From 4bb53b7e2abc5c45362f5a85d68401c927e83345 Mon Sep 17 00:00:00 2001 From: maliu Date: Thu, 2 Feb 2017 11:38:47 +0800 Subject: [PATCH 01/70] Bug 1333089 - Force update up indicator drawable in onCreate even locale did not change, r=sebastian MozReview-Commit-ID: Ltuuq16u571 --HG-- extra : rebase_source : decdad7d7ccb037afd0ad5967e31ba182060363b --- .../gecko/preferences/GeckoPreferences.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java index e1c696c4c038..7ab15e0f8da8 100644 --- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java +++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java @@ -233,6 +233,14 @@ public class GeckoPreferences } } + private void updateHomeAsUpIndicator() { + final ActionBar actionBar = getSupportActionBar(); + if (actionBar == null) { + return; + } + actionBar.setHomeAsUpIndicator(android.support.v7.appcompat.R.drawable.abc_ic_ab_back_mtrl_am_alpha); + } + /** * We only call this method for pre-HC versions of Android. */ @@ -263,10 +271,8 @@ public class GeckoPreferences // If activity is not recreated, also update locale to current activity configuration BrowserLocaleManager.getInstance().updateConfiguration(GeckoPreferences.this, newLocale); ViewUtil.setLayoutDirection(getWindow().getDecorView(), newLocale); - // Force update navigate up icon by current layout direction - final ActionBar actionBar = getSupportActionBar(); - actionBar.setHomeAsUpIndicator(android.support.v7.appcompat.R.drawable.abc_ic_ab_back_mtrl_am_alpha); + updateHomeAsUpIndicator(); this.lastLocale = newLocale; @@ -326,6 +332,11 @@ public class GeckoPreferences } private void checkLocale() { + if (AppConstants.Versions.feature21Plus && AppConstants.Versions.preMarshmallow) { + // Force update navigate up icon by current layout direction + updateHomeAsUpIndicator(); + } + final Locale currentLocale = Locale.getDefault(); Log.v(LOGTAG, "Checking locale: " + currentLocale + " vs " + lastLocale); if (currentLocale.equals(lastLocale)) { From af787a45416ce43ec49736282beb979df7584434 Mon Sep 17 00:00:00 2001 From: maliu Date: Fri, 3 Feb 2017 11:54:22 +0800 Subject: [PATCH 02/70] Bug 1326291 - Make width of SiteIdentity TextView as wrap_content to follow layout_gravity from layout_direction for RTL, r=sebastian MozReview-Commit-ID: Fk7VtHd1VMM --HG-- extra : rebase_source : 4fb07b73efe3ba48635de9f70710265d7e74ed9f --- mobile/android/base/resources/layout/site_identity.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/base/resources/layout/site_identity.xml b/mobile/android/base/resources/layout/site_identity.xml index b74c97c8327a..aea50665597b 100644 --- a/mobile/android/base/resources/layout/site_identity.xml +++ b/mobile/android/base/resources/layout/site_identity.xml @@ -29,7 +29,7 @@ android:layout_weight="1.0"> From 3f3207756c3d96d3e1144591ed02367868ecaef1 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Thu, 19 Jan 2017 20:14:32 +0000 Subject: [PATCH 03/70] Bug 1332411 - Enable print_via_parent for Tier3 platforms. r=ted MozReview-Commit-ID: v227rb4Ovh --HG-- extra : rebase_source : a96a161d62da46c55316bfc86e3ff79c429a1a3b --- modules/libpref/init/all.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 86abc7437462..f0f0bb67d1ed 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1108,7 +1108,7 @@ pref("print.print_edge_right", 0); pref("print.print_edge_bottom", 0); // Print via the parent process. This is only used when e10s is enabled. -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_LINUX) +#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) pref("print.print_via_parent", true); #else pref("print.print_via_parent", false); From 35d30a1e742cbbfd60581f187b991d7fca19e6ee Mon Sep 17 00:00:00 2001 From: Kirk Steuber Date: Thu, 2 Feb 2017 13:00:05 -0800 Subject: [PATCH 04/70] Bug 1333483 - Hardcode itisatrap manual testing URLs for Flash blocking into the SafeBrowsing module r=francois MozReview-Commit-ID: ASCt3VfRJgg --HG-- extra : rebase_source : 9c62b6fc16096a192aaf08e1a4e0307998cfe12d --- .../url-classifier/SafeBrowsing.jsm | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/toolkit/components/url-classifier/SafeBrowsing.jsm b/toolkit/components/url-classifier/SafeBrowsing.jsm index 01955668e68a..36cb3879b19b 100644 --- a/toolkit/components/url-classifier/SafeBrowsing.jsm +++ b/toolkit/components/url-classifier/SafeBrowsing.jsm @@ -374,6 +374,13 @@ this.SafeBrowsing = { const whitelistURL = "itisatrap.org/?resource=itisatracker.org"; const blockedURL = "itisatrap.org/firefox/blocked.html"; + const flashDenyURL = "flashblock.itisatrap.org/"; + const flashDenyExceptURL = "except.flashblock.itisatrap.org/"; + const flashAllowURL = "flashallow.itisatrap.org/"; + const flashAllowExceptURL = "except.flashallow.itisatrap.org/"; + const flashSubDocURL = "flashsubdoc.itisatrap.org/"; + const flashSubDocExceptURL = "except.flashsubdoc.itisatrap.org/"; + let update = "n:1000\ni:test-malware-simple\nad:1\n" + "a:1:32:" + malwareURL.length + "\n" + malwareURL + "\n"; @@ -395,6 +402,24 @@ this.SafeBrowsing = { update += "n:1000\ni:test-block-simple\nad:1\n" + "a:1:32:" + blockedURL.length + "\n" + blockedURL; + update += "n:1000\ni:test-flash-simple\nad:1\n" + + "a:1:32:" + flashDenyURL.length + "\n" + + flashDenyURL; + update += "n:1000\ni:testexcept-flash-simple\nad:1\n" + + "a:1:32:" + flashDenyExceptURL.length + "\n" + + flashDenyExceptURL; + update += "n:1000\ni:test-flashallow-simple\nad:1\n" + + "a:1:32:" + flashAllowURL.length + "\n" + + flashAllowURL; + update += "n:1000\ni:testexcept-flashallow-simple\nad:1\n" + + "a:1:32:" + flashAllowExceptURL.length + "\n" + + flashAllowExceptURL; + update += "n:1000\ni:test-flashsubdoc-simple\nad:1\n" + + "a:1:32:" + flashSubDocURL.length + "\n" + + flashSubDocURL; + update += "n:1000\ni:testexcept-flashsubdoc-simple\nad:1\n" + + "a:1:32:" + flashSubDocExceptURL.length + "\n" + + flashSubDocExceptURL; log("addMozEntries:", update); let db = Cc["@mozilla.org/url-classifier/dbservice;1"]. @@ -415,7 +440,7 @@ this.SafeBrowsing = { }; try { - let tables = "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple"; + let tables = "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,test-flash-simple,testexcept-flash-simple,test-flashallow-simple,testexcept-flashallow-simple,test-flashsubdoc-simple,testexcept-flashsubdoc-simple"; db.beginUpdate(dummyListener, tables, ""); db.beginStream("", ""); db.updateStream(update); From 82076a7ff16023ee2238ce02e612ab580307f084 Mon Sep 17 00:00:00 2001 From: Tomislav Jovanovic Date: Sat, 4 Feb 2017 20:48:38 +0100 Subject: [PATCH 05/70] Bug 1295072 - Focus urlbar after opening an empty new tab r=kmag MozReview-Commit-ID: 3dzCzHTxQrh --HG-- extra : rebase_source : 0098f06f83c77c03bb2f9eeb4031296f2b22cedb --- browser/components/extensions/ext-tabs.js | 4 +++ .../test/browser/browser_ext_tabs_create.js | 34 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/browser/components/extensions/ext-tabs.js b/browser/components/extensions/ext-tabs.js index 8603caff2210..ccd2961c02b3 100644 --- a/browser/components/extensions/ext-tabs.js +++ b/browser/components/extensions/ext-tabs.js @@ -418,6 +418,10 @@ extensions.registerSchemaAPI("tabs", "addon_parent", context => { window.gBrowser.pinTab(tab); } + if (active && !url) { + window.focusAndSelectUrlBar(); + } + if (createProperties.url && createProperties.url !== window.BROWSER_NEW_TAB_URL) { // We can't wait for a location change event for about:newtab, // since it may be pre-rendered, in which case its initial diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_create.js b/browser/components/extensions/test/browser/browser_ext_tabs_create.js index 8bc5a68a2ddc..bbe3e045db1a 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_create.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_create.js @@ -2,7 +2,7 @@ /* vim: set sts=2 sw=2 et tw=80: */ "use strict"; -add_task(function* () { +add_task(function* test_create_options() { let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:robots"); gBrowser.selectedTab = tab; @@ -164,3 +164,35 @@ add_task(function* () { yield BrowserTestUtils.removeTab(tab); }); +add_task(function* test_urlbar_focus() { + const extension = ExtensionTestUtils.loadExtension({ + background() { + browser.test.onMessage.addListener(async (cmd, ...args) => { + const result = await browser.tabs[cmd](...args); + browser.test.sendMessage("result", result); + }); + }, + }); + + yield extension.startup(); + + // Test content is focused after opening a regular url + extension.sendMessage("create", {url: "https://example.com"}); + const tab1 = yield extension.awaitMessage("result"); + + is(document.activeElement.tagName, "browser", "Content focused after opening a web page"); + + extension.sendMessage("remove", tab1.id); + yield extension.awaitMessage("result"); + + // Test urlbar is focused after opening an empty tab + extension.sendMessage("create", {}); + const tab2 = yield extension.awaitMessage("result"); + + ok(gURLBar.focused, "Urlbar focused after opening an empty tab"); + + extension.sendMessage("remove", tab2.id); + yield extension.awaitMessage("result"); + + yield extension.unload(); +}); From a17e96d75254f1bc369ff73a3638023504fe3d13 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 5 Feb 2017 13:23:21 -0800 Subject: [PATCH 06/70] Backed out changeset 70253d6678af (bug 1295072) for failures in browser_ext_tabs_create.js --- browser/components/extensions/ext-tabs.js | 4 --- .../test/browser/browser_ext_tabs_create.js | 34 +------------------ 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/browser/components/extensions/ext-tabs.js b/browser/components/extensions/ext-tabs.js index ccd2961c02b3..8603caff2210 100644 --- a/browser/components/extensions/ext-tabs.js +++ b/browser/components/extensions/ext-tabs.js @@ -418,10 +418,6 @@ extensions.registerSchemaAPI("tabs", "addon_parent", context => { window.gBrowser.pinTab(tab); } - if (active && !url) { - window.focusAndSelectUrlBar(); - } - if (createProperties.url && createProperties.url !== window.BROWSER_NEW_TAB_URL) { // We can't wait for a location change event for about:newtab, // since it may be pre-rendered, in which case its initial diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_create.js b/browser/components/extensions/test/browser/browser_ext_tabs_create.js index bbe3e045db1a..8bc5a68a2ddc 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_create.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_create.js @@ -2,7 +2,7 @@ /* vim: set sts=2 sw=2 et tw=80: */ "use strict"; -add_task(function* test_create_options() { +add_task(function* () { let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:robots"); gBrowser.selectedTab = tab; @@ -164,35 +164,3 @@ add_task(function* test_create_options() { yield BrowserTestUtils.removeTab(tab); }); -add_task(function* test_urlbar_focus() { - const extension = ExtensionTestUtils.loadExtension({ - background() { - browser.test.onMessage.addListener(async (cmd, ...args) => { - const result = await browser.tabs[cmd](...args); - browser.test.sendMessage("result", result); - }); - }, - }); - - yield extension.startup(); - - // Test content is focused after opening a regular url - extension.sendMessage("create", {url: "https://example.com"}); - const tab1 = yield extension.awaitMessage("result"); - - is(document.activeElement.tagName, "browser", "Content focused after opening a web page"); - - extension.sendMessage("remove", tab1.id); - yield extension.awaitMessage("result"); - - // Test urlbar is focused after opening an empty tab - extension.sendMessage("create", {}); - const tab2 = yield extension.awaitMessage("result"); - - ok(gURLBar.focused, "Urlbar focused after opening an empty tab"); - - extension.sendMessage("remove", tab2.id); - yield extension.awaitMessage("result"); - - yield extension.unload(); -}); From d144f3788851f3d0350f160b252c65dd68795f08 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Tue, 20 Dec 2016 18:53:39 +1100 Subject: [PATCH 07/70] Bug 1319987: P1. Remove handling for WaitingForKey in MFR. r=cpearce This is not compatible with promise based decoders. We'll re-implement it in a different fashion later on. MozReview-Commit-ID: HYBNKVxEUmB --HG-- extra : rebase_source : fe9f26e47b77a64099a422be844d20f4108663d0 --- dom/media/MediaFormatReader.cpp | 52 +++---------------- dom/media/MediaFormatReader.h | 11 +--- dom/media/platforms/PlatformDecoderModule.h | 6 --- .../agnostic/eme/SamplesWaitingForKey.cpp | 1 - .../agnostic/gmp/MediaDataDecoderProxy.h | 5 -- 5 files changed, 8 insertions(+), 67 deletions(-) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index f92faceaf586..1d8b5e36b8bd 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -1432,21 +1432,6 @@ MediaFormatReader::NotifyWaitingForData(TrackType aTrack) ScheduleUpdate(aTrack); } -void -MediaFormatReader::NotifyWaitingForKey(TrackType aTrack) -{ - MOZ_ASSERT(OnTaskQueue()); - auto& decoder = GetDecoderData(aTrack); - if (mDecoder) { - mDecoder->NotifyWaitingForKey(); - } - if (!decoder.mDecodePending) { - LOGV("WaitingForKey received while no pending decode. Ignoring"); - } - decoder.mWaitingForKey = true; - ScheduleUpdate(aTrack); -} - void MediaFormatReader::NotifyEndOfStream(TrackType aTrack) { @@ -1917,10 +1902,6 @@ MediaFormatReader::Update(TrackType aTrack) // EOS state. We can immediately reject the data promise. LOG("Rejecting %s promise: EOS", TrackTypeToStr(aTrack)); decoder.RejectPromise(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__); - } else if (decoder.mWaitingForKey) { - LOG("Rejecting %s promise: WAITING_FOR_DATA due to waiting for key", - TrackTypeToStr(aTrack)); - decoder.RejectPromise(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA, __func__); } } @@ -1954,30 +1935,20 @@ MediaFormatReader::Update(TrackType aTrack) bool needInput = NeedInput(decoder); - LOGV("Update(%s) ni=%d no=%d ie=%d, in:%llu out:%llu qs=%u pending:%u waiting:%d promise:%d wfk:%d sid:%u", + LOGV("Update(%s) ni=%d no=%d ie=%d, in:%llu out:%llu qs=%u pending:%u waiting:%d promise:%d sid:%u", TrackTypeToStr(aTrack), needInput, needOutput, decoder.mDecodePending, decoder.mNumSamplesInput, decoder.mNumSamplesOutput, uint32_t(size_t(decoder.mSizeOfQueue)), uint32_t(decoder.mOutput.Length()), decoder.mWaitingForData, decoder.HasPromise(), - decoder.mWaitingForKey, decoder.mLastStreamSourceID); + decoder.mLastStreamSourceID); if ((decoder.mWaitingForData && - (!decoder.mTimeThreshold || decoder.mTimeThreshold.ref().mWaiting)) || - (decoder.mWaitingForKey && decoder.mDecodePending)) { + (!decoder.mTimeThreshold || decoder.mTimeThreshold.ref().mWaiting))) { // Nothing more we can do at present. LOGV("Still waiting for data or key."); return; } - if (decoder.mWaitingForKey) { - decoder.mWaitingForKey = false; - if (decoder.HasWaitingPromise() && !decoder.IsWaiting()) { - LOGV("No longer waiting for key. Resolving waiting promise"); - decoder.mWaitingPromise.Resolve(decoder.mType, __func__); - return; - } - } - if (!needInput) { LOGV("No need for additional input (pending:%u)", uint32_t(decoder.mOutput.Length())); @@ -2148,15 +2119,6 @@ MediaFormatReader::Error(TrackType aTrack, const MediaResult& aError) OwnerThread()->Dispatch(task.forget()); } -void -MediaFormatReader::WaitingForKey(TrackType aTrack) -{ - RefPtr task = - NewRunnableMethod( - this, &MediaFormatReader::NotifyWaitingForKey, aTrack); - OwnerThread()->Dispatch(task.forget()); -} - void MediaFormatReader::Reset(TrackType aTrack) { @@ -2677,7 +2639,7 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString) result += nsPrintfCString("audio frames decoded: %lld\n", mAudio.mNumSamplesOutputTotal); if (HasAudio()) { - result += nsPrintfCString("audio state: ni=%d no=%d ie=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d wfk:%d sid:%u\n", + result += nsPrintfCString("audio state: ni=%d no=%d ie=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", NeedInput(mAudio), mAudio.HasPromise(), mAudio.mDecodePending, mAudio.mDemuxRequest.Exists(), @@ -2691,7 +2653,7 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString) mAudio.mNumSamplesInput, mAudio.mNumSamplesOutput, unsigned(size_t(mAudio.mSizeOfQueue)), unsigned(mAudio.mOutput.Length()), - mAudio.mWaitingForData, mAudio.mWaitingForKey, + mAudio.mWaitingForData, mAudio.mLastStreamSourceID); } result += nsPrintfCString("video decoder: %s\n", videoName); @@ -2701,7 +2663,7 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString) mVideo.mNumSamplesOutputTotal, mVideo.mNumSamplesSkippedTotal); if (HasVideo()) { - result += nsPrintfCString("video state: ni=%d no=%d ie=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d wfk:%d, sid:%u\n", + result += nsPrintfCString("video state: ni=%d no=%d ie=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", NeedInput(mVideo), mVideo.HasPromise(), mVideo.mDecodePending, mVideo.mDemuxRequest.Exists(), @@ -2715,7 +2677,7 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString) mVideo.mNumSamplesInput, mVideo.mNumSamplesOutput, unsigned(size_t(mVideo.mSizeOfQueue)), unsigned(mVideo.mOutput.Length()), - mVideo.mWaitingForData, mVideo.mWaitingForKey, + mVideo.mWaitingForData, mVideo.mLastStreamSourceID); } aString += result; diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index e9e5ddd0cd61..1c4f0ca39740 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -141,7 +141,6 @@ private: void NotifyDrainComplete(TrackType aTrack); void NotifyError(TrackType aTrack, const MediaResult& aError); void NotifyWaitingForData(TrackType aTrack); - void NotifyWaitingForKey(TrackType aTrack); void NotifyEndOfStream(TrackType aTrack); void ExtractCryptoInitData(nsTArray& aInitData); @@ -157,7 +156,6 @@ private: void Reset(TrackType aTrack); void DrainComplete(TrackType aTrack); void DropDecodedSamples(TrackType aTrack); - void WaitingForKey(TrackType aTrack); bool ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold); @@ -192,10 +190,6 @@ private: bool OnReaderTaskQueue() override { return mReader->OnTaskQueue(); } - void WaitingForKey() override { - mReader->WaitingForKey(mType); - } - private: MediaFormatReader* mReader; TrackType mType; @@ -212,7 +206,6 @@ private: , mUpdateScheduled(false) , mDemuxEOS(false) , mWaitingForData(false) - , mWaitingForKey(false) , mReceivedNewData(false) , mOutputRequested(false) , mDecodePending(false) @@ -260,7 +253,6 @@ private: bool mUpdateScheduled; bool mDemuxEOS; bool mWaitingForData; - bool mWaitingForKey; bool mReceivedNewData; // Pending seek. @@ -280,7 +272,7 @@ private: bool IsWaiting() const { MOZ_ASSERT(mOwner->OnTaskQueue()); - return mWaitingForData || mWaitingForKey; + return mWaitingForData; } // MediaDataDecoder handler's variables. @@ -383,7 +375,6 @@ private: MOZ_ASSERT(mOwner->OnTaskQueue()); mDemuxEOS = false; mWaitingForData = false; - mWaitingForKey = false; mQueuedSamples.Clear(); mOutputRequested = false; mNeedDraining = false; diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index 0d7b71e644db..511104e564f4 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -206,12 +206,6 @@ public: virtual void ReleaseMediaResources() {} virtual bool OnReaderTaskQueue() = 0; - - // Denotes that a pending encryption key is preventing more input being fed - // into the decoder. This only needs to be overridden for callbacks that - // handle encryption. E.g. benchmarking does not use eme, so this need - // not be overridden in that case. - virtual void WaitingForKey() {} }; // MediaDataDecoder is the interface exposed by decoders created by the diff --git a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp index 58098c2b39a2..86180d58ba66 100644 --- a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp +++ b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp @@ -40,7 +40,6 @@ SamplesWaitingForKey::WaitIfKeyNotUsable(MediaRawData* aSample) MutexAutoLock lock(mMutex); mSamples.AppendElement(aSample); } - mDecoderCallback->WaitingForKey(); caps.NotifyWhenKeyIdUsable(aSample->mCrypto.mKeyId, this); return true; } diff --git a/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h b/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h index 735b6126ee67..1e108994da4e 100644 --- a/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h +++ b/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h @@ -95,11 +95,6 @@ public: return mProxyCallback->OnReaderTaskQueue(); } - void WaitingForKey() override - { - mProxyCallback->WaitingForKey(); - } - private: MediaDataDecoderProxy* mProxyDecoder; MediaDataDecoderCallback* mProxyCallback; From 6e774a7bcdaf30b83ea3ee73071cfcb05e09078b Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Wed, 21 Dec 2016 10:52:01 +1100 Subject: [PATCH 08/70] Bug 1319987: P2. Remove FuzzingWrapper. r=gerald It is no longer used and in its current state incompatible with promise based decoders. We'll re-add it later. MozReview-Commit-ID: DHsyTsFvTZB --HG-- extra : rebase_source : 4b1a7dba2a001ff32ffe4ef4df63b91f15a43e83 --- dom/media/platforms/PDMFactory.cpp | 22 +- dom/media/platforms/moz.build | 2 - .../platforms/wrappers/FuzzingWrapper.cpp | 328 ------------------ dom/media/platforms/wrappers/FuzzingWrapper.h | 124 ------- 4 files changed, 2 insertions(+), 474 deletions(-) delete mode 100644 dom/media/platforms/wrappers/FuzzingWrapper.cpp delete mode 100644 dom/media/platforms/wrappers/FuzzingWrapper.h diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp index d86e6a440ccb..f3a167d367a3 100644 --- a/dom/media/platforms/PDMFactory.cpp +++ b/dom/media/platforms/PDMFactory.cpp @@ -35,7 +35,6 @@ #include "MediaInfo.h" #include "MediaPrefs.h" -#include "FuzzingWrapper.h" #include "H264Converter.h" #include "AgnosticDecoderModule.h" @@ -287,21 +286,8 @@ PDMFactory::CreateDecoderWithPDM(PlatformDecoderModule* aPDM, return nullptr; } - MediaDataDecoderCallback* callback = aParams.mCallback; - RefPtr callbackWrapper; - if (MediaPrefs::PDMFuzzingEnabled()) { - callbackWrapper = new DecoderCallbackFuzzingWrapper(callback); - callbackWrapper->SetVideoOutputMinimumInterval( - TimeDuration::FromMilliseconds(MediaPrefs::PDMFuzzingInterval())); - callbackWrapper->SetDontDelayInputExhausted(!MediaPrefs::PDMFuzzingDelayInputExhausted()); - callback = callbackWrapper.get(); - } - - CreateDecoderParams params = aParams; - params.mCallback = callback; - if (MP4Decoder::IsH264(config.mMimeType) && !aParams.mUseBlankDecoder) { - RefPtr h = new H264Converter(aPDM, params); + RefPtr h = new H264Converter(aPDM, aParams); const nsresult rv = h->GetLastError(); if (NS_SUCCEEDED(rv) || rv == NS_ERROR_NOT_INITIALIZED) { // The H264Converter either successfully created the wrapped decoder, @@ -310,11 +296,7 @@ PDMFactory::CreateDecoderWithPDM(PlatformDecoderModule* aPDM, m = h.forget(); } } else { - m = aPDM->CreateVideoDecoder(params); - } - - if (callbackWrapper && m) { - m = new DecoderFuzzingWrapper(m.forget(), callbackWrapper.forget()); + m = aPDM->CreateVideoDecoder(aParams); } return m.forget(); diff --git a/dom/media/platforms/moz.build b/dom/media/platforms/moz.build index 310820c91225..95deb6e9cb38 100644 --- a/dom/media/platforms/moz.build +++ b/dom/media/platforms/moz.build @@ -13,7 +13,6 @@ EXPORTS += [ 'MediaTelemetryConstants.h', 'PDMFactory.h', 'PlatformDecoderModule.h', - 'wrappers/FuzzingWrapper.h', 'wrappers/H264Converter.h' ] @@ -26,7 +25,6 @@ UNIFIED_SOURCES += [ 'agnostic/VPXDecoder.cpp', 'agnostic/WAVDecoder.cpp', 'PDMFactory.cpp', - 'wrappers/FuzzingWrapper.cpp', 'wrappers/H264Converter.cpp' ] diff --git a/dom/media/platforms/wrappers/FuzzingWrapper.cpp b/dom/media/platforms/wrappers/FuzzingWrapper.cpp deleted file mode 100644 index a5243a33b595..000000000000 --- a/dom/media/platforms/wrappers/FuzzingWrapper.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "FuzzingWrapper.h" - -mozilla::LogModule* GetFuzzingWrapperLog() { - static mozilla::LazyLogModule log("MediaFuzzingWrapper"); - return log; -} -#define DFW_LOGD(arg, ...) MOZ_LOG(GetFuzzingWrapperLog(), mozilla::LogLevel::Debug, ("DecoderFuzzingWrapper(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define DFW_LOGV(arg, ...) MOZ_LOG(GetFuzzingWrapperLog(), mozilla::LogLevel::Verbose, ("DecoderFuzzingWrapper(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define CFW_LOGD(arg, ...) MOZ_LOG(GetFuzzingWrapperLog(), mozilla::LogLevel::Debug, ("DecoderCallbackFuzzingWrapper(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define CFW_LOGV(arg, ...) MOZ_LOG(GetFuzzingWrapperLog(), mozilla::LogLevel::Verbose, ("DecoderCallbackFuzzingWrapper(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) - -namespace mozilla { - -DecoderFuzzingWrapper::DecoderFuzzingWrapper( - already_AddRefed aDecoder, - already_AddRefed aCallbackWrapper) - : mDecoder(aDecoder) - , mCallbackWrapper(aCallbackWrapper) -{ - DFW_LOGV("aDecoder=%p aCallbackWrapper=%p", mDecoder.get(), mCallbackWrapper.get()); -} - -DecoderFuzzingWrapper::~DecoderFuzzingWrapper() -{ - DFW_LOGV(""); -} - -RefPtr -DecoderFuzzingWrapper::Init() -{ - DFW_LOGV(""); - MOZ_ASSERT(mDecoder); - return mDecoder->Init(); -} - -void -DecoderFuzzingWrapper::Input(MediaRawData* aData) -{ - DFW_LOGV("aData.mTime=%lld", aData->mTime); - MOZ_ASSERT(mDecoder); - mDecoder->Input(aData); -} - -void -DecoderFuzzingWrapper::Flush() -{ - DFW_LOGV("Calling mDecoder[%p]->Flush()", mDecoder.get()); - MOZ_ASSERT(mDecoder); - // Flush may output some frames (though unlikely). - // Flush may block a bit, it's ok if we output some frames in the meantime. - mDecoder->Flush(); - DFW_LOGV("mDecoder[%p]->Flush()", mDecoder.get()); - // Clear any delayed output we may have. - mCallbackWrapper->ClearDelayedOutput(); -} - -void -DecoderFuzzingWrapper::Drain() -{ - DFW_LOGV(""); - MOZ_ASSERT(mDecoder); - // Note: The decoder should callback DrainComplete(), we'll drain the - // delayed output (if any) then. - mDecoder->Drain(); -} - -void -DecoderFuzzingWrapper::Shutdown() -{ - DFW_LOGV(""); - MOZ_ASSERT(mDecoder); - // Both shutdowns below may block a bit. - mDecoder->Shutdown(); - mCallbackWrapper->Shutdown(); -} - -bool -DecoderFuzzingWrapper::IsHardwareAccelerated(nsACString& aFailureReason) const -{ - DFW_LOGV(""); - MOZ_ASSERT(mDecoder); - return mDecoder->IsHardwareAccelerated(aFailureReason); -} - -DecoderCallbackFuzzingWrapper::DecoderCallbackFuzzingWrapper(MediaDataDecoderCallback* aCallback) - : mCallback(aCallback) - , mDontDelayInputExhausted(false) - , mDraining(false) - , mTaskQueue(new TaskQueue(SharedThreadPool::Get(NS_LITERAL_CSTRING("MediaFuzzingWrapper"), 1))) -{ - CFW_LOGV("aCallback=%p", aCallback); -} - -DecoderCallbackFuzzingWrapper::~DecoderCallbackFuzzingWrapper() -{ - CFW_LOGV(""); -} - -void -DecoderCallbackFuzzingWrapper::SetVideoOutputMinimumInterval( - TimeDuration aFrameOutputMinimumInterval) -{ - CFW_LOGD("aFrameOutputMinimumInterval=%fms", - aFrameOutputMinimumInterval.ToMilliseconds()); - mFrameOutputMinimumInterval = aFrameOutputMinimumInterval; -} - -void -DecoderCallbackFuzzingWrapper::SetDontDelayInputExhausted( - bool aDontDelayInputExhausted) -{ - CFW_LOGD("aDontDelayInputExhausted=%d", - aDontDelayInputExhausted); - mDontDelayInputExhausted = aDontDelayInputExhausted; -} - -void -DecoderCallbackFuzzingWrapper::Output(MediaData* aData) -{ - if (!mTaskQueue->IsCurrentThreadIn()) { - nsCOMPtr task = - NewRunnableMethod>( - this, &DecoderCallbackFuzzingWrapper::Output, aData); - mTaskQueue->Dispatch(task.forget()); - return; - } - CFW_LOGV("aData.mTime=%lld", aData->mTime); - MOZ_ASSERT(mCallback); - if (mFrameOutputMinimumInterval) { - if (!mPreviousOutput.IsNull()) { - if (!mDelayedOutput.empty()) { - // We already have some delayed frames, just add this one to the queue. - mDelayedOutput.push_back(MakePair, bool>(aData, false)); - CFW_LOGD("delaying output of sample@%lld, total queued:%d", - aData->mTime, int(mDelayedOutput.size())); - return; - } - if (TimeStamp::Now() < mPreviousOutput + mFrameOutputMinimumInterval) { - // Frame arriving too soon after the previous one, start queuing. - mDelayedOutput.push_back(MakePair, bool>(aData, false)); - CFW_LOGD("delaying output of sample@%lld, first queued", aData->mTime); - if (!mDelayedOutputTimer) { - mDelayedOutputTimer = new MediaTimer(); - } - ScheduleOutputDelayedFrame(); - return; - } - } - // If we're here, we're going to actually output a frame -> Record time. - mPreviousOutput = TimeStamp::Now(); - } - - // Passing the data straight through, no need to dispatch to another queue, - // callback should deal with that. - mCallback->Output(aData); -} - -void -DecoderCallbackFuzzingWrapper::Error(const MediaResult& aError) -{ - if (!mTaskQueue->IsCurrentThreadIn()) { - mTaskQueue->Dispatch(NewRunnableMethod( - this, &DecoderCallbackFuzzingWrapper::Error, aError)); - return; - } - CFW_LOGV(""); - MOZ_ASSERT(mCallback); - ClearDelayedOutput(); - mCallback->Error(aError); -} - -void -DecoderCallbackFuzzingWrapper::InputExhausted() -{ - if (!mTaskQueue->IsCurrentThreadIn()) { - mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::InputExhausted)); - return; - } - if (!mDontDelayInputExhausted && !mDelayedOutput.empty()) { - MediaDataAndInputExhausted& last = mDelayedOutput.back(); - CFW_LOGD("InputExhausted delayed until after output of sample@%lld", - last.first()->mTime); - last.second() = true; - return; - } - CFW_LOGV(""); - MOZ_ASSERT(mCallback); - mCallback->InputExhausted(); -} - -void -DecoderCallbackFuzzingWrapper::DrainComplete() -{ - if (!mTaskQueue->IsCurrentThreadIn()) { - mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::DrainComplete)); - return; - } - MOZ_ASSERT(mCallback); - if (mDelayedOutput.empty()) { - // No queued output -> Draining is complete now. - CFW_LOGV("No delayed output -> DrainComplete now"); - mCallback->DrainComplete(); - } else { - // Queued output waiting -> Make sure we call DrainComplete when it's empty. - CFW_LOGD("Delayed output -> DrainComplete later"); - mDraining = true; - } -} - -void -DecoderCallbackFuzzingWrapper::ReleaseMediaResources() -{ - if (!mTaskQueue->IsCurrentThreadIn()) { - mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ReleaseMediaResources)); - return; - } - CFW_LOGV(""); - MOZ_ASSERT(mCallback); - mCallback->ReleaseMediaResources(); -} - -bool -DecoderCallbackFuzzingWrapper::OnReaderTaskQueue() -{ - CFW_LOGV(""); - MOZ_ASSERT(mCallback); - return mCallback->OnReaderTaskQueue(); -} - -void -DecoderCallbackFuzzingWrapper::ScheduleOutputDelayedFrame() -{ - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - if (mDelayedOutputRequest.Exists()) { - // A delayed output is already scheduled, no need for more than one timer. - return; - } - RefPtr self = this; - mDelayedOutputTimer->WaitUntil( - mPreviousOutput + mFrameOutputMinimumInterval, - __func__) - ->Then(mTaskQueue, __func__, - [self] () -> void { - if (self->mDelayedOutputRequest.Exists()) { - self->mDelayedOutputRequest.Complete(); - self->OutputDelayedFrame(); - } - }, - [self] () -> void { - if (self->mDelayedOutputRequest.Exists()) { - self->mDelayedOutputRequest.Complete(); - self->ClearDelayedOutput(); - } - }) - ->Track(mDelayedOutputRequest); -} - -void -DecoderCallbackFuzzingWrapper::OutputDelayedFrame() -{ - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - if (mDelayedOutput.empty()) { - if (mDraining) { - // No more output, and we were draining -> Send DrainComplete. - mDraining = false; - mCallback->DrainComplete(); - } - return; - } - MediaDataAndInputExhausted& data = mDelayedOutput.front(); - CFW_LOGD("Outputting delayed sample@%lld, remaining:%d", - data.first()->mTime, int(mDelayedOutput.size() - 1)); - mPreviousOutput = TimeStamp::Now(); - mCallback->Output(data.first()); - if (data.second()) { - CFW_LOGD("InputExhausted after delayed sample@%lld", data.first()->mTime); - mCallback->InputExhausted(); - } - mDelayedOutput.pop_front(); - if (!mDelayedOutput.empty()) { - // More output -> Send it later. - ScheduleOutputDelayedFrame(); - } else if (mDraining) { - // No more output, and we were draining -> Send DrainComplete. - CFW_LOGD("DrainComplete"); - mDraining = false; - mCallback->DrainComplete(); - } -} - -void -DecoderCallbackFuzzingWrapper::ClearDelayedOutput() -{ - if (!mTaskQueue->IsCurrentThreadIn()) { - DFW_LOGV("(dispatching self)"); - mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ClearDelayedOutput)); - return; - } - DFW_LOGV(""); - // In case a timer hasn't lapsed yet, before destroying the timer and its - // attached waitUntil() promise, the 'Then' request must be disconnected. - mDelayedOutputRequest.DisconnectIfExists(); - mDelayedOutputTimer = nullptr; - mDelayedOutput.clear(); -} - -void -DecoderCallbackFuzzingWrapper::Shutdown() -{ - CFW_LOGV("Clear delayed output (if any) before shutting down mTaskQueue"); - ClearDelayedOutput(); - // Await idle here, so that 'ClearDelayedOutput' runs to completion before - // the task queue is shutdown (and tasks can't be queued anymore). - mTaskQueue->AwaitIdle(); - - CFW_LOGV("Shutting down mTaskQueue"); - mTaskQueue->BeginShutdown(); - mTaskQueue->AwaitIdle(); - CFW_LOGV("mTaskQueue shut down"); -} - -} // namespace mozilla diff --git a/dom/media/platforms/wrappers/FuzzingWrapper.h b/dom/media/platforms/wrappers/FuzzingWrapper.h deleted file mode 100644 index c2b737520761..000000000000 --- a/dom/media/platforms/wrappers/FuzzingWrapper.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#if !defined(FuzzingWrapper_h_) -#define FuzzingWrapper_h_ - -#include "mozilla/Pair.h" -#include "PlatformDecoderModule.h" - -#include - -namespace mozilla { - -// Fuzzing wrapper for media decoders. -// -// DecoderFuzzingWrapper owns the DecoderCallbackFuzzingWrapper, and inserts -// itself between the reader and the decoder. -// DecoderCallbackFuzzingWrapper inserts itself between a decoder and its -// callback. -// Together they are used to introduce some fuzzing, (e.g. delay output). -// -// Normally: -// ====================================> -// reader decoder -// <------------------------------------ -// -// With fuzzing: -// ======> DecoderFuzzingWrapper ======> -// reader v decoder -// <-- DecoderCallbackFuzzingWrapper <-- -// -// Creation order should be: -// 1. Create DecoderCallbackFuzzingWrapper, give the expected callback target. -// 2. Create actual decoder, give DecoderCallbackFuzzingWrapper as callback. -// 3. Create DecoderFuzzingWrapper, give decoder and DecoderCallbackFuzzingWrapper. -// DecoderFuzzingWrapper is what the reader sees as decoder, it owns the -// real decoder and the DecoderCallbackFuzzingWrapper. - -class DecoderCallbackFuzzingWrapper : public MediaDataDecoderCallback -{ -public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DecoderCallbackFuzzingWrapper) - - explicit DecoderCallbackFuzzingWrapper(MediaDataDecoderCallback* aCallback); - - // Enforce a minimum interval between output frames (i.e., limit frame rate). - // Of course, if the decoder is even slower, this won't have any effect. - void SetVideoOutputMinimumInterval(TimeDuration aFrameOutputMinimumInterval); - // If false (default), if frames are delayed, any InputExhausted is delayed to - // be later sent after the corresponding delayed frame. - // If true, InputExhausted are passed through immediately; This could result - // in lots of frames being decoded and queued for delayed output! - void SetDontDelayInputExhausted(bool aDontDelayInputExhausted); - -private: - virtual ~DecoderCallbackFuzzingWrapper(); - - // MediaDataDecoderCallback implementation. - void Output(MediaData* aData) override; - void Error(const MediaResult& aError) override; - void InputExhausted() override; - void DrainComplete() override; - void ReleaseMediaResources() override; - bool OnReaderTaskQueue() override; - - MediaDataDecoderCallback* mCallback; - - // Settings for minimum frame output interval & InputExhausted, - // should be set during init and then only read on mTaskQueue. - TimeDuration mFrameOutputMinimumInterval; - bool mDontDelayInputExhausted; - // Members for minimum frame output interval & InputExhausted, - // should only be accessed on mTaskQueue. - TimeStamp mPreviousOutput; - // First member is the frame to be delayed. - // Second member is true if an 'InputExhausted' arrived after that frame; in - // which case an InputExhausted will be sent after finally outputting the frame. - typedef Pair, bool> MediaDataAndInputExhausted; - std::deque mDelayedOutput; - RefPtr mDelayedOutputTimer; - MozPromiseRequestHolder mDelayedOutputRequest; - // If draining, a 'DrainComplete' will be sent after all delayed frames have - // been output. - bool mDraining; - // All callbacks are redirected through this task queue, both to avoid locking - // and to have a consistent sequencing of callbacks. - RefPtr mTaskQueue; - void ScheduleOutputDelayedFrame(); - void OutputDelayedFrame(); -public: // public for the benefit of DecoderFuzzingWrapper. - void ClearDelayedOutput(); - void Shutdown(); -}; - -class DecoderFuzzingWrapper : public MediaDataDecoder -{ -public: - DecoderFuzzingWrapper(already_AddRefed aDecoder, - already_AddRefed aCallbackWrapper); - - // MediaDataDecoder implementation. - RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; - bool IsHardwareAccelerated(nsACString& aFailureReason) const override; - const char* GetDescriptionName() const override - { - return mDecoder->GetDescriptionName(); - } - -private: - virtual ~DecoderFuzzingWrapper(); - RefPtr mDecoder; - RefPtr mCallbackWrapper; -}; - -} // namespace mozilla - -#endif From 6a0bd6027f6bc01c04fb359c1cf6a0e509662aec Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 30 Dec 2016 01:26:12 +1100 Subject: [PATCH 09/70] Bug 1319987: P3. Remove Gonk PDM. r=cpearce The platform is no longer supported, and the promisifying of the MediaDataDecoder makes it not worthwhile to continue maintenance. MozReview-Commit-ID: FjDzRk5YQp3 --HG-- extra : rebase_source : a28f0e2cada698f5be93c9115b1af6c7789f9d4e --- .../gonk/GonkAudioDecoderManager.cpp | 268 ------ .../platforms/gonk/GonkAudioDecoderManager.h | 59 -- .../platforms/gonk/GonkDecoderModule.cpp | 63 -- dom/media/platforms/gonk/GonkDecoderModule.h | 37 - .../platforms/gonk/GonkMediaDataDecoder.cpp | 385 --------- .../platforms/gonk/GonkMediaDataDecoder.h | 214 ----- .../gonk/GonkVideoDecoderManager.cpp | 772 ------------------ .../platforms/gonk/GonkVideoDecoderManager.h | 149 ---- dom/media/platforms/gonk/moz.build | 39 - dom/media/platforms/moz.build | 4 - 10 files changed, 1990 deletions(-) delete mode 100644 dom/media/platforms/gonk/GonkAudioDecoderManager.cpp delete mode 100644 dom/media/platforms/gonk/GonkAudioDecoderManager.h delete mode 100644 dom/media/platforms/gonk/GonkDecoderModule.cpp delete mode 100644 dom/media/platforms/gonk/GonkDecoderModule.h delete mode 100644 dom/media/platforms/gonk/GonkMediaDataDecoder.cpp delete mode 100644 dom/media/platforms/gonk/GonkMediaDataDecoder.h delete mode 100644 dom/media/platforms/gonk/GonkVideoDecoderManager.cpp delete mode 100644 dom/media/platforms/gonk/GonkVideoDecoderManager.h delete mode 100644 dom/media/platforms/gonk/moz.build diff --git a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp deleted file mode 100644 index 0bc3fbea9af0..000000000000 --- a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "MediaCodecProxy.h" -#include -#include -#include -#include "GonkAudioDecoderManager.h" -#include "MediaDecoderReader.h" -#include "VideoUtils.h" -#include "nsTArray.h" -#include "mozilla/Logging.h" -#include "stagefright/MediaBuffer.h" -#include "stagefright/MetaData.h" -#include "stagefright/MediaErrors.h" -#include -#include -#include "media/openmax/OMX_Audio.h" -#include "MediaData.h" -#include "MediaInfo.h" - -#define CODECCONFIG_TIMEOUT_US 10000LL -#define READ_OUTPUT_BUFFER_TIMEOUT_US 0LL - -#include -#define GADM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkAudioDecoderManager", __VA_ARGS__) - -#define LOG(...) MOZ_LOG(sPDMLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) - -using namespace android; -typedef android::MediaCodecProxy MediaCodecProxy; - -namespace mozilla { - -GonkAudioDecoderManager::GonkAudioDecoderManager(const AudioInfo& aConfig) - : mAudioChannels(aConfig.mChannels) - , mAudioRate(aConfig.mRate) - , mAudioProfile(aConfig.mProfile) - , mAudioCompactor(mAudioQueue) -{ - MOZ_COUNT_CTOR(GonkAudioDecoderManager); - MOZ_ASSERT(mAudioChannels); - mCodecSpecificData = aConfig.mCodecSpecificConfig; - mMimeType = aConfig.mMimeType; -} - -GonkAudioDecoderManager::~GonkAudioDecoderManager() -{ - MOZ_COUNT_DTOR(GonkAudioDecoderManager); -} - -RefPtr -GonkAudioDecoderManager::Init() -{ - if (InitMediaCodecProxy()) { - return InitPromise::CreateAndResolve(TrackType::kAudioTrack, __func__); - } else { - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - } -} - -bool -GonkAudioDecoderManager::InitMediaCodecProxy() -{ - status_t rv = OK; - if (!InitLoopers(MediaData::AUDIO_DATA)) { - return false; - } - - mDecoder = MediaCodecProxy::CreateByType(mDecodeLooper, mMimeType.get(), false); - if (!mDecoder.get()) { - return false; - } - if (!mDecoder->AllocateAudioMediaCodec()) - { - mDecoder = nullptr; - return false; - } - sp format = new AMessage; - // Fixed values - GADM_LOG("Configure audio mime type:%s, chan no:%d, sample-rate:%d, profile:%d", - mMimeType.get(), mAudioChannels, mAudioRate, mAudioProfile); - format->setString("mime", mMimeType.get()); - format->setInt32("channel-count", mAudioChannels); - format->setInt32("sample-rate", mAudioRate); - format->setInt32("aac-profile", mAudioProfile); - status_t err = mDecoder->configure(format, nullptr, nullptr, 0); - if (err != OK || !mDecoder->Prepare()) { - return false; - } - - if (mMimeType.EqualsLiteral("audio/mp4a-latm")) { - rv = mDecoder->Input(mCodecSpecificData->Elements(), mCodecSpecificData->Length(), 0, - android::MediaCodec::BUFFER_FLAG_CODECCONFIG, - CODECCONFIG_TIMEOUT_US); - } - - if (rv == OK) { - return true; - } else { - GADM_LOG("Failed to input codec specific data!"); - return false; - } -} - -nsresult -GonkAudioDecoderManager::CreateAudioData(MediaBuffer* aBuffer, int64_t aStreamOffset) -{ - if (!(aBuffer != nullptr && aBuffer->data() != nullptr)) { - GADM_LOG("Audio Buffer is not valid!"); - return NS_ERROR_UNEXPECTED; - } - - int64_t timeUs; - if (!aBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) { - return NS_ERROR_UNEXPECTED; - } - - if (aBuffer->range_length() == 0) { - // Some decoders may return spurious empty buffers that we just want to ignore - // quoted from Android's AwesomePlayer.cpp - return NS_ERROR_NOT_AVAILABLE; - } - - if (mLastTime > timeUs) { - GADM_LOG("Output decoded sample time is revert. time=%lld", timeUs); - MOZ_ASSERT(false); - return NS_ERROR_NOT_AVAILABLE; - } - mLastTime = timeUs; - - const uint8_t *data = static_cast(aBuffer->data()); - size_t dataOffset = aBuffer->range_offset(); - size_t size = aBuffer->range_length(); - - uint32_t frames = size / (2 * mAudioChannels); - - CheckedInt64 duration = FramesToUsecs(frames, mAudioRate); - if (!duration.isValid()) { - return NS_ERROR_UNEXPECTED; - } - - typedef AudioCompactor::NativeCopy OmxCopy; - mAudioCompactor.Push(aStreamOffset, - timeUs, - mAudioRate, - frames, - mAudioChannels, - OmxCopy(data+dataOffset, - size, - mAudioChannels)); - return NS_OK; -} - -nsresult -GonkAudioDecoderManager::Output(int64_t aStreamOffset, - RefPtr& aOutData) -{ - aOutData = nullptr; - if (mAudioQueue.GetSize() > 0) { - aOutData = mAudioQueue.PopFront(); - return mAudioQueue.AtEndOfStream() ? NS_ERROR_ABORT : NS_OK; - } - - status_t err; - MediaBuffer* audioBuffer = nullptr; - err = mDecoder->Output(&audioBuffer, READ_OUTPUT_BUFFER_TIMEOUT_US); - AutoReleaseMediaBuffer a(audioBuffer, mDecoder.get()); - - switch (err) { - case OK: - { - nsresult rv = CreateAudioData(audioBuffer, aStreamOffset); - NS_ENSURE_SUCCESS(rv, rv); - break; - } - case android::INFO_FORMAT_CHANGED: - { - // If the format changed, update our cached info. - GADM_LOG("Decoder format changed"); - sp audioCodecFormat; - - if (mDecoder->getOutputFormat(&audioCodecFormat) != OK || - audioCodecFormat == nullptr) { - return NS_ERROR_UNEXPECTED; - } - - int32_t codec_channel_count = 0; - int32_t codec_sample_rate = 0; - - if (!audioCodecFormat->findInt32("channel-count", &codec_channel_count) || - !audioCodecFormat->findInt32("sample-rate", &codec_sample_rate)) { - return NS_ERROR_UNEXPECTED; - } - - // Update AudioInfo - AudioConfig::ChannelLayout layout(codec_channel_count); - if (!layout.IsValid()) { - return NS_ERROR_FAILURE; - } - mAudioChannels = codec_channel_count; - mAudioRate = codec_sample_rate; - - return Output(aStreamOffset, aOutData); - } - case android::INFO_OUTPUT_BUFFERS_CHANGED: - { - GADM_LOG("Info Output Buffers Changed"); - if (mDecoder->UpdateOutputBuffers()) { - return Output(aStreamOffset, aOutData); - } - return NS_ERROR_FAILURE; - } - case -EAGAIN: - { - return NS_ERROR_NOT_AVAILABLE; - } - case android::ERROR_END_OF_STREAM: - { - GADM_LOG("Got EOS frame!"); - nsresult rv = CreateAudioData(audioBuffer, aStreamOffset); - NS_ENSURE_SUCCESS(rv, NS_ERROR_ABORT); - MOZ_ASSERT(mAudioQueue.GetSize() > 0); - mAudioQueue.Finish(); - break; - } - case -ETIMEDOUT: - { - GADM_LOG("Timeout. can try again next time"); - return NS_ERROR_UNEXPECTED; - } - default: - { - GADM_LOG("Decoder failed, err=%d", err); - return NS_ERROR_UNEXPECTED; - } - } - - if (mAudioQueue.GetSize() > 0) { - aOutData = mAudioQueue.PopFront(); - // Return NS_ERROR_ABORT at the last sample. - return mAudioQueue.AtEndOfStream() ? NS_ERROR_ABORT : NS_OK; - } - - return NS_ERROR_NOT_AVAILABLE; -} - -void -GonkAudioDecoderManager::ProcessFlush() -{ - GADM_LOG("FLUSH<<<"); - mAudioQueue.Reset(); - GADM_LOG(">>>FLUSH"); - GonkDecoderManager::ProcessFlush(); -} - -void -GonkAudioDecoderManager::ResetEOS() -{ - GADM_LOG("ResetEOS(<<<"); - mAudioQueue.Reset(); - GADM_LOG(">>>ResetEOS("); - GonkDecoderManager::ResetEOS(); -} - -} // namespace mozilla diff --git a/dom/media/platforms/gonk/GonkAudioDecoderManager.h b/dom/media/platforms/gonk/GonkAudioDecoderManager.h deleted file mode 100644 index aa35d620eca5..000000000000 --- a/dom/media/platforms/gonk/GonkAudioDecoderManager.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#if !defined(GonkAudioDecoderManager_h_) -#define GonkAudioDecoderManager_h_ - -#include "AudioCompactor.h" -#include "mozilla/RefPtr.h" -#include "GonkMediaDataDecoder.h" - -using namespace android; - -namespace android { -class MOZ_EXPORT MediaBuffer; -} // namespace android - -namespace mozilla { - -class GonkAudioDecoderManager : public GonkDecoderManager { -typedef android::MediaCodecProxy MediaCodecProxy; -public: - GonkAudioDecoderManager(const AudioInfo& aConfig); - - virtual ~GonkAudioDecoderManager(); - - RefPtr Init() override; - - nsresult Output(int64_t aStreamOffset, - RefPtr& aOutput) override; - - void ProcessFlush() override; - virtual void ResetEOS() override; - - const char* GetDescriptionName() const override - { - return "gonk audio decoder"; - } - -private: - bool InitMediaCodecProxy(); - - nsresult CreateAudioData(MediaBuffer* aBuffer, int64_t aStreamOffset); - - uint32_t mAudioChannels; - uint32_t mAudioRate; - const uint32_t mAudioProfile; - - MediaQueue mAudioQueue; - - AudioCompactor mAudioCompactor; - -}; - -} // namespace mozilla - -#endif // GonkAudioDecoderManager_h_ diff --git a/dom/media/platforms/gonk/GonkDecoderModule.cpp b/dom/media/platforms/gonk/GonkDecoderModule.cpp deleted file mode 100644 index 537bc299c0cf..000000000000 --- a/dom/media/platforms/gonk/GonkDecoderModule.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "GonkDecoderModule.h" -#include "GonkVideoDecoderManager.h" -#include "GonkAudioDecoderManager.h" -#include "mozilla/DebugOnly.h" -#include "GonkMediaDataDecoder.h" - -namespace mozilla { -GonkDecoderModule::GonkDecoderModule() -{ -} - -GonkDecoderModule::~GonkDecoderModule() -{ -} - -already_AddRefed -GonkDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) -{ - RefPtr decoder = - new GonkMediaDataDecoder(new GonkVideoDecoderManager(aParams.mImageContainer, aParams.VideoConfig()), - aParams.mCallback); - return decoder.forget(); -} - -already_AddRefed -GonkDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) -{ - RefPtr decoder = - new GonkMediaDataDecoder(new GonkAudioDecoderManager(aParams.AudioConfig()), - aParams.mCallback); - return decoder.forget(); -} - -PlatformDecoderModule::ConversionRequired -GonkDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const -{ - if (aConfig.IsVideo()) { - return ConversionRequired::kNeedAnnexB; - } else { - return ConversionRequired::kNeedNone; - } -} - -bool -GonkDecoderModule::SupportsMimeType(const nsACString& aMimeType, - DecoderDoctorDiagnostics* aDiagnostics) const -{ - return aMimeType.EqualsLiteral("audio/mp4a-latm") || - aMimeType.EqualsLiteral("audio/3gpp") || - aMimeType.EqualsLiteral("audio/amr-wb") || - aMimeType.EqualsLiteral("audio/mpeg") || - aMimeType.EqualsLiteral("video/mp4") || - aMimeType.EqualsLiteral("video/mp4v-es") || - aMimeType.EqualsLiteral("video/avc") || - aMimeType.EqualsLiteral("video/3gpp"); -} - -} // namespace mozilla diff --git a/dom/media/platforms/gonk/GonkDecoderModule.h b/dom/media/platforms/gonk/GonkDecoderModule.h deleted file mode 100644 index 4f29f0e754b9..000000000000 --- a/dom/media/platforms/gonk/GonkDecoderModule.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#if !defined(GonkPlatformDecoderModule_h_) -#define GonkPlatformDecoderModule_h_ - -#include "PlatformDecoderModule.h" - -namespace mozilla { - -class GonkDecoderModule : public PlatformDecoderModule { -public: - GonkDecoderModule(); - virtual ~GonkDecoderModule(); - - // Decode thread. - already_AddRefed - CreateVideoDecoder(const CreateDecoderParams& aParams) override; - - // Decode thread. - already_AddRefed - CreateAudioDecoder(const CreateDecoderParams& aParams) override; - - ConversionRequired - DecoderNeedsConversion(const TrackInfo& aConfig) const override; - - bool SupportsMimeType(const nsACString& aMimeType, - DecoderDoctorDiagnostics* aDiagnostics) const override; - -}; - -} // namespace mozilla - -#endif diff --git a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp deleted file mode 100644 index 6d59d72e115a..000000000000 --- a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "GonkMediaDataDecoder.h" -#include "VideoUtils.h" -#include "nsTArray.h" -#include "MediaCodecProxy.h" - -#include - -#include "mozilla/Logging.h" -#include -#define GMDD_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkMediaDataDecoder", __VA_ARGS__) -#define INPUT_TIMEOUT_US 0LL // Don't wait for buffer if none is available. -#define MIN_QUEUED_SAMPLES 2 - -#ifdef DEBUG -#include -#endif - -#define LOG(...) MOZ_LOG(sPDMLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) - -using namespace android; - -namespace mozilla { - -bool -GonkDecoderManager::InitLoopers(MediaData::Type aType) -{ - MOZ_ASSERT(mDecodeLooper.get() == nullptr && mTaskLooper.get() == nullptr); - MOZ_ASSERT(aType == MediaData::VIDEO_DATA || aType == MediaData::AUDIO_DATA); - - const char* suffix = (aType == MediaData::VIDEO_DATA ? "video" : "audio"); - mDecodeLooper = new ALooper; - android::AString name("MediaCodecProxy/"); - name.append(suffix); - mDecodeLooper->setName(name.c_str()); - - mTaskLooper = new ALooper; - name.setTo("GonkDecoderManager/"); - name.append(suffix); - mTaskLooper->setName(name.c_str()); - mTaskLooper->registerHandler(this); - -#ifdef DEBUG - sp findThreadId(new AMessage(kNotifyFindLooperId, id())); - findThreadId->post(); -#endif - - return mDecodeLooper->start() == OK && mTaskLooper->start() == OK; -} - -nsresult -GonkDecoderManager::Input(MediaRawData* aSample) -{ - RefPtr sample; - - if (aSample) { - sample = aSample; - } else { - // It means EOS with empty sample. - sample = new MediaRawData(); - } - { - MutexAutoLock lock(mMutex); - mQueuedSamples.AppendElement(sample); - } - - sp input = new AMessage(kNotifyProcessInput, id()); - if (!aSample) { - input->setInt32("input-eos", 1); - } - input->post(); - return NS_OK; -} - -int32_t -GonkDecoderManager::ProcessQueuedSamples() -{ - MOZ_ASSERT(OnTaskLooper()); - - MutexAutoLock lock(mMutex); - status_t rv; - while (mQueuedSamples.Length()) { - RefPtr data = mQueuedSamples.ElementAt(0); - rv = mDecoder->Input(reinterpret_cast(data->Data()), - data->Size(), - data->mTime, - 0, - INPUT_TIMEOUT_US); - if (rv == OK) { - mQueuedSamples.RemoveElementAt(0); - mWaitOutput.AppendElement(WaitOutputInfo(data->mOffset, data->mTime, - /* eos */ data->Data() == nullptr)); - } else if (rv == -EAGAIN || rv == -ETIMEDOUT) { - // In most cases, EAGAIN or ETIMEOUT are safe because OMX can't fill - // buffer on time. - break; - } else { - return rv; - } - } - return mQueuedSamples.Length(); -} - -nsresult -GonkDecoderManager::Flush() -{ - if (mDecoder == nullptr) { - GMDD_LOG("Decoder is not initialized"); - return NS_ERROR_UNEXPECTED; - } - - if (!mInitPromise.IsEmpty()) { - return NS_OK; - } - - { - MutexAutoLock lock(mMutex); - mQueuedSamples.Clear(); - } - - MonitorAutoLock lock(mFlushMonitor); - mIsFlushing = true; - sp flush = new AMessage(kNotifyProcessFlush, id()); - flush->post(); - while (mIsFlushing) { - lock.Wait(); - } - return NS_OK; -} - -nsresult -GonkDecoderManager::Shutdown() -{ - if (mDecoder.get()) { - mDecoder->stop(); - mDecoder->ReleaseMediaResources(); - mDecoder = nullptr; - } - - mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); - - return NS_OK; -} - -size_t -GonkDecoderManager::NumQueuedSamples() -{ - MutexAutoLock lock(mMutex); - return mQueuedSamples.Length(); -} - -void -GonkDecoderManager::ProcessInput(bool aEndOfStream) -{ - MOZ_ASSERT(OnTaskLooper()); - - status_t rv = ProcessQueuedSamples(); - if (rv >= 0) { - if (!aEndOfStream && rv <= MIN_QUEUED_SAMPLES) { - mDecodeCallback->InputExhausted(); - } - - if (mToDo.get() == nullptr) { - mToDo = new AMessage(kNotifyDecoderActivity, id()); - if (aEndOfStream) { - mToDo->setInt32("input-eos", 1); - } - mDecoder->requestActivityNotification(mToDo); - } else if (aEndOfStream) { - mToDo->setInt32("input-eos", 1); - } - } else { - GMDD_LOG("input processed: error#%d", rv); - mDecodeCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - __func__)); - } -} - -void -GonkDecoderManager::ProcessFlush() -{ - MOZ_ASSERT(OnTaskLooper()); - - mLastTime = INT64_MIN; - MonitorAutoLock lock(mFlushMonitor); - mWaitOutput.Clear(); - if (mDecoder->flush() != OK) { - GMDD_LOG("flush error"); - mDecodeCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - __func__)); - } - mIsFlushing = false; - lock.NotifyAll(); -} - -// Use output timestamp to determine which output buffer is already returned -// and remove corresponding info, except for EOS, from the waiting list. -// This method handles the cases that audio decoder sends multiple output -// buffers for one input. -void -GonkDecoderManager::UpdateWaitingList(int64_t aForgetUpTo) -{ - MOZ_ASSERT(OnTaskLooper()); - - size_t i; - for (i = 0; i < mWaitOutput.Length(); i++) { - const auto& item = mWaitOutput.ElementAt(i); - if (item.mEOS || item.mTimestamp > aForgetUpTo) { - break; - } - } - if (i > 0) { - mWaitOutput.RemoveElementsAt(0, i); - } -} - -void -GonkDecoderManager::ProcessToDo(bool aEndOfStream) -{ - MOZ_ASSERT(OnTaskLooper()); - - MOZ_ASSERT(mToDo.get() != nullptr); - mToDo.clear(); - - if (NumQueuedSamples() > 0 && ProcessQueuedSamples() < 0) { - mDecodeCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - __func__)); - return; - } - - while (mWaitOutput.Length() > 0) { - RefPtr output; - WaitOutputInfo wait = mWaitOutput.ElementAt(0); - nsresult rv = Output(wait.mOffset, output); - if (rv == NS_OK) { - MOZ_ASSERT(output); - mDecodeCallback->Output(output); - UpdateWaitingList(output->mTime); - } else if (rv == NS_ERROR_ABORT) { - // EOS - MOZ_ASSERT(mQueuedSamples.IsEmpty()); - if (output) { - mDecodeCallback->Output(output); - UpdateWaitingList(output->mTime); - } - MOZ_ASSERT(mWaitOutput.Length() == 1); - mWaitOutput.RemoveElementAt(0); - mDecodeCallback->DrainComplete(); - ResetEOS(); - return; - } else if (rv == NS_ERROR_NOT_AVAILABLE) { - break; - } else { - mDecodeCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - __func__)); - return; - } - } - - if (!aEndOfStream && NumQueuedSamples() <= MIN_QUEUED_SAMPLES) { - mDecodeCallback->InputExhausted(); - // No need to shedule todo task this time because InputExhausted() will - // cause Input() to be invoked and do it for us. - return; - } - - if (NumQueuedSamples() || mWaitOutput.Length() > 0) { - mToDo = new AMessage(kNotifyDecoderActivity, id()); - if (aEndOfStream) { - mToDo->setInt32("input-eos", 1); - } - mDecoder->requestActivityNotification(mToDo); - } -} - -void -GonkDecoderManager::ResetEOS() -{ - // After eos, android::MediaCodec needs to be flushed to receive next input - mWaitOutput.Clear(); - if (mDecoder->flush() != OK) { - GMDD_LOG("flush error"); - mDecodeCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - __func__)); - } -} - -void -GonkDecoderManager::onMessageReceived(const sp &aMessage) -{ - switch (aMessage->what()) { - case kNotifyProcessInput: - { - int32_t eos = 0; - ProcessInput(aMessage->findInt32("input-eos", &eos) && eos); - break; - } - case kNotifyProcessFlush: - { - ProcessFlush(); - break; - } - case kNotifyDecoderActivity: - { - int32_t eos = 0; - ProcessToDo(aMessage->findInt32("input-eos", &eos) && eos); - break; - } -#ifdef DEBUG - case kNotifyFindLooperId: - { - mTaskLooperId = androidGetThreadId(); - MOZ_ASSERT(mTaskLooperId); - break; - } -#endif - default: - { - TRESPASS(); - break; - } - } -} - -#ifdef DEBUG -bool -GonkDecoderManager::OnTaskLooper() -{ - return androidGetThreadId() == mTaskLooperId; -} -#endif - -GonkMediaDataDecoder::GonkMediaDataDecoder(GonkDecoderManager* aManager, - MediaDataDecoderCallback* aCallback) - : mManager(aManager) -{ - MOZ_COUNT_CTOR(GonkMediaDataDecoder); - mManager->SetDecodeCallback(aCallback); -} - -GonkMediaDataDecoder::~GonkMediaDataDecoder() -{ - MOZ_COUNT_DTOR(GonkMediaDataDecoder); -} - -RefPtr -GonkMediaDataDecoder::Init() -{ - return mManager->Init(); -} - -void -GonkMediaDataDecoder::Shutdown() -{ - mManager->Shutdown(); - - // Because codec allocated runnable and init promise is at reader TaskQueue, - // so manager needs to be destroyed at reader TaskQueue to prevent racing. - mManager = nullptr; -} - -// Inserts data into the decoder's pipeline. -void -GonkMediaDataDecoder::Input(MediaRawData* aSample) -{ - mManager->Input(aSample); -} - -void -GonkMediaDataDecoder::Flush() -{ - mManager->Flush(); -} - -void -GonkMediaDataDecoder::Drain() -{ - mManager->Input(nullptr); -} - -} // namespace mozilla diff --git a/dom/media/platforms/gonk/GonkMediaDataDecoder.h b/dom/media/platforms/gonk/GonkMediaDataDecoder.h deleted file mode 100644 index bba2a8645d7a..000000000000 --- a/dom/media/platforms/gonk/GonkMediaDataDecoder.h +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#if !defined(GonkMediaDataDecoder_h_) -#define GonkMediaDataDecoder_h_ -#include "PlatformDecoderModule.h" -#include - -namespace android { -struct ALooper; -class MediaBuffer; -class MediaCodecProxy; -} // namespace android - -namespace mozilla { -class MediaRawData; - -// Manage the data flow from inputting encoded data and outputting decode data. -class GonkDecoderManager : public android::AHandler { -public: - typedef TrackInfo::TrackType TrackType; - typedef MediaDataDecoder::InitPromise InitPromise; - - virtual ~GonkDecoderManager() {} - - virtual RefPtr Init() = 0; - virtual const char* GetDescriptionName() const = 0; - - // Asynchronously send sample into mDecoder. If out of input buffer, aSample - // will be queued for later re-send. - nsresult Input(MediaRawData* aSample); - - // Flush the queued samples and signal decoder to throw all pending input/output away. - nsresult Flush(); - - // Shutdown decoder and rejects the init promise. - virtual nsresult Shutdown(); - - // How many samples are waiting for processing. - size_t NumQueuedSamples(); - - // Set callback for decoder events, such as requesting more input, - // returning output, or reporting error. - void SetDecodeCallback(MediaDataDecoderCallback* aCallback) - { - mDecodeCallback = aCallback; - } - -protected: - GonkDecoderManager() - : mMutex("GonkDecoderManager") - , mLastTime(INT64_MIN) - , mFlushMonitor("GonkDecoderManager::Flush") - , mIsFlushing(false) - , mDecodeCallback(nullptr) - {} - - bool InitLoopers(MediaData::Type aType); - - void onMessageReceived(const android::sp &aMessage) override; - - // Produces decoded output. It returns NS_OK on success, or NS_ERROR_NOT_AVAILABLE - // when output is not produced yet. - // If this returns a failure code other than NS_ERROR_NOT_AVAILABLE, an error - // will be reported through mDecodeCallback. - virtual nsresult Output(int64_t aStreamOffset, - RefPtr& aOutput) = 0; - - // Send queued samples to OMX. It returns how many samples are still in - // queue after processing, or negative error code if failed. - int32_t ProcessQueuedSamples(); - - void ProcessInput(bool aEndOfStream); - virtual void ProcessFlush(); - void ProcessToDo(bool aEndOfStream); - virtual void ResetEOS(); - - RefPtr mCodecSpecificData; - - nsAutoCString mMimeType; - - // MediaCodedc's wrapper that performs the decoding. - android::sp mDecoder; - // Looper for mDecoder to run on. - android::sp mDecodeLooper; - // Looper to run decode tasks such as processing input, output, flush, and - // recycling output buffers. - android::sp mTaskLooper; - // Message codes for tasks running on mTaskLooper. - enum { - // Decoder will send this to indicate internal state change such as input or - // output buffers availability. Used to run pending input & output tasks. - kNotifyDecoderActivity = 'nda ', - // Signal the decoder to flush. - kNotifyProcessFlush = 'npf ', - // Used to process queued samples when there is new input. - kNotifyProcessInput = 'npi ', -#ifdef DEBUG - kNotifyFindLooperId = 'nfli', -#endif - }; - - MozPromiseHolder mInitPromise; - - Mutex mMutex; // Protects mQueuedSamples. - // A queue that stores the samples waiting to be sent to mDecoder. - // Empty element means EOS and there shouldn't be any sample be queued after it. - // Samples are queued in caller's thread and dequeued in mTaskLooper. - nsTArray> mQueuedSamples; - - // The last decoded frame presentation time. Only accessed on mTaskLooper. - int64_t mLastTime; - - Monitor mFlushMonitor; // Waits for flushing to complete. - bool mIsFlushing; // Protected by mFlushMonitor. - - // Remembers the notification that is currently waiting for the decoder event - // to avoid requesting more than one notification at the time, which is - // forbidden by mDecoder. - android::sp mToDo; - - // Stores sample info for output buffer processing later. - struct WaitOutputInfo { - WaitOutputInfo(int64_t aOffset, int64_t aTimestamp, bool aEOS) - : mOffset(aOffset) - , mTimestamp(aTimestamp) - , mEOS(aEOS) - {} - const int64_t mOffset; - const int64_t mTimestamp; - const bool mEOS; - }; - - nsTArray mWaitOutput; - - MediaDataDecoderCallback* mDecodeCallback; // Reports decoder output or error. - -private: - void UpdateWaitingList(int64_t aForgetUpTo); - -#ifdef DEBUG - typedef void* LooperId; - - bool OnTaskLooper(); - LooperId mTaskLooperId; -#endif -}; - -class AutoReleaseMediaBuffer -{ -public: - AutoReleaseMediaBuffer(android::MediaBuffer* aBuffer, android::MediaCodecProxy* aCodec) - : mBuffer(aBuffer) - , mCodec(aCodec) - {} - - ~AutoReleaseMediaBuffer() - { - MOZ_ASSERT(mCodec.get()); - if (mBuffer) { - mCodec->ReleaseMediaBuffer(mBuffer); - } - } - - android::MediaBuffer* forget() - { - android::MediaBuffer* tmp = mBuffer; - mBuffer = nullptr; - return tmp; - } - -private: - android::MediaBuffer* mBuffer; - android::sp mCodec; -}; - -// Samples are decoded using the GonkDecoder (MediaCodec) -// created by the GonkDecoderManager. This class implements -// the higher-level logic that drives mapping the Gonk to the async -// MediaDataDecoder interface. The specifics of decoding the exact stream -// type are handled by GonkDecoderManager and the GonkDecoder it creates. -class GonkMediaDataDecoder : public MediaDataDecoder { -public: - GonkMediaDataDecoder(GonkDecoderManager* aDecoderManager, - MediaDataDecoderCallback* aCallback); - - ~GonkMediaDataDecoder(); - - RefPtr Init() override; - - void Input(MediaRawData* aSample) override; - - void Flush() override; - - void Drain() override; - - void Shutdown() override; - - const char* GetDescriptionName() const override - { - return "gonk decoder"; - } - -private: - - android::sp mManager; -}; - -} // namespace mozilla - -#endif // GonkMediaDataDecoder_h_ diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp deleted file mode 100644 index 0c7b3b6af95f..000000000000 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp +++ /dev/null @@ -1,772 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "MediaCodecProxy.h" -#include -#include -#include -#include "GonkVideoDecoderManager.h" -#include "GrallocImages.h" -#include "MediaDecoderReader.h" -#include "ImageContainer.h" -#include "VideoUtils.h" -#include "nsThreadUtils.h" -#include "Layers.h" -#include "mozilla/Logging.h" -#include -#include -#include -#include -#include "GonkNativeWindow.h" -#include "mozilla/layers/GrallocTextureClient.h" -#include "mozilla/layers/ImageBridgeChild.h" -#include "mozilla/layers/TextureClient.h" -#include "mozilla/layers/TextureClientRecycleAllocator.h" -#include - -#define CODECCONFIG_TIMEOUT_US 10000LL -#define READ_OUTPUT_BUFFER_TIMEOUT_US 0LL - -#include -#define GVDM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkVideoDecoderManager", __VA_ARGS__) - -#define LOG(...) MOZ_LOG(sPDMLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) -using namespace mozilla::layers; -using namespace android; -typedef android::MediaCodecProxy MediaCodecProxy; - -namespace mozilla { - -class GonkTextureClientAllocationHelper : public layers::ITextureClientAllocationHelper -{ -public: - GonkTextureClientAllocationHelper(uint32_t aGrallocFormat, - gfx::IntSize aSize) - : ITextureClientAllocationHelper(gfx::SurfaceFormat::UNKNOWN, - aSize, - BackendSelector::Content, - TextureFlags::DEALLOCATE_CLIENT, - ALLOC_DISALLOW_BUFFERTEXTURECLIENT) - , mGrallocFormat(aGrallocFormat) - {} - - already_AddRefed Allocate(KnowsCompositor* aAllocator) override - { - uint32_t usage = android::GraphicBuffer::USAGE_SW_READ_OFTEN | - android::GraphicBuffer::USAGE_SW_WRITE_OFTEN | - android::GraphicBuffer::USAGE_HW_TEXTURE; - - GrallocTextureData* texData = GrallocTextureData::Create(mSize, mGrallocFormat, - gfx::BackendType::NONE, - usage, aAllocator->GetTextureForwarder()); - if (!texData) { - return nullptr; - } - sp graphicBuffer = texData->GetGraphicBuffer(); - if (!graphicBuffer.get()) { - return nullptr; - } - RefPtr textureClient = - TextureClient::CreateWithData(texData, TextureFlags::DEALLOCATE_CLIENT, aAllocator->GetTextureForwarder()); - return textureClient.forget(); - } - - bool IsCompatible(TextureClient* aTextureClient) override - { - if (!aTextureClient) { - return false; - } - sp graphicBuffer = - static_cast(aTextureClient->GetInternalData())->GetGraphicBuffer(); - if (!graphicBuffer.get() || - static_cast(graphicBuffer->getPixelFormat()) != mGrallocFormat || - aTextureClient->GetSize() != mSize) { - return false; - } - return true; - } - -private: - uint32_t mGrallocFormat; -}; - -GonkVideoDecoderManager::GonkVideoDecoderManager( - mozilla::layers::ImageContainer* aImageContainer, - const VideoInfo& aConfig) - : mConfig(aConfig) - , mImageContainer(aImageContainer) - , mColorConverterBufferSize(0) - , mPendingReleaseItemsLock("GonkVideoDecoderManager::mPendingReleaseItemsLock") - , mNeedsCopyBuffer(false) -{ - MOZ_COUNT_CTOR(GonkVideoDecoderManager); -} - -GonkVideoDecoderManager::~GonkVideoDecoderManager() -{ - MOZ_COUNT_DTOR(GonkVideoDecoderManager); -} - -nsresult -GonkVideoDecoderManager::Shutdown() -{ - mVideoCodecRequest.DisconnectIfExists(); - return GonkDecoderManager::Shutdown(); -} - -RefPtr -GonkVideoDecoderManager::Init() -{ - mNeedsCopyBuffer = false; - - uint32_t maxWidth, maxHeight; - char propValue[PROPERTY_VALUE_MAX]; - property_get("ro.moz.omx.hw.max_width", propValue, "-1"); - maxWidth = -1 == atoi(propValue) ? MAX_VIDEO_WIDTH : atoi(propValue); - property_get("ro.moz.omx.hw.max_height", propValue, "-1"); - maxHeight = -1 == atoi(propValue) ? MAX_VIDEO_HEIGHT : atoi(propValue) ; - - if (uint32_t(mConfig.mImage.width * mConfig.mImage.height) > maxWidth * maxHeight) { - GVDM_LOG("Video resolution exceeds hw codec capability"); - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - } - - // Validate the container-reported frame and pictureRect sizes. This ensures - // that our video frame creation code doesn't overflow. - if (!IsValidVideoRegion(mConfig.mImage, mConfig.ImageRect(), mConfig.mDisplay)) { - GVDM_LOG("It is not a valid region"); - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - } - - mReaderTaskQueue = AbstractThread::GetCurrent()->AsTaskQueue(); - MOZ_ASSERT(mReaderTaskQueue); - - if (mDecodeLooper.get() != nullptr) { - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - } - - if (!InitLoopers(MediaData::VIDEO_DATA)) { - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - } - - RefPtr p = mInitPromise.Ensure(__func__); - android::sp self = this; - mDecoder = MediaCodecProxy::CreateByType(mDecodeLooper, - mConfig.mMimeType.get(), - false); - - uint32_t capability = MediaCodecProxy::kEmptyCapability; - if (mDecoder->getCapability(&capability) == OK && (capability & - MediaCodecProxy::kCanExposeGraphicBuffer)) { -#if ANDROID_VERSION >= 21 - sp consumer; - GonkBufferQueue::createBufferQueue(&mGraphicBufferProducer, &consumer); - mNativeWindow = new GonkNativeWindow(consumer); -#else - mNativeWindow = new GonkNativeWindow(); -#endif - } - - mVideoCodecRequest.Begin(mDecoder->AsyncAllocateVideoMediaCodec() - ->Then(mReaderTaskQueue, __func__, - [self] (bool) -> void { - self->mVideoCodecRequest.Complete(); - self->codecReserved(); - }, [self] (bool) -> void { - self->mVideoCodecRequest.Complete(); - self->codecCanceled(); - })); - - return p; -} - -nsresult -GonkVideoDecoderManager::CreateVideoData(MediaBuffer* aBuffer, - int64_t aStreamOffset, - VideoData **v) -{ - *v = nullptr; - RefPtr data; - int64_t timeUs; - int32_t keyFrame; - - if (aBuffer == nullptr) { - GVDM_LOG("Video Buffer is not valid!"); - return NS_ERROR_UNEXPECTED; - } - - AutoReleaseMediaBuffer autoRelease(aBuffer, mDecoder.get()); - - if (!aBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) { - GVDM_LOG("Decoder did not return frame time"); - return NS_ERROR_UNEXPECTED; - } - - if (mLastTime > timeUs) { - GVDM_LOG("Output decoded sample time is revert. time=%lld", timeUs); - return NS_ERROR_NOT_AVAILABLE; - } - mLastTime = timeUs; - - if (aBuffer->range_length() == 0) { - // Some decoders may return spurious empty buffers that we just want to ignore - // quoted from Android's AwesomePlayer.cpp - return NS_ERROR_NOT_AVAILABLE; - } - - if (!aBuffer->meta_data()->findInt32(kKeyIsSyncFrame, &keyFrame)) { - keyFrame = 0; - } - - gfx::IntRect picture = - mConfig.ScaledImageRect(mFrameInfo.mWidth, mFrameInfo.mHeight); - if (aBuffer->graphicBuffer().get()) { - data = CreateVideoDataFromGraphicBuffer(aBuffer, picture); - if (data && !mNeedsCopyBuffer) { - // RecycleCallback() will be responsible for release the buffer. - autoRelease.forget(); - } - mNeedsCopyBuffer = false; - } else { - data = CreateVideoDataFromDataBuffer(aBuffer, picture); - } - - if (!data) { - return NS_ERROR_UNEXPECTED; - } - // Fill necessary info. - data->mOffset = aStreamOffset; - data->mTime = timeUs; - data->mKeyframe = keyFrame; - - data.forget(v); - return NS_OK; -} - -// Copy pixels from one planar YUV to another. -static void -CopyYUV(PlanarYCbCrData& aSource, PlanarYCbCrData& aDestination) -{ - // Fill Y plane. - uint8_t* srcY = aSource.mYChannel; - gfx::IntSize ySize = aSource.mYSize; - uint8_t* destY = aDestination.mYChannel; - // Y plane. - for (int i = 0; i < ySize.height; i++) { - memcpy(destY, srcY, ySize.width); - srcY += aSource.mYStride; - destY += aDestination.mYStride; - } - - // Fill UV plane. - // Line start - uint8_t* srcU = aSource.mCbChannel; - uint8_t* srcV = aSource.mCrChannel; - uint8_t* destU = aDestination.mCbChannel; - uint8_t* destV = aDestination.mCrChannel; - - gfx::IntSize uvSize = aSource.mCbCrSize; - for (int i = 0; i < uvSize.height; i++) { - uint8_t* su = srcU; - uint8_t* sv = srcV; - uint8_t* du = destU; - uint8_t* dv =destV; - for (int j = 0; j < uvSize.width; j++) { - *du++ = *su++; - *dv++ = *sv++; - // Move to next pixel. - su += aSource.mCbSkip; - sv += aSource.mCrSkip; - du += aDestination.mCbSkip; - dv += aDestination.mCrSkip; - } - // Move to next line. - srcU += aSource.mCbCrStride; - srcV += aSource.mCbCrStride; - destU += aDestination.mCbCrStride; - destV += aDestination.mCbCrStride; - } -} - -inline static int -Align(int aX, int aAlign) -{ - return (aX + aAlign - 1) & ~(aAlign - 1); -} - -// Venus formats are doucmented in kernel/include/media/msm_media_info.h: -// * Y_Stride : Width aligned to 128 -// * UV_Stride : Width aligned to 128 -// * Y_Scanlines: Height aligned to 32 -// * UV_Scanlines: Height/2 aligned to 16 -// * Total size = align((Y_Stride * Y_Scanlines -// * + UV_Stride * UV_Scanlines + 4096), 4096) -static void -CopyVenus(uint8_t* aSrc, uint8_t* aDest, uint32_t aWidth, uint32_t aHeight) -{ - size_t yStride = Align(aWidth, 128); - uint8_t* s = aSrc; - uint8_t* d = aDest; - for (size_t i = 0; i < aHeight; i++) { - memcpy(d, s, aWidth); - s += yStride; - d += yStride; - } - size_t uvStride = yStride; - size_t uvLines = (aHeight + 1) / 2; - size_t ySize = yStride * Align(aHeight, 32); - s = aSrc + ySize; - d = aDest + ySize; - for (size_t i = 0; i < uvLines; i++) { - memcpy(d, s, aWidth); - s += uvStride; - d += uvStride; - } -} - -static void -CopyGraphicBuffer(sp& aSource, sp& aDestination) -{ - void* srcPtr = nullptr; - aSource->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, &srcPtr); - void* destPtr = nullptr; - aDestination->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN, &destPtr); - MOZ_ASSERT(srcPtr && destPtr); - - // Build PlanarYCbCrData for source buffer. - PlanarYCbCrData srcData; - switch (aSource->getPixelFormat()) { - case HAL_PIXEL_FORMAT_YV12: { - // Android YV12 format is defined in system/core/include/system/graphics.h - srcData.mYChannel = static_cast(srcPtr); - srcData.mYSkip = 0; - srcData.mYSize.width = aSource->getWidth(); - srcData.mYSize.height = aSource->getHeight(); - srcData.mYStride = aSource->getStride(); - // 4:2:0. - srcData.mCbCrSize.width = srcData.mYSize.width / 2; - srcData.mCbCrSize.height = srcData.mYSize.height / 2; - srcData.mCrChannel = srcData.mYChannel + (srcData.mYStride * srcData.mYSize.height); - // Aligned to 16 bytes boundary. - srcData.mCbCrStride = Align(srcData.mYStride / 2, 16); - srcData.mCrSkip = 0; - srcData.mCbChannel = srcData.mCrChannel + (srcData.mCbCrStride * srcData.mCbCrSize.height); - srcData.mCbSkip = 0; - - // Build PlanarYCbCrData for destination buffer. - PlanarYCbCrData destData; - destData.mYChannel = static_cast(destPtr); - destData.mYSkip = 0; - destData.mYSize.width = aDestination->getWidth(); - destData.mYSize.height = aDestination->getHeight(); - destData.mYStride = aDestination->getStride(); - // 4:2:0. - destData.mCbCrSize.width = destData.mYSize.width / 2; - destData.mCbCrSize.height = destData.mYSize.height / 2; - destData.mCrChannel = destData.mYChannel + (destData.mYStride * destData.mYSize.height); - // Aligned to 16 bytes boundary. - destData.mCbCrStride = Align(destData.mYStride / 2, 16); - destData.mCrSkip = 0; - destData.mCbChannel = destData.mCrChannel + (destData.mCbCrStride * destData.mCbCrSize.height); - destData.mCbSkip = 0; - - CopyYUV(srcData, destData); - break; - } - case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS: - CopyVenus(static_cast(srcPtr), - static_cast(destPtr), - aSource->getWidth(), - aSource->getHeight()); - break; - default: - NS_ERROR("Unsupported input gralloc image type. Should never be here."); - } - - - aSource->unlock(); - aDestination->unlock(); -} - -already_AddRefed -GonkVideoDecoderManager::CreateVideoDataFromGraphicBuffer(MediaBuffer* aSource, - gfx::IntRect& aPicture) -{ - sp srcBuffer(aSource->graphicBuffer()); - RefPtr textureClient; - - if (mNeedsCopyBuffer) { - // Copy buffer contents for bug 1199809. - if (!mCopyAllocator) { - RefPtr bridge = layers::ImageBridgeChild::GetSingleton(); - mCopyAllocator = new TextureClientRecycleAllocator(bridge); - } - if (!mCopyAllocator) { - GVDM_LOG("Create buffer allocator failed!"); - return nullptr; - } - - gfx::IntSize size(srcBuffer->getWidth(), srcBuffer->getHeight()); - GonkTextureClientAllocationHelper helper(srcBuffer->getPixelFormat(), size); - textureClient = mCopyAllocator->CreateOrRecycle(helper); - if (!textureClient) { - GVDM_LOG("Copy buffer allocation failed!"); - return nullptr; - } - - sp destBuffer = - static_cast(textureClient->GetInternalData())->GetGraphicBuffer(); - - CopyGraphicBuffer(srcBuffer, destBuffer); - } else { - textureClient = mNativeWindow->getTextureClientFromBuffer(srcBuffer.get()); - textureClient->SetRecycleCallback(GonkVideoDecoderManager::RecycleCallback, this); - static_cast(textureClient->GetInternalData())->SetMediaBuffer(aSource); - } - - RefPtr data = - VideoData::CreateAndCopyIntoTextureClient(mConfig, - 0, // Filled later by caller. - 0, // Filled later by caller. - 1, // No way to pass sample duration from muxer to - // OMX codec, so we hardcode the duration here. - textureClient, - false, // Filled later by caller. - -1, - aPicture); - return data.forget(); -} - -already_AddRefed -GonkVideoDecoderManager::CreateVideoDataFromDataBuffer(MediaBuffer* aSource, gfx::IntRect& aPicture) -{ - if (!aSource->data()) { - GVDM_LOG("No data in Video Buffer!"); - return nullptr; - } - uint8_t *yuv420p_buffer = (uint8_t *)aSource->data(); - int32_t stride = mFrameInfo.mStride; - int32_t slice_height = mFrameInfo.mSliceHeight; - - // Converts to OMX_COLOR_FormatYUV420Planar - if (mFrameInfo.mColorFormat != OMX_COLOR_FormatYUV420Planar) { - ARect crop; - crop.top = 0; - crop.bottom = mFrameInfo.mHeight; - crop.left = 0; - crop.right = mFrameInfo.mWidth; - yuv420p_buffer = GetColorConverterBuffer(mFrameInfo.mWidth, mFrameInfo.mHeight); - if (mColorConverter.convertDecoderOutputToI420(aSource->data(), - mFrameInfo.mWidth, mFrameInfo.mHeight, crop, yuv420p_buffer) != OK) { - GVDM_LOG("Color conversion failed!"); - return nullptr; - } - stride = mFrameInfo.mWidth; - slice_height = mFrameInfo.mHeight; - } - - size_t yuv420p_y_size = stride * slice_height; - size_t yuv420p_u_size = ((stride + 1) / 2) * ((slice_height + 1) / 2); - uint8_t *yuv420p_y = yuv420p_buffer; - uint8_t *yuv420p_u = yuv420p_y + yuv420p_y_size; - uint8_t *yuv420p_v = yuv420p_u + yuv420p_u_size; - - VideoData::YCbCrBuffer b; - b.mPlanes[0].mData = yuv420p_y; - b.mPlanes[0].mWidth = mFrameInfo.mWidth; - b.mPlanes[0].mHeight = mFrameInfo.mHeight; - b.mPlanes[0].mStride = stride; - b.mPlanes[0].mOffset = 0; - b.mPlanes[0].mSkip = 0; - - b.mPlanes[1].mData = yuv420p_u; - b.mPlanes[1].mWidth = (mFrameInfo.mWidth + 1) / 2; - b.mPlanes[1].mHeight = (mFrameInfo.mHeight + 1) / 2; - b.mPlanes[1].mStride = (stride + 1) / 2; - b.mPlanes[1].mOffset = 0; - b.mPlanes[1].mSkip = 0; - - b.mPlanes[2].mData = yuv420p_v; - b.mPlanes[2].mWidth =(mFrameInfo.mWidth + 1) / 2; - b.mPlanes[2].mHeight = (mFrameInfo.mHeight + 1) / 2; - b.mPlanes[2].mStride = (stride + 1) / 2; - b.mPlanes[2].mOffset = 0; - b.mPlanes[2].mSkip = 0; - - RefPtr data = - VideoData::CreateAndCopyData(mConfig, - mImageContainer, - 0, // Filled later by caller. - 0, // Filled later by caller. - 1, // We don't know the duration. - b, - 0, // Filled later by caller. - -1, - aPicture); - - return data.forget(); -} - -bool -GonkVideoDecoderManager::SetVideoFormat() -{ - // read video metadata from MediaCodec - sp codecFormat; - if (mDecoder->getOutputFormat(&codecFormat) == OK) { - AString mime; - int32_t width = 0; - int32_t height = 0; - int32_t stride = 0; - int32_t slice_height = 0; - int32_t color_format = 0; - int32_t crop_left = 0; - int32_t crop_top = 0; - int32_t crop_right = 0; - int32_t crop_bottom = 0; - if (!codecFormat->findString("mime", &mime) || - !codecFormat->findInt32("width", &width) || - !codecFormat->findInt32("height", &height) || - !codecFormat->findInt32("stride", &stride) || - !codecFormat->findInt32("slice-height", &slice_height) || - !codecFormat->findInt32("color-format", &color_format) || - !codecFormat->findRect("crop", &crop_left, &crop_top, &crop_right, &crop_bottom)) { - GVDM_LOG("Failed to find values"); - return false; - } - mFrameInfo.mWidth = width; - mFrameInfo.mHeight = height; - mFrameInfo.mStride = stride; - mFrameInfo.mSliceHeight = slice_height; - mFrameInfo.mColorFormat = color_format; - - nsIntSize displaySize(width, height); - if (!IsValidVideoRegion(mConfig.mDisplay, - mConfig.ScaledImageRect(width, height), - displaySize)) { - GVDM_LOG("It is not a valid region"); - return false; - } - return true; - } - GVDM_LOG("Fail to get output format"); - return false; -} - -// Blocks until decoded sample is produced by the deoder. -nsresult -GonkVideoDecoderManager::Output(int64_t aStreamOffset, - RefPtr& aOutData) -{ - aOutData = nullptr; - status_t err; - if (mDecoder == nullptr) { - GVDM_LOG("Decoder is not inited"); - return NS_ERROR_UNEXPECTED; - } - MediaBuffer* outputBuffer = nullptr; - err = mDecoder->Output(&outputBuffer, READ_OUTPUT_BUFFER_TIMEOUT_US); - - switch (err) { - case OK: - { - RefPtr data; - nsresult rv = CreateVideoData(outputBuffer, aStreamOffset, getter_AddRefs(data)); - if (rv == NS_ERROR_NOT_AVAILABLE) { - // Decoder outputs a empty video buffer, try again - return NS_ERROR_NOT_AVAILABLE; - } else if (rv != NS_OK || data == nullptr) { - GVDM_LOG("Failed to create VideoData"); - return NS_ERROR_UNEXPECTED; - } - aOutData = data; - return NS_OK; - } - case android::INFO_FORMAT_CHANGED: - { - // If the format changed, update our cached info. - GVDM_LOG("Decoder format changed"); - if (!SetVideoFormat()) { - return NS_ERROR_UNEXPECTED; - } - return Output(aStreamOffset, aOutData); - } - case android::INFO_OUTPUT_BUFFERS_CHANGED: - { - if (mDecoder->UpdateOutputBuffers()) { - return Output(aStreamOffset, aOutData); - } - GVDM_LOG("Fails to update output buffers!"); - return NS_ERROR_FAILURE; - } - case -EAGAIN: - { -// GVDM_LOG("Need to try again!"); - return NS_ERROR_NOT_AVAILABLE; - } - case android::ERROR_END_OF_STREAM: - { - GVDM_LOG("Got the EOS frame!"); - RefPtr data; - nsresult rv = CreateVideoData(outputBuffer, aStreamOffset, getter_AddRefs(data)); - if (rv == NS_ERROR_NOT_AVAILABLE) { - // For EOS, no need to do any thing. - return NS_ERROR_ABORT; - } - if (rv != NS_OK || data == nullptr) { - GVDM_LOG("Failed to create video data"); - return NS_ERROR_UNEXPECTED; - } - aOutData = data; - return NS_ERROR_ABORT; - } - case -ETIMEDOUT: - { - GVDM_LOG("Timeout. can try again next time"); - return NS_ERROR_UNEXPECTED; - } - default: - { - GVDM_LOG("Decoder failed, err=%d", err); - return NS_ERROR_UNEXPECTED; - } - } - - return NS_OK; -} - -void -GonkVideoDecoderManager::codecReserved() -{ - if (mInitPromise.IsEmpty()) { - return; - } - GVDM_LOG("codecReserved"); - sp format = new AMessage; - sp surface; - status_t rv = OK; - // Fixed values - GVDM_LOG("Configure video mime type: %s, width:%d, height:%d", mConfig.mMimeType.get(), mConfig.mImage.width, mConfig.mImage.height); - format->setString("mime", mConfig.mMimeType.get()); - format->setInt32("width", mConfig.mImage.width); - format->setInt32("height", mConfig.mImage.height); - // Set the "moz-use-undequeued-bufs" to use the undeque buffers to accelerate - // the video decoding. - format->setInt32("moz-use-undequeued-bufs", 1); - if (mNativeWindow != nullptr) { -#if ANDROID_VERSION >= 21 - surface = new Surface(mGraphicBufferProducer); -#else - surface = new Surface(mNativeWindow->getBufferQueue()); -#endif - } - mDecoder->configure(format, surface, nullptr, 0); - mDecoder->Prepare(); - - if (mConfig.mMimeType.EqualsLiteral("video/mp4v-es")) { - rv = mDecoder->Input(mConfig.mCodecSpecificConfig->Elements(), - mConfig.mCodecSpecificConfig->Length(), 0, - android::MediaCodec::BUFFER_FLAG_CODECCONFIG, - CODECCONFIG_TIMEOUT_US); - } - - if (rv != OK) { - GVDM_LOG("Failed to configure codec!!!!"); - mInitPromise.Reject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - return; - } - - mInitPromise.Resolve(TrackType::kVideoTrack, __func__); -} - -void -GonkVideoDecoderManager::codecCanceled() -{ - GVDM_LOG("codecCanceled"); - mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); -} - -// Called on GonkDecoderManager::mTaskLooper thread. -void -GonkVideoDecoderManager::onMessageReceived(const sp &aMessage) -{ - switch (aMessage->what()) { - case kNotifyPostReleaseBuffer: - { - ReleaseAllPendingVideoBuffers(); - break; - } - - default: - { - GonkDecoderManager::onMessageReceived(aMessage); - break; - } - } -} - -uint8_t * -GonkVideoDecoderManager::GetColorConverterBuffer(int32_t aWidth, int32_t aHeight) -{ - // Allocate a temporary YUV420Planer buffer. - size_t yuv420p_y_size = aWidth * aHeight; - size_t yuv420p_u_size = ((aWidth + 1) / 2) * ((aHeight + 1) / 2); - size_t yuv420p_v_size = yuv420p_u_size; - size_t yuv420p_size = yuv420p_y_size + yuv420p_u_size + yuv420p_v_size; - if (mColorConverterBufferSize != yuv420p_size) { - mColorConverterBuffer = MakeUnique(yuv420p_size); - mColorConverterBufferSize = yuv420p_size; - } - return mColorConverterBuffer.get(); -} - -/* static */ -void -GonkVideoDecoderManager::RecycleCallback(TextureClient* aClient, void* aClosure) -{ - MOZ_ASSERT(aClient && !aClient->IsDead()); - GonkVideoDecoderManager* videoManager = static_cast(aClosure); - GrallocTextureData* client = static_cast(aClient->GetInternalData()); - aClient->ClearRecycleCallback(); - FenceHandle handle = aClient->GetAndResetReleaseFenceHandle(); - videoManager->PostReleaseVideoBuffer(client->GetMediaBuffer(), handle); -} - -void GonkVideoDecoderManager::PostReleaseVideoBuffer( - android::MediaBuffer *aBuffer, - FenceHandle aReleaseFence) -{ - { - MutexAutoLock autoLock(mPendingReleaseItemsLock); - if (aBuffer) { - mPendingReleaseItems.AppendElement(ReleaseItem(aBuffer, aReleaseFence)); - } - } - sp notify = - new AMessage(kNotifyPostReleaseBuffer, id()); - notify->post(); - -} - -void GonkVideoDecoderManager::ReleaseAllPendingVideoBuffers() -{ - nsTArray releasingItems; - { - MutexAutoLock autoLock(mPendingReleaseItemsLock); - releasingItems.AppendElements(mPendingReleaseItems); - mPendingReleaseItems.Clear(); - } - - // Free all pending video buffers without holding mPendingReleaseItemsLock. - size_t size = releasingItems.Length(); - for (size_t i = 0; i < size; i++) { - RefPtr fdObj = releasingItems[i].mReleaseFence.GetAndResetFdObj(); - sp fence = new Fence(fdObj->GetAndResetFd()); - fence->waitForever("GonkVideoDecoderManager"); - mDecoder->ReleaseMediaBuffer(releasingItems[i].mBuffer); - } - releasingItems.Clear(); -} - -} // namespace mozilla diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.h b/dom/media/platforms/gonk/GonkVideoDecoderManager.h deleted file mode 100644 index 343bb2a5ce83..000000000000 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.h +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#if !defined(GonkVideoDecoderManager_h_) -#define GonkVideoDecoderManager_h_ - -#include "nsRect.h" -#include "GonkMediaDataDecoder.h" -#include "mozilla/RefPtr.h" -#include "I420ColorConverterHelper.h" -#include "MediaCodecProxy.h" -#include "GonkNativeWindow.h" -#include "mozilla/layers/FenceUtils.h" -#include "mozilla/UniquePtr.h" -#include - -using namespace android; - -namespace android { -class MediaBuffer; -struct MOZ_EXPORT AString; -class GonkNativeWindow; -} // namespace android - -namespace mozilla { - -namespace layers { -class TextureClient; -class TextureClientRecycleAllocator; -} // namespace mozilla::layers - -class GonkVideoDecoderManager : public GonkDecoderManager { -typedef android::MediaCodecProxy MediaCodecProxy; -typedef mozilla::layers::TextureClient TextureClient; - -public: - GonkVideoDecoderManager(mozilla::layers::ImageContainer* aImageContainer, - const VideoInfo& aConfig); - - virtual ~GonkVideoDecoderManager(); - - RefPtr Init() override; - - nsresult Output(int64_t aStreamOffset, - RefPtr& aOutput) override; - - nsresult Shutdown() override; - - const char* GetDescriptionName() const override - { - return "gonk video decoder"; - } - - static void RecycleCallback(TextureClient* aClient, void* aClosure); - -protected: - // Bug 1199809: workaround to avoid sending the graphic buffer by making a - // copy of output buffer after calling flush(). Bug 1203859 was created to - // reimplementing Gonk PDM on top of OpenMax IL directly. Its buffer - // management will work better with Gecko and solve problems like this. - void ProcessFlush() override - { - mNeedsCopyBuffer = true; - GonkDecoderManager::ProcessFlush(); - } - -private: - struct FrameInfo - { - int32_t mWidth = 0; - int32_t mHeight = 0; - int32_t mStride = 0; - int32_t mSliceHeight = 0; - int32_t mColorFormat = 0; - int32_t mCropLeft = 0; - int32_t mCropTop = 0; - int32_t mCropRight = 0; - int32_t mCropBottom = 0; - }; - - void onMessageReceived(const android::sp &aMessage) override; - - bool SetVideoFormat(); - - nsresult CreateVideoData(MediaBuffer* aBuffer, int64_t aStreamOffset, VideoData** aOutData); - already_AddRefed CreateVideoDataFromGraphicBuffer(android::MediaBuffer* aSource, - gfx::IntRect& aPicture); - already_AddRefed CreateVideoDataFromDataBuffer(android::MediaBuffer* aSource, - gfx::IntRect& aPicture); - - uint8_t* GetColorConverterBuffer(int32_t aWidth, int32_t aHeight); - - // For codec resource management - void codecReserved(); - void codecCanceled(); - - void ReleaseAllPendingVideoBuffers(); - void PostReleaseVideoBuffer(android::MediaBuffer *aBuffer, - layers::FenceHandle mReleaseFence); - - VideoInfo mConfig; - - RefPtr mImageContainer; - RefPtr mCopyAllocator; - - MozPromiseRequestHolder mVideoCodecRequest; - FrameInfo mFrameInfo; - - // color converter - android::I420ColorConverterHelper mColorConverter; - UniquePtr mColorConverterBuffer; - size_t mColorConverterBufferSize; - - android::sp mNativeWindow; -#if ANDROID_VERSION >= 21 - android::sp mGraphicBufferProducer; -#endif - - enum { - kNotifyPostReleaseBuffer = 'nprb', - }; - - struct ReleaseItem { - ReleaseItem(android::MediaBuffer* aBuffer, layers::FenceHandle& aFence) - : mBuffer(aBuffer) - , mReleaseFence(aFence) {} - android::MediaBuffer* mBuffer; - layers::FenceHandle mReleaseFence; - }; - nsTArray mPendingReleaseItems; - - // The lock protects mPendingReleaseItems. - Mutex mPendingReleaseItemsLock; - - // This TaskQueue should be the same one in mDecodeCallback->OnReaderTaskQueue(). - // It is for codec resource mangement, decoding task should not dispatch to it. - RefPtr mReaderTaskQueue; - - // Bug 1199809: do we need to make a copy of output buffer? Used only when - // the decoder outputs graphic buffers. - bool mNeedsCopyBuffer; -}; - -} // namespace mozilla - -#endif // GonkVideoDecoderManager_h_ diff --git a/dom/media/platforms/gonk/moz.build b/dom/media/platforms/gonk/moz.build deleted file mode 100644 index 014594977cdd..000000000000 --- a/dom/media/platforms/gonk/moz.build +++ /dev/null @@ -1,39 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXPORTS += [ - 'GonkAudioDecoderManager.h', - 'GonkDecoderModule.h', - 'GonkMediaDataDecoder.h', - 'GonkVideoDecoderManager.h', -] -UNIFIED_SOURCES += [ - 'GonkAudioDecoderManager.cpp', - 'GonkDecoderModule.cpp', - 'GonkMediaDataDecoder.cpp', - 'GonkVideoDecoderManager.cpp', -] -LOCAL_INCLUDES += [ - '/dom/media/omx/', -] -include('/ipc/chromium/chromium-config.mozbuild') - -# Suppress some GCC/clang warnings being treated as errors: -# - about attributes on forward declarations for types that are already -# defined, which complains about an important MOZ_EXPORT for android::AString -# - about multi-character constants which are used in codec-related code -if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']: - CXXFLAGS += [ - '-Wno-error=attributes', - '-Wno-error=multichar' - ] - -FINAL_LIBRARY = 'xul' - -LOCAL_INCLUDES += [ - '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [ - 'frameworks/native/opengl/include',] -] diff --git a/dom/media/platforms/moz.build b/dom/media/platforms/moz.build index 95deb6e9cb38..eae28fb3de5b 100644 --- a/dom/media/platforms/moz.build +++ b/dom/media/platforms/moz.build @@ -68,10 +68,6 @@ if CONFIG['MOZ_APPLEMEDIA']: '-framework AudioToolbox', ] -if CONFIG['MOZ_GONK_MEDIACODEC']: - DEFINES['MOZ_GONK_MEDIACODEC'] = True - DIRS += ['gonk'] - include('/ipc/chromium/chromium-config.mozbuild') if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': From c64edca1b9885d94b0793a9012a58b6638a7e321 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 30 Dec 2016 21:51:42 +1100 Subject: [PATCH 10/70] Bug 1319987: P4. Refactor H264 Converter. r=cpearce We can make some assumptions now that the Input method is only called once and never again while a decode is pending. MozReview-Commit-ID: EmzKEcwNY2J --HG-- extra : rebase_source : 42ae59878962b425970a60abe25d98c023ef4fdf --- .../platforms/wrappers/H264Converter.cpp | 64 +++++++------------ dom/media/platforms/wrappers/H264Converter.h | 4 +- xpcom/base/ErrorList.h | 1 + 3 files changed, 26 insertions(+), 43 deletions(-) diff --git a/dom/media/platforms/wrappers/H264Converter.cpp b/dom/media/platforms/wrappers/H264Converter.cpp index 8b3aefb4d62a..e4db5e2a72a5 100644 --- a/dom/media/platforms/wrappers/H264Converter.cpp +++ b/dom/media/platforms/wrappers/H264Converter.cpp @@ -52,6 +52,9 @@ H264Converter::Init() void H264Converter::Input(MediaRawData* aSample) { + MOZ_RELEASE_ASSERT(!mInitPromiseRequest.Exists(), + "Still processing previous sample"); + if (!mp4_demuxer::AnnexB::ConvertSampleToAVCC(aSample)) { // We need AVCC content to be able to later parse the SPS. // This is a no-op if the data is already AVCC. @@ -60,19 +63,6 @@ H264Converter::Input(MediaRawData* aSample) return; } - if (mInitPromiseRequest.Exists()) { - if (mNeedKeyframe) { - if (!aSample->mKeyframe) { - // Frames dropped, we need a new one. - mCallback->InputExhausted(); - return; - } - mNeedKeyframe = false; - } - mMediaRawSamples.AppendElement(aSample); - return; - } - nsresult rv; if (!mDecoder) { // It is not possible to create an AVCC H264 decoder without SPS. @@ -87,12 +77,13 @@ H264Converter::Input(MediaRawData* aSample) } } else { rv = CheckForSPSChange(aSample); - if (rv == NS_ERROR_NOT_INITIALIZED) { - // The decoder is pending initialization. - mCallback->InputExhausted(); - return; - } } + + if (rv == NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER) { + // The decoder is pending initialization. + return; + } + if (NS_FAILED(rv)) { mCallback->Error( MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, @@ -229,14 +220,14 @@ H264Converter::CreateDecoderAndInit(MediaRawData* aSample) if (NS_SUCCEEDED(rv)) { // Queue the incoming sample. - mMediaRawSamples.AppendElement(aSample); + mPendingSample = aSample; mDecoder->Init() ->Then(AbstractThread::GetCurrent()->AsTaskQueue(), __func__, this, &H264Converter::OnDecoderInitDone, &H264Converter::OnDecoderInitFailed) ->Track(mInitPromiseRequest); - return NS_ERROR_NOT_INITIALIZED; + return NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER; } return rv; } @@ -245,32 +236,23 @@ void H264Converter::OnDecoderInitDone(const TrackType aTrackType) { mInitPromiseRequest.Complete(); - bool gotInput = false; - for (uint32_t i = 0 ; i < mMediaRawSamples.Length(); i++) { - const RefPtr& sample = mMediaRawSamples[i]; - if (mNeedKeyframe) { - if (!sample->mKeyframe) { - continue; - } - mNeedKeyframe = false; - } - if (!mNeedAVCC && - !mp4_demuxer::AnnexB::ConvertSampleToAnnexB(sample, mNeedKeyframe)) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("ConvertSampleToAnnexB"))); - mMediaRawSamples.Clear(); - return; - } - mDecoder->Input(sample); - } - if (!gotInput) { + RefPtr sample = mPendingSample.forget(); + if (mNeedKeyframe && !sample->mKeyframe) { mCallback->InputExhausted(); + return; } - mMediaRawSamples.Clear(); + mNeedKeyframe = false; + if (!mNeedAVCC && + !mp4_demuxer::AnnexB::ConvertSampleToAnnexB(sample, mNeedKeyframe)) { + mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("ConvertSampleToAnnexB"))); + return; + } + mDecoder->Input(sample); } void -H264Converter::OnDecoderInitFailed(MediaResult aError) +H264Converter::OnDecoderInitFailed(const MediaResult& aError) { mInitPromiseRequest.Complete(); mCallback->Error( diff --git a/dom/media/platforms/wrappers/H264Converter.h b/dom/media/platforms/wrappers/H264Converter.h index 66d68cc9f574..c995654755ec 100644 --- a/dom/media/platforms/wrappers/H264Converter.h +++ b/dom/media/platforms/wrappers/H264Converter.h @@ -59,14 +59,14 @@ private: void UpdateConfigFromExtraData(MediaByteBuffer* aExtraData); void OnDecoderInitDone(const TrackType aTrackType); - void OnDecoderInitFailed(MediaResult aError); + void OnDecoderInitFailed(const MediaResult& aError); RefPtr mPDM; VideoInfo mCurrentConfig; RefPtr mKnowsCompositor; RefPtr mImageContainer; const RefPtr mTaskQueue; - nsTArray> mMediaRawSamples; + RefPtr mPendingSample; MediaDataDecoderCallback* mCallback; RefPtr mDecoder; MozPromiseRequestHolder mInitPromiseRequest; diff --git a/xpcom/base/ErrorList.h b/xpcom/base/ErrorList.h index 74c4292abe5a..1b35d904b142 100644 --- a/xpcom/base/ErrorList.h +++ b/xpcom/base/ErrorList.h @@ -987,6 +987,7 @@ ERROR(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, FAILURE(12)), ERROR(NS_ERROR_DOM_MEDIA_CDM_ERR, FAILURE(13)), ERROR(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, FAILURE(14)), + ERROR(NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER, FAILURE(15)), /* Internal platform-related errors */ ERROR(NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR, FAILURE(101)), From 8953ccbc242c7223175a4c6ae2613c2c5750e2d7 Mon Sep 17 00:00:00 2001 From: Eduardo Boucas Date: Fri, 3 Feb 2017 17:19:20 +0000 Subject: [PATCH 11/70] Bug 1320233 - Add Learn More link to headers in Network panel. r=Honza --- .../locales/en-US/netmonitor.properties | 4 + .../shared/components/headers-mdn.js | 119 ++++++++++++++++++ .../shared/components/headers-panel.js | 47 ++++++- .../netmonitor/shared/components/moz.build | 1 + devtools/client/netmonitor/test/browser.ini | 1 + .../test/browser_net_header-docs.js | 56 +++++++++ .../shared/components/tree/tree-view.css | 17 +++ 7 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 devtools/client/netmonitor/shared/components/headers-mdn.js create mode 100644 devtools/client/netmonitor/test/browser_net_header-docs.js diff --git a/devtools/client/locales/en-US/netmonitor.properties b/devtools/client/locales/en-US/netmonitor.properties index a893a12c930a..719bea030d69 100644 --- a/devtools/client/locales/en-US/netmonitor.properties +++ b/devtools/client/locales/en-US/netmonitor.properties @@ -749,3 +749,7 @@ netmonitor.custom.cancel=Cancel # LOCALIZATION NOTE (netmonitor.backButton): This is the label displayed # on the button which exists the performance statistics view netmonitor.backButton=Back + +# LOCALIZATION NOTE (netmonitor.headers.learnMore): This is the label displayed +# next to a header list item, with a link to external documentation +netmonitor.headers.learnMore=Learn More diff --git a/devtools/client/netmonitor/shared/components/headers-mdn.js b/devtools/client/netmonitor/shared/components/headers-mdn.js new file mode 100644 index 000000000000..1b54480adf1f --- /dev/null +++ b/devtools/client/netmonitor/shared/components/headers-mdn.js @@ -0,0 +1,119 @@ +/* this source code form is subject to the terms of the mozilla public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * A mapping of header names to external documentation. Any header included + * here will show a "Learn More" link alongside it. + */ + +"use strict"; + +var URL_DOMAIN = "https://developer.mozilla.org"; +const URL_PATH = "/en-US/docs/Web/HTTP/Headers/"; +const URL_PARAMS = + "?utm_source=mozilla&utm_medium=devtools-netmonitor&utm_campaign=default"; + +var SUPPORTED_HEADERS = [ + "Accept", + "Accept-Charset", + "Accept-Encoding", + "Accept-Language", + "Accept-Ranges", + "Access-Control-Allow-Credentials", + "Access-Control-Allow-Headers", + "Access-Control-Allow-Methods", + "Access-Control-Allow-Origin", + "Access-Control-Expose-Headers", + "Access-Control-Max-Age", + "Access-Control-Request-Headers", + "Access-Control-Request-Method", + "Age", + "Cache-Control", + "Connection", + "Content-Disposition", + "Content-Encoding", + "Content-Language", + "Content-Length", + "Content-Location", + "Content-Security-Policy", + "Content-Security-Policy-Report-Only", + "Content-Type", + "Cookie", + "Cookie2", + "DNT", + "Date", + "ETag", + "Expires", + "From", + "Host", + "If-Match", + "If-Modified-Since", + "If-None-Match", + "If-Range", + "If-Unmodified-Since", + "Keep-Alive", + "Last-Modified", + "Location", + "Origin", + "Pragma", + "Public-Key-Pins", + "Public-Key-Pins-Report-Only", + "Referer", + "Referrer-Policy", + "Retry-After", + "Server", + "Set-Cookie", + "Set-Cookie2", + "Strict-Transport-Security", + "TE", + "Tk", + "Trailer", + "Transfer-Encoding", + "Upgrade-Insecure-Requests", + "User-Agent", + "Vary", + "Via", + "Warning", + "X-Content-Type-Options", + "X-DNS-Prefetch-Control", + "X-Frame-Options", + "X-XSS-Protection" +]; + +/** + * Get the MDN URL for the specified header + * + * @param {string} Name of the header + * The baseURL to use. + * + * @return {string} + * The MDN URL for the header, or null if not available. + */ +exports.getURL = (header) => { + if (SUPPORTED_HEADERS.indexOf(header) === -1) { + return null; + } + + return URL_DOMAIN + URL_PATH + header + URL_PARAMS; +}; + +/** + * Use a different domain for the URLs. Used only for testing. + * + * @param {string} domain + * The domain to use. + */ +exports.setDomain = (domain) => { + URL_DOMAIN = domain; +}; + +/** + * Use a different list of supported headers. Used only for testing. + * + * @param {array} headers + * The supported headers to use. + */ +exports.setSupportedHeaders = (headers) => { + SUPPORTED_HEADERS = headers; +}; diff --git a/devtools/client/netmonitor/shared/components/headers-panel.js b/devtools/client/netmonitor/shared/components/headers-panel.js index 49be96a6670a..78cc861f2654 100644 --- a/devtools/client/netmonitor/shared/components/headers-panel.js +++ b/devtools/client/netmonitor/shared/components/headers-panel.js @@ -15,11 +15,16 @@ const { const { L10N } = require("../../l10n"); const { writeHeaderText } = require("../../request-utils"); const { getFormattedSize } = require("../../utils/format-utils"); +const Services = require("Services"); +const { gDevTools } = require("devtools/client/framework/devtools"); +const HeadersMDN = require("devtools/client/netmonitor/shared/components/headers-mdn"); +const { REPS, MODE } = require("devtools/client/shared/components/reps/load-reps"); +const Rep = createFactory(REPS.Rep); // Components const PropertiesView = createFactory(require("./properties-view")); -const { div, input, textarea } = DOM; +const { a, div, input, textarea } = DOM; const EDIT_AND_RESEND = L10N.getStr("netmonitor.summary.editAndResend"); const RAW_HEADERS = L10N.getStr("netmonitor.summary.rawHeaders"); const RAW_HEADERS_REQUEST = L10N.getStr("netmonitor.summary.rawHeaders.requestHeaders"); @@ -45,6 +50,7 @@ const HeadersPanel = createClass({ propTypes: { cloneSelectedRequest: PropTypes.func.isRequired, request: PropTypes.object.isRequired, + renderValue: PropTypes.func }, getInitialState() { @@ -213,10 +219,49 @@ const HeadersPanel = createClass({ object, filterPlaceHolder: HEADERS_FILTER_TEXT, sectionNames: Object.keys(object), + renderValue }), ) ); } }); +function onLearnMoreClick(e, headerDocURL) { + e.stopPropagation(); + e.preventDefault(); + + let win = Services.wm.getMostRecentWindow(gDevTools.chromeWindowType); + win.openUILinkIn(headerDocURL, "tab"); +} + +function renderValue(props) { + const { member, value } = props; + + if (typeof value !== "string") { + return null; + } + + let headerDocURL = HeadersMDN.getURL(member.name); + + return ( + div({ className: "treeValueCellDivider" }, + Rep(Object.assign(props, { + // FIXME: A workaround for the issue in StringRep + // Force StringRep to crop the text everytime + member: Object.assign({}, member, { open: false }), + mode: MODE.TINY, + cropLimit: 60, + })), + headerDocURL ? + a({ + className: "learn-more-link", + title: headerDocURL, + onClick: (e) => onLearnMoreClick(e, headerDocURL), + }, `[${L10N.getStr("netmonitor.headers.learnMore")}]`) + : + null + ) + ); +} + module.exports = HeadersPanel; diff --git a/devtools/client/netmonitor/shared/components/moz.build b/devtools/client/netmonitor/shared/components/moz.build index 25293bf437f0..f248811c0a27 100644 --- a/devtools/client/netmonitor/shared/components/moz.build +++ b/devtools/client/netmonitor/shared/components/moz.build @@ -6,6 +6,7 @@ DevToolsModules( 'cookies-panel.js', 'details-panel.js', 'editor.js', + 'headers-mdn.js', 'headers-panel.js', 'params-panel.js', 'preview-panel.js', diff --git a/devtools/client/netmonitor/test/browser.ini b/devtools/client/netmonitor/test/browser.ini index dea4674248df..fa88acf58a73 100644 --- a/devtools/client/netmonitor/test/browser.ini +++ b/devtools/client/netmonitor/test/browser.ini @@ -98,6 +98,7 @@ skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 [browser_net_cyrillic-01.js] [browser_net_cyrillic-02.js] [browser_net_frame.js] +[browser_net_header-docs.js] skip-if = (os == 'linux' && debug && bits == 32) # Bug 1321434 [browser_net_filter-01.js] skip-if = (os == 'linux' && debug && bits == 32) # Bug 1303439 diff --git a/devtools/client/netmonitor/test/browser_net_header-docs.js b/devtools/client/netmonitor/test/browser_net_header-docs.js new file mode 100644 index 000000000000..fff4213909b6 --- /dev/null +++ b/devtools/client/netmonitor/test/browser_net_header-docs.js @@ -0,0 +1,56 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const HeadersMDN = require("devtools/client/netmonitor/shared/components/headers-mdn"); + +/** + * Tests if "Learn More" links are correctly displayed + * next to headers. + */ +add_task(function* () { + let { tab, monitor } = yield initNetMonitor(POST_DATA_URL); + info("Starting test... "); + + let { document, NetMonitorView } = monitor.panelWin; + let { RequestsMenu } = NetMonitorView; + + RequestsMenu.lazyUpdate = false; + + let wait = waitForNetworkEvents(monitor, 0, 2); + yield ContentTask.spawn(tab.linkedBrowser, {}, function* () { + content.wrappedJSObject.performRequests(); + }); + yield wait; + + let origItem = RequestsMenu.getItemAtIndex(0); + RequestsMenu.selectedItem = origItem; + + EventUtils.sendMouseEvent({ type: "click" }, + document.querySelectorAll(".request-list-item")[0]); + + testShowLearnMore(origItem); + + return teardown(monitor); + + /* + * Tests that a "Learn More" button is only shown if + * and only if a header is documented in MDN. + */ + function testShowLearnMore(data) { + document.querySelectorAll(".properties-view .treeRow.stringRow").forEach((rowEl, index) => { + let headerName = rowEl.querySelectorAll(".treeLabelCell .treeLabel")[0].textContent; + let headerDocURL = HeadersMDN.getURL(headerName); + let learnMoreEl = rowEl.querySelectorAll(".treeValueCell .learn-more-link"); + + if (headerDocURL === null) { + ok(learnMoreEl.length === 0, + "undocumented header does not include a \"Learn More\" button"); + } else { + ok(learnMoreEl[0].getAttribute("title") === headerDocURL, + "documented header includes a \"Learn More\" button with a link to MDN"); + } + }); + } +}); diff --git a/devtools/client/shared/components/tree/tree-view.css b/devtools/client/shared/components/tree/tree-view.css index cc6686556f9e..cccf92a2ba5e 100644 --- a/devtools/client/shared/components/tree/tree-view.css +++ b/devtools/client/shared/components/tree/tree-view.css @@ -77,6 +77,23 @@ display: none; } +.treeTable .treeValueCellDivider { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +/* Learn More link */ +.treeTable .treeValueCell .learn-more-link { + color: var(--theme-highlight-blue); + cursor: pointer; + margin: 0 5px; +} + +.treeTable .treeValueCell .learn-more-link:hover { + text-decoration: underline; +} + /******************************************************************************/ /* Toggle Icon */ From 020af842d87e6eea2bd0f8eda2767399893dd572 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Fri, 3 Feb 2017 14:58:00 -0500 Subject: [PATCH 12/70] Bug 1320972 - Allow a max difference of 1 on Android for 722923-1.html. r=me --- layout/reftests/bugs/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 4d6550961fc0..8c3c98e91e96 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1717,7 +1717,7 @@ needs-focus != 703186-1.html 703186-2.html fuzzy-if(true,1,21) fuzzy-if(d2d,68,173) fuzzy-if(cocoaWidget,1,170) == 718521.html 718521-ref.html # bug 773482 == 720987.html 720987-ref.html == 722888-1.html 722888-1-ref.html -== 722923-1.html 722923-1-ref.html +fuzzy-if(Android,1,40000) == 722923-1.html 722923-1-ref.html == 723484-1.html 723484-1-ref.html random-if(Android) == 728983-1.html 728983-1-ref.html == 729143-1.html 729143-1-ref.html From a02136ffc6f86e2a07a71547b25c1a5d1c7c555e Mon Sep 17 00:00:00 2001 From: JerryShih Date: Fri, 3 Feb 2017 01:06:00 -0500 Subject: [PATCH 13/70] Bug 1336362 - Remove PCompositable, PLayer and PImageContainer related def. r=dvander MozReview-Commit-ID: IzxHU1SRh2t --- gfx/layers/ImageContainer.h | 3 --- gfx/layers/client/ClientLayerManager.h | 7 +++---- gfx/layers/client/CompositableClient.h | 1 - gfx/layers/ipc/ShadowLayers.h | 1 - gfx/vr/ipc/VRManagerChild.h | 1 - 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index bb7580c83b85..62a520ed30c0 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -147,7 +147,6 @@ class ImageClient; class ImageCompositeNotification; class ImageContainer; class ImageContainerChild; -class PImageContainerChild; class SharedPlanarYCbCrImage; class PlanarYCbCrImage; class TextureClient; @@ -583,8 +582,6 @@ public: void NotifyComposite(const ImageCompositeNotification& aNotification); - PImageContainerChild* GetPImageContainerChild(); - ImageContainerListener* GetImageContainerListener() { return mNotifyCompositeListener; diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 818a5f9e1bd2..364ba9245547 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -32,7 +32,6 @@ namespace layers { class ClientPaintedLayer; class CompositorBridgeChild; class ImageLayer; -class PLayerChild; class FrameUniformityData; class ClientLayerManager final : public LayerManager @@ -380,9 +379,9 @@ public: } }; -// Create a shadow layer (PLayerChild) for aLayer, if we're forwarding -// our layer tree to a parent process. Record the new layer creation -// in the current open transaction as a side effect. +// Create a LayerHandle for aLayer, if we're forwarding our layer tree +// to a parent process. Record the new layer creation in the current +// open transaction as a side effect. template void CreateShadowFor(ClientLayer* aLayer, ClientLayerManager* aMgr, diff --git a/gfx/layers/client/CompositableClient.h b/gfx/layers/client/CompositableClient.h index 16463cb69a79..65c36c4efc7a 100644 --- a/gfx/layers/client/CompositableClient.h +++ b/gfx/layers/client/CompositableClient.h @@ -25,7 +25,6 @@ class ImageBridgeChild; class ImageContainer; class CompositableForwarder; class CompositableChild; -class PCompositableChild; class TextureClientRecycleAllocator; class ContentClientRemote; diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index b198de55980b..c80eb34c99e1 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -37,7 +37,6 @@ class EditReply; class FixedSizeSmallShmemSectionAllocator; class ImageContainer; class Layer; -class PLayerChild; class PLayerTransactionChild; class LayerTransactionChild; class ShadowableLayer; diff --git a/gfx/vr/ipc/VRManagerChild.h b/gfx/vr/ipc/VRManagerChild.h index c06ea2b86e5b..b52eeca69e5c 100644 --- a/gfx/vr/ipc/VRManagerChild.h +++ b/gfx/vr/ipc/VRManagerChild.h @@ -23,7 +23,6 @@ class VRDisplay; class VREventObserver; } // namespace dom namespace layers { -class PCompositableChild; class TextureClient; } namespace gfx { From 029c5d0ca2e2a8b1595af642b2784e3328e856d8 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Sat, 21 Jan 2017 17:26:01 +0900 Subject: [PATCH 14/70] Bug 675709 - Create needed API when printing info PDF on macOS. r=haik --- widget/cocoa/nsPrintSettingsX.h | 16 +++ widget/cocoa/nsPrintSettingsX.mm | 227 ++++++++++++++++++++++++++++++- 2 files changed, 241 insertions(+), 2 deletions(-) diff --git a/widget/cocoa/nsPrintSettingsX.h b/widget/cocoa/nsPrintSettingsX.h index 1d755b25057d..cedc99ad6930 100644 --- a/widget/cocoa/nsPrintSettingsX.h +++ b/widget/cocoa/nsPrintSettingsX.h @@ -51,8 +51,22 @@ public: void SetInchesScale(float aWidthScale, float aHeightScale); void GetInchesScale(float *aWidthScale, float *aHeightScale); + NS_IMETHOD SetPaperSizeUnit(int16_t aPaperSizeUnit) override; + + NS_IMETHOD SetScaling(double aScaling) override; + NS_IMETHOD SetToFileName(const char16_t * aToFileName) override; + + NS_IMETHOD GetOrientation(int32_t *aOrientation) override; + NS_IMETHOD SetOrientation(int32_t aOrientation) override; + + NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop) override; + NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) override; + NS_IMETHOD SetUnwriteableMarginBottom(double aUnwriteableMarginBottom) override; + NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight) override; + void SetAdjustedPaperSize(double aWidth, double aHeight); void GetAdjustedPaperSize(double *aWidth, double *aHeight); + nsresult SetCocoaPaperSize(double aWidth, double aHeight); protected: virtual ~nsPrintSettingsX(); @@ -63,6 +77,8 @@ protected: nsresult _Clone(nsIPrintSettings **_retval) override; nsresult _Assign(nsIPrintSettings *aPS) override; + int GetCocoaUnit(int16_t aGeckoUnit); + // The out param has a ref count of 1 on return so caller needs to PMRelase() when done. OSStatus CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat); OSStatus CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings); diff --git a/widget/cocoa/nsPrintSettingsX.mm b/widget/cocoa/nsPrintSettingsX.mm index 73a8e78d2b1c..ae64c75b18e4 100644 --- a/widget/cocoa/nsPrintSettingsX.mm +++ b/widget/cocoa/nsPrintSettingsX.mm @@ -254,8 +254,13 @@ NS_IMETHODIMP nsPrintSettingsX::SetPaperHeight(double aPaperHeight) NS_IMETHODIMP nsPrintSettingsX::GetEffectivePageSize(double *aWidth, double *aHeight) { - *aWidth = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); - *aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); + if (kPaperSizeInches == GetCocoaUnit(mPaperSizeUnit)) { + *aWidth = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); + *aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); + } else { + *aWidth = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); + *aHeight = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); + } return NS_OK; } @@ -270,3 +275,221 @@ void nsPrintSettingsX::GetAdjustedPaperSize(double *aWidth, double *aHeight) *aWidth = mAdjustedPaperWidth; *aHeight = mAdjustedPaperHeight; } + +NS_IMETHODIMP +nsPrintSettingsX::SetPaperSizeUnit(int16_t aPaperSizeUnit) +{ + mPaperSizeUnit = aPaperSizeUnit; + return NS_OK; +} + +NS_IMETHODIMP +nsPrintSettingsX::SetScaling(double aScaling) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + [printInfoDict setObject: [NSNumber numberWithFloat: aScaling] + forKey: NSPrintScalingFactor]; + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} + +NS_IMETHODIMP +nsPrintSettingsX::SetToFileName(const char16_t *aToFileName) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + nsString filename = nsDependentString(aToFileName); + + NSURL* jobSavingURL = + [NSURL fileURLWithPath: nsCocoaUtils::ToNSString(filename)]; + if (jobSavingURL) { + [printInfoDict setObject: NSPrintSaveJob forKey: NSPrintJobDisposition]; + [printInfoDict setObject: jobSavingURL forKey: NSPrintJobSavingURL]; + } + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} + +NS_IMETHODIMP +nsPrintSettingsX::GetOrientation(int32_t *aOrientation) +{ + if ([mPrintInfo orientation] == NSPaperOrientationPortrait) { + *aOrientation = nsIPrintSettings::kPortraitOrientation; + } else { + *aOrientation = nsIPrintSettings::kLandscapeOrientation; + } + return NS_OK; +} + +NS_IMETHODIMP +nsPrintSettingsX::SetOrientation(int32_t aOrientation) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + if (aOrientation == nsIPrintSettings::kPortraitOrientation) { + [printInfoDict setObject: [NSNumber numberWithInt: NSPaperOrientationPortrait] + forKey: NSPrintOrientation]; + } else { + [printInfoDict setObject: [NSNumber numberWithInt: NSPaperOrientationLandscape] + forKey: NSPrintOrientation]; + } + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} + +NS_IMETHODIMP +nsPrintSettingsX::SetUnwriteableMarginTop(double aUnwriteableMarginTop) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + nsPrintSettings::SetUnwriteableMarginTop(aUnwriteableMarginTop); + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginTop] + forKey : NSPrintTopMargin]; + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} + +NS_IMETHODIMP +nsPrintSettingsX::SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + nsPrintSettings::SetUnwriteableMarginLeft(aUnwriteableMarginLeft); + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginLeft] + forKey : NSPrintLeftMargin]; + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} + +NS_IMETHODIMP +nsPrintSettingsX::SetUnwriteableMarginBottom(double aUnwriteableMarginBottom) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + nsPrintSettings::SetUnwriteableMarginBottom(aUnwriteableMarginBottom); + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginBottom] + forKey : NSPrintBottomMargin]; + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} + +NS_IMETHODIMP +nsPrintSettingsX::SetUnwriteableMarginRight(double aUnwriteableMarginRight) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + nsPrintSettings::SetUnwriteableMarginRight(aUnwriteableMarginRight); + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginRight] + forKey : NSPrintRightMargin]; + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} + +int +nsPrintSettingsX::GetCocoaUnit(int16_t aGeckoUnit) +{ + if (aGeckoUnit == kPaperSizeMillimeters) + return kPaperSizeMillimeters; + else + return kPaperSizeInches; +} + +nsresult nsPrintSettingsX::SetCocoaPaperSize(double aWidth, double aHeight) +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + NSSize paperSize; + NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; + if ([mPrintInfo orientation] == NSPaperOrientationPortrait) { + // switch widths and heights + paperSize = NSMakeSize(aWidth, aHeight); + [printInfoDict setObject: [NSValue valueWithSize: paperSize] + forKey: NSPrintPaperSize]; + } else { + paperSize = NSMakeSize(aHeight, aWidth); + [printInfoDict setObject: [NSValue valueWithSize: paperSize] + forKey: NSPrintPaperSize]; + } + NSPrintInfo* newPrintInfo = + [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; + if (NS_WARN_IF(!newPrintInfo)) { + return NS_ERROR_OUT_OF_MEMORY; + } + + SetCocoaPrintInfo(newPrintInfo); + [newPrintInfo release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; +} From b138378a8626d48462832f0fd3fe3337f66dc0d4 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Sat, 21 Jan 2017 17:42:37 +0900 Subject: [PATCH 15/70] Bug 675709 - Set needed paper size information when printing info PDF on macOS. r=haik --HG-- extra : amend_source : ef8d05cd84882961e6bbd4dcb801ecd8b148434a --- widget/cocoa/nsDeviceContextSpecX.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/widget/cocoa/nsDeviceContextSpecX.mm b/widget/cocoa/nsDeviceContextSpecX.mm index 0a72af8ed89a..a22572b614b0 100644 --- a/widget/cocoa/nsDeviceContextSpecX.mm +++ b/widget/cocoa/nsDeviceContextSpecX.mm @@ -64,6 +64,19 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget *aWidget, if (!settings) return NS_ERROR_NO_INTERFACE; + bool toFile; + settings->GetPrintToFile(&toFile); + + bool toPrinter = !toFile && !aIsPrintPreview; + if (!toPrinter) { + double width, height; + settings->GetEffectivePageSize(&width, &height); + width /= TWIPS_PER_POINT_FLOAT; + height /= TWIPS_PER_POINT_FLOAT; + + settings->SetCocoaPaperSize(width, height); + } + mPrintSession = settings->GetPMPrintSession(); ::PMRetain(mPrintSession); mPageFormat = settings->GetPMPageFormat(); From 73fd84bc5d3aaba338a2c1dc7e9c94885e51322b Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 26 Jan 2017 13:56:46 +0100 Subject: [PATCH 16/70] Bug 1319987: P5. Promisify MediaDataDecoder. r=cpearce,gerald,mattwoodrow,snorp This is a big change, and unfortunately impossible to break down with independently functional commits. There are four main changes being applied here: * Code cleanup, including making all MediaDataDecoder related code mozilla coding style compliant * Make MediaDataDecoder use MozPromise * Making Flush and Shutdown processes fully asynchronous * Fixing few data races encountered across the code, in particular in the Android PDM MozReview-Commit-ID: DpiZucGofJT --HG-- extra : rebase_source : 80bd6c6f9726d536b6f306c40d9af6df27333be9 --- dom/media/Benchmark.cpp | 163 +++--- dom/media/Benchmark.h | 15 +- dom/media/MediaFormatReader.cpp | 436 +++++++++------- dom/media/MediaFormatReader.h | 119 ++--- dom/media/ipc/PVideoDecoder.ipdl | 4 +- dom/media/ipc/RemoteVideoDecoder.cpp | 76 +-- dom/media/ipc/RemoteVideoDecoder.h | 21 +- dom/media/ipc/VideoDecoderChild.cpp | 113 ++-- dom/media/ipc/VideoDecoderChild.h | 27 +- dom/media/ipc/VideoDecoderParent.cpp | 169 +++--- dom/media/ipc/VideoDecoderParent.h | 21 +- dom/media/platforms/PlatformDecoderModule.h | 126 ++--- .../platforms/agnostic/BlankDecoderModule.cpp | 64 ++- dom/media/platforms/agnostic/OpusDecoder.cpp | 138 +++-- dom/media/platforms/agnostic/OpusDecoder.h | 15 +- .../platforms/agnostic/TheoraDecoder.cpp | 85 ++- dom/media/platforms/agnostic/TheoraDecoder.h | 14 +- dom/media/platforms/agnostic/VPXDecoder.cpp | 100 ++-- dom/media/platforms/agnostic/VPXDecoder.h | 20 +- .../platforms/agnostic/VorbisDecoder.cpp | 125 ++--- dom/media/platforms/agnostic/VorbisDecoder.h | 15 +- dom/media/platforms/agnostic/WAVDecoder.cpp | 51 +- dom/media/platforms/agnostic/WAVDecoder.h | 13 +- .../agnostic/eme/EMEDecoderModule.cpp | 225 +++++--- .../platforms/agnostic/eme/EMEDecoderModule.h | 7 +- .../agnostic/eme/EMEVideoDecoder.cpp | 23 +- .../platforms/agnostic/eme/EMEVideoDecoder.h | 13 +- .../agnostic/eme/SamplesWaitingForKey.cpp | 57 +- .../agnostic/eme/SamplesWaitingForKey.h | 39 +- .../agnostic/gmp/GMPDecoderModule.cpp | 8 +- .../agnostic/gmp/GMPVideoDecoder.cpp | 158 +++--- .../platforms/agnostic/gmp/GMPVideoDecoder.h | 87 ++-- .../agnostic/gmp/MediaDataDecoderProxy.cpp | 65 +-- .../agnostic/gmp/MediaDataDecoderProxy.h | 133 +---- .../android/AndroidDecoderModule.cpp | 71 +-- .../platforms/android/AndroidDecoderModule.h | 3 +- .../android/MediaCodecDataDecoder.cpp | 270 ++++------ .../platforms/android/MediaCodecDataDecoder.h | 49 +- .../platforms/android/RemoteDataDecoder.cpp | 491 +++++++++--------- .../platforms/android/RemoteDataDecoder.h | 58 ++- dom/media/platforms/apple/AppleATDecoder.cpp | 90 ++-- dom/media/platforms/apple/AppleATDecoder.h | 25 +- .../platforms/apple/AppleDecoderModule.cpp | 5 +- dom/media/platforms/apple/AppleVTDecoder.cpp | 316 ++++++----- dom/media/platforms/apple/AppleVTDecoder.h | 32 +- .../platforms/ffmpeg/FFmpegAudioDecoder.cpp | 81 +-- .../platforms/ffmpeg/FFmpegAudioDecoder.h | 5 +- .../platforms/ffmpeg/FFmpegDataDecoder.cpp | 67 +-- .../platforms/ffmpeg/FFmpegDataDecoder.h | 21 +- .../platforms/ffmpeg/FFmpegDecoderModule.h | 2 - .../platforms/ffmpeg/FFmpegVideoDecoder.cpp | 41 +- .../platforms/ffmpeg/FFmpegVideoDecoder.h | 11 +- .../platforms/omx/GonkOmxPlatformLayer.cpp | 3 +- dom/media/platforms/omx/OmxDataDecoder.cpp | 195 +++---- dom/media/platforms/omx/OmxDataDecoder.h | 37 +- dom/media/platforms/omx/OmxDecoderModule.cpp | 2 - dom/media/platforms/wmf/WMFAudioMFTManager.h | 13 +- dom/media/platforms/wmf/WMFDecoderModule.cpp | 4 +- dom/media/platforms/wmf/WMFDecoderModule.h | 3 +- .../platforms/wmf/WMFMediaDataDecoder.cpp | 111 ++-- dom/media/platforms/wmf/WMFMediaDataDecoder.h | 37 +- dom/media/platforms/wmf/WMFVideoMFTManager.h | 4 +- .../platforms/wrappers/H264Converter.cpp | 88 ++-- dom/media/platforms/wrappers/H264Converter.h | 14 +- 64 files changed, 2293 insertions(+), 2601 deletions(-) diff --git a/dom/media/Benchmark.cpp b/dom/media/Benchmark.cpp index 6c5b87d54a21..070d48fdb1df 100644 --- a/dom/media/Benchmark.cpp +++ b/dom/media/Benchmark.cpp @@ -150,6 +150,7 @@ BenchmarkPlayback::BenchmarkPlayback(Benchmark* aMainThreadState, , mSampleIndex(0) , mFrameCount(0) , mFinished(false) + , mDrained(false) { MOZ_ASSERT(static_cast(mMainThreadState)->OnThread()); } @@ -186,8 +187,8 @@ BenchmarkPlayback::DemuxNextSample() Thread(), __func__, [this, ref](RefPtr aHolder) { mSamples.AppendElements(Move(aHolder->mSamples)); - if (ref->mParameters.mStopAtFrame && - mSamples.Length() == (size_t)ref->mParameters.mStopAtFrame.ref()) { + if (ref->mParameters.mStopAtFrame + && mSamples.Length() == (size_t)ref->mParameters.mStopAtFrame.ref()) { InitDecoder(Move(*mTrackDemuxer->GetInfo())); } else { Dispatch(NS_NewRunnableFunction([this, ref]() { DemuxNextSample(); })); @@ -210,7 +211,7 @@ BenchmarkPlayback::InitDecoder(TrackInfo&& aInfo) MOZ_ASSERT(OnThread()); RefPtr platform = new PDMFactory(); - mDecoder = platform->CreateDecoder({ aInfo, mDecoderTaskQueue, reinterpret_cast(this) }); + mDecoder = platform->CreateDecoder({ aInfo, mDecoderTaskQueue }); if (!mDecoder) { MainThreadShutdown(); return; @@ -221,7 +222,7 @@ BenchmarkPlayback::InitDecoder(TrackInfo&& aInfo) [this, ref](TrackInfo::TrackType aTrackType) { InputExhausted(); }, - [this, ref](MediaResult aError) { + [this, ref](const MediaResult& aError) { MainThreadShutdown(); }); } @@ -238,98 +239,88 @@ BenchmarkPlayback::MainThreadShutdown() mFinished = true; if (mDecoder) { - mDecoder->Flush(); - mDecoder->Shutdown(); - mDecoder = nullptr; + RefPtr ref(mMainThreadState); + mDecoder->Flush()->Then( + Thread(), __func__, + [ref, this]() { + mDecoder->Shutdown()->Then( + Thread(), __func__, + [ref, this]() { + mDecoderTaskQueue->BeginShutdown(); + mDecoderTaskQueue->AwaitShutdownAndIdle(); + mDecoderTaskQueue = nullptr; + + if (mTrackDemuxer) { + mTrackDemuxer->Reset(); + mTrackDemuxer->BreakCycles(); + mTrackDemuxer = nullptr; + } + + Thread()->AsTaskQueue()->BeginShutdown()->Then( + ref->Thread(), __func__, + [ref]() { ref->Dispose(); }, + []() { MOZ_CRASH("not reached"); }); + }, + []() { MOZ_CRASH("not reached"); }); + mDecoder = nullptr; + }, + []() { MOZ_CRASH("not reached"); }); } +} - mDecoderTaskQueue->BeginShutdown(); - mDecoderTaskQueue->AwaitShutdownAndIdle(); - mDecoderTaskQueue = nullptr; - - if (mTrackDemuxer) { - mTrackDemuxer->Reset(); - mTrackDemuxer->BreakCycles(); - mTrackDemuxer = nullptr; +void +BenchmarkPlayback::Output(const MediaDataDecoder::DecodedData& aResults) +{ + MOZ_ASSERT(OnThread()); + RefPtr ref(mMainThreadState); + mFrameCount += aResults.Length(); + if (!mDecodeStartTime && mFrameCount >= ref->mParameters.mStartupFrame) { + mDecodeStartTime = Some(TimeStamp::Now()); } - - RefPtr ref(mMainThreadState); - Thread()->AsTaskQueue()->BeginShutdown()->Then( - ref->Thread(), __func__, - [ref]() { ref->Dispose(); }, - []() { MOZ_CRASH("not reached"); }); -} - -void -BenchmarkPlayback::Output(MediaData* aData) -{ - RefPtr ref(mMainThreadState); - Dispatch(NS_NewRunnableFunction([this, ref]() { - mFrameCount++; - if (mFrameCount == ref->mParameters.mStartupFrame) { - mDecodeStartTime = TimeStamp::Now(); - } - int32_t frames = mFrameCount - ref->mParameters.mStartupFrame; - TimeDuration elapsedTime = TimeStamp::Now() - mDecodeStartTime; - if (!mFinished && - (frames == ref->mParameters.mFramesToMeasure || - elapsedTime >= ref->mParameters.mTimeout)) { - uint32_t decodeFps = frames / elapsedTime.ToSeconds(); - MainThreadShutdown(); - ref->Dispatch(NS_NewRunnableFunction([ref, decodeFps]() { - ref->ReturnResult(decodeFps); - })); - } - })); -} - -void -BenchmarkPlayback::Error(const MediaResult& aError) -{ - RefPtr ref(mMainThreadState); - Dispatch(NS_NewRunnableFunction([this, ref]() { MainThreadShutdown(); })); -} - -void -BenchmarkPlayback::InputExhausted() -{ - RefPtr ref(mMainThreadState); - Dispatch(NS_NewRunnableFunction([this, ref]() { - MOZ_ASSERT(OnThread()); - if (mFinished || mSampleIndex >= mSamples.Length()) { - return; - } - mDecoder->Input(mSamples[mSampleIndex]); - mSampleIndex++; - if (mSampleIndex == mSamples.Length()) { - if (ref->mParameters.mStopAtFrame) { - mSampleIndex = 0; - } else { - mDecoder->Drain(); - } - } - })); -} - -void -BenchmarkPlayback::DrainComplete() -{ - RefPtr ref(mMainThreadState); - Dispatch(NS_NewRunnableFunction([this, ref]() { - int32_t frames = mFrameCount - ref->mParameters.mStartupFrame; - TimeDuration elapsedTime = TimeStamp::Now() - mDecodeStartTime; + TimeStamp now = TimeStamp::Now(); + int32_t frames = mFrameCount - ref->mParameters.mStartupFrame; + TimeDuration elapsedTime = now - mDecodeStartTime.refOr(now); + if (!mFinished + && (((frames == ref->mParameters.mFramesToMeasure) && frames > 0) + || elapsedTime >= ref->mParameters.mTimeout + || mDrained)) { uint32_t decodeFps = frames / elapsedTime.ToSeconds(); MainThreadShutdown(); ref->Dispatch(NS_NewRunnableFunction([ref, decodeFps]() { ref->ReturnResult(decodeFps); })); - })); + } } -bool -BenchmarkPlayback::OnReaderTaskQueue() +void +BenchmarkPlayback::InputExhausted() { - return OnThread(); + MOZ_ASSERT(OnThread()); + if (mFinished || mSampleIndex >= mSamples.Length()) { + return; + } + RefPtr ref(mMainThreadState); + mDecoder->Decode(mSamples[mSampleIndex]) + ->Then(Thread(), __func__, + [ref, this](const MediaDataDecoder::DecodedData& aResults) { + Output(aResults); + InputExhausted(); + }, + [ref, this](const MediaResult& aError) { MainThreadShutdown(); }); + mSampleIndex++; + if (mSampleIndex == mSamples.Length()) { + if (ref->mParameters.mStopAtFrame) { + mSampleIndex = 0; + } else { + mDecoder->Drain()->Then( + Thread(), __func__, + [ref, this](const MediaDataDecoder::DecodedData& aResults) { + mDrained = true; + Output(aResults); + }, + [ref, this](const MediaResult& aError) { MainThreadShutdown(); }); + } + } } -} +} // namespace mozilla diff --git a/dom/media/Benchmark.h b/dom/media/Benchmark.h index bb14751f45c4..084fec8a39f5 100644 --- a/dom/media/Benchmark.h +++ b/dom/media/Benchmark.h @@ -10,6 +10,7 @@ #include "MediaDataDemuxer.h" #include "QueueObject.h" #include "PlatformDecoderModule.h" +#include "mozilla/Maybe.h" #include "mozilla/RefPtr.h" #include "mozilla/TaskQueue.h" #include "mozilla/TimeStamp.h" @@ -20,7 +21,7 @@ namespace mozilla { class TaskQueue; class Benchmark; -class BenchmarkPlayback : public QueueObject, private MediaDataDecoderCallback +class BenchmarkPlayback : public QueueObject { friend class Benchmark; explicit BenchmarkPlayback(Benchmark* aMainThreadState, MediaDataDemuxer* aDemuxer); @@ -29,13 +30,8 @@ class BenchmarkPlayback : public QueueObject, private MediaDataDecoderCallback void MainThreadShutdown(); void InitDecoder(TrackInfo&& aInfo); - // MediaDataDecoderCallback - // Those methods are called on the MediaDataDecoder's task queue. - void Output(MediaData* aData) override; - void Error(const MediaResult& aError) override; - void InputExhausted() override; - void DrainComplete() override; - bool OnReaderTaskQueue() override; + void Output(const MediaDataDecoder::DecodedData& aResults); + void InputExhausted(); Atomic mMainThreadState; @@ -47,9 +43,10 @@ class BenchmarkPlayback : public QueueObject, private MediaDataDecoderCallback RefPtr mTrackDemuxer; nsTArray> mSamples; size_t mSampleIndex; - TimeStamp mDecodeStartTime; + Maybe mDecodeStartTime; uint32_t mFrameCount; bool mFinished; + bool mDrained; }; // Init() must have been called at least once prior on the diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 1d8b5e36b8bd..7792a6d6f759 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -22,6 +22,7 @@ #include "mozilla/Telemetry.h" #include "mozilla/SharedThreadPool.h" #include "mozilla/SyncRunnable.h" +#include "mozilla/Unused.h" #include "nsContentUtils.h" #include "nsPrintfCString.h" #include "nsSize.h" @@ -198,6 +199,27 @@ class MediaFormatReader::DecoderFactory public: explicit DecoderFactory(MediaFormatReader* aOwner) : mOwner(aOwner) {} void CreateDecoder(TrackType aTrack); + // Shutdown any decoder pending initialization. + RefPtr ShutdownDecoder(TrackType aTrack) + { + MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack || + aTrack == TrackInfo::kVideoTrack); + auto& data = aTrack == TrackInfo::kAudioTrack ? mAudio : mVideo; + data.mTokenRequest.DisconnectIfExists(); + data.mInitRequest.DisconnectIfExists(); + if (!data.mDecoder) { + return ShutdownPromise::CreateAndResolve(true, __func__); + } + if (data.mShutdownRequest.Exists()) { + // A shutdown is already in progress due to a prior initialization error, + // return the existing promise. + data.mShutdownRequest.Disconnect(); + RefPtr p = data.mShutdownPromise.forget(); + return p; + } + RefPtr decoder = data.mDecoder.forget(); + return decoder->Shutdown(); + } private: class Wrapper; @@ -215,17 +237,10 @@ private: Stage mStage = Stage::None; RefPtr mToken; RefPtr mDecoder; - MozPromiseRequestHolder mTokenPromise; - MozPromiseRequestHolder mInitPromise; - ~Data() - { - mTokenPromise.DisconnectIfExists(); - mInitPromise.DisconnectIfExists(); - if (mDecoder) { - mDecoder->Flush(); - mDecoder->Shutdown(); - } - } + MozPromiseRequestHolder mTokenRequest; + MozPromiseRequestHolder mInitRequest; + MozPromiseRequestHolder mShutdownRequest; + RefPtr mShutdownPromise; } mAudio, mVideo; void RunStage(TrackType aTrack); @@ -253,9 +268,12 @@ public: : mDecoder(aDecoder), mToken(aToken) {} RefPtr Init() override { return mDecoder->Init(); } - void Input(MediaRawData* aSample) override { mDecoder->Input(aSample); } - void Flush() override { mDecoder->Flush(); } - void Drain() override { mDecoder->Drain(); } + RefPtr Decode(MediaRawData* aSample) override + { + return mDecoder->Decode(aSample); + } + RefPtr Drain() override { return mDecoder->Drain(); } + RefPtr Flush() override { return mDecoder->Flush(); } bool IsHardwareAccelerated(nsACString& aFailureReason) const override { return mDecoder->IsHardwareAccelerated(aFailureReason); @@ -272,11 +290,14 @@ public: { return mDecoder->SupportDecoderRecycling(); } - void Shutdown() override + RefPtr Shutdown() override { - mDecoder->Shutdown(); - mDecoder = nullptr; - mToken = nullptr; + RefPtr decoder = mDecoder.forget(); + RefPtr token = mToken.forget(); + return decoder->Shutdown()->Then( + AbstractThread::GetCurrent(), __func__, + [token]() {}, + [token]() { MOZ_RELEASE_ASSERT(false, "Can't reach here"); }); } private: @@ -295,29 +316,29 @@ MediaFormatReader::DecoderFactory::RunStage(TrackType aTrack) DecoderAllocPolicy::Instance(aTrack).Alloc()->Then( mOwner->OwnerThread(), __func__, [this, &data, aTrack] (Token* aToken) { - data.mTokenPromise.Complete(); + data.mTokenRequest.Complete(); data.mToken = aToken; data.mStage = Stage::CreateDecoder; RunStage(aTrack); }, [&data] () { - data.mTokenPromise.Complete(); + data.mTokenRequest.Complete(); data.mStage = Stage::None; - })->Track(data.mTokenPromise); + })->Track(data.mTokenRequest); data.mStage = Stage::WaitForToken; break; } case Stage::WaitForToken: { MOZ_ASSERT(!data.mToken); - MOZ_ASSERT(data.mTokenPromise.Exists()); + MOZ_ASSERT(data.mTokenRequest.Exists()); break; } case Stage::CreateDecoder: { MOZ_ASSERT(data.mToken); MOZ_ASSERT(!data.mDecoder); - MOZ_ASSERT(!data.mInitPromise.Exists()); + MOZ_ASSERT(!data.mInitRequest.Exists()); MediaResult rv = DoCreateDecoder(aTrack); if (NS_FAILED(rv)) { @@ -336,7 +357,7 @@ MediaFormatReader::DecoderFactory::RunStage(TrackType aTrack) case Stage::WaitForInit: { MOZ_ASSERT(data.mDecoder); - MOZ_ASSERT(data.mInitPromise.Exists()); + MOZ_ASSERT(data.mInitRequest.Exists()); break; } } @@ -366,7 +387,6 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) ? *ownerData.mInfo->GetAsAudioInfo() : *ownerData.mOriginalInfo->GetAsAudioInfo(), ownerData.mTaskQueue, - ownerData.mCallback.get(), mOwner->mCrashHelper, ownerData.mIsBlankDecode, &result @@ -382,7 +402,6 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) ? *ownerData.mInfo->GetAsVideoInfo() : *ownerData.mOriginalInfo->GetAsVideoInfo(), ownerData.mTaskQueue, - ownerData.mCallback.get(), mOwner->mKnowsCompositor, mOwner->GetImageContainer(), mOwner->mCrashHelper, @@ -397,8 +416,7 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) } if (data.mDecoder) { - result = MediaResult(NS_OK); - return result; + return NS_OK; } ownerData.mDescription = decoderCreatingError; @@ -411,24 +429,36 @@ MediaFormatReader::DecoderFactory::DoInitDecoder(TrackType aTrack) auto& ownerData = mOwner->GetDecoderData(aTrack); auto& data = aTrack == TrackInfo::kAudioTrack ? mAudio : mVideo; - data.mDecoder->Init()->Then( - mOwner->OwnerThread(), __func__, - [this, &data, &ownerData] (TrackType aTrack) { - data.mInitPromise.Complete(); - data.mStage = Stage::None; - MutexAutoLock lock(ownerData.mMutex); - ownerData.mDecoder = data.mDecoder.forget(); - ownerData.mDescription = ownerData.mDecoder->GetDescriptionName(); - mOwner->SetVideoDecodeThreshold(); - mOwner->ScheduleUpdate(aTrack); - }, - [this, &data, aTrack] (MediaResult aError) { - data.mInitPromise.Complete(); - data.mStage = Stage::None; - data.mDecoder->Shutdown(); - data.mDecoder = nullptr; - mOwner->NotifyError(aTrack, aError); - })->Track(data.mInitPromise); + data.mDecoder->Init() + ->Then(mOwner->OwnerThread(), __func__, + [this, &data, &ownerData](TrackType aTrack) { + data.mInitRequest.Complete(); + data.mStage = Stage::None; + MutexAutoLock lock(ownerData.mMutex); + ownerData.mDecoder = data.mDecoder.forget(); + ownerData.mDescription = ownerData.mDecoder->GetDescriptionName(); + mOwner->SetVideoDecodeThreshold(); + mOwner->ScheduleUpdate(aTrack); + }, + [this, &data, &ownerData, aTrack](const MediaResult& aError) { + data.mInitRequest.Complete(); + MOZ_RELEASE_ASSERT(!ownerData.mDecoder, + "Can't have a decoder already set"); + data.mStage = Stage::None; + data.mShutdownPromise = data.mDecoder->Shutdown(); + data.mShutdownPromise + ->Then( + mOwner->OwnerThread(), __func__, + [this, &data, aTrack, aError]() { + data.mShutdownRequest.Complete(); + data.mShutdownPromise = nullptr; + data.mDecoder = nullptr; + mOwner->NotifyError(aTrack, aError); + }, + []() { MOZ_RELEASE_ASSERT(false, "Can't ever get here"); }) + ->Track(data.mShutdownRequest); + }) + ->Track(data.mInitRequest); } // DemuxerProxy ensures that the original main demuxer is only ever accessed @@ -822,59 +852,131 @@ RefPtr MediaFormatReader::Shutdown() { MOZ_ASSERT(OnTaskQueue()); + LOG(""); - mDecoderFactory = nullptr; mDemuxerInitRequest.DisconnectIfExists(); mNotifyDataArrivedPromise.DisconnectIfExists(); mMetadataPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); mSeekPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); mSkipRequest.DisconnectIfExists(); - if (mAudio.mDecoder) { - Reset(TrackInfo::kAudioTrack); - if (mAudio.HasPromise()) { - mAudio.RejectPromise(NS_ERROR_DOM_MEDIA_CANCELED, __func__); - } - mAudio.ShutdownDecoder(); + if (mAudio.HasPromise()) { + mAudio.RejectPromise(NS_ERROR_DOM_MEDIA_CANCELED, __func__); } - if (mAudio.mTrackDemuxer) { + if (mVideo.HasPromise()) { + mVideo.RejectPromise(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + } + + nsTArray> promises; + + if (HasAudio()) { mAudio.ResetDemuxer(); mAudio.mTrackDemuxer->BreakCycles(); mAudio.mTrackDemuxer = nullptr; + mAudio.ResetState(); + promises.AppendElement(ShutdownDecoderWithPromise(TrackInfo::kAudioTrack)); } + + if (HasVideo()) { + mVideo.ResetDemuxer(); + mVideo.mTrackDemuxer->BreakCycles(); + mVideo.mTrackDemuxer = nullptr; + mVideo.ResetState(); + promises.AppendElement(ShutdownDecoderWithPromise(TrackInfo::kVideoTrack)); + } + + mDemuxer = nullptr; + mCompositorUpdatedListener.DisconnectIfExists(); + + if (promises.IsEmpty()) { + TearDownDecoders(); + return MediaDecoderReader::Shutdown(); + } + + RefPtr p = mShutdownPromise.Ensure(__func__); + ShutdownPromise::All(OwnerThread(), promises) + ->Then(OwnerThread(), __func__, this, + &MediaFormatReader::TearDownDecoders, + &MediaFormatReader::TearDownDecoders); + + mShutdown = true; + + return p; +} + +RefPtr +MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack) +{ + LOGV("%s", TrackTypeToStr(aTrack)); + + auto& decoder = GetDecoderData(aTrack); + if (!decoder.mFlushed && decoder.mDecoder) { + // The decoder has yet to be flushed. + // We always flush the decoder prior to a shutdown to ensure that all the + // potentially pending operations on the decoder are completed. + decoder.Flush(); + return decoder.mShutdownPromise.Ensure(__func__); + } + + if (decoder.mFlushRequest.Exists() || decoder.mShutdownRequest.Exists()) { + // Let the current flush or shutdown operation complete, Flush will continue + // shutting down the current decoder now that the shutdown promise is set. + return decoder.mShutdownPromise.Ensure(__func__); + } + + if (!decoder.mDecoder) { + // Shutdown any decoders that may be in the process of being initialized + // in the Decoder Factory. + // This will be a no-op until we're processing the final decoder shutdown + // prior to the MediaFormatReader being shutdown. + return mDecoderFactory->ShutdownDecoder(aTrack); + } + + // Finally, let's just shut down the currently active decoder. + decoder.ShutdownDecoder(); + return decoder.mShutdownPromise.Ensure(__func__); +} + +void +MediaFormatReader::ShutdownDecoder(TrackType aTrack) +{ + LOG("%s", TrackTypeToStr(aTrack)); + auto& decoder = GetDecoderData(aTrack); + if (!decoder.mDecoder) { + LOGV("Already shut down"); + return; + } + if (!decoder.mShutdownPromise.IsEmpty()) { + LOGV("Shutdown already in progress"); + return; + } + Unused << ShutdownDecoderWithPromise(aTrack); +} + +void +MediaFormatReader::TearDownDecoders() +{ if (mAudio.mTaskQueue) { mAudio.mTaskQueue->BeginShutdown(); mAudio.mTaskQueue->AwaitShutdownAndIdle(); mAudio.mTaskQueue = nullptr; } - MOZ_ASSERT(!mAudio.HasPromise()); - - if (mVideo.mDecoder) { - Reset(TrackInfo::kVideoTrack); - if (mVideo.HasPromise()) { - mVideo.RejectPromise(NS_ERROR_DOM_MEDIA_CANCELED, __func__); - } - mVideo.ShutdownDecoder(); - } - if (mVideo.mTrackDemuxer) { - mVideo.ResetDemuxer(); - mVideo.mTrackDemuxer->BreakCycles(); - mVideo.mTrackDemuxer = nullptr; - } if (mVideo.mTaskQueue) { mVideo.mTaskQueue->BeginShutdown(); mVideo.mTaskQueue->AwaitShutdownAndIdle(); mVideo.mTaskQueue = nullptr; } - MOZ_ASSERT(!mVideo.HasPromise()); - mDemuxer = nullptr; + mDecoderFactory = nullptr; mPlatform = nullptr; mVideoFrameContainer = nullptr; - mCompositorUpdatedListener.DisconnectIfExists(); + if (mShutdownPromise.IsEmpty()) { + return; + } - return MediaDecoderReader::Shutdown(); + MediaDecoderReader::Shutdown(); + mShutdownPromise.Resolve(true, __func__); } void @@ -922,7 +1024,8 @@ MediaFormatReader::InitInternal() return NS_OK; } -class DispatchKeyNeededEvent : public Runnable { +class DispatchKeyNeededEvent : public Runnable +{ public: DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, nsTArray& aInitData, @@ -961,7 +1064,8 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) } bool -MediaFormatReader::IsWaitingOnCDMResource() { +MediaFormatReader::IsWaitingOnCDMResource() +{ MOZ_ASSERT(OnTaskQueue()); return IsEncrypted() && !mCDMProxy; } @@ -1031,7 +1135,6 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) tags->Put(tag.mKey, tag.mValue); } mVideo.mOriginalInfo = Move(videoInfo); - mVideo.mCallback = new DecoderCallback(this, TrackInfo::kVideoTrack); mTrackDemuxersMayBlock |= mVideo.mTrackDemuxer->GetSamplesMayBlock(); } else { mVideo.mTrackDemuxer->BreakCycles(); @@ -1059,7 +1162,6 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) tags->Put(tag.mKey, tag.mValue); } mAudio.mOriginalInfo = Move(audioInfo); - mAudio.mCallback = new DecoderCallback(this, TrackInfo::kAudioTrack); mTrackDemuxersMayBlock |= mAudio.mTrackDemuxer->GetSamplesMayBlock(); } else { mAudio.mTrackDemuxer->BreakCycles(); @@ -1369,29 +1471,19 @@ MediaFormatReader::OnAudioDemuxCompleted(RefPtrmTime, aSample->mDuration); auto& decoder = GetDecoderData(aTrack); - if (!decoder.mOutputRequested) { - LOG("MediaFormatReader produced output while flushing, discarding."); - return; + for (auto& sample : aResults) { + LOGV("Received new %s sample time:%lld duration:%lld", + TrackTypeToStr(aTrack), sample->mTime, sample->mDuration); + decoder.mOutput.AppendElement(sample); + decoder.mNumSamplesOutput++; + decoder.mNumOfConsecutiveError = 0; } - decoder.mOutput.AppendElement(aSample); - decoder.mNumSamplesOutput++; - decoder.mNumOfConsecutiveError = 0; - ScheduleUpdate(aTrack); -} - -void -MediaFormatReader::NotifyInputExhausted(TrackType aTrack) -{ - MOZ_ASSERT(OnTaskQueue()); - LOGV("Decoder has requested more %s data", TrackTypeToStr(aTrack)); - auto& decoder = GetDecoderData(aTrack); - decoder.mDecodePending = false; + LOG("Done processing new %s samples", TrackTypeToStr(aTrack)); ScheduleUpdate(aTrack); } @@ -1401,10 +1493,6 @@ MediaFormatReader::NotifyDrainComplete(TrackType aTrack) MOZ_ASSERT(OnTaskQueue()); auto& decoder = GetDecoderData(aTrack); LOG("%s", TrackTypeToStr(aTrack)); - if (!decoder.mOutputRequested) { - LOG("MediaFormatReader called DrainComplete() before flushing, ignoring."); - return; - } decoder.mDrainComplete = true; ScheduleUpdate(aTrack); } @@ -1444,10 +1532,8 @@ MediaFormatReader::NotifyEndOfStream(TrackType aTrack) bool MediaFormatReader::NeedInput(DecoderData& aDecoder) { - // To account for H.264 streams which may require a longer - // run of input than we input, decoders fire an "input exhausted" callback. - // The decoder will not be fed a new raw sample until InputExhausted - // has been called. + // The decoder will not be fed a new raw sample until the current decoding + // requests has completed. return (aDecoder.HasPromise() || aDecoder.mTimeThreshold.isSome()) && !aDecoder.HasPendingDrain() && @@ -1455,7 +1541,7 @@ MediaFormatReader::NeedInput(DecoderData& aDecoder) !aDecoder.mDemuxRequest.Exists() && !aDecoder.mOutput.Length() && !aDecoder.HasInternalSeekPending() && - !aDecoder.mDecodePending; + !aDecoder.mDecodeRequest.Exists(); } void @@ -1589,8 +1675,20 @@ MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack, { MOZ_ASSERT(OnTaskQueue()); auto& decoder = GetDecoderData(aTrack); - decoder.mDecoder->Input(aSample); - decoder.mDecodePending = true; + RefPtr self = this; + decoder.mFlushed = false; + decoder.mDecoder->Decode(aSample) + ->Then(mTaskQueue, __func__, + [self, this, aTrack, &decoder] + (const MediaDataDecoder::DecodedData& aResults) { + decoder.mDecodeRequest.Complete(); + NotifyNewOutput(aTrack, aResults); + }, + [self, this, aTrack, &decoder](const MediaResult& aError) { + decoder.mDecodeRequest.Complete(); + NotifyError(aTrack, aError); + }) + ->Track(decoder.mDecodeRequest); } void @@ -1601,6 +1699,11 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, auto& decoder = GetDecoderData(aTrack); + if (decoder.mFlushRequest.Exists() || decoder.mShutdownRequest.Exists()) { + LOGV("Decoder operation in progress, let it complete."); + return; + } + if (decoder.mQueuedSamples.IsEmpty()) { return; } @@ -1613,17 +1716,11 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, LOGV("Giving %s input to decoder", TrackTypeToStr(aTrack)); // Decode all our demuxed frames. - bool samplesPending = false; while (decoder.mQueuedSamples.Length()) { RefPtr sample = decoder.mQueuedSamples[0]; RefPtr info = sample->mTrackInfo; if (info && decoder.mLastStreamSourceID != info->GetID()) { - if (samplesPending) { - // Let existing samples complete their decoding. We'll resume later. - return; - } - bool supportRecycling = MediaPrefs::MediaDecoderCheckRecycling() && decoder.mDecoder->SupportDecoderRecycling(); if (decoder.mNextStreamSourceID.isNothing() || @@ -1644,18 +1741,19 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, info->GetID()); decoder.mLastStreamSourceID = info->GetID(); decoder.mNextStreamSourceID.reset(); + decoder.mInfo = info; + if (!supportRecycling) { LOG("Decoder does not support recycling, recreate decoder."); - // Reset will clear our array of queued samples. So make a copy now. - nsTArray> samples{decoder.mQueuedSamples}; - Reset(aTrack); - decoder.ShutdownDecoder(); + // If flushing is required, it will clear our array of queued samples. + // So make a copy now. + nsTArray> samples{ Move(decoder.mQueuedSamples) }; + ShutdownDecoder(aTrack); if (sample->mKeyframe) { decoder.mQueuedSamples.AppendElements(Move(samples)); } } - decoder.mInfo = info; if (sample->mKeyframe) { ScheduleUpdate(aTrack); } else { @@ -1673,7 +1771,6 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, LOGV("Input:%lld (dts:%lld kf:%d)", sample->mTime, sample->mTimecode, sample->mKeyframe); - decoder.mOutputRequested = true; decoder.mNumSamplesInput++; decoder.mSizeOfQueue++; if (aTrack == TrackInfo::kVideoTrack) { @@ -1683,7 +1780,7 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, DecodeDemuxedSamples(aTrack, sample); decoder.mQueuedSamples.RemoveElementAt(0); - samplesPending = true; + break; } } @@ -1743,17 +1840,28 @@ MediaFormatReader::DrainDecoder(TrackType aTrack) return; } decoder.mNeedDraining = false; - // mOutputRequest must be set, otherwise NotifyDrainComplete() - // may reject the drain if a Flush recently occurred. - decoder.mOutputRequested = true; if (!decoder.mDecoder || decoder.mNumSamplesInput == decoder.mNumSamplesOutput) { // No frames to drain. + LOGV("Draining %s with nothing to drain", TrackTypeToStr(aTrack)); NotifyDrainComplete(aTrack); return; } - decoder.mDecoder->Drain(); decoder.mDraining = true; + RefPtr self = this; + decoder.mDecoder->Drain() + ->Then(mTaskQueue, __func__, + [self, this, aTrack, &decoder] + (const MediaDataDecoder::DecodedData& aResults) { + decoder.mDrainRequest.Complete(); + NotifyNewOutput(aTrack, aResults); + NotifyDrainComplete(aTrack); + }, + [self, this, aTrack, &decoder](const MediaResult& aError) { + decoder.mDrainRequest.Complete(); + NotifyError(aTrack, aError); + }) + ->Track(decoder.mDrainRequest); LOG("Requesting %s decoder to drain", TrackTypeToStr(aTrack)); } @@ -1911,7 +2019,6 @@ MediaFormatReader::Update(TrackType aTrack) } if (decoder.mError && !decoder.HasFatalError()) { - decoder.mDecodePending = false; bool needsNewDecoder = decoder.mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER; if (!needsNewDecoder && ++decoder.mNumOfConsecutiveError > decoder.mMaxConsecutiveError) { NotifyError(aTrack, decoder.mError.ref()); @@ -1924,21 +2031,23 @@ MediaFormatReader::Update(TrackType aTrack) if (aTrack == TrackType::kVideoTrack && !decoder.HasInternalSeekPending() && NS_SUCCEEDED(decoder.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe))) { if (needsNewDecoder) { - decoder.ShutdownDecoder(); + ShutdownDecoder(aTrack); } SkipVideoDemuxToNextKeyFrame(decoder.mLastSampleTime.refOr(TimeInterval()).Length()); - return; } else if (aTrack == TrackType::kAudioTrack) { decoder.Flush(); } + return; } bool needInput = NeedInput(decoder); - LOGV("Update(%s) ni=%d no=%d ie=%d, in:%llu out:%llu qs=%u pending:%u waiting:%d promise:%d sid:%u", - TrackTypeToStr(aTrack), needInput, needOutput, decoder.mDecodePending, - decoder.mNumSamplesInput, decoder.mNumSamplesOutput, - uint32_t(size_t(decoder.mSizeOfQueue)), uint32_t(decoder.mOutput.Length()), + LOGV("Update(%s) ni=%d no=%d in:%llu out:%llu qs=%u decoding:%d flushing:%d " + "shutdown:%d pending:%u waiting:%d promise:%d sid:%u", + TrackTypeToStr(aTrack), needInput, needOutput, decoder.mNumSamplesInput, + decoder.mNumSamplesOutput, uint32_t(size_t(decoder.mSizeOfQueue)), + decoder.mDecodeRequest.Exists(), decoder.mFlushRequest.Exists(), + decoder.mShutdownRequest.Exists(), uint32_t(decoder.mOutput.Length()), decoder.mWaitingForData, decoder.HasPromise(), decoder.mLastStreamSourceID); @@ -2073,52 +2182,6 @@ MediaFormatReader::ResetDecode(TrackSet aTracks) return MediaDecoderReader::ResetDecode(aTracks); } -void -MediaFormatReader::Output(TrackType aTrack, MediaData* aSample) -{ - if (!aSample) { - NS_WARNING("MediaFormatReader::Output() passed a null sample"); - Error(aTrack, MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, __func__)); - return; - } - - LOGV("Decoded %s sample time=%lld timecode=%lld kf=%d dur=%lld", - TrackTypeToStr(aTrack), aSample->mTime, aSample->mTimecode, - aSample->mKeyframe, aSample->mDuration); - - RefPtr task = - NewRunnableMethod( - this, &MediaFormatReader::NotifyNewOutput, aTrack, aSample); - OwnerThread()->Dispatch(task.forget()); -} - -void -MediaFormatReader::DrainComplete(TrackType aTrack) -{ - RefPtr task = - NewRunnableMethod( - this, &MediaFormatReader::NotifyDrainComplete, aTrack); - OwnerThread()->Dispatch(task.forget()); -} - -void -MediaFormatReader::InputExhausted(TrackType aTrack) -{ - RefPtr task = - NewRunnableMethod( - this, &MediaFormatReader::NotifyInputExhausted, aTrack); - OwnerThread()->Dispatch(task.forget()); -} - -void -MediaFormatReader::Error(TrackType aTrack, const MediaResult& aError) -{ - RefPtr task = - NewRunnableMethod( - this, &MediaFormatReader::NotifyError, aTrack, aError); - OwnerThread()->Dispatch(task.forget()); -} - void MediaFormatReader::Reset(TrackType aTrack) { @@ -2163,10 +2226,6 @@ MediaFormatReader::SkipVideoDemuxToNextKeyFrame(media::TimeUnit aTimeThreshold) // We've reached SkipVideoDemuxToNextKeyFrame when our decoding is late. // As such we can drop all already decoded samples and discard all pending // samples. - // TODO: Ideally we should set mOutputRequested to false so that all pending - // frames are dropped too. However, we can't do such thing as the code assumes - // that the decoder just got flushed. Once bug 1257107 land, we could set the - // decoder threshold to the value of currentTime. DropDecodedSamples(TrackInfo::kVideoTrack); mVideo.mTrackDemuxer->SkipToNextRandomAccessPoint(aTimeThreshold) @@ -2489,8 +2548,12 @@ MediaFormatReader::OnAudioSeekFailed(const MediaResult& aError) void MediaFormatReader::ReleaseResources() { - mVideo.ShutdownDecoder(); - mAudio.ShutdownDecoder(); + LOGV(""); + if (mShutdown) { + return; + } + ShutdownDecoder(TrackInfo::kAudioTrack); + ShutdownDecoder(TrackInfo::kVideoTrack); } bool @@ -2639,9 +2702,8 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString) result += nsPrintfCString("audio frames decoded: %lld\n", mAudio.mNumSamplesOutputTotal); if (HasAudio()) { - result += nsPrintfCString("audio state: ni=%d no=%d ie=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", + result += nsPrintfCString("audio state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", NeedInput(mAudio), mAudio.HasPromise(), - mAudio.mDecodePending, mAudio.mDemuxRequest.Exists(), int(mAudio.mQueuedSamples.Length()), mAudio.mTimeThreshold @@ -2663,9 +2725,8 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString) mVideo.mNumSamplesOutputTotal, mVideo.mNumSamplesSkippedTotal); if (HasVideo()) { - result += nsPrintfCString("video state: ni=%d no=%d ie=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", + result += nsPrintfCString("video state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", NeedInput(mVideo), mVideo.HasPromise(), - mVideo.mDecodePending, mVideo.mDemuxRequest.Exists(), int(mVideo.mQueuedSamples.Length()), mVideo.mTimeThreshold @@ -2704,8 +2765,7 @@ MediaFormatReader::SetBlankDecode(TrackType aTrack, bool aIsBlankDecode) TrackTypeToStr(aTrack), decoder.mIsBlankDecode, aIsBlankDecode); decoder.mIsBlankDecode = aIsBlankDecode; - decoder.Flush(); - decoder.ShutdownDecoder(); + ShutdownDecoder(aTrack); } void diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index 1c4f0ca39740..c85af13da692 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -136,8 +136,8 @@ private: // Drain the current decoder. void DrainDecoder(TrackType aTrack); - void NotifyNewOutput(TrackType aTrack, MediaData* aSample); - void NotifyInputExhausted(TrackType aTrack); + void NotifyNewOutput(TrackType aTrack, + const MediaDataDecoder::DecodedData& aResults); void NotifyDrainComplete(TrackType aTrack); void NotifyError(TrackType aTrack, const MediaResult& aError); void NotifyWaitingForData(TrackType aTrack); @@ -148,13 +148,7 @@ private: // Initializes mLayersBackendType if possible. void InitLayersBackendType(); - // DecoderCallback proxies the MediaDataDecoderCallback calls to these - // functions. - void Output(TrackType aType, MediaData* aSample); - void InputExhausted(TrackType aTrack); - void Error(TrackType aTrack, const MediaResult& aError); void Reset(TrackType aTrack); - void DrainComplete(TrackType aTrack); void DropDecodedSamples(TrackType aTrack); bool ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold); @@ -165,36 +159,6 @@ private: RefPtr mPlatform; - class DecoderCallback : public MediaDataDecoderCallback { - public: - DecoderCallback(MediaFormatReader* aReader, TrackType aType) - : mReader(aReader) - , mType(aType) - { - } - void Output(MediaData* aSample) override { - mReader->Output(mType, aSample); - } - void InputExhausted() override { - mReader->InputExhausted(mType); - } - void Error(const MediaResult& aError) override { - mReader->Error(mType, aError); - } - void DrainComplete() override { - mReader->DrainComplete(mType); - } - void ReleaseMediaResources() override { - mReader->ReleaseResources(); - } - bool OnReaderTaskQueue() override { - return mReader->OnTaskQueue(); - } - private: - MediaFormatReader* mReader; - TrackType mType; - }; - struct DecoderData { DecoderData(MediaFormatReader* aOwner, MediaData::Type aType, @@ -207,11 +171,10 @@ private: , mDemuxEOS(false) , mWaitingForData(false) , mReceivedNewData(false) - , mOutputRequested(false) - , mDecodePending(false) , mNeedDraining(false) , mDraining(false) , mDrainComplete(false) + , mFlushed(true) , mNumOfConsecutiveError(0) , mMaxConsecutiveError(aNumOfMaxError) , mNumSamplesInput(0) @@ -231,8 +194,6 @@ private: // TaskQueue on which decoder can choose to decode. // Only non-null up until the decoder is created. RefPtr mTaskQueue; - // Callback that receives output and error notifications from the decoder. - nsAutoPtr mCallback; // Mutex protecting mDescription and mDecoder. Mutex mMutex; @@ -243,7 +204,19 @@ private: { MutexAutoLock lock(mMutex); if (mDecoder) { - mDecoder->Shutdown(); + RefPtr owner = mOwner; + TrackType type = mType == MediaData::AUDIO_DATA + ? TrackType::kAudioTrack + : TrackType::kVideoTrack; + mDecoder->Shutdown() + ->Then(mOwner->OwnerThread(), __func__, + [owner, this, type]() { + mShutdownRequest.Complete(); + mShutdownPromise.ResolveIfExists(true, __func__); + owner->ScheduleUpdate(type); + }, + []() { MOZ_RELEASE_ASSERT(false, "Can't ever be here"); }) + ->Track(mShutdownRequest); } mDescription = "shutdown"; mDecoder = nullptr; @@ -276,16 +249,16 @@ private: } // MediaDataDecoder handler's variables. - bool mOutputRequested; - // Set to true once the MediaDataDecoder has been fed a compressed sample. - // No more samples will be passed to the decoder while true. - // mDecodePending is reset when: - // 1- The decoder calls InputExhausted - // 2- The decoder is Flushed or Reset. - bool mDecodePending; + MozPromiseRequestHolder mDecodeRequest; bool mNeedDraining; + MozPromiseRequestHolder mDrainRequest; bool mDraining; bool mDrainComplete; + MozPromiseRequestHolder mFlushRequest; + // Set to true if the last operation run on the decoder was a flush. + bool mFlushed; + MozPromiseHolder mShutdownPromise; + MozPromiseRequestHolder mShutdownRequest; bool HasPendingDrain() const { @@ -349,26 +322,51 @@ private: } // Flush the decoder if present and reset decoding related data. - // Decoding will be suspended until mInputRequested is set again. // Following a flush, the decoder is ready to accept any new data. void Flush() { - if (mDecoder) { - mDecoder->Flush(); + if (mFlushRequest.Exists() || mFlushed) { + // Flush still pending or already flushed, nothing more to do. + return; } - mOutputRequested = false; - mDecodePending = false; + mDecodeRequest.DisconnectIfExists(); + mDrainRequest.DisconnectIfExists(); mOutput.Clear(); mNumSamplesInput = 0; mNumSamplesOutput = 0; mSizeOfQueue = 0; mDraining = false; mDrainComplete = false; + if (mDecoder && !mFlushed) { + RefPtr owner = mOwner; + TrackType type = mType == MediaData::AUDIO_DATA + ? TrackType::kAudioTrack + : TrackType::kVideoTrack; + mDecoder->Flush() + ->Then(mOwner->OwnerThread(), __func__, + [owner, type, this]() { + mFlushRequest.Complete(); + if (!mShutdownPromise.IsEmpty()) { + ShutdownDecoder(); + return; + } + owner->ScheduleUpdate(type); + }, + [owner, type, this](const MediaResult& aError) { + mFlushRequest.Complete(); + if (!mShutdownPromise.IsEmpty()) { + ShutdownDecoder(); + return; + } + owner->NotifyError(type, aError); + }) + ->Track(mFlushRequest); + } + mFlushed = true; } // Reset the state of the DecoderData, clearing all queued frames // (pending demuxed and decoded). - // Decoding will be suspended until mInputRequested is set again. // The track demuxer is *not* reset. void ResetState() { @@ -376,9 +374,9 @@ private: mDemuxEOS = false; mWaitingForData = false; mQueuedSamples.Clear(); - mOutputRequested = false; mNeedDraining = false; - mDecodePending = false; + mDecodeRequest.DisconnectIfExists(); + mDrainRequest.DisconnectIfExists(); mDraining = false; mDrainComplete = false; mTimeThreshold.reset(); @@ -574,6 +572,11 @@ private: // A flag indicating if the start time is known or not. bool mHasStartTime = false; + + void ShutdownDecoder(TrackType aTrack); + RefPtr ShutdownDecoderWithPromise(TrackType aTrack); + void TearDownDecoders(); + MozPromiseHolder mShutdownPromise; }; } // namespace mozilla diff --git a/dom/media/ipc/PVideoDecoder.ipdl b/dom/media/ipc/PVideoDecoder.ipdl index 5848ad0bac5d..30974daa9cfc 100644 --- a/dom/media/ipc/PVideoDecoder.ipdl +++ b/dom/media/ipc/PVideoDecoder.ipdl @@ -36,8 +36,8 @@ struct MediaRawDataIPDL Shmem buffer; }; -// This protocol provides a way to use MediaDataDecoder/MediaDataDecoderCallback -// across processes. The parent side currently is only implemented to work with +// This protocol provides a way to use MediaDataDecoder across processes. +// The parent side currently is only implemented to work with // Window Media Foundation, but can be extended easily to support other backends. // The child side runs in the content process, and the parent side runs in the // GPU process. We run a separate IPDL thread for both sides. diff --git a/dom/media/ipc/RemoteVideoDecoder.cpp b/dom/media/ipc/RemoteVideoDecoder.cpp index 824ff555f0ed..2196e21c52e7 100644 --- a/dom/media/ipc/RemoteVideoDecoder.cpp +++ b/dom/media/ipc/RemoteVideoDecoder.cpp @@ -21,13 +21,9 @@ using namespace ipc; using namespace layers; using namespace gfx; -RemoteVideoDecoder::RemoteVideoDecoder(MediaDataDecoderCallback* aCallback) +RemoteVideoDecoder::RemoteVideoDecoder() : mActor(new VideoDecoderChild()) { -#ifdef DEBUG - mCallback = aCallback; -#endif - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); } RemoteVideoDecoder::~RemoteVideoDecoder() @@ -54,86 +50,63 @@ RemoteVideoDecoder::~RemoteVideoDecoder() RefPtr RemoteVideoDecoder::Init() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); + RefPtr self = this; return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(), - this, __func__, &RemoteVideoDecoder::InitInternal); + __func__, [self, this]() { return mActor->Init(); }); } -RefPtr -RemoteVideoDecoder::InitInternal() +RefPtr +RemoteVideoDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mActor); - MOZ_ASSERT(NS_GetCurrentThread() == VideoDecoderManagerChild::GetManagerThread()); - return mActor->Init(); -} - -void -RemoteVideoDecoder::Input(MediaRawData* aSample) -{ - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); RefPtr self = this; RefPtr sample = aSample; - VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([self, sample]() { - MOZ_ASSERT(self->mActor); - self->mActor->Input(sample); - }), NS_DISPATCH_NORMAL); + return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(), + __func__, + [self, this, sample]() { return mActor->Decode(sample); }); } -void +RefPtr RemoteVideoDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - SynchronousTask task("Decoder flush"); - VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([&]() { - MOZ_ASSERT(this->mActor); - this->mActor->Flush(&task); - }), NS_DISPATCH_NORMAL); - task.Wait(); + RefPtr self = this; + return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(), + __func__, [self, this]() { return mActor->Flush(); }); } -void +RefPtr RemoteVideoDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); RefPtr self = this; - VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([self]() { - MOZ_ASSERT(self->mActor); - self->mActor->Drain(); - }), NS_DISPATCH_NORMAL); + return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(), + __func__, [self, this]() { return mActor->Drain(); }); } -void +RefPtr RemoteVideoDecoder::Shutdown() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - SynchronousTask task("Shutdown"); RefPtr self = this; - VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([&]() { - AutoCompleteTask complete(&task); - MOZ_ASSERT(self->mActor); - self->mActor->Shutdown(); - }), NS_DISPATCH_NORMAL); - task.Wait(); + return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(), + __func__, [self, this]() { + mActor->Shutdown(); + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } bool RemoteVideoDecoder::IsHardwareAccelerated(nsACString& aFailureReason) const { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); return mActor->IsHardwareAccelerated(aFailureReason); } void RemoteVideoDecoder::SetSeekThreshold(const media::TimeUnit& aTime) { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); RefPtr self = this; media::TimeUnit time = aTime; VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([=]() { MOZ_ASSERT(self->mActor); self->mActor->SetSeekThreshold(time); }), NS_DISPATCH_NORMAL); - } nsresult @@ -174,16 +147,13 @@ RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) return mWrapped->CreateVideoDecoder(aParams); } - MediaDataDecoderCallback* callback = aParams.mCallback; - MOZ_ASSERT(callback->OnReaderTaskQueue()); - RefPtr object = new RemoteVideoDecoder(callback); + RefPtr object = new RemoteVideoDecoder(); SynchronousTask task("InitIPDL"); bool success; VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([&]() { AutoCompleteTask complete(&task); - success = object->mActor->InitIPDL(callback, - aParams.VideoConfig(), + success = object->mActor->InitIPDL(aParams.VideoConfig(), aParams.mKnowsCompositor->GetTextureFactoryIdentifier()); }), NS_DISPATCH_NORMAL); task.Wait(); diff --git a/dom/media/ipc/RemoteVideoDecoder.h b/dom/media/ipc/RemoteVideoDecoder.h index de647b013672..45c099ad6caf 100644 --- a/dom/media/ipc/RemoteVideoDecoder.h +++ b/dom/media/ipc/RemoteVideoDecoder.h @@ -28,28 +28,23 @@ public: // MediaDataDecoder RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; bool IsHardwareAccelerated(nsACString& aFailureReason) const override; void SetSeekThreshold(const media::TimeUnit& aTime) override; const char* GetDescriptionName() const override { return "RemoteVideoDecoder"; } private: - explicit RemoteVideoDecoder(MediaDataDecoderCallback* aCallback); + RemoteVideoDecoder(); ~RemoteVideoDecoder(); - RefPtr InitInternal(); - - // Only ever written to from the reader task queue (during the constructor and destructor - // when we can guarantee no other threads are accessing it). Only read from the manager - // thread. + // Only ever written to from the reader task queue (during the constructor and + // destructor when we can guarantee no other threads are accessing it). Only + // read from the manager thread. RefPtr mActor; -#ifdef DEBUG - MediaDataDecoderCallback* mCallback; -#endif }; // A PDM implementation that creates RemoteVideoDecoders. diff --git a/dom/media/ipc/VideoDecoderChild.cpp b/dom/media/ipc/VideoDecoderChild.cpp index 2b7e8fe6f872..c91efb6c154c 100644 --- a/dom/media/ipc/VideoDecoderChild.cpp +++ b/dom/media/ipc/VideoDecoderChild.cpp @@ -10,7 +10,6 @@ #include "MediaInfo.h" #include "ImageContainer.h" #include "GPUVideoImage.h" -#include "mozilla/layers/SynchronousTask.h" namespace mozilla { namespace dom { @@ -22,10 +21,10 @@ using namespace gfx; VideoDecoderChild::VideoDecoderChild() : mThread(VideoDecoderManagerChild::GetManagerThread()) - , mFlushTask(nullptr) , mCanSend(false) , mInitialized(false) , mIsHardwareAccelerated(false) + , mNeedNewDecoder(false) { } @@ -54,9 +53,7 @@ VideoDecoderChild::RecvOutput(const VideoDataIPDL& aData) aData.base().keyframe(), aData.base().timecode(), IntRect()); - if (mCallback) { - mCallback->Output(video); - } + mDecodedData.AppendElement(Move(video)); return IPC_OK(); } @@ -64,9 +61,8 @@ mozilla::ipc::IPCResult VideoDecoderChild::RecvInputExhausted() { AssertOnManagerThread(); - if (mCallback) { - mCallback->InputExhausted(); - } + mDecodePromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); return IPC_OK(); } @@ -74,9 +70,8 @@ mozilla::ipc::IPCResult VideoDecoderChild::RecvDrainComplete() { AssertOnManagerThread(); - if (mCallback) { - mCallback->DrainComplete(); - } + mDrainPromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); return IPC_OK(); } @@ -84,14 +79,16 @@ mozilla::ipc::IPCResult VideoDecoderChild::RecvError(const nsresult& aError) { AssertOnManagerThread(); - if (mCallback) { - mCallback->Error(aError); - } + mDecodedData.Clear(); + mDecodePromise.RejectIfExists(aError, __func__); + mDrainPromise.RejectIfExists(aError, __func__); + mFlushPromise.RejectIfExists(aError, __func__); return IPC_OK(); } mozilla::ipc::IPCResult -VideoDecoderChild::RecvInitComplete(const bool& aHardware, const nsCString& aHardwareReason) +VideoDecoderChild::RecvInitComplete(const bool& aHardware, + const nsCString& aHardwareReason) { AssertOnManagerThread(); mInitPromise.ResolveIfExists(TrackInfo::kVideoTrack, __func__); @@ -112,9 +109,8 @@ VideoDecoderChild::RecvInitFailed(const nsresult& aReason) mozilla::ipc::IPCResult VideoDecoderChild::RecvFlushComplete() { - MOZ_ASSERT(mFlushTask); - AutoCompleteTask complete(mFlushTask); - mFlushTask = nullptr; + AssertOnManagerThread(); + mFlushPromise.ResolveIfExists(true, __func__); return IPC_OK(); } @@ -126,39 +122,45 @@ VideoDecoderChild::ActorDestroy(ActorDestroyReason aWhy) // it'll be safe for MediaFormatReader to recreate decoders RefPtr ref = this; GetManager()->RunWhenRecreated(NS_NewRunnableFunction([=]() { - if (ref->mInitialized && ref->mCallback) { - ref->mCallback->Error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER); + if (ref->mInitialized) { + mDecodedData.Clear(); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); + mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); + mFlushPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); + // Make sure the next request will be rejected accordingly if ever + // called. + mNeedNewDecoder = true; } else { - ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__); + ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); } })); } - if (mFlushTask) { - AutoCompleteTask complete(mFlushTask); - mFlushTask = nullptr; - } mCanSend = false; } bool -VideoDecoderChild::InitIPDL(MediaDataDecoderCallback* aCallback, - const VideoInfo& aVideoInfo, +VideoDecoderChild::InitIPDL(const VideoInfo& aVideoInfo, const layers::TextureFactoryIdentifier& aIdentifier) { - RefPtr manager = VideoDecoderManagerChild::GetSingleton(); - // If the manager isn't available, then don't initialize mIPDLSelfRef and leave - // us in an error state. We'll then immediately reject the promise when Init() - // is called and the caller can try again. Hopefully by then the new manager is - // ready, or we've notified the caller of it being no longer available. - // If not, then the cycle repeats until we're ready. + RefPtr manager = + VideoDecoderManagerChild::GetSingleton(); + // If the manager isn't available, then don't initialize mIPDLSelfRef and + // leave us in an error state. We'll then immediately reject the promise when + // Init() is called and the caller can try again. Hopefully by then the new + // manager is ready, or we've notified the caller of it being no longer + // available. If not, then the cycle repeats until we're ready. if (!manager || !manager->CanSend()) { return true; } mIPDLSelfRef = this; - mCallback = aCallback; bool success = false; - if (manager->SendPVideoDecoderConstructor(this, aVideoInfo, aIdentifier, &success)) { + if (manager->SendPVideoDecoderConstructor(this, aVideoInfo, aIdentifier, + &success)) { mCanSend = true; } return success; @@ -197,12 +199,20 @@ VideoDecoderChild::Init() return mInitPromise.Ensure(__func__); } -void -VideoDecoderChild::Input(MediaRawData* aSample) +RefPtr +VideoDecoderChild::Decode(MediaRawData* aSample) { AssertOnManagerThread(); + + if (mNeedNewDecoder) { + return MediaDataDecoder::DecodePromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__); + } if (!mCanSend) { - return; + // We're here if the IPC channel has died but we're still waiting for the + // RunWhenRecreated task to complete. The decode promise will be rejected + // when that task is run. + return mDecodePromise.Ensure(__func__); } // TODO: It would be nice to add an allocator method to @@ -210,8 +220,8 @@ VideoDecoderChild::Input(MediaRawData* aSample) // into shmem rather than requiring a copy here. Shmem buffer; if (!AllocShmem(aSample->Size(), Shmem::SharedMemory::TYPE_BASIC, &buffer)) { - mCallback->Error(NS_ERROR_DOM_MEDIA_DECODE_ERR); - return; + return MediaDataDecoder::DecodePromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_DECODE_ERR, __func__); } memcpy(buffer.get(), aSample->Data(), aSample->Size()); @@ -224,27 +234,37 @@ VideoDecoderChild::Input(MediaRawData* aSample) aSample->mKeyframe), buffer); SendInput(sample); + return mDecodePromise.Ensure(__func__); } -void -VideoDecoderChild::Flush(SynchronousTask* aTask) +RefPtr +VideoDecoderChild::Flush() { AssertOnManagerThread(); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + if (mNeedNewDecoder) { + return MediaDataDecoder::FlushPromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__); + } if (mCanSend) { SendFlush(); - mFlushTask = aTask; - } else { - AutoCompleteTask complete(aTask); } + return mFlushPromise.Ensure(__func__); } -void +RefPtr VideoDecoderChild::Drain() { AssertOnManagerThread(); + if (mNeedNewDecoder) { + return MediaDataDecoder::DecodePromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__); + } if (mCanSend) { SendDrain(); } + return mDrainPromise.Ensure(__func__); } void @@ -256,7 +276,6 @@ VideoDecoderChild::Shutdown() SendShutdown(); } mInitialized = false; - mCallback = nullptr; } bool diff --git a/dom/media/ipc/VideoDecoderChild.h b/dom/media/ipc/VideoDecoderChild.h index 8cb8c4b7a106..7f30dafe55ce 100644 --- a/dom/media/ipc/VideoDecoderChild.h +++ b/dom/media/ipc/VideoDecoderChild.h @@ -6,15 +6,10 @@ #ifndef include_dom_ipc_VideoDecoderChild_h #define include_dom_ipc_VideoDecoderChild_h -#include "mozilla/RefPtr.h" -#include "mozilla/dom/PVideoDecoderChild.h" -#include "MediaData.h" #include "PlatformDecoderModule.h" +#include "mozilla/dom/PVideoDecoderChild.h" namespace mozilla { -namespace layers { -class SynchronousTask; -} namespace dom { class RemoteVideoDecoder; @@ -40,16 +35,15 @@ public: void ActorDestroy(ActorDestroyReason aWhy) override; RefPtr Init(); - void Input(MediaRawData* aSample); - void Flush(layers::SynchronousTask* Task); - void Drain(); + RefPtr Decode(MediaRawData* aSample); + RefPtr Drain(); + RefPtr Flush(); void Shutdown(); bool IsHardwareAccelerated(nsACString& aFailureReason) const; void SetSeekThreshold(const media::TimeUnit& aTime); MOZ_IS_CLASS_INIT - bool InitIPDL(MediaDataDecoderCallback* aCallback, - const VideoInfo& aVideoInfo, + bool InitIPDL(const VideoInfo& aVideoInfo, const layers::TextureFactoryIdentifier& aIdentifier); void DestroyIPDL(); @@ -66,16 +60,19 @@ private: RefPtr mIPDLSelfRef; RefPtr mThread; - MediaDataDecoderCallback* mCallback; - MozPromiseHolder mInitPromise; - - layers::SynchronousTask* mFlushTask; + MozPromiseHolder mDecodePromise; + MozPromiseHolder mDrainPromise; + MozPromiseHolder mFlushPromise; nsCString mHardwareAcceleratedReason; bool mCanSend; bool mInitialized; bool mIsHardwareAccelerated; + // Set to true if the actor got destroyed and we haven't yet notified the + // caller. + bool mNeedNewDecoder; + MediaDataDecoder::DecodedData mDecodedData; }; } // namespace dom diff --git a/dom/media/ipc/VideoDecoderParent.cpp b/dom/media/ipc/VideoDecoderParent.cpp index 7152b4269fb0..b73581c3d9ee 100644 --- a/dom/media/ipc/VideoDecoderParent.cpp +++ b/dom/media/ipc/VideoDecoderParent.cpp @@ -72,7 +72,6 @@ VideoDecoderParent::VideoDecoderParent(VideoDecoderManagerParent* aParent, CreateDecoderParams params(aVideoInfo); params.mTaskQueue = mDecodeTaskQueue; - params.mCallback = this; params.mKnowsCompositor = mKnowsCompositor; params.mImageContainer = new layers::ImageContainer(); @@ -134,28 +133,73 @@ VideoDecoderParent::RecvInput(const MediaRawDataIPDL& aData) DeallocShmem(aData.buffer()); - mDecoder->Input(data); + RefPtr self = this; + mDecoder->Decode(data)->Then( + mManagerTaskQueue, __func__, + [self, this](const MediaDataDecoder::DecodedData& aResults) { + if (mDestroyed) { + return; + } + ProcessDecodedData(aResults); + Unused << SendInputExhausted(); + }, + [self, this](const MediaResult& aError) { Error(aError); }); return IPC_OK(); } +void +VideoDecoderParent::ProcessDecodedData( + const MediaDataDecoder::DecodedData& aData) +{ + MOZ_ASSERT(OnManagerThread()); + + for (const auto& data : aData) { + MOZ_ASSERT(data->mType == MediaData::VIDEO_DATA, + "Can only decode videos using VideoDecoderParent!"); + VideoData* video = static_cast(data.get()); + + MOZ_ASSERT(video->mImage, "Decoded video must output a layer::Image to " + "be used with VideoDecoderParent"); + + RefPtr texture = + video->mImage->GetTextureClient(mKnowsCompositor); + + if (!texture) { + texture = ImageClient::CreateTextureClientForImage(video->mImage, + mKnowsCompositor); + } + + if (texture && !texture->IsAddedToCompositableClient()) { + texture->InitIPDLActor(mKnowsCompositor); + texture->SetAddedToCompositableClient(); + } + + VideoDataIPDL output( + MediaDataIPDL(data->mOffset, data->mTime, data->mTimecode, + data->mDuration, data->mFrames, data->mKeyframe), + video->mDisplay, + texture ? mParent->StoreImage(video->mImage, texture) + : SurfaceDescriptorGPUVideo(0), + video->mFrameID); + Unused << SendOutput(output); + } +} + mozilla::ipc::IPCResult VideoDecoderParent::RecvFlush() { MOZ_ASSERT(!mDestroyed); MOZ_ASSERT(OnManagerThread()); - if (mDecoder) { - mDecoder->Flush(); - } - - // Dispatch a runnable to our own event queue so that - // it will be processed after anything that got dispatched - // during the Flush call. RefPtr self = this; - mManagerTaskQueue->Dispatch(NS_NewRunnableFunction([self]() { - if (!self->mDestroyed) { - Unused << self->SendFlushComplete(); - } - })); + mDecoder->Flush()->Then( + mManagerTaskQueue, __func__, + [self, this]() { + if (!mDestroyed) { + Unused << SendFlushComplete(); + } + }, + [self, this](const MediaResult& aError) { Error(aError); }); + return IPC_OK(); } @@ -164,7 +208,16 @@ VideoDecoderParent::RecvDrain() { MOZ_ASSERT(!mDestroyed); MOZ_ASSERT(OnManagerThread()); - mDecoder->Drain(); + RefPtr self = this; + mDecoder->Drain()->Then( + mManagerTaskQueue, __func__, + [self, this](const MediaDataDecoder::DecodedData& aResults) { + if (!mDestroyed) { + ProcessDecodedData(aResults); + Unused << SendDrainComplete(); + } + }, + [self, this](const MediaResult& aError) { Error(aError); }); return IPC_OK(); } @@ -203,91 +256,13 @@ VideoDecoderParent::ActorDestroy(ActorDestroyReason aWhy) } } -void -VideoDecoderParent::Output(MediaData* aData) -{ - MOZ_ASSERT(mDecodeTaskQueue->IsCurrentThreadIn()); - RefPtr self = this; - RefPtr knowsCompositor = mKnowsCompositor; - RefPtr data = aData; - mManagerTaskQueue->Dispatch(NS_NewRunnableFunction([self, knowsCompositor, data]() { - if (self->mDestroyed) { - return; - } - - MOZ_ASSERT(data->mType == MediaData::VIDEO_DATA, "Can only decode videos using VideoDecoderParent!"); - VideoData* video = static_cast(data.get()); - - MOZ_ASSERT(video->mImage, "Decoded video must output a layer::Image to be used with VideoDecoderParent"); - - RefPtr texture = video->mImage->GetTextureClient(knowsCompositor); - - if (!texture) { - texture = ImageClient::CreateTextureClientForImage(video->mImage, knowsCompositor); - } - - if (texture && !texture->IsAddedToCompositableClient()) { - texture->InitIPDLActor(knowsCompositor); - texture->SetAddedToCompositableClient(); - } - - VideoDataIPDL output(MediaDataIPDL(data->mOffset, - data->mTime, - data->mTimecode, - data->mDuration, - data->mFrames, - data->mKeyframe), - video->mDisplay, - texture ? self->mParent->StoreImage(video->mImage, texture) : SurfaceDescriptorGPUVideo(0), - video->mFrameID); - Unused << self->SendOutput(output); - })); -} - void VideoDecoderParent::Error(const MediaResult& aError) { - MOZ_ASSERT(mDecodeTaskQueue->IsCurrentThreadIn()); - RefPtr self = this; - MediaResult error = aError; - mManagerTaskQueue->Dispatch(NS_NewRunnableFunction([self, error]() { - if (!self->mDestroyed) { - Unused << self->SendError(error); - } - })); -} - -void -VideoDecoderParent::InputExhausted() -{ - MOZ_ASSERT(mDecodeTaskQueue->IsCurrentThreadIn()); - RefPtr self = this; - mManagerTaskQueue->Dispatch(NS_NewRunnableFunction([self]() { - if (!self->mDestroyed) { - Unused << self->SendInputExhausted(); - } - })); -} - -void -VideoDecoderParent::DrainComplete() -{ - MOZ_ASSERT(mDecodeTaskQueue->IsCurrentThreadIn()); - RefPtr self = this; - mManagerTaskQueue->Dispatch(NS_NewRunnableFunction([self]() { - if (!self->mDestroyed) { - Unused << self->SendDrainComplete(); - } - })); -} - -bool -VideoDecoderParent::OnReaderTaskQueue() -{ - // Most of our calls into mDecoder come directly from IPDL so are on - // the right thread, but not actually on the task queue. We only ever - // run a single thread, not a pool, so this should work fine. - return OnManagerThread(); + MOZ_ASSERT(OnManagerThread()); + if (!mDestroyed) { + Unused << SendError(aError); + } } bool diff --git a/dom/media/ipc/VideoDecoderParent.h b/dom/media/ipc/VideoDecoderParent.h index 63ba3bb65b69..eb58d493b954 100644 --- a/dom/media/ipc/VideoDecoderParent.h +++ b/dom/media/ipc/VideoDecoderParent.h @@ -6,20 +6,20 @@ #ifndef include_dom_ipc_VideoDecoderParent_h #define include_dom_ipc_VideoDecoderParent_h -#include "mozilla/RefPtr.h" +#include "ImageContainer.h" +#include "MediaData.h" +#include "PlatformDecoderModule.h" +#include "VideoDecoderManagerParent.h" +#include "mozilla/MozPromise.h" #include "mozilla/dom/PVideoDecoderParent.h" #include "mozilla/layers/TextureForwarder.h" -#include "VideoDecoderManagerParent.h" -#include "MediaData.h" -#include "ImageContainer.h" namespace mozilla { namespace dom { class KnowsCompositorVideo; -class VideoDecoderParent final : public PVideoDecoderParent, - public MediaDataDecoderCallback +class VideoDecoderParent final : public PVideoDecoderParent { public: // We refcount this class since the task queue can have runnables @@ -45,17 +45,12 @@ public: void ActorDestroy(ActorDestroyReason aWhy) override; - // MediaDataDecoderCallback - void Output(MediaData* aData) override; - void Error(const MediaResult& aError) override; - void InputExhausted() override; - void DrainComplete() override; - bool OnReaderTaskQueue() override; - private: bool OnManagerThread(); + void Error(const MediaResult& aError); ~VideoDecoderParent(); + void ProcessDecodedData(const MediaDataDecoder::DecodedData& aData); RefPtr mParent; RefPtr mIPDLSelfRef; diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index 511104e564f4..e01e55088d81 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -34,16 +34,17 @@ class RemoteDecoderModule; } class MediaDataDecoder; -class MediaDataDecoderCallback; class TaskQueue; class CDMProxy; static LazyLogModule sPDMLog("PlatformDecoderModule"); -struct MOZ_STACK_CLASS CreateDecoderParams final { +struct MOZ_STACK_CLASS CreateDecoderParams final +{ explicit CreateDecoderParams(const TrackInfo& aConfig) : mConfig(aConfig) - {} + { + } template CreateDecoderParams(const TrackInfo& aConfig, T1&& a1, Ts&&... args) @@ -74,7 +75,6 @@ struct MOZ_STACK_CLASS CreateDecoderParams final { const TrackInfo& mConfig; TaskQueue* mTaskQueue = nullptr; - MediaDataDecoderCallback* mCallback = nullptr; DecoderDoctorDiagnostics* mDiagnostics = nullptr; layers::ImageContainer* mImageContainer = nullptr; MediaResult* mError = nullptr; @@ -84,13 +84,21 @@ struct MOZ_STACK_CLASS CreateDecoderParams final { private: void Set(TaskQueue* aTaskQueue) { mTaskQueue = aTaskQueue; } - void Set(MediaDataDecoderCallback* aCallback) { mCallback = aCallback; } - void Set(DecoderDoctorDiagnostics* aDiagnostics) { mDiagnostics = aDiagnostics; } - void Set(layers::ImageContainer* aImageContainer) { mImageContainer = aImageContainer; } + void Set(DecoderDoctorDiagnostics* aDiagnostics) + { + mDiagnostics = aDiagnostics; + } + void Set(layers::ImageContainer* aImageContainer) + { + mImageContainer = aImageContainer; + } void Set(MediaResult* aError) { mError = aError; } void Set(GMPCrashHelper* aCrashHelper) { mCrashHelper = aCrashHelper; } void Set(bool aUseBlankDecoder) { mUseBlankDecoder = aUseBlankDecoder; } - void Set(layers::KnowsCompositor* aKnowsCompositor) { mKnowsCompositor = aKnowsCompositor; } + void Set(layers::KnowsCompositor* aKnowsCompositor) + { + mKnowsCompositor = aKnowsCompositor; + } template void Set(T1&& a1, T2&& a2, Ts&&... args) { @@ -113,7 +121,8 @@ private: // output samples exists for testing, and is created when the pref // "media.use-blank-decoder" is true. -class PlatformDecoderModule { +class PlatformDecoderModule +{ public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PlatformDecoderModule) @@ -132,7 +141,8 @@ public: return SupportsMimeType(aTrackInfo.mMimeType, aDiagnostics); } - enum class ConversionRequired : uint8_t { + enum class ConversionRequired : uint8_t + { kNeedNone, kNeedAVCC, kNeedAnnexB, @@ -157,7 +167,6 @@ protected: // Asynchronous decoding of video should be done in runnables dispatched // to aVideoTaskQueue. If the task queue isn't needed, the decoder should // not hold a reference to it. - // Output and errors should be returned to the reader via aCallback. // On Windows the task queue's threads in have MSCOM initialized with // COINIT_MULTITHREADED. // Returns nullptr if the decoder can't be created. @@ -170,7 +179,6 @@ protected: // Asynchronous decoding of audio should be done in runnables dispatched to // aAudioTaskQueue. If the task queue isn't needed, the decoder should // not hold a reference to it. - // Output and errors should be returned to the reader via aCallback. // Returns nullptr if the decoder can't be created. // On Windows the task queue's threads in have MSCOM initialized with // COINIT_MULTITHREADED. @@ -180,34 +188,6 @@ protected: CreateAudioDecoder(const CreateDecoderParams& aParams) = 0; }; -// A callback used by MediaDataDecoder to return output/errors to the -// MediaFormatReader. -// Implementation is threadsafe, and can be called on any thread. -class MediaDataDecoderCallback { -public: - virtual ~MediaDataDecoderCallback() {} - - // Called by MediaDataDecoder when a sample has been decoded. - virtual void Output(MediaData* aData) = 0; - - // Denotes an error in the decoding process. The reader will stop calling - // the decoder. - virtual void Error(const MediaResult& aError) = 0; - - // Denotes that the last input sample has been inserted into the decoder, - // and no more output can be produced unless more input is sent. - // A frame decoding session is completed once InputExhausted has been called. - // MediaDataDecoder::Input will not be called again until InputExhausted has - // been called. - virtual void InputExhausted() = 0; - - virtual void DrainComplete() = 0; - - virtual void ReleaseMediaResources() {} - - virtual bool OnReaderTaskQueue() = 0; -}; - // MediaDataDecoder is the interface exposed by decoders created by the // PlatformDecoderModule's Create*Decoder() functions. The type of // media data that the decoder accepts as valid input and produces as @@ -225,17 +205,19 @@ public: // TaskQueue passed into the PlatformDecoderModules's Create*Decoder() // function. This may not be necessary for platforms with async APIs // for decoding. -// -// If an error occurs at any point after the Init promise has been -// completed, then Error() must be called on the associated -// MediaDataDecoderCallback. -class MediaDataDecoder { +class MediaDataDecoder +{ protected: virtual ~MediaDataDecoder() {}; public: typedef TrackInfo::TrackType TrackType; - typedef MozPromise InitPromise; + typedef nsTArray> DecodedData; + typedef MozPromise + InitPromise; + typedef MozPromise + DecodePromise; + typedef MozPromise FlushPromise; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDataDecoder) @@ -248,41 +230,39 @@ public: // be done here so that it can be canceled by calling Shutdown()! virtual RefPtr Init() = 0; - // Inserts a sample into the decoder's decode pipeline. - virtual void Input(MediaRawData* aSample) = 0; - - // Causes all samples in the decoding pipeline to be discarded. When - // this function returns, the decoder must be ready to accept new input - // for decoding. This function is called when the demuxer seeks, before - // decoding resumes after the seek. - // While the reader calls Flush(), it ignores all output sent to it; - // it is safe (but pointless) to send output while Flush is called. - // The MediaFormatReader will not call Input() while it's calling Flush(). - virtual void Flush() = 0; + // Inserts a sample into the decoder's decode pipeline. The DecodePromise will + // be resolved with the decoded MediaData. In case the decoder needs more + // input, the DecodePromise may be resolved with an empty array of samples to + // indicate that Decode should be called again before a MediaData is returned. + virtual RefPtr Decode(MediaRawData* aSample) = 0; // Causes all complete samples in the pipeline that can be decoded to be // output. If the decoder can't produce samples from the current output, // it drops the input samples. The decoder may be holding onto samples // that are required to decode samples that it expects to get in future. // This is called when the demuxer reaches end of stream. - // The MediaFormatReader will not call Input() while it's calling Drain(). - // This function is asynchronous. The MediaDataDecoder must call - // MediaDataDecoderCallback::DrainComplete() once all remaining - // samples have been output. - virtual void Drain() = 0; + // This function is asynchronous. The MediaDataDecoder shall resolve the + // pending DecodePromise will all drained samples. + virtual RefPtr Drain() = 0; - // Cancels all init/input/drain operations, and shuts down the - // decoder. The platform decoder should clean up any resources it's using - // and release memory etc. Shutdown() must block until the decoder has - // completed shutdown. The reader calls Flush() before calling Shutdown(). - // The reader will delete the decoder once Shutdown() returns. - // The MediaDataDecoderCallback *must* not be called after Shutdown() has - // returned. - virtual void Shutdown() = 0; + // Causes all samples in the decoding pipeline to be discarded. When this + // promise resolves, the decoder must be ready to accept new data for + // decoding. This function is called when the demuxer seeks, before decoding + // resumes after the seek. The current DecodePromise if any shall be rejected + // with NS_ERROR_DOM_MEDIA_CANCELED + virtual RefPtr Flush() = 0; - // Called from the state machine task queue or main thread. - // Decoder needs to decide whether or not hardware accelearation is supported - // after creating. It doesn't need to call Init() before calling this function. + // Cancels all init/decode/drain operations, and shuts down the decoder. The + // platform decoder should clean up any resources it's using and release + // memory etc. The shutdown promise will be resolved once the decoder has + // completed shutdown. The reader calls Flush() before calling Shutdown(). The + // reader will delete the decoder once the promise is resolved. + // The ShutdownPromise must only ever be resolved. + virtual RefPtr Shutdown() = 0; + + // Called from the state machine task queue or main thread. Decoder needs to + // decide whether or not hardware acceleration is supported after creating. + // It doesn't need to call Init() before calling this function. virtual bool IsHardwareAccelerated(nsACString& aFailureReason) const { return false; } // Return the name of the MediaDataDecoder, only used for decoding. diff --git a/dom/media/platforms/agnostic/BlankDecoderModule.cpp b/dom/media/platforms/agnostic/BlankDecoderModule.cpp index 7d7bae721302..97f43db403ec 100644 --- a/dom/media/platforms/agnostic/BlankDecoderModule.cpp +++ b/dom/media/platforms/agnostic/BlankDecoderModule.cpp @@ -32,7 +32,6 @@ public: BlankMediaDataDecoder(BlankMediaDataCreator* aCreator, const CreateDecoderParams& aParams) : mCreator(aCreator) - , mCallback(aParams.mCallback) , mMaxRefFrames(aParams.mConfig.GetType() == TrackInfo::kVideoTrack && MP4Decoder::IsH264(aParams.mConfig.mMimeType) ? mp4_demuxer::AnnexB::HasSPS(aParams.VideoConfig().mExtraData) @@ -47,30 +46,45 @@ public: return InitPromise::CreateAndResolve(mType, __func__); } - void Shutdown() override {} + RefPtr Shutdown() override + { + return ShutdownPromise::CreateAndResolve(true, __func__); + } - void Input(MediaRawData* aSample) override + RefPtr Decode(MediaRawData* aSample) override { RefPtr data = mCreator->Create(media::TimeUnit::FromMicroseconds(aSample->mTime), media::TimeUnit::FromMicroseconds(aSample->mDuration), aSample->mOffset); - OutputFrame(data); - } - - void Flush() override - { - mReorderQueue.Clear(); - } - - void Drain() override - { - while (!mReorderQueue.IsEmpty()) { - mCallback->Output(mReorderQueue.Pop().get()); + if (!data) { + return DecodePromise::CreateAndReject(NS_ERROR_OUT_OF_MEMORY, __func__); } - mCallback->DrainComplete(); + // Frames come out in DTS order but we need to output them in PTS order. + mReorderQueue.Push(data); + + if (mReorderQueue.Length() > mMaxRefFrames) { + return DecodePromise::CreateAndResolve( + DecodedData{ mReorderQueue.Pop().get() }, __func__); + } + return DecodePromise::CreateAndResolve(DecodedData(), __func__); + } + + RefPtr Drain() override + { + DecodedData samples; + while (!mReorderQueue.IsEmpty()) { + samples.AppendElement(mReorderQueue.Pop().get()); + } + return DecodePromise::CreateAndResolve(samples, __func__); + } + + RefPtr Flush() override + { + mReorderQueue.Clear(); + return FlushPromise::CreateAndResolve(true, __func__); } const char* GetDescriptionName() const override @@ -78,26 +92,8 @@ public: return "blank media data decoder"; } -private: - void OutputFrame(MediaData* aData) - { - if (!aData) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__)); - return; - } - - // Frames come out in DTS order but we need to output them in PTS order. - mReorderQueue.Push(aData); - - while (mReorderQueue.Length() > mMaxRefFrames) { - mCallback->Output(mReorderQueue.Pop().get()); - } - mCallback->InputExhausted(); - } - private: nsAutoPtr mCreator; - MediaDataDecoderCallback* mCallback; const uint32_t mMaxRefFrames; ReorderQueue mReorderQueue; TrackInfo::TrackType mType; diff --git a/dom/media/platforms/agnostic/OpusDecoder.cpp b/dom/media/platforms/agnostic/OpusDecoder.cpp index 3ce801ccb2b0..e584b940406a 100644 --- a/dom/media/platforms/agnostic/OpusDecoder.cpp +++ b/dom/media/platforms/agnostic/OpusDecoder.cpp @@ -28,13 +28,11 @@ namespace mozilla { OpusDataDecoder::OpusDataDecoder(const CreateDecoderParams& aParams) : mInfo(aParams.AudioConfig()) , mTaskQueue(aParams.mTaskQueue) - , mCallback(aParams.mCallback) , mOpusDecoder(nullptr) , mSkip(0) , mDecodedHeader(false) , mPaddingDiscarded(false) , mFrames(0) - , mIsFlushing(false) { } @@ -46,9 +44,13 @@ OpusDataDecoder::~OpusDataDecoder() } } -void +RefPtr OpusDataDecoder::Shutdown() { + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self]() { + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } void @@ -142,30 +144,15 @@ OpusDataDecoder::DecodeHeader(const unsigned char* aData, size_t aLength) return NS_OK; } -void -OpusDataDecoder::Input(MediaRawData* aSample) +RefPtr +OpusDataDecoder::Decode(MediaRawData* aSample) { - mTaskQueue->Dispatch(NewRunnableMethod>( - this, &OpusDataDecoder::ProcessDecode, aSample)); + return InvokeAsync(mTaskQueue, this, __func__, + &OpusDataDecoder::ProcessDecode, aSample); } -void +RefPtr OpusDataDecoder::ProcessDecode(MediaRawData* aSample) -{ - if (mIsFlushing) { - return; - } - - MediaResult rv = DoDecode(aSample); - if (NS_FAILED(rv)) { - mCallback->Error(rv); - return; - } - mCallback->InputExhausted(); -} - -MediaResult -OpusDataDecoder::DoDecode(MediaRawData* aSample) { uint32_t channels = mOpusParser->mChannels; @@ -173,9 +160,10 @@ OpusDataDecoder::DoDecode(MediaRawData* aSample) // Discard padding should be used only on the final packet, so // decoding after a padding discard is invalid. OPUS_DEBUG("Opus error, discard padding on interstitial packet"); - return MediaResult( - NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Discard padding on interstitial packet")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("Discard padding on interstitial packet")), + __func__); } if (!mLastFrameTime || mLastFrameTime.ref() != aSample->mTime) { @@ -188,28 +176,32 @@ OpusDataDecoder::DoDecode(MediaRawData* aSample) uint32_t frames_number = opus_packet_get_nb_frames(aSample->Data(), aSample->Size()); if (frames_number <= 0) { - OPUS_DEBUG("Invalid packet header: r=%ld length=%ld", - frames_number, aSample->Size()); - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("Invalid packet header: r=%d length=%u", - frames_number, uint32_t(aSample->Size()))); + OPUS_DEBUG("Invalid packet header: r=%ld length=%ld", frames_number, + aSample->Size()); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("Invalid packet header: r=%d length=%u", + frames_number, uint32_t(aSample->Size()))), + __func__); } uint32_t samples = opus_packet_get_samples_per_frame( aSample->Data(), opus_int32(mOpusParser->mRate)); - // A valid Opus packet must be between 2.5 and 120 ms long (48kHz). uint32_t frames = frames_number*samples; if (frames < 120 || frames > 5760) { OPUS_DEBUG("Invalid packet frames: %u", frames); - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("Invalid packet frames:%u", frames)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("Invalid packet frames:%u", frames)), + __func__); } AlignedAudioBuffer buffer(frames * channels); if (!buffer) { - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__); } // Decode to the appropriate sample type. @@ -223,8 +215,10 @@ OpusDataDecoder::DoDecode(MediaRawData* aSample) buffer.get(), frames, false); #endif if (ret < 0) { - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("Opus decoding error:%d", ret)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("Opus decoding error:%d", ret)), + __func__); } NS_ASSERTION(uint32_t(ret) == frames, "Opus decoded too few audio samples"); CheckedInt64 startTime = aSample->mTime; @@ -249,10 +243,12 @@ OpusDataDecoder::DoDecode(MediaRawData* aSample) // Record the discard so we can return an error if another packet is // decoded. if (aSample->mDiscardPadding > frames) { - // Discarding more than the entire packet is invalid. + // Discarding more than the entire packet is invalid. OPUS_DEBUG("Opus error, discard padding larger than packet"); - return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Discard padding larger than packet")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("Discard padding larger than packet")), + __func__); } mPaddingDiscarded = true; @@ -281,59 +277,59 @@ OpusDataDecoder::DoDecode(MediaRawData* aSample) CheckedInt64 duration = FramesToUsecs(frames, mOpusParser->mRate); if (!duration.isValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, - RESULT_DETAIL("Overflow converting WebM audio duration")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, + RESULT_DETAIL("Overflow converting WebM audio duration")), + __func__); } - CheckedInt64 time = - startTime - FramesToUsecs(mOpusParser->mPreSkip, mOpusParser->mRate) + - FramesToUsecs(mFrames, mOpusParser->mRate); + CheckedInt64 time = startTime - + FramesToUsecs(mOpusParser->mPreSkip, mOpusParser->mRate) + + FramesToUsecs(mFrames, mOpusParser->mRate); if (!time.isValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, - RESULT_DETAIL("Overflow shifting tstamp by codec delay")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, + RESULT_DETAIL("Overflow shifting tstamp by codec delay")), + __func__); }; - mCallback->Output(new AudioData(aSample->mOffset, - time.value(), - duration.value(), - frames, - Move(buffer), - mOpusParser->mChannels, - mOpusParser->mRate)); + mFrames += frames; - return NS_OK; + + return DecodePromise::CreateAndResolve( + DecodedData{ new AudioData(aSample->mOffset, time.value(), duration.value(), + frames, Move(buffer), mOpusParser->mChannels, + mOpusParser->mRate) }, + __func__); } -void -OpusDataDecoder::ProcessDrain() -{ - mCallback->DrainComplete(); -} - -void +RefPtr OpusDataDecoder::Drain() { - mTaskQueue->Dispatch(NewRunnableMethod(this, &OpusDataDecoder::ProcessDrain)); + RefPtr self = this; + // InvokeAsync dispatches a task that will be run after any pending decode + // completes. As such, once the drain task run, there's nothing more to do. + return InvokeAsync(mTaskQueue, __func__, [] { + return DecodePromise::CreateAndResolve(DecodedData(), __func__); + }); } -void +RefPtr OpusDataDecoder::Flush() { if (!mOpusDecoder) { - return; + return FlushPromise::CreateAndResolve(true, __func__); } - mIsFlushing = true; - nsCOMPtr runnable = NS_NewRunnableFunction([this] () { + + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { MOZ_ASSERT(mOpusDecoder); // Reset the decoder. opus_multistream_decoder_ctl(mOpusDecoder, OPUS_RESET_STATE); mSkip = mOpusParser->mPreSkip; mPaddingDiscarded = false; mLastFrameTime.reset(); + return FlushPromise::CreateAndResolve(true, __func__); }); - SyncRunnable::DispatchToThread(mTaskQueue, runnable); - mIsFlushing = false; } /* static */ diff --git a/dom/media/platforms/agnostic/OpusDecoder.h b/dom/media/platforms/agnostic/OpusDecoder.h index 6d82ae502c6c..7615d82a7dcf 100644 --- a/dom/media/platforms/agnostic/OpusDecoder.h +++ b/dom/media/platforms/agnostic/OpusDecoder.h @@ -24,10 +24,10 @@ public: ~OpusDataDecoder(); RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { return "opus audio decoder"; @@ -46,13 +46,10 @@ public: private: nsresult DecodeHeader(const unsigned char* aData, size_t aLength); - void ProcessDecode(MediaRawData* aSample); - MediaResult DoDecode(MediaRawData* aSample); - void ProcessDrain(); + RefPtr ProcessDecode(MediaRawData* aSample); const AudioInfo& mInfo; const RefPtr mTaskQueue; - MediaDataDecoderCallback* mCallback; // Opus decoder state nsAutoPtr mOpusParser; @@ -68,8 +65,6 @@ private: int64_t mFrames; Maybe mLastFrameTime; uint8_t mMappingTable[MAX_AUDIO_CHANNELS]; // Channel mapping table. - - Atomic mIsFlushing; }; } // namespace mozilla diff --git a/dom/media/platforms/agnostic/TheoraDecoder.cpp b/dom/media/platforms/agnostic/TheoraDecoder.cpp index b216791e4926..ff9b783f69df 100644 --- a/dom/media/platforms/agnostic/TheoraDecoder.cpp +++ b/dom/media/platforms/agnostic/TheoraDecoder.cpp @@ -40,8 +40,6 @@ ogg_packet InitTheoraPacket(const unsigned char* aData, size_t aLength, TheoraDecoder::TheoraDecoder(const CreateDecoderParams& aParams) : mImageContainer(aParams.mImageContainer) , mTaskQueue(aParams.mTaskQueue) - , mCallback(aParams.mCallback) - , mIsFlushing(false) , mTheoraSetupInfo(nullptr) , mTheoraDecoderContext(nullptr) , mPacketCount(0) @@ -58,13 +56,17 @@ TheoraDecoder::~TheoraDecoder() th_info_clear(&mTheoraInfo); } -void +RefPtr TheoraDecoder::Shutdown() { - if (mTheoraDecoderContext) { - th_decode_free(mTheoraDecoderContext); - mTheoraDecoderContext = nullptr; - } + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { + if (mTheoraDecoderContext) { + th_decode_free(mTheoraDecoderContext); + mTheoraDecoderContext = nullptr; + } + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } RefPtr @@ -98,16 +100,12 @@ TheoraDecoder::Init() } -void +RefPtr TheoraDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mIsFlushing = true; - nsCOMPtr r = NS_NewRunnableFunction([this] () { - // nothing to do for now. + return InvokeAsync(mTaskQueue, __func__, []() { + return FlushPromise::CreateAndResolve(true, __func__); }); - SyncRunnable::DispatchToThread(mTaskQueue, r); - mIsFlushing = false; } nsresult @@ -123,8 +121,8 @@ TheoraDecoder::DoDecodeHeader(const unsigned char* aData, size_t aLength) return r > 0 ? NS_OK : NS_ERROR_FAILURE; } -MediaResult -TheoraDecoder::DoDecode(MediaRawData* aSample) +RefPtr +TheoraDecoder::ProcessDecode(MediaRawData* aSample) { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); @@ -181,52 +179,33 @@ TheoraDecoder::DoDecode(MediaRawData* aSample) LOG("Image allocation error source %ldx%ld display %ldx%ld picture %ldx%ld", mTheoraInfo.frame_width, mTheoraInfo.frame_height, mInfo.mDisplay.width, mInfo.mDisplay.height, mInfo.mImage.width, mInfo.mImage.height); - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("Insufficient memory")), + __func__); } - mCallback->Output(v); - return NS_OK; - } else { - LOG("Theora Decode error: %d", ret); - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("Theora decode error:%d", ret)); + return DecodePromise::CreateAndResolve(DecodedData{v}, __func__); } + LOG("Theora Decode error: %d", ret); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("Theora decode error:%d", ret)), + __func__); } -void -TheoraDecoder::ProcessDecode(MediaRawData* aSample) +RefPtr +TheoraDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - if (mIsFlushing) { - return; - } - MediaResult rv = DoDecode(aSample); - if (NS_FAILED(rv)) { - mCallback->Error(rv); - } else { - mCallback->InputExhausted(); - } + return InvokeAsync(mTaskQueue, this, __func__, + &TheoraDecoder::ProcessDecode, aSample); } -void -TheoraDecoder::Input(MediaRawData* aSample) -{ - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mTaskQueue->Dispatch(NewRunnableMethod>( - this, &TheoraDecoder::ProcessDecode, aSample)); -} - -void -TheoraDecoder::ProcessDrain() -{ - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - mCallback->DrainComplete(); -} - -void +RefPtr TheoraDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mTaskQueue->Dispatch(NewRunnableMethod(this, &TheoraDecoder::ProcessDrain)); + return InvokeAsync(mTaskQueue, __func__, [] { + return DecodePromise::CreateAndResolve(DecodedData(), __func__); + }); } /* static */ diff --git a/dom/media/platforms/agnostic/TheoraDecoder.h b/dom/media/platforms/agnostic/TheoraDecoder.h index 4a5daebb9149..a776eb68e9f3 100644 --- a/dom/media/platforms/agnostic/TheoraDecoder.h +++ b/dom/media/platforms/agnostic/TheoraDecoder.h @@ -24,10 +24,10 @@ public: ~TheoraDecoder(); RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; // Return true if mimetype is a Theora codec static bool IsTheora(const nsACString& aMimeType); @@ -40,14 +40,10 @@ public: private: nsresult DoDecodeHeader(const unsigned char* aData, size_t aLength); - void ProcessDecode(MediaRawData* aSample); - MediaResult DoDecode(MediaRawData* aSample); - void ProcessDrain(); + RefPtr ProcessDecode(MediaRawData* aSample); RefPtr mImageContainer; RefPtr mTaskQueue; - MediaDataDecoderCallback* mCallback; - Atomic mIsFlushing; // Theora header & decoder state th_info mTheoraInfo; diff --git a/dom/media/platforms/agnostic/VPXDecoder.cpp b/dom/media/platforms/agnostic/VPXDecoder.cpp index 4d3b7295bf97..0229abddcc7b 100644 --- a/dom/media/platforms/agnostic/VPXDecoder.cpp +++ b/dom/media/platforms/agnostic/VPXDecoder.cpp @@ -69,8 +69,6 @@ InitContext(vpx_codec_ctx_t* aCtx, VPXDecoder::VPXDecoder(const CreateDecoderParams& aParams) : mImageContainer(aParams.mImageContainer) , mTaskQueue(aParams.mTaskQueue) - , mCallback(aParams.mCallback) - , mIsFlushing(false) , mInfo(aParams.VideoConfig()) , mCodec(MimeTypeToCodec(aParams.VideoConfig().mMimeType)) { @@ -84,11 +82,15 @@ VPXDecoder::~VPXDecoder() MOZ_COUNT_DTOR(VPXDecoder); } -void +RefPtr VPXDecoder::Shutdown() { - vpx_codec_destroy(&mVPX); - vpx_codec_destroy(&mVPXAlpha); + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { + vpx_codec_destroy(&mVPX); + vpx_codec_destroy(&mVPXAlpha); + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } RefPtr @@ -108,22 +110,19 @@ VPXDecoder::Init() __func__); } -void +RefPtr VPXDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mIsFlushing = true; - nsCOMPtr r = NS_NewRunnableFunction([this] () { - // nothing to do for now. + return InvokeAsync(mTaskQueue, __func__, []() { + return FlushPromise::CreateAndResolve(true, __func__); }); - SyncRunnable::DispatchToThread(mTaskQueue, r); - mIsFlushing = false; } -MediaResult -VPXDecoder::DoDecode(MediaRawData* aSample) +RefPtr +VPXDecoder::ProcessDecode(MediaRawData* aSample) { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); + #if defined(DEBUG) vpx_codec_stream_info_t si; PodZero(&si); @@ -139,15 +138,17 @@ VPXDecoder::DoDecode(MediaRawData* aSample) if (vpx_codec_err_t r = vpx_codec_decode(&mVPX, aSample->Data(), aSample->Size(), nullptr, 0)) { LOG("VPX Decode error: %s", vpx_codec_err_to_string(r)); - return MediaResult( - NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("VPX error: %s", vpx_codec_err_to_string(r))); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("VPX error: %s", vpx_codec_err_to_string(r))), + __func__); } vpx_codec_iter_t iter = nullptr; vpx_image_t *img; vpx_image_t *img_alpha = nullptr; bool alpha_decoded = false; + DecodedData results; while ((img = vpx_codec_get_frame(&mVPX, &iter))) { NS_ASSERTION(img->fmt == VPX_IMG_FMT_I420 || @@ -157,10 +158,10 @@ VPXDecoder::DoDecode(MediaRawData* aSample) "Multiple frames per packet that contains alpha"); if (aSample->AlphaSize() > 0) { - if(!alpha_decoded){ + if (!alpha_decoded){ MediaResult rv = DecodeAlpha(&img_alpha, aSample); if (NS_FAILED(rv)) { - return(rv); + return DecodePromise::CreateAndReject(rv, __func__); } alpha_decoded = true; } @@ -195,8 +196,10 @@ VPXDecoder::DoDecode(MediaRawData* aSample) b.mPlanes[2].mWidth = img->d_w; } else { LOG("VPX Unknown image format"); - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("VPX Unknown image format")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("VPX Unknown image format")), + __func__); } RefPtr v; @@ -233,56 +236,35 @@ VPXDecoder::DoDecode(MediaRawData* aSample) } if (!v) { - LOG("Image allocation error source %ldx%ld display %ldx%ld picture %ldx%ld", - img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height, - mInfo.mImage.width, mInfo.mImage.height); - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); + LOG( + "Image allocation error source %ldx%ld display %ldx%ld picture %ldx%ld", + img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height, + mInfo.mImage.width, mInfo.mImage.height); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__); } - mCallback->Output(v); + results.AppendElement(Move(v)); } - return NS_OK; + return DecodePromise::CreateAndResolve(Move(results), __func__); } -void -VPXDecoder::ProcessDecode(MediaRawData* aSample) +RefPtr +VPXDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - if (mIsFlushing) { - return; - } - MediaResult rv = DoDecode(aSample); - if (NS_FAILED(rv)) { - mCallback->Error(rv); - } else { - mCallback->InputExhausted(); - } + return InvokeAsync(mTaskQueue, this, __func__, + &VPXDecoder::ProcessDecode, aSample); } -void -VPXDecoder::Input(MediaRawData* aSample) -{ - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mTaskQueue->Dispatch(NewRunnableMethod>( - this, &VPXDecoder::ProcessDecode, aSample)); -} - -void -VPXDecoder::ProcessDrain() -{ - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - mCallback->DrainComplete(); -} - -void +RefPtr VPXDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mTaskQueue->Dispatch(NewRunnableMethod(this, &VPXDecoder::ProcessDrain)); + return InvokeAsync(mTaskQueue, __func__, [] { + return DecodePromise::CreateAndResolve(DecodedData(), __func__); + }); } MediaResult -VPXDecoder::DecodeAlpha(vpx_image_t** aImgAlpha, - MediaRawData* aSample) +VPXDecoder::DecodeAlpha(vpx_image_t** aImgAlpha, const MediaRawData* aSample) { vpx_codec_err_t r = vpx_codec_decode(&mVPXAlpha, aSample->AlphaData(), diff --git a/dom/media/platforms/agnostic/VPXDecoder.h b/dom/media/platforms/agnostic/VPXDecoder.h index b76d0d21fc7f..b76b5432f948 100644 --- a/dom/media/platforms/agnostic/VPXDecoder.h +++ b/dom/media/platforms/agnostic/VPXDecoder.h @@ -25,16 +25,17 @@ public: ~VPXDecoder(); RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { return "libvpx video decoder"; } - enum Codec: uint8_t { + enum Codec: uint8_t + { VP8 = 1 << 0, VP9 = 1 << 1 }; @@ -47,16 +48,11 @@ public: static bool IsVP9(const nsACString& aMimeType); private: - void ProcessDecode(MediaRawData* aSample); - MediaResult DoDecode(MediaRawData* aSample); - void ProcessDrain(); - MediaResult DecodeAlpha(vpx_image_t** aImgAlpha, - MediaRawData* aSample); + RefPtr ProcessDecode(MediaRawData* aSample); + MediaResult DecodeAlpha(vpx_image_t** aImgAlpha, const MediaRawData* aSample); const RefPtr mImageContainer; const RefPtr mTaskQueue; - MediaDataDecoderCallback* mCallback; - Atomic mIsFlushing; // VPx decoder state vpx_codec_ctx_t mVPX; diff --git a/dom/media/platforms/agnostic/VorbisDecoder.cpp b/dom/media/platforms/agnostic/VorbisDecoder.cpp index a4a908e678a3..eebeb27f34ef 100644 --- a/dom/media/platforms/agnostic/VorbisDecoder.cpp +++ b/dom/media/platforms/agnostic/VorbisDecoder.cpp @@ -33,10 +33,8 @@ ogg_packet InitVorbisPacket(const unsigned char* aData, size_t aLength, VorbisDataDecoder::VorbisDataDecoder(const CreateDecoderParams& aParams) : mInfo(aParams.AudioConfig()) , mTaskQueue(aParams.mTaskQueue) - , mCallback(aParams.mCallback) , mPacketCount(0) , mFrames(0) - , mIsFlushing(false) { // Zero these member vars to avoid crashes in Vorbis clear functions when // destructor is called before |Init|. @@ -54,9 +52,13 @@ VorbisDataDecoder::~VorbisDataDecoder() vorbis_comment_clear(&mVorbisComment); } -void +RefPtr VorbisDataDecoder::Shutdown() { + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self]() { + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } RefPtr @@ -122,32 +124,15 @@ VorbisDataDecoder::DecodeHeader(const unsigned char* aData, size_t aLength) return r == 0 ? NS_OK : NS_ERROR_FAILURE; } -void -VorbisDataDecoder::Input(MediaRawData* aSample) +RefPtr +VorbisDataDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mTaskQueue->Dispatch(NewRunnableMethod>( - this, &VorbisDataDecoder::ProcessDecode, aSample)); + return InvokeAsync(mTaskQueue, this, __func__, + &VorbisDataDecoder::ProcessDecode, aSample); } -void +RefPtr VorbisDataDecoder::ProcessDecode(MediaRawData* aSample) -{ - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - if (mIsFlushing) { - return; - } - - MediaResult rv = DoDecode(aSample); - if (NS_FAILED(rv)) { - mCallback->Error(rv); - } else { - mCallback->InputExhausted(); - } -} - -MediaResult -VorbisDataDecoder::DoDecode(MediaRawData* aSample) { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); @@ -170,27 +155,34 @@ VorbisDataDecoder::DoDecode(MediaRawData* aSample) int err = vorbis_synthesis(&mVorbisBlock, &pkt); if (err) { - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("vorbis_synthesis:%d", err)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("vorbis_synthesis:%d", err)), + __func__); } err = vorbis_synthesis_blockin(&mVorbisDsp, &mVorbisBlock); if (err) { - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("vorbis_synthesis_blockin:%d", err)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("vorbis_synthesis_blockin:%d", err)), + __func__); } VorbisPCMValue** pcm = 0; int32_t frames = vorbis_synthesis_pcmout(&mVorbisDsp, &pcm); if (frames == 0) { - return NS_OK; + return DecodePromise::CreateAndResolve(DecodedData(), __func__); } + + DecodedData results; while (frames > 0) { uint32_t channels = mVorbisDsp.vi->channels; uint32_t rate = mVorbisDsp.vi->rate; AlignedAudioBuffer buffer(frames*channels); if (!buffer) { - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__); } for (uint32_t j = 0; j < channels; ++j) { VorbisPCMValue* channel = pcm[j]; @@ -201,21 +193,26 @@ VorbisDataDecoder::DoDecode(MediaRawData* aSample) CheckedInt64 duration = FramesToUsecs(frames, rate); if (!duration.isValid()) { - return MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, - RESULT_DETAIL("Overflow converting audio duration")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, + RESULT_DETAIL("Overflow converting audio duration")), + __func__); } CheckedInt64 total_duration = FramesToUsecs(mFrames, rate); if (!total_duration.isValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, - RESULT_DETAIL("Overflow converting audio total_duration")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, + RESULT_DETAIL("Overflow converting audio total_duration")), + __func__); } CheckedInt64 time = total_duration + aTstampUsecs; if (!time.isValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, - RESULT_DETAIL("Overflow adding total_duration and aTstampUsecs")); + return DecodePromise::CreateAndReject( + MediaResult( + NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, + RESULT_DETAIL("Overflow adding total_duration and aTstampUsecs")), + __func__); }; if (!mAudioConverter) { @@ -223,9 +220,10 @@ VorbisDataDecoder::DoDecode(MediaRawData* aSample) rate); AudioConfig out(channels, rate); if (!in.IsValid() || !out.IsValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Invalid channel layout:%u", channels)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("Invalid channel layout:%u", channels)), + __func__); } mAudioConverter = MakeUnique(in, out); } @@ -234,54 +232,43 @@ VorbisDataDecoder::DoDecode(MediaRawData* aSample) data = mAudioConverter->Process(Move(data)); aTotalFrames += frames; - mCallback->Output(new AudioData(aOffset, - time.value(), - duration.value(), - frames, - data.Forget(), - channels, - rate)); + + results.AppendElement(new AudioData(aOffset, time.value(), duration.value(), + frames, data.Forget(), channels, rate)); mFrames += frames; err = vorbis_synthesis_read(&mVorbisDsp, frames); if (err) { - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("vorbis_synthesis_read:%d", err)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("vorbis_synthesis_read:%d", err)), + __func__); } frames = vorbis_synthesis_pcmout(&mVorbisDsp, &pcm); } - - return NS_OK; + return DecodePromise::CreateAndResolve(Move(results), __func__); } -void -VorbisDataDecoder::ProcessDrain() -{ - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - mCallback->DrainComplete(); -} - -void +RefPtr VorbisDataDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mTaskQueue->Dispatch(NewRunnableMethod(this, &VorbisDataDecoder::ProcessDrain)); + return InvokeAsync(mTaskQueue, __func__, [] { + return DecodePromise::CreateAndResolve(DecodedData(), __func__); + }); } -void +RefPtr VorbisDataDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mIsFlushing = true; - nsCOMPtr r = NS_NewRunnableFunction([this] () { + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { // Ignore failed results from vorbis_synthesis_restart. They // aren't fatal and it fails when ResetDecode is called at a // time when no vorbis data has been read. vorbis_synthesis_restart(&mVorbisDsp); mLastFrameTime.reset(); + return FlushPromise::CreateAndResolve(true, __func__); }); - SyncRunnable::DispatchToThread(mTaskQueue, r); - mIsFlushing = false; } /* static */ diff --git a/dom/media/platforms/agnostic/VorbisDecoder.h b/dom/media/platforms/agnostic/VorbisDecoder.h index 0ed7bb645377..ebade59e6e8a 100644 --- a/dom/media/platforms/agnostic/VorbisDecoder.h +++ b/dom/media/platforms/agnostic/VorbisDecoder.h @@ -25,10 +25,10 @@ public: ~VorbisDataDecoder(); RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { return "vorbis audio decoder"; @@ -40,14 +40,10 @@ public: private: nsresult DecodeHeader(const unsigned char* aData, size_t aLength); - - void ProcessDecode(MediaRawData* aSample); - MediaResult DoDecode(MediaRawData* aSample); - void ProcessDrain(); + RefPtr ProcessDecode(MediaRawData* aSample); const AudioInfo& mInfo; const RefPtr mTaskQueue; - MediaDataDecoderCallback* mCallback; // Vorbis decoder state vorbis_info mVorbisInfo; @@ -59,7 +55,6 @@ private: int64_t mFrames; Maybe mLastFrameTime; UniquePtr mAudioConverter; - Atomic mIsFlushing; }; } // namespace mozilla diff --git a/dom/media/platforms/agnostic/WAVDecoder.cpp b/dom/media/platforms/agnostic/WAVDecoder.cpp index 67a045287d49..507409bf1373 100644 --- a/dom/media/platforms/agnostic/WAVDecoder.cpp +++ b/dom/media/platforms/agnostic/WAVDecoder.cpp @@ -47,13 +47,17 @@ DecodeULawSample(uint8_t aValue) WaveDataDecoder::WaveDataDecoder(const CreateDecoderParams& aParams) : mInfo(aParams.AudioConfig()) - , mCallback(aParams.mCallback) + , mTaskQueue(aParams.mTaskQueue) { } -void +RefPtr WaveDataDecoder::Shutdown() { + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self]() { + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } RefPtr @@ -62,19 +66,15 @@ WaveDataDecoder::Init() return InitPromise::CreateAndResolve(TrackInfo::kAudioTrack, __func__); } -void -WaveDataDecoder::Input(MediaRawData* aSample) +RefPtr +WaveDataDecoder::Decode(MediaRawData* aSample) { - MediaResult rv = DoDecode(aSample); - if (NS_FAILED(rv)) { - mCallback->Error(rv); - } else { - mCallback->InputExhausted(); - } + return InvokeAsync(mTaskQueue, this, __func__, + &WaveDataDecoder::ProcessDecode, aSample); } -MediaResult -WaveDataDecoder::DoDecode(MediaRawData* aSample) +RefPtr +WaveDataDecoder::ProcessDecode(MediaRawData* aSample) { size_t aLength = aSample->Size(); ByteReader aReader(aSample->Data(), aLength); @@ -85,7 +85,8 @@ WaveDataDecoder::DoDecode(MediaRawData* aSample) AlignedAudioBuffer buffer(frames * mInfo.mChannels); if (!buffer) { - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__); } for (int i = 0; i < frames; ++i) { for (unsigned int j = 0; j < mInfo.mChannels; ++j) { @@ -119,26 +120,26 @@ WaveDataDecoder::DoDecode(MediaRawData* aSample) int64_t duration = frames / mInfo.mRate; - mCallback->Output(new AudioData(aOffset, - aTstampUsecs, - duration, - frames, - Move(buffer), - mInfo.mChannels, - mInfo.mRate)); - - return NS_OK; + return DecodePromise::CreateAndResolve( + DecodedData{ new AudioData(aOffset, aTstampUsecs, duration, frames, + Move(buffer), mInfo.mChannels, mInfo.mRate) }, + __func__); } -void +RefPtr WaveDataDecoder::Drain() { - mCallback->DrainComplete(); + return InvokeAsync(mTaskQueue, __func__, [] { + return DecodePromise::CreateAndResolve(DecodedData(), __func__); + }); } -void +RefPtr WaveDataDecoder::Flush() { + return InvokeAsync(mTaskQueue, __func__, []() { + return FlushPromise::CreateAndResolve(true, __func__); + }); } /* static */ diff --git a/dom/media/platforms/agnostic/WAVDecoder.h b/dom/media/platforms/agnostic/WAVDecoder.h index dea980168118..de49ebbc7531 100644 --- a/dom/media/platforms/agnostic/WAVDecoder.h +++ b/dom/media/platforms/agnostic/WAVDecoder.h @@ -21,20 +21,19 @@ public: static bool IsWave(const nsACString& aMimeType); RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { return "wave audio decoder"; } private: - MediaResult DoDecode(MediaRawData* aSample); - + RefPtr ProcessDecode(MediaRawData* aSample); const AudioInfo& mInfo; - MediaDataDecoderCallback* mCallback; + const RefPtr mTaskQueue; }; } // namespace mozilla diff --git a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp index 7acf955d5e81..8fdb16685e95 100644 --- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp +++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp @@ -24,53 +24,67 @@ namespace mozilla { typedef MozPromiseRequestHolder DecryptPromiseRequestHolder; extern already_AddRefed CreateBlankDecoderModule(); -class EMEDecryptor : public MediaDataDecoder { - +class EMEDecryptor : public MediaDataDecoder +{ public: - EMEDecryptor(MediaDataDecoder* aDecoder, - MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, TaskQueue* aDecodeTaskQueue) : mDecoder(aDecoder) - , mCallback(aCallback) , mTaskQueue(aDecodeTaskQueue) , mProxy(aProxy) - , mSamplesWaitingForKey(new SamplesWaitingForKey(this, this->mCallback, - mTaskQueue, mProxy)) + , mSamplesWaitingForKey(new SamplesWaitingForKey(mProxy)) , mIsShutdown(false) { } - RefPtr Init() override { + RefPtr Init() override + { MOZ_ASSERT(!mIsShutdown); return mDecoder->Init(); } - void Input(MediaRawData* aSample) override { + RefPtr Decode(MediaRawData* aSample) override + { + MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); + MOZ_RELEASE_ASSERT(mDecrypts.Count() == 0, + "Can only process one sample at a time"); + RefPtr p = mDecodePromise.Ensure(__func__); + AttemptDecode(aSample); + return p; + } + + void AttemptDecode(MediaRawData* aSample) + { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); if (mIsShutdown) { NS_WARNING("EME encrypted sample arrived after shutdown"); - return; - } - if (mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)) { + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); return; } - nsAutoPtr writer(aSample->CreateWriter()); - mProxy->GetSessionIdsForKeyId(aSample->mCrypto.mKeyId, - writer->mCrypto.mSessionIds); + RefPtr self = this; + mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample) + ->Then(mTaskQueue, __func__, + [self, this](MediaRawData* aSample) { + mKeyRequest.Complete(); + nsAutoPtr writer(aSample->CreateWriter()); + mProxy->GetSessionIdsForKeyId(aSample->mCrypto.mKeyId, + writer->mCrypto.mSessionIds); - mDecrypts.Put(aSample, new DecryptPromiseRequestHolder()); - mProxy->Decrypt(aSample)->Then( - mTaskQueue, __func__, this, - &EMEDecryptor::Decrypted, - &EMEDecryptor::Decrypted) - ->Track(*mDecrypts.Get(aSample)); - return; + mDecrypts.Put(aSample, new DecryptPromiseRequestHolder()); + mProxy->Decrypt(aSample) + ->Then(mTaskQueue, __func__, this, + &EMEDecryptor::Decrypted, + &EMEDecryptor::Decrypted) + ->Track(*mDecrypts.Get(aSample)); + }, + [self, this]() { mKeyRequest.Complete(); }) + ->Track(mKeyRequest); } - void Decrypted(const DecryptResult& aDecrypted) { + void Decrypted(const DecryptResult& aDecrypted) + { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); MOZ_ASSERT(aDecrypted.mSample); @@ -91,117 +105,177 @@ public: if (aDecrypted.mStatus == NoKeyErr) { // Key became unusable after we sent the sample to CDM to decrypt. - // Call Input() again, so that the sample is enqueued for decryption + // Call Decode() again, so that the sample is enqueued for decryption // if the key becomes usable again. - Input(aDecrypted.mSample); + AttemptDecode(aDecrypted.mSample); } else if (aDecrypted.mStatus != Ok) { - if (mCallback) { - mCallback->Error(MediaResult( + mDecodePromise.RejectIfExists( + MediaResult( NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("decrypted.mStatus=%u", uint32_t(aDecrypted.mStatus)))); - } + RESULT_DETAIL("decrypted.mStatus=%u", uint32_t(aDecrypted.mStatus))), + __func__); } else { MOZ_ASSERT(!mIsShutdown); // The sample is no longer encrypted, so clear its crypto metadata. UniquePtr writer(aDecrypted.mSample->CreateWriter()); writer->mCrypto = CryptoSample(); - mDecoder->Input(aDecrypted.mSample); + RefPtr self = this; + mDecoder->Decode(aDecrypted.mSample) + ->Then(mTaskQueue, __func__, + [self, this](const DecodedData& aResults) { + mDecodeRequest.Complete(); + mDecodePromise.ResolveIfExists(aResults, __func__); + }, + [self, this](const MediaResult& aError) { + mDecodeRequest.Complete(); + mDecodePromise.RejectIfExists(aError, __func__); + }) + ->Track(mDecodeRequest); } } - void Flush() override { + RefPtr Flush() override + { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); MOZ_ASSERT(!mIsShutdown); + mKeyRequest.DisconnectIfExists(); + mDecodeRequest.DisconnectIfExists(); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); for (auto iter = mDecrypts.Iter(); !iter.Done(); iter.Next()) { nsAutoPtr& holder = iter.Data(); holder->DisconnectIfExists(); iter.Remove(); } - mDecoder->Flush(); - mSamplesWaitingForKey->Flush(); + RefPtr self = this; + return mDecoder->Flush()->Then(mTaskQueue, __func__, + [self, this]() { + mSamplesWaitingForKey->Flush(); + }, + [self, this]() { + mSamplesWaitingForKey->Flush(); + }); } - void Drain() override { + RefPtr Drain() override + { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); MOZ_ASSERT(!mIsShutdown); + MOZ_ASSERT(mDecodePromise.IsEmpty() && !mDecodeRequest.Exists(), + "Must wait for decoding to complete"); for (auto iter = mDecrypts.Iter(); !iter.Done(); iter.Next()) { nsAutoPtr& holder = iter.Data(); holder->DisconnectIfExists(); iter.Remove(); } - mDecoder->Drain(); + return mDecoder->Drain(); } - void Shutdown() override { + RefPtr Shutdown() override + { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); MOZ_ASSERT(!mIsShutdown); mIsShutdown = true; - mDecoder->Shutdown(); - mSamplesWaitingForKey->BreakCycles(); mSamplesWaitingForKey = nullptr; - mDecoder = nullptr; + RefPtr decoder = mDecoder.forget(); mProxy = nullptr; - mCallback = nullptr; + return decoder->Shutdown(); } - const char* GetDescriptionName() const override { + const char* GetDescriptionName() const override + { return mDecoder->GetDescriptionName(); } private: - RefPtr mDecoder; - MediaDataDecoderCallback* mCallback; RefPtr mTaskQueue; RefPtr mProxy; nsClassHashtable, DecryptPromiseRequestHolder> mDecrypts; RefPtr mSamplesWaitingForKey; + MozPromiseRequestHolder mKeyRequest; + MozPromiseHolder mDecodePromise; + MozPromiseHolder mDrainPromise; + MozPromiseHolder mFlushPromise; + MozPromiseRequestHolder mDecodeRequest; + bool mIsShutdown; }; -class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy { +class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy +{ public: EMEMediaDataDecoderProxy(already_AddRefed aProxyThread, - MediaDataDecoderCallback* aCallback, - CDMProxy* aProxy, - TaskQueue* aTaskQueue) - : MediaDataDecoderProxy(Move(aProxyThread), aCallback) - , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aCallback, - aTaskQueue, aProxy)) + CDMProxy* aProxy) + : MediaDataDecoderProxy(Move(aProxyThread)) + , mTaskQueue(AbstractThread::GetCurrent()->AsTaskQueue()) + , mSamplesWaitingForKey(new SamplesWaitingForKey(aProxy)) , mProxy(aProxy) { } - void Input(MediaRawData* aSample) override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Flush() override; + RefPtr Shutdown() override; private: + RefPtr mTaskQueue; RefPtr mSamplesWaitingForKey; + MozPromiseRequestHolder mKeyRequest; + MozPromiseHolder mDecodePromise; + MozPromiseRequestHolder mDecodeRequest; RefPtr mProxy; }; -void -EMEMediaDataDecoderProxy::Input(MediaRawData* aSample) +RefPtr +EMEMediaDataDecoderProxy::Decode(MediaRawData* aSample) { - if (mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)) { - return; - } + RefPtr p = mDecodePromise.Ensure(__func__); - nsAutoPtr writer(aSample->CreateWriter()); - mProxy->GetSessionIdsForKeyId(aSample->mCrypto.mKeyId, - writer->mCrypto.mSessionIds); + RefPtr self = this; + mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample) + ->Then(mTaskQueue, __func__, + [self, this](MediaRawData* aSample) { + mKeyRequest.Complete(); - MediaDataDecoderProxy::Input(aSample); + nsAutoPtr writer(aSample->CreateWriter()); + mProxy->GetSessionIdsForKeyId(aSample->mCrypto.mKeyId, + writer->mCrypto.mSessionIds); + MediaDataDecoderProxy::Decode(aSample) + ->Then(mTaskQueue, __func__, + [self, this](const DecodedData& aResults) { + mDecodeRequest.Complete(); + mDecodePromise.Resolve(aResults, __func__); + }, + [self, this](const MediaResult& aError) { + mDecodeRequest.Complete(); + mDecodePromise.Reject(aError, __func__); + }) + ->Track(mDecodeRequest); + }, + [self, this]() { + mKeyRequest.Complete(); + MOZ_CRASH("Should never get here"); + }) + ->Track(mKeyRequest); + + return p; } -void +RefPtr +EMEMediaDataDecoderProxy::Flush() +{ + mKeyRequest.DisconnectIfExists(); + mDecodeRequest.DisconnectIfExists(); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + return MediaDataDecoderProxy::Flush(); +} + +RefPtr EMEMediaDataDecoderProxy::Shutdown() { - MediaDataDecoderProxy::Shutdown(); - - mSamplesWaitingForKey->BreakCycles(); mSamplesWaitingForKey = nullptr; mProxy = nullptr; + return MediaDataDecoderProxy::Shutdown(); } EMEDecoderModule::EMEDecoderModule(CDMProxy* aProxy, PDMFactory* aPDM) @@ -215,7 +289,7 @@ EMEDecoderModule::~EMEDecoderModule() } static already_AddRefed -CreateDecoderWrapper(MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, TaskQueue* aTaskQueue) +CreateDecoderWrapper(CDMProxy* aProxy) { RefPtr s(gmp::GeckoMediaPluginService::GetGeckoMediaPluginService()); if (!s) { @@ -226,7 +300,7 @@ CreateDecoderWrapper(MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, Task return nullptr; } RefPtr decoder( - new EMEMediaDataDecoderProxy(thread.forget(), aCallback, aProxy, aTaskQueue)); + new EMEMediaDataDecoderProxy(thread.forget(), aProxy)); return decoder.forget(); } @@ -243,9 +317,8 @@ EMEDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) if (SupportsMimeType(aParams.mConfig.mMimeType, nullptr)) { // GMP decodes. Assume that means it can decrypt too. - RefPtr wrapper = - CreateDecoderWrapper(aParams.mCallback, mProxy, aParams.mTaskQueue); - auto params = GMPVideoDecoderParams(aParams).WithCallback(wrapper); + RefPtr wrapper = CreateDecoderWrapper(mProxy); + auto params = GMPVideoDecoderParams(aParams); wrapper->SetProxyTarget(new EMEVideoDecoder(mProxy, params)); return wrapper.forget(); } @@ -256,10 +329,8 @@ EMEDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) return nullptr; } - RefPtr emeDecoder(new EMEDecryptor(decoder, - aParams.mCallback, - mProxy, - AbstractThread::GetCurrent()->AsTaskQueue())); + RefPtr emeDecoder(new EMEDecryptor( + decoder, mProxy, AbstractThread::GetCurrent()->AsTaskQueue())); return emeDecoder.forget(); } @@ -283,10 +354,8 @@ EMEDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) return nullptr; } - RefPtr emeDecoder(new EMEDecryptor(decoder, - aParams.mCallback, - mProxy, - AbstractThread::GetCurrent()->AsTaskQueue())); + RefPtr emeDecoder(new EMEDecryptor( + decoder, mProxy, AbstractThread::GetCurrent()->AsTaskQueue())); return emeDecoder.forget(); } diff --git a/dom/media/platforms/agnostic/eme/EMEDecoderModule.h b/dom/media/platforms/agnostic/eme/EMEDecoderModule.h index 32074ae8c0b3..fdc38ee8ab44 100644 --- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.h +++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.h @@ -15,9 +15,8 @@ namespace mozilla { class CDMProxy; -class EMEDecoderModule : public PlatformDecoderModule { -private: - +class EMEDecoderModule : public PlatformDecoderModule +{ public: EMEDecoderModule(CDMProxy* aProxy, PDMFactory* aPDM); @@ -43,8 +42,6 @@ private: RefPtr mProxy; // Will be null if CDM has decoding capability. RefPtr mPDM; - // We run the PDM on its own task queue. - RefPtr mTaskQueue; }; } // namespace mozilla diff --git a/dom/media/platforms/agnostic/eme/EMEVideoDecoder.cpp b/dom/media/platforms/agnostic/eme/EMEVideoDecoder.cpp index bddb8966051d..7fb8607975fb 100644 --- a/dom/media/platforms/agnostic/eme/EMEVideoDecoder.cpp +++ b/dom/media/platforms/agnostic/eme/EMEVideoDecoder.cpp @@ -4,36 +4,23 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "mozilla/CDMProxy.h" #include "EMEVideoDecoder.h" #include "GMPVideoEncodedFrameImpl.h" -#include "mozilla/CDMProxy.h" #include "MediaData.h" #include "MP4Decoder.h" +#include "PlatformDecoderModule.h" #include "VPXDecoder.h" namespace mozilla { -void -EMEVideoCallbackAdapter::Error(GMPErr aErr) -{ - if (aErr == GMPNoKeyErr) { - // The GMP failed to decrypt a frame due to not having a key. This can - // happen if a key expires or a session is closed during playback. - NS_WARNING("GMP failed to decrypt due to lack of key"); - return; - } - VideoCallbackAdapter::Error(aErr); -} - EMEVideoDecoder::EMEVideoDecoder(CDMProxy* aProxy, const GMPVideoDecoderParams& aParams) - : GMPVideoDecoder(GMPVideoDecoderParams(aParams).WithAdapter( - new EMEVideoCallbackAdapter(aParams.mCallback, - VideoInfo(aParams.mConfig.mDisplay), - aParams.mImageContainer))) + : GMPVideoDecoder(GMPVideoDecoderParams(aParams)) , mProxy(aProxy) , mDecryptorId(aProxy->GetDecryptorId()) -{} +{ +} void EMEVideoDecoder::InitTags(nsTArray& aTags) diff --git a/dom/media/platforms/agnostic/eme/EMEVideoDecoder.h b/dom/media/platforms/agnostic/eme/EMEVideoDecoder.h index a0f23f867390..6ab7349b6d22 100644 --- a/dom/media/platforms/agnostic/eme/EMEVideoDecoder.h +++ b/dom/media/platforms/agnostic/eme/EMEVideoDecoder.h @@ -8,24 +8,13 @@ #define EMEVideoDecoder_h_ #include "GMPVideoDecoder.h" -#include "PlatformDecoderModule.h" namespace mozilla { class CDMProxy; +class MediaRawData; class TaskQueue; -class EMEVideoCallbackAdapter : public VideoCallbackAdapter { -public: - EMEVideoCallbackAdapter(MediaDataDecoderCallbackProxy* aCallback, - VideoInfo aVideoInfo, - layers::ImageContainer* aImageContainer) - : VideoCallbackAdapter(aCallback, aVideoInfo, aImageContainer) - {} - - void Error(GMPErr aErr) override; -}; - class EMEVideoDecoder : public GMPVideoDecoder { public: EMEVideoDecoder(CDMProxy* aProxy, const GMPVideoDecoderParams& aParams); diff --git a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp index 86180d58ba66..c0fa9af954a4 100644 --- a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp +++ b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp @@ -4,46 +4,45 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "SamplesWaitingForKey.h" #include "mozilla/CDMProxy.h" #include "mozilla/CDMCaps.h" +#include "mozilla/TaskQueue.h" #include "MediaData.h" +#include "SamplesWaitingForKey.h" namespace mozilla { -SamplesWaitingForKey::SamplesWaitingForKey(MediaDataDecoder* aDecoder, - MediaDataDecoderCallback* aCallback, - TaskQueue* aTaskQueue, - CDMProxy* aProxy) +SamplesWaitingForKey::SamplesWaitingForKey(CDMProxy* aProxy) : mMutex("SamplesWaitingForKey") - , mDecoder(aDecoder) - , mDecoderCallback(aCallback) - , mTaskQueue(aTaskQueue) , mProxy(aProxy) { } SamplesWaitingForKey::~SamplesWaitingForKey() { + Flush(); } -bool +RefPtr SamplesWaitingForKey::WaitIfKeyNotUsable(MediaRawData* aSample) { if (!aSample || !aSample->mCrypto.mValid || !mProxy) { - return false; + return WaitForKeyPromise::CreateAndResolve(aSample, __func__); } CDMCaps::AutoLock caps(mProxy->Capabilites()); const auto& keyid = aSample->mCrypto.mKeyId; - if (!caps.IsKeyUsable(keyid)) { - { - MutexAutoLock lock(mMutex); - mSamples.AppendElement(aSample); - } - caps.NotifyWhenKeyIdUsable(aSample->mCrypto.mKeyId, this); - return true; + if (caps.IsKeyUsable(keyid)) { + return WaitForKeyPromise::CreateAndResolve(aSample, __func__); } - return false; + SampleEntry entry; + entry.mSample = aSample; + RefPtr p = entry.mPromise.Ensure(__func__); + { + MutexAutoLock lock(mMutex); + mSamples.AppendElement(Move(entry)); + } + caps.NotifyWhenKeyIdUsable(aSample->mCrypto.mKeyId, this); + return p; } void @@ -52,13 +51,10 @@ SamplesWaitingForKey::NotifyUsable(const CencKeyId& aKeyId) MutexAutoLock lock(mMutex); size_t i = 0; while (i < mSamples.Length()) { - if (aKeyId == mSamples[i]->mCrypto.mKeyId) { - RefPtr task; - task = NewRunnableMethod>(mDecoder, - &MediaDataDecoder::Input, - RefPtr(mSamples[i])); + auto& entry = mSamples[i]; + if (aKeyId == entry.mSample->mCrypto.mKeyId) { + entry.mPromise.Resolve(entry.mSample, __func__); mSamples.RemoveElementAt(i); - mTaskQueue->Dispatch(task.forget()); } else { i++; } @@ -69,16 +65,9 @@ void SamplesWaitingForKey::Flush() { MutexAutoLock lock(mMutex); - mSamples.Clear(); -} - -void -SamplesWaitingForKey::BreakCycles() -{ - MutexAutoLock lock(mMutex); - mDecoder = nullptr; - mTaskQueue = nullptr; - mProxy = nullptr; + for (auto& sample : mSamples) { + sample.mPromise.Reject(true, __func__); + } mSamples.Clear(); } diff --git a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h index 65bb14403070..cc4a546b4b3d 100644 --- a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h +++ b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h @@ -7,50 +7,49 @@ #ifndef SamplesWaitingForKey_h_ #define SamplesWaitingForKey_h_ -#include "mozilla/TaskQueue.h" - -#include "PlatformDecoderModule.h" +#include "mozilla/MozPromise.h" +#include "mozilla/Mutex.h" +#include "mozilla/RefPtr.h" namespace mozilla { typedef nsTArray CencKeyId; class CDMProxy; +class MediaRawData; // Encapsulates the task of waiting for the CDMProxy to have the necessary // keys to decrypt a given sample. -class SamplesWaitingForKey { +class SamplesWaitingForKey +{ public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SamplesWaitingForKey) - explicit SamplesWaitingForKey(MediaDataDecoder* aDecoder, - MediaDataDecoderCallback* aCallback, - TaskQueue* aTaskQueue, - CDMProxy* aProxy); + typedef MozPromise, bool, /* IsExclusive = */ true> + WaitForKeyPromise; - // Returns true if we need to wait for a key to become usable. - // Will callback MediaDataDecoder::Input(aSample) on mDecoder once the - // sample is ready to be decrypted. The order of input samples is - // preserved. - bool WaitIfKeyNotUsable(MediaRawData* aSample); + explicit SamplesWaitingForKey(CDMProxy* aProxy); + + // Returns a promise that will be resolved if or when a key for decoding the + // sample becomes usable. + RefPtr WaitIfKeyNotUsable(MediaRawData* aSample); void NotifyUsable(const CencKeyId& aKeyId); void Flush(); - void BreakCycles(); - protected: ~SamplesWaitingForKey(); private: Mutex mMutex; - RefPtr mDecoder; - MediaDataDecoderCallback* mDecoderCallback; - RefPtr mTaskQueue; RefPtr mProxy; - nsTArray> mSamples; + struct SampleEntry + { + RefPtr mSample; + MozPromiseHolder mPromise; + }; + nsTArray mSamples; }; } // namespace mozilla diff --git a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp index daa919249c19..f35b3e44ddad 100644 --- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp +++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp @@ -32,7 +32,7 @@ GMPDecoderModule::~GMPDecoderModule() } static already_AddRefed -CreateDecoderWrapper(MediaDataDecoderCallback* aCallback) +CreateDecoderWrapper() { RefPtr s(gmp::GeckoMediaPluginService::GetGeckoMediaPluginService()); if (!s) { @@ -42,7 +42,7 @@ CreateDecoderWrapper(MediaDataDecoderCallback* aCallback) if (!thread) { return nullptr; } - RefPtr decoder(new MediaDataDecoderProxy(thread.forget(), aCallback)); + RefPtr decoder(new MediaDataDecoderProxy(thread.forget())); return decoder.forget(); } @@ -55,8 +55,8 @@ GMPDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) return nullptr; } - RefPtr wrapper = CreateDecoderWrapper(aParams.mCallback); - auto params = GMPVideoDecoderParams(aParams).WithCallback(wrapper); + RefPtr wrapper = CreateDecoderWrapper(); + auto params = GMPVideoDecoderParams(aParams); wrapper->SetProxyTarget(new GMPVideoDecoder(params)); return wrapper.forget(); } diff --git a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp index 7c4deac2077c..71990c2097e6 100644 --- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp +++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp @@ -27,8 +27,17 @@ static bool IsOnGMPThread() } #endif +GMPVideoDecoderParams::GMPVideoDecoderParams(const CreateDecoderParams& aParams) + : mConfig(aParams.VideoConfig()) + , mTaskQueue(aParams.mTaskQueue) + , mImageContainer(aParams.mImageContainer) + , mLayersBackend(aParams.GetLayersBackend()) + , mCrashHelper(aParams.mCrashHelper) +{ +} + void -VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame) +GMPVideoDecoder::Decoded(GMPVideoi420Frame* aDecodedFrame) { GMPUniquePtr decodedFrame(aDecodedFrame); @@ -51,7 +60,7 @@ VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame) gfx::IntRect pictureRegion(0, 0, decodedFrame->Width(), decodedFrame->Height()); RefPtr v = - VideoData::CreateAndCopyData(mVideoInfo, + VideoData::CreateAndCopyData(mConfig, mImageContainer, mLastStreamOffset, decodedFrame->Timestamp(), @@ -60,110 +69,80 @@ VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame) false, -1, pictureRegion); + RefPtr self = this; if (v) { - mCallback->Output(v); + mDecodedData.AppendElement(Move(v)); } else { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__)); + mDecodedData.Clear(); + mDecodePromise.RejectIfExists( + MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("CallBack::CreateAndCopyData")), + __func__); } } void -VideoCallbackAdapter::ReceivedDecodedReferenceFrame(const uint64_t aPictureId) +GMPVideoDecoder::ReceivedDecodedReferenceFrame(const uint64_t aPictureId) { MOZ_ASSERT(IsOnGMPThread()); } void -VideoCallbackAdapter::ReceivedDecodedFrame(const uint64_t aPictureId) +GMPVideoDecoder::ReceivedDecodedFrame(const uint64_t aPictureId) { MOZ_ASSERT(IsOnGMPThread()); } void -VideoCallbackAdapter::InputDataExhausted() +GMPVideoDecoder::InputDataExhausted() { MOZ_ASSERT(IsOnGMPThread()); - mCallback->InputExhausted(); + mDecodePromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); } void -VideoCallbackAdapter::DrainComplete() +GMPVideoDecoder::DrainComplete() { MOZ_ASSERT(IsOnGMPThread()); - mCallback->DrainComplete(); + mDrainPromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); } void -VideoCallbackAdapter::ResetComplete() +GMPVideoDecoder::ResetComplete() { MOZ_ASSERT(IsOnGMPThread()); - mCallback->FlushComplete(); + mFlushPromise.ResolveIfExists(true, __func__); } void -VideoCallbackAdapter::Error(GMPErr aErr) +GMPVideoDecoder::Error(GMPErr aErr) { MOZ_ASSERT(IsOnGMPThread()); - mCallback->Error(MediaResult(aErr == GMPDecodeErr - ? NS_ERROR_DOM_MEDIA_DECODE_ERR - : NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("GMPErr:%x", aErr))); + auto error = MediaResult(aErr == GMPDecodeErr ? NS_ERROR_DOM_MEDIA_DECODE_ERR + : NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("GMPErr:%x", aErr)); + mDecodePromise.RejectIfExists(error, __func__); + mDrainPromise.RejectIfExists(error, __func__); + mFlushPromise.RejectIfExists(error, __func__); } void -VideoCallbackAdapter::Terminated() +GMPVideoDecoder::Terminated() { - // Note that this *may* be called from the proxy thread also. - mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Video GMP decoder terminated."))); -} - -GMPVideoDecoderParams::GMPVideoDecoderParams(const CreateDecoderParams& aParams) - : mConfig(aParams.VideoConfig()) - , mTaskQueue(aParams.mTaskQueue) - , mCallback(nullptr) - , mAdapter(nullptr) - , mImageContainer(aParams.mImageContainer) - , mLayersBackend(aParams.GetLayersBackend()) - , mCrashHelper(aParams.mCrashHelper) -{} - -GMPVideoDecoderParams& -GMPVideoDecoderParams::WithCallback(MediaDataDecoderProxy* aWrapper) -{ - MOZ_ASSERT(aWrapper); - MOZ_ASSERT(!mCallback); // Should only be called once per instance. - mCallback = aWrapper->Callback(); - mAdapter = nullptr; - return *this; -} - -GMPVideoDecoderParams& -GMPVideoDecoderParams::WithAdapter(VideoCallbackAdapter* aAdapter) -{ - MOZ_ASSERT(aAdapter); - MOZ_ASSERT(!mAdapter); // Should only be called once per instance. - mCallback = aAdapter->Callback(); - mAdapter = aAdapter; - return *this; + MOZ_ASSERT(IsOnGMPThread()); + Error(GMPErr::GMPAbortedErr); } GMPVideoDecoder::GMPVideoDecoder(const GMPVideoDecoderParams& aParams) : mConfig(aParams.mConfig) - , mCallback(aParams.mCallback) , mGMP(nullptr) , mHost(nullptr) - , mAdapter(aParams.mAdapter) , mConvertNALUnitLengths(false) , mCrashHelper(aParams.mCrashHelper) + , mImageContainer(aParams.mImageContainer) { - MOZ_ASSERT(!mAdapter || mCallback == mAdapter->Callback()); - if (!mAdapter) { - mAdapter = new VideoCallbackAdapter(mCallback, - VideoInfo(mConfig.mDisplay.width, - mConfig.mDisplay.height), - aParams.mImageContainer); - } } void @@ -190,16 +169,12 @@ GMPVideoDecoder::CreateFrame(MediaRawData* aSample) GMPVideoFrame* ftmp = nullptr; GMPErr err = mHost->CreateFrame(kGMPEncodedVideoFrame, &ftmp); if (GMP_FAILED(err)) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("Host::CreateFrame:%x", err))); return nullptr; } GMPUniquePtr frame(static_cast(ftmp)); err = frame->CreateEmptyFrame(aSample->Size()); if (GMP_FAILED(err)) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("GMPVideoEncodedFrame::CreateEmptyFrame:%x", err))); return nullptr; } @@ -278,7 +253,7 @@ GMPVideoDecoder::GMPInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost) nsresult rv = aGMP->InitDecode(codec, codecSpecific, - mAdapter, + this, PR_GetNumberOfProcessors()); if (NS_FAILED(rv)) { aGMP->Close(); @@ -326,66 +301,85 @@ GMPVideoDecoder::Init() return promise; } -void -GMPVideoDecoder::Input(MediaRawData* aSample) +RefPtr +GMPVideoDecoder::Decode(MediaRawData* aSample) { MOZ_ASSERT(IsOnGMPThread()); RefPtr sample(aSample); if (!mGMP) { - mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("mGMP not initialized"))); - return; + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("mGMP not initialized")), + __func__); } - mAdapter->SetLastStreamOffset(sample->mOffset); + mLastStreamOffset = sample->mOffset; GMPUniquePtr frame = CreateFrame(sample); if (!frame) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("CreateFrame returned null"))); - return; + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("CreateFrame returned null")), + __func__); } + RefPtr p = mDecodePromise.Ensure(__func__); nsTArray info; // No codec specific per-frame info to pass. nsresult rv = mGMP->Decode(Move(frame), false, info, 0); if (NS_FAILED(rv)) { - mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("mGMP->Decode:%x", rv))); + mDecodePromise.Reject(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("mGMP->Decode:%x", rv)), + __func__); } + return p; } -void +RefPtr GMPVideoDecoder::Flush() { MOZ_ASSERT(IsOnGMPThread()); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + + RefPtr p = mFlushPromise.Ensure(__func__); if (!mGMP || NS_FAILED(mGMP->Reset())) { // Abort the flush. - mCallback->FlushComplete(); + mFlushPromise.Resolve(true, __func__); } + return p; } -void +RefPtr GMPVideoDecoder::Drain() { MOZ_ASSERT(IsOnGMPThread()); + MOZ_ASSERT(mDecodePromise.IsEmpty(), "Must wait for decoding to complete"); + + RefPtr p = mDrainPromise.Ensure(__func__); if (!mGMP || NS_FAILED(mGMP->Drain())) { - mCallback->DrainComplete(); + mDrainPromise.Resolve(DecodedData(), __func__); } + + return p; } -void +RefPtr GMPVideoDecoder::Shutdown() { mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + mFlushPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + // Note that this *may* be called from the proxy thread also. + // TODO: If that's the case, then this code is racy. if (!mGMP) { - return; + return ShutdownPromise::CreateAndResolve(true, __func__); } // Note this unblocks flush and drain operations waiting for callbacks. mGMP->Close(); mGMP = nullptr; + return ShutdownPromise::CreateAndResolve(true, __func__); } } // namespace mozilla diff --git a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h index 900ef4553a35..f7633f21079f 100644 --- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h +++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h @@ -16,20 +16,35 @@ namespace mozilla { -class VideoCallbackAdapter : public GMPVideoDecoderCallbackProxy { -public: - VideoCallbackAdapter(MediaDataDecoderCallbackProxy* aCallback, - VideoInfo aVideoInfo, - layers::ImageContainer* aImageContainer) - : mCallback(aCallback) - , mLastStreamOffset(0) - , mVideoInfo(aVideoInfo) - , mImageContainer(aImageContainer) - {} +struct GMPVideoDecoderParams +{ + explicit GMPVideoDecoderParams(const CreateDecoderParams& aParams); - MediaDataDecoderCallbackProxy* Callback() const { return mCallback; } + const VideoInfo& mConfig; + TaskQueue* mTaskQueue; + layers::ImageContainer* mImageContainer; + layers::LayersBackend mLayersBackend; + RefPtr mCrashHelper; +}; + +class GMPVideoDecoder : public MediaDataDecoder, + public GMPVideoDecoderCallbackProxy +{ +public: + explicit GMPVideoDecoder(const GMPVideoDecoderParams& aParams); + + RefPtr Init() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; + const char* GetDescriptionName() const override + { + return "GMP video decoder"; + } // GMPVideoDecoderCallbackProxy + // All those methods are called on the GMP thread. void Decoded(GMPVideoi420Frame* aDecodedFrame) override; void ReceivedDecodedReferenceFrame(const uint64_t aPictureId) override; void ReceivedDecodedFrame(const uint64_t aPictureId) override; @@ -39,46 +54,6 @@ public: void Error(GMPErr aErr) override; void Terminated() override; - void SetLastStreamOffset(int64_t aStreamOffset) { - mLastStreamOffset = aStreamOffset; - } - -private: - MediaDataDecoderCallbackProxy* mCallback; - int64_t mLastStreamOffset; - - VideoInfo mVideoInfo; - RefPtr mImageContainer; -}; - -struct GMPVideoDecoderParams { - explicit GMPVideoDecoderParams(const CreateDecoderParams& aParams); - GMPVideoDecoderParams& WithCallback(MediaDataDecoderProxy* aWrapper); - GMPVideoDecoderParams& WithAdapter(VideoCallbackAdapter* aAdapter); - - const VideoInfo& mConfig; - TaskQueue* mTaskQueue; - MediaDataDecoderCallbackProxy* mCallback; - VideoCallbackAdapter* mAdapter; - layers::ImageContainer* mImageContainer; - layers::LayersBackend mLayersBackend; - RefPtr mCrashHelper; -}; - -class GMPVideoDecoder : public MediaDataDecoder { -public: - explicit GMPVideoDecoder(const GMPVideoDecoderParams& aParams); - - RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; - const char* GetDescriptionName() const override - { - return "GMP video decoder"; - } - protected: virtual void InitTags(nsTArray& aTags); virtual nsCString GetNodeId(); @@ -107,14 +82,20 @@ private: void GMPInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost); const VideoInfo mConfig; - MediaDataDecoderCallbackProxy* mCallback; nsCOMPtr mMPS; GMPVideoDecoderProxy* mGMP; GMPVideoHost* mHost; - nsAutoPtr mAdapter; bool mConvertNALUnitLengths; MozPromiseHolder mInitPromise; RefPtr mCrashHelper; + + int64_t mLastStreamOffset = 0; + RefPtr mImageContainer; + + MozPromiseHolder mDecodePromise; + MozPromiseHolder mDrainPromise; + MozPromiseHolder mFlushPromise; + DecodedData mDecodedData; }; } // namespace mozilla diff --git a/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.cpp b/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.cpp index 98fccaa00307..560a67479918 100644 --- a/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.cpp +++ b/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.cpp @@ -6,85 +6,68 @@ #include "MediaDataDecoderProxy.h" #include "MediaData.h" +#include "mozilla/SyncRunnable.h" namespace mozilla { -void -MediaDataDecoderCallbackProxy::Error(const MediaResult& aError) -{ - mProxyCallback->Error(aError); -} - -void -MediaDataDecoderCallbackProxy::FlushComplete() -{ - mProxyDecoder->FlushComplete(); -} - -RefPtr -MediaDataDecoderProxy::InternalInit() -{ - return mProxyDecoder->Init(); -} - RefPtr MediaDataDecoderProxy::Init() { MOZ_ASSERT(!mIsShutdown); - return InvokeAsync(mProxyThread, this, __func__, - &MediaDataDecoderProxy::InternalInit); + RefPtr self = this; + return InvokeAsync(mProxyThread, __func__, + [self, this]() { return mProxyDecoder->Init(); }); } -void -MediaDataDecoderProxy::Input(MediaRawData* aSample) +RefPtr +MediaDataDecoderProxy::Decode(MediaRawData* aSample) { MOZ_ASSERT(!IsOnProxyThread()); MOZ_ASSERT(!mIsShutdown); - nsCOMPtr task(new InputTask(mProxyDecoder, aSample)); - mProxyThread->Dispatch(task.forget()); + RefPtr self = this; + RefPtr sample = aSample; + return InvokeAsync(mProxyThread, __func__, [self, this, sample]() { + return mProxyDecoder->Decode(sample); + }); } -void +RefPtr MediaDataDecoderProxy::Flush() { MOZ_ASSERT(!IsOnProxyThread()); MOZ_ASSERT(!mIsShutdown); - mFlushComplete.Set(false); - - mProxyThread->Dispatch(NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Flush)); - - mFlushComplete.WaitUntil(true); + RefPtr self = this; + return InvokeAsync(mProxyThread, __func__, + [self, this]() { return mProxyDecoder->Flush(); }); } -void +RefPtr MediaDataDecoderProxy::Drain() { MOZ_ASSERT(!IsOnProxyThread()); MOZ_ASSERT(!mIsShutdown); - mProxyThread->Dispatch(NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Drain)); + RefPtr self = this; + return InvokeAsync(mProxyThread, __func__, + [self, this]() { return mProxyDecoder->Drain(); }); } -void +RefPtr MediaDataDecoderProxy::Shutdown() { + MOZ_ASSERT(!IsOnProxyThread()); // Note that this *may* be called from the proxy thread also. MOZ_ASSERT(!mIsShutdown); #if defined(DEBUG) mIsShutdown = true; #endif - mProxyThread->AsEventTarget()->Dispatch(NewRunnableMethod(mProxyDecoder, - &MediaDataDecoder::Shutdown), - NS_DISPATCH_SYNC); -} -void -MediaDataDecoderProxy::FlushComplete() -{ - mFlushComplete.Set(true); + RefPtr self = this; + return InvokeAsync(mProxyThread, __func__, + [self, this]() { return mProxyDecoder->Shutdown(); }); } } // namespace mozilla diff --git a/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h b/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h index 1e108994da4e..0c09240c87d7 100644 --- a/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h +++ b/dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h @@ -8,6 +8,7 @@ #define MediaDataDecoderProxy_h_ #include "PlatformDecoderModule.h" +#include "mozilla/Atomics.h" #include "mozilla/RefPtr.h" #include "nsThreadUtils.h" #include "nscore.h" @@ -15,115 +16,17 @@ namespace mozilla { -class InputTask : public Runnable { +class MediaDataDecoderProxy : public MediaDataDecoder +{ public: - InputTask(MediaDataDecoder* aDecoder, - MediaRawData* aSample) - : mDecoder(aDecoder) - , mSample(aSample) - {} - - NS_IMETHOD Run() override { - mDecoder->Input(mSample); - return NS_OK; - } - -private: - RefPtr mDecoder; - RefPtr mSample; -}; - -template -class Condition { -public: - explicit Condition(T aValue) - : mMonitor("Condition") - , mCondition(aValue) - {} - - void Set(T aValue) { - MonitorAutoLock mon(mMonitor); - mCondition = aValue; - mon.NotifyAll(); - } - - void WaitUntil(T aValue) { - MonitorAutoLock mon(mMonitor); - while (mCondition != aValue) { - mon.Wait(); - } - } - -private: - Monitor mMonitor; - T mCondition; -}; - -class MediaDataDecoderProxy; - -class MediaDataDecoderCallbackProxy : public MediaDataDecoderCallback { -public: - MediaDataDecoderCallbackProxy(MediaDataDecoderProxy* aProxyDecoder, - MediaDataDecoderCallback* aCallback) - : mProxyDecoder(aProxyDecoder) - , mProxyCallback(aCallback) - { - } - - void Output(MediaData* aData) override { - mProxyCallback->Output(aData); - } - - void Error(const MediaResult& aError) override; - - void InputExhausted() override { - mProxyCallback->InputExhausted(); - } - - void DrainComplete() override { - mProxyCallback->DrainComplete(); - } - - void ReleaseMediaResources() override { - mProxyCallback->ReleaseMediaResources(); - } - - void FlushComplete(); - - bool OnReaderTaskQueue() override - { - return mProxyCallback->OnReaderTaskQueue(); - } - -private: - MediaDataDecoderProxy* mProxyDecoder; - MediaDataDecoderCallback* mProxyCallback; -}; - -class MediaDataDecoderProxy : public MediaDataDecoder { -public: - MediaDataDecoderProxy(already_AddRefed aProxyThread, - MediaDataDecoderCallback* aCallback) + explicit MediaDataDecoderProxy(already_AddRefed aProxyThread) : mProxyThread(aProxyThread) - , mProxyCallback(this, aCallback) - , mFlushComplete(false) #if defined(DEBUG) , mIsShutdown(false) #endif { } - // Ideally, this would return a regular MediaDataDecoderCallback pointer - // to retain the clean abstraction, but until MediaDataDecoderCallback - // supports the FlushComplete interface, this will have to do. When MDDC - // supports FlushComplete, this, the GMP*Decoders, and the - // *CallbackAdapters can be reverted to accepting a regular - // MediaDataDecoderCallback pointer. - MediaDataDecoderCallbackProxy* Callback() - { - return &mProxyCallback; - } - void SetProxyTarget(MediaDataDecoder* aProxyDecoder) { MOZ_ASSERT(aProxyDecoder); @@ -131,43 +34,33 @@ public: } // These are called from the decoder thread pool. - // Init and Shutdown run synchronously on the proxy thread, all others are - // asynchronously and responded to via the MediaDataDecoderCallback. - // Note: the nsresults returned by the proxied decoder are lost. + // Shutdown run synchronously on the proxy thread, all others are + // asynchronous. RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { return "GMP proxy data decoder"; } - // Called by MediaDataDecoderCallbackProxy. - void FlushComplete(); - private: - RefPtr InternalInit(); #ifdef DEBUG - bool IsOnProxyThread() { + bool IsOnProxyThread() + { return mProxyThread && mProxyThread->IsCurrentThreadIn(); } #endif - friend class InputTask; - friend class InitTask; - RefPtr mProxyDecoder; RefPtr mProxyThread; - MediaDataDecoderCallbackProxy mProxyCallback; - - Condition mFlushComplete; #if defined(DEBUG) - bool mIsShutdown; + Atomic mIsShutdown; #endif }; diff --git a/dom/media/platforms/android/AndroidDecoderModule.cpp b/dom/media/platforms/android/AndroidDecoderModule.cpp index ef4313a0c90f..6cbf17f8edd7 100644 --- a/dom/media/platforms/android/AndroidDecoderModule.cpp +++ b/dom/media/platforms/android/AndroidDecoderModule.cpp @@ -53,7 +53,8 @@ GetFeatureStatus(int32_t aFeature) nsCOMPtr gfxInfo = services::GetGfxInfo(); int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; nsCString discardFailureId; - if (!gfxInfo || NS_FAILED(gfxInfo->GetFeatureStatus(aFeature, discardFailureId, &status))) { + if (!gfxInfo || NS_FAILED(gfxInfo->GetFeatureStatus( + aFeature, discardFailureId, &status))) { return false; } return status == nsIGfxInfo::FEATURE_STATUS_OK; @@ -72,8 +73,8 @@ GetCryptoInfoFromSample(const MediaRawData* aSample) nsresult rv = CryptoInfo::New(&cryptoInfo); NS_ENSURE_SUCCESS(rv, nullptr); - uint32_t numSubSamples = - std::min(cryptoObj.mPlainSizes.Length(), cryptoObj.mEncryptedSizes.Length()); + uint32_t numSubSamples = std::min( + cryptoObj.mPlainSizes.Length(), cryptoObj.mEncryptedSizes.Length()); uint32_t totalSubSamplesSize = 0; for (auto& size : cryptoObj.mEncryptedSizes) { @@ -105,19 +106,16 @@ GetCryptoInfoFromSample(const MediaRawData* aSample) reinterpret_cast(&plainSizes[0]), plainSizes.Length()); - auto numBytesOfEncryptedData = - mozilla::jni::IntArray::New(reinterpret_cast(&cryptoObj.mEncryptedSizes[0]), - cryptoObj.mEncryptedSizes.Length()); + auto numBytesOfEncryptedData = mozilla::jni::IntArray::New( + reinterpret_cast(&cryptoObj.mEncryptedSizes[0]), + cryptoObj.mEncryptedSizes.Length()); auto iv = mozilla::jni::ByteArray::New(reinterpret_cast(&tempIV[0]), - tempIV.Length()); - auto keyId = mozilla::jni::ByteArray::New(reinterpret_cast(&cryptoObj.mKeyId[0]), - cryptoObj.mKeyId.Length()); - cryptoInfo->Set(numSubSamples, - numBytesOfPlainData, - numBytesOfEncryptedData, - keyId, - iv, - MediaCodec::CRYPTO_MODE_AES_CTR); + tempIV.Length()); + auto keyId = mozilla::jni::ByteArray::New( + reinterpret_cast(&cryptoObj.mKeyId[0]), + cryptoObj.mKeyId.Length()); + cryptoInfo->Set(numSubSamples, numBytesOfPlainData, numBytesOfEncryptedData, + keyId, iv, MediaCodec::CRYPTO_MODE_AES_CTR); return cryptoInfo; } @@ -168,7 +166,7 @@ AndroidDecoderModule::SupportsMimeType(const nsACString& aMimeType, } return java::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType( - nsCString(TranslateMimeType(aMimeType))); + nsCString(TranslateMimeType(aMimeType))); } already_AddRefed @@ -195,21 +193,13 @@ AndroidDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) drmStubId = mProxy->GetMediaDrmStubId(); } - RefPtr decoder = MediaPrefs::PDMAndroidRemoteCodecEnabled() ? - RemoteDataDecoder::CreateVideoDecoder(config, - format, - aParams.mCallback, - aParams.mImageContainer, - drmStubId, - mProxy, - aParams.mTaskQueue) : - MediaCodecDataDecoder::CreateVideoDecoder(config, - format, - aParams.mCallback, - aParams.mImageContainer, - drmStubId, - mProxy, - aParams.mTaskQueue); + RefPtr decoder = + MediaPrefs::PDMAndroidRemoteCodecEnabled() + ? RemoteDataDecoder::CreateVideoDecoder( + config, format, aParams.mImageContainer, drmStubId, mProxy, + aParams.mTaskQueue) + : MediaCodecDataDecoder::CreateVideoDecoder( + config, format, aParams.mImageContainer, drmStubId, mProxy); return decoder.forget(); } @@ -237,19 +227,12 @@ AndroidDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) if (mProxy) { drmStubId = mProxy->GetMediaDrmStubId(); } - RefPtr decoder = MediaPrefs::PDMAndroidRemoteCodecEnabled() ? - RemoteDataDecoder::CreateAudioDecoder(config, - format, - aParams.mCallback, - drmStubId, - mProxy, - aParams.mTaskQueue) : - MediaCodecDataDecoder::CreateAudioDecoder(config, - format, - aParams.mCallback, - drmStubId, - mProxy, - aParams.mTaskQueue); + RefPtr decoder = + MediaPrefs::PDMAndroidRemoteCodecEnabled() + ? RemoteDataDecoder::CreateAudioDecoder(config, format, drmStubId, mProxy, + aParams.mTaskQueue) + : MediaCodecDataDecoder::CreateAudioDecoder(config, format, drmStubId, + mProxy); return decoder.forget(); } diff --git a/dom/media/platforms/android/AndroidDecoderModule.h b/dom/media/platforms/android/AndroidDecoderModule.h index 9ae44e06fd9f..ae4320bb4844 100644 --- a/dom/media/platforms/android/AndroidDecoderModule.h +++ b/dom/media/platforms/android/AndroidDecoderModule.h @@ -10,7 +10,8 @@ namespace mozilla { -class AndroidDecoderModule : public PlatformDecoderModule { +class AndroidDecoderModule : public PlatformDecoderModule +{ public: already_AddRefed CreateVideoDecoder(const CreateDecoderParams& aParams) override; diff --git a/dom/media/platforms/android/MediaCodecDataDecoder.cpp b/dom/media/platforms/android/MediaCodecDataDecoder.cpp index a671abfd55fc..a6ad8bdaaacf 100644 --- a/dom/media/platforms/android/MediaCodecDataDecoder.cpp +++ b/dom/media/platforms/android/MediaCodecDataDecoder.cpp @@ -34,13 +34,6 @@ using media::TimeUnit; namespace mozilla { -#define INVOKE_CALLBACK(Func, ...) \ - if (mCallback) { \ - mCallback->Func(__VA_ARGS__); \ - } else { \ - NS_WARNING("Callback not set"); \ - } - static MediaCodec::LocalRef CreateDecoder(const nsACString& aMimeType) { @@ -55,11 +48,10 @@ class VideoDataDecoder : public MediaCodecDataDecoder public: VideoDataDecoder(const VideoInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer, const nsString& aDrmStubId) : MediaCodecDataDecoder(MediaData::Type::VIDEO_DATA, aConfig.mMimeType, - aFormat, aCallback, aDrmStubId) + aFormat, aDrmStubId) , mImageContainer(aImageContainer) , mConfig(aConfig) { @@ -119,11 +111,18 @@ public: gfx::IntRect(0, 0, mConfig.mDisplay.width, mConfig.mDisplay.height)); - INVOKE_CALLBACK(Output, v); + if (!v) { + return NS_ERROR_OUT_OF_MEMORY; + } + MonitorAutoLock mon(mMonitor); + mDecodedData.AppendElement(Move(v)); return NS_OK; } - bool SupportDecoderRecycling() const override { return mIsCodecSupportAdaptivePlayback; } + bool SupportDecoderRecycling() const override + { + return mIsCodecSupportAdaptivePlayback; + } protected: layers::ImageContainer* mImageContainer; @@ -131,56 +130,13 @@ protected: RefPtr mSurfaceTexture; }; - - -class EMEVideoDataDecoder : public VideoDataDecoder { -public: - EMEVideoDataDecoder(const VideoInfo& aConfig, - MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - layers::ImageContainer* aImageContainer, - const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue) - : VideoDataDecoder(aConfig, aFormat, aCallback, aImageContainer, aDrmStubId) - , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aCallback, - aTaskQueue, aProxy)) - { - } - - void Input(MediaRawData* aSample) override; - void Shutdown() override; - -private: - RefPtr mSamplesWaitingForKey; -}; - -void -EMEVideoDataDecoder::Input(MediaRawData* aSample) -{ - if (mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)) { - return; - } - VideoDataDecoder::Input(aSample); -} - -void -EMEVideoDataDecoder::Shutdown() -{ - VideoDataDecoder::Shutdown(); - - mSamplesWaitingForKey->BreakCycles(); - mSamplesWaitingForKey = nullptr; -} - class AudioDataDecoder : public MediaCodecDataDecoder { public: AudioDataDecoder(const AudioInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, const nsString& aDrmStubId) : MediaCodecDataDecoder(MediaData::Type::AUDIO_DATA, aConfig.mMimeType, - aFormat, aCallback, aDrmStubId) + aFormat, aDrmStubId) { JNIEnv* const env = jni::GetEnvForThread(); @@ -203,7 +159,7 @@ public: } nsresult Output(BufferInfo::Param aInfo, void* aBuffer, - MediaFormat::Param aFormat, const TimeUnit& aDuration) + MediaFormat::Param aFormat, const TimeUnit& aDuration) override { // The output on Android is always 16-bit signed nsresult rv; @@ -250,104 +206,59 @@ public: Move(audio), numChannels, sampleRate); - INVOKE_CALLBACK(Output, data); + MonitorAutoLock mon(mMonitor); + mDecodedData.AppendElement(Move(data)); return NS_OK; } }; -class EMEAudioDataDecoder : public AudioDataDecoder { -public: - EMEAudioDataDecoder(const AudioInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, const nsString& aDrmStubId, - CDMProxy* aProxy, TaskQueue* aTaskQueue) - : AudioDataDecoder(aConfig, aFormat, aCallback, aDrmStubId) - , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aCallback, - aTaskQueue, aProxy)) - { - } - - void Input(MediaRawData* aSample) override; - void Shutdown() override; - -private: - RefPtr mSamplesWaitingForKey; -}; - -void -EMEAudioDataDecoder::Input(MediaRawData* aSample) -{ - if (mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)) { - return; - } - AudioDataDecoder::Input(aSample); -} - -void -EMEAudioDataDecoder::Shutdown() -{ - AudioDataDecoder::Shutdown(); - - mSamplesWaitingForKey->BreakCycles(); - mSamplesWaitingForKey = nullptr; -} - -MediaDataDecoder* +already_AddRefed MediaCodecDataDecoder::CreateAudioDecoder(const AudioInfo& aConfig, java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue) + CDMProxy* aProxy) { + RefPtr decoder; if (!aProxy) { - return new AudioDataDecoder(aConfig, aFormat, aCallback, aDrmStubId); + decoder = new AudioDataDecoder(aConfig, aFormat, aDrmStubId); } else { - return new EMEAudioDataDecoder(aConfig, - aFormat, - aCallback, - aDrmStubId, - aProxy, - aTaskQueue); + // TODO in bug 1334061. } + return decoder.forget(); } -MediaDataDecoder* +already_AddRefed MediaCodecDataDecoder::CreateVideoDecoder(const VideoInfo& aConfig, java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer, const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue) + CDMProxy* aProxy) { + RefPtr decoder; if (!aProxy) { - return new VideoDataDecoder(aConfig, aFormat, aCallback, aImageContainer, aDrmStubId); + decoder = new VideoDataDecoder(aConfig, aFormat, aImageContainer, aDrmStubId); } else { - return new EMEVideoDataDecoder(aConfig, - aFormat, - aCallback, - aImageContainer, - aDrmStubId, - aProxy, - aTaskQueue); + // TODO in bug 1334061. } + return decoder.forget(); } MediaCodecDataDecoder::MediaCodecDataDecoder(MediaData::Type aType, const nsACString& aMimeType, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, const nsString& aDrmStubId) : mType(aType) , mMimeType(aMimeType) , mFormat(aFormat) - , mCallback(aCallback) , mInputBuffers(nullptr) , mOutputBuffers(nullptr) + , mError(false) , mMonitor("MediaCodecDataDecoder::mMonitor") , mState(ModuleState::kDecoding) , mDrmStubId(aDrmStubId) { + mDecodePromise.SetMonitor(&mMonitor); + mDrainPromise.SetMonitor(&mMonitor); } MediaCodecDataDecoder::~MediaCodecDataDecoder() @@ -364,10 +275,9 @@ MediaCodecDataDecoder::Init() (mType == MediaData::AUDIO_DATA ? TrackInfo::TrackType::kAudioTrack : TrackInfo::TrackType::kVideoTrack); - return NS_SUCCEEDED(rv) ? - InitPromise::CreateAndResolve(type, __func__) : - InitPromise::CreateAndReject( - NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + return NS_SUCCEEDED(rv) ? InitPromise::CreateAndResolve(type, __func__) + : InitPromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); } nsresult @@ -376,8 +286,6 @@ MediaCodecDataDecoder::InitDecoder(Surface::Param aSurface) mDecoder = CreateDecoder(mMimeType); if (!mDecoder) { - INVOKE_CALLBACK(Error, - MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__)); return NS_ERROR_FAILURE; } @@ -395,7 +303,8 @@ MediaCodecDataDecoder::InitDecoder(Surface::Param aSurface) MediaCrypto::LocalRef crypto = MediaDrmProxy::GetMediaCrypto(mDrmStubId); bool hascrypto = !!crypto; - LOG("Has(%d) MediaCrypto (%s)", hascrypto, NS_ConvertUTF16toUTF8(mDrmStubId).get()); + LOG("Has(%d) MediaCrypto (%s)", hascrypto, + NS_ConvertUTF16toUTF8(mDrmStubId).get()); nsresult rv; NS_ENSURE_SUCCESS(rv = mDecoder->Configure(mFormat, aSurface, crypto, 0), rv); NS_ENSURE_SUCCESS(rv = mDecoder->Start(), rv); @@ -403,7 +312,8 @@ MediaCodecDataDecoder::InitDecoder(Surface::Param aSurface) NS_ENSURE_SUCCESS(rv = ResetInputBuffers(), rv); NS_ENSURE_SUCCESS(rv = ResetOutputBuffers(), rv); - nsCOMPtr r = NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop); + nsCOMPtr r = + NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop); rv = NS_NewNamedThread("MC Decoder", getter_AddRefs(mThread), r); return rv; @@ -412,15 +322,36 @@ MediaCodecDataDecoder::InitDecoder(Surface::Param aSurface) // This is in usec, so that's 10ms. static const int64_t kDecoderTimeout = 10000; -#define BREAK_ON_DECODER_ERROR() \ - if (NS_FAILED(res)) { \ - NS_WARNING("Exiting decoder loop due to exception"); \ - if (mState == ModuleState::kDrainDecoder) { \ - INVOKE_CALLBACK(DrainComplete); \ - SetState(ModuleState::kDecoding); \ - } \ - INVOKE_CALLBACK(Error, MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__)); \ - break; \ +#define BREAK_ON_DECODER_ERROR_LOCKED() \ + if (NS_FAILED(res)) { \ + mError = true; \ + mMonitor.AssertCurrentThreadOwns(); \ + NS_WARNING("Exiting decoder loop due to exception"); \ + if (mState == ModuleState::kDrainDecoder) { \ + mDrainPromise.RejectIfExists( \ + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__), __func__); \ + SetState(ModuleState::kDecoding); \ + break; \ + } \ + mDecodePromise.RejectIfExists( \ + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__), __func__); \ + break; \ + } + +#define BREAK_ON_DECODER_ERROR() \ + if (NS_FAILED(res)) { \ + mError = true; \ + MonitorAutoLock mon(mMonitor); \ + NS_WARNING("Exiting decoder loop due to exception"); \ + if (mState == ModuleState::kDrainDecoder) { \ + mDrainPromise.RejectIfExists( \ + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__), __func__); \ + SetState(ModuleState::kDecoding); \ + break; \ + } \ + mDecodePromise.RejectIfExists( \ + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__), __func__); \ + break; \ } nsresult @@ -451,9 +382,10 @@ MediaCodecDataDecoder::WaitForInput() { MonitorAutoLock lock(mMonitor); - while (mState == ModuleState::kDecoding && mQueue.empty()) { - // Signal that we require more input. - INVOKE_CALLBACK(InputExhausted); + while (mState == ModuleState::kDecoding && mQueue.empty()) { + // We're done processing the current sample. + mDecodePromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); lock.Wait(); } @@ -562,9 +494,10 @@ MediaCodecDataDecoder::HandleEOS(int32_t aOutputStatus) if (mState == ModuleState::kDrainWaitEOS) { SetState(ModuleState::kDecoding); - mMonitor.Notify(); - INVOKE_CALLBACK(DrainComplete); + mDrainPromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); + mMonitor.Notify(); } mDecoder->ReleaseOutputBuffer(aOutputStatus, false); @@ -606,9 +539,7 @@ MediaCodecDataDecoder::ProcessOutput( // The Surface will be updated at this point (for video). mDecoder->ReleaseOutputBuffer(aStatus, true); - PostOutput(aInfo, aFormat, duration.value()); - - return NS_OK; + return PostOutput(aInfo, aFormat, duration.value()); } void @@ -627,7 +558,7 @@ MediaCodecDataDecoder::DecoderLoop() if (mState == ModuleState::kDrainDecoder) { MOZ_ASSERT(!sample, "Shouldn't have a sample when pushing EOF frame"); res = QueueEOS(); - BREAK_ON_DECODER_ERROR(); + BREAK_ON_DECODER_ERROR_LOCKED(); } } @@ -656,8 +587,6 @@ MediaCodecDataDecoder::DecoderLoop() BREAK_ON_DECODER_ERROR(); if (outputStatus == MediaCodec::INFO_TRY_AGAIN_LATER) { - // We might want to call mCallback->InputExhausted() here, but there seems - // to be some possible bad interactions here with the threading. } else if (outputStatus == MediaCodec::INFO_OUTPUT_BUFFERS_CHANGED) { res = ResetOutputBuffers(); BREAK_ON_DECODER_ERROR(); @@ -666,9 +595,13 @@ MediaCodecDataDecoder::DecoderLoop() BREAK_ON_DECODER_ERROR(); } else if (outputStatus < 0) { NS_WARNING("Unknown error from decoder!"); - INVOKE_CALLBACK(Error, - MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - __func__)); + { + const auto result = + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, __func__); + MonitorAutoLock mon(mMonitor); + mDecodePromise.RejectIfExists(result, __func__); + mDrainPromise.RejectIfExists(result, __func__); + } // Don't break here just in case it's recoverable. If it's not, other // stuff will fail later and we'll bail out. } else { @@ -715,6 +648,8 @@ MediaCodecDataDecoder::ModuleStateStr(ModuleState aState) { bool MediaCodecDataDecoder::SetState(ModuleState aState) { + mMonitor.AssertCurrentThreadOwns(); + bool ok = true; if (mState == ModuleState::kShutdown) { @@ -744,14 +679,21 @@ MediaCodecDataDecoder::ClearQueue() mQueue.clear(); mDurations.clear(); + mDecodedData.Clear(); } -void -MediaCodecDataDecoder::Input(MediaRawData* aSample) +RefPtr +MediaCodecDataDecoder::Decode(MediaRawData* aSample) { + if (mError) { + return DecodePromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); + } MonitorAutoLock lock(mMonitor); + RefPtr p = mDecodePromise.Ensure(__func__); mQueue.push_back(aSample); lock.NotifyAll(); + return p; } nsresult @@ -766,35 +708,41 @@ MediaCodecDataDecoder::ResetOutputBuffers() return mDecoder->GetOutputBuffers(ReturnTo(&mOutputBuffers)); } -void +RefPtr MediaCodecDataDecoder::Flush() { MonitorAutoLock lock(mMonitor); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); if (!SetState(ModuleState::kFlushing)) { - return; + return FlushPromise::CreateAndResolve(true, __func__); } lock.Notify(); while (mState == ModuleState::kFlushing) { lock.Wait(); } + return FlushPromise::CreateAndResolve(true, __func__); } -void +RefPtr MediaCodecDataDecoder::Drain() { - MonitorAutoLock lock(mMonitor); - if (mState == ModuleState::kDrainDecoder || - mState == ModuleState::kDrainQueue) { - return; + if (mError) { + return DecodePromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); } + MonitorAutoLock lock(mMonitor); + RefPtr p = mDecodePromise.Ensure(__func__); + MOZ_ASSERT(mState != ModuleState::kDrainDecoder + && mState != ModuleState::kDrainQueue, "Already draining"); SetState(ModuleState::kDrainQueue); lock.Notify(); + return p; } - -void +RefPtr MediaCodecDataDecoder::Shutdown() { MonitorAutoLock lock(mMonitor); @@ -816,6 +764,8 @@ MediaCodecDataDecoder::Shutdown() mDecoder->Release(); mDecoder = nullptr; } + + return ShutdownPromise::CreateAndResolve(true, __func__); } } // mozilla diff --git a/dom/media/platforms/android/MediaCodecDataDecoder.h b/dom/media/platforms/android/MediaCodecDataDecoder.h index 96e51737efd5..9a957bc16294 100644 --- a/dom/media/platforms/android/MediaCodecDataDecoder.h +++ b/dom/media/platforms/android/MediaCodecDataDecoder.h @@ -10,6 +10,7 @@ #include "MediaCodec.h" #include "SurfaceTexture.h" #include "TimeUnits.h" +#include "mozilla/Atomics.h" #include "mozilla/Monitor.h" #include "mozilla/Maybe.h" @@ -19,37 +20,33 @@ namespace mozilla { typedef std::deque> SampleQueue; -class MediaCodecDataDecoder : public MediaDataDecoder { +class MediaCodecDataDecoder : public MediaDataDecoder +{ public: - static MediaDataDecoder* CreateAudioDecoder(const AudioInfo& aConfig, - java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue); + static already_AddRefed CreateAudioDecoder( + const AudioInfo& aConfig, java::sdk::MediaFormat::Param aFormat, + const nsString& aDrmStubId, CDMProxy* aProxy); - static MediaDataDecoder* CreateVideoDecoder(const VideoInfo& aConfig, - java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - layers::ImageContainer* aImageContainer, - const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue); + static already_AddRefed CreateVideoDecoder( + const VideoInfo& aConfig, java::sdk::MediaFormat::Param aFormat, + layers::ImageContainer* aImageContainer, const nsString& aDrmStubId, + CDMProxy* aProxy); - virtual ~MediaCodecDataDecoder(); + ~MediaCodecDataDecoder(); - RefPtr Init() override; - void Flush() override; - void Drain() override; - void Shutdown() override; - void Input(MediaRawData* aSample) override; + RefPtr Init() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { return "Android MediaCodec decoder"; } protected: - enum class ModuleState : uint8_t { + enum class ModuleState : uint8_t + { kDecoding = 0, kFlushing, kDrainQueue, @@ -64,7 +61,6 @@ protected: MediaCodecDataDecoder(MediaData::Type aType, const nsACString& aMimeType, java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, const nsString& aDrmStubId); static const char* ModuleStateStr(ModuleState aState); @@ -99,6 +95,7 @@ protected: java::sdk::MediaFormat::Param aFormat, int32_t aStatus); // Sets decoder state and returns whether the new state has become effective. + // Must hold the monitor. bool SetState(ModuleState aState); void DecoderLoop(); @@ -109,8 +106,6 @@ protected: nsAutoCString mMimeType; java::sdk::MediaFormat::GlobalRef mFormat; - MediaDataDecoderCallback* mCallback; - java::sdk::MediaCodec::GlobalRef mDecoder; jni::ObjectArray::GlobalRef mInputBuffers; @@ -118,6 +113,8 @@ protected: nsCOMPtr mThread; + Atomic mError; + // Only these members are protected by mMonitor. Monitor mMonitor; @@ -130,6 +127,10 @@ protected: nsString mDrmStubId; bool mIsCodecSupportAdaptivePlayback = false; + + MozPromiseHolder mDecodePromise; + MozPromiseHolder mDrainPromise; + DecodedData mDecodedData; }; } // namespace mozilla diff --git a/dom/media/platforms/android/RemoteDataDecoder.cpp b/dom/media/platforms/android/RemoteDataDecoder.cpp index 10443c320f82..f06600b3c46b 100644 --- a/dom/media/platforms/android/RemoteDataDecoder.cpp +++ b/dom/media/platforms/android/RemoteDataDecoder.cpp @@ -19,9 +19,9 @@ #include "prlog.h" +#include #include -#include #undef LOG #define LOG(arg, ...) MOZ_LOG(sAndroidDecoderModuleLog, \ @@ -43,18 +43,16 @@ public: typedef CodecProxy::NativeCallbacks::Natives Base; using Base::AttachNative; - JavaCallbacksSupport(MediaDataDecoderCallback* aDecoderCallback) - : mDecoderCallback(aDecoderCallback) - { - MOZ_ASSERT(aDecoderCallback); - } + JavaCallbacksSupport() : mCanceled(false) { } - virtual ~JavaCallbacksSupport() {} + virtual ~JavaCallbacksSupport() { } + + virtual void HandleInputExhausted() = 0; void OnInputExhausted() { - if (mDecoderCallback) { - mDecoderCallback->InputExhausted(); + if (!mCanceled) { + HandleInputExhausted(); } } @@ -62,26 +60,28 @@ public: void OnOutput(jni::Object::Param aSample) { - if (mDecoderCallback) { + if (!mCanceled) { HandleOutput(Sample::Ref::From(aSample)); } } - virtual void HandleOutputFormatChanged(MediaFormat::Param aFormat) {}; + virtual void HandleOutputFormatChanged(MediaFormat::Param aFormat) { }; void OnOutputFormatChanged(jni::Object::Param aFormat) { - if (mDecoderCallback) { + if (!mCanceled) { HandleOutputFormatChanged(MediaFormat::Ref::From(aFormat)); } } + virtual void HandleError(const MediaResult& aError) = 0; + void OnError(bool aIsFatal) { - if (mDecoderCallback) { - mDecoderCallback->Error(aIsFatal ? - MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__) : - MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, __func__)); + if (!mCanceled) { + HandleError( + aIsFatal ? MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__) + : MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, __func__)); } } @@ -92,25 +92,27 @@ public: void Cancel() { - mDecoderCallback = nullptr; + mCanceled = true; } -protected: - MediaDataDecoderCallback* mDecoderCallback; +private: + Atomic mCanceled; }; class RemoteVideoDecoder : public RemoteDataDecoder { public: - // Hold an output buffer and render it to the surface when the frame is sent to compositor, or - // release it if not presented. + // Hold an output buffer and render it to the surface when the frame is sent + // to compositor, or release it if not presented. class RenderOrReleaseOutput : public VideoData::Listener { public: - RenderOrReleaseOutput(java::CodecProxy::Param aCodec, java::Sample::Param aSample) - : mCodec(aCodec), - mSample(aSample) - {} + RenderOrReleaseOutput(java::CodecProxy::Param aCodec, + java::Sample::Param aSample) + : mCodec(aCodec) + , mSample(aSample) + { + } ~RenderOrReleaseOutput() { @@ -139,12 +141,12 @@ public: class CallbacksSupport final : public JavaCallbacksSupport { public: - CallbacksSupport(RemoteVideoDecoder* aDecoder, MediaDataDecoderCallback* aCallback) - : JavaCallbacksSupport(aCallback) - , mDecoder(aDecoder) - {} + CallbacksSupport(RemoteVideoDecoder* aDecoder) : mDecoder(aDecoder) { } - virtual ~CallbacksSupport() {} + void HandleInputExhausted() override + { + mDecoder->InputExhausted(); + } void HandleOutput(Sample::Param aSample) override { @@ -157,50 +159,51 @@ public: int32_t flags; bool ok = NS_SUCCEEDED(info->Flags(&flags)); - MOZ_ASSERT(ok); int32_t offset; - ok |= NS_SUCCEEDED(info->Offset(&offset)); - MOZ_ASSERT(ok); + ok &= NS_SUCCEEDED(info->Offset(&offset)); int64_t presentationTimeUs; - ok |= NS_SUCCEEDED(info->PresentationTimeUs(&presentationTimeUs)); - MOZ_ASSERT(ok); + ok &= NS_SUCCEEDED(info->PresentationTimeUs(&presentationTimeUs)); int32_t size; - ok |= NS_SUCCEEDED(info->Size(&size)); - MOZ_ASSERT(ok); + ok &= NS_SUCCEEDED(info->Size(&size)); - NS_ENSURE_TRUE_VOID(ok); + if (!ok) { + HandleError(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("VideoCallBack::HandleOutput"))); + return; + } if (size > 0) { - RefPtr img = - new SurfaceTextureImage(mDecoder->mSurfaceTexture.get(), mDecoder->mConfig.mDisplay, - gl::OriginPos::BottomLeft); + RefPtr img = new SurfaceTextureImage( + mDecoder->mSurfaceTexture.get(), mDecoder->mConfig.mDisplay, + gl::OriginPos::BottomLeft); - RefPtr v = - VideoData::CreateFromImage(mDecoder->mConfig, - offset, - presentationTimeUs, - durationUs.value(), - img, - !!(flags & MediaCodec::BUFFER_FLAG_SYNC_FRAME), - presentationTimeUs, - gfx::IntRect(0, 0, - mDecoder->mConfig.mDisplay.width, - mDecoder->mConfig.mDisplay.height)); + RefPtr v = VideoData::CreateFromImage( + mDecoder->mConfig, offset, presentationTimeUs, durationUs.value(), + img, !!(flags & MediaCodec::BUFFER_FLAG_SYNC_FRAME), + presentationTimeUs, + gfx::IntRect(0, 0, mDecoder->mConfig.mDisplay.width, + mDecoder->mConfig.mDisplay.height)); - UniquePtr listener(new RenderOrReleaseOutput(mDecoder->mJavaDecoder, aSample)); + UniquePtr listener( + new RenderOrReleaseOutput(mDecoder->mJavaDecoder, aSample)); v->SetListener(Move(listener)); - mDecoderCallback->Output(v); + mDecoder->Output(v); } if ((flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM) != 0) { - mDecoderCallback->DrainComplete(); + mDecoder->DrainComplete(); } } + void HandleError(const MediaResult& aError) override + { + mDecoder->Error(aError); + } + friend class RemoteDataDecoder; private: @@ -209,11 +212,10 @@ public: RemoteVideoDecoder(const VideoInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer, - const nsString& aDrmStubId) + const nsString& aDrmStubId, TaskQueue* aTaskQueue) : RemoteDataDecoder(MediaData::Type::VIDEO_DATA, aConfig.mMimeType, - aFormat, aCallback, aDrmStubId) + aFormat, aDrmStubId, aTaskQueue) , mImageContainer(aImageContainer) , mConfig(aConfig) { @@ -224,59 +226,66 @@ public: mSurfaceTexture = AndroidSurfaceTexture::Create(); if (!mSurfaceTexture) { NS_WARNING("Failed to create SurfaceTexture for video decode\n"); - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); } if (!jni::IsFennec()) { NS_WARNING("Remote decoding not supported in non-Fennec environment\n"); - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); } // Register native methods. JavaCallbacksSupport::Init(); mJavaCallbacks = CodecProxy::NativeCallbacks::New(); - JavaCallbacksSupport::AttachNative(mJavaCallbacks, - mozilla::MakeUnique(this, mCallback)); + JavaCallbacksSupport::AttachNative( + mJavaCallbacks, mozilla::MakeUnique(this)); mJavaDecoder = CodecProxy::Create(mFormat, mSurfaceTexture->JavaSurface(), mJavaCallbacks, mDrmStubId); if (mJavaDecoder == nullptr) { - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); } - mIsCodecSupportAdaptivePlayback = mJavaDecoder->IsAdaptivePlaybackSupported(); - mInputDurations.Clear(); + mIsCodecSupportAdaptivePlayback = + mJavaDecoder->IsAdaptivePlaybackSupported(); return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__); } - void Flush() override + RefPtr Flush() override { mInputDurations.Clear(); - RemoteDataDecoder::Flush(); + return RemoteDataDecoder::Flush(); } - void Drain() override + RefPtr Drain() override { - RemoteDataDecoder::Drain(); mInputDurations.Put(0); + return RemoteDataDecoder::Drain(); } - void Input(MediaRawData* aSample) override + RefPtr Decode(MediaRawData* aSample) override { - RemoteDataDecoder::Input(aSample); mInputDurations.Put(aSample->mDuration); + return RemoteDataDecoder::Decode(aSample); } - bool SupportDecoderRecycling() const override { return mIsCodecSupportAdaptivePlayback; } + bool SupportDecoderRecycling() const override + { + return mIsCodecSupportAdaptivePlayback; + } private: - class DurationQueue { + class DurationQueue + { public: - DurationQueue() : mMutex("Video duration queue") {} + DurationQueue() : mMutex("Video duration queue") { } void Clear() { @@ -309,75 +318,34 @@ private: }; layers::ImageContainer* mImageContainer; - const VideoInfo& mConfig; + const VideoInfo mConfig; RefPtr mSurfaceTexture; DurationQueue mInputDurations; bool mIsCodecSupportAdaptivePlayback = false; }; -class RemoteEMEVideoDecoder : public RemoteVideoDecoder { -public: - RemoteEMEVideoDecoder(const VideoInfo& aConfig, - MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - layers::ImageContainer* aImageContainer, - const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue) - : RemoteVideoDecoder(aConfig, aFormat, aCallback, aImageContainer, aDrmStubId) - , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aCallback, - aTaskQueue, aProxy)) - { - } - - void Input(MediaRawData* aSample) override; - void Shutdown() override; - -private: - RefPtr mSamplesWaitingForKey; -}; - -void -RemoteEMEVideoDecoder::Input(MediaRawData* aSample) -{ - if (mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)) { - return; - } - RemoteVideoDecoder::Input(aSample); -} - -void -RemoteEMEVideoDecoder::Shutdown() -{ - RemoteVideoDecoder::Shutdown(); - - mSamplesWaitingForKey->BreakCycles(); - mSamplesWaitingForKey = nullptr; -} - class RemoteAudioDecoder : public RemoteDataDecoder { public: RemoteAudioDecoder(const AudioInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - const nsString& aDrmStubId) + const nsString& aDrmStubId, TaskQueue* aTaskQueue) : RemoteDataDecoder(MediaData::Type::AUDIO_DATA, aConfig.mMimeType, - aFormat, aCallback, aDrmStubId) + aFormat, aDrmStubId, aTaskQueue) , mConfig(aConfig) { JNIEnv* const env = jni::GetEnvForThread(); bool formatHasCSD = false; - NS_ENSURE_SUCCESS_VOID(aFormat->ContainsKey(NS_LITERAL_STRING("csd-0"), &formatHasCSD)); + NS_ENSURE_SUCCESS_VOID( + aFormat->ContainsKey(NS_LITERAL_STRING("csd-0"), &formatHasCSD)); if (!formatHasCSD && aConfig.mCodecSpecificConfig->Length() >= 2) { jni::ByteBuffer::LocalRef buffer(env); - buffer = jni::ByteBuffer::New( - aConfig.mCodecSpecificConfig->Elements(), + buffer = jni::ByteBuffer::New(aConfig.mCodecSpecificConfig->Elements(), aConfig.mCodecSpecificConfig->Length()); - NS_ENSURE_SUCCESS_VOID(aFormat->SetByteBuffer(NS_LITERAL_STRING("csd-0"), - buffer)); + NS_ENSURE_SUCCESS_VOID( + aFormat->SetByteBuffer(NS_LITERAL_STRING("csd-0"), buffer)); } } @@ -387,12 +355,14 @@ public: JavaCallbacksSupport::Init(); mJavaCallbacks = CodecProxy::NativeCallbacks::New(); - JavaCallbacksSupport::AttachNative(mJavaCallbacks, - mozilla::MakeUnique(this, mCallback)); + JavaCallbacksSupport::AttachNative( + mJavaCallbacks, mozilla::MakeUnique(this)); - mJavaDecoder = CodecProxy::Create(mFormat, nullptr, mJavaCallbacks, mDrmStubId); + mJavaDecoder = + CodecProxy::Create(mFormat, nullptr, mJavaCallbacks, mDrmStubId); if (mJavaDecoder == nullptr) { - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); } return InitPromise::CreateAndResolve(TrackInfo::kAudioTrack, __func__); @@ -402,12 +372,12 @@ private: class CallbacksSupport final : public JavaCallbacksSupport { public: - CallbacksSupport(RemoteAudioDecoder* aDecoder, MediaDataDecoderCallback* aCallback) - : JavaCallbacksSupport(aCallback) - , mDecoder(aDecoder) - {} + CallbacksSupport(RemoteAudioDecoder* aDecoder) : mDecoder(aDecoder) { } - virtual ~CallbacksSupport() {} + void HandleInputExhausted() override + { + mDecoder->InputExhausted(); + } void HandleOutput(Sample::Param aSample) override { @@ -415,21 +385,21 @@ private: int32_t flags; bool ok = NS_SUCCEEDED(info->Flags(&flags)); - MOZ_ASSERT(ok); int32_t offset; - ok |= NS_SUCCEEDED(info->Offset(&offset)); - MOZ_ASSERT(ok); + ok &= NS_SUCCEEDED(info->Offset(&offset)); int64_t presentationTimeUs; - ok |= NS_SUCCEEDED(info->PresentationTimeUs(&presentationTimeUs)); - MOZ_ASSERT(ok); + ok &= NS_SUCCEEDED(info->PresentationTimeUs(&presentationTimeUs)); int32_t size; - ok |= NS_SUCCEEDED(info->Size(&size)); - MOZ_ASSERT(ok); + ok &= NS_SUCCEEDED(info->Size(&size)); - NS_ENSURE_TRUE_VOID(ok); + if (!ok) { + HandleError(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("AudioCallBack::HandleOutput"))); + return; + } if (size > 0) { #ifdef MOZ_SAMPLE_TYPE_S16 @@ -441,25 +411,24 @@ private: const int32_t numFrames = numSamples / mOutputChannels; AlignedAudioBuffer audio(numSamples); if (!audio) { + mDecoder->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__)); return; } - jni::ByteBuffer::LocalRef dest = jni::ByteBuffer::New(audio.get(), size); + jni::ByteBuffer::LocalRef dest = + jni::ByteBuffer::New(audio.get(), size); aSample->WriteToByteBuffer(dest); - RefPtr data = new AudioData(0, presentationTimeUs, - FramesToUsecs(numFrames, mOutputSampleRate).value(), - numFrames, - Move(audio), - mOutputChannels, - mOutputSampleRate); + RefPtr data = new AudioData( + 0, presentationTimeUs, + FramesToUsecs(numFrames, mOutputSampleRate).value(), numFrames, + Move(audio), mOutputChannels, mOutputSampleRate); - mDecoderCallback->Output(data); + mDecoder->Output(data); } if ((flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM) != 0) { - mDecoderCallback->DrainComplete(); - return; + mDecoder->DrainComplete(); } } @@ -468,13 +437,19 @@ private: aFormat->GetInteger(NS_LITERAL_STRING("channel-count"), &mOutputChannels); AudioConfig::ChannelLayout layout(mOutputChannels); if (!layout.IsValid()) { - mDecoderCallback->Error(MediaResult( + mDecoder->Error(MediaResult( NS_ERROR_DOM_MEDIA_FATAL_ERR, RESULT_DETAIL("Invalid channel layout:%d", mOutputChannels))); return; } aFormat->GetInteger(NS_LITERAL_STRING("sample-rate"), &mOutputSampleRate); - LOG("Audio output format changed: channels:%d sample rate:%d", mOutputChannels, mOutputSampleRate); + LOG("Audio output format changed: channels:%d sample rate:%d", + mOutputChannels, mOutputSampleRate); + } + + void HandleError(const MediaResult& aError) override + { + mDecoder->Error(aError); } private: @@ -483,122 +458,98 @@ private: int32_t mOutputSampleRate; }; - const AudioInfo& mConfig; + const AudioInfo mConfig; }; -class RemoteEMEAudioDecoder : public RemoteAudioDecoder { -public: - RemoteEMEAudioDecoder(const AudioInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, const nsString& aDrmStubId, - CDMProxy* aProxy, TaskQueue* aTaskQueue) - : RemoteAudioDecoder(aConfig, aFormat, aCallback, aDrmStubId) - , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aCallback, - aTaskQueue, aProxy)) - { - } - - void Input(MediaRawData* aSample) override; - void Shutdown() override; - -private: - RefPtr mSamplesWaitingForKey; -}; - -void -RemoteEMEAudioDecoder::Input(MediaRawData* aSample) -{ - if (mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)) { - return; - } - RemoteAudioDecoder::Input(aSample); -} - -void -RemoteEMEAudioDecoder::Shutdown() -{ - RemoteAudioDecoder::Shutdown(); - - mSamplesWaitingForKey->BreakCycles(); - mSamplesWaitingForKey = nullptr; -} - -MediaDataDecoder* +already_AddRefed RemoteDataDecoder::CreateAudioDecoder(const AudioInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue) + CDMProxy* aProxy, TaskQueue* aTaskQueue) { + RefPtr decoder; if (!aProxy) { - return new RemoteAudioDecoder(aConfig, aFormat, aCallback, aDrmStubId); + decoder = new RemoteAudioDecoder(aConfig, aFormat, aDrmStubId, aTaskQueue); } else { - return new RemoteEMEAudioDecoder(aConfig, - aFormat, - aCallback, - aDrmStubId, - aProxy, - aTaskQueue); + // TODO in bug 1334061. } + return decoder.forget(); } -MediaDataDecoder* +already_AddRefed RemoteDataDecoder::CreateVideoDecoder(const VideoInfo& aConfig, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer, const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue) + CDMProxy* aProxy, TaskQueue* aTaskQueue) { + RefPtr decoder; if (!aProxy) { - return new RemoteVideoDecoder(aConfig, aFormat, aCallback, aImageContainer, aDrmStubId); + decoder = new RemoteVideoDecoder(aConfig, aFormat, aImageContainer, + aDrmStubId, aTaskQueue); } else { - return new RemoteEMEVideoDecoder(aConfig, - aFormat, - aCallback, - aImageContainer, - aDrmStubId, - aProxy, - aTaskQueue); + // TODO in bug 1334061. } + return decoder.forget(); } RemoteDataDecoder::RemoteDataDecoder(MediaData::Type aType, const nsACString& aMimeType, MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - const nsString& aDrmStubId) + const nsString& aDrmStubId, + TaskQueue* aTaskQueue) : mType(aType) , mMimeType(aMimeType) , mFormat(aFormat) - , mCallback(aCallback) , mDrmStubId(aDrmStubId) + , mTaskQueue(aTaskQueue) { } -void +RefPtr RemoteDataDecoder::Flush() { - mJavaDecoder->Flush(); + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + mJavaDecoder->Flush(); + return FlushPromise::CreateAndResolve(true, __func__); + }); } -void +RefPtr RemoteDataDecoder::Drain() { - BufferInfo::LocalRef bufferInfo; - nsresult rv = BufferInfo::New(&bufferInfo); - NS_ENSURE_SUCCESS_VOID(rv); - bufferInfo->Set(0, 0, -1, MediaCodec::BUFFER_FLAG_END_OF_STREAM); + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { + BufferInfo::LocalRef bufferInfo; + nsresult rv = BufferInfo::New(&bufferInfo); + if (NS_FAILED(rv)) { + return DecodePromise::CreateAndReject(NS_ERROR_OUT_OF_MEMORY, __func__); + } + bufferInfo->Set(0, 0, -1, MediaCodec::BUFFER_FLAG_END_OF_STREAM); - mJavaDecoder->Input(nullptr, bufferInfo, nullptr); + RefPtr p = mDrainPromise.Ensure(__func__); + mJavaDecoder->Input(nullptr, bufferInfo, nullptr); + return p; + }); } -void +RefPtr RemoteDataDecoder::Shutdown() { LOG(""); + RefPtr self = this; + return InvokeAsync(mTaskQueue, this, __func__, + &RemoteDataDecoder::ProcessShutdown); +} +RefPtr +RemoteDataDecoder::ProcessShutdown() +{ + AssertOnTaskQueue(); + mShutdown = true; if (mJavaDecoder) { mJavaDecoder->Release(); mJavaDecoder = nullptr; @@ -610,25 +561,97 @@ RemoteDataDecoder::Shutdown() } mFormat = nullptr; + + return ShutdownPromise::CreateAndResolve(true, __func__); } -void -RemoteDataDecoder::Input(MediaRawData* aSample) +RefPtr +RemoteDataDecoder::Decode(MediaRawData* aSample) { MOZ_ASSERT(aSample != nullptr); - jni::ByteBuffer::LocalRef bytes = jni::ByteBuffer::New(const_cast(aSample->Data()), - aSample->Size()); + RefPtr self = this; + RefPtr sample = aSample; + return InvokeAsync(mTaskQueue, __func__, [self, sample, this]() { + jni::ByteBuffer::LocalRef bytes = jni::ByteBuffer::New( + const_cast(sample->Data()), sample->Size()); - BufferInfo::LocalRef bufferInfo; - nsresult rv = BufferInfo::New(&bufferInfo); - if (NS_FAILED(rv)) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__)); + BufferInfo::LocalRef bufferInfo; + nsresult rv = BufferInfo::New(&bufferInfo); + if (NS_FAILED(rv)) { + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__); + } + bufferInfo->Set(0, sample->Size(), sample->mTime, 0); + + RefPtr p = mDecodePromise.Ensure(__func__); + mJavaDecoder->Input(bytes, bufferInfo, GetCryptoInfoFromSample(sample)); + return p; + }); +} + +void +RemoteDataDecoder::Output(MediaData* aSample) +{ + if (!mTaskQueue->IsCurrentThreadIn()) { + mTaskQueue->Dispatch( + NewRunnableMethod(this, &RemoteDataDecoder::Output, aSample)); return; } - bufferInfo->Set(0, aSample->Size(), aSample->mTime, 0); + AssertOnTaskQueue(); + if (mShutdown) { + return; + } + mDecodedData.AppendElement(aSample); +} - mJavaDecoder->Input(bytes, bufferInfo, GetCryptoInfoFromSample(aSample)); +void +RemoteDataDecoder::InputExhausted() +{ + if (!mTaskQueue->IsCurrentThreadIn()) { + mTaskQueue->Dispatch( + NewRunnableMethod(this, &RemoteDataDecoder::InputExhausted)); + return; + } + AssertOnTaskQueue(); + if (mShutdown) { + return; + } + mDecodePromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); +} + +void +RemoteDataDecoder::DrainComplete() +{ + if (!mTaskQueue->IsCurrentThreadIn()) { + mTaskQueue->Dispatch( + NewRunnableMethod(this, &RemoteDataDecoder::DrainComplete)); + return; + } + AssertOnTaskQueue(); + if (mShutdown) { + return; + } + mDrainPromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); +} + +void +RemoteDataDecoder::Error(const MediaResult& aError) +{ + if (!mTaskQueue->IsCurrentThreadIn()) { + mTaskQueue->Dispatch( + NewRunnableMethod(this, &RemoteDataDecoder::Error, aError)); + return; + } + AssertOnTaskQueue(); + if (mShutdown) { + return; + } + mDecodePromise.RejectIfExists(aError, __func__); + mDrainPromise.RejectIfExists(aError, __func__); + mDecodedData.Clear(); } } // mozilla diff --git a/dom/media/platforms/android/RemoteDataDecoder.h b/dom/media/platforms/android/RemoteDataDecoder.h index e60cf8e22974..47fbf786027c 100644 --- a/dom/media/platforms/android/RemoteDataDecoder.h +++ b/dom/media/platforms/android/RemoteDataDecoder.h @@ -14,33 +14,26 @@ #include "mozilla/Monitor.h" #include "mozilla/Maybe.h" -#include - namespace mozilla { -class RemoteDataDecoder : public MediaDataDecoder { +class RemoteDataDecoder : public MediaDataDecoder +{ public: - static MediaDataDecoder* CreateAudioDecoder(const AudioInfo& aConfig, - java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue); + static already_AddRefed CreateAudioDecoder( + const AudioInfo& aConfig, java::sdk::MediaFormat::Param aFormat, + const nsString& aDrmStubId, CDMProxy* aProxy, TaskQueue* aTaskQueue); - static MediaDataDecoder* CreateVideoDecoder(const VideoInfo& aConfig, - java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - layers::ImageContainer* aImageContainer, - const nsString& aDrmStubId, - CDMProxy* aProxy, - TaskQueue* aTaskQueue); + static already_AddRefed CreateVideoDecoder( + const VideoInfo& aConfig, java::sdk::MediaFormat::Param aFormat, + layers::ImageContainer* aImageContainer, const nsString& aDrmStubId, + CDMProxy* aProxy, TaskQueue* aTaskQueue); - virtual ~RemoteDataDecoder() {} + virtual ~RemoteDataDecoder() { } - void Flush() override; - void Drain() override; - void Shutdown() override; - void Input(MediaRawData* aSample) override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { return "android remote decoder"; @@ -50,19 +43,34 @@ protected: RemoteDataDecoder(MediaData::Type aType, const nsACString& aMimeType, java::sdk::MediaFormat::Param aFormat, - MediaDataDecoderCallback* aCallback, - const nsString& aDrmStubId); + const nsString& aDrmStubId, TaskQueue* aTaskQueue); + + // Methods only called on mTaskQueue. + RefPtr ProcessShutdown(); + void Output(MediaData* aSample); + void InputExhausted(); + void DrainComplete(); + void Error(const MediaResult& aError); + void AssertOnTaskQueue() + { + MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); + } MediaData::Type mType; nsAutoCString mMimeType; java::sdk::MediaFormat::GlobalRef mFormat; - MediaDataDecoderCallback* mCallback; - java::CodecProxy::GlobalRef mJavaDecoder; java::CodecProxy::NativeCallbacks::GlobalRef mJavaCallbacks; nsString mDrmStubId; + + RefPtr mTaskQueue; + // Only ever accessed on mTaskqueue. + bool mShutdown = false; + MozPromiseHolder mDecodePromise; + MozPromiseHolder mDrainPromise; + DecodedData mDecodedData; }; } // namespace mozilla diff --git a/dom/media/platforms/apple/AppleATDecoder.cpp b/dom/media/platforms/apple/AppleATDecoder.cpp index 65794d82c80e..aee9eb6df563 100644 --- a/dom/media/platforms/apple/AppleATDecoder.cpp +++ b/dom/media/platforms/apple/AppleATDecoder.cpp @@ -19,15 +19,12 @@ namespace mozilla { AppleATDecoder::AppleATDecoder(const AudioInfo& aConfig, - TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback) + TaskQueue* aTaskQueue) : mConfig(aConfig) , mFileStreamError(false) , mTaskQueue(aTaskQueue) - , mCallback(aCallback) , mConverter(nullptr) , mStream(nullptr) - , mIsFlushing(false) , mParsedFramesForAACMagicCookie(0) , mErrored(false) { @@ -65,31 +62,26 @@ AppleATDecoder::Init() return InitPromise::CreateAndResolve(TrackType::kAudioTrack, __func__); } -void -AppleATDecoder::Input(MediaRawData* aSample) +RefPtr +AppleATDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - LOG("mp4 input sample %p %lld us %lld pts%s %llu bytes audio", - aSample, - aSample->mDuration, - aSample->mTime, - aSample->mKeyframe ? " keyframe" : "", + LOG("mp4 input sample %p %lld us %lld pts%s %llu bytes audio", aSample, + aSample->mDuration, aSample->mTime, aSample->mKeyframe ? " keyframe" : "", (unsigned long long)aSample->Size()); - - // Queue a task to perform the actual decoding on a separate thread. - nsCOMPtr runnable = - NewRunnableMethod>( - this, - &AppleATDecoder::SubmitSample, - RefPtr(aSample)); - mTaskQueue->Dispatch(runnable.forget()); + RefPtr self = this; + RefPtr sample = aSample; + return InvokeAsync(mTaskQueue, __func__, [self, this, sample] { + return ProcessDecode(sample); + }); } -void +RefPtr AppleATDecoder::ProcessFlush() { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); mQueuedSamples.Clear(); + mDecodedSamples.Clear(); + if (mConverter) { OSStatus rv = AudioConverterReset(mConverter); if (rv) { @@ -102,37 +94,34 @@ AppleATDecoder::ProcessFlush() ProcessShutdown(); mErrored = false; } + return FlushPromise::CreateAndResolve(true, __func__); } -void +RefPtr AppleATDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); LOG("Flushing AudioToolbox AAC decoder"); - mIsFlushing = true; - nsCOMPtr runnable = - NewRunnableMethod(this, &AppleATDecoder::ProcessFlush); - SyncRunnable::DispatchToThread(mTaskQueue, runnable); - mIsFlushing = false; + return InvokeAsync(mTaskQueue, this, __func__, &AppleATDecoder::ProcessFlush); } -void +RefPtr AppleATDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); LOG("Draining AudioToolbox AAC decoder"); - mTaskQueue->AwaitIdle(); - mCallback->DrainComplete(); - Flush(); + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [] { + return DecodePromise::CreateAndResolve(DecodedData(), __func__); + }); } -void +RefPtr AppleATDecoder::Shutdown() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - nsCOMPtr runnable = - NewRunnableMethod(this, &AppleATDecoder::ProcessShutdown); - SyncRunnable::DispatchToThread(mTaskQueue, runnable); + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { + ProcessShutdown(); + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } void @@ -200,21 +189,16 @@ _PassthroughInputDataCallback(AudioConverterRef aAudioConverter, return noErr; } -void -AppleATDecoder::SubmitSample(MediaRawData* aSample) +RefPtr +AppleATDecoder::ProcessDecode(MediaRawData* aSample) { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - if (mIsFlushing) { - return; - } - MediaResult rv = NS_OK; if (!mConverter) { rv = SetupDecoder(aSample); if (rv != NS_OK && rv != NS_ERROR_NOT_INITIALIZED) { - mCallback->Error(rv); - return; + return DecodePromise::CreateAndReject(rv, __func__); } } @@ -225,13 +209,13 @@ AppleATDecoder::SubmitSample(MediaRawData* aSample) rv = DecodeSample(mQueuedSamples[i]); if (NS_FAILED(rv)) { mErrored = true; - mCallback->Error(rv); - return; + return DecodePromise::CreateAndReject(rv, __func__); } } mQueuedSamples.Clear(); } - mCallback->InputExhausted(); + + return DecodePromise::CreateAndResolve(Move(mDecodedSamples), __func__); } MediaResult @@ -343,7 +327,7 @@ AppleATDecoder::DecodeSample(MediaRawData* aSample) data.Forget(), channels, rate); - mCallback->Output(audio); + mDecodedSamples.AppendElement(Move(audio)); return NS_OK; } @@ -496,8 +480,8 @@ AppleATDecoder::SetupChannelLayout() if (tag != kAudioChannelLayoutTag_UseChannelDescriptions) { AudioFormatPropertyID property = tag == kAudioChannelLayoutTag_UseChannelBitmap - ? kAudioFormatProperty_ChannelLayoutForBitmap - : kAudioFormatProperty_ChannelLayoutForTag; + ? kAudioFormatProperty_ChannelLayoutForBitmap + : kAudioFormatProperty_ChannelLayoutForTag; if (property == kAudioFormatProperty_ChannelLayoutForBitmap) { status = @@ -632,6 +616,8 @@ _MetadataCallback(void* aAppleATDecoder, UInt32* aFlags) { AppleATDecoder* decoder = static_cast(aAppleATDecoder); + MOZ_RELEASE_ASSERT(decoder->mTaskQueue->IsCurrentThreadIn()); + LOG("MetadataCallback receiving: '%s'", FourCC2Str(aProperty)); if (aProperty == kAudioFileStreamProperty_MagicCookieData) { UInt32 size; diff --git a/dom/media/platforms/apple/AppleATDecoder.h b/dom/media/platforms/apple/AppleATDecoder.h index be232e07be0b..eeb8064188ea 100644 --- a/dom/media/platforms/apple/AppleATDecoder.h +++ b/dom/media/platforms/apple/AppleATDecoder.h @@ -9,7 +9,6 @@ #include #include "PlatformDecoderModule.h" -#include "mozilla/ReentrantMonitor.h" #include "mozilla/Vector.h" #include "nsIThread.h" #include "AudioConverter.h" @@ -17,20 +16,18 @@ namespace mozilla { class TaskQueue; -class MediaDataDecoderCallback; class AppleATDecoder : public MediaDataDecoder { public: AppleATDecoder(const AudioInfo& aConfig, - TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback); - virtual ~AppleATDecoder(); + TaskQueue* aTaskQueue); + ~AppleATDecoder(); RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { @@ -46,9 +43,9 @@ public: // the magic cookie property. bool mFileStreamError; -private: const RefPtr mTaskQueue; - MediaDataDecoderCallback* mCallback; + +private: AudioConverterRef mConverter; AudioStreamBasicDescription mOutputFormat; UInt32 mFormatID; @@ -56,11 +53,11 @@ private: nsTArray> mQueuedSamples; UniquePtr mChannelLayout; UniquePtr mAudioConverter; - Atomic mIsFlushing; + DecodedData mDecodedSamples; - void ProcessFlush(); + RefPtr ProcessDecode(MediaRawData* aSample); + RefPtr ProcessFlush(); void ProcessShutdown(); - void SubmitSample(MediaRawData* aSample); MediaResult DecodeSample(MediaRawData* aSample); MediaResult GetInputAudioDescription(AudioStreamBasicDescription& aDesc, const nsTArray& aExtraData); diff --git a/dom/media/platforms/apple/AppleDecoderModule.cpp b/dom/media/platforms/apple/AppleDecoderModule.cpp index 9976c86abd74..85f3e63bdb56 100644 --- a/dom/media/platforms/apple/AppleDecoderModule.cpp +++ b/dom/media/platforms/apple/AppleDecoderModule.cpp @@ -74,7 +74,6 @@ AppleDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) RefPtr decoder = new AppleVTDecoder(aParams.VideoConfig(), aParams.mTaskQueue, - aParams.mCallback, aParams.mImageContainer); return decoder.forget(); } @@ -83,9 +82,7 @@ already_AddRefed AppleDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) { RefPtr decoder = - new AppleATDecoder(aParams.AudioConfig(), - aParams.mTaskQueue, - aParams.mCallback); + new AppleATDecoder(aParams.AudioConfig(), aParams.mTaskQueue); return decoder.forget(); } diff --git a/dom/media/platforms/apple/AppleVTDecoder.cpp b/dom/media/platforms/apple/AppleVTDecoder.cpp index 81638870a040..2e4df639ef08 100644 --- a/dom/media/platforms/apple/AppleVTDecoder.cpp +++ b/dom/media/platforms/apple/AppleVTDecoder.cpp @@ -26,10 +26,8 @@ namespace mozilla { AppleVTDecoder::AppleVTDecoder(const VideoInfo& aConfig, TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer) : mExtraData(aConfig.mExtraData) - , mCallback(aCallback) , mPictureWidth(aConfig.mImage.width) , mPictureHeight(aConfig.mImage.height) , mDisplayWidth(aConfig.mDisplay.width) @@ -37,24 +35,24 @@ AppleVTDecoder::AppleVTDecoder(const VideoInfo& aConfig, , mTaskQueue(aTaskQueue) , mMaxRefFrames(mp4_demuxer::H264::ComputeMaxRefFrames(aConfig.mExtraData)) , mImageContainer(aImageContainer) - , mIsShutDown(false) #ifdef MOZ_WIDGET_UIKIT , mUseSoftwareImages(true) #else , mUseSoftwareImages(false) #endif , mIsFlushing(false) - , mMonitor("AppleVideoDecoder") + , mMonitor("AppleVTDecoder") , mFormat(nullptr) , mSession(nullptr) , mIsHardwareAccelerated(false) { MOZ_COUNT_CTOR(AppleVTDecoder); // TODO: Verify aConfig.mime_type. - LOG("Creating AppleVTDecoder for %dx%d h.264 video", - mDisplayWidth, - mDisplayHeight - ); + LOG("Creating AppleVTDecoder for %dx%d h.264 video", mDisplayWidth, + mDisplayHeight); + + // To ensure our PromiseHolder is only ever accessed with the monitor held. + mPromise.SetMonitor(&mMonitor); } AppleVTDecoder::~AppleVTDecoder() @@ -74,11 +72,9 @@ AppleVTDecoder::Init() return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); } -void -AppleVTDecoder::Input(MediaRawData* aSample) +RefPtr +AppleVTDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - LOG("mp4 input sample %p pts %lld duration %lld us%s %d bytes", aSample, aSample->mTime, @@ -86,58 +82,130 @@ AppleVTDecoder::Input(MediaRawData* aSample) aSample->mKeyframe ? " keyframe" : "", aSample->Size()); - mTaskQueue->Dispatch(NewRunnableMethod>( - this, &AppleVTDecoder::ProcessDecode, aSample)); + RefPtr self = this; + RefPtr sample = aSample; + return InvokeAsync(mTaskQueue, __func__, [self, this, sample] { + RefPtr p; + { + MonitorAutoLock mon(mMonitor); + p = mPromise.Ensure(__func__); + } + ProcessDecode(sample); + return p; + }); } -void +RefPtr AppleVTDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); mIsFlushing = true; - nsCOMPtr runnable = - NewRunnableMethod(this, &AppleVTDecoder::ProcessFlush); - SyncRunnable::DispatchToThread(mTaskQueue, runnable); - mIsFlushing = false; - - mSeekTargetThreshold.reset(); + return InvokeAsync(mTaskQueue, this, __func__, &AppleVTDecoder::ProcessFlush); } -void +RefPtr AppleVTDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - nsCOMPtr runnable = - NewRunnableMethod(this, &AppleVTDecoder::ProcessDrain); - mTaskQueue->Dispatch(runnable.forget()); + return InvokeAsync(mTaskQueue, this, __func__, &AppleVTDecoder::ProcessDrain); +} + +RefPtr +AppleVTDecoder::Shutdown() +{ + if (mTaskQueue) { + RefPtr self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { + ProcessShutdown(); + return ShutdownPromise::CreateAndResolve(true, __func__); + }); + } + ProcessShutdown(); + return ShutdownPromise::CreateAndResolve(true, __func__); +} + +// Helper to fill in a timestamp structure. +static CMSampleTimingInfo +TimingInfoFromSample(MediaRawData* aSample) +{ + CMSampleTimingInfo timestamp; + + timestamp.duration = CMTimeMake(aSample->mDuration, USECS_PER_S); + timestamp.presentationTimeStamp = + CMTimeMake(aSample->mTime, USECS_PER_S); + timestamp.decodeTimeStamp = + CMTimeMake(aSample->mTimecode, USECS_PER_S); + + return timestamp; } void -AppleVTDecoder::Shutdown() -{ - MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown); - mIsShutDown = true; - if (mTaskQueue) { - nsCOMPtr runnable = - NewRunnableMethod(this, &AppleVTDecoder::ProcessShutdown); - mTaskQueue->Dispatch(runnable.forget()); - } else { - ProcessShutdown(); - } -} - -nsresult AppleVTDecoder::ProcessDecode(MediaRawData* aSample) { AssertOnTaskQueueThread(); if (mIsFlushing) { - return NS_OK; + MonitorAutoLock mon(mMonitor); + mPromise.Reject(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + return; } - auto rv = DoDecode(aSample); + AutoCFRelease block = nullptr; + AutoCFRelease sample = nullptr; + VTDecodeInfoFlags infoFlags; + OSStatus rv; - return rv; + // FIXME: This copies the sample data. I think we can provide + // a custom block source which reuses the aSample buffer. + // But note that there may be a problem keeping the samples + // alive over multiple frames. + rv = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, // Struct allocator. + const_cast(aSample->Data()), + aSample->Size(), + kCFAllocatorNull, // Block allocator. + NULL, // Block source. + 0, // Data offset. + aSample->Size(), + false, + block.receive()); + if (rv != noErr) { + NS_ERROR("Couldn't create CMBlockBuffer"); + MonitorAutoLock mon(mMonitor); + mPromise.Reject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("CMBlockBufferCreateWithMemoryBlock:%x", rv)), + __func__); + return; + } + + CMSampleTimingInfo timestamp = TimingInfoFromSample(aSample); + rv = CMSampleBufferCreate(kCFAllocatorDefault, block, true, 0, 0, mFormat, 1, 1, ×tamp, 0, NULL, sample.receive()); + if (rv != noErr) { + NS_ERROR("Couldn't create CMSampleBuffer"); + MonitorAutoLock mon(mMonitor); + mPromise.Reject(MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("CMSampleBufferCreate:%x", rv)), + __func__); + return; + } + + VTDecodeFrameFlags decodeFlags = + kVTDecodeFrame_EnableAsynchronousDecompression; + rv = VTDecompressionSessionDecodeFrame(mSession, + sample, + decodeFlags, + CreateAppleFrameRef(aSample), + &infoFlags); + if (rv != noErr && !(infoFlags & kVTDecodeInfo_FrameDropped)) { + LOG("AppleVTDecoder: Error %d VTDecompressionSessionDecodeFrame", rv); + NS_WARNING("Couldn't pass frame to decoder"); + // It appears that even when VTDecompressionSessionDecodeFrame returned a + // failure. Decoding sometimes actually get processed. + MonitorAutoLock mon(mMonitor); + mPromise.RejectIfExists( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("VTDecompressionSessionDecodeFrame:%x", rv)), + __func__); + return; + } } void @@ -156,29 +224,39 @@ AppleVTDecoder::ProcessShutdown() } } -void +RefPtr AppleVTDecoder::ProcessFlush() { AssertOnTaskQueueThread(); nsresult rv = WaitForAsynchronousFrames(); if (NS_FAILED(rv)) { - LOG("AppleVTDecoder::Flush failed waiting for platform decoder " - "with error:%d.", rv); + LOG("AppleVTDecoder::Flush failed waiting for platform decoder"); } - ClearReorderedFrames(); + MonitorAutoLock mon(mMonitor); + mPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + + while (!mReorderQueue.IsEmpty()) { + mReorderQueue.Pop(); + } + mSeekTargetThreshold.reset(); + mIsFlushing = false; + return FlushPromise::CreateAndResolve(true, __func__); } -void +RefPtr AppleVTDecoder::ProcessDrain() { AssertOnTaskQueueThread(); nsresult rv = WaitForAsynchronousFrames(); if (NS_FAILED(rv)) { - LOG("AppleVTDecoder::Drain failed waiting for platform decoder " - "with error:%d.", rv); + LOG("AppleVTDecoder::Drain failed waiting for platform decoder"); } - DrainReorderedFrames(); - mCallback->DrainComplete(); + MonitorAutoLock mon(mMonitor); + DecodedData samples; + while (!mReorderQueue.IsEmpty()) { + samples.AppendElement(Move(mReorderQueue.Pop())); + } + return DecodePromise::CreateAndResolve(Move(samples), __func__); } AppleVTDecoder::AppleFrameRef* @@ -188,24 +266,6 @@ AppleVTDecoder::CreateAppleFrameRef(const MediaRawData* aSample) return new AppleFrameRef(*aSample); } -void -AppleVTDecoder::DrainReorderedFrames() -{ - MonitorAutoLock mon(mMonitor); - while (!mReorderQueue.IsEmpty()) { - mCallback->Output(mReorderQueue.Pop().get()); - } -} - -void -AppleVTDecoder::ClearReorderedFrames() -{ - MonitorAutoLock mon(mMonitor); - while (!mReorderQueue.IsEmpty()) { - mReorderQueue.Pop(); - } -} - void AppleVTDecoder::SetSeekThreshold(const media::TimeUnit& aTime) { @@ -247,17 +307,18 @@ PlatformCallback(void* decompressionOutputRefCon, MOZ_ASSERT(CFGetTypeID(image) == CVPixelBufferGetTypeID(), "VideoToolbox returned an unexpected image type"); } + decoder->OutputFrame(image, *frameRef); } // Copy and return a decoded frame. -nsresult +void AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage, AppleVTDecoder::AppleFrameRef aFrameRef) { - if (mIsShutDown || mIsFlushing) { + if (mIsFlushing) { // We are in the process of flushing or shutting down; ignore frame. - return NS_OK; + return; } LOG("mp4 output frame %lld dts %lld pts %lld duration %lld us%s", @@ -271,8 +332,9 @@ AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage, if (!aImage) { // Image was dropped by decoder or none return yet. // We need more input to continue. - mCallback->InputExhausted(); - return NS_OK; + MonitorAutoLock mon(mMonitor); + mPromise.Resolve(DecodedData(), __func__); + return; } bool useNullSample = false; @@ -310,10 +372,12 @@ AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage, CVReturn rv = CVPixelBufferLockBaseAddress(aImage, kCVPixelBufferLock_ReadOnly); if (rv != kCVReturnSuccess) { NS_ERROR("error locking pixel data"); - mCallback->Error( - MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("CVPixelBufferLockBaseAddress:%x", rv))); - return NS_ERROR_DOM_MEDIA_DECODE_ERR; + MonitorAutoLock mon(mMonitor); + mPromise.Reject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("CVPixelBufferLockBaseAddress:%x", rv)), + __func__); + return; } // Y plane. buffer.mPlanes[0].mData = @@ -378,22 +442,23 @@ AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage, if (!data) { NS_ERROR("Couldn't create VideoData for frame"); - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__)); - return NS_ERROR_OUT_OF_MEMORY; + MonitorAutoLock mon(mMonitor); + mPromise.Reject(MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__); + return; } // Frames come out in DTS order but we need to output them // in composition order. MonitorAutoLock mon(mMonitor); mReorderQueue.Push(data); - if (mReorderQueue.Length() > mMaxRefFrames) { - mCallback->Output(mReorderQueue.Pop().get()); + DecodedData results; + while (mReorderQueue.Length() > mMaxRefFrames) { + results.AppendElement(mReorderQueue.Pop()); } - mCallback->InputExhausted(); + mPromise.Resolve(Move(results), __func__); + LOG("%llu decoded frames queued", static_cast(mReorderQueue.Length())); - - return NS_OK; } nsresult @@ -401,86 +466,12 @@ AppleVTDecoder::WaitForAsynchronousFrames() { OSStatus rv = VTDecompressionSessionWaitForAsynchronousFrames(mSession); if (rv != noErr) { - LOG("AppleVTDecoder: Error %d waiting for asynchronous frames", rv); + NS_ERROR("AppleVTDecoder: Error waiting for asynchronous frames"); return NS_ERROR_FAILURE; } return NS_OK; } -// Helper to fill in a timestamp structure. -static CMSampleTimingInfo -TimingInfoFromSample(MediaRawData* aSample) -{ - CMSampleTimingInfo timestamp; - - timestamp.duration = CMTimeMake(aSample->mDuration, USECS_PER_S); - timestamp.presentationTimeStamp = - CMTimeMake(aSample->mTime, USECS_PER_S); - timestamp.decodeTimeStamp = - CMTimeMake(aSample->mTimecode, USECS_PER_S); - - return timestamp; -} - -MediaResult -AppleVTDecoder::DoDecode(MediaRawData* aSample) -{ - AssertOnTaskQueueThread(); - - // For some reason this gives me a double-free error with stagefright. - AutoCFRelease block = nullptr; - AutoCFRelease sample = nullptr; - VTDecodeInfoFlags infoFlags; - OSStatus rv; - - // FIXME: This copies the sample data. I think we can provide - // a custom block source which reuses the aSample buffer. - // But note that there may be a problem keeping the samples - // alive over multiple frames. - rv = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, // Struct allocator. - const_cast(aSample->Data()), - aSample->Size(), - kCFAllocatorNull, // Block allocator. - NULL, // Block source. - 0, // Data offset. - aSample->Size(), - false, - block.receive()); - if (rv != noErr) { - NS_ERROR("Couldn't create CMBlockBuffer"); - mCallback->Error( - MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("CMBlockBufferCreateWithMemoryBlock:%x", rv))); - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); - } - CMSampleTimingInfo timestamp = TimingInfoFromSample(aSample); - rv = CMSampleBufferCreate(kCFAllocatorDefault, block, true, 0, 0, mFormat, 1, 1, ×tamp, 0, NULL, sample.receive()); - if (rv != noErr) { - NS_ERROR("Couldn't create CMSampleBuffer"); - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("CMSampleBufferCreate:%x", rv))); - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); - } - - VTDecodeFrameFlags decodeFlags = - kVTDecodeFrame_EnableAsynchronousDecompression; - rv = VTDecompressionSessionDecodeFrame(mSession, - sample, - decodeFlags, - CreateAppleFrameRef(aSample), - &infoFlags); - if (rv != noErr && !(infoFlags & kVTDecodeInfo_FrameDropped)) { - LOG("AppleVTDecoder: Error %d VTDecompressionSessionDecodeFrame", rv); - NS_WARNING("Couldn't pass frame to decoder"); - mCallback->Error( - MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("VTDecompressionSessionDecodeFrame:%x", rv))); - return NS_ERROR_DOM_MEDIA_DECODE_ERR; - } - - return NS_OK; -} - nsresult AppleVTDecoder::InitializeSession() { @@ -670,5 +661,4 @@ AppleVTDecoder::CreateOutputConfiguration() #endif } - } // namespace mozilla diff --git a/dom/media/platforms/apple/AppleVTDecoder.h b/dom/media/platforms/apple/AppleVTDecoder.h index 05d08c7c79a8..ae1c06d71224 100644 --- a/dom/media/platforms/apple/AppleVTDecoder.h +++ b/dom/media/platforms/apple/AppleVTDecoder.h @@ -21,7 +21,6 @@ class AppleVTDecoder : public MediaDataDecoder { public: AppleVTDecoder(const VideoInfo& aConfig, TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer); class AppleFrameRef { @@ -43,10 +42,10 @@ public: }; RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; void SetSeekThreshold(const media::TimeUnit& aTime) override; bool IsHardwareAccelerated(nsACString& aFailureReason) const override @@ -57,21 +56,20 @@ public: const char* GetDescriptionName() const override { return mIsHardwareAccelerated - ? "apple hardware VT decoder" - : "apple software VT decoder"; + ? "apple hardware VT decoder" + : "apple software VT decoder"; } // Access from the taskqueue and the decoder's thread. // OutputFrame is thread-safe. - nsresult OutputFrame(CVPixelBufferRef aImage, - AppleFrameRef aFrameRef); + void OutputFrame(CVPixelBufferRef aImage, AppleFrameRef aFrameRef); private: virtual ~AppleVTDecoder(); - void ProcessFlush(); - void ProcessDrain(); + RefPtr ProcessFlush(); + RefPtr ProcessDrain(); void ProcessShutdown(); - nsresult ProcessDecode(MediaRawData* aSample); + void ProcessDecode(MediaRawData* aSample); void AssertOnTaskQueueThread() { @@ -79,12 +77,9 @@ private: } AppleFrameRef* CreateAppleFrameRef(const MediaRawData* aSample); - void DrainReorderedFrames(); - void ClearReorderedFrames(); CFDictionaryRef CreateOutputConfiguration(); const RefPtr mExtraData; - MediaDataDecoderCallback* mCallback; const uint32_t mPictureWidth; const uint32_t mPictureHeight; const uint32_t mDisplayWidth; @@ -95,22 +90,21 @@ private: nsresult WaitForAsynchronousFrames(); CFDictionaryRef CreateDecoderSpecification(); CFDictionaryRef CreateDecoderExtensions(); - // Method to pass a frame to VideoToolbox for decoding. - MediaResult DoDecode(MediaRawData* aSample); const RefPtr mTaskQueue; const uint32_t mMaxRefFrames; const RefPtr mImageContainer; - Atomic mIsShutDown; const bool mUseSoftwareImages; // Set on reader/decode thread calling Flush() to indicate that output is // not required and so input samples on mTaskQueue need not be processed. // Cleared on mTaskQueue in ProcessDrain(). Atomic mIsFlushing; - // Protects mReorderQueue. + // Protects mReorderQueue and mPromise. Monitor mMonitor; ReorderQueue mReorderQueue; + MozPromiseHolder mPromise; + // Decoded frame will be dropped if its pts is smaller than this // value. It shold be initialized before Input() or after Flush(). So it is // safe to access it in OutputFrame without protecting. diff --git a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp index b4dd88132689..9b9e5f950d4b 100644 --- a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp @@ -15,9 +15,8 @@ namespace mozilla { FFmpegAudioDecoder::FFmpegAudioDecoder(FFmpegLibWrapper* aLib, - TaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, - const AudioInfo& aConfig) - : FFmpegDataDecoder(aLib, aTaskQueue, aCallback, GetCodecId(aConfig.mMimeType)) + TaskQueue* aTaskQueue, const AudioInfo& aConfig) + : FFmpegDataDecoder(aLib, aTaskQueue, GetCodecId(aConfig.mMimeType)) { MOZ_COUNT_CTOR(FFmpegAudioDecoder); // Use a new MediaByteBuffer as the object will be modified during initialization. @@ -117,8 +116,8 @@ CopyAndPackAudio(AVFrame* aFrame, uint32_t aNumChannels, uint32_t aNumAFrames) return audio; } -MediaResult -FFmpegAudioDecoder::DoDecode(MediaRawData* aSample) +RefPtr +FFmpegAudioDecoder::ProcessDecode(MediaRawData* aSample) { AVPacket packet; mLib->av_init_packet(&packet); @@ -127,14 +126,17 @@ FFmpegAudioDecoder::DoDecode(MediaRawData* aSample) packet.size = aSample->Size(); if (!PrepareFrame()) { - return MediaResult( - NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("FFmpeg audio decoder failed to allocate frame")); + return DecodePromise::CreateAndReject( + MediaResult( + NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("FFmpeg audio decoder failed to allocate frame")), + __func__); } int64_t samplePosition = aSample->mOffset; media::TimeUnit pts = media::TimeUnit::FromMicroseconds(aSample->mTime); + DecodedData results; while (packet.size > 0) { int decoded; int bytesConsumed = @@ -142,8 +144,10 @@ FFmpegAudioDecoder::DoDecode(MediaRawData* aSample) if (bytesConsumed < 0) { NS_WARNING("FFmpeg audio decoder error."); - return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("FFmpeg audio error:%d", bytesConsumed)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("FFmpeg audio error:%d", bytesConsumed)), + __func__); } if (mFrame->format != AV_SAMPLE_FMT_FLT && @@ -152,18 +156,21 @@ FFmpegAudioDecoder::DoDecode(MediaRawData* aSample) mFrame->format != AV_SAMPLE_FMT_S16P && mFrame->format != AV_SAMPLE_FMT_S32 && mFrame->format != AV_SAMPLE_FMT_S32P) { - return MediaResult( - NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("FFmpeg audio decoder outputs unsupported audio format")); + return DecodePromise::CreateAndReject( + MediaResult( + NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("FFmpeg audio decoder outputs unsupported audio format")), + __func__); } if (decoded) { uint32_t numChannels = mCodecContext->channels; AudioConfig::ChannelLayout layout(numChannels); if (!layout.IsValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Unsupported channel layout:%u", numChannels)); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("Unsupported channel layout:%u", numChannels)), + __func__); } uint32_t samplingRate = mCodecContext->sample_rate; @@ -171,44 +178,46 @@ FFmpegAudioDecoder::DoDecode(MediaRawData* aSample) AlignedAudioBuffer audio = CopyAndPackAudio(mFrame, numChannels, mFrame->nb_samples); if (!audio) { - return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__); } media::TimeUnit duration = FramesToTimeUnit(mFrame->nb_samples, samplingRate); if (!duration.IsValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, - RESULT_DETAIL("Invalid sample duration")); + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, + RESULT_DETAIL("Invalid sample duration")), + __func__); } - RefPtr data = new AudioData(samplePosition, - pts.ToMicroseconds(), - duration.ToMicroseconds(), - mFrame->nb_samples, - Move(audio), - numChannels, - samplingRate); - mCallback->Output(data); - pts += duration; - if (!pts.IsValid()) { - return MediaResult( - NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, - RESULT_DETAIL("Invalid count of accumulated audio samples")); + media::TimeUnit newpts = pts + duration; + if (!newpts.IsValid()) { + return DecodePromise::CreateAndReject( + MediaResult( + NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, + RESULT_DETAIL("Invalid count of accumulated audio samples")), + __func__); } + + results.AppendElement(new AudioData( + samplePosition, pts.ToMicroseconds(), duration.ToMicroseconds(), + mFrame->nb_samples, Move(audio), numChannels, samplingRate)); + + pts = newpts; } packet.data += bytesConsumed; packet.size -= bytesConsumed; samplePosition += bytesConsumed; } - return NS_OK; + return DecodePromise::CreateAndResolve(Move(results), __func__); } -void +RefPtr FFmpegAudioDecoder::ProcessDrain() { ProcessFlush(); - mCallback->DrainComplete(); + return DecodePromise::CreateAndResolve(DecodedData(), __func__); } AVCodecID diff --git a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h index 6adaeee14024..97f0f010c1e3 100644 --- a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h +++ b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h @@ -22,7 +22,6 @@ class FFmpegAudioDecoder : public FFmpegDataDecoder { public: FFmpegAudioDecoder(FFmpegLibWrapper* aLib, TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback, const AudioInfo& aConfig); virtual ~FFmpegAudioDecoder(); @@ -35,8 +34,8 @@ public: } private: - MediaResult DoDecode(MediaRawData* aSample) override; - void ProcessDrain() override; + RefPtr ProcessDecode(MediaRawData* aSample) override; + RefPtr ProcessDrain() override; }; } // namespace mozilla diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp index 0b31fb0f94f2..8dfae0e89a05 100644 --- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp @@ -21,18 +21,15 @@ namespace mozilla StaticMutex FFmpegDataDecoder::sMonitor; - FFmpegDataDecoder::FFmpegDataDecoder(FFmpegLibWrapper* aLib, - TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback, - AVCodecID aCodecID) +FFmpegDataDecoder::FFmpegDataDecoder(FFmpegLibWrapper* aLib, + TaskQueue* aTaskQueue, + AVCodecID aCodecID) : mLib(aLib) - , mCallback(aCallback) , mCodecContext(nullptr) , mFrame(NULL) , mExtraData(nullptr) , mCodecID(aCodecID) , mTaskQueue(aTaskQueue) - , mIsFlushing(false) { MOZ_ASSERT(aLib); MOZ_COUNT_CTOR(FFmpegDataDecoder); @@ -90,67 +87,49 @@ FFmpegDataDecoder::InitDecoder() return NS_OK; } -void +RefPtr FFmpegDataDecoder::Shutdown() { if (mTaskQueue) { - nsCOMPtr runnable = - NewRunnableMethod(this, &FFmpegDataDecoder::ProcessShutdown); - mTaskQueue->Dispatch(runnable.forget()); - } else { - ProcessShutdown(); + RefPtr> self = this; + return InvokeAsync(mTaskQueue, __func__, [self, this]() { + ProcessShutdown(); + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } + ProcessShutdown(); + return ShutdownPromise::CreateAndResolve(true, __func__); } -void -FFmpegDataDecoder::ProcessDecode(MediaRawData* aSample) +RefPtr +FFmpegDataDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); - if (mIsFlushing) { - return; - } - MediaResult rv = DoDecode(aSample); - if (NS_FAILED(rv)) { - mCallback->Error(rv); - } else { - mCallback->InputExhausted(); - } + return InvokeAsync(mTaskQueue, this, __func__, + &FFmpegDataDecoder::ProcessDecode, aSample); } -void -FFmpegDataDecoder::Input(MediaRawData* aSample) -{ - mTaskQueue->Dispatch(NewRunnableMethod>( - this, &FFmpegDataDecoder::ProcessDecode, aSample)); -} - -void +RefPtr FFmpegDataDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - mIsFlushing = true; - nsCOMPtr runnable = - NewRunnableMethod(this, &FFmpegDataDecoder::ProcessFlush); - SyncRunnable::DispatchToThread(mTaskQueue, runnable); - mIsFlushing = false; + return InvokeAsync(mTaskQueue, this, __func__, + &FFmpegDataDecoder::ProcessFlush); } -void +RefPtr FFmpegDataDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); - nsCOMPtr runnable = - NewRunnableMethod(this, &FFmpegDataDecoder::ProcessDrain); - mTaskQueue->Dispatch(runnable.forget()); + return InvokeAsync(mTaskQueue, this, __func__, + &FFmpegDataDecoder::ProcessDrain); } -void +RefPtr FFmpegDataDecoder::ProcessFlush() { MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn()); if (mCodecContext) { mLib->avcodec_flush_buffers(mCodecContext); } + return FlushPromise::CreateAndResolve(true, __func__); } void diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.h b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.h index f9ff9d3c41ea..ecede68a705a 100644 --- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.h +++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.h @@ -25,30 +25,28 @@ class FFmpegDataDecoder : public MediaDataDecoder { public: FFmpegDataDecoder(FFmpegLibWrapper* aLib, TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback, AVCodecID aCodecID); virtual ~FFmpegDataDecoder(); static bool Link(); RefPtr Init() override = 0; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; static AVCodec* FindAVCodec(FFmpegLibWrapper* aLib, AVCodecID aCodec); protected: // Flush and Drain operation, always run - virtual void ProcessFlush(); + virtual RefPtr ProcessFlush(); virtual void ProcessShutdown(); virtual void InitCodecContext() {} AVFrame* PrepareFrame(); nsresult InitDecoder(); FFmpegLibWrapper* mLib; - MediaDataDecoderCallback* mCallback; AVCodecContext* mCodecContext; AVFrame* mFrame; @@ -56,15 +54,12 @@ protected: AVCodecID mCodecID; private: - void ProcessDecode(MediaRawData* aSample); - virtual MediaResult DoDecode(MediaRawData* aSample) = 0; - virtual void ProcessDrain() = 0; + virtual RefPtr ProcessDecode(MediaRawData* aSample) = 0; + virtual RefPtr ProcessDrain() = 0; static StaticMutex sMonitor; const RefPtr mTaskQueue; - // Set/cleared on reader thread calling Flush() to indicate that output is - // not required and so input samples on mTaskQueue need not be processed. - Atomic mIsFlushing; + MozPromiseHolder mPromise; }; } // namespace mozilla diff --git a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h index 4fc8ca72df81..92f5d4757821 100644 --- a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h +++ b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h @@ -43,7 +43,6 @@ public: RefPtr decoder = new FFmpegVideoDecoder(mLib, aParams.mTaskQueue, - aParams.mCallback, aParams.VideoConfig(), aParams.mImageContainer); return decoder.forget(); @@ -55,7 +54,6 @@ public: RefPtr decoder = new FFmpegAudioDecoder(mLib, aParams.mTaskQueue, - aParams.mCallback, aParams.AudioConfig()); return decoder.forget(); } diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp index 227605d3776e..086a6b8cbff3 100644 --- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp @@ -102,10 +102,8 @@ FFmpegVideoDecoder::PtsCorrectionContext::Reset() } FFmpegVideoDecoder::FFmpegVideoDecoder(FFmpegLibWrapper* aLib, - TaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, - const VideoInfo& aConfig, - ImageContainer* aImageContainer) - : FFmpegDataDecoder(aLib, aTaskQueue, aCallback, GetCodecId(aConfig.mMimeType)) + TaskQueue* aTaskQueue, const VideoInfo& aConfig, ImageContainer* aImageContainer) + : FFmpegDataDecoder(aLib, aTaskQueue, GetCodecId(aConfig.mMimeType)) , mImageContainer(aImageContainer) , mInfo(aConfig) , mCodecParser(nullptr) @@ -161,15 +159,21 @@ FFmpegVideoDecoder::InitCodecContext() } } -MediaResult -FFmpegVideoDecoder::DoDecode(MediaRawData* aSample) +RefPtr +FFmpegVideoDecoder::ProcessDecode(MediaRawData* aSample) { bool gotFrame = false; - return DoDecode(aSample, &gotFrame); + DecodedData results; + MediaResult rv = DoDecode(aSample, &gotFrame, results); + if (NS_FAILED(rv)) { + return DecodePromise::CreateAndReject(rv, __func__); + } + return DecodePromise::CreateAndResolve(Move(results), __func__); } MediaResult -FFmpegVideoDecoder::DoDecode(MediaRawData* aSample, bool* aGotFrame) +FFmpegVideoDecoder::DoDecode(MediaRawData* aSample, bool* aGotFrame, + MediaDataDecoder::DecodedData& aResults) { uint8_t* inputData = const_cast(aSample->Data()); size_t inputSize = aSample->Size(); @@ -194,7 +198,7 @@ FFmpegVideoDecoder::DoDecode(MediaRawData* aSample, bool* aGotFrame) inputSize -= len; if (size) { bool gotFrame = false; - MediaResult rv = DoDecode(aSample, data, size, &gotFrame); + MediaResult rv = DoDecode(aSample, data, size, &gotFrame, aResults); if (NS_FAILED(rv)) { return rv; } @@ -206,13 +210,14 @@ FFmpegVideoDecoder::DoDecode(MediaRawData* aSample, bool* aGotFrame) return NS_OK; } #endif - return DoDecode(aSample, inputData, inputSize, aGotFrame); + return DoDecode(aSample, inputData, inputSize, aGotFrame, aResults); } MediaResult FFmpegVideoDecoder::DoDecode(MediaRawData* aSample, uint8_t* aData, int aSize, - bool* aGotFrame) + bool* aGotFrame, + MediaDataDecoder::DecodedData& aResults) { AVPacket packet; mLib->av_init_packet(&packet); @@ -337,29 +342,31 @@ FFmpegVideoDecoder::DoDecode(MediaRawData* aSample, return MediaResult(NS_ERROR_OUT_OF_MEMORY, RESULT_DETAIL("image allocation error")); } - mCallback->Output(v); + aResults.AppendElement(Move(v)); if (aGotFrame) { *aGotFrame = true; } return NS_OK; } -void +RefPtr FFmpegVideoDecoder::ProcessDrain() { RefPtr empty(new MediaRawData()); empty->mTimecode = mLastInputDts; bool gotFrame = false; - while (NS_SUCCEEDED(DoDecode(empty, &gotFrame)) && gotFrame); - mCallback->DrainComplete(); + DecodedData results; + while (NS_SUCCEEDED(DoDecode(empty, &gotFrame, results)) && gotFrame) { + } + return DecodePromise::CreateAndResolve(Move(results), __func__); } -void +RefPtr FFmpegVideoDecoder::ProcessFlush() { mPtsContext.Reset(); mDurationMap.Clear(); - FFmpegDataDecoder::ProcessFlush(); + return FFmpegDataDecoder::ProcessFlush(); } FFmpegVideoDecoder::~FFmpegVideoDecoder() diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h index 786df0da1afa..70761262c6d6 100644 --- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h @@ -28,7 +28,6 @@ class FFmpegVideoDecoder : public FFmpegDataDecoder public: FFmpegVideoDecoder(FFmpegLibWrapper* aLib, TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback, const VideoInfo& aConfig, ImageContainer* aImageContainer); virtual ~FFmpegVideoDecoder(); @@ -46,11 +45,11 @@ public: static AVCodecID GetCodecId(const nsACString& aMimeType); private: - MediaResult DoDecode(MediaRawData* aSample) override; - MediaResult DoDecode(MediaRawData* aSample, bool* aGotFrame); - MediaResult DoDecode(MediaRawData* aSample, uint8_t* aData, int aSize, bool* aGotFrame); - void ProcessDrain() override; - void ProcessFlush() override; + RefPtr ProcessDecode(MediaRawData* aSample) override; + RefPtr ProcessDrain() override; + RefPtr ProcessFlush() override; + MediaResult DoDecode(MediaRawData* aSample, bool* aGotFrame, DecodedData& aResults); + MediaResult DoDecode(MediaRawData* aSample, uint8_t* aData, int aSize, bool* aGotFrame, DecodedData& aResults); void OutputDelayedFrames(); /** diff --git a/dom/media/platforms/omx/GonkOmxPlatformLayer.cpp b/dom/media/platforms/omx/GonkOmxPlatformLayer.cpp index 870566cf5876..390bb6556ae5 100644 --- a/dom/media/platforms/omx/GonkOmxPlatformLayer.cpp +++ b/dom/media/platforms/omx/GonkOmxPlatformLayer.cpp @@ -134,7 +134,8 @@ public: : mTaskQueue(aTaskQueue) , mPromiseLayer(aPromiseLayer) , mClient(aDataDecoder) - {} + { + } protected: RefPtr mTaskQueue; diff --git a/dom/media/platforms/omx/OmxDataDecoder.cpp b/dom/media/platforms/omx/OmxDataDecoder.cpp index 886c7bb5d2d3..6c0f48faf15e 100644 --- a/dom/media/platforms/omx/OmxDataDecoder.cpp +++ b/dom/media/platforms/omx/OmxDataDecoder.cpp @@ -96,10 +96,8 @@ protected: }; OmxDataDecoder::OmxDataDecoder(const TrackInfo& aTrackInfo, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer) - : mMonitor("OmxDataDecoder") - , mOmxTaskQueue(CreateMediaDecodeTaskQueue()) + : mOmxTaskQueue(CreateMediaDecodeTaskQueue()) , mImageContainer(aImageContainer) , mWatchManager(this, mOmxTaskQueue) , mOmxState(OMX_STATETYPE::OMX_StateInvalid, "OmxDataDecoder::mOmxState") @@ -108,12 +106,9 @@ OmxDataDecoder::OmxDataDecoder(const TrackInfo& aTrackInfo, , mShuttingDown(false) , mCheckingInputExhausted(false) , mPortSettingsChanged(-1, "OmxDataDecoder::mPortSettingsChanged") - , mCallback(aCallback) { LOG(""); mOmxLayer = new OmxPromiseLayer(mOmxTaskQueue, this, aImageContainer); - - mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::InitializationTask)); } OmxDataDecoder::~OmxDataDecoder() @@ -134,17 +129,16 @@ OmxDataDecoder::EndOfStream() LOG(""); MOZ_ASSERT(mOmxTaskQueue->IsCurrentThreadIn()); - mFlushing = true; RefPtr self = this; mOmxLayer->SendCommand(OMX_CommandFlush, OMX_ALL, nullptr) - ->Then(mReaderTaskQueue, __func__, - [self] () { - self->mFlushing = false; - self->mCallback->DrainComplete(); + ->Then(mOmxTaskQueue, __func__, + [self, this] () { + mDrainPromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); }, - [self] () { - self->mFlushing = false; - self->mCallback->DrainComplete(); + [self, this] () { + mDrainPromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); }); } @@ -152,101 +146,82 @@ RefPtr OmxDataDecoder::Init() { LOG(""); - mReaderTaskQueue = AbstractThread::GetCurrent()->AsTaskQueue(); - MOZ_ASSERT(mReaderTaskQueue); - RefPtr p = mInitPromise.Ensure(__func__); RefPtr self = this; + return InvokeAsync(mOmxTaskQueue, __func__, [self, this]() { + InitializationTask(); - // TODO: it needs to get permission from resource manager before allocating - // Omx component. - InvokeAsync(mOmxTaskQueue, mOmxLayer.get(), __func__, - &OmxPromiseLayer::Init, mTrackInfo.get()) - ->Then(mOmxTaskQueue, __func__, - [self] () { - // Omx state should be OMX_StateIdle. - self->mOmxState = self->mOmxLayer->GetState(); - MOZ_ASSERT(self->mOmxState != OMX_StateIdle); - }, - [self] () { - self->RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - }); - - return p; + RefPtr p = mInitPromise.Ensure(__func__); + mOmxLayer->Init(mTrackInfo.get()) + ->Then(mOmxTaskQueue, __func__, + [self, this]() { + // Omx state should be OMX_StateIdle. + mOmxState = mOmxLayer->GetState(); + MOZ_ASSERT(mOmxState != OMX_StateIdle); + }, + [self, this]() { + RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + }); + return p; + }); } -void -OmxDataDecoder::Input(MediaRawData* aSample) +RefPtr +OmxDataDecoder::Decode(MediaRawData* aSample) { LOG("sample %p", aSample); MOZ_ASSERT(mInitPromise.IsEmpty()); RefPtr self = this; RefPtr sample = aSample; + return InvokeAsync(mOmxTaskQueue, __func__, [self, this, sample]() { + RefPtr p = mDecodePromise.Ensure(__func__); + mMediaRawDatas.AppendElement(Move(sample)); - nsCOMPtr r = - NS_NewRunnableFunction([self, sample] () { - self->mMediaRawDatas.AppendElement(sample); - - // Start to fill/empty buffers. - if (self->mOmxState == OMX_StateIdle || - self->mOmxState == OMX_StateExecuting) { - self->FillAndEmptyBuffers(); - } - }); - mOmxTaskQueue->Dispatch(r.forget()); + // Start to fill/empty buffers. + if (mOmxState == OMX_StateIdle || + mOmxState == OMX_StateExecuting) { + FillAndEmptyBuffers(); + } + return p; + }); } -void +RefPtr OmxDataDecoder::Flush() { LOG(""); mFlushing = true; - mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::DoFlush)); - - // According to the definition of Flush() in PDM: - // "the decoder must be ready to accept new input for decoding". - // So it needs to wait for the Omx to complete the flush command. - MonitorAutoLock lock(mMonitor); - while (mFlushing) { - lock.Wait(); - } + return InvokeAsync(mOmxTaskQueue, this, __func__, &OmxDataDecoder::DoFlush); } -void +RefPtr OmxDataDecoder::Drain() { LOG(""); - mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::SendEosBuffer)); + RefPtr self = this; + return InvokeAsync(mOmxTaskQueue, __func__, [self, this]() { + RefPtr p = mDrainPromise.Ensure(__func__); + SendEosBuffer(); + return p; + }); } -void +RefPtr OmxDataDecoder::Shutdown() { LOG(""); mShuttingDown = true; - mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::DoAsyncShutdown)); - - { - // DoAsyncShutdown() will be running for a while, it could be still running - // when reader releasing the decoder and then it causes problem. To avoid it, - // Shutdown() must block until DoAsyncShutdown() is completed. - MonitorAutoLock lock(mMonitor); - while (mShuttingDown) { - lock.Wait(); - } - } - - mOmxTaskQueue->BeginShutdown(); - mOmxTaskQueue->AwaitShutdownAndIdle(); + return InvokeAsync(mOmxTaskQueue, this, __func__, + &OmxDataDecoder::DoAsyncShutdown); } -void +RefPtr OmxDataDecoder::DoAsyncShutdown() { LOG(""); @@ -297,9 +272,10 @@ OmxDataDecoder::DoAsyncShutdown() self->mOmxLayer = nullptr; self->mMediaDataHelper = nullptr; - MonitorAutoLock lock(self->mMonitor); self->mShuttingDown = false; - self->mMonitor.Notify(); + self->mOmxTaskQueue->BeginShutdown(); + self->mOmxTaskQueue->AwaitShutdownAndIdle(); + self->mShutdownPromise.Resolve(true, __func__); }, [self] () { self->mOmxLayer->Shutdown(); @@ -307,10 +283,12 @@ OmxDataDecoder::DoAsyncShutdown() self->mOmxLayer = nullptr; self->mMediaDataHelper = nullptr; - MonitorAutoLock lock(self->mMonitor); self->mShuttingDown = false; - self->mMonitor.Notify(); + self->mOmxTaskQueue->BeginShutdown(); + self->mOmxTaskQueue->AwaitShutdownAndIdle(); + self->mShutdownPromise.Resolve(true, __func__); }); + return mShutdownPromise.Ensure(__func__); } void @@ -378,7 +356,7 @@ OmxDataDecoder::Output(BufferData* aData) aData->mStatus = BufferData::BufferStatus::FREE; } - mCallback->Output(data); + mDecodedData.AppendElement(Move(data)); } void @@ -390,6 +368,7 @@ OmxDataDecoder::FillBufferFailure(OmxBufferFailureHolder aFailureHolder) void OmxDataDecoder::EmptyBufferDone(BufferData* aData) { + MOZ_ASSERT(mOmxTaskQueue->IsCurrentThreadIn()); MOZ_ASSERT(!aData || aData->mStatus == BufferData::BufferStatus::OMX_CLIENT); // Nothing to do when status of input buffer is OMX_CLIENT. @@ -403,19 +382,16 @@ OmxDataDecoder::EmptyBufferDone(BufferData* aData) mCheckingInputExhausted = true; RefPtr self = this; - nsCOMPtr r = - NS_NewRunnableFunction([self] () { - MOZ_ASSERT(self->mOmxTaskQueue->IsCurrentThreadIn()); + nsCOMPtr r = NS_NewRunnableFunction([self, this]() { + mCheckingInputExhausted = false; - self->mCheckingInputExhausted = false; + if (mMediaRawDatas.Length()) { + return; + } - if (self->mMediaRawDatas.Length()) { - return; - } - - LOGL("Call InputExhausted()"); - self->mCallback->InputExhausted(); - }); + mDecodePromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); + }); mOmxTaskQueue->Dispatch(r.forget()); } @@ -431,7 +407,10 @@ void OmxDataDecoder::NotifyError(OMX_ERRORTYPE aOmxError, const char* aLine, const MediaResult& aError) { LOG("NotifyError %d (%d) at %s", aOmxError, aError.Code(), aLine); - mCallback->Error(aError); + mDecodedData.Clear(); + mDecodePromise.RejectIfExists(aError, __func__); + mDrainPromise.RejectIfExists(aError, __func__); + mFlushPromise.RejectIfExists(aError, __func__); } void @@ -538,26 +517,16 @@ OmxDataDecoder::GetBuffers(OMX_DIRTYPE aType) void OmxDataDecoder::ResolveInitPromise(const char* aMethodName) { + MOZ_ASSERT(mOmxTaskQueue->IsCurrentThreadIn()); LOG("called from %s", aMethodName); - RefPtr self = this; - nsCOMPtr r = - NS_NewRunnableFunction([self, aMethodName] () { - MOZ_ASSERT(self->mReaderTaskQueue->IsCurrentThreadIn()); - self->mInitPromise.ResolveIfExists(self->mTrackInfo->GetType(), aMethodName); - }); - mReaderTaskQueue->Dispatch(r.forget()); + mInitPromise.ResolveIfExists(mTrackInfo->GetType(), aMethodName); } void OmxDataDecoder::RejectInitPromise(MediaResult aError, const char* aMethodName) { - RefPtr self = this; - nsCOMPtr r = - NS_NewRunnableFunction([self, aError, aMethodName] () { - MOZ_ASSERT(self->mReaderTaskQueue->IsCurrentThreadIn()); - self->mInitPromise.RejectIfExists(aError, aMethodName); - }); - mReaderTaskQueue->Dispatch(r.forget()); + MOZ_ASSERT(mOmxTaskQueue->IsCurrentThreadIn()); + mInitPromise.RejectIfExists(aError, aMethodName); } void @@ -862,17 +831,25 @@ OmxDataDecoder::SendEosBuffer() FillAndEmptyBuffers(); } -void +RefPtr OmxDataDecoder::DoFlush() { MOZ_ASSERT(mOmxTaskQueue->IsCurrentThreadIn()); + mDecodedData.Clear(); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + + RefPtr p = mFlushPromise.Ensure(__func__); + // 1. Call OMX command OMX_CommandFlush in Omx TaskQueue. // 2. Remove all elements in mMediaRawDatas when flush is completed. mOmxLayer->SendCommand(OMX_CommandFlush, OMX_ALL, nullptr) ->Then(mOmxTaskQueue, __func__, this, &OmxDataDecoder::FlushComplete, &OmxDataDecoder::FlushFailure); + + return p; } void @@ -881,18 +858,14 @@ OmxDataDecoder::FlushComplete(OMX_COMMANDTYPE aCommandType) mMediaRawDatas.Clear(); mFlushing = false; - MonitorAutoLock lock(mMonitor); - mMonitor.Notify(); LOG("Flush complete"); + mFlushPromise.ResolveIfExists(true, __func__); } void OmxDataDecoder::FlushFailure(OmxCommandFailureHolder aFailureHolder) { - NotifyError(OMX_ErrorUndefined, __func__); mFlushing = false; - - MonitorAutoLock lock(mMonitor); - mMonitor.Notify(); + mFlushPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); } MediaDataHelper::MediaDataHelper(const TrackInfo* aTrackInfo, diff --git a/dom/media/platforms/omx/OmxDataDecoder.h b/dom/media/platforms/omx/OmxDataDecoder.h index ea75b2a2ac75..3d0429529610 100644 --- a/dom/media/platforms/omx/OmxDataDecoder.h +++ b/dom/media/platforms/omx/OmxDataDecoder.h @@ -61,18 +61,13 @@ protected: public: OmxDataDecoder(const TrackInfo& aTrackInfo, - MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer); RefPtr Init() override; - - void Input(MediaRawData* aSample) override; - - void Flush() override; - - void Drain() override; - - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; const char* GetDescriptionName() const override { @@ -131,9 +126,9 @@ protected: OMX_DIRTYPE GetPortDirection(uint32_t aPortIndex); - void DoAsyncShutdown(); + RefPtr DoAsyncShutdown(); - void DoFlush(); + RefPtr DoFlush(); void FlushComplete(OMX_COMMANDTYPE aCommandType); @@ -151,13 +146,9 @@ protected: RefPtr CollectBufferPromises(OMX_DIRTYPE aType); - Monitor mMonitor; - // The Omx TaskQueue. RefPtr mOmxTaskQueue; - RefPtr mReaderTaskQueue; - RefPtr mImageContainer; WatchManager mWatchManager; @@ -172,16 +163,24 @@ protected: // It is accessed in both omx and reader TaskQueue. Atomic mFlushing; - // It is accessed in Omx/reader TaskQeueu. + // It is accessed in Omx/reader TaskQueue. Atomic mShuttingDown; // It is accessed in Omx TaskQeueu. bool mCheckingInputExhausted; - // It is accessed in reader TaskQueue. + // It is accessed in OMX TaskQueue. MozPromiseHolder mInitPromise; + MozPromiseHolder mDecodePromise; + MozPromiseHolder mDrainPromise; + MozPromiseHolder mFlushPromise; + MozPromiseHolder mShutdownPromise; + // Where decoded samples will be stored until the decode promise is resolved. + DecodedData mDecodedData; - // It is written in Omx TaskQeueu. Read in Omx TaskQueue. + void CompleteDrain(); + + // It is written in Omx TaskQueue. Read in Omx TaskQueue. // It value means the port index which port settings is changed. // -1 means no port setting changed. // @@ -197,8 +196,6 @@ protected: BUFFERLIST mOutPortBuffers; RefPtr mMediaDataHelper; - - MediaDataDecoderCallback* mCallback; }; template diff --git a/dom/media/platforms/omx/OmxDecoderModule.cpp b/dom/media/platforms/omx/OmxDecoderModule.cpp index 9a3c2f929a6c..170f7029d031 100644 --- a/dom/media/platforms/omx/OmxDecoderModule.cpp +++ b/dom/media/platforms/omx/OmxDecoderModule.cpp @@ -15,7 +15,6 @@ already_AddRefed OmxDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) { RefPtr decoder = new OmxDataDecoder(aParams.mConfig, - aParams.mCallback, aParams.mImageContainer); return decoder.forget(); } @@ -24,7 +23,6 @@ already_AddRefed OmxDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) { RefPtr decoder = new OmxDataDecoder(aParams.mConfig, - aParams.mCallback, nullptr); return decoder.forget(); } diff --git a/dom/media/platforms/wmf/WMFAudioMFTManager.h b/dom/media/platforms/wmf/WMFAudioMFTManager.h index 84981dc6af9c..e294b234dc41 100644 --- a/dom/media/platforms/wmf/WMFAudioMFTManager.h +++ b/dom/media/platforms/wmf/WMFAudioMFTManager.h @@ -16,7 +16,8 @@ extern const GUID CLSID_WebmMfVpxDec; namespace mozilla { -class WMFAudioMFTManager : public MFTManager { +class WMFAudioMFTManager : public MFTManager +{ public: explicit WMFAudioMFTManager(const AudioInfo& aConfig); ~WMFAudioMFTManager(); @@ -28,12 +29,12 @@ public: // Note WMF's AAC decoder sometimes output negatively timestamped samples, // presumably they're the preroll samples, and we strip them. We may return // a null aOutput in this case. - HRESULT Output(int64_t aStreamOffset, - RefPtr& aOutput) override; + HRESULT Output(int64_t aStreamOffset, RefPtr& aOutput) override; void Shutdown() override; - TrackInfo::TrackType GetType() override { + TrackInfo::TrackType GetType() override + { return TrackInfo::kAudioTrack; } @@ -43,7 +44,6 @@ public: } private: - HRESULT UpdateOutputType(); uint32_t mAudioChannels; @@ -57,7 +57,8 @@ private: // discontinuity. int64_t mAudioFrameSum; - enum StreamType { + enum StreamType + { Unknown, AAC, MP3 diff --git a/dom/media/platforms/wmf/WMFDecoderModule.cpp b/dom/media/platforms/wmf/WMFDecoderModule.cpp index 13ec48eb5a83..8d5c5b053c3f 100644 --- a/dom/media/platforms/wmf/WMFDecoderModule.cpp +++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp @@ -95,7 +95,7 @@ WMFDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) } RefPtr decoder = - new WMFMediaDataDecoder(manager.forget(), aParams.mTaskQueue, aParams.mCallback); + new WMFMediaDataDecoder(manager.forget(), aParams.mTaskQueue); return decoder.forget(); } @@ -110,7 +110,7 @@ WMFDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) } RefPtr decoder = - new WMFMediaDataDecoder(manager.forget(), aParams.mTaskQueue, aParams.mCallback); + new WMFMediaDataDecoder(manager.forget(), aParams.mTaskQueue); return decoder.forget(); } diff --git a/dom/media/platforms/wmf/WMFDecoderModule.h b/dom/media/platforms/wmf/WMFDecoderModule.h index cd7b8c6609a9..9746ba29c91e 100644 --- a/dom/media/platforms/wmf/WMFDecoderModule.h +++ b/dom/media/platforms/wmf/WMFDecoderModule.h @@ -11,7 +11,8 @@ namespace mozilla { -class WMFDecoderModule : public PlatformDecoderModule { +class WMFDecoderModule : public PlatformDecoderModule +{ public: WMFDecoderModule(); virtual ~WMFDecoderModule(); diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp index f23ec0be6e94..079df6b4aa3f 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp @@ -18,12 +18,9 @@ namespace mozilla { WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager, - TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback) + TaskQueue* aTaskQueue) : mTaskQueue(aTaskQueue) - , mCallback(aCallback) , mMFTManager(aMFTManager) - , mIsFlushing(false) , mIsShutDown(false) { } @@ -72,20 +69,21 @@ SendTelemetry(unsigned long hr) NS_DispatchToMainThread(runnable); } -void +RefPtr WMFMediaDataDecoder::Shutdown() { MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown); - if (mTaskQueue) { - mTaskQueue->Dispatch(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown)); - } else { - ProcessShutdown(); - } mIsShutDown = true; + + if (mTaskQueue) { + return InvokeAsync(mTaskQueue, this, __func__, + &WMFMediaDataDecoder::ProcessShutdown); + } + return ProcessShutdown(); } -void +RefPtr WMFMediaDataDecoder::ProcessShutdown() { if (mMFTManager) { @@ -95,31 +93,23 @@ WMFMediaDataDecoder::ProcessShutdown() SendTelemetry(S_OK); } } + return ShutdownPromise::CreateAndResolve(true, __func__); } // Inserts data into the decoder's pipeline. -void -WMFMediaDataDecoder::Input(MediaRawData* aSample) +RefPtr +WMFMediaDataDecoder::Decode(MediaRawData* aSample) { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown); - nsCOMPtr runnable = - NewRunnableMethod>( - this, - &WMFMediaDataDecoder::ProcessDecode, - RefPtr(aSample)); - mTaskQueue->Dispatch(runnable.forget()); + return InvokeAsync(mTaskQueue, this, __func__, + &WMFMediaDataDecoder::ProcessDecode, + aSample); } -void +RefPtr WMFMediaDataDecoder::ProcessDecode(MediaRawData* aSample) { - if (mIsFlushing) { - // Skip sample, to be released by runnable. - return; - } - HRESULT hr = mMFTManager->Input(aSample); if (hr == MF_E_NOTACCEPTING) { ProcessOutput(); @@ -128,18 +118,21 @@ WMFMediaDataDecoder::ProcessDecode(MediaRawData* aSample) if (FAILED(hr)) { NS_WARNING("MFTManager rejected sample"); - mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("MFTManager::Input:%x", hr))); if (!mRecordedError) { SendTelemetry(hr); mRecordedError = true; } - return; + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("MFTManager::Input:%x", hr)), + __func__); } mLastStreamOffset = aSample->mOffset; + RefPtr p = mDecodePromise.Ensure(__func__); ProcessOutput(); + return p; } void @@ -147,17 +140,31 @@ WMFMediaDataDecoder::ProcessOutput() { RefPtr output; HRESULT hr = S_OK; + DecodedData results; while (SUCCEEDED(hr = mMFTManager->Output(mLastStreamOffset, output)) && output) { mHasSuccessfulOutput = true; - mCallback->Output(output); + results.AppendElement(Move(output)); } if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { - mCallback->InputExhausted(); - } else if (FAILED(hr)) { + if (!mDecodePromise.IsEmpty()) { + mDecodePromise.Resolve(Move(results), __func__); + } else { + mDrainPromise.Resolve(Move(results), __func__); + } + return; + } + if (FAILED(hr)) { NS_WARNING("WMFMediaDataDecoder failed to output data"); - mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("MFTManager::Output:%x", hr))); + const auto error = MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL("MFTManager::Output:%x", hr)); + if (!mDecodePromise.IsEmpty()) { + mDecodePromise.Reject(error, __func__); + } + else { + mDrainPromise.Reject(error, __func__); + } + if (!mRecordedError) { SendTelemetry(hr); mRecordedError = true; @@ -165,46 +172,45 @@ WMFMediaDataDecoder::ProcessOutput() } } -void +RefPtr WMFMediaDataDecoder::ProcessFlush() { if (mMFTManager) { mMFTManager->Flush(); } + return FlushPromise::CreateAndResolve(true, __func__); } -void +RefPtr WMFMediaDataDecoder::Flush() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown); - mIsFlushing = true; - nsCOMPtr runnable = - NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessFlush); - SyncRunnable::DispatchToThread(mTaskQueue, runnable); - mIsFlushing = false; + return InvokeAsync(mTaskQueue, this, __func__, + &WMFMediaDataDecoder::ProcessFlush); } -void +RefPtr WMFMediaDataDecoder::ProcessDrain() { - if (!mIsFlushing && mMFTManager) { - // Order the decoder to drain... - mMFTManager->Drain(); - // Then extract all available output. - ProcessOutput(); + if (!mMFTManager) { + return DecodePromise::CreateAndResolve(DecodedData(), __func__); } - mCallback->DrainComplete(); + // Order the decoder to drain... + mMFTManager->Drain(); + // Then extract all available output. + RefPtr p = mDrainPromise.Ensure(__func__); + ProcessOutput(); + return p; } -void +RefPtr WMFMediaDataDecoder::Drain() { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown); - mTaskQueue->Dispatch(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessDrain)); + return InvokeAsync(mTaskQueue, this, __func__, + &WMFMediaDataDecoder::ProcessDrain); } bool @@ -217,7 +223,6 @@ WMFMediaDataDecoder::IsHardwareAccelerated(nsACString& aFailureReason) const { void WMFMediaDataDecoder::SetSeekThreshold(const media::TimeUnit& aTime) { - MOZ_ASSERT(mCallback->OnReaderTaskQueue()); MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown); RefPtr self = this; diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.h b/dom/media/platforms/wmf/WMFMediaDataDecoder.h index a4dd49f56fe7..fc28758fd329 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.h +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.h @@ -19,7 +19,8 @@ namespace mozilla { // Encapsulates the initialization of the MFTDecoder appropriate for decoding // a given stream, and the process of converting the IMFSample produced // by the MFT into a MediaData object. -class MFTManager { +class MFTManager +{ public: virtual ~MFTManager() {} @@ -59,7 +60,8 @@ public: virtual const char* GetDescriptionName() const = 0; - virtual void SetSeekThreshold(const media::TimeUnit& aTime) { + virtual void SetSeekThreshold(const media::TimeUnit& aTime) + { mSeekTargetThreshold = Some(aTime); } @@ -75,22 +77,22 @@ protected: // the higher-level logic that drives mapping the MFT to the async // MediaDataDecoder interface. The specifics of decoding the exact stream // type are handled by MFTManager and the MFTDecoder it creates. -class WMFMediaDataDecoder : public MediaDataDecoder { +class WMFMediaDataDecoder : public MediaDataDecoder +{ public: WMFMediaDataDecoder(MFTManager* aOutputSource, - TaskQueue* aTaskQueue, - MediaDataDecoderCallback* aCallback); + TaskQueue* aTaskQueue); ~WMFMediaDataDecoder(); RefPtr Init() override; - void Input(MediaRawData* aSample); + RefPtr Decode(MediaRawData* aSample) override; - void Flush() override; + RefPtr Drain() override; - void Drain() override; + RefPtr Flush() override; - void Shutdown() override; + RefPtr Shutdown() override; bool IsHardwareAccelerated(nsACString& aFailureReason) const override; @@ -105,7 +107,7 @@ private: // Called on the task queue. Inserts the sample into the decoder, and // extracts output if available. - void ProcessDecode(MediaRawData* aSample); + RefPtr ProcessDecode(MediaRawData* aSample); // Called on the task queue. Extracts output if available, and delivers // it to the reader. Called after ProcessDecode() and ProcessDrain(). @@ -113,16 +115,15 @@ private: // Called on the task queue. Orders the MFT to flush. There is no output to // extract. - void ProcessFlush(); + RefPtr ProcessFlush(); // Called on the task queue. Orders the MFT to drain, and then extracts // all available output. - void ProcessDrain(); + RefPtr ProcessDrain(); - void ProcessShutdown(); + RefPtr ProcessShutdown(); const RefPtr mTaskQueue; - MediaDataDecoderCallback* mCallback; nsAutoPtr mMFTManager; @@ -130,13 +131,11 @@ private: // This is used to approximate the decoder's position in the media resource. int64_t mLastStreamOffset; - // Set on reader/decode thread calling Flush() to indicate that output is - // not required and so input samples on mTaskQueue need not be processed. - // Cleared on mTaskQueue. - Atomic mIsFlushing; - bool mIsShutDown; + MozPromiseHolder mDecodePromise; + MozPromiseHolder mDrainPromise; + // For telemetry bool mHasSuccessfulOutput = false; bool mRecordedError = false; diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.h b/dom/media/platforms/wmf/WMFVideoMFTManager.h index b8dfa63365d6..99331982c8b2 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.h +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.h @@ -43,8 +43,8 @@ public: const char* GetDescriptionName() const override { nsCString failureReason; - return IsHardwareAccelerated(failureReason) - ? "wmf hardware video decoder" : "wmf software video decoder"; + return IsHardwareAccelerated(failureReason) ? "wmf hardware video decoder" + : "wmf software video decoder"; } void Flush() override diff --git a/dom/media/platforms/wrappers/H264Converter.cpp b/dom/media/platforms/wrappers/H264Converter.cpp index e4db5e2a72a5..06f534704074 100644 --- a/dom/media/platforms/wrappers/H264Converter.cpp +++ b/dom/media/platforms/wrappers/H264Converter.cpp @@ -23,7 +23,6 @@ H264Converter::H264Converter(PlatformDecoderModule* aPDM, , mKnowsCompositor(aParams.mKnowsCompositor) , mImageContainer(aParams.mImageContainer) , mTaskQueue(aParams.mTaskQueue) - , mCallback(aParams.mCallback) , mDecoder(nullptr) , mGMPCrashHelper(aParams.mCrashHelper) , mNeedAVCC(aPDM->DecoderNeedsConversion(aParams.mConfig) @@ -49,18 +48,19 @@ H264Converter::Init() TrackType::kVideoTrack, __func__); } -void -H264Converter::Input(MediaRawData* aSample) +RefPtr +H264Converter::Decode(MediaRawData* aSample) { - MOZ_RELEASE_ASSERT(!mInitPromiseRequest.Exists(), - "Still processing previous sample"); + MOZ_RELEASE_ASSERT(!mDecodePromiseRequest.Exists() && + !mInitPromiseRequest.Exists(), + "Can't request a new decode until previous one completed"); if (!mp4_demuxer::AnnexB::ConvertSampleToAVCC(aSample)) { // We need AVCC content to be able to later parse the SPS. // This is a no-op if the data is already AVCC. - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("ConvertSampleToAVCC"))); - return; + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, RESULT_DETAIL("ConvertSampleToAVCC")), + __func__); } nsresult rv; @@ -72,8 +72,7 @@ H264Converter::Input(MediaRawData* aSample) if (rv == NS_ERROR_NOT_INITIALIZED) { // We are missing the required SPS to create the decoder. // Ignore for the time being, the MediaRawData will be dropped. - mCallback->InputExhausted(); - return; + return DecodePromise::CreateAndResolve(DecodedData(), __func__); } } else { rv = CheckForSPSChange(aSample); @@ -81,63 +80,66 @@ H264Converter::Input(MediaRawData* aSample) if (rv == NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER) { // The decoder is pending initialization. - return; + RefPtr p = mDecodePromise.Ensure(__func__); + return p; } if (NS_FAILED(rv)) { - mCallback->Error( + return DecodePromise::CreateAndReject( MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Unable to create H264 decoder"))); - return; + RESULT_DETAIL("Unable to create H264 decoder")), + __func__); } if (mNeedKeyframe && !aSample->mKeyframe) { - mCallback->InputExhausted(); - return; + return DecodePromise::CreateAndResolve(DecodedData(), __func__); } if (!mNeedAVCC && !mp4_demuxer::AnnexB::ConvertSampleToAnnexB(aSample, mNeedKeyframe)) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("ConvertSampleToAnnexB"))); - return; + return DecodePromise::CreateAndReject( + MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("ConvertSampleToAnnexB")), + __func__); } mNeedKeyframe = false; aSample->mExtraData = mCurrentConfig.mExtraData; - mDecoder->Input(aSample); + return mDecoder->Decode(aSample); } -void +RefPtr H264Converter::Flush() { mNeedKeyframe = true; if (mDecoder) { - mDecoder->Flush(); + return mDecoder->Flush(); } + return FlushPromise::CreateAndResolve(true, __func__); } -void +RefPtr H264Converter::Drain() { mNeedKeyframe = true; if (mDecoder) { - mDecoder->Drain(); - return; + return mDecoder->Drain(); } - mCallback->DrainComplete(); + return DecodePromise::CreateAndResolve(DecodedData(), __func__); } -void +RefPtr H264Converter::Shutdown() { if (mDecoder) { - mDecoder->Shutdown(); mInitPromiseRequest.DisconnectIfExists(); - mDecoder = nullptr; + mDecodePromiseRequest.DisconnectIfExists(); + RefPtr decoder = mDecoder.forget(); + return decoder->Shutdown(); } + return ShutdownPromise::CreateAndResolve(true, __func__); } bool @@ -189,7 +191,6 @@ H264Converter::CreateDecoder(DecoderDoctorDiagnostics* aDiagnostics) mDecoder = mPDM->CreateVideoDecoder({ mCurrentConfig, mTaskQueue, - mCallback, aDiagnostics, mImageContainer, mKnowsCompositor, @@ -238,26 +239,39 @@ H264Converter::OnDecoderInitDone(const TrackType aTrackType) mInitPromiseRequest.Complete(); RefPtr sample = mPendingSample.forget(); if (mNeedKeyframe && !sample->mKeyframe) { - mCallback->InputExhausted(); - return; + mDecodePromise.ResolveIfExists(DecodedData(), __func__); } mNeedKeyframe = false; if (!mNeedAVCC && !mp4_demuxer::AnnexB::ConvertSampleToAnnexB(sample, mNeedKeyframe)) { - mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY, - RESULT_DETAIL("ConvertSampleToAnnexB"))); + mDecodePromise.RejectIfExists( + MediaResult(NS_ERROR_OUT_OF_MEMORY, + RESULT_DETAIL("ConvertSampleToAnnexB")), + __func__); return; } - mDecoder->Input(sample); + RefPtr self = this; + mDecoder->Decode(sample) + ->Then(AbstractThread::GetCurrent()->AsTaskQueue(), __func__, + [self, this](const MediaDataDecoder::DecodedData& aResults) { + mDecodePromiseRequest.Complete(); + mDecodePromise.ResolveIfExists(aResults, __func__); + }, + [self, this](const MediaResult& aError) { + mDecodePromiseRequest.Complete(); + mDecodePromise.RejectIfExists(aError, __func__); + }) + ->Track(mDecodePromiseRequest); } void H264Converter::OnDecoderInitFailed(const MediaResult& aError) { mInitPromiseRequest.Complete(); - mCallback->Error( + mDecodePromise.RejectIfExists( MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Unable to initialize H264 decoder"))); + RESULT_DETAIL("Unable to initialize H264 decoder")), + __func__); } nsresult diff --git a/dom/media/platforms/wrappers/H264Converter.h b/dom/media/platforms/wrappers/H264Converter.h index c995654755ec..1d0a5f8f4534 100644 --- a/dom/media/platforms/wrappers/H264Converter.h +++ b/dom/media/platforms/wrappers/H264Converter.h @@ -18,7 +18,8 @@ namespace mozilla { // H264Converter will monitor the input data, and will delay creation of the // MediaDataDecoder until a SPS and PPS NALs have been extracted. -class H264Converter : public MediaDataDecoder { +class H264Converter : public MediaDataDecoder +{ public: H264Converter(PlatformDecoderModule* aPDM, @@ -26,10 +27,10 @@ public: virtual ~H264Converter(); RefPtr Init() override; - void Input(MediaRawData* aSample) override; - void Flush() override; - void Drain() override; - void Shutdown() override; + RefPtr Decode(MediaRawData* aSample) override; + RefPtr Drain() override; + RefPtr Flush() override; + RefPtr Shutdown() override; bool IsHardwareAccelerated(nsACString& aFailureReason) const override; const char* GetDescriptionName() const override { @@ -67,9 +68,10 @@ private: RefPtr mImageContainer; const RefPtr mTaskQueue; RefPtr mPendingSample; - MediaDataDecoderCallback* mCallback; RefPtr mDecoder; MozPromiseRequestHolder mInitPromiseRequest; + MozPromiseRequestHolder mDecodePromiseRequest; + MozPromiseHolder mDecodePromise; RefPtr mGMPCrashHelper; bool mNeedAVCC; nsresult mLastError; From 5e2e07649c05d8d7de9702df7490331cbb2f6d4c Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 26 Jan 2017 18:17:15 +0100 Subject: [PATCH 17/70] Bug 1319987: P6. Shutdown demuxer asynchronously. r=gerald This prevents the demuxer attempting to use the parent resources once the parent has been shutdown. MozReview-Commit-ID: LQqPxBkAfAS --HG-- extra : rebase_source : 1a9c2e870aecb5b0ecb68d5f600c48334ac4d312 --- dom/media/MediaFormatReader.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 7792a6d6f759..ad0b2a5d5430 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -483,15 +483,21 @@ public: ~DemuxerProxy() { MOZ_COUNT_DTOR(DemuxerProxy); + } + + RefPtr Shutdown() + { mData->mAudioDemuxer = nullptr; mData->mVideoDemuxer = nullptr; RefPtr data = mData.forget(); - mTaskQueue->Dispatch( + return InvokeAsync(mTaskQueue, __func__, [data]() { // We need to clear our reference to the demuxer now. So that in the event // the init promise wasn't resolved, such as what can happen with the // mediasource demuxer that is waiting on more data, it will force the // init promise to be rejected. - NS_NewRunnableFunction([data]() { data->mDemuxer = nullptr; })); + data->mDemuxer = nullptr; + return ShutdownPromise::CreateAndResolve(true, __func__); + }); } RefPtr Init(); @@ -885,13 +891,10 @@ MediaFormatReader::Shutdown() promises.AppendElement(ShutdownDecoderWithPromise(TrackInfo::kVideoTrack)); } + promises.AppendElement(mDemuxer->Shutdown()); mDemuxer = nullptr; - mCompositorUpdatedListener.DisconnectIfExists(); - if (promises.IsEmpty()) { - TearDownDecoders(); - return MediaDecoderReader::Shutdown(); - } + mCompositorUpdatedListener.DisconnectIfExists(); RefPtr p = mShutdownPromise.Ensure(__func__); ShutdownPromise::All(OwnerThread(), promises) From e2abc1a5235a2da3ae1abefface62ef09ec97108 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 27 Jan 2017 11:48:00 +0100 Subject: [PATCH 18/70] Bug 1319987: P7. Re-implement handling for WaitingForKey in MFR. r=cpearce,gerald MozReview-Commit-ID: FCiAO54oiH3 --HG-- extra : rebase_source : 898e175742ae4db13c48cf75463a9775968b0030 --- dom/media/MediaDecoderReader.h | 15 +++++++ dom/media/MediaFormatReader.cpp | 44 +++++++++++++++++-- dom/media/MediaFormatReader.h | 7 ++- dom/media/platforms/PlatformDecoderModule.h | 10 +++++ .../agnostic/eme/EMEDecoderModule.cpp | 39 +++++++++------- .../agnostic/eme/SamplesWaitingForKey.cpp | 10 ++++- .../agnostic/eme/SamplesWaitingForKey.h | 7 ++- .../platforms/wrappers/H264Converter.cpp | 6 ++- dom/media/platforms/wrappers/H264Converter.h | 2 + 9 files changed, 116 insertions(+), 24 deletions(-) diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index 6c4356e79c60..d224abb502d1 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -243,6 +243,18 @@ public: return mOnMediaNotSeekable; } + // Notified if the reader can't decode a sample due to a missing decryption + // key. + MediaEventSource& OnTrackWaitingForKey() + { + return mOnTrackWaitingForKey; + } + + MediaEventProducer& OnTrackWaitingForKeyProducer() + { + return mOnTrackWaitingForKey; + } + // Switch the video decoder to BlankDecoderModule. It might takes effective // since a few samples later depends on how much demuxed samples are already // queued in the original video decoder. @@ -306,6 +318,9 @@ protected: // Notify if this media is not seekable. MediaEventProducer mOnMediaNotSeekable; + // Notify if we are waiting for a decryption key. + MediaEventProducer mOnTrackWaitingForKey; + private: virtual nsresult InitInternal() { return NS_OK; } diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index ad0b2a5d5430..6528406bf41f 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -389,7 +389,9 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) ownerData.mTaskQueue, mOwner->mCrashHelper, ownerData.mIsBlankDecode, - &result + &result, + aTrack, + &mOwner->OnTrackWaitingForKeyProducer() }); break; } @@ -406,7 +408,9 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) mOwner->GetImageContainer(), mOwner->mCrashHelper, ownerData.mIsBlankDecode, - &result + &result, + aTrack, + &mOwner->OnTrackWaitingForKeyProducer() }); break; } @@ -847,6 +851,8 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder, aDecoder->CompositorUpdatedEvent()->Connect( mTaskQueue, this, &MediaFormatReader::NotifyCompositorUpdated); } + mOnTrackWaitingForKeyListener = OnTrackWaitingForKey().Connect( + mTaskQueue, this, &MediaFormatReader::NotifyWaitingForKey); } MediaFormatReader::~MediaFormatReader() @@ -895,6 +901,7 @@ MediaFormatReader::Shutdown() mDemuxer = nullptr; mCompositorUpdatedListener.DisconnectIfExists(); + mOnTrackWaitingForKeyListener.Disconnect(); RefPtr p = mShutdownPromise.Ensure(__func__); ShutdownPromise::All(OwnerThread(), promises) @@ -1523,6 +1530,21 @@ MediaFormatReader::NotifyWaitingForData(TrackType aTrack) ScheduleUpdate(aTrack); } +void +MediaFormatReader::NotifyWaitingForKey(TrackType aTrack) +{ + MOZ_ASSERT(OnTaskQueue()); + auto& decoder = GetDecoderData(aTrack); + if (mDecoder) { + mDecoder->NotifyWaitingForKey(); + } + if (!decoder.mDecodeRequest.Exists()) { + LOGV("WaitingForKey received while no pending decode. Ignoring"); + } + decoder.mWaitingForKey = true; + ScheduleUpdate(aTrack); +} + void MediaFormatReader::NotifyEndOfStream(TrackType aTrack) { @@ -2013,6 +2035,10 @@ MediaFormatReader::Update(TrackType aTrack) // EOS state. We can immediately reject the data promise. LOG("Rejecting %s promise: EOS", TrackTypeToStr(aTrack)); decoder.RejectPromise(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__); + } else if (decoder.mWaitingForKey) { + LOG("Rejecting %s promise: WAITING_FOR_DATA due to waiting for key", + TrackTypeToStr(aTrack)); + decoder.RejectPromise(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA, __func__); } } @@ -2054,13 +2080,23 @@ MediaFormatReader::Update(TrackType aTrack) decoder.mWaitingForData, decoder.HasPromise(), decoder.mLastStreamSourceID); - if ((decoder.mWaitingForData && - (!decoder.mTimeThreshold || decoder.mTimeThreshold.ref().mWaiting))) { + if ((decoder.mWaitingForData + && (!decoder.mTimeThreshold || decoder.mTimeThreshold.ref().mWaiting)) + || (decoder.mWaitingForKey && decoder.mDecodeRequest.Exists())) { // Nothing more we can do at present. LOGV("Still waiting for data or key."); return; } + if (decoder.mWaitingForKey) { + decoder.mWaitingForKey = false; + if (decoder.HasWaitingPromise() && !decoder.IsWaiting()) { + LOGV("No longer waiting for key. Resolving waiting promise"); + decoder.mWaitingPromise.Resolve(decoder.mType, __func__); + return; + } + } + if (!needInput) { LOGV("No need for additional input (pending:%u)", uint32_t(decoder.mOutput.Length())); diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index c85af13da692..b217edebb0ed 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -141,6 +141,7 @@ private: void NotifyDrainComplete(TrackType aTrack); void NotifyError(TrackType aTrack, const MediaResult& aError); void NotifyWaitingForData(TrackType aTrack); + void NotifyWaitingForKey(TrackType aTrack); void NotifyEndOfStream(TrackType aTrack); void ExtractCryptoInitData(nsTArray& aInitData); @@ -170,6 +171,7 @@ private: , mUpdateScheduled(false) , mDemuxEOS(false) , mWaitingForData(false) + , mWaitingForKey(false) , mReceivedNewData(false) , mNeedDraining(false) , mDraining(false) @@ -226,6 +228,7 @@ private: bool mUpdateScheduled; bool mDemuxEOS; bool mWaitingForData; + bool mWaitingForKey; bool mReceivedNewData; // Pending seek. @@ -245,7 +248,7 @@ private: bool IsWaiting() const { MOZ_ASSERT(mOwner->OnTaskQueue()); - return mWaitingForData; + return mWaitingForData || mWaitingForKey; } // MediaDataDecoder handler's variables. @@ -373,6 +376,7 @@ private: MOZ_ASSERT(mOwner->OnTaskQueue()); mDemuxEOS = false; mWaitingForData = false; + mWaitingForKey = false; mQueuedSamples.Clear(); mNeedDraining = false; mDecodeRequest.DisconnectIfExists(); @@ -560,6 +564,7 @@ private: UniquePtr mDecoderFactory; MediaEventListener mCompositorUpdatedListener; + MediaEventListener mOnTrackWaitingForKeyListener; void OnFirstDemuxCompleted(TrackInfo::TrackType aType, RefPtr aSamples); diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index e01e55088d81..ad5b5a1cb530 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -81,6 +81,8 @@ struct MOZ_STACK_CLASS CreateDecoderParams final RefPtr mKnowsCompositor; RefPtr mCrashHelper; bool mUseBlankDecoder = false; + TrackInfo::TrackType mType = TrackInfo::kUndefinedTrack; + MediaEventProducer* mOnWaitingForKeyEvent = nullptr; private: void Set(TaskQueue* aTaskQueue) { mTaskQueue = aTaskQueue; } @@ -99,6 +101,14 @@ private: { mKnowsCompositor = aKnowsCompositor; } + void Set(TrackInfo::TrackType aType) + { + mType = aType; + } + void Set(MediaEventProducer* aOnWaitingForKey) + { + mOnWaitingForKeyEvent = aOnWaitingForKey; + } template void Set(T1&& a1, T2&& a2, Ts&&... args) { diff --git a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp index 8fdb16685e95..36f0cf352eaa 100644 --- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp +++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp @@ -27,13 +27,14 @@ extern already_AddRefed CreateBlankDecoderModule(); class EMEDecryptor : public MediaDataDecoder { public: - EMEDecryptor(MediaDataDecoder* aDecoder, - CDMProxy* aProxy, - TaskQueue* aDecodeTaskQueue) + EMEDecryptor(MediaDataDecoder* aDecoder, CDMProxy* aProxy, + TaskQueue* aDecodeTaskQueue, TrackInfo::TrackType aType, + MediaEventProducer* aOnWaitingForKey) : mDecoder(aDecoder) , mTaskQueue(aDecodeTaskQueue) , mProxy(aProxy) - , mSamplesWaitingForKey(new SamplesWaitingForKey(mProxy)) + , mSamplesWaitingForKey( + new SamplesWaitingForKey(mProxy, aType, aOnWaitingForKey)) , mIsShutdown(false) { } @@ -204,12 +205,15 @@ private: class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy { public: - EMEMediaDataDecoderProxy(already_AddRefed aProxyThread, - CDMProxy* aProxy) - : MediaDataDecoderProxy(Move(aProxyThread)) - , mTaskQueue(AbstractThread::GetCurrent()->AsTaskQueue()) - , mSamplesWaitingForKey(new SamplesWaitingForKey(aProxy)) - , mProxy(aProxy) + EMEMediaDataDecoderProxy( + already_AddRefed aProxyThread, CDMProxy* aProxy, + TrackInfo::TrackType aType, + MediaEventProducer* aOnWaitingForKey) + : MediaDataDecoderProxy(Move(aProxyThread)) + , mTaskQueue(AbstractThread::GetCurrent()->AsTaskQueue()) + , mSamplesWaitingForKey( + new SamplesWaitingForKey(aProxy, aType, aOnWaitingForKey)) + , mProxy(aProxy) { } @@ -289,7 +293,7 @@ EMEDecoderModule::~EMEDecoderModule() } static already_AddRefed -CreateDecoderWrapper(CDMProxy* aProxy) +CreateDecoderWrapper(CDMProxy* aProxy, const CreateDecoderParams& aParams) { RefPtr s(gmp::GeckoMediaPluginService::GetGeckoMediaPluginService()); if (!s) { @@ -299,8 +303,8 @@ CreateDecoderWrapper(CDMProxy* aProxy) if (!thread) { return nullptr; } - RefPtr decoder( - new EMEMediaDataDecoderProxy(thread.forget(), aProxy)); + RefPtr decoder(new EMEMediaDataDecoderProxy( + thread.forget(), aProxy, aParams.mType, aParams.mOnWaitingForKeyEvent)); return decoder.forget(); } @@ -317,7 +321,8 @@ EMEDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) if (SupportsMimeType(aParams.mConfig.mMimeType, nullptr)) { // GMP decodes. Assume that means it can decrypt too. - RefPtr wrapper = CreateDecoderWrapper(mProxy); + RefPtr wrapper = + CreateDecoderWrapper(mProxy, aParams); auto params = GMPVideoDecoderParams(aParams); wrapper->SetProxyTarget(new EMEVideoDecoder(mProxy, params)); return wrapper.forget(); @@ -330,7 +335,8 @@ EMEDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) } RefPtr emeDecoder(new EMEDecryptor( - decoder, mProxy, AbstractThread::GetCurrent()->AsTaskQueue())); + decoder, mProxy, AbstractThread::GetCurrent()->AsTaskQueue(), + aParams.mType, aParams.mOnWaitingForKeyEvent)); return emeDecoder.forget(); } @@ -355,7 +361,8 @@ EMEDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) } RefPtr emeDecoder(new EMEDecryptor( - decoder, mProxy, AbstractThread::GetCurrent()->AsTaskQueue())); + decoder, mProxy, AbstractThread::GetCurrent()->AsTaskQueue(), + aParams.mType, aParams.mOnWaitingForKeyEvent)); return emeDecoder.forget(); } diff --git a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp index c0fa9af954a4..e9dee73ea704 100644 --- a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp +++ b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp @@ -8,13 +8,18 @@ #include "mozilla/CDMCaps.h" #include "mozilla/TaskQueue.h" #include "MediaData.h" +#include "MediaEventSource.h" #include "SamplesWaitingForKey.h" namespace mozilla { -SamplesWaitingForKey::SamplesWaitingForKey(CDMProxy* aProxy) +SamplesWaitingForKey::SamplesWaitingForKey( + CDMProxy* aProxy, TrackInfo::TrackType aType, + MediaEventProducer* aOnWaitingForKey) : mMutex("SamplesWaitingForKey") , mProxy(aProxy) + , mType(aType) + , mOnWaitingForKeyEvent(aOnWaitingForKey) { } @@ -41,6 +46,9 @@ SamplesWaitingForKey::WaitIfKeyNotUsable(MediaRawData* aSample) MutexAutoLock lock(mMutex); mSamples.AppendElement(Move(entry)); } + if (mOnWaitingForKeyEvent) { + mOnWaitingForKeyEvent->Notify(mType); + } caps.NotifyWhenKeyIdUsable(aSample->mCrypto.mKeyId, this); return p; } diff --git a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h index cc4a546b4b3d..accf7cf3d540 100644 --- a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h +++ b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h @@ -10,12 +10,14 @@ #include "mozilla/MozPromise.h" #include "mozilla/Mutex.h" #include "mozilla/RefPtr.h" +#include "MediaInfo.h" namespace mozilla { typedef nsTArray CencKeyId; class CDMProxy; +template class MediaEventProducer; class MediaRawData; // Encapsulates the task of waiting for the CDMProxy to have the necessary @@ -28,7 +30,8 @@ public: typedef MozPromise, bool, /* IsExclusive = */ true> WaitForKeyPromise; - explicit SamplesWaitingForKey(CDMProxy* aProxy); + SamplesWaitingForKey(CDMProxy* aProxy, TrackInfo::TrackType aType, + MediaEventProducer* aOnWaitingForKey); // Returns a promise that will be resolved if or when a key for decoding the // sample becomes usable. @@ -50,6 +53,8 @@ private: MozPromiseHolder mPromise; }; nsTArray mSamples; + const TrackInfo::TrackType mType; + MediaEventProducer* const mOnWaitingForKeyEvent; }; } // namespace mozilla diff --git a/dom/media/platforms/wrappers/H264Converter.cpp b/dom/media/platforms/wrappers/H264Converter.cpp index 06f534704074..d7c2ef569418 100644 --- a/dom/media/platforms/wrappers/H264Converter.cpp +++ b/dom/media/platforms/wrappers/H264Converter.cpp @@ -28,6 +28,8 @@ H264Converter::H264Converter(PlatformDecoderModule* aPDM, , mNeedAVCC(aPDM->DecoderNeedsConversion(aParams.mConfig) == PlatformDecoderModule::ConversionRequired::kNeedAVCC) , mLastError(NS_OK) + , mType(aParams.mType) + , mOnWaitingForKeyEvent(aParams.mOnWaitingForKeyEvent) { CreateDecoder(aParams.mDiagnostics); } @@ -194,7 +196,9 @@ H264Converter::CreateDecoder(DecoderDoctorDiagnostics* aDiagnostics) aDiagnostics, mImageContainer, mKnowsCompositor, - mGMPCrashHelper + mGMPCrashHelper, + mType, + mOnWaitingForKeyEvent }); if (!mDecoder) { diff --git a/dom/media/platforms/wrappers/H264Converter.h b/dom/media/platforms/wrappers/H264Converter.h index 1d0a5f8f4534..2670ed046cb5 100644 --- a/dom/media/platforms/wrappers/H264Converter.h +++ b/dom/media/platforms/wrappers/H264Converter.h @@ -76,6 +76,8 @@ private: bool mNeedAVCC; nsresult mLastError; bool mNeedKeyframe = true; + const TrackInfo::TrackType mType; + MediaEventProducer* const mOnWaitingForKeyEvent; }; } // namespace mozilla From 8dcd7e8a3085337b6a7c2587bd546511d64410d0 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 27 Jan 2017 11:48:43 +0100 Subject: [PATCH 19/70] Bug 1319987: P8. Fix comment. r=gerald MozReview-Commit-ID: BXZBHdEAY8Z --HG-- extra : rebase_source : 633be1d45d5afc7e0d8f875ed6dc99a376d0bea4 --- dom/media/MediaDecoderReader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index d224abb502d1..b0128a24b1da 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -230,7 +230,7 @@ public: return mTimedMetadataEvent; } - // Notified by the OggReader during playback when chained ogg is detected. + // Notified by the OggDemuxer during playback when chained ogg is detected. MediaEventSource& OnMediaNotSeekable() { return mOnMediaNotSeekable; } TimedMetadataEventProducer& TimedMetadataProducer() From b7844bd5c3f42a714931afbea92e70f1c8f70bc1 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 27 Jan 2017 13:20:37 +0100 Subject: [PATCH 20/70] Bug 1319987: P9. More coding style fixes. r=gerald MozReview-Commit-ID: DhFRqkWQZny --HG-- extra : rebase_source : 03ed44efc83fe9cab7fc975229ac4e5746aff96b --- dom/media/AbstractMediaDecoder.h | 50 +- dom/media/Benchmark.h | 13 +- dom/media/DOMMediaStream.cpp | 2 +- dom/media/GraphDriver.cpp | 4 +- dom/media/MediaCache.cpp | 7 +- dom/media/MediaData.h | 115 ++-- dom/media/MediaDataDemuxer.h | 24 +- dom/media/MediaDecoder.cpp | 126 ++-- dom/media/MediaDecoder.h | 67 ++- dom/media/MediaDecoderReader.h | 27 +- dom/media/MediaDecoderStateMachine.cpp | 554 ++++++++++-------- dom/media/MediaDecoderStateMachine.h | 38 +- dom/media/MediaFormatReader.cpp | 301 +++++----- dom/media/MediaFormatReader.h | 27 +- dom/media/MediaInfo.h | 81 +-- dom/media/MediaRecorder.cpp | 4 +- dom/media/MediaStreamGraph.cpp | 21 +- dom/media/MediaStreamListener.cpp | 4 +- dom/media/flac/FlacDemuxer.cpp | 5 +- dom/media/mediasink/DecodedAudioDataSink.cpp | 6 +- dom/media/mediasource/ContainerParser.cpp | 3 +- dom/media/mediasource/MediaSourceDecoder.cpp | 4 +- dom/media/mediasource/MediaSourceDemuxer.cpp | 7 +- dom/media/mediasource/TrackBuffersManager.cpp | 58 +- dom/media/ogg/OggCodecState.cpp | 4 +- dom/media/webaudio/AudioBuffer.cpp | 8 +- 26 files changed, 889 insertions(+), 671 deletions(-) diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h index 0bec23f351c7..b17848ab989a 100644 --- a/dom/media/AbstractMediaDecoder.h +++ b/dom/media/AbstractMediaDecoder.h @@ -17,14 +17,13 @@ #include "nsDataHashtable.h" #include "nsThreadUtils.h" -namespace mozilla -{ +namespace mozilla { -namespace layers -{ - class ImageContainer; - class KnowsCompositor; +namespace layers { +class ImageContainer; +class KnowsCompositor; } // namespace layers + class AbstractThread; class MediaResource; class ReentrantMonitor; @@ -35,7 +34,8 @@ class GMPCrashHelper; typedef nsDataHashtable MetadataTags; -static inline bool IsCurrentThread(nsIThread* aThread) { +static inline bool IsCurrentThread(nsIThread* aThread) +{ return NS_GetCurrentThread() == aThread; } @@ -59,7 +59,10 @@ public: // Can be called on any thread. virtual void NotifyDecodedFrames(const FrameStatisticsData& aStats) = 0; - virtual AbstractCanonical* CanonicalDurationOrNull() { return nullptr; }; + virtual AbstractCanonical* CanonicalDurationOrNull() + { + return nullptr; + }; // Return an event that will be notified when data arrives in MediaResource. // MediaDecoderReader will register with this event to receive notifications @@ -74,7 +77,8 @@ public: // and we might have a new compositor. If this new compositor requires us to // recreate our decoders, then we expect the existing decoderis to return an // error independently of this. - virtual MediaEventSource>* CompositorUpdatedEvent() + virtual MediaEventSource>* + CompositorUpdatedEvent() { return nullptr; } @@ -82,7 +86,7 @@ public: // Notify the media decoder that a decryption key is required before emitting // further output. This only needs to be overridden for decoders that expect // encryption, such as the MediaSource decoder. - virtual void NotifyWaitingForKey() {} + virtual void NotifyWaitingForKey() { } // Return an event that will be notified when a decoder is waiting for a // decryption key before it can return more output. @@ -95,13 +99,12 @@ public: virtual AbstractThread* AbstractMainThread() const = 0; protected: - virtual void UpdateEstimatedMediaDuration(int64_t aDuration) {}; + virtual void UpdateEstimatedMediaDuration(int64_t aDuration) { }; public: void DispatchUpdateEstimatedMediaDuration(int64_t aDuration) { - NS_DispatchToMainThread(NewRunnableMethod(this, - &AbstractMediaDecoder::UpdateEstimatedMediaDuration, - aDuration)); + NS_DispatchToMainThread(NewRunnableMethod( + this, &AbstractMediaDecoder::UpdateEstimatedMediaDuration, aDuration)); } virtual VideoFrameContainer* GetVideoFrameContainer() = 0; @@ -112,19 +115,22 @@ public: virtual MediaDecoderOwner* GetOwner() const = 0; // Set by Reader if the current audio track can be offloaded - virtual void SetPlatformCanOffloadAudio(bool aCanOffloadAudio) {} + virtual void SetPlatformCanOffloadAudio(bool aCanOffloadAudio) { } virtual already_AddRefed GetCrashHelper() { return nullptr; } // Stack based class to assist in notifying the frame statistics of // parsed and decoded frames. Use inside video demux & decode functions // to ensure all parsed and decoded frames are reported on all return paths. - class AutoNotifyDecoded { + class AutoNotifyDecoded + { public: explicit AutoNotifyDecoded(AbstractMediaDecoder* aDecoder) : mDecoder(aDecoder) - {} - ~AutoNotifyDecoded() { + { + } + ~AutoNotifyDecoded() + { if (mDecoder) { mDecoder->NotifyDecodedFrames(mStats); } @@ -138,8 +144,12 @@ public: // Classes directly inheriting from AbstractMediaDecoder do not support // Observe and it should never be called directly. - NS_IMETHOD Observe(nsISupports *aSubject, const char * aTopic, const char16_t * aData) override - { MOZ_CRASH("Forbidden method"); return NS_OK; } + NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, + const char16_t* aData) override + { + MOZ_CRASH("Forbidden method"); + return NS_OK; + } }; } // namespace mozilla diff --git a/dom/media/Benchmark.h b/dom/media/Benchmark.h index 084fec8a39f5..0d36006f043c 100644 --- a/dom/media/Benchmark.h +++ b/dom/media/Benchmark.h @@ -24,7 +24,7 @@ class Benchmark; class BenchmarkPlayback : public QueueObject { friend class Benchmark; - explicit BenchmarkPlayback(Benchmark* aMainThreadState, MediaDataDemuxer* aDemuxer); + BenchmarkPlayback(Benchmark* aMainThreadState, MediaDataDemuxer* aDemuxer); void DemuxSamples(); void DemuxNextSample(); void MainThreadShutdown(); @@ -61,7 +61,9 @@ public: Parameters() : mFramesToMeasure(-1) , mStartupFrame(1) - , mTimeout(TimeDuration::Forever()) {} + , mTimeout(TimeDuration::Forever()) + { + } Parameters(int32_t aFramesToMeasure, uint32_t aStartupFrame, @@ -70,7 +72,9 @@ public: : mFramesToMeasure(aFramesToMeasure) , mStartupFrame(aStartupFrame) , mStopAtFrame(Some(aStopAtFrame)) - , mTimeout(aTimeout) {} + , mTimeout(aTimeout) + { + } const int32_t mFramesToMeasure; const uint32_t mStartupFrame; @@ -80,7 +84,8 @@ public: typedef MozPromise BenchmarkPromise; - explicit Benchmark(MediaDataDemuxer* aDemuxer, const Parameters& aParameters = Parameters()); + explicit Benchmark(MediaDataDemuxer* aDemuxer, + const Parameters& aParameters = Parameters()); RefPtr Run(); static void Init(); diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 8f0365781e95..64f46a96ce78 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -724,7 +724,7 @@ DOMMediaStream::CloneInternal(TrackForwardingOption aForwarding) LOG(LogLevel::Info, ("DOMMediaStream %p created clone %p, forwarding %s tracks", this, newStream.get(), aForwarding == TrackForwardingOption::ALL - ? "all" : "current")); + ? "all" : "current")); MOZ_RELEASE_ASSERT(mPlaybackStream); MOZ_RELEASE_ASSERT(mPlaybackStream->Graph()); diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 708621bae2de..7e66aefffdfc 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -67,8 +67,8 @@ void GraphDriver::SetGraphTime(GraphDriver* aPreviousDriver, STREAM_LOG(LogLevel::Debug, ("Setting previous driver: %p (%s)", aPreviousDriver, aPreviousDriver->AsAudioCallbackDriver() - ? "AudioCallbackDriver" - : "SystemClockDriver")); + ? "AudioCallbackDriver" + : "SystemClockDriver")); SetPreviousDriver(aPreviousDriver); } diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index 37399f851178..55c38f561b76 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -1526,8 +1526,8 @@ MediaCache::AllocateAndWriteBlock(MediaCacheStream* aStream, const void* aData, bo->mLastUseTime = now; stream->mBlocks[streamBlockIndex] = blockIndex; if (streamBlockIndex*BLOCK_SIZE < stream->mStreamOffset) { - bo->mClass = aMode == MediaCacheStream::MODE_PLAYBACK - ? PLAYED_BLOCK : METADATA_BLOCK; + bo->mClass = aMode == MediaCacheStream::MODE_PLAYBACK ? PLAYED_BLOCK + : METADATA_BLOCK; // This must be the most-recently-used block, since we // marked it as used now (which may be slightly bogus, but we'll // treat it as used for simplicity). @@ -1648,7 +1648,8 @@ MediaCache::NoteBlockUsage(MediaCacheStream* aStream, int32_t aBlockIndex, GetListForBlock(bo)->RemoveBlock(aBlockIndex); bo->mClass = (aMode == MediaCacheStream::MODE_METADATA || bo->mClass == METADATA_BLOCK) - ? METADATA_BLOCK : PLAYED_BLOCK; + ? METADATA_BLOCK + : PLAYED_BLOCK; // Since this is just being used now, it can definitely be at the front // of mMetadataBlocks or mPlayedBlocks GetListForBlock(bo)->AddFirstBlock(aBlockIndex); diff --git a/dom/media/MediaData.h b/dom/media/MediaData.h index 3f1dfff39f24..7b500f0a7a75 100644 --- a/dom/media/MediaData.h +++ b/dom/media/MediaData.h @@ -270,12 +270,14 @@ typedef AlignedBuffer AlignedShortBuffer; typedef AlignedBuffer AlignedAudioBuffer; // Container that holds media samples. -class MediaData { +class MediaData +{ public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaData) - enum Type { + enum Type + { AUDIO_DATA = 0, VIDEO_DATA, RAW_DATA, @@ -294,7 +296,8 @@ public: , mDuration(aDuration) , mFrames(aFrames) , mKeyframe(false) - {} + { + } // Type of contained data. const Type mType; @@ -348,7 +351,8 @@ protected: , mDuration(0) , mFrames(aFrames) , mKeyframe(false) - {} + { + } virtual ~MediaData() {} @@ -356,7 +360,8 @@ protected: // NullData is for decoder generating a sample which doesn't need to be // rendered. -class NullData : public MediaData { +class NullData : public MediaData +{ public: NullData(int64_t aOffset, int64_t aTime, int64_t aDuration) : MediaData(NULL_DATA, aOffset, aTime, aDuration, 0) @@ -366,7 +371,8 @@ public: }; // Holds chunk a decoded audio frames. -class AudioData : public MediaData { +class AudioData : public MediaData +{ public: AudioData(int64_t aOffset, @@ -411,7 +417,7 @@ public: AlignedAudioBuffer mAudioData; protected: - ~AudioData() {} + ~AudioData() { } }; namespace layers { @@ -422,7 +428,8 @@ class PlanarYCbCrImage; class VideoInfo; // Holds a decoded video frame, in YCbCr format. These are queued in the reader. -class VideoData : public MediaData { +class VideoData : public MediaData +{ public: typedef gfx::IntRect IntRect; typedef gfx::IntSize IntSize; @@ -437,8 +444,10 @@ public: // 0 = Y // 1 = Cb // 2 = Cr - struct YCbCrBuffer { - struct Plane { + struct YCbCrBuffer + { + struct Plane + { uint8_t* mData; uint32_t mWidth; uint32_t mHeight; @@ -451,7 +460,8 @@ public: YUVColorSpace mYUVColorSpace = YUVColorSpace::BT601; }; - class Listener { + class Listener + { public: virtual void OnSentToCompositor() = 0; virtual ~Listener() {} @@ -469,44 +479,48 @@ public: // Creates a new VideoData containing a deep copy of aBuffer. May use aContainer // to allocate an Image to hold the copied data. - static already_AddRefed CreateAndCopyData(const VideoInfo& aInfo, - ImageContainer* aContainer, - int64_t aOffset, - int64_t aTime, - int64_t aDuration, - const YCbCrBuffer &aBuffer, - bool aKeyframe, - int64_t aTimecode, - const IntRect& aPicture); + static already_AddRefed CreateAndCopyData( + const VideoInfo& aInfo, + ImageContainer* aContainer, + int64_t aOffset, + int64_t aTime, + int64_t aDuration, + const YCbCrBuffer &aBuffer, + bool aKeyframe, + int64_t aTimecode, + const IntRect& aPicture); - static already_AddRefed CreateAndCopyData(const VideoInfo& aInfo, - ImageContainer* aContainer, - int64_t aOffset, - int64_t aTime, - int64_t aDuration, - const YCbCrBuffer &aBuffer, - const YCbCrBuffer::Plane &aAlphaPlane, - bool aKeyframe, - int64_t aTimecode, - const IntRect& aPicture); + static already_AddRefed CreateAndCopyData( + const VideoInfo& aInfo, + ImageContainer* aContainer, + int64_t aOffset, + int64_t aTime, + int64_t aDuration, + const YCbCrBuffer &aBuffer, + const YCbCrBuffer::Plane &aAlphaPlane, + bool aKeyframe, + int64_t aTimecode, + const IntRect& aPicture); - static already_AddRefed CreateAndCopyIntoTextureClient(const VideoInfo& aInfo, - int64_t aOffset, - int64_t aTime, - int64_t aDuration, - layers::TextureClient* aBuffer, - bool aKeyframe, - int64_t aTimecode, - const IntRect& aPicture); + static already_AddRefed CreateAndCopyIntoTextureClient( + const VideoInfo& aInfo, + int64_t aOffset, + int64_t aTime, + int64_t aDuration, + layers::TextureClient* aBuffer, + bool aKeyframe, + int64_t aTimecode, + const IntRect& aPicture); - static already_AddRefed CreateFromImage(const VideoInfo& aInfo, - int64_t aOffset, - int64_t aTime, - int64_t aDuration, - const RefPtr& aImage, - bool aKeyframe, - int64_t aTimecode, - const IntRect& aPicture); + static already_AddRefed CreateFromImage( + const VideoInfo& aInfo, + int64_t aOffset, + int64_t aTime, + int64_t aDuration, + const RefPtr& aImage, + bool aKeyframe, + int64_t aTimecode, + const IntRect& aPicture); // Initialize PlanarYCbCrImage. Only When aCopyData is true, // video data is copied to PlanarYCbCrImage. @@ -553,7 +567,7 @@ protected: class CryptoTrack { public: - CryptoTrack() : mValid(false), mMode(0), mIVSize(0) {} + CryptoTrack() : mValid(false), mMode(0), mIVSize(0) { } bool mValid; int32_t mMode; int32_t mIVSize; @@ -620,7 +634,8 @@ private: MediaRawData* mTarget; }; -class MediaRawData : public MediaData { +class MediaRawData : public MediaData +{ public: MediaRawData(); MediaRawData(const uint8_t* aData, size_t aSize); @@ -676,10 +691,10 @@ private: class MediaByteBuffer : public nsTArray { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaByteBuffer); MediaByteBuffer() = default; - explicit MediaByteBuffer(size_t aCapacity) : nsTArray(aCapacity) {} + explicit MediaByteBuffer(size_t aCapacity) : nsTArray(aCapacity) { } private: - ~MediaByteBuffer() {} + ~MediaByteBuffer() { } }; } // namespace mozilla diff --git a/dom/media/MediaDataDemuxer.h b/dom/media/MediaDataDemuxer.h index 2a60d3fe850a..1fc71a97f538 100644 --- a/dom/media/MediaDataDemuxer.h +++ b/dom/media/MediaDataDemuxer.h @@ -55,8 +55,8 @@ public: // aTrackNumber must be constrained between 0 and GetNumberTracks(aType) - 1 // The actual Track ID is to be retrieved by calling // MediaTrackDemuxer::TrackInfo. - virtual already_AddRefed GetTrackDemuxer(TrackInfo::TrackType aType, - uint32_t aTrackNumber) = 0; + virtual already_AddRefed GetTrackDemuxer( + TrackInfo::TrackType aType, uint32_t aTrackNumber) = 0; // Returns true if the underlying resource allows seeking. virtual bool IsSeekable() const = 0; @@ -101,15 +101,17 @@ class MediaTrackDemuxer public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaTrackDemuxer) - class SamplesHolder { + class SamplesHolder + { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SamplesHolder) nsTArray> mSamples; private: - ~SamplesHolder() {} + ~SamplesHolder() { } }; - class SkipFailureHolder { + class SkipFailureHolder + { public: SkipFailureHolder(const MediaResult& aFailure, uint32_t aSkipped) : mFailure(aFailure) @@ -119,9 +121,13 @@ public: uint32_t mSkipped; }; - typedef MozPromise SeekPromise; - typedef MozPromise, MediaResult, /* IsExclusive = */ true> SamplesPromise; - typedef MozPromise SkipAccessPointPromise; + typedef MozPromise + SeekPromise; + typedef MozPromise, MediaResult, + /* IsExclusive = */ true> + SamplesPromise; + typedef MozPromise + SkipAccessPointPromise; // Returns the TrackInfo (a.k.a Track Description) for this track. // The TrackInfo returned will be: @@ -207,7 +213,7 @@ public: } protected: - virtual ~MediaTrackDemuxer() {} + virtual ~MediaTrackDemuxer() { } }; } // namespace mozilla diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index d62424334c28..bb5064c02bbf 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -92,7 +92,8 @@ class MediaMemoryTracker : public nsIMemoryReporter static StaticRefPtr sUniqueInstance; - static MediaMemoryTracker* UniqueInstance() { + static MediaMemoryTracker* UniqueInstance() + { if (!sUniqueInstance) { sUniqueInstance = new MediaMemoryTracker(); sUniqueInstance->InitMemoryReporter(); @@ -101,7 +102,8 @@ class MediaMemoryTracker : public nsIMemoryReporter } typedef nsTArray DecodersArray; - static DecodersArray& Decoders() { + static DecodersArray& Decoders() + { return UniqueInstance()->mDecoders; } @@ -441,7 +443,8 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner) mWatchManager.Watch(mStateMachineDuration, &MediaDecoder::DurationChanged); // mStateMachineIsShutdown - mWatchManager.Watch(mStateMachineIsShutdown, &MediaDecoder::ShutdownBitChanged); + mWatchManager.Watch(mStateMachineIsShutdown, + &MediaDecoder::ShutdownBitChanged); // readyState mWatchManager.Watch(mPlayState, &MediaDecoder::UpdateReadyState); @@ -458,7 +461,8 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner) // mIgnoreProgressData mWatchManager.Watch(mLogicallySeeking, &MediaDecoder::SeekingChanged); - mWatchManager.Watch(mIsAudioDataAudible, &MediaDecoder::NotifyAudibleStateChanged); + mWatchManager.Watch(mIsAudioDataAudible, + &MediaDecoder::NotifyAudibleStateChanged); MediaShutdownManager::Instance().Register(this); } @@ -648,8 +652,9 @@ MediaDecoder::SetStateMachineParameters() mAbstractMainThread, this, &MediaDecoder::OnMetadataUpdate); mMetadataLoadedListener = mDecoderStateMachine->MetadataLoadedEvent().Connect( mAbstractMainThread, this, &MediaDecoder::MetadataLoaded); - mFirstFrameLoadedListener = mDecoderStateMachine->FirstFrameLoadedEvent().Connect( - mAbstractMainThread, this, &MediaDecoder::FirstFrameLoaded); + mFirstFrameLoadedListener = + mDecoderStateMachine->FirstFrameLoadedEvent().Connect( + mAbstractMainThread, this, &MediaDecoder::FirstFrameLoaded); mOnPlaybackEvent = mDecoderStateMachine->OnPlaybackEvent().Connect( mAbstractMainThread, this, &MediaDecoder::OnPlaybackEvent); @@ -695,7 +700,8 @@ MediaDecoder::Play() } nsresult -MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType, dom::Promise* aPromise /*=nullptr*/) +MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType, + dom::Promise* aPromise /*=nullptr*/) { MOZ_ASSERT(NS_IsMainThread()); MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); @@ -813,7 +819,8 @@ MediaDecoder::MetadataLoaded(nsAutoPtr aInfo, // our new size. if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) { mFiredMetadataLoaded = true; - GetOwner()->MetadataLoaded(mInfo, nsAutoPtr(aTags.forget())); + GetOwner()->MetadataLoaded(mInfo, + nsAutoPtr(aTags.forget())); } // Invalidate() will end up calling GetOwner()->UpdateMediaSize with the last // dimensions retrieved from the video frame container. The video frame @@ -838,15 +845,17 @@ MediaDecoder::EnsureTelemetryReported() } nsTArray codecs; - if (mInfo->HasAudio() && !mInfo->mAudio.GetAsAudioInfo()->mMimeType.IsEmpty()) { + if (mInfo->HasAudio() + && !mInfo->mAudio.GetAsAudioInfo()->mMimeType.IsEmpty()) { codecs.AppendElement(mInfo->mAudio.GetAsAudioInfo()->mMimeType); } - if (mInfo->HasVideo() && !mInfo->mVideo.GetAsVideoInfo()->mMimeType.IsEmpty()) { + if (mInfo->HasVideo() + && !mInfo->mVideo.GetAsVideoInfo()->mMimeType.IsEmpty()) { codecs.AppendElement(mInfo->mVideo.GetAsVideoInfo()->mMimeType); } if (codecs.IsEmpty()) { - codecs.AppendElement(nsPrintfCString("resource; %s", - mResource->GetContentType().OriginalString().Data())); + codecs.AppendElement(nsPrintfCString( + "resource; %s", mResource->GetContentType().OriginalString().Data())); } for (const nsCString& codec : codecs) { DECODER_LOG("Telemetry MEDIA_CODEC_USED= '%s'", codec.get()); @@ -870,9 +879,10 @@ MediaDecoder::FirstFrameLoaded(nsAutoPtr aInfo, MOZ_ASSERT(NS_IsMainThread()); MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); - DECODER_LOG("FirstFrameLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d mPlayState=%s", - aInfo->mAudio.mChannels, aInfo->mAudio.mRate, - aInfo->HasAudio(), aInfo->HasVideo(), PlayStateStr()); + DECODER_LOG("FirstFrameLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d " + "mPlayState=%s", + aInfo->mAudio.mChannels, aInfo->mAudio.mRate, aInfo->HasAudio(), + aInfo->HasVideo(), PlayStateStr()); mInfo = aInfo.forget(); @@ -962,8 +972,10 @@ already_AddRefed MediaDecoder::GetCrashHelper() { MOZ_ASSERT(NS_IsMainThread()); - return GetOwner()->GetMediaElement() ? - MakeAndAddRef(GetOwner()->GetMediaElement()) : nullptr; + return GetOwner()->GetMediaElement() + ? MakeAndAddRef( + GetOwner()->GetMediaElement()) + : nullptr; } bool @@ -999,8 +1011,8 @@ MediaDecoder::PlaybackEnded() InvalidateWithFlags(VideoFrameContainer::INVALIDATE_FORCE); GetOwner()->PlaybackEnded(); - // This must be called after |GetOwner()->PlaybackEnded()| call above, in order - // to fire the required durationchange. + // This must be called after |GetOwner()->PlaybackEnded()| call above, in + // order to fire the required durationchange. if (IsInfinite()) { SetInfinite(false); } @@ -1013,7 +1025,8 @@ MediaDecoder::GetStatistics() MOZ_ASSERT(mResource); MediaStatistics result; - result.mDownloadRate = mResource->GetDownloadRate(&result.mDownloadRateReliable); + result.mDownloadRate = + mResource->GetDownloadRate(&result.mDownloadRateReliable); result.mDownloadPosition = mResource->GetCachedDataEnd(mDecoderPosition); result.mTotalBytes = mResource->GetLength(); result.mPlaybackRate = mPlaybackBytesPerSecond; @@ -1030,7 +1043,8 @@ MediaDecoder::ComputePlaybackRate() MOZ_ASSERT(mResource); int64_t length = mResource->GetLength(); - if (!IsNaN(mDuration) && !mozilla::IsInfinite(mDuration) && length >= 0) { + if (!IsNaN(mDuration) && !mozilla::IsInfinite(mDuration) + && length >= 0) { mPlaybackRateReliable = true; mPlaybackBytesPerSecond = length / mDuration; return; @@ -1199,7 +1213,8 @@ MediaDecoder::UpdateLogicalPositionInternal() MOZ_ASSERT(NS_IsMainThread()); MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); - double currentPosition = static_cast(CurrentPosition()) / static_cast(USECS_PER_S); + double currentPosition = + static_cast(CurrentPosition()) / static_cast(USECS_PER_S); if (mPlayState == PLAY_STATE_ENDED) { currentPosition = std::max(currentPosition, mDuration); } @@ -1243,8 +1258,9 @@ MediaDecoder::DurationChanged() // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=28822 for a discussion // of whether we should fire durationchange on explicit infinity. - if (mFiredMetadataLoaded && - (!mozilla::IsInfinite(mDuration) || mExplicitDuration.Ref().isSome())) { + if (mFiredMetadataLoaded + && (!mozilla::IsInfinite(mDuration) + || mExplicitDuration.Ref().isSome())) { GetOwner()->DispatchAsyncEvent(NS_LITERAL_STRING("durationchange")); } @@ -1282,8 +1298,10 @@ MediaDecoder::UpdateEstimatedMediaDuration(int64_t aDuration) // the current estimate, as the incoming duration is an estimate and so // often is unstable as more data is read and the estimate is updated. // Can result in a durationchangeevent. aDuration is in microseconds. - if (mEstimatedDuration.Ref().isSome() && - mozilla::Abs(mEstimatedDuration.Ref().ref().ToMicroseconds() - aDuration) < ESTIMATED_DURATION_FUZZ_FACTOR_USECS) { + if (mEstimatedDuration.Ref().isSome() + && mozilla::Abs(mEstimatedDuration.Ref().ref().ToMicroseconds() + - aDuration) + < ESTIMATED_DURATION_FUZZ_FACTOR_USECS) { return; } @@ -1327,9 +1345,9 @@ MediaDecoder::GetSeekable() } else { return media::TimeIntervals( media::TimeInterval(media::TimeUnit::FromMicroseconds(0), - IsInfinite() ? - media::TimeUnit::FromInfinity() : - media::TimeUnit::FromSeconds(GetDuration()))); + IsInfinite() + ? media::TimeUnit::FromInfinity() + : media::TimeUnit::FromSeconds(GetDuration()))); } } @@ -1338,7 +1356,8 @@ MediaDecoder::SetFragmentEndTime(double aTime) { MOZ_ASSERT(NS_IsMainThread()); if (mDecoderStateMachine) { - mDecoderStateMachine->DispatchSetFragmentEndTime(static_cast(aTime * USECS_PER_S)); + mDecoderStateMachine->DispatchSetFragmentEndTime( + static_cast(aTime * USECS_PER_S)); } } @@ -1443,7 +1462,8 @@ MediaDecoder::SetStateMachine(MediaDecoderStateMachine* aStateMachine) ImageContainer* MediaDecoder::GetImageContainer() { - return mVideoFrameContainer ? mVideoFrameContainer->GetImageContainer() : nullptr; + return mVideoFrameContainer ? mVideoFrameContainer->GetImageContainer() + : nullptr; } void @@ -1465,13 +1485,15 @@ MediaDecoder::Invalidate() // Constructs the time ranges representing what segments of the media // are buffered and playable. media::TimeIntervals -MediaDecoder::GetBuffered() { +MediaDecoder::GetBuffered() +{ MOZ_ASSERT(NS_IsMainThread()); return mBuffered.Ref(); } size_t -MediaDecoder::SizeOfVideoQueue() { +MediaDecoder::SizeOfVideoQueue() +{ MOZ_ASSERT(NS_IsMainThread()); if (mDecoderStateMachine) { return mDecoderStateMachine->SizeOfVideoQueue(); @@ -1480,7 +1502,8 @@ MediaDecoder::SizeOfVideoQueue() { } size_t -MediaDecoder::SizeOfAudioQueue() { +MediaDecoder::SizeOfAudioQueue() +{ MOZ_ASSERT(NS_IsMainThread()); if (mDecoderStateMachine) { return mDecoderStateMachine->SizeOfAudioQueue(); @@ -1488,15 +1511,18 @@ MediaDecoder::SizeOfAudioQueue() { return 0; } -void MediaDecoder::AddSizeOfResources(ResourceSizes* aSizes) { +void MediaDecoder::AddSizeOfResources(ResourceSizes* aSizes) +{ MOZ_ASSERT(NS_IsMainThread()); if (GetResource()) { - aSizes->mByteSize += GetResource()->SizeOfIncludingThis(aSizes->mMallocSizeOf); + aSizes->mByteSize += + GetResource()->SizeOfIncludingThis(aSizes->mMallocSizeOf); } } void -MediaDecoder::NotifyDataArrived() { +MediaDecoder::NotifyDataArrived() +{ MOZ_ASSERT(NS_IsMainThread()); MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); mDataArrivedEvent.Notify(); @@ -1504,7 +1530,8 @@ MediaDecoder::NotifyDataArrived() { // Provide access to the state machine object MediaDecoderStateMachine* -MediaDecoder::GetStateMachine() const { +MediaDecoder::GetStateMachine() const +{ MOZ_ASSERT(NS_IsMainThread()); return mDecoderStateMachine; } @@ -1592,9 +1619,9 @@ MediaDecoder::IsWebMEnabled() bool MediaDecoder::IsAndroidMediaPluginEnabled() { - return AndroidBridge::Bridge() && - AndroidBridge::Bridge()->GetAPIVersion() < 16 && - Preferences::GetBool("media.plugins.enabled"); + return AndroidBridge::Bridge() + && AndroidBridge::Bridge()->GetAPIVersion() < 16 + && Preferences::GetBool("media.plugins.enabled"); } #endif @@ -1602,8 +1629,6 @@ NS_IMETHODIMP MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData, bool aAnonymize) { - int64_t video = 0, audio = 0; - // NB: When resourceSizes' ref count goes to 0 the promise will report the // resources memory and finish the asynchronous memory report. RefPtr resourceSizes = @@ -1613,7 +1638,8 @@ MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, nsCOMPtr data = aData; resourceSizes->Promise()->Then( - // Non-DocGroup version of AbstractThread::MainThread is fine for memory report. + // Non-DocGroup version of AbstractThread::MainThread is fine for memory + // report. AbstractThread::MainThread(), __func__, [handleReport, data] (size_t size) { @@ -1633,6 +1659,8 @@ MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, }, [] (size_t) { /* unused reject function */ }); + int64_t video = 0; + int64_t audio = 0; DecodersArray& decoders = Decoders(); for (size_t i = 0; i < decoders.Length(); ++i) { MediaDecoder* decoder = decoders[i]; @@ -1731,11 +1759,13 @@ MediaDecoder::NextFrameBufferedStatus() // Use the buffered range to consider if we have the next frame available. media::TimeUnit currentPosition = media::TimeUnit::FromMicroseconds(CurrentPosition()); - media::TimeInterval interval(currentPosition, - currentPosition + media::TimeUnit::FromMicroseconds(DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED)); + media::TimeInterval interval( + currentPosition, + currentPosition + + media::TimeUnit::FromMicroseconds(DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED)); return GetBuffered().Contains(interval) - ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE - : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE; + ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE + : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE; } nsCString diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 6746d3d3c5ec..745f6f7fb529 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -62,7 +62,8 @@ class MediaDecoder : public AbstractMediaDecoder public: // Used to register with MediaResource to receive notifications which will // be forwarded to MediaDecoder. - class ResourceCallback : public MediaResourceCallback { + class ResourceCallback : public MediaResourceCallback + { // Throttle calls to MediaDecoder::NotifyDataArrived() // to be at most once per 500ms. static const uint32_t sDelay = 500; @@ -96,12 +97,15 @@ public: const RefPtr mAbstractMainThread; }; - typedef MozPromise SeekPromise; + typedef MozPromise + SeekPromise; NS_DECL_THREADSAFE_ISUPPORTS // Enumeration for the valid play states (see mPlayState) - enum PlayState { + enum PlayState + { PLAY_STATE_START, PLAY_STATE_LOADING, PLAY_STATE_PAUSED, @@ -207,7 +211,8 @@ public: // Add an output stream. All decoder output will be sent to the stream. // The stream is initially blocked. The decoder is responsible for unblocking // it while it is playing back. - virtual void AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded); + virtual void AddOutputStream(ProcessedMediaStream* aStream, + bool aFinishWhenEnded); // Remove an output stream added with AddOutputStream. virtual void RemoveOutputStream(MediaStream* aStream); @@ -430,7 +435,9 @@ private: return mAbstractMainThread; } - typedef MozPromise, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise; + typedef MozPromise, bool /* aIgnored */, + /* IsExclusive = */ true> + CDMProxyPromise; // Resolved when a CDMProxy is available and the capabilities are known or // rejected when this decoder is about to shut down. @@ -476,12 +483,15 @@ private: GetOwner()->UpdateReadyState(); } - virtual MediaDecoderOwner::NextFrameStatus NextFrameStatus() { return mNextFrameStatus; } + virtual MediaDecoderOwner::NextFrameStatus NextFrameStatus() + { + return mNextFrameStatus; + } virtual MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus(); // Returns a string describing the state of the media player internal // data. Used for debugging purposes. - virtual void GetMozDebugReaderData(nsACString& aString) {} + virtual void GetMozDebugReaderData(nsACString& aString) { } virtual void DumpDebugInfo(); @@ -787,45 +797,46 @@ protected: public: AbstractCanonical* CanonicalDurationOrNull() override; - AbstractCanonical* CanonicalVolume() { - return &mVolume; - } - AbstractCanonical* CanonicalPreservesPitch() { + AbstractCanonical* CanonicalVolume() { return &mVolume; } + AbstractCanonical* CanonicalPreservesPitch() + { return &mPreservesPitch; } - AbstractCanonical* CanonicalEstimatedDuration() { + AbstractCanonical* CanonicalEstimatedDuration() + { return &mEstimatedDuration; } - AbstractCanonical>* CanonicalExplicitDuration() { + AbstractCanonical>* CanonicalExplicitDuration() + { return &mExplicitDuration; } - AbstractCanonical* CanonicalPlayState() { - return &mPlayState; - } - AbstractCanonical* CanonicalNextPlayState() { - return &mNextState; - } - AbstractCanonical* CanonicalLogicallySeeking() { + AbstractCanonical* CanonicalPlayState() { return &mPlayState; } + AbstractCanonical* CanonicalNextPlayState() { return &mNextState; } + AbstractCanonical* CanonicalLogicallySeeking() + { return &mLogicallySeeking; } - AbstractCanonical* CanonicalSameOriginMedia() { + AbstractCanonical* CanonicalSameOriginMedia() + { return &mSameOriginMedia; } - AbstractCanonical* CanonicalMediaPrincipalHandle() { + AbstractCanonical* CanonicalMediaPrincipalHandle() + { return &mMediaPrincipalHandle; } - AbstractCanonical* CanonicalPlaybackBytesPerSecond() { + AbstractCanonical* CanonicalPlaybackBytesPerSecond() + { return &mPlaybackBytesPerSecond; } - AbstractCanonical* CanonicalPlaybackRateReliable() { + AbstractCanonical* CanonicalPlaybackRateReliable() + { return &mPlaybackRateReliable; } - AbstractCanonical* CanonicalDecoderPosition() { + AbstractCanonical* CanonicalDecoderPosition() + { return &mDecoderPosition; } - AbstractCanonical* CanonicalIsVisible() { - return &mIsVisible; - } + AbstractCanonical* CanonicalIsVisible() { return &mIsVisible; } private: // Notify owner when the audible state changed diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index b0128a24b1da..c4ee8cfa0667 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -29,13 +29,16 @@ class MediaDecoderReader; struct WaitForDataRejectValue { - enum Reason { + enum Reason + { SHUTDOWN, CANCELED }; WaitForDataRejectValue(MediaData::Type aType, Reason aReason) - :mType(aType), mReason(aReason) {} + :mType(aType), mReason(aReason) + { + } MediaData::Type mType; Reason mReason; }; @@ -43,11 +46,11 @@ struct WaitForDataRejectValue struct SeekRejectValue { MOZ_IMPLICIT SeekRejectValue(const MediaResult& aError) - : mType(MediaData::NULL_DATA), mError(aError) {} + : mType(MediaData::NULL_DATA), mError(aError) { } MOZ_IMPLICIT SeekRejectValue(nsresult aResult) - : mType(MediaData::NULL_DATA), mError(aResult) {} + : mType(MediaData::NULL_DATA), mError(aResult) { } SeekRejectValue(MediaData::Type aType, const MediaResult& aError) - : mType(aType), mError(aError) {} + : mType(aType), mError(aError) { } MediaData::Type mType; MediaResult mError; }; @@ -60,7 +63,7 @@ public: nsAutoPtr mTags; private: - virtual ~MetadataHolder() {} + virtual ~MetadataHolder() { } }; // Encapsulates the decoding and reading of media data. Reading can either @@ -69,7 +72,8 @@ private: // callback. // Unless otherwise specified, methods and fields of this class can only // be accessed on the decode task queue. -class MediaDecoderReader { +class MediaDecoderReader +{ friend class ReRequestVideoWithSkipTask; friend class ReRequestAudioTask; @@ -104,7 +108,7 @@ public: // Called by MDSM in dormant state to release resources allocated by this // reader. The reader can resume decoding by calling Seek() to a specific // position. - virtual void ReleaseResources() {} + virtual void ReleaseResources() { } // Destroys the decoding state. The reader cannot be made usable again. // This is different from ReleaseMediaResources() as it is irreversable, @@ -128,8 +132,9 @@ public: // // aParam is a set of TrackInfo::TrackType enums specifying which // queues need to be reset, defaulting to both audio and video tracks. - virtual nsresult ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack, - TrackInfo::kVideoTrack)); + virtual nsresult ResetDecode( + TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack, + TrackInfo::kVideoTrack)); // Requests one audio sample from the reader. // @@ -258,7 +263,7 @@ public: // Switch the video decoder to BlankDecoderModule. It might takes effective // since a few samples later depends on how much demuxed samples are already // queued in the original video decoder. - virtual void SetVideoBlankDecode(bool aIsBlankDecode) {} + virtual void SetVideoBlankDecode(bool aIsBlankDecode) { } protected: virtual ~MediaDecoderReader(); diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 43d1fb52479c..9e2c056722b2 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -139,7 +139,8 @@ static_assert(LOW_DATA_THRESHOLD_USECS > AMPLE_AUDIO_USECS, // Amount of excess usecs of data to add in to the "should we buffer" calculation. static const uint32_t EXHAUSTED_DATA_MARGIN_USECS = 100000; -static int64_t DurationToUsecs(TimeDuration aDuration) { +static int64_t DurationToUsecs(TimeDuration aDuration) +{ return static_cast(aDuration.ToSeconds() * USECS_PER_S); } @@ -154,9 +155,11 @@ static const uint32_t VIDEO_QUEUE_SEND_TO_COMPOSITOR_SIZE = 9999; static uint32_t sVideoQueueDefaultSize = MAX_VIDEO_QUEUE_SIZE; static uint32_t sVideoQueueHWAccelSize = HW_VIDEO_QUEUE_SIZE; -static uint32_t sVideoQueueSendToCompositorSize = VIDEO_QUEUE_SEND_TO_COMPOSITOR_SIZE; +static uint32_t sVideoQueueSendToCompositorSize = + VIDEO_QUEUE_SEND_TO_COMPOSITOR_SIZE; -static void InitVideoQueuePrefs() { +static void InitVideoQueuePrefs() +{ MOZ_ASSERT(NS_IsMainThread()); static bool sPrefInit = false; if (!sPrefInit) { @@ -182,14 +185,14 @@ SuspendBackgroundVideoDelay() class MediaDecoderStateMachine::StateObject { public: - virtual ~StateObject() {} - virtual void Exit() {}; // Exit action. - virtual void Step() {} // Perform a 'cycle' of this state object. + virtual ~StateObject() { } + virtual void Exit() { } // Exit action. + virtual void Step() { } // Perform a 'cycle' of this state object. virtual State GetState() const = 0; // Event handlers for various events. - virtual void HandleCDMProxyReady() {} - virtual void HandleAudioCaptured() {} + virtual void HandleCDMProxyReady() { } + virtual void HandleAudioCaptured() { } virtual void HandleAudioDecoded(MediaData* aAudio) { Crash("Unexpected event!", __func__); @@ -250,7 +253,8 @@ private: void Crash(const char* aReason, const char* aSite) { char buf[1024]; - SprintfLiteral(buf, "%s state=%s callsite=%s", aReason, ToStateStr(GetState()), aSite); + SprintfLiteral(buf, "%s state=%s callsite=%s", aReason, + ToStateStr(GetState()), aSite); MOZ_ReportAssertionFailure(buf, __FILE__, __LINE__); MOZ_CRASH(); } @@ -272,9 +276,9 @@ protected: { // We are expecting more data if either the resource states so, or if we // have a waiting promise pending (such as with non-MSE EME). - return Resource()->IsExpectingMoreData() || - mMaster->IsWaitingAudioData() || - mMaster->IsWaitingVideoData(); + return Resource()->IsExpectingMoreData() + || mMaster->IsWaitingAudioData() + || mMaster->IsWaitingVideoData(); } MediaQueue& AudioQueue() const { return mMaster->mAudioQueue; } MediaQueue& VideoQueue() const { return mMaster->mVideoQueue; } @@ -291,8 +295,8 @@ protected: auto s = new S(master); - MOZ_ASSERT(GetState() != s->GetState() || - GetState() == DECODER_STATE_SEEKING); + MOZ_ASSERT(GetState() != s->GetState() + || GetState() == DECODER_STATE_SEEKING); SLOG("change state to: %s", ToStateStr(s->GetState())); @@ -322,7 +326,7 @@ class MediaDecoderStateMachine::DecodeMetadataState : public MediaDecoderStateMachine::StateObject { public: - explicit DecodeMetadataState(Master* aPtr) : StateObject(aPtr) {} + explicit DecodeMetadataState(Master* aPtr) : StateObject(aPtr) { } void Enter() { @@ -397,7 +401,7 @@ class MediaDecoderStateMachine::WaitForCDMState : public MediaDecoderStateMachine::StateObject { public: - explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) {} + explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) { } void Enter() { @@ -451,7 +455,7 @@ class MediaDecoderStateMachine::DormantState : public MediaDecoderStateMachine::StateObject { public: - explicit DormantState(Master* aPtr) : StateObject(aPtr) {} + explicit DormantState(Master* aPtr) : StateObject(aPtr) { } void Enter() { @@ -460,13 +464,13 @@ public: } // Calculate the position to seek to when exiting dormant. - auto t = mMaster->mMediaSink->IsStarted() - ? mMaster->GetClock() - : mMaster->GetMediaTime(); + auto t = mMaster->mMediaSink->IsStarted() ? mMaster->GetClock() + : mMaster->GetMediaTime(); mPendingSeek.mTarget.emplace(t, SeekTarget::Accurate); // SeekJob asserts |mTarget.IsValid() == !mPromise.IsEmpty()| so we // need to create the promise even it is not used at all. - RefPtr x = mPendingSeek.mPromise.Ensure(__func__); + RefPtr x = + mPendingSeek.mPromise.Ensure(__func__); mMaster->ResetDecode(); mMaster->StopMediaSink(); @@ -513,7 +517,7 @@ class MediaDecoderStateMachine::DecodingFirstFrameState : public MediaDecoderStateMachine::StateObject { public: - explicit DecodingFirstFrameState(Master* aPtr) : StateObject(aPtr) {} + explicit DecodingFirstFrameState(Master* aPtr) : StateObject(aPtr) { } void Enter(); @@ -578,7 +582,8 @@ public: void HandleVideoSuspendTimeout() override { - // Do nothing for we need to decode the 1st video frame to get the dimensions. + // Do nothing for we need to decode the 1st video frame to get the + // dimensions. } void HandleResumeVideoDecoding() override @@ -628,8 +633,8 @@ public: void Step() override { - if (mMaster->mPlayState != MediaDecoder::PLAY_STATE_PLAYING && - mMaster->IsPlaying()) { + if (mMaster->mPlayState != MediaDecoder::PLAY_STATE_PLAYING + && mMaster->IsPlaying()) { // We're playing, but the element/decoder is in paused state. Stop // playing! mMaster->StopPlayback(); @@ -642,8 +647,8 @@ public: mMaster->UpdatePlaybackPositionPeriodically(); - MOZ_ASSERT(!mMaster->IsPlaying() || - mMaster->IsStateMachineScheduled(), + MOZ_ASSERT(!mMaster->IsPlaying() + || mMaster->IsStateMachineScheduled(), "Must have timer scheduled"); MaybeStartBuffering(); @@ -765,8 +770,8 @@ private: TimeDuration decodeTime = TimeStamp::Now() - aDecodeStart; int64_t adjustedTime = THRESHOLD_FACTOR * DurationToUsecs(decodeTime); - if (adjustedTime > mMaster->mLowAudioThresholdUsecs && - !mMaster->HasLowBufferedData()) + if (adjustedTime > mMaster->mLowAudioThresholdUsecs + && !mMaster->HasLowBufferedData()) { mMaster->mLowAudioThresholdUsecs = std::min(adjustedTime, mMaster->mAmpleAudioThresholdUsecs); @@ -785,23 +790,23 @@ private: bool DonePrerollingAudio() { - return !mMaster->IsAudioDecoding() || - mMaster->GetDecodedAudioDuration() >= - mMaster->AudioPrerollUsecs() * mMaster->mPlaybackRate; + return !mMaster->IsAudioDecoding() + || mMaster->GetDecodedAudioDuration() + >= mMaster->AudioPrerollUsecs() * mMaster->mPlaybackRate; } bool DonePrerollingVideo() { - return !mMaster->IsVideoDecoding() || - static_cast(mMaster->VideoQueue().GetSize()) >= - mMaster->VideoPrerollFrames() * mMaster->mPlaybackRate + 1; + return !mMaster->IsVideoDecoding() + || static_cast(mMaster->VideoQueue().GetSize()) + >= mMaster->VideoPrerollFrames() * mMaster->mPlaybackRate + 1; } void MaybeStopPrerolling() { - if (mIsPrerolling && - (DonePrerollingAudio() || mMaster->IsWaitingAudioData()) && - (DonePrerollingVideo() || mMaster->IsWaitingVideoData())) { + if (mIsPrerolling + && (DonePrerollingAudio() || mMaster->IsWaitingAudioData()) + && (DonePrerollingVideo() || mMaster->IsWaitingVideoData())) { mIsPrerolling = false; // Check if we can start playback. mMaster->ScheduleStateMachine(); @@ -875,7 +880,7 @@ class MediaDecoderStateMachine::SeekingState : public MediaDecoderStateMachine::StateObject { public: - explicit SeekingState(Master* aPtr) : StateObject(aPtr) {} + explicit SeekingState(Master* aPtr) : StateObject(aPtr) { } RefPtr Enter(SeekJob aSeekJob, EventVisibility aVisibility) @@ -896,13 +901,15 @@ public: mMaster->StopPlayback(); } - mMaster->UpdatePlaybackPositionInternal(mSeekJob.mTarget->GetTime().ToMicroseconds()); + mMaster->UpdatePlaybackPositionInternal( + mSeekJob.mTarget->GetTime().ToMicroseconds()); if (aVisibility == EventVisibility::Observable) { mMaster->mOnPlaybackEvent.Notify(MediaEventType::SeekStarted); // We want dormant actions to be transparent to the user. // So we only notify the change when the seek request is from the user. - mMaster->UpdateNextFrameStatus(MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING); + mMaster->UpdateNextFrameStatus( + MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING); } DoSeek(); @@ -918,7 +925,8 @@ public: } void HandleAudioDecoded(MediaData* aAudio) override = 0; - void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override = 0; + void HandleVideoDecoded(MediaData* aVideo, + TimeStamp aDecodeStart) override = 0; void HandleAudioWaited(MediaData::Type aType) override = 0; void HandleVideoWaited(MediaData::Type aType) override = 0; @@ -956,7 +964,8 @@ public: EventVisibility aVisibility) { MOZ_ASSERT(aSeekJob.mTarget->IsAccurate() || aSeekJob.mTarget->IsFast()); - mCurrentTimeBeforeSeek = TimeUnit::FromMicroseconds(mMaster->GetMediaTime()); + mCurrentTimeBeforeSeek = + TimeUnit::FromMicroseconds(mMaster->GetMediaTime()); return SeekingState::Enter(Move(aSeekJob), aVisibility); } @@ -973,12 +982,14 @@ public: void HandleAudioDecoded(MediaData* aAudio) override { - MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, "Seek shouldn't be finished"); + MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, + "Seek shouldn't be finished"); MOZ_ASSERT(aAudio); // Video-only seek doesn't reset audio decoder. There might be pending audio - // requests when AccurateSeekTask::Seek() begins. We will just store the data - // without checking |mDiscontinuity| or calling DropAudioUpToSeekTarget(). + // requests when AccurateSeekTask::Seek() begins. We will just store the + // data without checking |mDiscontinuity| or calling + // DropAudioUpToSeekTarget(). if (mSeekJob.mTarget->IsVideoOnly()) { mMaster->PushAudio(aAudio); return; @@ -1007,7 +1018,8 @@ public: void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override { - MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, "Seek shouldn't be finished"); + MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, + "Seek shouldn't be finished"); MOZ_ASSERT(aVideo); AdjustFastSeekIfNeeded(aVideo); @@ -1084,7 +1096,8 @@ public: void HandleAudioWaited(MediaData::Type aType) override { - MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, "Seek shouldn't be finished"); + MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, + "Seek shouldn't be finished"); // Ignore pending requests from video-only seek. if (mSeekJob.mTarget->IsVideoOnly()) { @@ -1095,7 +1108,8 @@ public: void HandleVideoWaited(MediaData::Type aType) override { - MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, "Seek shouldn't be finished"); + MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, + "Seek shouldn't be finished"); RequestVideoData(); } @@ -1134,16 +1148,16 @@ private: { const int64_t seekTime = mSeekJob.mTarget->GetTime().ToMicroseconds(); - // For the accurate seek, we always set the newCurrentTime = seekTime so that - // the updated HTMLMediaElement.currentTime will always be the seek target; - // we rely on the MediaSink to handles the gap between the newCurrentTime and - // the real decoded samples' start time. + // For the accurate seek, we always set the newCurrentTime = seekTime so + // that the updated HTMLMediaElement.currentTime will always be the seek + // target; we rely on the MediaSink to handles the gap between the + // newCurrentTime and the real decoded samples' start time. if (mSeekJob.mTarget->IsAccurate()) { return seekTime; } - // For the fast seek, we update the newCurrentTime with the decoded audio and - // video samples, set it to be the one which is closet to the seekTime. + // For the fast seek, we update the newCurrentTime with the decoded audio + // and video samples, set it to be the one which is closet to the seekTime. if (mSeekJob.mTarget->IsFast()) { RefPtr audio = AudioQueue().PeekFront(); RefPtr video = VideoQueue().PeekFront(); @@ -1164,7 +1178,8 @@ private: return 0; } - void OnSeekResolved(media::TimeUnit) { + void OnSeekResolved(media::TimeUnit) + { mSeekRequest.Complete(); // We must decode the first samples of active streams, so we can determine @@ -1177,7 +1192,8 @@ private: } } - void OnSeekRejected(const SeekRejectValue& aReject) { + void OnSeekRejected(const SeekRejectValue& aReject) + { mSeekRequest.Complete(); if (aReject.mError == NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA) { @@ -1187,23 +1203,27 @@ private: MOZ_ASSERT(!mMaster->IsWaitingAudioData()); MOZ_ASSERT(!mMaster->IsWaitingVideoData()); // Fire 'waiting' to notify the player that we are waiting for data. - mMaster->UpdateNextFrameStatus(MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING); - Reader()->WaitForData(aReject.mType)->Then( - OwnerThread(), __func__, - [this] (MediaData::Type aType) { - SLOG("OnSeekRejected wait promise resolved"); - mWaitRequest.Complete(); - DemuxerSeek(); - }, - [this] (const WaitForDataRejectValue& aRejection) { - SLOG("OnSeekRejected wait promise rejected"); - mWaitRequest.Complete(); - mMaster->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); - })->Track(mWaitRequest); + mMaster->UpdateNextFrameStatus( + MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING); + Reader() + ->WaitForData(aReject.mType) + ->Then(OwnerThread(), __func__, + [this](MediaData::Type aType) { + SLOG("OnSeekRejected wait promise resolved"); + mWaitRequest.Complete(); + DemuxerSeek(); + }, + [this](const WaitForDataRejectValue& aRejection) { + SLOG("OnSeekRejected wait promise rejected"); + mWaitRequest.Complete(); + mMaster->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); + }) + ->Track(mWaitRequest); return; } - MOZ_ASSERT(NS_FAILED(aReject.mError), "Cancels should also disconnect mSeekRequest"); + MOZ_ASSERT(NS_FAILED(aReject.mError), + "Cancels should also disconnect mSeekRequest"); mMaster->DecodeError(aReject.mError); } @@ -1221,9 +1241,9 @@ private: void AdjustFastSeekIfNeeded(MediaData* aSample) { - if (mSeekJob.mTarget->IsFast() && - mSeekJob.mTarget->GetTime() > mCurrentTimeBeforeSeek && - aSample->mTime < mCurrentTimeBeforeSeek.ToMicroseconds()) { + if (mSeekJob.mTarget->IsFast() + && mSeekJob.mTarget->GetTime() > mCurrentTimeBeforeSeek + && aSample->mTime < mCurrentTimeBeforeSeek.ToMicroseconds()) { // We are doing a fastSeek, but we ended up *before* the previous // playback position. This is surprising UX, so switch to an accurate // seek and decode to the seek target. This is not conformant to the @@ -1238,12 +1258,14 @@ private: { MOZ_ASSERT(aAudio && mSeekJob.mTarget->IsAccurate()); - CheckedInt64 sampleDuration = FramesToUsecs(aAudio->mFrames, Info().mAudio.mRate); + CheckedInt64 sampleDuration = + FramesToUsecs(aAudio->mFrames, Info().mAudio.mRate); if (!sampleDuration.isValid()) { return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR; } - if (aAudio->mTime + sampleDuration.value() <= mSeekJob.mTarget->GetTime().ToMicroseconds()) { + if (aAudio->mTime + sampleDuration.value() + <= mSeekJob.mTarget->GetTime().ToMicroseconds()) { // Our seek target lies after the frames in this AudioData. Don't // push it onto the audio queue, and keep decoding forwards. return NS_OK; @@ -1268,11 +1290,13 @@ private: // exactly at the seek target. NS_ASSERTION(mSeekJob.mTarget->GetTime().ToMicroseconds() >= aAudio->mTime, "Target must at or be after data start."); - NS_ASSERTION(mSeekJob.mTarget->GetTime().ToMicroseconds() < aAudio->mTime + sampleDuration.value(), + NS_ASSERTION(mSeekJob.mTarget->GetTime().ToMicroseconds() + < aAudio->mTime + sampleDuration.value(), "Data must end after target."); - CheckedInt64 framesToPrune = - UsecsToFrames(mSeekJob.mTarget->GetTime().ToMicroseconds() - aAudio->mTime, Info().mAudio.mRate); + CheckedInt64 framesToPrune = UsecsToFrames( + mSeekJob.mTarget->GetTime().ToMicroseconds() - aAudio->mTime, + Info().mAudio.mRate); if (!framesToPrune.isValid()) { return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR; } @@ -1282,7 +1306,8 @@ private: SWARN("Can't prune more frames that we have!"); return NS_ERROR_FAILURE; } - uint32_t frames = aAudio->mFrames - static_cast(framesToPrune.value()); + uint32_t frames = + aAudio->mFrames - static_cast(framesToPrune.value()); uint32_t channels = aAudio->mChannels; AlignedAudioBuffer audioData(frames * channels); if (!audioData) { @@ -1296,14 +1321,11 @@ private: if (!duration.isValid()) { return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR; } - RefPtr data(new AudioData(aAudio->mOffset, - mSeekJob.mTarget->GetTime().ToMicroseconds(), - duration.value(), - frames, - Move(audioData), - channels, - aAudio->mRate)); - MOZ_ASSERT(AudioQueue().GetSize() == 0, "Should be the 1st sample after seeking"); + RefPtr data(new AudioData( + aAudio->mOffset, mSeekJob.mTarget->GetTime().ToMicroseconds(), + duration.value(), frames, Move(audioData), channels, aAudio->mRate)); + MOZ_ASSERT(AudioQueue().GetSize() == 0, + "Should be the 1st sample after seeking"); mMaster->PushAudio(data); mDoneAudioSeeking = true; @@ -1326,16 +1348,18 @@ private: mFirstVideoFrameAfterSeek = video; } else { if (target >= video->mTime && video->GetEndTime() >= target) { - // The seek target lies inside this frame's time slice. Adjust the frame's - // start time to match the seek target. + // The seek target lies inside this frame's time slice. Adjust the + // frame's start time to match the seek target. video->UpdateTimestamp(target); } mFirstVideoFrameAfterSeek = nullptr; - SLOG("DropVideoUpToSeekTarget() found video frame [%lld, %lld] containing target=%lld", - video->mTime, video->GetEndTime(), target); + SLOG("DropVideoUpToSeekTarget() found video frame [%lld, %lld] " + "containing target=%lld", + video->mTime, video->GetEndTime(), target); - MOZ_ASSERT(VideoQueue().GetSize() == 0, "Should be the 1st sample after seeking"); + MOZ_ASSERT(VideoQueue().GetSize() == 0, + "Should be the 1st sample after seeking"); mMaster->PushVideo(video); mDoneVideoSeeking = true; } @@ -1423,8 +1447,8 @@ private: if (!NeedMoreVideo()) { FinishSeek(); - } else if (!mMaster->IsRequestingVideoData() && - !mMaster->IsWaitingVideoData()) { + } else if (!mMaster->IsRequestingVideoData() + && !mMaster->IsWaitingVideoData()) { RequestVideoData(); } } @@ -1560,12 +1584,13 @@ private: bool NeedMoreVideo() const { // Need to request video when we have none and video queue is not finished. - return VideoQueue().GetSize() == 0 && - !VideoQueue().IsFinished(); + return VideoQueue().GetSize() == 0 + && !VideoQueue().IsFinished(); } // Update the seek target's time before resolving this seek task, the updated - // time will be used in the MDSM::SeekCompleted() to update the MDSM's position. + // time will be used in the MDSM::SeekCompleted() to update the MDSM's + // position. void UpdateSeekTargetTime() { RefPtr data = VideoQueue().PeekFront(); @@ -1609,7 +1634,7 @@ class MediaDecoderStateMachine::BufferingState : public MediaDecoderStateMachine::StateObject { public: - explicit BufferingState(Master* aPtr) : StateObject(aPtr) {} + explicit BufferingState(Master* aPtr) : StateObject(aPtr) { } void Enter() { @@ -1621,12 +1646,15 @@ public: MediaStatistics stats = mMaster->GetStatistics(); SLOG("Playback rate: %.1lfKB/s%s download rate: %.1lfKB/s%s", - stats.mPlaybackRate/1024, stats.mPlaybackRateReliable ? "" : " (unreliable)", - stats.mDownloadRate/1024, stats.mDownloadRateReliable ? "" : " (unreliable)"); + stats.mPlaybackRate / 1024, + stats.mPlaybackRateReliable ? "" : " (unreliable)", + stats.mDownloadRate / 1024, + stats.mDownloadRateReliable ? "" : " (unreliable)"); mMaster->ScheduleStateMachineIn(USECS_PER_S); - mMaster->UpdateNextFrameStatus(MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING); + mMaster->UpdateNextFrameStatus( + MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING); } void Step() override; @@ -1714,7 +1742,7 @@ class MediaDecoderStateMachine::CompletedState : public MediaDecoderStateMachine::StateObject { public: - explicit CompletedState(Master* aPtr) : StateObject(aPtr) {} + explicit CompletedState(Master* aPtr) : StateObject(aPtr) { } void Enter() { @@ -1722,11 +1750,11 @@ public: Reader()->ReleaseResources(); bool hasNextFrame = (!mMaster->HasAudio() || !mMaster->mAudioCompleted) - && (!mMaster->HasVideo() || !mMaster->mVideoCompleted); + && (!mMaster->HasVideo() || !mMaster->mVideoCompleted); - mMaster->UpdateNextFrameStatus(hasNextFrame - ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE - : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE); + mMaster->UpdateNextFrameStatus( + hasNextFrame ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE + : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE); Step(); } @@ -1738,21 +1766,21 @@ public: void Step() override { - if (mMaster->mPlayState != MediaDecoder::PLAY_STATE_PLAYING && - mMaster->IsPlaying()) { + if (mMaster->mPlayState != MediaDecoder::PLAY_STATE_PLAYING + && mMaster->IsPlaying()) { mMaster->StopPlayback(); } // Play the remaining media. We want to run AdvanceFrame() at least // once to ensure the current playback position is advanced to the // end of the media, and so that we update the readyState. - if ((mMaster->HasVideo() && !mMaster->mVideoCompleted) || - (mMaster->HasAudio() && !mMaster->mAudioCompleted)) { + if ((mMaster->HasVideo() && !mMaster->mVideoCompleted) + || (mMaster->HasAudio() && !mMaster->mAudioCompleted)) { // Start playback if necessary to play the remaining media. mMaster->MaybeStartPlayback(); mMaster->UpdatePlaybackPositionPeriodically(); - MOZ_ASSERT(!mMaster->IsPlaying() || - mMaster->IsStateMachineScheduled(), + MOZ_ASSERT(!mMaster->IsPlaying() + || mMaster->IsStateMachineScheduled(), "Must have timer scheduled"); return; } @@ -1762,8 +1790,10 @@ public: mMaster->StopPlayback(); if (!mSentPlaybackEndedEvent) { - int64_t clockTime = std::max(mMaster->AudioEndTime(), mMaster->VideoEndTime()); - clockTime = std::max(int64_t(0), std::max(clockTime, mMaster->Duration().ToMicroseconds())); + int64_t clockTime = + std::max(mMaster->AudioEndTime(), mMaster->VideoEndTime()); + clockTime = std::max( + int64_t(0), std::max(clockTime, mMaster->Duration().ToMicroseconds())); mMaster->UpdatePlaybackPosition(clockTime); // Ensure readyState is updated before firing the 'ended' event. @@ -1819,7 +1849,7 @@ class MediaDecoderStateMachine::ShutdownState : public MediaDecoderStateMachine::StateObject { public: - explicit ShutdownState(Master* aPtr) : StateObject(aPtr) {} + explicit ShutdownState(Master* aPtr) : StateObject(aPtr) { } RefPtr Enter(); @@ -1938,8 +1968,8 @@ StateObject::HandleResumeVideoDecoding() type, true /* aVideoOnly */); - // Hold mMaster->mAbstractMainThread here because this->mMaster will be invalid - // after the current state object is deleted in SetState(); + // Hold mMaster->mAbstractMainThread here because this->mMaster will be + // invalid after the current state object is deleted in SetState(); RefPtr mainThread = mMaster->mAbstractMainThread; SetSeekingState(Move(seekJob), EventVisibility::Suppressed)->Then( @@ -1976,7 +2006,8 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata) mMaster->mInfo.emplace(aMetadata->mInfo); mMaster->mMetadataTags = aMetadata->mTags.forget(); mMaster->mMediaSeekable = Info().mMediaSeekable; - mMaster->mMediaSeekableOnlyInBufferedRanges = Info().mMediaSeekableOnlyInBufferedRanges; + mMaster->mMediaSeekableOnlyInBufferedRanges = + Info().mMediaSeekableOnlyInBufferedRanges; if (Info().mMetadataDuration.isSome()) { mMaster->RecomputeDuration(); @@ -2062,8 +2093,8 @@ DecodingFirstFrameState::MaybeFinishDecodeFirstFrame() { MOZ_ASSERT(!mMaster->mSentFirstFrameLoadedEvent); - if ((mMaster->IsAudioDecoding() && AudioQueue().GetSize() == 0) || - (mMaster->IsVideoDecoding() && VideoQueue().GetSize() == 0)) { + if ((mMaster->IsAudioDecoding() && AudioQueue().GetSize() == 0) + || (mMaster->IsVideoDecoding() && VideoQueue().GetSize() == 0)) { return; } @@ -2077,9 +2108,9 @@ DecodingState::Enter() { MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent); - if (!mMaster->mIsVisible && - !mMaster->mVideoDecodeSuspendTimer.IsScheduled() && - !mMaster->mVideoDecodeSuspended) { + if (!mMaster->mIsVisible + && !mMaster->mVideoDecodeSuspendTimer.IsScheduled() + && !mMaster->mVideoDecodeSuspended) { // If we are not visible and the timer is not schedule, it means the timer // has timed out and we should suspend video decoding now if necessary. HandleVideoSuspendTimeout(); @@ -2148,15 +2179,15 @@ void MediaDecoderStateMachine:: DecodingState::DispatchDecodeTasksIfNeeded() { - if (mMaster->IsAudioDecoding() && - !mMaster->mMinimizePreroll && - !mMaster->HaveEnoughDecodedAudio()) { + if (mMaster->IsAudioDecoding() + && !mMaster->mMinimizePreroll + && !mMaster->HaveEnoughDecodedAudio()) { EnsureAudioDecodeTaskQueued(); } - if (mMaster->IsVideoDecoding() && - !mMaster->mMinimizePreroll && - !mMaster->HaveEnoughDecodedVideo()) { + if (mMaster->IsVideoDecoding() + && !mMaster->mMinimizePreroll + && !mMaster->HaveEnoughDecodedVideo()) { EnsureVideoDecodeTaskQueued(); } } @@ -2165,9 +2196,9 @@ void MediaDecoderStateMachine:: DecodingState::EnsureAudioDecodeTaskQueued() { - if (!mMaster->IsAudioDecoding() || - mMaster->IsRequestingAudioData() || - mMaster->IsWaitingAudioData()) { + if (!mMaster->IsAudioDecoding() + || mMaster->IsRequestingAudioData() + || mMaster->IsWaitingAudioData()) { return; } mMaster->RequestAudioData(); @@ -2177,13 +2208,14 @@ void MediaDecoderStateMachine:: DecodingState::EnsureVideoDecodeTaskQueued() { - if (!mMaster->IsVideoDecoding() || - mMaster->IsRequestingVideoData() || - mMaster->IsWaitingVideoData()) { + if (!mMaster->IsVideoDecoding() + || mMaster->IsRequestingVideoData() + || mMaster->IsWaitingVideoData()) { return; } - mMaster->RequestVideoData(NeedToSkipToNextKeyframe(), - media::TimeUnit::FromMicroseconds(mMaster->GetMediaTime())); + mMaster->RequestVideoData( + NeedToSkipToNextKeyframe(), + media::TimeUnit::FromMicroseconds(mMaster->GetMediaTime())); } bool @@ -2211,17 +2243,22 @@ DecodingState::NeedToSkipToNextKeyframe() // after buffering finishes. We ignore the low audio calculations for // readers that are async, as since their audio decode runs on a different // task queue it should never run low and skipping won't help their decode. - bool isLowOnDecodedAudio = !Reader()->IsAsync() && - mMaster->IsAudioDecoding() && - (mMaster->GetDecodedAudioDuration() < - mMaster->mLowAudioThresholdUsecs * mMaster->mPlaybackRate); - bool isLowOnDecodedVideo = (mMaster->GetClock() - mMaster->mDecodedVideoEndTime) * mMaster->mPlaybackRate > - LOW_VIDEO_THRESHOLD_USECS; + bool isLowOnDecodedAudio = + !Reader()->IsAsync() + && mMaster->IsAudioDecoding() + && (mMaster->GetDecodedAudioDuration() + < mMaster->mLowAudioThresholdUsecs * mMaster->mPlaybackRate); + bool isLowOnDecodedVideo = + (mMaster->GetClock() - mMaster->mDecodedVideoEndTime) + * mMaster->mPlaybackRate + > LOW_VIDEO_THRESHOLD_USECS; bool lowBuffered = mMaster->HasLowBufferedData(); if ((isLowOnDecodedAudio || isLowOnDecodedVideo) && !lowBuffered) { - SLOG("Skipping video decode to the next keyframe lowAudio=%d lowVideo=%d lowUndecoded=%d async=%d", - isLowOnDecodedAudio, isLowOnDecodedVideo, lowBuffered, Reader()->IsAsync()); + SLOG("Skipping video decode to the next keyframe lowAudio=%d lowVideo=%d " + "lowUndecoded=%d async=%d", + isLowOnDecodedAudio, isLowOnDecodedVideo, lowBuffered, + Reader()->IsAsync()); return true; } @@ -2248,13 +2285,13 @@ DecodingState::MaybeStartBuffering() bool shouldBuffer; if (Reader()->UseBufferingHeuristics()) { - shouldBuffer = IsExpectingMoreData() && - mMaster->HasLowDecodedData() && - mMaster->HasLowBufferedData(); + shouldBuffer = IsExpectingMoreData() + && mMaster->HasLowDecodedData() + && mMaster->HasLowBufferedData(); } else { shouldBuffer = - (mMaster->OutOfDecodedAudio() && mMaster->IsWaitingAudioData()) || - (mMaster->OutOfDecodedVideo() && mMaster->IsWaitingVideoData()); + (mMaster->OutOfDecodedAudio() && mMaster->IsWaitingAudioData()) + || (mMaster->OutOfDecodedVideo() && mMaster->IsWaitingVideoData()); } if (shouldBuffer) { SetState(); @@ -2305,7 +2342,8 @@ SeekingState::SeekCompleted() } // Try to decode another frame to detect if we're at the end... - SLOG("Seek completed, mCurrentPosition=%lld", mMaster->mCurrentPosition.Ref()); + SLOG("Seek completed, mCurrentPosition=%lld", + mMaster->mCurrentPosition.Ref()); if (mMaster->VideoQueue().PeekFront()) { mMaster->mMediaSink->Redraw(Info().mVideo); @@ -2319,17 +2357,17 @@ void MediaDecoderStateMachine:: BufferingState::DispatchDecodeTasksIfNeeded() { - if (mMaster->IsAudioDecoding() && - !mMaster->HaveEnoughDecodedAudio() && - !mMaster->IsRequestingAudioData() && - !mMaster->IsWaitingAudioData()) { + if (mMaster->IsAudioDecoding() + && !mMaster->HaveEnoughDecodedAudio() + && !mMaster->IsRequestingAudioData() + && !mMaster->IsWaitingAudioData()) { mMaster->RequestAudioData(); } - if (mMaster->IsVideoDecoding() && - !mMaster->HaveEnoughDecodedVideo() && - !mMaster->IsRequestingVideoData() && - !mMaster->IsWaitingVideoData()) { + if (mMaster->IsVideoDecoding() + && !mMaster->HaveEnoughDecodedVideo() + && !mMaster->IsRequestingVideoData() + && !mMaster->IsWaitingVideoData()) { mMaster->RequestVideoData(false, media::TimeUnit()); } } @@ -2347,10 +2385,11 @@ BufferingState::Step() if (Reader()->UseBufferingHeuristics()) { TimeDuration elapsed = now - mBufferingStart; bool isLiveStream = Resource()->IsLiveStream(); - if ((isLiveStream || !mMaster->CanPlayThrough()) && - elapsed < TimeDuration::FromSeconds(mBufferingWait * mMaster->mPlaybackRate) && - mMaster->HasLowBufferedData(mBufferingWait * USECS_PER_S) && - IsExpectingMoreData()) { + if ((isLiveStream || !mMaster->CanPlayThrough()) + && elapsed + < TimeDuration::FromSeconds(mBufferingWait * mMaster->mPlaybackRate) + && mMaster->HasLowBufferedData(mBufferingWait * USECS_PER_S) + && IsExpectingMoreData()) { SLOG("Buffering: wait %ds, timeout in %.3lfs", mBufferingWait, mBufferingWait - elapsed.ToSeconds()); mMaster->ScheduleStateMachineIn(USECS_PER_S); @@ -2359,12 +2398,12 @@ BufferingState::Step() } } else if (mMaster->OutOfDecodedAudio() || mMaster->OutOfDecodedVideo()) { DispatchDecodeTasksIfNeeded(); - MOZ_ASSERT(!mMaster->OutOfDecodedAudio() || - mMaster->IsRequestingAudioData() || - mMaster->IsWaitingAudioData()); - MOZ_ASSERT(!mMaster->OutOfDecodedVideo() || - mMaster->IsRequestingVideoData() || - mMaster->IsWaitingVideoData()); + MOZ_ASSERT(!mMaster->OutOfDecodedAudio() + || mMaster->IsRequestingAudioData() + || mMaster->IsWaitingAudioData()); + MOZ_ASSERT(!mMaster->OutOfDecodedVideo() + || mMaster->IsRequestingVideoData() + || mMaster->IsWaitingVideoData()); SLOG("In buffering mode, waiting to be notified: outOfAudio: %d, " "mAudioStatus: %s, outOfVideo: %d, mVideoStatus: %s", mMaster->OutOfDecodedAudio(), mMaster->AudioRequestStatus(), @@ -2530,9 +2569,9 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, #ifdef XP_WIN // Ensure high precision timers are enabled on Windows, otherwise the state - // machine isn't woken up at reliable intervals to set the next frame, - // and we drop frames while painting. Note that multiple calls to this - // function per-process is OK, provided each call is matched by a corresponding + // machine isn't woken up at reliable intervals to set the next frame, and we + // drop frames while painting. Note that multiple calls to this function + // per-process is OK, provided each call is matched by a corresponding // timeEndPeriod() call. timeBeginPeriod(1); #endif @@ -2572,17 +2611,23 @@ MediaDecoderStateMachine::InitializationTask(MediaDecoder* aDecoder) mDecoderPosition.Connect(aDecoder->CanonicalDecoderPosition()); // Initialize watchers. - mWatchManager.Watch(mBuffered, &MediaDecoderStateMachine::BufferedRangeUpdated); + mWatchManager.Watch(mBuffered, + &MediaDecoderStateMachine::BufferedRangeUpdated); mWatchManager.Watch(mVolume, &MediaDecoderStateMachine::VolumeChanged); - mWatchManager.Watch(mPreservesPitch, &MediaDecoderStateMachine::PreservesPitchChanged); - mWatchManager.Watch(mEstimatedDuration, &MediaDecoderStateMachine::RecomputeDuration); - mWatchManager.Watch(mExplicitDuration, &MediaDecoderStateMachine::RecomputeDuration); - mWatchManager.Watch(mObservedDuration, &MediaDecoderStateMachine::RecomputeDuration); + mWatchManager.Watch(mPreservesPitch, + &MediaDecoderStateMachine::PreservesPitchChanged); + mWatchManager.Watch(mEstimatedDuration, + &MediaDecoderStateMachine::RecomputeDuration); + mWatchManager.Watch(mExplicitDuration, + &MediaDecoderStateMachine::RecomputeDuration); + mWatchManager.Watch(mObservedDuration, + &MediaDecoderStateMachine::RecomputeDuration); mWatchManager.Watch(mPlayState, &MediaDecoderStateMachine::PlayStateChanged); if (MediaPrefs::MDSMSuspendBackgroundVideoEnabled()) { mIsVisible.Connect(aDecoder->CanonicalIsVisible()); - mWatchManager.Watch(mIsVisible, &MediaDecoderStateMachine::VisibilityChanged); + mWatchManager.Watch(mIsVisible, + &MediaDecoderStateMachine::VisibilityChanged); } } @@ -2603,7 +2648,8 @@ MediaDecoderStateMachine::CreateAudioSink() self->Info().mAudio, self->mAudioChannel); self->mAudibleListener = audioSink->AudibleEvent().Connect( - self->mTaskQueue, self.get(), &MediaDecoderStateMachine::AudioAudibleChanged); + self->mTaskQueue, self.get(), + &MediaDecoderStateMachine::AudioAudibleChanged); return audioSink; }; return new AudioSinkWrapper(mTaskQueue, audioSinkCreator); @@ -2612,10 +2658,11 @@ MediaDecoderStateMachine::CreateAudioSink() already_AddRefed MediaDecoderStateMachine::CreateMediaSink(bool aAudioCaptured) { - RefPtr audioSink = aAudioCaptured - ? new DecodedStream(mTaskQueue, mAbstractMainThread, mAudioQueue, mVideoQueue, - mOutputStreamManager, mSameOriginMedia.Ref(), - mMediaPrincipalHandle.Ref()) + RefPtr audioSink = + aAudioCaptured + ? new DecodedStream(mTaskQueue, mAbstractMainThread, mAudioQueue, + mVideoQueue, mOutputStreamManager, + mSameOriginMedia.Ref(), mMediaPrincipalHandle.Ref()) : CreateAudioSink(); RefPtr mediaSink = @@ -2644,8 +2691,8 @@ MediaDecoderStateMachine::HaveEnoughDecodedAudio() { MOZ_ASSERT(OnTaskQueue()); auto ampleAudioUSecs = mAmpleAudioThresholdUsecs * mPlaybackRate; - return AudioQueue().GetSize() > 0 && - GetDecodedAudioDuration() >= ampleAudioUSecs; + return AudioQueue().GetSize() > 0 + && GetDecodedAudioDuration() >= ampleAudioUSecs; } bool MediaDecoderStateMachine::HaveEnoughDecodedVideo() @@ -2804,7 +2851,8 @@ void MediaDecoderStateMachine::UpdatePlaybackPosition(int64_t aTime) MOZ_ASSERT(OnTaskQueue()); UpdatePlaybackPositionInternal(aTime); - bool fragmentEnded = mFragmentEndTime >= 0 && GetMediaTime() >= mFragmentEndTime; + bool fragmentEnded = + mFragmentEndTime >= 0 && GetMediaTime() >= mFragmentEndTime; mMetadataManager.DispatchMetadataIfNeeded(TimeUnit::FromMicroseconds(aTime)); if (fragmentEnded) { @@ -2873,8 +2921,8 @@ void MediaDecoderStateMachine::RecomputeDuration() // The duration is always exactly known with MSE and there's no need to adjust // it based on what may have been seen in the past; in particular as this data // may no longer exist such as when the mediasource duration was reduced. - if (mExplicitDuration.Ref().isNothing() && - duration < mObservedDuration.Ref()) { + if (mExplicitDuration.Ref().isNothing() + && duration < mObservedDuration.Ref()) { duration = mObservedDuration; } @@ -2897,8 +2945,8 @@ void MediaDecoderStateMachine::PlayStateChanged() mVideoDecodeSuspendTimer.Reset(); } else if (mMinimizePreroll) { // Once we start playing, we don't want to minimize our prerolling, as we - // assume the user is likely to want to keep playing in future. This needs to - // happen before we invoke StartDecoding(). + // assume the user is likely to want to keep playing in future. This needs + // to happen before we invoke StartDecoding(). mMinimizePreroll = false; } @@ -2956,18 +3004,23 @@ MediaDecoderStateMachine::Seek(const SeekTarget& aTarget) MOZ_ASSERT(OnTaskQueue()); if (IsShutdown()) { - return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true, __func__); + return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true, + __func__); } // We need to be able to seek in some way if (!mMediaSeekable && !mMediaSeekableOnlyInBufferedRanges) { - DECODER_WARN("Seek() function should not be called on a non-seekable state machine"); - return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true, __func__); + DECODER_WARN( + "Seek() function should not be called on a non-seekable state machine"); + return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true, + __func__); } if (aTarget.IsNextFrame() && !HasVideo()) { - DECODER_WARN("Ignore a NextFrameSeekTask on a media file without video track."); - return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true, __func__); + DECODER_WARN( + "Ignore a NextFrameSeekTask on a media file without video track."); + return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true, + __func__); } MOZ_ASSERT(mDuration.Ref().isSome(), "We should have got duration already"); @@ -3012,8 +3065,10 @@ MediaDecoderStateMachine::RequestAudioData() MOZ_ASSERT(aAudio); mAudioDataRequest.Complete(); // audio->GetEndTime() is not always mono-increasing in chained ogg. - mDecodedAudioEndTime = std::max(aAudio->GetEndTime(), mDecodedAudioEndTime); - SAMPLE_LOG("OnAudioDecoded [%lld,%lld]", aAudio->mTime, aAudio->GetEndTime()); + mDecodedAudioEndTime = + std::max(aAudio->GetEndTime(), mDecodedAudioEndTime); + SAMPLE_LOG("OnAudioDecoded [%lld,%lld]", aAudio->mTime, + aAudio->GetEndTime()); mStateObj->HandleAudioDecoded(aAudio); }, [this] (const MediaResult& aError) { @@ -3043,9 +3098,10 @@ MediaDecoderStateMachine::RequestVideoData(bool aSkipToNextKeyframe, MOZ_ASSERT(IsVideoDecoding()); MOZ_ASSERT(!IsRequestingVideoData()); MOZ_ASSERT(!IsWaitingVideoData()); - SAMPLE_LOG("Queueing video task - queued=%i, decoder-queued=%o, skip=%i, time=%lld", - VideoQueue().GetSize(), mReader->SizeOfVideoQueueInFrames(), aSkipToNextKeyframe, - aCurrentTime.ToMicroseconds()); + SAMPLE_LOG( + "Queueing video task - queued=%i, decoder-queued=%o, skip=%i, time=%lld", + VideoQueue().GetSize(), mReader->SizeOfVideoQueueInFrames(), + aSkipToNextKeyframe, aCurrentTime.ToMicroseconds()); TimeStamp videoDecodeStartTime = TimeStamp::Now(); mReader->RequestVideoData(aSkipToNextKeyframe, aCurrentTime)->Then( @@ -3054,8 +3110,10 @@ MediaDecoderStateMachine::RequestVideoData(bool aSkipToNextKeyframe, MOZ_ASSERT(aVideo); mVideoDataRequest.Complete(); // Handle abnormal or negative timestamps. - mDecodedVideoEndTime = std::max(mDecodedVideoEndTime, aVideo->GetEndTime()); - SAMPLE_LOG("OnVideoDecoded [%lld,%lld]", aVideo->mTime, aVideo->GetEndTime()); + mDecodedVideoEndTime = + std::max(mDecodedVideoEndTime, aVideo->GetEndTime()); + SAMPLE_LOG("OnVideoDecoded [%lld,%lld]", aVideo->mTime, + aVideo->GetEndTime()); mStateObj->HandleVideoDecoded(aVideo, videoDecodeStartTime); }, [this] (const MediaResult& aError) { @@ -3141,16 +3199,17 @@ bool MediaDecoderStateMachine::HasLowDecodedAudio() { MOZ_ASSERT(OnTaskQueue()); - return IsAudioDecoding() && - GetDecodedAudioDuration() < EXHAUSTED_DATA_MARGIN_USECS * mPlaybackRate; + return IsAudioDecoding() + && GetDecodedAudioDuration() + < EXHAUSTED_DATA_MARGIN_USECS * mPlaybackRate; } bool MediaDecoderStateMachine::HasLowDecodedVideo() { MOZ_ASSERT(OnTaskQueue()); - return IsVideoDecoding() && - VideoQueue().GetSize() < LOW_VIDEO_FRAMES * mPlaybackRate; + return IsVideoDecoding() + && VideoQueue().GetSize() < LOW_VIDEO_FRAMES * mPlaybackRate; } bool @@ -3164,9 +3223,9 @@ MediaDecoderStateMachine::HasLowDecodedData() bool MediaDecoderStateMachine::OutOfDecodedAudio() { MOZ_ASSERT(OnTaskQueue()); - return IsAudioDecoding() && !AudioQueue().IsFinished() && - AudioQueue().GetSize() == 0 && - !mMediaSink->HasUnplayedFrames(TrackInfo::kAudioTrack); + return IsAudioDecoding() && !AudioQueue().IsFinished() + && AudioQueue().GetSize() == 0 + && !mMediaSink->HasUnplayedFrames(TrackInfo::kAudioTrack); } bool MediaDecoderStateMachine::HasLowBufferedData() @@ -3194,14 +3253,15 @@ bool MediaDecoderStateMachine::HasLowBufferedData(int64_t aUsecs) // decoded all audio/video samples. int64_t endOfDecodedVideoData = (HasVideo() && !VideoQueue().IsFinished()) - ? mDecodedVideoEndTime - : INT64_MAX; + ? mDecodedVideoEndTime + : INT64_MAX; int64_t endOfDecodedAudioData = (HasAudio() && !AudioQueue().IsFinished()) - ? mDecodedAudioEndTime - : INT64_MAX; + ? mDecodedAudioEndTime + : INT64_MAX; - int64_t endOfDecodedData = std::min(endOfDecodedVideoData, endOfDecodedAudioData); + int64_t endOfDecodedData = + std::min(endOfDecodedVideoData, endOfDecodedAudioData); if (Duration().ToMicroseconds() < endOfDecodedData) { // Our duration is not up to date. No point buffering. return false; @@ -3271,7 +3331,8 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame() DECODER_LOG("Media duration %lld, " "transportSeekable=%d, mediaSeekable=%d", - Duration().ToMicroseconds(), mResource->IsTransportSeekable(), mMediaSeekable); + Duration().ToMicroseconds(), mResource->IsTransportSeekable(), + mMediaSeekable); // Get potentially updated metadata mReader->ReadUpdatedMetadata(mInfo.ptr()); @@ -3364,7 +3425,8 @@ MediaDecoderStateMachine::UpdatePlaybackPositionPeriodically() // the current frame. NS_ASSERTION(clockTime >= 0, "Should have positive clock time."); - // These will be non -1 if we've displayed a video frame, or played an audio frame. + // These will be non -1 if we've displayed a video frame, or played an audio + // frame. int64_t t = std::min(clockTime, std::max(VideoEndTime(), AudioEndTime())); // FIXME: Bug 1091422 - chained ogg files hit this assertion. //MOZ_ASSERT(t >= GetMediaTime()); @@ -3385,11 +3447,16 @@ MediaDecoderStateMachine::UpdatePlaybackPositionPeriodically() MediaDecoderStateMachine::ToStr(NextFrameStatus aStatus) { switch (aStatus) { - case MediaDecoderOwner::NEXT_FRAME_AVAILABLE: return "NEXT_FRAME_AVAILABLE"; - case MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE: return "NEXT_FRAME_UNAVAILABLE"; - case MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING: return "NEXT_FRAME_UNAVAILABLE_BUFFERING"; - case MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING: return "NEXT_FRAME_UNAVAILABLE_SEEKING"; - case MediaDecoderOwner::NEXT_FRAME_UNINITIALIZED: return "NEXT_FRAME_UNINITIALIZED"; + case MediaDecoderOwner::NEXT_FRAME_AVAILABLE: + return "NEXT_FRAME_AVAILABLE"; + case MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE: + return "NEXT_FRAME_UNAVAILABLE"; + case MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING: + return "NEXT_FRAME_UNAVAILABLE_BUFFERING"; + case MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING: + return "NEXT_FRAME_UNAVAILABLE_SEEKING"; + case MediaDecoderOwner::NEXT_FRAME_UNINITIALIZED: + return "NEXT_FRAME_UNINITIALIZED"; } return "UNKNOWN"; } @@ -3416,7 +3483,8 @@ MediaDecoderStateMachine::GetStatistics() { MOZ_ASSERT(OnTaskQueue()); MediaStatistics result; - result.mDownloadRate = mResource->GetDownloadRate(&result.mDownloadRateReliable); + result.mDownloadRate = + mResource->GetDownloadRate(&result.mDownloadRateReliable); result.mDownloadPosition = mResource->GetCachedDataEnd(mDecoderPosition); result.mTotalBytes = mResource->GetLength(); result.mPlaybackRate = mPlaybackBytesPerSecond; @@ -3435,15 +3503,16 @@ MediaDecoderStateMachine::ScheduleStateMachine() } mDispatchedStateMachine = true; - OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaDecoderStateMachine::RunStateMachine)); + OwnerThread()->Dispatch( + NewRunnableMethod(this, &MediaDecoderStateMachine::RunStateMachine)); } void MediaDecoderStateMachine::ScheduleStateMachineIn(int64_t aMicroseconds) { - MOZ_ASSERT(OnTaskQueue()); // mDelayedScheduler.Ensure() may Disconnect() - // the promise, which must happen on the state - // machine task queue. + MOZ_ASSERT(OnTaskQueue()); // mDelayedScheduler.Ensure() may Disconnect() + // the promise, which must happen on the state + // machine task queue. MOZ_ASSERT(aMicroseconds > 0); if (mDispatchedStateMachine) { return; @@ -3635,9 +3704,8 @@ MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured) // Don't buffer as much when audio is captured because we don't need to worry // about high latency audio devices. - mAmpleAudioThresholdUsecs = mAudioCaptured ? - detail::AMPLE_AUDIO_USECS / 2 : - detail::AMPLE_AUDIO_USECS; + mAmpleAudioThresholdUsecs = + mAudioCaptured ? detail::AMPLE_AUDIO_USECS / 2 : detail::AMPLE_AUDIO_USECS; mStateObj->HandleAudioCaptured(); } @@ -3646,8 +3714,8 @@ uint32_t MediaDecoderStateMachine::GetAmpleVideoFrames() const { MOZ_ASSERT(OnTaskQueue()); return (mReader->IsAsync() && mReader->VideoIsHardwareAccelerated()) - ? std::max(sVideoQueueHWAccelSize, MIN_VIDEO_QUEUE_SIZE) - : std::max(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE); + ? std::max(sVideoQueueHWAccelSize, MIN_VIDEO_QUEUE_SIZE) + : std::max(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE); } nsCString @@ -3655,16 +3723,18 @@ MediaDecoderStateMachine::GetDebugInfo() { MOZ_ASSERT(OnTaskQueue()); return nsPrintfCString( - "GetMediaTime=%lld GetClock=%lld mMediaSink=%p " - "state=%s mPlayState=%d mSentFirstFrameLoadedEvent=%d IsPlaying=%d " - "mAudioStatus=%s mVideoStatus=%s mDecodedAudioEndTime=%lld mDecodedVideoEndTime=%lld " - "mAudioCompleted=%d mVideoCompleted=%d ", - GetMediaTime(), mMediaSink->IsStarted() ? GetClock() : -1, mMediaSink.get(), - ToStateStr(), mPlayState.Ref(), mSentFirstFrameLoadedEvent, IsPlaying(), - AudioRequestStatus(), VideoRequestStatus(), mDecodedAudioEndTime, mDecodedVideoEndTime, - mAudioCompleted, mVideoCompleted) - + mStateObj->GetDebugInfo() + nsCString("\n") - + mMediaSink->GetDebugInfo(); + "GetMediaTime=%lld GetClock=%lld mMediaSink=%p " + "state=%s mPlayState=%d mSentFirstFrameLoadedEvent=%d IsPlaying=%d " + "mAudioStatus=%s mVideoStatus=%s mDecodedAudioEndTime=%lld " + "mDecodedVideoEndTime=%lld " + "mAudioCompleted=%d mVideoCompleted=%d ", + GetMediaTime(), mMediaSink->IsStarted() ? GetClock() : -1, + mMediaSink.get(), ToStateStr(), mPlayState.Ref(), + mSentFirstFrameLoadedEvent, IsPlaying(), AudioRequestStatus(), + VideoRequestStatus(), mDecodedAudioEndTime, mDecodedVideoEndTime, + mAudioCompleted, mVideoCompleted) + + mStateObj->GetDebugInfo() + nsCString("\n") + + mMediaSink->GetDebugInfo(); } RefPtr diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index b7c5dfc1754a..7dd0c4e0b141 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -114,7 +114,8 @@ class TaskQueue; extern LazyLogModule gMediaDecoderLog; extern LazyLogModule gMediaSampleLog; -enum class MediaEventType : int8_t { +enum class MediaEventType : int8_t +{ PlaybackStarted, PlaybackStopped, PlaybackEnded, @@ -150,7 +151,8 @@ public: nsresult Init(MediaDecoder* aDecoder); // Enumeration for the valid decoding states - enum State { + enum State + { DECODER_STATE_DECODING_METADATA, DECODER_STATE_WAIT_FOR_CDM, DECODER_STATE_DORMANT, @@ -430,7 +432,8 @@ protected: // [mStartTime, mEndTime], and mStartTime will not be 0 if the media does // not start at 0. Note this is different than the "current playback position", // which is in the range [0,duration]. - int64_t GetMediaTime() const { + int64_t GetMediaTime() const + { MOZ_ASSERT(OnTaskQueue()); return mCurrentPosition; } @@ -494,7 +497,11 @@ private: UniquePtr mStateObj; - media::TimeUnit Duration() const { MOZ_ASSERT(OnTaskQueue()); return mDuration.Ref().ref(); } + media::TimeUnit Duration() const + { + MOZ_ASSERT(OnTaskQueue()); + return mDuration.Ref().ref(); + } // Recomputes the canonical duration from various sources. void RecomputeDuration(); @@ -515,8 +522,8 @@ private: bool IsLogicallyPlaying() { MOZ_ASSERT(OnTaskQueue()); - return mPlayState == MediaDecoder::PLAY_STATE_PLAYING || - mNextPlayState == MediaDecoder::PLAY_STATE_PLAYING; + return mPlayState == MediaDecoder::PLAY_STATE_PLAYING + || mNextPlayState == MediaDecoder::PLAY_STATE_PLAYING; } // Media Fragment end time in microseconds. Access controlled by decoder monitor. @@ -751,22 +758,25 @@ private: public: AbstractCanonical* CanonicalBuffered() const; - AbstractCanonical* CanonicalDuration() { + AbstractCanonical* CanonicalDuration() + { return &mDuration; } - AbstractCanonical* CanonicalIsShutdown() { - return &mIsShutdown; - } - AbstractCanonical* CanonicalNextFrameStatus() { + AbstractCanonical* CanonicalIsShutdown() { return &mIsShutdown; } + AbstractCanonical* CanonicalNextFrameStatus() + { return &mNextFrameStatus; } - AbstractCanonical* CanonicalCurrentPosition() { + AbstractCanonical* CanonicalCurrentPosition() + { return &mCurrentPosition; } - AbstractCanonical* CanonicalPlaybackOffset() { + AbstractCanonical* CanonicalPlaybackOffset() + { return &mPlaybackOffset; } - AbstractCanonical* CanonicalIsAudioDataAudible() { + AbstractCanonical* CanonicalIsAudioDataAudible() + { return &mIsAudioDataAudible; } }; diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 6528406bf41f..3dde44707b19 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -102,9 +102,7 @@ StaticMutex DecoderAllocPolicy::sMutex; class DecoderAllocPolicy::AutoDeallocToken : public Token { public: - explicit AutoDeallocToken(TrackType aTrack) - : mTrack(aTrack) - {} + explicit AutoDeallocToken(TrackType aTrack) : mTrack(aTrack) { } private: ~AutoDeallocToken() @@ -120,7 +118,8 @@ DecoderAllocPolicy::DecoderAllocPolicy(TrackType aTrack) , mDecoderLimit(MediaPrefs::MediaDecoderLimit()) , mTrack(aTrack) { - // Non DocGroup-version AbstractThread::MainThread is fine for ClearOnShutdown(). + // Non DocGroup-version AbstractThread::MainThread is fine for + // ClearOnShutdown(). AbstractThread::MainThread()->Dispatch(NS_NewRunnableFunction([this] () { ClearOnShutdown(this, ShutdownPhase::ShutdownThreads); })); @@ -197,13 +196,13 @@ class MediaFormatReader::DecoderFactory using Token = DecoderAllocPolicy::Token; public: - explicit DecoderFactory(MediaFormatReader* aOwner) : mOwner(aOwner) {} + explicit DecoderFactory(MediaFormatReader* aOwner) : mOwner(aOwner) { } void CreateDecoder(TrackType aTrack); // Shutdown any decoder pending initialization. RefPtr ShutdownDecoder(TrackType aTrack) { - MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack || - aTrack == TrackInfo::kVideoTrack); + MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack + || aTrack == TrackInfo::kVideoTrack); auto& data = aTrack == TrackInfo::kAudioTrack ? mAudio : mVideo; data.mTokenRequest.DisconnectIfExists(); data.mInitRequest.DisconnectIfExists(); @@ -253,8 +252,8 @@ private: void MediaFormatReader::DecoderFactory::CreateDecoder(TrackType aTrack) { - MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack || - aTrack == TrackInfo::kVideoTrack); + MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack + || aTrack == TrackInfo::kVideoTrack); RunStage(aTrack); } @@ -370,7 +369,8 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) auto& data = aTrack == TrackInfo::kAudioTrack ? mAudio : mVideo; auto decoderCreatingError = "error creating audio decoder"; - MediaResult result = MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, decoderCreatingError); + MediaResult result = + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, decoderCreatingError); if (!mOwner->mPlatform) { mOwner->mPlatform = new PDMFactory(); @@ -475,10 +475,10 @@ class MediaFormatReader::DemuxerProxy class Wrapper; public: - explicit DemuxerProxy(MediaDataDemuxer* aDemuxer, AbstractThread* mainThread) + explicit DemuxerProxy(MediaDataDemuxer* aDemuxer, AbstractThread* aMainThread) : mTaskQueue(new AutoTaskQueue( GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER), - mainThread)) + aMainThread)) , mData(new Data(aDemuxer)) { MOZ_COUNT_CTOR(DemuxerProxy); @@ -579,7 +579,8 @@ private: explicit Data(MediaDataDemuxer* aDemuxer) : mInitDone(false) , mDemuxer(aDemuxer) - { } + { + } Atomic mInitDone; // Only ever accessed over mTaskQueue once. @@ -609,7 +610,8 @@ public: , mGetSamplesMayBlock(aTrackDemuxer->GetSamplesMayBlock()) , mInfo(aTrackDemuxer->GetInfo()) , mTrackDemuxer(aTrackDemuxer) - { } + { + } UniquePtr GetInfo() const override { @@ -1045,7 +1047,8 @@ public: , mInitDataType(aInitDataType) { } - NS_IMETHOD Run() override { + NS_IMETHOD Run() override + { // Note: Null check the owner, as the decoder could have been shutdown // since this event was dispatched. MediaDecoderOwner* owner = mDecoder->GetOwner(); @@ -1121,8 +1124,8 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) } // To decode, we need valid video and a place to put it. - bool videoActive = !!mDemuxer->GetNumberTracks(TrackInfo::kVideoTrack) && - GetImageContainer(); + bool videoActive = + !!mDemuxer->GetNumberTracks(TrackInfo::kVideoTrack) && GetImageContainer(); if (videoActive) { // We currently only handle the first video track. @@ -1135,7 +1138,8 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) UniquePtr videoInfo = mVideo.mTrackDemuxer->GetInfo(); videoActive = videoInfo && videoInfo->IsValid(); if (videoActive) { - if (platform && !platform->SupportsMimeType(videoInfo->mMimeType, nullptr)) { + if (platform + && !platform->SupportsMimeType(videoInfo->mMimeType, nullptr)) { // We have no decoder for this track. Error. mMetadataPromise.Reject(NS_ERROR_DOM_MEDIA_METADATA_ERR, __func__); return; @@ -1162,9 +1166,11 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) UniquePtr audioInfo = mAudio.mTrackDemuxer->GetInfo(); // We actively ignore audio tracks that we know we can't play. - audioActive = audioInfo && audioInfo->IsValid() && - (!platform || - platform->SupportsMimeType(audioInfo->mMimeType, nullptr)); + audioActive = + audioInfo + && audioInfo->IsValid() + && (!platform || platform->SupportsMimeType(audioInfo->mMimeType, + nullptr)); if (audioActive) { mInfo.mAudio = *audioInfo->GetAsAudioInfo(); @@ -1184,7 +1190,8 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) // Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING. for (uint32_t i = 0; i < crypto->mInitDatas.Length(); i++) { NS_DispatchToMainThread( - new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, crypto->mInitDatas[i].mType)); + new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, + crypto->mInitDatas[i].mType)); } mInfo.mCrypto = *crypto; } @@ -1234,8 +1241,8 @@ MediaFormatReader::MaybeResolveMetadataPromise() { MOZ_ASSERT(OnTaskQueue()); - if ((HasAudio() && mAudio.mFirstDemuxedSampleTime.isNothing()) || - (HasVideo() && mVideo.mFirstDemuxedSampleTime.isNothing())) { + if ((HasAudio() && mAudio.mFirstDemuxedSampleTime.isNothing()) + || (HasVideo() && mVideo.mFirstDemuxedSampleTime.isNothing())) { return; } @@ -1262,8 +1269,8 @@ MediaFormatReader::MaybeResolveMetadataPromise() bool MediaFormatReader::IsEncrypted() const { - return (HasAudio() && mInfo.mAudio.mCrypto.mValid) || - (HasVideo() && mInfo.mVideo.mCrypto.mValid); + return (HasAudio() && mInfo.mAudio.mCrypto.mValid) + || (HasVideo() && mInfo.mVideo.mCrypto.mValid); } void @@ -1282,8 +1289,8 @@ MediaFormatReader::ReadUpdatedMetadata(MediaInfo* aInfo) MediaFormatReader::DecoderData& MediaFormatReader::GetDecoderData(TrackType aTrack) { - MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack || - aTrack == TrackInfo::kVideoTrack); + MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack + || aTrack == TrackInfo::kVideoTrack); if (aTrack == TrackInfo::kAudioTrack) { return mAudio; } @@ -1291,7 +1298,8 @@ MediaFormatReader::GetDecoderData(TrackType aTrack) } bool -MediaFormatReader::ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold) +MediaFormatReader::ShouldSkip(bool aSkipToNextKeyframe, + media::TimeUnit aTimeThreshold) { MOZ_ASSERT(HasVideo()); media::TimeUnit nextKeyframe; @@ -1300,9 +1308,10 @@ MediaFormatReader::ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThr return aSkipToNextKeyframe; } return (nextKeyframe < aTimeThreshold || - (mVideo.mTimeThreshold && - mVideo.mTimeThreshold.ref().EndTime() < aTimeThreshold)) && - nextKeyframe.ToMicroseconds() >= 0 && !nextKeyframe.IsInfinite(); + (mVideo.mTimeThreshold + && mVideo.mTimeThreshold.ref().EndTime() < aTimeThreshold)) + && nextKeyframe.ToMicroseconds() >= 0 + && !nextKeyframe.IsInfinite(); } RefPtr @@ -1310,33 +1319,38 @@ MediaFormatReader::RequestVideoData(bool aSkipToNextKeyframe, int64_t aTimeThreshold) { MOZ_ASSERT(OnTaskQueue()); - MOZ_DIAGNOSTIC_ASSERT(mSeekPromise.IsEmpty(), "No sample requests allowed while seeking"); + MOZ_DIAGNOSTIC_ASSERT(mSeekPromise.IsEmpty(), + "No sample requests allowed while seeking"); MOZ_DIAGNOSTIC_ASSERT(!mVideo.HasPromise(), "No duplicate sample requests"); - MOZ_DIAGNOSTIC_ASSERT(!mVideo.mSeekRequest.Exists() || - mVideo.mTimeThreshold.isSome()); + MOZ_DIAGNOSTIC_ASSERT(!mVideo.mSeekRequest.Exists() + || mVideo.mTimeThreshold.isSome()); MOZ_DIAGNOSTIC_ASSERT(!IsSeeking(), "called mid-seek"); LOGV("RequestVideoData(%d, %lld)", aSkipToNextKeyframe, aTimeThreshold); if (!HasVideo()) { LOG("called with no video track"); - return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); } if (IsSeeking()) { LOG("called mid-seek. Rejecting."); - return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, + __func__); } if (mShutdown) { NS_WARNING("RequestVideoData on shutdown MediaFormatReader!"); - return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, + __func__); } - media::TimeUnit timeThreshold{media::TimeUnit::FromMicroseconds(aTimeThreshold)}; + media::TimeUnit timeThreshold{ media::TimeUnit::FromMicroseconds( + aTimeThreshold) }; // Ensure we have no pending seek going as ShouldSkip could return out of date // information. - if (!mVideo.HasInternalSeekPending() && - ShouldSkip(aSkipToNextKeyframe, timeThreshold)) { + if (!mVideo.HasInternalSeekPending() + && ShouldSkip(aSkipToNextKeyframe, timeThreshold)) { RefPtr p = mVideo.EnsurePromise(__func__); SkipVideoDemuxToNextKeyFrame(timeThreshold); return p; @@ -1403,11 +1417,14 @@ MediaFormatReader::DoDemuxVideo() } void -MediaFormatReader::OnVideoDemuxCompleted(RefPtr aSamples) +MediaFormatReader::OnVideoDemuxCompleted( + RefPtr aSamples) { LOGV("%d video samples demuxed (sid:%d)", aSamples->mSamples.Length(), - aSamples->mSamples[0]->mTrackInfo ? aSamples->mSamples[0]->mTrackInfo->GetID() : 0); + aSamples->mSamples[0]->mTrackInfo + ? aSamples->mSamples[0]->mTrackInfo->GetID() + : 0); mVideo.mDemuxRequest.Complete(); mVideo.mQueuedSamples.AppendElements(aSamples->mSamples); ScheduleUpdate(TrackInfo::kVideoTrack); @@ -1420,25 +1437,28 @@ MediaFormatReader::RequestAudioData() MOZ_DIAGNOSTIC_ASSERT(!mAudio.HasPromise(), "No duplicate sample requests"); MOZ_DIAGNOSTIC_ASSERT(IsVideoSeeking() || mSeekPromise.IsEmpty(), "No sample requests allowed while seeking"); - MOZ_DIAGNOSTIC_ASSERT(IsVideoSeeking() || - !mAudio.mSeekRequest.Exists() || - mAudio.mTimeThreshold.isSome()); + MOZ_DIAGNOSTIC_ASSERT(IsVideoSeeking() + || !mAudio.mSeekRequest.Exists() + || mAudio.mTimeThreshold.isSome()); MOZ_DIAGNOSTIC_ASSERT(IsVideoSeeking() || !IsSeeking(), "called mid-seek"); LOGV(""); if (!HasAudio()) { LOG("called with no audio track"); - return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); } if (IsSeeking()) { LOG("called mid-seek. Rejecting."); - return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, + __func__); } if (mShutdown) { NS_WARNING("RequestAudioData on shutdown MediaFormatReader!"); - return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, __func__); + return MediaDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, + __func__); } RefPtr p = mAudio.EnsurePromise(__func__); @@ -1470,19 +1490,22 @@ MediaFormatReader::DoDemuxAudio() } void -MediaFormatReader::OnAudioDemuxCompleted(RefPtr aSamples) +MediaFormatReader::OnAudioDemuxCompleted( + RefPtr aSamples) { LOGV("%d audio samples demuxed (sid:%d)", aSamples->mSamples.Length(), - aSamples->mSamples[0]->mTrackInfo ? aSamples->mSamples[0]->mTrackInfo->GetID() : 0); + aSamples->mSamples[0]->mTrackInfo + ? aSamples->mSamples[0]->mTrackInfo->GetID() + : 0); mAudio.mDemuxRequest.Complete(); mAudio.mQueuedSamples.AppendElements(aSamples->mSamples); ScheduleUpdate(TrackInfo::kAudioTrack); } void -MediaFormatReader::NotifyNewOutput(TrackType aTrack, - const MediaDataDecoder::DecodedData& aResults) +MediaFormatReader::NotifyNewOutput( + TrackType aTrack, const MediaDataDecoder::DecodedData& aResults) { MOZ_ASSERT(OnTaskQueue()); auto& decoder = GetDecoderData(aTrack); @@ -1560,13 +1583,13 @@ MediaFormatReader::NeedInput(DecoderData& aDecoder) // The decoder will not be fed a new raw sample until the current decoding // requests has completed. return - (aDecoder.HasPromise() || aDecoder.mTimeThreshold.isSome()) && - !aDecoder.HasPendingDrain() && - !aDecoder.HasFatalError() && - !aDecoder.mDemuxRequest.Exists() && - !aDecoder.mOutput.Length() && - !aDecoder.HasInternalSeekPending() && - !aDecoder.mDecodeRequest.Exists(); + (aDecoder.HasPromise() || aDecoder.mTimeThreshold.isSome()) + && !aDecoder.HasPendingDrain() + && !aDecoder.HasFatalError() + && !aDecoder.mDemuxRequest.Exists() + && !aDecoder.mOutput.Length() + && !aDecoder.HasInternalSeekPending() + && !aDecoder.mDecodeRequest.Exists(); } void @@ -1634,17 +1657,18 @@ MediaFormatReader::UpdateReceivedNewData(TrackType aTrack) return false; } - if (!mSeekPromise.IsEmpty() && - (!IsVideoSeeking() || aTrack == TrackInfo::kVideoTrack)) { + if (!mSeekPromise.IsEmpty() + && (!IsVideoSeeking() || aTrack == TrackInfo::kVideoTrack)) { MOZ_ASSERT(!decoder.HasPromise()); - MOZ_DIAGNOSTIC_ASSERT((IsVideoSeeking() || !mAudio.mTimeThreshold) && - !mVideo.mTimeThreshold, - "InternalSeek must have been aborted when Seek was first called"); - MOZ_DIAGNOSTIC_ASSERT((IsVideoSeeking() || !mAudio.HasWaitingPromise()) && - !mVideo.HasWaitingPromise(), - "Waiting promises must have been rejected when Seek was first called"); - if (mVideo.mSeekRequest.Exists() || - (!IsVideoSeeking() && mAudio.mSeekRequest.Exists())) { + MOZ_DIAGNOSTIC_ASSERT( + (IsVideoSeeking() || !mAudio.mTimeThreshold) && !mVideo.mTimeThreshold, + "InternalSeek must have been aborted when Seek was first called"); + MOZ_DIAGNOSTIC_ASSERT( + (IsVideoSeeking() || !mAudio.HasWaitingPromise()) + && !mVideo.HasWaitingPromise(), + "Waiting promises must have been rejected when Seek was first called"); + if (mVideo.mSeekRequest.Exists() + || (!IsVideoSeeking() && mAudio.mSeekRequest.Exists())) { // Already waiting for a seek to complete. Nothing more to do. return true; } @@ -1717,8 +1741,8 @@ MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack, } void -MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, - AbstractMediaDecoder::AutoNotifyDecoded& aA) +MediaFormatReader::HandleDemuxedSamples( + TrackType aTrack, AbstractMediaDecoder::AutoNotifyDecoded& aA) { MOZ_ASSERT(OnTaskQueue()); @@ -1746,8 +1770,8 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, RefPtr info = sample->mTrackInfo; if (info && decoder.mLastStreamSourceID != info->GetID()) { - bool supportRecycling = MediaPrefs::MediaDecoderCheckRecycling() && - decoder.mDecoder->SupportDecoderRecycling(); + bool supportRecycling = MediaPrefs::MediaDecoderCheckRecycling() + && decoder.mDecoder->SupportDecoderRecycling(); if (decoder.mNextStreamSourceID.isNothing() || decoder.mNextStreamSourceID.ref() != info->GetID()) { if (!supportRecycling) { @@ -1810,7 +1834,8 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack, } void -MediaFormatReader::InternalSeek(TrackType aTrack, const InternalSeekTarget& aTarget) +MediaFormatReader::InternalSeek(TrackType aTrack, + const InternalSeekTarget& aTarget) { MOZ_ASSERT(OnTaskQueue()); LOG("%s internal seek to %f", @@ -1826,8 +1851,9 @@ MediaFormatReader::InternalSeek(TrackType aTrack, const InternalSeekTarget& aTar [self, aTrack] (media::TimeUnit aTime) { auto& decoder = self->GetDecoderData(aTrack); decoder.mSeekRequest.Complete(); - MOZ_ASSERT(decoder.mTimeThreshold, - "Seek promise must be disconnected when timethreshold is reset"); + MOZ_ASSERT( + decoder.mTimeThreshold, + "Seek promise must be disconnected when timethreshold is reset"); decoder.mTimeThreshold.ref().mHasSeeked = true; self->SetVideoDecodeThreshold(); self->ScheduleUpdate(aTrack); @@ -1924,10 +1950,10 @@ MediaFormatReader::Update(TrackType aTrack) return; } - MOZ_DIAGNOSTIC_ASSERT(!decoder.HasInternalSeekPending() || - (!decoder.mOutput.Length() && - !decoder.mQueuedSamples.Length()), - "No frames can be demuxed or decoded while an internal seek is pending"); + MOZ_DIAGNOSTIC_ASSERT( + !decoder.HasInternalSeekPending() + || (!decoder.mOutput.Length() && !decoder.mQueuedSamples.Length()), + "No frames can be demuxed or decoded while an internal seek is pending"); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. @@ -1955,7 +1981,8 @@ MediaFormatReader::Update(TrackType aTrack) } } - while (decoder.mOutput.Length() && decoder.mOutput[0]->mType == MediaData::NULL_DATA) { + while (decoder.mOutput.Length() + && decoder.mOutput[0]->mType == MediaData::NULL_DATA) { LOGV("Dropping null data. Time: %lld", decoder.mOutput[0]->mTime); decoder.mOutput.RemoveElementAt(0); decoder.mSizeOfQueue -= 1; @@ -1981,7 +2008,8 @@ MediaFormatReader::Update(TrackType aTrack) if (output->mKeyframe) { if (mPreviousDecodedKeyframeTime_us < output->mTime) { // There is a previous keyframe -> Record inter-keyframe stats. - uint64_t segment_us = output->mTime - mPreviousDecodedKeyframeTime_us; + uint64_t segment_us = + output->mTime - mPreviousDecodedKeyframeTime_us; a.mStats.mInterKeyframeSum_us += segment_us; a.mStats.mInterKeyframeCount += 1; if (a.mStats.mInterKeyFrameMax_us < segment_us) { @@ -2013,7 +2041,8 @@ MediaFormatReader::Update(TrackType aTrack) // last sample decoded. LOG("Seeking to last sample time: %lld", decoder.mLastSampleTime.ref().mStart.ToMicroseconds()); - InternalSeek(aTrack, InternalSeekTarget(decoder.mLastSampleTime.ref(), true)); + InternalSeek(aTrack, + InternalSeekTarget(decoder.mLastSampleTime.ref(), true)); } if (!decoder.mReceivedNewData) { LOG("Rejecting %s promise: WAITING_FOR_DATA", TrackTypeToStr(aTrack)); @@ -2048,8 +2077,10 @@ MediaFormatReader::Update(TrackType aTrack) } if (decoder.mError && !decoder.HasFatalError()) { - bool needsNewDecoder = decoder.mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER; - if (!needsNewDecoder && ++decoder.mNumOfConsecutiveError > decoder.mMaxConsecutiveError) { + bool needsNewDecoder = + decoder.mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER; + if (!needsNewDecoder + && ++decoder.mNumOfConsecutiveError > decoder.mMaxConsecutiveError) { NotifyError(aTrack, decoder.mError.ref()); return; } @@ -2057,12 +2088,14 @@ MediaFormatReader::Update(TrackType aTrack) LOG("%s decoded error count %d", TrackTypeToStr(aTrack), decoder.mNumOfConsecutiveError); media::TimeUnit nextKeyframe; - if (aTrack == TrackType::kVideoTrack && !decoder.HasInternalSeekPending() && - NS_SUCCEEDED(decoder.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe))) { + if (aTrack == TrackType::kVideoTrack && !decoder.HasInternalSeekPending() + && NS_SUCCEEDED( + decoder.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe))) { if (needsNewDecoder) { ShutdownDecoder(aTrack); } - SkipVideoDemuxToNextKeyFrame(decoder.mLastSampleTime.refOr(TimeInterval()).Length()); + SkipVideoDemuxToNextKeyFrame( + decoder.mLastSampleTime.refOr(TimeInterval()).Length()); } else if (aTrack == TrackType::kAudioTrack) { decoder.Flush(); } @@ -2312,7 +2345,8 @@ MediaFormatReader::OnVideoSkipCompleted(uint32_t aSkipped) } void -MediaFormatReader::OnVideoSkipFailed(MediaTrackDemuxer::SkipFailureHolder aFailure) +MediaFormatReader::OnVideoSkipFailed( + MediaTrackDemuxer::SkipFailureHolder aFailure) { MOZ_ASSERT(OnTaskQueue()); LOG("Skipping failed, skipped %u frames", aFailure.mSkipped); @@ -2351,7 +2385,8 @@ MediaFormatReader::Seek(const SeekTarget& aTarget) MOZ_DIAGNOSTIC_ASSERT(aTarget.IsVideoOnly() || !mAudio.HasPromise()); MOZ_DIAGNOSTIC_ASSERT(mPendingSeekTime.isNothing()); MOZ_DIAGNOSTIC_ASSERT(mVideo.mTimeThreshold.isNothing()); - MOZ_DIAGNOSTIC_ASSERT(aTarget.IsVideoOnly() || mAudio.mTimeThreshold.isNothing()); + MOZ_DIAGNOSTIC_ASSERT(aTarget.IsVideoOnly() + || mAudio.mTimeThreshold.isNothing()); if (!mInfo.mMediaSeekable && !mInfo.mMediaSeekableOnlyInBufferedRanges) { LOG("Seek() END (Unseekable)"); @@ -2387,7 +2422,8 @@ MediaFormatReader::ScheduleSeek() return; } mSeekScheduled = true; - OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaFormatReader::AttemptSeek)); + OwnerThread()->Dispatch( + NewRunnableMethod(this, &MediaFormatReader::AttemptSeek)); } void @@ -2435,9 +2471,10 @@ MediaFormatReader::OnSeekFailed(TrackType aTrack, const MediaResult& aError) } if (aError == NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA) { - if (HasVideo() && aTrack == TrackType::kAudioTrack && - mFallbackSeekTime.isSome() && - mPendingSeekTime.ref() != mFallbackSeekTime.ref()) { + if (HasVideo() + && aTrack == TrackType::kAudioTrack + && mFallbackSeekTime.isSome() + && mPendingSeekTime.ref() != mFallbackSeekTime.ref()) { // We have failed to seek audio where video seeked to earlier. // Attempt to seek instead to the closest point that we know we have in // order to limit A/V sync discrepency. @@ -2468,8 +2505,8 @@ MediaFormatReader::OnSeekFailed(TrackType aTrack, const MediaResult& aError) MOZ_ASSERT(!mVideo.mSeekRequest.Exists() && !mAudio.mSeekRequest.Exists()); mPendingSeekTime.reset(); - auto type = aTrack == TrackType::kAudioTrack - ? MediaData::AUDIO_DATA : MediaData::VIDEO_DATA; + auto type = aTrack == TrackType::kAudioTrack ? MediaData::AUDIO_DATA + : MediaData::VIDEO_DATA; mSeekPromise.Reject(SeekRejectValue(type, aError), __func__); } @@ -2627,8 +2664,9 @@ MediaFormatReader::NotifyDataArrived() { MOZ_ASSERT(OnTaskQueue()); - if (mShutdown || !mDemuxer || - (!mDemuxerInitDone && !mDemuxerInitRequest.Exists())) { + if (mShutdown + || !mDemuxer + || (!mDemuxerInitDone && !mDemuxerInitRequest.Exists())) { return; } @@ -2717,8 +2755,8 @@ MediaFormatReader::UpdateBuffered() layers::ImageContainer* MediaFormatReader::GetImageContainer() { - return mVideoFrameContainer - ? mVideoFrameContainer->GetImageContainer() : nullptr; + return mVideoFrameContainer ? mVideoFrameContainer->GetImageContainer() + : nullptr; } void @@ -2741,44 +2779,37 @@ MediaFormatReader::GetMozDebugReaderData(nsACString& aString) result += nsPrintfCString("audio frames decoded: %lld\n", mAudio.mNumSamplesOutputTotal); if (HasAudio()) { - result += nsPrintfCString("audio state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", - NeedInput(mAudio), mAudio.HasPromise(), - mAudio.mDemuxRequest.Exists(), - int(mAudio.mQueuedSamples.Length()), - mAudio.mTimeThreshold - ? mAudio.mTimeThreshold.ref().Time().ToSeconds() - : -1.0, - mAudio.mTimeThreshold - ? mAudio.mTimeThreshold.ref().mHasSeeked - : -1, - mAudio.mNumSamplesInput, mAudio.mNumSamplesOutput, - unsigned(size_t(mAudio.mSizeOfQueue)), - unsigned(mAudio.mOutput.Length()), - mAudio.mWaitingForData, - mAudio.mLastStreamSourceID); + result += nsPrintfCString( + "audio state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu " + "out:%llu qs=%u pending:%u waiting:%d sid:%u\n", + NeedInput(mAudio), mAudio.HasPromise(), mAudio.mDemuxRequest.Exists(), + int(mAudio.mQueuedSamples.Length()), + mAudio.mTimeThreshold ? mAudio.mTimeThreshold.ref().Time().ToSeconds() + : -1.0, + mAudio.mTimeThreshold ? mAudio.mTimeThreshold.ref().mHasSeeked : -1, + mAudio.mNumSamplesInput, mAudio.mNumSamplesOutput, + unsigned(size_t(mAudio.mSizeOfQueue)), unsigned(mAudio.mOutput.Length()), + mAudio.mWaitingForData, mAudio.mLastStreamSourceID); } result += nsPrintfCString("video decoder: %s\n", videoName); - result += nsPrintfCString("hardware video decoding: %s\n", - VideoIsHardwareAccelerated() ? "enabled" : "disabled"); + result += + nsPrintfCString("hardware video decoding: %s\n", + VideoIsHardwareAccelerated() ? "enabled" : "disabled"); result += nsPrintfCString("video frames decoded: %lld (skipped:%lld)\n", mVideo.mNumSamplesOutputTotal, mVideo.mNumSamplesSkippedTotal); if (HasVideo()) { - result += nsPrintfCString("video state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d sid:%u\n", - NeedInput(mVideo), mVideo.HasPromise(), - mVideo.mDemuxRequest.Exists(), - int(mVideo.mQueuedSamples.Length()), - mVideo.mTimeThreshold - ? mVideo.mTimeThreshold.ref().Time().ToSeconds() - : -1.0, - mVideo.mTimeThreshold - ? mVideo.mTimeThreshold.ref().mHasSeeked - : -1, - mVideo.mNumSamplesInput, mVideo.mNumSamplesOutput, - unsigned(size_t(mVideo.mSizeOfQueue)), - unsigned(mVideo.mOutput.Length()), - mVideo.mWaitingForData, - mVideo.mLastStreamSourceID); + result += nsPrintfCString( + "video state: ni=%d no=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu " + "out:%llu qs=%u pending:%u waiting:%d sid:%u\n", + NeedInput(mVideo), mVideo.HasPromise(), mVideo.mDemuxRequest.Exists(), + int(mVideo.mQueuedSamples.Length()), + mVideo.mTimeThreshold ? mVideo.mTimeThreshold.ref().Time().ToSeconds() + : -1.0, + mVideo.mTimeThreshold ? mVideo.mTimeThreshold.ref().mHasSeeked : -1, + mVideo.mNumSamplesInput, mVideo.mNumSamplesOutput, + unsigned(size_t(mVideo.mSizeOfQueue)), unsigned(mVideo.mOutput.Length()), + mVideo.mWaitingForData, mVideo.mLastStreamSourceID); } aString += result; } @@ -2808,8 +2839,8 @@ MediaFormatReader::SetBlankDecode(TrackType aTrack, bool aIsBlankDecode) } void -MediaFormatReader::OnFirstDemuxCompleted(TrackInfo::TrackType aType, - RefPtr aSamples) +MediaFormatReader::OnFirstDemuxCompleted( + TrackInfo::TrackType aType, RefPtr aSamples) { MOZ_ASSERT(OnTaskQueue()); diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index b217edebb0ed..957431e04e1a 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -109,13 +109,15 @@ private: void DecodeDemuxedSamples(TrackType aTrack, MediaRawData* aSample); - struct InternalSeekTarget { + struct InternalSeekTarget + { InternalSeekTarget(const media::TimeInterval& aTime, bool aDropTarget) : mTime(aTime) , mDropTarget(aDropTarget) , mWaiting(false) , mHasSeeked(false) - {} + { + } media::TimeUnit Time() const { return mTime.mStart; } media::TimeUnit EndTime() const { return mTime.mEnd; } @@ -160,7 +162,8 @@ private: RefPtr mPlatform; - struct DecoderData { + struct DecoderData + { DecoderData(MediaFormatReader* aOwner, MediaData::Type aType, uint32_t aNumOfMaxError) @@ -187,7 +190,8 @@ private: , mIsHardwareAccelerated(false) , mLastStreamSourceID(UINT32_MAX) , mIsBlankDecode(false) - {} + { + } MediaFormatReader* mOwner; // Disambiguate Audio vs Video. @@ -208,8 +212,8 @@ private: if (mDecoder) { RefPtr owner = mOwner; TrackType type = mType == MediaData::AUDIO_DATA - ? TrackType::kAudioTrack - : TrackType::kVideoTrack; + ? TrackType::kAudioTrack + : TrackType::kVideoTrack; mDecoder->Shutdown() ->Then(mOwner->OwnerThread(), __func__, [owner, this, type]() { @@ -343,8 +347,8 @@ private: if (mDecoder && !mFlushed) { RefPtr owner = mOwner; TrackType type = mType == MediaData::AUDIO_DATA - ? TrackType::kAudioTrack - : TrackType::kVideoTrack; + ? TrackType::kAudioTrack + : TrackType::kVideoTrack; mDecoder->Flush() ->Then(mOwner->OwnerThread(), __func__, [owner, type, this]() { @@ -419,15 +423,16 @@ private: }; - class DecoderDataWithPromise : public DecoderData { + class DecoderDataWithPromise : public DecoderData + { public: DecoderDataWithPromise(MediaFormatReader* aOwner, MediaData::Type aType, uint32_t aNumOfMaxError) : DecoderData(aOwner, aType, aNumOfMaxError) , mHasPromise(false) - - {} + { + } bool HasPromise() const override { diff --git a/dom/media/MediaInfo.h b/dom/media/MediaInfo.h index 8e08862d5b92..24437af44397 100644 --- a/dom/media/MediaInfo.h +++ b/dom/media/MediaInfo.h @@ -23,13 +23,15 @@ class AudioInfo; class VideoInfo; class TextInfo; -class MetadataTag { +class MetadataTag +{ public: MetadataTag(const nsACString& aKey, const nsACString& aValue) : mKey(aKey) , mValue(aValue) - {} + { + } nsCString mKey; nsCString mValue; }; @@ -37,9 +39,11 @@ public: // Maximum channel number we can currently handle (7.1) #define MAX_AUDIO_CHANNELS 8 -class TrackInfo { +class TrackInfo +{ public: - enum TrackType { + enum TrackType + { kUndefinedTrack, kAudioTrack, kVideoTrack, @@ -175,9 +179,11 @@ private: }; // Stores info relevant to presenting media frames. -class VideoInfo : public TrackInfo { +class VideoInfo : public TrackInfo +{ public: - enum Rotation { + enum Rotation + { kDegree_0 = 0, kDegree_90 = 90, kDegree_180 = 180, @@ -272,8 +278,9 @@ public: // container. nsIntRect ScaledImageRect(int64_t aWidth, int64_t aHeight) const { - if ((aWidth == mImage.width && aHeight == mImage.height) || - !mImage.width || !mImage.height) { + if ((aWidth == mImage.width && aHeight == mImage.height) + || !mImage.width + || !mImage.height) { return ImageRect(); } nsIntRect imageRect = ImageRect(); @@ -325,7 +332,8 @@ private: bool mAlphaPresent = false; }; -class AudioInfo : public TrackInfo { +class AudioInfo : public TrackInfo +{ public: AudioInfo() : TrackInfo(kAudioTrack, NS_LITERAL_STRING("1"), NS_LITERAL_STRING("main"), @@ -392,17 +400,18 @@ public: RefPtr mCodecSpecificConfig; RefPtr mExtraData; - }; -class EncryptionInfo { +class EncryptionInfo +{ public: EncryptionInfo() : mEncrypted(false) { } - struct InitData { + struct InitData + { template InitData(const nsAString& aType, AInitDatas&& aInitData) : mType(aType) @@ -449,7 +458,8 @@ private: bool mEncrypted; }; -class MediaInfo { +class MediaInfo +{ public: bool HasVideo() const { @@ -484,8 +494,8 @@ public: bool IsEncrypted() const { - return (HasAudio() && mAudio.mCrypto.mValid) || - (HasVideo() && mVideo.mCrypto.mValid); + return (HasAudio() && mAudio.mCrypto.mValid) + || (HasVideo() && mVideo.mCrypto.mValid); } bool HasValidMedia() const @@ -499,8 +509,9 @@ public: "Audio track ID must be valid"); NS_ASSERTION(!HasVideo() || mVideo.mTrackId != TRACK_INVALID, "Audio track ID must be valid"); - NS_ASSERTION(!HasAudio() || !HasVideo() || - mAudio.mTrackId != mVideo.mTrackId, + NS_ASSERTION(!HasAudio() + || !HasVideo() + || mAudio.mTrackId != mVideo.mTrackId, "Duplicate track IDs"); } @@ -529,7 +540,8 @@ public: media::TimeUnit mStartTime; }; -class SharedTrackInfo { +class SharedTrackInfo +{ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedTrackInfo) public: SharedTrackInfo(const TrackInfo& aOriginal, uint32_t aStreamID) @@ -571,7 +583,7 @@ public: } private: - ~SharedTrackInfo() {}; + ~SharedTrackInfo() { } UniquePtr mInfo; // A unique ID, guaranteed to change when changing streams. uint32_t mStreamSourceID; @@ -580,9 +592,11 @@ public: const nsCString& mMimeType; }; -class AudioConfig { +class AudioConfig +{ public: - enum Channel { + enum Channel + { CHANNEL_INVALID = -1, CHANNEL_MONO = 0, CHANNEL_LEFT, @@ -596,15 +610,14 @@ public: CHANNEL_LFE, }; - class ChannelLayout { + class ChannelLayout + { public: - ChannelLayout() - : mChannelMap(0) - , mValid(false) - {} + ChannelLayout() : mChannelMap(0), mValid(false) { } explicit ChannelLayout(uint32_t aChannels) : ChannelLayout(aChannels, SMPTEDefault(aChannels)) - {} + { + } ChannelLayout(uint32_t aChannels, const Channel* aConfig) : ChannelLayout() { @@ -645,9 +658,7 @@ public: // the current layout can be easily reordered to aOther. // aMap must be an array of size MAX_AUDIO_CHANNELS. bool MappingTable(const ChannelLayout& aOther, uint8_t* aMap = nullptr) const; - bool IsValid() const { - return mValid; - } + bool IsValid() const { return mValid; } bool HasChannel(Channel aChannel) const { return mChannelMap & (1 << aChannel); @@ -660,7 +671,8 @@ public: bool mValid; }; - enum SampleFormat { + enum SampleFormat + { FORMAT_NONE = 0, FORMAT_U8, FORMAT_S16, @@ -710,9 +722,10 @@ public: } bool operator==(const AudioConfig& aOther) const { - return mChannelLayout == aOther.mChannelLayout && - mRate == aOther.mRate && mFormat == aOther.mFormat && - mInterleaved == aOther.mInterleaved; + return mChannelLayout == aOther.mChannelLayout + && mRate == aOther.mRate + && mFormat == aOther.mFormat + && mInterleaved == aOther.mInterleaved; } bool operator!=(const AudioConfig& aOther) const { diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index 27b7a8ed6057..9b1fbb92e52a 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -705,8 +705,8 @@ private: { MOZ_ASSERT(mRecorder->mAudioNode != nullptr); nsIDocument* doc = mRecorder->mAudioNode->GetOwner() - ? mRecorder->mAudioNode->GetOwner()->GetExtantDoc() - : nullptr; + ? mRecorder->mAudioNode->GetOwner()->GetExtantDoc() + : nullptr; nsCOMPtr principal = doc ? doc->NodePrincipal() : nullptr; return PrincipalSubsumes(principal); } diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 36323f501374..459bc71059fa 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -207,8 +207,10 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream, // The logic is different from the manipulating of aStream->mTracks part. // So it is not combined with the manipulating of aStream->mTracks part. - StreamTime offset = (data->mCommands & SourceMediaStream::TRACK_CREATE) - ? data->mStart : aStream->mTracks.FindTrack(data->mID)->GetSegment()->GetDuration(); + StreamTime offset = + (data->mCommands & SourceMediaStream::TRACK_CREATE) + ? data->mStart + : aStream->mTracks.FindTrack(data->mID)->GetSegment()->GetDuration(); // Audio case. if (data->mData->GetType() == MediaSegment::AUDIO) { @@ -395,13 +397,14 @@ MediaStreamGraphImpl::ProcessChunkMetadataForInterval(MediaStream* aStream, PrincipalHandle principalHandle = chunk->GetPrincipalHandle(); if (principalHandle != aSegment.GetLastPrincipalHandle()) { aSegment.SetLastPrincipalHandle(principalHandle); - STREAM_LOG(LogLevel::Debug, ("MediaStream %p track %d, principalHandle " - "changed in %sChunk with duration %lld", - aStream, aTrackID, - aSegment.GetType() == MediaSegment::AUDIO - ? "Audio" : "Video", - (long long) chunk->GetDuration())); - for (const TrackBound& listener : aStream->mTrackListeners) { + STREAM_LOG(LogLevel::Debug, + ("MediaStream %p track %d, principalHandle " + "changed in %sChunk with duration %lld", + aStream, aTrackID, + aSegment.GetType() == MediaSegment::AUDIO ? "Audio" : "Video", + (long long)chunk->GetDuration())); + for (const TrackBound& listener : + aStream->mTrackListeners) { if (listener.mTrackID == aTrackID) { listener.mListener->NotifyPrincipalHandleChanged(this, principalHandle); } diff --git a/dom/media/MediaStreamListener.cpp b/dom/media/MediaStreamListener.cpp index d9fbb6e29d1c..bae634301161 100644 --- a/dom/media/MediaStreamListener.cpp +++ b/dom/media/MediaStreamListener.cpp @@ -55,8 +55,8 @@ DirectMediaStreamTrackListener::NotifyRealtimeTrackDataAndApplyTrackDisabling(Me } DisabledTrackMode mode = mDisabledBlackCount > 0 - ? DisabledTrackMode::SILENCE_BLACK - : DisabledTrackMode::SILENCE_FREEZE; + ? DisabledTrackMode::SILENCE_BLACK + : DisabledTrackMode::SILENCE_FREEZE; if (!mMedia) { mMedia = aMedia.CreateEmptyClone(); } diff --git a/dom/media/flac/FlacDemuxer.cpp b/dom/media/flac/FlacDemuxer.cpp index 6fa46efb2544..df5f04e3aef3 100644 --- a/dom/media/flac/FlacDemuxer.cpp +++ b/dom/media/flac/FlacDemuxer.cpp @@ -124,9 +124,8 @@ public: // 1- coded sample number if blocksize is variable or // 2- coded frame number if blocksize is known. // A frame is made of Blocksize sample. - mIndex = mVariableBlockSize - ? frame_or_sample_num - : frame_or_sample_num * mBlocksize; + mIndex = mVariableBlockSize ? frame_or_sample_num + : frame_or_sample_num * mBlocksize; // Sample rate. if (sr_code < 12) { diff --git a/dom/media/mediasink/DecodedAudioDataSink.cpp b/dom/media/mediasink/DecodedAudioDataSink.cpp index e7fcffe4f30c..a8dbdda6e1be 100644 --- a/dom/media/mediasink/DecodedAudioDataSink.cpp +++ b/dom/media/mediasink/DecodedAudioDataSink.cpp @@ -71,8 +71,10 @@ DecodedAudioDataSink::DecodedAudioDataSink(AbstractThread* aThread, bool monoAudioEnabled = MediaPrefs::MonoAudio(); - mOutputChannels = monoAudioEnabled - ? 1 : (MediaPrefs::AudioSinkForceStereo() ? 2 : mInfo.mChannels); + mOutputChannels = + monoAudioEnabled + ? 1 + : (MediaPrefs::AudioSinkForceStereo() ? 2 : mInfo.mChannels); } DecodedAudioDataSink::~DecodedAudioDataSink() diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index d26e5654b977..cdf0260f1980 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -310,7 +310,8 @@ public: return NS_ERROR_NOT_AVAILABLE; } - uint64_t frameDuration = (completeIdx + 1u < mapping.Length()) + uint64_t frameDuration = + (completeIdx + 1u < mapping.Length()) ? mapping[completeIdx + 1].mTimecode - mapping[completeIdx].mTimecode : mapping[completeIdx].mTimecode - previousMapping.ref().mTimecode; aStart = mapping[0].mTimecode / NS_PER_USEC; diff --git a/dom/media/mediasource/MediaSourceDecoder.cpp b/dom/media/mediasource/MediaSourceDecoder.cpp index af55218b3f69..50a301313688 100644 --- a/dom/media/mediasource/MediaSourceDecoder.cpp +++ b/dom/media/mediasource/MediaSourceDecoder.cpp @@ -284,8 +284,8 @@ MediaSourceDecoder::NextFrameBufferedStatus() currentPosition + media::TimeUnit::FromMicroseconds(DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED)); return buffered.ContainsStrict(ClampIntervalToEnd(interval)) - ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE - : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE; + ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE + : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE; } bool diff --git a/dom/media/mediasource/MediaSourceDemuxer.cpp b/dom/media/mediasource/MediaSourceDemuxer.cpp index 2b2c3f34cba5..db3d1a49b861 100644 --- a/dom/media/mediasource/MediaSourceDemuxer.cpp +++ b/dom/media/mediasource/MediaSourceDemuxer.cpp @@ -291,10 +291,9 @@ MediaSourceTrackDemuxer::MediaSourceTrackDemuxer(MediaSourceDemuxer* aParent, , mType(aType) , mMonitor("MediaSourceTrackDemuxer") , mReset(true) - , mPreRoll( - TimeUnit::FromMicroseconds( - OpusDataDecoder::IsOpus(mParent->GetTrackInfo(mType)->mMimeType) - ? 80000 : 0)) + , mPreRoll(TimeUnit::FromMicroseconds( + OpusDataDecoder::IsOpus(mParent->GetTrackInfo(mType)->mMimeType) ? 80000 + : 0)) { } diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index d69bc443c288..605d401eb9c8 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -1319,13 +1319,14 @@ TrackBuffersManager::CompleteCodedFrameProcessing() // 6. Remove the media segment bytes from the beginning of the input buffer. // Clear our demuxer from any already processed data. - int64_t safeToEvict = std::min( - HasVideo() - ? mVideoTracks.mDemuxer->GetEvictionOffset(mVideoTracks.mLastParsedEndTime) - : INT64_MAX, - HasAudio() - ? mAudioTracks.mDemuxer->GetEvictionOffset(mAudioTracks.mLastParsedEndTime) - : INT64_MAX); + int64_t safeToEvict = std::min(HasVideo() + ? mVideoTracks.mDemuxer->GetEvictionOffset( + mVideoTracks.mLastParsedEndTime) + : INT64_MAX, + HasAudio() + ? mAudioTracks.mDemuxer->GetEvictionOffset( + mAudioTracks.mLastParsedEndTime) + : INT64_MAX); ErrorResult rv; mCurrentInputBuffer->EvictBefore(safeToEvict, rv); if (rv.Failed()) { @@ -1398,8 +1399,10 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData) // Let presentation timestamp equal 0. // Otherwise // Let presentation timestamp be a double precision floating point representation of the coded frame's presentation timestamp in seconds. - TimeUnit presentationTimestamp = mSourceBufferAttributes->mGenerateTimestamps - ? TimeUnit() : TimeUnit::FromMicroseconds(aSamples[0]->mTime); + TimeUnit presentationTimestamp = + mSourceBufferAttributes->mGenerateTimestamps + ? TimeUnit() + : TimeUnit::FromMicroseconds(aSamples[0]->mTime); // 3. If mode equals "sequence" and group start timestamp is set, then run the following steps: CheckSequenceDiscontinuity(presentationTimestamp); @@ -1412,12 +1415,13 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData) // of +- mLongestFrameDuration on the append window start. // We only apply the leeway with the default append window start of 0 // otherwise do as per spec. - TimeInterval targetWindow = mAppendWindow.mStart != TimeUnit::FromSeconds(0) + TimeInterval targetWindow = + mAppendWindow.mStart != TimeUnit::FromSeconds(0) ? mAppendWindow : TimeInterval(mAppendWindow.mStart, mAppendWindow.mEnd, trackBuffer.mLastFrameDuration.isSome() - ? trackBuffer.mLongestFrameDuration - : TimeUnit::FromMicroseconds(aSamples[0]->mDuration)); + ? trackBuffer.mLongestFrameDuration + : TimeUnit::FromMicroseconds(aSamples[0]->mDuration)); TimeIntervals samplesRange; uint32_t sizeNewSamples = 0; @@ -1484,13 +1488,12 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData) TimeInterval sampleInterval = mSourceBufferAttributes->mGenerateTimestamps - ? TimeInterval(timestampOffset, timestampOffset + sampleDuration) - : TimeInterval(timestampOffset + sampleTime, - timestampOffset + sampleTime + sampleDuration); - TimeUnit decodeTimestamp = - mSourceBufferAttributes->mGenerateTimestamps - ? timestampOffset - : timestampOffset + sampleTimecode; + ? TimeInterval(timestampOffset, timestampOffset + sampleDuration) + : TimeInterval(timestampOffset + sampleTime, + timestampOffset + sampleTime + sampleDuration); + TimeUnit decodeTimestamp = mSourceBufferAttributes->mGenerateTimestamps + ? timestampOffset + : timestampOffset + sampleTimecode; // 6. If last decode timestamp for track buffer is set and decode timestamp is less than last decode timestamp: // OR @@ -1525,8 +1528,8 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData) // Rather that restarting the process for the frame, we run the first // steps again instead. // 3. If mode equals "sequence" and group start timestamp is set, then run the following steps: - TimeUnit presentationTimestamp = mSourceBufferAttributes->mGenerateTimestamps - ? TimeUnit() : sampleTime; + TimeUnit presentationTimestamp = + mSourceBufferAttributes->mGenerateTimestamps ? TimeUnit() : sampleTime; CheckSequenceDiscontinuity(presentationTimestamp); if (!sample->mKeyframe) { @@ -1538,13 +1541,12 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData) timestampOffset = mSourceBufferAttributes->GetTimestampOffset(); sampleInterval = mSourceBufferAttributes->mGenerateTimestamps - ? TimeInterval(timestampOffset, timestampOffset + sampleDuration) - : TimeInterval(timestampOffset + sampleTime, - timestampOffset + sampleTime + sampleDuration); - decodeTimestamp = - mSourceBufferAttributes->mGenerateTimestamps - ? timestampOffset - : timestampOffset + sampleTimecode; + ? TimeInterval(timestampOffset, timestampOffset + sampleDuration) + : TimeInterval(timestampOffset + sampleTime, + timestampOffset + sampleTime + sampleDuration); + decodeTimestamp = mSourceBufferAttributes->mGenerateTimestamps + ? timestampOffset + : timestampOffset + sampleTimecode; } trackBuffer.mNeedRandomAccessPoint = false; needDiscontinuityCheck = false; diff --git a/dom/media/ogg/OggCodecState.cpp b/dom/media/ogg/OggCodecState.cpp index 63a056c62f38..fa5a1f3fcc9e 100644 --- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -363,8 +363,8 @@ TheoraState::Init() int64_t n = mTheoraInfo.aspect_numerator; int64_t d = mTheoraInfo.aspect_denominator; - float aspectRatio = (n == 0 || d == 0) - ? 1.0f : static_cast(n) / static_cast(d); + float aspectRatio = + (n == 0 || d == 0) ? 1.0f : static_cast(n) / static_cast(d); // Ensure the frame and picture regions aren't larger than our prescribed // maximum, or zero sized. diff --git a/dom/media/webaudio/AudioBuffer.cpp b/dom/media/webaudio/AudioBuffer.cpp index 46bfd231c75e..866b196f6598 100644 --- a/dom/media/webaudio/AudioBuffer.cpp +++ b/dom/media/webaudio/AudioBuffer.cpp @@ -395,10 +395,10 @@ AudioBuffer::StealJSArrayDataIntoSharedChannels(JSContext* aJSContext) // The channel data arrays should all have originated in // RestoreJSChannelData, where they are created unshared. MOZ_ASSERT(!isSharedMemory); - auto stolenData = arrayBuffer - ? static_cast(JS_StealArrayBufferContents(aJSContext, - arrayBuffer)) - : nullptr; + auto stolenData = + arrayBuffer ? static_cast( + JS_StealArrayBufferContents(aJSContext, arrayBuffer)) + : nullptr; if (stolenData) { result->SetData(i, stolenData, js_free, stolenData); } else { From 97ce8f8ad2de32e1ba7612014a45e7e876908580 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sun, 29 Jan 2017 21:56:29 +0100 Subject: [PATCH 21/70] Bug 1319987: P10. Update WPT expected results. r=gerald MozReview-Commit-ID: BWEk7Ri0iyc --HG-- extra : rebase_source : c0d6af0a1b283e0ff1ca56896b48e65fa2040633 --- ...-playback-temporary-encrypted-clear.html.ini | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/testing/web-platform/meta/encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear.html.ini b/testing/web-platform/meta/encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear.html.ini index d469e18c6173..579fbd70cdb2 100644 --- a/testing/web-platform/meta/encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear.html.ini +++ b/testing/web-platform/meta/encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear.html.ini @@ -2,21 +2,6 @@ type: testharness disabled: if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1301418 - expected: - if not debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if not debug and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if debug and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT [org.w3.clearkey, temporary, mp4, playback, single key, encrypted then clear content] expected: - if not debug and e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL - if debug and not e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL - if debug and e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL - if not debug and not e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL - if not debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if not debug and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if debug and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if not debug and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if not debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - + if (os == "win") and (version == "5.1.2600"): FAIL From 7ea5b8ca6d55a6a9cda29781df4932dcb8a9f091 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Tue, 31 Jan 2017 20:43:07 +0100 Subject: [PATCH 22/70] Bug 1319987: P11. Fix MediaDataDecoder gtest. r=gerald They appear to have been broken for a while. Several months at least. MozReview-Commit-ID: I71xE91UMOZ --HG-- extra : rebase_source : 80d179d207c2ae2f808aec573ab47f54f6df4a1d --- dom/media/Benchmark.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dom/media/Benchmark.cpp b/dom/media/Benchmark.cpp index 070d48fdb1df..139e75593c6e 100644 --- a/dom/media/Benchmark.cpp +++ b/dom/media/Benchmark.cpp @@ -10,10 +10,12 @@ #include "MediaPrefs.h" #include "PDMFactory.h" #include "WebMDemuxer.h" +#include "gfxPrefs.h" #include "mozilla/AbstractThread.h" #include "mozilla/Preferences.h" #include "mozilla/Telemetry.h" #include "mozilla/dom/ContentChild.h" +#include "mozilla/gfx/gfxVars.h" #ifndef MOZ_WIDGET_ANDROID #include "WebMSample.h" @@ -136,7 +138,8 @@ void Benchmark::Init() { MOZ_ASSERT(NS_IsMainThread()); - + gfxVars::Initialize(); + gfxPrefs::GetSingleton(); MediaPrefs::GetSingleton(); } From 3bd375697152ce884a056866e87ce2d2b8df281b Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 3 Feb 2017 09:40:28 +0100 Subject: [PATCH 23/70] Bug 1319987: P12. Disable RemoteDataDecoder. ?jhlin r=jya There appears to be a race occurring where InputExhausted callback isn't always called. The issue could be reproduced prior all those changes, albeit rarely. The tracking of re-enabling this feature will be done in bug 1336358 MozReview-Commit-ID: 5rPpcCcgNIq --HG-- extra : rebase_source : bf3513e5ff8d8c72ed7aa505c8fda723a480c243 --- mobile/android/app/mobile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 99fc6f975a5a..2f9d13d9ed0e 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -620,7 +620,7 @@ pref("media.decoder.recycle.enabled", true); pref("media.android-media-codec.enabled", true); pref("media.android-media-codec.preferred", true); // Run decoder in seperate process. -pref("media.android-remote-codec.enabled", true); +pref("media.android-remote-codec.enabled", false); // Enable MSE pref("media.mediasource.enabled", true); From 798612dc766b9d317e6413ce284816f09d94dce0 Mon Sep 17 00:00:00 2001 From: Alastor Wu Date: Mon, 6 Feb 2017 10:21:19 +0800 Subject: [PATCH 24/70] Bug 1336309 - modify the access key for 'play tab' option. r=jaws Because the key "P" was already used by "pin tab", we need to change the access key. MozReview-Commit-ID: Igzs6cv1bLj --HG-- extra : rebase_source : 35d7af508a047baadc01c2f6f75652e089df0a12 --- browser/locales/en-US/chrome/browser/browser.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 1abb642f44e9..d75fce9e1cba 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -815,7 +815,7 @@ muteTab.accesskey = M unmuteTab.label = Unmute Tab unmuteTab.accesskey = M playTab.label = Play Tab -playTab.accesskey = P +playTab.accesskey = l # LOCALIZATION NOTE (weakCryptoOverriding.message): %S is brandShortName weakCryptoOverriding.message = %S recommends that you don’t enter your password, credit card and other personal information on this website. From b2d71437490402e8f1a978cac5b91c02a8c44741 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Fri, 3 Feb 2017 15:12:22 +0800 Subject: [PATCH 25/70] Bug 1336345. Part 1 - register shutdown blocker on startup. r=gerald MozReview-Commit-ID: 80DEZEEhm9E --HG-- extra : rebase_source : 4c582b3ab3356efc166e22aaad5bd79826afaaeb extra : source : 1785526b2065f6dd314218e19e75b770bab8a08e --- dom/media/MediaShutdownManager.cpp | 52 ++++++++++++++++++++++++++---- dom/media/MediaShutdownManager.h | 3 ++ layout/build/nsLayoutStatics.cpp | 3 ++ 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/dom/media/MediaShutdownManager.cpp b/dom/media/MediaShutdownManager.cpp index 2a95d8da29cb..d6d0d9529103 100644 --- a/dom/media/MediaShutdownManager.cpp +++ b/dom/media/MediaShutdownManager.cpp @@ -38,9 +38,7 @@ MediaShutdownManager& MediaShutdownManager::Instance() { MOZ_ASSERT(NS_IsMainThread()); - if (!sInstance) { - sInstance = new MediaShutdownManager(); - } + MOZ_DIAGNOSTIC_ASSERT(sInstance); return *sInstance; } @@ -62,6 +60,29 @@ GetShutdownBarrier() return barrier.forget(); } +void +MediaShutdownManager::InitStatics() +{ + sInstance = new MediaShutdownManager(); + + // Dispatch a task to avoid "ASSERTION: Recursive GetService!". + NS_DispatchToCurrentThread(NS_NewRunnableFunction([] () { + nsresult rv = GetShutdownBarrier()->AddBlocker( + sInstance, NS_LITERAL_STRING(__FILE__), __LINE__, + NS_LITERAL_STRING("MediaShutdownManager shutdown")); + if (NS_FAILED(rv)) { + // Leak the buffer on the heap to make sure that it lives long enough, + // as MOZ_CRASH_ANNOTATE expects the pointer passed to it to live to + // the end of the program. + const size_t CAPACITY = 256; + auto buf = new char[CAPACITY]; + snprintf(buf, CAPACITY, "Failed to add shutdown blocker! rv=%x", uint32_t(rv)); + MOZ_CRASH_ANNOTATE(buf); + MOZ_REALLY_CRASH(); + } + })); +} + void MediaShutdownManager::EnsureCorrectShutdownObserverState() { @@ -92,6 +113,19 @@ MediaShutdownManager::EnsureCorrectShutdownObserverState() } } +void +MediaShutdownManager::RemoveBlocker() +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(mIsDoingXPCOMShutDown); + MOZ_ASSERT(mDecoders.Count() == 0); + GetShutdownBarrier()->RemoveBlocker(this); + // Clear our singleton reference. This will probably delete + // this instance, so don't deref |this| clearing sInstance. + sInstance = nullptr; + DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::BlockShutdown() end.")); +} + void MediaShutdownManager::Register(MediaDecoder* aDecoder) { @@ -103,7 +137,6 @@ MediaShutdownManager::Register(MediaDecoder* aDecoder) mDecoders.PutEntry(aDecoder); MOZ_ASSERT(mDecoders.Contains(aDecoder)); MOZ_ASSERT(mDecoders.Count() > 0); - EnsureCorrectShutdownObserverState(); } void @@ -112,7 +145,9 @@ MediaShutdownManager::Unregister(MediaDecoder* aDecoder) MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mDecoders.Contains(aDecoder)); mDecoders.RemoveEntry(aDecoder); - EnsureCorrectShutdownObserverState(); + if (mIsDoingXPCOMShutDown && mDecoders.Count() == 0) { + RemoveBlocker(); + } } NS_IMETHODIMP @@ -139,8 +174,11 @@ MediaShutdownManager::BlockShutdown(nsIAsyncShutdownClient*) // Set this flag to ensure no Register() is allowed when Shutdown() begins. mIsDoingXPCOMShutDown = true; - DebugOnly oldCount = mDecoders.Count(); - MOZ_ASSERT(oldCount > 0); + auto oldCount = mDecoders.Count(); + if (oldCount == 0) { + RemoveBlocker(); + return NS_OK; + } // Iterate over the decoders and shut them down. for (auto iter = mDecoders.Iter(); !iter.Done(); iter.Next()) { diff --git a/dom/media/MediaShutdownManager.h b/dom/media/MediaShutdownManager.h index fa1628b61aa0..867c711f0f32 100644 --- a/dom/media/MediaShutdownManager.h +++ b/dom/media/MediaShutdownManager.h @@ -54,6 +54,8 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIASYNCSHUTDOWNBLOCKER + static void InitStatics(); + // The MediaShutdownManager is a singleton, access its instance with // this accessor. static MediaShutdownManager& Instance(); @@ -71,6 +73,7 @@ private: MediaShutdownManager(); virtual ~MediaShutdownManager(); + void RemoveBlocker(); // Ensures we have a shutdown listener if we need one, and removes the // listener and destroys the singleton if we don't. diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index fe8bdc0bd4e2..6df19031d972 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -128,6 +128,7 @@ using namespace mozilla::system; #include "TouchManager.h" #include "MediaDecoder.h" #include "MediaPrefs.h" +#include "MediaShutdownManager.h" #include "mozilla/dom/devicestorage/DeviceStorageStatics.h" #include "mozilla/ServoBindings.h" #include "mozilla/StaticPresData.h" @@ -304,6 +305,8 @@ nsLayoutStatics::Initialize() mozilla::LayerAnimationInfo::Initialize(); #endif + MediaShutdownManager::InitStatics(); + MediaDecoder::InitStatics(); PromiseDebugging::Init(); From 41824361028defd6e47a45b8ecd7eb05c7b5fb04 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Fri, 3 Feb 2017 15:16:50 +0800 Subject: [PATCH 26/70] Bug 1336345. Part 2 - some code cleanup. r=gerald MozReview-Commit-ID: 1XHkvz4aWxB --HG-- extra : rebase_source : 5303151acf39cbd05ee07d643c834b38d99c2562 extra : source : 4367d744807385cbba96fa0d7e9250e0d6329ba6 --- dom/media/MediaShutdownManager.cpp | 32 ------------------------------ dom/media/MediaShutdownManager.h | 9 +-------- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/dom/media/MediaShutdownManager.cpp b/dom/media/MediaShutdownManager.cpp index d6d0d9529103..5b01d14d2ccc 100644 --- a/dom/media/MediaShutdownManager.cpp +++ b/dom/media/MediaShutdownManager.cpp @@ -19,8 +19,6 @@ extern LazyLogModule gMediaDecoderLog; NS_IMPL_ISUPPORTS(MediaShutdownManager, nsIAsyncShutdownBlocker) MediaShutdownManager::MediaShutdownManager() - : mIsObservingShutdown(false) - , mIsDoingXPCOMShutDown(false) { MOZ_ASSERT(NS_IsMainThread()); } @@ -83,36 +81,6 @@ MediaShutdownManager::InitStatics() })); } -void -MediaShutdownManager::EnsureCorrectShutdownObserverState() -{ - bool needShutdownObserver = mDecoders.Count() > 0; - if (needShutdownObserver != mIsObservingShutdown) { - mIsObservingShutdown = needShutdownObserver; - if (mIsObservingShutdown) { - nsresult rv = GetShutdownBarrier()->AddBlocker( - this, NS_LITERAL_STRING(__FILE__), __LINE__, - NS_LITERAL_STRING("MediaShutdownManager shutdown")); - if (NS_FAILED(rv)) { - // Leak the buffer on the heap to make sure that it lives long enough, - // as MOZ_CRASH_ANNOTATE expects the pointer passed to it to live to - // the end of the program. - const size_t CAPACITY = 256; - auto buf = new char[CAPACITY]; - snprintf(buf, CAPACITY, "Failed to add shutdown blocker! rv=%x", uint32_t(rv)); - MOZ_CRASH_ANNOTATE(buf); - MOZ_REALLY_CRASH(); - } - } else { - GetShutdownBarrier()->RemoveBlocker(this); - // Clear our singleton reference. This will probably delete - // this instance, so don't deref |this| clearing sInstance. - sInstance = nullptr; - DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::BlockShutdown() end.")); - } - } -} - void MediaShutdownManager::RemoveBlocker() { diff --git a/dom/media/MediaShutdownManager.h b/dom/media/MediaShutdownManager.h index 867c711f0f32..d6c570eec2e4 100644 --- a/dom/media/MediaShutdownManager.h +++ b/dom/media/MediaShutdownManager.h @@ -75,10 +75,6 @@ private: virtual ~MediaShutdownManager(); void RemoveBlocker(); - // Ensures we have a shutdown listener if we need one, and removes the - // listener and destroys the singleton if we don't. - void EnsureCorrectShutdownObserverState(); - static StaticRefPtr sInstance; // References to the MediaDecoder. The decoders unregister themselves @@ -86,10 +82,7 @@ private: // we're shutting down (in the non xpcom-shutdown case). nsTHashtable> mDecoders; - // True if we have an XPCOM shutdown observer. - bool mIsObservingShutdown; - - bool mIsDoingXPCOMShutDown; + bool mIsDoingXPCOMShutDown = false; }; } // namespace mozilla From da8e4c10f2ee057140f3a808cb5d3159f7cbe8b8 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 2 Feb 2017 23:26:45 +0900 Subject: [PATCH 27/70] Bug 1336080 When NativeKey::GetFollowingCharMessage() founds different message when it fails to remove a found char message, it should retry to remove the newly found message if it's caused by same physical key r=m_kato When NativeKey::GetFollowingCharMessage() tries to remove a char message from the queue, the message might be changed by odd keyboard layout or something. In such case, if the new char message is also caused by same physical key, the char message must be overwritten. Then, we should take the new char message instead. Note that this patch saves original found char message into kFoundCharMsg and it's logged by each points for indicating if this case has occurred. MozReview-Commit-ID: HAduq8sfwFt --HG-- extra : rebase_source : c8980c7fa019fc3e0f249b4506fa572e81f4a1e8 --- widget/windows/KeyboardLayout.cpp | 89 ++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 32 deletions(-) diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 766dfe326230..6db1b72b5783 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2842,6 +2842,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) this)); return false; } + const MSG kFoundCharMsg = nextKeyMsg; AutoRestore saveLastRemovingMsg(mRemovingMsg); mRemovingMsg = nextKeyMsg; @@ -2872,8 +2873,10 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, ("%p NativeKey::GetFollowingCharMessage(), WARNING, received a " "char message during removing it from the queue, but it's for " - "different window, mReceivedMsg=%s, nextKeyMsg=%s", - this, ToString(mReceivedMsg).get(), ToString(nextKeyMsg).get())); + "different window, mReceivedMsg=%s, nextKeyMsg=%s, " + "kFoundCharMsg=%s", + this, ToString(mReceivedMsg).get(), ToString(nextKeyMsg).get(), + ToString(kFoundCharMsg).get())); // There might still exist char messages, the loop of calling // this method should be continued. aCharMsg.message = WM_NULL; @@ -2889,13 +2892,16 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) ("%p NativeKey::GetFollowingCharMessage(), WARNING, received a " "char message during removing it from the queue, but it's " "differnt from what trying to remove from the queue, " - "aCharMsg=%s, nextKeyMsg=%s", - this, ToString(mReceivedMsg).get(), ToString(nextKeyMsg).get())); + "aCharMsg=%s, nextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(mReceivedMsg).get(), ToString(nextKeyMsg).get(), + ToString(kFoundCharMsg).get())); } else { MOZ_LOG(sNativeKeyLogger, LogLevel::Verbose, ("%p NativeKey::GetFollowingCharMessage(), succeeded to retrieve " - "next char message via another instance, aCharMsg=%s", - this, ToString(mReceivedMsg).get())); + "next char message via another instance, aCharMsg=%s, " + "kFoundCharMsg=%s", + this, ToString(mReceivedMsg).get(), + ToString(kFoundCharMsg).get())); } aCharMsg = mReceivedMsg; return true; @@ -2909,22 +2915,38 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " "remove a char message, but it's already gone from all message " - "queues, nextKeyMsg=%s", - this, ToString(nextKeyMsg).get())); + "queues, nextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); return true; } + // The next key message is redirected to different window created by our + // thread, we should do nothing because we must not have focus. + if (nextKeyMsgInAllWindows.hwnd != mMsg.hwnd) { + aCharMsg = nextKeyMsgInAllWindows; + MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, + ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " + "remove a char message, but found in another message queue, " + "nextKeyMsgInAllWindows=%s, nextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(nextKeyMsgInAllWindows).get(), + ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); + return true; + } + // If next key message is still a char message but the message is changed, + // we should retry to remove the new message with PeekMessage() again. + if (IsCharMessage(nextKeyMsgInAllWindows) && + nextKeyMsgInAllWindows.message != nextKeyMsg.message && + IsSamePhysicalKeyMessage(nextKeyMsgInAllWindows, kFoundCharMsg)) { + MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, + ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " + "remove a char message due to message change, let's retry to " + "remove the message with newly found char message, ", + "nextKeyMsgInAllWindows=%s, nextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(nextKeyMsgInAllWindows).get(), + ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); + nextKeyMsg = nextKeyMsgInAllWindows; + continue; + } if (MayBeSameCharMessage(nextKeyMsgInAllWindows, nextKeyMsg)) { - // The char message is redirected to different window created by our - // thread. - if (nextKeyMsgInAllWindows.hwnd != mMsg.hwnd) { - aCharMsg = nextKeyMsgInAllWindows; - MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, - ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " - "remove a char message, but found in another message queue, " - "nextKeyMsgInAllWindows=%s", - this, ToString(nextKeyMsgInAllWindows).get())); - return true; - } // The found char message still in the queue, but PeekMessage() failed // to remove it only with PM_REMOVE. Although, we don't know why this // occurs. However, this occurs acctually. @@ -2934,8 +2956,8 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " "remove a char message, but succeeded with GetMessage(), " - "removedMsg=%s", - this, ToString(removedMsg).get())); + "removedMsg=%s, kFoundCharMsg=%s", + this, ToString(removedMsg).get(), ToString(kFoundCharMsg).get())); // Cancel to crash, but we need to check the removed message value. doCrash = false; } @@ -2975,7 +2997,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) KeyboardLayout::GetActiveLayoutName().get(), ToString(mMsg).get(), GetResultOfInSendMessageEx().get(), - ToString(nextKeyMsg).get(), i, + ToString(kFoundCharMsg).get(), i, ToString(nextKeyMsgInAllWindows).get(), nextKeyMsgInAllWindows.time); CrashReporter::AppendAppNotesToCrashReport(info); @@ -3014,8 +3036,8 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " "remove a char message because it's gone during removing it from " - "the queue, nextKeyMsg=%s", - this, ToString(nextKeyMsg).get())); + "the queue, nextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); MOZ_ASSERT(!mCharMessageHasGone); mFollowingCharMsgs.Clear(); mCharMessageHasGone = true; @@ -3028,8 +3050,9 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " "remove a char message because it's gone during removing it from " - "the queue, nextKeyMsg=%s, newNextKeyMsg=%s", - this, ToString(nextKeyMsg).get(), ToString(newNextKeyMsg).get())); + "the queue, nextKeyMsg=%s, newNextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(nextKeyMsg).get(), ToString(newNextKeyMsg).get(), + ToString(kFoundCharMsg).get())); MOZ_ASSERT(!mCharMessageHasGone); mFollowingCharMsgs.Clear(); mCharMessageHasGone = true; @@ -3075,8 +3098,9 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) ("%p NativeKey::GetFollowingCharMessage(), WARNING, succeeded to " "remove a char message, but the removed message was changed from " "the found message except their scancode, aCharMsg=%s, " - "nextKeyMsg(the found message)=%s", - this, ToString(aCharMsg).get(), ToString(nextKeyMsg).get())); + "nextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(aCharMsg).get(), ToString(nextKeyMsg).get(), + ToString(kFoundCharMsg).get())); return true; } @@ -3086,8 +3110,9 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) MOZ_LOG(sNativeKeyLogger, LogLevel::Error, ("%p NativeKey::GetFollowingCharMessage(), FAILED, removed message " "is really different from what we have already found, removedMsg=%s, " - "nextKeyMsg=%s", - this, ToString(removedMsg).get(), ToString(nextKeyMsg).get())); + "nextKeyMsg=%s, kFoundCharMsg=%s", + this, ToString(removedMsg).get(), ToString(nextKeyMsg).get(), + ToString(kFoundCharMsg).get())); #ifdef MOZ_CRASHREPORTER nsPrintfCString info("\nPeekMessage() removed unexpcted char message! " "\nActive keyboard layout=0x%08X (%s), " @@ -3098,7 +3123,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) KeyboardLayout::GetActiveLayoutName().get(), ToString(mMsg).get(), GetResultOfInSendMessageEx().get(), - ToString(nextKeyMsg).get(), + ToString(kFoundCharMsg).get(), ToString(removedMsg).get()); CrashReporter::AppendAppNotesToCrashReport(info); // What's the next key message? @@ -3142,7 +3167,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) KeyboardLayout::GetActiveLayoutName().get(), ToString(mMsg).get(), GetResultOfInSendMessageEx().get(), - ToString(nextKeyMsg).get()); + ToString(kFoundCharMsg).get()); CrashReporter::AppendAppNotesToCrashReport(info); #endif // #ifdef MOZ_CRASHREPORTER MOZ_CRASH("We lost the following char message"); From 7d78556bf0ebe109fe1e1617f49619725818648f Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 5 Feb 2017 20:40:19 -0800 Subject: [PATCH 28/70] Backed out 2 changesets (bug 1336345) for gtest timeouts and crashes in test_data_protocol_registration.js CLOSED TREE Backed out changeset c4247e22a8ff (bug 1336345) Backed out changeset 05e8e7d0f430 (bug 1336345) --- dom/media/MediaShutdownManager.cpp | 74 ++++++++++++++---------------- dom/media/MediaShutdownManager.h | 12 +++-- layout/build/nsLayoutStatics.cpp | 3 -- 3 files changed, 42 insertions(+), 47 deletions(-) diff --git a/dom/media/MediaShutdownManager.cpp b/dom/media/MediaShutdownManager.cpp index 5b01d14d2ccc..2a95d8da29cb 100644 --- a/dom/media/MediaShutdownManager.cpp +++ b/dom/media/MediaShutdownManager.cpp @@ -19,6 +19,8 @@ extern LazyLogModule gMediaDecoderLog; NS_IMPL_ISUPPORTS(MediaShutdownManager, nsIAsyncShutdownBlocker) MediaShutdownManager::MediaShutdownManager() + : mIsObservingShutdown(false) + , mIsDoingXPCOMShutDown(false) { MOZ_ASSERT(NS_IsMainThread()); } @@ -36,7 +38,9 @@ MediaShutdownManager& MediaShutdownManager::Instance() { MOZ_ASSERT(NS_IsMainThread()); - MOZ_DIAGNOSTIC_ASSERT(sInstance); + if (!sInstance) { + sInstance = new MediaShutdownManager(); + } return *sInstance; } @@ -59,39 +63,33 @@ GetShutdownBarrier() } void -MediaShutdownManager::InitStatics() +MediaShutdownManager::EnsureCorrectShutdownObserverState() { - sInstance = new MediaShutdownManager(); - - // Dispatch a task to avoid "ASSERTION: Recursive GetService!". - NS_DispatchToCurrentThread(NS_NewRunnableFunction([] () { - nsresult rv = GetShutdownBarrier()->AddBlocker( - sInstance, NS_LITERAL_STRING(__FILE__), __LINE__, - NS_LITERAL_STRING("MediaShutdownManager shutdown")); - if (NS_FAILED(rv)) { - // Leak the buffer on the heap to make sure that it lives long enough, - // as MOZ_CRASH_ANNOTATE expects the pointer passed to it to live to - // the end of the program. - const size_t CAPACITY = 256; - auto buf = new char[CAPACITY]; - snprintf(buf, CAPACITY, "Failed to add shutdown blocker! rv=%x", uint32_t(rv)); - MOZ_CRASH_ANNOTATE(buf); - MOZ_REALLY_CRASH(); + bool needShutdownObserver = mDecoders.Count() > 0; + if (needShutdownObserver != mIsObservingShutdown) { + mIsObservingShutdown = needShutdownObserver; + if (mIsObservingShutdown) { + nsresult rv = GetShutdownBarrier()->AddBlocker( + this, NS_LITERAL_STRING(__FILE__), __LINE__, + NS_LITERAL_STRING("MediaShutdownManager shutdown")); + if (NS_FAILED(rv)) { + // Leak the buffer on the heap to make sure that it lives long enough, + // as MOZ_CRASH_ANNOTATE expects the pointer passed to it to live to + // the end of the program. + const size_t CAPACITY = 256; + auto buf = new char[CAPACITY]; + snprintf(buf, CAPACITY, "Failed to add shutdown blocker! rv=%x", uint32_t(rv)); + MOZ_CRASH_ANNOTATE(buf); + MOZ_REALLY_CRASH(); + } + } else { + GetShutdownBarrier()->RemoveBlocker(this); + // Clear our singleton reference. This will probably delete + // this instance, so don't deref |this| clearing sInstance. + sInstance = nullptr; + DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::BlockShutdown() end.")); } - })); -} - -void -MediaShutdownManager::RemoveBlocker() -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mIsDoingXPCOMShutDown); - MOZ_ASSERT(mDecoders.Count() == 0); - GetShutdownBarrier()->RemoveBlocker(this); - // Clear our singleton reference. This will probably delete - // this instance, so don't deref |this| clearing sInstance. - sInstance = nullptr; - DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::BlockShutdown() end.")); + } } void @@ -105,6 +103,7 @@ MediaShutdownManager::Register(MediaDecoder* aDecoder) mDecoders.PutEntry(aDecoder); MOZ_ASSERT(mDecoders.Contains(aDecoder)); MOZ_ASSERT(mDecoders.Count() > 0); + EnsureCorrectShutdownObserverState(); } void @@ -113,9 +112,7 @@ MediaShutdownManager::Unregister(MediaDecoder* aDecoder) MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mDecoders.Contains(aDecoder)); mDecoders.RemoveEntry(aDecoder); - if (mIsDoingXPCOMShutDown && mDecoders.Count() == 0) { - RemoveBlocker(); - } + EnsureCorrectShutdownObserverState(); } NS_IMETHODIMP @@ -142,11 +139,8 @@ MediaShutdownManager::BlockShutdown(nsIAsyncShutdownClient*) // Set this flag to ensure no Register() is allowed when Shutdown() begins. mIsDoingXPCOMShutDown = true; - auto oldCount = mDecoders.Count(); - if (oldCount == 0) { - RemoveBlocker(); - return NS_OK; - } + DebugOnly oldCount = mDecoders.Count(); + MOZ_ASSERT(oldCount > 0); // Iterate over the decoders and shut them down. for (auto iter = mDecoders.Iter(); !iter.Done(); iter.Next()) { diff --git a/dom/media/MediaShutdownManager.h b/dom/media/MediaShutdownManager.h index d6c570eec2e4..fa1628b61aa0 100644 --- a/dom/media/MediaShutdownManager.h +++ b/dom/media/MediaShutdownManager.h @@ -54,8 +54,6 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIASYNCSHUTDOWNBLOCKER - static void InitStatics(); - // The MediaShutdownManager is a singleton, access its instance with // this accessor. static MediaShutdownManager& Instance(); @@ -73,7 +71,10 @@ private: MediaShutdownManager(); virtual ~MediaShutdownManager(); - void RemoveBlocker(); + + // Ensures we have a shutdown listener if we need one, and removes the + // listener and destroys the singleton if we don't. + void EnsureCorrectShutdownObserverState(); static StaticRefPtr sInstance; @@ -82,7 +83,10 @@ private: // we're shutting down (in the non xpcom-shutdown case). nsTHashtable> mDecoders; - bool mIsDoingXPCOMShutDown = false; + // True if we have an XPCOM shutdown observer. + bool mIsObservingShutdown; + + bool mIsDoingXPCOMShutDown; }; } // namespace mozilla diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 6df19031d972..fe8bdc0bd4e2 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -128,7 +128,6 @@ using namespace mozilla::system; #include "TouchManager.h" #include "MediaDecoder.h" #include "MediaPrefs.h" -#include "MediaShutdownManager.h" #include "mozilla/dom/devicestorage/DeviceStorageStatics.h" #include "mozilla/ServoBindings.h" #include "mozilla/StaticPresData.h" @@ -305,8 +304,6 @@ nsLayoutStatics::Initialize() mozilla::LayerAnimationInfo::Initialize(); #endif - MediaShutdownManager::InitStatics(); - MediaDecoder::InitStatics(); PromiseDebugging::Init(); From c522e5b4d261c59b0fad28e5889a8b79075d9fcd Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Fri, 3 Feb 2017 14:30:22 +0900 Subject: [PATCH 29/70] Bug 1336322 NativeKey::GetFollowingCharMessage() should treat the char message has gone if PeekMessage() failed to remove found char message and next key message becomes non-char message or different key's char message r=m_kato This patch depends on bug 1336080. When PeekMessage() fails to remove found char message, NativeKey::GetFollowingCharMessage() tries to check next key message in the queue again. Then, when next key message becomes non-char message, such as WM_KEYDOWN or WM_KEYUP, the char message must be removed by odd keyboard layout or something. Similarly, when next key message is a char message but it's caused by different key, the found char message must be removed by one of them too. So, in these cases, NativeKey::GetFollowingCharMessage() should treat the key operation is already handled or canceled by the odd keyboard layout or somebody else. Additionally, in the latter case, following char message should be handled as orphan char message(s) as usual. MozReview-Commit-ID: 8ahs8I0HUQ2 --HG-- extra : rebase_source : 563efc0e65c1d400a32cb0ceec94eb56ad0aa1c5 --- widget/windows/KeyboardLayout.cpp | 37 +++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 6db1b72b5783..f46389d0c027 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2917,7 +2917,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) "remove a char message, but it's already gone from all message " "queues, nextKeyMsg=%s, kFoundCharMsg=%s", this, ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); - return true; + return true; // XXX should return false in this case } // The next key message is redirected to different window created by our // thread, we should do nothing because we must not have focus. @@ -2931,11 +2931,40 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); return true; } + // If next key message becomes non-char message, this key operation + // may have already been consumed or canceled. + if (!IsCharMessage(nextKeyMsgInAllWindows)) { + MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, + ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " + "remove a char message and next key message becomes non-char " + "message, nextKeyMsgInAllWindows=%s, nextKeyMsg=%s, " + "kFoundCharMsg=%s", + this, ToString(nextKeyMsgInAllWindows).get(), + ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); + MOZ_ASSERT(!mCharMessageHasGone); + mFollowingCharMsgs.Clear(); + mCharMessageHasGone = true; + return false; + } + // If next key message is still a char message but different key message, + // we should treat current key operation is consumed or canceled and + // next char message should be handled as an orphan char message later. + if (!IsSamePhysicalKeyMessage(nextKeyMsgInAllWindows, kFoundCharMsg)) { + MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, + ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " + "remove a char message and next key message becomes differnt key's " + "char message, nextKeyMsgInAllWindows=%s, nextKeyMsg=%s, " + "kFoundCharMsg=%s", + this, ToString(nextKeyMsgInAllWindows).get(), + ToString(nextKeyMsg).get(), ToString(kFoundCharMsg).get())); + MOZ_ASSERT(!mCharMessageHasGone); + mFollowingCharMsgs.Clear(); + mCharMessageHasGone = true; + return false; + } // If next key message is still a char message but the message is changed, // we should retry to remove the new message with PeekMessage() again. - if (IsCharMessage(nextKeyMsgInAllWindows) && - nextKeyMsgInAllWindows.message != nextKeyMsg.message && - IsSamePhysicalKeyMessage(nextKeyMsgInAllWindows, kFoundCharMsg)) { + if (nextKeyMsgInAllWindows.message != nextKeyMsg.message) { MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " "remove a char message due to message change, let's retry to " From 78b1b5964b5a02241cea30da15680511813cdd60 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Fri, 3 Feb 2017 16:22:50 +0900 Subject: [PATCH 30/70] Bug 1336349 - Merge GetIsDocumentEditable implementation to EditorBase. r=masayuki GetIsDocumentEditable is implemnted in EditorBase, TextEditor, and HTMLEditor. This is virtual method, we won't use EditorBase::GetIsDocumentEditable. Also, TextEditor::GetIsDocumentEditable and HTMLEditor::GetIsDocumentEditable are same implementation. So we should merge this to EditorBase. MozReview-Commit-ID: 62euqUaYAuY --HG-- extra : rebase_source : 1a3025aeddc61d0ae3e0de334472ee8393893114 --- editor/libeditor/EditorBase.cpp | 2 +- editor/libeditor/EditorBase.h | 5 +++++ editor/libeditor/HTMLEditor.cpp | 17 ----------------- editor/libeditor/HTMLEditor.h | 6 ------ editor/libeditor/TextEditor.cpp | 18 ------------------ editor/libeditor/TextEditor.h | 6 ------ 6 files changed, 6 insertions(+), 48 deletions(-) diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 373e89b4faa6..7e23c7dfed9a 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -545,7 +545,7 @@ EditorBase::GetIsDocumentEditable(bool* aIsDocumentEditable) { NS_ENSURE_ARG_POINTER(aIsDocumentEditable); nsCOMPtr doc = GetDocument(); - *aIsDocumentEditable = !!doc; + *aIsDocumentEditable = doc && IsModifiable(); return NS_OK; } diff --git a/editor/libeditor/EditorBase.h b/editor/libeditor/EditorBase.h index 7cd01c913730..7c52e5e4e09a 100644 --- a/editor/libeditor/EditorBase.h +++ b/editor/libeditor/EditorBase.h @@ -857,6 +857,11 @@ public: return !!mSelConWeak; } + bool IsModifiable() const + { + return !IsReadonly(); + } + /** * Get the input event target. This might return null. */ diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index fe0c7bd5b2af..3b2e37691b7c 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -973,23 +973,6 @@ HTMLEditor::IsVisBreak(nsINode* aNode) return true; } -NS_IMETHODIMP -HTMLEditor::GetIsDocumentEditable(bool* aIsDocumentEditable) -{ - NS_ENSURE_ARG_POINTER(aIsDocumentEditable); - - nsCOMPtr doc = GetDOMDocument(); - *aIsDocumentEditable = doc && IsModifiable(); - - return NS_OK; -} - -bool -HTMLEditor::IsModifiable() -{ - return !IsReadonly(); -} - NS_IMETHODIMP HTMLEditor::UpdateBaseURL() { diff --git a/editor/libeditor/HTMLEditor.h b/editor/libeditor/HTMLEditor.h index 3bedfd5747c2..002b5a21f6c0 100644 --- a/editor/libeditor/HTMLEditor.h +++ b/editor/libeditor/HTMLEditor.h @@ -107,7 +107,6 @@ public: NS_IMETHOD GetPreferredIMEState(widget::IMEState* aState) override; // TextEditor overrides - NS_IMETHOD GetIsDocumentEditable(bool* aIsDocumentEditable) override; NS_IMETHOD BeginningOfDocument() override; virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) override; virtual already_AddRefed GetFocusedContent() override; @@ -670,11 +669,6 @@ protected: nsCOMPtr* insertParentNode, int32_t* insertOffset); - /** - * Small utility routine to test the eEditorReadonly bit. - */ - bool IsModifiable(); - /** * Helpers for block transformations. */ diff --git a/editor/libeditor/TextEditor.cpp b/editor/libeditor/TextEditor.cpp index f39565db783f..12b177a7afea 100644 --- a/editor/libeditor/TextEditor.cpp +++ b/editor/libeditor/TextEditor.cpp @@ -329,24 +329,6 @@ TextEditor::InitRules() return mRules->Init(this); } - -NS_IMETHODIMP -TextEditor::GetIsDocumentEditable(bool* aIsDocumentEditable) -{ - NS_ENSURE_ARG_POINTER(aIsDocumentEditable); - - nsCOMPtr doc = GetDOMDocument(); - *aIsDocumentEditable = doc && IsModifiable(); - - return NS_OK; -} - -bool -TextEditor::IsModifiable() -{ - return !IsReadonly(); -} - nsresult TextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) { diff --git a/editor/libeditor/TextEditor.h b/editor/libeditor/TextEditor.h index 25e00318977d..df33fbbc50a4 100644 --- a/editor/libeditor/TextEditor.h +++ b/editor/libeditor/TextEditor.h @@ -80,7 +80,6 @@ public: const nsAString& aValue) override; NS_IMETHOD GetDocumentIsEmpty(bool* aDocumentIsEmpty) override; - NS_IMETHOD GetIsDocumentEditable(bool* aIsDocumentEditable) override; NS_IMETHOD DeleteSelection(EDirection aAction, EStripWrappers aStripWrappers) override; @@ -213,11 +212,6 @@ protected: nsresult SharedOutputString(uint32_t aFlags, bool* aIsCollapsed, nsAString& aResult); - /** - * Small utility routine to test the eEditorReadonly bit. - */ - bool IsModifiable(); - enum PasswordFieldAllowed { ePasswordFieldAllowed, From b769737eb78e3eedf07edd6151ad6f228bbfdd4f Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Fri, 3 Feb 2017 18:01:33 +0900 Subject: [PATCH 31/70] Bug 1336331 NativeKey::GetFollowingCharMessage() should try to use GetMessage() when PeekMessage() failed to remove a char message from the queue and there is still existing a char message r=m_kato I think that when PeekMessage(PM_REMOVE) failed to remove a char message but next key message is still a char message, it may be possible that the odd keyboard layout or utility hook only PeekMessage(PM_NOREMOVE) and GetMessage(). If so, we can explain what occurs in this case. I'm still not sure this fixes the case of bug 1336322 comment 0, but we should try to do this because I don't have better idea. MozReview-Commit-ID: CxoO24n167t --HG-- extra : rebase_source : c00b86166a345eec18fa2de74698f6e8859364b8 --- widget/windows/KeyboardLayout.cpp | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index f46389d0c027..3bb622a8e7c5 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2975,21 +2975,23 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) nextKeyMsg = nextKeyMsgInAllWindows; continue; } - if (MayBeSameCharMessage(nextKeyMsgInAllWindows, nextKeyMsg)) { - // The found char message still in the queue, but PeekMessage() failed - // to remove it only with PM_REMOVE. Although, we don't know why this - // occurs. However, this occurs acctually. - // Try to remove the char message with GetMessage() again. - if (WinUtils::GetMessage(&removedMsg, mMsg.hwnd, - nextKeyMsg.message, nextKeyMsg.message)) { - MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, - ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " - "remove a char message, but succeeded with GetMessage(), " - "removedMsg=%s, kFoundCharMsg=%s", - this, ToString(removedMsg).get(), ToString(kFoundCharMsg).get())); - // Cancel to crash, but we need to check the removed message value. - doCrash = false; - } + // If there is still existing a char message caused by same physical key + // in the queue but PeekMessage(PM_REMOVE) failed to remove it from the + // queue, it might be possible that the odd keyboard layout or utility + // hooks only PeekMessage(PM_NOREMOVE) and GetMessage(). So, let's try + // remove the char message with GetMessage() again. + // FYI: The wParam might be different from the found message, but it's + // okay because we assume that odd keyboard layouts return actual + // inputting character at removing the char message. + if (WinUtils::GetMessage(&removedMsg, mMsg.hwnd, + nextKeyMsg.message, nextKeyMsg.message)) { + MOZ_LOG(sNativeKeyLogger, LogLevel::Warning, + ("%p NativeKey::GetFollowingCharMessage(), WARNING, failed to " + "remove a char message, but succeeded with GetMessage(), " + "removedMsg=%s, kFoundCharMsg=%s", + this, ToString(removedMsg).get(), ToString(kFoundCharMsg).get())); + // Cancel to crash, but we need to check the removed message value. + doCrash = false; } // If we've already removed some WM_NULL messages from the queue and // the found message has already gone from the queue, let's treat the key From 561671475df1e6490db092ca175ca8c2b57f0bd4 Mon Sep 17 00:00:00 2001 From: Chun-Min Chang Date: Thu, 26 Jan 2017 17:35:31 +0800 Subject: [PATCH 32/70] Bug 1321502 - part 1: Enable multi-channel support in Gecko on Windows; r=jya MozReview-Commit-ID: KURUk3EffOu --HG-- extra : rebase_source : a0ce3fb8691f45a33995a3ce1ba895c254a35c8c --- dom/media/AudioStream.cpp | 7 +--- dom/media/AudioStream.h | 5 ++- dom/media/CubebUtils.cpp | 42 ++++++++++++++++++++ dom/media/CubebUtils.h | 1 + dom/media/MediaPrefs.h | 6 ++- dom/media/mediasink/DecodedAudioDataSink.cpp | 8 +++- 6 files changed, 60 insertions(+), 9 deletions(-) diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 671854030c43..93ecda4319af 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -318,7 +318,7 @@ int AudioStream::InvokeCubeb(Function aFunction, Args&&... aArgs) } nsresult -AudioStream::Init(uint32_t aNumChannels, uint32_t aRate, +AudioStream::Init(uint32_t aNumChannels, uint32_t aChannelMap, uint32_t aRate, const dom::AudioChannel aAudioChannel) { auto startTime = TimeStamp::Now(); @@ -332,6 +332,7 @@ AudioStream::Init(uint32_t aNumChannels, uint32_t aRate, cubeb_stream_params params; params.rate = aRate; params.channels = mOutChannels; + params.layout = CubebUtils::ConvertChannelMapToCubebLayout(aChannelMap); #if defined(__ANDROID__) #if defined(MOZ_B2G) params.stream_type = CubebUtils::ConvertChannelToCubebType(aAudioChannel); @@ -354,10 +355,6 @@ AudioStream::Init(uint32_t aNumChannels, uint32_t aRate, return NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR; } - // The DecodedAudioDataSink forces mono or stereo for now. - params.layout = params.channels == 1 ? CUBEB_LAYOUT_MONO - : CUBEB_LAYOUT_STEREO; - return OpenCubeb(cubebContext, params, startTime, CubebUtils::GetFirstStream()); } diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index acc38b93db7e..23da668661e3 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -188,9 +188,10 @@ public: explicit AudioStream(DataSource& aSource); // Initialize the audio stream. aNumChannels is the number of audio - // channels (1 for mono, 2 for stereo, etc) and aRate is the sample rate + // channels (1 for mono, 2 for stereo, etc), aChannelMap is the indicator for + // channel layout(mono, stereo, 5.1 or 7.1 ) and aRate is the sample rate // (22050Hz, 44100Hz, etc). - nsresult Init(uint32_t aNumChannels, uint32_t aRate, + nsresult Init(uint32_t aNumChannels, uint32_t aChannelMap, uint32_t aRate, const dom::AudioChannel aAudioStreamChannel); // Closes the stream. All future use of the stream is an error. diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index e10e07e06ade..f66f3457116e 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -24,6 +24,23 @@ #define PREF_CUBEB_LATENCY_MSG "media.cubeb_latency_msg_frames" #define PREF_CUBEB_LOG_LEVEL "media.cubeb.log_level" +#define MASK_MONO (1 << AudioConfig::CHANNEL_MONO) +#define MASK_MONO_LFE (MASK_MONO | (1 << AudioConfig::CHANNEL_LFE)) +#define MASK_STEREO ((1 << AudioConfig::CHANNEL_LEFT) | (1 << AudioConfig::CHANNEL_RIGHT)) +#define MASK_STEREO_LFE (MASK_STEREO | (1 << AudioConfig::CHANNEL_LFE)) +#define MASK_3F (MASK_STEREO | (1 << AudioConfig::CHANNEL_CENTER)) +#define MASK_3F_LFE (MASK_3F | (1 << AudioConfig::CHANNEL_LFE)) +#define MASK_2F1 (MASK_STEREO | (1 << AudioConfig::CHANNEL_RCENTER)) +#define MASK_2F1_LFE (MASK_2F1 | (1 << AudioConfig::CHANNEL_LFE)) +#define MASK_3F1 (MASK_3F | (1 < AudioConfig::CHANNEL_RCENTER)) +#define MASK_3F1_LFE (MASK_3F1 | (1 << AudioConfig::CHANNEL_LFE)) +#define MASK_2F2 (MASK_STEREO | (1 << AudioConfig::CHANNEL_LS) | (1 << AudioConfig::CHANNEL_RS)) +#define MASK_2F2_LFE (MASK_2F2 | (1 << AudioConfig::CHANNEL_LFE)) +#define MASK_3F2 (MASK_3F | (1 << AudioConfig::CHANNEL_LS) | (1 << AudioConfig::CHANNEL_RS)) +#define MASK_3F2_LFE (MASK_3F2 | (1 << AudioConfig::CHANNEL_LFE)) +#define MASK_3F3R_LFE (MASK_3F2_LFE | (1 << AudioConfig::CHANNEL_RCENTER)) +#define MASK_3F4_LFE (MASK_3F2_LFE | (1 << AudioConfig::CHANNEL_RLS) | (1 << AudioConfig::CHANNEL_RRS)) + namespace mozilla { namespace { @@ -359,6 +376,31 @@ uint32_t MaxNumberOfChannels() return 0; } +cubeb_channel_layout ConvertChannelMapToCubebLayout(uint32_t aChannelMap) +{ + switch(aChannelMap) { + case MASK_MONO: return CUBEB_LAYOUT_MONO; + case MASK_MONO_LFE: return CUBEB_LAYOUT_MONO_LFE; + case MASK_STEREO: return CUBEB_LAYOUT_STEREO; + case MASK_STEREO_LFE: return CUBEB_LAYOUT_STEREO_LFE; + case MASK_3F: return CUBEB_LAYOUT_3F; + case MASK_3F_LFE: return CUBEB_LAYOUT_3F_LFE; + case MASK_2F1: return CUBEB_LAYOUT_2F1; + case MASK_2F1_LFE: return CUBEB_LAYOUT_2F1_LFE; + case MASK_3F1: return CUBEB_LAYOUT_3F1; + case MASK_3F1_LFE: return CUBEB_LAYOUT_3F1_LFE; + case MASK_2F2: return CUBEB_LAYOUT_2F2; + case MASK_2F2_LFE: return CUBEB_LAYOUT_2F2_LFE; + case MASK_3F2: return CUBEB_LAYOUT_3F2; + case MASK_3F2_LFE: return CUBEB_LAYOUT_3F2_LFE; + case MASK_3F3R_LFE: return CUBEB_LAYOUT_3F3R_LFE; + case MASK_3F4_LFE: return CUBEB_LAYOUT_3F4_LFE; + default: + NS_ERROR("The channel map is unsupported"); + return CUBEB_LAYOUT_UNDEFINED; + } +} + #if defined(__ANDROID__) && defined(MOZ_B2G) cubeb_stream_type ConvertChannelToCubebType(dom::AudioChannel aChannel) { diff --git a/dom/media/CubebUtils.h b/dom/media/CubebUtils.h index 171c244b7843..b3a2b56d0ac4 100644 --- a/dom/media/CubebUtils.h +++ b/dom/media/CubebUtils.h @@ -40,6 +40,7 @@ void ReportCubebBackendUsed(); uint32_t GetCubebPlaybackLatencyInMilliseconds(); Maybe GetCubebMSGLatencyInFrames(); bool CubebLatencyPrefSet(); +cubeb_channel_layout ConvertChannelMapToCubebLayout(uint32_t aChannelMap); #if defined(__ANDROID__) && defined(MOZ_B2G) cubeb_stream_type ConvertChannelToCubebType(dom::AudioChannel aChannel); #endif diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h index 7f9e694a0bbe..95c3cfdde9b9 100644 --- a/dom/media/MediaPrefs.h +++ b/dom/media/MediaPrefs.h @@ -90,8 +90,12 @@ private: DECL_MEDIA_PREF("accessibility.monoaudio.enable", MonoAudio, bool, false); DECL_MEDIA_PREF("media.resampling.enabled", AudioSinkResampling, bool, false); DECL_MEDIA_PREF("media.resampling.rate", AudioSinkResampleRate, uint32_t, 48000); +#if defined(XP_WIN) + // Enable multiple channel support on Windows. + DECL_MEDIA_PREF("media.forcestereo.enabled", AudioSinkForceStereo, bool, false); +#else DECL_MEDIA_PREF("media.forcestereo.enabled", AudioSinkForceStereo, bool, true); - +#endif // VideoSink DECL_MEDIA_PREF("media.ruin-av-sync.enabled", RuinAvSync, bool, false); diff --git a/dom/media/mediasink/DecodedAudioDataSink.cpp b/dom/media/mediasink/DecodedAudioDataSink.cpp index a8dbdda6e1be..c9f7a29aba14 100644 --- a/dom/media/mediasink/DecodedAudioDataSink.cpp +++ b/dom/media/mediasink/DecodedAudioDataSink.cpp @@ -197,7 +197,13 @@ nsresult DecodedAudioDataSink::InitializeAudioStream(const PlaybackParams& aParams) { mAudioStream = new AudioStream(*this); - nsresult rv = mAudioStream->Init(mOutputChannels, mOutputRate, mChannel); + // The layout map used here is already processed by mConverter with + // mOutputChannels into SMPTE format, so there is no need to worry if + // MediaPrefs::MonoAudio() or MediaPrefs::AudioSinkForceStereo() is applied. + nsresult rv = mAudioStream->Init(mOutputChannels, + mConverter->OutputConfig().Layout().Map(), + mOutputRate, + mChannel); if (NS_FAILED(rv)) { mAudioStream->Shutdown(); mAudioStream = nullptr; From 9efca17a0786f228bf647c9be9a89165fca03136 Mon Sep 17 00:00:00 2001 From: Chun-Min Chang Date: Sat, 4 Feb 2017 08:22:15 +0800 Subject: [PATCH 33/70] Bug 1321502 - part 2: Use preferred layout for initializing cubeb when audio queue is empty; r=jya MozReview-Commit-ID: BDEb8IxuJRn --HG-- extra : rebase_source : a3bc1ea315c6a00d479a1b7da3eb14d89f458b2d --- dom/media/AudioStream.h | 5 ++ dom/media/CubebUtils.cpp | 60 ++++++++++++++++++++ dom/media/CubebUtils.h | 3 + dom/media/mediasink/DecodedAudioDataSink.cpp | 10 ++-- 4 files changed, 74 insertions(+), 4 deletions(-) diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index 23da668661e3..7dc1f60f95cc 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -225,6 +225,11 @@ public: return CubebUtils::PreferredSampleRate(); } + static uint32_t GetPreferredChannelMap(uint32_t aChannels) + { + return CubebUtils::PreferredChannelMap(aChannels); + } + uint32_t GetOutChannels() { return mOutChannels; } // Set playback rate as a multiple of the intrinsic playback rate. This is to diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index f66f3457116e..0f346268045b 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -111,6 +111,11 @@ const int CUBEB_BACKEND_UNKNOWN = CUBEB_BACKEND_INIT_FAILURE_FIRST + 2; // visible on the querying thread/CPU. uint32_t sPreferredSampleRate; +// We only support SMPTE layout in cubeb for now. If the value is +// CUBEB_LAYOUT_UNDEFINED, then it implies that the preferred layout is +// non-SMPTE format. +cubeb_channel_layout sPreferredChannelLayout; + } // namespace extern LazyLogModule gAudioStreamLog; @@ -216,6 +221,61 @@ uint32_t PreferredSampleRate() return sPreferredSampleRate; } +bool InitPreferredChannelLayout() +{ + StaticMutexAutoLock lock(sMutex); + if (sPreferredChannelLayout != 0) { + return true; + } + cubeb* context = GetCubebContextUnlocked(); + if (!context) { + return false; + } + return cubeb_get_preferred_channel_layout(context, + &sPreferredChannelLayout) == CUBEB_OK + ? true : false; +} + +uint32_t PreferredChannelMap(uint32_t aChannels) +{ + // The first element of the following mapping table is channel counts, + // and the second one is its bit mask. It will be used in many times, + // so we shoule avoid to allocate it in stack, or it will be created + // and removed repeatedly. Use static to allocate this local variable + // in data space instead of stack. + static uint32_t layoutInfo[CUBEB_LAYOUT_MAX][2] = { + { 0, 0 }, // CUBEB_LAYOUT_UNDEFINED + { 2, MASK_STEREO }, // CUBEB_LAYOUT_DUAL_MONO + { 3, MASK_STEREO_LFE }, // CUBEB_LAYOUT_DUAL_MONO_LFE + { 1, MASK_MONO }, // CUBEB_LAYOUT_MONO + { 2, MASK_MONO_LFE }, // CUBEB_LAYOUT_MONO_LFE + { 2, MASK_STEREO }, // CUBEB_LAYOUT_STEREO + { 3, MASK_STEREO_LFE }, // CUBEB_LAYOUT_STEREO_LFE + { 3, MASK_3F }, // CUBEB_LAYOUT_3F + { 4, MASK_3F_LFE }, // CUBEB_LAYOUT_3F_LFE + { 3, MASK_2F1 }, // CUBEB_LAYOUT_2F1 + { 4, MASK_2F1_LFE }, // CUBEB_LAYOUT_2F1_LFE + { 4, MASK_3F1 }, // CUBEB_LAYOUT_3F1 + { 5, MASK_3F1_LFE }, // CUBEB_LAYOUT_3F1_LFE + { 4, MASK_2F2 }, // CUBEB_LAYOUT_2F2 + { 5, MASK_2F2_LFE }, // CUBEB_LAYOUT_2F2_LFE + { 5, MASK_3F2 }, // CUBEB_LAYOUT_3F2 + { 6, MASK_3F2_LFE }, // CUBEB_LAYOUT_3F2_LFE + { 7, MASK_3F3R_LFE }, // CUBEB_LAYOUT_3F3R_LFE + { 8, MASK_3F4_LFE }, // CUBEB_LAYOUT_3F4_LFE + }; + + // Use SMPTE default channel map if we can't get preferred layout + // or the channel counts of preferred layout is different from input's one + if (!InitPreferredChannelLayout() + || layoutInfo[sPreferredChannelLayout][0] != aChannels) { + AudioConfig::ChannelLayout smpteLayout(aChannels); + return smpteLayout.Map(); + } + + return layoutInfo[sPreferredChannelLayout][1]; +} + void InitBrandName() { if (sBrandName) { diff --git a/dom/media/CubebUtils.h b/dom/media/CubebUtils.h index b3a2b56d0ac4..e2d898921b26 100644 --- a/dom/media/CubebUtils.h +++ b/dom/media/CubebUtils.h @@ -30,6 +30,9 @@ uint32_t MaxNumberOfChannels(); // Get the sample rate the hardware/mixer runs at. Thread safe. uint32_t PreferredSampleRate(); +// Get the bit mask of the connected audio device's preferred layout. +uint32_t PreferredChannelMap(uint32_t aChannels); + void PrefChanged(const char* aPref, void* aClosure); double GetVolumeScale(); bool GetFirstStream(); diff --git a/dom/media/mediasink/DecodedAudioDataSink.cpp b/dom/media/mediasink/DecodedAudioDataSink.cpp index c9f7a29aba14..531f4b9eaea8 100644 --- a/dom/media/mediasink/DecodedAudioDataSink.cpp +++ b/dom/media/mediasink/DecodedAudioDataSink.cpp @@ -197,13 +197,15 @@ nsresult DecodedAudioDataSink::InitializeAudioStream(const PlaybackParams& aParams) { mAudioStream = new AudioStream(*this); + // When AudioQueue is empty, there is no way to know the channel layout of + // the coming audio data, so we use the predefined channel map instead. + uint32_t channelMap = mConverter + ? mConverter->OutputConfig().Layout().Map() + : AudioStream::GetPreferredChannelMap(mOutputChannels); // The layout map used here is already processed by mConverter with // mOutputChannels into SMPTE format, so there is no need to worry if // MediaPrefs::MonoAudio() or MediaPrefs::AudioSinkForceStereo() is applied. - nsresult rv = mAudioStream->Init(mOutputChannels, - mConverter->OutputConfig().Layout().Map(), - mOutputRate, - mChannel); + nsresult rv = mAudioStream->Init(mOutputChannels, channelMap, mOutputRate, mChannel); if (NS_FAILED(rv)) { mAudioStream->Shutdown(); mAudioStream = nullptr; From 8e9169e0f5bfd7203f4c0fdf343e7a6cf37e75f3 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Wed, 25 Jan 2017 15:45:12 -0800 Subject: [PATCH 34/70] Bug 1333303 - Remove the google4 dir from the test and relax the list comparison. r=whimboo MozReview-Commit-ID: 2KY6CEQZYOk --HG-- extra : rebase_source : 186be1cbf3fabf1e47845dcc096c4bab15a413e6 --- .../test_safe_browsing_initial_download.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/testing/firefox-ui/tests/functional/security/test_safe_browsing_initial_download.py b/testing/firefox-ui/tests/functional/security/test_safe_browsing_initial_download.py index eb8c77c77646..22d103ba8e39 100644 --- a/testing/firefox-ui/tests/functional/security/test_safe_browsing_initial_download.py +++ b/testing/firefox-ui/tests/functional/security/test_safe_browsing_initial_download.py @@ -56,15 +56,12 @@ class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase): if is_v4: my_file_extensions = self.v4_file_extensions else: # v2 - # safebrowsing dir should have a 'google4' directory where - # v4 databases exist. - files.append('google4') my_file_extensions = self.v2_file_extensions for pref_name in self.prefs_download_lists: base_names = self.marionette.get_pref(pref_name).split(',') for ext in my_file_extensions: - files.extend(['{file}.{ext}'.format(file=f, ext=ext) + files.extend(['{name}.{ext}'.format(name=f, ext=ext) for f in base_names if f and f.endswith('-proto') == is_v4]) return set(sorted(files)) @@ -80,7 +77,10 @@ class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase): self.safebrowsing_path = os.path.join(self.marionette.instance.profile.profile, 'safebrowsing') self.safebrowsing_v2_files = self.get_safebrowsing_files(False) - self.safebrowsing_v4_files = self.get_safebrowsing_files(True) + # Bug 1330253 - Leave the next line disabled until we have google API key + # on the CI machines. + # self.safebrowsing_v4_files = self.get_safebrowsing_files(True) + self.safebrowsing_v4_files = [] def tearDown(self): try: @@ -98,9 +98,11 @@ class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase): Wait(self.marionette, timeout=60).until( check_downloaded, message='Not all safebrowsing files have been downloaded') finally: - self.assertSetEqual(self.safebrowsing_v2_files, - set(os.listdir(self.safebrowsing_path))) - # Bug 1330253 - Leave the next test disabled until we have google api key - # on the CI machines. - # self.assertSetEqual(self.safebrowsing_v4_files, - # set(os.listdir(os.path.join(self.safebrowsing_path, 'google4')))) + files_on_disk_toplevel = os.listdir(self.safebrowsing_path) + for f in self.safebrowsing_v2_files: + self.assertIn(f, files_on_disk_toplevel) + + if len(self.safebrowsing_v4_files) > 0: + files_on_disk_google4 = os.listdir(os.path.join(self.safebrowsing_path, 'google4')) + for f in self.safebrowsing_v4_files: + self.assertIn(f, files_on_disk_google4) From c9fe666f10a231ec585d94536c706ae2b52633c2 Mon Sep 17 00:00:00 2001 From: Andrew Swan Date: Fri, 27 Jan 2017 20:13:43 -0800 Subject: [PATCH 35/70] bug 1317000 Test for permission prompts on local file installs r=mossop MozReview-Commit-ID: FHakjocnDmn --HG-- extra : rebase_source : ccd0834847571eb81ff87a31a640cc6de597428b --- .../general/browser_extension_permissions.js | 65 ++++++++++++++----- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/browser/base/content/test/general/browser_extension_permissions.js b/browser/base/content/test/general/browser_extension_permissions.js index ada14cb68c2e..fe8e4d04058e 100644 --- a/browser/base/content/test/general/browser_extension_permissions.js +++ b/browser/base/content/test/general/browser_extension_permissions.js @@ -3,9 +3,9 @@ const BASE = getRootDirectory(gTestPath) .replace("chrome://mochitests/content/", "https://example.com/"); -const PAGE = `${BASE}/file_install_extensions.html`; -const PERMS_XPI = `${BASE}/browser_webext_permissions.xpi`; -const NO_PERMS_XPI = `${BASE}/browser_webext_nopermissions.xpi`; +const INSTALL_PAGE = `${BASE}/file_install_extensions.html`; +const PERMS_XPI = "browser_webext_permissions.xpi"; +const NO_PERMS_XPI = "browser_webext_nopermissions.xpi"; const ID = "permissions@test.mozilla.org"; const DEFAULT_EXTENSION_ICON = "chrome://browser/content/extension.svg"; @@ -36,13 +36,13 @@ function promiseGetAddonByID(id) { }); } -function checkNotification(panel, url) { +function checkNotification(panel, filename) { let icon = panel.getAttribute("icon"); let ul = document.getElementById("addon-webext-perm-list"); let header = document.getElementById("addon-webext-perm-intro"); - if (url == PERMS_XPI) { + if (filename == PERMS_XPI) { // The icon should come from the extension, don't bother with the precise // path, just make sure we've got a jar url pointing to the right path // inside the jar. @@ -52,7 +52,7 @@ function checkNotification(panel, url) { is(header.getAttribute("hidden"), "", "Permission list header is visible"); is(ul.childElementCount, 4, "Permissions list has 4 entries"); // Real checking of the contents here is deferred until bug 1316996 lands - } else if (url == NO_PERMS_XPI) { + } else if (filename == NO_PERMS_XPI) { // This extension has no icon, it should have the default is(icon, DEFAULT_EXTENSION_ICON, "Icon is the default extension icon"); @@ -61,18 +61,48 @@ function checkNotification(panel, url) { } } +// Navigate the current tab to the given url and return a Promise +// that resolves when the page is loaded. +function load(url) { + gBrowser.selectedBrowser.loadURI(INSTALL_PAGE); + return BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); +} + const INSTALL_FUNCTIONS = [ - function installMozAM(url) { - return ContentTask.spawn(gBrowser.selectedBrowser, url, function*(cUrl) { - yield content.wrappedJSObject.installMozAM(cUrl); + async function installMozAM(filename) { + await load(INSTALL_PAGE); + + await ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/${filename}`, function*(url) { + yield content.wrappedJSObject.installMozAM(url); }); }, - function installTrigger(url) { - ContentTask.spawn(gBrowser.selectedBrowser, url, function*(cUrl) { - content.wrappedJSObject.installTrigger(cUrl); + async function installTrigger(filename) { + await load(INSTALL_PAGE); + + ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/${filename}`, function*(url) { + content.wrappedJSObject.installTrigger(url); }); - return Promise.resolve(); + }, + + async function installFile(filename) { + const ChromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"] + .getService(Ci.nsIChromeRegistry); + let chromeUrl = Services.io.newURI(gTestPath); + let fileUrl = ChromeRegistry.convertChromeURL(chromeUrl); + let file = fileUrl.QueryInterface(Ci.nsIFileURL).file; + file.leafName = filename; + + let MockFilePicker = SpecialPowers.MockFilePicker; + MockFilePicker.init(window); + MockFilePicker.returnFiles = [file]; + + await BrowserOpenAddonsMgr("addons://list/extension"); + let contentWin = gBrowser.selectedTab.linkedBrowser.contentWindow; + + // Do the install... + contentWin.gViewController.doCommand("cmd_installFromFile"); + MockFilePicker.cleanup(); }, ]; @@ -85,8 +115,8 @@ add_task(function* () { ["extensions.webextPermissionPrompts", true], ]}); - function* runOnce(installFn, url, cancel) { - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, PAGE); + function* runOnce(installFn, filename, cancel) { + let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser); let installPromise = new Promise(resolve => { let listener = { @@ -118,10 +148,10 @@ add_task(function* () { AddonManager.addInstallListener(listener); }); - let installMethodPromise = installFn(url); + let installMethodPromise = installFn(filename); let panel = yield promisePopupNotificationShown("addon-webext-permissions"); - checkNotification(panel, url); + checkNotification(panel, filename); if (cancel) { panel.secondaryButton.click(); @@ -140,7 +170,6 @@ add_task(function* () { yield installMethodPromise; } - let result = yield installPromise; let addon = yield promiseGetAddonByID(ID); if (cancel) { From 386a057848f434e944e81da2a08f53333711f41c Mon Sep 17 00:00:00 2001 From: cku Date: Sun, 5 Feb 2017 22:17:45 +0800 Subject: [PATCH 36/70] Bug 1334961 - Turn on clip-path-basic-shapes for paint-on-maskLayer-1c.html. r=mstange MozReview-Commit-ID: Fohgwy98opM --HG-- extra : rebase_source : f26eb0b69b6f40a57a54014686aee13b6cfa1b1b --- layout/reftests/svg/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 0d81636ec2bc..37698cf03707 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -464,7 +464,7 @@ default-preferences == paint-on-maskLayer-1a.html paint-on-maskLayer-1-ref.html == paint-on-maskLayer-1b.html paint-on-maskLayer-1-ref.html -== paint-on-maskLayer-1c.html paint-on-maskLayer-1-ref.html +pref(layout.css.clip-path-shapes.enabled,true) == paint-on-maskLayer-1c.html paint-on-maskLayer-1-ref.html fuzzy(71,817) == filter-on-continuation-box-01.html filter-on-continuation-box-ref.html == mask-contains-inner-svg-01.svg pass.svg From 41ebbcb918141263e3b315f932c7bad6280b0179 Mon Sep 17 00:00:00 2001 From: Barun Parruck Date: Sun, 29 Jan 2017 06:25:51 +0530 Subject: [PATCH 37/70] Bug 1334796 : Removes redundant return statement in void function r=froydnj MozReview-Commit-ID: 1EkMIiXMtjf --HG-- extra : rebase_source : ea6d5e7617bb7b35c4029d16b2ccca07bba39660 --- startupcache/StartupCache.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index f698187170a5..1768d62c8c57 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -456,8 +456,6 @@ StartupCache::WriteToDisk() // Our reader's view of the archive is outdated now, reload it. LoadArchive(); - - return; } void From ecdf363246f3e59606331c0ce8f78367820c1d72 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sun, 5 Feb 2017 00:52:38 -0500 Subject: [PATCH 38/70] bug 1303096 - Stop sending sync messages soon after content process start-up r=billm --- caps/DomainPolicy.cpp | 2 +- caps/nsIDomainPolicy.idl | 3 +- dom/ipc/ContentChild.cpp | 62 +++--- dom/ipc/ContentChild.h | 12 +- dom/ipc/ContentParent.cpp | 258 ++++++++++++----------- dom/ipc/ContentParent.h | 19 -- dom/ipc/ContentPrefs.cpp | 275 +++++++++++++++++++++++++ dom/ipc/ContentPrefs.h | 25 +++ dom/ipc/ContentProcess.cpp | 156 +++++++++++--- dom/ipc/ContentProcess.h | 12 +- dom/ipc/PContent.ipdl | 43 ++-- dom/ipc/TabChild.cpp | 2 + dom/ipc/moz.build | 2 + dom/media/gmp/GMPProcessChild.cpp | 2 +- dom/media/gmp/GMPProcessChild.h | 2 +- dom/plugins/ipc/PluginProcessChild.cpp | 2 +- dom/plugins/ipc/PluginProcessChild.h | 2 +- gfx/ipc/GPUProcessImpl.cpp | 2 +- gfx/ipc/GPUProcessImpl.h | 2 +- ipc/glue/ProcessChild.h | 2 +- modules/libpref/Preferences.cpp | 30 ++- modules/libpref/Preferences.h | 20 ++ modules/libpref/prefapi.cpp | 38 +++- modules/libpref/prefapi_private_data.h | 6 + toolkit/xre/nsEmbedFunctions.cpp | 47 +---- 25 files changed, 733 insertions(+), 293 deletions(-) create mode 100644 dom/ipc/ContentPrefs.cpp create mode 100644 dom/ipc/ContentPrefs.h diff --git a/caps/DomainPolicy.cpp b/caps/DomainPolicy.cpp index 16029a2bdfdc..2dcec2abe4b3 100644 --- a/caps/DomainPolicy.cpp +++ b/caps/DomainPolicy.cpp @@ -139,7 +139,7 @@ CopyURIs(const InfallibleTArray& aDomains, nsIDomainSet* aSet) } void -DomainPolicy::ApplyClone(DomainPolicyClone* aClone) +DomainPolicy::ApplyClone(const DomainPolicyClone* aClone) { CopyURIs(aClone->blacklist(), mBlacklist); CopyURIs(aClone->whitelist(), mWhitelist); diff --git a/caps/nsIDomainPolicy.idl b/caps/nsIDomainPolicy.idl index 54b0de4dbf98..3fd4020a60d0 100644 --- a/caps/nsIDomainPolicy.idl +++ b/caps/nsIDomainPolicy.idl @@ -17,6 +17,7 @@ class DomainPolicyClone; %} [ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone); +[ptr] native DomainPolicyCloneConstPtr(const mozilla::dom::DomainPolicyClone); /* * When a domain policy is instantiated by invoking activateDomainPolicy() on @@ -41,7 +42,7 @@ interface nsIDomainPolicy : nsISupports void deactivate(); [noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone); - [noscript, notxpcom] void applyClone(in DomainPolicyClonePtr aClone); + [noscript, notxpcom] void applyClone(in DomainPolicyCloneConstPtr aClone); }; [scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)] diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index aee51eeee77a..e271e10bb2cc 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -502,10 +502,24 @@ NS_INTERFACE_MAP_BEGIN(ContentChild) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentChild) NS_INTERFACE_MAP_END + +mozilla::ipc::IPCResult +ContentChild::RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit, + const StructuredCloneData& aInitialData, + nsTArray&& aLookAndFeelIntCache) +{ + mLookAndFeelCache = aLookAndFeelIntCache; + InitXPCOM(aXPCOMInit, aInitialData); + InitGraphicsDeviceData(); + return IPC_OK(); +} + bool ContentChild::Init(MessageLoop* aIOLoop, base::ProcessId aParentPid, - IPC::Channel* aChannel) + IPC::Channel* aChannel, + uint64_t aChildID, + bool aIsForBrowser) { #ifdef MOZ_WIDGET_GTK // We need to pass a display down to gtk_init because it's not going to @@ -571,7 +585,8 @@ ContentChild::Init(MessageLoop* aIOLoop, XRE_GetProcessType()); #endif - SendGetProcessAttributes(&mID, &mIsForBrowser); + mID = aChildID; + mIsForBrowser = aIsForBrowser; #ifdef NS_PRINTING // Force the creation of the nsPrintingProxy so that it's IPC counterpart, @@ -933,8 +948,14 @@ ContentChild::InitGraphicsDeviceData() } void -ContentChild::InitXPCOM() +ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit, + const mozilla::dom::ipc::StructuredCloneData& aInitialData) { + SET_PREF_PHASE(pref_initPhase::BEGIN_ALL_PREFS); + for (unsigned int i = 0; i < aXPCOMInit.prefs().Length(); i++) { + Preferences::SetPreference(aXPCOMInit.prefs().ElementAt(i)); + } + SET_PREF_PHASE(pref_initPhase::END_ALL_PREFS); // Do this as early as possible to get the parent process to initialize the // background thread since we'll likely need database information very soon. BackgroundChild::Startup(); @@ -957,42 +978,29 @@ ContentChild::InitXPCOM() if (NS_FAILED(svc->RegisterListener(mConsoleListener))) NS_WARNING("Couldn't register console listener for child process"); - bool isOffline, isLangRTL, haveBidiKeyboards; - bool isConnected; - int32_t captivePortalState; - ClipboardCapabilities clipboardCaps; - DomainPolicyClone domainPolicy; - StructuredCloneData initialData; - OptionalURIParams userContentSheetURL; + mAvailableDictionaries = aXPCOMInit.dictionaries(); - SendGetXPCOMProcessAttributes(&isOffline, &isConnected, &captivePortalState, - &isLangRTL, &haveBidiKeyboards, - &mAvailableDictionaries, - &clipboardCaps, &domainPolicy, &initialData, - &mFontFamilies, &userContentSheetURL, - &mLookAndFeelCache); - - RecvSetOffline(isOffline); - RecvSetConnectivity(isConnected); - RecvSetCaptivePortalState(captivePortalState); - RecvBidiKeyboardNotify(isLangRTL, haveBidiKeyboards); + RecvSetOffline(aXPCOMInit.isOffline()); + RecvSetConnectivity(aXPCOMInit.isConnected()); + RecvSetCaptivePortalState(aXPCOMInit.captivePortalState()); + RecvBidiKeyboardNotify(aXPCOMInit.isLangRTL(), aXPCOMInit.haveBidiKeyboards()); // Create the CPOW manager as soon as possible. SendPJavaScriptConstructor(); - if (domainPolicy.active()) { + if (aXPCOMInit.domainPolicy().active()) { nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); MOZ_ASSERT(ssm); ssm->ActivateDomainPolicyInternal(getter_AddRefs(mPolicy)); if (!mPolicy) { MOZ_CRASH("Failed to activate domain policy."); } - mPolicy->ApplyClone(&domainPolicy); + mPolicy->ApplyClone(&aXPCOMInit.domainPolicy()); } nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboard;1")); if (nsCOMPtr clipboardProxy = do_QueryInterface(clipboard)) { - clipboardProxy->SetCapabilities(clipboardCaps); + clipboardProxy->SetCapabilities(aXPCOMInit.clipboardCaps()); } { @@ -1002,7 +1010,9 @@ ContentChild::InitXPCOM() } ErrorResult rv; JS::RootedValue data(jsapi.cx()); - initialData.Read(jsapi.cx(), &data, rv); + mozilla::dom::ipc::StructuredCloneData id; + id.Copy(aInitialData); + id.Read(jsapi.cx(), &data, rv); if (NS_WARN_IF(rv.Failed())) { MOZ_CRASH(); } @@ -1011,7 +1021,7 @@ ContentChild::InitXPCOM() } // The stylesheet cache is not ready yet. Store this URL for future use. - nsCOMPtr ucsURL = DeserializeURI(userContentSheetURL); + nsCOMPtr ucsURL = DeserializeURI(aXPCOMInit.userContentSheetURL()); nsLayoutStylesheetCache::SetUserContentCSSURL(ucsURL); // This will register cross-process observer. diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index c9e4153c2499..d712f5c8c165 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -96,9 +96,12 @@ public: bool Init(MessageLoop* aIOLoop, base::ProcessId aParentPid, - IPC::Channel* aChannel); + IPC::Channel* aChannel, + uint64_t aChildID, + bool aIsForBrowser); - void InitXPCOM(); + void InitXPCOM(const XPCOMInitData& aXPCOMInit, + const mozilla::dom::ipc::StructuredCloneData& aInitialData); void InitGraphicsDeviceData(); @@ -573,6 +576,11 @@ public: const bool& minimizeMemoryUsage, const MaybeFileDesc& DMDFile) override; + virtual mozilla::ipc::IPCResult + RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit, + const StructuredCloneData& aInitialData, + nsTArray&& aLookAndFeelIntCache) override; + #if defined(XP_WIN) && defined(ACCESSIBILITY) bool SendGetA11yContentId(); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 030d413fd003..7db9e85399f7 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -186,6 +186,8 @@ #include "nsLayoutStylesheetCache.h" +#include "ContentPrefs.h" + #ifdef MOZ_WEBRTC #include "signaling/src/peerconnection/WebrtcGlobalParent.h" #endif @@ -1824,6 +1826,48 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); std::vector extraArgs; + extraArgs.push_back("-childID"); + char idStr[21]; + SprintfLiteral(idStr, "%" PRId64, static_cast(mChildID)); + extraArgs.push_back(idStr); + extraArgs.push_back(IsForBrowser() ? "-isForBrowser" : "-notForBrowser"); + + std::stringstream boolPrefs; + std::stringstream intPrefs; + std::stringstream stringPrefs; + + size_t prefsLen; + ContentPrefs::GetContentPrefs(&prefsLen); + + for (unsigned int i = 0; i < prefsLen; i++) { + MOZ_ASSERT(i == 0 || strcmp(ContentPrefs::GetContentPref(i), ContentPrefs::GetContentPref(i - 1)) > 0); + switch (Preferences::GetType(ContentPrefs::GetContentPref(i))) { + case nsIPrefBranch::PREF_INT: + intPrefs << i << ':' << Preferences::GetInt(ContentPrefs::GetContentPref(i)) << '|'; + break; + case nsIPrefBranch::PREF_BOOL: + boolPrefs << i << ':' << Preferences::GetBool(ContentPrefs::GetContentPref(i)) << '|'; + break; + case nsIPrefBranch::PREF_STRING: { + std::string value(Preferences::GetCString(ContentPrefs::GetContentPref(i)).get()); + stringPrefs << i << ':' << value.length() << ':' << value << '|'; + } + break; + case nsIPrefBranch::PREF_INVALID: + break; + default: + printf("preference type: %x\n", Preferences::GetType(ContentPrefs::GetContentPref(i))); + MOZ_CRASH(); + } + } + + extraArgs.push_back("-intPrefs"); + extraArgs.push_back(intPrefs.str()); + extraArgs.push_back("-boolPrefs"); + extraArgs.push_back(boolPrefs.str()); + extraArgs.push_back("-stringPrefs"); + extraArgs.push_back(stringPrefs.str()); + if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) { MarkAsDead(); return false; @@ -1843,6 +1887,17 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR // Set a reply timeout for CPOWs. SetReplyTimeoutMs(Preferences::GetInt("dom.ipc.cpow.timeout", 0)); + Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS, + static_cast((TimeStamp::Now() - mLaunchTS) + .ToMilliseconds())); + + nsCOMPtr obs = mozilla::services::GetObserverService(); + if (obs) { + nsAutoString cpId; + cpId.AppendInt(static_cast(this->ChildID())); + obs->NotifyObservers(static_cast(this), "ipc:content-initializing", cpId.get()); + } + return true; } @@ -1900,6 +1955,90 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority, bool aSetupOffMainThreadCompositing, bool aSendRegisteredChrome) { + Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS, + static_cast((TimeStamp::Now() - mLaunchTS) + .ToMilliseconds())); + + XPCOMInitData xpcomInit; + + Preferences::GetPreferences(&xpcomInit.prefs()); + nsCOMPtr io(do_GetIOService()); + MOZ_ASSERT(io, "No IO service?"); + DebugOnly rv = io->GetOffline(&xpcomInit.isOffline()); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?"); + + rv = io->GetConnectivity(&xpcomInit.isConnected()); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?"); + + xpcomInit.captivePortalState() = nsICaptivePortalService::UNKNOWN; + nsCOMPtr cps = do_GetService(NS_CAPTIVEPORTAL_CONTRACTID); + if (cps) { + cps->GetState(&xpcomInit.captivePortalState()); + } + + nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard(); + + xpcomInit.isLangRTL() = false; + xpcomInit.haveBidiKeyboards() = false; + if (bidi) { + bidi->IsLangRTL(&xpcomInit.isLangRTL()); + bidi->GetHaveBidiKeyboards(&xpcomInit.haveBidiKeyboards()); + } + + nsCOMPtr spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID)); + MOZ_ASSERT(spellChecker, "No spell checker?"); + + spellChecker->GetDictionaryList(&xpcomInit.dictionaries()); + + nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboard;1")); + MOZ_ASSERT(clipboard, "No clipboard?"); + + rv = clipboard->SupportsSelectionClipboard(&xpcomInit.clipboardCaps().supportsSelectionClipboard()); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + + rv = clipboard->SupportsFindClipboard(&xpcomInit.clipboardCaps().supportsFindClipboard()); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + + // Let's copy the domain policy from the parent to the child (if it's active). + StructuredCloneData initialData; + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + if (ssm) { + ssm->CloneDomainPolicy(&xpcomInit.domainPolicy()); + + if (nsFrameMessageManager* mm = nsFrameMessageManager::sParentProcessManager) { + AutoJSAPI jsapi; + if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) { + MOZ_CRASH(); + } + JS::RootedValue init(jsapi.cx()); + nsresult result = mm->GetInitialProcessData(jsapi.cx(), &init); + if (NS_FAILED(result)) { + MOZ_CRASH(); + } + + ErrorResult rv; + initialData.Write(jsapi.cx(), init, rv); + if (NS_WARN_IF(rv.Failed())) { + rv.SuppressException(); + MOZ_CRASH(); + } + } + } + // This is only implemented (returns a non-empty list) by MacOSX at present. + gfxPlatform::GetPlatform()->GetSystemFontFamilyList(&xpcomInit.fontFamilies()); + nsTArray lnfCache = LookAndFeel::GetIntCache(); + + // Content processes have no permission to access profile directory, so we + // send the file URL instead. + StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet(); + if (ucs) { + SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL()); + } else { + SerializeURI(nullptr, xpcomInit.userContentSheetURL()); + } + + Unused << SendSetXPCOMProcessAttributes(xpcomInit, initialData, lnfCache); + if (aSendRegisteredChrome) { nsCOMPtr registrySvc = nsChromeRegistry::GetService(); nsChromeRegistryChrome* chromeRegistry = @@ -2071,13 +2210,6 @@ ContentParent::Pid() const return base::GetProcId(mSubprocess->GetChildProcessHandle()); } -mozilla::ipc::IPCResult -ContentParent::RecvReadPrefsArray(InfallibleTArray* aPrefs) -{ - Preferences::GetPreferences(aPrefs); - return IPC_OK(); -} - mozilla::ipc::IPCResult ContentParent::RecvGetGfxVars(InfallibleTArray* aVars) { @@ -2548,118 +2680,6 @@ ContentParent::RecvInitBackground(Endpoint&& aEndpoint) return IPC_OK(); } -mozilla::ipc::IPCResult -ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId, - bool* aIsForBrowser) -{ - *aCpId = mChildID; - *aIsForBrowser = mIsForBrowser; - - return IPC_OK(); -} - -mozilla::ipc::IPCResult -ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline, - bool* aIsConnected, - int32_t* aCaptivePortalState, - bool* aIsLangRTL, - bool* aHaveBidiKeyboards, - InfallibleTArray* dictionaries, - ClipboardCapabilities* clipboardCaps, - DomainPolicyClone* domainPolicy, - StructuredCloneData* aInitialData, - InfallibleTArray* fontFamilies, - OptionalURIParams* aUserContentCSSURL, - nsTArray* aLookAndFeelIntCache) -{ - Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS, - static_cast((TimeStamp::Now() - mLaunchTS) - .ToMilliseconds())); - - nsCOMPtr io(do_GetIOService()); - MOZ_ASSERT(io, "No IO service?"); - DebugOnly rv = io->GetOffline(aIsOffline); - MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?"); - - rv = io->GetConnectivity(aIsConnected); - MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?"); - - *aCaptivePortalState = nsICaptivePortalService::UNKNOWN; - nsCOMPtr cps = do_GetService(NS_CAPTIVEPORTAL_CONTRACTID); - if (cps) { - cps->GetState(aCaptivePortalState); - } - - nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard(); - - *aIsLangRTL = false; - *aHaveBidiKeyboards = false; - if (bidi) { - bidi->IsLangRTL(aIsLangRTL); - bidi->GetHaveBidiKeyboards(aHaveBidiKeyboards); - } - - nsCOMPtr spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID)); - MOZ_ASSERT(spellChecker, "No spell checker?"); - - spellChecker->GetDictionaryList(dictionaries); - - nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboard;1")); - MOZ_ASSERT(clipboard, "No clipboard?"); - - rv = clipboard->SupportsSelectionClipboard(&clipboardCaps->supportsSelectionClipboard()); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - rv = clipboard->SupportsFindClipboard(&clipboardCaps->supportsFindClipboard()); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - // Let's copy the domain policy from the parent to the child (if it's active). - nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); - NS_ENSURE_TRUE(ssm, IPC_OK()); - ssm->CloneDomainPolicy(domainPolicy); - - if (nsFrameMessageManager* mm = nsFrameMessageManager::sParentProcessManager) { - AutoJSAPI jsapi; - if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) { - return IPC_FAIL_NO_REASON(this); - } - JS::RootedValue init(jsapi.cx()); - nsresult result = mm->GetInitialProcessData(jsapi.cx(), &init); - if (NS_FAILED(result)) { - return IPC_FAIL_NO_REASON(this); - } - - ErrorResult rv; - aInitialData->Write(jsapi.cx(), init, rv); - if (NS_WARN_IF(rv.Failed())) { - rv.SuppressException(); - return IPC_FAIL_NO_REASON(this); - } - } - - // This is only implemented (returns a non-empty list) by MacOSX at present. - gfxPlatform::GetPlatform()->GetSystemFontFamilyList(fontFamilies); - *aLookAndFeelIntCache = LookAndFeel::GetIntCache(); - - // Content processes have no permission to access profile directory, so we - // send the file URL instead. - StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet(); - if (ucs) { - SerializeURI(ucs->GetSheetURI(), *aUserContentCSSURL); - } else { - SerializeURI(nullptr, *aUserContentCSSURL); - } - - nsCOMPtr obs = mozilla::services::GetObserverService(); - if (obs) { - nsAutoString cpId; - cpId.AppendInt(static_cast(this->ChildID())); - obs->NotifyObservers(static_cast(this), "ipc:content-initializing", cpId.get()); - } - - return IPC_OK(); -} - mozilla::jsipc::PJavaScriptParent * ContentParent::AllocPJavaScriptParent() { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index f0650a00c601..3c79fb559861 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -746,24 +746,6 @@ private: virtual mozilla::ipc::IPCResult RecvInitBackground(Endpoint&& aEndpoint) override; - virtual mozilla::ipc::IPCResult RecvGetProcessAttributes(ContentParentId* aCpId, - bool* aIsForBrowser) override; - - virtual mozilla::ipc::IPCResult - RecvGetXPCOMProcessAttributes(bool* aIsOffline, - bool* aIsConnected, - int32_t* aCaptivePortalState, - bool* aIsLangRTL, - bool* aHaveBidiKeyboards, - InfallibleTArray* dictionaries, - ClipboardCapabilities* clipboardCaps, - DomainPolicyClone* domainPolicy, - StructuredCloneData* initialData, - InfallibleTArray* fontFamilies, - OptionalURIParams* aUserContentSheetURL, - nsTArray* aLookAndFeelIntCache) override; - - mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport) override; mozilla::ipc::IPCResult RecvFinishMemoryReport(const uint32_t& aGeneration) override; @@ -898,7 +880,6 @@ private: virtual bool DeallocPWebBrowserPersistDocumentParent(PWebBrowserPersistDocumentParent* aActor) override; - virtual mozilla::ipc::IPCResult RecvReadPrefsArray(InfallibleTArray* aPrefs) override; virtual mozilla::ipc::IPCResult RecvGetGfxVars(InfallibleTArray* aVars) override; virtual mozilla::ipc::IPCResult RecvReadFontList(InfallibleTArray* retValue) override; diff --git a/dom/ipc/ContentPrefs.cpp b/dom/ipc/ContentPrefs.cpp new file mode 100644 index 000000000000..343fe98d03f5 --- /dev/null +++ b/dom/ipc/ContentPrefs.cpp @@ -0,0 +1,275 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "ContentPrefs.h" + +const char* mozilla::dom::ContentPrefs::gInitPrefs[] = { + "accessibility.monoaudio.enable", + "accessibility.mouse_focuses_formcontrol", + "accessibility.tabfocus_applies_to_xul", + "app.update.channel", + "browser.dom.window.dump.enabled", + "browser.sessionhistory.max_entries", + "browser.sessionhistory.max_total_viewers", + "content.cors.disable", + "content.cors.no_private_data", + "content.notify.backoffcount", + "content.notify.interval", + "content.notify.ontimer", + "content.sink.enable_perf_mode", + "content.sink.event_probe_rate", + "content.sink.initial_perf_time", + "content.sink.interactive_deflect_count", + "content.sink.interactive_parse_time", + "content.sink.interactive_time", + "content.sink.pending_event_mode", + "content.sink.perf_deflect_count", + "content.sink.perf_parse_time", + "device.storage.prompt.testing", + "device.storage.writable.name", + "dom.allow_XUL_XBL_for_file", + "dom.allow_cut_copy", + "dom.enable_frame_timing", + "dom.enable_performance", + "dom.enable_resource_timing", + "dom.event.handling-user-input-time-limit", + "dom.forms.autocomplete.experimental", + "dom.ipc.processPriorityManager.backgroundGracePeriodMS", + "dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS", + "dom.max_chrome_script_run_time", + "dom.max_script_run_time", + "dom.performance.enable_notify_performance_timing", + "dom.performance.enable_user_timing_logging", + "dom.storage.testing", + "dom.url.encode_decode_hash", + "dom.url.getters_decode_hash", + "dom.use_watchdog", + "dom.vibrator.enabled", + "dom.vibrator.max_vibrate_list_len", + "dom.vibrator.max_vibrate_ms", + "focusmanager.testmode", + "font.size.inflation.disabledInMasterProcess", + "font.size.inflation.emPerLine", + "font.size.inflation.forceEnabled", + "font.size.inflation.lineThreshold", + "font.size.inflation.mappingIntercept", + "font.size.inflation.maxRatio", + "font.size.inflation.minTwips", + "full-screen-api.allow-trusted-requests-only", + "full-screen-api.enabled", + "full-screen-api.unprefix.enabled", + "gfx.font_rendering.opentype_svg.enabled", + "hangmonitor.timeout", + "html5.flushtimer.initialdelay", + "html5.flushtimer.subsequentdelay", + "html5.offmainthread", + "intl.charset.fallback.tld", + "intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition", + "javascript.enabled", + "javascript.options.asmjs", + "javascript.options.asyncstack", + "javascript.options.baselinejit", + "javascript.options.baselinejit.threshold", + "javascript.options.baselinejit.unsafe_eager_compilation", + "javascript.options.discardSystemSource", + "javascript.options.dump_stack_on_debuggee_would_run", + "javascript.options.gczeal", + "javascript.options.gczeal.frequency", + "javascript.options.ion", + "javascript.options.ion.offthread_compilation", + "javascript.options.ion.threshold", + "javascript.options.ion.unsafe_eager_compilation", + "javascript.options.jit.full_debug_checks", + "javascript.options.native_regexp", + "javascript.options.parallel_parsing", + "javascript.options.shared_memory", + "javascript.options.strict", + "javascript.options.strict.debug", + "javascript.options.throw_on_asmjs_validation_failure", + "javascript.options.throw_on_debuggee_would_run", + "javascript.options.wasm", + "javascript.options.wasm_baselinejit", + "javascript.options.werror", + "javascript.use_us_english_locale", + "jsloader.reuseGlobal", + "layout.css.all-shorthand.enabled", + "layout.css.background-blend-mode.enabled", + "layout.css.background-clip-text.enabled", + "layout.css.box-decoration-break.enabled", + "layout.css.color-adjust.enabled", + "layout.css.contain.enabled", + "layout.css.control-characters.visible", + "layout.css.display-flow-root.enabled", + "layout.css.expensive-style-struct-assertions.enabled", + "layout.css.float-logical-values.enabled", + "layout.css.font-variations.enabled", + "layout.css.grid.enabled", + "layout.css.image-orientation.enabled", + "layout.css.initial-letter.enabled", + "layout.css.isolation.enabled", + "layout.css.mix-blend-mode.enabled", + "layout.css.object-fit-and-position.enabled", + "layout.css.osx-font-smoothing.enabled", + "layout.css.overflow-clip-box.enabled", + "layout.css.prefixes.animations", + "layout.css.prefixes.border-image", + "layout.css.prefixes.box-sizing", + "layout.css.prefixes.device-pixel-ratio-webkit", + "layout.css.prefixes.font-features", + "layout.css.prefixes.gradients", + "layout.css.prefixes.transforms", + "layout.css.prefixes.transitions", + "layout.css.prefixes.webkit", + "layout.css.scope-pseudo.enabled", + "layout.css.scroll-behavior.property-enabled", + "layout.css.scroll-snap.enabled", + "layout.css.shape-outside.enabled", + "layout.css.text-align-unsafe-value.enabled", + "layout.css.text-combine-upright-digits.enabled", + "layout.css.text-combine-upright.enabled", + "layout.css.touch_action.enabled", + "layout.css.unprefixing-service.enabled", + "layout.css.unprefixing-service.globally-whitelisted", + "layout.css.unprefixing-service.include-test-domains", + "layout.css.variables.enabled", + "layout.css.visited_links_enabled", + "layout.idle_period.required_quiescent_frames", + "layout.idle_period.time_limit", + "layout.interruptible-reflow.enabled", + "mathml.disabled", + "media.apple.forcevda", + "media.clearkey.persistent-license.enabled", + "media.cubeb_latency_msg_frames", + "media.cubeb_latency_playback_ms", + "media.decoder-doctor.wmf-disabled-is-failure", + "media.decoder.fuzzing.dont-delay-inputexhausted", + "media.decoder.fuzzing.enabled", + "media.decoder.fuzzing.video-output-minimum-interval-ms", + "media.decoder.limit", + "media.decoder.recycle.enabled", + "media.dormant-on-pause-timeout-ms", + "media.eme.audio.blank", + "media.eme.enabled", + "media.eme.video.blank", + "media.ffmpeg.enabled", + "media.ffvpx.enabled", + "media.flac.enabled", + "media.forcestereo.enabled", + "media.gmp.async-shutdown-timeout", + "media.gmp.decoder.aac", + "media.gmp.decoder.enabled", + "media.gmp.decoder.h264", + "media.gmp.insecure.allow", + "media.gpu-process-decoder", + "media.libavcodec.allow-obsolete", + "media.num-decode-threads", + "media.ogg.enabled", + "media.ogg.flac.enabled", + "media.resampling.enabled", + "media.resampling.rate", + "media.ruin-av-sync.enabled", + "media.rust.test_mode", + "media.suspend-bkgnd-video.delay-ms", + "media.suspend-bkgnd-video.enabled", + "media.use-blank-decoder", + "media.video_stats.enabled", + "media.volume_scale", + "media.webspeech.recognition.enable", + "media.webspeech.recognition.force_enable", + "media.webspeech.synth.force_global_queue", + "media.webspeech.test.enable", + "media.webspeech.test.fake_fsm_events", + "media.webspeech.test.fake_recognition_service", + "media.wmf.allow-unsupported-resolutions", + "media.wmf.decoder.thread-count", + "media.wmf.enabled", + "media.wmf.skip-blacklist", + "media.wmf.vp9.enabled", + "memory.free_dirty_pages", + "memory.low_commit_space_threshold_mb", + "memory.low_memory_notification_interval_ms", + "memory.low_physical_memory_threshold_mb", + "memory.low_virtual_mem_threshold_mb", + "network.IDN.blacklist_chars", + "network.IDN.restriction_profile", + "network.IDN.use_whitelist", + "network.IDN_show_punycode", + "network.buffer.cache.count", + "network.buffer.cache.size", + "network.captive-portal-service.enabled", + "network.cookie.cookieBehavior", + "network.cookie.lifetimePolicy", + "network.dns.disablePrefetch", + "network.dns.disablePrefetchFromHTTPS", + "network.jar.block-remote-files", + "network.loadinfo.skip_type_assertion", + "network.notify.changed", + "network.offline-mirrors-connectivity", + "network.protocol-handler.external.jar", + "network.proxy.type", + "network.security.ports.banned", + "network.security.ports.banned.override", + "network.standard-url.enable-rust", + "network.standard-url.max-length", + "network.sts.max_time_for_events_between_two_polls", + "network.sts.max_time_for_pr_close_during_shutdown", + "network.tcp.keepalive.enabled", + "network.tcp.keepalive.idle_time", + "network.tcp.keepalive.probe_count", + "network.tcp.keepalive.retry_interval", + "network.tcp.sendbuffer", + "nglayout.debug.invalidation", + "privacy.donottrackheader.enabled", + "privacy.firstparty.isolate", + "privacy.firstparty.isolate.restrict_opener_access", + "privacy.resistFingerprinting", + "security.data_uri.inherit_security_context", + "security.fileuri.strict_origin_policy", + "security.sandbox.content.level", + "security.sandbox.content.tempDirSuffix", + "security.sandbox.logging.enabled", + "security.sandbox.mac.track.violations", + "security.sandbox.windows.log", + "security.sandbox.windows.log.stackTraceDepth", + "shutdown.watchdog.timeoutSecs", + "signed.applets.codebase_principal_support", + "svg.disabled", + "svg.display-lists.hit-testing.enabled", + "svg.display-lists.painting.enabled", + "svg.new-getBBox.enabled", + "svg.paint-order.enabled", + "svg.path-caching.enabled", + "svg.transform-box.enabled", + "toolkit.asyncshutdown.crash_timeout", + "toolkit.asyncshutdown.log", + "toolkit.osfile.log", + "toolkit.osfile.log.redirect", + "toolkit.telemetry.enabled", + "toolkit.telemetry.idleTimeout", + "toolkit.telemetry.initDelay", + "toolkit.telemetry.log.dump", + "toolkit.telemetry.log.level", + "toolkit.telemetry.minSubsessionLength", + "toolkit.telemetry.scheduler.idleTickInterval", + "toolkit.telemetry.scheduler.tickInterval", + "toolkit.telemetry.unified", + "ui.key.menuAccessKeyFocuses", + "ui.popup.disable_autohide", + "ui.use_activity_cursor", + "view_source.editor.external"}; + +const char** mozilla::dom::ContentPrefs::GetContentPrefs(size_t* aCount) +{ + *aCount = ArrayLength(ContentPrefs::gInitPrefs); + return gInitPrefs; +} + +const char* mozilla::dom::ContentPrefs::GetContentPref(size_t aIndex) +{ + MOZ_ASSERT(aIndex < ArrayLength(ContentPrefs::gInitPrefs)); + return gInitPrefs[aIndex]; +} + diff --git a/dom/ipc/ContentPrefs.h b/dom/ipc/ContentPrefs.h new file mode 100644 index 000000000000..f85d4b5cbad5 --- /dev/null +++ b/dom/ipc/ContentPrefs.h @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_ContentPrefs_h +#define mozilla_dom_ContentPrefs_h + +namespace mozilla { +namespace dom { + +class ContentPrefs { +public: + static const char** GetContentPrefs(size_t* aCount); + static const char* GetContentPref(size_t aIndex); + +private: + static const char* gInitPrefs[]; +}; + +} +} + +#endif diff --git a/dom/ipc/ContentProcess.cpp b/dom/ipc/ContentProcess.cpp index 2413d88087e5..394e7f1deff8 100644 --- a/dom/ipc/ContentProcess.cpp +++ b/dom/ipc/ContentProcess.cpp @@ -7,6 +7,7 @@ #include "mozilla/ipc/IOThreadChild.h" #include "ContentProcess.h" +#include "ContentPrefs.h" #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) #include @@ -103,46 +104,143 @@ SetUpSandboxEnvironment() } #endif -void -ContentProcess::SetAppDir(const nsACString& aPath) +bool +ContentProcess::Init(int aArgc, char* aArgv[]) { - mXREEmbed.SetAppDir(aPath); -} + // If passed in grab the application path for xpcom init + bool foundAppdir = false; + bool foundChildID = false; + bool foundIsForBrowser = false; + bool foundIntPrefs = false; + bool foundBoolPrefs = false; + bool foundStringPrefs = false; + + uint64_t childID; + bool isForBrowser; #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) -void -ContentProcess::SetProfile(const nsACString& aProfile) -{ - bool flag; - nsresult rv = - XRE_GetFileFromPath(aProfile.BeginReading(), getter_AddRefs(mProfileDir)); - if (NS_FAILED(rv) || - NS_FAILED(mProfileDir->Exists(&flag)) || !flag) { - NS_WARNING("Invalid profile directory passed to content process."); - mProfileDir = nullptr; - } -} + // If passed in grab the profile path for sandboxing + bool foundProfile = false; + nsCOMPtr profileDir; #endif -bool -ContentProcess::Init() -{ - mContent.Init(IOThreadChild::message_loop(), - ParentPid(), - IOThreadChild::channel()); - mXREEmbed.Start(); - mContent.InitXPCOM(); - mContent.InitGraphicsDeviceData(); + InfallibleTArray prefsArray; + for (int idx = aArgc; idx > 0; idx--) { + if (!aArgv[idx]) { + continue; + } + if (!strcmp(aArgv[idx], "-appdir")) { + MOZ_ASSERT(!foundAppdir); + if (foundAppdir) { + continue; + } + nsCString appDir; + appDir.Assign(nsDependentCString(aArgv[idx+1])); + mXREEmbed.SetAppDir(appDir); + foundAppdir = true; + } else if (!strcmp(aArgv[idx], "-childID")) { + MOZ_ASSERT(!foundChildID); + if (foundChildID) { + continue; + } + if (idx + 1 < aArgc) { + childID = strtoull(aArgv[idx + 1], nullptr, 10); + foundChildID = true; + } + } else if (!strcmp(aArgv[idx], "-isForBrowser") || !strcmp(aArgv[idx], "-notForBrowser")) { + MOZ_ASSERT(!foundIsForBrowser); + if (foundIsForBrowser) { + continue; + } + isForBrowser = strcmp(aArgv[idx], "-notForBrowser"); + foundIsForBrowser = true; + } else if (!strcmp(aArgv[idx], "-intPrefs")) { + SET_PREF_PHASE(BEGIN_INIT_PREFS); + char* str = aArgv[idx + 1]; + while (*str) { + int32_t index = strtol(str, &str, 10); + str++; + MaybePrefValue value(PrefValue(static_cast(strtol(str, &str, 10)))); + str++; + PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue()); + prefsArray.AppendElement(pref); + } + SET_PREF_PHASE(END_INIT_PREFS); + foundIntPrefs = true; + } else if (!strcmp(aArgv[idx], "-boolPrefs")) { + SET_PREF_PHASE(BEGIN_INIT_PREFS); + char* str = aArgv[idx + 1]; + while (*str) { + int32_t index = strtol(str, &str, 10); + str++; + MaybePrefValue value(PrefValue(!!strtol(str, &str, 10))); + str++; + PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue()); + prefsArray.AppendElement(pref); + } + SET_PREF_PHASE(END_INIT_PREFS); + foundBoolPrefs = true; + } else if (!strcmp(aArgv[idx], "-stringPrefs")) { + SET_PREF_PHASE(BEGIN_INIT_PREFS); + char* str = aArgv[idx + 1]; + while (*str) { + int32_t index = strtol(str, &str, 10); + str++; + int32_t length = strtol(str, &str, 10); + str++; + MaybePrefValue value(PrefValue(nsCString(str, length))); + PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue()); + prefsArray.AppendElement(pref); + str += length + 1; + } + SET_PREF_PHASE(END_INIT_PREFS); + foundStringPrefs = true; + } + +#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) + else if (!strcmp(aArgv[idx], "-profile")) { + MOZ_ASSERT(!foundProfile); + if (foundProfile) { + continue; + } + bool flag; + nsresult rv = XRE_GetFileFromPath(aArgv[idx+1], getter_AddRefs(profileDir)); + if (NS_FAILED(rv) || + NS_FAILED(profileDir->Exists(&flag)) || !flag) { + NS_WARNING("Invalid profile directory passed to content process."); + profileDir = nullptr; + } + foundProfile = true; + } +#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */ + + bool allFound = foundAppdir && foundChildID && foundIsForBrowser && foundIntPrefs && foundBoolPrefs && foundStringPrefs; + +#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) + allFound &= foundProfile; +#endif + + if (allFound) { + break; + } + } + Preferences::SetInitPreferences(&prefsArray); + mContent.Init(IOThreadChild::message_loop(), + ParentPid(), + IOThreadChild::channel(), + childID, + isForBrowser); + mXREEmbed.Start(); #if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - mContent.SetProfileDir(mProfileDir); + mContent.SetProfileDir(profileDir); #endif #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - SetUpSandboxEnvironment(); + SetUpSandboxEnvironment(); #endif - return true; + return true; } // Note: CleanUp() never gets called in non-debug builds because we exit early @@ -150,7 +248,7 @@ ContentProcess::Init() void ContentProcess::CleanUp() { - mXREEmbed.Stop(); + mXREEmbed.Stop(); } } // namespace dom diff --git a/dom/ipc/ContentProcess.h b/dom/ipc/ContentProcess.h index bf9968f8cad9..a3854c761e10 100644 --- a/dom/ipc/ContentProcess.h +++ b/dom/ipc/ContentProcess.h @@ -34,23 +34,13 @@ public: ~ContentProcess() { } - virtual bool Init() override; + virtual bool Init(int aArgc, char* aArgv[]) override; virtual void CleanUp() override; - void SetAppDir(const nsACString& aPath); - -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - void SetProfile(const nsACString& aProfile); -#endif - private: ContentChild mContent; mozilla::ipc::ScopedXREEmbed mXREEmbed; -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - nsCOMPtr mProfileDir; -#endif - #if defined(XP_WIN) // This object initializes and configures COM. mozilla::mscom::MainThreadRuntime mCOMRuntime; diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index eead95c2fa64..71f382b4fb7b 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -334,6 +334,22 @@ struct GMPCapabilityData GMPAPITags[] capabilities; }; +struct XPCOMInitData +{ + bool isOffline; + bool isConnected; + int32_t captivePortalState; + bool isLangRTL; + bool haveBidiKeyboards; + nsString[] dictionaries; + ClipboardCapabilities clipboardCaps; + DomainPolicyClone domainPolicy; + /* used on MacOSX only */ + FontFamilyListEntry[] fontFamilies; + OptionalURIParams userContentSheetURL; + PrefSetting[] prefs; +}; + struct GfxInfoFeatureStatus { int32_t feature; @@ -527,6 +543,8 @@ child: */ async InitBlobURLs(BlobURLRegistrationData[] registrations); + async SetXPCOMProcessAttributes(XPCOMInitData xpcomInit, StructuredCloneData initialData, LookAndFeelInt[] lookAndFeelIntCache); + // Notify child that last-pb-context-exited notification was observed async LastPrivateDocShellDestroyed(); @@ -650,30 +668,6 @@ child: parent: async InitBackground(Endpoint aEndpoint); - /** - * Tell the content process some attributes of itself. This is - * among the first information queried by content processes after - * startup. (The message is sync to allow the content process to - * control when it receives the information.) - * - * |id| is a unique ID among all subprocesses. When - * |isForBrowser|, we're loading or . - * - * Keep the return values in sync with PBrowser()! - */ - sync GetProcessAttributes() - returns (ContentParentId cpId, bool isForBrowser); - sync GetXPCOMProcessAttributes() - returns (bool isOffline, bool isConnected, int32_t captivePortalState, - bool isLangRTL, - bool haveBidiKeyboards, nsString[] dictionaries, - ClipboardCapabilities clipboardCaps, - DomainPolicyClone domainPolicy, - StructuredCloneData initialData, - FontFamilyListEntry[] fontFamilies /* used on MacOSX only */, - OptionalURIParams userContentSheetURL, - LookAndFeelInt[] lookAndFeelIntCache); - sync CreateChildProcess(IPCTabContext context, ProcessPriority priority, TabId openerTabId) @@ -817,7 +811,6 @@ parent: async ExtProtocolChannelConnectParent(uint32_t registrarId); // PrefService message - sync ReadPrefsArray() returns (PrefSetting[] prefs) verify; sync GetGfxVars() returns (GfxVarUpdate[] vars); sync ReadFontList() returns (FontListEntry[] retValue); diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index debd5cd2e25f..a72655e9dd10 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -119,6 +119,8 @@ #include "GroupedSHistory.h" #include "nsIHttpChannel.h" #include "mozilla/dom/DocGroup.h" +#include "nsISupportsPrimitives.h" +#include "mozilla/Telemetry.h" #ifdef NS_PRINTING #include "nsIPrintSession.h" diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 452e1fe45166..e84887ea40a8 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -20,6 +20,7 @@ EXPORTS.mozilla.dom += [ 'ContentBridgeParent.h', 'ContentChild.h', 'ContentParent.h', + 'ContentPrefs.h', 'ContentProcess.h', 'ContentProcessManager.h', 'CPOWManagerGetter.h', @@ -50,6 +51,7 @@ UNIFIED_SOURCES += [ 'ContentBridgeChild.cpp', 'ContentBridgeParent.cpp', 'ContentParent.cpp', + 'ContentPrefs.cpp', 'ContentProcess.cpp', 'ContentProcessManager.cpp', 'CrashReporterParent.cpp', diff --git a/dom/media/gmp/GMPProcessChild.cpp b/dom/media/gmp/GMPProcessChild.cpp index d1ada706a7dd..d56339bc1018 100644 --- a/dom/media/gmp/GMPProcessChild.cpp +++ b/dom/media/gmp/GMPProcessChild.cpp @@ -25,7 +25,7 @@ GMPProcessChild::~GMPProcessChild() } bool -GMPProcessChild::Init() +GMPProcessChild::Init(int aArgc, char* aArgv[]) { nsAutoString pluginFilename; diff --git a/dom/media/gmp/GMPProcessChild.h b/dom/media/gmp/GMPProcessChild.h index c2c8be9e2ebc..382882e18a31 100644 --- a/dom/media/gmp/GMPProcessChild.h +++ b/dom/media/gmp/GMPProcessChild.h @@ -22,7 +22,7 @@ public: explicit GMPProcessChild(ProcessId aParentPid); ~GMPProcessChild(); - bool Init() override; + bool Init(int aArgc, char* aArgv[]) override; void CleanUp() override; private: diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp index eb698e8af5cf..5b0a2beecdea 100644 --- a/dom/plugins/ipc/PluginProcessChild.cpp +++ b/dom/plugins/ipc/PluginProcessChild.cpp @@ -40,7 +40,7 @@ namespace plugins { bool -PluginProcessChild::Init() +PluginProcessChild::Init(int aArgc, char* aArgv[]) { nsDebugImpl::SetMultiprocessMode("NPAPI"); diff --git a/dom/plugins/ipc/PluginProcessChild.h b/dom/plugins/ipc/PluginProcessChild.h index 75c842a1bfda..fd0a328bc703 100644 --- a/dom/plugins/ipc/PluginProcessChild.h +++ b/dom/plugins/ipc/PluginProcessChild.h @@ -30,7 +30,7 @@ public: virtual ~PluginProcessChild() { } - virtual bool Init() override; + virtual bool Init(int aArgc, char* aArgv[]) override; virtual void CleanUp() override; protected: diff --git a/gfx/ipc/GPUProcessImpl.cpp b/gfx/ipc/GPUProcessImpl.cpp index 38d13484b3e7..f7c4c80daafe 100644 --- a/gfx/ipc/GPUProcessImpl.cpp +++ b/gfx/ipc/GPUProcessImpl.cpp @@ -22,7 +22,7 @@ GPUProcessImpl::~GPUProcessImpl() } bool -GPUProcessImpl::Init() +GPUProcessImpl::Init(int aArgc, char* aArgv[]) { return mGPU.Init(ParentPid(), IOThreadChild::message_loop(), diff --git a/gfx/ipc/GPUProcessImpl.h b/gfx/ipc/GPUProcessImpl.h index 5e8b6694a6c6..fc7ff8ca3a6e 100644 --- a/gfx/ipc/GPUProcessImpl.h +++ b/gfx/ipc/GPUProcessImpl.h @@ -24,7 +24,7 @@ public: explicit GPUProcessImpl(ProcessId aParentPid); ~GPUProcessImpl(); - bool Init() override; + bool Init(int aArgc, char* aArgv[]) override; void CleanUp() override; private: diff --git a/ipc/glue/ProcessChild.h b/ipc/glue/ProcessChild.h index 4d1d3865902a..65d62bae8fba 100644 --- a/ipc/glue/ProcessChild.h +++ b/ipc/glue/ProcessChild.h @@ -27,7 +27,7 @@ public: explicit ProcessChild(ProcessId aParentPid); virtual ~ProcessChild(); - virtual bool Init() = 0; + virtual bool Init(int aArgc, char* aArgv[]) = 0; virtual void CleanUp() { } diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index f36819236f47..b1f86b9e0f62 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/MemoryReporting.h" -#include "mozilla/dom/ContentChild.h" +#include "mozilla/dom/PContent.h" #include "mozilla/ArrayUtils.h" #include "mozilla/Attributes.h" @@ -546,6 +546,14 @@ NS_INTERFACE_MAP_END * nsIPrefService Implementation */ +InfallibleTArray* gInitPrefs; + +/*static*/ +void +Preferences::SetInitPreferences(nsTArray* aPrefs) { + gInitPrefs = new InfallibleTArray(mozilla::Move(*aPrefs)); +} + nsresult Preferences::Init() { @@ -557,15 +565,13 @@ Preferences::Init() rv = pref_InitInitialObjects(); NS_ENSURE_SUCCESS(rv, rv); - using mozilla::dom::ContentChild; if (XRE_IsContentProcess()) { - InfallibleTArray prefs; - ContentChild::GetSingleton()->SendReadPrefsArray(&prefs); - - // Store the array - for (uint32_t i = 0; i < prefs.Length(); ++i) { - pref_SetPref(prefs[i]); + MOZ_ASSERT(gInitPrefs); + for (unsigned int i = 0; i < gInitPrefs->Length(); i++) { + Preferences::SetPreference(gInitPrefs->ElementAt(i)); } + delete gInitPrefs; + gInitPrefs = nullptr; return NS_OK; } @@ -780,6 +786,14 @@ Preferences::GetPreferences(InfallibleTArray* aPrefs) } } +#ifdef DEBUG +void +Preferences::SetInitPhase(pref_initPhase phase) +{ + pref_SetInitPhase(phase); +} +#endif + NS_IMETHODIMP Preferences::GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { diff --git a/modules/libpref/Preferences.h b/modules/libpref/Preferences.h index 255d2a8d2f29..8b0daef13b46 100644 --- a/modules/libpref/Preferences.h +++ b/modules/libpref/Preferences.h @@ -28,6 +28,20 @@ typedef void (*PrefChangedFunc)(const char *, void *); #define have_PrefChangedFunc_typedef #endif +#ifdef DEBUG +enum pref_initPhase { + START, + BEGIN_INIT_PREFS, + END_INIT_PREFS, + BEGIN_ALL_PREFS, + END_ALL_PREFS +}; + +#define SET_PREF_PHASE(p) Preferences::SetInitPhase(p) +#else +#define SET_PREF_PHASE(p) do { } while (0) +#endif + namespace mozilla { namespace dom { @@ -366,6 +380,12 @@ public: static void GetPreference(PrefSetting* aPref); static void SetPreference(const PrefSetting& aPref); + static void SetInitPreferences(nsTArray* aPrefs); + +#ifdef DEBUG + static void SetInitPhase(pref_initPhase phase); +#endif + static int64_t SizeOfIncludingThisAndOtherStuff(mozilla::MallocSizeOf aMallocSizeOf); static void DirtyCallback(); diff --git a/modules/libpref/prefapi.cpp b/modules/libpref/prefapi.cpp index 046a6941903d..a42c83d343bf 100644 --- a/modules/libpref/prefapi.cpp +++ b/modules/libpref/prefapi.cpp @@ -29,6 +29,7 @@ #include "prprf.h" #include "mozilla/MemoryReporting.h" #include "mozilla/dom/PContent.h" +#include "mozilla/dom/ContentPrefs.h" #include "nsQuickSort.h" #include "nsString.h" #include "nsPrintfCString.h" @@ -736,13 +737,48 @@ static PrefTypeFlags pref_SetValue(PrefValue* existingValue, PrefTypeFlags flags } return flags; } +#ifdef DEBUG +static pref_initPhase gPhase = START; + +void +pref_SetInitPhase(pref_initPhase phase) +{ + gPhase = phase; +} + +struct StringComparator +{ + const char* mKey; + explicit StringComparator(const char* aKey) : mKey(aKey) {} + int operator()(const char* string) const { + return strcmp(mKey, string); + } +}; + +bool +inInitArray(const char* key) +{ + size_t prefsLen; + size_t found; + const char** list = mozilla::dom::ContentPrefs::GetContentPrefs(&prefsLen); + return BinarySearchIf(list, 0, prefsLen, + StringComparator(key), &found); +} +#endif PrefHashEntry* pref_HashTableLookup(const char *key) { #ifndef MOZ_B2G MOZ_ASSERT(NS_IsMainThread()); #endif - + MOZ_ASSERT((!XRE_IsContentProcess() || gPhase != START), + "pref access before commandline prefs set"); + /* If you're hitting this assertion, you've added a pref access to start up. + * Consider moving it later or add it to the whitelist in ContentPrefs.cpp + * and get review from a DOM peer + */ + MOZ_ASSERT((!XRE_IsContentProcess() || gPhase > END_INIT_PREFS || inInitArray(key)), + "accessing non-init pref before the rest of the prefs are sent"); return static_cast(gHashTable->Search(key)); } diff --git a/modules/libpref/prefapi_private_data.h b/modules/libpref/prefapi_private_data.h index f1fa68fdc45e..4cf58f6a9f85 100644 --- a/modules/libpref/prefapi_private_data.h +++ b/modules/libpref/prefapi_private_data.h @@ -10,6 +10,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/UniquePtr.h" +#include "Preferences.h" extern PLDHashTable* gHashTable; @@ -25,6 +26,11 @@ pref_savePrefs(PLDHashTable* aTable, uint32_t* aPrefCount); nsresult pref_SetPref(const mozilla::dom::PrefSetting& aPref); +#ifdef DEBUG +void +pref_SetInitPhase(pref_initPhase phase); +#endif + int pref_CompareStrings(const void *v1, const void *v2, void* unused); PrefHashEntry* pref_HashTableLookup(const char *key); diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 89584b5621ad..4649a41525f8 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -625,49 +625,8 @@ XRE_InitChildProcess(int aArgc, process = new PluginProcessChild(parentPID); break; - case GeckoProcessType_Content: { - process = new ContentProcess(parentPID); - // If passed in grab the application path for xpcom init - bool foundAppdir = false; - -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - // If passed in grab the profile path for sandboxing - bool foundProfile = false; -#endif - - for (int idx = aArgc; idx > 0; idx--) { - if (aArgv[idx] && !strcmp(aArgv[idx], "-appdir")) { - MOZ_ASSERT(!foundAppdir); - if (foundAppdir) { - continue; - } - nsCString appDir; - appDir.Assign(nsDependentCString(aArgv[idx+1])); - static_cast(process.get())->SetAppDir(appDir); - foundAppdir = true; - } - -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - if (aArgv[idx] && !strcmp(aArgv[idx], "-profile")) { - MOZ_ASSERT(!foundProfile); - if (foundProfile) { - continue; - } - nsCString profile; - profile.Assign(nsDependentCString(aArgv[idx+1])); - static_cast(process.get())->SetProfile(profile); - foundProfile = true; - } - if (foundProfile && foundAppdir) { - break; - } -#else - if (foundAppdir) { - break; - } -#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */ - } - } + case GeckoProcessType_Content: + process = new ContentProcess(parentPID); break; case GeckoProcessType_IPDLUnitTest: @@ -690,7 +649,7 @@ XRE_InitChildProcess(int aArgc, MOZ_CRASH("Unknown main thread class"); } - if (!process->Init()) { + if (!process->Init(aArgc, aArgv)) { return NS_ERROR_FAILURE; } From 995c71cd9778d961b0398ed29bb4ca20c254b8fe Mon Sep 17 00:00:00 2001 From: Aakar Dwivedi Date: Sun, 5 Feb 2017 08:17:45 +0100 Subject: [PATCH 39/70] Bug 1334989 - Parameter in the declaration of the function made same as the one in definition of the function; r=janv --- dom/indexedDB/ActorsParent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 3059ac6e49fb..ece430e06f57 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -5134,7 +5134,7 @@ public: ~AutoSavepoint(); nsresult - Start(const TransactionBase* aConnection); + Start(const TransactionBase* aTransaction); nsresult Commit(); From a609ae147a391ff424f92f856df57b890368c57c Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Sun, 5 Feb 2017 08:41:33 +0100 Subject: [PATCH 40/70] Bug 1334933 - Randomize mmap address for executable code on posix platforms. r=luke --- js/src/jit/ProcessExecutableMemory.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/js/src/jit/ProcessExecutableMemory.cpp b/js/src/jit/ProcessExecutableMemory.cpp index 8096fb56ea42..8075a9488dd2 100644 --- a/js/src/jit/ProcessExecutableMemory.cpp +++ b/js/src/jit/ProcessExecutableMemory.cpp @@ -256,11 +256,29 @@ DecommitPages(void* addr, size_t bytes) MOZ_CRASH("DecommitPages failed"); } #else // !XP_WIN +static void* +ComputeRandomAllocationAddress() +{ + // Return a random, page-aligned address. x64 CPUs have a 48-bit address + // space and on some platforms the OS will give us access to 47 bits, so + // to be safe we right shift by 18 to leave 46 bits. + + uint64_t rand = js::GenerateRandomSeed(); +# ifdef HAVE_64BIT_BUILD + rand >>= 18; +# endif + uintptr_t mask = ~uintptr_t(gc::SystemPageSize() - 1); + return (void*) uintptr_t(rand & mask); +} + static void* ReserveProcessExecutableMemory(size_t bytes) { - void* p = MozTaggedAnonymousMmap(nullptr, bytes, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0, - "js-executable-memory"); + // Note that randomAddr is just a hint: if the address is not available + // mmap will pick a different address. + void* randomAddr = ComputeRandomAllocationAddress(); + void* p = MozTaggedAnonymousMmap(randomAddr, bytes, PROT_NONE, MAP_PRIVATE | MAP_ANON, + -1, 0, "js-executable-memory"); if (p == MAP_FAILED) return nullptr; return p; From 122ebc553b5beae884b9a20eea11c4f581c34961 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Sun, 5 Feb 2017 10:26:28 +0100 Subject: [PATCH 41/70] Backed out changeset e9d8a75a0dcc (bug 1303096) for failing various tests on Android 4.3 debug (e.g. test_saveHeapSnapshot_e10s_01.html). r=backout --- caps/DomainPolicy.cpp | 2 +- caps/nsIDomainPolicy.idl | 3 +- dom/ipc/ContentChild.cpp | 62 +++--- dom/ipc/ContentChild.h | 12 +- dom/ipc/ContentParent.cpp | 258 +++++++++++------------ dom/ipc/ContentParent.h | 19 ++ dom/ipc/ContentPrefs.cpp | 275 ------------------------- dom/ipc/ContentPrefs.h | 25 --- dom/ipc/ContentProcess.cpp | 160 +++----------- dom/ipc/ContentProcess.h | 12 +- dom/ipc/PContent.ipdl | 43 ++-- dom/ipc/TabChild.cpp | 2 - dom/ipc/moz.build | 2 - dom/media/gmp/GMPProcessChild.cpp | 2 +- dom/media/gmp/GMPProcessChild.h | 2 +- dom/plugins/ipc/PluginProcessChild.cpp | 2 +- dom/plugins/ipc/PluginProcessChild.h | 2 +- gfx/ipc/GPUProcessImpl.cpp | 2 +- gfx/ipc/GPUProcessImpl.h | 2 +- ipc/glue/ProcessChild.h | 2 +- modules/libpref/Preferences.cpp | 30 +-- modules/libpref/Preferences.h | 20 -- modules/libpref/prefapi.cpp | 38 +--- modules/libpref/prefapi_private_data.h | 6 - toolkit/xre/nsEmbedFunctions.cpp | 47 ++++- 25 files changed, 295 insertions(+), 735 deletions(-) delete mode 100644 dom/ipc/ContentPrefs.cpp delete mode 100644 dom/ipc/ContentPrefs.h diff --git a/caps/DomainPolicy.cpp b/caps/DomainPolicy.cpp index 2dcec2abe4b3..16029a2bdfdc 100644 --- a/caps/DomainPolicy.cpp +++ b/caps/DomainPolicy.cpp @@ -139,7 +139,7 @@ CopyURIs(const InfallibleTArray& aDomains, nsIDomainSet* aSet) } void -DomainPolicy::ApplyClone(const DomainPolicyClone* aClone) +DomainPolicy::ApplyClone(DomainPolicyClone* aClone) { CopyURIs(aClone->blacklist(), mBlacklist); CopyURIs(aClone->whitelist(), mWhitelist); diff --git a/caps/nsIDomainPolicy.idl b/caps/nsIDomainPolicy.idl index 3fd4020a60d0..54b0de4dbf98 100644 --- a/caps/nsIDomainPolicy.idl +++ b/caps/nsIDomainPolicy.idl @@ -17,7 +17,6 @@ class DomainPolicyClone; %} [ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone); -[ptr] native DomainPolicyCloneConstPtr(const mozilla::dom::DomainPolicyClone); /* * When a domain policy is instantiated by invoking activateDomainPolicy() on @@ -42,7 +41,7 @@ interface nsIDomainPolicy : nsISupports void deactivate(); [noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone); - [noscript, notxpcom] void applyClone(in DomainPolicyCloneConstPtr aClone); + [noscript, notxpcom] void applyClone(in DomainPolicyClonePtr aClone); }; [scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)] diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index e271e10bb2cc..aee51eeee77a 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -502,24 +502,10 @@ NS_INTERFACE_MAP_BEGIN(ContentChild) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentChild) NS_INTERFACE_MAP_END - -mozilla::ipc::IPCResult -ContentChild::RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit, - const StructuredCloneData& aInitialData, - nsTArray&& aLookAndFeelIntCache) -{ - mLookAndFeelCache = aLookAndFeelIntCache; - InitXPCOM(aXPCOMInit, aInitialData); - InitGraphicsDeviceData(); - return IPC_OK(); -} - bool ContentChild::Init(MessageLoop* aIOLoop, base::ProcessId aParentPid, - IPC::Channel* aChannel, - uint64_t aChildID, - bool aIsForBrowser) + IPC::Channel* aChannel) { #ifdef MOZ_WIDGET_GTK // We need to pass a display down to gtk_init because it's not going to @@ -585,8 +571,7 @@ ContentChild::Init(MessageLoop* aIOLoop, XRE_GetProcessType()); #endif - mID = aChildID; - mIsForBrowser = aIsForBrowser; + SendGetProcessAttributes(&mID, &mIsForBrowser); #ifdef NS_PRINTING // Force the creation of the nsPrintingProxy so that it's IPC counterpart, @@ -948,14 +933,8 @@ ContentChild::InitGraphicsDeviceData() } void -ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit, - const mozilla::dom::ipc::StructuredCloneData& aInitialData) +ContentChild::InitXPCOM() { - SET_PREF_PHASE(pref_initPhase::BEGIN_ALL_PREFS); - for (unsigned int i = 0; i < aXPCOMInit.prefs().Length(); i++) { - Preferences::SetPreference(aXPCOMInit.prefs().ElementAt(i)); - } - SET_PREF_PHASE(pref_initPhase::END_ALL_PREFS); // Do this as early as possible to get the parent process to initialize the // background thread since we'll likely need database information very soon. BackgroundChild::Startup(); @@ -978,29 +957,42 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit, if (NS_FAILED(svc->RegisterListener(mConsoleListener))) NS_WARNING("Couldn't register console listener for child process"); - mAvailableDictionaries = aXPCOMInit.dictionaries(); + bool isOffline, isLangRTL, haveBidiKeyboards; + bool isConnected; + int32_t captivePortalState; + ClipboardCapabilities clipboardCaps; + DomainPolicyClone domainPolicy; + StructuredCloneData initialData; + OptionalURIParams userContentSheetURL; - RecvSetOffline(aXPCOMInit.isOffline()); - RecvSetConnectivity(aXPCOMInit.isConnected()); - RecvSetCaptivePortalState(aXPCOMInit.captivePortalState()); - RecvBidiKeyboardNotify(aXPCOMInit.isLangRTL(), aXPCOMInit.haveBidiKeyboards()); + SendGetXPCOMProcessAttributes(&isOffline, &isConnected, &captivePortalState, + &isLangRTL, &haveBidiKeyboards, + &mAvailableDictionaries, + &clipboardCaps, &domainPolicy, &initialData, + &mFontFamilies, &userContentSheetURL, + &mLookAndFeelCache); + + RecvSetOffline(isOffline); + RecvSetConnectivity(isConnected); + RecvSetCaptivePortalState(captivePortalState); + RecvBidiKeyboardNotify(isLangRTL, haveBidiKeyboards); // Create the CPOW manager as soon as possible. SendPJavaScriptConstructor(); - if (aXPCOMInit.domainPolicy().active()) { + if (domainPolicy.active()) { nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); MOZ_ASSERT(ssm); ssm->ActivateDomainPolicyInternal(getter_AddRefs(mPolicy)); if (!mPolicy) { MOZ_CRASH("Failed to activate domain policy."); } - mPolicy->ApplyClone(&aXPCOMInit.domainPolicy()); + mPolicy->ApplyClone(&domainPolicy); } nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboard;1")); if (nsCOMPtr clipboardProxy = do_QueryInterface(clipboard)) { - clipboardProxy->SetCapabilities(aXPCOMInit.clipboardCaps()); + clipboardProxy->SetCapabilities(clipboardCaps); } { @@ -1010,9 +1002,7 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit, } ErrorResult rv; JS::RootedValue data(jsapi.cx()); - mozilla::dom::ipc::StructuredCloneData id; - id.Copy(aInitialData); - id.Read(jsapi.cx(), &data, rv); + initialData.Read(jsapi.cx(), &data, rv); if (NS_WARN_IF(rv.Failed())) { MOZ_CRASH(); } @@ -1021,7 +1011,7 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit, } // The stylesheet cache is not ready yet. Store this URL for future use. - nsCOMPtr ucsURL = DeserializeURI(aXPCOMInit.userContentSheetURL()); + nsCOMPtr ucsURL = DeserializeURI(userContentSheetURL); nsLayoutStylesheetCache::SetUserContentCSSURL(ucsURL); // This will register cross-process observer. diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index d712f5c8c165..c9e4153c2499 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -96,12 +96,9 @@ public: bool Init(MessageLoop* aIOLoop, base::ProcessId aParentPid, - IPC::Channel* aChannel, - uint64_t aChildID, - bool aIsForBrowser); + IPC::Channel* aChannel); - void InitXPCOM(const XPCOMInitData& aXPCOMInit, - const mozilla::dom::ipc::StructuredCloneData& aInitialData); + void InitXPCOM(); void InitGraphicsDeviceData(); @@ -576,11 +573,6 @@ public: const bool& minimizeMemoryUsage, const MaybeFileDesc& DMDFile) override; - virtual mozilla::ipc::IPCResult - RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit, - const StructuredCloneData& aInitialData, - nsTArray&& aLookAndFeelIntCache) override; - #if defined(XP_WIN) && defined(ACCESSIBILITY) bool SendGetA11yContentId(); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 7db9e85399f7..030d413fd003 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -186,8 +186,6 @@ #include "nsLayoutStylesheetCache.h" -#include "ContentPrefs.h" - #ifdef MOZ_WEBRTC #include "signaling/src/peerconnection/WebrtcGlobalParent.h" #endif @@ -1826,48 +1824,6 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); std::vector extraArgs; - extraArgs.push_back("-childID"); - char idStr[21]; - SprintfLiteral(idStr, "%" PRId64, static_cast(mChildID)); - extraArgs.push_back(idStr); - extraArgs.push_back(IsForBrowser() ? "-isForBrowser" : "-notForBrowser"); - - std::stringstream boolPrefs; - std::stringstream intPrefs; - std::stringstream stringPrefs; - - size_t prefsLen; - ContentPrefs::GetContentPrefs(&prefsLen); - - for (unsigned int i = 0; i < prefsLen; i++) { - MOZ_ASSERT(i == 0 || strcmp(ContentPrefs::GetContentPref(i), ContentPrefs::GetContentPref(i - 1)) > 0); - switch (Preferences::GetType(ContentPrefs::GetContentPref(i))) { - case nsIPrefBranch::PREF_INT: - intPrefs << i << ':' << Preferences::GetInt(ContentPrefs::GetContentPref(i)) << '|'; - break; - case nsIPrefBranch::PREF_BOOL: - boolPrefs << i << ':' << Preferences::GetBool(ContentPrefs::GetContentPref(i)) << '|'; - break; - case nsIPrefBranch::PREF_STRING: { - std::string value(Preferences::GetCString(ContentPrefs::GetContentPref(i)).get()); - stringPrefs << i << ':' << value.length() << ':' << value << '|'; - } - break; - case nsIPrefBranch::PREF_INVALID: - break; - default: - printf("preference type: %x\n", Preferences::GetType(ContentPrefs::GetContentPref(i))); - MOZ_CRASH(); - } - } - - extraArgs.push_back("-intPrefs"); - extraArgs.push_back(intPrefs.str()); - extraArgs.push_back("-boolPrefs"); - extraArgs.push_back(boolPrefs.str()); - extraArgs.push_back("-stringPrefs"); - extraArgs.push_back(stringPrefs.str()); - if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) { MarkAsDead(); return false; @@ -1887,17 +1843,6 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR // Set a reply timeout for CPOWs. SetReplyTimeoutMs(Preferences::GetInt("dom.ipc.cpow.timeout", 0)); - Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS, - static_cast((TimeStamp::Now() - mLaunchTS) - .ToMilliseconds())); - - nsCOMPtr obs = mozilla::services::GetObserverService(); - if (obs) { - nsAutoString cpId; - cpId.AppendInt(static_cast(this->ChildID())); - obs->NotifyObservers(static_cast(this), "ipc:content-initializing", cpId.get()); - } - return true; } @@ -1955,90 +1900,6 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority, bool aSetupOffMainThreadCompositing, bool aSendRegisteredChrome) { - Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS, - static_cast((TimeStamp::Now() - mLaunchTS) - .ToMilliseconds())); - - XPCOMInitData xpcomInit; - - Preferences::GetPreferences(&xpcomInit.prefs()); - nsCOMPtr io(do_GetIOService()); - MOZ_ASSERT(io, "No IO service?"); - DebugOnly rv = io->GetOffline(&xpcomInit.isOffline()); - MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?"); - - rv = io->GetConnectivity(&xpcomInit.isConnected()); - MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?"); - - xpcomInit.captivePortalState() = nsICaptivePortalService::UNKNOWN; - nsCOMPtr cps = do_GetService(NS_CAPTIVEPORTAL_CONTRACTID); - if (cps) { - cps->GetState(&xpcomInit.captivePortalState()); - } - - nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard(); - - xpcomInit.isLangRTL() = false; - xpcomInit.haveBidiKeyboards() = false; - if (bidi) { - bidi->IsLangRTL(&xpcomInit.isLangRTL()); - bidi->GetHaveBidiKeyboards(&xpcomInit.haveBidiKeyboards()); - } - - nsCOMPtr spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID)); - MOZ_ASSERT(spellChecker, "No spell checker?"); - - spellChecker->GetDictionaryList(&xpcomInit.dictionaries()); - - nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboard;1")); - MOZ_ASSERT(clipboard, "No clipboard?"); - - rv = clipboard->SupportsSelectionClipboard(&xpcomInit.clipboardCaps().supportsSelectionClipboard()); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - rv = clipboard->SupportsFindClipboard(&xpcomInit.clipboardCaps().supportsFindClipboard()); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - // Let's copy the domain policy from the parent to the child (if it's active). - StructuredCloneData initialData; - nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); - if (ssm) { - ssm->CloneDomainPolicy(&xpcomInit.domainPolicy()); - - if (nsFrameMessageManager* mm = nsFrameMessageManager::sParentProcessManager) { - AutoJSAPI jsapi; - if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) { - MOZ_CRASH(); - } - JS::RootedValue init(jsapi.cx()); - nsresult result = mm->GetInitialProcessData(jsapi.cx(), &init); - if (NS_FAILED(result)) { - MOZ_CRASH(); - } - - ErrorResult rv; - initialData.Write(jsapi.cx(), init, rv); - if (NS_WARN_IF(rv.Failed())) { - rv.SuppressException(); - MOZ_CRASH(); - } - } - } - // This is only implemented (returns a non-empty list) by MacOSX at present. - gfxPlatform::GetPlatform()->GetSystemFontFamilyList(&xpcomInit.fontFamilies()); - nsTArray lnfCache = LookAndFeel::GetIntCache(); - - // Content processes have no permission to access profile directory, so we - // send the file URL instead. - StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet(); - if (ucs) { - SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL()); - } else { - SerializeURI(nullptr, xpcomInit.userContentSheetURL()); - } - - Unused << SendSetXPCOMProcessAttributes(xpcomInit, initialData, lnfCache); - if (aSendRegisteredChrome) { nsCOMPtr registrySvc = nsChromeRegistry::GetService(); nsChromeRegistryChrome* chromeRegistry = @@ -2210,6 +2071,13 @@ ContentParent::Pid() const return base::GetProcId(mSubprocess->GetChildProcessHandle()); } +mozilla::ipc::IPCResult +ContentParent::RecvReadPrefsArray(InfallibleTArray* aPrefs) +{ + Preferences::GetPreferences(aPrefs); + return IPC_OK(); +} + mozilla::ipc::IPCResult ContentParent::RecvGetGfxVars(InfallibleTArray* aVars) { @@ -2680,6 +2548,118 @@ ContentParent::RecvInitBackground(Endpoint&& aEndpoint) return IPC_OK(); } +mozilla::ipc::IPCResult +ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId, + bool* aIsForBrowser) +{ + *aCpId = mChildID; + *aIsForBrowser = mIsForBrowser; + + return IPC_OK(); +} + +mozilla::ipc::IPCResult +ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline, + bool* aIsConnected, + int32_t* aCaptivePortalState, + bool* aIsLangRTL, + bool* aHaveBidiKeyboards, + InfallibleTArray* dictionaries, + ClipboardCapabilities* clipboardCaps, + DomainPolicyClone* domainPolicy, + StructuredCloneData* aInitialData, + InfallibleTArray* fontFamilies, + OptionalURIParams* aUserContentCSSURL, + nsTArray* aLookAndFeelIntCache) +{ + Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS, + static_cast((TimeStamp::Now() - mLaunchTS) + .ToMilliseconds())); + + nsCOMPtr io(do_GetIOService()); + MOZ_ASSERT(io, "No IO service?"); + DebugOnly rv = io->GetOffline(aIsOffline); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?"); + + rv = io->GetConnectivity(aIsConnected); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?"); + + *aCaptivePortalState = nsICaptivePortalService::UNKNOWN; + nsCOMPtr cps = do_GetService(NS_CAPTIVEPORTAL_CONTRACTID); + if (cps) { + cps->GetState(aCaptivePortalState); + } + + nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard(); + + *aIsLangRTL = false; + *aHaveBidiKeyboards = false; + if (bidi) { + bidi->IsLangRTL(aIsLangRTL); + bidi->GetHaveBidiKeyboards(aHaveBidiKeyboards); + } + + nsCOMPtr spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID)); + MOZ_ASSERT(spellChecker, "No spell checker?"); + + spellChecker->GetDictionaryList(dictionaries); + + nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboard;1")); + MOZ_ASSERT(clipboard, "No clipboard?"); + + rv = clipboard->SupportsSelectionClipboard(&clipboardCaps->supportsSelectionClipboard()); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + + rv = clipboard->SupportsFindClipboard(&clipboardCaps->supportsFindClipboard()); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + + // Let's copy the domain policy from the parent to the child (if it's active). + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + NS_ENSURE_TRUE(ssm, IPC_OK()); + ssm->CloneDomainPolicy(domainPolicy); + + if (nsFrameMessageManager* mm = nsFrameMessageManager::sParentProcessManager) { + AutoJSAPI jsapi; + if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) { + return IPC_FAIL_NO_REASON(this); + } + JS::RootedValue init(jsapi.cx()); + nsresult result = mm->GetInitialProcessData(jsapi.cx(), &init); + if (NS_FAILED(result)) { + return IPC_FAIL_NO_REASON(this); + } + + ErrorResult rv; + aInitialData->Write(jsapi.cx(), init, rv); + if (NS_WARN_IF(rv.Failed())) { + rv.SuppressException(); + return IPC_FAIL_NO_REASON(this); + } + } + + // This is only implemented (returns a non-empty list) by MacOSX at present. + gfxPlatform::GetPlatform()->GetSystemFontFamilyList(fontFamilies); + *aLookAndFeelIntCache = LookAndFeel::GetIntCache(); + + // Content processes have no permission to access profile directory, so we + // send the file URL instead. + StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet(); + if (ucs) { + SerializeURI(ucs->GetSheetURI(), *aUserContentCSSURL); + } else { + SerializeURI(nullptr, *aUserContentCSSURL); + } + + nsCOMPtr obs = mozilla::services::GetObserverService(); + if (obs) { + nsAutoString cpId; + cpId.AppendInt(static_cast(this->ChildID())); + obs->NotifyObservers(static_cast(this), "ipc:content-initializing", cpId.get()); + } + + return IPC_OK(); +} + mozilla::jsipc::PJavaScriptParent * ContentParent::AllocPJavaScriptParent() { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 3c79fb559861..f0650a00c601 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -746,6 +746,24 @@ private: virtual mozilla::ipc::IPCResult RecvInitBackground(Endpoint&& aEndpoint) override; + virtual mozilla::ipc::IPCResult RecvGetProcessAttributes(ContentParentId* aCpId, + bool* aIsForBrowser) override; + + virtual mozilla::ipc::IPCResult + RecvGetXPCOMProcessAttributes(bool* aIsOffline, + bool* aIsConnected, + int32_t* aCaptivePortalState, + bool* aIsLangRTL, + bool* aHaveBidiKeyboards, + InfallibleTArray* dictionaries, + ClipboardCapabilities* clipboardCaps, + DomainPolicyClone* domainPolicy, + StructuredCloneData* initialData, + InfallibleTArray* fontFamilies, + OptionalURIParams* aUserContentSheetURL, + nsTArray* aLookAndFeelIntCache) override; + + mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport) override; mozilla::ipc::IPCResult RecvFinishMemoryReport(const uint32_t& aGeneration) override; @@ -880,6 +898,7 @@ private: virtual bool DeallocPWebBrowserPersistDocumentParent(PWebBrowserPersistDocumentParent* aActor) override; + virtual mozilla::ipc::IPCResult RecvReadPrefsArray(InfallibleTArray* aPrefs) override; virtual mozilla::ipc::IPCResult RecvGetGfxVars(InfallibleTArray* aVars) override; virtual mozilla::ipc::IPCResult RecvReadFontList(InfallibleTArray* retValue) override; diff --git a/dom/ipc/ContentPrefs.cpp b/dom/ipc/ContentPrefs.cpp deleted file mode 100644 index 343fe98d03f5..000000000000 --- a/dom/ipc/ContentPrefs.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "ContentPrefs.h" - -const char* mozilla::dom::ContentPrefs::gInitPrefs[] = { - "accessibility.monoaudio.enable", - "accessibility.mouse_focuses_formcontrol", - "accessibility.tabfocus_applies_to_xul", - "app.update.channel", - "browser.dom.window.dump.enabled", - "browser.sessionhistory.max_entries", - "browser.sessionhistory.max_total_viewers", - "content.cors.disable", - "content.cors.no_private_data", - "content.notify.backoffcount", - "content.notify.interval", - "content.notify.ontimer", - "content.sink.enable_perf_mode", - "content.sink.event_probe_rate", - "content.sink.initial_perf_time", - "content.sink.interactive_deflect_count", - "content.sink.interactive_parse_time", - "content.sink.interactive_time", - "content.sink.pending_event_mode", - "content.sink.perf_deflect_count", - "content.sink.perf_parse_time", - "device.storage.prompt.testing", - "device.storage.writable.name", - "dom.allow_XUL_XBL_for_file", - "dom.allow_cut_copy", - "dom.enable_frame_timing", - "dom.enable_performance", - "dom.enable_resource_timing", - "dom.event.handling-user-input-time-limit", - "dom.forms.autocomplete.experimental", - "dom.ipc.processPriorityManager.backgroundGracePeriodMS", - "dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS", - "dom.max_chrome_script_run_time", - "dom.max_script_run_time", - "dom.performance.enable_notify_performance_timing", - "dom.performance.enable_user_timing_logging", - "dom.storage.testing", - "dom.url.encode_decode_hash", - "dom.url.getters_decode_hash", - "dom.use_watchdog", - "dom.vibrator.enabled", - "dom.vibrator.max_vibrate_list_len", - "dom.vibrator.max_vibrate_ms", - "focusmanager.testmode", - "font.size.inflation.disabledInMasterProcess", - "font.size.inflation.emPerLine", - "font.size.inflation.forceEnabled", - "font.size.inflation.lineThreshold", - "font.size.inflation.mappingIntercept", - "font.size.inflation.maxRatio", - "font.size.inflation.minTwips", - "full-screen-api.allow-trusted-requests-only", - "full-screen-api.enabled", - "full-screen-api.unprefix.enabled", - "gfx.font_rendering.opentype_svg.enabled", - "hangmonitor.timeout", - "html5.flushtimer.initialdelay", - "html5.flushtimer.subsequentdelay", - "html5.offmainthread", - "intl.charset.fallback.tld", - "intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition", - "javascript.enabled", - "javascript.options.asmjs", - "javascript.options.asyncstack", - "javascript.options.baselinejit", - "javascript.options.baselinejit.threshold", - "javascript.options.baselinejit.unsafe_eager_compilation", - "javascript.options.discardSystemSource", - "javascript.options.dump_stack_on_debuggee_would_run", - "javascript.options.gczeal", - "javascript.options.gczeal.frequency", - "javascript.options.ion", - "javascript.options.ion.offthread_compilation", - "javascript.options.ion.threshold", - "javascript.options.ion.unsafe_eager_compilation", - "javascript.options.jit.full_debug_checks", - "javascript.options.native_regexp", - "javascript.options.parallel_parsing", - "javascript.options.shared_memory", - "javascript.options.strict", - "javascript.options.strict.debug", - "javascript.options.throw_on_asmjs_validation_failure", - "javascript.options.throw_on_debuggee_would_run", - "javascript.options.wasm", - "javascript.options.wasm_baselinejit", - "javascript.options.werror", - "javascript.use_us_english_locale", - "jsloader.reuseGlobal", - "layout.css.all-shorthand.enabled", - "layout.css.background-blend-mode.enabled", - "layout.css.background-clip-text.enabled", - "layout.css.box-decoration-break.enabled", - "layout.css.color-adjust.enabled", - "layout.css.contain.enabled", - "layout.css.control-characters.visible", - "layout.css.display-flow-root.enabled", - "layout.css.expensive-style-struct-assertions.enabled", - "layout.css.float-logical-values.enabled", - "layout.css.font-variations.enabled", - "layout.css.grid.enabled", - "layout.css.image-orientation.enabled", - "layout.css.initial-letter.enabled", - "layout.css.isolation.enabled", - "layout.css.mix-blend-mode.enabled", - "layout.css.object-fit-and-position.enabled", - "layout.css.osx-font-smoothing.enabled", - "layout.css.overflow-clip-box.enabled", - "layout.css.prefixes.animations", - "layout.css.prefixes.border-image", - "layout.css.prefixes.box-sizing", - "layout.css.prefixes.device-pixel-ratio-webkit", - "layout.css.prefixes.font-features", - "layout.css.prefixes.gradients", - "layout.css.prefixes.transforms", - "layout.css.prefixes.transitions", - "layout.css.prefixes.webkit", - "layout.css.scope-pseudo.enabled", - "layout.css.scroll-behavior.property-enabled", - "layout.css.scroll-snap.enabled", - "layout.css.shape-outside.enabled", - "layout.css.text-align-unsafe-value.enabled", - "layout.css.text-combine-upright-digits.enabled", - "layout.css.text-combine-upright.enabled", - "layout.css.touch_action.enabled", - "layout.css.unprefixing-service.enabled", - "layout.css.unprefixing-service.globally-whitelisted", - "layout.css.unprefixing-service.include-test-domains", - "layout.css.variables.enabled", - "layout.css.visited_links_enabled", - "layout.idle_period.required_quiescent_frames", - "layout.idle_period.time_limit", - "layout.interruptible-reflow.enabled", - "mathml.disabled", - "media.apple.forcevda", - "media.clearkey.persistent-license.enabled", - "media.cubeb_latency_msg_frames", - "media.cubeb_latency_playback_ms", - "media.decoder-doctor.wmf-disabled-is-failure", - "media.decoder.fuzzing.dont-delay-inputexhausted", - "media.decoder.fuzzing.enabled", - "media.decoder.fuzzing.video-output-minimum-interval-ms", - "media.decoder.limit", - "media.decoder.recycle.enabled", - "media.dormant-on-pause-timeout-ms", - "media.eme.audio.blank", - "media.eme.enabled", - "media.eme.video.blank", - "media.ffmpeg.enabled", - "media.ffvpx.enabled", - "media.flac.enabled", - "media.forcestereo.enabled", - "media.gmp.async-shutdown-timeout", - "media.gmp.decoder.aac", - "media.gmp.decoder.enabled", - "media.gmp.decoder.h264", - "media.gmp.insecure.allow", - "media.gpu-process-decoder", - "media.libavcodec.allow-obsolete", - "media.num-decode-threads", - "media.ogg.enabled", - "media.ogg.flac.enabled", - "media.resampling.enabled", - "media.resampling.rate", - "media.ruin-av-sync.enabled", - "media.rust.test_mode", - "media.suspend-bkgnd-video.delay-ms", - "media.suspend-bkgnd-video.enabled", - "media.use-blank-decoder", - "media.video_stats.enabled", - "media.volume_scale", - "media.webspeech.recognition.enable", - "media.webspeech.recognition.force_enable", - "media.webspeech.synth.force_global_queue", - "media.webspeech.test.enable", - "media.webspeech.test.fake_fsm_events", - "media.webspeech.test.fake_recognition_service", - "media.wmf.allow-unsupported-resolutions", - "media.wmf.decoder.thread-count", - "media.wmf.enabled", - "media.wmf.skip-blacklist", - "media.wmf.vp9.enabled", - "memory.free_dirty_pages", - "memory.low_commit_space_threshold_mb", - "memory.low_memory_notification_interval_ms", - "memory.low_physical_memory_threshold_mb", - "memory.low_virtual_mem_threshold_mb", - "network.IDN.blacklist_chars", - "network.IDN.restriction_profile", - "network.IDN.use_whitelist", - "network.IDN_show_punycode", - "network.buffer.cache.count", - "network.buffer.cache.size", - "network.captive-portal-service.enabled", - "network.cookie.cookieBehavior", - "network.cookie.lifetimePolicy", - "network.dns.disablePrefetch", - "network.dns.disablePrefetchFromHTTPS", - "network.jar.block-remote-files", - "network.loadinfo.skip_type_assertion", - "network.notify.changed", - "network.offline-mirrors-connectivity", - "network.protocol-handler.external.jar", - "network.proxy.type", - "network.security.ports.banned", - "network.security.ports.banned.override", - "network.standard-url.enable-rust", - "network.standard-url.max-length", - "network.sts.max_time_for_events_between_two_polls", - "network.sts.max_time_for_pr_close_during_shutdown", - "network.tcp.keepalive.enabled", - "network.tcp.keepalive.idle_time", - "network.tcp.keepalive.probe_count", - "network.tcp.keepalive.retry_interval", - "network.tcp.sendbuffer", - "nglayout.debug.invalidation", - "privacy.donottrackheader.enabled", - "privacy.firstparty.isolate", - "privacy.firstparty.isolate.restrict_opener_access", - "privacy.resistFingerprinting", - "security.data_uri.inherit_security_context", - "security.fileuri.strict_origin_policy", - "security.sandbox.content.level", - "security.sandbox.content.tempDirSuffix", - "security.sandbox.logging.enabled", - "security.sandbox.mac.track.violations", - "security.sandbox.windows.log", - "security.sandbox.windows.log.stackTraceDepth", - "shutdown.watchdog.timeoutSecs", - "signed.applets.codebase_principal_support", - "svg.disabled", - "svg.display-lists.hit-testing.enabled", - "svg.display-lists.painting.enabled", - "svg.new-getBBox.enabled", - "svg.paint-order.enabled", - "svg.path-caching.enabled", - "svg.transform-box.enabled", - "toolkit.asyncshutdown.crash_timeout", - "toolkit.asyncshutdown.log", - "toolkit.osfile.log", - "toolkit.osfile.log.redirect", - "toolkit.telemetry.enabled", - "toolkit.telemetry.idleTimeout", - "toolkit.telemetry.initDelay", - "toolkit.telemetry.log.dump", - "toolkit.telemetry.log.level", - "toolkit.telemetry.minSubsessionLength", - "toolkit.telemetry.scheduler.idleTickInterval", - "toolkit.telemetry.scheduler.tickInterval", - "toolkit.telemetry.unified", - "ui.key.menuAccessKeyFocuses", - "ui.popup.disable_autohide", - "ui.use_activity_cursor", - "view_source.editor.external"}; - -const char** mozilla::dom::ContentPrefs::GetContentPrefs(size_t* aCount) -{ - *aCount = ArrayLength(ContentPrefs::gInitPrefs); - return gInitPrefs; -} - -const char* mozilla::dom::ContentPrefs::GetContentPref(size_t aIndex) -{ - MOZ_ASSERT(aIndex < ArrayLength(ContentPrefs::gInitPrefs)); - return gInitPrefs[aIndex]; -} - diff --git a/dom/ipc/ContentPrefs.h b/dom/ipc/ContentPrefs.h deleted file mode 100644 index f85d4b5cbad5..000000000000 --- a/dom/ipc/ContentPrefs.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_ContentPrefs_h -#define mozilla_dom_ContentPrefs_h - -namespace mozilla { -namespace dom { - -class ContentPrefs { -public: - static const char** GetContentPrefs(size_t* aCount); - static const char* GetContentPref(size_t aIndex); - -private: - static const char* gInitPrefs[]; -}; - -} -} - -#endif diff --git a/dom/ipc/ContentProcess.cpp b/dom/ipc/ContentProcess.cpp index 394e7f1deff8..2413d88087e5 100644 --- a/dom/ipc/ContentProcess.cpp +++ b/dom/ipc/ContentProcess.cpp @@ -7,7 +7,6 @@ #include "mozilla/ipc/IOThreadChild.h" #include "ContentProcess.h" -#include "ContentPrefs.h" #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) #include @@ -104,143 +103,46 @@ SetUpSandboxEnvironment() } #endif -bool -ContentProcess::Init(int aArgc, char* aArgv[]) +void +ContentProcess::SetAppDir(const nsACString& aPath) { - // If passed in grab the application path for xpcom init - bool foundAppdir = false; - bool foundChildID = false; - bool foundIsForBrowser = false; - bool foundIntPrefs = false; - bool foundBoolPrefs = false; - bool foundStringPrefs = false; - - uint64_t childID; - bool isForBrowser; + mXREEmbed.SetAppDir(aPath); +} #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - // If passed in grab the profile path for sandboxing - bool foundProfile = false; - nsCOMPtr profileDir; -#endif - - InfallibleTArray prefsArray; - for (int idx = aArgc; idx > 0; idx--) { - if (!aArgv[idx]) { - continue; - } - - if (!strcmp(aArgv[idx], "-appdir")) { - MOZ_ASSERT(!foundAppdir); - if (foundAppdir) { - continue; - } - nsCString appDir; - appDir.Assign(nsDependentCString(aArgv[idx+1])); - mXREEmbed.SetAppDir(appDir); - foundAppdir = true; - } else if (!strcmp(aArgv[idx], "-childID")) { - MOZ_ASSERT(!foundChildID); - if (foundChildID) { - continue; - } - if (idx + 1 < aArgc) { - childID = strtoull(aArgv[idx + 1], nullptr, 10); - foundChildID = true; - } - } else if (!strcmp(aArgv[idx], "-isForBrowser") || !strcmp(aArgv[idx], "-notForBrowser")) { - MOZ_ASSERT(!foundIsForBrowser); - if (foundIsForBrowser) { - continue; - } - isForBrowser = strcmp(aArgv[idx], "-notForBrowser"); - foundIsForBrowser = true; - } else if (!strcmp(aArgv[idx], "-intPrefs")) { - SET_PREF_PHASE(BEGIN_INIT_PREFS); - char* str = aArgv[idx + 1]; - while (*str) { - int32_t index = strtol(str, &str, 10); - str++; - MaybePrefValue value(PrefValue(static_cast(strtol(str, &str, 10)))); - str++; - PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue()); - prefsArray.AppendElement(pref); - } - SET_PREF_PHASE(END_INIT_PREFS); - foundIntPrefs = true; - } else if (!strcmp(aArgv[idx], "-boolPrefs")) { - SET_PREF_PHASE(BEGIN_INIT_PREFS); - char* str = aArgv[idx + 1]; - while (*str) { - int32_t index = strtol(str, &str, 10); - str++; - MaybePrefValue value(PrefValue(!!strtol(str, &str, 10))); - str++; - PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue()); - prefsArray.AppendElement(pref); - } - SET_PREF_PHASE(END_INIT_PREFS); - foundBoolPrefs = true; - } else if (!strcmp(aArgv[idx], "-stringPrefs")) { - SET_PREF_PHASE(BEGIN_INIT_PREFS); - char* str = aArgv[idx + 1]; - while (*str) { - int32_t index = strtol(str, &str, 10); - str++; - int32_t length = strtol(str, &str, 10); - str++; - MaybePrefValue value(PrefValue(nsCString(str, length))); - PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue()); - prefsArray.AppendElement(pref); - str += length + 1; - } - SET_PREF_PHASE(END_INIT_PREFS); - foundStringPrefs = true; - } - -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - else if (!strcmp(aArgv[idx], "-profile")) { - MOZ_ASSERT(!foundProfile); - if (foundProfile) { - continue; - } - bool flag; - nsresult rv = XRE_GetFileFromPath(aArgv[idx+1], getter_AddRefs(profileDir)); - if (NS_FAILED(rv) || - NS_FAILED(profileDir->Exists(&flag)) || !flag) { - NS_WARNING("Invalid profile directory passed to content process."); - profileDir = nullptr; - } - foundProfile = true; - } -#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */ - - bool allFound = foundAppdir && foundChildID && foundIsForBrowser && foundIntPrefs && foundBoolPrefs && foundStringPrefs; - -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - allFound &= foundProfile; -#endif - - if (allFound) { - break; - } +void +ContentProcess::SetProfile(const nsACString& aProfile) +{ + bool flag; + nsresult rv = + XRE_GetFileFromPath(aProfile.BeginReading(), getter_AddRefs(mProfileDir)); + if (NS_FAILED(rv) || + NS_FAILED(mProfileDir->Exists(&flag)) || !flag) { + NS_WARNING("Invalid profile directory passed to content process."); + mProfileDir = nullptr; } - Preferences::SetInitPreferences(&prefsArray); - mContent.Init(IOThreadChild::message_loop(), - ParentPid(), - IOThreadChild::channel(), - childID, - isForBrowser); - mXREEmbed.Start(); +} +#endif + +bool +ContentProcess::Init() +{ + mContent.Init(IOThreadChild::message_loop(), + ParentPid(), + IOThreadChild::channel()); + mXREEmbed.Start(); + mContent.InitXPCOM(); + mContent.InitGraphicsDeviceData(); + #if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - mContent.SetProfileDir(profileDir); + mContent.SetProfileDir(mProfileDir); #endif #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - SetUpSandboxEnvironment(); + SetUpSandboxEnvironment(); #endif - return true; + return true; } // Note: CleanUp() never gets called in non-debug builds because we exit early @@ -248,7 +150,7 @@ ContentProcess::Init(int aArgc, char* aArgv[]) void ContentProcess::CleanUp() { - mXREEmbed.Stop(); + mXREEmbed.Stop(); } } // namespace dom diff --git a/dom/ipc/ContentProcess.h b/dom/ipc/ContentProcess.h index a3854c761e10..bf9968f8cad9 100644 --- a/dom/ipc/ContentProcess.h +++ b/dom/ipc/ContentProcess.h @@ -34,13 +34,23 @@ public: ~ContentProcess() { } - virtual bool Init(int aArgc, char* aArgv[]) override; + virtual bool Init() override; virtual void CleanUp() override; + void SetAppDir(const nsACString& aPath); + +#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) + void SetProfile(const nsACString& aProfile); +#endif + private: ContentChild mContent; mozilla::ipc::ScopedXREEmbed mXREEmbed; +#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) + nsCOMPtr mProfileDir; +#endif + #if defined(XP_WIN) // This object initializes and configures COM. mozilla::mscom::MainThreadRuntime mCOMRuntime; diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 71f382b4fb7b..eead95c2fa64 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -334,22 +334,6 @@ struct GMPCapabilityData GMPAPITags[] capabilities; }; -struct XPCOMInitData -{ - bool isOffline; - bool isConnected; - int32_t captivePortalState; - bool isLangRTL; - bool haveBidiKeyboards; - nsString[] dictionaries; - ClipboardCapabilities clipboardCaps; - DomainPolicyClone domainPolicy; - /* used on MacOSX only */ - FontFamilyListEntry[] fontFamilies; - OptionalURIParams userContentSheetURL; - PrefSetting[] prefs; -}; - struct GfxInfoFeatureStatus { int32_t feature; @@ -543,8 +527,6 @@ child: */ async InitBlobURLs(BlobURLRegistrationData[] registrations); - async SetXPCOMProcessAttributes(XPCOMInitData xpcomInit, StructuredCloneData initialData, LookAndFeelInt[] lookAndFeelIntCache); - // Notify child that last-pb-context-exited notification was observed async LastPrivateDocShellDestroyed(); @@ -668,6 +650,30 @@ child: parent: async InitBackground(Endpoint aEndpoint); + /** + * Tell the content process some attributes of itself. This is + * among the first information queried by content processes after + * startup. (The message is sync to allow the content process to + * control when it receives the information.) + * + * |id| is a unique ID among all subprocesses. When + * |isForBrowser|, we're loading or . + * + * Keep the return values in sync with PBrowser()! + */ + sync GetProcessAttributes() + returns (ContentParentId cpId, bool isForBrowser); + sync GetXPCOMProcessAttributes() + returns (bool isOffline, bool isConnected, int32_t captivePortalState, + bool isLangRTL, + bool haveBidiKeyboards, nsString[] dictionaries, + ClipboardCapabilities clipboardCaps, + DomainPolicyClone domainPolicy, + StructuredCloneData initialData, + FontFamilyListEntry[] fontFamilies /* used on MacOSX only */, + OptionalURIParams userContentSheetURL, + LookAndFeelInt[] lookAndFeelIntCache); + sync CreateChildProcess(IPCTabContext context, ProcessPriority priority, TabId openerTabId) @@ -811,6 +817,7 @@ parent: async ExtProtocolChannelConnectParent(uint32_t registrarId); // PrefService message + sync ReadPrefsArray() returns (PrefSetting[] prefs) verify; sync GetGfxVars() returns (GfxVarUpdate[] vars); sync ReadFontList() returns (FontListEntry[] retValue); diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index a72655e9dd10..debd5cd2e25f 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -119,8 +119,6 @@ #include "GroupedSHistory.h" #include "nsIHttpChannel.h" #include "mozilla/dom/DocGroup.h" -#include "nsISupportsPrimitives.h" -#include "mozilla/Telemetry.h" #ifdef NS_PRINTING #include "nsIPrintSession.h" diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index e84887ea40a8..452e1fe45166 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -20,7 +20,6 @@ EXPORTS.mozilla.dom += [ 'ContentBridgeParent.h', 'ContentChild.h', 'ContentParent.h', - 'ContentPrefs.h', 'ContentProcess.h', 'ContentProcessManager.h', 'CPOWManagerGetter.h', @@ -51,7 +50,6 @@ UNIFIED_SOURCES += [ 'ContentBridgeChild.cpp', 'ContentBridgeParent.cpp', 'ContentParent.cpp', - 'ContentPrefs.cpp', 'ContentProcess.cpp', 'ContentProcessManager.cpp', 'CrashReporterParent.cpp', diff --git a/dom/media/gmp/GMPProcessChild.cpp b/dom/media/gmp/GMPProcessChild.cpp index d56339bc1018..d1ada706a7dd 100644 --- a/dom/media/gmp/GMPProcessChild.cpp +++ b/dom/media/gmp/GMPProcessChild.cpp @@ -25,7 +25,7 @@ GMPProcessChild::~GMPProcessChild() } bool -GMPProcessChild::Init(int aArgc, char* aArgv[]) +GMPProcessChild::Init() { nsAutoString pluginFilename; diff --git a/dom/media/gmp/GMPProcessChild.h b/dom/media/gmp/GMPProcessChild.h index 382882e18a31..c2c8be9e2ebc 100644 --- a/dom/media/gmp/GMPProcessChild.h +++ b/dom/media/gmp/GMPProcessChild.h @@ -22,7 +22,7 @@ public: explicit GMPProcessChild(ProcessId aParentPid); ~GMPProcessChild(); - bool Init(int aArgc, char* aArgv[]) override; + bool Init() override; void CleanUp() override; private: diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp index 5b0a2beecdea..eb698e8af5cf 100644 --- a/dom/plugins/ipc/PluginProcessChild.cpp +++ b/dom/plugins/ipc/PluginProcessChild.cpp @@ -40,7 +40,7 @@ namespace plugins { bool -PluginProcessChild::Init(int aArgc, char* aArgv[]) +PluginProcessChild::Init() { nsDebugImpl::SetMultiprocessMode("NPAPI"); diff --git a/dom/plugins/ipc/PluginProcessChild.h b/dom/plugins/ipc/PluginProcessChild.h index fd0a328bc703..75c842a1bfda 100644 --- a/dom/plugins/ipc/PluginProcessChild.h +++ b/dom/plugins/ipc/PluginProcessChild.h @@ -30,7 +30,7 @@ public: virtual ~PluginProcessChild() { } - virtual bool Init(int aArgc, char* aArgv[]) override; + virtual bool Init() override; virtual void CleanUp() override; protected: diff --git a/gfx/ipc/GPUProcessImpl.cpp b/gfx/ipc/GPUProcessImpl.cpp index f7c4c80daafe..38d13484b3e7 100644 --- a/gfx/ipc/GPUProcessImpl.cpp +++ b/gfx/ipc/GPUProcessImpl.cpp @@ -22,7 +22,7 @@ GPUProcessImpl::~GPUProcessImpl() } bool -GPUProcessImpl::Init(int aArgc, char* aArgv[]) +GPUProcessImpl::Init() { return mGPU.Init(ParentPid(), IOThreadChild::message_loop(), diff --git a/gfx/ipc/GPUProcessImpl.h b/gfx/ipc/GPUProcessImpl.h index fc7ff8ca3a6e..5e8b6694a6c6 100644 --- a/gfx/ipc/GPUProcessImpl.h +++ b/gfx/ipc/GPUProcessImpl.h @@ -24,7 +24,7 @@ public: explicit GPUProcessImpl(ProcessId aParentPid); ~GPUProcessImpl(); - bool Init(int aArgc, char* aArgv[]) override; + bool Init() override; void CleanUp() override; private: diff --git a/ipc/glue/ProcessChild.h b/ipc/glue/ProcessChild.h index 65d62bae8fba..4d1d3865902a 100644 --- a/ipc/glue/ProcessChild.h +++ b/ipc/glue/ProcessChild.h @@ -27,7 +27,7 @@ public: explicit ProcessChild(ProcessId aParentPid); virtual ~ProcessChild(); - virtual bool Init(int aArgc, char* aArgv[]) = 0; + virtual bool Init() = 0; virtual void CleanUp() { } diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index b1f86b9e0f62..f36819236f47 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/MemoryReporting.h" -#include "mozilla/dom/PContent.h" +#include "mozilla/dom/ContentChild.h" #include "mozilla/ArrayUtils.h" #include "mozilla/Attributes.h" @@ -546,14 +546,6 @@ NS_INTERFACE_MAP_END * nsIPrefService Implementation */ -InfallibleTArray* gInitPrefs; - -/*static*/ -void -Preferences::SetInitPreferences(nsTArray* aPrefs) { - gInitPrefs = new InfallibleTArray(mozilla::Move(*aPrefs)); -} - nsresult Preferences::Init() { @@ -565,13 +557,15 @@ Preferences::Init() rv = pref_InitInitialObjects(); NS_ENSURE_SUCCESS(rv, rv); + using mozilla::dom::ContentChild; if (XRE_IsContentProcess()) { - MOZ_ASSERT(gInitPrefs); - for (unsigned int i = 0; i < gInitPrefs->Length(); i++) { - Preferences::SetPreference(gInitPrefs->ElementAt(i)); + InfallibleTArray prefs; + ContentChild::GetSingleton()->SendReadPrefsArray(&prefs); + + // Store the array + for (uint32_t i = 0; i < prefs.Length(); ++i) { + pref_SetPref(prefs[i]); } - delete gInitPrefs; - gInitPrefs = nullptr; return NS_OK; } @@ -786,14 +780,6 @@ Preferences::GetPreferences(InfallibleTArray* aPrefs) } } -#ifdef DEBUG -void -Preferences::SetInitPhase(pref_initPhase phase) -{ - pref_SetInitPhase(phase); -} -#endif - NS_IMETHODIMP Preferences::GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { diff --git a/modules/libpref/Preferences.h b/modules/libpref/Preferences.h index 8b0daef13b46..255d2a8d2f29 100644 --- a/modules/libpref/Preferences.h +++ b/modules/libpref/Preferences.h @@ -28,20 +28,6 @@ typedef void (*PrefChangedFunc)(const char *, void *); #define have_PrefChangedFunc_typedef #endif -#ifdef DEBUG -enum pref_initPhase { - START, - BEGIN_INIT_PREFS, - END_INIT_PREFS, - BEGIN_ALL_PREFS, - END_ALL_PREFS -}; - -#define SET_PREF_PHASE(p) Preferences::SetInitPhase(p) -#else -#define SET_PREF_PHASE(p) do { } while (0) -#endif - namespace mozilla { namespace dom { @@ -380,12 +366,6 @@ public: static void GetPreference(PrefSetting* aPref); static void SetPreference(const PrefSetting& aPref); - static void SetInitPreferences(nsTArray* aPrefs); - -#ifdef DEBUG - static void SetInitPhase(pref_initPhase phase); -#endif - static int64_t SizeOfIncludingThisAndOtherStuff(mozilla::MallocSizeOf aMallocSizeOf); static void DirtyCallback(); diff --git a/modules/libpref/prefapi.cpp b/modules/libpref/prefapi.cpp index a42c83d343bf..046a6941903d 100644 --- a/modules/libpref/prefapi.cpp +++ b/modules/libpref/prefapi.cpp @@ -29,7 +29,6 @@ #include "prprf.h" #include "mozilla/MemoryReporting.h" #include "mozilla/dom/PContent.h" -#include "mozilla/dom/ContentPrefs.h" #include "nsQuickSort.h" #include "nsString.h" #include "nsPrintfCString.h" @@ -737,48 +736,13 @@ static PrefTypeFlags pref_SetValue(PrefValue* existingValue, PrefTypeFlags flags } return flags; } -#ifdef DEBUG -static pref_initPhase gPhase = START; - -void -pref_SetInitPhase(pref_initPhase phase) -{ - gPhase = phase; -} - -struct StringComparator -{ - const char* mKey; - explicit StringComparator(const char* aKey) : mKey(aKey) {} - int operator()(const char* string) const { - return strcmp(mKey, string); - } -}; - -bool -inInitArray(const char* key) -{ - size_t prefsLen; - size_t found; - const char** list = mozilla::dom::ContentPrefs::GetContentPrefs(&prefsLen); - return BinarySearchIf(list, 0, prefsLen, - StringComparator(key), &found); -} -#endif PrefHashEntry* pref_HashTableLookup(const char *key) { #ifndef MOZ_B2G MOZ_ASSERT(NS_IsMainThread()); #endif - MOZ_ASSERT((!XRE_IsContentProcess() || gPhase != START), - "pref access before commandline prefs set"); - /* If you're hitting this assertion, you've added a pref access to start up. - * Consider moving it later or add it to the whitelist in ContentPrefs.cpp - * and get review from a DOM peer - */ - MOZ_ASSERT((!XRE_IsContentProcess() || gPhase > END_INIT_PREFS || inInitArray(key)), - "accessing non-init pref before the rest of the prefs are sent"); + return static_cast(gHashTable->Search(key)); } diff --git a/modules/libpref/prefapi_private_data.h b/modules/libpref/prefapi_private_data.h index 4cf58f6a9f85..f1fa68fdc45e 100644 --- a/modules/libpref/prefapi_private_data.h +++ b/modules/libpref/prefapi_private_data.h @@ -10,7 +10,6 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/UniquePtr.h" -#include "Preferences.h" extern PLDHashTable* gHashTable; @@ -26,11 +25,6 @@ pref_savePrefs(PLDHashTable* aTable, uint32_t* aPrefCount); nsresult pref_SetPref(const mozilla::dom::PrefSetting& aPref); -#ifdef DEBUG -void -pref_SetInitPhase(pref_initPhase phase); -#endif - int pref_CompareStrings(const void *v1, const void *v2, void* unused); PrefHashEntry* pref_HashTableLookup(const char *key); diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 4649a41525f8..89584b5621ad 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -625,8 +625,49 @@ XRE_InitChildProcess(int aArgc, process = new PluginProcessChild(parentPID); break; - case GeckoProcessType_Content: - process = new ContentProcess(parentPID); + case GeckoProcessType_Content: { + process = new ContentProcess(parentPID); + // If passed in grab the application path for xpcom init + bool foundAppdir = false; + +#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) + // If passed in grab the profile path for sandboxing + bool foundProfile = false; +#endif + + for (int idx = aArgc; idx > 0; idx--) { + if (aArgv[idx] && !strcmp(aArgv[idx], "-appdir")) { + MOZ_ASSERT(!foundAppdir); + if (foundAppdir) { + continue; + } + nsCString appDir; + appDir.Assign(nsDependentCString(aArgv[idx+1])); + static_cast(process.get())->SetAppDir(appDir); + foundAppdir = true; + } + +#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) + if (aArgv[idx] && !strcmp(aArgv[idx], "-profile")) { + MOZ_ASSERT(!foundProfile); + if (foundProfile) { + continue; + } + nsCString profile; + profile.Assign(nsDependentCString(aArgv[idx+1])); + static_cast(process.get())->SetProfile(profile); + foundProfile = true; + } + if (foundProfile && foundAppdir) { + break; + } +#else + if (foundAppdir) { + break; + } +#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */ + } + } break; case GeckoProcessType_IPDLUnitTest: @@ -649,7 +690,7 @@ XRE_InitChildProcess(int aArgc, MOZ_CRASH("Unknown main thread class"); } - if (!process->Init(aArgc, aArgv)) { + if (!process->Init()) { return NS_ERROR_FAILURE; } From e0ca7bce950ea574e918c871a8fe017b59b5b32b Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Sun, 5 Feb 2017 13:10:16 +0100 Subject: [PATCH 42/70] Bug 1330006 - Fix space-infix-ops eslint. r=till --- js/src/builtin/Array.js | 2 +- js/src/builtin/Sorting.js | 6 +++--- js/src/builtin/String.js | 6 +++--- js/src/builtin/TypedArray.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/js/src/builtin/Array.js b/js/src/builtin/Array.js index d619faa72315..67b61f8b5484 100644 --- a/js/src/builtin/Array.js +++ b/js/src/builtin/Array.js @@ -791,7 +791,7 @@ function ArrayKeys() { } // ES 2017 draft 0f10dba4ad18de92d47d421f378233a2eae8f077 22.1.2.1 -function ArrayFrom(items, mapfn=undefined, thisArg=undefined) { +function ArrayFrom(items, mapfn = undefined, thisArg = undefined) { // Step 1. var C = this; diff --git a/js/src/builtin/Sorting.js b/js/src/builtin/Sorting.js index 6cd279c4f818..11db7ba58080 100644 --- a/js/src/builtin/Sorting.js +++ b/js/src/builtin/Sorting.js @@ -75,7 +75,7 @@ function SortByColumn(array, len, aux, col) { // Transform counts to indices. for (let r = 0; r < R; r++) { - counts[r+1] += counts[r]; + counts[r + 1] += counts[r]; } // Distribute @@ -212,13 +212,13 @@ function Merge(list, start, mid, end, lBuffer, rBuffer, comparefn) { // Empty out any remaining elements in the buffer. while (i < sizeLeft) { - list[k] =lBuffer[i]; + list[k] = lBuffer[i]; i++; k++; } while (j < sizeRight) { - list[k] =rBuffer[j]; + list[k] = rBuffer[j]; j++; k++; } diff --git a/js/src/builtin/String.js b/js/src/builtin/String.js index 91c8ddb720fe..240be15a7469 100644 --- a/js/src/builtin/String.js +++ b/js/src/builtin/String.js @@ -68,7 +68,7 @@ function String_generic_match(thisValue, regexp) { * A helper function implementing the logic for both String.prototype.padStart * and String.prototype.padEnd as described in ES7 Draft March 29, 2016 */ -function String_pad(maxLength, fillString, padEnd=false) { +function String_pad(maxLength, fillString, padEnd = false) { // Steps 1-2. RequireObjectCoercible(this); @@ -105,11 +105,11 @@ function String_pad(maxLength, fillString, padEnd=false) { return truncatedStringFiller + str; } -function String_pad_start(maxLength, fillString=" ") { +function String_pad_start(maxLength, fillString = " ") { return callFunction(String_pad, this, maxLength, fillString, false); } -function String_pad_end(maxLength, fillString=" ") { +function String_pad_end(maxLength, fillString = " ") { return callFunction(String_pad, this, maxLength, fillString, true); } diff --git a/js/src/builtin/TypedArray.js b/js/src/builtin/TypedArray.js index 8e4904d799dd..cb1232cb1b75 100644 --- a/js/src/builtin/TypedArray.js +++ b/js/src/builtin/TypedArray.js @@ -1094,7 +1094,7 @@ function TypedArrayCompare(x, y) { // Steps 8-9. if (x === 0 && y === 0) - return (1/x > 0 ? 1 : 0) - (1/y > 0 ? 1 : 0); + return ((1 / x) > 0 ? 1 : 0) - ((1 / y) > 0 ? 1 : 0); // Steps 3-4. if (Number_isNaN(x)) @@ -1109,7 +1109,7 @@ function TypedArrayCompareInt(x, y) { // Step 1. assert(typeof x === "number" && typeof y === "number", "x and y are not numbers."); - assert((x === (x|0) || x === (x>>>0)) && (y === (y|0) || y === (y>>>0)), + assert((x === (x | 0) || x === (x >>> 0)) && (y === (y | 0) || y === (y >>> 0)), "x and y are not int32/uint32 numbers."); // Step 2 (Implemented in TypedArraySort). From 4562413d8ceb316e32c39ba8886120f6bddfe5d4 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Sun, 5 Feb 2017 13:10:16 +0100 Subject: [PATCH 43/70] Bug 1330006 - Fix various space related eslint errors. r=till --- js/src/builtin/Generator.js | 4 ++-- js/src/builtin/Number.js | 2 +- js/src/builtin/Sorting.js | 8 ++++---- js/src/builtin/TypedObject.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/src/builtin/Generator.js b/js/src/builtin/Generator.js index 28ea872ecac3..3a85194513db 100644 --- a/js/src/builtin/Generator.js +++ b/js/src/builtin/Generator.js @@ -82,7 +82,7 @@ function LegacyGeneratorNext(val) { try { return resumeGenerator(this, val, "next"); - } catch(e) { + } catch (e) { if (!LegacyGeneratorObjectIsClosed(this)) GeneratorSetClosed(this); throw e; @@ -102,7 +102,7 @@ function LegacyGeneratorThrow(val) { try { return resumeGenerator(this, val, "throw"); - } catch(e) { + } catch (e) { if (!LegacyGeneratorObjectIsClosed(this)) GeneratorSetClosed(this); throw e; diff --git a/js/src/builtin/Number.js b/js/src/builtin/Number.js index aaecd0930dd1..24b997b1670e 100644 --- a/js/src/builtin/Number.js +++ b/js/src/builtin/Number.js @@ -82,6 +82,6 @@ function Global_isNaN(number) { return Number_isNaN(ToNumber(number)); } -function Global_isFinite(number){ +function Global_isFinite(number) { return Number_isFinite(ToNumber(number)); } diff --git a/js/src/builtin/Sorting.js b/js/src/builtin/Sorting.js index 11db7ba58080..bc001fa43a47 100644 --- a/js/src/builtin/Sorting.js +++ b/js/src/builtin/Sorting.js @@ -12,11 +12,11 @@ function CountingSort(array, len, signed) { var min = 0; // Map int8 values onto the uint8 range when storing in buffer. - if (signed) { + if (signed) { min = -128; } - for (var i = 0; i < 256; i++) { + for (var i = 0; i < 256; i++) { buffer[i] = 0; } @@ -45,7 +45,7 @@ function CountingSort(array, len, signed) { // Helper for RadixSort function ByteAtCol(x, pos) { - return (x >> (pos * 8)) & 0xFF; + return (x >> (pos * 8)) & 0xFF; } function SortByColumn(array, len, aux, col) { @@ -314,7 +314,7 @@ function Partition(array, from, to, comparefn) { var pivotIndex = i; // Hoare partition method. - for(;;) { + for (;;) { do i++; while (comparefn(array[i], array[pivotIndex]) < 0); do j--; while (comparefn(array[j], array[pivotIndex]) > 0); if (i > j) diff --git a/js/src/builtin/TypedObject.js b/js/src/builtin/TypedObject.js index 6e492870b692..0c503241f8f1 100644 --- a/js/src/builtin/TypedObject.js +++ b/js/src/builtin/TypedObject.js @@ -967,7 +967,7 @@ function TypeOfTypedObject(obj) { // TypedObject surface API methods (sequential implementations). // Warning: user exposed! -function TypedObjectArrayTypeBuild(a,b,c) { +function TypedObjectArrayTypeBuild(a, b, c) { // Arguments : [depth], func if (!IsObject(this) || !ObjectIsTypeDescr(this)) From a9d97e3d927a70db1bd6677866940f0b6f1a0793 Mon Sep 17 00:00:00 2001 From: Andreas Farre Date: Fri, 3 Feb 2017 10:32:31 +0100 Subject: [PATCH 44/70] Bug 1336229 - Don't dispatch canceled IdleRequestExecutors. r=bkelly IdleRequestExecutor::MaybeDispatch needs to handle the case when mWindow is null, due to IdleRequestExecutor::Cancel setting mWindow to nullptr. MozReview-Commit-ID: F2Up5mItkqN --- dom/base/nsGlobalWindow.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 560f47584ef6..2d836f7477d2 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -612,9 +612,11 @@ IdleRequestExecutor::SetDeadline(TimeStamp aDeadline) void IdleRequestExecutor::MaybeDispatch() { - MOZ_DIAGNOSTIC_ASSERT(mWindow); - - if (mDispatched) { + // If we've already dispatched the executor we don't want to do it + // again. Also, if we've called IdleRequestExecutor::Cancel mWindow + // will be null, which indicates that we shouldn't dispatch this + // executor either. + if (mDispatched || !mWindow) { return; } From e22752b858aaa866d966b5fa132d38c38e512b4a Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Sun, 5 Feb 2017 10:26:09 -0500 Subject: [PATCH 45/70] Bug 1209697 followup - Add comment to explain change that might not be clear given existing comments here and in nsChangeHint.h. --- layout/style/nsStyleStruct.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index abdb10e49c02..5f4eb3e42c0e 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1590,6 +1590,10 @@ nsStylePosition::CalcDifference(const nsStylePosition& aNewData, // also have percentage bsizes. This is handled via // nsChangeHint_UpdateComputedBSize which clears intrinsic sizes // for frames that have such replaced elements. + // + // We need to use nsChangeHint_ClearAncestorIntrinsics for + // block-size changes so we clear results of cached CSS Flex + // measuring reflows. hint |= nsChangeHint_NeedReflow | nsChangeHint_UpdateComputedBSize | nsChangeHint_ReflowChangesSizeOrPosition | From 7b0a9b6ebf0b279ed1353677e35c39a22d40ed5d Mon Sep 17 00:00:00 2001 From: ffxbld Date: Sun, 5 Feb 2017 07:38:30 -0800 Subject: [PATCH 46/70] No bug, Automated HSTS preload list update from host bld-linux64-spot-018 - a=hsts-update --- security/manager/ssl/nsSTSPreloadList.errors | 197 +- security/manager/ssl/nsSTSPreloadList.inc | 30096 +++++++++-------- 2 files changed, 15148 insertions(+), 15145 deletions(-) diff --git a/security/manager/ssl/nsSTSPreloadList.errors b/security/manager/ssl/nsSTSPreloadList.errors index b3899672a0db..d8efecedded2 100644 --- a/security/manager/ssl/nsSTSPreloadList.errors +++ b/security/manager/ssl/nsSTSPreloadList.errors @@ -5,6 +5,7 @@ 0x.sk: could not connect to host 0x1337.eu: could not connect to host 0x44.net: did not receive HSTS header +0xa.in: could not connect to host 0xb612.org: could not connect to host 0xf00.ch: did not receive HSTS header 100dayloans.com: max-age too low: 0 @@ -27,7 +28,6 @@ 1years.cc: did not receive HSTS header 206rc.net: max-age too low: 2592000 247loan.com: max-age too low: 0 -24hourpaint.com: could not connect to host 25daysof.io: could not connect to host 2600hq.com: could not connect to host 2859cc.com: could not connect to host @@ -88,7 +88,6 @@ accountradar.com: could not connect to host accuenergy.com: max-age too low: 0 acgmoon.org: did not receive HSTS header acisonline.net: did not receive HSTS header -acmle.com: could not connect to host acorns.com: did not receive HSTS header acr.im: could not connect to host acslimited.co.uk: did not receive HSTS header @@ -117,6 +116,7 @@ adquisitio.de: could not connect to host adquisitio.es: could not connect to host adquisitio.fr: could not connect to host adquisitio.it: could not connect to host +adrianseo.ro: did not receive HSTS header adrl.ca: could not connect to host adsfund.org: could not connect to host advancedstudio.ro: did not receive HSTS header @@ -131,6 +131,7 @@ aficotroceni.ro: did not receive HSTS header afp548.tk: could not connect to host agalaxyfarfaraway.co.uk: could not connect to host agbremen.de: did not receive HSTS header +agdalieso.com.ba: did not receive HSTS header agilebits.net: could not connect to host agrias.com.br: could not connect to host agrimap.com: did not receive HSTS header @@ -173,10 +174,9 @@ alethearose.com: did not receive HSTS header alexandre.sh: did not receive HSTS header alexisabarca.com: did not receive HSTS header alexsergeyev.com: could not connect to host -alisync.com: could not connect to host alittlebitcheeky.com: did not receive HSTS header alkami.com: did not receive HSTS header -all-subtitles.com: could not connect to host +all-subtitles.com: did not receive HSTS header all.tf: could not connect to host alldaymonitoring.com: could not connect to host allforyou.at: could not connect to host @@ -186,14 +186,13 @@ allo-symo.fr: could not connect to host allstarswithus.com: could not connect to host alpha.irccloud.com: could not connect to host alphabit-secure.com: could not connect to host -alphabuild.io: could not connect to host +alphabuild.io: did not receive HSTS header alphalabs.xyz: could not connect to host alt33c3.org: could not connect to host altfire.ca: could not connect to host altmv.com: max-age too low: 7776000 alwaysmine.fi: did not receive HSTS header amaforums.org: could not connect to host -amani-kinderdorf.de: could not connect to host amavis.org: did not receive HSTS header ameho.me: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] american-truck-simulator.de: could not connect to host @@ -222,6 +221,7 @@ andreastoneman.com: could not connect to host andreigec.net: did not receive HSTS header andrewbroekman.com: could not connect to host andrewmichaud.beer: could not connect to host +andrewx.net: did not receive HSTS header andreypopp.com: could not connect to host androoz.se: did not receive HSTS header andymartin.cc: did not receive HSTS header @@ -254,6 +254,7 @@ antscript.com: did not receive HSTS header any.pm: could not connect to host anycoin.me: could not connect to host apachelounge.com: did not receive HSTS header +apbox.de: could not connect to host apeasternpower.com: max-age too low: 0 api.mega.co.nz: could not connect to host apibot.de: could not connect to host @@ -282,7 +283,6 @@ aran.me.uk: could not connect to host arbeitslosenverwaltung.de: did not receive HSTS header arboineuropa.nl: did not receive HSTS header arbu.eu: could not connect to host -arctic.gov: did not receive HSTS header arlen.se: could not connect to host armory.consulting: could not connect to host armory.supplies: could not connect to host @@ -321,6 +321,7 @@ atavio.at: could not connect to host atavio.ch: could not connect to host atavio.de: did not receive HSTS header atbeckett.com: did not receive HSTS header +atelierdesflammesnoires.fr: could not connect to host athaliasoft.com: did not receive HSTS header athenelive.com: could not connect to host athul.xyz: did not receive HSTS header @@ -346,7 +347,6 @@ authentication.io: could not connect to host authoritynutrition.com: did not receive HSTS header auto-serwis.zgorzelec.pl: did not receive HSTS header auto4trade.nl: could not connect to host -autoepc.ro: did not receive HSTS header autojuhos.sk: did not receive HSTS header autokovrik-diskont.ru: did not receive HSTS header autotsum.com: could not connect to host @@ -366,7 +366,6 @@ axeny.com: did not receive HSTS header az.search.yahoo.com: did not receive HSTS header azabani.com: could not connect to host azprep.us: could not connect to host -aztrix.me: could not connect to host b3orion.com: max-age too low: 0 babelfisch.eu: could not connect to host baby-click.de: did not receive HSTS header @@ -375,7 +374,6 @@ babyhouse.xyz: could not connect to host babysaying.me: could not connect to host bacchanallia.com: could not connect to host back-bone.nl: did not receive HSTS header -backeby.eu: could not connect to host bacon-monitoring.org: could not connect to host badcronjob.com: could not connect to host badkamergigant.com: could not connect to host @@ -386,15 +384,12 @@ bakkerdesignandbuild.com: did not receive HSTS header balcan-underground.net: could not connect to host baldwinkoo.com: could not connect to host baleares.party: could not connect to host -balloonphp.com: could not connect to host bandb.xyz: could not connect to host bandrcrafts.com: could not connect to host bannisbierblog.de: could not connect to host banqingdiao.com: could not connect to host bardiharborow.tk: could not connect to host barely.sexy: did not receive HSTS header -bartelt.name: could not connect to host -bartula.de: could not connect to host bashcode.ninja: could not connect to host basicsolutionsus.com: did not receive HSTS header basilisk.io: could not connect to host @@ -435,6 +430,7 @@ beneffy.com: did not receive HSTS header benk.press: could not connect to host benny003.de: did not receive HSTS header benzkosmetik.de: could not connect to host +berasavocate.com: could not connect to host berger.work: did not receive HSTS header berlatih.com: could not connect to host berlinleaks.com: could not connect to host @@ -479,7 +475,6 @@ bionicspirit.com: could not connect to host biophysik-ssl.de: did not receive HSTS header biou.me: could not connect to host birkman.com: did not receive HSTS header -bismarck.moe: did not receive HSTS header bitchan.it: could not connect to host bitcoinworld.me: could not connect to host bitconcepts.co.uk: could not connect to host @@ -507,6 +502,7 @@ black-armada.com.pl: could not connect to host black-armada.pl: could not connect to host blackburn.link: could not connect to host blacklane.com: did not receive HSTS header +blackly.uk: max-age too low: 0 blackpayment.ru: could not connect to host blackscytheconsulting.com: could not connect to host blackunicorn.wtf: could not connect to host @@ -523,7 +519,6 @@ bloglikepro.com: could not connect to host blubbablasen.de: could not connect to host blucas.org: did not receive HSTS header blueglobalmedia.com: max-age too low: 0 -blueimp.net: did not receive HSTS header blueliv.com: did not receive HSTS header bluescloud.xyz: could not connect to host bluetenmeer.com: did not receive HSTS header @@ -572,9 +567,9 @@ brandon.so: could not connect to host brandred.net: could not connect to host brandspray.com: did not receive HSTS header bratislava-airport-taxi.com: could not connect to host -brettabel.com: did not receive HSTS header brianmwaters.net: did not receive HSTS header brickoo.com: could not connect to host +brid.gy: did not receive HSTS header britzer-toner.de: did not receive HSTS header brks.xyz: could not connect to host broken-oak.com: could not connect to host @@ -587,8 +582,10 @@ bsquared.org: could not connect to host btcdlc.com: could not connect to host buchheld.at: did not receive HSTS header bucket.tk: could not connect to host +budger.nl: could not connect to host budgetthostels.nl: did not receive HSTS header budskap.eu: could not connect to host +bugs.chromium.org: did not receive HSTS header (error ignored - included regardless) bugtrack.io: did not receive HSTS header buhler.pro: did not receive HSTS header buildci.asia: could not connect to host @@ -635,7 +632,6 @@ cake.care: could not connect to host calendarr.com: did not receive HSTS header calgaryconstructionjobs.com: did not receive HSTS header calix.com: max-age too low: 0 -call.me: did not receive HSTS header calltrackingreports.com: could not connect to host calvin.me: max-age too low: 2592000 calvinallen.net: did not receive HSTS header @@ -701,10 +697,11 @@ cfetengineering.com: could not connect to host cg.search.yahoo.com: did not receive HSTS header chainmonitor.com: could not connect to host chamathellawala.com: could not connect to host +chamilo.org: could not connect to host championsofregnum.com: did not receive HSTS header chandlerredding.com: could not connect to host changelab.cc: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] -changetip.com: did not receive HSTS header +changetip.com: could not connect to host chaos.fail: did not receive HSTS header chargejuice.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] charityclear.com: did not receive HSTS header @@ -723,7 +720,7 @@ checkout.google.com: did not receive HSTS header (error ignored - included regar cheerflow.com: could not connect to host cheesetart.my: could not connect to host chejianer.cn: did not receive HSTS header -chensir.net: max-age too low: 7776000 +chensir.net: could not connect to host cherysunzhang.com: max-age too low: 7776000 chihiro.xyz: could not connect to host chijiokeindustries.co.uk: could not connect to host @@ -754,7 +751,7 @@ chroniclesofgeorge.com: did not receive HSTS header chrst.ph: could not connect to host chua.cf: could not connect to host chuckame.fr: could not connect to host -chulado.com: could not connect to host +chulado.com: did not receive HSTS header cidr.ml: could not connect to host cig-dem.com: could not connect to host cigarblogs.net: could not connect to host @@ -824,9 +821,9 @@ codeforce.io: could not connect to host codelayer.ca: could not connect to host codemonkeyrawks.net: could not connect to host codepoet.de: could not connect to host -codepult.com: could not connect to host codepx.com: did not receive HSTS header codereview.appspot.com: did not receive HSTS header (error ignored - included regardless) +codereview.chromium.org: did not receive HSTS header (error ignored - included regardless) codiva.io: max-age too low: 2592000 coffeeetc.co.uk: did not receive HSTS header coffeestrategies.com: max-age too low: 2592000 @@ -845,6 +842,7 @@ comfy.moe: could not connect to host comicspines.com: could not connect to host compalytics.com: could not connect to host comparejewelleryprices.co.uk: could not connect to host +compiledworks.com: could not connect to host completeid.com: max-age too low: 86400 completionist.audio: could not connect to host compucorner.com.mx: could not connect to host @@ -863,6 +861,7 @@ contarkos.xyz: could not connect to host content-api-dev.azurewebsites.net: could not connect to host continuumgaming.com: could not connect to host controlcenter.gigahost.dk: did not receive HSTS header +convert.zone: could not connect to host cookingreporter.com: did not receive HSTS header coolchevy.org.ua: could not connect to host cor-ser.es: could not connect to host @@ -887,7 +886,6 @@ coursella.com: did not receive HSTS header covenantbank.net: could not connect to host coverduck.ru: could not connect to host cpuvinf.eu.org: could not connect to host -cpvmatch.eu: could not connect to host cr.search.yahoo.com: did not receive HSTS header cracking.org: did not receive HSTS header craftbeerbarn.co.uk: could not connect to host @@ -945,7 +943,6 @@ cupidmentor.com: did not receive HSTS header curlybracket.co.uk: could not connect to host curroapp.com: could not connect to host custe.rs: could not connect to host -cutorrent.com: could not connect to host cuvva.insure: did not receive HSTS header cyanogenmod.xxx: could not connect to host cyberpunk.ca: could not connect to host @@ -1000,6 +997,7 @@ datenreiter.ml: could not connect to host datenreiter.tk: could not connect to host datewon.net: did not receive HSTS header davidglidden.eu: could not connect to host +davidgreig.uk: did not receive HSTS header davidgrudl.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] davidhunter.scot: did not receive HSTS header davidnoren.com: did not receive HSTS header @@ -1014,6 +1012,7 @@ dcurt.is: did not receive HSTS header dden.ca: could not connect to host dden.website: could not connect to host dden.xyz: could not connect to host +dealpass.no: could not connect to host deanjerkovich.com: could not connect to host debank.tv: did not receive HSTS header debatch.se: could not connect to host @@ -1058,8 +1057,7 @@ despora.de: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR destinationbijoux.fr: could not connect to host destom.be: could not connect to host detector.exposed: could not connect to host -devcu.com: could not connect to host -devcu.net: could not connect to host +devcu.net: did not receive HSTS header deviltracks.net: could not connect to host devincrow.me: could not connect to host devtub.com: could not connect to host @@ -1112,7 +1110,6 @@ dollywiki.co.uk: could not connect to host dolphin-cloud.com: could not connect to host dolphincorp.co.uk: could not connect to host domaris.de: did not receive HSTS header -dominikkulaga.pl: could not connect to host dominique-mueller.de: did not receive HSTS header donttrustrobots.nl: could not connect to host donzelot.co.uk: max-age too low: 3600 @@ -1155,14 +1152,12 @@ duria.de: max-age too low: 3600 dustri.org: did not receive HSTS header dutchrank.com: could not connect to host dwhd.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] -dworzak.ch: could not connect to host dxa.io: could not connect to host dycontrol.de: could not connect to host dylanscott.com.au: did not receive HSTS header dymersion.com: did not receive HSTS header dzimejl.sk: did not receive HSTS header dzlibs.io: could not connect to host -dzndk.net: could not connect to host dzndk.org: could not connect to host e-deca2.org: did not receive HSTS header e-sa.com: did not receive HSTS header @@ -1197,7 +1192,6 @@ edmodo.com: did not receive HSTS header edp-collaborative.com: max-age too low: 2500 eduvance.in: did not receive HSTS header edxg.de: could not connect to host -eenhoorn.ga: did not receive HSTS header efficienthealth.com: did not receive HSTS header effortlesshr.com: did not receive HSTS header egg-ortho.ch: did not receive HSTS header @@ -1207,7 +1201,6 @@ ego-world.org: could not connect to host ehrenamt-skpfcw.de: could not connect to host eicfood.com: could not connect to host eidolonhost.com: did not receive HSTS header -ejeff.org: did not receive HSTS header ekbanden.nl: could not connect to host ekostecki.de: did not receive HSTS header elaintehtaat.fi: did not receive HSTS header @@ -1252,7 +1245,6 @@ end.pp.ua: could not connect to host endlessdark.net: max-age too low: 600 endlesstone.com: did not receive HSTS header enersec.co.uk: could not connect to host -enfoqueseguro.com: did not receive HSTS header engelwerbung.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] enigmacpt.com: did not receive HSTS header enigmail.net: did not receive HSTS header @@ -1303,12 +1295,13 @@ etdonline.co.uk: could not connect to host eternitylove.us: could not connect to host ethanfaust.com: could not connect to host ethicalexploiting.com: could not connect to host -etrker.com: could not connect to host +etrker.com: did not receive HSTS header etsysecure.com: could not connect to host etula.ga: could not connect to host etula.me: could not connect to host euanbaines.com: did not receive HSTS header eucl3d.com: did not receive HSTS header +euclideanpostulates.xyz: could not connect to host eulerpi.io: could not connect to host euph.eu: did not receive HSTS header eupho.me: could not connect to host @@ -1324,7 +1317,6 @@ evomon.com: could not connect to host evossd.tk: could not connect to host ewuchuan.com: could not connect to host excelgum.ca: did not receive HSTS header -exceptionalservers.com: could not connect to host exfiles.cz: did not receive HSTS header exgravitus.com: could not connect to host exitus.jp: max-age too low: 0 @@ -1349,7 +1341,6 @@ fabianfischer.de: did not receive HSTS header facebook-atom.appspot.com: did not receive HSTS header factorable.net: did not receive HSTS header factorygw.com: did not receive HSTS header -fadednet.com: could not connect to host fadilus.com: did not receive HSTS header faesser.com: did not receive HSTS header fail4free.de: did not receive HSTS header @@ -1436,6 +1427,8 @@ fleurette.me: max-age too low: 0 fliexer.com: could not connect to host flirchi.com: did not receive HSTS header floless.co.uk: did not receive HSTS header +floort.net: could not connect to host +florent-tatard.fr: could not connect to host florian-lillpopp.de: max-age too low: 10 florianlillpopp.de: max-age too low: 10 floridaescapes.co.uk: did not receive HSTS header @@ -1496,12 +1489,12 @@ frforms.com: did not receive HSTS header friendica.ch: could not connect to host frizo.com: did not receive HSTS header froggstack.de: could not connect to host +fromscratch.rocks: could not connect to host frontmin.com: did not receive HSTS header frost-ci.xyz: could not connect to host frosty-gaming.xyz: did not receive HSTS header fruitusers.com: could not connect to host frusky.net: could not connect to host -fsf.moe: could not connect to host fspphoto.com: could not connect to host ftctele.com: did not receive HSTS header fuckbilibili.com: did not receive HSTS header @@ -1525,13 +1518,14 @@ g2a.co: did not receive HSTS header g2g.com: did not receive HSTS header g4w.co: did not receive HSTS header (error ignored - included regardless) gabber.scot: could not connect to host -gaelleetarnaud.com: did not receive HSTS header +gaelleetarnaud.com: could not connect to host gafachi.com: could not connect to host gakkainavi4.com: could not connect to host galardi.org: did not receive HSTS header galenskap.eu: could not connect to host gallery44.org: did not receive HSTS header galoisvpn.xyz: could not connect to host +game.yt: could not connect to host gamecave.de: could not connect to host gamechasm.com: could not connect to host gamefund.me: did not receive HSTS header @@ -1551,7 +1545,7 @@ garbage-juice.com: could not connect to host garciamartin.me: could not connect to host garden-life.org: could not connect to host gatapro.net: could not connect to host -gatilagata.com.br: did not receive HSTS header +gatilagata.com.br: could not connect to host gchq.wtf: could not connect to host gdpventure.com: max-age too low: 0 gedankenbude.info: did not receive HSTS header @@ -1647,7 +1641,6 @@ gogold-g.com: could not connect to host gold24.in: did not receive HSTS header goldendata.io: could not connect to host golocal-media.de: did not receive HSTS header -gonkar.com: did not receive HSTS header gonzalosanchez.mx: did not receive HSTS header goodenough.nz: did not receive HSTS header goodwin43.ru: could not connect to host @@ -1658,19 +1651,23 @@ goolok.com: could not connect to host gorilla-gym.site: could not connect to host gotech.com.eg: did not receive HSTS header goto.google.com: did not receive HSTS header (error ignored - included regardless) -goto.world: did not receive HSTS header +goto.world: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] gotowned.org: did not receive HSTS header gotspot.com: could not connect to host gottcode.org: did not receive HSTS header gov.ax: could not connect to host govillemo.ca: did not receive HSTS header +gozel.com.tr: did not receive HSTS header gparent.org: did not receive HSTS header gpsfix.cz: could not connect to host gpstuner.com: did not receive HSTS header gracesofgrief.com: max-age too low: 86400 +gracethrufaith.com: could not connect to host gradienthosting.co.uk: did not receive HSTS header granary-demo.appspot.com: did not receive HSTS header grandmascookieblog.com: did not receive HSTS header +grantedby.me: could not connect to host +granular.ag: could not connect to host graph.no: did not receive HSTS header gravito.nl: did not receive HSTS header gravity-net.de: could not connect to host @@ -1705,9 +1702,6 @@ gulenet.com: could not connect to host gunnarhafdal.com: did not receive HSTS header gurom.lv: could not connect to host gurusupe.com: could not connect to host -guso.ml: could not connect to host -guso.site: could not connect to host -guso.tech: could not connect to host gussi.is: could not connect to host gvt2.com: could not connect to host (error ignored - included regardless) gvt3.com: could not connect to host (error ignored - included regardless) @@ -1727,7 +1721,6 @@ habbo.life: did not receive HSTS header hablemosdetecnologia.com.ve: could not connect to host hack.cz: could not connect to host hack.li: did not receive HSTS header -hackcraft.net: could not connect to host hacker.one: could not connect to host hackerforever.com: did not receive HSTS header hackernet.se: could not connect to host @@ -1752,10 +1745,10 @@ hansen.hn: could not connect to host hao2taiwan.com: max-age too low: 0 haoyugao.com: could not connect to host hapissl.com: could not connect to host -hapivm.com: could not connect to host happyfabric.me: did not receive HSTS header happygadget.me: could not connect to host happygastro.com: could not connect to host +hapvm.com: could not connect to host harabuhouse.com: did not receive HSTS header harbor-light.net: could not connect to host hardline.xyz: could not connect to host @@ -1798,8 +1791,9 @@ helpmebuild.com: did not receive HSTS header hemdal.se: could not connect to host hencagon.com: could not connect to host henriknoerr.com: could not connect to host +henrock.net: could not connect to host hermes-net.de: could not connect to host -herpaderp.net: did not receive HSTS header +herpaderp.net: could not connect to host herzbotschaft.de: did not receive HSTS header hibilog.com: could not connect to host hicn.gq: could not connect to host @@ -1822,6 +1816,7 @@ hn.search.yahoo.com: did not receive HSTS header hodne.io: could not connect to host hoerbuecher-und-hoerspiele.de: could not connect to host hogar123.es: could not connect to host +hokieprivacy.org: could not connect to host holifestival-freyung.de: could not connect to host holymoly.lu: could not connect to host homa.website: could not connect to host @@ -1855,7 +1850,6 @@ hsir.me: could not connect to host hsts.date: could not connect to host hstsfail.appspot.com: did not receive HSTS header hstspreload.appspot.com: did not receive HSTS header -hstspreload.org: did not receive HSTS header http418.xyz: could not connect to host httpstatuscode418.xyz: could not connect to host hu.search.yahoo.com: did not receive HSTS header @@ -1959,6 +1953,7 @@ inkstory.gr: did not receive HSTS header inksupply.com: did not receive HSTS header inleaked.com: could not connect to host inmyarea.com: max-age too low: 0 +innoloop.com: did not receive HSTS header innophate-security.nl: could not connect to host ins1gn1a.com: did not receive HSTS header insane-bullets.com: could not connect to host @@ -1971,12 +1966,12 @@ instagram-atom.appspot.com: did not receive HSTS header installgentoo.net: could not connect to host instantdev.io: could not connect to host institutoflordelavida.com: could not connect to host +institutolancaster.com: could not connect to host intarweb.ca: could not connect to host intel.li: could not connect to host intelldynamics.com: could not connect to host interference.io: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] interlun.com: could not connect to host -internect.co.za: did not receive HSTS header internetcasinos.de: could not connect to host internetcensus.org: could not connect to host interserved.com: did not receive HSTS header @@ -1986,7 +1981,7 @@ intimtoy.com.ua: could not connect to host inverselink-user-content.com: could not connect to host inverselink.com: could not connect to host invite24.pro: could not connect to host -inwesttitle.com: max-age too low: 0 +inwesttitle.com: could not connect to host ionx.co.uk: did not receive HSTS header iop.intuit.com: max-age too low: 86400 iosmods.com: could not connect to host @@ -2014,6 +2009,7 @@ isitamor.pm: could not connect to host iskaz.rs: did not receive HSTS header israkurort.com: did not receive HSTS header istaspirtslietas.lv: did not receive HSTS header +isteinbaby.de: could not connect to host it-go.net: did not receive HSTS header itechgeek.com: max-age too low: 0 itos.asia: did not receive HSTS header @@ -2022,6 +2018,7 @@ itriskltd.com: could not connect to host itsadog.co.uk: did not receive HSTS header itsagadget.com: did not receive HSTS header itsamurai.ru: max-age too low: 2592000 +itsatrap.nl: could not connect to host itsecurityassurance.pw: could not connect to host itsg-faq.de: could not connect to host itshost.ru: could not connect to host @@ -2072,7 +2069,6 @@ jasonroe.me: did not receive HSTS header jasonsansone.com: could not connect to host jastoria.pl: could not connect to host jayblock.com: did not receive HSTS header -jayf.de: could not connect to host jayschulman.com: could not connect to host jayscoaching.com: could not connect to host jayshao.com: did not receive HSTS header @@ -2128,7 +2124,6 @@ joshi.su: could not connect to host joshstroup.me: could not connect to host jottit.com: could not connect to host jpbike.cz: could not connect to host -jpcdi.com: could not connect to host jrc9.ca: did not receive HSTS header jrgold.me: could not connect to host jrmd.io: could not connect to host @@ -2174,10 +2169,12 @@ katproxy.site: could not connect to host katproxy.tech: could not connect to host kaufkraftkiel.de: could not connect to host kausch.at: did not receive HSTS header +kavinvin.me: did not receive HSTS header kawaii.io: could not connect to host kawaiiku.com: could not connect to host kawaiiku.de: could not connect to host kayon.cf: could not connect to host +kcptun.com: could not connect to host kd-plus.pp.ua: could not connect to host kdata.it: did not receive HSTS header kdm-online.de: did not receive HSTS header @@ -2192,6 +2189,7 @@ kenderbeton-magyarorszag.hu: did not receive HSTS header kenderbetonmagyarorszag.hu: did not receive HSTS header kenderhaz-magyarorszag.hu: did not receive HSTS header kenderhazmagyarorszag.hu: did not receive HSTS header +kennethlim.me: could not connect to host kerangalam.com: could not connect to host kerksanders.nl: did not receive HSTS header kermadec.net: could not connect to host @@ -2204,7 +2202,6 @@ kickass.al: could not connect to host kid-dachau.de: did not receive HSTS header kiel-media.de: did not receive HSTS header kienlen.org: could not connect to host -kimberg.co.uk: could not connect to host kimpost.org: could not connect to host kinderly.co.uk: did not receive HSTS header kinderwagen-test24.de: could not connect to host @@ -2250,6 +2247,7 @@ kollabria.com: max-age too low: 0 komikito.com: could not connect to host kompetenzwerft.de: did not receive HSTS header konata.us: could not connect to host +kongar.org: could not connect to host kontaxis.network: could not connect to host kontorhaus-schlachte.de: could not connect to host koop-bremen.de: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -2263,10 +2261,8 @@ kotovstyle.ru: could not connect to host kr.search.yahoo.com: did not receive HSTS header kramsj.uk: could not connect to host krayx.com: could not connect to host -krc.link: could not connect to host -kreavis.com: could not connect to host +kreavis.com: did not receive HSTS header kredite.sale: could not connect to host -kriegskindernothilfe.de: could not connect to host kriegt.es: could not connect to host krmela.com: could not connect to host kroetenfuchs.de: could not connect to host @@ -2376,7 +2372,6 @@ lianye5.cc: could not connect to host lianye6.cc: could not connect to host lianyexiuchang.in: could not connect to host liaoshuma.com: could not connect to host -libbitcoin.org: did not receive HSTS header libertyrp.org: could not connect to host library.linode.com: did not receive HSTS header librechan.net: could not connect to host @@ -2436,7 +2431,6 @@ lookastic.mx: [Exception... "Component returned failure code: 0x80004005 (NS_ERR lookastic.ru: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] lookout.com: did not receive HSTS header lookzook.com: did not receive HSTS header -lordjevington.co.uk: could not connect to host lostinsecurity.com: could not connect to host lostinweb.eu: could not connect to host lothai.re: could not connect to host @@ -2444,6 +2438,7 @@ lotsencafe.de: did not receive HSTS header loveandadoreboutique.com: could not connect to host lovelifelovelive.com: could not connect to host lovelive.us: did not receive HSTS header +lovelyblogacademy.com: did not receive HSTS header lovelycorral.com: did not receive HSTS header loveto.at: could not connect to host lowhangingfruitgrabber.com: could not connect to host @@ -2492,14 +2487,11 @@ maartenvandekamp.nl: did not receive HSTS header mac-torrents.me: did not receive HSTS header macchaberrycream.com: could not connect to host macgeneral.de: did not receive HSTS header -machbach.com: could not connect to host -machbach.net: could not connect to host machon.biz: could not connect to host madars.org: did not receive HSTS header maddin.ga: could not connect to host madebymagnitude.com: did not receive HSTS header maderwin.com: could not connect to host -madreacqua.org: could not connect to host mae-berlinistanbul.com: could not connect to host mafamane.com: could not connect to host mafiaforum.de: did not receive HSTS header @@ -2523,6 +2515,7 @@ mammothmail.com: could not connect to host mammothmail.net: could not connect to host mammothmail.org: could not connect to host managemynetsuite.com: could not connect to host +manifestbin.com: did not receive HSTS header manningbrothers.com: did not receive HSTS header mannsolutions.co.uk: did not receive HSTS header mansion-note.com: did not receive HSTS header @@ -2558,13 +2551,14 @@ matchneedle.com: could not connect to host maternalsafety.org: did not receive HSTS header matrip.de: could not connect to host matrix.ac: did not receive HSTS header +matrixcheats.net: could not connect to host matsuz.com: could not connect to host mattberryman.com: did not receive HSTS header mattcoles.io: did not receive HSTS header mattfin.ch: could not connect to host matthewprenger.com: could not connect to host matthiassteen.be: max-age too low: 0 -mattsvensson.com: did not receive HSTS header +mattsvensson.com: could not connect to host mattwb65.com: could not connect to host matty.digital: max-age too low: 3600 maultrom.ml: could not connect to host @@ -2647,7 +2641,8 @@ micro-dv.ru: could not connect to host micro-rain-systems.com: did not receive HSTS header microme.ga: could not connect to host micropple.net: could not connect to host -midwestwomenworkers.org: could not connect to host +microtalk.org: could not connect to host +midwestwomenworkers.org: did not receive HSTS header mightydicks.io: could not connect to host mightydicks.tech: could not connect to host mightysounds.cz: max-age too low: 0 @@ -2657,6 +2652,7 @@ mikaelemilsson.net: did not receive HSTS header mikeburns.com: did not receive HSTS header mikecb.org: did not receive HSTS header mikeg.de: did not receive HSTS header +mikek.work: could not connect to host mikeology.org: could not connect to host mikeybot.com: could not connect to host mikonmaa.fi: could not connect to host @@ -2692,7 +2688,6 @@ mizd.at: could not connect to host mizi.name: did not receive HSTS header mkes.com: did not receive HSTS header mlpepilepsy.org: could not connect to host -mlvbphotography.com: did not receive HSTS header mmgazhomeloans.com: did not receive HSTS header mnemotiv.com: could not connect to host mnetworkingsolutions.co.uk: did not receive HSTS header @@ -2704,6 +2699,7 @@ mobilethreat.net: could not connect to host mobilethreatnetwork.net: could not connect to host mobilpass.no: could not connect to host mocloud.eu: could not connect to host +model9.io: could not connect to host modemagazines.co.uk: could not connect to host moebel-nagel.de: did not receive HSTS header moelord.org: could not connect to host @@ -2801,12 +2797,12 @@ myraytech.net: did not receive HSTS header mysecretrewards.com: did not receive HSTS header mystery-science-theater-3000.de: did not receive HSTS header mystudy.me: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] -mythslegendscollection.com: did not receive HSTS header myvirtualserver.com: max-age too low: 2592000 myzone.com: did not receive HSTS header n0psled.nl: could not connect to host n2x.in: could not connect to host n4l.pw: could not connect to host +nagelfam.com: could not connect to host nagoya-kyuyo.com: could not connect to host naiharngym.com: did not receive HSTS header najedlo.sk: did not receive HSTS header @@ -2823,7 +2819,6 @@ nanogeneinc.com: could not connect to host nanto.eu: could not connect to host narada.com.ua: could not connect to host nargileh.nl: could not connect to host -narindal.ch: did not receive HSTS header nassi.me: could not connect to host natalia-fadeeva.ru: could not connect to host natalia.io: could not connect to host @@ -2878,6 +2873,7 @@ new-process.eu: could not connect to host newcitygas.ca: could not connect to host newkaliningrad.ru: did not receive HSTS header newlooknow.com: did not receive HSTS header +newportpropertygroup.com: could not connect to host newtonwarp.com: could not connect to host nextcloud.org: could not connect to host nexth.de: could not connect to host @@ -2913,9 +2909,9 @@ nmctest.net: could not connect to host nnote.net: could not connect to host nnya.cat: could not connect to host no17sifangjie.cc: could not connect to host -nobly.de: could not connect to host nocallaghan.com: could not connect to host nocs.cn: could not connect to host +noctinus.tk: could not connect to host nodebrewery.com: could not connect to host nodetemple.com: could not connect to host nodi.at: could not connect to host @@ -3000,6 +2996,7 @@ okutama.in.th: could not connect to host olafnorge.de: could not connect to host olanderflorist.com: could not connect to host oldoakflorist.com: could not connect to host +oliveraiedelabastideblanche.fr: could not connect to host oliverdunk.com: did not receive HSTS header ollehbizev.co.kr: could not connect to host ollie.io: did not receive HSTS header @@ -3018,7 +3015,6 @@ onet.space: could not connect to host oniichan.us: did not receive HSTS header online-casino.eu: did not receive HSTS header online-wetten.de: did not receive HSTS header -online.marketing: did not receive HSTS header onlinecompliance.org: did not receive HSTS header onlinedeposit.us: could not connect to host onlinekasino.de: did not receive HSTS header @@ -3133,6 +3129,7 @@ parodybit.net: [Exception... "Component returned failure code: 0x80004005 (NS_ER parpaing-paillette.net: could not connect to host particonpsplus.it: did not receive HSTS header partijtjevoordevrijheid.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] +partirkyoto.jp: did not receive HSTS header partou.de: did not receive HSTS header partyvan.it: could not connect to host partyvan.moe: could not connect to host @@ -3170,6 +3167,7 @@ pekkapikkarainen.fi: did not receive HSTS header pekkarik.ru: could not connect to host penguinclientsystem.com: did not receive HSTS header pensacolawinterfest.org: could not connect to host +pentandra.com: could not connect to host pepperhead.com: did not receive HSTS header pepperworldhotshop.de: did not receive HSTS header perfectionis.me: could not connect to host @@ -3267,9 +3265,11 @@ pontokay.com.br: did not receive HSTS header pontualcomp.com: max-age too low: 2592000 poolsandstuff.com: did not receive HSTS header poon.tech: could not connect to host +pornstars.me: could not connect to host portalplatform.net: did not receive HSTS header poshpak.com: max-age too low: 86400 postcodewise.co.uk: did not receive HSTS header +posterspy.com: did not receive HSTS header postscheduler.org: could not connect to host posylka.de: did not receive HSTS header poussinooz.fr: could not connect to host @@ -3285,7 +3285,6 @@ prego-shop.de: did not receive HSTS header preissler.co.uk: could not connect to host prelist.org: did not receive HSTS header pressfreedomfoundation.org: did not receive HSTS header -pressrush.com: could not connect to host pretzlaff.info: did not receive HSTS header preworkout.me: could not connect to host prezola.com: did not receive HSTS header @@ -3301,6 +3300,7 @@ pro-zone.com: could not connect to host prodpad.com: did not receive HSTS header professionalboundaries.com: did not receive HSTS header profi-durchgangsmelder.de: did not receive HSTS header +profpay.com: could not connect to host profundr.com: could not connect to host progblog.net: could not connect to host progg.no: could not connect to host @@ -3358,6 +3358,7 @@ quantacloud.ch: could not connect to host quantenteranik.eu: could not connect to host quantum-cloud.xyz: could not connect to host quantumcourse.org: did not receive HSTS header +quantumfurball.net: could not connect to host queercoders.com: did not receive HSTS header questsandrewards.com: could not connect to host quli.nl: did not receive HSTS header @@ -3368,12 +3369,12 @@ qwaser.fr: could not connect to host qwilink.me: did not receive HSTS header r10n.com: did not receive HSTS header r15.me: could not connect to host -r2d2pc.com: could not connect to host r3bl.me: did not receive HSTS header raajheshkannaa.com: could not connect to host radicaleducation.net: could not connect to host rafaelcz.de: could not connect to host railgun.com.cn: could not connect to host +railjob.cn: could not connect to host rainbowbarracuda.com: could not connect to host ramonj.nl: could not connect to host randomcage.com: did not receive HSTS header @@ -3401,6 +3402,7 @@ rcpcbd.com: did not receive HSTS header rdns.im: did not receive HSTS header re-customer.net: could not connect to host readr.pw: could not connect to host +readytongue.com: could not connect to host realmic.net: could not connect to host realmofespionage.com: could not connect to host reardenporn.com: could not connect to host @@ -3443,6 +3445,7 @@ res42.com: could not connect to host research.facebook.com: did not receive HSTS header reserve-online.net: did not receive HSTS header respice.xyz: could not connect to host +responsibledisclosure.nl: could not connect to host respostas.com.br: did not receive HSTS header restchart.com: did not receive HSTS header retrotracks.net: max-age too low: 0 @@ -3473,7 +3476,6 @@ ringh.am: could not connect to host rippleunion.com: could not connect to host riskmgt.com.au: could not connect to host rivastation.de: did not receive HSTS header -riverbanktearooms.co.uk: could not connect to host rj.gg: could not connect to host rk6.cz: could not connect to host rkmantpur.org: did not receive HSTS header @@ -3492,11 +3494,11 @@ roddis.net: did not receive HSTS header rodney.id.au: did not receive HSTS header rodosto.com: did not receive HSTS header roeper.party: could not connect to host -roflcopter.fr: did not receive HSTS header +rogerbastien.com: could not connect to host roguesignal.net: did not receive HSTS header rolandszabo.com: could not connect to host rolemaster.net: could not connect to host -romans-place.me.uk: did not receive HSTS header +romans-place.me.uk: could not connect to host ron2k.za.net: could not connect to host ronvandordt.info: could not connect to host ronwo.de: max-age too low: 1 @@ -3542,6 +3544,7 @@ rxv.cc: could not connect to host ryansmithphotography.com: did not receive HSTS header ryanteck.uk: did not receive HSTS header s.how: did not receive HSTS header +safelist.eu: did not receive HSTS header safematix.com: could not connect to host safewings-nh.nl: did not receive HSTS header safic.net: could not connect to host @@ -3615,7 +3618,6 @@ scriptict.nl: could not connect to host sdmoscow.ru: could not connect to host sdrobs.com: did not receive HSTS header sdsl-speedtest.de: could not connect to host -sealbaker.com: could not connect to host search-one.de: did not receive HSTS header sebster.com: did not receive HSTS header secandtech.com: could not connect to host @@ -3626,18 +3628,17 @@ secure.link: did not receive HSTS header securejabber.me: could not connect to host secureradio.net: could not connect to host securesuisse.ch: could not connect to host -securetheorem.com: did not receive HSTS header security-carpet.com: could not connect to host security.google.com: did not receive HSTS header (error ignored - included regardless) securitybsides.pl: did not receive HSTS header securityglance.com: could not connect to host +securityheaders.com: could not connect to host securityinet.biz: did not receive HSTS header securityinet.net: did not receive HSTS header securityinet.org.il: did not receive HSTS header securiviera.ch: did not receive HSTS header sedoexpert.nl: could not connect to host sedoexperts.nl: could not connect to host -sedziapilkarski.pl: could not connect to host seedbox.fr: did not receive HSTS header seedboxers.net: did not receive HSTS header seele.ca: could not connect to host @@ -3690,7 +3691,6 @@ shakepeers.org: did not receive HSTS header shanesage.com: could not connect to host shanewadleigh.com: could not connect to host shareimg.xyz: could not connect to host -shareoine.com: could not connect to host sharepass.pw: could not connect to host sharescope.co.uk: max-age too low: 14400 sharevari.com: did not receive HSTS header @@ -3712,6 +3712,7 @@ shoprose.ru: could not connect to host shops.neonisi.com: could not connect to host shortr.li: could not connect to host showkeeper.tv: did not receive HSTS header +shrike.me: could not connect to host shukatsu-note.com: could not connect to host shv25.se: could not connect to host shwongacc.com: could not connect to host @@ -3736,8 +3737,8 @@ simplefraud.com: [Exception... "Component returned failure code: 0x80004005 (NS_ simplelearner.com: could not connect to host simplepractice.com: did not receive HSTS header simply-premium.com: max-age too low: 0 +sin30.net: could not connect to host sincron.org: could not connect to host -sinquin.eu: could not connect to host siriad.com: did not receive HSTS header sirius-lee.net: could not connect to host sitennisclub.com: did not receive HSTS header @@ -3770,7 +3771,6 @@ sluitkampzeist.nl: [Exception... "Component returned failure code: 0x80004005 (N slycurity.de: did not receive HSTS header smart-mirror.de: did not receive HSTS header smart-ov.nl: could not connect to host -smartcheck.gov: did not receive HSTS header smartcoin.com.br: could not connect to host smartlend.se: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] smartofficesandsmarthomes.com: did not receive HSTS header @@ -3819,8 +3819,8 @@ someshit.xyz: could not connect to host somethingnew.xyz: did not receive HSTS header sonic.sk: max-age too low: 0 sonicrainboom.rocks: could not connect to host -sorincocorada.ro: could not connect to host -sotiran.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] +sortaweird.net: could not connect to host +sotiran.com: did not receive HSTS header sotor.de: did not receive HSTS header soulboy.io: did not receive HSTS header soulema.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -3852,7 +3852,6 @@ speedy.lt: max-age too low: 0 speidel.com.tr: did not receive HSTS header spencerbaer.com: could not connect to host sperohub.io: could not connect to host -sphereblur.com: did not receive HSTS header spherenix.org: could not connect to host spicydog.tk: could not connect to host spiegels.nl: could not connect to host @@ -3927,7 +3926,7 @@ stpatricksguild.com: did not receive HSTS header stqry.com: did not receive HSTS header str0.at: did not receive HSTS header strasweb.fr: did not receive HSTS header -streamingeverywhere.com: could not connect to host +streamingeverywhere.com: did not receive HSTS header streamingmagazin.de: could not connect to host streampanel.net: did not receive HSTS header streams.dyndns.org: could not connect to host @@ -3945,9 +3944,11 @@ studybay.com: did not receive HSTS header studydrive.net: did not receive HSTS header stugb.de: did not receive HSTS header stw-group.at: could not connect to host +stygium.net: could not connect to host stylenda.com: could not connect to host subbing.work: could not connect to host subdimension.org: could not connect to host +subeesu.com: could not connect to host subrosa.io: could not connect to host subsys.no: did not receive HSTS header subtitle.rip: could not connect to host @@ -3958,8 +3959,6 @@ suksit.com: could not connect to host sumoatm.com: did not receive HSTS header sumoscout.de: did not receive HSTS header suncountrymarine.com: did not receive HSTS header -sunflyer.cn: did not receive HSTS header -sunjaydhama.com: could not connect to host sunnyfruit.ru: did not receive HSTS header sunshinepress.org: could not connect to host supcro.com: could not connect to host @@ -3998,7 +3997,6 @@ syno.gq: could not connect to host syntheticmotoroil.org: did not receive HSTS header syriatalk.biz: could not connect to host syriatalk.org: could not connect to host -sysadmin.pm: could not connect to host sysadmin.xyz: did not receive HSTS header syso.name: could not connect to host szaszm.tk: max-age too low: 0 @@ -4021,7 +4019,7 @@ tangibilizing.com: could not connect to host tapfinder.ca: could not connect to host tapka.cz: did not receive HSTS header tappublisher.com: did not receive HSTS header -taravancil.com: could not connect to host +taravancil.com: did not receive HSTS header tarhauskielto.fi: did not receive HSTS header tartaros.fi: could not connect to host taskstats.com: could not connect to host @@ -4056,7 +4054,6 @@ techmatehq.com: could not connect to host technogroup.cz: did not receive HSTS header technosavvyport.com: did not receive HSTS header techpointed.com: could not connect to host -tedb.us: did not receive HSTS header tegelsensanitaironline.nl: did not receive HSTS header tekshrek.com: did not receive HSTS header telefonnummer.online: could not connect to host @@ -4103,8 +4100,10 @@ theclubjersey.com: did not receive HSTS header thecoffeehouse.xyz: could not connect to host thediaryofadam.com: did not receive HSTS header theendofzion.com: did not receive HSTS header +theeyeopener.com: did not receive HSTS header theflowerbasketonline.com: could not connect to host thefootballanalyst.com: could not connect to host +thefrozenfire.com: did not receive HSTS header thegcccoin.com: did not receive HSTS header thehiddenbay.eu: could not connect to host thehiddenbay.me: could not connect to host @@ -4175,7 +4174,6 @@ titouan.co: did not receive HSTS header tittelbach.at: did not receive HSTS header titties.ml: could not connect to host tkarstens.de: did not receive HSTS header -tlach.cz: did not receive HSTS header tlo.hosting: could not connect to host tlo.link: did not receive HSTS header tlo.network: could not connect to host @@ -4194,7 +4192,6 @@ tobiasofficial.at: could not connect to host todamateria.com.br: did not receive HSTS header todo.is: did not receive HSTS header todobazar.es: could not connect to host -tokage.me: could not connect to host tollmanz.com: did not receive HSTS header tom.horse: did not receive HSTS header tomask.info: did not receive HSTS header @@ -4206,7 +4203,7 @@ tomharris.tech: did not receive HSTS header tomlankhorst.nl: did not receive HSTS header tommsy.com: did not receive HSTS header tommyads.com: could not connect to host -tonburi.jp: did not receive HSTS header +tonburi.jp: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] tonsit.org: did not receive HSTS header tonyfantjr.com: could not connect to host toomanypillows.com: could not connect to host @@ -4216,6 +4213,7 @@ topmarine.se: could not connect to host topnewstoday.org: could not connect to host topshelfguild.com: could not connect to host torahanytime.com: did not receive HSTS header +toretfaction.net: could not connect to host tosecure.link: could not connect to host toshnix.com: could not connect to host totem-eshop.cz: could not connect to host @@ -4234,6 +4232,7 @@ translate.googleapis.com: did not receive HSTS header (error ignored - included transportal.sk: did not receive HSTS header treeby.net: could not connect to host trendberry.ru: could not connect to host +trimage.org: could not connect to host trinityaffirmations.com: max-age too low: 0 trinitycore.org: max-age too low: 2592000 trior.net: could not connect to host @@ -4309,6 +4308,7 @@ ulmo.dk: could not connect to host ultros.io: did not receive HSTS header umidev.com: could not connect to host umie.cc: did not receive HSTS header +umwandeln-online.de: could not connect to host unbanthe.net: could not connect to host unblocked-networks.org: could not connect to host unblocked.host: could not connect to host @@ -4343,7 +4343,6 @@ upldr.pw: could not connect to host uprotect.it: could not connect to host upstats.eu: could not connect to host urandom.eu.org: did not receive HSTS header -url.rw: did not receive HSTS header urphp.com: could not connect to host us-immigration.com: did not receive HSTS header usaa.com: did not receive HSTS header @@ -4352,7 +4351,6 @@ uscurrency.gov: did not receive HSTS header used-in.jp: did not receive HSTS header usercare.com: did not receive HSTS header userify.com: max-age too low: 0 -uspsoig.gov: could not connect to host ussm.gov: could not connect to host ustr.gov: max-age too low: 86400 utleieplassen.no: could not connect to host @@ -4398,7 +4396,6 @@ verifikatorindonesia.com: could not connect to host vermontcareergateway.org: could not connect to host versia.ru: did not receive HSTS header veryhax.de: could not connect to host -vestacp.top: could not connect to host vetmgmt.com: could not connect to host vfree.org: could not connect to host vglimg.com: could not connect to host @@ -4406,6 +4403,7 @@ vhost.co.id: could not connect to host vicenage.com: could not connect to host videnskabsklubben.dk: did not receive HSTS header videomuz.com: did not receive HSTS header +videosqr.com: could not connect to host vidz.ga: could not connect to host vieaw.com: could not connect to host viewsea.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -4420,6 +4418,7 @@ vio.no: did not receive HSTS header viperdns.com: could not connect to host vipi.es: could not connect to host vipmusic.ga: could not connect to host +virtuallifestyle.nl: could not connect to host visiontree-beta.eu: could not connect to host visitbroadstairs.com: could not connect to host vissanum.com: did not receive HSTS header @@ -4431,6 +4430,7 @@ vlora.city: could not connect to host vm0.eu: did not receive HSTS header vmrdev.com: could not connect to host voceinveste.com: did not receive HSTS header +vodpay.com: could not connect to host vodpay.net: could not connect to host vodpay.org: could not connect to host voicesuk.co.uk: did not receive HSTS header @@ -4563,6 +4563,7 @@ wikisports.eu: could not connect to host wilf1rst.com: could not connect to host willcipriano.com: could not connect to host william.si: did not receive HSTS header +williamsonshore.com: could not connect to host willosagiede.com: did not receive HSTS header winaes.com: did not receive HSTS header winclient.cn: could not connect to host @@ -4576,7 +4577,6 @@ winpack.eu.org: could not connect to host winsec.nl: did not receive HSTS header winshiplending.com: did not receive HSTS header winterschoen.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] -wintodoor.com: could not connect to host wirc.gr: could not connect to host wiseloan.com: did not receive HSTS header wishcert.com: could not connect to host @@ -4639,7 +4639,7 @@ www.rme.li: did not receive HSTS header www.sandbox.mydigipass.com: could not connect to host www.surfeasy.com: did not receive HSTS header www.zenpayroll.com: did not receive HSTS header -www3.info: did not receive HSTS header +www3.info: could not connect to host wxukang.cn: could not connect to host x2w.io: could not connect to host xa.search.yahoo.com: did not receive HSTS header @@ -4661,7 +4661,6 @@ xiaoxiao.im: could not connect to host ximens.me: did not receive HSTS header xisa.it: could not connect to host xiyu.moe: could not connect to host -xlange.com: could not connect to host xmppwocky.net: could not connect to host xn--4dbjwf8c.cf: could not connect to host xn--4dbjwf8c.ga: could not connect to host @@ -4670,6 +4669,7 @@ xn--4dbjwf8c.tk: could not connect to host xn--79q87uvkclvgd56ahq5a.net: did not receive HSTS header xn--7rvz7ku3ppnr.jp: did not receive HSTS header xn--80aaihqncaejjobbu6v.xn--p1ai: max-age too low: 6000 +xn--80aocgsfei.xn--p1ai: could not connect to host xn--9pr52k0p5a.com: did not receive HSTS header xn--datenrettung-mnchen-jbc.com: did not receive HSTS header xn--lgb3a8bcpn.cf: could not connect to host @@ -4680,7 +4680,6 @@ xn--ls8hi7a.tk: could not connect to host xn--mgbbh2a9fub.xn--ngbc5azd: did not receive HSTS header xn--neb-tma3u8u.xyz: could not connect to host xn--werner-schffer-fib.de: could not connect to host -xn--y8j148r.xn--q9jyb4c: did not receive HSTS header xn--yoamomisuasbcn-ynb.com: could not connect to host xnode.org: did not receive HSTS header xobox.me: could not connect to host @@ -4688,6 +4687,7 @@ xoffy.com: did not receive HSTS header xombra.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] xpi.fr: could not connect to host xplore-dna.net: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] +xps2pdf.co.uk: could not connect to host xsmobile.de: could not connect to host xtream-hosting.com: could not connect to host xtream-hosting.de: could not connect to host @@ -4715,6 +4715,7 @@ yenniferallulli.moda: could not connect to host yenniferallulli.nl: could not connect to host yestees.com: did not receive HSTS header yetcore.io: could not connect to host +yhb.io: could not connect to host yingyj.com: could not connect to host yippie.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] yizhu.com: could not connect to host @@ -4757,6 +4758,7 @@ zbp.at: did not receive HSTS header zebrababy.cn: did not receive HSTS header zefiris.org: did not receive HSTS header zefu.ca: could not connect to host +zehntner.ch: could not connect to host zeitpunkt-kulturmagazin.de: did not receive HSTS header zelezny.uk: did not receive HSTS header zelfstandigemakelaars.net: could not connect to host @@ -4770,7 +4772,6 @@ zeytin.pro: could not connect to host zh.search.yahoo.com: did not receive HSTS header zhaojin97.cn: did not receive HSTS header zhendingresources.com: could not connect to host -zhousiru.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] zirtue.io: could not connect to host ziyuanabc.xyz: could not connect to host zkillboard.com: did not receive HSTS header @@ -4789,7 +4790,7 @@ ztan.tk: could not connect to host ztcaoll222.cn: did not receive HSTS header zten.org: could not connect to host zulu7.com: could not connect to host -zuolan.me: could not connect to host +zuolan.me: did not receive HSTS header zupago.pe: did not receive HSTS header zvncloud.com: did not receive HSTS header zwollemagazine.nl: did not receive HSTS header diff --git a/security/manager/ssl/nsSTSPreloadList.inc b/security/manager/ssl/nsSTSPreloadList.inc index c75b19aeb1c2..d0eae4aa4049 100644 --- a/security/manager/ssl/nsSTSPreloadList.inc +++ b/security/manager/ssl/nsSTSPreloadList.inc @@ -8,7 +8,7 @@ /*****************************************************************************/ #include -const PRTime gPreloadListExpirationTime = INT64_C(1497108138072000); +const PRTime gPreloadListExpirationTime = INT64_C(1497195438932000); static const char kSTSHostTable[] = { /* "0.me.uk", true */ '0', '.', 'm', 'e', '.', 'u', 'k', '\0', @@ -37,7 +37,6 @@ static const char kSTSHostTable[] = { /* "0x90.fi", true */ '0', 'x', '9', '0', '.', 'f', 'i', '\0', /* "0x90.io", true */ '0', 'x', '9', '0', '.', 'i', 'o', '\0', /* "0xAA55.me", true */ '0', 'x', 'A', 'A', '5', '5', '.', 'm', 'e', '\0', - /* "0xa.in", true */ '0', 'x', 'a', '.', 'i', 'n', '\0', /* "0xaa55.me", true */ '0', 'x', 'a', 'a', '5', '5', '.', 'm', 'e', '\0', /* "0xacab.org", true */ '0', 'x', 'a', 'c', 'a', 'b', '.', 'o', 'r', 'g', '\0', /* "0xda.de", true */ '0', 'x', 'd', 'a', '.', 'd', 'e', '\0', @@ -111,6 +110,7 @@ static const char kSTSHostTable[] = { /* "21stnc.com", true */ '2', '1', 's', 't', 'n', 'c', '.', 'c', 'o', 'm', '\0', /* "246060.ru", true */ '2', '4', '6', '0', '6', '0', '.', 'r', 'u', '\0', /* "247healthshop.com", true */ '2', '4', '7', 'h', 'e', 'a', 'l', 't', 'h', 's', 'h', 'o', 'p', '.', 'c', 'o', 'm', '\0', + /* "24hourpaint.com", true */ '2', '4', 'h', 'o', 'u', 'r', 'p', 'a', 'i', 'n', 't', '.', 'c', 'o', 'm', '\0', /* "24ip.com", true */ '2', '4', 'i', 'p', '.', 'c', 'o', 'm', '\0', /* "24ip.de", true */ '2', '4', 'i', 'p', '.', 'd', 'e', '\0', /* "24ip.fr", true */ '2', '4', 'i', 'p', '.', 'f', 'r', '\0', @@ -313,6 +313,7 @@ static const char kSTSHostTable[] = { /* "achtzehn.eu", true */ 'a', 'c', 'h', 't', 'z', 'e', 'h', 'n', '.', 'e', 'u', '\0', /* "aciksite.com", true */ 'a', 'c', 'i', 'k', 's', 'i', 't', 'e', '.', 'c', 'o', 'm', '\0', /* "aclu.org", false */ 'a', 'c', 'l', 'u', '.', 'o', 'r', 'g', '\0', + /* "acmle.com", false */ 'a', 'c', 'm', 'l', 'e', '.', 'c', 'o', 'm', '\0', /* "acnpacific.com", true */ 'a', 'c', 'n', 'p', 'a', 'c', 'i', 'f', 'i', 'c', '.', 'c', 'o', 'm', '\0', /* "acoffeeshops.com", true */ 'a', 'c', 'o', 'f', 'f', 'e', 'e', 's', 'h', 'o', 'p', 's', '.', 'c', 'o', 'm', '\0', /* "acritelli.com", true */ 'a', 'c', 'r', 'i', 't', 'e', 'l', 'l', 'i', '.', 'c', 'o', 'm', '\0', @@ -394,7 +395,6 @@ static const char kSTSHostTable[] = { /* "adr.gov", true */ 'a', 'd', 'r', '.', 'g', 'o', 'v', '\0', /* "adrenaline-gaming.ru", false */ 'a', 'd', 'r', 'e', 'n', 'a', 'l', 'i', 'n', 'e', '-', 'g', 'a', 'm', 'i', 'n', 'g', '.', 'r', 'u', '\0', /* "adrianajewelry.my", true */ 'a', 'd', 'r', 'i', 'a', 'n', 'a', 'j', 'e', 'w', 'e', 'l', 'r', 'y', '.', 'm', 'y', '\0', - /* "adrianseo.ro", true */ 'a', 'd', 'r', 'i', 'a', 'n', 's', 'e', 'o', '.', 'r', 'o', '\0', /* "adrinet.tk", true */ 'a', 'd', 'r', 'i', 'n', 'e', 't', '.', 't', 'k', '\0', /* "aduedu.de", true */ 'a', 'd', 'u', 'e', 'd', 'u', '.', 'd', 'e', '\0', /* "aduvi.de", true */ 'a', 'd', 'u', 'v', 'i', '.', 'd', 'e', '\0', @@ -449,7 +449,6 @@ static const char kSTSHostTable[] = { /* "afvallendoeje.nu", true */ 'a', 'f', 'v', 'a', 'l', 'l', 'e', 'n', 'd', 'o', 'e', 'j', 'e', '.', 'n', 'u', '\0', /* "afyou.co.kr", false */ 'a', 'f', 'y', 'o', 'u', '.', 'c', 'o', '.', 'k', 'r', '\0', /* "agatheetraphael.fr", true */ 'a', 'g', 'a', 't', 'h', 'e', 'e', 't', 'r', 'a', 'p', 'h', 'a', 'e', 'l', '.', 'f', 'r', '\0', - /* "agdalieso.com.ba", true */ 'a', 'g', 'd', 'a', 'l', 'i', 'e', 's', 'o', '.', 'c', 'o', 'm', '.', 'b', 'a', '\0', /* "ageg.ca", true */ 'a', 'g', 'e', 'g', '.', 'c', 'a', '\0', /* "agenda-loto.net", false */ 'a', 'g', 'e', 'n', 'd', 'a', '-', 'l', 'o', 't', 'o', '.', 'n', 'e', 't', '\0', /* "agenda21senden.de", true */ 'a', 'g', 'e', 'n', 'd', 'a', '2', '1', 's', 'e', 'n', 'd', 'e', 'n', '.', 'd', 'e', '\0', @@ -588,6 +587,7 @@ static const char kSTSHostTable[] = { /* "alinode.com", true */ 'a', 'l', 'i', 'n', 'o', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "alisonisrealestate.com", true */ 'a', 'l', 'i', 's', 'o', 'n', 'i', 's', 'r', 'e', 'a', 'l', 'e', 's', 't', 'a', 't', 'e', '.', 'c', 'o', 'm', '\0', /* "alisonlitchfield.com", true */ 'a', 'l', 'i', 's', 'o', 'n', 'l', 'i', 't', 'c', 'h', 'f', 'i', 'e', 'l', 'd', '.', 'c', 'o', 'm', '\0', + /* "alisync.com", true */ 'a', 'l', 'i', 's', 'y', 'n', 'c', '.', 'c', 'o', 'm', '\0', /* "aljaspod.com", true */ 'a', 'l', 'j', 'a', 's', 'p', 'o', 'd', '.', 'c', 'o', 'm', '\0', /* "aljaspod.hu", true */ 'a', 'l', 'j', 'a', 's', 'p', 'o', 'd', '.', 'h', 'u', '\0', /* "aljaspod.net", true */ 'a', 'l', 'j', 'a', 's', 'p', 'o', 'd', '.', 'n', 'e', 't', '\0', @@ -657,6 +657,7 @@ static const char kSTSHostTable[] = { /* "amagdic.com", true */ 'a', 'm', 'a', 'g', 'd', 'i', 'c', '.', 'c', 'o', 'm', '\0', /* "amagical.net", true */ 'a', 'm', 'a', 'g', 'i', 'c', 'a', 'l', '.', 'n', 'e', 't', '\0', /* "amandaonishi.com", true */ 'a', 'm', 'a', 'n', 'd', 'a', 'o', 'n', 'i', 's', 'h', 'i', '.', 'c', 'o', 'm', '\0', + /* "amani-kinderdorf.de", true */ 'a', 'm', 'a', 'n', 'i', '-', 'k', 'i', 'n', 'd', 'e', 'r', 'd', 'o', 'r', 'f', '.', 'd', 'e', '\0', /* "amartinz.at", true */ 'a', 'm', 'a', 'r', 't', 'i', 'n', 'z', '.', 'a', 't', '\0', /* "amateri.com", true */ 'a', 'm', 'a', 't', 'e', 'r', 'i', '.', 'c', 'o', 'm', '\0', /* "amazing-gaming.fr", true */ 'a', 'm', 'a', 'z', 'i', 'n', 'g', '-', 'g', 'a', 'm', 'i', 'n', 'g', '.', 'f', 'r', '\0', @@ -744,7 +745,6 @@ static const char kSTSHostTable[] = { /* "andrewtebert.com", true */ 'a', 'n', 'd', 'r', 'e', 'w', 't', 'e', 'b', 'e', 'r', 't', '.', 'c', 'o', 'm', '\0', /* "andrewthelott.net", true */ 'a', 'n', 'd', 'r', 'e', 'w', 't', 'h', 'e', 'l', 'o', 't', 't', '.', 'n', 'e', 't', '\0', /* "andrewvoce.com", true */ 'a', 'n', 'd', 'r', 'e', 'w', 'v', 'o', 'c', 'e', '.', 'c', 'o', 'm', '\0', - /* "andrewx.net", true */ 'a', 'n', 'd', 'r', 'e', 'w', 'x', '.', 'n', 'e', 't', '\0', /* "andrezadnik.com", true */ 'a', 'n', 'd', 'r', 'e', 'z', 'a', 'd', 'n', 'i', 'k', '.', 'c', 'o', 'm', '\0', /* "androide.com", true */ 'a', 'n', 'd', 'r', 'o', 'i', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "andromedacenter.com", true */ 'a', 'n', 'd', 'r', 'o', 'm', 'e', 'd', 'a', 'c', 'e', 'n', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', @@ -836,7 +836,6 @@ static const char kSTSHostTable[] = { /* "apachehaus.de", false */ 'a', 'p', 'a', 'c', 'h', 'e', 'h', 'a', 'u', 's', '.', 'd', 'e', '\0', /* "apadvantage.com", true */ 'a', 'p', 'a', 'd', 'v', 'a', 'n', 't', 'a', 'g', 'e', '.', 'c', 'o', 'm', '\0', /* "aparaatti.org", true */ 'a', 'p', 'a', 'r', 'a', 'a', 't', 't', 'i', '.', 'o', 'r', 'g', '\0', - /* "apbox.de", true */ 'a', 'p', 'b', 'o', 'x', '.', 'd', 'e', '\0', /* "aperture-laboratories.science", true */ 'a', 'p', 'e', 'r', 't', 'u', 'r', 'e', '-', 'l', 'a', 'b', 'o', 'r', 'a', 't', 'o', 'r', 'i', 'e', 's', '.', 's', 'c', 'i', 'e', 'n', 'c', 'e', '\0', /* "aperturesciencelabs.de", true */ 'a', 'p', 'e', 'r', 't', 'u', 'r', 'e', 's', 'c', 'i', 'e', 'n', 'c', 'e', 'l', 'a', 'b', 's', '.', 'd', 'e', '\0', /* "apervita.net", true */ 'a', 'p', 'e', 'r', 'v', 'i', 't', 'a', '.', 'n', 'e', 't', '\0', @@ -914,6 +913,7 @@ static const char kSTSHostTable[] = { /* "architectdirect.nl", true */ 'a', 'r', 'c', 'h', 'i', 't', 'e', 'c', 't', 'd', 'i', 'r', 'e', 'c', 't', '.', 'n', 'l', '\0', /* "architecte-interieur.be", true */ 'a', 'r', 'c', 'h', 'i', 't', 'e', 'c', 't', 'e', '-', 'i', 'n', 't', 'e', 'r', 'i', 'e', 'u', 'r', '.', 'b', 'e', '\0', /* "archlinux.de", true */ 'a', 'r', 'c', 'h', 'l', 'i', 'n', 'u', 'x', '.', 'd', 'e', '\0', + /* "arctic.gov", true */ 'a', 'r', 'c', 't', 'i', 'c', '.', 'g', 'o', 'v', '\0', /* "ardao.me", true */ 'a', 'r', 'd', 'a', 'o', '.', 'm', 'e', '\0', /* "ardtrade.ru", true */ 'a', 'r', 'd', 't', 'r', 'a', 'd', 'e', '.', 'r', 'u', '\0', /* "areafiftylan.nl", true */ 'a', 'r', 'e', 'a', 'f', 'i', 'f', 't', 'y', 'l', 'a', 'n', '.', 'n', 'l', '\0', @@ -1045,7 +1045,6 @@ static const char kSTSHostTable[] = { /* "ateli.com", true */ 'a', 't', 'e', 'l', 'i', '.', 'c', 'o', 'm', '\0', /* "atelier-naruby.cz", true */ 'a', 't', 'e', 'l', 'i', 'e', 'r', '-', 'n', 'a', 'r', 'u', 'b', 'y', '.', 'c', 'z', '\0', /* "atelier-rk.com", true */ 'a', 't', 'e', 'l', 'i', 'e', 'r', '-', 'r', 'k', '.', 'c', 'o', 'm', '\0', - /* "atelierdesflammesnoires.fr", true */ 'a', 't', 'e', 'l', 'i', 'e', 'r', 'd', 'e', 's', 'f', 'l', 'a', 'm', 'm', 'e', 's', 'n', 'o', 'i', 'r', 'e', 's', '.', 'f', 'r', '\0', /* "ateliernaruby.cz", true */ 'a', 't', 'e', 'l', 'i', 'e', 'r', 'n', 'a', 'r', 'u', 'b', 'y', '.', 'c', 'z', '\0', /* "atencionbimbo.com", true */ 'a', 't', 'e', 'n', 'c', 'i', 'o', 'n', 'b', 'i', 'm', 'b', 'o', '.', 'c', 'o', 'm', '\0', /* "atg.soy", true */ 'a', 't', 'g', '.', 's', 'o', 'y', '\0', @@ -1125,6 +1124,7 @@ static const char kSTSHostTable[] = { /* "autodalmacija.com", true */ 'a', 'u', 't', 'o', 'd', 'a', 'l', 'm', 'a', 'c', 'i', 'j', 'a', '.', 'c', 'o', 'm', '\0', /* "autodeploy.it", true */ 'a', 'u', 't', 'o', 'd', 'e', 'p', 'l', 'o', 'y', '.', 'i', 't', '\0', /* "autoentrepreneurinfo.com", true */ 'a', 'u', 't', 'o', 'e', 'n', 't', 'r', 'e', 'p', 'r', 'e', 'n', 'e', 'u', 'r', 'i', 'n', 'f', 'o', '.', 'c', 'o', 'm', '\0', + /* "autoepc.ro", true */ 'a', 'u', 't', 'o', 'e', 'p', 'c', '.', 'r', 'o', '\0', /* "autoledky.sk", true */ 'a', 'u', 't', 'o', 'l', 'e', 'd', 'k', 'y', '.', 's', 'k', '\0', /* "automacity.com", true */ 'a', 'u', 't', 'o', 'm', 'a', 'c', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "autoosijek.com", true */ 'a', 'u', 't', 'o', 'o', 's', 'i', 'j', 'e', 'k', '.', 'c', 'o', 'm', '\0', @@ -1190,6 +1190,7 @@ static const char kSTSHostTable[] = { /* "azirevpn.com", true */ 'a', 'z', 'i', 'r', 'e', 'v', 'p', 'n', '.', 'c', 'o', 'm', '\0', /* "azlk-team.ru", true */ 'a', 'z', 'l', 'k', '-', 't', 'e', 'a', 'm', '.', 'r', 'u', '\0', /* "azort.com", true */ 'a', 'z', 'o', 'r', 't', '.', 'c', 'o', 'm', '\0', + /* "aztrix.me", true */ 'a', 'z', 't', 'r', 'i', 'x', '.', 'm', 'e', '\0', /* "azun.pl", true */ 'a', 'z', 'u', 'n', '.', 'p', 'l', '\0', /* "azuxul.fr", true */ 'a', 'z', 'u', 'x', 'u', 'l', '.', 'f', 'r', '\0', /* "azzag.co.uk", true */ 'a', 'z', 'z', 'a', 'g', '.', 'c', 'o', '.', 'u', 'k', '\0', @@ -1215,6 +1216,7 @@ static const char kSTSHostTable[] = { /* "babypibu.com", true */ 'b', 'a', 'b', 'y', 'p', 'i', 'b', 'u', '.', 'c', 'o', 'm', '\0', /* "babystep.tv", true */ 'b', 'a', 'b', 'y', 's', 't', 'e', 'p', '.', 't', 'v', '\0', /* "bacgrouppublishing.com", true */ 'b', 'a', 'c', 'g', 'r', 'o', 'u', 'p', 'p', 'u', 'b', 'l', 'i', 's', 'h', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', + /* "backeby.eu", true */ 'b', 'a', 'c', 'k', 'e', 'b', 'y', '.', 'e', 'u', '\0', /* "backmountaingas.com", true */ 'b', 'a', 'c', 'k', 'm', 'o', 'u', 'n', 't', 'a', 'i', 'n', 'g', 'a', 's', '.', 'c', 'o', 'm', '\0', /* "backpacker.dating", true */ 'b', 'a', 'c', 'k', 'p', 'a', 'c', 'k', 'e', 'r', '.', 'd', 'a', 't', 'i', 'n', 'g', '\0', /* "backscattering.de", true */ 'b', 'a', 'c', 'k', 's', 'c', 'a', 't', 't', 'e', 'r', 'i', 'n', 'g', '.', 'd', 'e', '\0', @@ -1257,6 +1259,7 @@ static const char kSTSHostTable[] = { /* "ballarin.cc", true */ 'b', 'a', 'l', 'l', 'a', 'r', 'i', 'n', '.', 'c', 'c', '\0', /* "ballejaune.com", true */ 'b', 'a', 'l', 'l', 'e', 'j', 'a', 'u', 'n', 'e', '.', 'c', 'o', 'm', '\0', /* "ballmerpeak.org", true */ 'b', 'a', 'l', 'l', 'm', 'e', 'r', 'p', 'e', 'a', 'k', '.', 'o', 'r', 'g', '\0', + /* "balloonphp.com", true */ 'b', 'a', 'l', 'l', 'o', 'o', 'n', 'p', 'h', 'p', '.', 'c', 'o', 'm', '\0', /* "ballotapi.com", true */ 'b', 'a', 'l', 'l', 'o', 't', 'a', 'p', 'i', '.', 'c', 'o', 'm', '\0', /* "balonmano.co", true */ 'b', 'a', 'l', 'o', 'n', 'm', 'a', 'n', 'o', '.', 'c', 'o', '\0', /* "bananabandy.com", true */ 'b', 'a', 'n', 'a', 'n', 'a', 'b', 'a', 'n', 'd', 'y', '.', 'c', 'o', 'm', '\0', @@ -1300,7 +1303,9 @@ static const char kSTSHostTable[] = { /* "barslecht.com", true */ 'b', 'a', 'r', 's', 'l', 'e', 'c', 'h', 't', '.', 'c', 'o', 'm', '\0', /* "barslecht.nl", true */ 'b', 'a', 'r', 's', 'l', 'e', 'c', 'h', 't', '.', 'n', 'l', '\0', /* "bartel.ws", true */ 'b', 'a', 'r', 't', 'e', 'l', '.', 'w', 's', '\0', + /* "bartelt.name", true */ 'b', 'a', 'r', 't', 'e', 'l', 't', '.', 'n', 'a', 'm', 'e', '\0', /* "bartlamboo.nl", true */ 'b', 'a', 'r', 't', 'l', 'a', 'm', 'b', 'o', 'o', '.', 'n', 'l', '\0', + /* "bartula.de", true */ 'b', 'a', 'r', 't', 'u', 'l', 'a', '.', 'd', 'e', '\0', /* "baruch.me", true */ 'b', 'a', 'r', 'u', 'c', 'h', '.', 'm', 'e', '\0', /* "barunisystems.com", true */ 'b', 'a', 'r', 'u', 'n', 'i', 's', 'y', 's', 't', 'e', 'm', 's', '.', 'c', 'o', 'm', '\0', /* "bashc.at", true */ 'b', 'a', 's', 'h', 'c', '.', 'a', 't', '\0', @@ -1437,7 +1442,6 @@ static const char kSTSHostTable[] = { /* "beourvictim.com", true */ 'b', 'e', 'o', 'u', 'r', 'v', 'i', 'c', 't', 'i', 'm', '.', 'c', 'o', 'm', '\0', /* "bep362.vn", true */ 'b', 'e', 'p', '3', '6', '2', '.', 'v', 'n', '\0', /* "beranovi.com", true */ 'b', 'e', 'r', 'a', 'n', 'o', 'v', 'i', '.', 'c', 'o', 'm', '\0', - /* "berasavocate.com", true */ 'b', 'e', 'r', 'a', 's', 'a', 'v', 'o', 'c', 'a', 't', 'e', '.', 'c', 'o', 'm', '\0', /* "bergenhave.nl", true */ 'b', 'e', 'r', 'g', 'e', 'n', 'h', 'a', 'v', 'e', '.', 'n', 'l', '\0', /* "bergstoneware.com", true */ 'b', 'e', 'r', 'g', 's', 't', 'o', 'n', 'e', 'w', 'a', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "berlin-kohlefrei.de", true */ 'b', 'e', 'r', 'l', 'i', 'n', '-', 'k', 'o', 'h', 'l', 'e', 'f', 'r', 'e', 'i', '.', 'd', 'e', '\0', @@ -1590,6 +1594,7 @@ static const char kSTSHostTable[] = { /* "birzan.org", true */ 'b', 'i', 'r', 'z', 'a', 'n', '.', 'o', 'r', 'g', '\0', /* "biscuits-rec.com", true */ 'b', 'i', 's', 'c', 'u', 'i', 't', 's', '-', 'r', 'e', 'c', '.', 'c', 'o', 'm', '\0', /* "biscuits-shop.com", true */ 'b', 'i', 's', 'c', 'u', 'i', 't', 's', '-', 's', 'h', 'o', 'p', '.', 'c', 'o', 'm', '\0', + /* "bismarck.moe", true */ 'b', 'i', 's', 'm', 'a', 'r', 'c', 'k', '.', 'm', 'o', 'e', '\0', /* "bisterfeldt.com", true */ 'b', 'i', 's', 't', 'e', 'r', 'f', 'e', 'l', 'd', 't', '.', 'c', 'o', 'm', '\0', /* "bit-rapid.com", true */ 'b', 'i', 't', '-', 'r', 'a', 'p', 'i', 'd', '.', 'c', 'o', 'm', '\0', /* "bit-sentinel.com", true */ 'b', 'i', 't', '-', 's', 'e', 'n', 't', 'i', 'n', 'e', 'l', '.', 'c', 'o', 'm', '\0', @@ -1684,7 +1689,6 @@ static const char kSTSHostTable[] = { /* "blackdown.de", true */ 'b', 'l', 'a', 'c', 'k', 'd', 'o', 'w', 'n', '.', 'd', 'e', '\0', /* "blackdragoninc.org", true */ 'b', 'l', 'a', 'c', 'k', 'd', 'r', 'a', 'g', 'o', 'n', 'i', 'n', 'c', '.', 'o', 'r', 'g', '\0', /* "blackhelicopters.net", true */ 'b', 'l', 'a', 'c', 'k', 'h', 'e', 'l', 'i', 'c', 'o', 'p', 't', 'e', 'r', 's', '.', 'n', 'e', 't', '\0', - /* "blackly.uk", true */ 'b', 'l', 'a', 'c', 'k', 'l', 'y', '.', 'u', 'k', '\0', /* "blacknova.io", true */ 'b', 'l', 'a', 'c', 'k', 'n', 'o', 'v', 'a', '.', 'i', 'o', '\0', /* "blackonion.com", true */ 'b', 'l', 'a', 'c', 'k', 'o', 'n', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "blackpapermoon.de", true */ 'b', 'l', 'a', 'c', 'k', 'p', 'a', 'p', 'e', 'r', 'm', 'o', 'o', 'n', '.', 'd', 'e', '\0', @@ -1746,6 +1750,7 @@ static const char kSTSHostTable[] = { /* "bluechilli.com", true */ 'b', 'l', 'u', 'e', 'c', 'h', 'i', 'l', 'l', 'i', '.', 'c', 'o', 'm', '\0', /* "blueflare.org", true */ 'b', 'l', 'u', 'e', 'f', 'l', 'a', 'r', 'e', '.', 'o', 'r', 'g', '\0', /* "bluefuzz.nl", true */ 'b', 'l', 'u', 'e', 'f', 'u', 'z', 'z', '.', 'n', 'l', '\0', + /* "blueimp.net", true */ 'b', 'l', 'u', 'e', 'i', 'm', 'p', '.', 'n', 'e', 't', '\0', /* "bluemoonroleplaying.com", true */ 'b', 'l', 'u', 'e', 'm', 'o', 'o', 'n', 'r', 'o', 'l', 'e', 'p', 'l', 'a', 'y', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "bluemosh.com", true */ 'b', 'l', 'u', 'e', 'm', 'o', 's', 'h', '.', 'c', 'o', 'm', '\0', /* "blueperil.de", true */ 'b', 'l', 'u', 'e', 'p', 'e', 'r', 'i', 'l', '.', 'd', 'e', '\0', @@ -1896,6 +1901,7 @@ static const char kSTSHostTable[] = { /* "bregnedalsystems.dk", true */ 'b', 'r', 'e', 'g', 'n', 'e', 'd', 'a', 'l', 's', 'y', 's', 't', 'e', 'm', 's', '.', 'd', 'k', '\0', /* "breitbild-beamer.de", true */ 'b', 'r', 'e', 'i', 't', 'b', 'i', 'l', 'd', '-', 'b', 'e', 'a', 'm', 'e', 'r', '.', 'd', 'e', '\0', /* "brejoc.com", true */ 'b', 'r', 'e', 'j', 'o', 'c', '.', 'c', 'o', 'm', '\0', + /* "brettabel.com", true */ 'b', 'r', 'e', 't', 't', 'a', 'b', 'e', 'l', '.', 'c', 'o', 'm', '\0', /* "brettcornwall.com", true */ 'b', 'r', 'e', 't', 't', 'c', 'o', 'r', 'n', 'w', 'a', 'l', 'l', '.', 'c', 'o', 'm', '\0', /* "bretz-hufer.de", true */ 'b', 'r', 'e', 't', 'z', '-', 'h', 'u', 'f', 'e', 'r', '.', 'd', 'e', '\0', /* "brevboxar.se", true */ 'b', 'r', 'e', 'v', 'b', 'o', 'x', 'a', 'r', '.', 's', 'e', '\0', @@ -1904,7 +1910,6 @@ static const char kSTSHostTable[] = { /* "brianalawayconsulting.com", true */ 'b', 'r', 'i', 'a', 'n', 'a', 'l', 'a', 'w', 'a', 'y', 'c', 'o', 'n', 's', 'u', 'l', 't', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "brianpcurran.com", true */ 'b', 'r', 'i', 'a', 'n', 'p', 'c', 'u', 'r', 'r', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "brickftp.com", true */ 'b', 'r', 'i', 'c', 'k', 'f', 't', 'p', '.', 'c', 'o', 'm', '\0', - /* "brid.gy", true */ 'b', 'r', 'i', 'd', '.', 'g', 'y', '\0', /* "brideandgroomdirect.ie", true */ 'b', 'r', 'i', 'd', 'e', 'a', 'n', 'd', 'g', 'r', 'o', 'o', 'm', 'd', 'i', 'r', 'e', 'c', 't', '.', 'i', 'e', '\0', /* "bridgeout.com", true */ 'b', 'r', 'i', 'd', 'g', 'e', 'o', 'u', 't', '.', 'c', 'o', 'm', '\0', /* "bridholm.se", true */ 'b', 'r', 'i', 'd', 'h', 'o', 'l', 'm', '.', 's', 'e', '\0', @@ -1979,7 +1984,6 @@ static const char kSTSHostTable[] = { /* "buddhistische-weisheiten.org", true */ 'b', 'u', 'd', 'd', 'h', 'i', 's', 't', 'i', 's', 'c', 'h', 'e', '-', 'w', 'e', 'i', 's', 'h', 'e', 'i', 't', 'e', 'n', '.', 'o', 'r', 'g', '\0', /* "buddlycrafts.com", true */ 'b', 'u', 'd', 'd', 'l', 'y', 'c', 'r', 'a', 'f', 't', 's', '.', 'c', 'o', 'm', '\0', /* "buderus-family.be", true */ 'b', 'u', 'd', 'e', 'r', 'u', 's', '-', 'f', 'a', 'm', 'i', 'l', 'y', '.', 'b', 'e', '\0', - /* "budger.nl", true */ 'b', 'u', 'd', 'g', 'e', 'r', '.', 'n', 'l', '\0', /* "budgetalk.com", true */ 'b', 'u', 'd', 'g', 'e', 't', 'a', 'l', 'k', '.', 'c', 'o', 'm', '\0', /* "bueltge.de", true */ 'b', 'u', 'e', 'l', 't', 'g', 'e', '.', 'd', 'e', '\0', /* "buenosairesestetica.com.ar", true */ 'b', 'u', 'e', 'n', 'o', 's', 'a', 'i', 'r', 'e', 's', 'e', 's', 't', 'e', 't', 'i', 'c', 'a', '.', 'c', 'o', 'm', '.', 'a', 'r', '\0', @@ -2164,6 +2168,7 @@ static const char kSTSHostTable[] = { /* "calibreapp.com", false */ 'c', 'a', 'l', 'i', 'b', 'r', 'e', 'a', 'p', 'p', '.', 'c', 'o', 'm', '\0', /* "calibso.net", true */ 'c', 'a', 'l', 'i', 'b', 's', 'o', '.', 'n', 'e', 't', '\0', /* "calixte-concept.fr", true */ 'c', 'a', 'l', 'i', 'x', 't', 'e', '-', 'c', 'o', 'n', 'c', 'e', 'p', 't', '.', 'f', 'r', '\0', + /* "call.me", false */ 'c', 'a', 'l', 'l', '.', 'm', 'e', '\0', /* "callabs.net", true */ 'c', 'a', 'l', 'l', 'a', 'b', 's', '.', 'n', 'e', 't', '\0', /* "callaction.co", true */ 'c', 'a', 'l', 'l', 'a', 'c', 't', 'i', 'o', 'n', '.', 'c', 'o', '\0', /* "callcap.com", false */ 'c', 'a', 'l', 'l', 'c', 'a', 'p', '.', 'c', 'o', 'm', '\0', @@ -2406,7 +2411,6 @@ static const char kSTSHostTable[] = { /* "chaletmanager.com", true */ 'c', 'h', 'a', 'l', 'e', 't', 'm', 'a', 'n', 'a', 'g', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "chalkfestival.org", true */ 'c', 'h', 'a', 'l', 'k', 'f', 'e', 's', 't', 'i', 'v', 'a', 'l', '.', 'o', 'r', 'g', '\0', /* "chameth.com", true */ 'c', 'h', 'a', 'm', 'e', 't', 'h', '.', 'c', 'o', 'm', '\0', - /* "chamilo.org", true */ 'c', 'h', 'a', 'm', 'i', 'l', 'o', '.', 'o', 'r', 'g', '\0', /* "champicreuse.fr", true */ 'c', 'h', 'a', 'm', 'p', 'i', 'c', 'r', 'e', 'u', 's', 'e', '.', 'f', 'r', '\0', /* "champserver.net", true */ 'c', 'h', 'a', 'm', 'p', 's', 'e', 'r', 'v', 'e', 'r', '.', 'n', 'e', 't', '\0', /* "chanissue.com", true */ 'c', 'h', 'a', 'n', 'i', 's', 's', 'u', 'e', '.', 'c', 'o', 'm', '\0', @@ -2737,9 +2741,10 @@ static const char kSTSHostTable[] = { /* "codeplay.org", true */ 'c', 'o', 'd', 'e', 'p', 'l', 'a', 'y', '.', 'o', 'r', 'g', '\0', /* "codepoints.net", true */ 'c', 'o', 'd', 'e', 'p', 'o', 'i', 'n', 't', 's', '.', 'n', 'e', 't', '\0', /* "codepref.com", true */ 'c', 'o', 'd', 'e', 'p', 'r', 'e', 'f', '.', 'c', 'o', 'm', '\0', + /* "codepult.com", true */ 'c', 'o', 'd', 'e', 'p', 'u', 'l', 't', '.', 'c', 'o', 'm', '\0', /* "codera.co.uk", true */ 'c', 'o', 'd', 'e', 'r', 'a', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "codereview.appspot.com", true */ 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', '.', 'a', 'p', 'p', 's', 'p', 'o', 't', '.', 'c', 'o', 'm', '\0', - /* "codereview.chromium.org", false */ 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', '.', 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm', '.', 'o', 'r', 'g', '\0', + /* "codereview.chromium.org", true */ 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', '.', 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm', '.', 'o', 'r', 'g', '\0', /* "coderhangout.com", true */ 'c', 'o', 'd', 'e', 'r', 'h', 'a', 'n', 'g', 'o', 'u', 't', '.', 'c', 'o', 'm', '\0', /* "codesport.io", true */ 'c', 'o', 'd', 'e', 's', 'p', 'o', 'r', 't', '.', 'i', 'o', '\0', /* "codeux.com", true */ 'c', 'o', 'd', 'e', 'u', 'x', '.', 'c', 'o', 'm', '\0', @@ -2834,7 +2839,6 @@ static const char kSTSHostTable[] = { /* "compartir.party", true */ 'c', 'o', 'm', 'p', 'a', 'r', 't', 'i', 'r', '.', 'p', 'a', 'r', 't', 'y', '\0', /* "compeuphoria.com", true */ 'c', 'o', 'm', 'p', 'e', 'u', 'p', 'h', 'o', 'r', 'i', 'a', '.', 'c', 'o', 'm', '\0', /* "compibus.fr", true */ 'c', 'o', 'm', 'p', 'i', 'b', 'u', 's', '.', 'f', 'r', '\0', - /* "compiledworks.com", true */ 'c', 'o', 'm', 'p', 'i', 'l', 'e', 'd', 'w', 'o', 'r', 'k', 's', '.', 'c', 'o', 'm', '\0', /* "compilenix.org", true */ 'c', 'o', 'm', 'p', 'i', 'l', 'e', 'n', 'i', 'x', '.', 'o', 'r', 'g', '\0', /* "completionist.me", true */ 'c', 'o', 'm', 'p', 'l', 'e', 't', 'i', 'o', 'n', 'i', 's', 't', '.', 'm', 'e', '\0', /* "complexart.ro", true */ 'c', 'o', 'm', 'p', 'l', 'e', 'x', 'a', 'r', 't', '.', 'r', 'o', '\0', @@ -2893,7 +2897,6 @@ static const char kSTSHostTable[] = { /* "convergemagazine.com", true */ 'c', 'o', 'n', 'v', 'e', 'r', 'g', 'e', 'm', 'a', 'g', 'a', 'z', 'i', 'n', 'e', '.', 'c', 'o', 'm', '\0', /* "conversiones.com", true */ 'c', 'o', 'n', 'v', 'e', 'r', 's', 'i', 'o', 'n', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "convert.im", true */ 'c', 'o', 'n', 'v', 'e', 'r', 't', '.', 'i', 'm', '\0', - /* "convert.zone", true */ 'c', 'o', 'n', 'v', 'e', 'r', 't', '.', 'z', 'o', 'n', 'e', '\0', /* "converter.ml", true */ 'c', 'o', 'n', 'v', 'e', 'r', 't', 'e', 'r', '.', 'm', 'l', '\0', /* "convocatoriafundacionpepsicomexico.org", false */ 'c', 'o', 'n', 'v', 'o', 'c', 'a', 't', 'o', 'r', 'i', 'a', 'f', 'u', 'n', 'd', 'a', 'c', 'i', 'o', 'n', 'p', 'e', 'p', 's', 'i', 'c', 'o', 'm', 'e', 'x', 'i', 'c', 'o', '.', 'o', 'r', 'g', '\0', /* "cooink.net", true */ 'c', 'o', 'o', 'i', 'n', 'k', '.', 'n', 'e', 't', '\0', @@ -2971,6 +2974,7 @@ static const char kSTSHostTable[] = { /* "cozmaadrian.ro", true */ 'c', 'o', 'z', 'm', 'a', 'a', 'd', 'r', 'i', 'a', 'n', '.', 'r', 'o', '\0', /* "cozyeggdesigns.com", true */ 'c', 'o', 'z', 'y', 'e', 'g', 'g', 'd', 'e', 's', 'i', 'g', 'n', 's', '.', 'c', 'o', 'm', '\0', /* "cprnearme.com", true */ 'c', 'p', 'r', 'n', 'e', 'a', 'r', 'm', 'e', '.', 'c', 'o', 'm', '\0', + /* "cpvmatch.eu", true */ 'c', 'p', 'v', 'm', 'a', 't', 'c', 'h', '.', 'e', 'u', '\0', /* "cqchome.com", true */ 'c', 'q', 'c', 'h', 'o', 'm', 'e', '.', 'c', 'o', 'm', '\0', /* "cracker.in.th", true */ 'c', 'r', 'a', 'c', 'k', 'e', 'r', '.', 'i', 'n', '.', 't', 'h', '\0', /* "crackingking.com", false */ 'c', 'r', 'a', 'c', 'k', 'i', 'n', 'g', 'k', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', @@ -3144,6 +3148,7 @@ static const char kSTSHostTable[] = { /* "customd.com", true */ 'c', 'u', 's', 't', 'o', 'm', 'd', '.', 'c', 'o', 'm', '\0', /* "customfilmworks.com", true */ 'c', 'u', 's', 't', 'o', 'm', 'f', 'i', 'l', 'm', 'w', 'o', 'r', 'k', 's', '.', 'c', 'o', 'm', '\0', /* "customshort.link", true */ 'c', 'u', 's', 't', 'o', 'm', 's', 'h', 'o', 'r', 't', '.', 'l', 'i', 'n', 'k', '\0', + /* "cutorrent.com", true */ 'c', 'u', 't', 'o', 'r', 'r', 'e', 'n', 't', '.', 'c', 'o', 'm', '\0', /* "cuvva.co", true */ 'c', 'u', 'v', 'v', 'a', '.', 'c', 'o', '\0', /* "cuvva.co.uk", true */ 'c', 'u', 'v', 'v', 'a', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "cuvva.com", true */ 'c', 'u', 'v', 'v', 'a', '.', 'c', 'o', 'm', '\0', @@ -3361,7 +3366,6 @@ static const char kSTSHostTable[] = { /* "davidcrx.net", true */ 'd', 'a', 'v', 'i', 'd', 'c', 'r', 'x', '.', 'n', 'e', 't', '\0', /* "davidgouveia.net", true */ 'd', 'a', 'v', 'i', 'd', 'g', 'o', 'u', 'v', 'e', 'i', 'a', '.', 'n', 'e', 't', '\0', /* "davidgow.net", true */ 'd', 'a', 'v', 'i', 'd', 'g', 'o', 'w', '.', 'n', 'e', 't', '\0', - /* "davidgreig.uk", true */ 'd', 'a', 'v', 'i', 'd', 'g', 'r', 'e', 'i', 'g', '.', 'u', 'k', '\0', /* "davidlillo.com", true */ 'd', 'a', 'v', 'i', 'd', 'l', 'i', 'l', 'l', 'o', '.', 'c', 'o', 'm', '\0', /* "davidlyness.com", true */ 'd', 'a', 'v', 'i', 'd', 'l', 'y', 'n', 'e', 's', 's', '.', 'c', 'o', 'm', '\0', /* "davidmcevoy.org.uk", true */ 'd', 'a', 'v', 'i', 'd', 'm', 'c', 'e', 'v', 'o', 'y', '.', 'o', 'r', 'g', '.', 'u', 'k', '\0', @@ -3420,7 +3424,6 @@ static const char kSTSHostTable[] = { /* "dealbanana.it", true */ 'd', 'e', 'a', 'l', 'b', 'a', 'n', 'a', 'n', 'a', '.', 'i', 't', '\0', /* "dealbanana.se", true */ 'd', 'e', 'a', 'l', 'b', 'a', 'n', 'a', 'n', 'a', '.', 's', 'e', '\0', /* "dealcruiser.nl", true */ 'd', 'e', 'a', 'l', 'c', 'r', 'u', 'i', 's', 'e', 'r', '.', 'n', 'l', '\0', - /* "dealpass.no", true */ 'd', 'e', 'a', 'l', 'p', 'a', 's', 's', '.', 'n', 'o', '\0', /* "deamuseum.org", true */ 'd', 'e', 'a', 'm', 'u', 's', 'e', 'u', 'm', '.', 'o', 'r', 'g', '\0', /* "deanmorgan.org", true */ 'd', 'e', 'a', 'n', 'm', 'o', 'r', 'g', 'a', 'n', '.', 'o', 'r', 'g', '\0', /* "deathy.ro", true */ 'd', 'e', 'a', 't', 'h', 'y', '.', 'r', 'o', '\0', @@ -3559,6 +3562,7 @@ static const char kSTSHostTable[] = { /* "devafterdark.com", true */ 'd', 'e', 'v', 'a', 'f', 't', 'e', 'r', 'd', 'a', 'r', 'k', '.', 'c', 'o', 'm', '\0', /* "devb.nl", true */ 'd', 'e', 'v', 'b', '.', 'n', 'l', '\0', /* "devct.cz", true */ 'd', 'e', 'v', 'c', 't', '.', 'c', 'z', '\0', + /* "devcu.com", true */ 'd', 'e', 'v', 'c', 'u', '.', 'c', 'o', 'm', '\0', /* "devdesco.com", true */ 'd', 'e', 'v', 'd', 'e', 's', 'c', 'o', '.', 'c', 'o', 'm', '\0', /* "devdom.io", true */ 'd', 'e', 'v', 'd', 'o', 'm', '.', 'i', 'o', '\0', /* "devdoodle.net", true */ 'd', 'e', 'v', 'd', 'o', 'o', 'd', 'l', 'e', '.', 'n', 'e', 't', '\0', @@ -3840,6 +3844,7 @@ static const char kSTSHostTable[] = { /* "domhaase.me", true */ 'd', 'o', 'm', 'h', 'a', 'a', 's', 'e', '.', 'm', 'e', '\0', /* "dominationgame.co.uk", true */ 'd', 'o', 'm', 'i', 'n', 'a', 't', 'i', 'o', 'n', 'g', 'a', 'm', 'e', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "dominicpratt.de", false */ 'd', 'o', 'm', 'i', 'n', 'i', 'c', 'p', 'r', 'a', 't', 't', '.', 'd', 'e', '\0', + /* "dominikkulaga.pl", true */ 'd', 'o', 'm', 'i', 'n', 'i', 'k', 'k', 'u', 'l', 'a', 'g', 'a', '.', 'p', 'l', '\0', /* "dominioanimal.com", true */ 'd', 'o', 'm', 'i', 'n', 'i', 'o', 'a', 'n', 'i', 'm', 'a', 'l', '.', 'c', 'o', 'm', '\0', /* "dominioanimal.com.br", true */ 'd', 'o', 'm', 'i', 'n', 'i', 'o', 'a', 'n', 'i', 'm', 'a', 'l', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', /* "dominoknihy.cz", true */ 'd', 'o', 'm', 'i', 'n', 'o', 'k', 'n', 'i', 'h', 'y', '.', 'c', 'z', '\0', @@ -4030,6 +4035,7 @@ static const char kSTSHostTable[] = { /* "dvotx.org", true */ 'd', 'v', 'o', 't', 'x', '.', 'o', 'r', 'g', '\0', /* "dvwc.org", true */ 'd', 'v', 'w', 'c', '.', 'o', 'r', 'g', '\0', /* "dwnld.me", true */ 'd', 'w', 'n', 'l', 'd', '.', 'm', 'e', '\0', + /* "dworzak.ch", true */ 'd', 'w', 'o', 'r', 'z', 'a', 'k', '.', 'c', 'h', '\0', /* "dwtm.ch", true */ 'd', 'w', 't', 'm', '.', 'c', 'h', '\0', /* "dxgl.info", true */ 'd', 'x', 'g', 'l', '.', 'i', 'n', 'f', 'o', '\0', /* "dyeager.org", true */ 'd', 'y', 'e', 'a', 'g', 'e', 'r', '.', 'o', 'r', 'g', '\0', @@ -4046,6 +4052,7 @@ static const char kSTSHostTable[] = { /* "dyrkar.com", true */ 'd', 'y', 'r', 'k', 'a', 'r', '.', 'c', 'o', 'm', '\0', /* "dziekonski.com", true */ 'd', 'z', 'i', 'e', 'k', 'o', 'n', 's', 'k', 'i', '.', 'c', 'o', 'm', '\0', /* "dzndk.com", true */ 'd', 'z', 'n', 'd', 'k', '.', 'c', 'o', 'm', '\0', + /* "dzndk.net", true */ 'd', 'z', 'n', 'd', 'k', '.', 'n', 'e', 't', '\0', /* "dzyabchenko.com", true */ 'd', 'z', 'y', 'a', 'b', 'c', 'h', 'e', 'n', 'k', 'o', '.', 'c', 'o', 'm', '\0', /* "e-aut.net", true */ 'e', '-', 'a', 'u', 't', '.', 'n', 'e', 't', '\0', /* "e-biografias.net", true */ 'e', '-', 'b', 'i', 'o', 'g', 'r', 'a', 'f', 'i', 'a', 's', '.', 'n', 'e', 't', '\0', @@ -4188,6 +4195,7 @@ static const char kSTSHostTable[] = { /* "eengezinswoning-in-zuidplas-kopen.nl", true */ 'e', 'e', 'n', 'g', 'e', 'z', 'i', 'n', 's', 'w', 'o', 'n', 'i', 'n', 'g', '-', 'i', 'n', '-', 'z', 'u', 'i', 'd', 'p', 'l', 'a', 's', '-', 'k', 'o', 'p', 'e', 'n', '.', 'n', 'l', '\0', /* "eengezinswoning-in-zwartewaterland-kopen.nl", true */ 'e', 'e', 'n', 'g', 'e', 'z', 'i', 'n', 's', 'w', 'o', 'n', 'i', 'n', 'g', '-', 'i', 'n', '-', 'z', 'w', 'a', 'r', 't', 'e', 'w', 'a', 't', 'e', 'r', 'l', 'a', 'n', 'd', '-', 'k', 'o', 'p', 'e', 'n', '.', 'n', 'l', '\0', /* "eengezinswoningverkopen.nl", true */ 'e', 'e', 'n', 'g', 'e', 'z', 'i', 'n', 's', 'w', 'o', 'n', 'i', 'n', 'g', 'v', 'e', 'r', 'k', 'o', 'p', 'e', 'n', '.', 'n', 'l', '\0', + /* "eenhoorn.ga", true */ 'e', 'e', 'n', 'h', 'o', 'o', 'r', 'n', '.', 'g', 'a', '\0', /* "eeqj.com", true */ 'e', 'e', 'q', 'j', '.', 'c', 'o', 'm', '\0', /* "eery.de", true */ 'e', 'e', 'r', 'y', '.', 'd', 'e', '\0', /* "eewna.org", false */ 'e', 'e', 'w', 'n', 'a', '.', 'o', 'r', 'g', '\0', @@ -4230,6 +4238,7 @@ static const char kSTSHostTable[] = { /* "eit-web.de", false */ 'e', 'i', 't', '-', 'w', 'e', 'b', '.', 'd', 'e', '\0', /* "eitler.cx", true */ 'e', 'i', 't', 'l', 'e', 'r', '.', 'c', 'x', '\0', /* "eiyoushi-shigoto.com", true */ 'e', 'i', 'y', 'o', 'u', 's', 'h', 'i', '-', 's', 'h', 'i', 'g', 'o', 't', 'o', '.', 'c', 'o', 'm', '\0', + /* "ejeff.org", true */ 'e', 'j', 'e', 'f', 'f', '.', 'o', 'r', 'g', '\0', /* "ekedc.com", true */ 'e', 'k', 'e', 'd', 'c', '.', 'c', 'o', 'm', '\0', /* "ekodevices.com", true */ 'e', 'k', 'o', 'd', 'e', 'v', 'i', 'c', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "ekokontakt.cz", true */ 'e', 'k', 'o', 'k', 'o', 'n', 't', 'a', 'k', 't', '.', 'c', 'z', '\0', @@ -4361,6 +4370,7 @@ static const char kSTSHostTable[] = { /* "energyatlas.com", true */ 'e', 'n', 'e', 'r', 'g', 'y', 'a', 't', 'l', 'a', 's', '.', 'c', 'o', 'm', '\0', /* "energyaupair.se", true */ 'e', 'n', 'e', 'r', 'g', 'y', 'a', 'u', 'p', 'a', 'i', 'r', '.', 's', 'e', '\0', /* "energydrinkblog.de", true */ 'e', 'n', 'e', 'r', 'g', 'y', 'd', 'r', 'i', 'n', 'k', 'b', 'l', 'o', 'g', '.', 'd', 'e', '\0', + /* "enfoqueseguro.com", true */ 'e', 'n', 'f', 'o', 'q', 'u', 'e', 's', 'e', 'g', 'u', 'r', 'o', '.', 'c', 'o', 'm', '\0', /* "engaugetools.com", true */ 'e', 'n', 'g', 'a', 'u', 'g', 'e', 't', 'o', 'o', 'l', 's', '.', 'c', 'o', 'm', '\0', /* "engelundlicht.ch", true */ 'e', 'n', 'g', 'e', 'l', 'u', 'n', 'd', 'l', 'i', 'c', 'h', 't', '.', 'c', 'h', '\0', /* "engg.ca", true */ 'e', 'n', 'g', 'g', '.', 'c', 'a', '\0', @@ -4415,7 +4425,7 @@ static const char kSTSHostTable[] = { /* "epicwalnutcreek.com", true */ 'e', 'p', 'i', 'c', 'w', 'a', 'l', 'n', 'u', 't', 'c', 'r', 'e', 'e', 'k', '.', 'c', 'o', 'm', '\0', /* "epizentrum.work", true */ 'e', 'p', 'i', 'z', 'e', 'n', 't', 'r', 'u', 'm', '.', 'w', 'o', 'r', 'k', '\0', /* "epizentrum.works", true */ 'e', 'p', 'i', 'z', 'e', 'n', 't', 'r', 'u', 'm', '.', 'w', 'o', 'r', 'k', 's', '\0', - /* "epoch.com", false */ 'e', 'p', 'o', 'c', 'h', '.', 'c', 'o', 'm', '\0', + /* "epoch.com", true */ 'e', 'p', 'o', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "epostplus.li", true */ 'e', 'p', 'o', 's', 't', 'p', 'l', 'u', 's', '.', 'l', 'i', '\0', /* "epsilon.dk", true */ 'e', 'p', 's', 'i', 'l', 'o', 'n', '.', 'd', 'k', '\0', /* "epublibre.org", true */ 'e', 'p', 'u', 'b', 'l', 'i', 'b', 'r', 'e', '.', 'o', 'r', 'g', '\0', @@ -4542,7 +4552,6 @@ static const char kSTSHostTable[] = { /* "ets2mp.de", true */ 'e', 't', 's', '2', 'm', 'p', '.', 'd', 'e', '\0', /* "etv.cx", true */ 'e', 't', 'v', '.', 'c', 'x', '\0', /* "etyd.org", true */ 'e', 't', 'y', 'd', '.', 'o', 'r', 'g', '\0', - /* "euclideanpostulates.xyz", true */ 'e', 'u', 'c', 'l', 'i', 'd', 'e', 'a', 'n', 'p', 'o', 's', 't', 'u', 'l', 'a', 't', 'e', 's', '.', 'x', 'y', 'z', '\0', /* "eucollegetours.com", true */ 'e', 'u', 'c', 'o', 'l', 'l', 'e', 'g', 'e', 't', 'o', 'u', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "eugenekay.com", true */ 'e', 'u', 'g', 'e', 'n', 'e', 'k', 'a', 'y', '.', 'c', 'o', 'm', '\0', /* "eulenleben.de", true */ 'e', 'u', 'l', 'e', 'n', 'l', 'e', 'b', 'e', 'n', '.', 'd', 'e', '\0', @@ -4612,6 +4621,7 @@ static const char kSTSHostTable[] = { /* "exactphilosophy.net", true */ 'e', 'x', 'a', 'c', 't', 'p', 'h', 'i', 'l', 'o', 's', 'o', 'p', 'h', 'y', '.', 'n', 'e', 't', '\0', /* "examenpilotos.com", true */ 'e', 'x', 'a', 'm', 'e', 'n', 'p', 'i', 'l', 'o', 't', 'o', 's', '.', 'c', 'o', 'm', '\0', /* "exceltobarcode.com", true */ 'e', 'x', 'c', 'e', 'l', 't', 'o', 'b', 'a', 'r', 'c', 'o', 'd', 'e', '.', 'c', 'o', 'm', '\0', + /* "exceptionalservers.com", true */ 'e', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 'a', 'l', 's', 'e', 'r', 'v', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "excessamerica.com", true */ 'e', 'x', 'c', 'e', 's', 's', 'a', 'm', 'e', 'r', 'i', 'c', 'a', '.', 'c', 'o', 'm', '\0', /* "exchangeworks.co", true */ 'e', 'x', 'c', 'h', 'a', 'n', 'g', 'e', 'w', 'o', 'r', 'k', 's', '.', 'c', 'o', '\0', /* "exehack.net", true */ 'e', 'x', 'e', 'h', 'a', 'c', 'k', '.', 'n', 'e', 't', '\0', @@ -4699,6 +4709,7 @@ static const char kSTSHostTable[] = { /* "factuursturen.nl", true */ 'f', 'a', 'c', 't', 'u', 'u', 'r', 's', 't', 'u', 'r', 'e', 'n', '.', 'n', 'l', '\0', /* "factys.do", true */ 'f', 'a', 'c', 't', 'y', 's', '.', 'd', 'o', '\0', /* "factys.es", true */ 'f', 'a', 'c', 't', 'y', 's', '.', 'e', 's', '\0', + /* "fadednet.com", true */ 'f', 'a', 'd', 'e', 'd', 'n', 'e', 't', '.', 'c', 'o', 'm', '\0', /* "faeriecakes.be", true */ 'f', 'a', 'e', 'r', 'i', 'e', 'c', 'a', 'k', 'e', 's', '.', 'b', 'e', '\0', /* "fahrenwal.de", true */ 'f', 'a', 'h', 'r', 'e', 'n', 'w', 'a', 'l', '.', 'd', 'e', '\0', /* "fahrenwalde.de", true */ 'f', 'a', 'h', 'r', 'e', 'n', 'w', 'a', 'l', 'd', 'e', '.', 'd', 'e', '\0', @@ -4966,9 +4977,7 @@ static const char kSTSHostTable[] = { /* "floobits.com", true */ 'f', 'l', 'o', 'o', 'b', 'i', 't', 's', '.', 'c', 'o', 'm', '\0', /* "floorball-haunwoehr.de", true */ 'f', 'l', 'o', 'o', 'r', 'b', 'a', 'l', 'l', '-', 'h', 'a', 'u', 'n', 'w', 'o', 'e', 'h', 'r', '.', 'd', 'e', '\0', /* "flooringnightmares.com", true */ 'f', 'l', 'o', 'o', 'r', 'i', 'n', 'g', 'n', 'i', 'g', 'h', 't', 'm', 'a', 'r', 'e', 's', '.', 'c', 'o', 'm', '\0', - /* "floort.net", false */ 'f', 'l', 'o', 'o', 'r', 't', '.', 'n', 'e', 't', '\0', /* "florence.uk.net", true */ 'f', 'l', 'o', 'r', 'e', 'n', 'c', 'e', '.', 'u', 'k', '.', 'n', 'e', 't', '\0', - /* "florent-tatard.fr", true */ 'f', 'l', 'o', 'r', 'e', 'n', 't', '-', 't', 'a', 't', 'a', 'r', 'd', '.', 'f', 'r', '\0', /* "florian-bachelet.fr", true */ 'f', 'l', 'o', 'r', 'i', 'a', 'n', '-', 'b', 'a', 'c', 'h', 'e', 'l', 'e', 't', '.', 'f', 'r', '\0', /* "florian-schlachter.de", true */ 'f', 'l', 'o', 'r', 'i', 'a', 'n', '-', 's', 'c', 'h', 'l', 'a', 'c', 'h', 't', 'e', 'r', '.', 'd', 'e', '\0', /* "florian-thie.de", true */ 'f', 'l', 'o', 'r', 'i', 'a', 'n', '-', 't', 'h', 'i', 'e', '.', 'd', 'e', '\0', @@ -5179,7 +5188,6 @@ static const char kSTSHostTable[] = { /* "frolova.org", true */ 'f', 'r', 'o', 'l', 'o', 'v', 'a', '.', 'o', 'r', 'g', '\0', /* "fromix.de", true */ 'f', 'r', 'o', 'm', 'i', 'x', '.', 'd', 'e', '\0', /* "fromlemaytoz.com", true */ 'f', 'r', 'o', 'm', 'l', 'e', 'm', 'a', 'y', 't', 'o', 'z', '.', 'c', 'o', 'm', '\0', - /* "fromscratch.rocks", true */ 'f', 'r', 'o', 'm', 's', 'c', 'r', 'a', 't', 'c', 'h', '.', 'r', 'o', 'c', 'k', 's', '\0', /* "fronteers.nl", false */ 'f', 'r', 'o', 'n', 't', 'e', 'e', 'r', 's', '.', 'n', 'l', '\0', /* "frontisme.nl", true */ 'f', 'r', 'o', 'n', 't', 'i', 's', 'm', 'e', '.', 'n', 'l', '\0', /* "froot.se", true */ 'f', 'r', 'o', 'o', 't', '.', 's', 'e', '\0', @@ -5197,6 +5205,7 @@ static const char kSTSHostTable[] = { /* "fsapubs.gov", true */ 'f', 's', 'a', 'p', 'u', 'b', 's', '.', 'g', 'o', 'v', '\0', /* "fsbpaintrock.com", true */ 'f', 's', 'b', 'p', 'a', 'i', 'n', 't', 'r', 'o', 'c', 'k', '.', 'c', 'o', 'm', '\0', /* "fsbturton.com", true */ 'f', 's', 'b', 't', 'u', 'r', 't', 'o', 'n', '.', 'c', 'o', 'm', '\0', + /* "fsf.moe", true */ 'f', 's', 'f', '.', 'm', 'o', 'e', '\0', /* "fsfi.is", true */ 'f', 's', 'f', 'i', '.', 'i', 's', '\0', /* "fsinf.at", true */ 'f', 's', 'i', 'n', 'f', '.', 'a', 't', '\0', /* "fsm2016.org", true */ 'f', 's', 'm', '2', '0', '1', '6', '.', 'o', 'r', 'g', '\0', @@ -5312,7 +5321,6 @@ static const char kSTSHostTable[] = { /* "gambitprint.com", true */ 'g', 'a', 'm', 'b', 'i', 't', 'p', 'r', 'i', 'n', 't', '.', 'c', 'o', 'm', '\0', /* "game-files.net", true */ 'g', 'a', 'm', 'e', '-', 'f', 'i', 'l', 'e', 's', '.', 'n', 'e', 't', '\0', /* "game-gentle.com", true */ 'g', 'a', 'm', 'e', '-', 'g', 'e', 'n', 't', 'l', 'e', '.', 'c', 'o', 'm', '\0', - /* "game.yt", true */ 'g', 'a', 'm', 'e', '.', 'y', 't', '\0', /* "game7.de", true */ 'g', 'a', 'm', 'e', '7', '.', 'd', 'e', '\0', /* "gamecard-shop.nl", true */ 'g', 'a', 'm', 'e', 'c', 'a', 'r', 'd', '-', 's', 'h', 'o', 'p', '.', 'n', 'l', '\0', /* "gameclue.jp", true */ 'g', 'a', 'm', 'e', 'c', 'l', 'u', 'e', '.', 'j', 'p', '\0', @@ -5619,6 +5627,7 @@ static const char kSTSHostTable[] = { /* "golfhausmallorca.com", true */ 'g', 'o', 'l', 'f', 'h', 'a', 'u', 's', 'm', 'a', 'l', 'l', 'o', 'r', 'c', 'a', '.', 'c', 'o', 'm', '\0', /* "golfscape.com", true */ 'g', 'o', 'l', 'f', 's', 'c', 'a', 'p', 'e', '.', 'c', 'o', 'm', '\0', /* "gong8.win", true */ 'g', 'o', 'n', 'g', '8', '.', 'w', 'i', 'n', '\0', + /* "gonkar.com", true */ 'g', 'o', 'n', 'k', 'a', 'r', '.', 'c', 'o', 'm', '\0', /* "goo.gl", true */ 'g', 'o', 'o', '.', 'g', 'l', '\0', /* "gooby.co", false */ 'g', 'o', 'o', 'b', 'y', '.', 'c', 'o', '\0', /* "goodmengroup.de", true */ 'g', 'o', 'o', 'd', 'm', 'e', 'n', 'g', 'r', 'o', 'u', 'p', '.', 'd', 'e', '\0', @@ -5661,7 +5670,6 @@ static const char kSTSHostTable[] = { /* "governorhub.com", true */ 'g', 'o', 'v', 'e', 'r', 'n', 'o', 'r', 'h', 'u', 'b', '.', 'c', 'o', 'm', '\0', /* "govtrack.us", true */ 'g', 'o', 'v', 't', 'r', 'a', 'c', 'k', '.', 'u', 's', '\0', /* "gowe.wang", false */ 'g', 'o', 'w', 'e', '.', 'w', 'a', 'n', 'g', '\0', - /* "gozel.com.tr", true */ 'g', 'o', 'z', 'e', 'l', '.', 'c', 'o', 'm', '.', 't', 'r', '\0', /* "gpcsolutions.fr", true */ 'g', 'p', 'c', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n', 's', '.', 'f', 'r', '\0', /* "gpfclan.de", true */ 'g', 'p', 'f', 'c', 'l', 'a', 'n', '.', 'd', 'e', '\0', /* "gplintegratedit.com", true */ 'g', 'p', 'l', 'i', 'n', 't', 'e', 'g', 'r', 'a', 't', 'e', 'd', 'i', 't', '.', 'c', 'o', 'm', '\0', @@ -5677,7 +5685,6 @@ static const char kSTSHostTable[] = { /* "grace-wan.com", true */ 'g', 'r', 'a', 'c', 'e', '-', 'w', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "gracedays.org", true */ 'g', 'r', 'a', 'c', 'e', 'd', 'a', 'y', 's', '.', 'o', 'r', 'g', '\0', /* "graceful-project.eu", true */ 'g', 'r', 'a', 'c', 'e', 'f', 'u', 'l', '-', 'p', 'r', 'o', 'j', 'e', 'c', 't', '.', 'e', 'u', '\0', - /* "gracethrufaith.com", true */ 'g', 'r', 'a', 'c', 'e', 't', 'h', 'r', 'u', 'f', 'a', 'i', 't', 'h', '.', 'c', 'o', 'm', '\0', /* "gracetini.com", true */ 'g', 'r', 'a', 'c', 'e', 't', 'i', 'n', 'i', '.', 'c', 'o', 'm', '\0', /* "graciousmay.com", true */ 'g', 'r', 'a', 'c', 'i', 'o', 'u', 's', 'm', 'a', 'y', '.', 'c', 'o', 'm', '\0', /* "grademymac.com", true */ 'g', 'r', 'a', 'd', 'e', 'm', 'y', 'm', 'a', 'c', '.', 'c', 'o', 'm', '\0', @@ -5699,9 +5706,7 @@ static const char kSTSHostTable[] = { /* "grandpadusercontent.com", true */ 'g', 'r', 'a', 'n', 'd', 'p', 'a', 'd', 'u', 's', 'e', 'r', 'c', 'o', 'n', 't', 'e', 'n', 't', '.', 'c', 'o', 'm', '\0', /* "grandwailea.com", true */ 'g', 'r', 'a', 'n', 'd', 'w', 'a', 'i', 'l', 'e', 'a', '.', 'c', 'o', 'm', '\0', /* "grannyshouse.de", true */ 'g', 'r', 'a', 'n', 'n', 'y', 's', 'h', 'o', 'u', 's', 'e', '.', 'd', 'e', '\0', - /* "grantedby.me", false */ 'g', 'r', 'a', 'n', 't', 'e', 'd', 'b', 'y', '.', 'm', 'e', '\0', /* "granth.io", true */ 'g', 'r', 'a', 'n', 't', 'h', '.', 'i', 'o', '\0', - /* "granular.ag", true */ 'g', 'r', 'a', 'n', 'u', 'l', 'a', 'r', '.', 'a', 'g', '\0', /* "graphene.software", true */ 'g', 'r', 'a', 'p', 'h', 'e', 'n', 'e', '.', 's', 'o', 'f', 't', 'w', 'a', 'r', 'e', '\0', /* "graphire.io", true */ 'g', 'r', 'a', 'p', 'h', 'i', 'r', 'e', '.', 'i', 'o', '\0', /* "graphsearchengine.com", true */ 'g', 'r', 'a', 'p', 'h', 's', 'e', 'a', 'r', 'c', 'h', 'e', 'n', 'g', 'i', 'n', 'e', '.', 'c', 'o', 'm', '\0', @@ -5847,6 +5852,9 @@ static const char kSTSHostTable[] = { /* "gus.moe", true */ 'g', 'u', 's', '.', 'm', 'o', 'e', '\0', /* "guscaplan.me", true */ 'g', 'u', 's', 'c', 'a', 'p', 'l', 'a', 'n', '.', 'm', 'e', '\0', /* "guso.gq", true */ 'g', 'u', 's', 'o', '.', 'g', 'q', '\0', + /* "guso.ml", true */ 'g', 'u', 's', 'o', '.', 'm', 'l', '\0', + /* "guso.site", true */ 'g', 'u', 's', 'o', '.', 's', 'i', 't', 'e', '\0', + /* "guso.tech", true */ 'g', 'u', 's', 'o', '.', 't', 'e', 'c', 'h', '\0', /* "guthabenkarten-billiger.de", true */ 'g', 'u', 't', 'h', 'a', 'b', 'e', 'n', 'k', 'a', 'r', 't', 'e', 'n', '-', 'b', 'i', 'l', 'l', 'i', 'g', 'e', 'r', '.', 'd', 'e', '\0', /* "guts.me", true */ 'g', 'u', 't', 's', '.', 'm', 'e', '\0', /* "guvernalternativa.ro", true */ 'g', 'u', 'v', 'e', 'r', 'n', 'a', 'l', 't', 'e', 'r', 'n', 'a', 't', 'i', 'v', 'a', '.', 'r', 'o', '\0', @@ -5881,6 +5889,7 @@ static const char kSTSHostTable[] = { /* "habtium.es", true */ 'h', 'a', 'b', 't', 'i', 'u', 'm', '.', 'e', 's', '\0', /* "hac30.com", true */ 'h', 'a', 'c', '3', '0', '.', 'c', 'o', 'm', '\0', /* "hachre.de", false */ 'h', 'a', 'c', 'h', 'r', 'e', '.', 'd', 'e', '\0', + /* "hackcraft.net", true */ 'h', 'a', 'c', 'k', 'c', 'r', 'a', 'f', 't', '.', 'n', 'e', 't', '\0', /* "hackenkunjeleren.nl", true */ 'h', 'a', 'c', 'k', 'e', 'n', 'k', 'u', 'n', 'j', 'e', 'l', 'e', 'r', 'e', 'n', '.', 'n', 'l', '\0', /* "hackenturet.dk", true */ 'h', 'a', 'c', 'k', 'e', 'n', 't', 'u', 'r', 'e', 't', '.', 'd', 'k', '\0', /* "hacker.parts", true */ 'h', 'a', 'c', 'k', 'e', 'r', '.', 'p', 'a', 'r', 't', 's', '\0', @@ -5943,6 +5952,7 @@ static const char kSTSHostTable[] = { /* "haozhang.org", true */ 'h', 'a', 'o', 'z', 'h', 'a', 'n', 'g', '.', 'o', 'r', 'g', '\0', /* "haozi.me", true */ 'h', 'a', 'o', 'z', 'i', '.', 'm', 'e', '\0', /* "hapijs.cn", true */ 'h', 'a', 'p', 'i', 'j', 's', '.', 'c', 'n', '\0', + /* "hapivm.com", true */ 'h', 'a', 'p', 'i', 'v', 'm', '.', 'c', 'o', 'm', '\0', /* "happist.com", true */ 'h', 'a', 'p', 'p', 'i', 's', 't', '.', 'c', 'o', 'm', '\0', /* "happix.nl", true */ 'h', 'a', 'p', 'p', 'i', 'x', '.', 'n', 'l', '\0', /* "happyandrelaxeddogs.eu", true */ 'h', 'a', 'p', 'p', 'y', 'a', 'n', 'd', 'r', 'e', 'l', 'a', 'x', 'e', 'd', 'd', 'o', 'g', 's', '.', 'e', 'u', '\0', @@ -5951,7 +5961,6 @@ static const char kSTSHostTable[] = { /* "happyteamlabs.com", true */ 'h', 'a', 'p', 'p', 'y', 't', 'e', 'a', 'm', 'l', 'a', 'b', 's', '.', 'c', 'o', 'm', '\0', /* "happytiger.eu", true */ 'h', 'a', 'p', 'p', 'y', 't', 'i', 'g', 'e', 'r', '.', 'e', 'u', '\0', /* "happyukgo.com", true */ 'h', 'a', 'p', 'p', 'y', 'u', 'k', 'g', 'o', '.', 'c', 'o', 'm', '\0', - /* "hapvm.com", true */ 'h', 'a', 'p', 'v', 'm', '.', 'c', 'o', 'm', '\0', /* "haraj.com.sa", true */ 'h', 'a', 'r', 'a', 'j', '.', 'c', 'o', 'm', '.', 's', 'a', '\0', /* "harambe.site", true */ 'h', 'a', 'r', 'a', 'm', 'b', 'e', '.', 's', 'i', 't', 'e', '\0', /* "hardeman.nu", true */ 'h', 'a', 'r', 'd', 'e', 'm', 'a', 'n', '.', 'n', 'u', '\0', @@ -6102,7 +6111,6 @@ static const char kSTSHostTable[] = { /* "hennymerkel.com", true */ 'h', 'e', 'n', 'n', 'y', 'm', 'e', 'r', 'k', 'e', 'l', '.', 'c', 'o', 'm', '\0', /* "henok.eu", true */ 'h', 'e', 'n', 'o', 'k', '.', 'e', 'u', '\0', /* "henriksen.is", true */ 'h', 'e', 'n', 'r', 'i', 'k', 's', 'e', 'n', '.', 'i', 's', '\0', - /* "henrock.net", true */ 'h', 'e', 'n', 'r', 'o', 'c', 'k', '.', 'n', 'e', 't', '\0', /* "henry.gg", true */ 'h', 'e', 'n', 'r', 'y', '.', 'g', 'g', '\0', /* "henryphan.com", false */ 'h', 'e', 'n', 'r', 'y', 'p', 'h', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "hentschke-bau.de", true */ 'h', 'e', 'n', 't', 's', 'c', 'h', 'k', 'e', '-', 'b', 'a', 'u', '.', 'd', 'e', '\0', @@ -6211,7 +6219,6 @@ static const char kSTSHostTable[] = { /* "hohm.in", true */ 'h', 'o', 'h', 'm', '.', 'i', 'n', '\0', /* "hohnet.com", true */ 'h', 'o', 'h', 'n', 'e', 't', '.', 'c', 'o', 'm', '\0', /* "hoiku-map.tokyo", true */ 'h', 'o', 'i', 'k', 'u', '-', 'm', 'a', 'p', '.', 't', 'o', 'k', 'y', 'o', '\0', - /* "hokieprivacy.org", true */ 'h', 'o', 'k', 'i', 'e', 'p', 'r', 'i', 'v', 'a', 'c', 'y', '.', 'o', 'r', 'g', '\0', /* "holisticon.de", true */ 'h', 'o', 'l', 'i', 's', 't', 'i', 'c', 'o', 'n', '.', 'd', 'e', '\0', /* "hollowrap.com", true */ 'h', 'o', 'l', 'l', 'o', 'w', 'r', 'a', 'p', '.', 'c', 'o', 'm', '\0', /* "hollyforrest.ca", true */ 'h', 'o', 'l', 'l', 'y', 'f', 'o', 'r', 'r', 'e', 's', 't', '.', 'c', 'a', '\0', @@ -6340,6 +6347,7 @@ static const char kSTSHostTable[] = { /* "hsts.com.br", true */ 'h', 's', 't', 's', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', /* "hsts.eu", true */ 'h', 's', 't', 's', '.', 'e', 'u', '\0', /* "hstspreload.com", true */ 'h', 's', 't', 's', 'p', 'r', 'e', 'l', 'o', 'a', 'd', '.', 'c', 'o', 'm', '\0', + /* "hstspreload.org", true */ 'h', 's', 't', 's', 'p', 'r', 'e', 'l', 'o', 'a', 'd', '.', 'o', 'r', 'g', '\0', /* "hszemi.de", true */ 'h', 's', 'z', 'e', 'm', 'i', '.', 'd', 'e', '\0', /* "hszhyy120.com", true */ 'h', 's', 'z', 'h', 'y', 'y', '1', '2', '0', '.', 'c', 'o', 'm', '\0', /* "htaccessbook.com", true */ 'h', 't', 'a', 'c', 'c', 'e', 's', 's', 'b', 'o', 'o', 'k', '.', 'c', 'o', 'm', '\0', @@ -6684,7 +6692,6 @@ static const char kSTSHostTable[] = { /* "inline-sport.cz", true */ 'i', 'n', 'l', 'i', 'n', 'e', '-', 's', 'p', 'o', 'r', 't', '.', 'c', 'z', '\0', /* "inme.ga", true */ 'i', 'n', 'm', 'e', '.', 'g', 'a', '\0', /* "innermostparts.org", true */ 'i', 'n', 'n', 'e', 'r', 'm', 'o', 's', 't', 'p', 'a', 'r', 't', 's', '.', 'o', 'r', 'g', '\0', - /* "innoloop.com", true */ 'i', 'n', 'n', 'o', 'l', 'o', 'o', 'p', '.', 'c', 'o', 'm', '\0', /* "innophate-security.com", true */ 'i', 'n', 'n', 'o', 'p', 'h', 'a', 't', 'e', '-', 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "innovaptor.at", true */ 'i', 'n', 'n', 'o', 'v', 'a', 'p', 't', 'o', 'r', '.', 'a', 't', '\0', /* "innovaptor.com", true */ 'i', 'n', 'n', 'o', 'v', 'a', 'p', 't', 'o', 'r', '.', 'c', 'o', 'm', '\0', @@ -6711,7 +6718,6 @@ static const char kSTSHostTable[] = { /* "instics.com", true */ 'i', 'n', 's', 't', 'i', 'c', 's', '.', 'c', 'o', 'm', '\0', /* "instinctiveads.com", true */ 'i', 'n', 's', 't', 'i', 'n', 'c', 't', 'i', 'v', 'e', 'a', 'd', 's', '.', 'c', 'o', 'm', '\0', /* "institut-confucius-montpellier.org", true */ 'i', 'n', 's', 't', 'i', 't', 'u', 't', '-', 'c', 'o', 'n', 'f', 'u', 'c', 'i', 'u', 's', '-', 'm', 'o', 'n', 't', 'p', 'e', 'l', 'l', 'i', 'e', 'r', '.', 'o', 'r', 'g', '\0', - /* "institutolancaster.com", true */ 'i', 'n', 's', 't', 'i', 't', 'u', 't', 'o', 'l', 'a', 'n', 'c', 'a', 's', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "institutulcultural.ro", true */ 'i', 'n', 's', 't', 'i', 't', 'u', 't', 'u', 'l', 'c', 'u', 'l', 't', 'u', 'r', 'a', 'l', '.', 'r', 'o', '\0', /* "instruktor.io", true */ 'i', 'n', 's', 't', 'r', 'u', 'k', 't', 'o', 'r', '.', 'i', 'o', '\0', /* "insurance321.com", true */ 'i', 'n', 's', 'u', 'r', 'a', 'n', 'c', 'e', '3', '2', '1', '.', 'c', 'o', 'm', '\0', @@ -6741,6 +6747,7 @@ static const char kSTSHostTable[] = { /* "intermedinet.nl", true */ 'i', 'n', 't', 'e', 'r', 'm', 'e', 'd', 'i', 'n', 'e', 't', '.', 'n', 'l', '\0', /* "internaldh.com", true */ 'i', 'n', 't', 'e', 'r', 'n', 'a', 'l', 'd', 'h', '.', 'c', 'o', 'm', '\0', /* "internaut.co.za", true */ 'i', 'n', 't', 'e', 'r', 'n', 'a', 'u', 't', '.', 'c', 'o', '.', 'z', 'a', '\0', + /* "internect.co.za", true */ 'i', 'n', 't', 'e', 'r', 'n', 'e', 'c', 't', '.', 'c', 'o', '.', 'z', 'a', '\0', /* "internet-pornografie.de", true */ 'i', 'n', 't', 'e', 'r', 'n', 'e', 't', '-', 'p', 'o', 'r', 'n', 'o', 'g', 'r', 'a', 'f', 'i', 'e', '.', 'd', 'e', '\0', /* "internetbank.swedbank.se", true */ 'i', 'n', 't', 'e', 'r', 'n', 'e', 't', 'b', 'a', 'n', 'k', '.', 's', 'w', 'e', 'd', 'b', 'a', 'n', 'k', '.', 's', 'e', '\0', /* "internetbugbounty.org", true */ 'i', 'n', 't', 'e', 'r', 'n', 'e', 't', 'b', 'u', 'g', 'b', 'o', 'u', 'n', 't', 'y', '.', 'o', 'r', 'g', '\0', @@ -6897,7 +6904,6 @@ static const char kSTSHostTable[] = { /* "istanbul.systems", true */ 'i', 's', 't', 'a', 'n', 'b', 'u', 'l', '.', 's', 'y', 's', 't', 'e', 'm', 's', '\0', /* "istanbultravelguide.info", true */ 'i', 's', 't', 'a', 'n', 'b', 'u', 'l', 't', 'r', 'a', 'v', 'e', 'l', 'g', 'u', 'i', 'd', 'e', '.', 'i', 'n', 'f', 'o', '\0', /* "istdieweltschonuntergegangen.de", true */ 'i', 's', 't', 'd', 'i', 'e', 'w', 'e', 'l', 't', 's', 'c', 'h', 'o', 'n', 'u', 'n', 't', 'e', 'r', 'g', 'e', 'g', 'a', 'n', 'g', 'e', 'n', '.', 'd', 'e', '\0', - /* "isteinbaby.de", true */ 'i', 's', 't', 'e', 'i', 'n', 'b', 'a', 'b', 'y', '.', 'd', 'e', '\0', /* "istgame.com", true */ 'i', 's', 't', 'g', 'a', 'm', 'e', '.', 'c', 'o', 'm', '\0', /* "istheapplestoredown.com", true */ 'i', 's', 't', 'h', 'e', 'a', 'p', 'p', 'l', 'e', 's', 't', 'o', 'r', 'e', 'd', 'o', 'w', 'n', '.', 'c', 'o', 'm', '\0', /* "istheapplestoredown.de", true */ 'i', 's', 't', 'h', 'e', 'a', 'p', 'p', 'l', 'e', 's', 't', 'o', 'r', 'e', 'd', 'o', 'w', 'n', '.', 'd', 'e', '\0', @@ -6949,7 +6955,6 @@ static const char kSTSHostTable[] = { /* "its-v.de", true */ 'i', 't', 's', '-', 'v', '.', 'd', 'e', '\0', /* "its4living.com", true */ 'i', 't', 's', '4', 'l', 'i', 'v', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "itsanicedoor.co.uk", true */ 'i', 't', 's', 'a', 'n', 'i', 'c', 'e', 'd', 'o', 'o', 'r', '.', 'c', 'o', '.', 'u', 'k', '\0', - /* "itsatrap.nl", true */ 'i', 't', 's', 'a', 't', 'r', 'a', 'p', '.', 'n', 'l', '\0', /* "itsecguy.com", true */ 'i', 't', 's', 'e', 'c', 'g', 'u', 'y', '.', 'c', 'o', 'm', '\0', /* "itsgoingdown.org", true */ 'i', 't', 's', 'g', 'o', 'i', 'n', 'g', 'd', 'o', 'w', 'n', '.', 'o', 'r', 'g', '\0', /* "itskayla.com", false */ 'i', 't', 's', 'k', 'a', 'y', 'l', 'a', '.', 'c', 'o', 'm', '\0', @@ -7093,6 +7098,7 @@ static const char kSTSHostTable[] = { /* "javalestari.com", true */ 'j', 'a', 'v', 'a', 'l', 'e', 's', 't', 'a', 'r', 'i', '.', 'c', 'o', 'm', '\0', /* "javamilk.com", true */ 'j', 'a', 'v', 'a', 'm', 'i', 'l', 'k', '.', 'c', 'o', 'm', '\0', /* "javelinsms.com", true */ 'j', 'a', 'v', 'e', 'l', 'i', 'n', 's', 'm', 's', '.', 'c', 'o', 'm', '\0', + /* "jayf.de", true */ 'j', 'a', 'y', 'f', '.', 'd', 'e', '\0', /* "jayharris.ca", true */ 'j', 'a', 'y', 'h', 'a', 'r', 'r', 'i', 's', '.', 'c', 'a', '\0', /* "jaylen.com.ar", true */ 'j', 'a', 'y', 'l', 'e', 'n', '.', 'c', 'o', 'm', '.', 'a', 'r', '\0', /* "jaymecd.rocks", true */ 'j', 'a', 'y', 'm', 'e', 'c', 'd', '.', 'r', 'o', 'c', 'k', 's', '\0', @@ -7293,6 +7299,7 @@ static const char kSTSHostTable[] = { /* "joyofcookingandbaking.com", true */ 'j', 'o', 'y', 'o', 'f', 'c', 'o', 'o', 'k', 'i', 'n', 'g', 'a', 'n', 'd', 'b', 'a', 'k', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "joyqi.com", true */ 'j', 'o', 'y', 'q', 'i', '.', 'c', 'o', 'm', '\0', /* "jpaglier.com", true */ 'j', 'p', 'a', 'g', 'l', 'i', 'e', 'r', '.', 'c', 'o', 'm', '\0', + /* "jpcdi.com", true */ 'j', 'p', 'c', 'd', 'i', '.', 'c', 'o', 'm', '\0', /* "jpeaches.xyz", true */ 'j', 'p', 'e', 'a', 'c', 'h', 'e', 's', '.', 'x', 'y', 'z', '\0', /* "jpeg.io", true */ 'j', 'p', 'e', 'g', '.', 'i', 'o', '\0', /* "jproxx.com", true */ 'j', 'p', 'r', 'o', 'x', 'x', '.', 'c', 'o', 'm', '\0', @@ -7469,7 +7476,6 @@ static const char kSTSHostTable[] = { /* "kau-boys.de", true */ 'k', 'a', 'u', '-', 'b', 'o', 'y', 's', '.', 'd', 'e', '\0', /* "kaufberatung.community", true */ 'k', 'a', 'u', 'f', 'b', 'e', 'r', 'a', 't', 'u', 'n', 'g', '.', 'c', 'o', 'm', 'm', 'u', 'n', 'i', 't', 'y', '\0', /* "kavik.no", true */ 'k', 'a', 'v', 'i', 'k', '.', 'n', 'o', '\0', - /* "kavinvin.me", true */ 'k', 'a', 'v', 'i', 'n', 'v', 'i', 'n', '.', 'm', 'e', '\0', /* "kavovary-kava.cz", true */ 'k', 'a', 'v', 'o', 'v', 'a', 'r', 'y', '-', 'k', 'a', 'v', 'a', '.', 'c', 'z', '\0', /* "kawaiii.link", true */ 'k', 'a', 'w', 'a', 'i', 'i', 'i', '.', 'l', 'i', 'n', 'k', '\0', /* "kayleen.net", true */ 'k', 'a', 'y', 'l', 'e', 'e', 'n', '.', 'n', 'e', 't', '\0', @@ -7484,7 +7490,6 @@ static const char kSTSHostTable[] = { /* "kc5mpk.com", true */ 'k', 'c', '5', 'm', 'p', 'k', '.', 'c', 'o', 'm', '\0', /* "kcluster.io", true */ 'k', 'c', 'l', 'u', 's', 't', 'e', 'r', '.', 'i', 'o', '\0', /* "kcolford.com", false */ 'k', 'c', 'o', 'l', 'f', 'o', 'r', 'd', '.', 'c', 'o', 'm', '\0', - /* "kcptun.com", true */ 'k', 'c', 'p', 't', 'u', 'n', '.', 'c', 'o', 'm', '\0', /* "kcsordparticipation.org", true */ 'k', 'c', 's', 'o', 'r', 'd', 'p', 'a', 'r', 't', 'i', 'c', 'i', 'p', 'a', 't', 'i', 'o', 'n', '.', 'o', 'r', 'g', '\0', /* "kdex.de", true */ 'k', 'd', 'e', 'x', '.', 'd', 'e', '\0', /* "kdyby.org", true */ 'k', 'd', 'y', 'b', 'y', '.', 'o', 'r', 'g', '\0', @@ -7517,7 +7522,6 @@ static const char kSTSHostTable[] = { /* "kennedy.ie", true */ 'k', 'e', 'n', 'n', 'e', 'd', 'y', '.', 'i', 'e', '\0', /* "kenners.org", true */ 'k', 'e', 'n', 'n', 'e', 'r', 's', '.', 'o', 'r', 'g', '\0', /* "kennethaasan.no", true */ 'k', 'e', 'n', 'n', 'e', 't', 'h', 'a', 'a', 's', 'a', 'n', '.', 'n', 'o', '\0', - /* "kennethlim.me", true */ 'k', 'e', 'n', 'n', 'e', 't', 'h', 'l', 'i', 'm', '.', 'm', 'e', '\0', /* "kenny-peck.com", true */ 'k', 'e', 'n', 'n', 'y', '-', 'p', 'e', 'c', 'k', '.', 'c', 'o', 'm', '\0', /* "kenoschwalb.com", true */ 'k', 'e', 'n', 'o', 's', 'c', 'h', 'w', 'a', 'l', 'b', '.', 'c', 'o', 'm', '\0', /* "kentacademiestrust.org.uk", true */ 'k', 'e', 'n', 't', 'a', 'c', 'a', 'd', 'e', 'm', 'i', 'e', 's', 't', 'r', 'u', 's', 't', '.', 'o', 'r', 'g', '.', 'u', 'k', '\0', @@ -7584,6 +7588,7 @@ static const char kSTSHostTable[] = { /* "kilobyte22.de", true */ 'k', 'i', 'l', 'o', 'b', 'y', 't', 'e', '2', '2', '.', 'd', 'e', '\0', /* "kilogram.nl", true */ 'k', 'i', 'l', 'o', 'g', 'r', 'a', 'm', '.', 'n', 'l', '\0', /* "kilometertje.nl", true */ 'k', 'i', 'l', 'o', 'm', 'e', 't', 'e', 'r', 't', 'j', 'e', '.', 'n', 'l', '\0', + /* "kimberg.co.uk", true */ 'k', 'i', 'm', 'b', 'e', 'r', 'g', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "kimmel.com", true */ 'k', 'i', 'm', 'm', 'e', 'l', '.', 'c', 'o', 'm', '\0', /* "kimmel.in", true */ 'k', 'i', 'm', 'm', 'e', 'l', '.', 'i', 'n', '\0', /* "kimoota.net", true */ 'k', 'i', 'm', 'o', 'o', 't', 'a', '.', 'n', 'e', 't', '\0', @@ -7737,7 +7742,6 @@ static const char kSTSHostTable[] = { /* "kompetenzkurs.de", true */ 'k', 'o', 'm', 'p', 'e', 't', 'e', 'n', 'z', 'k', 'u', 'r', 's', '.', 'd', 'e', '\0', /* "kon-sil.de", true */ 'k', 'o', 'n', '-', 's', 'i', 'l', '.', 'd', 'e', '\0', /* "kondou-butsudan.com", true */ 'k', 'o', 'n', 'd', 'o', 'u', '-', 'b', 'u', 't', 's', 'u', 'd', 'a', 'n', '.', 'c', 'o', 'm', '\0', - /* "kongar.org", true */ 'k', 'o', 'n', 'g', 'a', 'r', '.', 'o', 'r', 'g', '\0', /* "koniecfica.sk", true */ 'k', 'o', 'n', 'i', 'e', 'c', 'f', 'i', 'c', 'a', '.', 's', 'k', '\0', /* "konijntjes.nl", true */ 'k', 'o', 'n', 'i', 'j', 'n', 't', 'j', 'e', 's', '.', 'n', 'l', '\0', /* "konklone.com", true */ 'k', 'o', 'n', 'k', 'l', 'o', 'n', 'e', '.', 'c', 'o', 'm', '\0', @@ -7790,6 +7794,7 @@ static const char kSTSHostTable[] = { /* "krasovsky.me", true */ 'k', 'r', 'a', 's', 'o', 'v', 's', 'k', 'y', '.', 'm', 'e', '\0', /* "kravelindo-adventure.com", false */ 'k', 'r', 'a', 'v', 'e', 'l', 'i', 'n', 'd', 'o', '-', 'a', 'd', 'v', 'e', 'n', 't', 'u', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "kraynik.com", true */ 'k', 'r', 'a', 'y', 'n', 'i', 'k', '.', 'c', 'o', 'm', '\0', + /* "krc.link", true */ 'k', 'r', 'c', '.', 'l', 'i', 'n', 'k', '\0', /* "kream.io", true */ 'k', 'r', 'e', 'a', 'm', '.', 'i', 'o', '\0', /* "kreationnext.com", true */ 'k', 'r', 'e', 'a', 't', 'i', 'o', 'n', 'n', 'e', 'x', 't', '.', 'c', 'o', 'm', '\0', /* "kreativstrecke.de", true */ 'k', 'r', 'e', 'a', 't', 'i', 'v', 's', 't', 'r', 'e', 'c', 'k', 'e', '.', 'd', 'e', '\0', @@ -7799,6 +7804,7 @@ static const char kSTSHostTable[] = { /* "kreditkacs.cz", true */ 'k', 'r', 'e', 'd', 'i', 't', 'k', 'a', 'c', 's', '.', 'c', 'z', '\0', /* "kreen.org", true */ 'k', 'r', 'e', 'e', 'n', '.', 'o', 'r', 'g', '\0', /* "kriechel.de", true */ 'k', 'r', 'i', 'e', 'c', 'h', 'e', 'l', '.', 'd', 'e', '\0', + /* "kriegskindernothilfe.de", true */ 'k', 'r', 'i', 'e', 'g', 's', 'k', 'i', 'n', 'd', 'e', 'r', 'n', 'o', 't', 'h', 'i', 'l', 'f', 'e', '.', 'd', 'e', '\0', /* "kriptosec.com", true */ 'k', 'r', 'i', 'p', 't', 'o', 's', 'e', 'c', '.', 'c', 'o', 'm', '\0', /* "krislamoureux.com", true */ 'k', 'r', 'i', 's', 'l', 'a', 'm', 'o', 'u', 'r', 'e', 'u', 'x', '.', 'c', 'o', 'm', '\0', /* "krisstarkey.co.uk", true */ 'k', 'r', 'i', 's', 's', 't', 'a', 'r', 'k', 'e', 'y', '.', 'c', 'o', '.', 'u', 'k', '\0', @@ -8162,6 +8168,7 @@ static const char kSTSHostTable[] = { /* "liam-w.com", false */ 'l', 'i', 'a', 'm', '-', 'w', '.', 'c', 'o', 'm', '\0', /* "liangji.com.tw", false */ 'l', 'i', 'a', 'n', 'g', 'j', 'i', '.', 'c', 'o', 'm', '.', 't', 'w', '\0', /* "libanco.com", true */ 'l', 'i', 'b', 'a', 'n', 'c', 'o', '.', 'c', 'o', 'm', '\0', + /* "libbitcoin.org", true */ 'l', 'i', 'b', 'b', 'i', 't', 'c', 'o', 'i', 'n', '.', 'o', 'r', 'g', '\0', /* "libble.eu", true */ 'l', 'i', 'b', 'b', 'l', 'e', '.', 'e', 'u', '\0', /* "libertas-tech.com", true */ 'l', 'i', 'b', 'e', 'r', 't', 'a', 's', '-', 't', 'e', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "libfte.org", true */ 'l', 'i', 'b', 'f', 't', 'e', '.', 'o', 'r', 'g', '\0', @@ -8407,6 +8414,7 @@ static const char kSTSHostTable[] = { /* "loopstart.org", true */ 'l', 'o', 'o', 'p', 's', 't', 'a', 'r', 't', '.', 'o', 'r', 'g', '\0', /* "loothole.com", true */ 'l', 'o', 'o', 't', 'h', 'o', 'l', 'e', '.', 'c', 'o', 'm', '\0', /* "loqu8.com", true */ 'l', 'o', 'q', 'u', '8', '.', 'c', 'o', 'm', '\0', + /* "lordjevington.co.uk", true */ 'l', 'o', 'r', 'd', 'j', 'e', 'v', 'i', 'n', 'g', 't', 'o', 'n', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "lore.azurewebsites.net", true */ 'l', 'o', 'r', 'e', '.', 'a', 'z', 'u', 'r', 'e', 'w', 'e', 'b', 's', 'i', 't', 'e', 's', '.', 'n', 'e', 't', '\0', /* "lorenadumitrascu.ro", true */ 'l', 'o', 'r', 'e', 'n', 'a', 'd', 'u', 'm', 'i', 't', 'r', 'a', 's', 'c', 'u', '.', 'r', 'o', '\0', /* "losless.fr", true */ 'l', 'o', 's', 'l', 'e', 's', 's', '.', 'f', 'r', '\0', @@ -8432,7 +8440,6 @@ static const char kSTSHostTable[] = { /* "loveismore.sk", true */ 'l', 'o', 'v', 'e', 'i', 's', 'm', 'o', 'r', 'e', '.', 's', 'k', '\0', /* "loveisourweapon.com", true */ 'l', 'o', 'v', 'e', 'i', 's', 'o', 'u', 'r', 'w', 'e', 'a', 'p', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "lovelivewiki.com", true */ 'l', 'o', 'v', 'e', 'l', 'i', 'v', 'e', 'w', 'i', 'k', 'i', '.', 'c', 'o', 'm', '\0', - /* "lovelyblogacademy.com", true */ 'l', 'o', 'v', 'e', 'l', 'y', 'b', 'l', 'o', 'g', 'a', 'c', 'a', 'd', 'e', 'm', 'y', '.', 'c', 'o', 'm', '\0', /* "lovemomiji.com", true */ 'l', 'o', 'v', 'e', 'm', 'o', 'm', 'i', 'j', 'i', '.', 'c', 'o', 'm', '\0', /* "loveph.one", true */ 'l', 'o', 'v', 'e', 'p', 'h', '.', 'o', 'n', 'e', '\0', /* "lover-bg.com", true */ 'l', 'o', 'v', 'e', 'r', '-', 'b', 'g', '.', 'c', 'o', 'm', '\0', @@ -8547,6 +8554,8 @@ static const char kSTSHostTable[] = { /* "macchedil.com", false */ 'm', 'a', 'c', 'c', 'h', 'e', 'd', 'i', 'l', '.', 'c', 'o', 'm', '\0', /* "macdj.tk", true */ 'm', 'a', 'c', 'd', 'j', '.', 't', 'k', '\0', /* "mach-politik.ch", true */ 'm', 'a', 'c', 'h', '-', 'p', 'o', 'l', 'i', 't', 'i', 'k', '.', 'c', 'h', '\0', + /* "machbach.com", true */ 'm', 'a', 'c', 'h', 'b', 'a', 'c', 'h', '.', 'c', 'o', 'm', '\0', + /* "machbach.net", true */ 'm', 'a', 'c', 'h', 'b', 'a', 'c', 'h', '.', 'n', 'e', 't', '\0', /* "machtweb.de", true */ 'm', 'a', 'c', 'h', 't', 'w', 'e', 'b', '.', 'd', 'e', '\0', /* "macinyasha.net", true */ 'm', 'a', 'c', 'i', 'n', 'y', 'a', 's', 'h', 'a', '.', 'n', 'e', 't', '\0', /* "macker.io", true */ 'm', 'a', 'c', 'k', 'e', 'r', '.', 'i', 'o', '\0', @@ -8565,6 +8574,7 @@ static const char kSTSHostTable[] = { /* "madnetwork.org", true */ 'm', 'a', 'd', 'n', 'e', 't', 'w', 'o', 'r', 'k', '.', 'o', 'r', 'g', '\0', /* "madokami.net", true */ 'm', 'a', 'd', 'o', 'k', 'a', 'm', 'i', '.', 'n', 'e', 't', '\0', /* "madrants.net", true */ 'm', 'a', 'd', 'r', 'a', 'n', 't', 's', '.', 'n', 'e', 't', '\0', + /* "madreacqua.org", true */ 'm', 'a', 'd', 'r', 'e', 'a', 'c', 'q', 'u', 'a', '.', 'o', 'r', 'g', '\0', /* "madtec.de", true */ 'm', 'a', 'd', 't', 'e', 'c', '.', 'd', 'e', '\0', /* "madusecurity.com", true */ 'm', 'a', 'd', 'u', 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "maelstrom.ninja", true */ 'm', 'a', 'e', 'l', 's', 't', 'r', 'o', 'm', '.', 'n', 'i', 'n', 'j', 'a', '\0', @@ -8666,7 +8676,6 @@ static const char kSTSHostTable[] = { /* "manhattanchoralensemble.org", true */ 'm', 'a', 'n', 'h', 'a', 't', 't', 'a', 'n', 'c', 'h', 'o', 'r', 'a', 'l', 'e', 'n', 's', 'e', 'm', 'b', 'l', 'e', '.', 'o', 'r', 'g', '\0', /* "maniadeprazer.com.br", true */ 'm', 'a', 'n', 'i', 'a', 'd', 'e', 'p', 'r', 'a', 'z', 'e', 'r', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', /* "manicode.com", true */ 'm', 'a', 'n', 'i', 'c', 'o', 'd', 'e', '.', 'c', 'o', 'm', '\0', - /* "manifestbin.com", true */ 'm', 'a', 'n', 'i', 'f', 'e', 's', 't', 'b', 'i', 'n', '.', 'c', 'o', 'm', '\0', /* "manja-und-martin.de", true */ 'm', 'a', 'n', 'j', 'a', '-', 'u', 'n', 'd', '-', 'm', 'a', 'r', 't', 'i', 'n', '.', 'd', 'e', '\0', /* "manoirdecontres.com", true */ 'm', 'a', 'n', 'o', 'i', 'r', 'd', 'e', 'c', 'o', 'n', 't', 'r', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "manowarus.com", true */ 'm', 'a', 'n', 'o', 'w', 'a', 'r', 'u', 's', '.', 'c', 'o', 'm', '\0', @@ -8793,7 +8802,6 @@ static const char kSTSHostTable[] = { /* "mathieuguimond.com", true */ 'm', 'a', 't', 'h', 'i', 'e', 'u', 'g', 'u', 'i', 'm', 'o', 'n', 'd', '.', 'c', 'o', 'm', '\0', /* "mathieui.net", true */ 'm', 'a', 't', 'h', 'i', 'e', 'u', 'i', '.', 'n', 'e', 't', '\0', /* "matrict.com", true */ 'm', 'a', 't', 'r', 'i', 'c', 't', '.', 'c', 'o', 'm', '\0', - /* "matrixcheats.net", true */ 'm', 'a', 't', 'r', 'i', 'x', 'c', 'h', 'e', 'a', 't', 's', '.', 'n', 'e', 't', '\0', /* "matt.tf", true */ 'm', 'a', 't', 't', '.', 't', 'f', '\0', /* "mattandreko.com", true */ 'm', 'a', 't', 't', 'a', 'n', 'd', 'r', 'e', 'k', 'o', '.', 'c', 'o', 'm', '\0', /* "mattandyana.com", true */ 'm', 'a', 't', 't', 'a', 'n', 'd', 'y', 'a', 'n', 'a', '.', 'c', 'o', 'm', '\0', @@ -9074,7 +9082,6 @@ static const char kSTSHostTable[] = { /* "microco.sm", true */ 'm', 'i', 'c', 'r', 'o', 'c', 'o', '.', 's', 'm', '\0', /* "microdots.de", true */ 'm', 'i', 'c', 'r', 'o', 'd', 'o', 't', 's', '.', 'd', 'e', '\0', /* "microlog.org", true */ 'm', 'i', 'c', 'r', 'o', 'l', 'o', 'g', '.', 'o', 'r', 'g', '\0', - /* "microtalk.org", true */ 'm', 'i', 'c', 'r', 'o', 't', 'a', 'l', 'k', '.', 'o', 'r', 'g', '\0', /* "microvb.com", true */ 'm', 'i', 'c', 'r', 'o', 'v', 'b', '.', 'c', 'o', 'm', '\0', /* "midair.io", true */ 'm', 'i', 'd', 'a', 'i', 'r', '.', 'i', 'o', '\0', /* "midirs.org", true */ 'm', 'i', 'd', 'i', 'r', 's', '.', 'o', 'r', 'g', '\0', @@ -9101,7 +9108,6 @@ static const char kSTSHostTable[] = { /* "mikaela.info", true */ 'm', 'i', 'k', 'a', 'e', 'l', 'a', '.', 'i', 'n', 'f', 'o', '\0', /* "mikalikes.men", true */ 'm', 'i', 'k', 'a', 'l', 'i', 'k', 'e', 's', '.', 'm', 'e', 'n', '\0', /* "mike-bland.com", true */ 'm', 'i', 'k', 'e', '-', 'b', 'l', 'a', 'n', 'd', '.', 'c', 'o', 'm', '\0', - /* "mikek.work", true */ 'm', 'i', 'k', 'e', 'k', '.', 'w', 'o', 'r', 'k', '\0', /* "mikepair.net", true */ 'm', 'i', 'k', 'e', 'p', 'a', 'i', 'r', '.', 'n', 'e', 't', '\0', /* "mikes.tk", true */ 'm', 'i', 'k', 'e', 's', '.', 't', 'k', '\0', /* "miketabor.com", true */ 'm', 'i', 'k', 'e', 't', 'a', 'b', 'o', 'r', '.', 'c', 'o', 'm', '\0', @@ -9229,6 +9235,7 @@ static const char kSTSHostTable[] = { /* "mlp.ee", true */ 'm', 'l', 'p', '.', 'e', 'e', '\0', /* "mlrslateroofing.com.au", true */ 'm', 'l', 'r', 's', 'l', 'a', 't', 'e', 'r', 'o', 'o', 'f', 'i', 'n', 'g', '.', 'c', 'o', 'm', '.', 'a', 'u', '\0', /* "mlsrv.de", true */ 'm', 'l', 's', 'r', 'v', '.', 'd', 'e', '\0', + /* "mlvbphotography.com", true */ 'm', 'l', 'v', 'b', 'p', 'h', 'o', 't', 'o', 'g', 'r', 'a', 'p', 'h', 'y', '.', 'c', 'o', 'm', '\0', /* "mm13.at", true */ 'm', 'm', '1', '3', '.', 'a', 't', '\0', /* "mm404.com", true */ 'm', 'm', '4', '0', '4', '.', 'c', 'o', 'm', '\0', /* "mma-acareporting.com", true */ 'm', 'm', 'a', '-', 'a', 'c', 'a', 'r', 'e', 'p', 'o', 'r', 't', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', @@ -9271,7 +9278,6 @@ static const char kSTSHostTable[] = { /* "moddedark.com", true */ 'm', 'o', 'd', 'd', 'e', 'd', 'a', 'r', 'k', '.', 'c', 'o', 'm', '\0', /* "mode-individuell.de", true */ 'm', 'o', 'd', 'e', '-', 'i', 'n', 'd', 'i', 'v', 'i', 'd', 'u', 'e', 'l', 'l', '.', 'd', 'e', '\0', /* "modecaso.com", true */ 'm', 'o', 'd', 'e', 'c', 'a', 's', 'o', '.', 'c', 'o', 'm', '\0', - /* "model9.io", true */ 'm', 'o', 'd', 'e', 'l', '9', '.', 'i', 'o', '\0', /* "modelcase.co.jp", false */ 'm', 'o', 'd', 'e', 'l', 'c', 'a', 's', 'e', '.', 'c', 'o', '.', 'j', 'p', '\0', /* "modelcube.com", true */ 'm', 'o', 'd', 'e', 'l', 'c', 'u', 'b', 'e', '.', 'c', 'o', 'm', '\0', /* "modeldimension.com", true */ 'm', 'o', 'd', 'e', 'l', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', @@ -9594,6 +9600,7 @@ static const char kSTSHostTable[] = { /* "mytc.fr", true */ 'm', 'y', 't', 'c', '.', 'f', 'r', '\0', /* "mythengay.ch", true */ 'm', 'y', 't', 'h', 'e', 'n', 'g', 'a', 'y', '.', 'c', 'h', '\0', /* "mythlogic.com", true */ 'm', 'y', 't', 'h', 'l', 'o', 'g', 'i', 'c', '.', 'c', 'o', 'm', '\0', + /* "mythslegendscollection.com", true */ 'm', 'y', 't', 'h', 's', 'l', 'e', 'g', 'e', 'n', 'd', 's', 'c', 'o', 'l', 'l', 'e', 'c', 't', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "mytraiteurs.com", true */ 'm', 'y', 't', 'r', 'a', 'i', 't', 'e', 'u', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "mytripcar.co.uk", true */ 'm', 'y', 't', 'r', 'i', 'p', 'c', 'a', 'r', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "mytripcar.de", true */ 'm', 'y', 't', 'r', 'i', 'p', 'c', 'a', 'r', '.', 'd', 'e', '\0', @@ -9627,7 +9634,6 @@ static const char kSTSHostTable[] = { /* "nagaya.biz", true */ 'n', 'a', 'g', 'a', 'y', 'a', '.', 'b', 'i', 'z', '\0', /* "nagb.gov", true */ 'n', 'a', 'g', 'b', '.', 'g', 'o', 'v', '\0', /* "nagb.org", true */ 'n', 'a', 'g', 'b', '.', 'o', 'r', 'g', '\0', - /* "nagelfam.com", true */ 'n', 'a', 'g', 'e', 'l', 'f', 'a', 'm', '.', 'c', 'o', 'm', '\0', /* "nakamastreamingcommunity.com", true */ 'n', 'a', 'k', 'a', 'm', 'a', 's', 't', 'r', 'e', 'a', 'm', 'i', 'n', 'g', 'c', 'o', 'm', 'm', 'u', 'n', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "nakedalarmclock.me", true */ 'n', 'a', 'k', 'e', 'd', 'a', 'l', 'a', 'r', 'm', 'c', 'l', 'o', 'c', 'k', '.', 'm', 'e', '\0', /* "nakedfacts.co.uk", true */ 'n', 'a', 'k', 'e', 'd', 'f', 'a', 'c', 't', 's', '.', 'c', 'o', '.', 'u', 'k', '\0', @@ -9656,6 +9662,7 @@ static const char kSTSHostTable[] = { /* "naralogics.com", true */ 'n', 'a', 'r', 'a', 'l', 'o', 'g', 'i', 'c', 's', '.', 'c', 'o', 'm', '\0', /* "narfation.org", true */ 'n', 'a', 'r', 'f', 'a', 't', 'i', 'o', 'n', '.', 'o', 'r', 'g', '\0', /* "nargele.eu", true */ 'n', 'a', 'r', 'g', 'e', 'l', 'e', '.', 'e', 'u', '\0', + /* "narindal.ch", true */ 'n', 'a', 'r', 'i', 'n', 'd', 'a', 'l', '.', 'c', 'h', '\0', /* "naro.se", true */ 'n', 'a', 'r', 'o', '.', 's', 'e', '\0', /* "narodniki.com", true */ 'n', 'a', 'r', 'o', 'd', 'n', 'i', 'k', 'i', '.', 'c', 'o', 'm', '\0', /* "narthollis.net", true */ 'n', 'a', 'r', 't', 'h', 'o', 'l', 'l', 'i', 's', '.', 'n', 'e', 't', '\0', @@ -9843,7 +9850,6 @@ static const char kSTSHostTable[] = { /* "newmediaone.net", true */ 'n', 'e', 'w', 'm', 'e', 'd', 'i', 'a', 'o', 'n', 'e', '.', 'n', 'e', 't', '\0', /* "newodesign.com", true */ 'n', 'e', 'w', 'o', 'd', 'e', 's', 'i', 'g', 'n', '.', 'c', 'o', 'm', '\0', /* "newpathintegratedtherapy.com", true */ 'n', 'e', 'w', 'p', 'a', 't', 'h', 'i', 'n', 't', 'e', 'g', 'r', 'a', 't', 'e', 'd', 't', 'h', 'e', 'r', 'a', 'p', 'y', '.', 'c', 'o', 'm', '\0', - /* "newportpropertygroup.com", true */ 'n', 'e', 'w', 'p', 'o', 'r', 't', 'p', 'r', 'o', 'p', 'e', 'r', 't', 'y', 'g', 'r', 'o', 'u', 'p', '.', 'c', 'o', 'm', '\0', /* "newstarnootropics.com", true */ 'n', 'e', 'w', 's', 't', 'a', 'r', 'n', 'o', 'o', 't', 'r', 'o', 'p', 'i', 'c', 's', '.', 'c', 'o', 'm', '\0', /* "newstone-tech.com", true */ 'n', 'e', 'w', 's', 't', 'o', 'n', 'e', '-', 't', 'e', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "newsyslog.org", true */ 'n', 'e', 'w', 's', 'y', 's', 'l', 'o', 'g', '.', 'o', 'r', 'g', '\0', @@ -9968,9 +9974,9 @@ static const char kSTSHostTable[] = { /* "nnqc.nl", true */ 'n', 'n', 'q', 'c', '.', 'n', 'l', '\0', /* "no-ip.cz", true */ 'n', 'o', '-', 'i', 'p', '.', 'c', 'z', '\0', /* "no.search.yahoo.com", false */ 'n', 'o', '.', 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', + /* "nobly.de", true */ 'n', 'o', 'b', 'l', 'y', '.', 'd', 'e', '\0', /* "nocit.dk", true */ 'n', 'o', 'c', 'i', 't', '.', 'd', 'k', '\0', /* "noclegi-online.pl", true */ 'n', 'o', 'c', 'l', 'e', 'g', 'i', '-', 'o', 'n', 'l', 'i', 'n', 'e', '.', 'p', 'l', '\0', - /* "noctinus.tk", true */ 'n', 'o', 'c', 't', 'i', 'n', 'u', 's', '.', 't', 'k', '\0', /* "nodari.com.ar", true */ 'n', 'o', 'd', 'a', 'r', 'i', '.', 'c', 'o', 'm', '.', 'a', 'r', '\0', /* "nodecompat.com", true */ 'n', 'o', 'd', 'e', 'c', 'o', 'm', 'p', 'a', 't', '.', 'c', 'o', 'm', '\0', /* "nodelia.com", true */ 'n', 'o', 'd', 'e', 'l', 'i', 'a', '.', 'c', 'o', 'm', '\0', @@ -10214,7 +10220,6 @@ static const char kSTSHostTable[] = { /* "olegon.ru", true */ 'o', 'l', 'e', 'g', 'o', 'n', '.', 'r', 'u', '\0', /* "oleksii.name", true */ 'o', 'l', 'e', 'k', 's', 'i', 'i', '.', 'n', 'a', 'm', 'e', '\0', /* "oliver-pietsch.de", false */ 'o', 'l', 'i', 'v', 'e', 'r', '-', 'p', 'i', 'e', 't', 's', 'c', 'h', '.', 'd', 'e', '\0', - /* "oliveraiedelabastideblanche.fr", true */ 'o', 'l', 'i', 'v', 'e', 'r', 'a', 'i', 'e', 'd', 'e', 'l', 'a', 'b', 'a', 's', 't', 'i', 'd', 'e', 'b', 'l', 'a', 'n', 'c', 'h', 'e', '.', 'f', 'r', '\0', /* "oliverfaircliff.com", true */ 'o', 'l', 'i', 'v', 'e', 'r', 'f', 'a', 'i', 'r', 'c', 'l', 'i', 'f', 'f', '.', 'c', 'o', 'm', '\0', /* "olivierlemoal.fr", true */ 'o', 'l', 'i', 'v', 'i', 'e', 'r', 'l', 'e', 'm', 'o', 'a', 'l', '.', 'f', 'r', '\0', /* "olivierpieters.be", true */ 'o', 'l', 'i', 'v', 'i', 'e', 'r', 'p', 'i', 'e', 't', 'e', 'r', 's', '.', 'b', 'e', '\0', @@ -10264,6 +10269,7 @@ static const char kSTSHostTable[] = { /* "online-bouwmaterialen.nl", true */ 'o', 'n', 'l', 'i', 'n', 'e', '-', 'b', 'o', 'u', 'w', 'm', 'a', 't', 'e', 'r', 'i', 'a', 'l', 'e', 'n', '.', 'n', 'l', '\0', /* "online-eikaiwa-guide.com", true */ 'o', 'n', 'l', 'i', 'n', 'e', '-', 'e', 'i', 'k', 'a', 'i', 'w', 'a', '-', 'g', 'u', 'i', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "online-pr.at", true */ 'o', 'n', 'l', 'i', 'n', 'e', '-', 'p', 'r', '.', 'a', 't', '\0', + /* "online.marketing", true */ 'o', 'n', 'l', 'i', 'n', 'e', '.', 'm', 'a', 'r', 'k', 'e', 't', 'i', 'n', 'g', '\0', /* "online.swedbank.se", true */ 'o', 'n', 'l', 'i', 'n', 'e', '.', 's', 'w', 'e', 'd', 'b', 'a', 'n', 'k', '.', 's', 'e', '\0', /* "onlinebiller.com", true */ 'o', 'n', 'l', 'i', 'n', 'e', 'b', 'i', 'l', 'l', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "onlinebizdirect.com", true */ 'o', 'n', 'l', 'i', 'n', 'e', 'b', 'i', 'z', 'd', 'i', 'r', 'e', 'c', 't', '.', 'c', 'o', 'm', '\0', @@ -10510,7 +10516,6 @@ static const char kSTSHostTable[] = { /* "participatorybudgeting.de", true */ 'p', 'a', 'r', 't', 'i', 'c', 'i', 'p', 'a', 't', 'o', 'r', 'y', 'b', 'u', 'd', 'g', 'e', 't', 'i', 'n', 'g', '.', 'd', 'e', '\0', /* "participatorybudgeting.info", true */ 'p', 'a', 'r', 't', 'i', 'c', 'i', 'p', 'a', 't', 'o', 'r', 'y', 'b', 'u', 'd', 'g', 'e', 't', 'i', 'n', 'g', '.', 'i', 'n', 'f', 'o', '\0', /* "partiono.com", true */ 'p', 'a', 'r', 't', 'i', 'o', 'n', 'o', '.', 'c', 'o', 'm', '\0', - /* "partirkyoto.jp", true */ 'p', 'a', 'r', 't', 'i', 'r', 'k', 'y', 'o', 't', 'o', '.', 'j', 'p', '\0', /* "partnerbeam.com", true */ 'p', 'a', 'r', 't', 'n', 'e', 'r', 'b', 'e', 'a', 'm', '.', 'c', 'o', 'm', '\0', /* "partnercardservices.com", true */ 'p', 'a', 'r', 't', 'n', 'e', 'r', 'c', 'a', 'r', 'd', 's', 'e', 'r', 'v', 'i', 'c', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "partnersfcu.org", true */ 'p', 'a', 'r', 't', 'n', 'e', 'r', 's', 'f', 'c', 'u', '.', 'o', 'r', 'g', '\0', @@ -10663,7 +10668,6 @@ static const char kSTSHostTable[] = { /* "pension-waldesruh.de", true */ 'p', 'e', 'n', 's', 'i', 'o', 'n', '-', 'w', 'a', 'l', 'd', 'e', 's', 'r', 'u', 'h', '.', 'd', 'e', '\0', /* "pensiunealido.ro", true */ 'p', 'e', 'n', 's', 'i', 'u', 'n', 'e', 'a', 'l', 'i', 'd', 'o', '.', 'r', 'o', '\0', /* "pentagram.me", false */ 'p', 'e', 'n', 't', 'a', 'g', 'r', 'a', 'm', '.', 'm', 'e', '\0', - /* "pentandra.com", true */ 'p', 'e', 'n', 't', 'a', 'n', 'd', 'r', 'a', '.', 'c', 'o', 'm', '\0', /* "pentano.net", true */ 'p', 'e', 'n', 't', 'a', 'n', 'o', '.', 'n', 'e', 't', '\0', /* "pentest.blog", true */ 'p', 'e', 'n', 't', 'e', 's', 't', '.', 'b', 'l', 'o', 'g', '\0', /* "pentest.nl", true */ 'p', 'e', 'n', 't', 'e', 's', 't', '.', 'n', 'l', '\0', @@ -10725,7 +10729,7 @@ static const char kSTSHostTable[] = { /* "pettitcoat.com", true */ 'p', 'e', 't', 't', 'i', 't', 'c', 'o', 'a', 't', '.', 'c', 'o', 'm', '\0', /* "pexieapp.com", true */ 'p', 'e', 'x', 'i', 'e', 'a', 'p', 'p', '.', 'c', 'o', 'm', '\0', /* "peyote.com", true */ 'p', 'e', 'y', 'o', 't', 'e', '.', 'c', 'o', 'm', '\0', - /* "peytonfarrar.com", true */ 'p', 'e', 'y', 't', 'o', 'n', 'f', 'a', 'r', 'r', 'a', 'r', '.', 'c', 'o', 'm', '\0', + /* "peytonfarrar.com", false */ 'p', 'e', 'y', 't', 'o', 'n', 'f', 'a', 'r', 'r', 'a', 'r', '.', 'c', 'o', 'm', '\0', /* "pfa.or.jp", true */ 'p', 'f', 'a', '.', 'o', 'r', '.', 'j', 'p', '\0', /* "pfadfinder-aurich.de", true */ 'p', 'f', 'a', 'd', 'f', 'i', 'n', 'd', 'e', 'r', '-', 'a', 'u', 'r', 'i', 'c', 'h', '.', 'd', 'e', '\0', /* "pfarchimedes-pensioen123.nl", true */ 'p', 'f', 'a', 'r', 'c', 'h', 'i', 'm', 'e', 'd', 'e', 's', '-', 'p', 'e', 'n', 's', 'i', 'o', 'e', 'n', '1', '2', '3', '.', 'n', 'l', '\0', @@ -10999,7 +11003,6 @@ static const char kSTSHostTable[] = { /* "pornbase.info", true */ 'p', 'o', 'r', 'n', 'b', 'a', 's', 'e', '.', 'i', 'n', 'f', 'o', '\0', /* "pornbay.org", true */ 'p', 'o', 'r', 'n', 'b', 'a', 'y', '.', 'o', 'r', 'g', '\0', /* "porno-gif.ru", true */ 'p', 'o', 'r', 'n', 'o', '-', 'g', 'i', 'f', '.', 'r', 'u', '\0', - /* "pornstars.me", true */ 'p', 'o', 'r', 'n', 's', 't', 'a', 'r', 's', '.', 'm', 'e', '\0', /* "porschen.fr", true */ 'p', 'o', 'r', 's', 'c', 'h', 'e', 'n', '.', 'f', 'r', '\0', /* "port443.hamburg", true */ 'p', 'o', 'r', 't', '4', '4', '3', '.', 'h', 'a', 'm', 'b', 'u', 'r', 'g', '\0', /* "port80.hamburg", true */ 'p', 'o', 'r', 't', '8', '0', '.', 'h', 'a', 'm', 'b', 'u', 'r', 'g', '\0', @@ -11020,7 +11023,6 @@ static const char kSTSHostTable[] = { /* "postbox.life", true */ 'p', 'o', 's', 't', 'b', 'o', 'x', '.', 'l', 'i', 'f', 'e', '\0', /* "postcodegarant.nl", true */ 'p', 'o', 's', 't', 'c', 'o', 'd', 'e', 'g', 'a', 'r', 'a', 'n', 't', '.', 'n', 'l', '\0', /* "posteo.de", false */ 'p', 'o', 's', 't', 'e', 'o', '.', 'd', 'e', '\0', - /* "posterspy.com", true */ 'p', 'o', 's', 't', 'e', 'r', 's', 'p', 'y', '.', 'c', 'o', 'm', '\0', /* "postfinance.ch", true */ 'p', 'o', 's', 't', 'f', 'i', 'n', 'a', 'n', 'c', 'e', '.', 'c', 'h', '\0', /* "postmatescode.com", true */ 'p', 'o', 's', 't', 'm', 'a', 't', 'e', 's', 'c', 'o', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "postn.eu", true */ 'p', 'o', 's', 't', 'n', '.', 'e', 'u', '\0', @@ -11090,6 +11092,7 @@ static const char kSTSHostTable[] = { /* "prespanok.sk", true */ 'p', 'r', 'e', 's', 'p', 'a', 'n', 'o', 'k', '.', 's', 'k', '\0', /* "press-anime-nenkan.com", true */ 'p', 'r', 'e', 's', 's', '-', 'a', 'n', 'i', 'm', 'e', '-', 'n', 'e', 'n', 'k', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "presscenter.jp", true */ 'p', 'r', 'e', 's', 's', 'c', 'e', 'n', 't', 'e', 'r', '.', 'j', 'p', '\0', + /* "pressrush.com", true */ 'p', 'r', 'e', 's', 's', 'r', 'u', 's', 'h', '.', 'c', 'o', 'm', '\0', /* "prestburyscouts.org.uk", true */ 'p', 'r', 'e', 's', 't', 'b', 'u', 'r', 'y', 's', 'c', 'o', 'u', 't', 's', '.', 'o', 'r', 'g', '.', 'u', 'k', '\0', /* "pretix.eu", true */ 'p', 'r', 'e', 't', 'i', 'x', '.', 'e', 'u', '\0', /* "pretty.hu", true */ 'p', 'r', 'e', 't', 't', 'y', '.', 'h', 'u', '\0', @@ -11144,7 +11147,6 @@ static const char kSTSHostTable[] = { /* "profiles.google.com", true */ 'p', 'r', 'o', 'f', 'i', 'l', 'e', 's', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm', '\0', /* "profitopia.de", true */ 'p', 'r', 'o', 'f', 'i', 't', 'o', 'p', 'i', 'a', '.', 'd', 'e', '\0', /* "profivps.com", true */ 'p', 'r', 'o', 'f', 'i', 'v', 'p', 's', '.', 'c', 'o', 'm', '\0', - /* "profpay.com", true */ 'p', 'r', 'o', 'f', 'p', 'a', 'y', '.', 'c', 'o', 'm', '\0', /* "profusion.io", true */ 'p', 'r', 'o', 'f', 'u', 's', 'i', 'o', 'n', '.', 'i', 'o', '\0', /* "progarm.org", true */ 'p', 'r', 'o', 'g', 'a', 'r', 'm', '.', 'o', 'r', 'g', '\0', /* "proggersession.de", true */ 'p', 'r', 'o', 'g', 'g', 'e', 'r', 's', 'e', 's', 's', 'i', 'o', 'n', '.', 'd', 'e', '\0', @@ -11156,7 +11158,7 @@ static const char kSTSHostTable[] = { /* "project-sparks.eu", true */ 'p', 'r', 'o', 'j', 'e', 'c', 't', '-', 's', 'p', 'a', 'r', 'k', 's', '.', 'e', 'u', '\0', /* "projectarmy.net", true */ 'p', 'r', 'o', 'j', 'e', 'c', 't', 'a', 'r', 'm', 'y', '.', 'n', 'e', 't', '\0', /* "projectascension.io", true */ 'p', 'r', 'o', 'j', 'e', 'c', 't', 'a', 's', 'c', 'e', 'n', 's', 'i', 'o', 'n', '.', 'i', 'o', '\0', - /* "projectbenson.com", true */ 'p', 'r', 'o', 'j', 'e', 'c', 't', 'b', 'e', 'n', 's', 'o', 'n', '.', 'c', 'o', 'm', '\0', + /* "projectbenson.com", false */ 'p', 'r', 'o', 'j', 'e', 'c', 't', 'b', 'e', 'n', 's', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "projectblackbook.us", true */ 'p', 'r', 'o', 'j', 'e', 'c', 't', 'b', 'l', 'a', 'c', 'k', 'b', 'o', 'o', 'k', '.', 'u', 's', '\0', /* "projektik.cz", true */ 'p', 'r', 'o', 'j', 'e', 'k', 't', 'i', 'k', '.', 'c', 'z', '\0', /* "projektzentrisch.de", true */ 'p', 'r', 'o', 'j', 'e', 'k', 't', 'z', 'e', 'n', 't', 'r', 'i', 's', 'c', 'h', '.', 'd', 'e', '\0', @@ -11361,7 +11363,6 @@ static const char kSTSHostTable[] = { /* "qualityology.com", true */ 'q', 'u', 'a', 'l', 'i', 't', 'y', 'o', 'l', 'o', 'g', 'y', '.', 'c', 'o', 'm', '\0', /* "quanglepro.com", true */ 'q', 'u', 'a', 'n', 'g', 'l', 'e', 'p', 'r', 'o', '.', 'c', 'o', 'm', '\0', /* "quantoras.com", true */ 'q', 'u', 'a', 'n', 't', 'o', 'r', 'a', 's', '.', 'c', 'o', 'm', '\0', - /* "quantumfurball.net", true */ 'q', 'u', 'a', 'n', 't', 'u', 'm', 'f', 'u', 'r', 'b', 'a', 'l', 'l', '.', 'n', 'e', 't', '\0', /* "quarterfull.com", true */ 'q', 'u', 'a', 'r', 't', 'e', 'r', 'f', 'u', 'l', 'l', '.', 'c', 'o', 'm', '\0', /* "qubyte.codes", true */ 'q', 'u', 'b', 'y', 't', 'e', '.', 'c', 'o', 'd', 'e', 's', '\0', /* "quchao.com", true */ 'q', 'u', 'c', 'h', 'a', 'o', '.', 'c', 'o', 'm', '\0', @@ -11398,6 +11399,7 @@ static const char kSTSHostTable[] = { /* "r-rickroll-u.pw", true */ 'r', '-', 'r', 'i', 'c', 'k', 'r', 'o', 'l', 'l', '-', 'u', '.', 'p', 'w', '\0', /* "r0t.co", true */ 'r', '0', 't', '.', 'c', 'o', '\0', /* "r0uzic.net", true */ 'r', '0', 'u', 'z', 'i', 'c', '.', 'n', 'e', 't', '\0', + /* "r2d2pc.com", true */ 'r', '2', 'd', '2', 'p', 'c', '.', 'c', 'o', 'm', '\0', /* "r3s1stanc3.me", true */ 'r', '3', 's', '1', 's', 't', 'a', 'n', 'c', '3', '.', 'm', 'e', '\0', /* "r40.us", true */ 'r', '4', '0', '.', 'u', 's', '\0', /* "r6-team.ru", true */ 'r', '6', '-', 't', 'e', 'a', 'm', '.', 'r', 'u', '\0', @@ -11431,7 +11433,6 @@ static const char kSTSHostTable[] = { /* "raidstone.net", true */ 'r', 'a', 'i', 'd', 's', 't', 'o', 'n', 'e', '.', 'n', 'e', 't', '\0', /* "raidstone.rocks", true */ 'r', 'a', 'i', 'd', 's', 't', 'o', 'n', 'e', '.', 'r', 'o', 'c', 'k', 's', '\0', /* "railgun.ac", true */ 'r', 'a', 'i', 'l', 'g', 'u', 'n', '.', 'a', 'c', '\0', - /* "railjob.cn", true */ 'r', 'a', 'i', 'l', 'j', 'o', 'b', '.', 'c', 'n', '\0', /* "railyardurgentcare.com", true */ 'r', 'a', 'i', 'l', 'y', 'a', 'r', 'd', 'u', 'r', 'g', 'e', 'n', 't', 'c', 'a', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "rainbowbay.org", true */ 'r', 'a', 'i', 'n', 'b', 'o', 'w', 'b', 'a', 'y', '.', 'o', 'r', 'g', '\0', /* "rainforest.engineering", true */ 'r', 'a', 'i', 'n', 'f', 'o', 'r', 'e', 's', 't', '.', 'e', 'n', 'g', 'i', 'n', 'e', 'e', 'r', 'i', 'n', 'g', '\0', @@ -11514,7 +11515,6 @@ static const char kSTSHostTable[] = { /* "readmeeatmedrinkme.com", true */ 'r', 'e', 'a', 'd', 'm', 'e', 'e', 'a', 't', 'm', 'e', 'd', 'r', 'i', 'n', 'k', 'm', 'e', '.', 'c', 'o', 'm', '\0', /* "readonly.de", true */ 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', '.', 'd', 'e', '\0', /* "readouble.com", false */ 'r', 'e', 'a', 'd', 'o', 'u', 'b', 'l', 'e', '.', 'c', 'o', 'm', '\0', - /* "readytongue.com", true */ 'r', 'e', 'a', 'd', 'y', 't', 'o', 'n', 'g', 'u', 'e', '.', 'c', 'o', 'm', '\0', /* "reaganlibrary.gov", true */ 'r', 'e', 'a', 'g', 'a', 'n', 'l', 'i', 'b', 'r', 'a', 'r', 'y', '.', 'g', 'o', 'v', '\0', /* "real-compare.com", true */ 'r', 'e', 'a', 'l', '-', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "real-it.nl", true */ 'r', 'e', 'a', 'l', '-', 'i', 't', '.', 'n', 'l', '\0', @@ -11673,7 +11673,6 @@ static const char kSTSHostTable[] = { /* "resources.flowfinity.com", true */ 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', 's', '.', 'f', 'l', 'o', 'w', 'f', 'i', 'n', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "respon.jp", true */ 'r', 'e', 's', 'p', 'o', 'n', '.', 'j', 'p', '\0', /* "responer.com", true */ 'r', 'e', 's', 'p', 'o', 'n', 'e', 'r', '.', 'c', 'o', 'm', '\0', - /* "responsibledisclosure.nl", false */ 'r', 'e', 's', 'p', 'o', 'n', 's', 'i', 'b', 'l', 'e', 'd', 'i', 's', 'c', 'l', 'o', 's', 'u', 'r', 'e', '.', 'n', 'l', '\0', /* "restoruns.com", true */ 'r', 'e', 's', 't', 'o', 'r', 'u', 'n', 's', '.', 'c', 'o', 'm', '\0', /* "restrealitaet.de", true */ 'r', 'e', 's', 't', 'r', 'e', 'a', 'l', 'i', 't', 'a', 'e', 't', '.', 'd', 'e', '\0', /* "restrito.org", true */ 'r', 'e', 's', 't', 'r', 'i', 't', 'o', '.', 'o', 'r', 'g', '\0', @@ -11770,6 +11769,7 @@ static const char kSTSHostTable[] = { /* "ristoarea.it", true */ 'r', 'i', 's', 't', 'o', 'a', 'r', 'e', 'a', '.', 'i', 't', '\0', /* "ristorantefattoamano.eu", true */ 'r', 'i', 's', 't', 'o', 'r', 'a', 'n', 't', 'e', 'f', 'a', 't', 't', 'o', 'a', 'm', 'a', 'n', 'o', '.', 'e', 'u', '\0', /* "rithm.ch", true */ 'r', 'i', 't', 'h', 'm', '.', 'c', 'h', '\0', + /* "riverbanktearooms.co.uk", true */ 'r', 'i', 'v', 'e', 'r', 'b', 'a', 'n', 'k', 't', 'e', 'a', 'r', 'o', 'o', 'm', 's', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "rivermendhealthcenters.com", true */ 'r', 'i', 'v', 'e', 'r', 'm', 'e', 'n', 'd', 'h', 'e', 'a', 'l', 't', 'h', 'c', 'e', 'n', 't', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "riversideauto.net", true */ 'r', 'i', 'v', 'e', 'r', 's', 'i', 'd', 'e', 'a', 'u', 't', 'o', '.', 'n', 'e', 't', '\0', /* "rivlo.com", true */ 'r', 'i', 'v', 'l', 'o', '.', 'c', 'o', 'm', '\0', @@ -11824,7 +11824,7 @@ static const char kSTSHostTable[] = { /* "roesemann.email", true */ 'r', 'o', 'e', 's', 'e', 'm', 'a', 'n', 'n', '.', 'e', 'm', 'a', 'i', 'l', '\0', /* "roessner-network-solutions.com", true */ 'r', 'o', 'e', 's', 's', 'n', 'e', 'r', '-', 'n', 'e', 't', 'w', 'o', 'r', 'k', '-', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n', 's', '.', 'c', 'o', 'm', '\0', /* "roffe.nu", true */ 'r', 'o', 'f', 'f', 'e', '.', 'n', 'u', '\0', - /* "rogerbastien.com", true */ 'r', 'o', 'g', 'e', 'r', 'b', 'a', 's', 't', 'i', 'e', 'n', '.', 'c', 'o', 'm', '\0', + /* "roflcopter.fr", true */ 'r', 'o', 'f', 'l', 'c', 'o', 'p', 't', 'e', 'r', '.', 'f', 'r', '\0', /* "rogerriendeau.ca", true */ 'r', 'o', 'g', 'e', 'r', 'r', 'i', 'e', 'n', 'd', 'e', 'a', 'u', '.', 'c', 'a', '\0', /* "rogue-e.xyz", true */ 'r', 'o', 'g', 'u', 'e', '-', 'e', '.', 'x', 'y', 'z', '\0', /* "roguelikecenter.fr", true */ 'r', 'o', 'g', 'u', 'e', 'l', 'i', 'k', 'e', 'c', 'e', 'n', 't', 'e', 'r', '.', 'f', 'r', '\0', @@ -12000,7 +12000,6 @@ static const char kSTSHostTable[] = { /* "safeex.com", true */ 's', 'a', 'f', 'e', 'e', 'x', '.', 'c', 'o', 'm', '\0', /* "safegroup.pl", true */ 's', 'a', 'f', 'e', 'g', 'r', 'o', 'u', 'p', '.', 'p', 'l', '\0', /* "safejourney.education", true */ 's', 'a', 'f', 'e', 'j', 'o', 'u', 'r', 'n', 'e', 'y', '.', 'e', 'd', 'u', 'c', 'a', 't', 'i', 'o', 'n', '\0', - /* "safelist.eu", true */ 's', 'a', 'f', 'e', 'l', 'i', 's', 't', '.', 'e', 'u', '\0', /* "safeme.ga", true */ 's', 'a', 'f', 'e', 'm', 'e', '.', 'g', 'a', '\0', /* "safemovescheme.co.uk", true */ 's', 'a', 'f', 'e', 'm', 'o', 'v', 'e', 's', 'c', 'h', 'e', 'm', 'e', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "safer-networking.org", true */ 's', 'a', 'f', 'e', 'r', '-', 'n', 'e', 't', 'w', 'o', 'r', 'k', 'i', 'n', 'g', '.', 'o', 'r', 'g', '\0', @@ -12259,6 +12258,7 @@ static const char kSTSHostTable[] = { /* "sdcardrecovery.de", true */ 's', 'd', 'c', 'a', 'r', 'd', 'r', 'e', 'c', 'o', 'v', 'e', 'r', 'y', '.', 'd', 'e', '\0', /* "se.search.yahoo.com", false */ 's', 'e', '.', 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', /* "sea-godzilla.com", true */ 's', 'e', 'a', '-', 'g', 'o', 'd', 'z', 'i', 'l', 'l', 'a', '.', 'c', 'o', 'm', '\0', + /* "sealbaker.com", true */ 's', 'e', 'a', 'l', 'b', 'a', 'k', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "seamless.no", true */ 's', 'e', 'a', 'm', 'l', 'e', 's', 's', '.', 'n', 'o', '\0', /* "seanholcroft.co.uk", true */ 's', 'e', 'a', 'n', 'h', 'o', 'l', 'c', 'r', 'o', 'f', 't', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "search.yahoo.com", false */ 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', @@ -12314,12 +12314,12 @@ static const char kSTSHostTable[] = { /* "secureobscure.com", true */ 's', 'e', 'c', 'u', 'r', 'e', 'o', 'b', 's', 'c', 'u', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "secureonline.co", true */ 's', 'e', 'c', 'u', 'r', 'e', 'o', 'n', 'l', 'i', 'n', 'e', '.', 'c', 'o', '\0', /* "securethe.news", true */ 's', 'e', 'c', 'u', 'r', 'e', 't', 'h', 'e', '.', 'n', 'e', 'w', 's', '\0', + /* "securetheorem.com", true */ 's', 'e', 'c', 'u', 'r', 'e', 't', 'h', 'e', 'o', 'r', 'e', 'm', '.', 'c', 'o', 'm', '\0', /* "securetronic.ch", true */ 's', 'e', 'c', 'u', 'r', 'e', 't', 'r', 'o', 'n', 'i', 'c', '.', 'c', 'h', '\0', /* "securify.nl", true */ 's', 'e', 'c', 'u', 'r', 'i', 'f', 'y', '.', 'n', 'l', '\0', /* "security-taskforce.be", true */ 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '-', 't', 'a', 's', 'k', 'f', 'o', 'r', 'c', 'e', '.', 'b', 'e', '\0', /* "security-thoughts.org", true */ 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '-', 't', 'h', 'o', 'u', 'g', 'h', 't', 's', '.', 'o', 'r', 'g', '\0', /* "security.google.com", true */ 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm', '\0', - /* "securityheaders.com", true */ 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', 'h', 'e', 'a', 'd', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "securityheaders.io", true */ 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', 'h', 'e', 'a', 'd', 'e', 'r', 's', '.', 'i', 'o', '\0', /* "securitymap.wiki", true */ 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', 'm', 'a', 'p', '.', 'w', 'i', 'k', 'i', '\0', /* "securityprimes.in", true */ 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', 'p', 'r', 'i', 'm', 'e', 's', '.', 'i', 'n', '\0', @@ -12332,6 +12332,7 @@ static const char kSTSHostTable[] = { /* "secuvera.de", true */ 's', 'e', 'c', 'u', 'v', 'e', 'r', 'a', '.', 'd', 'e', '\0', /* "sedrubal.de", true */ 's', 'e', 'd', 'r', 'u', 'b', 'a', 'l', '.', 'd', 'e', '\0', /* "sedussa.ro", true */ 's', 'e', 'd', 'u', 's', 's', 'a', '.', 'r', 'o', '\0', + /* "sedziapilkarski.pl", true */ 's', 'e', 'd', 'z', 'i', 'a', 'p', 'i', 'l', 'k', 'a', 'r', 's', 'k', 'i', '.', 'p', 'l', '\0', /* "seedalpha.com", true */ 's', 'e', 'e', 'd', 'a', 'l', 'p', 'h', 'a', '.', 'c', 'o', 'm', '\0', /* "seeks.ru", true */ 's', 'e', 'e', 'k', 's', '.', 'r', 'u', '\0', /* "seemeagain.com", true */ 's', 'e', 'e', 'm', 'e', 'a', 'g', 'a', 'i', 'n', '.', 'c', 'o', 'm', '\0', @@ -12484,6 +12485,7 @@ static const char kSTSHostTable[] = { /* "shansing.space", true */ 's', 'h', 'a', 'n', 's', 'i', 'n', 'g', '.', 's', 'p', 'a', 'c', 'e', '\0', /* "shaobin.wang", true */ 's', 'h', 'a', 'o', 'b', 'i', 'n', '.', 'w', 'a', 'n', 'g', '\0', /* "shapesedinburgh.co.uk", true */ 's', 'h', 'a', 'p', 'e', 's', 'e', 'd', 'i', 'n', 'b', 'u', 'r', 'g', 'h', '.', 'c', 'o', '.', 'u', 'k', '\0', + /* "shareoine.com", true */ 's', 'h', 'a', 'r', 'e', 'o', 'i', 'n', 'e', '.', 'c', 'o', 'm', '\0', /* "sharepic.xyz", true */ 's', 'h', 'a', 'r', 'e', 'p', 'i', 'c', '.', 'x', 'y', 'z', '\0', /* "sharepointdrive.com", true */ 's', 'h', 'a', 'r', 'e', 'p', 'o', 'i', 'n', 't', 'd', 'r', 'i', 'v', 'e', '.', 'c', 'o', 'm', '\0', /* "sharesplitter.com", true */ 's', 'h', 'a', 'r', 'e', 's', 'p', 'l', 'i', 't', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', @@ -12549,7 +12551,6 @@ static const char kSTSHostTable[] = { /* "shotbow.net", true */ 's', 'h', 'o', 't', 'b', 'o', 'w', '.', 'n', 'e', 't', '\0', /* "show-saratov.ru", true */ 's', 'h', 'o', 'w', '-', 's', 'a', 'r', 'a', 't', 'o', 'v', '.', 'r', 'u', '\0', /* "showsonar.com", true */ 's', 'h', 'o', 'w', 's', 'o', 'n', 'a', 'r', '.', 'c', 'o', 'm', '\0', - /* "shrike.me", true */ 's', 'h', 'r', 'i', 'k', 'e', '.', 'm', 'e', '\0', /* "shrinkhub.com", true */ 's', 'h', 'r', 'i', 'n', 'k', 'h', 'u', 'b', '.', 'c', 'o', 'm', '\0', /* "shrub.ca", true */ 's', 'h', 'r', 'u', 'b', '.', 'c', 'a', '\0', /* "shtorku.com", true */ 's', 'h', 't', 'o', 'r', 'k', 'u', '.', 'c', 'o', 'm', '\0', @@ -12663,7 +12664,6 @@ static const char kSTSHostTable[] = { /* "simsnieuws.nl", true */ 's', 'i', 'm', 's', 'n', 'i', 'e', 'u', 'w', 's', '.', 'n', 'l', '\0', /* "simumiehet.com", true */ 's', 'i', 'm', 'u', 'm', 'i', 'e', 'h', 'e', 't', '.', 'c', 'o', 'm', '\0', /* "simus.fr", true */ 's', 'i', 'm', 'u', 's', '.', 'f', 'r', '\0', - /* "sin30.net", true */ 's', 'i', 'n', '3', '0', '.', 'n', 'e', 't', '\0', /* "sinful.pw", true */ 's', 'i', 'n', 'f', 'u', 'l', '.', 'p', 'w', '\0', /* "sinfulforums.net", false */ 's', 'i', 'n', 'f', 'u', 'l', 'f', 'o', 'r', 'u', 'm', 's', '.', 'n', 'e', 't', '\0', /* "singleuse.link", true */ 's', 'i', 'n', 'g', 'l', 'e', 'u', 's', 'e', '.', 'l', 'i', 'n', 'k', '\0', @@ -12677,6 +12677,7 @@ static const char kSTSHostTable[] = { /* "sinonimosonline.com.br", true */ 's', 'i', 'n', 'o', 'n', 'i', 'm', 'o', 's', 'o', 'n', 'l', 'i', 'n', 'e', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', /* "sinoscandinavia.se", true */ 's', 'i', 'n', 'o', 's', 'c', 'a', 'n', 'd', 'i', 'n', 'a', 'v', 'i', 'a', '.', 's', 'e', '\0', /* "sinosky.org", true */ 's', 'i', 'n', 'o', 's', 'k', 'y', '.', 'o', 'r', 'g', '\0', + /* "sinquin.eu", true */ 's', 'i', 'n', 'q', 'u', 'i', 'n', '.', 'e', 'u', '\0', /* "siqi.wang", true */ 's', 'i', 'q', 'i', '.', 'w', 'a', 'n', 'g', '\0', /* "siraweb.org", false */ 's', 'i', 'r', 'a', 'w', 'e', 'b', '.', 'o', 'r', 'g', '\0', /* "sirenslove.com", true */ 's', 'i', 'r', 'e', 'n', 's', 'l', 'o', 'v', 'e', '.', 'c', 'o', 'm', '\0', @@ -12797,6 +12798,7 @@ static const char kSTSHostTable[] = { /* "smart-cp.jp", true */ 's', 'm', 'a', 'r', 't', '-', 'c', 'p', '.', 'j', 'p', '\0', /* "smartairkey.com", true */ 's', 'm', 'a', 'r', 't', 'a', 'i', 'r', 'k', 'e', 'y', '.', 'c', 'o', 'm', '\0', /* "smartbuyelectric.com", true */ 's', 'm', 'a', 'r', 't', 'b', 'u', 'y', 'e', 'l', 'e', 'c', 't', 'r', 'i', 'c', '.', 'c', 'o', 'm', '\0', + /* "smartcheck.gov", true */ 's', 'm', 'a', 'r', 't', 'c', 'h', 'e', 'c', 'k', '.', 'g', 'o', 'v', '\0', /* "smartcleaningcenter.nl", false */ 's', 'm', 'a', 'r', 't', 'c', 'l', 'e', 'a', 'n', 'i', 'n', 'g', 'c', 'e', 'n', 't', 'e', 'r', '.', 'n', 'l', '\0', /* "smartest-trading.com", true */ 's', 'm', 'a', 'r', 't', 'e', 's', 't', '-', 't', 'r', 'a', 'd', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "smartftp.com", true */ 's', 'm', 'a', 'r', 't', 'f', 't', 'p', '.', 'c', 'o', 'm', '\0', @@ -12964,8 +12966,8 @@ static const char kSTSHostTable[] = { /* "sor.so", true */ 's', 'o', 'r', '.', 's', 'o', '\0', /* "sorcix.com", true */ 's', 'o', 'r', 'c', 'i', 'x', '.', 'c', 'o', 'm', '\0', /* "sorenstudios.com", true */ 's', 'o', 'r', 'e', 'n', 's', 't', 'u', 'd', 'i', 'o', 's', '.', 'c', 'o', 'm', '\0', + /* "sorincocorada.ro", true */ 's', 'o', 'r', 'i', 'n', 'c', 'o', 'c', 'o', 'r', 'a', 'd', 'a', '.', 'r', 'o', '\0', /* "sorn.service.gov.uk", true */ 's', 'o', 'r', 'n', '.', 's', 'e', 'r', 'v', 'i', 'c', 'e', '.', 'g', 'o', 'v', '.', 'u', 'k', '\0', - /* "sortaweird.net", true */ 's', 'o', 'r', 't', 'a', 'w', 'e', 'i', 'r', 'd', '.', 'n', 'e', 't', '\0', /* "soruly.com", true */ 's', 'o', 'r', 'u', 'l', 'y', '.', 'c', 'o', 'm', '\0', /* "sorz.org", true */ 's', 'o', 'r', 'z', '.', 'o', 'r', 'g', '\0', /* "sos.sk", true */ 's', 'o', 's', '.', 's', 'k', '\0', @@ -13042,6 +13044,7 @@ static const char kSTSHostTable[] = { /* "sperohub.com", true */ 's', 'p', 'e', 'r', 'o', 'h', 'u', 'b', '.', 'c', 'o', 'm', '\0', /* "sperohub.lt", true */ 's', 'p', 'e', 'r', 'o', 'h', 'u', 'b', '.', 'l', 't', '\0', /* "sperrstun.de", true */ 's', 'p', 'e', 'r', 'r', 's', 't', 'u', 'n', '.', 'd', 'e', '\0', + /* "sphereblur.com", true */ 's', 'p', 'h', 'e', 'r', 'e', 'b', 'l', 'u', 'r', '.', 'c', 'o', 'm', '\0', /* "spibe.is", true */ 's', 'p', 'i', 'b', 'e', '.', 'i', 's', '\0', /* "spicydog.org", true */ 's', 'p', 'i', 'c', 'y', 'd', 'o', 'g', '.', 'o', 'r', 'g', '\0', /* "spicymatch.com", true */ 's', 'p', 'i', 'c', 'y', 'm', 'a', 't', 'c', 'h', '.', 'c', 'o', 'm', '\0', @@ -13358,7 +13361,6 @@ static const char kSTSHostTable[] = { /* "sturbock.me", true */ 's', 't', 'u', 'r', 'b', 'o', 'c', 'k', '.', 'm', 'e', '\0', /* "stutelage.com", true */ 's', 't', 'u', 't', 'e', 'l', 'a', 'g', 'e', '.', 'c', 'o', 'm', '\0', /* "stuur.nl", false */ 's', 't', 'u', 'u', 'r', '.', 'n', 'l', '\0', - /* "stygium.net", false */ 's', 't', 'y', 'g', 'i', 'u', 'm', '.', 'n', 'e', 't', '\0', /* "styleci.io", true */ 's', 't', 'y', 'l', 'e', 'c', 'i', '.', 'i', 'o', '\0', /* "stylefast.com.au", true */ 's', 't', 'y', 'l', 'e', 'f', 'a', 's', 't', '.', 'c', 'o', 'm', '.', 'a', 'u', '\0', /* "styles.pm", true */ 's', 't', 'y', 'l', 'e', 's', '.', 'p', 'm', '\0', @@ -13366,7 +13368,6 @@ static const char kSTSHostTable[] = { /* "su1ph3r.io", true */ 's', 'u', '1', 'p', 'h', '3', 'r', '.', 'i', 'o', '\0', /* "suave.io", true */ 's', 'u', 'a', 'v', 'e', '.', 'i', 'o', '\0', /* "subdev.org", true */ 's', 'u', 'b', 'd', 'e', 'v', '.', 'o', 'r', 'g', '\0', - /* "subeesu.com", true */ 's', 'u', 'b', 'e', 'e', 's', 'u', '.', 'c', 'o', 'm', '\0', /* "sublevel.net", false */ 's', 'u', 'b', 'l', 'e', 'v', 'e', 'l', '.', 'n', 'e', 't', '\0', /* "sublimebits.com", true */ 's', 'u', 'b', 'l', 'i', 'm', 'e', 'b', 'i', 't', 's', '.', 'c', 'o', 'm', '\0', /* "submedia.tv", true */ 's', 'u', 'b', 'm', 'e', 'd', 'i', 'a', '.', 't', 'v', '\0', @@ -13395,6 +13396,8 @@ static const char kSTSHostTable[] = { /* "sunbritetv.com", true */ 's', 'u', 'n', 'b', 'r', 'i', 't', 'e', 't', 'v', '.', 'c', 'o', 'm', '\0', /* "sundayfundayjapan.com", true */ 's', 'u', 'n', 'd', 'a', 'y', 'f', 'u', 'n', 'd', 'a', 'y', 'j', 'a', 'p', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "suneilpatel.com", true */ 's', 'u', 'n', 'e', 'i', 'l', 'p', 'a', 't', 'e', 'l', '.', 'c', 'o', 'm', '\0', + /* "sunflyer.cn", false */ 's', 'u', 'n', 'f', 'l', 'y', 'e', 'r', '.', 'c', 'n', '\0', + /* "sunjaydhama.com", true */ 's', 'u', 'n', 'j', 'a', 'y', 'd', 'h', 'a', 'm', 'a', '.', 'c', 'o', 'm', '\0', /* "sunsetwx.com", true */ 's', 'u', 'n', 's', 'e', 't', 'w', 'x', '.', 'c', 'o', 'm', '\0', /* "sunstar.bg", true */ 's', 'u', 'n', 's', 't', 'a', 'r', '.', 'b', 'g', '\0', /* "sunyanzi.tk", true */ 's', 'u', 'n', 'y', 'a', 'n', 'z', 'i', '.', 't', 'k', '\0', @@ -13503,6 +13506,7 @@ static const char kSTSHostTable[] = { /* "syntaxnightmare.com", true */ 's', 'y', 'n', 't', 'a', 'x', 'n', 'i', 'g', 'h', 't', 'm', 'a', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "syrocon.ch", true */ 's', 'y', 'r', 'o', 'c', 'o', 'n', '.', 'c', 'h', '\0', /* "sys.tf", true */ 's', 'y', 's', '.', 't', 'f', '\0', + /* "sysadmin.pm", true */ 's', 'y', 's', 'a', 'd', 'm', 'i', 'n', '.', 'p', 'm', '\0', /* "sysadmins.ro", true */ 's', 'y', 's', 'a', 'd', 'm', 'i', 'n', 's', '.', 'r', 'o', '\0', /* "sysadminstory.com", true */ 's', 'y', 's', 'a', 'd', 'm', 'i', 'n', 's', 't', 'o', 'r', 'y', '.', 'c', 'o', 'm', '\0', /* "sysctl.se", false */ 's', 'y', 's', 'c', 't', 'l', '.', 's', 'e', '\0', @@ -13691,6 +13695,7 @@ static const char kSTSHostTable[] = { /* "techwords.io", true */ 't', 'e', 'c', 'h', 'w', 'o', 'r', 'd', 's', '.', 'i', 'o', '\0', /* "tecnogaming.com", true */ 't', 'e', 'c', 'n', 'o', 'g', 'a', 'm', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "tecture.de", true */ 't', 'e', 'c', 't', 'u', 'r', 'e', '.', 'd', 'e', '\0', + /* "tedb.us", true */ 't', 'e', 'd', 'b', '.', 'u', 's', '\0', /* "teddy.ch", true */ 't', 'e', 'd', 'd', 'y', '.', 'c', 'h', '\0', /* "tedeh.net", true */ 't', 'e', 'd', 'e', 'h', '.', 'n', 'e', 't', '\0', /* "tedovo.com", true */ 't', 'e', 'd', 'o', 'v', 'o', '.', 'c', 'o', 'm', '\0', @@ -13825,12 +13830,10 @@ static const char kSTSHostTable[] = { /* "thedrop.pw", true */ 't', 'h', 'e', 'd', 'r', 'o', 'p', '.', 'p', 'w', '\0', /* "thedutchmarketers.com", true */ 't', 'h', 'e', 'd', 'u', 't', 'c', 'h', 'm', 'a', 'r', 'k', 'e', 't', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "theescapistswiki.com", true */ 't', 'h', 'e', 'e', 's', 'c', 'a', 'p', 'i', 's', 't', 's', 'w', 'i', 'k', 'i', '.', 'c', 'o', 'm', '\0', - /* "theeyeopener.com", false */ 't', 'h', 'e', 'e', 'y', 'e', 'o', 'p', 'e', 'n', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "thefarbeyond.com", true */ 't', 'h', 'e', 'f', 'a', 'r', 'b', 'e', 'y', 'o', 'n', 'd', '.', 'c', 'o', 'm', '\0', /* "theflyingbear.net", true */ 't', 'h', 'e', 'f', 'l', 'y', 'i', 'n', 'g', 'b', 'e', 'a', 'r', '.', 'n', 'e', 't', '\0', /* "thefox.co", true */ 't', 'h', 'e', 'f', 'o', 'x', '.', 'c', 'o', '\0', /* "thefreebirds.in", true */ 't', 'h', 'e', 'f', 'r', 'e', 'e', 'b', 'i', 'r', 'd', 's', '.', 'i', 'n', '\0', - /* "thefrozenfire.com", false */ 't', 'h', 'e', 'f', 'r', 'o', 'z', 'e', 'n', 'f', 'i', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "thego2swatking.com", false */ 't', 'h', 'e', 'g', 'o', '2', 's', 'w', 'a', 't', 'k', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "thegoldregister.co.uk", true */ 't', 'h', 'e', 'g', 'o', 'l', 'd', 'r', 'e', 'g', 'i', 's', 't', 'e', 'r', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "thegraciousgourmet.com", true */ 't', 'h', 'e', 'g', 'r', 'a', 'c', 'i', 'o', 'u', 's', 'g', 'o', 'u', 'r', 'm', 'e', 't', '.', 'c', 'o', 'm', '\0', @@ -14050,6 +14053,7 @@ static const char kSTSHostTable[] = { /* "tkappertjedemetamorfose.nl", true */ 't', 'k', 'a', 'p', 'p', 'e', 'r', 't', 'j', 'e', 'd', 'e', 'm', 'e', 't', 'a', 'm', 'o', 'r', 'f', 'o', 's', 'e', '.', 'n', 'l', '\0', /* "tkat.ch", true */ 't', 'k', 'a', 't', '.', 'c', 'h', '\0', /* "tkn.tokyo", true */ 't', 'k', 'n', '.', 't', 'o', 'k', 'y', 'o', '\0', + /* "tlach.cz", true */ 't', 'l', 'a', 'c', 'h', '.', 'c', 'z', '\0', /* "tlo.xyz", true */ 't', 'l', 'o', '.', 'x', 'y', 'z', '\0', /* "tls.builders", true */ 't', 'l', 's', '.', 'b', 'u', 'i', 'l', 'd', 'e', 'r', 's', '\0', /* "tls.care", true */ 't', 'l', 's', '.', 'c', 'a', 'r', 'e', '\0', @@ -14096,6 +14100,7 @@ static const char kSTSHostTable[] = { /* "togech.jp", true */ 't', 'o', 'g', 'e', 'c', 'h', '.', 'j', 'p', '\0', /* "togelonlinecommunity.com", false */ 't', 'o', 'g', 'e', 'l', 'o', 'n', 'l', 'i', 'n', 'e', 'c', 'o', 'm', 'm', 'u', 'n', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "togetter.com", true */ 't', 'o', 'g', 'e', 't', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', + /* "tokage.me", true */ 't', 'o', 'k', 'a', 'g', 'e', '.', 'm', 'e', '\0', /* "tokaido-kun.jp", true */ 't', 'o', 'k', 'a', 'i', 'd', 'o', '-', 'k', 'u', 'n', '.', 'j', 'p', '\0', /* "tokaido.com", true */ 't', 'o', 'k', 'a', 'i', 'd', 'o', '.', 'c', 'o', 'm', '\0', /* "tokenloan.com", true */ 't', 'o', 'k', 'e', 'n', 'l', 'o', 'a', 'n', '.', 'c', 'o', 'm', '\0', @@ -14188,7 +14193,6 @@ static const char kSTSHostTable[] = { /* "tor2web.org", true */ 't', 'o', 'r', '2', 'w', 'e', 'b', '.', 'o', 'r', 'g', '\0', /* "torchl.it", true */ 't', 'o', 'r', 'c', 'h', 'l', '.', 'i', 't', '\0', /* "toretame.jp", true */ 't', 'o', 'r', 'e', 't', 'a', 'm', 'e', '.', 'j', 'p', '\0', - /* "toretfaction.net", true */ 't', 'o', 'r', 'e', 't', 'f', 'a', 'c', 't', 'i', 'o', 'n', '.', 'n', 'e', 't', '\0', /* "tormentedradio.com", true */ 't', 'o', 'r', 'm', 'e', 'n', 't', 'e', 'd', 'r', 'a', 'd', 'i', 'o', '.', 'c', 'o', 'm', '\0', /* "torn1.se", true */ 't', 'o', 'r', 'n', '1', '.', 's', 'e', '\0', /* "torproject.org", false */ 't', 'o', 'r', 'p', 'r', 'o', 'j', 'e', 'c', 't', '.', 'o', 'r', 'g', '\0', @@ -14338,7 +14342,6 @@ static const char kSTSHostTable[] = { /* "trident-online.de", true */ 't', 'r', 'i', 'd', 'e', 'n', 't', '-', 'o', 'n', 'l', 'i', 'n', 'e', '.', 'd', 'e', '\0', /* "trik.es", false */ 't', 'r', 'i', 'k', '.', 'e', 's', '\0', /* "trim-a-slab.com", true */ 't', 'r', 'i', 'm', '-', 'a', '-', 's', 'l', 'a', 'b', '.', 'c', 'o', 'm', '\0', - /* "trimage.org", true */ 't', 'r', 'i', 'm', 'a', 'g', 'e', '.', 'o', 'r', 'g', '\0', /* "trineco.com", true */ 't', 'r', 'i', 'n', 'e', 'c', 'o', '.', 'c', 'o', 'm', '\0', /* "trineco.fi", true */ 't', 'r', 'i', 'n', 'e', 'c', 'o', '.', 'f', 'i', '\0', /* "trinnes.net", true */ 't', 'r', 'i', 'n', 'n', 'e', 's', '.', 'n', 'e', 't', '\0', @@ -14547,7 +14550,6 @@ static const char kSTSHostTable[] = { /* "umenlisam.com", true */ 'u', 'm', 'e', 'n', 'l', 'i', 's', 'a', 'm', '.', 'c', 'o', 'm', '\0', /* "umgardi.ca", true */ 'u', 'm', 'g', 'a', 'r', 'd', 'i', '.', 'c', 'a', '\0', /* "umisonoda.com", true */ 'u', 'm', 'i', 's', 'o', 'n', 'o', 'd', 'a', '.', 'c', 'o', 'm', '\0', - /* "umwandeln-online.de", true */ 'u', 'm', 'w', 'a', 'n', 'd', 'e', 'l', 'n', '-', 'o', 'n', 'l', 'i', 'n', 'e', '.', 'd', 'e', '\0', /* "un-zero-un.fr", true */ 'u', 'n', '-', 'z', 'e', 'r', 'o', '-', 'u', 'n', '.', 'f', 'r', '\0', /* "unapp.me", true */ 'u', 'n', 'a', 'p', 'p', '.', 'm', 'e', '\0', /* "unart.info", true */ 'u', 'n', 'a', 'r', 't', '.', 'i', 'n', 'f', 'o', '\0', @@ -14665,6 +14667,7 @@ static const char kSTSHostTable[] = { /* "ureka.org", true */ 'u', 'r', 'e', 'k', 'a', '.', 'o', 'r', 'g', '\0', /* "uripura.de", true */ 'u', 'r', 'i', 'p', 'u', 'r', 'a', '.', 'd', 'e', '\0', /* "url.cab", true */ 'u', 'r', 'l', '.', 'c', 'a', 'b', '\0', + /* "url.rw", false */ 'u', 'r', 'l', '.', 'r', 'w', '\0', /* "urlchomp.com", true */ 'u', 'r', 'l', 'c', 'h', 'o', 'm', 'p', '.', 'c', 'o', 'm', '\0', /* "urown.net", true */ 'u', 'r', 'o', 'w', 'n', '.', 'n', 'e', 't', '\0', /* "urspringer.de", true */ 'u', 'r', 's', 'p', 'r', 'i', 'n', 'g', 'e', 'r', '.', 'd', 'e', '\0', @@ -14694,6 +14697,7 @@ static const char kSTSHostTable[] = { /* "usmint.gov", true */ 'u', 's', 'm', 'i', 'n', 't', '.', 'g', 'o', 'v', '\0', /* "usparklodging.com", true */ 'u', 's', 'p', 'a', 'r', 'k', 'l', 'o', 'd', 'g', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "usportsgo.com", true */ 'u', 's', 'p', 'o', 'r', 't', 's', 'g', 'o', '.', 'c', 'o', 'm', '\0', + /* "uspsoig.gov", true */ 'u', 's', 'p', 's', 'o', 'i', 'g', '.', 'g', 'o', 'v', '\0', /* "ust.space", true */ 'u', 's', 't', '.', 's', 'p', 'a', 'c', 'e', '\0', /* "uswitch.com", true */ 'u', 's', 'w', 'i', 't', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "utdsgda.com", true */ 'u', 't', 'd', 's', 'g', 'd', 'a', '.', 'c', 'o', 'm', '\0', @@ -14832,6 +14836,7 @@ static const char kSTSHostTable[] = { /* "veryapt.com", true */ 'v', 'e', 'r', 'y', 'a', 'p', 't', '.', 'c', 'o', 'm', '\0', /* "ves.vn.ua", true */ 'v', 'e', 's', '.', 'v', 'n', '.', 'u', 'a', '\0', /* "vespacascadia.com", true */ 'v', 'e', 's', 'p', 'a', 'c', 'a', 's', 'c', 'a', 'd', 'i', 'a', '.', 'c', 'o', 'm', '\0', + /* "vestacp.top", true */ 'v', 'e', 's', 't', 'a', 'c', 'p', '.', 't', 'o', 'p', '\0', /* "vetdnacenter.com", false */ 'v', 'e', 't', 'd', 'n', 'a', 'c', 'e', 'n', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "veterinaire-cazeres-foucault.fr", true */ 'v', 'e', 't', 'e', 'r', 'i', 'n', 'a', 'i', 'r', 'e', '-', 'c', 'a', 'z', 'e', 'r', 'e', 's', '-', 'f', 'o', 'u', 'c', 'a', 'u', 'l', 't', '.', 'f', 'r', '\0', /* "vetinte.eu", true */ 'v', 'e', 't', 'i', 'n', 't', 'e', '.', 'e', 'u', '\0', @@ -14861,7 +14866,6 @@ static const char kSTSHostTable[] = { /* "vide-maisons.org", false */ 'v', 'i', 'd', 'e', '-', 'm', 'a', 'i', 's', 'o', 'n', 's', '.', 'o', 'r', 'g', '\0', /* "videogamesartwork.com", true */ 'v', 'i', 'd', 'e', 'o', 'g', 'a', 'm', 'e', 's', 'a', 'r', 't', 'w', 'o', 'r', 'k', '.', 'c', 'o', 'm', '\0', /* "videomail.io", true */ 'v', 'i', 'd', 'e', 'o', 'm', 'a', 'i', 'l', '.', 'i', 'o', '\0', - /* "videosqr.com", true */ 'v', 'i', 'd', 'e', 'o', 's', 'q', 'r', '.', 'c', 'o', 'm', '\0', /* "videotogel.net", false */ 'v', 'i', 'd', 'e', 'o', 't', 'o', 'g', 'e', 'l', '.', 'n', 'e', 't', '\0', /* "vidid.net", false */ 'v', 'i', 'd', 'i', 'd', '.', 'n', 'e', 't', '\0', /* "vieclam24h.vn", false */ 'v', 'i', 'e', 'c', 'l', 'a', 'm', '2', '4', 'h', '.', 'v', 'n', '\0', @@ -14907,7 +14911,6 @@ static const char kSTSHostTable[] = { /* "vipnettikasinoklubi.com", true */ 'v', 'i', 'p', 'n', 'e', 't', 't', 'i', 'k', 'a', 's', 'i', 'n', 'o', 'k', 'l', 'u', 'b', 'i', '.', 'c', 'o', 'm', '\0', /* "virginiacrimeanalysisnetwork.org", true */ 'v', 'i', 'r', 'g', 'i', 'n', 'i', 'a', 'c', 'r', 'i', 'm', 'e', 'a', 'n', 'a', 'l', 'y', 's', 'i', 's', 'n', 'e', 't', 'w', 'o', 'r', 'k', '.', 'o', 'r', 'g', '\0', /* "virtualdesignmedia.com", false */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 'd', 'e', 's', 'i', 'g', 'n', 'm', 'e', 'd', 'i', 'a', '.', 'c', 'o', 'm', '\0', - /* "virtuallifestyle.nl", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 'l', 'i', 'f', 'e', 's', 't', 'y', 'l', 'e', '.', 'n', 'l', '\0', /* "virtualperez.com", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 'p', 'e', 'r', 'e', 'z', '.', 'c', 'o', 'm', '\0', /* "virtualsanity.com", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 's', 'a', 'n', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "virtualstrongbox.ca", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 's', 't', 'r', 'o', 'n', 'g', 'b', 'o', 'x', '.', 'c', 'a', '\0', @@ -14965,7 +14968,6 @@ static const char kSTSHostTable[] = { /* "vnvisa.ru", true */ 'v', 'n', 'v', 'i', 's', 'a', '.', 'r', 'u', '\0', /* "vocab.guru", true */ 'v', 'o', 'c', 'a', 'b', '.', 'g', 'u', 'r', 'u', '\0', /* "vocaloid.my", true */ 'v', 'o', 'c', 'a', 'l', 'o', 'i', 'd', '.', 'm', 'y', '\0', - /* "vodpay.com", true */ 'v', 'o', 'd', 'p', 'a', 'y', '.', 'c', 'o', 'm', '\0', /* "vogler.name", true */ 'v', 'o', 'g', 'l', 'e', 'r', '.', 'n', 'a', 'm', 'e', '\0', /* "vogt.tech", true */ 'v', 'o', 'g', 't', '.', 't', 'e', 'c', 'h', '\0', /* "voidi.ca", true */ 'v', 'o', 'i', 'd', 'i', '.', 'c', 'a', '\0', @@ -15366,7 +15368,6 @@ static const char kSTSHostTable[] = { /* "willi-graf-os.de", true */ 'w', 'i', 'l', 'l', 'i', '-', 'g', 'r', 'a', 'f', '-', 'o', 's', '.', 'd', 'e', '\0', /* "williamfeely.info", true */ 'w', 'i', 'l', 'l', 'i', 'a', 'm', 'f', 'e', 'e', 'l', 'y', '.', 'i', 'n', 'f', 'o', '\0', /* "williamsapiens.com", true */ 'w', 'i', 'l', 'l', 'i', 'a', 'm', 's', 'a', 'p', 'i', 'e', 'n', 's', '.', 'c', 'o', 'm', '\0', - /* "williamsonshore.com", true */ 'w', 'i', 'l', 'l', 'i', 'a', 'm', 's', 'o', 'n', 's', 'h', 'o', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "willnorris.com", true */ 'w', 'i', 'l', 'l', 'n', 'o', 'r', 'r', 'i', 's', '.', 'c', 'o', 'm', '\0', /* "wills.co.tt", true */ 'w', 'i', 'l', 'l', 's', '.', 'c', 'o', '.', 't', 't', '\0', /* "willstamper.name", true */ 'w', 'i', 'l', 'l', 's', 't', 'a', 'm', 'p', 'e', 'r', '.', 'n', 'a', 'm', 'e', '\0', @@ -15386,6 +15387,7 @@ static const char kSTSHostTable[] = { /* "winterbergwebcams.com", true */ 'w', 'i', 'n', 't', 'e', 'r', 'b', 'e', 'r', 'g', 'w', 'e', 'b', 'c', 'a', 'm', 's', '.', 'c', 'o', 'm', '\0', /* "winterfeldt.de", true */ 'w', 'i', 'n', 't', 'e', 'r', 'f', 'e', 'l', 'd', 't', '.', 'd', 'e', '\0', /* "winterhillbank.com", true */ 'w', 'i', 'n', 't', 'e', 'r', 'h', 'i', 'l', 'l', 'b', 'a', 'n', 'k', '.', 'c', 'o', 'm', '\0', + /* "wintodoor.com", true */ 'w', 'i', 'n', 't', 'o', 'd', 'o', 'o', 'r', '.', 'c', 'o', 'm', '\0', /* "wipply.com", false */ 'w', 'i', 'p', 'p', 'l', 'y', '.', 'c', 'o', 'm', '\0', /* "wircon-int.net", true */ 'w', 'i', 'r', 'c', 'o', 'n', '-', 'i', 'n', 't', '.', 'n', 'e', 't', '\0', /* "wireheading.com", true */ 'w', 'i', 'r', 'e', 'h', 'e', 'a', 'd', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', @@ -15666,6 +15668,7 @@ static const char kSTSHostTable[] = { /* "xjoin.de", true */ 'x', 'j', 'o', 'i', 'n', '.', 'd', 'e', '\0', /* "xkbcommon.org", false */ 'x', 'k', 'b', 'c', 'o', 'm', 'm', 'o', 'n', '.', 'o', 'r', 'g', '\0', /* "xkviz.net", true */ 'x', 'k', 'v', 'i', 'z', '.', 'n', 'e', 't', '\0', + /* "xlange.com", true */ 'x', 'l', 'a', 'n', 'g', 'e', '.', 'c', 'o', 'm', '\0', /* "xliu.cf", true */ 'x', 'l', 'i', 'u', '.', 'c', 'f', '\0', /* "xmedius.com", true */ 'x', 'm', 'e', 'd', 'i', 'u', 's', '.', 'c', 'o', 'm', '\0', /* "xmedius.eu", true */ 'x', 'm', 'e', 'd', 'i', 'u', 's', '.', 'e', 'u', '\0', @@ -15685,7 +15688,6 @@ static const char kSTSHostTable[] = { /* "xn--4dbjwf8c.ml", true */ 'x', 'n', '-', '-', '4', 'd', 'b', 'j', 'w', 'f', '8', 'c', '.', 'm', 'l', '\0', /* "xn--7v8h.cf", true */ 'x', 'n', '-', '-', '7', 'v', '8', 'h', '.', 'c', 'f', '\0', /* "xn--7xa.google.com", true */ 'x', 'n', '-', '-', '7', 'x', 'a', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm', '\0', - /* "xn--80aocgsfei.xn--p1ai", true */ 'x', 'n', '-', '-', '8', '0', 'a', 'o', 'c', 'g', 's', 'f', 'e', 'i', '.', 'x', 'n', '-', '-', 'p', '1', 'a', 'i', '\0', /* "xn--8mr166hf6s.xn--fiqs8s", true */ 'x', 'n', '-', '-', '8', 'm', 'r', '1', '6', '6', 'h', 'f', '6', 's', '.', 'x', 'n', '-', '-', 'f', 'i', 'q', 's', '8', 's', '\0', /* "xn--allgu-biker-o8a.de", true */ 'x', 'n', '-', '-', 'a', 'l', 'l', 'g', 'u', '-', 'b', 'i', 'k', 'e', 'r', '-', 'o', '8', 'a', '.', 'd', 'e', '\0', /* "xn--aviao-dra1a.pt", true */ 'x', 'n', '-', '-', 'a', 'v', 'i', 'a', 'o', '-', 'd', 'r', 'a', '1', 'a', '.', 'p', 't', '\0', @@ -15715,6 +15717,7 @@ static const char kSTSHostTable[] = { /* "xn--u9jv84l7ea468b.com", true */ 'x', 'n', '-', '-', 'u', '9', 'j', 'v', '8', '4', 'l', '7', 'e', 'a', '4', '6', '8', 'b', '.', 'c', 'o', 'm', '\0', /* "xn--v-wfa35g.ro", true */ 'x', 'n', '-', '-', 'v', '-', 'w', 'f', 'a', '3', '5', 'g', '.', 'r', 'o', '\0', /* "xn--xdtx3pfzbiw3ar8e7yedqrhui.com", true */ 'x', 'n', '-', '-', 'x', 'd', 't', 'x', '3', 'p', 'f', 'z', 'b', 'i', 'w', '3', 'a', 'r', '8', 'e', '7', 'y', 'e', 'd', 'q', 'r', 'h', 'u', 'i', '.', 'c', 'o', 'm', '\0', + /* "xn--y8j148r.xn--q9jyb4c", true */ 'x', 'n', '-', '-', 'y', '8', 'j', '1', '4', '8', 'r', '.', 'x', 'n', '-', '-', 'q', '9', 'j', 'y', 'b', '4', 'c', '\0', /* "xn5.de", true */ 'x', 'n', '5', '.', 'd', 'e', '\0', /* "xng.io", false */ 'x', 'n', 'g', '.', 'i', 'o', '\0', /* "xo.tc", true */ 'x', 'o', '.', 't', 'c', '\0', @@ -15725,7 +15728,6 @@ static const char kSTSHostTable[] = { /* "xpd.se", true */ 'x', 'p', 'd', '.', 's', 'e', '\0', /* "xperidia.com", true */ 'x', 'p', 'e', 'r', 'i', 'd', 'i', 'a', '.', 'c', 'o', 'm', '\0', /* "xpj.sx", true */ 'x', 'p', 'j', '.', 's', 'x', '\0', - /* "xps2pdf.co.uk", true */ 'x', 'p', 's', '2', 'p', 'd', 'f', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "xqin.net", true */ 'x', 'q', 'i', 'n', '.', 'n', 'e', 't', '\0', /* "xrippedhd.com", true */ 'x', 'r', 'i', 'p', 'p', 'e', 'd', 'h', 'd', '.', 'c', 'o', 'm', '\0', /* "xrockx.de", true */ 'x', 'r', 'o', 'c', 'k', 'x', '.', 'd', 'e', '\0', @@ -15795,7 +15797,6 @@ static const char kSTSHostTable[] = { /* "yetzt.me", false */ 'y', 'e', 't', 'z', 't', '.', 'm', 'e', '\0', /* "yeu.io", true */ 'y', 'e', 'u', '.', 'i', 'o', '\0', /* "yhaupenthal.org", true */ 'y', 'h', 'a', 'u', 'p', 'e', 'n', 't', 'h', 'a', 'l', '.', 'o', 'r', 'g', '\0', - /* "yhb.io", true */ 'y', 'h', 'b', '.', 'i', 'o', '\0', /* "yhori.xyz", true */ 'y', 'h', 'o', 'r', 'i', '.', 'x', 'y', 'z', '\0', /* "yhrd.org", true */ 'y', 'h', 'r', 'd', '.', 'o', 'r', 'g', '\0', /* "yii2.cc", true */ 'y', 'i', 'i', '2', '.', 'c', 'c', '\0', @@ -15936,7 +15937,6 @@ static const char kSTSHostTable[] = { /* "zeedroom.be", true */ 'z', 'e', 'e', 'd', 'r', 'o', 'o', 'm', '.', 'b', 'e', '\0', /* "zeel.com", true */ 'z', 'e', 'e', 'l', '.', 'c', 'o', 'm', '\0', /* "zehdenick-bleibt-bunt.de", true */ 'z', 'e', 'h', 'd', 'e', 'n', 'i', 'c', 'k', '-', 'b', 'l', 'e', 'i', 'b', 't', '-', 'b', 'u', 'n', 't', '.', 'd', 'e', '\0', - /* "zehntner.ch", true */ 'z', 'e', 'h', 'n', 't', 'n', 'e', 'r', '.', 'c', 'h', '\0', /* "zeitzer-turngala.de", true */ 'z', 'e', 'i', 't', 'z', 'e', 'r', '-', 't', 'u', 'r', 'n', 'g', 'a', 'l', 'a', '.', 'd', 'e', '\0', /* "zelfrijdendeautos.com", true */ 'z', 'e', 'l', 'f', 'r', 'i', 'j', 'd', 'e', 'n', 'd', 'e', 'a', 'u', 't', 'o', 's', '.', 'c', 'o', 'm', '\0', /* "zellari.ru", true */ 'z', 'e', 'l', 'l', 'a', 'r', 'i', '.', 'r', 'u', '\0', @@ -15980,6 +15980,7 @@ static const char kSTSHostTable[] = { /* "zhengzexin.com", true */ 'z', 'h', 'e', 'n', 'g', 'z', 'e', 'x', 'i', 'n', '.', 'c', 'o', 'm', '\0', /* "zhh.in", true */ 'z', 'h', 'h', '.', 'i', 'n', '\0', /* "zhihua-lai.com", true */ 'z', 'h', 'i', 'h', 'u', 'a', '-', 'l', 'a', 'i', '.', 'c', 'o', 'm', '\0', + /* "zhousiru.com", false */ 'z', 'h', 'o', 'u', 's', 'i', 'r', 'u', '.', 'c', 'o', 'm', '\0', /* "zhovner.com", true */ 'z', 'h', 'o', 'v', 'n', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "zi0r.com", true */ 'z', 'i', '0', 'r', '.', 'c', 'o', 'm', '\0', /* "zicklam.com", true */ 'z', 'i', 'c', 'k', 'l', 'a', 'm', '.', 'c', 'o', 'm', '\0', @@ -16103,805 +16104,804 @@ static const nsSTSPreload kSTSPreloadList[] = { { 254, true }, { 262, true }, { 272, true }, - { 279, true }, - { 289, true }, - { 300, true }, - { 308, true }, - { 321, true }, - { 329, true }, + { 282, true }, + { 293, true }, + { 301, true }, + { 314, true }, + { 322, true }, + { 330, true }, { 337, true }, - { 344, true }, - { 354, true }, - { 368, true }, - { 383, true }, - { 393, false }, - { 416, true }, - { 436, true }, - { 448, true }, - { 464, true }, - { 472, true }, - { 480, true }, - { 490, true }, + { 347, true }, + { 361, true }, + { 376, true }, + { 386, false }, + { 409, true }, + { 429, true }, + { 441, true }, + { 457, true }, + { 465, true }, + { 473, true }, + { 483, true }, + { 494, true }, { 501, true }, - { 508, true }, - { 523, true }, - { 537, true }, - { 549, true }, - { 560, true }, - { 571, true }, - { 582, true }, - { 592, true }, - { 602, true }, - { 627, true }, - { 635, true }, - { 645, true }, - { 653, true }, - { 671, false }, - { 687, true }, - { 698, true }, - { 719, true }, - { 735, true }, - { 743, true }, - { 768, true }, - { 790, true }, - { 807, true }, - { 830, true }, - { 840, true }, - { 851, true }, - { 862, true }, - { 876, true }, - { 898, true }, + { 516, true }, + { 530, true }, + { 542, true }, + { 553, true }, + { 564, true }, + { 575, true }, + { 585, true }, + { 595, true }, + { 620, true }, + { 628, true }, + { 638, true }, + { 646, true }, + { 664, false }, + { 680, true }, + { 691, true }, + { 712, true }, + { 728, true }, + { 736, true }, + { 761, true }, + { 783, true }, + { 800, true }, + { 823, true }, + { 833, true }, + { 844, true }, + { 855, true }, + { 869, true }, + { 891, true }, + { 903, true }, { 910, true }, - { 917, true }, - { 926, true }, + { 919, true }, + { 930, true }, { 937, true }, - { 944, true }, - { 955, true }, + { 948, true }, + { 959, true }, { 966, true }, { 973, true }, - { 980, true }, + { 984, true }, { 991, true }, - { 998, true }, - { 1010, true }, - { 1027, true }, - { 1045, true }, - { 1059, true }, - { 1071, true }, - { 1082, true }, - { 1091, true }, - { 1097, true }, - { 1112, true }, - { 1120, true }, - { 1129, true }, - { 1137, true }, - { 1148, true }, - { 1158, true }, - { 1176, true }, + { 1003, true }, + { 1020, true }, + { 1038, true }, + { 1052, true }, + { 1064, true }, + { 1075, true }, + { 1084, true }, + { 1090, true }, + { 1105, true }, + { 1113, true }, + { 1122, true }, + { 1130, true }, + { 1141, true }, + { 1151, true }, + { 1169, true }, { 1185, true }, - { 1193, true }, - { 1201, true }, - { 1212, true }, - { 1230, true }, + { 1194, true }, + { 1202, true }, + { 1210, true }, + { 1221, true }, { 1239, true }, - { 1251, true }, - { 1265, true }, - { 1273, true }, - { 1283, true }, - { 1299, false }, - { 1312, true }, + { 1248, true }, + { 1260, true }, + { 1274, true }, + { 1282, true }, + { 1292, true }, + { 1308, false }, { 1321, true }, - { 1335, true }, + { 1330, true }, { 1344, true }, - { 1365, true }, - { 1385, true }, + { 1353, true }, + { 1374, true }, { 1394, true }, - { 1404, true }, - { 1419, true }, - { 1427, true }, - { 1444, true }, - { 1460, true }, - { 1467, true }, - { 1480, true }, - { 1489, false }, - { 1501, true }, - { 1509, true }, - { 1520, true }, - { 1527, true }, + { 1403, true }, + { 1413, true }, + { 1428, true }, + { 1436, true }, + { 1453, true }, + { 1469, true }, + { 1476, true }, + { 1489, true }, + { 1498, false }, + { 1510, true }, + { 1518, true }, + { 1529, true }, { 1536, true }, { 1545, true }, - { 1558, true }, + { 1554, true }, { 1567, true }, - { 1586, true }, - { 1605, true }, - { 1617, true }, - { 1631, true }, - { 1643, true }, - { 1654, true }, + { 1576, true }, + { 1595, true }, + { 1614, true }, + { 1626, true }, + { 1640, true }, + { 1652, true }, { 1663, true }, - { 1674, true }, - { 1687, true }, - { 1695, true }, - { 1710, true }, - { 1722, true }, - { 1735, true }, - { 1745, true }, - { 1759, true }, - { 1775, true }, - { 1789, true }, - { 1803, true }, - { 1811, true }, - { 1818, true }, - { 1830, true }, - { 1841, true }, - { 1854, true }, + { 1672, true }, + { 1683, true }, + { 1696, true }, + { 1704, true }, + { 1719, true }, + { 1731, true }, + { 1744, true }, + { 1754, true }, + { 1768, true }, + { 1784, true }, + { 1798, true }, + { 1812, true }, + { 1820, true }, + { 1827, true }, + { 1839, true }, + { 1850, true }, { 1863, true }, - { 1875, true }, - { 1892, true }, - { 1903, true }, - { 1913, true }, - { 1924, true }, - { 1935, true }, - { 1948, true }, - { 1956, false }, + { 1872, true }, + { 1884, true }, + { 1901, true }, + { 1912, true }, + { 1922, true }, + { 1933, true }, + { 1944, true }, + { 1957, true }, { 1965, false }, - { 1978, true }, - { 1986, true }, - { 1998, true }, - { 2010, true }, - { 2025, true }, - { 2044, true }, - { 2051, false }, - { 2070, true }, - { 2080, true }, - { 2086, true }, + { 1974, false }, + { 1987, true }, + { 1995, true }, + { 2007, true }, + { 2019, true }, + { 2034, true }, + { 2053, true }, + { 2060, false }, + { 2079, true }, + { 2089, true }, { 2095, true }, - { 2108, true }, - { 2120, true }, + { 2104, true }, + { 2117, true }, { 2129, true }, - { 2142, true }, - { 2152, true }, - { 2162, false }, - { 2169, true }, - { 2180, true }, - { 2192, true }, - { 2200, true }, - { 2213, true }, - { 2220, true }, + { 2138, true }, + { 2151, true }, + { 2161, true }, + { 2171, false }, + { 2178, true }, + { 2189, true }, + { 2201, true }, + { 2209, true }, + { 2222, true }, { 2229, true }, - { 2241, true }, + { 2238, true }, { 2250, true }, - { 2271, true }, - { 2295, true }, - { 2310, true }, - { 2321, true }, - { 2327, true }, - { 2340, true }, - { 2352, true }, - { 2364, true }, - { 2372, true }, - { 2382, true }, - { 2389, true }, - { 2406, true }, - { 2413, true }, + { 2259, true }, + { 2280, true }, + { 2304, true }, + { 2319, true }, + { 2330, true }, + { 2336, true }, + { 2349, true }, + { 2361, true }, + { 2373, true }, + { 2381, true }, + { 2391, true }, + { 2398, true }, + { 2415, true }, { 2422, true }, - { 2443, true }, - { 2456, false }, - { 2469, true }, - { 2479, true }, - { 2532, true }, - { 2544, true }, + { 2431, true }, + { 2452, true }, + { 2465, false }, + { 2478, true }, + { 2488, true }, + { 2541, true }, { 2553, true }, { 2562, true }, - { 2572, true }, - { 2582, true }, - { 2593, true }, - { 2601, true }, - { 2608, true }, - { 2620, true }, - { 2636, true }, - { 2648, true }, - { 2658, true }, - { 2669, true }, - { 2688, true }, - { 2699, true }, - { 2709, true }, - { 2720, true }, + { 2571, true }, + { 2581, true }, + { 2591, true }, + { 2602, true }, + { 2610, true }, + { 2617, true }, + { 2629, true }, + { 2645, true }, + { 2657, true }, + { 2667, true }, + { 2678, true }, + { 2697, true }, + { 2708, true }, + { 2718, true }, { 2729, true }, - { 2742, true }, - { 2757, true }, - { 2772, true }, - { 2780, true }, - { 2790, true }, - { 2807, true }, - { 2822, true }, - { 2834, true }, - { 2850, true }, - { 2860, true }, - { 2867, true }, - { 2878, true }, - { 2893, true }, - { 2903, true }, - { 2931, true }, - { 2950, true }, - { 2960, true }, - { 2971, true }, - { 2989, true }, - { 3000, true }, - { 3014, true }, - { 3026, true }, - { 3048, true }, - { 3064, true }, - { 3075, false }, - { 3091, false }, - { 3103, true }, - { 3116, true }, - { 3133, true }, - { 3158, true }, - { 3175, true }, - { 3199, false }, - { 3207, true }, - { 3231, true }, - { 3244, true }, - { 3256, true }, - { 3267, true }, - { 3285, true }, - { 3309, true }, - { 3316, true }, - { 3329, true }, - { 3342, true }, + { 2738, true }, + { 2751, true }, + { 2766, true }, + { 2781, true }, + { 2789, true }, + { 2799, true }, + { 2816, true }, + { 2831, true }, + { 2843, true }, + { 2859, true }, + { 2869, true }, + { 2876, true }, + { 2887, true }, + { 2902, true }, + { 2912, true }, + { 2940, true }, + { 2959, true }, + { 2969, true }, + { 2980, true }, + { 2998, true }, + { 3009, true }, + { 3023, true }, + { 3035, true }, + { 3057, true }, + { 3073, true }, + { 3084, false }, + { 3100, false }, + { 3112, true }, + { 3125, true }, + { 3142, true }, + { 3167, true }, + { 3184, true }, + { 3208, false }, + { 3216, true }, + { 3240, true }, + { 3253, true }, + { 3265, true }, + { 3276, true }, + { 3294, true }, + { 3318, true }, + { 3325, true }, + { 3338, true }, { 3351, true }, - { 3368, true }, - { 3380, true }, - { 3399, true }, - { 3422, true }, - { 3436, true }, - { 3460, true }, - { 3476, true }, - { 3489, true }, - { 3506, true }, - { 3526, true }, - { 3539, true }, - { 3557, true }, - { 3572, true }, - { 3593, true }, - { 3613, true }, - { 3638, true }, - { 3650, true }, - { 3661, true }, - { 3680, false }, - { 3687, true }, - { 3708, true }, - { 3720, true }, - { 3737, true }, - { 3750, true }, - { 3766, true }, - { 3787, true }, - { 3799, true }, - { 3812, false }, - { 3821, true }, - { 3836, true }, - { 3853, true }, - { 3867, true }, - { 3880, true }, - { 3896, true }, - { 3907, true }, - { 3919, true }, - { 3940, false }, - { 3950, true }, - { 3965, true }, - { 3979, false }, - { 3992, true }, - { 4001, true }, - { 4016, true }, - { 4030, true }, - { 4042, true }, - { 4057, true }, - { 4070, true }, - { 4082, true }, - { 4094, true }, - { 4106, true }, - { 4118, true }, - { 4130, true }, - { 4138, true }, - { 4151, true }, - { 4162, true }, - { 4176, true }, - { 4192, true }, - { 4205, true }, - { 4222, true }, - { 4237, true }, - { 4252, true }, - { 4270, true }, - { 4279, true }, - { 4292, true }, - { 4313, true }, - { 4322, true }, + { 3360, true }, + { 3377, true }, + { 3389, true }, + { 3408, true }, + { 3431, true }, + { 3445, true }, + { 3469, true }, + { 3485, true }, + { 3498, true }, + { 3515, true }, + { 3535, true }, + { 3548, true }, + { 3566, true }, + { 3581, true }, + { 3602, true }, + { 3622, true }, + { 3647, true }, + { 3659, true }, + { 3670, true }, + { 3689, false }, + { 3696, true }, + { 3717, true }, + { 3729, true }, + { 3746, true }, + { 3759, true }, + { 3775, true }, + { 3796, true }, + { 3808, true }, + { 3821, false }, + { 3830, false }, + { 3840, true }, + { 3855, true }, + { 3872, true }, + { 3886, true }, + { 3899, true }, + { 3915, true }, + { 3926, true }, + { 3938, true }, + { 3959, false }, + { 3969, true }, + { 3984, true }, + { 3998, false }, + { 4011, true }, + { 4020, true }, + { 4035, true }, + { 4049, true }, + { 4061, true }, + { 4076, true }, + { 4089, true }, + { 4101, true }, + { 4113, true }, + { 4125, true }, + { 4137, true }, + { 4149, true }, + { 4157, true }, + { 4170, true }, + { 4181, true }, + { 4195, true }, + { 4211, true }, + { 4224, true }, + { 4241, true }, + { 4256, true }, + { 4271, true }, + { 4289, true }, + { 4298, true }, + { 4311, true }, { 4332, true }, - { 4357, true }, - { 4368, true }, - { 4380, true }, + { 4341, true }, + { 4351, true }, + { 4376, true }, + { 4387, true }, { 4399, true }, - { 4411, true }, + { 4418, true }, { 4430, true }, { 4449, true }, { 4468, true }, - { 4479, true }, - { 4491, true }, - { 4506, true }, - { 4517, true }, - { 4530, true }, - { 4542, true }, - { 4555, true }, - { 4569, true }, - { 4591, true }, - { 4614, true }, - { 4624, true }, - { 4646, true }, - { 4655, true }, - { 4668, true }, - { 4682, true }, - { 4694, true }, - { 4707, true }, - { 4734, true }, - { 4760, true }, - { 4771, true }, - { 4784, true }, - { 4795, true }, - { 4819, true }, - { 4836, true }, - { 4864, true }, - { 4880, true }, - { 4889, true }, + { 4487, true }, + { 4498, true }, + { 4510, true }, + { 4525, true }, + { 4536, true }, + { 4549, true }, + { 4561, true }, + { 4574, true }, + { 4588, true }, + { 4610, true }, + { 4633, true }, + { 4643, true }, + { 4665, true }, + { 4674, true }, + { 4687, true }, + { 4701, true }, + { 4713, true }, + { 4726, true }, + { 4753, true }, + { 4779, true }, + { 4790, true }, + { 4803, true }, + { 4814, true }, + { 4838, true }, + { 4855, true }, + { 4883, true }, { 4899, true }, - { 4913, true }, + { 4908, true }, + { 4918, true }, { 4932, true }, - { 4942, true }, - { 4956, true }, - { 4964, false }, - { 4985, true }, - { 5003, true }, - { 5016, true }, - { 5027, true }, - { 5037, true }, - { 5046, true }, - { 5065, true }, - { 5086, true }, - { 5100, true }, - { 5119, true }, - { 5132, true }, - { 5143, true }, - { 5163, true }, - { 5181, true }, - { 5199, false }, - { 5218, true }, - { 5232, true }, - { 5253, true }, - { 5269, true }, - { 5279, true }, - { 5292, true }, - { 5305, true }, - { 5319, true }, - { 5333, true }, - { 5343, true }, - { 5353, true }, - { 5363, true }, - { 5373, true }, - { 5383, true }, - { 5393, true }, - { 5410, true }, - { 5420, false }, - { 5428, true }, - { 5439, true }, - { 5450, true }, - { 5461, true }, - { 5479, true }, - { 5488, true }, - { 5508, true }, - { 5519, true }, - { 5536, true }, - { 5560, true }, - { 5574, true }, - { 5593, true }, - { 5615, true }, - { 5625, true }, - { 5637, true }, - { 5653, true }, - { 5664, true }, - { 5678, true }, - { 5694, true }, - { 5709, true }, - { 5717, true }, - { 5726, true }, - { 5743, false }, - { 5755, true }, - { 5774, true }, - { 5791, true }, - { 5799, false }, - { 5815, true }, - { 5833, true }, + { 4951, true }, + { 4961, true }, + { 4975, true }, + { 4983, false }, + { 5004, true }, + { 5022, true }, + { 5033, true }, + { 5043, true }, + { 5052, true }, + { 5071, true }, + { 5092, true }, + { 5106, true }, + { 5125, true }, + { 5138, true }, + { 5149, true }, + { 5169, true }, + { 5187, true }, + { 5205, false }, + { 5224, true }, + { 5238, true }, + { 5259, true }, + { 5275, true }, + { 5285, true }, + { 5298, true }, + { 5311, true }, + { 5325, true }, + { 5339, true }, + { 5349, true }, + { 5359, true }, + { 5369, true }, + { 5379, true }, + { 5389, true }, + { 5399, true }, + { 5416, true }, + { 5426, false }, + { 5434, true }, + { 5445, true }, + { 5456, true }, + { 5467, true }, + { 5485, true }, + { 5494, true }, + { 5514, true }, + { 5525, true }, + { 5542, true }, + { 5566, true }, + { 5580, true }, + { 5599, true }, + { 5621, true }, + { 5631, true }, + { 5643, true }, + { 5659, true }, + { 5670, true }, + { 5684, true }, + { 5700, true }, + { 5715, true }, + { 5723, true }, + { 5732, true }, + { 5749, false }, + { 5761, true }, + { 5780, true }, + { 5788, false }, + { 5804, true }, + { 5822, true }, + { 5837, true }, { 5848, true }, - { 5859, true }, - { 5872, true }, - { 5880, true }, - { 5894, true }, - { 5906, true }, - { 5916, false }, - { 5929, true }, - { 5941, true }, - { 5953, true }, - { 5963, true }, - { 5971, true }, - { 5981, true }, - { 5995, true }, - { 6008, true }, - { 6020, true }, - { 6039, true }, - { 6058, true }, - { 6068, true }, - { 6101, true }, - { 6111, true }, - { 6125, true }, - { 6132, true }, - { 6149, true }, - { 6165, true }, - { 6174, true }, - { 6181, true }, - { 6195, true }, + { 5861, true }, + { 5869, true }, + { 5883, true }, + { 5895, true }, + { 5905, false }, + { 5918, true }, + { 5930, true }, + { 5942, true }, + { 5952, true }, + { 5960, true }, + { 5970, true }, + { 5984, true }, + { 5997, true }, + { 6009, true }, + { 6028, true }, + { 6047, true }, + { 6057, true }, + { 6090, true }, + { 6100, true }, + { 6114, true }, + { 6121, true }, + { 6138, true }, + { 6154, true }, + { 6163, true }, + { 6170, true }, + { 6184, true }, + { 6192, true }, { 6203, true }, - { 6214, true }, - { 6229, true }, - { 6244, true }, - { 6261, true }, - { 6274, true }, + { 6218, true }, + { 6233, true }, + { 6250, true }, + { 6263, true }, + { 6273, true }, { 6284, true }, - { 6295, true }, - { 6310, true }, + { 6299, true }, + { 6322, true }, { 6333, true }, - { 6344, true }, + { 6345, true }, { 6356, true }, { 6367, true }, { 6378, true }, { 6389, true }, { 6400, true }, - { 6411, true }, - { 6424, true }, - { 6442, true }, - { 6454, true }, - { 6471, true }, - { 6480, true }, + { 6413, true }, + { 6431, true }, + { 6443, true }, + { 6460, true }, + { 6469, true }, + { 6483, true }, { 6494, true }, - { 6505, true }, + { 6511, true }, { 6522, true }, - { 6533, true }, - { 6541, true }, - { 6550, false }, - { 6576, false }, - { 6587, true }, - { 6597, false }, - { 6614, true }, - { 6624, true }, - { 6636, true }, - { 6645, true }, - { 6662, true }, - { 6669, true }, - { 6693, true }, - { 6709, true }, - { 6729, true }, - { 6754, true }, - { 6779, true }, - { 6804, true }, - { 6816, true }, - { 6828, true }, - { 6837, true }, - { 6850, false }, - { 6859, true }, - { 6875, true }, - { 6891, true }, - { 6903, true }, - { 6917, true }, - { 6937, true }, - { 6952, true }, - { 6973, true }, + { 6530, true }, + { 6539, false }, + { 6565, false }, + { 6576, true }, + { 6586, false }, + { 6603, true }, + { 6613, true }, + { 6625, true }, + { 6634, true }, + { 6651, true }, + { 6658, true }, + { 6682, true }, + { 6698, true }, + { 6718, true }, + { 6743, true }, + { 6768, true }, + { 6793, true }, + { 6805, true }, + { 6817, true }, + { 6826, true }, + { 6839, false }, + { 6848, true }, + { 6864, true }, + { 6880, true }, + { 6892, true }, + { 6906, true }, + { 6926, true }, + { 6941, true }, + { 6962, true }, + { 6974, true }, { 6985, true }, - { 6996, true }, - { 7006, true }, - { 7018, true }, - { 7030, true }, - { 7042, true }, - { 7061, true }, + { 6995, true }, + { 7007, true }, + { 7019, true }, + { 7031, true }, + { 7050, true }, + { 7063, true }, { 7074, true }, - { 7085, true }, - { 7094, true }, - { 7112, true }, - { 7126, true }, - { 7140, true }, - { 7156, true }, - { 7172, true }, - { 7192, true }, - { 7213, true }, - { 7227, true }, - { 7240, true }, - { 7255, true }, - { 7265, true }, - { 7283, true }, - { 7298, true }, - { 7316, true }, - { 7326, true }, - { 7341, true }, - { 7359, true }, - { 7373, true }, - { 7387, true }, - { 7401, true }, - { 7413, true }, - { 7428, true }, - { 7442, true }, - { 7457, true }, - { 7467, true }, - { 7481, true }, - { 7496, true }, - { 7510, true }, - { 7524, true }, - { 7540, true }, - { 7552, true }, - { 7565, true }, - { 7576, false }, - { 7591, true }, - { 7618, true }, - { 7630, true }, - { 7645, true }, - { 7659, true }, - { 7681, true }, - { 7693, true }, - { 7716, true }, - { 7737, true }, - { 7750, true }, - { 7762, true }, - { 7775, true }, - { 7790, true }, - { 7801, false }, - { 7817, true }, - { 7828, true }, - { 7840, true }, - { 7853, true }, - { 7873, true }, - { 7886, true }, - { 7904, true }, - { 7921, true }, - { 7945, true }, - { 7964, true }, - { 7978, true }, - { 7994, true }, - { 8010, true }, - { 8029, true }, - { 8042, true }, - { 8063, true }, - { 8083, true }, - { 8103, true }, - { 8119, true }, - { 8132, false }, - { 8145, true }, - { 8157, true }, - { 8167, true }, - { 8180, true }, - { 8194, true }, - { 8210, true }, - { 8224, true }, - { 8240, true }, - { 8252, true }, - { 8266, true }, - { 8277, true }, - { 8296, true }, - { 8309, true }, - { 8323, true }, - { 8331, true }, - { 8344, true }, - { 8359, true }, - { 8373, true }, - { 8390, true }, - { 8409, true }, - { 8421, true }, - { 8435, true }, - { 8457, true }, - { 8471, true }, - { 8483, true }, - { 8511, true }, - { 8526, true }, - { 8538, true }, - { 8549, true }, - { 8560, true }, - { 8572, true }, - { 8580, true }, - { 8591, true }, - { 8599, true }, - { 8607, true }, - { 8615, true }, - { 8623, true }, - { 8636, true }, - { 8643, true }, - { 8653, true }, - { 8666, true }, - { 8678, true }, - { 8691, true }, - { 8708, true }, - { 8720, true }, - { 8732, true }, - { 8750, true }, - { 8778, true }, - { 8791, true }, - { 8800, true }, - { 8813, true }, - { 8825, true }, - { 8839, true }, - { 8852, true }, - { 8863, true }, + { 7083, true }, + { 7101, true }, + { 7115, true }, + { 7129, true }, + { 7145, true }, + { 7161, true }, + { 7181, true }, + { 7202, true }, + { 7216, true }, + { 7229, true }, + { 7244, true }, + { 7254, true }, + { 7272, true }, + { 7287, true }, + { 7305, true }, + { 7315, true }, + { 7330, true }, + { 7348, true }, + { 7362, true }, + { 7376, true }, + { 7390, true }, + { 7402, true }, + { 7417, true }, + { 7431, true }, + { 7446, true }, + { 7456, true }, + { 7470, true }, + { 7485, true }, + { 7499, true }, + { 7513, true }, + { 7529, true }, + { 7541, true }, + { 7554, true }, + { 7565, false }, + { 7580, true }, + { 7607, true }, + { 7619, true }, + { 7634, true }, + { 7648, true }, + { 7670, true }, + { 7682, true }, + { 7705, true }, + { 7726, true }, + { 7738, true }, + { 7751, true }, + { 7763, true }, + { 7776, true }, + { 7791, true }, + { 7802, false }, + { 7818, true }, + { 7829, true }, + { 7841, true }, + { 7854, true }, + { 7874, true }, + { 7887, true }, + { 7905, true }, + { 7922, true }, + { 7946, true }, + { 7965, true }, + { 7979, true }, + { 7995, true }, + { 8011, true }, + { 8030, true }, + { 8043, true }, + { 8064, true }, + { 8084, true }, + { 8104, true }, + { 8120, true }, + { 8133, false }, + { 8146, true }, + { 8158, true }, + { 8168, true }, + { 8181, true }, + { 8195, true }, + { 8211, true }, + { 8225, true }, + { 8241, true }, + { 8253, true }, + { 8267, true }, + { 8278, true }, + { 8297, true }, + { 8310, true }, + { 8324, true }, + { 8332, true }, + { 8345, true }, + { 8360, true }, + { 8374, true }, + { 8391, true }, + { 8410, true }, + { 8422, true }, + { 8436, true }, + { 8458, true }, + { 8472, true }, + { 8484, true }, + { 8512, true }, + { 8527, true }, + { 8539, true }, + { 8550, true }, + { 8561, true }, + { 8573, true }, + { 8581, true }, + { 8592, true }, + { 8600, true }, + { 8608, true }, + { 8616, true }, + { 8624, true }, + { 8637, true }, + { 8644, true }, + { 8654, true }, + { 8667, true }, + { 8679, true }, + { 8692, true }, + { 8709, true }, + { 8729, true }, + { 8741, true }, + { 8753, true }, + { 8771, true }, + { 8799, true }, + { 8812, true }, + { 8821, true }, + { 8834, true }, + { 8846, true }, + { 8860, true }, { 8873, true }, { 8884, true }, { 8894, true }, { 8905, true }, - { 8914, true }, - { 8930, true }, - { 8946, true }, - { 8974, true }, - { 8993, true }, - { 9008, true }, - { 9028, true }, - { 9040, true }, - { 9052, true }, - { 9065, true }, - { 9074, true }, - { 9083, true }, - { 9102, true }, - { 9113, true }, - { 9124, true }, - { 9139, true }, - { 9159, true }, - { 9177, true }, - { 9187, true }, - { 9204, true }, - { 9215, true }, + { 8915, true }, + { 8926, true }, + { 8935, true }, + { 8951, true }, + { 8967, true }, + { 8995, true }, + { 9014, true }, + { 9029, true }, + { 9049, true }, + { 9061, true }, + { 9073, true }, + { 9086, true }, + { 9095, true }, + { 9104, true }, + { 9123, true }, + { 9134, true }, + { 9145, true }, + { 9160, true }, + { 9180, true }, + { 9198, true }, + { 9208, true }, { 9225, true }, - { 9239, true }, - { 9256, true }, - { 9265, true }, - { 9276, true }, - { 9296, true }, - { 9315, true }, - { 9326, true }, - { 9337, true }, - { 9355, true }, - { 9381, false }, - { 9392, true }, - { 9414, true }, - { 9436, true }, - { 9450, true }, - { 9465, true }, - { 9479, true }, - { 9493, true }, - { 9508, true }, + { 9236, true }, + { 9246, true }, + { 9260, true }, + { 9277, true }, + { 9286, true }, + { 9297, true }, + { 9317, true }, + { 9336, true }, + { 9347, true }, + { 9358, true }, + { 9376, true }, + { 9402, false }, + { 9413, true }, + { 9435, true }, + { 9457, true }, + { 9471, true }, + { 9486, true }, + { 9500, true }, + { 9514, true }, { 9529, true }, - { 9539, true }, { 9550, true }, + { 9560, true }, { 9571, true }, - { 9589, true }, - { 9607, true }, - { 9620, true }, + { 9592, true }, + { 9610, true }, { 9628, true }, { 9641, true }, - { 9655, true }, - { 9677, true }, - { 9692, true }, - { 9709, true }, - { 9731, true }, - { 9746, true }, - { 9763, true }, + { 9649, true }, + { 9662, true }, + { 9676, true }, + { 9698, true }, + { 9713, true }, + { 9730, true }, + { 9752, true }, + { 9767, true }, { 9784, true }, - { 9800, true }, - { 9827, true }, - { 9843, true }, - { 9858, true }, - { 9872, true }, - { 9889, true }, - { 9906, true }, - { 9918, true }, - { 9936, true }, - { 9953, true }, - { 9968, true }, - { 9982, true }, - { 9999, true }, - { 10017, true }, - { 10032, true }, - { 10044, true }, - { 10060, true }, - { 10073, true }, - { 10093, true }, - { 10113, true }, - { 10124, true }, - { 10135, true }, - { 10146, true }, - { 10161, true }, - { 10172, true }, - { 10189, true }, - { 10205, true }, - { 10216, true }, - { 10227, true }, - { 10239, true }, - { 10252, true }, - { 10271, true }, - { 10282, true }, - { 10295, true }, - { 10309, true }, - { 10327, false }, - { 10340, false }, - { 10349, true }, - { 10366, true }, - { 10383, true }, - { 10403, true }, - { 10414, true }, - { 10425, true }, - { 10443, true }, - { 10475, true }, - { 10502, true }, - { 10514, true }, - { 10524, true }, - { 10542, true }, - { 10557, true }, - { 10569, true }, - { 10581, true }, - { 10601, true }, - { 10620, true }, - { 10640, true }, - { 10663, false }, - { 10687, true }, - { 10699, true }, - { 10710, true }, - { 10722, true }, - { 10734, true }, - { 10750, true }, - { 10767, true }, - { 10786, true }, - { 10800, true }, - { 10811, true }, - { 10827, true }, - { 10846, true }, - { 10859, true }, - { 10872, true }, - { 10884, false }, - { 10908, true }, - { 10924, true }, - { 10940, true }, - { 10952, true }, - { 10968, true }, - { 10985, true }, - { 10999, true }, - { 11014, true }, - { 11029, true }, - { 11040, true }, - { 11058, true }, - { 11074, true }, - { 11095, true }, - { 11109, true }, - { 11124, true }, - { 11134, true }, - { 11147, true }, - { 11164, true }, - { 11177, true }, - { 11190, true }, - { 11206, true }, - { 11217, true }, - { 11229, true }, - { 11240, true }, - { 11247, true }, - { 11255, false }, - { 11266, true }, - { 11277, true }, - { 11290, false }, - { 11298, true }, - { 11308, true }, - { 11315, true }, - { 11329, false }, - { 11343, true }, - { 11359, true }, - { 11373, true }, + { 9805, true }, + { 9821, true }, + { 9848, true }, + { 9864, true }, + { 9879, true }, + { 9893, true }, + { 9910, true }, + { 9927, true }, + { 9939, true }, + { 9957, true }, + { 9974, true }, + { 9989, true }, + { 10003, true }, + { 10020, true }, + { 10038, true }, + { 10053, true }, + { 10069, true }, + { 10082, true }, + { 10102, true }, + { 10122, true }, + { 10133, true }, + { 10144, true }, + { 10155, true }, + { 10170, true }, + { 10181, true }, + { 10198, true }, + { 10214, true }, + { 10225, true }, + { 10236, true }, + { 10248, true }, + { 10261, true }, + { 10280, true }, + { 10291, true }, + { 10304, true }, + { 10318, true }, + { 10336, false }, + { 10349, false }, + { 10358, true }, + { 10375, true }, + { 10392, true }, + { 10412, true }, + { 10423, true }, + { 10434, true }, + { 10452, true }, + { 10484, true }, + { 10511, true }, + { 10523, true }, + { 10533, true }, + { 10551, true }, + { 10566, true }, + { 10578, true }, + { 10590, true }, + { 10610, true }, + { 10629, true }, + { 10649, true }, + { 10672, false }, + { 10696, true }, + { 10708, true }, + { 10719, true }, + { 10731, true }, + { 10743, true }, + { 10759, true }, + { 10776, true }, + { 10795, true }, + { 10809, true }, + { 10820, true }, + { 10836, true }, + { 10855, true }, + { 10868, true }, + { 10881, true }, + { 10893, false }, + { 10917, true }, + { 10933, true }, + { 10949, true }, + { 10961, true }, + { 10977, true }, + { 10994, true }, + { 11008, true }, + { 11023, true }, + { 11038, true }, + { 11049, true }, + { 11067, true }, + { 11083, true }, + { 11104, true }, + { 11118, true }, + { 11133, true }, + { 11143, true }, + { 11156, true }, + { 11173, true }, + { 11186, true }, + { 11199, true }, + { 11215, true }, + { 11226, true }, + { 11238, true }, + { 11249, true }, + { 11256, true }, + { 11264, false }, + { 11275, true }, + { 11286, true }, + { 11299, false }, + { 11307, true }, + { 11317, true }, + { 11324, true }, + { 11338, false }, + { 11352, true }, + { 11368, true }, { 11382, true }, { 11412, true }, { 11435, true }, @@ -16980,15156 +16980,15158 @@ static const nsSTSPreload kSTSPreloadList[] = { { 12545, true }, { 12569, true }, { 12582, true }, - { 12591, true }, - { 12603, true }, - { 12619, true }, - { 12633, true }, - { 12649, true }, - { 12669, true }, - { 12683, true }, - { 12691, true }, - { 12705, true }, - { 12723, true }, - { 12743, true }, - { 12765, true }, - { 12777, true }, - { 12793, true }, - { 12807, false }, - { 12820, true }, - { 12835, true }, - { 12853, true }, - { 12867, true }, - { 12876, true }, - { 12888, true }, - { 12906, true }, - { 12926, false }, - { 12941, true }, - { 12954, true }, - { 12964, true }, - { 12978, true }, - { 13004, true }, - { 13014, true }, - { 13028, true }, - { 13040, true }, - { 13058, true }, - { 13076, false }, - { 13092, true }, - { 13102, true }, + { 12593, true }, + { 12602, true }, + { 12614, true }, + { 12630, true }, + { 12644, true }, + { 12660, true }, + { 12680, true }, + { 12694, true }, + { 12702, true }, + { 12716, true }, + { 12734, true }, + { 12754, true }, + { 12776, true }, + { 12788, true }, + { 12804, true }, + { 12818, false }, + { 12831, true }, + { 12846, true }, + { 12864, true }, + { 12878, true }, + { 12887, true }, + { 12899, true }, + { 12917, true }, + { 12937, false }, + { 12952, true }, + { 12965, true }, + { 12975, true }, + { 12989, true }, + { 13015, true }, + { 13025, true }, + { 13039, true }, + { 13051, true }, + { 13069, true }, + { 13087, false }, + { 13103, true }, { 13113, true }, - { 13126, true }, - { 13142, true }, + { 13124, true }, + { 13137, true }, { 13153, true }, - { 13163, true }, - { 13178, true }, - { 13197, true }, - { 13210, true }, - { 13228, false }, - { 13243, true }, - { 13263, true }, + { 13164, true }, + { 13174, true }, + { 13189, true }, + { 13208, true }, + { 13221, true }, + { 13239, false }, + { 13254, true }, { 13274, true }, - { 13286, true }, - { 13299, true }, - { 13319, false }, - { 13333, true }, - { 13346, true }, - { 13364, true }, - { 13378, true }, - { 13391, true }, - { 13403, true }, - { 13417, true }, - { 13430, true }, - { 13444, true }, - { 13456, true }, - { 13474, true }, - { 13486, true }, + { 13285, true }, + { 13297, true }, + { 13310, true }, + { 13330, false }, + { 13344, true }, + { 13357, true }, + { 13375, true }, + { 13389, true }, + { 13402, true }, + { 13414, true }, + { 13428, true }, + { 13441, true }, + { 13455, true }, + { 13467, true }, + { 13485, true }, { 13497, true }, { 13508, true }, - { 13521, true }, - { 13534, true }, - { 13549, true }, + { 13519, true }, + { 13532, true }, + { 13545, true }, { 13560, true }, { 13571, true }, { 13582, true }, - { 13592, true }, - { 13613, true }, - { 13622, true }, - { 13629, true }, - { 13643, false }, - { 13656, true }, - { 13666, true }, - { 13679, true }, - { 13692, true }, - { 13704, true }, - { 13721, true }, + { 13593, true }, + { 13603, true }, + { 13624, true }, + { 13633, true }, + { 13640, true }, + { 13654, false }, + { 13667, true }, + { 13677, true }, + { 13690, true }, + { 13703, true }, + { 13715, true }, { 13732, true }, - { 13746, true }, - { 13756, true }, - { 13774, true }, - { 13784, true }, - { 13796, true }, - { 13810, true }, - { 13827, true }, - { 13841, true }, - { 13851, true }, - { 13867, true }, + { 13743, true }, + { 13757, true }, + { 13767, true }, + { 13785, true }, + { 13795, true }, + { 13807, true }, + { 13821, true }, + { 13838, true }, + { 13852, true }, + { 13862, true }, { 13878, true }, - { 13895, true }, - { 13907, true }, - { 13921, true }, - { 13943, true }, - { 13969, true }, - { 13984, true }, - { 13997, true }, - { 14015, true }, + { 13889, true }, + { 13906, true }, + { 13918, true }, + { 13932, true }, + { 13954, true }, + { 13980, true }, + { 13995, true }, + { 14008, true }, { 14026, true }, - { 14036, true }, - { 14046, true }, - { 14056, true }, - { 14075, true }, - { 14095, true }, - { 14107, true }, - { 14121, true }, - { 14128, true }, - { 14138, true }, - { 14148, true }, - { 14170, true }, - { 14182, true }, - { 14200, true }, - { 14212, true }, - { 14225, true }, - { 14253, true }, - { 14262, true }, - { 14272, true }, - { 14282, true }, - { 14290, true }, - { 14302, false }, - { 14322, true }, - { 14329, true }, - { 14345, true }, - { 14361, true }, - { 14376, true }, - { 14386, true }, - { 14404, true }, - { 14419, true }, - { 14446, true }, - { 14463, true }, - { 14481, true }, - { 14489, true }, - { 14503, true }, - { 14514, true }, - { 14523, true }, - { 14550, true }, - { 14558, true }, + { 14037, true }, + { 14047, true }, + { 14057, true }, + { 14067, true }, + { 14086, true }, + { 14106, true }, + { 14118, true }, + { 14132, true }, + { 14139, true }, + { 14149, true }, + { 14159, true }, + { 14181, true }, + { 14193, true }, + { 14211, true }, + { 14223, true }, + { 14236, true }, + { 14264, true }, + { 14273, true }, + { 14283, true }, + { 14293, true }, + { 14301, true }, + { 14313, false }, + { 14333, true }, + { 14340, true }, + { 14356, true }, + { 14372, true }, + { 14387, true }, + { 14397, true }, + { 14415, true }, + { 14430, true }, + { 14447, true }, + { 14465, true }, + { 14473, true }, + { 14487, true }, + { 14498, true }, + { 14507, true }, + { 14534, true }, + { 14542, true }, + { 14552, true }, { 14568, true }, - { 14584, true }, - { 14596, true }, - { 14611, true }, - { 14623, true }, - { 14638, true }, - { 14653, true }, - { 14665, true }, - { 14686, true }, - { 14703, true }, - { 14717, true }, - { 14729, true }, - { 14743, true }, - { 14753, true }, - { 14763, true }, - { 14778, true }, - { 14793, true }, - { 14804, true }, - { 14817, true }, - { 14830, true }, - { 14842, true }, - { 14850, true }, - { 14863, true }, - { 14881, true }, - { 14902, true }, + { 14580, true }, + { 14595, true }, + { 14607, true }, + { 14622, true }, + { 14637, true }, + { 14649, true }, + { 14670, true }, + { 14687, true }, + { 14701, true }, + { 14713, true }, + { 14727, true }, + { 14737, true }, + { 14747, true }, + { 14762, true }, + { 14777, true }, + { 14788, true }, + { 14801, true }, + { 14814, true }, + { 14826, true }, + { 14834, true }, + { 14847, true }, + { 14865, true }, + { 14886, true }, + { 14900, true }, { 14916, true }, - { 14932, true }, - { 14944, true }, - { 14956, true }, - { 14968, true }, - { 14980, true }, - { 14990, true }, - { 15000, true }, - { 15011, true }, - { 15026, true }, - { 15039, true }, - { 15058, true }, - { 15084, true }, + { 14928, true }, + { 14940, true }, + { 14952, true }, + { 14964, true }, + { 14974, true }, + { 14984, true }, + { 14995, true }, + { 15010, true }, + { 15023, true }, + { 15042, true }, + { 15068, true }, + { 15080, true }, { 15096, true }, - { 15112, true }, + { 15108, true }, { 15124, true }, - { 15140, true }, - { 15159, true }, - { 15172, true }, - { 15183, true }, - { 15194, true }, - { 15212, true }, - { 15242, true }, - { 15265, true }, - { 15278, false }, - { 15286, true }, - { 15298, true }, - { 15308, true }, - { 15318, true }, + { 15143, true }, + { 15156, true }, + { 15167, true }, + { 15178, true }, + { 15196, true }, + { 15226, true }, + { 15249, true }, + { 15262, false }, + { 15270, true }, + { 15282, true }, + { 15292, true }, + { 15302, true }, + { 15316, true }, { 15332, true }, - { 15348, true }, + { 15361, true }, { 15377, true }, { 15393, true }, - { 15409, true }, - { 15427, true }, - { 15448, true }, - { 15459, true }, - { 15471, true }, - { 15483, true }, - { 15501, true }, - { 15519, true }, - { 15540, true }, - { 15565, true }, - { 15583, true }, - { 15597, true }, - { 15622, true }, - { 15635, true }, - { 15650, true }, - { 15665, true }, - { 15678, true }, - { 15691, true }, - { 15704, true }, - { 15717, true }, - { 15730, true }, - { 15743, true }, - { 15754, true }, - { 15770, true }, - { 15780, true }, - { 15792, true }, - { 15809, true }, - { 15821, true }, - { 15834, true }, - { 15842, true }, - { 15853, true }, - { 15864, true }, - { 15882, true }, - { 15897, true }, - { 15915, true }, - { 15925, true }, - { 15935, true }, - { 15944, true }, - { 15966, true }, - { 15980, true }, - { 15991, true }, - { 15999, true }, - { 16009, true }, - { 16021, true }, - { 16029, true }, - { 16039, true }, - { 16054, true }, - { 16074, true }, - { 16082, true }, - { 16107, true }, - { 16123, true }, - { 16147, true }, - { 16154, true }, - { 16162, true }, - { 16171, true }, - { 16178, true }, - { 16190, true }, - { 16201, true }, - { 16212, true }, - { 16224, true }, - { 16236, false }, - { 16245, true }, - { 16261, true }, - { 16274, true }, - { 16283, true }, - { 16292, true }, - { 16307, true }, - { 16317, true }, - { 16329, true }, - { 16347, false }, - { 16363, true }, - { 16373, true }, - { 16383, true }, - { 16393, true }, - { 16405, true }, - { 16418, true }, - { 16431, true }, - { 16441, true }, - { 16449, true }, - { 16459, true }, - { 16471, true }, - { 16483, true }, - { 16496, true }, - { 16512, true }, - { 16528, true }, - { 16539, false }, - { 16549, true }, - { 16566, true }, - { 16574, true }, - { 16583, true }, - { 16597, true }, - { 16627, true }, - { 16642, false }, - { 16651, true }, - { 16665, true }, - { 16686, true }, - { 16697, true }, - { 16710, true }, - { 16734, true }, - { 16748, true }, - { 16761, true }, - { 16773, true }, - { 16796, true }, - { 16816, true }, - { 16834, true }, - { 16852, true }, - { 16867, true }, - { 16882, true }, - { 16906, true }, - { 16916, true }, - { 16926, true }, - { 16936, true }, - { 16949, true }, - { 16960, true }, - { 16985, true }, - { 17014, true }, - { 17027, true }, - { 17039, true }, - { 17049, true }, - { 17057, true }, - { 17066, true }, - { 17080, false }, - { 17097, true }, - { 17109, true }, - { 17124, true }, - { 17131, true }, - { 17144, true }, - { 17156, true }, - { 17170, true }, - { 17178, true }, - { 17193, true }, - { 17202, true }, - { 17215, true }, - { 17227, true }, - { 17238, true }, - { 17248, true }, - { 17265, true }, - { 17278, true }, - { 17288, true }, - { 17301, true }, - { 17315, true }, - { 17329, true }, - { 17341, true }, - { 17356, true }, + { 15411, true }, + { 15432, true }, + { 15443, true }, + { 15455, true }, + { 15467, true }, + { 15485, true }, + { 15503, true }, + { 15524, true }, + { 15549, true }, + { 15567, true }, + { 15581, true }, + { 15606, true }, + { 15617, true }, + { 15630, true }, + { 15645, true }, + { 15660, true }, + { 15673, true }, + { 15686, true }, + { 15699, true }, + { 15712, true }, + { 15725, true }, + { 15738, true }, + { 15749, true }, + { 15765, true }, + { 15775, true }, + { 15787, true }, + { 15804, true }, + { 15816, true }, + { 15829, true }, + { 15837, true }, + { 15848, true }, + { 15859, true }, + { 15877, true }, + { 15892, true }, + { 15910, true }, + { 15920, true }, + { 15930, true }, + { 15939, true }, + { 15961, true }, + { 15975, true }, + { 15986, true }, + { 15994, true }, + { 16004, true }, + { 16016, true }, + { 16024, true }, + { 16034, true }, + { 16049, true }, + { 16069, true }, + { 16077, true }, + { 16102, true }, + { 16118, true }, + { 16142, true }, + { 16149, true }, + { 16157, true }, + { 16166, true }, + { 16173, true }, + { 16185, true }, + { 16196, true }, + { 16207, true }, + { 16219, true }, + { 16231, false }, + { 16240, true }, + { 16256, true }, + { 16269, true }, + { 16278, true }, + { 16287, true }, + { 16302, true }, + { 16312, true }, + { 16324, true }, + { 16342, false }, + { 16358, true }, + { 16368, true }, + { 16378, true }, + { 16388, true }, + { 16400, true }, + { 16413, true }, + { 16426, true }, + { 16436, true }, + { 16446, true }, + { 16454, true }, + { 16464, true }, + { 16476, true }, + { 16488, true }, + { 16501, true }, + { 16517, true }, + { 16533, true }, + { 16544, false }, + { 16554, true }, + { 16571, true }, + { 16579, true }, + { 16588, true }, + { 16602, true }, + { 16632, true }, + { 16647, false }, + { 16656, true }, + { 16670, true }, + { 16691, true }, + { 16702, true }, + { 16715, true }, + { 16739, true }, + { 16753, true }, + { 16766, true }, + { 16778, true }, + { 16801, true }, + { 16812, true }, + { 16832, true }, + { 16850, true }, + { 16868, true }, + { 16883, true }, + { 16898, true }, + { 16922, true }, + { 16932, true }, + { 16942, true }, + { 16952, true }, + { 16965, true }, + { 16976, true }, + { 17001, true }, + { 17030, true }, + { 17043, true }, + { 17055, true }, + { 17065, true }, + { 17073, true }, + { 17082, true }, + { 17096, false }, + { 17113, true }, + { 17125, true }, + { 17140, true }, + { 17147, true }, + { 17160, true }, + { 17172, true }, + { 17186, true }, + { 17194, true }, + { 17209, true }, + { 17218, true }, + { 17231, true }, + { 17243, true }, + { 17254, true }, + { 17264, true }, + { 17281, true }, + { 17294, true }, + { 17304, true }, + { 17317, true }, + { 17331, true }, + { 17345, true }, + { 17357, true }, { 17372, true }, - { 17386, true }, - { 17399, true }, - { 17415, true }, - { 17427, true }, - { 17441, true }, - { 17453, true }, - { 17465, true }, - { 17476, true }, - { 17487, true }, - { 17502, false }, - { 17517, false }, - { 17533, true }, - { 17555, true }, - { 17573, true }, - { 17590, true }, - { 17608, true }, - { 17619, true }, - { 17632, true }, - { 17649, true }, - { 17665, true }, - { 17685, true }, - { 17700, true }, - { 17715, true }, - { 17729, true }, - { 17740, true }, - { 17752, true }, - { 17765, true }, - { 17778, true }, - { 17792, true }, - { 17805, true }, + { 17388, true }, + { 17403, true }, + { 17417, true }, + { 17430, true }, + { 17446, true }, + { 17458, true }, + { 17472, true }, + { 17484, true }, + { 17496, true }, + { 17507, true }, + { 17518, true }, + { 17533, false }, + { 17548, false }, + { 17564, true }, + { 17586, true }, + { 17604, true }, + { 17621, true }, + { 17639, true }, + { 17650, true }, + { 17663, true }, + { 17680, true }, + { 17696, true }, + { 17716, true }, + { 17731, true }, + { 17746, true }, + { 17760, true }, + { 17771, true }, + { 17783, true }, + { 17796, true }, + { 17809, true }, { 17823, true }, - { 17841, true }, - { 17859, true }, - { 17869, true }, - { 17882, true }, - { 17891, true }, - { 17906, true }, - { 17917, false }, - { 17927, true }, - { 17938, true }, - { 17952, true }, - { 17965, true }, - { 17975, true }, - { 17989, true }, - { 17999, true }, - { 18017, true }, - { 18026, true }, - { 18043, true }, - { 18062, true }, - { 18077, true }, - { 18097, true }, - { 18115, true }, - { 18126, true }, - { 18139, true }, - { 18154, true }, - { 18167, true }, - { 18178, true }, - { 18192, true }, - { 18216, true }, - { 18242, true }, - { 18250, true }, - { 18260, true }, + { 17836, true }, + { 17854, true }, + { 17872, true }, + { 17890, true }, + { 17900, true }, + { 17913, true }, + { 17922, true }, + { 17937, true }, + { 17948, false }, + { 17958, true }, + { 17969, true }, + { 17983, true }, + { 17996, true }, + { 18006, true }, + { 18019, true }, + { 18033, true }, + { 18044, true }, + { 18054, true }, + { 18072, true }, + { 18081, true }, + { 18098, true }, + { 18117, true }, + { 18132, true }, + { 18152, true }, + { 18170, true }, + { 18181, true }, + { 18194, true }, + { 18209, true }, + { 18222, true }, + { 18233, true }, + { 18247, true }, { 18271, true }, - { 18282, true }, - { 18309, true }, - { 18321, true }, - { 18333, true }, - { 18342, true }, - { 18351, true }, - { 18360, true }, - { 18375, true }, - { 18384, true }, - { 18396, true }, - { 18405, true }, + { 18297, true }, + { 18305, true }, + { 18315, true }, + { 18326, true }, + { 18337, true }, + { 18364, true }, + { 18376, true }, + { 18388, true }, + { 18397, true }, + { 18406, true }, { 18415, true }, - { 18426, true }, - { 18438, true }, - { 18448, true }, + { 18430, true }, + { 18439, true }, + { 18451, true }, { 18460, true }, - { 18474, true }, - { 18484, true }, - { 18494, true }, - { 18507, true }, - { 18517, false }, - { 18528, true }, - { 18546, true }, - { 18556, true }, - { 18563, true }, - { 18575, true }, - { 18590, true }, + { 18470, true }, + { 18481, true }, + { 18493, true }, + { 18503, true }, + { 18515, true }, + { 18529, true }, + { 18539, true }, + { 18549, true }, + { 18562, true }, + { 18572, false }, + { 18583, true }, + { 18601, true }, { 18611, true }, - { 18624, true }, - { 18637, true }, - { 18654, true }, + { 18618, true }, + { 18630, true }, + { 18645, true }, { 18666, true }, - { 18679, false }, - { 18693, true }, - { 18705, true }, - { 18719, true }, - { 18737, true }, - { 18749, true }, - { 18762, true }, - { 18771, true }, - { 18789, true }, - { 18800, true }, - { 18811, true }, - { 18836, true }, - { 18850, true }, - { 18863, true }, - { 18877, true }, - { 18890, true }, - { 18904, true }, - { 18916, true }, - { 18932, false }, - { 18943, true }, - { 18958, true }, + { 18679, true }, + { 18692, true }, + { 18709, true }, + { 18721, true }, + { 18734, false }, + { 18748, true }, + { 18760, true }, + { 18774, true }, + { 18792, true }, + { 18804, true }, + { 18817, true }, + { 18826, true }, + { 18844, true }, + { 18855, true }, + { 18866, true }, + { 18891, true }, + { 18905, true }, + { 18918, true }, + { 18932, true }, + { 18945, true }, + { 18959, true }, { 18971, true }, - { 18984, true }, - { 19000, true }, - { 19022, true }, - { 19034, true }, - { 19047, true }, - { 19062, true }, - { 19074, true }, - { 19090, true }, - { 19103, true }, - { 19113, true }, - { 19141, true }, - { 19156, true }, - { 19172, true }, - { 19183, true }, - { 19194, true }, - { 19204, true }, - { 19217, true }, - { 19227, false }, - { 19241, true }, - { 19250, true }, - { 19262, false }, - { 19281, true }, - { 19308, true }, - { 19329, true }, - { 19345, true }, - { 19356, true }, - { 19374, true }, - { 19389, true }, + { 18987, false }, + { 18998, true }, + { 19013, true }, + { 19026, true }, + { 19039, true }, + { 19055, true }, + { 19077, true }, + { 19089, true }, + { 19102, true }, + { 19117, true }, + { 19129, true }, + { 19145, true }, + { 19158, true }, + { 19168, true }, + { 19196, true }, + { 19211, true }, + { 19227, true }, + { 19238, true }, + { 19249, true }, + { 19259, true }, + { 19272, true }, + { 19282, false }, + { 19296, true }, + { 19305, true }, + { 19317, false }, + { 19336, true }, + { 19363, true }, + { 19384, true }, { 19400, true }, - { 19415, false }, - { 19430, true }, - { 19440, true }, - { 19451, true }, - { 19465, true }, - { 19487, true }, - { 19500, true }, - { 19515, true }, - { 19530, true }, - { 19551, true }, - { 19561, true }, - { 19575, true }, - { 19588, true }, - { 19603, true }, - { 19624, true }, - { 19642, true }, - { 19654, true }, - { 19672, true }, - { 19690, true }, - { 19704, true }, - { 19723, false }, - { 19737, true }, - { 19747, true }, - { 19758, true }, - { 19768, true }, - { 19781, true }, - { 19796, true }, - { 19810, true }, + { 19411, true }, + { 19429, true }, + { 19444, true }, + { 19455, true }, + { 19470, false }, + { 19485, true }, + { 19495, true }, + { 19506, true }, + { 19520, true }, + { 19542, true }, + { 19555, true }, + { 19570, true }, + { 19585, true }, + { 19606, true }, + { 19616, true }, + { 19630, true }, + { 19643, true }, + { 19658, true }, + { 19679, true }, + { 19697, true }, + { 19709, true }, + { 19727, true }, + { 19745, true }, + { 19759, true }, + { 19778, false }, + { 19792, true }, + { 19802, true }, + { 19813, true }, { 19823, true }, { 19836, true }, - { 19853, true }, - { 19869, true }, - { 19879, true }, - { 19892, true }, - { 19909, true }, - { 19923, true }, - { 19941, true }, + { 19851, true }, + { 19865, true }, + { 19878, true }, + { 19891, true }, + { 19908, true }, + { 19924, true }, + { 19934, true }, + { 19947, true }, { 19961, true }, - { 19975, true }, - { 19991, true }, - { 20000, true }, - { 20008, true }, - { 20017, true }, - { 20026, true }, - { 20043, true }, - { 20056, true }, - { 20066, true }, - { 20076, true }, + { 19979, true }, + { 19999, true }, + { 20013, true }, + { 20029, true }, + { 20038, true }, + { 20046, true }, + { 20055, true }, + { 20064, true }, + { 20081, true }, { 20094, true }, - { 20113, true }, - { 20137, true }, - { 20152, true }, - { 20170, true }, - { 20186, true }, - { 20204, true }, - { 20216, true }, - { 20239, true }, - { 20261, true }, - { 20287, true }, - { 20305, true }, - { 20327, true }, - { 20341, true }, - { 20354, true }, - { 20366, true }, - { 20378, false }, - { 20394, true }, - { 20408, true }, - { 20426, true }, - { 20441, true }, - { 20453, true }, - { 20475, true }, - { 20492, true }, - { 20507, true }, - { 20528, true }, - { 20542, true }, - { 20561, true }, - { 20582, true }, + { 20104, true }, + { 20114, true }, + { 20132, true }, + { 20151, true }, + { 20175, true }, + { 20190, true }, + { 20208, true }, + { 20224, true }, + { 20242, true }, + { 20254, true }, + { 20277, true }, + { 20299, true }, + { 20325, true }, + { 20343, true }, + { 20365, true }, + { 20379, true }, + { 20392, true }, + { 20404, true }, + { 20416, false }, + { 20432, true }, + { 20446, true }, + { 20464, true }, + { 20479, true }, + { 20491, true }, + { 20513, true }, + { 20530, true }, + { 20545, true }, + { 20566, true }, + { 20580, true }, { 20599, true }, - { 20613, true }, - { 20634, true }, - { 20647, true }, - { 20663, true }, - { 20676, true }, - { 20695, true }, - { 20712, true }, - { 20730, true }, - { 20748, true }, - { 20757, true }, - { 20773, true }, - { 20789, true }, - { 20808, true }, - { 20826, true }, - { 20842, true }, - { 20856, true }, - { 20868, true }, - { 20879, true }, - { 20893, true }, - { 20903, true }, - { 20914, true }, - { 20923, false }, - { 20932, true }, - { 20946, true }, - { 20960, true }, - { 20972, true }, - { 20987, true }, - { 20999, true }, - { 21014, true }, - { 21027, true }, - { 21038, true }, - { 21061, true }, - { 21073, true }, - { 21088, true }, - { 21104, true }, - { 21113, true }, - { 21128, true }, - { 21144, true }, - { 21157, true }, - { 21172, true }, - { 21185, true }, + { 20620, true }, + { 20637, true }, + { 20651, true }, + { 20672, true }, + { 20685, true }, + { 20701, true }, + { 20714, true }, + { 20733, true }, + { 20750, true }, + { 20768, true }, + { 20786, true }, + { 20795, true }, + { 20811, true }, + { 20827, true }, + { 20846, true }, + { 20864, true }, + { 20880, true }, + { 20894, true }, + { 20906, true }, + { 20917, true }, + { 20931, true }, + { 20941, true }, + { 20952, true }, + { 20961, false }, + { 20970, true }, + { 20984, true }, + { 20998, true }, + { 21010, true }, + { 21025, true }, + { 21037, true }, + { 21052, true }, + { 21065, true }, + { 21076, true }, + { 21099, true }, + { 21111, true }, + { 21126, true }, + { 21142, true }, + { 21151, true }, + { 21166, true }, + { 21182, true }, { 21195, true }, - { 21215, true }, - { 21228, true }, - { 21247, true }, - { 21257, true }, - { 21267, true }, - { 21279, true }, - { 21294, true }, - { 21309, true }, - { 21324, true }, - { 21334, true }, - { 21349, true }, - { 21365, true }, - { 21384, true }, - { 21393, true }, + { 21210, true }, + { 21223, true }, + { 21233, true }, + { 21253, true }, + { 21266, true }, + { 21285, true }, + { 21295, true }, + { 21305, true }, + { 21317, true }, + { 21332, true }, + { 21347, true }, + { 21362, true }, + { 21372, true }, + { 21387, true }, + { 21403, true }, { 21422, true }, - { 21435, true }, - { 21455, true }, - { 21470, true }, - { 21483, true }, - { 21498, true }, - { 21513, true }, - { 21528, true }, - { 21538, true }, - { 21548, true }, - { 21563, true }, - { 21585, true }, - { 21600, true }, - { 21613, true }, - { 21640, true }, - { 21654, true }, - { 21666, true }, - { 21681, true }, - { 21695, true }, - { 21705, true }, - { 21726, true }, + { 21431, true }, + { 21460, true }, + { 21473, true }, + { 21493, true }, + { 21508, true }, + { 21521, true }, + { 21536, true }, + { 21551, true }, + { 21566, true }, + { 21576, true }, + { 21586, true }, + { 21601, true }, + { 21623, true }, + { 21638, true }, + { 21651, true }, + { 21678, true }, + { 21692, true }, + { 21704, true }, + { 21719, true }, + { 21733, true }, { 21743, true }, - { 21765, true }, - { 21783, true }, - { 21797, true }, - { 21809, true }, - { 21824, true }, - { 21841, true }, - { 21856, true }, - { 21867, true }, - { 21877, true }, - { 21893, true }, - { 21911, true }, - { 21923, true }, - { 21935, true }, - { 21965, true }, - { 21979, false }, - { 21992, true }, - { 22010, true }, - { 22023, true }, - { 22035, true }, - { 22058, true }, - { 22077, true }, - { 22090, false }, - { 22101, true }, - { 22119, true }, - { 22143, true }, - { 22163, true }, - { 22175, true }, - { 22196, true }, - { 22207, true }, - { 22224, true }, - { 22242, true }, - { 22258, true }, - { 22272, true }, - { 22289, true }, - { 22300, true }, + { 21764, true }, + { 21781, true }, + { 21803, true }, + { 21821, true }, + { 21835, true }, + { 21847, true }, + { 21862, true }, + { 21879, true }, + { 21894, true }, + { 21905, true }, + { 21915, true }, + { 21931, true }, + { 21949, true }, + { 21961, true }, + { 21973, true }, + { 22003, true }, + { 22017, false }, + { 22030, true }, + { 22048, true }, + { 22061, true }, + { 22073, true }, + { 22096, true }, + { 22115, true }, + { 22128, false }, + { 22139, true }, + { 22157, true }, + { 22181, true }, + { 22201, true }, + { 22213, true }, + { 22234, true }, + { 22245, true }, + { 22262, true }, + { 22280, true }, + { 22293, true }, { 22309, true }, - { 22321, true }, - { 22332, true }, - { 22342, true }, - { 22356, true }, - { 22374, true }, - { 22387, true }, - { 22398, true }, - { 22412, true }, - { 22424, true }, - { 22435, true }, - { 22446, true }, - { 22459, true }, - { 22471, true }, - { 22482, true }, - { 22501, true }, - { 22517, true }, - { 22531, true }, - { 22550, true }, - { 22562, true }, - { 22577, true }, - { 22586, true }, + { 22323, true }, + { 22340, true }, + { 22351, true }, + { 22360, true }, + { 22372, true }, + { 22383, true }, + { 22393, true }, + { 22407, true }, + { 22425, true }, + { 22438, true }, + { 22449, true }, + { 22463, true }, + { 22475, true }, + { 22486, true }, + { 22497, true }, + { 22510, true }, + { 22522, true }, + { 22533, true }, + { 22552, true }, + { 22568, true }, + { 22582, true }, { 22601, true }, - { 22615, true }, + { 22613, true }, { 22628, true }, - { 22640, true }, + { 22637, true }, { 22652, true }, { 22666, true }, - { 22677, true }, + { 22679, true }, { 22691, true }, - { 22702, true }, - { 22713, true }, - { 22723, true }, - { 22733, true }, - { 22746, true }, - { 22757, true }, - { 22768, true }, - { 22779, true }, - { 22792, true }, - { 22806, true }, - { 22818, true }, - { 22832, true }, - { 22844, true }, + { 22703, true }, + { 22717, true }, + { 22728, true }, + { 22742, true }, + { 22753, true }, + { 22764, true }, + { 22774, true }, + { 22784, true }, + { 22797, true }, + { 22808, true }, + { 22819, true }, + { 22830, true }, + { 22843, true }, { 22857, true }, - { 22882, true }, - { 22894, true }, - { 22911, true }, - { 22922, true }, + { 22869, true }, + { 22883, true }, + { 22895, true }, + { 22908, true }, { 22933, true }, - { 22952, true }, - { 22968, true }, - { 22978, true }, - { 22989, true }, - { 23001, true }, - { 23016, true }, - { 23035, true }, + { 22945, true }, + { 22962, true }, + { 22973, true }, + { 22984, true }, + { 23003, true }, + { 23019, true }, + { 23029, true }, + { 23040, true }, { 23052, true }, - { 23070, false }, - { 23078, true }, - { 23094, true }, - { 23108, true }, - { 23125, true }, - { 23142, true }, - { 23155, true }, - { 23168, true }, - { 23181, true }, - { 23194, true }, - { 23207, true }, - { 23220, true }, - { 23233, true }, - { 23246, true }, - { 23259, true }, - { 23272, true }, - { 23285, true }, - { 23298, true }, - { 23311, true }, - { 23324, true }, - { 23341, true }, - { 23356, true }, - { 23373, true }, - { 23386, true }, - { 23398, true }, - { 23420, true }, - { 23432, true }, - { 23455, true }, - { 23479, true }, - { 23497, true }, - { 23510, true }, - { 23529, true }, - { 23550, true }, + { 23067, true }, + { 23086, true }, + { 23103, true }, + { 23121, false }, + { 23129, true }, + { 23145, true }, + { 23159, true }, + { 23176, true }, + { 23193, true }, + { 23206, true }, + { 23219, true }, + { 23232, true }, + { 23245, true }, + { 23258, true }, + { 23271, true }, + { 23284, true }, + { 23297, true }, + { 23310, true }, + { 23323, true }, + { 23336, true }, + { 23349, true }, + { 23362, true }, + { 23375, true }, + { 23392, true }, + { 23407, true }, + { 23424, true }, + { 23437, true }, + { 23449, true }, + { 23471, true }, + { 23483, true }, + { 23506, true }, + { 23530, true }, + { 23548, true }, { 23561, true }, - { 23574, true }, - { 23589, true }, - { 23607, true }, - { 23623, true }, - { 23639, true }, - { 23649, true }, + { 23580, true }, + { 23601, true }, + { 23614, true }, + { 23629, true }, + { 23647, true }, { 23663, true }, - { 23678, true }, - { 23697, true }, - { 23714, true }, - { 23725, true }, - { 23741, true }, - { 23753, true }, - { 23763, true }, - { 23779, true }, - { 23789, true }, - { 23810, true }, - { 23832, true }, - { 23844, true }, - { 23855, true }, - { 23870, true }, - { 23881, true }, - { 23896, true }, - { 23911, true }, - { 23923, true }, - { 23942, true }, - { 23955, true }, - { 23969, true }, - { 23991, true }, - { 24010, true }, - { 24030, true }, - { 24038, true }, - { 24051, true }, - { 24065, true }, - { 24079, true }, - { 24090, true }, - { 24103, true }, - { 24118, true }, - { 24134, true }, - { 24149, true }, - { 24163, true }, - { 24175, true }, - { 24192, false }, - { 24208, false }, - { 24228, true }, - { 24241, true }, - { 24257, true }, - { 24282, true }, - { 24295, true }, - { 24308, true }, - { 24319, true }, - { 24328, true }, - { 24337, true }, - { 24353, true }, - { 24367, true }, - { 24383, true }, - { 24394, true }, + { 23679, true }, + { 23689, true }, + { 23703, true }, + { 23718, true }, + { 23737, true }, + { 23754, true }, + { 23765, true }, + { 23781, true }, + { 23793, true }, + { 23803, true }, + { 23819, true }, + { 23829, true }, + { 23850, true }, + { 23872, true }, + { 23884, true }, + { 23895, true }, + { 23910, true }, + { 23921, true }, + { 23936, true }, + { 23951, true }, + { 23963, true }, + { 23982, true }, + { 23995, true }, + { 24009, true }, + { 24031, true }, + { 24050, true }, + { 24070, true }, + { 24078, true }, + { 24091, true }, + { 24105, true }, + { 24119, true }, + { 24130, true }, + { 24143, true }, + { 24158, true }, + { 24174, true }, + { 24189, true }, + { 24203, true }, + { 24215, true }, + { 24232, false }, + { 24248, false }, + { 24268, true }, + { 24281, true }, + { 24297, true }, + { 24322, true }, + { 24335, true }, + { 24348, true }, + { 24359, true }, + { 24368, true }, + { 24377, true }, + { 24393, true }, { 24407, true }, - { 24422, true }, - { 24436, true }, - { 24448, true }, - { 24472, true }, - { 24485, true }, - { 24498, true }, - { 24519, true }, - { 24539, true }, - { 24553, true }, - { 24568, true }, - { 24577, true }, - { 24588, true }, - { 24598, true }, - { 24608, true }, - { 24626, true }, - { 24651, true }, - { 24673, true }, - { 24685, true }, - { 24698, true }, - { 24711, true }, - { 24722, true }, - { 24730, true }, - { 24749, true }, - { 24759, true }, - { 24772, true }, - { 24789, true }, - { 24806, true }, - { 24822, true }, - { 24834, true }, - { 24846, true }, - { 24857, true }, - { 24871, true }, - { 24895, true }, - { 24910, true }, - { 24925, true }, + { 24423, true }, + { 24434, true }, + { 24447, true }, + { 24462, true }, + { 24476, true }, + { 24488, true }, + { 24500, true }, + { 24524, true }, + { 24537, true }, + { 24550, true }, + { 24571, true }, + { 24591, true }, + { 24605, true }, + { 24620, true }, + { 24629, true }, + { 24640, true }, + { 24650, true }, + { 24660, true }, + { 24678, true }, + { 24703, true }, + { 24725, true }, + { 24737, true }, + { 24750, true }, + { 24763, true }, + { 24774, true }, + { 24782, true }, + { 24801, true }, + { 24811, true }, + { 24824, true }, + { 24841, true }, + { 24858, true }, + { 24874, true }, + { 24886, true }, + { 24898, true }, + { 24909, true }, + { 24923, true }, { 24947, true }, - { 24957, true }, - { 24973, true }, - { 24984, true }, - { 25005, true }, - { 25018, true }, - { 25038, true }, - { 25049, true }, - { 25057, false }, - { 25069, true }, - { 25081, true }, - { 25100, true }, - { 25114, true }, - { 25129, true }, - { 25144, true }, - { 25159, true }, - { 25169, true }, - { 25179, true }, - { 25191, false }, - { 25200, true }, - { 25214, true }, - { 25226, true }, + { 24962, true }, + { 24977, true }, + { 24999, true }, + { 25009, true }, + { 25025, true }, + { 25036, true }, + { 25057, true }, + { 25070, true }, + { 25090, true }, + { 25101, true }, + { 25109, false }, + { 25121, true }, + { 25133, true }, + { 25152, true }, + { 25166, true }, + { 25181, true }, + { 25196, true }, + { 25211, true }, + { 25221, true }, + { 25231, true }, + { 25243, false }, { 25252, true }, - { 25260, true }, - { 25275, true }, - { 25287, true }, - { 25299, true }, - { 25317, true }, - { 25337, true }, - { 25353, true }, - { 25365, true }, - { 25383, true }, - { 25395, true }, - { 25409, true }, - { 25429, true }, - { 25441, true }, - { 25455, true }, - { 25472, true }, + { 25266, true }, + { 25278, true }, + { 25304, true }, + { 25312, true }, + { 25327, true }, + { 25339, true }, + { 25351, true }, + { 25369, true }, + { 25389, true }, + { 25405, true }, + { 25417, true }, + { 25435, true }, + { 25447, true }, + { 25461, true }, { 25481, true }, - { 25491, true }, - { 25503, true }, - { 25525, false }, - { 25539, true }, + { 25493, true }, + { 25507, true }, + { 25524, true }, + { 25533, true }, + { 25543, true }, { 25555, true }, - { 25572, true }, - { 25584, true }, - { 25602, false }, - { 25624, false }, - { 25649, false }, - { 25673, true }, - { 25685, true }, - { 25695, true }, - { 25708, true }, - { 25718, true }, - { 25728, true }, - { 25738, true }, - { 25748, true }, - { 25758, true }, - { 25768, true }, - { 25778, true }, - { 25792, true }, + { 25577, false }, + { 25591, true }, + { 25607, true }, + { 25624, true }, + { 25636, true }, + { 25654, false }, + { 25676, false }, + { 25701, false }, + { 25725, true }, + { 25737, true }, + { 25747, true }, + { 25760, true }, + { 25770, true }, + { 25780, true }, + { 25790, true }, + { 25800, true }, { 25810, true }, - { 25825, true }, - { 25839, true }, - { 25851, true }, - { 25863, true }, - { 25874, true }, - { 25888, true }, + { 25820, true }, + { 25830, true }, + { 25844, true }, + { 25862, true }, + { 25877, true }, + { 25891, true }, { 25903, true }, - { 25917, true }, - { 25924, true }, - { 25938, false }, - { 25958, true }, - { 25979, true }, - { 25998, true }, - { 26013, true }, - { 26025, true }, + { 25915, true }, + { 25926, true }, + { 25940, true }, + { 25955, true }, + { 25969, true }, + { 25976, true }, + { 25990, false }, + { 26010, true }, + { 26031, true }, { 26050, true }, - { 26061, true }, - { 26072, true }, - { 26084, true }, - { 26097, false }, - { 26110, true }, - { 26127, true }, - { 26143, true }, - { 26156, true }, - { 26168, true }, - { 26183, true }, - { 26193, true }, - { 26218, true }, - { 26234, true }, - { 26248, true }, - { 26265, true }, - { 26284, true }, - { 26294, true }, - { 26314, true }, - { 26326, true }, - { 26342, false }, - { 26354, true }, - { 26367, true }, - { 26384, true }, - { 26401, true }, - { 26410, true }, - { 26420, true }, - { 26429, true }, - { 26446, true }, - { 26455, true }, + { 26065, true }, + { 26077, true }, + { 26102, true }, + { 26113, true }, + { 26124, true }, + { 26136, true }, + { 26149, false }, + { 26162, true }, + { 26179, true }, + { 26195, true }, + { 26208, true }, + { 26220, true }, + { 26235, true }, + { 26245, true }, + { 26270, true }, + { 26286, true }, + { 26300, true }, + { 26317, true }, + { 26336, true }, + { 26346, true }, + { 26366, true }, + { 26378, true }, + { 26394, false }, + { 26406, true }, + { 26419, true }, + { 26436, true }, + { 26453, true }, { 26462, true }, - { 26477, true }, - { 26488, false }, - { 26504, true }, - { 26521, true }, - { 26535, true }, - { 26545, true }, - { 26555, true }, - { 26575, true }, - { 26595, true }, - { 26606, true }, - { 26624, true }, - { 26639, true }, - { 26652, true }, - { 26667, true }, - { 26683, true }, - { 26709, true }, - { 26726, true }, - { 26739, true }, - { 26747, true }, - { 26770, true }, - { 26784, true }, - { 26796, true }, - { 26806, true }, - { 26831, true }, - { 26848, false }, - { 26869, false }, - { 26891, false }, - { 26910, false }, - { 26928, true }, - { 26944, true }, - { 26968, true }, - { 26996, true }, - { 27007, true }, - { 27022, true }, - { 27041, true }, - { 27064, true }, - { 27088, true }, - { 27102, true }, - { 27113, true }, - { 27135, true }, - { 27153, true }, - { 27168, true }, - { 27183, true }, - { 27196, true }, - { 27209, true }, - { 27224, true }, - { 27239, true }, + { 26472, true }, + { 26481, true }, + { 26498, true }, + { 26507, true }, + { 26514, true }, + { 26529, true }, + { 26540, false }, + { 26556, true }, + { 26573, true }, + { 26587, true }, + { 26597, true }, + { 26607, true }, + { 26627, true }, + { 26647, true }, + { 26658, true }, + { 26672, true }, + { 26690, true }, + { 26705, true }, + { 26718, true }, + { 26733, true }, + { 26749, true }, + { 26775, true }, + { 26792, true }, + { 26805, true }, + { 26828, true }, + { 26842, true }, + { 26854, true }, + { 26864, true }, + { 26889, true }, + { 26906, false }, + { 26927, false }, + { 26949, false }, + { 26968, false }, + { 26986, true }, + { 27002, true }, + { 27026, true }, + { 27054, true }, + { 27065, true }, + { 27080, true }, + { 27099, true }, + { 27122, true }, + { 27146, true }, + { 27160, true }, + { 27171, true }, + { 27193, true }, + { 27211, true }, + { 27226, true }, + { 27241, true }, { 27254, true }, - { 27281, true }, - { 27293, true }, - { 27308, true }, - { 27327, true }, - { 27345, true }, - { 27353, true }, - { 27361, true }, - { 27373, true }, + { 27267, true }, + { 27282, true }, + { 27297, true }, + { 27312, true }, + { 27339, true }, + { 27351, true }, + { 27366, true }, { 27385, true }, - { 27399, true }, - { 27417, true }, - { 27435, true }, - { 27450, true }, - { 27465, true }, - { 27480, true }, - { 27496, true }, - { 27513, true }, - { 27522, true }, - { 27533, true }, - { 27546, true }, - { 27556, true }, - { 27569, false }, - { 27583, true }, - { 27595, true }, - { 27605, true }, - { 27621, false }, - { 27628, true }, - { 27638, true }, - { 27652, true }, - { 27667, true }, - { 27675, true }, - { 27688, true }, + { 27403, true }, + { 27411, true }, + { 27419, true }, + { 27431, true }, + { 27443, true }, + { 27457, true }, + { 27475, true }, + { 27493, true }, + { 27508, true }, + { 27523, true }, + { 27538, true }, + { 27554, true }, + { 27571, true }, + { 27580, true }, + { 27591, true }, + { 27604, true }, + { 27614, true }, + { 27627, false }, + { 27641, true }, + { 27653, true }, + { 27663, true }, + { 27679, false }, + { 27686, true }, { 27696, true }, - { 27706, true }, - { 27724, true }, - { 27742, true }, - { 27753, true }, - { 27766, true }, - { 27779, true }, - { 27793, true }, - { 27802, true }, - { 27817, true }, - { 27846, true }, - { 27863, true }, - { 27881, true }, - { 27891, true }, - { 27905, true }, - { 27916, true }, - { 27943, true }, - { 27963, true }, - { 27980, true }, - { 27994, true }, - { 28016, true }, - { 28041, true }, - { 28054, true }, - { 28067, true }, - { 28084, true }, + { 27710, true }, + { 27725, true }, + { 27733, true }, + { 27746, true }, + { 27754, true }, + { 27764, true }, + { 27782, true }, + { 27800, true }, + { 27811, true }, + { 27824, true }, + { 27837, true }, + { 27851, true }, + { 27860, true }, + { 27875, true }, + { 27904, true }, + { 27921, true }, + { 27939, true }, + { 27953, true }, + { 27964, true }, + { 27991, true }, + { 28011, true }, + { 28028, true }, + { 28042, true }, + { 28064, true }, + { 28089, true }, { 28102, true }, - { 28117, true }, + { 28115, true }, { 28132, true }, - { 28143, true }, - { 28153, true }, - { 28174, true }, - { 28184, false }, - { 28203, true }, - { 28215, true }, - { 28244, true }, - { 28262, true }, - { 28280, true }, - { 28298, true }, - { 28319, true }, - { 28333, true }, - { 28347, true }, - { 28355, true }, - { 28365, true }, - { 28378, true }, - { 28390, true }, - { 28402, true }, - { 28418, true }, - { 28432, true }, - { 28454, true }, - { 28473, true }, - { 28486, true }, - { 28505, true }, - { 28520, true }, - { 28533, true }, - { 28551, true }, - { 28564, false }, - { 28574, true }, - { 28596, true }, - { 28610, true }, - { 28633, true }, - { 28649, true }, - { 28664, true }, - { 28680, true }, + { 28150, true }, + { 28165, true }, + { 28180, true }, + { 28191, true }, + { 28201, true }, + { 28222, true }, + { 28232, false }, + { 28251, true }, + { 28263, true }, + { 28292, true }, + { 28310, true }, + { 28328, true }, + { 28346, true }, + { 28367, true }, + { 28381, true }, + { 28395, true }, + { 28403, true }, + { 28413, true }, + { 28426, true }, + { 28438, true }, + { 28450, true }, + { 28466, true }, + { 28480, true }, + { 28502, true }, + { 28521, true }, + { 28534, true }, + { 28553, true }, + { 28568, true }, + { 28581, true }, + { 28599, true }, + { 28612, false }, + { 28622, true }, + { 28644, true }, + { 28658, true }, + { 28681, true }, { 28697, true }, - { 28708, false }, - { 28716, true }, - { 28732, true }, - { 28752, true }, - { 28766, true }, - { 28781, true }, - { 28789, true }, - { 28804, true }, - { 28817, true }, + { 28712, true }, + { 28728, true }, + { 28745, true }, + { 28756, false }, + { 28764, true }, + { 28780, true }, + { 28800, true }, + { 28814, true }, { 28829, true }, - { 28842, true }, - { 28855, false }, + { 28837, true }, + { 28852, true }, + { 28865, true }, { 28877, true }, - { 28901, true }, - { 28924, true }, - { 28942, true }, - { 28957, true }, - { 28984, true }, - { 29010, true }, - { 29037, true }, - { 29053, true }, - { 29071, true }, - { 29100, true }, - { 29116, true }, - { 29132, true }, - { 29144, true }, - { 29157, true }, - { 29168, true }, - { 29186, true }, - { 29199, true }, - { 29208, true }, - { 29217, true }, + { 28890, true }, + { 28903, false }, + { 28925, true }, + { 28949, true }, + { 28972, true }, + { 28990, true }, + { 29005, true }, + { 29032, true }, + { 29058, true }, + { 29085, true }, + { 29101, true }, + { 29119, true }, + { 29148, true }, + { 29164, true }, + { 29180, true }, + { 29192, true }, + { 29205, true }, + { 29216, true }, { 29234, true }, { 29247, true }, { 29256, true }, - { 29273, true }, - { 29281, true }, - { 29290, true }, - { 29299, false }, - { 29310, true }, - { 29334, true }, - { 29344, true }, - { 29354, true }, - { 29363, true }, - { 29376, true }, - { 29389, true }, - { 29401, true }, - { 29415, true }, - { 29429, true }, - { 29447, true }, - { 29462, true }, - { 29476, true }, - { 29488, true }, - { 29504, true }, - { 29517, true }, - { 29532, true }, - { 29544, true }, - { 29559, true }, - { 29573, true }, - { 29588, true }, - { 29603, true }, - { 29618, true }, - { 29627, true }, + { 29265, true }, + { 29282, true }, + { 29295, true }, + { 29304, true }, + { 29321, true }, + { 29329, true }, + { 29338, true }, + { 29347, false }, + { 29358, true }, + { 29382, true }, + { 29392, true }, + { 29402, true }, + { 29411, true }, + { 29424, true }, + { 29437, true }, + { 29449, true }, + { 29463, true }, + { 29477, true }, + { 29495, true }, + { 29510, true }, + { 29524, true }, + { 29536, true }, + { 29552, true }, + { 29565, true }, + { 29580, true }, + { 29592, true }, + { 29607, true }, + { 29621, true }, { 29636, true }, - { 29650, true }, - { 29659, true }, - { 29673, true }, - { 29683, true }, - { 29696, true }, - { 29706, true }, - { 29716, true }, + { 29651, true }, + { 29666, true }, + { 29675, true }, + { 29684, true }, + { 29698, true }, + { 29707, true }, + { 29721, true }, { 29731, true }, - { 29746, true }, - { 29760, true }, - { 29775, true }, + { 29744, true }, + { 29754, true }, + { 29764, true }, + { 29779, true }, { 29794, true }, - { 29810, true }, - { 29824, true }, - { 29840, true }, - { 29851, true }, - { 29865, true }, - { 29875, true }, - { 29886, true }, - { 29902, true }, - { 29914, true }, - { 29930, true }, - { 29944, true }, - { 29949, true }, - { 29960, true }, - { 29968, true }, - { 29976, true }, - { 29983, true }, - { 29989, true }, - { 29999, true }, + { 29808, true }, + { 29823, true }, + { 29842, true }, + { 29858, true }, + { 29872, true }, + { 29888, true }, + { 29899, true }, + { 29913, true }, + { 29923, true }, + { 29934, true }, + { 29950, true }, + { 29962, true }, + { 29978, true }, + { 29992, true }, + { 29997, true }, { 30008, true }, - { 30018, true }, + { 30016, true }, + { 30024, true }, + { 30031, true }, + { 30037, true }, { 30047, true }, - { 30062, false }, - { 30082, true }, - { 30092, true }, - { 30105, true }, - { 30123, true }, - { 30136, true }, - { 30156, true }, - { 30172, true }, + { 30056, true }, + { 30066, true }, + { 30095, true }, + { 30110, false }, + { 30130, true }, + { 30140, true }, + { 30153, true }, + { 30171, true }, { 30184, true }, - { 30196, true }, - { 30209, true }, + { 30204, true }, { 30220, true }, - { 30231, true }, - { 30245, true }, - { 30263, true }, - { 30276, true }, - { 30289, true }, - { 30305, true }, - { 30325, true }, - { 30345, true }, + { 30232, true }, + { 30244, true }, + { 30257, true }, + { 30268, true }, + { 30279, true }, + { 30293, true }, + { 30311, true }, + { 30324, true }, + { 30337, true }, { 30353, true }, - { 30364, false }, - { 30374, true }, - { 30386, true }, - { 30395, true }, - { 30409, true }, - { 30428, true }, - { 30436, true }, - { 30460, true }, - { 30479, true }, - { 30493, false }, - { 30509, true }, - { 30520, true }, - { 30532, false }, - { 30547, true }, - { 30559, true }, - { 30578, true }, - { 30590, true }, - { 30604, false }, - { 30616, true }, - { 30628, true }, - { 30639, true }, - { 30653, true }, - { 30666, true }, - { 30678, true }, - { 30691, true }, - { 30711, true }, - { 30721, true }, - { 30740, true }, - { 30752, true }, - { 30763, true }, - { 30775, true }, - { 30792, true }, - { 30815, true }, - { 30838, true }, - { 30849, true }, - { 30861, true }, - { 30876, true }, - { 30887, true }, - { 30903, true }, - { 30919, true }, - { 30937, false }, - { 30960, true }, - { 30980, true }, - { 30994, true }, - { 31009, true }, - { 31032, true }, - { 31051, true }, - { 31066, true }, - { 31084, true }, - { 31101, true }, - { 31127, true }, - { 31146, true }, - { 31162, true }, - { 31176, true }, - { 31197, true }, - { 31213, true }, - { 31238, true }, - { 31252, true }, - { 31270, true }, - { 31279, true }, - { 31291, false }, - { 31302, true }, - { 31315, true }, - { 31327, true }, - { 31350, true }, - { 31362, true }, - { 31377, true }, - { 31390, true }, - { 31404, true }, - { 31414, true }, - { 31427, true }, - { 31435, true }, - { 31442, true }, - { 31467, true }, - { 31493, true }, - { 31505, true }, - { 31525, true }, - { 31537, true }, - { 31552, true }, - { 31578, true }, - { 31600, true }, - { 31614, true }, - { 31626, true }, - { 31639, true }, - { 31647, true }, - { 31661, true }, - { 31685, true }, - { 31699, true }, - { 31723, true }, - { 31734, true }, - { 31751, true }, - { 31760, true }, - { 31775, true }, - { 31797, true }, - { 31820, true }, - { 31844, true }, - { 31867, true }, - { 31880, true }, - { 31898, false }, - { 31929, false }, - { 31944, true }, - { 31956, true }, - { 31969, true }, - { 31989, true }, - { 32004, true }, - { 32020, true }, - { 32031, true }, - { 32047, true }, - { 32058, true }, - { 32072, true }, - { 32082, true }, - { 32091, false }, - { 32104, true }, - { 32121, true }, - { 32140, true }, - { 32154, true }, - { 32168, true }, - { 32180, true }, - { 32199, true }, - { 32212, true }, - { 32229, true }, - { 32238, true }, - { 32258, true }, - { 32280, true }, - { 32293, true }, + { 30373, true }, + { 30393, true }, + { 30401, true }, + { 30412, false }, + { 30422, true }, + { 30434, true }, + { 30443, true }, + { 30457, true }, + { 30476, true }, + { 30484, true }, + { 30508, true }, + { 30527, true }, + { 30541, false }, + { 30557, true }, + { 30568, true }, + { 30580, false }, + { 30595, true }, + { 30607, true }, + { 30626, false }, + { 30634, true }, + { 30646, true }, + { 30660, false }, + { 30672, true }, + { 30684, true }, + { 30695, true }, + { 30709, true }, + { 30722, true }, + { 30734, true }, + { 30747, true }, + { 30767, true }, + { 30777, true }, + { 30796, true }, + { 30808, true }, + { 30819, true }, + { 30831, true }, + { 30848, true }, + { 30871, true }, + { 30894, true }, + { 30905, true }, + { 30917, true }, + { 30932, true }, + { 30943, true }, + { 30959, true }, + { 30975, true }, + { 30993, false }, + { 31016, true }, + { 31036, true }, + { 31050, true }, + { 31065, true }, + { 31088, true }, + { 31107, true }, + { 31122, true }, + { 31140, true }, + { 31157, true }, + { 31183, true }, + { 31202, true }, + { 31218, true }, + { 31232, true }, + { 31253, true }, + { 31269, true }, + { 31294, true }, + { 31308, true }, + { 31326, true }, + { 31335, true }, + { 31347, false }, + { 31358, true }, + { 31371, true }, + { 31383, true }, + { 31406, true }, + { 31418, true }, + { 31433, true }, + { 31446, true }, + { 31460, true }, + { 31470, true }, + { 31483, true }, + { 31491, true }, + { 31498, true }, + { 31523, true }, + { 31549, true }, + { 31561, true }, + { 31581, true }, + { 31593, true }, + { 31608, true }, + { 31634, true }, + { 31656, true }, + { 31670, true }, + { 31682, true }, + { 31695, true }, + { 31703, true }, + { 31717, true }, + { 31741, true }, + { 31755, true }, + { 31779, true }, + { 31790, true }, + { 31807, true }, + { 31816, true }, + { 31831, true }, + { 31853, true }, + { 31876, true }, + { 31900, true }, + { 31923, true }, + { 31936, true }, + { 31954, false }, + { 31985, false }, + { 32000, true }, + { 32012, true }, + { 32025, true }, + { 32045, true }, + { 32060, true }, + { 32076, true }, + { 32087, true }, + { 32103, true }, + { 32114, true }, + { 32128, true }, + { 32138, true }, + { 32147, false }, + { 32160, true }, + { 32177, true }, + { 32196, true }, + { 32210, true }, + { 32224, true }, + { 32236, true }, + { 32255, true }, + { 32268, true }, + { 32285, true }, + { 32294, true }, { 32314, true }, - { 32325, true }, - { 32339, true }, - { 32355, true }, - { 32366, true }, - { 32382, true }, - { 32399, true }, - { 32408, true }, - { 32423, true }, - { 32437, true }, - { 32458, true }, - { 32475, true }, - { 32491, true }, - { 32504, true }, - { 32517, true }, - { 32529, true }, - { 32537, true }, - { 32550, true }, - { 32563, true }, - { 32575, true }, - { 32587, true }, + { 32336, true }, + { 32349, true }, + { 32370, true }, + { 32381, true }, + { 32395, true }, + { 32411, true }, + { 32422, true }, + { 32438, true }, + { 32455, true }, + { 32464, true }, + { 32479, true }, + { 32493, true }, + { 32514, true }, + { 32531, true }, + { 32547, true }, + { 32560, true }, + { 32573, true }, + { 32585, true }, + { 32593, true }, { 32606, true }, - { 32621, true }, - { 32637, true }, - { 32658, true }, - { 32676, true }, - { 32687, true }, - { 32695, false }, - { 32718, true }, - { 32735, true }, - { 32752, true }, - { 32765, true }, - { 32782, true }, - { 32793, true }, - { 32805, false }, - { 32815, true }, - { 32831, false }, - { 32842, true }, - { 32857, true }, - { 32866, true }, - { 32879, true }, + { 32619, true }, + { 32631, true }, + { 32643, true }, + { 32662, true }, + { 32677, true }, + { 32693, true }, + { 32714, true }, + { 32732, true }, + { 32743, true }, + { 32751, false }, + { 32774, true }, + { 32791, true }, + { 32808, true }, + { 32821, true }, + { 32838, true }, + { 32849, true }, + { 32861, false }, + { 32871, true }, + { 32887, false }, + { 32898, true }, { 32913, true }, - { 32931, true }, - { 32949, true }, - { 32960, true }, - { 32970, true }, - { 32981, true }, - { 32993, true }, - { 33019, true }, - { 33036, true }, - { 33045, true }, - { 33061, true }, - { 33071, true }, - { 33079, false }, - { 33087, true }, - { 33097, true }, - { 33110, true }, - { 33120, true }, - { 33135, true }, - { 33149, true }, - { 33163, true }, - { 33173, true }, - { 33181, true }, - { 33195, true }, - { 33216, true }, - { 33230, true }, - { 33246, true }, - { 33253, true }, - { 33263, true }, - { 33278, true }, - { 33289, false }, + { 32922, true }, + { 32935, true }, + { 32969, true }, + { 32987, true }, + { 33005, true }, + { 33016, true }, + { 33026, true }, + { 33037, true }, + { 33049, true }, + { 33075, true }, + { 33092, true }, + { 33101, true }, + { 33117, true }, + { 33127, true }, + { 33135, false }, + { 33143, true }, + { 33153, true }, + { 33166, true }, + { 33176, true }, + { 33191, true }, + { 33205, true }, + { 33219, true }, + { 33229, true }, + { 33237, true }, + { 33251, true }, + { 33272, true }, + { 33286, true }, { 33302, true }, - { 33318, true }, - { 33336, true }, - { 33352, true }, - { 33363, true }, - { 33381, true }, - { 33403, false }, - { 33420, true }, - { 33432, true }, - { 33448, true }, - { 33464, true }, - { 33480, true }, - { 33499, true }, - { 33516, true }, - { 33531, true }, - { 33550, true }, - { 33565, true }, - { 33580, true }, - { 33601, true }, - { 33619, true }, - { 33632, true }, - { 33645, true }, - { 33659, true }, - { 33678, true }, - { 33696, true }, - { 33711, true }, - { 33725, true }, - { 33738, true }, - { 33749, true }, - { 33759, true }, - { 33776, true }, - { 33792, true }, - { 33808, true }, - { 33823, true }, - { 33833, true }, + { 33309, true }, + { 33319, true }, + { 33334, true }, + { 33345, false }, + { 33358, true }, + { 33374, true }, + { 33392, true }, + { 33408, true }, + { 33419, true }, + { 33437, true }, + { 33459, false }, + { 33476, true }, + { 33488, true }, + { 33504, true }, + { 33520, true }, + { 33536, true }, + { 33555, true }, + { 33572, true }, + { 33587, true }, + { 33606, true }, + { 33621, true }, + { 33636, true }, + { 33657, true }, + { 33675, true }, + { 33688, true }, + { 33701, true }, + { 33715, true }, + { 33734, true }, + { 33752, true }, + { 33767, true }, + { 33781, true }, + { 33794, true }, + { 33805, true }, + { 33815, true }, + { 33832, true }, { 33848, true }, - { 33860, true }, - { 33871, true }, - { 33883, false }, - { 33891, true }, - { 33912, true }, - { 33920, true }, - { 33931, true }, - { 33944, true }, - { 33952, true }, - { 33960, true }, - { 33978, true }, - { 33992, true }, - { 34006, true }, - { 34014, true }, - { 34022, true }, - { 34032, true }, - { 34046, true }, - { 34066, true }, - { 34074, true }, - { 34083, false }, - { 34103, true }, - { 34121, true }, - { 34132, true }, - { 34150, true }, - { 34168, true }, - { 34180, true }, - { 34192, true }, - { 34208, true }, + { 33864, true }, + { 33879, true }, + { 33889, true }, + { 33904, true }, + { 33916, true }, + { 33927, true }, + { 33939, false }, + { 33947, true }, + { 33968, true }, + { 33976, true }, + { 33987, true }, + { 34000, true }, + { 34008, true }, + { 34016, true }, + { 34034, true }, + { 34048, true }, + { 34062, true }, + { 34070, true }, + { 34078, true }, + { 34088, true }, + { 34102, true }, + { 34122, true }, + { 34130, true }, + { 34139, false }, + { 34159, true }, + { 34177, true }, + { 34188, true }, + { 34206, true }, { 34224, true }, - { 34238, true }, - { 34255, true }, + { 34236, true }, + { 34252, true }, { 34268, true }, - { 34285, true }, - { 34298, true }, + { 34282, true }, + { 34299, true }, { 34312, true }, - { 34325, true }, - { 34339, true }, - { 34358, true }, - { 34368, true }, - { 34388, true }, - { 34397, true }, - { 34417, true }, - { 34434, true }, - { 34454, true }, - { 34468, true }, - { 34488, true }, - { 34506, true }, - { 34541, true }, - { 34555, true }, - { 34573, true }, - { 34583, true }, - { 34613, true }, - { 34628, true }, - { 34641, true }, - { 34654, true }, - { 34668, true }, - { 34683, true }, - { 34703, true }, - { 34720, true }, - { 34731, true }, - { 34741, false }, - { 34752, true }, - { 34760, true }, - { 34781, true }, - { 34802, true }, - { 34823, false }, - { 34839, true }, - { 34852, true }, - { 34867, true }, - { 34879, false }, - { 34900, true }, - { 34920, true }, - { 34942, true }, - { 34956, true }, - { 34974, true }, - { 34994, true }, - { 35007, true }, - { 35023, true }, - { 35037, true }, - { 35053, true }, - { 35071, true }, - { 35082, true }, - { 35093, true }, - { 35106, true }, - { 35119, true }, - { 35133, true }, - { 35148, true }, - { 35167, true }, - { 35183, true }, - { 35195, true }, - { 35205, true }, - { 35216, false }, - { 35238, true }, - { 35246, true }, - { 35261, true }, - { 35278, true }, - { 35292, true }, - { 35309, true }, - { 35324, true }, - { 35342, true }, - { 35366, true }, - { 35382, true }, - { 35398, true }, - { 35413, true }, - { 35434, true }, - { 35443, true }, - { 35458, true }, - { 35471, false }, - { 35481, true }, - { 35500, true }, - { 35514, true }, - { 35534, true }, - { 35549, true }, + { 34329, true }, + { 34342, true }, + { 34356, true }, + { 34369, true }, + { 34383, true }, + { 34402, true }, + { 34412, true }, + { 34432, true }, + { 34441, true }, + { 34461, true }, + { 34478, true }, + { 34498, true }, + { 34512, true }, + { 34532, true }, + { 34550, true }, + { 34585, true }, + { 34599, true }, + { 34617, true }, + { 34627, true }, + { 34657, true }, + { 34672, true }, + { 34685, true }, + { 34698, true }, + { 34712, true }, + { 34727, true }, + { 34747, true }, + { 34764, true }, + { 34775, true }, + { 34785, false }, + { 34796, true }, + { 34804, true }, + { 34825, true }, + { 34846, true }, + { 34867, false }, + { 34883, true }, + { 34896, true }, + { 34911, true }, + { 34923, false }, + { 34944, true }, + { 34964, true }, + { 34986, true }, + { 35000, true }, + { 35018, true }, + { 35038, true }, + { 35051, true }, + { 35067, true }, + { 35081, true }, + { 35097, true }, + { 35115, true }, + { 35126, true }, + { 35137, true }, + { 35150, true }, + { 35163, true }, + { 35177, true }, + { 35192, true }, + { 35211, true }, + { 35227, true }, + { 35239, true }, + { 35249, true }, + { 35260, false }, + { 35282, true }, + { 35290, true }, + { 35305, true }, + { 35322, true }, + { 35336, true }, + { 35353, true }, + { 35368, true }, + { 35386, true }, + { 35410, true }, + { 35426, true }, + { 35442, true }, + { 35457, true }, + { 35478, true }, + { 35487, true }, + { 35502, true }, + { 35515, false }, + { 35525, true }, + { 35544, true }, { 35558, true }, - { 35576, false }, - { 35598, true }, - { 35617, true }, - { 35629, false }, - { 35645, false }, - { 35659, true }, - { 35675, true }, - { 35694, true }, - { 35706, true }, - { 35721, true }, - { 35739, true }, - { 35754, true }, - { 35766, true }, - { 35784, true }, - { 35804, true }, - { 35826, true }, - { 35844, true }, - { 35861, true }, - { 35876, true }, - { 35891, true }, - { 35908, false }, - { 35924, true }, - { 35938, true }, - { 35952, true }, - { 35971, true }, - { 35988, true }, - { 36007, true }, - { 36022, true }, - { 36049, true }, - { 36069, true }, - { 36091, true }, - { 36112, true }, + { 35578, true }, + { 35593, true }, + { 35602, true }, + { 35620, false }, + { 35642, true }, + { 35661, true }, + { 35673, false }, + { 35689, false }, + { 35703, true }, + { 35719, true }, + { 35738, true }, + { 35750, true }, + { 35765, true }, + { 35783, true }, + { 35798, true }, + { 35810, true }, + { 35828, true }, + { 35848, true }, + { 35870, true }, + { 35888, true }, + { 35905, true }, + { 35920, true }, + { 35935, true }, + { 35952, false }, + { 35968, true }, + { 35982, true }, + { 35996, true }, + { 36015, true }, + { 36032, true }, + { 36051, true }, + { 36066, true }, + { 36093, true }, + { 36113, true }, { 36135, true }, - { 36155, true }, - { 36173, true }, - { 36191, true }, - { 36210, true }, - { 36232, true }, - { 36251, true }, - { 36271, true }, - { 36294, true }, - { 36317, true }, - { 36331, true }, - { 36348, true }, - { 36362, true }, - { 36376, true }, - { 36389, true }, - { 36426, false }, - { 36437, true }, - { 36455, true }, - { 36475, true }, - { 36498, true }, - { 36523, true }, - { 36554, true }, - { 36568, true }, - { 36579, true }, - { 36591, true }, - { 36600, true }, + { 36156, true }, + { 36179, true }, + { 36199, true }, + { 36217, true }, + { 36235, true }, + { 36254, true }, + { 36276, true }, + { 36295, true }, + { 36315, true }, + { 36338, true }, + { 36361, true }, + { 36375, true }, + { 36392, true }, + { 36406, true }, + { 36420, true }, + { 36433, true }, + { 36470, false }, + { 36481, true }, + { 36499, true }, + { 36519, true }, + { 36542, true }, + { 36567, true }, + { 36598, true }, { 36612, true }, - { 36629, true }, - { 36639, true }, - { 36657, false }, - { 36665, true }, - { 36676, true }, - { 36690, true }, + { 36623, true }, + { 36635, true }, + { 36644, true }, + { 36656, true }, + { 36673, true }, + { 36683, true }, + { 36701, false }, { 36709, true }, - { 36720, false }, - { 36738, true }, - { 36751, true }, - { 36764, true }, - { 36781, true }, + { 36720, true }, + { 36734, true }, + { 36753, true }, + { 36764, false }, + { 36782, true }, { 36795, true }, - { 36806, true }, - { 36820, true }, - { 36832, true }, - { 36847, true }, - { 36855, true }, - { 36869, true }, - { 36881, true }, - { 36893, true }, - { 36903, true }, - { 36914, true }, + { 36808, true }, + { 36825, true }, + { 36839, true }, + { 36850, true }, + { 36864, true }, + { 36876, true }, + { 36891, true }, + { 36899, true }, + { 36913, true }, { 36925, true }, - { 36939, true }, - { 36962, true }, - { 36970, true }, - { 36988, true }, - { 37003, true }, - { 37022, true }, - { 37034, true }, - { 37050, true }, - { 37060, true }, - { 37079, true }, - { 37092, true }, - { 37107, true }, - { 37115, true }, - { 37130, true }, - { 37142, true }, - { 37150, true }, - { 37156, true }, - { 37169, true }, - { 37178, true }, - { 37192, true }, - { 37206, true }, - { 37219, false }, - { 37239, true }, - { 37255, true }, - { 37266, true }, - { 37278, true }, - { 37294, true }, - { 37307, true }, - { 37327, true }, - { 37341, true }, - { 37357, true }, + { 36937, true }, + { 36947, true }, + { 36958, true }, + { 36969, true }, + { 36983, true }, + { 37006, true }, + { 37014, true }, + { 37032, true }, + { 37047, true }, + { 37066, true }, + { 37078, true }, + { 37094, true }, + { 37104, true }, + { 37123, true }, + { 37136, true }, + { 37151, true }, + { 37159, true }, + { 37174, true }, + { 37186, true }, + { 37194, true }, + { 37200, true }, + { 37213, true }, + { 37222, true }, + { 37236, true }, + { 37250, true }, + { 37263, false }, + { 37283, true }, + { 37299, true }, + { 37310, true }, + { 37322, true }, + { 37338, true }, + { 37351, true }, { 37371, true }, - { 37391, true }, - { 37405, true }, - { 37420, true }, - { 37440, true }, - { 37454, true }, - { 37467, true }, - { 37476, true }, - { 37486, true }, - { 37505, true }, - { 37521, true }, - { 37543, true }, - { 37575, true }, - { 37594, true }, - { 37610, true }, - { 37631, true }, - { 37651, true }, - { 37664, true }, - { 37684, true }, - { 37698, true }, - { 37717, true }, - { 37736, true }, - { 37750, true }, - { 37765, true }, - { 37778, true }, - { 37788, true }, - { 37801, true }, - { 37816, true }, - { 37828, true }, - { 37843, true }, - { 37866, true }, - { 37882, true }, - { 37901, true }, - { 37913, false }, - { 37934, true }, - { 37942, true }, - { 37951, true }, - { 37964, true }, + { 37385, true }, + { 37401, true }, + { 37415, true }, + { 37435, true }, + { 37449, true }, + { 37464, true }, + { 37484, true }, + { 37498, true }, + { 37511, true }, + { 37520, true }, + { 37530, true }, + { 37549, true }, + { 37565, true }, + { 37587, true }, + { 37619, true }, + { 37638, true }, + { 37654, true }, + { 37675, true }, + { 37695, true }, + { 37708, true }, + { 37728, true }, + { 37742, true }, + { 37761, true }, + { 37780, true }, + { 37794, true }, + { 37809, true }, + { 37822, true }, + { 37832, true }, + { 37845, true }, + { 37860, true }, + { 37872, true }, + { 37887, true }, + { 37910, true }, + { 37926, true }, + { 37945, true }, + { 37957, false }, { 37978, true }, - { 37987, true }, - { 37999, true }, - { 38015, true }, - { 38032, false }, - { 38042, true }, - { 38053, true }, - { 38065, true }, - { 38078, true }, + { 37986, true }, + { 37995, true }, + { 38008, true }, + { 38022, true }, + { 38031, true }, + { 38043, true }, + { 38059, true }, + { 38076, false }, + { 38086, true }, { 38097, true }, - { 38115, true }, - { 38132, true }, - { 38149, false }, + { 38109, true }, + { 38122, true }, + { 38141, true }, { 38159, true }, - { 38177, true }, - { 38196, true }, - { 38210, true }, - { 38227, true }, - { 38249, true }, - { 38261, true }, - { 38274, true }, - { 38295, true }, - { 38312, true }, - { 38334, true }, - { 38350, true }, - { 38365, true }, - { 38379, true }, - { 38405, true }, - { 38430, true }, - { 38445, true }, - { 38458, true }, - { 38470, true }, - { 38480, true }, - { 38495, true }, - { 38505, true }, + { 38176, true }, + { 38193, false }, + { 38203, true }, + { 38221, true }, + { 38240, true }, + { 38254, true }, + { 38271, true }, + { 38293, true }, + { 38305, true }, + { 38318, true }, + { 38339, true }, + { 38356, true }, + { 38378, true }, + { 38394, true }, + { 38409, true }, + { 38423, true }, + { 38449, true }, + { 38474, true }, + { 38489, true }, + { 38502, true }, { 38514, true }, - { 38528, true }, + { 38524, true }, { 38539, true }, - { 38550, true }, - { 38565, true }, - { 38580, true }, - { 38592, true }, - { 38606, true }, - { 38619, true }, - { 38630, true }, - { 38646, true }, - { 38656, true }, - { 38665, true }, - { 38677, true }, - { 38688, true }, - { 38697, true }, - { 38713, true }, + { 38549, true }, + { 38558, true }, + { 38572, true }, + { 38583, true }, + { 38594, true }, + { 38609, true }, + { 38624, true }, + { 38636, true }, + { 38650, true }, + { 38663, true }, + { 38674, true }, + { 38690, true }, + { 38700, true }, + { 38709, true }, { 38721, true }, - { 38731, true }, - { 38742, true }, - { 38753, false }, - { 38773, true }, - { 38797, true }, - { 38818, true }, - { 38826, true }, - { 38847, true }, - { 38857, true }, - { 38873, true }, - { 38887, true }, - { 38907, true }, - { 38919, false }, - { 38929, true }, - { 38959, true }, - { 38986, false }, - { 39000, true }, - { 39013, true }, - { 39032, true }, - { 39049, true }, - { 39063, false }, - { 39081, true }, - { 39089, true }, - { 39105, true }, - { 39116, true }, - { 39131, true }, - { 39150, true }, - { 39163, true }, - { 39176, true }, - { 39191, true }, - { 39211, false }, - { 39226, true }, - { 39238, true }, - { 39250, true }, - { 39262, true }, - { 39275, true }, - { 39290, true }, - { 39303, true }, - { 39316, true }, - { 39339, false }, - { 39363, true }, - { 39380, true }, - { 39393, true }, - { 39404, true }, - { 39416, true }, - { 39436, true }, - { 39448, true }, - { 39462, true }, - { 39480, true }, - { 39491, true }, - { 39510, true }, - { 39527, true }, - { 39549, true }, - { 39563, true }, - { 39582, true }, - { 39592, true }, + { 38732, true }, + { 38741, true }, + { 38757, true }, + { 38765, true }, + { 38775, true }, + { 38786, true }, + { 38797, false }, + { 38817, true }, + { 38841, true }, + { 38862, true }, + { 38870, true }, + { 38891, true }, + { 38901, true }, + { 38917, true }, + { 38931, true }, + { 38951, true }, + { 38963, false }, + { 38973, true }, + { 39003, true }, + { 39030, false }, + { 39044, true }, + { 39057, true }, + { 39076, true }, + { 39093, true }, + { 39107, false }, + { 39125, true }, + { 39133, true }, + { 39149, true }, + { 39160, true }, + { 39175, true }, + { 39194, true }, + { 39207, true }, + { 39220, true }, + { 39235, true }, + { 39255, false }, + { 39270, true }, + { 39282, true }, + { 39294, true }, + { 39306, true }, + { 39319, true }, + { 39334, true }, + { 39347, true }, + { 39360, true }, + { 39373, true }, + { 39396, true }, + { 39420, true }, + { 39437, true }, + { 39450, true }, + { 39461, true }, + { 39473, true }, + { 39493, true }, + { 39505, true }, + { 39519, true }, + { 39537, true }, + { 39548, true }, + { 39567, true }, + { 39584, true }, { 39606, true }, + { 39620, true }, { 39639, true }, - { 39660, true }, - { 39672, true }, - { 39687, true }, - { 39701, true }, - { 39712, true }, - { 39726, true }, - { 39739, true }, - { 39755, true }, - { 39768, true }, - { 39788, true }, + { 39649, true }, + { 39663, true }, + { 39696, true }, + { 39717, true }, + { 39729, true }, + { 39744, true }, + { 39758, true }, + { 39769, true }, + { 39783, true }, { 39796, true }, - { 39808, false }, - { 39820, true }, - { 39831, true }, - { 39848, true }, - { 39870, true }, - { 39883, true }, - { 39903, true }, - { 39915, true }, + { 39812, true }, + { 39825, true }, + { 39845, true }, + { 39853, true }, + { 39865, false }, + { 39877, true }, + { 39888, true }, + { 39905, true }, { 39927, true }, - { 39945, true }, - { 39959, true }, - { 39974, true }, - { 39993, true }, - { 40008, true }, - { 40022, true }, - { 40034, true }, + { 39940, true }, + { 39960, true }, + { 39972, true }, + { 39984, true }, + { 40002, true }, + { 40016, true }, + { 40031, true }, { 40050, true }, - { 40066, true }, - { 40087, true }, - { 40106, true }, - { 40133, true }, - { 40152, true }, - { 40172, true }, - { 40186, true }, - { 40203, true }, - { 40223, true }, - { 40236, true }, - { 40250, true }, - { 40271, true }, - { 40292, true }, - { 40305, true }, - { 40312, true }, - { 40324, true }, - { 40346, true }, + { 40065, true }, + { 40079, true }, + { 40091, true }, + { 40107, true }, + { 40123, true }, + { 40144, true }, + { 40163, true }, + { 40190, true }, + { 40209, true }, + { 40229, true }, + { 40243, true }, + { 40260, true }, + { 40280, true }, + { 40293, true }, + { 40307, true }, + { 40328, true }, + { 40349, true }, { 40362, true }, - { 40373, true }, - { 40389, true }, - { 40404, true }, - { 40417, true }, - { 40437, true }, - { 40451, true }, - { 40466, true }, - { 40476, true }, - { 40490, true }, - { 40502, true }, - { 40514, true }, - { 40532, true }, - { 40551, true }, - { 40566, true }, - { 40587, false }, + { 40369, true }, + { 40381, true }, + { 40403, true }, + { 40419, true }, + { 40430, true }, + { 40446, true }, + { 40461, true }, + { 40474, true }, + { 40494, true }, + { 40508, true }, + { 40523, true }, + { 40533, true }, + { 40547, true }, + { 40559, true }, + { 40571, true }, + { 40589, true }, { 40608, true }, - { 40628, true }, - { 40648, true }, - { 40680, true }, - { 40690, true }, - { 40703, true }, - { 40722, true }, - { 40739, false }, - { 40763, false }, - { 40785, true }, - { 40809, true }, - { 40839, true }, - { 40863, true }, - { 40879, true }, + { 40623, true }, + { 40644, false }, + { 40665, true }, + { 40685, true }, + { 40705, true }, + { 40737, true }, + { 40747, true }, + { 40760, true }, + { 40779, true }, + { 40796, false }, + { 40820, false }, + { 40842, true }, + { 40866, true }, { 40896, true }, - { 40908, true }, - { 40926, true }, - { 40941, true }, - { 40958, true }, - { 40972, true }, - { 40994, true }, - { 41019, true }, - { 41032, true }, - { 41047, true }, - { 41062, true }, - { 41084, true }, - { 41100, false }, - { 41125, true }, - { 41149, true }, - { 41170, true }, - { 41184, true }, - { 41199, true }, - { 41215, true }, - { 41234, true }, - { 41251, true }, - { 41269, true }, - { 41293, false }, - { 41315, true }, - { 41328, true }, - { 41339, true }, - { 41351, true }, - { 41365, true }, - { 41383, true }, - { 41402, true }, - { 41417, true }, - { 41445, true }, - { 41460, true }, - { 41483, true }, - { 41496, true }, - { 41507, true }, - { 41520, true }, - { 41538, true }, - { 41560, true }, - { 41585, true }, - { 41608, true }, - { 41622, true }, - { 41635, true }, - { 41651, true }, - { 41664, true }, - { 41682, true }, - { 41692, true }, - { 41705, true }, - { 41732, true }, - { 41750, true }, + { 40920, true }, + { 40936, true }, + { 40953, true }, + { 40965, true }, + { 40980, true }, + { 40997, true }, + { 41011, true }, + { 41033, true }, + { 41058, true }, + { 41071, true }, + { 41086, true }, + { 41101, true }, + { 41123, true }, + { 41139, false }, + { 41164, true }, + { 41188, true }, + { 41209, true }, + { 41223, true }, + { 41238, true }, + { 41254, true }, + { 41273, true }, + { 41290, true }, + { 41308, true }, + { 41332, false }, + { 41354, true }, + { 41367, true }, + { 41378, true }, + { 41390, true }, + { 41404, true }, + { 41422, true }, + { 41441, true }, + { 41456, true }, + { 41484, true }, + { 41499, true }, + { 41522, true }, + { 41535, true }, + { 41546, true }, + { 41559, true }, + { 41577, true }, + { 41599, true }, + { 41624, true }, + { 41647, true }, + { 41661, true }, + { 41674, true }, + { 41690, true }, + { 41703, true }, + { 41721, true }, + { 41731, true }, + { 41744, true }, { 41771, true }, - { 41786, true }, + { 41789, true }, { 41810, true }, - { 41828, true }, - { 41853, true }, - { 41868, false }, - { 41891, true }, - { 41900, true }, - { 41921, true }, - { 41938, true }, - { 41949, true }, - { 41962, true }, - { 41975, false }, - { 42014, true }, - { 42025, true }, - { 42038, true }, - { 42050, true }, - { 42066, true }, - { 42080, false }, - { 42095, false }, - { 42111, true }, - { 42130, true }, - { 42141, true }, - { 42154, true }, - { 42166, true }, - { 42189, true }, - { 42201, true }, - { 42210, true }, - { 42220, true }, - { 42234, true }, - { 42249, true }, - { 42263, true }, - { 42279, true }, - { 42295, true }, - { 42312, true }, - { 42324, true }, + { 41825, true }, + { 41849, true }, + { 41867, true }, + { 41892, true }, + { 41907, false }, + { 41930, true }, + { 41939, true }, + { 41960, true }, + { 41977, true }, + { 41988, true }, + { 42001, false }, + { 42040, true }, + { 42051, true }, + { 42064, true }, + { 42076, true }, + { 42092, true }, + { 42106, false }, + { 42121, false }, + { 42137, true }, + { 42156, true }, + { 42167, true }, + { 42180, true }, + { 42192, true }, + { 42215, true }, + { 42227, true }, + { 42236, true }, + { 42246, true }, + { 42260, true }, + { 42275, true }, + { 42289, true }, + { 42305, true }, + { 42321, true }, { 42338, true }, { 42350, true }, - { 42373, true }, - { 42398, true }, - { 42415, true }, + { 42364, true }, + { 42376, true }, + { 42399, true }, { 42424, true }, { 42441, true }, - { 42453, true }, - { 42468, true }, - { 42485, true }, - { 42504, true }, - { 42517, false }, - { 42535, true }, - { 42547, true }, - { 42566, true }, - { 42578, true }, - { 42608, true }, - { 42622, true }, - { 42646, true }, - { 42669, true }, - { 42683, true }, - { 42696, true }, - { 42708, true }, - { 42730, true }, - { 42750, true }, - { 42775, true }, - { 42787, true }, - { 42810, true }, - { 42829, true }, - { 42840, true }, - { 42854, true }, + { 42450, true }, + { 42467, true }, + { 42479, true }, + { 42494, true }, + { 42511, true }, + { 42530, true }, + { 42543, false }, + { 42561, true }, + { 42573, true }, + { 42592, true }, + { 42604, true }, + { 42634, true }, + { 42648, true }, + { 42672, true }, + { 42695, true }, + { 42709, true }, + { 42722, true }, + { 42734, true }, + { 42756, true }, + { 42776, true }, + { 42801, true }, + { 42813, true }, + { 42836, true }, + { 42855, true }, { 42866, true }, - { 42882, true }, - { 42900, true }, - { 42918, true }, - { 42936, true }, - { 42952, true }, - { 42969, true }, - { 42998, true }, - { 43011, true }, - { 43022, true }, - { 43040, true }, - { 43058, true }, - { 43081, true }, - { 43098, false }, - { 43113, true }, - { 43125, true }, - { 43137, true }, - { 43150, true }, - { 43159, true }, - { 43174, true }, - { 43193, true }, - { 43207, true }, + { 42880, true }, + { 42892, true }, + { 42908, true }, + { 42926, true }, + { 42944, true }, + { 42962, true }, + { 42978, true }, + { 42995, true }, + { 43024, true }, + { 43037, true }, + { 43048, true }, + { 43066, true }, + { 43084, true }, + { 43107, true }, + { 43124, false }, + { 43139, true }, + { 43151, true }, + { 43163, true }, + { 43176, true }, + { 43185, true }, + { 43200, true }, { 43219, true }, - { 43233, false }, - { 43250, true }, - { 43261, true }, - { 43274, true }, - { 43291, true }, - { 43310, false }, - { 43323, true }, - { 43341, true }, - { 43367, true }, - { 43384, true }, - { 43403, true }, - { 43418, true }, - { 43433, true }, - { 43447, true }, - { 43464, true }, - { 43480, true }, - { 43499, true }, + { 43233, true }, + { 43245, true }, + { 43257, true }, + { 43271, false }, + { 43288, true }, + { 43299, true }, + { 43312, true }, + { 43329, true }, + { 43348, false }, + { 43361, true }, + { 43379, true }, + { 43405, true }, + { 43422, true }, + { 43441, true }, + { 43456, true }, + { 43471, true }, + { 43485, true }, + { 43502, true }, { 43518, true }, - { 43538, true }, - { 43554, true }, - { 43570, true }, - { 43584, true }, - { 43594, true }, - { 43602, true }, - { 43628, true }, - { 43645, true }, + { 43537, true }, + { 43556, true }, + { 43576, true }, + { 43592, true }, + { 43608, true }, + { 43622, true }, + { 43632, true }, + { 43640, true }, { 43666, true }, - { 43684, true }, - { 43703, true }, - { 43717, true }, - { 43736, true }, - { 43748, true }, - { 43764, false }, - { 43783, true }, - { 43797, true }, - { 43806, true }, - { 43823, true }, - { 43837, true }, - { 43852, true }, - { 43867, true }, - { 43884, true }, - { 43895, true }, - { 43913, true }, - { 43934, true }, - { 43945, true }, - { 43954, true }, - { 43973, true }, - { 43986, true }, - { 44001, true }, - { 44023, true }, - { 44037, false }, - { 44051, true }, - { 44067, true }, - { 44079, true }, - { 44096, true }, - { 44108, true }, - { 44123, true }, - { 44135, true }, - { 44158, true }, - { 44170, true }, - { 44193, true }, - { 44212, true }, - { 44228, true }, - { 44243, true }, - { 44253, true }, - { 44263, true }, - { 44270, true }, + { 43683, true }, + { 43704, true }, + { 43722, true }, + { 43741, true }, + { 43755, true }, + { 43774, true }, + { 43786, true }, + { 43802, false }, + { 43821, true }, + { 43835, true }, + { 43844, true }, + { 43861, true }, + { 43875, true }, + { 43890, true }, + { 43905, true }, + { 43922, true }, + { 43933, true }, + { 43951, true }, + { 43972, true }, + { 43983, true }, + { 43992, true }, + { 44011, true }, + { 44024, true }, + { 44039, true }, + { 44061, true }, + { 44075, false }, + { 44089, true }, + { 44105, true }, + { 44117, true }, + { 44134, true }, + { 44146, true }, + { 44161, true }, + { 44173, true }, + { 44196, true }, + { 44208, true }, + { 44231, true }, + { 44250, true }, + { 44266, true }, { 44281, true }, - { 44298, true }, - { 44312, true }, - { 44333, true }, - { 44342, true }, + { 44291, true }, + { 44301, true }, + { 44308, true }, + { 44319, true }, + { 44336, true }, { 44350, true }, - { 44364, false }, - { 44375, true }, - { 44391, false }, - { 44401, false }, - { 44417, true }, - { 44430, true }, - { 44444, true }, - { 44459, true }, - { 44475, true }, + { 44371, true }, + { 44380, true }, + { 44388, true }, + { 44402, false }, + { 44413, true }, + { 44429, false }, + { 44439, false }, + { 44455, true }, + { 44468, true }, + { 44482, true }, { 44497, true }, - { 44511, true }, - { 44525, true }, - { 44540, true }, - { 44555, true }, - { 44580, true }, - { 44600, true }, - { 44616, true }, - { 44629, true }, - { 44643, true }, - { 44656, true }, - { 44686, true }, - { 44698, true }, - { 44713, true }, - { 44723, true }, - { 44739, true }, - { 44747, false }, - { 44759, true }, - { 44770, true }, - { 44779, true }, - { 44789, true }, - { 44804, true }, - { 44821, true }, - { 44837, true }, - { 44853, true }, - { 44866, true }, - { 44883, true }, - { 44892, true }, - { 44900, true }, - { 44908, true }, - { 44919, true }, - { 44928, true }, - { 44942, true }, - { 44955, true }, - { 44963, true }, - { 44981, true }, - { 44990, true }, - { 44999, true }, - { 45007, true }, - { 45022, true }, - { 45030, true }, - { 45050, true }, - { 45073, true }, - { 45086, true }, - { 45100, true }, - { 45119, true }, + { 44513, true }, + { 44535, true }, + { 44549, true }, + { 44563, true }, + { 44578, true }, + { 44593, true }, + { 44618, true }, + { 44638, true }, + { 44654, true }, + { 44667, true }, + { 44681, true }, + { 44694, true }, + { 44724, true }, + { 44736, true }, + { 44751, true }, + { 44761, true }, + { 44777, true }, + { 44785, false }, + { 44797, true }, + { 44808, true }, + { 44817, true }, + { 44827, true }, + { 44842, true }, + { 44859, true }, + { 44875, true }, + { 44891, true }, + { 44904, true }, + { 44921, true }, + { 44930, true }, + { 44938, true }, + { 44946, true }, + { 44957, true }, + { 44966, true }, + { 44980, true }, + { 44993, true }, + { 45001, true }, + { 45019, true }, + { 45028, true }, + { 45037, true }, + { 45045, true }, + { 45060, true }, + { 45068, true }, + { 45088, true }, + { 45111, true }, + { 45124, true }, { 45138, true }, - { 45152, true }, - { 45161, true }, - { 45181, true }, - { 45204, true }, - { 45214, true }, - { 45224, true }, + { 45157, true }, + { 45176, true }, + { 45190, true }, + { 45199, true }, + { 45219, true }, { 45242, true }, + { 45252, true }, { 45262, true }, - { 45275, true }, - { 45289, true }, - { 45305, true }, - { 45315, true }, - { 45326, true }, - { 45336, true }, + { 45280, true }, + { 45300, true }, + { 45313, true }, + { 45327, true }, + { 45343, true }, { 45353, true }, - { 45369, true }, - { 45376, true }, - { 45385, true }, - { 45404, true }, - { 45417, true }, - { 45430, true }, - { 45441, true }, - { 45448, true }, - { 45459, true }, - { 45470, true }, - { 45478, true }, - { 45492, true }, - { 45512, true }, - { 45533, true }, - { 45548, true }, - { 45570, true }, - { 45582, false }, - { 45604, true }, - { 45623, true }, - { 45639, true }, - { 45657, true }, - { 45672, true }, - { 45689, true }, - { 45704, true }, - { 45723, true }, - { 45735, true }, - { 45755, true }, - { 45772, true }, - { 45781, true }, + { 45364, true }, + { 45374, true }, + { 45391, true }, + { 45407, true }, + { 45414, true }, + { 45423, true }, + { 45442, true }, + { 45455, true }, + { 45468, true }, + { 45479, true }, + { 45486, true }, + { 45497, true }, + { 45508, true }, + { 45516, true }, + { 45530, true }, + { 45550, true }, + { 45571, true }, + { 45586, true }, + { 45608, true }, + { 45620, false }, + { 45642, true }, + { 45661, true }, + { 45677, true }, + { 45695, true }, + { 45710, true }, + { 45727, true }, + { 45742, true }, + { 45761, true }, + { 45773, true }, { 45793, true }, - { 45803, true }, - { 45812, true }, - { 45821, true }, - { 45830, true }, - { 45839, true }, - { 45849, true }, - { 45859, true }, - { 45868, true }, - { 45877, true }, - { 45895, true }, + { 45810, true }, + { 45824, true }, + { 45833, true }, + { 45845, true }, + { 45855, true }, + { 45864, true }, + { 45873, true }, + { 45882, true }, + { 45891, true }, + { 45901, true }, { 45911, true }, - { 45919, true }, - { 45926, true }, - { 45939, true }, - { 45956, true }, - { 45970, true }, - { 45977, true }, - { 45987, true }, - { 45998, true }, - { 46015, true }, - { 46032, true }, - { 46052, true }, - { 46071, false }, - { 46085, true }, - { 46103, true }, - { 46116, true }, - { 46133, true }, - { 46147, true }, - { 46161, true }, - { 46178, true }, - { 46204, true }, - { 46218, true }, - { 46235, true }, - { 46250, true }, - { 46264, true }, - { 46279, true }, - { 46290, true }, - { 46303, true }, - { 46317, true }, - { 46327, true }, - { 46338, true }, - { 46357, true }, - { 46372, true }, - { 46387, true }, - { 46414, true }, + { 45920, true }, + { 45929, true }, + { 45947, true }, + { 45963, true }, + { 45971, true }, + { 45978, true }, + { 45991, true }, + { 46008, true }, + { 46022, true }, + { 46029, true }, + { 46039, true }, + { 46050, true }, + { 46067, true }, + { 46084, true }, + { 46104, true }, + { 46123, false }, + { 46137, true }, + { 46155, true }, + { 46168, true }, + { 46185, true }, + { 46199, true }, + { 46213, true }, + { 46230, true }, + { 46256, true }, + { 46270, true }, + { 46287, true }, + { 46302, true }, + { 46316, true }, + { 46331, true }, + { 46342, true }, + { 46355, true }, + { 46369, true }, + { 46379, true }, + { 46390, true }, + { 46409, true }, { 46424, true }, - { 46436, true }, - { 46447, true }, - { 46459, true }, - { 46467, true }, - { 46478, true }, - { 46486, true }, - { 46497, true }, - { 46524, true }, - { 46534, true }, - { 46545, true }, - { 46556, true }, - { 46566, true }, - { 46580, true }, - { 46594, true }, - { 46605, true }, - { 46612, true }, - { 46620, true }, - { 46636, true }, - { 46650, true }, - { 46666, true }, - { 46680, true }, - { 46689, true }, - { 46701, true }, - { 46708, true }, - { 46715, true }, - { 46731, true }, - { 46743, true }, - { 46757, true }, - { 46779, true }, - { 46790, true }, - { 46801, true }, - { 46812, true }, - { 46823, true }, - { 46839, true }, - { 46856, true }, - { 46869, true }, - { 46895, false }, - { 46918, true }, - { 46934, true }, - { 46944, true }, - { 46957, true }, - { 46976, true }, - { 46989, true }, - { 47000, true }, - { 47015, true }, - { 47033, true }, - { 47045, false }, - { 47057, true }, - { 47071, true }, - { 47083, true }, - { 47097, true }, - { 47110, true }, - { 47128, true }, - { 47141, true }, - { 47160, true }, - { 47170, true }, - { 47181, true }, - { 47194, true }, - { 47211, true }, - { 47229, true }, - { 47245, true }, - { 47258, true }, - { 47276, true }, - { 47290, true }, - { 47309, true }, - { 47326, true }, - { 47344, true }, - { 47359, true }, - { 47380, true }, - { 47401, true }, - { 47417, true }, - { 47433, true }, - { 47452, false }, - { 47473, false }, - { 47493, true }, - { 47513, true }, - { 47533, true }, - { 47549, true }, - { 47566, true }, + { 46439, true }, + { 46466, true }, + { 46476, true }, + { 46488, true }, + { 46499, true }, + { 46511, true }, + { 46519, true }, + { 46530, true }, + { 46538, true }, + { 46549, true }, + { 46576, true }, + { 46586, true }, + { 46597, true }, + { 46608, true }, + { 46618, true }, + { 46632, true }, + { 46646, true }, + { 46657, true }, + { 46664, true }, + { 46672, true }, + { 46688, true }, + { 46702, true }, + { 46718, true }, + { 46732, true }, + { 46741, true }, + { 46753, true }, + { 46760, true }, + { 46767, true }, + { 46783, true }, + { 46795, true }, + { 46809, true }, + { 46831, true }, + { 46842, true }, + { 46853, true }, + { 46864, true }, + { 46875, true }, + { 46891, true }, + { 46908, true }, + { 46921, true }, + { 46947, false }, + { 46970, true }, + { 46986, true }, + { 46996, true }, + { 47009, true }, + { 47028, true }, + { 47041, true }, + { 47052, true }, + { 47067, true }, + { 47085, true }, + { 47097, false }, + { 47109, true }, + { 47123, true }, + { 47135, true }, + { 47149, true }, + { 47162, true }, + { 47180, true }, + { 47193, true }, + { 47212, true }, + { 47222, true }, + { 47233, true }, + { 47246, true }, + { 47263, true }, + { 47281, true }, + { 47297, true }, + { 47310, true }, + { 47328, true }, + { 47342, true }, + { 47361, true }, + { 47378, true }, + { 47396, true }, + { 47411, true }, + { 47432, true }, + { 47453, true }, + { 47469, true }, + { 47485, true }, + { 47504, false }, + { 47525, false }, + { 47545, true }, + { 47565, true }, { 47585, true }, - { 47603, true }, - { 47623, true }, - { 47639, true }, - { 47650, false }, - { 47660, true }, - { 47669, true }, - { 47687, true }, - { 47701, true }, - { 47719, false }, - { 47731, true }, - { 47744, true }, - { 47759, true }, - { 47774, true }, - { 47789, true }, - { 47797, true }, - { 47815, true }, + { 47601, true }, + { 47618, true }, + { 47637, true }, + { 47655, true }, + { 47675, true }, + { 47691, true }, + { 47702, false }, + { 47712, true }, + { 47721, true }, + { 47739, true }, + { 47753, true }, + { 47771, false }, + { 47783, true }, + { 47796, true }, + { 47811, true }, + { 47826, true }, + { 47841, true }, { 47849, true }, - { 47860, true }, - { 47873, false }, - { 47887, true }, - { 47905, true }, - { 47923, true }, - { 47934, true }, - { 47949, true }, - { 47960, true }, - { 47974, true }, - { 47989, true }, - { 48006, true }, - { 48018, true }, - { 48047, true }, - { 48080, true }, - { 48092, true }, - { 48104, true }, - { 48121, true }, - { 48136, true }, - { 48148, true }, - { 48160, true }, - { 48175, false }, - { 48187, true }, - { 48196, true }, - { 48208, true }, - { 48225, true }, - { 48240, false }, - { 48254, true }, - { 48274, true }, + { 47867, true }, + { 47901, true }, + { 47912, true }, + { 47925, false }, + { 47939, true }, + { 47957, true }, + { 47975, true }, + { 47986, true }, + { 48001, true }, + { 48012, true }, + { 48026, true }, + { 48041, true }, + { 48058, true }, + { 48070, true }, + { 48099, true }, + { 48132, true }, + { 48144, true }, + { 48156, true }, + { 48173, true }, + { 48188, true }, + { 48200, true }, + { 48212, true }, + { 48227, false }, + { 48239, true }, + { 48248, true }, + { 48260, true }, + { 48277, true }, { 48292, false }, { 48306, true }, - { 48317, true }, - { 48330, true }, - { 48340, false }, - { 48356, true }, - { 48370, true }, - { 48384, true }, - { 48395, true }, - { 48415, true }, - { 48428, true }, - { 48444, true }, - { 48457, true }, - { 48468, true }, - { 48485, true }, - { 48511, true }, - { 48531, true }, - { 48545, true }, - { 48562, false }, - { 48576, true }, - { 48590, false }, - { 48607, true }, - { 48623, true }, - { 48636, true }, - { 48663, true }, - { 48682, true }, - { 48693, true }, - { 48708, true }, - { 48720, true }, - { 48735, true }, - { 48750, true }, - { 48765, true }, + { 48326, true }, + { 48344, false }, + { 48358, true }, + { 48369, true }, + { 48382, true }, + { 48392, false }, + { 48408, true }, + { 48422, true }, + { 48436, true }, + { 48447, true }, + { 48467, true }, + { 48480, true }, + { 48496, true }, + { 48509, true }, + { 48520, true }, + { 48537, true }, + { 48563, true }, + { 48583, true }, + { 48597, true }, + { 48614, false }, + { 48628, true }, + { 48642, false }, + { 48659, true }, + { 48675, true }, + { 48688, true }, + { 48715, true }, + { 48734, true }, + { 48745, true }, + { 48760, true }, + { 48772, true }, { 48787, true }, - { 48805, true }, - { 48821, true }, - { 48838, true }, - { 48858, true }, - { 48872, true }, - { 48888, true }, - { 48906, true }, - { 48925, true }, - { 48938, true }, - { 48955, true }, - { 48968, true }, - { 48982, true }, - { 48997, true }, - { 49013, true }, - { 49032, true }, - { 49053, true }, + { 48802, true }, + { 48817, true }, + { 48839, true }, + { 48857, true }, + { 48873, true }, + { 48890, true }, + { 48910, true }, + { 48924, true }, + { 48940, true }, + { 48958, true }, + { 48977, true }, + { 48990, true }, + { 49007, true }, + { 49020, true }, + { 49035, true }, + { 49051, true }, { 49070, true }, - { 49086, true }, - { 49098, true }, - { 49111, true }, - { 49137, true }, - { 49157, false }, - { 49168, true }, - { 49186, true }, - { 49200, true }, - { 49212, true }, - { 49220, true }, - { 49229, true }, - { 49246, true }, - { 49257, true }, - { 49269, true }, - { 49277, true }, - { 49287, true }, - { 49298, true }, - { 49319, true }, - { 49331, true }, - { 49342, true }, - { 49350, true }, + { 49091, true }, + { 49108, true }, + { 49124, true }, + { 49136, true }, + { 49149, true }, + { 49175, true }, + { 49195, false }, + { 49206, true }, + { 49224, true }, + { 49238, true }, + { 49250, true }, + { 49258, true }, + { 49267, true }, + { 49284, true }, + { 49295, true }, + { 49307, true }, + { 49315, true }, + { 49325, true }, + { 49336, true }, { 49357, true }, - { 49365, true }, - { 49376, true }, - { 49392, true }, - { 49402, true }, - { 49413, true }, - { 49429, true }, - { 49442, true }, - { 49457, true }, - { 49474, true }, - { 49496, true }, - { 49517, true }, - { 49525, true }, - { 49538, true }, - { 49548, true }, - { 49562, true }, - { 49573, false }, - { 49593, true }, - { 49608, true }, - { 49621, true }, - { 49633, true }, - { 49654, true }, - { 49668, true }, - { 49682, true }, - { 49699, true }, - { 49714, true }, - { 49728, true }, - { 49742, true }, - { 49756, true }, - { 49770, true }, - { 49784, true }, - { 49799, true }, - { 49811, true }, - { 49825, true }, - { 49840, true }, - { 49850, true }, - { 49863, true }, + { 49369, true }, + { 49380, true }, + { 49388, true }, + { 49395, true }, + { 49403, true }, + { 49414, true }, + { 49430, true }, + { 49440, true }, + { 49451, true }, + { 49467, true }, + { 49480, true }, + { 49495, true }, + { 49512, true }, + { 49534, true }, + { 49555, true }, + { 49563, true }, + { 49576, true }, + { 49586, true }, + { 49600, true }, + { 49611, false }, + { 49631, true }, + { 49646, true }, + { 49659, true }, + { 49671, true }, + { 49692, true }, + { 49706, true }, + { 49720, true }, + { 49737, true }, + { 49752, true }, + { 49766, true }, + { 49780, true }, + { 49794, true }, + { 49808, true }, + { 49822, true }, + { 49837, true }, + { 49851, true }, + { 49866, true }, { 49876, true }, - { 49897, true }, - { 49909, true }, - { 49924, true }, - { 49941, true }, - { 49954, true }, - { 49969, true }, - { 49981, true }, - { 49996, true }, - { 50013, true }, - { 50030, true }, - { 50038, true }, - { 50050, true }, - { 50059, true }, - { 50079, true }, - { 50090, true }, + { 49889, true }, + { 49902, true }, + { 49923, true }, + { 49935, true }, + { 49950, true }, + { 49967, true }, + { 49980, true }, + { 49995, true }, + { 50007, true }, + { 50022, true }, + { 50039, true }, + { 50056, true }, + { 50064, true }, + { 50076, true }, + { 50085, true }, { 50105, true }, - { 50121, true }, - { 50128, true }, - { 50151, true }, - { 50165, true }, - { 50180, true }, - { 50195, true }, - { 50210, true }, + { 50116, true }, + { 50131, true }, + { 50147, true }, + { 50154, true }, + { 50177, true }, + { 50191, true }, + { 50206, true }, { 50221, true }, - { 50231, true }, - { 50240, true }, - { 50252, true }, - { 50263, true }, - { 50274, true }, - { 50287, true }, - { 50297, true }, + { 50236, true }, + { 50247, true }, + { 50257, true }, + { 50266, true }, + { 50278, true }, + { 50289, true }, + { 50300, true }, { 50313, true }, - { 50328, true }, - { 50344, true }, - { 50361, true }, - { 50378, true }, - { 50392, true }, - { 50407, true }, - { 50423, true }, - { 50438, true }, - { 50448, true }, - { 50461, true }, - { 50473, true }, - { 50501, true }, - { 50513, true }, + { 50323, true }, + { 50339, true }, + { 50354, true }, + { 50370, true }, + { 50387, true }, + { 50404, true }, + { 50418, true }, + { 50433, true }, + { 50449, true }, + { 50464, true }, + { 50474, true }, + { 50487, true }, + { 50499, true }, { 50527, true }, - { 50541, true }, - { 50552, true }, - { 50568, true }, - { 50579, true }, - { 50592, true }, - { 50603, true }, - { 50625, true }, - { 50645, true }, - { 50666, true }, - { 50681, true }, - { 50695, true }, - { 50710, true }, - { 50724, true }, + { 50539, true }, + { 50553, true }, + { 50567, true }, + { 50578, true }, + { 50594, true }, + { 50605, true }, + { 50618, true }, + { 50629, true }, + { 50651, true }, + { 50671, true }, + { 50692, true }, + { 50707, true }, + { 50721, true }, { 50736, true }, - { 50746, true }, - { 50765, true }, - { 50782, true }, - { 50795, true }, - { 50809, true }, + { 50750, true }, + { 50762, true }, + { 50772, true }, + { 50791, true }, + { 50808, true }, { 50821, true }, - { 50834, true }, - { 50846, true }, - { 50859, true }, + { 50835, true }, + { 50847, true }, + { 50860, true }, { 50872, true }, - { 50883, true }, - { 50901, true }, - { 50919, true }, - { 50932, true }, - { 50944, true }, + { 50885, true }, + { 50898, true }, + { 50909, true }, + { 50927, true }, + { 50945, true }, { 50958, true }, - { 50972, true }, - { 50980, true }, - { 51009, true }, - { 51028, true }, - { 51041, true }, - { 51066, true }, - { 51083, true }, - { 51104, true }, - { 51116, true }, - { 51133, true }, - { 51157, true }, - { 51190, true }, - { 51202, true }, - { 51224, true }, - { 51241, true }, - { 51256, true }, - { 51270, true }, + { 50970, true }, + { 50984, true }, + { 50998, true }, + { 51006, true }, + { 51035, true }, + { 51054, true }, + { 51067, true }, + { 51092, true }, + { 51109, true }, + { 51130, true }, + { 51142, true }, + { 51159, true }, + { 51183, true }, + { 51216, true }, + { 51228, true }, + { 51250, true }, + { 51267, true }, + { 51282, true }, { 51296, true }, - { 51315, true }, - { 51328, true }, - { 51338, true }, - { 51348, true }, - { 51369, true }, - { 51378, true }, - { 51396, true }, - { 51414, true }, - { 51441, true }, - { 51466, true }, - { 51481, true }, - { 51501, true }, - { 51516, true }, - { 51531, true }, - { 51552, true }, - { 51576, true }, - { 51589, true }, - { 51618, true }, - { 51629, false }, - { 51643, true }, - { 51654, true }, - { 51668, true }, - { 51687, true }, - { 51701, true }, - { 51716, false }, - { 51731, true }, - { 51748, true }, + { 51322, true }, + { 51341, true }, + { 51354, true }, + { 51364, true }, + { 51374, true }, + { 51395, true }, + { 51404, true }, + { 51422, true }, + { 51440, true }, + { 51467, true }, + { 51492, true }, + { 51507, true }, + { 51527, true }, + { 51542, true }, + { 51557, true }, + { 51578, true }, + { 51602, true }, + { 51615, true }, + { 51644, true }, + { 51655, false }, + { 51669, true }, + { 51680, true }, + { 51694, true }, + { 51713, true }, + { 51727, true }, + { 51742, false }, { 51757, true }, - { 51767, true }, - { 51805, true }, - { 51820, true }, + { 51774, true }, + { 51783, true }, + { 51793, true }, { 51831, true }, - { 51843, true }, - { 51861, true }, - { 51873, true }, - { 51884, true }, - { 51901, true }, - { 51909, true }, - { 51918, true }, - { 51931, true }, - { 51941, true }, - { 51955, false }, - { 51980, true }, - { 51998, false }, - { 52022, true }, - { 52036, true }, - { 52055, true }, - { 52082, true }, - { 52094, true }, - { 52106, true }, - { 52114, true }, - { 52123, true }, - { 52137, true }, - { 52154, true }, - { 52169, false }, - { 52181, true }, - { 52193, true }, - { 52210, true }, - { 52222, true }, - { 52234, true }, - { 52244, true }, - { 52255, true }, - { 52267, true }, + { 51846, true }, + { 51857, true }, + { 51869, true }, + { 51887, true }, + { 51899, true }, + { 51910, true }, + { 51927, true }, + { 51935, true }, + { 51944, true }, + { 51954, true }, + { 51967, true }, + { 51977, true }, + { 51991, false }, + { 52016, true }, + { 52034, false }, + { 52058, true }, + { 52072, true }, + { 52091, true }, + { 52118, true }, + { 52130, true }, + { 52142, true }, + { 52150, true }, + { 52159, true }, + { 52173, true }, + { 52190, true }, + { 52205, false }, + { 52217, true }, + { 52229, true }, + { 52246, true }, + { 52258, true }, + { 52270, true }, { 52280, true }, - { 52294, true }, - { 52311, true }, - { 52322, true }, - { 52340, false }, - { 52360, true }, - { 52372, true }, - { 52384, true }, - { 52395, true }, - { 52407, true }, - { 52416, true }, - { 52426, true }, - { 52439, true }, - { 52461, true }, + { 52291, true }, + { 52303, true }, + { 52316, true }, + { 52330, true }, + { 52347, true }, + { 52358, true }, + { 52376, false }, + { 52396, true }, + { 52408, true }, + { 52420, true }, + { 52431, true }, + { 52443, true }, + { 52452, true }, + { 52462, true }, { 52475, true }, - { 52484, true }, - { 52496, true }, - { 52503, true }, - { 52515, true }, - { 52524, true }, - { 52533, true }, - { 52543, true }, - { 52557, true }, - { 52574, true }, - { 52585, true }, - { 52599, true }, - { 52608, true }, - { 52617, true }, - { 52627, true }, - { 52641, true }, - { 52650, true }, - { 52665, true }, + { 52497, true }, + { 52511, true }, + { 52520, true }, + { 52532, true }, + { 52539, true }, + { 52551, true }, + { 52560, true }, + { 52569, true }, + { 52579, true }, + { 52593, true }, + { 52610, true }, + { 52621, true }, + { 52635, true }, + { 52644, true }, + { 52653, true }, + { 52663, true }, { 52677, true }, - { 52693, true }, - { 52709, true }, - { 52726, true }, - { 52743, true }, - { 52753, true }, - { 52775, true }, - { 52784, true }, - { 52796, true }, - { 52810, true }, - { 52824, true }, - { 52839, true }, - { 52872, true }, - { 52900, true }, - { 52925, true }, - { 52934, true }, - { 52950, true }, - { 52962, true }, - { 52973, true }, + { 52686, true }, + { 52701, true }, + { 52713, true }, + { 52729, true }, + { 52745, true }, + { 52762, true }, + { 52779, true }, + { 52789, true }, + { 52811, true }, + { 52820, true }, + { 52832, true }, + { 52846, true }, + { 52860, true }, + { 52875, true }, + { 52908, true }, + { 52936, true }, + { 52961, true }, + { 52970, true }, + { 52986, true }, { 52998, true }, - { 53013, true }, - { 53035, true }, - { 53060, true }, - { 53091, true }, - { 53102, true }, - { 53118, true }, - { 53132, true }, - { 53141, true }, - { 53159, true }, - { 53173, true }, - { 53188, false }, - { 53205, true }, - { 53223, true }, - { 53236, true }, - { 53246, true }, - { 53269, true }, - { 53281, true }, - { 53296, true }, - { 53311, true }, - { 53322, true }, - { 53336, true }, - { 53350, true }, - { 53363, true }, - { 53375, true }, - { 53387, true }, + { 53009, true }, + { 53034, true }, + { 53049, true }, + { 53071, true }, + { 53096, true }, + { 53127, true }, + { 53138, true }, + { 53154, true }, + { 53168, true }, + { 53177, true }, + { 53195, true }, + { 53209, true }, + { 53224, false }, + { 53241, true }, + { 53259, true }, + { 53272, true }, + { 53282, true }, + { 53305, true }, + { 53317, true }, + { 53332, true }, + { 53347, true }, + { 53358, true }, + { 53372, true }, + { 53386, true }, { 53399, true }, - { 53412, true }, + { 53411, true }, { 53423, true }, - { 53439, true }, - { 53452, true }, - { 53464, false }, - { 53481, true }, - { 53501, true }, - { 53518, true }, - { 53536, true }, - { 53552, true }, - { 53567, true }, - { 53582, true }, - { 53605, true }, - { 53631, true }, - { 53646, true }, - { 53666, false }, - { 53684, true }, - { 53703, true }, + { 53435, true }, + { 53448, true }, + { 53459, true }, + { 53475, true }, + { 53488, true }, + { 53500, false }, + { 53517, true }, + { 53537, true }, + { 53554, true }, + { 53572, true }, + { 53588, true }, + { 53603, true }, + { 53618, true }, + { 53641, true }, + { 53667, true }, + { 53682, true }, + { 53702, false }, { 53720, true }, { 53739, true }, - { 53752, true }, - { 53769, true }, - { 53779, false }, - { 53796, true }, - { 53815, true }, + { 53756, true }, + { 53775, true }, + { 53788, true }, + { 53805, true }, + { 53815, false }, { 53832, true }, - { 53846, true }, - { 53863, true }, - { 53871, true }, + { 53851, true }, + { 53868, true }, { 53882, true }, - { 53894, true }, - { 53904, true }, - { 53915, true }, - { 53925, true }, - { 53935, true }, - { 53948, true }, - { 53962, true }, - { 53973, true }, - { 53986, true }, - { 54005, false }, - { 54013, true }, - { 54024, true }, - { 54037, true }, - { 54050, true }, - { 54069, true }, - { 54085, true }, - { 54109, true }, + { 53899, true }, + { 53907, true }, + { 53918, true }, + { 53930, true }, + { 53940, true }, + { 53951, true }, + { 53961, true }, + { 53971, true }, + { 53984, true }, + { 53998, true }, + { 54009, true }, + { 54022, true }, + { 54041, false }, + { 54049, true }, + { 54060, true }, + { 54073, true }, + { 54086, true }, + { 54105, true }, { 54121, true }, - { 54135, true }, - { 54149, true }, - { 54160, true }, - { 54174, true }, - { 54186, true }, - { 54201, true }, - { 54217, true }, - { 54229, true }, - { 54244, true }, - { 54262, true }, - { 54277, true }, - { 54291, true }, + { 54145, true }, + { 54157, true }, + { 54171, true }, + { 54185, true }, + { 54196, true }, + { 54210, true }, + { 54222, true }, + { 54237, true }, + { 54253, true }, + { 54265, true }, + { 54280, true }, + { 54298, true }, { 54313, true }, - { 54328, true }, - { 54344, true }, - { 54358, true }, - { 54379, true }, - { 54395, true }, - { 54414, true }, - { 54433, true }, - { 54450, false }, - { 54470, true }, - { 54500, true }, - { 54526, true }, - { 54543, true }, - { 54565, true }, - { 54581, true }, + { 54327, true }, + { 54349, true }, + { 54364, true }, + { 54380, true }, + { 54394, true }, + { 54415, true }, + { 54431, true }, + { 54450, true }, + { 54469, true }, + { 54486, false }, + { 54506, true }, + { 54536, true }, + { 54562, true }, + { 54579, true }, { 54601, true }, - { 54615, true }, - { 54638, true }, - { 54657, true }, - { 54675, true }, - { 54690, true }, - { 54701, true }, - { 54712, true }, - { 54722, true }, - { 54740, true }, - { 54759, true }, - { 54769, true }, - { 54787, true }, - { 54796, false }, - { 54807, false }, - { 54827, true }, - { 54835, true }, - { 54850, true }, - { 54864, true }, - { 54877, true }, - { 54887, true }, - { 54896, true }, - { 54916, true }, - { 54925, false }, - { 54940, true }, - { 54949, false }, - { 54958, true }, - { 54974, true }, - { 54991, true }, - { 55000, true }, - { 55007, true }, - { 55015, true }, + { 54617, true }, + { 54637, true }, + { 54651, true }, + { 54674, true }, + { 54693, true }, + { 54711, true }, + { 54726, true }, + { 54737, true }, + { 54748, true }, + { 54758, true }, + { 54776, true }, + { 54795, true }, + { 54805, true }, + { 54823, true }, + { 54832, false }, + { 54843, false }, + { 54863, true }, + { 54871, true }, + { 54886, true }, + { 54900, true }, + { 54913, true }, + { 54923, true }, + { 54932, true }, + { 54952, true }, + { 54961, false }, + { 54976, true }, + { 54985, false }, + { 54994, true }, + { 55010, true }, { 55027, true }, { 55036, true }, - { 55046, true }, + { 55043, true }, + { 55051, true }, { 55063, true }, - { 55073, true }, - { 55081, true }, - { 55089, true }, - { 55096, true }, - { 55107, true }, - { 55120, true }, - { 55127, true }, - { 55137, true }, - { 55152, true }, - { 55167, true }, - { 55180, true }, - { 55192, true }, - { 55207, true }, - { 55218, true }, + { 55072, true }, + { 55082, true }, + { 55099, true }, + { 55109, true }, + { 55117, true }, + { 55125, true }, + { 55132, true }, + { 55143, true }, + { 55156, true }, + { 55163, true }, + { 55173, true }, + { 55188, true }, + { 55203, true }, + { 55216, true }, { 55228, true }, - { 55236, true }, - { 55245, true }, - { 55253, true }, - { 55267, true }, - { 55279, true }, - { 55294, true }, - { 55301, true }, - { 55311, true }, - { 55328, true }, - { 55338, true }, - { 55354, true }, - { 55370, true }, - { 55389, true }, - { 55403, true }, - { 55419, true }, - { 55432, true }, - { 55447, true }, - { 55458, true }, - { 55470, true }, - { 55495, false }, - { 55504, true }, - { 55517, true }, - { 55526, true }, - { 55542, true }, - { 55552, true }, - { 55565, true }, - { 55586, true }, - { 55595, true }, - { 55610, true }, - { 55624, true }, - { 55638, true }, - { 55650, true }, - { 55672, true }, - { 55683, true }, - { 55695, true }, - { 55706, true }, - { 55720, true }, - { 55740, true }, - { 55754, true }, - { 55777, true }, - { 55793, true }, - { 55801, true }, - { 55815, true }, - { 55830, true }, - { 55847, true }, - { 55861, true }, - { 55880, true }, - { 55896, true }, - { 55907, true }, - { 55918, true }, - { 55930, true }, - { 55951, false }, - { 55967, true }, - { 55985, true }, - { 56006, true }, - { 56021, true }, - { 56039, true }, - { 56054, true }, - { 56082, true }, + { 55243, true }, + { 55254, true }, + { 55264, true }, + { 55272, true }, + { 55281, true }, + { 55289, true }, + { 55303, true }, + { 55315, true }, + { 55330, true }, + { 55337, true }, + { 55347, true }, + { 55364, true }, + { 55374, true }, + { 55390, true }, + { 55406, true }, + { 55425, true }, + { 55439, true }, + { 55455, true }, + { 55468, true }, + { 55483, true }, + { 55494, true }, + { 55506, true }, + { 55531, false }, + { 55540, true }, + { 55553, true }, + { 55562, true }, + { 55578, true }, + { 55588, true }, + { 55601, true }, + { 55622, true }, + { 55631, true }, + { 55646, true }, + { 55660, true }, + { 55674, true }, + { 55686, true }, + { 55708, true }, + { 55719, true }, + { 55731, true }, + { 55742, true }, + { 55756, true }, + { 55776, true }, + { 55790, true }, + { 55813, true }, + { 55829, true }, + { 55837, true }, + { 55851, true }, + { 55866, true }, + { 55883, true }, + { 55897, true }, + { 55916, true }, + { 55932, true }, + { 55943, true }, + { 55954, true }, + { 55966, true }, + { 55987, false }, + { 56003, true }, + { 56020, true }, + { 56038, true }, + { 56059, true }, + { 56074, true }, { 56092, true }, - { 56102, true }, - { 56121, false }, - { 56133, true }, - { 56147, true }, - { 56160, true }, - { 56179, true }, - { 56195, true }, - { 56209, true }, - { 56224, true }, - { 56247, true }, - { 56260, true }, + { 56107, true }, + { 56135, true }, + { 56145, true }, + { 56155, true }, + { 56174, false }, + { 56186, true }, + { 56200, true }, + { 56213, true }, + { 56232, true }, + { 56248, true }, + { 56262, true }, { 56277, true }, - { 56286, true }, - { 56301, true }, - { 56322, true }, - { 56337, true }, - { 56353, true }, - { 56366, true }, - { 56379, true }, - { 56391, true }, - { 56416, true }, - { 56430, true }, - { 56441, true }, - { 56458, true }, - { 56475, true }, - { 56486, true }, - { 56500, true }, - { 56507, true }, - { 56516, true }, - { 56535, true }, - { 56550, true }, - { 56561, true }, - { 56585, true }, - { 56596, true }, - { 56606, true }, - { 56619, true }, - { 56631, true }, - { 56642, true }, - { 56653, true }, - { 56665, true }, - { 56686, true }, - { 56700, true }, - { 56715, true }, - { 56732, true }, - { 56747, true }, - { 56759, true }, - { 56776, true }, - { 56792, true }, - { 56813, true }, - { 56830, true }, - { 56859, true }, - { 56873, true }, - { 56884, false }, - { 56907, false }, - { 56921, true }, - { 56935, true }, - { 56953, true }, - { 56968, true }, - { 56984, true }, - { 57001, true }, - { 57018, true }, - { 57035, true }, - { 57046, true }, - { 57064, true }, - { 57083, true }, - { 57106, true }, - { 57120, true }, - { 57139, true }, - { 57158, true }, - { 57172, true }, - { 57183, true }, - { 57193, true }, - { 57206, true }, - { 57222, true }, - { 57242, true }, - { 57262, true }, - { 57282, false }, - { 57300, true }, - { 57329, true }, - { 57345, true }, - { 57361, true }, - { 57371, true }, - { 57387, true }, - { 57402, true }, - { 57411, true }, - { 57426, true }, - { 57438, true }, - { 57446, true }, - { 57460, true }, - { 57475, true }, - { 57488, true }, - { 57500, true }, - { 57515, true }, - { 57531, false }, + { 56300, true }, + { 56313, true }, + { 56330, true }, + { 56339, true }, + { 56354, true }, + { 56375, true }, + { 56390, true }, + { 56406, true }, + { 56419, true }, + { 56432, true }, + { 56444, true }, + { 56469, true }, + { 56483, true }, + { 56494, true }, + { 56511, true }, + { 56528, true }, + { 56539, true }, + { 56553, true }, + { 56560, true }, + { 56569, true }, + { 56588, true }, + { 56603, true }, + { 56614, true }, + { 56638, true }, + { 56649, true }, + { 56659, true }, + { 56672, true }, + { 56684, true }, + { 56695, true }, + { 56706, true }, + { 56718, true }, + { 56739, true }, + { 56753, true }, + { 56768, true }, + { 56785, true }, + { 56800, true }, + { 56812, true }, + { 56829, true }, + { 56845, true }, + { 56866, true }, + { 56883, true }, + { 56912, true }, + { 56926, true }, + { 56937, false }, + { 56960, false }, + { 56974, true }, + { 56988, true }, + { 57006, true }, + { 57021, true }, + { 57037, true }, + { 57054, true }, + { 57071, true }, + { 57088, true }, + { 57099, true }, + { 57117, true }, + { 57136, true }, + { 57159, true }, + { 57173, true }, + { 57192, true }, + { 57211, true }, + { 57225, true }, + { 57236, true }, + { 57246, true }, + { 57259, true }, + { 57275, true }, + { 57295, true }, + { 57315, true }, + { 57335, false }, + { 57353, true }, + { 57382, true }, + { 57398, true }, + { 57414, true }, + { 57424, true }, + { 57440, true }, + { 57455, true }, + { 57464, true }, + { 57479, true }, + { 57491, true }, + { 57499, true }, + { 57513, true }, + { 57528, true }, { 57541, true }, - { 57558, true }, - { 57571, true }, - { 57589, true }, + { 57553, true }, + { 57568, true }, + { 57584, false }, + { 57594, true }, { 57611, true }, - { 57633, true }, - { 57651, true }, - { 57662, true }, - { 57671, true }, - { 57692, true }, + { 57624, true }, + { 57642, true }, + { 57664, true }, + { 57686, true }, { 57704, true }, - { 57725, true }, - { 57737, true }, - { 57750, true }, - { 57765, true }, - { 57777, true }, - { 57794, true }, + { 57715, true }, + { 57724, true }, + { 57745, true }, + { 57757, true }, + { 57778, true }, + { 57790, true }, { 57803, true }, { 57818, true }, - { 57848, true }, - { 57886, true }, - { 57917, true }, - { 57949, true }, - { 57977, true }, - { 58011, true }, - { 58041, true }, - { 58071, true }, - { 58106, true }, - { 58135, true }, - { 58171, true }, - { 58183, true }, - { 58197, true }, - { 58213, true }, - { 58223, true }, - { 58233, true }, - { 58248, true }, - { 58270, true }, - { 58284, true }, - { 58294, true }, - { 58314, true }, - { 58325, true }, - { 58341, true }, - { 58359, true }, + { 57830, true }, + { 57847, true }, + { 57856, true }, + { 57871, true }, + { 57901, true }, + { 57939, true }, + { 57970, true }, + { 58002, true }, + { 58030, true }, + { 58064, true }, + { 58094, true }, + { 58124, true }, + { 58159, true }, + { 58188, true }, + { 58224, true }, + { 58236, true }, + { 58250, true }, + { 58266, true }, + { 58276, true }, + { 58286, true }, + { 58301, true }, + { 58323, true }, + { 58337, true }, + { 58347, true }, { 58367, true }, - { 58381, true }, - { 58396, true }, - { 58404, true }, - { 58413, true }, - { 58436, true }, - { 58447, true }, - { 58462, true }, - { 58480, true }, - { 58492, true }, - { 58508, true }, - { 58523, false }, - { 58536, true }, - { 58547, true }, - { 58562, true }, - { 58579, true }, - { 58590, true }, - { 58599, true }, - { 58608, true }, - { 58624, true }, - { 58634, false }, - { 58653, true }, - { 58667, true }, - { 58685, true }, - { 58693, true }, - { 58702, true }, - { 58712, true }, - { 58722, true }, - { 58737, true }, - { 58747, true }, - { 58768, true }, - { 58777, true }, - { 58793, true }, - { 58803, true }, - { 58822, true }, - { 58835, true }, - { 58853, true }, - { 58873, true }, - { 58893, true }, - { 58901, true }, - { 58914, true }, - { 58925, true }, - { 58943, true }, - { 58953, true }, - { 58962, true }, - { 58971, true }, - { 58979, true }, - { 58989, true }, - { 59001, true }, - { 59011, true }, - { 59026, true }, - { 59033, true }, - { 59046, true }, - { 59070, false }, - { 59085, true }, - { 59105, true }, - { 59125, true }, - { 59144, true }, - { 59161, true }, - { 59172, true }, - { 59187, true }, - { 59197, true }, - { 59213, true }, - { 59223, true }, - { 59240, true }, - { 59250, true }, - { 59264, true }, - { 59281, true }, - { 59302, true }, - { 59311, true }, - { 59327, true }, - { 59347, true }, - { 59360, true }, - { 59370, true }, - { 59382, true }, - { 59391, true }, + { 58378, true }, + { 58394, true }, + { 58412, true }, + { 58420, true }, + { 58434, true }, + { 58449, true }, + { 58457, true }, + { 58466, true }, + { 58489, true }, + { 58500, true }, + { 58515, true }, + { 58533, true }, + { 58545, true }, + { 58561, true }, + { 58576, false }, + { 58589, true }, + { 58600, true }, + { 58615, true }, + { 58632, true }, + { 58643, true }, + { 58652, true }, + { 58661, true }, + { 58677, true }, + { 58687, false }, + { 58706, true }, + { 58720, true }, + { 58738, true }, + { 58746, true }, + { 58755, true }, + { 58765, true }, + { 58775, true }, + { 58790, true }, + { 58800, true }, + { 58821, true }, + { 58830, true }, + { 58846, true }, + { 58856, true }, + { 58875, true }, + { 58888, true }, + { 58906, true }, + { 58926, true }, + { 58946, true }, + { 58954, true }, + { 58967, true }, + { 58978, true }, + { 58996, true }, + { 59006, true }, + { 59015, true }, + { 59024, true }, + { 59035, true }, + { 59043, true }, + { 59053, true }, + { 59065, true }, + { 59075, true }, + { 59090, true }, + { 59097, true }, + { 59110, true }, + { 59134, false }, + { 59149, true }, + { 59169, true }, + { 59189, true }, + { 59208, true }, + { 59225, true }, + { 59236, true }, + { 59251, true }, + { 59261, true }, + { 59271, true }, + { 59287, true }, + { 59297, true }, + { 59314, true }, + { 59324, true }, + { 59338, true }, + { 59355, true }, + { 59376, true }, + { 59385, true }, { 59401, true }, - { 59412, true }, - { 59420, true }, - { 59427, true }, - { 59441, true }, - { 59466, true }, - { 59484, true }, - { 59502, true }, - { 59516, true }, - { 59525, true }, - { 59538, true }, - { 59555, true }, - { 59564, true }, - { 59577, true }, - { 59594, true }, - { 59610, true }, - { 59627, true }, - { 59642, true }, - { 59671, true }, - { 59689, false }, - { 59702, true }, - { 59718, true }, - { 59734, true }, - { 59747, true }, - { 59760, true }, - { 59771, true }, - { 59784, true }, - { 59794, false }, - { 59812, true }, - { 59825, true }, - { 59838, true }, - { 59854, true }, - { 59873, true }, - { 59888, true }, - { 59895, true }, - { 59924, true }, - { 59946, true }, - { 59967, true }, - { 59994, true }, - { 60014, true }, - { 60022, true }, - { 60033, true }, - { 60053, true }, - { 60072, true }, - { 60087, true }, - { 60106, true }, - { 60117, true }, - { 60128, true }, + { 59421, true }, + { 59434, true }, + { 59444, true }, + { 59456, true }, + { 59465, true }, + { 59475, true }, + { 59486, true }, + { 59494, true }, + { 59501, true }, + { 59515, true }, + { 59540, true }, + { 59558, true }, + { 59576, true }, + { 59590, true }, + { 59599, true }, + { 59612, true }, + { 59629, true }, + { 59638, true }, + { 59651, true }, + { 59668, true }, + { 59684, true }, + { 59701, true }, + { 59716, true }, + { 59745, true }, + { 59763, false }, + { 59776, true }, + { 59792, true }, + { 59808, true }, + { 59821, true }, + { 59834, true }, + { 59845, true }, + { 59858, true }, + { 59868, false }, + { 59886, true }, + { 59899, true }, + { 59912, true }, + { 59928, true }, + { 59947, true }, + { 59962, true }, + { 59969, true }, + { 59998, true }, + { 60020, true }, + { 60041, true }, + { 60068, true }, + { 60088, true }, + { 60096, true }, + { 60107, true }, + { 60127, true }, { 60146, true }, - { 60162, false }, - { 60177, true }, - { 60192, true }, - { 60209, true }, - { 60224, true }, - { 60243, true }, - { 60257, true }, - { 60275, true }, - { 60284, true }, - { 60294, true }, - { 60305, true }, - { 60321, true }, - { 60335, true }, + { 60161, true }, + { 60180, true }, + { 60191, true }, + { 60202, true }, + { 60220, true }, + { 60236, false }, + { 60251, true }, + { 60266, true }, + { 60283, true }, + { 60298, true }, + { 60317, true }, + { 60331, true }, { 60349, true }, - { 60362, true }, - { 60375, true }, - { 60389, true }, - { 60403, true }, - { 60412, true }, + { 60358, true }, + { 60368, true }, + { 60379, true }, + { 60395, true }, + { 60409, true }, { 60423, true }, - { 60447, true }, - { 60468, true }, - { 60480, true }, - { 60491, false }, - { 60504, true }, - { 60510, true }, - { 60520, true }, - { 60529, true }, - { 60543, true }, - { 60553, true }, - { 60569, true }, - { 60579, true }, - { 60592, true }, - { 60605, true }, + { 60436, true }, + { 60449, true }, + { 60463, true }, + { 60477, true }, + { 60486, true }, + { 60497, true }, + { 60521, true }, + { 60542, true }, + { 60554, true }, + { 60565, false }, + { 60578, true }, + { 60584, true }, + { 60594, true }, + { 60603, true }, { 60617, true }, - { 60633, true }, - { 60644, true }, - { 60656, true }, - { 60671, true }, - { 60688, true }, - { 60699, true }, - { 60711, true }, - { 60727, false }, - { 60742, true }, - { 60752, true }, - { 60771, true }, - { 60787, true }, - { 60799, true }, - { 60810, true }, - { 60827, true }, - { 60846, true }, - { 60869, true }, - { 60886, true }, - { 60899, true }, - { 60908, false }, - { 60917, true }, - { 60928, true }, - { 60945, true }, - { 60961, true }, - { 60975, true }, - { 60989, true }, - { 61007, true }, - { 61016, true }, - { 61029, true }, - { 61046, true }, - { 61056, true }, - { 61068, true }, - { 61078, true }, - { 61126, true }, - { 61170, true }, - { 61208, true }, - { 61247, true }, - { 61287, true }, - { 61331, true }, - { 61367, true }, - { 61408, true }, - { 61445, true }, - { 61489, true }, - { 61516, true }, - { 61525, true }, - { 61533, false }, - { 61543, true }, - { 61549, true }, - { 61557, true }, - { 61575, true }, - { 61584, true }, - { 61606, true }, - { 61613, true }, - { 61624, true }, - { 61636, true }, - { 61645, true }, - { 61660, true }, + { 60627, true }, + { 60643, true }, + { 60653, true }, + { 60666, true }, + { 60679, true }, + { 60691, true }, + { 60707, true }, + { 60718, true }, + { 60730, true }, + { 60745, true }, + { 60762, true }, + { 60773, true }, + { 60785, true }, + { 60801, false }, + { 60816, true }, + { 60826, true }, + { 60845, true }, + { 60861, true }, + { 60873, true }, + { 60884, true }, + { 60901, true }, + { 60920, true }, + { 60943, true }, + { 60960, true }, + { 60973, true }, + { 60982, false }, + { 60991, true }, + { 61002, true }, + { 61019, true }, + { 61035, true }, + { 61049, true }, + { 61063, true }, + { 61081, true }, + { 61090, true }, + { 61103, true }, + { 61120, true }, + { 61130, true }, + { 61142, true }, + { 61152, true }, + { 61200, true }, + { 61244, true }, + { 61282, true }, + { 61321, true }, + { 61361, true }, + { 61405, true }, + { 61441, true }, + { 61482, true }, + { 61519, true }, + { 61563, true }, + { 61590, true }, + { 61602, true }, + { 61611, true }, + { 61619, false }, + { 61629, true }, + { 61635, true }, + { 61643, true }, + { 61661, true }, { 61670, true }, - { 61679, true }, - { 61690, true }, - { 61702, true }, - { 61715, true }, + { 61692, true }, + { 61699, true }, + { 61710, true }, + { 61722, true }, { 61731, true }, - { 61752, true }, - { 61763, true }, - { 61777, true }, - { 61787, true }, - { 61804, true }, - { 61821, true }, - { 61833, true }, - { 61856, true }, - { 61870, true }, - { 61885, true }, - { 61896, true }, - { 61912, true }, - { 61923, true }, - { 61952, true }, - { 61968, true }, - { 61996, true }, - { 62012, true }, - { 62024, false }, - { 62042, true }, - { 62050, false }, - { 62061, true }, - { 62071, true }, - { 62092, true }, - { 62102, true }, - { 62117, true }, - { 62131, true }, - { 62141, true }, - { 62156, true }, - { 62167, true }, - { 62179, true }, - { 62191, true }, - { 62204, true }, - { 62217, true }, - { 62226, true }, - { 62235, false }, - { 62247, true }, + { 61746, true }, + { 61756, true }, + { 61765, true }, + { 61776, true }, + { 61788, true }, + { 61801, true }, + { 61817, true }, + { 61838, true }, + { 61849, true }, + { 61863, true }, + { 61873, true }, + { 61890, true }, + { 61907, true }, + { 61919, true }, + { 61942, true }, + { 61956, true }, + { 61971, true }, + { 61982, true }, + { 61998, true }, + { 62009, true }, + { 62038, true }, + { 62054, true }, + { 62082, true }, + { 62098, true }, + { 62110, false }, + { 62128, true }, + { 62136, false }, + { 62147, true }, + { 62157, true }, + { 62178, true }, + { 62188, true }, + { 62198, true }, + { 62213, true }, + { 62227, true }, + { 62237, true }, + { 62252, true }, { 62263, true }, - { 62274, true }, - { 62290, true }, - { 62309, true }, - { 62325, true }, - { 62340, true }, - { 62361, true }, - { 62392, true }, - { 62416, true }, - { 62435, true }, - { 62455, true }, - { 62472, true }, + { 62275, true }, + { 62287, true }, + { 62300, true }, + { 62313, true }, + { 62322, true }, + { 62331, false }, + { 62343, true }, + { 62359, true }, + { 62370, true }, + { 62386, true }, + { 62405, true }, + { 62421, true }, + { 62436, true }, + { 62457, true }, { 62488, true }, - { 62503, true }, - { 62522, true }, - { 62544, true }, - { 62566, true }, - { 62588, true }, - { 62605, true }, - { 62620, true }, - { 62639, true }, - { 62652, true }, - { 62667, true }, - { 62682, true }, - { 62695, true }, - { 62711, true }, - { 62723, true }, - { 62736, false }, - { 62746, false }, - { 62755, true }, - { 62775, true }, - { 62790, true }, - { 62801, true }, - { 62822, true }, - { 62838, true }, - { 62862, false }, - { 62879, true }, - { 62892, true }, - { 62905, true }, + { 62512, true }, + { 62531, true }, + { 62551, true }, + { 62568, true }, + { 62584, true }, + { 62599, true }, + { 62618, true }, + { 62640, true }, + { 62662, true }, + { 62684, true }, + { 62701, true }, + { 62716, true }, + { 62735, true }, + { 62748, true }, + { 62763, true }, + { 62778, true }, + { 62791, true }, + { 62807, true }, + { 62819, true }, + { 62832, false }, + { 62842, false }, + { 62851, true }, + { 62871, true }, + { 62886, true }, + { 62897, true }, { 62918, true }, - { 62931, true }, - { 62950, true }, - { 62961, true }, - { 62970, true }, - { 62979, true }, - { 62989, true }, - { 63002, true }, - { 63012, true }, - { 63021, true }, - { 63037, true }, - { 63053, true }, - { 63080, true }, - { 63091, true }, + { 62934, true }, + { 62958, false }, + { 62975, true }, + { 62988, true }, + { 63001, true }, + { 63014, true }, + { 63027, true }, + { 63046, true }, + { 63057, true }, + { 63066, true }, + { 63075, true }, + { 63085, true }, + { 63098, true }, { 63108, true }, - { 63121, true }, - { 63135, true }, - { 63152, true }, - { 63167, true }, - { 63190, true }, - { 63200, true }, - { 63215, true }, - { 63225, true }, - { 63245, true }, - { 63270, true }, - { 63294, true }, - { 63303, true }, - { 63320, true }, + { 63117, true }, + { 63133, true }, + { 63149, true }, + { 63176, true }, + { 63187, true }, + { 63204, true }, + { 63217, true }, + { 63231, true }, + { 63248, true }, + { 63263, true }, + { 63286, true }, + { 63296, true }, + { 63311, true }, + { 63321, true }, { 63341, true }, - { 63361, true }, - { 63373, true }, - { 63386, true }, - { 63400, true }, - { 63417, true }, - { 63434, false }, - { 63447, true }, - { 63464, true }, - { 63473, true }, - { 63484, true }, - { 63498, true }, - { 63509, true }, - { 63523, true }, - { 63540, true }, - { 63549, true }, - { 63563, false }, - { 63591, true }, - { 63600, true }, - { 63609, true }, + { 63366, true }, + { 63390, true }, + { 63399, true }, + { 63416, true }, + { 63437, true }, + { 63457, true }, + { 63469, true }, + { 63482, true }, + { 63496, true }, + { 63513, true }, + { 63530, false }, + { 63543, true }, + { 63560, true }, + { 63569, true }, + { 63580, true }, + { 63594, true }, + { 63605, true }, { 63619, true }, - { 63635, true }, + { 63636, true }, { 63645, true }, - { 63657, true }, - { 63671, false }, - { 63685, false }, - { 63700, true }, - { 63724, true }, - { 63745, true }, - { 63767, true }, - { 63781, true }, - { 63791, true }, - { 63803, true }, - { 63817, true }, - { 63836, true }, - { 63853, true }, - { 63866, true }, - { 63878, true }, - { 63891, true }, - { 63903, true }, - { 63915, false }, - { 63939, true }, - { 63952, true }, + { 63659, false }, + { 63687, true }, + { 63696, true }, + { 63705, true }, + { 63715, true }, + { 63731, true }, + { 63741, true }, + { 63753, true }, + { 63767, false }, + { 63781, false }, + { 63796, true }, + { 63820, true }, + { 63841, true }, + { 63863, true }, + { 63877, true }, + { 63887, true }, + { 63899, true }, + { 63913, true }, + { 63932, true }, + { 63949, true }, { 63962, true }, - { 63981, true }, - { 64005, true }, - { 64021, true }, - { 64031, true }, - { 64047, true }, - { 64063, true }, - { 64082, true }, - { 64099, true }, - { 64116, true }, - { 64124, false }, - { 64150, true }, - { 64167, true }, - { 64181, true }, - { 64192, true }, - { 64204, true }, - { 64224, true }, - { 64240, true }, - { 64258, true }, - { 64268, true }, - { 64283, true }, + { 63974, true }, + { 63987, true }, + { 63999, true }, + { 64011, false }, + { 64035, true }, + { 64048, true }, + { 64058, true }, + { 64077, true }, + { 64101, true }, + { 64117, true }, + { 64127, true }, + { 64143, true }, + { 64159, true }, + { 64178, true }, + { 64196, true }, + { 64213, true }, + { 64230, true }, + { 64238, false }, + { 64264, true }, + { 64281, true }, { 64295, true }, - { 64310, true }, - { 64328, true }, - { 64346, true }, - { 64365, true }, - { 64375, true }, - { 64389, true }, - { 64399, true }, - { 64410, true }, - { 64429, true }, - { 64445, true }, - { 64464, true }, - { 64476, true }, - { 64487, true }, - { 64497, true }, + { 64306, true }, + { 64318, true }, + { 64338, true }, + { 64354, true }, + { 64372, true }, + { 64382, true }, + { 64397, true }, + { 64409, true }, + { 64424, true }, + { 64442, true }, + { 64460, true }, + { 64479, true }, + { 64489, true }, + { 64503, true }, { 64513, true }, - { 64526, true }, - { 64550, true }, - { 64574, true }, - { 64589, true }, - { 64609, true }, - { 64622, false }, - { 64634, true }, - { 64644, true }, - { 64659, true }, - { 64679, true }, - { 64689, true }, - { 64699, false }, - { 64716, true }, - { 64724, true }, - { 64740, true }, - { 64755, true }, - { 64771, true }, - { 64787, true }, - { 64801, true }, - { 64815, true }, - { 64829, true }, - { 64841, true }, - { 64861, true }, - { 64877, true }, - { 64894, false }, - { 64904, true }, - { 64917, true }, - { 64928, true }, - { 64942, true }, + { 64524, true }, + { 64543, true }, + { 64559, true }, + { 64578, true }, + { 64590, true }, + { 64601, true }, + { 64611, true }, + { 64627, true }, + { 64640, true }, + { 64664, true }, + { 64688, true }, + { 64703, true }, + { 64723, true }, + { 64736, false }, + { 64748, true }, + { 64758, true }, + { 64773, true }, + { 64793, true }, + { 64803, true }, + { 64813, false }, + { 64830, true }, + { 64838, true }, + { 64854, true }, + { 64869, true }, + { 64885, true }, + { 64901, true }, + { 64915, true }, + { 64929, true }, + { 64943, true }, { 64955, true }, - { 64963, true }, - { 64973, true }, - { 64987, true }, - { 64999, true }, - { 65015, true }, - { 65026, true }, - { 65050, true }, - { 65075, true }, - { 65088, true }, + { 64975, true }, + { 64991, true }, + { 65008, true }, + { 65018, true }, + { 65031, true }, + { 65042, true }, + { 65056, true }, + { 65069, true }, + { 65077, true }, + { 65087, true }, { 65101, true }, { 65113, true }, - { 65132, true }, - { 65147, true }, - { 65160, true }, - { 65173, true }, - { 65186, true }, - { 65206, true }, - { 65221, true }, - { 65232, true }, - { 65250, true }, - { 65259, true }, - { 65270, true }, - { 65281, true }, - { 65292, true }, - { 65303, true }, - { 65313, true }, - { 65327, true }, - { 65339, true }, - { 65349, true }, - { 65363, true }, - { 65397, true }, - { 65407, true }, - { 65419, true }, - { 65428, true }, - { 65439, false }, - { 65452, true }, - { 65474, true }, - { 65481, true }, - { 65493, true }, - { 65509, true }, - { 65526, true }, - { 65548, true }, - { 65561, false }, - { 65581, true }, - { 65594, true }, - { 65606, true }, - { 65619, true }, - { 65634, true }, - { 65653, true }, - { 65664, true }, - { 65688, false }, - { 65709, true }, - { 65719, true }, - { 65728, true }, - { 65743, true }, - { 65756, true }, + { 65129, true }, + { 65140, true }, + { 65164, true }, + { 65189, true }, + { 65202, true }, + { 65215, true }, + { 65227, true }, + { 65246, true }, + { 65261, true }, + { 65274, true }, + { 65287, true }, + { 65300, true }, + { 65320, true }, + { 65335, true }, + { 65346, true }, + { 65364, true }, + { 65373, true }, + { 65384, true }, + { 65395, true }, + { 65406, true }, + { 65417, true }, + { 65427, true }, + { 65441, true }, + { 65453, true }, + { 65463, true }, + { 65477, true }, + { 65511, true }, + { 65521, true }, + { 65533, true }, + { 65542, true }, + { 65553, false }, + { 65566, true }, + { 65588, true }, + { 65595, true }, + { 65607, true }, + { 65623, true }, + { 65640, true }, + { 65662, true }, + { 65675, false }, + { 65695, true }, + { 65708, true }, + { 65720, true }, + { 65733, true }, + { 65748, true }, { 65767, true }, - { 65776, true }, - { 65789, true }, - { 65802, true }, - { 65811, true }, + { 65778, true }, + { 65802, false }, { 65823, true }, - { 65832, true }, - { 65841, true }, - { 65855, true }, - { 65873, true }, - { 65895, true }, - { 65915, false }, - { 65940, true }, - { 65953, true }, - { 65962, true }, - { 65983, true }, - { 66004, true }, - { 66014, true }, - { 66026, true }, - { 66051, true }, + { 65833, true }, + { 65842, true }, + { 65857, true }, + { 65870, true }, + { 65881, true }, + { 65890, true }, + { 65903, true }, + { 65916, true }, + { 65925, true }, + { 65937, true }, + { 65946, true }, + { 65955, true }, + { 65969, true }, + { 65987, true }, + { 66009, true }, + { 66029, false }, + { 66054, true }, { 66067, true }, - { 66078, true }, - { 66091, true }, - { 66106, true }, - { 66120, true }, - { 66129, true }, - { 66147, true }, + { 66076, true }, + { 66097, true }, + { 66118, true }, + { 66128, true }, + { 66140, true }, + { 66165, true }, { 66181, true }, - { 66191, true }, - { 66209, true }, + { 66192, true }, + { 66205, true }, { 66220, true }, - { 66246, false }, + { 66234, true }, + { 66243, true }, { 66261, true }, - { 66276, true }, - { 66286, true }, { 66295, true }, - { 66307, true }, - { 66317, true }, - { 66326, true }, - { 66340, false }, - { 66351, true }, - { 66359, true }, - { 66368, true }, - { 66376, true }, - { 66387, true }, - { 66396, true }, - { 66408, true }, - { 66422, true }, - { 66436, true }, - { 66456, true }, - { 66468, true }, - { 66486, true }, - { 66502, true }, - { 66516, true }, - { 66533, true }, - { 66546, true }, - { 66556, true }, + { 66305, true }, + { 66323, true }, + { 66334, true }, + { 66360, false }, + { 66375, true }, + { 66390, true }, + { 66400, true }, + { 66409, true }, + { 66421, true }, + { 66431, true }, + { 66440, true }, + { 66454, false }, + { 66465, true }, + { 66473, true }, + { 66482, true }, + { 66490, true }, + { 66501, true }, + { 66510, true }, + { 66522, true }, + { 66536, true }, + { 66550, true }, { 66570, true }, { 66582, true }, - { 66596, true }, - { 66609, true }, - { 66622, true }, - { 66635, true }, - { 66645, true }, - { 66652, true }, - { 66661, true }, - { 66685, true }, - { 66704, true }, - { 66718, true }, - { 66732, true }, - { 66745, true }, - { 66761, true }, - { 66784, true }, - { 66793, true }, - { 66807, true }, + { 66600, true }, + { 66616, true }, + { 66630, true }, + { 66647, true }, + { 66660, true }, + { 66670, true }, + { 66684, true }, + { 66696, true }, + { 66710, true }, + { 66723, true }, + { 66736, true }, + { 66749, true }, + { 66759, true }, + { 66766, true }, + { 66775, true }, + { 66794, true }, + { 66808, true }, { 66822, true }, - { 66836, true }, - { 66850, true }, - { 66864, true }, - { 66878, true }, - { 66892, true }, - { 66906, true }, - { 66920, true }, - { 66937, true }, - { 66957, true }, - { 66969, true }, - { 66984, true }, - { 67003, true }, - { 67017, true }, - { 67035, true }, - { 67053, true }, - { 67060, true }, + { 66835, true }, + { 66851, true }, + { 66874, true }, + { 66883, true }, + { 66897, true }, + { 66912, true }, + { 66926, true }, + { 66940, true }, + { 66954, true }, + { 66968, true }, + { 66982, true }, + { 66996, true }, + { 67010, true }, + { 67027, true }, + { 67047, true }, + { 67059, true }, { 67074, true }, - { 67086, true }, - { 67103, true }, - { 67121, true }, - { 67140, true }, + { 67093, true }, + { 67107, true }, + { 67125, true }, + { 67143, true }, { 67150, true }, - { 67170, true }, - { 67183, true }, + { 67164, true }, + { 67176, true }, { 67193, true }, - { 67207, false }, - { 67224, true }, - { 67237, true }, - { 67250, true }, - { 67263, true }, + { 67211, true }, + { 67230, true }, + { 67240, true }, + { 67260, true }, { 67273, true }, - { 67285, true }, - { 67297, true }, - { 67310, false }, - { 67325, true }, - { 67338, true }, - { 67351, true }, - { 67365, true }, - { 67382, true }, - { 67394, true }, - { 67413, true }, - { 67425, true }, - { 67437, true }, - { 67446, true }, - { 67457, true }, - { 67471, true }, + { 67283, true }, + { 67297, false }, + { 67314, true }, + { 67327, true }, + { 67340, true }, + { 67353, true }, + { 67363, true }, + { 67375, true }, + { 67387, true }, + { 67400, false }, + { 67415, true }, + { 67428, true }, + { 67441, true }, + { 67455, true }, + { 67472, true }, { 67484, true }, - { 67509, true }, - { 67532, false }, - { 67542, true }, - { 67553, true }, - { 67566, true }, - { 67577, true }, - { 67586, true }, - { 67596, true }, - { 67607, true }, - { 67627, true }, - { 67647, true }, - { 67665, true }, - { 67684, true }, - { 67702, true }, - { 67719, true }, - { 67731, true }, - { 67745, true }, - { 67768, true }, - { 67778, true }, - { 67793, true }, - { 67807, true }, - { 67823, true }, - { 67836, true }, + { 67503, true }, + { 67515, true }, + { 67527, true }, + { 67536, true }, + { 67547, true }, + { 67561, true }, + { 67574, true }, + { 67599, true }, + { 67622, false }, + { 67632, true }, + { 67643, true }, + { 67656, true }, + { 67667, true }, + { 67676, true }, + { 67686, true }, + { 67697, true }, + { 67717, true }, + { 67737, true }, + { 67755, true }, + { 67774, true }, + { 67797, true }, + { 67815, true }, + { 67832, true }, { 67844, true }, - { 67856, true }, - { 67870, true }, - { 67892, true }, - { 67899, true }, - { 67912, true }, - { 67925, true }, - { 67945, true }, - { 67963, true }, - { 67985, true }, - { 67998, true }, - { 68013, true }, - { 68024, true }, + { 67858, true }, + { 67881, true }, + { 67891, true }, + { 67906, true }, + { 67920, true }, + { 67936, true }, + { 67949, true }, + { 67957, true }, + { 67969, true }, + { 67983, true }, + { 68005, true }, + { 68012, true }, + { 68025, true }, { 68038, true }, - { 68051, true }, - { 68064, true }, - { 68083, true }, - { 68099, true }, - { 68118, true }, + { 68058, true }, + { 68076, true }, + { 68098, true }, + { 68111, true }, + { 68126, true }, { 68137, true }, - { 68152, true }, + { 68151, true }, { 68164, true }, - { 68171, true }, - { 68187, true }, - { 68214, true }, - { 68242, true }, - { 68266, true }, - { 68285, true }, - { 68302, true }, - { 68323, true }, - { 68342, true }, - { 68360, true }, - { 68378, true }, - { 68390, true }, - { 68399, true }, - { 68422, true }, + { 68177, true }, + { 68196, true }, + { 68212, true }, + { 68231, true }, + { 68250, true }, + { 68265, true }, + { 68277, true }, + { 68284, true }, + { 68300, true }, + { 68327, true }, + { 68355, true }, + { 68379, true }, + { 68398, true }, + { 68415, true }, { 68436, true }, - { 68449, true }, - { 68461, true }, - { 68471, true }, - { 68482, false }, - { 68492, true }, + { 68455, true }, + { 68473, true }, + { 68491, true }, + { 68503, true }, { 68512, true }, - { 68525, true }, - { 68534, true }, - { 68546, true }, + { 68535, true }, + { 68549, true }, { 68562, true }, - { 68572, true }, - { 68579, true }, - { 68596, true }, - { 68609, true }, - { 68618, true }, - { 68631, true }, - { 68644, true }, - { 68662, true }, - { 68678, true }, - { 68694, true }, - { 68705, true }, - { 68719, true }, - { 68736, true }, - { 68746, true }, - { 68773, true }, - { 68808, true }, - { 68820, false }, - { 68833, true }, - { 68846, true }, - { 68865, true }, - { 68890, true }, - { 68912, true }, - { 68927, true }, - { 68947, false }, - { 68957, true }, - { 68976, true }, - { 68993, true }, - { 69010, true }, - { 69020, true }, - { 69030, true }, - { 69045, true }, - { 69058, true }, - { 69073, true }, + { 68574, true }, + { 68584, true }, + { 68595, false }, + { 68605, true }, + { 68625, true }, + { 68638, true }, + { 68647, true }, + { 68659, true }, + { 68675, true }, + { 68685, true }, + { 68692, true }, + { 68709, true }, + { 68722, true }, + { 68731, true }, + { 68744, true }, + { 68757, true }, + { 68775, true }, + { 68791, true }, + { 68807, true }, + { 68818, true }, + { 68832, true }, + { 68849, true }, + { 68859, true }, + { 68886, true }, + { 68921, true }, + { 68933, false }, + { 68946, true }, + { 68959, true }, + { 68978, true }, + { 69003, true }, + { 69025, true }, + { 69040, true }, + { 69060, false }, + { 69070, true }, { 69089, true }, - { 69102, true }, - { 69115, true }, - { 69129, true }, - { 69144, true }, + { 69106, true }, + { 69123, true }, + { 69133, true }, + { 69143, true }, { 69156, true }, - { 69169, true }, - { 69188, true }, - { 69212, true }, - { 69234, true }, + { 69171, true }, + { 69184, true }, + { 69199, true }, + { 69215, true }, + { 69228, true }, + { 69241, true }, { 69255, true }, - { 69280, true }, - { 69303, true }, - { 69323, true }, - { 69334, true }, - { 69346, true }, - { 69358, true }, - { 69378, true }, - { 69395, true }, - { 69416, true }, - { 69434, true }, - { 69457, true }, - { 69473, true }, - { 69493, true }, - { 69506, true }, + { 69270, true }, + { 69282, true }, + { 69295, true }, + { 69314, true }, + { 69338, true }, + { 69360, true }, + { 69381, true }, + { 69406, true }, + { 69429, true }, + { 69449, true }, + { 69460, true }, + { 69472, true }, + { 69484, true }, + { 69504, true }, { 69521, true }, - { 69531, true }, - { 69548, true }, - { 69559, true }, - { 69578, true }, - { 69588, true }, - { 69598, true }, - { 69606, true }, - { 69620, true }, - { 69633, true }, - { 69646, true }, - { 69655, true }, - { 69662, true }, - { 69669, false }, + { 69542, true }, + { 69560, true }, + { 69583, true }, + { 69599, true }, + { 69619, true }, + { 69632, true }, + { 69647, true }, + { 69657, true }, + { 69674, true }, { 69685, true }, - { 69694, true }, - { 69711, true }, - { 69726, true }, - { 69740, true }, - { 69752, true }, - { 69764, true }, - { 69787, true }, - { 69801, true }, - { 69816, true }, - { 69832, true }, - { 69844, true }, - { 69860, true }, - { 69877, true }, - { 69895, true }, - { 69916, true }, - { 69933, true }, - { 69950, true }, - { 69967, true }, - { 69984, true }, - { 70001, true }, - { 70018, true }, - { 70034, true }, - { 70048, true }, - { 70073, true }, - { 70084, true }, - { 70100, true }, - { 70116, true }, - { 70132, true }, - { 70151, false }, - { 70164, true }, - { 70174, false }, - { 70190, true }, - { 70204, true }, - { 70217, true }, - { 70227, true }, - { 70238, true }, - { 70252, true }, - { 70264, true }, - { 70278, true }, - { 70288, false }, - { 70298, true }, - { 70307, true }, - { 70317, true }, - { 70336, true }, - { 70345, true }, - { 70361, false }, - { 70381, true }, + { 69704, true }, + { 69714, true }, + { 69724, true }, + { 69732, true }, + { 69746, true }, + { 69759, true }, + { 69772, true }, + { 69781, true }, + { 69788, true }, + { 69795, false }, + { 69811, true }, + { 69820, true }, + { 69837, true }, + { 69852, true }, + { 69866, true }, + { 69878, true }, + { 69890, true }, + { 69913, true }, + { 69927, true }, + { 69942, true }, + { 69958, true }, + { 69970, true }, + { 69986, true }, + { 70003, true }, + { 70021, true }, + { 70042, true }, + { 70059, true }, + { 70076, true }, + { 70093, true }, + { 70110, true }, + { 70127, true }, + { 70144, true }, + { 70160, true }, + { 70174, true }, + { 70199, true }, + { 70210, true }, + { 70226, true }, + { 70242, true }, + { 70258, true }, + { 70277, false }, + { 70290, true }, + { 70300, false }, + { 70316, true }, + { 70330, true }, + { 70343, true }, + { 70353, true }, + { 70364, true }, + { 70378, true }, + { 70390, true }, { 70404, true }, - { 70416, true }, + { 70414, false }, + { 70424, true }, { 70433, true }, - { 70452, true }, - { 70469, true }, - { 70480, false }, - { 70492, true }, - { 70503, true }, - { 70518, true }, - { 70536, true }, - { 70546, true }, - { 70554, true }, - { 70568, true }, - { 70581, true }, - { 70596, true }, - { 70610, true }, - { 70625, false }, - { 70639, true }, - { 70651, true }, - { 70665, true }, - { 70679, true }, - { 70689, true }, - { 70705, true }, - { 70721, true }, - { 70740, true }, - { 70759, false }, - { 70788, true }, - { 70802, true }, - { 70816, true }, - { 70837, true }, - { 70855, true }, - { 70870, true }, - { 70883, true }, - { 70901, true }, - { 70921, true }, - { 70933, true }, - { 70948, true }, - { 70971, true }, - { 70995, true }, - { 71019, true }, - { 71043, true }, - { 71053, true }, - { 71067, true }, - { 71089, true }, + { 70443, true }, + { 70462, true }, + { 70471, true }, + { 70487, false }, + { 70507, true }, + { 70530, true }, + { 70542, true }, + { 70559, true }, + { 70578, true }, + { 70595, true }, + { 70606, false }, + { 70618, true }, + { 70629, true }, + { 70644, true }, + { 70662, true }, + { 70672, true }, + { 70680, true }, + { 70694, true }, + { 70707, true }, + { 70722, true }, + { 70736, true }, + { 70751, false }, + { 70765, true }, + { 70777, true }, + { 70791, true }, + { 70805, true }, + { 70815, true }, + { 70831, true }, + { 70847, true }, + { 70866, true }, + { 70885, false }, + { 70914, true }, + { 70928, true }, + { 70942, true }, + { 70963, true }, + { 70981, true }, + { 70996, true }, + { 71009, true }, + { 71027, true }, + { 71047, true }, + { 71059, true }, + { 71074, true }, + { 71097, true }, { 71121, true }, - { 71132, true }, - { 71140, true }, - { 71150, true }, - { 71162, true }, - { 71177, true }, - { 71191, false }, - { 71211, true }, - { 71222, true }, - { 71240, true }, - { 71249, true }, - { 71256, true }, - { 71267, true }, + { 71145, true }, + { 71169, true }, + { 71179, true }, + { 71193, true }, + { 71215, true }, + { 71247, true }, + { 71258, true }, + { 71266, true }, { 71276, true }, - { 71289, true }, - { 71307, true }, - { 71330, true }, - { 71345, false }, - { 71356, false }, - { 71368, false }, - { 71379, true }, - { 71395, true }, - { 71421, false }, - { 71437, true }, - { 71447, true }, - { 71455, true }, - { 71464, true }, - { 71476, true }, - { 71488, false }, - { 71500, true }, - { 71513, true }, - { 71527, true }, - { 71539, true }, - { 71556, true }, - { 71576, true }, - { 71587, true }, - { 71603, true }, - { 71615, true }, - { 71632, true }, - { 71641, true }, - { 71654, true }, - { 71667, true }, - { 71685, true }, - { 71698, true }, - { 71722, true }, - { 71736, true }, - { 71753, true }, - { 71768, true }, + { 71288, true }, + { 71303, true }, + { 71317, false }, + { 71337, true }, + { 71348, true }, + { 71366, true }, + { 71375, true }, + { 71382, true }, + { 71393, true }, + { 71402, true }, + { 71415, true }, + { 71433, true }, + { 71456, true }, + { 71471, false }, + { 71482, false }, + { 71494, false }, + { 71505, true }, + { 71521, true }, + { 71547, false }, + { 71563, true }, + { 71573, true }, + { 71581, true }, + { 71590, true }, + { 71602, true }, + { 71614, false }, + { 71626, true }, + { 71639, true }, + { 71653, true }, + { 71665, true }, + { 71682, true }, + { 71702, true }, + { 71713, true }, + { 71729, true }, + { 71741, true }, + { 71758, true }, + { 71767, true }, { 71780, true }, - { 71792, true }, - { 71807, true }, + { 71793, true }, + { 71811, true }, { 71824, true }, - { 71832, true }, - { 71851, true }, - { 71868, true }, - { 71885, true }, - { 71900, true }, - { 71912, true }, - { 71937, true }, - { 71952, false }, - { 71965, false }, + { 71848, true }, + { 71862, true }, + { 71879, true }, + { 71894, true }, + { 71906, true }, + { 71918, true }, + { 71933, true }, + { 71950, true }, + { 71958, true }, { 71977, true }, - { 71997, true }, - { 72010, true }, - { 72028, true }, - { 72040, true }, - { 72064, true }, - { 72077, true }, - { 72096, true }, - { 72108, true }, - { 72120, true }, - { 72144, true }, - { 72165, true }, - { 72179, true }, - { 72193, true }, - { 72206, false }, + { 71994, true }, + { 72011, true }, + { 72026, true }, + { 72038, true }, + { 72063, true }, + { 72078, false }, + { 72091, false }, + { 72103, true }, + { 72123, true }, + { 72136, true }, + { 72154, true }, + { 72166, true }, + { 72190, true }, + { 72203, true }, { 72222, true }, { 72234, true }, - { 72247, true }, - { 72265, true }, - { 72274, true }, - { 72284, true }, - { 72295, true }, - { 72307, true }, - { 72317, true }, - { 72328, true }, - { 72340, true }, - { 72349, true }, - { 72370, true }, + { 72246, true }, + { 72270, true }, + { 72291, true }, + { 72305, true }, + { 72319, true }, + { 72332, false }, + { 72348, true }, + { 72360, true }, + { 72373, true }, { 72391, true }, - { 72401, true }, - { 72415, true }, - { 72427, true }, + { 72400, true }, + { 72410, true }, + { 72421, true }, + { 72433, true }, { 72443, true }, - { 72465, true }, - { 72484, true }, - { 72503, true }, - { 72513, false }, + { 72454, true }, + { 72466, true }, + { 72475, true }, + { 72496, true }, + { 72517, true }, { 72527, true }, - { 72540, true }, - { 72561, true }, - { 72574, true }, - { 72587, true }, - { 72595, false }, - { 72612, true }, - { 72628, true }, - { 72647, true }, + { 72541, true }, + { 72553, true }, + { 72569, true }, + { 72591, true }, + { 72610, true }, + { 72629, true }, + { 72639, false }, + { 72653, true }, { 72666, true }, - { 72680, true }, - { 72688, true }, - { 72702, true }, + { 72687, true }, + { 72700, true }, + { 72713, true }, { 72721, false }, - { 72739, true }, - { 72748, true }, - { 72761, true }, - { 72776, true }, - { 72796, false }, - { 72809, true }, - { 72826, true }, - { 72839, true }, - { 72852, true }, - { 72876, true }, - { 72903, true }, - { 72916, false }, - { 72930, true }, - { 72942, true }, - { 72955, true }, - { 72967, true }, - { 72982, true }, - { 73000, true }, - { 73013, true }, - { 73036, true }, - { 73059, false }, - { 73070, true }, - { 73086, true }, - { 73104, true }, - { 73124, true }, - { 73146, true }, + { 72738, true }, + { 72754, true }, + { 72773, true }, + { 72792, true }, + { 72806, true }, + { 72814, true }, + { 72828, true }, + { 72847, false }, + { 72865, true }, + { 72874, true }, + { 72887, true }, + { 72902, true }, + { 72922, false }, + { 72935, true }, + { 72952, true }, + { 72965, true }, + { 72978, true }, + { 73002, true }, + { 73029, true }, + { 73042, false }, + { 73056, true }, + { 73068, true }, + { 73081, true }, + { 73093, true }, + { 73108, true }, + { 73126, true }, + { 73139, true }, { 73162, true }, - { 73179, true }, - { 73196, true }, - { 73213, true }, - { 73231, true }, - { 73244, true }, - { 73261, true }, + { 73185, true }, + { 73201, true }, + { 73221, true }, + { 73243, true }, + { 73259, true }, { 73276, true }, - { 73290, true }, - { 73301, true }, - { 73317, true }, - { 73326, true }, - { 73345, true }, - { 73355, true }, - { 73363, true }, - { 73372, true }, - { 73383, true }, + { 73293, true }, + { 73310, true }, + { 73328, true }, + { 73341, true }, + { 73358, true }, + { 73373, true }, + { 73387, true }, { 73398, true }, - { 73413, true }, - { 73431, true }, - { 73448, false }, - { 73459, true }, - { 73475, true }, - { 73489, true }, - { 73501, true }, - { 73509, true }, - { 73529, true }, - { 73539, true }, - { 73548, true }, - { 73564, true }, - { 73574, true }, - { 73580, true }, - { 73592, true }, - { 73614, true }, - { 73628, true }, - { 73643, true }, - { 73654, true }, - { 73667, true }, - { 73683, true }, - { 73701, false }, - { 73714, true }, - { 73728, true }, - { 73737, true }, - { 73748, true }, - { 73759, true }, - { 73770, true }, - { 73782, true }, - { 73801, true }, - { 73809, true }, - { 73826, true }, - { 73835, true }, - { 73844, true }, - { 73863, true }, - { 73874, true }, - { 73890, true }, - { 73897, true }, - { 73909, true }, - { 73930, true }, - { 73947, true }, + { 73414, true }, + { 73423, true }, + { 73442, true }, + { 73452, true }, + { 73460, true }, + { 73469, true }, + { 73480, true }, + { 73495, true }, + { 73510, true }, + { 73528, true }, + { 73545, false }, + { 73556, true }, + { 73572, true }, + { 73586, true }, + { 73598, true }, + { 73606, true }, + { 73626, true }, + { 73636, true }, + { 73645, true }, + { 73661, true }, + { 73671, true }, + { 73677, true }, + { 73689, true }, + { 73711, true }, + { 73725, true }, + { 73740, true }, + { 73751, true }, + { 73764, true }, + { 73780, true }, + { 73798, false }, + { 73811, true }, + { 73825, true }, + { 73834, true }, + { 73845, true }, + { 73856, true }, + { 73867, true }, + { 73879, true }, + { 73898, true }, + { 73906, true }, + { 73923, true }, + { 73932, true }, + { 73941, true }, { 73960, true }, { 73971, true }, - { 73996, true }, - { 74011, true }, - { 74030, true }, - { 74041, true }, - { 74056, true }, + { 73987, true }, + { 73994, true }, + { 74006, true }, + { 74027, true }, + { 74044, true }, + { 74057, true }, { 74068, true }, - { 74079, true }, - { 74094, true }, - { 74110, true }, - { 74124, true }, + { 74093, true }, + { 74108, true }, + { 74127, true }, { 74138, true }, - { 74155, true }, - { 74175, true }, - { 74184, true }, - { 74198, true }, - { 74209, true }, - { 74229, false }, - { 74253, true }, - { 74264, false }, + { 74153, true }, + { 74165, true }, + { 74176, true }, + { 74191, true }, + { 74207, true }, + { 74221, true }, + { 74235, true }, + { 74252, true }, { 74272, true }, - { 74290, true }, - { 74308, true }, - { 74330, true }, - { 74352, true }, - { 74377, true }, - { 74393, true }, + { 74281, true }, + { 74295, true }, + { 74306, true }, + { 74326, false }, + { 74350, true }, + { 74361, false }, + { 74369, true }, + { 74387, true }, { 74405, true }, - { 74417, true }, - { 74438, true }, - { 74452, true }, - { 74465, false }, - { 74482, true }, - { 74491, true }, - { 74513, true }, - { 74533, true }, - { 74560, true }, + { 74427, true }, + { 74449, true }, + { 74474, true }, + { 74490, true }, + { 74502, true }, + { 74514, true }, + { 74535, true }, + { 74549, true }, + { 74562, false }, { 74579, true }, - { 74591, true }, - { 74611, true }, - { 74619, true }, - { 74628, true }, - { 74645, true }, - { 74660, true }, - { 74675, true }, - { 74704, true }, - { 74726, true }, - { 74744, true }, - { 74758, true }, - { 74773, true }, - { 74786, true }, - { 74799, true }, - { 74809, true }, - { 74825, true }, - { 74843, true }, - { 74862, true }, - { 74880, true }, - { 74898, true }, - { 74916, true }, - { 74923, false }, - { 74943, true }, - { 74952, true }, - { 74967, true }, - { 74985, true }, - { 74997, true }, - { 75006, false }, - { 75016, true }, - { 75024, true }, - { 75038, true }, - { 75055, true }, - { 75066, true }, - { 75076, true }, - { 75093, true }, - { 75115, true }, - { 75130, true }, - { 75147, true }, - { 75157, true }, - { 75170, true }, - { 75185, true }, - { 75201, true }, + { 74588, true }, + { 74610, true }, + { 74630, true }, + { 74657, true }, + { 74676, true }, + { 74688, true }, + { 74708, true }, + { 74716, true }, + { 74725, true }, + { 74742, true }, + { 74757, true }, + { 74772, true }, + { 74801, true }, + { 74823, true }, + { 74841, true }, + { 74855, true }, + { 74870, true }, + { 74883, true }, + { 74896, true }, + { 74906, true }, + { 74922, true }, + { 74940, true }, + { 74959, true }, + { 74977, true }, + { 74995, true }, + { 75013, true }, + { 75020, false }, + { 75040, true }, + { 75049, true }, + { 75064, true }, + { 75082, true }, + { 75094, true }, + { 75103, false }, + { 75113, true }, + { 75121, true }, + { 75135, true }, + { 75152, true }, + { 75163, true }, + { 75173, true }, + { 75190, true }, { 75212, true }, - { 75224, true }, - { 75246, true }, - { 75259, true }, - { 75270, true }, - { 75286, true }, - { 75302, true }, - { 75312, true }, - { 75324, true }, - { 75332, true }, - { 75351, true }, - { 75370, true }, + { 75227, true }, + { 75244, true }, + { 75254, true }, + { 75267, true }, + { 75282, true }, + { 75298, true }, + { 75309, true }, + { 75321, true }, + { 75343, true }, + { 75356, true }, + { 75367, true }, { 75383, true }, - { 75400, true }, - { 75412, true }, - { 75426, true }, - { 75440, true }, - { 75452, true }, - { 75465, true }, - { 75479, true }, - { 75504, true }, - { 75518, true }, - { 75540, true }, - { 75556, true }, - { 75575, true }, - { 75588, true }, - { 75605, true }, - { 75623, true }, - { 75638, true }, + { 75399, true }, + { 75409, true }, + { 75421, true }, + { 75429, true }, + { 75448, true }, + { 75467, true }, + { 75480, true }, + { 75497, true }, + { 75509, true }, + { 75523, true }, + { 75537, true }, + { 75549, true }, + { 75562, true }, + { 75576, true }, + { 75601, true }, + { 75615, true }, + { 75637, true }, { 75653, true }, { 75672, true }, { 75685, true }, - { 75710, true }, - { 75723, true }, - { 75734, true }, - { 75748, true }, - { 75761, true }, - { 75779, true }, - { 75798, true }, - { 75812, true }, - { 75828, true }, - { 75840, true }, - { 75852, true }, - { 75868, true }, - { 75884, true }, - { 75897, true }, - { 75913, true }, - { 75928, true }, - { 75943, true }, - { 75957, true }, - { 75975, true }, - { 76000, true }, - { 76019, true }, - { 76032, true }, - { 76042, true }, + { 75702, true }, + { 75720, true }, + { 75735, true }, + { 75750, true }, + { 75769, true }, + { 75782, true }, + { 75807, true }, + { 75820, true }, + { 75831, true }, + { 75845, true }, + { 75858, true }, + { 75876, true }, + { 75895, true }, + { 75909, true }, + { 75925, true }, + { 75937, true }, + { 75949, true }, + { 75965, true }, + { 75981, true }, + { 75994, true }, + { 76010, true }, + { 76025, true }, + { 76040, true }, { 76054, true }, - { 76064, true }, - { 76080, true }, - { 76088, true }, - { 76096, true }, - { 76109, true }, - { 76120, true }, - { 76131, true }, - { 76147, true }, - { 76158, true }, - { 76170, true }, - { 76180, true }, - { 76197, true }, - { 76215, false }, + { 76072, true }, + { 76097, true }, + { 76116, true }, + { 76129, true }, + { 76139, true }, + { 76151, true }, + { 76161, true }, + { 76177, true }, + { 76185, true }, + { 76193, true }, + { 76206, true }, + { 76217, true }, { 76228, true }, - { 76241, true }, - { 76250, true }, - { 76265, true }, - { 76282, true }, - { 76296, true }, - { 76314, true }, - { 76330, true }, - { 76339, true }, - { 76348, true }, - { 76363, true }, - { 76373, true }, - { 76383, true }, - { 76397, true }, + { 76244, true }, + { 76255, true }, + { 76267, true }, + { 76277, true }, + { 76294, false }, + { 76307, true }, + { 76320, true }, + { 76329, true }, + { 76344, true }, + { 76361, true }, + { 76375, true }, + { 76393, true }, { 76409, true }, - { 76426, true }, - { 76440, true }, - { 76448, true }, - { 76457, true }, - { 76469, false }, - { 76477, true }, - { 76503, true }, - { 76516, true }, - { 76530, true }, - { 76540, true }, - { 76555, true }, + { 76418, true }, + { 76427, true }, + { 76442, true }, + { 76452, true }, + { 76462, true }, + { 76476, true }, + { 76488, true }, + { 76505, true }, + { 76519, true }, + { 76527, true }, + { 76535, true }, + { 76544, true }, + { 76556, false }, { 76564, true }, - { 76575, true }, - { 76586, true }, - { 76597, true }, - { 76612, true }, - { 76625, true }, - { 76637, true }, - { 76650, true }, - { 76658, true }, - { 76672, true }, - { 76687, false }, - { 76701, true }, - { 76722, true }, - { 76733, true }, - { 76747, true }, - { 76765, true }, - { 76776, true }, - { 76790, true }, - { 76806, true }, - { 76819, true }, + { 76590, true }, + { 76603, true }, + { 76617, true }, + { 76627, true }, + { 76642, true }, + { 76651, true }, + { 76662, true }, + { 76673, true }, + { 76684, true }, + { 76699, true }, + { 76712, true }, + { 76724, true }, + { 76737, true }, + { 76745, true }, + { 76759, true }, + { 76774, false }, + { 76788, true }, + { 76809, true }, + { 76820, true }, { 76834, true }, - { 76847, true }, - { 76861, false }, + { 76852, true }, + { 76863, true }, { 76877, true }, - { 76888, true }, - { 76907, true }, + { 76893, true }, + { 76906, true }, { 76921, true }, - { 76944, true }, - { 76953, true }, - { 76967, true }, - { 76978, true }, - { 76989, true }, - { 76998, true }, - { 77016, true }, - { 77034, true }, - { 77053, true }, - { 77063, true }, + { 76934, true }, + { 76948, false }, + { 76964, true }, + { 76975, true }, + { 76994, true }, + { 77008, true }, + { 77031, true }, + { 77040, true }, + { 77054, true }, + { 77065, true }, { 77076, true }, - { 77087, true }, - { 77096, true }, - { 77113, true }, - { 77133, true }, - { 77147, true }, - { 77155, true }, + { 77085, true }, + { 77103, true }, + { 77121, true }, + { 77140, true }, + { 77150, true }, { 77163, true }, - { 77173, true }, - { 77180, true }, - { 77193, true }, - { 77204, true }, - { 77218, true }, - { 77232, true }, - { 77246, true }, - { 77256, true }, - { 77266, true }, - { 77279, true }, - { 77289, true }, - { 77301, true }, - { 77308, true }, - { 77318, true }, - { 77327, true }, - { 77342, true }, - { 77349, true }, - { 77365, true }, - { 77375, true }, - { 77387, true }, - { 77397, true }, - { 77408, true }, - { 77418, true }, - { 77425, true }, - { 77434, true }, - { 77446, true }, - { 77455, true }, - { 77464, true }, - { 77478, true }, - { 77496, true }, - { 77518, true }, - { 77531, true }, - { 77540, true }, - { 77554, true }, - { 77566, true }, - { 77576, false }, - { 77589, true }, - { 77598, true }, - { 77620, true }, - { 77643, true }, - { 77657, true }, - { 77672, true }, - { 77687, true }, - { 77703, true }, - { 77721, true }, - { 77731, true }, - { 77750, true }, - { 77769, true }, - { 77787, true }, - { 77807, true }, - { 77817, true }, - { 77828, true }, - { 77846, true }, - { 77858, true }, - { 77869, true }, - { 77885, true }, - { 77902, true }, - { 77917, true }, + { 77174, true }, + { 77183, true }, + { 77200, true }, + { 77220, true }, + { 77234, true }, + { 77242, true }, + { 77250, true }, + { 77260, true }, + { 77267, true }, + { 77280, true }, + { 77291, true }, + { 77305, true }, + { 77319, true }, + { 77333, true }, + { 77343, true }, + { 77353, true }, + { 77366, true }, + { 77376, true }, + { 77388, true }, + { 77395, true }, + { 77405, true }, + { 77414, true }, + { 77429, true }, + { 77436, true }, + { 77452, true }, + { 77462, true }, + { 77474, true }, + { 77484, true }, + { 77495, true }, + { 77505, true }, + { 77512, true }, + { 77521, true }, + { 77533, true }, + { 77542, true }, + { 77551, true }, + { 77565, true }, + { 77583, true }, + { 77605, true }, + { 77618, true }, + { 77627, true }, + { 77641, true }, + { 77653, true }, + { 77663, false }, + { 77676, true }, + { 77685, true }, + { 77707, true }, + { 77730, true }, + { 77744, true }, + { 77759, true }, + { 77774, true }, + { 77790, true }, + { 77808, true }, + { 77818, true }, + { 77837, true }, + { 77856, true }, + { 77874, true }, + { 77894, true }, + { 77904, true }, + { 77915, true }, { 77933, true }, - { 77948, true }, - { 77964, true }, + { 77945, true }, + { 77956, true }, { 77972, true }, - { 77981, true }, - { 77998, true }, - { 78010, true }, - { 78027, true }, - { 78045, true }, - { 78057, true }, - { 78074, true }, - { 78088, true }, - { 78097, true }, - { 78111, true }, - { 78126, true }, - { 78141, true }, - { 78152, true }, - { 78166, true }, - { 78181, true }, - { 78196, true }, - { 78211, true }, - { 78229, true }, - { 78242, true }, - { 78254, true }, - { 78271, true }, - { 78292, true }, - { 78316, true }, - { 78338, true }, + { 77989, true }, + { 78004, true }, + { 78020, true }, + { 78035, true }, + { 78051, true }, + { 78060, true }, + { 78077, true }, + { 78089, true }, + { 78106, true }, + { 78124, true }, + { 78136, true }, + { 78153, true }, + { 78167, true }, + { 78176, true }, + { 78190, true }, + { 78205, true }, + { 78220, true }, + { 78231, true }, + { 78245, true }, + { 78260, true }, + { 78275, true }, + { 78290, true }, + { 78308, true }, + { 78321, true }, + { 78333, true }, { 78350, true }, - { 78363, true }, - { 78378, true }, - { 78394, true }, - { 78408, true }, - { 78421, true }, - { 78439, true }, - { 78460, true }, - { 78473, false }, - { 78494, true }, - { 78507, true }, - { 78522, true }, - { 78536, true }, - { 78547, true }, - { 78572, true }, - { 78588, true }, - { 78605, true }, - { 78622, true }, - { 78634, false }, + { 78371, true }, + { 78395, true }, + { 78417, true }, + { 78429, true }, + { 78442, true }, + { 78457, true }, + { 78473, true }, + { 78487, true }, + { 78500, true }, + { 78518, true }, + { 78539, true }, + { 78552, false }, + { 78573, true }, + { 78586, true }, + { 78601, true }, + { 78615, true }, + { 78626, true }, { 78651, true }, - { 78664, false }, - { 78675, true }, - { 78690, true }, - { 78702, false }, - { 78713, true }, - { 78727, true }, - { 78737, true }, - { 78756, true }, - { 78765, true }, - { 78772, true }, - { 78783, true }, - { 78800, true }, - { 78812, true }, - { 78821, true }, - { 78832, true }, + { 78667, true }, + { 78684, true }, + { 78701, true }, + { 78713, false }, + { 78730, true }, + { 78743, false }, + { 78754, true }, + { 78769, true }, + { 78781, false }, + { 78792, true }, + { 78806, true }, + { 78816, true }, + { 78835, true }, { 78844, true }, - { 78851, false }, - { 78858, false }, - { 78867, true }, + { 78851, true }, + { 78862, true }, { 78879, true }, { 78891, true }, - { 78902, true }, + { 78900, true }, + { 78911, true }, { 78923, true }, - { 78949, true }, - { 78959, true }, - { 78968, true }, - { 78977, true }, - { 78984, true }, - { 78996, false }, - { 79008, false }, - { 79016, true }, + { 78930, false }, + { 78937, false }, + { 78946, true }, + { 78958, true }, + { 78970, true }, + { 78981, true }, + { 79002, true }, { 79028, true }, - { 79041, true }, - { 79055, false }, - { 79070, true }, - { 79084, true }, - { 79097, true }, - { 79109, true }, - { 79123, true }, - { 79143, true }, - { 79154, true }, - { 79164, true }, - { 79172, true }, - { 79185, true }, - { 79197, true }, - { 79208, true }, - { 79220, true }, - { 79230, false }, - { 79248, true }, - { 79266, true }, - { 79288, true }, - { 79310, true }, - { 79321, true }, - { 79336, true }, - { 79352, true }, - { 79363, true }, - { 79379, true }, - { 79403, true }, - { 79426, true }, - { 79444, true }, - { 79455, true }, - { 79473, true }, - { 79500, true }, - { 79520, true }, - { 79532, true }, - { 79550, true }, - { 79564, true }, - { 79580, true }, - { 79596, true }, - { 79609, true }, - { 79623, true }, - { 79637, true }, - { 79651, true }, + { 79038, true }, + { 79047, true }, + { 79056, true }, + { 79063, true }, + { 79075, false }, + { 79087, false }, + { 79095, true }, + { 79107, true }, + { 79120, true }, + { 79134, false }, + { 79149, true }, + { 79163, true }, + { 79176, true }, + { 79188, true }, + { 79202, true }, + { 79222, true }, + { 79233, true }, + { 79243, true }, + { 79251, true }, + { 79264, true }, + { 79276, true }, + { 79287, true }, + { 79299, true }, + { 79309, false }, + { 79327, true }, + { 79345, true }, + { 79367, true }, + { 79389, true }, + { 79400, true }, + { 79415, true }, + { 79431, true }, + { 79442, true }, + { 79458, true }, + { 79482, true }, + { 79505, true }, + { 79523, true }, + { 79534, true }, + { 79552, true }, + { 79579, true }, + { 79599, true }, + { 79611, true }, + { 79629, true }, + { 79643, true }, + { 79659, true }, { 79675, true }, - { 79703, false }, - { 79714, true }, - { 79725, true }, - { 79743, true }, - { 79761, true }, - { 79782, true }, - { 79803, true }, - { 79824, true }, - { 79838, true }, - { 79851, true }, - { 79870, true }, - { 79888, true }, - { 79898, true }, - { 79916, true }, - { 79934, true }, - { 79955, true }, - { 79975, true }, - { 79985, true }, - { 80007, true }, - { 80023, true }, - { 80044, true }, - { 80060, true }, - { 80071, true }, - { 80082, true }, - { 80092, true }, + { 79688, true }, + { 79702, true }, + { 79716, true }, + { 79730, true }, + { 79754, true }, + { 79782, false }, + { 79793, true }, + { 79804, true }, + { 79822, true }, + { 79840, true }, + { 79861, true }, + { 79882, true }, + { 79903, true }, + { 79917, true }, + { 79930, true }, + { 79949, true }, + { 79967, true }, + { 79977, true }, + { 79995, true }, + { 80013, true }, + { 80034, true }, + { 80054, true }, + { 80064, true }, + { 80086, true }, { 80102, true }, - { 80119, true }, - { 80133, false }, - { 80146, true }, - { 80158, true }, - { 80169, true }, - { 80186, true }, - { 80196, true }, - { 80210, true }, + { 80123, true }, + { 80139, true }, + { 80150, true }, + { 80161, true }, + { 80171, true }, + { 80181, true }, + { 80198, true }, + { 80212, false }, { 80225, true }, - { 80244, true }, - { 80262, true }, - { 80282, true }, - { 80293, true }, - { 80306, true }, - { 80319, true }, - { 80329, true }, - { 80344, true }, - { 80358, true }, - { 80370, true }, - { 80384, true }, - { 80399, true }, - { 80412, true }, - { 80429, true }, - { 80446, true }, - { 80460, true }, - { 80473, true }, - { 80487, true }, - { 80496, true }, - { 80515, false }, - { 80526, true }, - { 80537, true }, - { 80554, true }, - { 80563, true }, - { 80577, true }, - { 80585, true }, - { 80593, true }, - { 80600, true }, - { 80607, true }, + { 80237, true }, + { 80248, true }, + { 80265, true }, + { 80275, true }, + { 80289, true }, + { 80304, true }, + { 80323, true }, + { 80341, true }, + { 80361, true }, + { 80372, true }, + { 80385, true }, + { 80398, true }, + { 80408, true }, + { 80423, true }, + { 80437, true }, + { 80449, true }, + { 80463, true }, + { 80478, true }, + { 80491, true }, + { 80508, true }, + { 80525, true }, + { 80539, true }, + { 80552, true }, + { 80566, true }, + { 80575, true }, + { 80594, false }, + { 80605, true }, { 80616, true }, - { 80635, true }, - { 80650, true }, - { 80663, true }, - { 80684, true }, - { 80704, true }, - { 80721, true }, - { 80737, true }, - { 80757, true }, - { 80776, true }, - { 80797, true }, - { 80814, true }, - { 80827, true }, - { 80840, true }, - { 80854, true }, - { 80869, true }, - { 80881, true }, - { 80897, false }, - { 80911, false }, - { 80924, false }, - { 80931, true }, - { 80939, true }, - { 80951, true }, - { 80961, true }, - { 80976, true }, - { 80989, true }, - { 81000, true }, - { 81015, true }, - { 81037, true }, - { 81056, true }, + { 80633, true }, + { 80642, true }, + { 80656, true }, + { 80664, true }, + { 80672, true }, + { 80679, true }, + { 80686, true }, + { 80695, true }, + { 80714, true }, + { 80729, true }, + { 80742, true }, + { 80763, true }, + { 80783, true }, + { 80800, true }, + { 80816, true }, + { 80836, true }, + { 80855, true }, + { 80876, true }, + { 80893, true }, + { 80906, true }, + { 80919, true }, + { 80933, true }, + { 80948, true }, + { 80960, true }, + { 80976, false }, + { 80990, false }, + { 81003, false }, + { 81010, true }, + { 81018, true }, + { 81030, true }, + { 81040, true }, + { 81055, true }, { 81068, true }, - { 81080, true }, - { 81091, true }, - { 81106, true }, - { 81122, true }, - { 81140, true }, - { 81158, true }, - { 81166, true }, - { 81180, true }, - { 81190, true }, - { 81203, true }, - { 81210, true }, - { 81221, true }, - { 81233, false }, - { 81253, false }, + { 81079, true }, + { 81094, true }, + { 81116, true }, + { 81135, true }, + { 81147, true }, + { 81159, true }, + { 81170, true }, + { 81185, true }, + { 81201, true }, + { 81219, true }, + { 81237, true }, + { 81245, true }, + { 81259, true }, { 81269, true }, - { 81280, true }, - { 81295, true }, - { 81308, true }, - { 81321, true }, - { 81333, true }, - { 81346, true }, - { 81363, false }, - { 81374, false }, - { 81384, true }, - { 81399, true }, - { 81414, true }, - { 81430, true }, - { 81459, true }, + { 81282, true }, + { 81289, true }, + { 81300, true }, + { 81312, false }, + { 81332, false }, + { 81348, true }, + { 81359, true }, + { 81374, true }, + { 81387, true }, + { 81400, true }, + { 81412, true }, + { 81425, true }, + { 81442, false }, + { 81453, false }, + { 81463, true }, { 81478, true }, - { 81492, true }, + { 81493, true }, { 81509, true }, - { 81535, true }, - { 81550, true }, - { 81565, true }, - { 81580, true }, - { 81594, true }, - { 81613, true }, - { 81630, true }, - { 81646, true }, - { 81667, true }, - { 81684, true }, - { 81718, true }, - { 81742, true }, - { 81771, false }, - { 81786, true }, - { 81802, true }, - { 81827, true }, - { 81839, true }, - { 81853, true }, - { 81862, true }, - { 81882, false }, - { 81892, true }, - { 81907, true }, - { 81915, true }, - { 81924, true }, + { 81538, true }, + { 81557, true }, + { 81571, true }, + { 81588, true }, + { 81614, true }, + { 81629, true }, + { 81644, true }, + { 81659, true }, + { 81673, true }, + { 81692, true }, + { 81709, true }, + { 81725, true }, + { 81746, true }, + { 81763, true }, + { 81797, true }, + { 81821, true }, + { 81850, false }, + { 81865, true }, + { 81881, true }, + { 81906, true }, + { 81918, true }, { 81932, true }, - { 81940, true }, - { 81956, true }, - { 81978, true }, - { 81990, true }, - { 82002, true }, - { 82013, true }, - { 82023, true }, - { 82033, false }, - { 82045, true }, - { 82061, true }, - { 82077, true }, - { 82091, true }, - { 82107, true }, - { 82122, true }, - { 82136, true }, - { 82147, true }, - { 82162, true }, - { 82173, false }, - { 82185, true }, - { 82199, true }, - { 82210, true }, - { 82220, true }, - { 82237, true }, - { 82255, true }, - { 82265, true }, - { 82288, true }, - { 82302, true }, - { 82318, true }, - { 82331, true }, - { 82350, true }, - { 82363, true }, - { 82380, true }, - { 82398, false }, - { 82411, true }, - { 82432, true }, - { 82446, true }, - { 82456, true }, - { 82463, false }, - { 82472, true }, - { 82488, true }, - { 82504, true }, + { 81941, true }, + { 81961, false }, + { 81971, true }, + { 81986, true }, + { 81994, true }, + { 82003, true }, + { 82011, true }, + { 82019, true }, + { 82035, true }, + { 82057, true }, + { 82069, true }, + { 82081, true }, + { 82092, true }, + { 82102, true }, + { 82112, false }, + { 82124, true }, + { 82140, true }, + { 82156, true }, + { 82170, true }, + { 82186, true }, + { 82201, true }, + { 82215, true }, + { 82226, true }, + { 82241, true }, + { 82252, false }, + { 82264, true }, + { 82278, true }, + { 82289, true }, + { 82299, true }, + { 82316, true }, + { 82334, true }, + { 82344, true }, + { 82367, true }, + { 82381, true }, + { 82397, true }, + { 82410, true }, + { 82429, true }, + { 82442, true }, + { 82459, true }, + { 82477, false }, + { 82490, true }, { 82511, true }, - { 82532, true }, - { 82542, false }, - { 82557, true }, - { 82572, true }, - { 82589, true }, - { 82599, true }, - { 82608, true }, - { 82617, true }, - { 82629, true }, + { 82525, true }, + { 82535, true }, + { 82546, true }, + { 82553, false }, + { 82562, true }, + { 82578, true }, + { 82594, true }, + { 82601, true }, + { 82622, true }, + { 82632, false }, { 82647, true }, - { 82657, true }, - { 82667, true }, - { 82680, true }, - { 82691, true }, - { 82706, true }, - { 82717, true }, - { 82733, true }, - { 82746, true }, - { 82756, true }, - { 82775, true }, - { 82791, true }, - { 82813, true }, - { 82825, true }, - { 82838, true }, - { 82851, true }, - { 82866, true }, - { 82880, true }, - { 82895, true }, - { 82911, false }, - { 82924, true }, - { 82936, true }, - { 82953, true }, - { 82966, true }, + { 82662, true }, + { 82679, true }, + { 82689, true }, + { 82698, true }, + { 82707, true }, + { 82719, true }, + { 82737, true }, + { 82747, true }, + { 82757, true }, + { 82770, true }, + { 82781, true }, + { 82796, true }, + { 82807, true }, + { 82823, true }, + { 82836, true }, + { 82846, true }, + { 82865, true }, + { 82881, true }, + { 82903, true }, + { 82915, true }, + { 82928, true }, + { 82941, true }, + { 82956, true }, + { 82970, true }, { 82985, true }, - { 83001, true }, - { 83013, false }, - { 83023, true }, - { 83036, true }, - { 83052, true }, - { 83063, true }, - { 83083, false }, + { 83001, false }, + { 83014, true }, + { 83026, true }, + { 83043, true }, + { 83056, true }, + { 83075, true }, { 83091, true }, - { 83103, true }, - { 83114, true }, - { 83133, false }, - { 83153, true }, - { 83162, true }, - { 83173, true }, - { 83204, true }, - { 83213, true }, - { 83227, true }, - { 83241, true }, - { 83261, true }, - { 83280, true }, - { 83294, true }, - { 83310, true }, - { 83325, true }, - { 83339, true }, - { 83353, true }, - { 83361, true }, - { 83374, true }, - { 83385, true }, + { 83103, false }, + { 83113, true }, + { 83129, true }, + { 83140, true }, + { 83160, false }, + { 83168, true }, + { 83180, true }, + { 83191, true }, + { 83210, false }, + { 83230, true }, + { 83239, true }, + { 83250, true }, + { 83281, true }, + { 83290, true }, + { 83304, true }, + { 83318, true }, + { 83338, true }, + { 83352, true }, + { 83368, true }, + { 83383, true }, { 83397, true }, - { 83409, true }, - { 83425, true }, - { 83436, true }, - { 83451, true }, + { 83411, true }, + { 83419, true }, + { 83432, true }, + { 83443, true }, + { 83455, true }, { 83467, true }, { 83483, true }, - { 83505, true }, - { 83521, true }, - { 83540, true }, - { 83564, true }, - { 83580, true }, - { 83596, false }, - { 83609, true }, - { 83619, true }, - { 83631, true }, - { 83649, true }, - { 83661, true }, - { 83683, true }, - { 83698, true }, - { 83718, true }, - { 83738, true }, - { 83758, true }, - { 83779, false }, - { 83795, true }, - { 83813, true }, + { 83494, true }, + { 83509, true }, + { 83525, true }, + { 83541, true }, + { 83563, true }, + { 83579, true }, + { 83598, true }, + { 83622, true }, + { 83638, true }, + { 83654, true }, + { 83664, true }, + { 83682, true }, + { 83694, true }, + { 83716, true }, + { 83731, true }, + { 83751, true }, + { 83771, true }, + { 83791, true }, + { 83812, false }, { 83828, true }, - { 83840, false }, - { 83848, true }, - { 83862, true }, - { 83876, true }, - { 83888, true }, - { 83902, true }, - { 83914, true }, - { 83928, true }, - { 83941, true }, - { 83959, true }, - { 83973, true }, - { 83989, true }, - { 84009, true }, - { 84040, true }, - { 84071, true }, - { 84093, true }, - { 84111, true }, - { 84125, true }, - { 84147, true }, - { 84162, true }, - { 84181, true }, - { 84191, true }, - { 84206, true }, - { 84221, true }, - { 84236, true }, - { 84253, true }, - { 84266, true }, - { 84279, true }, - { 84292, true }, - { 84302, true }, + { 83846, true }, + { 83861, true }, + { 83873, false }, + { 83881, true }, + { 83895, true }, + { 83909, true }, + { 83921, true }, + { 83935, true }, + { 83947, true }, + { 83961, true }, + { 83974, true }, + { 83992, true }, + { 84006, true }, + { 84022, true }, + { 84042, true }, + { 84073, true }, + { 84104, true }, + { 84126, true }, + { 84144, true }, + { 84158, true }, + { 84180, true }, + { 84195, true }, + { 84214, true }, + { 84224, true }, + { 84239, true }, + { 84254, true }, + { 84269, true }, + { 84286, true }, + { 84299, true }, + { 84312, true }, { 84325, true }, - { 84336, true }, - { 84353, true }, - { 84370, true }, - { 84385, true }, - { 84392, true }, - { 84405, true }, - { 84422, true }, - { 84432, true }, - { 84442, true }, - { 84451, true }, - { 84470, true }, - { 84488, true }, - { 84509, true }, - { 84529, true }, + { 84335, true }, + { 84358, true }, + { 84369, true }, + { 84386, true }, + { 84403, true }, + { 84418, true }, + { 84425, true }, + { 84438, true }, + { 84455, true }, + { 84465, true }, + { 84475, true }, + { 84484, true }, + { 84503, true }, + { 84521, true }, { 84542, true }, - { 84559, true }, - { 84572, true }, - { 84594, true }, - { 84606, true }, - { 84622, true }, - { 84632, true }, - { 84645, true }, - { 84667, true }, - { 84681, true }, - { 84703, true }, - { 84720, true }, - { 84734, true }, - { 84742, true }, - { 84754, true }, - { 84769, true }, - { 84779, true }, - { 84790, true }, + { 84562, true }, + { 84575, true }, + { 84592, true }, + { 84605, true }, + { 84627, true }, + { 84639, true }, + { 84655, true }, + { 84665, true }, + { 84678, true }, + { 84700, true }, + { 84714, true }, + { 84736, true }, + { 84753, true }, + { 84767, true }, + { 84775, true }, + { 84787, true }, { 84802, true }, - { 84813, true }, - { 84822, true }, - { 84832, true }, - { 84849, true }, - { 84868, true }, - { 84890, true }, - { 84902, true }, - { 84920, true }, - { 84933, true }, - { 84944, true }, - { 84959, true }, - { 84972, true }, - { 84995, true }, - { 85009, true }, - { 85019, true }, - { 85033, true }, - { 85049, true }, - { 85064, true }, - { 85076, true }, - { 85086, true }, - { 85102, true }, - { 85120, true }, - { 85134, true }, - { 85142, true }, + { 84812, true }, + { 84823, true }, + { 84835, true }, + { 84846, true }, + { 84855, true }, + { 84865, true }, + { 84882, true }, + { 84901, true }, + { 84923, true }, + { 84935, true }, + { 84953, true }, + { 84966, true }, + { 84977, true }, + { 84992, true }, + { 85005, true }, + { 85028, true }, + { 85042, true }, + { 85052, true }, + { 85066, true }, + { 85082, true }, + { 85097, true }, + { 85109, true }, + { 85119, true }, + { 85135, true }, { 85153, true }, { 85167, true }, - { 85180, true }, - { 85190, true }, - { 85201, true }, - { 85212, false }, - { 85228, true }, - { 85241, true }, - { 85256, true }, - { 85267, true }, - { 85283, true }, - { 85301, true }, - { 85318, true }, - { 85339, true }, + { 85175, true }, + { 85186, true }, + { 85200, true }, + { 85213, true }, + { 85223, true }, + { 85234, true }, + { 85245, false }, + { 85261, true }, + { 85274, true }, + { 85289, true }, + { 85300, true }, + { 85316, true }, + { 85334, true }, { 85351, true }, - { 85360, true }, - { 85373, false }, - { 85391, true }, - { 85400, true }, - { 85411, true }, - { 85423, true }, - { 85433, false }, - { 85451, true }, - { 85469, true }, - { 85488, true }, - { 85507, true }, + { 85372, true }, + { 85384, true }, + { 85393, true }, + { 85406, false }, + { 85424, true }, + { 85433, true }, + { 85444, true }, + { 85456, true }, + { 85466, false }, + { 85484, true }, + { 85502, true }, { 85521, true }, - { 85541, false }, - { 85561, true }, - { 85573, true }, - { 85586, true }, - { 85605, true }, - { 85617, true }, - { 85630, true }, - { 85645, true }, - { 85659, true }, - { 85669, true }, - { 85679, true }, - { 85689, true }, - { 85701, true }, - { 85716, true }, - { 85731, true }, - { 85740, true }, - { 85748, true }, - { 85761, true }, - { 85769, true }, - { 85796, true }, - { 85804, true }, - { 85825, true }, - { 85839, true }, - { 85849, true }, + { 85540, true }, + { 85554, true }, + { 85574, false }, + { 85594, true }, + { 85606, true }, + { 85619, true }, + { 85638, true }, + { 85650, true }, + { 85663, true }, + { 85678, true }, + { 85692, true }, + { 85702, true }, + { 85712, true }, + { 85722, true }, + { 85734, true }, + { 85749, true }, + { 85764, true }, + { 85773, true }, + { 85781, true }, + { 85794, true }, + { 85802, true }, + { 85810, true }, + { 85820, true }, + { 85830, true }, { 85857, true }, - { 85866, true }, - { 85875, true }, - { 85892, true }, - { 85904, true }, - { 85912, true }, - { 85933, true }, - { 85952, true }, - { 85964, true }, - { 85982, true }, + { 85865, true }, + { 85886, true }, + { 85900, true }, + { 85910, true }, + { 85918, true }, + { 85927, true }, + { 85936, true }, + { 85953, true }, + { 85965, true }, + { 85973, true }, { 85994, true }, - { 86005, true }, - { 86012, true }, - { 86024, true }, - { 86033, true }, - { 86042, true }, - { 86058, true }, - { 86065, true }, + { 86013, true }, + { 86025, true }, + { 86043, true }, + { 86055, true }, + { 86066, true }, { 86073, true }, - { 86087, false }, - { 86098, true }, - { 86109, true }, - { 86124, true }, + { 86085, true }, + { 86094, true }, + { 86103, true }, + { 86119, true }, + { 86126, true }, { 86134, true }, - { 86147, true }, + { 86148, false }, { 86159, true }, { 86170, true }, - { 86180, false }, - { 86190, true }, - { 86210, true }, - { 86225, true }, - { 86238, true }, - { 86250, true }, + { 86185, true }, + { 86195, true }, + { 86208, true }, + { 86220, true }, + { 86231, true }, + { 86241, false }, + { 86251, true }, { 86265, true }, - { 86292, true }, - { 86306, true }, - { 86320, true }, - { 86337, true }, - { 86357, true }, - { 86372, true }, - { 86382, true }, + { 86285, true }, + { 86300, true }, + { 86313, true }, + { 86325, true }, + { 86340, true }, + { 86367, true }, + { 86381, true }, { 86395, true }, { 86412, true }, - { 86425, true }, - { 86435, true }, - { 86462, true }, - { 86472, true }, - { 86481, true }, - { 86488, true }, - { 86504, true }, - { 86515, true }, - { 86526, true }, - { 86540, true }, - { 86551, true }, - { 86561, true }, - { 86582, true }, + { 86432, true }, + { 86447, true }, + { 86457, true }, + { 86470, true }, + { 86487, true }, + { 86500, true }, + { 86510, true }, + { 86537, true }, + { 86547, true }, + { 86556, true }, + { 86563, true }, + { 86579, true }, { 86590, true }, - { 86600, true }, - { 86611, true }, - { 86631, true }, - { 86643, true }, - { 86666, true }, - { 86680, true }, - { 86699, true }, - { 86716, true }, - { 86724, true }, - { 86752, true }, - { 86770, true }, - { 86780, true }, - { 86789, true }, - { 86805, true }, - { 86823, true }, + { 86601, true }, + { 86615, true }, + { 86626, true }, + { 86636, true }, + { 86657, true }, + { 86665, true }, + { 86675, true }, + { 86686, true }, + { 86706, true }, + { 86718, true }, + { 86741, true }, + { 86755, true }, + { 86774, true }, + { 86791, true }, + { 86799, true }, + { 86827, true }, + { 86845, true }, { 86855, true }, - { 86871, true }, - { 86892, true }, - { 86909, true }, - { 86923, true }, - { 86943, true }, - { 86956, true }, - { 86968, true }, - { 86982, true }, - { 87001, true }, - { 87019, true }, - { 87030, true }, - { 87038, true }, - { 87050, true }, - { 87064, true }, + { 86864, true }, + { 86880, true }, + { 86898, true }, + { 86930, true }, + { 86946, true }, + { 86967, true }, + { 86984, true }, + { 86998, true }, + { 87018, true }, + { 87031, true }, + { 87043, true }, + { 87057, true }, { 87076, true }, - { 87089, true }, - { 87098, true }, - { 87108, true }, - { 87120, true }, - { 87130, true }, - { 87153, false }, - { 87168, true }, - { 87187, true }, - { 87205, true }, - { 87219, true }, - { 87233, true }, - { 87243, true }, - { 87256, true }, - { 87269, true }, - { 87281, true }, - { 87295, true }, - { 87311, true }, - { 87326, true }, - { 87335, true }, - { 87351, true }, - { 87378, true }, - { 87393, true }, - { 87406, true }, - { 87422, true }, - { 87439, false }, - { 87456, true }, - { 87478, true }, - { 87500, true }, - { 87522, true }, - { 87534, true }, - { 87548, true }, - { 87561, true }, - { 87570, true }, - { 87586, true }, - { 87603, true }, - { 87617, true }, - { 87630, true }, - { 87644, true }, - { 87656, true }, - { 87669, true }, - { 87682, true }, - { 87692, true }, - { 87706, false }, - { 87718, true }, - { 87731, true }, - { 87753, true }, - { 87775, true }, - { 87786, false }, - { 87801, true }, - { 87812, false }, - { 87832, true }, - { 87849, true }, - { 87868, true }, - { 87895, true }, - { 87914, true }, - { 87926, true }, - { 87947, true }, - { 87972, true }, - { 87991, true }, - { 88006, true }, - { 88026, false }, - { 88034, true }, - { 88046, true }, - { 88058, true }, - { 88072, true }, + { 87094, true }, + { 87105, true }, + { 87113, true }, + { 87125, true }, + { 87139, true }, + { 87151, true }, + { 87164, true }, + { 87173, true }, + { 87183, true }, + { 87194, true }, + { 87206, true }, + { 87216, true }, + { 87239, false }, + { 87254, true }, + { 87273, true }, + { 87291, true }, + { 87305, true }, + { 87319, true }, + { 87332, true }, + { 87345, true }, + { 87357, true }, + { 87371, true }, + { 87387, true }, + { 87402, true }, + { 87411, true }, + { 87427, true }, + { 87454, true }, + { 87469, true }, + { 87482, true }, + { 87498, true }, + { 87515, false }, + { 87532, true }, + { 87554, true }, + { 87576, true }, + { 87598, true }, + { 87610, true }, + { 87624, true }, + { 87637, true }, + { 87646, true }, + { 87662, true }, + { 87679, true }, + { 87693, true }, + { 87706, true }, + { 87720, true }, + { 87732, true }, + { 87745, true }, + { 87758, true }, + { 87768, true }, + { 87782, false }, + { 87794, true }, + { 87807, true }, + { 87829, true }, + { 87851, true }, + { 87862, false }, + { 87877, true }, + { 87888, false }, + { 87908, true }, + { 87925, true }, + { 87944, true }, + { 87971, true }, + { 87990, true }, + { 88002, true }, + { 88023, true }, + { 88048, true }, + { 88067, true }, { 88082, true }, - { 88095, true }, - { 88113, true }, - { 88127, true }, + { 88102, false }, + { 88110, true }, + { 88122, true }, { 88134, true }, - { 88141, true }, - { 88153, true }, - { 88164, true }, - { 88177, true }, - { 88191, true }, - { 88208, true }, - { 88222, true }, - { 88238, true }, - { 88249, true }, - { 88256, true }, - { 88269, true }, - { 88282, true }, - { 88291, true }, - { 88305, true }, - { 88321, false }, - { 88336, true }, - { 88364, true }, - { 88379, true }, - { 88400, true }, - { 88414, true }, - { 88428, true }, - { 88449, true }, - { 88465, true }, - { 88477, true }, - { 88487, true }, - { 88498, true }, - { 88508, true }, - { 88521, true }, - { 88531, true }, - { 88544, true }, - { 88561, true }, - { 88580, true }, - { 88599, true }, - { 88617, true }, - { 88628, true }, - { 88640, true }, - { 88652, true }, - { 88663, true }, + { 88148, true }, + { 88158, true }, + { 88171, true }, + { 88189, true }, + { 88203, true }, + { 88210, true }, + { 88217, true }, + { 88229, true }, + { 88240, true }, + { 88253, true }, + { 88267, true }, + { 88284, true }, + { 88298, true }, + { 88314, true }, + { 88325, true }, + { 88332, true }, + { 88345, true }, + { 88358, true }, + { 88367, true }, + { 88381, true }, + { 88397, false }, + { 88412, true }, + { 88440, true }, + { 88455, true }, + { 88476, true }, + { 88490, true }, + { 88504, true }, + { 88525, true }, + { 88541, true }, + { 88553, true }, + { 88563, true }, + { 88574, true }, + { 88584, true }, + { 88597, true }, + { 88607, true }, + { 88620, true }, + { 88637, true }, + { 88656, true }, { 88675, true }, - { 88690, true }, + { 88693, true }, + { 88704, true }, { 88716, true }, - { 88727, true }, - { 88738, true }, - { 88749, true }, - { 88761, true }, - { 88772, true }, - { 88785, true }, - { 88794, true }, + { 88728, true }, + { 88739, true }, + { 88751, true }, + { 88766, true }, + { 88792, true }, { 88803, true }, - { 88816, true }, - { 88823, false }, - { 88831, true }, - { 88839, true }, - { 88854, true }, - { 88867, true }, - { 88878, true }, - { 88892, false }, - { 88904, true }, - { 88928, true }, + { 88814, true }, + { 88825, true }, + { 88837, true }, + { 88848, true }, + { 88861, true }, + { 88870, true }, + { 88879, true }, + { 88892, true }, + { 88899, false }, + { 88907, true }, + { 88915, true }, + { 88930, true }, { 88943, true }, - { 88956, true }, - { 88970, true }, - { 88988, true }, - { 88996, true }, - { 89013, true }, - { 89038, true }, - { 89058, true }, - { 89082, true }, - { 89094, true }, - { 89107, true }, - { 89123, true }, - { 89132, true }, - { 89148, true }, - { 89166, true }, - { 89181, true }, - { 89201, true }, - { 89214, true }, - { 89230, true }, - { 89244, true }, - { 89260, true }, - { 89280, true }, - { 89298, true }, - { 89317, true }, - { 89334, true }, - { 89350, true }, - { 89360, true }, - { 89389, true }, - { 89409, true }, + { 88954, true }, + { 88968, false }, + { 88980, true }, + { 89004, true }, + { 89019, true }, + { 89032, true }, + { 89046, true }, + { 89064, true }, + { 89072, true }, + { 89089, true }, + { 89114, true }, + { 89134, true }, + { 89158, true }, + { 89170, true }, + { 89183, true }, + { 89199, true }, + { 89208, true }, + { 89224, true }, + { 89242, true }, + { 89257, true }, + { 89277, true }, + { 89290, true }, + { 89306, true }, + { 89320, true }, + { 89336, true }, + { 89356, true }, + { 89374, true }, + { 89393, true }, + { 89410, true }, { 89426, true }, - { 89442, true }, - { 89451, true }, - { 89464, true }, - { 89476, true }, - { 89485, false }, - { 89499, true }, - { 89516, true }, - { 89549, true }, - { 89569, true }, - { 89581, true }, - { 89594, true }, - { 89607, true }, - { 89622, true }, + { 89436, true }, + { 89465, true }, + { 89485, true }, + { 89502, true }, + { 89518, true }, + { 89527, true }, + { 89540, true }, + { 89549, false }, + { 89563, true }, + { 89580, true }, + { 89613, true }, { 89633, true }, - { 89650, true }, - { 89662, true }, - { 89674, true }, + { 89645, true }, + { 89658, true }, + { 89671, true }, { 89686, true }, - { 89695, true }, - { 89712, true }, + { 89697, true }, + { 89714, true }, { 89726, true }, - { 89747, true }, - { 89762, true }, - { 89780, true }, - { 89796, true }, - { 89817, true }, - { 89831, true }, - { 89845, true }, - { 89856, true }, - { 89867, true }, - { 89883, true }, + { 89738, true }, + { 89750, true }, + { 89759, true }, + { 89776, true }, + { 89790, true }, + { 89811, true }, + { 89826, true }, + { 89844, true }, + { 89860, true }, + { 89881, true }, { 89895, true }, - { 89907, true }, - { 89918, true }, - { 89932, true }, - { 89941, true }, - { 89950, true }, - { 89965, true }, - { 89974, true }, + { 89909, true }, + { 89920, true }, + { 89931, true }, + { 89947, true }, + { 89959, true }, + { 89971, true }, { 89982, true }, - { 89993, true }, - { 90004, true }, - { 90018, true }, - { 90033, true }, - { 90051, true }, - { 90065, true }, - { 90075, true }, - { 90085, true }, - { 90093, true }, - { 90102, true }, - { 90114, true }, - { 90123, true }, - { 90137, true }, - { 90160, true }, - { 90175, true }, - { 90183, true }, - { 90196, true }, - { 90208, true }, - { 90220, true }, - { 90233, true }, - { 90243, false }, - { 90252, false }, - { 90261, false }, - { 90270, true }, - { 90287, true }, - { 90306, true }, - { 90329, true }, - { 90348, true }, - { 90365, true }, - { 90380, true }, - { 90394, true }, - { 90409, true }, - { 90428, true }, - { 90441, true }, - { 90457, true }, - { 90470, true }, - { 90487, true }, - { 90503, true }, - { 90518, true }, - { 90528, true }, - { 90544, true }, - { 90563, true }, - { 90578, true }, - { 90597, true }, - { 90605, true }, - { 90619, true }, - { 90633, true }, - { 90647, true }, - { 90664, false }, - { 90684, true }, + { 89996, true }, + { 90005, true }, + { 90014, true }, + { 90029, true }, + { 90038, true }, + { 90046, true }, + { 90057, true }, + { 90068, true }, + { 90082, true }, + { 90097, true }, + { 90115, true }, + { 90129, true }, + { 90139, true }, + { 90149, true }, + { 90157, true }, + { 90166, true }, + { 90178, true }, + { 90187, true }, + { 90201, true }, + { 90224, true }, + { 90239, true }, + { 90247, true }, + { 90260, true }, + { 90272, true }, + { 90284, true }, + { 90297, true }, + { 90307, false }, + { 90316, false }, + { 90325, false }, + { 90334, true }, + { 90351, true }, + { 90370, true }, + { 90393, true }, + { 90412, true }, + { 90429, true }, + { 90444, true }, + { 90458, true }, + { 90473, true }, + { 90492, true }, + { 90505, true }, + { 90521, true }, + { 90534, true }, + { 90551, true }, + { 90567, true }, + { 90582, true }, + { 90592, true }, + { 90608, true }, + { 90627, true }, + { 90642, true }, + { 90661, true }, + { 90669, true }, + { 90683, true }, { 90697, true }, - { 90709, true }, - { 90724, true }, - { 90742, true }, - { 90753, true }, - { 90763, true }, - { 90777, true }, - { 90790, true }, + { 90711, true }, + { 90728, false }, + { 90748, true }, + { 90761, true }, + { 90773, true }, + { 90788, true }, { 90806, true }, - { 90821, true }, - { 90846, true }, - { 90872, true }, - { 90887, true }, - { 90899, true }, - { 90924, true }, - { 90931, true }, - { 90953, true }, - { 90968, true }, - { 90976, true }, - { 90984, true }, + { 90817, true }, + { 90827, true }, + { 90841, true }, + { 90854, true }, + { 90870, true }, + { 90885, true }, + { 90910, true }, + { 90936, true }, + { 90951, true }, + { 90963, true }, + { 90988, true }, { 90995, true }, - { 91011, true }, - { 91028, true }, - { 91042, true }, - { 91056, true }, - { 91072, true }, - { 91099, true }, - { 91113, true }, - { 91122, true }, - { 91135, true }, - { 91147, true }, - { 91170, true }, - { 91190, true }, - { 91209, true }, - { 91231, false }, - { 91242, true }, - { 91259, true }, - { 91273, true }, - { 91293, true }, - { 91318, true }, - { 91334, true }, - { 91346, true }, - { 91358, true }, - { 91380, true }, - { 91395, true }, - { 91410, true }, + { 91017, true }, + { 91032, true }, + { 91040, true }, + { 91048, true }, + { 91059, true }, + { 91075, true }, + { 91089, true }, + { 91103, true }, + { 91119, true }, + { 91146, true }, + { 91160, true }, + { 91169, true }, + { 91182, true }, + { 91194, true }, + { 91217, true }, + { 91237, true }, + { 91256, true }, + { 91278, false }, + { 91289, true }, + { 91306, true }, + { 91320, true }, + { 91340, true }, + { 91365, true }, + { 91381, true }, + { 91393, true }, + { 91405, true }, { 91427, true }, { 91442, true }, - { 91459, true }, + { 91457, true }, { 91474, true }, { 91489, true }, - { 91501, false }, - { 91511, true }, - { 91528, true }, - { 91539, false }, - { 91554, true }, - { 91571, true }, - { 91585, true }, - { 91598, true }, - { 91611, true }, - { 91623, true }, - { 91635, true }, + { 91506, true }, + { 91521, true }, + { 91536, true }, + { 91548, false }, + { 91558, true }, + { 91575, true }, + { 91586, false }, + { 91601, true }, + { 91618, true }, + { 91632, true }, { 91645, true }, - { 91657, true }, - { 91672, true }, - { 91684, true }, - { 91695, true }, - { 91715, true }, - { 91727, true }, - { 91738, true }, - { 91763, true }, - { 91772, true }, - { 91780, true }, - { 91793, true }, - { 91816, true }, - { 91833, true }, - { 91844, true }, - { 91860, false }, - { 91872, true }, + { 91658, true }, + { 91670, true }, + { 91682, true }, + { 91692, true }, + { 91704, true }, + { 91719, true }, + { 91731, true }, + { 91742, true }, + { 91762, true }, + { 91774, true }, + { 91785, true }, + { 91810, true }, + { 91819, true }, + { 91827, true }, + { 91840, true }, + { 91863, true }, { 91880, true }, - { 91890, true }, - { 91905, true }, + { 91891, true }, + { 91907, false }, { 91919, true }, - { 91929, false }, - { 91947, true }, - { 91971, true }, - { 91983, true }, - { 92011, true }, - { 92027, true }, - { 92039, true }, - { 92053, true }, - { 92081, true }, - { 92095, true }, - { 92111, true }, + { 91927, true }, + { 91937, true }, + { 91952, true }, + { 91966, true }, + { 91976, false }, + { 91994, true }, + { 92018, true }, + { 92030, true }, + { 92058, true }, + { 92074, true }, + { 92086, true }, + { 92100, true }, { 92128, true }, { 92142, true }, - { 92159, true }, - { 92181, true }, - { 92191, true }, - { 92201, true }, - { 92219, true }, + { 92158, true }, + { 92175, true }, + { 92189, true }, + { 92206, true }, + { 92228, true }, { 92238, true }, - { 92257, true }, - { 92282, true }, - { 92301, true }, - { 92318, true }, - { 92332, true }, - { 92345, true }, - { 92374, true }, - { 92404, true }, - { 92416, true }, - { 92425, true }, - { 92438, true }, - { 92449, true }, - { 92471, true }, - { 92482, true }, - { 92492, true }, - { 92508, true }, - { 92525, true }, - { 92548, true }, - { 92574, true }, - { 92588, true }, - { 92602, true }, - { 92621, false }, - { 92631, true }, - { 92643, true }, - { 92659, true }, - { 92667, true }, - { 92686, true }, - { 92698, false }, - { 92709, true }, - { 92717, true }, + { 92248, true }, + { 92266, true }, + { 92285, true }, + { 92304, true }, + { 92329, true }, + { 92348, true }, + { 92365, true }, + { 92379, true }, + { 92392, true }, + { 92421, true }, + { 92451, true }, + { 92463, true }, + { 92472, true }, + { 92485, true }, + { 92496, true }, + { 92518, true }, + { 92529, true }, + { 92539, true }, + { 92555, true }, + { 92572, true }, + { 92595, true }, + { 92621, true }, + { 92635, true }, + { 92649, true }, + { 92668, false }, + { 92678, true }, + { 92690, true }, + { 92706, true }, + { 92714, true }, { 92733, true }, - { 92747, true }, - { 92759, true }, - { 92772, true }, - { 92791, true }, - { 92800, true }, - { 92811, true }, - { 92823, true }, - { 92836, true }, - { 92846, true }, - { 92859, true }, - { 92871, true }, - { 92887, true }, - { 92895, false }, - { 92903, true }, - { 92925, true }, - { 92937, true }, - { 92945, true }, - { 92961, true }, - { 92971, true }, - { 92985, true }, - { 93002, true }, - { 93014, true }, + { 92745, false }, + { 92756, true }, + { 92764, true }, + { 92780, true }, + { 92794, true }, + { 92806, true }, + { 92819, true }, + { 92838, true }, + { 92847, true }, + { 92858, true }, + { 92870, true }, + { 92883, true }, + { 92893, true }, + { 92906, true }, + { 92918, true }, + { 92934, true }, + { 92942, false }, + { 92950, true }, + { 92972, true }, + { 92984, true }, + { 92992, true }, + { 93008, true }, { 93024, true }, - { 93039, true }, - { 93049, true }, - { 93059, true }, - { 93069, true }, - { 93081, true }, - { 93104, true }, - { 93118, true }, - { 93133, true }, - { 93146, true }, - { 93158, true }, + { 93034, true }, + { 93048, true }, + { 93065, true }, + { 93077, true }, + { 93087, true }, + { 93102, true }, + { 93112, true }, + { 93122, true }, + { 93132, true }, + { 93144, true }, { 93167, true }, - { 93178, true }, - { 93191, true }, - { 93206, true }, + { 93181, true }, + { 93196, true }, + { 93209, true }, { 93221, true }, - { 93231, true }, - { 93251, true }, - { 93265, true }, - { 93288, true }, - { 93300, true }, - { 93315, true }, - { 93326, true }, - { 93348, true }, - { 93359, true }, - { 93369, true }, - { 93383, true }, - { 93391, true }, - { 93400, true }, - { 93408, true }, - { 93423, true }, - { 93433, true }, - { 93443, true }, - { 93458, true }, - { 93466, true }, - { 93474, true }, - { 93483, true }, - { 93494, true }, + { 93230, true }, + { 93241, true }, + { 93254, true }, + { 93269, true }, + { 93284, true }, + { 93294, true }, + { 93314, true }, + { 93328, true }, + { 93351, true }, + { 93363, true }, + { 93378, true }, + { 93389, true }, + { 93411, true }, + { 93422, true }, + { 93432, true }, + { 93446, true }, + { 93454, true }, + { 93463, true }, + { 93471, true }, + { 93486, true }, + { 93496, true }, { 93506, true }, - { 93518, true }, - { 93528, true }, - { 93538, true }, - { 93550, true }, - { 93564, true }, - { 93579, true }, - { 93596, true }, - { 93608, true }, - { 93619, true }, - { 93626, true }, - { 93640, true }, - { 93651, true }, - { 93662, true }, - { 93670, true }, - { 93681, true }, - { 93696, true }, - { 93710, true }, - { 93724, true }, - { 93739, true }, - { 93754, true }, - { 93765, true }, - { 93776, true }, - { 93791, true }, - { 93804, true }, + { 93521, true }, + { 93529, true }, + { 93537, true }, + { 93546, true }, + { 93557, true }, + { 93569, true }, + { 93581, true }, + { 93591, true }, + { 93601, true }, + { 93613, true }, + { 93627, true }, + { 93642, true }, + { 93659, true }, + { 93671, true }, + { 93682, true }, + { 93689, true }, + { 93703, true }, + { 93714, true }, + { 93725, true }, + { 93733, true }, + { 93744, true }, + { 93759, true }, + { 93773, true }, + { 93787, true }, + { 93802, true }, { 93817, true }, - { 93824, true }, - { 93844, true }, - { 93853, true }, - { 93865, true }, - { 93878, true }, - { 93895, true }, - { 93910, true }, - { 93925, true }, - { 93945, true }, - { 93965, true }, - { 93974, true }, - { 93990, true }, - { 94002, true }, - { 94011, true }, - { 94021, true }, - { 94030, true }, - { 94040, false }, - { 94047, true }, - { 94058, true }, - { 94071, true }, - { 94086, true }, - { 94103, true }, - { 94119, true }, - { 94140, true }, - { 94147, true }, - { 94167, true }, - { 94177, true }, - { 94188, false }, - { 94201, true }, - { 94215, true }, - { 94225, true }, - { 94237, true }, - { 94257, false }, - { 94273, true }, - { 94282, false }, - { 94291, true }, - { 94299, true }, - { 94311, true }, - { 94318, true }, + { 93828, true }, + { 93839, true }, + { 93854, true }, + { 93867, true }, + { 93880, true }, + { 93887, true }, + { 93907, true }, + { 93916, true }, + { 93928, true }, + { 93941, true }, + { 93958, true }, + { 93973, true }, + { 93988, true }, + { 94008, true }, + { 94028, true }, + { 94037, true }, + { 94053, true }, + { 94065, true }, + { 94074, true }, + { 94084, true }, + { 94093, true }, + { 94103, false }, + { 94110, true }, + { 94121, true }, + { 94134, true }, + { 94149, true }, + { 94166, true }, + { 94182, true }, + { 94203, true }, + { 94210, true }, + { 94230, true }, + { 94240, true }, + { 94251, false }, + { 94264, true }, + { 94278, true }, + { 94288, true }, + { 94300, true }, + { 94320, false }, { 94336, true }, - { 94348, true }, - { 94367, true }, - { 94380, true }, - { 94393, false }, - { 94402, true }, + { 94345, false }, + { 94354, true }, + { 94362, true }, + { 94374, true }, + { 94381, true }, + { 94399, true }, { 94411, true }, - { 94422, true }, - { 94442, true }, - { 94459, true }, - { 94472, true }, - { 94488, false }, - { 94503, true }, - { 94517, true }, - { 94530, true }, - { 94549, true }, - { 94562, true }, - { 94579, true }, - { 94590, true }, - { 94607, false }, - { 94628, false }, - { 94644, false }, - { 94664, true }, - { 94676, true }, - { 94699, true }, - { 94711, true }, - { 94724, true }, - { 94736, true }, - { 94747, true }, - { 94756, true }, - { 94767, true }, - { 94782, true }, - { 94800, true }, - { 94827, true }, - { 94837, true }, + { 94430, true }, + { 94443, true }, + { 94456, false }, + { 94465, true }, + { 94474, true }, + { 94485, true }, + { 94505, true }, + { 94522, true }, + { 94535, true }, + { 94551, false }, + { 94566, true }, + { 94580, true }, + { 94593, true }, + { 94612, true }, + { 94625, true }, + { 94642, true }, + { 94653, true }, + { 94670, false }, + { 94691, false }, + { 94707, false }, + { 94727, true }, + { 94739, true }, + { 94762, true }, + { 94774, true }, + { 94787, true }, + { 94799, true }, + { 94810, true }, + { 94819, true }, + { 94830, true }, { 94845, true }, - { 94859, true }, - { 94871, true }, - { 94886, true }, - { 94896, true }, - { 94907, true }, - { 94916, true }, - { 94935, true }, - { 94948, true }, - { 94958, true }, - { 94966, true }, - { 94973, true }, - { 94986, true }, - { 94996, true }, - { 95005, false }, - { 95015, true }, - { 95024, true }, + { 94863, true }, + { 94890, true }, + { 94900, true }, + { 94908, true }, + { 94922, true }, + { 94934, true }, + { 94949, true }, + { 94959, true }, + { 94970, true }, + { 94979, true }, + { 94998, true }, + { 95011, true }, + { 95021, true }, + { 95029, true }, { 95036, true }, - { 95047, true }, - { 95058, true }, + { 95049, true }, + { 95059, true }, { 95068, false }, - { 95085, true }, - { 95094, true }, - { 95104, true }, - { 95112, true }, - { 95122, true }, - { 95129, true }, - { 95139, true }, - { 95152, true }, - { 95164, true }, - { 95179, true }, - { 95191, true }, - { 95207, true }, - { 95221, true }, - { 95235, true }, + { 95078, true }, + { 95087, true }, + { 95099, true }, + { 95110, true }, + { 95121, true }, + { 95131, false }, + { 95148, true }, + { 95157, true }, + { 95167, true }, + { 95175, true }, + { 95185, true }, + { 95192, true }, + { 95202, true }, + { 95215, true }, + { 95227, true }, { 95242, true }, { 95254, true }, - { 95263, true }, - { 95279, true }, - { 95293, true }, - { 95304, true }, - { 95313, true }, - { 95327, true }, - { 95339, true }, - { 95351, true }, - { 95361, true }, - { 95371, true }, - { 95381, true }, - { 95393, true }, - { 95403, true }, - { 95413, true }, - { 95431, true }, - { 95446, true }, - { 95457, true }, - { 95470, true }, - { 95477, true }, + { 95270, true }, + { 95284, true }, + { 95298, true }, + { 95305, true }, + { 95317, true }, + { 95326, true }, + { 95342, true }, + { 95356, true }, + { 95367, true }, + { 95376, true }, + { 95390, true }, + { 95402, true }, + { 95414, true }, + { 95424, true }, + { 95434, true }, + { 95444, true }, + { 95456, true }, + { 95466, true }, + { 95476, true }, { 95494, true }, - { 95505, true }, - { 95515, true }, - { 95525, true }, - { 95536, true }, - { 95545, true }, - { 95567, true }, - { 95592, true }, - { 95611, true }, - { 95618, true }, - { 95632, true }, - { 95647, true }, - { 95657, true }, - { 95673, true }, + { 95509, true }, + { 95520, true }, + { 95533, true }, + { 95540, true }, + { 95557, true }, + { 95568, true }, + { 95578, true }, + { 95588, true }, + { 95599, true }, + { 95608, true }, + { 95630, true }, + { 95655, true }, + { 95674, true }, + { 95681, true }, { 95695, true }, - { 95709, true }, - { 95722, true }, + { 95710, true }, + { 95720, true }, { 95736, true }, - { 95759, true }, - { 95770, true }, - { 95779, true }, - { 95790, true }, - { 95804, true }, - { 95815, true }, - { 95827, true }, - { 95846, true }, - { 95859, true }, - { 95868, true }, - { 95884, true }, - { 95897, true }, + { 95758, true }, + { 95772, true }, + { 95785, true }, + { 95799, true }, + { 95822, true }, + { 95833, true }, + { 95842, true }, + { 95853, true }, + { 95867, true }, + { 95878, true }, + { 95890, true }, { 95909, true }, { 95922, true }, - { 95930, true }, - { 95942, true }, - { 95951, true }, - { 95966, true }, - { 95975, true }, - { 95987, true }, - { 95997, true }, - { 96012, true }, - { 96020, true }, - { 96035, true }, - { 96046, true }, - { 96057, true }, - { 96066, true }, - { 96081, true }, - { 96095, true }, + { 95931, true }, + { 95947, true }, + { 95960, true }, + { 95972, true }, + { 95985, true }, + { 95993, true }, + { 96005, true }, + { 96014, true }, + { 96029, true }, + { 96038, true }, + { 96050, true }, + { 96060, true }, + { 96075, true }, + { 96083, true }, + { 96098, true }, { 96109, true }, + { 96120, true }, { 96129, true }, - { 96152, true }, - { 96177, true }, - { 96196, true }, - { 96210, true }, - { 96226, true }, + { 96144, true }, + { 96158, true }, + { 96172, true }, + { 96192, true }, + { 96215, true }, { 96240, true }, - { 96256, true }, - { 96274, true }, - { 96291, true }, - { 96308, true }, - { 96323, true }, - { 96340, true }, - { 96357, true }, - { 96372, true }, - { 96381, true }, - { 96394, true }, - { 96411, true }, - { 96424, true }, - { 96434, true }, - { 96445, true }, - { 96456, true }, - { 96466, true }, - { 96478, true }, - { 96499, true }, - { 96513, false }, - { 96533, false }, - { 96545, true }, - { 96558, true }, - { 96568, true }, - { 96581, true }, - { 96594, true }, - { 96610, true }, - { 96627, true }, - { 96639, true }, - { 96653, true }, - { 96667, true }, - { 96683, true }, - { 96695, true }, - { 96721, true }, - { 96742, true }, - { 96763, false }, - { 96777, true }, - { 96795, true }, - { 96812, true }, - { 96824, true }, - { 96844, true }, - { 96860, true }, - { 96872, true }, - { 96894, true }, - { 96916, true }, + { 96259, true }, + { 96273, true }, + { 96289, true }, + { 96303, true }, + { 96319, true }, + { 96337, true }, + { 96354, true }, + { 96371, true }, + { 96386, true }, + { 96403, true }, + { 96420, true }, + { 96435, true }, + { 96444, true }, + { 96457, true }, + { 96474, true }, + { 96487, true }, + { 96497, true }, + { 96508, true }, + { 96519, true }, + { 96529, true }, + { 96541, true }, + { 96562, true }, + { 96576, false }, + { 96596, false }, + { 96608, true }, + { 96621, true }, + { 96631, true }, + { 96644, true }, + { 96657, true }, + { 96673, true }, + { 96690, true }, + { 96702, true }, + { 96716, true }, + { 96730, true }, + { 96746, true }, + { 96758, true }, + { 96784, true }, + { 96805, true }, + { 96826, false }, + { 96840, true }, + { 96858, true }, + { 96875, true }, + { 96887, true }, + { 96907, true }, + { 96923, true }, { 96935, true }, - { 96952, true }, - { 96964, true }, - { 96975, true }, - { 96988, true }, - { 97008, true }, - { 97019, true }, - { 97044, true }, - { 97059, true }, - { 97076, true }, - { 97097, true }, - { 97117, true }, - { 97139, false }, - { 97152, true }, - { 97163, true }, - { 97179, true }, - { 97194, true }, - { 97209, true }, - { 97229, true }, - { 97241, true }, - { 97259, true }, - { 97284, true }, - { 97307, true }, - { 97323, true }, - { 97340, true }, - { 97351, true }, - { 97363, true }, - { 97377, true }, - { 97393, false }, - { 97406, true }, - { 97419, true }, - { 97431, true }, - { 97442, true }, - { 97459, true }, - { 97471, true }, - { 97481, false }, - { 97490, false }, - { 97500, true }, - { 97511, true }, + { 96957, true }, + { 96979, true }, + { 96998, true }, + { 97015, true }, + { 97027, true }, + { 97038, true }, + { 97051, true }, + { 97071, true }, + { 97082, true }, + { 97107, true }, + { 97122, true }, + { 97139, true }, + { 97160, true }, + { 97180, true }, + { 97202, false }, + { 97215, true }, + { 97226, true }, + { 97242, true }, + { 97257, true }, + { 97272, true }, + { 97292, true }, + { 97304, true }, + { 97322, true }, + { 97347, true }, + { 97370, true }, + { 97386, true }, + { 97403, true }, + { 97414, true }, + { 97426, true }, + { 97440, true }, + { 97456, false }, + { 97469, true }, + { 97482, true }, + { 97494, true }, + { 97505, true }, + { 97522, true }, { 97534, true }, - { 97547, false }, - { 97560, true }, - { 97571, true }, - { 97585, true }, - { 97601, true }, - { 97609, true }, - { 97628, true }, - { 97641, true }, + { 97544, false }, + { 97553, false }, + { 97563, true }, + { 97574, true }, + { 97597, true }, + { 97610, false }, + { 97623, true }, + { 97634, true }, + { 97648, true }, { 97664, true }, - { 97678, true }, - { 97693, true }, - { 97703, true }, - { 97716, true }, - { 97731, true }, - { 97747, true }, - { 97763, true }, - { 97780, true }, - { 97793, true }, - { 97805, true }, - { 97818, true }, + { 97672, true }, + { 97691, true }, + { 97714, true }, + { 97728, true }, + { 97743, true }, + { 97753, true }, + { 97766, true }, + { 97781, true }, + { 97797, true }, + { 97813, true }, { 97830, true }, - { 97845, true }, - { 97862, true }, - { 97871, true }, - { 97892, true }, - { 97909, true }, - { 97920, false }, - { 97938, true }, - { 97953, true }, - { 97965, true }, - { 97977, true }, - { 97989, true }, - { 98008, true }, - { 98043, true }, - { 98066, true }, - { 98088, true }, - { 98102, true }, - { 98119, true }, - { 98132, true }, - { 98149, true }, - { 98166, false }, - { 98185, true }, - { 98203, true }, - { 98234, true }, - { 98249, true }, - { 98262, true }, - { 98284, true }, - { 98296, true }, - { 98313, true }, - { 98330, true }, - { 98352, true }, - { 98368, true }, - { 98381, true }, - { 98393, true }, - { 98414, true }, - { 98433, true }, - { 98445, true }, - { 98462, true }, - { 98477, true }, - { 98494, true }, - { 98511, true }, - { 98527, true }, - { 98542, true }, - { 98558, true }, - { 98582, true }, - { 98607, true }, - { 98629, true }, - { 98644, true }, - { 98671, true }, - { 98689, true }, - { 98706, true }, + { 97843, true }, + { 97855, true }, + { 97868, true }, + { 97880, true }, + { 97895, true }, + { 97912, true }, + { 97921, true }, + { 97942, true }, + { 97959, true }, + { 97970, false }, + { 97988, true }, + { 98003, true }, + { 98015, true }, + { 98027, true }, + { 98039, true }, + { 98058, true }, + { 98093, true }, + { 98115, true }, + { 98129, true }, + { 98146, true }, + { 98159, true }, + { 98176, true }, + { 98193, false }, + { 98212, true }, + { 98230, true }, + { 98261, true }, + { 98276, true }, + { 98289, true }, + { 98311, true }, + { 98323, true }, + { 98340, true }, + { 98357, true }, + { 98379, true }, + { 98395, true }, + { 98408, true }, + { 98420, true }, + { 98441, true }, + { 98460, true }, + { 98472, true }, + { 98489, true }, + { 98504, true }, + { 98521, true }, + { 98538, true }, + { 98554, true }, + { 98569, true }, + { 98585, true }, + { 98601, true }, + { 98625, true }, + { 98650, true }, + { 98672, true }, + { 98687, true }, + { 98714, true }, { 98732, true }, - { 98747, true }, - { 98765, true }, - { 98786, true }, - { 98814, true }, - { 98833, true }, + { 98749, true }, + { 98775, true }, + { 98790, true }, + { 98808, true }, + { 98829, true }, { 98857, true }, - { 98881, true }, - { 98894, true }, - { 98907, true }, + { 98876, true }, + { 98900, true }, { 98924, true }, - { 98939, true }, - { 98964, false }, - { 98978, true }, - { 98988, true }, - { 99007, true }, - { 99023, true }, - { 99047, true }, - { 99062, true }, - { 99079, true }, - { 99089, true }, - { 99098, true }, - { 99113, true }, - { 99123, true }, - { 99135, true }, + { 98937, true }, + { 98950, true }, + { 98967, true }, + { 98982, true }, + { 99007, false }, + { 99021, true }, + { 99031, true }, + { 99050, true }, + { 99066, true }, + { 99090, true }, + { 99105, true }, + { 99122, true }, + { 99132, true }, + { 99141, true }, { 99156, true }, - { 99169, true }, - { 99182, true }, - { 99200, true }, - { 99213, true }, - { 99227, true }, - { 99246, true }, + { 99166, true }, + { 99178, true }, + { 99199, true }, + { 99212, true }, + { 99225, true }, + { 99243, true }, { 99256, true }, - { 99272, true }, - { 99288, true }, - { 99301, true }, - { 99320, true }, - { 99338, true }, - { 99352, true }, - { 99362, false }, - { 99374, true }, - { 99382, true }, - { 99392, true }, - { 99402, true }, - { 99414, true }, - { 99428, false }, - { 99441, true }, - { 99449, true }, - { 99460, true }, - { 99471, true }, - { 99479, true }, - { 99495, true }, - { 99507, true }, - { 99516, true }, - { 99532, false }, - { 99539, true }, - { 99547, true }, - { 99557, true }, - { 99569, true }, - { 99583, true }, - { 99592, true }, - { 99608, true }, - { 99616, true }, - { 99625, true }, - { 99641, true }, - { 99651, false }, - { 99669, true }, - { 99681, true }, - { 99693, false }, - { 99704, true }, - { 99717, true }, - { 99727, true }, - { 99737, true }, + { 99270, true }, + { 99289, true }, + { 99299, true }, + { 99315, true }, + { 99331, true }, + { 99344, true }, + { 99363, true }, + { 99381, true }, + { 99395, true }, + { 99405, false }, + { 99417, true }, + { 99425, true }, + { 99435, true }, + { 99445, true }, + { 99457, true }, + { 99471, false }, + { 99484, true }, + { 99492, true }, + { 99503, true }, + { 99514, true }, + { 99522, true }, + { 99538, true }, + { 99550, true }, + { 99559, true }, + { 99575, false }, + { 99582, true }, + { 99590, true }, + { 99600, true }, + { 99612, true }, + { 99626, true }, + { 99635, true }, + { 99651, true }, + { 99659, true }, + { 99668, true }, + { 99684, true }, + { 99694, false }, + { 99712, true }, + { 99724, true }, + { 99736, false }, { 99747, true }, - { 99757, true }, - { 99767, true }, - { 99786, true }, - { 99795, true }, - { 99804, true }, - { 99824, true }, - { 99840, true }, - { 99848, true }, - { 99869, true }, - { 99877, true }, - { 99893, true }, - { 99910, true }, - { 99918, true }, - { 99929, true }, - { 99941, true }, - { 99952, true }, - { 99967, true }, - { 99978, true }, - { 99988, true }, - { 99997, true }, - { 100015, true }, + { 99760, true }, + { 99770, true }, + { 99780, true }, + { 99790, true }, + { 99800, true }, + { 99810, true }, + { 99829, true }, + { 99838, true }, + { 99847, true }, + { 99867, true }, + { 99883, true }, + { 99891, true }, + { 99912, true }, + { 99920, true }, + { 99936, true }, + { 99953, true }, + { 99961, true }, + { 99972, true }, + { 99984, true }, + { 99995, true }, + { 100010, true }, + { 100021, true }, { 100031, true }, - { 100045, true }, - { 100073, true }, - { 100086, true }, - { 100095, true }, - { 100114, true }, - { 100130, true }, - { 100145, true }, - { 100162, true }, - { 100185, true }, - { 100204, true }, - { 100213, true }, - { 100231, true }, - { 100246, true }, - { 100260, true }, - { 100283, true }, - { 100305, true }, - { 100315, true }, - { 100331, true }, - { 100347, true }, - { 100355, true }, - { 100365, true }, - { 100377, true }, + { 100040, true }, + { 100058, true }, + { 100074, true }, + { 100088, true }, + { 100116, true }, + { 100129, true }, + { 100138, true }, + { 100157, true }, + { 100173, true }, + { 100188, true }, + { 100205, true }, + { 100228, true }, + { 100247, true }, + { 100256, true }, + { 100274, true }, + { 100289, true }, + { 100303, true }, + { 100326, true }, + { 100348, true }, + { 100358, true }, + { 100374, true }, { 100390, true }, - { 100407, true }, - { 100439, true }, + { 100398, true }, + { 100408, true }, + { 100420, true }, + { 100433, true }, { 100450, true }, - { 100468, true }, { 100482, true }, - { 100496, true }, - { 100514, true }, - { 100533, true }, - { 100549, true }, - { 100560, true }, - { 100571, true }, - { 100589, true }, - { 100602, true }, - { 100613, true }, - { 100623, true }, - { 100636, true }, - { 100648, true }, - { 100659, true }, - { 100670, true }, - { 100681, true }, + { 100493, true }, + { 100511, true }, + { 100525, true }, + { 100539, true }, + { 100557, true }, + { 100576, true }, + { 100592, true }, + { 100603, true }, + { 100614, true }, + { 100632, true }, + { 100645, true }, + { 100656, true }, + { 100666, true }, + { 100679, true }, { 100691, true }, - { 100700, true }, - { 100717, true }, - { 100736, true }, - { 100749, true }, - { 100762, true }, - { 100781, true }, - { 100798, true }, - { 100823, true }, - { 100855, true }, - { 100869, true }, - { 100881, true }, - { 100905, true }, - { 100928, true }, - { 100960, true }, - { 100985, true }, - { 100998, true }, - { 101024, true }, - { 101043, true }, - { 101057, true }, - { 101071, true }, - { 101084, true }, - { 101099, true }, - { 101114, true }, + { 100702, true }, + { 100713, true }, + { 100724, true }, + { 100734, true }, + { 100743, true }, + { 100760, true }, + { 100779, true }, + { 100792, true }, + { 100805, true }, + { 100824, true }, + { 100841, true }, + { 100866, true }, + { 100898, true }, + { 100910, true }, + { 100934, true }, + { 100957, true }, + { 100989, true }, + { 101014, true }, + { 101027, true }, + { 101053, true }, + { 101072, true }, + { 101086, true }, + { 101100, true }, + { 101113, true }, { 101128, true }, - { 101142, false }, - { 101162, true }, - { 101175, true }, - { 101192, true }, - { 101207, true }, - { 101224, true }, - { 101233, true }, - { 101242, true }, - { 101258, true }, - { 101278, true }, - { 101297, true }, - { 101306, true }, - { 101315, true }, + { 101143, true }, + { 101157, true }, + { 101171, false }, + { 101191, true }, + { 101204, true }, + { 101221, true }, + { 101236, true }, + { 101253, true }, + { 101262, true }, + { 101271, true }, + { 101287, true }, + { 101307, true }, { 101326, true }, { 101335, true }, - { 101343, true }, - { 101352, true }, - { 101363, true }, - { 101376, true }, - { 101388, true }, - { 101401, true }, - { 101410, true }, - { 101423, true }, - { 101433, true }, - { 101446, true }, - { 101459, true }, - { 101470, true }, - { 101481, true }, - { 101492, true }, - { 101501, true }, + { 101344, true }, + { 101355, true }, + { 101364, true }, + { 101372, true }, + { 101381, true }, + { 101392, true }, + { 101405, true }, + { 101417, true }, + { 101430, true }, + { 101439, true }, + { 101452, true }, + { 101462, true }, + { 101475, true }, + { 101488, true }, + { 101499, true }, { 101510, true }, - { 101520, true }, - { 101537, true }, - { 101554, true }, - { 101563, true }, - { 101578, true }, - { 101597, true }, - { 101609, true }, - { 101622, true }, - { 101639, false }, - { 101652, true }, - { 101661, true }, - { 101675, true }, - { 101698, false }, - { 101710, true }, - { 101721, true }, + { 101521, true }, + { 101530, true }, + { 101539, true }, + { 101549, true }, + { 101566, true }, + { 101583, true }, + { 101592, true }, + { 101607, true }, + { 101626, true }, + { 101639, true }, + { 101656, false }, + { 101669, true }, + { 101678, true }, + { 101692, true }, + { 101715, false }, + { 101727, true }, { 101738, true }, - { 101752, true }, - { 101763, true }, + { 101755, true }, + { 101769, true }, { 101780, true }, - { 101801, true }, - { 101812, true }, - { 101823, true }, - { 101830, true }, - { 101841, true }, - { 101848, true }, + { 101797, true }, + { 101818, true }, + { 101829, true }, + { 101840, true }, + { 101847, true }, { 101858, true }, - { 101870, true }, - { 101880, true }, - { 101889, true }, - { 101902, true }, - { 101914, true }, + { 101865, true }, + { 101875, true }, + { 101887, true }, + { 101897, true }, + { 101906, true }, + { 101919, true }, { 101931, true }, - { 101945, true }, - { 101959, true }, - { 101966, true }, - { 101973, true }, - { 101980, true }, - { 101989, true }, - { 101998, true }, + { 101948, true }, + { 101962, true }, + { 101976, true }, + { 101983, true }, + { 101990, true }, + { 101997, true }, { 102006, true }, - { 102016, true }, - { 102034, true }, - { 102048, true }, - { 102060, true }, - { 102071, true }, - { 102082, true }, - { 102093, true }, - { 102106, true }, - { 102117, true }, - { 102126, true }, + { 102015, true }, + { 102023, true }, + { 102033, true }, + { 102051, true }, + { 102065, true }, + { 102077, true }, + { 102088, true }, + { 102099, true }, + { 102110, true }, + { 102123, true }, + { 102134, true }, { 102143, true }, - { 102154, true }, - { 102170, true }, - { 102177, true }, - { 102184, true }, - { 102198, true }, - { 102206, true }, - { 102213, true }, - { 102224, true }, + { 102160, true }, + { 102171, true }, + { 102187, true }, + { 102194, true }, + { 102201, true }, + { 102215, true }, + { 102223, true }, { 102230, true }, - { 102243, true }, - { 102256, true }, - { 102266, true }, - { 102276, true }, - { 102289, true }, - { 102303, true }, - { 102318, true }, - { 102331, true }, - { 102340, true }, - { 102359, true }, - { 102384, false }, - { 102396, true }, - { 102404, true }, - { 102418, true }, - { 102431, true }, - { 102446, true }, - { 102465, true }, - { 102478, true }, - { 102493, true }, - { 102506, true }, - { 102517, true }, - { 102530, true }, + { 102241, true }, + { 102247, true }, + { 102260, true }, + { 102273, true }, + { 102283, true }, + { 102293, true }, + { 102306, true }, + { 102320, true }, + { 102335, true }, + { 102348, true }, + { 102357, true }, + { 102376, true }, + { 102401, false }, + { 102413, true }, + { 102421, true }, + { 102435, true }, + { 102448, true }, + { 102463, true }, + { 102482, true }, + { 102495, true }, + { 102510, true }, + { 102523, true }, + { 102534, true }, { 102547, true }, - { 102561, false }, - { 102580, true }, - { 102595, true }, - { 102609, true }, - { 102625, true }, - { 102641, true }, - { 102661, true }, - { 102679, true }, - { 102689, true }, - { 102698, true }, - { 102714, true }, - { 102729, true }, - { 102749, true }, - { 102768, true }, + { 102564, true }, + { 102578, false }, + { 102597, true }, + { 102612, true }, + { 102626, true }, + { 102642, true }, + { 102658, true }, + { 102678, true }, + { 102696, true }, + { 102706, true }, + { 102715, true }, + { 102731, true }, + { 102746, true }, + { 102766, true }, { 102785, true }, - { 102801, true }, - { 102821, true }, - { 102834, true }, - { 102848, false }, - { 102861, true }, - { 102871, true }, - { 102883, true }, + { 102802, true }, + { 102818, true }, + { 102838, true }, + { 102851, true }, + { 102865, false }, + { 102878, true }, + { 102888, true }, { 102900, true }, - { 102915, true }, - { 102938, true }, + { 102917, true }, + { 102932, true }, { 102955, true }, - { 102969, true }, - { 102981, true }, - { 102996, true }, + { 102972, true }, + { 102986, true }, + { 102998, true }, { 103013, true }, - { 103027, true }, - { 103042, true }, - { 103051, true }, - { 103066, true }, - { 103084, true }, - { 103098, true }, + { 103030, true }, + { 103044, true }, + { 103059, true }, + { 103068, true }, + { 103083, true }, + { 103101, true }, { 103115, true }, - { 103125, true }, - { 103136, true }, - { 103146, true }, - { 103161, true }, - { 103175, true }, - { 103188, true }, - { 103199, true }, + { 103132, true }, + { 103142, true }, + { 103153, true }, + { 103163, true }, + { 103178, true }, + { 103192, true }, + { 103205, true }, { 103216, true }, - { 103230, true }, - { 103240, true }, - { 103252, true }, - { 103270, true }, - { 103284, true }, - { 103296, false }, - { 103311, true }, - { 103330, true }, - { 103341, true }, - { 103353, true }, - { 103366, true }, + { 103233, true }, + { 103247, true }, + { 103257, true }, + { 103269, true }, + { 103287, true }, + { 103301, true }, + { 103313, false }, + { 103328, true }, + { 103347, true }, + { 103358, true }, + { 103370, true }, { 103383, true }, - { 103399, true }, - { 103418, true }, + { 103400, true }, + { 103416, true }, { 103435, true }, - { 103453, true }, - { 103475, true }, - { 103494, true }, - { 103507, true }, - { 103523, true }, - { 103536, true }, - { 103551, true }, - { 103564, true }, - { 103578, true }, - { 103592, true }, + { 103452, true }, + { 103470, true }, + { 103492, true }, + { 103511, true }, + { 103524, true }, + { 103540, true }, + { 103553, true }, + { 103568, true }, + { 103576, true }, + { 103589, true }, { 103603, true }, - { 103613, true }, - { 103631, true }, - { 103649, true }, - { 103662, true }, - { 103670, true }, - { 103678, true }, - { 103691, true }, + { 103617, true }, + { 103628, true }, + { 103638, true }, + { 103656, true }, + { 103674, true }, + { 103687, true }, + { 103695, true }, { 103703, true }, - { 103714, true }, - { 103729, true }, + { 103716, true }, + { 103728, true }, { 103739, true }, - { 103750, true }, - { 103758, true }, - { 103773, true }, - { 103780, true }, - { 103796, true }, - { 103818, true }, - { 103834, true }, + { 103754, true }, + { 103764, true }, + { 103775, true }, + { 103783, true }, + { 103798, true }, + { 103805, true }, + { 103821, true }, { 103843, true }, - { 103853, true }, - { 103865, true }, + { 103859, true }, + { 103868, true }, { 103878, true }, - { 103896, true }, - { 103910, true }, - { 103929, true }, - { 103943, true }, - { 103956, true }, - { 103972, false }, - { 103989, true }, - { 104010, true }, - { 104029, true }, - { 104048, true }, - { 104067, false }, - { 104083, true }, - { 104098, true }, + { 103890, true }, + { 103903, true }, + { 103921, true }, + { 103935, true }, + { 103954, true }, + { 103968, true }, + { 103981, true }, + { 103997, false }, + { 104014, true }, + { 104035, true }, + { 104054, true }, + { 104073, true }, + { 104092, false }, { 104108, true }, - { 104118, true }, - { 104127, true }, - { 104140, true }, - { 104150, false }, - { 104168, true }, - { 104190, true }, - { 104207, true }, - { 104223, true }, - { 104241, true }, - { 104252, true }, - { 104268, true }, - { 104286, true }, - { 104301, false }, - { 104315, true }, - { 104332, true }, - { 104350, true }, - { 104369, true }, - { 104380, true }, - { 104396, true }, - { 104413, true }, - { 104429, true }, - { 104442, true }, - { 104460, true }, - { 104471, true }, - { 104488, true }, - { 104510, false }, - { 104527, true }, - { 104543, true }, - { 104557, true }, - { 104569, true }, - { 104591, false }, - { 104606, true }, - { 104618, true }, - { 104626, true }, - { 104639, true }, - { 104654, true }, - { 104669, true }, + { 104123, true }, + { 104133, true }, + { 104143, true }, + { 104152, true }, + { 104165, true }, + { 104175, false }, + { 104193, true }, + { 104215, true }, + { 104232, true }, + { 104248, true }, + { 104266, true }, + { 104277, true }, + { 104293, true }, + { 104311, true }, + { 104326, false }, + { 104340, true }, + { 104357, true }, + { 104375, true }, + { 104394, true }, + { 104405, true }, + { 104421, true }, + { 104438, true }, + { 104454, true }, + { 104467, true }, + { 104485, true }, + { 104496, true }, + { 104513, true }, + { 104535, false }, + { 104552, true }, + { 104568, true }, + { 104582, true }, + { 104594, true }, + { 104616, false }, + { 104631, true }, + { 104643, true }, + { 104651, true }, + { 104664, true }, { 104679, true }, - { 104690, true }, - { 104702, true }, - { 104711, true }, - { 104721, true }, - { 104731, true }, - { 104745, true }, - { 104759, true }, - { 104770, false }, - { 104783, true }, - { 104791, true }, - { 104805, true }, - { 104814, true }, - { 104827, true }, - { 104836, true }, - { 104846, true }, - { 104859, true }, - { 104879, false }, - { 104889, true }, - { 104905, true }, - { 104918, true }, - { 104931, true }, - { 104942, true }, - { 104951, true }, - { 104958, true }, - { 104974, true }, - { 104987, true }, - { 105000, true }, - { 105013, true }, - { 105028, true }, - { 105039, true }, - { 105059, true }, - { 105071, true }, - { 105078, true }, - { 105085, true }, - { 105094, true }, + { 104694, true }, + { 104704, true }, + { 104715, true }, + { 104727, true }, + { 104736, true }, + { 104746, true }, + { 104756, true }, + { 104770, true }, + { 104784, true }, + { 104795, false }, + { 104808, true }, + { 104816, true }, + { 104830, true }, + { 104839, true }, + { 104852, true }, + { 104861, true }, + { 104871, true }, + { 104884, true }, + { 104904, false }, + { 104914, true }, + { 104930, true }, + { 104943, true }, + { 104956, true }, + { 104967, true }, + { 104976, true }, + { 104983, true }, + { 104999, true }, + { 105012, true }, + { 105025, true }, + { 105038, true }, + { 105053, true }, + { 105064, true }, + { 105084, true }, + { 105096, true }, { 105103, true }, - { 105112, true }, - { 105123, true }, + { 105110, true }, + { 105119, true }, + { 105128, true }, { 105137, true }, - { 105150, true }, - { 105158, true }, - { 105177, true }, - { 105188, true }, - { 105200, true }, - { 105214, true }, + { 105148, true }, + { 105162, true }, + { 105175, true }, + { 105183, true }, + { 105202, true }, + { 105213, true }, { 105225, true }, - { 105241, true }, - { 105255, true }, - { 105270, true }, - { 105280, false }, - { 105294, true }, - { 105304, true }, - { 105319, false }, - { 105335, true }, - { 105354, true }, - { 105366, true }, + { 105239, true }, + { 105250, true }, + { 105266, true }, + { 105280, true }, + { 105295, true }, + { 105305, false }, + { 105319, true }, + { 105329, true }, + { 105344, false }, + { 105360, true }, { 105379, true }, - { 105398, true }, - { 105422, false }, - { 105435, true }, - { 105451, true }, - { 105465, true }, - { 105480, true }, - { 105499, true }, - { 105516, true }, - { 105533, true }, - { 105543, true }, + { 105391, true }, + { 105404, true }, + { 105423, true }, + { 105447, false }, + { 105460, true }, + { 105476, true }, + { 105490, true }, + { 105505, true }, + { 105524, true }, + { 105541, true }, { 105558, true }, - { 105572, true }, - { 105585, true }, - { 105601, true }, - { 105616, true }, - { 105632, true }, - { 105646, true }, - { 105661, true }, - { 105675, true }, - { 105690, true }, - { 105709, true }, - { 105724, true }, - { 105739, true }, - { 105757, true }, - { 105776, true }, - { 105789, true }, - { 105802, true }, - { 105825, true }, - { 105841, true }, - { 105852, true }, - { 105865, true }, - { 105880, true }, - { 105895, true }, - { 105911, true }, - { 105926, true }, - { 105942, true }, - { 105959, true }, - { 105971, true }, - { 105981, true }, - { 105999, true }, - { 106009, true }, - { 106020, true }, - { 106030, true }, - { 106044, true }, - { 106057, true }, - { 106085, true }, - { 106096, true }, - { 106107, true }, - { 106118, true }, - { 106131, true }, - { 106144, true }, - { 106161, true }, - { 106175, false }, - { 106192, true }, - { 106206, true }, - { 106223, true }, - { 106240, true }, - { 106252, true }, - { 106263, true }, + { 105568, true }, + { 105583, true }, + { 105597, true }, + { 105610, true }, + { 105626, true }, + { 105641, true }, + { 105657, true }, + { 105671, true }, + { 105686, true }, + { 105700, true }, + { 105715, true }, + { 105734, true }, + { 105749, true }, + { 105764, true }, + { 105782, true }, + { 105801, true }, + { 105814, true }, + { 105827, true }, + { 105850, true }, + { 105866, true }, + { 105877, true }, + { 105890, true }, + { 105905, true }, + { 105920, true }, + { 105936, true }, + { 105951, true }, + { 105967, true }, + { 105984, true }, + { 105996, true }, + { 106006, true }, + { 106024, true }, + { 106034, true }, + { 106045, true }, + { 106055, true }, + { 106069, true }, + { 106082, true }, + { 106110, true }, + { 106121, true }, + { 106132, true }, + { 106143, true }, + { 106156, true }, + { 106169, true }, + { 106186, true }, + { 106200, false }, + { 106217, true }, + { 106231, true }, + { 106248, true }, + { 106265, true }, { 106277, true }, - { 106289, true }, - { 106305, true }, - { 106331, true }, - { 106341, true }, - { 106354, true }, - { 106367, true }, - { 106375, true }, - { 106386, true }, - { 106406, true }, - { 106424, true }, + { 106288, true }, + { 106302, true }, + { 106314, true }, + { 106330, true }, + { 106356, true }, + { 106366, true }, + { 106379, true }, + { 106389, true }, + { 106402, true }, + { 106410, true }, + { 106421, true }, { 106441, true }, - { 106456, true }, - { 106474, true }, - { 106490, true }, - { 106504, true }, - { 106521, true }, - { 106531, true }, - { 106547, true }, - { 106560, true }, - { 106570, false }, - { 106584, true }, + { 106459, true }, + { 106476, true }, + { 106491, true }, + { 106509, true }, + { 106525, true }, + { 106539, true }, + { 106556, true }, + { 106566, true }, + { 106582, true }, { 106595, true }, - { 106611, true }, + { 106605, false }, { 106619, true }, - { 106629, true }, - { 106644, true }, - { 106660, true }, + { 106630, true }, + { 106646, true }, + { 106654, true }, + { 106664, true }, { 106679, true }, - { 106692, true }, - { 106712, true }, + { 106695, true }, + { 106714, true }, { 106727, true }, - { 106745, true }, - { 106758, true }, - { 106768, true }, - { 106785, true }, - { 106800, true }, - { 106811, true }, - { 106830, true }, - { 106841, true }, - { 106854, true }, - { 106862, true }, - { 106871, true }, - { 106882, true }, - { 106896, true }, + { 106747, true }, + { 106762, true }, + { 106780, true }, + { 106793, true }, + { 106803, true }, + { 106820, true }, + { 106835, true }, + { 106846, true }, + { 106865, true }, + { 106876, true }, + { 106889, true }, + { 106897, true }, { 106906, true }, - { 106929, true }, - { 106942, true }, - { 106954, false }, - { 106965, true }, - { 106979, true }, - { 107007, true }, - { 107016, true }, - { 107031, true }, - { 107050, true }, - { 107074, true }, - { 107089, true }, + { 106917, true }, + { 106931, true }, + { 106941, true }, + { 106964, true }, + { 106977, true }, + { 106989, false }, + { 107000, true }, + { 107014, true }, + { 107042, true }, + { 107051, true }, + { 107066, true }, + { 107085, true }, { 107109, true }, - { 107127, true }, - { 107140, true }, - { 107156, true }, - { 107171, true }, - { 107184, true }, - { 107198, true }, - { 107209, true }, - { 107220, true }, - { 107234, true }, - { 107246, true }, - { 107263, true }, - { 107273, true }, - { 107286, true }, - { 107301, true }, - { 107309, true }, - { 107329, true }, - { 107340, true }, - { 107350, true }, - { 107366, true }, + { 107124, true }, + { 107144, true }, + { 107162, true }, + { 107175, true }, + { 107191, true }, + { 107206, true }, + { 107219, true }, + { 107233, true }, + { 107244, true }, + { 107255, true }, + { 107269, true }, + { 107281, true }, + { 107298, true }, + { 107308, true }, + { 107321, true }, + { 107336, true }, + { 107344, true }, + { 107364, true }, { 107375, true }, - { 107386, true }, - { 107399, true }, - { 107409, true }, + { 107385, true }, + { 107401, true }, + { 107410, true }, { 107421, true }, - { 107436, true }, - { 107445, true }, - { 107459, true }, - { 107472, true }, - { 107487, true }, - { 107501, true }, - { 107512, true }, - { 107527, true }, - { 107537, false }, + { 107434, true }, + { 107444, true }, + { 107456, true }, + { 107471, true }, + { 107480, true }, + { 107494, true }, + { 107507, true }, + { 107522, true }, + { 107536, true }, { 107547, true }, - { 107566, true }, - { 107579, true }, - { 107588, true }, - { 107599, true }, - { 107613, true }, - { 107633, true }, - { 107649, true }, - { 107660, true }, - { 107676, true }, - { 107693, true }, - { 107708, true }, - { 107729, true }, - { 107742, true }, - { 107759, true }, - { 107769, true }, + { 107562, true }, + { 107572, false }, + { 107582, true }, + { 107601, true }, + { 107614, true }, + { 107623, true }, + { 107634, true }, + { 107648, true }, + { 107668, true }, + { 107684, true }, + { 107695, true }, + { 107711, true }, + { 107728, true }, + { 107743, true }, + { 107764, true }, { 107777, true }, - { 107788, true }, - { 107798, true }, - { 107813, true }, - { 107826, true }, - { 107840, true }, - { 107852, true }, - { 107862, true }, - { 107870, true }, - { 107889, true }, - { 107909, true }, - { 107918, true }, - { 107932, true }, - { 107946, true }, - { 107988, true }, - { 108004, true }, - { 108013, true }, - { 108025, true }, - { 108037, true }, - { 108050, true }, - { 108063, true }, - { 108081, true }, - { 108089, true }, - { 108102, true }, - { 108113, true }, - { 108127, true }, + { 107794, true }, + { 107804, true }, + { 107812, true }, + { 107823, true }, + { 107833, true }, + { 107848, true }, + { 107861, true }, + { 107875, true }, + { 107887, true }, + { 107897, true }, + { 107905, true }, + { 107924, true }, + { 107944, true }, + { 107953, true }, + { 107967, true }, + { 107981, true }, + { 108023, true }, + { 108039, true }, + { 108048, true }, + { 108060, true }, + { 108072, true }, + { 108085, true }, + { 108098, true }, + { 108116, true }, + { 108124, true }, { 108137, true }, - { 108147, true }, - { 108159, true }, - { 108170, true }, - { 108187, true }, - { 108202, true }, - { 108214, true }, - { 108227, true }, - { 108239, true }, - { 108254, true }, - { 108267, true }, - { 108279, true }, + { 108148, true }, + { 108162, true }, + { 108172, true }, + { 108182, true }, + { 108194, true }, + { 108205, true }, + { 108222, true }, + { 108237, true }, + { 108249, true }, + { 108262, true }, + { 108274, true }, { 108289, true }, - { 108305, true }, + { 108302, true }, { 108314, true }, - { 108335, true }, - { 108348, true }, - { 108366, true }, - { 108381, true }, - { 108395, true }, - { 108413, true }, - { 108431, true }, - { 108443, true }, - { 108454, true }, - { 108472, true }, - { 108483, true }, - { 108497, true }, - { 108517, true }, - { 108530, true }, - { 108542, true }, - { 108562, true }, - { 108571, true }, - { 108580, true }, - { 108587, true }, - { 108602, true }, - { 108617, true }, - { 108631, true }, - { 108650, true }, - { 108674, true }, + { 108324, true }, + { 108340, true }, + { 108349, true }, + { 108370, true }, + { 108383, true }, + { 108401, true }, + { 108416, true }, + { 108430, true }, + { 108448, true }, + { 108466, true }, + { 108478, true }, + { 108489, true }, + { 108507, true }, + { 108518, true }, + { 108532, true }, + { 108552, true }, + { 108565, true }, + { 108577, true }, + { 108597, true }, + { 108606, true }, + { 108615, true }, + { 108622, true }, + { 108637, true }, + { 108652, true }, + { 108666, true }, { 108685, true }, - { 108699, true }, - { 108711, true }, - { 108724, true }, - { 108737, true }, - { 108748, true }, - { 108761, true }, - { 108773, true }, + { 108709, true }, + { 108720, true }, + { 108734, true }, + { 108746, true }, + { 108759, true }, + { 108772, true }, + { 108783, true }, { 108796, true }, - { 108805, true }, - { 108817, true }, - { 108834, true }, - { 108847, true }, - { 108859, true }, + { 108808, true }, + { 108831, true }, + { 108840, true }, + { 108857, true }, { 108870, true }, - { 108885, true }, - { 108899, true }, - { 108907, true }, - { 108921, true }, - { 108935, true }, - { 108943, true }, - { 108956, true }, - { 108967, true }, - { 108979, false }, - { 108992, true }, - { 109003, true }, - { 109027, true }, - { 109035, true }, - { 109045, true }, - { 109055, true }, - { 109072, true }, - { 109090, true }, - { 109108, true }, - { 109118, true }, - { 109142, true }, - { 109156, true }, - { 109175, true }, + { 108882, true }, + { 108893, true }, + { 108908, true }, + { 108922, true }, + { 108930, true }, + { 108944, true }, + { 108958, true }, + { 108966, true }, + { 108979, true }, + { 108990, true }, + { 109002, false }, + { 109015, true }, + { 109039, true }, + { 109047, true }, + { 109057, true }, + { 109067, true }, + { 109084, true }, + { 109102, true }, + { 109120, true }, + { 109130, true }, + { 109154, true }, + { 109168, true }, { 109187, true }, - { 109206, true }, - { 109223, true }, - { 109233, true }, - { 109248, true }, - { 109268, true }, + { 109199, true }, + { 109218, true }, + { 109235, true }, + { 109245, true }, + { 109260, true }, { 109280, true }, { 109292, true }, - { 109305, true }, - { 109314, true }, - { 109323, true }, - { 109332, true }, + { 109304, true }, + { 109317, true }, + { 109326, true }, + { 109335, true }, { 109344, true }, - { 109354, true }, - { 109363, true }, - { 109378, true }, - { 109393, false }, - { 109411, true }, - { 109422, true }, + { 109356, true }, + { 109366, true }, + { 109375, true }, + { 109390, true }, + { 109405, false }, + { 109423, true }, { 109434, true }, - { 109450, true }, - { 109464, true }, - { 109479, true }, - { 109495, true }, - { 109521, true }, - { 109532, true }, - { 109547, true }, - { 109562, true }, - { 109577, true }, - { 109595, true }, - { 109605, true }, - { 109620, true }, - { 109635, true }, - { 109648, true }, - { 109664, true }, - { 109687, true }, - { 109700, true }, - { 109713, true }, - { 109726, true }, - { 109745, true }, - { 109761, true }, - { 109776, true }, - { 109790, true }, - { 109802, false }, - { 109821, true }, - { 109836, true }, - { 109854, true }, - { 109865, true }, - { 109877, true }, - { 109888, true }, - { 109901, true }, - { 109924, true }, - { 109939, true }, - { 109953, true }, - { 109970, false }, - { 109984, true }, - { 109995, true }, - { 110003, true }, - { 110019, true }, - { 110032, true }, - { 110042, true }, - { 110053, true }, - { 110061, true }, - { 110078, true }, - { 110093, true }, - { 110103, true }, - { 110113, true }, - { 110124, true }, - { 110135, true }, - { 110155, true }, - { 110170, true }, - { 110187, true }, - { 110201, true }, - { 110217, true }, - { 110227, true }, - { 110238, true }, - { 110257, true }, - { 110268, true }, - { 110290, true }, - { 110304, true }, - { 110315, true }, - { 110328, true }, - { 110338, true }, - { 110356, true }, - { 110373, true }, - { 110387, true }, - { 110399, true }, - { 110415, true }, - { 110426, true }, - { 110436, true }, + { 109446, true }, + { 109462, true }, + { 109477, true }, + { 109493, true }, + { 109519, true }, + { 109530, true }, + { 109545, true }, + { 109560, true }, + { 109575, true }, + { 109593, true }, + { 109603, true }, + { 109618, true }, + { 109633, true }, + { 109646, true }, + { 109662, true }, + { 109685, true }, + { 109698, true }, + { 109711, true }, + { 109724, true }, + { 109743, true }, + { 109759, true }, + { 109774, true }, + { 109788, true }, + { 109800, false }, + { 109819, true }, + { 109834, true }, + { 109852, true }, + { 109863, true }, + { 109875, true }, + { 109886, true }, + { 109899, true }, + { 109922, true }, + { 109937, true }, + { 109951, true }, + { 109968, false }, + { 109982, true }, + { 109993, true }, + { 110001, true }, + { 110017, true }, + { 110030, true }, + { 110040, true }, + { 110051, true }, + { 110059, true }, + { 110076, true }, + { 110091, true }, + { 110101, true }, + { 110111, true }, + { 110122, true }, + { 110133, true }, + { 110153, true }, + { 110168, true }, + { 110185, true }, + { 110199, true }, + { 110215, true }, + { 110225, true }, + { 110236, true }, + { 110255, true }, + { 110266, true }, + { 110288, true }, + { 110302, true }, + { 110313, true }, + { 110326, true }, + { 110336, true }, + { 110354, true }, + { 110371, true }, + { 110385, true }, + { 110397, true }, + { 110413, true }, + { 110427, true }, + { 110438, true }, { 110448, true }, - { 110468, true }, - { 110495, true }, - { 110511, true }, - { 110526, true }, + { 110460, true }, + { 110480, true }, + { 110507, true }, + { 110523, true }, { 110538, true }, - { 110554, true }, + { 110550, true }, { 110566, true }, - { 110583, true }, - { 110603, true }, - { 110613, true }, - { 110630, true }, - { 110644, true }, - { 110661, true }, + { 110578, true }, + { 110595, true }, + { 110615, true }, + { 110625, true }, + { 110642, true }, + { 110656, true }, { 110673, true }, - { 110686, false }, - { 110700, true }, - { 110723, false }, - { 110737, true }, + { 110685, true }, + { 110698, false }, + { 110712, true }, + { 110735, false }, { 110749, true }, - { 110760, true }, + { 110761, true }, { 110772, true }, - { 110790, true }, - { 110803, true }, - { 110818, true }, - { 110836, true }, - { 110846, true }, + { 110784, true }, + { 110802, true }, + { 110815, true }, + { 110830, true }, + { 110848, true }, { 110858, true }, - { 110891, true }, - { 110901, true }, - { 110910, true }, - { 110929, true }, + { 110870, true }, + { 110903, true }, + { 110913, true }, + { 110922, true }, { 110941, true }, - { 110955, true }, - { 110976, true }, - { 110990, true }, - { 111004, true }, - { 111022, true }, - { 111040, true }, - { 111058, true }, + { 110953, true }, + { 110967, true }, + { 110988, true }, + { 111002, true }, + { 111016, true }, + { 111034, true }, + { 111052, true }, { 111070, true }, { 111082, true }, - { 111090, true }, - { 111104, true }, - { 111120, true }, - { 111135, true }, - { 111149, true }, - { 111158, true }, - { 111168, true }, + { 111094, true }, + { 111102, true }, + { 111116, true }, + { 111132, true }, + { 111147, true }, + { 111161, true }, + { 111170, true }, { 111180, true }, { 111192, true }, - { 111215, true }, + { 111204, true }, { 111227, true }, - { 111240, true }, - { 111248, true }, - { 111259, true }, - { 111268, true }, - { 111276, true }, - { 111289, true }, - { 111312, true }, + { 111239, true }, + { 111252, true }, + { 111260, true }, + { 111271, true }, + { 111280, true }, + { 111288, true }, + { 111301, true }, { 111324, true }, - { 111340, true }, - { 111363, true }, - { 111374, true }, - { 111390, true }, - { 111406, true }, - { 111421, true }, - { 111434, true }, - { 111444, true }, - { 111451, true }, - { 111464, true }, - { 111481, true }, - { 111504, true }, - { 111521, true }, - { 111539, true }, - { 111568, true }, - { 111585, true }, - { 111601, true }, - { 111611, true }, - { 111625, true }, - { 111639, true }, + { 111336, true }, + { 111352, true }, + { 111375, true }, + { 111386, true }, + { 111402, true }, + { 111418, true }, + { 111433, true }, + { 111446, true }, + { 111456, true }, + { 111463, true }, + { 111476, true }, + { 111493, true }, + { 111516, true }, + { 111533, true }, + { 111551, true }, + { 111580, true }, + { 111597, true }, + { 111613, true }, + { 111623, true }, + { 111637, true }, { 111651, true }, - { 111660, true }, - { 111676, true }, - { 111693, true }, - { 111709, false }, - { 111724, true }, - { 111737, true }, - { 111748, true }, - { 111766, true }, - { 111780, true }, - { 111798, true }, - { 111816, true }, - { 111824, true }, - { 111834, true }, - { 111842, true }, - { 111852, true }, - { 111863, true }, - { 111873, true }, - { 111887, true }, - { 111895, true }, + { 111663, true }, + { 111672, true }, + { 111688, true }, + { 111705, true }, + { 111721, false }, + { 111736, true }, + { 111749, true }, + { 111760, true }, + { 111778, true }, + { 111792, true }, + { 111810, true }, + { 111828, true }, + { 111836, true }, + { 111846, true }, + { 111854, true }, + { 111864, true }, + { 111875, true }, + { 111885, true }, + { 111899, true }, { 111907, true }, - { 111921, true }, - { 111939, true }, - { 111948, true }, - { 111959, true }, - { 111974, true }, - { 111982, true }, - { 111997, true }, - { 112015, true }, + { 111919, true }, + { 111933, true }, + { 111951, true }, + { 111960, true }, + { 111971, true }, + { 111986, true }, + { 111994, true }, + { 112009, true }, { 112027, true }, - { 112037, true }, - { 112048, true }, - { 112062, true }, + { 112039, true }, + { 112049, true }, + { 112060, true }, { 112074, true }, - { 112085, false }, - { 112101, false }, - { 112122, true }, - { 112139, true }, - { 112157, true }, - { 112174, true }, - { 112191, true }, - { 112205, true }, + { 112086, true }, + { 112097, false }, + { 112113, false }, + { 112134, true }, + { 112151, true }, + { 112169, true }, + { 112186, true }, + { 112203, true }, { 112217, true }, - { 112232, true }, - { 112240, true }, - { 112253, true }, - { 112271, true }, - { 112295, true }, - { 112312, true }, - { 112327, true }, - { 112340, true }, - { 112356, true }, - { 112369, true }, - { 112383, true }, + { 112229, true }, + { 112244, true }, + { 112252, true }, + { 112265, true }, + { 112283, true }, + { 112307, true }, + { 112324, true }, + { 112339, true }, + { 112352, true }, + { 112368, true }, + { 112381, true }, { 112395, true }, - { 112406, true }, - { 112417, true }, - { 112427, true }, - { 112438, false }, - { 112459, true }, - { 112470, true }, - { 112484, true }, + { 112407, true }, + { 112418, true }, + { 112429, true }, + { 112439, true }, + { 112450, false }, + { 112471, true }, + { 112482, true }, { 112496, true }, - { 112510, true }, - { 112528, true }, - { 112542, true }, - { 112553, true }, - { 112570, true }, - { 112581, true }, - { 112601, true }, - { 112612, true }, - { 112626, true }, - { 112640, true }, - { 112653, true }, - { 112664, true }, - { 112683, true }, - { 112699, true }, - { 112712, true }, - { 112720, true }, - { 112734, true }, - { 112747, true }, - { 112759, true }, - { 112772, true }, - { 112784, true }, - { 112796, true }, - { 112811, true }, - { 112821, true }, - { 112836, true }, - { 112850, true }, - { 112863, true }, - { 112873, false }, - { 112884, true }, - { 112906, true }, - { 112920, true }, - { 112933, true }, - { 112943, true }, - { 112953, true }, - { 112967, true }, - { 112978, true }, - { 112988, true }, - { 112999, true }, - { 113010, true }, - { 113023, true }, - { 113035, true }, - { 113045, true }, - { 113057, true }, - { 113067, true }, - { 113075, true }, - { 113097, true }, - { 113109, true }, - { 113118, true }, - { 113134, true }, - { 113143, true }, - { 113155, true }, - { 113167, true }, - { 113177, true }, - { 113187, true }, - { 113198, true }, - { 113211, false }, - { 113222, true }, - { 113235, false }, - { 113260, true }, - { 113272, true }, - { 113281, true }, - { 113298, true }, - { 113316, true }, - { 113324, true }, - { 113343, true }, - { 113356, true }, - { 113370, true }, + { 112508, true }, + { 112522, true }, + { 112540, true }, + { 112554, true }, + { 112565, true }, + { 112582, true }, + { 112593, true }, + { 112613, true }, + { 112627, true }, + { 112641, true }, + { 112654, true }, + { 112665, true }, + { 112684, true }, + { 112700, true }, + { 112713, true }, + { 112721, true }, + { 112735, true }, + { 112748, true }, + { 112760, true }, + { 112773, true }, + { 112785, true }, + { 112797, true }, + { 112812, true }, + { 112822, true }, + { 112837, true }, + { 112851, true }, + { 112864, true }, + { 112874, false }, + { 112885, true }, + { 112907, true }, + { 112921, true }, + { 112934, true }, + { 112944, true }, + { 112954, true }, + { 112968, true }, + { 112979, true }, + { 112989, true }, + { 113000, true }, + { 113011, true }, + { 113024, true }, + { 113036, true }, + { 113046, true }, + { 113058, true }, + { 113068, true }, + { 113076, true }, + { 113098, true }, + { 113110, true }, + { 113119, true }, + { 113135, true }, + { 113144, true }, + { 113156, true }, + { 113168, true }, + { 113178, true }, + { 113188, true }, + { 113199, true }, + { 113212, false }, + { 113223, true }, + { 113236, false }, + { 113261, true }, + { 113273, true }, + { 113282, true }, + { 113291, true }, + { 113308, true }, + { 113326, true }, + { 113334, true }, + { 113353, true }, + { 113366, true }, { 113380, true }, - { 113392, true }, - { 113406, true }, - { 113424, true }, - { 113442, true }, - { 113456, true }, - { 113474, true }, + { 113390, true }, + { 113402, true }, + { 113426, true }, + { 113440, true }, + { 113458, true }, + { 113476, true }, { 113490, true }, - { 113509, true }, - { 113519, true }, - { 113542, true }, - { 113556, false }, - { 113569, true }, - { 113579, true }, - { 113592, true }, - { 113601, true }, - { 113612, true }, - { 113624, false }, - { 113637, true }, - { 113647, true }, - { 113655, true }, - { 113667, true }, - { 113679, true }, - { 113687, true }, - { 113699, true }, - { 113714, true }, - { 113723, true }, - { 113729, true }, - { 113741, true }, - { 113751, true }, - { 113760, true }, - { 113770, true }, - { 113777, false }, - { 113792, true }, - { 113810, true }, - { 113825, true }, - { 113838, true }, - { 113852, true }, - { 113864, true }, - { 113878, true }, - { 113891, true }, - { 113902, true }, - { 113911, true }, - { 113926, true }, + { 113508, true }, + { 113524, true }, + { 113543, true }, + { 113553, true }, + { 113576, true }, + { 113590, false }, + { 113603, true }, + { 113613, true }, + { 113626, true }, + { 113635, true }, + { 113646, true }, + { 113658, false }, + { 113671, true }, + { 113681, true }, + { 113689, true }, + { 113701, true }, + { 113713, true }, + { 113721, true }, + { 113733, true }, + { 113748, true }, + { 113757, true }, + { 113763, true }, + { 113775, true }, + { 113785, true }, + { 113794, true }, + { 113804, true }, + { 113811, false }, + { 113826, true }, + { 113844, true }, + { 113859, true }, + { 113872, true }, + { 113886, true }, + { 113898, true }, + { 113912, true }, + { 113925, true }, + { 113936, true }, { 113945, true }, - { 113955, true }, - { 113968, true }, - { 113976, true }, + { 113960, true }, + { 113979, true }, { 113989, true }, - { 114001, true }, - { 114014, true }, - { 114034, true }, - { 114053, true }, - { 114070, true }, - { 114082, true }, - { 114097, true }, - { 114110, true }, - { 114122, true }, - { 114141, true }, - { 114149, true }, - { 114168, true }, - { 114186, true }, - { 114208, true }, - { 114224, true }, - { 114235, true }, - { 114250, true }, - { 114260, true }, - { 114274, true }, - { 114289, true }, + { 114002, true }, + { 114010, true }, + { 114023, true }, + { 114035, true }, + { 114048, true }, + { 114068, true }, + { 114087, true }, + { 114104, true }, + { 114116, true }, + { 114131, true }, + { 114144, true }, + { 114156, true }, + { 114175, true }, + { 114183, true }, + { 114202, true }, + { 114220, true }, + { 114242, true }, + { 114258, true }, + { 114269, true }, + { 114284, true }, + { 114294, true }, { 114308, true }, - { 114317, false }, - { 114328, true }, - { 114336, true }, - { 114344, true }, - { 114352, true }, - { 114368, true }, - { 114376, true }, - { 114387, true }, - { 114399, false }, - { 114413, true }, - { 114427, true }, - { 114438, true }, + { 114323, true }, + { 114342, true }, + { 114351, false }, + { 114362, true }, + { 114370, true }, + { 114378, true }, + { 114386, true }, + { 114402, true }, + { 114410, true }, + { 114421, true }, + { 114433, false }, { 114447, true }, - { 114463, true }, - { 114485, true }, + { 114461, true }, + { 114472, true }, + { 114481, true }, { 114497, true }, - { 114515, true }, - { 114522, true }, - { 114534, true }, - { 114544, true }, - { 114560, true }, - { 114570, true }, - { 114582, true }, - { 114600, true }, - { 114618, true }, - { 114638, true }, - { 114648, true }, - { 114671, true }, - { 114726, true }, - { 114738, true }, - { 114753, true }, - { 114763, true }, - { 114781, true }, - { 114796, true }, - { 114809, false }, - { 114823, true }, - { 114837, false }, - { 114853, true }, - { 114878, true }, - { 114888, true }, - { 114899, true }, - { 114911, true }, + { 114519, true }, + { 114531, true }, + { 114549, true }, + { 114556, true }, + { 114568, true }, + { 114578, true }, + { 114594, true }, + { 114604, true }, + { 114616, true }, + { 114634, true }, + { 114652, true }, + { 114672, true }, + { 114682, true }, + { 114705, true }, + { 114760, true }, + { 114772, true }, + { 114787, true }, + { 114797, true }, + { 114815, true }, + { 114830, true }, + { 114843, false }, + { 114857, true }, + { 114871, false }, + { 114887, true }, + { 114912, true }, + { 114922, true }, { 114933, true }, - { 114956, true }, - { 114966, true }, - { 114976, true }, - { 114999, true }, - { 115012, false }, - { 115026, true }, - { 115044, true }, - { 115055, true }, - { 115066, true }, - { 115085, true }, - { 115101, true }, - { 115114, true }, - { 115139, true }, - { 115153, true }, - { 115166, true }, - { 115195, true }, - { 115208, true }, - { 115218, true }, - { 115230, true }, + { 114945, true }, + { 114967, true }, + { 114990, true }, + { 115000, true }, + { 115010, true }, + { 115033, true }, + { 115046, false }, + { 115060, true }, + { 115078, true }, + { 115089, true }, + { 115100, true }, + { 115119, true }, + { 115135, true }, + { 115148, true }, + { 115173, true }, + { 115187, true }, + { 115200, true }, + { 115229, true }, { 115242, true }, - { 115261, true }, - { 115271, true }, - { 115285, true }, - { 115302, true }, + { 115252, true }, + { 115264, true }, + { 115276, true }, + { 115295, true }, + { 115305, true }, { 115319, true }, - { 115331, true }, - { 115345, true }, - { 115359, true }, - { 115369, true }, - { 115386, true }, - { 115398, true }, - { 115409, true }, - { 115425, true }, - { 115440, true }, - { 115452, false }, - { 115461, true }, - { 115481, true }, - { 115501, true }, - { 115517, true }, - { 115531, true }, - { 115544, true }, - { 115559, true }, - { 115571, true }, - { 115581, true }, - { 115602, true }, - { 115616, true }, - { 115630, true }, - { 115648, true }, - { 115663, true }, - { 115675, true }, - { 115693, true }, - { 115704, true }, - { 115717, true }, + { 115336, true }, + { 115353, true }, + { 115365, true }, + { 115379, true }, + { 115393, true }, + { 115403, true }, + { 115420, true }, + { 115432, true }, + { 115443, true }, + { 115459, true }, + { 115474, true }, + { 115486, false }, + { 115495, true }, + { 115515, true }, + { 115535, true }, + { 115551, true }, + { 115565, true }, + { 115578, true }, + { 115593, true }, + { 115605, true }, + { 115615, true }, + { 115636, true }, + { 115650, true }, + { 115664, true }, + { 115682, true }, + { 115697, true }, + { 115709, true }, { 115727, true }, - { 115739, true }, - { 115753, true }, - { 115765, true }, - { 115784, true }, - { 115796, true }, - { 115808, true }, - { 115820, true }, - { 115841, true }, - { 115857, true }, - { 115870, true }, - { 115887, true }, - { 115902, true }, - { 115916, true }, - { 115929, true }, - { 115942, true }, - { 115956, true }, - { 115971, true }, - { 115983, true }, - { 115996, true }, - { 116015, true }, - { 116038, false }, - { 116051, true }, - { 116059, true }, - { 116079, false }, - { 116097, true }, - { 116117, true }, - { 116130, true }, - { 116145, true }, - { 116160, true }, - { 116175, true }, - { 116189, true }, - { 116204, true }, - { 116217, true }, - { 116242, true }, - { 116253, true }, - { 116269, true }, - { 116283, true }, - { 116296, true }, - { 116324, true }, - { 116351, true }, - { 116376, true }, - { 116404, true }, - { 116418, true }, - { 116432, true }, - { 116446, true }, - { 116462, true }, - { 116475, true }, - { 116486, true }, - { 116497, true }, - { 116508, true }, + { 115738, true }, + { 115751, true }, + { 115761, true }, + { 115773, true }, + { 115787, true }, + { 115799, true }, + { 115818, true }, + { 115830, true }, + { 115842, true }, + { 115854, true }, + { 115875, true }, + { 115891, true }, + { 115904, true }, + { 115921, true }, + { 115936, true }, + { 115950, true }, + { 115963, true }, + { 115976, true }, + { 115990, true }, + { 116005, true }, + { 116017, true }, + { 116030, true }, + { 116049, true }, + { 116072, false }, + { 116085, true }, + { 116093, true }, + { 116113, false }, + { 116131, true }, + { 116151, true }, + { 116164, true }, + { 116179, true }, + { 116194, true }, + { 116209, true }, + { 116223, true }, + { 116238, true }, + { 116251, true }, + { 116276, true }, + { 116287, true }, + { 116303, true }, + { 116317, true }, + { 116330, true }, + { 116358, true }, + { 116385, true }, + { 116410, true }, + { 116438, true }, + { 116452, true }, + { 116466, true }, + { 116480, true }, + { 116496, true }, + { 116509, true }, { 116520, true }, - { 116548, true }, - { 116558, true }, - { 116568, true }, - { 116585, true }, + { 116531, true }, + { 116542, true }, + { 116554, true }, + { 116582, true }, + { 116592, true }, { 116602, true }, - { 116612, true }, - { 116635, true }, - { 116645, true }, - { 116654, true }, - { 116676, true }, + { 116619, true }, + { 116636, true }, + { 116646, true }, + { 116669, true }, + { 116679, true }, { 116688, true }, - { 116699, true }, - { 116711, true }, - { 116723, true }, - { 116734, true }, - { 116752, true }, - { 116767, true }, - { 116777, true }, + { 116710, true }, + { 116722, true }, + { 116733, true }, + { 116745, true }, + { 116757, true }, + { 116768, true }, { 116786, true }, - { 116804, false }, - { 116815, true }, - { 116826, true }, - { 116836, true }, - { 116844, true }, - { 116858, true }, + { 116801, true }, + { 116811, true }, + { 116820, true }, + { 116838, false }, + { 116849, true }, + { 116860, true }, { 116870, true }, - { 116882, true }, - { 116900, true }, - { 116920, true }, - { 116935, true }, - { 116952, true }, - { 116968, true }, - { 116981, true }, - { 116992, true }, - { 117007, true }, - { 117028, true }, - { 117044, true }, - { 117057, true }, - { 117082, true }, - { 117098, true }, - { 117107, true }, - { 117127, true }, - { 117142, true }, - { 117153, true }, - { 117164, true }, - { 117178, true }, - { 117190, true }, - { 117207, true }, - { 117218, true }, - { 117226, true }, - { 117238, true }, - { 117250, true }, - { 117264, true }, - { 117278, true }, - { 117295, true }, - { 117311, true }, - { 117327, true }, - { 117343, true }, - { 117362, true }, + { 116878, true }, + { 116892, true }, + { 116904, true }, + { 116916, true }, + { 116934, true }, + { 116954, true }, + { 116969, true }, + { 116986, true }, + { 117002, true }, + { 117015, true }, + { 117026, true }, + { 117041, true }, + { 117062, true }, + { 117078, true }, + { 117091, true }, + { 117116, true }, + { 117132, true }, + { 117141, true }, + { 117161, true }, + { 117176, true }, + { 117187, true }, + { 117198, true }, + { 117212, true }, + { 117224, true }, + { 117241, true }, + { 117252, true }, + { 117260, true }, + { 117272, true }, + { 117284, true }, + { 117298, true }, + { 117312, true }, + { 117329, true }, + { 117345, true }, + { 117361, true }, { 117377, true }, - { 117389, true }, - { 117406, false }, - { 117426, true }, - { 117442, true }, - { 117453, true }, - { 117473, true }, - { 117494, true }, - { 117515, false }, - { 117532, true }, - { 117551, true }, + { 117396, true }, + { 117411, true }, + { 117423, true }, + { 117440, false }, + { 117460, true }, + { 117476, true }, + { 117487, true }, + { 117507, true }, + { 117528, true }, + { 117549, false }, { 117566, true }, - { 117577, true }, - { 117594, true }, - { 117602, true }, - { 117629, true }, - { 117640, true }, - { 117657, true }, - { 117667, true }, - { 117682, true }, - { 117694, true }, - { 117715, true }, - { 117724, true }, - { 117737, true }, - { 117750, true }, - { 117768, true }, - { 117777, true }, - { 117786, true }, - { 117795, false }, - { 117812, false }, - { 117823, true }, - { 117841, true }, - { 117852, true }, - { 117867, true }, - { 117882, true }, - { 117898, true }, - { 117920, true }, - { 117935, true }, - { 117943, true }, - { 117956, true }, - { 117968, true }, - { 117985, true }, - { 117999, true }, - { 118009, true }, - { 118027, true }, - { 118044, true }, + { 117585, true }, + { 117600, true }, + { 117611, true }, + { 117628, true }, + { 117636, true }, + { 117663, true }, + { 117674, true }, + { 117691, true }, + { 117701, true }, + { 117716, true }, + { 117728, true }, + { 117749, true }, + { 117758, true }, + { 117771, true }, + { 117784, true }, + { 117802, true }, + { 117811, true }, + { 117820, true }, + { 117829, false }, + { 117846, false }, + { 117857, true }, + { 117875, true }, + { 117886, true }, + { 117901, true }, + { 117916, true }, + { 117932, true }, + { 117954, true }, + { 117969, true }, + { 117977, true }, + { 117990, true }, + { 118002, true }, + { 118019, true }, + { 118033, true }, + { 118043, true }, { 118061, true }, - { 118069, true }, - { 118093, true }, - { 118111, true }, - { 118125, true }, - { 118143, true }, - { 118156, true }, - { 118170, true }, - { 118184, true }, - { 118203, true }, - { 118213, true }, - { 118235, true }, + { 118078, true }, + { 118095, true }, + { 118103, true }, + { 118127, true }, + { 118145, true }, + { 118159, true }, + { 118177, true }, + { 118190, true }, + { 118204, true }, + { 118218, true }, + { 118237, true }, { 118247, true }, - { 118258, true }, - { 118285, true }, - { 118297, true }, - { 118309, true }, - { 118330, true }, + { 118269, true }, + { 118281, true }, + { 118292, true }, + { 118319, true }, + { 118331, true }, { 118343, true }, - { 118350, true }, - { 118370, true }, - { 118380, true }, - { 118392, true }, - { 118408, true }, - { 118418, false }, - { 118435, true }, - { 118446, true }, - { 118453, true }, - { 118462, true }, - { 118481, true }, - { 118494, true }, - { 118504, true }, - { 118524, true }, - { 118534, true }, - { 118544, true }, - { 118552, true }, - { 118565, true }, - { 118582, true }, - { 118594, false }, - { 118605, false }, - { 118620, true }, - { 118632, true }, - { 118642, true }, - { 118660, true }, - { 118671, true }, - { 118683, true }, - { 118704, false }, - { 118730, true }, - { 118744, true }, - { 118758, true }, - { 118772, true }, - { 118785, true }, - { 118799, false }, - { 118812, true }, - { 118823, true }, - { 118837, true }, - { 118850, true }, - { 118862, true }, - { 118875, true }, - { 118892, false }, - { 118906, true }, + { 118364, true }, + { 118377, true }, + { 118384, true }, + { 118404, true }, + { 118414, true }, + { 118426, true }, + { 118442, true }, + { 118452, false }, + { 118469, true }, + { 118480, true }, + { 118487, true }, + { 118496, true }, + { 118515, true }, + { 118528, true }, + { 118538, true }, + { 118558, true }, + { 118568, true }, + { 118578, true }, + { 118586, true }, + { 118599, true }, + { 118616, true }, + { 118628, false }, + { 118639, false }, + { 118654, true }, + { 118666, true }, + { 118681, true }, + { 118691, true }, + { 118709, true }, + { 118720, true }, + { 118732, true }, + { 118753, false }, + { 118779, true }, + { 118793, true }, + { 118807, true }, + { 118821, true }, + { 118834, true }, + { 118848, false }, + { 118861, true }, + { 118872, true }, + { 118886, true }, + { 118899, true }, + { 118911, true }, { 118924, true }, - { 118937, true }, - { 118950, true }, - { 118963, true }, - { 118983, true }, - { 118993, true }, - { 119004, true }, - { 119015, true }, - { 119026, true }, - { 119038, true }, - { 119051, true }, + { 118941, false }, + { 118955, true }, + { 118973, true }, + { 118986, true }, + { 118999, true }, + { 119012, true }, + { 119032, true }, + { 119042, true }, + { 119053, true }, + { 119064, true }, { 119075, true }, { 119087, true }, - { 119099, true }, - { 119113, true }, - { 119128, true }, - { 119151, true }, + { 119100, true }, + { 119124, true }, + { 119136, true }, + { 119148, true }, { 119162, true }, - { 119176, true }, - { 119189, false }, - { 119204, true }, - { 119216, true }, - { 119226, true }, - { 119242, true }, - { 119254, true }, - { 119268, true }, - { 119278, true }, - { 119292, true }, - { 119305, true }, - { 119318, true }, - { 119332, true }, - { 119342, true }, - { 119370, true }, - { 119398, true }, - { 119408, true }, - { 119420, true }, - { 119430, true }, - { 119440, true }, - { 119453, true }, + { 119177, true }, + { 119200, true }, + { 119211, true }, + { 119225, true }, + { 119238, false }, + { 119253, true }, + { 119265, true }, + { 119275, true }, + { 119291, true }, + { 119303, true }, + { 119317, true }, + { 119327, true }, + { 119341, true }, + { 119354, true }, + { 119367, true }, + { 119381, true }, + { 119391, true }, + { 119419, true }, + { 119447, true }, + { 119457, true }, { 119469, true }, - { 119482, true }, - { 119498, false }, - { 119513, true }, + { 119479, true }, + { 119489, true }, + { 119502, true }, + { 119518, true }, { 119531, true }, - { 119550, true }, - { 119558, true }, - { 119571, true }, - { 119586, true }, - { 119600, true }, - { 119616, true }, - { 119630, true }, - { 119648, true }, - { 119658, true }, - { 119667, false }, - { 119678, true }, - { 119694, true }, - { 119705, true }, - { 119715, true }, + { 119547, false }, + { 119562, true }, + { 119580, true }, + { 119599, true }, + { 119607, true }, + { 119620, true }, + { 119635, true }, + { 119649, true }, + { 119665, true }, + { 119679, true }, + { 119697, true }, + { 119707, true }, + { 119716, false }, { 119727, true }, - { 119737, true }, + { 119743, true }, + { 119754, true }, { 119764, true }, - { 119782, true }, - { 119796, true }, - { 119807, true }, - { 119816, true }, - { 119825, true }, - { 119842, false }, + { 119776, true }, + { 119786, true }, + { 119813, true }, + { 119831, true }, + { 119845, true }, { 119856, true }, - { 119879, true }, - { 119895, true }, - { 119916, true }, - { 119932, true }, - { 119945, true }, - { 119967, true }, - { 119977, true }, - { 119985, true }, + { 119865, true }, + { 119874, true }, + { 119891, false }, + { 119905, true }, + { 119928, true }, + { 119944, true }, + { 119965, true }, + { 119981, true }, { 119994, true }, - { 120005, true }, - { 120020, true }, + { 120016, true }, + { 120026, true }, { 120034, true }, - { 120044, true }, - { 120061, true }, - { 120076, true }, - { 120090, true }, - { 120100, true }, - { 120120, true }, - { 120130, true }, - { 120144, true }, - { 120156, true }, - { 120175, true }, - { 120188, true }, - { 120212, false }, - { 120231, true }, - { 120259, true }, - { 120273, true }, - { 120287, true }, - { 120299, true }, - { 120313, true }, - { 120323, true }, - { 120345, true }, - { 120364, true }, - { 120382, true }, - { 120390, true }, - { 120406, true }, - { 120421, true }, - { 120429, true }, - { 120440, true }, - { 120453, true }, - { 120469, true }, - { 120483, true }, - { 120499, true }, - { 120513, true }, - { 120528, true }, - { 120543, true }, - { 120555, true }, - { 120567, true }, - { 120586, true }, - { 120602, false }, - { 120627, true }, - { 120646, true }, - { 120663, true }, - { 120673, true }, - { 120684, true }, - { 120696, false }, - { 120711, true }, - { 120729, true }, - { 120738, true }, - { 120745, true }, - { 120756, true }, - { 120770, true }, - { 120783, true }, - { 120796, true }, - { 120809, true }, - { 120820, true }, - { 120833, true }, - { 120843, true }, - { 120853, true }, - { 120865, true }, - { 120873, true }, - { 120885, true }, - { 120894, true }, - { 120901, true }, - { 120911, true }, + { 120043, true }, + { 120054, true }, + { 120069, true }, + { 120083, true }, + { 120093, true }, + { 120110, true }, + { 120125, true }, + { 120139, true }, + { 120149, true }, + { 120169, true }, + { 120179, true }, + { 120193, true }, + { 120205, true }, + { 120224, true }, + { 120237, true }, + { 120261, false }, + { 120280, true }, + { 120308, true }, + { 120322, true }, + { 120336, true }, + { 120348, true }, + { 120362, true }, + { 120372, true }, + { 120394, true }, + { 120413, true }, + { 120431, true }, + { 120439, true }, + { 120455, true }, + { 120470, true }, + { 120478, true }, + { 120489, true }, + { 120502, true }, + { 120518, true }, + { 120532, true }, + { 120548, true }, + { 120562, true }, + { 120577, true }, + { 120592, true }, + { 120604, true }, + { 120616, true }, + { 120635, true }, + { 120651, false }, + { 120676, true }, + { 120695, true }, + { 120712, true }, + { 120722, true }, + { 120733, true }, + { 120745, false }, + { 120760, true }, + { 120778, true }, + { 120787, true }, + { 120794, true }, + { 120805, true }, + { 120819, true }, + { 120832, true }, + { 120845, true }, + { 120858, true }, + { 120869, true }, + { 120882, true }, + { 120892, true }, + { 120902, true }, + { 120914, true }, { 120922, true }, - { 120932, true }, + { 120934, true }, + { 120943, true }, { 120950, true }, - { 120968, true }, - { 120982, true }, - { 120996, true }, - { 121019, true }, - { 121029, true }, - { 121044, true }, - { 121062, true }, - { 121079, true }, + { 120960, true }, + { 120971, true }, + { 120981, true }, + { 120999, true }, + { 121017, true }, + { 121031, true }, + { 121045, true }, + { 121068, true }, + { 121078, true }, { 121093, true }, - { 121107, true }, - { 121122, true }, - { 121138, true }, - { 121151, true }, - { 121165, true }, - { 121177, true }, - { 121189, true }, - { 121201, true }, + { 121111, true }, + { 121128, true }, + { 121142, true }, + { 121156, true }, + { 121171, true }, + { 121187, true }, + { 121200, true }, { 121214, true }, - { 121227, false }, + { 121226, true }, { 121238, true }, - { 121252, true }, - { 121265, true }, - { 121280, true }, + { 121250, true }, + { 121263, true }, + { 121276, false }, { 121287, true }, - { 121306, true }, - { 121325, true }, - { 121340, true }, - { 121364, false }, - { 121379, true }, - { 121390, true }, + { 121301, true }, + { 121314, true }, + { 121329, true }, + { 121336, true }, + { 121355, true }, + { 121374, true }, + { 121389, true }, { 121413, false }, - { 121424, false }, - { 121435, false }, - { 121447, true }, - { 121461, true }, - { 121474, true }, - { 121487, true }, - { 121500, true }, - { 121522, true }, - { 121532, true }, - { 121552, true }, - { 121570, true }, - { 121584, true }, - { 121601, false }, - { 121616, false }, - { 121632, true }, - { 121649, true }, - { 121660, true }, - { 121682, true }, - { 121696, true }, - { 121716, true }, - { 121726, true }, - { 121737, true }, + { 121428, true }, + { 121439, true }, + { 121462, false }, + { 121473, false }, + { 121484, false }, + { 121496, true }, + { 121510, true }, + { 121523, true }, + { 121536, true }, + { 121549, true }, + { 121571, true }, + { 121581, true }, + { 121601, true }, + { 121619, true }, + { 121633, true }, + { 121650, false }, + { 121665, false }, + { 121681, true }, + { 121698, true }, + { 121709, true }, + { 121731, true }, { 121745, true }, - { 121754, true }, { 121765, true }, - { 121777, true }, - { 121787, true }, - { 121802, true }, - { 121815, true }, - { 121829, true }, - { 121837, true }, - { 121854, true }, - { 121875, true }, - { 121889, true }, - { 121904, true }, - { 121918, true }, + { 121775, true }, + { 121786, true }, + { 121794, true }, + { 121803, true }, + { 121814, true }, + { 121826, true }, + { 121836, true }, + { 121851, true }, + { 121864, true }, + { 121878, true }, + { 121886, true }, + { 121903, true }, + { 121924, true }, { 121938, true }, { 121953, true }, - { 121964, true }, - { 121976, true }, - { 121995, true }, - { 122008, true }, - { 122020, true }, - { 122031, false }, - { 122047, true }, - { 122060, true }, - { 122074, true }, - { 122087, true }, - { 122097, true }, - { 122120, true }, - { 122140, true }, - { 122151, true }, - { 122161, true }, - { 122171, true }, - { 122186, true }, - { 122196, true }, - { 122213, true }, - { 122229, true }, - { 122244, true }, - { 122264, true }, - { 122274, true }, - { 122288, true }, - { 122300, true }, - { 122314, true }, - { 122328, true }, - { 122342, true }, - { 122356, true }, - { 122370, true }, - { 122385, true }, - { 122399, true }, - { 122413, true }, - { 122427, true }, - { 122447, true }, - { 122464, true }, - { 122486, true }, - { 122501, true }, - { 122512, true }, - { 122525, true }, - { 122543, true }, - { 122558, true }, - { 122574, true }, - { 122586, true }, - { 122603, true }, - { 122616, true }, - { 122631, true }, - { 122640, false }, - { 122655, true }, - { 122666, true }, - { 122681, true }, - { 122693, true }, - { 122710, true }, - { 122719, true }, - { 122731, true }, - { 122748, false }, - { 122758, true }, - { 122777, true }, - { 122787, true }, - { 122803, true }, - { 122823, true }, - { 122837, true }, - { 122856, true }, - { 122876, true }, - { 122888, true }, - { 122904, true }, - { 122914, true }, - { 122929, true }, - { 122939, true }, - { 122953, true }, - { 122963, true }, - { 122982, true }, - { 122999, true }, - { 123008, true }, - { 123021, true }, - { 123036, true }, - { 123050, true }, - { 123069, true }, - { 123087, true }, - { 123101, true }, + { 121967, true }, + { 121987, true }, + { 122002, true }, + { 122013, true }, + { 122025, true }, + { 122044, true }, + { 122057, true }, + { 122069, true }, + { 122080, false }, + { 122096, true }, + { 122109, true }, + { 122123, true }, + { 122136, true }, + { 122146, true }, + { 122166, true }, + { 122189, true }, + { 122209, true }, + { 122220, true }, + { 122230, true }, + { 122240, true }, + { 122255, true }, + { 122265, true }, + { 122282, true }, + { 122298, true }, + { 122313, true }, + { 122333, true }, + { 122343, true }, + { 122357, true }, + { 122369, true }, + { 122383, true }, + { 122397, true }, + { 122411, true }, + { 122425, true }, + { 122439, true }, + { 122454, true }, + { 122468, true }, + { 122482, true }, + { 122496, true }, + { 122516, true }, + { 122533, true }, + { 122548, true }, + { 122559, true }, + { 122572, true }, + { 122590, true }, + { 122605, true }, + { 122621, true }, + { 122633, true }, + { 122650, true }, + { 122663, true }, + { 122678, true }, + { 122687, false }, + { 122702, true }, + { 122713, true }, + { 122728, true }, + { 122740, true }, + { 122757, true }, + { 122766, true }, + { 122778, true }, + { 122795, false }, + { 122805, true }, + { 122824, true }, + { 122834, true }, + { 122850, true }, + { 122870, true }, + { 122884, true }, + { 122903, true }, + { 122923, true }, + { 122935, true }, + { 122951, true }, + { 122961, true }, + { 122976, true }, + { 122986, true }, + { 123000, true }, + { 123010, true }, + { 123029, true }, + { 123046, true }, + { 123055, true }, + { 123068, true }, + { 123083, true }, + { 123097, true }, { 123116, true }, - { 123132, true }, + { 123134, true }, { 123148, true }, - { 123156, true }, - { 123176, true }, - { 123188, true }, - { 123200, true }, - { 123212, true }, - { 123225, true }, - { 123238, true }, - { 123252, true }, - { 123266, true }, - { 123280, false }, - { 123306, true }, - { 123317, true }, - { 123326, true }, - { 123334, true }, - { 123342, true }, - { 123350, true }, - { 123360, true }, - { 123369, true }, + { 123163, true }, + { 123179, true }, + { 123195, true }, + { 123203, true }, + { 123223, true }, + { 123235, true }, + { 123247, true }, + { 123259, true }, + { 123272, true }, + { 123285, true }, + { 123299, true }, + { 123313, true }, + { 123327, false }, + { 123353, true }, + { 123364, true }, + { 123373, true }, { 123381, true }, - { 123400, true }, - { 123410, true }, - { 123421, true }, - { 123431, true }, - { 123448, true }, - { 123461, true }, - { 123471, true }, - { 123485, true }, - { 123496, true }, - { 123514, true }, + { 123389, true }, + { 123397, true }, + { 123407, true }, + { 123416, true }, + { 123428, true }, + { 123447, true }, + { 123457, true }, + { 123468, true }, + { 123478, true }, + { 123495, true }, + { 123508, true }, + { 123518, true }, { 123532, true }, - { 123546, true }, - { 123556, true }, - { 123570, true }, - { 123577, true }, - { 123587, true }, - { 123602, true }, + { 123543, true }, + { 123561, true }, + { 123579, true }, + { 123593, true }, + { 123603, true }, + { 123617, true }, { 123624, true }, - { 123632, true }, - { 123642, true }, - { 123661, true }, - { 123673, true }, - { 123683, true }, - { 123693, true }, - { 123703, true }, - { 123714, true }, - { 123727, true }, - { 123735, true }, - { 123749, true }, - { 123759, true }, - { 123770, true }, - { 123777, true }, - { 123785, true }, - { 123803, true }, - { 123814, true }, - { 123830, false }, - { 123845, true }, - { 123855, true }, - { 123864, true }, - { 123872, true }, - { 123881, true }, - { 123890, true }, - { 123910, true }, - { 123919, false }, - { 123930, true }, - { 123942, false }, - { 123956, true }, - { 123965, true }, - { 123981, true }, - { 123993, true }, - { 124008, true }, - { 124018, true }, - { 124030, true }, - { 124042, true }, - { 124053, true }, - { 124064, true }, - { 124076, true }, - { 124099, true }, - { 124109, true }, - { 124119, true }, - { 124135, true }, - { 124150, true }, - { 124163, true }, + { 123634, true }, + { 123649, true }, + { 123671, true }, + { 123679, true }, + { 123689, true }, + { 123708, true }, + { 123720, true }, + { 123730, true }, + { 123740, true }, + { 123750, true }, + { 123761, true }, + { 123774, true }, + { 123782, true }, + { 123796, true }, + { 123806, true }, + { 123817, true }, + { 123824, true }, + { 123832, true }, + { 123850, true }, + { 123861, true }, + { 123877, false }, + { 123892, true }, + { 123902, true }, + { 123911, true }, + { 123919, true }, + { 123928, true }, + { 123937, true }, + { 123957, true }, + { 123966, false }, + { 123977, true }, + { 123989, false }, + { 124003, true }, + { 124012, true }, + { 124028, true }, + { 124041, true }, + { 124054, true }, + { 124066, true }, + { 124081, true }, + { 124091, true }, + { 124103, true }, + { 124115, true }, + { 124126, true }, + { 124137, true }, + { 124149, true }, { 124172, true }, - { 124187, true }, - { 124200, true }, - { 124213, true }, + { 124182, true }, + { 124192, true }, + { 124208, true }, { 124223, true }, - { 124240, true }, - { 124256, true }, - { 124270, false }, - { 124280, true }, - { 124291, true }, + { 124236, true }, + { 124245, true }, + { 124260, true }, + { 124273, true }, + { 124286, true }, { 124301, true }, - { 124315, true }, - { 124326, true }, - { 124339, true }, - { 124352, true }, - { 124369, true }, - { 124381, true }, - { 124398, true }, - { 124416, true }, + { 124311, true }, + { 124328, true }, + { 124344, true }, + { 124358, false }, + { 124368, true }, + { 124379, true }, + { 124389, true }, + { 124403, true }, + { 124414, true }, { 124427, true }, { 124440, true }, - { 124461, true }, - { 124472, true }, - { 124496, true }, - { 124511, true }, - { 124536, true }, - { 124544, true }, - { 124560, false }, - { 124575, true }, - { 124587, true }, + { 124457, true }, + { 124469, true }, + { 124486, true }, + { 124504, true }, + { 124515, true }, + { 124528, true }, + { 124549, true }, + { 124560, true }, + { 124584, true }, { 124599, true }, - { 124613, true }, - { 124627, true }, - { 124641, true }, - { 124655, true }, - { 124672, true }, - { 124699, true }, - { 124716, true }, - { 124736, true }, - { 124748, true }, - { 124758, true }, - { 124772, true }, - { 124794, true }, - { 124808, true }, - { 124826, true }, - { 124847, true }, - { 124864, true }, - { 124875, true }, - { 124889, true }, - { 124902, true }, - { 124918, true }, - { 124930, true }, - { 124946, true }, + { 124624, true }, + { 124632, true }, + { 124648, false }, + { 124663, true }, + { 124675, true }, + { 124687, true }, + { 124701, true }, + { 124715, true }, + { 124729, true }, + { 124743, true }, + { 124760, true }, + { 124787, true }, + { 124804, true }, + { 124824, true }, + { 124836, true }, + { 124846, true }, + { 124860, true }, + { 124882, true }, + { 124896, true }, + { 124914, true }, + { 124935, true }, + { 124952, true }, { 124963, true }, { 124977, true }, - { 124989, false }, - { 125014, true }, - { 125038, true }, - { 125048, false }, - { 125074, true }, - { 125091, true }, - { 125108, true }, - { 125122, true }, - { 125152, false }, - { 125166, true }, - { 125183, true }, - { 125197, true }, - { 125220, true }, - { 125238, true }, - { 125253, true }, - { 125261, true }, - { 125269, true }, - { 125277, true }, + { 124990, true }, + { 125006, true }, + { 125018, true }, + { 125034, true }, + { 125051, true }, + { 125065, true }, + { 125077, false }, + { 125102, true }, + { 125126, true }, + { 125136, false }, + { 125162, true }, + { 125179, true }, + { 125196, true }, + { 125210, true }, + { 125240, false }, + { 125254, true }, + { 125271, true }, { 125285, true }, - { 125293, true }, - { 125304, true }, - { 125314, true }, - { 125328, true }, - { 125347, true }, - { 125363, true }, - { 125374, true }, - { 125399, true }, - { 125411, true }, - { 125420, false }, - { 125436, true }, - { 125446, false }, - { 125468, true }, - { 125483, true }, - { 125497, true }, - { 125510, true }, - { 125527, true }, - { 125543, true }, - { 125566, true }, - { 125588, true }, - { 125606, true }, - { 125625, false }, - { 125644, true }, - { 125657, true }, - { 125670, true }, + { 125308, true }, + { 125326, true }, + { 125341, true }, + { 125349, true }, + { 125357, true }, + { 125365, true }, + { 125373, true }, + { 125381, true }, + { 125392, true }, + { 125402, true }, + { 125416, true }, + { 125435, true }, + { 125451, true }, + { 125462, true }, + { 125487, true }, + { 125499, true }, + { 125508, false }, + { 125524, true }, + { 125534, false }, + { 125556, true }, + { 125571, true }, + { 125585, true }, + { 125598, true }, + { 125615, true }, + { 125631, true }, + { 125654, true }, + { 125676, true }, { 125694, true }, - { 125705, true }, - { 125724, true }, - { 125752, true }, - { 125773, true }, - { 125786, true }, - { 125802, true }, - { 125822, true }, - { 125842, true }, - { 125856, true }, - { 125869, true }, - { 125890, false }, - { 125901, true }, - { 125920, true }, - { 125931, true }, - { 125943, true }, - { 125954, true }, - { 125984, true }, - { 125995, true }, - { 126009, true }, - { 126023, true }, - { 126035, true }, - { 126049, true }, - { 126069, true }, - { 126084, true }, + { 125713, false }, + { 125732, true }, + { 125745, true }, + { 125758, true }, + { 125782, true }, + { 125793, true }, + { 125812, true }, + { 125840, true }, + { 125861, true }, + { 125874, true }, + { 125894, true }, + { 125914, true }, + { 125928, true }, + { 125941, true }, + { 125962, false }, + { 125973, true }, + { 125992, true }, + { 126003, true }, + { 126015, true }, + { 126026, true }, + { 126056, true }, + { 126067, true }, + { 126081, true }, { 126095, true }, - { 126119, true }, - { 126140, true }, - { 126153, true }, - { 126170, true }, - { 126186, true }, - { 126204, true }, - { 126226, true }, - { 126243, true }, - { 126257, true }, - { 126271, true }, - { 126287, true }, - { 126307, true }, - { 126322, true }, - { 126339, true }, - { 126366, true }, - { 126385, true }, - { 126400, true }, + { 126107, true }, + { 126121, true }, + { 126141, true }, + { 126156, true }, + { 126167, true }, + { 126191, true }, + { 126212, true }, + { 126225, true }, + { 126242, true }, + { 126258, true }, + { 126276, true }, + { 126298, true }, + { 126315, true }, + { 126329, true }, + { 126343, true }, + { 126359, true }, + { 126379, true }, + { 126394, true }, { 126411, true }, - { 126425, true }, - { 126442, true }, - { 126458, true }, - { 126475, true }, - { 126490, true }, - { 126501, true }, - { 126517, true }, - { 126533, true }, - { 126550, true }, - { 126570, true }, - { 126585, true }, - { 126604, true }, - { 126620, true }, - { 126630, true }, - { 126643, true }, - { 126662, true }, - { 126678, true }, - { 126698, true }, - { 126710, true }, - { 126727, false }, - { 126742, true }, - { 126754, true }, - { 126767, true }, - { 126777, true }, - { 126794, true }, - { 126806, false }, - { 126816, true }, - { 126829, true }, - { 126846, true }, - { 126869, true }, - { 126886, true }, + { 126438, true }, + { 126457, true }, + { 126472, true }, + { 126483, true }, + { 126497, true }, + { 126514, true }, + { 126530, true }, + { 126547, true }, + { 126562, true }, + { 126573, true }, + { 126589, true }, + { 126605, true }, + { 126622, true }, + { 126642, true }, + { 126657, true }, + { 126676, true }, + { 126692, true }, + { 126702, true }, + { 126715, true }, + { 126734, true }, + { 126750, true }, + { 126770, true }, + { 126782, true }, + { 126799, false }, + { 126814, true }, + { 126826, true }, + { 126839, true }, + { 126849, true }, + { 126866, true }, + { 126878, false }, + { 126888, true }, { 126901, true }, - { 126920, true }, - { 126945, true }, - { 126978, true }, - { 126988, true }, - { 127002, true }, - { 127018, true }, - { 127037, false }, + { 126918, true }, + { 126941, true }, + { 126958, true }, + { 126973, true }, + { 126992, true }, + { 127017, true }, + { 127050, true }, { 127060, true }, { 127074, true }, - { 127088, true }, - { 127100, true }, - { 127115, true }, - { 127135, true }, - { 127147, true }, - { 127167, true }, - { 127185, true }, - { 127196, true }, - { 127211, true }, - { 127224, true }, - { 127237, true }, - { 127250, true }, - { 127261, true }, - { 127276, true }, - { 127287, true }, - { 127303, true }, - { 127317, true }, - { 127329, true }, - { 127343, true }, - { 127351, true }, - { 127370, true }, - { 127384, true }, - { 127406, true }, + { 127090, true }, + { 127109, false }, + { 127132, true }, + { 127146, true }, + { 127160, true }, + { 127172, true }, + { 127187, true }, + { 127207, true }, + { 127219, true }, + { 127239, true }, + { 127257, true }, + { 127268, true }, + { 127283, true }, + { 127296, true }, + { 127309, true }, + { 127322, true }, + { 127333, true }, + { 127348, true }, + { 127359, true }, + { 127375, true }, + { 127389, true }, + { 127401, true }, + { 127415, true }, { 127423, true }, - { 127432, true }, - { 127445, true }, - { 127455, false }, - { 127467, true }, + { 127442, true }, + { 127456, true }, { 127478, true }, - { 127488, true }, - { 127511, true }, - { 127525, true }, - { 127540, true }, - { 127564, true }, + { 127495, true }, + { 127504, true }, + { 127517, true }, + { 127527, false }, + { 127539, true }, + { 127550, true }, + { 127560, true }, { 127583, true }, { 127597, true }, - { 127611, true }, - { 127632, true }, - { 127651, true }, - { 127661, true }, - { 127677, true }, - { 127694, true }, - { 127707, true }, - { 127724, true }, - { 127740, true }, - { 127759, true }, - { 127772, true }, - { 127784, true }, - { 127801, true }, - { 127809, true }, - { 127825, true }, - { 127841, true }, - { 127861, true }, - { 127879, true }, - { 127893, true }, - { 127910, true }, - { 127929, true }, - { 127946, true }, - { 127960, true }, - { 127981, true }, - { 128000, true }, - { 128018, true }, - { 128031, true }, - { 128041, true }, - { 128059, true }, - { 128079, true }, - { 128099, true }, - { 128108, true }, - { 128122, true }, - { 128139, true }, - { 128162, true }, - { 128171, true }, - { 128187, true }, - { 128205, true }, + { 127612, true }, + { 127636, true }, + { 127655, true }, + { 127669, true }, + { 127683, true }, + { 127704, true }, + { 127723, true }, + { 127733, true }, + { 127749, true }, + { 127766, true }, + { 127779, true }, + { 127796, true }, + { 127812, true }, + { 127831, true }, + { 127844, true }, + { 127856, true }, + { 127864, true }, + { 127880, true }, + { 127896, true }, + { 127916, true }, + { 127934, true }, + { 127948, true }, + { 127965, true }, + { 127984, true }, + { 128001, true }, + { 128015, true }, + { 128036, true }, + { 128055, true }, + { 128073, true }, + { 128086, true }, + { 128096, true }, + { 128114, true }, + { 128134, true }, + { 128154, true }, + { 128163, true }, + { 128177, true }, + { 128194, true }, { 128217, true }, { 128226, true }, - { 128239, true }, - { 128252, true }, - { 128268, true }, - { 128276, false }, - { 128288, true }, - { 128298, true }, - { 128317, true }, - { 128332, true }, - { 128347, true }, - { 128366, true }, - { 128388, true }, - { 128407, true }, + { 128242, true }, + { 128260, true }, + { 128272, true }, + { 128281, true }, + { 128294, true }, + { 128307, true }, + { 128323, true }, + { 128331, false }, + { 128343, true }, + { 128353, true }, + { 128372, true }, + { 128387, true }, + { 128402, true }, { 128421, true }, - { 128433, true }, - { 128447, true }, - { 128460, false }, - { 128482, true }, - { 128499, true }, - { 128517, true }, - { 128530, true }, - { 128544, true }, - { 128555, true }, - { 128569, false }, - { 128589, true }, - { 128600, false }, - { 128609, true }, + { 128443, true }, + { 128462, true }, + { 128476, true }, + { 128488, true }, + { 128502, true }, + { 128515, false }, + { 128537, true }, + { 128554, true }, + { 128572, true }, + { 128585, true }, + { 128599, true }, + { 128610, true }, { 128624, false }, - { 128642, true }, - { 128655, true }, - { 128665, true }, - { 128676, false }, - { 128691, true }, - { 128700, true }, - { 128712, true }, - { 128721, true }, - { 128734, true }, - { 128747, true }, - { 128760, true }, - { 128777, false }, - { 128794, true }, - { 128801, true }, - { 128809, true }, - { 128818, true }, - { 128830, true }, - { 128853, true }, - { 128867, true }, - { 128881, true }, - { 128898, true }, - { 128912, false }, - { 128928, false }, - { 128942, true }, - { 128949, true }, - { 128959, true }, - { 128970, true }, - { 128985, true }, + { 128644, true }, + { 128655, false }, + { 128664, true }, + { 128679, false }, + { 128697, true }, + { 128710, true }, + { 128720, true }, + { 128731, false }, + { 128746, true }, + { 128755, true }, + { 128767, true }, + { 128776, true }, + { 128789, true }, + { 128802, true }, + { 128815, true }, + { 128832, false }, + { 128849, true }, + { 128856, true }, + { 128864, true }, + { 128873, true }, + { 128885, true }, + { 128908, true }, + { 128922, true }, + { 128936, true }, + { 128953, true }, + { 128967, false }, + { 128983, false }, { 128997, true }, - { 129005, true }, - { 129017, true }, - { 129032, false }, - { 129042, true }, - { 129054, true }, - { 129066, true }, - { 129081, true }, - { 129110, true }, - { 129124, true }, - { 129132, true }, - { 129140, true }, - { 129149, true }, - { 129162, true }, - { 129170, true }, - { 129181, true }, - { 129192, true }, - { 129199, true }, - { 129208, true }, - { 129218, true }, - { 129238, true }, - { 129250, true }, - { 129262, true }, - { 129271, false }, - { 129280, true }, - { 129300, false }, - { 129321, true }, - { 129332, true }, - { 129345, true }, - { 129354, true }, - { 129368, true }, - { 129385, true }, - { 129401, true }, - { 129419, true }, - { 129433, true }, - { 129450, true }, - { 129462, true }, - { 129475, true }, - { 129487, true }, - { 129501, true }, - { 129519, true }, - { 129533, true }, - { 129549, false }, - { 129567, true }, - { 129584, true }, - { 129606, true }, - { 129629, true }, - { 129640, true }, - { 129651, true }, - { 129662, true }, - { 129673, true }, - { 129685, true }, - { 129699, true }, - { 129710, true }, - { 129722, true }, - { 129738, true }, - { 129767, false }, - { 129786, true }, - { 129802, true }, - { 129828, true }, - { 129842, true }, - { 129859, true }, - { 129878, true }, - { 129895, true }, - { 129911, true }, - { 129922, true }, - { 129930, true }, - { 129942, true }, - { 129959, true }, - { 129972, true }, - { 129987, true }, - { 130000, true }, + { 129004, true }, + { 129014, true }, + { 129025, true }, + { 129040, true }, + { 129052, true }, + { 129060, true }, + { 129072, true }, + { 129087, false }, + { 129097, true }, + { 129109, true }, + { 129121, true }, + { 129136, true }, + { 129165, true }, + { 129179, true }, + { 129187, true }, + { 129195, true }, + { 129204, true }, + { 129217, true }, + { 129225, true }, + { 129236, true }, + { 129247, true }, + { 129254, true }, + { 129263, true }, + { 129273, true }, + { 129293, true }, + { 129305, true }, + { 129317, true }, + { 129326, false }, + { 129335, true }, + { 129355, false }, + { 129376, true }, + { 129387, true }, + { 129400, true }, + { 129409, true }, + { 129423, true }, + { 129440, true }, + { 129456, true }, + { 129474, true }, + { 129488, true }, + { 129505, true }, + { 129517, true }, + { 129530, true }, + { 129542, true }, + { 129556, true }, + { 129574, true }, + { 129588, true }, + { 129604, false }, + { 129622, true }, + { 129639, true }, + { 129661, true }, + { 129684, true }, + { 129695, true }, + { 129706, true }, + { 129717, true }, + { 129728, true }, + { 129740, true }, + { 129754, true }, + { 129765, true }, + { 129777, true }, + { 129793, true }, + { 129822, false }, + { 129841, true }, + { 129857, true }, + { 129883, true }, + { 129897, true }, + { 129914, true }, + { 129933, true }, + { 129950, true }, + { 129966, true }, + { 129977, true }, + { 129985, true }, + { 129997, true }, { 130014, true }, - { 130026, true }, - { 130038, true }, - { 130052, true }, + { 130027, true }, + { 130042, true }, + { 130055, true }, { 130069, true }, - { 130082, true }, - { 130097, true }, - { 130110, true }, - { 130122, true }, - { 130136, true }, - { 130147, true }, - { 130170, true }, - { 130188, true }, - { 130209, true }, - { 130228, true }, - { 130246, true }, - { 130263, true }, - { 130280, true }, - { 130291, true }, - { 130313, true }, + { 130081, true }, + { 130093, true }, + { 130107, true }, + { 130124, true }, + { 130137, true }, + { 130152, true }, + { 130165, true }, + { 130177, true }, + { 130191, true }, + { 130202, true }, + { 130225, true }, + { 130243, true }, + { 130264, true }, + { 130283, true }, + { 130301, true }, + { 130318, true }, { 130335, true }, - { 130347, true }, - { 130355, true }, - { 130376, true }, - { 130397, true }, - { 130418, true }, - { 130436, true }, + { 130346, true }, + { 130368, true }, + { 130390, true }, + { 130402, true }, + { 130410, true }, + { 130431, true }, { 130452, true }, - { 130464, true }, - { 130476, true }, - { 130494, true }, - { 130504, true }, - { 130518, true }, - { 130534, true }, - { 130560, false }, + { 130473, true }, + { 130491, true }, + { 130507, true }, + { 130519, true }, + { 130531, true }, + { 130549, true }, + { 130559, true }, + { 130573, true }, { 130589, true }, - { 130600, true }, - { 130615, true }, - { 130631, true }, - { 130646, true }, - { 130657, true }, - { 130671, true }, - { 130698, true }, - { 130716, true }, - { 130733, false }, - { 130744, true }, - { 130754, true }, - { 130769, true }, - { 130780, true }, - { 130798, true }, - { 130816, true }, - { 130829, true }, - { 130840, true }, - { 130862, true }, - { 130881, true }, + { 130615, false }, + { 130644, true }, + { 130655, true }, + { 130670, true }, + { 130686, true }, + { 130701, true }, + { 130712, true }, + { 130726, true }, + { 130753, true }, + { 130771, true }, + { 130788, false }, + { 130799, true }, + { 130809, true }, + { 130824, true }, + { 130835, true }, + { 130853, true }, + { 130871, true }, + { 130884, true }, { 130895, true }, - { 130907, false }, - { 130927, true }, - { 130937, true }, - { 130951, true }, - { 130969, true }, - { 130983, true }, - { 130995, true }, - { 131005, true }, - { 131017, true }, - { 131025, true }, - { 131042, true }, - { 131056, true }, - { 131077, true }, - { 131089, true }, - { 131107, true }, - { 131123, true }, - { 131135, true }, - { 131147, true }, - { 131159, true }, - { 131171, true }, - { 131183, true }, - { 131195, true }, - { 131207, true }, - { 131219, true }, - { 131235, false }, - { 131255, true }, - { 131264, true }, - { 131278, true }, - { 131294, true }, - { 131307, true }, - { 131320, true }, - { 131343, true }, - { 131356, true }, - { 131364, true }, - { 131379, false }, - { 131395, true }, - { 131405, true }, - { 131423, true }, - { 131437, true }, - { 131446, true }, - { 131459, true }, - { 131475, true }, - { 131490, true }, - { 131506, true }, - { 131518, true }, - { 131529, true }, - { 131544, true }, - { 131559, true }, - { 131571, true }, - { 131589, true }, - { 131608, true }, - { 131627, true }, - { 131649, true }, - { 131669, true }, - { 131688, true }, - { 131705, true }, - { 131723, true }, - { 131741, true }, - { 131759, true }, - { 131781, true }, - { 131795, true }, - { 131811, true }, - { 131828, true }, - { 131849, true }, - { 131864, true }, - { 131886, true }, - { 131903, true }, - { 131914, true }, - { 131927, true }, - { 131940, true }, - { 131954, true }, - { 131966, true }, - { 131976, true }, - { 131987, true }, - { 132002, true }, - { 132013, true }, - { 132025, true }, - { 132034, true }, - { 132044, true }, - { 132053, true }, - { 132064, true }, - { 132089, true }, - { 132101, true }, - { 132119, true }, - { 132135, true }, - { 132146, true }, - { 132162, true }, - { 132185, true }, - { 132206, true }, - { 132224, true }, - { 132243, true }, - { 132252, false }, - { 132266, true }, - { 132277, true }, - { 132290, true }, - { 132304, true }, - { 132319, true }, - { 132330, true }, - { 132343, true }, - { 132352, true }, - { 132366, true }, - { 132379, true }, - { 132393, true }, - { 132404, true }, - { 132417, true }, - { 132427, true }, - { 132441, true }, - { 132450, true }, - { 132465, true }, - { 132478, true }, - { 132491, true }, - { 132510, true }, - { 132523, true }, - { 132541, true }, - { 132557, true }, - { 132569, true }, - { 132582, true }, - { 132594, true }, - { 132609, true }, - { 132619, true }, - { 132629, true }, - { 132640, true }, - { 132654, true }, - { 132665, true }, - { 132692, true }, - { 132706, true }, - { 132714, true }, + { 130917, true }, + { 130936, true }, + { 130950, true }, + { 130962, false }, + { 130982, true }, + { 130992, true }, + { 131006, true }, + { 131024, true }, + { 131038, true }, + { 131050, true }, + { 131060, true }, + { 131072, true }, + { 131080, true }, + { 131097, true }, + { 131111, true }, + { 131132, true }, + { 131144, true }, + { 131162, true }, + { 131178, true }, + { 131190, true }, + { 131202, true }, + { 131214, true }, + { 131226, true }, + { 131238, true }, + { 131250, true }, + { 131262, true }, + { 131274, true }, + { 131290, false }, + { 131310, true }, + { 131319, true }, + { 131333, true }, + { 131349, true }, + { 131362, true }, + { 131375, true }, + { 131398, true }, + { 131411, true }, + { 131419, true }, + { 131434, false }, + { 131450, true }, + { 131460, true }, + { 131478, true }, + { 131492, true }, + { 131501, true }, + { 131514, true }, + { 131530, true }, + { 131545, true }, + { 131561, true }, + { 131573, true }, + { 131584, true }, + { 131599, true }, + { 131614, true }, + { 131626, true }, + { 131644, true }, + { 131663, true }, + { 131682, true }, + { 131704, true }, + { 131724, true }, + { 131743, true }, + { 131760, true }, + { 131778, true }, + { 131796, true }, + { 131814, true }, + { 131836, true }, + { 131850, true }, + { 131866, true }, + { 131883, true }, + { 131904, true }, + { 131919, true }, + { 131941, true }, + { 131958, true }, + { 131969, true }, + { 131982, true }, + { 131995, true }, + { 132007, true }, + { 132017, true }, + { 132028, true }, + { 132043, true }, + { 132054, true }, + { 132066, true }, + { 132075, true }, + { 132085, true }, + { 132094, true }, + { 132105, true }, + { 132130, true }, + { 132142, true }, + { 132160, true }, + { 132176, true }, + { 132187, true }, + { 132203, true }, + { 132226, true }, + { 132247, true }, + { 132265, true }, + { 132284, true }, + { 132293, false }, + { 132307, true }, + { 132318, true }, + { 132331, true }, + { 132345, true }, + { 132360, true }, + { 132373, true }, + { 132382, true }, + { 132396, true }, + { 132409, true }, + { 132423, true }, + { 132434, true }, + { 132447, true }, + { 132457, true }, + { 132471, true }, + { 132480, true }, + { 132495, true }, + { 132508, true }, + { 132521, true }, + { 132540, true }, + { 132553, true }, + { 132571, true }, + { 132587, true }, + { 132599, true }, + { 132612, true }, + { 132624, true }, + { 132639, true }, + { 132649, true }, + { 132659, true }, + { 132670, true }, + { 132684, true }, + { 132695, true }, + { 132722, true }, { 132736, true }, - { 132750, true }, - { 132764, true }, - { 132775, true }, + { 132744, true }, + { 132766, true }, + { 132780, true }, { 132794, true }, - { 132813, true }, - { 132832, true }, - { 132851, true }, - { 132871, true }, - { 132891, true }, - { 132911, true }, - { 132929, true }, - { 132948, true }, - { 132967, true }, - { 132986, true }, - { 133005, true }, - { 133019, true }, - { 133032, true }, - { 133044, true }, - { 133057, false }, - { 133079, true }, - { 133094, true }, - { 133106, true }, - { 133114, true }, - { 133139, true }, - { 133155, true }, - { 133164, true }, - { 133176, true }, - { 133193, true }, + { 132805, true }, + { 132824, true }, + { 132843, true }, + { 132862, true }, + { 132881, true }, + { 132901, true }, + { 132921, true }, + { 132941, true }, + { 132959, true }, + { 132978, true }, + { 132997, true }, + { 133016, true }, + { 133035, true }, + { 133049, true }, + { 133062, true }, + { 133074, true }, + { 133087, false }, + { 133109, true }, + { 133124, true }, + { 133136, true }, + { 133144, true }, + { 133169, true }, + { 133185, true }, + { 133194, true }, { 133206, true }, - { 133221, true }, - { 133237, true }, - { 133255, true }, - { 133268, true }, - { 133280, true }, - { 133290, true }, - { 133301, true }, - { 133315, true }, - { 133330, true }, - { 133343, true }, - { 133354, true }, - { 133368, true }, - { 133383, true }, - { 133392, true }, - { 133405, true }, - { 133421, true }, - { 133440, true }, - { 133454, true }, - { 133469, true }, - { 133480, true }, - { 133490, true }, - { 133502, true }, - { 133517, true }, - { 133534, true }, - { 133565, true }, - { 133580, true }, - { 133598, true }, - { 133619, true }, - { 133633, true }, - { 133651, true }, - { 133661, true }, - { 133673, true }, - { 133683, true }, - { 133692, true }, - { 133705, true }, - { 133720, true }, - { 133733, true }, - { 133745, true }, - { 133753, true }, - { 133771, true }, - { 133786, true }, - { 133803, true }, - { 133818, true }, - { 133831, true }, - { 133847, true }, - { 133867, true }, - { 133882, true }, - { 133896, true }, - { 133909, true }, - { 133919, true }, - { 133933, true }, - { 133943, true }, + { 133223, true }, + { 133236, true }, + { 133251, true }, + { 133267, true }, + { 133285, true }, + { 133298, true }, + { 133310, true }, + { 133320, true }, + { 133331, true }, + { 133345, true }, + { 133360, true }, + { 133373, true }, + { 133384, true }, + { 133398, true }, + { 133413, true }, + { 133422, true }, + { 133435, true }, + { 133451, true }, + { 133470, true }, + { 133484, true }, + { 133499, true }, + { 133510, true }, + { 133520, true }, + { 133532, true }, + { 133547, true }, + { 133564, true }, + { 133595, true }, + { 133610, true }, + { 133628, true }, + { 133649, true }, + { 133663, true }, + { 133681, true }, + { 133691, true }, + { 133703, true }, + { 133713, true }, + { 133722, true }, + { 133735, true }, + { 133750, true }, + { 133763, true }, + { 133775, true }, + { 133783, true }, + { 133801, true }, + { 133816, true }, + { 133833, true }, + { 133848, true }, + { 133861, true }, + { 133877, true }, + { 133897, true }, + { 133912, true }, + { 133926, true }, + { 133939, true }, + { 133949, true }, { 133963, true }, - { 133972, true }, - { 133982, true }, + { 133973, true }, { 133993, true }, - { 134006, true }, - { 134025, true }, - { 134035, true }, - { 134046, true }, - { 134059, true }, - { 134066, true }, - { 134075, true }, - { 134091, true }, - { 134102, true }, - { 134109, true }, + { 134002, true }, + { 134012, true }, + { 134023, true }, + { 134036, true }, + { 134055, true }, + { 134065, true }, + { 134076, true }, + { 134089, true }, + { 134096, true }, + { 134105, true }, + { 134121, true }, { 134132, true }, - { 134141, true }, - { 134149, true }, - { 134159, true }, - { 134180, true }, - { 134192, true }, - { 134201, true }, + { 134139, true }, + { 134162, true }, + { 134171, true }, + { 134191, true }, + { 134199, true }, { 134209, true }, - { 134218, true }, - { 134229, true }, - { 134239, true }, - { 134250, true }, - { 134257, true }, - { 134266, true }, - { 134274, true }, - { 134285, true }, - { 134297, true }, - { 134305, true }, - { 134313, true }, - { 134323, true }, - { 134339, true }, - { 134351, true }, - { 134381, true }, + { 134230, true }, + { 134242, true }, + { 134251, true }, + { 134259, true }, + { 134268, true }, + { 134279, true }, + { 134289, true }, + { 134300, true }, + { 134307, true }, + { 134316, true }, + { 134324, true }, + { 134335, true }, + { 134347, true }, + { 134355, true }, + { 134363, true }, + { 134373, true }, + { 134389, true }, { 134401, true }, - { 134415, false }, - { 134433, false }, - { 134449, true }, - { 134464, true }, - { 134480, true }, - { 134495, true }, - { 134516, true }, + { 134431, true }, + { 134451, true }, + { 134465, false }, + { 134483, false }, + { 134499, true }, + { 134514, true }, { 134530, true }, - { 134549, true }, - { 134560, true }, - { 134570, true }, - { 134588, true }, + { 134545, true }, + { 134566, true }, + { 134580, true }, { 134599, true }, { 134610, true }, - { 134624, true }, + { 134620, true }, { 134638, true }, - { 134671, true }, - { 134685, true }, - { 134705, true }, - { 134718, true }, - { 134728, false }, - { 134744, true }, - { 134758, true }, - { 134777, true }, - { 134803, true }, - { 134826, true }, + { 134649, true }, + { 134660, true }, + { 134674, true }, + { 134688, true }, + { 134721, true }, + { 134735, true }, + { 134755, true }, + { 134768, false }, + { 134784, true }, + { 134798, true }, + { 134817, true }, { 134843, true }, - { 134856, true }, - { 134872, true }, - { 134880, true }, - { 134893, true }, - { 134900, true }, + { 134866, true }, + { 134883, true }, + { 134896, true }, { 134912, true }, - { 134924, true }, - { 134939, true }, - { 134949, true }, - { 134961, true }, - { 134972, true }, - { 134992, true }, - { 135000, false }, - { 135018, true }, - { 135031, true }, - { 135042, true }, - { 135052, true }, - { 135066, true }, - { 135078, false }, - { 135094, true }, - { 135105, true }, - { 135114, true }, - { 135127, true }, - { 135135, true }, + { 134920, true }, + { 134933, true }, + { 134940, true }, + { 134952, true }, + { 134964, true }, + { 134979, true }, + { 134989, true }, + { 135001, true }, + { 135012, true }, + { 135032, true }, + { 135040, false }, + { 135058, true }, + { 135071, true }, + { 135082, true }, + { 135092, true }, + { 135106, true }, + { 135118, false }, + { 135134, true }, { 135145, true }, - { 135162, true }, - { 135173, true }, - { 135189, true }, - { 135200, true }, - { 135212, true }, - { 135222, false }, - { 135237, true }, + { 135154, true }, + { 135167, true }, + { 135175, true }, + { 135185, true }, + { 135202, true }, + { 135213, true }, + { 135229, true }, + { 135240, true }, { 135252, true }, - { 135267, false }, - { 135275, true }, - { 135291, false }, - { 135301, true }, - { 135313, true }, - { 135328, true }, - { 135347, true }, - { 135367, true }, - { 135378, true }, - { 135392, true }, - { 135408, true }, - { 135430, true }, - { 135443, true }, - { 135462, true }, - { 135475, true }, - { 135484, true }, - { 135499, true }, - { 135512, true }, + { 135262, false }, + { 135277, true }, + { 135292, true }, + { 135307, false }, + { 135315, true }, + { 135331, false }, + { 135341, true }, + { 135353, true }, + { 135368, true }, + { 135387, true }, + { 135407, true }, + { 135418, true }, + { 135432, true }, + { 135448, true }, + { 135470, true }, + { 135483, true }, + { 135502, true }, + { 135515, true }, { 135524, true }, - { 135541, true }, - { 135565, true }, - { 135578, true }, - { 135590, true }, - { 135607, true }, - { 135619, true }, - { 135637, true }, - { 135650, true }, - { 135665, true }, - { 135672, true }, - { 135684, true }, - { 135694, true }, - { 135708, true }, - { 135721, true }, - { 135735, true }, - { 135752, true }, - { 135767, true }, - { 135781, true }, - { 135793, true }, - { 135806, true }, - { 135826, true }, - { 135841, true }, - { 135856, true }, - { 135871, true }, - { 135890, true }, - { 135909, true }, - { 135928, true }, - { 135943, true }, - { 135954, true }, - { 135964, true }, - { 135977, false }, - { 135990, true }, + { 135539, true }, + { 135552, true }, + { 135564, true }, + { 135581, true }, + { 135605, true }, + { 135618, true }, + { 135630, true }, + { 135647, true }, + { 135659, true }, + { 135677, true }, + { 135690, true }, + { 135705, true }, + { 135712, true }, + { 135724, true }, + { 135734, true }, + { 135748, true }, + { 135761, true }, + { 135775, true }, + { 135792, true }, + { 135807, true }, + { 135821, true }, + { 135833, true }, + { 135846, true }, + { 135866, true }, + { 135881, true }, + { 135896, true }, + { 135911, true }, + { 135930, true }, + { 135949, true }, + { 135968, true }, + { 135983, true }, + { 135994, true }, { 136004, true }, - { 136015, true }, + { 136017, false }, { 136030, true }, - { 136046, true }, - { 136059, true }, - { 136072, true }, - { 136092, true }, - { 136101, true }, - { 136117, true }, - { 136130, true }, - { 136145, true }, - { 136159, true }, - { 136169, true }, - { 136182, true }, - { 136200, true }, - { 136208, false }, - { 136221, true }, - { 136239, true }, - { 136262, true }, - { 136280, true }, - { 136311, true }, - { 136341, true }, - { 136363, true }, - { 136379, true }, - { 136390, false }, + { 136044, true }, + { 136055, true }, + { 136070, true }, + { 136086, true }, + { 136099, true }, + { 136112, true }, + { 136132, true }, + { 136141, true }, + { 136157, true }, + { 136170, true }, + { 136185, true }, + { 136199, true }, + { 136209, true }, + { 136222, true }, + { 136240, true }, + { 136248, false }, + { 136261, true }, + { 136279, true }, + { 136302, true }, + { 136320, true }, + { 136351, true }, + { 136381, true }, { 136403, true }, - { 136415, true }, - { 136430, true }, - { 136447, false }, - { 136466, true }, - { 136477, true }, - { 136487, true }, - { 136497, true }, - { 136512, true }, - { 136526, true }, - { 136536, true }, - { 136548, true }, - { 136564, true }, - { 136575, true }, - { 136592, true }, - { 136605, true }, - { 136625, true }, - { 136635, true }, - { 136646, true }, - { 136656, false }, - { 136671, true }, + { 136419, true }, + { 136430, false }, + { 136443, true }, + { 136455, true }, + { 136470, true }, + { 136487, false }, + { 136506, true }, + { 136517, true }, + { 136527, true }, + { 136537, true }, + { 136552, true }, + { 136566, true }, + { 136576, true }, + { 136588, true }, + { 136604, true }, + { 136615, true }, + { 136632, true }, + { 136645, true }, + { 136665, true }, + { 136675, true }, { 136686, true }, - { 136703, true }, - { 136718, true }, - { 136729, false }, - { 136742, true }, - { 136755, true }, - { 136765, true }, + { 136696, false }, + { 136711, true }, + { 136726, true }, + { 136743, true }, + { 136758, true }, + { 136769, false }, { 136782, true }, - { 136794, true }, - { 136808, true }, - { 136819, true }, - { 136836, true }, - { 136849, true }, - { 136858, true }, - { 136869, true }, - { 136879, true }, - { 136893, true }, - { 136904, true }, - { 136913, true }, - { 136927, true }, - { 136937, true }, - { 136947, true }, - { 136963, true }, - { 136974, true }, - { 136986, true }, - { 136996, true }, - { 137005, true }, - { 137016, false }, - { 137024, true }, - { 137042, true }, - { 137049, true }, - { 137060, false }, - { 137080, true }, - { 137087, false }, - { 137103, true }, - { 137119, true }, - { 137134, true }, - { 137146, true }, - { 137166, true }, - { 137180, true }, - { 137196, true }, + { 136795, true }, + { 136805, true }, + { 136822, true }, + { 136834, true }, + { 136848, true }, + { 136859, true }, + { 136876, true }, + { 136889, true }, + { 136898, true }, + { 136909, true }, + { 136919, true }, + { 136933, true }, + { 136944, true }, + { 136953, true }, + { 136967, true }, + { 136977, true }, + { 136987, true }, + { 137003, true }, + { 137014, true }, + { 137026, true }, + { 137036, true }, + { 137045, true }, + { 137056, false }, + { 137064, true }, + { 137082, true }, + { 137089, true }, + { 137100, false }, + { 137120, true }, + { 137127, false }, + { 137143, true }, + { 137159, true }, + { 137174, true }, + { 137186, true }, { 137206, true }, - { 137219, true }, - { 137237, true }, - { 137251, true }, - { 137268, true }, - { 137287, true }, - { 137303, true }, - { 137322, true }, - { 137345, true }, - { 137357, true }, - { 137379, true }, - { 137393, true }, - { 137404, true }, - { 137414, true }, - { 137428, true }, - { 137438, true }, - { 137449, true }, - { 137464, true }, - { 137473, true }, - { 137482, true }, - { 137499, true }, - { 137515, true }, - { 137537, true }, - { 137553, true }, - { 137567, true }, - { 137587, true }, - { 137604, true }, - { 137621, true }, - { 137635, true }, - { 137654, true }, - { 137670, false }, - { 137684, true }, - { 137697, true }, - { 137714, true }, - { 137729, true }, - { 137748, true }, - { 137759, true }, - { 137770, true }, - { 137784, true }, - { 137798, true }, - { 137813, true }, - { 137834, true }, - { 137850, true }, - { 137868, true }, - { 137886, true }, - { 137899, true }, - { 137927, true }, + { 137220, true }, + { 137236, true }, + { 137246, true }, + { 137259, true }, + { 137277, true }, + { 137291, true }, + { 137308, true }, + { 137327, true }, + { 137343, true }, + { 137362, true }, + { 137385, true }, + { 137397, true }, + { 137419, true }, + { 137433, true }, + { 137444, true }, + { 137454, true }, + { 137468, true }, + { 137478, true }, + { 137489, true }, + { 137504, true }, + { 137513, true }, + { 137522, true }, + { 137539, true }, + { 137555, true }, + { 137577, true }, + { 137593, true }, + { 137607, true }, + { 137627, true }, + { 137644, true }, + { 137661, true }, + { 137675, true }, + { 137694, true }, + { 137710, false }, + { 137724, true }, + { 137737, true }, + { 137754, true }, + { 137769, true }, + { 137788, true }, + { 137799, true }, + { 137810, true }, + { 137824, true }, + { 137838, true }, + { 137853, true }, + { 137874, true }, + { 137890, true }, + { 137908, true }, + { 137926, true }, { 137939, true }, - { 137955, true }, - { 137966, true }, - { 137974, true }, - { 137988, true }, - { 138002, false }, - { 138011, true }, - { 138018, false }, - { 138028, false }, - { 138048, true }, - { 138059, true }, - { 138069, true }, - { 138080, true }, - { 138090, false }, - { 138109, false }, - { 138122, false }, - { 138134, false }, - { 138155, true }, - { 138177, true }, - { 138190, true }, - { 138206, true }, - { 138224, true }, - { 138233, true }, - { 138245, true }, - { 138261, true }, - { 138272, true }, - { 138296, true }, - { 138307, false }, - { 138323, true }, - { 138341, true }, - { 138356, true }, - { 138368, true }, - { 138383, true }, - { 138400, true }, - { 138414, true }, - { 138429, true }, - { 138448, true }, - { 138467, true }, - { 138478, true }, - { 138492, true }, - { 138510, true }, - { 138520, false }, - { 138549, true }, - { 138563, true }, - { 138587, true }, - { 138606, true }, - { 138619, true }, - { 138634, true }, - { 138648, true }, - { 138663, true }, - { 138681, true }, - { 138691, false }, - { 138706, true }, - { 138714, true }, - { 138727, false }, - { 138741, true }, - { 138752, true }, - { 138760, true }, - { 138768, true }, - { 138782, true }, - { 138804, true }, - { 138816, true }, - { 138828, true }, - { 138840, true }, - { 138855, true }, - { 138875, true }, - { 138898, true }, - { 138917, true }, - { 138936, true }, - { 138955, true }, - { 138974, true }, - { 138993, true }, - { 139012, true }, - { 139031, true }, - { 139048, true }, - { 139066, true }, - { 139083, true }, - { 139098, true }, - { 139116, true }, - { 139131, true }, - { 139144, true }, - { 139168, true }, - { 139185, true }, - { 139203, true }, - { 139219, true }, - { 139237, true }, - { 139254, true }, - { 139270, true }, - { 139283, true }, - { 139296, true }, - { 139313, true }, - { 139334, true }, - { 139349, true }, - { 139366, true }, - { 139378, true }, - { 139386, true }, - { 139399, true }, - { 139413, true }, - { 139429, true }, - { 139445, true }, - { 139458, true }, - { 139471, true }, - { 139481, true }, - { 139494, true }, - { 139509, true }, - { 139519, true }, - { 139530, true }, - { 139545, true }, - { 139560, false }, - { 139570, false }, - { 139580, false }, - { 139590, true }, - { 139602, true }, - { 139610, false }, - { 139621, true }, - { 139629, true }, - { 139638, true }, - { 139651, true }, - { 139663, true }, - { 139683, true }, - { 139694, true }, - { 139715, true }, - { 139731, true }, - { 139748, true }, - { 139767, true }, - { 139776, true }, - { 139790, true }, - { 139800, true }, - { 139811, true }, - { 139820, true }, - { 139829, true }, - { 139842, true }, - { 139871, true }, - { 139890, true }, - { 139907, true }, - { 139930, true }, - { 139938, true }, - { 139956, true }, - { 139967, true }, - { 139980, true }, - { 139991, true }, - { 140004, true }, - { 140017, true }, + { 137967, true }, + { 137979, true }, + { 137995, true }, + { 138006, true }, + { 138014, true }, + { 138028, true }, + { 138042, false }, + { 138051, true }, + { 138058, false }, + { 138068, false }, + { 138088, true }, + { 138099, true }, + { 138109, true }, + { 138120, true }, + { 138130, false }, + { 138149, false }, + { 138162, false }, + { 138174, false }, + { 138195, true }, + { 138217, true }, + { 138230, true }, + { 138246, true }, + { 138264, true }, + { 138273, true }, + { 138285, true }, + { 138301, true }, + { 138312, true }, + { 138336, true }, + { 138347, false }, + { 138363, true }, + { 138381, true }, + { 138396, true }, + { 138408, true }, + { 138423, true }, + { 138440, true }, + { 138454, true }, + { 138469, true }, + { 138488, true }, + { 138507, true }, + { 138518, true }, + { 138532, true }, + { 138550, true }, + { 138560, false }, + { 138589, true }, + { 138603, true }, + { 138627, true }, + { 138646, true }, + { 138659, true }, + { 138674, true }, + { 138688, true }, + { 138703, true }, + { 138721, true }, + { 138731, false }, + { 138746, true }, + { 138754, true }, + { 138767, false }, + { 138781, true }, + { 138792, true }, + { 138800, true }, + { 138808, true }, + { 138822, true }, + { 138844, true }, + { 138856, true }, + { 138868, true }, + { 138880, true }, + { 138895, true }, + { 138915, true }, + { 138938, true }, + { 138957, true }, + { 138976, true }, + { 138995, true }, + { 139014, true }, + { 139033, true }, + { 139052, true }, + { 139071, true }, + { 139088, true }, + { 139106, true }, + { 139123, true }, + { 139138, true }, + { 139156, true }, + { 139171, true }, + { 139184, true }, + { 139208, true }, + { 139225, true }, + { 139243, true }, + { 139259, true }, + { 139277, true }, + { 139294, true }, + { 139310, true }, + { 139323, true }, + { 139336, true }, + { 139353, true }, + { 139374, true }, + { 139389, true }, + { 139406, true }, + { 139418, true }, + { 139426, true }, + { 139439, true }, + { 139453, true }, + { 139480, true }, + { 139496, true }, + { 139512, true }, + { 139525, true }, + { 139538, true }, + { 139548, true }, + { 139561, true }, + { 139576, true }, + { 139586, true }, + { 139597, true }, + { 139612, true }, + { 139627, false }, + { 139637, false }, + { 139647, false }, + { 139657, true }, + { 139669, true }, + { 139677, false }, + { 139688, true }, + { 139696, true }, + { 139705, true }, + { 139718, true }, + { 139730, true }, + { 139750, true }, + { 139761, true }, + { 139782, true }, + { 139798, true }, + { 139815, true }, + { 139834, true }, + { 139843, true }, + { 139857, true }, + { 139867, true }, + { 139878, true }, + { 139887, true }, + { 139896, true }, + { 139925, true }, + { 139944, true }, + { 139961, true }, + { 139984, true }, + { 139992, true }, + { 140010, true }, + { 140021, true }, { 140034, true }, - { 140047, true }, + { 140045, true }, { 140058, true }, - { 140067, true }, - { 140077, true }, - { 140087, true }, - { 140100, true }, - { 140111, true }, + { 140071, true }, + { 140088, true }, + { 140101, true }, + { 140112, true }, { 140121, true }, - { 140134, true }, - { 140144, true }, - { 140157, true }, - { 140176, true }, - { 140187, true }, - { 140202, true }, - { 140216, true }, - { 140227, true }, - { 140235, true }, - { 140249, true }, - { 140264, false }, - { 140278, false }, - { 140290, true }, - { 140301, false }, - { 140316, true }, - { 140330, true }, - { 140351, true }, - { 140366, true }, - { 140378, true }, - { 140389, true }, - { 140402, true }, - { 140412, true }, - { 140433, true }, - { 140451, true }, - { 140472, true }, - { 140498, true }, - { 140521, true }, - { 140554, true }, - { 140573, true }, - { 140597, true }, - { 140608, true }, - { 140622, true }, - { 140633, true }, - { 140646, false }, - { 140670, true }, - { 140681, true }, - { 140695, true }, - { 140706, true }, - { 140716, true }, - { 140724, true }, - { 140731, true }, - { 140742, true }, - { 140753, true }, - { 140764, true }, - { 140774, true }, - { 140785, true }, - { 140794, true }, - { 140809, true }, - { 140824, true }, - { 140835, true }, - { 140844, true }, - { 140855, true }, - { 140866, true }, - { 140880, true }, - { 140889, true }, - { 140905, true }, - { 140913, true }, - { 140925, true }, - { 140937, true }, - { 140953, true }, - { 140961, true }, + { 140131, true }, + { 140141, true }, + { 140154, true }, + { 140165, true }, + { 140175, true }, + { 140188, true }, + { 140198, true }, + { 140211, true }, + { 140230, true }, + { 140241, true }, + { 140256, true }, + { 140270, true }, + { 140281, true }, + { 140293, true }, + { 140301, true }, + { 140315, true }, + { 140330, false }, + { 140344, false }, + { 140356, true }, + { 140367, false }, + { 140382, true }, + { 140396, true }, + { 140417, true }, + { 140432, true }, + { 140444, true }, + { 140455, true }, + { 140468, true }, + { 140478, true }, + { 140499, true }, + { 140517, true }, + { 140538, true }, + { 140564, true }, + { 140587, true }, + { 140620, true }, + { 140639, true }, + { 140663, true }, + { 140674, true }, + { 140688, true }, + { 140699, true }, + { 140712, false }, + { 140736, true }, + { 140747, true }, + { 140761, true }, + { 140772, true }, + { 140782, true }, + { 140790, true }, + { 140797, true }, + { 140808, true }, + { 140819, true }, + { 140830, true }, + { 140840, true }, + { 140851, true }, + { 140860, true }, + { 140875, true }, + { 140890, true }, + { 140901, true }, + { 140910, true }, + { 140921, true }, + { 140932, true }, + { 140946, true }, + { 140955, true }, { 140971, true }, - { 140990, true }, - { 140998, true }, - { 141011, true }, - { 141028, true }, - { 141039, true }, - { 141051, true }, - { 141060, true }, - { 141081, true }, - { 141100, true }, - { 141116, true }, - { 141131, true }, - { 141144, true }, - { 141161, true }, - { 141174, true }, - { 141190, true }, - { 141200, true }, - { 141208, true }, - { 141217, true }, - { 141225, true }, - { 141239, true }, - { 141258, false }, - { 141267, true }, - { 141277, true }, - { 141299, true }, - { 141313, true }, - { 141328, true }, - { 141341, true }, - { 141355, true }, - { 141363, true }, - { 141375, true }, - { 141386, true }, - { 141398, true }, - { 141408, true }, - { 141417, true }, - { 141428, true }, - { 141439, false }, - { 141449, false }, - { 141465, true }, - { 141475, true }, - { 141490, true }, - { 141500, true }, - { 141514, true }, - { 141529, true }, + { 140979, true }, + { 140991, true }, + { 141003, true }, + { 141019, true }, + { 141027, true }, + { 141037, true }, + { 141056, true }, + { 141064, true }, + { 141077, true }, + { 141094, true }, + { 141105, true }, + { 141117, true }, + { 141126, true }, + { 141147, true }, + { 141166, true }, + { 141182, true }, + { 141197, true }, + { 141210, true }, + { 141227, true }, + { 141240, true }, + { 141256, true }, + { 141266, true }, + { 141274, true }, + { 141283, true }, + { 141291, true }, + { 141305, true }, + { 141324, false }, + { 141333, true }, + { 141343, true }, + { 141365, true }, + { 141379, true }, + { 141394, true }, + { 141407, true }, + { 141421, true }, + { 141429, true }, + { 141441, true }, + { 141452, true }, + { 141464, true }, + { 141474, true }, + { 141483, true }, + { 141494, true }, + { 141505, false }, + { 141515, false }, + { 141531, true }, { 141541, true }, - { 141552, true }, - { 141561, true }, - { 141574, true }, - { 141584, true }, - { 141597, true }, - { 141608, true }, - { 141631, false }, - { 141645, true }, - { 141657, true }, - { 141670, true }, - { 141679, true }, - { 141692, true }, - { 141708, true }, - { 141719, true }, - { 141733, true }, - { 141747, true }, - { 141757, true }, - { 141766, true }, - { 141776, true }, - { 141791, true }, - { 141803, true }, - { 141815, true }, - { 141829, true }, - { 141846, true }, - { 141856, false }, - { 141865, false }, - { 141884, true }, - { 141900, true }, - { 141915, true }, - { 141925, true }, - { 141937, true }, - { 141949, false }, - { 141961, true }, - { 141974, true }, - { 141992, true }, - { 142007, true }, - { 142022, false }, - { 142038, true }, - { 142050, true }, - { 142062, true }, + { 141556, true }, + { 141566, true }, + { 141580, true }, + { 141595, true }, + { 141607, true }, + { 141618, true }, + { 141627, true }, + { 141640, true }, + { 141650, true }, + { 141663, true }, + { 141674, true }, + { 141697, false }, + { 141711, true }, + { 141723, true }, + { 141736, true }, + { 141745, true }, + { 141758, true }, + { 141774, true }, + { 141785, true }, + { 141799, true }, + { 141813, true }, + { 141823, true }, + { 141832, true }, + { 141842, true }, + { 141857, true }, + { 141869, true }, + { 141881, true }, + { 141895, true }, + { 141912, true }, + { 141922, false }, + { 141931, false }, + { 141950, true }, + { 141966, true }, + { 141981, true }, + { 141991, true }, + { 142003, true }, + { 142015, false }, + { 142027, true }, + { 142040, true }, + { 142058, true }, { 142073, true }, - { 142086, false }, - { 142101, true }, + { 142088, false }, + { 142104, true }, { 142116, true }, - { 142126, true }, - { 142136, true }, - { 142150, true }, - { 142164, true }, - { 142176, true }, - { 142187, true }, - { 142203, true }, - { 142214, true }, - { 142225, true }, - { 142243, true }, - { 142261, true }, - { 142274, true }, - { 142295, false }, - { 142314, true }, - { 142334, true }, - { 142356, true }, - { 142368, true }, - { 142386, true }, - { 142401, true }, - { 142413, true }, - { 142429, true }, - { 142444, true }, - { 142460, true }, - { 142476, true }, - { 142493, true }, - { 142509, true }, + { 142128, true }, + { 142139, true }, + { 142152, false }, + { 142167, true }, + { 142182, true }, + { 142192, true }, + { 142202, true }, + { 142216, true }, + { 142230, true }, + { 142242, true }, + { 142253, true }, + { 142269, true }, + { 142280, true }, + { 142291, true }, + { 142309, true }, + { 142327, true }, + { 142340, true }, + { 142361, false }, + { 142380, true }, + { 142400, true }, + { 142422, true }, + { 142434, true }, + { 142452, true }, + { 142467, true }, + { 142479, true }, + { 142495, true }, + { 142510, true }, { 142526, true }, - { 142548, true }, - { 142565, true }, - { 142587, true }, - { 142598, true }, + { 142542, true }, + { 142559, true }, + { 142575, true }, + { 142592, true }, { 142614, true }, - { 142634, true }, - { 142645, true }, - { 142659, true }, - { 142682, true }, - { 142694, true }, - { 142709, true }, - { 142734, true }, - { 142749, true }, - { 142761, true }, - { 142776, true }, - { 142792, true }, - { 142807, true }, - { 142836, true }, - { 142861, true }, - { 142883, true }, - { 142901, true }, - { 142915, true }, - { 142928, true }, - { 142943, true }, - { 142958, true }, - { 142965, true }, - { 142981, true }, - { 142992, true }, - { 143003, true }, - { 143013, true }, - { 143024, true }, - { 143038, true }, - { 143052, true }, - { 143064, true }, - { 143076, true }, - { 143087, true }, - { 143102, true }, - { 143115, true }, - { 143144, true }, - { 143153, true }, - { 143168, true }, - { 143175, true }, + { 142631, true }, + { 142653, true }, + { 142664, true }, + { 142680, true }, + { 142700, true }, + { 142711, true }, + { 142725, true }, + { 142748, true }, + { 142760, true }, + { 142775, true }, + { 142800, true }, + { 142815, true }, + { 142827, true }, + { 142842, true }, + { 142858, true }, + { 142873, true }, + { 142902, true }, + { 142924, true }, + { 142942, true }, + { 142956, true }, + { 142969, true }, + { 142984, true }, + { 142999, true }, + { 143006, true }, + { 143022, true }, + { 143033, true }, + { 143044, true }, + { 143054, true }, + { 143065, true }, + { 143079, true }, + { 143093, true }, + { 143105, true }, + { 143117, true }, + { 143128, true }, + { 143143, true }, + { 143156, true }, { 143185, true }, - { 143195, true }, - { 143204, true }, - { 143220, true }, - { 143229, true }, - { 143238, true }, - { 143250, true }, - { 143266, true }, - { 143285, true }, - { 143297, false }, - { 143314, false }, - { 143334, true }, - { 143349, true }, - { 143365, true }, - { 143378, true }, - { 143396, true }, - { 143411, true }, - { 143420, true }, - { 143435, true }, - { 143449, true }, - { 143465, true }, - { 143480, true }, - { 143502, true }, - { 143523, true }, - { 143542, true }, - { 143561, true }, - { 143577, true }, - { 143588, true }, - { 143597, true }, - { 143607, true }, - { 143626, true }, - { 143641, true }, - { 143655, true }, - { 143668, true }, - { 143676, true }, - { 143684, true }, - { 143693, true }, - { 143705, true }, + { 143194, true }, + { 143209, true }, + { 143216, true }, + { 143226, true }, + { 143236, true }, + { 143245, true }, + { 143261, true }, + { 143270, true }, + { 143279, true }, + { 143291, true }, + { 143307, true }, + { 143326, true }, + { 143338, false }, + { 143355, false }, + { 143375, true }, + { 143390, true }, + { 143406, true }, + { 143419, true }, + { 143437, true }, + { 143452, true }, + { 143461, true }, + { 143476, true }, + { 143490, true }, + { 143506, true }, + { 143521, true }, + { 143543, true }, + { 143564, true }, + { 143583, true }, + { 143602, true }, + { 143618, true }, + { 143629, true }, + { 143638, true }, + { 143648, true }, + { 143667, true }, + { 143682, true }, + { 143696, true }, + { 143709, true }, { 143717, true }, - { 143726, true }, - { 143738, true }, + { 143725, true }, + { 143734, true }, { 143746, true }, { 143758, true }, - { 143784, true }, - { 143807, false }, - { 143823, true }, - { 143837, true }, - { 143857, true }, - { 143868, true }, - { 143889, true }, - { 143908, true }, - { 143922, true }, - { 143936, true }, - { 143953, true }, - { 143967, false }, - { 143982, true }, - { 143990, true }, - { 144005, true }, - { 144020, true }, + { 143767, true }, + { 143779, true }, + { 143787, true }, + { 143799, true }, + { 143825, true }, + { 143848, false }, + { 143864, true }, + { 143878, true }, + { 143898, true }, + { 143909, true }, + { 143930, true }, + { 143949, true }, + { 143963, true }, + { 143977, true }, + { 143994, true }, + { 144008, false }, + { 144023, true }, { 144031, true }, - { 144045, true }, - { 144056, true }, - { 144066, true }, - { 144084, true }, - { 144101, true }, - { 144121, true }, - { 144145, true }, - { 144152, true }, - { 144163, true }, - { 144174, true }, - { 144187, true }, - { 144199, false }, - { 144214, true }, - { 144230, true }, - { 144243, true }, - { 144251, true }, - { 144261, true }, - { 144276, false }, - { 144285, true }, - { 144299, true }, - { 144314, true }, - { 144324, true }, - { 144336, true }, - { 144346, true }, - { 144359, true }, - { 144371, true }, - { 144379, true }, - { 144390, true }, - { 144404, true }, - { 144425, true }, - { 144438, true }, - { 144448, false }, - { 144468, true }, + { 144046, true }, + { 144061, true }, + { 144072, true }, + { 144086, true }, + { 144097, true }, + { 144107, true }, + { 144125, true }, + { 144142, true }, + { 144162, true }, + { 144186, true }, + { 144193, true }, + { 144204, true }, + { 144215, true }, + { 144228, true }, + { 144240, false }, + { 144255, true }, + { 144271, true }, + { 144284, true }, + { 144292, true }, + { 144302, true }, + { 144317, false }, + { 144326, true }, + { 144340, true }, + { 144355, true }, + { 144365, true }, + { 144377, true }, + { 144387, true }, + { 144400, true }, + { 144412, true }, + { 144420, true }, + { 144431, true }, + { 144445, true }, + { 144466, true }, { 144479, true }, - { 144486, true }, - { 144493, true }, - { 144503, true }, + { 144489, false }, { 144509, true }, - { 144517, true }, - { 144526, false }, - { 144546, true }, - { 144555, true }, - { 144573, true }, - { 144585, true }, - { 144599, true }, - { 144614, true }, - { 144626, true }, - { 144639, true }, - { 144657, true }, - { 144668, true }, - { 144676, true }, - { 144686, true }, - { 144694, true }, + { 144520, true }, + { 144527, true }, + { 144534, true }, + { 144544, true }, + { 144550, true }, + { 144558, true }, + { 144567, false }, + { 144587, true }, + { 144596, true }, + { 144605, true }, + { 144623, true }, + { 144637, true }, + { 144652, true }, + { 144664, true }, + { 144677, true }, + { 144695, true }, { 144706, true }, - { 144715, true }, - { 144728, true }, - { 144738, true }, - { 144750, true }, - { 144765, true }, - { 144777, true }, - { 144791, true }, - { 144807, true }, - { 144825, true }, - { 144838, true }, - { 144851, false }, - { 144864, true }, - { 144883, true }, - { 144898, true }, - { 144906, true }, - { 144918, true }, - { 144932, true }, - { 144952, true }, - { 144964, true }, + { 144714, true }, + { 144724, true }, + { 144732, true }, + { 144744, true }, + { 144753, true }, + { 144766, true }, + { 144776, true }, + { 144788, true }, + { 144803, true }, + { 144815, true }, + { 144829, true }, + { 144845, true }, + { 144863, true }, + { 144876, true }, + { 144889, false }, + { 144902, true }, + { 144921, true }, + { 144936, true }, + { 144944, true }, + { 144956, true }, + { 144970, true }, { 144990, true }, - { 145008, true }, - { 145025, true }, - { 145042, true }, - { 145053, true }, - { 145071, true }, - { 145083, true }, - { 145096, true }, - { 145112, true }, - { 145126, true }, - { 145144, true }, - { 145160, true }, - { 145183, true }, - { 145202, true }, - { 145216, true }, - { 145232, true }, - { 145248, true }, - { 145265, true }, - { 145296, true }, - { 145326, false }, - { 145342, true }, - { 145353, true }, - { 145365, true }, - { 145378, true }, - { 145395, true }, - { 145409, true }, - { 145434, true }, - { 145451, true }, - { 145468, true }, - { 145487, true }, - { 145502, true }, - { 145522, true }, - { 145537, true }, - { 145548, true }, - { 145563, true }, - { 145581, true }, - { 145597, true }, - { 145609, true }, + { 145002, true }, + { 145028, true }, + { 145046, true }, + { 145063, true }, + { 145080, true }, + { 145091, true }, + { 145109, true }, + { 145121, true }, + { 145134, true }, + { 145150, true }, + { 145164, true }, + { 145182, true }, + { 145198, true }, + { 145221, true }, + { 145240, true }, + { 145254, true }, + { 145270, true }, + { 145286, true }, + { 145303, true }, + { 145334, true }, + { 145364, false }, + { 145380, true }, + { 145391, true }, + { 145403, true }, + { 145416, true }, + { 145433, true }, + { 145447, true }, + { 145472, true }, + { 145489, true }, + { 145506, true }, + { 145525, true }, + { 145540, true }, + { 145560, true }, + { 145575, true }, + { 145586, true }, + { 145601, true }, { 145619, true }, - { 145636, true }, - { 145648, false }, - { 145662, true }, - { 145669, false }, - { 145701, true }, - { 145715, true }, - { 145725, true }, + { 145635, true }, + { 145647, true }, + { 145657, true }, + { 145674, true }, + { 145686, false }, + { 145700, true }, + { 145707, false }, { 145739, true }, - { 145752, true }, - { 145769, true }, - { 145781, true }, - { 145795, true }, - { 145811, false }, - { 145826, true }, - { 145840, true }, - { 145851, true }, - { 145862, true }, - { 145874, true }, - { 145883, true }, - { 145890, true }, - { 145901, true }, - { 145909, true }, - { 145916, true }, - { 145926, true }, - { 145937, true }, - { 145945, true }, - { 145953, true }, - { 145961, true }, - { 145974, true }, - { 145989, true }, + { 145753, true }, + { 145763, true }, + { 145777, true }, + { 145790, true }, + { 145807, true }, + { 145819, true }, + { 145833, true }, + { 145849, false }, + { 145864, true }, + { 145878, true }, + { 145889, true }, + { 145900, true }, + { 145912, true }, + { 145921, true }, + { 145928, true }, + { 145939, true }, + { 145947, true }, + { 145954, true }, + { 145964, true }, + { 145975, true }, + { 145983, true }, + { 145991, true }, { 145999, true }, - { 146009, true }, - { 146016, true }, - { 146028, true }, + { 146012, true }, + { 146027, true }, { 146037, true }, - { 146053, true }, - { 146065, true }, - { 146077, true }, - { 146089, true }, - { 146100, true }, + { 146047, true }, + { 146054, true }, + { 146066, true }, + { 146075, true }, + { 146091, true }, + { 146103, true }, { 146115, true }, - { 146123, true }, - { 146134, true }, - { 146145, true }, - { 146159, true }, - { 146175, true }, - { 146187, true }, - { 146201, true }, - { 146215, false }, + { 146127, true }, + { 146138, true }, + { 146153, true }, + { 146161, true }, + { 146172, true }, + { 146183, true }, + { 146197, true }, + { 146213, true }, { 146225, true }, - { 146246, true }, - { 146261, true }, - { 146282, true }, - { 146294, true }, - { 146302, true }, - { 146316, true }, - { 146323, true }, - { 146335, true }, - { 146349, true }, - { 146366, true }, - { 146379, true }, - { 146395, true }, - { 146408, true }, - { 146422, true }, + { 146239, true }, + { 146253, false }, + { 146263, true }, + { 146284, true }, + { 146299, true }, + { 146320, true }, + { 146332, true }, + { 146340, true }, + { 146354, true }, + { 146361, true }, + { 146373, true }, + { 146387, true }, + { 146404, true }, + { 146417, true }, { 146433, true }, - { 146442, true }, - { 146452, true }, - { 146459, true }, + { 146446, true }, + { 146460, true }, { 146471, true }, { 146480, true }, - { 146489, true }, + { 146490, true }, { 146497, true }, - { 146512, true }, - { 146520, true }, - { 146532, false }, - { 146542, true }, - { 146552, true }, - { 146563, true }, - { 146572, true }, + { 146509, true }, + { 146518, true }, + { 146527, true }, + { 146535, true }, + { 146550, true }, + { 146558, true }, + { 146570, false }, + { 146580, true }, { 146590, true }, - { 146600, true }, - { 146611, false }, - { 146622, true }, - { 146633, true }, - { 146655, true }, - { 146663, true }, - { 146671, false }, - { 146679, true }, - { 146687, true }, - { 146703, true }, - { 146719, true }, - { 146732, true }, - { 146743, true }, - { 146755, true }, - { 146774, true }, - { 146788, true }, - { 146802, true }, - { 146816, true }, - { 146831, false }, - { 146849, true }, - { 146865, true }, - { 146880, true }, - { 146891, true }, + { 146601, true }, + { 146610, true }, + { 146628, true }, + { 146638, true }, + { 146649, false }, + { 146660, true }, + { 146671, true }, + { 146693, true }, + { 146701, true }, + { 146709, false }, + { 146717, true }, + { 146725, true }, + { 146741, true }, + { 146757, true }, + { 146770, true }, + { 146781, true }, + { 146793, true }, + { 146812, true }, + { 146826, true }, + { 146840, true }, + { 146854, true }, + { 146869, false }, + { 146887, true }, { 146903, true }, - { 146914, true }, - { 146933, true }, - { 146949, true }, - { 146961, true }, - { 146973, true }, - { 146986, true }, - { 146998, true }, - { 147005, true }, - { 147018, true }, - { 147035, true }, - { 147057, true }, - { 147067, true }, - { 147077, true }, - { 147089, false }, - { 147100, true }, - { 147114, true }, - { 147123, true }, - { 147134, true }, + { 146918, true }, + { 146929, true }, + { 146941, true }, + { 146952, true }, + { 146971, true }, + { 146987, true }, + { 146999, true }, + { 147011, true }, + { 147024, true }, + { 147036, true }, + { 147043, true }, + { 147056, true }, + { 147073, true }, + { 147095, true }, + { 147105, true }, + { 147115, true }, + { 147127, false }, + { 147138, true }, { 147152, true }, - { 147171, true }, - { 147187, true }, - { 147200, true }, - { 147216, true }, - { 147243, true }, - { 147255, true }, - { 147269, true }, - { 147277, true }, - { 147291, true }, - { 147301, true }, - { 147337, true }, - { 147370, true }, - { 147393, true }, - { 147406, true }, - { 147415, true }, - { 147432, false }, - { 147455, true }, - { 147471, true }, - { 147489, true }, - { 147506, true }, - { 147530, true }, - { 147542, true }, - { 147551, true }, - { 147560, true }, - { 147572, true }, - { 147581, true }, + { 147161, true }, + { 147172, true }, + { 147190, true }, + { 147209, true }, + { 147225, true }, + { 147238, true }, + { 147254, true }, + { 147281, true }, + { 147293, true }, + { 147307, true }, + { 147315, true }, + { 147329, true }, + { 147339, true }, + { 147375, true }, + { 147408, true }, + { 147431, true }, + { 147444, true }, + { 147453, true }, + { 147470, false }, + { 147493, true }, + { 147509, true }, + { 147527, true }, + { 147544, true }, + { 147568, true }, + { 147580, true }, { 147589, true }, - { 147602, true }, - { 147613, true }, - { 147638, true }, - { 147649, true }, - { 147662, true }, + { 147598, true }, + { 147610, true }, + { 147619, true }, + { 147627, true }, + { 147640, true }, + { 147651, true }, { 147676, true }, - { 147689, false }, + { 147687, true }, { 147700, true }, - { 147708, true }, - { 147716, true }, - { 147724, true }, - { 147737, false }, - { 147748, true }, - { 147763, true }, - { 147783, true }, - { 147791, true }, - { 147809, true }, + { 147714, true }, + { 147727, false }, + { 147738, true }, + { 147746, true }, + { 147754, true }, + { 147762, true }, + { 147775, false }, + { 147786, true }, + { 147801, true }, + { 147821, true }, { 147829, true }, - { 147849, true }, - { 147870, true }, - { 147885, true }, - { 147911, true }, - { 147921, true }, - { 147934, false }, - { 147952, true }, - { 147983, true }, - { 148003, true }, - { 148020, true }, - { 148038, true }, - { 148051, true }, - { 148066, true }, - { 148078, true }, - { 148088, true }, + { 147847, true }, + { 147867, true }, + { 147887, true }, + { 147908, true }, + { 147923, true }, + { 147949, true }, + { 147959, true }, + { 147972, false }, + { 147990, true }, + { 148010, true }, + { 148027, true }, + { 148045, true }, + { 148058, true }, + { 148073, true }, + { 148085, true }, { 148095, true }, - { 148115, true }, - { 148128, true }, - { 148145, true }, - { 148161, true }, - { 148173, true }, - { 148187, true }, - { 148199, true }, - { 148214, true }, - { 148232, true }, - { 148245, true }, - { 148255, true }, - { 148266, true }, - { 148277, true }, - { 148288, true }, - { 148303, true }, - { 148314, true }, - { 148326, false }, - { 148338, true }, - { 148352, true }, - { 148369, true }, - { 148379, true }, - { 148392, false }, - { 148410, false }, - { 148421, true }, - { 148436, true }, - { 148453, true }, - { 148470, true }, - { 148487, true }, - { 148497, true }, - { 148512, true }, - { 148522, true }, - { 148537, true }, - { 148554, true }, - { 148566, true }, - { 148577, true }, - { 148595, true }, - { 148610, true }, - { 148625, true }, - { 148650, true }, - { 148675, true }, - { 148688, true }, - { 148707, true }, - { 148724, true }, - { 148744, true }, - { 148765, true }, - { 148779, true }, - { 148804, true }, - { 148825, true }, - { 148847, true }, - { 148877, true }, + { 148102, true }, + { 148122, true }, + { 148135, true }, + { 148152, true }, + { 148168, true }, + { 148180, true }, + { 148194, true }, + { 148206, true }, + { 148221, true }, + { 148239, true }, + { 148252, true }, + { 148262, true }, + { 148273, true }, + { 148284, true }, + { 148295, true }, + { 148310, true }, + { 148321, true }, + { 148333, false }, + { 148345, true }, + { 148359, true }, + { 148376, true }, + { 148386, true }, + { 148399, false }, + { 148417, false }, + { 148428, true }, + { 148443, true }, + { 148460, true }, + { 148477, true }, + { 148494, true }, + { 148504, true }, + { 148519, true }, + { 148529, true }, + { 148544, true }, + { 148561, true }, + { 148573, true }, + { 148584, true }, + { 148602, true }, + { 148617, true }, + { 148632, true }, + { 148657, true }, + { 148682, true }, + { 148695, true }, + { 148712, true }, + { 148731, true }, + { 148748, true }, + { 148768, true }, + { 148789, true }, + { 148803, true }, + { 148828, true }, + { 148849, true }, + { 148871, true }, { 148901, true }, - { 148916, true }, - { 148929, true }, - { 148939, true }, - { 148962, true }, - { 148973, true }, - { 148980, true }, - { 148994, true }, - { 149013, true }, - { 149022, true }, - { 149029, true }, - { 149049, true }, - { 149060, true }, - { 149079, true }, - { 149095, true }, - { 149105, true }, - { 149116, true }, - { 149126, true }, - { 149137, true }, - { 149149, true }, - { 149165, true }, + { 148925, true }, + { 148940, true }, + { 148953, true }, + { 148963, true }, + { 148986, true }, + { 148997, true }, + { 149004, true }, + { 149018, true }, + { 149037, true }, + { 149046, true }, + { 149053, true }, + { 149073, true }, + { 149084, true }, + { 149103, true }, + { 149119, true }, + { 149129, true }, + { 149140, true }, + { 149150, true }, + { 149161, true }, { 149173, true }, - { 149183, true }, - { 149195, true }, - { 149206, true }, - { 149221, true }, + { 149189, true }, + { 149197, true }, + { 149207, true }, + { 149219, true }, + { 149230, true }, { 149245, true }, - { 149259, true }, - { 149267, true }, - { 149285, true }, - { 149296, true }, + { 149269, true }, + { 149283, true }, + { 149291, true }, { 149309, true }, { 149320, true }, - { 149339, true }, - { 149351, true }, - { 149362, true }, - { 149377, true }, - { 149392, true }, - { 149406, true }, - { 149418, true }, - { 149436, true }, - { 149456, true }, - { 149468, true }, - { 149485, true }, - { 149500, true }, - { 149514, true }, - { 149528, true }, - { 149539, true }, - { 149548, true }, - { 149561, true }, - { 149570, true }, - { 149581, true }, - { 149593, true }, - { 149600, true }, - { 149611, true }, - { 149628, false }, - { 149654, false }, - { 149666, true }, - { 149679, true }, + { 149333, true }, + { 149344, true }, + { 149363, true }, + { 149375, true }, + { 149386, true }, + { 149401, true }, + { 149416, true }, + { 149430, true }, + { 149442, true }, + { 149460, true }, + { 149480, true }, + { 149492, true }, + { 149509, true }, + { 149524, true }, + { 149538, true }, + { 149552, true }, + { 149563, true }, + { 149572, true }, + { 149585, true }, + { 149594, true }, + { 149605, true }, + { 149617, true }, + { 149624, true }, + { 149635, true }, + { 149652, false }, + { 149678, false }, { 149690, true }, - { 149707, true }, - { 149717, true }, - { 149730, true }, - { 149745, true }, - { 149766, true }, - { 149782, true }, + { 149703, true }, + { 149714, true }, + { 149731, true }, + { 149741, true }, + { 149754, true }, + { 149769, true }, + { 149790, true }, { 149806, true }, - { 149820, true }, - { 149831, true }, - { 149845, true }, - { 149862, true }, - { 149874, true }, - { 149889, true }, - { 149899, true }, - { 149912, true }, - { 149925, true }, - { 149938, true }, - { 149958, true }, - { 149980, true }, - { 149994, true }, - { 150009, false }, - { 150022, true }, - { 150037, true }, - { 150048, true }, - { 150068, true }, - { 150081, true }, - { 150102, true }, - { 150113, true }, - { 150132, true }, - { 150140, true }, - { 150148, true }, - { 150165, true }, - { 150181, true }, - { 150190, true }, + { 149830, true }, + { 149844, true }, + { 149855, true }, + { 149869, true }, + { 149886, true }, + { 149898, true }, + { 149913, true }, + { 149923, true }, + { 149936, true }, + { 149949, true }, + { 149962, true }, + { 149982, true }, + { 150004, true }, + { 150018, true }, + { 150033, false }, + { 150046, true }, + { 150061, true }, + { 150072, true }, + { 150092, true }, + { 150105, true }, + { 150126, true }, + { 150137, true }, + { 150156, true }, + { 150164, true }, + { 150172, true }, + { 150189, true }, { 150205, true }, - { 150216, true }, - { 150227, true }, - { 150237, true }, - { 150247, true }, - { 150258, true }, - { 150268, true }, - { 150279, true }, - { 150291, true }, - { 150298, true }, - { 150316, true }, - { 150328, true }, - { 150339, true }, - { 150361, true }, - { 150375, true }, - { 150394, true }, - { 150402, true }, - { 150421, true }, - { 150443, true }, - { 150452, true }, - { 150464, true }, - { 150482, true }, - { 150496, true }, - { 150515, true }, - { 150525, true }, - { 150534, true }, - { 150550, true }, + { 150214, true }, + { 150229, true }, + { 150240, true }, + { 150251, true }, + { 150261, true }, + { 150271, true }, + { 150282, true }, + { 150292, true }, + { 150303, true }, + { 150315, true }, + { 150322, true }, + { 150340, true }, + { 150352, true }, + { 150363, true }, + { 150385, true }, + { 150399, true }, + { 150418, true }, + { 150426, true }, + { 150445, true }, + { 150467, true }, + { 150476, true }, + { 150488, true }, + { 150506, true }, + { 150520, true }, + { 150539, true }, + { 150549, true }, { 150558, true }, - { 150570, true }, - { 150585, true }, - { 150605, true }, - { 150613, true }, - { 150626, true }, - { 150635, true }, - { 150653, true }, - { 150665, true }, - { 150684, true }, - { 150698, true }, - { 150711, true }, - { 150723, true }, + { 150574, true }, + { 150582, true }, + { 150594, true }, + { 150609, true }, + { 150629, true }, + { 150637, true }, + { 150650, true }, + { 150659, true }, + { 150677, true }, + { 150689, true }, + { 150708, true }, + { 150722, true }, + { 150735, true }, { 150747, true }, - { 150763, true }, - { 150777, true }, - { 150794, true }, - { 150810, true }, - { 150827, true }, - { 150846, true }, - { 150862, true }, + { 150771, true }, + { 150787, true }, + { 150801, true }, + { 150818, true }, + { 150834, true }, + { 150851, true }, { 150870, true }, - { 150888, true }, - { 150897, false }, - { 150906, true }, - { 150918, true }, - { 150932, true }, + { 150886, true }, + { 150894, true }, + { 150912, true }, + { 150921, false }, + { 150930, true }, { 150942, true }, - { 150955, true }, - { 150964, true }, - { 150987, true }, - { 150999, true }, - { 151015, true }, - { 151025, false }, - { 151034, true }, - { 151041, true }, - { 151050, true }, + { 150956, true }, + { 150966, true }, + { 150979, true }, + { 150988, true }, + { 151011, true }, + { 151023, true }, + { 151039, true }, + { 151049, false }, { 151058, true }, - { 151067, false }, - { 151081, true }, - { 151095, true }, + { 151065, true }, + { 151074, true }, + { 151082, true }, + { 151091, false }, { 151105, true }, - { 151115, true }, - { 151125, true }, - { 151137, true }, + { 151119, true }, + { 151129, true }, + { 151139, true }, { 151149, true }, - { 151167, false }, - { 151180, true }, - { 151195, true }, - { 151213, true }, - { 151223, true }, - { 151234, true }, - { 151246, true }, - { 151259, true }, - { 151273, true }, - { 151287, true }, + { 151161, true }, + { 151173, true }, + { 151191, false }, + { 151204, true }, + { 151219, true }, + { 151237, true }, + { 151247, true }, + { 151258, true }, + { 151270, true }, + { 151283, true }, { 151297, true }, - { 151310, true }, - { 151320, true }, - { 151331, true }, - { 151340, true }, - { 151357, true }, - { 151366, true }, - { 151379, true }, + { 151311, true }, + { 151321, true }, + { 151334, true }, + { 151344, true }, + { 151355, true }, + { 151364, true }, + { 151381, true }, { 151390, true }, - { 151408, true }, - { 151418, true }, - { 151430, true }, + { 151403, true }, + { 151414, true }, + { 151432, true }, { 151442, true }, - { 151453, true }, - { 151470, true }, - { 151483, true }, - { 151497, true }, - { 151506, true }, - { 151519, false }, - { 151528, true }, - { 151545, false }, - { 151556, true }, - { 151572, false }, - { 151587, false }, - { 151598, false }, - { 151605, true }, - { 151621, true }, - { 151639, true }, - { 151658, true }, - { 151673, true }, - { 151690, true }, - { 151704, true }, - { 151720, true }, - { 151741, true }, - { 151755, true }, - { 151780, true }, - { 151797, true }, - { 151816, true }, - { 151831, false }, - { 151845, true }, - { 151859, true }, - { 151872, true }, - { 151893, true }, - { 151905, true }, - { 151918, true }, - { 151928, true }, - { 151948, true }, - { 151961, true }, - { 151980, true }, - { 151996, true }, - { 152014, true }, - { 152028, false }, - { 152040, true }, - { 152050, true }, + { 151454, true }, + { 151466, true }, + { 151477, true }, + { 151494, true }, + { 151507, true }, + { 151521, true }, + { 151530, true }, + { 151543, false }, + { 151552, true }, + { 151569, false }, + { 151580, true }, + { 151596, false }, + { 151611, false }, + { 151622, false }, + { 151629, true }, + { 151645, true }, + { 151663, true }, + { 151682, true }, + { 151697, true }, + { 151714, true }, + { 151728, true }, + { 151744, true }, + { 151765, true }, + { 151779, true }, + { 151804, true }, + { 151821, true }, + { 151840, true }, + { 151855, false }, + { 151869, true }, + { 151883, true }, + { 151896, true }, + { 151917, true }, + { 151929, true }, + { 151942, true }, + { 151952, true }, + { 151972, true }, + { 151985, true }, + { 152004, true }, + { 152020, true }, + { 152038, true }, + { 152052, false }, { 152064, true }, { 152074, true }, - { 152090, true }, - { 152116, true }, - { 152144, true }, - { 152157, true }, - { 152172, true }, - { 152188, true }, - { 152212, true }, - { 152228, true }, - { 152243, true }, - { 152257, true }, - { 152269, true }, - { 152281, false }, - { 152299, true }, - { 152312, true }, - { 152331, true }, - { 152349, true }, - { 152364, true }, - { 152387, true }, - { 152404, true }, - { 152423, true }, - { 152443, true }, - { 152466, true }, - { 152485, true }, - { 152504, true }, - { 152523, true }, - { 152541, true }, - { 152560, true }, - { 152571, true }, - { 152581, true }, - { 152596, true }, - { 152617, true }, - { 152637, true }, - { 152656, true }, - { 152670, true }, - { 152682, true }, - { 152692, true }, - { 152722, true }, - { 152745, true }, - { 152768, true }, - { 152797, true }, - { 152815, true }, - { 152831, true }, - { 152850, true }, - { 152862, true }, - { 152872, true }, - { 152892, false }, - { 152904, true }, - { 152917, true }, - { 152934, true }, - { 152952, true }, - { 152972, true }, - { 152987, true }, + { 152088, true }, + { 152098, true }, + { 152114, true }, + { 152140, true }, + { 152168, true }, + { 152181, true }, + { 152197, true }, + { 152221, true }, + { 152237, true }, + { 152252, true }, + { 152266, true }, + { 152278, true }, + { 152290, false }, + { 152308, true }, + { 152321, true }, + { 152340, true }, + { 152358, true }, + { 152373, true }, + { 152396, true }, + { 152413, true }, + { 152432, true }, + { 152452, true }, + { 152475, true }, + { 152494, true }, + { 152513, true }, + { 152532, true }, + { 152550, true }, + { 152569, true }, + { 152580, true }, + { 152590, true }, + { 152605, true }, + { 152626, true }, + { 152646, true }, + { 152665, true }, + { 152679, true }, + { 152691, true }, + { 152701, true }, + { 152731, true }, + { 152754, true }, + { 152777, true }, + { 152806, true }, + { 152824, true }, + { 152840, true }, + { 152859, true }, + { 152871, true }, + { 152881, true }, + { 152901, false }, + { 152913, true }, + { 152926, true }, + { 152943, true }, + { 152961, true }, + { 152981, true }, { 152996, true }, - { 153008, true }, - { 153019, true }, - { 153031, true }, - { 153043, false }, - { 153060, true }, - { 153073, true }, - { 153091, true }, - { 153106, true }, - { 153121, true }, - { 153133, true }, - { 153147, true }, - { 153159, true }, - { 153179, true }, - { 153191, true }, - { 153205, true }, - { 153225, true }, - { 153239, true }, - { 153257, true }, - { 153270, true }, - { 153285, true }, - { 153301, true }, - { 153316, true }, - { 153328, true }, - { 153341, true }, - { 153357, true }, - { 153367, true }, - { 153374, true }, - { 153389, true }, - { 153409, true }, - { 153420, true }, - { 153433, true }, + { 153005, true }, + { 153017, true }, + { 153028, true }, + { 153040, true }, + { 153052, false }, + { 153069, true }, + { 153082, true }, + { 153100, true }, + { 153115, true }, + { 153130, true }, + { 153142, true }, + { 153156, true }, + { 153168, true }, + { 153188, true }, + { 153200, true }, + { 153214, true }, + { 153234, true }, + { 153248, true }, + { 153266, true }, + { 153279, true }, + { 153294, true }, + { 153310, true }, + { 153325, true }, + { 153337, true }, + { 153350, true }, + { 153366, true }, + { 153376, true }, + { 153383, true }, + { 153398, true }, + { 153418, true }, + { 153429, true }, { 153442, true }, - { 153462, true }, - { 153482, true }, - { 153505, true }, - { 153525, true }, - { 153537, true }, - { 153548, true }, - { 153559, false }, - { 153570, true }, - { 153581, true }, - { 153592, false }, - { 153602, false }, - { 153619, true }, - { 153631, true }, - { 153647, true }, - { 153660, true }, + { 153451, true }, + { 153471, true }, + { 153491, true }, + { 153514, true }, + { 153534, true }, + { 153546, true }, + { 153557, true }, + { 153568, false }, + { 153579, true }, + { 153590, true }, + { 153601, false }, + { 153611, false }, + { 153628, true }, + { 153640, true }, + { 153656, true }, { 153669, true }, - { 153683, true }, - { 153694, true }, - { 153706, true }, - { 153724, true }, - { 153738, true }, - { 153751, true }, - { 153764, true }, + { 153678, true }, + { 153692, true }, + { 153703, true }, + { 153715, true }, + { 153733, true }, + { 153747, true }, + { 153760, true }, { 153773, true }, - { 153788, true }, - { 153799, true }, - { 153813, true }, - { 153833, true }, - { 153845, true }, - { 153855, true }, - { 153866, true }, - { 153899, true }, - { 153911, true }, - { 153925, true }, - { 153944, true }, - { 153959, true }, - { 153973, true }, - { 153987, false }, - { 154007, true }, - { 154024, true }, - { 154035, true }, - { 154048, true }, - { 154063, true }, - { 154079, true }, - { 154097, true }, - { 154113, true }, - { 154130, true }, - { 154142, true }, - { 154156, true }, - { 154172, true }, - { 154185, true }, - { 154197, true }, - { 154208, true }, - { 154215, true }, - { 154232, true }, - { 154245, true }, + { 153782, true }, + { 153797, true }, + { 153808, true }, + { 153822, true }, + { 153842, true }, + { 153854, true }, + { 153864, true }, + { 153875, true }, + { 153908, true }, + { 153920, true }, + { 153934, true }, + { 153953, true }, + { 153968, true }, + { 153982, true }, + { 153996, false }, + { 154016, true }, + { 154033, true }, + { 154044, true }, + { 154057, true }, + { 154072, true }, + { 154088, true }, + { 154106, true }, + { 154122, true }, + { 154139, true }, + { 154151, true }, + { 154165, true }, + { 154181, true }, + { 154194, true }, + { 154206, true }, + { 154217, true }, + { 154224, true }, + { 154241, true }, { 154254, true }, - { 154265, true }, + { 154263, true }, { 154274, true }, - { 154287, true }, - { 154318, true }, - { 154331, true }, - { 154344, true }, - { 154357, true }, - { 154368, true }, + { 154283, true }, + { 154296, true }, + { 154327, true }, + { 154340, true }, + { 154353, true }, + { 154366, true }, { 154377, true }, - { 154392, true }, - { 154404, true }, - { 154420, true }, - { 154441, true }, - { 154458, false }, - { 154471, true }, - { 154485, true }, - { 154497, true }, - { 154510, true }, - { 154521, true }, - { 154538, true }, - { 154549, true }, - { 154568, true }, - { 154586, false }, - { 154598, true }, - { 154608, true }, - { 154644, true }, - { 154657, true }, - { 154671, true }, - { 154680, true }, - { 154690, true }, - { 154702, true }, - { 154720, true }, - { 154734, true }, - { 154752, true }, - { 154773, true }, - { 154793, true }, - { 154816, true }, - { 154832, true }, - { 154846, true }, - { 154862, true }, - { 154875, true }, - { 154896, true }, - { 154916, true }, - { 154929, true }, - { 154938, true }, - { 154972, true }, - { 154993, true }, - { 155010, true }, - { 155021, true }, - { 155032, true }, - { 155044, true }, - { 155055, true }, - { 155074, true }, - { 155086, true }, - { 155099, true }, - { 155115, true }, - { 155134, true }, - { 155149, true }, - { 155163, true }, - { 155178, true }, - { 155195, false }, - { 155210, true }, - { 155230, true }, - { 155241, true }, - { 155252, true }, - { 155272, false }, - { 155281, true }, - { 155290, true }, - { 155301, true }, - { 155313, true }, - { 155327, true }, - { 155345, true }, - { 155359, true }, - { 155371, true }, - { 155386, true }, - { 155399, true }, - { 155410, true }, - { 155427, true }, - { 155437, true }, - { 155458, true }, - { 155486, false }, - { 155497, true }, - { 155504, true }, - { 155515, true }, - { 155525, true }, - { 155535, true }, - { 155549, true }, - { 155563, true }, - { 155574, false }, - { 155585, true }, - { 155593, false }, - { 155613, true }, - { 155628, true }, - { 155641, true }, - { 155657, true }, - { 155672, true }, - { 155685, true }, - { 155701, true }, - { 155714, true }, - { 155734, true }, - { 155747, true }, - { 155766, true }, - { 155784, true }, - { 155794, true }, - { 155808, true }, - { 155826, true }, - { 155846, true }, - { 155878, true }, - { 155893, true }, - { 155912, true }, - { 155925, true }, - { 155940, true }, - { 155955, true }, - { 155976, true }, - { 155997, true }, - { 156011, true }, - { 156033, true }, - { 156049, true }, - { 156074, true }, - { 156086, true }, - { 156097, true }, - { 156114, true }, - { 156138, true }, - { 156152, true }, - { 156165, true }, - { 156178, true }, - { 156190, true }, - { 156203, true }, - { 156221, true }, - { 156238, true }, - { 156263, true }, - { 156276, true }, - { 156288, true }, - { 156302, true }, - { 156316, true }, - { 156333, true }, - { 156353, true }, - { 156369, true }, - { 156387, true }, - { 156398, true }, - { 156413, true }, - { 156426, true }, - { 156441, true }, - { 156449, false }, - { 156462, true }, - { 156474, true }, - { 156488, true }, - { 156497, true }, - { 156513, true }, - { 156529, true }, - { 156551, true }, - { 156565, true }, - { 156575, true }, - { 156589, true }, - { 156597, true }, - { 156609, true }, - { 156620, true }, - { 156636, true }, - { 156646, true }, - { 156659, true }, - { 156672, true }, - { 156686, true }, - { 156702, true }, - { 156715, true }, - { 156729, true }, - { 156746, true }, - { 156757, true }, - { 156767, true }, - { 156787, true }, - { 156799, true }, - { 156813, true }, - { 156828, true }, - { 156840, true }, - { 156849, true }, - { 156857, true }, - { 156869, true }, - { 156880, true }, - { 156901, true }, - { 156920, true }, - { 156938, true }, - { 156956, true }, - { 156976, true }, - { 156985, true }, - { 156999, true }, - { 157017, true }, - { 157030, true }, - { 157044, true }, - { 157063, true }, - { 157076, true }, - { 157088, true }, - { 157100, true }, - { 157111, true }, - { 157125, true }, - { 157139, false }, - { 157154, true }, - { 157171, true }, - { 157182, true }, - { 157193, true }, - { 157207, true }, - { 157228, true }, - { 157244, true }, - { 157263, true }, - { 157279, true }, - { 157297, true }, - { 157313, true }, - { 157336, true }, - { 157352, true }, - { 157364, true }, - { 157373, true }, - { 157386, true }, - { 157404, true }, - { 157419, true }, - { 157434, true }, - { 157450, true }, - { 157465, true }, - { 157480, true }, - { 157495, true }, - { 157511, true }, - { 157526, true }, - { 157541, true }, - { 157557, true }, - { 157574, true }, - { 157584, true }, - { 157597, true }, - { 157610, true }, - { 157620, true }, - { 157641, true }, - { 157653, false }, - { 157664, true }, - { 157678, true }, - { 157690, true }, - { 157699, true }, - { 157714, false }, - { 157733, true }, - { 157750, true }, - { 157763, true }, - { 157778, true }, - { 157794, false }, - { 157807, false }, - { 157817, true }, - { 157830, true }, - { 157840, true }, - { 157850, false }, - { 157859, false }, - { 157879, true }, - { 157892, true }, - { 157904, false }, - { 157916, true }, - { 157933, true }, - { 157947, true }, - { 157964, true }, - { 157980, true }, - { 157999, true }, - { 158015, false }, - { 158032, true }, - { 158046, true }, - { 158060, true }, - { 158081, true }, - { 158095, true }, - { 158111, true }, - { 158124, false }, - { 158138, true }, - { 158152, true }, - { 158171, true }, - { 158193, true }, - { 158208, true }, - { 158225, true }, - { 158233, true }, - { 158245, true }, - { 158258, true }, - { 158271, true }, - { 158284, false }, - { 158295, true }, - { 158306, true }, - { 158324, true }, - { 158343, true }, - { 158359, true }, - { 158375, true }, - { 158384, true }, - { 158393, false }, - { 158407, true }, - { 158425, true }, - { 158443, true }, - { 158460, true }, - { 158472, true }, - { 158483, false }, - { 158499, false }, - { 158523, true }, - { 158537, true }, - { 158556, true }, - { 158601, true }, - { 158646, true }, - { 158660, true }, - { 158668, true }, - { 158677, true }, - { 158689, true }, - { 158701, true }, - { 158726, true }, - { 158743, true }, - { 158760, true }, - { 158775, true }, - { 158787, true }, - { 158800, true }, - { 158808, true }, - { 158826, true }, - { 158835, false }, - { 158843, true }, - { 158864, true }, - { 158877, true }, - { 158890, true }, - { 158902, true }, - { 158915, false }, - { 158928, true }, - { 158944, true }, - { 158958, true }, - { 158976, true }, - { 158997, true }, - { 159009, true }, - { 159030, true }, - { 159049, true }, - { 159074, true }, - { 159086, true }, - { 159099, true }, - { 159112, true }, - { 159124, true }, - { 159136, true }, - { 159153, true }, - { 159170, true }, - { 159182, false }, - { 159191, true }, - { 159206, true }, - { 159228, true }, - { 159247, true }, - { 159261, true }, - { 159274, true }, - { 159296, true }, - { 159311, true }, - { 159326, true }, - { 159337, true }, - { 159362, true }, - { 159379, true }, - { 159391, true }, - { 159407, false }, - { 159422, true }, - { 159435, false }, - { 159459, true }, - { 159467, false }, - { 159480, true }, - { 159494, true }, - { 159506, true }, - { 159519, true }, - { 159532, true }, - { 159544, true }, - { 159560, true }, - { 159575, true }, - { 159594, true }, - { 159608, true }, - { 159622, true }, - { 159642, true }, - { 159658, true }, - { 159677, true }, - { 159697, true }, - { 159709, true }, - { 159732, true }, - { 159762, true }, - { 159774, true }, - { 159785, true }, - { 159795, true }, - { 159809, true }, - { 159822, true }, - { 159840, false }, - { 159850, true }, - { 159864, true }, - { 159879, true }, - { 159897, true }, - { 159906, true }, - { 159919, false }, - { 159936, true }, + { 154386, true }, + { 154401, true }, + { 154413, true }, + { 154429, true }, + { 154450, true }, + { 154467, false }, + { 154480, true }, + { 154492, true }, + { 154505, true }, + { 154516, true }, + { 154533, true }, + { 154544, true }, + { 154563, true }, + { 154581, false }, + { 154593, true }, + { 154603, true }, + { 154639, true }, + { 154652, true }, + { 154666, true }, + { 154675, true }, + { 154685, true }, + { 154697, true }, + { 154715, true }, + { 154729, true }, + { 154747, true }, + { 154768, true }, + { 154788, true }, + { 154811, true }, + { 154827, true }, + { 154841, true }, + { 154857, true }, + { 154870, true }, + { 154891, true }, + { 154911, true }, + { 154924, true }, + { 154933, true }, + { 154967, true }, + { 154988, true }, + { 155005, true }, + { 155016, true }, + { 155027, true }, + { 155039, true }, + { 155050, true }, + { 155069, true }, + { 155081, true }, + { 155094, true }, + { 155110, true }, + { 155129, true }, + { 155144, true }, + { 155158, true }, + { 155173, true }, + { 155190, false }, + { 155205, true }, + { 155225, true }, + { 155236, true }, + { 155247, true }, + { 155267, false }, + { 155276, true }, + { 155285, true }, + { 155296, true }, + { 155308, true }, + { 155322, true }, + { 155340, true }, + { 155354, true }, + { 155366, true }, + { 155381, true }, + { 155394, true }, + { 155405, false }, + { 155422, true }, + { 155432, true }, + { 155453, true }, + { 155481, false }, + { 155492, true }, + { 155499, true }, + { 155510, true }, + { 155520, true }, + { 155530, true }, + { 155544, true }, + { 155558, true }, + { 155569, false }, + { 155580, true }, + { 155588, false }, + { 155608, true }, + { 155623, true }, + { 155636, true }, + { 155652, true }, + { 155667, true }, + { 155680, true }, + { 155696, true }, + { 155709, true }, + { 155729, true }, + { 155742, true }, + { 155761, true }, + { 155779, true }, + { 155789, true }, + { 155803, true }, + { 155821, true }, + { 155841, true }, + { 155873, true }, + { 155888, true }, + { 155907, true }, + { 155920, true }, + { 155935, true }, + { 155950, true }, + { 155971, true }, + { 155992, true }, + { 156006, true }, + { 156028, true }, + { 156044, true }, + { 156069, true }, + { 156081, true }, + { 156092, true }, + { 156109, true }, + { 156133, true }, + { 156147, true }, + { 156160, true }, + { 156173, true }, + { 156185, true }, + { 156198, true }, + { 156216, true }, + { 156233, true }, + { 156258, true }, + { 156271, true }, + { 156283, true }, + { 156297, true }, + { 156311, true }, + { 156328, true }, + { 156348, true }, + { 156364, true }, + { 156382, true }, + { 156393, true }, + { 156408, true }, + { 156421, true }, + { 156436, true }, + { 156444, false }, + { 156457, true }, + { 156469, true }, + { 156483, true }, + { 156492, true }, + { 156508, true }, + { 156524, true }, + { 156546, true }, + { 156560, true }, + { 156570, true }, + { 156584, true }, + { 156592, true }, + { 156604, true }, + { 156615, true }, + { 156631, true }, + { 156641, true }, + { 156654, true }, + { 156667, true }, + { 156681, true }, + { 156697, true }, + { 156710, true }, + { 156724, true }, + { 156741, true }, + { 156752, true }, + { 156762, true }, + { 156782, true }, + { 156794, true }, + { 156808, true }, + { 156823, true }, + { 156835, true }, + { 156844, true }, + { 156852, true }, + { 156864, true }, + { 156875, true }, + { 156896, true }, + { 156915, true }, + { 156933, true }, + { 156951, true }, + { 156971, true }, + { 156980, true }, + { 156994, true }, + { 157012, true }, + { 157025, true }, + { 157039, true }, + { 157058, true }, + { 157071, true }, + { 157083, true }, + { 157095, true }, + { 157106, true }, + { 157120, true }, + { 157134, false }, + { 157149, true }, + { 157166, true }, + { 157177, true }, + { 157188, true }, + { 157202, true }, + { 157223, true }, + { 157239, true }, + { 157258, true }, + { 157274, true }, + { 157292, true }, + { 157308, true }, + { 157331, true }, + { 157347, true }, + { 157359, true }, + { 157368, true }, + { 157381, true }, + { 157399, true }, + { 157414, true }, + { 157429, true }, + { 157445, true }, + { 157460, true }, + { 157475, true }, + { 157490, true }, + { 157506, true }, + { 157521, true }, + { 157536, true }, + { 157552, true }, + { 157569, true }, + { 157579, true }, + { 157592, true }, + { 157605, true }, + { 157615, true }, + { 157636, true }, + { 157648, false }, + { 157659, true }, + { 157673, true }, + { 157685, true }, + { 157694, true }, + { 157709, false }, + { 157728, true }, + { 157745, true }, + { 157758, true }, + { 157773, true }, + { 157789, false }, + { 157802, false }, + { 157812, true }, + { 157825, true }, + { 157835, true }, + { 157845, false }, + { 157854, false }, + { 157874, true }, + { 157887, true }, + { 157899, false }, + { 157911, true }, + { 157928, true }, + { 157942, true }, + { 157959, true }, + { 157975, true }, + { 157994, true }, + { 158010, false }, + { 158027, true }, + { 158041, true }, + { 158055, true }, + { 158076, true }, + { 158090, true }, + { 158106, true }, + { 158119, false }, + { 158133, true }, + { 158147, true }, + { 158166, true }, + { 158188, true }, + { 158203, true }, + { 158220, true }, + { 158228, true }, + { 158240, true }, + { 158253, true }, + { 158266, true }, + { 158279, false }, + { 158290, true }, + { 158301, true }, + { 158319, true }, + { 158338, true }, + { 158354, true }, + { 158370, true }, + { 158379, true }, + { 158388, false }, + { 158402, true }, + { 158420, true }, + { 158438, true }, + { 158455, true }, + { 158467, true }, + { 158478, false }, + { 158494, false }, + { 158518, true }, + { 158532, true }, + { 158551, true }, + { 158596, true }, + { 158641, true }, + { 158655, true }, + { 158663, true }, + { 158672, true }, + { 158684, true }, + { 158696, true }, + { 158721, true }, + { 158738, true }, + { 158755, true }, + { 158770, true }, + { 158782, true }, + { 158795, true }, + { 158803, true }, + { 158821, true }, + { 158830, false }, + { 158838, true }, + { 158859, true }, + { 158872, true }, + { 158885, true }, + { 158897, true }, + { 158910, false }, + { 158923, true }, + { 158939, true }, + { 158953, true }, + { 158971, true }, + { 158992, true }, + { 159004, true }, + { 159025, true }, + { 159044, true }, + { 159069, true }, + { 159081, true }, + { 159094, true }, + { 159107, true }, + { 159119, true }, + { 159131, true }, + { 159148, true }, + { 159165, true }, + { 159177, false }, + { 159186, true }, + { 159201, true }, + { 159223, true }, + { 159242, true }, + { 159256, true }, + { 159269, true }, + { 159291, true }, + { 159306, true }, + { 159321, true }, + { 159332, true }, + { 159357, true }, + { 159374, true }, + { 159386, true }, + { 159402, false }, + { 159417, true }, + { 159430, false }, + { 159454, true }, + { 159462, false }, + { 159475, true }, + { 159489, true }, + { 159501, true }, + { 159514, true }, + { 159526, true }, + { 159542, true }, + { 159557, true }, + { 159576, true }, + { 159590, true }, + { 159604, true }, + { 159624, true }, + { 159640, true }, + { 159659, true }, + { 159679, true }, + { 159691, true }, + { 159714, true }, + { 159744, true }, + { 159756, true }, + { 159767, true }, + { 159777, true }, + { 159791, true }, + { 159804, true }, + { 159822, false }, + { 159832, true }, + { 159847, true }, + { 159865, true }, + { 159874, true }, + { 159887, false }, + { 159904, true }, + { 159920, true }, + { 159931, true }, + { 159942, true }, { 159952, true }, - { 159963, true }, - { 159974, true }, - { 159984, true }, - { 159993, true }, + { 159961, true }, + { 159975, true }, + { 159996, true }, { 160007, true }, - { 160028, true }, - { 160039, true }, - { 160061, true }, + { 160029, true }, + { 160044, true }, + { 160059, true }, { 160076, true }, - { 160091, true }, + { 160098, true }, { 160108, true }, { 160130, true }, - { 160140, true }, - { 160162, true }, - { 160184, true }, - { 160201, true }, - { 160215, true }, - { 160228, true }, - { 160245, true }, - { 160270, true }, - { 160287, true }, - { 160303, true }, - { 160313, true }, - { 160324, true }, - { 160333, false }, - { 160342, true }, + { 160152, true }, + { 160169, true }, + { 160183, true }, + { 160196, true }, + { 160213, true }, + { 160238, true }, + { 160255, true }, + { 160271, true }, + { 160281, true }, + { 160292, true }, + { 160301, false }, + { 160310, true }, + { 160320, true }, + { 160334, true }, { 160352, true }, - { 160366, true }, - { 160384, true }, - { 160404, true }, - { 160418, true }, - { 160427, true }, - { 160451, true }, - { 160472, true }, - { 160492, true }, - { 160510, true }, - { 160523, true }, - { 160540, true }, - { 160561, true }, - { 160579, true }, - { 160591, true }, - { 160613, false }, - { 160632, true }, - { 160643, true }, + { 160372, true }, + { 160386, true }, + { 160395, true }, + { 160419, true }, + { 160440, true }, + { 160460, true }, + { 160478, true }, + { 160491, true }, + { 160508, true }, + { 160529, true }, + { 160547, true }, + { 160559, true }, + { 160581, false }, + { 160600, true }, + { 160611, true }, + { 160624, true }, + { 160645, true }, { 160656, true }, - { 160677, true }, - { 160688, true }, - { 160703, true }, - { 160715, true }, - { 160732, true }, - { 160758, true }, - { 160775, false }, - { 160793, true }, - { 160812, false }, + { 160671, true }, + { 160683, true }, + { 160700, true }, + { 160726, true }, + { 160743, false }, + { 160761, true }, + { 160780, false }, + { 160799, true }, + { 160811, true }, { 160831, true }, - { 160843, true }, - { 160863, true }, - { 160885, true }, - { 160898, true }, - { 160920, true }, - { 160933, true }, - { 160956, true }, - { 160971, true }, - { 160994, true }, - { 161004, true }, - { 161014, true }, - { 161033, true }, - { 161046, true }, - { 161068, true }, - { 161088, true }, - { 161098, true }, - { 161110, true }, - { 161123, true }, - { 161136, true }, - { 161157, true }, - { 161183, true }, - { 161204, true }, - { 161225, true }, - { 161246, true }, - { 161266, true }, - { 161278, true }, - { 161298, true }, - { 161312, true }, - { 161324, true }, - { 161333, true }, - { 161356, true }, - { 161372, true }, - { 161384, true }, - { 161409, true }, - { 161424, true }, - { 161445, true }, - { 161462, true }, - { 161483, false }, - { 161500, false }, - { 161518, true }, - { 161528, true }, - { 161542, true }, - { 161556, true }, - { 161566, true }, - { 161578, true }, - { 161590, true }, - { 161600, true }, - { 161611, true }, - { 161625, true }, - { 161649, true }, - { 161661, true }, - { 161690, true }, - { 161705, true }, - { 161719, true }, - { 161733, true }, - { 161749, true }, - { 161764, true }, - { 161778, true }, - { 161790, true }, - { 161810, true }, - { 161824, true }, - { 161837, true }, - { 161849, true }, + { 160853, true }, + { 160866, true }, + { 160888, true }, + { 160901, true }, + { 160924, true }, + { 160939, true }, + { 160953, true }, + { 160976, true }, + { 160986, true }, + { 160996, true }, + { 161015, true }, + { 161028, true }, + { 161050, true }, + { 161070, true }, + { 161080, true }, + { 161092, true }, + { 161105, true }, + { 161118, true }, + { 161139, true }, + { 161165, true }, + { 161186, true }, + { 161207, true }, + { 161228, true }, + { 161248, true }, + { 161260, true }, + { 161280, true }, + { 161294, true }, + { 161306, true }, + { 161315, true }, + { 161338, true }, + { 161354, true }, + { 161366, true }, + { 161391, true }, + { 161406, true }, + { 161427, true }, + { 161444, true }, + { 161465, false }, + { 161482, false }, + { 161500, true }, + { 161510, true }, + { 161524, true }, + { 161538, true }, + { 161548, true }, + { 161560, true }, + { 161572, true }, + { 161582, true }, + { 161593, true }, + { 161607, true }, + { 161631, true }, + { 161643, true }, + { 161672, true }, + { 161687, true }, + { 161701, true }, + { 161715, true }, + { 161731, true }, + { 161746, true }, + { 161760, true }, + { 161772, true }, + { 161792, true }, + { 161806, true }, + { 161819, true }, + { 161832, true }, + { 161844, true }, { 161862, true }, { 161874, true }, - { 161892, true }, - { 161904, true }, - { 161923, true }, - { 161947, true }, + { 161893, true }, + { 161917, true }, + { 161940, true }, + { 161952, true }, { 161970, true }, - { 161982, true }, - { 162000, true }, - { 162016, true }, - { 162036, true }, - { 162054, true }, - { 162074, true }, - { 162087, true }, - { 162107, true }, - { 162115, true }, - { 162125, true }, - { 162144, true }, - { 162163, true }, - { 162177, true }, - { 162195, true }, - { 162211, false }, - { 162230, true }, - { 162251, true }, - { 162265, true }, - { 162274, true }, - { 162292, true }, - { 162309, true }, - { 162325, true }, - { 162347, true }, - { 162364, true }, - { 162382, true }, + { 161986, true }, + { 162006, false }, + { 162024, true }, + { 162044, true }, + { 162057, true }, + { 162077, true }, + { 162085, true }, + { 162095, true }, + { 162114, true }, + { 162133, true }, + { 162147, true }, + { 162165, true }, + { 162181, false }, + { 162200, true }, + { 162221, true }, + { 162235, true }, + { 162244, true }, + { 162262, true }, + { 162279, true }, + { 162295, true }, + { 162317, true }, + { 162334, true }, + { 162352, true }, + { 162371, true }, + { 162388, true }, { 162401, true }, - { 162418, true }, - { 162431, true }, - { 162441, true }, - { 162449, true }, - { 162467, true }, - { 162495, true }, - { 162512, true }, - { 162526, true }, - { 162541, false }, - { 162554, true }, - { 162566, false }, - { 162576, false }, - { 162589, false }, - { 162604, true }, - { 162616, true }, - { 162628, true }, - { 162640, true }, - { 162652, true }, - { 162665, true }, - { 162678, true }, - { 162690, true }, - { 162702, true }, - { 162718, true }, - { 162730, true }, - { 162743, true }, - { 162753, true }, - { 162763, true }, - { 162776, true }, - { 162791, true }, - { 162802, true }, - { 162813, true }, - { 162831, true }, - { 162839, true }, - { 162847, true }, - { 162859, true }, - { 162873, true }, + { 162411, true }, + { 162419, true }, + { 162437, true }, + { 162465, true }, + { 162482, true }, + { 162496, true }, + { 162511, false }, + { 162524, true }, + { 162536, false }, + { 162546, false }, + { 162559, false }, + { 162574, true }, + { 162586, true }, + { 162598, true }, + { 162610, true }, + { 162622, true }, + { 162635, true }, + { 162648, true }, + { 162660, true }, + { 162672, true }, + { 162688, true }, + { 162700, true }, + { 162713, true }, + { 162723, true }, + { 162733, true }, + { 162746, true }, + { 162761, true }, + { 162772, true }, + { 162783, true }, + { 162801, true }, + { 162809, true }, + { 162817, true }, + { 162829, true }, + { 162843, true }, + { 162860, true }, { 162890, true }, - { 162920, true }, - { 162935, true }, + { 162905, true }, + { 162921, true }, + { 162936, true }, { 162951, true }, { 162966, true }, - { 162981, true }, - { 162996, true }, - { 163004, true }, - { 163019, true }, - { 163030, true }, - { 163043, true }, - { 163051, false }, - { 163061, true }, - { 163077, true }, - { 163094, true }, - { 163111, true }, - { 163132, true }, - { 163145, true }, - { 163157, true }, - { 163165, true }, - { 163182, true }, - { 163198, true }, - { 163205, true }, - { 163216, true }, - { 163224, false }, - { 163248, true }, - { 163280, true }, - { 163307, true }, - { 163327, true }, + { 162974, true }, + { 162989, true }, + { 163000, true }, + { 163013, true }, + { 163021, false }, + { 163031, true }, + { 163047, true }, + { 163064, true }, + { 163081, true }, + { 163102, true }, + { 163115, true }, + { 163127, true }, + { 163135, true }, + { 163152, true }, + { 163168, true }, + { 163175, true }, + { 163186, true }, + { 163194, false }, + { 163218, true }, + { 163250, true }, + { 163277, true }, + { 163297, true }, + { 163321, true }, + { 163338, false }, { 163351, true }, - { 163368, false }, - { 163381, true }, - { 163396, true }, - { 163407, true }, - { 163418, true }, - { 163428, true }, - { 163441, true }, - { 163449, true }, - { 163461, true }, - { 163473, false }, - { 163485, false }, - { 163493, false }, - { 163518, true }, - { 163531, true }, - { 163546, true }, - { 163560, true }, - { 163573, true }, + { 163366, true }, + { 163377, true }, + { 163388, true }, + { 163398, true }, + { 163411, true }, + { 163419, true }, + { 163431, true }, + { 163443, false }, + { 163455, false }, + { 163463, false }, + { 163488, true }, + { 163501, true }, + { 163516, true }, + { 163530, true }, + { 163543, true }, + { 163555, true }, + { 163568, true }, { 163585, true }, - { 163598, true }, - { 163615, true }, - { 163629, true }, - { 163646, true }, - { 163658, true }, + { 163599, true }, + { 163616, true }, + { 163628, true }, + { 163642, true }, + { 163657, true }, { 163672, true }, - { 163687, true }, - { 163702, true }, - { 163713, true }, - { 163720, true }, - { 163740, true }, - { 163754, true }, - { 163762, true }, - { 163770, false }, - { 163785, true }, - { 163797, true }, - { 163811, true }, - { 163824, true }, + { 163683, true }, + { 163690, true }, + { 163710, true }, + { 163724, true }, + { 163732, true }, + { 163740, false }, + { 163755, true }, + { 163767, true }, + { 163781, true }, + { 163794, true }, + { 163804, true }, + { 163814, true }, + { 163821, true }, { 163834, true }, - { 163844, true }, - { 163851, true }, - { 163864, true }, - { 163877, true }, - { 163885, true }, - { 163902, true }, - { 163910, true }, - { 163919, true }, + { 163847, true }, + { 163855, true }, + { 163872, true }, + { 163880, true }, + { 163889, true }, + { 163905, true }, + { 163924, true }, { 163935, true }, - { 163954, true }, - { 163965, true }, - { 163977, true }, - { 163987, true }, - { 164004, false }, - { 164015, true }, - { 164023, true }, - { 164033, true }, - { 164042, true }, - { 164058, true }, - { 164079, true }, - { 164104, false }, - { 164120, true }, - { 164132, true }, - { 164144, true }, - { 164157, true }, - { 164165, true }, - { 164173, false }, - { 164193, false }, - { 164212, false }, - { 164231, false }, - { 164251, false }, - { 164271, false }, - { 164291, false }, - { 164310, false }, + { 163947, true }, + { 163957, true }, + { 163974, false }, + { 163985, true }, + { 163993, true }, + { 164003, true }, + { 164012, true }, + { 164028, true }, + { 164049, true }, + { 164074, false }, + { 164090, true }, + { 164102, true }, + { 164114, true }, + { 164127, true }, + { 164135, true }, + { 164143, false }, + { 164163, false }, + { 164182, false }, + { 164201, false }, + { 164221, false }, + { 164241, false }, + { 164261, false }, + { 164280, false }, + { 164299, true }, + { 164318, true }, { 164329, true }, + { 164339, true }, { 164348, true }, - { 164359, true }, - { 164369, true }, - { 164378, true }, - { 164391, true }, - { 164406, true }, - { 164416, false }, - { 164427, true }, + { 164361, true }, + { 164376, true }, + { 164386, false }, + { 164397, true }, + { 164408, true }, + { 164417, true }, + { 164425, true }, { 164438, true }, - { 164447, true }, - { 164455, true }, - { 164468, true }, - { 164476, true }, - { 164486, true }, - { 164495, true }, - { 164510, true }, + { 164446, true }, + { 164456, true }, + { 164465, true }, + { 164480, true }, + { 164503, true }, + { 164522, false }, { 164533, true }, - { 164552, false }, - { 164563, true }, + { 164555, true }, + { 164569, true }, + { 164578, true }, { 164585, true }, - { 164599, true }, - { 164608, true }, - { 164615, true }, - { 164624, true }, - { 164632, true }, - { 164639, true }, - { 164651, true }, - { 164668, true }, - { 164675, true }, - { 164683, true }, - { 164694, true }, - { 164708, true }, + { 164594, true }, + { 164602, true }, + { 164609, true }, + { 164621, true }, + { 164638, true }, + { 164645, true }, + { 164653, true }, + { 164664, true }, + { 164678, true }, + { 164690, true }, + { 164702, true }, + { 164711, true }, { 164720, true }, - { 164732, true }, - { 164741, true }, - { 164750, true }, - { 164762, false }, - { 164773, true }, - { 164786, true }, - { 164812, true }, - { 164835, false }, - { 164855, true }, - { 164872, true }, + { 164732, false }, + { 164743, true }, + { 164756, true }, + { 164782, true }, + { 164805, false }, + { 164825, true }, + { 164842, true }, + { 164857, true }, + { 164871, true }, { 164887, true }, - { 164901, true }, - { 164920, true }, - { 164936, true }, - { 164949, true }, - { 164960, true }, - { 164978, true }, - { 164993, true }, - { 165013, true }, - { 165028, true }, - { 165037, true }, - { 165055, true }, - { 165070, true }, - { 165091, true }, - { 165111, true }, - { 165126, true }, - { 165141, true }, - { 165156, true }, + { 164900, true }, + { 164911, true }, + { 164929, true }, + { 164944, true }, + { 164964, true }, + { 164979, true }, + { 164988, true }, + { 165006, true }, + { 165021, true }, + { 165042, true }, + { 165062, true }, + { 165077, true }, + { 165092, true }, + { 165107, true }, + { 165121, true }, + { 165135, true }, + { 165144, true }, + { 165155, true }, { 165170, true }, - { 165184, true }, - { 165193, true }, - { 165204, true }, - { 165219, true }, - { 165228, true }, - { 165246, true }, + { 165179, true }, + { 165197, true }, + { 165208, true }, + { 165218, true }, + { 165227, true }, + { 165238, true }, + { 165248, true }, { 165257, true }, { 165267, true }, - { 165276, true }, - { 165287, true }, - { 165297, true }, - { 165306, true }, - { 165316, true }, - { 165329, true }, - { 165340, true }, - { 165350, true }, - { 165359, true }, - { 165375, true }, - { 165382, true }, - { 165393, true }, - { 165407, true }, - { 165414, true }, - { 165425, true }, - { 165433, true }, - { 165451, true }, - { 165464, true }, - { 165476, true }, - { 165484, true }, - { 165504, false }, - { 165520, true }, - { 165539, true }, - { 165562, true }, - { 165581, true }, - { 165592, true }, - { 165614, true }, - { 165627, true }, - { 165636, true }, - { 165659, true }, - { 165693, true }, + { 165280, true }, + { 165291, true }, + { 165301, true }, + { 165310, true }, + { 165326, true }, + { 165333, true }, + { 165344, true }, + { 165355, true }, + { 165369, true }, + { 165376, true }, + { 165387, true }, + { 165395, true }, + { 165413, true }, + { 165426, true }, + { 165438, true }, + { 165446, true }, + { 165466, false }, + { 165482, true }, + { 165501, true }, + { 165524, true }, + { 165543, true }, + { 165554, true }, + { 165576, true }, + { 165589, true }, + { 165598, true }, + { 165621, true }, + { 165655, true }, + { 165671, true }, + { 165687, true }, { 165709, true }, - { 165725, true }, - { 165747, true }, - { 165760, true }, - { 165787, true }, + { 165722, true }, + { 165749, true }, + { 165763, true }, + { 165773, true }, + { 165791, true }, { 165801, true }, - { 165811, true }, - { 165829, true }, - { 165839, true }, - { 165858, true }, - { 165872, true }, - { 165886, true }, - { 165902, true }, + { 165820, true }, + { 165834, true }, + { 165848, true }, + { 165864, true }, + { 165875, true }, + { 165898, true }, { 165913, true }, - { 165924, true }, - { 165947, true }, - { 165962, true }, - { 165985, true }, - { 165994, true }, - { 166012, true }, - { 166029, true }, - { 166039, true }, - { 166064, true }, - { 166082, true }, - { 166097, true }, - { 166107, true }, - { 166119, true }, - { 166132, true }, - { 166143, false }, - { 166155, true }, - { 166172, true }, - { 166182, true }, - { 166199, true }, - { 166220, true }, - { 166242, true }, + { 165936, true }, + { 165945, true }, + { 165963, true }, + { 165980, true }, + { 165990, true }, + { 166015, true }, + { 166033, true }, + { 166048, true }, + { 166058, true }, + { 166070, true }, + { 166083, true }, + { 166094, false }, + { 166106, true }, + { 166123, true }, + { 166133, true }, + { 166150, true }, + { 166171, true }, + { 166193, true }, + { 166211, true }, + { 166222, true }, + { 166235, true }, + { 166246, true }, { 166260, true }, - { 166271, true }, + { 166273, true }, { 166284, true }, - { 166295, true }, - { 166309, true }, - { 166322, true }, + { 166294, true }, + { 166308, true }, + { 166323, true }, { 166333, true }, - { 166343, true }, - { 166357, true }, - { 166372, true }, - { 166382, true }, - { 166395, true }, - { 166404, true }, - { 166420, true }, - { 166436, false }, - { 166449, false }, - { 166462, false }, - { 166474, true }, - { 166491, true }, - { 166502, true }, - { 166517, true }, - { 166527, true }, - { 166539, true }, - { 166556, true }, - { 166570, true }, + { 166346, true }, + { 166355, true }, + { 166371, true }, + { 166387, false }, + { 166400, false }, + { 166413, false }, + { 166425, true }, + { 166442, true }, + { 166453, true }, + { 166468, true }, + { 166478, true }, + { 166490, true }, + { 166507, true }, + { 166521, true }, + { 166534, true }, + { 166552, true }, + { 166561, true }, + { 166572, true }, { 166583, true }, - { 166601, true }, - { 166610, true }, - { 166621, true }, - { 166632, true }, - { 166644, true }, + { 166595, true }, + { 166608, true }, + { 166620, true }, + { 166629, true }, + { 166640, true }, { 166657, true }, - { 166669, true }, - { 166678, true }, - { 166689, true }, - { 166706, true }, - { 166722, true }, - { 166734, true }, - { 166746, true }, - { 166758, true }, - { 166775, true }, - { 166787, true }, - { 166797, true }, - { 166810, true }, - { 166827, true }, - { 166841, true }, - { 166856, true }, - { 166868, true }, - { 166875, true }, - { 166891, true }, - { 166907, true }, - { 166916, true }, - { 166923, true }, - { 166934, true }, + { 166673, true }, + { 166685, true }, + { 166697, true }, + { 166709, true }, + { 166726, true }, + { 166738, true }, + { 166748, true }, + { 166761, true }, + { 166778, true }, + { 166792, true }, + { 166807, true }, + { 166819, true }, + { 166826, true }, + { 166842, true }, + { 166858, true }, + { 166867, true }, + { 166874, true }, + { 166885, true }, + { 166902, true }, + { 166915, true }, + { 166930, true }, + { 166940, true }, { 166951, true }, - { 166964, true }, - { 166979, true }, - { 166989, true }, + { 166974, true }, + { 166986, false }, { 167000, true }, - { 167023, true }, - { 167035, false }, - { 167049, true }, - { 167065, true }, - { 167083, true }, - { 167100, true }, - { 167111, true }, - { 167127, false }, - { 167146, true }, - { 167161, true }, - { 167180, true }, - { 167191, true }, - { 167212, true }, - { 167228, true }, - { 167240, true }, - { 167254, true }, - { 167268, true }, - { 167279, true }, - { 167300, true }, - { 167313, true }, - { 167323, true }, - { 167334, true }, - { 167351, true }, - { 167366, true }, - { 167386, true }, - { 167401, true }, - { 167420, false }, - { 167437, true }, - { 167453, true }, + { 167018, true }, + { 167035, true }, + { 167046, true }, + { 167062, false }, + { 167081, true }, + { 167096, true }, + { 167115, true }, + { 167126, true }, + { 167147, true }, + { 167163, true }, + { 167175, true }, + { 167189, true }, + { 167203, true }, + { 167214, true }, + { 167235, true }, + { 167248, true }, + { 167258, true }, + { 167269, true }, + { 167286, true }, + { 167301, true }, + { 167321, true }, + { 167336, true }, + { 167355, false }, + { 167372, true }, + { 167388, true }, + { 167400, true }, + { 167423, true }, + { 167438, true }, + { 167454, true }, { 167465, true }, - { 167488, true }, - { 167503, true }, - { 167519, true }, - { 167530, true }, - { 167538, true }, - { 167561, true }, + { 167473, true }, + { 167496, true }, + { 167508, true }, + { 167516, true }, + { 167542, true }, + { 167560, true }, { 167573, true }, - { 167581, true }, - { 167607, true }, - { 167625, true }, - { 167638, true }, - { 167655, true }, - { 167667, true }, - { 167694, true }, - { 167725, true }, - { 167736, true }, + { 167590, true }, + { 167602, true }, + { 167629, true }, + { 167660, true }, + { 167671, true }, + { 167681, true }, + { 167696, true }, + { 167707, true }, + { 167718, true }, + { 167734, true }, { 167746, true }, - { 167761, true }, - { 167772, true }, - { 167783, true }, - { 167799, true }, - { 167811, true }, - { 167820, true }, - { 167833, true }, - { 167861, true }, - { 167882, true }, - { 167896, true }, - { 167918, true }, - { 167935, true }, - { 167945, true }, - { 167957, true }, - { 167973, true }, - { 167987, true }, - { 167998, true }, - { 168012, true }, - { 168030, true }, - { 168047, true }, - { 168067, true }, - { 168078, true }, - { 168089, false }, - { 168096, true }, + { 167755, true }, + { 167768, true }, + { 167796, true }, + { 167817, true }, + { 167831, true }, + { 167853, true }, + { 167870, true }, + { 167880, true }, + { 167892, true }, + { 167908, true }, + { 167922, true }, + { 167933, true }, + { 167947, true }, + { 167965, true }, + { 167982, true }, + { 168002, true }, + { 168013, true }, + { 168024, false }, + { 168031, true }, + { 168041, true }, + { 168068, true }, + { 168088, true }, { 168106, true }, - { 168133, true }, - { 168153, true }, - { 168171, true }, - { 168186, false }, - { 168197, true }, - { 168213, true }, - { 168230, true }, - { 168247, true }, - { 168269, true }, - { 168283, true }, - { 168299, false }, + { 168121, false }, + { 168132, true }, + { 168148, true }, + { 168165, true }, + { 168182, true }, + { 168204, true }, + { 168218, true }, + { 168234, false }, + { 168251, true }, + { 168267, true }, + { 168277, true }, + { 168295, true }, { 168316, true }, - { 168332, true }, - { 168342, true }, - { 168360, true }, - { 168381, true }, - { 168399, true }, - { 168406, true }, - { 168424, true }, - { 168442, true }, - { 168456, true }, - { 168466, true }, - { 168477, true }, - { 168499, true }, - { 168515, true }, - { 168532, true }, - { 168552, true }, - { 168563, true }, - { 168582, true }, - { 168596, true }, - { 168613, true }, - { 168625, true }, - { 168642, true }, - { 168663, true }, - { 168679, true }, - { 168691, true }, - { 168714, true }, - { 168732, true }, - { 168743, true }, - { 168753, true }, - { 168769, true }, - { 168780, true }, - { 168792, false }, - { 168812, true }, - { 168831, true }, - { 168844, true }, - { 168854, true }, - { 168871, true }, - { 168891, true }, - { 168905, true }, - { 168920, true }, - { 168934, true }, - { 168948, true }, - { 168966, true }, - { 168980, true }, - { 168995, true }, - { 169016, true }, - { 169027, true }, - { 169041, true }, - { 169057, false }, - { 169071, true }, - { 169087, true }, - { 169104, true }, - { 169120, true }, - { 169140, true }, - { 169163, true }, - { 169172, false }, - { 169180, true }, - { 169190, true }, - { 169202, false }, - { 169224, true }, - { 169239, true }, - { 169253, true }, - { 169267, true }, - { 169280, true }, - { 169308, true }, - { 169320, true }, - { 169335, true }, - { 169360, true }, - { 169374, true }, - { 169395, true }, + { 168334, true }, + { 168341, true }, + { 168359, true }, + { 168377, true }, + { 168391, true }, + { 168401, true }, + { 168412, true }, + { 168434, true }, + { 168450, true }, + { 168467, true }, + { 168487, true }, + { 168498, true }, + { 168517, true }, + { 168531, true }, + { 168548, true }, + { 168560, true }, + { 168577, true }, + { 168598, true }, + { 168614, true }, + { 168626, true }, + { 168649, true }, + { 168667, true }, + { 168678, true }, + { 168688, true }, + { 168704, true }, + { 168715, true }, + { 168727, false }, + { 168747, true }, + { 168766, true }, + { 168779, true }, + { 168789, true }, + { 168806, true }, + { 168826, true }, + { 168840, true }, + { 168855, true }, + { 168869, true }, + { 168883, true }, + { 168901, true }, + { 168915, true }, + { 168930, true }, + { 168951, true }, + { 168962, true }, + { 168976, true }, + { 168992, false }, + { 169006, true }, + { 169022, true }, + { 169039, true }, + { 169055, true }, + { 169075, true }, + { 169098, true }, + { 169107, false }, + { 169115, true }, + { 169125, true }, + { 169137, false }, + { 169159, true }, + { 169174, true }, + { 169188, true }, + { 169202, true }, + { 169215, true }, + { 169243, true }, + { 169255, true }, + { 169270, true }, + { 169295, true }, + { 169309, true }, + { 169330, true }, + { 169341, true }, + { 169351, true }, + { 169359, true }, + { 169371, true }, + { 169396, true }, { 169406, true }, - { 169416, true }, - { 169424, true }, - { 169436, true }, - { 169461, true }, - { 169471, true }, - { 169496, true }, - { 169506, true }, - { 169519, false }, - { 169544, true }, - { 169558, true }, - { 169575, true }, - { 169588, true }, - { 169599, true }, - { 169607, true }, - { 169616, true }, - { 169630, true }, - { 169643, true }, - { 169659, true }, - { 169669, true }, - { 169680, true }, - { 169691, true }, - { 169707, true }, - { 169717, false }, - { 169729, true }, - { 169741, true }, - { 169756, true }, - { 169774, true }, - { 169786, true }, - { 169796, true }, - { 169812, true }, - { 169836, true }, - { 169849, true }, - { 169856, true }, + { 169431, true }, + { 169441, true }, + { 169454, true }, + { 169468, true }, + { 169485, true }, + { 169498, true }, + { 169509, true }, + { 169517, true }, + { 169526, true }, + { 169540, true }, + { 169553, true }, + { 169569, true }, + { 169579, true }, + { 169590, true }, + { 169601, true }, + { 169617, true }, + { 169627, false }, + { 169639, true }, + { 169651, true }, + { 169666, true }, + { 169684, true }, + { 169696, true }, + { 169706, true }, + { 169722, true }, + { 169746, true }, + { 169759, true }, + { 169766, true }, + { 169773, true }, + { 169790, true }, + { 169804, true }, + { 169816, true }, + { 169828, true }, + { 169840, true }, + { 169854, true }, { 169863, true }, - { 169880, true }, - { 169894, true }, - { 169906, true }, - { 169918, true }, - { 169930, true }, - { 169944, true }, - { 169953, true }, - { 169974, true }, - { 169987, true }, - { 169998, true }, - { 170015, true }, - { 170030, true }, - { 170055, true }, - { 170081, true }, - { 170096, true }, - { 170107, true }, - { 170116, true }, - { 170138, true }, - { 170147, true }, - { 170162, true }, - { 170172, true }, - { 170188, true }, - { 170201, true }, + { 169884, true }, + { 169897, true }, + { 169908, true }, + { 169925, true }, + { 169940, true }, + { 169965, true }, + { 169991, true }, + { 170006, true }, + { 170017, true }, + { 170026, true }, + { 170048, true }, + { 170057, true }, + { 170072, true }, + { 170082, true }, + { 170098, true }, + { 170111, true }, + { 170128, true }, + { 170149, true }, + { 170170, true }, + { 170187, true }, + { 170206, true }, { 170218, true }, - { 170239, true }, - { 170260, true }, - { 170277, true }, - { 170296, true }, - { 170308, true }, - { 170323, true }, - { 170339, true }, - { 170353, true }, - { 170365, true }, - { 170379, true }, - { 170391, true }, - { 170410, true }, - { 170426, true }, - { 170442, true }, - { 170458, true }, - { 170476, true }, - { 170486, true }, - { 170503, true }, - { 170520, true }, - { 170538, true }, - { 170553, true }, - { 170567, true }, - { 170585, true }, - { 170602, true }, + { 170233, true }, + { 170249, true }, + { 170263, true }, + { 170275, true }, + { 170289, true }, + { 170301, true }, + { 170320, true }, + { 170336, true }, + { 170352, true }, + { 170368, true }, + { 170386, true }, + { 170396, true }, + { 170413, true }, + { 170430, true }, + { 170448, true }, + { 170463, true }, + { 170477, true }, + { 170495, true }, + { 170512, true }, + { 170525, true }, + { 170544, true }, + { 170564, true }, + { 170581, true }, + { 170597, true }, { 170615, true }, - { 170634, true }, - { 170654, true }, - { 170671, true }, + { 170632, false }, + { 170649, false }, + { 170670, true }, { 170687, true }, - { 170705, true }, - { 170722, false }, - { 170739, false }, - { 170760, true }, - { 170777, true }, - { 170787, true }, - { 170806, true }, - { 170820, true }, - { 170833, true }, - { 170844, true }, - { 170859, true }, - { 170872, true }, - { 170883, true }, - { 170901, true }, - { 170913, true }, - { 170926, true }, - { 170950, true }, - { 170959, true }, - { 170986, true }, - { 171004, true }, - { 171014, true }, - { 171023, true }, - { 171033, true }, - { 171044, true }, - { 171067, true }, - { 171077, true }, - { 171090, true }, - { 171098, true }, - { 171105, true }, - { 171124, true }, - { 171131, true }, - { 171146, true }, - { 171155, true }, - { 171167, false }, - { 171187, true }, - { 171201, true }, - { 171211, true }, - { 171228, true }, - { 171246, true }, + { 170697, true }, + { 170716, true }, + { 170730, true }, + { 170743, true }, + { 170754, true }, + { 170769, true }, + { 170782, true }, + { 170793, true }, + { 170811, true }, + { 170823, true }, + { 170836, true }, + { 170860, true }, + { 170869, true }, + { 170893, true }, + { 170920, true }, + { 170938, true }, + { 170948, true }, + { 170957, true }, + { 170967, true }, + { 170978, true }, + { 171001, true }, + { 171011, true }, + { 171024, true }, + { 171032, true }, + { 171039, true }, + { 171058, true }, + { 171065, true }, + { 171080, true }, + { 171089, true }, + { 171101, false }, + { 171121, true }, + { 171135, true }, + { 171145, true }, + { 171162, true }, + { 171180, true }, + { 171197, true }, + { 171219, false }, + { 171232, true }, + { 171251, true }, { 171263, true }, - { 171285, false }, - { 171298, true }, - { 171317, true }, - { 171329, true }, - { 171340, true }, - { 171353, true }, - { 171372, true }, - { 171387, true }, - { 171403, true }, - { 171426, true }, - { 171446, true }, - { 171459, true }, - { 171473, true }, - { 171487, true }, - { 171498, true }, - { 171509, true }, - { 171519, true }, - { 171538, true }, - { 171550, true }, - { 171567, true }, - { 171579, true }, - { 171596, true }, + { 171274, true }, + { 171287, true }, + { 171306, true }, + { 171321, true }, + { 171337, true }, + { 171360, true }, + { 171380, true }, + { 171393, true }, + { 171407, true }, + { 171421, true }, + { 171432, true }, + { 171443, true }, + { 171453, true }, + { 171472, true }, + { 171484, true }, + { 171501, true }, + { 171513, true }, + { 171530, true }, + { 171541, true }, + { 171565, true }, + { 171575, true }, + { 171587, true }, + { 171597, true }, { 171607, true }, - { 171631, true }, - { 171641, true }, - { 171653, true }, - { 171663, true }, - { 171673, true }, - { 171689, true }, - { 171705, true }, - { 171736, true }, - { 171745, true }, - { 171762, true }, - { 171779, true }, - { 171791, true }, - { 171810, true }, - { 171827, true }, - { 171840, true }, - { 171853, true }, - { 171863, true }, - { 171877, true }, - { 171891, true }, - { 171900, true }, + { 171623, true }, + { 171639, true }, + { 171670, true }, + { 171679, true }, + { 171693, true }, + { 171710, true }, + { 171722, true }, + { 171741, true }, + { 171758, true }, + { 171771, true }, + { 171784, true }, + { 171794, true }, + { 171808, true }, + { 171822, true }, + { 171831, true }, + { 171841, true }, + { 171856, true }, + { 171866, true }, + { 171880, true }, + { 171897, true }, { 171910, true }, - { 171925, true }, - { 171935, true }, - { 171949, true }, - { 171966, true }, - { 171979, true }, - { 171989, true }, - { 172007, true }, - { 172024, true }, + { 171920, true }, + { 171938, true }, + { 171955, true }, + { 171971, true }, + { 171988, true }, + { 172010, true }, + { 172022, true }, { 172040, true }, - { 172057, true }, - { 172079, true }, - { 172091, true }, - { 172109, true }, - { 172123, false }, - { 172138, true }, - { 172151, true }, + { 172054, false }, + { 172069, true }, + { 172082, true }, + { 172094, true }, + { 172101, true }, + { 172113, true }, + { 172123, true }, + { 172135, true }, + { 172146, true }, { 172163, true }, - { 172170, true }, - { 172182, true }, - { 172192, true }, - { 172204, true }, - { 172215, true }, - { 172232, true }, + { 172175, true }, + { 172194, true }, + { 172220, true }, + { 172229, true }, { 172244, true }, - { 172263, true }, + { 172258, true }, + { 172274, true }, { 172289, true }, - { 172298, true }, - { 172313, true }, - { 172327, true }, - { 172343, true }, - { 172358, true }, - { 172380, true }, - { 172405, true }, - { 172421, true }, - { 172439, true }, - { 172453, true }, - { 172463, true }, - { 172473, true }, - { 172484, true }, - { 172499, true }, - { 172509, true }, - { 172521, true }, + { 172311, true }, + { 172336, true }, + { 172352, true }, + { 172370, true }, + { 172384, true }, + { 172394, true }, + { 172404, true }, + { 172415, true }, + { 172430, true }, + { 172440, true }, + { 172452, true }, + { 172470, true }, + { 172486, true }, + { 172501, true }, + { 172516, false }, { 172539, true }, { 172555, true }, - { 172570, true }, - { 172585, false }, - { 172608, true }, - { 172624, true }, - { 172637, true }, - { 172648, true }, - { 172658, true }, - { 172675, true }, - { 172695, true }, - { 172707, true }, - { 172738, true }, - { 172759, true }, - { 172772, true }, - { 172797, true }, - { 172818, true }, - { 172829, true }, - { 172846, true }, - { 172858, true }, - { 172871, true }, - { 172891, true }, - { 172899, true }, - { 172910, true }, - { 172919, true }, - { 172928, true }, - { 172935, true }, - { 172943, true }, - { 172957, true }, - { 172969, false }, - { 172976, true }, - { 172984, false }, - { 172993, true }, - { 173002, true }, - { 173013, true }, - { 173020, true }, - { 173037, true }, + { 172568, true }, + { 172579, true }, + { 172589, true }, + { 172606, true }, + { 172626, true }, + { 172638, true }, + { 172669, true }, + { 172690, true }, + { 172703, true }, + { 172728, true }, + { 172749, true }, + { 172760, true }, + { 172777, true }, + { 172789, true }, + { 172802, true }, + { 172822, true }, + { 172830, true }, + { 172841, true }, + { 172850, true }, + { 172859, true }, + { 172866, true }, + { 172874, true }, + { 172888, true }, + { 172900, false }, + { 172907, true }, + { 172915, false }, + { 172924, true }, + { 172933, true }, + { 172944, true }, + { 172951, true }, + { 172968, true }, + { 172977, true }, + { 172985, true }, + { 172999, true }, + { 173007, true }, + { 173026, false }, { 173046, true }, - { 173054, true }, - { 173068, true }, - { 173076, true }, - { 173095, false }, - { 173115, true }, - { 173125, true }, - { 173146, true }, - { 173157, false }, - { 173169, true }, - { 173183, true }, - { 173200, true }, - { 173217, true }, + { 173056, true }, + { 173077, true }, + { 173088, false }, + { 173100, true }, + { 173114, true }, + { 173131, true }, + { 173148, true }, + { 173159, true }, + { 173188, true }, + { 173202, true }, + { 173214, true }, { 173228, true }, + { 173245, true }, { 173257, true }, - { 173271, true }, - { 173283, true }, - { 173297, true }, + { 173272, true }, + { 173286, true }, + { 173294, true }, + { 173302, true }, { 173314, true }, - { 173326, true }, - { 173341, true }, - { 173355, true }, + { 173328, true }, + { 173345, true }, { 173363, true }, - { 173371, true }, - { 173383, true }, - { 173397, true }, - { 173414, true }, - { 173432, true }, - { 173445, true }, - { 173455, true }, - { 173464, false }, - { 173482, true }, - { 173494, false }, - { 173506, true }, - { 173519, true }, - { 173534, true }, - { 173548, true }, - { 173557, true }, - { 173580, true }, - { 173594, true }, - { 173607, true }, - { 173623, true }, - { 173640, true }, - { 173658, true }, - { 173670, true }, - { 173689, true }, - { 173711, true }, - { 173733, true }, - { 173753, true }, - { 173771, false }, - { 173787, true }, - { 173810, true }, - { 173819, true }, - { 173827, true }, - { 173842, true }, - { 173861, true }, - { 173877, true }, - { 173891, true }, - { 173907, true }, - { 173927, true }, - { 173937, true }, - { 173955, true }, - { 173962, true }, - { 173974, true }, - { 173987, true }, - { 173997, true }, - { 174013, true }, - { 174021, true }, - { 174029, true }, - { 174037, true }, - { 174044, false }, - { 174067, true }, - { 174086, true }, - { 174111, true }, + { 173376, true }, + { 173386, true }, + { 173395, false }, + { 173413, true }, + { 173425, false }, + { 173437, true }, + { 173450, true }, + { 173465, true }, + { 173479, true }, + { 173488, true }, + { 173511, true }, + { 173525, true }, + { 173538, true }, + { 173554, true }, + { 173571, true }, + { 173589, true }, + { 173601, true }, + { 173620, true }, + { 173642, true }, + { 173664, true }, + { 173684, true }, + { 173702, false }, + { 173718, true }, + { 173741, true }, + { 173750, true }, + { 173758, true }, + { 173773, true }, + { 173792, true }, + { 173808, true }, + { 173822, true }, + { 173838, true }, + { 173858, true }, + { 173868, true }, + { 173886, true }, + { 173893, true }, + { 173905, true }, + { 173918, true }, + { 173928, true }, + { 173944, true }, + { 173952, true }, + { 173960, true }, + { 173968, true }, + { 173975, false }, + { 173998, true }, + { 174017, true }, + { 174042, true }, + { 174059, true }, + { 174071, true }, + { 174083, true }, + { 174093, true }, + { 174104, true }, + { 174119, true }, { 174128, true }, - { 174140, true }, - { 174152, true }, - { 174162, true }, - { 174173, true }, + { 174142, true }, + { 174153, true }, + { 174166, true }, { 174188, true }, - { 174197, true }, - { 174211, true }, - { 174222, true }, - { 174235, true }, + { 174198, true }, + { 174219, true }, + { 174240, true }, { 174257, true }, - { 174269, true }, - { 174279, true }, - { 174300, true }, + { 174278, true }, + { 174292, true }, + { 174308, true }, { 174321, true }, - { 174338, true }, - { 174359, true }, - { 174373, true }, - { 174389, true }, - { 174402, true }, + { 174333, true }, + { 174348, true }, + { 174358, true }, + { 174371, true }, + { 174395, true }, { 174414, true }, - { 174429, true }, - { 174439, true }, - { 174452, true }, - { 174476, true }, - { 174495, true }, - { 174507, true }, - { 174525, true }, - { 174534, false }, - { 174551, true }, - { 174569, true }, - { 174582, true }, - { 174595, false }, - { 174616, true }, - { 174626, true }, + { 174426, true }, + { 174444, true }, + { 174453, false }, + { 174470, true }, + { 174488, true }, + { 174501, true }, + { 174514, false }, + { 174535, true }, + { 174545, true }, + { 174564, true }, + { 174577, true }, + { 174597, true }, + { 174622, true }, + { 174633, true }, { 174645, true }, - { 174658, true }, - { 174678, true }, + { 174660, true }, + { 174673, true }, + { 174688, true }, { 174703, true }, - { 174714, true }, - { 174726, true }, - { 174741, true }, - { 174754, true }, - { 174769, true }, - { 174784, true }, - { 174804, true }, - { 174817, false }, - { 174826, true }, - { 174845, true }, - { 174862, false }, - { 174877, true }, - { 174891, true }, - { 174901, true }, - { 174914, true }, - { 174930, true }, - { 174946, true }, - { 174964, true }, - { 174974, true }, - { 174987, true }, - { 174999, true }, - { 175012, true }, - { 175025, true }, - { 175034, true }, + { 174723, true }, + { 174736, false }, + { 174745, true }, + { 174764, true }, + { 174781, false }, + { 174796, true }, + { 174810, true }, + { 174820, true }, + { 174833, true }, + { 174849, true }, + { 174865, true }, + { 174883, true }, + { 174893, true }, + { 174906, true }, + { 174918, true }, + { 174931, true }, + { 174944, true }, + { 174953, true }, + { 174977, true }, + { 175001, true }, + { 175018, false }, + { 175031, true }, + { 175042, true }, { 175058, true }, - { 175082, true }, - { 175099, false }, - { 175112, true }, - { 175123, true }, - { 175139, true }, - { 175151, true }, - { 175167, true }, - { 175184, false }, - { 175196, true }, - { 175215, false }, - { 175224, true }, - { 175246, true }, - { 175260, true }, - { 175273, false }, - { 175288, true }, - { 175303, true }, - { 175315, true }, - { 175334, false }, - { 175357, true }, - { 175373, true }, + { 175070, true }, + { 175086, true }, + { 175103, false }, + { 175115, true }, + { 175134, false }, + { 175143, true }, + { 175165, true }, + { 175179, true }, + { 175192, false }, + { 175207, true }, + { 175222, true }, + { 175234, true }, + { 175253, false }, + { 175276, true }, + { 175292, true }, + { 175308, true }, + { 175326, true }, + { 175344, false }, + { 175364, true }, + { 175376, true }, { 175389, true }, - { 175407, true }, - { 175425, false }, - { 175445, true }, - { 175457, true }, + { 175405, true }, + { 175416, true }, + { 175435, true }, + { 175449, true }, + { 175460, true }, { 175470, true }, - { 175486, true }, - { 175497, true }, - { 175516, true }, + { 175487, true }, + { 175499, true }, + { 175511, true }, { 175530, true }, - { 175541, true }, - { 175551, true }, - { 175568, true }, - { 175580, true }, - { 175592, true }, - { 175611, true }, - { 175623, true }, - { 175634, true }, - { 175653, true }, - { 175674, true }, - { 175684, true }, - { 175697, true }, - { 175705, true }, - { 175721, true }, - { 175745, false }, - { 175763, true }, - { 175781, false }, - { 175801, true }, - { 175817, true }, - { 175835, true }, - { 175847, true }, - { 175864, true }, - { 175887, true }, + { 175542, true }, + { 175553, true }, + { 175572, true }, + { 175593, true }, + { 175603, true }, + { 175616, true }, + { 175624, true }, + { 175640, true }, + { 175664, false }, + { 175682, true }, + { 175700, false }, + { 175720, true }, + { 175736, true }, + { 175754, true }, + { 175766, true }, + { 175783, true }, + { 175806, true }, + { 175825, true }, + { 175845, true }, + { 175858, true }, + { 175870, true }, + { 175878, true }, + { 175898, true }, { 175906, true }, - { 175926, true }, - { 175939, true }, - { 175951, true }, - { 175959, true }, - { 175979, true }, - { 175987, true }, + { 175922, true }, + { 175936, true }, + { 175948, true }, + { 175957, true }, + { 175967, true }, + { 175976, true }, + { 175993, true }, { 176003, true }, - { 176017, true }, - { 176029, true }, - { 176038, true }, - { 176048, true }, - { 176057, true }, - { 176074, true }, - { 176084, true }, + { 176016, true }, + { 176033, true }, + { 176044, true }, + { 176054, true }, + { 176071, true }, + { 176088, true }, { 176097, true }, - { 176114, true }, - { 176125, true }, - { 176135, true }, + { 176111, true }, + { 176123, true }, + { 176142, true }, { 176152, true }, { 176169, true }, - { 176178, true }, - { 176192, true }, - { 176204, true }, - { 176223, true }, - { 176233, true }, - { 176250, true }, - { 176272, true }, - { 176286, true }, - { 176300, true }, - { 176318, true }, - { 176333, true }, - { 176347, true }, - { 176356, true }, - { 176368, true }, - { 176374, true }, - { 176380, true }, - { 176388, true }, - { 176400, true }, - { 176421, true }, - { 176431, true }, - { 176442, true }, - { 176460, true }, - { 176473, true }, - { 176492, true }, - { 176508, true }, - { 176519, true }, - { 176532, true }, - { 176547, true }, - { 176561, false }, - { 176575, true }, - { 176594, true }, - { 176605, true }, - { 176615, true }, - { 176623, true }, - { 176640, true }, - { 176654, true }, - { 176666, true }, - { 176683, true }, - { 176697, true }, - { 176711, false }, - { 176724, true }, - { 176742, true }, - { 176754, true }, - { 176766, true }, - { 176785, true }, + { 176191, true }, + { 176205, true }, + { 176219, true }, + { 176237, true }, + { 176252, true }, + { 176266, true }, + { 176275, true }, + { 176287, true }, + { 176293, true }, + { 176299, true }, + { 176307, true }, + { 176319, true }, + { 176340, true }, + { 176350, true }, + { 176361, true }, + { 176379, true }, + { 176392, true }, + { 176411, true }, + { 176427, true }, + { 176438, true }, + { 176451, true }, + { 176466, true }, + { 176480, false }, + { 176494, true }, + { 176513, true }, + { 176524, true }, + { 176534, true }, + { 176542, true }, + { 176559, true }, + { 176573, true }, + { 176585, true }, + { 176602, true }, + { 176616, true }, + { 176630, false }, + { 176643, true }, + { 176661, true }, + { 176673, true }, + { 176685, true }, + { 176704, true }, + { 176723, true }, + { 176737, true }, + { 176749, true }, + { 176762, true }, + { 176778, true }, + { 176791, true }, { 176804, true }, - { 176818, true }, - { 176830, true }, - { 176843, true }, - { 176859, true }, - { 176872, true }, - { 176885, true }, - { 176900, true }, - { 176928, true }, - { 176939, true }, - { 176952, true }, - { 176967, true }, - { 176986, true }, - { 176999, true }, - { 177024, true }, - { 177036, true }, - { 177050, true }, - { 177064, true }, + { 176819, true }, + { 176847, true }, + { 176858, true }, + { 176871, true }, + { 176886, true }, + { 176905, true }, + { 176918, true }, + { 176943, true }, + { 176955, true }, + { 176969, true }, + { 176983, true }, + { 176998, true }, + { 177012, true }, + { 177026, true }, + { 177040, true }, + { 177056, true }, { 177079, true }, - { 177093, true }, - { 177107, true }, - { 177121, true }, - { 177137, true }, - { 177160, true }, - { 177176, true }, - { 177191, true }, - { 177215, true }, - { 177227, true }, - { 177246, true }, - { 177259, true }, - { 177270, true }, + { 177095, true }, + { 177110, true }, + { 177134, true }, + { 177146, true }, + { 177165, true }, + { 177178, true }, + { 177189, true }, + { 177209, true }, + { 177221, true }, + { 177239, true }, + { 177256, true }, + { 177271, true }, { 177290, true }, - { 177302, true }, - { 177320, true }, + { 177303, true }, + { 177319, true }, { 177337, true }, - { 177352, true }, - { 177371, true }, - { 177384, true }, - { 177400, true }, - { 177418, true }, - { 177442, true }, - { 177458, true }, - { 177471, true }, - { 177491, true }, - { 177504, true }, - { 177526, true }, - { 177543, true }, + { 177361, true }, + { 177377, true }, + { 177390, true }, + { 177410, true }, + { 177423, true }, + { 177445, true }, + { 177462, true }, + { 177477, true }, + { 177498, true }, + { 177518, true }, + { 177531, true }, + { 177546, true }, { 177558, true }, - { 177579, true }, - { 177599, true }, - { 177612, true }, - { 177627, true }, - { 177639, true }, - { 177653, true }, - { 177671, true }, - { 177686, true }, + { 177572, true }, + { 177590, true }, + { 177605, true }, + { 177624, true }, + { 177643, true }, + { 177657, true }, + { 177678, true }, + { 177693, true }, { 177705, true }, - { 177724, true }, - { 177738, true }, - { 177759, true }, - { 177774, true }, - { 177786, true }, - { 177803, true }, - { 177818, true }, - { 177836, true }, - { 177848, true }, + { 177722, true }, + { 177737, true }, + { 177755, true }, + { 177767, true }, + { 177781, true }, + { 177792, true }, + { 177814, true }, + { 177826, true }, + { 177835, true }, + { 177847, true }, { 177862, true }, - { 177873, true }, - { 177895, true }, - { 177907, true }, - { 177916, true }, - { 177928, true }, - { 177943, true }, - { 177966, true }, - { 177985, true }, + { 177885, true }, + { 177904, true }, + { 177922, true }, + { 177938, true }, + { 177957, true }, + { 177973, true }, + { 177990, true }, { 178003, true }, - { 178019, true }, - { 178038, true }, - { 178054, true }, - { 178071, true }, + { 178022, true }, + { 178040, true }, + { 178046, true }, + { 178064, false }, { 178084, true }, - { 178103, true }, - { 178121, true }, + { 178101, true }, + { 178115, true }, { 178127, true }, - { 178145, false }, - { 178165, true }, + { 178146, false }, + { 178163, true }, { 178182, true }, - { 178194, true }, - { 178213, false }, - { 178230, true }, - { 178249, true }, - { 178260, true }, - { 178279, true }, - { 178302, true }, - { 178328, true }, - { 178339, true }, - { 178357, true }, - { 178377, true }, - { 178394, true }, - { 178413, true }, - { 178431, true }, + { 178193, true }, + { 178212, true }, + { 178235, true }, + { 178261, true }, + { 178272, true }, + { 178290, true }, + { 178310, true }, + { 178327, true }, + { 178346, true }, + { 178364, true }, + { 178373, true }, + { 178380, true }, + { 178387, true }, + { 178399, true }, + { 178409, true }, + { 178420, false }, { 178440, true }, - { 178447, true }, - { 178454, true }, - { 178466, true }, - { 178476, true }, - { 178487, false }, - { 178507, true }, - { 178515, true }, - { 178526, true }, - { 178537, true }, - { 178548, true }, - { 178571, true }, - { 178595, true }, - { 178618, true }, - { 178641, true }, - { 178669, true }, - { 178698, true }, - { 178711, true }, - { 178726, true }, - { 178745, true }, - { 178758, true }, - { 178776, true }, - { 178799, true }, - { 178810, true }, - { 178827, true }, - { 178838, true }, - { 178853, true }, - { 178864, true }, + { 178448, true }, + { 178459, true }, + { 178470, true }, + { 178481, true }, + { 178504, true }, + { 178528, true }, + { 178551, true }, + { 178574, true }, + { 178602, true }, + { 178631, true }, + { 178644, true }, + { 178659, true }, + { 178678, true }, + { 178691, true }, + { 178709, true }, + { 178732, true }, + { 178743, true }, + { 178760, true }, + { 178771, true }, + { 178786, true }, + { 178797, true }, + { 178815, true }, + { 178841, true }, + { 178870, true }, { 178882, true }, - { 178908, true }, - { 178937, true }, - { 178949, true }, - { 178962, false }, - { 178982, true }, - { 179000, true }, - { 179015, true }, - { 179036, false }, + { 178895, false }, + { 178915, true }, + { 178933, true }, + { 178948, true }, + { 178969, false }, + { 178985, true }, + { 179003, true }, + { 179019, true }, + { 179034, true }, { 179052, true }, - { 179070, true }, - { 179086, true }, - { 179101, true }, - { 179117, true }, - { 179129, true }, - { 179151, true }, - { 179173, true }, - { 179193, true }, - { 179213, true }, - { 179232, true }, - { 179249, true }, - { 179267, false }, - { 179285, true }, - { 179305, true }, - { 179324, true }, - { 179343, true }, - { 179364, true }, - { 179391, true }, - { 179403, true }, - { 179415, true }, - { 179426, true }, - { 179440, true }, - { 179449, true }, - { 179464, true }, - { 179474, true }, - { 179487, true }, - { 179507, true }, - { 179516, true }, - { 179526, true }, - { 179547, false }, - { 179564, true }, - { 179584, true }, - { 179593, true }, - { 179606, true }, - { 179623, true }, - { 179637, true }, - { 179651, true }, - { 179663, true }, - { 179680, true }, + { 179068, true }, + { 179080, true }, + { 179102, true }, + { 179124, true }, + { 179144, true }, + { 179163, true }, + { 179180, true }, + { 179198, false }, + { 179216, true }, + { 179236, true }, + { 179255, true }, + { 179274, true }, + { 179295, true }, + { 179322, true }, + { 179334, true }, + { 179346, true }, + { 179357, true }, + { 179376, true }, + { 179390, true }, + { 179399, true }, + { 179414, true }, + { 179424, true }, + { 179437, true }, + { 179457, true }, + { 179466, true }, + { 179476, true }, + { 179497, false }, + { 179514, true }, + { 179534, true }, + { 179543, true }, + { 179556, true }, + { 179573, true }, + { 179587, true }, + { 179601, true }, + { 179613, true }, + { 179630, true }, + { 179645, true }, + { 179662, true }, + { 179678, true }, { 179695, true }, - { 179712, true }, - { 179728, true }, - { 179745, true }, + { 179711, true }, + { 179723, true }, + { 179734, false }, + { 179750, true }, { 179761, true }, - { 179773, true }, - { 179784, false }, - { 179800, true }, - { 179811, true }, - { 179827, true }, - { 179842, true }, - { 179858, true }, - { 179871, true }, - { 179880, true }, - { 179893, true }, - { 179910, true }, - { 179922, true }, - { 179934, true }, - { 179946, true }, + { 179777, true }, + { 179792, true }, + { 179808, true }, + { 179821, true }, + { 179830, true }, + { 179843, true }, + { 179860, true }, + { 179872, true }, + { 179884, true }, + { 179896, true }, + { 179908, true }, + { 179917, true }, + { 179929, true }, + { 179944, true }, { 179958, true }, - { 179967, true }, - { 179979, true }, - { 179994, true }, - { 180008, true }, - { 180020, true }, - { 180037, true }, - { 180049, true }, - { 180059, true }, - { 180075, true }, + { 179970, true }, + { 179987, true }, + { 179999, true }, + { 180009, true }, + { 180025, true }, + { 180046, true }, + { 180064, true }, + { 180080, true }, { 180096, true }, - { 180114, true }, - { 180130, true }, - { 180146, true }, - { 180166, true }, - { 180181, true }, - { 180193, true }, - { 180208, true }, - { 180218, true }, - { 180233, true }, - { 180245, true }, - { 180257, true }, - { 180272, true }, - { 180286, true }, - { 180297, true }, - { 180308, true }, - { 180319, true }, - { 180327, true }, - { 180340, true }, - { 180353, true }, - { 180370, true }, - { 180380, true }, - { 180393, true }, - { 180410, true }, - { 180424, true }, - { 180433, true }, + { 180116, true }, + { 180131, true }, + { 180143, true }, + { 180158, true }, + { 180168, true }, + { 180183, true }, + { 180195, true }, + { 180207, true }, + { 180222, true }, + { 180236, true }, + { 180247, true }, + { 180258, true }, + { 180269, true }, + { 180277, true }, + { 180290, true }, + { 180303, true }, + { 180320, true }, + { 180330, true }, + { 180343, true }, + { 180360, true }, + { 180374, true }, + { 180383, true }, + { 180398, true }, + { 180412, true }, + { 180426, true }, + { 180440, true }, { 180448, true }, - { 180462, true }, - { 180476, true }, - { 180490, true }, - { 180498, true }, - { 180515, true }, - { 180530, true }, - { 180545, true }, - { 180559, true }, - { 180575, true }, - { 180591, true }, - { 180605, true }, - { 180621, true }, - { 180643, true }, - { 180660, true }, - { 180673, true }, - { 180687, true }, - { 180703, false }, - { 180721, true }, - { 180736, true }, - { 180753, true }, - { 180768, true }, - { 180785, false }, - { 180811, true }, - { 180826, true }, - { 180844, true }, - { 180857, true }, - { 180870, true }, - { 180889, true }, - { 180899, true }, - { 180915, true }, + { 180465, true }, + { 180480, true }, + { 180495, true }, + { 180509, true }, + { 180525, true }, + { 180541, true }, + { 180555, true }, + { 180571, true }, + { 180593, true }, + { 180610, true }, + { 180623, true }, + { 180637, true }, + { 180653, false }, + { 180671, true }, + { 180686, true }, + { 180703, true }, + { 180718, true }, + { 180735, false }, + { 180761, true }, + { 180776, true }, + { 180794, true }, + { 180807, true }, + { 180820, true }, + { 180839, true }, + { 180849, true }, + { 180865, true }, + { 180877, true }, + { 180899, false }, + { 180910, true }, { 180927, true }, - { 180949, false }, - { 180960, true }, - { 180977, true }, - { 181008, true }, - { 181018, true }, - { 181029, true }, - { 181041, true }, - { 181055, true }, - { 181067, true }, - { 181075, true }, - { 181083, true }, - { 181094, false }, - { 181114, true }, + { 180958, true }, + { 180968, true }, + { 180979, true }, + { 180991, true }, + { 181005, true }, + { 181017, true }, + { 181025, true }, + { 181033, true }, + { 181044, false }, + { 181064, true }, + { 181082, true }, + { 181102, true }, + { 181117, true }, { 181132, true }, - { 181152, true }, - { 181167, true }, - { 181182, true }, - { 181199, false }, - { 181213, true }, - { 181233, true }, - { 181244, true }, - { 181269, true }, + { 181149, false }, + { 181163, true }, + { 181183, true }, + { 181194, true }, + { 181219, true }, + { 181240, true }, + { 181258, true }, + { 181273, true }, { 181290, true }, - { 181308, true }, - { 181323, true }, - { 181340, true }, - { 181356, true }, - { 181381, true }, - { 181392, true }, - { 181403, true }, - { 181417, true }, - { 181430, false }, - { 181458, true }, - { 181470, true }, - { 181483, true }, - { 181496, false }, - { 181504, true }, - { 181514, true }, - { 181529, true }, - { 181541, true }, - { 181560, true }, - { 181572, true }, - { 181585, true }, + { 181306, true }, + { 181331, true }, + { 181342, true }, + { 181353, true }, + { 181367, true }, + { 181380, false }, + { 181408, true }, + { 181420, true }, + { 181433, true }, + { 181446, false }, + { 181454, true }, + { 181464, true }, + { 181479, true }, + { 181491, true }, + { 181510, true }, + { 181522, true }, + { 181535, true }, + { 181548, true }, + { 181563, true }, + { 181576, true }, { 181598, true }, - { 181613, true }, - { 181626, true }, - { 181648, true }, - { 181661, true }, - { 181681, true }, + { 181612, true }, + { 181625, true }, + { 181645, true }, + { 181663, true }, + { 181677, true }, + { 181688, true }, { 181699, true }, - { 181713, true }, - { 181724, true }, - { 181735, true }, - { 181748, true }, + { 181712, true }, + { 181729, true }, + { 181737, true }, + { 181752, true }, { 181765, true }, - { 181773, true }, - { 181788, true }, - { 181801, true }, - { 181815, true }, - { 181830, true }, + { 181779, true }, + { 181794, true }, + { 181819, true }, { 181855, true }, - { 181891, true }, - { 181904, true }, - { 181914, true }, - { 181929, true }, - { 181942, true }, - { 181964, true }, - { 181986, true }, + { 181868, true }, + { 181878, true }, + { 181893, true }, + { 181906, true }, + { 181928, true }, + { 181950, true }, + { 181968, true }, + { 181981, true }, + { 181992, true }, { 182004, true }, - { 182017, true }, - { 182028, true }, - { 182040, true }, - { 182059, true }, - { 182077, true }, - { 182085, true }, - { 182118, true }, - { 182125, true }, - { 182142, true }, - { 182158, true }, - { 182175, true }, - { 182185, true }, + { 182023, true }, + { 182041, true }, + { 182049, true }, + { 182082, true }, + { 182089, true }, + { 182106, true }, + { 182122, true }, + { 182139, true }, + { 182149, true }, + { 182162, true }, + { 182180, false }, { 182198, true }, - { 182216, false }, - { 182234, true }, - { 182252, true }, + { 182216, true }, + { 182228, true }, + { 182240, true }, + { 182251, true }, { 182264, true }, - { 182276, true }, - { 182287, true }, - { 182300, true }, - { 182316, true }, - { 182330, true }, - { 182350, true }, - { 182364, true }, - { 182376, true }, - { 182396, true }, + { 182280, true }, + { 182294, true }, + { 182314, true }, + { 182328, true }, + { 182340, true }, + { 182360, true }, + { 182371, true }, + { 182388, true }, + { 182398, true }, { 182407, true }, - { 182424, true }, - { 182434, true }, - { 182443, true }, + { 182418, true }, + { 182437, true }, { 182454, true }, - { 182473, true }, - { 182490, true }, - { 182504, true }, - { 182518, true }, - { 182541, true }, - { 182561, true }, - { 182575, true }, - { 182589, true }, - { 182601, true }, - { 182613, true }, - { 182629, true }, - { 182643, true }, - { 182653, true }, - { 182667, true }, - { 182676, true }, - { 182688, true }, - { 182700, true }, - { 182711, true }, - { 182720, true }, - { 182729, true }, - { 182740, true }, - { 182754, true }, - { 182760, true }, - { 182772, true }, - { 182785, true }, - { 182800, false }, - { 182827, true }, - { 182847, true }, - { 182857, true }, - { 182870, true }, - { 182883, true }, - { 182899, true }, - { 182920, true }, - { 182941, true }, - { 182960, true }, + { 182468, true }, + { 182482, true }, + { 182505, true }, + { 182525, true }, + { 182539, true }, + { 182553, true }, + { 182565, true }, + { 182577, true }, + { 182593, true }, + { 182607, true }, + { 182621, true }, + { 182630, true }, + { 182642, true }, + { 182654, true }, + { 182665, true }, + { 182674, true }, + { 182683, true }, + { 182694, true }, + { 182708, true }, + { 182714, true }, + { 182726, true }, + { 182739, true }, + { 182754, false }, + { 182781, true }, + { 182801, true }, + { 182811, true }, + { 182824, true }, + { 182837, true }, + { 182853, true }, + { 182874, true }, + { 182895, true }, + { 182914, true }, + { 182924, true }, + { 182936, true }, + { 182947, false }, + { 182955, true }, { 182970, true }, - { 182982, true }, - { 182993, false }, - { 183001, true }, - { 183016, true }, - { 183030, true }, - { 183044, true }, - { 183056, true }, - { 183069, true }, - { 183079, true }, - { 183100, true }, - { 183112, true }, - { 183123, true }, - { 183143, true }, - { 183162, true }, - { 183173, true }, - { 183188, true }, - { 183213, false }, - { 183241, false }, - { 183253, true }, - { 183264, true }, + { 182984, true }, + { 182998, true }, + { 183010, true }, + { 183023, true }, + { 183033, true }, + { 183054, true }, + { 183066, true }, + { 183077, true }, + { 183097, true }, + { 183116, true }, + { 183127, true }, + { 183142, true }, + { 183167, false }, + { 183195, false }, + { 183207, true }, + { 183218, true }, + { 183229, true }, + { 183245, true }, + { 183260, true }, { 183275, true }, - { 183291, true }, - { 183306, true }, - { 183321, true }, + { 183286, true }, + { 183303, true }, + { 183315, false }, { 183332, true }, - { 183349, true }, - { 183361, false }, - { 183378, true }, - { 183397, true }, - { 183413, true }, + { 183351, true }, + { 183367, true }, + { 183381, true }, + { 183396, true }, + { 183411, true }, { 183427, true }, - { 183442, true }, - { 183457, true }, - { 183473, true }, - { 183490, true }, - { 183513, true }, - { 183532, true }, - { 183546, true }, - { 183567, true }, - { 183587, true }, - { 183605, true }, - { 183624, true }, - { 183642, true }, - { 183660, true }, - { 183676, true }, - { 183691, false }, - { 183706, false }, - { 183720, true }, - { 183733, true }, - { 183749, true }, - { 183760, true }, - { 183771, true }, - { 183783, true }, - { 183798, true }, - { 183816, true }, - { 183834, true }, - { 183856, true }, - { 183870, true }, - { 183887, true }, - { 183906, true }, - { 183924, true }, - { 183945, true }, - { 183959, true }, - { 183971, true }, - { 183986, true }, - { 184002, true }, - { 184020, true }, - { 184030, true }, - { 184042, false }, - { 184053, true }, - { 184072, false }, - { 184091, true }, - { 184106, true }, - { 184119, false }, - { 184138, true }, - { 184149, true }, - { 184167, true }, - { 184181, true }, - { 184206, true }, - { 184221, true }, - { 184239, true }, - { 184254, true }, - { 184269, true }, - { 184286, true }, - { 184297, true }, - { 184307, true }, - { 184319, true }, - { 184333, true }, - { 184348, true }, - { 184357, true }, - { 184367, true }, - { 184377, false }, + { 183444, true }, + { 183467, true }, + { 183486, true }, + { 183500, true }, + { 183521, true }, + { 183541, true }, + { 183559, true }, + { 183578, true }, + { 183596, true }, + { 183614, true }, + { 183630, true }, + { 183645, false }, + { 183660, false }, + { 183674, true }, + { 183687, true }, + { 183703, true }, + { 183714, true }, + { 183725, true }, + { 183737, true }, + { 183752, true }, + { 183770, true }, + { 183788, true }, + { 183810, true }, + { 183824, true }, + { 183841, true }, + { 183860, true }, + { 183878, true }, + { 183899, true }, + { 183913, true }, + { 183925, true }, + { 183940, true }, + { 183956, true }, + { 183974, true }, + { 183984, true }, + { 183996, false }, + { 184007, true }, + { 184026, false }, + { 184045, true }, + { 184060, true }, + { 184073, false }, + { 184092, true }, + { 184103, true }, + { 184121, true }, + { 184135, true }, + { 184160, true }, + { 184175, true }, + { 184193, true }, + { 184208, true }, + { 184223, true }, + { 184240, true }, + { 184251, true }, + { 184261, true }, + { 184273, true }, + { 184287, true }, + { 184302, true }, + { 184311, true }, + { 184321, false }, + { 184338, true }, + { 184353, false }, + { 184366, true }, + { 184382, true }, { 184394, true }, - { 184409, false }, - { 184422, true }, - { 184438, true }, - { 184450, true }, - { 184471, true }, - { 184484, true }, - { 184501, true }, - { 184521, true }, - { 184544, true }, - { 184563, true }, - { 184575, true }, - { 184585, false }, - { 184597, true }, - { 184612, true }, - { 184626, true }, - { 184640, true }, - { 184660, true }, - { 184683, true }, - { 184696, true }, - { 184714, true }, - { 184722, true }, - { 184729, true }, - { 184737, true }, - { 184752, true }, - { 184764, true }, + { 184415, true }, + { 184428, true }, + { 184445, true }, + { 184465, true }, + { 184488, true }, + { 184507, true }, + { 184519, true }, + { 184530, true }, + { 184540, false }, + { 184552, true }, + { 184567, true }, + { 184581, true }, + { 184595, true }, + { 184615, true }, + { 184638, true }, + { 184651, true }, + { 184669, true }, + { 184677, true }, + { 184684, true }, + { 184692, true }, + { 184707, true }, + { 184719, true }, + { 184731, true }, + { 184748, true }, + { 184759, false }, { 184776, true }, - { 184793, true }, - { 184804, false }, - { 184821, true }, - { 184834, true }, - { 184845, false }, - { 184858, true }, - { 184873, false }, - { 184897, false }, - { 184909, true }, - { 184934, true }, - { 184943, true }, - { 184963, true }, - { 184980, true }, - { 184990, true }, - { 185011, true }, - { 185020, true }, - { 185039, true }, - { 185057, true }, + { 184789, true }, + { 184800, false }, + { 184813, true }, + { 184828, false }, + { 184852, false }, + { 184864, true }, + { 184889, true }, + { 184898, true }, + { 184918, true }, + { 184935, true }, + { 184945, true }, + { 184966, true }, + { 184975, true }, + { 184994, true }, + { 185012, true }, + { 185028, true }, + { 185043, true }, + { 185058, true }, { 185073, true }, - { 185088, true }, - { 185103, true }, - { 185118, true }, - { 185138, true }, - { 185151, true }, - { 185164, true }, - { 185173, true }, + { 185093, true }, + { 185106, true }, + { 185119, true }, + { 185128, true }, + { 185142, true }, + { 185165, true }, { 185187, true }, - { 185210, true }, - { 185232, true }, - { 185258, true }, - { 185273, true }, - { 185288, true }, - { 185298, true }, - { 185312, true }, - { 185324, true }, - { 185347, true }, - { 185356, true }, - { 185366, true }, - { 185374, true }, - { 185390, true }, - { 185404, true }, - { 185417, true }, - { 185434, false }, - { 185452, true }, + { 185213, true }, + { 185228, true }, + { 185243, true }, + { 185253, true }, + { 185267, true }, + { 185279, true }, + { 185302, true }, + { 185311, true }, + { 185321, true }, + { 185329, true }, + { 185345, true }, + { 185359, true }, + { 185372, true }, + { 185389, false }, + { 185407, true }, + { 185420, true }, + { 185431, true }, + { 185444, true }, + { 185455, true }, { 185465, true }, - { 185476, true }, - { 185489, true }, - { 185500, true }, - { 185510, true }, - { 185525, true }, - { 185538, true }, - { 185554, true }, - { 185564, false }, - { 185574, true }, - { 185587, true }, - { 185602, true }, - { 185612, true }, - { 185628, true }, - { 185640, true }, - { 185649, true }, - { 185664, true }, - { 185675, true }, - { 185693, true }, - { 185713, true }, - { 185729, true }, - { 185746, true }, - { 185759, true }, - { 185769, true }, - { 185779, true }, - { 185793, true }, + { 185480, true }, + { 185493, true }, + { 185509, true }, + { 185519, false }, + { 185529, true }, + { 185542, true }, + { 185557, true }, + { 185567, true }, + { 185583, true }, + { 185595, true }, + { 185604, true }, + { 185619, true }, + { 185630, true }, + { 185648, true }, + { 185668, true }, + { 185684, true }, + { 185701, true }, + { 185714, true }, + { 185724, true }, + { 185734, true }, + { 185748, true }, + { 185760, true }, + { 185773, true }, + { 185790, true }, { 185805, true }, - { 185818, true }, - { 185835, true }, - { 185850, true }, - { 185867, true }, - { 185879, true }, - { 185896, true }, - { 185910, true }, - { 185919, true }, - { 185935, true }, - { 185948, true }, - { 185961, true }, - { 185976, false }, - { 185988, true }, - { 186001, true }, + { 185822, true }, + { 185834, true }, + { 185851, true }, + { 185865, true }, + { 185874, true }, + { 185890, true }, + { 185903, true }, + { 185916, true }, + { 185931, false }, + { 185943, true }, + { 185956, true }, + { 185966, true }, + { 185975, true }, + { 185987, true }, + { 185995, true }, + { 186003, true }, { 186011, true }, - { 186020, true }, - { 186032, true }, - { 186040, true }, - { 186048, true }, + { 186017, true }, + { 186028, true }, + { 186043, true }, { 186056, true }, - { 186062, true }, - { 186073, true }, - { 186088, true }, - { 186101, true }, - { 186116, true }, - { 186135, true }, - { 186159, true }, - { 186172, true }, - { 186187, true }, - { 186211, true }, - { 186221, true }, - { 186233, true }, - { 186249, true }, - { 186270, false }, - { 186293, true }, - { 186314, true }, + { 186071, true }, + { 186090, true }, + { 186114, true }, + { 186127, true }, + { 186142, true }, + { 186166, true }, + { 186176, true }, + { 186188, true }, + { 186204, true }, + { 186225, true }, + { 186240, false }, + { 186263, true }, + { 186284, true }, + { 186297, true }, + { 186310, true }, { 186327, true }, - { 186340, true }, - { 186357, true }, - { 186371, true }, - { 186383, true }, - { 186402, true }, - { 186420, true }, - { 186444, false }, - { 186471, true }, - { 186497, true }, - { 186512, true }, - { 186529, true }, - { 186545, true }, - { 186562, true }, - { 186579, true }, - { 186594, true }, - { 186607, true }, - { 186618, true }, - { 186629, true }, - { 186640, true }, - { 186650, true }, - { 186663, true }, - { 186681, true }, - { 186694, true }, + { 186341, true }, + { 186353, true }, + { 186372, true }, + { 186390, true }, + { 186414, false }, + { 186441, true }, + { 186467, true }, + { 186482, true }, + { 186499, true }, + { 186515, true }, + { 186532, true }, + { 186549, true }, + { 186564, true }, + { 186577, true }, + { 186588, true }, + { 186599, true }, + { 186610, true }, + { 186620, true }, + { 186633, true }, + { 186651, true }, + { 186664, true }, + { 186678, true }, + { 186688, true }, + { 186699, true }, { 186708, true }, - { 186718, true }, { 186729, true }, - { 186738, true }, + { 186743, true }, + { 186752, true }, { 186759, true }, - { 186773, true }, - { 186782, true }, - { 186789, true }, - { 186796, true }, - { 186804, true }, - { 186827, true }, - { 186840, true }, - { 186854, true }, + { 186766, true }, + { 186774, true }, + { 186797, true }, + { 186810, true }, + { 186824, true }, + { 186837, true }, + { 186852, true }, { 186867, true }, - { 186882, true }, + { 186876, true }, + { 186884, true }, { 186897, true }, - { 186906, true }, - { 186914, true }, - { 186927, true }, + { 186905, true }, + { 186923, true }, { 186935, true }, - { 186953, true }, - { 186965, true }, - { 186986, true }, - { 187002, true }, - { 187011, true }, - { 187024, true }, - { 187035, true }, - { 187047, true }, - { 187062, true }, - { 187071, true }, - { 187083, true }, - { 187094, true }, - { 187106, true }, - { 187119, true }, - { 187132, true }, - { 187147, true }, - { 187167, true }, - { 187179, true }, - { 187196, true }, - { 187206, true }, - { 187213, true }, - { 187223, true }, - { 187235, true }, - { 187251, true }, - { 187266, true }, - { 187275, true }, - { 187289, true }, - { 187309, true }, - { 187321, true }, - { 187334, true }, - { 187348, true }, - { 187366, true }, - { 187373, true }, - { 187390, true }, - { 187407, true }, - { 187427, true }, - { 187446, true }, - { 187462, false }, - { 187480, true }, - { 187507, true }, - { 187524, true }, + { 186956, true }, + { 186972, true }, + { 186981, true }, + { 186994, true }, + { 187005, true }, + { 187017, true }, + { 187032, true }, + { 187041, true }, + { 187053, true }, + { 187064, true }, + { 187076, true }, + { 187089, true }, + { 187102, true }, + { 187117, true }, + { 187137, true }, + { 187149, true }, + { 187166, true }, + { 187176, true }, + { 187183, true }, + { 187193, true }, + { 187205, true }, + { 187221, true }, + { 187236, true }, + { 187245, true }, + { 187259, true }, + { 187279, true }, + { 187291, true }, + { 187304, true }, + { 187318, true }, + { 187336, true }, + { 187343, true }, + { 187360, true }, + { 187377, true }, + { 187397, true }, + { 187416, true }, + { 187432, false }, + { 187450, true }, + { 187477, true }, + { 187494, true }, + { 187508, true }, + { 187522, true }, { 187538, true }, - { 187552, true }, - { 187568, true }, - { 187583, false }, - { 187602, true }, - { 187620, true }, - { 187638, true }, - { 187656, true }, - { 187673, true }, - { 187694, true }, - { 187713, true }, - { 187727, true }, - { 187738, true }, - { 187751, true }, - { 187759, true }, + { 187553, false }, + { 187572, true }, + { 187590, true }, + { 187608, true }, + { 187626, true }, + { 187643, true }, + { 187664, true }, + { 187683, true }, + { 187697, true }, + { 187708, true }, + { 187721, true }, + { 187729, true }, + { 187739, true }, + { 187754, true }, { 187769, true }, - { 187784, true }, - { 187799, true }, - { 187810, true }, - { 187832, true }, - { 187845, true }, - { 187860, true }, - { 187879, true }, - { 187905, true }, - { 187921, true }, - { 187939, true }, - { 187957, true }, - { 187972, true }, - { 187980, true }, - { 187993, true }, - { 188001, true }, - { 188012, true }, - { 188026, true }, - { 188040, true }, - { 188051, true }, - { 188067, true }, - { 188084, true }, - { 188094, true }, - { 188107, true }, - { 188125, true }, - { 188138, true }, - { 188157, false }, - { 188167, true }, - { 188183, true }, - { 188200, true }, - { 188216, true }, - { 188239, true }, - { 188264, true }, - { 188277, true }, - { 188288, true }, + { 187780, true }, + { 187802, true }, + { 187815, true }, + { 187830, true }, + { 187849, true }, + { 187875, true }, + { 187891, true }, + { 187909, true }, + { 187927, true }, + { 187942, true }, + { 187950, true }, + { 187963, true }, + { 187971, true }, + { 187982, true }, + { 187996, true }, + { 188010, true }, + { 188021, true }, + { 188037, true }, + { 188054, true }, + { 188064, true }, + { 188077, true }, + { 188095, true }, + { 188108, true }, + { 188127, false }, + { 188137, true }, + { 188153, true }, + { 188170, true }, + { 188186, true }, + { 188209, true }, + { 188234, true }, + { 188247, true }, + { 188258, true }, + { 188273, true }, + { 188285, true }, { 188303, true }, - { 188315, true }, - { 188333, true }, - { 188358, true }, - { 188370, true }, - { 188382, true }, - { 188394, true }, + { 188328, true }, + { 188340, true }, + { 188352, true }, + { 188364, true }, + { 188375, true }, + { 188387, true }, { 188405, true }, - { 188417, true }, - { 188435, true }, - { 188456, true }, - { 188472, true }, - { 188484, true }, - { 188498, true }, - { 188513, true }, + { 188426, true }, + { 188442, true }, + { 188454, true }, + { 188468, true }, + { 188483, true }, + { 188496, true }, + { 188512, true }, { 188526, true }, - { 188542, true }, - { 188556, true }, - { 188574, true }, - { 188588, true }, - { 188598, false }, - { 188609, true }, - { 188617, false }, - { 188629, true }, - { 188646, true }, - { 188656, true }, - { 188667, true }, - { 188674, true }, - { 188685, true }, - { 188702, true }, - { 188722, true }, - { 188737, true }, - { 188748, true }, + { 188544, true }, + { 188558, true }, + { 188568, false }, + { 188579, true }, + { 188587, false }, + { 188599, true }, + { 188616, true }, + { 188626, true }, + { 188637, true }, + { 188644, true }, + { 188655, true }, + { 188672, true }, + { 188689, true }, + { 188709, true }, + { 188720, true }, + { 188729, true }, + { 188736, true }, + { 188746, true }, { 188757, true }, - { 188764, true }, - { 188774, true }, - { 188785, true }, - { 188801, true }, - { 188810, true }, - { 188825, true }, - { 188835, true }, - { 188856, true }, - { 188865, true }, - { 188883, true }, - { 188899, false }, + { 188773, true }, + { 188782, true }, + { 188797, true }, + { 188807, true }, + { 188828, true }, + { 188837, true }, + { 188855, true }, + { 188871, false }, + { 188884, true }, + { 188900, true }, { 188912, true }, - { 188928, true }, - { 188940, true }, - { 188952, true }, - { 188972, true }, - { 188986, true }, - { 189002, true }, - { 189016, true }, - { 189031, true }, - { 189039, true }, - { 189052, true }, - { 189068, true }, - { 189081, true }, - { 189094, true }, - { 189108, true }, - { 189130, true }, - { 189150, true }, - { 189171, true }, - { 189190, true }, + { 188924, true }, + { 188944, true }, + { 188958, true }, + { 188974, true }, + { 188988, true }, + { 189003, true }, + { 189011, true }, + { 189024, true }, + { 189040, true }, + { 189053, true }, + { 189066, true }, + { 189080, true }, + { 189102, true }, + { 189122, true }, + { 189143, true }, + { 189162, true }, + { 189178, true }, { 189206, true }, - { 189234, true }, - { 189251, true }, - { 189270, true }, - { 189294, true }, - { 189304, true }, + { 189223, true }, + { 189242, true }, + { 189266, true }, + { 189276, true }, + { 189285, true }, + { 189298, true }, + { 189307, true }, { 189313, true }, - { 189326, true }, - { 189335, true }, - { 189341, true }, - { 189353, true }, - { 189370, true }, - { 189384, true }, - { 189403, true }, - { 189417, true }, - { 189431, false }, - { 189444, true }, - { 189457, true }, - { 189470, true }, - { 189488, true }, - { 189509, true }, - { 189535, true }, - { 189548, true }, - { 189558, true }, - { 189577, true }, - { 189596, true }, - { 189613, true }, - { 189633, true }, - { 189649, true }, - { 189669, true }, - { 189678, true }, - { 189689, true }, - { 189698, true }, - { 189717, false }, - { 189733, false }, - { 189746, false }, - { 189759, true }, - { 189770, true }, - { 189785, true }, - { 189796, true }, - { 189815, true }, - { 189828, true }, + { 189325, true }, + { 189342, true }, + { 189356, true }, + { 189375, true }, + { 189389, true }, + { 189403, false }, + { 189416, true }, + { 189429, true }, + { 189442, true }, + { 189460, true }, + { 189481, true }, + { 189507, true }, + { 189520, true }, + { 189530, true }, + { 189549, true }, + { 189568, true }, + { 189585, true }, + { 189605, true }, + { 189621, true }, + { 189641, true }, + { 189650, true }, + { 189661, true }, + { 189670, true }, + { 189689, false }, + { 189705, false }, + { 189718, false }, + { 189731, true }, + { 189742, true }, + { 189757, true }, + { 189768, true }, + { 189787, true }, + { 189800, true }, + { 189812, true }, + { 189825, true }, { 189840, true }, - { 189853, true }, + { 189849, true }, { 189862, true }, - { 189875, true }, - { 189890, true }, - { 189906, true }, - { 189920, true }, - { 189937, true }, - { 189946, true }, - { 189960, true }, - { 189984, true }, - { 189999, true }, - { 190015, true }, - { 190033, true }, - { 190050, true }, - { 190065, true }, - { 190083, true }, + { 189877, true }, + { 189893, true }, + { 189907, true }, + { 189924, true }, + { 189933, true }, + { 189947, true }, + { 189971, true }, + { 189986, true }, + { 190002, true }, + { 190020, true }, + { 190037, true }, + { 190052, true }, + { 190070, true }, + { 190086, true }, { 190099, true }, - { 190112, true }, + { 190108, true }, { 190121, true }, - { 190134, true }, - { 190154, true }, - { 190165, true }, - { 190179, true }, - { 190188, true }, - { 190197, true }, - { 190215, true }, - { 190229, true }, - { 190244, true }, - { 190264, true }, - { 190281, true }, - { 190298, true }, - { 190314, true }, - { 190326, true }, - { 190340, true }, - { 190354, true }, - { 190375, true }, - { 190400, false }, - { 190416, true }, - { 190435, true }, - { 190450, true }, - { 190460, true }, - { 190484, true }, - { 190496, true }, + { 190141, true }, + { 190152, true }, + { 190166, true }, + { 190175, true }, + { 190184, true }, + { 190202, true }, + { 190216, true }, + { 190231, true }, + { 190251, true }, + { 190268, true }, + { 190285, true }, + { 190301, true }, + { 190313, true }, + { 190327, true }, + { 190341, true }, + { 190362, true }, + { 190387, false }, + { 190403, true }, + { 190422, true }, + { 190437, true }, + { 190447, true }, + { 190471, true }, + { 190483, true }, + { 190494, true }, { 190507, true }, - { 190520, true }, - { 190534, true }, - { 190543, true }, - { 190572, true }, - { 190597, true }, - { 190622, true }, - { 190651, true }, - { 190663, true }, - { 190679, true }, - { 190688, true }, - { 190700, true }, - { 190714, true }, - { 190728, true }, + { 190521, true }, + { 190530, true }, + { 190559, true }, + { 190584, true }, + { 190609, true }, + { 190638, true }, + { 190650, true }, + { 190666, true }, + { 190675, true }, + { 190687, true }, + { 190701, true }, + { 190715, true }, + { 190729, true }, { 190742, true }, - { 190755, true }, + { 190761, true }, { 190774, true }, - { 190787, true }, - { 190804, true }, - { 190813, true }, - { 190828, true }, - { 190846, true }, - { 190860, false }, + { 190791, true }, + { 190800, true }, + { 190815, true }, + { 190833, true }, + { 190847, false }, + { 190858, true }, { 190871, true }, - { 190884, true }, - { 190904, false }, - { 190917, true }, - { 190927, true }, + { 190891, false }, + { 190904, true }, + { 190914, true }, + { 190933, true }, { 190946, true }, - { 190959, true }, - { 190971, true }, - { 190993, true }, - { 191004, true }, - { 191015, true }, - { 191026, true }, - { 191036, true }, - { 191046, true }, - { 191055, true }, - { 191063, true }, - { 191069, false }, - { 191077, true }, - { 191086, true }, - { 191095, true }, - { 191103, true }, - { 191113, true }, - { 191121, true }, - { 191140, true }, - { 191147, true }, - { 191172, true }, + { 190958, true }, + { 190980, true }, + { 190991, true }, + { 191002, true }, + { 191013, true }, + { 191023, true }, + { 191033, true }, + { 191042, true }, + { 191050, true }, + { 191056, false }, + { 191064, true }, + { 191073, true }, + { 191082, true }, + { 191090, true }, + { 191100, true }, + { 191108, true }, + { 191127, true }, + { 191134, true }, + { 191159, true }, + { 191166, true }, { 191179, true }, - { 191192, true }, - { 191206, true }, - { 191216, true }, - { 191226, true }, - { 191245, true }, - { 191257, true }, - { 191272, true }, - { 191283, true }, - { 191295, true }, + { 191193, true }, + { 191203, true }, + { 191213, true }, + { 191232, true }, + { 191244, true }, + { 191259, true }, + { 191270, true }, + { 191282, true }, + { 191290, true }, { 191303, true }, - { 191316, true }, - { 191328, true }, - { 191347, true }, - { 191358, true }, - { 191385, true }, - { 191396, false }, - { 191407, true }, - { 191422, true }, - { 191438, true }, - { 191460, true }, + { 191315, true }, + { 191334, true }, + { 191345, true }, + { 191372, true }, + { 191383, false }, + { 191394, true }, + { 191409, true }, + { 191425, true }, + { 191447, true }, + { 191461, true }, { 191474, true }, { 191487, true }, - { 191500, true }, - { 191519, true }, - { 191548, true }, + { 191506, true }, + { 191535, true }, + { 191551, true }, { 191564, true }, - { 191577, true }, - { 191597, false }, - { 191624, false }, - { 191640, true }, - { 191656, true }, - { 191671, true }, - { 191687, true }, - { 191705, true }, - { 191724, true }, + { 191584, false }, + { 191611, false }, + { 191627, true }, + { 191643, true }, + { 191658, true }, + { 191674, true }, + { 191692, true }, + { 191711, true }, + { 191720, true }, { 191733, true }, - { 191746, true }, - { 191763, true }, + { 191750, true }, + { 191769, true }, { 191782, true }, - { 191795, true }, - { 191811, true }, - { 191829, true }, + { 191798, true }, + { 191816, true }, + { 191837, true }, { 191850, true }, - { 191863, true }, - { 191882, true }, - { 191909, true }, - { 191926, true }, - { 191940, true }, - { 191958, true }, - { 191976, true }, - { 191992, true }, + { 191869, true }, + { 191896, true }, + { 191913, true }, + { 191927, true }, + { 191945, true }, + { 191963, true }, + { 191979, true }, + { 191997, true }, { 192010, true }, - { 192023, true }, - { 192039, true }, - { 192060, true }, + { 192026, true }, + { 192047, true }, + { 192057, true }, { 192070, true }, - { 192083, true }, - { 192092, true }, - { 192103, true }, + { 192079, true }, + { 192090, true }, + { 192100, true }, { 192113, true }, { 192126, true }, - { 192139, true }, + { 192142, true }, { 192155, true }, - { 192168, true }, - { 192182, true }, - { 192197, true }, - { 192211, true }, - { 192226, true }, - { 192238, true }, - { 192255, true }, - { 192271, true }, - { 192290, true }, + { 192169, true }, + { 192184, true }, + { 192198, true }, + { 192213, true }, + { 192225, true }, + { 192242, true }, + { 192258, true }, + { 192277, true }, + { 192293, true }, { 192306, true }, - { 192319, true }, - { 192334, true }, - { 192343, true }, - { 192353, true }, - { 192381, true }, - { 192393, false }, - { 192410, true }, - { 192428, true }, - { 192452, true }, - { 192476, true }, - { 192495, true }, - { 192509, true }, - { 192517, true }, - { 192528, true }, - { 192542, true }, - { 192554, true }, - { 192563, true }, - { 192573, true }, - { 192593, true }, + { 192321, true }, + { 192330, true }, + { 192340, true }, + { 192368, true }, + { 192380, false }, + { 192397, true }, + { 192415, true }, + { 192439, true }, + { 192463, true }, + { 192482, true }, + { 192496, true }, + { 192504, true }, + { 192515, true }, + { 192529, true }, + { 192541, true }, + { 192550, true }, + { 192560, true }, + { 192580, true }, + { 192594, true }, { 192607, true }, - { 192620, true }, - { 192640, true }, - { 192658, true }, - { 192670, true }, - { 192685, true }, - { 192700, true }, - { 192711, true }, - { 192736, true }, - { 192751, false }, - { 192768, true }, - { 192780, false }, - { 192803, true }, - { 192822, true }, - { 192839, true }, + { 192627, true }, + { 192645, true }, + { 192657, true }, + { 192672, true }, + { 192687, true }, + { 192698, true }, + { 192723, true }, + { 192738, false }, + { 192755, true }, + { 192767, false }, + { 192790, true }, + { 192809, true }, + { 192826, true }, + { 192843, true }, { 192856, true }, - { 192869, true }, - { 192880, true }, - { 192902, true }, - { 192925, true }, - { 192943, true }, - { 192964, true }, - { 192986, true }, - { 193007, true }, - { 193028, true }, - { 193038, false }, - { 193052, true }, - { 193069, true }, - { 193089, true }, - { 193106, true }, + { 192867, true }, + { 192889, true }, + { 192912, true }, + { 192930, true }, + { 192951, true }, + { 192973, true }, + { 192994, true }, + { 193015, true }, + { 193025, false }, + { 193039, true }, + { 193056, true }, + { 193076, true }, + { 193093, true }, + { 193103, true }, { 193116, true }, - { 193129, true }, - { 193144, true }, - { 193162, true }, - { 193173, true }, - { 193190, true }, - { 193206, true }, - { 193218, true }, - { 193255, true }, - { 193274, true }, - { 193288, true }, - { 193303, true }, - { 193318, false }, - { 193330, true }, - { 193347, false }, + { 193131, true }, + { 193149, true }, + { 193160, true }, + { 193177, true }, + { 193193, true }, + { 193205, true }, + { 193242, true }, + { 193261, true }, + { 193275, true }, + { 193290, true }, + { 193305, false }, + { 193317, true }, + { 193334, false }, + { 193351, true }, { 193364, true }, - { 193377, true }, - { 193398, false }, - { 193410, false }, - { 193427, true }, - { 193444, true }, + { 193385, false }, + { 193397, false }, + { 193414, true }, + { 193431, true }, + { 193448, true }, { 193461, true }, - { 193474, true }, - { 193490, true }, - { 193506, true }, + { 193477, true }, + { 193493, true }, + { 193509, true }, { 193522, true }, - { 193535, true }, - { 193553, true }, - { 193563, true }, - { 193574, true }, - { 193590, true }, - { 193600, true }, + { 193540, true }, + { 193550, true }, + { 193561, true }, + { 193577, true }, + { 193587, true }, + { 193606, true }, { 193619, true }, - { 193632, true }, - { 193649, true }, - { 193663, true }, - { 193678, true }, - { 193689, true }, + { 193636, true }, + { 193650, true }, + { 193665, true }, + { 193676, true }, + { 193696, true }, { 193709, true }, { 193722, true }, - { 193735, true }, - { 193747, true }, + { 193734, true }, + { 193753, true }, { 193766, true }, - { 193779, true }, - { 193794, true }, - { 193805, true }, - { 193816, true }, - { 193826, true }, - { 193836, true }, - { 193858, true }, - { 193878, true }, - { 193895, true }, + { 193781, true }, + { 193792, true }, + { 193803, true }, + { 193813, true }, + { 193823, true }, + { 193845, true }, + { 193865, true }, + { 193882, true }, + { 193900, true }, { 193913, true }, { 193926, true }, - { 193939, true }, - { 193954, true }, - { 193963, true }, - { 193974, true }, - { 193989, true }, - { 194005, true }, - { 194027, true }, - { 194043, true }, - { 194059, true }, - { 194083, true }, + { 193941, true }, + { 193950, true }, + { 193961, true }, + { 193976, true }, + { 193992, true }, + { 194014, true }, + { 194030, true }, + { 194046, true }, + { 194070, true }, + { 194085, true }, { 194098, true }, - { 194111, true }, - { 194130, true }, - { 194140, true }, - { 194154, true }, - { 194165, true }, - { 194182, true }, + { 194117, true }, + { 194127, true }, + { 194141, true }, + { 194152, true }, + { 194169, true }, + { 194181, true }, { 194194, true }, - { 194207, true }, - { 194224, true }, - { 194236, true }, - { 194253, true }, - { 194262, true }, - { 194282, true }, - { 194302, true }, - { 194319, true }, - { 194334, true }, - { 194360, true }, - { 194378, true }, - { 194388, true }, - { 194405, true }, - { 194417, true }, - { 194434, true }, - { 194449, true }, - { 194468, true }, - { 194485, true }, - { 194502, true }, - { 194513, true }, - { 194525, true }, - { 194537, true }, - { 194547, true }, + { 194211, true }, + { 194223, true }, + { 194240, true }, + { 194249, true }, + { 194269, true }, + { 194289, true }, + { 194306, true }, + { 194321, true }, + { 194347, true }, + { 194365, true }, + { 194375, true }, + { 194392, true }, + { 194404, true }, + { 194421, true }, + { 194436, true }, + { 194455, true }, + { 194472, true }, + { 194489, true }, + { 194500, true }, + { 194512, true }, + { 194524, true }, + { 194534, true }, + { 194543, true }, { 194556, true }, - { 194569, true }, - { 194584, true }, - { 194594, true }, - { 194606, true }, - { 194620, false }, - { 194629, false }, - { 194641, true }, - { 194652, true }, - { 194669, true }, - { 194679, true }, - { 194689, true }, - { 194700, true }, - { 194709, true }, - { 194720, true }, - { 194732, false }, - { 194745, true }, - { 194761, true }, - { 194773, true }, - { 194784, true }, - { 194798, false }, - { 194809, true }, - { 194832, true }, - { 194854, true }, - { 194862, true }, - { 194872, true }, - { 194884, true }, - { 194897, true }, - { 194905, true }, - { 194913, true }, - { 194928, true }, - { 194938, true }, + { 194571, true }, + { 194581, true }, + { 194593, true }, + { 194607, false }, + { 194616, true }, + { 194627, true }, + { 194644, true }, + { 194654, true }, + { 194664, true }, + { 194675, true }, + { 194684, true }, + { 194695, false }, + { 194708, true }, + { 194724, true }, + { 194736, true }, + { 194747, true }, + { 194761, false }, + { 194772, true }, + { 194795, true }, + { 194817, true }, + { 194825, true }, + { 194835, true }, + { 194847, true }, + { 194860, true }, + { 194868, true }, + { 194876, true }, + { 194891, true }, + { 194901, true }, + { 194917, true }, + { 194930, true }, + { 194939, true }, { 194954, true }, - { 194967, true }, - { 194976, true }, - { 194991, true }, + { 194963, true }, + { 194972, true }, + { 194981, true }, { 195000, true }, - { 195009, true }, - { 195018, true }, - { 195037, true }, + { 195013, true }, + { 195028, true }, { 195050, true }, - { 195065, true }, - { 195087, true }, - { 195103, true }, - { 195116, true }, - { 195127, true }, - { 195139, true }, - { 195147, true }, - { 195161, true }, - { 195178, true }, - { 195191, true }, - { 195207, true }, - { 195228, true }, - { 195247, true }, - { 195264, true }, - { 195280, true }, - { 195293, true }, - { 195304, true }, - { 195318, true }, - { 195338, true }, - { 195362, true }, - { 195385, true }, - { 195396, true }, - { 195418, false }, - { 195431, true }, - { 195445, true }, - { 195459, false }, - { 195480, true }, - { 195490, true }, - { 195502, true }, - { 195514, true }, - { 195526, true }, - { 195545, true }, - { 195571, true }, - { 195584, true }, - { 195598, true }, - { 195615, true }, - { 195634, true }, - { 195651, true }, - { 195669, true }, - { 195684, true }, - { 195705, true }, - { 195719, true }, - { 195741, true }, - { 195760, true }, - { 195772, true }, - { 195785, true }, - { 195797, true }, - { 195821, true }, - { 195831, true }, - { 195844, true }, - { 195859, true }, - { 195876, true }, - { 195892, true }, - { 195910, true }, - { 195929, true }, - { 195946, true }, - { 195961, true }, - { 195977, true }, - { 196004, true }, - { 196018, true }, - { 196034, true }, - { 196049, true }, + { 195066, false }, + { 195078, true }, + { 195094, true }, + { 195107, true }, + { 195118, true }, + { 195130, true }, + { 195138, true }, + { 195152, true }, + { 195169, true }, + { 195182, true }, + { 195198, true }, + { 195219, true }, + { 195238, true }, + { 195255, true }, + { 195271, true }, + { 195284, true }, + { 195295, true }, + { 195309, true }, + { 195329, true }, + { 195353, true }, + { 195376, true }, + { 195387, true }, + { 195409, false }, + { 195422, true }, + { 195436, true }, + { 195450, false }, + { 195471, true }, + { 195481, true }, + { 195493, true }, + { 195505, true }, + { 195517, true }, + { 195536, true }, + { 195562, true }, + { 195575, true }, + { 195589, true }, + { 195606, true }, + { 195625, true }, + { 195642, true }, + { 195660, true }, + { 195675, true }, + { 195696, true }, + { 195710, true }, + { 195732, true }, + { 195751, true }, + { 195763, true }, + { 195776, true }, + { 195788, true }, + { 195812, true }, + { 195822, true }, + { 195835, true }, + { 195850, true }, + { 195867, true }, + { 195883, true }, + { 195901, true }, + { 195920, true }, + { 195937, true }, + { 195952, true }, + { 195968, true }, + { 195995, true }, + { 196009, true }, + { 196025, true }, + { 196040, true }, + { 196053, true }, { 196062, true }, - { 196071, true }, - { 196087, true }, - { 196102, true }, - { 196115, true }, - { 196128, true }, - { 196144, true }, - { 196156, true }, - { 196173, true }, - { 196188, true }, - { 196199, true }, - { 196211, true }, - { 196227, true }, - { 196250, true }, - { 196265, true }, - { 196275, true }, + { 196078, true }, + { 196093, true }, + { 196106, true }, + { 196119, true }, + { 196135, true }, + { 196147, true }, + { 196164, true }, + { 196179, true }, + { 196190, true }, + { 196202, true }, + { 196218, true }, + { 196241, true }, + { 196256, true }, + { 196266, true }, + { 196280, true }, { 196289, true }, - { 196298, true }, - { 196305, true }, - { 196319, true }, - { 196339, true }, - { 196350, true }, - { 196364, true }, - { 196377, false }, - { 196391, true }, - { 196399, true }, - { 196410, true }, - { 196428, true }, - { 196438, true }, - { 196455, true }, - { 196465, true }, - { 196476, true }, - { 196501, true }, - { 196515, true }, - { 196526, true }, - { 196537, true }, - { 196552, true }, - { 196567, true }, - { 196583, false }, - { 196594, true }, - { 196609, true }, - { 196624, false }, - { 196643, true }, - { 196654, true }, - { 196664, true }, - { 196675, true }, - { 196695, true }, - { 196706, true }, - { 196713, true }, - { 196726, true }, - { 196744, false }, - { 196754, true }, - { 196763, true }, - { 196773, true }, - { 196784, true }, - { 196795, true }, - { 196807, true }, - { 196818, true }, - { 196826, true }, - { 196836, true }, - { 196853, true }, - { 196870, true }, - { 196879, true }, - { 196886, true }, - { 196905, true }, - { 196916, true }, - { 196935, false }, - { 196946, true }, - { 196963, true }, - { 196980, true }, - { 196993, true }, - { 197009, true }, - { 197020, true }, - { 197030, true }, - { 197041, true }, - { 197058, true }, - { 197075, false }, - { 197083, true }, - { 197092, false }, - { 197105, true }, - { 197116, false }, - { 197123, true }, - { 197133, true }, - { 197147, true }, - { 197156, true }, - { 197170, true }, - { 197190, false }, - { 197202, false }, - { 197218, true }, - { 197230, true }, - { 197249, true }, - { 197259, true }, - { 197283, true }, - { 197291, true }, - { 197308, true }, - { 197324, true }, - { 197340, true }, - { 197353, true }, - { 197362, true }, - { 197374, true }, - { 197387, true }, - { 197402, true }, - { 197416, true }, - { 197432, false }, - { 197447, true }, - { 197456, true }, - { 197476, true }, - { 197484, true }, - { 197498, true }, - { 197511, true }, - { 197522, true }, - { 197532, false }, - { 197542, true }, - { 197556, true }, - { 197568, true }, - { 197578, false }, - { 197591, true }, - { 197607, true }, - { 197629, true }, - { 197646, true }, - { 197659, true }, - { 197668, true }, - { 197677, true }, - { 197692, true }, - { 197706, true }, - { 197716, true }, - { 197726, true }, - { 197755, true }, - { 197776, true }, - { 197791, true }, - { 197805, true }, - { 197825, true }, - { 197841, true }, - { 197853, false }, - { 197869, true }, - { 197883, true }, - { 197898, true }, - { 197913, true }, - { 197927, true }, - { 197940, true }, - { 197951, true }, - { 197962, true }, - { 197978, true }, - { 197988, true }, - { 198012, false }, - { 198031, false }, - { 198043, true }, - { 198059, true }, - { 198087, true }, - { 198119, true }, - { 198134, true }, - { 198146, true }, - { 198157, true }, - { 198166, true }, - { 198180, false }, - { 198193, true }, - { 198211, true }, - { 198219, true }, - { 198233, true }, - { 198247, true }, - { 198259, true }, - { 198280, true }, - { 198295, true }, - { 198311, false }, - { 198319, false }, - { 198331, true }, - { 198340, true }, - { 198350, true }, - { 198361, true }, - { 198373, true }, - { 198389, true }, - { 198405, true }, - { 198415, true }, - { 198426, true }, - { 198437, true }, - { 198449, true }, - { 198459, true }, - { 198468, true }, - { 198487, true }, - { 198515, true }, - { 198529, true }, - { 198543, true }, - { 198561, true }, - { 198578, true }, - { 198594, true }, - { 198605, true }, - { 198620, true }, - { 198633, false }, - { 198649, true }, - { 198665, true }, - { 198678, true }, - { 198696, true }, - { 198714, true }, - { 198728, true }, - { 198743, true }, - { 198763, true }, - { 198782, true }, - { 198801, true }, - { 198814, true }, - { 198830, true }, - { 198843, true }, - { 198858, true }, - { 198874, true }, - { 198891, true }, - { 198907, true }, - { 198924, true }, - { 198937, true }, - { 198952, true }, - { 198971, true }, - { 198984, true }, - { 199000, true }, - { 199011, true }, - { 199024, true }, - { 199038, true }, - { 199052, false }, - { 199068, true }, - { 199087, true }, - { 199107, true }, - { 199127, false }, - { 199143, true }, - { 199159, true }, - { 199174, true }, - { 199191, true }, - { 199212, true }, - { 199229, true }, - { 199247, false }, - { 199266, true }, - { 199277, true }, - { 199293, true }, - { 199307, true }, - { 199323, true }, - { 199336, true }, - { 199350, true }, - { 199363, true }, - { 199376, true }, - { 199392, true }, - { 199403, true }, - { 199412, true }, - { 199422, true }, + { 196296, true }, + { 196310, true }, + { 196330, true }, + { 196341, true }, + { 196355, true }, + { 196368, false }, + { 196382, true }, + { 196390, true }, + { 196401, true }, + { 196419, true }, + { 196429, true }, + { 196446, true }, + { 196456, true }, + { 196467, true }, + { 196492, true }, + { 196506, true }, + { 196517, true }, + { 196528, true }, + { 196543, true }, + { 196558, true }, + { 196574, false }, + { 196585, true }, + { 196600, true }, + { 196615, false }, + { 196634, true }, + { 196645, true }, + { 196655, true }, + { 196666, true }, + { 196686, true }, + { 196697, true }, + { 196704, true }, + { 196716, true }, + { 196729, true }, + { 196747, false }, + { 196757, true }, + { 196766, true }, + { 196776, true }, + { 196787, true }, + { 196798, true }, + { 196810, true }, + { 196821, true }, + { 196829, true }, + { 196839, true }, + { 196856, true }, + { 196873, true }, + { 196882, true }, + { 196889, true }, + { 196908, true }, + { 196919, true }, + { 196938, false }, + { 196949, true }, + { 196966, true }, + { 196983, true }, + { 196996, true }, + { 197012, true }, + { 197023, true }, + { 197033, true }, + { 197044, true }, + { 197061, true }, + { 197078, false }, + { 197086, true }, + { 197095, false }, + { 197108, true }, + { 197119, false }, + { 197126, true }, + { 197136, true }, + { 197150, true }, + { 197159, true }, + { 197173, true }, + { 197193, false }, + { 197205, false }, + { 197221, true }, + { 197233, true }, + { 197252, true }, + { 197262, true }, + { 197286, true }, + { 197294, true }, + { 197311, true }, + { 197327, true }, + { 197343, true }, + { 197356, true }, + { 197365, true }, + { 197377, true }, + { 197390, true }, + { 197405, true }, + { 197419, true }, + { 197435, false }, + { 197450, true }, + { 197459, true }, + { 197479, true }, + { 197487, true }, + { 197501, true }, + { 197514, true }, + { 197525, true }, + { 197535, false }, + { 197545, true }, + { 197559, true }, + { 197571, true }, + { 197581, false }, + { 197594, true }, + { 197610, true }, + { 197632, true }, + { 197649, true }, + { 197662, true }, + { 197671, true }, + { 197680, true }, + { 197695, true }, + { 197709, true }, + { 197719, true }, + { 197729, true }, + { 197758, true }, + { 197779, true }, + { 197794, true }, + { 197808, true }, + { 197828, true }, + { 197844, true }, + { 197856, false }, + { 197872, true }, + { 197886, true }, + { 197901, true }, + { 197916, true }, + { 197930, true }, + { 197943, true }, + { 197954, true }, + { 197965, true }, + { 197981, true }, + { 197991, true }, + { 198015, false }, + { 198034, false }, + { 198046, true }, + { 198062, true }, + { 198090, true }, + { 198122, true }, + { 198137, true }, + { 198149, true }, + { 198160, true }, + { 198169, true }, + { 198183, false }, + { 198196, true }, + { 198214, true }, + { 198222, true }, + { 198236, true }, + { 198250, true }, + { 198262, true }, + { 198283, true }, + { 198298, true }, + { 198314, false }, + { 198322, false }, + { 198334, true }, + { 198343, true }, + { 198353, true }, + { 198364, true }, + { 198376, true }, + { 198392, true }, + { 198408, true }, + { 198418, true }, + { 198429, true }, + { 198440, true }, + { 198452, true }, + { 198462, true }, + { 198471, true }, + { 198490, true }, + { 198518, true }, + { 198532, true }, + { 198546, true }, + { 198564, true }, + { 198581, true }, + { 198597, true }, + { 198608, true }, + { 198623, true }, + { 198636, false }, + { 198652, true }, + { 198668, true }, + { 198681, true }, + { 198699, true }, + { 198717, true }, + { 198731, true }, + { 198746, true }, + { 198766, true }, + { 198785, true }, + { 198804, true }, + { 198817, true }, + { 198833, true }, + { 198846, true }, + { 198861, true }, + { 198877, true }, + { 198894, true }, + { 198910, true }, + { 198927, true }, + { 198940, true }, + { 198955, true }, + { 198974, true }, + { 198987, true }, + { 199003, true }, + { 199014, true }, + { 199027, true }, + { 199041, true }, + { 199055, false }, + { 199071, true }, + { 199090, true }, + { 199110, true }, + { 199130, false }, + { 199146, true }, + { 199162, true }, + { 199177, true }, + { 199194, true }, + { 199215, true }, + { 199232, true }, + { 199250, false }, + { 199269, true }, + { 199280, true }, + { 199296, true }, + { 199310, true }, + { 199326, true }, + { 199339, true }, + { 199353, true }, + { 199366, true }, + { 199379, true }, + { 199395, true }, + { 199406, true }, + { 199414, true }, + { 199423, true }, { 199433, true }, - { 199445, true }, - { 199459, true }, - { 199468, true }, - { 199485, true }, - { 199494, true }, - { 199507, true }, - { 199526, true }, - { 199547, true }, - { 199566, true }, - { 199583, false }, - { 199598, false }, - { 199614, false }, - { 199626, true }, - { 199646, true }, - { 199659, true }, - { 199679, true }, - { 199701, true }, - { 199724, true }, - { 199742, true }, - { 199758, true }, - { 199770, true }, - { 199783, true }, - { 199795, true }, - { 199809, true }, - { 199818, true }, - { 199832, true }, - { 199840, true }, - { 199858, true }, - { 199868, true }, - { 199888, true }, - { 199905, true }, - { 199925, true }, + { 199444, true }, + { 199456, true }, + { 199470, true }, + { 199479, true }, + { 199496, true }, + { 199505, true }, + { 199518, true }, + { 199537, true }, + { 199558, true }, + { 199577, true }, + { 199594, false }, + { 199609, false }, + { 199625, false }, + { 199637, true }, + { 199657, true }, + { 199670, true }, + { 199690, true }, + { 199712, true }, + { 199735, true }, + { 199753, true }, + { 199769, true }, + { 199781, true }, + { 199794, true }, + { 199806, true }, + { 199820, true }, + { 199829, true }, + { 199843, true }, + { 199851, true }, + { 199869, true }, + { 199879, true }, + { 199899, true }, + { 199916, true }, { 199936, true }, - { 199949, true }, - { 199964, true }, - { 199976, true }, - { 199992, true }, - { 200005, true }, - { 200022, true }, - { 200043, true }, - { 200051, true }, - { 200061, true }, - { 200084, true }, - { 200096, true }, - { 200105, true }, - { 200115, true }, - { 200128, true }, - { 200138, true }, - { 200153, true }, - { 200166, false }, - { 200176, true }, - { 200190, true }, - { 200210, true }, - { 200223, true }, - { 200243, false }, - { 200266, true }, - { 200279, true }, + { 199947, true }, + { 199960, true }, + { 199975, true }, + { 199987, true }, + { 200003, true }, + { 200016, true }, + { 200033, true }, + { 200054, true }, + { 200062, true }, + { 200072, true }, + { 200095, true }, + { 200107, true }, + { 200116, true }, + { 200126, true }, + { 200139, true }, + { 200149, true }, + { 200164, true }, + { 200177, false }, + { 200187, true }, + { 200201, true }, + { 200221, true }, + { 200234, true }, + { 200254, false }, + { 200277, true }, { 200290, true }, { 200301, true }, - { 200311, true }, - { 200336, true }, - { 200346, true }, - { 200360, true }, - { 200374, false }, - { 200389, true }, - { 200403, true }, - { 200428, true }, - { 200442, true }, - { 200454, true }, - { 200466, true }, - { 200480, true }, - { 200490, false }, - { 200510, true }, - { 200520, true }, - { 200534, true }, - { 200544, true }, - { 200557, true }, - { 200572, true }, - { 200581, true }, - { 200591, true }, - { 200605, true }, - { 200614, true }, + { 200312, true }, + { 200322, true }, + { 200347, true }, + { 200357, true }, + { 200371, true }, + { 200385, false }, + { 200400, true }, + { 200414, true }, + { 200439, true }, + { 200453, true }, + { 200465, true }, + { 200477, true }, + { 200491, true }, + { 200501, false }, + { 200521, true }, + { 200531, true }, + { 200545, true }, + { 200555, true }, + { 200568, true }, + { 200583, true }, + { 200592, true }, + { 200602, true }, + { 200616, true }, { 200625, true }, { 200636, true }, { 200647, true }, - { 200657, false }, - { 200677, true }, - { 200692, true }, - { 200704, true }, - { 200716, true }, - { 200728, true }, - { 200747, true }, - { 200767, true }, - { 200777, true }, - { 200791, true }, - { 200806, true }, - { 200823, true }, - { 200838, true }, - { 200846, true }, - { 200867, false }, - { 200885, true }, - { 200897, true }, - { 200919, true }, - { 200935, true }, - { 200950, true }, + { 200658, true }, + { 200668, false }, + { 200688, true }, + { 200703, true }, + { 200715, true }, + { 200727, true }, + { 200739, true }, + { 200758, true }, + { 200778, true }, + { 200788, true }, + { 200802, true }, + { 200817, true }, + { 200834, true }, + { 200849, true }, + { 200857, true }, + { 200878, false }, + { 200896, true }, + { 200908, true }, + { 200930, true }, + { 200946, true }, { 200961, true }, - { 200983, true }, - { 200997, true }, - { 201018, true }, - { 201032, true }, - { 201049, true }, - { 201068, true }, - { 201087, true }, - { 201100, true }, - { 201120, true }, - { 201136, true }, - { 201162, true }, - { 201183, true }, - { 201202, true }, - { 201224, true }, - { 201248, true }, - { 201264, true }, - { 201289, true }, - { 201315, true }, + { 200972, true }, + { 200994, true }, + { 201008, true }, + { 201029, true }, + { 201043, true }, + { 201060, true }, + { 201079, true }, + { 201098, true }, + { 201111, true }, + { 201131, true }, + { 201147, true }, + { 201173, true }, + { 201194, true }, + { 201213, true }, + { 201235, true }, + { 201259, true }, + { 201275, true }, + { 201300, true }, { 201326, true }, - { 201350, true }, - { 201376, true }, - { 201394, true }, + { 201337, true }, + { 201361, true }, + { 201387, true }, { 201405, true }, - { 201427, true }, - { 201448, false }, - { 201465, true }, - { 201482, true }, - { 201500, true }, - { 201510, true }, - { 201526, false }, - { 201544, false }, - { 201563, true }, - { 201585, true }, - { 201608, true }, - { 201620, true }, - { 201639, true }, - { 201657, true }, - { 201680, true }, - { 201693, true }, - { 201709, true }, - { 201727, true }, - { 201745, true }, - { 201771, true }, - { 201785, true }, - { 201803, true }, - { 201818, true }, - { 201835, true }, - { 201849, true }, - { 201876, true }, - { 201890, true }, - { 201908, true }, - { 201924, true }, - { 201940, true }, - { 201953, true }, - { 201973, true }, - { 201991, true }, - { 202010, true }, - { 202023, true }, - { 202059, true }, - { 202082, true }, - { 202102, true }, - { 202117, true }, - { 202134, true }, - { 202145, true }, - { 202163, true }, - { 202193, true }, - { 202209, true }, - { 202224, true }, - { 202239, true }, - { 202250, true }, - { 202264, true }, - { 202286, true }, - { 202301, true }, - { 202316, true }, - { 202329, true }, - { 202344, true }, - { 202357, true }, - { 202380, true }, - { 202389, true }, - { 202411, true }, - { 202421, true }, + { 201416, true }, + { 201438, true }, + { 201459, true }, + { 201476, true }, + { 201494, true }, + { 201504, true }, + { 201520, false }, + { 201539, true }, + { 201561, true }, + { 201584, true }, + { 201596, true }, + { 201615, true }, + { 201633, true }, + { 201656, true }, + { 201669, true }, + { 201685, true }, + { 201703, true }, + { 201721, true }, + { 201747, true }, + { 201761, true }, + { 201779, true }, + { 201794, true }, + { 201811, true }, + { 201825, true }, + { 201852, true }, + { 201866, true }, + { 201884, true }, + { 201900, true }, + { 201916, true }, + { 201929, true }, + { 201949, true }, + { 201967, true }, + { 201986, true }, + { 201999, true }, + { 202035, true }, + { 202058, true }, + { 202078, true }, + { 202093, true }, + { 202110, true }, + { 202121, true }, + { 202139, true }, + { 202169, true }, + { 202185, true }, + { 202200, true }, + { 202215, true }, + { 202226, true }, + { 202240, true }, + { 202262, true }, + { 202277, true }, + { 202292, true }, + { 202305, true }, + { 202320, true }, + { 202333, true }, + { 202356, true }, + { 202365, true }, + { 202387, true }, + { 202397, true }, + { 202416, true }, { 202440, true }, - { 202464, true }, - { 202490, true }, - { 202508, true }, - { 202519, true }, - { 202536, true }, - { 202554, true }, - { 202570, true }, - { 202584, true }, - { 202597, true }, - { 202613, true }, + { 202466, true }, + { 202484, true }, + { 202495, true }, + { 202512, true }, + { 202530, true }, + { 202546, true }, + { 202560, true }, + { 202573, true }, + { 202589, true }, + { 202608, true }, { 202632, true }, - { 202656, true }, - { 202669, true }, - { 202686, true }, - { 202697, true }, - { 202712, true }, - { 202734, true }, - { 202753, true }, - { 202773, true }, - { 202790, false }, - { 202805, true }, - { 202823, true }, - { 202845, true }, + { 202645, true }, + { 202662, true }, + { 202673, true }, + { 202688, true }, + { 202710, true }, + { 202729, true }, + { 202749, true }, + { 202766, false }, + { 202781, true }, + { 202799, true }, + { 202821, true }, + { 202837, true }, + { 202849, true }, { 202861, true }, { 202873, true }, - { 202885, true }, - { 202897, true }, - { 202913, true }, - { 202932, true }, - { 202952, true }, - { 202972, true }, - { 202988, true }, - { 203007, true }, - { 203037, false }, - { 203051, true }, - { 203068, true }, - { 203089, true }, - { 203109, true }, - { 203123, true }, - { 203141, true }, - { 203158, true }, - { 203174, true }, - { 203184, true }, - { 203195, true }, - { 203207, true }, - { 203226, true }, - { 203242, true }, - { 203262, true }, + { 202889, true }, + { 202908, true }, + { 202928, true }, + { 202948, true }, + { 202964, true }, + { 202983, true }, + { 203013, false }, + { 203027, true }, + { 203044, true }, + { 203065, true }, + { 203085, true }, + { 203099, true }, + { 203117, true }, + { 203134, true }, + { 203150, true }, + { 203160, true }, + { 203171, true }, + { 203183, true }, + { 203202, true }, + { 203218, true }, + { 203238, true }, + { 203252, true }, + { 203265, true }, { 203276, true }, - { 203289, true }, - { 203300, true }, - { 203321, true }, - { 203349, true }, - { 203365, true }, - { 203390, true }, - { 203407, true }, - { 203424, false }, - { 203439, true }, - { 203464, true }, - { 203473, true }, - { 203483, true }, - { 203495, true }, - { 203514, true }, - { 203533, true }, - { 203550, true }, - { 203567, true }, - { 203583, false }, - { 203601, true }, - { 203618, true }, - { 203631, true }, + { 203297, true }, + { 203325, true }, + { 203341, true }, + { 203366, true }, + { 203383, true }, + { 203400, false }, + { 203415, true }, + { 203440, true }, + { 203449, true }, + { 203459, true }, + { 203471, true }, + { 203490, true }, + { 203509, true }, + { 203526, true }, + { 203543, true }, + { 203559, false }, + { 203577, true }, + { 203594, true }, + { 203607, true }, + { 203627, true }, { 203651, true }, - { 203675, true }, - { 203693, true }, - { 203714, true }, - { 203729, true }, - { 203744, true }, - { 203756, true }, - { 203781, true }, - { 203794, true }, - { 203816, true }, - { 203826, true }, - { 203843, true }, - { 203862, true }, - { 203875, true }, - { 203889, true }, + { 203669, true }, + { 203690, true }, + { 203705, true }, + { 203720, true }, + { 203732, true }, + { 203757, true }, + { 203770, true }, + { 203792, true }, + { 203802, true }, + { 203819, true }, + { 203838, true }, + { 203851, true }, + { 203865, true }, + { 203878, true }, { 203902, true }, - { 203926, true }, - { 203948, true }, - { 203981, true }, - { 203996, true }, - { 204010, true }, - { 204019, true }, - { 204028, true }, + { 203924, true }, + { 203957, true }, + { 203972, true }, + { 203986, true }, + { 203995, true }, + { 204004, true }, + { 204018, true }, + { 204028, false }, { 204042, true }, - { 204052, false }, - { 204066, true }, - { 204075, true }, - { 204086, true }, - { 204100, true }, - { 204111, true }, - { 204129, true }, - { 204144, true }, - { 204157, true }, - { 204167, true }, - { 204180, true }, - { 204199, true }, - { 204219, true }, - { 204242, true }, - { 204249, true }, - { 204265, true }, - { 204283, true }, - { 204304, true }, - { 204316, true }, - { 204346, true }, - { 204359, true }, - { 204369, true }, - { 204381, true }, - { 204395, true }, - { 204409, true }, - { 204420, true }, - { 204439, true }, + { 204051, true }, + { 204062, true }, + { 204076, true }, + { 204087, true }, + { 204105, true }, + { 204120, true }, + { 204133, true }, + { 204143, true }, + { 204156, true }, + { 204175, true }, + { 204195, true }, + { 204218, true }, + { 204225, true }, + { 204241, true }, + { 204259, true }, + { 204280, true }, + { 204292, true }, + { 204322, true }, + { 204335, true }, + { 204345, true }, + { 204357, true }, + { 204371, true }, + { 204385, true }, + { 204396, true }, + { 204415, true }, + { 204430, true }, + { 204442, true }, { 204454, true }, - { 204466, true }, - { 204478, true }, - { 204489, true }, - { 204504, true }, - { 204516, true }, - { 204532, true }, - { 204547, true }, - { 204563, true }, - { 204572, true }, - { 204586, true }, - { 204597, false }, - { 204612, true }, - { 204626, true }, - { 204642, true }, - { 204655, true }, - { 204675, true }, - { 204688, false }, - { 204708, true }, - { 204721, true }, - { 204735, true }, - { 204746, true }, - { 204763, true }, - { 204777, true }, - { 204789, true }, + { 204465, true }, + { 204480, true }, + { 204492, true }, + { 204508, true }, + { 204523, true }, + { 204539, true }, + { 204548, true }, + { 204562, true }, + { 204573, false }, + { 204588, true }, + { 204602, true }, + { 204618, true }, + { 204631, true }, + { 204651, true }, + { 204664, false }, + { 204684, true }, + { 204697, true }, + { 204711, true }, + { 204722, true }, + { 204739, true }, + { 204753, true }, + { 204765, true }, + { 204779, true }, + { 204791, true }, { 204803, true }, { 204815, true }, { 204827, true }, - { 204839, true }, - { 204851, true }, - { 204861, true }, - { 204874, true }, - { 204891, true }, - { 204918, true }, - { 204931, true }, - { 204949, true }, - { 204957, true }, - { 204969, true }, - { 204982, true }, - { 205009, true }, - { 205018, true }, - { 205027, true }, - { 205045, true }, - { 205052, true }, - { 205079, true }, - { 205087, true }, - { 205097, true }, - { 205105, true }, - { 205118, true }, - { 205127, true }, - { 205139, true }, - { 205152, true }, - { 205161, true }, - { 205171, true }, - { 205181, true }, - { 205191, true }, - { 205201, true }, - { 205211, true }, - { 205220, true }, - { 205227, true }, - { 205243, true }, - { 205260, true }, - { 205267, true }, - { 205281, true }, - { 205298, true }, - { 205310, true }, + { 204837, true }, + { 204850, true }, + { 204867, true }, + { 204894, true }, + { 204907, true }, + { 204925, true }, + { 204933, true }, + { 204945, true }, + { 204958, true }, + { 204985, true }, + { 204994, true }, + { 205003, true }, + { 205021, true }, + { 205028, true }, + { 205055, true }, + { 205063, true }, + { 205073, true }, + { 205082, true }, + { 205090, true }, + { 205103, true }, + { 205112, true }, + { 205124, true }, + { 205137, true }, + { 205146, true }, + { 205156, true }, + { 205166, true }, + { 205176, true }, + { 205186, true }, + { 205196, true }, + { 205205, true }, + { 205212, true }, + { 205228, true }, + { 205245, true }, + { 205252, true }, + { 205266, true }, + { 205283, true }, + { 205295, true }, + { 205312, true }, + { 205320, true }, { 205327, true }, - { 205335, true }, - { 205342, true }, - { 205351, true }, - { 205360, true }, - { 205372, true }, - { 205386, true }, - { 205403, true }, - { 205419, true }, - { 205435, true }, - { 205454, true }, + { 205336, true }, + { 205345, true }, + { 205357, true }, + { 205371, true }, + { 205388, true }, + { 205404, true }, + { 205420, true }, + { 205439, true }, + { 205457, true }, { 205472, true }, - { 205487, true }, - { 205505, true }, - { 205522, true }, - { 205532, true }, - { 205544, true }, - { 205562, true }, + { 205490, true }, + { 205507, true }, + { 205517, true }, + { 205529, true }, + { 205547, true }, + { 205564, true }, { 205579, true }, { 205594, true }, - { 205609, true }, - { 205621, true }, - { 205635, true }, - { 205643, true }, - { 205653, false }, - { 205678, true }, - { 205691, true }, - { 205706, true }, - { 205718, true }, - { 205732, true }, - { 205741, true }, - { 205750, false }, - { 205762, true }, - { 205775, false }, - { 205808, true }, - { 205823, true }, - { 205834, true }, - { 205857, true }, - { 205870, true }, - { 205881, true }, - { 205895, true }, - { 205915, true }, - { 205928, true }, - { 205942, true }, - { 205955, true }, - { 205969, true }, - { 205987, true }, - { 206001, true }, - { 206017, true }, - { 206032, true }, - { 206054, true }, - { 206064, true }, - { 206076, true }, - { 206092, true }, - { 206104, true }, - { 206114, true }, - { 206127, true }, - { 206141, true }, - { 206152, true }, - { 206161, true }, - { 206169, true }, - { 206181, false }, - { 206189, true }, - { 206200, true }, - { 206216, true }, - { 206227, true }, - { 206240, true }, - { 206252, false }, - { 206266, true }, - { 206279, true }, - { 206290, true }, - { 206300, true }, - { 206314, true }, - { 206333, true }, - { 206344, true }, - { 206358, true }, - { 206369, true }, - { 206380, true }, - { 206391, true }, - { 206402, true }, - { 206413, true }, - { 206427, true }, - { 206439, true }, - { 206454, true }, - { 206468, true }, - { 206483, true }, - { 206496, true }, - { 206512, true }, - { 206521, true }, - { 206530, true }, - { 206544, true }, - { 206555, false }, - { 206571, true }, - { 206582, true }, - { 206593, true }, - { 206603, true }, - { 206619, false }, - { 206633, true }, - { 206646, true }, - { 206655, true }, - { 206665, true }, - { 206678, true }, - { 206688, true }, - { 206702, true }, - { 206712, true }, - { 206725, true }, - { 206739, true }, - { 206751, true }, - { 206765, true }, - { 206786, true }, - { 206801, true }, - { 206815, true }, - { 206827, true }, - { 206842, false }, - { 206861, true }, - { 206871, true }, - { 206883, true }, - { 206893, true }, - { 206905, true }, - { 206922, true }, - { 206941, true }, - { 206950, false }, - { 206965, true }, - { 206983, true }, - { 206999, false }, - { 207011, true }, - { 207037, true }, - { 207048, true }, - { 207069, true }, - { 207084, true }, - { 207102, true }, - { 207119, true }, - { 207132, true }, - { 207148, true }, - { 207163, true }, - { 207183, true }, - { 207194, true }, - { 207209, true }, - { 207221, true }, - { 207232, true }, - { 207245, true }, - { 207263, true }, - { 207283, true }, - { 207302, true }, - { 207330, true }, - { 207344, true }, - { 207363, true }, - { 207384, true }, - { 207393, true }, - { 207417, false }, - { 207436, true }, - { 207450, true }, - { 207468, true }, - { 207483, true }, - { 207500, true }, - { 207520, true }, - { 207534, true }, - { 207544, true }, - { 207562, true }, - { 207575, true }, - { 207596, true }, - { 207608, true }, - { 207619, true }, - { 207634, true }, - { 207655, true }, - { 207674, true }, - { 207703, true }, - { 207710, true }, - { 207722, true }, - { 207737, true }, - { 207753, true }, + { 205606, true }, + { 205620, true }, + { 205628, true }, + { 205638, false }, + { 205663, true }, + { 205676, true }, + { 205686, true }, + { 205701, true }, + { 205713, true }, + { 205727, true }, + { 205736, true }, + { 205745, false }, + { 205757, true }, + { 205770, false }, + { 205803, true }, + { 205818, true }, + { 205829, true }, + { 205852, true }, + { 205865, true }, + { 205876, true }, + { 205890, true }, + { 205910, true }, + { 205923, true }, + { 205937, true }, + { 205950, true }, + { 205964, true }, + { 205982, true }, + { 205996, true }, + { 206012, true }, + { 206027, true }, + { 206049, true }, + { 206059, true }, + { 206071, true }, + { 206087, true }, + { 206099, true }, + { 206109, true }, + { 206122, true }, + { 206136, true }, + { 206147, true }, + { 206156, true }, + { 206164, true }, + { 206176, false }, + { 206184, true }, + { 206195, true }, + { 206211, true }, + { 206222, true }, + { 206235, true }, + { 206247, false }, + { 206261, true }, + { 206274, true }, + { 206285, true }, + { 206295, true }, + { 206309, true }, + { 206328, true }, + { 206339, true }, + { 206353, true }, + { 206364, true }, + { 206375, true }, + { 206386, true }, + { 206397, true }, + { 206408, true }, + { 206422, true }, + { 206434, true }, + { 206449, true }, + { 206463, true }, + { 206478, true }, + { 206491, true }, + { 206507, true }, + { 206516, true }, + { 206525, true }, + { 206539, true }, + { 206550, false }, + { 206566, true }, + { 206577, true }, + { 206588, true }, + { 206598, true }, + { 206614, false }, + { 206628, true }, + { 206641, true }, + { 206650, true }, + { 206660, true }, + { 206673, true }, + { 206683, true }, + { 206697, true }, + { 206707, true }, + { 206720, true }, + { 206734, true }, + { 206746, true }, + { 206760, true }, + { 206781, true }, + { 206796, true }, + { 206810, true }, + { 206822, true }, + { 206837, false }, + { 206856, true }, + { 206866, true }, + { 206878, true }, + { 206888, true }, + { 206900, true }, + { 206919, true }, + { 206928, false }, + { 206943, true }, + { 206961, true }, + { 206977, false }, + { 206989, true }, + { 207015, true }, + { 207026, true }, + { 207047, true }, + { 207062, true }, + { 207080, true }, + { 207097, true }, + { 207110, true }, + { 207126, true }, + { 207141, true }, + { 207161, true }, + { 207172, true }, + { 207187, true }, + { 207199, true }, + { 207210, true }, + { 207223, true }, + { 207241, true }, + { 207261, true }, + { 207280, true }, + { 207308, true }, + { 207322, true }, + { 207341, true }, + { 207362, true }, + { 207371, true }, + { 207395, false }, + { 207414, true }, + { 207428, true }, + { 207446, true }, + { 207461, true }, + { 207478, true }, + { 207498, true }, + { 207512, true }, + { 207522, true }, + { 207540, true }, + { 207553, true }, + { 207574, true }, + { 207586, true }, + { 207597, true }, + { 207612, true }, + { 207633, true }, + { 207652, true }, + { 207681, true }, + { 207688, true }, + { 207700, true }, + { 207715, true }, + { 207731, true }, + { 207748, true }, { 207770, true }, + { 207780, true }, { 207792, true }, - { 207802, true }, - { 207814, true }, - { 207826, true }, - { 207843, true }, - { 207852, false }, - { 207865, false }, + { 207804, true }, + { 207821, true }, + { 207830, false }, + { 207843, false }, + { 207863, true }, + { 207873, true }, { 207885, true }, - { 207895, true }, - { 207907, true }, - { 207924, true }, - { 207940, true }, - { 207955, true }, - { 207973, true }, - { 207986, true }, - { 208001, true }, - { 208014, true }, - { 208030, true }, - { 208048, true }, - { 208060, true }, - { 208079, true }, - { 208093, true }, - { 208106, true }, - { 208117, true }, - { 208137, true }, - { 208148, true }, - { 208167, true }, + { 207902, true }, + { 207918, true }, + { 207933, true }, + { 207951, true }, + { 207964, true }, + { 207979, true }, + { 207992, true }, + { 208008, true }, + { 208026, true }, + { 208038, true }, + { 208057, true }, + { 208071, true }, + { 208084, true }, + { 208095, true }, + { 208115, true }, + { 208126, true }, + { 208145, true }, + { 208164, true }, + { 208174, true }, { 208186, true }, - { 208196, true }, - { 208208, true }, - { 208228, true }, - { 208245, true }, - { 208258, true }, - { 208271, true }, - { 208284, true }, - { 208297, true }, - { 208310, true }, - { 208321, true }, - { 208333, true }, - { 208348, true }, - { 208358, true }, - { 208371, true }, - { 208389, true }, - { 208407, true }, - { 208426, true }, - { 208438, true }, - { 208451, true }, + { 208206, true }, + { 208223, true }, + { 208236, true }, + { 208249, true }, + { 208262, true }, + { 208275, true }, + { 208288, true }, + { 208299, true }, + { 208311, true }, + { 208326, true }, + { 208336, true }, + { 208349, true }, + { 208367, true }, + { 208385, true }, + { 208404, true }, + { 208416, true }, + { 208429, true }, + { 208447, true }, { 208469, true }, - { 208491, true }, - { 208504, true }, - { 208521, true }, - { 208541, true }, - { 208557, true }, - { 208585, true }, - { 208610, true }, - { 208642, true }, - { 208661, true }, - { 208681, true }, - { 208696, true }, - { 208716, true }, - { 208729, true }, - { 208745, true }, - { 208762, true }, - { 208779, true }, - { 208791, true }, - { 208804, true }, - { 208817, true }, + { 208482, true }, + { 208499, true }, + { 208519, true }, + { 208535, true }, + { 208563, true }, + { 208588, true }, + { 208620, true }, + { 208639, true }, + { 208659, true }, + { 208674, true }, + { 208694, true }, + { 208707, true }, + { 208723, true }, + { 208740, true }, + { 208757, true }, + { 208769, true }, + { 208782, true }, + { 208795, true }, + { 208820, true }, { 208842, true }, - { 208864, true }, - { 208882, true }, - { 208896, true }, - { 208917, true }, - { 208929, true }, - { 208944, true }, - { 208961, true }, - { 208973, true }, - { 208988, true }, - { 208999, true }, - { 209013, true }, - { 209032, true }, - { 209049, true }, + { 208860, true }, + { 208874, true }, + { 208895, true }, + { 208907, true }, + { 208922, true }, + { 208939, true }, + { 208951, true }, + { 208966, true }, + { 208977, true }, + { 208991, true }, + { 209010, true }, + { 209027, true }, + { 209042, true }, + { 209052, true }, { 209064, true }, - { 209074, true }, - { 209086, true }, - { 209106, true }, - { 209120, true }, - { 209130, true }, - { 209143, true }, - { 209162, true }, - { 209176, true }, - { 209190, true }, + { 209084, true }, + { 209098, true }, + { 209108, true }, + { 209121, true }, + { 209140, true }, + { 209154, true }, + { 209168, true }, + { 209182, true }, + { 209192, true }, { 209204, true }, - { 209214, true }, - { 209226, true }, - { 209244, false }, - { 209252, true }, - { 209268, true }, - { 209280, true }, - { 209292, true }, - { 209303, true }, - { 209315, true }, - { 209324, true }, - { 209338, true }, - { 209352, true }, - { 209366, true }, - { 209384, true }, - { 209395, true }, - { 209403, true }, - { 209419, true }, - { 209434, true }, - { 209452, true }, - { 209472, true }, - { 209485, true }, - { 209493, true }, - { 209514, true }, - { 209525, true }, - { 209540, false }, - { 209558, false }, - { 209579, true }, - { 209588, true }, - { 209611, true }, - { 209634, true }, - { 209651, true }, - { 209663, true }, - { 209684, true }, + { 209222, false }, + { 209230, true }, + { 209246, true }, + { 209258, true }, + { 209269, true }, + { 209281, true }, + { 209290, true }, + { 209304, true }, + { 209318, true }, + { 209332, true }, + { 209350, true }, + { 209361, true }, + { 209369, true }, + { 209385, true }, + { 209400, true }, + { 209418, true }, + { 209438, true }, + { 209451, true }, + { 209459, true }, + { 209480, true }, + { 209491, true }, + { 209506, false }, + { 209524, false }, + { 209545, true }, + { 209554, true }, + { 209577, true }, + { 209600, true }, + { 209617, true }, + { 209629, true }, + { 209650, true }, + { 209676, true }, + { 209693, true }, { 209710, true }, - { 209727, true }, - { 209744, true }, - { 209764, true }, - { 209777, true }, - { 209791, true }, + { 209730, true }, + { 209743, true }, + { 209757, true }, + { 209779, true }, + { 209796, true }, { 209813, true }, - { 209830, true }, - { 209847, true }, - { 209867, true }, - { 209892, true }, - { 209917, true }, - { 209943, true }, - { 209959, true }, - { 209970, true }, + { 209833, true }, + { 209858, true }, + { 209883, true }, + { 209909, true }, + { 209925, true }, + { 209936, true }, + { 209951, true }, + { 209960, true }, + { 209971, true }, { 209985, true }, { 209994, true }, - { 210005, true }, - { 210019, true }, - { 210028, true }, + { 210007, true }, + { 210029, true }, { 210041, true }, + { 210049, true }, { 210063, true }, - { 210075, true }, - { 210083, true }, - { 210097, true }, - { 210105, true }, - { 210116, true }, - { 210126, true }, - { 210136, true }, - { 210143, true }, - { 210154, true }, - { 210166, true }, - { 210176, true }, + { 210071, true }, + { 210082, true }, + { 210092, true }, + { 210102, true }, + { 210109, true }, + { 210120, true }, + { 210132, true }, + { 210142, true }, + { 210149, true }, + { 210161, true }, + { 210174, true }, { 210183, true }, - { 210195, true }, - { 210208, true }, - { 210217, true }, - { 210227, true }, - { 210237, true }, - { 210248, true }, - { 210259, true }, - { 210267, true }, - { 210280, true }, - { 210292, true }, - { 210303, true }, - { 210317, true }, - { 210343, false }, - { 210357, true }, - { 210373, true }, - { 210389, true }, - { 210402, true }, - { 210414, true }, - { 210427, true }, - { 210439, true }, - { 210460, true }, - { 210472, true }, - { 210482, true }, - { 210504, true }, - { 210535, true }, - { 210552, true }, - { 210565, true }, - { 210576, false }, + { 210193, true }, + { 210203, true }, + { 210214, true }, + { 210225, true }, + { 210233, true }, + { 210246, true }, + { 210258, true }, + { 210269, true }, + { 210283, true }, + { 210309, false }, + { 210323, true }, + { 210339, true }, + { 210355, true }, + { 210368, true }, + { 210380, true }, + { 210393, true }, + { 210405, true }, + { 210426, true }, + { 210438, true }, + { 210448, true }, + { 210470, true }, + { 210501, true }, + { 210518, true }, + { 210531, true }, + { 210542, false }, + { 210553, true }, + { 210563, true }, + { 210575, true }, { 210587, true }, - { 210597, true }, - { 210609, true }, - { 210621, true }, - { 210635, true }, - { 210646, false }, - { 210659, false }, - { 210679, true }, - { 210689, true }, - { 210697, false }, - { 210706, true }, - { 210719, true }, - { 210777, true }, - { 210823, true }, - { 210877, true }, - { 210924, true }, - { 210973, true }, - { 211018, true }, - { 211068, true }, - { 211122, true }, - { 211168, true }, - { 211215, true }, - { 211269, true }, - { 211296, true }, - { 211329, true }, - { 211342, true }, - { 211355, true }, - { 211371, true }, - { 211394, true }, - { 211410, true }, - { 211423, true }, - { 211439, true }, - { 211449, true }, - { 211460, false }, + { 210601, true }, + { 210612, false }, + { 210625, false }, + { 210645, true }, + { 210655, true }, + { 210663, false }, + { 210672, true }, + { 210685, true }, + { 210743, true }, + { 210789, true }, + { 210843, true }, + { 210890, true }, + { 210939, true }, + { 210984, true }, + { 211034, true }, + { 211088, true }, + { 211134, true }, + { 211181, true }, + { 211235, true }, + { 211262, true }, + { 211295, true }, + { 211308, true }, + { 211321, true }, + { 211337, true }, + { 211360, true }, + { 211376, true }, + { 211389, true }, + { 211405, true }, + { 211415, true }, + { 211426, false }, + { 211438, true }, + { 211455, true }, { 211472, true }, - { 211489, true }, - { 211506, true }, - { 211524, true }, + { 211490, true }, + { 211504, true }, + { 211522, true }, { 211538, true }, - { 211556, true }, - { 211572, true }, - { 211583, true }, + { 211549, true }, + { 211560, true }, + { 211568, true }, + { 211578, true }, + { 211585, true }, { 211594, true }, { 211602, true }, { 211612, true }, { 211619, true }, { 211628, true }, - { 211636, true }, { 211646, true }, - { 211653, true }, { 211662, true }, - { 211680, true }, - { 211696, true }, - { 211715, true }, - { 211728, true }, - { 211742, true }, - { 211754, true }, - { 211768, true }, - { 211783, true }, + { 211681, true }, + { 211694, true }, + { 211708, true }, + { 211720, true }, + { 211734, true }, + { 211749, true }, + { 211761, true }, + { 211774, true }, + { 211785, true }, { 211795, true }, - { 211808, true }, - { 211819, true }, - { 211829, true }, - { 211838, true }, - { 211847, true }, - { 211854, true }, - { 211861, true }, - { 211885, true }, - { 211899, true }, - { 211916, false }, - { 211931, true }, - { 211945, true }, - { 211957, true }, - { 211971, true }, - { 211988, true }, + { 211804, true }, + { 211813, true }, + { 211820, true }, + { 211827, true }, + { 211851, true }, + { 211865, true }, + { 211882, false }, + { 211897, true }, + { 211911, true }, + { 211923, true }, + { 211937, true }, + { 211954, true }, + { 211965, true }, + { 211977, true }, + { 211989, true }, { 211999, true }, - { 212011, true }, - { 212023, true }, - { 212033, true }, - { 212044, true }, - { 212059, true }, - { 212069, true }, - { 212088, true }, + { 212010, true }, + { 212025, true }, + { 212035, true }, + { 212054, true }, + { 212066, true }, + { 212073, true }, + { 212089, true }, { 212100, true }, - { 212107, true }, - { 212123, true }, - { 212134, true }, - { 212149, true }, - { 212172, true }, - { 212179, true }, - { 212189, true }, - { 212199, true }, - { 212211, true }, - { 212227, true }, - { 212234, true }, - { 212241, true }, - { 212253, true }, - { 212264, true }, - { 212274, true }, - { 212286, true }, - { 212296, false }, - { 212316, true }, - { 212339, true }, - { 212363, true }, - { 212373, false }, - { 212380, true }, - { 212393, true }, - { 212407, true }, - { 212421, true }, - { 212434, true }, - { 212445, true }, - { 212461, false }, - { 212482, true }, - { 212492, true }, - { 212503, true }, - { 212518, true }, - { 212532, true }, - { 212543, true }, + { 212115, true }, + { 212138, true }, + { 212145, true }, + { 212155, true }, + { 212165, true }, + { 212177, true }, + { 212193, true }, + { 212200, true }, + { 212207, true }, + { 212219, true }, + { 212230, true }, + { 212240, true }, + { 212252, true }, + { 212262, false }, + { 212282, true }, + { 212305, true }, + { 212329, true }, + { 212339, false }, + { 212346, true }, + { 212359, true }, + { 212373, true }, + { 212387, true }, + { 212400, true }, + { 212411, true }, + { 212427, false }, + { 212448, true }, + { 212458, true }, + { 212469, true }, + { 212484, true }, + { 212498, true }, + { 212509, true }, + { 212523, true }, + { 212537, true }, + { 212546, true }, { 212557, true }, - { 212577, true }, - { 212591, true }, + { 212572, true }, + { 212585, true }, { 212600, true }, - { 212611, true }, - { 212626, true }, - { 212639, true }, - { 212654, true }, - { 212670, true }, - { 212684, true }, - { 212699, true }, - { 212713, true }, - { 212729, true }, - { 212745, true }, - { 212759, true }, - { 212773, true }, - { 212789, true }, - { 212805, true }, - { 212823, true }, - { 212841, true }, - { 212861, true }, - { 212880, true }, - { 212896, true }, - { 212911, true }, - { 212925, true }, - { 212945, true }, - { 212961, true }, - { 212976, true }, - { 212990, true }, - { 213021, true }, - { 213037, true }, - { 213048, true }, - { 213058, false }, - { 213082, true }, + { 212616, true }, + { 212630, true }, + { 212645, true }, + { 212659, true }, + { 212675, true }, + { 212691, true }, + { 212705, true }, + { 212719, true }, + { 212735, true }, + { 212751, true }, + { 212769, true }, + { 212787, true }, + { 212807, true }, + { 212826, true }, + { 212842, true }, + { 212857, true }, + { 212871, true }, + { 212891, true }, + { 212907, true }, + { 212922, true }, + { 212936, true }, + { 212967, true }, + { 212983, true }, + { 212994, true }, + { 213004, false }, + { 213028, true }, + { 213042, true }, + { 213056, true }, + { 213066, true }, + { 213083, true }, { 213096, true }, - { 213110, true }, - { 213120, true }, - { 213137, true }, - { 213150, true }, - { 213163, true }, - { 213180, true }, - { 213197, false }, - { 213214, true }, - { 213227, true }, - { 213244, true }, - { 213265, true }, - { 213278, true }, - { 213291, true }, - { 213311, true }, - { 213329, true }, - { 213339, true }, - { 213352, true }, - { 213366, true }, - { 213380, false }, - { 213391, true }, - { 213408, true }, - { 213422, true }, - { 213441, true }, - { 213464, true }, - { 213492, true }, - { 213508, true }, - { 213520, true }, - { 213534, false }, - { 213547, true }, - { 213561, true }, - { 213571, true }, - { 213580, true }, + { 213109, true }, + { 213126, true }, + { 213143, false }, + { 213160, true }, + { 213173, true }, + { 213190, true }, + { 213211, true }, + { 213224, true }, + { 213237, true }, + { 213257, true }, + { 213275, true }, + { 213285, true }, + { 213298, true }, + { 213312, true }, + { 213326, false }, + { 213337, true }, + { 213354, true }, + { 213368, true }, + { 213387, true }, + { 213410, true }, + { 213438, true }, + { 213454, true }, + { 213466, true }, + { 213480, false }, + { 213493, true }, + { 213507, true }, + { 213517, true }, + { 213526, true }, + { 213538, true }, + { 213551, true }, + { 213567, true }, + { 213577, true }, { 213592, true }, - { 213605, true }, - { 213621, true }, - { 213631, true }, - { 213646, true }, - { 213654, true }, - { 213665, true }, - { 213680, true }, - { 213697, true }, - { 213704, true }, - { 213714, true }, - { 213724, true }, - { 213745, true }, + { 213600, true }, + { 213611, true }, + { 213626, true }, + { 213643, true }, + { 213650, true }, + { 213660, true }, + { 213670, true }, + { 213691, true }, + { 213707, true }, + { 213726, true }, + { 213746, true }, { 213761, true }, - { 213780, true }, - { 213800, true }, - { 213815, true }, + { 213769, true }, + { 213788, true }, + { 213799, true }, + { 213815, false }, { 213823, true }, - { 213842, true }, - { 213853, true }, - { 213869, false }, - { 213877, true }, - { 213892, true }, - { 213900, true }, - { 213911, true }, - { 213924, true }, - { 213935, true }, - { 213950, false }, - { 213970, true }, - { 213985, true }, - { 214007, true }, - { 214017, true }, - { 214032, true }, - { 214045, true }, - { 214056, true }, - { 214066, true }, - { 214078, true }, - { 214102, true }, - { 214115, true }, - { 214128, true }, - { 214140, true }, - { 214153, true }, - { 214167, true }, - { 214183, true }, - { 214199, true }, - { 214215, true }, - { 214234, true }, - { 214254, true }, - { 214265, true }, - { 214275, true }, - { 214286, true }, - { 214294, true }, - { 214307, true }, - { 214317, true }, - { 214331, true }, - { 214346, true }, - { 214356, true }, - { 214374, true }, - { 214388, true }, - { 214400, true }, - { 214427, false }, - { 214436, true }, - { 214449, false }, - { 214472, true }, - { 214494, true }, - { 214505, true }, - { 214518, true }, + { 213838, true }, + { 213846, true }, + { 213857, true }, + { 213870, true }, + { 213881, true }, + { 213896, false }, + { 213916, true }, + { 213931, true }, + { 213953, true }, + { 213963, true }, + { 213978, true }, + { 213991, true }, + { 214002, true }, + { 214012, true }, + { 214024, true }, + { 214048, true }, + { 214061, true }, + { 214074, true }, + { 214086, true }, + { 214099, true }, + { 214113, true }, + { 214129, true }, + { 214145, true }, + { 214161, true }, + { 214180, true }, + { 214200, true }, + { 214211, true }, + { 214221, true }, + { 214232, true }, + { 214240, false }, + { 214247, true }, + { 214260, true }, + { 214270, true }, + { 214284, true }, + { 214299, true }, + { 214309, true }, + { 214327, true }, + { 214341, true }, + { 214353, true }, + { 214380, false }, + { 214389, true }, + { 214402, false }, + { 214425, true }, + { 214447, true }, + { 214458, true }, + { 214471, true }, + { 214478, true }, + { 214485, true }, + { 214496, true }, + { 214512, true }, { 214525, true }, - { 214532, true }, - { 214543, true }, - { 214559, true }, - { 214572, true }, - { 214584, true }, - { 214594, true }, - { 214611, true }, - { 214626, true }, - { 214635, true }, - { 214646, true }, - { 214657, true }, - { 214675, true }, - { 214689, true }, - { 214699, true }, - { 214711, true }, - { 214723, true }, + { 214537, true }, + { 214547, true }, + { 214564, true }, + { 214579, true }, + { 214588, true }, + { 214599, true }, + { 214610, true }, + { 214628, true }, + { 214642, true }, + { 214654, true }, + { 214664, true }, + { 214676, true }, + { 214688, true }, + { 214701, true }, + { 214717, true }, { 214736, true }, - { 214752, true }, - { 214771, true }, - { 214790, true }, - { 214809, true }, - { 214824, true }, - { 214834, true }, - { 214852, true }, - { 214864, true }, - { 214883, true }, - { 214895, true }, - { 214910, true }, - { 214919, true }, - { 214930, false }, - { 214940, true }, - { 214946, true }, - { 214955, true }, - { 214964, true }, - { 214972, true }, - { 214991, true }, - { 215004, true }, - { 215013, true }, - { 215027, true }, - { 215045, true }, - { 215057, true }, - { 215067, true }, - { 215091, true }, - { 215114, true }, - { 215134, true }, - { 215147, true }, - { 215163, true }, - { 215175, true }, - { 215189, true }, - { 215208, true }, + { 214755, true }, + { 214774, true }, + { 214789, true }, + { 214799, true }, + { 214817, true }, + { 214829, true }, + { 214848, true }, + { 214860, true }, + { 214875, true }, + { 214884, true }, + { 214895, false }, + { 214905, true }, + { 214911, true }, + { 214920, true }, + { 214929, true }, + { 214937, true }, + { 214956, true }, + { 214969, true }, + { 214978, true }, + { 214992, true }, + { 215010, true }, + { 215022, true }, + { 215032, true }, + { 215056, true }, + { 215079, true }, + { 215099, true }, + { 215112, true }, + { 215128, true }, + { 215140, true }, + { 215154, true }, + { 215173, true }, + { 215183, true }, + { 215205, true }, { 215218, true }, - { 215240, true }, - { 215253, true }, + { 215227, true }, + { 215238, true }, + { 215251, true }, { 215262, true }, - { 215273, true }, - { 215286, true }, - { 215297, true }, - { 215311, true }, - { 215325, true }, - { 215340, true }, - { 215354, true }, - { 215369, true }, - { 215392, false }, - { 215405, true }, - { 215417, true }, - { 215432, true }, - { 215444, true }, - { 215454, true }, - { 215468, true }, - { 215481, true }, - { 215494, true }, - { 215513, false }, - { 215527, true }, - { 215539, true }, - { 215551, true }, - { 215567, true }, - { 215585, true }, - { 215611, true }, - { 215629, false }, - { 215642, true }, - { 215660, true }, - { 215670, true }, - { 215680, true }, - { 215691, true }, - { 215706, true }, - { 215718, true }, - { 215734, true }, - { 215742, true }, - { 215752, true }, - { 215762, true }, - { 215772, true }, - { 215784, true }, - { 215794, true }, - { 215804, true }, - { 215815, true }, - { 215835, true }, - { 215843, false }, - { 215864, true }, - { 215877, true }, - { 215886, true }, - { 215900, true }, - { 215910, true }, + { 215276, true }, + { 215290, true }, + { 215305, true }, + { 215319, true }, + { 215334, true }, + { 215357, false }, + { 215370, true }, + { 215382, true }, + { 215397, true }, + { 215409, true }, + { 215419, true }, + { 215433, true }, + { 215446, true }, + { 215459, true }, + { 215478, false }, + { 215492, true }, + { 215504, true }, + { 215516, true }, + { 215532, true }, + { 215550, true }, + { 215576, true }, + { 215594, false }, + { 215607, true }, + { 215625, true }, + { 215635, true }, + { 215645, true }, + { 215656, true }, + { 215671, true }, + { 215683, true }, + { 215699, true }, + { 215707, true }, + { 215717, true }, + { 215727, true }, + { 215737, true }, + { 215749, true }, + { 215759, true }, + { 215769, true }, + { 215780, true }, + { 215800, true }, + { 215808, false }, + { 215829, true }, + { 215842, true }, + { 215851, true }, + { 215865, true }, + { 215875, true }, + { 215888, true }, + { 215898, true }, + { 215907, true }, { 215923, true }, - { 215933, true }, - { 215942, true }, - { 215958, true }, - { 215969, false }, - { 215989, true }, - { 215999, true }, + { 215934, false }, + { 215954, true }, + { 215964, true }, + { 215971, true }, + { 215981, true }, + { 215991, true }, { 216006, true }, - { 216016, true }, - { 216026, true }, - { 216041, true }, - { 216055, true }, - { 216072, true }, - { 216089, true }, - { 216109, true }, - { 216122, true }, - { 216138, true }, - { 216168, true }, - { 216194, true }, - { 216202, true }, - { 216221, true }, - { 216235, true }, - { 216244, true }, - { 216263, true }, - { 216273, true }, - { 216294, true }, - { 216309, true }, - { 216322, true }, - { 216338, true }, - { 216350, true }, - { 216367, true }, + { 216020, true }, + { 216037, true }, + { 216054, true }, + { 216074, true }, + { 216087, true }, + { 216103, true }, + { 216133, true }, + { 216159, true }, + { 216167, true }, + { 216186, true }, + { 216200, true }, + { 216209, true }, + { 216228, true }, + { 216238, true }, + { 216259, true }, + { 216274, true }, + { 216287, true }, + { 216303, true }, + { 216315, true }, + { 216332, true }, + { 216343, true }, + { 216360, true }, { 216378, true }, - { 216395, true }, - { 216413, true }, - { 216429, true }, + { 216394, true }, + { 216414, true }, + { 216436, true }, { 216449, true }, - { 216471, true }, - { 216484, true }, - { 216494, true }, - { 216516, true }, - { 216537, true }, - { 216558, true }, + { 216459, true }, + { 216481, true }, + { 216502, true }, + { 216523, true }, + { 216536, true }, + { 216560, true }, { 216571, true }, + { 216583, true }, { 216595, true }, - { 216606, true }, - { 216618, true }, - { 216630, true }, - { 216640, true }, - { 216658, false }, - { 216675, true }, - { 216707, true }, + { 216605, true }, + { 216623, true }, + { 216635, false }, + { 216652, true }, + { 216684, true }, + { 216695, true }, + { 216705, true }, { 216718, true }, - { 216728, true }, - { 216741, true }, - { 216750, true }, - { 216763, true }, - { 216774, true }, - { 216785, true }, - { 216795, true }, - { 216802, true }, - { 216814, true }, - { 216827, false }, - { 216839, true }, + { 216727, true }, + { 216740, true }, + { 216751, true }, + { 216762, true }, + { 216772, true }, + { 216779, true }, + { 216791, true }, + { 216804, false }, + { 216816, true }, + { 216836, true }, + { 216846, true }, { 216859, true }, - { 216869, true }, - { 216882, true }, - { 216903, true }, - { 216920, true }, - { 216934, true }, - { 216951, true }, - { 216969, true }, - { 216976, true }, - { 216994, false }, - { 217012, false }, - { 217030, false }, - { 217047, true }, - { 217069, true }, - { 217082, true }, - { 217095, false }, - { 217110, false }, - { 217120, false }, - { 217134, true }, - { 217149, true }, - { 217161, true }, - { 217182, true }, - { 217200, true }, - { 217215, true }, - { 217243, true }, - { 217268, true }, - { 217286, true }, - { 217302, true }, - { 217312, true }, + { 216880, true }, + { 216897, true }, + { 216911, true }, + { 216928, true }, + { 216946, true }, + { 216953, true }, + { 216971, false }, + { 216989, false }, + { 217007, false }, + { 217024, true }, + { 217046, true }, + { 217059, false }, + { 217074, false }, + { 217084, false }, + { 217098, true }, + { 217113, true }, + { 217125, true }, + { 217146, true }, + { 217164, true }, + { 217179, true }, + { 217207, true }, + { 217232, true }, + { 217250, true }, + { 217266, true }, + { 217276, true }, + { 217304, true }, + { 217319, true }, + { 217330, true }, { 217340, true }, - { 217355, true }, - { 217366, true }, - { 217376, true }, - { 217399, false }, - { 217417, true }, - { 217432, true }, - { 217444, true }, - { 217457, true }, - { 217486, true }, + { 217363, false }, + { 217381, true }, + { 217396, true }, + { 217408, true }, + { 217421, true }, + { 217450, true }, + { 217468, true }, + { 217487, true }, { 217504, true }, - { 217523, true }, + { 217514, true }, + { 217525, false }, { 217540, true }, - { 217550, true }, - { 217561, false }, - { 217576, true }, - { 217591, true }, - { 217609, true }, - { 217623, true }, - { 217638, true }, - { 217650, true }, - { 217673, true }, - { 217687, true }, - { 217712, true }, - { 217728, true }, - { 217752, true }, - { 217766, true }, - { 217777, true }, - { 217795, true }, - { 217819, true }, - { 217852, false }, - { 217875, true }, - { 217895, true }, - { 217912, true }, + { 217555, true }, + { 217573, true }, + { 217587, true }, + { 217602, true }, + { 217614, true }, + { 217637, true }, + { 217651, true }, + { 217676, true }, + { 217692, true }, + { 217716, true }, + { 217730, true }, + { 217741, true }, + { 217759, true }, + { 217783, true }, + { 217816, false }, + { 217839, true }, + { 217856, true }, + { 217874, true }, + { 217894, true }, + { 217904, true }, + { 217917, true }, { 217930, true }, - { 217950, true }, - { 217960, true }, - { 217973, true }, - { 217986, true }, - { 218003, true }, - { 218014, true }, - { 218025, true }, - { 218047, true }, - { 218065, false }, - { 218079, true }, - { 218093, true }, - { 218111, true }, - { 218131, true }, + { 217947, true }, + { 217958, true }, + { 217969, true }, + { 217991, true }, + { 218009, false }, + { 218023, true }, + { 218037, true }, + { 218055, true }, + { 218075, true }, + { 218089, true }, + { 218098, true }, + { 218114, true }, + { 218127, true }, { 218145, true }, - { 218154, true }, - { 218170, true }, - { 218183, true }, - { 218201, true }, - { 218213, true }, - { 218228, true }, - { 218241, true }, + { 218157, true }, + { 218172, true }, + { 218185, true }, + { 218197, true }, + { 218209, true }, + { 218220, true }, + { 218231, true }, + { 218240, true }, { 218253, true }, - { 218265, true }, - { 218276, true }, - { 218287, true }, - { 218296, true }, - { 218309, true }, - { 218323, true }, - { 218334, true }, - { 218348, true }, - { 218359, true }, - { 218372, true }, - { 218386, true }, - { 218396, false }, - { 218409, true }, - { 218418, true }, - { 218435, true }, - { 218445, true }, - { 218455, true }, - { 218468, true }, - { 218477, true }, - { 218487, true }, - { 218498, true }, - { 218508, true }, - { 218516, true }, - { 218524, false }, - { 218538, true }, - { 218546, false }, - { 218566, true }, - { 218576, true }, - { 218590, true }, - { 218604, true }, - { 218614, true }, + { 218267, true }, + { 218278, true }, + { 218292, true }, + { 218303, true }, + { 218316, true }, + { 218330, true }, + { 218340, false }, + { 218353, true }, + { 218362, true }, + { 218379, true }, + { 218389, true }, + { 218399, true }, + { 218412, true }, + { 218421, true }, + { 218431, true }, + { 218442, true }, + { 218452, true }, + { 218460, true }, + { 218468, false }, + { 218482, true }, + { 218490, false }, + { 218510, true }, + { 218520, true }, + { 218534, true }, + { 218548, true }, + { 218558, true }, + { 218569, true }, + { 218581, true }, + { 218593, true }, + { 218603, true }, + { 218612, true }, { 218625, true }, { 218637, true }, - { 218648, true }, + { 218649, true }, { 218660, true }, - { 218670, true }, - { 218679, true }, - { 218692, true }, - { 218704, true }, - { 218716, true }, - { 218727, true }, - { 218741, true }, - { 218753, true }, - { 218769, true }, - { 218784, true }, - { 218798, true }, - { 218807, true }, - { 218819, true }, - { 218829, true }, - { 218845, true }, - { 218860, true }, - { 218875, true }, - { 218891, true }, + { 218674, true }, + { 218686, true }, + { 218702, true }, + { 218717, true }, + { 218731, true }, + { 218740, true }, + { 218752, true }, + { 218762, true }, + { 218778, true }, + { 218793, true }, + { 218808, true }, + { 218824, true }, + { 218839, true }, + { 218861, true }, + { 218873, true }, + { 218880, true }, + { 218895, true }, { 218906, true }, - { 218928, true }, - { 218940, true }, - { 218947, true }, - { 218962, true }, - { 218973, true }, - { 218983, true }, - { 218998, true }, - { 219009, true }, - { 219023, true }, - { 219037, true }, - { 219048, true }, - { 219061, true }, - { 219072, false }, - { 219087, true }, - { 219103, true }, - { 219112, true }, - { 219122, true }, - { 219129, true }, - { 219140, true }, - { 219152, true }, - { 219174, true }, - { 219186, true }, - { 219200, true }, - { 219223, true }, - { 219258, true }, - { 219294, true }, - { 219327, true }, - { 219365, true }, - { 219400, true }, - { 219435, true }, - { 219475, true }, - { 219511, true }, - { 219554, true }, - { 219580, true }, - { 219593, true }, - { 219602, true }, - { 219612, true }, - { 219622, true }, - { 219649, true }, - { 219658, true }, - { 219667, true }, - { 219684, true }, - { 219701, true }, - { 219713, true }, - { 219726, true }, - { 219739, true }, - { 219766, true }, + { 218916, true }, + { 218931, true }, + { 218942, true }, + { 218956, true }, + { 218970, true }, + { 218981, true }, + { 218994, true }, + { 219005, false }, + { 219020, true }, + { 219036, true }, + { 219045, true }, + { 219055, true }, + { 219062, true }, + { 219073, true }, + { 219085, true }, + { 219107, true }, + { 219119, true }, + { 219133, true }, + { 219156, true }, + { 219191, true }, + { 219227, true }, + { 219260, true }, + { 219298, true }, + { 219333, true }, + { 219368, true }, + { 219408, true }, + { 219444, true }, + { 219487, true }, + { 219513, true }, + { 219526, true }, + { 219535, true }, + { 219545, true }, + { 219555, true }, + { 219582, true }, + { 219591, true }, + { 219600, true }, + { 219617, true }, + { 219634, true }, + { 219646, true }, + { 219659, true }, + { 219672, true }, + { 219699, true }, + { 219706, true }, + { 219717, true }, + { 219734, true }, + { 219750, true }, + { 219761, true }, { 219773, true }, - { 219784, true }, - { 219801, true }, - { 219817, true }, - { 219828, true }, + { 219786, true }, + { 219810, true }, + { 219822, true }, + { 219829, true }, { 219840, true }, - { 219853, true }, - { 219877, true }, - { 219889, true }, - { 219896, true }, - { 219907, true }, - { 219915, true }, - { 219925, true }, - { 219932, true }, - { 219952, true }, - { 219964, true }, + { 219848, true }, + { 219858, true }, + { 219865, true }, + { 219885, true }, + { 219897, true }, + { 219918, true }, + { 219929, true }, + { 219941, true }, + { 219951, true }, + { 219963, true }, { 219985, true }, - { 219996, true }, - { 220008, true }, - { 220018, true }, - { 220030, true }, - { 220052, true }, - { 220061, true }, - { 220069, true }, - { 220078, true }, + { 219994, true }, + { 220002, true }, + { 220011, true }, + { 220020, true }, + { 220039, true }, + { 220053, true }, + { 220074, true }, { 220087, true }, - { 220106, true }, - { 220120, true }, - { 220141, true }, - { 220154, true }, - { 220166, true }, - { 220190, true }, - { 220202, true }, - { 220220, true }, - { 220238, false }, - { 220252, true }, - { 220267, true }, - { 220282, true }, - { 220291, false }, - { 220308, true }, - { 220318, true }, - { 220332, true }, - { 220340, true }, - { 220351, true }, - { 220366, true }, - { 220382, true }, - { 220405, true }, - { 220415, true }, - { 220426, true }, - { 220436, true }, - { 220452, true }, - { 220463, true }, - { 220474, true }, - { 220486, true }, - { 220497, true }, - { 220511, true }, - { 220528, true }, - { 220544, true }, - { 220556, false }, - { 220575, true }, + { 220099, true }, + { 220123, true }, + { 220135, true }, + { 220153, true }, + { 220171, false }, + { 220185, true }, + { 220200, true }, + { 220215, true }, + { 220224, false }, + { 220241, true }, + { 220251, true }, + { 220265, true }, + { 220273, true }, + { 220284, true }, + { 220299, true }, + { 220315, true }, + { 220338, true }, + { 220348, true }, + { 220359, true }, + { 220369, true }, + { 220385, true }, + { 220396, true }, + { 220407, true }, + { 220419, true }, + { 220430, true }, + { 220444, true }, + { 220461, true }, + { 220477, true }, + { 220489, false }, + { 220508, true }, + { 220518, true }, + { 220536, true }, + { 220551, true }, + { 220574, true }, { 220585, true }, - { 220603, true }, - { 220618, true }, - { 220641, true }, - { 220652, true }, - { 220672, true }, - { 220689, true }, - { 220699, true }, + { 220605, true }, + { 220622, true }, + { 220632, true }, + { 220648, true }, + { 220667, true }, + { 220682, true }, + { 220698, true }, { 220715, true }, - { 220734, true }, - { 220749, true }, - { 220765, true }, + { 220735, true }, + { 220747, true }, + { 220767, true }, { 220782, true }, - { 220802, true }, - { 220814, true }, - { 220834, true }, - { 220849, true }, - { 220868, true }, - { 220877, true }, - { 220893, true }, - { 220910, true }, - { 220922, true }, - { 220934, true }, - { 220943, true }, - { 220953, true }, - { 220970, true }, - { 220988, true }, - { 220999, true }, - { 221007, true }, - { 221017, true }, - { 221032, true }, - { 221042, true }, - { 221052, false }, - { 221059, true }, - { 221069, true }, - { 221090, true }, - { 221110, true }, - { 221133, true }, - { 221153, true }, - { 221169, true }, - { 221184, true }, + { 220801, true }, + { 220810, true }, + { 220826, true }, + { 220843, true }, + { 220855, true }, + { 220867, true }, + { 220876, true }, + { 220886, true }, + { 220903, true }, + { 220921, true }, + { 220932, true }, + { 220940, true }, + { 220950, true }, + { 220965, true }, + { 220975, true }, + { 220985, false }, + { 220992, true }, + { 221002, true }, + { 221023, true }, + { 221043, true }, + { 221066, true }, + { 221086, true }, + { 221102, true }, + { 221117, true }, + { 221135, true }, + { 221146, false }, + { 221170, true }, + { 221189, true }, { 221202, true }, - { 221213, false }, - { 221237, true }, - { 221256, true }, - { 221269, true }, - { 221285, true }, + { 221218, true }, + { 221234, true }, + { 221248, true }, + { 221260, false }, + { 221274, false }, + { 221287, true }, { 221301, true }, - { 221315, true }, - { 221327, false }, - { 221341, false }, - { 221354, true }, - { 221368, true }, - { 221386, true }, - { 221409, true }, - { 221432, true }, - { 221445, true }, - { 221457, true }, - { 221468, true }, - { 221479, true }, - { 221494, true }, - { 221519, true }, - { 221552, true }, - { 221578, true }, - { 221612, true }, - { 221635, true }, - { 221648, true }, - { 221664, true }, - { 221676, true }, - { 221688, true }, - { 221704, false }, - { 221724, true }, - { 221737, false }, - { 221755, false }, - { 221778, true }, - { 221798, true }, - { 221814, true }, - { 221828, true }, - { 221849, true }, - { 221864, false }, - { 221877, true }, + { 221319, true }, + { 221342, true }, + { 221365, true }, + { 221378, true }, + { 221390, true }, + { 221401, true }, + { 221412, true }, + { 221427, true }, + { 221452, true }, + { 221485, true }, + { 221511, true }, + { 221545, true }, + { 221568, true }, + { 221581, true }, + { 221597, true }, + { 221609, true }, + { 221621, true }, + { 221637, false }, + { 221657, true }, + { 221670, false }, + { 221688, false }, + { 221711, true }, + { 221731, true }, + { 221747, true }, + { 221761, true }, + { 221782, true }, + { 221797, false }, + { 221810, true }, + { 221827, true }, + { 221841, true }, + { 221854, true }, + { 221866, true }, + { 221878, true }, { 221894, true }, - { 221908, true }, - { 221921, true }, - { 221933, true }, - { 221945, true }, - { 221961, true }, - { 221976, false }, - { 221998, true }, - { 222018, true }, - { 222030, true }, - { 222051, true }, - { 222067, false }, - { 222079, true }, - { 222095, true }, - { 222113, true }, - { 222125, true }, - { 222139, true }, - { 222153, true }, - { 222170, true }, - { 222187, true }, - { 222201, true }, - { 222211, false }, - { 222225, true }, - { 222235, true }, - { 222256, true }, - { 222269, true }, - { 222287, true }, - { 222303, true }, - { 222316, true }, - { 222327, true }, - { 222340, true }, - { 222361, true }, - { 222381, true }, - { 222398, true }, - { 222410, true }, - { 222424, true }, - { 222434, true }, - { 222451, true }, + { 221909, false }, + { 221931, true }, + { 221951, true }, + { 221963, true }, + { 221984, true }, + { 222000, false }, + { 222012, true }, + { 222028, true }, + { 222046, true }, + { 222058, true }, + { 222072, true }, + { 222086, true }, + { 222103, true }, + { 222120, true }, + { 222134, true }, + { 222144, false }, + { 222158, true }, + { 222168, true }, + { 222189, true }, + { 222202, true }, + { 222220, true }, + { 222236, true }, + { 222249, true }, + { 222260, true }, + { 222273, true }, + { 222294, true }, + { 222314, true }, + { 222331, true }, + { 222343, true }, + { 222357, true }, + { 222367, true }, + { 222384, true }, + { 222394, true }, + { 222403, true }, + { 222421, true }, + { 222429, true }, + { 222445, true }, { 222461, true }, - { 222470, true }, - { 222488, true }, - { 222496, true }, - { 222512, true }, - { 222528, true }, - { 222544, true }, - { 222565, true }, - { 222576, true }, - { 222589, true }, - { 222614, true }, - { 222629, true }, - { 222649, true }, - { 222663, true }, + { 222477, true }, + { 222498, true }, + { 222509, true }, + { 222522, true }, + { 222547, true }, + { 222562, true }, + { 222582, true }, + { 222596, true }, + { 222611, true }, + { 222633, true }, + { 222653, true }, + { 222668, true }, { 222678, true }, - { 222700, true }, - { 222720, true }, - { 222735, true }, - { 222745, true }, - { 222758, true }, - { 222776, true }, + { 222691, true }, + { 222709, true }, + { 222724, true }, + { 222740, true }, + { 222756, true }, + { 222772, true }, + { 222781, false }, { 222791, true }, - { 222807, true }, - { 222823, true }, - { 222839, true }, - { 222848, false }, - { 222858, true }, - { 222870, true }, - { 222887, true }, - { 222899, true }, - { 222915, true }, - { 222931, true }, - { 222948, true }, + { 222803, true }, + { 222820, true }, + { 222832, true }, + { 222848, true }, + { 222864, true }, + { 222881, true }, + { 222902, true }, + { 222914, true }, + { 222926, true }, + { 222945, false }, + { 222957, true }, { 222969, true }, - { 222981, true }, - { 222993, true }, - { 223012, false }, - { 223024, true }, - { 223036, true }, - { 223046, true }, - { 223061, true }, - { 223073, true }, - { 223087, true }, - { 223111, true }, - { 223123, true }, - { 223155, true }, - { 223176, true }, - { 223207, true }, - { 223232, true }, - { 223255, true }, - { 223266, true }, - { 223278, true }, - { 223293, true }, - { 223306, true }, - { 223319, true }, - { 223332, true }, - { 223342, true }, - { 223371, true }, - { 223394, true }, - { 223418, true }, - { 223445, true }, - { 223459, true }, - { 223482, true }, - { 223508, true }, - { 223536, true }, - { 223567, true }, - { 223592, true }, - { 223600, true }, + { 222979, true }, + { 222994, true }, + { 223006, true }, + { 223020, true }, + { 223044, true }, + { 223056, true }, + { 223088, true }, + { 223109, true }, + { 223140, true }, + { 223165, true }, + { 223188, true }, + { 223199, true }, + { 223211, true }, + { 223226, true }, + { 223239, true }, + { 223252, true }, + { 223265, true }, + { 223275, true }, + { 223304, true }, + { 223327, true }, + { 223351, true }, + { 223378, true }, + { 223392, true }, + { 223415, true }, + { 223441, true }, + { 223469, true }, + { 223500, true }, + { 223525, true }, + { 223533, true }, + { 223540, true }, + { 223552, true }, + { 223560, true }, + { 223572, true }, + { 223594, true }, { 223607, true }, - { 223619, true }, - { 223627, true }, - { 223639, true }, - { 223661, true }, - { 223674, true }, - { 223695, true }, - { 223708, true }, - { 223729, true }, - { 223748, true }, - { 223769, true }, - { 223788, true }, - { 223799, true }, - { 223812, true }, - { 223828, false }, - { 223844, true }, - { 223852, true }, - { 223867, true }, - { 223884, false }, - { 223899, true }, - { 223915, true }, - { 223925, true }, - { 223937, true }, - { 223953, true }, - { 223967, false }, - { 223976, true }, + { 223628, true }, + { 223641, true }, + { 223662, true }, + { 223681, true }, + { 223702, true }, + { 223721, true }, + { 223732, true }, + { 223745, true }, + { 223761, false }, + { 223777, true }, + { 223785, true }, + { 223800, true }, + { 223817, false }, + { 223832, true }, + { 223848, true }, + { 223858, true }, + { 223870, true }, + { 223886, true }, + { 223900, false }, + { 223909, true }, + { 223921, true }, + { 223934, true }, + { 223949, true }, + { 223971, true }, { 223988, true }, - { 224001, true }, - { 224016, true }, - { 224038, true }, - { 224055, true }, - { 224077, true }, - { 224099, true }, - { 224113, true }, - { 224127, true }, - { 224134, true }, - { 224147, true }, - { 224160, true }, - { 224186, true }, - { 224198, true }, - { 224209, true }, - { 224235, true }, - { 224245, true }, - { 224255, false }, - { 224272, true }, - { 224284, true }, - { 224299, true }, + { 224010, true }, + { 224032, true }, + { 224046, true }, + { 224060, true }, + { 224067, true }, + { 224080, true }, + { 224093, true }, + { 224119, true }, + { 224131, true }, + { 224142, true }, + { 224168, true }, + { 224178, true }, + { 224188, false }, + { 224205, true }, + { 224217, true }, + { 224232, true }, + { 224241, true }, + { 224254, true }, + { 224264, true }, + { 224278, true }, + { 224295, true }, { 224308, true }, - { 224321, true }, + { 224320, true }, { 224331, true }, - { 224345, true }, - { 224362, true }, - { 224375, true }, - { 224387, true }, - { 224398, true }, - { 224408, true }, - { 224421, false }, - { 224437, true }, - { 224453, true }, - { 224467, false }, - { 224482, true }, - { 224495, false }, - { 224512, true }, - { 224526, true }, - { 224540, true }, - { 224554, true }, - { 224578, true }, - { 224591, true }, - { 224604, true }, - { 224618, true }, - { 224632, true }, - { 224647, true }, - { 224663, true }, - { 224678, true }, - { 224693, true }, - { 224711, true }, - { 224734, true }, - { 224746, true }, - { 224758, true }, - { 224777, true }, - { 224793, true }, - { 224808, true }, - { 224832, true }, - { 224849, true }, - { 224867, true }, - { 224886, true }, - { 224906, true }, - { 224921, true }, - { 224933, true }, - { 224950, true }, - { 224964, true }, - { 224981, true }, - { 224990, true }, - { 225003, true }, - { 225017, true }, - { 225032, true }, - { 225044, false }, - { 225057, true }, - { 225071, true }, - { 225084, true }, + { 224341, true }, + { 224354, false }, + { 224370, true }, + { 224386, true }, + { 224400, false }, + { 224415, true }, + { 224428, false }, + { 224445, true }, + { 224459, true }, + { 224473, true }, + { 224487, true }, + { 224511, true }, + { 224524, true }, + { 224537, true }, + { 224551, true }, + { 224565, true }, + { 224580, true }, + { 224596, true }, + { 224611, true }, + { 224626, true }, + { 224644, true }, + { 224667, true }, + { 224679, true }, + { 224691, true }, + { 224710, true }, + { 224726, true }, + { 224741, true }, + { 224765, true }, + { 224782, true }, + { 224800, true }, + { 224819, true }, + { 224834, true }, + { 224846, true }, + { 224863, true }, + { 224877, true }, + { 224894, true }, + { 224903, true }, + { 224916, true }, + { 224930, true }, + { 224945, true }, + { 224957, false }, + { 224970, true }, + { 224984, true }, + { 224997, true }, + { 225009, true }, + { 225021, false }, + { 225040, true }, + { 225062, true }, + { 225077, true }, { 225096, true }, - { 225108, false }, - { 225127, true }, - { 225149, true }, - { 225164, true }, - { 225183, false }, - { 225194, true }, - { 225209, true }, - { 225225, true }, - { 225239, true }, + { 225110, false }, + { 225121, true }, + { 225136, true }, + { 225152, true }, + { 225166, true }, + { 225178, true }, + { 225195, true }, + { 225213, true }, + { 225224, true }, + { 225231, true }, + { 225243, true }, { 225251, true }, - { 225268, true }, + { 225261, true }, + { 225271, true }, { 225286, true }, - { 225297, true }, - { 225304, true }, - { 225316, true }, - { 225324, true }, - { 225334, true }, - { 225344, true }, + { 225305, true }, + { 225321, false }, + { 225331, true }, + { 225338, false }, + { 225350, true }, { 225359, true }, - { 225378, true }, - { 225394, false }, - { 225404, true }, - { 225411, false }, - { 225423, true }, - { 225432, true }, - { 225446, true }, - { 225458, true }, - { 225466, true }, - { 225473, true }, - { 225483, true }, - { 225495, true }, - { 225506, true }, - { 225525, true }, - { 225533, true }, - { 225541, false }, - { 225553, true }, - { 225566, true }, - { 225581, true }, - { 225603, true }, - { 225615, true }, - { 225633, true }, - { 225649, true }, - { 225658, false }, - { 225675, true }, - { 225696, true }, - { 225717, true }, - { 225729, true }, - { 225745, true }, - { 225770, true }, - { 225796, true }, - { 225822, true }, - { 225833, true }, - { 225845, true }, - { 225858, true }, - { 225871, true }, - { 225881, true }, - { 225890, true }, + { 225373, true }, + { 225385, true }, + { 225393, true }, + { 225400, true }, + { 225410, true }, + { 225422, true }, + { 225433, true }, + { 225452, true }, + { 225460, true }, + { 225468, false }, + { 225480, true }, + { 225493, true }, + { 225508, true }, + { 225530, true }, + { 225542, true }, + { 225560, true }, + { 225576, true }, + { 225585, false }, + { 225602, true }, + { 225623, true }, + { 225644, true }, + { 225656, true }, + { 225672, true }, + { 225697, true }, + { 225723, true }, + { 225749, true }, + { 225760, true }, + { 225772, true }, + { 225785, true }, + { 225798, true }, + { 225808, true }, + { 225817, true }, + { 225831, true }, + { 225851, true }, + { 225866, true }, + { 225882, true }, + { 225892, true }, { 225904, true }, { 225924, true }, - { 225939, true }, - { 225955, true }, + { 225946, true }, { 225965, true }, - { 225977, true }, - { 225997, true }, - { 226019, true }, - { 226038, true }, - { 226052, true }, - { 226071, true }, - { 226083, true }, - { 226107, true }, - { 226124, false }, - { 226138, true }, - { 226151, true }, - { 226164, true }, - { 226183, true }, - { 226201, true }, - { 226213, true }, - { 226228, true }, - { 226243, true }, - { 226264, true }, - { 226289, true }, - { 226314, true }, - { 226330, true }, - { 226356, true }, - { 226376, true }, + { 225979, true }, + { 225998, true }, + { 226010, true }, + { 226034, true }, + { 226051, false }, + { 226065, true }, + { 226078, true }, + { 226091, true }, + { 226110, true }, + { 226128, true }, + { 226140, true }, + { 226155, true }, + { 226170, true }, + { 226191, true }, + { 226216, true }, + { 226241, true }, + { 226257, true }, + { 226283, true }, + { 226303, true }, + { 226316, true }, + { 226332, true }, + { 226345, true }, + { 226357, true }, + { 226375, true }, { 226389, true }, - { 226405, true }, - { 226418, true }, - { 226430, true }, - { 226448, true }, - { 226462, true }, + { 226408, true }, + { 226419, true }, + { 226431, true }, + { 226441, true }, + { 226450, true }, + { 226464, true }, { 226481, true }, { 226492, true }, - { 226504, true }, - { 226514, true }, + { 226503, true }, + { 226511, true }, { 226523, true }, - { 226537, true }, - { 226554, true }, - { 226565, true }, - { 226576, true }, - { 226584, true }, - { 226596, true }, + { 226536, true }, + { 226550, true }, + { 226567, true }, + { 226578, false }, + { 226590, true }, { 226609, true }, - { 226623, true }, - { 226640, true }, - { 226651, false }, - { 226663, true }, - { 226682, true }, - { 226695, true }, - { 226706, true }, + { 226622, true }, + { 226633, true }, + { 226644, true }, + { 226655, true }, + { 226668, true }, + { 226679, true }, + { 226691, true }, + { 226701, true }, + { 226707, true }, { 226717, true }, - { 226728, true }, - { 226741, true }, - { 226752, true }, - { 226764, true }, - { 226774, true }, - { 226780, true }, - { 226790, true }, - { 226810, true }, - { 226820, true }, + { 226737, true }, + { 226747, true }, + { 226770, true }, + { 226782, true }, + { 226801, true }, + { 226809, true }, + { 226817, true }, + { 226831, true }, { 226843, true }, - { 226855, true }, - { 226874, true }, - { 226882, true }, - { 226890, true }, - { 226904, true }, - { 226916, true }, - { 226931, false }, - { 226944, true }, - { 226957, true }, - { 226968, true }, - { 226979, true }, - { 226995, true }, - { 227009, true }, - { 227019, true }, - { 227033, true }, - { 227040, true }, - { 227053, true }, - { 227070, true }, - { 227080, true }, - { 227088, true }, - { 227100, true }, - { 227116, true }, - { 227131, true }, - { 227141, true }, - { 227166, true }, - { 227174, true }, - { 227186, false }, - { 227197, false }, - { 227215, false }, - { 227228, true }, - { 227243, true }, - { 227257, true }, - { 227271, true }, - { 227288, true }, - { 227305, true }, - { 227320, true }, - { 227338, true }, - { 227356, true }, - { 227374, true }, - { 227388, true }, - { 227402, true }, - { 227416, true }, - { 227430, true }, - { 227444, false }, - { 227462, false }, - { 227485, false }, - { 227506, false }, - { 227525, true }, - { 227541, false }, - { 227557, false }, - { 227573, true }, - { 227595, true }, - { 227608, false }, - { 227625, false }, - { 227642, true }, + { 226858, false }, + { 226871, true }, + { 226884, true }, + { 226895, true }, + { 226906, true }, + { 226922, true }, + { 226936, true }, + { 226946, true }, + { 226960, true }, + { 226967, true }, + { 226980, true }, + { 226997, true }, + { 227007, true }, + { 227015, true }, + { 227027, true }, + { 227043, true }, + { 227058, true }, + { 227068, true }, + { 227093, true }, + { 227101, true }, + { 227113, false }, + { 227124, false }, + { 227142, false }, + { 227155, true }, + { 227170, true }, + { 227184, true }, + { 227198, true }, + { 227215, true }, + { 227232, true }, + { 227247, true }, + { 227265, true }, + { 227283, true }, + { 227301, true }, + { 227315, true }, + { 227329, true }, + { 227343, true }, + { 227357, true }, + { 227371, false }, + { 227389, false }, + { 227412, false }, + { 227433, false }, + { 227452, true }, + { 227468, false }, + { 227484, false }, + { 227500, true }, + { 227522, true }, + { 227535, false }, + { 227552, false }, + { 227569, true }, + { 227586, false }, + { 227603, false }, + { 227617, false }, + { 227636, false }, + { 227647, false }, { 227659, false }, - { 227676, false }, - { 227690, false }, - { 227709, false }, - { 227720, false }, - { 227732, false }, - { 227744, false }, - { 227763, true }, - { 227781, false }, - { 227795, true }, - { 227811, false }, - { 227828, false }, - { 227845, false }, - { 227860, false }, - { 227876, true }, + { 227671, false }, + { 227690, true }, + { 227708, false }, + { 227722, true }, + { 227738, false }, + { 227755, false }, + { 227772, false }, + { 227787, false }, + { 227803, true }, + { 227824, false }, + { 227843, false }, + { 227861, false }, + { 227881, true }, { 227897, false }, - { 227916, false }, - { 227934, false }, - { 227954, true }, - { 227970, false }, - { 227985, true }, - { 228000, false }, - { 228024, true }, - { 228031, true }, - { 228050, false }, - { 228068, false }, - { 228083, true }, - { 228103, true }, - { 228124, false }, - { 228148, false }, - { 228167, false }, + { 227912, true }, + { 227927, false }, + { 227951, true }, + { 227958, true }, + { 227977, false }, + { 227995, false }, + { 228010, true }, + { 228030, true }, + { 228051, false }, + { 228075, false }, + { 228094, false }, + { 228110, false }, + { 228125, false }, + { 228138, true }, + { 228154, false }, + { 228169, false }, { 228183, false }, - { 228198, false }, - { 228211, true }, - { 228227, false }, - { 228242, false }, - { 228256, false }, - { 228274, true }, - { 228285, true }, - { 228296, true }, - { 228304, true }, - { 228312, true }, - { 228327, true }, - { 228337, true }, - { 228350, true }, - { 228367, true }, - { 228383, true }, - { 228395, true }, - { 228403, true }, + { 228201, true }, + { 228212, true }, + { 228223, true }, + { 228231, true }, + { 228239, true }, + { 228254, true }, + { 228264, true }, + { 228277, true }, + { 228294, true }, + { 228310, true }, + { 228322, true }, + { 228330, true }, + { 228341, true }, + { 228351, true }, + { 228361, true }, + { 228377, true }, + { 228382, true }, + { 228387, true }, + { 228397, true }, + { 228405, true }, { 228414, true }, - { 228424, true }, - { 228434, true }, - { 228450, true }, - { 228455, true }, - { 228460, true }, - { 228470, true }, - { 228478, true }, - { 228487, true }, - { 228495, true }, - { 228515, true }, - { 228522, true }, - { 228541, true }, - { 228548, true }, - { 228555, true }, - { 228562, true }, - { 228571, true }, - { 228592, true }, - { 228612, true }, + { 228422, true }, + { 228442, true }, + { 228449, true }, + { 228468, true }, + { 228475, true }, + { 228482, true }, + { 228489, true }, + { 228498, true }, + { 228519, true }, + { 228539, true }, + { 228563, true }, + { 228570, true }, + { 228580, true }, + { 228593, true }, + { 228610, true }, + { 228630, true }, { 228636, true }, { 228643, true }, - { 228653, true }, - { 228666, true }, - { 228683, true }, - { 228703, true }, - { 228709, true }, - { 228716, true }, - { 228728, true }, - { 228741, true }, - { 228756, false }, - { 228767, true }, - { 228778, true }, - { 228786, false }, - { 228805, true }, - { 228816, true }, - { 228827, true }, - { 228834, true }, - { 228845, true }, - { 228857, true }, - { 228876, true }, - { 228892, true }, - { 228904, true }, + { 228655, true }, + { 228668, true }, + { 228683, false }, + { 228694, true }, + { 228705, true }, + { 228713, false }, + { 228732, true }, + { 228743, true }, + { 228754, true }, + { 228761, true }, + { 228772, true }, + { 228784, true }, + { 228803, true }, + { 228819, true }, + { 228831, true }, + { 228842, true }, + { 228855, true }, + { 228871, true }, + { 228885, true }, + { 228900, true }, { 228915, true }, - { 228928, true }, - { 228944, true }, - { 228958, true }, - { 228973, true }, - { 228988, true }, - { 228998, true }, - { 229008, true }, - { 229019, false }, - { 229029, true }, - { 229039, true }, - { 229050, true }, - { 229058, true }, - { 229066, true }, - { 229076, true }, - { 229085, false }, - { 229099, true }, - { 229109, true }, - { 229117, true }, - { 229129, true }, + { 228925, true }, + { 228935, true }, + { 228946, false }, + { 228956, true }, + { 228966, true }, + { 228977, true }, + { 228985, true }, + { 228993, true }, + { 229003, true }, + { 229012, false }, + { 229026, true }, + { 229036, true }, + { 229047, true }, + { 229055, true }, + { 229067, true }, + { 229078, true }, + { 229089, true }, + { 229101, true }, + { 229111, true }, + { 229119, true }, + { 229126, true }, + { 229133, true }, { 229140, true }, - { 229151, true }, - { 229163, true }, - { 229173, true }, - { 229181, true }, - { 229188, true }, - { 229195, true }, - { 229202, true }, - { 229220, true }, - { 229246, true }, - { 229272, true }, - { 229295, true }, - { 229326, true }, - { 229337, true }, - { 229353, true }, - { 229365, true }, - { 229384, true }, - { 229408, true }, - { 229434, true }, - { 229457, true }, - { 229476, true }, - { 229501, true }, - { 229526, true }, - { 229550, true }, - { 229590, true }, - { 229620, true }, - { 229631, true }, - { 229650, true }, + { 229158, true }, + { 229184, true }, + { 229210, true }, + { 229233, true }, + { 229264, true }, + { 229275, true }, + { 229291, true }, + { 229303, true }, + { 229322, true }, + { 229348, true }, + { 229371, true }, + { 229390, true }, + { 229415, true }, + { 229440, true }, + { 229464, true }, + { 229504, true }, + { 229534, true }, + { 229545, true }, + { 229564, true }, + { 229595, true }, + { 229606, false }, + { 229627, true }, + { 229645, true }, + { 229663, true }, { 229681, true }, - { 229692, false }, - { 229713, true }, - { 229731, true }, - { 229749, true }, - { 229767, true }, - { 229804, true }, - { 229827, true }, - { 229855, true }, - { 229870, true }, - { 229897, true }, - { 229911, true }, + { 229718, true }, + { 229741, true }, + { 229769, true }, + { 229784, true }, + { 229811, true }, + { 229825, true }, + { 229847, true }, + { 229872, true }, + { 229914, true }, { 229933, true }, - { 229958, true }, - { 230000, true }, - { 230019, true }, - { 230042, true }, - { 230058, true }, - { 230092, true }, - { 230099, false }, - { 230106, true }, - { 230112, true }, - { 230123, true }, - { 230133, true }, - { 230143, true }, - { 230150, true }, - { 230157, true }, - { 230170, true }, - { 230177, true }, + { 229956, true }, + { 229972, true }, + { 230006, true }, + { 230030, true }, + { 230037, false }, + { 230044, true }, + { 230050, true }, + { 230061, true }, + { 230071, true }, + { 230081, true }, + { 230088, true }, + { 230095, true }, + { 230108, true }, + { 230115, true }, + { 230124, true }, + { 230138, true }, + { 230148, true }, + { 230158, true }, + { 230171, true }, + { 230184, true }, { 230191, true }, - { 230200, true }, + { 230198, true }, + { 230207, true }, { 230214, true }, - { 230224, true }, + { 230225, true }, { 230234, true }, - { 230247, true }, - { 230260, true }, - { 230267, true }, - { 230274, true }, + { 230245, true }, + { 230261, true }, + { 230270, true }, { 230283, true }, { 230290, true }, - { 230301, true }, - { 230310, true }, - { 230321, true }, - { 230337, true }, - { 230346, true }, - { 230359, true }, - { 230366, true }, - { 230376, true }, - { 230384, true }, - { 230395, true }, - { 230404, true }, + { 230300, true }, + { 230308, true }, + { 230319, true }, + { 230328, true }, + { 230338, true }, + { 230353, true }, + { 230363, true }, + { 230372, true }, + { 230392, true }, + { 230403, true }, { 230414, true }, - { 230429, true }, - { 230439, true }, - { 230448, true }, - { 230468, true }, - { 230479, true }, - { 230490, true }, - { 230504, true }, - { 230513, true }, - { 230529, true }, - { 230536, true }, + { 230428, true }, + { 230437, true }, + { 230453, true }, + { 230460, true }, + { 230472, true }, + { 230482, true }, + { 230489, true }, + { 230500, true }, + { 230512, true }, + { 230522, false }, + { 230534, true }, { 230548, true }, - { 230558, true }, - { 230565, true }, - { 230576, true }, - { 230588, true }, - { 230598, false }, - { 230610, true }, - { 230624, true }, - { 230637, true }, - { 230653, true }, - { 230668, true }, - { 230680, true }, - { 230693, false }, - { 230703, true }, - { 230715, true }, - { 230728, true }, - { 230750, true }, - { 230762, true }, + { 230561, true }, + { 230577, true }, + { 230592, true }, + { 230604, true }, + { 230617, false }, + { 230627, true }, + { 230639, true }, + { 230652, true }, + { 230674, true }, + { 230686, true }, + { 230698, true }, + { 230708, true }, + { 230716, true }, + { 230725, true }, + { 230737, true }, + { 230747, false }, + { 230755, true }, + { 230765, true }, { 230774, true }, - { 230784, true }, - { 230792, true }, - { 230801, true }, - { 230813, true }, - { 230823, false }, - { 230831, true }, - { 230841, true }, - { 230850, true }, - { 230870, true }, - { 230885, true }, - { 230901, false }, - { 230916, false }, - { 230929, true }, - { 230943, true }, - { 230953, false }, - { 230962, true }, - { 230969, true }, - { 230985, true }, - { 230992, true }, - { 231002, true }, - { 231011, true }, - { 231019, true }, - { 231028, true }, - { 231039, true }, - { 231053, true }, - { 231064, true }, - { 231086, true }, - { 231101, true }, - { 231108, true }, - { 231119, true }, - { 231127, true }, - { 231137, true }, - { 231150, true }, - { 231168, true }, - { 231180, false }, + { 230794, true }, + { 230809, true }, + { 230825, false }, + { 230840, false }, + { 230853, true }, + { 230867, true }, + { 230877, false }, + { 230886, true }, + { 230893, true }, + { 230909, true }, + { 230919, true }, + { 230928, true }, + { 230936, true }, + { 230945, true }, + { 230956, true }, + { 230970, true }, + { 230981, true }, + { 231003, true }, + { 231018, true }, + { 231025, true }, + { 231036, true }, + { 231044, true }, + { 231054, true }, + { 231067, true }, + { 231085, true }, + { 231097, false }, + { 231106, true }, + { 231120, true }, + { 231136, true }, + { 231160, true }, + { 231178, true }, { 231189, true }, - { 231203, true }, - { 231219, true }, - { 231243, true }, - { 231261, true }, - { 231272, true }, - { 231284, false }, - { 231299, true }, - { 231309, true }, - { 231321, true }, - { 231341, false }, - { 231351, true }, - { 231375, true }, - { 231386, true }, - { 231396, true }, - { 231408, true }, - { 231421, true }, - { 231438, true }, - { 231453, true }, - { 231466, true }, - { 231480, true }, - { 231495, true }, + { 231201, false }, + { 231216, true }, + { 231226, true }, + { 231238, true }, + { 231258, false }, + { 231268, true }, + { 231292, true }, + { 231303, true }, + { 231313, true }, + { 231325, true }, + { 231338, true }, + { 231355, true }, + { 231370, true }, + { 231383, true }, + { 231397, true }, + { 231412, true }, + { 231427, true }, + { 231439, true }, + { 231451, true }, + { 231465, true }, + { 231477, true }, + { 231488, true }, + { 231498, true }, { 231510, true }, - { 231522, true }, - { 231534, true }, - { 231548, true }, - { 231560, true }, - { 231571, true }, - { 231581, true }, - { 231593, true }, - { 231606, true }, - { 231626, true }, - { 231644, true }, - { 231657, true }, - { 231672, true }, - { 231687, true }, - { 231699, true }, - { 231708, true }, + { 231523, true }, + { 231543, true }, + { 231561, true }, + { 231574, true }, + { 231589, true }, + { 231604, true }, + { 231616, true }, + { 231625, true }, + { 231636, true }, + { 231658, true }, + { 231674, true }, + { 231694, true }, + { 231703, true }, + { 231711, true }, { 231719, true }, - { 231741, true }, - { 231757, true }, - { 231777, true }, - { 231786, true }, - { 231794, true }, - { 231802, true }, - { 231815, true }, - { 231827, true }, - { 231839, true }, - { 231854, true }, - { 231864, true }, - { 231875, true }, - { 231891, true }, - { 231900, true }, - { 231909, true }, - { 231918, true }, - { 231933, true }, - { 231952, true }, - { 231965, true }, - { 231978, true }, - { 231987, true }, - { 231998, true }, - { 232012, true }, - { 232024, true }, - { 232042, true }, - { 232055, true }, - { 232063, true }, - { 232077, true }, - { 232089, true }, + { 231732, true }, + { 231744, true }, + { 231756, true }, + { 231771, true }, + { 231781, true }, + { 231792, true }, + { 231808, true }, + { 231817, true }, + { 231826, true }, + { 231835, true }, + { 231850, true }, + { 231869, true }, + { 231882, true }, + { 231895, true }, + { 231904, true }, + { 231915, true }, + { 231929, true }, + { 231941, true }, + { 231959, true }, + { 231972, true }, + { 231980, true }, + { 231994, true }, + { 232006, true }, + { 232016, true }, + { 232023, true }, + { 232031, true }, + { 232039, true }, + { 232049, true }, + { 232058, true }, + { 232081, true }, + { 232094, true }, { 232099, true }, - { 232106, true }, - { 232114, true }, - { 232122, true }, - { 232132, true }, - { 232141, true }, - { 232164, true }, - { 232177, true }, - { 232182, true }, - { 232192, true }, - { 232199, true }, - { 232206, true }, - { 232218, false }, + { 232109, true }, + { 232116, true }, + { 232123, true }, + { 232135, false }, + { 232154, true }, + { 232165, true }, + { 232181, true }, + { 232196, true }, + { 232211, true }, + { 232224, true }, { 232237, true }, - { 232248, true }, - { 232264, true }, - { 232279, true }, + { 232245, true }, + { 232255, true }, + { 232265, true }, + { 232280, true }, { 232294, true }, - { 232307, true }, - { 232320, true }, - { 232328, true }, - { 232338, true }, + { 232322, true }, + { 232335, true }, { 232348, true }, - { 232363, true }, - { 232377, true }, - { 232405, true }, - { 232418, true }, - { 232431, true }, - { 232448, true }, - { 232456, true }, - { 232465, true }, - { 232478, true }, - { 232490, true }, + { 232365, true }, + { 232373, true }, + { 232382, true }, + { 232395, true }, + { 232407, true }, + { 232414, true }, + { 232444, true }, + { 232455, true }, + { 232473, true }, { 232497, true }, - { 232527, true }, - { 232538, true }, - { 232556, true }, + { 232507, true }, + { 232519, true }, + { 232530, true }, + { 232542, true }, + { 232560, true }, + { 232569, true }, { 232580, true }, - { 232590, true }, - { 232602, true }, - { 232613, true }, - { 232625, true }, - { 232643, true }, - { 232652, true }, - { 232663, true }, - { 232675, true }, + { 232592, true }, + { 232600, true }, + { 232607, true }, + { 232615, true }, + { 232626, true }, + { 232636, true }, + { 232645, true }, + { 232671, true }, { 232683, true }, - { 232690, true }, - { 232698, true }, - { 232709, true }, - { 232719, true }, - { 232728, true }, - { 232754, true }, - { 232766, true }, - { 232775, true }, - { 232800, true }, - { 232812, true }, - { 232832, true }, - { 232854, true }, - { 232865, true }, - { 232876, true }, - { 232888, true }, + { 232692, true }, + { 232717, true }, + { 232737, true }, + { 232759, true }, + { 232770, true }, + { 232781, true }, + { 232793, true }, + { 232806, true }, + { 232821, true }, + { 232839, true }, + { 232852, true }, + { 232867, true }, + { 232883, true }, { 232901, true }, - { 232916, true }, - { 232934, true }, - { 232947, true }, - { 232962, true }, - { 232978, true }, - { 232996, true }, - { 233010, true }, - { 233020, true }, - { 233032, true }, - { 233040, true }, - { 233052, true }, - { 233064, true }, - { 233075, true }, - { 233087, true }, - { 233100, true }, - { 233111, true }, - { 233124, true }, - { 233136, true }, - { 233148, false }, - { 233158, true }, - { 233169, true }, + { 232915, true }, + { 232925, true }, + { 232937, true }, + { 232945, true }, + { 232957, true }, + { 232969, true }, + { 232980, true }, + { 232992, true }, + { 233005, true }, + { 233016, true }, + { 233029, true }, + { 233041, true }, + { 233053, false }, + { 233063, true }, + { 233074, true }, + { 233089, true }, + { 233102, true }, + { 233113, true }, + { 233123, true }, + { 233130, true }, + { 233144, true }, + { 233156, true }, + { 233168, true }, { 233184, true }, - { 233197, true }, - { 233208, true }, - { 233218, true }, - { 233225, true }, - { 233239, true }, - { 233251, true }, - { 233263, true }, - { 233279, true }, - { 233294, true }, - { 233307, true }, - { 233319, true }, - { 233332, true }, - { 233347, true }, - { 233354, true }, - { 233369, true }, - { 233381, true }, - { 233390, true }, - { 233402, true }, - { 233410, true }, - { 233425, true }, - { 233440, true }, - { 233449, false }, - { 233457, true }, - { 233468, true }, - { 233476, true }, - { 233487, true }, - { 233498, true }, - { 233513, true }, - { 233530, true }, - { 233544, false }, - { 233556, true }, - { 233575, true }, - { 233593, true }, - { 233604, true }, - { 233624, true }, - { 233640, true }, - { 233655, true }, - { 233667, true }, - { 233677, true }, - { 233684, true }, - { 233695, true }, - { 233705, true }, - { 233711, true }, - { 233721, true }, - { 233736, true }, - { 233748, true }, - { 233760, true }, - { 233775, true }, - { 233786, true }, - { 233799, true }, - { 233806, true }, - { 233817, true }, - { 233828, true }, - { 233839, true }, - { 233850, true }, - { 233865, true }, + { 233199, true }, + { 233212, true }, + { 233224, true }, + { 233237, true }, + { 233252, true }, + { 233259, true }, + { 233274, false }, + { 233287, true }, + { 233299, true }, + { 233308, true }, + { 233320, true }, + { 233328, true }, + { 233343, true }, + { 233358, true }, + { 233367, false }, + { 233375, true }, + { 233386, true }, + { 233394, true }, + { 233405, true }, + { 233416, true }, + { 233431, true }, + { 233448, true }, + { 233462, false }, + { 233474, true }, + { 233493, true }, + { 233511, true }, + { 233522, true }, + { 233542, true }, + { 233558, true }, + { 233573, true }, + { 233585, true }, + { 233595, true }, + { 233602, true }, + { 233613, true }, + { 233623, true }, + { 233629, true }, + { 233639, true }, + { 233654, true }, + { 233666, true }, + { 233678, true }, + { 233693, true }, + { 233704, true }, + { 233717, true }, + { 233724, true }, + { 233735, true }, + { 233746, true }, + { 233757, true }, + { 233768, true }, + { 233783, true }, + { 233807, true }, + { 233825, true }, + { 233838, true }, + { 233849, true }, + { 233864, true }, + { 233880, true }, { 233889, true }, - { 233907, true }, - { 233920, true }, - { 233931, true }, - { 233946, true }, - { 233962, true }, - { 233971, true }, - { 233982, true }, - { 233998, true }, - { 234022, true }, - { 234037, true }, - { 234048, true }, - { 234058, true }, - { 234066, true }, - { 234083, true }, - { 234102, true }, - { 234113, true }, - { 234123, true }, - { 234133, true }, - { 234144, true }, - { 234152, true }, - { 234166, false }, - { 234173, true }, - { 234185, true }, - { 234194, true }, - { 234208, true }, - { 234216, true }, - { 234229, true }, - { 234243, true }, - { 234264, true }, - { 234278, true }, - { 234285, true }, - { 234296, true }, - { 234306, true }, - { 234319, true }, - { 234327, true }, - { 234336, true }, - { 234349, true }, - { 234362, true }, - { 234375, true }, - { 234385, true }, - { 234396, true }, - { 234406, true }, - { 234415, true }, - { 234425, true }, + { 233900, true }, + { 233916, true }, + { 233940, true }, + { 233955, true }, + { 233966, true }, + { 233976, true }, + { 233984, true }, + { 234001, true }, + { 234020, true }, + { 234031, true }, + { 234041, true }, + { 234051, true }, + { 234062, true }, + { 234070, true }, + { 234084, false }, + { 234091, true }, + { 234103, true }, + { 234112, true }, + { 234126, true }, + { 234134, true }, + { 234147, true }, + { 234161, true }, + { 234182, true }, + { 234196, true }, + { 234203, true }, + { 234214, true }, + { 234224, true }, + { 234237, true }, + { 234245, true }, + { 234254, true }, + { 234267, true }, + { 234280, true }, + { 234293, true }, + { 234303, true }, + { 234314, true }, + { 234324, true }, + { 234333, true }, + { 234343, true }, }; From 24209083be33791d3ca89ed734cb3b3b6840a36d Mon Sep 17 00:00:00 2001 From: ffxbld Date: Sun, 5 Feb 2017 07:38:32 -0800 Subject: [PATCH 47/70] No bug, Automated HPKP preload list update from host bld-linux64-spot-018 - a=hpkp-update --- security/manager/ssl/StaticHPKPins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/manager/ssl/StaticHPKPins.h b/security/manager/ssl/StaticHPKPins.h index a2307a2fab93..1730d2d8b839 100644 --- a/security/manager/ssl/StaticHPKPins.h +++ b/security/manager/ssl/StaticHPKPins.h @@ -1155,4 +1155,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = { static const int32_t kUnknownId = -1; -static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1494688949505000); +static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1494776249598000); From b2963d0f8154af379595115602497eda43730938 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 5 Feb 2017 14:22:49 -0500 Subject: [PATCH 48/70] Backed out 3 changesets (bug 1322277) for causing bug 1334149. Backed out changeset 4dcb65842657 (bug 1322277) Backed out changeset 35d9f271da8d (bug 1322277) Backed out changeset 55cc36b0d408 (bug 1322277) --- .../client/marionette_driver/marionette.py | 28 ++-------- .../harness/marionette_harness/runner/base.py | 5 +- .../tests/unit/test_capabilities.py | 56 ++++++------------- 3 files changed, 25 insertions(+), 64 deletions(-) diff --git a/testing/marionette/client/marionette_driver/marionette.py b/testing/marionette/client/marionette_driver/marionette.py index 7a262407e607..a0776d22df1c 100644 --- a/testing/marionette/client/marionette_driver/marionette.py +++ b/testing/marionette/client/marionette_driver/marionette.py @@ -3,7 +3,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import base64 -import copy import datetime import json import os @@ -545,7 +544,7 @@ class Marionette(object): CONTEXT_CHROME = "chrome" # non-browser content: windows, dialogs, etc. CONTEXT_CONTENT = "content" # browser content: iframes, divs, etc. - DEFAULT_SOCKET_TIMEOUT = 65 + DEFAULT_SOCKET_TIMEOUT = 60 DEFAULT_STARTUP_TIMEOUT = 120 DEFAULT_SHUTDOWN_TIMEOUT = 65 # Firefox will kill hanging threads after 60s @@ -1248,12 +1247,13 @@ class Marionette(object): return "{0}{1}".format(self.baseurl, relative_url) @do_process_check - def start_session(self, capabilities=None, session_id=None, timeout=60): + def start_session(self, desired_capabilities=None, session_id=None, timeout=60): """Create a new Marionette session. This method must be called before performing any other action. - :param capabilities: An optional dict of desired or required capabilities. + :param desired_capabilities: An optional dict of desired + capabilities. This is currently ignored. :param timeout: Timeout in seconds for the server to be ready. :param session_id: unique identifier for the session. If no session id is passed in then one will be generated by the marionette server. @@ -1279,25 +1279,7 @@ class Marionette(object): self.wait_for_port(timeout=timeout) self.protocol, _ = self.client.connect() - if capabilities is not None: - caps = copy.deepcopy(capabilities) - else: - caps = {} - - # Bug 1322277 - Override some default capabilities which are defined by - # the Webdriver spec but which don't really apply to tests executed with - # the Marionette client. Using "desiredCapabilities" here will allow tests - # to override the settings via "desiredCapabilities" and requiredCapabilities". - if "desiredCapabilities" not in caps: - caps.update({ - "desiredCapabilities": { - "timeouts": { - "page load": 60000, # webdriver specifies 300000ms - } - } - }) - - body = {"capabilities": caps, "sessionId": session_id} + body = {"capabilities": desired_capabilities, "sessionId": session_id} resp = self._send_message("newSession", body) self.session_id = resp["sessionId"] diff --git a/testing/marionette/harness/marionette_harness/runner/base.py b/testing/marionette/harness/marionette_harness/runner/base.py index 1b2a0280a7de..aa89c1be2577 100644 --- a/testing/marionette/harness/marionette_harness/runner/base.py +++ b/testing/marionette/harness/marionette_harness/runner/base.py @@ -240,7 +240,7 @@ class MarionetteTextTestRunner(StructuredTestRunner): class BaseMarionetteArguments(ArgumentParser): - socket_timeout_default = 65.0 + socket_timeout_default = 60.0 def __init__(self, **kwargs): ArgumentParser.__init__(self, **kwargs) @@ -347,8 +347,7 @@ class BaseMarionetteArguments(ArgumentParser): self.add_argument('--socket-timeout', type=float, default=self.socket_timeout_default, - help='Set the global timeout for marionette socket operations.' - ' Default: %(default)ss.') + help='Set the global timeout for marionette socket operations.') self.add_argument('--disable-e10s', action='store_false', dest='e10s', diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py index e7ff4e8291ec..35205cef4f72 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py @@ -11,14 +11,7 @@ class TestCapabilities(MarionetteTestCase): def setUp(self): super(TestCapabilities, self).setUp() - - # Force default webdriver capabilities by default to test - # Marionette server. - self.marionette.delete_session() - self.marionette.start_session({"desiredCapabilities": {}}) - self.caps = self.marionette.session_capabilities - with self.marionette.using_context("chrome"): self.appinfo = self.marionette.execute_script( "return Services.appinfo") @@ -40,8 +33,10 @@ class TestCapabilities(MarionetteTestCase): self.assertEqual(self.caps["platformName"], self.os_name) self.assertEqual(self.caps["platformVersion"], self.os_version) self.assertFalse(self.caps["acceptInsecureCerts"]) - self.assertEqual(self.caps["timeouts"], - {"implicit": 0, "page load": 300000, "script": 30000}) + self.assertDictEqual(self.caps["timeouts"], + {"implicit": 0, + "page load": 300000, + "script": 30000}) def test_supported_features(self): self.assertIn("rotatable", self.caps) @@ -65,14 +60,6 @@ class TestCapabilities(MarionetteTestCase): self.assertIn("specificationLevel", self.caps) self.assertEqual(self.caps["specificationLevel"], 0) - def test_default_client_capabilities(self): - self.marionette.delete_session() - self.marionette.start_session() - caps = self.marionette.session_capabilities - - self.assertEqual(caps["timeouts"], - {"implicit": 0, "page load": 60000, "script": 30000}) - def test_set_specification_level(self): self.marionette.delete_session() self.marionette.start_session({"desiredCapabilities": {"specificationLevel": 2}}) @@ -135,8 +122,7 @@ class TestCapabilityMatching(MarionetteTestCase): for typ in self.allowed: self.marionette.delete_session() self.marionette.start_session({"desiredCapabilities": {"browserName": typ}}) - self.assertEqual(self.marionette.session_capabilities["browserName"], - self.browser_name) + self.assertEqual(self.marionette.session_capabilities["browserName"], self.browser_name) def test_browser_name_desired_disallowed_types(self): for typ in self.disallowed: @@ -147,8 +133,7 @@ class TestCapabilityMatching(MarionetteTestCase): for typ in self.allowed: self.marionette.delete_session() self.marionette.start_session({"requiredCapabilities": {"browserName": typ}}) - self.assertEqual(self.marionette.session_capabilities["browserName"], - self.browser_name) + self.assertEqual(self.marionette.session_capabilities["browserName"], self.browser_name) def test_browser_name_requried_disallowed_types(self): for typ in self.disallowed: @@ -157,33 +142,30 @@ class TestCapabilityMatching(MarionetteTestCase): def test_browser_name_prefers_required(self): caps = {"desiredCapabilities": {"browserName": "invalid"}, - "requiredCapabilities": {"browserName": "*"}} + "requiredCapabilities": {"browserName": "*"}} self.marionette.start_session(caps) def test_browser_name_error_on_invalid_required(self): with self.assertRaises(SessionNotCreatedException): caps = {"desiredCapabilities": {"browserName": "*"}, - "requiredCapabilities": {"browserName": "invalid"}} + "requiredCapabilities": {"browserName": "invalid"}} self.marionette.start_session(caps) # TODO(ato): browser version comparison not implemented yet def test_platform_name_desired(self): - self.marionette.start_session( - {"desiredCapabilities": {"platformName": self.platform_name}}) + self.marionette.start_session({"desiredCapabilities": {"platformName": self.platform_name}}) self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name) def test_platform_name_required(self): - self.marionette.start_session( - {"requiredCapabilities": {"platformName": self.platform_name}}) + self.marionette.start_session({"requiredCapabilities": {"platformName": self.platform_name}}) self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name) def test_platform_name_desired_allowed_types(self): for typ in self.allowed: self.marionette.delete_session() self.marionette.start_session({"desiredCapabilities": {"platformName": typ}}) - self.assertEqual(self.marionette.session_capabilities["platformName"], - self.platform_name) + self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name) def test_platform_name_desired_disallowed_types(self): for typ in self.disallowed: @@ -194,8 +176,7 @@ class TestCapabilityMatching(MarionetteTestCase): for typ in self.allowed: self.marionette.delete_session() self.marionette.start_session({"requiredCapabilities": {"platformName": typ}}) - self.assertEqual(self.marionette.session_capabilities["platformName"], - self.platform_name) + self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name) def test_platform_name_requried_disallowed_types(self): for typ in self.disallowed: @@ -204,13 +185,13 @@ class TestCapabilityMatching(MarionetteTestCase): def test_platform_name_prefers_required(self): caps = {"desiredCapabilities": {"platformName": "invalid"}, - "requiredCapabilities": {"platformName": "*"}} + "requiredCapabilities": {"platformName": "*"}} self.marionette.start_session(caps) def test_platform_name_error_on_invalid_required(self): with self.assertRaises(SessionNotCreatedException): caps = {"desiredCapabilities": {"platformName": "*"}, - "requiredCapabilities": {"platformName": "invalid"}} + "requiredCapabilities": {"platformName": "invalid"}} self.marionette.start_session(caps) # TODO(ato): platform version comparison not imlpemented yet @@ -221,8 +202,7 @@ class TestCapabilityMatching(MarionetteTestCase): for value in ["", 42, {}, []]: print(" type {}".format(type(value))) with self.assertRaises(SessionNotCreatedException): - self.marionette.start_session( - {capability_type: {"acceptInsecureCerts": value}}) + self.marionette.start_session({capability_type: {"acceptInsecureCerts": value}}) self.marionette.delete_session() self.marionette.start_session({"desiredCapabilities": {"acceptInsecureCerts": True}}) @@ -261,9 +241,9 @@ class TestCapabilityMatching(MarionetteTestCase): self.assertEqual(self.marionette.get_pref("network.proxy.type"), 1) def test_timeouts(self): - timeouts = {"implicit": 123, "page load": 456, "script": 789} + timeouts = {u"implicit": 123, u"page load": 456, u"script": 789} caps = {"desiredCapabilities": {"timeouts": timeouts}} self.marionette.start_session(caps) self.assertIn("timeouts", self.marionette.session_capabilities) - self.assertEqual(self.marionette.session_capabilities["timeouts"], timeouts) - self.assertEqual(self.marionette._send_message("getTimeouts"), timeouts) + self.assertDictEqual(self.marionette.session_capabilities["timeouts"], timeouts) + self.assertDictEqual(self.marionette._send_message("getTimeouts"), timeouts) From 463433cf37a96def95d843da5667a68d0069645a Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Sun, 5 Feb 2017 20:52:53 +0100 Subject: [PATCH 49/70] Backed out changeset d88c174c2d20 (bug 675709) --- widget/cocoa/nsDeviceContextSpecX.mm | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/widget/cocoa/nsDeviceContextSpecX.mm b/widget/cocoa/nsDeviceContextSpecX.mm index a22572b614b0..0a72af8ed89a 100644 --- a/widget/cocoa/nsDeviceContextSpecX.mm +++ b/widget/cocoa/nsDeviceContextSpecX.mm @@ -64,19 +64,6 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget *aWidget, if (!settings) return NS_ERROR_NO_INTERFACE; - bool toFile; - settings->GetPrintToFile(&toFile); - - bool toPrinter = !toFile && !aIsPrintPreview; - if (!toPrinter) { - double width, height; - settings->GetEffectivePageSize(&width, &height); - width /= TWIPS_PER_POINT_FLOAT; - height /= TWIPS_PER_POINT_FLOAT; - - settings->SetCocoaPaperSize(width, height); - } - mPrintSession = settings->GetPMPrintSession(); ::PMRetain(mPrintSession); mPageFormat = settings->GetPMPageFormat(); From deffc9f665a6fd56c23dd552ac1b7169b5e65e52 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Sun, 5 Feb 2017 20:53:32 +0100 Subject: [PATCH 50/70] Backed out changeset 2114a592360d (bug 675709) for bustage on OS X: use undeclared identifiers. r=backout on a CLOSED TREE --- widget/cocoa/nsPrintSettingsX.h | 16 --- widget/cocoa/nsPrintSettingsX.mm | 227 +------------------------------ 2 files changed, 2 insertions(+), 241 deletions(-) diff --git a/widget/cocoa/nsPrintSettingsX.h b/widget/cocoa/nsPrintSettingsX.h index cedc99ad6930..1d755b25057d 100644 --- a/widget/cocoa/nsPrintSettingsX.h +++ b/widget/cocoa/nsPrintSettingsX.h @@ -51,22 +51,8 @@ public: void SetInchesScale(float aWidthScale, float aHeightScale); void GetInchesScale(float *aWidthScale, float *aHeightScale); - NS_IMETHOD SetPaperSizeUnit(int16_t aPaperSizeUnit) override; - - NS_IMETHOD SetScaling(double aScaling) override; - NS_IMETHOD SetToFileName(const char16_t * aToFileName) override; - - NS_IMETHOD GetOrientation(int32_t *aOrientation) override; - NS_IMETHOD SetOrientation(int32_t aOrientation) override; - - NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop) override; - NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) override; - NS_IMETHOD SetUnwriteableMarginBottom(double aUnwriteableMarginBottom) override; - NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight) override; - void SetAdjustedPaperSize(double aWidth, double aHeight); void GetAdjustedPaperSize(double *aWidth, double *aHeight); - nsresult SetCocoaPaperSize(double aWidth, double aHeight); protected: virtual ~nsPrintSettingsX(); @@ -77,8 +63,6 @@ protected: nsresult _Clone(nsIPrintSettings **_retval) override; nsresult _Assign(nsIPrintSettings *aPS) override; - int GetCocoaUnit(int16_t aGeckoUnit); - // The out param has a ref count of 1 on return so caller needs to PMRelase() when done. OSStatus CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat); OSStatus CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings); diff --git a/widget/cocoa/nsPrintSettingsX.mm b/widget/cocoa/nsPrintSettingsX.mm index ae64c75b18e4..73a8e78d2b1c 100644 --- a/widget/cocoa/nsPrintSettingsX.mm +++ b/widget/cocoa/nsPrintSettingsX.mm @@ -254,13 +254,8 @@ NS_IMETHODIMP nsPrintSettingsX::SetPaperHeight(double aPaperHeight) NS_IMETHODIMP nsPrintSettingsX::GetEffectivePageSize(double *aWidth, double *aHeight) { - if (kPaperSizeInches == GetCocoaUnit(mPaperSizeUnit)) { - *aWidth = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); - *aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); - } else { - *aWidth = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); - *aHeight = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); - } + *aWidth = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); + *aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); return NS_OK; } @@ -275,221 +270,3 @@ void nsPrintSettingsX::GetAdjustedPaperSize(double *aWidth, double *aHeight) *aWidth = mAdjustedPaperWidth; *aHeight = mAdjustedPaperHeight; } - -NS_IMETHODIMP -nsPrintSettingsX::SetPaperSizeUnit(int16_t aPaperSizeUnit) -{ - mPaperSizeUnit = aPaperSizeUnit; - return NS_OK; -} - -NS_IMETHODIMP -nsPrintSettingsX::SetScaling(double aScaling) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - [printInfoDict setObject: [NSNumber numberWithFloat: aScaling] - forKey: NSPrintScalingFactor]; - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -NS_IMETHODIMP -nsPrintSettingsX::SetToFileName(const char16_t *aToFileName) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - nsString filename = nsDependentString(aToFileName); - - NSURL* jobSavingURL = - [NSURL fileURLWithPath: nsCocoaUtils::ToNSString(filename)]; - if (jobSavingURL) { - [printInfoDict setObject: NSPrintSaveJob forKey: NSPrintJobDisposition]; - [printInfoDict setObject: jobSavingURL forKey: NSPrintJobSavingURL]; - } - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -NS_IMETHODIMP -nsPrintSettingsX::GetOrientation(int32_t *aOrientation) -{ - if ([mPrintInfo orientation] == NSPaperOrientationPortrait) { - *aOrientation = nsIPrintSettings::kPortraitOrientation; - } else { - *aOrientation = nsIPrintSettings::kLandscapeOrientation; - } - return NS_OK; -} - -NS_IMETHODIMP -nsPrintSettingsX::SetOrientation(int32_t aOrientation) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - if (aOrientation == nsIPrintSettings::kPortraitOrientation) { - [printInfoDict setObject: [NSNumber numberWithInt: NSPaperOrientationPortrait] - forKey: NSPrintOrientation]; - } else { - [printInfoDict setObject: [NSNumber numberWithInt: NSPaperOrientationLandscape] - forKey: NSPrintOrientation]; - } - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -NS_IMETHODIMP -nsPrintSettingsX::SetUnwriteableMarginTop(double aUnwriteableMarginTop) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - nsPrintSettings::SetUnwriteableMarginTop(aUnwriteableMarginTop); - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginTop] - forKey : NSPrintTopMargin]; - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -NS_IMETHODIMP -nsPrintSettingsX::SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - nsPrintSettings::SetUnwriteableMarginLeft(aUnwriteableMarginLeft); - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginLeft] - forKey : NSPrintLeftMargin]; - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -NS_IMETHODIMP -nsPrintSettingsX::SetUnwriteableMarginBottom(double aUnwriteableMarginBottom) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - nsPrintSettings::SetUnwriteableMarginBottom(aUnwriteableMarginBottom); - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginBottom] - forKey : NSPrintBottomMargin]; - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -NS_IMETHODIMP -nsPrintSettingsX::SetUnwriteableMarginRight(double aUnwriteableMarginRight) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - nsPrintSettings::SetUnwriteableMarginRight(aUnwriteableMarginRight); - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginRight] - forKey : NSPrintRightMargin]; - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -int -nsPrintSettingsX::GetCocoaUnit(int16_t aGeckoUnit) -{ - if (aGeckoUnit == kPaperSizeMillimeters) - return kPaperSizeMillimeters; - else - return kPaperSizeInches; -} - -nsresult nsPrintSettingsX::SetCocoaPaperSize(double aWidth, double aHeight) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - NSSize paperSize; - NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - if ([mPrintInfo orientation] == NSPaperOrientationPortrait) { - // switch widths and heights - paperSize = NSMakeSize(aWidth, aHeight); - [printInfoDict setObject: [NSValue valueWithSize: paperSize] - forKey: NSPrintPaperSize]; - } else { - paperSize = NSMakeSize(aHeight, aWidth); - [printInfoDict setObject: [NSValue valueWithSize: paperSize] - forKey: NSPrintPaperSize]; - } - NSPrintInfo* newPrintInfo = - [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; - if (NS_WARN_IF(!newPrintInfo)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - SetCocoaPrintInfo(newPrintInfo); - [newPrintInfo release]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} From 2cbdd729685b24b13b0695e06a60112b0b4eb686 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Sun, 5 Feb 2017 21:24:23 +0100 Subject: [PATCH 51/70] Bug 1333000 part 5 - Annotate crash reports with the value we found instead of the TI magic word. r=ehoogeveen --- js/src/vm/TypeInference.cpp | 15 +++++++++++++++ js/src/vm/TypeInference.h | 11 +++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/js/src/vm/TypeInference.cpp b/js/src/vm/TypeInference.cpp index 591b1e83a7ae..8e2d206906a4 100644 --- a/js/src/vm/TypeInference.cpp +++ b/js/src/vm/TypeInference.cpp @@ -7,6 +7,7 @@ #include "vm/TypeInference-inl.h" #include "mozilla/DebugOnly.h" +#include "mozilla/IntegerPrintfMacros.h" #include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "mozilla/SizePrintfMacros.h" @@ -2606,6 +2607,20 @@ TypeZone::addPendingRecompile(JSContext* cx, JSScript* script) ObjectStateChange(cx, script->functionNonDelazifying()->group(), false); } +#ifdef JS_CRASH_DIAGNOSTICS +static char sCrashReason[256]; + +MOZ_NORETURN MOZ_COLD MOZ_NEVER_INLINE void +js::ReportMagicWordFailure(uintptr_t actual, uintptr_t expected) +{ + SprintfLiteral(sCrashReason, + "MOZ_CRASH(Got 0x%" PRIxPTR " expected magic word 0x%" PRIxPTR ")", + actual, expected); + MOZ_CRASH_ANNOTATE(sCrashReason); + MOZ_REALLY_CRASH(); +} +#endif + void js::PrintTypes(JSContext* cx, JSCompartment* comp, bool force) { diff --git a/js/src/vm/TypeInference.h b/js/src/vm/TypeInference.h index 472c6e015720..ac95c4c9fdd8 100644 --- a/js/src/vm/TypeInference.h +++ b/js/src/vm/TypeInference.h @@ -543,6 +543,11 @@ static const uintptr_t BaseTypeInferenceMagic = 0xa1a2b3b4c5c6d7d8; static const uintptr_t TypeConstraintMagic = BaseTypeInferenceMagic + 1; static const uintptr_t ConstraintTypeSetMagic = BaseTypeInferenceMagic + 2; +#ifdef JS_CRASH_DIAGNOSTICS +extern MOZ_NORETURN MOZ_COLD MOZ_NEVER_INLINE void +ReportMagicWordFailure(uintptr_t actual, uintptr_t expected); +#endif + /* * A constraint which listens to additions to a type set and propagates those * changes to other type sets. @@ -567,7 +572,8 @@ class TypeConstraint void checkMagic() const { #ifdef JS_CRASH_DIAGNOSTICS - MOZ_RELEASE_ASSERT(magic_ == TypeConstraintMagic); + if (MOZ_UNLIKELY(magic_ != TypeConstraintMagic)) + ReportMagicWordFailure(magic_, TypeConstraintMagic); #endif } @@ -669,7 +675,8 @@ class ConstraintTypeSet : public TypeSet void checkMagic() const { #ifdef JS_CRASH_DIAGNOSTICS - MOZ_RELEASE_ASSERT(magic_ == ConstraintTypeSetMagic); + if (MOZ_UNLIKELY(magic_ != ConstraintTypeSetMagic)) + ReportMagicWordFailure(magic_, ConstraintTypeSetMagic); #endif } From f5077ad52f8b90183e73038869f6140f0afbf427 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 5 Feb 2017 18:18:09 -0800 Subject: [PATCH 52/70] Backed out changeset c13c36e04303 (bug 1332295) for extremely frequent Linux32 debug failures in test_be_conservative.js --- testing/xpcshell/head.js | 35 ++++++++++++++++++++--------------- testing/xpcshell/selftest.py | 17 ++++------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/testing/xpcshell/head.js b/testing/xpcshell/head.js index 3fc55036b742..0c0f316ddf95 100644 --- a/testing/xpcshell/head.js +++ b/testing/xpcshell/head.js @@ -23,7 +23,6 @@ _register_modules_protocol_handler(); var _Promise = Components.utils.import("resource://gre/modules/Promise.jsm", {}).Promise; var _PromiseTestUtils = Components.utils.import("resource://testing-common/PromiseTestUtils.jsm", {}).PromiseTestUtils; -var _Task = Components.utils.import("resource://gre/modules/Task.jsm", {}).Task; Components.utils.importGlobalProperties(["XMLHttpRequest"]); // Support a common assertion library, Assert.jsm. @@ -595,22 +594,27 @@ function _execute_test() { }); }; - let complete = _cleanupFunctions.length == 0; - _Task.spawn(function*() { - for (let func of _cleanupFunctions.reverse()) { - try { - yield func(); - } catch (ex) { - reportCleanupError(ex); + let func; + while ((func = _cleanupFunctions.pop())) { + let result; + try { + result = func(); + } catch (ex) { + reportCleanupError(ex); + continue; + } + if (result && typeof result == "object" + && "then" in result && typeof result.then == "function") { + // This is a promise, wait until it is satisfied before proceeding + let complete = false; + let promise = result.then(null, reportCleanupError); + promise = promise.then(() => complete = true); + let thr = Components.classes["@mozilla.org/thread-manager;1"] + .getService().currentThread; + while (!complete) { + thr.processNextEvent(true); } } - _cleanupFunctions = []; - }.bind(this)).catch(reportCleanupError) - .then(() => complete = true); - let thr = Components.classes["@mozilla.org/thread-manager;1"] - .getService().currentThread; - while (!complete) { - thr.processNextEvent(true); } // Restore idle service to avoid leaks. @@ -1508,6 +1512,7 @@ function add_task(funcOrProperties, func) { add_task.only = _add_only.bind(undefined, add_task); add_task.skip = _add_skip.bind(undefined, add_task); +var _Task = Components.utils.import("resource://gre/modules/Task.jsm", {}).Task; _Task.Debugging.maintainStack = true; diff --git a/testing/xpcshell/selftest.py b/testing/xpcshell/selftest.py index 7c753ab2be06..34173c366a22 100755 --- a/testing/xpcshell/selftest.py +++ b/testing/xpcshell/selftest.py @@ -301,22 +301,12 @@ function run_test() { // Cleanup tasks, in reverse order do_register_cleanup(function cleanup_checkout() { - do_check_eq(checkpoints.join(""), "123456"); + do_check_eq(checkpoints.join(""), "1234"); do_print("At this stage, the test has succeeded"); do_throw("Throwing an error to force displaying the log"); }); do_register_cleanup(function sync_cleanup_2() { - checkpoints.push(6); - }); - - do_register_cleanup(async function async_cleanup_4() { - await undefined; - checkpoints.push(5); - }); - - do_register_cleanup(function* async_cleanup_3() { - yield undefined; checkpoints.push(4); }); @@ -1194,12 +1184,13 @@ add_test({ def testAsyncCleanup(self): """ - Check that do_register_cleanup handles nicely async cleanup tasks + Check that do_register_cleanup handles nicely cleanup tasks that + return a promise """ self.writeFile("test_asyncCleanup.js", ASYNC_CLEANUP) self.writeManifest(["test_asyncCleanup.js"]) self.assertTestResult(False) - self.assertInLog("\"123456\" == \"123456\"") + self.assertInLog("\"1234\" == \"1234\"") self.assertInLog("At this stage, the test has succeeded") self.assertInLog("Throwing an error to force displaying the log") From 7a6a69db52b0c00e75cef6072eda2ec646514d43 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 5 Feb 2017 18:39:26 -0800 Subject: [PATCH 53/70] Bug 1334962 - set the pref to enable VR for wpt even on beta/release --- testing/web-platform/meta/vr/idlharness.html.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/web-platform/meta/vr/idlharness.html.ini b/testing/web-platform/meta/vr/idlharness.html.ini index 0ddc4314aa28..48961e716eab 100644 --- a/testing/web-platform/meta/vr/idlharness.html.ini +++ b/testing/web-platform/meta/vr/idlharness.html.ini @@ -1,5 +1,6 @@ [idlharness.html] type: testharness + prefs: [dom.vr.enabled:true] [Window interface: attribute onvrdisplayblur] expected: FAIL From 10744cc4bba7ea43f0a196639ecb18a3f9d0b283 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Sun, 5 Feb 2017 21:50:07 -0500 Subject: [PATCH 54/70] Bug 1336598 P1 Tune setTimeout anti-flood constants to minimize jank. r=smaug --- dom/base/TimeoutManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/base/TimeoutManager.cpp b/dom/base/TimeoutManager.cpp index 4cc0d2a996cf..e551a33af010 100644 --- a/dom/base/TimeoutManager.cpp +++ b/dom/base/TimeoutManager.cpp @@ -73,12 +73,12 @@ const uint32_t kThrottledEventQueueBackPressure = 5000; // As the length of the ThrottledEventQueue grows delay is increased. The // delay is scaled such that every kThrottledEventQueueBackPressure runnables // in the queue equates to an additional kBackPressureDelayMS. -const double kBackPressureDelayMS = 500; +const double kBackPressureDelayMS = 250; // This defines a limit for how much the delay must drop before we actually // reduce back pressure throttle amount. This makes the throttle delay // a bit "sticky" once we enter back pressure. -const double kBackPressureDelayReductionThresholdMS = 400; +const double kBackPressureDelayReductionThresholdMS = 1000; // The minimum delay we can reduce back pressure to before we just floor // the value back to zero. This allows us to ensure that we can exit From cc8571902b897706d47f64e6306456fb9a96f3aa Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Sun, 5 Feb 2017 21:50:09 -0500 Subject: [PATCH 55/70] Bug 1336598 P2 Avoid underflow in timeout CancelOrUpdateBackpressure(). r=smaug --- dom/base/TimeoutManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/base/TimeoutManager.cpp b/dom/base/TimeoutManager.cpp index e551a33af010..5e2c465ee1da 100644 --- a/dom/base/TimeoutManager.cpp +++ b/dom/base/TimeoutManager.cpp @@ -712,8 +712,8 @@ TimeoutManager::CancelOrUpdateBackPressure(nsGlobalWindow* aWindow) // can be quite expensive. We only want to call that method if the back log // is really clearing. else if (newBackPressureDelayMS == 0 || - (newBackPressureDelayMS <= - (mBackPressureDelayMS - kBackPressureDelayReductionThresholdMS))) { + (mBackPressureDelayMS > + (newBackPressureDelayMS + kBackPressureDelayReductionThresholdMS))) { int32_t oldBackPressureDelayMS = mBackPressureDelayMS; mBackPressureDelayMS = newBackPressureDelayMS; From b639eaf199c29e368dcb8bb479a0d900204f0774 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Sun, 5 Feb 2017 21:50:12 -0500 Subject: [PATCH 56/70] Bug 1336598 P3 Add preferences to control timeout back pressure algorithm. r=smaug --- dom/base/TimeoutManager.cpp | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/dom/base/TimeoutManager.cpp b/dom/base/TimeoutManager.cpp index 5e2c465ee1da..5219ee7d33f9 100644 --- a/dom/base/TimeoutManager.cpp +++ b/dom/base/TimeoutManager.cpp @@ -67,24 +67,28 @@ namespace { // The number of queued runnables within the TabGroup ThrottledEventQueue // at which to begin applying back pressure to the window. -const uint32_t kThrottledEventQueueBackPressure = 5000; +#define DEFAULT_THROTTLED_EVENT_QUEUE_BACK_PRESSURE 5000 +static uint32_t gThrottledEventQueueBackPressure; // The amount of delay to apply to timers when back pressure is triggered. // As the length of the ThrottledEventQueue grows delay is increased. The // delay is scaled such that every kThrottledEventQueueBackPressure runnables // in the queue equates to an additional kBackPressureDelayMS. -const double kBackPressureDelayMS = 250; +#define DEFAULT_BACK_PRESSURE_DELAY_MS 250 +static uint32_t gBackPressureDelayMS; // This defines a limit for how much the delay must drop before we actually // reduce back pressure throttle amount. This makes the throttle delay // a bit "sticky" once we enter back pressure. -const double kBackPressureDelayReductionThresholdMS = 1000; +#define DEFAULT_BACK_PRESSURE_DELAY_REDUCTION_THRESHOLD_MS 1000 +static uint32_t gBackPressureDelayReductionThresholdMS; // The minimum delay we can reduce back pressure to before we just floor // the value back to zero. This allows us to ensure that we can exit // back pressure event if there are always a small number of runnables // queued up. -const double kBackPressureDelayMinimumMS = 100; +#define DEFAULT_BACK_PRESSURE_DELAY_MINIMUM_MS 100 +static uint32_t gBackPressureDelayMinimumMS; // Convert a ThrottledEventQueue length to a timer delay in milliseconds. // This will return a value between 0 and INT32_MAX. @@ -92,8 +96,8 @@ int32_t CalculateNewBackPressureDelayMS(uint32_t aBacklogDepth) { double multiplier = static_cast(aBacklogDepth) / - static_cast(kThrottledEventQueueBackPressure); - double value = kBackPressureDelayMS * multiplier; + static_cast(gThrottledEventQueueBackPressure); + double value = static_cast(gBackPressureDelayMS) * multiplier; // Avoid overflow if (value > INT32_MAX) { value = INT32_MAX; @@ -102,7 +106,7 @@ CalculateNewBackPressureDelayMS(uint32_t aBacklogDepth) // Once we get close to an empty queue just floor the delay back to zero. // We want to ensure we don't get stuck in a condition where there is a // small amount of delay remaining due to an active, but reasonable, queue. - else if (value < kBackPressureDelayMinimumMS) { + else if (value < static_cast(gBackPressureDelayMinimumMS)) { value = 0; } return static_cast(value); @@ -153,6 +157,19 @@ TimeoutManager::Initialize() Preferences::AddBoolVarCache(&gAnnotateTrackingChannels, "privacy.trackingprotection.annotate_channels", false); + + Preferences::AddUintVarCache(&gThrottledEventQueueBackPressure, + "dom.timeout.throttled_event_queue_back_pressure", + DEFAULT_THROTTLED_EVENT_QUEUE_BACK_PRESSURE); + Preferences::AddUintVarCache(&gBackPressureDelayMS, + "dom.timeout.back_pressure_delay_ms", + DEFAULT_BACK_PRESSURE_DELAY_MS); + Preferences::AddUintVarCache(&gBackPressureDelayReductionThresholdMS, + "dom.timeout.back_pressure_delay_reduction_threshold_ms", + DEFAULT_BACK_PRESSURE_DELAY_REDUCTION_THRESHOLD_MS); + Preferences::AddUintVarCache(&gBackPressureDelayMinimumMS, + "dom.timeout.back_pressure_delay_minimum_ms", + DEFAULT_BACK_PRESSURE_DELAY_MINIMUM_MS); } uint32_t @@ -654,7 +671,7 @@ TimeoutManager::MaybeApplyBackPressure() // rarely fire under normaly circumstances. Its low enough, though, // that we should have time to slow new runnables from being added before an // OOM occurs. - if (queue->Length() < kThrottledEventQueueBackPressure) { + if (queue->Length() < gThrottledEventQueueBackPressure) { return; } @@ -712,8 +729,8 @@ TimeoutManager::CancelOrUpdateBackPressure(nsGlobalWindow* aWindow) // can be quite expensive. We only want to call that method if the back log // is really clearing. else if (newBackPressureDelayMS == 0 || - (mBackPressureDelayMS > - (newBackPressureDelayMS + kBackPressureDelayReductionThresholdMS))) { + (static_cast(mBackPressureDelayMS) > + (newBackPressureDelayMS + gBackPressureDelayReductionThresholdMS))) { int32_t oldBackPressureDelayMS = mBackPressureDelayMS; mBackPressureDelayMS = newBackPressureDelayMS; From e68e4a6f44772de7a8dfc6b6374282c069d25570 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 3 Feb 2017 11:27:14 +1100 Subject: [PATCH 57/70] Bug 1336326 (part 1) - Remove Sampler::GetRegisteredThreads(). r=mstange. Sampler::sRegisteredThreadsMutex is public. Might as well make Sampler::sRegisteredThreads public too. This allows the getter to be removed, and makes the code a little easier to read. --HG-- extra : rebase_source : 4ff3ba92c9d74ae1b10a2be227ca15f61d15bee2 --- tools/profiler/core/platform-linux.cc | 6 ++---- tools/profiler/core/platform-macos.cc | 6 ++---- tools/profiler/core/platform-win32.cc | 6 ++---- tools/profiler/core/platform.cpp | 5 ++--- tools/profiler/core/platform.h | 7 +------ 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/tools/profiler/core/platform-linux.cc b/tools/profiler/core/platform-linux.cc index 56e22949f56a..39c8ac92da8d 100644 --- a/tools/profiler/core/platform-linux.cc +++ b/tools/profiler/core/platform-linux.cc @@ -310,12 +310,10 @@ static void* SignalSender(void* arg) { if (!SamplerRegistry::sampler->IsPaused()) { MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); - const std::vector& threads = - SamplerRegistry::sampler->GetRegisteredThreads(); bool isFirstProfiledThread = true; - for (uint32_t i = 0; i < threads.size(); i++) { - ThreadInfo* info = threads[i]; + for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { + ThreadInfo* info = (*Sampler::sRegisteredThreads)[i]; // This will be null if we're not interested in profiling this thread. if (!info->hasProfile() || info->IsPendingDelete()) { diff --git a/tools/profiler/core/platform-macos.cc b/tools/profiler/core/platform-macos.cc index 148828779ce2..c620f6c3c241 100644 --- a/tools/profiler/core/platform-macos.cc +++ b/tools/profiler/core/platform-macos.cc @@ -177,11 +177,9 @@ public: SamplerRegistry::sampler->DeleteExpiredMarkers(); if (!SamplerRegistry::sampler->IsPaused()) { MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); - const std::vector& threads = - SamplerRegistry::sampler->GetRegisteredThreads(); bool isFirstProfiledThread = true; - for (uint32_t i = 0; i < threads.size(); i++) { - ThreadInfo* info = threads[i]; + for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { + ThreadInfo* info = (*Sampler::sRegisteredThreads)[i]; // This will be null if we're not interested in profiling this thread. if (!info->hasProfile() || info->IsPendingDelete()) { diff --git a/tools/profiler/core/platform-win32.cc b/tools/profiler/core/platform-win32.cc index 9f1f83276550..bc5e607558bb 100644 --- a/tools/profiler/core/platform-win32.cc +++ b/tools/profiler/core/platform-win32.cc @@ -167,11 +167,9 @@ class SamplerThread if (!mSampler->IsPaused()) { mozilla::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); - const std::vector& threads = - mSampler->GetRegisteredThreads(); bool isFirstProfiledThread = true; - for (uint32_t i = 0; i < threads.size(); i++) { - ThreadInfo* info = threads[i]; + for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { + ThreadInfo* info = (*Sampler::sRegisteredThreads)[i]; // This will be null if we're not interested in profiling this thread. if (!info->hasProfile() || info->IsPendingDelete()) { diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 2b719fa2c5cf..a2d6e06f829d 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -745,10 +745,9 @@ profiler_start(int aProfileEntries, double aInterval, gSampler->Start(); if (gSampler->ProfileJS() || gSampler->InPrivacyMode()) { mozilla::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); - const std::vector& threads = gSampler->GetRegisteredThreads(); - for (uint32_t i = 0; i < threads.size(); i++) { - ThreadInfo* info = threads[i]; + for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { + ThreadInfo* info = (*Sampler::sRegisteredThreads)[i]; if (info->IsPendingDelete() || !info->hasProfile()) { continue; } diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index c966b9eacc83..9ab33ce8ef01 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -297,10 +297,6 @@ public: static uintptr_t GetThreadHandle(PlatformData*); #endif - static const std::vector& GetRegisteredThreads() { - return *sRegisteredThreads; - } - static bool RegisterCurrentThread(const char* aName, PseudoStack* aPseudoStack, bool aIsMainThread, void* stackTop); @@ -311,6 +307,7 @@ public: static void Shutdown(); static mozilla::UniquePtr sRegisteredThreadsMutex; + static std::vector* sRegisteredThreads; static bool CanNotifyObservers() { #ifdef MOZ_WIDGET_GONK @@ -365,8 +362,6 @@ private: void SetActive(bool value) { NoBarrier_Store(&active_, value); } - static std::vector* sRegisteredThreads; - const double interval_; Atomic32 paused_; Atomic32 active_; From 7302f2a052ba64b86c1381ab0ec33905fb87e87e Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 3 Feb 2017 13:11:34 +1100 Subject: [PATCH 58/70] Bug 1336326 (part 2) - Make sRegisteredThreadsMutex a StaticMutex. r=mstange. StaticMutexes don't need to be created or destroyed, which avoids the need for checking if they still exist. This patch also adds locking to a few functions that lacked it. Every access to sRegisteredThreads is now protected appropriately. --HG-- extra : rebase_source : 2ea1d7372652ddd532e6e98c167be0997df33f07 --- tools/profiler/core/Sampler.cpp | 39 +++++++++++++++------------ tools/profiler/core/platform-linux.cc | 2 +- tools/profiler/core/platform-macos.cc | 4 ++- tools/profiler/core/platform-win32.cc | 3 ++- tools/profiler/core/platform.cpp | 2 +- tools/profiler/core/platform.h | 4 +-- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/tools/profiler/core/Sampler.cpp b/tools/profiler/core/Sampler.cpp index f39108a54119..12ec6de50879 100644 --- a/tools/profiler/core/Sampler.cpp +++ b/tools/profiler/core/Sampler.cpp @@ -199,7 +199,7 @@ hasFeature(const char** aFeatures, uint32_t aFeatureCount, const char* aFeature) } std::vector* Sampler::sRegisteredThreads = nullptr; -mozilla::UniquePtr Sampler::sRegisteredThreadsMutex; +StaticMutex Sampler::sRegisteredThreadsMutex; Sampler::Sampler(double aInterval, int aEntrySize, const char** aFeatures, uint32_t aFeatureCount, @@ -251,7 +251,7 @@ Sampler::Sampler(double aInterval, int aEntrySize, sStartTime = mozilla::TimeStamp::ProcessCreation(ignore); { - MutexAutoLock lock(*sRegisteredThreadsMutex); + StaticMutexAutoLock lock(sRegisteredThreadsMutex); // Set up profiling for each registered thread, if appropriate for (uint32_t i = 0; i < sRegisteredThreads->size(); i++) { @@ -279,7 +279,7 @@ Sampler::~Sampler() // Destroy ThreadInfo for all threads { - MutexAutoLock lock(*sRegisteredThreadsMutex); + StaticMutexAutoLock lock(sRegisteredThreadsMutex); for (uint32_t i = 0; i < sRegisteredThreads->size(); i++) { ThreadInfo* info = sRegisteredThreads->at(i); @@ -307,8 +307,9 @@ Sampler::~Sampler() void Sampler::Startup() { + StaticMutexAutoLock lock(sRegisteredThreadsMutex); + sRegisteredThreads = new std::vector(); - sRegisteredThreadsMutex = MakeUnique("sRegisteredThreadsMutex"); // We could create the sLUL object and read unwind info into it at // this point. That would match the lifetime implied by destruction @@ -321,17 +322,16 @@ Sampler::Startup() void Sampler::Shutdown() { + StaticMutexAutoLock lock(sRegisteredThreadsMutex); + while (sRegisteredThreads->size() > 0) { delete sRegisteredThreads->back(); sRegisteredThreads->pop_back(); } - sRegisteredThreadsMutex = nullptr; - delete sRegisteredThreads; - // UnregisterThread can be called after shutdown in XPCShell. Thus // we need to point to null to ignore such a call after shutdown. - sRegisteredThreadsMutex = nullptr; + delete sRegisteredThreads; sRegisteredThreads = nullptr; #if defined(USE_LUL_STACKWALK) @@ -348,12 +348,12 @@ Sampler::RegisterCurrentThread(const char* aName, PseudoStack* aPseudoStack, bool aIsMainThread, void* stackTop) { - if (!sRegisteredThreadsMutex) { + StaticMutexAutoLock lock(sRegisteredThreadsMutex); + + if (!sRegisteredThreads) { return false; } - MutexAutoLock lock(*sRegisteredThreadsMutex); - Thread::tid_t id = Thread::GetCurrentId(); for (uint32_t i = 0; i < sRegisteredThreads->size(); i++) { @@ -382,12 +382,12 @@ Sampler::RegisterCurrentThread(const char* aName, void Sampler::UnregisterCurrentThread() { - if (!sRegisteredThreadsMutex) { + StaticMutexAutoLock lock(sRegisteredThreadsMutex); + + if (!sRegisteredThreads) { return; } - MutexAutoLock lock(*sRegisteredThreadsMutex); - Thread::tid_t id = Thread::GetCurrentId(); for (uint32_t i = 0; i < sRegisteredThreads->size(); i++) { @@ -426,11 +426,14 @@ Sampler::StreamTaskTracer(SpliceableJSONWriter& aWriter) aWriter.EndArray(); aWriter.StartArrayProperty("threads"); - MutexAutoLock lock(*sRegisteredThreadsMutex); + { + StaticMutexAutoLock lock(sRegisteredThreadsMutex); + for (size_t i = 0; i < sRegisteredThreads->size(); i++) { // Thread meta data ThreadInfo* info = sRegisteredThreads->at(i); aWriter.StartObjectElement(); + { if (XRE_GetProcessType() == GeckoProcessType_Plugin) { // TODO Add the proper plugin name aWriter.StringProperty("name", "Plugin"); @@ -438,8 +441,10 @@ Sampler::StreamTaskTracer(SpliceableJSONWriter& aWriter) aWriter.StringProperty("name", info->Name()); } aWriter.IntProperty("tid", static_cast(info->ThreadId())); + } aWriter.EndObject(); } + } aWriter.EndArray(); aWriter.DoubleProperty("start", static_cast(mozilla::tasktracer::GetStartTime())); @@ -665,7 +670,7 @@ Sampler::StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime) SetPaused(true); { - MutexAutoLock lock(*sRegisteredThreadsMutex); + StaticMutexAutoLock lock(sRegisteredThreadsMutex); for (size_t i = 0; i < sRegisteredThreads->size(); i++) { // Thread not being profiled, skip it @@ -721,7 +726,7 @@ Sampler::FlushOnJSShutdown(JSContext* aContext) SetPaused(true); { - MutexAutoLock lock(*sRegisteredThreadsMutex); + StaticMutexAutoLock lock(sRegisteredThreadsMutex); for (size_t i = 0; i < sRegisteredThreads->size(); i++) { // Thread not being profiled, skip it. diff --git a/tools/profiler/core/platform-linux.cc b/tools/profiler/core/platform-linux.cc index 39c8ac92da8d..eebcdf471a46 100644 --- a/tools/profiler/core/platform-linux.cc +++ b/tools/profiler/core/platform-linux.cc @@ -309,7 +309,7 @@ static void* SignalSender(void* arg) { SamplerRegistry::sampler->DeleteExpiredMarkers(); if (!SamplerRegistry::sampler->IsPaused()) { - MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); + StaticMutexAutoLock lock(Sampler::sRegisteredThreadsMutex); bool isFirstProfiledThread = true; for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { diff --git a/tools/profiler/core/platform-macos.cc b/tools/profiler/core/platform-macos.cc index c620f6c3c241..7522bc030011 100644 --- a/tools/profiler/core/platform-macos.cc +++ b/tools/profiler/core/platform-macos.cc @@ -175,8 +175,10 @@ public: TimeStamp sampleStart = TimeStamp::Now(); while (SamplerRegistry::sampler->IsActive()) { SamplerRegistry::sampler->DeleteExpiredMarkers(); + if (!SamplerRegistry::sampler->IsPaused()) { - MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); + StaticMutexAutoLock lock(Sampler::sRegisteredThreadsMutex); + bool isFirstProfiledThread = true; for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { ThreadInfo* info = (*Sampler::sRegisteredThreads)[i]; diff --git a/tools/profiler/core/platform-win32.cc b/tools/profiler/core/platform-win32.cc index bc5e607558bb..e4737e0ef0c7 100644 --- a/tools/profiler/core/platform-win32.cc +++ b/tools/profiler/core/platform-win32.cc @@ -166,7 +166,8 @@ class SamplerThread mSampler->DeleteExpiredMarkers(); if (!mSampler->IsPaused()) { - mozilla::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); + mozilla::StaticMutexAutoLock lock(Sampler::sRegisteredThreadsMutex); + bool isFirstProfiledThread = true; for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { ThreadInfo* info = (*Sampler::sRegisteredThreads)[i]; diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index a2d6e06f829d..891f2a6f7a17 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -744,7 +744,7 @@ profiler_start(int aProfileEntries, double aInterval, gSampler->Start(); if (gSampler->ProfileJS() || gSampler->InPrivacyMode()) { - mozilla::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex); + mozilla::StaticMutexAutoLock lock(Sampler::sRegisteredThreadsMutex); for (uint32_t i = 0; i < Sampler::sRegisteredThreads->size(); i++) { ThreadInfo* info = (*Sampler::sRegisteredThreads)[i]; diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index 9ab33ce8ef01..644b231d889b 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -42,7 +42,7 @@ #include #include #include "MainThreadUtils.h" -#include "mozilla/Mutex.h" +#include "mozilla/StaticMutex.h" #include "ThreadResponsiveness.h" #include "mozilla/TimeStamp.h" #include "mozilla/UniquePtr.h" @@ -306,7 +306,7 @@ public: // Should only be called on shutdown static void Shutdown(); - static mozilla::UniquePtr sRegisteredThreadsMutex; + static mozilla::StaticMutex sRegisteredThreadsMutex; static std::vector* sRegisteredThreads; static bool CanNotifyObservers() { From 46b88ab7a656299f7e1a6e947d2944700a79b424 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 3 Feb 2017 13:18:02 +1100 Subject: [PATCH 59/70] Bug 1336326 (part 3) - Remove SamplerRegistry. r=mstange. We only have one global Sampler, gSampler, and so SamplerRegistry is just an unnecessary and obfuscating wrapper around it. --HG-- extra : rebase_source : b675c414d0081dab2cd7dac864ffdff5070afe7d --- tools/profiler/core/platform-linux.cc | 28 ++++------------ tools/profiler/core/platform-macos.cc | 47 +++++++++------------------ tools/profiler/core/platform-win32.cc | 30 +++++++++-------- 3 files changed, 38 insertions(+), 67 deletions(-) diff --git a/tools/profiler/core/platform-linux.cc b/tools/profiler/core/platform-linux.cc index eebcdf471a46..18a9dffc2055 100644 --- a/tools/profiler/core/platform-linux.cc +++ b/tools/profiler/core/platform-linux.cc @@ -161,19 +161,6 @@ static void* setup_atfork() { } #endif /* !defined(ANDROID) */ -struct SamplerRegistry { - static void AddActiveSampler(Sampler *sampler) { - MOZ_ASSERT(!SamplerRegistry::sampler); - SamplerRegistry::sampler = sampler; - } - static void RemoveActiveSampler(Sampler *sampler) { - SamplerRegistry::sampler = NULL; - } - static Sampler *sampler; -}; - -Sampler *SamplerRegistry::sampler = NULL; - static mozilla::Atomic sCurrentThreadInfo; static sem_t sSignalHandlingDone; @@ -304,11 +291,11 @@ static void* SignalSender(void* arg) { TimeDuration lastSleepOverhead = 0; TimeStamp sampleStart = TimeStamp::Now(); - while (SamplerRegistry::sampler->IsActive()) { + // XXX: this loop is an off-main-thread use of gSampler + while (gSampler->IsActive()) { + gSampler->DeleteExpiredMarkers(); - SamplerRegistry::sampler->DeleteExpiredMarkers(); - - if (!SamplerRegistry::sampler->IsPaused()) { + if (!gSampler->IsPaused()) { StaticMutexAutoLock lock(Sampler::sRegisteredThreadsMutex); bool isFirstProfiledThread = true; @@ -369,7 +356,8 @@ static void* SignalSender(void* arg) { } } - TimeStamp targetSleepEndTime = sampleStart + TimeDuration::FromMicroseconds(SamplerRegistry::sampler->interval() * 1000); + TimeStamp targetSleepEndTime = + sampleStart + TimeDuration::FromMicroseconds(gSampler->interval() * 1000); TimeStamp beforeSleep = TimeStamp::Now(); TimeDuration targetSleepDuration = targetSleepEndTime - beforeSleep; double sleepTime = std::max(0.0, (targetSleepDuration - lastSleepOverhead).ToMicroseconds()); @@ -393,8 +381,6 @@ void Sampler::Start() { } #endif - SamplerRegistry::AddActiveSampler(this); - // Initialize signal handler communication sCurrentThreadInfo = nullptr; if (sem_init(&sSignalHandlingDone, /* pshared: */ 0, /* value: */ 0) != 0) { @@ -450,8 +436,6 @@ void Sampler::Stop() { signal_sender_launched_ = false; } - SamplerRegistry::RemoveActiveSampler(this); - // Restore old signal handler if (signal_handler_installed_) { sigaction(SIGPROF, &old_sigprof_signal_handler_, 0); diff --git a/tools/profiler/core/platform-macos.cc b/tools/profiler/core/platform-macos.cc index 7522bc030011..72a3853b7c50 100644 --- a/tools/profiler/core/platform-macos.cc +++ b/tools/profiler/core/platform-macos.cc @@ -43,21 +43,6 @@ using mozilla::TimeDuration; // this port is based off of v8 svn revision 9837 -// XXX: this is a very stubbed out implementation -// that only supports a single Sampler -struct SamplerRegistry { - static void AddActiveSampler(Sampler *sampler) { - MOZ_ASSERT(!SamplerRegistry::sampler); - SamplerRegistry::sampler = sampler; - } - static void RemoveActiveSampler(Sampler *sampler) { - SamplerRegistry::sampler = NULL; - } - static Sampler *sampler; -}; - -Sampler *SamplerRegistry::sampler = NULL; - #ifdef DEBUG // 0 is never a valid thread id on MacOSX since a pthread_t is a pointer. static const pthread_t kNoThread = (pthread_t) 0; @@ -153,19 +138,17 @@ public: pthread_join(mThread, NULL); } - static void AddActiveSampler(Sampler* sampler) { - SamplerRegistry::AddActiveSampler(sampler); + static void AddActiveSampler() { + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + if (mInstance == NULL) { - mInstance = new SamplerThread(sampler->interval()); + mInstance = new SamplerThread(gSampler->interval()); mInstance->Start(); } } - static void RemoveActiveSampler(Sampler* sampler) { + static void RemoveActiveSampler() { mInstance->Join(); - //XXX: unlike v8 we need to remove the active sampler after doing the Join - // because we drop the sampler immediately - SamplerRegistry::RemoveActiveSampler(sampler); delete mInstance; mInstance = NULL; } @@ -173,10 +156,12 @@ public: void Run() { TimeDuration lastSleepOverhead = 0; TimeStamp sampleStart = TimeStamp::Now(); - while (SamplerRegistry::sampler->IsActive()) { - SamplerRegistry::sampler->DeleteExpiredMarkers(); - if (!SamplerRegistry::sampler->IsPaused()) { + // XXX: this loop is an off-main-thread use of gSampler + while (gSampler->IsActive()) { + gSampler->DeleteExpiredMarkers(); + + if (!gSampler->IsPaused()) { StaticMutexAutoLock lock(Sampler::sRegisteredThreadsMutex); bool isFirstProfiledThread = true; @@ -196,7 +181,7 @@ public: info->UpdateThreadResponsiveness(); - SampleContext(SamplerRegistry::sampler, info, isFirstProfiledThread); + SampleContext(info, isFirstProfiledThread); isFirstProfiledThread = false; } } @@ -211,8 +196,7 @@ public: } } - void SampleContext(Sampler* sampler, ThreadInfo* aThreadInfo, - bool isFirstProfiledThread) + void SampleContext(ThreadInfo* aThreadInfo, bool isFirstProfiledThread) { thread_act_t profiled_thread = aThreadInfo->GetPlatformData()->profiled_thread(); @@ -267,7 +251,8 @@ public: sample->timestamp = mozilla::TimeStamp::Now(); sample->threadInfo = aThreadInfo; - sampler->Tick(sample); + // XXX: this is an off-main-thread use of gSampler + gSampler->Tick(sample); } thread_resume(profiled_thread); } @@ -289,13 +274,13 @@ SamplerThread* SamplerThread::mInstance = NULL; void Sampler::Start() { MOZ_ASSERT(!IsActive()); SetActive(true); - SamplerThread::AddActiveSampler(this); + SamplerThread::AddActiveSampler(); } void Sampler::Stop() { MOZ_ASSERT(IsActive()); SetActive(false); - SamplerThread::RemoveActiveSampler(this); + SamplerThread::RemoveActiveSampler(); } /* static */ Thread::tid_t diff --git a/tools/profiler/core/platform-win32.cc b/tools/profiler/core/platform-win32.cc index e4737e0ef0c7..c35355ac9a2f 100644 --- a/tools/profiler/core/platform-win32.cc +++ b/tools/profiler/core/platform-win32.cc @@ -96,10 +96,9 @@ class SamplerThread public: // Initialize a Win32 thread object. The thread has an invalid thread // handle until it is started. - SamplerThread(double interval, Sampler* sampler) + explicit SamplerThread(double interval) : mStackSize(0) , mThread(kNoThread) - , mSampler(sampler) , mInterval(interval) { mInterval = floor(interval + 0.5); @@ -140,12 +139,14 @@ class SamplerThread } } - static void StartSampler(Sampler* sampler) { + static void StartSampler() { + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + if (mInstance == NULL) { - mInstance = new SamplerThread(sampler->interval(), sampler); + mInstance = new SamplerThread(gSampler->interval()); mInstance->Start(); } else { - MOZ_ASSERT(mInstance->mInterval == sampler->interval()); + MOZ_ASSERT(mInstance->mInterval == gSampler->interval()); } } @@ -162,10 +163,11 @@ class SamplerThread if (mInterval < 10) ::timeBeginPeriod(mInterval); - while (mSampler->IsActive()) { - mSampler->DeleteExpiredMarkers(); + // XXX: this loop is an off-main-thread use of gSampler + while (gSampler->IsActive()) { + gSampler->DeleteExpiredMarkers(); - if (!mSampler->IsPaused()) { + if (!gSampler->IsPaused()) { mozilla::StaticMutexAutoLock lock(Sampler::sRegisteredThreadsMutex); bool isFirstProfiledThread = true; @@ -185,7 +187,7 @@ class SamplerThread info->UpdateThreadResponsiveness(); - SampleContext(mSampler, info, isFirstProfiledThread); + SampleContext(info, isFirstProfiledThread); isFirstProfiledThread = false; } } @@ -197,8 +199,7 @@ class SamplerThread ::timeEndPeriod(mInterval); } - void SampleContext(Sampler* sampler, ThreadInfo* aThreadInfo, - bool isFirstProfiledThread) + void SampleContext(ThreadInfo* aThreadInfo, bool isFirstProfiledThread) { uintptr_t thread = Sampler::GetThreadHandle(aThreadInfo->GetPlatformData()); HANDLE profiled_thread = reinterpret_cast(thread); @@ -280,7 +281,9 @@ class SamplerThread #endif sample->context = &context; - sampler->Tick(sample); + + // XXX: this is an off-main-thread use of gSampler + gSampler->Tick(sample); ResumeThread(profiled_thread); } @@ -290,7 +293,6 @@ private: HANDLE mThread; Thread::tid_t mThreadId; - Sampler* mSampler; int mInterval; // units: ms // Protects the process wide state below. @@ -304,7 +306,7 @@ SamplerThread* SamplerThread::mInstance = NULL; void Sampler::Start() { MOZ_ASSERT(!IsActive()); SetActive(true); - SamplerThread::StartSampler(this); + SamplerThread::StartSampler(); } void Sampler::Stop() { From 07ad57645482b56e80745396c3102e9478da04e5 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Mon, 6 Feb 2017 08:13:55 -0800 Subject: [PATCH 60/70] No bug, Automated HSTS preload list update from host bld-linux64-spot-1037 - a=hsts-update --- security/manager/ssl/nsSTSPreloadList.errors | 175 +- security/manager/ssl/nsSTSPreloadList.inc | 29258 +++++++++-------- 2 files changed, 14720 insertions(+), 14713 deletions(-) diff --git a/security/manager/ssl/nsSTSPreloadList.errors b/security/manager/ssl/nsSTSPreloadList.errors index d8efecedded2..278ecabbf16d 100644 --- a/security/manager/ssl/nsSTSPreloadList.errors +++ b/security/manager/ssl/nsSTSPreloadList.errors @@ -131,7 +131,6 @@ aficotroceni.ro: did not receive HSTS header afp548.tk: could not connect to host agalaxyfarfaraway.co.uk: could not connect to host agbremen.de: did not receive HSTS header -agdalieso.com.ba: did not receive HSTS header agilebits.net: could not connect to host agrias.com.br: could not connect to host agrimap.com: did not receive HSTS header @@ -143,6 +142,7 @@ ahmedabadflowermall.com: did not receive HSTS header ahoynetwork.com: could not connect to host ahri.ovh: could not connect to host aidanwoods.com: did not receive HSTS header +aimeeandalec.com: did not receive HSTS header airbnb.com: did not receive HSTS header aircomms.com: did not receive HSTS header airlinecheckins.com: could not connect to host @@ -167,6 +167,8 @@ alarmsystemreviews.com: did not receive HSTS header albertopimienta.com: did not receive HSTS header alcazaar.com: could not connect to host aleax.me: could not connect to host +alecpap.com: did not receive HSTS header +alecpapierniak.com: did not receive HSTS header alecvannoten.be: did not receive HSTS header alenan.org: could not connect to host alessandro.pw: did not receive HSTS header @@ -182,7 +184,7 @@ alldaymonitoring.com: could not connect to host allforyou.at: could not connect to host allinnote.com: could not connect to host allmbw.com: could not connect to host -allo-symo.fr: could not connect to host +allo-symo.fr: did not receive HSTS header allstarswithus.com: could not connect to host alpha.irccloud.com: could not connect to host alphabit-secure.com: could not connect to host @@ -194,11 +196,13 @@ altmv.com: max-age too low: 7776000 alwaysmine.fi: did not receive HSTS header amaforums.org: could not connect to host amavis.org: did not receive HSTS header +amees.me: could not connect to host ameho.me: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] american-truck-simulator.de: could not connect to host american-truck-simulator.net: could not connect to host americanworkwear.nl: did not receive HSTS header amigogeek.net: could not connect to host +amilum.org: could not connect to host amilx.com: could not connect to host amilx.org: could not connect to host amimoto-ami.com: max-age too low: 3153600 @@ -215,13 +219,11 @@ andere-gedanken.net: max-age too low: 10 andiplusben.com: could not connect to host andisadhdspot.com: did not receive HSTS header andreasbreitenlohner.de: did not receive HSTS header -andreaskrasa.com: could not connect to host andreasolsson.se: could not connect to host andreastoneman.com: could not connect to host andreigec.net: did not receive HSTS header andrewbroekman.com: could not connect to host andrewmichaud.beer: could not connect to host -andrewx.net: did not receive HSTS header andreypopp.com: could not connect to host androoz.se: did not receive HSTS header andymartin.cc: did not receive HSTS header @@ -254,7 +256,6 @@ antscript.com: did not receive HSTS header any.pm: could not connect to host anycoin.me: could not connect to host apachelounge.com: did not receive HSTS header -apbox.de: could not connect to host apeasternpower.com: max-age too low: 0 api.mega.co.nz: could not connect to host apibot.de: could not connect to host @@ -306,9 +307,10 @@ asdpress.cn: could not connect to host ashlane-cottages.com: could not connect to host ashutoshmishra.org: did not receive HSTS header askfit.cz: did not receive HSTS header +asm-x.com: could not connect to host asmui.ga: could not connect to host asmui.ml: could not connect to host -asrob.eu: could not connect to host +asrob.eu: did not receive HSTS header ass.org.au: did not receive HSTS header assdecoeur.org: could not connect to host assekuranzjobs.de: could not connect to host @@ -317,6 +319,7 @@ asset-alive.net: did not receive HSTS header astrath.net: could not connect to host astrolpost.com: could not connect to host astromelody.com: did not receive HSTS header +asuhe.cc: did not receive HSTS header atavio.at: could not connect to host atavio.ch: could not connect to host atavio.de: did not receive HSTS header @@ -364,7 +367,6 @@ awg-mode.de: did not receive HSTS header axado.com.br: did not receive HSTS header axeny.com: did not receive HSTS header az.search.yahoo.com: did not receive HSTS header -azabani.com: could not connect to host azprep.us: could not connect to host b3orion.com: max-age too low: 0 babelfisch.eu: could not connect to host @@ -468,7 +470,6 @@ bildschirmflackern.de: did not receive HSTS header billin.net: could not connect to host billkiss.com: max-age too low: 300 billninja.com: could not connect to host -binaryfigments.com: could not connect to host binderapp.net: could not connect to host biofam.ru: did not receive HSTS header bionicspirit.com: could not connect to host @@ -519,6 +520,7 @@ bloglikepro.com: could not connect to host blubbablasen.de: could not connect to host blucas.org: did not receive HSTS header blueglobalmedia.com: max-age too low: 0 +blueimp.net: did not receive HSTS header blueliv.com: did not receive HSTS header bluescloud.xyz: could not connect to host bluetenmeer.com: did not receive HSTS header @@ -537,7 +539,7 @@ bohan.life: could not connect to host bombsquad.studio: could not connect to host bonapp.restaurant: could not connect to host bonfi.net: did not receive HSTS header -bonigo.de: could not connect to host +bonigo.de: did not receive HSTS header bonitabrazilian.co.nz: did not receive HSTS header bonnyprints.fr: could not connect to host bookcelerator.com: did not receive HSTS header @@ -567,6 +569,7 @@ brandon.so: could not connect to host brandred.net: could not connect to host brandspray.com: did not receive HSTS header bratislava-airport-taxi.com: could not connect to host +brettabel.com: did not receive HSTS header brianmwaters.net: did not receive HSTS header brickoo.com: could not connect to host brid.gy: did not receive HSTS header @@ -582,7 +585,6 @@ bsquared.org: could not connect to host btcdlc.com: could not connect to host buchheld.at: did not receive HSTS header bucket.tk: could not connect to host -budger.nl: could not connect to host budgetthostels.nl: did not receive HSTS header budskap.eu: could not connect to host bugs.chromium.org: did not receive HSTS header (error ignored - included regardless) @@ -594,6 +596,7 @@ built.by: did not receive HSTS header builtritetrailerplans.com: could not connect to host bullbits.com: could not connect to host bulletpoint.cz: did not receive HSTS header +bulmafox.com: could not connect to host bumarkamoda.com: could not connect to host bunaken.asia: could not connect to host burian-server.cz: could not connect to host @@ -633,6 +636,7 @@ calendarr.com: did not receive HSTS header calgaryconstructionjobs.com: did not receive HSTS header calix.com: max-age too low: 0 calltrackingreports.com: could not connect to host +calories.org: could not connect to host calvin.me: max-age too low: 2592000 calvinallen.net: did not receive HSTS header calyxinstitute.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -648,6 +652,7 @@ capecycles.co.za: could not connect to host capper.de: could not connect to host captchatheprize.com: could not connect to host capturethepen.co.uk: could not connect to host +caputodesign.com: could not connect to host car-navi.ph: did not receive HSTS header carano-service.de: did not receive HSTS header caraudio69.cz: could not connect to host @@ -659,6 +664,7 @@ caringladies.org: could not connect to host carlandfaith.com: did not receive HSTS header carlolly.co.uk: could not connect to host carlosalves.info: could not connect to host +carnildo.com: could not connect to host carsforbackpackers.com: could not connect to host casedi.org: max-age too low: 0 cashmojo.com: max-age too low: 0 @@ -697,7 +703,6 @@ cfetengineering.com: could not connect to host cg.search.yahoo.com: did not receive HSTS header chainmonitor.com: could not connect to host chamathellawala.com: could not connect to host -chamilo.org: could not connect to host championsofregnum.com: did not receive HSTS header chandlerredding.com: could not connect to host changelab.cc: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -719,7 +724,9 @@ chebedara.com: could not connect to host checkout.google.com: did not receive HSTS header (error ignored - included regardless) cheerflow.com: could not connect to host cheesetart.my: could not connect to host +cheetah85.de: could not connect to host chejianer.cn: did not receive HSTS header +chenky.com: could not connect to host chensir.net: could not connect to host cherysunzhang.com: max-age too low: 7776000 chihiro.xyz: could not connect to host @@ -842,11 +849,9 @@ comfy.moe: could not connect to host comicspines.com: could not connect to host compalytics.com: could not connect to host comparejewelleryprices.co.uk: could not connect to host -compiledworks.com: could not connect to host completeid.com: max-age too low: 86400 completionist.audio: could not connect to host compucorner.com.mx: could not connect to host -computerhilfe-feucht.de: could not connect to host concord-group.co.jp: did not receive HSTS header condesaelectronics.com: max-age too low: 0 confirm365.com: could not connect to host @@ -862,7 +867,6 @@ content-api-dev.azurewebsites.net: could not connect to host continuumgaming.com: could not connect to host controlcenter.gigahost.dk: did not receive HSTS header convert.zone: could not connect to host -cookingreporter.com: did not receive HSTS header coolchevy.org.ua: could not connect to host cor-ser.es: could not connect to host coralproject.net: did not receive HSTS header @@ -871,7 +875,6 @@ cordial-restaurant.com: did not receive HSTS header core.mx: could not connect to host core4system.de: could not connect to host corenetworking.de: could not connect to host -corepartners.com.ua: could not connect to host cormilu.com.br: did not receive HSTS header coronelpicanha.com.br: could not connect to host correctpaardbatterijnietje.nl: did not receive HSTS header @@ -928,7 +931,6 @@ csfs.org.uk: could not connect to host csgodicegame.com: did not receive HSTS header csgoelemental.com: could not connect to host csgokings.eu: could not connect to host -cshopify.com: could not connect to host csohack.tk: could not connect to host cspbuilder.info: could not connect to host csvape.com: did not receive HSTS header @@ -949,7 +951,6 @@ cyberpunk.ca: could not connect to host cybershambles.com: could not connect to host cycleluxembourg.lu: did not receive HSTS header cydia-search.io: could not connect to host -cyph.com: did not receive HSTS header cyphertite.com: could not connect to host czlx.co: could not connect to host dad256.tk: could not connect to host @@ -997,8 +998,8 @@ datenreiter.ml: could not connect to host datenreiter.tk: could not connect to host datewon.net: did not receive HSTS header davidglidden.eu: could not connect to host -davidgreig.uk: did not receive HSTS header -davidgrudl.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] +davidgreig.uk: could not connect to host +davidgrudl.com: did not receive HSTS header davidhunter.scot: did not receive HSTS header davidnoren.com: did not receive HSTS header davidreinhardt.de: could not connect to host @@ -1012,8 +1013,6 @@ dcurt.is: did not receive HSTS header dden.ca: could not connect to host dden.website: could not connect to host dden.xyz: could not connect to host -dealpass.no: could not connect to host -deanjerkovich.com: could not connect to host debank.tv: did not receive HSTS header debatch.se: could not connect to host debian-vhost.de: did not receive HSTS header @@ -1034,6 +1033,7 @@ delayrefunds.co.uk: could not connect to host deliverance.co.uk: could not connect to host deltaconcepts.de: did not receive HSTS header deltanet-production.de: max-age too low: 0 +delvj.org: could not connect to host demdis.org: could not connect to host demilitarized.ninja: could not connect to host democracychronicles.com: did not receive HSTS header @@ -1086,6 +1086,7 @@ dizihocasi.com: did not receive HSTS header dizorg.net: could not connect to host dj4et.de: did not receive HSTS header djz4music.com: did not receive HSTS header +dkds.us: could not connect to host dl.google.com: did not receive HSTS header (error ignored - included regardless) dlc.viasinc.com: could not connect to host dlemper.de: did not receive HSTS header @@ -1109,6 +1110,7 @@ dollarstore24.com: could not connect to host dollywiki.co.uk: could not connect to host dolphin-cloud.com: could not connect to host dolphincorp.co.uk: could not connect to host +domadillo.com: could not connect to host domaris.de: did not receive HSTS header dominique-mueller.de: did not receive HSTS header donttrustrobots.nl: could not connect to host @@ -1126,7 +1128,6 @@ download.jitsi.org: did not receive HSTS header downsouthweddings.com.au: did not receive HSTS header doyoucheck.com: did not receive HSTS header dpratt.de: could not connect to host -dr2dr.ca: did not receive HSTS header dragonisles.net: could not connect to host dragons-of-highlands.cz: could not connect to host dragontrainingmobilezoo.com.au: max-age too low: 0 @@ -1137,7 +1138,6 @@ dreadbyte.com: could not connect to host dreaming.solutions: did not receive HSTS header drishti.guru: could not connect to host drive.google.com: did not receive HSTS header (error ignored - included regardless) -drobniuch.pl: could not connect to host droidboss.com: could not connect to host dropcam.com: did not receive HSTS header drtroyhendrickson.com: could not connect to host @@ -1278,6 +1278,8 @@ eromixx.com: did not receive HSTS header erotalia.es: could not connect to host eroticen.com: did not receive HSTS header erotische-aanbiedingen.nl: could not connect to host +erp-band.ru: could not connect to host +erpband.ru: could not connect to host errlytics.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] errolz.com: could not connect to host errors.zenpayroll.com: could not connect to host @@ -1306,6 +1308,7 @@ eulerpi.io: could not connect to host euph.eu: did not receive HSTS header eupho.me: could not connect to host euroshop24.net: could not connect to host +evanhandgraaf.nl: did not receive HSTS header evantage.org: could not connect to host evdenevenakliyatankara.pw: did not receive HSTS header everybooks.com: max-age too low: 60 @@ -1373,7 +1376,6 @@ fedramp.gov: could not connect to host fedux.com.ar: could not connect to host feedkovacs.hu: could not connect to host feezmodo.com: max-age too low: 0 -feirlane.org: could not connect to host felisslovakia.sk: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] feliwyn.fr: did not receive HSTS header feminists.co: could not connect to host @@ -1386,6 +1388,7 @@ fexmen.com: could not connect to host ffmradio.de: did not receive HSTS header fhdhelp.de: could not connect to host fhdhilft.de: could not connect to host +fierman.net: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] fiftyshadesofluca.ml: could not connect to host fig.co: did not receive HSTS header fightr.co: could not connect to host @@ -1419,15 +1422,12 @@ fj.search.yahoo.com: did not receive HSTS header fjruiz.es: could not connect to host flags.ninja: could not connect to host flamewall.net: could not connect to host -flamingcow.tv: did not receive HSTS header -flana.com: could not connect to host flareon.net: could not connect to host flawcheck.com: did not receive HSTS header fleurette.me: max-age too low: 0 fliexer.com: could not connect to host flirchi.com: did not receive HSTS header floless.co.uk: did not receive HSTS header -floort.net: could not connect to host florent-tatard.fr: could not connect to host florian-lillpopp.de: max-age too low: 10 florianlillpopp.de: max-age too low: 10 @@ -1444,7 +1444,6 @@ fnvsecurity.com: could not connect to host fonetiq.io: could not connect to host food4health.guide: could not connect to host foodievenues.com: could not connect to host -fooishbar.org: could not connect to host footballmapped.com: could not connect to host foraje-profesionale.ro: did not receive HSTS header forbook.net: could not connect to host @@ -1459,6 +1458,7 @@ fotm.net: did not receive HSTS header fotocerita.net: could not connect to host fotografosexpertos.com: did not receive HSTS header fotopasja.info: could not connect to host +fourchin.net: could not connect to host foxdev.io: could not connect to host foxelbox.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] foxtrot.pw: could not connect to host @@ -1518,7 +1518,7 @@ g2a.co: did not receive HSTS header g2g.com: did not receive HSTS header g4w.co: did not receive HSTS header (error ignored - included regardless) gabber.scot: could not connect to host -gaelleetarnaud.com: could not connect to host +gaelleetarnaud.com: did not receive HSTS header gafachi.com: could not connect to host gakkainavi4.com: could not connect to host galardi.org: did not receive HSTS header @@ -1554,6 +1554,7 @@ geeky.software: could not connect to host geli-graphics.com: did not receive HSTS header gem-indonesia.net: could not connect to host gendrin.com: could not connect to host +generic.cx: could not connect to host genuu.com: could not connect to host genuxation.com: could not connect to host genyaa.com: could not connect to host @@ -1583,6 +1584,7 @@ getlifti.com: did not receive HSTS header getlittleapps.com: could not connect to host getlolaccount.com: could not connect to host getmassage.com.ng: could not connect to host +getmdl.io: did not receive HSTS header getremembrall.com: could not connect to host getsello.com: did not receive HSTS header getwashdaddy.com: could not connect to host @@ -1662,12 +1664,10 @@ gparent.org: did not receive HSTS header gpsfix.cz: could not connect to host gpstuner.com: did not receive HSTS header gracesofgrief.com: max-age too low: 86400 -gracethrufaith.com: could not connect to host gradienthosting.co.uk: did not receive HSTS header granary-demo.appspot.com: did not receive HSTS header grandmascookieblog.com: did not receive HSTS header grantedby.me: could not connect to host -granular.ag: could not connect to host graph.no: did not receive HSTS header gravito.nl: did not receive HSTS header gravity-net.de: could not connect to host @@ -1680,7 +1680,6 @@ gregorytlee.me: did not receive HSTS header gremots.com: did not receive HSTS header greplin.com: could not connect to host gresb.com: did not receive HSTS header -greyline.se: could not connect to host gribani.com: could not connect to host grigalanzsoftware.com: could not connect to host grossmann.gr: could not connect to host @@ -1702,7 +1701,7 @@ gulenet.com: could not connect to host gunnarhafdal.com: did not receive HSTS header gurom.lv: could not connect to host gurusupe.com: could not connect to host -gussi.is: could not connect to host +gussi.is: did not receive HSTS header gvt2.com: could not connect to host (error ignored - included regardless) gvt3.com: could not connect to host (error ignored - included regardless) gw2reload.eu: could not connect to host @@ -1746,9 +1745,7 @@ hao2taiwan.com: max-age too low: 0 haoyugao.com: could not connect to host hapissl.com: could not connect to host happyfabric.me: did not receive HSTS header -happygadget.me: could not connect to host happygastro.com: could not connect to host -hapvm.com: could not connect to host harabuhouse.com: did not receive HSTS header harbor-light.net: could not connect to host hardline.xyz: could not connect to host @@ -1791,7 +1788,7 @@ helpmebuild.com: did not receive HSTS header hemdal.se: could not connect to host hencagon.com: could not connect to host henriknoerr.com: could not connect to host -henrock.net: could not connect to host +hepteract.us: did not receive HSTS header hermes-net.de: could not connect to host herpaderp.net: could not connect to host herzbotschaft.de: did not receive HSTS header @@ -1850,6 +1847,7 @@ hsir.me: could not connect to host hsts.date: could not connect to host hstsfail.appspot.com: did not receive HSTS header hstspreload.appspot.com: did not receive HSTS header +hstspreload.org: did not receive HSTS header http418.xyz: could not connect to host httpstatuscode418.xyz: could not connect to host hu.search.yahoo.com: did not receive HSTS header @@ -1887,6 +1885,7 @@ id-co.in: could not connect to host id-conf.com: could not connect to host idacmedia.com: max-age too low: 5184000 idcrane.com: could not connect to host +ideadozz.hu: could not connect to host ideal-envelopes.co.uk: did not receive HSTS header ideasmeetingpoint.com: could not connect to host ideation-inc.co.jp: did not receive HSTS header @@ -1913,6 +1912,7 @@ ilbuongiorno.it: did not receive HSTS header ilhadocaranguejo.com.br: could not connect to host ilikerainbows.co: could not connect to host ilikerainbows.co.uk: could not connect to host +illorenese.fr: could not connect to host ilmconpm.de: did not receive HSTS header ilona.graphics: max-age too low: 3600 iluvscotland.co.uk: did not receive HSTS header @@ -1966,7 +1966,7 @@ instagram-atom.appspot.com: did not receive HSTS header installgentoo.net: could not connect to host instantdev.io: could not connect to host institutoflordelavida.com: could not connect to host -institutolancaster.com: could not connect to host +institutolancaster.com: did not receive HSTS header intarweb.ca: could not connect to host intel.li: could not connect to host intelldynamics.com: could not connect to host @@ -2018,7 +2018,6 @@ itriskltd.com: could not connect to host itsadog.co.uk: did not receive HSTS header itsagadget.com: did not receive HSTS header itsamurai.ru: max-age too low: 2592000 -itsatrap.nl: could not connect to host itsecurityassurance.pw: could not connect to host itsg-faq.de: could not connect to host itshost.ru: could not connect to host @@ -2061,7 +2060,7 @@ jaqen.ch: could not connect to host jardins-utopie.net: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] jaredeberle.org: did not receive HSTS header jaroslavtrsek.cz: did not receive HSTS header -jarrettgraham.com: could not connect to host +jarrettgraham.com: did not receive HSTS header jartza.org: could not connect to host jasmineconseil.com: did not receive HSTS header jasonrobinson.me: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -2105,6 +2104,7 @@ jirav.io: could not connect to host jkb.pics: could not connect to host jkbuster.com: could not connect to host jmdekker.it: could not connect to host +jmk.hu: could not connect to host joakimalgroy.com: could not connect to host jobmedic.com: did not receive HSTS header joedavison.me: could not connect to host @@ -2134,11 +2134,13 @@ jualautoclave.com: did not receive HSTS header jualssh.com: could not connect to host juliamweber.de: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] julian-kipka.de: could not connect to host +julibear.com: could not connect to host jumbox.xyz: could not connect to host junaos.xyz: did not receive HSTS header junge-selbsthilfe.info: could not connect to host junqtion.com: could not connect to host jupp0r.de: did not receive HSTS header +justanothercompany.name: could not connect to host justlikethat.hosting: did not receive HSTS header justnaw.co.uk: could not connect to host justudin.com: did not receive HSTS header @@ -2150,7 +2152,6 @@ jznet.org: max-age too low: 86400 k-dev.de: could not connect to host ka-clan.com: could not connect to host kabuabc.com: did not receive HSTS header -kabus.org: could not connect to host kadioglumakina.com.tr: did not receive HSTS header kaela.design: could not connect to host kahopoon.net: could not connect to host @@ -2163,6 +2164,7 @@ kaplatz.is: could not connect to host kapucini.si: max-age too low: 0 karaoketonight.com: could not connect to host kasilag.me: did not receive HSTS header +katericke.com: could not connect to host katiaetdavid.fr: could not connect to host katproxy.online: could not connect to host katproxy.site: could not connect to host @@ -2174,7 +2176,6 @@ kawaii.io: could not connect to host kawaiiku.com: could not connect to host kawaiiku.de: could not connect to host kayon.cf: could not connect to host -kcptun.com: could not connect to host kd-plus.pp.ua: could not connect to host kdata.it: did not receive HSTS header kdm-online.de: did not receive HSTS header @@ -2183,7 +2184,6 @@ keeley.ml: could not connect to host keeleysam.com: could not connect to host keeleysam.me: could not connect to host keepclean.me: could not connect to host -kellyandantony.com: could not connect to host ken.fm: did not receive HSTS header kenderbeton-magyarorszag.hu: did not receive HSTS header kenderbetonmagyarorszag.hu: did not receive HSTS header @@ -2211,6 +2211,7 @@ kinkdr.com: could not connect to host kinnon.enterprises: could not connect to host kionetworks.com: did not receive HSTS header kipira.com: could not connect to host +kirbear.com: could not connect to host kirkforcongress.com: could not connect to host kirkforsenate.com: could not connect to host kirkpatrickdavis.com: could not connect to host @@ -2228,7 +2229,7 @@ kiwiirc.com: max-age too low: 5256000 kizil.net: could not connect to host kjaermaxi.me: did not receive HSTS header kjchernov.info: could not connect to host -klauwd.com: did not receive HSTS header +klauwd.com: could not connect to host klaxn.org: could not connect to host kleertjesvoordelig.nl: did not receive HSTS header kleinblogje.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -2247,7 +2248,6 @@ kollabria.com: max-age too low: 0 komikito.com: could not connect to host kompetenzwerft.de: did not receive HSTS header konata.us: could not connect to host -kongar.org: could not connect to host kontaxis.network: could not connect to host kontorhaus-schlachte.de: could not connect to host koop-bremen.de: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -2264,6 +2264,7 @@ krayx.com: could not connect to host kreavis.com: did not receive HSTS header kredite.sale: could not connect to host kriegt.es: could not connect to host +kristikala.nl: could not connect to host krmela.com: could not connect to host kroetenfuchs.de: could not connect to host kropkait.pl: could not connect to host @@ -2285,7 +2286,6 @@ kurtmclester.com: did not receive HSTS header kusaka-abacus.jp: max-age too low: 0 kvhile.com: could not connect to host kweddingplanning.com: did not receive HSTS header -kxind.cn: could not connect to host kyanite.co: could not connect to host kylapps.com: did not receive HSTS header kylinj.com: could not connect to host @@ -2295,7 +2295,7 @@ kzjnet.com: could not connect to host labaia.info: could not connect to host labina.com.tr: did not receive HSTS header laboiteapc.fr: did not receive HSTS header -labordata.io: could not connect to host +labordata.io: did not receive HSTS header labrador-retrievers.com.au: did not receive HSTS header labs.moscow: did not receive HSTS header lachlankidson.net: did not receive HSTS header @@ -2316,6 +2316,7 @@ laserfuchs.de: did not receive HSTS header lashstuff.com: did not receive HSTS header lask.in: did not receive HSTS header latour-managedcare.ch: did not receive HSTS header +latrine.cz: did not receive HSTS header latus.xyz: could not connect to host lausitzer-widerstand.de: could not connect to host lavine.ch: did not receive HSTS header @@ -2414,6 +2415,7 @@ livej.am: could not connect to host livi.co: did not receive HSTS header loadingdeck.com: did not receive HSTS header loafbox.com: could not connect to host +locchat.com: did not receive HSTS header locktheirphone.com: could not connect to host locomotive.ca: did not receive HSTS header loforo.com: could not connect to host @@ -2452,7 +2454,6 @@ lt.search.yahoo.com: did not receive HSTS header ltbytes.com: could not connect to host lu.search.yahoo.com: did not receive HSTS header lucaterzini.com: could not connect to host -lucidlogs.com: could not connect to host lufthansaexperts.com: max-age too low: 2592000 luine.xyz: could not connect to host luis-checa.com: could not connect to host @@ -2486,6 +2487,7 @@ maarten.nyc: did not receive HSTS header maartenvandekamp.nl: did not receive HSTS header mac-torrents.me: did not receive HSTS header macchaberrycream.com: could not connect to host +macdj.tk: could not connect to host macgeneral.de: did not receive HSTS header machon.biz: could not connect to host madars.org: did not receive HSTS header @@ -2623,6 +2625,7 @@ meuemail.pro: could not connect to host mexbt.com: could not connect to host mfcatalin.com: could not connect to host mfiles.pl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] +mgrossklaus.de: did not receive HSTS header mh-bloemen.co.jp: could not connect to host mhdsyarif.com: did not receive HSTS header mhealthdemocamp.com: could not connect to host @@ -2630,6 +2633,7 @@ mhertel.com: did not receive HSTS header mhict.nl: max-age too low: 0 mhx.pw: could not connect to host mia.to: could not connect to host +michaelcullen.name: could not connect to host michaelfitzpatrickruth.com: could not connect to host michaelwaite.org: could not connect to host michal-kral.cz: could not connect to host @@ -2650,7 +2654,6 @@ mijcorijneveld.nl: did not receive HSTS header mijn-email.org: could not connect to host mikaelemilsson.net: did not receive HSTS header mikeburns.com: did not receive HSTS header -mikecb.org: did not receive HSTS header mikeg.de: did not receive HSTS header mikek.work: could not connect to host mikeology.org: could not connect to host @@ -2749,7 +2752,6 @@ mt.me.uk: could not connect to host mt.search.yahoo.com: did not receive HSTS header mtcgf.com: did not receive HSTS header mtg-esport.de: could not connect to host -mtg-tutor.de: could not connect to host mu.search.yahoo.com: did not receive HSTS header mudcrab.us: did not receive HSTS header mujadin.se: did not receive HSTS header @@ -2760,7 +2762,6 @@ muriburiland.com: could not connect to host murodese.org: could not connect to host murraycoin.org: could not connect to host murrayrun.com: could not connect to host -musi.cx: could not connect to host musikkfondene.no: did not receive HSTS header mustika.cf: could not connect to host mutamatic.com: could not connect to host @@ -2850,7 +2851,6 @@ nemno.de: could not connect to host nemovement.org: did not receive HSTS header neonisi.com: could not connect to host nepustil.net: did not receive HSTS header -nerven.se: could not connect to host netba.net: could not connect to host netbox.cc: could not connect to host netherwind.eu: did not receive HSTS header @@ -2863,13 +2863,10 @@ netzpolitik.org: did not receive HSTS header netztest.at: did not receive HSTS header neueonlinecasino2016.com: could not connect to host neuralgic.net: could not connect to host +neuronasdigitales.com: could not connect to host neutralox.com: did not receive HSTS header never-afk.de: did not receive HSTS header neveta.com: could not connect to host -new-process.ch: could not connect to host -new-process.com: could not connect to host -new-process.de: could not connect to host -new-process.eu: could not connect to host newcitygas.ca: could not connect to host newkaliningrad.ru: did not receive HSTS header newlooknow.com: did not receive HSTS header @@ -2905,6 +2902,7 @@ nippombashi.net: did not receive HSTS header nipponcareers.com: did not receive HSTS header nixien.fr: could not connect to host nkinka.de: did not receive HSTS header +nlegall.fr: did not receive HSTS header nmctest.net: could not connect to host nnote.net: could not connect to host nnya.cat: could not connect to host @@ -2956,6 +2954,7 @@ null-sec.ru: could not connect to host null.cat: could not connect to host null.tips: could not connect to host nullpoint.at: did not receive HSTS header +number.me: did not receive HSTS header numericacu.com: did not receive HSTS header numero-di-telefono.it: could not connect to host nuos.org: could not connect to host @@ -3056,7 +3055,6 @@ oracaodocredo.com.br: could not connect to host orbiosales.com: could not connect to host orbitcom.de: max-age too low: 0 orbograph-hrcm.com: could not connect to host -ordereat.fr: could not connect to host orf-digitalsatkarte.at: could not connect to host organiplan.com: could not connect to host orioncustompcs.com: could not connect to host @@ -3121,7 +3119,6 @@ papeda.net: could not connect to host papercard.co.uk: did not receive HSTS header papierniak.net: could not connect to host papygeek.com: could not connect to host -parent5446.us: could not connect to host parentmail.co.uk: did not receive HSTS header parithy.net: could not connect to host parkingplus.co.il: could not connect to host @@ -3129,7 +3126,6 @@ parodybit.net: [Exception... "Component returned failure code: 0x80004005 (NS_ER parpaing-paillette.net: could not connect to host particonpsplus.it: did not receive HSTS header partijtjevoordevrijheid.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] -partirkyoto.jp: did not receive HSTS header partou.de: did not receive HSTS header partyvan.it: could not connect to host partyvan.moe: could not connect to host @@ -3162,6 +3158,7 @@ pcfun.net: did not receive HSTS header pchax.net: could not connect to host pdevio.com: could not connect to host pdf.yt: could not connect to host +peakapp.nl: could not connect to host peissen.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] pekkapikkarainen.fi: did not receive HSTS header pekkarik.ru: could not connect to host @@ -3178,6 +3175,7 @@ perplex.nl: did not receive HSTS header perroud.pro: max-age too low: 2592000 personaldatabasen.no: could not connect to host personalinjurylist.com: did not receive HSTS header +personalizedtouch.co: could not connect to host perthdevicelab.com: did not receive HSTS header pet-nsk.ru: could not connect to host petchart.net: could not connect to host @@ -3196,7 +3194,7 @@ phonenumberinfo.co.uk: could not connect to host phongmay24h.com: could not connect to host photoblogverona.com: could not connect to host php-bach.org: could not connect to host -phpfashion.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] +phpfashion.com: did not receive HSTS header phurl.de: could not connect to host phus.lu: did not receive HSTS header pickr.co: could not connect to host @@ -3269,7 +3267,6 @@ pornstars.me: could not connect to host portalplatform.net: did not receive HSTS header poshpak.com: max-age too low: 86400 postcodewise.co.uk: did not receive HSTS header -posterspy.com: did not receive HSTS header postscheduler.org: could not connect to host posylka.de: did not receive HSTS header poussinooz.fr: could not connect to host @@ -3311,6 +3308,7 @@ projectmercury.space: could not connect to host promecon-gmbh.de: did not receive HSTS header prontolight.com: did not receive HSTS header prontomovers.co.uk: could not connect to host +propactrading.com: could not connect to host prosocialmachines.com: could not connect to host prosoft.sk: did not receive HSTS header prosperident.com: did not receive HSTS header @@ -3358,7 +3356,7 @@ quantacloud.ch: could not connect to host quantenteranik.eu: could not connect to host quantum-cloud.xyz: could not connect to host quantumcourse.org: did not receive HSTS header -quantumfurball.net: could not connect to host +quebecmailbox.com: did not receive HSTS header queercoders.com: did not receive HSTS header questsandrewards.com: could not connect to host quli.nl: did not receive HSTS header @@ -3374,7 +3372,6 @@ raajheshkannaa.com: could not connect to host radicaleducation.net: could not connect to host rafaelcz.de: could not connect to host railgun.com.cn: could not connect to host -railjob.cn: could not connect to host rainbowbarracuda.com: could not connect to host ramonj.nl: could not connect to host randomcage.com: did not receive HSTS header @@ -3388,15 +3385,15 @@ raspass.me: could not connect to host rastreador.com.es: did not receive HSTS header ratajczak.fr: could not connect to host rate-esport.de: could not connect to host -rathorian.fr: could not connect to host raulfraile.net: could not connect to host +ravkr.duckdns.org: could not connect to host rawet.se: did not receive HSTS header rawstorieslondon.com: could not connect to host raydan.space: could not connect to host raydobe.me: could not connect to host rbhighinc.org: could not connect to host rc-rp.com: did not receive HSTS header -rc4.io: could not connect to host +rc4.io: did not receive HSTS header rcafox.com: could not connect to host rcpcbd.com: did not receive HSTS header rdns.im: did not receive HSTS header @@ -3422,6 +3419,7 @@ regenbogenwald.de: did not receive HSTS header regenerescence.com: did not receive HSTS header reggae-cdmx.com: did not receive HSTS header reic.me: could not connect to host +reinaertvandecruys.me: could not connect to host reisyukaku.org: did not receive HSTS header rejo.in: could not connect to host rejuvemedspa.com: did not receive HSTS header @@ -3445,7 +3443,6 @@ res42.com: could not connect to host research.facebook.com: did not receive HSTS header reserve-online.net: did not receive HSTS header respice.xyz: could not connect to host -responsibledisclosure.nl: could not connect to host respostas.com.br: did not receive HSTS header restchart.com: did not receive HSTS header retrotracks.net: max-age too low: 0 @@ -3454,7 +3451,6 @@ reverie.pw: could not connect to host reviews.anime.my: max-age too low: 5184000 revtut.net: did not receive HSTS header rewardstock.com: max-age too low: 0 -rgavmf.ru: did not receive HSTS header rhapsodhy.hu: could not connect to host rhdigital.pro: could not connect to host rhodri.io: could not connect to host @@ -3462,7 +3458,6 @@ richardb.me: could not connect to host richiemail.net: did not receive HSTS header richmondsunlight.com: did not receive HSTS header richsiciliano.com: could not connect to host -rickrongen.nl: could not connect to host rid-wan.com: could not connect to host rideworks.com: did not receive HSTS header riesenweber.id.au: did not receive HSTS header @@ -3482,8 +3477,10 @@ rkmantpur.org: did not receive HSTS header rme.li: did not receive HSTS header rngmeme.com: could not connect to host roan24.pl: did not receive HSTS header +robandjanine.com: could not connect to host robertglastra.com: could not connect to host robigalia.org: did not receive HSTS header +robspc.repair: could not connect to host robteix.com: did not receive HSTS header robtex.net: did not receive HSTS header robtex.org: did not receive HSTS header @@ -3495,7 +3492,6 @@ rodney.id.au: did not receive HSTS header rodosto.com: did not receive HSTS header roeper.party: could not connect to host rogerbastien.com: could not connect to host -roguesignal.net: did not receive HSTS header rolandszabo.com: could not connect to host rolemaster.net: could not connect to host romans-place.me.uk: could not connect to host @@ -3525,7 +3521,8 @@ rubenschulz.nl: did not receive HSTS header ruborr.se: did not receive HSTS header rubyshop.nl: max-age too low: 604800 rudeotter.com: could not connect to host -rudloff.pro: did not receive HSTS header +rudloff.pro: could not connect to host +ruffbeatz.com: could not connect to host rugirlfriend.com: could not connect to host ruiming.me: did not receive HSTS header runawebinar.nl: could not connect to host @@ -3535,7 +3532,6 @@ ruqu.nl: could not connect to host rusadmin.biz: did not receive HSTS header rusl.me: could not connect to host russmarshall.com: could not connect to host -rusxakep.com: could not connect to host ruxit.com: did not receive HSTS header rw.search.yahoo.com: did not receive HSTS header rx-contact.com: did not receive HSTS header @@ -3563,6 +3559,7 @@ sampoznay.ru: did not receive HSTS header samraskauskas.com: could not connect to host samsen.club: did not receive HSTS header samuelkeeley.com: could not connect to host +sanasalud.org: did not receive HSTS header sandrolittke.de: did not receive HSTS header sandviks.com: did not receive HSTS header sangwon.org: could not connect to host @@ -3591,7 +3588,6 @@ sazima.ru: did not receive HSTS header sbox-archives.com: could not connect to host sby.de: did not receive HSTS header sc4le.com: could not connect to host -scannabi.com: could not connect to host schadegarant.net: could not connect to host schmitz.link: could not connect to host schnell-gold.com: could not connect to host @@ -3698,6 +3694,7 @@ shauncrowley.co.uk: could not connect to host shaunwheelhou.se: could not connect to host shawnh.net: could not connect to host shellsec.pw: did not receive HSTS header +sherbers.de: could not connect to host shibe.club: could not connect to host shiftins.com: did not receive HSTS header shiinko.com: could not connect to host @@ -3753,13 +3750,14 @@ skile.ru: could not connect to host skk.io: could not connect to host skoda-clever-lead.de: could not connect to host skoda-im-dialog.de: could not connect to host +skoleniphp.cz: did not receive HSTS header +skotty.io: could not connect to host skullhouse.nyc: did not receive HSTS header skyasker.cn: could not connect to host skyflix.me: did not receive HSTS header skyoy.com: could not connect to host slash-dev.de: did not receive HSTS header slashand.co: could not connect to host -slashem.me: could not connect to host slattery.co: could not connect to host sleep10.com: could not connect to host slicketl.com: did not receive HSTS header @@ -3771,10 +3769,12 @@ sluitkampzeist.nl: [Exception... "Component returned failure code: 0x80004005 (N slycurity.de: did not receive HSTS header smart-mirror.de: did not receive HSTS header smart-ov.nl: could not connect to host +smartairkey.com: did not receive HSTS header smartcoin.com.br: could not connect to host smartlend.se: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] smartofficesandsmarthomes.com: did not receive HSTS header smartrak.co.nz: did not receive HSTS header +smatch.com: did not receive HSTS header smdev.fr: could not connect to host smet.us: could not connect to host smimea.com: could not connect to host @@ -3819,8 +3819,7 @@ someshit.xyz: could not connect to host somethingnew.xyz: did not receive HSTS header sonic.sk: max-age too low: 0 sonicrainboom.rocks: could not connect to host -sortaweird.net: could not connect to host -sotiran.com: did not receive HSTS header +sotiran.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] sotor.de: did not receive HSTS header soulboy.io: did not receive HSTS header soulema.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -3855,7 +3854,7 @@ sperohub.io: could not connect to host spherenix.org: could not connect to host spicydog.tk: could not connect to host spiegels.nl: could not connect to host -spikeykc.me: did not receive HSTS header +spikeykc.me: could not connect to host spillmaker.no: did not receive HSTS header spilsbury.io: could not connect to host spititout.it: could not connect to host @@ -3977,6 +3976,7 @@ surfone-leucate.com: could not connect to host sushi101tempe.com: did not receive HSTS header suzukikenichi.com: did not receive HSTS header sv.search.yahoo.com: did not receive HSTS header +svarovani.tk: could not connect to host svatba-frantovi.cz: did not receive HSTS header sweetll.me: could not connect to host sweetstreats.ca: could not connect to host @@ -4041,7 +4041,6 @@ tcomms.org: max-age too low: 0 tcp.expert: did not receive HSTS header teachforcanada.ca: did not receive HSTS header team-teasers.com: could not connect to host -teamhood.io: could not connect to host teamsocial.co: could not connect to host teamzeus.cz: could not connect to host tech55i.com: did not receive HSTS header @@ -4054,10 +4053,12 @@ techmatehq.com: could not connect to host technogroup.cz: did not receive HSTS header technosavvyport.com: did not receive HSTS header techpointed.com: could not connect to host +tedb.us: did not receive HSTS header tegelsensanitaironline.nl: did not receive HSTS header tekshrek.com: did not receive HSTS header telefonnummer.online: could not connect to host telefoonnummerinfo.nl: could not connect to host +telling.xyz: could not connect to host temehu.com: did not receive HSTS header tempcraft.net: could not connect to host tendertool.nl: could not connect to host @@ -4078,7 +4079,6 @@ textracer.dk: could not connect to host tezcam.tk: could not connect to host tf2stadium.com: did not receive HSTS header tfcoms-sp-tracker-client.azurewebsites.net: could not connect to host -tffans.com: did not receive HSTS header tfl.lu: did not receive HSTS header tgr.re: could not connect to host th-bl.de: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] @@ -4105,6 +4105,7 @@ theflowerbasketonline.com: could not connect to host thefootballanalyst.com: could not connect to host thefrozenfire.com: did not receive HSTS header thegcccoin.com: did not receive HSTS header +thego2swatking.com: could not connect to host thehiddenbay.eu: could not connect to host thehiddenbay.me: could not connect to host thehiddenbay.net: could not connect to host @@ -4281,7 +4282,6 @@ txclimbers.com: could not connect to host txf.pw: could not connect to host ty2u.com: did not receive HSTS header tylian.net: max-age too low: 0 -typingrevolution.com: did not receive HSTS header tyrelius.com: did not receive HSTS header tyroproducts.eu: did not receive HSTS header tzappa.net: could not connect to host @@ -4292,6 +4292,7 @@ uasmi.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_ ubicloud.de: could not connect to host ubicv.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] ublox.com: did not receive HSTS header +ubtce.com: could not connect to host ubuntuhot.com: did not receive HSTS header uega.net: did not receive HSTS header ufgaming.com: did not receive HSTS header @@ -4382,11 +4383,13 @@ vanitynailworkz.com: could not connect to host vanlaanen.com: did not receive HSTS header vansieleghem.com: could not connect to host vante.me: could not connect to host +vapordepot.jp: did not receive HSTS header vasanth.org: did not receive HSTS header vbulletin-russia.com: could not connect to host vbulletinrussia.com: could not connect to host vcdove.com: did not receive HSTS header vcr.re: could not connect to host +vdrpro.com: could not connect to host veblen.com: could not connect to host vechkasov.ru: did not receive HSTS header vehent.org: did not receive HSTS header @@ -4403,13 +4406,11 @@ vhost.co.id: could not connect to host vicenage.com: could not connect to host videnskabsklubben.dk: did not receive HSTS header videomuz.com: did not receive HSTS header -videosqr.com: could not connect to host vidz.ga: could not connect to host vieaw.com: could not connect to host viewsea.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] vigilo.cf: could not connect to host viktorsvantesson.net: did not receive HSTS header -vinasec.se: could not connect to host vincentkooijman.at: did not receive HSTS header vincentkooijman.nl: did not receive HSTS header vincentpancol.com: could not connect to host @@ -4418,7 +4419,6 @@ vio.no: did not receive HSTS header viperdns.com: could not connect to host vipi.es: could not connect to host vipmusic.ga: could not connect to host -virtuallifestyle.nl: could not connect to host visiontree-beta.eu: could not connect to host visitbroadstairs.com: could not connect to host vissanum.com: did not receive HSTS header @@ -4430,7 +4430,6 @@ vlora.city: could not connect to host vm0.eu: did not receive HSTS header vmrdev.com: could not connect to host voceinveste.com: did not receive HSTS header -vodpay.com: could not connect to host vodpay.net: could not connect to host vodpay.org: could not connect to host voicesuk.co.uk: did not receive HSTS header @@ -4546,7 +4545,6 @@ whats.io: did not receive HSTS header whatsstalk.me: could not connect to host when-release.com: did not receive HSTS header whiskeyriver.co.uk: max-age too low: 0 -whistleblower.gov: did not receive HSTS header whitehat.id: could not connect to host whiterabbitcakery.com: could not connect to host whitestagforge.com: did not receive HSTS header @@ -4563,7 +4561,6 @@ wikisports.eu: could not connect to host wilf1rst.com: could not connect to host willcipriano.com: could not connect to host william.si: did not receive HSTS header -williamsonshore.com: could not connect to host willosagiede.com: did not receive HSTS header winaes.com: did not receive HSTS header winclient.cn: could not connect to host @@ -4594,6 +4591,7 @@ wmcuk.net: could not connect to host wmfinanz.com: could not connect to host wod-stavby.cz: could not connect to host wodice.com: could not connect to host +wohlgemuth.rocks: could not connect to host wohnungsbau-ludwigsburg.de: did not receive HSTS header woima.fi: max-age too low: 604800 wolfesden.com: could not connect to host @@ -4601,12 +4599,10 @@ womosale.de: could not connect to host wonderfall.xyz: could not connect to host wonderhost.info: could not connect to host woodmafia.com.au: max-age too low: 0 -woodomat.com: could not connect to host woording.com: could not connect to host wootton95.com: could not connect to host woresite.jp: did not receive HSTS header workfone.io: did not receive HSTS header -workingclassmedia.com: could not connect to host wowapi.org: could not connect to host wphostingspot.com: did not receive HSTS header wpmetadatastandardsproject.org: could not connect to host @@ -4669,7 +4665,6 @@ xn--4dbjwf8c.tk: could not connect to host xn--79q87uvkclvgd56ahq5a.net: did not receive HSTS header xn--7rvz7ku3ppnr.jp: did not receive HSTS header xn--80aaihqncaejjobbu6v.xn--p1ai: max-age too low: 6000 -xn--80aocgsfei.xn--p1ai: could not connect to host xn--9pr52k0p5a.com: did not receive HSTS header xn--datenrettung-mnchen-jbc.com: did not receive HSTS header xn--lgb3a8bcpn.cf: could not connect to host @@ -4698,8 +4693,9 @@ xuyh0120.win: could not connect to host xxbase.com: could not connect to host xyndrac.net: did not receive HSTS header y-o-w.com: did not receive HSTS header -y-s.pw: did not receive HSTS header +y-s.pw: max-age too low: 0 yabrt.cn: could not connect to host +yalook.com: did not receive HSTS header yamaken.jp: did not receive HSTS header yamamo10.com: could not connect to host yanwh.xyz: did not receive HSTS header @@ -4715,7 +4711,6 @@ yenniferallulli.moda: could not connect to host yenniferallulli.nl: could not connect to host yestees.com: did not receive HSTS header yetcore.io: could not connect to host -yhb.io: could not connect to host yingyj.com: could not connect to host yippie.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no] yizhu.com: could not connect to host @@ -4752,7 +4747,6 @@ zadieheimlich.com: did not receive HSTS header zamorano.edu: could not connect to host zap.yt: could not connect to host zarooba.com: did not receive HSTS header -zary.me: did not receive HSTS header zbigniewgalucki.eu: did not receive HSTS header zbp.at: did not receive HSTS header zebrababy.cn: did not receive HSTS header @@ -4791,7 +4785,6 @@ ztcaoll222.cn: did not receive HSTS header zten.org: could not connect to host zulu7.com: could not connect to host zuolan.me: did not receive HSTS header -zupago.pe: did not receive HSTS header zvncloud.com: did not receive HSTS header zwollemagazine.nl: did not receive HSTS header zwy.me: did not receive HSTS header diff --git a/security/manager/ssl/nsSTSPreloadList.inc b/security/manager/ssl/nsSTSPreloadList.inc index d0eae4aa4049..04223f1653bd 100644 --- a/security/manager/ssl/nsSTSPreloadList.inc +++ b/security/manager/ssl/nsSTSPreloadList.inc @@ -8,7 +8,7 @@ /*****************************************************************************/ #include -const PRTime gPreloadListExpirationTime = INT64_C(1497195438932000); +const PRTime gPreloadListExpirationTime = INT64_C(1497283691334000); static const char kSTSHostTable[] = { /* "0.me.uk", true */ '0', '.', 'm', 'e', '.', 'u', 'k', '\0', @@ -449,6 +449,7 @@ static const char kSTSHostTable[] = { /* "afvallendoeje.nu", true */ 'a', 'f', 'v', 'a', 'l', 'l', 'e', 'n', 'd', 'o', 'e', 'j', 'e', '.', 'n', 'u', '\0', /* "afyou.co.kr", false */ 'a', 'f', 'y', 'o', 'u', '.', 'c', 'o', '.', 'k', 'r', '\0', /* "agatheetraphael.fr", true */ 'a', 'g', 'a', 't', 'h', 'e', 'e', 't', 'r', 'a', 'p', 'h', 'a', 'e', 'l', '.', 'f', 'r', '\0', + /* "agdalieso.com.ba", true */ 'a', 'g', 'd', 'a', 'l', 'i', 'e', 's', 'o', '.', 'c', 'o', 'm', '.', 'b', 'a', '\0', /* "ageg.ca", true */ 'a', 'g', 'e', 'g', '.', 'c', 'a', '\0', /* "agenda-loto.net", false */ 'a', 'g', 'e', 'n', 'd', 'a', '-', 'l', 'o', 't', 'o', '.', 'n', 'e', 't', '\0', /* "agenda21senden.de", true */ 'a', 'g', 'e', 'n', 'd', 'a', '2', '1', 's', 'e', 'n', 'd', 'e', 'n', '.', 'd', 'e', '\0', @@ -484,7 +485,6 @@ static const char kSTSHostTable[] = { /* "aigcev.org", true */ 'a', 'i', 'g', 'c', 'e', 'v', '.', 'o', 'r', 'g', '\0', /* "aikido-linz.at", true */ 'a', 'i', 'k', 'i', 'd', 'o', '-', 'l', 'i', 'n', 'z', '.', 'a', 't', '\0', /* "aikido-wels.at", true */ 'a', 'i', 'k', 'i', 'd', 'o', '-', 'w', 'e', 'l', 's', '.', 'a', 't', '\0', - /* "aimeeandalec.com", true */ 'a', 'i', 'm', 'e', 'e', 'a', 'n', 'd', 'a', 'l', 'e', 'c', '.', 'c', 'o', 'm', '\0', /* "aimotive.com", true */ 'a', 'i', 'm', 'o', 't', 'i', 'v', 'e', '.', 'c', 'o', 'm', '\0', /* "aiois.com", true */ 'a', 'i', 'o', 'i', 's', '.', 'c', 'o', 'm', '\0', /* "airbly.com", true */ 'a', 'i', 'r', 'b', 'l', 'y', '.', 'c', 'o', 'm', '\0', @@ -540,8 +540,6 @@ static const char kSTSHostTable[] = { /* "albuic.tk", true */ 'a', 'l', 'b', 'u', 'i', 'c', '.', 't', 'k', '\0', /* "alcorao.org", true */ 'a', 'l', 'c', 'o', 'r', 'a', 'o', '.', 'o', 'r', 'g', '\0', /* "aldes.co.za", true */ 'a', 'l', 'd', 'e', 's', '.', 'c', 'o', '.', 'z', 'a', '\0', - /* "alecpap.com", true */ 'a', 'l', 'e', 'c', 'p', 'a', 'p', '.', 'c', 'o', 'm', '\0', - /* "alecpapierniak.com", true */ 'a', 'l', 'e', 'c', 'p', 'a', 'p', 'i', 'e', 'r', 'n', 'i', 'a', 'k', '.', 'c', 'o', 'm', '\0', /* "alecrust.com", true */ 'a', 'l', 'e', 'c', 'r', 'u', 's', 't', '.', 'c', 'o', 'm', '\0', /* "aleksib.fi", true */ 'a', 'l', 'e', 'k', 's', 'i', 'b', '.', 'f', 'i', '\0', /* "alela.fr", true */ 'a', 'l', 'e', 'l', 'a', '.', 'f', 'r', '\0', @@ -673,7 +671,6 @@ static const char kSTSHostTable[] = { /* "ameego.net", true */ 'a', 'm', 'e', 'e', 'g', 'o', '.', 'n', 'e', 't', '\0', /* "ameego.nl", true */ 'a', 'm', 'e', 'e', 'g', 'o', '.', 'n', 'l', '\0', /* "ameego.org", true */ 'a', 'm', 'e', 'e', 'g', 'o', '.', 'o', 'r', 'g', '\0', - /* "amees.me", true */ 'a', 'm', 'e', 'e', 's', '.', 'm', 'e', '\0', /* "american.dating", true */ 'a', 'm', 'e', 'r', 'i', 'c', 'a', 'n', '.', 'd', 'a', 't', 'i', 'n', 'g', '\0', /* "americanbio.com", true */ 'a', 'm', 'e', 'r', 'i', 'c', 'a', 'n', 'b', 'i', 'o', '.', 'c', 'o', 'm', '\0', /* "americansportsinstitute.org", true */ 'a', 'm', 'e', 'r', 'i', 'c', 'a', 'n', 's', 'p', 'o', 'r', 't', 's', 'i', 'n', 's', 't', 'i', 't', 'u', 't', 'e', '.', 'o', 'r', 'g', '\0', @@ -687,7 +684,6 @@ static const char kSTSHostTable[] = { /* "ameza.me", true */ 'a', 'm', 'e', 'z', 'a', '.', 'm', 'e', '\0', /* "ami-de-bastanes.fr", true */ 'a', 'm', 'i', '-', 'd', 'e', '-', 'b', 'a', 's', 't', 'a', 'n', 'e', 's', '.', 'f', 'r', '\0', /* "amihub.com", true */ 'a', 'm', 'i', 'h', 'u', 'b', '.', 'c', 'o', 'm', '\0', - /* "amilum.org", true */ 'a', 'm', 'i', 'l', 'u', 'm', '.', 'o', 'r', 'g', '\0', /* "amineptine.com", true */ 'a', 'm', 'i', 'n', 'e', 'p', 't', 'i', 'n', 'e', '.', 'c', 'o', 'm', '\0', /* "amisharingstuff.com", true */ 'a', 'm', 'i', 's', 'h', 'a', 'r', 'i', 'n', 'g', 's', 't', 'u', 'f', 'f', '.', 'c', 'o', 'm', '\0', /* "amishsecurity.com", true */ 'a', 'm', 'i', 's', 'h', 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', @@ -733,6 +729,7 @@ static const char kSTSHostTable[] = { /* "andreasfeusi.ch", true */ 'a', 'n', 'd', 'r', 'e', 'a', 's', 'f', 'e', 'u', 's', 'i', '.', 'c', 'h', '\0', /* "andreasfritz-fotografie.de", true */ 'a', 'n', 'd', 'r', 'e', 'a', 's', 'f', 'r', 'i', 't', 'z', '-', 'f', 'o', 't', 'o', 'g', 'r', 'a', 'f', 'i', 'e', '.', 'd', 'e', '\0', /* "andreaskluge.eu", true */ 'a', 'n', 'd', 'r', 'e', 'a', 's', 'k', 'l', 'u', 'g', 'e', '.', 'e', 'u', '\0', + /* "andreaskrasa.com", true */ 'a', 'n', 'd', 'r', 'e', 'a', 's', 'k', 'r', 'a', 's', 'a', '.', 'c', 'o', 'm', '\0', /* "andrepicard.de", true */ 'a', 'n', 'd', 'r', 'e', 'p', 'i', 'c', 'a', 'r', 'd', '.', 'd', 'e', '\0', /* "andrewdaws.tv", true */ 'a', 'n', 'd', 'r', 'e', 'w', 'd', 'a', 'w', 's', '.', 't', 'v', '\0', /* "andrewhowden.com", true */ 'a', 'n', 'd', 'r', 'e', 'w', 'h', 'o', 'w', 'd', 'e', 'n', '.', 'c', 'o', 'm', '\0', @@ -745,6 +742,7 @@ static const char kSTSHostTable[] = { /* "andrewtebert.com", true */ 'a', 'n', 'd', 'r', 'e', 'w', 't', 'e', 'b', 'e', 'r', 't', '.', 'c', 'o', 'm', '\0', /* "andrewthelott.net", true */ 'a', 'n', 'd', 'r', 'e', 'w', 't', 'h', 'e', 'l', 'o', 't', 't', '.', 'n', 'e', 't', '\0', /* "andrewvoce.com", true */ 'a', 'n', 'd', 'r', 'e', 'w', 'v', 'o', 'c', 'e', '.', 'c', 'o', 'm', '\0', + /* "andrewx.net", true */ 'a', 'n', 'd', 'r', 'e', 'w', 'x', '.', 'n', 'e', 't', '\0', /* "andrezadnik.com", true */ 'a', 'n', 'd', 'r', 'e', 'z', 'a', 'd', 'n', 'i', 'k', '.', 'c', 'o', 'm', '\0', /* "androide.com", true */ 'a', 'n', 'd', 'r', 'o', 'i', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "andromedacenter.com", true */ 'a', 'n', 'd', 'r', 'o', 'm', 'e', 'd', 'a', 'c', 'e', 'n', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', @@ -836,6 +834,7 @@ static const char kSTSHostTable[] = { /* "apachehaus.de", false */ 'a', 'p', 'a', 'c', 'h', 'e', 'h', 'a', 'u', 's', '.', 'd', 'e', '\0', /* "apadvantage.com", true */ 'a', 'p', 'a', 'd', 'v', 'a', 'n', 't', 'a', 'g', 'e', '.', 'c', 'o', 'm', '\0', /* "aparaatti.org", true */ 'a', 'p', 'a', 'r', 'a', 'a', 't', 't', 'i', '.', 'o', 'r', 'g', '\0', + /* "apbox.de", true */ 'a', 'p', 'b', 'o', 'x', '.', 'd', 'e', '\0', /* "aperture-laboratories.science", true */ 'a', 'p', 'e', 'r', 't', 'u', 'r', 'e', '-', 'l', 'a', 'b', 'o', 'r', 'a', 't', 'o', 'r', 'i', 'e', 's', '.', 's', 'c', 'i', 'e', 'n', 'c', 'e', '\0', /* "aperturesciencelabs.de", true */ 'a', 'p', 'e', 'r', 't', 'u', 'r', 'e', 's', 'c', 'i', 'e', 'n', 'c', 'e', 'l', 'a', 'b', 's', '.', 'd', 'e', '\0', /* "apervita.net", true */ 'a', 'p', 'e', 'r', 'v', 'i', 't', 'a', '.', 'n', 'e', 't', '\0', @@ -1018,7 +1017,6 @@ static const char kSTSHostTable[] = { /* "askme24.de", true */ 'a', 's', 'k', 'm', 'e', '2', '4', '.', 'd', 'e', '\0', /* "askwhy.cz", true */ 'a', 's', 'k', 'w', 'h', 'y', '.', 'c', 'z', '\0', /* "askwhy.eu", true */ 'a', 's', 'k', 'w', 'h', 'y', '.', 'e', 'u', '\0', - /* "asm-x.com", true */ 'a', 's', 'm', '-', 'x', '.', 'c', 'o', 'm', '\0', /* "aspargesgaarden.no", true */ 'a', 's', 'p', 'a', 'r', 'g', 'e', 's', 'g', 'a', 'a', 'r', 'd', 'e', 'n', '.', 'n', 'o', '\0', /* "asphaltfruehling.de", true */ 'a', 's', 'p', 'h', 'a', 'l', 't', 'f', 'r', 'u', 'e', 'h', 'l', 'i', 'n', 'g', '.', 'd', 'e', '\0', /* "asphyxia.su", true */ 'a', 's', 'p', 'h', 'y', 'x', 'i', 'a', '.', 's', 'u', '\0', @@ -1032,7 +1030,6 @@ static const char kSTSHostTable[] = { /* "asta-bar.de", true */ 'a', 's', 't', 'a', '-', 'b', 'a', 'r', '.', 'd', 'e', '\0', /* "astengox.com", true */ 'a', 's', 't', 'e', 'n', 'g', 'o', 'x', '.', 'c', 'o', 'm', '\0', /* "astrea-voetbal-groningen.nl", true */ 'a', 's', 't', 'r', 'e', 'a', '-', 'v', 'o', 'e', 't', 'b', 'a', 'l', '-', 'g', 'r', 'o', 'n', 'i', 'n', 'g', 'e', 'n', '.', 'n', 'l', '\0', - /* "asuhe.cc", true */ 'a', 's', 'u', 'h', 'e', '.', 'c', 'c', '\0', /* "asuhe.win", true */ 'a', 's', 'u', 'h', 'e', '.', 'w', 'i', 'n', '\0', /* "asuhe.xyz", true */ 'a', 's', 'u', 'h', 'e', '.', 'x', 'y', 'z', '\0', /* "asun.co", true */ 'a', 's', 'u', 'n', '.', 'c', 'o', '\0', @@ -1183,6 +1180,7 @@ static const char kSTSHostTable[] = { /* "aymerick.fr", true */ 'a', 'y', 'm', 'e', 'r', 'i', 'c', 'k', '.', 'f', 'r', '\0', /* "aymericlagier.com", true */ 'a', 'y', 'm', 'e', 'r', 'i', 'c', 'l', 'a', 'g', 'i', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "ayurveda101.com", false */ 'a', 'y', 'u', 'r', 'v', 'e', 'd', 'a', '1', '0', '1', '.', 'c', 'o', 'm', '\0', + /* "azabani.com", true */ 'a', 'z', 'a', 'b', 'a', 'n', 'i', '.', 'c', 'o', 'm', '\0', /* "azazy.net", true */ 'a', 'z', 'a', 'z', 'y', '.', 'n', 'e', 't', '\0', /* "azbuki.by", true */ 'a', 'z', 'b', 'u', 'k', 'i', '.', 'b', 'y', '\0', /* "azimut.fr", true */ 'a', 'z', 'i', 'm', 'u', 't', '.', 'f', 'r', '\0', @@ -1565,6 +1563,7 @@ static const char kSTSHostTable[] = { /* "binarization.com", true */ 'b', 'i', 'n', 'a', 'r', 'i', 'z', 'a', 't', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "binaryabstraction.com", true */ 'b', 'i', 'n', 'a', 'r', 'y', 'a', 'b', 's', 't', 'r', 'a', 'c', 't', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "binaryevolved.com", true */ 'b', 'i', 'n', 'a', 'r', 'y', 'e', 'v', 'o', 'l', 'v', 'e', 'd', '.', 'c', 'o', 'm', '\0', + /* "binaryfigments.com", false */ 'b', 'i', 'n', 'a', 'r', 'y', 'f', 'i', 'g', 'm', 'e', 'n', 't', 's', '.', 'c', 'o', 'm', '\0', /* "binarystud.io", true */ 'b', 'i', 'n', 'a', 'r', 'y', 's', 't', 'u', 'd', '.', 'i', 'o', '\0', /* "binfind.com", true */ 'b', 'i', 'n', 'f', 'i', 'n', 'd', '.', 'c', 'o', 'm', '\0', /* "bingcheung.com", true */ 'b', 'i', 'n', 'g', 'c', 'h', 'e', 'u', 'n', 'g', '.', 'c', 'o', 'm', '\0', @@ -1750,7 +1749,6 @@ static const char kSTSHostTable[] = { /* "bluechilli.com", true */ 'b', 'l', 'u', 'e', 'c', 'h', 'i', 'l', 'l', 'i', '.', 'c', 'o', 'm', '\0', /* "blueflare.org", true */ 'b', 'l', 'u', 'e', 'f', 'l', 'a', 'r', 'e', '.', 'o', 'r', 'g', '\0', /* "bluefuzz.nl", true */ 'b', 'l', 'u', 'e', 'f', 'u', 'z', 'z', '.', 'n', 'l', '\0', - /* "blueimp.net", true */ 'b', 'l', 'u', 'e', 'i', 'm', 'p', '.', 'n', 'e', 't', '\0', /* "bluemoonroleplaying.com", true */ 'b', 'l', 'u', 'e', 'm', 'o', 'o', 'n', 'r', 'o', 'l', 'e', 'p', 'l', 'a', 'y', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "bluemosh.com", true */ 'b', 'l', 'u', 'e', 'm', 'o', 's', 'h', '.', 'c', 'o', 'm', '\0', /* "blueperil.de", true */ 'b', 'l', 'u', 'e', 'p', 'e', 'r', 'i', 'l', '.', 'd', 'e', '\0', @@ -1901,7 +1899,6 @@ static const char kSTSHostTable[] = { /* "bregnedalsystems.dk", true */ 'b', 'r', 'e', 'g', 'n', 'e', 'd', 'a', 'l', 's', 'y', 's', 't', 'e', 'm', 's', '.', 'd', 'k', '\0', /* "breitbild-beamer.de", true */ 'b', 'r', 'e', 'i', 't', 'b', 'i', 'l', 'd', '-', 'b', 'e', 'a', 'm', 'e', 'r', '.', 'd', 'e', '\0', /* "brejoc.com", true */ 'b', 'r', 'e', 'j', 'o', 'c', '.', 'c', 'o', 'm', '\0', - /* "brettabel.com", true */ 'b', 'r', 'e', 't', 't', 'a', 'b', 'e', 'l', '.', 'c', 'o', 'm', '\0', /* "brettcornwall.com", true */ 'b', 'r', 'e', 't', 't', 'c', 'o', 'r', 'n', 'w', 'a', 'l', 'l', '.', 'c', 'o', 'm', '\0', /* "bretz-hufer.de", true */ 'b', 'r', 'e', 't', 'z', '-', 'h', 'u', 'f', 'e', 'r', '.', 'd', 'e', '\0', /* "brevboxar.se", true */ 'b', 'r', 'e', 'v', 'b', 'o', 'x', 'a', 'r', '.', 's', 'e', '\0', @@ -1984,6 +1981,7 @@ static const char kSTSHostTable[] = { /* "buddhistische-weisheiten.org", true */ 'b', 'u', 'd', 'd', 'h', 'i', 's', 't', 'i', 's', 'c', 'h', 'e', '-', 'w', 'e', 'i', 's', 'h', 'e', 'i', 't', 'e', 'n', '.', 'o', 'r', 'g', '\0', /* "buddlycrafts.com", true */ 'b', 'u', 'd', 'd', 'l', 'y', 'c', 'r', 'a', 'f', 't', 's', '.', 'c', 'o', 'm', '\0', /* "buderus-family.be", true */ 'b', 'u', 'd', 'e', 'r', 'u', 's', '-', 'f', 'a', 'm', 'i', 'l', 'y', '.', 'b', 'e', '\0', + /* "budger.nl", true */ 'b', 'u', 'd', 'g', 'e', 'r', '.', 'n', 'l', '\0', /* "budgetalk.com", true */ 'b', 'u', 'd', 'g', 'e', 't', 'a', 'l', 'k', '.', 'c', 'o', 'm', '\0', /* "bueltge.de", true */ 'b', 'u', 'e', 'l', 't', 'g', 'e', '.', 'd', 'e', '\0', /* "buenosairesestetica.com.ar", true */ 'b', 'u', 'e', 'n', 'o', 's', 'a', 'i', 'r', 'e', 's', 'e', 's', 't', 'e', 't', 'i', 'c', 'a', '.', 'c', 'o', 'm', '.', 'a', 'r', '\0', @@ -2023,7 +2021,6 @@ static const char kSTSHostTable[] = { /* "bulktrade.de", true */ 'b', 'u', 'l', 'k', 't', 'r', 'a', 'd', 'e', '.', 'd', 'e', '\0', /* "bulldog-hosting.de", true */ 'b', 'u', 'l', 'l', 'd', 'o', 'g', '-', 'h', 'o', 's', 't', 'i', 'n', 'g', '.', 'd', 'e', '\0', /* "bullterrier.me", true */ 'b', 'u', 'l', 'l', 't', 'e', 'r', 'r', 'i', 'e', 'r', '.', 'm', 'e', '\0', - /* "bulmafox.com", true */ 'b', 'u', 'l', 'm', 'a', 'f', 'o', 'x', '.', 'c', 'o', 'm', '\0', /* "bulmastife.com.br", true */ 'b', 'u', 'l', 'm', 'a', 's', 't', 'i', 'f', 'e', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', /* "bunbomenu.de", true */ 'b', 'u', 'n', 'b', 'o', 'm', 'e', 'n', 'u', '.', 'd', 'e', '\0', /* "bunbun.be", false */ 'b', 'u', 'n', 'b', 'u', 'n', '.', 'b', 'e', '\0', @@ -2177,7 +2174,6 @@ static const char kSTSHostTable[] = { /* "callision.com", true */ 'c', 'a', 'l', 'l', 'i', 's', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "callsigns.ca", true */ 'c', 'a', 'l', 'l', 's', 'i', 'g', 'n', 's', '.', 'c', 'a', '\0', /* "calomel.org", true */ 'c', 'a', 'l', 'o', 'm', 'e', 'l', '.', 'o', 'r', 'g', '\0', - /* "calories.org", true */ 'c', 'a', 'l', 'o', 'r', 'i', 'e', 's', '.', 'o', 'r', 'g', '\0', /* "caltonnutrition.com", true */ 'c', 'a', 'l', 't', 'o', 'n', 'n', 'u', 't', 'r', 'i', 't', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "calvin.my", true */ 'c', 'a', 'l', 'v', 'i', 'n', '.', 'm', 'y', '\0', /* "calyxengineers.com", true */ 'c', 'a', 'l', 'y', 'x', 'e', 'n', 'g', 'i', 'n', 'e', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', @@ -2243,7 +2239,6 @@ static const char kSTSHostTable[] = { /* "capturapp.com", true */ 'c', 'a', 'p', 't', 'u', 'r', 'a', 'p', 'p', '.', 'c', 'o', 'm', '\0', /* "captured-symphonies.com", true */ 'c', 'a', 'p', 't', 'u', 'r', 'e', 'd', '-', 's', 'y', 'm', 'p', 'h', 'o', 'n', 'i', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "caputo.com", true */ 'c', 'a', 'p', 'u', 't', 'o', '.', 'c', 'o', 'm', '\0', - /* "caputodesign.com", true */ 'c', 'a', 'p', 'u', 't', 'o', 'd', 'e', 's', 'i', 'g', 'n', '.', 'c', 'o', 'm', '\0', /* "car.info", true */ 'c', 'a', 'r', '.', 'i', 'n', 'f', 'o', '\0', /* "car24portal.de", true */ 'c', 'a', 'r', '2', '4', 'p', 'o', 'r', 't', 'a', 'l', '.', 'd', 'e', '\0', /* "carauctionnetwork.com", true */ 'c', 'a', 'r', 'a', 'u', 'c', 't', 'i', 'o', 'n', 'n', 'e', 't', 'w', 'o', 'r', 'k', '.', 'c', 'o', 'm', '\0', @@ -2277,7 +2272,6 @@ static const char kSTSHostTable[] = { /* "carlo.mx", true */ 'c', 'a', 'r', 'l', 'o', '.', 'm', 'x', '\0', /* "carlosjeurissen.com", true */ 'c', 'a', 'r', 'l', 'o', 's', 'j', 'e', 'u', 'r', 'i', 's', 's', 'e', 'n', '.', 'c', 'o', 'm', '\0', /* "carnaticalifornia.com", true */ 'c', 'a', 'r', 'n', 'a', 't', 'i', 'c', 'a', 'l', 'i', 'f', 'o', 'r', 'n', 'i', 'a', '.', 'c', 'o', 'm', '\0', - /* "carnildo.com", true */ 'c', 'a', 'r', 'n', 'i', 'l', 'd', 'o', '.', 'c', 'o', 'm', '\0', /* "carolcappelletti.com", true */ 'c', 'a', 'r', 'o', 'l', 'c', 'a', 'p', 'p', 'e', 'l', 'l', 'e', 't', 't', 'i', '.', 'c', 'o', 'm', '\0', /* "caroli.com", true */ 'c', 'a', 'r', 'o', 'l', 'i', '.', 'c', 'o', 'm', '\0', /* "carriedin.com", true */ 'c', 'a', 'r', 'r', 'i', 'e', 'd', 'i', 'n', '.', 'c', 'o', 'm', '\0', @@ -2411,6 +2405,7 @@ static const char kSTSHostTable[] = { /* "chaletmanager.com", true */ 'c', 'h', 'a', 'l', 'e', 't', 'm', 'a', 'n', 'a', 'g', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "chalkfestival.org", true */ 'c', 'h', 'a', 'l', 'k', 'f', 'e', 's', 't', 'i', 'v', 'a', 'l', '.', 'o', 'r', 'g', '\0', /* "chameth.com", true */ 'c', 'h', 'a', 'm', 'e', 't', 'h', '.', 'c', 'o', 'm', '\0', + /* "chamilo.org", true */ 'c', 'h', 'a', 'm', 'i', 'l', 'o', '.', 'o', 'r', 'g', '\0', /* "champicreuse.fr", true */ 'c', 'h', 'a', 'm', 'p', 'i', 'c', 'r', 'e', 'u', 's', 'e', '.', 'f', 'r', '\0', /* "champserver.net", true */ 'c', 'h', 'a', 'm', 'p', 's', 'e', 'r', 'v', 'e', 'r', '.', 'n', 'e', 't', '\0', /* "chanissue.com", true */ 'c', 'h', 'a', 'n', 'i', 's', 's', 'u', 'e', '.', 'c', 'o', 'm', '\0', @@ -2460,13 +2455,11 @@ static const char kSTSHostTable[] = { /* "checktype.com", true */ 'c', 'h', 'e', 'c', 'k', 't', 'y', 'p', 'e', '.', 'c', 'o', 'm', '\0', /* "checkyourmath.com", true */ 'c', 'h', 'e', 'c', 'k', 'y', 'o', 'u', 'r', 'm', 'a', 't', 'h', '.', 'c', 'o', 'm', '\0', /* "cheddarpayments.com", true */ 'c', 'h', 'e', 'd', 'd', 'a', 'r', 'p', 'a', 'y', 'm', 'e', 'n', 't', 's', '.', 'c', 'o', 'm', '\0', - /* "cheetah85.de", true */ 'c', 'h', 'e', 'e', 't', 'a', 'h', '8', '5', '.', 'd', 'e', '\0', /* "cheetahwerx.com", true */ 'c', 'h', 'e', 'e', 't', 'a', 'h', 'w', 'e', 'r', 'x', '.', 'c', 'o', 'm', '\0', /* "cheez.systems", true */ 'c', 'h', 'e', 'e', 'z', '.', 's', 'y', 's', 't', 'e', 'm', 's', '\0', /* "chelseafs.co.uk", true */ 'c', 'h', 'e', 'l', 's', 'e', 'a', 'f', 's', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "chenapartment.com", true */ 'c', 'h', 'e', 'n', 'a', 'p', 'a', 'r', 't', 'm', 'e', 'n', 't', '.', 'c', 'o', 'm', '\0', /* "chengl.com", true */ 'c', 'h', 'e', 'n', 'g', 'l', '.', 'c', 'o', 'm', '\0', - /* "chenky.com", true */ 'c', 'h', 'e', 'n', 'k', 'y', '.', 'c', 'o', 'm', '\0', /* "chennien.com", true */ 'c', 'h', 'e', 'n', 'n', 'i', 'e', 'n', '.', 'c', 'o', 'm', '\0', /* "chenzhekl.me", true */ 'c', 'h', 'e', 'n', 'z', 'h', 'e', 'k', 'l', '.', 'm', 'e', '\0', /* "chepaofen.com", true */ 'c', 'h', 'e', 'p', 'a', 'o', 'f', 'e', 'n', '.', 'c', 'o', 'm', '\0', @@ -2839,6 +2832,7 @@ static const char kSTSHostTable[] = { /* "compartir.party", true */ 'c', 'o', 'm', 'p', 'a', 'r', 't', 'i', 'r', '.', 'p', 'a', 'r', 't', 'y', '\0', /* "compeuphoria.com", true */ 'c', 'o', 'm', 'p', 'e', 'u', 'p', 'h', 'o', 'r', 'i', 'a', '.', 'c', 'o', 'm', '\0', /* "compibus.fr", true */ 'c', 'o', 'm', 'p', 'i', 'b', 'u', 's', '.', 'f', 'r', '\0', + /* "compiledworks.com", true */ 'c', 'o', 'm', 'p', 'i', 'l', 'e', 'd', 'w', 'o', 'r', 'k', 's', '.', 'c', 'o', 'm', '\0', /* "compilenix.org", true */ 'c', 'o', 'm', 'p', 'i', 'l', 'e', 'n', 'i', 'x', '.', 'o', 'r', 'g', '\0', /* "completionist.me", true */ 'c', 'o', 'm', 'p', 'l', 'e', 't', 'i', 'o', 'n', 'i', 's', 't', '.', 'm', 'e', '\0', /* "complexart.ro", true */ 'c', 'o', 'm', 'p', 'l', 'e', 'x', 'a', 'r', 't', '.', 'r', 'o', '\0', @@ -2850,6 +2844,7 @@ static const char kSTSHostTable[] = { /* "computer-acquisti.com", true */ 'c', 'o', 'm', 'p', 'u', 't', 'e', 'r', '-', 'a', 'c', 'q', 'u', 'i', 's', 't', 'i', '.', 'c', 'o', 'm', '\0', /* "computerbase.de", true */ 'c', 'o', 'm', 'p', 'u', 't', 'e', 'r', 'b', 'a', 's', 'e', '.', 'd', 'e', '\0', /* "computeremergency.com.au", false */ 'c', 'o', 'm', 'p', 'u', 't', 'e', 'r', 'e', 'm', 'e', 'r', 'g', 'e', 'n', 'c', 'y', '.', 'c', 'o', 'm', '.', 'a', 'u', '\0', + /* "computerhilfe-feucht.de", true */ 'c', 'o', 'm', 'p', 'u', 't', 'e', 'r', 'h', 'i', 'l', 'f', 'e', '-', 'f', 'e', 'u', 'c', 'h', 't', '.', 'd', 'e', '\0', /* "computerslotopschool.nl", true */ 'c', 'o', 'm', 'p', 'u', 't', 'e', 'r', 's', 'l', 'o', 't', 'o', 'p', 's', 'c', 'h', 'o', 'o', 'l', '.', 'n', 'l', '\0', /* "computersystems.guru", true */ 'c', 'o', 'm', 'p', 'u', 't', 'e', 'r', 's', 'y', 's', 't', 'e', 'm', 's', '.', 'g', 'u', 'r', 'u', '\0', /* "comssa.org.au", true */ 'c', 'o', 'm', 's', 's', 'a', '.', 'o', 'r', 'g', '.', 'a', 'u', '\0', @@ -2905,6 +2900,7 @@ static const char kSTSHostTable[] = { /* "cookiecrook.com", true */ 'c', 'o', 'o', 'k', 'i', 'e', 'c', 'r', 'o', 'o', 'k', '.', 'c', 'o', 'm', '\0', /* "cookiesoft.de", true */ 'c', 'o', 'o', 'k', 'i', 'e', 's', 'o', 'f', 't', '.', 'd', 'e', '\0', /* "cookinglife.nl", false */ 'c', 'o', 'o', 'k', 'i', 'n', 'g', 'l', 'i', 'f', 'e', '.', 'n', 'l', '\0', + /* "cookingreporter.com", true */ 'c', 'o', 'o', 'k', 'i', 'n', 'g', 'r', 'e', 'p', 'o', 'r', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "cookmedical.com", false */ 'c', 'o', 'o', 'k', 'm', 'e', 'd', 'i', 'c', 'a', 'l', '.', 'c', 'o', 'm', '\0', /* "cool-wallpapers.jp", true */ 'c', 'o', 'o', 'l', '-', 'w', 'a', 'l', 'l', 'p', 'a', 'p', 'e', 'r', 's', '.', 'j', 'p', '\0', /* "cool110.tk", true */ 'c', 'o', 'o', 'l', '1', '1', '0', '.', 't', 'k', '\0', @@ -2925,6 +2921,7 @@ static const char kSTSHostTable[] = { /* "coredump.gr", true */ 'c', 'o', 'r', 'e', 'd', 'u', 'm', 'p', '.', 'g', 'r', '\0', /* "coreinfrastructure.org", true */ 'c', 'o', 'r', 'e', 'i', 'n', 'f', 'r', 'a', 's', 't', 'r', 'u', 'c', 't', 'u', 'r', 'e', '.', 'o', 'r', 'g', '\0', /* "coreless-stretchfilm.com", true */ 'c', 'o', 'r', 'e', 'l', 'e', 's', 's', '-', 's', 't', 'r', 'e', 't', 'c', 'h', 'f', 'i', 'l', 'm', '.', 'c', 'o', 'm', '\0', + /* "corepartners.com.ua", true */ 'c', 'o', 'r', 'e', 'p', 'a', 'r', 't', 'n', 'e', 'r', 's', '.', 'c', 'o', 'm', '.', 'u', 'a', '\0', /* "coresolutions.ca", true */ 'c', 'o', 'r', 'e', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n', 's', '.', 'c', 'a', '\0', /* "corex.io", true */ 'c', 'o', 'r', 'e', 'x', '.', 'i', 'o', '\0', /* "coreyjmahler.com", true */ 'c', 'o', 'r', 'e', 'y', 'j', 'm', 'a', 'h', 'l', 'e', 'r', '.', 'c', 'o', 'm', '\0', @@ -3082,6 +3079,7 @@ static const char kSTSHostTable[] = { /* "csgogamers.com", true */ 'c', 's', 'g', 'o', 'g', 'a', 'm', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "csgohandouts.com", true */ 'c', 's', 'g', 'o', 'h', 'a', 'n', 'd', 'o', 'u', 't', 's', '.', 'c', 'o', 'm', '\0', /* "csgotwister.com", true */ 'c', 's', 'g', 'o', 't', 'w', 'i', 's', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', + /* "cshopify.com", true */ 'c', 's', 'h', 'o', 'p', 'i', 'f', 'y', '.', 'c', 'o', 'm', '\0', /* "csmainframe.com", true */ 'c', 's', 'm', 'a', 'i', 'n', 'f', 'r', 'a', 'm', 'e', '.', 'c', 'o', 'm', '\0', /* "csokolade.hu", true */ 'c', 's', 'o', 'k', 'o', 'l', 'a', 'd', 'e', '.', 'h', 'u', '\0', /* "cspvalidator.org", true */ 'c', 's', 'p', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'o', 'r', '.', 'o', 'r', 'g', '\0', @@ -3202,6 +3200,7 @@ static const char kSTSHostTable[] = { /* "cymtech.net", true */ 'c', 'y', 'm', 't', 'e', 'c', 'h', '.', 'n', 'e', 't', '\0', /* "cyon.ch", true */ 'c', 'y', 'o', 'n', '.', 'c', 'h', '\0', /* "cyph.audio", true */ 'c', 'y', 'p', 'h', '.', 'a', 'u', 'd', 'i', 'o', '\0', + /* "cyph.com", true */ 'c', 'y', 'p', 'h', '.', 'c', 'o', 'm', '\0', /* "cyph.im", true */ 'c', 'y', 'p', 'h', '.', 'i', 'm', '\0', /* "cyph.video", true */ 'c', 'y', 'p', 'h', '.', 'v', 'i', 'd', 'e', 'o', '\0', /* "cyprus-company-service.com", true */ 'c', 'y', 'p', 'r', 'u', 's', '-', 'c', 'o', 'm', 'p', 'a', 'n', 'y', '-', 's', 'e', 'r', 'v', 'i', 'c', 'e', '.', 'c', 'o', 'm', '\0', @@ -3424,7 +3423,9 @@ static const char kSTSHostTable[] = { /* "dealbanana.it", true */ 'd', 'e', 'a', 'l', 'b', 'a', 'n', 'a', 'n', 'a', '.', 'i', 't', '\0', /* "dealbanana.se", true */ 'd', 'e', 'a', 'l', 'b', 'a', 'n', 'a', 'n', 'a', '.', 's', 'e', '\0', /* "dealcruiser.nl", true */ 'd', 'e', 'a', 'l', 'c', 'r', 'u', 'i', 's', 'e', 'r', '.', 'n', 'l', '\0', + /* "dealpass.no", true */ 'd', 'e', 'a', 'l', 'p', 'a', 's', 's', '.', 'n', 'o', '\0', /* "deamuseum.org", true */ 'd', 'e', 'a', 'm', 'u', 's', 'e', 'u', 'm', '.', 'o', 'r', 'g', '\0', + /* "deanjerkovich.com", true */ 'd', 'e', 'a', 'n', 'j', 'e', 'r', 'k', 'o', 'v', 'i', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "deanmorgan.org", true */ 'd', 'e', 'a', 'n', 'm', 'o', 'r', 'g', 'a', 'n', '.', 'o', 'r', 'g', '\0', /* "deathy.ro", true */ 'd', 'e', 'a', 't', 'h', 'y', '.', 'r', 'o', '\0', /* "debigare.com", true */ 'd', 'e', 'b', 'i', 'g', 'a', 'r', 'e', '.', 'c', 'o', 'm', '\0', @@ -3489,7 +3490,6 @@ static const char kSTSHostTable[] = { /* "delta-smart.ch", true */ 'd', 'e', 'l', 't', 'a', '-', 's', 'm', 'a', 'r', 't', '.', 'c', 'h', '\0', /* "deltasmart.ch", true */ 'd', 'e', 'l', 't', 'a', 's', 'm', 'a', 'r', 't', '.', 'c', 'h', '\0', /* "deltava.org", true */ 'd', 'e', 'l', 't', 'a', 'v', 'a', '.', 'o', 'r', 'g', '\0', - /* "delvj.org", true */ 'd', 'e', 'l', 'v', 'j', '.', 'o', 'r', 'g', '\0', /* "dementiapraecox.de", true */ 'd', 'e', 'm', 'e', 'n', 't', 'i', 'a', 'p', 'r', 'a', 'e', 'c', 'o', 'x', '.', 'd', 'e', '\0', /* "demo.swedbank.se", true */ 'd', 'e', 'm', 'o', '.', 's', 'w', 'e', 'd', 'b', 'a', 'n', 'k', '.', 's', 'e', '\0', /* "democracy.io", true */ 'd', 'e', 'm', 'o', 'c', 'r', 'a', 'c', 'y', '.', 'i', 'o', '\0', @@ -3756,7 +3756,6 @@ static const char kSTSHostTable[] = { /* "djul.net", true */ 'd', 'j', 'u', 'l', '.', 'n', 'e', 't', '\0', /* "djxmmx.net", false */ 'd', 'j', 'x', 'm', 'm', 'x', '.', 'n', 'e', 't', '\0', /* "dk.search.yahoo.com", false */ 'd', 'k', '.', 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', - /* "dkds.us", true */ 'd', 'k', 'd', 's', '.', 'u', 's', '\0', /* "dkravchenko.su", true */ 'd', 'k', 'r', 'a', 'v', 'c', 'h', 'e', 'n', 'k', 'o', '.', 's', 'u', '\0', /* "dl.google.com", true */ 'd', 'l', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm', '\0', /* "dlaspania.pl", true */ 'd', 'l', 'a', 's', 'p', 'a', 'n', 'i', 'a', '.', 'p', 'l', '\0', @@ -3833,7 +3832,6 @@ static const char kSTSHostTable[] = { /* "dolphinswithlasers.com", true */ 'd', 'o', 'l', 'p', 'h', 'i', 'n', 's', 'w', 'i', 't', 'h', 'l', 'a', 's', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "dom-medicina.ru", true */ 'd', 'o', 'm', '-', 'm', 'e', 'd', 'i', 'c', 'i', 'n', 'a', '.', 'r', 'u', '\0', /* "doma.in", true */ 'd', 'o', 'm', 'a', '.', 'i', 'n', '\0', - /* "domadillo.com", true */ 'd', 'o', 'm', 'a', 'd', 'i', 'l', 'l', 'o', '.', 'c', 'o', 'm', '\0', /* "domain001.info", true */ 'd', 'o', 'm', 'a', 'i', 'n', '0', '0', '1', '.', 'i', 'n', 'f', 'o', '\0', /* "domainexpress.de", true */ 'd', 'o', 'm', 'a', 'i', 'n', 'e', 'x', 'p', 'r', 'e', 's', 's', '.', 'd', 'e', '\0', /* "domainkauf.de", true */ 'd', 'o', 'm', 'a', 'i', 'n', 'k', 'a', 'u', 'f', '.', 'd', 'e', '\0', @@ -3907,6 +3905,7 @@ static const char kSTSHostTable[] = { /* "dpd.com.pl", true */ 'd', 'p', 'd', '.', 'c', 'o', 'm', '.', 'p', 'l', '\0', /* "dprd-wonogirikab.go.id", false */ 'd', 'p', 'r', 'd', '-', 'w', 'o', 'n', 'o', 'g', 'i', 'r', 'i', 'k', 'a', 'b', '.', 'g', 'o', '.', 'i', 'd', '\0', /* "dpsg-roden.de", false */ 'd', 'p', 's', 'g', '-', 'r', 'o', 'd', 'e', 'n', '.', 'd', 'e', '\0', + /* "dr2dr.ca", true */ 'd', 'r', '2', 'd', 'r', '.', 'c', 'a', '\0', /* "dragfiles.com", true */ 'd', 'r', 'a', 'g', 'f', 'i', 'l', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "dragon-aspect.com", true */ 'd', 'r', 'a', 'g', 'o', 'n', '-', 'a', 's', 'p', 'e', 'c', 't', '.', 'c', 'o', 'm', '\0', /* "dragon-chem.eu", true */ 'd', 'r', 'a', 'g', 'o', 'n', '-', 'c', 'h', 'e', 'm', '.', 'e', 'u', '\0', @@ -3957,6 +3956,7 @@ static const char kSTSHostTable[] = { /* "drjoe.ca", true */ 'd', 'r', 'j', 'o', 'e', '.', 'c', 'a', '\0', /* "drjuanitacollier.com", true */ 'd', 'r', 'j', 'u', 'a', 'n', 'i', 't', 'a', 'c', 'o', 'l', 'l', 'i', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "drkmtrx.xyz", true */ 'd', 'r', 'k', 'm', 't', 'r', 'x', '.', 'x', 'y', 'z', '\0', + /* "drobniuch.pl", false */ 'd', 'r', 'o', 'b', 'n', 'i', 'u', 'c', 'h', '.', 'p', 'l', '\0', /* "drogueriaelbarco.com", true */ 'd', 'r', 'o', 'g', 'u', 'e', 'r', 'i', 'a', 'e', 'l', 'b', 'a', 'r', 'c', 'o', '.', 'c', 'o', 'm', '\0', /* "droidapp.nl", true */ 'd', 'r', 'o', 'i', 'd', 'a', 'p', 'p', '.', 'n', 'l', '\0', /* "droidwiki.de", true */ 'd', 'r', 'o', 'i', 'd', 'w', 'i', 'k', 'i', '.', 'd', 'e', '\0', @@ -4234,7 +4234,7 @@ static const char kSTSHostTable[] = { /* "eintageinzug.de", true */ 'e', 'i', 'n', 't', 'a', 'g', 'e', 'i', 'n', 'z', 'u', 'g', '.', 'd', 'e', '\0', /* "eipione.com", true */ 'e', 'i', 'p', 'i', 'o', 'n', 'e', '.', 'c', 'o', 'm', '\0', /* "eirastudios.co.uk", false */ 'e', 'i', 'r', 'a', 's', 't', 'u', 'd', 'i', 'o', 's', '.', 'c', 'o', '.', 'u', 'k', '\0', - /* "eisp.it", true */ 'e', 'i', 's', 'p', '.', 'i', 't', '\0', + /* "eisp.it", false */ 'e', 'i', 's', 'p', '.', 'i', 't', '\0', /* "eit-web.de", false */ 'e', 'i', 't', '-', 'w', 'e', 'b', '.', 'd', 'e', '\0', /* "eitler.cx", true */ 'e', 'i', 't', 'l', 'e', 'r', '.', 'c', 'x', '\0', /* "eiyoushi-shigoto.com", true */ 'e', 'i', 'y', 'o', 'u', 's', 'h', 'i', '-', 's', 'h', 'i', 'g', 'o', 't', 'o', '.', 'c', 'o', 'm', '\0', @@ -4462,9 +4462,7 @@ static const char kSTSHostTable[] = { /* "erisrenee.com", true */ 'e', 'r', 'i', 's', 'r', 'e', 'n', 'e', 'e', '.', 'c', 'o', 'm', '\0', /* "ernaehrungsberatung-rapperswil.ch", true */ 'e', 'r', 'n', 'a', 'e', 'h', 'r', 'u', 'n', 'g', 's', 'b', 'e', 'r', 'a', 't', 'u', 'n', 'g', '-', 'r', 'a', 'p', 'p', 'e', 'r', 's', 'w', 'i', 'l', '.', 'c', 'h', '\0', /* "ernest.ly", true */ 'e', 'r', 'n', 'e', 's', 't', '.', 'l', 'y', '\0', - /* "erp-band.ru", true */ 'e', 'r', 'p', '-', 'b', 'a', 'n', 'd', '.', 'r', 'u', '\0', /* "erp.band", true */ 'e', 'r', 'p', '.', 'b', 'a', 'n', 'd', '\0', - /* "erpband.ru", true */ 'e', 'r', 'p', 'b', 'a', 'n', 'd', '.', 'r', 'u', '\0', /* "erpcargo.com", false */ 'e', 'r', 'p', 'c', 'a', 'r', 'g', 'o', '.', 'c', 'o', 'm', '\0', /* "erstehilfeprodukte.at", true */ 'e', 'r', 's', 't', 'e', 'h', 'i', 'l', 'f', 'e', 'p', 'r', 'o', 'd', 'u', 'k', 't', 'e', '.', 'a', 't', '\0', /* "eru.me", true */ 'e', 'r', 'u', '.', 'm', 'e', '\0', @@ -4579,7 +4577,6 @@ static const char kSTSHostTable[] = { /* "eva.cz", true */ 'e', 'v', 'a', '.', 'c', 'z', '\0', /* "evafojtova.cz", true */ 'e', 'v', 'a', 'f', 'o', 'j', 't', 'o', 'v', 'a', '.', 'c', 'z', '\0', /* "evalesc.com", true */ 'e', 'v', 'a', 'l', 'e', 's', 'c', '.', 'c', 'o', 'm', '\0', - /* "evanhandgraaf.nl", true */ 'e', 'v', 'a', 'n', 'h', 'a', 'n', 'd', 'g', 'r', 'a', 'a', 'f', '.', 'n', 'l', '\0', /* "evankurniawan.com", true */ 'e', 'v', 'a', 'n', 'k', 'u', 'r', 'n', 'i', 'a', 'w', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "evantageglobal.com", true */ 'e', 'v', 'a', 'n', 't', 'a', 'g', 'e', 'g', 'l', 'o', 'b', 'a', 'l', '.', 'c', 'o', 'm', '\0', /* "evapp.org", true */ 'e', 'v', 'a', 'p', 'p', '.', 'o', 'r', 'g', '\0', @@ -4814,6 +4811,7 @@ static const char kSTSHostTable[] = { /* "feen.us", true */ 'f', 'e', 'e', 'n', '.', 'u', 's', '\0', /* "fehngarten.de", true */ 'f', 'e', 'h', 'n', 'g', 'a', 'r', 't', 'e', 'n', '.', 'd', 'e', '\0', /* "fehnladen.de", true */ 'f', 'e', 'h', 'n', 'l', 'a', 'd', 'e', 'n', '.', 'd', 'e', '\0', + /* "feirlane.org", false */ 'f', 'e', 'i', 'r', 'l', 'a', 'n', 'e', '.', 'o', 'r', 'g', '\0', /* "feistyduck.com", true */ 'f', 'e', 'i', 's', 't', 'y', 'd', 'u', 'c', 'k', '.', 'c', 'o', 'm', '\0', /* "feld.saarland", true */ 'f', 'e', 'l', 'd', '.', 's', 'a', 'a', 'r', 'l', 'a', 'n', 'd', '\0', /* "felixhefner.de", true */ 'f', 'e', 'l', 'i', 'x', 'h', 'e', 'f', 'n', 'e', 'r', '.', 'd', 'e', '\0', @@ -4863,7 +4861,6 @@ static const char kSTSHostTable[] = { /* "fiendishmasterplan.com", true */ 'f', 'i', 'e', 'n', 'd', 'i', 's', 'h', 'm', 'a', 's', 't', 'e', 'r', 'p', 'l', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "fierlafijn.net", true */ 'f', 'i', 'e', 'r', 'l', 'a', 'f', 'i', 'j', 'n', '.', 'n', 'e', 't', '\0', /* "fierman.eu", false */ 'f', 'i', 'e', 'r', 'm', 'a', 'n', '.', 'e', 'u', '\0', - /* "fierman.net", false */ 'f', 'i', 'e', 'r', 'm', 'a', 'n', '.', 'n', 'e', 't', '\0', /* "fierman.us", false */ 'f', 'i', 'e', 'r', 'm', 'a', 'n', '.', 'u', 's', '\0', /* "fifieldtech.com", true */ 'f', 'i', 'f', 'i', 'e', 'l', 'd', 't', 'e', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "figurasdelinguagem.com.br", true */ 'f', 'i', 'g', 'u', 'r', 'a', 's', 'd', 'e', 'l', 'i', 'n', 'g', 'u', 'a', 'g', 'e', 'm', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', @@ -4949,9 +4946,11 @@ static const char kSTSHostTable[] = { /* "flajshans.cz", true */ 'f', 'l', 'a', 'j', 's', 'h', 'a', 'n', 's', '.', 'c', 'z', '\0', /* "flam.io", true */ 'f', 'l', 'a', 'm', '.', 'i', 'o', '\0', /* "flamer-scene.com", false */ 'f', 'l', 'a', 'm', 'e', 'r', '-', 's', 'c', 'e', 'n', 'e', '.', 'c', 'o', 'm', '\0', + /* "flamingcow.tv", true */ 'f', 'l', 'a', 'm', 'i', 'n', 'g', 'c', 'o', 'w', '.', 't', 'v', '\0', /* "flamingkeys.com", true */ 'f', 'l', 'a', 'm', 'i', 'n', 'g', 'k', 'e', 'y', 's', '.', 'c', 'o', 'm', '\0', /* "flamingkeys.com.au", true */ 'f', 'l', 'a', 'm', 'i', 'n', 'g', 'k', 'e', 'y', 's', '.', 'c', 'o', 'm', '.', 'a', 'u', '\0', /* "flamme-von-anor.de", true */ 'f', 'l', 'a', 'm', 'm', 'e', '-', 'v', 'o', 'n', '-', 'a', 'n', 'o', 'r', '.', 'd', 'e', '\0', + /* "flana.com", true */ 'f', 'l', 'a', 'n', 'a', '.', 'c', 'o', 'm', '\0', /* "flashback.org", true */ 'f', 'l', 'a', 's', 'h', 'b', 'a', 'c', 'k', '.', 'o', 'r', 'g', '\0', /* "flat.io", true */ 'f', 'l', 'a', 't', '.', 'i', 'o', '\0', /* "flauschig.net", true */ 'f', 'l', 'a', 'u', 's', 'c', 'h', 'i', 'g', '.', 'n', 'e', 't', '\0', @@ -4977,6 +4976,7 @@ static const char kSTSHostTable[] = { /* "floobits.com", true */ 'f', 'l', 'o', 'o', 'b', 'i', 't', 's', '.', 'c', 'o', 'm', '\0', /* "floorball-haunwoehr.de", true */ 'f', 'l', 'o', 'o', 'r', 'b', 'a', 'l', 'l', '-', 'h', 'a', 'u', 'n', 'w', 'o', 'e', 'h', 'r', '.', 'd', 'e', '\0', /* "flooringnightmares.com", true */ 'f', 'l', 'o', 'o', 'r', 'i', 'n', 'g', 'n', 'i', 'g', 'h', 't', 'm', 'a', 'r', 'e', 's', '.', 'c', 'o', 'm', '\0', + /* "floort.net", false */ 'f', 'l', 'o', 'o', 'r', 't', '.', 'n', 'e', 't', '\0', /* "florence.uk.net", true */ 'f', 'l', 'o', 'r', 'e', 'n', 'c', 'e', '.', 'u', 'k', '.', 'n', 'e', 't', '\0', /* "florian-bachelet.fr", true */ 'f', 'l', 'o', 'r', 'i', 'a', 'n', '-', 'b', 'a', 'c', 'h', 'e', 'l', 'e', 't', '.', 'f', 'r', '\0', /* "florian-schlachter.de", true */ 'f', 'l', 'o', 'r', 'i', 'a', 'n', '-', 's', 'c', 'h', 'l', 'a', 'c', 'h', 't', 'e', 'r', '.', 'd', 'e', '\0', @@ -5044,6 +5044,7 @@ static const char kSTSHostTable[] = { /* "foodplantengineering.com", true */ 'f', 'o', 'o', 'd', 'p', 'l', 'a', 'n', 't', 'e', 'n', 'g', 'i', 'n', 'e', 'e', 'r', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "foodsafety.gov", true */ 'f', 'o', 'o', 'd', 's', 'a', 'f', 'e', 't', 'y', '.', 'g', 'o', 'v', '\0', /* "foodwise.marketing", true */ 'f', 'o', 'o', 'd', 'w', 'i', 's', 'e', '.', 'm', 'a', 'r', 'k', 'e', 't', 'i', 'n', 'g', '\0', + /* "fooishbar.org", false */ 'f', 'o', 'o', 'i', 's', 'h', 'b', 'a', 'r', '.', 'o', 'r', 'g', '\0', /* "foolip.org", true */ 'f', 'o', 'o', 'l', 'i', 'p', '.', 'o', 'r', 'g', '\0', /* "foolwealth.com", true */ 'f', 'o', 'o', 'l', 'w', 'e', 'a', 'l', 't', 'h', '.', 'c', 'o', 'm', '\0', /* "foorack.com", true */ 'f', 'o', 'o', 'r', 'a', 'c', 'k', '.', 'c', 'o', 'm', '\0', @@ -5090,7 +5091,6 @@ static const char kSTSHostTable[] = { /* "fotowettbewerb.co", true */ 'f', 'o', 't', 'o', 'w', 'e', 't', 't', 'b', 'e', 'w', 'e', 'r', 'b', '.', 'c', 'o', '\0', /* "fotowolfy.com", true */ 'f', 'o', 't', 'o', 'w', 'o', 'l', 'f', 'y', '.', 'c', 'o', 'm', '\0', /* "foundsounds.me", true */ 'f', 'o', 'u', 'n', 'd', 's', 'o', 'u', 'n', 'd', 's', '.', 'm', 'e', '\0', - /* "fourchin.net", true */ 'f', 'o', 'u', 'r', 'c', 'h', 'i', 'n', '.', 'n', 'e', 't', '\0', /* "foxbnc.co.uk", true */ 'f', 'o', 'x', 'b', 'n', 'c', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "foxdev.co", true */ 'f', 'o', 'x', 'd', 'e', 'v', '.', 'c', 'o', '\0', /* "foxhound.com.br", true */ 'f', 'o', 'x', 'h', 'o', 'u', 'n', 'd', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', @@ -5425,7 +5425,6 @@ static const char kSTSHostTable[] = { /* "general-anaesthesia.com", true */ 'g', 'e', 'n', 'e', 'r', 'a', 'l', '-', 'a', 'n', 'a', 'e', 's', 't', 'h', 'e', 's', 'i', 'a', '.', 'c', 'o', 'm', '\0', /* "generali-worldwide.com", true */ 'g', 'e', 'n', 'e', 'r', 'a', 'l', 'i', '-', 'w', 'o', 'r', 'l', 'd', 'w', 'i', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "generationnext.pl", true */ 'g', 'e', 'n', 'e', 'r', 'a', 't', 'i', 'o', 'n', 'n', 'e', 'x', 't', '.', 'p', 'l', '\0', - /* "generic.cx", true */ 'g', 'e', 'n', 'e', 'r', 'i', 'c', '.', 'c', 'x', '\0', /* "genesiseureka.com", true */ 'g', 'e', 'n', 'e', 's', 'i', 's', 'e', 'u', 'r', 'e', 'k', 'a', '.', 'c', 'o', 'm', '\0', /* "genie-seiner-generation.de", true */ 'g', 'e', 'n', 'i', 'e', '-', 's', 'e', 'i', 'n', 'e', 'r', '-', 'g', 'e', 'n', 'e', 'r', 'a', 't', 'i', 'o', 'n', '.', 'd', 'e', '\0', /* "genomequestlive.com", true */ 'g', 'e', 'n', 'o', 'm', 'e', 'q', 'u', 'e', 's', 't', 'l', 'i', 'v', 'e', '.', 'c', 'o', 'm', '\0', @@ -5480,7 +5479,6 @@ static const char kSTSHostTable[] = { /* "geti2p.com", true */ 'g', 'e', 't', 'i', '2', 'p', '.', 'c', 'o', 'm', '\0', /* "getidmcc.com", true */ 'g', 'e', 't', 'i', 'd', 'm', 'c', 'c', '.', 'c', 'o', 'm', '\0', /* "getmango.com", true */ 'g', 'e', 't', 'm', 'a', 'n', 'g', 'o', '.', 'c', 'o', 'm', '\0', - /* "getmdl.io", true */ 'g', 'e', 't', 'm', 'd', 'l', '.', 'i', 'o', '\0', /* "getmondo.co.uk", true */ 'g', 'e', 't', 'm', 'o', 'n', 'd', 'o', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "getnikola.com", true */ 'g', 'e', 't', 'n', 'i', 'k', 'o', 'l', 'a', '.', 'c', 'o', 'm', '\0', /* "getpake.com", true */ 'g', 'e', 't', 'p', 'a', 'k', 'e', '.', 'c', 'o', 'm', '\0', @@ -5685,6 +5683,7 @@ static const char kSTSHostTable[] = { /* "grace-wan.com", true */ 'g', 'r', 'a', 'c', 'e', '-', 'w', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "gracedays.org", true */ 'g', 'r', 'a', 'c', 'e', 'd', 'a', 'y', 's', '.', 'o', 'r', 'g', '\0', /* "graceful-project.eu", true */ 'g', 'r', 'a', 'c', 'e', 'f', 'u', 'l', '-', 'p', 'r', 'o', 'j', 'e', 'c', 't', '.', 'e', 'u', '\0', + /* "gracethrufaith.com", true */ 'g', 'r', 'a', 'c', 'e', 't', 'h', 'r', 'u', 'f', 'a', 'i', 't', 'h', '.', 'c', 'o', 'm', '\0', /* "gracetini.com", true */ 'g', 'r', 'a', 'c', 'e', 't', 'i', 'n', 'i', '.', 'c', 'o', 'm', '\0', /* "graciousmay.com", true */ 'g', 'r', 'a', 'c', 'i', 'o', 'u', 's', 'm', 'a', 'y', '.', 'c', 'o', 'm', '\0', /* "grademymac.com", true */ 'g', 'r', 'a', 'd', 'e', 'm', 'y', 'm', 'a', 'c', '.', 'c', 'o', 'm', '\0', @@ -5707,6 +5706,7 @@ static const char kSTSHostTable[] = { /* "grandwailea.com", true */ 'g', 'r', 'a', 'n', 'd', 'w', 'a', 'i', 'l', 'e', 'a', '.', 'c', 'o', 'm', '\0', /* "grannyshouse.de", true */ 'g', 'r', 'a', 'n', 'n', 'y', 's', 'h', 'o', 'u', 's', 'e', '.', 'd', 'e', '\0', /* "granth.io", true */ 'g', 'r', 'a', 'n', 't', 'h', '.', 'i', 'o', '\0', + /* "granular.ag", true */ 'g', 'r', 'a', 'n', 'u', 'l', 'a', 'r', '.', 'a', 'g', '\0', /* "graphene.software", true */ 'g', 'r', 'a', 'p', 'h', 'e', 'n', 'e', '.', 's', 'o', 'f', 't', 'w', 'a', 'r', 'e', '\0', /* "graphire.io", true */ 'g', 'r', 'a', 'p', 'h', 'i', 'r', 'e', '.', 'i', 'o', '\0', /* "graphsearchengine.com", true */ 'g', 'r', 'a', 'p', 'h', 's', 'e', 'a', 'r', 'c', 'h', 'e', 'n', 'g', 'i', 'n', 'e', '.', 'c', 'o', 'm', '\0', @@ -5750,6 +5750,7 @@ static const char kSTSHostTable[] = { /* "gresak.io", true */ 'g', 'r', 'e', 's', 'a', 'k', '.', 'i', 'o', '\0', /* "gretchelizartistry.com", true */ 'g', 'r', 'e', 't', 'c', 'h', 'e', 'l', 'i', 'z', 'a', 'r', 't', 'i', 's', 't', 'r', 'y', '.', 'c', 'o', 'm', '\0', /* "grey.house", true */ 'g', 'r', 'e', 'y', '.', 'h', 'o', 'u', 's', 'e', '\0', + /* "greyline.se", true */ 'g', 'r', 'e', 'y', 'l', 'i', 'n', 'e', '.', 's', 'e', '\0', /* "greyskymedia.com", true */ 'g', 'r', 'e', 'y', 's', 'k', 'y', 'm', 'e', 'd', 'i', 'a', '.', 'c', 'o', 'm', '\0', /* "greysolutions.it", true */ 'g', 'r', 'e', 'y', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n', 's', '.', 'i', 't', '\0', /* "greywizard.com", true */ 'g', 'r', 'e', 'y', 'w', 'i', 'z', 'a', 'r', 'd', '.', 'c', 'o', 'm', '\0', @@ -5957,10 +5958,12 @@ static const char kSTSHostTable[] = { /* "happix.nl", true */ 'h', 'a', 'p', 'p', 'i', 'x', '.', 'n', 'l', '\0', /* "happyandrelaxeddogs.eu", true */ 'h', 'a', 'p', 'p', 'y', 'a', 'n', 'd', 'r', 'e', 'l', 'a', 'x', 'e', 'd', 'd', 'o', 'g', 's', '.', 'e', 'u', '\0', /* "happycoder.net", false */ 'h', 'a', 'p', 'p', 'y', 'c', 'o', 'd', 'e', 'r', '.', 'n', 'e', 't', '\0', + /* "happygadget.me", true */ 'h', 'a', 'p', 'p', 'y', 'g', 'a', 'd', 'g', 'e', 't', '.', 'm', 'e', '\0', /* "happylifestyle.com", true */ 'h', 'a', 'p', 'p', 'y', 'l', 'i', 'f', 'e', 's', 't', 'y', 'l', 'e', '.', 'c', 'o', 'm', '\0', /* "happyteamlabs.com", true */ 'h', 'a', 'p', 'p', 'y', 't', 'e', 'a', 'm', 'l', 'a', 'b', 's', '.', 'c', 'o', 'm', '\0', /* "happytiger.eu", true */ 'h', 'a', 'p', 'p', 'y', 't', 'i', 'g', 'e', 'r', '.', 'e', 'u', '\0', /* "happyukgo.com", true */ 'h', 'a', 'p', 'p', 'y', 'u', 'k', 'g', 'o', '.', 'c', 'o', 'm', '\0', + /* "hapvm.com", true */ 'h', 'a', 'p', 'v', 'm', '.', 'c', 'o', 'm', '\0', /* "haraj.com.sa", true */ 'h', 'a', 'r', 'a', 'j', '.', 'c', 'o', 'm', '.', 's', 'a', '\0', /* "harambe.site", true */ 'h', 'a', 'r', 'a', 'm', 'b', 'e', '.', 's', 'i', 't', 'e', '\0', /* "hardeman.nu", true */ 'h', 'a', 'r', 'd', 'e', 'm', 'a', 'n', '.', 'n', 'u', '\0', @@ -6111,13 +6114,13 @@ static const char kSTSHostTable[] = { /* "hennymerkel.com", true */ 'h', 'e', 'n', 'n', 'y', 'm', 'e', 'r', 'k', 'e', 'l', '.', 'c', 'o', 'm', '\0', /* "henok.eu", true */ 'h', 'e', 'n', 'o', 'k', '.', 'e', 'u', '\0', /* "henriksen.is", true */ 'h', 'e', 'n', 'r', 'i', 'k', 's', 'e', 'n', '.', 'i', 's', '\0', + /* "henrock.net", true */ 'h', 'e', 'n', 'r', 'o', 'c', 'k', '.', 'n', 'e', 't', '\0', /* "henry.gg", true */ 'h', 'e', 'n', 'r', 'y', '.', 'g', 'g', '\0', /* "henryphan.com", false */ 'h', 'e', 'n', 'r', 'y', 'p', 'h', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "hentschke-bau.de", true */ 'h', 'e', 'n', 't', 's', 'c', 'h', 'k', 'e', '-', 'b', 'a', 'u', '.', 'd', 'e', '\0', /* "hentschke-betonfertigteilwerk.de", true */ 'h', 'e', 'n', 't', 's', 'c', 'h', 'k', 'e', '-', 'b', 'e', 't', 'o', 'n', 'f', 'e', 'r', 't', 'i', 'g', 't', 'e', 'i', 'l', 'w', 'e', 'r', 'k', '.', 'd', 'e', '\0', /* "hentschke-invest.de", true */ 'h', 'e', 'n', 't', 's', 'c', 'h', 'k', 'e', '-', 'i', 'n', 'v', 'e', 's', 't', '.', 'd', 'e', '\0', /* "heppler.net", true */ 'h', 'e', 'p', 'p', 'l', 'e', 'r', '.', 'n', 'e', 't', '\0', - /* "hepteract.us", true */ 'h', 'e', 'p', 't', 'e', 'r', 'a', 'c', 't', '.', 'u', 's', '\0', /* "heptner24.de", true */ 'h', 'e', 'p', 't', 'n', 'e', 'r', '2', '4', '.', 'd', 'e', '\0', /* "herbandpat.org", true */ 'h', 'e', 'r', 'b', 'a', 'n', 'd', 'p', 'a', 't', '.', 'o', 'r', 'g', '\0', /* "herbert.io", true */ 'h', 'e', 'r', 'b', 'e', 'r', 't', '.', 'i', 'o', '\0', @@ -6347,7 +6350,6 @@ static const char kSTSHostTable[] = { /* "hsts.com.br", true */ 'h', 's', 't', 's', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', /* "hsts.eu", true */ 'h', 's', 't', 's', '.', 'e', 'u', '\0', /* "hstspreload.com", true */ 'h', 's', 't', 's', 'p', 'r', 'e', 'l', 'o', 'a', 'd', '.', 'c', 'o', 'm', '\0', - /* "hstspreload.org", true */ 'h', 's', 't', 's', 'p', 'r', 'e', 'l', 'o', 'a', 'd', '.', 'o', 'r', 'g', '\0', /* "hszemi.de", true */ 'h', 's', 'z', 'e', 'm', 'i', '.', 'd', 'e', '\0', /* "hszhyy120.com", true */ 'h', 's', 'z', 'h', 'y', 'y', '1', '2', '0', '.', 'c', 'o', 'm', '\0', /* "htaccessbook.com", true */ 'h', 't', 'a', 'c', 'c', 'e', 's', 's', 'b', 'o', 'o', 'k', '.', 'c', 'o', 'm', '\0', @@ -6482,7 +6484,6 @@ static const char kSTSHostTable[] = { /* "idahoansforliberty.net", true */ 'i', 'd', 'a', 'h', 'o', 'a', 'n', 's', 'f', 'o', 'r', 'l', 'i', 'b', 'e', 'r', 't', 'y', '.', 'n', 'e', 't', '\0', /* "idaspis.com", true */ 'i', 'd', 'a', 's', 'p', 'i', 's', '.', 'c', 'o', 'm', '\0', /* "idconsult.nl", true */ 'i', 'd', 'c', 'o', 'n', 's', 'u', 'l', 't', '.', 'n', 'l', '\0', - /* "ideadozz.hu", true */ 'i', 'd', 'e', 'a', 'd', 'o', 'z', 'z', '.', 'h', 'u', '\0', /* "ideaweb.de", true */ 'i', 'd', 'e', 'a', 'w', 'e', 'b', '.', 'd', 'e', '\0', /* "idemo.in", true */ 'i', 'd', 'e', 'm', 'o', '.', 'i', 'n', '\0', /* "idensys.nl", true */ 'i', 'd', 'e', 'n', 's', 'y', 's', '.', 'n', 'l', '\0', @@ -6563,7 +6564,6 @@ static const char kSTSHostTable[] = { /* "illegalpornography.me", true */ 'i', 'l', 'l', 'e', 'g', 'a', 'l', 'p', 'o', 'r', 'n', 'o', 'g', 'r', 'a', 'p', 'h', 'y', '.', 'm', 'e', '\0', /* "illicitart.ca", true */ 'i', 'l', 'l', 'i', 'c', 'i', 't', 'a', 'r', 't', '.', 'c', 'a', '\0', /* "illjinx.info", true */ 'i', 'l', 'l', 'j', 'i', 'n', 'x', '.', 'i', 'n', 'f', 'o', '\0', - /* "illorenese.fr", true */ 'i', 'l', 'l', 'o', 'r', 'e', 'n', 'e', 's', 'e', '.', 'f', 'r', '\0', /* "ilmiobusinessonline.it", true */ 'i', 'l', 'm', 'i', 'o', 'b', 'u', 's', 'i', 'n', 'e', 's', 's', 'o', 'n', 'l', 'i', 'n', 'e', '.', 'i', 't', '\0', /* "ilprof.com", true */ 'i', 'l', 'p', 'r', 'o', 'f', '.', 'c', 'o', 'm', '\0', /* "ilrg.com", true */ 'i', 'l', 'r', 'g', '.', 'c', 'o', 'm', '\0', @@ -6682,7 +6682,7 @@ static const char kSTSHostTable[] = { /* "iniiter.com", true */ 'i', 'n', 'i', 'i', 't', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "inima.org", true */ 'i', 'n', 'i', 'm', 'a', '.', 'o', 'r', 'g', '\0', /* "inios.fr", false */ 'i', 'n', 'i', 'o', 's', '.', 'f', 'r', '\0', - /* "initq.net", false */ 'i', 'n', 'i', 't', 'q', '.', 'n', 'e', 't', '\0', + /* "initq.net", true */ 'i', 'n', 'i', 't', 'q', '.', 'n', 'e', 't', '\0', /* "initrd.net", true */ 'i', 'n', 'i', 't', 'r', 'd', '.', 'n', 'e', 't', '\0', /* "injertoshorticolas.com", true */ 'i', 'n', 'j', 'e', 'r', 't', 'o', 's', 'h', 'o', 'r', 't', 'i', 'c', 'o', 'l', 'a', 's', '.', 'c', 'o', 'm', '\0', /* "inkbunny.net", true */ 'i', 'n', 'k', 'b', 'u', 'n', 'n', 'y', '.', 'n', 'e', 't', '\0', @@ -6955,6 +6955,7 @@ static const char kSTSHostTable[] = { /* "its-v.de", true */ 'i', 't', 's', '-', 'v', '.', 'd', 'e', '\0', /* "its4living.com", true */ 'i', 't', 's', '4', 'l', 'i', 'v', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "itsanicedoor.co.uk", true */ 'i', 't', 's', 'a', 'n', 'i', 'c', 'e', 'd', 'o', 'o', 'r', '.', 'c', 'o', '.', 'u', 'k', '\0', + /* "itsatrap.nl", true */ 'i', 't', 's', 'a', 't', 'r', 'a', 'p', '.', 'n', 'l', '\0', /* "itsecguy.com", true */ 'i', 't', 's', 'e', 'c', 'g', 'u', 'y', '.', 'c', 'o', 'm', '\0', /* "itsgoingdown.org", true */ 'i', 't', 's', 'g', 'o', 'i', 'n', 'g', 'd', 'o', 'w', 'n', '.', 'o', 'r', 'g', '\0', /* "itskayla.com", false */ 'i', 't', 's', 'k', 'a', 'y', 'l', 'a', '.', 'c', 'o', 'm', '\0', @@ -7209,7 +7210,6 @@ static const char kSTSHostTable[] = { /* "jm-bea.net", true */ 'j', 'm', '-', 'b', 'e', 'a', '.', 'n', 'e', 't', '\0', /* "jmcleaning.services", true */ 'j', 'm', 'c', 'l', 'e', 'a', 'n', 'i', 'n', 'g', '.', 's', 'e', 'r', 'v', 'i', 'c', 'e', 's', '\0', /* "jmedved.com", true */ 'j', 'm', 'e', 'd', 'v', 'e', 'd', '.', 'c', 'o', 'm', '\0', - /* "jmk.hu", true */ 'j', 'm', 'k', '.', 'h', 'u', '\0', /* "jn1.me", true */ 'j', 'n', '1', '.', 'm', 'e', '\0', /* "jncde.de", true */ 'j', 'n', 'c', 'd', 'e', '.', 'd', 'e', '\0', /* "jncie.eu", true */ 'j', 'n', 'c', 'i', 'e', '.', 'e', 'u', '\0', @@ -7327,7 +7327,6 @@ static const char kSTSHostTable[] = { /* "juliangonggrijp.com", true */ 'j', 'u', 'l', 'i', 'a', 'n', 'g', 'o', 'n', 'g', 'g', 'r', 'i', 'j', 'p', '.', 'c', 'o', 'm', '\0', /* "julianmeyer.de", true */ 'j', 'u', 'l', 'i', 'a', 'n', 'm', 'e', 'y', 'e', 'r', '.', 'd', 'e', '\0', /* "juliansimioni.com", true */ 'j', 'u', 'l', 'i', 'a', 'n', 's', 'i', 'm', 'i', 'o', 'n', 'i', '.', 'c', 'o', 'm', '\0', - /* "julibear.com", true */ 'j', 'u', 'l', 'i', 'b', 'e', 'a', 'r', '.', 'c', 'o', 'm', '\0', /* "julido.de", true */ 'j', 'u', 'l', 'i', 'd', 'o', '.', 'd', 'e', '\0', /* "juliekoubova.net", true */ 'j', 'u', 'l', 'i', 'e', 'k', 'o', 'u', 'b', 'o', 'v', 'a', '.', 'n', 'e', 't', '\0', /* "juliemaurel.fr", true */ 'j', 'u', 'l', 'i', 'e', 'm', 'a', 'u', 'r', 'e', 'l', '.', 'f', 'r', '\0', @@ -7349,7 +7348,6 @@ static const char kSTSHostTable[] = { /* "jurko.cz", true */ 'j', 'u', 'r', 'k', 'o', '.', 'c', 'z', '\0', /* "jurriaan.ninja", true */ 'j', 'u', 'r', 'r', 'i', 'a', 'a', 'n', '.', 'n', 'i', 'n', 'j', 'a', '\0', /* "just-a-clanpage.de", true */ 'j', 'u', 's', 't', '-', 'a', '-', 'c', 'l', 'a', 'n', 'p', 'a', 'g', 'e', '.', 'd', 'e', '\0', - /* "justanothercompany.name", true */ 'j', 'u', 's', 't', 'a', 'n', 'o', 't', 'h', 'e', 'r', 'c', 'o', 'm', 'p', 'a', 'n', 'y', '.', 'n', 'a', 'm', 'e', '\0', /* "justchunks.net", true */ 'j', 'u', 's', 't', 'c', 'h', 'u', 'n', 'k', 's', '.', 'n', 'e', 't', '\0', /* "justice4assange.com", true */ 'j', 'u', 's', 't', 'i', 'c', 'e', '4', 'a', 's', 's', 'a', 'n', 'g', 'e', '.', 'c', 'o', 'm', '\0', /* "justinharrison.ca", true */ 'j', 'u', 's', 't', 'i', 'n', 'h', 'a', 'r', 'r', 'i', 's', 'o', 'n', '.', 'c', 'a', '\0', @@ -7380,6 +7378,7 @@ static const char kSTSHostTable[] = { /* "kab-s.de", true */ 'k', 'a', 'b', '-', 's', '.', 'd', 'e', '\0', /* "kabat-fans.cz", true */ 'k', 'a', 'b', 'a', 't', '-', 'f', 'a', 'n', 's', '.', 'c', 'z', '\0', /* "kabeuchi.com", true */ 'k', 'a', 'b', 'e', 'u', 'c', 'h', 'i', '.', 'c', 'o', 'm', '\0', + /* "kabus.org", true */ 'k', 'a', 'b', 'u', 's', '.', 'o', 'r', 'g', '\0', /* "kachlikova2.cz", true */ 'k', 'a', 'c', 'h', 'l', 'i', 'k', 'o', 'v', 'a', '2', '.', 'c', 'z', '\0', /* "kackscharf.de", true */ 'k', 'a', 'c', 'k', 's', 'c', 'h', 'a', 'r', 'f', '.', 'd', 'e', '\0', /* "kadmec.com", true */ 'k', 'a', 'd', 'm', 'e', 'c', '.', 'c', 'o', 'm', '\0', @@ -7463,7 +7462,6 @@ static const char kSTSHostTable[] = { /* "kat.al", true */ 'k', 'a', 't', '.', 'a', 'l', '\0', /* "kateduggan.net", true */ 'k', 'a', 't', 'e', 'd', 'u', 'g', 'g', 'a', 'n', '.', 'n', 'e', 't', '\0', /* "katekligys.com", true */ 'k', 'a', 't', 'e', 'k', 'l', 'i', 'g', 'y', 's', '.', 'c', 'o', 'm', '\0', - /* "katericke.com", true */ 'k', 'a', 't', 'e', 'r', 'i', 'c', 'k', 'e', '.', 'c', 'o', 'm', '\0', /* "kati-raumplaner.de", true */ 'k', 'a', 't', 'i', '-', 'r', 'a', 'u', 'm', 'p', 'l', 'a', 'n', 'e', 'r', '.', 'd', 'e', '\0', /* "katja-nikolic-design.de", true */ 'k', 'a', 't', 'j', 'a', '-', 'n', 'i', 'k', 'o', 'l', 'i', 'c', '-', 'd', 'e', 's', 'i', 'g', 'n', '.', 'd', 'e', '\0', /* "katka.info", true */ 'k', 'a', 't', 'k', 'a', '.', 'i', 'n', 'f', 'o', '\0', @@ -7490,6 +7488,7 @@ static const char kSTSHostTable[] = { /* "kc5mpk.com", true */ 'k', 'c', '5', 'm', 'p', 'k', '.', 'c', 'o', 'm', '\0', /* "kcluster.io", true */ 'k', 'c', 'l', 'u', 's', 't', 'e', 'r', '.', 'i', 'o', '\0', /* "kcolford.com", false */ 'k', 'c', 'o', 'l', 'f', 'o', 'r', 'd', '.', 'c', 'o', 'm', '\0', + /* "kcptun.com", true */ 'k', 'c', 'p', 't', 'u', 'n', '.', 'c', 'o', 'm', '\0', /* "kcsordparticipation.org", true */ 'k', 'c', 's', 'o', 'r', 'd', 'p', 'a', 'r', 't', 'i', 'c', 'i', 'p', 'a', 't', 'i', 'o', 'n', '.', 'o', 'r', 'g', '\0', /* "kdex.de", true */ 'k', 'd', 'e', 'x', '.', 'd', 'e', '\0', /* "kdyby.org", true */ 'k', 'd', 'y', 'b', 'y', '.', 'o', 'r', 'g', '\0', @@ -7513,6 +7512,7 @@ static const char kSTSHostTable[] = { /* "kekku.li", true */ 'k', 'e', 'k', 'k', 'u', '.', 'l', 'i', '\0', /* "keksi.io", true */ 'k', 'e', 'k', 's', 'i', '.', 'i', 'o', '\0', /* "kekz.org", true */ 'k', 'e', 'k', 'z', '.', 'o', 'r', 'g', '\0', + /* "kellyandantony.com", true */ 'k', 'e', 'l', 'l', 'y', 'a', 'n', 'd', 'a', 'n', 't', 'o', 'n', 'y', '.', 'c', 'o', 'm', '\0', /* "kempkens.io", true */ 'k', 'e', 'm', 'p', 'k', 'e', 'n', 's', '.', 'i', 'o', '\0', /* "kendra.io", true */ 'k', 'e', 'n', 'd', 'r', 'a', '.', 'i', 'o', '\0', /* "kendu.si", true */ 'k', 'e', 'n', 'd', 'u', '.', 's', 'i', '\0', @@ -7618,7 +7618,6 @@ static const char kSTSHostTable[] = { /* "kionetworks.es", true */ 'k', 'i', 'o', 'n', 'e', 't', 'w', 'o', 'r', 'k', 's', '.', 'e', 's', '\0', /* "kiragameforum.net", true */ 'k', 'i', 'r', 'a', 'g', 'a', 'm', 'e', 'f', 'o', 'r', 'u', 'm', '.', 'n', 'e', 't', '\0', /* "kirara.eu", true */ 'k', 'i', 'r', 'a', 'r', 'a', '.', 'e', 'u', '\0', - /* "kirbear.com", true */ 'k', 'i', 'r', 'b', 'e', 'a', 'r', '.', 'c', 'o', 'm', '\0', /* "kirchengemeinde-markt-erlbach.de", true */ 'k', 'i', 'r', 'c', 'h', 'e', 'n', 'g', 'e', 'm', 'e', 'i', 'n', 'd', 'e', '-', 'm', 'a', 'r', 'k', 't', '-', 'e', 'r', 'l', 'b', 'a', 'c', 'h', '.', 'd', 'e', '\0', /* "kircp.com", true */ 'k', 'i', 'r', 'c', 'p', '.', 'c', 'o', 'm', '\0', /* "kirei.se", true */ 'k', 'i', 'r', 'e', 'i', '.', 's', 'e', '\0', @@ -7742,6 +7741,7 @@ static const char kSTSHostTable[] = { /* "kompetenzkurs.de", true */ 'k', 'o', 'm', 'p', 'e', 't', 'e', 'n', 'z', 'k', 'u', 'r', 's', '.', 'd', 'e', '\0', /* "kon-sil.de", true */ 'k', 'o', 'n', '-', 's', 'i', 'l', '.', 'd', 'e', '\0', /* "kondou-butsudan.com", true */ 'k', 'o', 'n', 'd', 'o', 'u', '-', 'b', 'u', 't', 's', 'u', 'd', 'a', 'n', '.', 'c', 'o', 'm', '\0', + /* "kongar.org", true */ 'k', 'o', 'n', 'g', 'a', 'r', '.', 'o', 'r', 'g', '\0', /* "koniecfica.sk", true */ 'k', 'o', 'n', 'i', 'e', 'c', 'f', 'i', 'c', 'a', '.', 's', 'k', '\0', /* "konijntjes.nl", true */ 'k', 'o', 'n', 'i', 'j', 'n', 't', 'j', 'e', 's', '.', 'n', 'l', '\0', /* "konklone.com", true */ 'k', 'o', 'n', 'k', 'l', 'o', 'n', 'e', '.', 'c', 'o', 'm', '\0', @@ -7808,7 +7808,6 @@ static const char kSTSHostTable[] = { /* "kriptosec.com", true */ 'k', 'r', 'i', 'p', 't', 'o', 's', 'e', 'c', '.', 'c', 'o', 'm', '\0', /* "krislamoureux.com", true */ 'k', 'r', 'i', 's', 'l', 'a', 'm', 'o', 'u', 'r', 'e', 'u', 'x', '.', 'c', 'o', 'm', '\0', /* "krisstarkey.co.uk", true */ 'k', 'r', 'i', 's', 's', 't', 'a', 'r', 'k', 'e', 'y', '.', 'c', 'o', '.', 'u', 'k', '\0', - /* "kristikala.nl", true */ 'k', 'r', 'i', 's', 't', 'i', 'k', 'a', 'l', 'a', '.', 'n', 'l', '\0', /* "kristinbailey.com", true */ 'k', 'r', 'i', 's', 't', 'i', 'n', 'b', 'a', 'i', 'l', 'e', 'y', '.', 'c', 'o', 'm', '\0', /* "kristjanrang.eu", true */ 'k', 'r', 'i', 's', 't', 'j', 'a', 'n', 'r', 'a', 'n', 'g', '.', 'e', 'u', '\0', /* "kristofferkoch.com", true */ 'k', 'r', 'i', 's', 't', 'o', 'f', 'f', 'e', 'r', 'k', 'o', 'c', 'h', '.', 'c', 'o', 'm', '\0', @@ -7879,6 +7878,7 @@ static const char kSTSHostTable[] = { /* "kwok.cc", true */ 'k', 'w', 'o', 'k', '.', 'c', 'c', '\0', /* "kwok.tv", true */ 'k', 'w', 'o', 'k', '.', 't', 'v', '\0', /* "kwondratsch.com", true */ 'k', 'w', 'o', 'n', 'd', 'r', 'a', 't', 's', 'c', 'h', '.', 'c', 'o', 'm', '\0', + /* "kxind.cn", true */ 'k', 'x', 'i', 'n', 'd', '.', 'c', 'n', '\0', /* "kybi.sk", true */ 'k', 'y', 'b', 'i', '.', 's', 'k', '\0', /* "kydara.com", true */ 'k', 'y', 'd', 'a', 'r', 'a', '.', 'c', 'o', 'm', '\0', /* "kykoonn.net", true */ 'k', 'y', 'k', 'o', 'o', 'n', 'n', '.', 'n', 'e', 't', '\0', @@ -8004,7 +8004,6 @@ static const char kSTSHostTable[] = { /* "latinphone.com", true */ 'l', 'a', 't', 'i', 'n', 'p', 'h', 'o', 'n', 'e', '.', 'c', 'o', 'm', '\0', /* "latinred.com", true */ 'l', 'a', 't', 'i', 'n', 'r', 'e', 'd', '.', 'c', 'o', 'm', '\0', /* "latitude42technology.com", true */ 'l', 'a', 't', 'i', 't', 'u', 'd', 'e', '4', '2', 't', 'e', 'c', 'h', 'n', 'o', 'l', 'o', 'g', 'y', '.', 'c', 'o', 'm', '\0', - /* "latrine.cz", true */ 'l', 'a', 't', 'r', 'i', 'n', 'e', '.', 'c', 'z', '\0', /* "lattyware.co.uk", true */ 'l', 'a', 't', 't', 'y', 'w', 'a', 'r', 'e', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "lattyware.com", true */ 'l', 'a', 't', 't', 'y', 'w', 'a', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "laubacher.io", true */ 'l', 'a', 'u', 'b', 'a', 'c', 'h', 'e', 'r', '.', 'i', 'o', '\0', @@ -8348,7 +8347,6 @@ static const char kSTSHostTable[] = { /* "localnetwork.nz", true */ 'l', 'o', 'c', 'a', 'l', 'n', 'e', 't', 'w', 'o', 'r', 'k', '.', 'n', 'z', '\0', /* "localspot.pl", true */ 'l', 'o', 'c', 'a', 'l', 's', 'p', 'o', 't', '.', 'p', 'l', '\0', /* "locauxrama.fr", true */ 'l', 'o', 'c', 'a', 'u', 'x', 'r', 'a', 'm', 'a', '.', 'f', 'r', '\0', - /* "locchat.com", true */ 'l', 'o', 'c', 'c', 'h', 'a', 't', '.', 'c', 'o', 'm', '\0', /* "lockify.com", true */ 'l', 'o', 'c', 'k', 'i', 'f', 'y', '.', 'c', 'o', 'm', '\0', /* "lockpick.nl", true */ 'l', 'o', 'c', 'k', 'p', 'i', 'c', 'k', '.', 'n', 'l', '\0', /* "lockpicks.se", true */ 'l', 'o', 'c', 'k', 'p', 'i', 'c', 'k', 's', '.', 's', 'e', '\0', @@ -8465,6 +8463,7 @@ static const char kSTSHostTable[] = { /* "luchscheider.de", true */ 'l', 'u', 'c', 'h', 's', 'c', 'h', 'e', 'i', 'd', 'e', 'r', '.', 'd', 'e', '\0', /* "lucidframeworks.com", true */ 'l', 'u', 'c', 'i', 'd', 'f', 'r', 'a', 'm', 'e', 'w', 'o', 'r', 'k', 's', '.', 'c', 'o', 'm', '\0', /* "lucidlight.de", true */ 'l', 'u', 'c', 'i', 'd', 'l', 'i', 'g', 'h', 't', '.', 'd', 'e', '\0', + /* "lucidlogs.com", true */ 'l', 'u', 'c', 'i', 'd', 'l', 'o', 'g', 's', '.', 'c', 'o', 'm', '\0', /* "lucielavickova.com", true */ 'l', 'u', 'c', 'i', 'e', 'l', 'a', 'v', 'i', 'c', 'k', 'o', 'v', 'a', '.', 'c', 'o', 'm', '\0', /* "lucyparsonslabs.com", true */ 'l', 'u', 'c', 'y', 'p', 'a', 'r', 's', 'o', 'n', 's', 'l', 'a', 'b', 's', '.', 'c', 'o', 'm', '\0', /* "lucysan.net", true */ 'l', 'u', 'c', 'y', 's', 'a', 'n', '.', 'n', 'e', 't', '\0', @@ -8552,7 +8551,6 @@ static const char kSTSHostTable[] = { /* "macaque.io", false */ 'm', 'a', 'c', 'a', 'q', 'u', 'e', '.', 'i', 'o', '\0', /* "macbolo.com", true */ 'm', 'a', 'c', 'b', 'o', 'l', 'o', '.', 'c', 'o', 'm', '\0', /* "macchedil.com", false */ 'm', 'a', 'c', 'c', 'h', 'e', 'd', 'i', 'l', '.', 'c', 'o', 'm', '\0', - /* "macdj.tk", true */ 'm', 'a', 'c', 'd', 'j', '.', 't', 'k', '\0', /* "mach-politik.ch", true */ 'm', 'a', 'c', 'h', '-', 'p', 'o', 'l', 'i', 't', 'i', 'k', '.', 'c', 'h', '\0', /* "machbach.com", true */ 'm', 'a', 'c', 'h', 'b', 'a', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "machbach.net", true */ 'm', 'a', 'c', 'h', 'b', 'a', 'c', 'h', '.', 'n', 'e', 't', '\0', @@ -9054,7 +9052,6 @@ static const char kSTSHostTable[] = { /* "mfxbe.de", true */ 'm', 'f', 'x', 'b', 'e', '.', 'd', 'e', '\0', /* "mgdigital.fr", true */ 'm', 'g', 'd', 'i', 'g', 'i', 't', 'a', 'l', '.', 'f', 'r', '\0', /* "mghiorzi.com.ar", true */ 'm', 'g', 'h', 'i', 'o', 'r', 'z', 'i', '.', 'c', 'o', 'm', '.', 'a', 'r', '\0', - /* "mgrossklaus.de", true */ 'm', 'g', 'r', 'o', 's', 's', 'k', 'l', 'a', 'u', 's', '.', 'd', 'e', '\0', /* "mheistermann.de", true */ 'm', 'h', 'e', 'i', 's', 't', 'e', 'r', 'm', 'a', 'n', 'n', '.', 'd', 'e', '\0', /* "mhermans.nl", true */ 'm', 'h', 'e', 'r', 'm', 'a', 'n', 's', '.', 'n', 'l', '\0', /* "mhjuma.com", true */ 'm', 'h', 'j', 'u', 'm', 'a', '.', 'c', 'o', 'm', '\0', @@ -9062,7 +9059,6 @@ static const char kSTSHostTable[] = { /* "miasarafina.de", true */ 'm', 'i', 'a', 's', 'a', 'r', 'a', 'f', 'i', 'n', 'a', '.', 'd', 'e', '\0', /* "micbase.com", true */ 'm', 'i', 'c', 'b', 'a', 's', 'e', '.', 'c', 'o', 'm', '\0', /* "michael-rigart.be", true */ 'm', 'i', 'c', 'h', 'a', 'e', 'l', '-', 'r', 'i', 'g', 'a', 'r', 't', '.', 'b', 'e', '\0', - /* "michaelcullen.name", true */ 'm', 'i', 'c', 'h', 'a', 'e', 'l', 'c', 'u', 'l', 'l', 'e', 'n', '.', 'n', 'a', 'm', 'e', '\0', /* "michaeleichorn.com", true */ 'm', 'i', 'c', 'h', 'a', 'e', 'l', 'e', 'i', 'c', 'h', 'o', 'r', 'n', '.', 'c', 'o', 'm', '\0', /* "michaelleibundgut.com", true */ 'm', 'i', 'c', 'h', 'a', 'e', 'l', 'l', 'e', 'i', 'b', 'u', 'n', 'd', 'g', 'u', 't', '.', 'c', 'o', 'm', '\0', /* "michaelmorpurgo.com", true */ 'm', 'i', 'c', 'h', 'a', 'e', 'l', 'm', 'o', 'r', 'p', 'u', 'r', 'g', 'o', '.', 'c', 'o', 'm', '\0', @@ -9108,6 +9104,7 @@ static const char kSTSHostTable[] = { /* "mikaela.info", true */ 'm', 'i', 'k', 'a', 'e', 'l', 'a', '.', 'i', 'n', 'f', 'o', '\0', /* "mikalikes.men", true */ 'm', 'i', 'k', 'a', 'l', 'i', 'k', 'e', 's', '.', 'm', 'e', 'n', '\0', /* "mike-bland.com", true */ 'm', 'i', 'k', 'e', '-', 'b', 'l', 'a', 'n', 'd', '.', 'c', 'o', 'm', '\0', + /* "mikecb.org", true */ 'm', 'i', 'k', 'e', 'c', 'b', '.', 'o', 'r', 'g', '\0', /* "mikepair.net", true */ 'm', 'i', 'k', 'e', 'p', 'a', 'i', 'r', '.', 'n', 'e', 't', '\0', /* "mikes.tk", true */ 'm', 'i', 'k', 'e', 's', '.', 't', 'k', '\0', /* "miketabor.com", true */ 'm', 'i', 'k', 'e', 't', 'a', 'b', 'o', 'r', '.', 'c', 'o', 'm', '\0', @@ -9441,6 +9438,7 @@ static const char kSTSHostTable[] = { /* "mtamaki.com", true */ 'm', 't', 'a', 'm', 'a', 'k', 'i', '.', 'c', 'o', 'm', '\0', /* "mtasa.com", true */ 'm', 't', 'a', 's', 'a', '.', 'c', 'o', 'm', '\0', /* "mtau.com", true */ 'm', 't', 'a', 'u', '.', 'c', 'o', 'm', '\0', + /* "mtg-tutor.de", true */ 'm', 't', 'g', '-', 't', 'u', 't', 'o', 'r', '.', 'd', 'e', '\0', /* "mthode.org", true */ 'm', 't', 'h', 'o', 'd', 'e', '.', 'o', 'r', 'g', '\0', /* "mths.be", false */ 'm', 't', 'h', 's', '.', 'b', 'e', '\0', /* "mticareportal.com", true */ 'm', 't', 'i', 'c', 'a', 'r', 'e', 'p', 'o', 'r', 't', 'a', 'l', '.', 'c', 'o', 'm', '\0', @@ -9481,6 +9479,7 @@ static const char kSTSHostTable[] = { /* "mush-room.co.jp", true */ 'm', 'u', 's', 'h', '-', 'r', 'o', 'o', 'm', '.', 'c', 'o', '.', 'j', 'p', '\0', /* "mushikabu.net", true */ 'm', 'u', 's', 'h', 'i', 'k', 'a', 'b', 'u', '.', 'n', 'e', 't', '\0', /* "mushroomandfern.com", true */ 'm', 'u', 's', 'h', 'r', 'o', 'o', 'm', 'a', 'n', 'd', 'f', 'e', 'r', 'n', '.', 'c', 'o', 'm', '\0', + /* "musi.cx", true */ 'm', 'u', 's', 'i', '.', 'c', 'x', '\0', /* "music-project.eu", true */ 'm', 'u', 's', 'i', 'c', '-', 'p', 'r', 'o', 'j', 'e', 'c', 't', '.', 'e', 'u', '\0', /* "music.amazon.com", true */ 'm', 'u', 's', 'i', 'c', '.', 'a', 'm', 'a', 'z', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "musicchris.de", true */ 'm', 'u', 's', 'i', 'c', 'c', 'h', 'r', 'i', 's', '.', 'd', 'e', '\0', @@ -9773,6 +9772,7 @@ static const char kSTSHostTable[] = { /* "nerdydev.net", true */ 'n', 'e', 'r', 'd', 'y', 'd', 'e', 'v', '.', 'n', 'e', 't', '\0', /* "neris.io", true */ 'n', 'e', 'r', 'i', 's', '.', 'i', 'o', '\0', /* "nerull7.info", true */ 'n', 'e', 'r', 'u', 'l', 'l', '7', '.', 'i', 'n', 'f', 'o', '\0', + /* "nerven.se", false */ 'n', 'e', 'r', 'v', 'e', 'n', '.', 's', 'e', '\0', /* "nestedquotes.ca", true */ 'n', 'e', 's', 't', 'e', 'd', 'q', 'u', 'o', 't', 'e', 's', '.', 'c', 'a', '\0', /* "nestone.ru", true */ 'n', 'e', 's', 't', 'o', 'n', 'e', '.', 'r', 'u', '\0', /* "neswec.org.uk", true */ 'n', 'e', 's', 'w', 'e', 'c', '.', 'o', 'r', 'g', '.', 'u', 'k', '\0', @@ -9832,13 +9832,16 @@ static const char kSTSHostTable[] = { /* "neurobiology.com", true */ 'n', 'e', 'u', 'r', 'o', 'b', 'i', 'o', 'l', 'o', 'g', 'y', '.', 'c', 'o', 'm', '\0', /* "neuroethics.com", true */ 'n', 'e', 'u', 'r', 'o', 'e', 't', 'h', 'i', 'c', 's', '.', 'c', 'o', 'm', '\0', /* "neurogroove.info", true */ 'n', 'e', 'u', 'r', 'o', 'g', 'r', 'o', 'o', 'v', 'e', '.', 'i', 'n', 'f', 'o', '\0', - /* "neuronasdigitales.com", true */ 'n', 'e', 'u', 'r', 'o', 'n', 'a', 's', 'd', 'i', 'g', 'i', 't', 'a', 'l', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "neuronfactor.com", true */ 'n', 'e', 'u', 'r', 'o', 'n', 'f', 'a', 'c', 't', 'o', 'r', '.', 'c', 'o', 'm', '\0', /* "neuropharmacology.com", true */ 'n', 'e', 'u', 'r', 'o', 'p', 'h', 'a', 'r', 'm', 'a', 'c', 'o', 'l', 'o', 'g', 'y', '.', 'c', 'o', 'm', '\0', /* "neuwal.com", true */ 'n', 'e', 'u', 'w', 'a', 'l', '.', 'c', 'o', 'm', '\0', /* "nevadafiber.net", true */ 'n', 'e', 'v', 'a', 'd', 'a', 'f', 'i', 'b', 'e', 'r', '.', 'n', 'e', 't', '\0', /* "new-black-order.com", true */ 'n', 'e', 'w', '-', 'b', 'l', 'a', 'c', 'k', '-', 'o', 'r', 'd', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "new-ms.com", true */ 'n', 'e', 'w', '-', 'm', 's', '.', 'c', 'o', 'm', '\0', + /* "new-process.ch", true */ 'n', 'e', 'w', '-', 'p', 'r', 'o', 'c', 'e', 's', 's', '.', 'c', 'h', '\0', + /* "new-process.com", true */ 'n', 'e', 'w', '-', 'p', 'r', 'o', 'c', 'e', 's', 's', '.', 'c', 'o', 'm', '\0', + /* "new-process.de", true */ 'n', 'e', 'w', '-', 'p', 'r', 'o', 'c', 'e', 's', 's', '.', 'd', 'e', '\0', + /* "new-process.eu", true */ 'n', 'e', 'w', '-', 'p', 'r', 'o', 'c', 'e', 's', 's', '.', 'e', 'u', '\0', /* "new.travel.pl", true */ 'n', 'e', 'w', '.', 't', 'r', 'a', 'v', 'e', 'l', '.', 'p', 'l', '\0', /* "newantiagingcreams.com", true */ 'n', 'e', 'w', 'a', 'n', 't', 'i', 'a', 'g', 'i', 'n', 'g', 'c', 'r', 'e', 'a', 'm', 's', '.', 'c', 'o', 'm', '\0', /* "newday.host", true */ 'n', 'e', 'w', 'd', 'a', 'y', '.', 'h', 'o', 's', 't', '\0', @@ -9966,7 +9969,6 @@ static const char kSTSHostTable[] = { /* "nkp-media.de", true */ 'n', 'k', 'p', '-', 'm', 'e', 'd', 'i', 'a', '.', 'd', 'e', '\0', /* "nl-ix.net", true */ 'n', 'l', '-', 'i', 'x', '.', 'n', 'e', 't', '\0', /* "nl.search.yahoo.com", false */ 'n', 'l', '.', 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', - /* "nlegall.fr", true */ 'n', 'l', 'e', 'g', 'a', 'l', 'l', '.', 'f', 'r', '\0', /* "nll.fi", true */ 'n', 'l', 'l', '.', 'f', 'i', '\0', /* "nmd.so", true */ 'n', 'm', 'd', '.', 's', 'o', '\0', /* "nmsnj.com", true */ 'n', 'm', 's', 'n', 'j', '.', 'c', 'o', 'm', '\0', @@ -10094,7 +10096,6 @@ static const char kSTSHostTable[] = { /* "nullpro.com", true */ 'n', 'u', 'l', 'l', 'p', 'r', 'o', '.', 'c', 'o', 'm', '\0', /* "nullroute.com", true */ 'n', 'u', 'l', 'l', 'r', 'o', 'u', 't', 'e', '.', 'c', 'o', 'm', '\0', /* "numatic.co.uk", true */ 'n', 'u', 'm', 'a', 't', 'i', 'c', '.', 'c', 'o', '.', 'u', 'k', '\0', - /* "number.me", false */ 'n', 'u', 'm', 'b', 'e', 'r', '.', 'm', 'e', '\0', /* "numberoneshoes.co.nz", true */ 'n', 'u', 'm', 'b', 'e', 'r', 'o', 'n', 'e', 's', 'h', 'o', 'e', 's', '.', 'c', 'o', '.', 'n', 'z', '\0', /* "numberzero.org", true */ 'n', 'u', 'm', 'b', 'e', 'r', 'z', 'e', 'r', 'o', '.', 'o', 'r', 'g', '\0', /* "numero-aleatorio.com", true */ 'n', 'u', 'm', 'e', 'r', 'o', '-', 'a', 'l', 'e', 'a', 't', 'o', 'r', 'i', 'o', '.', 'c', 'o', 'm', '\0', @@ -10350,6 +10351,7 @@ static const char kSTSHostTable[] = { /* "orcahq.com", true */ 'o', 'r', 'c', 'a', 'h', 'q', '.', 'c', 'o', 'm', '\0', /* "orcamoney.com", true */ 'o', 'r', 'c', 'a', 'm', 'o', 'n', 'e', 'y', '.', 'c', 'o', 'm', '\0', /* "orchidspaper.com", true */ 'o', 'r', 'c', 'h', 'i', 'd', 's', 'p', 'a', 'p', 'e', 'r', '.', 'c', 'o', 'm', '\0', + /* "ordereat.fr", true */ 'o', 'r', 'd', 'e', 'r', 'e', 'a', 't', '.', 'f', 'r', '\0', /* "ordernow.at", true */ 'o', 'r', 'd', 'e', 'r', 'n', 'o', 'w', '.', 'a', 't', '\0', /* "orderswift.com", true */ 'o', 'r', 'd', 'e', 'r', 's', 'w', 'i', 'f', 't', '.', 'c', 'o', 'm', '\0', /* "ordr.mobi", true */ 'o', 'r', 'd', 'r', '.', 'm', 'o', 'b', 'i', '\0', @@ -10502,6 +10504,7 @@ static const char kSTSHostTable[] = { /* "paratlan.hu", true */ 'p', 'a', 'r', 'a', 't', 'l', 'a', 'n', '.', 'h', 'u', '\0', /* "parckwart.de", true */ 'p', 'a', 'r', 'c', 'k', 'w', 'a', 'r', 't', '.', 'd', 'e', '\0', /* "parcon.it", true */ 'p', 'a', 'r', 'c', 'o', 'n', '.', 'i', 't', '\0', + /* "parent5446.us", true */ 'p', 'a', 'r', 'e', 'n', 't', '5', '4', '4', '6', '.', 'u', 's', '\0', /* "parentinterview.com", true */ 'p', 'a', 'r', 'e', 'n', 't', 'i', 'n', 't', 'e', 'r', 'v', 'i', 'e', 'w', '.', 'c', 'o', 'm', '\0', /* "pariga.co.uk", true */ 'p', 'a', 'r', 'i', 'g', 'a', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "parkingpoint.co.uk", true */ 'p', 'a', 'r', 'k', 'i', 'n', 'g', 'p', 'o', 'i', 'n', 't', '.', 'c', 'o', '.', 'u', 'k', '\0', @@ -10516,6 +10519,7 @@ static const char kSTSHostTable[] = { /* "participatorybudgeting.de", true */ 'p', 'a', 'r', 't', 'i', 'c', 'i', 'p', 'a', 't', 'o', 'r', 'y', 'b', 'u', 'd', 'g', 'e', 't', 'i', 'n', 'g', '.', 'd', 'e', '\0', /* "participatorybudgeting.info", true */ 'p', 'a', 'r', 't', 'i', 'c', 'i', 'p', 'a', 't', 'o', 'r', 'y', 'b', 'u', 'd', 'g', 'e', 't', 'i', 'n', 'g', '.', 'i', 'n', 'f', 'o', '\0', /* "partiono.com", true */ 'p', 'a', 'r', 't', 'i', 'o', 'n', 'o', '.', 'c', 'o', 'm', '\0', + /* "partirkyoto.jp", true */ 'p', 'a', 'r', 't', 'i', 'r', 'k', 'y', 'o', 't', 'o', '.', 'j', 'p', '\0', /* "partnerbeam.com", true */ 'p', 'a', 'r', 't', 'n', 'e', 'r', 'b', 'e', 'a', 'm', '.', 'c', 'o', 'm', '\0', /* "partnercardservices.com", true */ 'p', 'a', 'r', 't', 'n', 'e', 'r', 'c', 'a', 'r', 'd', 's', 'e', 'r', 'v', 'i', 'c', 'e', 's', '.', 'c', 'o', 'm', '\0', /* "partnersfcu.org", true */ 'p', 'a', 'r', 't', 'n', 'e', 'r', 's', 'f', 'c', 'u', '.', 'o', 'r', 'g', '\0', @@ -10636,7 +10640,6 @@ static const char kSTSHostTable[] = { /* "pe-kyousai.jp", true */ 'p', 'e', '-', 'k', 'y', 'o', 'u', 's', 'a', 'i', '.', 'j', 'p', '\0', /* "pe.search.yahoo.com", false */ 'p', 'e', '.', 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', /* "peaceandwool.com", true */ 'p', 'e', 'a', 'c', 'e', 'a', 'n', 'd', 'w', 'o', 'o', 'l', '.', 'c', 'o', 'm', '\0', - /* "peakapp.nl", true */ 'p', 'e', 'a', 'k', 'a', 'p', 'p', '.', 'n', 'l', '\0', /* "pear2pear.de", true */ 'p', 'e', 'a', 'r', '2', 'p', 'e', 'a', 'r', '.', 'd', 'e', '\0', /* "pebbles.net.in", true */ 'p', 'e', 'b', 'b', 'l', 'e', 's', '.', 'n', 'e', 't', '.', 'i', 'n', '\0', /* "pebblesdemo.com", true */ 'p', 'e', 'b', 'b', 'l', 'e', 's', 'd', 'e', 'm', 'o', '.', 'c', 'o', 'm', '\0', @@ -10698,7 +10701,6 @@ static const char kSTSHostTable[] = { /* "peromsik.com", true */ 'p', 'e', 'r', 'o', 'm', 's', 'i', 'k', '.', 'c', 'o', 'm', '\0', /* "perot.me", true */ 'p', 'e', 'r', 'o', 't', '.', 'm', 'e', '\0', /* "personalcommunicationsecurity.com", true */ 'p', 'e', 'r', 's', 'o', 'n', 'a', 'l', 'c', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', - /* "personalizedtouch.co", true */ 'p', 'e', 'r', 's', 'o', 'n', 'a', 'l', 'i', 'z', 'e', 'd', 't', 'o', 'u', 'c', 'h', '.', 'c', 'o', '\0', /* "perspectivum.com", true */ 'p', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'u', 'm', '.', 'c', 'o', 'm', '\0', /* "persson.im", true */ 'p', 'e', 'r', 's', 's', 'o', 'n', '.', 'i', 'm', '\0', /* "persson.me", true */ 'p', 'e', 'r', 's', 's', 'o', 'n', '.', 'm', 'e', '\0', @@ -11023,6 +11025,7 @@ static const char kSTSHostTable[] = { /* "postbox.life", true */ 'p', 'o', 's', 't', 'b', 'o', 'x', '.', 'l', 'i', 'f', 'e', '\0', /* "postcodegarant.nl", true */ 'p', 'o', 's', 't', 'c', 'o', 'd', 'e', 'g', 'a', 'r', 'a', 'n', 't', '.', 'n', 'l', '\0', /* "posteo.de", false */ 'p', 'o', 's', 't', 'e', 'o', '.', 'd', 'e', '\0', + /* "posterspy.com", true */ 'p', 'o', 's', 't', 'e', 'r', 's', 'p', 'y', '.', 'c', 'o', 'm', '\0', /* "postfinance.ch", true */ 'p', 'o', 's', 't', 'f', 'i', 'n', 'a', 'n', 'c', 'e', '.', 'c', 'h', '\0', /* "postmatescode.com", true */ 'p', 'o', 's', 't', 'm', 'a', 't', 'e', 's', 'c', 'o', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "postn.eu", true */ 'p', 'o', 's', 't', 'n', '.', 'e', 'u', '\0', @@ -11173,7 +11176,6 @@ static const char kSTSHostTable[] = { /* "prontocleaners.co.uk", true */ 'p', 'r', 'o', 'n', 't', 'o', 'c', 'l', 'e', 'a', 'n', 'e', 'r', 's', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "proofwiki.org", true */ 'p', 'r', 'o', 'o', 'f', 'w', 'i', 'k', 'i', '.', 'o', 'r', 'g', '\0', /* "proos.nl", true */ 'p', 'r', 'o', 'o', 's', '.', 'n', 'l', '\0', - /* "propactrading.com", true */ 'p', 'r', 'o', 'p', 'a', 'c', 't', 'r', 'a', 'd', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "propagandism.org", true */ 'p', 'r', 'o', 'p', 'a', 'g', 'a', 'n', 'd', 'i', 's', 'm', '.', 'o', 'r', 'g', '\0', /* "propershave.com", true */ 'p', 'r', 'o', 'p', 'e', 'r', 's', 'h', 'a', 'v', 'e', '.', 'c', 'o', 'm', '\0', /* "property-catalogue.eu", true */ 'p', 'r', 'o', 'p', 'e', 'r', 't', 'y', '-', 'c', 'a', 't', 'a', 'l', 'o', 'g', 'u', 'e', '.', 'e', 'u', '\0', @@ -11363,10 +11365,10 @@ static const char kSTSHostTable[] = { /* "qualityology.com", true */ 'q', 'u', 'a', 'l', 'i', 't', 'y', 'o', 'l', 'o', 'g', 'y', '.', 'c', 'o', 'm', '\0', /* "quanglepro.com", true */ 'q', 'u', 'a', 'n', 'g', 'l', 'e', 'p', 'r', 'o', '.', 'c', 'o', 'm', '\0', /* "quantoras.com", true */ 'q', 'u', 'a', 'n', 't', 'o', 'r', 'a', 's', '.', 'c', 'o', 'm', '\0', + /* "quantumfurball.net", true */ 'q', 'u', 'a', 'n', 't', 'u', 'm', 'f', 'u', 'r', 'b', 'a', 'l', 'l', '.', 'n', 'e', 't', '\0', /* "quarterfull.com", true */ 'q', 'u', 'a', 'r', 't', 'e', 'r', 'f', 'u', 'l', 'l', '.', 'c', 'o', 'm', '\0', /* "qubyte.codes", true */ 'q', 'u', 'b', 'y', 't', 'e', '.', 'c', 'o', 'd', 'e', 's', '\0', /* "quchao.com", true */ 'q', 'u', 'c', 'h', 'a', 'o', '.', 'c', 'o', 'm', '\0', - /* "quebecmailbox.com", true */ 'q', 'u', 'e', 'b', 'e', 'c', 'm', 'a', 'i', 'l', 'b', 'o', 'x', '.', 'c', 'o', 'm', '\0', /* "queercinema.ch", true */ 'q', 'u', 'e', 'e', 'r', 'c', 'i', 'n', 'e', 'm', 'a', '.', 'c', 'h', '\0', /* "queminventou.com.br", true */ 'q', 'u', 'e', 'm', 'i', 'n', 'v', 'e', 'n', 't', 'o', 'u', '.', 'c', 'o', 'm', '.', 'b', 'r', '\0', /* "quemmeliga.com", true */ 'q', 'u', 'e', 'm', 'm', 'e', 'l', 'i', 'g', 'a', '.', 'c', 'o', 'm', '\0', @@ -11433,6 +11435,7 @@ static const char kSTSHostTable[] = { /* "raidstone.net", true */ 'r', 'a', 'i', 'd', 's', 't', 'o', 'n', 'e', '.', 'n', 'e', 't', '\0', /* "raidstone.rocks", true */ 'r', 'a', 'i', 'd', 's', 't', 'o', 'n', 'e', '.', 'r', 'o', 'c', 'k', 's', '\0', /* "railgun.ac", true */ 'r', 'a', 'i', 'l', 'g', 'u', 'n', '.', 'a', 'c', '\0', + /* "railjob.cn", true */ 'r', 'a', 'i', 'l', 'j', 'o', 'b', '.', 'c', 'n', '\0', /* "railyardurgentcare.com", true */ 'r', 'a', 'i', 'l', 'y', 'a', 'r', 'd', 'u', 'r', 'g', 'e', 'n', 't', 'c', 'a', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "rainbowbay.org", true */ 'r', 'a', 'i', 'n', 'b', 'o', 'w', 'b', 'a', 'y', '.', 'o', 'r', 'g', '\0', /* "rainforest.engineering", true */ 'r', 'a', 'i', 'n', 'f', 'o', 'r', 'e', 's', 't', '.', 'e', 'n', 'g', 'i', 'n', 'e', 'e', 'r', 'i', 'n', 'g', '\0', @@ -11466,6 +11469,7 @@ static const char kSTSHostTable[] = { /* "rasebo.ro", true */ 'r', 'a', 's', 'e', 'b', 'o', '.', 'r', 'o', '\0', /* "raspberry.us", true */ 'r', 'a', 's', 'p', 'b', 'e', 'r', 'r', 'y', '.', 'u', 's', '\0', /* "ratd.net", true */ 'r', 'a', 't', 'd', '.', 'n', 'e', 't', '\0', + /* "rathorian.fr", true */ 'r', 'a', 't', 'h', 'o', 'r', 'i', 'a', 'n', '.', 'f', 'r', '\0', /* "rationalism.com", true */ 'r', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'i', 's', 'm', '.', 'c', 'o', 'm', '\0', /* "rationalops.com", true */ 'r', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'o', 'p', 's', '.', 'c', 'o', 'm', '\0', /* "ratuseks.com", false */ 'r', 'a', 't', 'u', 's', 'e', 'k', 's', '.', 'c', 'o', 'm', '\0', @@ -11479,7 +11483,6 @@ static const char kSTSHostTable[] = { /* "raven.lipetsk.ru", true */ 'r', 'a', 'v', 'e', 'n', '.', 'l', 'i', 'p', 'e', 't', 's', 'k', '.', 'r', 'u', '\0', /* "ravensbuch.de", true */ 'r', 'a', 'v', 'e', 'n', 's', 'b', 'u', 'c', 'h', '.', 'd', 'e', '\0', /* "ravindran.me", true */ 'r', 'a', 'v', 'i', 'n', 'd', 'r', 'a', 'n', '.', 'm', 'e', '\0', - /* "ravkr.duckdns.org", true */ 'r', 'a', 'v', 'k', 'r', '.', 'd', 'u', 'c', 'k', 'd', 'n', 's', '.', 'o', 'r', 'g', '\0', /* "ravse.dk", true */ 'r', 'a', 'v', 's', 'e', '.', 'd', 'k', '\0', /* "rawoil.com", true */ 'r', 'a', 'w', 'o', 'i', 'l', '.', 'c', 'o', 'm', '\0', /* "rawsec.net", true */ 'r', 'a', 'w', 's', 'e', 'c', '.', 'n', 'e', 't', '\0', @@ -11606,7 +11609,6 @@ static const char kSTSHostTable[] = { /* "reikiqueen.uk", true */ 'r', 'e', 'i', 'k', 'i', 'q', 'u', 'e', 'e', 'n', '.', 'u', 'k', '\0', /* "reilly.io", true */ 'r', 'e', 'i', 'l', 'l', 'y', '.', 'i', 'o', '\0', /* "reimers.de", true */ 'r', 'e', 'i', 'm', 'e', 'r', 's', '.', 'd', 'e', '\0', - /* "reinaertvandecruys.me", true */ 'r', 'e', 'i', 'n', 'a', 'e', 'r', 't', 'v', 'a', 'n', 'd', 'e', 'c', 'r', 'u', 'y', 's', '.', 'm', 'e', '\0', /* "reinaldudras.ee", true */ 'r', 'e', 'i', 'n', 'a', 'l', 'd', 'u', 'd', 'r', 'a', 's', '.', 'e', 'e', '\0', /* "reinencaressa.be", true */ 'r', 'e', 'i', 'n', 'e', 'n', 'c', 'a', 'r', 'e', 's', 's', 'a', '.', 'b', 'e', '\0', /* "reinhardtsgrimma.de", true */ 'r', 'e', 'i', 'n', 'h', 'a', 'r', 'd', 't', 's', 'g', 'r', 'i', 'm', 'm', 'a', '.', 'd', 'e', '\0', @@ -11673,6 +11675,7 @@ static const char kSTSHostTable[] = { /* "resources.flowfinity.com", true */ 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', 's', '.', 'f', 'l', 'o', 'w', 'f', 'i', 'n', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "respon.jp", true */ 'r', 'e', 's', 'p', 'o', 'n', '.', 'j', 'p', '\0', /* "responer.com", true */ 'r', 'e', 's', 'p', 'o', 'n', 'e', 'r', '.', 'c', 'o', 'm', '\0', + /* "responsibledisclosure.nl", false */ 'r', 'e', 's', 'p', 'o', 'n', 's', 'i', 'b', 'l', 'e', 'd', 'i', 's', 'c', 'l', 'o', 's', 'u', 'r', 'e', '.', 'n', 'l', '\0', /* "restoruns.com", true */ 'r', 'e', 's', 't', 'o', 'r', 'u', 'n', 's', '.', 'c', 'o', 'm', '\0', /* "restrealitaet.de", true */ 'r', 'e', 's', 't', 'r', 'e', 'a', 'l', 'i', 't', 'a', 'e', 't', '.', 'd', 'e', '\0', /* "restrito.org", true */ 'r', 'e', 's', 't', 'r', 'i', 't', 'o', '.', 'o', 'r', 'g', '\0', @@ -11703,6 +11706,7 @@ static const char kSTSHostTable[] = { /* "rezosup.net", true */ 'r', 'e', 'z', 'o', 's', 'u', 'p', '.', 'n', 'e', 't', '\0', /* "rezosup.org", true */ 'r', 'e', 'z', 'o', 's', 'u', 'p', '.', 'o', 'r', 'g', '\0', /* "rezun.cloud", true */ 'r', 'e', 'z', 'u', 'n', '.', 'c', 'l', 'o', 'u', 'd', '\0', + /* "rgavmf.ru", true */ 'r', 'g', 'a', 'v', 'm', 'f', '.', 'r', 'u', '\0', /* "rgservers.com", true */ 'r', 'g', 's', 'e', 'r', 'v', 'e', 'r', 's', '.', 'c', 'o', 'm', '\0', /* "rhees.nl", true */ 'r', 'h', 'e', 'e', 's', '.', 'n', 'l', '\0', /* "rheinneckarmetal.com", true */ 'r', 'h', 'e', 'i', 'n', 'n', 'e', 'c', 'k', 'a', 'r', 'm', 'e', 't', 'a', 'l', '.', 'c', 'o', 'm', '\0', @@ -11727,6 +11731,7 @@ static const char kSTSHostTable[] = { /* "richmtdriver.com", true */ 'r', 'i', 'c', 'h', 'm', 't', 'd', 'r', 'i', 'v', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "richterphilipp.com", true */ 'r', 'i', 'c', 'h', 't', 'e', 'r', 'p', 'h', 'i', 'l', 'i', 'p', 'p', '.', 'c', 'o', 'm', '\0', /* "ricki-z.com", true */ 'r', 'i', 'c', 'k', 'i', '-', 'z', '.', 'c', 'o', 'm', '\0', + /* "rickrongen.nl", true */ 'r', 'i', 'c', 'k', 'r', 'o', 'n', 'g', 'e', 'n', '.', 'n', 'l', '\0', /* "rickweijers.nl", true */ 'r', 'i', 'c', 'k', 'w', 'e', 'i', 'j', 'e', 'r', 's', '.', 'n', 'l', '\0', /* "rickyromero.com", true */ 'r', 'i', 'c', 'k', 'y', 'r', 'o', 'm', 'e', 'r', 'o', '.', 'c', 'o', 'm', '\0', /* "rico-brase.de", true */ 'r', 'i', 'c', 'o', '-', 'b', 'r', 'a', 's', 'e', '.', 'd', 'e', '\0', @@ -11789,7 +11794,6 @@ static const char kSTSHostTable[] = { /* "ro.search.yahoo.com", false */ 'r', 'o', '.', 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', /* "roadfeast.com", true */ 'r', 'o', 'a', 'd', 'f', 'e', 'a', 's', 't', '.', 'c', 'o', 'm', '\0', /* "roave.com", true */ 'r', 'o', 'a', 'v', 'e', '.', 'c', 'o', 'm', '\0', - /* "robandjanine.com", true */ 'r', 'o', 'b', 'a', 'n', 'd', 'j', 'a', 'n', 'i', 'n', 'e', '.', 'c', 'o', 'm', '\0', /* "roberthurlbut.com", true */ 'r', 'o', 'b', 'e', 'r', 't', 'h', 'u', 'r', 'l', 'b', 'u', 't', '.', 'c', 'o', 'm', '\0', /* "robertkrueger.de", true */ 'r', 'o', 'b', 'e', 'r', 't', 'k', 'r', 'u', 'e', 'g', 'e', 'r', '.', 'd', 'e', '\0', /* "roberto-webhosting.nl", true */ 'r', 'o', 'b', 'e', 'r', 't', 'o', '-', 'w', 'e', 'b', 'h', 'o', 's', 't', 'i', 'n', 'g', '.', 'n', 'l', '\0', @@ -11805,7 +11809,6 @@ static const char kSTSHostTable[] = { /* "robodeidentidad.gov", true */ 'r', 'o', 'b', 'o', 'd', 'e', 'i', 'd', 'e', 'n', 't', 'i', 'd', 'a', 'd', '.', 'g', 'o', 'v', '\0', /* "robohash.org", true */ 'r', 'o', 'b', 'o', 'h', 'a', 's', 'h', '.', 'o', 'r', 'g', '\0', /* "robototes.com", true */ 'r', 'o', 'b', 'o', 't', 'o', 't', 'e', 's', '.', 'c', 'o', 'm', '\0', - /* "robspc.repair", true */ 'r', 'o', 'b', 's', 'p', 'c', '.', 'r', 'e', 'p', 'a', 'i', 'r', '\0', /* "robtex.com", true */ 'r', 'o', 'b', 't', 'e', 'x', '.', 'c', 'o', 'm', '\0', /* "robud.info", true */ 'r', 'o', 'b', 'u', 'd', '.', 'i', 'n', 'f', 'o', '\0', /* "robust.ga", true */ 'r', 'o', 'b', 'u', 's', 't', '.', 'g', 'a', '\0', @@ -11828,6 +11831,7 @@ static const char kSTSHostTable[] = { /* "rogerriendeau.ca", true */ 'r', 'o', 'g', 'e', 'r', 'r', 'i', 'e', 'n', 'd', 'e', 'a', 'u', '.', 'c', 'a', '\0', /* "rogue-e.xyz", true */ 'r', 'o', 'g', 'u', 'e', '-', 'e', '.', 'x', 'y', 'z', '\0', /* "roguelikecenter.fr", true */ 'r', 'o', 'g', 'u', 'e', 'l', 'i', 'k', 'e', 'c', 'e', 'n', 't', 'e', 'r', '.', 'f', 'r', '\0', + /* "roguesignal.net", true */ 'r', 'o', 'g', 'u', 'e', 's', 'i', 'g', 'n', 'a', 'l', '.', 'n', 'e', 't', '\0', /* "roguetechhub.org", true */ 'r', 'o', 'g', 'u', 'e', 't', 'e', 'c', 'h', 'h', 'u', 'b', '.', 'o', 'r', 'g', '\0', /* "rohedaten.de", true */ 'r', 'o', 'h', 'e', 'd', 'a', 't', 'e', 'n', '.', 'd', 'e', '\0', /* "rohitagr.com", true */ 'r', 'o', 'h', 'i', 't', 'a', 'g', 'r', '.', 'c', 'o', 'm', '\0', @@ -11930,7 +11934,6 @@ static const char kSTSHostTable[] = { /* "rubysecurity.org", true */ 'r', 'u', 'b', 'y', 's', 'e', 'c', 'u', 'r', 'i', 't', 'y', '.', 'o', 'r', 'g', '\0', /* "rudd-o.com", true */ 'r', 'u', 'd', 'd', '-', 'o', '.', 'c', 'o', 'm', '\0', /* "ruderverein-gelsenkirchen.de", true */ 'r', 'u', 'd', 'e', 'r', 'v', 'e', 'r', 'e', 'i', 'n', '-', 'g', 'e', 'l', 's', 'e', 'n', 'k', 'i', 'r', 'c', 'h', 'e', 'n', '.', 'd', 'e', '\0', - /* "ruffbeatz.com", true */ 'r', 'u', 'f', 'f', 'b', 'e', 'a', 't', 'z', '.', 'c', 'o', 'm', '\0', /* "rugby.video", true */ 'r', 'u', 'g', 'b', 'y', '.', 'v', 'i', 'd', 'e', 'o', '\0', /* "rugk.dedyn.io", true */ 'r', 'u', 'g', 'k', '.', 'd', 'e', 'd', 'y', 'n', '.', 'i', 'o', '\0', /* "rugstorene.co.uk", true */ 'r', 'u', 'g', 's', 't', 'o', 'r', 'e', 'n', 'e', '.', 'c', 'o', '.', 'u', 'k', '\0', @@ -11958,6 +11961,7 @@ static const char kSTSHostTable[] = { /* "rustable.com", true */ 'r', 'u', 's', 't', 'a', 'b', 'l', 'e', '.', 'c', 'o', 'm', '\0', /* "rustfanatic.com", true */ 'r', 'u', 's', 't', 'f', 'a', 'n', 'a', 't', 'i', 'c', '.', 'c', 'o', 'm', '\0', /* "rustyrambles.com", true */ 'r', 'u', 's', 't', 'y', 'r', 'a', 'm', 'b', 'l', 'e', 's', '.', 'c', 'o', 'm', '\0', + /* "rusxakep.com", true */ 'r', 'u', 's', 'x', 'a', 'k', 'e', 'p', '.', 'c', 'o', 'm', '\0', /* "rutgerschimmel.nl", true */ 'r', 'u', 't', 'g', 'e', 'r', 's', 'c', 'h', 'i', 'm', 'm', 'e', 'l', '.', 'n', 'l', '\0', /* "ruudkoot.nl", true */ 'r', 'u', 'u', 'd', 'k', 'o', 'o', 't', '.', 'n', 'l', '\0', /* "rva-asbestgroep.nl", true */ 'r', 'v', 'a', '-', 'a', 's', 'b', 'e', 's', 't', 'g', 'r', 'o', 'e', 'p', '.', 'n', 'l', '\0', @@ -12064,7 +12068,6 @@ static const char kSTSHostTable[] = { /* "samwilberforce.com", true */ 's', 'a', 'm', 'w', 'i', 'l', 'b', 'e', 'r', 'f', 'o', 'r', 'c', 'e', '.', 'c', 'o', 'm', '\0', /* "samwu.tw", false */ 's', 'a', 'm', 'w', 'u', '.', 't', 'w', '\0', /* "sanandreasstories.com", true */ 's', 'a', 'n', 'a', 'n', 'd', 'r', 'e', 'a', 's', 's', 't', 'o', 'r', 'i', 'e', 's', '.', 'c', 'o', 'm', '\0', - /* "sanasalud.org", true */ 's', 'a', 'n', 'a', 's', 'a', 'l', 'u', 'd', '.', 'o', 'r', 'g', '\0', /* "sanasport.cz", true */ 's', 'a', 'n', 'a', 's', 'p', 'o', 'r', 't', '.', 'c', 'z', '\0', /* "sanatfilan.com", false */ 's', 'a', 'n', 'a', 't', 'f', 'i', 'l', 'a', 'n', '.', 'c', 'o', 'm', '\0', /* "sanchez.adv.br", true */ 's', 'a', 'n', 'c', 'h', 'e', 'z', '.', 'a', 'd', 'v', '.', 'b', 'r', '\0', @@ -12151,6 +12154,7 @@ static const char kSTSHostTable[] = { /* "scandicom.fi", true */ 's', 'c', 'a', 'n', 'd', 'i', 'c', 'o', 'm', '.', 'f', 'i', '\0', /* "scandinavia.dating", true */ 's', 'c', 'a', 'n', 'd', 'i', 'n', 'a', 'v', 'i', 'a', '.', 'd', 'a', 't', 'i', 'n', 'g', '\0', /* "scanleasing.net", true */ 's', 'c', 'a', 'n', 'l', 'e', 'a', 's', 'i', 'n', 'g', '.', 'n', 'e', 't', '\0', + /* "scannabi.com", true */ 's', 'c', 'a', 'n', 'n', 'a', 'b', 'i', '.', 'c', 'o', 'm', '\0', /* "scanpay.dk", true */ 's', 'c', 'a', 'n', 'p', 'a', 'y', '.', 'd', 'k', '\0', /* "scenester.tv", true */ 's', 'c', 'e', 'n', 'e', 's', 't', 'e', 'r', '.', 't', 'v', '\0', /* "scepticism.com", true */ 's', 'c', 'e', 'p', 't', 'i', 'c', 'i', 's', 'm', '.', 'c', 'o', 'm', '\0', @@ -12510,7 +12514,6 @@ static const char kSTSHostTable[] = { /* "shentengtu.idv.tw", true */ 's', 'h', 'e', 'n', 't', 'e', 'n', 'g', 't', 'u', '.', 'i', 'd', 'v', '.', 't', 'w', '\0', /* "shenyuqi.com", true */ 's', 'h', 'e', 'n', 'y', 'u', 'q', 'i', '.', 'c', 'o', 'm', '\0', /* "shep.co.il", true */ 's', 'h', 'e', 'p', '.', 'c', 'o', '.', 'i', 'l', '\0', - /* "sherbers.de", true */ 's', 'h', 'e', 'r', 'b', 'e', 'r', 's', '.', 'd', 'e', '\0', /* "shereallyheals.com", true */ 's', 'h', 'e', 'r', 'e', 'a', 'l', 'l', 'y', 'h', 'e', 'a', 'l', 's', '.', 'c', 'o', 'm', '\0', /* "shevronpatriot.ru", true */ 's', 'h', 'e', 'v', 'r', 'o', 'n', 'p', 'a', 't', 'r', 'i', 'o', 't', '.', 'r', 'u', '\0', /* "shft.cl", true */ 's', 'h', 'f', 't', '.', 'c', 'l', '\0', @@ -12665,7 +12668,7 @@ static const char kSTSHostTable[] = { /* "simumiehet.com", true */ 's', 'i', 'm', 'u', 'm', 'i', 'e', 'h', 'e', 't', '.', 'c', 'o', 'm', '\0', /* "simus.fr", true */ 's', 'i', 'm', 'u', 's', '.', 'f', 'r', '\0', /* "sinful.pw", true */ 's', 'i', 'n', 'f', 'u', 'l', '.', 'p', 'w', '\0', - /* "sinfulforums.net", false */ 's', 'i', 'n', 'f', 'u', 'l', 'f', 'o', 'r', 'u', 'm', 's', '.', 'n', 'e', 't', '\0', + /* "sinfulforums.net", true */ 's', 'i', 'n', 'f', 'u', 'l', 'f', 'o', 'r', 'u', 'm', 's', '.', 'n', 'e', 't', '\0', /* "singleuse.link", true */ 's', 'i', 'n', 'g', 'l', 'e', 'u', 's', 'e', '.', 'l', 'i', 'n', 'k', '\0', /* "singlu10.org", false */ 's', 'i', 'n', 'g', 'l', 'u', '1', '0', '.', 'o', 'r', 'g', '\0', /* "singul4rity.com", true */ 's', 'i', 'n', 'g', 'u', 'l', '4', 'r', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', @@ -12726,11 +12729,9 @@ static const char kSTSHostTable[] = { /* "skogsbruket.fi", true */ 's', 'k', 'o', 'g', 's', 'b', 'r', 'u', 'k', 'e', 't', '.', 'f', 'i', '\0', /* "skogskultur.fi", true */ 's', 'k', 'o', 'g', 's', 'k', 'u', 'l', 't', 'u', 'r', '.', 'f', 'i', '\0', /* "skolem.de", true */ 's', 'k', 'o', 'l', 'e', 'm', '.', 'd', 'e', '\0', - /* "skoleniphp.cz", true */ 's', 'k', 'o', 'l', 'e', 'n', 'i', 'p', 'h', 'p', '.', 'c', 'z', '\0', /* "skontakt.cz", true */ 's', 'k', 'o', 'n', 't', 'a', 'k', 't', '.', 'c', 'z', '\0', /* "skontorp-enterprise.no", true */ 's', 'k', 'o', 'n', 't', 'o', 'r', 'p', '-', 'e', 'n', 't', 'e', 'r', 'p', 'r', 'i', 's', 'e', '.', 'n', 'o', '\0', /* "skory.us", true */ 's', 'k', 'o', 'r', 'y', '.', 'u', 's', '\0', - /* "skotty.io", true */ 's', 'k', 'o', 't', 't', 'y', '.', 'i', 'o', '\0', /* "skou.dk", true */ 's', 'k', 'o', 'u', '.', 'd', 'k', '\0', /* "sktsolution.com", true */ 's', 'k', 't', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "sky-aroma.com", true */ 's', 'k', 'y', '-', 'a', 'r', 'o', 'm', 'a', '.', 'c', 'o', 'm', '\0', @@ -12754,6 +12755,7 @@ static const char kSTSHostTable[] = { /* "slapen17.nl", true */ 's', 'l', 'a', 'p', 'e', 'n', '1', '7', '.', 'n', 'l', '\0', /* "slaps.be", true */ 's', 'l', 'a', 'p', 's', '.', 'b', 'e', '\0', /* "slashdesign.it", true */ 's', 'l', 'a', 's', 'h', 'd', 'e', 's', 'i', 'g', 'n', '.', 'i', 't', '\0', + /* "slashem.me", true */ 's', 'l', 'a', 's', 'h', 'e', 'm', '.', 'm', 'e', '\0', /* "slauber.de", true */ 's', 'l', 'a', 'u', 'b', 'e', 'r', '.', 'd', 'e', '\0', /* "slaughterhouse.fr", true */ 's', 'l', 'a', 'u', 'g', 'h', 't', 'e', 'r', 'h', 'o', 'u', 's', 'e', '.', 'f', 'r', '\0', /* "sleeplessbeastie.eu", true */ 's', 'l', 'e', 'e', 'p', 'l', 'e', 's', 's', 'b', 'e', 'a', 's', 't', 'i', 'e', '.', 'e', 'u', '\0', @@ -12796,7 +12798,6 @@ static const char kSTSHostTable[] = { /* "smalltalkconsulting.com", true */ 's', 'm', 'a', 'l', 'l', 't', 'a', 'l', 'k', 'c', 'o', 'n', 's', 'u', 'l', 't', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "smares.de", true */ 's', 'm', 'a', 'r', 'e', 's', '.', 'd', 'e', '\0', /* "smart-cp.jp", true */ 's', 'm', 'a', 'r', 't', '-', 'c', 'p', '.', 'j', 'p', '\0', - /* "smartairkey.com", true */ 's', 'm', 'a', 'r', 't', 'a', 'i', 'r', 'k', 'e', 'y', '.', 'c', 'o', 'm', '\0', /* "smartbuyelectric.com", true */ 's', 'm', 'a', 'r', 't', 'b', 'u', 'y', 'e', 'l', 'e', 'c', 't', 'r', 'i', 'c', '.', 'c', 'o', 'm', '\0', /* "smartcheck.gov", true */ 's', 'm', 'a', 'r', 't', 'c', 'h', 'e', 'c', 'k', '.', 'g', 'o', 'v', '\0', /* "smartcleaningcenter.nl", false */ 's', 'm', 'a', 'r', 't', 'c', 'l', 'e', 'a', 'n', 'i', 'n', 'g', 'c', 'e', 'n', 't', 'e', 'r', '.', 'n', 'l', '\0', @@ -12818,7 +12819,6 @@ static const char kSTSHostTable[] = { /* "smartviewing.com", true */ 's', 'm', 'a', 'r', 't', 'v', 'i', 'e', 'w', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "smartwelve.com", true */ 's', 'm', 'a', 'r', 't', 'w', 'e', 'l', 'v', 'e', '.', 'c', 'o', 'm', '\0', /* "smartwurk.nl", true */ 's', 'm', 'a', 'r', 't', 'w', 'u', 'r', 'k', '.', 'n', 'l', '\0', - /* "smatch.com", true */ 's', 'm', 'a', 't', 'c', 'h', '.', 'c', 'o', 'm', '\0', /* "smb445.com", true */ 's', 'm', 'b', '4', '4', '5', '.', 'c', 'o', 'm', '\0', /* "smdavis.us", true */ 's', 'm', 'd', 'a', 'v', 'i', 's', '.', 'u', 's', '\0', /* "smdcn.net", true */ 's', 'm', 'd', 'c', 'n', '.', 'n', 'e', 't', '\0', @@ -12968,9 +12968,10 @@ static const char kSTSHostTable[] = { /* "sorenstudios.com", true */ 's', 'o', 'r', 'e', 'n', 's', 't', 'u', 'd', 'i', 'o', 's', '.', 'c', 'o', 'm', '\0', /* "sorincocorada.ro", true */ 's', 'o', 'r', 'i', 'n', 'c', 'o', 'c', 'o', 'r', 'a', 'd', 'a', '.', 'r', 'o', '\0', /* "sorn.service.gov.uk", true */ 's', 'o', 'r', 'n', '.', 's', 'e', 'r', 'v', 'i', 'c', 'e', '.', 'g', 'o', 'v', '.', 'u', 'k', '\0', + /* "sortaweird.net", true */ 's', 'o', 'r', 't', 'a', 'w', 'e', 'i', 'r', 'd', '.', 'n', 'e', 't', '\0', /* "soruly.com", true */ 's', 'o', 'r', 'u', 'l', 'y', '.', 'c', 'o', 'm', '\0', /* "sorz.org", true */ 's', 'o', 'r', 'z', '.', 'o', 'r', 'g', '\0', - /* "sos.sk", true */ 's', 'o', 's', '.', 's', 'k', '\0', + /* "sos.sk", false */ 's', 'o', 's', '.', 's', 'k', '\0', /* "sosaka.ml", true */ 's', 'o', 's', 'a', 'k', 'a', '.', 'm', 'l', '\0', /* "sosecu.red", true */ 's', 'o', 's', 'e', 'c', 'u', '.', 'r', 'e', 'd', '\0', /* "sostacancun.com", true */ 's', 'o', 's', 't', 'a', 'c', 'a', 'n', 'c', 'u', 'n', '.', 'c', 'o', 'm', '\0', @@ -13444,7 +13445,6 @@ static const char kSTSHostTable[] = { /* "suwalls.com", true */ 's', 'u', 'w', 'a', 'l', 'l', 's', '.', 'c', 'o', 'm', '\0', /* "sv-turm-hohenlimburg.de", true */ 's', 'v', '-', 't', 'u', 'r', 'm', '-', 'h', 'o', 'h', 'e', 'n', 'l', 'i', 'm', 'b', 'u', 'r', 'g', '.', 'd', 'e', '\0', /* "svager.cz", true */ 's', 'v', 'a', 'g', 'e', 'r', '.', 'c', 'z', '\0', - /* "svarovani.tk", true */ 's', 'v', 'a', 'r', 'o', 'v', 'a', 'n', 'i', '.', 't', 'k', '\0', /* "svendubbeld.nl", true */ 's', 'v', 'e', 'n', 'd', 'u', 'b', 'b', 'e', 'l', 'd', '.', 'n', 'l', '\0', /* "sveneckelmann.de", true */ 's', 'v', 'e', 'n', 'e', 'c', 'k', 'e', 'l', 'm', 'a', 'n', 'n', '.', 'd', 'e', '\0', /* "svenluijten.com", true */ 's', 'v', 'e', 'n', 'l', 'u', 'i', 'j', 't', 'e', 'n', '.', 'c', 'o', 'm', '\0', @@ -13652,6 +13652,7 @@ static const char kSTSHostTable[] = { /* "teambeoplay.co.uk", true */ 't', 'e', 'a', 'm', 'b', 'e', 'o', 'p', 'l', 'a', 'y', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "teamblueridge.org", true */ 't', 'e', 'a', 'm', 'b', 'l', 'u', 'e', 'r', 'i', 'd', 'g', 'e', '.', 'o', 'r', 'g', '\0', /* "teamdaylo.xyz", true */ 't', 'e', 'a', 'm', 'd', 'a', 'y', 'l', 'o', '.', 'x', 'y', 'z', '\0', + /* "teamhood.io", true */ 't', 'e', 'a', 'm', 'h', 'o', 'o', 'd', '.', 'i', 'o', '\0', /* "teamnetsol.com", true */ 't', 'e', 'a', 'm', 'n', 'e', 't', 's', 'o', 'l', '.', 'c', 'o', 'm', '\0', /* "teamnorthgermany.de", true */ 't', 'e', 'a', 'm', 'n', 'o', 'r', 't', 'h', 'g', 'e', 'r', 'm', 'a', 'n', 'y', '.', 'd', 'e', '\0', /* "teampaddymurphy.ch", true */ 't', 'e', 'a', 'm', 'p', 'a', 'd', 'd', 'y', 'm', 'u', 'r', 'p', 'h', 'y', '.', 'c', 'h', '\0', @@ -13695,7 +13696,6 @@ static const char kSTSHostTable[] = { /* "techwords.io", true */ 't', 'e', 'c', 'h', 'w', 'o', 'r', 'd', 's', '.', 'i', 'o', '\0', /* "tecnogaming.com", true */ 't', 'e', 'c', 'n', 'o', 'g', 'a', 'm', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "tecture.de", true */ 't', 'e', 'c', 't', 'u', 'r', 'e', '.', 'd', 'e', '\0', - /* "tedb.us", true */ 't', 'e', 'd', 'b', '.', 'u', 's', '\0', /* "teddy.ch", true */ 't', 'e', 'd', 'd', 'y', '.', 'c', 'h', '\0', /* "tedeh.net", true */ 't', 'e', 'd', 'e', 'h', '.', 'n', 'e', 't', '\0', /* "tedovo.com", true */ 't', 'e', 'd', 'o', 'v', 'o', '.', 'c', 'o', 'm', '\0', @@ -13721,7 +13721,6 @@ static const char kSTSHostTable[] = { /* "teleogistic.net", true */ 't', 'e', 'l', 'e', 'o', 'g', 'i', 's', 't', 'i', 'c', '.', 'n', 'e', 't', '\0', /* "telepass.me", true */ 't', 'e', 'l', 'e', 'p', 'a', 's', 's', '.', 'm', 'e', '\0', /* "telescam.com", true */ 't', 'e', 'l', 'e', 's', 'c', 'a', 'm', '.', 'c', 'o', 'm', '\0', - /* "telling.xyz", true */ 't', 'e', 'l', 'l', 'i', 'n', 'g', '.', 'x', 'y', 'z', '\0', /* "tellingua.com", true */ 't', 'e', 'l', 'l', 'i', 'n', 'g', 'u', 'a', '.', 'c', 'o', 'm', '\0', /* "teloo.pl", true */ 't', 'e', 'l', 'o', 'o', '.', 'p', 'l', '\0', /* "temizmama.com", true */ 't', 'e', 'm', 'i', 'z', 'm', 'a', 'm', 'a', '.', 'c', 'o', 'm', '\0', @@ -13781,6 +13780,7 @@ static const char kSTSHostTable[] = { /* "texy.info", true */ 't', 'e', 'x', 'y', '.', 'i', 'n', 'f', 'o', '\0', /* "tf-network.de", true */ 't', 'f', '-', 'n', 'e', 't', 'w', 'o', 'r', 'k', '.', 'd', 'e', '\0', /* "tf2b.com", true */ 't', 'f', '2', 'b', '.', 'c', 'o', 'm', '\0', + /* "tffans.com", false */ 't', 'f', 'f', 'a', 'n', 's', '.', 'c', 'o', 'm', '\0', /* "tflite.com", true */ 't', 'f', 'l', 'i', 't', 'e', '.', 'c', 'o', 'm', '\0', /* "tfnapps.de", true */ 't', 'f', 'n', 'a', 'p', 'p', 's', '.', 'd', 'e', '\0', /* "tgbyte.com", true */ 't', 'g', 'b', 'y', 't', 'e', '.', 'c', 'o', 'm', '\0', @@ -13834,7 +13834,6 @@ static const char kSTSHostTable[] = { /* "theflyingbear.net", true */ 't', 'h', 'e', 'f', 'l', 'y', 'i', 'n', 'g', 'b', 'e', 'a', 'r', '.', 'n', 'e', 't', '\0', /* "thefox.co", true */ 't', 'h', 'e', 'f', 'o', 'x', '.', 'c', 'o', '\0', /* "thefreebirds.in", true */ 't', 'h', 'e', 'f', 'r', 'e', 'e', 'b', 'i', 'r', 'd', 's', '.', 'i', 'n', '\0', - /* "thego2swatking.com", false */ 't', 'h', 'e', 'g', 'o', '2', 's', 'w', 'a', 't', 'k', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', /* "thegoldregister.co.uk", true */ 't', 'h', 'e', 'g', 'o', 'l', 'd', 'r', 'e', 'g', 'i', 's', 't', 'e', 'r', '.', 'c', 'o', '.', 'u', 'k', '\0', /* "thegraciousgourmet.com", true */ 't', 'h', 'e', 'g', 'r', 'a', 'c', 'i', 'o', 'u', 's', 'g', 'o', 'u', 'r', 'm', 'e', 't', '.', 'c', 'o', 'm', '\0', /* "thegrape.ro", true */ 't', 'h', 'e', 'g', 'r', 'a', 'p', 'e', '.', 'r', 'o', '\0', @@ -14493,6 +14492,7 @@ static const char kSTSHostTable[] = { /* "typeria.net", true */ 't', 'y', 'p', 'e', 'r', 'i', 'a', '.', 'n', 'e', 't', '\0', /* "typewolf.com", true */ 't', 'y', 'p', 'e', 'w', 'o', 'l', 'f', '.', 'c', 'o', 'm', '\0', /* "typing.com", true */ 't', 'y', 'p', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', + /* "typingrevolution.com", true */ 't', 'y', 'p', 'i', 'n', 'g', 'r', 'e', 'v', 'o', 'l', 'u', 't', 'i', 'o', 'n', '.', 'c', 'o', 'm', '\0', /* "typo3.com", true */ 't', 'y', 'p', 'o', '3', '.', 'c', 'o', 'm', '\0', /* "tysye.ca", true */ 't', 'y', 's', 'y', 'e', '.', 'c', 'a', '\0', /* "tzwe.com", true */ 't', 'z', 'w', 'e', '.', 'c', 'o', 'm', '\0', @@ -14509,7 +14509,6 @@ static const char kSTSHostTable[] = { /* "ubertt.org", true */ 'u', 'b', 'e', 'r', 't', 't', '.', 'o', 'r', 'g', '\0', /* "uberwald.de", true */ 'u', 'b', 'e', 'r', 'w', 'a', 'l', 'd', '.', 'd', 'e', '\0', /* "uberwald.ws", true */ 'u', 'b', 'e', 'r', 'w', 'a', 'l', 'd', '.', 'w', 's', '\0', - /* "ubtce.com", true */ 'u', 'b', 't', 'c', 'e', '.', 'c', 'o', 'm', '\0', /* "ucfirst.nl", true */ 'u', 'c', 'f', 'i', 'r', 's', 't', '.', 'n', 'l', '\0', /* "uctarna.online", true */ 'u', 'c', 't', 'a', 'r', 'n', 'a', '.', 'o', 'n', 'l', 'i', 'n', 'e', '\0', /* "udbhav.me", true */ 'u', 'd', 'b', 'h', 'a', 'v', '.', 'm', 'e', '\0', @@ -14757,7 +14756,6 @@ static const char kSTSHostTable[] = { /* "vapehour.com", true */ 'v', 'a', 'p', 'e', 'h', 'o', 'u', 'r', '.', 'c', 'o', 'm', '\0', /* "vapemania.eu", true */ 'v', 'a', 'p', 'e', 'm', 'a', 'n', 'i', 'a', '.', 'e', 'u', '\0', /* "vapeshopsupply.com", true */ 'v', 'a', 'p', 'e', 's', 'h', 'o', 'p', 's', 'u', 'p', 'p', 'l', 'y', '.', 'c', 'o', 'm', '\0', - /* "vapordepot.jp", false */ 'v', 'a', 'p', 'o', 'r', 'd', 'e', 'p', 'o', 't', '.', 'j', 'p', '\0', /* "varden.info", true */ 'v', 'a', 'r', 'd', 'e', 'n', '.', 'i', 'n', 'f', 'o', '\0', /* "varghese.de", true */ 'v', 'a', 'r', 'g', 'h', 'e', 's', 'e', '.', 'd', 'e', '\0', /* "variag-group.ru", true */ 'v', 'a', 'r', 'i', 'a', 'g', '-', 'g', 'r', 'o', 'u', 'p', '.', 'r', 'u', '\0', @@ -14791,7 +14789,6 @@ static const char kSTSHostTable[] = { /* "vdesc.com", true */ 'v', 'd', 'e', 's', 'c', '.', 'c', 'o', 'm', '\0', /* "vdhco.be", true */ 'v', 'd', 'h', 'c', 'o', '.', 'b', 'e', '\0', /* "vdownloader.com", true */ 'v', 'd', 'o', 'w', 'n', 'l', 'o', 'a', 'd', 'e', 'r', '.', 'c', 'o', 'm', '\0', - /* "vdrpro.com", true */ 'v', 'd', 'r', 'p', 'r', 'o', '.', 'c', 'o', 'm', '\0', /* "ve.search.yahoo.com", false */ 'v', 'e', '.', 's', 'e', 'a', 'r', 'c', 'h', '.', 'y', 'a', 'h', 'o', 'o', '.', 'c', 'o', 'm', '\0', /* "ve3oat.ca", true */ 'v', 'e', '3', 'o', 'a', 't', '.', 'c', 'a', '\0', /* "vea.re", true */ 'v', 'e', 'a', '.', 'r', 'e', '\0', @@ -14866,6 +14863,7 @@ static const char kSTSHostTable[] = { /* "vide-maisons.org", false */ 'v', 'i', 'd', 'e', '-', 'm', 'a', 'i', 's', 'o', 'n', 's', '.', 'o', 'r', 'g', '\0', /* "videogamesartwork.com", true */ 'v', 'i', 'd', 'e', 'o', 'g', 'a', 'm', 'e', 's', 'a', 'r', 't', 'w', 'o', 'r', 'k', '.', 'c', 'o', 'm', '\0', /* "videomail.io", true */ 'v', 'i', 'd', 'e', 'o', 'm', 'a', 'i', 'l', '.', 'i', 'o', '\0', + /* "videosqr.com", true */ 'v', 'i', 'd', 'e', 'o', 's', 'q', 'r', '.', 'c', 'o', 'm', '\0', /* "videotogel.net", false */ 'v', 'i', 'd', 'e', 'o', 't', 'o', 'g', 'e', 'l', '.', 'n', 'e', 't', '\0', /* "vidid.net", false */ 'v', 'i', 'd', 'i', 'd', '.', 'n', 'e', 't', '\0', /* "vieclam24h.vn", false */ 'v', 'i', 'e', 'c', 'l', 'a', 'm', '2', '4', 'h', '.', 'v', 'n', '\0', @@ -14894,6 +14892,7 @@ static const char kSTSHostTable[] = { /* "villenvinkit.com", true */ 'v', 'i', 'l', 'l', 'e', 'n', 'v', 'i', 'n', 'k', 'i', 't', '.', 'c', 'o', 'm', '\0', /* "vimeo.com", true */ 'v', 'i', 'm', 'e', 'o', '.', 'c', 'o', 'm', '\0', /* "vinagro.sk", true */ 'v', 'i', 'n', 'a', 'g', 'r', 'o', '.', 's', 'k', '\0', + /* "vinasec.se", true */ 'v', 'i', 'n', 'a', 's', 'e', 'c', '.', 's', 'e', '\0', /* "vincentcox.com", false */ 'v', 'i', 'n', 'c', 'e', 'n', 't', 'c', 'o', 'x', '.', 'c', 'o', 'm', '\0', /* "vinciconps4.it", true */ 'v', 'i', 'n', 'c', 'i', 'c', 'o', 'n', 'p', 's', '4', '.', 'i', 't', '\0', /* "vincitraining.com", true */ 'v', 'i', 'n', 'c', 'i', 't', 'r', 'a', 'i', 'n', 'i', 'n', 'g', '.', 'c', 'o', 'm', '\0', @@ -14911,6 +14910,7 @@ static const char kSTSHostTable[] = { /* "vipnettikasinoklubi.com", true */ 'v', 'i', 'p', 'n', 'e', 't', 't', 'i', 'k', 'a', 's', 'i', 'n', 'o', 'k', 'l', 'u', 'b', 'i', '.', 'c', 'o', 'm', '\0', /* "virginiacrimeanalysisnetwork.org", true */ 'v', 'i', 'r', 'g', 'i', 'n', 'i', 'a', 'c', 'r', 'i', 'm', 'e', 'a', 'n', 'a', 'l', 'y', 's', 'i', 's', 'n', 'e', 't', 'w', 'o', 'r', 'k', '.', 'o', 'r', 'g', '\0', /* "virtualdesignmedia.com", false */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 'd', 'e', 's', 'i', 'g', 'n', 'm', 'e', 'd', 'i', 'a', '.', 'c', 'o', 'm', '\0', + /* "virtuallifestyle.nl", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 'l', 'i', 'f', 'e', 's', 't', 'y', 'l', 'e', '.', 'n', 'l', '\0', /* "virtualperez.com", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 'p', 'e', 'r', 'e', 'z', '.', 'c', 'o', 'm', '\0', /* "virtualsanity.com", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 's', 'a', 'n', 'i', 't', 'y', '.', 'c', 'o', 'm', '\0', /* "virtualstrongbox.ca", true */ 'v', 'i', 'r', 't', 'u', 'a', 'l', 's', 't', 'r', 'o', 'n', 'g', 'b', 'o', 'x', '.', 'c', 'a', '\0', @@ -14968,6 +14968,7 @@ static const char kSTSHostTable[] = { /* "vnvisa.ru", true */ 'v', 'n', 'v', 'i', 's', 'a', '.', 'r', 'u', '\0', /* "vocab.guru", true */ 'v', 'o', 'c', 'a', 'b', '.', 'g', 'u', 'r', 'u', '\0', /* "vocaloid.my", true */ 'v', 'o', 'c', 'a', 'l', 'o', 'i', 'd', '.', 'm', 'y', '\0', + /* "vodpay.com", true */ 'v', 'o', 'd', 'p', 'a', 'y', '.', 'c', 'o', 'm', '\0', /* "vogler.name", true */ 'v', 'o', 'g', 'l', 'e', 'r', '.', 'n', 'a', 'm', 'e', '\0', /* "vogt.tech", true */ 'v', 'o', 'g', 't', '.', 't', 'e', 'c', 'h', '\0', /* "voidi.ca", true */ 'v', 'o', 'i', 'd', 'i', '.', 'c', 'a', '\0', @@ -15310,6 +15311,7 @@ static const char kSTSHostTable[] = { /* "whisp.ly", false */ 'w', 'h', 'i', 's', 'p', '.', 'l', 'y', '\0', /* "whispeer.de", true */ 'w', 'h', 'i', 's', 'p', 'e', 'e', 'r', '.', 'd', 'e', '\0', /* "whistleb.com", true */ 'w', 'h', 'i', 's', 't', 'l', 'e', 'b', '.', 'c', 'o', 'm', '\0', + /* "whistleblower.gov", true */ 'w', 'h', 'i', 's', 't', 'l', 'e', 'b', 'l', 'o', 'w', 'e', 'r', '.', 'g', 'o', 'v', '\0', /* "whitehouse.gov", true */ 'w', 'h', 'i', 't', 'e', 'h', 'o', 'u', 's', 'e', '.', 'g', 'o', 'v', '\0', /* "whitelabelcashback.nl", true */ 'w', 'h', 'i', 't', 'e', 'l', 'a', 'b', 'e', 'l', 'c', 'a', 's', 'h', 'b', 'a', 'c', 'k', '.', 'n', 'l', '\0', /* "whiteroom.agency", true */ 'w', 'h', 'i', 't', 'e', 'r', 'o', 'o', 'm', '.', 'a', 'g', 'e', 'n', 'c', 'y', '\0', @@ -15368,6 +15370,7 @@ static const char kSTSHostTable[] = { /* "willi-graf-os.de", true */ 'w', 'i', 'l', 'l', 'i', '-', 'g', 'r', 'a', 'f', '-', 'o', 's', '.', 'd', 'e', '\0', /* "williamfeely.info", true */ 'w', 'i', 'l', 'l', 'i', 'a', 'm', 'f', 'e', 'e', 'l', 'y', '.', 'i', 'n', 'f', 'o', '\0', /* "williamsapiens.com", true */ 'w', 'i', 'l', 'l', 'i', 'a', 'm', 's', 'a', 'p', 'i', 'e', 'n', 's', '.', 'c', 'o', 'm', '\0', + /* "williamsonshore.com", true */ 'w', 'i', 'l', 'l', 'i', 'a', 'm', 's', 'o', 'n', 's', 'h', 'o', 'r', 'e', '.', 'c', 'o', 'm', '\0', /* "willnorris.com", true */ 'w', 'i', 'l', 'l', 'n', 'o', 'r', 'r', 'i', 's', '.', 'c', 'o', 'm', '\0', /* "wills.co.tt", true */ 'w', 'i', 'l', 'l', 's', '.', 'c', 'o', '.', 't', 't', '\0', /* "willstamper.name", true */ 'w', 'i', 'l', 'l', 's', 't', 'a', 'm', 'p', 'e', 'r', '.', 'n', 'a', 'm', 'e', '\0', @@ -15426,7 +15429,6 @@ static const char kSTSHostTable[] = { /* "wodka-division.de", true */ 'w', 'o', 'd', 'k', 'a', '-', 'd', 'i', 'v', 'i', 's', 'i', 'o', 'n', '.', 'd', 'e', '\0', /* "wofford-ecs.org", true */ 'w', 'o', 'f', 'f', 'o', 'r', 'd', '-', 'e', 'c', 's', '.', 'o', 'r', 'g', '\0', /* "woffs.de", true */ 'w', 'o', 'f', 'f', 's', '.', 'd', 'e', '\0', - /* "wohlgemuth.rocks", false */ 'w', 'o', 'h', 'l', 'g', 'e', 'm', 'u', 't', 'h', '.', 'r', 'o', 'c', 'k', 's', '\0', /* "wohnsitz-ausland.com", true */ 'w', 'o', 'h', 'n', 's', 'i', 't', 'z', '-', 'a', 'u', 's', 'l', 'a', 'n', 'd', '.', 'c', 'o', 'm', '\0', /* "wolfachtal-alpaka.de", true */ 'w', 'o', 'l', 'f', 'a', 'c', 'h', 't', 'a', 'l', '-', 'a', 'l', 'p', 'a', 'k', 'a', '.', 'd', 'e', '\0', /* "wolfemg.com", true */ 'w', 'o', 'l', 'f', 'e', 'm', 'g', '.', 'c', 'o', 'm', '\0', @@ -15448,6 +15450,7 @@ static const char kSTSHostTable[] = { /* "woodbury.io", true */ 'w', 'o', 'o', 'd', 'b', 'u', 'r', 'y', '.', 'i', 'o', '\0', /* "woodlandschurch.net", true */ 'w', 'o', 'o', 'd', 'l', 'a', 'n', 'd', 's', 'c', 'h', 'u', 'r', 'c', 'h', '.', 'n', 'e', 't', '\0', /* "woodlandsmetro.church", true */ 'w', 'o', 'o', 'd', 'l', 'a', 'n', 'd', 's', 'm', 'e', 't', 'r', 'o', '.', 'c', 'h', 'u', 'r', 'c', 'h', '\0', + /* "woodomat.com", true */ 'w', 'o', 'o', 'd', 'o', 'm', 'a', 't', '.', 'c', 'o', 'm', '\0', /* "woodsidepottery.ca", true */ 'w', 'o', 'o', 'd', 's', 'i', 'd', 'e', 'p', 'o', 't', 't', 'e', 'r', 'y', '.', 'c', 'a', '\0', /* "woohooyeah.nl", true */ 'w', 'o', 'o', 'h', 'o', 'o', 'y', 'e', 'a', 'h', '.', 'n', 'l', '\0', /* "woontegelwinkel.nl", true */ 'w', 'o', 'o', 'n', 't', 'e', 'g', 'e', 'l', 'w', 'i', 'n', 'k', 'e', 'l', '.', 'n', 'l', '\0', @@ -15458,6 +15461,7 @@ static const char kSTSHostTable[] = { /* "wordsmart.it", true */ 'w', 'o', 'r', 'd', 's', 'm', 'a', 'r', 't', '.', 'i', 't', '\0', /* "wordxtra.net", true */ 'w', 'o', 'r', 'd', 'x', 't', 'r', 'a', '.', 'n', 'e', 't', '\0', /* "work-and-jockel.de", true */ 'w', 'o', 'r', 'k', '-', 'a', 'n', 'd', '-', 'j', 'o', 'c', 'k', 'e', 'l', '.', 'd', 'e', '\0', + /* "workingclassmedia.com", true */ 'w', 'o', 'r', 'k', 'i', 'n', 'g', 'c', 'l', 'a', 's', 's', 'm', 'e', 'd', 'i', 'a', '.', 'c', 'o', 'm', '\0', /* "workpermit.com.vn", true */ 'w', 'o', 'r', 'k', 'p', 'e', 'r', 'm', 'i', 't', '.', 'c', 'o', 'm', '.', 'v', 'n', '\0', /* "workray.com", true */ 'w', 'o', 'r', 'k', 'r', 'a', 'y', '.', 'c', 'o', 'm', '\0', /* "works-ginan.jp", true */ 'w', 'o', 'r', 'k', 's', '-', 'g', 'i', 'n', 'a', 'n', '.', 'j', 'p', '\0', @@ -15688,6 +15692,7 @@ static const char kSTSHostTable[] = { /* "xn--4dbjwf8c.ml", true */ 'x', 'n', '-', '-', '4', 'd', 'b', 'j', 'w', 'f', '8', 'c', '.', 'm', 'l', '\0', /* "xn--7v8h.cf", true */ 'x', 'n', '-', '-', '7', 'v', '8', 'h', '.', 'c', 'f', '\0', /* "xn--7xa.google.com", true */ 'x', 'n', '-', '-', '7', 'x', 'a', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm', '\0', + /* "xn--80aocgsfei.xn--p1ai", true */ 'x', 'n', '-', '-', '8', '0', 'a', 'o', 'c', 'g', 's', 'f', 'e', 'i', '.', 'x', 'n', '-', '-', 'p', '1', 'a', 'i', '\0', /* "xn--8mr166hf6s.xn--fiqs8s", true */ 'x', 'n', '-', '-', '8', 'm', 'r', '1', '6', '6', 'h', 'f', '6', 's', '.', 'x', 'n', '-', '-', 'f', 'i', 'q', 's', '8', 's', '\0', /* "xn--allgu-biker-o8a.de", true */ 'x', 'n', '-', '-', 'a', 'l', 'l', 'g', 'u', '-', 'b', 'i', 'k', 'e', 'r', '-', 'o', '8', 'a', '.', 'd', 'e', '\0', /* "xn--aviao-dra1a.pt", true */ 'x', 'n', '-', '-', 'a', 'v', 'i', 'a', 'o', '-', 'd', 'r', 'a', '1', 'a', '.', 'p', 't', '\0', @@ -15763,7 +15768,6 @@ static const char kSTSHostTable[] = { /* "yakmade.com", true */ 'y', 'a', 'k', 'm', 'a', 'd', 'e', '.', 'c', 'o', 'm', '\0', /* "yakmoo.se", true */ 'y', 'a', 'k', 'm', 'o', 'o', '.', 's', 'e', '\0', /* "yal.sh", true */ 'y', 'a', 'l', '.', 's', 'h', '\0', - /* "yalook.com", true */ 'y', 'a', 'l', 'o', 'o', 'k', '.', 'c', 'o', 'm', '\0', /* "yamadaya.tv", true */ 'y', 'a', 'm', 'a', 'd', 'a', 'y', 'a', '.', 't', 'v', '\0', /* "yame2.com", true */ 'y', 'a', 'm', 'e', '2', '.', 'c', 'o', 'm', '\0', /* "yameveo.com", false */ 'y', 'a', 'm', 'e', 'v', 'e', 'o', '.', 'c', 'o', 'm', '\0', @@ -15797,6 +15801,7 @@ static const char kSTSHostTable[] = { /* "yetzt.me", false */ 'y', 'e', 't', 'z', 't', '.', 'm', 'e', '\0', /* "yeu.io", true */ 'y', 'e', 'u', '.', 'i', 'o', '\0', /* "yhaupenthal.org", true */ 'y', 'h', 'a', 'u', 'p', 'e', 'n', 't', 'h', 'a', 'l', '.', 'o', 'r', 'g', '\0', + /* "yhb.io", true */ 'y', 'h', 'b', '.', 'i', 'o', '\0', /* "yhori.xyz", true */ 'y', 'h', 'o', 'r', 'i', '.', 'x', 'y', 'z', '\0', /* "yhrd.org", true */ 'y', 'h', 'r', 'd', '.', 'o', 'r', 'g', '\0', /* "yii2.cc", true */ 'y', 'i', 'i', '2', '.', 'c', 'c', '\0', @@ -15918,6 +15923,7 @@ static const char kSTSHostTable[] = { /* "zaoshanghao-dajia.rhcloud.com", true */ 'z', 'a', 'o', 's', 'h', 'a', 'n', 'g', 'h', 'a', 'o', '-', 'd', 'a', 'j', 'i', 'a', '.', 'r', 'h', 'c', 'l', 'o', 'u', 'd', '.', 'c', 'o', 'm', '\0', /* "zapier.com", true */ 'z', 'a', 'p', 'i', 'e', 'r', '.', 'c', 'o', 'm', '\0', /* "zappbuildapps.com", true */ 'z', 'a', 'p', 'p', 'b', 'u', 'i', 'l', 'd', 'a', 'p', 'p', 's', '.', 'c', 'o', 'm', '\0', + /* "zary.me", true */ 'z', 'a', 'r', 'y', '.', 'm', 'e', '\0', /* "zaufanatrzeciastrona.pl", true */ 'z', 'a', 'u', 'f', 'a', 'n', 'a', 't', 'r', 'z', 'e', 'c', 'i', 'a', 's', 't', 'r', 'o', 'n', 'a', '.', 'p', 'l', '\0', /* "zavca.com", true */ 'z', 'a', 'v', 'c', 'a', '.', 'c', 'o', 'm', '\0', /* "zbasenem.pl", true */ 'z', 'b', 'a', 's', 'e', 'n', 'e', 'm', '.', 'p', 'l', '\0', @@ -16055,6 +16061,7 @@ static const char kSTSHostTable[] = { /* "zunftmarke.de", true */ 'z', 'u', 'n', 'f', 't', 'm', 'a', 'r', 'k', 'e', '.', 'd', 'e', '\0', /* "zup.me", true */ 'z', 'u', 'p', '.', 'm', 'e', '\0', /* "zupago.com", true */ 'z', 'u', 'p', 'a', 'g', 'o', '.', 'c', 'o', 'm', '\0', + /* "zupago.pe", true */ 'z', 'u', 'p', 'a', 'g', 'o', '.', 'p', 'e', '\0', /* "zuram.net", true */ 'z', 'u', 'r', 'a', 'm', '.', 'n', 'e', 't', '\0', /* "zuviel.space", true */ 'z', 'u', 'v', 'i', 'e', 'l', '.', 's', 'p', 'a', 'c', 'e', '\0', /* "zvps.uk", true */ 'z', 'v', 'p', 's', '.', 'u', 'k', '\0', @@ -16516,41 +16523,41 @@ static const nsSTSPreload kSTSPreloadList[] = { { 5749, false }, { 5761, true }, { 5780, true }, - { 5788, false }, - { 5804, true }, - { 5822, true }, - { 5837, true }, - { 5848, true }, - { 5861, true }, - { 5869, true }, - { 5883, true }, - { 5895, true }, - { 5905, false }, - { 5918, true }, - { 5930, true }, - { 5942, true }, - { 5952, true }, - { 5960, true }, - { 5970, true }, - { 5984, true }, - { 5997, true }, - { 6009, true }, - { 6028, true }, - { 6047, true }, - { 6057, true }, - { 6090, true }, - { 6100, true }, - { 6114, true }, - { 6121, true }, + { 5797, true }, + { 5805, false }, + { 5821, true }, + { 5839, true }, + { 5854, true }, + { 5865, true }, + { 5878, true }, + { 5886, true }, + { 5900, true }, + { 5912, true }, + { 5922, false }, + { 5935, true }, + { 5947, true }, + { 5959, true }, + { 5969, true }, + { 5977, true }, + { 5987, true }, + { 6001, true }, + { 6014, true }, + { 6026, true }, + { 6045, true }, + { 6064, true }, + { 6074, true }, + { 6107, true }, + { 6117, true }, + { 6131, true }, { 6138, true }, - { 6154, true }, - { 6163, true }, - { 6170, true }, - { 6184, true }, - { 6192, true }, - { 6203, true }, - { 6218, true }, - { 6233, true }, + { 6155, true }, + { 6171, true }, + { 6180, true }, + { 6187, true }, + { 6201, true }, + { 6209, true }, + { 6220, true }, + { 6235, true }, { 6250, true }, { 6263, true }, { 6273, true }, @@ -16607,4329 +16614,4326 @@ static const nsSTSPreload kSTSPreloadList[] = { { 6995, true }, { 7007, true }, { 7019, true }, - { 7031, true }, - { 7050, true }, - { 7063, true }, - { 7074, true }, - { 7083, true }, - { 7101, true }, - { 7115, true }, - { 7129, true }, - { 7145, true }, - { 7161, true }, - { 7181, true }, - { 7202, true }, - { 7216, true }, - { 7229, true }, - { 7244, true }, - { 7254, true }, - { 7272, true }, - { 7287, true }, - { 7305, true }, - { 7315, true }, - { 7330, true }, - { 7348, true }, - { 7362, true }, - { 7376, true }, - { 7390, true }, - { 7402, true }, - { 7417, true }, - { 7431, true }, - { 7446, true }, - { 7456, true }, - { 7470, true }, - { 7485, true }, - { 7499, true }, - { 7513, true }, - { 7529, true }, - { 7541, true }, - { 7554, true }, - { 7565, false }, - { 7580, true }, - { 7607, true }, - { 7619, true }, - { 7634, true }, - { 7648, true }, - { 7670, true }, - { 7682, true }, - { 7705, true }, - { 7726, true }, - { 7738, true }, - { 7751, true }, - { 7763, true }, - { 7776, true }, - { 7791, true }, - { 7802, false }, - { 7818, true }, - { 7829, true }, - { 7841, true }, - { 7854, true }, + { 7032, true }, + { 7043, true }, + { 7052, true }, + { 7070, true }, + { 7084, true }, + { 7098, true }, + { 7114, true }, + { 7130, true }, + { 7150, true }, + { 7171, true }, + { 7185, true }, + { 7198, true }, + { 7213, true }, + { 7223, true }, + { 7241, true }, + { 7256, true }, + { 7274, true }, + { 7284, true }, + { 7299, true }, + { 7317, true }, + { 7331, true }, + { 7345, true }, + { 7359, true }, + { 7371, true }, + { 7386, true }, + { 7400, true }, + { 7415, true }, + { 7425, true }, + { 7439, true }, + { 7454, true }, + { 7468, true }, + { 7482, true }, + { 7498, true }, + { 7510, true }, + { 7523, true }, + { 7534, false }, + { 7549, true }, + { 7576, true }, + { 7588, true }, + { 7603, true }, + { 7617, true }, + { 7639, true }, + { 7651, true }, + { 7674, true }, + { 7695, true }, + { 7707, true }, + { 7720, true }, + { 7732, true }, + { 7745, true }, + { 7760, true }, + { 7771, false }, + { 7787, true }, + { 7798, true }, + { 7810, true }, + { 7823, true }, + { 7843, true }, + { 7856, true }, { 7874, true }, - { 7887, true }, - { 7905, true }, - { 7922, true }, - { 7946, true }, - { 7965, true }, - { 7979, true }, - { 7995, true }, - { 8011, true }, - { 8030, true }, - { 8043, true }, - { 8064, true }, - { 8084, true }, - { 8104, true }, - { 8120, true }, - { 8133, false }, - { 8146, true }, - { 8158, true }, - { 8168, true }, - { 8181, true }, - { 8195, true }, - { 8211, true }, - { 8225, true }, - { 8241, true }, - { 8253, true }, - { 8267, true }, - { 8278, true }, - { 8297, true }, - { 8310, true }, - { 8324, true }, - { 8332, true }, - { 8345, true }, + { 7891, true }, + { 7915, true }, + { 7934, true }, + { 7948, true }, + { 7964, true }, + { 7980, true }, + { 7999, true }, + { 8012, true }, + { 8033, true }, + { 8053, true }, + { 8073, true }, + { 8089, true }, + { 8102, false }, + { 8115, true }, + { 8127, true }, + { 8137, true }, + { 8150, true }, + { 8164, true }, + { 8180, true }, + { 8194, true }, + { 8210, true }, + { 8222, true }, + { 8236, true }, + { 8247, true }, + { 8266, true }, + { 8279, true }, + { 8293, true }, + { 8301, true }, + { 8314, true }, + { 8329, true }, + { 8343, true }, { 8360, true }, - { 8374, true }, + { 8379, true }, { 8391, true }, - { 8410, true }, - { 8422, true }, - { 8436, true }, - { 8458, true }, - { 8472, true }, - { 8484, true }, - { 8512, true }, - { 8527, true }, - { 8539, true }, + { 8405, true }, + { 8427, true }, + { 8441, true }, + { 8453, true }, + { 8481, true }, + { 8496, true }, + { 8508, true }, + { 8519, true }, + { 8530, true }, + { 8542, true }, { 8550, true }, { 8561, true }, - { 8573, true }, - { 8581, true }, - { 8592, true }, - { 8600, true }, - { 8608, true }, - { 8616, true }, - { 8624, true }, - { 8637, true }, - { 8644, true }, - { 8654, true }, - { 8667, true }, - { 8679, true }, - { 8692, true }, - { 8709, true }, - { 8729, true }, - { 8741, true }, - { 8753, true }, - { 8771, true }, - { 8799, true }, - { 8812, true }, - { 8821, true }, - { 8834, true }, - { 8846, true }, - { 8860, true }, - { 8873, true }, + { 8569, true }, + { 8577, true }, + { 8585, true }, + { 8593, true }, + { 8606, true }, + { 8613, true }, + { 8623, true }, + { 8636, true }, + { 8648, true }, + { 8661, true }, + { 8678, true }, + { 8698, true }, + { 8710, true }, + { 8722, true }, + { 8740, true }, + { 8768, true }, + { 8781, true }, + { 8790, true }, + { 8803, true }, + { 8815, true }, + { 8829, true }, + { 8842, true }, + { 8853, true }, + { 8863, true }, + { 8874, true }, { 8884, true }, - { 8894, true }, - { 8905, true }, - { 8915, true }, - { 8926, true }, - { 8935, true }, - { 8951, true }, - { 8967, true }, - { 8995, true }, - { 9014, true }, - { 9029, true }, - { 9049, true }, - { 9061, true }, - { 9073, true }, - { 9086, true }, - { 9095, true }, - { 9104, true }, - { 9123, true }, - { 9134, true }, - { 9145, true }, - { 9160, true }, - { 9180, true }, - { 9198, true }, - { 9208, true }, - { 9225, true }, - { 9236, true }, + { 8895, true }, + { 8911, true }, + { 8927, true }, + { 8955, true }, + { 8974, true }, + { 8989, true }, + { 9009, true }, + { 9021, true }, + { 9033, true }, + { 9046, true }, + { 9055, true }, + { 9064, true }, + { 9083, true }, + { 9094, true }, + { 9109, true }, + { 9129, true }, + { 9147, true }, + { 9157, true }, + { 9174, true }, + { 9185, true }, + { 9195, true }, + { 9209, true }, + { 9226, true }, + { 9235, true }, { 9246, true }, - { 9260, true }, - { 9277, true }, - { 9286, true }, - { 9297, true }, - { 9317, true }, - { 9336, true }, - { 9347, true }, - { 9358, true }, - { 9376, true }, - { 9402, false }, - { 9413, true }, + { 9266, true }, + { 9285, true }, + { 9296, true }, + { 9307, true }, + { 9325, true }, + { 9351, false }, + { 9362, true }, + { 9384, true }, + { 9406, true }, + { 9420, true }, { 9435, true }, - { 9457, true }, - { 9471, true }, - { 9486, true }, - { 9500, true }, - { 9514, true }, - { 9529, true }, - { 9550, true }, - { 9560, true }, - { 9571, true }, - { 9592, true }, - { 9610, true }, - { 9628, true }, - { 9641, true }, - { 9649, true }, + { 9449, true }, + { 9463, true }, + { 9478, true }, + { 9499, true }, + { 9509, true }, + { 9520, true }, + { 9541, true }, + { 9559, true }, + { 9577, true }, + { 9590, true }, + { 9598, true }, + { 9611, true }, + { 9625, true }, + { 9647, true }, { 9662, true }, - { 9676, true }, - { 9698, true }, - { 9713, true }, - { 9730, true }, - { 9752, true }, - { 9767, true }, - { 9784, true }, - { 9805, true }, - { 9821, true }, - { 9848, true }, - { 9864, true }, - { 9879, true }, + { 9679, true }, + { 9701, true }, + { 9716, true }, + { 9733, true }, + { 9754, true }, + { 9770, true }, + { 9797, true }, + { 9813, true }, + { 9830, true }, + { 9845, true }, + { 9859, true }, + { 9876, true }, { 9893, true }, - { 9910, true }, - { 9927, true }, - { 9939, true }, - { 9957, true }, - { 9974, true }, - { 9989, true }, - { 10003, true }, - { 10020, true }, - { 10038, true }, - { 10053, true }, - { 10069, true }, - { 10082, true }, - { 10102, true }, + { 9905, true }, + { 9923, true }, + { 9940, true }, + { 9955, true }, + { 9969, true }, + { 9986, true }, + { 10004, true }, + { 10019, true }, + { 10031, true }, + { 10047, true }, + { 10060, true }, + { 10080, true }, + { 10100, true }, + { 10111, true }, { 10122, true }, { 10133, true }, - { 10144, true }, - { 10155, true }, - { 10170, true }, - { 10181, true }, - { 10198, true }, + { 10148, true }, + { 10159, true }, + { 10176, true }, + { 10192, true }, + { 10203, true }, { 10214, true }, - { 10225, true }, - { 10236, true }, - { 10248, true }, - { 10261, true }, - { 10280, true }, - { 10291, true }, - { 10304, true }, - { 10318, true }, - { 10336, false }, - { 10349, false }, - { 10358, true }, - { 10375, true }, - { 10392, true }, + { 10226, true }, + { 10239, true }, + { 10258, true }, + { 10269, true }, + { 10282, true }, + { 10296, true }, + { 10314, false }, + { 10327, false }, + { 10336, true }, + { 10353, true }, + { 10370, true }, + { 10390, true }, + { 10401, true }, { 10412, true }, - { 10423, true }, - { 10434, true }, - { 10452, true }, - { 10484, true }, + { 10430, true }, + { 10462, true }, + { 10489, true }, + { 10501, true }, { 10511, true }, - { 10523, true }, - { 10533, true }, - { 10551, true }, - { 10566, true }, - { 10578, true }, - { 10590, true }, - { 10610, true }, - { 10629, true }, - { 10649, true }, - { 10672, false }, - { 10696, true }, - { 10708, true }, - { 10719, true }, - { 10731, true }, - { 10743, true }, - { 10759, true }, - { 10776, true }, - { 10795, true }, - { 10809, true }, - { 10820, true }, - { 10836, true }, - { 10855, true }, - { 10868, true }, - { 10881, true }, - { 10893, false }, - { 10917, true }, - { 10933, true }, - { 10949, true }, - { 10961, true }, - { 10977, true }, - { 10994, true }, - { 11008, true }, - { 11023, true }, - { 11038, true }, - { 11049, true }, - { 11067, true }, - { 11083, true }, - { 11104, true }, - { 11118, true }, - { 11133, true }, - { 11143, true }, - { 11156, true }, - { 11173, true }, - { 11186, true }, - { 11199, true }, - { 11215, true }, - { 11226, true }, - { 11238, true }, - { 11249, true }, - { 11256, true }, - { 11264, false }, - { 11275, true }, - { 11286, true }, - { 11299, false }, - { 11307, true }, - { 11317, true }, - { 11324, true }, - { 11338, false }, - { 11352, true }, - { 11368, true }, - { 11382, true }, - { 11412, true }, + { 10529, true }, + { 10544, true }, + { 10556, true }, + { 10568, true }, + { 10588, true }, + { 10607, true }, + { 10627, true }, + { 10650, false }, + { 10674, true }, + { 10686, true }, + { 10697, true }, + { 10709, true }, + { 10721, true }, + { 10737, true }, + { 10754, true }, + { 10773, true }, + { 10787, true }, + { 10798, true }, + { 10814, true }, + { 10833, true }, + { 10846, true }, + { 10859, true }, + { 10871, false }, + { 10895, true }, + { 10911, true }, + { 10927, true }, + { 10939, true }, + { 10955, true }, + { 10972, true }, + { 10986, true }, + { 11001, true }, + { 11016, true }, + { 11027, true }, + { 11045, true }, + { 11061, true }, + { 11082, true }, + { 11096, true }, + { 11111, true }, + { 11121, true }, + { 11134, true }, + { 11151, true }, + { 11164, true }, + { 11177, true }, + { 11193, true }, + { 11204, true }, + { 11216, true }, + { 11227, true }, + { 11234, true }, + { 11242, false }, + { 11253, true }, + { 11264, true }, + { 11277, false }, + { 11285, true }, + { 11295, true }, + { 11302, true }, + { 11316, false }, + { 11330, true }, + { 11346, true }, + { 11360, true }, + { 11369, true }, + { 11399, true }, + { 11422, true }, { 11435, true }, - { 11448, true }, - { 11467, true }, - { 11480, false }, - { 11499, true }, - { 11515, false }, - { 11531, true }, - { 11547, false }, - { 11562, false }, - { 11575, true }, - { 11591, true }, - { 11603, true }, - { 11622, true }, + { 11454, true }, + { 11467, false }, + { 11486, true }, + { 11502, false }, + { 11518, true }, + { 11534, false }, + { 11549, false }, + { 11562, true }, + { 11578, true }, + { 11590, true }, + { 11609, true }, + { 11630, true }, { 11643, true }, { 11656, true }, - { 11669, true }, - { 11679, true }, - { 11690, true }, - { 11701, true }, - { 11715, true }, - { 11731, true }, - { 11748, false }, - { 11765, true }, + { 11666, true }, + { 11677, true }, + { 11688, true }, + { 11702, true }, + { 11718, true }, + { 11735, false }, + { 11752, true }, + { 11778, true }, { 11791, true }, - { 11804, true }, - { 11818, true }, - { 11837, true }, - { 11858, true }, - { 11870, true }, - { 11884, true }, - { 11908, true }, + { 11805, true }, + { 11824, true }, + { 11845, true }, + { 11857, true }, + { 11871, true }, + { 11895, true }, + { 11904, true }, { 11917, true }, { 11930, true }, - { 11943, true }, - { 11957, true }, - { 11968, true }, + { 11944, true }, + { 11955, true }, + { 11964, true }, { 11977, true }, { 11990, true }, - { 12003, true }, - { 12015, true }, - { 12036, false }, - { 12054, true }, - { 12077, true }, - { 12104, true }, - { 12123, true }, - { 12143, true }, - { 12154, true }, - { 12171, true }, - { 12183, true }, - { 12197, true }, - { 12205, true }, + { 12002, true }, + { 12023, false }, + { 12041, true }, + { 12064, true }, + { 12091, true }, + { 12110, true }, + { 12130, true }, + { 12141, true }, + { 12158, true }, + { 12170, true }, + { 12184, true }, + { 12192, true }, + { 12209, true }, { 12222, true }, - { 12235, true }, - { 12247, true }, - { 12265, true }, - { 12288, false }, - { 12304, true }, - { 12310, true }, - { 12322, true }, - { 12332, true }, - { 12344, true }, - { 12355, true }, - { 12365, true }, - { 12382, true }, - { 12401, true }, - { 12413, true }, + { 12234, true }, + { 12252, true }, + { 12275, false }, + { 12291, true }, + { 12297, true }, + { 12309, true }, + { 12319, true }, + { 12331, true }, + { 12342, true }, + { 12352, true }, + { 12369, true }, + { 12388, true }, + { 12400, true }, + { 12412, true }, { 12425, true }, - { 12438, true }, - { 12467, true }, + { 12454, true }, + { 12470, true }, { 12483, true }, - { 12496, true }, - { 12510, true }, - { 12526, true }, - { 12545, true }, + { 12497, true }, + { 12513, true }, + { 12532, true }, + { 12556, true }, { 12569, true }, - { 12582, true }, - { 12593, true }, - { 12602, true }, - { 12614, true }, - { 12630, true }, - { 12644, true }, - { 12660, true }, - { 12680, true }, - { 12694, true }, - { 12702, true }, - { 12716, true }, - { 12734, true }, - { 12754, true }, - { 12776, true }, - { 12788, true }, - { 12804, true }, - { 12818, false }, - { 12831, true }, - { 12846, true }, - { 12864, true }, - { 12878, true }, - { 12887, true }, - { 12899, true }, - { 12917, true }, - { 12937, false }, + { 12580, true }, + { 12589, true }, + { 12601, true }, + { 12617, true }, + { 12631, true }, + { 12647, true }, + { 12667, true }, + { 12681, true }, + { 12689, true }, + { 12703, true }, + { 12721, true }, + { 12741, true }, + { 12763, true }, + { 12775, true }, + { 12791, true }, + { 12805, false }, + { 12818, true }, + { 12833, true }, + { 12851, true }, + { 12865, true }, + { 12874, true }, + { 12886, true }, + { 12904, true }, + { 12924, false }, + { 12939, true }, { 12952, true }, - { 12965, true }, - { 12975, true }, - { 12989, true }, - { 13015, true }, - { 13025, true }, - { 13039, true }, - { 13051, true }, - { 13069, true }, - { 13087, false }, - { 13103, true }, - { 13113, true }, + { 12962, true }, + { 12976, true }, + { 13002, true }, + { 13012, true }, + { 13026, true }, + { 13038, true }, + { 13056, true }, + { 13074, false }, + { 13090, true }, + { 13100, true }, + { 13111, true }, { 13124, true }, - { 13137, true }, - { 13153, true }, - { 13164, true }, - { 13174, true }, - { 13189, true }, + { 13140, true }, + { 13151, true }, + { 13161, true }, + { 13176, true }, + { 13195, true }, { 13208, true }, - { 13221, true }, - { 13239, false }, - { 13254, true }, - { 13274, true }, - { 13285, true }, + { 13226, false }, + { 13241, true }, + { 13261, true }, + { 13272, true }, + { 13284, true }, { 13297, true }, - { 13310, true }, - { 13330, false }, + { 13317, false }, + { 13331, true }, { 13344, true }, - { 13357, true }, - { 13375, true }, + { 13362, true }, + { 13376, true }, { 13389, true }, - { 13402, true }, - { 13414, true }, + { 13401, true }, + { 13415, true }, { 13428, true }, - { 13441, true }, - { 13455, true }, - { 13467, true }, - { 13485, true }, - { 13497, true }, - { 13508, true }, + { 13442, true }, + { 13454, true }, + { 13472, true }, + { 13484, true }, + { 13495, true }, + { 13506, true }, { 13519, true }, { 13532, true }, - { 13545, true }, - { 13560, true }, - { 13571, true }, - { 13582, true }, - { 13593, true }, - { 13603, true }, - { 13624, true }, - { 13633, true }, - { 13640, true }, - { 13654, false }, - { 13667, true }, + { 13547, true }, + { 13558, true }, + { 13569, true }, + { 13580, true }, + { 13590, true }, + { 13611, true }, + { 13620, true }, + { 13627, true }, + { 13641, false }, + { 13654, true }, + { 13664, true }, { 13677, true }, { 13690, true }, - { 13703, true }, - { 13715, true }, - { 13732, true }, - { 13743, true }, - { 13757, true }, - { 13767, true }, - { 13785, true }, - { 13795, true }, - { 13807, true }, - { 13821, true }, - { 13838, true }, - { 13852, true }, - { 13862, true }, - { 13878, true }, - { 13889, true }, - { 13906, true }, - { 13918, true }, - { 13932, true }, - { 13954, true }, - { 13980, true }, + { 13702, true }, + { 13719, true }, + { 13730, true }, + { 13744, true }, + { 13754, true }, + { 13772, true }, + { 13782, true }, + { 13794, true }, + { 13808, true }, + { 13825, true }, + { 13839, true }, + { 13849, true }, + { 13865, true }, + { 13876, true }, + { 13893, true }, + { 13905, true }, + { 13919, true }, + { 13941, true }, + { 13967, true }, + { 13982, true }, { 13995, true }, - { 14008, true }, - { 14026, true }, - { 14037, true }, - { 14047, true }, - { 14057, true }, - { 14067, true }, - { 14086, true }, - { 14106, true }, - { 14118, true }, - { 14132, true }, - { 14139, true }, - { 14149, true }, - { 14159, true }, - { 14181, true }, - { 14193, true }, - { 14211, true }, - { 14223, true }, - { 14236, true }, - { 14264, true }, - { 14273, true }, - { 14283, true }, - { 14293, true }, + { 14013, true }, + { 14024, true }, + { 14034, true }, + { 14044, true }, + { 14063, true }, + { 14083, true }, + { 14095, true }, + { 14109, true }, + { 14116, true }, + { 14126, true }, + { 14136, true }, + { 14158, true }, + { 14170, true }, + { 14188, true }, + { 14200, true }, + { 14213, true }, + { 14241, true }, + { 14251, true }, + { 14261, true }, + { 14269, true }, + { 14281, false }, { 14301, true }, - { 14313, false }, - { 14333, true }, + { 14308, true }, + { 14324, true }, { 14340, true }, - { 14356, true }, - { 14372, true }, - { 14387, true }, - { 14397, true }, + { 14355, true }, + { 14365, true }, + { 14383, true }, + { 14398, true }, { 14415, true }, - { 14430, true }, - { 14447, true }, - { 14465, true }, - { 14473, true }, - { 14487, true }, - { 14498, true }, - { 14507, true }, - { 14534, true }, - { 14542, true }, - { 14552, true }, - { 14568, true }, - { 14580, true }, - { 14595, true }, - { 14607, true }, - { 14622, true }, - { 14637, true }, - { 14649, true }, - { 14670, true }, - { 14687, true }, - { 14701, true }, - { 14713, true }, - { 14727, true }, - { 14737, true }, - { 14747, true }, - { 14762, true }, - { 14777, true }, - { 14788, true }, - { 14801, true }, - { 14814, true }, - { 14826, true }, - { 14834, true }, - { 14847, true }, - { 14865, true }, - { 14886, true }, - { 14900, true }, - { 14916, true }, - { 14928, true }, - { 14940, true }, + { 14433, true }, + { 14441, true }, + { 14455, true }, + { 14466, true }, + { 14475, true }, + { 14502, true }, + { 14510, true }, + { 14520, true }, + { 14536, true }, + { 14548, true }, + { 14563, true }, + { 14575, true }, + { 14590, true }, + { 14605, true }, + { 14617, true }, + { 14638, true }, + { 14655, true }, + { 14669, true }, + { 14681, true }, + { 14695, true }, + { 14705, true }, + { 14715, true }, + { 14730, true }, + { 14745, true }, + { 14756, true }, + { 14769, true }, + { 14782, true }, + { 14794, true }, + { 14802, true }, + { 14815, true }, + { 14833, true }, + { 14854, true }, + { 14868, true }, + { 14884, true }, + { 14896, true }, + { 14908, true }, + { 14920, true }, + { 14932, true }, + { 14942, true }, { 14952, true }, - { 14964, true }, - { 14974, true }, - { 14984, true }, - { 14995, true }, + { 14963, true }, + { 14978, true }, + { 14991, true }, { 15010, true }, - { 15023, true }, - { 15042, true }, - { 15068, true }, - { 15080, true }, - { 15096, true }, - { 15108, true }, + { 15036, true }, + { 15048, true }, + { 15064, true }, + { 15076, true }, + { 15092, true }, + { 15111, true }, { 15124, true }, - { 15143, true }, - { 15156, true }, - { 15167, true }, - { 15178, true }, - { 15196, true }, - { 15226, true }, - { 15249, true }, - { 15262, false }, + { 15135, true }, + { 15146, true }, + { 15164, true }, + { 15194, true }, + { 15217, true }, + { 15230, false }, + { 15238, true }, + { 15250, true }, + { 15260, true }, { 15270, true }, - { 15282, true }, - { 15292, true }, - { 15302, true }, - { 15316, true }, - { 15332, true }, + { 15284, true }, + { 15300, true }, + { 15329, true }, + { 15345, true }, { 15361, true }, - { 15377, true }, - { 15393, true }, + { 15379, true }, + { 15400, true }, { 15411, true }, - { 15432, true }, - { 15443, true }, - { 15455, true }, - { 15467, true }, - { 15485, true }, - { 15503, true }, - { 15524, true }, + { 15423, true }, + { 15435, true }, + { 15453, true }, + { 15471, true }, + { 15492, true }, + { 15517, true }, + { 15535, true }, { 15549, true }, - { 15567, true }, - { 15581, true }, - { 15606, true }, - { 15617, true }, - { 15630, true }, - { 15645, true }, - { 15660, true }, - { 15673, true }, - { 15686, true }, - { 15699, true }, - { 15712, true }, - { 15725, true }, - { 15738, true }, - { 15749, true }, - { 15765, true }, - { 15775, true }, - { 15787, true }, - { 15804, true }, + { 15574, true }, + { 15585, true }, + { 15598, true }, + { 15613, true }, + { 15628, true }, + { 15641, true }, + { 15654, true }, + { 15667, true }, + { 15680, true }, + { 15693, true }, + { 15706, true }, + { 15717, true }, + { 15733, true }, + { 15743, true }, + { 15755, true }, + { 15772, true }, + { 15784, true }, + { 15797, true }, + { 15805, true }, { 15816, true }, - { 15829, true }, - { 15837, true }, - { 15848, true }, - { 15859, true }, - { 15877, true }, - { 15892, true }, - { 15910, true }, - { 15920, true }, - { 15930, true }, - { 15939, true }, - { 15961, true }, - { 15975, true }, - { 15986, true }, - { 15994, true }, - { 16004, true }, - { 16016, true }, - { 16024, true }, - { 16034, true }, - { 16049, true }, - { 16069, true }, - { 16077, true }, - { 16102, true }, - { 16118, true }, - { 16142, true }, - { 16149, true }, - { 16157, true }, - { 16166, true }, - { 16173, true }, - { 16185, true }, - { 16196, true }, - { 16207, true }, - { 16219, true }, - { 16231, false }, - { 16240, true }, - { 16256, true }, - { 16269, true }, - { 16278, true }, - { 16287, true }, - { 16302, true }, - { 16312, true }, - { 16324, true }, - { 16342, false }, + { 15827, true }, + { 15845, true }, + { 15860, true }, + { 15878, true }, + { 15888, true }, + { 15898, true }, + { 15907, true }, + { 15929, true }, + { 15943, true }, + { 15954, true }, + { 15962, true }, + { 15972, true }, + { 15984, true }, + { 15992, true }, + { 16002, true }, + { 16017, true }, + { 16037, true }, + { 16045, true }, + { 16070, true }, + { 16086, true }, + { 16110, true }, + { 16117, true }, + { 16125, true }, + { 16134, true }, + { 16141, true }, + { 16153, true }, + { 16164, true }, + { 16175, true }, + { 16187, true }, + { 16199, false }, + { 16208, true }, + { 16224, true }, + { 16237, true }, + { 16246, true }, + { 16255, true }, + { 16270, true }, + { 16280, true }, + { 16292, true }, + { 16310, false }, + { 16326, true }, + { 16338, true }, + { 16348, true }, { 16358, true }, { 16368, true }, - { 16378, true }, - { 16388, true }, - { 16400, true }, - { 16413, true }, + { 16380, true }, + { 16393, true }, + { 16406, true }, + { 16416, true }, { 16426, true }, - { 16436, true }, - { 16446, true }, - { 16454, true }, - { 16464, true }, - { 16476, true }, - { 16488, true }, - { 16501, true }, - { 16517, true }, - { 16533, true }, - { 16544, false }, - { 16554, true }, - { 16571, true }, - { 16579, true }, - { 16588, true }, - { 16602, true }, - { 16632, true }, - { 16647, false }, - { 16656, true }, - { 16670, true }, - { 16691, true }, - { 16702, true }, - { 16715, true }, - { 16739, true }, - { 16753, true }, - { 16766, true }, - { 16778, true }, - { 16801, true }, + { 16434, true }, + { 16444, true }, + { 16456, true }, + { 16468, true }, + { 16481, true }, + { 16497, true }, + { 16513, true }, + { 16524, false }, + { 16534, true }, + { 16551, true }, + { 16559, true }, + { 16568, true }, + { 16582, true }, + { 16612, true }, + { 16627, false }, + { 16636, true }, + { 16650, true }, + { 16671, true }, + { 16682, true }, + { 16695, true }, + { 16719, true }, + { 16733, true }, + { 16746, true }, + { 16758, true }, + { 16781, true }, + { 16792, true }, { 16812, true }, - { 16832, true }, - { 16850, true }, - { 16868, true }, - { 16883, true }, - { 16898, true }, + { 16830, true }, + { 16848, true }, + { 16863, true }, + { 16878, true }, + { 16902, true }, + { 16912, true }, { 16922, true }, { 16932, true }, - { 16942, true }, - { 16952, true }, - { 16965, true }, - { 16976, true }, - { 17001, true }, - { 17030, true }, - { 17043, true }, - { 17055, true }, - { 17065, true }, - { 17073, true }, - { 17082, true }, - { 17096, false }, - { 17113, true }, - { 17125, true }, + { 16945, true }, + { 16956, true }, + { 16981, true }, + { 17010, true }, + { 17023, true }, + { 17035, true }, + { 17045, true }, + { 17053, true }, + { 17062, true }, + { 17076, false }, + { 17093, true }, + { 17105, true }, + { 17120, true }, + { 17127, true }, { 17140, true }, - { 17147, true }, - { 17160, true }, - { 17172, true }, - { 17186, true }, - { 17194, true }, - { 17209, true }, - { 17218, true }, - { 17231, true }, - { 17243, true }, - { 17254, true }, - { 17264, true }, - { 17281, true }, - { 17294, true }, - { 17304, true }, - { 17317, true }, - { 17331, true }, - { 17345, true }, - { 17357, true }, - { 17372, true }, - { 17388, true }, - { 17403, true }, - { 17417, true }, - { 17430, true }, - { 17446, true }, - { 17458, true }, - { 17472, true }, - { 17484, true }, - { 17496, true }, - { 17507, true }, - { 17518, true }, - { 17533, false }, - { 17548, false }, - { 17564, true }, - { 17586, true }, - { 17604, true }, - { 17621, true }, - { 17639, true }, - { 17650, true }, - { 17663, true }, - { 17680, true }, + { 17152, true }, + { 17166, true }, + { 17174, true }, + { 17189, true }, + { 17198, true }, + { 17211, true }, + { 17223, true }, + { 17234, true }, + { 17244, true }, + { 17261, true }, + { 17274, true }, + { 17284, true }, + { 17297, true }, + { 17311, true }, + { 17325, true }, + { 17337, true }, + { 17352, true }, + { 17368, true }, + { 17383, true }, + { 17397, true }, + { 17410, true }, + { 17426, true }, + { 17438, true }, + { 17452, true }, + { 17464, true }, + { 17476, true }, + { 17487, true }, + { 17498, true }, + { 17513, false }, + { 17528, false }, + { 17544, true }, + { 17566, true }, + { 17584, true }, + { 17601, true }, + { 17619, true }, + { 17630, true }, + { 17643, true }, + { 17660, true }, + { 17676, true }, { 17696, true }, - { 17716, true }, - { 17731, true }, - { 17746, true }, - { 17760, true }, - { 17771, true }, - { 17783, true }, - { 17796, true }, - { 17809, true }, - { 17823, true }, - { 17836, true }, - { 17854, true }, - { 17872, true }, - { 17890, true }, - { 17900, true }, - { 17913, true }, - { 17922, true }, - { 17937, true }, - { 17948, false }, - { 17958, true }, - { 17969, true }, - { 17983, true }, - { 17996, true }, - { 18006, true }, - { 18019, true }, - { 18033, true }, - { 18044, true }, - { 18054, true }, - { 18072, true }, - { 18081, true }, - { 18098, true }, - { 18117, true }, + { 17711, true }, + { 17726, true }, + { 17740, true }, + { 17751, true }, + { 17763, true }, + { 17776, true }, + { 17789, true }, + { 17803, true }, + { 17816, true }, + { 17834, true }, + { 17852, true }, + { 17870, true }, + { 17880, true }, + { 17893, true }, + { 17902, true }, + { 17917, true }, + { 17928, false }, + { 17938, true }, + { 17949, true }, + { 17963, true }, + { 17976, true }, + { 17986, true }, + { 17999, true }, + { 18013, true }, + { 18024, true }, + { 18034, true }, + { 18052, true }, + { 18061, true }, + { 18078, true }, + { 18097, true }, + { 18112, true }, { 18132, true }, - { 18152, true }, - { 18170, true }, - { 18181, true }, - { 18194, true }, - { 18209, true }, - { 18222, true }, - { 18233, true }, - { 18247, true }, - { 18271, true }, - { 18297, true }, - { 18305, true }, - { 18315, true }, - { 18326, true }, - { 18337, true }, - { 18364, true }, - { 18376, true }, - { 18388, true }, - { 18397, true }, - { 18406, true }, - { 18415, true }, - { 18430, true }, - { 18439, true }, - { 18451, true }, - { 18460, true }, - { 18470, true }, - { 18481, true }, - { 18493, true }, - { 18503, true }, - { 18515, true }, + { 18150, true }, + { 18161, true }, + { 18174, true }, + { 18189, true }, + { 18202, true }, + { 18213, true }, + { 18227, true }, + { 18251, true }, + { 18277, true }, + { 18285, true }, + { 18295, true }, + { 18306, true }, + { 18317, true }, + { 18344, true }, + { 18356, true }, + { 18368, true }, + { 18377, true }, + { 18386, true }, + { 18395, true }, + { 18410, true }, + { 18419, true }, + { 18431, true }, + { 18440, true }, + { 18450, true }, + { 18461, true }, + { 18473, true }, + { 18483, true }, + { 18495, true }, + { 18509, true }, + { 18519, true }, { 18529, true }, - { 18539, true }, - { 18549, true }, - { 18562, true }, - { 18572, false }, - { 18583, true }, - { 18601, true }, - { 18611, true }, - { 18618, true }, - { 18630, true }, - { 18645, true }, - { 18666, true }, - { 18679, true }, - { 18692, true }, - { 18709, true }, - { 18721, true }, - { 18734, false }, - { 18748, true }, - { 18760, true }, - { 18774, true }, - { 18792, true }, - { 18804, true }, - { 18817, true }, - { 18826, true }, - { 18844, true }, - { 18855, true }, - { 18866, true }, - { 18891, true }, - { 18905, true }, - { 18918, true }, - { 18932, true }, - { 18945, true }, - { 18959, true }, - { 18971, true }, - { 18987, false }, - { 18998, true }, - { 19013, true }, - { 19026, true }, - { 19039, true }, - { 19055, true }, - { 19077, true }, - { 19089, true }, - { 19102, true }, - { 19117, true }, - { 19129, true }, - { 19145, true }, - { 19158, true }, - { 19168, true }, - { 19196, true }, - { 19211, true }, - { 19227, true }, - { 19238, true }, - { 19249, true }, - { 19259, true }, - { 19272, true }, - { 19282, false }, - { 19296, true }, - { 19305, true }, - { 19317, false }, - { 19336, true }, - { 19363, true }, - { 19384, true }, - { 19400, true }, - { 19411, true }, - { 19429, true }, - { 19444, true }, - { 19455, true }, - { 19470, false }, - { 19485, true }, - { 19495, true }, - { 19506, true }, - { 19520, true }, - { 19542, true }, - { 19555, true }, - { 19570, true }, - { 19585, true }, - { 19606, true }, - { 19616, true }, - { 19630, true }, - { 19643, true }, - { 19658, true }, - { 19679, true }, - { 19697, true }, - { 19709, true }, - { 19727, true }, - { 19745, true }, - { 19759, true }, - { 19778, false }, - { 19792, true }, - { 19802, true }, - { 19813, true }, - { 19823, true }, - { 19836, true }, - { 19851, true }, - { 19865, true }, - { 19878, true }, - { 19891, true }, - { 19908, true }, - { 19924, true }, - { 19934, true }, - { 19947, true }, - { 19961, true }, + { 18542, true }, + { 18552, false }, + { 18563, true }, + { 18581, true }, + { 18591, true }, + { 18598, true }, + { 18610, true }, + { 18625, true }, + { 18646, true }, + { 18659, true }, + { 18672, true }, + { 18689, true }, + { 18701, true }, + { 18714, false }, + { 18728, true }, + { 18740, true }, + { 18754, true }, + { 18772, true }, + { 18784, true }, + { 18797, true }, + { 18806, true }, + { 18824, true }, + { 18835, true }, + { 18846, true }, + { 18871, true }, + { 18885, true }, + { 18898, true }, + { 18912, true }, + { 18925, true }, + { 18939, true }, + { 18951, true }, + { 18967, false }, + { 18978, true }, + { 18993, true }, + { 19006, true }, + { 19019, true }, + { 19035, true }, + { 19057, true }, + { 19069, true }, + { 19082, true }, + { 19097, true }, + { 19109, true }, + { 19125, true }, + { 19138, true }, + { 19148, true }, + { 19176, true }, + { 19191, true }, + { 19207, true }, + { 19218, true }, + { 19229, true }, + { 19239, true }, + { 19252, true }, + { 19262, false }, + { 19276, true }, + { 19285, true }, + { 19297, false }, + { 19316, true }, + { 19343, true }, + { 19364, true }, + { 19380, true }, + { 19391, true }, + { 19409, true }, + { 19424, true }, + { 19435, true }, + { 19450, false }, + { 19465, true }, + { 19475, true }, + { 19486, true }, + { 19500, true }, + { 19522, true }, + { 19535, true }, + { 19550, true }, + { 19565, true }, + { 19586, true }, + { 19596, true }, + { 19610, true }, + { 19623, true }, + { 19638, true }, + { 19659, true }, + { 19677, true }, + { 19689, true }, + { 19707, true }, + { 19725, true }, + { 19739, true }, + { 19758, false }, + { 19772, true }, + { 19782, true }, + { 19793, true }, + { 19803, true }, + { 19816, true }, + { 19831, true }, + { 19845, true }, + { 19858, true }, + { 19871, true }, + { 19888, true }, + { 19904, true }, + { 19914, true }, + { 19927, true }, + { 19941, true }, + { 19959, true }, { 19979, true }, - { 19999, true }, - { 20013, true }, - { 20029, true }, - { 20038, true }, - { 20046, true }, - { 20055, true }, - { 20064, true }, - { 20081, true }, + { 19993, true }, + { 20009, true }, + { 20018, true }, + { 20026, true }, + { 20035, true }, + { 20044, true }, + { 20061, true }, + { 20074, true }, + { 20084, true }, { 20094, true }, - { 20104, true }, - { 20114, true }, - { 20132, true }, - { 20151, true }, - { 20175, true }, - { 20190, true }, - { 20208, true }, - { 20224, true }, - { 20242, true }, - { 20254, true }, - { 20277, true }, - { 20299, true }, - { 20325, true }, - { 20343, true }, - { 20365, true }, - { 20379, true }, - { 20392, true }, - { 20404, true }, - { 20416, false }, - { 20432, true }, - { 20446, true }, - { 20464, true }, - { 20479, true }, - { 20491, true }, - { 20513, true }, - { 20530, true }, - { 20545, true }, - { 20566, true }, - { 20580, true }, - { 20599, true }, - { 20620, true }, - { 20637, true }, - { 20651, true }, - { 20672, true }, - { 20685, true }, - { 20701, true }, - { 20714, true }, - { 20733, true }, - { 20750, true }, - { 20768, true }, - { 20786, true }, - { 20795, true }, - { 20811, true }, - { 20827, true }, - { 20846, true }, - { 20864, true }, - { 20880, true }, - { 20894, true }, - { 20906, true }, - { 20917, true }, - { 20931, true }, - { 20941, true }, - { 20952, true }, - { 20961, false }, - { 20970, true }, - { 20984, true }, - { 20998, true }, - { 21010, true }, - { 21025, true }, - { 21037, true }, - { 21052, true }, - { 21065, true }, - { 21076, true }, - { 21099, true }, - { 21111, true }, - { 21126, true }, - { 21142, true }, - { 21151, true }, - { 21166, true }, - { 21182, true }, - { 21195, true }, - { 21210, true }, - { 21223, true }, + { 20112, true }, + { 20131, true }, + { 20155, true }, + { 20170, true }, + { 20188, true }, + { 20204, true }, + { 20222, true }, + { 20234, true }, + { 20257, true }, + { 20279, true }, + { 20305, true }, + { 20323, true }, + { 20345, true }, + { 20359, true }, + { 20372, true }, + { 20384, true }, + { 20396, false }, + { 20412, true }, + { 20426, true }, + { 20444, true }, + { 20459, true }, + { 20471, true }, + { 20493, true }, + { 20510, true }, + { 20525, true }, + { 20546, true }, + { 20560, true }, + { 20579, true }, + { 20600, true }, + { 20617, true }, + { 20631, true }, + { 20652, true }, + { 20665, true }, + { 20681, true }, + { 20694, true }, + { 20713, true }, + { 20730, true }, + { 20748, true }, + { 20766, true }, + { 20775, true }, + { 20791, true }, + { 20807, true }, + { 20826, true }, + { 20844, true }, + { 20860, true }, + { 20874, true }, + { 20886, true }, + { 20897, true }, + { 20911, true }, + { 20921, true }, + { 20932, true }, + { 20941, false }, + { 20950, true }, + { 20964, true }, + { 20978, true }, + { 20990, true }, + { 21005, true }, + { 21017, true }, + { 21032, true }, + { 21045, true }, + { 21056, true }, + { 21079, true }, + { 21091, true }, + { 21106, true }, + { 21122, true }, + { 21131, true }, + { 21146, true }, + { 21162, true }, + { 21175, true }, + { 21190, true }, + { 21203, true }, + { 21213, true }, { 21233, true }, - { 21253, true }, - { 21266, true }, + { 21246, true }, + { 21265, true }, + { 21275, true }, { 21285, true }, - { 21295, true }, - { 21305, true }, - { 21317, true }, - { 21332, true }, - { 21347, true }, - { 21362, true }, - { 21372, true }, - { 21387, true }, - { 21403, true }, - { 21422, true }, - { 21431, true }, - { 21460, true }, + { 21297, true }, + { 21312, true }, + { 21327, true }, + { 21342, true }, + { 21352, true }, + { 21367, true }, + { 21383, true }, + { 21402, true }, + { 21411, true }, + { 21440, true }, + { 21453, true }, { 21473, true }, - { 21493, true }, - { 21508, true }, - { 21521, true }, - { 21536, true }, - { 21551, true }, + { 21488, true }, + { 21501, true }, + { 21516, true }, + { 21531, true }, + { 21546, true }, + { 21556, true }, { 21566, true }, - { 21576, true }, - { 21586, true }, - { 21601, true }, - { 21623, true }, - { 21638, true }, - { 21651, true }, - { 21678, true }, - { 21692, true }, - { 21704, true }, - { 21719, true }, - { 21733, true }, - { 21743, true }, - { 21764, true }, - { 21781, true }, - { 21803, true }, - { 21821, true }, - { 21835, true }, - { 21847, true }, - { 21862, true }, - { 21879, true }, - { 21894, true }, - { 21905, true }, - { 21915, true }, - { 21931, true }, - { 21949, true }, - { 21961, true }, - { 21973, true }, - { 22003, true }, - { 22017, false }, - { 22030, true }, - { 22048, true }, - { 22061, true }, - { 22073, true }, - { 22096, true }, - { 22115, true }, - { 22128, false }, - { 22139, true }, - { 22157, true }, - { 22181, true }, - { 22201, true }, - { 22213, true }, - { 22234, true }, - { 22245, true }, - { 22262, true }, - { 22280, true }, - { 22293, true }, - { 22309, true }, - { 22323, true }, - { 22340, true }, - { 22351, true }, - { 22360, true }, - { 22372, true }, - { 22383, true }, - { 22393, true }, - { 22407, true }, - { 22425, true }, - { 22438, true }, - { 22449, true }, - { 22463, true }, - { 22475, true }, - { 22486, true }, - { 22497, true }, - { 22510, true }, - { 22522, true }, - { 22533, true }, - { 22552, true }, - { 22568, true }, - { 22582, true }, - { 22601, true }, - { 22613, true }, - { 22628, true }, - { 22637, true }, - { 22652, true }, - { 22666, true }, - { 22679, true }, - { 22691, true }, - { 22703, true }, - { 22717, true }, - { 22728, true }, - { 22742, true }, - { 22753, true }, - { 22764, true }, - { 22774, true }, - { 22784, true }, - { 22797, true }, - { 22808, true }, - { 22819, true }, - { 22830, true }, - { 22843, true }, - { 22857, true }, - { 22869, true }, - { 22883, true }, - { 22895, true }, - { 22908, true }, - { 22933, true }, - { 22945, true }, - { 22962, true }, - { 22973, true }, - { 22984, true }, - { 23003, true }, - { 23019, true }, - { 23029, true }, - { 23040, true }, - { 23052, true }, - { 23067, true }, - { 23086, true }, - { 23103, true }, - { 23121, false }, - { 23129, true }, - { 23145, true }, - { 23159, true }, - { 23176, true }, - { 23193, true }, - { 23206, true }, - { 23219, true }, - { 23232, true }, - { 23245, true }, - { 23258, true }, - { 23271, true }, - { 23284, true }, - { 23297, true }, - { 23310, true }, - { 23323, true }, - { 23336, true }, - { 23349, true }, - { 23362, true }, - { 23375, true }, - { 23392, true }, - { 23407, true }, - { 23424, true }, - { 23437, true }, - { 23449, true }, - { 23471, true }, - { 23483, true }, - { 23506, true }, - { 23530, true }, - { 23548, true }, - { 23561, true }, - { 23580, true }, - { 23601, true }, - { 23614, true }, - { 23629, true }, - { 23647, true }, - { 23663, true }, - { 23679, true }, - { 23689, true }, - { 23703, true }, - { 23718, true }, - { 23737, true }, - { 23754, true }, - { 23765, true }, - { 23781, true }, - { 23793, true }, - { 23803, true }, - { 23819, true }, - { 23829, true }, - { 23850, true }, - { 23872, true }, - { 23884, true }, - { 23895, true }, - { 23910, true }, - { 23921, true }, - { 23936, true }, - { 23951, true }, - { 23963, true }, - { 23982, true }, - { 23995, true }, - { 24009, true }, - { 24031, true }, - { 24050, true }, - { 24070, true }, - { 24078, true }, - { 24091, true }, - { 24105, true }, - { 24119, true }, - { 24130, true }, - { 24143, true }, - { 24158, true }, - { 24174, true }, - { 24189, true }, - { 24203, true }, - { 24215, true }, - { 24232, false }, - { 24248, false }, - { 24268, true }, - { 24281, true }, - { 24297, true }, - { 24322, true }, - { 24335, true }, - { 24348, true }, - { 24359, true }, - { 24368, true }, - { 24377, true }, - { 24393, true }, - { 24407, true }, - { 24423, true }, - { 24434, true }, - { 24447, true }, - { 24462, true }, - { 24476, true }, - { 24488, true }, - { 24500, true }, + { 21581, true }, + { 21603, true }, + { 21618, true }, + { 21631, true }, + { 21658, true }, + { 21672, true }, + { 21684, true }, + { 21699, true }, + { 21713, true }, + { 21723, true }, + { 21744, true }, + { 21761, true }, + { 21783, true }, + { 21801, false }, + { 21820, true }, + { 21834, true }, + { 21846, true }, + { 21861, true }, + { 21878, true }, + { 21893, true }, + { 21904, true }, + { 21914, true }, + { 21930, true }, + { 21948, true }, + { 21960, true }, + { 21972, true }, + { 22002, true }, + { 22016, false }, + { 22029, true }, + { 22047, true }, + { 22060, true }, + { 22072, true }, + { 22095, true }, + { 22114, true }, + { 22127, false }, + { 22138, true }, + { 22156, true }, + { 22180, true }, + { 22200, true }, + { 22212, true }, + { 22233, true }, + { 22244, true }, + { 22261, true }, + { 22279, true }, + { 22292, true }, + { 22308, true }, + { 22322, true }, + { 22339, true }, + { 22350, true }, + { 22359, true }, + { 22371, true }, + { 22382, true }, + { 22392, true }, + { 22406, true }, + { 22424, true }, + { 22437, true }, + { 22448, true }, + { 22462, true }, + { 22474, true }, + { 22485, true }, + { 22496, true }, + { 22509, true }, + { 22521, true }, + { 22532, true }, + { 22551, true }, + { 22567, true }, + { 22581, true }, + { 22600, true }, + { 22612, true }, + { 22627, true }, + { 22636, true }, + { 22651, true }, + { 22665, true }, + { 22678, true }, + { 22690, true }, + { 22702, true }, + { 22716, true }, + { 22727, true }, + { 22741, true }, + { 22752, true }, + { 22763, true }, + { 22773, true }, + { 22783, true }, + { 22796, true }, + { 22807, true }, + { 22818, true }, + { 22829, true }, + { 22842, true }, + { 22856, true }, + { 22868, true }, + { 22882, true }, + { 22894, true }, + { 22907, true }, + { 22932, true }, + { 22944, true }, + { 22961, true }, + { 22972, true }, + { 22983, true }, + { 23002, true }, + { 23018, true }, + { 23028, true }, + { 23039, true }, + { 23051, true }, + { 23066, true }, + { 23085, true }, + { 23102, true }, + { 23120, false }, + { 23128, true }, + { 23144, true }, + { 23158, true }, + { 23175, true }, + { 23192, true }, + { 23205, true }, + { 23218, true }, + { 23231, true }, + { 23244, true }, + { 23257, true }, + { 23270, true }, + { 23283, true }, + { 23296, true }, + { 23309, true }, + { 23322, true }, + { 23335, true }, + { 23348, true }, + { 23361, true }, + { 23374, true }, + { 23391, true }, + { 23406, true }, + { 23423, true }, + { 23436, true }, + { 23448, true }, + { 23470, true }, + { 23482, true }, + { 23505, true }, + { 23529, true }, + { 23547, true }, + { 23560, true }, + { 23579, true }, + { 23600, true }, + { 23613, true }, + { 23628, true }, + { 23646, true }, + { 23662, true }, + { 23678, true }, + { 23688, true }, + { 23702, true }, + { 23717, true }, + { 23736, true }, + { 23753, true }, + { 23764, true }, + { 23780, true }, + { 23792, true }, + { 23802, true }, + { 23818, true }, + { 23828, true }, + { 23849, true }, + { 23871, true }, + { 23883, true }, + { 23894, true }, + { 23909, true }, + { 23920, true }, + { 23935, true }, + { 23950, true }, + { 23962, true }, + { 23981, true }, + { 23994, true }, + { 24008, true }, + { 24030, true }, + { 24049, true }, + { 24069, true }, + { 24077, true }, + { 24090, true }, + { 24104, true }, + { 24118, true }, + { 24129, true }, + { 24142, true }, + { 24157, true }, + { 24173, true }, + { 24188, true }, + { 24202, true }, + { 24214, true }, + { 24231, false }, + { 24247, false }, + { 24267, true }, + { 24280, true }, + { 24296, true }, + { 24321, true }, + { 24334, true }, + { 24347, true }, + { 24358, true }, + { 24367, true }, + { 24376, true }, + { 24392, true }, + { 24406, true }, + { 24422, true }, + { 24433, true }, + { 24446, true }, + { 24461, true }, + { 24475, true }, + { 24487, true }, + { 24511, true }, { 24524, true }, { 24537, true }, - { 24550, true }, - { 24571, true }, - { 24591, true }, - { 24605, true }, - { 24620, true }, - { 24629, true }, - { 24640, true }, - { 24650, true }, - { 24660, true }, - { 24678, true }, - { 24703, true }, - { 24725, true }, + { 24558, true }, + { 24578, true }, + { 24592, true }, + { 24607, true }, + { 24616, true }, + { 24627, true }, + { 24637, true }, + { 24647, true }, + { 24665, true }, + { 24690, true }, + { 24712, true }, + { 24724, true }, { 24737, true }, { 24750, true }, - { 24763, true }, - { 24774, true }, - { 24782, true }, - { 24801, true }, + { 24761, true }, + { 24769, true }, + { 24788, true }, + { 24798, true }, { 24811, true }, - { 24824, true }, - { 24841, true }, - { 24858, true }, - { 24874, true }, - { 24886, true }, - { 24898, true }, - { 24909, true }, - { 24923, true }, - { 24947, true }, - { 24962, true }, - { 24977, true }, - { 24999, true }, - { 25009, true }, - { 25025, true }, - { 25036, true }, + { 24828, true }, + { 24845, true }, + { 24861, true }, + { 24873, true }, + { 24885, true }, + { 24896, true }, + { 24910, true }, + { 24934, true }, + { 24949, true }, + { 24964, true }, + { 24986, true }, + { 24996, true }, + { 25012, true }, + { 25023, true }, + { 25044, true }, { 25057, true }, - { 25070, true }, - { 25090, true }, - { 25101, true }, - { 25109, false }, - { 25121, true }, - { 25133, true }, - { 25152, true }, - { 25166, true }, - { 25181, true }, - { 25196, true }, - { 25211, true }, - { 25221, true }, - { 25231, true }, - { 25243, false }, - { 25252, true }, - { 25266, true }, - { 25278, true }, - { 25304, true }, - { 25312, true }, - { 25327, true }, - { 25339, true }, - { 25351, true }, - { 25369, true }, - { 25389, true }, - { 25405, true }, - { 25417, true }, - { 25435, true }, - { 25447, true }, - { 25461, true }, - { 25481, true }, - { 25493, true }, - { 25507, true }, - { 25524, true }, - { 25533, true }, - { 25543, true }, - { 25555, true }, - { 25577, false }, - { 25591, true }, - { 25607, true }, - { 25624, true }, - { 25636, true }, - { 25654, false }, - { 25676, false }, - { 25701, false }, - { 25725, true }, - { 25737, true }, + { 25077, true }, + { 25088, true }, + { 25096, false }, + { 25108, true }, + { 25120, true }, + { 25139, true }, + { 25153, true }, + { 25168, true }, + { 25183, true }, + { 25198, true }, + { 25208, true }, + { 25218, true }, + { 25230, false }, + { 25239, true }, + { 25253, true }, + { 25265, true }, + { 25291, true }, + { 25299, true }, + { 25314, true }, + { 25326, true }, + { 25338, true }, + { 25356, true }, + { 25376, true }, + { 25392, true }, + { 25404, true }, + { 25422, true }, + { 25434, true }, + { 25448, true }, + { 25468, true }, + { 25480, true }, + { 25494, true }, + { 25511, true }, + { 25520, true }, + { 25530, true }, + { 25542, true }, + { 25564, false }, + { 25578, true }, + { 25594, true }, + { 25611, true }, + { 25623, true }, + { 25641, false }, + { 25663, false }, + { 25688, false }, + { 25712, true }, + { 25724, true }, + { 25734, true }, { 25747, true }, - { 25760, true }, - { 25770, true }, - { 25780, true }, - { 25790, true }, - { 25800, true }, - { 25810, true }, - { 25820, true }, - { 25830, true }, - { 25844, true }, - { 25862, true }, - { 25877, true }, - { 25891, true }, - { 25903, true }, - { 25915, true }, - { 25926, true }, - { 25940, true }, - { 25955, true }, - { 25969, true }, - { 25976, true }, - { 25990, false }, - { 26010, true }, - { 26031, true }, - { 26050, true }, - { 26065, true }, - { 26077, true }, - { 26102, true }, - { 26113, true }, - { 26124, true }, - { 26136, true }, - { 26149, false }, - { 26162, true }, - { 26179, true }, + { 25757, true }, + { 25767, true }, + { 25777, true }, + { 25787, true }, + { 25797, true }, + { 25807, true }, + { 25817, true }, + { 25831, true }, + { 25849, true }, + { 25864, true }, + { 25878, true }, + { 25890, true }, + { 25902, true }, + { 25913, true }, + { 25927, true }, + { 25942, true }, + { 25956, true }, + { 25963, true }, + { 25977, false }, + { 25997, true }, + { 26018, true }, + { 26037, true }, + { 26052, true }, + { 26064, true }, + { 26089, true }, + { 26100, true }, + { 26111, true }, + { 26123, true }, + { 26136, false }, + { 26149, true }, + { 26166, true }, + { 26182, true }, { 26195, true }, - { 26208, true }, - { 26220, true }, - { 26235, true }, - { 26245, true }, - { 26270, true }, - { 26286, true }, - { 26300, true }, - { 26317, true }, - { 26336, true }, - { 26346, true }, - { 26366, true }, - { 26378, true }, - { 26394, false }, + { 26207, true }, + { 26222, true }, + { 26232, true }, + { 26257, true }, + { 26273, true }, + { 26287, true }, + { 26304, true }, + { 26323, true }, + { 26333, true }, + { 26353, true }, + { 26365, true }, + { 26381, false }, + { 26393, true }, { 26406, true }, - { 26419, true }, - { 26436, true }, - { 26453, true }, - { 26462, true }, - { 26472, true }, - { 26481, true }, - { 26498, true }, - { 26507, true }, - { 26514, true }, - { 26529, true }, - { 26540, false }, - { 26556, true }, - { 26573, true }, - { 26587, true }, - { 26597, true }, - { 26607, true }, - { 26627, true }, - { 26647, true }, - { 26658, true }, - { 26672, true }, - { 26690, true }, - { 26705, true }, - { 26718, true }, - { 26733, true }, - { 26749, true }, - { 26775, true }, - { 26792, true }, - { 26805, true }, - { 26828, true }, - { 26842, true }, - { 26854, true }, - { 26864, true }, - { 26889, true }, - { 26906, false }, - { 26927, false }, - { 26949, false }, - { 26968, false }, - { 26986, true }, - { 27002, true }, - { 27026, true }, - { 27054, true }, - { 27065, true }, - { 27080, true }, - { 27099, true }, - { 27122, true }, - { 27146, true }, - { 27160, true }, - { 27171, true }, - { 27193, true }, - { 27211, true }, - { 27226, true }, - { 27241, true }, - { 27254, true }, - { 27267, true }, - { 27282, true }, - { 27297, true }, + { 26423, true }, + { 26440, true }, + { 26449, true }, + { 26459, true }, + { 26468, true }, + { 26485, true }, + { 26494, true }, + { 26501, true }, + { 26516, true }, + { 26527, false }, + { 26543, true }, + { 26560, true }, + { 26574, true }, + { 26584, true }, + { 26594, true }, + { 26614, true }, + { 26634, true }, + { 26645, true }, + { 26663, true }, + { 26678, true }, + { 26691, true }, + { 26706, true }, + { 26722, true }, + { 26748, true }, + { 26765, true }, + { 26778, true }, + { 26801, true }, + { 26815, true }, + { 26827, true }, + { 26837, true }, + { 26862, true }, + { 26879, false }, + { 26900, false }, + { 26922, false }, + { 26941, false }, + { 26959, true }, + { 26975, true }, + { 26999, true }, + { 27027, true }, + { 27038, true }, + { 27053, true }, + { 27072, true }, + { 27095, true }, + { 27119, true }, + { 27133, true }, + { 27144, true }, + { 27166, true }, + { 27184, true }, + { 27199, true }, + { 27214, true }, + { 27227, true }, + { 27240, true }, + { 27255, true }, + { 27270, true }, + { 27285, true }, { 27312, true }, + { 27324, true }, { 27339, true }, - { 27351, true }, - { 27366, true }, - { 27385, true }, - { 27403, true }, - { 27411, true }, - { 27419, true }, - { 27431, true }, - { 27443, true }, - { 27457, true }, - { 27475, true }, - { 27493, true }, - { 27508, true }, - { 27523, true }, - { 27538, true }, - { 27554, true }, - { 27571, true }, - { 27580, true }, - { 27591, true }, - { 27604, true }, + { 27358, true }, + { 27376, true }, + { 27384, true }, + { 27392, true }, + { 27404, true }, + { 27416, true }, + { 27430, true }, + { 27448, true }, + { 27466, true }, + { 27481, true }, + { 27496, true }, + { 27511, true }, + { 27527, true }, + { 27544, true }, + { 27553, true }, + { 27564, true }, + { 27577, true }, + { 27587, true }, + { 27600, false }, { 27614, true }, - { 27627, false }, - { 27641, true }, - { 27653, true }, - { 27663, true }, - { 27679, false }, - { 27686, true }, - { 27696, true }, - { 27710, true }, - { 27725, true }, - { 27733, true }, - { 27746, true }, - { 27754, true }, - { 27764, true }, - { 27782, true }, - { 27800, true }, - { 27811, true }, + { 27626, true }, + { 27636, true }, + { 27652, false }, + { 27659, true }, + { 27669, true }, + { 27683, true }, + { 27698, true }, + { 27706, true }, + { 27719, true }, + { 27727, true }, + { 27737, true }, + { 27755, true }, + { 27773, true }, + { 27784, true }, + { 27797, true }, + { 27810, true }, { 27824, true }, - { 27837, true }, - { 27851, true }, - { 27860, true }, - { 27875, true }, - { 27904, true }, - { 27921, true }, - { 27939, true }, - { 27953, true }, - { 27964, true }, - { 27991, true }, + { 27833, true }, + { 27848, true }, + { 27877, true }, + { 27894, true }, + { 27912, true }, + { 27922, true }, + { 27936, true }, + { 27947, true }, + { 27974, true }, + { 27994, true }, { 28011, true }, - { 28028, true }, - { 28042, true }, - { 28064, true }, - { 28089, true }, - { 28102, true }, + { 28025, true }, + { 28047, true }, + { 28072, true }, + { 28085, true }, + { 28098, true }, { 28115, true }, - { 28132, true }, - { 28150, true }, - { 28165, true }, - { 28180, true }, - { 28191, true }, - { 28201, true }, - { 28222, true }, - { 28232, false }, - { 28251, true }, - { 28263, true }, - { 28292, true }, - { 28310, true }, - { 28328, true }, - { 28346, true }, - { 28367, true }, - { 28381, true }, - { 28395, true }, - { 28403, true }, - { 28413, true }, - { 28426, true }, - { 28438, true }, - { 28450, true }, - { 28466, true }, - { 28480, true }, - { 28502, true }, - { 28521, true }, - { 28534, true }, - { 28553, true }, - { 28568, true }, - { 28581, true }, - { 28599, true }, - { 28612, false }, - { 28622, true }, - { 28644, true }, - { 28658, true }, - { 28681, true }, - { 28697, true }, - { 28712, true }, - { 28728, true }, - { 28745, true }, - { 28756, false }, - { 28764, true }, - { 28780, true }, - { 28800, true }, - { 28814, true }, - { 28829, true }, - { 28837, true }, - { 28852, true }, - { 28865, true }, - { 28877, true }, - { 28890, true }, - { 28903, false }, - { 28925, true }, - { 28949, true }, - { 28972, true }, - { 28990, true }, - { 29005, true }, - { 29032, true }, - { 29058, true }, - { 29085, true }, - { 29101, true }, - { 29119, true }, - { 29148, true }, - { 29164, true }, - { 29180, true }, - { 29192, true }, - { 29205, true }, - { 29216, true }, - { 29234, true }, - { 29247, true }, - { 29256, true }, + { 28133, true }, + { 28148, true }, + { 28163, true }, + { 28174, true }, + { 28184, true }, + { 28205, true }, + { 28215, false }, + { 28234, true }, + { 28246, true }, + { 28275, true }, + { 28293, true }, + { 28311, true }, + { 28329, true }, + { 28350, true }, + { 28364, true }, + { 28378, true }, + { 28386, true }, + { 28396, true }, + { 28409, true }, + { 28421, true }, + { 28433, true }, + { 28449, true }, + { 28463, true }, + { 28485, true }, + { 28504, true }, + { 28517, true }, + { 28536, true }, + { 28551, true }, + { 28569, true }, + { 28582, false }, + { 28592, true }, + { 28614, true }, + { 28628, true }, + { 28651, true }, + { 28667, true }, + { 28682, true }, + { 28698, true }, + { 28715, true }, + { 28726, false }, + { 28734, true }, + { 28750, true }, + { 28770, true }, + { 28784, true }, + { 28799, true }, + { 28807, true }, + { 28822, true }, + { 28835, true }, + { 28847, true }, + { 28860, true }, + { 28873, false }, + { 28895, true }, + { 28919, true }, + { 28942, true }, + { 28960, true }, + { 28975, true }, + { 29002, true }, + { 29028, true }, + { 29055, true }, + { 29071, true }, + { 29089, true }, + { 29118, true }, + { 29134, true }, + { 29150, true }, + { 29162, true }, + { 29175, true }, + { 29186, true }, + { 29204, true }, + { 29217, true }, + { 29226, true }, + { 29235, true }, + { 29252, true }, { 29265, true }, - { 29282, true }, - { 29295, true }, - { 29304, true }, - { 29321, true }, - { 29329, true }, - { 29338, true }, - { 29347, false }, - { 29358, true }, - { 29382, true }, - { 29392, true }, - { 29402, true }, - { 29411, true }, - { 29424, true }, - { 29437, true }, - { 29449, true }, - { 29463, true }, - { 29477, true }, - { 29495, true }, - { 29510, true }, - { 29524, true }, - { 29536, true }, - { 29552, true }, - { 29565, true }, - { 29580, true }, - { 29592, true }, - { 29607, true }, + { 29274, true }, + { 29291, true }, + { 29299, true }, + { 29308, true }, + { 29317, false }, + { 29328, true }, + { 29352, true }, + { 29362, true }, + { 29372, true }, + { 29381, true }, + { 29394, true }, + { 29407, true }, + { 29419, true }, + { 29433, true }, + { 29447, true }, + { 29465, true }, + { 29480, true }, + { 29494, true }, + { 29506, true }, + { 29522, true }, + { 29535, true }, + { 29550, true }, + { 29562, true }, + { 29577, true }, + { 29591, true }, + { 29606, true }, { 29621, true }, { 29636, true }, - { 29651, true }, - { 29666, true }, - { 29675, true }, - { 29684, true }, - { 29698, true }, - { 29707, true }, - { 29721, true }, - { 29731, true }, - { 29744, true }, - { 29754, true }, + { 29645, true }, + { 29654, true }, + { 29668, true }, + { 29677, true }, + { 29691, true }, + { 29701, true }, + { 29714, true }, + { 29724, true }, + { 29734, true }, + { 29749, true }, { 29764, true }, - { 29779, true }, - { 29794, true }, - { 29808, true }, - { 29823, true }, + { 29778, true }, + { 29793, true }, + { 29812, true }, + { 29828, true }, { 29842, true }, { 29858, true }, - { 29872, true }, - { 29888, true }, - { 29899, true }, - { 29913, true }, - { 29923, true }, - { 29934, true }, - { 29950, true }, + { 29869, true }, + { 29883, true }, + { 29893, true }, + { 29904, true }, + { 29920, true }, + { 29932, true }, + { 29948, true }, { 29962, true }, + { 29967, true }, { 29978, true }, - { 29992, true }, - { 29997, true }, - { 30008, true }, - { 30016, true }, - { 30024, true }, - { 30031, true }, - { 30037, true }, - { 30047, true }, - { 30056, true }, - { 30066, true }, - { 30095, true }, - { 30110, false }, - { 30130, true }, - { 30140, true }, - { 30153, true }, - { 30171, true }, - { 30184, true }, - { 30204, true }, - { 30220, true }, - { 30232, true }, - { 30244, true }, - { 30257, true }, - { 30268, true }, - { 30279, true }, - { 30293, true }, - { 30311, true }, - { 30324, true }, - { 30337, true }, - { 30353, true }, - { 30373, true }, - { 30393, true }, - { 30401, true }, - { 30412, false }, - { 30422, true }, - { 30434, true }, - { 30443, true }, - { 30457, true }, - { 30476, true }, - { 30484, true }, - { 30508, true }, + { 29986, true }, + { 29994, true }, + { 30001, true }, + { 30007, true }, + { 30017, true }, + { 30026, true }, + { 30036, true }, + { 30065, true }, + { 30080, false }, + { 30100, true }, + { 30110, true }, + { 30123, true }, + { 30141, true }, + { 30154, true }, + { 30174, true }, + { 30190, true }, + { 30202, true }, + { 30214, true }, + { 30227, true }, + { 30238, true }, + { 30249, true }, + { 30263, true }, + { 30281, true }, + { 30294, true }, + { 30307, true }, + { 30323, true }, + { 30343, true }, + { 30363, true }, + { 30371, true }, + { 30382, false }, + { 30392, true }, + { 30404, true }, + { 30413, true }, + { 30427, true }, + { 30446, true }, + { 30454, true }, + { 30478, true }, + { 30497, true }, + { 30511, false }, { 30527, true }, - { 30541, false }, - { 30557, true }, - { 30568, true }, - { 30580, false }, - { 30595, true }, - { 30607, true }, - { 30626, false }, - { 30634, true }, - { 30646, true }, - { 30660, false }, - { 30672, true }, - { 30684, true }, - { 30695, true }, - { 30709, true }, - { 30722, true }, + { 30538, true }, + { 30550, false }, + { 30565, true }, + { 30577, true }, + { 30596, false }, + { 30604, true }, + { 30616, true }, + { 30630, false }, + { 30642, true }, + { 30654, true }, + { 30665, true }, + { 30679, true }, + { 30692, true }, + { 30704, true }, + { 30724, true }, { 30734, true }, - { 30747, true }, - { 30767, true }, - { 30777, true }, - { 30796, true }, - { 30808, true }, - { 30819, true }, - { 30831, true }, - { 30848, true }, - { 30871, true }, - { 30894, true }, - { 30905, true }, - { 30917, true }, + { 30753, true }, + { 30765, true }, + { 30776, true }, + { 30788, true }, + { 30805, true }, + { 30828, true }, + { 30851, true }, + { 30862, true }, + { 30874, true }, + { 30889, true }, + { 30900, true }, + { 30916, true }, { 30932, true }, - { 30943, true }, - { 30959, true }, - { 30975, true }, - { 30993, false }, - { 31016, true }, - { 31036, true }, - { 31050, true }, - { 31065, true }, - { 31088, true }, - { 31107, true }, - { 31122, true }, + { 30950, false }, + { 30973, true }, + { 30993, true }, + { 31007, true }, + { 31022, true }, + { 31045, true }, + { 31064, true }, + { 31079, true }, + { 31097, true }, + { 31114, true }, { 31140, true }, - { 31157, true }, - { 31183, true }, - { 31202, true }, - { 31218, true }, - { 31232, true }, - { 31253, true }, - { 31269, true }, - { 31294, true }, - { 31308, true }, - { 31326, true }, - { 31335, true }, - { 31347, false }, - { 31358, true }, - { 31371, true }, - { 31383, true }, - { 31406, true }, - { 31418, true }, - { 31433, true }, - { 31446, true }, - { 31460, true }, - { 31470, true }, - { 31483, true }, - { 31491, true }, - { 31498, true }, - { 31523, true }, - { 31549, true }, - { 31561, true }, - { 31581, true }, - { 31593, true }, - { 31608, true }, - { 31634, true }, - { 31656, true }, - { 31670, true }, - { 31682, true }, - { 31695, true }, - { 31703, true }, - { 31717, true }, - { 31741, true }, - { 31755, true }, - { 31779, true }, - { 31790, true }, - { 31807, true }, + { 31159, true }, + { 31175, true }, + { 31189, true }, + { 31210, true }, + { 31226, true }, + { 31251, true }, + { 31265, true }, + { 31283, true }, + { 31292, true }, + { 31304, false }, + { 31315, true }, + { 31328, true }, + { 31340, true }, + { 31363, true }, + { 31375, true }, + { 31390, true }, + { 31403, true }, + { 31417, true }, + { 31427, true }, + { 31440, true }, + { 31448, true }, + { 31455, true }, + { 31480, true }, + { 31506, true }, + { 31518, true }, + { 31538, true }, + { 31550, true }, + { 31565, true }, + { 31591, true }, + { 31613, true }, + { 31627, true }, + { 31639, true }, + { 31652, true }, + { 31660, true }, + { 31674, true }, + { 31698, true }, + { 31712, true }, + { 31736, true }, + { 31747, true }, + { 31756, true }, + { 31771, true }, + { 31793, true }, { 31816, true }, - { 31831, true }, - { 31853, true }, + { 31840, true }, + { 31863, true }, { 31876, true }, - { 31900, true }, - { 31923, true }, - { 31936, true }, - { 31954, false }, - { 31985, false }, + { 31894, false }, + { 31925, false }, + { 31940, true }, + { 31952, true }, + { 31965, true }, + { 31985, true }, { 32000, true }, - { 32012, true }, - { 32025, true }, - { 32045, true }, - { 32060, true }, - { 32076, true }, - { 32087, true }, - { 32103, true }, - { 32114, true }, - { 32128, true }, - { 32138, true }, - { 32147, false }, - { 32160, true }, - { 32177, true }, - { 32196, true }, - { 32210, true }, - { 32224, true }, - { 32236, true }, - { 32255, true }, - { 32268, true }, - { 32285, true }, - { 32294, true }, - { 32314, true }, - { 32336, true }, + { 32016, true }, + { 32027, true }, + { 32043, true }, + { 32054, true }, + { 32068, true }, + { 32078, true }, + { 32087, false }, + { 32100, true }, + { 32117, true }, + { 32136, true }, + { 32150, true }, + { 32164, true }, + { 32176, true }, + { 32195, true }, + { 32208, true }, + { 32225, true }, + { 32234, true }, + { 32254, true }, + { 32276, true }, + { 32297, true }, + { 32308, true }, + { 32322, true }, + { 32338, true }, { 32349, true }, - { 32370, true }, - { 32381, true }, - { 32395, true }, - { 32411, true }, - { 32422, true }, - { 32438, true }, - { 32455, true }, - { 32464, true }, - { 32479, true }, - { 32493, true }, - { 32514, true }, - { 32531, true }, - { 32547, true }, - { 32560, true }, - { 32573, true }, - { 32585, true }, - { 32593, true }, - { 32606, true }, - { 32619, true }, - { 32631, true }, - { 32643, true }, - { 32662, true }, - { 32677, true }, - { 32693, true }, - { 32714, true }, - { 32732, true }, - { 32743, true }, - { 32751, false }, - { 32774, true }, - { 32791, true }, - { 32808, true }, - { 32821, true }, - { 32838, true }, + { 32365, true }, + { 32382, true }, + { 32391, true }, + { 32406, true }, + { 32420, true }, + { 32441, true }, + { 32458, true }, + { 32474, true }, + { 32487, true }, + { 32500, true }, + { 32512, true }, + { 32520, true }, + { 32533, true }, + { 32546, true }, + { 32558, true }, + { 32570, true }, + { 32589, true }, + { 32604, true }, + { 32620, true }, + { 32641, true }, + { 32659, true }, + { 32670, true }, + { 32678, false }, + { 32701, true }, + { 32718, true }, + { 32735, true }, + { 32748, true }, + { 32765, true }, + { 32776, true }, + { 32788, false }, + { 32798, true }, + { 32814, false }, + { 32825, true }, + { 32840, true }, { 32849, true }, - { 32861, false }, - { 32871, true }, - { 32887, false }, - { 32898, true }, - { 32913, true }, - { 32922, true }, - { 32935, true }, - { 32969, true }, - { 32987, true }, - { 33005, true }, - { 33016, true }, - { 33026, true }, - { 33037, true }, - { 33049, true }, - { 33075, true }, - { 33092, true }, - { 33101, true }, - { 33117, true }, - { 33127, true }, - { 33135, false }, - { 33143, true }, - { 33153, true }, - { 33166, true }, - { 33176, true }, - { 33191, true }, - { 33205, true }, - { 33219, true }, + { 32862, true }, + { 32896, true }, + { 32914, true }, + { 32932, true }, + { 32943, true }, + { 32953, true }, + { 32964, true }, + { 32976, true }, + { 33002, true }, + { 33019, true }, + { 33028, true }, + { 33044, true }, + { 33054, true }, + { 33062, false }, + { 33070, true }, + { 33080, true }, + { 33093, true }, + { 33103, true }, + { 33118, true }, + { 33132, true }, + { 33146, true }, + { 33156, true }, + { 33164, true }, + { 33178, true }, + { 33199, true }, + { 33213, true }, { 33229, true }, - { 33237, true }, - { 33251, true }, - { 33272, true }, - { 33286, true }, - { 33302, true }, - { 33309, true }, + { 33236, true }, + { 33246, true }, + { 33261, true }, + { 33272, false }, + { 33285, true }, + { 33301, true }, { 33319, true }, - { 33334, true }, - { 33345, false }, - { 33358, true }, - { 33374, true }, - { 33392, true }, - { 33408, true }, - { 33419, true }, - { 33437, true }, - { 33459, false }, - { 33476, true }, - { 33488, true }, - { 33504, true }, - { 33520, true }, - { 33536, true }, - { 33555, true }, - { 33572, true }, - { 33587, true }, - { 33606, true }, - { 33621, true }, - { 33636, true }, - { 33657, true }, - { 33675, true }, - { 33688, true }, - { 33701, true }, - { 33715, true }, - { 33734, true }, - { 33752, true }, - { 33767, true }, - { 33781, true }, - { 33794, true }, - { 33805, true }, - { 33815, true }, - { 33832, true }, - { 33848, true }, - { 33864, true }, - { 33879, true }, - { 33889, true }, - { 33904, true }, - { 33916, true }, + { 33335, true }, + { 33346, true }, + { 33364, true }, + { 33386, false }, + { 33403, true }, + { 33415, true }, + { 33431, true }, + { 33447, true }, + { 33463, true }, + { 33482, true }, + { 33499, true }, + { 33514, true }, + { 33533, true }, + { 33548, true }, + { 33563, true }, + { 33584, true }, + { 33602, true }, + { 33615, true }, + { 33628, true }, + { 33642, true }, + { 33661, true }, + { 33679, true }, + { 33694, true }, + { 33708, true }, + { 33721, true }, + { 33732, true }, + { 33742, true }, + { 33759, true }, + { 33775, true }, + { 33791, true }, + { 33806, true }, + { 33816, true }, + { 33831, true }, + { 33843, true }, + { 33854, true }, + { 33866, false }, + { 33874, true }, + { 33895, true }, + { 33903, true }, + { 33914, true }, { 33927, true }, - { 33939, false }, - { 33947, true }, - { 33968, true }, - { 33976, true }, - { 33987, true }, - { 34000, true }, - { 34008, true }, - { 34016, true }, - { 34034, true }, - { 34048, true }, - { 34062, true }, - { 34070, true }, - { 34078, true }, - { 34088, true }, - { 34102, true }, - { 34122, true }, - { 34130, true }, - { 34139, false }, - { 34159, true }, - { 34177, true }, - { 34188, true }, - { 34206, true }, - { 34224, true }, - { 34236, true }, - { 34252, true }, + { 33935, true }, + { 33943, true }, + { 33961, true }, + { 33975, true }, + { 33989, true }, + { 33997, true }, + { 34005, true }, + { 34015, true }, + { 34029, true }, + { 34049, true }, + { 34057, true }, + { 34066, false }, + { 34086, true }, + { 34104, true }, + { 34115, true }, + { 34133, true }, + { 34151, true }, + { 34163, true }, + { 34175, true }, + { 34191, true }, + { 34207, true }, + { 34221, true }, + { 34238, true }, + { 34251, true }, { 34268, true }, - { 34282, true }, - { 34299, true }, - { 34312, true }, - { 34329, true }, - { 34342, true }, - { 34356, true }, - { 34369, true }, - { 34383, true }, - { 34402, true }, - { 34412, true }, - { 34432, true }, - { 34441, true }, - { 34461, true }, - { 34478, true }, - { 34498, true }, - { 34512, true }, - { 34532, true }, - { 34550, true }, - { 34585, true }, - { 34599, true }, - { 34617, true }, - { 34627, true }, - { 34657, true }, - { 34672, true }, - { 34685, true }, - { 34698, true }, - { 34712, true }, - { 34727, true }, - { 34747, true }, + { 34281, true }, + { 34295, true }, + { 34308, true }, + { 34322, true }, + { 34341, true }, + { 34351, true }, + { 34371, true }, + { 34380, true }, + { 34400, true }, + { 34417, true }, + { 34437, true }, + { 34451, true }, + { 34471, true }, + { 34489, true }, + { 34524, true }, + { 34538, true }, + { 34556, true }, + { 34566, true }, + { 34596, true }, + { 34611, true }, + { 34624, true }, + { 34637, true }, + { 34651, true }, + { 34666, true }, + { 34686, true }, + { 34703, true }, + { 34714, true }, + { 34724, false }, + { 34735, true }, + { 34743, true }, { 34764, true }, - { 34775, true }, - { 34785, false }, - { 34796, true }, - { 34804, true }, - { 34825, true }, - { 34846, true }, - { 34867, false }, + { 34785, true }, + { 34806, false }, + { 34822, true }, + { 34835, true }, + { 34850, true }, + { 34862, false }, { 34883, true }, - { 34896, true }, - { 34911, true }, - { 34923, false }, - { 34944, true }, - { 34964, true }, - { 34986, true }, - { 35000, true }, - { 35018, true }, - { 35038, true }, - { 35051, true }, - { 35067, true }, - { 35081, true }, - { 35097, true }, - { 35115, true }, + { 34903, true }, + { 34925, true }, + { 34939, true }, + { 34957, true }, + { 34977, true }, + { 34993, true }, + { 35007, true }, + { 35023, true }, + { 35041, true }, + { 35052, true }, + { 35065, true }, + { 35078, true }, + { 35092, true }, + { 35107, true }, { 35126, true }, - { 35137, true }, - { 35150, true }, - { 35163, true }, - { 35177, true }, - { 35192, true }, - { 35211, true }, - { 35227, true }, - { 35239, true }, - { 35249, true }, - { 35260, false }, - { 35282, true }, - { 35290, true }, - { 35305, true }, - { 35322, true }, - { 35336, true }, - { 35353, true }, - { 35368, true }, - { 35386, true }, - { 35410, true }, - { 35426, true }, - { 35442, true }, - { 35457, true }, - { 35478, true }, - { 35487, true }, - { 35502, true }, - { 35515, false }, - { 35525, true }, - { 35544, true }, - { 35558, true }, - { 35578, true }, - { 35593, true }, - { 35602, true }, - { 35620, false }, - { 35642, true }, - { 35661, true }, - { 35673, false }, - { 35689, false }, - { 35703, true }, - { 35719, true }, - { 35738, true }, - { 35750, true }, - { 35765, true }, - { 35783, true }, - { 35798, true }, - { 35810, true }, - { 35828, true }, - { 35848, true }, - { 35870, true }, - { 35888, true }, - { 35905, true }, - { 35920, true }, - { 35935, true }, - { 35952, false }, - { 35968, true }, - { 35982, true }, - { 35996, true }, - { 36015, true }, - { 36032, true }, - { 36051, true }, - { 36066, true }, - { 36093, true }, - { 36113, true }, - { 36135, true }, - { 36156, true }, - { 36179, true }, - { 36199, true }, - { 36217, true }, - { 36235, true }, - { 36254, true }, + { 35142, true }, + { 35154, true }, + { 35164, true }, + { 35175, false }, + { 35197, true }, + { 35205, true }, + { 35220, true }, + { 35237, true }, + { 35251, true }, + { 35268, true }, + { 35283, true }, + { 35301, true }, + { 35325, true }, + { 35341, true }, + { 35357, true }, + { 35372, true }, + { 35393, true }, + { 35402, true }, + { 35417, true }, + { 35430, false }, + { 35440, true }, + { 35459, true }, + { 35473, true }, + { 35493, true }, + { 35508, true }, + { 35517, true }, + { 35535, false }, + { 35557, true }, + { 35576, true }, + { 35588, false }, + { 35604, false }, + { 35618, true }, + { 35634, true }, + { 35653, true }, + { 35665, true }, + { 35680, true }, + { 35698, true }, + { 35713, true }, + { 35725, true }, + { 35743, true }, + { 35763, true }, + { 35785, true }, + { 35803, true }, + { 35820, true }, + { 35835, true }, + { 35850, true }, + { 35867, false }, + { 35883, true }, + { 35897, true }, + { 35911, true }, + { 35930, true }, + { 35947, true }, + { 35966, true }, + { 35981, true }, + { 36008, true }, + { 36028, true }, + { 36050, true }, + { 36071, true }, + { 36094, true }, + { 36114, true }, + { 36132, true }, + { 36150, true }, + { 36169, true }, + { 36191, true }, + { 36210, true }, + { 36230, true }, + { 36253, true }, { 36276, true }, - { 36295, true }, - { 36315, true }, - { 36338, true }, - { 36361, true }, - { 36375, true }, - { 36392, true }, - { 36406, true }, - { 36420, true }, - { 36433, true }, - { 36470, false }, - { 36481, true }, - { 36499, true }, - { 36519, true }, - { 36542, true }, - { 36567, true }, + { 36290, true }, + { 36307, true }, + { 36321, true }, + { 36335, true }, + { 36348, true }, + { 36385, false }, + { 36396, true }, + { 36414, true }, + { 36434, true }, + { 36457, true }, + { 36482, true }, + { 36513, true }, + { 36527, true }, + { 36538, true }, + { 36550, true }, + { 36559, true }, + { 36571, true }, + { 36588, true }, { 36598, true }, - { 36612, true }, - { 36623, true }, + { 36616, false }, + { 36624, true }, { 36635, true }, - { 36644, true }, - { 36656, true }, - { 36673, true }, - { 36683, true }, - { 36701, false }, - { 36709, true }, - { 36720, true }, - { 36734, true }, - { 36753, true }, - { 36764, false }, - { 36782, true }, - { 36795, true }, - { 36808, true }, - { 36825, true }, - { 36839, true }, - { 36850, true }, - { 36864, true }, - { 36876, true }, - { 36891, true }, - { 36899, true }, - { 36913, true }, - { 36925, true }, - { 36937, true }, + { 36649, true }, + { 36668, true }, + { 36679, false }, + { 36697, true }, + { 36710, true }, + { 36723, true }, + { 36740, true }, + { 36754, true }, + { 36765, true }, + { 36779, true }, + { 36791, true }, + { 36806, true }, + { 36814, true }, + { 36828, true }, + { 36840, true }, + { 36852, true }, + { 36862, true }, + { 36873, true }, + { 36884, true }, + { 36898, true }, + { 36921, true }, + { 36929, true }, { 36947, true }, - { 36958, true }, - { 36969, true }, - { 36983, true }, - { 37006, true }, - { 37014, true }, - { 37032, true }, - { 37047, true }, + { 36962, true }, + { 36981, true }, + { 36993, true }, + { 37009, true }, + { 37019, true }, + { 37038, true }, + { 37051, true }, { 37066, true }, - { 37078, true }, - { 37094, true }, - { 37104, true }, - { 37123, true }, - { 37136, true }, + { 37074, true }, + { 37089, true }, + { 37101, true }, + { 37109, true }, + { 37115, true }, + { 37128, true }, + { 37137, true }, { 37151, true }, - { 37159, true }, - { 37174, true }, - { 37186, true }, - { 37194, true }, - { 37200, true }, - { 37213, true }, - { 37222, true }, - { 37236, true }, - { 37250, true }, - { 37263, false }, - { 37283, true }, - { 37299, true }, - { 37310, true }, - { 37322, true }, - { 37338, true }, - { 37351, true }, - { 37371, true }, - { 37385, true }, - { 37401, true }, - { 37415, true }, + { 37165, true }, + { 37178, false }, + { 37198, true }, + { 37214, true }, + { 37225, true }, + { 37237, true }, + { 37253, true }, + { 37266, true }, + { 37286, true }, + { 37300, true }, + { 37316, true }, + { 37330, true }, + { 37350, true }, + { 37364, true }, + { 37379, true }, + { 37399, true }, + { 37413, true }, + { 37426, true }, { 37435, true }, - { 37449, true }, + { 37445, true }, { 37464, true }, - { 37484, true }, - { 37498, true }, - { 37511, true }, - { 37520, true }, - { 37530, true }, - { 37549, true }, - { 37565, true }, - { 37587, true }, - { 37619, true }, - { 37638, true }, - { 37654, true }, - { 37675, true }, + { 37480, true }, + { 37502, true }, + { 37534, true }, + { 37553, true }, + { 37569, true }, + { 37590, true }, + { 37610, true }, + { 37623, true }, + { 37643, true }, + { 37657, true }, + { 37676, true }, { 37695, true }, - { 37708, true }, - { 37728, true }, - { 37742, true }, - { 37761, true }, - { 37780, true }, - { 37794, true }, - { 37809, true }, - { 37822, true }, - { 37832, true }, - { 37845, true }, + { 37709, true }, + { 37724, true }, + { 37737, true }, + { 37747, true }, + { 37760, true }, + { 37775, true }, + { 37787, true }, + { 37802, true }, + { 37825, true }, + { 37841, true }, { 37860, true }, - { 37872, true }, - { 37887, true }, + { 37872, false }, + { 37893, true }, + { 37901, true }, { 37910, true }, - { 37926, true }, - { 37945, true }, - { 37957, false }, - { 37978, true }, - { 37986, true }, - { 37995, true }, - { 38008, true }, - { 38022, true }, - { 38031, true }, - { 38043, true }, - { 38059, true }, - { 38076, false }, - { 38086, true }, - { 38097, true }, - { 38109, true }, - { 38122, true }, - { 38141, true }, - { 38159, true }, - { 38176, true }, - { 38193, false }, - { 38203, true }, - { 38221, true }, - { 38240, true }, + { 37923, true }, + { 37937, true }, + { 37946, true }, + { 37958, true }, + { 37974, true }, + { 37991, false }, + { 38001, true }, + { 38012, true }, + { 38024, true }, + { 38037, true }, + { 38056, true }, + { 38074, true }, + { 38091, true }, + { 38108, false }, + { 38118, true }, + { 38136, true }, + { 38155, true }, + { 38169, true }, + { 38186, true }, + { 38208, true }, + { 38220, true }, + { 38233, true }, { 38254, true }, { 38271, true }, { 38293, true }, - { 38305, true }, - { 38318, true }, - { 38339, true }, - { 38356, true }, - { 38378, true }, - { 38394, true }, - { 38409, true }, - { 38423, true }, - { 38449, true }, - { 38474, true }, - { 38489, true }, - { 38502, true }, - { 38514, true }, + { 38309, true }, + { 38324, true }, + { 38338, true }, + { 38364, true }, + { 38389, true }, + { 38404, true }, + { 38417, true }, + { 38429, true }, + { 38439, true }, + { 38454, true }, + { 38464, true }, + { 38473, true }, + { 38487, true }, + { 38498, true }, + { 38509, true }, { 38524, true }, { 38539, true }, - { 38549, true }, - { 38558, true }, - { 38572, true }, - { 38583, true }, - { 38594, true }, - { 38609, true }, + { 38551, true }, + { 38565, true }, + { 38578, true }, + { 38589, true }, + { 38605, true }, + { 38615, true }, { 38624, true }, { 38636, true }, - { 38650, true }, - { 38663, true }, - { 38674, true }, + { 38647, true }, + { 38656, true }, + { 38672, true }, + { 38680, true }, { 38690, true }, - { 38700, true }, - { 38709, true }, - { 38721, true }, + { 38701, true }, + { 38712, false }, { 38732, true }, - { 38741, true }, - { 38757, true }, - { 38765, true }, - { 38775, true }, - { 38786, true }, - { 38797, false }, - { 38817, true }, - { 38841, true }, - { 38862, true }, - { 38870, true }, - { 38891, true }, - { 38901, true }, - { 38917, true }, - { 38931, true }, - { 38951, true }, - { 38963, false }, - { 38973, true }, - { 39003, true }, - { 39030, false }, - { 39044, true }, - { 39057, true }, - { 39076, true }, - { 39093, true }, - { 39107, false }, - { 39125, true }, - { 39133, true }, - { 39149, true }, - { 39160, true }, - { 39175, true }, - { 39194, true }, - { 39207, true }, - { 39220, true }, - { 39235, true }, - { 39255, false }, - { 39270, true }, - { 39282, true }, - { 39294, true }, - { 39306, true }, - { 39319, true }, - { 39334, true }, - { 39347, true }, - { 39360, true }, - { 39373, true }, - { 39396, true }, + { 38756, true }, + { 38777, true }, + { 38785, true }, + { 38806, true }, + { 38816, true }, + { 38832, true }, + { 38846, true }, + { 38866, true }, + { 38878, false }, + { 38888, true }, + { 38918, true }, + { 38945, false }, + { 38959, true }, + { 38972, true }, + { 38991, true }, + { 39008, true }, + { 39022, false }, + { 39040, true }, + { 39048, true }, + { 39064, true }, + { 39075, true }, + { 39090, true }, + { 39109, true }, + { 39122, true }, + { 39135, true }, + { 39150, true }, + { 39170, false }, + { 39185, true }, + { 39197, true }, + { 39209, true }, + { 39221, true }, + { 39234, true }, + { 39249, true }, + { 39262, true }, + { 39275, true }, + { 39288, true }, + { 39311, true }, + { 39335, true }, + { 39352, true }, + { 39365, true }, + { 39376, true }, + { 39388, true }, + { 39408, true }, { 39420, true }, - { 39437, true }, - { 39450, true }, - { 39461, true }, - { 39473, true }, - { 39493, true }, - { 39505, true }, - { 39519, true }, - { 39537, true }, - { 39548, true }, - { 39567, true }, - { 39584, true }, - { 39606, true }, - { 39620, true }, - { 39639, true }, - { 39649, true }, - { 39663, true }, - { 39696, true }, - { 39717, true }, - { 39729, true }, - { 39744, true }, - { 39758, true }, - { 39769, true }, - { 39783, true }, - { 39796, true }, - { 39812, true }, - { 39825, true }, - { 39845, true }, - { 39853, true }, - { 39865, false }, - { 39877, true }, - { 39888, true }, - { 39905, true }, - { 39927, true }, - { 39940, true }, - { 39960, true }, - { 39972, true }, - { 39984, true }, - { 40002, true }, - { 40016, true }, - { 40031, true }, - { 40050, true }, - { 40065, true }, - { 40079, true }, - { 40091, true }, - { 40107, true }, - { 40123, true }, + { 39434, true }, + { 39452, true }, + { 39463, true }, + { 39482, true }, + { 39499, true }, + { 39521, true }, + { 39535, true }, + { 39554, true }, + { 39564, true }, + { 39578, true }, + { 39611, true }, + { 39632, true }, + { 39644, true }, + { 39659, true }, + { 39673, true }, + { 39684, true }, + { 39698, true }, + { 39711, true }, + { 39727, true }, + { 39740, true }, + { 39760, true }, + { 39768, true }, + { 39780, false }, + { 39792, true }, + { 39803, true }, + { 39820, true }, + { 39842, true }, + { 39855, true }, + { 39875, true }, + { 39887, true }, + { 39899, true }, + { 39917, true }, + { 39931, true }, + { 39946, true }, + { 39965, true }, + { 39980, true }, + { 39994, true }, + { 40006, true }, + { 40022, true }, + { 40038, true }, + { 40059, true }, + { 40078, true }, + { 40105, true }, + { 40124, true }, { 40144, true }, - { 40163, true }, - { 40190, true }, - { 40209, true }, - { 40229, true }, + { 40158, true }, + { 40175, true }, + { 40195, true }, + { 40208, true }, + { 40222, true }, { 40243, true }, - { 40260, true }, - { 40280, true }, - { 40293, true }, - { 40307, true }, - { 40328, true }, - { 40349, true }, - { 40362, true }, - { 40369, true }, - { 40381, true }, - { 40403, true }, - { 40419, true }, - { 40430, true }, - { 40446, true }, - { 40461, true }, + { 40264, true }, + { 40277, true }, + { 40284, true }, + { 40296, true }, + { 40318, true }, + { 40334, true }, + { 40345, true }, + { 40361, true }, + { 40376, true }, + { 40389, true }, + { 40409, true }, + { 40423, true }, + { 40438, true }, + { 40448, true }, + { 40462, true }, { 40474, true }, - { 40494, true }, - { 40508, true }, + { 40486, true }, + { 40504, true }, { 40523, true }, - { 40533, true }, - { 40547, true }, - { 40559, true }, - { 40571, true }, - { 40589, true }, - { 40608, true }, - { 40623, true }, - { 40644, false }, - { 40665, true }, - { 40685, true }, - { 40705, true }, - { 40737, true }, - { 40747, true }, - { 40760, true }, - { 40779, true }, - { 40796, false }, - { 40820, false }, - { 40842, true }, - { 40866, true }, - { 40896, true }, - { 40920, true }, - { 40936, true }, - { 40953, true }, - { 40965, true }, - { 40980, true }, - { 40997, true }, - { 41011, true }, - { 41033, true }, - { 41058, true }, - { 41071, true }, - { 41086, true }, - { 41101, true }, - { 41123, true }, - { 41139, false }, - { 41164, true }, - { 41188, true }, - { 41209, true }, - { 41223, true }, - { 41238, true }, - { 41254, true }, - { 41273, true }, - { 41290, true }, - { 41308, true }, - { 41332, false }, - { 41354, true }, - { 41367, true }, - { 41378, true }, - { 41390, true }, - { 41404, true }, - { 41422, true }, + { 40538, true }, + { 40559, false }, + { 40580, true }, + { 40600, true }, + { 40620, true }, + { 40652, true }, + { 40662, true }, + { 40675, true }, + { 40694, true }, + { 40711, false }, + { 40735, false }, + { 40757, true }, + { 40781, true }, + { 40811, true }, + { 40835, true }, + { 40851, true }, + { 40868, true }, + { 40880, true }, + { 40898, true }, + { 40913, true }, + { 40930, true }, + { 40944, true }, + { 40966, true }, + { 40991, true }, + { 41004, true }, + { 41019, true }, + { 41034, true }, + { 41056, true }, + { 41072, false }, + { 41097, true }, + { 41121, true }, + { 41145, true }, + { 41166, true }, + { 41180, true }, + { 41195, true }, + { 41211, true }, + { 41230, true }, + { 41247, true }, + { 41265, true }, + { 41289, false }, + { 41311, true }, + { 41324, true }, + { 41335, true }, + { 41347, true }, + { 41361, true }, + { 41379, true }, + { 41398, true }, + { 41413, true }, { 41441, true }, { 41456, true }, - { 41484, true }, - { 41499, true }, - { 41522, true }, - { 41535, true }, - { 41546, true }, - { 41559, true }, - { 41577, true }, - { 41599, true }, - { 41624, true }, + { 41479, true }, + { 41492, true }, + { 41503, true }, + { 41516, true }, + { 41534, true }, + { 41556, true }, + { 41581, true }, + { 41604, true }, + { 41618, true }, + { 41631, true }, { 41647, true }, - { 41661, true }, - { 41674, true }, - { 41690, true }, - { 41703, true }, - { 41721, true }, - { 41731, true }, - { 41744, true }, - { 41771, true }, - { 41789, true }, - { 41810, true }, - { 41825, true }, + { 41660, true }, + { 41678, true }, + { 41688, true }, + { 41701, true }, + { 41728, true }, + { 41746, true }, + { 41767, true }, + { 41782, true }, + { 41806, true }, + { 41824, true }, { 41849, true }, - { 41867, true }, - { 41892, true }, - { 41907, false }, - { 41930, true }, - { 41939, true }, - { 41960, true }, - { 41977, true }, - { 41988, true }, - { 42001, false }, - { 42040, true }, - { 42051, true }, - { 42064, true }, - { 42076, true }, - { 42092, true }, - { 42106, false }, - { 42121, false }, - { 42137, true }, - { 42156, true }, - { 42167, true }, - { 42180, true }, + { 41864, false }, + { 41887, true }, + { 41896, true }, + { 41917, true }, + { 41934, true }, + { 41945, true }, + { 41958, false }, + { 41997, true }, + { 42008, true }, + { 42021, true }, + { 42033, true }, + { 42049, true }, + { 42063, false }, + { 42078, true }, + { 42098, false }, + { 42114, true }, + { 42133, true }, + { 42144, true }, + { 42157, true }, + { 42169, true }, { 42192, true }, - { 42215, true }, - { 42227, true }, - { 42236, true }, - { 42246, true }, - { 42260, true }, - { 42275, true }, - { 42289, true }, - { 42305, true }, - { 42321, true }, - { 42338, true }, - { 42350, true }, - { 42364, true }, + { 42204, true }, + { 42213, true }, + { 42223, true }, + { 42237, true }, + { 42252, true }, + { 42266, true }, + { 42282, true }, + { 42298, true }, + { 42315, true }, + { 42327, true }, + { 42341, true }, + { 42353, true }, { 42376, true }, - { 42399, true }, - { 42424, true }, - { 42441, true }, - { 42450, true }, - { 42467, true }, - { 42479, true }, - { 42494, true }, - { 42511, true }, - { 42530, true }, - { 42543, false }, - { 42561, true }, - { 42573, true }, - { 42592, true }, - { 42604, true }, - { 42634, true }, - { 42648, true }, - { 42672, true }, - { 42695, true }, - { 42709, true }, - { 42722, true }, - { 42734, true }, - { 42756, true }, - { 42776, true }, - { 42801, true }, - { 42813, true }, - { 42836, true }, - { 42855, true }, - { 42866, true }, - { 42880, true }, - { 42892, true }, - { 42908, true }, - { 42926, true }, - { 42944, true }, - { 42962, true }, - { 42978, true }, - { 42995, true }, - { 43024, true }, - { 43037, true }, - { 43048, true }, - { 43066, true }, - { 43084, true }, - { 43107, true }, - { 43124, false }, - { 43139, true }, - { 43151, true }, - { 43163, true }, - { 43176, true }, - { 43185, true }, - { 43200, true }, - { 43219, true }, - { 43233, true }, - { 43245, true }, - { 43257, true }, - { 43271, false }, - { 43288, true }, - { 43299, true }, - { 43312, true }, - { 43329, true }, - { 43348, false }, - { 43361, true }, - { 43379, true }, - { 43405, true }, - { 43422, true }, - { 43441, true }, - { 43456, true }, - { 43471, true }, - { 43485, true }, - { 43502, true }, - { 43518, true }, - { 43537, true }, - { 43556, true }, - { 43576, true }, - { 43592, true }, - { 43608, true }, - { 43622, true }, - { 43632, true }, - { 43640, true }, - { 43666, true }, - { 43683, true }, - { 43704, true }, - { 43722, true }, - { 43741, true }, - { 43755, true }, - { 43774, true }, - { 43786, true }, - { 43802, false }, - { 43821, true }, - { 43835, true }, - { 43844, true }, - { 43861, true }, - { 43875, true }, - { 43890, true }, - { 43905, true }, - { 43922, true }, - { 43933, true }, - { 43951, true }, - { 43972, true }, - { 43983, true }, - { 43992, true }, - { 44011, true }, - { 44024, true }, - { 44039, true }, - { 44061, true }, - { 44075, false }, - { 44089, true }, - { 44105, true }, - { 44117, true }, - { 44134, true }, - { 44146, true }, - { 44161, true }, - { 44173, true }, - { 44196, true }, - { 44208, true }, - { 44231, true }, - { 44250, true }, - { 44266, true }, - { 44281, true }, - { 44291, true }, - { 44301, true }, - { 44308, true }, - { 44319, true }, - { 44336, true }, - { 44350, true }, - { 44371, true }, - { 44380, true }, - { 44388, true }, - { 44402, false }, - { 44413, true }, - { 44429, false }, - { 44439, false }, - { 44455, true }, - { 44468, true }, - { 44482, true }, - { 44497, true }, - { 44513, true }, - { 44535, true }, - { 44549, true }, - { 44563, true }, - { 44578, true }, - { 44593, true }, - { 44618, true }, - { 44638, true }, - { 44654, true }, - { 44667, true }, - { 44681, true }, - { 44694, true }, - { 44724, true }, - { 44736, true }, - { 44751, true }, - { 44761, true }, - { 44777, true }, - { 44785, false }, - { 44797, true }, - { 44808, true }, - { 44817, true }, - { 44827, true }, - { 44842, true }, - { 44859, true }, - { 44875, true }, - { 44891, true }, - { 44904, true }, - { 44921, true }, - { 44930, true }, - { 44938, true }, - { 44946, true }, - { 44957, true }, - { 44966, true }, - { 44980, true }, - { 44993, true }, - { 45001, true }, - { 45019, true }, - { 45028, true }, - { 45037, true }, - { 45045, true }, - { 45060, true }, - { 45068, true }, - { 45088, true }, - { 45111, true }, - { 45124, true }, - { 45138, true }, - { 45157, true }, - { 45176, true }, - { 45190, true }, - { 45199, true }, - { 45219, true }, - { 45242, true }, + { 42401, true }, + { 42421, true }, + { 42438, true }, + { 42447, true }, + { 42464, true }, + { 42476, true }, + { 42491, true }, + { 42508, true }, + { 42527, true }, + { 42540, false }, + { 42558, true }, + { 42570, true }, + { 42589, true }, + { 42601, true }, + { 42631, true }, + { 42645, true }, + { 42669, true }, + { 42692, true }, + { 42706, true }, + { 42719, true }, + { 42731, true }, + { 42753, true }, + { 42773, true }, + { 42798, true }, + { 42810, true }, + { 42833, true }, + { 42852, true }, + { 42863, true }, + { 42877, true }, + { 42889, true }, + { 42905, true }, + { 42923, true }, + { 42941, true }, + { 42959, true }, + { 42975, true }, + { 42992, true }, + { 43021, true }, + { 43034, true }, + { 43045, true }, + { 43063, true }, + { 43081, true }, + { 43104, true }, + { 43121, false }, + { 43136, true }, + { 43148, true }, + { 43160, true }, + { 43173, true }, + { 43182, true }, + { 43197, true }, + { 43216, true }, + { 43230, true }, + { 43242, true }, + { 43254, true }, + { 43268, false }, + { 43285, true }, + { 43296, true }, + { 43309, true }, + { 43326, true }, + { 43345, false }, + { 43358, true }, + { 43376, true }, + { 43402, true }, + { 43419, true }, + { 43438, true }, + { 43453, true }, + { 43468, true }, + { 43482, true }, + { 43499, true }, + { 43515, true }, + { 43534, true }, + { 43553, true }, + { 43573, true }, + { 43589, true }, + { 43605, true }, + { 43619, true }, + { 43629, true }, + { 43637, true }, + { 43663, true }, + { 43680, true }, + { 43701, true }, + { 43719, true }, + { 43738, true }, + { 43752, true }, + { 43771, true }, + { 43783, true }, + { 43799, false }, + { 43818, true }, + { 43832, true }, + { 43841, true }, + { 43858, true }, + { 43872, true }, + { 43887, true }, + { 43902, true }, + { 43919, true }, + { 43930, true }, + { 43948, true }, + { 43969, true }, + { 43980, true }, + { 43989, true }, + { 44008, true }, + { 44021, true }, + { 44036, true }, + { 44058, true }, + { 44072, false }, + { 44086, true }, + { 44102, true }, + { 44114, true }, + { 44131, true }, + { 44143, true }, + { 44158, true }, + { 44170, true }, + { 44193, true }, + { 44205, true }, + { 44228, true }, + { 44247, true }, + { 44263, true }, + { 44278, true }, + { 44288, true }, + { 44298, true }, + { 44305, true }, + { 44316, true }, + { 44333, true }, + { 44347, true }, + { 44368, true }, + { 44377, true }, + { 44385, true }, + { 44399, false }, + { 44410, true }, + { 44426, false }, + { 44436, false }, + { 44452, true }, + { 44465, true }, + { 44479, true }, + { 44494, true }, + { 44510, true }, + { 44532, true }, + { 44546, true }, + { 44560, true }, + { 44575, true }, + { 44590, true }, + { 44615, true }, + { 44635, true }, + { 44651, true }, + { 44664, true }, + { 44678, true }, + { 44691, true }, + { 44721, true }, + { 44733, true }, + { 44748, true }, + { 44758, true }, + { 44774, true }, + { 44782, false }, + { 44794, true }, + { 44805, true }, + { 44814, true }, + { 44824, true }, + { 44839, true }, + { 44856, true }, + { 44872, true }, + { 44885, true }, + { 44901, true }, + { 44914, true }, + { 44931, true }, + { 44940, true }, + { 44948, true }, + { 44956, true }, + { 44967, true }, + { 44976, true }, + { 44990, true }, + { 45003, true }, + { 45011, true }, + { 45029, true }, + { 45038, true }, + { 45047, true }, + { 45055, true }, + { 45070, true }, + { 45078, true }, + { 45098, true }, + { 45121, true }, + { 45134, true }, + { 45148, true }, + { 45167, true }, + { 45186, true }, + { 45200, true }, + { 45209, true }, + { 45229, true }, { 45252, true }, { 45262, true }, - { 45280, true }, - { 45300, true }, - { 45313, true }, - { 45327, true }, - { 45343, true }, + { 45272, true }, + { 45290, true }, + { 45310, true }, + { 45323, true }, + { 45337, true }, { 45353, true }, - { 45364, true }, + { 45363, true }, { 45374, true }, - { 45391, true }, - { 45407, true }, - { 45414, true }, - { 45423, true }, - { 45442, true }, - { 45455, true }, - { 45468, true }, - { 45479, true }, - { 45486, true }, - { 45497, true }, - { 45508, true }, - { 45516, true }, - { 45530, true }, - { 45550, true }, - { 45571, true }, - { 45586, true }, - { 45608, true }, - { 45620, false }, - { 45642, true }, - { 45661, true }, - { 45677, true }, - { 45695, true }, - { 45710, true }, - { 45727, true }, - { 45742, true }, - { 45761, true }, - { 45773, true }, - { 45793, true }, - { 45810, true }, - { 45824, true }, - { 45833, true }, - { 45845, true }, + { 45384, true }, + { 45401, true }, + { 45417, true }, + { 45424, true }, + { 45433, true }, + { 45452, true }, + { 45465, true }, + { 45478, true }, + { 45489, true }, + { 45496, true }, + { 45507, true }, + { 45518, true }, + { 45526, true }, + { 45540, true }, + { 45560, true }, + { 45581, true }, + { 45596, true }, + { 45618, true }, + { 45630, false }, + { 45652, true }, + { 45671, true }, + { 45687, true }, + { 45705, true }, + { 45720, true }, + { 45737, true }, + { 45752, true }, + { 45771, true }, + { 45783, true }, + { 45803, true }, + { 45820, true }, + { 45834, true }, + { 45843, true }, { 45855, true }, - { 45864, true }, - { 45873, true }, - { 45882, true }, - { 45891, true }, + { 45865, true }, + { 45874, true }, + { 45883, true }, + { 45892, true }, { 45901, true }, { 45911, true }, - { 45920, true }, - { 45929, true }, - { 45947, true }, - { 45963, true }, - { 45971, true }, - { 45978, true }, - { 45991, true }, - { 46008, true }, - { 46022, true }, - { 46029, true }, + { 45921, true }, + { 45930, true }, + { 45939, true }, + { 45957, true }, + { 45973, true }, + { 45981, true }, + { 45988, true }, + { 46001, true }, + { 46018, true }, + { 46032, true }, { 46039, true }, - { 46050, true }, - { 46067, true }, - { 46084, true }, - { 46104, true }, - { 46123, false }, - { 46137, true }, - { 46155, true }, - { 46168, true }, - { 46185, true }, - { 46199, true }, - { 46213, true }, - { 46230, true }, - { 46256, true }, - { 46270, true }, - { 46287, true }, - { 46302, true }, - { 46316, true }, - { 46331, true }, - { 46342, true }, - { 46355, true }, - { 46369, true }, + { 46049, true }, + { 46060, true }, + { 46077, true }, + { 46094, true }, + { 46114, true }, + { 46133, false }, + { 46147, true }, + { 46165, true }, + { 46178, true }, + { 46195, true }, + { 46209, true }, + { 46223, true }, + { 46240, true }, + { 46266, true }, + { 46280, true }, + { 46297, true }, + { 46312, true }, + { 46326, true }, + { 46341, true }, + { 46352, true }, + { 46365, true }, { 46379, true }, - { 46390, true }, - { 46409, true }, - { 46424, true }, - { 46439, true }, - { 46466, true }, + { 46389, true }, + { 46400, true }, + { 46419, true }, + { 46434, true }, + { 46449, true }, { 46476, true }, - { 46488, true }, - { 46499, true }, - { 46511, true }, - { 46519, true }, - { 46530, true }, - { 46538, true }, + { 46486, true }, + { 46498, true }, + { 46509, true }, + { 46521, true }, + { 46529, true }, + { 46540, true }, { 46549, true }, - { 46576, true }, - { 46586, true }, - { 46597, true }, - { 46608, true }, - { 46618, true }, - { 46632, true }, - { 46646, true }, - { 46657, true }, - { 46664, true }, - { 46672, true }, - { 46688, true }, - { 46702, true }, - { 46718, true }, - { 46732, true }, - { 46741, true }, - { 46753, true }, + { 46557, true }, + { 46568, true }, + { 46595, true }, + { 46605, true }, + { 46616, true }, + { 46627, true }, + { 46637, true }, + { 46651, true }, + { 46665, true }, + { 46676, true }, + { 46683, true }, + { 46691, true }, + { 46707, true }, + { 46721, true }, + { 46737, true }, + { 46751, true }, { 46760, true }, - { 46767, true }, - { 46783, true }, - { 46795, true }, - { 46809, true }, - { 46831, true }, - { 46842, true }, - { 46853, true }, - { 46864, true }, - { 46875, true }, - { 46891, true }, - { 46908, true }, - { 46921, true }, - { 46947, false }, - { 46970, true }, - { 46986, true }, - { 46996, true }, - { 47009, true }, + { 46772, true }, + { 46779, true }, + { 46786, true }, + { 46802, true }, + { 46814, true }, + { 46828, true }, + { 46850, true }, + { 46861, true }, + { 46872, true }, + { 46883, true }, + { 46894, true }, + { 46910, true }, + { 46927, true }, + { 46940, true }, + { 46966, false }, + { 46989, true }, + { 47005, true }, + { 47015, true }, { 47028, true }, - { 47041, true }, - { 47052, true }, - { 47067, true }, - { 47085, true }, - { 47097, false }, - { 47109, true }, - { 47123, true }, - { 47135, true }, - { 47149, true }, - { 47162, true }, - { 47180, true }, - { 47193, true }, + { 47047, true }, + { 47060, true }, + { 47071, true }, + { 47086, true }, + { 47104, true }, + { 47116, false }, + { 47128, true }, + { 47142, true }, + { 47154, true }, + { 47168, true }, + { 47181, true }, + { 47199, true }, { 47212, true }, - { 47222, true }, - { 47233, true }, - { 47246, true }, - { 47263, true }, - { 47281, true }, - { 47297, true }, - { 47310, true }, - { 47328, true }, - { 47342, true }, + { 47231, true }, + { 47241, true }, + { 47252, true }, + { 47265, true }, + { 47282, true }, + { 47300, true }, + { 47316, true }, + { 47329, true }, + { 47347, true }, { 47361, true }, - { 47378, true }, - { 47396, true }, - { 47411, true }, - { 47432, true }, - { 47453, true }, - { 47469, true }, - { 47485, true }, - { 47504, false }, - { 47525, false }, - { 47545, true }, - { 47565, true }, - { 47585, true }, - { 47601, true }, - { 47618, true }, + { 47380, true }, + { 47397, true }, + { 47415, true }, + { 47430, true }, + { 47451, true }, + { 47472, true }, + { 47488, true }, + { 47504, true }, + { 47523, false }, + { 47544, false }, + { 47564, true }, + { 47584, true }, + { 47604, true }, + { 47620, true }, { 47637, true }, - { 47655, true }, - { 47675, true }, - { 47691, true }, - { 47702, false }, - { 47712, true }, - { 47721, true }, - { 47739, true }, - { 47753, true }, - { 47771, false }, - { 47783, true }, - { 47796, true }, - { 47811, true }, - { 47826, true }, - { 47841, true }, - { 47849, true }, - { 47867, true }, - { 47901, true }, - { 47912, true }, - { 47925, false }, - { 47939, true }, - { 47957, true }, - { 47975, true }, - { 47986, true }, - { 48001, true }, - { 48012, true }, - { 48026, true }, - { 48041, true }, - { 48058, true }, - { 48070, true }, - { 48099, true }, - { 48132, true }, - { 48144, true }, - { 48156, true }, - { 48173, true }, - { 48188, true }, - { 48200, true }, - { 48212, true }, - { 48227, false }, - { 48239, true }, - { 48248, true }, - { 48260, true }, - { 48277, true }, - { 48292, false }, - { 48306, true }, - { 48326, true }, - { 48344, false }, - { 48358, true }, - { 48369, true }, - { 48382, true }, - { 48392, false }, - { 48408, true }, - { 48422, true }, - { 48436, true }, - { 48447, true }, - { 48467, true }, - { 48480, true }, - { 48496, true }, - { 48509, true }, - { 48520, true }, - { 48537, true }, - { 48563, true }, - { 48583, true }, - { 48597, true }, - { 48614, false }, - { 48628, true }, - { 48642, false }, - { 48659, true }, - { 48675, true }, - { 48688, true }, - { 48715, true }, + { 47656, true }, + { 47674, true }, + { 47694, true }, + { 47710, true }, + { 47721, false }, + { 47731, true }, + { 47740, true }, + { 47758, true }, + { 47772, true }, + { 47790, false }, + { 47802, true }, + { 47815, true }, + { 47830, true }, + { 47845, true }, + { 47860, true }, + { 47868, true }, + { 47886, true }, + { 47920, true }, + { 47931, true }, + { 47944, false }, + { 47958, true }, + { 47976, true }, + { 47994, true }, + { 48005, true }, + { 48020, true }, + { 48031, true }, + { 48045, true }, + { 48060, true }, + { 48077, true }, + { 48089, true }, + { 48118, true }, + { 48151, true }, + { 48163, true }, + { 48175, true }, + { 48192, true }, + { 48207, true }, + { 48219, true }, + { 48231, true }, + { 48246, false }, + { 48258, true }, + { 48267, true }, + { 48279, true }, + { 48296, true }, + { 48311, false }, + { 48325, true }, + { 48345, true }, + { 48363, false }, + { 48377, true }, + { 48388, true }, + { 48401, true }, + { 48411, false }, + { 48427, true }, + { 48441, true }, + { 48455, true }, + { 48466, true }, + { 48486, true }, + { 48499, true }, + { 48515, true }, + { 48528, true }, + { 48539, true }, + { 48556, true }, + { 48582, true }, + { 48602, true }, + { 48616, true }, + { 48633, false }, + { 48647, true }, + { 48661, false }, + { 48678, true }, + { 48694, true }, + { 48707, true }, { 48734, true }, - { 48745, true }, - { 48760, true }, - { 48772, true }, - { 48787, true }, - { 48802, true }, - { 48817, true }, - { 48839, true }, - { 48857, true }, - { 48873, true }, - { 48890, true }, - { 48910, true }, - { 48924, true }, - { 48940, true }, - { 48958, true }, + { 48753, true }, + { 48764, true }, + { 48779, true }, + { 48791, true }, + { 48806, true }, + { 48821, true }, + { 48836, true }, + { 48858, true }, + { 48876, true }, + { 48892, true }, + { 48909, true }, + { 48929, true }, + { 48943, true }, + { 48959, true }, { 48977, true }, - { 48990, true }, - { 49007, true }, - { 49020, true }, - { 49035, true }, - { 49051, true }, + { 48996, true }, + { 49009, true }, + { 49026, true }, + { 49039, true }, + { 49054, true }, { 49070, true }, - { 49091, true }, - { 49108, true }, - { 49124, true }, - { 49136, true }, - { 49149, true }, - { 49175, true }, - { 49195, false }, - { 49206, true }, - { 49224, true }, - { 49238, true }, - { 49250, true }, - { 49258, true }, - { 49267, true }, - { 49284, true }, - { 49295, true }, - { 49307, true }, - { 49315, true }, - { 49325, true }, - { 49336, true }, - { 49357, true }, - { 49369, true }, - { 49380, true }, + { 49089, true }, + { 49110, true }, + { 49127, true }, + { 49143, true }, + { 49155, true }, + { 49168, true }, + { 49194, true }, + { 49214, false }, + { 49225, true }, + { 49243, true }, + { 49257, true }, + { 49269, true }, + { 49277, true }, + { 49286, true }, + { 49303, true }, + { 49314, true }, + { 49326, true }, + { 49334, true }, + { 49344, true }, + { 49355, true }, + { 49376, true }, { 49388, true }, - { 49395, true }, - { 49403, true }, + { 49399, true }, + { 49407, true }, { 49414, true }, - { 49430, true }, - { 49440, true }, - { 49451, true }, - { 49467, true }, - { 49480, true }, - { 49495, true }, - { 49512, true }, - { 49534, true }, - { 49555, true }, - { 49563, true }, - { 49576, true }, - { 49586, true }, - { 49600, true }, - { 49611, false }, - { 49631, true }, - { 49646, true }, - { 49659, true }, - { 49671, true }, - { 49692, true }, - { 49706, true }, - { 49720, true }, - { 49737, true }, - { 49752, true }, - { 49766, true }, - { 49780, true }, - { 49794, true }, - { 49808, true }, - { 49822, true }, - { 49837, true }, - { 49851, true }, - { 49866, true }, - { 49876, true }, - { 49889, true }, - { 49902, true }, - { 49923, true }, - { 49935, true }, - { 49950, true }, - { 49967, true }, - { 49980, true }, - { 49995, true }, - { 50007, true }, - { 50022, true }, - { 50039, true }, + { 49422, true }, + { 49433, true }, + { 49449, true }, + { 49459, true }, + { 49470, true }, + { 49486, true }, + { 49499, true }, + { 49514, true }, + { 49531, true }, + { 49553, true }, + { 49574, true }, + { 49582, true }, + { 49595, true }, + { 49605, true }, + { 49619, true }, + { 49630, false }, + { 49650, true }, + { 49665, true }, + { 49678, true }, + { 49690, true }, + { 49711, true }, + { 49725, true }, + { 49739, true }, + { 49756, true }, + { 49771, true }, + { 49785, true }, + { 49799, true }, + { 49813, true }, + { 49827, true }, + { 49841, true }, + { 49856, true }, + { 49868, true }, + { 49882, true }, + { 49900, true }, + { 49915, true }, + { 49925, true }, + { 49938, true }, + { 49951, true }, + { 49972, true }, + { 49984, true }, + { 49999, true }, + { 50016, true }, + { 50029, true }, + { 50044, true }, { 50056, true }, - { 50064, true }, - { 50076, true }, - { 50085, true }, + { 50071, true }, + { 50088, true }, { 50105, true }, - { 50116, true }, - { 50131, true }, - { 50147, true }, + { 50113, true }, + { 50125, true }, + { 50134, true }, { 50154, true }, - { 50177, true }, - { 50191, true }, - { 50206, true }, - { 50221, true }, - { 50236, true }, - { 50247, true }, - { 50257, true }, - { 50266, true }, - { 50278, true }, - { 50289, true }, - { 50300, true }, - { 50313, true }, - { 50323, true }, - { 50339, true }, - { 50354, true }, - { 50370, true }, - { 50387, true }, - { 50404, true }, - { 50418, true }, - { 50433, true }, - { 50449, true }, - { 50464, true }, - { 50474, true }, - { 50487, true }, - { 50499, true }, - { 50527, true }, - { 50539, true }, - { 50553, true }, - { 50567, true }, - { 50578, true }, - { 50594, true }, - { 50605, true }, - { 50618, true }, - { 50629, true }, - { 50651, true }, - { 50671, true }, - { 50692, true }, - { 50707, true }, - { 50721, true }, - { 50736, true }, - { 50750, true }, - { 50762, true }, - { 50772, true }, - { 50791, true }, - { 50808, true }, - { 50821, true }, - { 50835, true }, + { 50165, true }, + { 50180, true }, + { 50196, true }, + { 50203, true }, + { 50226, true }, + { 50240, true }, + { 50255, true }, + { 50270, true }, + { 50285, true }, + { 50296, true }, + { 50306, true }, + { 50315, true }, + { 50327, true }, + { 50338, true }, + { 50349, true }, + { 50362, true }, + { 50372, true }, + { 50388, true }, + { 50403, true }, + { 50419, true }, + { 50436, true }, + { 50453, true }, + { 50467, true }, + { 50482, true }, + { 50498, true }, + { 50513, true }, + { 50523, true }, + { 50536, true }, + { 50548, true }, + { 50576, true }, + { 50588, true }, + { 50602, true }, + { 50616, true }, + { 50627, true }, + { 50643, true }, + { 50654, true }, + { 50667, true }, + { 50678, true }, + { 50700, true }, + { 50720, true }, + { 50741, true }, + { 50756, true }, + { 50770, true }, + { 50785, true }, + { 50799, true }, + { 50811, true }, + { 50830, true }, { 50847, true }, { 50860, true }, - { 50872, true }, - { 50885, true }, - { 50898, true }, - { 50909, true }, - { 50927, true }, - { 50945, true }, - { 50958, true }, - { 50970, true }, + { 50874, true }, + { 50886, true }, + { 50899, true }, + { 50911, true }, + { 50924, true }, + { 50937, true }, + { 50948, true }, + { 50966, true }, { 50984, true }, - { 50998, true }, - { 51006, true }, - { 51035, true }, - { 51054, true }, - { 51067, true }, - { 51092, true }, - { 51109, true }, - { 51130, true }, - { 51142, true }, - { 51159, true }, - { 51183, true }, - { 51216, true }, - { 51228, true }, - { 51250, true }, + { 50997, true }, + { 51009, true }, + { 51023, true }, + { 51037, true }, + { 51045, true }, + { 51074, true }, + { 51093, true }, + { 51106, true }, + { 51131, true }, + { 51148, true }, + { 51169, true }, + { 51181, true }, + { 51198, true }, + { 51222, true }, + { 51255, true }, { 51267, true }, - { 51282, true }, - { 51296, true }, - { 51322, true }, - { 51341, true }, - { 51354, true }, - { 51364, true }, - { 51374, true }, - { 51395, true }, - { 51404, true }, - { 51422, true }, - { 51440, true }, - { 51467, true }, - { 51492, true }, - { 51507, true }, - { 51527, true }, - { 51542, true }, - { 51557, true }, - { 51578, true }, - { 51602, true }, - { 51615, true }, - { 51644, true }, - { 51655, false }, - { 51669, true }, - { 51680, true }, - { 51694, true }, - { 51713, true }, - { 51727, true }, - { 51742, false }, - { 51757, true }, - { 51774, true }, - { 51783, true }, - { 51793, true }, - { 51831, true }, - { 51846, true }, - { 51857, true }, - { 51869, true }, - { 51887, true }, - { 51899, true }, - { 51910, true }, - { 51927, true }, - { 51935, true }, - { 51944, true }, - { 51954, true }, - { 51967, true }, - { 51977, true }, - { 51991, false }, + { 51289, true }, + { 51306, true }, + { 51321, true }, + { 51335, true }, + { 51361, true }, + { 51380, true }, + { 51393, true }, + { 51403, true }, + { 51413, true }, + { 51434, true }, + { 51443, true }, + { 51461, true }, + { 51479, true }, + { 51506, true }, + { 51531, true }, + { 51546, true }, + { 51566, true }, + { 51581, true }, + { 51596, true }, + { 51617, true }, + { 51641, true }, + { 51654, true }, + { 51683, true }, + { 51694, false }, + { 51708, true }, + { 51719, true }, + { 51733, true }, + { 51752, true }, + { 51766, true }, + { 51781, false }, + { 51796, true }, + { 51813, true }, + { 51822, true }, + { 51832, true }, + { 51870, true }, + { 51885, true }, + { 51896, true }, + { 51908, true }, + { 51926, true }, + { 51938, true }, + { 51949, true }, + { 51966, true }, + { 51974, true }, + { 51983, true }, + { 51993, true }, + { 52006, true }, { 52016, true }, - { 52034, false }, - { 52058, true }, - { 52072, true }, - { 52091, true }, - { 52118, true }, + { 52030, false }, + { 52055, true }, + { 52073, false }, + { 52097, true }, + { 52111, true }, { 52130, true }, - { 52142, true }, - { 52150, true }, - { 52159, true }, - { 52173, true }, - { 52190, true }, - { 52205, false }, - { 52217, true }, + { 52157, true }, + { 52169, true }, + { 52181, true }, + { 52189, true }, + { 52198, true }, + { 52212, true }, { 52229, true }, - { 52246, true }, - { 52258, true }, - { 52270, true }, - { 52280, true }, - { 52291, true }, - { 52303, true }, - { 52316, true }, + { 52244, false }, + { 52256, true }, + { 52268, true }, + { 52285, true }, + { 52297, true }, + { 52309, true }, + { 52319, true }, { 52330, true }, - { 52347, true }, - { 52358, true }, - { 52376, false }, - { 52396, true }, - { 52408, true }, - { 52420, true }, - { 52431, true }, - { 52443, true }, - { 52452, true }, - { 52462, true }, - { 52475, true }, - { 52497, true }, - { 52511, true }, - { 52520, true }, - { 52532, true }, - { 52539, true }, - { 52551, true }, - { 52560, true }, - { 52569, true }, - { 52579, true }, - { 52593, true }, - { 52610, true }, - { 52621, true }, - { 52635, true }, - { 52644, true }, - { 52653, true }, - { 52663, true }, - { 52677, true }, - { 52686, true }, - { 52701, true }, - { 52713, true }, - { 52729, true }, - { 52745, true }, - { 52762, true }, - { 52779, true }, - { 52789, true }, - { 52811, true }, - { 52820, true }, - { 52832, true }, - { 52846, true }, - { 52860, true }, - { 52875, true }, - { 52908, true }, - { 52936, true }, - { 52961, true }, - { 52970, true }, - { 52986, true }, - { 52998, true }, + { 52342, true }, + { 52355, true }, + { 52369, true }, + { 52386, true }, + { 52397, true }, + { 52415, false }, + { 52435, true }, + { 52447, true }, + { 52459, true }, + { 52470, true }, + { 52482, true }, + { 52491, true }, + { 52501, true }, + { 52514, true }, + { 52536, true }, + { 52550, true }, + { 52559, true }, + { 52571, true }, + { 52578, true }, + { 52590, true }, + { 52599, true }, + { 52608, true }, + { 52618, true }, + { 52632, true }, + { 52649, true }, + { 52660, true }, + { 52674, true }, + { 52683, true }, + { 52692, true }, + { 52702, true }, + { 52716, true }, + { 52725, true }, + { 52740, true }, + { 52752, true }, + { 52768, true }, + { 52784, true }, + { 52801, true }, + { 52818, true }, + { 52828, true }, + { 52850, true }, + { 52859, true }, + { 52871, true }, + { 52885, true }, + { 52899, true }, + { 52914, true }, + { 52947, true }, + { 52975, true }, + { 53000, true }, { 53009, true }, - { 53034, true }, - { 53049, true }, - { 53071, true }, - { 53096, true }, - { 53127, true }, - { 53138, true }, - { 53154, true }, - { 53168, true }, + { 53025, true }, + { 53037, true }, + { 53048, true }, + { 53073, true }, + { 53088, true }, + { 53110, true }, + { 53135, true }, + { 53166, true }, { 53177, true }, - { 53195, true }, - { 53209, true }, - { 53224, false }, - { 53241, true }, - { 53259, true }, - { 53272, true }, - { 53282, true }, - { 53305, true }, - { 53317, true }, - { 53332, true }, - { 53347, true }, - { 53358, true }, - { 53372, true }, + { 53193, true }, + { 53207, true }, + { 53216, true }, + { 53234, true }, + { 53248, true }, + { 53263, false }, + { 53280, true }, + { 53298, true }, + { 53311, true }, + { 53321, true }, + { 53344, true }, + { 53356, true }, + { 53371, true }, { 53386, true }, - { 53399, true }, + { 53397, true }, { 53411, true }, - { 53423, true }, - { 53435, true }, - { 53448, true }, - { 53459, true }, - { 53475, true }, - { 53488, true }, - { 53500, false }, - { 53517, true }, - { 53537, true }, - { 53554, true }, - { 53572, true }, - { 53588, true }, - { 53603, true }, - { 53618, true }, - { 53641, true }, - { 53667, true }, - { 53682, true }, - { 53702, false }, - { 53720, true }, - { 53739, true }, - { 53756, true }, - { 53775, true }, - { 53788, true }, - { 53805, true }, - { 53815, false }, - { 53832, true }, - { 53851, true }, - { 53868, true }, - { 53882, true }, - { 53899, true }, + { 53425, true }, + { 53438, true }, + { 53450, true }, + { 53462, true }, + { 53474, true }, + { 53487, true }, + { 53498, true }, + { 53514, true }, + { 53527, true }, + { 53539, false }, + { 53556, true }, + { 53576, true }, + { 53593, true }, + { 53611, true }, + { 53627, true }, + { 53642, true }, + { 53657, true }, + { 53680, true }, + { 53706, true }, + { 53721, true }, + { 53741, false }, + { 53759, true }, + { 53778, true }, + { 53795, true }, + { 53814, true }, + { 53827, true }, + { 53844, true }, + { 53854, false }, + { 53871, true }, + { 53890, true }, { 53907, true }, - { 53918, true }, - { 53930, true }, - { 53940, true }, - { 53951, true }, - { 53961, true }, - { 53971, true }, - { 53984, true }, - { 53998, true }, - { 54009, true }, - { 54022, true }, - { 54041, false }, - { 54049, true }, - { 54060, true }, - { 54073, true }, - { 54086, true }, - { 54105, true }, - { 54121, true }, - { 54145, true }, - { 54157, true }, - { 54171, true }, - { 54185, true }, + { 53921, true }, + { 53938, true }, + { 53946, true }, + { 53957, true }, + { 53969, true }, + { 53979, true }, + { 53990, true }, + { 54000, true }, + { 54010, true }, + { 54023, true }, + { 54037, true }, + { 54048, true }, + { 54061, true }, + { 54080, false }, + { 54088, true }, + { 54099, true }, + { 54112, true }, + { 54125, true }, + { 54144, true }, + { 54160, true }, + { 54184, true }, { 54196, true }, { 54210, true }, - { 54222, true }, - { 54237, true }, - { 54253, true }, - { 54265, true }, - { 54280, true }, - { 54298, true }, - { 54313, true }, - { 54327, true }, - { 54349, true }, - { 54364, true }, - { 54380, true }, - { 54394, true }, - { 54415, true }, - { 54431, true }, - { 54450, true }, - { 54469, true }, - { 54486, false }, - { 54506, true }, - { 54536, true }, - { 54562, true }, - { 54579, true }, + { 54224, true }, + { 54235, true }, + { 54249, true }, + { 54261, true }, + { 54276, true }, + { 54292, true }, + { 54304, true }, + { 54319, true }, + { 54337, true }, + { 54352, true }, + { 54366, true }, + { 54388, true }, + { 54403, true }, + { 54419, true }, + { 54433, true }, + { 54454, true }, + { 54470, true }, + { 54489, true }, + { 54508, true }, + { 54525, false }, + { 54545, true }, + { 54575, true }, { 54601, true }, - { 54617, true }, - { 54637, true }, - { 54651, true }, - { 54674, true }, - { 54693, true }, - { 54711, true }, - { 54726, true }, - { 54737, true }, - { 54748, true }, - { 54758, true }, + { 54618, true }, + { 54640, true }, + { 54656, true }, + { 54676, true }, + { 54690, true }, + { 54713, true }, + { 54732, true }, + { 54750, true }, + { 54765, true }, { 54776, true }, - { 54795, true }, - { 54805, true }, - { 54823, true }, - { 54832, false }, - { 54843, false }, - { 54863, true }, - { 54871, true }, - { 54886, true }, - { 54900, true }, - { 54913, true }, - { 54923, true }, - { 54932, true }, - { 54952, true }, - { 54961, false }, - { 54976, true }, - { 54985, false }, - { 54994, true }, - { 55010, true }, - { 55027, true }, - { 55036, true }, - { 55043, true }, - { 55051, true }, - { 55063, true }, - { 55072, true }, + { 54787, true }, + { 54797, true }, + { 54815, true }, + { 54834, true }, + { 54844, true }, + { 54862, true }, + { 54871, false }, + { 54882, false }, + { 54902, true }, + { 54917, true }, + { 54931, true }, + { 54944, true }, + { 54954, true }, + { 54963, true }, + { 54983, true }, + { 54992, false }, + { 55007, true }, + { 55016, false }, + { 55025, true }, + { 55041, true }, + { 55058, true }, + { 55067, true }, + { 55074, true }, { 55082, true }, - { 55099, true }, - { 55109, true }, - { 55117, true }, - { 55125, true }, - { 55132, true }, - { 55143, true }, + { 55094, true }, + { 55103, true }, + { 55113, true }, + { 55130, true }, + { 55140, true }, + { 55148, true }, { 55156, true }, { 55163, true }, - { 55173, true }, - { 55188, true }, - { 55203, true }, - { 55216, true }, - { 55228, true }, - { 55243, true }, - { 55254, true }, - { 55264, true }, - { 55272, true }, - { 55281, true }, - { 55289, true }, + { 55174, true }, + { 55187, true }, + { 55194, true }, + { 55204, true }, + { 55219, true }, + { 55234, true }, + { 55247, true }, + { 55259, true }, + { 55274, true }, + { 55285, true }, + { 55295, true }, { 55303, true }, - { 55315, true }, - { 55330, true }, - { 55337, true }, - { 55347, true }, - { 55364, true }, - { 55374, true }, - { 55390, true }, - { 55406, true }, - { 55425, true }, - { 55439, true }, - { 55455, true }, - { 55468, true }, - { 55483, true }, - { 55494, true }, - { 55506, true }, - { 55531, false }, - { 55540, true }, - { 55553, true }, - { 55562, true }, - { 55578, true }, - { 55588, true }, - { 55601, true }, - { 55622, true }, - { 55631, true }, - { 55646, true }, - { 55660, true }, - { 55674, true }, - { 55686, true }, - { 55708, true }, - { 55719, true }, - { 55731, true }, - { 55742, true }, - { 55756, true }, - { 55776, true }, - { 55790, true }, - { 55813, true }, - { 55829, true }, - { 55837, true }, - { 55851, true }, - { 55866, true }, + { 55312, true }, + { 55320, true }, + { 55334, true }, + { 55346, true }, + { 55361, true }, + { 55368, true }, + { 55378, true }, + { 55395, true }, + { 55405, true }, + { 55421, true }, + { 55437, true }, + { 55456, true }, + { 55470, true }, + { 55486, true }, + { 55499, true }, + { 55514, true }, + { 55525, true }, + { 55537, true }, + { 55562, false }, + { 55571, true }, + { 55584, true }, + { 55593, true }, + { 55609, true }, + { 55619, true }, + { 55632, true }, + { 55653, true }, + { 55662, true }, + { 55677, true }, + { 55691, true }, + { 55705, true }, + { 55717, true }, + { 55739, true }, + { 55750, true }, + { 55762, true }, + { 55773, true }, + { 55787, true }, + { 55807, true }, + { 55821, true }, + { 55844, true }, + { 55860, true }, + { 55868, true }, { 55883, true }, - { 55897, true }, - { 55916, true }, - { 55932, true }, - { 55943, true }, - { 55954, true }, - { 55966, true }, - { 55987, false }, - { 56003, true }, + { 55900, true }, + { 55914, true }, + { 55933, true }, + { 55949, true }, + { 55960, true }, + { 55971, true }, + { 55983, true }, + { 56004, false }, { 56020, true }, - { 56038, true }, - { 56059, true }, - { 56074, true }, - { 56092, true }, - { 56107, true }, - { 56135, true }, - { 56145, true }, - { 56155, true }, - { 56174, false }, - { 56186, true }, - { 56200, true }, - { 56213, true }, - { 56232, true }, - { 56248, true }, - { 56262, true }, - { 56277, true }, - { 56300, true }, - { 56313, true }, + { 56037, true }, + { 56055, true }, + { 56076, true }, + { 56091, true }, + { 56109, true }, + { 56124, true }, + { 56152, true }, + { 56162, true }, + { 56172, true }, + { 56191, false }, + { 56203, true }, + { 56217, true }, + { 56230, true }, + { 56249, true }, + { 56265, true }, + { 56279, true }, + { 56294, true }, + { 56317, true }, { 56330, true }, - { 56339, true }, - { 56354, true }, - { 56375, true }, - { 56390, true }, - { 56406, true }, - { 56419, true }, - { 56432, true }, - { 56444, true }, - { 56469, true }, - { 56483, true }, - { 56494, true }, + { 56347, true }, + { 56356, true }, + { 56371, true }, + { 56392, true }, + { 56407, true }, + { 56423, true }, + { 56436, true }, + { 56449, true }, + { 56461, true }, + { 56486, true }, + { 56500, true }, { 56511, true }, { 56528, true }, - { 56539, true }, - { 56553, true }, - { 56560, true }, - { 56569, true }, - { 56588, true }, - { 56603, true }, - { 56614, true }, - { 56638, true }, - { 56649, true }, - { 56659, true }, - { 56672, true }, - { 56684, true }, - { 56695, true }, - { 56706, true }, - { 56718, true }, - { 56739, true }, - { 56753, true }, - { 56768, true }, + { 56545, true }, + { 56556, true }, + { 56570, true }, + { 56577, true }, + { 56586, true }, + { 56605, true }, + { 56620, true }, + { 56631, true }, + { 56655, true }, + { 56666, true }, + { 56676, true }, + { 56689, true }, + { 56701, true }, + { 56712, true }, + { 56723, true }, + { 56735, true }, + { 56756, true }, + { 56770, true }, { 56785, true }, - { 56800, true }, - { 56812, true }, + { 56802, true }, + { 56817, true }, { 56829, true }, - { 56845, true }, - { 56866, true }, + { 56846, true }, + { 56862, true }, { 56883, true }, - { 56912, true }, - { 56926, true }, - { 56937, false }, - { 56960, false }, - { 56974, true }, - { 56988, true }, - { 57006, true }, - { 57021, true }, - { 57037, true }, - { 57054, true }, - { 57071, true }, - { 57088, true }, - { 57099, true }, - { 57117, true }, - { 57136, true }, - { 57159, true }, - { 57173, true }, - { 57192, true }, - { 57211, true }, - { 57225, true }, - { 57236, true }, - { 57246, true }, - { 57259, true }, - { 57275, true }, - { 57295, true }, - { 57315, true }, - { 57335, false }, - { 57353, true }, - { 57382, true }, - { 57398, true }, - { 57414, true }, + { 56900, true }, + { 56929, true }, + { 56943, true }, + { 56954, false }, + { 56977, false }, + { 56991, true }, + { 57000, true }, + { 57014, true }, + { 57032, true }, + { 57047, true }, + { 57063, true }, + { 57080, true }, + { 57097, true }, + { 57114, true }, + { 57125, true }, + { 57143, true }, + { 57162, true }, + { 57185, true }, + { 57199, true }, + { 57218, true }, + { 57237, true }, + { 57251, true }, + { 57262, true }, + { 57272, true }, + { 57285, true }, + { 57301, true }, + { 57321, true }, + { 57341, true }, + { 57361, false }, + { 57379, true }, + { 57408, true }, { 57424, true }, { 57440, true }, - { 57455, true }, - { 57464, true }, - { 57479, true }, - { 57491, true }, - { 57499, true }, - { 57513, true }, - { 57528, true }, - { 57541, true }, - { 57553, true }, - { 57568, true }, - { 57584, false }, + { 57450, true }, + { 57466, true }, + { 57481, true }, + { 57490, true }, + { 57505, true }, + { 57517, true }, + { 57525, true }, + { 57539, true }, + { 57554, true }, + { 57567, true }, + { 57579, true }, { 57594, true }, - { 57611, true }, - { 57624, true }, - { 57642, true }, - { 57664, true }, - { 57686, true }, - { 57704, true }, - { 57715, true }, - { 57724, true }, - { 57745, true }, - { 57757, true }, - { 57778, true }, - { 57790, true }, - { 57803, true }, - { 57818, true }, - { 57830, true }, - { 57847, true }, - { 57856, true }, - { 57871, true }, - { 57901, true }, - { 57939, true }, - { 57970, true }, - { 58002, true }, - { 58030, true }, - { 58064, true }, - { 58094, true }, - { 58124, true }, - { 58159, true }, - { 58188, true }, - { 58224, true }, - { 58236, true }, - { 58250, true }, - { 58266, true }, - { 58276, true }, - { 58286, true }, - { 58301, true }, - { 58323, true }, - { 58337, true }, - { 58347, true }, - { 58367, true }, - { 58378, true }, - { 58394, true }, - { 58412, true }, - { 58420, true }, - { 58434, true }, - { 58449, true }, - { 58457, true }, - { 58466, true }, - { 58489, true }, - { 58500, true }, - { 58515, true }, - { 58533, true }, - { 58545, true }, - { 58561, true }, - { 58576, false }, - { 58589, true }, + { 57610, false }, + { 57620, true }, + { 57637, true }, + { 57650, true }, + { 57668, true }, + { 57690, true }, + { 57712, true }, + { 57730, true }, + { 57741, true }, + { 57750, true }, + { 57771, true }, + { 57783, false }, + { 57796, true }, + { 57817, true }, + { 57829, true }, + { 57842, true }, + { 57857, true }, + { 57869, true }, + { 57886, true }, + { 57895, true }, + { 57910, true }, + { 57940, true }, + { 57978, true }, + { 58009, true }, + { 58041, true }, + { 58069, true }, + { 58103, true }, + { 58133, true }, + { 58163, true }, + { 58198, true }, + { 58227, true }, + { 58263, true }, + { 58275, true }, + { 58289, true }, + { 58305, true }, + { 58315, true }, + { 58325, true }, + { 58340, true }, + { 58362, true }, + { 58376, true }, + { 58386, true }, + { 58406, true }, + { 58417, true }, + { 58433, true }, + { 58451, true }, + { 58459, true }, + { 58473, true }, + { 58488, true }, + { 58496, true }, + { 58505, true }, + { 58528, true }, + { 58539, true }, + { 58554, true }, + { 58572, true }, + { 58584, true }, { 58600, true }, - { 58615, true }, - { 58632, true }, - { 58643, true }, - { 58652, true }, - { 58661, true }, - { 58677, true }, - { 58687, false }, - { 58706, true }, - { 58720, true }, - { 58738, true }, - { 58746, true }, - { 58755, true }, - { 58765, true }, - { 58775, true }, - { 58790, true }, - { 58800, true }, - { 58821, true }, - { 58830, true }, - { 58846, true }, - { 58856, true }, - { 58875, true }, - { 58888, true }, - { 58906, true }, - { 58926, true }, - { 58946, true }, - { 58954, true }, - { 58967, true }, - { 58978, true }, - { 58996, true }, + { 58615, false }, + { 58628, true }, + { 58639, true }, + { 58654, true }, + { 58671, true }, + { 58682, true }, + { 58691, true }, + { 58700, true }, + { 58716, true }, + { 58726, false }, + { 58745, true }, + { 58759, true }, + { 58777, true }, + { 58785, true }, + { 58794, true }, + { 58804, true }, + { 58814, true }, + { 58829, true }, + { 58839, true }, + { 58860, true }, + { 58869, true }, + { 58885, true }, + { 58895, true }, + { 58914, true }, + { 58927, true }, + { 58945, true }, + { 58965, true }, + { 58985, true }, + { 58993, true }, { 59006, true }, - { 59015, true }, - { 59024, true }, + { 59017, true }, { 59035, true }, - { 59043, true }, - { 59053, true }, - { 59065, true }, - { 59075, true }, - { 59090, true }, - { 59097, true }, - { 59110, true }, - { 59134, false }, + { 59045, true }, + { 59054, true }, + { 59063, true }, + { 59074, true }, + { 59082, true }, + { 59092, true }, + { 59104, true }, + { 59114, true }, + { 59129, true }, + { 59136, true }, { 59149, true }, - { 59169, true }, - { 59189, true }, + { 59173, false }, + { 59188, true }, { 59208, true }, - { 59225, true }, - { 59236, true }, - { 59251, true }, - { 59261, true }, - { 59271, true }, - { 59287, true }, - { 59297, true }, - { 59314, true }, - { 59324, true }, - { 59338, true }, - { 59355, true }, - { 59376, true }, - { 59385, true }, - { 59401, true }, - { 59421, true }, - { 59434, true }, - { 59444, true }, - { 59456, true }, - { 59465, true }, - { 59475, true }, - { 59486, true }, - { 59494, true }, - { 59501, true }, - { 59515, true }, + { 59228, true }, + { 59247, true }, + { 59264, true }, + { 59275, true }, + { 59290, true }, + { 59300, true }, + { 59310, true }, + { 59326, true }, + { 59336, true }, + { 59353, true }, + { 59363, true }, + { 59377, true }, + { 59394, true }, + { 59415, true }, + { 59424, true }, + { 59440, true }, + { 59460, true }, + { 59473, true }, + { 59483, true }, + { 59495, true }, + { 59504, true }, + { 59514, true }, + { 59525, true }, + { 59533, true }, { 59540, true }, - { 59558, true }, - { 59576, true }, - { 59590, true }, - { 59599, true }, - { 59612, true }, + { 59554, true }, + { 59579, true }, + { 59597, true }, + { 59615, true }, { 59629, true }, { 59638, true }, { 59651, true }, { 59668, true }, - { 59684, true }, - { 59701, true }, - { 59716, true }, - { 59745, true }, - { 59763, false }, - { 59776, true }, - { 59792, true }, - { 59808, true }, - { 59821, true }, - { 59834, true }, - { 59845, true }, - { 59858, true }, - { 59868, false }, - { 59886, true }, - { 59899, true }, - { 59912, true }, - { 59928, true }, - { 59947, true }, - { 59962, true }, - { 59969, true }, - { 59998, true }, - { 60020, true }, - { 60041, true }, - { 60068, true }, - { 60088, true }, - { 60096, true }, + { 59677, true }, + { 59690, true }, + { 59707, true }, + { 59723, true }, + { 59740, true }, + { 59755, true }, + { 59784, true }, + { 59802, false }, + { 59815, true }, + { 59831, true }, + { 59847, true }, + { 59860, true }, + { 59873, true }, + { 59884, true }, + { 59897, true }, + { 59907, false }, + { 59925, true }, + { 59938, true }, + { 59951, true }, + { 59967, true }, + { 59986, true }, + { 60001, true }, + { 60008, true }, + { 60037, true }, + { 60059, true }, + { 60080, true }, { 60107, true }, { 60127, true }, + { 60135, true }, { 60146, true }, - { 60161, true }, - { 60180, true }, - { 60191, true }, - { 60202, true }, - { 60220, true }, - { 60236, false }, - { 60251, true }, - { 60266, true }, - { 60283, true }, - { 60298, true }, - { 60317, true }, - { 60331, true }, - { 60349, true }, - { 60358, true }, - { 60368, true }, - { 60379, true }, - { 60395, true }, - { 60409, true }, - { 60423, true }, - { 60436, true }, - { 60449, true }, - { 60463, true }, - { 60477, true }, - { 60486, true }, - { 60497, true }, - { 60521, true }, - { 60542, true }, - { 60554, true }, - { 60565, false }, - { 60578, true }, - { 60584, true }, - { 60594, true }, - { 60603, true }, + { 60166, true }, + { 60185, true }, + { 60200, true }, + { 60219, true }, + { 60230, true }, + { 60241, true }, + { 60259, true }, + { 60275, false }, + { 60290, true }, + { 60305, true }, + { 60322, true }, + { 60337, true }, + { 60356, true }, + { 60370, true }, + { 60388, true }, + { 60397, true }, + { 60407, true }, + { 60418, true }, + { 60434, true }, + { 60448, true }, + { 60462, true }, + { 60475, true }, + { 60488, true }, + { 60502, true }, + { 60516, true }, + { 60525, true }, + { 60536, true }, + { 60560, true }, + { 60581, true }, + { 60593, true }, + { 60604, false }, { 60617, true }, - { 60627, true }, - { 60643, true }, - { 60653, true }, + { 60623, true }, + { 60633, true }, + { 60642, true }, + { 60656, true }, { 60666, true }, - { 60679, true }, - { 60691, true }, - { 60707, true }, + { 60682, true }, + { 60692, true }, + { 60705, true }, { 60718, true }, { 60730, true }, - { 60745, true }, - { 60762, true }, - { 60773, true }, - { 60785, true }, - { 60801, false }, - { 60816, true }, - { 60826, true }, - { 60845, true }, - { 60861, true }, - { 60873, true }, + { 60746, true }, + { 60757, true }, + { 60769, true }, + { 60784, true }, + { 60801, true }, + { 60812, true }, + { 60824, true }, + { 60840, false }, + { 60855, true }, + { 60865, true }, { 60884, true }, - { 60901, true }, - { 60920, true }, - { 60943, true }, - { 60960, true }, - { 60973, true }, - { 60982, false }, - { 60991, true }, - { 61002, true }, - { 61019, true }, - { 61035, true }, - { 61049, true }, - { 61063, true }, - { 61081, true }, - { 61090, true }, - { 61103, true }, + { 60900, true }, + { 60912, true }, + { 60923, true }, + { 60940, true }, + { 60959, true }, + { 60982, true }, + { 60999, true }, + { 61012, true }, + { 61021, false }, + { 61030, true }, + { 61041, true }, + { 61058, true }, + { 61074, true }, + { 61088, true }, + { 61102, true }, { 61120, true }, - { 61130, true }, + { 61129, true }, { 61142, true }, - { 61152, true }, - { 61200, true }, - { 61244, true }, - { 61282, true }, + { 61159, true }, + { 61169, true }, + { 61181, true }, + { 61191, true }, + { 61239, true }, + { 61283, true }, { 61321, true }, - { 61361, true }, - { 61405, true }, - { 61441, true }, - { 61482, true }, - { 61519, true }, - { 61563, true }, - { 61590, true }, + { 61360, true }, + { 61400, true }, + { 61444, true }, + { 61480, true }, + { 61521, true }, + { 61558, true }, { 61602, true }, - { 61611, true }, - { 61619, false }, { 61629, true }, - { 61635, true }, - { 61643, true }, - { 61661, true }, - { 61670, true }, - { 61692, true }, - { 61699, true }, - { 61710, true }, - { 61722, true }, + { 61641, true }, + { 61650, true }, + { 61658, false }, + { 61668, true }, + { 61674, true }, + { 61682, true }, + { 61700, true }, + { 61709, true }, { 61731, true }, - { 61746, true }, - { 61756, true }, - { 61765, true }, - { 61776, true }, - { 61788, true }, - { 61801, true }, - { 61817, true }, - { 61838, true }, - { 61849, true }, - { 61863, true }, - { 61873, true }, - { 61890, true }, - { 61907, true }, - { 61919, true }, - { 61942, true }, - { 61956, true }, - { 61971, true }, - { 61982, true }, - { 61998, true }, - { 62009, true }, - { 62038, true }, - { 62054, true }, - { 62082, true }, - { 62098, true }, - { 62110, false }, - { 62128, true }, - { 62136, false }, - { 62147, true }, - { 62157, true }, - { 62178, true }, - { 62188, true }, - { 62198, true }, - { 62213, true }, + { 61738, true }, + { 61749, true }, + { 61761, true }, + { 61770, true }, + { 61785, true }, + { 61795, true }, + { 61804, true }, + { 61815, true }, + { 61827, true }, + { 61840, true }, + { 61856, true }, + { 61877, true }, + { 61888, true }, + { 61902, true }, + { 61912, true }, + { 61929, true }, + { 61946, true }, + { 61958, true }, + { 61981, true }, + { 61995, true }, + { 62010, true }, + { 62021, true }, + { 62037, true }, + { 62048, true }, + { 62077, true }, + { 62093, true }, + { 62121, true }, + { 62137, true }, + { 62149, false }, + { 62167, false }, + { 62175, false }, + { 62186, true }, + { 62196, true }, + { 62217, true }, { 62227, true }, { 62237, true }, { 62252, true }, - { 62263, true }, - { 62275, true }, - { 62287, true }, - { 62300, true }, - { 62313, true }, - { 62322, true }, - { 62331, false }, - { 62343, true }, - { 62359, true }, - { 62370, true }, - { 62386, true }, - { 62405, true }, - { 62421, true }, - { 62436, true }, - { 62457, true }, - { 62488, true }, - { 62512, true }, - { 62531, true }, + { 62266, true }, + { 62276, true }, + { 62291, true }, + { 62302, true }, + { 62314, true }, + { 62326, true }, + { 62339, true }, + { 62352, true }, + { 62361, true }, + { 62370, false }, + { 62382, true }, + { 62398, true }, + { 62409, true }, + { 62425, true }, + { 62444, true }, + { 62460, true }, + { 62475, true }, + { 62496, true }, + { 62527, true }, { 62551, true }, - { 62568, true }, - { 62584, true }, - { 62599, true }, - { 62618, true }, - { 62640, true }, - { 62662, true }, - { 62684, true }, + { 62570, true }, + { 62590, true }, + { 62607, true }, + { 62623, true }, + { 62638, true }, + { 62657, true }, + { 62679, true }, { 62701, true }, - { 62716, true }, - { 62735, true }, - { 62748, true }, - { 62763, true }, - { 62778, true }, - { 62791, true }, - { 62807, true }, - { 62819, true }, - { 62832, false }, - { 62842, false }, - { 62851, true }, - { 62871, true }, - { 62886, true }, - { 62897, true }, - { 62918, true }, - { 62934, true }, - { 62958, false }, - { 62975, true }, - { 62988, true }, - { 63001, true }, + { 62723, true }, + { 62740, true }, + { 62755, true }, + { 62774, true }, + { 62787, true }, + { 62802, true }, + { 62817, true }, + { 62830, true }, + { 62846, true }, + { 62858, true }, + { 62871, false }, + { 62881, false }, + { 62890, true }, + { 62910, true }, + { 62925, true }, + { 62936, true }, + { 62957, true }, + { 62973, true }, + { 62997, false }, { 63014, true }, { 63027, true }, - { 63046, true }, - { 63057, true }, + { 63040, true }, + { 63053, true }, { 63066, true }, - { 63075, true }, { 63085, true }, - { 63098, true }, - { 63108, true }, - { 63117, true }, - { 63133, true }, - { 63149, true }, - { 63176, true }, - { 63187, true }, - { 63204, true }, - { 63217, true }, - { 63231, true }, - { 63248, true }, - { 63263, true }, - { 63286, true }, - { 63296, true }, - { 63311, true }, - { 63321, true }, - { 63341, true }, - { 63366, true }, - { 63390, true }, - { 63399, true }, - { 63416, true }, - { 63437, true }, - { 63457, true }, - { 63469, true }, - { 63482, true }, + { 63096, true }, + { 63105, true }, + { 63114, true }, + { 63124, true }, + { 63137, true }, + { 63147, true }, + { 63156, true }, + { 63172, true }, + { 63188, true }, + { 63215, true }, + { 63226, true }, + { 63243, true }, + { 63256, true }, + { 63270, true }, + { 63287, true }, + { 63302, true }, + { 63325, true }, + { 63335, true }, + { 63350, true }, + { 63360, true }, + { 63380, true }, + { 63405, true }, + { 63429, true }, + { 63438, true }, + { 63455, true }, + { 63476, true }, { 63496, true }, - { 63513, true }, - { 63530, false }, - { 63543, true }, - { 63560, true }, - { 63569, true }, - { 63580, true }, - { 63594, true }, - { 63605, true }, + { 63508, true }, + { 63521, true }, + { 63535, true }, + { 63552, true }, + { 63569, false }, + { 63582, true }, + { 63599, true }, + { 63608, true }, { 63619, true }, - { 63636, true }, - { 63645, true }, - { 63659, false }, - { 63687, true }, - { 63696, true }, - { 63705, true }, - { 63715, true }, - { 63731, true }, - { 63741, true }, - { 63753, true }, - { 63767, false }, - { 63781, false }, - { 63796, true }, - { 63820, true }, - { 63841, true }, - { 63863, true }, - { 63877, true }, - { 63887, true }, - { 63899, true }, - { 63913, true }, - { 63932, true }, - { 63949, true }, - { 63962, true }, - { 63974, true }, - { 63987, true }, - { 63999, true }, - { 64011, false }, - { 64035, true }, - { 64048, true }, - { 64058, true }, - { 64077, true }, - { 64101, true }, - { 64117, true }, - { 64127, true }, - { 64143, true }, - { 64159, true }, - { 64178, true }, - { 64196, true }, - { 64213, true }, - { 64230, true }, - { 64238, false }, - { 64264, true }, - { 64281, true }, - { 64295, true }, - { 64306, true }, - { 64318, true }, - { 64338, true }, - { 64354, true }, - { 64372, true }, - { 64382, true }, - { 64397, true }, - { 64409, true }, - { 64424, true }, - { 64442, true }, - { 64460, true }, - { 64479, true }, - { 64489, true }, - { 64503, true }, - { 64513, true }, - { 64524, true }, - { 64543, true }, - { 64559, true }, - { 64578, true }, - { 64590, true }, - { 64601, true }, - { 64611, true }, - { 64627, true }, + { 63633, true }, + { 63644, true }, + { 63658, true }, + { 63675, true }, + { 63684, true }, + { 63698, false }, + { 63726, true }, + { 63735, true }, + { 63744, true }, + { 63754, true }, + { 63770, true }, + { 63780, true }, + { 63792, true }, + { 63806, false }, + { 63820, false }, + { 63835, true }, + { 63859, true }, + { 63880, true }, + { 63902, true }, + { 63916, true }, + { 63926, true }, + { 63938, true }, + { 63952, true }, + { 63971, true }, + { 63988, true }, + { 64001, true }, + { 64013, true }, + { 64026, true }, + { 64038, true }, + { 64050, false }, + { 64074, true }, + { 64087, true }, + { 64097, true }, + { 64116, true }, + { 64140, true }, + { 64156, true }, + { 64166, true }, + { 64182, true }, + { 64198, true }, + { 64217, true }, + { 64235, true }, + { 64252, true }, + { 64269, true }, + { 64277, false }, + { 64303, true }, + { 64320, true }, + { 64334, true }, + { 64345, true }, + { 64357, true }, + { 64377, true }, + { 64393, true }, + { 64411, true }, + { 64421, true }, + { 64436, true }, + { 64448, true }, + { 64463, true }, + { 64481, true }, + { 64499, true }, + { 64518, true }, + { 64528, true }, + { 64542, true }, + { 64552, true }, + { 64563, true }, + { 64582, true }, + { 64598, true }, + { 64617, true }, + { 64629, true }, { 64640, true }, - { 64664, true }, - { 64688, true }, + { 64650, true }, + { 64666, true }, + { 64679, true }, { 64703, true }, - { 64723, true }, - { 64736, false }, - { 64748, true }, - { 64758, true }, - { 64773, true }, - { 64793, true }, - { 64803, true }, - { 64813, false }, - { 64830, true }, - { 64838, true }, - { 64854, true }, + { 64727, true }, + { 64742, true }, + { 64762, true }, + { 64775, false }, + { 64787, true }, + { 64797, true }, + { 64812, true }, + { 64832, true }, + { 64842, true }, + { 64852, false }, { 64869, true }, - { 64885, true }, - { 64901, true }, - { 64915, true }, - { 64929, true }, - { 64943, true }, - { 64955, true }, - { 64975, true }, - { 64991, true }, - { 65008, true }, - { 65018, true }, - { 65031, true }, - { 65042, true }, - { 65056, true }, - { 65069, true }, - { 65077, true }, - { 65087, true }, - { 65101, true }, - { 65113, true }, - { 65129, true }, + { 64877, true }, + { 64893, true }, + { 64908, true }, + { 64924, true }, + { 64940, true }, + { 64954, true }, + { 64968, true }, + { 64982, true }, + { 64994, true }, + { 65014, true }, + { 65030, true }, + { 65047, true }, + { 65057, true }, + { 65070, true }, + { 65081, true }, + { 65095, true }, + { 65108, true }, + { 65116, true }, + { 65126, true }, { 65140, true }, - { 65164, true }, - { 65189, true }, - { 65202, true }, - { 65215, true }, - { 65227, true }, - { 65246, true }, - { 65261, true }, - { 65274, true }, - { 65287, true }, + { 65152, true }, + { 65168, true }, + { 65179, true }, + { 65203, true }, + { 65228, true }, + { 65241, true }, + { 65254, true }, + { 65266, true }, + { 65285, true }, { 65300, true }, - { 65320, true }, - { 65335, true }, - { 65346, true }, - { 65364, true }, - { 65373, true }, - { 65384, true }, - { 65395, true }, - { 65406, true }, - { 65417, true }, - { 65427, true }, - { 65441, true }, - { 65453, true }, - { 65463, true }, - { 65477, true }, - { 65511, true }, - { 65521, true }, - { 65533, true }, - { 65542, true }, - { 65553, false }, - { 65566, true }, - { 65588, true }, - { 65595, true }, - { 65607, true }, + { 65313, true }, + { 65326, true }, + { 65339, true }, + { 65359, true }, + { 65374, true }, + { 65385, true }, + { 65403, true }, + { 65412, true }, + { 65423, true }, + { 65434, true }, + { 65445, true }, + { 65456, true }, + { 65466, true }, + { 65480, true }, + { 65492, true }, + { 65502, true }, + { 65516, true }, + { 65550, true }, + { 65560, true }, + { 65569, false }, + { 65582, true }, + { 65604, true }, + { 65611, true }, { 65623, true }, - { 65640, true }, - { 65662, true }, - { 65675, false }, - { 65695, true }, - { 65708, true }, - { 65720, true }, - { 65733, true }, - { 65748, true }, - { 65767, true }, - { 65778, true }, - { 65802, false }, - { 65823, true }, - { 65833, true }, - { 65842, true }, - { 65857, true }, - { 65870, true }, - { 65881, true }, - { 65890, true }, - { 65903, true }, - { 65916, true }, - { 65925, true }, - { 65937, true }, - { 65946, true }, - { 65955, true }, - { 65969, true }, - { 65987, true }, - { 66009, true }, - { 66029, false }, - { 66054, true }, - { 66067, true }, - { 66076, true }, - { 66097, true }, - { 66118, true }, - { 66128, true }, - { 66140, true }, - { 66165, true }, + { 65639, true }, + { 65656, true }, + { 65678, true }, + { 65691, false }, + { 65711, true }, + { 65724, true }, + { 65736, true }, + { 65749, true }, + { 65764, true }, + { 65783, true }, + { 65794, true }, + { 65818, false }, + { 65839, true }, + { 65849, true }, + { 65858, true }, + { 65873, true }, + { 65886, true }, + { 65897, true }, + { 65906, true }, + { 65919, true }, + { 65932, true }, + { 65941, true }, + { 65953, true }, + { 65962, true }, + { 65971, true }, + { 65985, true }, + { 66003, true }, + { 66025, true }, + { 66045, false }, + { 66070, true }, + { 66083, true }, + { 66092, true }, + { 66113, true }, + { 66134, true }, + { 66144, true }, + { 66156, true }, { 66181, true }, - { 66192, true }, - { 66205, true }, - { 66220, true }, - { 66234, true }, - { 66243, true }, - { 66261, true }, - { 66295, true }, - { 66305, true }, - { 66323, true }, - { 66334, true }, - { 66360, false }, - { 66375, true }, - { 66390, true }, - { 66400, true }, - { 66409, true }, - { 66421, true }, - { 66431, true }, - { 66440, true }, - { 66454, false }, - { 66465, true }, - { 66473, true }, - { 66482, true }, - { 66490, true }, - { 66501, true }, - { 66510, true }, - { 66522, true }, - { 66536, true }, - { 66550, true }, - { 66570, true }, - { 66582, true }, - { 66600, true }, + { 66197, true }, + { 66208, true }, + { 66221, true }, + { 66236, true }, + { 66250, true }, + { 66259, true }, + { 66277, true }, + { 66311, true }, + { 66321, true }, + { 66339, true }, + { 66350, true }, + { 66376, false }, + { 66391, true }, + { 66406, true }, + { 66416, true }, + { 66425, true }, + { 66437, true }, + { 66447, true }, + { 66456, true }, + { 66470, false }, + { 66481, true }, + { 66489, true }, + { 66498, true }, + { 66506, true }, + { 66517, true }, + { 66526, true }, + { 66538, true }, + { 66552, true }, + { 66566, true }, + { 66586, true }, + { 66598, true }, { 66616, true }, - { 66630, true }, - { 66647, true }, - { 66660, true }, - { 66670, true }, - { 66684, true }, - { 66696, true }, - { 66710, true }, - { 66723, true }, - { 66736, true }, - { 66749, true }, - { 66759, true }, - { 66766, true }, + { 66632, true }, + { 66646, true }, + { 66663, true }, + { 66676, true }, + { 66686, true }, + { 66700, true }, + { 66712, true }, + { 66726, true }, + { 66739, true }, + { 66752, true }, + { 66765, true }, { 66775, true }, - { 66794, true }, - { 66808, true }, - { 66822, true }, - { 66835, true }, + { 66782, true }, + { 66791, true }, + { 66810, true }, + { 66824, true }, + { 66838, true }, { 66851, true }, - { 66874, true }, - { 66883, true }, - { 66897, true }, - { 66912, true }, - { 66926, true }, - { 66940, true }, - { 66954, true }, - { 66968, true }, - { 66982, true }, - { 66996, true }, - { 67010, true }, - { 67027, true }, - { 67047, true }, - { 67059, true }, - { 67074, true }, - { 67093, true }, - { 67107, true }, - { 67125, true }, - { 67143, true }, - { 67150, true }, - { 67164, true }, - { 67176, true }, - { 67193, true }, - { 67211, true }, - { 67230, true }, - { 67240, true }, - { 67260, true }, - { 67273, true }, - { 67283, true }, - { 67297, false }, - { 67314, true }, - { 67327, true }, - { 67340, true }, - { 67353, true }, - { 67363, true }, - { 67375, true }, - { 67387, true }, - { 67400, false }, - { 67415, true }, - { 67428, true }, - { 67441, true }, - { 67455, true }, - { 67472, true }, - { 67484, true }, - { 67503, true }, - { 67515, true }, - { 67527, true }, - { 67536, true }, - { 67547, true }, - { 67561, true }, - { 67574, true }, - { 67599, true }, - { 67622, false }, - { 67632, true }, - { 67643, true }, - { 67656, true }, - { 67667, true }, - { 67676, true }, - { 67686, true }, - { 67697, true }, - { 67717, true }, - { 67737, true }, - { 67755, true }, - { 67774, true }, - { 67797, true }, - { 67815, true }, - { 67832, true }, - { 67844, true }, - { 67858, true }, - { 67881, true }, - { 67891, true }, - { 67906, true }, - { 67920, true }, - { 67936, true }, - { 67949, true }, - { 67957, true }, - { 67969, true }, - { 67983, true }, - { 68005, true }, - { 68012, true }, - { 68025, true }, - { 68038, true }, - { 68058, true }, - { 68076, true }, - { 68098, true }, - { 68111, true }, - { 68126, true }, - { 68137, true }, - { 68151, true }, - { 68164, true }, - { 68177, true }, - { 68196, true }, - { 68212, true }, - { 68231, true }, - { 68250, true }, - { 68265, true }, - { 68277, true }, - { 68284, true }, - { 68300, true }, - { 68327, true }, - { 68355, true }, - { 68379, true }, - { 68398, true }, - { 68415, true }, - { 68436, true }, - { 68455, true }, - { 68473, true }, - { 68491, true }, - { 68503, true }, - { 68512, true }, - { 68535, true }, - { 68549, true }, - { 68562, true }, - { 68574, true }, - { 68584, true }, - { 68595, false }, - { 68605, true }, - { 68625, true }, - { 68638, true }, - { 68647, true }, - { 68659, true }, - { 68675, true }, - { 68685, true }, - { 68692, true }, - { 68709, true }, - { 68722, true }, - { 68731, true }, - { 68744, true }, - { 68757, true }, - { 68775, true }, - { 68791, true }, - { 68807, true }, - { 68818, true }, - { 68832, true }, - { 68849, true }, - { 68859, true }, - { 68886, true }, - { 68921, true }, - { 68933, false }, - { 68946, true }, - { 68959, true }, - { 68978, true }, - { 69003, true }, - { 69025, true }, - { 69040, true }, - { 69060, false }, - { 69070, true }, - { 69089, true }, - { 69106, true }, - { 69123, true }, - { 69133, true }, - { 69143, true }, - { 69156, true }, - { 69171, true }, - { 69184, true }, - { 69199, true }, - { 69215, true }, - { 69228, true }, - { 69241, true }, - { 69255, true }, - { 69270, true }, - { 69282, true }, - { 69295, true }, - { 69314, true }, - { 69338, true }, - { 69360, true }, - { 69381, true }, - { 69406, true }, - { 69429, true }, - { 69449, true }, - { 69460, true }, - { 69472, true }, - { 69484, true }, - { 69504, true }, - { 69521, true }, - { 69542, true }, - { 69560, true }, - { 69583, true }, - { 69599, true }, - { 69619, true }, - { 69632, true }, - { 69647, true }, - { 69657, true }, - { 69674, true }, - { 69685, true }, - { 69704, true }, - { 69714, true }, - { 69724, true }, - { 69732, true }, - { 69746, true }, - { 69759, true }, - { 69772, true }, - { 69781, true }, - { 69788, true }, - { 69795, false }, - { 69811, true }, - { 69820, true }, - { 69837, true }, - { 69852, true }, - { 69866, true }, - { 69878, true }, - { 69890, true }, - { 69913, true }, - { 69927, true }, - { 69942, true }, - { 69958, true }, - { 69970, true }, - { 69986, true }, - { 70003, true }, - { 70021, true }, - { 70042, true }, - { 70059, true }, - { 70076, true }, - { 70093, true }, - { 70110, true }, - { 70127, true }, - { 70144, true }, - { 70160, true }, - { 70174, true }, - { 70199, true }, - { 70210, true }, - { 70226, true }, - { 70242, true }, - { 70258, true }, - { 70277, false }, - { 70290, true }, - { 70300, false }, - { 70316, true }, - { 70330, true }, - { 70343, true }, - { 70353, true }, - { 70364, true }, - { 70378, true }, - { 70390, true }, - { 70404, true }, - { 70414, false }, - { 70424, true }, - { 70433, true }, - { 70443, true }, - { 70462, true }, - { 70471, true }, - { 70487, false }, - { 70507, true }, - { 70530, true }, - { 70542, true }, - { 70559, true }, - { 70578, true }, - { 70595, true }, - { 70606, false }, - { 70618, true }, - { 70629, true }, - { 70644, true }, - { 70662, true }, - { 70672, true }, - { 70680, true }, - { 70694, true }, - { 70707, true }, - { 70722, true }, - { 70736, true }, - { 70751, false }, - { 70765, true }, + { 66867, true }, + { 66890, true }, + { 66899, true }, + { 66913, true }, + { 66928, true }, + { 66942, true }, + { 66956, true }, + { 66970, true }, + { 66984, true }, + { 66998, true }, + { 67012, true }, + { 67026, true }, + { 67043, true }, + { 67063, true }, + { 67075, true }, + { 67090, true }, + { 67109, true }, + { 67123, true }, + { 67141, true }, + { 67159, true }, + { 67166, true }, + { 67180, true }, + { 67192, true }, + { 67210, true }, + { 67229, true }, + { 67239, true }, + { 67259, true }, + { 67272, true }, + { 67282, true }, + { 67296, false }, + { 67313, true }, + { 67326, true }, + { 67339, true }, + { 67352, true }, + { 67362, true }, + { 67374, true }, + { 67386, true }, + { 67399, false }, + { 67414, true }, + { 67427, true }, + { 67440, true }, + { 67454, true }, + { 67471, true }, + { 67483, true }, + { 67502, true }, + { 67514, true }, + { 67526, true }, + { 67535, true }, + { 67546, true }, + { 67560, true }, + { 67573, true }, + { 67598, true }, + { 67621, false }, + { 67631, true }, + { 67642, true }, + { 67655, true }, + { 67666, true }, + { 67675, true }, + { 67685, true }, + { 67696, true }, + { 67716, true }, + { 67736, true }, + { 67754, true }, + { 67773, true }, + { 67796, true }, + { 67814, true }, + { 67831, true }, + { 67843, true }, + { 67857, true }, + { 67880, true }, + { 67890, true }, + { 67905, true }, + { 67919, true }, + { 67935, true }, + { 67948, true }, + { 67956, true }, + { 67968, true }, + { 67982, true }, + { 68004, true }, + { 68011, true }, + { 68024, true }, + { 68037, true }, + { 68057, true }, + { 68075, true }, + { 68097, true }, + { 68110, true }, + { 68125, true }, + { 68136, true }, + { 68150, true }, + { 68163, true }, + { 68176, true }, + { 68195, true }, + { 68211, true }, + { 68230, true }, + { 68249, true }, + { 68264, true }, + { 68276, true }, + { 68283, true }, + { 68299, true }, + { 68326, true }, + { 68354, true }, + { 68378, true }, + { 68397, true }, + { 68414, true }, + { 68435, true }, + { 68454, true }, + { 68472, true }, + { 68490, true }, + { 68502, true }, + { 68511, true }, + { 68534, true }, + { 68548, true }, + { 68561, true }, + { 68573, true }, + { 68583, true }, + { 68594, false }, + { 68604, true }, + { 68624, true }, + { 68637, true }, + { 68646, true }, + { 68658, true }, + { 68674, true }, + { 68684, true }, + { 68691, true }, + { 68708, true }, + { 68721, true }, + { 68730, true }, + { 68743, true }, + { 68756, true }, + { 68774, true }, + { 68790, true }, + { 68806, true }, + { 68817, true }, + { 68831, true }, + { 68848, true }, + { 68858, true }, + { 68885, true }, + { 68920, true }, + { 68932, false }, + { 68945, true }, + { 68958, true }, + { 68977, true }, + { 69002, true }, + { 69024, true }, + { 69039, true }, + { 69059, false }, + { 69069, true }, + { 69088, true }, + { 69105, true }, + { 69122, true }, + { 69132, true }, + { 69142, true }, + { 69155, true }, + { 69170, true }, + { 69183, true }, + { 69198, true }, + { 69214, true }, + { 69227, true }, + { 69240, true }, + { 69254, true }, + { 69269, true }, + { 69281, true }, + { 69294, true }, + { 69313, true }, + { 69337, true }, + { 69359, true }, + { 69380, true }, + { 69405, true }, + { 69428, true }, + { 69448, true }, + { 69459, true }, + { 69471, true }, + { 69483, true }, + { 69503, true }, + { 69520, true }, + { 69541, true }, + { 69559, true }, + { 69582, true }, + { 69598, true }, + { 69618, true }, + { 69631, true }, + { 69646, true }, + { 69656, true }, + { 69673, true }, + { 69684, true }, + { 69703, true }, + { 69713, true }, + { 69723, true }, + { 69731, true }, + { 69745, true }, + { 69758, true }, + { 69771, true }, + { 69780, true }, + { 69787, true }, + { 69794, false }, + { 69810, true }, + { 69819, true }, + { 69836, true }, + { 69851, true }, + { 69865, true }, + { 69877, true }, + { 69889, true }, + { 69912, true }, + { 69926, true }, + { 69941, true }, + { 69957, true }, + { 69969, true }, + { 69985, true }, + { 70002, true }, + { 70020, true }, + { 70041, true }, + { 70058, true }, + { 70075, true }, + { 70092, true }, + { 70109, true }, + { 70126, true }, + { 70143, true }, + { 70159, true }, + { 70173, true }, + { 70198, true }, + { 70209, true }, + { 70225, true }, + { 70241, true }, + { 70257, true }, + { 70276, false }, + { 70289, true }, + { 70299, false }, + { 70315, true }, + { 70329, true }, + { 70342, true }, + { 70352, true }, + { 70363, true }, + { 70377, true }, + { 70389, true }, + { 70403, true }, + { 70413, false }, + { 70423, true }, + { 70432, true }, + { 70442, true }, + { 70461, true }, + { 70470, true }, + { 70486, false }, + { 70506, true }, + { 70529, true }, + { 70541, true }, + { 70558, true }, + { 70577, true }, + { 70594, true }, + { 70605, false }, + { 70617, true }, + { 70628, true }, + { 70643, true }, + { 70661, true }, + { 70671, true }, + { 70679, true }, + { 70693, true }, + { 70706, false }, + { 70719, true }, + { 70734, true }, + { 70748, true }, + { 70763, false }, { 70777, true }, - { 70791, true }, - { 70805, true }, - { 70815, true }, - { 70831, true }, - { 70847, true }, - { 70866, true }, - { 70885, false }, - { 70914, true }, - { 70928, true }, - { 70942, true }, - { 70963, true }, - { 70981, true }, - { 70996, true }, - { 71009, true }, - { 71027, true }, - { 71047, true }, + { 70789, true }, + { 70803, true }, + { 70817, true }, + { 70827, true }, + { 70843, true }, + { 70859, true }, + { 70878, true }, + { 70897, false }, + { 70926, true }, + { 70940, true }, + { 70954, true }, + { 70975, true }, + { 70993, true }, + { 71008, true }, + { 71021, true }, + { 71039, true }, { 71059, true }, - { 71074, true }, - { 71097, true }, - { 71121, true }, - { 71145, true }, - { 71169, true }, - { 71179, true }, - { 71193, true }, - { 71215, true }, - { 71247, true }, - { 71258, true }, - { 71266, true }, - { 71276, true }, + { 71071, true }, + { 71086, true }, + { 71109, true }, + { 71133, true }, + { 71157, true }, + { 71181, true }, + { 71191, true }, + { 71205, true }, + { 71227, true }, + { 71259, true }, + { 71270, true }, + { 71278, true }, { 71288, true }, - { 71303, true }, - { 71317, false }, - { 71337, true }, - { 71348, true }, - { 71366, true }, - { 71375, true }, - { 71382, true }, - { 71393, true }, - { 71402, true }, - { 71415, true }, - { 71433, true }, - { 71456, true }, - { 71471, false }, - { 71482, false }, + { 71300, true }, + { 71315, true }, + { 71329, false }, + { 71349, true }, + { 71360, true }, + { 71378, true }, + { 71387, true }, + { 71394, true }, + { 71405, true }, + { 71414, true }, + { 71427, true }, + { 71445, true }, + { 71468, true }, + { 71483, false }, { 71494, false }, { 71505, true }, { 71521, true }, @@ -21016,4497 +21020,4498 @@ static const nsSTSPreload kSTSPreloadList[] = { { 72713, true }, { 72721, false }, { 72738, true }, - { 72754, true }, - { 72773, true }, - { 72792, true }, + { 72752, true }, + { 72768, true }, + { 72787, true }, { 72806, true }, - { 72814, true }, - { 72828, true }, - { 72847, false }, - { 72865, true }, - { 72874, true }, - { 72887, true }, - { 72902, true }, - { 72922, false }, - { 72935, true }, - { 72952, true }, - { 72965, true }, - { 72978, true }, + { 72816, true }, + { 72830, true }, + { 72838, true }, + { 72852, true }, + { 72871, false }, + { 72889, true }, + { 72898, true }, + { 72911, true }, + { 72926, true }, + { 72946, false }, + { 72959, true }, + { 72976, true }, + { 72989, true }, { 73002, true }, - { 73029, true }, - { 73042, false }, - { 73056, true }, - { 73068, true }, - { 73081, true }, - { 73093, true }, - { 73108, true }, - { 73126, true }, - { 73139, true }, - { 73162, true }, - { 73185, true }, - { 73201, true }, - { 73221, true }, - { 73243, true }, - { 73259, true }, - { 73276, true }, - { 73293, true }, - { 73310, true }, + { 73026, true }, + { 73053, true }, + { 73066, false }, + { 73080, true }, + { 73092, true }, + { 73105, true }, + { 73117, true }, + { 73132, true }, + { 73150, true }, + { 73163, true }, + { 73186, true }, + { 73209, false }, + { 73220, true }, + { 73236, true }, + { 73256, true }, + { 73278, true }, + { 73294, true }, + { 73311, true }, { 73328, true }, - { 73341, true }, - { 73358, true }, - { 73373, true }, - { 73387, true }, - { 73398, true }, - { 73414, true }, - { 73423, true }, - { 73442, true }, - { 73452, true }, - { 73460, true }, - { 73469, true }, - { 73480, true }, + { 73345, true }, + { 73363, true }, + { 73376, true }, + { 73393, true }, + { 73408, true }, + { 73422, true }, + { 73433, true }, + { 73449, true }, + { 73458, true }, + { 73477, true }, + { 73487, true }, { 73495, true }, - { 73510, true }, - { 73528, true }, - { 73545, false }, - { 73556, true }, - { 73572, true }, - { 73586, true }, - { 73598, true }, - { 73606, true }, - { 73626, true }, - { 73636, true }, - { 73645, true }, + { 73504, true }, + { 73515, true }, + { 73530, true }, + { 73545, true }, + { 73563, true }, + { 73580, false }, + { 73591, true }, + { 73607, true }, + { 73621, true }, + { 73633, true }, + { 73641, true }, { 73661, true }, { 73671, true }, - { 73677, true }, - { 73689, true }, - { 73711, true }, - { 73725, true }, - { 73740, true }, - { 73751, true }, - { 73764, true }, - { 73780, true }, - { 73798, false }, - { 73811, true }, - { 73825, true }, - { 73834, true }, - { 73845, true }, - { 73856, true }, - { 73867, true }, - { 73879, true }, - { 73898, true }, - { 73906, true }, - { 73923, true }, - { 73932, true }, + { 73680, true }, + { 73696, true }, + { 73706, true }, + { 73712, true }, + { 73724, true }, + { 73746, true }, + { 73760, true }, + { 73775, true }, + { 73786, true }, + { 73799, true }, + { 73815, true }, + { 73833, false }, + { 73846, true }, + { 73860, true }, + { 73869, true }, + { 73880, true }, + { 73891, true }, + { 73902, true }, + { 73914, true }, + { 73933, true }, { 73941, true }, - { 73960, true }, - { 73971, true }, - { 73987, true }, - { 73994, true }, + { 73958, true }, + { 73967, true }, + { 73976, true }, + { 73995, true }, { 74006, true }, - { 74027, true }, - { 74044, true }, - { 74057, true }, - { 74068, true }, - { 74093, true }, - { 74108, true }, - { 74127, true }, - { 74138, true }, - { 74153, true }, - { 74165, true }, + { 74022, true }, + { 74029, true }, + { 74041, true }, + { 74062, true }, + { 74079, true }, + { 74092, true }, + { 74103, true }, + { 74128, true }, + { 74143, true }, + { 74162, false }, { 74176, true }, - { 74191, true }, - { 74207, true }, - { 74221, true }, - { 74235, true }, - { 74252, true }, - { 74272, true }, - { 74281, true }, - { 74295, true }, - { 74306, true }, - { 74326, false }, - { 74350, true }, - { 74361, false }, - { 74369, true }, - { 74387, true }, - { 74405, true }, - { 74427, true }, - { 74449, true }, - { 74474, true }, - { 74490, true }, - { 74502, true }, - { 74514, true }, - { 74535, true }, - { 74549, true }, - { 74562, false }, - { 74579, true }, - { 74588, true }, - { 74610, true }, - { 74630, true }, - { 74657, true }, - { 74676, true }, - { 74688, true }, - { 74708, true }, - { 74716, true }, + { 74187, true }, + { 74202, true }, + { 74214, true }, + { 74225, true }, + { 74240, true }, + { 74256, true }, + { 74270, true }, + { 74284, true }, + { 74301, true }, + { 74321, true }, + { 74330, true }, + { 74344, true }, + { 74355, true }, + { 74375, false }, + { 74399, true }, + { 74410, false }, + { 74418, true }, + { 74436, true }, + { 74454, true }, + { 74476, true }, + { 74498, true }, + { 74523, true }, + { 74539, true }, + { 74551, true }, + { 74563, true }, + { 74584, true }, + { 74598, true }, + { 74611, false }, + { 74628, true }, + { 74637, true }, + { 74659, true }, + { 74679, true }, + { 74706, true }, { 74725, true }, - { 74742, true }, + { 74737, true }, { 74757, true }, - { 74772, true }, - { 74801, true }, - { 74823, true }, - { 74841, true }, - { 74855, true }, - { 74870, true }, - { 74883, true }, - { 74896, true }, - { 74906, true }, - { 74922, true }, - { 74940, true }, - { 74959, true }, - { 74977, true }, + { 74765, true }, + { 74774, true }, + { 74791, true }, + { 74806, true }, + { 74821, true }, + { 74850, true }, + { 74872, true }, + { 74890, true }, + { 74904, true }, + { 74919, true }, + { 74932, true }, + { 74942, true }, + { 74958, true }, + { 74976, true }, { 74995, true }, { 75013, true }, - { 75020, false }, - { 75040, true }, + { 75031, true }, { 75049, true }, - { 75064, true }, - { 75082, true }, - { 75094, true }, - { 75103, false }, - { 75113, true }, - { 75121, true }, - { 75135, true }, - { 75152, true }, - { 75163, true }, - { 75173, true }, - { 75190, true }, - { 75212, true }, - { 75227, true }, - { 75244, true }, - { 75254, true }, - { 75267, true }, - { 75282, true }, - { 75298, true }, - { 75309, true }, - { 75321, true }, - { 75343, true }, - { 75356, true }, - { 75367, true }, - { 75383, true }, - { 75399, true }, - { 75409, true }, - { 75421, true }, - { 75429, true }, - { 75448, true }, - { 75467, true }, - { 75480, true }, - { 75497, true }, - { 75509, true }, - { 75523, true }, - { 75537, true }, - { 75549, true }, - { 75562, true }, - { 75576, true }, - { 75601, true }, - { 75615, true }, + { 75056, false }, + { 75076, true }, + { 75085, true }, + { 75100, true }, + { 75118, true }, + { 75130, true }, + { 75139, false }, + { 75149, true }, + { 75157, true }, + { 75171, true }, + { 75188, true }, + { 75199, true }, + { 75209, true }, + { 75226, true }, + { 75248, true }, + { 75263, true }, + { 75280, true }, + { 75290, true }, + { 75303, true }, + { 75318, true }, + { 75334, true }, + { 75345, true }, + { 75357, true }, + { 75379, true }, + { 75392, true }, + { 75403, true }, + { 75419, true }, + { 75435, true }, + { 75445, true }, + { 75457, true }, + { 75465, true }, + { 75484, true }, + { 75503, true }, + { 75516, true }, + { 75533, true }, + { 75545, true }, + { 75559, true }, + { 75573, true }, + { 75585, true }, + { 75598, true }, + { 75612, true }, { 75637, true }, - { 75653, true }, - { 75672, true }, - { 75685, true }, - { 75702, true }, - { 75720, true }, - { 75735, true }, - { 75750, true }, - { 75769, true }, - { 75782, true }, - { 75807, true }, - { 75820, true }, - { 75831, true }, - { 75845, true }, - { 75858, true }, - { 75876, true }, - { 75895, true }, - { 75909, true }, - { 75925, true }, - { 75937, true }, - { 75949, true }, - { 75965, true }, - { 75981, true }, - { 75994, true }, - { 76010, true }, - { 76025, true }, - { 76040, true }, - { 76054, true }, - { 76072, true }, - { 76097, true }, - { 76116, true }, - { 76129, true }, - { 76139, true }, - { 76151, true }, - { 76161, true }, - { 76177, true }, - { 76185, true }, - { 76193, true }, - { 76206, true }, - { 76217, true }, - { 76228, true }, - { 76244, true }, - { 76255, true }, - { 76267, true }, - { 76277, true }, - { 76294, false }, - { 76307, true }, - { 76320, true }, - { 76329, true }, - { 76344, true }, - { 76361, true }, - { 76375, true }, - { 76393, true }, - { 76409, true }, - { 76418, true }, - { 76427, true }, - { 76442, true }, - { 76452, true }, - { 76462, true }, - { 76476, true }, + { 75651, true }, + { 75673, true }, + { 75689, true }, + { 75708, true }, + { 75721, true }, + { 75738, true }, + { 75756, true }, + { 75771, true }, + { 75786, true }, + { 75805, true }, + { 75818, true }, + { 75843, true }, + { 75856, true }, + { 75867, true }, + { 75881, true }, + { 75894, true }, + { 75912, true }, + { 75931, true }, + { 75945, true }, + { 75961, true }, + { 75973, true }, + { 75985, true }, + { 76001, true }, + { 76017, true }, + { 76030, true }, + { 76046, true }, + { 76061, true }, + { 76076, true }, + { 76090, true }, + { 76108, true }, + { 76133, true }, + { 76152, true }, + { 76165, true }, + { 76175, true }, + { 76187, true }, + { 76197, true }, + { 76213, true }, + { 76221, true }, + { 76229, true }, + { 76242, true }, + { 76253, true }, + { 76264, true }, + { 76280, true }, + { 76291, true }, + { 76303, true }, + { 76313, true }, + { 76330, false }, + { 76343, true }, + { 76356, true }, + { 76365, true }, + { 76380, true }, + { 76397, true }, + { 76411, true }, + { 76429, true }, + { 76445, true }, + { 76454, true }, + { 76463, true }, + { 76478, true }, { 76488, true }, - { 76505, true }, - { 76519, true }, - { 76527, true }, - { 76535, true }, - { 76544, true }, - { 76556, false }, - { 76564, true }, - { 76590, true }, - { 76603, true }, - { 76617, true }, - { 76627, true }, - { 76642, true }, - { 76651, true }, - { 76662, true }, - { 76673, true }, - { 76684, true }, - { 76699, true }, - { 76712, true }, - { 76724, true }, - { 76737, true }, - { 76745, true }, - { 76759, true }, - { 76774, false }, - { 76788, true }, - { 76809, true }, - { 76820, true }, - { 76834, true }, - { 76852, true }, - { 76863, true }, - { 76877, true }, - { 76893, true }, - { 76906, true }, - { 76921, true }, - { 76934, true }, - { 76948, false }, - { 76964, true }, - { 76975, true }, - { 76994, true }, - { 77008, true }, - { 77031, true }, - { 77040, true }, - { 77054, true }, - { 77065, true }, + { 76498, true }, + { 76512, true }, + { 76524, true }, + { 76541, true }, + { 76555, true }, + { 76563, true }, + { 76571, true }, + { 76580, true }, + { 76592, false }, + { 76600, true }, + { 76626, true }, + { 76639, true }, + { 76653, true }, + { 76663, true }, + { 76678, true }, + { 76687, true }, + { 76698, true }, + { 76709, true }, + { 76720, true }, + { 76735, true }, + { 76748, true }, + { 76760, true }, + { 76773, true }, + { 76781, true }, + { 76795, true }, + { 76810, false }, + { 76824, true }, + { 76845, true }, + { 76856, true }, + { 76870, true }, + { 76888, true }, + { 76899, true }, + { 76913, true }, + { 76929, true }, + { 76942, true }, + { 76957, true }, + { 76970, true }, + { 76984, false }, + { 77000, true }, + { 77011, true }, + { 77030, true }, + { 77044, true }, + { 77067, true }, { 77076, true }, - { 77085, true }, - { 77103, true }, + { 77090, true }, + { 77101, true }, + { 77112, true }, { 77121, true }, - { 77140, true }, - { 77150, true }, - { 77163, true }, - { 77174, true }, - { 77183, true }, - { 77200, true }, - { 77220, true }, - { 77234, true }, - { 77242, true }, - { 77250, true }, - { 77260, true }, - { 77267, true }, - { 77280, true }, - { 77291, true }, - { 77305, true }, - { 77319, true }, - { 77333, true }, - { 77343, true }, - { 77353, true }, - { 77366, true }, - { 77376, true }, - { 77388, true }, - { 77395, true }, - { 77405, true }, - { 77414, true }, - { 77429, true }, - { 77436, true }, - { 77452, true }, - { 77462, true }, - { 77474, true }, - { 77484, true }, - { 77495, true }, - { 77505, true }, - { 77512, true }, - { 77521, true }, - { 77533, true }, - { 77542, true }, - { 77551, true }, - { 77565, true }, - { 77583, true }, - { 77605, true }, - { 77618, true }, - { 77627, true }, + { 77139, true }, + { 77157, true }, + { 77176, true }, + { 77186, true }, + { 77199, true }, + { 77210, true }, + { 77219, true }, + { 77236, true }, + { 77256, true }, + { 77270, true }, + { 77278, true }, + { 77286, true }, + { 77296, true }, + { 77303, true }, + { 77316, true }, + { 77327, true }, + { 77341, true }, + { 77355, true }, + { 77369, true }, + { 77379, true }, + { 77389, true }, + { 77402, true }, + { 77412, true }, + { 77424, true }, + { 77431, true }, + { 77441, true }, + { 77450, true }, + { 77465, true }, + { 77472, true }, + { 77488, true }, + { 77498, true }, + { 77510, true }, + { 77520, true }, + { 77531, true }, + { 77541, true }, + { 77548, true }, + { 77557, true }, + { 77569, true }, + { 77578, true }, + { 77587, true }, + { 77601, true }, + { 77619, true }, { 77641, true }, - { 77653, true }, - { 77663, false }, - { 77676, true }, - { 77685, true }, - { 77707, true }, - { 77730, true }, - { 77744, true }, - { 77759, true }, - { 77774, true }, - { 77790, true }, - { 77808, true }, - { 77818, true }, - { 77837, true }, - { 77856, true }, - { 77874, true }, - { 77894, true }, - { 77904, true }, - { 77915, true }, - { 77933, true }, - { 77945, true }, - { 77956, true }, - { 77972, true }, - { 77989, true }, - { 78004, true }, - { 78020, true }, - { 78035, true }, - { 78051, true }, - { 78060, true }, - { 78077, true }, - { 78089, true }, - { 78106, true }, - { 78124, true }, - { 78136, true }, - { 78153, true }, - { 78167, true }, - { 78176, true }, - { 78190, true }, - { 78205, true }, - { 78220, true }, - { 78231, true }, - { 78245, true }, - { 78260, true }, - { 78275, true }, - { 78290, true }, - { 78308, true }, - { 78321, true }, - { 78333, true }, - { 78350, true }, - { 78371, true }, - { 78395, true }, - { 78417, true }, - { 78429, true }, - { 78442, true }, - { 78457, true }, - { 78473, true }, - { 78487, true }, - { 78500, true }, - { 78518, true }, - { 78539, true }, - { 78552, false }, - { 78573, true }, - { 78586, true }, - { 78601, true }, - { 78615, true }, - { 78626, true }, + { 77654, true }, + { 77663, true }, + { 77677, true }, + { 77689, true }, + { 77699, false }, + { 77712, true }, + { 77721, true }, + { 77743, true }, + { 77766, true }, + { 77780, true }, + { 77795, true }, + { 77810, true }, + { 77826, true }, + { 77844, true }, + { 77854, true }, + { 77873, true }, + { 77892, true }, + { 77910, true }, + { 77930, true }, + { 77940, true }, + { 77951, true }, + { 77969, true }, + { 77981, true }, + { 77992, true }, + { 78008, true }, + { 78025, true }, + { 78040, true }, + { 78056, true }, + { 78071, true }, + { 78087, true }, + { 78096, true }, + { 78113, true }, + { 78125, true }, + { 78142, true }, + { 78160, true }, + { 78172, true }, + { 78189, true }, + { 78203, true }, + { 78212, true }, + { 78226, true }, + { 78241, true }, + { 78256, true }, + { 78267, true }, + { 78281, true }, + { 78296, true }, + { 78311, true }, + { 78326, true }, + { 78344, true }, + { 78357, true }, + { 78369, true }, + { 78386, true }, + { 78407, true }, + { 78431, true }, + { 78453, true }, + { 78465, true }, + { 78478, true }, + { 78493, true }, + { 78509, true }, + { 78523, true }, + { 78536, true }, + { 78554, true }, + { 78575, true }, + { 78588, false }, + { 78609, true }, + { 78622, true }, + { 78637, true }, { 78651, true }, - { 78667, true }, - { 78684, true }, - { 78701, true }, - { 78713, false }, - { 78730, true }, - { 78743, false }, - { 78754, true }, - { 78769, true }, - { 78781, false }, - { 78792, true }, - { 78806, true }, - { 78816, true }, - { 78835, true }, - { 78844, true }, - { 78851, true }, - { 78862, true }, - { 78879, true }, - { 78891, true }, - { 78900, true }, - { 78911, true }, - { 78923, true }, - { 78930, false }, - { 78937, false }, - { 78946, true }, - { 78958, true }, - { 78970, true }, - { 78981, true }, - { 79002, true }, - { 79028, true }, + { 78662, true }, + { 78687, true }, + { 78703, true }, + { 78720, true }, + { 78737, true }, + { 78749, false }, + { 78766, true }, + { 78779, false }, + { 78790, true }, + { 78805, true }, + { 78817, false }, + { 78828, true }, + { 78842, true }, + { 78852, true }, + { 78871, true }, + { 78880, true }, + { 78887, true }, + { 78898, true }, + { 78915, true }, + { 78927, true }, + { 78936, true }, + { 78947, true }, + { 78959, true }, + { 78966, false }, + { 78973, false }, + { 78982, true }, + { 78994, true }, + { 79006, true }, + { 79017, true }, { 79038, true }, - { 79047, true }, - { 79056, true }, - { 79063, true }, - { 79075, false }, - { 79087, false }, - { 79095, true }, - { 79107, true }, - { 79120, true }, - { 79134, false }, - { 79149, true }, - { 79163, true }, - { 79176, true }, - { 79188, true }, - { 79202, true }, - { 79222, true }, - { 79233, true }, - { 79243, true }, - { 79251, true }, - { 79264, true }, - { 79276, true }, + { 79064, true }, + { 79074, true }, + { 79083, true }, + { 79092, true }, + { 79099, true }, + { 79111, false }, + { 79123, false }, + { 79131, true }, + { 79143, true }, + { 79156, true }, + { 79170, false }, + { 79185, true }, + { 79199, true }, + { 79212, true }, + { 79224, true }, + { 79238, true }, + { 79258, true }, + { 79269, true }, + { 79279, true }, { 79287, true }, - { 79299, true }, - { 79309, false }, - { 79327, true }, - { 79345, true }, - { 79367, true }, - { 79389, true }, - { 79400, true }, - { 79415, true }, - { 79431, true }, - { 79442, true }, - { 79458, true }, - { 79482, true }, - { 79505, true }, - { 79523, true }, - { 79534, true }, - { 79552, true }, - { 79579, true }, - { 79599, true }, - { 79611, true }, - { 79629, true }, - { 79643, true }, - { 79659, true }, - { 79675, true }, - { 79688, true }, - { 79702, true }, - { 79716, true }, - { 79730, true }, - { 79754, true }, - { 79782, false }, - { 79793, true }, - { 79804, true }, - { 79822, true }, - { 79840, true }, - { 79861, true }, - { 79882, true }, - { 79903, true }, - { 79917, true }, - { 79930, true }, - { 79949, true }, - { 79967, true }, - { 79977, true }, - { 79995, true }, - { 80013, true }, - { 80034, true }, - { 80054, true }, - { 80064, true }, - { 80086, true }, - { 80102, true }, - { 80123, true }, - { 80139, true }, - { 80150, true }, - { 80161, true }, - { 80171, true }, - { 80181, true }, - { 80198, true }, - { 80212, false }, - { 80225, true }, - { 80237, true }, - { 80248, true }, - { 80265, true }, - { 80275, true }, - { 80289, true }, - { 80304, true }, - { 80323, true }, - { 80341, true }, - { 80361, true }, - { 80372, true }, - { 80385, true }, - { 80398, true }, - { 80408, true }, + { 79300, true }, + { 79312, true }, + { 79323, true }, + { 79335, true }, + { 79345, false }, + { 79363, true }, + { 79381, true }, + { 79403, true }, + { 79425, true }, + { 79436, true }, + { 79451, true }, + { 79467, true }, + { 79478, true }, + { 79494, true }, + { 79518, true }, + { 79541, true }, + { 79559, true }, + { 79577, true }, + { 79604, true }, + { 79624, true }, + { 79636, true }, + { 79654, true }, + { 79668, true }, + { 79684, true }, + { 79700, true }, + { 79713, true }, + { 79727, true }, + { 79741, true }, + { 79755, true }, + { 79779, true }, + { 79807, false }, + { 79818, true }, + { 79829, true }, + { 79847, true }, + { 79865, true }, + { 79886, true }, + { 79907, true }, + { 79928, true }, + { 79942, true }, + { 79955, true }, + { 79974, true }, + { 79992, true }, + { 80002, true }, + { 80020, true }, + { 80038, true }, + { 80059, true }, + { 80079, true }, + { 80089, true }, + { 80111, true }, + { 80127, true }, + { 80148, true }, + { 80164, true }, + { 80175, true }, + { 80186, true }, + { 80196, true }, + { 80206, true }, + { 80223, true }, + { 80237, false }, + { 80250, true }, + { 80262, true }, + { 80273, true }, + { 80290, true }, + { 80300, true }, + { 80314, true }, + { 80329, true }, + { 80348, true }, + { 80366, true }, + { 80386, true }, + { 80397, true }, + { 80410, true }, { 80423, true }, - { 80437, true }, - { 80449, true }, - { 80463, true }, + { 80438, true }, + { 80452, true }, + { 80464, true }, { 80478, true }, - { 80491, true }, - { 80508, true }, - { 80525, true }, - { 80539, true }, - { 80552, true }, - { 80566, true }, - { 80575, true }, - { 80594, false }, - { 80605, true }, - { 80616, true }, - { 80633, true }, - { 80642, true }, - { 80656, true }, - { 80664, true }, - { 80672, true }, + { 80493, true }, + { 80506, true }, + { 80523, true }, + { 80540, true }, + { 80554, true }, + { 80567, true }, + { 80581, true }, + { 80590, true }, + { 80609, false }, + { 80620, true }, + { 80631, true }, + { 80648, true }, + { 80657, true }, + { 80671, true }, { 80679, true }, - { 80686, true }, - { 80695, true }, - { 80714, true }, + { 80687, true }, + { 80694, true }, + { 80701, true }, + { 80710, true }, { 80729, true }, - { 80742, true }, - { 80763, true }, - { 80783, true }, - { 80800, true }, - { 80816, true }, - { 80836, true }, - { 80855, true }, - { 80876, true }, - { 80893, true }, - { 80906, true }, - { 80919, true }, - { 80933, true }, + { 80744, true }, + { 80757, true }, + { 80778, true }, + { 80798, true }, + { 80815, true }, + { 80831, true }, + { 80851, true }, + { 80870, true }, + { 80891, true }, + { 80908, true }, + { 80921, true }, + { 80934, true }, { 80948, true }, - { 80960, true }, - { 80976, false }, - { 80990, false }, - { 81003, false }, - { 81010, true }, - { 81018, true }, - { 81030, true }, - { 81040, true }, + { 80963, true }, + { 80975, true }, + { 80991, false }, + { 81005, false }, + { 81018, false }, + { 81025, true }, + { 81033, true }, + { 81045, true }, { 81055, true }, - { 81068, true }, - { 81079, true }, + { 81070, true }, + { 81083, true }, { 81094, true }, - { 81116, true }, - { 81135, true }, - { 81147, true }, - { 81159, true }, - { 81170, true }, + { 81109, true }, + { 81131, true }, + { 81150, true }, + { 81162, true }, + { 81174, true }, { 81185, true }, - { 81201, true }, - { 81219, true }, - { 81237, true }, - { 81245, true }, - { 81259, true }, - { 81269, true }, - { 81282, true }, - { 81289, true }, - { 81300, true }, - { 81312, false }, - { 81332, false }, - { 81348, true }, - { 81359, true }, + { 81200, true }, + { 81216, true }, + { 81234, true }, + { 81252, true }, + { 81260, true }, + { 81274, true }, + { 81284, true }, + { 81297, true }, + { 81304, true }, + { 81315, true }, + { 81327, false }, + { 81347, false }, + { 81363, true }, { 81374, true }, - { 81387, true }, - { 81400, true }, - { 81412, true }, - { 81425, true }, - { 81442, false }, - { 81453, false }, - { 81463, true }, + { 81389, true }, + { 81402, true }, + { 81415, true }, + { 81427, true }, + { 81440, true }, + { 81457, false }, + { 81468, false }, { 81478, true }, { 81493, true }, - { 81509, true }, - { 81538, true }, - { 81557, true }, - { 81571, true }, - { 81588, true }, - { 81614, true }, + { 81508, true }, + { 81524, true }, + { 81553, true }, + { 81572, true }, + { 81586, true }, + { 81603, true }, { 81629, true }, { 81644, true }, { 81659, true }, - { 81673, true }, - { 81692, true }, - { 81709, true }, - { 81725, true }, - { 81746, true }, - { 81763, true }, - { 81797, true }, - { 81821, true }, - { 81850, false }, - { 81865, true }, - { 81881, true }, - { 81906, true }, - { 81918, true }, - { 81932, true }, - { 81941, true }, - { 81961, false }, - { 81971, true }, + { 81674, true }, + { 81688, true }, + { 81707, true }, + { 81724, true }, + { 81740, true }, + { 81761, true }, + { 81778, true }, + { 81812, true }, + { 81836, true }, + { 81865, false }, + { 81880, true }, + { 81896, true }, + { 81921, true }, + { 81933, true }, + { 81947, true }, + { 81956, true }, + { 81976, false }, { 81986, true }, - { 81994, true }, - { 82003, true }, - { 82011, true }, - { 82019, true }, - { 82035, true }, - { 82057, true }, - { 82069, true }, - { 82081, true }, - { 82092, true }, - { 82102, true }, - { 82112, false }, - { 82124, true }, - { 82140, true }, - { 82156, true }, - { 82170, true }, - { 82186, true }, + { 82001, true }, + { 82009, true }, + { 82018, true }, + { 82026, true }, + { 82034, true }, + { 82050, true }, + { 82072, true }, + { 82084, true }, + { 82096, true }, + { 82107, true }, + { 82117, true }, + { 82127, false }, + { 82139, true }, + { 82155, true }, + { 82171, true }, + { 82185, true }, { 82201, true }, - { 82215, true }, - { 82226, true }, + { 82216, true }, + { 82230, true }, { 82241, true }, - { 82252, false }, - { 82264, true }, - { 82278, true }, - { 82289, true }, - { 82299, true }, - { 82316, true }, - { 82334, true }, - { 82344, true }, - { 82367, true }, - { 82381, true }, - { 82397, true }, - { 82410, true }, - { 82429, true }, - { 82442, true }, - { 82459, true }, - { 82477, false }, - { 82490, true }, - { 82511, true }, - { 82525, true }, - { 82535, true }, - { 82546, true }, - { 82553, false }, - { 82562, true }, - { 82578, true }, - { 82594, true }, - { 82601, true }, - { 82622, true }, - { 82632, false }, - { 82647, true }, + { 82256, true }, + { 82267, false }, + { 82279, true }, + { 82293, true }, + { 82304, true }, + { 82314, true }, + { 82331, true }, + { 82349, true }, + { 82359, true }, + { 82382, true }, + { 82396, true }, + { 82412, true }, + { 82425, true }, + { 82444, true }, + { 82457, true }, + { 82474, true }, + { 82492, false }, + { 82505, true }, + { 82526, true }, + { 82540, true }, + { 82550, true }, + { 82561, true }, + { 82568, false }, + { 82577, true }, + { 82593, true }, + { 82609, true }, + { 82616, true }, + { 82637, true }, + { 82647, false }, { 82662, true }, - { 82679, true }, - { 82689, true }, - { 82698, true }, - { 82707, true }, - { 82719, true }, - { 82737, true }, - { 82747, true }, - { 82757, true }, - { 82770, true }, - { 82781, true }, + { 82677, true }, + { 82694, true }, + { 82704, true }, + { 82713, true }, + { 82722, true }, + { 82734, true }, + { 82752, true }, + { 82762, true }, + { 82772, true }, + { 82785, true }, { 82796, true }, - { 82807, true }, - { 82823, true }, - { 82836, true }, - { 82846, true }, - { 82865, true }, - { 82881, true }, - { 82903, true }, - { 82915, true }, - { 82928, true }, - { 82941, true }, + { 82811, true }, + { 82822, true }, + { 82838, true }, + { 82851, true }, + { 82861, true }, + { 82880, true }, + { 82896, true }, + { 82918, true }, + { 82930, true }, + { 82943, true }, { 82956, true }, - { 82970, true }, + { 82971, true }, { 82985, true }, - { 83001, false }, - { 83014, true }, - { 83026, true }, - { 83043, true }, - { 83056, true }, - { 83075, true }, - { 83091, true }, - { 83103, false }, - { 83113, true }, - { 83129, true }, - { 83140, true }, - { 83160, false }, - { 83168, true }, - { 83180, true }, - { 83191, true }, - { 83210, false }, - { 83230, true }, - { 83239, true }, - { 83250, true }, - { 83281, true }, - { 83290, true }, - { 83304, true }, - { 83318, true }, - { 83338, true }, - { 83352, true }, - { 83368, true }, - { 83383, true }, - { 83397, true }, - { 83411, true }, - { 83419, true }, - { 83432, true }, - { 83443, true }, - { 83455, true }, - { 83467, true }, - { 83483, true }, - { 83494, true }, - { 83509, true }, - { 83525, true }, - { 83541, true }, - { 83563, true }, - { 83579, true }, - { 83598, true }, - { 83622, true }, - { 83638, true }, - { 83654, true }, - { 83664, true }, - { 83682, true }, - { 83694, true }, - { 83716, true }, - { 83731, true }, - { 83751, true }, - { 83771, true }, - { 83791, true }, - { 83812, false }, - { 83828, true }, - { 83846, true }, - { 83861, true }, - { 83873, false }, - { 83881, true }, - { 83895, true }, - { 83909, true }, - { 83921, true }, - { 83935, true }, - { 83947, true }, - { 83961, true }, - { 83974, true }, - { 83992, true }, - { 84006, true }, - { 84022, true }, - { 84042, true }, - { 84073, true }, - { 84104, true }, - { 84126, true }, - { 84144, true }, - { 84158, true }, - { 84180, true }, - { 84195, true }, - { 84214, true }, - { 84224, true }, - { 84239, true }, - { 84254, true }, - { 84269, true }, - { 84286, true }, - { 84299, true }, - { 84312, true }, - { 84325, true }, - { 84335, true }, + { 83000, true }, + { 83016, false }, + { 83029, true }, + { 83041, true }, + { 83058, true }, + { 83071, true }, + { 83090, true }, + { 83106, true }, + { 83118, false }, + { 83128, true }, + { 83144, true }, + { 83155, true }, + { 83175, false }, + { 83183, true }, + { 83195, true }, + { 83206, true }, + { 83225, false }, + { 83245, true }, + { 83254, true }, + { 83265, true }, + { 83296, true }, + { 83305, true }, + { 83319, true }, + { 83333, true }, + { 83353, true }, + { 83372, true }, + { 83386, true }, + { 83402, true }, + { 83417, true }, + { 83431, true }, + { 83445, true }, + { 83453, true }, + { 83466, true }, + { 83477, true }, + { 83489, true }, + { 83501, true }, + { 83517, true }, + { 83528, true }, + { 83543, true }, + { 83559, true }, + { 83575, true }, + { 83597, true }, + { 83613, true }, + { 83632, true }, + { 83656, true }, + { 83672, true }, + { 83688, true }, + { 83698, true }, + { 83710, true }, + { 83728, true }, + { 83740, true }, + { 83762, true }, + { 83777, true }, + { 83797, true }, + { 83817, true }, + { 83837, true }, + { 83858, false }, + { 83874, true }, + { 83892, true }, + { 83907, true }, + { 83919, false }, + { 83927, true }, + { 83941, true }, + { 83955, true }, + { 83967, true }, + { 83981, true }, + { 83993, true }, + { 84007, true }, + { 84020, true }, + { 84038, true }, + { 84052, true }, + { 84068, true }, + { 84088, true }, + { 84119, true }, + { 84150, true }, + { 84172, true }, + { 84190, true }, + { 84204, true }, + { 84226, true }, + { 84241, true }, + { 84260, true }, + { 84270, true }, + { 84285, true }, + { 84300, true }, + { 84315, true }, + { 84332, true }, + { 84345, true }, { 84358, true }, - { 84369, true }, - { 84386, true }, - { 84403, true }, - { 84418, true }, - { 84425, true }, - { 84438, true }, - { 84455, true }, - { 84465, true }, - { 84475, true }, - { 84484, true }, - { 84503, true }, - { 84521, true }, + { 84371, true }, + { 84381, true }, + { 84404, true }, + { 84415, true }, + { 84427, true }, + { 84444, true }, + { 84461, true }, + { 84476, true }, + { 84483, true }, + { 84496, true }, + { 84513, true }, + { 84523, true }, + { 84533, true }, { 84542, true }, - { 84562, true }, - { 84575, true }, - { 84592, true }, - { 84605, true }, - { 84627, true }, - { 84639, true }, - { 84655, true }, - { 84665, true }, - { 84678, true }, - { 84700, true }, - { 84714, true }, + { 84561, true }, + { 84579, true }, + { 84600, true }, + { 84620, true }, + { 84633, true }, + { 84650, true }, + { 84663, true }, + { 84685, true }, + { 84697, true }, + { 84713, true }, + { 84723, true }, { 84736, true }, - { 84753, true }, - { 84767, true }, - { 84775, true }, - { 84787, true }, - { 84802, true }, - { 84812, true }, - { 84823, true }, - { 84835, true }, - { 84846, true }, - { 84855, true }, - { 84865, true }, - { 84882, true }, - { 84901, true }, + { 84758, true }, + { 84772, true }, + { 84794, true }, + { 84811, true }, + { 84825, true }, + { 84833, true }, + { 84845, true }, + { 84860, true }, + { 84870, true }, + { 84881, true }, + { 84893, true }, + { 84904, true }, + { 84913, true }, { 84923, true }, - { 84935, true }, - { 84953, true }, - { 84966, true }, - { 84977, true }, - { 84992, true }, - { 85005, true }, - { 85028, true }, - { 85042, true }, - { 85052, true }, - { 85066, true }, - { 85082, true }, - { 85097, true }, - { 85109, true }, - { 85119, true }, - { 85135, true }, - { 85153, true }, + { 84940, true }, + { 84959, true }, + { 84981, true }, + { 84993, true }, + { 85011, true }, + { 85024, true }, + { 85035, true }, + { 85050, true }, + { 85063, true }, + { 85086, true }, + { 85100, true }, + { 85110, true }, + { 85124, true }, + { 85140, true }, + { 85155, true }, { 85167, true }, - { 85175, true }, - { 85186, true }, - { 85200, true }, - { 85213, true }, - { 85223, true }, - { 85234, true }, - { 85245, false }, - { 85261, true }, - { 85274, true }, - { 85289, true }, - { 85300, true }, - { 85316, true }, - { 85334, true }, - { 85351, true }, - { 85372, true }, - { 85384, true }, - { 85393, true }, - { 85406, false }, - { 85424, true }, - { 85433, true }, - { 85444, true }, - { 85456, true }, - { 85466, false }, - { 85484, true }, + { 85177, true }, + { 85193, true }, + { 85211, true }, + { 85225, true }, + { 85233, true }, + { 85244, true }, + { 85258, true }, + { 85271, true }, + { 85281, true }, + { 85292, true }, + { 85303, false }, + { 85319, true }, + { 85332, true }, + { 85347, true }, + { 85358, true }, + { 85374, true }, + { 85392, true }, + { 85409, true }, + { 85430, true }, + { 85442, true }, + { 85451, true }, + { 85464, false }, + { 85482, true }, + { 85491, true }, { 85502, true }, - { 85521, true }, - { 85540, true }, - { 85554, true }, - { 85574, false }, - { 85594, true }, - { 85606, true }, - { 85619, true }, - { 85638, true }, - { 85650, true }, - { 85663, true }, - { 85678, true }, - { 85692, true }, - { 85702, true }, - { 85712, true }, - { 85722, true }, - { 85734, true }, - { 85749, true }, - { 85764, true }, - { 85773, true }, - { 85781, true }, - { 85794, true }, - { 85802, true }, - { 85810, true }, - { 85820, true }, - { 85830, true }, - { 85857, true }, - { 85865, true }, - { 85886, true }, - { 85900, true }, - { 85910, true }, - { 85918, true }, - { 85927, true }, - { 85936, true }, - { 85953, true }, - { 85965, true }, - { 85973, true }, + { 85514, true }, + { 85524, false }, + { 85542, true }, + { 85560, true }, + { 85579, true }, + { 85598, true }, + { 85612, true }, + { 85632, false }, + { 85652, true }, + { 85664, true }, + { 85677, true }, + { 85696, true }, + { 85708, true }, + { 85721, true }, + { 85736, true }, + { 85750, true }, + { 85760, true }, + { 85770, true }, + { 85780, true }, + { 85792, true }, + { 85807, true }, + { 85822, true }, + { 85831, true }, + { 85839, true }, + { 85852, true }, + { 85860, true }, + { 85868, true }, + { 85878, true }, + { 85888, true }, + { 85915, true }, + { 85923, true }, + { 85944, true }, + { 85958, true }, + { 85968, true }, + { 85976, true }, + { 85985, true }, { 85994, true }, - { 86013, true }, - { 86025, true }, - { 86043, true }, - { 86055, true }, - { 86066, true }, - { 86073, true }, - { 86085, true }, - { 86094, true }, - { 86103, true }, - { 86119, true }, - { 86126, true }, - { 86134, true }, - { 86148, false }, - { 86159, true }, - { 86170, true }, - { 86185, true }, - { 86195, true }, - { 86208, true }, - { 86220, true }, - { 86231, true }, - { 86241, false }, - { 86251, true }, - { 86265, true }, - { 86285, true }, - { 86300, true }, - { 86313, true }, - { 86325, true }, - { 86340, true }, - { 86367, true }, - { 86381, true }, - { 86395, true }, - { 86412, true }, - { 86432, true }, - { 86447, true }, - { 86457, true }, + { 86011, true }, + { 86023, true }, + { 86031, true }, + { 86052, true }, + { 86071, true }, + { 86083, true }, + { 86101, true }, + { 86113, true }, + { 86124, true }, + { 86131, true }, + { 86143, true }, + { 86152, true }, + { 86161, true }, + { 86177, true }, + { 86184, true }, + { 86192, true }, + { 86206, false }, + { 86217, true }, + { 86228, true }, + { 86243, true }, + { 86253, true }, + { 86266, true }, + { 86278, true }, + { 86289, true }, + { 86299, false }, + { 86309, true }, + { 86323, true }, + { 86343, true }, + { 86358, true }, + { 86371, true }, + { 86383, true }, + { 86398, true }, + { 86425, true }, + { 86439, true }, + { 86453, true }, { 86470, true }, - { 86487, true }, - { 86500, true }, - { 86510, true }, - { 86537, true }, - { 86547, true }, - { 86556, true }, - { 86563, true }, - { 86579, true }, - { 86590, true }, - { 86601, true }, - { 86615, true }, - { 86626, true }, - { 86636, true }, - { 86657, true }, - { 86665, true }, - { 86675, true }, - { 86686, true }, - { 86706, true }, - { 86718, true }, - { 86741, true }, - { 86755, true }, - { 86774, true }, - { 86791, true }, + { 86490, true }, + { 86505, true }, + { 86515, true }, + { 86528, true }, + { 86545, true }, + { 86558, true }, + { 86568, true }, + { 86595, true }, + { 86605, true }, + { 86614, true }, + { 86621, true }, + { 86637, true }, + { 86648, true }, + { 86659, true }, + { 86673, true }, + { 86684, true }, + { 86694, true }, + { 86715, true }, + { 86723, true }, + { 86733, true }, + { 86744, true }, + { 86764, true }, + { 86776, true }, { 86799, true }, - { 86827, true }, - { 86845, true }, - { 86855, true }, - { 86864, true }, - { 86880, true }, - { 86898, true }, - { 86930, true }, - { 86946, true }, - { 86967, true }, - { 86984, true }, - { 86998, true }, - { 87018, true }, - { 87031, true }, - { 87043, true }, - { 87057, true }, + { 86813, true }, + { 86832, true }, + { 86849, true }, + { 86857, true }, + { 86885, true }, + { 86903, true }, + { 86913, true }, + { 86922, true }, + { 86938, true }, + { 86956, true }, + { 86988, true }, + { 87004, true }, + { 87025, true }, + { 87042, true }, + { 87056, true }, { 87076, true }, - { 87094, true }, - { 87105, true }, - { 87113, true }, - { 87125, true }, - { 87139, true }, - { 87151, true }, - { 87164, true }, - { 87173, true }, + { 87089, true }, + { 87101, true }, + { 87115, true }, + { 87134, true }, + { 87152, true }, + { 87163, true }, + { 87171, true }, { 87183, true }, - { 87194, true }, - { 87206, true }, - { 87216, true }, - { 87239, false }, - { 87254, true }, - { 87273, true }, - { 87291, true }, - { 87305, true }, - { 87319, true }, - { 87332, true }, - { 87345, true }, - { 87357, true }, - { 87371, true }, - { 87387, true }, + { 87197, true }, + { 87209, true }, + { 87222, true }, + { 87231, true }, + { 87241, true }, + { 87252, true }, + { 87264, true }, + { 87274, true }, + { 87297, false }, + { 87312, true }, + { 87327, true }, + { 87346, true }, + { 87364, true }, + { 87378, true }, + { 87392, true }, { 87402, true }, - { 87411, true }, - { 87427, true }, + { 87415, true }, + { 87428, true }, + { 87440, true }, { 87454, true }, - { 87469, true }, - { 87482, true }, - { 87498, true }, - { 87515, false }, - { 87532, true }, - { 87554, true }, - { 87576, true }, - { 87598, true }, - { 87610, true }, - { 87624, true }, + { 87470, true }, + { 87485, true }, + { 87494, true }, + { 87510, true }, + { 87537, true }, + { 87552, true }, + { 87565, true }, + { 87581, true }, + { 87598, false }, + { 87615, true }, { 87637, true }, - { 87646, true }, - { 87662, true }, - { 87679, true }, + { 87659, true }, + { 87681, true }, { 87693, true }, - { 87706, true }, + { 87707, true }, { 87720, true }, - { 87732, true }, + { 87729, true }, { 87745, true }, - { 87758, true }, - { 87768, true }, - { 87782, false }, - { 87794, true }, - { 87807, true }, - { 87829, true }, + { 87762, true }, + { 87776, true }, + { 87789, true }, + { 87803, true }, + { 87815, true }, + { 87828, true }, + { 87841, true }, { 87851, true }, - { 87862, false }, + { 87865, false }, { 87877, true }, - { 87888, false }, - { 87908, true }, - { 87925, true }, - { 87944, true }, - { 87971, true }, - { 87990, true }, - { 88002, true }, - { 88023, true }, - { 88048, true }, - { 88067, true }, - { 88082, true }, - { 88102, false }, - { 88110, true }, - { 88122, true }, - { 88134, true }, - { 88148, true }, - { 88158, true }, - { 88171, true }, - { 88189, true }, - { 88203, true }, - { 88210, true }, + { 87890, true }, + { 87912, true }, + { 87934, true }, + { 87945, false }, + { 87960, true }, + { 87971, false }, + { 87991, true }, + { 88008, true }, + { 88027, true }, + { 88054, true }, + { 88073, true }, + { 88085, true }, + { 88106, true }, + { 88131, true }, + { 88150, true }, + { 88165, true }, + { 88185, false }, + { 88193, true }, + { 88205, true }, { 88217, true }, - { 88229, true }, - { 88240, true }, - { 88253, true }, - { 88267, true }, - { 88284, true }, - { 88298, true }, - { 88314, true }, - { 88325, true }, - { 88332, true }, - { 88345, true }, - { 88358, true }, + { 88231, true }, + { 88241, true }, + { 88254, true }, + { 88272, true }, + { 88286, true }, + { 88293, true }, + { 88300, true }, + { 88312, true }, + { 88323, true }, + { 88336, true }, + { 88350, true }, { 88367, true }, { 88381, true }, - { 88397, false }, - { 88412, true }, - { 88440, true }, - { 88455, true }, - { 88476, true }, - { 88490, true }, - { 88504, true }, - { 88525, true }, - { 88541, true }, - { 88553, true }, - { 88563, true }, - { 88574, true }, - { 88584, true }, - { 88597, true }, - { 88607, true }, - { 88620, true }, - { 88637, true }, - { 88656, true }, - { 88675, true }, - { 88693, true }, - { 88704, true }, - { 88716, true }, - { 88728, true }, + { 88397, true }, + { 88408, true }, + { 88415, true }, + { 88428, true }, + { 88441, true }, + { 88450, true }, + { 88464, true }, + { 88480, false }, + { 88495, true }, + { 88523, true }, + { 88538, true }, + { 88559, true }, + { 88573, true }, + { 88587, true }, + { 88608, true }, + { 88624, true }, + { 88636, true }, + { 88646, true }, + { 88657, true }, + { 88667, true }, + { 88680, true }, + { 88690, true }, + { 88703, true }, + { 88720, true }, { 88739, true }, - { 88751, true }, - { 88766, true }, - { 88792, true }, - { 88803, true }, - { 88814, true }, - { 88825, true }, - { 88837, true }, - { 88848, true }, - { 88861, true }, - { 88870, true }, - { 88879, true }, - { 88892, true }, - { 88899, false }, - { 88907, true }, - { 88915, true }, - { 88930, true }, - { 88943, true }, - { 88954, true }, - { 88968, false }, - { 88980, true }, - { 89004, true }, - { 89019, true }, - { 89032, true }, - { 89046, true }, - { 89064, true }, - { 89072, true }, - { 89089, true }, - { 89114, true }, - { 89134, true }, - { 89158, true }, - { 89170, true }, - { 89183, true }, - { 89199, true }, - { 89208, true }, - { 89224, true }, - { 89242, true }, - { 89257, true }, - { 89277, true }, - { 89290, true }, - { 89306, true }, - { 89320, true }, - { 89336, true }, - { 89356, true }, - { 89374, true }, - { 89393, true }, - { 89410, true }, - { 89426, true }, - { 89436, true }, - { 89465, true }, - { 89485, true }, - { 89502, true }, - { 89518, true }, - { 89527, true }, - { 89540, true }, - { 89549, false }, - { 89563, true }, - { 89580, true }, - { 89613, true }, - { 89633, true }, - { 89645, true }, + { 88758, true }, + { 88776, true }, + { 88787, true }, + { 88799, true }, + { 88811, true }, + { 88822, true }, + { 88834, true }, + { 88849, true }, + { 88875, true }, + { 88886, true }, + { 88897, true }, + { 88908, true }, + { 88920, true }, + { 88931, true }, + { 88944, true }, + { 88953, true }, + { 88962, true }, + { 88975, true }, + { 88982, false }, + { 88990, true }, + { 88998, true }, + { 89013, true }, + { 89026, true }, + { 89037, true }, + { 89051, false }, + { 89063, true }, + { 89087, true }, + { 89102, true }, + { 89115, true }, + { 89129, true }, + { 89147, true }, + { 89155, true }, + { 89172, true }, + { 89197, true }, + { 89217, true }, + { 89241, true }, + { 89253, true }, + { 89266, true }, + { 89282, true }, + { 89291, true }, + { 89307, true }, + { 89325, true }, + { 89340, true }, + { 89360, true }, + { 89373, true }, + { 89389, true }, + { 89403, true }, + { 89419, true }, + { 89439, true }, + { 89457, true }, + { 89476, true }, + { 89493, true }, + { 89509, true }, + { 89519, true }, + { 89548, true }, + { 89568, true }, + { 89585, true }, + { 89601, true }, + { 89610, true }, + { 89623, true }, + { 89635, true }, + { 89644, false }, { 89658, true }, - { 89671, true }, - { 89686, true }, - { 89697, true }, - { 89714, true }, - { 89726, true }, - { 89738, true }, - { 89750, true }, - { 89759, true }, - { 89776, true }, - { 89790, true }, - { 89811, true }, - { 89826, true }, - { 89844, true }, - { 89860, true }, - { 89881, true }, - { 89895, true }, - { 89909, true }, - { 89920, true }, - { 89931, true }, - { 89947, true }, - { 89959, true }, - { 89971, true }, - { 89982, true }, - { 89996, true }, - { 90005, true }, - { 90014, true }, + { 89675, true }, + { 89708, true }, + { 89728, true }, + { 89740, true }, + { 89753, true }, + { 89768, true }, + { 89779, true }, + { 89796, true }, + { 89808, true }, + { 89820, true }, + { 89832, true }, + { 89841, true }, + { 89858, true }, + { 89872, true }, + { 89893, true }, + { 89908, true }, + { 89926, true }, + { 89942, true }, + { 89963, true }, + { 89977, true }, + { 89991, true }, + { 90002, true }, + { 90013, true }, { 90029, true }, - { 90038, true }, - { 90046, true }, - { 90057, true }, - { 90068, true }, - { 90082, true }, - { 90097, true }, - { 90115, true }, - { 90129, true }, + { 90041, true }, + { 90053, true }, + { 90064, true }, + { 90078, true }, + { 90087, true }, + { 90096, true }, + { 90111, true }, + { 90120, true }, + { 90128, true }, { 90139, true }, - { 90149, true }, - { 90157, true }, - { 90166, true }, - { 90178, true }, - { 90187, true }, - { 90201, true }, - { 90224, true }, + { 90150, true }, + { 90164, true }, + { 90179, true }, + { 90197, true }, + { 90211, true }, + { 90221, true }, + { 90231, true }, { 90239, true }, - { 90247, true }, + { 90248, true }, { 90260, true }, - { 90272, true }, - { 90284, true }, - { 90297, true }, - { 90307, false }, - { 90316, false }, - { 90325, false }, - { 90334, true }, - { 90351, true }, - { 90370, true }, - { 90393, true }, - { 90412, true }, - { 90429, true }, - { 90444, true }, - { 90458, true }, - { 90473, true }, - { 90492, true }, - { 90505, true }, - { 90521, true }, - { 90534, true }, - { 90551, true }, - { 90567, true }, - { 90582, true }, - { 90592, true }, - { 90608, true }, - { 90627, true }, - { 90642, true }, - { 90661, true }, - { 90669, true }, - { 90683, true }, - { 90697, true }, - { 90711, true }, - { 90728, false }, - { 90748, true }, - { 90761, true }, - { 90773, true }, - { 90788, true }, - { 90806, true }, - { 90817, true }, - { 90827, true }, - { 90841, true }, - { 90854, true }, + { 90269, true }, + { 90283, true }, + { 90306, true }, + { 90321, true }, + { 90329, true }, + { 90342, true }, + { 90354, true }, + { 90366, true }, + { 90379, true }, + { 90389, false }, + { 90398, false }, + { 90407, false }, + { 90416, true }, + { 90433, true }, + { 90452, true }, + { 90475, true }, + { 90494, true }, + { 90511, true }, + { 90526, true }, + { 90540, true }, + { 90555, true }, + { 90574, true }, + { 90587, true }, + { 90603, true }, + { 90616, true }, + { 90633, true }, + { 90649, true }, + { 90664, true }, + { 90674, true }, + { 90690, true }, + { 90709, true }, + { 90724, true }, + { 90743, true }, + { 90751, true }, + { 90765, true }, + { 90779, true }, + { 90793, true }, + { 90810, false }, + { 90830, true }, + { 90843, true }, + { 90855, true }, { 90870, true }, - { 90885, true }, - { 90910, true }, + { 90888, true }, + { 90899, true }, + { 90909, true }, + { 90923, true }, { 90936, true }, - { 90951, true }, - { 90963, true }, - { 90988, true }, - { 90995, true }, - { 91017, true }, - { 91032, true }, - { 91040, true }, - { 91048, true }, - { 91059, true }, - { 91075, true }, - { 91089, true }, - { 91103, true }, - { 91119, true }, - { 91146, true }, - { 91160, true }, - { 91169, true }, - { 91182, true }, - { 91194, true }, - { 91217, true }, - { 91237, true }, - { 91256, true }, - { 91278, false }, - { 91289, true }, - { 91306, true }, - { 91320, true }, - { 91340, true }, - { 91365, true }, - { 91381, true }, - { 91393, true }, - { 91405, true }, - { 91427, true }, - { 91442, true }, - { 91457, true }, - { 91474, true }, - { 91489, true }, - { 91506, true }, - { 91521, true }, - { 91536, true }, - { 91548, false }, - { 91558, true }, - { 91575, true }, - { 91586, false }, - { 91601, true }, + { 90952, true }, + { 90967, true }, + { 90992, true }, + { 91018, true }, + { 91033, true }, + { 91045, true }, + { 91070, true }, + { 91077, true }, + { 91099, true }, + { 91114, true }, + { 91122, true }, + { 91130, true }, + { 91141, true }, + { 91157, true }, + { 91171, true }, + { 91185, true }, + { 91201, true }, + { 91228, true }, + { 91242, true }, + { 91251, true }, + { 91264, true }, + { 91276, true }, + { 91299, true }, + { 91319, true }, + { 91338, true }, + { 91360, false }, + { 91371, true }, + { 91388, true }, + { 91402, true }, + { 91422, true }, + { 91447, true }, + { 91463, true }, + { 91475, true }, + { 91487, true }, + { 91509, true }, + { 91524, true }, + { 91539, true }, + { 91556, true }, + { 91571, true }, + { 91588, true }, + { 91603, true }, { 91618, true }, - { 91632, true }, - { 91645, true }, - { 91658, true }, - { 91670, true }, - { 91682, true }, - { 91692, true }, - { 91704, true }, - { 91719, true }, - { 91731, true }, - { 91742, true }, - { 91762, true }, + { 91630, false }, + { 91640, true }, + { 91657, true }, + { 91668, false }, + { 91683, true }, + { 91700, true }, + { 91714, true }, + { 91727, true }, + { 91740, true }, + { 91752, true }, + { 91764, true }, { 91774, true }, - { 91785, true }, - { 91810, true }, - { 91819, true }, - { 91827, true }, - { 91840, true }, - { 91863, true }, - { 91880, true }, - { 91891, true }, - { 91907, false }, - { 91919, true }, - { 91927, true }, - { 91937, true }, - { 91952, true }, - { 91966, true }, - { 91976, false }, - { 91994, true }, - { 92018, true }, - { 92030, true }, - { 92058, true }, - { 92074, true }, - { 92086, true }, + { 91786, true }, + { 91801, true }, + { 91813, true }, + { 91824, true }, + { 91844, true }, + { 91856, true }, + { 91867, true }, + { 91892, true }, + { 91901, true }, + { 91909, true }, + { 91922, true }, + { 91945, true }, + { 91962, true }, + { 91973, true }, + { 91989, false }, + { 92001, true }, + { 92009, true }, + { 92019, true }, + { 92034, true }, + { 92048, true }, + { 92058, false }, + { 92076, true }, { 92100, true }, - { 92128, true }, - { 92142, true }, - { 92158, true }, - { 92175, true }, - { 92189, true }, - { 92206, true }, - { 92228, true }, - { 92238, true }, - { 92248, true }, - { 92266, true }, - { 92285, true }, - { 92304, true }, - { 92329, true }, + { 92112, true }, + { 92140, true }, + { 92156, true }, + { 92168, true }, + { 92182, true }, + { 92210, true }, + { 92224, true }, + { 92240, true }, + { 92257, true }, + { 92271, true }, + { 92288, true }, + { 92310, true }, + { 92320, true }, + { 92330, true }, { 92348, true }, - { 92365, true }, - { 92379, true }, - { 92392, true }, - { 92421, true }, - { 92451, true }, - { 92463, true }, - { 92472, true }, - { 92485, true }, - { 92496, true }, - { 92518, true }, - { 92529, true }, - { 92539, true }, - { 92555, true }, - { 92572, true }, - { 92595, true }, + { 92367, true }, + { 92386, true }, + { 92411, true }, + { 92430, true }, + { 92447, true }, + { 92461, true }, + { 92474, true }, + { 92503, true }, + { 92533, true }, + { 92545, true }, + { 92554, true }, + { 92567, true }, + { 92578, true }, + { 92600, true }, + { 92611, true }, { 92621, true }, - { 92635, true }, - { 92649, true }, - { 92668, false }, - { 92678, true }, - { 92690, true }, - { 92706, true }, - { 92714, true }, - { 92733, true }, - { 92745, false }, - { 92756, true }, - { 92764, true }, - { 92780, true }, - { 92794, true }, - { 92806, true }, - { 92819, true }, + { 92637, true }, + { 92654, true }, + { 92677, true }, + { 92703, true }, + { 92717, true }, + { 92731, true }, + { 92750, false }, + { 92760, true }, + { 92772, true }, + { 92788, true }, + { 92796, true }, + { 92815, true }, + { 92827, false }, { 92838, true }, - { 92847, true }, - { 92858, true }, - { 92870, true }, - { 92883, true }, - { 92893, true }, - { 92906, true }, - { 92918, true }, - { 92934, true }, - { 92942, false }, - { 92950, true }, - { 92972, true }, - { 92984, true }, - { 92992, true }, - { 93008, true }, - { 93024, true }, - { 93034, true }, - { 93048, true }, - { 93065, true }, - { 93077, true }, - { 93087, true }, - { 93102, true }, - { 93112, true }, - { 93122, true }, - { 93132, true }, - { 93144, true }, - { 93167, true }, - { 93181, true }, - { 93196, true }, - { 93209, true }, - { 93221, true }, - { 93230, true }, - { 93241, true }, - { 93254, true }, - { 93269, true }, - { 93284, true }, - { 93294, true }, - { 93314, true }, - { 93328, true }, - { 93351, true }, - { 93363, true }, - { 93378, true }, - { 93389, true }, - { 93411, true }, - { 93422, true }, - { 93432, true }, - { 93446, true }, - { 93454, true }, - { 93463, true }, - { 93471, true }, - { 93486, true }, - { 93496, true }, - { 93506, true }, - { 93521, true }, + { 92846, true }, + { 92862, true }, + { 92876, true }, + { 92888, true }, + { 92901, true }, + { 92920, true }, + { 92929, true }, + { 92940, true }, + { 92952, true }, + { 92965, true }, + { 92975, true }, + { 92988, true }, + { 93000, true }, + { 93016, true }, + { 93024, false }, + { 93032, true }, + { 93054, true }, + { 93066, true }, + { 93074, true }, + { 93090, true }, + { 93100, true }, + { 93114, true }, + { 93131, true }, + { 93143, true }, + { 93153, true }, + { 93168, true }, + { 93178, true }, + { 93188, true }, + { 93198, true }, + { 93210, true }, + { 93233, true }, + { 93247, true }, + { 93262, true }, + { 93275, true }, + { 93287, true }, + { 93296, true }, + { 93307, true }, + { 93320, true }, + { 93335, true }, + { 93350, true }, + { 93360, true }, + { 93380, true }, + { 93394, true }, + { 93417, true }, + { 93429, true }, + { 93444, true }, + { 93455, true }, + { 93477, true }, + { 93488, true }, + { 93498, true }, + { 93512, true }, + { 93520, true }, { 93529, true }, { 93537, true }, - { 93546, true }, - { 93557, true }, - { 93569, true }, - { 93581, true }, - { 93591, true }, - { 93601, true }, - { 93613, true }, - { 93627, true }, - { 93642, true }, - { 93659, true }, - { 93671, true }, - { 93682, true }, - { 93689, true }, - { 93703, true }, - { 93714, true }, + { 93552, true }, + { 93562, true }, + { 93572, true }, + { 93587, true }, + { 93595, true }, + { 93603, true }, + { 93612, true }, + { 93623, true }, + { 93635, true }, + { 93647, true }, + { 93657, true }, + { 93667, true }, + { 93679, true }, + { 93693, true }, + { 93708, true }, { 93725, true }, - { 93733, true }, - { 93744, true }, - { 93759, true }, - { 93773, true }, - { 93787, true }, - { 93802, true }, - { 93817, true }, - { 93828, true }, + { 93737, true }, + { 93748, true }, + { 93755, true }, + { 93769, true }, + { 93780, true }, + { 93791, true }, + { 93799, true }, + { 93810, true }, + { 93825, true }, { 93839, true }, - { 93854, true }, - { 93867, true }, - { 93880, true }, - { 93887, true }, - { 93907, true }, - { 93916, true }, - { 93928, true }, - { 93941, true }, - { 93958, true }, + { 93853, true }, + { 93868, true }, + { 93883, true }, + { 93894, true }, + { 93905, true }, + { 93920, true }, + { 93933, true }, + { 93946, true }, + { 93953, true }, { 93973, true }, - { 93988, true }, - { 94008, true }, - { 94028, true }, - { 94037, true }, - { 94053, true }, - { 94065, true }, + { 93982, true }, + { 93994, true }, + { 94007, true }, + { 94024, true }, + { 94039, true }, + { 94054, true }, { 94074, true }, - { 94084, true }, - { 94093, true }, - { 94103, false }, - { 94110, true }, - { 94121, true }, - { 94134, true }, - { 94149, true }, - { 94166, true }, - { 94182, true }, - { 94203, true }, - { 94210, true }, - { 94230, true }, - { 94240, true }, - { 94251, false }, - { 94264, true }, - { 94278, true }, - { 94288, true }, - { 94300, true }, - { 94320, false }, - { 94336, true }, - { 94345, false }, + { 94094, true }, + { 94103, true }, + { 94119, true }, + { 94131, true }, + { 94140, true }, + { 94150, true }, + { 94159, true }, + { 94169, false }, + { 94176, true }, + { 94187, true }, + { 94200, true }, + { 94215, true }, + { 94232, true }, + { 94248, true }, + { 94269, true }, + { 94276, true }, + { 94296, true }, + { 94306, true }, + { 94317, false }, + { 94330, true }, + { 94344, true }, { 94354, true }, - { 94362, true }, - { 94374, true }, - { 94381, true }, - { 94399, true }, - { 94411, true }, - { 94430, true }, - { 94443, true }, - { 94456, false }, + { 94366, true }, + { 94386, false }, + { 94402, true }, + { 94411, false }, + { 94420, true }, + { 94428, true }, + { 94440, true }, + { 94447, true }, { 94465, true }, - { 94474, true }, - { 94485, true }, - { 94505, true }, - { 94522, true }, - { 94535, true }, - { 94551, false }, - { 94566, true }, - { 94580, true }, - { 94593, true }, - { 94612, true }, - { 94625, true }, - { 94642, true }, - { 94653, true }, - { 94670, false }, - { 94691, false }, - { 94707, false }, - { 94727, true }, - { 94739, true }, - { 94762, true }, - { 94774, true }, - { 94787, true }, - { 94799, true }, - { 94810, true }, - { 94819, true }, - { 94830, true }, - { 94845, true }, - { 94863, true }, - { 94890, true }, - { 94900, true }, - { 94908, true }, - { 94922, true }, - { 94934, true }, - { 94949, true }, - { 94959, true }, - { 94970, true }, - { 94979, true }, - { 94998, true }, - { 95011, true }, - { 95021, true }, - { 95029, true }, - { 95036, true }, - { 95049, true }, - { 95059, true }, - { 95068, false }, - { 95078, true }, - { 95087, true }, - { 95099, true }, - { 95110, true }, - { 95121, true }, - { 95131, false }, - { 95148, true }, - { 95157, true }, - { 95167, true }, + { 94477, true }, + { 94496, true }, + { 94509, true }, + { 94522, false }, + { 94531, true }, + { 94540, true }, + { 94551, true }, + { 94571, true }, + { 94588, true }, + { 94601, true }, + { 94617, false }, + { 94632, true }, + { 94646, true }, + { 94659, true }, + { 94678, true }, + { 94691, true }, + { 94708, true }, + { 94719, true }, + { 94736, false }, + { 94757, false }, + { 94773, false }, + { 94793, true }, + { 94805, true }, + { 94828, true }, + { 94840, true }, + { 94853, true }, + { 94864, true }, + { 94873, true }, + { 94884, true }, + { 94899, true }, + { 94917, true }, + { 94944, true }, + { 94954, true }, + { 94962, true }, + { 94976, true }, + { 94988, true }, + { 95003, true }, + { 95013, true }, + { 95024, true }, + { 95033, true }, + { 95052, true }, + { 95065, true }, + { 95075, true }, + { 95083, true }, + { 95090, true }, + { 95103, true }, + { 95113, true }, + { 95122, false }, + { 95132, true }, + { 95141, true }, + { 95153, true }, + { 95164, true }, { 95175, true }, - { 95185, true }, - { 95192, true }, + { 95185, false }, { 95202, true }, - { 95215, true }, - { 95227, true }, - { 95242, true }, - { 95254, true }, - { 95270, true }, - { 95284, true }, - { 95298, true }, - { 95305, true }, - { 95317, true }, - { 95326, true }, - { 95342, true }, - { 95356, true }, - { 95367, true }, - { 95376, true }, - { 95390, true }, - { 95402, true }, - { 95414, true }, - { 95424, true }, - { 95434, true }, + { 95211, true }, + { 95221, true }, + { 95229, true }, + { 95239, true }, + { 95246, true }, + { 95256, true }, + { 95269, true }, + { 95281, true }, + { 95296, true }, + { 95308, true }, + { 95324, true }, + { 95338, true }, + { 95352, true }, + { 95359, true }, + { 95371, true }, + { 95380, true }, + { 95396, true }, + { 95410, true }, + { 95421, true }, + { 95430, true }, { 95444, true }, { 95456, true }, - { 95466, true }, - { 95476, true }, - { 95494, true }, - { 95509, true }, + { 95468, true }, + { 95478, true }, + { 95488, true }, + { 95498, true }, + { 95510, true }, { 95520, true }, - { 95533, true }, - { 95540, true }, - { 95557, true }, - { 95568, true }, - { 95578, true }, - { 95588, true }, - { 95599, true }, - { 95608, true }, - { 95630, true }, - { 95655, true }, - { 95674, true }, - { 95681, true }, - { 95695, true }, - { 95710, true }, - { 95720, true }, - { 95736, true }, - { 95758, true }, - { 95772, true }, - { 95785, true }, - { 95799, true }, - { 95822, true }, - { 95833, true }, - { 95842, true }, - { 95853, true }, - { 95867, true }, - { 95878, true }, - { 95890, true }, - { 95909, true }, - { 95922, true }, - { 95931, true }, - { 95947, true }, - { 95960, true }, - { 95972, true }, - { 95985, true }, - { 95993, true }, - { 96005, true }, - { 96014, true }, - { 96029, true }, - { 96038, true }, - { 96050, true }, - { 96060, true }, - { 96075, true }, - { 96083, true }, - { 96098, true }, - { 96109, true }, - { 96120, true }, - { 96129, true }, - { 96144, true }, - { 96158, true }, - { 96172, true }, - { 96192, true }, - { 96215, true }, - { 96240, true }, - { 96259, true }, - { 96273, true }, - { 96289, true }, - { 96303, true }, - { 96319, true }, - { 96337, true }, - { 96354, true }, - { 96371, true }, - { 96386, true }, - { 96403, true }, - { 96420, true }, - { 96435, true }, - { 96444, true }, - { 96457, true }, - { 96474, true }, - { 96487, true }, + { 95530, true }, + { 95548, true }, + { 95563, true }, + { 95574, true }, + { 95587, true }, + { 95594, true }, + { 95611, true }, + { 95622, true }, + { 95632, true }, + { 95642, true }, + { 95653, true }, + { 95662, true }, + { 95684, true }, + { 95709, true }, + { 95728, true }, + { 95735, true }, + { 95749, true }, + { 95764, true }, + { 95774, true }, + { 95790, true }, + { 95812, true }, + { 95826, true }, + { 95839, true }, + { 95862, true }, + { 95873, true }, + { 95882, true }, + { 95893, true }, + { 95907, true }, + { 95918, true }, + { 95930, true }, + { 95949, true }, + { 95962, true }, + { 95971, true }, + { 95987, true }, + { 96000, true }, + { 96012, true }, + { 96025, true }, + { 96033, true }, + { 96045, true }, + { 96054, true }, + { 96069, true }, + { 96078, true }, + { 96090, true }, + { 96100, true }, + { 96115, true }, + { 96123, true }, + { 96138, true }, + { 96149, true }, + { 96160, true }, + { 96169, true }, + { 96184, true }, + { 96198, true }, + { 96212, true }, + { 96232, true }, + { 96255, true }, + { 96280, true }, + { 96299, true }, + { 96313, true }, + { 96329, true }, + { 96343, true }, + { 96359, true }, + { 96377, true }, + { 96394, true }, + { 96411, true }, + { 96426, true }, + { 96443, true }, + { 96460, true }, + { 96475, true }, + { 96484, true }, { 96497, true }, - { 96508, true }, - { 96519, true }, - { 96529, true }, - { 96541, true }, - { 96562, true }, - { 96576, false }, - { 96596, false }, - { 96608, true }, - { 96621, true }, - { 96631, true }, - { 96644, true }, - { 96657, true }, - { 96673, true }, - { 96690, true }, - { 96702, true }, - { 96716, true }, + { 96514, true }, + { 96527, true }, + { 96537, true }, + { 96548, true }, + { 96559, true }, + { 96569, true }, + { 96581, true }, + { 96602, true }, + { 96616, false }, + { 96636, false }, + { 96648, true }, + { 96661, true }, + { 96671, true }, + { 96684, true }, + { 96697, true }, + { 96713, true }, { 96730, true }, - { 96746, true }, - { 96758, true }, - { 96784, true }, - { 96805, true }, - { 96826, false }, - { 96840, true }, - { 96858, true }, - { 96875, true }, - { 96887, true }, - { 96907, true }, - { 96923, true }, - { 96935, true }, - { 96957, true }, - { 96979, true }, - { 96998, true }, - { 97015, true }, - { 97027, true }, + { 96742, true }, + { 96756, true }, + { 96770, true }, + { 96786, true }, + { 96798, true }, + { 96824, true }, + { 96845, true }, + { 96866, false }, + { 96880, true }, + { 96898, true }, + { 96915, true }, + { 96927, true }, + { 96947, true }, + { 96963, true }, + { 96975, true }, + { 96997, true }, + { 97019, true }, { 97038, true }, - { 97051, true }, - { 97071, true }, - { 97082, true }, - { 97107, true }, + { 97055, true }, + { 97067, true }, + { 97078, true }, + { 97091, true }, + { 97111, true }, { 97122, true }, - { 97139, true }, - { 97160, true }, - { 97180, true }, - { 97202, false }, - { 97215, true }, - { 97226, true }, - { 97242, true }, - { 97257, true }, - { 97272, true }, - { 97292, true }, - { 97304, true }, - { 97322, true }, - { 97347, true }, - { 97370, true }, - { 97386, true }, - { 97403, true }, - { 97414, true }, + { 97147, true }, + { 97162, true }, + { 97179, true }, + { 97200, true }, + { 97220, true }, + { 97242, false }, + { 97255, true }, + { 97266, true }, + { 97282, true }, + { 97297, true }, + { 97312, true }, + { 97332, true }, + { 97344, true }, + { 97362, true }, + { 97387, true }, + { 97410, true }, { 97426, true }, - { 97440, true }, - { 97456, false }, - { 97469, true }, - { 97482, true }, - { 97494, true }, - { 97505, true }, + { 97443, true }, + { 97454, true }, + { 97466, true }, + { 97480, true }, + { 97496, false }, + { 97509, true }, { 97522, true }, { 97534, true }, - { 97544, false }, - { 97553, false }, - { 97563, true }, + { 97545, true }, + { 97562, true }, { 97574, true }, - { 97597, true }, - { 97610, false }, - { 97623, true }, - { 97634, true }, - { 97648, true }, - { 97664, true }, - { 97672, true }, - { 97691, true }, - { 97714, true }, - { 97728, true }, - { 97743, true }, - { 97753, true }, - { 97766, true }, - { 97781, true }, - { 97797, true }, - { 97813, true }, - { 97830, true }, - { 97843, true }, - { 97855, true }, - { 97868, true }, - { 97880, true }, + { 97584, false }, + { 97593, true }, + { 97603, true }, + { 97614, true }, + { 97637, true }, + { 97650, false }, + { 97663, true }, + { 97674, true }, + { 97688, true }, + { 97704, true }, + { 97712, true }, + { 97731, true }, + { 97754, true }, + { 97768, true }, + { 97783, true }, + { 97793, true }, + { 97806, true }, + { 97821, true }, + { 97837, true }, + { 97853, true }, + { 97870, true }, + { 97883, true }, { 97895, true }, - { 97912, true }, - { 97921, true }, - { 97942, true }, - { 97959, true }, - { 97970, false }, - { 97988, true }, - { 98003, true }, - { 98015, true }, - { 98027, true }, - { 98039, true }, - { 98058, true }, - { 98093, true }, - { 98115, true }, - { 98129, true }, - { 98146, true }, - { 98159, true }, - { 98176, true }, - { 98193, false }, - { 98212, true }, - { 98230, true }, - { 98261, true }, - { 98276, true }, - { 98289, true }, - { 98311, true }, - { 98323, true }, - { 98340, true }, - { 98357, true }, - { 98379, true }, - { 98395, true }, - { 98408, true }, - { 98420, true }, - { 98441, true }, + { 97908, true }, + { 97920, true }, + { 97935, true }, + { 97952, true }, + { 97961, true }, + { 97982, true }, + { 97999, true }, + { 98010, false }, + { 98028, true }, + { 98043, true }, + { 98055, true }, + { 98067, true }, + { 98079, true }, + { 98098, true }, + { 98133, true }, + { 98155, true }, + { 98169, true }, + { 98186, true }, + { 98199, true }, + { 98216, true }, + { 98233, false }, + { 98252, true }, + { 98270, true }, + { 98301, true }, + { 98316, true }, + { 98329, true }, + { 98351, true }, + { 98363, true }, + { 98380, true }, + { 98397, true }, + { 98419, true }, + { 98435, true }, + { 98448, true }, { 98460, true }, - { 98472, true }, - { 98489, true }, - { 98504, true }, - { 98521, true }, - { 98538, true }, - { 98554, true }, - { 98569, true }, - { 98585, true }, - { 98601, true }, + { 98481, true }, + { 98500, true }, + { 98512, true }, + { 98529, true }, + { 98544, true }, + { 98561, true }, + { 98578, true }, + { 98594, true }, + { 98609, true }, { 98625, true }, - { 98650, true }, - { 98672, true }, - { 98687, true }, - { 98714, true }, - { 98732, true }, - { 98749, true }, - { 98775, true }, - { 98790, true }, - { 98808, true }, - { 98829, true }, - { 98857, true }, - { 98876, true }, - { 98900, true }, - { 98924, true }, - { 98937, true }, - { 98950, true }, - { 98967, true }, - { 98982, true }, - { 99007, false }, - { 99021, true }, - { 99031, true }, - { 99050, true }, - { 99066, true }, + { 98641, true }, + { 98665, true }, + { 98690, true }, + { 98712, true }, + { 98727, true }, + { 98754, true }, + { 98772, true }, + { 98789, true }, + { 98815, true }, + { 98830, true }, + { 98848, true }, + { 98869, true }, + { 98897, true }, + { 98916, true }, + { 98940, true }, + { 98964, true }, + { 98977, true }, + { 98990, true }, + { 99007, true }, + { 99022, true }, + { 99047, false }, + { 99061, true }, + { 99071, true }, { 99090, true }, - { 99105, true }, - { 99122, true }, - { 99132, true }, - { 99141, true }, - { 99156, true }, - { 99166, true }, - { 99178, true }, - { 99199, true }, - { 99212, true }, - { 99225, true }, - { 99243, true }, - { 99256, true }, - { 99270, true }, - { 99289, true }, - { 99299, true }, - { 99315, true }, - { 99331, true }, - { 99344, true }, - { 99363, true }, - { 99381, true }, - { 99395, true }, - { 99405, false }, - { 99417, true }, - { 99425, true }, + { 99106, true }, + { 99130, true }, + { 99145, true }, + { 99162, true }, + { 99172, true }, + { 99181, true }, + { 99196, true }, + { 99206, true }, + { 99218, true }, + { 99239, true }, + { 99252, true }, + { 99265, true }, + { 99283, true }, + { 99296, true }, + { 99310, true }, + { 99329, true }, + { 99339, true }, + { 99355, true }, + { 99371, true }, + { 99384, true }, + { 99403, true }, + { 99421, true }, { 99435, true }, - { 99445, true }, + { 99445, false }, { 99457, true }, - { 99471, false }, - { 99484, true }, - { 99492, true }, - { 99503, true }, - { 99514, true }, - { 99522, true }, - { 99538, true }, - { 99550, true }, - { 99559, true }, - { 99575, false }, - { 99582, true }, + { 99465, true }, + { 99475, true }, + { 99485, true }, + { 99497, true }, + { 99511, false }, + { 99524, true }, + { 99532, true }, + { 99543, true }, + { 99554, true }, + { 99562, true }, + { 99578, true }, { 99590, true }, - { 99600, true }, - { 99612, true }, - { 99626, true }, - { 99635, true }, - { 99651, true }, - { 99659, true }, - { 99668, true }, - { 99684, true }, - { 99694, false }, - { 99712, true }, + { 99599, true }, + { 99615, false }, + { 99622, true }, + { 99630, true }, + { 99640, true }, + { 99652, true }, + { 99666, true }, + { 99675, true }, + { 99691, true }, + { 99699, true }, + { 99708, true }, { 99724, true }, - { 99736, false }, - { 99747, true }, - { 99760, true }, - { 99770, true }, - { 99780, true }, - { 99790, true }, + { 99734, false }, + { 99752, true }, + { 99764, true }, + { 99776, false }, + { 99787, true }, { 99800, true }, { 99810, true }, - { 99829, true }, - { 99838, true }, - { 99847, true }, - { 99867, true }, - { 99883, true }, - { 99891, true }, - { 99912, true }, - { 99920, true }, - { 99936, true }, - { 99953, true }, - { 99961, true }, - { 99972, true }, - { 99984, true }, - { 99995, true }, - { 100010, true }, - { 100021, true }, - { 100031, true }, - { 100040, true }, - { 100058, true }, - { 100074, true }, - { 100088, true }, - { 100116, true }, - { 100129, true }, - { 100138, true }, - { 100157, true }, - { 100173, true }, - { 100188, true }, - { 100205, true }, + { 99820, true }, + { 99830, true }, + { 99840, true }, + { 99850, true }, + { 99869, true }, + { 99878, true }, + { 99887, true }, + { 99907, true }, + { 99923, true }, + { 99931, true }, + { 99952, true }, + { 99960, true }, + { 99976, true }, + { 99993, true }, + { 100001, true }, + { 100012, true }, + { 100024, true }, + { 100035, true }, + { 100050, true }, + { 100061, true }, + { 100071, true }, + { 100080, true }, + { 100098, true }, + { 100114, true }, + { 100128, true }, + { 100156, true }, + { 100169, true }, + { 100178, true }, + { 100197, true }, + { 100213, true }, { 100228, true }, - { 100247, true }, - { 100256, true }, - { 100274, true }, - { 100289, true }, - { 100303, true }, - { 100326, true }, - { 100348, true }, - { 100358, true }, - { 100374, true }, - { 100390, true }, + { 100245, true }, + { 100268, true }, + { 100287, true }, + { 100296, true }, + { 100314, true }, + { 100329, true }, + { 100343, true }, + { 100366, true }, + { 100388, true }, { 100398, true }, - { 100408, true }, - { 100420, true }, - { 100433, true }, - { 100450, true }, - { 100482, true }, - { 100493, true }, - { 100511, true }, - { 100525, true }, - { 100539, true }, - { 100557, true }, - { 100576, true }, - { 100592, true }, - { 100603, true }, - { 100614, true }, + { 100414, true }, + { 100430, true }, + { 100438, true }, + { 100448, true }, + { 100460, true }, + { 100473, true }, + { 100490, true }, + { 100522, true }, + { 100533, true }, + { 100551, true }, + { 100565, true }, + { 100579, true }, + { 100597, true }, + { 100616, true }, { 100632, true }, - { 100645, true }, - { 100656, true }, - { 100666, true }, - { 100679, true }, - { 100691, true }, - { 100702, true }, - { 100713, true }, - { 100724, true }, - { 100734, true }, - { 100743, true }, - { 100760, true }, - { 100779, true }, - { 100792, true }, - { 100805, true }, - { 100824, true }, - { 100841, true }, - { 100866, true }, - { 100898, true }, - { 100910, true }, - { 100934, true }, - { 100957, true }, - { 100989, true }, - { 101014, true }, - { 101027, true }, - { 101053, true }, - { 101072, true }, - { 101086, true }, - { 101100, true }, - { 101113, true }, - { 101128, true }, - { 101143, true }, - { 101157, true }, - { 101171, false }, - { 101191, true }, - { 101204, true }, - { 101221, true }, - { 101236, true }, - { 101253, true }, - { 101262, true }, - { 101271, true }, - { 101287, true }, - { 101307, true }, - { 101326, true }, - { 101335, true }, - { 101344, true }, - { 101355, true }, - { 101364, true }, - { 101372, true }, - { 101381, true }, - { 101392, true }, - { 101405, true }, - { 101417, true }, - { 101430, true }, - { 101439, true }, - { 101452, true }, - { 101462, true }, - { 101475, true }, - { 101488, true }, - { 101499, true }, - { 101510, true }, - { 101521, true }, - { 101530, true }, + { 100643, true }, + { 100654, true }, + { 100672, true }, + { 100685, true }, + { 100696, true }, + { 100706, true }, + { 100719, true }, + { 100731, true }, + { 100742, true }, + { 100753, true }, + { 100764, true }, + { 100774, true }, + { 100783, true }, + { 100800, true }, + { 100819, true }, + { 100832, true }, + { 100845, true }, + { 100864, true }, + { 100881, true }, + { 100906, true }, + { 100938, true }, + { 100950, true }, + { 100974, true }, + { 100997, true }, + { 101029, true }, + { 101054, true }, + { 101067, true }, + { 101093, true }, + { 101112, true }, + { 101126, true }, + { 101140, true }, + { 101153, true }, + { 101168, true }, + { 101183, true }, + { 101197, true }, + { 101211, false }, + { 101231, true }, + { 101244, true }, + { 101261, true }, + { 101276, true }, + { 101293, true }, + { 101302, true }, + { 101311, true }, + { 101327, true }, + { 101347, true }, + { 101366, true }, + { 101375, true }, + { 101384, true }, + { 101395, true }, + { 101404, true }, + { 101412, true }, + { 101421, true }, + { 101432, true }, + { 101445, true }, + { 101457, true }, + { 101470, true }, + { 101479, true }, + { 101492, true }, + { 101502, true }, + { 101515, true }, + { 101528, true }, { 101539, true }, - { 101549, true }, - { 101566, true }, - { 101583, true }, - { 101592, true }, - { 101607, true }, - { 101626, true }, - { 101639, true }, - { 101656, false }, - { 101669, true }, + { 101550, true }, + { 101561, true }, + { 101570, true }, + { 101579, true }, + { 101589, true }, + { 101606, true }, + { 101623, true }, + { 101632, true }, + { 101647, true }, + { 101666, true }, { 101678, true }, - { 101692, true }, - { 101715, false }, - { 101727, true }, - { 101738, true }, - { 101755, true }, - { 101769, true }, - { 101780, true }, - { 101797, true }, - { 101818, true }, - { 101829, true }, - { 101840, true }, - { 101847, true }, - { 101858, true }, - { 101865, true }, - { 101875, true }, - { 101887, true }, - { 101897, true }, - { 101906, true }, - { 101919, true }, - { 101931, true }, - { 101948, true }, - { 101962, true }, - { 101976, true }, + { 101691, true }, + { 101708, false }, + { 101721, true }, + { 101730, true }, + { 101744, true }, + { 101767, false }, + { 101779, true }, + { 101790, true }, + { 101807, true }, + { 101821, true }, + { 101832, true }, + { 101849, true }, + { 101870, true }, + { 101881, true }, + { 101892, true }, + { 101899, true }, + { 101910, true }, + { 101917, true }, + { 101927, true }, + { 101939, true }, + { 101949, true }, + { 101958, true }, + { 101971, true }, { 101983, true }, - { 101990, true }, - { 101997, true }, - { 102006, true }, - { 102015, true }, - { 102023, true }, - { 102033, true }, - { 102051, true }, - { 102065, true }, - { 102077, true }, - { 102088, true }, - { 102099, true }, - { 102110, true }, - { 102123, true }, - { 102134, true }, - { 102143, true }, - { 102160, true }, - { 102171, true }, - { 102187, true }, - { 102194, true }, - { 102201, true }, - { 102215, true }, + { 102000, true }, + { 102014, true }, + { 102028, true }, + { 102035, true }, + { 102042, true }, + { 102049, true }, + { 102058, true }, + { 102067, true }, + { 102075, true }, + { 102085, true }, + { 102103, true }, + { 102117, true }, + { 102129, true }, + { 102140, true }, + { 102151, true }, + { 102162, true }, + { 102175, true }, + { 102186, true }, + { 102195, true }, + { 102212, true }, { 102223, true }, - { 102230, true }, - { 102241, true }, - { 102247, true }, - { 102260, true }, - { 102273, true }, - { 102283, true }, + { 102239, true }, + { 102246, true }, + { 102253, true }, + { 102267, true }, + { 102275, true }, + { 102282, true }, { 102293, true }, - { 102306, true }, - { 102320, true }, + { 102299, true }, + { 102312, true }, + { 102325, true }, { 102335, true }, - { 102348, true }, - { 102357, true }, - { 102376, true }, - { 102401, false }, - { 102413, true }, - { 102421, true }, - { 102435, true }, - { 102448, true }, - { 102463, true }, - { 102482, true }, - { 102495, true }, - { 102510, true }, - { 102523, true }, + { 102345, true }, + { 102358, true }, + { 102372, true }, + { 102387, true }, + { 102400, true }, + { 102409, true }, + { 102428, true }, + { 102453, false }, + { 102465, true }, + { 102473, true }, + { 102487, true }, + { 102500, true }, + { 102515, true }, { 102534, true }, { 102547, true }, - { 102564, true }, - { 102578, false }, - { 102597, true }, - { 102612, true }, - { 102626, true }, - { 102642, true }, - { 102658, true }, + { 102562, true }, + { 102575, true }, + { 102586, true }, + { 102599, true }, + { 102616, true }, + { 102630, false }, + { 102649, true }, + { 102664, true }, { 102678, true }, - { 102696, true }, - { 102706, true }, - { 102715, true }, - { 102731, true }, - { 102746, true }, - { 102766, true }, - { 102785, true }, - { 102802, true }, + { 102694, true }, + { 102710, true }, + { 102730, true }, + { 102748, true }, + { 102758, true }, + { 102767, true }, + { 102783, true }, + { 102798, true }, { 102818, true }, - { 102838, true }, - { 102851, true }, - { 102865, false }, - { 102878, true }, - { 102888, true }, - { 102900, true }, - { 102917, true }, - { 102932, true }, - { 102955, true }, - { 102972, true }, - { 102986, true }, - { 102998, true }, - { 103013, true }, - { 103030, true }, - { 103044, true }, - { 103059, true }, - { 103068, true }, - { 103083, true }, - { 103101, true }, - { 103115, true }, - { 103132, true }, - { 103142, true }, + { 102837, true }, + { 102854, true }, + { 102870, true }, + { 102890, true }, + { 102903, true }, + { 102917, false }, + { 102930, true }, + { 102940, true }, + { 102952, true }, + { 102969, true }, + { 102984, true }, + { 103007, true }, + { 103024, true }, + { 103038, true }, + { 103050, true }, + { 103065, true }, + { 103082, true }, + { 103096, true }, + { 103111, true }, + { 103120, true }, + { 103135, true }, { 103153, true }, - { 103163, true }, - { 103178, true }, - { 103192, true }, + { 103167, true }, + { 103184, true }, + { 103194, true }, { 103205, true }, - { 103216, true }, - { 103233, true }, - { 103247, true }, + { 103215, true }, + { 103230, true }, + { 103244, true }, { 103257, true }, - { 103269, true }, - { 103287, true }, - { 103301, true }, - { 103313, false }, - { 103328, true }, - { 103347, true }, - { 103358, true }, - { 103370, true }, - { 103383, true }, - { 103400, true }, - { 103416, true }, + { 103268, true }, + { 103285, true }, + { 103299, true }, + { 103309, true }, + { 103321, true }, + { 103339, true }, + { 103353, true }, + { 103365, false }, + { 103380, true }, + { 103399, true }, + { 103410, true }, + { 103422, true }, { 103435, true }, { 103452, true }, - { 103470, true }, - { 103492, true }, - { 103511, true }, - { 103524, true }, - { 103540, true }, - { 103553, true }, - { 103568, true }, + { 103468, true }, + { 103487, true }, + { 103504, true }, + { 103522, true }, + { 103544, true }, + { 103563, true }, { 103576, true }, - { 103589, true }, - { 103603, true }, - { 103617, true }, + { 103592, true }, + { 103605, true }, + { 103620, true }, { 103628, true }, - { 103638, true }, - { 103656, true }, - { 103674, true }, - { 103687, true }, - { 103695, true }, - { 103703, true }, - { 103716, true }, - { 103728, true }, + { 103641, true }, + { 103655, true }, + { 103669, true }, + { 103680, true }, + { 103690, true }, + { 103708, true }, + { 103726, true }, { 103739, true }, - { 103754, true }, - { 103764, true }, - { 103775, true }, - { 103783, true }, - { 103798, true }, - { 103805, true }, - { 103821, true }, - { 103843, true }, - { 103859, true }, - { 103868, true }, - { 103878, true }, - { 103890, true }, - { 103903, true }, - { 103921, true }, - { 103935, true }, - { 103954, true }, - { 103968, true }, - { 103981, true }, - { 103997, false }, - { 104014, true }, - { 104035, true }, - { 104054, true }, - { 104073, true }, - { 104092, false }, - { 104108, true }, - { 104123, true }, - { 104133, true }, - { 104143, true }, - { 104152, true }, - { 104165, true }, - { 104175, false }, - { 104193, true }, - { 104215, true }, - { 104232, true }, - { 104248, true }, - { 104266, true }, - { 104277, true }, - { 104293, true }, - { 104311, true }, - { 104326, false }, - { 104340, true }, - { 104357, true }, - { 104375, true }, - { 104394, true }, - { 104405, true }, - { 104421, true }, - { 104438, true }, - { 104454, true }, - { 104467, true }, - { 104485, true }, - { 104496, true }, - { 104513, true }, - { 104535, false }, - { 104552, true }, - { 104568, true }, - { 104582, true }, - { 104594, true }, - { 104616, false }, - { 104631, true }, - { 104643, true }, - { 104651, true }, - { 104664, true }, - { 104679, true }, - { 104694, true }, - { 104704, true }, - { 104715, true }, - { 104727, true }, - { 104736, true }, + { 103747, true }, + { 103755, true }, + { 103768, true }, + { 103780, true }, + { 103791, true }, + { 103806, true }, + { 103816, true }, + { 103827, true }, + { 103835, true }, + { 103850, true }, + { 103857, true }, + { 103873, true }, + { 103895, true }, + { 103911, true }, + { 103920, true }, + { 103930, true }, + { 103942, true }, + { 103955, true }, + { 103973, true }, + { 103987, true }, + { 104006, true }, + { 104020, true }, + { 104033, true }, + { 104049, false }, + { 104066, true }, + { 104087, true }, + { 104106, true }, + { 104125, true }, + { 104144, false }, + { 104160, true }, + { 104175, true }, + { 104185, true }, + { 104195, true }, + { 104204, true }, + { 104217, true }, + { 104227, false }, + { 104245, true }, + { 104267, true }, + { 104284, true }, + { 104300, true }, + { 104318, true }, + { 104329, true }, + { 104345, true }, + { 104363, true }, + { 104378, false }, + { 104392, true }, + { 104409, true }, + { 104427, true }, + { 104446, true }, + { 104457, true }, + { 104473, true }, + { 104490, true }, + { 104506, true }, + { 104519, true }, + { 104537, true }, + { 104548, true }, + { 104565, true }, + { 104587, false }, + { 104604, true }, + { 104620, true }, + { 104634, true }, + { 104646, true }, + { 104668, false }, + { 104683, true }, + { 104695, true }, + { 104703, true }, + { 104716, true }, + { 104731, true }, { 104746, true }, { 104756, true }, - { 104770, true }, - { 104784, true }, - { 104795, false }, + { 104767, true }, + { 104779, true }, + { 104788, true }, + { 104798, true }, { 104808, true }, - { 104816, true }, - { 104830, true }, - { 104839, true }, - { 104852, true }, - { 104861, true }, - { 104871, true }, - { 104884, true }, - { 104904, false }, - { 104914, true }, - { 104930, true }, - { 104943, true }, - { 104956, true }, - { 104967, true }, - { 104976, true }, - { 104983, true }, - { 104999, true }, - { 105012, true }, - { 105025, true }, - { 105038, true }, - { 105053, true }, + { 104822, true }, + { 104836, true }, + { 104847, false }, + { 104860, true }, + { 104868, true }, + { 104882, true }, + { 104891, true }, + { 104904, true }, + { 104913, true }, + { 104923, true }, + { 104936, true }, + { 104956, false }, + { 104966, true }, + { 104982, true }, + { 104995, true }, + { 105008, true }, + { 105019, true }, + { 105028, true }, + { 105035, true }, + { 105051, true }, { 105064, true }, - { 105084, true }, - { 105096, true }, - { 105103, true }, - { 105110, true }, - { 105119, true }, - { 105128, true }, - { 105137, true }, + { 105077, true }, + { 105090, true }, + { 105105, true }, + { 105116, true }, + { 105136, true }, { 105148, true }, - { 105162, true }, - { 105175, true }, - { 105183, true }, - { 105202, true }, - { 105213, true }, - { 105225, true }, - { 105239, true }, - { 105250, true }, - { 105266, true }, - { 105280, true }, + { 105155, true }, + { 105164, true }, + { 105173, true }, + { 105182, true }, + { 105193, true }, + { 105207, true }, + { 105220, true }, + { 105228, true }, + { 105247, true }, + { 105258, true }, + { 105270, true }, + { 105284, true }, { 105295, true }, - { 105305, false }, - { 105319, true }, - { 105329, true }, - { 105344, false }, - { 105360, true }, - { 105379, true }, - { 105391, true }, - { 105404, true }, - { 105423, true }, - { 105447, false }, - { 105460, true }, - { 105476, true }, - { 105490, true }, + { 105311, true }, + { 105325, true }, + { 105340, true }, + { 105350, false }, + { 105364, true }, + { 105374, true }, + { 105389, false }, + { 105405, true }, + { 105424, true }, + { 105436, true }, + { 105449, true }, + { 105468, true }, + { 105492, false }, { 105505, true }, - { 105524, true }, - { 105541, true }, - { 105558, true }, - { 105568, true }, - { 105583, true }, - { 105597, true }, - { 105610, true }, - { 105626, true }, - { 105641, true }, - { 105657, true }, + { 105521, true }, + { 105535, true }, + { 105550, true }, + { 105569, true }, + { 105586, true }, + { 105603, true }, + { 105613, true }, + { 105628, true }, + { 105642, true }, + { 105655, true }, { 105671, true }, { 105686, true }, - { 105700, true }, - { 105715, true }, - { 105734, true }, - { 105749, true }, - { 105764, true }, - { 105782, true }, - { 105801, true }, - { 105814, true }, + { 105702, true }, + { 105716, true }, + { 105731, true }, + { 105745, true }, + { 105760, true }, + { 105779, true }, + { 105794, true }, + { 105809, true }, { 105827, true }, - { 105850, true }, - { 105866, true }, - { 105877, true }, - { 105890, true }, - { 105905, true }, - { 105920, true }, - { 105936, true }, - { 105951, true }, - { 105967, true }, - { 105984, true }, + { 105846, true }, + { 105859, true }, + { 105872, true }, + { 105895, true }, + { 105911, true }, + { 105922, true }, + { 105935, true }, + { 105950, true }, + { 105965, true }, + { 105981, true }, { 105996, true }, - { 106006, true }, - { 106024, true }, - { 106034, true }, - { 106045, true }, - { 106055, true }, + { 106012, true }, + { 106029, true }, + { 106041, true }, + { 106051, true }, { 106069, true }, - { 106082, true }, - { 106110, true }, - { 106121, true }, - { 106132, true }, - { 106143, true }, - { 106156, true }, - { 106169, true }, - { 106186, true }, - { 106200, false }, - { 106217, true }, + { 106079, true }, + { 106090, true }, + { 106100, true }, + { 106114, true }, + { 106127, true }, + { 106155, true }, + { 106166, true }, + { 106177, true }, + { 106188, true }, + { 106201, true }, + { 106214, true }, { 106231, true }, - { 106248, true }, - { 106265, true }, - { 106277, true }, - { 106288, true }, - { 106302, true }, - { 106314, true }, - { 106330, true }, - { 106356, true }, - { 106366, true }, - { 106379, true }, - { 106389, true }, - { 106402, true }, - { 106410, true }, - { 106421, true }, - { 106441, true }, - { 106459, true }, - { 106476, true }, - { 106491, true }, - { 106509, true }, - { 106525, true }, - { 106539, true }, - { 106556, true }, - { 106566, true }, - { 106582, true }, - { 106595, true }, - { 106605, false }, - { 106619, true }, - { 106630, true }, - { 106646, true }, - { 106654, true }, + { 106245, false }, + { 106262, true }, + { 106276, true }, + { 106293, true }, + { 106310, true }, + { 106322, true }, + { 106333, true }, + { 106347, true }, + { 106359, true }, + { 106375, true }, + { 106401, true }, + { 106411, true }, + { 106424, true }, + { 106434, true }, + { 106447, true }, + { 106455, true }, + { 106466, true }, + { 106486, true }, + { 106504, true }, + { 106521, true }, + { 106536, true }, + { 106554, true }, + { 106570, true }, + { 106584, true }, + { 106601, true }, + { 106611, true }, + { 106627, true }, + { 106640, true }, + { 106650, false }, { 106664, true }, - { 106679, true }, - { 106695, true }, - { 106714, true }, - { 106727, true }, - { 106747, true }, - { 106762, true }, - { 106780, true }, - { 106793, true }, - { 106803, true }, - { 106820, true }, + { 106675, true }, + { 106691, true }, + { 106699, true }, + { 106709, true }, + { 106724, true }, + { 106740, true }, + { 106759, true }, + { 106772, true }, + { 106792, true }, + { 106807, true }, + { 106825, true }, { 106835, true }, - { 106846, true }, - { 106865, true }, - { 106876, true }, - { 106889, true }, + { 106852, true }, + { 106867, true }, + { 106878, true }, { 106897, true }, - { 106906, true }, - { 106917, true }, - { 106931, true }, - { 106941, true }, - { 106964, true }, - { 106977, true }, - { 106989, false }, - { 107000, true }, - { 107014, true }, - { 107042, true }, - { 107051, true }, - { 107066, true }, - { 107085, true }, - { 107109, true }, - { 107124, true }, - { 107144, true }, - { 107162, true }, - { 107175, true }, - { 107191, true }, - { 107206, true }, - { 107219, true }, - { 107233, true }, - { 107244, true }, - { 107255, true }, - { 107269, true }, - { 107281, true }, - { 107298, true }, - { 107308, true }, - { 107321, true }, - { 107336, true }, + { 106908, true }, + { 106921, true }, + { 106929, true }, + { 106938, true }, + { 106949, true }, + { 106963, true }, + { 106973, true }, + { 106996, true }, + { 107009, true }, + { 107021, false }, + { 107032, true }, + { 107046, true }, + { 107074, true }, + { 107083, true }, + { 107098, true }, + { 107117, true }, + { 107132, true }, + { 107152, true }, + { 107170, true }, + { 107183, true }, + { 107199, true }, + { 107214, true }, + { 107227, true }, + { 107241, true }, + { 107252, true }, + { 107263, true }, + { 107277, true }, + { 107289, true }, + { 107306, true }, + { 107316, true }, + { 107329, true }, { 107344, true }, - { 107364, true }, - { 107375, true }, - { 107385, true }, - { 107401, true }, - { 107410, true }, - { 107421, true }, - { 107434, true }, - { 107444, true }, - { 107456, true }, - { 107471, true }, - { 107480, true }, - { 107494, true }, - { 107507, true }, - { 107522, true }, - { 107536, true }, - { 107547, true }, - { 107562, true }, - { 107572, false }, - { 107582, true }, - { 107601, true }, - { 107614, true }, - { 107623, true }, - { 107634, true }, - { 107648, true }, - { 107668, true }, - { 107684, true }, - { 107695, true }, - { 107711, true }, - { 107728, true }, - { 107743, true }, - { 107764, true }, - { 107777, true }, - { 107794, true }, - { 107804, true }, + { 107352, true }, + { 107372, true }, + { 107383, true }, + { 107393, true }, + { 107409, true }, + { 107418, true }, + { 107429, true }, + { 107442, true }, + { 107452, true }, + { 107464, true }, + { 107479, true }, + { 107488, true }, + { 107502, true }, + { 107515, true }, + { 107525, true }, + { 107540, true }, + { 107554, true }, + { 107565, true }, + { 107580, true }, + { 107590, false }, + { 107600, true }, + { 107619, true }, + { 107632, true }, + { 107641, true }, + { 107652, true }, + { 107666, true }, + { 107686, true }, + { 107702, true }, + { 107713, true }, + { 107729, true }, + { 107746, true }, + { 107761, true }, + { 107782, true }, + { 107795, true }, { 107812, true }, - { 107823, true }, - { 107833, true }, - { 107848, true }, - { 107861, true }, - { 107875, true }, - { 107887, true }, - { 107897, true }, + { 107822, true }, + { 107830, true }, + { 107841, true }, + { 107851, true }, + { 107866, true }, + { 107879, true }, + { 107893, true }, { 107905, true }, - { 107924, true }, - { 107944, true }, - { 107953, true }, - { 107967, true }, - { 107981, true }, - { 108023, true }, - { 108039, true }, - { 108048, true }, - { 108060, true }, - { 108072, true }, - { 108085, true }, - { 108098, true }, + { 107915, true }, + { 107923, true }, + { 107942, true }, + { 107962, true }, + { 107971, true }, + { 107985, true }, + { 107999, true }, + { 108041, true }, + { 108057, true }, + { 108066, true }, + { 108078, true }, + { 108090, true }, + { 108103, true }, { 108116, true }, - { 108124, true }, - { 108137, true }, - { 108148, true }, - { 108162, true }, - { 108172, true }, - { 108182, true }, - { 108194, true }, - { 108205, true }, - { 108222, true }, - { 108237, true }, - { 108249, true }, - { 108262, true }, - { 108274, true }, - { 108289, true }, - { 108302, true }, - { 108314, true }, - { 108324, true }, - { 108340, true }, - { 108349, true }, - { 108370, true }, - { 108383, true }, + { 108134, true }, + { 108142, true }, + { 108155, true }, + { 108166, true }, + { 108180, true }, + { 108190, true }, + { 108200, true }, + { 108212, true }, + { 108223, true }, + { 108240, true }, + { 108255, true }, + { 108267, true }, + { 108280, true }, + { 108292, true }, + { 108307, true }, + { 108320, true }, + { 108332, true }, + { 108342, true }, + { 108358, true }, + { 108367, true }, + { 108388, true }, { 108401, true }, - { 108416, true }, - { 108430, true }, + { 108419, true }, + { 108434, true }, { 108448, true }, { 108466, true }, - { 108478, true }, - { 108489, true }, + { 108484, true }, + { 108496, true }, { 108507, true }, - { 108518, true }, - { 108532, true }, - { 108552, true }, - { 108565, true }, - { 108577, true }, - { 108597, true }, - { 108606, true }, + { 108525, true }, + { 108536, true }, + { 108550, true }, + { 108570, true }, + { 108583, true }, + { 108595, true }, { 108615, true }, - { 108622, true }, - { 108637, true }, - { 108652, true }, - { 108666, true }, - { 108685, true }, - { 108709, true }, - { 108720, true }, - { 108734, true }, - { 108746, true }, - { 108759, true }, - { 108772, true }, - { 108783, true }, - { 108796, true }, - { 108808, true }, - { 108831, true }, - { 108840, true }, - { 108857, true }, - { 108870, true }, - { 108882, true }, - { 108893, true }, - { 108908, true }, - { 108922, true }, - { 108930, true }, - { 108944, true }, - { 108958, true }, - { 108966, true }, - { 108979, true }, - { 108990, true }, - { 109002, false }, - { 109015, true }, - { 109039, true }, - { 109047, true }, - { 109057, true }, - { 109067, true }, - { 109084, true }, - { 109102, true }, - { 109120, true }, - { 109130, true }, - { 109154, true }, - { 109168, true }, - { 109187, true }, - { 109199, true }, - { 109218, true }, - { 109235, true }, - { 109245, true }, + { 108624, true }, + { 108633, true }, + { 108640, true }, + { 108655, true }, + { 108670, true }, + { 108689, true }, + { 108713, true }, + { 108724, true }, + { 108738, true }, + { 108750, true }, + { 108763, true }, + { 108776, true }, + { 108787, true }, + { 108800, true }, + { 108812, true }, + { 108835, true }, + { 108844, true }, + { 108861, true }, + { 108874, true }, + { 108886, true }, + { 108897, true }, + { 108912, true }, + { 108926, true }, + { 108934, true }, + { 108948, true }, + { 108962, true }, + { 108970, true }, + { 108983, true }, + { 108994, true }, + { 109006, false }, + { 109019, true }, + { 109030, true }, + { 109054, true }, + { 109062, true }, + { 109072, true }, + { 109082, true }, + { 109099, true }, + { 109117, true }, + { 109135, true }, + { 109145, true }, + { 109169, true }, + { 109183, true }, + { 109202, true }, + { 109214, true }, + { 109233, true }, + { 109250, true }, { 109260, true }, - { 109280, true }, - { 109292, true }, - { 109304, true }, - { 109317, true }, - { 109326, true }, - { 109335, true }, - { 109344, true }, - { 109356, true }, - { 109366, true }, - { 109375, true }, + { 109275, true }, + { 109295, true }, + { 109307, true }, + { 109319, true }, + { 109332, true }, + { 109341, true }, + { 109350, true }, + { 109359, true }, + { 109378, true }, { 109390, true }, - { 109405, false }, - { 109423, true }, - { 109434, true }, - { 109446, true }, - { 109462, true }, - { 109477, true }, - { 109493, true }, - { 109519, true }, - { 109530, true }, - { 109545, true }, - { 109560, true }, - { 109575, true }, - { 109593, true }, - { 109603, true }, - { 109618, true }, - { 109633, true }, - { 109646, true }, - { 109662, true }, - { 109685, true }, - { 109698, true }, - { 109711, true }, - { 109724, true }, - { 109743, true }, - { 109759, true }, - { 109774, true }, - { 109788, true }, - { 109800, false }, - { 109819, true }, - { 109834, true }, - { 109852, true }, - { 109863, true }, - { 109875, true }, + { 109400, true }, + { 109409, true }, + { 109424, true }, + { 109439, false }, + { 109457, true }, + { 109468, true }, + { 109480, true }, + { 109496, true }, + { 109511, true }, + { 109527, true }, + { 109553, true }, + { 109564, true }, + { 109579, true }, + { 109594, true }, + { 109609, true }, + { 109627, true }, + { 109637, true }, + { 109652, true }, + { 109667, true }, + { 109680, true }, + { 109696, true }, + { 109719, true }, + { 109732, true }, + { 109745, true }, + { 109758, true }, + { 109777, true }, + { 109793, true }, + { 109808, true }, + { 109822, true }, + { 109834, false }, + { 109853, true }, + { 109868, true }, { 109886, true }, - { 109899, true }, - { 109922, true }, - { 109937, true }, - { 109951, true }, - { 109968, false }, - { 109982, true }, - { 109993, true }, - { 110001, true }, - { 110017, true }, - { 110030, true }, - { 110040, true }, + { 109897, true }, + { 109909, true }, + { 109920, true }, + { 109933, true }, + { 109956, true }, + { 109971, true }, + { 109985, true }, + { 110002, false }, + { 110016, true }, + { 110027, true }, + { 110035, true }, { 110051, true }, - { 110059, true }, - { 110076, true }, - { 110091, true }, - { 110101, true }, - { 110111, true }, - { 110122, true }, - { 110133, true }, - { 110153, true }, - { 110168, true }, - { 110185, true }, - { 110199, true }, - { 110215, true }, - { 110225, true }, - { 110236, true }, - { 110255, true }, - { 110266, true }, - { 110288, true }, - { 110302, true }, - { 110313, true }, - { 110326, true }, + { 110064, true }, + { 110074, true }, + { 110085, true }, + { 110093, true }, + { 110110, true }, + { 110125, true }, + { 110135, true }, + { 110145, true }, + { 110156, true }, + { 110167, true }, + { 110187, true }, + { 110202, true }, + { 110219, true }, + { 110233, true }, + { 110249, true }, + { 110259, true }, + { 110270, true }, + { 110289, true }, + { 110300, true }, + { 110322, true }, { 110336, true }, - { 110354, true }, - { 110371, true }, - { 110385, true }, - { 110397, true }, - { 110413, true }, - { 110427, true }, - { 110438, true }, - { 110448, true }, - { 110460, true }, - { 110480, true }, - { 110507, true }, - { 110523, true }, - { 110538, true }, - { 110550, true }, - { 110566, true }, - { 110578, true }, - { 110595, true }, - { 110615, true }, - { 110625, true }, - { 110642, true }, - { 110656, true }, - { 110673, true }, - { 110685, true }, - { 110698, false }, - { 110712, true }, - { 110735, false }, - { 110749, true }, - { 110761, true }, - { 110772, true }, - { 110784, true }, - { 110802, true }, - { 110815, true }, - { 110830, true }, - { 110848, true }, - { 110858, true }, - { 110870, true }, - { 110903, true }, - { 110913, true }, - { 110922, true }, - { 110941, true }, - { 110953, true }, - { 110967, true }, - { 110988, true }, - { 111002, true }, - { 111016, true }, - { 111034, true }, - { 111052, true }, - { 111070, true }, - { 111082, true }, - { 111094, true }, - { 111102, true }, + { 110347, true }, + { 110360, true }, + { 110370, true }, + { 110388, true }, + { 110405, true }, + { 110419, true }, + { 110431, true }, + { 110447, true }, + { 110461, true }, + { 110472, true }, + { 110482, true }, + { 110494, true }, + { 110514, true }, + { 110541, true }, + { 110557, true }, + { 110572, true }, + { 110584, true }, + { 110600, true }, + { 110612, true }, + { 110629, true }, + { 110649, true }, + { 110659, true }, + { 110676, true }, + { 110690, true }, + { 110707, true }, + { 110719, true }, + { 110732, false }, + { 110746, true }, + { 110769, false }, + { 110783, true }, + { 110795, true }, + { 110806, true }, + { 110818, true }, + { 110836, true }, + { 110849, true }, + { 110864, true }, + { 110882, true }, + { 110892, true }, + { 110925, true }, + { 110935, true }, + { 110944, true }, + { 110963, true }, + { 110975, true }, + { 110989, true }, + { 111010, true }, + { 111024, true }, + { 111038, true }, + { 111056, true }, + { 111074, true }, + { 111092, true }, + { 111104, true }, { 111116, true }, - { 111132, true }, - { 111147, true }, - { 111161, true }, - { 111170, true }, - { 111180, true }, + { 111124, true }, + { 111138, true }, + { 111154, true }, + { 111169, true }, + { 111183, true }, { 111192, true }, - { 111204, true }, - { 111227, true }, - { 111239, true }, - { 111252, true }, - { 111260, true }, - { 111271, true }, - { 111280, true }, - { 111288, true }, - { 111301, true }, - { 111324, true }, - { 111336, true }, - { 111352, true }, - { 111375, true }, - { 111386, true }, - { 111402, true }, - { 111418, true }, - { 111433, true }, - { 111446, true }, - { 111456, true }, - { 111463, true }, - { 111476, true }, - { 111493, true }, - { 111516, true }, - { 111533, true }, - { 111551, true }, - { 111580, true }, - { 111597, true }, - { 111613, true }, - { 111623, true }, - { 111637, true }, - { 111651, true }, - { 111663, true }, - { 111672, true }, - { 111688, true }, - { 111705, true }, - { 111721, false }, - { 111736, true }, - { 111749, true }, - { 111760, true }, - { 111778, true }, - { 111792, true }, - { 111810, true }, - { 111828, true }, - { 111836, true }, - { 111846, true }, - { 111854, true }, - { 111864, true }, - { 111875, true }, - { 111885, true }, - { 111899, true }, + { 111202, true }, + { 111214, true }, + { 111226, true }, + { 111249, true }, + { 111261, true }, + { 111274, true }, + { 111282, true }, + { 111293, true }, + { 111302, true }, + { 111310, true }, + { 111323, true }, + { 111346, true }, + { 111358, true }, + { 111374, true }, + { 111397, true }, + { 111408, true }, + { 111424, true }, + { 111440, true }, + { 111455, true }, + { 111468, true }, + { 111478, true }, + { 111485, true }, + { 111498, true }, + { 111515, true }, + { 111538, true }, + { 111555, true }, + { 111573, true }, + { 111602, true }, + { 111619, true }, + { 111635, true }, + { 111645, true }, + { 111659, true }, + { 111673, true }, + { 111685, true }, + { 111694, true }, + { 111710, true }, + { 111727, true }, + { 111743, false }, + { 111758, true }, + { 111771, true }, + { 111782, true }, + { 111800, true }, + { 111814, true }, + { 111832, true }, + { 111850, true }, + { 111858, true }, + { 111868, true }, + { 111876, true }, + { 111886, true }, + { 111897, true }, { 111907, true }, - { 111919, true }, - { 111933, true }, - { 111951, true }, - { 111960, true }, - { 111971, true }, - { 111986, true }, - { 111994, true }, - { 112009, true }, - { 112027, true }, - { 112039, true }, + { 111921, true }, + { 111929, true }, + { 111941, true }, + { 111955, true }, + { 111973, true }, + { 111982, true }, + { 111993, true }, + { 112008, true }, + { 112016, true }, + { 112031, true }, { 112049, true }, - { 112060, true }, - { 112074, true }, - { 112086, true }, - { 112097, false }, - { 112113, false }, - { 112134, true }, - { 112151, true }, - { 112169, true }, - { 112186, true }, - { 112203, true }, - { 112217, true }, - { 112229, true }, - { 112244, true }, - { 112252, true }, - { 112265, true }, - { 112283, true }, - { 112307, true }, - { 112324, true }, - { 112339, true }, - { 112352, true }, - { 112368, true }, - { 112381, true }, - { 112395, true }, - { 112407, true }, - { 112418, true }, + { 112061, true }, + { 112071, true }, + { 112082, true }, + { 112096, true }, + { 112108, true }, + { 112119, false }, + { 112135, false }, + { 112156, true }, + { 112173, true }, + { 112191, true }, + { 112208, true }, + { 112225, true }, + { 112239, true }, + { 112251, true }, + { 112266, true }, + { 112274, true }, + { 112287, true }, + { 112305, true }, + { 112329, true }, + { 112346, true }, + { 112361, true }, + { 112374, true }, + { 112390, true }, + { 112403, true }, + { 112417, true }, { 112429, true }, - { 112439, true }, - { 112450, false }, - { 112471, true }, - { 112482, true }, - { 112496, true }, - { 112508, true }, - { 112522, true }, - { 112540, true }, - { 112554, true }, - { 112565, true }, - { 112582, true }, - { 112593, true }, - { 112613, true }, - { 112627, true }, - { 112641, true }, - { 112654, true }, - { 112665, true }, - { 112684, true }, - { 112700, true }, - { 112713, true }, - { 112721, true }, - { 112735, true }, - { 112748, true }, - { 112760, true }, - { 112773, true }, - { 112785, true }, - { 112797, true }, - { 112812, true }, - { 112822, true }, - { 112837, true }, - { 112851, true }, - { 112864, true }, - { 112874, false }, - { 112885, true }, - { 112907, true }, - { 112921, true }, - { 112934, true }, - { 112944, true }, + { 112440, true }, + { 112451, true }, + { 112461, true }, + { 112472, false }, + { 112493, true }, + { 112504, true }, + { 112518, true }, + { 112530, true }, + { 112544, true }, + { 112562, true }, + { 112576, true }, + { 112587, true }, + { 112604, true }, + { 112615, true }, + { 112635, true }, + { 112646, true }, + { 112660, true }, + { 112674, true }, + { 112687, true }, + { 112698, true }, + { 112717, true }, + { 112733, true }, + { 112746, true }, + { 112754, true }, + { 112768, true }, + { 112781, true }, + { 112793, true }, + { 112806, true }, + { 112818, true }, + { 112830, true }, + { 112845, true }, + { 112855, true }, + { 112870, true }, + { 112884, true }, + { 112897, true }, + { 112907, false }, + { 112918, true }, + { 112940, true }, { 112954, true }, - { 112968, true }, - { 112979, true }, - { 112989, true }, - { 113000, true }, - { 113011, true }, - { 113024, true }, - { 113036, true }, - { 113046, true }, - { 113058, true }, - { 113068, true }, - { 113076, true }, - { 113098, true }, - { 113110, true }, - { 113119, true }, - { 113135, true }, - { 113144, true }, - { 113156, true }, + { 112967, true }, + { 112977, true }, + { 112987, true }, + { 113001, true }, + { 113012, true }, + { 113022, true }, + { 113033, true }, + { 113044, true }, + { 113057, true }, + { 113069, true }, + { 113079, true }, + { 113091, true }, + { 113101, true }, + { 113109, true }, + { 113131, true }, + { 113143, true }, + { 113152, true }, { 113168, true }, - { 113178, true }, - { 113188, true }, - { 113199, true }, - { 113212, false }, - { 113223, true }, - { 113236, false }, - { 113261, true }, - { 113273, true }, - { 113282, true }, - { 113291, true }, - { 113308, true }, - { 113326, true }, - { 113334, true }, - { 113353, true }, - { 113366, true }, - { 113380, true }, - { 113390, true }, - { 113402, true }, - { 113426, true }, - { 113440, true }, - { 113458, true }, - { 113476, true }, - { 113490, true }, - { 113508, true }, - { 113524, true }, + { 113177, true }, + { 113189, true }, + { 113201, true }, + { 113211, true }, + { 113221, true }, + { 113232, true }, + { 113245, false }, + { 113256, true }, + { 113269, false }, + { 113294, true }, + { 113306, true }, + { 113315, true }, + { 113324, true }, + { 113341, true }, + { 113359, true }, + { 113367, true }, + { 113386, true }, + { 113399, true }, + { 113413, true }, + { 113423, true }, + { 113435, true }, + { 113459, true }, + { 113473, true }, + { 113491, true }, + { 113509, true }, + { 113527, true }, { 113543, true }, - { 113553, true }, - { 113576, true }, - { 113590, false }, - { 113603, true }, - { 113613, true }, - { 113626, true }, - { 113635, true }, - { 113646, true }, - { 113658, false }, - { 113671, true }, - { 113681, true }, - { 113689, true }, - { 113701, true }, - { 113713, true }, - { 113721, true }, - { 113733, true }, - { 113748, true }, - { 113757, true }, - { 113763, true }, - { 113775, true }, - { 113785, true }, + { 113562, true }, + { 113572, true }, + { 113595, true }, + { 113609, false }, + { 113622, true }, + { 113632, true }, + { 113645, true }, + { 113654, true }, + { 113665, true }, + { 113677, false }, + { 113690, true }, + { 113700, true }, + { 113708, true }, + { 113720, true }, + { 113732, true }, + { 113740, true }, + { 113752, true }, + { 113767, true }, + { 113776, true }, + { 113782, true }, { 113794, true }, { 113804, true }, - { 113811, false }, - { 113826, true }, - { 113844, true }, - { 113859, true }, - { 113872, true }, - { 113886, true }, - { 113898, true }, - { 113912, true }, - { 113925, true }, - { 113936, true }, - { 113945, true }, - { 113960, true }, + { 113813, true }, + { 113823, true }, + { 113830, false }, + { 113845, true }, + { 113863, true }, + { 113878, true }, + { 113891, true }, + { 113905, true }, + { 113917, true }, + { 113931, true }, + { 113944, true }, + { 113955, true }, + { 113964, true }, { 113979, true }, - { 113989, true }, - { 114002, true }, - { 114010, true }, - { 114023, true }, - { 114035, true }, - { 114048, true }, - { 114068, true }, + { 113998, true }, + { 114008, true }, + { 114021, true }, + { 114029, true }, + { 114042, true }, + { 114054, true }, + { 114067, true }, { 114087, true }, - { 114104, true }, - { 114116, true }, - { 114131, true }, - { 114144, true }, - { 114156, true }, + { 114106, true }, + { 114123, true }, + { 114135, true }, + { 114150, true }, + { 114163, true }, { 114175, true }, - { 114183, true }, + { 114194, true }, { 114202, true }, - { 114220, true }, - { 114242, true }, - { 114258, true }, - { 114269, true }, - { 114284, true }, - { 114294, true }, - { 114308, true }, - { 114323, true }, + { 114221, true }, + { 114239, true }, + { 114261, true }, + { 114277, true }, + { 114288, true }, + { 114303, true }, + { 114313, true }, + { 114327, true }, { 114342, true }, - { 114351, false }, - { 114362, true }, - { 114370, true }, - { 114378, true }, - { 114386, true }, - { 114402, true }, - { 114410, true }, + { 114361, true }, + { 114370, false }, + { 114381, true }, + { 114389, true }, + { 114397, true }, + { 114405, true }, { 114421, true }, - { 114433, false }, - { 114447, true }, - { 114461, true }, - { 114472, true }, - { 114481, true }, - { 114497, true }, - { 114519, true }, - { 114531, true }, - { 114549, true }, - { 114556, true }, - { 114568, true }, - { 114578, true }, - { 114594, true }, - { 114604, true }, - { 114616, true }, - { 114634, true }, - { 114652, true }, - { 114672, true }, - { 114682, true }, - { 114705, true }, - { 114760, true }, - { 114772, true }, - { 114787, true }, - { 114797, true }, + { 114430, true }, + { 114438, true }, + { 114449, true }, + { 114461, false }, + { 114475, true }, + { 114489, true }, + { 114500, true }, + { 114509, true }, + { 114525, true }, + { 114547, true }, + { 114559, true }, + { 114577, true }, + { 114584, true }, + { 114596, true }, + { 114606, true }, + { 114622, true }, + { 114632, true }, + { 114644, true }, + { 114662, true }, + { 114680, true }, + { 114700, true }, + { 114710, true }, + { 114733, true }, + { 114788, true }, + { 114800, true }, { 114815, true }, - { 114830, true }, - { 114843, false }, - { 114857, true }, + { 114825, true }, + { 114843, true }, + { 114858, true }, { 114871, false }, - { 114887, true }, - { 114912, true }, - { 114922, true }, - { 114933, true }, - { 114945, true }, - { 114967, true }, - { 114990, true }, - { 115000, true }, - { 115010, true }, - { 115033, true }, - { 115046, false }, - { 115060, true }, - { 115078, true }, - { 115089, true }, - { 115100, true }, - { 115119, true }, - { 115135, true }, - { 115148, true }, - { 115173, true }, - { 115187, true }, - { 115200, true }, - { 115229, true }, - { 115242, true }, - { 115252, true }, - { 115264, true }, - { 115276, true }, - { 115295, true }, - { 115305, true }, - { 115319, true }, - { 115336, true }, - { 115353, true }, - { 115365, true }, - { 115379, true }, + { 114885, true }, + { 114899, false }, + { 114915, true }, + { 114940, true }, + { 114950, true }, + { 114961, true }, + { 114973, true }, + { 114995, true }, + { 115018, true }, + { 115028, true }, + { 115038, true }, + { 115061, true }, + { 115074, false }, + { 115088, true }, + { 115106, true }, + { 115117, true }, + { 115128, true }, + { 115147, true }, + { 115163, true }, + { 115176, true }, + { 115201, true }, + { 115215, true }, + { 115228, true }, + { 115257, true }, + { 115270, true }, + { 115280, true }, + { 115292, true }, + { 115304, true }, + { 115323, true }, + { 115333, true }, + { 115347, true }, + { 115364, true }, + { 115381, true }, { 115393, true }, - { 115403, true }, - { 115420, true }, - { 115432, true }, - { 115443, true }, - { 115459, true }, - { 115474, true }, - { 115486, false }, - { 115495, true }, - { 115515, true }, - { 115535, true }, - { 115551, true }, - { 115565, true }, - { 115578, true }, + { 115407, true }, + { 115421, true }, + { 115431, true }, + { 115448, true }, + { 115460, true }, + { 115471, true }, + { 115487, true }, + { 115502, true }, + { 115514, false }, + { 115523, true }, + { 115543, true }, + { 115563, true }, + { 115579, true }, { 115593, true }, - { 115605, true }, - { 115615, true }, - { 115636, true }, - { 115650, true }, + { 115606, true }, + { 115621, true }, + { 115633, true }, + { 115643, true }, { 115664, true }, - { 115682, true }, - { 115697, true }, - { 115709, true }, - { 115727, true }, - { 115738, true }, - { 115751, true }, - { 115761, true }, - { 115773, true }, - { 115787, true }, - { 115799, true }, - { 115818, true }, - { 115830, true }, - { 115842, true }, - { 115854, true }, - { 115875, true }, - { 115891, true }, - { 115904, true }, - { 115921, true }, - { 115936, true }, - { 115950, true }, - { 115963, true }, - { 115976, true }, - { 115990, true }, - { 116005, true }, - { 116017, true }, - { 116030, true }, - { 116049, true }, - { 116072, false }, - { 116085, true }, - { 116093, true }, - { 116113, false }, - { 116131, true }, - { 116151, true }, - { 116164, true }, + { 115678, true }, + { 115692, true }, + { 115710, true }, + { 115725, true }, + { 115737, true }, + { 115755, true }, + { 115766, true }, + { 115779, true }, + { 115789, true }, + { 115801, true }, + { 115815, true }, + { 115827, true }, + { 115846, true }, + { 115858, true }, + { 115870, true }, + { 115882, true }, + { 115903, true }, + { 115919, true }, + { 115932, true }, + { 115949, true }, + { 115964, true }, + { 115978, true }, + { 115991, true }, + { 116004, true }, + { 116018, true }, + { 116033, true }, + { 116045, true }, + { 116058, true }, + { 116077, true }, + { 116100, false }, + { 116113, true }, + { 116121, true }, + { 116141, false }, + { 116159, true }, { 116179, true }, - { 116194, true }, - { 116209, true }, - { 116223, true }, - { 116238, true }, + { 116192, true }, + { 116207, true }, + { 116222, true }, + { 116237, true }, { 116251, true }, - { 116276, true }, - { 116287, true }, - { 116303, true }, - { 116317, true }, - { 116330, true }, - { 116358, true }, - { 116385, true }, - { 116410, true }, - { 116438, true }, - { 116452, true }, - { 116466, true }, - { 116480, true }, - { 116496, true }, - { 116509, true }, - { 116520, true }, - { 116531, true }, - { 116542, true }, - { 116554, true }, - { 116582, true }, - { 116592, true }, - { 116602, true }, + { 116266, true }, + { 116279, true }, + { 116304, true }, + { 116320, true }, + { 116334, true }, + { 116347, true }, + { 116375, true }, + { 116402, true }, + { 116427, true }, + { 116455, true }, + { 116469, true }, + { 116483, true }, + { 116497, true }, + { 116513, true }, + { 116526, true }, + { 116537, true }, + { 116548, true }, + { 116559, true }, + { 116571, true }, + { 116599, true }, + { 116609, true }, { 116619, true }, { 116636, true }, - { 116646, true }, - { 116669, true }, - { 116679, true }, - { 116688, true }, - { 116710, true }, - { 116722, true }, - { 116733, true }, - { 116745, true }, - { 116757, true }, - { 116768, true }, - { 116786, true }, - { 116801, true }, - { 116811, true }, - { 116820, true }, - { 116838, false }, - { 116849, true }, - { 116860, true }, - { 116870, true }, - { 116878, true }, - { 116892, true }, - { 116904, true }, - { 116916, true }, - { 116934, true }, - { 116954, true }, - { 116969, true }, + { 116653, true }, + { 116663, true }, + { 116686, true }, + { 116696, true }, + { 116705, true }, + { 116727, true }, + { 116739, true }, + { 116750, true }, + { 116762, true }, + { 116774, true }, + { 116785, true }, + { 116803, true }, + { 116818, true }, + { 116828, true }, + { 116837, true }, + { 116855, false }, + { 116866, true }, + { 116877, true }, + { 116887, true }, + { 116895, true }, + { 116909, true }, + { 116921, true }, + { 116933, true }, + { 116951, true }, + { 116971, true }, { 116986, true }, - { 117002, true }, - { 117015, true }, - { 117026, true }, - { 117041, true }, - { 117062, true }, - { 117078, true }, - { 117091, true }, - { 117116, true }, - { 117132, true }, - { 117141, true }, - { 117161, true }, - { 117176, true }, - { 117187, true }, - { 117198, true }, - { 117212, true }, - { 117224, true }, + { 117003, true }, + { 117019, true }, + { 117032, true }, + { 117043, true }, + { 117058, true }, + { 117079, true }, + { 117095, true }, + { 117108, true }, + { 117133, true }, + { 117149, true }, + { 117158, true }, + { 117178, true }, + { 117193, true }, + { 117204, true }, + { 117215, true }, + { 117229, true }, { 117241, true }, - { 117252, true }, - { 117260, true }, - { 117272, true }, - { 117284, true }, - { 117298, true }, - { 117312, true }, + { 117258, true }, + { 117269, true }, + { 117277, true }, + { 117289, true }, + { 117301, true }, + { 117315, true }, { 117329, true }, - { 117345, true }, - { 117361, true }, - { 117377, true }, - { 117396, true }, - { 117411, true }, - { 117423, true }, - { 117440, false }, - { 117460, true }, - { 117476, true }, - { 117487, true }, - { 117507, true }, - { 117528, true }, - { 117549, false }, - { 117566, true }, - { 117585, true }, - { 117600, true }, - { 117611, true }, + { 117346, true }, + { 117362, true }, + { 117378, true }, + { 117394, true }, + { 117413, true }, + { 117428, true }, + { 117440, true }, + { 117457, false }, + { 117477, true }, + { 117493, true }, + { 117504, true }, + { 117524, true }, + { 117545, true }, + { 117566, false }, + { 117583, true }, + { 117602, true }, + { 117617, true }, { 117628, true }, - { 117636, true }, - { 117663, true }, - { 117674, true }, + { 117645, true }, + { 117653, true }, + { 117680, true }, { 117691, true }, - { 117701, true }, - { 117716, true }, - { 117728, true }, - { 117749, true }, - { 117758, true }, - { 117771, true }, - { 117784, true }, - { 117802, true }, - { 117811, true }, - { 117820, true }, - { 117829, false }, + { 117708, true }, + { 117718, true }, + { 117733, true }, + { 117745, true }, + { 117766, true }, + { 117775, true }, + { 117788, true }, + { 117801, true }, + { 117819, true }, + { 117828, true }, + { 117837, true }, { 117846, false }, - { 117857, true }, - { 117875, true }, - { 117886, true }, - { 117901, true }, - { 117916, true }, - { 117932, true }, - { 117954, true }, - { 117969, true }, - { 117977, true }, - { 117990, true }, - { 118002, true }, + { 117863, false }, + { 117874, true }, + { 117892, true }, + { 117903, true }, + { 117918, true }, + { 117933, true }, + { 117949, true }, + { 117971, true }, + { 117986, true }, + { 117994, true }, + { 118007, true }, { 118019, true }, - { 118033, true }, - { 118043, true }, - { 118061, true }, + { 118036, true }, + { 118050, true }, + { 118060, true }, { 118078, true }, { 118095, true }, - { 118103, true }, - { 118127, true }, - { 118145, true }, - { 118159, true }, - { 118177, true }, - { 118190, true }, - { 118204, true }, - { 118218, true }, - { 118237, true }, - { 118247, true }, - { 118269, true }, - { 118281, true }, - { 118292, true }, - { 118319, true }, - { 118331, true }, - { 118343, true }, - { 118364, true }, - { 118377, true }, - { 118384, true }, - { 118404, true }, - { 118414, true }, - { 118426, true }, - { 118442, true }, - { 118452, false }, - { 118469, true }, - { 118480, true }, - { 118487, true }, - { 118496, true }, - { 118515, true }, - { 118528, true }, - { 118538, true }, - { 118558, true }, - { 118568, true }, - { 118578, true }, - { 118586, true }, - { 118599, true }, + { 118112, true }, + { 118120, true }, + { 118144, true }, + { 118162, true }, + { 118176, true }, + { 118194, true }, + { 118207, true }, + { 118221, true }, + { 118235, true }, + { 118254, true }, + { 118264, true }, + { 118286, true }, + { 118298, true }, + { 118309, true }, + { 118336, true }, + { 118348, true }, + { 118360, true }, + { 118381, true }, + { 118394, true }, + { 118401, true }, + { 118421, true }, + { 118431, true }, + { 118443, true }, + { 118459, true }, + { 118469, false }, + { 118486, true }, + { 118497, true }, + { 118504, true }, + { 118513, true }, + { 118532, true }, + { 118545, true }, + { 118555, true }, + { 118575, true }, + { 118585, true }, + { 118595, true }, + { 118603, true }, { 118616, true }, - { 118628, false }, - { 118639, false }, - { 118654, true }, - { 118666, true }, - { 118681, true }, - { 118691, true }, - { 118709, true }, - { 118720, true }, - { 118732, true }, - { 118753, false }, - { 118779, true }, - { 118793, true }, - { 118807, true }, - { 118821, true }, - { 118834, true }, - { 118848, false }, - { 118861, true }, - { 118872, true }, - { 118886, true }, - { 118899, true }, - { 118911, true }, - { 118924, true }, - { 118941, false }, - { 118955, true }, - { 118973, true }, - { 118986, true }, - { 118999, true }, - { 119012, true }, - { 119032, true }, - { 119042, true }, - { 119053, true }, - { 119064, true }, - { 119075, true }, - { 119087, true }, - { 119100, true }, - { 119124, true }, - { 119136, true }, - { 119148, true }, - { 119162, true }, - { 119177, true }, - { 119200, true }, - { 119211, true }, - { 119225, true }, - { 119238, false }, - { 119253, true }, - { 119265, true }, - { 119275, true }, - { 119291, true }, - { 119303, true }, - { 119317, true }, - { 119327, true }, - { 119341, true }, - { 119354, true }, - { 119367, true }, - { 119381, true }, - { 119391, true }, - { 119419, true }, - { 119447, true }, - { 119457, true }, - { 119469, true }, - { 119479, true }, - { 119489, true }, - { 119502, true }, - { 119518, true }, - { 119531, true }, - { 119547, false }, - { 119562, true }, - { 119580, true }, - { 119599, true }, - { 119607, true }, - { 119620, true }, - { 119635, true }, - { 119649, true }, - { 119665, true }, - { 119679, true }, - { 119697, true }, - { 119707, true }, - { 119716, false }, - { 119727, true }, - { 119743, true }, - { 119754, true }, - { 119764, true }, - { 119776, true }, - { 119786, true }, - { 119813, true }, - { 119831, true }, - { 119845, true }, - { 119856, true }, - { 119865, true }, - { 119874, true }, - { 119891, false }, - { 119905, true }, - { 119928, true }, - { 119944, true }, - { 119965, true }, - { 119981, true }, - { 119994, true }, - { 120016, true }, - { 120026, true }, - { 120034, true }, + { 118633, true }, + { 118645, false }, + { 118656, false }, + { 118671, true }, + { 118683, true }, + { 118698, true }, + { 118708, true }, + { 118726, true }, + { 118737, true }, + { 118749, true }, + { 118770, false }, + { 118796, true }, + { 118810, true }, + { 118824, true }, + { 118838, true }, + { 118851, true }, + { 118865, false }, + { 118878, true }, + { 118889, true }, + { 118903, true }, + { 118916, true }, + { 118928, true }, + { 118941, true }, + { 118958, false }, + { 118972, true }, + { 118990, true }, + { 119003, true }, + { 119016, true }, + { 119029, true }, + { 119049, true }, + { 119059, true }, + { 119070, true }, + { 119081, true }, + { 119092, true }, + { 119104, true }, + { 119117, true }, + { 119141, true }, + { 119153, true }, + { 119165, true }, + { 119179, true }, + { 119194, true }, + { 119217, true }, + { 119228, true }, + { 119242, true }, + { 119255, false }, + { 119270, true }, + { 119282, true }, + { 119292, true }, + { 119308, true }, + { 119320, true }, + { 119334, true }, + { 119344, true }, + { 119358, true }, + { 119371, true }, + { 119384, true }, + { 119398, true }, + { 119408, true }, + { 119436, true }, + { 119464, true }, + { 119474, true }, + { 119486, true }, + { 119496, true }, + { 119506, true }, + { 119519, true }, + { 119535, true }, + { 119548, true }, + { 119564, false }, + { 119579, true }, + { 119597, true }, + { 119616, true }, + { 119624, true }, + { 119637, true }, + { 119652, true }, + { 119666, true }, + { 119682, true }, + { 119696, true }, + { 119714, true }, + { 119724, true }, + { 119733, false }, + { 119744, true }, + { 119760, true }, + { 119771, true }, + { 119781, true }, + { 119793, true }, + { 119803, true }, + { 119830, true }, + { 119848, true }, + { 119862, true }, + { 119873, true }, + { 119882, true }, + { 119891, true }, + { 119908, false }, + { 119922, true }, + { 119945, true }, + { 119961, true }, + { 119982, true }, + { 119998, true }, + { 120011, true }, + { 120033, true }, { 120043, true }, - { 120054, true }, - { 120069, true }, - { 120083, true }, - { 120093, true }, + { 120051, true }, + { 120060, true }, + { 120071, true }, + { 120086, true }, + { 120100, true }, { 120110, true }, - { 120125, true }, - { 120139, true }, - { 120149, true }, - { 120169, true }, - { 120179, true }, - { 120193, true }, - { 120205, true }, - { 120224, true }, - { 120237, true }, - { 120261, false }, - { 120280, true }, - { 120308, true }, - { 120322, true }, - { 120336, true }, - { 120348, true }, - { 120362, true }, - { 120372, true }, - { 120394, true }, - { 120413, true }, - { 120431, true }, - { 120439, true }, - { 120455, true }, - { 120470, true }, - { 120478, true }, - { 120489, true }, - { 120502, true }, - { 120518, true }, - { 120532, true }, - { 120548, true }, - { 120562, true }, - { 120577, true }, - { 120592, true }, - { 120604, true }, - { 120616, true }, - { 120635, true }, - { 120651, false }, - { 120676, true }, - { 120695, true }, + { 120127, true }, + { 120142, true }, + { 120156, true }, + { 120166, true }, + { 120186, true }, + { 120196, true }, + { 120210, true }, + { 120222, true }, + { 120241, true }, + { 120254, true }, + { 120278, false }, + { 120297, true }, + { 120325, true }, + { 120339, true }, + { 120353, true }, + { 120365, true }, + { 120379, true }, + { 120389, true }, + { 120411, true }, + { 120430, true }, + { 120448, true }, + { 120456, true }, + { 120472, true }, + { 120487, true }, + { 120495, true }, + { 120506, true }, + { 120519, true }, + { 120535, true }, + { 120549, true }, + { 120565, true }, + { 120579, true }, + { 120594, true }, + { 120609, true }, + { 120621, true }, + { 120633, true }, + { 120652, true }, + { 120668, false }, + { 120693, true }, { 120712, true }, - { 120722, true }, - { 120733, true }, - { 120745, false }, - { 120760, true }, - { 120778, true }, - { 120787, true }, - { 120794, true }, - { 120805, true }, - { 120819, true }, - { 120832, true }, - { 120845, true }, - { 120858, true }, - { 120869, true }, - { 120882, true }, - { 120892, true }, - { 120902, true }, - { 120914, true }, - { 120922, true }, - { 120934, true }, - { 120943, true }, - { 120950, true }, + { 120729, true }, + { 120739, true }, + { 120750, true }, + { 120762, false }, + { 120777, true }, + { 120795, true }, + { 120804, true }, + { 120811, true }, + { 120822, true }, + { 120836, true }, + { 120849, true }, + { 120862, true }, + { 120875, true }, + { 120886, true }, + { 120899, true }, + { 120909, true }, + { 120919, true }, + { 120931, true }, + { 120939, true }, + { 120951, true }, { 120960, true }, - { 120971, true }, - { 120981, true }, - { 120999, true }, - { 121017, true }, - { 121031, true }, - { 121045, true }, - { 121068, true }, - { 121078, true }, - { 121093, true }, - { 121111, true }, + { 120967, true }, + { 120977, true }, + { 120988, true }, + { 120998, true }, + { 121016, true }, + { 121034, true }, + { 121048, true }, + { 121062, true }, + { 121085, true }, + { 121095, true }, + { 121110, true }, { 121128, true }, - { 121142, true }, - { 121156, true }, - { 121171, true }, - { 121187, true }, - { 121200, true }, - { 121214, true }, - { 121226, true }, - { 121238, true }, - { 121250, true }, - { 121263, true }, - { 121276, false }, - { 121287, true }, - { 121301, true }, - { 121314, true }, - { 121329, true }, - { 121336, true }, - { 121355, true }, - { 121374, true }, - { 121389, true }, - { 121413, false }, - { 121428, true }, - { 121439, true }, - { 121462, false }, - { 121473, false }, - { 121484, false }, - { 121496, true }, - { 121510, true }, - { 121523, true }, - { 121536, true }, - { 121549, true }, - { 121571, true }, - { 121581, true }, - { 121601, true }, - { 121619, true }, - { 121633, true }, - { 121650, false }, - { 121665, false }, - { 121681, true }, - { 121698, true }, - { 121709, true }, - { 121731, true }, - { 121745, true }, - { 121765, true }, - { 121775, true }, - { 121786, true }, - { 121794, true }, - { 121803, true }, - { 121814, true }, - { 121826, true }, - { 121836, true }, - { 121851, true }, - { 121864, true }, - { 121878, true }, - { 121886, true }, - { 121903, true }, - { 121924, true }, - { 121938, true }, - { 121953, true }, - { 121967, true }, - { 121987, true }, - { 122002, true }, - { 122013, true }, - { 122025, true }, - { 122044, true }, - { 122057, true }, - { 122069, true }, - { 122080, false }, - { 122096, true }, - { 122109, true }, - { 122123, true }, - { 122136, true }, - { 122146, true }, - { 122166, true }, - { 122189, true }, - { 122209, true }, - { 122220, true }, - { 122230, true }, - { 122240, true }, - { 122255, true }, - { 122265, true }, - { 122282, true }, - { 122298, true }, - { 122313, true }, - { 122333, true }, - { 122343, true }, - { 122357, true }, - { 122369, true }, - { 122383, true }, - { 122397, true }, - { 122411, true }, - { 122425, true }, - { 122439, true }, - { 122454, true }, - { 122468, true }, - { 122482, true }, - { 122496, true }, - { 122516, true }, - { 122533, true }, - { 122548, true }, - { 122559, true }, - { 122572, true }, - { 122590, true }, - { 122605, true }, - { 122621, true }, - { 122633, true }, - { 122650, true }, - { 122663, true }, - { 122678, true }, - { 122687, false }, - { 122702, true }, - { 122713, true }, - { 122728, true }, - { 122740, true }, - { 122757, true }, - { 122766, true }, - { 122778, true }, - { 122795, false }, - { 122805, true }, - { 122824, true }, - { 122834, true }, - { 122850, true }, - { 122870, true }, - { 122884, true }, + { 121145, true }, + { 121159, true }, + { 121173, true }, + { 121188, true }, + { 121204, true }, + { 121217, true }, + { 121231, true }, + { 121243, true }, + { 121255, true }, + { 121268, true }, + { 121281, false }, + { 121292, true }, + { 121306, true }, + { 121319, true }, + { 121334, true }, + { 121341, true }, + { 121360, true }, + { 121379, true }, + { 121394, true }, + { 121418, false }, + { 121433, true }, + { 121444, true }, + { 121467, false }, + { 121478, false }, + { 121489, false }, + { 121501, true }, + { 121515, true }, + { 121528, true }, + { 121541, true }, + { 121554, true }, + { 121576, true }, + { 121586, true }, + { 121606, true }, + { 121624, true }, + { 121638, true }, + { 121655, false }, + { 121670, false }, + { 121686, true }, + { 121703, true }, + { 121714, true }, + { 121736, true }, + { 121750, true }, + { 121770, true }, + { 121780, true }, + { 121791, true }, + { 121799, true }, + { 121808, true }, + { 121819, true }, + { 121831, true }, + { 121841, true }, + { 121856, true }, + { 121869, true }, + { 121883, true }, + { 121891, true }, + { 121908, true }, + { 121929, true }, + { 121943, true }, + { 121958, true }, + { 121972, true }, + { 121992, true }, + { 122007, true }, + { 122018, true }, + { 122030, true }, + { 122049, true }, + { 122062, true }, + { 122074, true }, + { 122085, false }, + { 122101, true }, + { 122114, true }, + { 122128, true }, + { 122141, true }, + { 122151, true }, + { 122171, true }, + { 122194, true }, + { 122214, true }, + { 122225, true }, + { 122235, true }, + { 122245, true }, + { 122260, true }, + { 122270, true }, + { 122287, true }, + { 122303, true }, + { 122318, true }, + { 122338, true }, + { 122348, true }, + { 122362, true }, + { 122374, true }, + { 122388, true }, + { 122402, true }, + { 122416, true }, + { 122430, true }, + { 122444, true }, + { 122459, true }, + { 122473, true }, + { 122487, true }, + { 122501, true }, + { 122521, true }, + { 122538, true }, + { 122553, true }, + { 122564, true }, + { 122577, true }, + { 122595, true }, + { 122610, true }, + { 122626, true }, + { 122638, true }, + { 122655, true }, + { 122668, true }, + { 122683, true }, + { 122692, false }, + { 122707, true }, + { 122718, true }, + { 122733, true }, + { 122745, true }, + { 122762, true }, + { 122771, true }, + { 122783, true }, + { 122800, false }, + { 122810, true }, + { 122829, true }, + { 122839, true }, + { 122855, true }, + { 122875, true }, + { 122889, true }, { 122903, true }, - { 122923, true }, - { 122935, true }, - { 122951, true }, - { 122961, true }, - { 122976, true }, - { 122986, true }, - { 123000, true }, - { 123010, true }, + { 122922, true }, + { 122942, true }, + { 122954, true }, + { 122970, true }, + { 122980, true }, + { 122995, true }, + { 123005, true }, + { 123019, true }, { 123029, true }, - { 123046, true }, - { 123055, true }, - { 123068, true }, - { 123083, true }, - { 123097, true }, + { 123048, true }, + { 123065, true }, + { 123074, true }, + { 123087, true }, + { 123102, true }, { 123116, true }, - { 123134, true }, - { 123148, true }, - { 123163, true }, - { 123179, true }, - { 123195, true }, - { 123203, true }, - { 123223, true }, - { 123235, true }, - { 123247, true }, - { 123259, true }, - { 123272, true }, - { 123285, true }, - { 123299, true }, - { 123313, true }, - { 123327, false }, - { 123353, true }, - { 123364, true }, - { 123373, true }, - { 123381, true }, - { 123389, true }, - { 123397, true }, - { 123407, true }, + { 123135, true }, + { 123153, true }, + { 123167, true }, + { 123182, true }, + { 123198, true }, + { 123214, true }, + { 123222, true }, + { 123242, true }, + { 123254, true }, + { 123266, true }, + { 123278, true }, + { 123291, true }, + { 123304, true }, + { 123318, true }, + { 123332, true }, + { 123346, false }, + { 123372, true }, + { 123383, true }, + { 123392, true }, + { 123400, true }, + { 123408, true }, { 123416, true }, - { 123428, true }, + { 123426, true }, + { 123435, true }, { 123447, true }, - { 123457, true }, - { 123468, true }, - { 123478, true }, - { 123495, true }, - { 123508, true }, - { 123518, true }, - { 123532, true }, - { 123543, true }, - { 123561, true }, - { 123579, true }, - { 123593, true }, - { 123603, true }, - { 123617, true }, - { 123624, true }, - { 123634, true }, - { 123649, true }, - { 123671, true }, - { 123679, true }, - { 123689, true }, + { 123466, true }, + { 123476, true }, + { 123487, true }, + { 123497, true }, + { 123514, true }, + { 123527, true }, + { 123537, true }, + { 123551, true }, + { 123562, true }, + { 123580, true }, + { 123598, true }, + { 123612, true }, + { 123622, true }, + { 123636, true }, + { 123643, true }, + { 123653, true }, + { 123668, true }, + { 123690, true }, + { 123698, true }, { 123708, true }, - { 123720, true }, - { 123730, true }, - { 123740, true }, - { 123750, true }, - { 123761, true }, - { 123774, true }, - { 123782, true }, - { 123796, true }, - { 123806, true }, - { 123817, true }, - { 123824, true }, - { 123832, true }, - { 123850, true }, - { 123861, true }, - { 123877, false }, - { 123892, true }, - { 123902, true }, + { 123727, true }, + { 123739, true }, + { 123749, true }, + { 123759, true }, + { 123769, true }, + { 123780, true }, + { 123793, true }, + { 123801, true }, + { 123815, true }, + { 123825, true }, + { 123836, true }, + { 123843, true }, + { 123851, true }, + { 123869, true }, + { 123880, true }, + { 123896, false }, { 123911, true }, - { 123919, true }, - { 123928, true }, - { 123937, true }, - { 123957, true }, - { 123966, false }, - { 123977, true }, - { 123989, false }, - { 124003, true }, - { 124012, true }, - { 124028, true }, - { 124041, true }, - { 124054, true }, - { 124066, true }, - { 124081, true }, + { 123921, true }, + { 123930, true }, + { 123938, true }, + { 123947, true }, + { 123956, true }, + { 123976, true }, + { 123985, false }, + { 123996, true }, + { 124008, false }, + { 124022, true }, + { 124038, true }, + { 124051, true }, + { 124064, true }, + { 124076, true }, { 124091, true }, - { 124103, true }, - { 124115, true }, - { 124126, true }, - { 124137, true }, - { 124149, true }, - { 124172, true }, + { 124101, true }, + { 124113, true }, + { 124125, true }, + { 124136, true }, + { 124147, true }, + { 124159, true }, { 124182, true }, { 124192, true }, - { 124208, true }, - { 124223, true }, - { 124236, true }, - { 124245, true }, - { 124260, true }, - { 124273, true }, - { 124286, true }, - { 124301, true }, + { 124202, true }, + { 124218, true }, + { 124233, true }, + { 124246, true }, + { 124255, true }, + { 124270, true }, + { 124283, true }, + { 124296, true }, { 124311, true }, - { 124328, true }, - { 124344, true }, - { 124358, false }, - { 124368, true }, - { 124379, true }, + { 124321, true }, + { 124338, true }, + { 124354, true }, + { 124368, false }, + { 124378, true }, { 124389, true }, - { 124403, true }, - { 124414, true }, - { 124427, true }, - { 124440, true }, - { 124457, true }, - { 124469, true }, - { 124486, true }, - { 124504, true }, - { 124515, true }, - { 124528, true }, - { 124549, true }, - { 124560, true }, - { 124584, true }, - { 124599, true }, - { 124624, true }, - { 124632, true }, - { 124648, false }, - { 124663, true }, - { 124675, true }, - { 124687, true }, - { 124701, true }, - { 124715, true }, - { 124729, true }, - { 124743, true }, - { 124760, true }, - { 124787, true }, - { 124804, true }, - { 124824, true }, - { 124836, true }, + { 124399, true }, + { 124413, true }, + { 124424, true }, + { 124437, true }, + { 124450, true }, + { 124467, true }, + { 124479, true }, + { 124496, true }, + { 124514, true }, + { 124525, true }, + { 124538, true }, + { 124559, true }, + { 124570, true }, + { 124594, true }, + { 124609, true }, + { 124634, true }, + { 124642, true }, + { 124658, false }, + { 124673, true }, + { 124685, true }, + { 124697, true }, + { 124711, true }, + { 124725, true }, + { 124739, true }, + { 124753, true }, + { 124770, true }, + { 124797, true }, + { 124814, true }, + { 124834, true }, { 124846, true }, - { 124860, true }, - { 124882, true }, - { 124896, true }, - { 124914, true }, - { 124935, true }, - { 124952, true }, - { 124963, true }, - { 124977, true }, - { 124990, true }, - { 125006, true }, - { 125018, true }, - { 125034, true }, - { 125051, true }, - { 125065, true }, - { 125077, false }, - { 125102, true }, - { 125126, true }, - { 125136, false }, - { 125162, true }, - { 125179, true }, - { 125196, true }, - { 125210, true }, - { 125240, false }, - { 125254, true }, - { 125271, true }, - { 125285, true }, - { 125308, true }, - { 125326, true }, - { 125341, true }, - { 125349, true }, - { 125357, true }, - { 125365, true }, - { 125373, true }, - { 125381, true }, - { 125392, true }, + { 124856, true }, + { 124870, true }, + { 124892, true }, + { 124906, true }, + { 124924, true }, + { 124945, true }, + { 124962, true }, + { 124973, true }, + { 124987, true }, + { 125000, true }, + { 125016, true }, + { 125028, true }, + { 125044, true }, + { 125061, true }, + { 125075, true }, + { 125087, false }, + { 125112, true }, + { 125136, true }, + { 125146, false }, + { 125172, true }, + { 125189, true }, + { 125206, true }, + { 125220, true }, + { 125250, false }, + { 125264, true }, + { 125281, true }, + { 125295, true }, + { 125318, true }, + { 125336, true }, + { 125351, true }, + { 125359, true }, + { 125367, true }, + { 125375, true }, + { 125383, true }, + { 125391, true }, { 125402, true }, - { 125416, true }, - { 125435, true }, - { 125451, true }, - { 125462, true }, - { 125487, true }, - { 125499, true }, - { 125508, false }, - { 125524, true }, - { 125534, false }, - { 125556, true }, - { 125571, true }, - { 125585, true }, - { 125598, true }, - { 125615, true }, - { 125631, true }, - { 125654, true }, - { 125676, true }, - { 125694, true }, - { 125713, false }, - { 125732, true }, - { 125745, true }, - { 125758, true }, - { 125782, true }, - { 125793, true }, - { 125812, true }, - { 125840, true }, - { 125861, true }, - { 125874, true }, - { 125894, true }, - { 125914, true }, - { 125928, true }, - { 125941, true }, - { 125962, false }, - { 125973, true }, - { 125992, true }, - { 126003, true }, - { 126015, true }, - { 126026, true }, - { 126056, true }, - { 126067, true }, - { 126081, true }, - { 126095, true }, - { 126107, true }, - { 126121, true }, - { 126141, true }, - { 126156, true }, - { 126167, true }, - { 126191, true }, - { 126212, true }, - { 126225, true }, - { 126242, true }, - { 126258, true }, - { 126276, true }, - { 126298, true }, - { 126315, true }, - { 126329, true }, - { 126343, true }, - { 126359, true }, - { 126379, true }, - { 126394, true }, - { 126411, true }, - { 126438, true }, - { 126457, true }, - { 126472, true }, - { 126483, true }, - { 126497, true }, - { 126514, true }, - { 126530, true }, - { 126547, true }, - { 126562, true }, - { 126573, true }, - { 126589, true }, - { 126605, true }, - { 126622, true }, - { 126642, true }, - { 126657, true }, - { 126676, true }, - { 126692, true }, + { 125412, true }, + { 125426, true }, + { 125445, true }, + { 125461, true }, + { 125472, true }, + { 125497, true }, + { 125509, true }, + { 125518, false }, + { 125534, true }, + { 125544, false }, + { 125566, true }, + { 125581, true }, + { 125595, true }, + { 125608, true }, + { 125625, true }, + { 125641, true }, + { 125664, true }, + { 125686, true }, + { 125704, true }, + { 125723, false }, + { 125742, true }, + { 125755, true }, + { 125768, true }, + { 125792, true }, + { 125803, true }, + { 125822, true }, + { 125850, true }, + { 125871, true }, + { 125884, true }, + { 125904, true }, + { 125924, true }, + { 125938, true }, + { 125951, true }, + { 125972, false }, + { 125983, true }, + { 126002, true }, + { 126013, true }, + { 126025, true }, + { 126036, true }, + { 126066, true }, + { 126077, true }, + { 126091, true }, + { 126105, true }, + { 126117, true }, + { 126131, true }, + { 126151, true }, + { 126166, true }, + { 126177, true }, + { 126201, true }, + { 126222, true }, + { 126235, true }, + { 126252, true }, + { 126268, true }, + { 126286, true }, + { 126308, true }, + { 126325, true }, + { 126339, true }, + { 126353, true }, + { 126369, true }, + { 126389, true }, + { 126404, true }, + { 126421, true }, + { 126448, true }, + { 126467, true }, + { 126482, true }, + { 126493, true }, + { 126507, true }, + { 126524, true }, + { 126540, true }, + { 126557, true }, + { 126572, true }, + { 126583, true }, + { 126599, true }, + { 126615, true }, + { 126632, true }, + { 126652, true }, + { 126667, true }, + { 126686, true }, { 126702, true }, - { 126715, true }, - { 126734, true }, - { 126750, true }, - { 126770, true }, - { 126782, true }, - { 126799, false }, - { 126814, true }, - { 126826, true }, - { 126839, true }, + { 126712, true }, + { 126725, true }, + { 126744, true }, + { 126760, true }, + { 126780, true }, + { 126792, true }, + { 126809, false }, + { 126824, true }, + { 126836, true }, { 126849, true }, - { 126866, true }, - { 126878, false }, - { 126888, true }, - { 126901, true }, - { 126918, true }, - { 126941, true }, - { 126958, true }, - { 126973, true }, - { 126992, true }, - { 127017, true }, - { 127050, true }, + { 126859, true }, + { 126876, true }, + { 126888, false }, + { 126898, true }, + { 126911, true }, + { 126928, true }, + { 126951, true }, + { 126968, true }, + { 126983, true }, + { 127002, true }, + { 127027, true }, { 127060, true }, - { 127074, true }, - { 127090, true }, - { 127109, false }, - { 127132, true }, - { 127146, true }, - { 127160, true }, - { 127172, true }, - { 127187, true }, - { 127207, true }, - { 127219, true }, - { 127239, true }, - { 127257, true }, - { 127268, true }, - { 127283, true }, - { 127296, true }, - { 127309, true }, - { 127322, true }, - { 127333, true }, - { 127348, true }, - { 127359, true }, - { 127375, true }, - { 127389, true }, - { 127401, true }, - { 127415, true }, - { 127423, true }, - { 127442, true }, - { 127456, true }, - { 127478, true }, - { 127495, true }, - { 127504, true }, - { 127517, true }, - { 127527, false }, - { 127539, true }, - { 127550, true }, + { 127070, true }, + { 127084, true }, + { 127100, true }, + { 127119, false }, + { 127142, true }, + { 127156, true }, + { 127170, true }, + { 127182, true }, + { 127197, true }, + { 127217, true }, + { 127229, true }, + { 127249, true }, + { 127267, true }, + { 127278, true }, + { 127293, true }, + { 127306, true }, + { 127319, true }, + { 127332, true }, + { 127343, true }, + { 127358, true }, + { 127369, true }, + { 127385, true }, + { 127399, true }, + { 127411, true }, + { 127425, true }, + { 127433, true }, + { 127452, true }, + { 127466, true }, + { 127488, true }, + { 127505, true }, + { 127514, true }, + { 127527, true }, + { 127537, false }, + { 127549, true }, { 127560, true }, - { 127583, true }, - { 127597, true }, - { 127612, true }, - { 127636, true }, - { 127655, true }, - { 127669, true }, - { 127683, true }, - { 127704, true }, - { 127723, true }, + { 127570, true }, + { 127593, true }, + { 127607, true }, + { 127622, true }, + { 127646, true }, + { 127665, true }, + { 127679, true }, + { 127693, true }, + { 127714, true }, { 127733, true }, - { 127749, true }, - { 127766, true }, - { 127779, true }, - { 127796, true }, - { 127812, true }, - { 127831, true }, - { 127844, true }, - { 127856, true }, - { 127864, true }, - { 127880, true }, - { 127896, true }, - { 127916, true }, - { 127934, true }, - { 127948, true }, - { 127965, true }, - { 127984, true }, - { 128001, true }, - { 128015, true }, - { 128036, true }, - { 128055, true }, - { 128073, true }, - { 128086, true }, + { 127743, true }, + { 127759, true }, + { 127776, true }, + { 127789, true }, + { 127806, true }, + { 127822, true }, + { 127841, true }, + { 127854, true }, + { 127866, true }, + { 127874, true }, + { 127890, true }, + { 127906, true }, + { 127926, true }, + { 127944, true }, + { 127958, true }, + { 127975, true }, + { 127994, true }, + { 128011, true }, + { 128025, true }, + { 128046, true }, + { 128065, true }, + { 128083, true }, { 128096, true }, - { 128114, true }, - { 128134, true }, - { 128154, true }, - { 128163, true }, - { 128177, true }, - { 128194, true }, - { 128217, true }, - { 128226, true }, - { 128242, true }, - { 128260, true }, - { 128272, true }, - { 128281, true }, - { 128294, true }, - { 128307, true }, - { 128323, true }, - { 128331, false }, - { 128343, true }, + { 128106, true }, + { 128124, true }, + { 128144, true }, + { 128164, true }, + { 128173, true }, + { 128187, true }, + { 128204, true }, + { 128227, true }, + { 128236, true }, + { 128252, true }, + { 128270, true }, + { 128282, true }, + { 128291, true }, + { 128304, true }, + { 128317, true }, + { 128333, true }, + { 128341, false }, { 128353, true }, - { 128372, true }, - { 128387, true }, - { 128402, true }, - { 128421, true }, - { 128443, true }, - { 128462, true }, - { 128476, true }, - { 128488, true }, - { 128502, true }, - { 128515, false }, - { 128537, true }, - { 128554, true }, - { 128572, true }, - { 128585, true }, - { 128599, true }, - { 128610, true }, - { 128624, false }, - { 128644, true }, - { 128655, false }, - { 128664, true }, - { 128679, false }, - { 128697, true }, - { 128710, true }, + { 128363, true }, + { 128382, true }, + { 128397, true }, + { 128412, true }, + { 128431, true }, + { 128453, true }, + { 128472, true }, + { 128486, true }, + { 128498, true }, + { 128512, true }, + { 128525, false }, + { 128547, true }, + { 128564, true }, + { 128582, true }, + { 128595, true }, + { 128609, true }, + { 128620, true }, + { 128634, false }, + { 128654, true }, + { 128665, false }, + { 128674, true }, + { 128689, false }, + { 128707, true }, { 128720, true }, - { 128731, false }, - { 128746, true }, - { 128755, true }, - { 128767, true }, - { 128776, true }, - { 128789, true }, - { 128802, true }, - { 128815, true }, - { 128832, false }, - { 128849, true }, - { 128856, true }, - { 128864, true }, - { 128873, true }, - { 128885, true }, - { 128908, true }, - { 128922, true }, - { 128936, true }, - { 128953, true }, - { 128967, false }, - { 128983, false }, - { 128997, true }, - { 129004, true }, + { 128730, true }, + { 128741, false }, + { 128756, true }, + { 128765, true }, + { 128777, true }, + { 128786, true }, + { 128799, true }, + { 128812, true }, + { 128825, true }, + { 128842, false }, + { 128859, true }, + { 128866, true }, + { 128874, true }, + { 128883, true }, + { 128895, true }, + { 128918, true }, + { 128932, true }, + { 128946, true }, + { 128963, true }, + { 128977, false }, + { 128993, false }, + { 129007, true }, { 129014, true }, - { 129025, true }, - { 129040, true }, - { 129052, true }, - { 129060, true }, - { 129072, true }, - { 129087, false }, - { 129097, true }, - { 129109, true }, - { 129121, true }, - { 129136, true }, - { 129165, true }, - { 129179, true }, - { 129187, true }, - { 129195, true }, - { 129204, true }, - { 129217, true }, - { 129225, true }, - { 129236, true }, - { 129247, true }, - { 129254, true }, - { 129263, true }, + { 129024, true }, + { 129035, true }, + { 129050, true }, + { 129062, true }, + { 129070, true }, + { 129082, true }, + { 129097, false }, + { 129107, true }, + { 129119, true }, + { 129131, true }, + { 129146, true }, + { 129175, true }, + { 129189, true }, + { 129197, true }, + { 129205, true }, + { 129214, true }, + { 129227, true }, + { 129235, true }, + { 129246, true }, + { 129257, true }, + { 129264, true }, { 129273, true }, - { 129293, true }, - { 129305, true }, - { 129317, true }, - { 129326, false }, - { 129335, true }, - { 129355, false }, - { 129376, true }, - { 129387, true }, - { 129400, true }, - { 129409, true }, - { 129423, true }, - { 129440, true }, - { 129456, true }, - { 129474, true }, - { 129488, true }, - { 129505, true }, - { 129517, true }, - { 129530, true }, - { 129542, true }, - { 129556, true }, - { 129574, true }, - { 129588, true }, - { 129604, false }, - { 129622, true }, - { 129639, true }, - { 129661, true }, - { 129684, true }, - { 129695, true }, - { 129706, true }, - { 129717, true }, - { 129728, true }, - { 129740, true }, - { 129754, true }, - { 129765, true }, - { 129777, true }, - { 129793, true }, - { 129822, false }, - { 129841, true }, - { 129857, true }, - { 129883, true }, - { 129897, true }, - { 129914, true }, - { 129933, true }, - { 129950, true }, - { 129966, true }, - { 129977, true }, - { 129985, true }, - { 129997, true }, - { 130014, true }, - { 130027, true }, - { 130042, true }, - { 130055, true }, - { 130069, true }, - { 130081, true }, - { 130093, true }, - { 130107, true }, - { 130124, true }, - { 130137, true }, - { 130152, true }, - { 130165, true }, - { 130177, true }, - { 130191, true }, - { 130202, true }, - { 130225, true }, - { 130243, true }, - { 130264, true }, - { 130283, true }, - { 130301, true }, - { 130318, true }, - { 130335, true }, - { 130346, true }, - { 130368, true }, - { 130390, true }, - { 130402, true }, - { 130410, true }, - { 130431, true }, - { 130452, true }, - { 130473, true }, - { 130491, true }, - { 130507, true }, - { 130519, true }, - { 130531, true }, - { 130549, true }, + { 129283, true }, + { 129303, true }, + { 129315, true }, + { 129327, true }, + { 129336, false }, + { 129345, true }, + { 129365, false }, + { 129386, true }, + { 129397, true }, + { 129410, true }, + { 129419, true }, + { 129433, true }, + { 129450, true }, + { 129466, true }, + { 129484, true }, + { 129498, true }, + { 129515, true }, + { 129527, true }, + { 129540, true }, + { 129552, true }, + { 129566, true }, + { 129584, true }, + { 129598, true }, + { 129614, false }, + { 129632, true }, + { 129649, true }, + { 129671, true }, + { 129694, true }, + { 129705, true }, + { 129716, true }, + { 129727, true }, + { 129738, true }, + { 129750, true }, + { 129764, true }, + { 129775, true }, + { 129787, true }, + { 129803, true }, + { 129832, false }, + { 129851, true }, + { 129867, true }, + { 129893, true }, + { 129907, true }, + { 129924, true }, + { 129943, true }, + { 129960, true }, + { 129976, true }, + { 129987, true }, + { 129995, true }, + { 130007, true }, + { 130024, true }, + { 130037, true }, + { 130052, true }, + { 130065, true }, + { 130079, true }, + { 130091, true }, + { 130103, true }, + { 130117, true }, + { 130134, true }, + { 130147, true }, + { 130162, true }, + { 130175, true }, + { 130187, true }, + { 130201, true }, + { 130212, true }, + { 130235, true }, + { 130253, true }, + { 130274, true }, + { 130293, true }, + { 130311, true }, + { 130328, true }, + { 130345, true }, + { 130356, true }, + { 130378, true }, + { 130400, true }, + { 130412, true }, + { 130420, true }, + { 130441, true }, + { 130462, true }, + { 130483, true }, + { 130501, true }, + { 130517, true }, + { 130529, true }, + { 130541, true }, { 130559, true }, - { 130573, true }, - { 130589, true }, - { 130615, false }, - { 130644, true }, - { 130655, true }, - { 130670, true }, - { 130686, true }, - { 130701, true }, - { 130712, true }, - { 130726, true }, - { 130753, true }, - { 130771, true }, - { 130788, false }, - { 130799, true }, + { 130569, true }, + { 130583, true }, + { 130599, true }, + { 130625, false }, + { 130654, true }, + { 130665, true }, + { 130680, true }, + { 130696, true }, + { 130711, true }, + { 130722, true }, + { 130736, true }, + { 130763, true }, + { 130781, true }, + { 130798, false }, { 130809, true }, - { 130824, true }, - { 130835, true }, - { 130853, true }, - { 130871, true }, - { 130884, true }, - { 130895, true }, - { 130917, true }, - { 130936, true }, - { 130950, true }, - { 130962, false }, - { 130982, true }, + { 130819, true }, + { 130834, true }, + { 130845, true }, + { 130863, true }, + { 130881, true }, + { 130894, true }, + { 130905, true }, + { 130927, true }, + { 130946, true }, + { 130960, true }, + { 130972, false }, { 130992, true }, - { 131006, true }, - { 131024, true }, - { 131038, true }, - { 131050, true }, + { 131002, true }, + { 131016, true }, + { 131034, true }, + { 131048, true }, { 131060, true }, - { 131072, true }, - { 131080, true }, - { 131097, true }, - { 131111, true }, - { 131132, true }, - { 131144, true }, - { 131162, true }, - { 131178, true }, - { 131190, true }, - { 131202, true }, - { 131214, true }, - { 131226, true }, - { 131238, true }, - { 131250, true }, - { 131262, true }, - { 131274, true }, - { 131290, false }, - { 131310, true }, - { 131319, true }, - { 131333, true }, - { 131349, true }, - { 131362, true }, - { 131375, true }, - { 131398, true }, - { 131411, true }, - { 131419, true }, - { 131434, false }, - { 131450, true }, + { 131070, true }, + { 131082, true }, + { 131090, true }, + { 131107, true }, + { 131121, true }, + { 131142, true }, + { 131154, true }, + { 131172, true }, + { 131188, true }, + { 131200, true }, + { 131212, true }, + { 131224, true }, + { 131236, true }, + { 131248, true }, + { 131260, true }, + { 131272, true }, + { 131284, true }, + { 131300, false }, + { 131320, true }, + { 131329, true }, + { 131343, true }, + { 131359, true }, + { 131372, true }, + { 131385, true }, + { 131408, true }, + { 131421, true }, + { 131429, true }, + { 131444, false }, { 131460, true }, - { 131478, true }, - { 131492, true }, - { 131501, true }, - { 131514, true }, - { 131530, true }, - { 131545, true }, - { 131561, true }, - { 131573, true }, - { 131584, true }, - { 131599, true }, - { 131614, true }, - { 131626, true }, - { 131644, true }, - { 131663, true }, - { 131682, true }, - { 131704, true }, - { 131724, true }, - { 131743, true }, - { 131760, true }, - { 131778, true }, - { 131796, true }, - { 131814, true }, - { 131836, true }, - { 131850, true }, - { 131866, true }, - { 131883, true }, - { 131904, true }, - { 131919, true }, - { 131941, true }, + { 131470, true }, + { 131488, true }, + { 131502, true }, + { 131511, true }, + { 131524, true }, + { 131540, true }, + { 131556, true }, + { 131568, true }, + { 131579, true }, + { 131594, true }, + { 131609, true }, + { 131621, true }, + { 131639, true }, + { 131658, true }, + { 131680, true }, + { 131700, true }, + { 131719, true }, + { 131736, true }, + { 131754, true }, + { 131772, true }, + { 131790, true }, + { 131812, true }, + { 131826, true }, + { 131842, true }, + { 131859, true }, + { 131880, true }, + { 131895, true }, + { 131917, true }, + { 131934, true }, + { 131945, true }, { 131958, true }, - { 131969, true }, - { 131982, true }, - { 131995, true }, - { 132007, true }, - { 132017, true }, - { 132028, true }, - { 132043, true }, - { 132054, true }, - { 132066, true }, - { 132075, true }, - { 132085, true }, - { 132094, true }, - { 132105, true }, - { 132130, true }, - { 132142, true }, - { 132160, true }, - { 132176, true }, - { 132187, true }, - { 132203, true }, - { 132226, true }, - { 132247, true }, - { 132265, true }, - { 132284, true }, - { 132293, false }, + { 131971, true }, + { 131983, true }, + { 131993, true }, + { 132004, true }, + { 132019, true }, + { 132030, true }, + { 132042, true }, + { 132051, true }, + { 132061, true }, + { 132070, true }, + { 132081, true }, + { 132106, true }, + { 132118, true }, + { 132136, true }, + { 132152, true }, + { 132163, true }, + { 132179, true }, + { 132202, true }, + { 132223, true }, + { 132241, true }, + { 132260, true }, + { 132269, false }, + { 132283, true }, + { 132294, true }, { 132307, true }, - { 132318, true }, - { 132331, true }, - { 132345, true }, + { 132321, true }, + { 132336, true }, + { 132347, true }, { 132360, true }, - { 132373, true }, - { 132382, true }, + { 132369, true }, + { 132383, true }, { 132396, true }, - { 132409, true }, - { 132423, true }, + { 132410, true }, + { 132421, true }, { 132434, true }, - { 132447, true }, - { 132457, true }, - { 132471, true }, - { 132480, true }, + { 132444, true }, + { 132458, true }, + { 132467, true }, + { 132482, true }, { 132495, true }, { 132508, true }, - { 132521, true }, + { 132527, true }, { 132540, true }, - { 132553, true }, - { 132571, true }, - { 132587, true }, + { 132558, true }, + { 132574, true }, + { 132586, true }, { 132599, true }, - { 132612, true }, - { 132624, true }, - { 132639, true }, - { 132649, true }, - { 132659, true }, - { 132670, true }, - { 132684, true }, - { 132695, true }, - { 132722, true }, - { 132736, true }, - { 132744, true }, - { 132766, true }, - { 132780, true }, - { 132794, true }, - { 132805, true }, - { 132824, true }, - { 132843, true }, - { 132862, true }, - { 132881, true }, - { 132901, true }, - { 132921, true }, - { 132941, true }, - { 132959, true }, - { 132978, true }, - { 132997, true }, - { 133016, true }, - { 133035, true }, + { 132611, true }, + { 132626, true }, + { 132636, true }, + { 132646, true }, + { 132657, true }, + { 132671, true }, + { 132682, true }, + { 132709, true }, + { 132723, true }, + { 132731, true }, + { 132753, true }, + { 132767, true }, + { 132781, true }, + { 132792, true }, + { 132811, true }, + { 132830, true }, + { 132849, true }, + { 132868, true }, + { 132888, true }, + { 132908, true }, + { 132928, true }, + { 132946, true }, + { 132965, true }, + { 132984, true }, + { 133003, true }, + { 133022, true }, + { 133036, true }, { 133049, true }, - { 133062, true }, - { 133074, true }, - { 133087, false }, - { 133109, true }, - { 133124, true }, - { 133136, true }, - { 133144, true }, - { 133169, true }, - { 133185, true }, - { 133194, true }, - { 133206, true }, + { 133061, true }, + { 133074, false }, + { 133096, true }, + { 133111, true }, + { 133123, true }, + { 133131, true }, + { 133156, true }, + { 133172, true }, + { 133181, true }, + { 133193, true }, + { 133210, true }, { 133223, true }, - { 133236, true }, - { 133251, true }, - { 133267, true }, + { 133238, true }, + { 133254, true }, + { 133272, true }, { 133285, true }, - { 133298, true }, - { 133310, true }, - { 133320, true }, - { 133331, true }, - { 133345, true }, + { 133297, true }, + { 133307, true }, + { 133318, true }, + { 133332, true }, + { 133347, true }, { 133360, true }, - { 133373, true }, - { 133384, true }, - { 133398, true }, - { 133413, true }, + { 133371, true }, + { 133385, true }, + { 133400, true }, + { 133409, true }, { 133422, true }, - { 133435, true }, - { 133451, true }, - { 133470, true }, - { 133484, true }, - { 133499, true }, - { 133510, true }, - { 133520, true }, - { 133532, true }, - { 133547, true }, - { 133564, true }, - { 133595, true }, - { 133610, true }, - { 133628, true }, - { 133649, true }, - { 133663, true }, - { 133681, true }, - { 133691, true }, - { 133703, true }, - { 133713, true }, + { 133438, true }, + { 133457, true }, + { 133471, true }, + { 133486, true }, + { 133497, true }, + { 133507, true }, + { 133519, true }, + { 133534, true }, + { 133551, true }, + { 133582, true }, + { 133597, true }, + { 133615, true }, + { 133636, true }, + { 133650, true }, + { 133668, true }, + { 133678, true }, + { 133690, true }, + { 133700, true }, + { 133709, true }, { 133722, true }, - { 133735, true }, + { 133737, true }, { 133750, true }, - { 133763, true }, - { 133775, true }, - { 133783, true }, - { 133801, true }, - { 133816, true }, - { 133833, true }, + { 133762, true }, + { 133770, true }, + { 133788, true }, + { 133803, true }, + { 133820, true }, + { 133835, true }, { 133848, true }, - { 133861, true }, - { 133877, true }, - { 133897, true }, - { 133912, true }, + { 133864, true }, + { 133884, true }, + { 133899, true }, + { 133913, true }, { 133926, true }, - { 133939, true }, - { 133949, true }, - { 133963, true }, - { 133973, true }, - { 133993, true }, - { 134002, true }, - { 134012, true }, + { 133936, true }, + { 133950, true }, + { 133960, true }, + { 133980, true }, + { 133989, true }, + { 133999, true }, + { 134010, true }, { 134023, true }, - { 134036, true }, - { 134055, true }, - { 134065, true }, + { 134042, true }, + { 134052, true }, + { 134063, true }, { 134076, true }, - { 134089, true }, - { 134096, true }, - { 134105, true }, - { 134121, true }, - { 134132, true }, - { 134139, true }, - { 134162, true }, - { 134171, true }, - { 134191, true }, - { 134199, true }, - { 134209, true }, - { 134230, true }, - { 134242, true }, - { 134251, true }, - { 134259, true }, - { 134268, true }, - { 134279, true }, - { 134289, true }, - { 134300, true }, - { 134307, true }, - { 134316, true }, - { 134324, true }, - { 134335, true }, - { 134347, true }, - { 134355, true }, - { 134363, true }, - { 134373, true }, - { 134389, true }, - { 134401, true }, - { 134431, true }, - { 134451, true }, - { 134465, false }, - { 134483, false }, - { 134499, true }, - { 134514, true }, - { 134530, true }, - { 134545, true }, - { 134566, true }, - { 134580, true }, - { 134599, true }, - { 134610, true }, - { 134620, true }, - { 134638, true }, - { 134649, true }, - { 134660, true }, - { 134674, true }, - { 134688, true }, - { 134721, true }, - { 134735, true }, - { 134755, true }, - { 134768, false }, - { 134784, true }, - { 134798, true }, - { 134817, true }, - { 134843, true }, - { 134866, true }, + { 134083, true }, + { 134092, true }, + { 134108, true }, + { 134119, true }, + { 134126, true }, + { 134149, true }, + { 134158, true }, + { 134178, true }, + { 134186, true }, + { 134196, true }, + { 134217, true }, + { 134229, true }, + { 134238, true }, + { 134246, true }, + { 134255, true }, + { 134266, true }, + { 134276, true }, + { 134287, true }, + { 134294, true }, + { 134303, true }, + { 134311, true }, + { 134322, true }, + { 134334, true }, + { 134342, true }, + { 134350, true }, + { 134360, true }, + { 134376, true }, + { 134388, true }, + { 134418, true }, + { 134438, true }, + { 134452, false }, + { 134470, false }, + { 134486, true }, + { 134501, true }, + { 134517, true }, + { 134532, true }, + { 134553, true }, + { 134567, true }, + { 134586, true }, + { 134597, true }, + { 134607, true }, + { 134625, true }, + { 134636, true }, + { 134647, true }, + { 134661, true }, + { 134675, true }, + { 134708, true }, + { 134722, true }, + { 134742, true }, + { 134755, false }, + { 134771, true }, + { 134785, true }, + { 134804, true }, + { 134830, true }, + { 134853, true }, + { 134870, true }, { 134883, true }, - { 134896, true }, - { 134912, true }, + { 134899, true }, + { 134907, true }, { 134920, true }, - { 134933, true }, - { 134940, true }, - { 134952, true }, - { 134964, true }, - { 134979, true }, - { 134989, true }, - { 135001, true }, - { 135012, true }, - { 135032, true }, - { 135040, false }, + { 134927, true }, + { 134939, true }, + { 134951, true }, + { 134966, true }, + { 134976, true }, + { 134988, true }, + { 134999, true }, + { 135019, true }, + { 135027, false }, + { 135045, true }, { 135058, true }, - { 135071, true }, - { 135082, true }, - { 135092, true }, - { 135106, true }, - { 135118, false }, - { 135134, true }, - { 135145, true }, + { 135069, true }, + { 135079, true }, + { 135093, true }, + { 135105, false }, + { 135121, true }, + { 135132, true }, + { 135141, true }, { 135154, true }, - { 135167, true }, - { 135175, true }, - { 135185, true }, - { 135202, true }, - { 135213, true }, - { 135229, true }, - { 135240, true }, - { 135252, true }, - { 135262, false }, - { 135277, true }, - { 135292, true }, - { 135307, false }, - { 135315, true }, - { 135331, false }, - { 135341, true }, - { 135353, true }, - { 135368, true }, - { 135387, true }, - { 135407, true }, - { 135418, true }, - { 135432, true }, - { 135448, true }, + { 135162, true }, + { 135172, true }, + { 135189, true }, + { 135200, true }, + { 135216, true }, + { 135227, true }, + { 135239, true }, + { 135249, false }, + { 135264, true }, + { 135279, true }, + { 135294, false }, + { 135302, true }, + { 135318, false }, + { 135328, true }, + { 135340, true }, + { 135355, true }, + { 135374, true }, + { 135394, true }, + { 135405, true }, + { 135419, true }, + { 135435, true }, + { 135457, true }, { 135470, true }, - { 135483, true }, + { 135489, true }, { 135502, true }, - { 135515, true }, - { 135524, true }, + { 135511, true }, + { 135526, true }, { 135539, true }, - { 135552, true }, - { 135564, true }, - { 135581, true }, + { 135551, true }, + { 135568, true }, + { 135592, true }, { 135605, true }, - { 135618, true }, - { 135630, true }, - { 135647, true }, - { 135659, true }, + { 135617, true }, + { 135634, true }, + { 135646, true }, + { 135664, true }, { 135677, true }, - { 135690, true }, - { 135705, true }, - { 135712, true }, - { 135724, true }, - { 135734, true }, + { 135692, true }, + { 135699, true }, + { 135711, true }, + { 135721, true }, + { 135735, true }, { 135748, true }, - { 135761, true }, - { 135775, true }, - { 135792, true }, - { 135807, true }, - { 135821, true }, + { 135762, true }, + { 135779, true }, + { 135794, true }, + { 135808, true }, + { 135820, true }, { 135833, true }, - { 135846, true }, - { 135866, true }, - { 135881, true }, - { 135896, true }, - { 135911, true }, - { 135930, true }, - { 135949, true }, - { 135968, true }, - { 135983, true }, - { 135994, true }, - { 136004, true }, - { 136017, false }, - { 136030, true }, - { 136044, true }, - { 136055, true }, - { 136070, true }, + { 135853, true }, + { 135868, true }, + { 135883, true }, + { 135898, true }, + { 135917, true }, + { 135936, true }, + { 135955, true }, + { 135970, true }, + { 135981, true }, + { 135991, true }, + { 136004, false }, + { 136017, true }, + { 136031, true }, + { 136042, true }, + { 136057, true }, + { 136073, true }, { 136086, true }, { 136099, true }, - { 136112, true }, - { 136132, true }, - { 136141, true }, + { 136119, true }, + { 136128, true }, + { 136144, true }, { 136157, true }, - { 136170, true }, - { 136185, true }, - { 136199, true }, + { 136172, true }, + { 136186, true }, + { 136196, true }, { 136209, true }, - { 136222, true }, - { 136240, true }, - { 136248, false }, - { 136261, true }, - { 136279, true }, - { 136302, true }, - { 136320, true }, - { 136351, true }, - { 136381, true }, - { 136403, true }, - { 136419, true }, - { 136430, false }, - { 136443, true }, - { 136455, true }, - { 136470, true }, - { 136487, false }, - { 136506, true }, - { 136517, true }, - { 136527, true }, - { 136537, true }, - { 136552, true }, - { 136566, true }, - { 136576, true }, - { 136588, true }, - { 136604, true }, - { 136615, true }, + { 136227, true }, + { 136235, false }, + { 136248, true }, + { 136266, true }, + { 136289, true }, + { 136307, true }, + { 136338, true }, + { 136368, true }, + { 136390, true }, + { 136406, true }, + { 136417, false }, + { 136430, true }, + { 136442, true }, + { 136457, true }, + { 136474, false }, + { 136493, true }, + { 136504, true }, + { 136514, true }, + { 136524, true }, + { 136539, true }, + { 136553, true }, + { 136563, true }, + { 136575, true }, + { 136591, true }, + { 136602, true }, + { 136619, true }, { 136632, true }, - { 136645, true }, - { 136665, true }, - { 136675, true }, - { 136686, true }, - { 136696, false }, - { 136711, true }, - { 136726, true }, - { 136743, true }, - { 136758, true }, - { 136769, false }, + { 136652, true }, + { 136662, true }, + { 136673, true }, + { 136683, false }, + { 136698, true }, + { 136713, true }, + { 136730, true }, + { 136745, true }, + { 136756, false }, + { 136769, true }, { 136782, true }, - { 136795, true }, - { 136805, true }, - { 136822, true }, - { 136834, true }, - { 136848, true }, - { 136859, true }, + { 136792, true }, + { 136809, true }, + { 136821, true }, + { 136835, true }, + { 136846, true }, + { 136863, true }, { 136876, true }, - { 136889, true }, - { 136898, true }, - { 136909, true }, - { 136919, true }, - { 136933, true }, - { 136944, true }, - { 136953, true }, - { 136967, true }, - { 136977, true }, - { 136987, true }, - { 137003, true }, - { 137014, true }, - { 137026, true }, - { 137036, true }, + { 136885, true }, + { 136896, true }, + { 136906, true }, + { 136920, true }, + { 136931, true }, + { 136940, true }, + { 136954, true }, + { 136964, true }, + { 136974, true }, + { 136990, true }, + { 137001, true }, + { 137013, true }, + { 137023, true }, + { 137032, true }, { 137045, true }, { 137056, false }, { 137064, true }, @@ -25548,4246 +25553,4247 @@ static const nsSTSPreload kSTSPreloadList[] = { { 137593, true }, { 137607, true }, { 137627, true }, - { 137644, true }, - { 137661, true }, - { 137675, true }, - { 137694, true }, - { 137710, false }, - { 137724, true }, - { 137737, true }, - { 137754, true }, - { 137769, true }, - { 137788, true }, - { 137799, true }, - { 137810, true }, - { 137824, true }, - { 137838, true }, - { 137853, true }, - { 137874, true }, - { 137890, true }, - { 137908, true }, - { 137926, true }, - { 137939, true }, - { 137967, true }, - { 137979, true }, - { 137995, true }, - { 138006, true }, + { 137635, true }, + { 137652, true }, + { 137669, true }, + { 137683, true }, + { 137702, true }, + { 137718, false }, + { 137732, true }, + { 137745, true }, + { 137762, true }, + { 137777, true }, + { 137796, true }, + { 137807, true }, + { 137818, true }, + { 137832, true }, + { 137846, true }, + { 137861, true }, + { 137882, true }, + { 137898, true }, + { 137916, true }, + { 137934, true }, + { 137947, true }, + { 137975, true }, + { 137987, true }, + { 138003, true }, { 138014, true }, - { 138028, true }, - { 138042, false }, - { 138051, true }, - { 138058, false }, - { 138068, false }, - { 138088, true }, - { 138099, true }, - { 138109, true }, - { 138120, true }, - { 138130, false }, - { 138149, false }, - { 138162, false }, - { 138174, false }, - { 138195, true }, - { 138217, true }, - { 138230, true }, - { 138246, true }, - { 138264, true }, - { 138273, true }, - { 138285, true }, - { 138301, true }, - { 138312, true }, - { 138336, true }, - { 138347, false }, - { 138363, true }, - { 138381, true }, - { 138396, true }, - { 138408, true }, - { 138423, true }, - { 138440, true }, - { 138454, true }, - { 138469, true }, - { 138488, true }, - { 138507, true }, - { 138518, true }, - { 138532, true }, - { 138550, true }, - { 138560, false }, - { 138589, true }, - { 138603, true }, - { 138627, true }, - { 138646, true }, - { 138659, true }, - { 138674, true }, - { 138688, true }, - { 138703, true }, - { 138721, true }, - { 138731, false }, - { 138746, true }, + { 138022, true }, + { 138036, true }, + { 138050, false }, + { 138059, true }, + { 138066, false }, + { 138076, false }, + { 138096, true }, + { 138107, true }, + { 138117, true }, + { 138128, true }, + { 138138, false }, + { 138157, false }, + { 138170, false }, + { 138182, false }, + { 138203, true }, + { 138225, true }, + { 138238, true }, + { 138254, true }, + { 138272, true }, + { 138281, true }, + { 138293, true }, + { 138309, true }, + { 138320, true }, + { 138344, true }, + { 138355, false }, + { 138371, true }, + { 138389, true }, + { 138404, true }, + { 138416, true }, + { 138431, true }, + { 138448, true }, + { 138462, true }, + { 138477, true }, + { 138496, true }, + { 138515, true }, + { 138526, true }, + { 138540, true }, + { 138558, true }, + { 138568, false }, + { 138597, true }, + { 138611, true }, + { 138635, true }, + { 138654, true }, + { 138667, true }, + { 138682, true }, + { 138696, true }, + { 138711, true }, + { 138729, true }, + { 138739, false }, { 138754, true }, - { 138767, false }, - { 138781, true }, - { 138792, true }, + { 138762, true }, + { 138775, false }, + { 138789, true }, { 138800, true }, { 138808, true }, - { 138822, true }, - { 138844, true }, - { 138856, true }, - { 138868, true }, - { 138880, true }, - { 138895, true }, - { 138915, true }, - { 138938, true }, - { 138957, true }, - { 138976, true }, - { 138995, true }, - { 139014, true }, - { 139033, true }, - { 139052, true }, - { 139071, true }, - { 139088, true }, - { 139106, true }, - { 139123, true }, - { 139138, true }, - { 139156, true }, - { 139171, true }, - { 139184, true }, - { 139208, true }, - { 139225, true }, - { 139243, true }, - { 139259, true }, - { 139277, true }, - { 139294, true }, - { 139310, true }, - { 139323, true }, - { 139336, true }, - { 139353, true }, - { 139374, true }, - { 139389, true }, - { 139406, true }, - { 139418, true }, + { 138816, true }, + { 138830, true }, + { 138852, true }, + { 138864, true }, + { 138876, true }, + { 138888, true }, + { 138903, true }, + { 138923, true }, + { 138946, true }, + { 138965, true }, + { 138984, true }, + { 139003, true }, + { 139022, true }, + { 139041, true }, + { 139060, true }, + { 139079, true }, + { 139096, true }, + { 139114, true }, + { 139131, true }, + { 139146, true }, + { 139164, true }, + { 139179, true }, + { 139192, true }, + { 139216, true }, + { 139233, true }, + { 139251, true }, + { 139267, true }, + { 139285, true }, + { 139302, true }, + { 139318, true }, + { 139331, true }, + { 139344, true }, + { 139361, true }, + { 139382, true }, + { 139397, true }, + { 139414, true }, { 139426, true }, - { 139439, true }, - { 139453, true }, - { 139480, true }, - { 139496, true }, - { 139512, true }, - { 139525, true }, - { 139538, true }, - { 139548, true }, - { 139561, true }, - { 139576, true }, - { 139586, true }, - { 139597, true }, - { 139612, true }, - { 139627, false }, - { 139637, false }, - { 139647, false }, - { 139657, true }, - { 139669, true }, - { 139677, false }, - { 139688, true }, + { 139434, true }, + { 139447, true }, + { 139461, true }, + { 139488, true }, + { 139504, true }, + { 139520, true }, + { 139533, true }, + { 139546, true }, + { 139556, true }, + { 139569, true }, + { 139584, true }, + { 139594, true }, + { 139605, true }, + { 139620, true }, + { 139635, false }, + { 139645, false }, + { 139655, false }, + { 139665, true }, + { 139677, true }, + { 139685, false }, { 139696, true }, - { 139705, true }, - { 139718, true }, - { 139730, true }, - { 139750, true }, - { 139761, true }, - { 139782, true }, - { 139798, true }, - { 139815, true }, - { 139834, true }, - { 139843, true }, - { 139857, true }, - { 139867, true }, - { 139878, true }, - { 139887, true }, - { 139896, true }, - { 139925, true }, - { 139944, true }, - { 139961, true }, - { 139984, true }, + { 139704, true }, + { 139713, true }, + { 139726, true }, + { 139738, true }, + { 139758, true }, + { 139769, true }, + { 139790, true }, + { 139806, true }, + { 139823, true }, + { 139842, true }, + { 139851, true }, + { 139865, true }, + { 139875, true }, + { 139886, true }, + { 139895, true }, + { 139904, true }, + { 139933, true }, + { 139952, true }, + { 139969, true }, { 139992, true }, - { 140010, true }, - { 140021, true }, - { 140034, true }, - { 140045, true }, - { 140058, true }, - { 140071, true }, - { 140088, true }, - { 140101, true }, - { 140112, true }, - { 140121, true }, - { 140131, true }, - { 140141, true }, - { 140154, true }, - { 140165, true }, - { 140175, true }, - { 140188, true }, - { 140198, true }, - { 140211, true }, - { 140230, true }, - { 140241, true }, - { 140256, true }, - { 140270, true }, - { 140281, true }, - { 140293, true }, + { 140000, true }, + { 140018, true }, + { 140029, true }, + { 140042, true }, + { 140053, true }, + { 140066, true }, + { 140079, true }, + { 140096, true }, + { 140109, true }, + { 140120, true }, + { 140129, true }, + { 140139, true }, + { 140149, true }, + { 140162, true }, + { 140173, true }, + { 140183, true }, + { 140196, true }, + { 140206, true }, + { 140219, true }, + { 140238, true }, + { 140249, true }, + { 140264, true }, + { 140278, true }, + { 140289, true }, { 140301, true }, - { 140315, true }, - { 140330, false }, - { 140344, false }, - { 140356, true }, - { 140367, false }, - { 140382, true }, - { 140396, true }, - { 140417, true }, - { 140432, true }, - { 140444, true }, - { 140455, true }, - { 140468, true }, - { 140478, true }, - { 140499, true }, - { 140517, true }, - { 140538, true }, - { 140564, true }, - { 140587, true }, - { 140620, true }, - { 140639, true }, - { 140663, true }, - { 140674, true }, - { 140688, true }, - { 140699, true }, - { 140712, false }, - { 140736, true }, - { 140747, true }, - { 140761, true }, - { 140772, true }, - { 140782, true }, + { 140309, true }, + { 140323, true }, + { 140338, false }, + { 140352, false }, + { 140364, true }, + { 140375, false }, + { 140390, true }, + { 140404, true }, + { 140425, true }, + { 140440, true }, + { 140452, true }, + { 140463, true }, + { 140476, true }, + { 140486, true }, + { 140507, true }, + { 140525, true }, + { 140546, true }, + { 140572, true }, + { 140595, true }, + { 140628, true }, + { 140647, true }, + { 140671, true }, + { 140682, true }, + { 140696, true }, + { 140707, true }, + { 140720, false }, + { 140744, true }, + { 140755, true }, + { 140769, true }, + { 140780, true }, { 140790, true }, - { 140797, true }, - { 140808, true }, - { 140819, true }, - { 140830, true }, - { 140840, true }, - { 140851, true }, - { 140860, true }, - { 140875, true }, - { 140890, true }, - { 140901, true }, - { 140910, true }, - { 140921, true }, - { 140932, true }, - { 140946, true }, - { 140955, true }, - { 140971, true }, + { 140798, true }, + { 140805, true }, + { 140816, true }, + { 140827, true }, + { 140838, true }, + { 140848, true }, + { 140859, true }, + { 140868, true }, + { 140883, true }, + { 140898, true }, + { 140909, true }, + { 140918, true }, + { 140929, true }, + { 140940, true }, + { 140954, true }, + { 140963, true }, { 140979, true }, - { 140991, true }, - { 141003, true }, - { 141019, true }, + { 140987, true }, + { 140999, true }, + { 141011, true }, { 141027, true }, - { 141037, true }, - { 141056, true }, + { 141035, true }, + { 141045, true }, { 141064, true }, - { 141077, true }, - { 141094, true }, - { 141105, true }, - { 141117, true }, - { 141126, true }, - { 141147, true }, - { 141166, true }, - { 141182, true }, - { 141197, true }, - { 141210, true }, - { 141227, true }, - { 141240, true }, - { 141256, true }, - { 141266, true }, + { 141072, true }, + { 141085, true }, + { 141102, true }, + { 141113, true }, + { 141125, true }, + { 141134, true }, + { 141155, true }, + { 141174, true }, + { 141190, true }, + { 141205, true }, + { 141218, true }, + { 141235, true }, + { 141248, true }, + { 141264, true }, { 141274, true }, - { 141283, true }, + { 141282, true }, { 141291, true }, - { 141305, true }, - { 141324, false }, - { 141333, true }, - { 141343, true }, - { 141365, true }, - { 141379, true }, - { 141394, true }, - { 141407, true }, - { 141421, true }, + { 141299, true }, + { 141313, true }, + { 141332, false }, + { 141341, true }, + { 141351, true }, + { 141373, true }, + { 141387, true }, + { 141402, true }, + { 141415, true }, { 141429, true }, - { 141441, true }, - { 141452, true }, - { 141464, true }, - { 141474, true }, - { 141483, true }, - { 141494, true }, - { 141505, false }, - { 141515, false }, - { 141531, true }, - { 141541, true }, - { 141556, true }, - { 141566, true }, - { 141580, true }, - { 141595, true }, - { 141607, true }, - { 141618, true }, - { 141627, true }, - { 141640, true }, - { 141650, true }, - { 141663, true }, - { 141674, true }, - { 141697, false }, - { 141711, true }, - { 141723, true }, - { 141736, true }, - { 141745, true }, - { 141758, true }, - { 141774, true }, - { 141785, true }, - { 141799, true }, - { 141813, true }, - { 141823, true }, - { 141832, true }, - { 141842, true }, - { 141857, true }, - { 141869, true }, - { 141881, true }, - { 141895, true }, - { 141912, true }, - { 141922, false }, - { 141931, false }, - { 141950, true }, - { 141966, true }, - { 141981, true }, - { 141991, true }, - { 142003, true }, - { 142015, false }, - { 142027, true }, - { 142040, true }, + { 141437, true }, + { 141449, true }, + { 141460, true }, + { 141472, true }, + { 141482, true }, + { 141491, true }, + { 141502, true }, + { 141513, false }, + { 141523, false }, + { 141539, true }, + { 141549, true }, + { 141564, true }, + { 141574, true }, + { 141588, true }, + { 141603, true }, + { 141615, true }, + { 141626, true }, + { 141635, true }, + { 141648, true }, + { 141658, true }, + { 141671, true }, + { 141682, true }, + { 141705, false }, + { 141719, true }, + { 141731, true }, + { 141744, true }, + { 141753, true }, + { 141766, false }, + { 141776, true }, + { 141792, true }, + { 141803, true }, + { 141817, true }, + { 141831, true }, + { 141841, true }, + { 141850, true }, + { 141860, true }, + { 141875, true }, + { 141887, true }, + { 141899, true }, + { 141913, true }, + { 141930, true }, + { 141940, false }, + { 141949, false }, + { 141968, true }, + { 141984, true }, + { 141999, true }, + { 142009, true }, + { 142021, true }, + { 142033, false }, + { 142045, true }, { 142058, true }, - { 142073, true }, - { 142088, false }, - { 142104, true }, - { 142116, true }, - { 142128, true }, - { 142139, true }, - { 142152, false }, - { 142167, true }, - { 142182, true }, - { 142192, true }, - { 142202, true }, - { 142216, true }, - { 142230, true }, - { 142242, true }, - { 142253, true }, - { 142269, true }, - { 142280, true }, - { 142291, true }, + { 142076, true }, + { 142091, true }, + { 142106, false }, + { 142122, true }, + { 142134, true }, + { 142146, true }, + { 142157, true }, + { 142170, false }, + { 142185, true }, + { 142200, true }, + { 142210, true }, + { 142220, true }, + { 142234, true }, + { 142248, true }, + { 142260, true }, + { 142271, true }, + { 142287, true }, + { 142298, true }, { 142309, true }, { 142327, true }, - { 142340, true }, - { 142361, false }, - { 142380, true }, - { 142400, true }, - { 142422, true }, - { 142434, true }, + { 142345, true }, + { 142358, true }, + { 142379, false }, + { 142398, true }, + { 142418, true }, + { 142440, true }, { 142452, true }, - { 142467, true }, - { 142479, true }, - { 142495, true }, - { 142510, true }, - { 142526, true }, - { 142542, true }, - { 142559, true }, - { 142575, true }, - { 142592, true }, - { 142614, true }, - { 142631, true }, - { 142653, true }, - { 142664, true }, - { 142680, true }, - { 142700, true }, - { 142711, true }, - { 142725, true }, - { 142748, true }, - { 142760, true }, - { 142775, true }, - { 142800, true }, - { 142815, true }, - { 142827, true }, - { 142842, true }, - { 142858, true }, - { 142873, true }, - { 142902, true }, - { 142924, true }, - { 142942, true }, - { 142956, true }, - { 142969, true }, - { 142984, true }, + { 142470, true }, + { 142485, true }, + { 142497, true }, + { 142513, true }, + { 142528, true }, + { 142544, true }, + { 142560, true }, + { 142577, true }, + { 142593, true }, + { 142610, true }, + { 142627, true }, + { 142649, true }, + { 142660, true }, + { 142676, true }, + { 142696, true }, + { 142707, true }, + { 142722, true }, + { 142738, true }, + { 142753, true }, + { 142768, true }, + { 142782, true }, + { 142805, true }, + { 142817, true }, + { 142832, true }, + { 142857, true }, + { 142872, true }, + { 142884, true }, + { 142899, true }, + { 142915, true }, + { 142930, true }, + { 142959, true }, + { 142981, true }, { 142999, true }, - { 143006, true }, - { 143022, true }, - { 143033, true }, - { 143044, true }, - { 143054, true }, - { 143065, true }, + { 143013, true }, + { 143026, true }, + { 143041, true }, + { 143056, true }, + { 143063, true }, { 143079, true }, - { 143093, true }, - { 143105, true }, - { 143117, true }, - { 143128, true }, - { 143143, true }, - { 143156, true }, + { 143090, true }, + { 143101, true }, + { 143111, true }, + { 143122, true }, + { 143136, true }, + { 143150, true }, + { 143162, true }, + { 143174, true }, { 143185, true }, - { 143194, true }, - { 143209, true }, - { 143216, true }, - { 143226, true }, - { 143236, true }, - { 143245, true }, - { 143261, true }, - { 143270, true }, - { 143279, true }, - { 143291, true }, - { 143307, true }, - { 143326, true }, - { 143338, false }, - { 143355, false }, - { 143375, true }, - { 143390, true }, - { 143406, true }, - { 143419, true }, - { 143437, true }, - { 143452, true }, - { 143461, true }, + { 143200, true }, + { 143213, true }, + { 143242, true }, + { 143251, true }, + { 143266, true }, + { 143273, true }, + { 143283, true }, + { 143293, true }, + { 143302, true }, + { 143318, true }, + { 143327, true }, + { 143336, true }, + { 143348, true }, + { 143364, true }, + { 143383, true }, + { 143395, false }, + { 143412, false }, + { 143432, true }, + { 143447, true }, + { 143463, true }, { 143476, true }, - { 143490, true }, - { 143506, true }, - { 143521, true }, - { 143543, true }, - { 143564, true }, - { 143583, true }, - { 143602, true }, - { 143618, true }, - { 143629, true }, - { 143638, true }, - { 143648, true }, - { 143667, true }, - { 143682, true }, - { 143696, true }, - { 143709, true }, - { 143717, true }, - { 143725, true }, - { 143734, true }, - { 143746, true }, - { 143758, true }, - { 143767, true }, - { 143779, true }, - { 143787, true }, - { 143799, true }, - { 143825, true }, - { 143848, false }, - { 143864, true }, - { 143878, true }, - { 143898, true }, - { 143909, true }, - { 143930, true }, - { 143949, true }, - { 143963, true }, - { 143977, true }, - { 143994, true }, - { 144008, false }, - { 144023, true }, - { 144031, true }, - { 144046, true }, - { 144061, true }, - { 144072, true }, - { 144086, true }, - { 144097, true }, - { 144107, true }, - { 144125, true }, - { 144142, true }, - { 144162, true }, - { 144186, true }, - { 144193, true }, - { 144204, true }, - { 144215, true }, - { 144228, true }, - { 144240, false }, - { 144255, true }, - { 144271, true }, - { 144284, true }, - { 144292, true }, - { 144302, true }, - { 144317, false }, - { 144326, true }, - { 144340, true }, - { 144355, true }, - { 144365, true }, - { 144377, true }, - { 144387, true }, - { 144400, true }, + { 143494, true }, + { 143509, true }, + { 143518, true }, + { 143533, true }, + { 143547, true }, + { 143563, true }, + { 143578, true }, + { 143600, true }, + { 143621, true }, + { 143640, true }, + { 143659, true }, + { 143675, true }, + { 143686, true }, + { 143695, true }, + { 143705, true }, + { 143724, true }, + { 143739, true }, + { 143753, true }, + { 143766, true }, + { 143774, true }, + { 143782, true }, + { 143791, true }, + { 143803, true }, + { 143815, true }, + { 143824, true }, + { 143836, true }, + { 143844, true }, + { 143856, true }, + { 143882, true }, + { 143905, false }, + { 143921, true }, + { 143935, true }, + { 143955, true }, + { 143966, true }, + { 143987, true }, + { 144006, true }, + { 144020, true }, + { 144034, true }, + { 144051, true }, + { 144065, false }, + { 144080, true }, + { 144088, true }, + { 144103, true }, + { 144118, true }, + { 144129, true }, + { 144143, true }, + { 144154, true }, + { 144164, true }, + { 144182, true }, + { 144199, true }, + { 144219, true }, + { 144243, true }, + { 144250, true }, + { 144261, true }, + { 144272, true }, + { 144285, true }, + { 144297, false }, + { 144312, true }, + { 144328, true }, + { 144341, true }, + { 144349, true }, + { 144359, true }, + { 144374, false }, + { 144383, true }, + { 144397, true }, { 144412, true }, - { 144420, true }, - { 144431, true }, - { 144445, true }, - { 144466, true }, - { 144479, true }, - { 144489, false }, - { 144509, true }, - { 144520, true }, - { 144527, true }, - { 144534, true }, - { 144544, true }, - { 144550, true }, - { 144558, true }, - { 144567, false }, - { 144587, true }, + { 144422, true }, + { 144434, true }, + { 144444, true }, + { 144457, true }, + { 144469, true }, + { 144477, true }, + { 144488, true }, + { 144502, true }, + { 144523, true }, + { 144536, true }, + { 144546, false }, + { 144566, true }, + { 144573, true }, + { 144580, true }, + { 144590, true }, { 144596, true }, - { 144605, true }, - { 144623, true }, - { 144637, true }, - { 144652, true }, - { 144664, true }, - { 144677, true }, - { 144695, true }, - { 144706, true }, - { 144714, true }, - { 144724, true }, - { 144732, true }, - { 144744, true }, - { 144753, true }, - { 144766, true }, - { 144776, true }, - { 144788, true }, - { 144803, true }, - { 144815, true }, - { 144829, true }, - { 144845, true }, - { 144863, true }, - { 144876, true }, - { 144889, false }, - { 144902, true }, - { 144921, true }, - { 144936, true }, - { 144944, true }, - { 144956, true }, - { 144970, true }, + { 144604, true }, + { 144613, false }, + { 144633, true }, + { 144642, true }, + { 144651, true }, + { 144669, true }, + { 144683, true }, + { 144698, true }, + { 144710, true }, + { 144723, true }, + { 144741, true }, + { 144752, true }, + { 144760, true }, + { 144770, true }, + { 144778, true }, + { 144790, true }, + { 144799, true }, + { 144812, true }, + { 144822, true }, + { 144834, true }, + { 144849, true }, + { 144861, true }, + { 144875, true }, + { 144891, true }, + { 144909, true }, + { 144922, true }, + { 144935, false }, + { 144948, true }, + { 144967, true }, + { 144982, true }, { 144990, true }, { 145002, true }, - { 145028, true }, - { 145046, true }, - { 145063, true }, - { 145080, true }, - { 145091, true }, + { 145016, true }, + { 145036, true }, + { 145048, true }, + { 145074, true }, + { 145092, true }, { 145109, true }, - { 145121, true }, - { 145134, true }, - { 145150, true }, - { 145164, true }, - { 145182, true }, - { 145198, true }, - { 145221, true }, - { 145240, true }, - { 145254, true }, - { 145270, true }, + { 145126, true }, + { 145137, true }, + { 145155, true }, + { 145167, true }, + { 145180, true }, + { 145196, true }, + { 145210, true }, + { 145228, true }, + { 145244, true }, + { 145267, true }, { 145286, true }, - { 145303, true }, - { 145334, true }, - { 145364, false }, + { 145300, true }, + { 145316, true }, + { 145332, true }, + { 145349, true }, { 145380, true }, - { 145391, true }, - { 145403, true }, - { 145416, true }, - { 145433, true }, - { 145447, true }, - { 145472, true }, - { 145489, true }, - { 145506, true }, - { 145525, true }, - { 145540, true }, - { 145560, true }, - { 145575, true }, + { 145410, false }, + { 145426, true }, + { 145437, true }, + { 145449, true }, + { 145462, true }, + { 145479, true }, + { 145493, true }, + { 145518, true }, + { 145535, true }, + { 145552, true }, + { 145571, true }, { 145586, true }, - { 145601, true }, - { 145619, true }, - { 145635, true }, + { 145606, true }, + { 145621, true }, + { 145632, true }, { 145647, true }, - { 145657, true }, - { 145674, true }, - { 145686, false }, - { 145700, true }, - { 145707, false }, - { 145739, true }, - { 145753, true }, - { 145763, true }, - { 145777, true }, - { 145790, true }, - { 145807, true }, - { 145819, true }, - { 145833, true }, - { 145849, false }, - { 145864, true }, - { 145878, true }, - { 145889, true }, - { 145900, true }, - { 145912, true }, - { 145921, true }, - { 145928, true }, - { 145939, true }, - { 145947, true }, - { 145954, true }, - { 145964, true }, - { 145975, true }, - { 145983, true }, - { 145991, true }, - { 145999, true }, - { 146012, true }, - { 146027, true }, + { 145665, true }, + { 145681, true }, + { 145693, true }, + { 145703, true }, + { 145720, true }, + { 145732, false }, + { 145746, true }, + { 145753, false }, + { 145785, true }, + { 145799, true }, + { 145809, true }, + { 145823, true }, + { 145836, true }, + { 145853, true }, + { 145865, true }, + { 145879, true }, + { 145895, false }, + { 145910, true }, + { 145924, true }, + { 145935, true }, + { 145946, true }, + { 145958, true }, + { 145967, true }, + { 145974, true }, + { 145985, true }, + { 145993, true }, + { 146000, true }, + { 146010, true }, + { 146021, true }, + { 146029, true }, { 146037, true }, - { 146047, true }, - { 146054, true }, - { 146066, true }, - { 146075, true }, - { 146091, true }, - { 146103, true }, - { 146115, true }, - { 146127, true }, - { 146138, true }, - { 146153, true }, + { 146045, true }, + { 146058, true }, + { 146073, true }, + { 146083, true }, + { 146093, true }, + { 146100, true }, + { 146112, true }, + { 146121, true }, + { 146137, true }, + { 146149, true }, { 146161, true }, - { 146172, true }, - { 146183, true }, - { 146197, true }, - { 146213, true }, - { 146225, true }, - { 146239, true }, - { 146253, false }, - { 146263, true }, - { 146284, true }, + { 146173, true }, + { 146184, true }, + { 146199, true }, + { 146207, true }, + { 146218, true }, + { 146229, true }, + { 146243, true }, + { 146259, true }, + { 146271, true }, + { 146285, true }, { 146299, true }, { 146320, true }, - { 146332, true }, - { 146340, true }, - { 146354, true }, - { 146361, true }, - { 146373, true }, - { 146387, true }, - { 146404, true }, - { 146417, true }, - { 146433, true }, - { 146446, true }, - { 146460, true }, - { 146471, true }, - { 146480, true }, - { 146490, true }, - { 146497, true }, - { 146509, true }, - { 146518, true }, - { 146527, true }, - { 146535, true }, - { 146550, true }, - { 146558, true }, - { 146570, false }, - { 146580, true }, - { 146590, true }, - { 146601, true }, - { 146610, true }, - { 146628, true }, - { 146638, true }, - { 146649, false }, - { 146660, true }, - { 146671, true }, - { 146693, true }, - { 146701, true }, - { 146709, false }, - { 146717, true }, - { 146725, true }, - { 146741, true }, - { 146757, true }, - { 146770, true }, - { 146781, true }, + { 146335, true }, + { 146356, true }, + { 146368, true }, + { 146376, true }, + { 146390, true }, + { 146397, true }, + { 146409, true }, + { 146423, true }, + { 146440, true }, + { 146453, true }, + { 146469, true }, + { 146482, true }, + { 146496, true }, + { 146507, true }, + { 146516, true }, + { 146526, true }, + { 146533, true }, + { 146545, true }, + { 146554, true }, + { 146563, true }, + { 146571, true }, + { 146586, true }, + { 146594, true }, + { 146606, false }, + { 146616, true }, + { 146626, true }, + { 146637, true }, + { 146646, true }, + { 146664, true }, + { 146674, true }, + { 146685, false }, + { 146696, true }, + { 146707, true }, + { 146729, true }, + { 146737, true }, + { 146745, false }, + { 146753, true }, + { 146761, true }, + { 146777, true }, { 146793, true }, - { 146812, true }, - { 146826, true }, - { 146840, true }, - { 146854, true }, - { 146869, false }, - { 146887, true }, - { 146903, true }, - { 146918, true }, - { 146929, true }, - { 146941, true }, - { 146952, true }, - { 146971, true }, - { 146987, true }, - { 146999, true }, - { 147011, true }, - { 147024, true }, - { 147036, true }, - { 147043, true }, - { 147056, true }, - { 147073, true }, - { 147095, true }, - { 147105, true }, - { 147115, true }, - { 147127, false }, - { 147138, true }, - { 147152, true }, - { 147161, true }, - { 147172, true }, - { 147190, true }, - { 147209, true }, - { 147225, true }, - { 147238, true }, - { 147254, true }, - { 147281, true }, - { 147293, true }, - { 147307, true }, - { 147315, true }, + { 146806, true }, + { 146817, true }, + { 146829, true }, + { 146848, true }, + { 146862, true }, + { 146876, true }, + { 146890, true }, + { 146905, false }, + { 146923, true }, + { 146939, true }, + { 146954, true }, + { 146965, true }, + { 146977, true }, + { 146988, true }, + { 147007, true }, + { 147023, true }, + { 147035, true }, + { 147047, true }, + { 147060, true }, + { 147072, true }, + { 147079, true }, + { 147092, true }, + { 147109, true }, + { 147131, true }, + { 147141, true }, + { 147151, true }, + { 147163, false }, + { 147174, true }, + { 147188, true }, + { 147197, true }, + { 147208, true }, + { 147226, true }, + { 147245, true }, + { 147261, true }, + { 147274, true }, + { 147290, true }, + { 147317, true }, { 147329, true }, - { 147339, true }, + { 147343, true }, + { 147351, true }, + { 147365, true }, { 147375, true }, - { 147408, true }, - { 147431, true }, + { 147411, true }, { 147444, true }, - { 147453, true }, - { 147470, false }, - { 147493, true }, - { 147509, true }, - { 147527, true }, - { 147544, true }, - { 147568, true }, + { 147467, true }, + { 147480, true }, + { 147489, true }, + { 147506, false }, + { 147529, true }, + { 147545, true }, + { 147563, true }, { 147580, true }, - { 147589, true }, - { 147598, true }, - { 147610, true }, - { 147619, true }, - { 147627, true }, - { 147640, true }, - { 147651, true }, + { 147604, true }, + { 147616, true }, + { 147625, true }, + { 147634, true }, + { 147646, true }, + { 147655, true }, + { 147663, true }, { 147676, true }, { 147687, true }, - { 147700, true }, - { 147714, true }, - { 147727, false }, - { 147738, true }, - { 147746, true }, - { 147754, true }, - { 147762, true }, - { 147775, false }, - { 147786, true }, - { 147801, true }, - { 147821, true }, - { 147829, true }, - { 147847, true }, - { 147867, true }, - { 147887, true }, - { 147908, true }, + { 147712, true }, + { 147723, true }, + { 147736, true }, + { 147750, true }, + { 147763, false }, + { 147774, true }, + { 147782, true }, + { 147790, true }, + { 147798, true }, + { 147811, false }, + { 147822, true }, + { 147837, true }, + { 147857, true }, + { 147865, true }, + { 147883, true }, + { 147903, true }, { 147923, true }, - { 147949, true }, + { 147944, true }, { 147959, true }, - { 147972, false }, - { 147990, true }, - { 148010, true }, - { 148027, true }, - { 148045, true }, - { 148058, true }, - { 148073, true }, - { 148085, true }, - { 148095, true }, - { 148102, true }, - { 148122, true }, - { 148135, true }, - { 148152, true }, - { 148168, true }, - { 148180, true }, - { 148194, true }, - { 148206, true }, - { 148221, true }, - { 148239, true }, - { 148252, true }, - { 148262, true }, - { 148273, true }, - { 148284, true }, - { 148295, true }, - { 148310, true }, - { 148321, true }, - { 148333, false }, - { 148345, true }, - { 148359, true }, - { 148376, true }, - { 148386, true }, - { 148399, false }, - { 148417, false }, - { 148428, true }, - { 148443, true }, - { 148460, true }, - { 148477, true }, - { 148494, true }, - { 148504, true }, - { 148519, true }, - { 148529, true }, - { 148544, true }, - { 148561, true }, - { 148573, true }, - { 148584, true }, - { 148602, true }, - { 148617, true }, - { 148632, true }, - { 148657, true }, - { 148682, true }, - { 148695, true }, - { 148712, true }, + { 147985, true }, + { 147995, true }, + { 148008, false }, + { 148026, true }, + { 148046, true }, + { 148063, true }, + { 148081, true }, + { 148094, true }, + { 148109, true }, + { 148121, true }, + { 148131, true }, + { 148138, true }, + { 148158, true }, + { 148171, true }, + { 148188, true }, + { 148204, true }, + { 148216, true }, + { 148230, true }, + { 148242, true }, + { 148257, true }, + { 148275, true }, + { 148288, true }, + { 148298, true }, + { 148309, true }, + { 148320, true }, + { 148331, true }, + { 148346, true }, + { 148357, true }, + { 148369, false }, + { 148381, true }, + { 148395, true }, + { 148412, true }, + { 148422, true }, + { 148435, false }, + { 148453, false }, + { 148464, true }, + { 148479, true }, + { 148496, true }, + { 148513, true }, + { 148530, true }, + { 148540, true }, + { 148555, true }, + { 148565, true }, + { 148580, true }, + { 148597, true }, + { 148609, true }, + { 148620, true }, + { 148638, true }, + { 148653, true }, + { 148668, true }, + { 148693, true }, + { 148718, true }, { 148731, true }, { 148748, true }, - { 148768, true }, - { 148789, true }, - { 148803, true }, - { 148828, true }, - { 148849, true }, - { 148871, true }, - { 148901, true }, - { 148925, true }, - { 148940, true }, - { 148953, true }, - { 148963, true }, - { 148986, true }, - { 148997, true }, - { 149004, true }, - { 149018, true }, - { 149037, true }, - { 149046, true }, - { 149053, true }, + { 148767, true }, + { 148784, true }, + { 148804, true }, + { 148825, true }, + { 148839, true }, + { 148864, true }, + { 148885, true }, + { 148907, true }, + { 148937, true }, + { 148961, true }, + { 148976, true }, + { 148989, true }, + { 148999, true }, + { 149022, true }, + { 149033, true }, + { 149040, true }, + { 149054, true }, { 149073, true }, - { 149084, true }, - { 149103, true }, - { 149119, true }, - { 149129, true }, - { 149140, true }, - { 149150, true }, - { 149161, true }, - { 149173, true }, - { 149189, true }, + { 149082, true }, + { 149089, true }, + { 149109, true }, + { 149120, true }, + { 149139, true }, + { 149155, true }, + { 149165, true }, + { 149176, true }, + { 149186, true }, { 149197, true }, - { 149207, true }, - { 149219, true }, - { 149230, true }, - { 149245, true }, - { 149269, true }, - { 149283, true }, - { 149291, true }, - { 149309, true }, - { 149320, true }, - { 149333, true }, - { 149344, true }, - { 149363, true }, - { 149375, true }, - { 149386, true }, - { 149401, true }, - { 149416, true }, - { 149430, true }, - { 149442, true }, - { 149460, true }, - { 149480, true }, - { 149492, true }, - { 149509, true }, - { 149524, true }, - { 149538, true }, - { 149552, true }, - { 149563, true }, - { 149572, true }, - { 149585, true }, - { 149594, true }, - { 149605, true }, - { 149617, true }, - { 149624, true }, - { 149635, true }, - { 149652, false }, - { 149678, false }, - { 149690, true }, - { 149703, true }, - { 149714, true }, - { 149731, true }, - { 149741, true }, - { 149754, true }, - { 149769, true }, + { 149209, true }, + { 149225, true }, + { 149233, true }, + { 149243, true }, + { 149255, true }, + { 149266, true }, + { 149281, true }, + { 149305, true }, + { 149319, true }, + { 149327, true }, + { 149345, true }, + { 149356, true }, + { 149369, true }, + { 149380, true }, + { 149399, true }, + { 149411, true }, + { 149422, true }, + { 149437, true }, + { 149452, true }, + { 149466, true }, + { 149478, true }, + { 149496, true }, + { 149516, true }, + { 149528, true }, + { 149545, true }, + { 149560, true }, + { 149574, true }, + { 149588, true }, + { 149599, true }, + { 149608, true }, + { 149621, true }, + { 149630, true }, + { 149641, true }, + { 149653, true }, + { 149660, true }, + { 149671, true }, + { 149688, false }, + { 149714, false }, + { 149726, true }, + { 149739, true }, + { 149750, true }, + { 149767, true }, + { 149777, true }, { 149790, true }, - { 149806, true }, - { 149830, true }, - { 149844, true }, - { 149855, true }, - { 149869, true }, - { 149886, true }, - { 149898, true }, - { 149913, true }, - { 149923, true }, - { 149936, true }, - { 149949, true }, - { 149962, true }, - { 149982, true }, - { 150004, true }, - { 150018, true }, - { 150033, false }, - { 150046, true }, - { 150061, true }, - { 150072, true }, - { 150092, true }, - { 150105, true }, - { 150126, true }, - { 150137, true }, - { 150156, true }, - { 150164, true }, - { 150172, true }, - { 150189, true }, - { 150205, true }, - { 150214, true }, - { 150229, true }, - { 150240, true }, - { 150251, true }, - { 150261, true }, - { 150271, true }, - { 150282, true }, - { 150292, true }, - { 150303, true }, - { 150315, true }, - { 150322, true }, + { 149805, true }, + { 149826, true }, + { 149842, true }, + { 149866, true }, + { 149880, true }, + { 149891, true }, + { 149905, true }, + { 149922, true }, + { 149934, true }, + { 149946, true }, + { 149961, true }, + { 149971, true }, + { 149984, true }, + { 149997, true }, + { 150010, true }, + { 150030, true }, + { 150052, true }, + { 150066, true }, + { 150081, false }, + { 150094, true }, + { 150109, true }, + { 150120, true }, + { 150140, true }, + { 150153, true }, + { 150174, true }, + { 150185, true }, + { 150204, true }, + { 150212, true }, + { 150220, true }, + { 150237, true }, + { 150253, true }, + { 150262, true }, + { 150277, true }, + { 150288, true }, + { 150299, true }, + { 150309, true }, + { 150319, true }, + { 150330, true }, { 150340, true }, - { 150352, true }, + { 150351, true }, { 150363, true }, - { 150385, true }, - { 150399, true }, - { 150418, true }, - { 150426, true }, - { 150445, true }, - { 150467, true }, - { 150476, true }, - { 150488, true }, - { 150506, true }, - { 150520, true }, - { 150539, true }, - { 150549, true }, - { 150558, true }, - { 150574, true }, - { 150582, true }, - { 150594, true }, - { 150609, true }, - { 150629, true }, - { 150637, true }, - { 150650, true }, - { 150659, true }, + { 150370, true }, + { 150388, true }, + { 150400, true }, + { 150411, true }, + { 150433, true }, + { 150447, true }, + { 150466, true }, + { 150474, true }, + { 150493, true }, + { 150515, true }, + { 150524, true }, + { 150536, true }, + { 150554, true }, + { 150568, true }, + { 150587, true }, + { 150597, true }, + { 150606, true }, + { 150622, true }, + { 150630, true }, + { 150642, true }, + { 150657, true }, { 150677, true }, - { 150689, true }, - { 150708, true }, - { 150722, true }, - { 150735, true }, - { 150747, true }, - { 150771, true }, - { 150787, true }, - { 150801, true }, - { 150818, true }, - { 150834, true }, - { 150851, true }, - { 150870, true }, - { 150886, true }, - { 150894, true }, - { 150912, true }, - { 150921, false }, - { 150930, true }, + { 150685, true }, + { 150698, true }, + { 150707, true }, + { 150725, true }, + { 150737, true }, + { 150756, true }, + { 150770, true }, + { 150783, true }, + { 150795, true }, + { 150819, true }, + { 150835, true }, + { 150849, true }, + { 150866, true }, + { 150882, true }, + { 150899, true }, + { 150918, true }, + { 150934, true }, { 150942, true }, - { 150956, true }, - { 150966, true }, - { 150979, true }, - { 150988, true }, - { 151011, true }, - { 151023, true }, - { 151039, true }, - { 151049, false }, - { 151058, true }, - { 151065, true }, - { 151074, true }, - { 151082, true }, - { 151091, false }, - { 151105, true }, - { 151119, true }, - { 151129, true }, - { 151139, true }, - { 151149, true }, - { 151161, true }, - { 151173, true }, - { 151191, false }, - { 151204, true }, - { 151219, true }, - { 151237, true }, - { 151247, true }, - { 151258, true }, - { 151270, true }, - { 151283, true }, - { 151297, true }, - { 151311, true }, - { 151321, true }, - { 151334, true }, - { 151344, true }, - { 151355, true }, - { 151364, true }, - { 151381, true }, - { 151390, true }, + { 150960, true }, + { 150969, false }, + { 150978, true }, + { 150990, true }, + { 151004, true }, + { 151014, true }, + { 151027, true }, + { 151036, true }, + { 151059, true }, + { 151071, true }, + { 151087, true }, + { 151097, false }, + { 151106, true }, + { 151113, true }, + { 151122, true }, + { 151130, true }, + { 151139, false }, + { 151153, true }, + { 151167, true }, + { 151177, true }, + { 151187, true }, + { 151197, true }, + { 151209, true }, + { 151221, true }, + { 151239, false }, + { 151252, true }, + { 151267, true }, + { 151285, true }, + { 151295, true }, + { 151306, true }, + { 151318, true }, + { 151331, true }, + { 151345, true }, + { 151359, true }, + { 151369, true }, + { 151382, true }, + { 151392, true }, { 151403, true }, - { 151414, true }, - { 151432, true }, - { 151442, true }, - { 151454, true }, - { 151466, true }, - { 151477, true }, - { 151494, true }, - { 151507, true }, - { 151521, true }, - { 151530, true }, - { 151543, false }, - { 151552, true }, - { 151569, false }, - { 151580, true }, - { 151596, false }, - { 151611, false }, - { 151622, false }, - { 151629, true }, - { 151645, true }, - { 151663, true }, - { 151682, true }, - { 151697, true }, - { 151714, true }, - { 151728, true }, - { 151744, true }, - { 151765, true }, - { 151779, true }, - { 151804, true }, - { 151821, true }, - { 151840, true }, - { 151855, false }, + { 151412, true }, + { 151429, true }, + { 151438, true }, + { 151451, true }, + { 151462, true }, + { 151480, true }, + { 151490, true }, + { 151502, true }, + { 151514, true }, + { 151525, true }, + { 151542, true }, + { 151555, true }, + { 151569, true }, + { 151578, true }, + { 151591, false }, + { 151600, true }, + { 151617, false }, + { 151628, true }, + { 151644, false }, + { 151659, false }, + { 151670, false }, + { 151677, true }, + { 151693, true }, + { 151711, true }, + { 151730, true }, + { 151745, true }, + { 151762, true }, + { 151776, true }, + { 151792, true }, + { 151813, true }, + { 151827, true }, + { 151852, true }, { 151869, true }, - { 151883, true }, - { 151896, true }, + { 151888, true }, + { 151903, false }, { 151917, true }, - { 151929, true }, - { 151942, true }, - { 151952, true }, - { 151972, true }, - { 151985, true }, - { 152004, true }, - { 152020, true }, - { 152038, true }, - { 152052, false }, - { 152064, true }, - { 152074, true }, - { 152088, true }, - { 152098, true }, - { 152114, true }, - { 152140, true }, - { 152168, true }, - { 152181, true }, - { 152197, true }, - { 152221, true }, - { 152237, true }, - { 152252, true }, - { 152266, true }, - { 152278, true }, - { 152290, false }, - { 152308, true }, - { 152321, true }, - { 152340, true }, - { 152358, true }, - { 152373, true }, - { 152396, true }, - { 152413, true }, - { 152432, true }, - { 152452, true }, - { 152475, true }, - { 152494, true }, - { 152513, true }, - { 152532, true }, - { 152550, true }, - { 152569, true }, - { 152580, true }, + { 151931, true }, + { 151944, true }, + { 151965, true }, + { 151977, true }, + { 151990, true }, + { 152000, true }, + { 152014, true }, + { 152034, true }, + { 152047, true }, + { 152066, true }, + { 152082, true }, + { 152100, true }, + { 152114, false }, + { 152126, true }, + { 152136, true }, + { 152150, true }, + { 152160, true }, + { 152176, true }, + { 152202, true }, + { 152230, true }, + { 152243, true }, + { 152258, true }, + { 152274, true }, + { 152298, true }, + { 152314, true }, + { 152329, true }, + { 152343, true }, + { 152355, true }, + { 152367, false }, + { 152385, true }, + { 152398, true }, + { 152417, true }, + { 152435, true }, + { 152450, true }, + { 152473, true }, + { 152490, true }, + { 152509, true }, + { 152529, true }, + { 152552, true }, + { 152571, true }, { 152590, true }, - { 152605, true }, - { 152626, true }, + { 152609, true }, + { 152627, true }, { 152646, true }, - { 152665, true }, - { 152679, true }, - { 152691, true }, - { 152701, true }, - { 152731, true }, - { 152754, true }, - { 152777, true }, - { 152806, true }, - { 152824, true }, - { 152840, true }, - { 152859, true }, - { 152871, true }, - { 152881, true }, - { 152901, false }, - { 152913, true }, - { 152926, true }, - { 152943, true }, - { 152961, true }, - { 152981, true }, - { 152996, true }, - { 153005, true }, - { 153017, true }, - { 153028, true }, - { 153040, true }, - { 153052, false }, - { 153069, true }, + { 152657, true }, + { 152667, true }, + { 152682, true }, + { 152703, true }, + { 152723, true }, + { 152742, true }, + { 152756, true }, + { 152768, true }, + { 152778, true }, + { 152808, true }, + { 152831, true }, + { 152854, true }, + { 152883, true }, + { 152901, true }, + { 152917, true }, + { 152936, true }, + { 152948, true }, + { 152958, true }, + { 152978, false }, + { 152990, true }, + { 153003, true }, + { 153020, true }, + { 153038, true }, + { 153058, true }, + { 153073, true }, { 153082, true }, - { 153100, true }, - { 153115, true }, - { 153130, true }, - { 153142, true }, - { 153156, true }, - { 153168, true }, - { 153188, true }, - { 153200, true }, - { 153214, true }, - { 153234, true }, - { 153248, true }, - { 153266, true }, - { 153279, true }, - { 153294, true }, - { 153310, true }, + { 153094, true }, + { 153105, true }, + { 153117, true }, + { 153129, false }, + { 153146, true }, + { 153159, true }, + { 153177, true }, + { 153192, true }, + { 153207, true }, + { 153219, true }, + { 153233, true }, + { 153245, true }, + { 153265, true }, + { 153277, true }, + { 153291, true }, + { 153311, true }, { 153325, true }, - { 153337, true }, - { 153350, true }, - { 153366, true }, - { 153376, true }, - { 153383, true }, - { 153398, true }, - { 153418, true }, - { 153429, true }, - { 153442, true }, - { 153451, true }, - { 153471, true }, - { 153491, true }, - { 153514, true }, - { 153534, true }, - { 153546, true }, - { 153557, true }, - { 153568, false }, - { 153579, true }, - { 153590, true }, - { 153601, false }, - { 153611, false }, - { 153628, true }, - { 153640, true }, + { 153343, true }, + { 153356, true }, + { 153371, true }, + { 153387, true }, + { 153402, true }, + { 153414, true }, + { 153427, true }, + { 153443, true }, + { 153453, true }, + { 153460, true }, + { 153475, true }, + { 153495, true }, + { 153506, true }, + { 153519, true }, + { 153528, true }, + { 153548, true }, + { 153568, true }, + { 153591, true }, + { 153611, true }, + { 153623, true }, + { 153634, true }, + { 153645, false }, { 153656, true }, - { 153669, true }, - { 153678, true }, - { 153692, true }, - { 153703, true }, - { 153715, true }, + { 153667, true }, + { 153678, false }, + { 153688, false }, + { 153705, true }, + { 153717, true }, { 153733, true }, - { 153747, true }, - { 153760, true }, - { 153773, true }, - { 153782, true }, - { 153797, true }, - { 153808, true }, - { 153822, true }, - { 153842, true }, - { 153854, true }, - { 153864, true }, - { 153875, true }, - { 153908, true }, - { 153920, true }, - { 153934, true }, - { 153953, true }, - { 153968, true }, - { 153982, true }, - { 153996, false }, - { 154016, true }, - { 154033, true }, - { 154044, true }, - { 154057, true }, - { 154072, true }, - { 154088, true }, - { 154106, true }, - { 154122, true }, - { 154139, true }, - { 154151, true }, - { 154165, true }, - { 154181, true }, - { 154194, true }, - { 154206, true }, + { 153746, true }, + { 153755, true }, + { 153769, true }, + { 153780, true }, + { 153792, true }, + { 153810, true }, + { 153824, true }, + { 153837, true }, + { 153850, true }, + { 153859, true }, + { 153874, true }, + { 153885, true }, + { 153899, true }, + { 153919, true }, + { 153931, true }, + { 153941, true }, + { 153952, true }, + { 153985, true }, + { 153997, true }, + { 154011, true }, + { 154030, true }, + { 154045, true }, + { 154059, true }, + { 154073, false }, + { 154093, true }, + { 154110, true }, + { 154123, true }, + { 154138, true }, + { 154154, true }, + { 154172, true }, + { 154188, true }, + { 154205, true }, { 154217, true }, - { 154224, true }, - { 154241, true }, - { 154254, true }, - { 154263, true }, - { 154274, true }, + { 154231, true }, + { 154247, true }, + { 154260, true }, + { 154272, true }, { 154283, true }, - { 154296, true }, - { 154327, true }, + { 154290, true }, + { 154307, true }, + { 154320, true }, + { 154329, true }, { 154340, true }, - { 154353, true }, - { 154366, true }, - { 154377, true }, - { 154386, true }, - { 154401, true }, - { 154413, true }, - { 154429, true }, - { 154450, true }, - { 154467, false }, - { 154480, true }, - { 154492, true }, - { 154505, true }, + { 154349, true }, + { 154362, true }, + { 154393, true }, + { 154406, true }, + { 154419, true }, + { 154432, true }, + { 154443, true }, + { 154452, true }, + { 154467, true }, + { 154479, true }, + { 154495, true }, { 154516, true }, - { 154533, true }, - { 154544, true }, - { 154563, true }, - { 154581, false }, - { 154593, true }, - { 154603, true }, - { 154639, true }, - { 154652, true }, - { 154666, true }, - { 154675, true }, - { 154685, true }, - { 154697, true }, - { 154715, true }, - { 154729, true }, - { 154747, true }, - { 154768, true }, - { 154788, true }, - { 154811, true }, - { 154827, true }, - { 154841, true }, - { 154857, true }, - { 154870, true }, - { 154891, true }, - { 154911, true }, - { 154924, true }, - { 154933, true }, - { 154967, true }, - { 154988, true }, - { 155005, true }, - { 155016, true }, - { 155027, true }, - { 155039, true }, + { 154533, false }, + { 154546, true }, + { 154558, true }, + { 154571, true }, + { 154582, true }, + { 154599, true }, + { 154610, true }, + { 154629, true }, + { 154647, false }, + { 154659, true }, + { 154669, true }, + { 154705, true }, + { 154718, true }, + { 154732, true }, + { 154741, true }, + { 154751, true }, + { 154763, true }, + { 154781, true }, + { 154795, true }, + { 154813, true }, + { 154834, true }, + { 154854, true }, + { 154877, true }, + { 154893, true }, + { 154907, true }, + { 154923, true }, + { 154936, true }, + { 154957, true }, + { 154977, true }, + { 154990, true }, + { 154999, true }, + { 155033, true }, { 155050, true }, - { 155069, true }, - { 155081, true }, - { 155094, true }, - { 155110, true }, - { 155129, true }, - { 155144, true }, - { 155158, true }, - { 155173, true }, - { 155190, false }, - { 155205, true }, - { 155225, true }, - { 155236, true }, - { 155247, true }, - { 155267, false }, - { 155276, true }, - { 155285, true }, - { 155296, true }, - { 155308, true }, - { 155322, true }, - { 155340, true }, - { 155354, true }, - { 155366, true }, - { 155381, true }, - { 155394, true }, - { 155405, false }, - { 155422, true }, - { 155432, true }, - { 155453, true }, - { 155481, false }, - { 155492, true }, - { 155499, true }, - { 155510, true }, - { 155520, true }, - { 155530, true }, + { 155061, true }, + { 155072, true }, + { 155084, true }, + { 155095, true }, + { 155114, true }, + { 155126, true }, + { 155139, true }, + { 155155, true }, + { 155174, true }, + { 155189, true }, + { 155203, true }, + { 155218, true }, + { 155235, false }, + { 155250, true }, + { 155270, true }, + { 155281, true }, + { 155292, true }, + { 155312, false }, + { 155321, true }, + { 155330, true }, + { 155341, true }, + { 155353, true }, + { 155367, true }, + { 155385, true }, + { 155399, true }, + { 155411, true }, + { 155426, true }, + { 155439, true }, + { 155450, false }, + { 155467, true }, + { 155477, true }, + { 155498, true }, + { 155526, false }, + { 155537, true }, { 155544, true }, - { 155558, true }, - { 155569, false }, - { 155580, true }, - { 155588, false }, - { 155608, true }, - { 155623, true }, - { 155636, true }, - { 155652, true }, - { 155667, true }, - { 155680, true }, - { 155696, true }, - { 155709, true }, - { 155729, true }, - { 155742, true }, - { 155761, true }, - { 155779, true }, - { 155789, true }, - { 155803, true }, - { 155821, true }, - { 155841, true }, - { 155873, true }, - { 155888, true }, - { 155907, true }, - { 155920, true }, - { 155935, true }, - { 155950, true }, - { 155971, true }, - { 155992, true }, - { 156006, true }, - { 156028, true }, - { 156044, true }, - { 156069, true }, - { 156081, true }, - { 156092, true }, - { 156109, true }, - { 156133, true }, - { 156147, true }, - { 156160, true }, - { 156173, true }, - { 156185, true }, - { 156198, true }, - { 156216, true }, - { 156233, true }, - { 156258, true }, - { 156271, true }, - { 156283, true }, - { 156297, true }, - { 156311, true }, + { 155555, true }, + { 155565, true }, + { 155575, true }, + { 155589, true }, + { 155603, true }, + { 155614, false }, + { 155625, true }, + { 155633, false }, + { 155653, true }, + { 155668, true }, + { 155681, true }, + { 155697, true }, + { 155712, true }, + { 155725, true }, + { 155741, true }, + { 155754, true }, + { 155774, true }, + { 155787, true }, + { 155806, true }, + { 155824, true }, + { 155834, true }, + { 155848, true }, + { 155866, true }, + { 155886, true }, + { 155918, true }, + { 155933, true }, + { 155952, true }, + { 155965, true }, + { 155980, true }, + { 155995, true }, + { 156016, true }, + { 156037, true }, + { 156051, true }, + { 156073, true }, + { 156089, true }, + { 156114, true }, + { 156126, true }, + { 156137, true }, + { 156154, true }, + { 156178, true }, + { 156192, true }, + { 156205, true }, + { 156218, true }, + { 156230, true }, + { 156243, true }, + { 156261, true }, + { 156278, true }, + { 156303, true }, + { 156316, true }, { 156328, true }, - { 156348, true }, - { 156364, true }, - { 156382, true }, + { 156342, true }, + { 156356, true }, + { 156373, true }, { 156393, true }, - { 156408, true }, - { 156421, true }, - { 156436, true }, - { 156444, false }, - { 156457, true }, - { 156469, true }, - { 156483, true }, - { 156492, true }, - { 156508, true }, - { 156524, true }, - { 156546, true }, - { 156560, true }, - { 156570, true }, - { 156584, true }, - { 156592, true }, - { 156604, true }, + { 156409, true }, + { 156427, true }, + { 156438, true }, + { 156453, true }, + { 156466, true }, + { 156481, true }, + { 156489, false }, + { 156502, true }, + { 156514, true }, + { 156528, true }, + { 156537, true }, + { 156553, true }, + { 156569, true }, + { 156591, true }, + { 156605, true }, { 156615, true }, - { 156631, true }, - { 156641, true }, - { 156654, true }, - { 156667, true }, - { 156681, true }, - { 156697, true }, - { 156710, true }, - { 156724, true }, - { 156741, true }, - { 156752, true }, - { 156762, true }, - { 156782, true }, - { 156794, true }, - { 156808, true }, - { 156823, true }, - { 156835, true }, - { 156844, true }, - { 156852, true }, - { 156864, true }, - { 156875, true }, - { 156896, true }, - { 156915, true }, - { 156933, true }, - { 156951, true }, - { 156971, true }, - { 156980, true }, - { 156994, true }, - { 157012, true }, + { 156629, true }, + { 156637, true }, + { 156649, true }, + { 156660, true }, + { 156676, true }, + { 156686, true }, + { 156699, true }, + { 156712, true }, + { 156726, true }, + { 156742, true }, + { 156755, true }, + { 156769, true }, + { 156786, true }, + { 156797, true }, + { 156807, true }, + { 156827, true }, + { 156839, true }, + { 156853, true }, + { 156868, true }, + { 156880, true }, + { 156889, true }, + { 156897, true }, + { 156909, true }, + { 156920, true }, + { 156941, true }, + { 156960, true }, + { 156978, true }, + { 156996, true }, + { 157016, true }, { 157025, true }, { 157039, true }, - { 157058, true }, - { 157071, true }, - { 157083, true }, - { 157095, true }, - { 157106, true }, - { 157120, true }, - { 157134, false }, - { 157149, true }, - { 157166, true }, - { 157177, true }, - { 157188, true }, - { 157202, true }, - { 157223, true }, - { 157239, true }, - { 157258, true }, - { 157274, true }, - { 157292, true }, - { 157308, true }, - { 157331, true }, - { 157347, true }, - { 157359, true }, - { 157368, true }, - { 157381, true }, - { 157399, true }, - { 157414, true }, - { 157429, true }, - { 157445, true }, - { 157460, true }, - { 157475, true }, + { 157057, true }, + { 157070, true }, + { 157084, true }, + { 157103, true }, + { 157116, true }, + { 157128, true }, + { 157140, true }, + { 157151, true }, + { 157165, true }, + { 157179, false }, + { 157194, true }, + { 157211, true }, + { 157222, true }, + { 157233, true }, + { 157247, true }, + { 157268, true }, + { 157284, true }, + { 157303, true }, + { 157319, true }, + { 157337, true }, + { 157353, true }, + { 157376, true }, + { 157392, true }, + { 157404, true }, + { 157413, true }, + { 157426, true }, + { 157444, true }, + { 157459, true }, + { 157474, true }, { 157490, true }, - { 157506, true }, - { 157521, true }, - { 157536, true }, - { 157552, true }, - { 157569, true }, - { 157579, true }, - { 157592, true }, - { 157605, true }, - { 157615, true }, - { 157636, true }, - { 157648, false }, - { 157659, true }, - { 157673, true }, - { 157685, true }, - { 157694, true }, - { 157709, false }, - { 157728, true }, - { 157745, true }, - { 157758, true }, + { 157505, true }, + { 157520, true }, + { 157535, true }, + { 157551, true }, + { 157566, true }, + { 157581, true }, + { 157597, true }, + { 157614, true }, + { 157624, true }, + { 157637, true }, + { 157650, true }, + { 157660, true }, + { 157681, true }, + { 157693, false }, + { 157704, true }, + { 157718, true }, + { 157730, true }, + { 157739, true }, + { 157754, false }, { 157773, true }, - { 157789, false }, - { 157802, false }, - { 157812, true }, - { 157825, true }, - { 157835, true }, - { 157845, false }, - { 157854, false }, - { 157874, true }, - { 157887, true }, + { 157790, true }, + { 157803, true }, + { 157818, true }, + { 157834, false }, + { 157847, false }, + { 157857, true }, + { 157870, true }, + { 157880, true }, + { 157890, false }, { 157899, false }, - { 157911, true }, - { 157928, true }, - { 157942, true }, - { 157959, true }, - { 157975, true }, - { 157994, true }, - { 158010, false }, - { 158027, true }, - { 158041, true }, - { 158055, true }, - { 158076, true }, - { 158090, true }, - { 158106, true }, - { 158119, false }, - { 158133, true }, - { 158147, true }, - { 158166, true }, - { 158188, true }, - { 158203, true }, - { 158220, true }, - { 158228, true }, - { 158240, true }, - { 158253, true }, - { 158266, true }, - { 158279, false }, - { 158290, true }, - { 158301, true }, - { 158319, true }, - { 158338, true }, - { 158354, true }, - { 158370, true }, - { 158379, true }, - { 158388, false }, - { 158402, true }, - { 158420, true }, - { 158438, true }, - { 158455, true }, - { 158467, true }, - { 158478, false }, - { 158494, false }, - { 158518, true }, - { 158532, true }, - { 158551, true }, + { 157919, true }, + { 157932, true }, + { 157944, false }, + { 157956, true }, + { 157973, true }, + { 157987, true }, + { 158004, true }, + { 158020, true }, + { 158039, true }, + { 158055, false }, + { 158072, true }, + { 158086, true }, + { 158100, true }, + { 158121, true }, + { 158135, true }, + { 158151, true }, + { 158164, false }, + { 158178, true }, + { 158192, true }, + { 158211, true }, + { 158233, true }, + { 158248, true }, + { 158265, true }, + { 158273, true }, + { 158285, true }, + { 158298, true }, + { 158311, true }, + { 158324, false }, + { 158335, true }, + { 158346, true }, + { 158364, true }, + { 158383, true }, + { 158399, true }, + { 158415, true }, + { 158424, true }, + { 158433, false }, + { 158447, true }, + { 158465, true }, + { 158483, true }, + { 158500, true }, + { 158512, true }, + { 158523, false }, + { 158539, false }, + { 158563, true }, + { 158577, true }, { 158596, true }, { 158641, true }, - { 158655, true }, - { 158663, true }, - { 158672, true }, - { 158684, true }, - { 158696, true }, - { 158721, true }, - { 158738, true }, - { 158755, true }, - { 158770, true }, - { 158782, true }, - { 158795, true }, - { 158803, true }, - { 158821, true }, - { 158830, false }, - { 158838, true }, - { 158859, true }, - { 158872, true }, - { 158885, true }, - { 158897, true }, - { 158910, false }, - { 158923, true }, - { 158939, true }, - { 158953, true }, - { 158971, true }, - { 158992, true }, - { 159004, true }, - { 159025, true }, - { 159044, true }, - { 159069, true }, - { 159081, true }, - { 159094, true }, - { 159107, true }, - { 159119, true }, - { 159131, true }, - { 159148, true }, - { 159165, true }, - { 159177, false }, - { 159186, true }, - { 159201, true }, - { 159223, true }, - { 159242, true }, - { 159256, true }, - { 159269, true }, - { 159291, true }, - { 159306, true }, - { 159321, true }, - { 159332, true }, - { 159357, true }, - { 159374, true }, - { 159386, true }, - { 159402, false }, - { 159417, true }, - { 159430, false }, - { 159454, true }, - { 159462, false }, - { 159475, true }, - { 159489, true }, - { 159501, true }, - { 159514, true }, - { 159526, true }, - { 159542, true }, - { 159557, true }, - { 159576, true }, - { 159590, true }, - { 159604, true }, - { 159624, true }, - { 159640, true }, - { 159659, true }, - { 159679, true }, - { 159691, true }, - { 159714, true }, - { 159744, true }, - { 159756, true }, - { 159767, true }, - { 159777, true }, - { 159791, true }, - { 159804, true }, - { 159822, false }, - { 159832, true }, - { 159847, true }, - { 159865, true }, - { 159874, true }, - { 159887, false }, - { 159904, true }, - { 159920, true }, - { 159931, true }, - { 159942, true }, - { 159952, true }, - { 159961, true }, - { 159975, true }, - { 159996, true }, - { 160007, true }, - { 160029, true }, - { 160044, true }, - { 160059, true }, - { 160076, true }, - { 160098, true }, - { 160108, true }, - { 160130, true }, - { 160152, true }, - { 160169, true }, - { 160183, true }, - { 160196, true }, - { 160213, true }, - { 160238, true }, + { 158686, true }, + { 158700, true }, + { 158708, true }, + { 158717, true }, + { 158729, true }, + { 158741, true }, + { 158766, true }, + { 158783, true }, + { 158800, true }, + { 158815, true }, + { 158827, true }, + { 158840, true }, + { 158848, true }, + { 158866, true }, + { 158875, false }, + { 158883, true }, + { 158904, true }, + { 158917, true }, + { 158930, true }, + { 158942, true }, + { 158955, false }, + { 158968, true }, + { 158984, true }, + { 158998, true }, + { 159016, true }, + { 159037, true }, + { 159049, true }, + { 159070, true }, + { 159089, true }, + { 159114, true }, + { 159126, true }, + { 159139, true }, + { 159152, true }, + { 159164, true }, + { 159176, true }, + { 159193, true }, + { 159210, true }, + { 159222, false }, + { 159231, true }, + { 159246, true }, + { 159268, true }, + { 159287, true }, + { 159301, true }, + { 159314, true }, + { 159336, true }, + { 159351, true }, + { 159366, true }, + { 159377, true }, + { 159402, true }, + { 159419, true }, + { 159431, true }, + { 159447, false }, + { 159462, true }, + { 159475, false }, + { 159499, true }, + { 159507, false }, + { 159520, true }, + { 159534, true }, + { 159546, true }, + { 159559, true }, + { 159571, true }, + { 159587, true }, + { 159602, true }, + { 159621, true }, + { 159635, true }, + { 159649, true }, + { 159669, true }, + { 159685, true }, + { 159704, true }, + { 159724, true }, + { 159736, true }, + { 159759, true }, + { 159789, true }, + { 159801, true }, + { 159812, true }, + { 159822, true }, + { 159836, true }, + { 159849, true }, + { 159867, false }, + { 159877, true }, + { 159891, true }, + { 159906, true }, + { 159924, true }, + { 159933, true }, + { 159946, false }, + { 159963, true }, + { 159979, true }, + { 159990, true }, + { 160001, true }, + { 160011, true }, + { 160020, true }, + { 160034, true }, + { 160055, true }, + { 160066, true }, + { 160088, true }, + { 160103, true }, + { 160118, true }, + { 160135, true }, + { 160157, true }, + { 160167, true }, + { 160189, true }, + { 160211, true }, + { 160228, true }, + { 160242, true }, { 160255, true }, - { 160271, true }, - { 160281, true }, - { 160292, true }, - { 160301, false }, - { 160310, true }, - { 160320, true }, - { 160334, true }, - { 160352, true }, - { 160372, true }, - { 160386, true }, - { 160395, true }, - { 160419, true }, - { 160440, true }, - { 160460, true }, + { 160272, true }, + { 160297, true }, + { 160314, true }, + { 160330, true }, + { 160340, true }, + { 160351, true }, + { 160360, false }, + { 160369, true }, + { 160379, true }, + { 160393, true }, + { 160411, true }, + { 160431, true }, + { 160445, true }, + { 160454, true }, { 160478, true }, - { 160491, true }, - { 160508, true }, - { 160529, true }, - { 160547, true }, - { 160559, true }, - { 160581, false }, - { 160600, true }, - { 160611, true }, - { 160624, true }, - { 160645, true }, - { 160656, true }, - { 160671, true }, + { 160499, true }, + { 160519, true }, + { 160537, true }, + { 160550, true }, + { 160567, true }, + { 160588, true }, + { 160606, true }, + { 160618, true }, + { 160640, false }, + { 160659, true }, + { 160670, true }, { 160683, true }, - { 160700, true }, - { 160726, true }, - { 160743, false }, - { 160761, true }, - { 160780, false }, - { 160799, true }, - { 160811, true }, - { 160831, true }, - { 160853, true }, - { 160866, true }, - { 160888, true }, - { 160901, true }, - { 160924, true }, - { 160939, true }, - { 160953, true }, - { 160976, true }, - { 160986, true }, - { 160996, true }, - { 161015, true }, - { 161028, true }, - { 161050, true }, - { 161070, true }, - { 161080, true }, - { 161092, true }, - { 161105, true }, - { 161118, true }, + { 160704, true }, + { 160715, true }, + { 160730, true }, + { 160742, true }, + { 160759, true }, + { 160785, true }, + { 160802, false }, + { 160820, true }, + { 160839, false }, + { 160858, true }, + { 160870, true }, + { 160890, true }, + { 160912, true }, + { 160925, true }, + { 160947, true }, + { 160960, true }, + { 160983, true }, + { 160998, true }, + { 161012, true }, + { 161035, true }, + { 161045, true }, + { 161055, true }, + { 161074, true }, + { 161087, true }, + { 161109, true }, + { 161129, true }, { 161139, true }, - { 161165, true }, - { 161186, true }, - { 161207, true }, - { 161228, true }, - { 161248, true }, - { 161260, true }, - { 161280, true }, - { 161294, true }, - { 161306, true }, - { 161315, true }, - { 161338, true }, - { 161354, true }, - { 161366, true }, - { 161391, true }, - { 161406, true }, - { 161427, true }, - { 161444, true }, - { 161465, false }, - { 161482, false }, - { 161500, true }, - { 161510, true }, - { 161524, true }, - { 161538, true }, - { 161548, true }, - { 161560, true }, - { 161572, true }, - { 161582, true }, - { 161593, true }, + { 161151, true }, + { 161164, true }, + { 161177, true }, + { 161198, true }, + { 161224, true }, + { 161245, true }, + { 161266, true }, + { 161287, true }, + { 161307, true }, + { 161319, true }, + { 161339, true }, + { 161353, true }, + { 161365, true }, + { 161374, true }, + { 161397, true }, + { 161413, true }, + { 161425, true }, + { 161450, true }, + { 161465, true }, + { 161486, true }, + { 161503, true }, + { 161524, false }, + { 161541, false }, + { 161559, true }, + { 161569, true }, + { 161583, true }, + { 161597, true }, { 161607, true }, + { 161619, true }, { 161631, true }, - { 161643, true }, - { 161672, true }, - { 161687, true }, - { 161701, true }, - { 161715, true }, + { 161641, true }, + { 161652, true }, + { 161666, true }, + { 161690, true }, + { 161702, true }, { 161731, true }, { 161746, true }, { 161760, true }, - { 161772, true }, - { 161792, true }, - { 161806, true }, + { 161774, true }, + { 161790, true }, + { 161805, true }, { 161819, true }, - { 161832, true }, - { 161844, true }, - { 161862, true }, - { 161874, true }, - { 161893, true }, - { 161917, true }, - { 161940, true }, + { 161831, true }, + { 161851, true }, + { 161865, true }, + { 161878, true }, + { 161891, true }, + { 161903, true }, + { 161921, true }, + { 161933, true }, { 161952, true }, - { 161970, true }, - { 161986, true }, - { 162006, false }, - { 162024, true }, - { 162044, true }, - { 162057, true }, - { 162077, true }, - { 162085, true }, - { 162095, true }, - { 162114, true }, - { 162133, true }, - { 162147, true }, - { 162165, true }, - { 162181, false }, - { 162200, true }, - { 162221, true }, - { 162235, true }, - { 162244, true }, - { 162262, true }, - { 162279, true }, - { 162295, true }, - { 162317, true }, - { 162334, true }, - { 162352, true }, - { 162371, true }, - { 162388, true }, - { 162401, true }, - { 162411, true }, - { 162419, true }, - { 162437, true }, - { 162465, true }, - { 162482, true }, - { 162496, true }, - { 162511, false }, - { 162524, true }, - { 162536, false }, - { 162546, false }, - { 162559, false }, - { 162574, true }, - { 162586, true }, - { 162598, true }, - { 162610, true }, - { 162622, true }, - { 162635, true }, - { 162648, true }, - { 162660, true }, - { 162672, true }, - { 162688, true }, - { 162700, true }, + { 161976, true }, + { 161999, true }, + { 162011, true }, + { 162029, true }, + { 162045, true }, + { 162065, false }, + { 162083, true }, + { 162103, true }, + { 162116, true }, + { 162136, true }, + { 162144, true }, + { 162154, true }, + { 162173, true }, + { 162192, true }, + { 162206, true }, + { 162224, true }, + { 162240, false }, + { 162259, true }, + { 162280, true }, + { 162294, true }, + { 162303, true }, + { 162320, true }, + { 162336, true }, + { 162358, true }, + { 162375, true }, + { 162393, true }, + { 162412, true }, + { 162429, true }, + { 162442, true }, + { 162452, true }, + { 162460, true }, + { 162478, true }, + { 162506, true }, + { 162523, true }, + { 162537, true }, + { 162552, false }, + { 162565, true }, + { 162577, false }, + { 162587, false }, + { 162600, false }, + { 162615, true }, + { 162627, true }, + { 162639, true }, + { 162651, true }, + { 162663, true }, + { 162676, true }, + { 162689, true }, + { 162701, true }, { 162713, true }, - { 162723, true }, - { 162733, true }, - { 162746, true }, - { 162761, true }, - { 162772, true }, - { 162783, true }, - { 162801, true }, - { 162809, true }, - { 162817, true }, - { 162829, true }, - { 162843, true }, - { 162860, true }, - { 162890, true }, - { 162905, true }, - { 162921, true }, - { 162936, true }, - { 162951, true }, - { 162966, true }, - { 162974, true }, - { 162989, true }, - { 163000, true }, - { 163013, true }, - { 163021, false }, - { 163031, true }, - { 163047, true }, - { 163064, true }, - { 163081, true }, - { 163102, true }, - { 163115, true }, - { 163127, true }, - { 163135, true }, - { 163152, true }, + { 162729, true }, + { 162741, true }, + { 162754, true }, + { 162764, true }, + { 162774, true }, + { 162787, true }, + { 162802, true }, + { 162813, true }, + { 162824, true }, + { 162842, true }, + { 162850, true }, + { 162858, true }, + { 162870, true }, + { 162884, true }, + { 162901, true }, + { 162931, true }, + { 162946, true }, + { 162962, true }, + { 162977, true }, + { 162992, true }, + { 163007, true }, + { 163015, true }, + { 163030, true }, + { 163041, true }, + { 163054, true }, + { 163062, false }, + { 163072, true }, + { 163088, true }, + { 163105, true }, + { 163122, true }, + { 163143, true }, + { 163156, true }, { 163168, true }, - { 163175, true }, - { 163186, true }, - { 163194, false }, - { 163218, true }, - { 163250, true }, - { 163277, true }, - { 163297, true }, - { 163321, true }, - { 163338, false }, - { 163351, true }, - { 163366, true }, - { 163377, true }, - { 163388, true }, - { 163398, true }, - { 163411, true }, - { 163419, true }, - { 163431, true }, - { 163443, false }, - { 163455, false }, - { 163463, false }, - { 163488, true }, - { 163501, true }, - { 163516, true }, - { 163530, true }, - { 163543, true }, - { 163555, true }, - { 163568, true }, - { 163585, true }, - { 163599, true }, - { 163616, true }, - { 163628, true }, - { 163642, true }, + { 163176, true }, + { 163193, true }, + { 163209, true }, + { 163216, true }, + { 163227, true }, + { 163235, false }, + { 163259, true }, + { 163291, true }, + { 163318, true }, + { 163338, true }, + { 163362, true }, + { 163379, false }, + { 163392, true }, + { 163407, true }, + { 163418, true }, + { 163429, true }, + { 163439, true }, + { 163452, true }, + { 163460, true }, + { 163472, true }, + { 163484, false }, + { 163496, false }, + { 163504, false }, + { 163529, true }, + { 163542, true }, + { 163557, true }, + { 163571, true }, + { 163584, true }, + { 163596, true }, + { 163609, true }, + { 163626, true }, + { 163640, true }, { 163657, true }, - { 163672, true }, + { 163669, true }, { 163683, true }, - { 163690, true }, - { 163710, true }, + { 163698, true }, + { 163713, true }, { 163724, true }, - { 163732, true }, - { 163740, false }, - { 163755, true }, - { 163767, true }, - { 163781, true }, - { 163794, true }, - { 163804, true }, - { 163814, true }, - { 163821, true }, - { 163834, true }, - { 163847, true }, + { 163731, true }, + { 163751, true }, + { 163765, true }, + { 163773, true }, + { 163781, false }, + { 163796, true }, + { 163808, true }, + { 163822, true }, + { 163835, true }, + { 163845, true }, { 163855, true }, - { 163872, true }, - { 163880, true }, - { 163889, true }, - { 163905, true }, - { 163924, true }, - { 163935, true }, - { 163947, true }, - { 163957, true }, - { 163974, false }, - { 163985, true }, - { 163993, true }, - { 164003, true }, - { 164012, true }, - { 164028, true }, - { 164049, true }, - { 164074, false }, + { 163862, true }, + { 163875, true }, + { 163888, true }, + { 163896, true }, + { 163913, true }, + { 163921, true }, + { 163930, true }, + { 163946, true }, + { 163965, true }, + { 163976, true }, + { 163988, true }, + { 163998, true }, + { 164015, false }, + { 164026, true }, + { 164034, true }, + { 164044, true }, + { 164053, true }, + { 164069, true }, { 164090, true }, - { 164102, true }, - { 164114, true }, - { 164127, true }, - { 164135, true }, - { 164143, false }, - { 164163, false }, - { 164182, false }, - { 164201, false }, - { 164221, false }, - { 164241, false }, - { 164261, false }, - { 164280, false }, - { 164299, true }, - { 164318, true }, - { 164329, true }, - { 164339, true }, - { 164348, true }, - { 164361, true }, - { 164376, true }, - { 164386, false }, - { 164397, true }, - { 164408, true }, + { 164115, false }, + { 164131, true }, + { 164143, true }, + { 164155, true }, + { 164168, true }, + { 164176, true }, + { 164184, false }, + { 164204, false }, + { 164223, false }, + { 164242, false }, + { 164262, false }, + { 164282, false }, + { 164302, false }, + { 164321, false }, + { 164340, true }, + { 164359, true }, + { 164370, true }, + { 164380, true }, + { 164389, true }, + { 164402, true }, { 164417, true }, - { 164425, true }, + { 164427, false }, { 164438, true }, - { 164446, true }, - { 164456, true }, - { 164465, true }, - { 164480, true }, - { 164503, true }, - { 164522, false }, - { 164533, true }, - { 164555, true }, - { 164569, true }, - { 164578, true }, - { 164585, true }, - { 164594, true }, - { 164602, true }, - { 164609, true }, - { 164621, true }, - { 164638, true }, - { 164645, true }, - { 164653, true }, - { 164664, true }, - { 164678, true }, - { 164690, true }, - { 164702, true }, - { 164711, true }, - { 164720, true }, - { 164732, false }, + { 164449, true }, + { 164458, true }, + { 164466, true }, + { 164479, true }, + { 164487, true }, + { 164497, true }, + { 164506, true }, + { 164521, true }, + { 164544, true }, + { 164563, false }, + { 164574, true }, + { 164596, true }, + { 164610, true }, + { 164619, true }, + { 164626, true }, + { 164635, true }, + { 164643, true }, + { 164650, true }, + { 164662, true }, + { 164679, true }, + { 164686, true }, + { 164694, true }, + { 164705, true }, + { 164719, true }, + { 164731, true }, { 164743, true }, - { 164756, true }, - { 164782, true }, - { 164805, false }, - { 164825, true }, - { 164842, true }, - { 164857, true }, - { 164871, true }, - { 164887, true }, - { 164900, true }, - { 164911, true }, - { 164929, true }, - { 164944, true }, - { 164964, true }, - { 164979, true }, - { 164988, true }, + { 164752, true }, + { 164761, true }, + { 164773, false }, + { 164784, true }, + { 164797, true }, + { 164823, true }, + { 164846, false }, + { 164866, true }, + { 164883, true }, + { 164898, true }, + { 164912, true }, + { 164931, true }, + { 164947, true }, + { 164960, true }, + { 164971, true }, + { 164986, true }, { 165006, true }, { 165021, true }, - { 165042, true }, - { 165062, true }, - { 165077, true }, - { 165092, true }, - { 165107, true }, - { 165121, true }, - { 165135, true }, - { 165144, true }, - { 165155, true }, - { 165170, true }, - { 165179, true }, + { 165030, true }, + { 165048, true }, + { 165063, true }, + { 165084, true }, + { 165104, true }, + { 165119, true }, + { 165134, true }, + { 165149, true }, + { 165163, true }, + { 165177, true }, + { 165186, true }, { 165197, true }, - { 165208, true }, - { 165218, true }, - { 165227, true }, - { 165238, true }, - { 165248, true }, - { 165257, true }, - { 165267, true }, + { 165212, true }, + { 165221, true }, + { 165239, true }, + { 165250, true }, + { 165260, true }, + { 165269, true }, { 165280, true }, - { 165291, true }, - { 165301, true }, - { 165310, true }, - { 165326, true }, + { 165290, true }, + { 165299, true }, + { 165309, true }, + { 165322, true }, { 165333, true }, - { 165344, true }, - { 165355, true }, - { 165369, true }, - { 165376, true }, - { 165387, true }, - { 165395, true }, - { 165413, true }, - { 165426, true }, - { 165438, true }, - { 165446, true }, - { 165466, false }, - { 165482, true }, - { 165501, true }, + { 165343, true }, + { 165352, true }, + { 165368, true }, + { 165375, true }, + { 165386, true }, + { 165397, true }, + { 165411, true }, + { 165418, true }, + { 165429, true }, + { 165437, true }, + { 165455, true }, + { 165468, true }, + { 165480, true }, + { 165488, true }, + { 165508, false }, { 165524, true }, { 165543, true }, - { 165554, true }, - { 165576, true }, - { 165589, true }, - { 165598, true }, - { 165621, true }, - { 165655, true }, - { 165671, true }, - { 165687, true }, - { 165709, true }, - { 165722, true }, - { 165749, true }, - { 165763, true }, - { 165773, true }, + { 165566, true }, + { 165585, true }, + { 165596, true }, + { 165618, true }, + { 165631, true }, + { 165640, true }, + { 165663, true }, + { 165697, true }, + { 165713, true }, + { 165729, true }, + { 165751, true }, + { 165764, true }, { 165791, true }, - { 165801, true }, - { 165820, true }, - { 165834, true }, - { 165848, true }, - { 165864, true }, - { 165875, true }, - { 165898, true }, - { 165913, true }, - { 165936, true }, - { 165945, true }, - { 165963, true }, - { 165980, true }, - { 165990, true }, - { 166015, true }, + { 165805, true }, + { 165815, true }, + { 165833, true }, + { 165843, true }, + { 165862, true }, + { 165876, true }, + { 165890, true }, + { 165906, true }, + { 165917, true }, + { 165928, true }, + { 165951, true }, + { 165966, true }, + { 165989, true }, + { 165998, true }, + { 166016, true }, { 166033, true }, - { 166048, true }, - { 166058, true }, - { 166070, true }, - { 166083, true }, - { 166094, false }, - { 166106, true }, + { 166043, true }, + { 166068, true }, + { 166086, true }, + { 166101, true }, + { 166111, true }, { 166123, true }, - { 166133, true }, - { 166150, true }, - { 166171, true }, - { 166193, true }, - { 166211, true }, - { 166222, true }, - { 166235, true }, + { 166136, true }, + { 166147, false }, + { 166159, true }, + { 166176, true }, + { 166186, true }, + { 166203, true }, + { 166224, true }, { 166246, true }, - { 166260, true }, - { 166273, true }, - { 166284, true }, - { 166294, true }, - { 166308, true }, - { 166323, true }, - { 166333, true }, - { 166346, true }, - { 166355, true }, - { 166371, true }, - { 166387, false }, - { 166400, false }, - { 166413, false }, - { 166425, true }, - { 166442, true }, - { 166453, true }, - { 166468, true }, - { 166478, true }, - { 166490, true }, - { 166507, true }, - { 166521, true }, + { 166264, true }, + { 166275, true }, + { 166288, true }, + { 166299, true }, + { 166313, true }, + { 166326, true }, + { 166337, true }, + { 166347, true }, + { 166361, true }, + { 166376, true }, + { 166386, true }, + { 166399, true }, + { 166408, true }, + { 166421, true }, + { 166437, true }, + { 166453, false }, + { 166466, false }, + { 166479, false }, + { 166491, true }, + { 166508, true }, + { 166519, true }, { 166534, true }, - { 166552, true }, - { 166561, true }, - { 166572, true }, - { 166583, true }, - { 166595, true }, - { 166608, true }, + { 166544, true }, + { 166556, true }, + { 166573, true }, + { 166587, true }, + { 166600, true }, + { 166609, true }, { 166620, true }, - { 166629, true }, - { 166640, true }, - { 166657, true }, - { 166673, true }, - { 166685, true }, - { 166697, true }, - { 166709, true }, - { 166726, true }, - { 166738, true }, - { 166748, true }, - { 166761, true }, - { 166778, true }, - { 166792, true }, - { 166807, true }, - { 166819, true }, + { 166631, true }, + { 166643, true }, + { 166656, true }, + { 166668, true }, + { 166677, true }, + { 166688, true }, + { 166705, true }, + { 166721, true }, + { 166733, true }, + { 166745, true }, + { 166757, true }, + { 166774, true }, + { 166786, true }, + { 166796, true }, + { 166809, true }, { 166826, true }, - { 166842, true }, - { 166858, true }, + { 166840, true }, + { 166855, true }, { 166867, true }, { 166874, true }, - { 166885, true }, - { 166902, true }, + { 166890, true }, + { 166906, true }, { 166915, true }, - { 166930, true }, - { 166940, true }, - { 166951, true }, - { 166974, true }, - { 166986, false }, - { 167000, true }, - { 167018, true }, - { 167035, true }, - { 167046, true }, - { 167062, false }, - { 167081, true }, - { 167096, true }, - { 167115, true }, - { 167126, true }, - { 167147, true }, + { 166922, true }, + { 166933, true }, + { 166950, true }, + { 166963, true }, + { 166978, true }, + { 166988, true }, + { 166999, true }, + { 167022, true }, + { 167034, false }, + { 167048, true }, + { 167066, true }, + { 167083, true }, + { 167094, true }, + { 167110, false }, + { 167129, true }, + { 167144, true }, { 167163, true }, - { 167175, true }, - { 167189, true }, - { 167203, true }, - { 167214, true }, - { 167235, true }, - { 167248, true }, - { 167258, true }, - { 167269, true }, - { 167286, true }, - { 167301, true }, - { 167321, true }, - { 167336, true }, - { 167355, false }, - { 167372, true }, - { 167388, true }, - { 167400, true }, - { 167423, true }, - { 167438, true }, - { 167454, true }, - { 167465, true }, - { 167473, true }, - { 167496, true }, - { 167508, true }, - { 167516, true }, - { 167542, true }, - { 167560, true }, - { 167573, true }, + { 167174, true }, + { 167195, true }, + { 167211, true }, + { 167223, true }, + { 167237, true }, + { 167251, true }, + { 167262, true }, + { 167283, true }, + { 167296, true }, + { 167306, true }, + { 167317, true }, + { 167334, true }, + { 167349, true }, + { 167369, true }, + { 167384, true }, + { 167403, false }, + { 167420, true }, + { 167436, true }, + { 167448, true }, + { 167471, true }, + { 167486, true }, + { 167502, true }, + { 167513, true }, + { 167521, true }, + { 167544, true }, + { 167556, true }, + { 167564, true }, { 167590, true }, - { 167602, true }, - { 167629, true }, - { 167660, true }, - { 167671, true }, - { 167681, true }, - { 167696, true }, - { 167707, true }, - { 167718, true }, - { 167734, true }, - { 167746, true }, + { 167608, true }, + { 167621, true }, + { 167638, true }, + { 167650, true }, + { 167677, true }, + { 167708, true }, + { 167719, true }, + { 167729, true }, + { 167744, true }, { 167755, true }, - { 167768, true }, - { 167796, true }, - { 167817, true }, - { 167831, true }, - { 167853, true }, - { 167870, true }, - { 167880, true }, - { 167892, true }, - { 167908, true }, - { 167922, true }, - { 167933, true }, - { 167947, true }, - { 167965, true }, - { 167982, true }, - { 168002, true }, + { 167766, true }, + { 167782, true }, + { 167794, true }, + { 167803, true }, + { 167816, true }, + { 167844, true }, + { 167865, true }, + { 167879, true }, + { 167901, true }, + { 167918, true }, + { 167928, true }, + { 167940, true }, + { 167956, true }, + { 167970, true }, + { 167981, true }, + { 167995, true }, { 168013, true }, - { 168024, false }, - { 168031, true }, - { 168041, true }, - { 168068, true }, - { 168088, true }, - { 168106, true }, - { 168121, false }, - { 168132, true }, - { 168148, true }, - { 168165, true }, - { 168182, true }, - { 168204, true }, - { 168218, true }, - { 168234, false }, - { 168251, true }, - { 168267, true }, - { 168277, true }, - { 168295, true }, - { 168316, true }, - { 168334, true }, - { 168341, true }, - { 168359, true }, - { 168377, true }, - { 168391, true }, - { 168401, true }, - { 168412, true }, - { 168434, true }, - { 168450, true }, - { 168467, true }, - { 168487, true }, - { 168498, true }, - { 168517, true }, - { 168531, true }, - { 168548, true }, - { 168560, true }, - { 168577, true }, - { 168598, true }, - { 168614, true }, - { 168626, true }, - { 168649, true }, - { 168667, true }, - { 168678, true }, - { 168688, true }, + { 168030, true }, + { 168050, true }, + { 168061, true }, + { 168072, false }, + { 168079, true }, + { 168089, true }, + { 168116, true }, + { 168136, true }, + { 168154, true }, + { 168169, false }, + { 168180, true }, + { 168196, true }, + { 168213, true }, + { 168230, true }, + { 168252, true }, + { 168266, true }, + { 168282, false }, + { 168299, true }, + { 168315, true }, + { 168325, true }, + { 168343, true }, + { 168364, true }, + { 168382, true }, + { 168389, true }, + { 168407, true }, + { 168425, true }, + { 168439, true }, + { 168449, true }, + { 168460, true }, + { 168476, true }, + { 168493, true }, + { 168513, true }, + { 168524, true }, + { 168543, true }, + { 168557, true }, + { 168574, true }, + { 168586, true }, + { 168603, true }, + { 168624, true }, + { 168640, true }, + { 168652, true }, + { 168675, true }, + { 168693, true }, { 168704, true }, - { 168715, true }, - { 168727, false }, - { 168747, true }, - { 168766, true }, - { 168779, true }, - { 168789, true }, - { 168806, true }, - { 168826, true }, - { 168840, true }, - { 168855, true }, - { 168869, true }, - { 168883, true }, - { 168901, true }, - { 168915, true }, - { 168930, true }, - { 168951, true }, - { 168962, true }, - { 168976, true }, - { 168992, false }, - { 169006, true }, - { 169022, true }, - { 169039, true }, - { 169055, true }, - { 169075, true }, - { 169098, true }, - { 169107, false }, - { 169115, true }, - { 169125, true }, - { 169137, false }, - { 169159, true }, - { 169174, true }, - { 169188, true }, - { 169202, true }, - { 169215, true }, - { 169243, true }, - { 169255, true }, - { 169270, true }, - { 169295, true }, - { 169309, true }, - { 169330, true }, - { 169341, true }, - { 169351, true }, - { 169359, true }, - { 169371, true }, - { 169396, true }, - { 169406, true }, - { 169431, true }, - { 169441, true }, - { 169454, true }, - { 169468, true }, - { 169485, true }, - { 169498, true }, - { 169509, true }, - { 169517, true }, - { 169526, true }, - { 169540, true }, - { 169553, true }, - { 169569, true }, - { 169579, true }, - { 169590, true }, - { 169601, true }, - { 169617, true }, - { 169627, false }, - { 169639, true }, - { 169651, true }, - { 169666, true }, - { 169684, true }, - { 169696, true }, - { 169706, true }, - { 169722, true }, - { 169746, true }, - { 169759, true }, - { 169766, true }, + { 168714, true }, + { 168730, true }, + { 168741, true }, + { 168753, false }, + { 168773, true }, + { 168792, true }, + { 168805, true }, + { 168815, true }, + { 168832, true }, + { 168852, true }, + { 168866, true }, + { 168881, true }, + { 168895, true }, + { 168909, true }, + { 168927, true }, + { 168941, true }, + { 168956, true }, + { 168977, true }, + { 168988, true }, + { 169002, true }, + { 169018, false }, + { 169032, true }, + { 169048, true }, + { 169065, true }, + { 169081, true }, + { 169101, true }, + { 169124, true }, + { 169133, false }, + { 169141, true }, + { 169151, true }, + { 169163, false }, + { 169185, true }, + { 169200, true }, + { 169214, true }, + { 169228, true }, + { 169241, true }, + { 169269, true }, + { 169281, true }, + { 169296, true }, + { 169321, true }, + { 169335, true }, + { 169356, true }, + { 169367, true }, + { 169377, true }, + { 169385, true }, + { 169397, true }, + { 169422, true }, + { 169432, true }, + { 169457, true }, + { 169467, true }, + { 169480, false }, + { 169505, true }, + { 169519, true }, + { 169536, true }, + { 169549, true }, + { 169560, true }, + { 169568, true }, + { 169577, true }, + { 169591, true }, + { 169604, true }, + { 169620, true }, + { 169630, true }, + { 169641, true }, + { 169652, true }, + { 169668, true }, + { 169678, false }, + { 169690, true }, + { 169702, true }, + { 169717, true }, + { 169735, true }, + { 169747, true }, + { 169757, true }, { 169773, true }, - { 169790, true }, - { 169804, true }, - { 169816, true }, - { 169828, true }, - { 169840, true }, - { 169854, true }, - { 169863, true }, - { 169884, true }, - { 169897, true }, - { 169908, true }, - { 169925, true }, - { 169940, true }, - { 169965, true }, - { 169991, true }, - { 170006, true }, - { 170017, true }, + { 169797, true }, + { 169810, true }, + { 169817, true }, + { 169824, true }, + { 169841, true }, + { 169855, true }, + { 169867, true }, + { 169879, true }, + { 169891, true }, + { 169901, true }, + { 169915, true }, + { 169924, true }, + { 169945, true }, + { 169958, true }, + { 169969, true }, + { 169986, true }, + { 170001, true }, { 170026, true }, - { 170048, true }, - { 170057, true }, - { 170072, true }, - { 170082, true }, - { 170098, true }, - { 170111, true }, - { 170128, true }, - { 170149, true }, - { 170170, true }, - { 170187, true }, - { 170206, true }, - { 170218, true }, - { 170233, true }, - { 170249, true }, - { 170263, true }, - { 170275, true }, - { 170289, true }, - { 170301, true }, - { 170320, true }, - { 170336, true }, - { 170352, true }, - { 170368, true }, - { 170386, true }, - { 170396, true }, - { 170413, true }, - { 170430, true }, - { 170448, true }, - { 170463, true }, - { 170477, true }, - { 170495, true }, - { 170512, true }, - { 170525, true }, - { 170544, true }, - { 170564, true }, - { 170581, true }, - { 170597, true }, - { 170615, true }, - { 170632, false }, - { 170649, false }, - { 170670, true }, - { 170687, true }, - { 170697, true }, - { 170716, true }, - { 170730, true }, - { 170743, true }, - { 170754, true }, - { 170769, true }, - { 170782, true }, - { 170793, true }, - { 170811, true }, - { 170823, true }, - { 170836, true }, - { 170860, true }, - { 170869, true }, - { 170893, true }, - { 170920, true }, - { 170938, true }, - { 170948, true }, - { 170957, true }, - { 170967, true }, - { 170978, true }, - { 171001, true }, - { 171011, true }, - { 171024, true }, + { 170052, true }, + { 170067, true }, + { 170078, true }, + { 170087, true }, + { 170109, true }, + { 170118, true }, + { 170133, true }, + { 170143, true }, + { 170159, true }, + { 170172, true }, + { 170189, true }, + { 170210, true }, + { 170231, true }, + { 170248, true }, + { 170267, true }, + { 170279, true }, + { 170293, true }, + { 170308, true }, + { 170324, true }, + { 170338, true }, + { 170350, true }, + { 170364, true }, + { 170376, true }, + { 170395, true }, + { 170411, true }, + { 170427, true }, + { 170443, true }, + { 170461, true }, + { 170471, true }, + { 170488, true }, + { 170505, true }, + { 170523, true }, + { 170538, true }, + { 170552, true }, + { 170570, true }, + { 170587, true }, + { 170600, true }, + { 170619, true }, + { 170639, true }, + { 170656, true }, + { 170672, true }, + { 170690, true }, + { 170707, false }, + { 170724, false }, + { 170745, true }, + { 170762, true }, + { 170772, true }, + { 170791, true }, + { 170805, true }, + { 170818, true }, + { 170829, true }, + { 170844, true }, + { 170857, true }, + { 170868, true }, + { 170886, true }, + { 170898, true }, + { 170911, true }, + { 170935, true }, + { 170944, true }, + { 170968, true }, + { 170995, true }, + { 171013, true }, + { 171023, true }, { 171032, true }, - { 171039, true }, - { 171058, true }, - { 171065, true }, - { 171080, true }, - { 171089, true }, - { 171101, false }, - { 171121, true }, - { 171135, true }, - { 171145, true }, - { 171162, true }, - { 171180, true }, - { 171197, true }, - { 171219, false }, - { 171232, true }, - { 171251, true }, - { 171263, true }, - { 171274, true }, - { 171287, true }, - { 171306, true }, + { 171042, true }, + { 171053, true }, + { 171076, true }, + { 171086, true }, + { 171099, true }, + { 171107, true }, + { 171114, true }, + { 171133, true }, + { 171140, true }, + { 171155, true }, + { 171164, true }, + { 171176, false }, + { 171196, true }, + { 171210, true }, + { 171220, true }, + { 171238, true }, + { 171255, true }, + { 171277, false }, + { 171290, true }, + { 171309, true }, { 171321, true }, - { 171337, true }, - { 171360, true }, - { 171380, true }, - { 171393, true }, - { 171407, true }, - { 171421, true }, - { 171432, true }, - { 171443, true }, - { 171453, true }, - { 171472, true }, - { 171484, true }, - { 171501, true }, - { 171513, true }, - { 171530, true }, - { 171541, true }, - { 171565, true }, - { 171575, true }, - { 171587, true }, - { 171597, true }, - { 171607, true }, - { 171623, true }, - { 171639, true }, - { 171670, true }, - { 171679, true }, - { 171693, true }, - { 171710, true }, - { 171722, true }, - { 171741, true }, - { 171758, true }, - { 171771, true }, - { 171784, true }, - { 171794, true }, - { 171808, true }, - { 171822, true }, + { 171332, true }, + { 171345, true }, + { 171364, true }, + { 171379, true }, + { 171395, true }, + { 171418, true }, + { 171438, true }, + { 171451, true }, + { 171465, true }, + { 171476, true }, + { 171487, true }, + { 171497, true }, + { 171516, true }, + { 171528, true }, + { 171545, true }, + { 171557, true }, + { 171574, true }, + { 171585, true }, + { 171609, true }, + { 171619, true }, + { 171631, true }, + { 171641, true }, + { 171651, true }, + { 171667, true }, + { 171683, true }, + { 171714, true }, + { 171723, true }, + { 171737, true }, + { 171754, true }, + { 171766, true }, + { 171785, true }, + { 171801, true }, + { 171818, true }, { 171831, true }, - { 171841, true }, - { 171856, true }, - { 171866, true }, - { 171880, true }, - { 171897, true }, - { 171910, true }, - { 171920, true }, - { 171938, true }, - { 171955, true }, - { 171971, true }, - { 171988, true }, - { 172010, true }, - { 172022, true }, - { 172040, true }, - { 172054, false }, - { 172069, true }, + { 171844, true }, + { 171854, true }, + { 171868, true }, + { 171882, true }, + { 171891, true }, + { 171901, true }, + { 171916, true }, + { 171926, true }, + { 171940, true }, + { 171957, true }, + { 171970, true }, + { 171980, true }, + { 171998, true }, + { 172015, true }, + { 172031, true }, + { 172048, true }, + { 172070, true }, { 172082, true }, - { 172094, true }, - { 172101, true }, - { 172113, true }, - { 172123, true }, - { 172135, true }, - { 172146, true }, - { 172163, true }, - { 172175, true }, - { 172194, true }, - { 172220, true }, - { 172229, true }, - { 172244, true }, - { 172258, true }, - { 172274, true }, + { 172100, true }, + { 172114, false }, + { 172129, true }, + { 172142, true }, + { 172154, true }, + { 172161, true }, + { 172173, true }, + { 172183, true }, + { 172195, true }, + { 172206, true }, + { 172223, true }, + { 172235, true }, + { 172254, true }, + { 172280, true }, { 172289, true }, - { 172311, true }, - { 172336, true }, - { 172352, true }, - { 172370, true }, - { 172384, true }, - { 172394, true }, - { 172404, true }, - { 172415, true }, + { 172304, true }, + { 172318, true }, + { 172334, true }, + { 172349, true }, + { 172371, true }, + { 172396, true }, + { 172412, true }, { 172430, true }, - { 172440, true }, - { 172452, true }, - { 172470, true }, - { 172486, true }, - { 172501, true }, - { 172516, false }, - { 172539, true }, - { 172555, true }, - { 172568, true }, - { 172579, true }, - { 172589, true }, - { 172606, true }, - { 172626, true }, - { 172638, true }, - { 172669, true }, - { 172690, true }, - { 172703, true }, - { 172728, true }, - { 172749, true }, - { 172760, true }, - { 172777, true }, - { 172789, true }, - { 172802, true }, - { 172822, true }, - { 172830, true }, - { 172841, true }, - { 172850, true }, - { 172859, true }, - { 172866, true }, - { 172874, true }, - { 172888, true }, - { 172900, false }, - { 172907, true }, - { 172915, false }, - { 172924, true }, - { 172933, true }, - { 172944, true }, - { 172951, true }, - { 172968, true }, - { 172977, true }, - { 172985, true }, - { 172999, true }, - { 173007, true }, - { 173026, false }, - { 173046, true }, - { 173056, true }, - { 173077, true }, - { 173088, false }, - { 173100, true }, - { 173114, true }, - { 173131, true }, - { 173148, true }, - { 173159, true }, - { 173188, true }, - { 173202, true }, - { 173214, true }, - { 173228, true }, - { 173245, true }, - { 173257, true }, - { 173272, true }, - { 173286, true }, - { 173294, true }, - { 173302, true }, - { 173314, true }, - { 173328, true }, - { 173345, true }, - { 173363, true }, - { 173376, true }, - { 173386, true }, - { 173395, false }, - { 173413, true }, - { 173425, false }, - { 173437, true }, - { 173450, true }, - { 173465, true }, - { 173479, true }, - { 173488, true }, + { 172444, true }, + { 172454, true }, + { 172464, true }, + { 172475, true }, + { 172490, true }, + { 172500, true }, + { 172512, true }, + { 172530, true }, + { 172546, true }, + { 172561, true }, + { 172576, false }, + { 172599, true }, + { 172615, true }, + { 172628, true }, + { 172639, true }, + { 172649, true }, + { 172666, true }, + { 172686, true }, + { 172698, true }, + { 172729, true }, + { 172750, true }, + { 172763, true }, + { 172788, true }, + { 172809, true }, + { 172820, true }, + { 172837, true }, + { 172849, true }, + { 172862, true }, + { 172882, true }, + { 172890, true }, + { 172901, true }, + { 172910, true }, + { 172919, true }, + { 172926, true }, + { 172934, true }, + { 172948, true }, + { 172960, false }, + { 172967, true }, + { 172975, false }, + { 172984, true }, + { 172993, true }, + { 173004, true }, + { 173011, true }, + { 173028, true }, + { 173037, true }, + { 173045, true }, + { 173059, true }, + { 173067, true }, + { 173086, false }, + { 173106, true }, + { 173116, true }, + { 173137, true }, + { 173148, false }, + { 173160, true }, + { 173174, true }, + { 173191, true }, + { 173208, true }, + { 173219, true }, + { 173248, true }, + { 173260, true }, + { 173274, true }, + { 173291, true }, + { 173303, true }, + { 173318, true }, + { 173332, true }, + { 173340, true }, + { 173348, true }, + { 173360, true }, + { 173374, true }, + { 173391, true }, + { 173409, true }, + { 173422, true }, + { 173432, true }, + { 173441, false }, + { 173459, true }, + { 173471, false }, + { 173483, true }, + { 173496, true }, { 173511, true }, { 173525, true }, - { 173538, true }, - { 173554, true }, + { 173534, true }, + { 173557, true }, { 173571, true }, - { 173589, true }, - { 173601, true }, - { 173620, true }, - { 173642, true }, - { 173664, true }, - { 173684, true }, - { 173702, false }, - { 173718, true }, - { 173741, true }, - { 173750, true }, - { 173758, true }, - { 173773, true }, - { 173792, true }, - { 173808, true }, - { 173822, true }, - { 173838, true }, - { 173858, true }, - { 173868, true }, - { 173886, true }, - { 173893, true }, - { 173905, true }, - { 173918, true }, - { 173928, true }, - { 173944, true }, + { 173584, true }, + { 173600, true }, + { 173617, true }, + { 173630, true }, + { 173648, true }, + { 173660, true }, + { 173679, true }, + { 173701, true }, + { 173723, true }, + { 173743, true }, + { 173761, false }, + { 173777, true }, + { 173800, true }, + { 173809, true }, + { 173817, true }, + { 173832, true }, + { 173851, true }, + { 173867, true }, + { 173881, true }, + { 173897, true }, + { 173917, true }, + { 173927, true }, + { 173945, true }, { 173952, true }, - { 173960, true }, - { 173968, true }, - { 173975, false }, - { 173998, true }, - { 174017, true }, - { 174042, true }, - { 174059, true }, - { 174071, true }, - { 174083, true }, - { 174093, true }, - { 174104, true }, - { 174119, true }, - { 174128, true }, + { 173964, true }, + { 173977, true }, + { 173987, true }, + { 174003, true }, + { 174011, true }, + { 174019, true }, + { 174027, true }, + { 174034, false }, + { 174057, true }, + { 174076, true }, + { 174101, true }, + { 174118, true }, + { 174130, true }, { 174142, true }, - { 174153, true }, - { 174166, true }, - { 174188, true }, - { 174198, true }, - { 174219, true }, - { 174240, true }, + { 174152, true }, + { 174163, true }, + { 174178, true }, + { 174187, true }, + { 174201, true }, + { 174212, true }, + { 174225, true }, + { 174247, true }, { 174257, true }, { 174278, true }, - { 174292, true }, - { 174308, true }, - { 174321, true }, - { 174333, true }, - { 174348, true }, - { 174358, true }, - { 174371, true }, - { 174395, true }, - { 174414, true }, - { 174426, true }, - { 174444, true }, - { 174453, false }, - { 174470, true }, - { 174488, true }, - { 174501, true }, - { 174514, false }, - { 174535, true }, - { 174545, true }, - { 174564, true }, - { 174577, true }, - { 174597, true }, - { 174622, true }, - { 174633, true }, - { 174645, true }, - { 174660, true }, - { 174673, true }, - { 174688, true }, - { 174703, true }, - { 174723, true }, - { 174736, false }, - { 174745, true }, - { 174764, true }, - { 174781, false }, - { 174796, true }, - { 174810, true }, - { 174820, true }, - { 174833, true }, - { 174849, true }, - { 174865, true }, - { 174883, true }, - { 174893, true }, - { 174906, true }, - { 174918, true }, - { 174931, true }, - { 174944, true }, - { 174953, true }, + { 174299, true }, + { 174316, true }, + { 174337, true }, + { 174351, true }, + { 174367, true }, + { 174380, true }, + { 174392, true }, + { 174407, true }, + { 174417, true }, + { 174430, true }, + { 174454, true }, + { 174473, true }, + { 174485, true }, + { 174503, true }, + { 174512, false }, + { 174529, true }, + { 174547, true }, + { 174560, true }, + { 174573, false }, + { 174594, true }, + { 174604, true }, + { 174623, true }, + { 174636, true }, + { 174656, true }, + { 174681, true }, + { 174692, true }, + { 174704, true }, + { 174719, true }, + { 174732, true }, + { 174747, true }, + { 174762, true }, + { 174782, true }, + { 174795, false }, + { 174804, true }, + { 174823, true }, + { 174840, false }, + { 174855, true }, + { 174869, true }, + { 174879, true }, + { 174892, true }, + { 174908, true }, + { 174924, true }, + { 174942, true }, + { 174952, true }, + { 174965, true }, { 174977, true }, - { 175001, true }, - { 175018, false }, - { 175031, true }, - { 175042, true }, - { 175058, true }, - { 175070, true }, - { 175086, true }, - { 175103, false }, - { 175115, true }, - { 175134, false }, - { 175143, true }, - { 175165, true }, - { 175179, true }, - { 175192, false }, - { 175207, true }, - { 175222, true }, - { 175234, true }, - { 175253, false }, - { 175276, true }, - { 175292, true }, - { 175308, true }, - { 175326, true }, - { 175344, false }, - { 175364, true }, - { 175376, true }, - { 175389, true }, - { 175405, true }, - { 175416, true }, - { 175435, true }, - { 175449, true }, - { 175460, true }, - { 175470, true }, - { 175487, true }, - { 175499, true }, - { 175511, true }, - { 175530, true }, - { 175542, true }, - { 175553, true }, - { 175572, true }, - { 175593, true }, - { 175603, true }, - { 175616, true }, - { 175624, true }, - { 175640, true }, - { 175664, false }, - { 175682, true }, - { 175700, false }, - { 175720, true }, - { 175736, true }, - { 175754, true }, - { 175766, true }, - { 175783, true }, - { 175806, true }, - { 175825, true }, - { 175845, true }, - { 175858, true }, + { 174990, true }, + { 175003, true }, + { 175012, true }, + { 175036, true }, + { 175060, true }, + { 175077, false }, + { 175090, true }, + { 175101, true }, + { 175117, true }, + { 175129, true }, + { 175145, true }, + { 175162, false }, + { 175174, true }, + { 175193, false }, + { 175202, true }, + { 175224, true }, + { 175237, false }, + { 175252, true }, + { 175267, true }, + { 175279, true }, + { 175298, false }, + { 175321, true }, + { 175337, true }, + { 175353, true }, + { 175371, true }, + { 175389, false }, + { 175409, true }, + { 175421, true }, + { 175434, true }, + { 175450, true }, + { 175461, true }, + { 175480, true }, + { 175494, true }, + { 175505, true }, + { 175515, true }, + { 175532, true }, + { 175544, true }, + { 175556, true }, + { 175575, true }, + { 175587, true }, + { 175598, true }, + { 175617, true }, + { 175638, true }, + { 175648, true }, + { 175661, true }, + { 175669, true }, + { 175685, true }, + { 175709, false }, + { 175727, true }, + { 175745, false }, + { 175765, true }, + { 175781, true }, + { 175799, true }, + { 175811, true }, + { 175828, true }, + { 175851, true }, { 175870, true }, - { 175878, true }, - { 175898, true }, - { 175906, true }, - { 175922, true }, - { 175936, true }, - { 175948, true }, - { 175957, true }, + { 175890, true }, + { 175903, true }, + { 175915, true }, + { 175923, true }, + { 175943, true }, + { 175951, true }, { 175967, true }, - { 175976, true }, + { 175981, true }, { 175993, true }, - { 176003, true }, - { 176016, true }, - { 176033, true }, - { 176044, true }, - { 176054, true }, - { 176071, true }, - { 176088, true }, - { 176097, true }, - { 176111, true }, - { 176123, true }, + { 176002, true }, + { 176012, true }, + { 176021, true }, + { 176038, true }, + { 176048, true }, + { 176061, true }, + { 176078, true }, + { 176089, true }, + { 176099, true }, + { 176116, true }, + { 176133, true }, { 176142, true }, - { 176152, true }, - { 176169, true }, - { 176191, true }, - { 176205, true }, - { 176219, true }, - { 176237, true }, - { 176252, true }, - { 176266, true }, - { 176275, true }, - { 176287, true }, - { 176293, true }, - { 176299, true }, - { 176307, true }, - { 176319, true }, - { 176340, true }, - { 176350, true }, - { 176361, true }, - { 176379, true }, - { 176392, true }, - { 176411, true }, - { 176427, true }, - { 176438, true }, - { 176451, true }, - { 176466, true }, - { 176480, false }, - { 176494, true }, - { 176513, true }, + { 176156, true }, + { 176168, true }, + { 176187, true }, + { 176197, true }, + { 176214, true }, + { 176236, true }, + { 176250, true }, + { 176264, true }, + { 176282, true }, + { 176297, true }, + { 176311, true }, + { 176320, true }, + { 176332, true }, + { 176338, true }, + { 176344, true }, + { 176352, true }, + { 176364, true }, + { 176385, true }, + { 176395, true }, + { 176406, true }, + { 176424, true }, + { 176437, true }, + { 176456, true }, + { 176472, true }, + { 176485, true }, + { 176496, true }, + { 176509, true }, { 176524, true }, - { 176534, true }, - { 176542, true }, - { 176559, true }, - { 176573, true }, - { 176585, true }, - { 176602, true }, - { 176616, true }, - { 176630, false }, + { 176538, false }, + { 176552, true }, + { 176571, true }, + { 176582, true }, + { 176592, true }, + { 176600, true }, + { 176617, true }, + { 176631, true }, { 176643, true }, - { 176661, true }, - { 176673, true }, - { 176685, true }, - { 176704, true }, - { 176723, true }, - { 176737, true }, - { 176749, true }, + { 176660, true }, + { 176674, true }, + { 176688, false }, + { 176701, true }, + { 176719, true }, + { 176731, true }, + { 176743, true }, { 176762, true }, - { 176778, true }, - { 176791, true }, - { 176804, true }, - { 176819, true }, - { 176847, true }, - { 176858, true }, - { 176871, true }, - { 176886, true }, + { 176781, true }, + { 176795, true }, + { 176807, true }, + { 176820, true }, + { 176836, true }, + { 176849, true }, + { 176862, true }, + { 176877, true }, { 176905, true }, - { 176918, true }, - { 176943, true }, - { 176955, true }, - { 176969, true }, - { 176983, true }, - { 176998, true }, - { 177012, true }, - { 177026, true }, - { 177040, true }, + { 176916, true }, + { 176929, true }, + { 176944, true }, + { 176963, true }, + { 176976, true }, + { 177001, true }, + { 177013, true }, + { 177027, true }, + { 177041, true }, { 177056, true }, - { 177079, true }, - { 177095, true }, - { 177110, true }, - { 177134, true }, - { 177146, true }, - { 177165, true }, - { 177178, true }, - { 177189, true }, - { 177209, true }, - { 177221, true }, - { 177239, true }, - { 177256, true }, - { 177271, true }, - { 177290, true }, - { 177303, true }, - { 177319, true }, - { 177337, true }, + { 177070, true }, + { 177084, true }, + { 177098, true }, + { 177114, true }, + { 177137, true }, + { 177153, true }, + { 177168, true }, + { 177192, true }, + { 177204, true }, + { 177223, true }, + { 177236, true }, + { 177247, true }, + { 177267, true }, + { 177279, true }, + { 177297, true }, + { 177314, true }, + { 177329, true }, + { 177348, true }, { 177361, true }, { 177377, true }, - { 177390, true }, - { 177410, true }, - { 177423, true }, - { 177445, true }, - { 177462, true }, - { 177477, true }, - { 177498, true }, - { 177518, true }, - { 177531, true }, - { 177546, true }, - { 177558, true }, - { 177572, true }, - { 177590, true }, - { 177605, true }, - { 177624, true }, - { 177643, true }, - { 177657, true }, - { 177678, true }, - { 177693, true }, - { 177705, true }, - { 177722, true }, - { 177737, true }, - { 177755, true }, - { 177767, true }, - { 177781, true }, - { 177792, true }, - { 177814, true }, - { 177826, true }, - { 177835, true }, - { 177847, true }, - { 177862, true }, - { 177885, true }, - { 177904, true }, - { 177922, true }, - { 177938, true }, - { 177957, true }, - { 177973, true }, - { 177990, true }, - { 178003, true }, - { 178022, true }, - { 178040, true }, - { 178046, true }, - { 178064, false }, - { 178084, true }, - { 178101, true }, - { 178115, true }, - { 178127, true }, - { 178146, false }, - { 178163, true }, - { 178182, true }, - { 178193, true }, - { 178212, true }, - { 178235, true }, - { 178261, true }, - { 178272, true }, - { 178290, true }, - { 178310, true }, - { 178327, true }, - { 178346, true }, - { 178364, true }, - { 178373, true }, - { 178380, true }, - { 178387, true }, - { 178399, true }, - { 178409, true }, - { 178420, false }, - { 178440, true }, - { 178448, true }, - { 178459, true }, - { 178470, true }, - { 178481, true }, - { 178504, true }, + { 177395, true }, + { 177419, true }, + { 177435, true }, + { 177448, true }, + { 177468, true }, + { 177481, true }, + { 177503, true }, + { 177520, true }, + { 177535, true }, + { 177556, true }, + { 177576, true }, + { 177589, true }, + { 177604, true }, + { 177616, true }, + { 177630, true }, + { 177648, true }, + { 177663, true }, + { 177682, true }, + { 177701, true }, + { 177715, true }, + { 177736, true }, + { 177751, true }, + { 177763, true }, + { 177780, true }, + { 177795, true }, + { 177813, true }, + { 177825, true }, + { 177839, true }, + { 177850, true }, + { 177872, true }, + { 177884, true }, + { 177893, true }, + { 177905, true }, + { 177920, true }, + { 177943, true }, + { 177962, true }, + { 177980, true }, + { 177996, true }, + { 178015, true }, + { 178031, true }, + { 178048, true }, + { 178061, true }, + { 178080, true }, + { 178098, true }, + { 178104, true }, + { 178122, false }, + { 178142, true }, + { 178159, true }, + { 178173, true }, + { 178185, true }, + { 178204, false }, + { 178221, true }, + { 178240, true }, + { 178251, true }, + { 178270, true }, + { 178293, true }, + { 178319, true }, + { 178330, true }, + { 178348, true }, + { 178368, true }, + { 178385, true }, + { 178404, true }, + { 178422, true }, + { 178431, true }, + { 178438, true }, + { 178445, true }, + { 178457, true }, + { 178467, true }, + { 178478, false }, + { 178498, true }, + { 178506, true }, + { 178517, true }, { 178528, true }, - { 178551, true }, - { 178574, true }, - { 178602, true }, - { 178631, true }, - { 178644, true }, - { 178659, true }, - { 178678, true }, - { 178691, true }, - { 178709, true }, - { 178732, true }, - { 178743, true }, - { 178760, true }, - { 178771, true }, - { 178786, true }, - { 178797, true }, - { 178815, true }, - { 178841, true }, - { 178870, true }, - { 178882, true }, - { 178895, false }, - { 178915, true }, - { 178933, true }, - { 178948, true }, - { 178969, false }, - { 178985, true }, - { 179003, true }, - { 179019, true }, - { 179034, true }, - { 179052, true }, - { 179068, true }, - { 179080, true }, - { 179102, true }, - { 179124, true }, - { 179144, true }, - { 179163, true }, - { 179180, true }, - { 179198, false }, - { 179216, true }, - { 179236, true }, - { 179255, true }, + { 178539, true }, + { 178562, true }, + { 178586, true }, + { 178609, true }, + { 178632, true }, + { 178660, true }, + { 178689, true }, + { 178702, true }, + { 178717, true }, + { 178736, true }, + { 178749, true }, + { 178767, true }, + { 178790, true }, + { 178801, true }, + { 178818, true }, + { 178829, true }, + { 178844, true }, + { 178855, true }, + { 178873, true }, + { 178899, true }, + { 178928, true }, + { 178940, true }, + { 178953, false }, + { 178973, true }, + { 178991, true }, + { 179006, true }, + { 179027, false }, + { 179043, true }, + { 179061, true }, + { 179077, true }, + { 179092, true }, + { 179110, true }, + { 179126, true }, + { 179138, true }, + { 179160, true }, + { 179182, true }, + { 179202, true }, + { 179221, true }, + { 179238, true }, + { 179256, false }, { 179274, true }, - { 179295, true }, - { 179322, true }, - { 179334, true }, - { 179346, true }, - { 179357, true }, - { 179376, true }, - { 179390, true }, - { 179399, true }, - { 179414, true }, - { 179424, true }, - { 179437, true }, + { 179294, true }, + { 179313, true }, + { 179332, true }, + { 179353, true }, + { 179380, true }, + { 179392, true }, + { 179404, true }, + { 179415, true }, + { 179434, true }, + { 179448, true }, { 179457, true }, - { 179466, true }, - { 179476, true }, - { 179497, false }, - { 179514, true }, + { 179472, true }, + { 179482, true }, + { 179495, true }, + { 179515, true }, + { 179524, true }, { 179534, true }, - { 179543, true }, - { 179556, true }, - { 179573, true }, - { 179587, true }, + { 179555, false }, + { 179572, true }, + { 179592, true }, { 179601, true }, - { 179613, true }, - { 179630, true }, + { 179614, true }, + { 179631, true }, { 179645, true }, - { 179662, true }, - { 179678, true }, - { 179695, true }, - { 179711, true }, - { 179723, true }, - { 179734, false }, - { 179750, true }, - { 179761, true }, - { 179777, true }, - { 179792, true }, + { 179659, true }, + { 179671, true }, + { 179688, true }, + { 179703, true }, + { 179720, true }, + { 179736, true }, + { 179753, true }, + { 179769, true }, + { 179781, true }, + { 179792, false }, { 179808, true }, - { 179821, true }, - { 179830, true }, - { 179843, true }, - { 179860, true }, - { 179872, true }, - { 179884, true }, - { 179896, true }, - { 179908, true }, - { 179917, true }, - { 179929, true }, - { 179944, true }, - { 179958, true }, - { 179970, true }, + { 179819, true }, + { 179835, true }, + { 179850, true }, + { 179866, true }, + { 179879, true }, + { 179888, true }, + { 179901, true }, + { 179918, true }, + { 179930, true }, + { 179942, true }, + { 179954, true }, + { 179966, true }, + { 179975, true }, { 179987, true }, - { 179999, true }, - { 180009, true }, - { 180025, true }, - { 180046, true }, - { 180064, true }, - { 180080, true }, - { 180096, true }, - { 180116, true }, - { 180131, true }, - { 180143, true }, - { 180158, true }, - { 180168, true }, - { 180183, true }, - { 180195, true }, - { 180207, true }, - { 180222, true }, - { 180236, true }, - { 180247, true }, - { 180258, true }, - { 180269, true }, - { 180277, true }, - { 180290, true }, - { 180303, true }, - { 180320, true }, - { 180330, true }, - { 180343, true }, - { 180360, true }, - { 180374, true }, - { 180383, true }, - { 180398, true }, - { 180412, true }, - { 180426, true }, - { 180440, true }, - { 180448, true }, - { 180465, true }, - { 180480, true }, - { 180495, true }, - { 180509, true }, - { 180525, true }, - { 180541, true }, - { 180555, true }, - { 180571, true }, - { 180593, true }, - { 180610, true }, - { 180623, true }, - { 180637, true }, - { 180653, false }, - { 180671, true }, - { 180686, true }, - { 180703, true }, - { 180718, true }, - { 180735, false }, + { 180002, true }, + { 180016, true }, + { 180028, true }, + { 180045, true }, + { 180057, true }, + { 180067, true }, + { 180083, true }, + { 180104, true }, + { 180122, true }, + { 180138, true }, + { 180154, true }, + { 180174, true }, + { 180189, true }, + { 180201, true }, + { 180216, true }, + { 180226, true }, + { 180241, true }, + { 180253, true }, + { 180265, true }, + { 180280, true }, + { 180294, true }, + { 180305, true }, + { 180316, true }, + { 180327, true }, + { 180335, true }, + { 180348, true }, + { 180361, true }, + { 180378, true }, + { 180388, true }, + { 180401, true }, + { 180418, true }, + { 180432, true }, + { 180441, true }, + { 180456, true }, + { 180470, true }, + { 180484, true }, + { 180498, true }, + { 180506, true }, + { 180523, true }, + { 180538, true }, + { 180553, true }, + { 180567, true }, + { 180583, true }, + { 180599, true }, + { 180613, true }, + { 180629, true }, + { 180651, true }, + { 180668, true }, + { 180681, true }, + { 180695, true }, + { 180711, false }, + { 180729, true }, + { 180744, true }, { 180761, true }, { 180776, true }, - { 180794, true }, - { 180807, true }, - { 180820, true }, - { 180839, true }, - { 180849, true }, + { 180793, false }, + { 180819, true }, + { 180834, true }, + { 180852, true }, { 180865, true }, - { 180877, true }, - { 180899, false }, - { 180910, true }, - { 180927, true }, - { 180958, true }, + { 180878, true }, + { 180897, true }, + { 180907, true }, + { 180923, true }, + { 180935, true }, + { 180957, false }, { 180968, true }, - { 180979, true }, - { 180991, true }, - { 181005, true }, - { 181017, true }, - { 181025, true }, - { 181033, true }, - { 181044, false }, - { 181064, true }, - { 181082, true }, - { 181102, true }, - { 181117, true }, - { 181132, true }, - { 181149, false }, - { 181163, true }, - { 181183, true }, - { 181194, true }, - { 181219, true }, - { 181240, true }, - { 181258, true }, - { 181273, true }, - { 181290, true }, - { 181306, true }, + { 180985, true }, + { 181016, true }, + { 181026, true }, + { 181037, true }, + { 181049, true }, + { 181063, true }, + { 181075, true }, + { 181083, true }, + { 181091, true }, + { 181102, false }, + { 181122, true }, + { 181140, true }, + { 181160, true }, + { 181175, true }, + { 181190, true }, + { 181207, false }, + { 181221, true }, + { 181241, true }, + { 181252, true }, + { 181277, true }, + { 181298, true }, + { 181316, true }, { 181331, true }, - { 181342, true }, - { 181353, true }, - { 181367, true }, - { 181380, false }, - { 181408, true }, - { 181420, true }, - { 181433, true }, - { 181446, false }, - { 181454, true }, - { 181464, true }, - { 181479, true }, + { 181348, true }, + { 181364, true }, + { 181389, true }, + { 181400, true }, + { 181411, true }, + { 181425, true }, + { 181438, false }, + { 181466, true }, + { 181478, true }, { 181491, true }, - { 181510, true }, + { 181504, false }, + { 181512, true }, { 181522, true }, - { 181535, true }, - { 181548, true }, - { 181563, true }, - { 181576, true }, - { 181598, true }, - { 181612, true }, - { 181625, true }, - { 181645, true }, - { 181663, true }, - { 181677, true }, - { 181688, true }, - { 181699, true }, - { 181712, true }, - { 181729, true }, - { 181737, true }, - { 181752, true }, - { 181765, true }, - { 181779, true }, - { 181794, true }, - { 181819, true }, - { 181855, true }, - { 181868, true }, - { 181878, true }, - { 181893, true }, - { 181906, true }, - { 181928, true }, - { 181950, true }, - { 181968, true }, - { 181981, true }, - { 181992, true }, - { 182004, true }, - { 182023, true }, - { 182041, true }, - { 182049, true }, - { 182082, true }, - { 182089, true }, - { 182106, true }, - { 182122, true }, - { 182139, true }, - { 182149, true }, - { 182162, true }, - { 182180, false }, - { 182198, true }, - { 182216, true }, - { 182228, true }, - { 182240, true }, - { 182251, true }, - { 182264, true }, - { 182280, true }, - { 182294, true }, - { 182314, true }, - { 182328, true }, + { 181537, true }, + { 181549, true }, + { 181568, true }, + { 181580, true }, + { 181593, true }, + { 181606, true }, + { 181621, true }, + { 181634, true }, + { 181656, true }, + { 181670, true }, + { 181683, true }, + { 181703, true }, + { 181721, true }, + { 181735, true }, + { 181746, true }, + { 181757, true }, + { 181770, true }, + { 181787, true }, + { 181795, true }, + { 181810, true }, + { 181823, true }, + { 181837, true }, + { 181852, true }, + { 181877, true }, + { 181913, true }, + { 181926, true }, + { 181936, true }, + { 181951, true }, + { 181964, true }, + { 181986, true }, + { 182008, true }, + { 182026, true }, + { 182039, true }, + { 182050, true }, + { 182069, true }, + { 182087, true }, + { 182095, true }, + { 182128, true }, + { 182135, true }, + { 182152, true }, + { 182168, true }, + { 182185, true }, + { 182195, true }, + { 182208, true }, + { 182226, false }, + { 182244, true }, + { 182262, true }, + { 182274, true }, + { 182286, true }, + { 182297, true }, + { 182310, true }, + { 182326, true }, { 182340, true }, { 182360, true }, - { 182371, true }, - { 182388, true }, - { 182398, true }, - { 182407, true }, - { 182418, true }, - { 182437, true }, - { 182454, true }, - { 182468, true }, - { 182482, true }, - { 182505, true }, - { 182525, true }, - { 182539, true }, - { 182553, true }, - { 182565, true }, - { 182577, true }, - { 182593, true }, - { 182607, true }, - { 182621, true }, - { 182630, true }, - { 182642, true }, - { 182654, true }, - { 182665, true }, - { 182674, true }, - { 182683, true }, - { 182694, true }, - { 182708, true }, - { 182714, true }, - { 182726, true }, - { 182739, true }, - { 182754, false }, - { 182781, true }, - { 182801, true }, - { 182811, true }, - { 182824, true }, - { 182837, true }, - { 182853, true }, - { 182874, true }, - { 182895, true }, - { 182914, true }, - { 182924, true }, - { 182936, true }, - { 182947, false }, - { 182955, true }, + { 182374, true }, + { 182386, true }, + { 182406, true }, + { 182417, true }, + { 182434, true }, + { 182444, true }, + { 182453, true }, + { 182464, true }, + { 182483, true }, + { 182500, true }, + { 182514, true }, + { 182528, true }, + { 182551, true }, + { 182571, true }, + { 182585, true }, + { 182599, true }, + { 182611, true }, + { 182623, true }, + { 182639, true }, + { 182653, true }, + { 182667, true }, + { 182676, true }, + { 182688, true }, + { 182700, true }, + { 182711, true }, + { 182720, true }, + { 182729, true }, + { 182740, true }, + { 182754, true }, + { 182760, true }, + { 182772, true }, + { 182785, true }, + { 182800, false }, + { 182827, true }, + { 182847, true }, + { 182857, true }, + { 182870, true }, + { 182883, true }, + { 182899, true }, + { 182920, true }, + { 182941, true }, + { 182960, true }, { 182970, true }, - { 182984, true }, - { 182998, true }, - { 183010, true }, - { 183023, true }, - { 183033, true }, - { 183054, true }, - { 183066, true }, - { 183077, true }, - { 183097, true }, - { 183116, true }, - { 183127, true }, - { 183142, true }, - { 183167, false }, - { 183195, false }, - { 183207, true }, - { 183218, true }, - { 183229, true }, - { 183245, true }, - { 183260, true }, + { 182982, true }, + { 182993, false }, + { 183001, true }, + { 183016, true }, + { 183030, true }, + { 183044, true }, + { 183056, true }, + { 183069, true }, + { 183079, true }, + { 183100, true }, + { 183112, true }, + { 183123, true }, + { 183143, true }, + { 183162, true }, + { 183173, true }, + { 183188, true }, + { 183213, false }, + { 183241, false }, + { 183253, true }, + { 183264, true }, { 183275, true }, - { 183286, true }, - { 183303, true }, - { 183315, false }, + { 183291, true }, + { 183306, true }, + { 183321, true }, { 183332, true }, - { 183351, true }, - { 183367, true }, - { 183381, true }, - { 183396, true }, - { 183411, true }, + { 183349, true }, + { 183361, false }, + { 183378, true }, + { 183397, true }, + { 183413, true }, { 183427, true }, - { 183444, true }, - { 183467, true }, - { 183486, true }, - { 183500, true }, - { 183521, true }, - { 183541, true }, - { 183559, true }, - { 183578, true }, - { 183596, true }, - { 183614, true }, - { 183630, true }, - { 183645, false }, - { 183660, false }, - { 183674, true }, - { 183687, true }, - { 183703, true }, - { 183714, true }, - { 183725, true }, - { 183737, true }, - { 183752, true }, - { 183770, true }, - { 183788, true }, - { 183810, true }, - { 183824, true }, - { 183841, true }, - { 183860, true }, - { 183878, true }, - { 183899, true }, - { 183913, true }, - { 183925, true }, - { 183940, true }, - { 183956, true }, - { 183974, true }, - { 183984, true }, - { 183996, false }, - { 184007, true }, - { 184026, false }, - { 184045, true }, - { 184060, true }, - { 184073, false }, - { 184092, true }, - { 184103, true }, - { 184121, true }, - { 184135, true }, - { 184160, true }, - { 184175, true }, - { 184193, true }, - { 184208, true }, - { 184223, true }, - { 184240, true }, - { 184251, true }, - { 184261, true }, - { 184273, true }, - { 184287, true }, - { 184302, true }, - { 184311, true }, - { 184321, false }, - { 184338, true }, - { 184353, false }, - { 184366, true }, - { 184382, true }, - { 184394, true }, - { 184415, true }, + { 183442, true }, + { 183457, true }, + { 183473, true }, + { 183490, true }, + { 183513, true }, + { 183532, true }, + { 183546, true }, + { 183567, true }, + { 183587, true }, + { 183605, true }, + { 183624, true }, + { 183642, true }, + { 183660, true }, + { 183676, true }, + { 183691, false }, + { 183706, false }, + { 183720, true }, + { 183733, true }, + { 183749, true }, + { 183760, true }, + { 183771, true }, + { 183783, true }, + { 183798, true }, + { 183816, true }, + { 183834, true }, + { 183856, true }, + { 183870, true }, + { 183887, true }, + { 183906, true }, + { 183924, true }, + { 183945, true }, + { 183959, true }, + { 183971, true }, + { 183986, true }, + { 184002, true }, + { 184020, true }, + { 184030, true }, + { 184042, false }, + { 184053, true }, + { 184072, false }, + { 184091, true }, + { 184106, true }, + { 184119, false }, + { 184138, true }, + { 184149, true }, + { 184167, true }, + { 184181, true }, + { 184206, true }, + { 184221, true }, + { 184239, true }, + { 184254, true }, + { 184269, true }, + { 184286, true }, + { 184297, true }, + { 184307, true }, + { 184319, true }, + { 184333, true }, + { 184348, true }, + { 184357, true }, + { 184367, true }, + { 184384, true }, + { 184399, false }, + { 184412, true }, { 184428, true }, - { 184445, true }, - { 184465, true }, - { 184488, true }, - { 184507, true }, - { 184519, true }, - { 184530, true }, - { 184540, false }, - { 184552, true }, - { 184567, true }, - { 184581, true }, - { 184595, true }, - { 184615, true }, - { 184638, true }, - { 184651, true }, - { 184669, true }, - { 184677, true }, + { 184440, true }, + { 184461, true }, + { 184474, true }, + { 184491, true }, + { 184511, true }, + { 184534, true }, + { 184553, true }, + { 184565, true }, + { 184576, true }, + { 184586, false }, + { 184598, true }, + { 184613, true }, + { 184627, true }, + { 184641, true }, + { 184661, true }, { 184684, true }, - { 184692, true }, - { 184707, true }, - { 184719, true }, - { 184731, true }, - { 184748, true }, - { 184759, false }, - { 184776, true }, - { 184789, true }, - { 184800, false }, - { 184813, true }, - { 184828, false }, - { 184852, false }, - { 184864, true }, - { 184889, true }, - { 184898, true }, - { 184918, true }, + { 184697, true }, + { 184715, true }, + { 184723, true }, + { 184730, true }, + { 184738, true }, + { 184753, true }, + { 184765, true }, + { 184777, true }, + { 184794, true }, + { 184805, false }, + { 184822, true }, + { 184835, true }, + { 184846, false }, + { 184859, true }, + { 184874, false }, + { 184898, false }, + { 184910, true }, { 184935, true }, - { 184945, true }, - { 184966, true }, - { 184975, true }, - { 184994, true }, + { 184944, true }, + { 184964, true }, + { 184981, true }, + { 184991, true }, { 185012, true }, - { 185028, true }, - { 185043, true }, + { 185021, true }, + { 185040, true }, { 185058, true }, - { 185073, true }, - { 185093, true }, - { 185106, true }, + { 185074, true }, + { 185089, true }, + { 185104, true }, { 185119, true }, - { 185128, true }, - { 185142, true }, + { 185139, true }, + { 185152, true }, { 185165, true }, - { 185187, true }, - { 185213, true }, - { 185228, true }, - { 185243, true }, - { 185253, true }, - { 185267, true }, - { 185279, true }, - { 185302, true }, + { 185174, true }, + { 185188, true }, + { 185211, true }, + { 185233, true }, + { 185259, true }, + { 185274, true }, + { 185289, true }, + { 185299, true }, { 185311, true }, - { 185321, true }, - { 185329, true }, - { 185345, true }, - { 185359, true }, - { 185372, true }, - { 185389, false }, - { 185407, true }, - { 185420, true }, - { 185431, true }, - { 185444, true }, - { 185455, true }, - { 185465, true }, - { 185480, true }, - { 185493, true }, - { 185509, true }, - { 185519, false }, - { 185529, true }, - { 185542, true }, - { 185557, true }, - { 185567, true }, - { 185583, true }, - { 185595, true }, - { 185604, true }, - { 185619, true }, - { 185630, true }, - { 185648, true }, - { 185668, true }, - { 185684, true }, + { 185334, true }, + { 185343, true }, + { 185351, true }, + { 185367, true }, + { 185381, true }, + { 185394, true }, + { 185411, false }, + { 185429, true }, + { 185442, true }, + { 185453, true }, + { 185466, true }, + { 185477, true }, + { 185487, true }, + { 185502, true }, + { 185515, true }, + { 185531, true }, + { 185541, false }, + { 185551, true }, + { 185564, true }, + { 185579, true }, + { 185589, true }, + { 185605, true }, + { 185617, true }, + { 185626, true }, + { 185641, true }, + { 185652, true }, + { 185663, true }, + { 185681, true }, { 185701, true }, - { 185714, true }, - { 185724, true }, + { 185717, true }, { 185734, true }, - { 185748, true }, - { 185760, true }, - { 185773, true }, - { 185790, true }, - { 185805, true }, - { 185822, true }, - { 185834, true }, - { 185851, true }, - { 185865, true }, - { 185874, true }, - { 185890, true }, - { 185903, true }, - { 185916, true }, - { 185931, false }, - { 185943, true }, - { 185956, true }, - { 185966, true }, - { 185975, true }, - { 185987, true }, - { 185995, true }, - { 186003, true }, - { 186011, true }, - { 186017, true }, + { 185747, true }, + { 185757, true }, + { 185767, true }, + { 185781, true }, + { 185793, true }, + { 185806, true }, + { 185823, true }, + { 185838, true }, + { 185855, true }, + { 185867, true }, + { 185884, true }, + { 185898, true }, + { 185907, true }, + { 185923, true }, + { 185936, true }, + { 185949, true }, + { 185964, false }, + { 185976, true }, + { 185989, true }, + { 185999, true }, + { 186008, true }, + { 186020, true }, { 186028, true }, - { 186043, true }, - { 186056, true }, - { 186071, true }, - { 186090, true }, - { 186114, true }, - { 186127, true }, - { 186142, true }, - { 186166, true }, - { 186176, true }, - { 186188, true }, - { 186204, true }, - { 186225, true }, - { 186240, false }, - { 186263, true }, - { 186284, true }, - { 186297, true }, - { 186310, true }, + { 186036, true }, + { 186044, true }, + { 186050, true }, + { 186061, true }, + { 186076, true }, + { 186089, true }, + { 186104, true }, + { 186123, true }, + { 186147, true }, + { 186160, true }, + { 186175, true }, + { 186199, true }, + { 186209, true }, + { 186221, true }, + { 186242, true }, + { 186257, false }, + { 186280, true }, + { 186301, true }, + { 186314, true }, { 186327, true }, - { 186341, true }, - { 186353, true }, - { 186372, true }, - { 186390, true }, - { 186414, false }, - { 186441, true }, - { 186467, true }, - { 186482, true }, + { 186344, true }, + { 186358, true }, + { 186370, true }, + { 186389, true }, + { 186407, true }, + { 186431, false }, + { 186458, true }, + { 186484, true }, { 186499, true }, - { 186515, true }, + { 186516, true }, { 186532, true }, { 186549, true }, - { 186564, true }, - { 186577, true }, - { 186588, true }, - { 186599, true }, - { 186610, true }, - { 186620, true }, - { 186633, true }, - { 186651, true }, - { 186664, true }, - { 186678, true }, - { 186688, true }, - { 186699, true }, - { 186708, true }, - { 186729, true }, - { 186743, true }, - { 186752, true }, - { 186759, true }, - { 186766, true }, - { 186774, true }, - { 186797, true }, - { 186810, true }, - { 186824, true }, - { 186837, true }, - { 186852, true }, - { 186867, true }, - { 186876, true }, - { 186884, true }, - { 186897, true }, - { 186905, true }, - { 186923, true }, - { 186935, true }, - { 186956, true }, - { 186972, true }, - { 186981, true }, - { 186994, true }, - { 187005, true }, - { 187017, true }, - { 187032, true }, - { 187041, true }, - { 187053, true }, - { 187064, true }, - { 187076, true }, - { 187089, true }, - { 187102, true }, - { 187117, true }, - { 187137, true }, - { 187149, true }, - { 187166, true }, - { 187176, true }, - { 187183, true }, - { 187193, true }, - { 187205, true }, - { 187221, true }, - { 187236, true }, - { 187245, true }, - { 187259, true }, - { 187279, true }, - { 187291, true }, - { 187304, true }, - { 187318, true }, - { 187336, true }, - { 187343, true }, - { 187360, true }, - { 187377, true }, - { 187397, true }, - { 187416, true }, - { 187432, false }, - { 187450, true }, - { 187477, true }, - { 187494, true }, - { 187508, true }, - { 187522, true }, - { 187538, true }, - { 187553, false }, - { 187572, true }, - { 187590, true }, - { 187608, true }, - { 187626, true }, - { 187643, true }, - { 187664, true }, - { 187683, true }, - { 187697, true }, - { 187708, true }, - { 187721, true }, - { 187729, true }, - { 187739, true }, - { 187754, true }, - { 187769, true }, - { 187780, true }, - { 187802, true }, - { 187815, true }, - { 187830, true }, - { 187849, true }, - { 187875, true }, - { 187891, true }, - { 187909, true }, - { 187927, true }, - { 187942, true }, - { 187950, true }, - { 187963, true }, - { 187971, true }, - { 187982, true }, - { 187996, true }, - { 188010, true }, - { 188021, true }, - { 188037, true }, - { 188054, true }, - { 188064, true }, - { 188077, true }, - { 188095, true }, - { 188108, true }, - { 188127, false }, - { 188137, true }, - { 188153, true }, - { 188170, true }, - { 188186, true }, - { 188209, true }, - { 188234, true }, - { 188247, true }, - { 188258, true }, - { 188273, true }, - { 188285, true }, - { 188303, true }, - { 188328, true }, - { 188340, true }, - { 188352, true }, - { 188364, true }, - { 188375, true }, - { 188387, true }, - { 188405, true }, - { 188426, true }, - { 188442, true }, - { 188454, true }, - { 188468, true }, - { 188483, true }, - { 188496, true }, - { 188512, true }, - { 188526, true }, - { 188544, true }, - { 188558, true }, - { 188568, false }, - { 188579, true }, - { 188587, false }, - { 188599, true }, - { 188616, true }, - { 188626, true }, - { 188637, true }, - { 188644, true }, - { 188655, true }, - { 188672, true }, - { 188689, true }, - { 188709, true }, - { 188720, true }, - { 188729, true }, - { 188736, true }, - { 188746, true }, + { 186566, true }, + { 186581, true }, + { 186594, true }, + { 186605, true }, + { 186616, true }, + { 186626, true }, + { 186639, true }, + { 186657, true }, + { 186670, true }, + { 186684, true }, + { 186694, true }, + { 186705, true }, + { 186714, true }, + { 186735, true }, + { 186749, true }, + { 186758, true }, + { 186765, true }, + { 186772, true }, + { 186780, true }, + { 186803, true }, + { 186816, true }, + { 186830, true }, + { 186843, true }, + { 186858, true }, + { 186873, true }, + { 186882, true }, + { 186890, true }, + { 186903, true }, + { 186911, true }, + { 186929, true }, + { 186941, true }, + { 186962, true }, + { 186978, true }, + { 186987, true }, + { 187000, true }, + { 187011, true }, + { 187023, true }, + { 187038, true }, + { 187047, true }, + { 187059, true }, + { 187070, true }, + { 187082, true }, + { 187095, true }, + { 187108, true }, + { 187123, true }, + { 187143, true }, + { 187155, true }, + { 187172, true }, + { 187182, true }, + { 187189, true }, + { 187199, true }, + { 187211, true }, + { 187227, true }, + { 187242, true }, + { 187251, true }, + { 187265, true }, + { 187285, true }, + { 187297, true }, + { 187310, true }, + { 187324, true }, + { 187342, true }, + { 187349, true }, + { 187366, true }, + { 187383, true }, + { 187403, true }, + { 187422, true }, + { 187438, false }, + { 187456, true }, + { 187483, true }, + { 187500, true }, + { 187514, true }, + { 187528, true }, + { 187544, true }, + { 187559, false }, + { 187578, true }, + { 187596, true }, + { 187614, true }, + { 187632, true }, + { 187649, true }, + { 187670, true }, + { 187689, true }, + { 187703, true }, + { 187714, true }, + { 187727, true }, + { 187735, true }, + { 187745, true }, + { 187760, true }, + { 187775, true }, + { 187786, true }, + { 187808, true }, + { 187821, true }, + { 187836, true }, + { 187855, true }, + { 187881, true }, + { 187897, true }, + { 187915, true }, + { 187933, true }, + { 187948, true }, + { 187956, true }, + { 187969, true }, + { 187977, true }, + { 187988, true }, + { 188002, true }, + { 188016, true }, + { 188027, true }, + { 188043, true }, + { 188060, true }, + { 188070, true }, + { 188083, true }, + { 188101, true }, + { 188114, true }, + { 188133, false }, + { 188143, true }, + { 188159, true }, + { 188176, true }, + { 188192, true }, + { 188215, true }, + { 188240, true }, + { 188253, true }, + { 188264, true }, + { 188279, true }, + { 188291, true }, + { 188309, true }, + { 188334, true }, + { 188346, true }, + { 188358, true }, + { 188370, true }, + { 188381, true }, + { 188393, true }, + { 188411, true }, + { 188432, true }, + { 188448, true }, + { 188460, true }, + { 188474, true }, + { 188489, true }, + { 188502, true }, + { 188518, true }, + { 188532, true }, + { 188550, true }, + { 188564, true }, + { 188574, false }, + { 188585, true }, + { 188593, false }, + { 188605, true }, + { 188622, true }, + { 188632, true }, + { 188643, true }, + { 188650, true }, + { 188661, true }, + { 188678, true }, + { 188695, true }, + { 188715, true }, + { 188730, true }, + { 188741, true }, + { 188750, false }, { 188757, true }, - { 188773, true }, - { 188782, true }, - { 188797, true }, - { 188807, true }, + { 188767, true }, + { 188778, true }, + { 188794, true }, + { 188803, true }, + { 188818, true }, { 188828, true }, - { 188837, true }, - { 188855, true }, - { 188871, false }, - { 188884, true }, - { 188900, true }, - { 188912, true }, - { 188924, true }, - { 188944, true }, - { 188958, true }, - { 188974, true }, - { 188988, true }, - { 189003, true }, - { 189011, true }, + { 188849, true }, + { 188858, true }, + { 188876, true }, + { 188892, false }, + { 188905, true }, + { 188921, true }, + { 188933, true }, + { 188945, true }, + { 188965, true }, + { 188979, true }, + { 188995, true }, + { 189009, true }, { 189024, true }, - { 189040, true }, - { 189053, true }, - { 189066, true }, - { 189080, true }, - { 189102, true }, - { 189122, true }, + { 189032, true }, + { 189045, true }, + { 189061, true }, + { 189074, true }, + { 189087, true }, + { 189101, true }, + { 189123, true }, { 189143, true }, - { 189162, true }, - { 189178, true }, - { 189206, true }, - { 189223, true }, - { 189242, true }, - { 189266, true }, - { 189276, true }, - { 189285, true }, - { 189298, true }, - { 189307, true }, - { 189313, true }, - { 189325, true }, - { 189342, true }, - { 189356, true }, - { 189375, true }, - { 189389, true }, - { 189403, false }, - { 189416, true }, - { 189429, true }, - { 189442, true }, - { 189460, true }, + { 189164, true }, + { 189183, true }, + { 189199, true }, + { 189227, true }, + { 189244, true }, + { 189263, true }, + { 189287, true }, + { 189297, true }, + { 189306, true }, + { 189319, true }, + { 189328, true }, + { 189334, true }, + { 189346, true }, + { 189363, true }, + { 189377, true }, + { 189396, true }, + { 189410, true }, + { 189424, false }, + { 189437, true }, + { 189450, true }, + { 189463, true }, { 189481, true }, - { 189507, true }, - { 189520, true }, - { 189530, true }, - { 189549, true }, - { 189568, true }, - { 189585, true }, - { 189605, true }, - { 189621, true }, - { 189641, true }, - { 189650, true }, - { 189661, true }, - { 189670, true }, - { 189689, false }, - { 189705, false }, - { 189718, false }, - { 189731, true }, - { 189742, true }, - { 189757, true }, - { 189768, true }, - { 189787, true }, - { 189800, true }, - { 189812, true }, - { 189825, true }, - { 189840, true }, - { 189849, true }, - { 189862, true }, - { 189877, true }, - { 189893, true }, - { 189907, true }, - { 189924, true }, - { 189933, true }, - { 189947, true }, - { 189971, true }, - { 189986, true }, - { 190002, true }, - { 190020, true }, - { 190037, true }, - { 190052, true }, - { 190070, true }, - { 190086, true }, - { 190099, true }, - { 190108, true }, - { 190121, true }, - { 190141, true }, - { 190152, true }, - { 190166, true }, - { 190175, true }, - { 190184, true }, - { 190202, true }, - { 190216, true }, - { 190231, true }, - { 190251, true }, - { 190268, true }, - { 190285, true }, - { 190301, true }, - { 190313, true }, - { 190327, true }, - { 190341, true }, + { 189502, true }, + { 189528, true }, + { 189541, true }, + { 189551, true }, + { 189570, true }, + { 189589, true }, + { 189606, true }, + { 189626, true }, + { 189642, true }, + { 189662, true }, + { 189671, true }, + { 189682, true }, + { 189691, true }, + { 189710, false }, + { 189726, false }, + { 189739, false }, + { 189752, true }, + { 189763, true }, + { 189778, true }, + { 189789, true }, + { 189808, true }, + { 189821, true }, + { 189833, true }, + { 189846, true }, + { 189861, true }, + { 189870, true }, + { 189883, true }, + { 189898, true }, + { 189914, true }, + { 189928, true }, + { 189945, true }, + { 189954, true }, + { 189968, true }, + { 189992, true }, + { 190007, true }, + { 190023, true }, + { 190041, true }, + { 190058, true }, + { 190073, true }, + { 190091, true }, + { 190107, true }, + { 190120, true }, + { 190129, true }, + { 190142, true }, + { 190162, true }, + { 190173, true }, + { 190187, true }, + { 190196, true }, + { 190205, true }, + { 190223, true }, + { 190237, true }, + { 190252, true }, + { 190272, true }, + { 190289, true }, + { 190306, true }, + { 190322, true }, + { 190334, true }, + { 190348, true }, { 190362, true }, - { 190387, false }, - { 190403, true }, - { 190422, true }, - { 190437, true }, - { 190447, true }, - { 190471, true }, - { 190483, true }, - { 190494, true }, - { 190507, true }, - { 190521, true }, - { 190530, true }, - { 190559, true }, - { 190584, true }, - { 190609, true }, - { 190638, true }, - { 190650, true }, - { 190666, true }, - { 190675, true }, + { 190383, true }, + { 190408, false }, + { 190424, true }, + { 190443, true }, + { 190458, true }, + { 190468, true }, + { 190492, true }, + { 190504, true }, + { 190515, true }, + { 190528, true }, + { 190542, true }, + { 190551, true }, + { 190580, true }, + { 190605, true }, + { 190630, true }, + { 190659, true }, + { 190671, true }, { 190687, true }, - { 190701, true }, - { 190715, true }, - { 190729, true }, - { 190742, true }, - { 190761, true }, - { 190774, true }, - { 190791, true }, - { 190800, true }, - { 190815, true }, - { 190833, true }, - { 190847, false }, - { 190858, true }, - { 190871, true }, - { 190891, false }, - { 190904, true }, - { 190914, true }, - { 190933, true }, - { 190946, true }, - { 190958, true }, - { 190980, true }, - { 190991, true }, - { 191002, true }, - { 191013, true }, + { 190696, true }, + { 190708, true }, + { 190722, true }, + { 190736, true }, + { 190750, true }, + { 190763, true }, + { 190782, true }, + { 190795, true }, + { 190812, true }, + { 190821, true }, + { 190836, true }, + { 190854, true }, + { 190868, false }, + { 190879, true }, + { 190892, true }, + { 190912, false }, + { 190925, true }, + { 190935, true }, + { 190954, true }, + { 190967, true }, + { 190979, true }, + { 191001, true }, + { 191012, true }, { 191023, true }, - { 191033, true }, - { 191042, true }, - { 191050, true }, - { 191056, false }, - { 191064, true }, - { 191073, true }, - { 191082, true }, - { 191090, true }, - { 191100, true }, - { 191108, true }, - { 191127, true }, - { 191134, true }, - { 191159, true }, - { 191166, true }, - { 191179, true }, - { 191193, true }, - { 191203, true }, - { 191213, true }, - { 191232, true }, - { 191244, true }, - { 191259, true }, - { 191270, true }, - { 191282, true }, - { 191290, true }, + { 191034, true }, + { 191044, true }, + { 191054, true }, + { 191063, true }, + { 191071, true }, + { 191077, false }, + { 191085, true }, + { 191094, true }, + { 191103, true }, + { 191111, true }, + { 191121, true }, + { 191129, true }, + { 191148, true }, + { 191155, true }, + { 191180, true }, + { 191187, true }, + { 191200, true }, + { 191214, true }, + { 191224, true }, + { 191234, true }, + { 191253, true }, + { 191265, true }, + { 191280, true }, + { 191291, true }, { 191303, true }, - { 191315, true }, - { 191334, true }, - { 191345, true }, - { 191372, true }, - { 191383, false }, - { 191394, true }, - { 191409, true }, - { 191425, true }, - { 191447, true }, - { 191461, true }, - { 191474, true }, - { 191487, true }, - { 191506, true }, - { 191535, true }, - { 191551, true }, - { 191564, true }, - { 191584, false }, - { 191611, false }, - { 191627, true }, - { 191643, true }, - { 191658, true }, - { 191674, true }, - { 191692, true }, - { 191711, true }, - { 191720, true }, - { 191733, true }, - { 191750, true }, - { 191769, true }, - { 191782, true }, - { 191798, true }, - { 191816, true }, + { 191311, true }, + { 191324, true }, + { 191336, true }, + { 191355, true }, + { 191366, true }, + { 191393, true }, + { 191404, false }, + { 191415, true }, + { 191430, true }, + { 191446, true }, + { 191468, true }, + { 191482, true }, + { 191495, true }, + { 191508, true }, + { 191527, true }, + { 191556, true }, + { 191572, true }, + { 191585, true }, + { 191605, false }, + { 191632, false }, + { 191648, true }, + { 191664, true }, + { 191679, true }, + { 191695, true }, + { 191713, true }, + { 191732, true }, + { 191741, true }, + { 191754, true }, + { 191771, true }, + { 191790, true }, + { 191803, true }, + { 191819, true }, { 191837, true }, - { 191850, true }, - { 191869, true }, - { 191896, true }, - { 191913, true }, - { 191927, true }, - { 191945, true }, - { 191963, true }, - { 191979, true }, - { 191997, true }, - { 192010, true }, - { 192026, true }, + { 191858, true }, + { 191871, true }, + { 191890, true }, + { 191917, true }, + { 191934, true }, + { 191948, true }, + { 191966, true }, + { 191984, true }, + { 192000, true }, + { 192018, true }, + { 192031, true }, { 192047, true }, - { 192057, true }, - { 192070, true }, - { 192079, true }, - { 192090, true }, + { 192068, true }, + { 192078, true }, + { 192091, true }, { 192100, true }, - { 192113, true }, - { 192126, true }, - { 192142, true }, - { 192155, true }, - { 192169, true }, - { 192184, true }, - { 192198, true }, - { 192213, true }, - { 192225, true }, - { 192242, true }, - { 192258, true }, - { 192277, true }, - { 192293, true }, - { 192306, true }, - { 192321, true }, - { 192330, true }, - { 192340, true }, - { 192368, true }, - { 192380, false }, - { 192397, true }, - { 192415, true }, - { 192439, true }, - { 192463, true }, - { 192482, true }, - { 192496, true }, - { 192504, true }, - { 192515, true }, - { 192529, true }, - { 192541, true }, + { 192111, true }, + { 192121, true }, + { 192134, true }, + { 192147, true }, + { 192163, true }, + { 192176, true }, + { 192190, true }, + { 192205, true }, + { 192219, true }, + { 192234, true }, + { 192246, true }, + { 192263, true }, + { 192279, true }, + { 192298, true }, + { 192314, true }, + { 192327, true }, + { 192342, true }, + { 192351, true }, + { 192361, true }, + { 192389, true }, + { 192401, false }, + { 192418, true }, + { 192436, true }, + { 192460, true }, + { 192484, true }, + { 192503, true }, + { 192517, true }, + { 192525, true }, + { 192536, true }, { 192550, true }, - { 192560, true }, - { 192580, true }, - { 192594, true }, - { 192607, true }, - { 192627, true }, - { 192645, true }, - { 192657, true }, - { 192672, true }, - { 192687, true }, - { 192698, true }, - { 192723, true }, - { 192738, false }, - { 192755, true }, - { 192767, false }, - { 192790, true }, - { 192809, true }, - { 192826, true }, - { 192843, true }, - { 192856, true }, - { 192867, true }, - { 192889, true }, - { 192912, true }, - { 192930, true }, + { 192562, true }, + { 192571, true }, + { 192581, true }, + { 192601, true }, + { 192615, true }, + { 192628, true }, + { 192648, true }, + { 192666, true }, + { 192678, true }, + { 192693, true }, + { 192708, true }, + { 192719, true }, + { 192744, true }, + { 192759, false }, + { 192776, true }, + { 192788, false }, + { 192811, true }, + { 192830, true }, + { 192847, true }, + { 192864, true }, + { 192877, true }, + { 192888, true }, + { 192910, true }, + { 192933, true }, { 192951, true }, - { 192973, true }, + { 192972, true }, { 192994, true }, { 193015, true }, - { 193025, false }, - { 193039, true }, - { 193056, true }, - { 193076, true }, - { 193093, true }, - { 193103, true }, - { 193116, true }, - { 193131, true }, - { 193149, true }, - { 193160, true }, - { 193177, true }, - { 193193, true }, - { 193205, true }, - { 193242, true }, - { 193261, true }, - { 193275, true }, - { 193290, true }, - { 193305, false }, - { 193317, true }, - { 193334, false }, - { 193351, true }, - { 193364, true }, - { 193385, false }, - { 193397, false }, - { 193414, true }, - { 193431, true }, - { 193448, true }, - { 193461, true }, - { 193477, true }, - { 193493, true }, - { 193509, true }, - { 193522, true }, - { 193540, true }, - { 193550, true }, + { 193036, true }, + { 193046, false }, + { 193060, true }, + { 193077, true }, + { 193097, true }, + { 193114, true }, + { 193124, true }, + { 193137, true }, + { 193152, true }, + { 193170, true }, + { 193181, true }, + { 193198, true }, + { 193214, true }, + { 193226, true }, + { 193263, true }, + { 193282, true }, + { 193296, true }, + { 193311, true }, + { 193326, false }, + { 193338, true }, + { 193355, false }, + { 193372, true }, + { 193385, true }, + { 193406, false }, + { 193418, false }, + { 193435, true }, + { 193452, true }, + { 193469, true }, + { 193482, true }, + { 193498, true }, + { 193514, true }, + { 193530, true }, + { 193543, true }, { 193561, true }, - { 193577, true }, - { 193587, true }, - { 193606, true }, - { 193619, true }, - { 193636, true }, - { 193650, true }, - { 193665, true }, - { 193676, true }, - { 193696, true }, - { 193709, true }, - { 193722, true }, - { 193734, true }, - { 193753, true }, - { 193766, true }, - { 193781, true }, - { 193792, true }, - { 193803, true }, + { 193571, true }, + { 193582, true }, + { 193598, true }, + { 193608, true }, + { 193627, true }, + { 193640, true }, + { 193657, true }, + { 193671, true }, + { 193686, true }, + { 193697, true }, + { 193717, true }, + { 193730, true }, + { 193743, true }, + { 193755, true }, + { 193774, true }, + { 193787, true }, + { 193802, true }, { 193813, true }, - { 193823, true }, - { 193845, true }, - { 193865, true }, - { 193882, true }, - { 193900, true }, - { 193913, true }, - { 193926, true }, - { 193941, true }, - { 193950, true }, - { 193961, true }, - { 193976, true }, - { 193992, true }, - { 194014, true }, - { 194030, true }, - { 194046, true }, - { 194070, true }, - { 194085, true }, - { 194098, true }, - { 194117, true }, - { 194127, true }, - { 194141, true }, - { 194152, true }, - { 194169, true }, - { 194181, true }, - { 194194, true }, - { 194211, true }, - { 194223, true }, - { 194240, true }, - { 194249, true }, - { 194269, true }, - { 194289, true }, - { 194306, true }, - { 194321, true }, - { 194347, true }, - { 194365, true }, - { 194375, true }, - { 194392, true }, - { 194404, true }, - { 194421, true }, - { 194436, true }, - { 194455, true }, - { 194472, true }, - { 194489, true }, - { 194500, true }, - { 194512, true }, - { 194524, true }, - { 194534, true }, - { 194543, true }, - { 194556, true }, - { 194571, true }, - { 194581, true }, - { 194593, true }, - { 194607, false }, - { 194616, true }, - { 194627, true }, - { 194644, true }, - { 194654, true }, - { 194664, true }, + { 193824, true }, + { 193834, true }, + { 193844, true }, + { 193866, true }, + { 193886, true }, + { 193903, true }, + { 193921, true }, + { 193934, true }, + { 193947, true }, + { 193962, true }, + { 193971, true }, + { 193982, true }, + { 193997, true }, + { 194013, true }, + { 194035, true }, + { 194051, true }, + { 194067, true }, + { 194091, true }, + { 194106, true }, + { 194119, true }, + { 194138, true }, + { 194148, true }, + { 194162, true }, + { 194173, true }, + { 194190, true }, + { 194202, true }, + { 194215, true }, + { 194232, true }, + { 194244, true }, + { 194261, true }, + { 194270, true }, + { 194290, true }, + { 194310, true }, + { 194327, true }, + { 194342, true }, + { 194368, true }, + { 194386, true }, + { 194396, true }, + { 194413, true }, + { 194425, true }, + { 194442, true }, + { 194457, true }, + { 194476, true }, + { 194493, true }, + { 194510, true }, + { 194521, true }, + { 194533, true }, + { 194545, true }, + { 194555, true }, + { 194564, true }, + { 194577, true }, + { 194592, true }, + { 194602, true }, + { 194614, true }, + { 194628, false }, + { 194637, true }, + { 194648, true }, + { 194665, true }, { 194675, true }, - { 194684, true }, - { 194695, false }, - { 194708, true }, - { 194724, true }, - { 194736, true }, - { 194747, true }, - { 194761, false }, - { 194772, true }, - { 194795, true }, - { 194817, true }, - { 194825, true }, - { 194835, true }, - { 194847, true }, - { 194860, true }, + { 194685, true }, + { 194696, true }, + { 194705, true }, + { 194716, false }, + { 194729, true }, + { 194745, true }, + { 194757, true }, + { 194768, true }, + { 194782, false }, + { 194793, true }, + { 194816, true }, + { 194838, true }, + { 194846, true }, + { 194856, true }, { 194868, true }, - { 194876, true }, - { 194891, true }, - { 194901, true }, - { 194917, true }, - { 194930, true }, - { 194939, true }, - { 194954, true }, - { 194963, true }, - { 194972, true }, - { 194981, true }, - { 195000, true }, - { 195013, true }, - { 195028, true }, - { 195050, true }, - { 195066, false }, - { 195078, true }, - { 195094, true }, - { 195107, true }, - { 195118, true }, - { 195130, true }, - { 195138, true }, - { 195152, true }, - { 195169, true }, - { 195182, true }, - { 195198, true }, + { 194881, true }, + { 194889, true }, + { 194897, true }, + { 194912, true }, + { 194922, true }, + { 194938, true }, + { 194951, true }, + { 194960, true }, + { 194975, true }, + { 194984, true }, + { 194993, true }, + { 195002, true }, + { 195021, true }, + { 195034, true }, + { 195049, true }, + { 195071, true }, + { 195087, false }, + { 195099, true }, + { 195115, true }, + { 195128, true }, + { 195139, true }, + { 195151, true }, + { 195159, true }, + { 195173, true }, + { 195190, true }, + { 195203, true }, { 195219, true }, - { 195238, true }, - { 195255, true }, - { 195271, true }, - { 195284, true }, - { 195295, true }, - { 195309, true }, - { 195329, true }, - { 195353, true }, - { 195376, true }, - { 195387, true }, - { 195409, false }, - { 195422, true }, - { 195436, true }, - { 195450, false }, - { 195471, true }, - { 195481, true }, - { 195493, true }, - { 195505, true }, - { 195517, true }, - { 195536, true }, - { 195562, true }, - { 195575, true }, - { 195589, true }, - { 195606, true }, - { 195625, true }, - { 195642, true }, - { 195660, true }, - { 195675, true }, + { 195240, true }, + { 195259, true }, + { 195276, true }, + { 195292, true }, + { 195305, true }, + { 195316, true }, + { 195330, true }, + { 195350, true }, + { 195374, true }, + { 195397, true }, + { 195408, true }, + { 195430, false }, + { 195443, true }, + { 195457, true }, + { 195471, false }, + { 195492, true }, + { 195502, true }, + { 195514, true }, + { 195526, true }, + { 195538, true }, + { 195557, true }, + { 195583, true }, + { 195596, true }, + { 195610, true }, + { 195627, true }, + { 195646, true }, + { 195663, true }, + { 195681, true }, { 195696, true }, - { 195710, true }, - { 195732, true }, - { 195751, true }, - { 195763, true }, - { 195776, true }, - { 195788, true }, - { 195812, true }, - { 195822, true }, - { 195835, true }, - { 195850, true }, - { 195867, true }, - { 195883, true }, - { 195901, true }, - { 195920, true }, - { 195937, true }, - { 195952, true }, - { 195968, true }, - { 195995, true }, - { 196009, true }, - { 196025, true }, - { 196040, true }, - { 196053, true }, - { 196062, true }, - { 196078, true }, - { 196093, true }, - { 196106, true }, - { 196119, true }, - { 196135, true }, - { 196147, true }, - { 196164, true }, - { 196179, true }, - { 196190, true }, - { 196202, true }, - { 196218, true }, - { 196241, true }, - { 196256, true }, - { 196266, true }, - { 196280, true }, - { 196289, true }, - { 196296, true }, - { 196310, true }, - { 196330, true }, - { 196341, true }, - { 196355, true }, - { 196368, false }, - { 196382, true }, + { 195717, true }, + { 195731, true }, + { 195753, true }, + { 195772, true }, + { 195784, true }, + { 195797, true }, + { 195809, true }, + { 195833, true }, + { 195843, true }, + { 195858, true }, + { 195875, true }, + { 195891, true }, + { 195909, true }, + { 195928, true }, + { 195945, true }, + { 195960, true }, + { 195976, true }, + { 196003, true }, + { 196017, true }, + { 196033, true }, + { 196048, true }, + { 196061, true }, + { 196070, true }, + { 196086, true }, + { 196101, true }, + { 196114, true }, + { 196127, true }, + { 196143, true }, + { 196155, true }, + { 196172, true }, + { 196187, true }, + { 196198, true }, + { 196210, true }, + { 196226, true }, + { 196249, true }, + { 196264, true }, + { 196274, true }, + { 196288, true }, + { 196297, true }, + { 196304, true }, + { 196318, true }, + { 196338, true }, + { 196349, true }, + { 196363, true }, + { 196376, false }, { 196390, true }, - { 196401, true }, - { 196419, true }, - { 196429, true }, - { 196446, true }, - { 196456, true }, - { 196467, true }, - { 196492, true }, - { 196506, true }, - { 196517, true }, - { 196528, true }, - { 196543, true }, - { 196558, true }, - { 196574, false }, - { 196585, true }, - { 196600, true }, - { 196615, false }, - { 196634, true }, - { 196645, true }, - { 196655, true }, - { 196666, true }, - { 196686, true }, - { 196697, true }, - { 196704, true }, - { 196716, true }, - { 196729, true }, - { 196747, false }, - { 196757, true }, - { 196766, true }, - { 196776, true }, - { 196787, true }, - { 196798, true }, - { 196810, true }, - { 196821, true }, + { 196398, true }, + { 196409, true }, + { 196427, true }, + { 196437, true }, + { 196454, true }, + { 196464, true }, + { 196475, true }, + { 196500, true }, + { 196514, true }, + { 196525, true }, + { 196536, true }, + { 196551, true }, + { 196566, true }, + { 196582, false }, + { 196593, true }, + { 196608, true }, + { 196623, false }, + { 196642, true }, + { 196653, true }, + { 196663, true }, + { 196674, true }, + { 196694, true }, + { 196705, true }, + { 196712, true }, + { 196724, true }, + { 196737, true }, + { 196755, false }, + { 196765, true }, + { 196774, true }, + { 196784, true }, + { 196795, true }, + { 196806, true }, + { 196818, true }, { 196829, true }, - { 196839, true }, - { 196856, true }, - { 196873, true }, - { 196882, true }, - { 196889, true }, - { 196908, true }, - { 196919, true }, - { 196938, false }, - { 196949, true }, - { 196966, true }, - { 196983, true }, - { 196996, true }, - { 197012, true }, - { 197023, true }, - { 197033, true }, - { 197044, true }, - { 197061, true }, - { 197078, false }, - { 197086, true }, - { 197095, false }, - { 197108, true }, - { 197119, false }, - { 197126, true }, - { 197136, true }, - { 197150, true }, - { 197159, true }, - { 197173, true }, - { 197193, false }, - { 197205, false }, - { 197221, true }, - { 197233, true }, - { 197252, true }, - { 197262, true }, - { 197286, true }, + { 196837, true }, + { 196847, true }, + { 196864, true }, + { 196881, true }, + { 196890, true }, + { 196897, true }, + { 196916, true }, + { 196927, true }, + { 196946, false }, + { 196957, true }, + { 196974, true }, + { 196991, true }, + { 197004, true }, + { 197020, true }, + { 197031, true }, + { 197041, true }, + { 197052, true }, + { 197069, true }, + { 197086, false }, + { 197094, true }, + { 197103, false }, + { 197116, true }, + { 197127, false }, + { 197134, true }, + { 197144, true }, + { 197158, true }, + { 197167, true }, + { 197181, true }, + { 197201, false }, + { 197213, false }, + { 197229, true }, + { 197241, true }, + { 197260, true }, + { 197270, true }, { 197294, true }, - { 197311, true }, - { 197327, true }, - { 197343, true }, - { 197356, true }, - { 197365, true }, - { 197377, true }, - { 197390, true }, - { 197405, true }, - { 197419, true }, - { 197435, false }, - { 197450, true }, - { 197459, true }, - { 197479, true }, + { 197302, true }, + { 197319, true }, + { 197335, true }, + { 197351, true }, + { 197364, true }, + { 197373, true }, + { 197385, true }, + { 197398, true }, + { 197413, true }, + { 197427, true }, + { 197443, false }, + { 197458, true }, + { 197467, true }, { 197487, true }, - { 197501, true }, - { 197514, true }, - { 197525, true }, - { 197535, false }, - { 197545, true }, - { 197559, true }, - { 197571, true }, - { 197581, false }, - { 197594, true }, - { 197610, true }, - { 197632, true }, - { 197649, true }, - { 197662, true }, - { 197671, true }, - { 197680, true }, - { 197695, true }, - { 197709, true }, - { 197719, true }, - { 197729, true }, - { 197758, true }, - { 197779, true }, - { 197794, true }, - { 197808, true }, - { 197828, true }, - { 197844, true }, - { 197856, false }, - { 197872, true }, - { 197886, true }, - { 197901, true }, - { 197916, true }, - { 197930, true }, - { 197943, true }, - { 197954, true }, - { 197965, true }, - { 197981, true }, - { 197991, true }, - { 198015, false }, - { 198034, false }, - { 198046, true }, - { 198062, true }, - { 198090, true }, - { 198122, true }, - { 198137, true }, - { 198149, true }, - { 198160, true }, - { 198169, true }, - { 198183, false }, - { 198196, true }, - { 198214, true }, + { 197495, true }, + { 197509, true }, + { 197522, true }, + { 197533, true }, + { 197543, false }, + { 197553, true }, + { 197567, true }, + { 197579, true }, + { 197589, false }, + { 197602, true }, + { 197618, true }, + { 197640, true }, + { 197657, true }, + { 197670, true }, + { 197679, true }, + { 197688, true }, + { 197703, true }, + { 197717, true }, + { 197727, true }, + { 197737, true }, + { 197766, true }, + { 197787, true }, + { 197802, true }, + { 197816, true }, + { 197836, true }, + { 197852, true }, + { 197864, false }, + { 197880, true }, + { 197894, true }, + { 197909, true }, + { 197924, true }, + { 197938, true }, + { 197951, true }, + { 197962, true }, + { 197973, true }, + { 197989, true }, + { 197999, true }, + { 198023, false }, + { 198042, false }, + { 198054, true }, + { 198070, true }, + { 198098, true }, + { 198130, true }, + { 198145, true }, + { 198157, true }, + { 198168, true }, + { 198177, true }, + { 198191, false }, + { 198204, true }, { 198222, true }, - { 198236, true }, - { 198250, true }, - { 198262, true }, - { 198283, true }, - { 198298, true }, - { 198314, false }, + { 198230, true }, + { 198244, true }, + { 198258, true }, + { 198270, true }, + { 198291, true }, + { 198306, true }, { 198322, false }, - { 198334, true }, - { 198343, true }, - { 198353, true }, - { 198364, true }, - { 198376, true }, - { 198392, true }, - { 198408, true }, - { 198418, true }, - { 198429, true }, - { 198440, true }, - { 198452, true }, - { 198462, true }, - { 198471, true }, - { 198490, true }, - { 198518, true }, - { 198532, true }, - { 198546, true }, - { 198564, true }, - { 198581, true }, - { 198597, true }, - { 198608, true }, - { 198623, true }, - { 198636, false }, - { 198652, true }, - { 198668, true }, - { 198681, true }, - { 198699, true }, - { 198717, true }, - { 198731, true }, - { 198746, true }, + { 198330, false }, + { 198342, true }, + { 198351, true }, + { 198361, true }, + { 198372, true }, + { 198384, true }, + { 198400, true }, + { 198416, true }, + { 198426, true }, + { 198437, true }, + { 198448, true }, + { 198460, true }, + { 198470, true }, + { 198479, true }, + { 198498, true }, + { 198526, true }, + { 198540, true }, + { 198554, true }, + { 198572, true }, + { 198589, true }, + { 198605, true }, + { 198616, true }, + { 198631, true }, + { 198644, false }, + { 198660, true }, + { 198676, true }, + { 198689, true }, + { 198707, true }, + { 198725, true }, + { 198739, true }, + { 198751, true }, { 198766, true }, - { 198785, true }, - { 198804, true }, - { 198817, true }, - { 198833, true }, - { 198846, true }, - { 198861, true }, - { 198877, true }, - { 198894, true }, - { 198910, true }, - { 198927, true }, - { 198940, true }, - { 198955, true }, - { 198974, true }, - { 198987, true }, - { 199003, true }, - { 199014, true }, - { 199027, true }, - { 199041, true }, - { 199055, false }, - { 199071, true }, - { 199090, true }, + { 198786, true }, + { 198805, true }, + { 198824, true }, + { 198837, true }, + { 198853, true }, + { 198866, true }, + { 198881, true }, + { 198897, true }, + { 198914, true }, + { 198930, true }, + { 198947, true }, + { 198960, true }, + { 198975, true }, + { 198994, true }, + { 199007, true }, + { 199023, true }, + { 199034, true }, + { 199047, true }, + { 199061, true }, + { 199075, false }, + { 199091, true }, { 199110, true }, - { 199130, false }, - { 199146, true }, - { 199162, true }, - { 199177, true }, - { 199194, true }, - { 199215, true }, - { 199232, true }, - { 199250, false }, - { 199269, true }, - { 199280, true }, - { 199296, true }, - { 199310, true }, - { 199326, true }, - { 199339, true }, - { 199353, true }, - { 199366, true }, - { 199379, true }, - { 199395, true }, - { 199406, true }, - { 199414, true }, - { 199423, true }, - { 199433, true }, - { 199444, true }, + { 199130, true }, + { 199150, false }, + { 199166, true }, + { 199182, true }, + { 199197, true }, + { 199214, true }, + { 199235, true }, + { 199252, true }, + { 199270, false }, + { 199289, true }, + { 199300, true }, + { 199316, true }, + { 199330, true }, + { 199346, true }, + { 199359, true }, + { 199373, true }, + { 199386, true }, + { 199399, true }, + { 199415, true }, + { 199426, true }, + { 199435, true }, + { 199445, true }, { 199456, true }, - { 199470, true }, - { 199479, true }, - { 199496, true }, - { 199505, true }, - { 199518, true }, - { 199537, true }, - { 199558, true }, - { 199577, true }, - { 199594, false }, - { 199609, false }, - { 199625, false }, - { 199637, true }, - { 199657, true }, - { 199670, true }, - { 199690, true }, - { 199712, true }, - { 199735, true }, - { 199753, true }, - { 199769, true }, + { 199468, true }, + { 199482, true }, + { 199491, true }, + { 199508, true }, + { 199517, true }, + { 199530, true }, + { 199549, true }, + { 199570, true }, + { 199589, true }, + { 199606, false }, + { 199621, false }, + { 199637, false }, + { 199649, true }, + { 199669, true }, + { 199682, true }, + { 199702, true }, + { 199724, true }, + { 199747, true }, + { 199765, true }, { 199781, true }, - { 199794, true }, + { 199793, true }, { 199806, true }, { 199820, true }, { 199829, true }, @@ -29847,2291 +29853,2299 @@ static const nsSTSPreload kSTSPreloadList[] = { { 200592, true }, { 200602, true }, { 200616, true }, - { 200625, true }, + { 200625, false }, { 200636, true }, { 200647, true }, { 200658, true }, - { 200668, false }, - { 200688, true }, - { 200703, true }, - { 200715, true }, - { 200727, true }, - { 200739, true }, - { 200758, true }, - { 200778, true }, - { 200788, true }, - { 200802, true }, - { 200817, true }, - { 200834, true }, - { 200849, true }, - { 200857, true }, - { 200878, false }, - { 200896, true }, - { 200908, true }, - { 200930, true }, - { 200946, true }, - { 200961, true }, + { 200669, true }, + { 200679, false }, + { 200699, true }, + { 200714, true }, + { 200726, true }, + { 200738, true }, + { 200750, true }, + { 200769, true }, + { 200789, true }, + { 200799, true }, + { 200813, true }, + { 200828, true }, + { 200845, true }, + { 200860, true }, + { 200868, true }, + { 200889, false }, + { 200907, true }, + { 200919, true }, + { 200941, true }, + { 200957, true }, { 200972, true }, - { 200994, true }, - { 201008, true }, - { 201029, true }, - { 201043, true }, - { 201060, true }, - { 201079, true }, - { 201098, true }, - { 201111, true }, - { 201131, true }, - { 201147, true }, - { 201173, true }, - { 201194, true }, - { 201213, true }, - { 201235, true }, - { 201259, true }, - { 201275, true }, - { 201300, true }, - { 201326, true }, + { 200983, true }, + { 201005, true }, + { 201019, true }, + { 201040, true }, + { 201054, true }, + { 201071, true }, + { 201090, true }, + { 201109, true }, + { 201122, true }, + { 201142, true }, + { 201158, true }, + { 201184, true }, + { 201205, true }, + { 201224, true }, + { 201246, true }, + { 201270, true }, + { 201286, true }, + { 201311, true }, { 201337, true }, - { 201361, true }, - { 201387, true }, - { 201405, true }, + { 201348, true }, + { 201372, true }, + { 201398, true }, { 201416, true }, - { 201438, true }, - { 201459, true }, - { 201476, true }, - { 201494, true }, - { 201504, true }, - { 201520, false }, - { 201539, true }, - { 201561, true }, - { 201584, true }, - { 201596, true }, - { 201615, true }, - { 201633, true }, - { 201656, true }, - { 201669, true }, - { 201685, true }, - { 201703, true }, - { 201721, true }, - { 201747, true }, - { 201761, true }, - { 201779, true }, - { 201794, true }, - { 201811, true }, - { 201825, true }, - { 201852, true }, - { 201866, true }, - { 201884, true }, - { 201900, true }, - { 201916, true }, - { 201929, true }, - { 201949, true }, - { 201967, true }, - { 201986, true }, - { 201999, true }, - { 202035, true }, - { 202058, true }, - { 202078, true }, - { 202093, true }, - { 202110, true }, - { 202121, true }, - { 202139, true }, - { 202169, true }, - { 202185, true }, - { 202200, true }, - { 202215, true }, - { 202226, true }, - { 202240, true }, - { 202262, true }, - { 202277, true }, - { 202292, true }, - { 202305, true }, - { 202320, true }, - { 202333, true }, - { 202356, true }, - { 202365, true }, - { 202387, true }, - { 202397, true }, - { 202416, true }, - { 202440, true }, - { 202466, true }, - { 202484, true }, - { 202495, true }, - { 202512, true }, - { 202530, true }, - { 202546, true }, - { 202560, true }, - { 202573, true }, - { 202589, true }, - { 202608, true }, - { 202632, true }, - { 202645, true }, - { 202662, true }, - { 202673, true }, - { 202688, true }, - { 202710, true }, - { 202729, true }, - { 202749, true }, - { 202766, false }, - { 202781, true }, - { 202799, true }, - { 202821, true }, - { 202837, true }, - { 202849, true }, - { 202861, true }, - { 202873, true }, - { 202889, true }, - { 202908, true }, - { 202928, true }, - { 202948, true }, - { 202964, true }, - { 202983, true }, - { 203013, false }, - { 203027, true }, - { 203044, true }, - { 203065, true }, - { 203085, true }, - { 203099, true }, - { 203117, true }, - { 203134, true }, - { 203150, true }, - { 203160, true }, - { 203171, true }, - { 203183, true }, - { 203202, true }, - { 203218, true }, - { 203238, true }, - { 203252, true }, - { 203265, true }, - { 203276, true }, - { 203297, true }, - { 203325, true }, - { 203341, true }, - { 203366, true }, - { 203383, true }, - { 203400, false }, - { 203415, true }, - { 203440, true }, - { 203449, true }, - { 203459, true }, - { 203471, true }, - { 203490, true }, - { 203509, true }, - { 203526, true }, - { 203543, true }, - { 203559, false }, - { 203577, true }, - { 203594, true }, - { 203607, true }, - { 203627, true }, - { 203651, true }, - { 203669, true }, - { 203690, true }, - { 203705, true }, - { 203720, true }, - { 203732, true }, - { 203757, true }, - { 203770, true }, - { 203792, true }, - { 203802, true }, - { 203819, true }, - { 203838, true }, - { 203851, true }, - { 203865, true }, - { 203878, true }, - { 203902, true }, - { 203924, true }, - { 203957, true }, - { 203972, true }, - { 203986, true }, - { 203995, true }, - { 204004, true }, - { 204018, true }, - { 204028, false }, - { 204042, true }, - { 204051, true }, - { 204062, true }, - { 204076, true }, - { 204087, true }, - { 204105, true }, - { 204120, true }, - { 204133, true }, - { 204143, true }, - { 204156, true }, - { 204175, true }, - { 204195, true }, - { 204218, true }, - { 204225, true }, - { 204241, true }, - { 204259, true }, - { 204280, true }, - { 204292, true }, - { 204322, true }, - { 204335, true }, - { 204345, true }, - { 204357, true }, - { 204371, true }, - { 204385, true }, - { 204396, true }, - { 204415, true }, - { 204430, true }, - { 204442, true }, - { 204454, true }, - { 204465, true }, - { 204480, true }, - { 204492, true }, - { 204508, true }, - { 204523, true }, - { 204539, true }, - { 204548, true }, - { 204562, true }, - { 204573, false }, - { 204588, true }, - { 204602, true }, - { 204618, true }, - { 204631, true }, - { 204651, true }, - { 204664, false }, - { 204684, true }, - { 204697, true }, - { 204711, true }, - { 204722, true }, - { 204739, true }, - { 204753, true }, - { 204765, true }, - { 204779, true }, - { 204791, true }, - { 204803, true }, - { 204815, true }, - { 204827, true }, - { 204837, true }, - { 204850, true }, - { 204867, true }, - { 204894, true }, - { 204907, true }, + { 201427, true }, + { 201449, true }, + { 201470, true }, + { 201487, true }, + { 201505, true }, + { 201515, true }, + { 201531, true }, + { 201553, true }, + { 201576, true }, + { 201588, true }, + { 201607, true }, + { 201625, true }, + { 201648, true }, + { 201661, true }, + { 201677, true }, + { 201695, true }, + { 201713, true }, + { 201739, true }, + { 201753, true }, + { 201771, true }, + { 201786, true }, + { 201803, true }, + { 201817, true }, + { 201844, true }, + { 201858, true }, + { 201876, true }, + { 201892, true }, + { 201908, true }, + { 201921, true }, + { 201941, true }, + { 201959, true }, + { 201978, true }, + { 201991, true }, + { 202027, true }, + { 202050, true }, + { 202070, true }, + { 202085, true }, + { 202102, true }, + { 202113, true }, + { 202131, true }, + { 202161, true }, + { 202177, true }, + { 202192, true }, + { 202207, true }, + { 202218, true }, + { 202232, true }, + { 202254, true }, + { 202269, true }, + { 202284, true }, + { 202297, true }, + { 202312, true }, + { 202325, true }, + { 202348, true }, + { 202357, true }, + { 202379, true }, + { 202389, true }, + { 202408, true }, + { 202432, true }, + { 202458, true }, + { 202476, true }, + { 202487, true }, + { 202504, true }, + { 202522, true }, + { 202538, true }, + { 202552, true }, + { 202565, true }, + { 202581, true }, + { 202600, true }, + { 202624, true }, + { 202637, true }, + { 202654, true }, + { 202665, true }, + { 202680, true }, + { 202702, true }, + { 202721, true }, + { 202741, true }, + { 202758, false }, + { 202773, true }, + { 202791, true }, + { 202813, true }, + { 202829, true }, + { 202841, true }, + { 202853, true }, + { 202865, true }, + { 202881, true }, + { 202900, true }, + { 202920, true }, + { 202940, true }, + { 202956, true }, + { 202975, true }, + { 203005, false }, + { 203019, true }, + { 203036, true }, + { 203057, true }, + { 203077, true }, + { 203091, true }, + { 203109, true }, + { 203126, true }, + { 203142, true }, + { 203152, true }, + { 203163, true }, + { 203175, true }, + { 203194, true }, + { 203210, true }, + { 203230, true }, + { 203244, true }, + { 203257, true }, + { 203268, true }, + { 203289, true }, + { 203317, true }, + { 203333, true }, + { 203358, true }, + { 203375, true }, + { 203392, false }, + { 203407, true }, + { 203432, true }, + { 203441, true }, + { 203451, true }, + { 203463, true }, + { 203482, true }, + { 203501, true }, + { 203518, true }, + { 203535, true }, + { 203551, false }, + { 203569, true }, + { 203586, true }, + { 203599, true }, + { 203619, true }, + { 203643, true }, + { 203661, true }, + { 203682, true }, + { 203697, true }, + { 203712, true }, + { 203724, true }, + { 203749, true }, + { 203762, true }, + { 203784, true }, + { 203794, true }, + { 203811, true }, + { 203830, true }, + { 203843, true }, + { 203857, true }, + { 203870, true }, + { 203894, true }, + { 203916, true }, + { 203949, true }, + { 203964, true }, + { 203978, true }, + { 203987, true }, + { 203996, true }, + { 204010, true }, + { 204020, false }, + { 204034, true }, + { 204043, true }, + { 204054, true }, + { 204068, true }, + { 204079, true }, + { 204097, true }, + { 204112, true }, + { 204125, true }, + { 204135, true }, + { 204148, true }, + { 204167, true }, + { 204187, true }, + { 204210, true }, + { 204217, true }, + { 204233, true }, + { 204251, true }, + { 204272, true }, + { 204284, true }, + { 204314, true }, + { 204327, true }, + { 204337, true }, + { 204349, true }, + { 204363, true }, + { 204377, true }, + { 204388, true }, + { 204407, true }, + { 204422, true }, + { 204434, true }, + { 204446, true }, + { 204457, true }, + { 204472, true }, + { 204484, true }, + { 204500, true }, + { 204515, true }, + { 204531, true }, + { 204540, true }, + { 204554, true }, + { 204565, false }, + { 204580, true }, + { 204594, true }, + { 204610, true }, + { 204623, true }, + { 204643, true }, + { 204656, false }, + { 204676, true }, + { 204689, true }, + { 204703, true }, + { 204714, true }, + { 204731, true }, + { 204745, true }, + { 204757, true }, + { 204771, true }, + { 204783, true }, + { 204795, true }, + { 204807, true }, + { 204819, true }, + { 204829, true }, + { 204842, true }, + { 204859, true }, + { 204886, true }, + { 204899, true }, + { 204917, true }, { 204925, true }, - { 204933, true }, - { 204945, true }, - { 204958, true }, - { 204985, true }, - { 204994, true }, - { 205003, true }, - { 205021, true }, - { 205028, true }, + { 204937, true }, + { 204950, true }, + { 204977, true }, + { 204986, true }, + { 204995, true }, + { 205013, true }, + { 205020, true }, + { 205047, true }, { 205055, true }, - { 205063, true }, - { 205073, true }, + { 205065, true }, + { 205074, true }, { 205082, true }, - { 205090, true }, - { 205103, true }, - { 205112, true }, - { 205124, true }, - { 205137, true }, - { 205146, true }, - { 205156, true }, - { 205166, true }, - { 205176, true }, - { 205186, true }, - { 205196, true }, - { 205205, true }, - { 205212, true }, - { 205228, true }, - { 205245, true }, - { 205252, true }, - { 205266, true }, - { 205283, true }, - { 205295, true }, + { 205095, true }, + { 205104, true }, + { 205116, true }, + { 205129, true }, + { 205138, true }, + { 205148, true }, + { 205158, true }, + { 205168, true }, + { 205178, true }, + { 205188, true }, + { 205197, true }, + { 205204, true }, + { 205220, true }, + { 205237, true }, + { 205244, true }, + { 205258, true }, + { 205275, true }, + { 205287, true }, + { 205304, true }, { 205312, true }, - { 205320, true }, - { 205327, true }, - { 205336, true }, - { 205345, true }, - { 205357, true }, - { 205371, true }, - { 205388, true }, - { 205404, true }, - { 205420, true }, - { 205439, true }, - { 205457, true }, - { 205472, true }, - { 205490, true }, - { 205507, true }, - { 205517, true }, - { 205529, true }, - { 205547, true }, - { 205564, true }, - { 205579, true }, - { 205594, true }, - { 205606, true }, + { 205319, true }, + { 205328, true }, + { 205337, true }, + { 205349, true }, + { 205363, true }, + { 205380, true }, + { 205396, true }, + { 205412, true }, + { 205431, true }, + { 205449, true }, + { 205464, true }, + { 205482, true }, + { 205499, true }, + { 205509, true }, + { 205521, true }, + { 205539, true }, + { 205556, true }, + { 205571, true }, + { 205586, true }, + { 205598, true }, + { 205612, true }, { 205620, true }, - { 205628, true }, - { 205638, false }, - { 205663, true }, - { 205676, true }, - { 205686, true }, - { 205701, true }, - { 205713, true }, - { 205727, true }, - { 205736, true }, - { 205745, false }, - { 205757, true }, - { 205770, false }, - { 205803, true }, - { 205818, true }, - { 205829, true }, - { 205852, true }, - { 205865, true }, - { 205876, true }, - { 205890, true }, - { 205910, true }, - { 205923, true }, - { 205937, true }, - { 205950, true }, - { 205964, true }, - { 205982, true }, - { 205996, true }, - { 206012, true }, - { 206027, true }, - { 206049, true }, - { 206059, true }, - { 206071, true }, - { 206087, true }, - { 206099, true }, - { 206109, true }, - { 206122, true }, - { 206136, true }, - { 206147, true }, + { 205630, false }, + { 205655, true }, + { 205668, true }, + { 205678, true }, + { 205693, true }, + { 205705, true }, + { 205719, true }, + { 205728, true }, + { 205737, false }, + { 205749, true }, + { 205762, false }, + { 205795, true }, + { 205810, true }, + { 205821, true }, + { 205844, true }, + { 205857, true }, + { 205868, true }, + { 205882, true }, + { 205902, true }, + { 205915, true }, + { 205929, true }, + { 205942, true }, + { 205956, true }, + { 205974, true }, + { 205988, true }, + { 206004, true }, + { 206019, true }, + { 206041, true }, + { 206051, true }, + { 206063, true }, + { 206079, true }, + { 206091, true }, + { 206101, true }, + { 206114, true }, + { 206128, true }, + { 206139, true }, + { 206148, true }, { 206156, true }, - { 206164, true }, - { 206176, false }, - { 206184, true }, - { 206195, true }, - { 206211, true }, - { 206222, true }, - { 206235, true }, - { 206247, false }, - { 206261, true }, - { 206274, true }, - { 206285, true }, - { 206295, true }, - { 206309, true }, - { 206328, true }, - { 206339, true }, - { 206353, true }, - { 206364, true }, - { 206375, true }, - { 206386, true }, - { 206397, true }, - { 206408, true }, - { 206422, true }, - { 206434, true }, - { 206449, true }, - { 206463, true }, - { 206478, true }, - { 206491, true }, - { 206507, true }, - { 206516, true }, - { 206525, true }, - { 206539, true }, - { 206550, false }, - { 206566, true }, - { 206577, true }, - { 206588, true }, - { 206598, true }, - { 206614, false }, - { 206628, true }, - { 206641, true }, - { 206650, true }, - { 206660, true }, - { 206673, true }, - { 206683, true }, - { 206697, true }, - { 206707, true }, - { 206720, true }, - { 206734, true }, - { 206746, true }, - { 206760, true }, - { 206781, true }, - { 206796, true }, - { 206810, true }, - { 206822, true }, - { 206837, false }, - { 206856, true }, - { 206866, true }, - { 206878, true }, - { 206888, true }, - { 206900, true }, - { 206919, true }, - { 206928, false }, - { 206943, true }, - { 206961, true }, - { 206977, false }, - { 206989, true }, - { 207015, true }, - { 207026, true }, - { 207047, true }, - { 207062, true }, - { 207080, true }, - { 207097, true }, - { 207110, true }, - { 207126, true }, - { 207141, true }, - { 207161, true }, - { 207172, true }, - { 207187, true }, - { 207199, true }, - { 207210, true }, - { 207223, true }, - { 207241, true }, - { 207261, true }, - { 207280, true }, - { 207308, true }, - { 207322, true }, - { 207341, true }, - { 207362, true }, - { 207371, true }, - { 207395, false }, - { 207414, true }, - { 207428, true }, - { 207446, true }, - { 207461, true }, - { 207478, true }, - { 207498, true }, - { 207512, true }, - { 207522, true }, - { 207540, true }, - { 207553, true }, - { 207574, true }, - { 207586, true }, - { 207597, true }, - { 207612, true }, - { 207633, true }, - { 207652, true }, - { 207681, true }, - { 207688, true }, - { 207700, true }, - { 207715, true }, - { 207731, true }, - { 207748, true }, - { 207770, true }, - { 207780, true }, - { 207792, true }, - { 207804, true }, - { 207821, true }, - { 207830, false }, - { 207843, false }, - { 207863, true }, - { 207873, true }, - { 207885, true }, - { 207902, true }, - { 207918, true }, - { 207933, true }, - { 207951, true }, - { 207964, true }, - { 207979, true }, - { 207992, true }, - { 208008, true }, - { 208026, true }, - { 208038, true }, - { 208057, true }, - { 208071, true }, - { 208084, true }, - { 208095, true }, - { 208115, true }, - { 208126, true }, - { 208145, true }, - { 208164, true }, - { 208174, true }, - { 208186, true }, - { 208206, true }, - { 208223, true }, - { 208236, true }, - { 208249, true }, - { 208262, true }, - { 208275, true }, - { 208288, true }, - { 208299, true }, - { 208311, true }, - { 208326, true }, - { 208336, true }, - { 208349, true }, - { 208367, true }, - { 208385, true }, - { 208404, true }, - { 208416, true }, - { 208429, true }, - { 208447, true }, - { 208469, true }, - { 208482, true }, - { 208499, true }, - { 208519, true }, - { 208535, true }, - { 208563, true }, - { 208588, true }, - { 208620, true }, - { 208639, true }, - { 208659, true }, - { 208674, true }, - { 208694, true }, - { 208707, true }, - { 208723, true }, - { 208740, true }, - { 208757, true }, - { 208769, true }, - { 208782, true }, - { 208795, true }, - { 208820, true }, - { 208842, true }, - { 208860, true }, - { 208874, true }, - { 208895, true }, - { 208907, true }, - { 208922, true }, - { 208939, true }, - { 208951, true }, - { 208966, true }, - { 208977, true }, - { 208991, true }, - { 209010, true }, - { 209027, true }, - { 209042, true }, - { 209052, true }, - { 209064, true }, - { 209084, true }, - { 209098, true }, - { 209108, true }, - { 209121, true }, - { 209140, true }, - { 209154, true }, - { 209168, true }, - { 209182, true }, - { 209192, true }, - { 209204, true }, - { 209222, false }, - { 209230, true }, - { 209246, true }, - { 209258, true }, - { 209269, true }, - { 209281, true }, - { 209290, true }, - { 209304, true }, - { 209318, true }, - { 209332, true }, - { 209350, true }, + { 206168, false }, + { 206176, true }, + { 206187, true }, + { 206203, true }, + { 206214, true }, + { 206227, true }, + { 206239, false }, + { 206253, true }, + { 206266, true }, + { 206277, true }, + { 206287, true }, + { 206301, true }, + { 206320, true }, + { 206331, true }, + { 206345, true }, + { 206356, true }, + { 206367, true }, + { 206378, true }, + { 206389, true }, + { 206400, true }, + { 206414, true }, + { 206426, true }, + { 206441, true }, + { 206455, true }, + { 206470, true }, + { 206483, true }, + { 206499, true }, + { 206508, true }, + { 206517, true }, + { 206531, true }, + { 206542, false }, + { 206558, true }, + { 206569, true }, + { 206580, true }, + { 206590, true }, + { 206606, false }, + { 206620, true }, + { 206633, true }, + { 206642, true }, + { 206652, true }, + { 206665, true }, + { 206675, true }, + { 206689, true }, + { 206699, true }, + { 206712, true }, + { 206726, true }, + { 206738, true }, + { 206752, true }, + { 206773, true }, + { 206788, true }, + { 206802, true }, + { 206814, true }, + { 206829, false }, + { 206848, true }, + { 206858, true }, + { 206870, true }, + { 206880, true }, + { 206892, true }, + { 206911, true }, + { 206920, false }, + { 206935, true }, + { 206953, true }, + { 206969, false }, + { 206981, true }, + { 207007, true }, + { 207018, true }, + { 207039, true }, + { 207054, true }, + { 207072, true }, + { 207089, true }, + { 207102, true }, + { 207118, true }, + { 207133, true }, + { 207153, true }, + { 207164, true }, + { 207179, true }, + { 207191, true }, + { 207202, true }, + { 207215, true }, + { 207233, true }, + { 207253, true }, + { 207272, true }, + { 207300, true }, + { 207314, true }, + { 207333, true }, + { 207354, true }, + { 207363, true }, + { 207387, false }, + { 207406, true }, + { 207420, true }, + { 207438, true }, + { 207453, true }, + { 207470, true }, + { 207490, true }, + { 207504, true }, + { 207514, true }, + { 207532, true }, + { 207545, true }, + { 207566, true }, + { 207578, true }, + { 207589, true }, + { 207604, true }, + { 207625, true }, + { 207644, true }, + { 207673, true }, + { 207680, true }, + { 207692, true }, + { 207707, true }, + { 207723, true }, + { 207740, true }, + { 207762, true }, + { 207772, true }, + { 207784, true }, + { 207796, true }, + { 207813, true }, + { 207822, false }, + { 207835, false }, + { 207855, true }, + { 207865, true }, + { 207877, true }, + { 207894, true }, + { 207910, true }, + { 207925, true }, + { 207943, true }, + { 207956, true }, + { 207971, true }, + { 207984, true }, + { 208000, true }, + { 208018, true }, + { 208030, true }, + { 208049, true }, + { 208063, true }, + { 208076, true }, + { 208087, true }, + { 208107, true }, + { 208118, true }, + { 208137, true }, + { 208156, true }, + { 208166, true }, + { 208178, true }, + { 208198, true }, + { 208215, true }, + { 208228, true }, + { 208241, true }, + { 208254, true }, + { 208267, true }, + { 208280, true }, + { 208291, true }, + { 208303, true }, + { 208318, true }, + { 208328, true }, + { 208341, true }, + { 208359, true }, + { 208377, true }, + { 208396, true }, + { 208408, true }, + { 208421, true }, + { 208439, true }, + { 208461, true }, + { 208474, true }, + { 208491, true }, + { 208511, true }, + { 208527, true }, + { 208555, true }, + { 208580, true }, + { 208612, true }, + { 208631, true }, + { 208651, true }, + { 208666, true }, + { 208686, true }, + { 208699, true }, + { 208715, true }, + { 208732, true }, + { 208749, true }, + { 208761, true }, + { 208774, true }, + { 208787, true }, + { 208812, true }, + { 208834, true }, + { 208852, true }, + { 208866, true }, + { 208887, true }, + { 208899, true }, + { 208914, true }, + { 208931, true }, + { 208943, true }, + { 208958, true }, + { 208969, true }, + { 208983, true }, + { 209002, true }, + { 209019, true }, + { 209034, true }, + { 209044, true }, + { 209056, true }, + { 209076, true }, + { 209090, true }, + { 209100, true }, + { 209113, true }, + { 209132, true }, + { 209146, true }, + { 209160, true }, + { 209174, true }, + { 209184, true }, + { 209196, true }, + { 209214, false }, + { 209222, true }, + { 209238, true }, + { 209250, true }, + { 209261, true }, + { 209273, true }, + { 209282, true }, + { 209296, true }, + { 209310, true }, + { 209324, true }, + { 209342, true }, + { 209353, true }, { 209361, true }, - { 209369, true }, - { 209385, true }, - { 209400, true }, - { 209418, true }, - { 209438, true }, + { 209377, true }, + { 209392, true }, + { 209410, true }, + { 209430, true }, + { 209443, true }, { 209451, true }, - { 209459, true }, - { 209480, true }, - { 209491, true }, - { 209506, false }, - { 209524, false }, - { 209545, true }, - { 209554, true }, - { 209577, true }, - { 209600, true }, - { 209617, true }, - { 209629, true }, - { 209650, true }, - { 209676, true }, - { 209693, true }, - { 209710, true }, - { 209730, true }, - { 209743, true }, - { 209757, true }, - { 209779, true }, - { 209796, true }, - { 209813, true }, - { 209833, true }, - { 209858, true }, - { 209883, true }, - { 209909, true }, - { 209925, true }, - { 209936, true }, - { 209951, true }, - { 209960, true }, - { 209971, true }, - { 209985, true }, - { 209994, true }, - { 210007, true }, - { 210029, true }, + { 209472, true }, + { 209483, true }, + { 209498, false }, + { 209516, false }, + { 209537, true }, + { 209546, true }, + { 209569, true }, + { 209592, true }, + { 209609, true }, + { 209621, true }, + { 209642, true }, + { 209668, true }, + { 209685, true }, + { 209702, true }, + { 209722, true }, + { 209735, true }, + { 209749, true }, + { 209771, true }, + { 209788, true }, + { 209805, true }, + { 209825, true }, + { 209850, true }, + { 209875, true }, + { 209901, true }, + { 209917, true }, + { 209928, true }, + { 209943, true }, + { 209952, true }, + { 209963, true }, + { 209977, true }, + { 209986, true }, + { 209999, true }, + { 210021, true }, + { 210033, true }, { 210041, true }, - { 210049, true }, + { 210055, true }, { 210063, true }, - { 210071, true }, - { 210082, true }, - { 210092, true }, - { 210102, true }, - { 210109, true }, - { 210120, true }, - { 210132, true }, - { 210142, true }, - { 210149, true }, - { 210161, true }, - { 210174, true }, - { 210183, true }, - { 210193, true }, - { 210203, true }, - { 210214, true }, + { 210074, true }, + { 210084, true }, + { 210094, true }, + { 210101, true }, + { 210112, true }, + { 210124, true }, + { 210134, true }, + { 210141, true }, + { 210153, true }, + { 210166, true }, + { 210175, true }, + { 210185, true }, + { 210195, true }, + { 210206, true }, + { 210217, true }, { 210225, true }, - { 210233, true }, - { 210246, true }, - { 210258, true }, - { 210269, true }, - { 210283, true }, - { 210309, false }, - { 210323, true }, - { 210339, true }, - { 210355, true }, - { 210368, true }, - { 210380, true }, - { 210393, true }, - { 210405, true }, - { 210426, true }, - { 210438, true }, - { 210448, true }, - { 210470, true }, - { 210501, true }, - { 210518, true }, - { 210531, true }, - { 210542, false }, - { 210553, true }, - { 210563, true }, - { 210575, true }, - { 210587, true }, - { 210601, true }, - { 210612, false }, - { 210625, false }, - { 210645, true }, - { 210655, true }, - { 210663, false }, - { 210672, true }, - { 210685, true }, - { 210743, true }, - { 210789, true }, - { 210843, true }, - { 210890, true }, - { 210939, true }, - { 210984, true }, - { 211034, true }, - { 211088, true }, - { 211134, true }, - { 211181, true }, - { 211235, true }, - { 211262, true }, - { 211295, true }, - { 211308, true }, - { 211321, true }, - { 211337, true }, - { 211360, true }, - { 211376, true }, - { 211389, true }, - { 211405, true }, - { 211415, true }, - { 211426, false }, - { 211438, true }, - { 211455, true }, - { 211472, true }, - { 211490, true }, - { 211504, true }, - { 211522, true }, - { 211538, true }, - { 211549, true }, + { 210238, true }, + { 210250, true }, + { 210261, true }, + { 210275, true }, + { 210301, false }, + { 210315, true }, + { 210331, true }, + { 210347, true }, + { 210360, true }, + { 210372, true }, + { 210385, true }, + { 210397, true }, + { 210418, true }, + { 210430, true }, + { 210440, true }, + { 210462, true }, + { 210493, true }, + { 210510, true }, + { 210523, true }, + { 210534, false }, + { 210545, true }, + { 210555, true }, + { 210567, true }, + { 210579, true }, + { 210593, true }, + { 210604, false }, + { 210617, false }, + { 210637, true }, + { 210647, true }, + { 210655, false }, + { 210664, true }, + { 210677, true }, + { 210735, true }, + { 210781, true }, + { 210835, true }, + { 210882, true }, + { 210931, true }, + { 210976, true }, + { 211026, true }, + { 211080, true }, + { 211126, true }, + { 211173, true }, + { 211227, true }, + { 211254, true }, + { 211287, true }, + { 211300, true }, + { 211313, true }, + { 211329, true }, + { 211352, true }, + { 211368, true }, + { 211381, true }, + { 211397, true }, + { 211407, true }, + { 211418, false }, + { 211430, true }, + { 211447, true }, + { 211464, true }, + { 211482, true }, + { 211496, true }, + { 211514, true }, + { 211530, true }, + { 211541, true }, + { 211552, true }, { 211560, true }, - { 211568, true }, - { 211578, true }, - { 211585, true }, + { 211570, true }, + { 211577, true }, + { 211586, true }, { 211594, true }, - { 211602, true }, - { 211612, true }, - { 211619, true }, - { 211628, true }, - { 211646, true }, - { 211662, true }, - { 211681, true }, - { 211694, true }, - { 211708, true }, - { 211720, true }, - { 211734, true }, - { 211749, true }, - { 211761, true }, - { 211774, true }, - { 211785, true }, - { 211795, true }, - { 211804, true }, - { 211813, true }, - { 211820, true }, - { 211827, true }, - { 211851, true }, - { 211865, true }, - { 211882, false }, - { 211897, true }, - { 211911, true }, - { 211923, true }, - { 211937, true }, - { 211954, true }, - { 211965, true }, - { 211977, true }, - { 211989, true }, - { 211999, true }, - { 212010, true }, - { 212025, true }, - { 212035, true }, - { 212054, true }, - { 212066, true }, - { 212073, true }, - { 212089, true }, - { 212100, true }, - { 212115, true }, - { 212138, true }, - { 212145, true }, - { 212155, true }, - { 212165, true }, - { 212177, true }, - { 212193, true }, - { 212200, true }, - { 212207, true }, - { 212219, true }, - { 212230, true }, - { 212240, true }, - { 212252, true }, - { 212262, false }, - { 212282, true }, - { 212305, true }, - { 212329, true }, - { 212339, false }, - { 212346, true }, - { 212359, true }, - { 212373, true }, - { 212387, true }, - { 212400, true }, - { 212411, true }, - { 212427, false }, - { 212448, true }, - { 212458, true }, - { 212469, true }, - { 212484, true }, - { 212498, true }, - { 212509, true }, - { 212523, true }, - { 212537, true }, - { 212546, true }, - { 212557, true }, - { 212572, true }, - { 212585, true }, - { 212600, true }, - { 212616, true }, - { 212630, true }, - { 212645, true }, - { 212659, true }, - { 212675, true }, - { 212691, true }, - { 212705, true }, - { 212719, true }, - { 212735, true }, - { 212751, true }, - { 212769, true }, - { 212787, true }, - { 212807, true }, - { 212826, true }, - { 212842, true }, - { 212857, true }, - { 212871, true }, - { 212891, true }, - { 212907, true }, - { 212922, true }, - { 212936, true }, - { 212967, true }, - { 212983, true }, - { 212994, true }, - { 213004, false }, - { 213028, true }, - { 213042, true }, - { 213056, true }, - { 213066, true }, - { 213083, true }, - { 213096, true }, - { 213109, true }, - { 213126, true }, - { 213143, false }, - { 213160, true }, - { 213173, true }, - { 213190, true }, - { 213211, true }, - { 213224, true }, - { 213237, true }, - { 213257, true }, - { 213275, true }, - { 213285, true }, - { 213298, true }, - { 213312, true }, - { 213326, false }, - { 213337, true }, - { 213354, true }, - { 213368, true }, - { 213387, true }, - { 213410, true }, - { 213438, true }, - { 213454, true }, - { 213466, true }, - { 213480, false }, - { 213493, true }, - { 213507, true }, - { 213517, true }, - { 213526, true }, - { 213538, true }, - { 213551, true }, - { 213567, true }, - { 213577, true }, - { 213592, true }, - { 213600, true }, - { 213611, true }, - { 213626, true }, - { 213643, true }, - { 213650, true }, - { 213660, true }, - { 213670, true }, - { 213691, true }, - { 213707, true }, - { 213726, true }, - { 213746, true }, - { 213761, true }, - { 213769, true }, - { 213788, true }, - { 213799, true }, - { 213815, false }, - { 213823, true }, - { 213838, true }, - { 213846, true }, - { 213857, true }, - { 213870, true }, - { 213881, true }, - { 213896, false }, - { 213916, true }, - { 213931, true }, - { 213953, true }, - { 213963, true }, - { 213978, true }, - { 213991, true }, - { 214002, true }, - { 214012, true }, - { 214024, true }, - { 214048, true }, - { 214061, true }, - { 214074, true }, - { 214086, true }, - { 214099, true }, - { 214113, true }, - { 214129, true }, - { 214145, true }, - { 214161, true }, - { 214180, true }, - { 214200, true }, - { 214211, true }, - { 214221, true }, - { 214232, true }, - { 214240, false }, - { 214247, true }, - { 214260, true }, - { 214270, true }, - { 214284, true }, - { 214299, true }, - { 214309, true }, - { 214327, true }, - { 214341, true }, - { 214353, true }, - { 214380, false }, - { 214389, true }, - { 214402, false }, - { 214425, true }, - { 214447, true }, - { 214458, true }, - { 214471, true }, - { 214478, true }, - { 214485, true }, - { 214496, true }, - { 214512, true }, - { 214525, true }, - { 214537, true }, - { 214547, true }, - { 214564, true }, - { 214579, true }, - { 214588, true }, - { 214599, true }, - { 214610, true }, - { 214628, true }, - { 214642, true }, - { 214654, true }, - { 214664, true }, - { 214676, true }, - { 214688, true }, - { 214701, true }, - { 214717, true }, - { 214736, true }, - { 214755, true }, - { 214774, true }, - { 214789, true }, - { 214799, true }, - { 214817, true }, - { 214829, true }, - { 214848, true }, - { 214860, true }, - { 214875, true }, - { 214884, true }, - { 214895, false }, - { 214905, true }, - { 214911, true }, - { 214920, true }, - { 214929, true }, - { 214937, true }, - { 214956, true }, - { 214969, true }, - { 214978, true }, - { 214992, true }, - { 215010, true }, - { 215022, true }, - { 215032, true }, - { 215056, true }, - { 215079, true }, - { 215099, true }, - { 215112, true }, - { 215128, true }, - { 215140, true }, - { 215154, true }, - { 215173, true }, - { 215183, true }, - { 215205, true }, - { 215218, true }, - { 215227, true }, - { 215238, true }, - { 215251, true }, - { 215262, true }, - { 215276, true }, - { 215290, true }, - { 215305, true }, - { 215319, true }, - { 215334, true }, - { 215357, false }, - { 215370, true }, - { 215382, true }, - { 215397, true }, - { 215409, true }, - { 215419, true }, - { 215433, true }, - { 215446, true }, - { 215459, true }, - { 215478, false }, - { 215492, true }, - { 215504, true }, - { 215516, true }, - { 215532, true }, - { 215550, true }, - { 215576, true }, - { 215594, false }, - { 215607, true }, - { 215625, true }, - { 215635, true }, + { 211604, true }, + { 211611, true }, + { 211620, true }, + { 211638, true }, + { 211654, true }, + { 211673, true }, + { 211686, true }, + { 211700, true }, + { 211712, true }, + { 211726, true }, + { 211741, true }, + { 211753, true }, + { 211766, true }, + { 211777, true }, + { 211798, true }, + { 211808, true }, + { 211817, true }, + { 211826, true }, + { 211833, true }, + { 211840, true }, + { 211864, true }, + { 211878, true }, + { 211895, false }, + { 211910, true }, + { 211924, true }, + { 211936, true }, + { 211950, true }, + { 211967, true }, + { 211978, true }, + { 211990, true }, + { 212002, true }, + { 212013, true }, + { 212028, true }, + { 212038, true }, + { 212057, true }, + { 212069, true }, + { 212076, true }, + { 212092, true }, + { 212103, true }, + { 212118, true }, + { 212141, true }, + { 212148, true }, + { 212158, true }, + { 212168, true }, + { 212180, true }, + { 212196, true }, + { 212203, true }, + { 212210, true }, + { 212222, true }, + { 212233, true }, + { 212243, true }, + { 212255, true }, + { 212265, false }, + { 212285, true }, + { 212308, true }, + { 212332, true }, + { 212342, false }, + { 212349, true }, + { 212362, true }, + { 212376, true }, + { 212390, true }, + { 212403, true }, + { 212414, true }, + { 212430, false }, + { 212451, true }, + { 212461, true }, + { 212472, true }, + { 212487, true }, + { 212501, true }, + { 212512, true }, + { 212526, true }, + { 212540, true }, + { 212549, true }, + { 212560, true }, + { 212575, true }, + { 212588, true }, + { 212603, true }, + { 212619, true }, + { 212633, true }, + { 212648, true }, + { 212662, true }, + { 212678, true }, + { 212694, true }, + { 212708, true }, + { 212722, true }, + { 212738, true }, + { 212754, true }, + { 212772, true }, + { 212790, true }, + { 212810, true }, + { 212829, true }, + { 212845, true }, + { 212860, true }, + { 212874, true }, + { 212894, true }, + { 212910, true }, + { 212925, true }, + { 212939, true }, + { 212970, true }, + { 212986, true }, + { 212997, true }, + { 213007, false }, + { 213031, true }, + { 213045, true }, + { 213059, true }, + { 213069, true }, + { 213086, true }, + { 213099, true }, + { 213112, true }, + { 213129, true }, + { 213146, false }, + { 213163, true }, + { 213176, true }, + { 213193, true }, + { 213214, true }, + { 213227, true }, + { 213240, true }, + { 213260, true }, + { 213278, true }, + { 213288, true }, + { 213301, true }, + { 213315, true }, + { 213329, false }, + { 213340, true }, + { 213357, true }, + { 213371, true }, + { 213390, true }, + { 213413, true }, + { 213441, true }, + { 213457, true }, + { 213469, true }, + { 213483, false }, + { 213496, true }, + { 213510, true }, + { 213520, true }, + { 213529, true }, + { 213541, true }, + { 213554, true }, + { 213570, true }, + { 213580, true }, + { 213595, true }, + { 213603, true }, + { 213614, true }, + { 213629, true }, + { 213646, true }, + { 213653, true }, + { 213663, true }, + { 213673, true }, + { 213694, true }, + { 213710, true }, + { 213729, true }, + { 213749, true }, + { 213764, true }, + { 213772, true }, + { 213791, true }, + { 213802, true }, + { 213818, false }, + { 213826, true }, + { 213841, true }, + { 213849, true }, + { 213860, true }, + { 213873, true }, + { 213884, true }, + { 213899, false }, + { 213919, true }, + { 213934, true }, + { 213956, true }, + { 213966, true }, + { 213981, true }, + { 213994, true }, + { 214005, true }, + { 214015, true }, + { 214027, true }, + { 214051, true }, + { 214064, true }, + { 214077, true }, + { 214089, true }, + { 214102, true }, + { 214116, true }, + { 214132, true }, + { 214148, true }, + { 214164, true }, + { 214183, true }, + { 214203, true }, + { 214214, true }, + { 214224, true }, + { 214235, true }, + { 214243, false }, + { 214250, true }, + { 214263, true }, + { 214273, true }, + { 214287, true }, + { 214302, true }, + { 214312, true }, + { 214330, true }, + { 214344, true }, + { 214356, true }, + { 214383, false }, + { 214392, true }, + { 214405, false }, + { 214428, true }, + { 214450, true }, + { 214461, true }, + { 214474, true }, + { 214481, true }, + { 214488, true }, + { 214499, true }, + { 214515, true }, + { 214528, true }, + { 214540, true }, + { 214550, true }, + { 214567, true }, + { 214582, true }, + { 214591, true }, + { 214602, true }, + { 214613, true }, + { 214631, true }, + { 214645, true }, + { 214657, true }, + { 214667, true }, + { 214679, true }, + { 214691, true }, + { 214704, true }, + { 214720, true }, + { 214739, true }, + { 214758, true }, + { 214777, true }, + { 214792, true }, + { 214802, true }, + { 214820, true }, + { 214832, true }, + { 214851, true }, + { 214863, true }, + { 214878, true }, + { 214887, true }, + { 214898, false }, + { 214908, true }, + { 214914, true }, + { 214923, true }, + { 214932, true }, + { 214940, true }, + { 214959, true }, + { 214972, true }, + { 214981, true }, + { 214995, true }, + { 215013, true }, + { 215025, true }, + { 215035, true }, + { 215059, true }, + { 215082, true }, + { 215102, true }, + { 215115, true }, + { 215131, true }, + { 215143, true }, + { 215157, true }, + { 215176, true }, + { 215186, true }, + { 215208, true }, + { 215221, true }, + { 215230, true }, + { 215241, true }, + { 215254, true }, + { 215265, true }, + { 215279, true }, + { 215293, true }, + { 215308, true }, + { 215322, true }, + { 215337, true }, + { 215360, false }, + { 215373, true }, + { 215385, true }, + { 215400, true }, + { 215412, true }, + { 215422, true }, + { 215436, true }, + { 215449, true }, + { 215462, true }, + { 215481, true }, + { 215493, true }, + { 215505, true }, + { 215521, true }, + { 215539, true }, + { 215565, true }, + { 215583, false }, + { 215596, true }, + { 215614, true }, + { 215624, true }, + { 215634, true }, { 215645, true }, - { 215656, true }, - { 215671, true }, - { 215683, true }, - { 215699, true }, - { 215707, true }, - { 215717, true }, - { 215727, true }, - { 215737, true }, - { 215749, true }, - { 215759, true }, + { 215660, true }, + { 215672, true }, + { 215688, true }, + { 215696, true }, + { 215706, true }, + { 215716, true }, + { 215726, true }, + { 215738, true }, + { 215748, true }, + { 215758, true }, { 215769, true }, - { 215780, true }, - { 215800, true }, - { 215808, false }, - { 215829, true }, - { 215842, true }, - { 215851, true }, - { 215865, true }, - { 215875, true }, - { 215888, true }, - { 215898, true }, - { 215907, true }, - { 215923, true }, - { 215934, false }, - { 215954, true }, - { 215964, true }, - { 215971, true }, - { 215981, true }, - { 215991, true }, - { 216006, true }, - { 216020, true }, - { 216037, true }, - { 216054, true }, - { 216074, true }, - { 216087, true }, - { 216103, true }, - { 216133, true }, - { 216159, true }, - { 216167, true }, - { 216186, true }, - { 216200, true }, - { 216209, true }, - { 216228, true }, - { 216238, true }, - { 216259, true }, - { 216274, true }, - { 216287, true }, - { 216303, true }, - { 216315, true }, - { 216332, true }, - { 216343, true }, - { 216360, true }, - { 216378, true }, - { 216394, true }, + { 215789, true }, + { 215797, false }, + { 215818, true }, + { 215831, true }, + { 215840, true }, + { 215854, true }, + { 215864, true }, + { 215877, true }, + { 215887, true }, + { 215896, true }, + { 215912, false }, + { 215932, true }, + { 215942, true }, + { 215949, true }, + { 215959, true }, + { 215969, true }, + { 215984, true }, + { 215998, true }, + { 216015, true }, + { 216032, true }, + { 216052, true }, + { 216065, true }, + { 216081, true }, + { 216111, true }, + { 216137, true }, + { 216145, true }, + { 216164, true }, + { 216178, true }, + { 216187, true }, + { 216206, true }, + { 216216, true }, + { 216237, true }, + { 216252, true }, + { 216265, true }, + { 216281, true }, + { 216293, true }, + { 216310, true }, + { 216321, true }, + { 216338, true }, + { 216356, true }, + { 216372, true }, + { 216392, true }, { 216414, true }, - { 216436, true }, - { 216449, true }, + { 216427, true }, + { 216437, true }, { 216459, true }, - { 216481, true }, - { 216502, true }, - { 216523, true }, - { 216536, true }, - { 216560, true }, - { 216571, true }, + { 216480, true }, + { 216501, true }, + { 216514, true }, + { 216538, true }, + { 216549, true }, + { 216561, true }, + { 216573, true }, { 216583, true }, - { 216595, true }, - { 216605, true }, - { 216623, true }, - { 216635, false }, - { 216652, true }, - { 216684, true }, - { 216695, true }, + { 216601, true }, + { 216613, false }, + { 216630, true }, + { 216662, true }, + { 216673, true }, + { 216683, true }, + { 216696, true }, { 216705, true }, { 216718, true }, - { 216727, true }, + { 216729, true }, { 216740, true }, - { 216751, true }, - { 216762, true }, - { 216772, true }, - { 216779, true }, - { 216791, true }, - { 216804, false }, - { 216816, true }, - { 216836, true }, - { 216846, true }, - { 216859, true }, - { 216880, true }, - { 216897, true }, - { 216911, true }, - { 216928, true }, - { 216946, true }, - { 216953, true }, - { 216971, false }, - { 216989, false }, - { 217007, false }, + { 216750, true }, + { 216757, true }, + { 216769, true }, + { 216782, false }, + { 216794, true }, + { 216814, true }, + { 216824, true }, + { 216837, true }, + { 216858, true }, + { 216875, true }, + { 216889, true }, + { 216906, true }, + { 216924, true }, + { 216931, true }, + { 216949, false }, + { 216967, false }, + { 216985, false }, + { 217002, true }, { 217024, true }, - { 217046, true }, - { 217059, false }, - { 217074, false }, - { 217084, false }, - { 217098, true }, - { 217113, true }, - { 217125, true }, - { 217146, true }, - { 217164, true }, - { 217179, true }, - { 217207, true }, - { 217232, true }, - { 217250, true }, - { 217266, true }, - { 217276, true }, - { 217304, true }, - { 217319, true }, - { 217330, true }, - { 217340, true }, - { 217363, false }, - { 217381, true }, - { 217396, true }, - { 217408, true }, - { 217421, true }, - { 217450, true }, - { 217468, true }, - { 217487, true }, - { 217504, true }, - { 217514, true }, - { 217525, false }, - { 217540, true }, - { 217555, true }, - { 217573, true }, - { 217587, true }, - { 217602, true }, - { 217614, true }, - { 217637, true }, - { 217651, true }, - { 217676, true }, - { 217692, true }, - { 217716, true }, - { 217730, true }, - { 217741, true }, - { 217759, true }, - { 217783, true }, - { 217816, false }, - { 217839, true }, - { 217856, true }, - { 217874, true }, - { 217894, true }, - { 217904, true }, - { 217917, true }, - { 217930, true }, - { 217947, true }, - { 217958, true }, + { 217037, true }, + { 217050, false }, + { 217065, false }, + { 217075, false }, + { 217089, true }, + { 217104, true }, + { 217116, true }, + { 217137, true }, + { 217155, true }, + { 217170, true }, + { 217198, true }, + { 217223, true }, + { 217241, true }, + { 217257, true }, + { 217267, true }, + { 217295, true }, + { 217310, true }, + { 217321, true }, + { 217331, true }, + { 217354, false }, + { 217372, true }, + { 217387, true }, + { 217399, true }, + { 217412, true }, + { 217441, true }, + { 217459, true }, + { 217478, true }, + { 217495, true }, + { 217505, true }, + { 217516, true }, + { 217527, false }, + { 217542, true }, + { 217557, true }, + { 217575, true }, + { 217589, true }, + { 217604, true }, + { 217616, true }, + { 217639, true }, + { 217653, true }, + { 217678, true }, + { 217694, true }, + { 217718, true }, + { 217732, true }, + { 217743, true }, + { 217761, true }, + { 217785, true }, + { 217818, false }, + { 217841, true }, + { 217861, true }, + { 217878, true }, + { 217896, true }, + { 217916, true }, + { 217926, true }, + { 217939, true }, + { 217952, true }, { 217969, true }, + { 217980, true }, { 217991, true }, - { 218009, false }, - { 218023, true }, - { 218037, true }, - { 218055, true }, - { 218075, true }, - { 218089, true }, - { 218098, true }, - { 218114, true }, - { 218127, true }, - { 218145, true }, - { 218157, true }, - { 218172, true }, - { 218185, true }, - { 218197, true }, - { 218209, true }, - { 218220, true }, + { 218013, true }, + { 218031, false }, + { 218045, true }, + { 218059, true }, + { 218077, true }, + { 218097, true }, + { 218111, true }, + { 218120, true }, + { 218136, true }, + { 218149, true }, + { 218167, true }, + { 218179, true }, + { 218194, true }, + { 218207, true }, + { 218219, true }, { 218231, true }, - { 218240, true }, + { 218242, true }, { 218253, true }, - { 218267, true }, - { 218278, true }, - { 218292, true }, - { 218303, true }, - { 218316, true }, - { 218330, true }, - { 218340, false }, - { 218353, true }, - { 218362, true }, - { 218379, true }, - { 218389, true }, - { 218399, true }, - { 218412, true }, + { 218262, true }, + { 218275, true }, + { 218289, true }, + { 218300, true }, + { 218314, true }, + { 218325, true }, + { 218338, true }, + { 218352, true }, + { 218362, false }, + { 218375, true }, + { 218384, true }, + { 218401, true }, + { 218411, true }, { 218421, true }, - { 218431, true }, - { 218442, true }, - { 218452, true }, - { 218460, true }, - { 218468, false }, + { 218434, true }, + { 218443, true }, + { 218453, true }, + { 218464, true }, + { 218474, true }, { 218482, true }, { 218490, false }, - { 218510, true }, - { 218520, true }, - { 218534, true }, - { 218548, true }, - { 218558, true }, - { 218569, true }, - { 218581, true }, - { 218593, true }, + { 218504, true }, + { 218512, false }, + { 218532, true }, + { 218542, true }, + { 218556, true }, + { 218570, true }, + { 218580, true }, + { 218591, true }, { 218603, true }, - { 218612, true }, - { 218625, true }, - { 218637, true }, - { 218649, true }, - { 218660, true }, - { 218674, true }, - { 218686, true }, - { 218702, true }, - { 218717, true }, - { 218731, true }, - { 218740, true }, - { 218752, true }, - { 218762, true }, - { 218778, true }, - { 218793, true }, - { 218808, true }, - { 218824, true }, - { 218839, true }, - { 218861, true }, - { 218873, true }, - { 218880, true }, - { 218895, true }, + { 218614, true }, + { 218626, true }, + { 218636, true }, + { 218645, true }, + { 218658, true }, + { 218670, true }, + { 218682, true }, + { 218693, true }, + { 218707, true }, + { 218719, true }, + { 218735, true }, + { 218750, true }, + { 218764, true }, + { 218773, true }, + { 218785, true }, + { 218795, true }, + { 218811, true }, + { 218826, true }, + { 218841, true }, + { 218857, true }, + { 218872, true }, + { 218894, true }, { 218906, true }, - { 218916, true }, - { 218931, true }, - { 218942, true }, - { 218956, true }, - { 218970, true }, - { 218981, true }, - { 218994, true }, - { 219005, false }, - { 219020, true }, - { 219036, true }, - { 219045, true }, - { 219055, true }, - { 219062, true }, - { 219073, true }, - { 219085, true }, - { 219107, true }, - { 219119, true }, - { 219133, true }, - { 219156, true }, - { 219191, true }, - { 219227, true }, + { 218913, true }, + { 218928, true }, + { 218939, true }, + { 218949, true }, + { 218964, true }, + { 218975, true }, + { 218989, true }, + { 219003, true }, + { 219014, true }, + { 219027, true }, + { 219038, false }, + { 219053, true }, + { 219069, true }, + { 219078, true }, + { 219088, true }, + { 219095, true }, + { 219106, true }, + { 219118, true }, + { 219140, true }, + { 219152, true }, + { 219166, true }, + { 219189, true }, + { 219224, true }, { 219260, true }, - { 219298, true }, - { 219333, true }, - { 219368, true }, - { 219408, true }, - { 219444, true }, - { 219487, true }, - { 219513, true }, - { 219526, true }, - { 219535, true }, - { 219545, true }, - { 219555, true }, - { 219582, true }, - { 219591, true }, - { 219600, true }, - { 219617, true }, - { 219634, true }, - { 219646, true }, - { 219659, true }, - { 219672, true }, - { 219699, true }, - { 219706, true }, - { 219717, true }, - { 219734, true }, + { 219293, true }, + { 219331, true }, + { 219366, true }, + { 219401, true }, + { 219441, true }, + { 219477, true }, + { 219520, true }, + { 219546, true }, + { 219559, true }, + { 219568, true }, + { 219578, true }, + { 219588, true }, + { 219615, true }, + { 219624, true }, + { 219633, true }, + { 219650, true }, + { 219667, true }, + { 219679, true }, + { 219692, true }, + { 219705, true }, + { 219732, true }, + { 219739, true }, { 219750, true }, - { 219761, true }, - { 219773, true }, - { 219786, true }, - { 219810, true }, - { 219822, true }, - { 219829, true }, - { 219840, true }, - { 219848, true }, - { 219858, true }, - { 219865, true }, - { 219885, true }, - { 219897, true }, + { 219767, true }, + { 219783, true }, + { 219794, true }, + { 219806, true }, + { 219819, true }, + { 219843, true }, + { 219855, true }, + { 219862, true }, + { 219873, true }, + { 219881, true }, + { 219891, true }, + { 219898, true }, { 219918, true }, - { 219929, true }, - { 219941, true }, + { 219930, true }, { 219951, true }, - { 219963, true }, - { 219985, true }, - { 219994, true }, - { 220002, true }, - { 220011, true }, - { 220020, true }, - { 220039, true }, + { 219962, true }, + { 219974, true }, + { 219984, true }, + { 219996, true }, + { 220018, true }, + { 220027, true }, + { 220035, true }, + { 220044, true }, { 220053, true }, - { 220074, true }, - { 220087, true }, - { 220099, true }, - { 220123, true }, - { 220135, true }, - { 220153, true }, - { 220171, false }, - { 220185, true }, - { 220200, true }, - { 220215, true }, - { 220224, false }, - { 220241, true }, - { 220251, true }, - { 220265, true }, - { 220273, true }, + { 220072, true }, + { 220086, true }, + { 220107, true }, + { 220120, true }, + { 220132, true }, + { 220156, true }, + { 220168, true }, + { 220186, true }, + { 220204, false }, + { 220218, true }, + { 220233, true }, + { 220248, true }, + { 220257, false }, + { 220274, true }, { 220284, true }, - { 220299, true }, - { 220315, true }, - { 220338, true }, + { 220298, true }, + { 220306, true }, + { 220317, true }, + { 220332, true }, { 220348, true }, - { 220359, true }, - { 220369, true }, - { 220385, true }, - { 220396, true }, - { 220407, true }, - { 220419, true }, - { 220430, true }, - { 220444, true }, - { 220461, true }, + { 220371, true }, + { 220381, true }, + { 220392, true }, + { 220402, true }, + { 220418, true }, + { 220429, true }, + { 220440, true }, + { 220452, true }, + { 220463, true }, { 220477, true }, - { 220489, false }, - { 220508, true }, - { 220518, true }, - { 220536, true }, + { 220494, true }, + { 220510, true }, + { 220522, false }, + { 220541, true }, { 220551, true }, - { 220574, true }, - { 220585, true }, - { 220605, true }, - { 220622, true }, - { 220632, true }, - { 220648, true }, - { 220667, true }, - { 220682, true }, - { 220698, true }, + { 220569, true }, + { 220584, true }, + { 220607, true }, + { 220618, true }, + { 220638, true }, + { 220655, true }, + { 220665, true }, + { 220681, true }, + { 220700, true }, { 220715, true }, - { 220735, true }, - { 220747, true }, - { 220767, true }, - { 220782, true }, - { 220801, true }, - { 220810, true }, - { 220826, true }, + { 220731, true }, + { 220748, true }, + { 220768, true }, + { 220780, true }, + { 220800, true }, + { 220815, true }, + { 220834, true }, { 220843, true }, - { 220855, true }, - { 220867, true }, + { 220859, true }, { 220876, true }, - { 220886, true }, - { 220903, true }, - { 220921, true }, - { 220932, true }, - { 220940, true }, - { 220950, true }, + { 220888, true }, + { 220900, true }, + { 220909, true }, + { 220919, true }, + { 220936, true }, + { 220954, true }, { 220965, true }, - { 220975, true }, - { 220985, false }, - { 220992, true }, - { 221002, true }, - { 221023, true }, - { 221043, true }, - { 221066, true }, - { 221086, true }, - { 221102, true }, - { 221117, true }, + { 220973, true }, + { 220983, true }, + { 220998, true }, + { 221008, true }, + { 221018, false }, + { 221025, true }, + { 221035, true }, + { 221056, true }, + { 221076, true }, + { 221099, true }, + { 221119, true }, { 221135, true }, - { 221146, false }, - { 221170, true }, - { 221189, true }, - { 221202, true }, - { 221218, true }, - { 221234, true }, - { 221248, true }, - { 221260, false }, - { 221274, false }, - { 221287, true }, - { 221301, true }, - { 221319, true }, - { 221342, true }, - { 221365, true }, - { 221378, true }, - { 221390, true }, - { 221401, true }, - { 221412, true }, - { 221427, true }, - { 221452, true }, + { 221150, true }, + { 221168, true }, + { 221179, false }, + { 221203, true }, + { 221222, true }, + { 221235, true }, + { 221251, true }, + { 221267, true }, + { 221281, true }, + { 221293, false }, + { 221307, false }, + { 221320, true }, + { 221334, true }, + { 221352, true }, + { 221375, true }, + { 221398, true }, + { 221411, true }, + { 221423, true }, + { 221434, true }, + { 221445, true }, + { 221460, true }, { 221485, true }, - { 221511, true }, - { 221545, true }, - { 221568, true }, - { 221581, true }, - { 221597, true }, - { 221609, true }, - { 221621, true }, - { 221637, false }, - { 221657, true }, + { 221518, true }, + { 221544, true }, + { 221578, true }, + { 221601, true }, + { 221614, true }, + { 221630, true }, + { 221642, true }, + { 221654, true }, { 221670, false }, - { 221688, false }, - { 221711, true }, - { 221731, true }, - { 221747, true }, - { 221761, true }, - { 221782, true }, - { 221797, false }, - { 221810, true }, - { 221827, true }, - { 221841, true }, - { 221854, true }, - { 221866, true }, - { 221878, true }, - { 221894, true }, - { 221909, false }, - { 221931, true }, - { 221951, true }, - { 221963, true }, + { 221690, true }, + { 221703, false }, + { 221721, false }, + { 221744, true }, + { 221764, true }, + { 221780, true }, + { 221794, true }, + { 221815, true }, + { 221830, false }, + { 221843, true }, + { 221860, true }, + { 221874, true }, + { 221887, true }, + { 221899, true }, + { 221911, true }, + { 221927, true }, + { 221942, false }, + { 221964, true }, { 221984, true }, - { 222000, false }, - { 222012, true }, - { 222028, true }, - { 222046, true }, - { 222058, true }, - { 222072, true }, - { 222086, true }, - { 222103, true }, - { 222120, true }, - { 222134, true }, - { 222144, false }, - { 222158, true }, - { 222168, true }, - { 222189, true }, - { 222202, true }, - { 222220, true }, - { 222236, true }, - { 222249, true }, - { 222260, true }, - { 222273, true }, - { 222294, true }, - { 222314, true }, - { 222331, true }, - { 222343, true }, - { 222357, true }, - { 222367, true }, - { 222384, true }, - { 222394, true }, - { 222403, true }, - { 222421, true }, - { 222429, true }, - { 222445, true }, - { 222461, true }, - { 222477, true }, - { 222498, true }, - { 222509, true }, - { 222522, true }, - { 222547, true }, - { 222562, true }, - { 222582, true }, - { 222596, true }, - { 222611, true }, - { 222633, true }, - { 222653, true }, - { 222668, true }, - { 222678, true }, - { 222691, true }, - { 222709, true }, + { 221996, true }, + { 222017, true }, + { 222033, false }, + { 222045, true }, + { 222061, true }, + { 222079, true }, + { 222091, true }, + { 222105, true }, + { 222119, true }, + { 222136, true }, + { 222153, true }, + { 222167, true }, + { 222177, false }, + { 222191, true }, + { 222201, true }, + { 222222, true }, + { 222235, true }, + { 222253, true }, + { 222269, true }, + { 222282, true }, + { 222293, true }, + { 222306, true }, + { 222327, true }, + { 222347, true }, + { 222364, true }, + { 222376, true }, + { 222390, true }, + { 222400, true }, + { 222417, true }, + { 222427, true }, + { 222436, true }, + { 222454, true }, + { 222462, true }, + { 222478, true }, + { 222494, true }, + { 222510, true }, + { 222531, true }, + { 222542, true }, + { 222555, true }, + { 222580, true }, + { 222595, true }, + { 222615, true }, + { 222629, true }, + { 222644, true }, + { 222666, true }, + { 222686, true }, + { 222701, true }, + { 222711, true }, { 222724, true }, - { 222740, true }, - { 222756, true }, - { 222772, true }, - { 222781, false }, - { 222791, true }, - { 222803, true }, - { 222820, true }, - { 222832, true }, - { 222848, true }, - { 222864, true }, + { 222742, true }, + { 222757, true }, + { 222773, true }, + { 222789, true }, + { 222805, true }, + { 222814, false }, + { 222824, true }, + { 222836, true }, + { 222853, true }, + { 222865, true }, { 222881, true }, - { 222902, true }, + { 222897, true }, { 222914, true }, - { 222926, true }, - { 222945, false }, - { 222957, true }, - { 222969, true }, - { 222979, true }, - { 222994, true }, - { 223006, true }, - { 223020, true }, - { 223044, true }, - { 223056, true }, - { 223088, true }, - { 223109, true }, - { 223140, true }, - { 223165, true }, - { 223188, true }, - { 223199, true }, - { 223211, true }, - { 223226, true }, - { 223239, true }, - { 223252, true }, - { 223265, true }, - { 223275, true }, - { 223304, true }, - { 223327, true }, - { 223351, true }, - { 223378, true }, - { 223392, true }, - { 223415, true }, - { 223441, true }, - { 223469, true }, - { 223500, true }, - { 223525, true }, + { 222935, true }, + { 222947, true }, + { 222959, true }, + { 222978, false }, + { 222990, true }, + { 223002, true }, + { 223012, true }, + { 223027, true }, + { 223039, true }, + { 223053, true }, + { 223077, true }, + { 223089, true }, + { 223121, true }, + { 223142, true }, + { 223173, true }, + { 223198, true }, + { 223221, true }, + { 223232, true }, + { 223244, true }, + { 223259, true }, + { 223272, true }, + { 223285, true }, + { 223298, true }, + { 223308, true }, + { 223337, true }, + { 223360, true }, + { 223384, true }, + { 223411, true }, + { 223425, true }, + { 223448, true }, + { 223474, true }, + { 223502, true }, { 223533, true }, - { 223540, true }, - { 223552, true }, - { 223560, true }, - { 223572, true }, - { 223594, true }, - { 223607, true }, - { 223628, true }, - { 223641, true }, - { 223662, true }, - { 223681, true }, - { 223702, true }, - { 223721, true }, - { 223732, true }, - { 223745, true }, - { 223761, false }, - { 223777, true }, - { 223785, true }, - { 223800, true }, - { 223817, false }, - { 223832, true }, - { 223848, true }, - { 223858, true }, - { 223870, true }, - { 223886, true }, - { 223900, false }, - { 223909, true }, - { 223921, true }, - { 223934, true }, - { 223949, true }, - { 223971, true }, - { 223988, true }, - { 224010, true }, - { 224032, true }, - { 224046, true }, - { 224060, true }, - { 224067, true }, - { 224080, true }, - { 224093, true }, - { 224119, true }, + { 223558, true }, + { 223566, true }, + { 223573, true }, + { 223585, true }, + { 223593, true }, + { 223605, true }, + { 223627, true }, + { 223640, true }, + { 223661, true }, + { 223674, true }, + { 223695, true }, + { 223714, true }, + { 223735, true }, + { 223754, true }, + { 223765, true }, + { 223778, true }, + { 223794, false }, + { 223810, true }, + { 223818, true }, + { 223833, true }, + { 223850, false }, + { 223865, true }, + { 223881, true }, + { 223891, true }, + { 223903, true }, + { 223919, true }, + { 223933, false }, + { 223942, true }, + { 223954, true }, + { 223967, true }, + { 223985, true }, + { 224000, true }, + { 224022, true }, + { 224039, true }, + { 224061, true }, + { 224083, true }, + { 224097, true }, + { 224111, true }, + { 224118, true }, { 224131, true }, - { 224142, true }, - { 224168, true }, - { 224178, true }, - { 224188, false }, - { 224205, true }, - { 224217, true }, - { 224232, true }, - { 224241, true }, - { 224254, true }, - { 224264, true }, - { 224278, true }, - { 224295, true }, - { 224308, true }, - { 224320, true }, - { 224331, true }, - { 224341, true }, - { 224354, false }, - { 224370, true }, - { 224386, true }, - { 224400, false }, - { 224415, true }, - { 224428, false }, - { 224445, true }, - { 224459, true }, - { 224473, true }, - { 224487, true }, - { 224511, true }, + { 224144, true }, + { 224170, true }, + { 224182, true }, + { 224193, true }, + { 224219, true }, + { 224229, true }, + { 224239, false }, + { 224256, true }, + { 224268, true }, + { 224283, true }, + { 224292, true }, + { 224305, true }, + { 224315, true }, + { 224329, true }, + { 224346, true }, + { 224359, true }, + { 224371, true }, + { 224382, true }, + { 224392, true }, + { 224405, false }, + { 224421, true }, + { 224437, true }, + { 224451, false }, + { 224466, true }, + { 224479, false }, + { 224496, true }, + { 224510, true }, { 224524, true }, - { 224537, true }, - { 224551, true }, - { 224565, true }, - { 224580, true }, - { 224596, true }, - { 224611, true }, - { 224626, true }, - { 224644, true }, - { 224667, true }, - { 224679, true }, - { 224691, true }, - { 224710, true }, - { 224726, true }, - { 224741, true }, - { 224765, true }, - { 224782, true }, - { 224800, true }, - { 224819, true }, - { 224834, true }, - { 224846, true }, - { 224863, true }, - { 224877, true }, - { 224894, true }, - { 224903, true }, - { 224916, true }, - { 224930, true }, - { 224945, true }, - { 224957, false }, - { 224970, true }, - { 224984, true }, - { 224997, true }, - { 225009, true }, - { 225021, false }, - { 225040, true }, - { 225062, true }, - { 225077, true }, - { 225096, true }, - { 225110, false }, - { 225121, true }, - { 225136, true }, - { 225152, true }, - { 225166, true }, - { 225178, true }, - { 225195, true }, - { 225213, true }, - { 225224, true }, - { 225231, true }, - { 225243, true }, - { 225251, true }, - { 225261, true }, - { 225271, true }, - { 225286, true }, - { 225305, true }, - { 225321, false }, - { 225331, true }, - { 225338, false }, - { 225350, true }, - { 225359, true }, - { 225373, true }, - { 225385, true }, - { 225393, true }, - { 225400, true }, - { 225410, true }, - { 225422, true }, - { 225433, true }, - { 225452, true }, - { 225460, true }, - { 225468, false }, - { 225480, true }, + { 224538, true }, + { 224562, true }, + { 224575, true }, + { 224588, true }, + { 224602, true }, + { 224616, true }, + { 224631, true }, + { 224647, true }, + { 224662, true }, + { 224677, true }, + { 224695, true }, + { 224718, true }, + { 224730, true }, + { 224742, true }, + { 224761, true }, + { 224777, true }, + { 224792, true }, + { 224816, true }, + { 224833, true }, + { 224851, true }, + { 224870, true }, + { 224890, true }, + { 224905, true }, + { 224917, true }, + { 224934, true }, + { 224948, true }, + { 224965, true }, + { 224974, true }, + { 224987, true }, + { 225001, true }, + { 225016, true }, + { 225028, false }, + { 225041, true }, + { 225055, true }, + { 225068, true }, + { 225080, true }, + { 225092, false }, + { 225111, true }, + { 225133, true }, + { 225148, true }, + { 225167, true }, + { 225181, false }, + { 225192, true }, + { 225207, true }, + { 225223, true }, + { 225237, true }, + { 225249, true }, + { 225266, true }, + { 225284, true }, + { 225295, true }, + { 225302, true }, + { 225314, true }, + { 225322, true }, + { 225332, true }, + { 225342, true }, + { 225357, true }, + { 225376, true }, + { 225392, false }, + { 225402, true }, + { 225409, false }, + { 225421, true }, + { 225430, true }, + { 225444, true }, + { 225456, true }, + { 225464, true }, + { 225471, true }, + { 225481, true }, { 225493, true }, - { 225508, true }, - { 225530, true }, - { 225542, true }, - { 225560, true }, - { 225576, true }, - { 225585, false }, - { 225602, true }, - { 225623, true }, - { 225644, true }, + { 225504, true }, + { 225523, true }, + { 225531, true }, + { 225539, false }, + { 225551, true }, + { 225564, true }, + { 225579, true }, + { 225601, true }, + { 225613, true }, + { 225631, true }, + { 225647, true }, { 225656, true }, - { 225672, true }, - { 225697, true }, - { 225723, true }, - { 225749, true }, - { 225760, true }, - { 225772, true }, - { 225785, true }, - { 225798, true }, - { 225808, true }, - { 225817, true }, - { 225831, true }, - { 225851, true }, - { 225866, true }, - { 225882, true }, - { 225892, true }, - { 225904, true }, - { 225924, true }, + { 225677, true }, + { 225698, true }, + { 225710, true }, + { 225726, true }, + { 225751, true }, + { 225777, true }, + { 225803, true }, + { 225814, true }, + { 225826, true }, + { 225839, true }, + { 225852, true }, + { 225862, true }, + { 225871, true }, + { 225885, true }, + { 225905, true }, + { 225920, true }, + { 225936, true }, { 225946, true }, - { 225965, true }, - { 225979, true }, - { 225998, true }, - { 226010, true }, - { 226034, true }, - { 226051, false }, + { 225958, true }, + { 225978, true }, + { 226000, true }, + { 226013, true }, + { 226032, true }, + { 226046, true }, { 226065, true }, - { 226078, true }, - { 226091, true }, - { 226110, true }, - { 226128, true }, - { 226140, true }, - { 226155, true }, - { 226170, true }, - { 226191, true }, - { 226216, true }, - { 226241, true }, - { 226257, true }, - { 226283, true }, - { 226303, true }, - { 226316, true }, - { 226332, true }, - { 226345, true }, - { 226357, true }, - { 226375, true }, - { 226389, true }, - { 226408, true }, - { 226419, true }, - { 226431, true }, - { 226441, true }, - { 226450, true }, + { 226077, true }, + { 226101, true }, + { 226118, false }, + { 226132, true }, + { 226145, true }, + { 226158, true }, + { 226177, true }, + { 226199, true }, + { 226217, true }, + { 226229, true }, + { 226244, true }, + { 226259, true }, + { 226280, true }, + { 226305, true }, + { 226330, true }, + { 226346, true }, + { 226372, true }, + { 226392, true }, + { 226405, true }, + { 226421, true }, + { 226434, true }, + { 226446, true }, { 226464, true }, - { 226481, true }, - { 226492, true }, - { 226503, true }, - { 226511, true }, - { 226523, true }, - { 226536, true }, - { 226550, true }, - { 226567, true }, - { 226578, false }, - { 226590, true }, - { 226609, true }, - { 226622, true }, - { 226633, true }, - { 226644, true }, - { 226655, true }, - { 226668, true }, + { 226478, true }, + { 226497, true }, + { 226508, true }, + { 226520, true }, + { 226530, true }, + { 226539, true }, + { 226553, true }, + { 226570, true }, + { 226581, true }, + { 226592, true }, + { 226600, true }, + { 226612, true }, + { 226625, true }, + { 226639, true }, + { 226656, true }, + { 226667, false }, { 226679, true }, - { 226691, true }, - { 226701, true }, - { 226707, true }, - { 226717, true }, - { 226737, true }, - { 226747, true }, - { 226770, true }, - { 226782, true }, - { 226801, true }, - { 226809, true }, - { 226817, true }, - { 226831, true }, - { 226843, true }, - { 226858, false }, + { 226698, true }, + { 226711, true }, + { 226722, true }, + { 226733, true }, + { 226744, true }, + { 226757, true }, + { 226768, true }, + { 226780, true }, + { 226790, true }, + { 226796, true }, + { 226806, true }, + { 226826, true }, + { 226836, true }, + { 226859, true }, { 226871, true }, - { 226884, true }, - { 226895, true }, + { 226890, true }, + { 226898, true }, { 226906, true }, - { 226922, true }, - { 226936, true }, - { 226946, true }, + { 226920, true }, + { 226932, true }, + { 226947, false }, { 226960, true }, - { 226967, true }, - { 226980, true }, - { 226997, true }, - { 227007, true }, - { 227015, true }, - { 227027, true }, - { 227043, true }, - { 227058, true }, - { 227068, true }, - { 227093, true }, - { 227101, true }, - { 227113, false }, - { 227124, false }, - { 227142, false }, - { 227155, true }, - { 227170, true }, - { 227184, true }, - { 227198, true }, - { 227215, true }, - { 227232, true }, - { 227247, true }, - { 227265, true }, - { 227283, true }, - { 227301, true }, - { 227315, true }, - { 227329, true }, - { 227343, true }, - { 227357, true }, - { 227371, false }, - { 227389, false }, - { 227412, false }, - { 227433, false }, - { 227452, true }, - { 227468, false }, - { 227484, false }, - { 227500, true }, - { 227522, true }, - { 227535, false }, - { 227552, false }, - { 227569, true }, - { 227586, false }, - { 227603, false }, - { 227617, false }, - { 227636, false }, - { 227647, false }, - { 227659, false }, - { 227671, false }, - { 227690, true }, - { 227708, false }, - { 227722, true }, - { 227738, false }, - { 227755, false }, - { 227772, false }, - { 227787, false }, - { 227803, true }, - { 227824, false }, - { 227843, false }, + { 226973, true }, + { 226984, true }, + { 226995, true }, + { 227011, true }, + { 227025, true }, + { 227035, true }, + { 227049, true }, + { 227056, true }, + { 227069, true }, + { 227086, true }, + { 227096, true }, + { 227104, true }, + { 227116, true }, + { 227132, true }, + { 227147, true }, + { 227157, true }, + { 227182, true }, + { 227190, true }, + { 227202, false }, + { 227213, false }, + { 227231, false }, + { 227244, true }, + { 227259, true }, + { 227273, true }, + { 227287, true }, + { 227304, true }, + { 227321, true }, + { 227336, true }, + { 227354, true }, + { 227372, true }, + { 227390, true }, + { 227404, true }, + { 227418, true }, + { 227432, true }, + { 227446, true }, + { 227460, false }, + { 227478, false }, + { 227501, false }, + { 227522, false }, + { 227541, true }, + { 227557, false }, + { 227573, false }, + { 227589, true }, + { 227611, true }, + { 227624, false }, + { 227641, false }, + { 227658, true }, + { 227675, false }, + { 227692, false }, + { 227706, false }, + { 227725, false }, + { 227736, false }, + { 227748, false }, + { 227760, false }, + { 227779, true }, + { 227797, false }, + { 227811, true }, + { 227827, false }, + { 227844, false }, { 227861, false }, - { 227881, true }, - { 227897, false }, - { 227912, true }, - { 227927, false }, - { 227951, true }, - { 227958, true }, - { 227977, false }, - { 227995, false }, - { 228010, true }, - { 228030, true }, - { 228051, false }, - { 228075, false }, - { 228094, false }, - { 228110, false }, - { 228125, false }, - { 228138, true }, - { 228154, false }, - { 228169, false }, + { 227876, false }, + { 227892, true }, + { 227913, false }, + { 227932, false }, + { 227950, false }, + { 227970, true }, + { 227986, false }, + { 228001, true }, + { 228016, false }, + { 228040, true }, + { 228047, true }, + { 228066, false }, + { 228084, false }, + { 228099, true }, + { 228119, true }, + { 228140, false }, + { 228164, false }, { 228183, false }, - { 228201, true }, - { 228212, true }, - { 228223, true }, - { 228231, true }, - { 228239, true }, - { 228254, true }, - { 228264, true }, - { 228277, true }, - { 228294, true }, - { 228310, true }, - { 228322, true }, - { 228330, true }, - { 228341, true }, - { 228351, true }, - { 228361, true }, - { 228377, true }, - { 228382, true }, - { 228387, true }, - { 228397, true }, - { 228405, true }, - { 228414, true }, - { 228422, true }, - { 228442, true }, - { 228449, true }, - { 228468, true }, - { 228475, true }, - { 228482, true }, - { 228489, true }, - { 228498, true }, - { 228519, true }, - { 228539, true }, - { 228563, true }, - { 228570, true }, - { 228580, true }, - { 228593, true }, - { 228610, true }, - { 228630, true }, - { 228636, true }, - { 228643, true }, - { 228655, true }, - { 228668, true }, - { 228683, false }, - { 228694, true }, - { 228705, true }, - { 228713, false }, + { 228199, false }, + { 228214, false }, + { 228227, true }, + { 228243, false }, + { 228258, false }, + { 228272, false }, + { 228290, true }, + { 228301, true }, + { 228312, true }, + { 228320, true }, + { 228328, true }, + { 228343, true }, + { 228353, true }, + { 228366, true }, + { 228383, true }, + { 228399, true }, + { 228411, true }, + { 228419, true }, + { 228430, true }, + { 228440, true }, + { 228450, true }, + { 228466, true }, + { 228471, true }, + { 228476, true }, + { 228486, true }, + { 228494, true }, + { 228503, true }, + { 228511, true }, + { 228531, true }, + { 228538, true }, + { 228557, true }, + { 228564, true }, + { 228571, true }, + { 228578, true }, + { 228587, true }, + { 228608, true }, + { 228628, true }, + { 228652, true }, + { 228659, true }, + { 228669, true }, + { 228682, true }, + { 228699, true }, + { 228719, true }, + { 228725, true }, { 228732, true }, - { 228743, true }, - { 228754, true }, - { 228761, true }, - { 228772, true }, - { 228784, true }, - { 228803, true }, - { 228819, true }, - { 228831, true }, - { 228842, true }, - { 228855, true }, - { 228871, true }, - { 228885, true }, - { 228900, true }, - { 228915, true }, - { 228925, true }, - { 228935, true }, - { 228946, false }, - { 228956, true }, - { 228966, true }, - { 228977, true }, - { 228985, true }, - { 228993, true }, - { 229003, true }, - { 229012, false }, - { 229026, true }, - { 229036, true }, - { 229047, true }, + { 228744, true }, + { 228757, true }, + { 228772, false }, + { 228783, true }, + { 228794, true }, + { 228802, false }, + { 228821, true }, + { 228832, true }, + { 228843, true }, + { 228850, true }, + { 228861, true }, + { 228873, true }, + { 228892, true }, + { 228908, true }, + { 228920, true }, + { 228931, true }, + { 228944, true }, + { 228960, true }, + { 228974, true }, + { 228989, true }, + { 229004, true }, + { 229014, true }, + { 229024, true }, + { 229035, false }, + { 229045, true }, { 229055, true }, - { 229067, true }, - { 229078, true }, - { 229089, true }, - { 229101, true }, - { 229111, true }, - { 229119, true }, - { 229126, true }, - { 229133, true }, - { 229140, true }, - { 229158, true }, - { 229184, true }, - { 229210, true }, - { 229233, true }, - { 229264, true }, - { 229275, true }, - { 229291, true }, - { 229303, true }, + { 229066, true }, + { 229074, true }, + { 229082, true }, + { 229092, true }, + { 229101, false }, + { 229115, true }, + { 229125, true }, + { 229136, true }, + { 229144, true }, + { 229156, true }, + { 229167, true }, + { 229178, true }, + { 229190, true }, + { 229200, true }, + { 229208, true }, + { 229215, true }, + { 229222, true }, + { 229229, true }, + { 229247, true }, + { 229273, true }, + { 229299, true }, { 229322, true }, - { 229348, true }, - { 229371, true }, - { 229390, true }, - { 229415, true }, - { 229440, true }, - { 229464, true }, - { 229504, true }, - { 229534, true }, - { 229545, true }, - { 229564, true }, - { 229595, true }, - { 229606, false }, - { 229627, true }, - { 229645, true }, - { 229663, true }, - { 229681, true }, - { 229718, true }, - { 229741, true }, - { 229769, true }, - { 229784, true }, - { 229811, true }, - { 229825, true }, - { 229847, true }, - { 229872, true }, - { 229914, true }, - { 229933, true }, - { 229956, true }, - { 229972, true }, - { 230006, true }, - { 230030, true }, - { 230037, false }, - { 230044, true }, - { 230050, true }, - { 230061, true }, - { 230071, true }, - { 230081, true }, - { 230088, true }, - { 230095, true }, - { 230108, true }, - { 230115, true }, - { 230124, true }, - { 230138, true }, - { 230148, true }, - { 230158, true }, - { 230171, true }, + { 229353, true }, + { 229364, true }, + { 229380, true }, + { 229392, true }, + { 229411, true }, + { 229435, true }, + { 229461, true }, + { 229484, true }, + { 229503, true }, + { 229528, true }, + { 229553, true }, + { 229577, true }, + { 229617, true }, + { 229647, true }, + { 229658, true }, + { 229677, true }, + { 229708, true }, + { 229719, false }, + { 229740, true }, + { 229758, true }, + { 229776, true }, + { 229794, true }, + { 229831, true }, + { 229854, true }, + { 229882, true }, + { 229897, true }, + { 229924, true }, + { 229938, true }, + { 229960, true }, + { 229985, true }, + { 230027, true }, + { 230046, true }, + { 230069, true }, + { 230085, true }, + { 230119, true }, + { 230143, true }, + { 230150, false }, + { 230157, true }, + { 230163, true }, + { 230174, true }, { 230184, true }, - { 230191, true }, - { 230198, true }, - { 230207, true }, - { 230214, true }, - { 230225, true }, - { 230234, true }, - { 230245, true }, + { 230194, true }, + { 230201, true }, + { 230208, true }, + { 230221, true }, + { 230228, true }, + { 230237, true }, + { 230251, true }, { 230261, true }, - { 230270, true }, - { 230283, true }, - { 230290, true }, - { 230300, true }, - { 230308, true }, - { 230319, true }, - { 230328, true }, + { 230271, true }, + { 230284, true }, + { 230297, true }, + { 230304, true }, + { 230311, true }, + { 230320, true }, + { 230327, true }, { 230338, true }, - { 230353, true }, - { 230363, true }, - { 230372, true }, - { 230392, true }, + { 230347, true }, + { 230358, true }, + { 230374, true }, + { 230383, true }, + { 230396, true }, { 230403, true }, - { 230414, true }, - { 230428, true }, - { 230437, true }, - { 230453, true }, - { 230460, true }, - { 230472, true }, - { 230482, true }, - { 230489, true }, - { 230500, true }, - { 230512, true }, - { 230522, false }, - { 230534, true }, - { 230548, true }, - { 230561, true }, - { 230577, true }, - { 230592, true }, - { 230604, true }, - { 230617, false }, - { 230627, true }, - { 230639, true }, - { 230652, true }, - { 230674, true }, - { 230686, true }, - { 230698, true }, - { 230708, true }, - { 230716, true }, - { 230725, true }, - { 230737, true }, - { 230747, false }, - { 230755, true }, - { 230765, true }, - { 230774, true }, - { 230794, true }, - { 230809, true }, - { 230825, false }, - { 230840, false }, - { 230853, true }, + { 230413, true }, + { 230421, true }, + { 230432, true }, + { 230441, true }, + { 230451, true }, + { 230466, true }, + { 230476, true }, + { 230485, true }, + { 230505, true }, + { 230516, true }, + { 230527, true }, + { 230541, true }, + { 230550, true }, + { 230566, true }, + { 230573, true }, + { 230585, true }, + { 230595, true }, + { 230602, true }, + { 230614, true }, + { 230624, false }, + { 230636, true }, + { 230650, true }, + { 230663, true }, + { 230679, true }, + { 230694, true }, + { 230706, true }, + { 230719, false }, + { 230729, true }, + { 230741, true }, + { 230754, true }, + { 230776, true }, + { 230788, true }, + { 230800, true }, + { 230810, true }, + { 230818, true }, + { 230827, true }, + { 230839, true }, + { 230849, false }, + { 230857, true }, { 230867, true }, - { 230877, false }, - { 230886, true }, - { 230893, true }, - { 230909, true }, - { 230919, true }, - { 230928, true }, - { 230936, true }, - { 230945, true }, - { 230956, true }, - { 230970, true }, - { 230981, true }, - { 231003, true }, + { 230876, true }, + { 230896, true }, + { 230911, true }, + { 230927, false }, + { 230942, false }, + { 230955, true }, + { 230969, true }, + { 230979, false }, + { 230988, true }, + { 230995, true }, + { 231011, true }, { 231018, true }, - { 231025, true }, - { 231036, true }, - { 231044, true }, + { 231028, true }, + { 231037, true }, + { 231045, true }, { 231054, true }, - { 231067, true }, - { 231085, true }, - { 231097, false }, - { 231106, true }, - { 231120, true }, - { 231136, true }, - { 231160, true }, - { 231178, true }, - { 231189, true }, - { 231201, false }, - { 231216, true }, - { 231226, true }, - { 231238, true }, - { 231258, false }, - { 231268, true }, - { 231292, true }, - { 231303, true }, - { 231313, true }, + { 231065, true }, + { 231079, true }, + { 231090, true }, + { 231112, true }, + { 231127, true }, + { 231134, true }, + { 231145, true }, + { 231153, true }, + { 231163, true }, + { 231176, true }, + { 231194, true }, + { 231206, false }, + { 231215, true }, + { 231229, true }, + { 231245, true }, + { 231269, true }, + { 231287, true }, + { 231298, true }, + { 231310, false }, { 231325, true }, - { 231338, true }, - { 231355, true }, - { 231370, true }, - { 231383, true }, - { 231397, true }, + { 231335, true }, + { 231347, true }, + { 231367, false }, + { 231377, true }, + { 231401, true }, { 231412, true }, - { 231427, true }, - { 231439, true }, - { 231451, true }, - { 231465, true }, - { 231477, true }, - { 231488, true }, - { 231498, true }, - { 231510, true }, - { 231523, true }, - { 231543, true }, - { 231561, true }, + { 231422, true }, + { 231434, true }, + { 231447, true }, + { 231464, true }, + { 231479, true }, + { 231492, true }, + { 231506, true }, + { 231521, true }, + { 231536, true }, + { 231548, true }, + { 231560, true }, { 231574, true }, - { 231589, true }, - { 231604, true }, - { 231616, true }, - { 231625, true }, - { 231636, true }, - { 231658, true }, - { 231674, true }, - { 231694, true }, - { 231703, true }, - { 231711, true }, - { 231719, true }, - { 231732, true }, - { 231744, true }, - { 231756, true }, - { 231771, true }, - { 231781, true }, - { 231792, true }, - { 231808, true }, - { 231817, true }, - { 231826, true }, - { 231835, true }, - { 231850, true }, - { 231869, true }, - { 231882, true }, - { 231895, true }, - { 231904, true }, - { 231915, true }, - { 231929, true }, - { 231941, true }, + { 231586, true }, + { 231597, true }, + { 231607, true }, + { 231619, true }, + { 231632, true }, + { 231652, true }, + { 231670, true }, + { 231683, true }, + { 231698, true }, + { 231713, true }, + { 231725, true }, + { 231734, true }, + { 231745, true }, + { 231767, true }, + { 231783, true }, + { 231803, true }, + { 231812, true }, + { 231820, true }, + { 231828, true }, + { 231841, true }, + { 231853, true }, + { 231865, true }, + { 231880, true }, + { 231890, true }, + { 231901, true }, + { 231917, true }, + { 231926, true }, + { 231935, true }, + { 231944, true }, { 231959, true }, - { 231972, true }, - { 231980, true }, - { 231994, true }, - { 232006, true }, - { 232016, true }, - { 232023, true }, - { 232031, true }, - { 232039, true }, - { 232049, true }, - { 232058, true }, + { 231978, true }, + { 231991, true }, + { 232004, true }, + { 232013, true }, + { 232024, true }, + { 232038, true }, + { 232050, true }, + { 232068, true }, { 232081, true }, - { 232094, true }, - { 232099, true }, - { 232109, true }, - { 232116, true }, - { 232123, true }, - { 232135, false }, - { 232154, true }, - { 232165, true }, - { 232181, true }, - { 232196, true }, - { 232211, true }, - { 232224, true }, - { 232237, true }, - { 232245, true }, - { 232255, true }, - { 232265, true }, - { 232280, true }, - { 232294, true }, - { 232322, true }, - { 232335, true }, - { 232348, true }, - { 232365, true }, - { 232373, true }, - { 232382, true }, - { 232395, true }, - { 232407, true }, - { 232414, true }, + { 232089, true }, + { 232103, true }, + { 232115, true }, + { 232125, true }, + { 232132, true }, + { 232140, true }, + { 232148, true }, + { 232158, true }, + { 232167, true }, + { 232190, true }, + { 232203, true }, + { 232208, true }, + { 232218, true }, + { 232225, true }, + { 232232, true }, + { 232244, false }, + { 232263, true }, + { 232274, true }, + { 232290, true }, + { 232305, true }, + { 232320, true }, + { 232333, true }, + { 232346, true }, + { 232354, true }, + { 232364, true }, + { 232374, true }, + { 232389, true }, + { 232403, true }, + { 232431, true }, { 232444, true }, - { 232455, true }, - { 232473, true }, - { 232497, true }, - { 232507, true }, - { 232519, true }, - { 232530, true }, - { 232542, true }, - { 232560, true }, - { 232569, true }, - { 232580, true }, - { 232592, true }, - { 232600, true }, - { 232607, true }, - { 232615, true }, - { 232626, true }, + { 232457, true }, + { 232474, true }, + { 232482, true }, + { 232491, true }, + { 232504, true }, + { 232516, true }, + { 232523, true }, + { 232553, true }, + { 232564, true }, + { 232582, true }, + { 232590, true }, + { 232614, true }, + { 232624, true }, { 232636, true }, - { 232645, true }, - { 232671, true }, - { 232683, true }, - { 232692, true }, + { 232647, true }, + { 232659, true }, + { 232677, true }, + { 232686, true }, + { 232697, true }, + { 232709, true }, { 232717, true }, - { 232737, true }, - { 232759, true }, - { 232770, true }, - { 232781, true }, - { 232793, true }, - { 232806, true }, - { 232821, true }, - { 232839, true }, - { 232852, true }, - { 232867, true }, - { 232883, true }, - { 232901, true }, - { 232915, true }, - { 232925, true }, - { 232937, true }, - { 232945, true }, - { 232957, true }, + { 232724, true }, + { 232732, true }, + { 232743, true }, + { 232753, true }, + { 232762, true }, + { 232788, true }, + { 232800, true }, + { 232809, true }, + { 232834, true }, + { 232854, true }, + { 232876, true }, + { 232887, true }, + { 232898, true }, + { 232910, true }, + { 232923, true }, + { 232938, true }, + { 232956, true }, { 232969, true }, - { 232980, true }, - { 232992, true }, - { 233005, true }, - { 233016, true }, - { 233029, true }, - { 233041, true }, - { 233053, false }, - { 233063, true }, + { 232984, true }, + { 233000, true }, + { 233018, true }, + { 233032, true }, + { 233042, true }, + { 233054, true }, + { 233062, true }, { 233074, true }, - { 233089, true }, - { 233102, true }, - { 233113, true }, - { 233123, true }, - { 233130, true }, - { 233144, true }, - { 233156, true }, - { 233168, true }, - { 233184, true }, - { 233199, true }, - { 233212, true }, - { 233224, true }, - { 233237, true }, - { 233252, true }, - { 233259, true }, - { 233274, false }, - { 233287, true }, - { 233299, true }, - { 233308, true }, - { 233320, true }, - { 233328, true }, - { 233343, true }, - { 233358, true }, - { 233367, false }, - { 233375, true }, - { 233386, true }, - { 233394, true }, - { 233405, true }, + { 233086, true }, + { 233097, true }, + { 233109, true }, + { 233122, true }, + { 233133, true }, + { 233146, true }, + { 233158, true }, + { 233170, false }, + { 233180, true }, + { 233191, true }, + { 233206, true }, + { 233219, true }, + { 233230, true }, + { 233240, true }, + { 233247, true }, + { 233261, true }, + { 233273, true }, + { 233285, true }, + { 233301, true }, + { 233316, true }, + { 233329, true }, + { 233341, true }, + { 233354, true }, + { 233369, true }, + { 233376, true }, + { 233391, false }, + { 233404, true }, { 233416, true }, - { 233431, true }, - { 233448, true }, - { 233462, false }, - { 233474, true }, - { 233493, true }, + { 233425, true }, + { 233437, true }, + { 233445, true }, + { 233460, true }, + { 233475, true }, + { 233484, false }, + { 233492, true }, + { 233503, true }, { 233511, true }, { 233522, true }, - { 233542, true }, - { 233558, true }, - { 233573, true }, - { 233585, true }, - { 233595, true }, - { 233602, true }, - { 233613, true }, - { 233623, true }, - { 233629, true }, + { 233533, true }, + { 233548, true }, + { 233565, true }, + { 233579, false }, + { 233591, true }, + { 233610, true }, + { 233628, true }, { 233639, true }, - { 233654, true }, - { 233666, true }, - { 233678, true }, - { 233693, true }, - { 233704, true }, - { 233717, true }, - { 233724, true }, - { 233735, true }, + { 233659, true }, + { 233675, true }, + { 233690, true }, + { 233702, true }, + { 233712, true }, + { 233719, true }, + { 233730, true }, + { 233740, true }, { 233746, true }, - { 233757, true }, - { 233768, true }, + { 233756, true }, + { 233771, true }, { 233783, true }, - { 233807, true }, - { 233825, true }, - { 233838, true }, - { 233849, true }, - { 233864, true }, - { 233880, true }, - { 233889, true }, + { 233795, true }, + { 233810, true }, + { 233821, true }, + { 233834, true }, + { 233841, true }, + { 233852, true }, + { 233863, true }, + { 233874, true }, + { 233885, true }, { 233900, true }, - { 233916, true }, - { 233940, true }, + { 233924, true }, + { 233942, true }, { 233955, true }, { 233966, true }, - { 233976, true }, - { 233984, true }, - { 234001, true }, - { 234020, true }, - { 234031, true }, - { 234041, true }, - { 234051, true }, - { 234062, true }, - { 234070, true }, - { 234084, false }, - { 234091, true }, - { 234103, true }, - { 234112, true }, - { 234126, true }, - { 234134, true }, - { 234147, true }, - { 234161, true }, - { 234182, true }, - { 234196, true }, - { 234203, true }, - { 234214, true }, - { 234224, true }, - { 234237, true }, - { 234245, true }, - { 234254, true }, - { 234267, true }, - { 234280, true }, - { 234293, true }, - { 234303, true }, - { 234314, true }, - { 234324, true }, - { 234333, true }, - { 234343, true }, + { 233981, true }, + { 233997, true }, + { 234006, true }, + { 234017, true }, + { 234033, true }, + { 234057, true }, + { 234072, true }, + { 234083, true }, + { 234093, true }, + { 234101, true }, + { 234118, true }, + { 234137, true }, + { 234148, true }, + { 234158, true }, + { 234168, true }, + { 234179, true }, + { 234187, true }, + { 234201, false }, + { 234208, true }, + { 234220, true }, + { 234229, true }, + { 234243, true }, + { 234251, true }, + { 234264, true }, + { 234278, true }, + { 234299, true }, + { 234313, true }, + { 234320, true }, + { 234331, true }, + { 234341, true }, + { 234351, true }, + { 234364, true }, + { 234372, true }, + { 234381, true }, + { 234394, true }, + { 234407, true }, + { 234420, true }, + { 234430, true }, + { 234441, true }, + { 234451, true }, + { 234460, true }, + { 234470, true }, }; From e53176272bf803951197ab3804342ae5bedb7659 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Mon, 6 Feb 2017 08:13:57 -0800 Subject: [PATCH 61/70] No bug, Automated HPKP preload list update from host bld-linux64-spot-1037 - a=hpkp-update --- security/manager/ssl/StaticHPKPins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/manager/ssl/StaticHPKPins.h b/security/manager/ssl/StaticHPKPins.h index 1730d2d8b839..c7e1c42dcf85 100644 --- a/security/manager/ssl/StaticHPKPins.h +++ b/security/manager/ssl/StaticHPKPins.h @@ -1155,4 +1155,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = { static const int32_t kUnknownId = -1; -static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1494776249598000); +static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1494864501893000); From 071364d96e08ef64f11a7cc1afaeb42f3d493dca Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:52 -0500 Subject: [PATCH 62/70] Bug 1335525 - Add top-level webrender crates to gfx/. r=gfx MozReview-Commit-ID: BXVNHlczLh5 --- gfx/webrender/Cargo.toml | 44 + gfx/webrender/build.rs | 54 + gfx/webrender/res/clip_shared.glsl | 91 + gfx/webrender/res/cs_blur.fs.glsl | 40 + gfx/webrender/res/cs_blur.glsl | 10 + gfx/webrender/res/cs_blur.vs.glsl | 65 + gfx/webrender/res/cs_box_shadow.fs.glsl | 148 + gfx/webrender/res/cs_box_shadow.glsl | 10 + gfx/webrender/res/cs_box_shadow.vs.glsl | 31 + gfx/webrender/res/cs_clip_image.fs.glsl | 16 + gfx/webrender/res/cs_clip_image.glsl | 9 + gfx/webrender/res/cs_clip_image.vs.glsl | 39 + gfx/webrender/res/cs_clip_rectangle.fs.glsl | 44 + gfx/webrender/res/cs_clip_rectangle.glsl | 10 + gfx/webrender/res/cs_clip_rectangle.vs.glsl | 78 + gfx/webrender/res/cs_text_run.fs.glsl | 9 + gfx/webrender/res/cs_text_run.glsl | 7 + gfx/webrender/res/cs_text_run.vs.glsl | 36 + gfx/webrender/res/debug_color.fs.glsl | 10 + gfx/webrender/res/debug_color.vs.glsl | 14 + gfx/webrender/res/debug_font.fs.glsl | 16 + gfx/webrender/res/debug_font.vs.glsl | 18 + gfx/webrender/res/prim_shared.glsl | 665 ++++ gfx/webrender/res/ps_angle_gradient.fs.glsl | 39 + gfx/webrender/res/ps_angle_gradient.glsl | 11 + gfx/webrender/res/ps_angle_gradient.vs.glsl | 33 + gfx/webrender/res/ps_blend.fs.glsl | 138 + gfx/webrender/res/ps_blend.glsl | 7 + gfx/webrender/res/ps_blend.vs.glsl | 46 + gfx/webrender/res/ps_border.fs.glsl | 408 +++ gfx/webrender/res/ps_border.glsl | 33 + gfx/webrender/res/ps_border.vs.glsl | 226 ++ gfx/webrender/res/ps_box_shadow.fs.glsl | 9 + gfx/webrender/res/ps_box_shadow.glsl | 9 + gfx/webrender/res/ps_box_shadow.vs.glsl | 32 + gfx/webrender/res/ps_cache_image.fs.glsl | 7 + gfx/webrender/res/ps_cache_image.glsl | 5 + gfx/webrender/res/ps_cache_image.vs.glsl | 28 + gfx/webrender/res/ps_clear.fs.glsl | 7 + gfx/webrender/res/ps_clear.glsl | 3 + gfx/webrender/res/ps_clear.vs.glsl | 14 + gfx/webrender/res/ps_composite.fs.glsl | 219 ++ gfx/webrender/res/ps_composite.glsl | 8 + gfx/webrender/res/ps_composite.vs.glsl | 50 + gfx/webrender/res/ps_gradient.fs.glsl | 16 + gfx/webrender/res/ps_gradient.glsl | 12 + gfx/webrender/res/ps_gradient.vs.glsl | 72 + gfx/webrender/res/ps_image.fs.glsl | 31 + gfx/webrender/res/ps_image.glsl | 16 + gfx/webrender/res/ps_image.vs.glsl | 39 + gfx/webrender/res/ps_radial_gradient.fs.glsl | 67 + gfx/webrender/res/ps_radial_gradient.glsl | 12 + gfx/webrender/res/ps_radial_gradient.vs.glsl | 35 + gfx/webrender/res/ps_rectangle.fs.glsl | 16 + gfx/webrender/res/ps_rectangle.glsl | 10 + gfx/webrender/res/ps_rectangle.vs.glsl | 29 + gfx/webrender/res/ps_text_run.fs.glsl | 20 + gfx/webrender/res/ps_text_run.glsl | 11 + gfx/webrender/res/ps_text_run.vs.glsl | 40 + gfx/webrender/res/ps_yuv_image.fs.glsl | 33 + gfx/webrender/res/ps_yuv_image.glsl | 19 + gfx/webrender/res/ps_yuv_image.vs.glsl | 77 + gfx/webrender/res/shared.glsl | 51 + gfx/webrender/res/shared_other.glsl | 33 + gfx/webrender/src/batch_builder.rs | 43 + gfx/webrender/src/debug_colors.rs | 158 + gfx/webrender/src/debug_font_data.rs | 1914 ++++++++++ gfx/webrender/src/debug_render.rs | 219 ++ gfx/webrender/src/device.rs | 1965 +++++++++++ gfx/webrender/src/frame.rs | 660 ++++ gfx/webrender/src/freelist.rs | 121 + gfx/webrender/src/geometry.rs | 121 + gfx/webrender/src/gpu_store.rs | 94 + gfx/webrender/src/internal_types.rs | 441 +++ gfx/webrender/src/layer.rs | 279 ++ gfx/webrender/src/lib.rs | 131 + gfx/webrender/src/mask_cache.rs | 157 + gfx/webrender/src/platform/macos/font.rs | 302 ++ gfx/webrender/src/platform/unix/font.rs | 256 ++ gfx/webrender/src/platform/windows/font.rs | 192 ++ gfx/webrender/src/prim_store.rs | 1291 +++++++ gfx/webrender/src/profiler.rs | 677 ++++ gfx/webrender/src/record.rs | 86 + gfx/webrender/src/render_backend.rs | 492 +++ gfx/webrender/src/renderer.rs | 1545 +++++++++ gfx/webrender/src/resource_cache.rs | 735 ++++ gfx/webrender/src/scene.rs | 64 + gfx/webrender/src/scroll_tree.rs | 309 ++ gfx/webrender/src/spring.rs | 103 + gfx/webrender/src/texture_cache.rs | 954 +++++ gfx/webrender/src/tiling.rs | 3068 +++++++++++++++++ gfx/webrender/src/util.rs | 305 ++ .../tests/angle_shader_validation.rs | 85 + gfx/webrender/tests/bug_124.html | 5 + gfx/webrender/tests/bug_134.html | 29 + gfx/webrender/tests/bug_137.html | 25 + gfx/webrender/tests/bug_143.html | 11 + gfx/webrender/tests/bug_159.html | 2 + gfx/webrender/tests/bug_166.html | 10 + gfx/webrender/tests/bug_176.html | 1 + gfx/webrender/tests/bug_177.html | 24 + gfx/webrender/tests/bug_178.html | 24 + gfx/webrender/tests/bug_203a.html | 13 + gfx/webrender/tests/bug_203b.html | 14 + gfx/webrender/tests/bug_servo_10136.html | 11 + gfx/webrender/tests/bug_servo_10164.html | 19 + gfx/webrender/tests/bug_servo_10307.html | 12 + gfx/webrender/tests/bug_servo_11358.html | 12 + gfx/webrender/tests/bug_servo_9983a.html | 17 + gfx/webrender/tests/color_pattern_1.png | Bin 0 -> 1693 bytes gfx/webrender/tests/color_pattern_2.png | Bin 0 -> 49144 bytes gfx/webrender/tests/fixed-position.html | 62 + gfx/webrender/tests/mix-blend-mode-2.html | 85 + gfx/webrender/tests/mix-blend-mode.html | 47 + gfx/webrender/tests/nav-1.html | 15 + gfx/webrender/tests/nav-2.html | 15 + gfx/webrender_bindings/Cargo.toml | 25 + gfx/webrender_bindings/src/bindings.rs | 1011 ++++++ gfx/webrender_bindings/src/lib.rs | 21 + gfx/webrender_traits/Cargo.toml | 36 + gfx/webrender_traits/build.rs | 46 + gfx/webrender_traits/src/api.rs | 257 ++ gfx/webrender_traits/src/channel.rs | 15 + gfx/webrender_traits/src/channel_ipc.rs | 34 + gfx/webrender_traits/src/channel_mpsc.rs | 93 + gfx/webrender_traits/src/display_item.rs | 179 + gfx/webrender_traits/src/display_list.rs | 557 +++ gfx/webrender_traits/src/lib.rs | 46 + gfx/webrender_traits/src/stacking_context.rs | 29 + gfx/webrender_traits/src/types.rs | 910 +++++ gfx/webrender_traits/src/units.rs | 93 + gfx/webrender_traits/src/webgl.rs | 708 ++++ 132 files changed, 24715 insertions(+) create mode 100644 gfx/webrender/Cargo.toml create mode 100644 gfx/webrender/build.rs create mode 100644 gfx/webrender/res/clip_shared.glsl create mode 100644 gfx/webrender/res/cs_blur.fs.glsl create mode 100644 gfx/webrender/res/cs_blur.glsl create mode 100644 gfx/webrender/res/cs_blur.vs.glsl create mode 100644 gfx/webrender/res/cs_box_shadow.fs.glsl create mode 100644 gfx/webrender/res/cs_box_shadow.glsl create mode 100644 gfx/webrender/res/cs_box_shadow.vs.glsl create mode 100644 gfx/webrender/res/cs_clip_image.fs.glsl create mode 100644 gfx/webrender/res/cs_clip_image.glsl create mode 100644 gfx/webrender/res/cs_clip_image.vs.glsl create mode 100644 gfx/webrender/res/cs_clip_rectangle.fs.glsl create mode 100644 gfx/webrender/res/cs_clip_rectangle.glsl create mode 100644 gfx/webrender/res/cs_clip_rectangle.vs.glsl create mode 100644 gfx/webrender/res/cs_text_run.fs.glsl create mode 100644 gfx/webrender/res/cs_text_run.glsl create mode 100644 gfx/webrender/res/cs_text_run.vs.glsl create mode 100644 gfx/webrender/res/debug_color.fs.glsl create mode 100644 gfx/webrender/res/debug_color.vs.glsl create mode 100644 gfx/webrender/res/debug_font.fs.glsl create mode 100644 gfx/webrender/res/debug_font.vs.glsl create mode 100644 gfx/webrender/res/prim_shared.glsl create mode 100644 gfx/webrender/res/ps_angle_gradient.fs.glsl create mode 100644 gfx/webrender/res/ps_angle_gradient.glsl create mode 100644 gfx/webrender/res/ps_angle_gradient.vs.glsl create mode 100644 gfx/webrender/res/ps_blend.fs.glsl create mode 100644 gfx/webrender/res/ps_blend.glsl create mode 100644 gfx/webrender/res/ps_blend.vs.glsl create mode 100644 gfx/webrender/res/ps_border.fs.glsl create mode 100644 gfx/webrender/res/ps_border.glsl create mode 100644 gfx/webrender/res/ps_border.vs.glsl create mode 100644 gfx/webrender/res/ps_box_shadow.fs.glsl create mode 100644 gfx/webrender/res/ps_box_shadow.glsl create mode 100644 gfx/webrender/res/ps_box_shadow.vs.glsl create mode 100644 gfx/webrender/res/ps_cache_image.fs.glsl create mode 100644 gfx/webrender/res/ps_cache_image.glsl create mode 100644 gfx/webrender/res/ps_cache_image.vs.glsl create mode 100644 gfx/webrender/res/ps_clear.fs.glsl create mode 100644 gfx/webrender/res/ps_clear.glsl create mode 100644 gfx/webrender/res/ps_clear.vs.glsl create mode 100644 gfx/webrender/res/ps_composite.fs.glsl create mode 100644 gfx/webrender/res/ps_composite.glsl create mode 100644 gfx/webrender/res/ps_composite.vs.glsl create mode 100644 gfx/webrender/res/ps_gradient.fs.glsl create mode 100644 gfx/webrender/res/ps_gradient.glsl create mode 100644 gfx/webrender/res/ps_gradient.vs.glsl create mode 100644 gfx/webrender/res/ps_image.fs.glsl create mode 100644 gfx/webrender/res/ps_image.glsl create mode 100644 gfx/webrender/res/ps_image.vs.glsl create mode 100644 gfx/webrender/res/ps_radial_gradient.fs.glsl create mode 100644 gfx/webrender/res/ps_radial_gradient.glsl create mode 100644 gfx/webrender/res/ps_radial_gradient.vs.glsl create mode 100644 gfx/webrender/res/ps_rectangle.fs.glsl create mode 100644 gfx/webrender/res/ps_rectangle.glsl create mode 100644 gfx/webrender/res/ps_rectangle.vs.glsl create mode 100644 gfx/webrender/res/ps_text_run.fs.glsl create mode 100644 gfx/webrender/res/ps_text_run.glsl create mode 100644 gfx/webrender/res/ps_text_run.vs.glsl create mode 100644 gfx/webrender/res/ps_yuv_image.fs.glsl create mode 100644 gfx/webrender/res/ps_yuv_image.glsl create mode 100644 gfx/webrender/res/ps_yuv_image.vs.glsl create mode 100644 gfx/webrender/res/shared.glsl create mode 100644 gfx/webrender/res/shared_other.glsl create mode 100644 gfx/webrender/src/batch_builder.rs create mode 100644 gfx/webrender/src/debug_colors.rs create mode 100644 gfx/webrender/src/debug_font_data.rs create mode 100644 gfx/webrender/src/debug_render.rs create mode 100644 gfx/webrender/src/device.rs create mode 100644 gfx/webrender/src/frame.rs create mode 100644 gfx/webrender/src/freelist.rs create mode 100644 gfx/webrender/src/geometry.rs create mode 100644 gfx/webrender/src/gpu_store.rs create mode 100644 gfx/webrender/src/internal_types.rs create mode 100644 gfx/webrender/src/layer.rs create mode 100644 gfx/webrender/src/lib.rs create mode 100644 gfx/webrender/src/mask_cache.rs create mode 100644 gfx/webrender/src/platform/macos/font.rs create mode 100644 gfx/webrender/src/platform/unix/font.rs create mode 100644 gfx/webrender/src/platform/windows/font.rs create mode 100644 gfx/webrender/src/prim_store.rs create mode 100644 gfx/webrender/src/profiler.rs create mode 100644 gfx/webrender/src/record.rs create mode 100644 gfx/webrender/src/render_backend.rs create mode 100644 gfx/webrender/src/renderer.rs create mode 100644 gfx/webrender/src/resource_cache.rs create mode 100644 gfx/webrender/src/scene.rs create mode 100644 gfx/webrender/src/scroll_tree.rs create mode 100644 gfx/webrender/src/spring.rs create mode 100644 gfx/webrender/src/texture_cache.rs create mode 100644 gfx/webrender/src/tiling.rs create mode 100644 gfx/webrender/src/util.rs create mode 100644 gfx/webrender/tests/angle_shader_validation.rs create mode 100644 gfx/webrender/tests/bug_124.html create mode 100644 gfx/webrender/tests/bug_134.html create mode 100644 gfx/webrender/tests/bug_137.html create mode 100644 gfx/webrender/tests/bug_143.html create mode 100644 gfx/webrender/tests/bug_159.html create mode 100644 gfx/webrender/tests/bug_166.html create mode 100644 gfx/webrender/tests/bug_176.html create mode 100644 gfx/webrender/tests/bug_177.html create mode 100644 gfx/webrender/tests/bug_178.html create mode 100644 gfx/webrender/tests/bug_203a.html create mode 100644 gfx/webrender/tests/bug_203b.html create mode 100644 gfx/webrender/tests/bug_servo_10136.html create mode 100644 gfx/webrender/tests/bug_servo_10164.html create mode 100644 gfx/webrender/tests/bug_servo_10307.html create mode 100644 gfx/webrender/tests/bug_servo_11358.html create mode 100644 gfx/webrender/tests/bug_servo_9983a.html create mode 100644 gfx/webrender/tests/color_pattern_1.png create mode 100644 gfx/webrender/tests/color_pattern_2.png create mode 100644 gfx/webrender/tests/fixed-position.html create mode 100644 gfx/webrender/tests/mix-blend-mode-2.html create mode 100644 gfx/webrender/tests/mix-blend-mode.html create mode 100644 gfx/webrender/tests/nav-1.html create mode 100644 gfx/webrender/tests/nav-2.html create mode 100644 gfx/webrender_bindings/Cargo.toml create mode 100644 gfx/webrender_bindings/src/bindings.rs create mode 100644 gfx/webrender_bindings/src/lib.rs create mode 100644 gfx/webrender_traits/Cargo.toml create mode 100644 gfx/webrender_traits/build.rs create mode 100644 gfx/webrender_traits/src/api.rs create mode 100644 gfx/webrender_traits/src/channel.rs create mode 100644 gfx/webrender_traits/src/channel_ipc.rs create mode 100644 gfx/webrender_traits/src/channel_mpsc.rs create mode 100644 gfx/webrender_traits/src/display_item.rs create mode 100644 gfx/webrender_traits/src/display_list.rs create mode 100644 gfx/webrender_traits/src/lib.rs create mode 100644 gfx/webrender_traits/src/stacking_context.rs create mode 100644 gfx/webrender_traits/src/types.rs create mode 100644 gfx/webrender_traits/src/units.rs create mode 100644 gfx/webrender_traits/src/webgl.rs diff --git a/gfx/webrender/Cargo.toml b/gfx/webrender/Cargo.toml new file mode 100644 index 000000000000..8a4d287fd1b8 --- /dev/null +++ b/gfx/webrender/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "webrender" +version = "0.11.1" +authors = ["Glenn Watson "] +license = "MPL-2.0" +repository = "https://github.com/servo/webrender" +build = "build.rs" +workspace = ".." + +[features] +default = ["codegen", "freetype-lib"] +codegen = ["webrender_traits/codegen"] +freetype-lib = ["freetype/servo-freetype-sys"] +serde_derive = ["webrender_traits/serde_derive"] + +[dependencies] +app_units = "0.3" +bincode = "0.6" +bit-set = "0.4" +byteorder = "0.5" +euclid = "0.10.3" +fnv="1.0" +gleam = "0.2.30" +lazy_static = "0.2" +log = "0.3" +num-traits = "0.1.32" +offscreen_gl_context = {version = "0.5", features = ["serde_serialization", "osmesa"]} +time = "0.1" +threadpool = "1.3.2" +webrender_traits = {path = "../webrender_traits", default-features = false} +bitflags = "0.7" + +[dev-dependencies] +angle = {git = "https://github.com/servo/angle", branch = "servo"} + +[target.'cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))'.dependencies] +freetype = { version = "0.2", default-features = false } + +[target.'cfg(target_os = "windows")'.dependencies] +dwrote = "0.1.5" + +[target.'cfg(target_os = "macos")'.dependencies] +core-graphics = "0.5.0" +core-text = "2.0" diff --git a/gfx/webrender/build.rs b/gfx/webrender/build.rs new file mode 100644 index 000000000000..848e467bc091 --- /dev/null +++ b/gfx/webrender/build.rs @@ -0,0 +1,54 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::env; +use std::path::{Path, PathBuf}; +use std::io::prelude::*; +use std::fs::{canonicalize, read_dir, File}; + +fn write_shaders(glsl_files: Vec, shader_file_path: &Path) { + let mut shader_file = File::create(shader_file_path).unwrap(); + + write!(shader_file, "/// AUTO GENERATED BY build.rs\n\n").unwrap(); + write!(shader_file, "use std::collections::HashMap;\n").unwrap(); + write!(shader_file, "lazy_static! {{\n").unwrap(); + write!(shader_file, " pub static ref SHADERS: HashMap<&'static str, &'static str> = {{\n").unwrap(); + write!(shader_file, " let mut h = HashMap::with_capacity({});\n", glsl_files.len()).unwrap(); + for glsl in glsl_files { + let shader_name = glsl.file_name().unwrap().to_str().unwrap(); + // strip .glsl + let shader_name = shader_name.replace(".glsl", ""); + let full_path = canonicalize(&glsl).unwrap(); + let full_name = full_path.as_os_str().to_str().unwrap(); + // if someone is building on a network share, I'm sorry. + let full_name = full_name.replace("\\\\?\\", ""); + let full_name = full_name.replace("\\", "/"); + write!(shader_file, " h.insert(\"{}\", include_str!(\"{}\"));\n", + shader_name, full_name).unwrap(); + } + write!(shader_file, " h\n").unwrap(); + write!(shader_file, " }};\n").unwrap(); + write!(shader_file, "}}\n").unwrap(); +} + +fn main() { + let out_dir = env::var("OUT_DIR").unwrap_or("out".to_owned()); + + let shaders_file = Path::new(&out_dir).join("shaders.rs"); + let mut glsl_files = vec![]; + + println!("cargo:rerun-if-changed=res"); + let res_dir = Path::new("res"); + for entry in read_dir(res_dir).unwrap() { + let entry = entry.unwrap(); + let path = entry.path(); + + if entry.file_name().to_str().unwrap().ends_with(".glsl") { + println!("cargo:rerun-if-changed={}", path.display()); + glsl_files.push(path.to_owned()); + } + } + + write_shaders(glsl_files, &shaders_file); +} diff --git a/gfx/webrender/res/clip_shared.glsl b/gfx/webrender/res/clip_shared.glsl new file mode 100644 index 000000000000..cc9018b105e2 --- /dev/null +++ b/gfx/webrender/res/clip_shared.glsl @@ -0,0 +1,91 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifdef WR_VERTEX_SHADER + +#define SEGMENT_ALL 0 +#define SEGMENT_CORNER_TL 1 +#define SEGMENT_CORNER_TR 2 +#define SEGMENT_CORNER_BL 3 +#define SEGMENT_CORNER_BR 4 + +in int aClipRenderTaskIndex; +in int aClipLayerIndex; +in int aClipDataIndex; +in int aClipSegmentIndex; + +struct CacheClipInstance { + int render_task_index; + int layer_index; + int data_index; + int segment_index; +}; + +CacheClipInstance fetch_clip_item(int index) { + CacheClipInstance cci; + + cci.render_task_index = aClipRenderTaskIndex; + cci.layer_index = aClipLayerIndex; + cci.data_index = aClipDataIndex; + cci.segment_index = aClipSegmentIndex; + + return cci; +} + +// The transformed vertex function that always covers the whole clip area, +// which is the intersection of all clip instances of a given primitive +TransformVertexInfo write_clip_tile_vertex(vec4 local_clip_rect, + Layer layer, + ClipArea area, + int segment_index) { + vec2 lp0_base = local_clip_rect.xy; + vec2 lp1_base = local_clip_rect.xy + local_clip_rect.zw; + + vec2 lp0 = clamp_rect(lp0_base, layer.local_clip_rect); + vec2 lp1 = clamp_rect(lp1_base, layer.local_clip_rect); + vec4 clipped_local_rect = vec4(lp0, lp1 - lp0); + + vec2 outer_p0 = area.screen_origin_target_index.xy; + vec2 outer_p1 = outer_p0 + area.task_bounds.zw - area.task_bounds.xy; + vec2 inner_p0 = area.inner_rect.xy; + vec2 inner_p1 = area.inner_rect.zw; + + vec2 p0, p1; + switch (segment_index) { + case SEGMENT_ALL: + p0 = outer_p0; + p1 = outer_p1; + break; + case SEGMENT_CORNER_TL: + p0 = outer_p0; + p1 = inner_p0; + break; + case SEGMENT_CORNER_BL: + p0 = vec2(outer_p0.x, outer_p1.y); + p1 = vec2(inner_p0.x, inner_p1.y); + break; + case SEGMENT_CORNER_TR: + p0 = vec2(outer_p1.x, outer_p1.y); + p1 = vec2(inner_p1.x, inner_p1.y); + break; + case SEGMENT_CORNER_BR: + p0 = vec2(outer_p1.x, outer_p0.y); + p1 = vec2(inner_p1.x, inner_p0.y); + break; + } + + vec2 actual_pos = mix(p0, p1, aPosition.xy); + + vec4 layer_pos = get_layer_pos(actual_pos / uDevicePixelRatio, layer); + + // compute the point position in side the layer, in CSS space + vec2 vertex_pos = actual_pos + area.task_bounds.xy - area.screen_origin_target_index.xy; + + gl_Position = uTransform * vec4(vertex_pos, 0.0, 1); + + return TransformVertexInfo(layer_pos.xyw, actual_pos, clipped_local_rect); +} + +#endif //WR_VERTEX_SHADER diff --git a/gfx/webrender/res/cs_blur.fs.glsl b/gfx/webrender/res/cs_blur.fs.glsl new file mode 100644 index 000000000000..550e42f5d237 --- /dev/null +++ b/gfx/webrender/res/cs_blur.fs.glsl @@ -0,0 +1,40 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// TODO(gw): Write a fast path blur that handles smaller blur radii +// with a offset / weight uniform table and a constant +// loop iteration count! + +// TODO(gw): Make use of the bilinear sampling trick to reduce +// the number of texture fetches needed for a gaussian blur. + +float gauss(float x, float sigma) { + return (1.0 / sqrt(6.283185307179586 * sigma * sigma)) * exp(-(x * x) / (2.0 * sigma * sigma)); +} + +void main(void) { + vec4 cache_sample = texture(sCache, vUv); + vec4 color = vec4(cache_sample.rgb, 1.0) * (cache_sample.a * gauss(0.0, vSigma)); + + for (int i=1 ; i < vBlurRadius ; ++i) { + vec2 offset = vec2(float(i)) * vOffsetScale; + + vec2 st0 = clamp(vUv.xy + offset, vUvRect.xy, vUvRect.zw); + vec4 color0 = texture(sCache, vec3(st0, vUv.z)); + + vec2 st1 = clamp(vUv.xy - offset, vUvRect.xy, vUvRect.zw); + vec4 color1 = texture(sCache, vec3(st1, vUv.z)); + + // Alpha must be premultiplied in order to properly blur the alpha channel. + float weight = gauss(float(i), vSigma); + color += vec4(color0.rgb * color0.a, color0.a) * weight; + color += vec4(color1.rgb * color1.a, color1.a) * weight; + } + + // Unpremultiply the alpha. + color.rgb /= color.a; + + oFragColor = color; +} diff --git a/gfx/webrender/res/cs_blur.glsl b/gfx/webrender/res/cs_blur.glsl new file mode 100644 index 000000000000..110b748b7dcf --- /dev/null +++ b/gfx/webrender/res/cs_blur.glsl @@ -0,0 +1,10 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec3 vUv; +flat varying vec4 vUvRect; +flat varying vec2 vOffsetScale; +flat varying float vSigma; +flat varying int vBlurRadius; diff --git a/gfx/webrender/res/cs_blur.vs.glsl b/gfx/webrender/res/cs_blur.vs.glsl new file mode 100644 index 000000000000..edb0f5fdc602 --- /dev/null +++ b/gfx/webrender/res/cs_blur.vs.glsl @@ -0,0 +1,65 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Applies a separable gaussian blur in one direction, as specified +// by the dir field in the blur command. + +#define DIR_HORIZONTAL 0 +#define DIR_VERTICAL 1 + +in int aBlurRenderTaskIndex; +in int aBlurSourceTaskIndex; +in int aBlurDirection; + +struct BlurCommand { + int task_id; + int src_task_id; + int dir; +}; + +BlurCommand fetch_blur() { + BlurCommand blur; + + blur.task_id = aBlurRenderTaskIndex; + blur.src_task_id = aBlurSourceTaskIndex; + blur.dir = aBlurDirection; + + return blur; +} + +void main(void) { + BlurCommand cmd = fetch_blur(); + RenderTaskData task = fetch_render_task(cmd.task_id); + RenderTaskData src_task = fetch_render_task(cmd.src_task_id); + + vec4 local_rect = task.data0; + + vec2 pos = mix(local_rect.xy, + local_rect.xy + local_rect.zw, + aPosition.xy); + + vec2 texture_size = vec2(textureSize(sCache, 0).xy); + vUv.z = src_task.data1.x; + vBlurRadius = int(task.data1.y); + vSigma = task.data1.y * 0.5; + + switch (cmd.dir) { + case DIR_HORIZONTAL: + vOffsetScale = vec2(1.0 / texture_size.x, 0.0); + break; + case DIR_VERTICAL: + vOffsetScale = vec2(0.0, 1.0 / texture_size.y); + break; + } + + vUvRect = vec4(src_task.data0.xy, src_task.data0.xy + src_task.data0.zw); + vUvRect /= texture_size.xyxy; + + vec2 uv0 = src_task.data0.xy / texture_size; + vec2 uv1 = (src_task.data0.xy + src_task.data0.zw) / texture_size; + vUv.xy = mix(uv0, uv1, aPosition.xy); + + gl_Position = uTransform * vec4(pos, 0.0, 1.0); +} diff --git a/gfx/webrender/res/cs_box_shadow.fs.glsl b/gfx/webrender/res/cs_box_shadow.fs.glsl new file mode 100644 index 000000000000..3243dc6d6284 --- /dev/null +++ b/gfx/webrender/res/cs_box_shadow.fs.glsl @@ -0,0 +1,148 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// See http://asciimath.org to render the equations here. + +// The Gaussian function used for blurring: +// +// G_sigma(x) = 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2)) +float gauss(float x, float sigma) { + float sigmaPow2 = sigma * sigma; + return 1.0 / sqrt(6.283185307179586 * sigmaPow2) * exp(-(x * x) / (2.0 * sigmaPow2)); +} + +// An approximation of the error function, which is related to the integral of the Gaussian +// function: +// +// "erf"(x) = 2/sqrt(pi) int_0^x e^(-t^2) dt +// ~~ 1 - 1 / (1 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4)^4 +// +// where: +// +// a_1 = 0.278393, a_2 = 0.230389, a_3 = 0.000972, a_4 = 0.078108 +// +// This approximation is accurate to `5 xx 10^-4`, more than accurate enough for our purposes. +// +// See: https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions +float erf(float x) { + bool negative = x < 0.0; + if (negative) + x = -x; + float x2 = x * x; + float x3 = x2 * x; + float x4 = x2 * x2; + float denom = 1.0 + 0.278393 * x + 0.230389 * x2 + 0.000972 * x3 + 0.078108 * x4; + float result = 1.0 - 1.0 / (denom * denom * denom * denom); + return negative ? -result : result; +} + +// A useful helper for calculating integrals of the Gaussian function via the error function: +// +// "erf"_sigma(x) = 2 int 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2)) dx +// = "erf"(x/(sigma sqrt(2))) +float erfSigma(float x, float sigma) { + return erf(x / (sigma * 1.4142135623730951)); +} + +// Returns the blurred color value from the box itself (not counting any rounded corners). `p_0` is +// the vector distance to the top left corner of the box; `p_1` is the vector distance to its +// bottom right corner. +// +// "colorFromRect"_sigma(p_0, p_1) +// = int_{p_{0_y}}^{p_{1_y}} int_{p_{1_x}}^{p_{0_x}} G_sigma(y) G_sigma(x) dx dy +// = 1/4 ("erf"_sigma(p_{1_x}) - "erf"_sigma(p_{0_x})) +// ("erf"_sigma(p_{1_y}) - "erf"_sigma(p_{0_y})) +float colorFromRect(vec2 p0, vec2 p1, float sigma) { + return (erfSigma(p1.x, sigma) - erfSigma(p0.x, sigma)) * + (erfSigma(p1.y, sigma) - erfSigma(p0.y, sigma)) / 4.0; +} + +// Returns the `x` coordinate on the ellipse with the given radii for the given `y` coordinate: +// +// "ellipsePoint"(y, y_0, a, b) = a sqrt(1 - ((y - y_0) / b)^2) +float ellipsePoint(float y, float y0, vec2 radii) { + float bStep = (y - y0) / radii.y; + return radii.x * sqrt(1.0 - bStep * bStep); +} + +// A helper function to compute the value that needs to be subtracted to accommodate the border +// corners. +// +// "colorCutout"_sigma(x_{0_l}, x_{0_r}, y_0, y_{min}, y_{max}, a, b) +// = int_{y_{min}}^{y_{max}} +// int_{x_{0_r} + "ellipsePoint"(y, y_0, a, b)}^{x_{0_r} + a} G_sigma(y) G_sigma(x) dx +// + int_{x_{0_l} - a}^{x_{0_l} - "ellipsePoint"(y, y_0, a, b)} G_sigma(y) G_sigma(x) +// dx dy +// = int_{y_{min}}^{y_{max}} 1/2 G_sigma(y) +// ("erf"_sigma(x_{0_r} + a) - "erf"_sigma(x_{0_r} + "ellipsePoint"(y, y_0, a, b)) + +// "erf"_sigma(x_{0_l} - "ellipsePoint"(y, y_0, a, b)) - "erf"_sigma(x_{0_l} - a)) +// +// with the outer integral evaluated numerically. +float colorCutoutGeneral(float x0l, + float x0r, + float y0, + float yMin, + float yMax, + vec2 radii, + float sigma) { + float sum = 0.0; + for (float y = yMin; y <= yMax; y += 1.0) { + float xEllipsePoint = ellipsePoint(y, y0, radii); + sum += gauss(y, sigma) * + (erfSigma(x0r + radii.x, sigma) - erfSigma(x0r + xEllipsePoint, sigma) + + erfSigma(x0l - xEllipsePoint, sigma) - erfSigma(x0l - radii.x, sigma)); + } + return sum / 2.0; +} + +// The value that needs to be subtracted to accommodate the top border corners. +float colorCutoutTop(float x0l, float x0r, float y0, vec2 radii, float sigma) { + return colorCutoutGeneral(x0l, x0r, y0, y0, y0 + radii.y, radii, sigma); +} + +// The value that needs to be subtracted to accommodate the bottom border corners. +float colorCutoutBottom(float x0l, float x0r, float y0, vec2 radii, float sigma) { + return colorCutoutGeneral(x0l, x0r, y0, y0 - radii.y, y0, radii, sigma); +} + +// The blurred color value for the point at `pos` with the top left corner of the box at +// `p_{0_"rect"}` and the bottom right corner of the box at `p_{1_"rect"}`. +float color(vec2 pos, vec2 p0Rect, vec2 p1Rect, vec2 radii, float sigma) { + // Compute the vector distances `p_0` and `p_1`. + vec2 p0 = p0Rect - pos, p1 = p1Rect - pos; + + // Compute the basic color `"colorFromRect"_sigma(p_0, p_1)`. This is all we have to do if + // the box is unrounded. + float cRect = colorFromRect(p0, p1, sigma); + if (radii.x == 0.0 || radii.y == 0.0) + return cRect; + + // Compute the inner corners of the box, taking border radii into account: `x_{0_l}`, + // `y_{0_t}`, `x_{0_r}`, and `y_{0_b}`. + float x0l = p0.x + radii.x; + float y0t = p1.y - radii.y; + float x0r = p1.x - radii.x; + float y0b = p0.y + radii.y; + + // Compute the final color: + // + // "colorFromRect"_sigma(p_0, p_1) - + // ("colorCutoutTop"_sigma(x_{0_l}, x_{0_r}, y_{0_t}, a, b) + + // "colorCutoutBottom"_sigma(x_{0_l}, x_{0_r}, y_{0_b}, a, b)) + float cCutoutTop = colorCutoutTop(x0l, x0r, y0t, radii, sigma); + float cCutoutBottom = colorCutoutBottom(x0l, x0r, y0b, radii, sigma); + return cRect - (cCutoutTop + cCutoutBottom); +} + +void main(void) { + vec2 pos = vPos.xy; + vec2 p0Rect = vBoxShadowRect.xy, p1Rect = vBoxShadowRect.zw; + vec2 radii = vBorderRadii.xy; + float sigma = vBlurRadius / 2.0; + float value = color(pos, p0Rect, p1Rect, radii, sigma); + + value = max(value, 0.0); + oFragColor = vec4(1.0, 1.0, 1.0, vInverted == 1.0 ? 1.0 - value : value); +} diff --git a/gfx/webrender/res/cs_box_shadow.glsl b/gfx/webrender/res/cs_box_shadow.glsl new file mode 100644 index 000000000000..9e5dd036c542 --- /dev/null +++ b/gfx/webrender/res/cs_box_shadow.glsl @@ -0,0 +1,10 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec2 vPos; +flat varying vec2 vBorderRadii; +flat varying float vBlurRadius; +flat varying vec4 vBoxShadowRect; +flat varying float vInverted; diff --git a/gfx/webrender/res/cs_box_shadow.vs.glsl b/gfx/webrender/res/cs_box_shadow.vs.glsl new file mode 100644 index 000000000000..a9bb8abdf22a --- /dev/null +++ b/gfx/webrender/res/cs_box_shadow.vs.glsl @@ -0,0 +1,31 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + CachePrimitiveInstance cpi = fetch_cache_instance(); + RenderTaskData task = fetch_render_task(cpi.render_task_index); + BoxShadow bs = fetch_boxshadow(cpi.specific_prim_index); + + vec2 p0 = task.data0.xy; + vec2 p1 = p0 + task.data0.zw; + + vec2 pos = mix(p0, p1, aPosition.xy); + + vBorderRadii = bs.border_radius_edge_size_blur_radius_inverted.xx; + vBlurRadius = bs.border_radius_edge_size_blur_radius_inverted.z; + vInverted = bs.border_radius_edge_size_blur_radius_inverted.w; + vBoxShadowRect = vec4(bs.bs_rect.xy, bs.bs_rect.xy + bs.bs_rect.zw); + + // The fragment shader expects logical units, beginning at where the + // blur radius begins. + // The first path of the equation gets the virtual position in + // logical pixels within the patch rectangle (accounting for + // bilinear offset). Then we add the start position of the + // box shadow rect and subtract the blur radius to get the + // virtual coordinates that the FS expects. + vPos = (pos - 1.0 - p0) / uDevicePixelRatio + bs.bs_rect.xy - vec2(2.0 * vBlurRadius); + + gl_Position = uTransform * vec4(pos, 0.0, 1.0); +} diff --git a/gfx/webrender/res/cs_clip_image.fs.glsl b/gfx/webrender/res/cs_clip_image.fs.glsl new file mode 100644 index 000000000000..45fa9eef203f --- /dev/null +++ b/gfx/webrender/res/cs_clip_image.fs.glsl @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + float alpha = 1.f; + vec2 local_pos = init_transform_fs(vPos, vLocalRect, alpha); + + bool repeat_mask = false; //TODO + vec2 clamped_mask_uv = repeat_mask ? fract(vClipMaskUv.xy) : + clamp(vClipMaskUv.xy, vec2(0.0, 0.0), vec2(1.0, 1.0)); + vec2 source_uv = clamped_mask_uv * vClipMaskUvRect.zw + vClipMaskUvRect.xy; + float clip_alpha = texture(sMask, source_uv).r; //careful: texture has type A8 + + oFragColor = vec4(min(alpha, clip_alpha), 1.0, 1.0, 1.0); +} diff --git a/gfx/webrender/res/cs_clip_image.glsl b/gfx/webrender/res/cs_clip_image.glsl new file mode 100644 index 000000000000..e5fe1f86237c --- /dev/null +++ b/gfx/webrender/res/cs_clip_image.glsl @@ -0,0 +1,9 @@ +#line 1 + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec3 vPos; +flat varying vec4 vLocalRect; +flat varying vec4 vClipMaskUvRect; diff --git a/gfx/webrender/res/cs_clip_image.vs.glsl b/gfx/webrender/res/cs_clip_image.vs.glsl new file mode 100644 index 000000000000..1293cf70f421 --- /dev/null +++ b/gfx/webrender/res/cs_clip_image.vs.glsl @@ -0,0 +1,39 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +struct ImageMaskData { + vec4 uv_rect; + vec4 local_rect; +}; + +ImageMaskData fetch_mask_data(int index) { + ImageMaskData info; + + ivec2 uv = get_fetch_uv_2(index); + + info.uv_rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); + info.local_rect = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); + + return info; +} + +void main(void) { + CacheClipInstance cci = fetch_clip_item(gl_InstanceID); + ClipArea area = fetch_clip_area(cci.render_task_index); + Layer layer = fetch_layer(cci.layer_index); + ImageMaskData mask = fetch_mask_data(cci.data_index); + vec4 local_rect = mask.local_rect; + + TransformVertexInfo vi = write_clip_tile_vertex(local_rect, + layer, + area, + cci.segment_index); + vLocalRect = vi.clipped_local_rect; + vPos = vi.local_pos; + + vClipMaskUv = vec3((vPos.xy / vPos.z - local_rect.xy) / local_rect.zw, 0.0); + vec2 texture_size = vec2(textureSize(sMask, 0)); + vClipMaskUvRect = mask.uv_rect / texture_size.xyxy; +} diff --git a/gfx/webrender/res/cs_clip_rectangle.fs.glsl b/gfx/webrender/res/cs_clip_rectangle.fs.glsl new file mode 100644 index 000000000000..695c8b8f358e --- /dev/null +++ b/gfx/webrender/res/cs_clip_rectangle.fs.glsl @@ -0,0 +1,44 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +float rounded_rect(vec2 pos) { + vec2 ref_tl = vClipRect.xy + vec2( vClipRadius.x, vClipRadius.x); + vec2 ref_tr = vClipRect.zy + vec2(-vClipRadius.y, vClipRadius.y); + vec2 ref_br = vClipRect.zw + vec2(-vClipRadius.z, -vClipRadius.z); + vec2 ref_bl = vClipRect.xw + vec2( vClipRadius.w, -vClipRadius.w); + + float d_tl = distance(pos, ref_tl); + float d_tr = distance(pos, ref_tr); + float d_br = distance(pos, ref_br); + float d_bl = distance(pos, ref_bl); + + float pixels_per_fragment = length(fwidth(pos.xy)); + float nudge = 0.5 * pixels_per_fragment; + vec4 distances = vec4(d_tl, d_tr, d_br, d_bl) - vClipRadius + nudge; + + bvec4 is_out = bvec4(pos.x < ref_tl.x && pos.y < ref_tl.y, + pos.x > ref_tr.x && pos.y < ref_tr.y, + pos.x > ref_br.x && pos.y > ref_br.y, + pos.x < ref_bl.x && pos.y > ref_bl.y); + + float distance_from_border = dot(vec4(is_out), + max(vec4(0.0, 0.0, 0.0, 0.0), distances)); + + // Move the distance back into pixels. + distance_from_border /= pixels_per_fragment; + // Apply a more gradual fade out to transparent. + //distance_from_border -= 0.5; + + return 1.0 - smoothstep(0.0, 1.0, distance_from_border); +} + + +void main(void) { + float alpha = 1.f; + vec2 local_pos = init_transform_fs(vPos, vLocalRect, alpha); + + float clip_alpha = rounded_rect(local_pos); + + oFragColor = vec4(min(alpha, clip_alpha), 0.0, 0.0, 1.0); +} diff --git a/gfx/webrender/res/cs_clip_rectangle.glsl b/gfx/webrender/res/cs_clip_rectangle.glsl new file mode 100644 index 000000000000..9e73553cc818 --- /dev/null +++ b/gfx/webrender/res/cs_clip_rectangle.glsl @@ -0,0 +1,10 @@ +#line 1 + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec3 vPos; +flat varying vec4 vLocalRect; +flat varying vec4 vClipRect; +flat varying vec4 vClipRadius; diff --git a/gfx/webrender/res/cs_clip_rectangle.vs.glsl b/gfx/webrender/res/cs_clip_rectangle.vs.glsl new file mode 100644 index 000000000000..15529e1db6a4 --- /dev/null +++ b/gfx/webrender/res/cs_clip_rectangle.vs.glsl @@ -0,0 +1,78 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +struct ClipRect { + vec4 rect; + vec4 dummy; +}; + +ClipRect fetch_clip_rect(int index) { + ClipRect rect; + + ivec2 uv = get_fetch_uv_2(index); + + rect.rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); + //rect.dummy = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); + rect.dummy = vec4(0.0, 0.0, 0.0, 0.0); + + return rect; +} + +struct ClipCorner { + vec4 rect; + vec4 outer_inner_radius; +}; + +ClipCorner fetch_clip_corner(int index) { + ClipCorner corner; + + ivec2 uv = get_fetch_uv_2(index); + + corner.rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); + corner.outer_inner_radius = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); + + return corner; +} + +struct ClipData { + ClipRect rect; + ClipCorner top_left; + ClipCorner top_right; + ClipCorner bottom_left; + ClipCorner bottom_right; +}; + +ClipData fetch_clip(int index) { + ClipData clip; + + clip.rect = fetch_clip_rect(index + 0); + clip.top_left = fetch_clip_corner(index + 1); + clip.top_right = fetch_clip_corner(index + 2); + clip.bottom_left = fetch_clip_corner(index + 3); + clip.bottom_right = fetch_clip_corner(index + 4); + + return clip; +} + +void main(void) { + CacheClipInstance cci = fetch_clip_item(gl_InstanceID); + ClipArea area = fetch_clip_area(cci.render_task_index); + Layer layer = fetch_layer(cci.layer_index); + ClipData clip = fetch_clip(cci.data_index); + vec4 local_rect = clip.rect.rect; + + TransformVertexInfo vi = write_clip_tile_vertex(local_rect, + layer, + area, + cci.segment_index); + vLocalRect = vi.clipped_local_rect; + vPos = vi.local_pos; + + vClipRect = vec4(local_rect.xy, local_rect.xy + local_rect.zw); + vClipRadius = vec4(clip.top_left.outer_inner_radius.x, + clip.top_right.outer_inner_radius.x, + clip.bottom_right.outer_inner_radius.x, + clip.bottom_left.outer_inner_radius.x); +} diff --git a/gfx/webrender/res/cs_text_run.fs.glsl b/gfx/webrender/res/cs_text_run.fs.glsl new file mode 100644 index 000000000000..8e9b40db247d --- /dev/null +++ b/gfx/webrender/res/cs_text_run.fs.glsl @@ -0,0 +1,9 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + float a = texture(sColor0, vUv).a; + oFragColor = vec4(vColor.rgb, vColor.a * a); +} diff --git a/gfx/webrender/res/cs_text_run.glsl b/gfx/webrender/res/cs_text_run.glsl new file mode 100644 index 000000000000..39ed226b2646 --- /dev/null +++ b/gfx/webrender/res/cs_text_run.glsl @@ -0,0 +1,7 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec2 vUv; +flat varying vec4 vColor; diff --git a/gfx/webrender/res/cs_text_run.vs.glsl b/gfx/webrender/res/cs_text_run.vs.glsl new file mode 100644 index 000000000000..07c269e224b0 --- /dev/null +++ b/gfx/webrender/res/cs_text_run.vs.glsl @@ -0,0 +1,36 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Draw a text run to a cache target. These are always +// drawn un-transformed. These are used for effects such +// as text-shadow. + +void main(void) { + CachePrimitiveInstance cpi = fetch_cache_instance(); + RenderTaskData task = fetch_render_task(cpi.render_task_index); + TextRun text = fetch_text_run(cpi.specific_prim_index); + Glyph glyph = fetch_glyph(cpi.sub_index); + PrimitiveGeometry pg = fetch_prim_geometry(cpi.global_prim_index); + ResourceRect res = fetch_resource_rect(cpi.user_data.x); + + // Glyphs size is already in device-pixels. + // The render task origin is in device-pixels. Offset that by + // the glyph offset, relative to its primitive bounding rect. + vec2 size = res.uv_rect.zw - res.uv_rect.xy; + vec2 origin = task.data0.xy + uDevicePixelRatio * (glyph.offset.xy - pg.local_rect.xy); + vec4 local_rect = vec4(origin, size); + + vec2 texture_size = vec2(textureSize(sColor0, 0)); + vec2 st0 = res.uv_rect.xy / texture_size; + vec2 st1 = res.uv_rect.zw / texture_size; + + vec2 pos = mix(local_rect.xy, + local_rect.xy + local_rect.zw, + aPosition.xy); + vUv = mix(st0, st1, aPosition.xy); + vColor = text.color; + + gl_Position = uTransform * vec4(pos, 0.0, 1.0); +} diff --git a/gfx/webrender/res/debug_color.fs.glsl b/gfx/webrender/res/debug_color.fs.glsl new file mode 100644 index 000000000000..f9f3425e951b --- /dev/null +++ b/gfx/webrender/res/debug_color.fs.glsl @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec4 vColor; + +void main(void) +{ + oFragColor = vColor; +} diff --git a/gfx/webrender/res/debug_color.vs.glsl b/gfx/webrender/res/debug_color.vs.glsl new file mode 100644 index 000000000000..800b5628eb5b --- /dev/null +++ b/gfx/webrender/res/debug_color.vs.glsl @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +in vec4 aColor; +varying vec4 vColor; + +void main(void) +{ + vColor = aColor; + vec4 pos = vec4(aPosition, 1.0); + pos.xy = floor(pos.xy * uDevicePixelRatio + 0.5) / uDevicePixelRatio; + gl_Position = uTransform * pos; +} diff --git a/gfx/webrender/res/debug_font.fs.glsl b/gfx/webrender/res/debug_font.fs.glsl new file mode 100644 index 000000000000..46acfb5b0e91 --- /dev/null +++ b/gfx/webrender/res/debug_font.fs.glsl @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec2 vColorTexCoord; +varying vec4 vColor; + +void main(void) +{ +#ifdef SERVO_ES2 + float alpha = texture(sColor0, vColorTexCoord.xy).a; +#else + float alpha = texture(sColor0, vColorTexCoord.xy).r; +#endif + oFragColor = vec4(vColor.xyz, vColor.w * alpha); +} diff --git a/gfx/webrender/res/debug_font.vs.glsl b/gfx/webrender/res/debug_font.vs.glsl new file mode 100644 index 000000000000..e81a0c087e48 --- /dev/null +++ b/gfx/webrender/res/debug_font.vs.glsl @@ -0,0 +1,18 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +in vec4 aColor; +in vec4 aColorTexCoord; + +varying vec2 vColorTexCoord; +varying vec4 vColor; + +void main(void) +{ + vColor = aColor; + vColorTexCoord = aColorTexCoord.xy; + vec4 pos = vec4(aPosition, 1.0); + pos.xy = floor(pos.xy * uDevicePixelRatio + 0.5) / uDevicePixelRatio; + gl_Position = uTransform * pos; +} diff --git a/gfx/webrender/res/prim_shared.glsl b/gfx/webrender/res/prim_shared.glsl new file mode 100644 index 000000000000..1d9e8a95e687 --- /dev/null +++ b/gfx/webrender/res/prim_shared.glsl @@ -0,0 +1,665 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#if defined(GL_ES) + #if GL_ES == 1 + #ifdef GL_FRAGMENT_PRECISION_HIGH + precision highp sampler2DArray; + #else + precision mediump sampler2DArray; + #endif + #endif +#endif + +#define PST_TOP_LEFT 0 +#define PST_TOP 1 +#define PST_TOP_RIGHT 2 +#define PST_RIGHT 3 +#define PST_BOTTOM_RIGHT 4 +#define PST_BOTTOM 5 +#define PST_BOTTOM_LEFT 6 +#define PST_LEFT 7 + +#define BORDER_LEFT 0 +#define BORDER_TOP 1 +#define BORDER_RIGHT 2 +#define BORDER_BOTTOM 3 + +#define UV_NORMALIZED uint(0) +#define UV_PIXEL uint(1) + +#define MAX_STOPS_PER_ANGLE_GRADIENT 8 +#define MAX_STOPS_PER_RADIAL_GRADIENT 8 + +uniform sampler2DArray sCache; + +flat varying vec4 vClipMaskUvBounds; +varying vec3 vClipMaskUv; + +#ifdef WR_VERTEX_SHADER + +#define VECS_PER_LAYER 13 +#define VECS_PER_RENDER_TASK 3 +#define VECS_PER_PRIM_GEOM 2 + +#define GRADIENT_HORIZONTAL 0 +#define GRADIENT_VERTICAL 1 +#define GRADIENT_ROTATED 2 + +uniform sampler2D sLayers; +uniform sampler2D sRenderTasks; +uniform sampler2D sPrimGeometry; + +uniform sampler2D sData16; +uniform sampler2D sData32; +uniform sampler2D sData64; +uniform sampler2D sData128; +uniform sampler2D sResourceRects; + +// Instanced attributes +in int aGlobalPrimId; +in int aPrimitiveAddress; +in int aTaskIndex; +in int aClipTaskIndex; +in int aLayerIndex; +in int aElementIndex; +in ivec2 aUserData; +in int aZIndex; + +// get_fetch_uv is a macro to work around a macOS Intel driver parsing bug. +// TODO: convert back to a function once the driver issues are resolved, if ever. +// https://github.com/servo/webrender/pull/623 +// https://github.com/servo/servo/issues/13953 +#define get_fetch_uv(i, vpi) ivec2(vpi * (i % (WR_MAX_VERTEX_TEXTURE_WIDTH/vpi)), i / (WR_MAX_VERTEX_TEXTURE_WIDTH/vpi)) + +ivec2 get_fetch_uv_1(int index) { + return get_fetch_uv(index, 1); +} + +ivec2 get_fetch_uv_2(int index) { + return get_fetch_uv(index, 2); +} + +ivec2 get_fetch_uv_4(int index) { + return get_fetch_uv(index, 4); +} + +ivec2 get_fetch_uv_8(int index) { + return get_fetch_uv(index, 8); +} + +struct Layer { + mat4 transform; + mat4 inv_transform; + vec4 local_clip_rect; + vec4 screen_vertices[4]; +}; + +Layer fetch_layer(int index) { + Layer layer; + + // Create a UV base coord for each 8 texels. + // This is required because trying to use an offset + // of more than 8 texels doesn't work on some versions + // of OSX. + ivec2 uv = get_fetch_uv(index, VECS_PER_LAYER); + ivec2 uv0 = ivec2(uv.x + 0, uv.y); + ivec2 uv1 = ivec2(uv.x + 8, uv.y); + + layer.transform[0] = texelFetchOffset(sLayers, uv0, 0, ivec2(0, 0)); + layer.transform[1] = texelFetchOffset(sLayers, uv0, 0, ivec2(1, 0)); + layer.transform[2] = texelFetchOffset(sLayers, uv0, 0, ivec2(2, 0)); + layer.transform[3] = texelFetchOffset(sLayers, uv0, 0, ivec2(3, 0)); + + layer.inv_transform[0] = texelFetchOffset(sLayers, uv0, 0, ivec2(4, 0)); + layer.inv_transform[1] = texelFetchOffset(sLayers, uv0, 0, ivec2(5, 0)); + layer.inv_transform[2] = texelFetchOffset(sLayers, uv0, 0, ivec2(6, 0)); + layer.inv_transform[3] = texelFetchOffset(sLayers, uv0, 0, ivec2(7, 0)); + + layer.local_clip_rect = texelFetchOffset(sLayers, uv1, 0, ivec2(0, 0)); + + layer.screen_vertices[0] = texelFetchOffset(sLayers, uv1, 0, ivec2(1, 0)); + layer.screen_vertices[1] = texelFetchOffset(sLayers, uv1, 0, ivec2(2, 0)); + layer.screen_vertices[2] = texelFetchOffset(sLayers, uv1, 0, ivec2(3, 0)); + layer.screen_vertices[3] = texelFetchOffset(sLayers, uv1, 0, ivec2(4, 0)); + + return layer; +} + +struct RenderTaskData { + vec4 data0; + vec4 data1; + vec4 data2; +}; + +RenderTaskData fetch_render_task(int index) { + RenderTaskData task; + + ivec2 uv = get_fetch_uv(index, VECS_PER_RENDER_TASK); + + task.data0 = texelFetchOffset(sRenderTasks, uv, 0, ivec2(0, 0)); + task.data1 = texelFetchOffset(sRenderTasks, uv, 0, ivec2(1, 0)); + task.data2 = texelFetchOffset(sRenderTasks, uv, 0, ivec2(2, 0)); + + return task; +} + +struct Tile { + vec4 screen_origin_task_origin; + vec4 size_target_index; +}; + +Tile fetch_tile(int index) { + RenderTaskData task = fetch_render_task(index); + + Tile tile; + tile.screen_origin_task_origin = task.data0; + tile.size_target_index = task.data1; + + return tile; +} + +struct ClipArea { + vec4 task_bounds; + vec4 screen_origin_target_index; + vec4 inner_rect; +}; + +ClipArea fetch_clip_area(int index) { + ClipArea area; + + if (index == 0x7FFFFFFF) { //special sentinel task index + area.task_bounds = vec4(0.0, 0.0, 0.0, 0.0); + area.screen_origin_target_index = vec4(0.0, 0.0, 0.0, 0.0); + area.inner_rect = vec4(0.0); + } else { + RenderTaskData task = fetch_render_task(index); + area.task_bounds = task.data0; + area.screen_origin_target_index = task.data1; + area.inner_rect = task.data2; + } + + return area; +} + +struct Gradient { + vec4 start_end_point; + vec4 kind; +}; + +Gradient fetch_gradient(int index) { + Gradient gradient; + + ivec2 uv = get_fetch_uv_2(index); + + gradient.start_end_point = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); + gradient.kind = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); + + return gradient; +} + +struct GradientStop { + vec4 color; + vec4 offset; +}; + +GradientStop fetch_gradient_stop(int index) { + GradientStop stop; + + ivec2 uv = get_fetch_uv_2(index); + + stop.color = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); + stop.offset = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); + + return stop; +} + +struct RadialGradient { + vec4 start_end_center; + vec4 start_end_radius; +}; + +RadialGradient fetch_radial_gradient(int index) { + RadialGradient gradient; + + ivec2 uv = get_fetch_uv_2(index); + + gradient.start_end_center = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); + gradient.start_end_radius = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); + + return gradient; +} + +struct Glyph { + vec4 offset; +}; + +Glyph fetch_glyph(int index) { + Glyph glyph; + + ivec2 uv = get_fetch_uv_1(index); + + glyph.offset = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); + + return glyph; +} + +vec4 fetch_instance_geometry(int index) { + ivec2 uv = get_fetch_uv_1(index); + + vec4 rect = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); + + return rect; +} + +struct PrimitiveGeometry { + vec4 local_rect; + vec4 local_clip_rect; +}; + +PrimitiveGeometry fetch_prim_geometry(int index) { + PrimitiveGeometry pg; + + ivec2 uv = get_fetch_uv(index, VECS_PER_PRIM_GEOM); + + pg.local_rect = texelFetchOffset(sPrimGeometry, uv, 0, ivec2(0, 0)); + pg.local_clip_rect = texelFetchOffset(sPrimGeometry, uv, 0, ivec2(1, 0)); + + return pg; +} + +struct PrimitiveInstance { + int global_prim_index; + int specific_prim_index; + int render_task_index; + int clip_task_index; + int layer_index; + int sub_index; + int z; + ivec2 user_data; +}; + +PrimitiveInstance fetch_prim_instance() { + PrimitiveInstance pi; + + pi.global_prim_index = aGlobalPrimId; + pi.specific_prim_index = aPrimitiveAddress; + pi.render_task_index = aTaskIndex; + pi.clip_task_index = aClipTaskIndex; + pi.layer_index = aLayerIndex; + pi.sub_index = aElementIndex; + pi.user_data = aUserData; + pi.z = aZIndex; + + return pi; +} + +struct CachePrimitiveInstance { + int global_prim_index; + int specific_prim_index; + int render_task_index; + int sub_index; + ivec2 user_data; +}; + +CachePrimitiveInstance fetch_cache_instance() { + CachePrimitiveInstance cpi; + + PrimitiveInstance pi = fetch_prim_instance(); + + cpi.global_prim_index = pi.global_prim_index; + cpi.specific_prim_index = pi.specific_prim_index; + cpi.render_task_index = pi.render_task_index; + cpi.sub_index = pi.sub_index; + cpi.user_data = pi.user_data; + + return cpi; +} + +struct Primitive { + Layer layer; + Tile tile; + ClipArea clip_area; + vec4 local_rect; + vec4 local_clip_rect; + int prim_index; + // when sending multiple primitives of the same type (e.g. border segments) + // this index allows the vertex shader to recognize the difference + int sub_index; + ivec2 user_data; + float z; +}; + +Primitive load_primitive_custom(PrimitiveInstance pi) { + Primitive prim; + + prim.layer = fetch_layer(pi.layer_index); + prim.tile = fetch_tile(pi.render_task_index); + prim.clip_area = fetch_clip_area(pi.clip_task_index); + + PrimitiveGeometry pg = fetch_prim_geometry(pi.global_prim_index); + prim.local_rect = pg.local_rect; + prim.local_clip_rect = pg.local_clip_rect; + + prim.prim_index = pi.specific_prim_index; + prim.sub_index = pi.sub_index; + prim.user_data = pi.user_data; + prim.z = float(pi.z); + + return prim; +} + +Primitive load_primitive() { + PrimitiveInstance pi = fetch_prim_instance(); + + return load_primitive_custom(pi); +} + + +// Return the intersection of the plane (set up by "normal" and "point") +// with the ray (set up by "ray_origin" and "ray_dir"), +// writing the resulting scaler into "t". +bool ray_plane(vec3 normal, vec3 point, vec3 ray_origin, vec3 ray_dir, out float t) +{ + float denom = dot(normal, ray_dir); + if (denom > 1e-6) { + vec3 d = point - ray_origin; + t = dot(d, normal) / denom; + return t >= 0.0; + } + + return false; +} + +// Apply the inverse transform "inv_transform" +// to the reference point "ref" in CSS space, +// producing a local point on a layer plane, +// set by a base point "a" and a normal "n". +vec4 untransform(vec2 ref, vec3 n, vec3 a, mat4 inv_transform) { + vec3 p = vec3(ref, -10000.0); + vec3 d = vec3(0, 0, 1.0); + + float t = 0.0; + // get an intersection of the layer plane with Z axis vector, + // originated from the "ref" point + ray_plane(n, a, p, d, t); + float z = p.z + d.z * t; // Z of the visible point on the layer + + vec4 r = inv_transform * vec4(ref, z, 1.0); + return r; +} + +// Given a CSS space position, transform it back into the layer space. +vec4 get_layer_pos(vec2 pos, Layer layer) { + // get 3 of the layer corners in CSS space + vec3 a = layer.screen_vertices[0].xyz / layer.screen_vertices[0].w; + vec3 b = layer.screen_vertices[3].xyz / layer.screen_vertices[3].w; + vec3 c = layer.screen_vertices[2].xyz / layer.screen_vertices[2].w; + // get the normal to the layer plane + vec3 n = normalize(cross(b-a, c-a)); + return untransform(pos, n, a, layer.inv_transform); +} + +vec2 clamp_rect(vec2 point, vec4 rect) { + return clamp(point, rect.xy, rect.xy + rect.zw); +} + +struct Rect { + vec2 p0; + vec2 p1; +}; + +struct VertexInfo { + Rect local_rect; + vec2 local_clamped_pos; + vec2 global_clamped_pos; +}; + +VertexInfo write_vertex(vec4 instance_rect, + vec4 local_clip_rect, + float z, + Layer layer, + Tile tile) { + vec2 p0 = floor(0.5 + instance_rect.xy * uDevicePixelRatio) / uDevicePixelRatio; + vec2 p1 = floor(0.5 + (instance_rect.xy + instance_rect.zw) * uDevicePixelRatio) / uDevicePixelRatio; + + vec2 local_pos = mix(p0, p1, aPosition.xy); + + vec2 cp0 = floor(0.5 + local_clip_rect.xy * uDevicePixelRatio) / uDevicePixelRatio; + vec2 cp1 = floor(0.5 + (local_clip_rect.xy + local_clip_rect.zw) * uDevicePixelRatio) / uDevicePixelRatio; + local_pos = clamp(local_pos, cp0, cp1); + + local_pos = clamp_rect(local_pos, layer.local_clip_rect); + + vec4 world_pos = layer.transform * vec4(local_pos, 0.0, 1.0); + world_pos.xyz /= world_pos.w; + + vec2 device_pos = world_pos.xy * uDevicePixelRatio; + + vec2 clamped_pos = clamp(device_pos, + tile.screen_origin_task_origin.xy, + tile.screen_origin_task_origin.xy + tile.size_target_index.xy); + + vec4 local_clamped_pos = layer.inv_transform * vec4(clamped_pos / uDevicePixelRatio, world_pos.z, 1); + local_clamped_pos.xyz /= local_clamped_pos.w; + + vec2 final_pos = clamped_pos + tile.screen_origin_task_origin.zw - tile.screen_origin_task_origin.xy; + + gl_Position = uTransform * vec4(final_pos, z, 1.0); + + VertexInfo vi = VertexInfo(Rect(p0, p1), local_clamped_pos.xy, clamped_pos.xy); + return vi; +} + +#ifdef WR_FEATURE_TRANSFORM + +struct TransformVertexInfo { + vec3 local_pos; + vec2 global_clamped_pos; + vec4 clipped_local_rect; +}; + +TransformVertexInfo write_transform_vertex(vec4 instance_rect, + vec4 local_clip_rect, + float z, + Layer layer, + Tile tile) { + vec2 lp0_base = instance_rect.xy; + vec2 lp1_base = instance_rect.xy + instance_rect.zw; + + vec2 lp0 = clamp_rect(clamp_rect(lp0_base, local_clip_rect), + layer.local_clip_rect); + vec2 lp1 = clamp_rect(clamp_rect(lp1_base, local_clip_rect), + layer.local_clip_rect); + + vec4 clipped_local_rect = vec4(lp0, lp1 - lp0); + + vec2 p0 = lp0; + vec2 p1 = vec2(lp1.x, lp0.y); + vec2 p2 = vec2(lp0.x, lp1.y); + vec2 p3 = lp1; + + vec4 t0 = layer.transform * vec4(p0, 0, 1); + vec4 t1 = layer.transform * vec4(p1, 0, 1); + vec4 t2 = layer.transform * vec4(p2, 0, 1); + vec4 t3 = layer.transform * vec4(p3, 0, 1); + + vec2 tp0 = t0.xy / t0.w; + vec2 tp1 = t1.xy / t1.w; + vec2 tp2 = t2.xy / t2.w; + vec2 tp3 = t3.xy / t3.w; + + // compute a CSS space aligned bounding box + vec2 min_pos = min(min(tp0.xy, tp1.xy), min(tp2.xy, tp3.xy)); + vec2 max_pos = max(max(tp0.xy, tp1.xy), max(tp2.xy, tp3.xy)); + + // clamp to the tile boundaries, in device space + vec2 min_pos_clamped = clamp(min_pos * uDevicePixelRatio, + tile.screen_origin_task_origin.xy, + tile.screen_origin_task_origin.xy + tile.size_target_index.xy); + + vec2 max_pos_clamped = clamp(max_pos * uDevicePixelRatio, + tile.screen_origin_task_origin.xy, + tile.screen_origin_task_origin.xy + tile.size_target_index.xy); + + // compute the device space position of this vertex + vec2 clamped_pos = mix(min_pos_clamped, + max_pos_clamped, + aPosition.xy); + + // compute the point position in side the layer, in CSS space + vec4 layer_pos = get_layer_pos(clamped_pos / uDevicePixelRatio, layer); + + // apply the task offset + vec2 final_pos = clamped_pos + tile.screen_origin_task_origin.zw - tile.screen_origin_task_origin.xy; + + gl_Position = uTransform * vec4(final_pos, z, 1.0); + + return TransformVertexInfo(layer_pos.xyw, clamped_pos, clipped_local_rect); +} + +#endif //WR_FEATURE_TRANSFORM + +struct ResourceRect { + vec4 uv_rect; +}; + +ResourceRect fetch_resource_rect(int index) { + ResourceRect rect; + + ivec2 uv = get_fetch_uv_1(index); + + rect.uv_rect = texelFetchOffset(sResourceRects, uv, 0, ivec2(0, 0)); + + return rect; +} + +struct Rectangle { + vec4 color; +}; + +Rectangle fetch_rectangle(int index) { + Rectangle rect; + + ivec2 uv = get_fetch_uv_1(index); + + rect.color = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); + + return rect; +} + +struct TextRun { + vec4 color; +}; + +TextRun fetch_text_run(int index) { + TextRun text; + + ivec2 uv = get_fetch_uv_1(index); + + text.color = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); + + return text; +} + +struct Image { + vec4 stretch_size_and_tile_spacing; // Size of the actual image and amount of space between + // tiled instances of this image. +}; + +Image fetch_image(int index) { + Image image; + + ivec2 uv = get_fetch_uv_1(index); + + image.stretch_size_and_tile_spacing = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); + + return image; +} + +// YUV color spaces +#define YUV_REC601 1 +#define YUV_REC709 2 + +struct YuvImage { + vec4 y_st_rect; + vec4 u_st_rect; + vec4 v_st_rect; + vec2 size; + int color_space; +}; + +YuvImage fetch_yuv_image(int index) { + YuvImage image; + + ivec2 uv = get_fetch_uv_4(index); + + image.y_st_rect = texelFetchOffset(sData64, uv, 0, ivec2(0, 0)); + image.u_st_rect = texelFetchOffset(sData64, uv, 0, ivec2(1, 0)); + image.v_st_rect = texelFetchOffset(sData64, uv, 0, ivec2(2, 0)); + vec4 size_color_space = texelFetchOffset(sData64, uv, 0, ivec2(3, 0)); + image.size = size_color_space.xy; + image.color_space = int(size_color_space.z); + + return image; +} + +struct BoxShadow { + vec4 src_rect; + vec4 bs_rect; + vec4 color; + vec4 border_radius_edge_size_blur_radius_inverted; +}; + +BoxShadow fetch_boxshadow(int index) { + BoxShadow bs; + + ivec2 uv = get_fetch_uv_4(index); + + bs.src_rect = texelFetchOffset(sData64, uv, 0, ivec2(0, 0)); + bs.bs_rect = texelFetchOffset(sData64, uv, 0, ivec2(1, 0)); + bs.color = texelFetchOffset(sData64, uv, 0, ivec2(2, 0)); + bs.border_radius_edge_size_blur_radius_inverted = texelFetchOffset(sData64, uv, 0, ivec2(3, 0)); + + return bs; +} + +void write_clip(vec2 global_pos, ClipArea area) { + vec2 texture_size = vec2(textureSize(sCache, 0).xy); + vec2 uv = global_pos + area.task_bounds.xy - area.screen_origin_target_index.xy; + vClipMaskUvBounds = area.task_bounds / texture_size.xyxy; + vClipMaskUv = vec3(uv / texture_size, area.screen_origin_target_index.z); +} +#endif //WR_VERTEX_SHADER + +#ifdef WR_FRAGMENT_SHADER +float distance_from_rect(vec2 p, vec2 origin, vec2 size) { + vec2 clamped = clamp(p, origin, origin + size); + return distance(clamped, p); +} + +vec2 init_transform_fs(vec3 local_pos, vec4 local_rect, out float fragment_alpha) { + fragment_alpha = 1.0; + vec2 pos = local_pos.xy / local_pos.z; + + float border_distance = distance_from_rect(pos, local_rect.xy, local_rect.zw); + if (border_distance != 0.0) { + float delta = length(fwidth(local_pos.xy)); + fragment_alpha = 1.0 - smoothstep(0.0, 1.0, border_distance / delta * 2.0); + } + + return pos; +} + +float do_clip() { + // anything outside of the mask is considered transparent + bvec4 inside = lessThanEqual( + vec4(vClipMaskUvBounds.xy, vClipMaskUv.xy), + vec4(vClipMaskUv.xy, vClipMaskUvBounds.zw)); + // check for the dummy bounds, which are given to the opaque objects + return vClipMaskUvBounds.xy == vClipMaskUvBounds.zw ? 1.0: + all(inside) ? textureLod(sCache, vClipMaskUv, 0.0).r : 0.0; +} +#endif //WR_FRAGMENT_SHADER diff --git a/gfx/webrender/res/ps_angle_gradient.fs.glsl b/gfx/webrender/res/ps_angle_gradient.fs.glsl new file mode 100644 index 000000000000..70f42a195518 --- /dev/null +++ b/gfx/webrender/res/ps_angle_gradient.fs.glsl @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +float offset(int index) { + return vOffsets[index / 4][index % 4]; +} + +float linearStep(float lo, float hi, float x) { + float d = hi - lo; + float v = x - lo; + if (d != 0.0) { + v /= d; + } + return clamp(v, 0.0, 1.0); +} + +void main(void) { + float angle = atan(-vEndPoint.y + vStartPoint.y, + vEndPoint.x - vStartPoint.x); + float sa = sin(angle); + float ca = cos(angle); + + float sx = vStartPoint.x * ca - vStartPoint.y * sa; + float ex = vEndPoint.x * ca - vEndPoint.y * sa; + float d = ex - sx; + + float x = vPos.x * ca - vPos.y * sa; + + oFragColor = mix(vColors[0], + vColors[1], + linearStep(sx + d * offset(0), sx + d * offset(1), x)); + + for (int i=1 ; i < vStopCount-1 ; ++i) { + oFragColor = mix(oFragColor, + vColors[i+1], + linearStep(sx + d * offset(i), sx + d * offset(i+1), x)); + } +} diff --git a/gfx/webrender/res/ps_angle_gradient.glsl b/gfx/webrender/res/ps_angle_gradient.glsl new file mode 100644 index 000000000000..0ef309411868 --- /dev/null +++ b/gfx/webrender/res/ps_angle_gradient.glsl @@ -0,0 +1,11 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +flat varying int vStopCount; +flat varying float vAngle; +flat varying vec2 vStartPoint; +flat varying vec2 vEndPoint; +varying vec2 vPos; +flat varying vec4 vColors[MAX_STOPS_PER_ANGLE_GRADIENT]; +flat varying vec4 vOffsets[MAX_STOPS_PER_ANGLE_GRADIENT/4]; diff --git a/gfx/webrender/res/ps_angle_gradient.vs.glsl b/gfx/webrender/res/ps_angle_gradient.vs.glsl new file mode 100644 index 000000000000..53c39ec44132 --- /dev/null +++ b/gfx/webrender/res/ps_angle_gradient.vs.glsl @@ -0,0 +1,33 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); + Gradient gradient = fetch_gradient(prim.prim_index); + + VertexInfo vi = write_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + + vStopCount = int(prim.user_data.x); + vPos = vi.local_clamped_pos; + + // Snap the start/end points to device pixel units. + // I'm not sure this is entirely correct, but the + // old render path does this, and it is needed to + // make the angle gradient ref tests pass. It might + // be better to fix this higher up in DL construction + // and not snap here? + vStartPoint = floor(0.5 + gradient.start_end_point.xy * uDevicePixelRatio) / uDevicePixelRatio; + vEndPoint = floor(0.5 + gradient.start_end_point.zw * uDevicePixelRatio) / uDevicePixelRatio; + + for (int i=0 ; i < vStopCount ; ++i) { + GradientStop stop = fetch_gradient_stop(prim.sub_index + i); + vColors[i] = stop.color; + vOffsets[i/4][i%4] = stop.offset.x; + } +} diff --git a/gfx/webrender/res/ps_blend.fs.glsl b/gfx/webrender/res/ps_blend.fs.glsl new file mode 100644 index 000000000000..7ce203fbbf9d --- /dev/null +++ b/gfx/webrender/res/ps_blend.fs.glsl @@ -0,0 +1,138 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +vec3 rgbToHsv(vec3 c) { + float value = max(max(c.r, c.g), c.b); + + float chroma = value - min(min(c.r, c.g), c.b); + if (chroma == 0.0) { + return vec3(0.0); + } + float saturation = chroma / value; + + float hue; + if (c.r == value) + hue = (c.g - c.b) / chroma; + else if (c.g == value) + hue = 2.0 + (c.b - c.r) / chroma; + else // if (c.b == value) + hue = 4.0 + (c.r - c.g) / chroma; + + hue *= 1.0/6.0; + if (hue < 0.0) + hue += 1.0; + return vec3(hue, saturation, value); +} + +vec3 hsvToRgb(vec3 c) { + if (c.s == 0.0) { + return vec3(c.z); + } + + float hue = c.x * 6.0; + int sector = int(hue); + float residualHue = hue - float(sector); + + vec3 pqt = c.z * vec3(1.0 - c.y, 1.0 - c.y * residualHue, 1.0 - c.y * (1.0 - residualHue)); + switch (sector) { + case 0: + return vec3(c.z, pqt.z, pqt.x); + case 1: + return vec3(pqt.y, c.z, pqt.x); + case 2: + return vec3(pqt.x, c.z, pqt.z); + case 3: + return vec3(pqt.x, pqt.y, c.z); + case 4: + return vec3(pqt.z, pqt.x, c.z); + default: + return vec3(c.z, pqt.x, pqt.y); + } +} + +vec4 Blur(float radius, vec2 direction) { + // TODO(gw): Support blur in WR2! + return vec4(1.0); +} + +vec4 Contrast(vec4 Cs, float amount) { + return vec4(Cs.rgb * amount - 0.5 * amount + 0.5, 1.0); +} + +vec4 Grayscale(vec4 Cs, float amount) { + float ia = 1.0 - amount; + return mat4(vec4(0.2126 + 0.7874 * ia, 0.2126 - 0.2126 * ia, 0.2126 - 0.2126 * ia, 0.0), + vec4(0.7152 - 0.7152 * ia, 0.7152 + 0.2848 * ia, 0.7152 - 0.7152 * ia, 0.0), + vec4(0.0722 - 0.0722 * ia, 0.0722 - 0.0722 * ia, 0.0722 + 0.9278 * ia, 0.0), + vec4(0.0, 0.0, 0.0, 1.0)) * Cs; +} + +vec4 HueRotate(vec4 Cs, float amount) { + vec3 CsHsv = rgbToHsv(Cs.rgb); + CsHsv.x = mod(CsHsv.x + amount / 6.283185307179586, 1.0); + return vec4(hsvToRgb(CsHsv), Cs.a); +} + +vec4 Invert(vec4 Cs, float amount) { + return mix(Cs, vec4(1.0, 1.0, 1.0, Cs.a) - vec4(Cs.rgb, 0.0), amount); +} + +vec4 Saturate(vec4 Cs, float amount) { + return vec4(hsvToRgb(min(vec3(1.0, amount, 1.0) * rgbToHsv(Cs.rgb), vec3(1.0))), Cs.a); +} + +vec4 Sepia(vec4 Cs, float amount) { + float ia = 1.0 - amount; + return mat4(vec4(0.393 + 0.607 * ia, 0.349 - 0.349 * ia, 0.272 - 0.272 * ia, 0.0), + vec4(0.769 - 0.769 * ia, 0.686 + 0.314 * ia, 0.534 - 0.534 * ia, 0.0), + vec4(0.189 - 0.189 * ia, 0.168 - 0.168 * ia, 0.131 + 0.869 * ia, 0.0), + vec4(0.0, 0.0, 0.0, 1.0)) * Cs; +} + +vec4 Brightness(vec4 Cs, float amount) { + return vec4(Cs.rgb * amount, Cs.a); +} + +vec4 Opacity(vec4 Cs, float amount) { + return vec4(Cs.rgb, Cs.a * amount); +} + +void main(void) { + vec4 Cs = texture(sCache, vUv); + + if (Cs.a == 0.0) { + discard; + } + + switch (vOp) { + case 0: + // Gaussian blur is specially handled: + oFragColor = Cs;// Blur(vAmount, vec2(0,0)); + break; + case 1: + oFragColor = Contrast(Cs, vAmount); + break; + case 2: + oFragColor = Grayscale(Cs, vAmount); + break; + case 3: + oFragColor = HueRotate(Cs, vAmount); + break; + case 4: + oFragColor = Invert(Cs, vAmount); + break; + case 5: + oFragColor = Saturate(Cs, vAmount); + break; + case 6: + oFragColor = Sepia(Cs, vAmount); + break; + case 7: + oFragColor = Brightness(Cs, vAmount); + break; + case 8: + oFragColor = Opacity(Cs, vAmount); + break; + } +} diff --git a/gfx/webrender/res/ps_blend.glsl b/gfx/webrender/res/ps_blend.glsl new file mode 100644 index 000000000000..09e6d9262a26 --- /dev/null +++ b/gfx/webrender/res/ps_blend.glsl @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec3 vUv; +flat varying float vAmount; +flat varying int vOp; diff --git a/gfx/webrender/res/ps_blend.vs.glsl b/gfx/webrender/res/ps_blend.vs.glsl new file mode 100644 index 000000000000..30960d8402da --- /dev/null +++ b/gfx/webrender/res/ps_blend.vs.glsl @@ -0,0 +1,46 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +struct Blend { + ivec4 src_id_target_id_op_amount; + int z; +}; + +Blend fetch_blend() { + PrimitiveInstance pi = fetch_prim_instance(); + + Blend blend; + blend.src_id_target_id_op_amount = ivec4(pi.user_data.x, + pi.render_task_index, + pi.sub_index, + pi.user_data.y); + blend.z = pi.z; + + return blend; +} + +void main(void) { + Blend blend = fetch_blend(); + Tile src = fetch_tile(blend.src_id_target_id_op_amount.x); + Tile dest = fetch_tile(blend.src_id_target_id_op_amount.y); + + vec2 dest_origin = dest.screen_origin_task_origin.zw - + dest.screen_origin_task_origin.xy + + src.screen_origin_task_origin.xy; + + vec2 local_pos = mix(dest_origin, + dest_origin + src.size_target_index.xy, + aPosition.xy); + + vec2 texture_size = vec2(textureSize(sCache, 0)); + vec2 st0 = src.screen_origin_task_origin.zw / texture_size; + vec2 st1 = (src.screen_origin_task_origin.zw + src.size_target_index.xy) / texture_size; + vUv = vec3(mix(st0, st1, aPosition.xy), src.size_target_index.z); + + vOp = blend.src_id_target_id_op_amount.z; + vAmount = float(blend.src_id_target_id_op_amount.w) / 65535.0; + + gl_Position = uTransform * vec4(local_pos, blend.z, 1.0); +} diff --git a/gfx/webrender/res/ps_border.fs.glsl b/gfx/webrender/res/ps_border.fs.glsl new file mode 100644 index 000000000000..7ddbb487d7c7 --- /dev/null +++ b/gfx/webrender/res/ps_border.fs.glsl @@ -0,0 +1,408 @@ +#line 1 + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Border styles as defined in webrender_traits/types.rs +#define BORDER_STYLE_NONE 0 +#define BORDER_STYLE_SOLID 1 +#define BORDER_STYLE_DOUBLE 2 +#define BORDER_STYLE_DOTTED 3 +#define BORDER_STYLE_DASHED 4 +#define BORDER_STYLE_HIDDEN 5 +#define BORDER_STYLE_GROOVE 6 +#define BORDER_STYLE_RIDGE 7 +#define BORDER_STYLE_INSET 8 +#define BORDER_STYLE_OUTSET 9 + +void discard_pixels_in_rounded_borders(vec2 local_pos) { + float distanceFromRef = distance(vRefPoint, local_pos); + if (vRadii.x > 0.0 && (distanceFromRef > vRadii.x || distanceFromRef < vRadii.z)) { + discard; + } +} + +vec4 get_fragment_color(float distanceFromMixLine, float pixelsPerFragment) { + // Here we are mixing between the two border colors. We need to convert + // distanceFromMixLine it to pixel space to properly anti-alias and then push + // it between the limits accepted by `mix`. + float colorMix = min(max(distanceFromMixLine / pixelsPerFragment, -0.5), 0.5) + 0.5; + return mix(vHorizontalColor, vVerticalColor, colorMix); +} + +float alpha_for_solid_border(float distance_from_ref, + float inner_radius, + float outer_radius, + float pixels_per_fragment) { + // We want to start anti-aliasing one pixel in from the border. + float nudge = pixels_per_fragment; + inner_radius += nudge; + outer_radius -= nudge; + + if (distance_from_ref < outer_radius && distance_from_ref > inner_radius) { + return 1.0; + } + + float distance_from_border = max(distance_from_ref - outer_radius, + inner_radius - distance_from_ref); + + // Move the distance back into pixels. + distance_from_border /= pixels_per_fragment; + + // Apply a more gradual fade out to transparent. + // distance_from_border -= 0.5; + + return 1.0 - smoothstep(0.0, 1.0, distance_from_border); +} + +float alpha_for_solid_border_corner(vec2 local_pos, + float inner_radius, + float outer_radius, + float pixels_per_fragment) { + float distance_from_ref = distance(vRefPoint, local_pos); + return alpha_for_solid_border(distance_from_ref, inner_radius, outer_radius, pixels_per_fragment); +} + +vec4 draw_dotted_edge(vec2 local_pos, vec4 piece_rect, float pixels_per_fragment) { + // We don't use pixels_per_fragment here, since it can change along the edge + // of a transformed border edge. We want this calculation to be consistent + // across the entire edge so that the positioning of the dots stays the same. + float two_pixels = 2.0 * length(fwidth(vLocalPos.xy)); + + // Circle diameter is stroke width, minus a couple pixels to account for anti-aliasing. + float circle_diameter = max(piece_rect.z - two_pixels, min(piece_rect.z, two_pixels)); + + // We want to spread the circles across the edge, but keep one circle diameter at the end + // reserved for two half-circles which connect to the corners. + float edge_available = piece_rect.w - (circle_diameter * 2.0); + float number_of_circles = floor(edge_available / (circle_diameter * 2.0)); + + // Here we are initializing the distance from the y coordinate of the center of the circle to + // the closest end half-circle. + vec2 relative_pos = local_pos - piece_rect.xy; + float y_distance = min(relative_pos.y, piece_rect.w - relative_pos.y); + + if (number_of_circles > 0.0) { + // Spread the circles throughout the edge, to distribute the extra space evenly. We want + // to ensure that we have at last two pixels of space for each circle so that they aren't + // touching. + float space_for_each_circle = ceil(max(edge_available / number_of_circles, two_pixels)); + + float first_half_circle_space = circle_diameter; + + float circle_index = (relative_pos.y - first_half_circle_space) / space_for_each_circle; + circle_index = floor(clamp(circle_index, 0.0, number_of_circles - 1.0)); + + float circle_y_pos = + circle_index * space_for_each_circle + (space_for_each_circle / 2.0) + circle_diameter; + y_distance = min(abs(circle_y_pos - relative_pos.y), y_distance); + } + + float distance_from_circle_center = length(vec2(relative_pos.x - (piece_rect.z / 2.0), y_distance)); + float distance_from_circle_edge = distance_from_circle_center - (circle_diameter / 2.0); + + // Don't anti-alias if the circle diameter is small to avoid a blur of color. + if (circle_diameter < two_pixels && distance_from_circle_edge > 0.0) + return vec4(0.0); + + // Move the distance back into pixels. + distance_from_circle_edge /= pixels_per_fragment; + + float alpha = 1.0 - smoothstep(0.0, 1.0, min(1.0, max(0.0, distance_from_circle_edge))); + return vHorizontalColor * vec4(1.0, 1.0, 1.0, alpha); +} + +vec4 draw_dashed_edge(float position, float border_width, float pixels_per_fragment) { + // TODO: Investigate exactly what FF does. + float size = border_width * 3.0; + float segment = floor(position / size); + + float alpha = alpha_for_solid_border(position, + segment * size, + (segment + 1.0) * size, + pixels_per_fragment); + + if (mod(segment + 2.0, 2.0) == 0.0) { + return vHorizontalColor * vec4(1.0, 1.0, 1.0, 1.0 - alpha); + } else { + return vHorizontalColor * vec4(1.0, 1.0, 1.0, alpha); + } +} + +void draw_dashed_or_dotted_border(vec2 local_pos, float distance_from_mix_line) { + // This is the conversion factor for transformations and device pixel scaling. + float pixels_per_fragment = length(fwidth(local_pos.xy)); + + switch (vBorderPart) { + // These are the layer tile part PrimitivePart as uploaded by the tiling.rs + case PST_TOP_LEFT: + case PST_TOP_RIGHT: + case PST_BOTTOM_LEFT: + case PST_BOTTOM_RIGHT: + { + oFragColor = get_fragment_color(distance_from_mix_line, pixels_per_fragment); + if (vRadii.x > 0.0) { + oFragColor *= vec4(1.0, 1.0, 1.0, alpha_for_solid_border_corner(local_pos, + vRadii.z, + vRadii.x, + pixels_per_fragment)); + } + + break; + } + case PST_BOTTOM: + case PST_TOP: { + if (vBorderStyle == BORDER_STYLE_DASHED) { + oFragColor = draw_dashed_edge(vLocalPos.x - vPieceRect.x, + vPieceRect.w, + pixels_per_fragment); + } else { + oFragColor = draw_dotted_edge(local_pos.yx, vPieceRect.yxwz, pixels_per_fragment); + } + break; + } + case PST_LEFT: + case PST_RIGHT: + { + if (vBorderStyle == BORDER_STYLE_DASHED) { + oFragColor = draw_dashed_edge(vLocalPos.y - vPieceRect.y, + vPieceRect.z, + pixels_per_fragment); + } else { + oFragColor = draw_dotted_edge(local_pos.xy, vPieceRect.xyzw, pixels_per_fragment); + } + break; + } + } +} + +vec4 draw_double_edge(float pos, + float len, + float distance_from_mix_line, + float pixels_per_fragment) { + float total_border_width = len; + float one_third_width = total_border_width / 3.0; + + // Contribution of the outer border segment. + float alpha = alpha_for_solid_border(pos, + total_border_width - one_third_width, + total_border_width, + pixels_per_fragment); + + // Contribution of the inner border segment. + alpha += alpha_for_solid_border(pos, 0.0, one_third_width, pixels_per_fragment); + return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha); +} + +vec4 draw_double_edge_vertical(vec2 local_pos, + float distance_from_mix_line, + float pixels_per_fragment) { + // Get our position within this specific segment + float position = local_pos.x - vLocalRect.x; + return draw_double_edge(position, vLocalRect.z, distance_from_mix_line, pixels_per_fragment); +} + +vec4 draw_double_edge_horizontal(vec2 local_pos, + float distance_from_mix_line, + float pixels_per_fragment) { + // Get our position within this specific segment + float position = local_pos.y - vLocalRect.y; + return draw_double_edge(position, vLocalRect.w, distance_from_mix_line, pixels_per_fragment); +} + +vec4 draw_double_edge_corner_with_radius(vec2 local_pos, + float distance_from_mix_line, + float pixels_per_fragment) { + float total_border_width = vRadii.x - vRadii.z; + float one_third_width = total_border_width / 3.0; + + // Contribution of the outer border segment. + float alpha = alpha_for_solid_border_corner(local_pos, + vRadii.x - one_third_width, + vRadii.x, + pixels_per_fragment); + + // Contribution of the inner border segment. + alpha += alpha_for_solid_border_corner(local_pos, + vRadii.z, + vRadii.z + one_third_width, + pixels_per_fragment); + return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha); +} + +vec4 draw_double_edge_corner(vec2 local_pos, + float distance_from_mix_line, + float pixels_per_fragment) { + if (vRadii.x > 0.0) { + return draw_double_edge_corner_with_radius(local_pos, + distance_from_mix_line, + pixels_per_fragment); + } + + bool is_vertical = (vBorderPart == PST_TOP_LEFT) ? distance_from_mix_line < 0.0 : + distance_from_mix_line >= 0.0; + if (is_vertical) { + return draw_double_edge_vertical(local_pos, distance_from_mix_line, pixels_per_fragment); + } else { + return draw_double_edge_horizontal(local_pos, distance_from_mix_line, pixels_per_fragment); + } +} + +void draw_double_border(float distance_from_mix_line, vec2 local_pos) { + float pixels_per_fragment = length(fwidth(local_pos.xy)); + switch (vBorderPart) { + // These are the layer tile part PrimitivePart as uploaded by the tiling.rs + case PST_TOP_LEFT: + case PST_TOP_RIGHT: + case PST_BOTTOM_LEFT: + case PST_BOTTOM_RIGHT: + { + oFragColor = draw_double_edge_corner(local_pos, distance_from_mix_line, pixels_per_fragment); + break; + } + case PST_BOTTOM: + case PST_TOP: + { + oFragColor = draw_double_edge_horizontal(local_pos, + distance_from_mix_line, + pixels_per_fragment); + break; + } + case PST_LEFT: + case PST_RIGHT: + { + oFragColor = draw_double_edge_vertical(local_pos, + distance_from_mix_line, + pixels_per_fragment); + break; + } + } +} + +void draw_solid_border(float distanceFromMixLine, vec2 localPos) { + switch (vBorderPart) { + case PST_TOP_LEFT: + case PST_TOP_RIGHT: + case PST_BOTTOM_LEFT: + case PST_BOTTOM_RIGHT: { + // This is the conversion factor for transformations and device pixel scaling. + float pixelsPerFragment = length(fwidth(localPos.xy)); + oFragColor = get_fragment_color(distanceFromMixLine, pixelsPerFragment); + + if (vRadii.x > 0.0) { + float alpha = alpha_for_solid_border_corner(localPos, vRadii.z, vRadii.x, pixelsPerFragment); + oFragColor *= vec4(1.0, 1.0, 1.0, alpha); + } + + break; + } + default: + oFragColor = vHorizontalColor; + discard_pixels_in_rounded_borders(localPos); + } +} + +vec4 draw_mixed_edge(float distance, float border_len, vec4 color, vec2 brightness_mod) { + float modulator = distance / border_len > 0.5 ? brightness_mod.x : brightness_mod.y; + return vec4(color.xyz * modulator, color.a); +} + +void draw_mixed_border(float distanceFromMixLine, float distanceFromMiddle, vec2 localPos, vec2 brightness_mod) { + switch (vBorderPart) { + case PST_TOP_LEFT: + case PST_TOP_RIGHT: + case PST_BOTTOM_LEFT: + case PST_BOTTOM_RIGHT: { + // This is the conversion factor for transformations and device pixel scaling. + float pixelsPerFragment = length(fwidth(localPos.xy)); + vec4 color = get_fragment_color(distanceFromMixLine, pixelsPerFragment); + + float distance = distance(vRefPoint, localPos) - vRadii.z; + float length = vRadii.x - vRadii.z; + if (distanceFromMiddle < 0.0) { + distance = length - distance; + } + + oFragColor = 0.0 <= distance && distance <= length ? + draw_mixed_edge(distance, length, color, brightness_mod) : vec4(0.0, 0.0, 0.0, 0.0); + break; + } + case PST_BOTTOM: + case PST_TOP: { + oFragColor = draw_mixed_edge(localPos.y - vPieceRect.y, vPieceRect.w, vVerticalColor, brightness_mod); + break; + } + case PST_LEFT: + case PST_RIGHT: { + oFragColor = draw_mixed_edge(localPos.x - vPieceRect.x, vPieceRect.z, vHorizontalColor, brightness_mod); + break; + } + } +} + +// TODO: Investigate performance of this shader and see +// if it's worthwhile splitting it / removing branches etc. +void main(void) { +#ifdef WR_FEATURE_TRANSFORM + float alpha = 0.0; + vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha); +#else + vec2 local_pos = vLocalPos; +#endif + +#ifdef WR_FEATURE_TRANSFORM + // TODO(gw): Support other border styles for transformed elements. + float distance_from_mix_line = (local_pos.x - vPieceRect.x) * vPieceRect.w - + (local_pos.y - vPieceRect.y) * vPieceRect.z; + distance_from_mix_line /= vPieceRectHypotenuseLength; + float distance_from_middle = (local_pos.x - vLocalRect.x) + + (local_pos.y - vLocalRect.y) - + 0.5 * (vLocalRect.z + vLocalRect.w); +#else + float distance_from_mix_line = vDistanceFromMixLine; + float distance_from_middle = vDistanceFromMiddle; +#endif + + vec2 brightness_mod = vec2(0.7, 1.3); + + // Note: we can't pass-through in the following cases, + // because Angle doesn't support it and fails to compile the shaders. + switch (vBorderStyle) { + case BORDER_STYLE_DASHED: + draw_dashed_or_dotted_border(local_pos, distance_from_mix_line); + break; + case BORDER_STYLE_DOTTED: + draw_dashed_or_dotted_border(local_pos, distance_from_mix_line); + break; + case BORDER_STYLE_DOUBLE: + draw_double_border(distance_from_mix_line, local_pos); + break; + case BORDER_STYLE_OUTSET: + draw_solid_border(distance_from_mix_line, local_pos); + break; + case BORDER_STYLE_INSET: + draw_solid_border(distance_from_mix_line, local_pos); + break; + case BORDER_STYLE_SOLID: + draw_solid_border(distance_from_mix_line, local_pos); + break; + case BORDER_STYLE_NONE: + draw_solid_border(distance_from_mix_line, local_pos); + break; + case BORDER_STYLE_GROOVE: + draw_mixed_border(distance_from_mix_line, distance_from_middle, local_pos, brightness_mod.yx); + break; + case BORDER_STYLE_RIDGE: + draw_mixed_border(distance_from_mix_line, distance_from_middle, local_pos, brightness_mod.xy); + break; + case BORDER_STYLE_HIDDEN: + discard; + default: + discard; + } + +#ifdef WR_FEATURE_TRANSFORM + oFragColor *= vec4(1.0, 1.0, 1.0, alpha); +#endif +} diff --git a/gfx/webrender/res/ps_border.glsl b/gfx/webrender/res/ps_border.glsl new file mode 100644 index 000000000000..4e2a8c7cc3c8 --- /dev/null +++ b/gfx/webrender/res/ps_border.glsl @@ -0,0 +1,33 @@ +#line 1 + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// These are not changing. +flat varying vec4 vVerticalColor; // The vertical color, e.g. top/bottom +flat varying vec4 vHorizontalColor; // The horizontal color e.g. left/right +flat varying vec4 vRadii; // The border radius from CSS border-radius +flat varying vec4 vLocalRect; // The rect of the border (x, y, w, h) in local space. + +// for corners, this is the beginning of the corner. +// For the lines, this is the top left of the line. +flat varying vec2 vRefPoint; +flat varying int vBorderStyle; +flat varying int vBorderPart; // Which part of the border we're drawing. + +flat varying vec4 vPieceRect; + +// These are in device space +#ifdef WR_FEATURE_TRANSFORM +varying vec3 vLocalPos; // The clamped position in local space. +flat varying float vPieceRectHypotenuseLength; +#else +varying vec2 vLocalPos; // The clamped position in local space. + +// These two are interpolated +varying float vDistanceFromMixLine; // This is the distance from the line where two colors + // meet in border corners. +varying float vDistanceFromMiddle; // This is the distance from the line between the top + // left corner and the bottom right. +#endif diff --git a/gfx/webrender/res/ps_border.vs.glsl b/gfx/webrender/res/ps_border.vs.glsl new file mode 100644 index 000000000000..2d60f8dc5ede --- /dev/null +++ b/gfx/webrender/res/ps_border.vs.glsl @@ -0,0 +1,226 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +struct Border { + vec4 style; + vec4 widths; + vec4 colors[4]; + vec4 radii[2]; +}; + +Border fetch_border(int index) { + Border border; + + ivec2 uv = get_fetch_uv_8(index); + + border.style = texelFetchOffset(sData128, uv, 0, ivec2(0, 0)); + border.widths = texelFetchOffset(sData128, uv, 0, ivec2(1, 0)); + border.colors[0] = texelFetchOffset(sData128, uv, 0, ivec2(2, 0)); + border.colors[1] = texelFetchOffset(sData128, uv, 0, ivec2(3, 0)); + border.colors[2] = texelFetchOffset(sData128, uv, 0, ivec2(4, 0)); + border.colors[3] = texelFetchOffset(sData128, uv, 0, ivec2(5, 0)); + border.radii[0] = texelFetchOffset(sData128, uv, 0, ivec2(6, 0)); + border.radii[1] = texelFetchOffset(sData128, uv, 0, ivec2(7, 0)); + + return border; +} + +void main(void) { + Primitive prim = load_primitive(); + Border border = fetch_border(prim.prim_index); + int sub_part = prim.sub_index; + + vec2 tl_outer = prim.local_rect.xy; + vec2 tl_inner = tl_outer + vec2(max(border.radii[0].x, border.widths.x), + max(border.radii[0].y, border.widths.y)); + + vec2 tr_outer = vec2(prim.local_rect.x + prim.local_rect.z, + prim.local_rect.y); + vec2 tr_inner = tr_outer + vec2(-max(border.radii[0].z, border.widths.z), + max(border.radii[0].w, border.widths.y)); + + vec2 br_outer = vec2(prim.local_rect.x + prim.local_rect.z, + prim.local_rect.y + prim.local_rect.w); + vec2 br_inner = br_outer - vec2(max(border.radii[1].x, border.widths.z), + max(border.radii[1].y, border.widths.w)); + + vec2 bl_outer = vec2(prim.local_rect.x, + prim.local_rect.y + prim.local_rect.w); + vec2 bl_inner = bl_outer + vec2(max(border.radii[1].z, border.widths.x), + -max(border.radii[1].w, border.widths.w)); + + vec4 segment_rect; + switch (sub_part) { + case PST_TOP_LEFT: + segment_rect = vec4(tl_outer, tl_inner - tl_outer); + vBorderStyle = int(border.style.x); + vHorizontalColor = border.colors[BORDER_LEFT]; + vVerticalColor = border.colors[BORDER_TOP]; + vRadii = vec4(border.radii[0].xy, + border.radii[0].xy - border.widths.xy); + break; + case PST_TOP_RIGHT: + segment_rect = vec4(tr_inner.x, + tr_outer.y, + tr_outer.x - tr_inner.x, + tr_inner.y - tr_outer.y); + vBorderStyle = int(border.style.y); + vHorizontalColor = border.colors[BORDER_TOP]; + vVerticalColor = border.colors[BORDER_RIGHT]; + vRadii = vec4(border.radii[0].zw, + border.radii[0].zw - border.widths.zy); + break; + case PST_BOTTOM_RIGHT: + segment_rect = vec4(br_inner, br_outer - br_inner); + vBorderStyle = int(border.style.z); + vHorizontalColor = border.colors[BORDER_BOTTOM]; + vVerticalColor = border.colors[BORDER_RIGHT]; + vRadii = vec4(border.radii[1].xy, + border.radii[1].xy - border.widths.zw); + break; + case PST_BOTTOM_LEFT: + segment_rect = vec4(bl_outer.x, + bl_inner.y, + bl_inner.x - bl_outer.x, + bl_outer.y - bl_inner.y); + vBorderStyle = int(border.style.w); + vHorizontalColor = border.colors[BORDER_BOTTOM]; + vVerticalColor = border.colors[BORDER_LEFT]; + vRadii = vec4(border.radii[1].zw, + border.radii[1].zw - border.widths.xw); + break; + case PST_LEFT: + segment_rect = vec4(tl_outer.x, + tl_inner.y, + border.widths.x, + bl_inner.y - tl_inner.y); + vBorderStyle = int(border.style.x); + vHorizontalColor = border.colors[BORDER_LEFT]; + vVerticalColor = border.colors[BORDER_LEFT]; + vRadii = vec4(0.0); + break; + case PST_RIGHT: + segment_rect = vec4(tr_outer.x - border.widths.z, + tr_inner.y, + border.widths.z, + br_inner.y - tr_inner.y); + vBorderStyle = int(border.style.z); + vHorizontalColor = border.colors[BORDER_RIGHT]; + vVerticalColor = border.colors[BORDER_RIGHT]; + vRadii = vec4(0.0); + break; + case PST_BOTTOM: + segment_rect = vec4(bl_inner.x, + bl_outer.y - border.widths.w, + br_inner.x - bl_inner.x, + border.widths.w); + vBorderStyle = int(border.style.w); + vHorizontalColor = border.colors[BORDER_BOTTOM]; + vVerticalColor = border.colors[BORDER_BOTTOM]; + vRadii = vec4(0.0); + break; + case PST_TOP: + segment_rect = vec4(tl_inner.x, + tl_outer.y, + tr_inner.x - tl_inner.x, + border.widths.y); + vBorderStyle = int(border.style.y); + vHorizontalColor = border.colors[BORDER_TOP]; + vVerticalColor = border.colors[BORDER_TOP]; + vRadii = vec4(0.0); + break; + } + +#ifdef WR_FEATURE_TRANSFORM + TransformVertexInfo vi = write_transform_vertex(segment_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalPos = vi.local_pos; + + // Local space + vLocalRect = vi.clipped_local_rect; +#else + VertexInfo vi = write_vertex(segment_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalPos = vi.local_clamped_pos.xy; + + // Local space + vLocalRect = prim.local_rect; +#endif + + float x0, y0, x1, y1; + switch (sub_part) { + // These are the layer tile part PrimitivePart as uploaded by the tiling.rs + case PST_TOP_LEFT: + x0 = segment_rect.x; + y0 = segment_rect.y; + // These are width / heights + x1 = segment_rect.x + segment_rect.z; + y1 = segment_rect.y + segment_rect.w; + + // The radius here is the border-radius. This is 0, so vRefPoint will + // just be the top left (x,y) corner. + vRefPoint = vec2(x0, y0) + vRadii.xy; + break; + case PST_TOP_RIGHT: + x0 = segment_rect.x + segment_rect.z; + y0 = segment_rect.y; + x1 = segment_rect.x; + y1 = segment_rect.y + segment_rect.w; + vRefPoint = vec2(x0, y0) + vec2(-vRadii.x, vRadii.y); + break; + case PST_BOTTOM_LEFT: + x0 = segment_rect.x; + y0 = segment_rect.y + segment_rect.w; + x1 = segment_rect.x + segment_rect.z; + y1 = segment_rect.y; + vRefPoint = vec2(x0, y0) + vec2(vRadii.x, -vRadii.y); + break; + case PST_BOTTOM_RIGHT: + x0 = segment_rect.x; + y0 = segment_rect.y; + x1 = segment_rect.x + segment_rect.z; + y1 = segment_rect.y + segment_rect.w; + vRefPoint = vec2(x1, y1) + vec2(-vRadii.x, -vRadii.y); + break; + case PST_TOP: + case PST_LEFT: + case PST_BOTTOM: + case PST_RIGHT: + vRefPoint = segment_rect.xy; + x0 = segment_rect.x; + y0 = segment_rect.y; + x1 = segment_rect.x + segment_rect.z; + y1 = segment_rect.y + segment_rect.w; + break; + } + + // y1 - y0 is the height of the corner / line + // x1 - x0 is the width of the corner / line. + float width = x1 - x0; + float height = y1 - y0; + + vBorderPart = sub_part; + vPieceRect = vec4(x0, y0, width, height); + + // The fragment shader needs to calculate the distance from the bisecting line + // to properly mix border colors. For transformed borders, we calculate this distance + // in the fragment shader itself. For non-transformed borders, we can use the + // interpolator. +#ifdef WR_FEATURE_TRANSFORM + vPieceRectHypotenuseLength = sqrt(pow(width, 2.0) + pow(height, 2.0)); +#else + vDistanceFromMixLine = (vi.local_clamped_pos.x - x0) * height - + (vi.local_clamped_pos.y - y0) * width; + vDistanceFromMiddle = (vi.local_clamped_pos.x - vLocalRect.x) + + (vi.local_clamped_pos.y - vLocalRect.y) - + 0.5 * (vLocalRect.z + vLocalRect.w); +#endif +} diff --git a/gfx/webrender/res/ps_box_shadow.fs.glsl b/gfx/webrender/res/ps_box_shadow.fs.glsl new file mode 100644 index 000000000000..8392ab698beb --- /dev/null +++ b/gfx/webrender/res/ps_box_shadow.fs.glsl @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + vec2 uv = min(vec2(1.0), vMirrorPoint - abs(vUv.xy - vMirrorPoint)); + uv = mix(vCacheUvRectCoords.xy, vCacheUvRectCoords.zw, uv); + oFragColor = vColor * texture(sCache, vec3(uv, vUv.z)); +} diff --git a/gfx/webrender/res/ps_box_shadow.glsl b/gfx/webrender/res/ps_box_shadow.glsl new file mode 100644 index 000000000000..40faee87f583 --- /dev/null +++ b/gfx/webrender/res/ps_box_shadow.glsl @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +flat varying vec4 vColor; + +varying vec3 vUv; +flat varying vec2 vMirrorPoint; +flat varying vec4 vCacheUvRectCoords; diff --git a/gfx/webrender/res/ps_box_shadow.vs.glsl b/gfx/webrender/res/ps_box_shadow.vs.glsl new file mode 100644 index 000000000000..47cfae51745e --- /dev/null +++ b/gfx/webrender/res/ps_box_shadow.vs.glsl @@ -0,0 +1,32 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); + BoxShadow bs = fetch_boxshadow(prim.prim_index); + vec4 segment_rect = fetch_instance_geometry(prim.sub_index); + + VertexInfo vi = write_vertex(segment_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + + RenderTaskData child_task = fetch_render_task(prim.user_data.x); + vUv.z = child_task.data1.x; + + // Constant offsets to inset from bilinear filtering border. + vec2 patch_origin = child_task.data0.xy + vec2(1.0); + vec2 patch_size_device_pixels = child_task.data0.zw - vec2(2.0); + vec2 patch_size = patch_size_device_pixels / uDevicePixelRatio; + + vUv.xy = (vi.local_clamped_pos - prim.local_rect.xy) / patch_size; + vMirrorPoint = 0.5 * prim.local_rect.zw / patch_size; + + vec2 texture_size = vec2(textureSize(sCache, 0)); + vCacheUvRectCoords = vec4(patch_origin, patch_origin + patch_size_device_pixels) / texture_size.xyxy; + + vColor = bs.color; +} diff --git a/gfx/webrender/res/ps_cache_image.fs.glsl b/gfx/webrender/res/ps_cache_image.fs.glsl new file mode 100644 index 000000000000..36ab69e31363 --- /dev/null +++ b/gfx/webrender/res/ps_cache_image.fs.glsl @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + oFragColor = texture(sCache, vUv); +} diff --git a/gfx/webrender/res/ps_cache_image.glsl b/gfx/webrender/res/ps_cache_image.glsl new file mode 100644 index 000000000000..a5930ae066de --- /dev/null +++ b/gfx/webrender/res/ps_cache_image.glsl @@ -0,0 +1,5 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec3 vUv; diff --git a/gfx/webrender/res/ps_cache_image.vs.glsl b/gfx/webrender/res/ps_cache_image.vs.glsl new file mode 100644 index 000000000000..84701b842d8e --- /dev/null +++ b/gfx/webrender/res/ps_cache_image.vs.glsl @@ -0,0 +1,28 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Draw a cached primitive (e.g. a blurred text run) from the +// target cache to the framebuffer, applying tile clip boundaries. + +void main(void) { + Primitive prim = load_primitive(); + + VertexInfo vi = write_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + + RenderTaskData child_task = fetch_render_task(prim.user_data.x); + vUv.z = child_task.data1.x; + + vec2 texture_size = vec2(textureSize(sCache, 0)); + vec2 uv0 = child_task.data0.xy / texture_size; + vec2 uv1 = (child_task.data0.xy + child_task.data0.zw) / texture_size; + + vec2 f = (vi.local_clamped_pos - prim.local_rect.xy) / prim.local_rect.zw; + + vUv.xy = mix(uv0, uv1, f); +} diff --git a/gfx/webrender/res/ps_clear.fs.glsl b/gfx/webrender/res/ps_clear.fs.glsl new file mode 100644 index 000000000000..bbdd2e6457cf --- /dev/null +++ b/gfx/webrender/res/ps_clear.fs.glsl @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + oFragColor = vec4(1.0, 1.0, 1.0, 1.0); +} diff --git a/gfx/webrender/res/ps_clear.glsl b/gfx/webrender/res/ps_clear.glsl new file mode 100644 index 000000000000..e0032240a4d2 --- /dev/null +++ b/gfx/webrender/res/ps_clear.glsl @@ -0,0 +1,3 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/gfx/webrender/res/ps_clear.vs.glsl b/gfx/webrender/res/ps_clear.vs.glsl new file mode 100644 index 000000000000..0b94afade228 --- /dev/null +++ b/gfx/webrender/res/ps_clear.vs.glsl @@ -0,0 +1,14 @@ +#line 1 + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +in ivec4 aClearRectangle; + +void main() { + vec4 rect = vec4(aClearRectangle); + + vec4 pos = vec4(mix(rect.xy, rect.xy + rect.zw, aPosition.xy), 0, 1); + gl_Position = uTransform * pos; +} diff --git a/gfx/webrender/res/ps_composite.fs.glsl b/gfx/webrender/res/ps_composite.fs.glsl new file mode 100644 index 000000000000..0384d1070ee1 --- /dev/null +++ b/gfx/webrender/res/ps_composite.fs.glsl @@ -0,0 +1,219 @@ +#line 1 + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +float gauss(float x, float sigma) { + if (sigma == 0.0) + return 1.0; + return (1.0 / sqrt(6.283185307179586 * sigma * sigma)) * exp(-(x * x) / (2.0 * sigma * sigma)); +} + +vec3 Multiply(vec3 Cb, vec3 Cs) { + return Cb * Cs; +} + +vec3 Screen(vec3 Cb, vec3 Cs) { + return Cb + Cs - (Cb * Cs); +} + +vec3 HardLight(vec3 Cb, vec3 Cs) { + vec3 m = Multiply(Cb, 2.0 * Cs); + vec3 s = Screen(Cb, 2.0 * Cs - 1.0); + vec3 edge = vec3(0.5, 0.5, 0.5); + return mix(m, s, step(edge, Cs)); +} + +// TODO: Worth doing with mix/step? Check GLSL output. +float ColorDodge(float Cb, float Cs) { + if (Cb == 0.0) + return 0.0; + else if (Cs == 1.0) + return 1.0; + else + return min(1.0, Cb / (1.0 - Cs)); +} + +// TODO: Worth doing with mix/step? Check GLSL output. +float ColorBurn(float Cb, float Cs) { + if (Cb == 1.0) + return 1.0; + else if (Cs == 0.0) + return 0.0; + else + return 1.0 - min(1.0, (1.0 - Cb) / Cs); +} + +float SoftLight(float Cb, float Cs) { + if (Cs <= 0.5) { + return Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb); + } else { + float D; + + if (Cb <= 0.25) + D = ((16.0 * Cb - 12.0) * Cb + 4.0) * Cb; + else + D = sqrt(Cb); + + return Cb + (2.0 * Cs - 1.0) * (D - Cb); + } +} + +vec3 Difference(vec3 Cb, vec3 Cs) { + return abs(Cb - Cs); +} + +vec3 Exclusion(vec3 Cb, vec3 Cs) { + return Cb + Cs - 2.0 * Cb * Cs; +} + +// These functions below are taken from the spec. +// There's probably a much quicker way to implement +// them in GLSL... +float Sat(vec3 c) { + return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); +} + +float Lum(vec3 c) { + vec3 f = vec3(0.3, 0.59, 0.11); + return dot(c, f); +} + +vec3 ClipColor(vec3 C) { + float L = Lum(C); + float n = min(C.r, min(C.g, C.b)); + float x = max(C.r, max(C.g, C.b)); + + if (n < 0.0) + C = L + (((C - L) * L) / (L - n)); + + if (x > 1.0) + C = L + (((C - L) * (1.0 - L)) / (x - L)); + + return C; +} + +vec3 SetLum(vec3 C, float l) { + float d = l - Lum(C); + return ClipColor(C + d); +} + +void SetSatInner(inout float Cmin, inout float Cmid, inout float Cmax, float s) { + if (Cmax > Cmin) { + Cmid = (((Cmid - Cmin) * s) / (Cmax - Cmin)); + Cmax = s; + } else { + Cmid = 0.0; + Cmax = 0.0; + } + Cmin = 0.0; +} + +vec3 SetSat(vec3 C, float s) { + if (C.r <= C.g) { + if (C.g <= C.b) { + SetSatInner(C.r, C.g, C.b, s); + } else { + if (C.r <= C.b) { + SetSatInner(C.r, C.b, C.g, s); + } else { + SetSatInner(C.b, C.r, C.g, s); + } + } + } else { + if (C.r <= C.b) { + SetSatInner(C.g, C.r, C.b, s); + } else { + if (C.g <= C.b) { + SetSatInner(C.g, C.b, C.r, s); + } else { + SetSatInner(C.b, C.g, C.r, s); + } + } + } + return C; +} + +vec3 Hue(vec3 Cb, vec3 Cs) { + return SetLum(SetSat(Cs, Sat(Cb)), Lum(Cb)); +} + +vec3 Saturation(vec3 Cb, vec3 Cs) { + return SetLum(SetSat(Cb, Sat(Cs)), Lum(Cb)); +} + +vec3 Color(vec3 Cb, vec3 Cs) { + return SetLum(Cs, Lum(Cb)); +} + +vec3 Luminosity(vec3 Cb, vec3 Cs) { + return SetLum(Cb, Lum(Cs)); +} + +void main(void) { + vec4 Cb = texture(sCache, vUv0); + + if (vUv1.x < vUv1Rect.x || + vUv1.x > vUv1Rect.z || + vUv1.y < vUv1Rect.y || + vUv1.y > vUv1Rect.w) { + oFragColor = Cb; + return; + } + + vec4 Cs = texture(sCache, vUv1); + + // Return yellow if none of the branches match (shouldn't happen). + vec4 result = vec4(1.0, 1.0, 0.0, 1.0); + + switch (vOp) { + case 1: + result.rgb = Multiply(Cb.rgb, Cs.rgb); + break; + case 2: + result.rgb = Screen(Cb.rgb, Cs.rgb); + break; + case 3: + result.rgb = HardLight(Cs.rgb, Cb.rgb); // Overlay is inverse of Hardlight + break; + case 6: + result.r = ColorDodge(Cb.r, Cs.r); + result.g = ColorDodge(Cb.g, Cs.g); + result.b = ColorDodge(Cb.b, Cs.b); + break; + case 7: + result.r = ColorBurn(Cb.r, Cs.r); + result.g = ColorBurn(Cb.g, Cs.g); + result.b = ColorBurn(Cb.b, Cs.b); + break; + case 8: + result.rgb = HardLight(Cb.rgb, Cs.rgb); + break; + case 9: + result.r = SoftLight(Cb.r, Cs.r); + result.g = SoftLight(Cb.g, Cs.g); + result.b = SoftLight(Cb.b, Cs.b); + break; + case 10: + result.rgb = Difference(Cb.rgb, Cs.rgb); + break; + case 11: + result.rgb = Exclusion(Cb.rgb, Cs.rgb); + break; + case 12: + result.rgb = Hue(Cb.rgb, Cs.rgb); + break; + case 13: + result.rgb = Saturation(Cb.rgb, Cs.rgb); + break; + case 14: + result.rgb = Color(Cb.rgb, Cs.rgb); + break; + case 15: + result.rgb = Luminosity(Cb.rgb, Cs.rgb); + break; + } + + oFragColor = result; +} diff --git a/gfx/webrender/res/ps_composite.glsl b/gfx/webrender/res/ps_composite.glsl new file mode 100644 index 000000000000..d2a1310d59bc --- /dev/null +++ b/gfx/webrender/res/ps_composite.glsl @@ -0,0 +1,8 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec3 vUv0; +varying vec3 vUv1; +flat varying vec4 vUv1Rect; +flat varying int vOp; diff --git a/gfx/webrender/res/ps_composite.vs.glsl b/gfx/webrender/res/ps_composite.vs.glsl new file mode 100644 index 000000000000..4486f53d17f2 --- /dev/null +++ b/gfx/webrender/res/ps_composite.vs.glsl @@ -0,0 +1,50 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +struct Composite { + ivec4 src0_src1_target_id_op; + int z; +}; + +Composite fetch_composite() { + PrimitiveInstance pi = fetch_prim_instance(); + + Composite composite; + composite.src0_src1_target_id_op = ivec4(pi.user_data.xy, + pi.render_task_index, + pi.sub_index); + composite.z = pi.z; + + return composite; +} + +void main(void) { + Composite composite = fetch_composite(); + Tile src0 = fetch_tile(composite.src0_src1_target_id_op.x); + Tile src1 = fetch_tile(composite.src0_src1_target_id_op.y); + Tile dest = fetch_tile(composite.src0_src1_target_id_op.z); + + vec2 local_pos = mix(dest.screen_origin_task_origin.zw, + dest.screen_origin_task_origin.zw + dest.size_target_index.xy, + aPosition.xy); + + vec2 texture_size = vec2(textureSize(sCache, 0)); + vec2 st0 = src0.screen_origin_task_origin.zw / texture_size; + vec2 st1 = (src0.screen_origin_task_origin.zw + src0.size_target_index.xy) / texture_size; + vUv0 = vec3(mix(st0, st1, aPosition.xy), src0.size_target_index.z); + + st0 = vec2(src1.screen_origin_task_origin.zw) / texture_size; + st1 = vec2(src1.screen_origin_task_origin.zw + src1.size_target_index.xy) / texture_size; + vec2 local_virtual_pos = mix(dest.screen_origin_task_origin.xy, + dest.screen_origin_task_origin.xy + dest.size_target_index.xy, + aPosition.xy); + vec2 f = (local_virtual_pos - src1.screen_origin_task_origin.xy) / src1.size_target_index.xy; + vUv1 = vec3(mix(st0, st1, f), src1.size_target_index.z); + vUv1Rect = vec4(st0, st1); + + vOp = composite.src0_src1_target_id_op.w; + + gl_Position = uTransform * vec4(local_pos, composite.z, 1.0); +} diff --git a/gfx/webrender/res/ps_gradient.fs.glsl b/gfx/webrender/res/ps_gradient.fs.glsl new file mode 100644 index 000000000000..d2c705af49c5 --- /dev/null +++ b/gfx/webrender/res/ps_gradient.fs.glsl @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { +#ifdef WR_FEATURE_TRANSFORM + float alpha = 0.0; + vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha); +#else + float alpha = 1.0; + vec2 local_pos = vPos; +#endif + + alpha = min(alpha, do_clip()); + oFragColor = vColor * vec4(1.0, 1.0, 1.0, alpha); +} diff --git a/gfx/webrender/res/ps_gradient.glsl b/gfx/webrender/res/ps_gradient.glsl new file mode 100644 index 000000000000..e1d184536337 --- /dev/null +++ b/gfx/webrender/res/ps_gradient.glsl @@ -0,0 +1,12 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec4 vColor; + +#ifdef WR_FEATURE_TRANSFORM +varying vec3 vLocalPos; +flat varying vec4 vLocalRect; +#else +varying vec2 vPos; +#endif diff --git a/gfx/webrender/res/ps_gradient.vs.glsl b/gfx/webrender/res/ps_gradient.vs.glsl new file mode 100644 index 000000000000..9bf70401e20d --- /dev/null +++ b/gfx/webrender/res/ps_gradient.vs.glsl @@ -0,0 +1,72 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); + Gradient gradient = fetch_gradient(prim.prim_index); + + GradientStop g0 = fetch_gradient_stop(prim.sub_index + 0); + GradientStop g1 = fetch_gradient_stop(prim.sub_index + 1); + + vec4 segment_rect; + switch (int(gradient.kind.x)) { + case GRADIENT_HORIZONTAL: { + float x0 = mix(gradient.start_end_point.x, + gradient.start_end_point.z, + g0.offset.x); + float x1 = mix(gradient.start_end_point.x, + gradient.start_end_point.z, + g1.offset.x); + segment_rect.yw = prim.local_rect.yw; + segment_rect.x = x0; + segment_rect.z = x1 - x0; + } break; + case GRADIENT_VERTICAL: { + float y0 = mix(gradient.start_end_point.y, + gradient.start_end_point.w, + g0.offset.x); + float y1 = mix(gradient.start_end_point.y, + gradient.start_end_point.w, + g1.offset.x); + segment_rect.xz = prim.local_rect.xz; + segment_rect.y = y0; + segment_rect.w = y1 - y0; + } break; + } + +#ifdef WR_FEATURE_TRANSFORM + TransformVertexInfo vi = write_transform_vertex(segment_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalRect = vi.clipped_local_rect; + vLocalPos = vi.local_pos; + vec2 f = (vi.local_pos.xy - prim.local_rect.xy) / prim.local_rect.zw; +#else + VertexInfo vi = write_vertex(segment_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + + vec2 f = (vi.local_clamped_pos - segment_rect.xy) / segment_rect.zw; + vPos = vi.local_clamped_pos; +#endif + + write_clip(vi.global_clamped_pos, prim.clip_area); + + switch (int(gradient.kind.x)) { + case GRADIENT_HORIZONTAL: + vColor = mix(g0.color, g1.color, f.x); + break; + case GRADIENT_VERTICAL: + vColor = mix(g0.color, g1.color, f.y); + break; + case GRADIENT_ROTATED: + vColor = vec4(1.0, 0.0, 1.0, 1.0); + break; + } +} diff --git a/gfx/webrender/res/ps_image.fs.glsl b/gfx/webrender/res/ps_image.fs.glsl new file mode 100644 index 000000000000..6d192732201f --- /dev/null +++ b/gfx/webrender/res/ps_image.fs.glsl @@ -0,0 +1,31 @@ +#line 1 + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { +#ifdef WR_FEATURE_TRANSFORM + float alpha = 0.0; + vec2 pos = init_transform_fs(vLocalPos, vLocalRect, alpha); + + // We clamp the texture coordinate calculation here to the local rectangle boundaries, + // which makes the edge of the texture stretch instead of repeat. + vec2 relative_pos_in_rect = + clamp(pos, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw) - vLocalRect.xy; +#else + float alpha = 1.0; + vec2 relative_pos_in_rect = vLocalPos; +#endif + + alpha = min(alpha, do_clip()); + + // We calculate the particular tile this fragment belongs to, taking into + // account the spacing in between tiles. We only paint if our fragment does + // not fall into that spacing. + vec2 position_in_tile = mod(relative_pos_in_rect, vStretchSize + vTileSpacing); + vec2 st = vTextureOffset + ((position_in_tile / vStretchSize) * vTextureSize); + alpha = alpha * float(all(bvec2(step(position_in_tile, vStretchSize)))); + + oFragColor = vec4(1.0, 1.0, 1.0, alpha) * texture(sColor0, st); +} diff --git a/gfx/webrender/res/ps_image.glsl b/gfx/webrender/res/ps_image.glsl new file mode 100644 index 000000000000..0ca0ac572111 --- /dev/null +++ b/gfx/webrender/res/ps_image.glsl @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +flat varying vec2 vTextureOffset; // Offset of this image into the texture atlas. +flat varying vec2 vTextureSize; // Size of the image in the texture atlas. +flat varying vec2 vTileSpacing; // Amount of space between tiled instances of this image. + +#ifdef WR_FEATURE_TRANSFORM +varying vec3 vLocalPos; +flat varying vec4 vLocalRect; +flat varying vec2 vStretchSize; +#else +varying vec2 vLocalPos; +flat varying vec2 vStretchSize; +#endif diff --git a/gfx/webrender/res/ps_image.vs.glsl b/gfx/webrender/res/ps_image.vs.glsl new file mode 100644 index 000000000000..d930ab1443eb --- /dev/null +++ b/gfx/webrender/res/ps_image.vs.glsl @@ -0,0 +1,39 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); + Image image = fetch_image(prim.prim_index); + ResourceRect res = fetch_resource_rect(prim.user_data.x); + +#ifdef WR_FEATURE_TRANSFORM + TransformVertexInfo vi = write_transform_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalRect = vi.clipped_local_rect; + vLocalPos = vi.local_pos; +#else + VertexInfo vi = write_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalPos = vi.local_clamped_pos - vi.local_rect.p0; +#endif + + write_clip(vi.global_clamped_pos, prim.clip_area); + + // vUv will contain how many times this image has wrapped around the image size. + vec2 texture_size = vec2(textureSize(sColor0, 0)); + vec2 st0 = res.uv_rect.xy / texture_size; + vec2 st1 = res.uv_rect.zw / texture_size; + + vTextureSize = st1 - st0; + vTextureOffset = st0; + vTileSpacing = image.stretch_size_and_tile_spacing.zw; + vStretchSize = image.stretch_size_and_tile_spacing.xy; +} diff --git a/gfx/webrender/res/ps_radial_gradient.fs.glsl b/gfx/webrender/res/ps_radial_gradient.fs.glsl new file mode 100644 index 000000000000..2d1b3c18d509 --- /dev/null +++ b/gfx/webrender/res/ps_radial_gradient.fs.glsl @@ -0,0 +1,67 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +float offset(int index) { + return vOffsets[index / 4][index % 4]; +} + +float linearStep(float lo, float hi, float x) { + float d = hi - lo; + float v = x - lo; + if (d != 0.0) { + v /= d; + } + return clamp(v, 0.0, 1.0); +} + +void main(void) { + vec2 cd = vEndCenter - vStartCenter; + vec2 pd = vPos - vStartCenter; + float rd = vEndRadius - vStartRadius; + + // Solve for t in length(t * cd - pd) = vStartRadius + t * rd + // using a quadratic equation in form of At^2 - 2Bt + C = 0 + float A = dot(cd, cd) - rd * rd; + float B = dot(pd, cd) + vStartRadius * rd; + float C = dot(pd, pd) - vStartRadius * vStartRadius; + + float x; + if (A == 0.0) { + // Since A is 0, just solve for -2Bt + C = 0 + if (B == 0.0) { + discard; + } + float t = 0.5 * C / B; + if (vStartRadius + rd * t >= 0.0) { + x = t; + } else { + discard; + } + } else { + float discr = B * B - A * C; + if (discr < 0.0) { + discard; + } + discr = sqrt(discr); + float t0 = (B + discr) / A; + float t1 = (B - discr) / A; + if (vStartRadius + rd * t0 >= 0.0) { + x = t0; + } else if (vStartRadius + rd * t1 >= 0.0) { + x = t1; + } else { + discard; + } + } + + oFragColor = mix(vColors[0], + vColors[1], + linearStep(offset(0), offset(1), x)); + + for (int i=1 ; i < vStopCount-1 ; ++i) { + oFragColor = mix(oFragColor, + vColors[i+1], + linearStep(offset(i), offset(i+1), x)); + } +} diff --git a/gfx/webrender/res/ps_radial_gradient.glsl b/gfx/webrender/res/ps_radial_gradient.glsl new file mode 100644 index 000000000000..ea24fb20ea2d --- /dev/null +++ b/gfx/webrender/res/ps_radial_gradient.glsl @@ -0,0 +1,12 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +flat varying int vStopCount; +flat varying vec2 vStartCenter; +flat varying vec2 vEndCenter; +flat varying float vStartRadius; +flat varying float vEndRadius; +varying vec2 vPos; +flat varying vec4 vColors[MAX_STOPS_PER_RADIAL_GRADIENT]; +flat varying vec4 vOffsets[MAX_STOPS_PER_RADIAL_GRADIENT/4]; diff --git a/gfx/webrender/res/ps_radial_gradient.vs.glsl b/gfx/webrender/res/ps_radial_gradient.vs.glsl new file mode 100644 index 000000000000..d571bdfbdf52 --- /dev/null +++ b/gfx/webrender/res/ps_radial_gradient.vs.glsl @@ -0,0 +1,35 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); + RadialGradient gradient = fetch_radial_gradient(prim.prim_index); + + VertexInfo vi = write_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + + vStopCount = int(prim.user_data.x); + vPos = vi.local_clamped_pos; + + // Snap the start/end points to device pixel units. + // I'm not sure this is entirely correct, but the + // old render path does this, and it is needed to + // make the angle gradient ref tests pass. It might + // be better to fix this higher up in DL construction + // and not snap here? + vStartCenter = floor(0.5 + gradient.start_end_center.xy * uDevicePixelRatio) / uDevicePixelRatio; + vEndCenter = floor(0.5 + gradient.start_end_center.zw * uDevicePixelRatio) / uDevicePixelRatio; + vStartRadius = gradient.start_end_radius.x; + vEndRadius = gradient.start_end_radius.y; + + for (int i=0 ; i < vStopCount ; ++i) { + GradientStop stop = fetch_gradient_stop(prim.sub_index + i); + vColors[i] = stop.color; + vOffsets[i/4][i%4] = stop.offset.x; + } +} diff --git a/gfx/webrender/res/ps_rectangle.fs.glsl b/gfx/webrender/res/ps_rectangle.fs.glsl new file mode 100644 index 000000000000..d60729750c23 --- /dev/null +++ b/gfx/webrender/res/ps_rectangle.fs.glsl @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + float alpha = 1.0; +#ifdef WR_FEATURE_TRANSFORM + alpha = 0.0; + init_transform_fs(vLocalPos, vLocalRect, alpha); +#endif + +#ifdef WR_FEATURE_CLIP + alpha = min(alpha, do_clip()); +#endif + oFragColor = vColor * vec4(1.0, 1.0, 1.0, alpha); +} diff --git a/gfx/webrender/res/ps_rectangle.glsl b/gfx/webrender/res/ps_rectangle.glsl new file mode 100644 index 000000000000..eb8c99226bf3 --- /dev/null +++ b/gfx/webrender/res/ps_rectangle.glsl @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +varying vec4 vColor; + +#ifdef WR_FEATURE_TRANSFORM +varying vec3 vLocalPos; +flat varying vec4 vLocalRect; +#endif diff --git a/gfx/webrender/res/ps_rectangle.vs.glsl b/gfx/webrender/res/ps_rectangle.vs.glsl new file mode 100644 index 000000000000..298a1bd07f48 --- /dev/null +++ b/gfx/webrender/res/ps_rectangle.vs.glsl @@ -0,0 +1,29 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); + Rectangle rect = fetch_rectangle(prim.prim_index); + vColor = rect.color; +#ifdef WR_FEATURE_TRANSFORM + TransformVertexInfo vi = write_transform_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalRect = vi.clipped_local_rect; + vLocalPos = vi.local_pos; +#else + VertexInfo vi = write_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); +#endif + +#ifdef WR_FEATURE_CLIP + write_clip(vi.global_clamped_pos, prim.clip_area); +#endif +} diff --git a/gfx/webrender/res/ps_text_run.fs.glsl b/gfx/webrender/res/ps_text_run.fs.glsl new file mode 100644 index 000000000000..e7049741bf1a --- /dev/null +++ b/gfx/webrender/res/ps_text_run.fs.glsl @@ -0,0 +1,20 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { +#ifdef WR_FEATURE_SUBPIXEL_AA + //note: the blend mode is not compatible with clipping + oFragColor = texture(sColor0, vUv); +#else + float alpha = texture(sColor0, vUv).a; +#ifdef WR_FEATURE_TRANSFORM + float a = 0.0; + init_transform_fs(vLocalPos, vLocalRect, a); + alpha *= a; +#endif + vec4 color = vColor; + alpha = min(alpha, do_clip()); + oFragColor = vec4(vColor.rgb, vColor.a * alpha); +#endif +} diff --git a/gfx/webrender/res/ps_text_run.glsl b/gfx/webrender/res/ps_text_run.glsl new file mode 100644 index 000000000000..d58ff7d14bbb --- /dev/null +++ b/gfx/webrender/res/ps_text_run.glsl @@ -0,0 +1,11 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +flat varying vec4 vColor; +varying vec2 vUv; + +#ifdef WR_FEATURE_TRANSFORM +varying vec3 vLocalPos; +flat varying vec4 vLocalRect; +#endif diff --git a/gfx/webrender/res/ps_text_run.vs.glsl b/gfx/webrender/res/ps_text_run.vs.glsl new file mode 100644 index 000000000000..0a417400759c --- /dev/null +++ b/gfx/webrender/res/ps_text_run.vs.glsl @@ -0,0 +1,40 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); + TextRun text = fetch_text_run(prim.prim_index); + Glyph glyph = fetch_glyph(prim.sub_index); + ResourceRect res = fetch_resource_rect(prim.user_data.x); + + vec4 local_rect = vec4(glyph.offset.xy, (res.uv_rect.zw - res.uv_rect.xy) / uDevicePixelRatio); + +#ifdef WR_FEATURE_TRANSFORM + TransformVertexInfo vi = write_transform_vertex(local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalRect = vi.clipped_local_rect; + vLocalPos = vi.local_pos; + vec2 f = (vi.local_pos.xy / vi.local_pos.z - local_rect.xy) / local_rect.zw; +#else + VertexInfo vi = write_vertex(local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vec2 f = (vi.local_clamped_pos - vi.local_rect.p0) / (vi.local_rect.p1 - vi.local_rect.p0); +#endif + + write_clip(vi.global_clamped_pos, prim.clip_area); + + vec2 texture_size = vec2(textureSize(sColor0, 0)); + vec2 st0 = res.uv_rect.xy / texture_size; + vec2 st1 = res.uv_rect.zw / texture_size; + + vColor = text.color; + vUv = mix(st0, st1, f); +} diff --git a/gfx/webrender/res/ps_yuv_image.fs.glsl b/gfx/webrender/res/ps_yuv_image.fs.glsl new file mode 100644 index 000000000000..133e23952fc3 --- /dev/null +++ b/gfx/webrender/res/ps_yuv_image.fs.glsl @@ -0,0 +1,33 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { +#ifdef WR_FEATURE_TRANSFORM + float alpha = 0.0; + vec2 pos = init_transform_fs(vLocalPos, vLocalRect, alpha); + + // We clamp the texture coordinate calculation here to the local rectangle boundaries, + // which makes the edge of the texture stretch instead of repeat. + vec2 relative_pos_in_rect = + clamp(pos, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw) - vLocalRect.xy; +#else + float alpha = 1.0;; + vec2 relative_pos_in_rect = vLocalPos; +#endif + + alpha = min(alpha, do_clip()); + + vec2 st_y = vTextureOffsetY + relative_pos_in_rect / vStretchSize * vTextureSizeY; + vec2 st_u = vTextureOffsetU + relative_pos_in_rect / vStretchSize * vTextureSizeUv; + vec2 st_v = vTextureOffsetV + relative_pos_in_rect / vStretchSize * vTextureSizeUv; + + float y = texture(sColor0, st_y).r; + float u = texture(sColor1, st_u).r; + float v = texture(sColor2, st_v).r; + + // See the vertex shader for an explanation of where the constants come from. + vec3 rgb = vYuvColorMatrix * vec3(y - 0.06275, u - 0.50196, v - 0.50196); + oFragColor = vec4(rgb, alpha); +} diff --git a/gfx/webrender/res/ps_yuv_image.glsl b/gfx/webrender/res/ps_yuv_image.glsl new file mode 100644 index 000000000000..65ff75e3a2cb --- /dev/null +++ b/gfx/webrender/res/ps_yuv_image.glsl @@ -0,0 +1,19 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +flat varying vec2 vTextureOffsetY; // Offset of the y plane into the texture atlas. +flat varying vec2 vTextureOffsetU; // Offset of the u plane into the texture atlas. +flat varying vec2 vTextureOffsetV; // Offset of the v plane into the texture atlas. +flat varying vec2 vTextureSizeY; // Size of the y plane in the texture atlas. +flat varying vec2 vTextureSizeUv; // Size of the u and v planes in the texture atlas. +flat varying vec2 vStretchSize; + +flat varying mat3 vYuvColorMatrix; + +#ifdef WR_FEATURE_TRANSFORM +varying vec3 vLocalPos; +flat varying vec4 vLocalRect; +#else +varying vec2 vLocalPos; +#endif diff --git a/gfx/webrender/res/ps_yuv_image.vs.glsl b/gfx/webrender/res/ps_yuv_image.vs.glsl new file mode 100644 index 000000000000..1163f3bbfd92 --- /dev/null +++ b/gfx/webrender/res/ps_yuv_image.vs.glsl @@ -0,0 +1,77 @@ +#line 1 +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +void main(void) { + Primitive prim = load_primitive(); +#ifdef WR_FEATURE_TRANSFORM + TransformVertexInfo vi = write_transform_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalRect = vi.clipped_local_rect; + vLocalPos = vi.local_pos; +#else + VertexInfo vi = write_vertex(prim.local_rect, + prim.local_clip_rect, + prim.z, + prim.layer, + prim.tile); + vLocalPos = vi.local_clamped_pos - vi.local_rect.p0; +#endif + + YuvImage image = fetch_yuv_image(prim.prim_index); + + vec2 y_texture_size = vec2(textureSize(sColor0, 0)); + vec2 y_st0 = image.y_st_rect.xy / y_texture_size; + vec2 y_st1 = image.y_st_rect.zw / y_texture_size; + + vTextureSizeY = y_st1 - y_st0; + vTextureOffsetY = y_st0; + + vec2 uv_texture_size = vec2(textureSize(sColor1, 0)); + vec2 u_st0 = image.u_st_rect.xy / uv_texture_size; + vec2 u_st1 = image.u_st_rect.zw / uv_texture_size; + + vec2 v_st0 = image.v_st_rect.xy / uv_texture_size; + vec2 v_st1 = image.v_st_rect.zw / uv_texture_size; + + // This assumes the U and V surfaces have the same size. + vTextureSizeUv = u_st1 - u_st0; + vTextureOffsetU = u_st0; + vTextureOffsetV = v_st0; + + vStretchSize = image.size; + + // The constants added to the Y, U and V components are applied in the fragment shader. + if (image.color_space == YUV_REC601) { + // From Rec601: + // [R] [1.1643835616438356, 0.0, 1.5960267857142858 ] [Y - 16] + // [G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708 ] x [U - 128] + // [B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [V - 128] + // + // For the range [0,1] instead of [0,255]. + vYuvColorMatrix = mat3( + 1.16438, 0.0, 1.59603, + 1.16438, -0.39176, -0.81297, + 1.16438, 2.01723, 0.0 + ); + } else { // if (image.color_space == YUV_REC709) + // From Rec709: + // [R] [1.1643835616438356, 4.2781193979771426e-17, 1.7927410714285714] [Y - 16] + // [G] = [1.1643835616438358, -0.21324861427372963, -0.532909328559444 ] x [U - 128] + // [B] [1.1643835616438356, 2.1124017857142854, 0.0 ] [V - 128] + // + // For the range [0,1] instead of [0,255]: + vYuvColorMatrix = mat3( + 1.16438, 0.0, 1.79274, + 1.16438, -0.21325, -0.53291, + 1.16438, 2.11240, 0.0 + ); + } + + write_clip(vi.global_clamped_pos, prim.clip_area); + +} diff --git a/gfx/webrender/res/shared.glsl b/gfx/webrender/res/shared.glsl new file mode 100644 index 000000000000..f250a709c6d1 --- /dev/null +++ b/gfx/webrender/res/shared.glsl @@ -0,0 +1,51 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//====================================================================================== +// Vertex shader attributes and uniforms +//====================================================================================== +#ifdef WR_VERTEX_SHADER + #define varying out + + // Uniform inputs + uniform mat4 uTransform; // Orthographic projection + uniform float uDevicePixelRatio; + + // Attribute inputs + in vec3 aPosition; +#endif + +//====================================================================================== +// Fragment shader attributes and uniforms +//====================================================================================== +#ifdef WR_FRAGMENT_SHADER + precision highp float; + + #define varying in + + // Uniform inputs + + // Fragment shader outputs + out vec4 oFragColor; +#endif + +//====================================================================================== +// Shared shader uniforms +//====================================================================================== +uniform sampler2D sColor0; +uniform sampler2D sColor1; +uniform sampler2D sColor2; +uniform sampler2D sMask; + +//====================================================================================== +// Interpolator definitions +//====================================================================================== + +//====================================================================================== +// VS only types and UBOs +//====================================================================================== + +//====================================================================================== +// VS only functions +//====================================================================================== diff --git a/gfx/webrender/res/shared_other.glsl b/gfx/webrender/res/shared_other.glsl new file mode 100644 index 000000000000..03cad173cdb8 --- /dev/null +++ b/gfx/webrender/res/shared_other.glsl @@ -0,0 +1,33 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//====================================================================================== +// Vertex shader attributes and uniforms +//====================================================================================== +#ifdef WR_VERTEX_SHADER +#endif + +//====================================================================================== +// Fragment shader attributes and uniforms +//====================================================================================== +#ifdef WR_FRAGMENT_SHADER +#endif + +//====================================================================================== +// Interpolator definitions +//====================================================================================== + +//====================================================================================== +// VS only types and UBOs +//====================================================================================== + +//====================================================================================== +// VS only functions +//====================================================================================== + +//====================================================================================== +// FS only functions +//====================================================================================== +#ifdef WR_FRAGMENT_SHADER +#endif diff --git a/gfx/webrender/src/batch_builder.rs b/gfx/webrender/src/batch_builder.rs new file mode 100644 index 000000000000..4dc0e8b37cc3 --- /dev/null +++ b/gfx/webrender/src/batch_builder.rs @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::f32; +use webrender_traits::{ColorF, BorderStyle}; +use webrender_traits::{BorderSide}; + +//const BORDER_DASH_SIZE: f32 = 3.0; + +pub trait BorderSideHelpers { + fn border_color(&self, + scale_factor_0: f32, + scale_factor_1: f32, + black_color_0: f32, + black_color_1: f32) -> ColorF; +} + +impl BorderSideHelpers for BorderSide { + fn border_color(&self, + scale_factor_0: f32, + scale_factor_1: f32, + black_color_0: f32, + black_color_1: f32) -> ColorF { + match self.style { + BorderStyle::Inset => { + if self.color.r != 0.0 || self.color.g != 0.0 || self.color.b != 0.0 { + self.color.scale_rgb(scale_factor_1) + } else { + ColorF::new(black_color_0, black_color_0, black_color_0, self.color.a) + } + } + BorderStyle::Outset => { + if self.color.r != 0.0 || self.color.g != 0.0 || self.color.b != 0.0 { + self.color.scale_rgb(scale_factor_0) + } else { + ColorF::new(black_color_1, black_color_1, black_color_1, self.color.a) + } + } + _ => self.color, + } + } +} diff --git a/gfx/webrender/src/debug_colors.rs b/gfx/webrender/src/debug_colors.rs new file mode 100644 index 000000000000..ff7c1d697010 --- /dev/null +++ b/gfx/webrender/src/debug_colors.rs @@ -0,0 +1,158 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#![allow(dead_code)] + +use webrender_traits::ColorF; + +// A subset of the standard CSS colors, useful for defining GPU tag colors etc. + +pub const INDIGO: ColorF = ColorF { r: 0.294117647059, g: 0.0, b: 0.509803921569, a: 1.0 }; +pub const GOLD: ColorF = ColorF { r: 1.0, g: 0.843137254902, b: 0.0, a: 1.0 }; +pub const FIREBRICK: ColorF = ColorF { r: 0.698039215686, g: 0.133333333333, b: 0.133333333333, a: 1.0 }; +pub const INDIANRED: ColorF = ColorF { r: 0.803921568627, g: 0.360784313725, b: 0.360784313725, a: 1.0 }; +pub const YELLOW: ColorF = ColorF { r: 1.0, g: 1.0, b: 0.0, a: 1.0 }; +pub const DARKOLIVEGREEN: ColorF = ColorF { r: 0.333333333333, g: 0.419607843137, b: 0.18431372549, a: 1.0 }; +pub const DARKSEAGREEN: ColorF = ColorF { r: 0.560784313725, g: 0.737254901961, b: 0.560784313725, a: 1.0 }; +pub const SLATEGREY: ColorF = ColorF { r: 0.439215686275, g: 0.501960784314, b: 0.564705882353, a: 1.0 }; +pub const DARKSLATEGREY: ColorF = ColorF { r: 0.18431372549, g: 0.309803921569, b: 0.309803921569, a: 1.0 }; +pub const MEDIUMVIOLETRED: ColorF = ColorF { r: 0.780392156863, g: 0.0823529411765, b: 0.521568627451, a: 1.0 }; +pub const MEDIUMORCHID: ColorF = ColorF { r: 0.729411764706, g: 0.333333333333, b: 0.827450980392, a: 1.0 }; +pub const CHARTREUSE: ColorF = ColorF { r: 0.498039215686, g: 1.0, b: 0.0, a: 1.0 }; +pub const MEDIUMSLATEBLUE: ColorF = ColorF { r: 0.482352941176, g: 0.407843137255, b: 0.933333333333, a: 1.0 }; +pub const BLACK: ColorF = ColorF { r: 0.0, g: 0.0, b: 0.0, a: 1.0 }; +pub const SPRINGGREEN: ColorF = ColorF { r: 0.0, g: 1.0, b: 0.498039215686, a: 1.0 }; +pub const CRIMSON: ColorF = ColorF { r: 0.862745098039, g: 0.078431372549, b: 0.235294117647, a: 1.0 }; +pub const LIGHTSALMON: ColorF = ColorF { r: 1.0, g: 0.627450980392, b: 0.478431372549, a: 1.0 }; +pub const BROWN: ColorF = ColorF { r: 0.647058823529, g: 0.164705882353, b: 0.164705882353, a: 1.0 }; +pub const TURQUOISE: ColorF = ColorF { r: 0.250980392157, g: 0.878431372549, b: 0.81568627451, a: 1.0 }; +pub const OLIVEDRAB: ColorF = ColorF { r: 0.419607843137, g: 0.556862745098, b: 0.137254901961, a: 1.0 }; +pub const CYAN: ColorF = ColorF { r: 0.0, g: 1.0, b: 1.0, a: 1.0 }; +pub const SILVER: ColorF = ColorF { r: 0.752941176471, g: 0.752941176471, b: 0.752941176471, a: 1.0 }; +pub const SKYBLUE: ColorF = ColorF { r: 0.529411764706, g: 0.807843137255, b: 0.921568627451, a: 1.0 }; +pub const GRAY: ColorF = ColorF { r: 0.501960784314, g: 0.501960784314, b: 0.501960784314, a: 1.0 }; +pub const DARKTURQUOISE: ColorF = ColorF { r: 0.0, g: 0.807843137255, b: 0.819607843137, a: 1.0 }; +pub const GOLDENROD: ColorF = ColorF { r: 0.854901960784, g: 0.647058823529, b: 0.125490196078, a: 1.0 }; +pub const DARKGREEN: ColorF = ColorF { r: 0.0, g: 0.392156862745, b: 0.0, a: 1.0 }; +pub const DARKVIOLET: ColorF = ColorF { r: 0.580392156863, g: 0.0, b: 0.827450980392, a: 1.0 }; +pub const DARKGRAY: ColorF = ColorF { r: 0.662745098039, g: 0.662745098039, b: 0.662745098039, a: 1.0 }; +pub const LIGHTPINK: ColorF = ColorF { r: 1.0, g: 0.713725490196, b: 0.756862745098, a: 1.0 }; +pub const TEAL: ColorF = ColorF { r: 0.0, g: 0.501960784314, b: 0.501960784314, a: 1.0 }; +pub const DARKMAGENTA: ColorF = ColorF { r: 0.545098039216, g: 0.0, b: 0.545098039216, a: 1.0 }; +pub const LIGHTGOLDENRODYELLOW: ColorF = ColorF { r: 0.980392156863, g: 0.980392156863, b: 0.823529411765, a: 1.0 }; +pub const LAVENDER: ColorF = ColorF { r: 0.901960784314, g: 0.901960784314, b: 0.980392156863, a: 1.0 }; +pub const YELLOWGREEN: ColorF = ColorF { r: 0.603921568627, g: 0.803921568627, b: 0.196078431373, a: 1.0 }; +pub const THISTLE: ColorF = ColorF { r: 0.847058823529, g: 0.749019607843, b: 0.847058823529, a: 1.0 }; +pub const VIOLET: ColorF = ColorF { r: 0.933333333333, g: 0.509803921569, b: 0.933333333333, a: 1.0 }; +pub const NAVY: ColorF = ColorF { r: 0.0, g: 0.0, b: 0.501960784314, a: 1.0 }; +pub const DIMGREY: ColorF = ColorF { r: 0.411764705882, g: 0.411764705882, b: 0.411764705882, a: 1.0 }; +pub const ORCHID: ColorF = ColorF { r: 0.854901960784, g: 0.439215686275, b: 0.839215686275, a: 1.0 }; +pub const BLUE: ColorF = ColorF { r: 0.0, g: 0.0, b: 1.0, a: 1.0 }; +pub const GHOSTWHITE: ColorF = ColorF { r: 0.972549019608, g: 0.972549019608, b: 1.0, a: 1.0 }; +pub const HONEYDEW: ColorF = ColorF { r: 0.941176470588, g: 1.0, b: 0.941176470588, a: 1.0 }; +pub const CORNFLOWERBLUE: ColorF = ColorF { r: 0.392156862745, g: 0.58431372549, b: 0.929411764706, a: 1.0 }; +pub const DARKBLUE: ColorF = ColorF { r: 0.0, g: 0.0, b: 0.545098039216, a: 1.0 }; +pub const DARKKHAKI: ColorF = ColorF { r: 0.741176470588, g: 0.717647058824, b: 0.419607843137, a: 1.0 }; +pub const MEDIUMPURPLE: ColorF = ColorF { r: 0.576470588235, g: 0.439215686275, b: 0.858823529412, a: 1.0 }; +pub const CORNSILK: ColorF = ColorF { r: 1.0, g: 0.972549019608, b: 0.862745098039, a: 1.0 }; +pub const RED: ColorF = ColorF { r: 1.0, g: 0.0, b: 0.0, a: 1.0 }; +pub const BISQUE: ColorF = ColorF { r: 1.0, g: 0.894117647059, b: 0.76862745098, a: 1.0 }; +pub const SLATEGRAY: ColorF = ColorF { r: 0.439215686275, g: 0.501960784314, b: 0.564705882353, a: 1.0 }; +pub const DARKCYAN: ColorF = ColorF { r: 0.0, g: 0.545098039216, b: 0.545098039216, a: 1.0 }; +pub const KHAKI: ColorF = ColorF { r: 0.941176470588, g: 0.901960784314, b: 0.549019607843, a: 1.0 }; +pub const WHEAT: ColorF = ColorF { r: 0.960784313725, g: 0.870588235294, b: 0.701960784314, a: 1.0 }; +pub const DEEPSKYBLUE: ColorF = ColorF { r: 0.0, g: 0.749019607843, b: 1.0, a: 1.0 }; +pub const REBECCAPURPLE: ColorF = ColorF { r: 0.4, g: 0.2, b: 0.6, a: 1.0 }; +pub const DARKRED: ColorF = ColorF { r: 0.545098039216, g: 0.0, b: 0.0, a: 1.0 }; +pub const STEELBLUE: ColorF = ColorF { r: 0.274509803922, g: 0.509803921569, b: 0.705882352941, a: 1.0 }; +pub const ALICEBLUE: ColorF = ColorF { r: 0.941176470588, g: 0.972549019608, b: 1.0, a: 1.0 }; +pub const LIGHTSLATEGREY: ColorF = ColorF { r: 0.466666666667, g: 0.533333333333, b: 0.6, a: 1.0 }; +pub const GAINSBORO: ColorF = ColorF { r: 0.862745098039, g: 0.862745098039, b: 0.862745098039, a: 1.0 }; +pub const MEDIUMTURQUOISE: ColorF = ColorF { r: 0.282352941176, g: 0.819607843137, b: 0.8, a: 1.0 }; +pub const FLORALWHITE: ColorF = ColorF { r: 1.0, g: 0.980392156863, b: 0.941176470588, a: 1.0 }; +pub const CORAL: ColorF = ColorF { r: 1.0, g: 0.498039215686, b: 0.313725490196, a: 1.0 }; +pub const PURPLE: ColorF = ColorF { r: 0.501960784314, g: 0.0, b: 0.501960784314, a: 1.0 }; +pub const LIGHTGREY: ColorF = ColorF { r: 0.827450980392, g: 0.827450980392, b: 0.827450980392, a: 1.0 }; +pub const LIGHTCYAN: ColorF = ColorF { r: 0.878431372549, g: 1.0, b: 1.0, a: 1.0 }; +pub const DARKSALMON: ColorF = ColorF { r: 0.913725490196, g: 0.588235294118, b: 0.478431372549, a: 1.0 }; +pub const BEIGE: ColorF = ColorF { r: 0.960784313725, g: 0.960784313725, b: 0.862745098039, a: 1.0 }; +pub const AZURE: ColorF = ColorF { r: 0.941176470588, g: 1.0, b: 1.0, a: 1.0 }; +pub const LIGHTSTEELBLUE: ColorF = ColorF { r: 0.690196078431, g: 0.76862745098, b: 0.870588235294, a: 1.0 }; +pub const OLDLACE: ColorF = ColorF { r: 0.992156862745, g: 0.960784313725, b: 0.901960784314, a: 1.0 }; +pub const GREENYELLOW: ColorF = ColorF { r: 0.678431372549, g: 1.0, b: 0.18431372549, a: 1.0 }; +pub const ROYALBLUE: ColorF = ColorF { r: 0.254901960784, g: 0.411764705882, b: 0.882352941176, a: 1.0 }; +pub const LIGHTSEAGREEN: ColorF = ColorF { r: 0.125490196078, g: 0.698039215686, b: 0.666666666667, a: 1.0 }; +pub const MISTYROSE: ColorF = ColorF { r: 1.0, g: 0.894117647059, b: 0.882352941176, a: 1.0 }; +pub const SIENNA: ColorF = ColorF { r: 0.627450980392, g: 0.321568627451, b: 0.176470588235, a: 1.0 }; +pub const LIGHTCORAL: ColorF = ColorF { r: 0.941176470588, g: 0.501960784314, b: 0.501960784314, a: 1.0 }; +pub const ORANGERED: ColorF = ColorF { r: 1.0, g: 0.270588235294, b: 0.0, a: 1.0 }; +pub const NAVAJOWHITE: ColorF = ColorF { r: 1.0, g: 0.870588235294, b: 0.678431372549, a: 1.0 }; +pub const LIME: ColorF = ColorF { r: 0.0, g: 1.0, b: 0.0, a: 1.0 }; +pub const PALEGREEN: ColorF = ColorF { r: 0.596078431373, g: 0.98431372549, b: 0.596078431373, a: 1.0 }; +pub const BURLYWOOD: ColorF = ColorF { r: 0.870588235294, g: 0.721568627451, b: 0.529411764706, a: 1.0 }; +pub const SEASHELL: ColorF = ColorF { r: 1.0, g: 0.960784313725, b: 0.933333333333, a: 1.0 }; +pub const MEDIUMSPRINGGREEN: ColorF = ColorF { r: 0.0, g: 0.980392156863, b: 0.603921568627, a: 1.0 }; +pub const FUCHSIA: ColorF = ColorF { r: 1.0, g: 0.0, b: 1.0, a: 1.0 }; +pub const PAPAYAWHIP: ColorF = ColorF { r: 1.0, g: 0.937254901961, b: 0.835294117647, a: 1.0 }; +pub const BLANCHEDALMOND: ColorF = ColorF { r: 1.0, g: 0.921568627451, b: 0.803921568627, a: 1.0 }; +pub const PERU: ColorF = ColorF { r: 0.803921568627, g: 0.521568627451, b: 0.247058823529, a: 1.0 }; +pub const AQUAMARINE: ColorF = ColorF { r: 0.498039215686, g: 1.0, b: 0.83137254902, a: 1.0 }; +pub const WHITE: ColorF = ColorF { r: 1.0, g: 1.0, b: 1.0, a: 1.0 }; +pub const DARKSLATEGRAY: ColorF = ColorF { r: 0.18431372549, g: 0.309803921569, b: 0.309803921569, a: 1.0 }; +pub const TOMATO: ColorF = ColorF { r: 1.0, g: 0.388235294118, b: 0.278431372549, a: 1.0 }; +pub const IVORY: ColorF = ColorF { r: 1.0, g: 1.0, b: 0.941176470588, a: 1.0 }; +pub const DODGERBLUE: ColorF = ColorF { r: 0.117647058824, g: 0.564705882353, b: 1.0, a: 1.0 }; +pub const LEMONCHIFFON: ColorF = ColorF { r: 1.0, g: 0.980392156863, b: 0.803921568627, a: 1.0 }; +pub const CHOCOLATE: ColorF = ColorF { r: 0.823529411765, g: 0.411764705882, b: 0.117647058824, a: 1.0 }; +pub const ORANGE: ColorF = ColorF { r: 1.0, g: 0.647058823529, b: 0.0, a: 1.0 }; +pub const FORESTGREEN: ColorF = ColorF { r: 0.133333333333, g: 0.545098039216, b: 0.133333333333, a: 1.0 }; +pub const DARKGREY: ColorF = ColorF { r: 0.662745098039, g: 0.662745098039, b: 0.662745098039, a: 1.0 }; +pub const OLIVE: ColorF = ColorF { r: 0.501960784314, g: 0.501960784314, b: 0.0, a: 1.0 }; +pub const MINTCREAM: ColorF = ColorF { r: 0.960784313725, g: 1.0, b: 0.980392156863, a: 1.0 }; +pub const ANTIQUEWHITE: ColorF = ColorF { r: 0.980392156863, g: 0.921568627451, b: 0.843137254902, a: 1.0 }; +pub const DARKORANGE: ColorF = ColorF { r: 1.0, g: 0.549019607843, b: 0.0, a: 1.0 }; +pub const CADETBLUE: ColorF = ColorF { r: 0.372549019608, g: 0.619607843137, b: 0.627450980392, a: 1.0 }; +pub const MOCCASIN: ColorF = ColorF { r: 1.0, g: 0.894117647059, b: 0.709803921569, a: 1.0 }; +pub const LIMEGREEN: ColorF = ColorF { r: 0.196078431373, g: 0.803921568627, b: 0.196078431373, a: 1.0 }; +pub const SADDLEBROWN: ColorF = ColorF { r: 0.545098039216, g: 0.270588235294, b: 0.0745098039216, a: 1.0 }; +pub const GREY: ColorF = ColorF { r: 0.501960784314, g: 0.501960784314, b: 0.501960784314, a: 1.0 }; +pub const DARKSLATEBLUE: ColorF = ColorF { r: 0.282352941176, g: 0.239215686275, b: 0.545098039216, a: 1.0 }; +pub const LIGHTSKYBLUE: ColorF = ColorF { r: 0.529411764706, g: 0.807843137255, b: 0.980392156863, a: 1.0 }; +pub const DEEPPINK: ColorF = ColorF { r: 1.0, g: 0.078431372549, b: 0.576470588235, a: 1.0 }; +pub const PLUM: ColorF = ColorF { r: 0.866666666667, g: 0.627450980392, b: 0.866666666667, a: 1.0 }; +pub const AQUA: ColorF = ColorF { r: 0.0, g: 1.0, b: 1.0, a: 1.0 }; +pub const DARKGOLDENROD: ColorF = ColorF { r: 0.721568627451, g: 0.525490196078, b: 0.043137254902, a: 1.0 }; +pub const MAROON: ColorF = ColorF { r: 0.501960784314, g: 0.0, b: 0.0, a: 1.0 }; +pub const SANDYBROWN: ColorF = ColorF { r: 0.956862745098, g: 0.643137254902, b: 0.376470588235, a: 1.0 }; +pub const MAGENTA: ColorF = ColorF { r: 1.0, g: 0.0, b: 1.0, a: 1.0 }; +pub const TAN: ColorF = ColorF { r: 0.823529411765, g: 0.705882352941, b: 0.549019607843, a: 1.0 }; +pub const ROSYBROWN: ColorF = ColorF { r: 0.737254901961, g: 0.560784313725, b: 0.560784313725, a: 1.0 }; +pub const PINK: ColorF = ColorF { r: 1.0, g: 0.752941176471, b: 0.796078431373, a: 1.0 }; +pub const LIGHTBLUE: ColorF = ColorF { r: 0.678431372549, g: 0.847058823529, b: 0.901960784314, a: 1.0 }; +pub const PALEVIOLETRED: ColorF = ColorF { r: 0.858823529412, g: 0.439215686275, b: 0.576470588235, a: 1.0 }; +pub const MEDIUMSEAGREEN: ColorF = ColorF { r: 0.235294117647, g: 0.701960784314, b: 0.443137254902, a: 1.0 }; +pub const SLATEBLUE: ColorF = ColorF { r: 0.41568627451, g: 0.352941176471, b: 0.803921568627, a: 1.0 }; +pub const DIMGRAY: ColorF = ColorF { r: 0.411764705882, g: 0.411764705882, b: 0.411764705882, a: 1.0 }; +pub const POWDERBLUE: ColorF = ColorF { r: 0.690196078431, g: 0.878431372549, b: 0.901960784314, a: 1.0 }; +pub const SEAGREEN: ColorF = ColorF { r: 0.180392156863, g: 0.545098039216, b: 0.341176470588, a: 1.0 }; +pub const SNOW: ColorF = ColorF { r: 1.0, g: 0.980392156863, b: 0.980392156863, a: 1.0 }; +pub const MEDIUMBLUE: ColorF = ColorF { r: 0.0, g: 0.0, b: 0.803921568627, a: 1.0 }; +pub const MIDNIGHTBLUE: ColorF = ColorF { r: 0.0980392156863, g: 0.0980392156863, b: 0.439215686275, a: 1.0 }; +pub const PALETURQUOISE: ColorF = ColorF { r: 0.686274509804, g: 0.933333333333, b: 0.933333333333, a: 1.0 }; +pub const PALEGOLDENROD: ColorF = ColorF { r: 0.933333333333, g: 0.909803921569, b: 0.666666666667, a: 1.0 }; +pub const WHITESMOKE: ColorF = ColorF { r: 0.960784313725, g: 0.960784313725, b: 0.960784313725, a: 1.0 }; +pub const DARKORCHID: ColorF = ColorF { r: 0.6, g: 0.196078431373, b: 0.8, a: 1.0 }; +pub const SALMON: ColorF = ColorF { r: 0.980392156863, g: 0.501960784314, b: 0.447058823529, a: 1.0 }; +pub const LIGHTSLATEGRAY: ColorF = ColorF { r: 0.466666666667, g: 0.533333333333, b: 0.6, a: 1.0 }; +pub const LAWNGREEN: ColorF = ColorF { r: 0.486274509804, g: 0.988235294118, b: 0.0, a: 1.0 }; +pub const LIGHTGREEN: ColorF = ColorF { r: 0.564705882353, g: 0.933333333333, b: 0.564705882353, a: 1.0 }; +pub const LIGHTGRAY: ColorF = ColorF { r: 0.827450980392, g: 0.827450980392, b: 0.827450980392, a: 1.0 }; +pub const HOTPINK: ColorF = ColorF { r: 1.0, g: 0.411764705882, b: 0.705882352941, a: 1.0 }; +pub const LIGHTYELLOW: ColorF = ColorF { r: 1.0, g: 1.0, b: 0.878431372549, a: 1.0 }; +pub const LAVENDERBLUSH: ColorF = ColorF { r: 1.0, g: 0.941176470588, b: 0.960784313725, a: 1.0 }; +pub const LINEN: ColorF = ColorF { r: 0.980392156863, g: 0.941176470588, b: 0.901960784314, a: 1.0 }; +pub const MEDIUMAQUAMARINE: ColorF = ColorF { r: 0.4, g: 0.803921568627, b: 0.666666666667, a: 1.0 }; +pub const GREEN: ColorF = ColorF { r: 0.0, g: 0.501960784314, b: 0.0, a: 1.0 }; +pub const BLUEVIOLET: ColorF = ColorF { r: 0.541176470588, g: 0.16862745098, b: 0.886274509804, a: 1.0 }; +pub const PEACHPUFF: ColorF = ColorF { r: 1.0, g: 0.854901960784, b: 0.725490196078, a: 1.0 }; diff --git a/gfx/webrender/src/debug_font_data.rs b/gfx/webrender/src/debug_font_data.rs new file mode 100644 index 000000000000..1c4a62eaeb42 --- /dev/null +++ b/gfx/webrender/src/debug_font_data.rs @@ -0,0 +1,1914 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#[derive(Debug)] +pub struct BakedGlyph { + pub x0: u32, + pub y0: u32, + pub x1: u32, + pub y1: u32, + pub xo: f32, + pub yo: f32, + pub xa: f32, +} + +pub const FIRST_GLYPH_INDEX: u32 = 32; +pub const BMP_WIDTH: u32 = 128; +pub const BMP_HEIGHT: u32 = 128; +pub const FONT_SIZE: u32 = 19; + +pub const GLYPHS: [BakedGlyph; 96] = [ + BakedGlyph { + x0: 1, + y0: 1, + x1: 1, + y1: 1, + xo: 0.000000, + yo: 0.000000, + xa: 3.864407, + }, + BakedGlyph { + x0: 2, + y0: 1, + x1: 5, + y1: 14, + xo: 1.000000, + yo: -12.000000, + xa: 4.644068, + }, + BakedGlyph { + x0: 6, + y0: 1, + x1: 11, + y1: 6, + xo: 1.000000, + yo: -13.000000, + xa: 6.644068, + }, + BakedGlyph { + x0: 12, + y0: 1, + x1: 23, + y1: 13, + xo: 0.000000, + yo: -12.000000, + xa: 11.067797, + }, + BakedGlyph { + x0: 24, + y0: 1, + x1: 32, + y1: 17, + xo: 1.000000, + yo: -14.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 33, + y0: 1, + x1: 46, + y1: 14, + xo: 1.000000, + yo: -12.000000, + xa: 14.084745, + }, + BakedGlyph { + x0: 47, + y0: 1, + x1: 58, + y1: 14, + xo: 0.000000, + yo: -12.000000, + xa: 10.983051, + }, + BakedGlyph { + x0: 59, + y0: 1, + x1: 61, + y1: 6, + xo: 1.000000, + yo: -13.000000, + xa: 4.067797, + }, + BakedGlyph { + x0: 62, + y0: 1, + x1: 67, + y1: 19, + xo: 1.000000, + yo: -14.000000, + xa: 5.254237, + }, + BakedGlyph { + x0: 68, + y0: 1, + x1: 72, + y1: 19, + xo: 0.000000, + yo: -14.000000, + xa: 5.254237, + }, + BakedGlyph { + x0: 73, + y0: 1, + x1: 81, + y1: 8, + xo: 0.000000, + yo: -12.000000, + xa: 8.000000, + }, + BakedGlyph { + x0: 82, + y0: 1, + x1: 91, + y1: 11, + xo: 0.000000, + yo: -10.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 92, + y0: 1, + x1: 95, + y1: 6, + xo: 0.000000, + yo: -2.000000, + xa: 4.169492, + }, + BakedGlyph { + x0: 96, + y0: 1, + x1: 101, + y1: 3, + xo: 0.000000, + yo: -6.000000, + xa: 4.779661, + }, + BakedGlyph { + x0: 102, + y0: 1, + x1: 105, + y1: 4, + xo: 1.000000, + yo: -2.000000, + xa: 4.169492, + }, + BakedGlyph { + x0: 106, + y0: 1, + x1: 114, + y1: 19, + xo: -1.000000, + yo: -14.000000, + xa: 6.084746, + }, + BakedGlyph { + x0: 115, + y0: 1, + x1: 123, + y1: 14, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 1, + y0: 20, + x1: 6, + y1: 32, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 7, + y0: 20, + x1: 15, + y1: 32, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 16, + y0: 20, + x1: 24, + y1: 33, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 25, + y0: 20, + x1: 34, + y1: 32, + xo: 0.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 35, + y0: 20, + x1: 43, + y1: 33, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 44, + y0: 20, + x1: 52, + y1: 33, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 53, + y0: 20, + x1: 61, + y1: 32, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 62, + y0: 20, + x1: 70, + y1: 33, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 71, + y0: 20, + x1: 79, + y1: 33, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 80, + y0: 20, + x1: 83, + y1: 30, + xo: 1.000000, + yo: -9.000000, + xa: 4.169492, + }, + BakedGlyph { + x0: 84, + y0: 20, + x1: 88, + y1: 32, + xo: 0.000000, + yo: -9.000000, + xa: 4.169492, + }, + BakedGlyph { + x0: 89, + y0: 20, + x1: 98, + y1: 28, + xo: 0.000000, + yo: -9.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 99, + y0: 20, + x1: 108, + y1: 26, + xo: 0.000000, + yo: -8.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 109, + y0: 20, + x1: 118, + y1: 28, + xo: 0.000000, + yo: -9.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 119, + y0: 20, + x1: 125, + y1: 33, + xo: 0.000000, + yo: -12.000000, + xa: 6.440678, + }, + BakedGlyph { + x0: 1, + y0: 34, + x1: 15, + y1: 49, + xo: 1.000000, + yo: -12.000000, + xa: 15.932203, + }, + BakedGlyph { + x0: 16, + y0: 34, + x1: 27, + y1: 46, + xo: 0.000000, + yo: -12.000000, + xa: 10.864407, + }, + BakedGlyph { + x0: 28, + y0: 34, + x1: 37, + y1: 47, + xo: 1.000000, + yo: -12.000000, + xa: 10.677966, + }, + BakedGlyph { + x0: 38, + y0: 34, + x1: 47, + y1: 47, + xo: 1.000000, + yo: -12.000000, + xa: 10.322034, + }, + BakedGlyph { + x0: 48, + y0: 34, + x1: 58, + y1: 47, + xo: 1.000000, + yo: -12.000000, + xa: 11.898305, + }, + BakedGlyph { + x0: 59, + y0: 34, + x1: 67, + y1: 46, + xo: 1.000000, + yo: -12.000000, + xa: 9.406779, + }, + BakedGlyph { + x0: 68, + y0: 34, + x1: 76, + y1: 46, + xo: 1.000000, + yo: -12.000000, + xa: 8.813560, + }, + BakedGlyph { + x0: 77, + y0: 34, + x1: 86, + y1: 47, + xo: 1.000000, + yo: -12.000000, + xa: 11.152542, + }, + BakedGlyph { + x0: 87, + y0: 34, + x1: 97, + y1: 46, + xo: 1.000000, + yo: -12.000000, + xa: 11.728813, + }, + BakedGlyph { + x0: 98, + y0: 34, + x1: 100, + y1: 46, + xo: 1.000000, + yo: -12.000000, + xa: 4.203390, + }, + BakedGlyph { + x0: 101, + y0: 34, + x1: 108, + y1: 47, + xo: 0.000000, + yo: -12.000000, + xa: 8.254237, + }, + BakedGlyph { + x0: 109, + y0: 34, + x1: 118, + y1: 46, + xo: 1.000000, + yo: -12.000000, + xa: 10.152542, + }, + BakedGlyph { + x0: 1, + y0: 50, + x1: 9, + y1: 62, + xo: 1.000000, + yo: -12.000000, + xa: 8.508474, + }, + BakedGlyph { + x0: 10, + y0: 50, + x1: 23, + y1: 62, + xo: 1.000000, + yo: -12.000000, + xa: 14.661017, + }, + BakedGlyph { + x0: 24, + y0: 50, + x1: 34, + y1: 62, + xo: 1.000000, + yo: -12.000000, + xa: 12.016949, + }, + BakedGlyph { + x0: 35, + y0: 50, + x1: 47, + y1: 63, + xo: 1.000000, + yo: -12.000000, + xa: 13.118644, + }, + BakedGlyph { + x0: 48, + y0: 50, + x1: 57, + y1: 62, + xo: 1.000000, + yo: -12.000000, + xa: 10.033898, + }, + BakedGlyph { + x0: 58, + y0: 50, + x1: 70, + y1: 66, + xo: 1.000000, + yo: -12.000000, + xa: 13.118644, + }, + BakedGlyph { + x0: 71, + y0: 50, + x1: 81, + y1: 62, + xo: 1.000000, + yo: -12.000000, + xa: 10.474576, + }, + BakedGlyph { + x0: 82, + y0: 50, + x1: 91, + y1: 63, + xo: 0.000000, + yo: -12.000000, + xa: 8.762712, + }, + BakedGlyph { + x0: 92, + y0: 50, + x1: 101, + y1: 62, + xo: 0.000000, + yo: -12.000000, + xa: 9.288136, + }, + BakedGlyph { + x0: 102, + y0: 50, + x1: 112, + y1: 63, + xo: 1.000000, + yo: -12.000000, + xa: 11.525424, + }, + BakedGlyph { + x0: 113, + y0: 50, + x1: 124, + y1: 62, + xo: 0.000000, + yo: -12.000000, + xa: 10.576271, + }, + BakedGlyph { + x0: 1, + y0: 67, + x1: 16, + y1: 79, + xo: 0.000000, + yo: -12.000000, + xa: 15.610169, + }, + BakedGlyph { + x0: 17, + y0: 67, + x1: 27, + y1: 79, + xo: 0.000000, + yo: -12.000000, + xa: 10.305085, + }, + BakedGlyph { + x0: 28, + y0: 67, + x1: 38, + y1: 79, + xo: 0.000000, + yo: -12.000000, + xa: 9.644068, + }, + BakedGlyph { + x0: 39, + y0: 67, + x1: 48, + y1: 79, + xo: 0.000000, + yo: -12.000000, + xa: 9.491526, + }, + BakedGlyph { + x0: 49, + y0: 67, + x1: 54, + y1: 85, + xo: 1.000000, + yo: -14.000000, + xa: 5.254237, + }, + BakedGlyph { + x0: 55, + y0: 67, + x1: 63, + y1: 85, + xo: -1.000000, + yo: -14.000000, + xa: 6.084746, + }, + BakedGlyph { + x0: 64, + y0: 67, + x1: 68, + y1: 85, + xo: 0.000000, + yo: -14.000000, + xa: 5.254237, + }, + BakedGlyph { + x0: 69, + y0: 67, + x1: 77, + y1: 74, + xo: 1.000000, + yo: -12.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 78, + y0: 67, + x1: 88, + y1: 69, + xo: -1.000000, + yo: 2.000000, + xa: 8.305085, + }, + BakedGlyph { + x0: 89, + y0: 67, + x1: 93, + y1: 72, + xo: 1.000000, + yo: -14.000000, + xa: 6.372881, + }, + BakedGlyph { + x0: 94, + y0: 67, + x1: 102, + y1: 77, + xo: 0.000000, + yo: -9.000000, + xa: 8.627119, + }, + BakedGlyph { + x0: 103, + y0: 67, + x1: 111, + y1: 82, + xo: 1.000000, + yo: -14.000000, + xa: 9.881356, + }, + BakedGlyph { + x0: 112, + y0: 67, + x1: 120, + y1: 77, + xo: 0.000000, + yo: -9.000000, + xa: 7.796610, + }, + BakedGlyph { + x0: 1, + y0: 86, + x1: 10, + y1: 101, + xo: 0.000000, + yo: -14.000000, + xa: 9.881356, + }, + BakedGlyph { + x0: 11, + y0: 86, + x1: 20, + y1: 96, + xo: 0.000000, + yo: -9.000000, + xa: 9.288136, + }, + BakedGlyph { + x0: 21, + y0: 86, + x1: 27, + y1: 100, + xo: 1.000000, + yo: -14.000000, + xa: 6.372881, + }, + BakedGlyph { + x0: 28, + y0: 86, + x1: 37, + y1: 99, + xo: 0.000000, + yo: -9.000000, + xa: 9.711864, + }, + BakedGlyph { + x0: 38, + y0: 86, + x1: 46, + y1: 100, + xo: 1.000000, + yo: -14.000000, + xa: 9.644068, + }, + BakedGlyph { + x0: 47, + y0: 86, + x1: 49, + y1: 99, + xo: 1.000000, + yo: -13.000000, + xa: 4.016949, + }, + BakedGlyph { + x0: 50, + y0: 86, + x1: 55, + y1: 103, + xo: -2.000000, + yo: -13.000000, + xa: 4.016949, + }, + BakedGlyph { + x0: 56, + y0: 86, + x1: 64, + y1: 100, + xo: 1.000000, + yo: -14.000000, + xa: 8.389831, + }, + BakedGlyph { + x0: 65, + y0: 86, + x1: 68, + y1: 101, + xo: 1.000000, + yo: -14.000000, + xa: 4.322034, + }, + BakedGlyph { + x0: 69, + y0: 86, + x1: 82, + y1: 95, + xo: 1.000000, + yo: -9.000000, + xa: 14.627119, + }, + BakedGlyph { + x0: 83, + y0: 86, + x1: 91, + y1: 95, + xo: 1.000000, + yo: -9.000000, + xa: 9.644068, + }, + BakedGlyph { + x0: 92, + y0: 86, + x1: 101, + y1: 96, + xo: 0.000000, + yo: -9.000000, + xa: 9.864407, + }, + BakedGlyph { + x0: 102, + y0: 86, + x1: 110, + y1: 99, + xo: 1.000000, + yo: -9.000000, + xa: 9.881356, + }, + BakedGlyph { + x0: 111, + y0: 86, + x1: 120, + y1: 99, + xo: 0.000000, + yo: -9.000000, + xa: 9.881356, + }, + BakedGlyph { + x0: 1, + y0: 104, + x1: 7, + y1: 113, + xo: 1.000000, + yo: -9.000000, + xa: 6.338983, + }, + BakedGlyph { + x0: 8, + y0: 104, + x1: 15, + y1: 114, + xo: 0.000000, + yo: -9.000000, + xa: 7.254237, + }, + BakedGlyph { + x0: 16, + y0: 104, + x1: 22, + y1: 117, + xo: 1.000000, + yo: -12.000000, + xa: 6.559322, + }, + BakedGlyph { + x0: 23, + y0: 104, + x1: 31, + y1: 114, + xo: 1.000000, + yo: -9.000000, + xa: 9.644068, + }, + BakedGlyph { + x0: 32, + y0: 104, + x1: 40, + y1: 113, + xo: 0.000000, + yo: -9.000000, + xa: 8.135593, + }, + BakedGlyph { + x0: 41, + y0: 104, + x1: 54, + y1: 113, + xo: 0.000000, + yo: -9.000000, + xa: 13.135593, + }, + BakedGlyph { + x0: 55, + y0: 104, + x1: 63, + y1: 113, + xo: 0.000000, + yo: -9.000000, + xa: 8.457627, + }, + BakedGlyph { + x0: 64, + y0: 104, + x1: 72, + y1: 117, + xo: 0.000000, + yo: -9.000000, + xa: 8.033898, + }, + BakedGlyph { + x0: 73, + y0: 104, + x1: 81, + y1: 113, + xo: 0.000000, + yo: -9.000000, + xa: 7.711864, + }, + BakedGlyph { + x0: 82, + y0: 104, + x1: 88, + y1: 122, + xo: 0.000000, + yo: -14.000000, + xa: 5.406780, + }, + BakedGlyph { + x0: 89, + y0: 104, + x1: 91, + y1: 122, + xo: 1.000000, + yo: -14.000000, + xa: 4.440678, + }, + BakedGlyph { + x0: 92, + y0: 104, + x1: 97, + y1: 122, + xo: 0.000000, + yo: -14.000000, + xa: 5.406780, + }, + BakedGlyph { + x0: 98, + y0: 104, + x1: 107, + y1: 108, + xo: 0.000000, + yo: -7.000000, + xa: 9.559322, + }, + BakedGlyph { + x0: 108, + y0: 104, + x1: 116, + y1: 117, + xo: 0.000000, + yo: -13.000000, + xa: 8.474576, + }, +]; + +pub const FONT_BITMAP: [u8; 16384] = [ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x34,0xae,0x00,0x00,0x81,0x90,0x00,0xe0,0x31,0x00,0x00,0x00,0x00,0x06, + 0xba,0x05,0x00,0x00,0xa2,0x23,0x00,0x00,0x00,0x00,0x00,0x1a,0x0d,0x00,0x00,0x00, + 0x00,0x16,0xb2,0xec,0xbc,0x1f,0x00,0x00,0x00,0x49,0x8c,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0d,0x9d,0xeb,0xe5,0x89,0x03,0x00,0x00,0x00,0x00,0x81,0x90,0x00,0x00,0x00, + 0x00,0x13,0x00,0x00,0x11,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6b,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x04,0x00,0x00,0x00,0x00,0x00,0x4a,0x76,0x00, + 0x3b,0x70,0x70,0x70,0x22,0x00,0x56,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x2d,0x1e,0x00,0x00,0x18,0xac,0xea,0xd2,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x45,0xe9,0x00,0x00,0x8a,0x99,0x00,0xf6,0x2d,0x00,0x00,0x00,0x00,0x2f, + 0xd8,0x00,0x00,0x08,0xf7,0x09,0x00,0x00,0x00,0x00,0x00,0xad,0x52,0x00,0x00,0x00, + 0x00,0xa5,0x8f,0x0c,0x7d,0xba,0x00,0x00,0x06,0xda,0x3d,0x00,0x00,0x00,0x00,0x00, + 0x00,0x92,0xb9,0x20,0x28,0xd7,0x64,0x00,0x00,0x00,0x00,0x8a,0x99,0x00,0x00,0x00, + 0x28,0xdd,0x03,0x00,0xa5,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x7f,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xb6,0x45,0x00,0x00,0x00,0x00,0x00,0x80,0xaa,0x00, + 0x54,0xa0,0xa0,0xa0,0x31,0x00,0xbb,0xe4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0xe0,0x34,0x00,0x0b,0xd7,0x95,0x1d,0x40,0xe1,0x6d,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x45,0xe9,0x00,0x00,0x7a,0x88,0x00,0xe6,0x1c,0x00,0x00,0x00,0x00,0x60, + 0xa8,0x00,0x00,0x34,0xd3,0x00,0x00,0x00,0x00,0x00,0x00,0xb2,0x6b,0x0b,0x00,0x00, + 0x00,0xea,0x22,0x00,0x10,0xf7,0x05,0x00,0x73,0xab,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xd6,0x50,0x00,0x00,0x81,0x98,0x00,0x00,0x00,0x00,0x7a,0x88,0x00,0x00,0x00, + 0xb4,0x6a,0x00,0x00,0x2e,0xe4,0x0d,0x00,0x00,0x24,0xcd,0x61,0x65,0x62,0x61,0xcd, + 0x24,0x00,0x00,0x00,0x00,0x00,0xb6,0x45,0x00,0x00,0x00,0x00,0x00,0x9b,0x83,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c, + 0xda,0x00,0x00,0x5e,0xd0,0x03,0x00,0x00,0x49,0xe6,0x04,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x44,0xe9,0x00,0x00,0x5a,0x67,0x00,0xbf,0x02,0x00,0x1b,0x86,0x86,0xc4, + 0xc5,0x86,0x86,0xb0,0xd9,0x86,0x24,0x00,0x00,0x57,0xc9,0xea,0xd3,0xef,0x85,0x00, + 0x00,0xed,0x1e,0x00,0x0d,0xf7,0x07,0x15,0xe8,0x21,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xbf,0x65,0x00,0x00,0xc6,0x6a,0x00,0x00,0x00,0x00,0x5a,0x67,0x00,0x00,0x47, + 0xd7,0x04,0x00,0x00,0x00,0x9d,0x85,0x00,0x00,0x0d,0x55,0x8d,0xcc,0xcc,0x8c,0x54, + 0x0d,0x00,0x00,0x00,0x00,0x00,0xb6,0x45,0x00,0x00,0x00,0x00,0x01,0xe0,0x2e,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x96, + 0x81,0x00,0x00,0xb7,0x80,0x00,0x00,0x00,0x04,0xf1,0x45,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x3d,0xe3,0x00,0x00,0x0f,0x12,0x00,0x21,0x00,0x00,0x13,0x5f,0x5f,0xe0, + 0x86,0x5f,0x5f,0xc2,0x9f,0x5f,0x1a,0x00,0x16,0xf9,0x3d,0x01,0x00,0x03,0x13,0x00, + 0x00,0xae,0x80,0x04,0x6c,0xc4,0x00,0x96,0x87,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x56,0xe2,0x1f,0x8e,0xc2,0x06,0x00,0x00,0x00,0x00,0x0f,0x12,0x00,0x00,0xc7, + 0x4f,0x00,0x00,0x00,0x00,0x1a,0xee,0x0d,0x00,0x00,0x00,0x3b,0xb4,0xb5,0x37,0x00, + 0x00,0x00,0x05,0x5f,0x5f,0x5f,0xd1,0x8a,0x5f,0x5f,0x3a,0x00,0x0b,0x76,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0xea, + 0x27,0x00,0x00,0xd8,0x4f,0x00,0x00,0x00,0x00,0xc2,0x67,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x35,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xf2, + 0x16,0x00,0x00,0xc6,0x3f,0x00,0x00,0x00,0x65,0xc3,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1f,0xc7,0xef,0xd1,0x29,0x2c,0xe4,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0d,0xd1,0xfa,0x8f,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xf6, + 0x0a,0x00,0x00,0x00,0x00,0x00,0xca,0x3b,0x00,0x00,0x23,0xec,0x3c,0x3d,0xea,0x21, + 0x00,0x00,0x07,0x93,0x93,0x93,0xe0,0xb0,0x93,0x93,0x5a,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0xcd, + 0x00,0x00,0x00,0xf0,0x3e,0x00,0x00,0x00,0x00,0xb0,0x7f,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x25,0xc5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0xe4, + 0x00,0x00,0x03,0xf4,0x0f,0x00,0x00,0x00,0x4d,0xec,0x20,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x06,0x00,0x00,0xba,0x63,0x07,0x82,0xc2,0x8d,0x0c,0x00,0x00,0x00, + 0x24,0xda,0x7b,0x97,0xc2,0x0b,0x00,0x01,0xa2,0x03,0x00,0x00,0x00,0x00,0x2a,0xe1, + 0x00,0x00,0x00,0x00,0x00,0x00,0xa3,0x69,0x00,0x00,0x0a,0x5b,0x00,0x00,0x5d,0x0a, + 0x00,0x00,0x00,0x00,0x00,0x00,0xb6,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa4,0x74, + 0x00,0x00,0x00,0xf6,0x3a,0x00,0x00,0x00,0x00,0xab,0x85,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x09,0xaa,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x1e,0x67,0xbe, + 0x1e,0x1e,0x40,0xe4,0x1e,0x1e,0x08,0x00,0x01,0x96,0xf2,0x91,0x2b,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x4c,0xce,0x02,0x8c,0xb1,0x37,0xa3,0xa2,0x00,0x00,0x00, + 0xc6,0x75,0x00,0x01,0x9c,0xbe,0x0a,0x28,0xd1,0x00,0x00,0x00,0x00,0x00,0x57,0xbc, + 0x00,0x00,0x00,0x00,0x00,0x00,0x7d,0x96,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xb6,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xf1,0x1c, + 0x00,0x00,0x00,0xde,0x49,0x00,0x00,0x00,0x00,0xbc,0x6d,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x37,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x29,0xcb,0xea,0xe2, + 0xcb,0xcb,0xe1,0xeb,0xcb,0xcb,0x37,0x00,0x00,0x00,0x2d,0x93,0xee,0xb4,0x1f,0x00, + 0x00,0x00,0x00,0x00,0x05,0xd8,0x40,0x00,0xe2,0x2e,0x00,0x19,0xf5,0x02,0x00,0x13, + 0xff,0x1d,0x00,0x00,0x02,0xa1,0xbb,0x94,0x7b,0x00,0x00,0x00,0x00,0x00,0x84,0x96, + 0x00,0x00,0x00,0x00,0x00,0x00,0x56,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xb6,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0xc0,0x00, + 0x00,0x00,0x00,0xc4,0x6e,0x00,0x00,0x00,0x00,0xe2,0x53,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb6,0x52, + 0x00,0x00,0x8b,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xa7,0xd7,0x04, + 0x00,0x00,0x00,0x00,0x70,0xad,0x00,0x00,0xf2,0x15,0x00,0x06,0xf7,0x0a,0x00,0x10, + 0xff,0x23,0x00,0x00,0x00,0x03,0xb2,0xfb,0x13,0x00,0x00,0x00,0x00,0x00,0x7e,0x9b, + 0x00,0x00,0x00,0x00,0x00,0x00,0x5b,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb3,0x67,0x00, + 0x00,0x00,0x00,0x77,0xb5,0x00,0x00,0x00,0x2b,0xf5,0x0f,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x33,0x8c,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0x20, + 0x00,0x00,0xbd,0x4b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0xfc,0x2c, + 0x00,0x00,0x00,0x13,0xe7,0x23,0x00,0x00,0xc1,0x5c,0x00,0x47,0xd7,0x00,0x00,0x00, + 0xb5,0xaf,0x0d,0x00,0x0a,0x60,0xe1,0xbd,0xa5,0x01,0x00,0x00,0x00,0x00,0x51,0xc1, + 0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0xf4,0x13,0x00, + 0x00,0x00,0x00,0x19,0xf3,0x57,0x00,0x0b,0xc0,0x98,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7f,0xfe,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0xec,0x00, + 0x00,0x01,0xee,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0xef,0x0c, + 0x00,0x00,0x00,0x94,0x8a,0x00,0x00,0x00,0x35,0xe8,0xc4,0xed,0x44,0x00,0x00,0x00, + 0x15,0xa9,0xf1,0xdc,0xea,0xaf,0x1e,0x07,0xc7,0x73,0x00,0x00,0x00,0x00,0x24,0xe6, + 0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x67,0xb3,0x00,0x00, + 0x00,0x00,0x00,0x00,0x3c,0xea,0xdb,0xf2,0xae,0x07,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x02,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x85,0x9b,0x61,0x52,0x6c,0xd1,0x89,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x34,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x03,0x1b,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xf4, + 0x0d,0x00,0x00,0x00,0x00,0x00,0xcf,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc1,0x5a,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x02,0x2c,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x69,0x8f,0xe2,0xa5,0x28,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xba, + 0x5e,0x00,0x00,0x00,0x00,0x26,0xe9,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1d,0xf2,0x0b,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x52,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35, + 0xe1,0x0a,0x00,0x00,0x00,0xaf,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0xa6,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x93,0x46,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xa1,0x7d,0x00,0x00,0x3e,0xd9,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcf,0x4d,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x1a,0xd2,0x03,0x00,0xa0,0x4f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2a,0xed,0x06,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x05,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x1a,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x28,0xb6,0x00,0x14,0x93,0xe1,0xe8,0x99,0x42,0x00,0x00,0x00, + 0x2b,0xaa,0xea,0xf3,0xca,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0xbd, + 0x30,0x00,0x00,0x00,0x63,0xbe,0xbe,0xbe,0xbe,0x94,0x00,0x00,0x00,0x00,0x00,0x0d, + 0x5a,0x8c,0x92,0x00,0x00,0x9e,0xbe,0xbe,0xbe,0xbe,0xbe,0xbe,0x3a,0x00,0x00,0x39, + 0xbe,0xed,0xde,0x94,0x0f,0x00,0x00,0x00,0x47,0xc5,0xf0,0xce,0x62,0x00,0x00,0x00, + 0x6a,0x88,0x00,0x00,0x00,0x6a,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x2a,0x29,0x00,0x02,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x18,0x00,0x00,0x4a,0x0a, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0xd0,0xf3,0xe5,0xa3,0x17,0x00,0x00,0x00, + 0x00,0x00,0x00,0x36,0xe8,0xfb,0x00,0x98,0x8a,0x21,0x16,0x68,0xfb,0x1d,0x00,0x00, + 0x3a,0x6a,0x22,0x11,0x62,0xf8,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0xd7,0xed, + 0x41,0x00,0x00,0x00,0x8e,0x8e,0x38,0x38,0x38,0x2c,0x00,0x00,0x00,0x00,0x42,0xdd, + 0xa9,0x5c,0x2b,0x00,0x00,0x39,0x45,0x45,0x45,0x45,0x5a,0xf1,0x24,0x00,0x25,0xef, + 0x54,0x05,0x17,0xad,0xb3,0x00,0x00,0x3e,0xe9,0x46,0x08,0x39,0xe1,0x65,0x00,0x00, + 0xaf,0xd8,0x00,0x00,0x00,0xaf,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x50,0xbc, + 0xe2,0x4f,0x00,0x0a,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0x7c,0x00,0x02,0xaa,0xe9, + 0x8b,0x21,0x00,0x00,0x00,0x00,0x00,0x32,0x49,0x0e,0x16,0xae,0xb1,0x00,0x00,0x00, + 0x00,0x0d,0xad,0xdf,0x61,0xfb,0x00,0x02,0x00,0x00,0x00,0x00,0xba,0x7a,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xac,0x86,0x00,0x00,0x00,0x00,0x00,0x05,0xc6,0x50,0xd4, + 0x41,0x00,0x00,0x00,0x9b,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0xf1,0x36, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xae,0x71,0x00,0x00,0x7d,0xa3, + 0x00,0x00,0x00,0x18,0xff,0x13,0x00,0xb6,0x78,0x00,0x00,0x00,0x4b,0xe0,0x04,0x00, + 0x02,0x05,0x00,0x00,0x00,0x02,0x05,0x00,0x00,0x00,0x00,0x13,0x76,0xdf,0xbe,0x53, + 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1d, + 0x84,0xe6,0xb1,0x45,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xeb,0x00,0x00,0x00, + 0x00,0x01,0x58,0x08,0x1e,0xfb,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0xa8,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xaa,0x70,0x00,0x00,0x00,0x00,0x00,0x87,0x8a,0x00,0xd4, + 0x41,0x00,0x00,0x00,0xad,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xd0,0x54,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xd4,0x02,0x00,0x00,0x8b,0x93, + 0x00,0x00,0x00,0x1e,0xff,0x18,0x00,0xe2,0x4c,0x00,0x00,0x00,0x06,0xfb,0x24,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x9d,0xe9,0x94,0x2a,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x06,0x5b,0xc5,0xd6,0x4e,0x00,0x00,0x00,0x00,0x00,0x75,0xbd,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x69,0x00,0x00, + 0x00,0x00,0x00,0x00,0x3e,0xe4,0x1c,0x00,0x00,0x00,0x00,0x39,0xd0,0x07,0x00,0xd4, + 0x41,0x00,0x00,0x00,0xc5,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0xeb,0x04,0x01, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xcc,0x58,0x00,0x00,0x00,0x45,0xe5, + 0x1a,0x00,0x00,0x74,0xc5,0x00,0x00,0xd2,0x80,0x00,0x00,0x00,0x00,0xe9,0x41,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xd8,0xcb,0x58,0x06,0x00,0x00, + 0x00,0x00,0x00,0x08,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x5c,0x00,0x00,0x00,0x00, + 0x00,0x00,0x21,0x89,0xef,0x73,0x00,0x00,0x00,0x00,0x2b,0xe6,0x32,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x00,0x00,0x00,0x00,0x70,0xd1,0x06,0x00,0x00, + 0x00,0x00,0x82,0xd2,0xed,0x2e,0x00,0x00,0x00,0x00,0x03,0xcd,0x3d,0x00,0x00,0xd4, + 0x41,0x00,0x00,0x00,0xc5,0xf6,0xe8,0xb5,0x3e,0x00,0x00,0x00,0x71,0xdc,0xc6,0xef, + 0xf3,0xc1,0x30,0x00,0x00,0x00,0x00,0x00,0x48,0xd8,0x02,0x00,0x00,0x00,0x00,0x5c, + 0xe9,0x8e,0x7d,0xd8,0x20,0x00,0x00,0x82,0xd4,0x1c,0x00,0x00,0x16,0xed,0x39,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x46,0xb3,0xe4,0x81,0x1b, + 0x00,0x00,0x00,0x05,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x37,0x00,0x00,0x00,0x01, + 0x47,0xb2,0xe5,0x81,0x1a,0x00,0x00,0x00,0x00,0x1d,0xdf,0x49,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x00,0x00,0x00,0x67,0xe2,0x1f,0x00,0x00,0x00, + 0x00,0x00,0x25,0x4b,0x95,0xea,0x3f,0x00,0x00,0x00,0x63,0xac,0x00,0x00,0x00,0xd4, + 0x41,0x00,0x00,0x00,0x00,0x00,0x17,0x6c,0xee,0x5c,0x00,0x00,0x94,0xb6,0x29,0x02, + 0x1d,0x8a,0xef,0x11,0x00,0x00,0x00,0x00,0xaf,0x78,0x00,0x00,0x00,0x00,0x03,0x9e, + 0xc5,0x6f,0xc8,0xc2,0x19,0x00,0x00,0x0c,0xab,0xfd,0xc6,0xcd,0xdb,0xff,0x17,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x8d,0xea, + 0xab,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x71,0xda, + 0xc7,0x5b,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0xaa,0x76,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x00,0x00,0x6f,0xe1,0x24,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x6a,0xe0,0x01,0x00,0x02,0xd9,0x45,0x16,0x16,0x16,0xd7, + 0x51,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x51,0xed,0x01,0x00,0xa1,0x81,0x00,0x00, + 0x00,0x06,0xf1,0x65,0x00,0x00,0x00,0x0d,0xf6,0x20,0x00,0x00,0x00,0x00,0x76,0xc8, + 0x07,0x00,0x00,0x63,0xe6,0x0a,0x00,0x00,0x00,0x16,0x3b,0x26,0x3e,0xf2,0x00,0x00, + 0x56,0x70,0x00,0x00,0x00,0x4a,0x76,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b, + 0x66,0x47,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x35, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xea,0x11,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x00,0x59,0xe6,0x23,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x1c,0x00,0x1f,0xcf,0xcf,0xcf,0xcf,0xcf,0xf7, + 0xdc,0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0xff,0x20,0x00,0x64,0x92,0x00,0x00, + 0x00,0x00,0xb4,0x81,0x00,0x00,0x00,0x5a,0xc7,0x00,0x00,0x00,0x00,0x00,0xca,0x72, + 0x00,0x00,0x00,0x00,0xdc,0x4d,0x00,0x00,0x00,0x00,0x00,0x00,0x8d,0x9b,0x00,0x00, + 0xbb,0xe4,0x00,0x00,0x00,0x80,0xaa,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x13,0xec,0x3a,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x4c,0xfc,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd4, + 0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0xfe,0x0d,0x00,0x21,0xcc,0x00,0x00, + 0x00,0x00,0xca,0x63,0x00,0x00,0x00,0x9b,0x8e,0x00,0x00,0x00,0x00,0x00,0xca,0x5e, + 0x00,0x00,0x00,0x00,0xce,0x54,0x00,0x00,0x00,0x00,0x00,0x41,0xed,0x18,0x00,0x00, + 0x09,0x11,0x00,0x00,0x00,0x9b,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x6d,0xb6,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x25,0x04,0x00,0x01,0x32,0xc1,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd4, + 0x41,0x00,0x00,0x22,0x06,0x00,0x00,0x10,0xb0,0xac,0x00,0x00,0x00,0xdd,0x5b,0x00, + 0x00,0x4b,0xec,0x10,0x00,0x00,0x00,0xc6,0x63,0x00,0x00,0x00,0x00,0x00,0x7a,0xcb, + 0x11,0x00,0x00,0x52,0xeb,0x14,0x00,0x00,0x03,0x22,0x88,0xda,0x4b,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0xe0,0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x8e,0x2b,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xfb,0x00,0x9b,0xfb,0xf6,0xf6,0xf6,0xf6,0xf6,0x21,0x00, + 0xa4,0xf0,0xcc,0xe7,0xfd,0x9d,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd4, + 0x41,0x00,0x00,0x8f,0xf2,0xce,0xd2,0xf4,0xa2,0x13,0x00,0x00,0x00,0x33,0xe0,0xd8, + 0xcd,0xe0,0x3a,0x00,0x00,0x00,0x01,0xf1,0x38,0x00,0x00,0x00,0x00,0x00,0x04,0x91, + 0xea,0xbe,0xcf,0xdc,0x3f,0x00,0x00,0x52,0xe1,0xbf,0x89,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x0b,0x76,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0xfe,0x70,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x17,0x39,0x2e,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x12,0x37,0x30,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x24, + 0x28,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x0e,0x34,0x24,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x0e,0x7d,0xb2,0xdc,0xe5,0xb8,0x84,0x14,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x30,0xbd,0x15,0x00,0x00,0x00,0x00,0x00,0x45,0xb2,0xce,0xd4, + 0xc2,0x9a,0x42,0x00,0x00,0x00,0x00,0x00,0x12,0x90,0xce,0xf7,0xea,0xb6,0x4c,0x00, + 0x45,0xb1,0xcb,0xd0,0xb0,0x8b,0x34,0x00,0x00,0x00,0x00,0x5a,0xbe,0xbe,0xbe,0xbe, + 0xbe,0xbe,0x3a,0x00,0x5a,0xbe,0xbe,0xbe,0xbe,0xbe,0xbe,0x2a,0x00,0x00,0x00,0x11, + 0x8e,0xcb,0xf4,0xdf,0xbb,0x5f,0x00,0x5a,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0xb4, + 0x27,0x00,0x5a,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x94,0x00,0x5a,0x81,0x00, + 0x00,0x00,0x00,0x21,0xb7,0x2f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x54,0xe4,0x9c,0x4a,0x1d,0x13,0x45,0x8c,0xe7,0x5c,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa6,0xec,0x7f,0x00,0x00,0x00,0x00,0x00,0x79,0xc0,0x2c,0x27, + 0x39,0x74,0xeb,0x79,0x00,0x00,0x00,0x37,0xe5,0x9f,0x43,0x16,0x29,0x63,0x62,0x00, + 0x79,0xc1,0x31,0x2d,0x4f,0x7b,0xe7,0xa6,0x0f,0x00,0x00,0x79,0xc2,0x41,0x41,0x41, + 0x41,0x41,0x14,0x00,0x79,0xc2,0x41,0x41,0x41,0x41,0x41,0x0e,0x00,0x00,0x37,0xe4, + 0x9e,0x3b,0x13,0x28,0x5b,0x83,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xc7,0x00,0x79,0xad,0x00, + 0x00,0x00,0x1b,0xda,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x39,0xeb,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xe5,0x44,0x00,0x00, + 0x00,0x00,0x00,0x1f,0xed,0x45,0xea,0x09,0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00, + 0x00,0x00,0x42,0xf4,0x06,0x00,0x08,0xd9,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x10,0xb6,0xa5,0x00,0x00,0x79,0xad,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xda,0x73, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xc7,0x00,0x79,0xad,0x00, + 0x00,0x1b,0xd9,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x07,0xd6,0x67,0x00,0x00,0x19,0x63,0x86,0x70,0x36,0x00,0x53,0xe2,0x0e,0x00, + 0x00,0x00,0x00,0x89,0x93,0x00,0xcb,0x61,0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00, + 0x00,0x00,0x1b,0xfd,0x13,0x00,0x72,0xd4,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x19,0xf0,0x4d,0x00,0x79,0xad,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0xd1,0x03, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xc7,0x00,0x79,0xad,0x00, + 0x1d,0xd9,0x67,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4f,0xd4,0x02,0x00,0x3f,0xe7,0x94,0x64,0x8d,0xe1,0x00,0x00,0xc8,0x50,0x00, + 0x00,0x00,0x08,0xea,0x29,0x00,0x60,0xc9,0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00, + 0x00,0x00,0x80,0xc2,0x00,0x00,0xac,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x8d,0x00,0x79,0xad,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x81,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xc7,0x00,0x79,0xad,0x22, + 0xda,0x5f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x7b,0x99,0x00,0x05,0xdc,0x5a,0x00,0x00,0x34,0xe1,0x00,0x00,0x91,0x82,0x00, + 0x00,0x00,0x5d,0xc5,0x00,0x00,0x0b,0xf1,0x32,0x00,0x00,0x00,0x79,0xdf,0x9c,0x9c, + 0xa6,0xd5,0xcc,0x12,0x00,0x00,0xd7,0x5a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xbb,0x00,0x79,0xe3,0xa9,0xa9,0xa9, + 0xa9,0x75,0x00,0x00,0x79,0xdf,0x9c,0x9c,0x9c,0x9c,0x5c,0x00,0x00,0xd7,0x5c,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x79,0xe2,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xfa, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xc7,0x00,0x79,0xcf,0xe6, + 0x5b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xa7,0x70,0x00,0x2b,0xf3,0x01,0x00,0x00,0x34,0xe1,0x00,0x00,0x6c,0xab,0x00, + 0x00,0x00,0xc1,0x64,0x00,0x00,0x00,0x99,0x97,0x00,0x00,0x00,0x79,0xcc,0x5f,0x5f, + 0x66,0x80,0xd4,0xc1,0x0f,0x00,0xe2,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0xc6,0x00,0x79,0xc7,0x52,0x52,0x52, + 0x52,0x39,0x00,0x00,0x79,0xcd,0x63,0x63,0x63,0x63,0x3b,0x00,0x00,0xe2,0x52,0x00, + 0x00,0x00,0x00,0x00,0x16,0x8f,0x00,0x79,0xca,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0xf7, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xc7,0x00,0x79,0xc5,0xba, + 0xd2,0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xb9,0x60,0x00,0x3d,0xe4,0x00,0x00,0x00,0x34,0xe1,0x00,0x00,0x79,0x98,0x00, + 0x00,0x24,0xfb,0x41,0x34,0x34,0x34,0x68,0xf0,0x0a,0x00,0x00,0x79,0xad,0x00,0x00, + 0x00,0x00,0x08,0xce,0x80,0x00,0xbb,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x95,0x98,0x00,0x79,0xad,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x72,0x00, + 0x00,0x00,0x00,0x00,0x27,0xff,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xc7,0x00,0x79,0xad,0x01, + 0x74,0xea,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8f,0x87,0x00,0x16,0xfd,0x15,0x00,0x00,0x34,0xe1,0x00,0x00,0xb4,0x6d,0x00, + 0x00,0x85,0xe3,0xc7,0xc7,0xc7,0xc7,0xc7,0xee,0x5e,0x00,0x00,0x79,0xad,0x00,0x00, + 0x00,0x00,0x00,0x89,0xb2,0x00,0x90,0xae,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x07,0xdb,0x66,0x00,0x79,0xad,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0xaf,0x00, + 0x00,0x00,0x00,0x00,0x27,0xff,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0xc0,0x00,0x79,0xad,0x00, + 0x00,0x50,0xec,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x64,0xb2,0x00,0x00,0xa8,0xae,0x0e,0x00,0x3d,0xfb,0x16,0x4b,0xec,0x0f,0x00, + 0x02,0xe2,0x46,0x00,0x00,0x00,0x00,0x00,0x7c,0xbf,0x00,0x00,0x79,0xad,0x00,0x00, + 0x00,0x00,0x00,0xb4,0x90,0x00,0x21,0xf5,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x86,0xce,0x06,0x00,0x79,0xad,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0xf6,0x32, + 0x00,0x00,0x00,0x00,0x27,0xff,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0xa5,0x00,0x79,0xad,0x00, + 0x00,0x00,0x52,0xee,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x2a,0xf3,0x24,0x00,0x0f,0x96,0xe4,0xe3,0xc4,0xa4,0xf0,0xcd,0x33,0x00,0x00, + 0x45,0xe5,0x03,0x00,0x00,0x00,0x00,0x00,0x21,0xfd,0x22,0x00,0x79,0xad,0x00,0x00, + 0x00,0x21,0x8d,0xed,0x2a,0x00,0x00,0x74,0xec,0x50,0x04,0x00,0x00,0x11,0x33,0x00, + 0x79,0xad,0x00,0x00,0x0d,0x37,0xb5,0xdf,0x27,0x00,0x00,0x79,0xad,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xec, + 0x53,0x05,0x00,0x00,0x28,0xff,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x4f,0x28,0x00,0x04,0x48,0xf5,0x51,0x00,0x79,0xad,0x00, + 0x00,0x00,0x00,0x6e,0xe1,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x8a,0xbf,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xa4,0x8d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc2,0x81,0x00,0x65,0xf3,0xeb,0xe4, + 0xef,0xe5,0x97,0x29,0x00,0x00,0x00,0x00,0x4c,0xdd,0xf5,0xd1,0xe2,0xf7,0x95,0x00, + 0x65,0xf3,0xef,0xeb,0xf0,0xcc,0x74,0x07,0x00,0x00,0x00,0x79,0xff,0xff,0xff,0xff, + 0xff,0xff,0xbe,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4b, + 0xd9,0xf7,0xd1,0xd4,0xf2,0xd1,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0xf2, + 0x34,0x00,0x79,0xad,0x00,0x75,0xf0,0xd8,0xe9,0xfd,0x86,0x02,0x00,0x79,0xad,0x00, + 0x00,0x00,0x00,0x00,0xad,0xa9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x08,0xcf,0xbd,0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0x15, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x3a,0x30,0x0a,0x00,0x00, + 0x00,0x02,0x10,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x10,0x34,0x24,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x30,0x33,0x0b,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x07,0x78,0xeb,0xba,0x91,0x72,0x7c,0x72,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x12,0x41,0x68,0x84,0x76,0x44,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x5a,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb7,0x37,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x6e,0x77,0x00,0x00,0x5a,0x8e,0x00,0x00,0x00,0x00,0x00,0x00, + 0x7a,0x5d,0x00,0x00,0x00,0x13,0x93,0xcd,0xf3,0xd3,0x9e,0x1e,0x00,0x00,0x00,0x00, + 0x44,0xaf,0xca,0xd3,0xbc,0x9b,0x39,0x00,0x00,0x00,0x00,0x00,0x13,0x93,0xcd,0xf3, + 0xd3,0x9e,0x1e,0x00,0x00,0x00,0x00,0x44,0xaf,0xca,0xd3,0xbc,0x99,0x36,0x00,0x00, + 0x00,0x00,0x00,0x09,0x63,0xab,0xee,0xed,0xb8,0x4b,0x00,0x00,0x84,0xbe,0xbe,0xbe, + 0xbe,0xbe,0xbe,0xbe,0xbb,0x00,0x64,0x77,0x00,0x00,0x00,0x00,0x00,0x13,0xbe,0x0a, + 0x00,0x85,0x6f,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xb1,0x34,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xff,0xc4,0x01,0x00,0x00, + 0x00,0x00,0x00,0x1a,0xf4,0xb2,0x00,0x00,0x79,0xff,0x78,0x00,0x00,0x00,0x00,0x00, + 0xa4,0x7d,0x00,0x00,0x3c,0xe8,0x9c,0x3f,0x16,0x39,0x8c,0xee,0x4f,0x00,0x00,0x00, + 0x79,0xc2,0x34,0x2b,0x3d,0x7d,0xed,0x83,0x00,0x00,0x00,0x3c,0xe8,0x9c,0x3f,0x16, + 0x39,0x8c,0xee,0x4f,0x00,0x00,0x00,0x79,0xc2,0x35,0x2b,0x3c,0x7b,0xed,0x78,0x00, + 0x00,0x00,0x00,0x6a,0xc2,0x30,0x08,0x1e,0x5e,0x58,0x00,0x00,0x2d,0x41,0x41,0x41, + 0xf2,0x6b,0x41,0x41,0x40,0x00,0x86,0xa0,0x00,0x00,0x00,0x00,0x00,0x1a,0xff,0x0d, + 0x00,0x63,0xe1,0x01,0x00,0x00,0x00,0x00,0x00,0x3d,0xed,0x07,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0xef,0xdd,0x4e,0x00,0x00, + 0x00,0x00,0x00,0x98,0xcd,0xc8,0x00,0x00,0x79,0xc4,0xe6,0x4b,0x00,0x00,0x00,0x00, + 0xa4,0x7d,0x00,0x09,0xdd,0x71,0x00,0x00,0x00,0x00,0x00,0x53,0xed,0x16,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x32,0xfe,0x27,0x00,0x09,0xdd,0x71,0x00,0x00,0x00, + 0x00,0x00,0x53,0xed,0x16,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x3b,0xfd,0x1a, + 0x00,0x00,0x02,0xd8,0x2b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x86,0xa0,0x00,0x00,0x00,0x00,0x00,0x1a,0xff,0x0d, + 0x00,0x0f,0xf7,0x3a,0x00,0x00,0x00,0x00,0x00,0x95,0x98,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0xd8,0x61,0xcb,0x01,0x00, + 0x00,0x00,0x1f,0xea,0x4a,0xdd,0x00,0x00,0x79,0xa9,0x3d,0xe9,0x1f,0x00,0x00,0x00, + 0xa4,0x7d,0x00,0x76,0xd4,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xb9,0x94,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0xdc,0x5b,0x00,0x76,0xd4,0x03,0x00,0x00,0x00, + 0x00,0x00,0x00,0xb9,0x94,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0xeb,0x49, + 0x00,0x00,0x09,0xfc,0x2f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x86,0xa0,0x00,0x00,0x00,0x00,0x00,0x1a,0xff,0x0d, + 0x00,0x00,0xac,0x93,0x00,0x00,0x00,0x00,0x04,0xe9,0x3c,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0xc4,0x05,0xdf,0x4a,0x00, + 0x00,0x00,0x97,0x84,0x27,0xf3,0x00,0x00,0x79,0xa9,0x00,0x79,0xc8,0x06,0x00,0x00, + 0xa4,0x7d,0x00,0xad,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x62,0xcb,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x01,0xed,0x47,0x00,0xad,0x81,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x62,0xcb,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x09,0xf9,0x1f, + 0x00,0x00,0x00,0xaf,0xc5,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x86,0xa0,0x00,0x00,0x00,0x00,0x00,0x1a,0xff,0x0d, + 0x00,0x00,0x4f,0xea,0x05,0x00,0x00,0x00,0x49,0xdc,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0xb1,0x00,0x6a,0xc2,0x00, + 0x00,0x18,0xed,0x15,0x14,0xff,0x09,0x00,0x79,0xa9,0x00,0x02,0xbc,0x88,0x00,0x00, + 0xa4,0x7d,0x00,0xd8,0x5c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0xf4,0x02,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x75,0xeb,0x10,0x00,0xd8,0x5c,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x3e,0xf4,0x02,0x00,0x79,0xad,0x00,0x00,0x00,0x08,0x95,0xc4,0x00, + 0x00,0x00,0x00,0x0e,0x9f,0xf5,0x9e,0x2f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x86,0xa0,0x00,0x00,0x00,0x00,0x00,0x1a,0xff,0x0d, + 0x00,0x00,0x05,0xe8,0x4a,0x00,0x00,0x00,0xa4,0x7c,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x75,0x9d,0x00,0x09,0xe8,0x3a, + 0x00,0x88,0x92,0x00,0x03,0xfd,0x1b,0x00,0x79,0xa9,0x00,0x00,0x1b,0xea,0x3c,0x00, + 0xa4,0x7d,0x00,0xe1,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0xfa,0x05,0x00, + 0x79,0xd9,0x8a,0x90,0xa1,0xdb,0xda,0x38,0x00,0x00,0xe2,0x54,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x35,0xfc,0x06,0x00,0x79,0xe9,0xba,0xbd,0xc9,0xf2,0x90,0x0f,0x00, + 0x00,0x00,0x00,0x00,0x00,0x25,0x92,0xf2,0xa9,0x12,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x86,0xa0,0x00,0x00,0x00,0x00,0x00,0x1a,0xff,0x0d, + 0x00,0x00,0x00,0x8c,0xa9,0x00,0x00,0x0f,0xf3,0x1e,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x90,0x00,0x00,0x79,0xb0, + 0x0d,0xea,0x1f,0x00,0x00,0xf2,0x29,0x00,0x79,0xa9,0x00,0x00,0x00,0x57,0xdc,0x0b, + 0xa4,0x7d,0x00,0xb8,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0xd6,0x00,0x00, + 0x79,0xd2,0x75,0x6f,0x5a,0x37,0x01,0x00,0x00,0x00,0xb9,0x77,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x59,0xdc,0x00,0x00,0x79,0xc2,0x41,0x40,0x4a,0xf0,0x40,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0xc5,0xb4,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x84,0xa4,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x0b, + 0x00,0x00,0x00,0x29,0xf7,0x12,0x00,0x66,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x91,0x85,0x00,0x00,0x10,0xf0, + 0x96,0xa0,0x00,0x00,0x00,0xe7,0x38,0x00,0x79,0xa9,0x00,0x00,0x00,0x00,0xab,0x8a, + 0xa4,0x7d,0x00,0x8b,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9a,0xa9,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8b,0xb8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x9a,0xab,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x62,0xe3,0x12,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0xfd,0x0c,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x6b,0xc2,0x00,0x00,0x00,0x00,0x00,0x3e,0xef,0x00, + 0x00,0x00,0x00,0x00,0xbe,0x6e,0x00,0xca,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9f,0x7a,0x00,0x00,0x00,0x8e, + 0xff,0x2d,0x00,0x00,0x00,0xdb,0x47,0x00,0x79,0xa9,0x00,0x00,0x00,0x00,0x16,0xe8, + 0xcf,0x7d,0x00,0x1d,0xf3,0x43,0x00,0x00,0x00,0x00,0x00,0x29,0xf7,0x31,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1d,0xf4,0x43,0x00,0x00,0x00, + 0x00,0x00,0x29,0xf9,0x32,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0xb1,0xa4,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3a,0xe9,0x09,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x3e,0xf3,0x16,0x00,0x00,0x00,0x00,0x86,0xc0,0x00, + 0x00,0x00,0x00,0x00,0x55,0xd7,0x35,0xe4,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x6f,0x00,0x00,0x00,0x15, + 0x46,0x00,0x00,0x00,0x00,0xd0,0x56,0x00,0x79,0xa9,0x00,0x00,0x00,0x00,0x00,0x61, + 0xff,0x7d,0x00,0x00,0x6b,0xf1,0x5c,0x05,0x00,0x03,0x4c,0xe9,0x84,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6d,0xf1,0x5c,0x05,0x00, + 0x03,0x4c,0xe9,0x84,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x1b,0xf0,0x44, + 0x00,0x00,0x15,0x47,0x02,0x00,0x00,0x15,0xb7,0x7b,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x00,0xc4,0xb7,0x14,0x00,0x00,0x4f,0xf5,0x4a,0x00, + 0x00,0x00,0x00,0x00,0x04,0xe1,0xd3,0x7b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x79,0xff,0xff,0xff,0xff,0xff,0xff,0x34,0x00,0xbb,0x64,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc4,0x65,0x00,0x79,0xa9,0x00,0x00,0x00,0x00,0x00,0x01, + 0xc4,0x7d,0x00,0x00,0x00,0x41,0xd4,0xf7,0xd4,0xf4,0xde,0x52,0x00,0x00,0x00,0x00, + 0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0xd4,0xf7,0xd4, + 0xf4,0xd5,0x5f,0x00,0x00,0x00,0x00,0x79,0xad,0x00,0x00,0x00,0x00,0x00,0x75,0xcc, + 0x01,0x00,0x33,0xda,0xee,0xc9,0xd9,0xdc,0x99,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 0xee,0x38,0x00,0x00,0x00,0x00,0x00,0x13,0xaf,0xf6,0xd5,0xe7,0xeb,0x58,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x75,0xf7,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x35,0x15,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x94, + 0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1b,0x38,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x32,0x1f,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12, + 0xd6,0xa9,0x37,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x0a,0x75,0xce,0xf0,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x3e,0xa4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0xb1, + 0x00,0x18,0xba,0x29,0x00,0x00,0x00,0x00,0x07,0xac,0x40,0x00,0x77,0x85,0x00,0x00, + 0x00,0x00,0x00,0x07,0xb2,0x32,0x00,0x06,0xbe,0xbe,0xbe,0xbe,0xbe,0xbe,0xbe,0x7a, + 0x00,0x15,0x45,0x45,0x45,0x08,0x00,0x18,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3c,0x45,0x45,0x27,0x00,0x00,0x00,0x07,0xb1,0x65,0x00,0x00,0x00,0x00,0x12,0xcf, + 0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0x51,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x1c, + 0xc9,0xea,0xe5,0xad,0x20,0x00,0x00,0x02,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x1e,0xa5,0xde,0xea,0xc5,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x2c,0xfc,0x09,0x00,0x00,0x00,0x00,0x39,0x1d,0x00,0x00,0x00,0x00,0x62,0xc5, + 0x00,0x00,0x81,0xc9,0x04,0x00,0x00,0x00,0x87,0xbb,0x01,0x00,0x28,0xf8,0x29,0x00, + 0x00,0x00,0x00,0x6f,0xc4,0x01,0x00,0x02,0x41,0x41,0x41,0x41,0x41,0x49,0xe8,0x72, + 0x00,0x4e,0xe4,0x93,0x93,0x11,0x00,0x20,0xee,0x07,0x00,0x00,0x00,0x00,0x00,0x00, + 0x7f,0x93,0xc8,0x8f,0x00,0x00,0x00,0x75,0xae,0xe3,0x14,0x00,0x00,0x00,0x03,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0d,0x00,0xae,0x6d,0x00,0x00,0x00,0x00,0x09, + 0x35,0x12,0x1b,0x8f,0xd4,0x03,0x00,0x89,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1f,0xeb,0xb4,0x47,0x13,0x3e,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x05,0xf9,0x33,0x00,0x00,0x00,0x05,0xec,0x96,0x00,0x00,0x00,0x00,0x94,0x96, + 0x00,0x00,0x05,0xcd,0x78,0x00,0x00,0x37,0xec,0x1d,0x00,0x00,0x00,0x95,0xa9,0x00, + 0x00,0x00,0x0c,0xe7,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa4,0xaa,0x01, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0xc4,0x51,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x14,0xe3,0x19,0x7d,0x93,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0xe0,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x05,0xef,0x2b,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xa3,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xd2,0x62,0x00,0x00,0x00,0x47,0xee,0xe7,0x02,0x00,0x00,0x00,0xc7,0x66, + 0x00,0x00,0x00,0x2c,0xf1,0x2b,0x08,0xd6,0x5d,0x00,0x00,0x00,0x00,0x15,0xee,0x35, + 0x00,0x00,0x81,0xa2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0xd9,0x0d,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x6b,0xab,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x92,0x7e,0x00,0x0a,0xdf,0x27,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x16,0xc2,0x3d,0x00,0x00,0x00, + 0x03,0x27,0x3b,0x24,0xd7,0x44,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xe6,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x9f,0x96,0x00,0x00,0x00,0x9c,0x7a,0xe1,0x3e,0x00,0x00,0x04,0xf5,0x31, + 0x00,0x00,0x00,0x00,0x75,0xcb,0x8e,0xad,0x00,0x00,0x00,0x00,0x00,0x00,0x69,0xcd, + 0x03,0x23,0xe7,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0xee,0x2f,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x16,0xf2,0x0e,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x26,0xe0,0x0b,0x00,0x00,0x61,0xb0,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x45, + 0xde,0xd0,0xb7,0xce,0xfc,0x45,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0xfe,0x2b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x6a,0xca,0x00,0x00,0x05,0xec,0x22,0x8d,0x92,0x00,0x00,0x2d,0xf5,0x05, + 0x00,0x00,0x00,0x00,0x03,0xcb,0xf2,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xc7, + 0x6e,0xb5,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xd0,0x6d,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0xb7,0x60,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0xaf,0x62,0x00,0x00,0x00,0x02,0xd0,0x3f,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xf0, + 0x54,0x00,0x00,0x00,0xd4,0x45,0x00,0x8a,0xb6,0xa9,0xdd,0xd7,0x9c,0x15,0x00,0x00, + 0x00,0xf0,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x34,0xf9,0x09,0x00,0x48,0xc6,0x00,0x33,0xe4,0x03,0x00,0x66,0xc3,0x00, + 0x00,0x00,0x00,0x00,0x1e,0xeb,0xe9,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2e, + 0xf4,0xc9,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x87,0xb9,0x01,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x5e,0xba,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x31,0x03,0x00,0x00,0x00,0x00,0x26,0x0d,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0xfc, + 0x04,0x00,0x00,0x00,0xd4,0x45,0x00,0x8a,0xdb,0x56,0x19,0x2e,0x95,0xe3,0x11,0x00, + 0x00,0xbf,0x79,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x04,0xf0,0x41,0x00,0xa7,0x6a,0x00,0x00,0xd6,0x4a,0x00,0xa5,0x84,0x00, + 0x00,0x00,0x00,0x02,0xbd,0x79,0x49,0xe9,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xc0,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0xec,0x1c,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0xf3,0x18,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0xf1, + 0x58,0x00,0x00,0x00,0xd4,0x45,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xb4,0x83,0x00, + 0x00,0x42,0xef,0x4c,0x01,0x00,0x0b,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xb2,0x7f,0x12,0xef,0x12,0x00,0x00,0x76,0xaf,0x00,0xe4,0x41,0x00, + 0x00,0x00,0x00,0x6f,0xc7,0x03,0x00,0x9b,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xbe,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xcf,0x66,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xaa,0x6e,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4b, + 0xe4,0xdf,0xce,0xdb,0xf0,0x39,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x5b,0xc7,0x00, + 0x00,0x00,0x50,0xe1,0xf1,0xda,0xee,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x6d,0xc7,0x6c,0xa2,0x00,0x00,0x00,0x17,0xf6,0x3e,0xf4,0x08,0x00, + 0x00,0x00,0x1c,0xed,0x29,0x00,0x00,0x0f,0xe4,0x52,0x00,0x00,0x00,0x00,0x00,0x00, + 0xbe,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xc3,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x51,0xc8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x1f,0x2c,0x1a,0x01,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x44,0xe8,0x00, + 0x00,0x00,0x00,0x00,0x15,0x23,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x1c,0xfb,0xd9,0x3a,0x00,0x00,0x00,0x00,0xaa,0xd7,0xad,0x00,0x00, + 0x00,0x00,0xa8,0x82,0x00,0x00,0x00,0x00,0x53,0xdf,0x09,0x00,0x00,0x00,0x00,0x00, + 0xbe,0x68,0x00,0x00,0x00,0x00,0x00,0x12,0xec,0x32,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xef,0x23,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x80,0xcd,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xc6,0xd0,0x00,0x00,0x00,0x00,0x00,0x3e,0xff,0x5c,0x00,0x00, + 0x00,0x40,0xe4,0x0a,0x00,0x00,0x00,0x00,0x00,0xbd,0x80,0x00,0x00,0x00,0x00,0x00, + 0xbe,0x68,0x00,0x00,0x00,0x00,0x00,0x59,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcf, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9e,0x7d,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xd3,0x96,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0xd6,0x00,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x26,0x8e,0xf0,0x19,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xe7,0x31,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0xf4,0xdc,0xd5,0xfd,0xc8,0x2d,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x91,0x8b,0x00,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x1d,0x2d,0x0f,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0xe3,0x02,0x00, + 0x00,0x00,0x7d,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x4e,0xec,0xb6,0xb6,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xdc,0x40,0x00, + 0x9d,0xb6,0xda,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0b,0x23,0x23,0x23,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x10,0x00, + 0x1e,0x23,0x23,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0c,0x00,0x00,0x00,0x24,0xae,0xe4, + 0xa9,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x14,0x11,0x00,0x00,0x00,0x00,0x17,0x98, + 0xd1,0xe4,0xce,0xa5,0x20,0x00,0x02,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14, + 0x14,0x00,0x00,0x00,0x00,0x14,0x14,0x00,0x02,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x02,0x0e,0x00,0x00,0x48,0xb3,0xd3,0xe5,0xa4,0x3e,0x2f,0xa4,0xdd,0xdb,0xa5, + 0x17,0x00,0x00,0x48,0xb1,0xd2,0xe6,0xcf,0x8e,0x09,0x00,0x00,0x00,0x00,0x1b,0xa3, + 0xdf,0xd8,0x94,0x0e,0x00,0x00,0x49,0xb7,0xd7,0xe7,0xc5,0x80,0x08,0x00,0x00,0x00, + 0x00,0x11,0x8f,0xcb,0xe7,0xd4,0xb1,0x37,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xab,0x6c,0x00,0x00,0x1f,0xed,0x72,0x18, + 0x55,0xd2,0x8a,0x00,0x00,0x00,0x56,0xbc,0xe7,0xec,0x4e,0x00,0x00,0x1d,0xe9,0x93, + 0x30,0x18,0x2f,0xe3,0x41,0x00,0x89,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb6, + 0xb6,0x00,0x00,0x00,0x00,0xb6,0xb6,0x00,0x89,0x8f,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8d,0x8a,0x00,0x00,0x8a,0xab,0x24,0x18,0x43,0xe0,0xe3,0x5f,0x20,0x29,0xa4, + 0xc8,0x00,0x00,0x8a,0xac,0x25,0x17,0x35,0xbd,0xab,0x00,0x00,0x00,0x1b,0xea,0xb6, + 0x3e,0x4d,0xc7,0xd6,0x09,0x00,0x8a,0xac,0x25,0x1c,0x6c,0xd3,0xcf,0x07,0x00,0x00, + 0x15,0xe3,0xc8,0x60,0x19,0x29,0xc3,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0xa5,0x8c,0x00,0x00, + 0x00,0x46,0xf7,0x0d,0x00,0x0a,0xf1,0x45,0x03,0x01,0x04,0x00,0x00,0xa4,0xa1,0x00, + 0x00,0x00,0x00,0xd8,0x41,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33, + 0x33,0x00,0x00,0x00,0x00,0x33,0x33,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x68,0xbf,0x00,0x00,0x00,0x11, + 0xfb,0x1f,0x00,0x8a,0x8f,0x00,0x00,0x00,0x1d,0xfa,0x18,0x00,0x00,0x9f,0xb8,0x00, + 0x00,0x00,0x00,0xdb,0x78,0x00,0x8a,0x8f,0x00,0x00,0x00,0x03,0xe8,0x78,0x00,0x00, + 0x9b,0xcd,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0xe3,0x4b,0x16,0x16, + 0x16,0x1c,0xf5,0x2f,0x00,0x4d,0xc5,0x00,0x00,0x00,0x00,0x00,0x00,0xe9,0x3e,0x00, + 0x00,0x00,0x00,0xd8,0x41,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x3d,0xe0,0x00,0x00,0x00,0x00, + 0xe2,0x3a,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xe4,0x3a,0x00,0x00,0xe4,0x6e,0x00, + 0x00,0x00,0x00,0x90,0xbf,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x98,0xc1,0x00,0x00, + 0xe2,0x79,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x08,0xfe,0xdd,0xd8,0xd8, + 0xd8,0xd8,0xd8,0x3a,0x00,0x87,0x92,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x24,0x00, + 0x00,0x00,0x00,0xd8,0x41,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69, + 0x6d,0x00,0x00,0x00,0x00,0x69,0x6d,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x31,0xe9,0x00,0x00,0x00,0x00, + 0xd5,0x45,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xd2,0x49,0x00,0x08,0xfe,0x2e,0x00, + 0x00,0x00,0x00,0x50,0xe3,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x4b,0xe7,0x00,0x08, + 0xfe,0x2d,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x22,0xa8,0xdd,0xd8,0x9d,0xc7,0x6c,0x00,0x00,0xf3,0x4f,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x8a,0xe4,0xc2,0xc2,0xc2,0x10,0x00,0x00,0xe3,0x45,0x00, + 0x00,0x00,0x00,0xd8,0x41,0x00,0x8a,0xcf,0xc2,0xe4,0xce,0x8e,0x0a,0x00,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x8a,0x8f,0x00,0x00,0x0d,0xad,0x43,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x30,0xe9,0x00,0x00,0x00,0x00, + 0xd4,0x45,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x00,0xee,0x5b,0x00, + 0x00,0x00,0x00,0x7e,0xca,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x50,0xd2,0x00,0x00, + 0xf2,0x32,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x24,0xed,0x7f,0x28,0x1d,0x62,0xe8,0x6c,0x00,0x00,0xc3,0xa2,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x8a,0xa2,0x2b,0x2b,0x2b,0x04,0x00,0x00,0xa3,0xaf,0x00, + 0x00,0x00,0x00,0xd9,0x41,0x00,0x8a,0xba,0x37,0x18,0x35,0xbd,0xae,0x00,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x8a,0x8f,0x00,0x09,0xbd,0x7e,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x30,0xe9,0x00,0x00,0x00,0x00, + 0xd4,0x45,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x00,0xba,0xa5,0x00, + 0x00,0x00,0x00,0xc8,0x94,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x93,0xa0,0x00,0x00, + 0xc2,0x74,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xa5,0x95,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x46,0xf1,0x75,0x1b, + 0x00,0x03,0x18,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0xe1,0xb6, + 0x62,0x6e,0xb6,0xff,0x41,0x00,0x8a,0x8f,0x00,0x00,0x00,0x1d,0xfb,0x18,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x8a,0x8f,0x08,0xb8,0x85,0x00,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x30,0xe9,0x00,0x00,0x00,0x00, + 0xd4,0x45,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x00,0x36,0xf2,0x77, + 0x0f,0x18,0x87,0xf1,0x1a,0x00,0x8a,0xbf,0x18,0x00,0x00,0x4f,0xf2,0x28,0x00,0x00, + 0x44,0xeb,0x39,0x00,0x00,0x22,0xd4,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xe8,0x3d,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x4d,0xdd,0xfc, + 0xdb,0xf2,0x7a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x6f, + 0x9e,0x9c,0x55,0xde,0x3d,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xe4,0x3a,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x8a,0x97,0xb6,0x88,0x00,0x00,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x30,0xe9,0x00,0x00,0x00,0x00, + 0xd4,0x45,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x00,0x00,0x48,0xe3, + 0xf0,0xf7,0xd4,0x32,0x00,0x00,0x8a,0xd3,0xe7,0xd5,0xea,0xdd,0x40,0x00,0x00,0x00, + 0x00,0x56,0xe8,0xe4,0xd9,0xdf,0xdc,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x08,0xff,0x25,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x10, + 0x25,0x09,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x27,0xff,0x1c,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xd2,0x49,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x8a,0xdf,0xf4,0x38,0x00,0x00,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x1e,0x17,0x00,0x00,0x00,0x00,0x8a,0x8f,0x02,0x20,0x19,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x1f,0x1b,0x01,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xed,0x62,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x09,0x00, + 0x00,0x1f,0x9e,0xcc,0x01,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x8a,0x8f,0x4f,0xed,0x48,0x00,0x00,0x00, + 0x00,0x8f,0x8a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xb8,0xb5,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0xf2,0xd8, + 0xdc,0xd3,0x8e,0x22,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x8a,0x8f,0x00,0x3e,0xed,0x3b,0x00,0x00, + 0x00,0x8e,0x8b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xad,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x31,0xf6,0x7f,0x1c,0x00,0x00,0xae,0x6c,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x22, + 0x18,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x8a, + 0x8f,0x00,0x00,0x00,0x00,0x8a,0x8e,0x00,0x8a,0x8f,0x00,0x00,0x52,0xe7,0x1d,0x00, + 0x00,0x7b,0xab,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x3f,0xd8,0xfc,0xd2,0xe0,0xf1,0x55,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0xcf,0x49,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xa6,0x69,0x00,0x8a,0x8f,0x00,0x00,0x00,0x92,0xbc,0x01, + 0x00,0x1f,0xdf,0xa9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x13,0x2d,0x1a,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1c,0xe0,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x03,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x03,0xd1,0xe1,0x86,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x1e,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x3d,0xac,0xd3,0xe8,0xd1,0x0b,0x00,0x00,0x2a,0x91,0xdc,0xe5,0xbd,0x0a,0x00, + 0x3e,0x3e,0x00,0x00,0x00,0x00,0x00,0x7d,0x59,0x00,0x00,0x00,0x00,0xb2,0x24,0x00, + 0x6b,0x76,0x00,0x00,0x00,0x00,0x4f,0x86,0x00,0x62,0x7e,0x00,0x00,0x00,0x01,0xb6, + 0x24,0x00,0x00,0x00,0x54,0x7c,0x00,0x17,0xbc,0x26,0x00,0x00,0x00,0x92,0x57,0x00, + 0x6b,0x77,0x00,0x00,0x00,0x00,0x6a,0x6a,0x00,0x14,0xc2,0xc2,0xc2,0xc2,0xc2,0xaf, + 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x07,0x00,0x15,0x34,0x00,0x0d,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x15,0x1a,0x00,0x00,0x00,0x01,0x00,0x00,0x1c,0xb6,0xb6,0xb6, + 0xb6,0xb6,0xb6,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0xab,0x1f,0x13,0x2a,0x00,0x00,0x00,0xc2,0x66,0x0a,0x16,0x44,0x00,0x00, + 0x9c,0x7d,0x00,0x00,0x00,0x00,0x00,0xa4,0x75,0x00,0x00,0x00,0x00,0xe9,0x30,0x00, + 0x4d,0xd4,0x00,0x00,0x00,0x00,0xa3,0x6f,0x00,0x41,0xda,0x00,0x00,0x00,0x27,0xff, + 0x5f,0x00,0x00,0x00,0xa5,0x63,0x00,0x00,0x7b,0xc6,0x03,0x00,0x5c,0xd0,0x06,0x00, + 0x4d,0xd8,0x00,0x00,0x00,0x00,0xc1,0x51,0x00,0x04,0x2b,0x2b,0x2b,0x2d,0xcd,0x96, + 0x00,0x00,0x00,0x00,0x11,0xba,0xd8,0x35,0x00,0x4e,0xbe,0x00,0xb0,0xdc,0x48,0x00, + 0x00,0x00,0x00,0x71,0xdc,0xde,0xb6,0x21,0x00,0x60,0x8a,0x00,0x27,0xbc,0x23,0x23, + 0x23,0x23,0x53,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x1c,0xfa,0x04,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x7d,0x00,0x00,0x00,0x00,0x00,0xa4,0x75,0x00,0x00,0x00,0x00,0xe9,0x30,0x00, + 0x0b,0xf6,0x1c,0x00,0x00,0x02,0xe8,0x25,0x00,0x06,0xf2,0x1d,0x00,0x00,0x6a,0xe9, + 0x9d,0x00,0x00,0x01,0xe5,0x1b,0x00,0x00,0x03,0xc6,0x76,0x1c,0xe7,0x2d,0x00,0x00, + 0x0b,0xf5,0x26,0x00,0x00,0x07,0xf4,0x11,0x00,0x00,0x00,0x00,0x00,0x7e,0xc1,0x05, + 0x00,0x00,0x00,0x00,0x78,0xaa,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x46,0xdb,0x00, + 0x00,0x00,0x0a,0xdb,0x0c,0x02,0x69,0xe5,0xc0,0xdb,0x21,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x02,0xd4,0xa4,0x1b,0x00,0x00,0x00,0x00, + 0x9c,0xe0,0xc2,0xc2,0xbf,0x00,0x00,0xa4,0x75,0x00,0x00,0x00,0x00,0xe9,0x30,0x00, + 0x00,0xad,0x6b,0x00,0x00,0x3c,0xce,0x00,0x00,0x00,0xb1,0x67,0x00,0x00,0xb1,0x67, + 0xe4,0x01,0x00,0x31,0xd1,0x00,0x00,0x00,0x00,0x25,0xec,0xc9,0x75,0x00,0x00,0x00, + 0x00,0xa8,0x7b,0x00,0x00,0x3e,0xcc,0x00,0x00,0x00,0x00,0x00,0x41,0xe4,0x19,0x00, + 0x00,0x00,0x00,0x00,0x9e,0x70,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x08,0xfe,0x06, + 0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x2e,0x0a,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x16,0x99,0xf2,0xa7,0x26,0x00,0x00, + 0x9c,0x93,0x2b,0x2b,0x2a,0x00,0x00,0xa4,0x75,0x00,0x00,0x00,0x00,0xe9,0x30,0x00, + 0x00,0x56,0xc1,0x00,0x00,0x91,0x75,0x00,0x00,0x00,0x6a,0xb5,0x00,0x0a,0xe7,0x08, + 0xd7,0x32,0x00,0x7d,0x88,0x00,0x00,0x00,0x00,0x00,0xb2,0xfc,0x24,0x00,0x00,0x00, + 0x00,0x4d,0xd9,0x01,0x00,0x81,0x8a,0x00,0x00,0x00,0x00,0x13,0xe4,0x44,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa4,0x69,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x01,0xff,0x0d, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x84,0xf1,0x2b,0x00, + 0x9c,0x7d,0x00,0x00,0x00,0x00,0x00,0x9b,0x84,0x00,0x00,0x00,0x00,0xe9,0x30,0x00, + 0x00,0x08,0xec,0x22,0x05,0xe4,0x19,0x00,0x00,0x00,0x17,0xf4,0x11,0x51,0xa7,0x00, + 0x84,0x84,0x00,0xd1,0x31,0x00,0x00,0x00,0x00,0x50,0xd4,0x80,0xc8,0x04,0x00,0x00, + 0x00,0x04,0xe1,0x40,0x00,0xc9,0x3c,0x00,0x00,0x00,0x00,0xab,0x8e,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa4,0x68,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0xff,0x0d, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa6,0x7f,0x00, + 0x9c,0x7d,0x00,0x00,0x00,0x00,0x00,0x7f,0xab,0x00,0x00,0x00,0x00,0xe9,0x30,0x00, + 0x00,0x00,0x8f,0x86,0x52,0xad,0x00,0x00,0x00,0x00,0x00,0xad,0x66,0xa8,0x50,0x00, + 0x2d,0xdc,0x2c,0xcd,0x00,0x00,0x00,0x00,0x16,0xe4,0x2f,0x02,0xc3,0x7d,0x00,0x00, + 0x00,0x00,0x77,0xad,0x1a,0xdd,0x01,0x00,0x00,0x00,0x57,0xda,0x08,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa4,0x64,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0xfc,0x0d, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x05,0x14,0x00,0x00,0x10,0xe4,0x39,0x00, + 0x9c,0x7d,0x00,0x00,0x00,0x00,0x00,0x27,0xf7,0x3f,0x00,0x00,0x02,0xeb,0x30,0x00, + 0x00,0x00,0x25,0xea,0xc8,0x42,0x00,0x00,0x00,0x00,0x00,0x49,0xd3,0xe2,0x06,0x00, + 0x00,0xce,0xc6,0x6a,0x00,0x00,0x00,0x00,0x9f,0x81,0x00,0x00,0x24,0xef,0x27,0x00, + 0x00,0x00,0x10,0xed,0x92,0x86,0x00,0x00,0x00,0x0c,0xe3,0x45,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xc0,0x49,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0xe3,0x26, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x8a,0x8f,0x00,0x00,0x00,0x00,0x00,0x2d,0xf2,0xd7,0xd5,0xdf,0x8c,0x00,0x00, + 0x9b,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x5b,0xeb,0xe6,0xdc,0xf1,0xda,0x22,0x00, + 0x00,0x00,0x00,0xae,0xcf,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xe1,0x8d,0x00,0x00, + 0x00,0x68,0xf6,0x10,0x00,0x00,0x00,0x3b,0xdc,0x08,0x00,0x00,0x00,0x7e,0xb3,0x00, + 0x00,0x00,0x00,0x7f,0xff,0x2c,0x00,0x00,0x00,0x58,0xfe,0xee,0xee,0xee,0xee,0xee, + 0x0c,0x00,0x17,0x8c,0xd4,0x09,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0x76,0xc9, + 0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x20,0x21,0x00,0x00,0x00,0x00, + 0x8a,0x8e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x1d,0x08,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x53,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x26,0xc3,0xaf,0x02,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0x4e,0xe4, + 0x67,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x5c,0xd5,0x0b,0x00,0x0f,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x17,0xd9,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x02,0xd3,0x3d,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0xd7,0x3b, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0xb5,0xef,0xd9,0xec,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xc2,0xc7,0xe5,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa5,0x60,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0xf9,0x0e, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xb1,0x00,0x00, + 0x00,0x00,0x38,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x14,0x24,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x14,0x25,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa4,0x68,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0xff,0x0d, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xf3,0xd8,0xd8, + 0xd8,0xd8,0xe1,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa4,0x68,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x00,0xff,0x0d, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xa1,0x6d,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x05,0xff,0x09, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x87,0x8f,0x00,0x00,0x00,0x4e,0xbe,0x00,0x00,0x2a,0xeb,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x24,0xe1,0xa3,0x26,0x00,0x4e,0xbe,0x00,0x80,0xd9,0x71,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x0c,0x3c,0x16,0x00,0x0b,0x1a,0x00,0x3e,0x20,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +]; + diff --git a/gfx/webrender/src/debug_render.rs b/gfx/webrender/src/debug_render.rs new file mode 100644 index 000000000000..02f1aa965a7b --- /dev/null +++ b/gfx/webrender/src/debug_render.rs @@ -0,0 +1,219 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use debug_font_data; +use device::{Device, GpuMarker, ProgramId, VAOId, TextureId, VertexFormat}; +use device::{TextureFilter, VertexUsageHint, TextureTarget}; +use euclid::{Matrix4D, Point2D, Size2D, Rect}; +use internal_types::{ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE, TextureSampler}; +use internal_types::{DebugFontVertex, DebugColorVertex, RenderTargetMode, PackedColor}; +use std::f32; +use webrender_traits::{ColorF, ImageFormat, DeviceUintSize}; + +pub struct DebugRenderer { + font_vertices: Vec, + font_indices: Vec, + font_program_id: ProgramId, + font_vao: VAOId, + font_texture_id: TextureId, + + tri_vertices: Vec, + tri_indices: Vec, + tri_vao: VAOId, + line_vertices: Vec, + line_vao: VAOId, + color_program_id: ProgramId, +} + +impl DebugRenderer { + pub fn new(device: &mut Device) -> DebugRenderer { + let font_program_id = device.create_program("debug_font", "shared_other"); + let color_program_id = device.create_program("debug_color", "shared_other"); + + let font_vao = device.create_vao(VertexFormat::DebugFont, 32); + let line_vao = device.create_vao(VertexFormat::DebugColor, 32); + let tri_vao = device.create_vao(VertexFormat::DebugColor, 32); + + let font_texture_id = device.create_texture_ids(1, TextureTarget::Default)[0]; + device.init_texture(font_texture_id, + debug_font_data::BMP_WIDTH, + debug_font_data::BMP_HEIGHT, + ImageFormat::A8, + TextureFilter::Linear, + RenderTargetMode::None, + Some(&debug_font_data::FONT_BITMAP)); + + DebugRenderer { + font_vertices: Vec::new(), + font_indices: Vec::new(), + line_vertices: Vec::new(), + tri_vao: tri_vao, + tri_vertices: Vec::new(), + tri_indices: Vec::new(), + font_program_id: font_program_id, + color_program_id: color_program_id, + font_vao: font_vao, + line_vao: line_vao, + font_texture_id: font_texture_id, + } + } + + pub fn line_height(&self) -> f32 { + debug_font_data::FONT_SIZE as f32 * 1.1 + } + + pub fn add_text(&mut self, + x: f32, + y: f32, + text: &str, + color: &ColorF) -> Rect { + let mut x_start = x; + let ipw = 1.0 / debug_font_data::BMP_WIDTH as f32; + let iph = 1.0 / debug_font_data::BMP_HEIGHT as f32; + let color = PackedColor::from_color(color); + + let mut min_x = f32::MAX; + let mut max_x = -f32::MAX; + let mut min_y = f32::MAX; + let mut max_y = -f32::MAX; + + for c in text.chars() { + let c = c as usize - debug_font_data::FIRST_GLYPH_INDEX as usize; + if c < debug_font_data::GLYPHS.len() { + let glyph = &debug_font_data::GLYPHS[c]; + + let x0 = (x_start + glyph.xo + 0.5).floor(); + let y0 = (y + glyph.yo + 0.5).floor(); + + let x1 = x0 + glyph.x1 as f32 - glyph.x0 as f32; + let y1 = y0 + glyph.y1 as f32 - glyph.y0 as f32; + + let s0 = glyph.x0 as f32 * ipw; + let t0 = glyph.y0 as f32 * iph; + let s1 = glyph.x1 as f32 * ipw; + let t1 = glyph.y1 as f32 * iph; + + x_start += glyph.xa; + + let vertex_count = self.font_vertices.len() as u32; + + self.font_vertices.push(DebugFontVertex::new(x0, y0, s0, t0, color)); + self.font_vertices.push(DebugFontVertex::new(x1, y0, s1, t0, color)); + self.font_vertices.push(DebugFontVertex::new(x0, y1, s0, t1, color)); + self.font_vertices.push(DebugFontVertex::new(x1, y1, s1, t1, color)); + + self.font_indices.push(vertex_count + 0); + self.font_indices.push(vertex_count + 1); + self.font_indices.push(vertex_count + 2); + self.font_indices.push(vertex_count + 2); + self.font_indices.push(vertex_count + 1); + self.font_indices.push(vertex_count + 3); + + min_x = min_x.min(x0); + max_x = max_x.max(x1); + min_y = min_y.min(y0); + max_y = max_y.max(y1); + } + } + + Rect::new(Point2D::new(min_x, min_y), Size2D::new(max_x-min_x, max_y-min_y)) + } + + pub fn add_quad(&mut self, + x0: f32, + y0: f32, + x1: f32, + y1: f32, + color_top: &ColorF, + color_bottom: &ColorF) { + let color_top = PackedColor::from_color(color_top); + let color_bottom = PackedColor::from_color(color_bottom); + let vertex_count = self.tri_vertices.len() as u32; + + self.tri_vertices.push(DebugColorVertex::new(x0, y0, color_top)); + self.tri_vertices.push(DebugColorVertex::new(x1, y0, color_top)); + self.tri_vertices.push(DebugColorVertex::new(x0, y1, color_bottom)); + self.tri_vertices.push(DebugColorVertex::new(x1, y1, color_bottom)); + + self.tri_indices.push(vertex_count + 0); + self.tri_indices.push(vertex_count + 1); + self.tri_indices.push(vertex_count + 2); + self.tri_indices.push(vertex_count + 2); + self.tri_indices.push(vertex_count + 1); + self.tri_indices.push(vertex_count + 3); + } + + #[allow(dead_code)] + pub fn add_line(&mut self, + x0: i32, + y0: i32, + color0: &ColorF, + x1: i32, + y1: i32, + color1: &ColorF) { + let color0 = PackedColor::from_color(color0); + let color1 = PackedColor::from_color(color1); + self.line_vertices.push(DebugColorVertex::new(x0 as f32, y0 as f32, color0)); + self.line_vertices.push(DebugColorVertex::new(x1 as f32, y1 as f32, color1)); + } + + pub fn render(&mut self, + device: &mut Device, + viewport_size: &DeviceUintSize) { + let _gm = GpuMarker::new("debug"); + device.disable_depth(); + device.set_blend(true); + device.set_blend_mode_alpha(); + + let projection = Matrix4D::ortho(0.0, + viewport_size.width as f32, + viewport_size.height as f32, + 0.0, + ORTHO_NEAR_PLANE, + ORTHO_FAR_PLANE); + + // Triangles + if !self.tri_vertices.is_empty() { + device.bind_program(self.color_program_id, &projection); + device.bind_vao(self.tri_vao); + device.update_vao_indices(self.tri_vao, + &self.tri_indices, + VertexUsageHint::Dynamic); + device.update_vao_main_vertices(self.tri_vao, + &self.tri_vertices, + VertexUsageHint::Dynamic); + device.draw_triangles_u32(0, self.tri_indices.len() as i32); + } + + // Lines + if !self.line_vertices.is_empty() { + device.bind_program(self.color_program_id, &projection); + device.bind_vao(self.line_vao); + device.update_vao_main_vertices(self.line_vao, + &self.line_vertices, + VertexUsageHint::Dynamic); + device.draw_nonindexed_lines(0, self.line_vertices.len() as i32); + } + + // Glyph + if !self.font_indices.is_empty() { + device.bind_program(self.font_program_id, &projection); + device.bind_texture(TextureSampler::Color0, self.font_texture_id); + device.bind_vao(self.font_vao); + device.update_vao_indices(self.font_vao, + &self.font_indices, + VertexUsageHint::Dynamic); + device.update_vao_main_vertices(self.font_vao, + &self.font_vertices, + VertexUsageHint::Dynamic); + device.draw_triangles_u32(0, self.font_indices.len() as i32); + } + + self.font_indices.clear(); + self.font_vertices.clear(); + self.line_vertices.clear(); + self.tri_vertices.clear(); + self.tri_indices.clear(); + } +} diff --git a/gfx/webrender/src/device.rs b/gfx/webrender/src/device.rs new file mode 100644 index 000000000000..74880e40ed3a --- /dev/null +++ b/gfx/webrender/src/device.rs @@ -0,0 +1,1965 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use euclid::Matrix4D; +use fnv::FnvHasher; +use gleam::gl; +use internal_types::{PackedVertex, RenderTargetMode, TextureSampler, DEFAULT_TEXTURE}; +use internal_types::{BlurAttribute, ClearAttribute, ClipAttribute, VertexAttribute}; +use internal_types::{DebugFontVertex, DebugColorVertex}; +//use notify::{self, Watcher}; +use super::shader_source; +use std::collections::HashMap; +use std::fs::File; +use std::hash::BuildHasherDefault; +use std::io::Read; +use std::mem; +use std::path::PathBuf; +//use std::sync::mpsc::{channel, Sender}; +//use std::thread; +use webrender_traits::{ColorF, ImageFormat}; +use webrender_traits::{DeviceIntPoint, DeviceIntRect, DeviceIntSize}; + +#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] +const GL_FORMAT_A: gl::GLuint = gl::RED; + +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +const GL_FORMAT_A: gl::GLuint = gl::ALPHA; + +#[cfg(any(target_os = "windows", all(unix, not(target_os = "android"))))] +const GL_FORMAT_BGRA: gl::GLuint = gl::BGRA; + +#[cfg(target_os = "android")] +const GL_FORMAT_BGRA: gl::GLuint = gl::BGRA_EXT; + +#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] +const SHADER_VERSION: &'static str = "#version 150\n"; + +#[cfg(any(target_arch = "arm", target_arch = "aarch64"))] +const SHADER_VERSION: &'static str = "#version 300 es\n"; + +static SHADER_PREAMBLE: &'static str = "shared"; + +pub type ViewportDimensions = [u32; 2]; + +lazy_static! { + pub static ref MAX_TEXTURE_SIZE: gl::GLint = { + gl::get_integer_v(gl::MAX_TEXTURE_SIZE) + }; +} + +#[repr(u32)] +pub enum DepthFunction { + Less = gl::LESS, +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum TextureTarget { + Default, + Array, +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum TextureFilter { + Nearest, + Linear, +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum VertexFormat { + Triangles, + Rectangles, + DebugFont, + DebugColor, + Clear, + Blur, + Clip, +} + +enum FBOTarget { + Read, + Draw, +} + +fn get_optional_shader_source(shader_name: &str, base_path: &Option) -> Option { + if let Some(ref base) = *base_path { + let shader_path = base.join(&format!("{}.glsl", shader_name)); + if shader_path.exists() { + let mut source = String::new(); + File::open(&shader_path).unwrap().read_to_string(&mut source).unwrap(); + return Some(source); + } + } + + shader_source::SHADERS.get(shader_name).and_then(|s| Some((*s).to_owned())) +} + +fn get_shader_source(shader_name: &str, base_path: &Option) -> String { + get_optional_shader_source(shader_name, base_path) + .expect(&format!("Couldn't get required shader: {}", shader_name)) +} + +pub trait FileWatcherHandler : Send { + fn file_changed(&self, path: PathBuf); +} + +impl VertexFormat { + fn bind(&self, main: VBOId, instance: VBOId, offset: gl::GLuint, instance_stride: gl::GLint) { + main.bind(); + + match *self { + VertexFormat::DebugFont => { + gl::enable_vertex_attrib_array(VertexAttribute::Position as gl::GLuint); + gl::enable_vertex_attrib_array(VertexAttribute::Color as gl::GLuint); + gl::enable_vertex_attrib_array(VertexAttribute::ColorTexCoord as gl::GLuint); + + gl::vertex_attrib_divisor(VertexAttribute::Position as gl::GLuint, 0); + gl::vertex_attrib_divisor(VertexAttribute::Color as gl::GLuint, 0); + gl::vertex_attrib_divisor(VertexAttribute::ColorTexCoord as gl::GLuint, 0); + + let vertex_stride = mem::size_of::() as gl::GLuint; + + gl::vertex_attrib_pointer(VertexAttribute::Position as gl::GLuint, + 2, + gl::FLOAT, + false, + vertex_stride as gl::GLint, + 0 + vertex_stride * offset); + gl::vertex_attrib_pointer(VertexAttribute::Color as gl::GLuint, + 4, + gl::UNSIGNED_BYTE, + true, + vertex_stride as gl::GLint, + 8 + vertex_stride * offset); + gl::vertex_attrib_pointer(VertexAttribute::ColorTexCoord as gl::GLuint, + 2, + gl::FLOAT, + false, + vertex_stride as gl::GLint, + 12 + vertex_stride * offset); + } + VertexFormat::DebugColor => { + gl::enable_vertex_attrib_array(VertexAttribute::Position as gl::GLuint); + gl::enable_vertex_attrib_array(VertexAttribute::Color as gl::GLuint); + + gl::vertex_attrib_divisor(VertexAttribute::Position as gl::GLuint, 0); + gl::vertex_attrib_divisor(VertexAttribute::Color as gl::GLuint, 0); + + let vertex_stride = mem::size_of::() as gl::GLuint; + + gl::vertex_attrib_pointer(VertexAttribute::Position as gl::GLuint, + 2, + gl::FLOAT, + false, + vertex_stride as gl::GLint, + 0 + vertex_stride * offset); + gl::vertex_attrib_pointer(VertexAttribute::Color as gl::GLuint, + 4, + gl::UNSIGNED_BYTE, + true, + vertex_stride as gl::GLint, + 8 + vertex_stride * offset); + } + VertexFormat::Rectangles | + VertexFormat::Triangles => { + let vertex_stride = mem::size_of::() as gl::GLuint; + gl::enable_vertex_attrib_array(VertexAttribute::Position as gl::GLuint); + gl::vertex_attrib_divisor(VertexAttribute::Position as gl::GLuint, 0); + + gl::vertex_attrib_pointer(VertexAttribute::Position as gl::GLuint, + 2, + gl::FLOAT, + false, + vertex_stride as gl::GLint, + 0); + + instance.bind(); + let mut offset = 0; + + for &attrib in [VertexAttribute::GlobalPrimId, + VertexAttribute::PrimitiveAddress, + VertexAttribute::TaskIndex, + VertexAttribute::ClipTaskIndex, + VertexAttribute::LayerIndex, + VertexAttribute::ElementIndex, + VertexAttribute::ZIndex, + ].into_iter() { + gl::enable_vertex_attrib_array(attrib as gl::GLuint); + gl::vertex_attrib_divisor(attrib as gl::GLuint, 1); + gl::vertex_attrib_i_pointer(attrib as gl::GLuint, + 1, + gl::INT, + instance_stride, + offset); + offset += 4; + } + + gl::enable_vertex_attrib_array(VertexAttribute::UserData as gl::GLuint); + gl::vertex_attrib_divisor(VertexAttribute::UserData as gl::GLuint, 1); + gl::vertex_attrib_i_pointer(VertexAttribute::UserData as gl::GLuint, + 2, + gl::INT, + instance_stride, + offset); + } + VertexFormat::Clear => { + let vertex_stride = mem::size_of::() as gl::GLuint; + gl::enable_vertex_attrib_array(ClearAttribute::Position as gl::GLuint); + gl::vertex_attrib_divisor(ClearAttribute::Position as gl::GLuint, 0); + + gl::vertex_attrib_pointer(ClearAttribute::Position as gl::GLuint, + 2, + gl::FLOAT, + false, + vertex_stride as gl::GLint, + 0); + + instance.bind(); + + gl::enable_vertex_attrib_array(ClearAttribute::Rectangle as gl::GLuint); + gl::vertex_attrib_divisor(ClearAttribute::Rectangle as gl::GLuint, 1); + gl::vertex_attrib_i_pointer(ClearAttribute::Rectangle as gl::GLuint, + 4, + gl::INT, + instance_stride, + 0); + } + VertexFormat::Blur => { + let vertex_stride = mem::size_of::() as gl::GLuint; + gl::enable_vertex_attrib_array(BlurAttribute::Position as gl::GLuint); + gl::vertex_attrib_divisor(BlurAttribute::Position as gl::GLuint, 0); + + gl::vertex_attrib_pointer(BlurAttribute::Position as gl::GLuint, + 2, + gl::FLOAT, + false, + vertex_stride as gl::GLint, + 0); + + instance.bind(); + + for (i, &attrib) in [BlurAttribute::RenderTaskIndex, + BlurAttribute::SourceTaskIndex, + BlurAttribute::Direction, + ].into_iter().enumerate() { + gl::enable_vertex_attrib_array(attrib as gl::GLuint); + gl::vertex_attrib_divisor(attrib as gl::GLuint, 1); + gl::vertex_attrib_i_pointer(attrib as gl::GLuint, + 1, + gl::INT, + instance_stride, + (i * 4) as gl::GLuint); + } + } + VertexFormat::Clip => { + let vertex_stride = mem::size_of::() as gl::GLuint; + gl::enable_vertex_attrib_array(ClipAttribute::Position as gl::GLuint); + gl::vertex_attrib_divisor(ClipAttribute::Position as gl::GLuint, 0); + + gl::vertex_attrib_pointer(ClipAttribute::Position as gl::GLuint, + 2, + gl::FLOAT, + false, + vertex_stride as gl::GLint, + 0); + + instance.bind(); + + for (i, &attrib) in [ClipAttribute::RenderTaskIndex, + ClipAttribute::LayerIndex, + ClipAttribute::DataIndex, + ClipAttribute::SegmentIndex, + ].into_iter().enumerate() { + gl::enable_vertex_attrib_array(attrib as gl::GLuint); + gl::vertex_attrib_divisor(attrib as gl::GLuint, 1); + gl::vertex_attrib_i_pointer(attrib as gl::GLuint, + 1, + gl::INT, + instance_stride, + (i * 4) as gl::GLuint); + } + } + } + } +} + +impl TextureId { + pub fn bind(&self) { + gl::bind_texture(self.target, self.name); + } + + pub fn new(name: gl::GLuint) -> TextureId { + TextureId { + name: name, + target: gl::TEXTURE_2D, + } + } + + pub fn invalid() -> TextureId { + TextureId { + name: 0, + target: gl::TEXTURE_2D, + } + } + + pub fn is_valid(&self) -> bool { *self != TextureId::invalid() } +} + +impl ProgramId { + fn bind(&self) { + gl::use_program(self.0); + } +} + +impl VBOId { + fn bind(&self) { + gl::bind_buffer(gl::ARRAY_BUFFER, self.0); + } +} + +impl IBOId { + fn bind(&self) { + gl::bind_buffer(gl::ELEMENT_ARRAY_BUFFER, self.0); + } +} + +impl UBOId { + fn _bind(&self) { + gl::bind_buffer(gl::UNIFORM_BUFFER, self.0); + } +} + +impl FBOId { + fn bind(&self, target: FBOTarget) { + let target = match target { + FBOTarget::Read => gl::READ_FRAMEBUFFER, + FBOTarget::Draw => gl::DRAW_FRAMEBUFFER, + }; + gl::bind_framebuffer(target, self.0); + } +} + +struct Texture { + id: gl::GLuint, + format: ImageFormat, + width: u32, + height: u32, + filter: TextureFilter, + mode: RenderTargetMode, + fbo_ids: Vec, +} + +impl Drop for Texture { + fn drop(&mut self) { + if !self.fbo_ids.is_empty() { + let fbo_ids: Vec<_> = self.fbo_ids.iter().map(|&FBOId(fbo_id)| fbo_id).collect(); + gl::delete_framebuffers(&fbo_ids[..]); + } + gl::delete_textures(&[self.id]); + } +} + +struct Program { + id: gl::GLuint, + u_transform: gl::GLint, + u_device_pixel_ratio: gl::GLint, + name: String, + vs_source: String, + fs_source: String, + prefix: Option, + vs_id: Option, + fs_id: Option, +} + +impl Program { + fn attach_and_bind_shaders(&mut self, + vs_id: gl::GLuint, + fs_id: gl::GLuint, + panic_on_fail: bool) -> bool { + gl::attach_shader(self.id, vs_id); + gl::attach_shader(self.id, fs_id); + + gl::bind_attrib_location(self.id, VertexAttribute::Position as gl::GLuint, "aPosition"); + gl::bind_attrib_location(self.id, VertexAttribute::Color as gl::GLuint, "aColor"); + gl::bind_attrib_location(self.id, VertexAttribute::ColorTexCoord as gl::GLuint, "aColorTexCoord"); + + gl::bind_attrib_location(self.id, VertexAttribute::GlobalPrimId as gl::GLuint, "aGlobalPrimId"); + gl::bind_attrib_location(self.id, VertexAttribute::PrimitiveAddress as gl::GLuint, "aPrimitiveAddress"); + gl::bind_attrib_location(self.id, VertexAttribute::TaskIndex as gl::GLuint, "aTaskIndex"); + gl::bind_attrib_location(self.id, VertexAttribute::ClipTaskIndex as gl::GLuint, "aClipTaskIndex"); + gl::bind_attrib_location(self.id, VertexAttribute::LayerIndex as gl::GLuint, "aLayerIndex"); + gl::bind_attrib_location(self.id, VertexAttribute::ElementIndex as gl::GLuint, "aElementIndex"); + gl::bind_attrib_location(self.id, VertexAttribute::UserData as gl::GLuint, "aUserData"); + gl::bind_attrib_location(self.id, VertexAttribute::ZIndex as gl::GLuint, "aZIndex"); + + gl::bind_attrib_location(self.id, ClearAttribute::Rectangle as gl::GLuint, "aClearRectangle"); + + gl::bind_attrib_location(self.id, BlurAttribute::RenderTaskIndex as gl::GLuint, "aBlurRenderTaskIndex"); + gl::bind_attrib_location(self.id, BlurAttribute::SourceTaskIndex as gl::GLuint, "aBlurSourceTaskIndex"); + gl::bind_attrib_location(self.id, BlurAttribute::Direction as gl::GLuint, "aBlurDirection"); + + gl::bind_attrib_location(self.id, ClipAttribute::RenderTaskIndex as gl::GLuint, "aClipRenderTaskIndex"); + gl::bind_attrib_location(self.id, ClipAttribute::LayerIndex as gl::GLuint, "aClipLayerIndex"); + gl::bind_attrib_location(self.id, ClipAttribute::DataIndex as gl::GLuint, "aClipDataIndex"); + gl::bind_attrib_location(self.id, ClipAttribute::SegmentIndex as gl::GLuint, "aClipSegmentIndex"); + + gl::link_program(self.id); + if gl::get_program_iv(self.id, gl::LINK_STATUS) == (0 as gl::GLint) { + println!("Failed to link shader program: {}", gl::get_program_info_log(self.id)); + gl::detach_shader(self.id, vs_id); + gl::detach_shader(self.id, fs_id); + if panic_on_fail { + panic!("-- Program link failed - exiting --"); + } + false + } else { + //println!("{}", gl::get_program_info_log(self.id)); + true + } + } +} + +impl Drop for Program { + fn drop(&mut self) { + gl::delete_program(self.id); + } +} + +struct VAO { + id: gl::GLuint, + ibo_id: IBOId, + main_vbo_id: VBOId, + instance_vbo_id: VBOId, + instance_stride: gl::GLint, + owns_indices: bool, + owns_vertices: bool, + owns_instances: bool, +} + +impl Drop for VAO { + fn drop(&mut self) { + gl::delete_vertex_arrays(&[self.id]); + + if self.owns_indices { + // todo(gw): maybe make these their own type with hashmap? + gl::delete_buffers(&[self.ibo_id.0]); + } + if self.owns_vertices { + gl::delete_buffers(&[self.main_vbo_id.0]); + } + if self.owns_instances { + gl::delete_buffers(&[self.instance_vbo_id.0]) + } + } +} + +#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Debug, Copy, Clone)] +pub struct TextureId { + name: gl::GLuint, + target: gl::GLuint, +} + +#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)] +pub struct ProgramId(pub gl::GLuint); + +#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)] +pub struct VAOId(gl::GLuint); + +#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)] +pub struct FBOId(gl::GLuint); + +#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)] +pub struct VBOId(gl::GLuint); + +#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)] +struct IBOId(gl::GLuint); + +#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)] +pub struct UBOId(gl::GLuint); + +const MAX_EVENTS_PER_FRAME: usize = 256; +const MAX_PROFILE_FRAMES: usize = 4; + +pub trait NamedTag { + fn get_label(&self) -> &str; +} + +#[derive(Debug, Clone)] +pub struct GpuSample { + pub tag: T, + pub time_ns: u64, +} + +pub struct GpuFrameProfile { + queries: Vec, + samples: Vec>, + next_query: usize, + pending_query: gl::GLuint, +} + +impl GpuFrameProfile { + #[cfg(not(target_os = "android"))] + fn new() -> GpuFrameProfile { + let queries = gl::gen_queries(MAX_EVENTS_PER_FRAME as gl::GLint); + + GpuFrameProfile { + queries: queries, + samples: Vec::new(), + next_query: 0, + pending_query: 0, + } + } + + #[cfg(target_os = "android")] + fn new() -> GpuFrameProfile { + GpuFrameProfile { + queries: Vec::new(), + samples: Vec::new(), + next_query: 0, + pending_query: 0, + } + } + + fn begin_frame(&mut self) { + self.next_query = 0; + self.pending_query = 0; + self.samples.clear(); + } + + #[cfg(not(target_os = "android"))] + fn end_frame(&mut self) { + if self.pending_query != 0 { + gl::end_query(gl::TIME_ELAPSED); + } + } + + #[cfg(target_os = "android")] + fn end_frame(&mut self) { + } + + #[cfg(not(target_os = "android"))] + fn add_marker(&mut self, tag: T) -> GpuMarker + where T: NamedTag { + if self.pending_query != 0 { + gl::end_query(gl::TIME_ELAPSED); + } + + let marker = GpuMarker::new(tag.get_label()); + + if self.next_query < MAX_EVENTS_PER_FRAME { + self.pending_query = self.queries[self.next_query]; + gl::begin_query(gl::TIME_ELAPSED, self.pending_query); + self.samples.push(GpuSample { + tag: tag, + time_ns: 0, + }); + } else { + self.pending_query = 0; + } + + self.next_query += 1; + marker + } + + #[cfg(target_os = "android")] + fn add_marker(&mut self, tag: T) { + self.samples.push(GpuSample { + tag: tag, + time_ns: 0, + }); + } + + fn is_valid(&self) -> bool { + self.next_query <= MAX_EVENTS_PER_FRAME + } + + #[cfg(not(target_os = "android"))] + fn build_samples(&mut self) -> Vec> { + for (index, sample) in self.samples.iter_mut().enumerate() { + sample.time_ns = gl::get_query_object_ui64v(self.queries[index], gl::QUERY_RESULT) + } + + mem::replace(&mut self.samples, Vec::new()) + } + + #[cfg(target_os = "android")] + fn build_samples(&mut self) -> Vec> { + mem::replace(&mut self.samples, Vec::new()) + } +} + +impl Drop for GpuFrameProfile { + #[cfg(not(target_os = "android"))] + fn drop(&mut self) { + gl::delete_queries(&self.queries); + } + + #[cfg(target_os = "android")] + fn drop(&mut self) { + } +} + +pub struct GpuProfiler { + frames: [GpuFrameProfile; MAX_PROFILE_FRAMES], + next_frame: usize, +} + +impl GpuProfiler { + pub fn new() -> GpuProfiler { + GpuProfiler { + next_frame: 0, + frames: [ + GpuFrameProfile::new(), + GpuFrameProfile::new(), + GpuFrameProfile::new(), + GpuFrameProfile::new(), + ], + } + } + + pub fn build_samples(&mut self) -> Option>> { + let frame = &mut self.frames[self.next_frame]; + if frame.is_valid() { + Some(frame.build_samples()) + } else { + None + } + } + + pub fn begin_frame(&mut self) { + let frame = &mut self.frames[self.next_frame]; + frame.begin_frame(); + } + + pub fn end_frame(&mut self) { + let frame = &mut self.frames[self.next_frame]; + frame.end_frame(); + self.next_frame = (self.next_frame + 1) % MAX_PROFILE_FRAMES; + } + + #[cfg(not(target_os = "android"))] + pub fn add_marker(&mut self, tag: T) -> GpuMarker + where T: NamedTag { + self.frames[self.next_frame].add_marker(tag) + } + + #[cfg(target_os = "android")] + pub fn add_marker(&mut self, tag: T) { + self.frames[self.next_frame].add_marker(tag) + } +} + +#[must_use] +pub struct GpuMarker(()); + +#[cfg(any(target_arch="arm", target_arch="aarch64"))] +impl GpuMarker { + pub fn new(_: &str) -> GpuMarker { + GpuMarker(()) + } + + pub fn fire(_: &str) {} +} + + +#[cfg(not(any(target_arch="arm", target_arch="aarch64")))] +impl GpuMarker { + pub fn new(message: &str) -> GpuMarker { + gl::push_group_marker_ext(message); + GpuMarker(()) + } + + pub fn fire(message: &str) { + gl::insert_event_marker_ext(message); + } +} + +#[cfg(not(any(target_arch="arm", target_arch="aarch64")))] +impl Drop for GpuMarker { + fn drop(&mut self) { + gl::pop_group_marker_ext(); + } +} + +#[derive(Debug, Copy, Clone)] +pub enum VertexUsageHint { + Static, + Dynamic, + Stream, +} + +impl VertexUsageHint { + fn to_gl(&self) -> gl::GLuint { + match *self { + VertexUsageHint::Static => gl::STATIC_DRAW, + VertexUsageHint::Dynamic => gl::DYNAMIC_DRAW, + VertexUsageHint::Stream => gl::STREAM_DRAW, + } + } +} + +#[derive(Copy, Clone, Debug)] +pub struct UniformLocation(gl::GLint); + +impl UniformLocation { + pub fn invalid() -> UniformLocation { + UniformLocation(-1) + } +} + +// TODO(gw): Fix up notify cargo deps and re-enable this! +/* +enum FileWatcherCmd { + AddWatch(PathBuf), + Exit, +} + +struct FileWatcherThread { + api_tx: Sender, +} + +impl FileWatcherThread { + fn new(handler: Box) -> FileWatcherThread { + let (api_tx, api_rx) = channel(); + + thread::spawn(move || { + + let (watch_tx, watch_rx) = channel(); + + enum Request { + Watcher(notify::Event), + Command(FileWatcherCmd), + } + + let mut file_watcher: notify::RecommendedWatcher = notify::Watcher::new(watch_tx).unwrap(); + + loop { + let request = { + let receiver_from_api = &api_rx; + let receiver_from_watcher = &watch_rx; + select! { + msg = receiver_from_api.recv() => Request::Command(msg.unwrap()), + msg = receiver_from_watcher.recv() => Request::Watcher(msg.unwrap()) + } + }; + + match request { + Request::Watcher(event) => { + handler.file_changed(event.path.unwrap()); + } + Request::Command(cmd) => { + match cmd { + FileWatcherCmd::AddWatch(path) => { + file_watcher.watch(path).ok(); + } + FileWatcherCmd::Exit => { + break; + } + } + } + } + } + }); + + FileWatcherThread { + api_tx: api_tx, + } + } + + fn exit(&self) { + self.api_tx.send(FileWatcherCmd::Exit).ok(); + } + + fn add_watch(&self, path: PathBuf) { + self.api_tx.send(FileWatcherCmd::AddWatch(path)).ok(); + } +} +*/ + +pub struct Capabilities { + pub max_ubo_size: usize, + pub supports_multisampling: bool, +} + +pub struct Device { + // device state + bound_textures: [TextureId; 16], + bound_program: ProgramId, + bound_vao: VAOId, + bound_read_fbo: FBOId, + bound_draw_fbo: FBOId, + default_read_fbo: gl::GLuint, + default_draw_fbo: gl::GLuint, + device_pixel_ratio: f32, + + // HW or API capabilties + capabilities: Capabilities, + + // debug + inside_frame: bool, + + // resources + resource_override_path: Option, + textures: HashMap>, + programs: HashMap>, + vaos: HashMap>, + + // misc. + shader_preamble: String, + //file_watcher: FileWatcherThread, + + // Used on android only + #[allow(dead_code)] + next_vao_id: gl::GLuint, +} + +impl Device { + pub fn new(resource_override_path: Option, + _file_changed_handler: Box) -> Device { + //let file_watcher = FileWatcherThread::new(file_changed_handler); + + let shader_preamble = get_shader_source(SHADER_PREAMBLE, &resource_override_path); + //file_watcher.add_watch(resource_path); + + Device { + resource_override_path: resource_override_path, + // This is initialized to 1 by default, but it is set + // every frame by the call to begin_frame(). + device_pixel_ratio: 1.0, + inside_frame: false, + + capabilities: Capabilities { + max_ubo_size: gl::get_integer_v(gl::MAX_UNIFORM_BLOCK_SIZE) as usize, + supports_multisampling: false, //TODO + }, + + bound_textures: [ TextureId::invalid(); 16 ], + bound_program: ProgramId(0), + bound_vao: VAOId(0), + bound_read_fbo: FBOId(0), + bound_draw_fbo: FBOId(0), + default_read_fbo: 0, + default_draw_fbo: 0, + + textures: HashMap::with_hasher(Default::default()), + programs: HashMap::with_hasher(Default::default()), + vaos: HashMap::with_hasher(Default::default()), + + shader_preamble: shader_preamble, + + next_vao_id: 1, + //file_watcher: file_watcher, + } + } + + pub fn get_capabilities(&self) -> &Capabilities { + &self.capabilities + } + + pub fn compile_shader(name: &str, + source_str: &str, + shader_type: gl::GLenum, + shader_preamble: &[String], + panic_on_fail: bool) + -> Option { + debug!("compile {:?}", name); + + let mut s = String::new(); + s.push_str(SHADER_VERSION); + for prefix in shader_preamble { + s.push_str(&prefix); + } + s.push_str(source_str); + + let id = gl::create_shader(shader_type); + let mut source = Vec::new(); + source.extend_from_slice(s.as_bytes()); + gl::shader_source(id, &[&source[..]]); + gl::compile_shader(id); + let log = gl::get_shader_info_log(id); + if gl::get_shader_iv(id, gl::COMPILE_STATUS) == (0 as gl::GLint) { + println!("Failed to compile shader: {:?}\n{}", name, log); + if panic_on_fail { + panic!("-- Shader compile failed - exiting --"); + } + + None + } else { + if !log.is_empty() { + println!("Warnings detected on shader: {:?}\n{}", name, log); + } + Some(id) + } + } + + pub fn begin_frame(&mut self, device_pixel_ratio: f32) { + debug_assert!(!self.inside_frame); + self.inside_frame = true; + self.device_pixel_ratio = device_pixel_ratio; + + // Retrive the currently set FBO. + let default_read_fbo = gl::get_integer_v(gl::READ_FRAMEBUFFER_BINDING); + self.default_read_fbo = default_read_fbo as gl::GLuint; + let default_draw_fbo = gl::get_integer_v(gl::DRAW_FRAMEBUFFER_BINDING); + self.default_draw_fbo = default_draw_fbo as gl::GLuint; + + // Texture state + for i in 0..self.bound_textures.len() { + self.bound_textures[i] = TextureId::invalid(); + gl::active_texture(gl::TEXTURE0 + i as gl::GLuint); + gl::bind_texture(gl::TEXTURE_2D, 0); + } + + // Shader state + self.bound_program = ProgramId(0); + gl::use_program(0); + + // Vertex state + self.bound_vao = VAOId(0); + self.clear_vertex_array(); + + // FBO state + self.bound_read_fbo = FBOId(self.default_read_fbo); + self.bound_draw_fbo = FBOId(self.default_draw_fbo); + + // Pixel op state + gl::pixel_store_i(gl::UNPACK_ALIGNMENT, 1); + + // Default is sampler 0, always + gl::active_texture(gl::TEXTURE0); + } + + pub fn bind_texture(&mut self, + sampler: TextureSampler, + texture_id: TextureId) { + debug_assert!(self.inside_frame); + + let sampler_index = sampler as usize; + if self.bound_textures[sampler_index] != texture_id { + self.bound_textures[sampler_index] = texture_id; + gl::active_texture(gl::TEXTURE0 + sampler_index as gl::GLuint); + texture_id.bind(); + gl::active_texture(gl::TEXTURE0); + } + } + + pub fn bind_read_target(&mut self, texture_id: Option<(TextureId, i32)>) { + debug_assert!(self.inside_frame); + + let fbo_id = texture_id.map_or(FBOId(self.default_read_fbo), |texture_id| { + self.textures.get(&texture_id.0).unwrap().fbo_ids[texture_id.1 as usize] + }); + + if self.bound_read_fbo != fbo_id { + self.bound_read_fbo = fbo_id; + fbo_id.bind(FBOTarget::Read); + } + } + + pub fn bind_draw_target(&mut self, + texture_id: Option<(TextureId, i32)>, + dimensions: Option) { + debug_assert!(self.inside_frame); + + let fbo_id = texture_id.map_or(FBOId(self.default_draw_fbo), |texture_id| { + self.textures.get(&texture_id.0).unwrap().fbo_ids[texture_id.1 as usize] + }); + + if self.bound_draw_fbo != fbo_id { + self.bound_draw_fbo = fbo_id; + fbo_id.bind(FBOTarget::Draw); + } + + if let Some(dimensions) = dimensions { + gl::viewport(0, 0, dimensions[0] as gl::GLint, dimensions[1] as gl::GLint); + } + } + + pub fn bind_program(&mut self, + program_id: ProgramId, + projection: &Matrix4D) { + debug_assert!(self.inside_frame); + + if self.bound_program != program_id { + self.bound_program = program_id; + program_id.bind(); + } + + let program = self.programs.get(&program_id).unwrap(); + self.set_uniforms(program, + projection, + self.device_pixel_ratio); + } + + pub fn create_texture_ids(&mut self, + count: i32, + target: TextureTarget) -> Vec { + let id_list = gl::gen_textures(count); + let mut texture_ids = Vec::new(); + + let target = match target { + TextureTarget::Default => gl::TEXTURE_2D, + TextureTarget::Array => gl::TEXTURE_2D_ARRAY, + }; + + for id in id_list { + let texture_id = TextureId { + name: id, + target: target, + }; + + let texture = Texture { + id: id, + width: 0, + height: 0, + format: ImageFormat::Invalid, + filter: TextureFilter::Nearest, + mode: RenderTargetMode::None, + fbo_ids: vec![], + }; + + debug_assert!(self.textures.contains_key(&texture_id) == false); + self.textures.insert(texture_id, texture); + + texture_ids.push(texture_id); + } + + texture_ids + } + + pub fn get_texture_dimensions(&self, texture_id: TextureId) -> (u32, u32) { + let texture = &self.textures[&texture_id]; + (texture.width, texture.height) + } + + fn set_texture_parameters(&mut self, target: gl::GLuint, filter: TextureFilter) { + let filter = match filter { + TextureFilter::Nearest => { + gl::NEAREST + } + TextureFilter::Linear => { + gl::LINEAR + } + }; + + gl::tex_parameter_i(target, gl::TEXTURE_MAG_FILTER, filter as gl::GLint); + gl::tex_parameter_i(target, gl::TEXTURE_MIN_FILTER, filter as gl::GLint); + + gl::tex_parameter_i(target, gl::TEXTURE_WRAP_S, gl::CLAMP_TO_EDGE as gl::GLint); + gl::tex_parameter_i(target, gl::TEXTURE_WRAP_T, gl::CLAMP_TO_EDGE as gl::GLint); + } + + fn upload_texture_image(&mut self, + target: gl::GLuint, + width: u32, + height: u32, + internal_format: u32, + format: u32, + type_: u32, + pixels: Option<&[u8]>) { + gl::tex_image_2d(target, + 0, + internal_format as gl::GLint, + width as gl::GLint, height as gl::GLint, + 0, + format, + type_, + pixels); + } + + pub fn init_texture(&mut self, + texture_id: TextureId, + width: u32, + height: u32, + format: ImageFormat, + filter: TextureFilter, + mode: RenderTargetMode, + pixels: Option<&[u8]>) { + debug_assert!(self.inside_frame); + + { + let texture = self.textures.get_mut(&texture_id).expect("Didn't find texture!"); + texture.format = format; + texture.width = width; + texture.height = height; + texture.filter = filter; + texture.mode = mode; + } + + let (internal_format, gl_format) = gl_texture_formats_for_image_format(format); + let type_ = gl_type_for_texture_format(format); + + match mode { + RenderTargetMode::SimpleRenderTarget => { + self.bind_texture(DEFAULT_TEXTURE, texture_id); + self.set_texture_parameters(texture_id.target, filter); + self.upload_texture_image(texture_id.target, + width, + height, + internal_format as u32, + gl_format, + type_, + None); + self.create_fbo_for_texture_if_necessary(texture_id, None); + } + RenderTargetMode::LayerRenderTarget(layer_count) => { + self.bind_texture(DEFAULT_TEXTURE, texture_id); + self.set_texture_parameters(texture_id.target, filter); + self.create_fbo_for_texture_if_necessary(texture_id, Some(layer_count)); + } + RenderTargetMode::None => { + self.bind_texture(DEFAULT_TEXTURE, texture_id); + self.set_texture_parameters(texture_id.target, filter); + self.upload_texture_image(texture_id.target, + width, + height, + internal_format as u32, + gl_format, + type_, + pixels); + } + } + } + + pub fn get_render_target_layer_count(&self, texture_id: TextureId) -> usize { + self.textures[&texture_id].fbo_ids.len() + } + + pub fn create_fbo_for_texture_if_necessary(&mut self, + texture_id: TextureId, + layer_count: Option) { + let texture = self.textures.get_mut(&texture_id).unwrap(); + + match layer_count { + Some(layer_count) => { + debug_assert!(layer_count > 0); + + // If we have enough layers allocated already, just use them. + // TODO(gw): Probably worth removing some after a while if + // there is a surplus? + let current_layer_count = texture.fbo_ids.len() as i32; + if current_layer_count >= layer_count { + return; + } + + let (internal_format, gl_format) = gl_texture_formats_for_image_format(texture.format); + let type_ = gl_type_for_texture_format(texture.format); + + gl::tex_image_3d(texture_id.target, + 0, + internal_format as gl::GLint, + texture.width as gl::GLint, + texture.height as gl::GLint, + layer_count, + 0, + gl_format, + type_, + None); + + let needed_layer_count = layer_count - current_layer_count; + let new_fbos = gl::gen_framebuffers(needed_layer_count); + texture.fbo_ids.extend(new_fbos.into_iter().map(|id| FBOId(id))); + + for (fbo_index, fbo_id) in texture.fbo_ids.iter().enumerate() { + gl::bind_framebuffer(gl::FRAMEBUFFER, fbo_id.0); + gl::framebuffer_texture_layer(gl::FRAMEBUFFER, + gl::COLOR_ATTACHMENT0, + texture_id.name, + 0, + fbo_index as gl::GLint); + + // TODO(gw): Share depth render buffer between FBOs to + // save memory! + // TODO(gw): Free these renderbuffers on exit! + let renderbuffer_ids = gl::gen_renderbuffers(1); + let depth_rb = renderbuffer_ids[0]; + gl::bind_renderbuffer(gl::RENDERBUFFER, depth_rb); + gl::renderbuffer_storage(gl::RENDERBUFFER, + gl::DEPTH_COMPONENT24, + texture.width as gl::GLsizei, + texture.height as gl::GLsizei); + gl::framebuffer_renderbuffer(gl::FRAMEBUFFER, + gl::DEPTH_ATTACHMENT, + gl::RENDERBUFFER, + depth_rb); + } + } + None => { + debug_assert!(texture.fbo_ids.len() == 0 || texture.fbo_ids.len() == 1); + if texture.fbo_ids.is_empty() { + let new_fbo = gl::gen_framebuffers(1)[0]; + + gl::bind_framebuffer(gl::FRAMEBUFFER, new_fbo); + + gl::framebuffer_texture_2d(gl::FRAMEBUFFER, + gl::COLOR_ATTACHMENT0, + texture_id.target, + texture_id.name, + 0); + + texture.fbo_ids.push(FBOId(new_fbo)); + } + } + } + + // TODO(gw): Hack! Modify the code above to use the normal binding interfaces the device exposes. + gl::bind_framebuffer(gl::READ_FRAMEBUFFER, self.bound_read_fbo.0); + gl::bind_framebuffer(gl::DRAW_FRAMEBUFFER, self.bound_draw_fbo.0); + } + + pub fn blit_render_target(&mut self, + src_texture: Option<(TextureId, i32)>, + src_rect: Option, + dest_rect: DeviceIntRect) { + debug_assert!(self.inside_frame); + + let src_rect = src_rect.unwrap_or_else(|| { + let texture = self.textures.get(&src_texture.unwrap().0).expect("unknown texture id!"); + DeviceIntRect::new(DeviceIntPoint::zero(), + DeviceIntSize::new(texture.width as gl::GLint, + texture.height as gl::GLint)) + }); + + self.bind_read_target(src_texture); + + gl::blit_framebuffer(src_rect.origin.x, + src_rect.origin.y, + src_rect.origin.x + src_rect.size.width, + src_rect.origin.y + src_rect.size.height, + dest_rect.origin.x, + dest_rect.origin.y, + dest_rect.origin.x + dest_rect.size.width, + dest_rect.origin.y + dest_rect.size.height, + gl::COLOR_BUFFER_BIT, + gl::LINEAR); + } + + pub fn resize_texture(&mut self, + texture_id: TextureId, + new_width: u32, + new_height: u32, + format: ImageFormat, + filter: TextureFilter, + mode: RenderTargetMode) { + debug_assert!(self.inside_frame); + + let (old_width, old_height) = self.get_texture_dimensions(texture_id); + + let temp_texture_id = self.create_texture_ids(1, TextureTarget::Default)[0]; + self.init_texture(temp_texture_id, old_width, old_height, format, filter, mode, None); + self.create_fbo_for_texture_if_necessary(temp_texture_id, None); + + self.bind_read_target(Some((texture_id, 0))); + self.bind_texture(DEFAULT_TEXTURE, temp_texture_id); + + gl::copy_tex_sub_image_2d(temp_texture_id.target, + 0, + 0, + 0, + 0, + 0, + old_width as i32, + old_height as i32); + + self.deinit_texture(texture_id); + self.init_texture(texture_id, new_width, new_height, format, filter, mode, None); + self.create_fbo_for_texture_if_necessary(texture_id, None); + self.bind_read_target(Some((temp_texture_id, 0))); + self.bind_texture(DEFAULT_TEXTURE, texture_id); + + gl::copy_tex_sub_image_2d(texture_id.target, + 0, + 0, + 0, + 0, + 0, + old_width as i32, + old_height as i32); + + self.bind_read_target(None); + self.deinit_texture(temp_texture_id); + } + + pub fn deinit_texture(&mut self, texture_id: TextureId) { + debug_assert!(self.inside_frame); + + self.bind_texture(DEFAULT_TEXTURE, texture_id); + + let texture = self.textures.get_mut(&texture_id).unwrap(); + let (internal_format, gl_format) = gl_texture_formats_for_image_format(texture.format); + let type_ = gl_type_for_texture_format(texture.format); + + gl::tex_image_2d(texture_id.target, + 0, + internal_format, + 0, + 0, + 0, + gl_format, + type_, + None); + + if !texture.fbo_ids.is_empty() { + let fbo_ids: Vec<_> = texture.fbo_ids.iter().map(|&FBOId(fbo_id)| fbo_id).collect(); + gl::delete_framebuffers(&fbo_ids[..]); + } + + texture.format = ImageFormat::Invalid; + texture.width = 0; + texture.height = 0; + texture.fbo_ids.clear(); + } + + pub fn create_program(&mut self, + base_filename: &str, + include_filename: &str) -> ProgramId { + self.create_program_with_prefix(base_filename, &[include_filename], None) + } + + pub fn create_program_with_prefix(&mut self, + base_filename: &str, + include_filenames: &[&str], + prefix: Option) -> ProgramId { + debug_assert!(self.inside_frame); + + let pid = gl::create_program(); + + let mut vs_name = String::from(base_filename); + vs_name.push_str(".vs"); + let mut fs_name = String::from(base_filename); + fs_name.push_str(".fs"); + + let mut include = format!("// Base shader: {}\n", base_filename); + for inc_filename in include_filenames { + let src = get_shader_source(inc_filename, &self.resource_override_path); + include.push_str(&src); + } + + if let Some(shared_src) = get_optional_shader_source(base_filename, &self.resource_override_path) { + include.push_str(&shared_src); + } + + let program = Program { + name: base_filename.to_owned(), + id: pid, + u_transform: -1, + u_device_pixel_ratio: -1, + vs_source: get_shader_source(&vs_name, &self.resource_override_path), + fs_source: get_shader_source(&fs_name, &self.resource_override_path), + prefix: prefix, + vs_id: None, + fs_id: None, + }; + + let program_id = ProgramId(pid); + + debug_assert!(self.programs.contains_key(&program_id) == false); + self.programs.insert(program_id, program); + + self.load_program(program_id, include, true); + + program_id + } + + fn load_program(&mut self, + program_id: ProgramId, + include: String, + panic_on_fail: bool) { + debug_assert!(self.inside_frame); + + let program = self.programs.get_mut(&program_id).unwrap(); + + let mut vs_preamble = Vec::new(); + let mut fs_preamble = Vec::new(); + + vs_preamble.push("#define WR_VERTEX_SHADER\n".to_owned()); + fs_preamble.push("#define WR_FRAGMENT_SHADER\n".to_owned()); + + if let Some(ref prefix) = program.prefix { + vs_preamble.push(prefix.clone()); + fs_preamble.push(prefix.clone()); + } + + vs_preamble.push(self.shader_preamble.to_owned()); + fs_preamble.push(self.shader_preamble.to_owned()); + + vs_preamble.push(include.clone()); + fs_preamble.push(include); + + // todo(gw): store shader ids so they can be freed! + let vs_id = Device::compile_shader(&program.name, + &program.vs_source, + gl::VERTEX_SHADER, + &vs_preamble, + panic_on_fail); + let fs_id = Device::compile_shader(&program.name, + &program.fs_source, + gl::FRAGMENT_SHADER, + &fs_preamble, + panic_on_fail); + + match (vs_id, fs_id) { + (Some(vs_id), None) => { + println!("FAILED to load fs - falling back to previous!"); + gl::delete_shader(vs_id); + } + (None, Some(fs_id)) => { + println!("FAILED to load vs - falling back to previous!"); + gl::delete_shader(fs_id); + } + (None, None) => { + println!("FAILED to load vs/fs - falling back to previous!"); + } + (Some(vs_id), Some(fs_id)) => { + if let Some(vs_id) = program.vs_id { + gl::detach_shader(program.id, vs_id); + } + + if let Some(fs_id) = program.fs_id { + gl::detach_shader(program.id, fs_id); + } + + if program.attach_and_bind_shaders(vs_id, fs_id, panic_on_fail) { + if let Some(vs_id) = program.vs_id { + gl::delete_shader(vs_id); + } + + if let Some(fs_id) = program.fs_id { + gl::delete_shader(fs_id); + } + + program.vs_id = Some(vs_id); + program.fs_id = Some(fs_id); + } else { + let vs_id = program.vs_id.unwrap(); + let fs_id = program.fs_id.unwrap(); + program.attach_and_bind_shaders(vs_id, fs_id, true); + } + + program.u_transform = gl::get_uniform_location(program.id, "uTransform"); + program.u_device_pixel_ratio = gl::get_uniform_location(program.id, "uDevicePixelRatio"); + + program_id.bind(); + let u_color_0 = gl::get_uniform_location(program.id, "sColor0"); + if u_color_0 != -1 { + gl::uniform_1i(u_color_0, TextureSampler::Color0 as i32); + } + let u_color1 = gl::get_uniform_location(program.id, "sColor1"); + if u_color1 != -1 { + gl::uniform_1i(u_color1, TextureSampler::Color1 as i32); + } + let u_color_2 = gl::get_uniform_location(program.id, "sColor2"); + if u_color_2 != -1 { + gl::uniform_1i(u_color_2, TextureSampler::Color2 as i32); + } + let u_mask = gl::get_uniform_location(program.id, "sMask"); + if u_mask != -1 { + gl::uniform_1i(u_mask, TextureSampler::Mask as i32); + } + + let u_cache = gl::get_uniform_location(program.id, "sCache"); + if u_cache != -1 { + gl::uniform_1i(u_cache, TextureSampler::Cache as i32); + } + + let u_layers = gl::get_uniform_location(program.id, "sLayers"); + if u_layers != -1 { + gl::uniform_1i(u_layers, TextureSampler::Layers as i32); + } + + let u_tasks = gl::get_uniform_location(program.id, "sRenderTasks"); + if u_tasks != -1 { + gl::uniform_1i(u_tasks, TextureSampler::RenderTasks as i32); + } + + let u_prim_geom = gl::get_uniform_location(program.id, "sPrimGeometry"); + if u_prim_geom != -1 { + gl::uniform_1i(u_prim_geom, TextureSampler::Geometry as i32); + } + + let u_data16 = gl::get_uniform_location(program.id, "sData16"); + if u_data16 != -1 { + gl::uniform_1i(u_data16, TextureSampler::Data16 as i32); + } + + let u_data32 = gl::get_uniform_location(program.id, "sData32"); + if u_data32 != -1 { + gl::uniform_1i(u_data32, TextureSampler::Data32 as i32); + } + + let u_data64 = gl::get_uniform_location(program.id, "sData64"); + if u_data64 != -1 { + gl::uniform_1i(u_data64, TextureSampler::Data64 as i32); + } + + let u_data128 = gl::get_uniform_location(program.id, "sData128"); + if u_data128 != -1 { + gl::uniform_1i(u_data128, TextureSampler::Data128 as i32); + } + + let u_resource_rects = gl::get_uniform_location(program.id, "sResourceRects"); + if u_resource_rects != -1 { + gl::uniform_1i(u_resource_rects, TextureSampler::ResourceRects as i32); + } + } + } + } + +/* + pub fn refresh_shader(&mut self, path: PathBuf) { + let mut vs_preamble_path = self.resource_path.clone(); + vs_preamble_path.push(VERTEX_SHADER_PREAMBLE); + + let mut fs_preamble_path = self.resource_path.clone(); + fs_preamble_path.push(FRAGMENT_SHADER_PREAMBLE); + + let mut refresh_all = false; + + if path == vs_preamble_path { + let mut f = File::open(&vs_preamble_path).unwrap(); + self.vertex_shader_preamble = String::new(); + f.read_to_string(&mut self.vertex_shader_preamble).unwrap(); + refresh_all = true; + } + + if path == fs_preamble_path { + let mut f = File::open(&fs_preamble_path).unwrap(); + self.fragment_shader_preamble = String::new(); + f.read_to_string(&mut self.fragment_shader_preamble).unwrap(); + refresh_all = true; + } + + let mut programs_to_update = Vec::new(); + + for (program_id, program) in &mut self.programs { + if refresh_all || program.vs_path == path || program.fs_path == path { + programs_to_update.push(*program_id) + } + } + + for program_id in programs_to_update { + self.load_program(program_id, false); + } + }*/ + + pub fn get_uniform_location(&self, program_id: ProgramId, name: &str) -> UniformLocation { + let ProgramId(program_id) = program_id; + UniformLocation(gl::get_uniform_location(program_id, name)) + } + + pub fn set_uniform_2f(&self, uniform: UniformLocation, x: f32, y: f32) { + debug_assert!(self.inside_frame); + let UniformLocation(location) = uniform; + gl::uniform_2f(location, x, y); + } + + fn set_uniforms(&self, + program: &Program, + transform: &Matrix4D, + device_pixel_ratio: f32) { + debug_assert!(self.inside_frame); + gl::uniform_matrix_4fv(program.u_transform, + false, + &transform.to_row_major_array()); + gl::uniform_1f(program.u_device_pixel_ratio, device_pixel_ratio); + } + + fn update_image_for_2d_texture(&mut self, + target: gl::GLuint, + x0: gl::GLint, + y0: gl::GLint, + width: gl::GLint, + height: gl::GLint, + format: gl::GLuint, + data: &[u8]) { + gl::tex_sub_image_2d(target, + 0, + x0, y0, + width, height, + format, + gl::UNSIGNED_BYTE, + data); + } + + pub fn update_texture(&mut self, + texture_id: TextureId, + x0: u32, + y0: u32, + width: u32, + height: u32, + stride: Option, + data: &[u8]) { + debug_assert!(self.inside_frame); + + let mut expanded_data = Vec::new(); + + let (gl_format, bpp, data) = match self.textures.get(&texture_id).unwrap().format { + ImageFormat::A8 => { + if cfg!(any(target_arch="arm", target_arch="aarch64")) { + for byte in data { + expanded_data.push(*byte); + expanded_data.push(*byte); + expanded_data.push(*byte); + expanded_data.push(*byte); + } + (GL_FORMAT_BGRA, 4, expanded_data.as_slice()) + } else { + (GL_FORMAT_A, 1, data) + } + } + ImageFormat::RGB8 => (gl::RGB, 3, data), + ImageFormat::RGBA8 => (GL_FORMAT_BGRA, 4, data), + ImageFormat::Invalid | ImageFormat::RGBAF32 => unreachable!(), + }; + + let row_length = match stride { + Some(value) => value / bpp, + None => width, + }; + + assert!(data.len() as u32 == bpp * row_length * height); + + if let Some(..) = stride { + gl::pixel_store_i(gl::UNPACK_ROW_LENGTH, row_length as gl::GLint); + } + + self.bind_texture(DEFAULT_TEXTURE, texture_id); + self.update_image_for_2d_texture(texture_id.target, + x0 as gl::GLint, + y0 as gl::GLint, + width as gl::GLint, + height as gl::GLint, + gl_format, + data); + + // Reset row length to 0, otherwise the stride would apply to all texture uploads. + if let Some(..) = stride { + gl::pixel_store_i(gl::UNPACK_ROW_LENGTH, 0 as gl::GLint); + } + } + + fn clear_vertex_array(&mut self) { + debug_assert!(self.inside_frame); + gl::bind_vertex_array(0); + } + + pub fn bind_vao(&mut self, vao_id: VAOId) { + debug_assert!(self.inside_frame); + + if self.bound_vao != vao_id { + self.bound_vao = vao_id; + + let VAOId(id) = vao_id; + gl::bind_vertex_array(id); + } + } + + fn create_vao_with_vbos(&mut self, + format: VertexFormat, + main_vbo_id: VBOId, + instance_vbo_id: VBOId, + ibo_id: IBOId, + vertex_offset: gl::GLuint, + instance_stride: gl::GLint, + owns_vertices: bool, + owns_instances: bool, + owns_indices: bool) + -> VAOId { + debug_assert!(self.inside_frame); + + let vao_ids = gl::gen_vertex_arrays(1); + let vao_id = vao_ids[0]; + + gl::bind_vertex_array(vao_id); + + format.bind(main_vbo_id, instance_vbo_id, vertex_offset, instance_stride); + ibo_id.bind(); // force it to be a part of VAO + + let vao = VAO { + id: vao_id, + ibo_id: ibo_id, + main_vbo_id: main_vbo_id, + instance_vbo_id: instance_vbo_id, + instance_stride: instance_stride, + owns_indices: owns_indices, + owns_vertices: owns_vertices, + owns_instances: owns_instances, + }; + + gl::bind_vertex_array(0); + + let vao_id = VAOId(vao_id); + + debug_assert!(!self.vaos.contains_key(&vao_id)); + self.vaos.insert(vao_id, vao); + + vao_id + } + + pub fn create_vao(&mut self, format: VertexFormat, inst_stride: gl::GLint) -> VAOId { + debug_assert!(self.inside_frame); + + let buffer_ids = gl::gen_buffers(3); + let ibo_id = IBOId(buffer_ids[0]); + let main_vbo_id = VBOId(buffer_ids[1]); + let intance_vbo_id = VBOId(buffer_ids[2]); + + self.create_vao_with_vbos(format, main_vbo_id, intance_vbo_id, ibo_id, 0, inst_stride, true, true, true) + } + + pub fn create_vao_with_new_instances(&mut self, format: VertexFormat, inst_stride: gl::GLint, + base_vao: VAOId) -> VAOId { + debug_assert!(self.inside_frame); + + let buffer_ids = gl::gen_buffers(1); + let intance_vbo_id = VBOId(buffer_ids[0]); + let (main_vbo_id, ibo_id) = { + let vao = self.vaos.get(&base_vao).unwrap(); + (vao.main_vbo_id, vao.ibo_id) + }; + + self.create_vao_with_vbos(format, main_vbo_id, intance_vbo_id, ibo_id, 0, inst_stride, false, true, false) + } + + pub fn update_vao_main_vertices(&mut self, + vao_id: VAOId, + vertices: &[V], + usage_hint: VertexUsageHint) { + debug_assert!(self.inside_frame); + + let vao = self.vaos.get(&vao_id).unwrap(); + debug_assert_eq!(self.bound_vao, vao_id); + + vao.main_vbo_id.bind(); + gl::buffer_data(gl::ARRAY_BUFFER, &vertices, usage_hint.to_gl()); + } + + pub fn update_vao_instances(&mut self, + vao_id: VAOId, + instances: &[V], + usage_hint: VertexUsageHint) { + debug_assert!(self.inside_frame); + + let vao = self.vaos.get(&vao_id).unwrap(); + debug_assert_eq!(self.bound_vao, vao_id); + debug_assert_eq!(vao.instance_stride as usize, mem::size_of::()); + + vao.instance_vbo_id.bind(); + gl::buffer_data(gl::ARRAY_BUFFER, &instances, usage_hint.to_gl()); + } + + pub fn update_vao_indices(&mut self, + vao_id: VAOId, + indices: &[I], + usage_hint: VertexUsageHint) { + debug_assert!(self.inside_frame); + + let vao = self.vaos.get(&vao_id).unwrap(); + debug_assert_eq!(self.bound_vao, vao_id); + + vao.ibo_id.bind(); + gl::buffer_data(gl::ELEMENT_ARRAY_BUFFER, &indices, usage_hint.to_gl()); + } + + pub fn draw_triangles_u16(&mut self, first_vertex: i32, index_count: i32) { + debug_assert!(self.inside_frame); + gl::draw_elements(gl::TRIANGLES, + index_count, + gl::UNSIGNED_SHORT, + first_vertex as u32 * 2); + } + + pub fn draw_triangles_u32(&mut self, first_vertex: i32, index_count: i32) { + debug_assert!(self.inside_frame); + gl::draw_elements(gl::TRIANGLES, + index_count, + gl::UNSIGNED_INT, + first_vertex as u32 * 4); + } + + pub fn draw_nonindexed_lines(&mut self, first_vertex: i32, vertex_count: i32) { + debug_assert!(self.inside_frame); + gl::draw_arrays(gl::LINES, + first_vertex, + vertex_count); + } + + pub fn draw_indexed_triangles_instanced_u16(&mut self, + index_count: i32, + instance_count: i32) { + debug_assert!(self.inside_frame); + gl::draw_elements_instanced(gl::TRIANGLES, index_count, gl::UNSIGNED_SHORT, 0, instance_count); + } + + pub fn end_frame(&mut self) { + self.bind_draw_target(None, None); + self.bind_read_target(None); + + debug_assert!(self.inside_frame); + self.inside_frame = false; + + gl::bind_texture(gl::TEXTURE_2D, 0); + gl::use_program(0); + + for i in 0..self.bound_textures.len() { + gl::active_texture(gl::TEXTURE0 + i as gl::GLuint); + gl::bind_texture(gl::TEXTURE_2D, 0); + } + + gl::active_texture(gl::TEXTURE0); + } + + pub fn assign_ubo_binding(&self, program_id: ProgramId, name: &str, value: u32) -> u32 { + let index = gl::get_uniform_block_index(program_id.0, name); + gl::uniform_block_binding(program_id.0, index, value); + index + } + + pub fn create_ubo(&self, data: &[T], binding: u32) -> UBOId { + let ubo = gl::gen_buffers(1)[0]; + gl::bind_buffer(gl::UNIFORM_BUFFER, ubo); + gl::buffer_data(gl::UNIFORM_BUFFER, data, gl::STATIC_DRAW); + gl::bind_buffer_base(gl::UNIFORM_BUFFER, binding, ubo); + UBOId(ubo) + } + + pub fn reset_ubo(&self, binding: u32) { + gl::bind_buffer(gl::UNIFORM_BUFFER, 0); + gl::bind_buffer_base(gl::UNIFORM_BUFFER, binding, 0); + } + + pub fn delete_buffer(&self, buffer: UBOId) { + gl::delete_buffers(&[buffer.0]); + } + + #[cfg(target_os = "android")] + pub fn set_multisample(&self, enable: bool) { + } + + #[cfg(not(target_os = "android"))] + pub fn set_multisample(&self, enable: bool) { + if self.capabilities.supports_multisampling { + if enable { + gl::enable(gl::MULTISAMPLE); + } else { + gl::disable(gl::MULTISAMPLE); + } + } + } + + pub fn clear_target(&self, + color: Option<[f32; 4]>, + depth: Option) { + let mut clear_bits = 0; + + if let Some(color) = color { + gl::clear_color(color[0], color[1], color[2], color[3]); + clear_bits |= gl::COLOR_BUFFER_BIT; + } + + if let Some(depth) = depth { + gl::clear_depth(depth as f64); + clear_bits |= gl::DEPTH_BUFFER_BIT; + } + + if clear_bits != 0 { + gl::clear(clear_bits); + } + } + + pub fn enable_depth(&self) { + gl::enable(gl::DEPTH_TEST); + } + + pub fn disable_depth(&self) { + gl::disable(gl::DEPTH_TEST); + } + + pub fn set_depth_func(&self, depth_func: DepthFunction) { + gl::depth_func(depth_func as gl::GLuint); + } + + pub fn enable_depth_write(&self) { + gl::depth_mask(true); + } + + pub fn disable_depth_write(&self) { + gl::depth_mask(false); + } + + pub fn disable_stencil(&self) { + gl::disable(gl::STENCIL_TEST); + } + + pub fn disable_scissor(&self) { + gl::disable(gl::SCISSOR_TEST); + } + + pub fn set_blend(&self, enable: bool) { + if enable { + gl::enable(gl::BLEND); + } else { + gl::disable(gl::BLEND); + } + } + + pub fn set_blend_mode_premultiplied_alpha(&self) { + gl::blend_func(gl::SRC_ALPHA, gl::ZERO); + gl::blend_equation(gl::FUNC_ADD); + } + + pub fn set_blend_mode_alpha(&self) { + //gl::blend_func(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA); + gl::blend_func_separate(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA, + gl::ONE, gl::ONE); + gl::blend_equation(gl::FUNC_ADD); + } + + pub fn set_blend_mode_subpixel(&self, color: ColorF) { + gl::blend_color(color.r, color.g, color.b, color.a); + gl::blend_func(gl::CONSTANT_COLOR, gl::ONE_MINUS_SRC_COLOR); + } + + pub fn set_blend_mode_multiply(&self) { + gl::blend_func_separate(gl::ZERO, gl::SRC_COLOR, + gl::ZERO, gl::SRC_ALPHA); + gl::blend_equation(gl::FUNC_ADD); + } +} + +impl Drop for Device { + fn drop(&mut self) { + //self.file_watcher.exit(); + } +} + +fn gl_texture_formats_for_image_format(format: ImageFormat) -> (gl::GLint, gl::GLuint) { + match format { + ImageFormat::A8 => { + if cfg!(any(target_arch="arm", target_arch="aarch64")) { + (GL_FORMAT_BGRA as gl::GLint, GL_FORMAT_BGRA) + } else { + (GL_FORMAT_A as gl::GLint, GL_FORMAT_A) + } + }, + ImageFormat::RGB8 => (gl::RGB as gl::GLint, gl::RGB), + ImageFormat::RGBA8 => { + if cfg!(any(target_arch="arm", target_arch="aarch64")) { + (GL_FORMAT_BGRA as gl::GLint, GL_FORMAT_BGRA) + } else { + (gl::RGBA as gl::GLint, GL_FORMAT_BGRA) + } + } + ImageFormat::RGBAF32 => (gl::RGBA32F as gl::GLint, gl::RGBA), + ImageFormat::Invalid => unreachable!(), + } +} + +fn gl_type_for_texture_format(format: ImageFormat) -> gl::GLuint { + match format { + ImageFormat::RGBAF32 => gl::FLOAT, + _ => gl::UNSIGNED_BYTE, + } +} + diff --git a/gfx/webrender/src/frame.rs b/gfx/webrender/src/frame.rs new file mode 100644 index 000000000000..fdc2faeaccb5 --- /dev/null +++ b/gfx/webrender/src/frame.rs @@ -0,0 +1,660 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use fnv::FnvHasher; +use internal_types::{ANGLE_FLOAT_TO_FIXED, AxisDirection}; +use internal_types::{CompositionOp}; +use internal_types::{LowLevelFilterOp}; +use internal_types::{RendererFrame}; +use layer::Layer; +use resource_cache::ResourceCache; +use scene::Scene; +use scroll_tree::{ScrollTree, ScrollStates}; +use std::collections::HashMap; +use std::hash::BuildHasherDefault; +use tiling::{AuxiliaryListsMap, FrameBuilder, FrameBuilderConfig, PrimitiveFlags}; +use webrender_traits::{AuxiliaryLists, ClipRegion, ColorF, DisplayItem, Epoch, FilterOp}; +use webrender_traits::{LayerPoint, LayerRect, LayerSize, LayerToScrollTransform}; +use webrender_traits::{MixBlendMode, PipelineId, ScrollEventPhase, ScrollLayerId, ScrollLayerState}; +use webrender_traits::{ScrollLocation, ScrollPolicy, ServoScrollRootId, SpecificDisplayItem}; +use webrender_traits::{StackingContext, WorldPoint}; + +#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)] +pub struct FrameId(pub u32); + +static DEFAULT_SCROLLBAR_COLOR: ColorF = ColorF { r: 0.3, g: 0.3, b: 0.3, a: 0.6 }; + +struct FlattenContext<'a> { + scene: &'a Scene, + pipeline_sizes: &'a mut HashMap, + builder: &'a mut FrameBuilder, +} + +// TODO: doc +pub struct Frame { + pub scroll_tree: ScrollTree, + pub pipeline_epoch_map: HashMap>, + pub pipeline_auxiliary_lists: AuxiliaryListsMap, + id: FrameId, + debug: bool, + frame_builder_config: FrameBuilderConfig, + frame_builder: Option, +} + +trait DisplayListHelpers { + fn starting_stacking_context<'a>(&'a self) -> Option<(&'a StackingContext, &'a ClipRegion)>; +} + +impl DisplayListHelpers for Vec { + fn starting_stacking_context<'a>(&'a self) -> Option<(&'a StackingContext, &'a ClipRegion)> { + self.first().and_then(|item| match item.item { + SpecificDisplayItem::PushStackingContext(ref specific_item) => { + Some((&specific_item.stacking_context, &item.clip)) + }, + _ => None, + }) + } +} + +trait StackingContextHelpers { + fn needs_composition_operation_for_mix_blend_mode(&self) -> bool; + fn composition_operations(&self, auxiliary_lists: &AuxiliaryLists) -> Vec; +} + +impl StackingContextHelpers for StackingContext { + fn needs_composition_operation_for_mix_blend_mode(&self) -> bool { + match self.mix_blend_mode { + MixBlendMode::Normal => false, + MixBlendMode::Multiply | + MixBlendMode::Screen | + MixBlendMode::Overlay | + MixBlendMode::Darken | + MixBlendMode::Lighten | + MixBlendMode::ColorDodge | + MixBlendMode::ColorBurn | + MixBlendMode::HardLight | + MixBlendMode::SoftLight | + MixBlendMode::Difference | + MixBlendMode::Exclusion | + MixBlendMode::Hue | + MixBlendMode::Saturation | + MixBlendMode::Color | + MixBlendMode::Luminosity => true, + } + } + + fn composition_operations(&self, auxiliary_lists: &AuxiliaryLists) -> Vec { + let mut composition_operations = vec![]; + if self.needs_composition_operation_for_mix_blend_mode() { + composition_operations.push(CompositionOp::MixBlend(self.mix_blend_mode)); + } + for filter in auxiliary_lists.filters(&self.filters) { + match *filter { + FilterOp::Blur(radius) => { + composition_operations.push(CompositionOp::Filter(LowLevelFilterOp::Blur( + radius, + AxisDirection::Horizontal))); + composition_operations.push(CompositionOp::Filter(LowLevelFilterOp::Blur( + radius, + AxisDirection::Vertical))); + } + FilterOp::Brightness(amount) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::Brightness(Au::from_f32_px(amount)))); + } + FilterOp::Contrast(amount) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::Contrast(Au::from_f32_px(amount)))); + } + FilterOp::Grayscale(amount) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::Grayscale(Au::from_f32_px(amount)))); + } + FilterOp::HueRotate(angle) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::HueRotate(f32::round( + angle * ANGLE_FLOAT_TO_FIXED) as i32))); + } + FilterOp::Invert(amount) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::Invert(Au::from_f32_px(amount)))); + } + FilterOp::Opacity(amount) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::Opacity(Au::from_f32_px(amount)))); + } + FilterOp::Saturate(amount) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::Saturate(Au::from_f32_px(amount)))); + } + FilterOp::Sepia(amount) => { + composition_operations.push(CompositionOp::Filter( + LowLevelFilterOp::Sepia(Au::from_f32_px(amount)))); + } + } + } + + composition_operations + } +} + +struct DisplayListTraversal<'a> { + pub display_list: &'a [DisplayItem], + pub next_item_index: usize, +} + +impl<'a> DisplayListTraversal<'a> { + pub fn new_skipping_first(display_list: &'a Vec) -> DisplayListTraversal { + DisplayListTraversal { + display_list: display_list, + next_item_index: 1, + } + } + + pub fn skip_current_stacking_context(&mut self) { + for item in self { + if item.item == SpecificDisplayItem::PopStackingContext { + return; + } + } + } + + pub fn current_stacking_context_empty(&self) -> bool { + match self.peek() { + Some(item) => item.item == SpecificDisplayItem::PopStackingContext, + None => true, + } + } + + fn peek(&self) -> Option<&'a DisplayItem> { + if self.next_item_index >= self.display_list.len() { + return None + } + Some(&self.display_list[self.next_item_index]) + } +} + +impl<'a> Iterator for DisplayListTraversal<'a> { + type Item = &'a DisplayItem; + + fn next(&mut self) -> Option<&'a DisplayItem> { + if self.next_item_index >= self.display_list.len() { + return None + } + + let item = &self.display_list[self.next_item_index]; + self.next_item_index += 1; + Some(item) + } +} + +impl Frame { + pub fn new(debug: bool, config: FrameBuilderConfig) -> Frame { + Frame { + pipeline_epoch_map: HashMap::with_hasher(Default::default()), + pipeline_auxiliary_lists: HashMap::with_hasher(Default::default()), + scroll_tree: ScrollTree::new(), + id: FrameId(0), + debug: debug, + frame_builder: None, + frame_builder_config: config, + } + } + + pub fn reset(&mut self) -> ScrollStates { + self.pipeline_epoch_map.clear(); + + // Advance to the next frame. + self.id.0 += 1; + + self.scroll_tree.drain() + } + + pub fn get_scroll_layer_state(&self) -> Vec { + self.scroll_tree.get_scroll_layer_state() + } + + /// Returns true if any layers actually changed position or false otherwise. + pub fn scroll_layers(&mut self, + origin: LayerPoint, + pipeline_id: PipelineId, + scroll_root_id: ServoScrollRootId) + -> bool { + self.scroll_tree.scroll_layers(origin, pipeline_id, scroll_root_id) + } + + /// Returns true if any layers actually changed position or false otherwise. + pub fn scroll(&mut self, + scroll_location: ScrollLocation, + cursor: WorldPoint, + phase: ScrollEventPhase) + -> bool { + self.scroll_tree.scroll(scroll_location, cursor, phase,) + } + + pub fn tick_scrolling_bounce_animations(&mut self) { + self.scroll_tree.tick_scrolling_bounce_animations(); + } + + pub fn create(&mut self, + scene: &Scene, + pipeline_sizes: &mut HashMap) { + let root_pipeline_id = match scene.root_pipeline_id { + Some(root_pipeline_id) => root_pipeline_id, + None => return, + }; + + let root_pipeline = match scene.pipeline_map.get(&root_pipeline_id) { + Some(root_pipeline) => root_pipeline, + None => return, + }; + + let display_list = scene.display_lists.get(&root_pipeline_id); + let display_list = match display_list { + Some(display_list) => display_list, + None => return, + }; + + let old_scrolling_states = self.reset(); + self.pipeline_auxiliary_lists = scene.pipeline_auxiliary_lists.clone(); + + self.pipeline_epoch_map.insert(root_pipeline_id, root_pipeline.epoch); + + let (root_stacking_context, root_clip) = match display_list.starting_stacking_context() { + Some(some) => some, + None => { + warn!("Pipeline display list does not start with a stacking context."); + return; + } + }; + + // Insert global position: fixed elements layer + debug_assert!(self.scroll_tree.layers.is_empty()); + let root_scroll_layer_id = ScrollLayerId::root(root_pipeline_id); + let root_fixed_layer_id = ScrollLayerId::create_fixed(root_pipeline_id); + let root_viewport = LayerRect::new(LayerPoint::zero(), root_pipeline.viewport_size); + let layer = Layer::new(&root_viewport, + root_clip.main.size, + &LayerToScrollTransform::identity(), + root_pipeline_id); + self.scroll_tree.add_layer(layer.clone(), root_fixed_layer_id, None); + self.scroll_tree.add_layer(layer, root_scroll_layer_id, None); + self.scroll_tree.root_scroll_layer_id = Some(root_scroll_layer_id); + + let background_color = root_pipeline.background_color.and_then(|color| { + if color.a > 0.0 { + Some(color) + } else { + None + } + }); + + let mut frame_builder = FrameBuilder::new(root_pipeline.viewport_size, + background_color, + self.debug, + self.frame_builder_config); + + { + let mut context = FlattenContext { + scene: scene, + pipeline_sizes: pipeline_sizes, + builder: &mut frame_builder, + }; + + let mut traversal = DisplayListTraversal::new_skipping_first(display_list); + self.flatten_stacking_context(&mut traversal, + root_pipeline_id, + &mut context, + root_fixed_layer_id, + root_scroll_layer_id, + LayerToScrollTransform::identity(), + 0, + &root_stacking_context, + root_clip); + } + + self.frame_builder = Some(frame_builder); + self.scroll_tree.finalize_and_apply_pending_scroll_offsets(old_scrolling_states); + } + + fn flatten_scroll_layer<'a>(&mut self, + traversal: &mut DisplayListTraversal<'a>, + pipeline_id: PipelineId, + context: &mut FlattenContext, + current_fixed_layer_id: ScrollLayerId, + mut current_scroll_layer_id: ScrollLayerId, + layer_relative_transform: LayerToScrollTransform, + level: i32, + clip: &LayerRect, + content_size: &LayerSize, + new_scroll_layer_id: ScrollLayerId) { + // Avoid doing unnecessary work for empty stacking contexts. + if traversal.current_stacking_context_empty() { + traversal.skip_current_stacking_context(); + return; + } + + let layer = Layer::new(&clip, *content_size, &layer_relative_transform, pipeline_id); + self.scroll_tree.add_layer(layer, new_scroll_layer_id, Some(current_scroll_layer_id)); + current_scroll_layer_id = new_scroll_layer_id; + + let layer_rect = LayerRect::new(LayerPoint::zero(), + LayerSize::new(content_size.width + clip.origin.x, + content_size.height + clip.origin.y)); + context.builder.push_layer(layer_rect, + &ClipRegion::simple(&layer_rect), + LayerToScrollTransform::identity(), + pipeline_id, + current_scroll_layer_id, + &[]); + + self.flatten_items(traversal, + pipeline_id, + context, + current_fixed_layer_id, + current_scroll_layer_id, + LayerToScrollTransform::identity(), + level); + + context.builder.pop_layer(); + } + + fn flatten_stacking_context<'a>(&mut self, + traversal: &mut DisplayListTraversal<'a>, + pipeline_id: PipelineId, + context: &mut FlattenContext, + current_fixed_layer_id: ScrollLayerId, + current_scroll_layer_id: ScrollLayerId, + layer_relative_transform: LayerToScrollTransform, + level: i32, + stacking_context: &StackingContext, + clip_region: &ClipRegion) { + // Avoid doing unnecessary work for empty stacking contexts. + if traversal.current_stacking_context_empty() { + traversal.skip_current_stacking_context(); + return; + } + + let composition_operations = { + let auxiliary_lists = self.pipeline_auxiliary_lists + .get(&pipeline_id) + .expect("No auxiliary lists?!"); + stacking_context.composition_operations(auxiliary_lists) + }; + + // Detect composition operations that will make us invisible. + for composition_operation in &composition_operations { + match *composition_operation { + CompositionOp::Filter(LowLevelFilterOp::Opacity(Au(0))) => { + traversal.skip_current_stacking_context(); + return; + } + _ => {} + } + } + + let transform = layer_relative_transform.pre_translated(stacking_context.bounds.origin.x, + stacking_context.bounds.origin.y, + 0.0) + .pre_mul(&stacking_context.transform) + .pre_mul(&stacking_context.perspective); + + // Build world space transform + let scroll_layer_id = match stacking_context.scroll_policy { + ScrollPolicy::Fixed => current_fixed_layer_id, + ScrollPolicy::Scrollable => current_scroll_layer_id, + }; + + if level == 0 { + if let Some(pipeline) = context.scene.pipeline_map.get(&pipeline_id) { + if let Some(bg_color) = pipeline.background_color { + + // Adding a dummy layer for this rectangle in order to disable clipping. + let no_clip = ClipRegion::simple(&clip_region.main); + context.builder.push_layer(clip_region.main, + &no_clip, + transform, + pipeline_id, + scroll_layer_id, + &composition_operations); + + //Note: we don't use the original clip region here, + // it's already processed by the layer we just pushed. + context.builder.add_solid_rectangle(&clip_region.main, + &no_clip, + &bg_color, + PrimitiveFlags::None); + + context.builder.pop_layer(); + } + } + } + + // TODO(gw): Int with overflow etc + context.builder.push_layer(clip_region.main, + &clip_region, + transform, + pipeline_id, + scroll_layer_id, + &composition_operations); + + self.flatten_items(traversal, + pipeline_id, + context, + current_fixed_layer_id, + current_scroll_layer_id, + transform, + level); + + if level == 0 && self.frame_builder_config.enable_scrollbars { + let scrollbar_rect = LayerRect::new(LayerPoint::zero(), LayerSize::new(10.0, 70.0)); + context.builder.add_solid_rectangle( + &scrollbar_rect, + &ClipRegion::simple(&scrollbar_rect), + &DEFAULT_SCROLLBAR_COLOR, + PrimitiveFlags::Scrollbar(self.scroll_tree.root_scroll_layer_id.unwrap(), 4.0)); + } + + context.builder.pop_layer(); + } + + fn flatten_iframe<'a>(&mut self, + pipeline_id: PipelineId, + bounds: &LayerRect, + context: &mut FlattenContext, + current_scroll_layer_id: ScrollLayerId, + layer_relative_transform: LayerToScrollTransform) { + context.pipeline_sizes.insert(pipeline_id, bounds.size); + + let pipeline = match context.scene.pipeline_map.get(&pipeline_id) { + Some(pipeline) => pipeline, + None => return, + }; + + let display_list = context.scene.display_lists.get(&pipeline_id); + let display_list = match display_list { + Some(display_list) => display_list, + None => return, + }; + + let (iframe_stacking_context, iframe_clip) = match display_list.starting_stacking_context() { + Some(some) => some, + None => { + warn!("Pipeline display list does not start with a stacking context."); + return; + } + }; + + self.pipeline_epoch_map.insert(pipeline_id, pipeline.epoch); + + let iframe_rect = &LayerRect::new(LayerPoint::zero(), bounds.size); + let transform = layer_relative_transform.pre_translated(bounds.origin.x, + bounds.origin.y, + 0.0); + + let iframe_fixed_layer_id = ScrollLayerId::create_fixed(pipeline_id); + let iframe_scroll_layer_id = ScrollLayerId::root(pipeline_id); + + let layer = Layer::new(iframe_rect, + iframe_clip.main.size, + &transform, + pipeline_id); + self.scroll_tree.add_layer(layer.clone(), iframe_fixed_layer_id, None); + self.scroll_tree.add_layer(layer, iframe_scroll_layer_id, Some(current_scroll_layer_id)); + + let mut traversal = DisplayListTraversal::new_skipping_first(display_list); + + self.flatten_stacking_context(&mut traversal, + pipeline_id, + context, + iframe_fixed_layer_id, + iframe_scroll_layer_id, + LayerToScrollTransform::identity(), + 0, + &iframe_stacking_context, + iframe_clip); + } + + fn flatten_items<'a>(&mut self, + traversal: &mut DisplayListTraversal<'a>, + pipeline_id: PipelineId, + context: &mut FlattenContext, + current_fixed_layer_id: ScrollLayerId, + current_scroll_layer_id: ScrollLayerId, + layer_relative_transform: LayerToScrollTransform, + level: i32) { + while let Some(item) = traversal.next() { + match item.item { + SpecificDisplayItem::WebGL(ref info) => { + context.builder.add_webgl_rectangle(item.rect, + &item.clip, info.context_id); + } + SpecificDisplayItem::Image(ref info) => { + context.builder.add_image(item.rect, + &item.clip, + &info.stretch_size, + &info.tile_spacing, + info.image_key, + info.image_rendering); + } + SpecificDisplayItem::YuvImage(ref info) => { + context.builder.add_yuv_image(item.rect, + &item.clip, + info.y_image_key, + info.u_image_key, + info.v_image_key, + info.color_space); + } + SpecificDisplayItem::Text(ref text_info) => { + context.builder.add_text(item.rect, + &item.clip, + text_info.font_key, + text_info.size, + text_info.blur_radius, + &text_info.color, + text_info.glyphs); + } + SpecificDisplayItem::Rectangle(ref info) => { + context.builder.add_solid_rectangle(&item.rect, + &item.clip, + &info.color, + PrimitiveFlags::None); + } + SpecificDisplayItem::Gradient(ref info) => { + context.builder.add_gradient(item.rect, + &item.clip, + info.start_point, + info.end_point, + info.stops); + } + SpecificDisplayItem::RadialGradient(ref info) => { + context.builder.add_radial_gradient(item.rect, + &item.clip, + info.start_center, + info.start_radius, + info.end_center, + info.end_radius, + info.stops); + } + SpecificDisplayItem::BoxShadow(ref box_shadow_info) => { + context.builder.add_box_shadow(&box_shadow_info.box_bounds, + &item.clip, + &box_shadow_info.offset, + &box_shadow_info.color, + box_shadow_info.blur_radius, + box_shadow_info.spread_radius, + box_shadow_info.border_radius, + box_shadow_info.clip_mode); + } + SpecificDisplayItem::Border(ref info) => { + context.builder.add_border(item.rect, &item.clip, info); + } + SpecificDisplayItem::PushStackingContext(ref info) => { + self.flatten_stacking_context(traversal, + pipeline_id, + context, + current_fixed_layer_id, + current_scroll_layer_id, + layer_relative_transform, + level + 1, + &info.stacking_context, + &item.clip); + } + SpecificDisplayItem::PushScrollLayer(ref info) => { + self.flatten_scroll_layer(traversal, + pipeline_id, + context, + current_fixed_layer_id, + current_scroll_layer_id, + layer_relative_transform, + level, + &item.rect, + &info.content_size, + info.id); + } + SpecificDisplayItem::Iframe(ref info) => { + self.flatten_iframe(info.pipeline_id, + &item.rect, + context, + current_scroll_layer_id, + layer_relative_transform); + } + SpecificDisplayItem::PopStackingContext | + SpecificDisplayItem::PopScrollLayer => return, + } + } + } + + pub fn build(&mut self, + resource_cache: &mut ResourceCache, + auxiliary_lists_map: &AuxiliaryListsMap, + device_pixel_ratio: f32) + -> RendererFrame { + self.scroll_tree.update_all_layer_transforms(); + let frame = self.build_frame(resource_cache, + auxiliary_lists_map, + device_pixel_ratio); + resource_cache.expire_old_resources(self.id); + frame + } + + fn build_frame(&mut self, + resource_cache: &mut ResourceCache, + auxiliary_lists_map: &AuxiliaryListsMap, + device_pixel_ratio: f32) -> RendererFrame { + let mut frame_builder = self.frame_builder.take(); + let frame = frame_builder.as_mut().map(|builder| + builder.build(resource_cache, + self.id, + &self.scroll_tree, + auxiliary_lists_map, + device_pixel_ratio) + ); + self.frame_builder = frame_builder; + + let layers_bouncing_back = self.scroll_tree.collect_layers_bouncing_back(); + RendererFrame::new(self.pipeline_epoch_map.clone(), layers_bouncing_back, frame) + } +} diff --git a/gfx/webrender/src/freelist.rs b/gfx/webrender/src/freelist.rs new file mode 100644 index 000000000000..805af8f69cf7 --- /dev/null +++ b/gfx/webrender/src/freelist.rs @@ -0,0 +1,121 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::collections::HashSet; + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct FreeListItemId(u32); + +impl FreeListItemId { + #[inline] + pub fn new(value: u32) -> FreeListItemId { + FreeListItemId(value) + } + + #[inline] + pub fn value(&self) -> u32 { + let FreeListItemId(value) = *self; + value + } +} + +pub trait FreeListItem { + fn next_free_id(&self) -> Option; + fn set_next_free_id(&mut self, id: Option); +} + +pub struct FreeList { + items: Vec, + first_free_index: Option, + alloc_count: usize, +} + +impl FreeList { + pub fn new() -> FreeList { + FreeList { + items: Vec::new(), + first_free_index: None, + alloc_count: 0, + } + } + + pub fn insert(&mut self, item: T) -> FreeListItemId { + self.alloc_count += 1; + match self.first_free_index { + Some(free_index) => { + let FreeListItemId(index) = free_index; + let free_item = &mut self.items[index as usize]; + self.first_free_index = free_item.next_free_id(); + *free_item = item; + free_index + } + None => { + let item_id = FreeListItemId(self.items.len() as u32); + self.items.push(item); + item_id + } + } + } + + #[allow(dead_code)] + fn assert_not_in_free_list(&self, id: FreeListItemId) { + let FreeListItemId(id) = id; + let mut next_free_id = self.first_free_index; + + while let Some(free_id) = next_free_id { + let FreeListItemId(index) = free_id; + assert!(index != id); + let free_item = &self.items[index as usize]; + next_free_id = free_item.next_free_id(); + } + } + + pub fn get(&self, id: FreeListItemId) -> &T { + //self.assert_not_in_free_list(id); + + let FreeListItemId(index) = id; + &self.items[index as usize] + } + + pub fn get_mut(&mut self, id: FreeListItemId) -> &mut T { + //self.assert_not_in_free_list(id); + + let FreeListItemId(index) = id; + &mut self.items[index as usize] + } + + #[allow(dead_code)] + pub fn len(&self) -> usize { + self.alloc_count + } + + // TODO(gw): Actually free items from the texture cache!! + #[allow(dead_code)] + pub fn free(&mut self, id: FreeListItemId) { + self.alloc_count -= 1; + let FreeListItemId(index) = id; + let item = &mut self.items[index as usize]; + item.set_next_free_id(self.first_free_index); + self.first_free_index = Some(id); + } + + pub fn for_each_item(&mut self, f: F) where F: Fn(&mut T) { + let mut free_ids = HashSet::new(); + + let mut next_free_id = self.first_free_index; + while let Some(free_id) = next_free_id { + free_ids.insert(free_id); + let FreeListItemId(index) = free_id; + let free_item = &self.items[index as usize]; + next_free_id = free_item.next_free_id(); + } + + for (index, mut item) in self.items.iter_mut().enumerate() { + let id = FreeListItemId(index as u32); + if !free_ids.contains(&id) { + f(&mut item); + } + } + } +} diff --git a/gfx/webrender/src/geometry.rs b/gfx/webrender/src/geometry.rs new file mode 100644 index 000000000000..2afa0d5c3e41 --- /dev/null +++ b/gfx/webrender/src/geometry.rs @@ -0,0 +1,121 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use euclid::{Rect, Point3D}; + +/* + A naive port of "An Efficient and Robust Ray–Box Intersection Algorithm" + from https://www.cs.utah.edu/~awilliam/box/box.pdf + + This should be cleaned up and extracted into more useful types! + */ + +// Assumes rect is in the z=0 plane! +pub fn ray_intersects_rect(ray_origin: Point3D, + ray_end: Point3D, + rect: Rect) -> bool { + let mut dir = ray_end - ray_origin; + let len = ((dir.x*dir.x) + (dir.y*dir.y) + (dir.z*dir.z)).sqrt(); + dir.x = dir.x / len; + dir.y = dir.y / len; + dir.z = dir.z / len; + let inv_direction = Point3D::new(1.0/dir.x, 1.0/dir.y, 1.0/dir.z); + + let sign = [ + if inv_direction.x < 0.0 { + 1 + } else { + 0 + }, + if inv_direction.y < 0.0 { + 1 + } else { + 0 + }, + if inv_direction.z < 0.0 { + 1 + } else { + 0 + }, + ]; + + let parameters = [ + Point3D::new(rect.origin.x, rect.origin.y, 0.0), + Point3D::new(rect.origin.x + rect.size.width, + rect.origin.y + rect.size.height, + 0.0), + ]; + + let mut tmin = (parameters[sign[0]].x - ray_origin.x) * inv_direction.x; + let mut tmax = (parameters[1-sign[0]].x - ray_origin.x) * inv_direction.x; + let tymin = (parameters[sign[1]].y - ray_origin.y) * inv_direction.y; + let tymax = (parameters[1-sign[1]].y - ray_origin.y) * inv_direction.y; + if (tmin > tymax) || (tymin > tmax) { + return false; + } + if tymin > tmin { + tmin = tymin; + } + if tymax < tmax { + tmax = tymax; + } + let tzmin = (parameters[sign[2]].z - ray_origin.z) * inv_direction.z; + let tzmax = (parameters[1-sign[2]].z - ray_origin.z) * inv_direction.z; + if (tmin > tzmax) || (tzmin > tmax) { + return false; + } + + // Don't care about where on the ray it hits... + true + + /* + if tzmin > tmin { + tmin = tzmin; + } + if tzmax < tmax { + tmax = tzmax; + } + + let t0 = 0.0; + let t1 = len; + + (tmin < t1) && (tmax > t0) + */ +} + +/* +pub fn circle_contains_rect(circle_center: &Point2D, + radius: f32, + rect: &Rect) -> bool { + let dx = (circle_center.x - rect.origin.x).max(rect.origin.x + rect.size.width - circle_center.x); + let dy = (circle_center.y - rect.origin.y).max(rect.origin.y + rect.size.height - circle_center.y); + radius * radius >= dx * dx + dy * dy +} + +pub fn rect_intersects_circle(circle_center: &Point2D, + radius: f32, + rect: &Rect) -> bool { + let circle_distance_x = (circle_center.x - (rect.origin.x + rect.size.width * 0.5)).abs(); + let circle_distance_y = (circle_center.y - (rect.origin.y + rect.size.height * 0.5)).abs(); + + if circle_distance_x > rect.size.width * 0.5 + radius { + return false + } + if circle_distance_y > rect.size.height * 0.5 + radius { + return false + } + + if circle_distance_x <= rect.size.width * 0.5 { + return true; + } + if circle_distance_y <= rect.size.height * 0.5 { + return true; + } + + let corner_distance_sq = (circle_distance_x - rect.size.width * 0.5) * (circle_distance_x - rect.size.width * 0.5) + + (circle_distance_y - rect.size.height * 0.5) * (circle_distance_y - rect.size.height * 0.5); + + corner_distance_sq <= radius * radius +} +*/ diff --git a/gfx/webrender/src/gpu_store.rs b/gfx/webrender/src/gpu_store.rs new file mode 100644 index 000000000000..6b2d2e157762 --- /dev/null +++ b/gfx/webrender/src/gpu_store.rs @@ -0,0 +1,94 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use renderer::MAX_VERTEX_TEXTURE_WIDTH; +use std::mem; + +#[derive(Debug, Copy, Clone, Eq, Hash, PartialEq)] +pub struct GpuStoreAddress(pub i32); + +/// A CPU-side buffer storing content to be uploaded to the GPU. +pub struct GpuStore { + data: Vec, + // TODO(gw): Could store this intrusively inside + // the data array free slots. + //free_list: Vec, +} + +impl GpuStore { + pub fn new() -> GpuStore { + GpuStore { + data: Vec::new(), + //free_list: Vec::new(), + } + } + + pub fn push(&mut self, data: E) -> GpuStoreAddress where T: From { + let address = GpuStoreAddress(self.data.len() as i32); + self.data.push(T::from(data)); + address + } + + // TODO(gw): Change this to do incremental updates, which means + // there is no need to copy all this data during every scroll! + pub fn build(&self) -> Vec { + let item_size = mem::size_of::(); + debug_assert!(item_size % 16 == 0); + let vecs_per_item = item_size / 16; + let items_per_row = MAX_VERTEX_TEXTURE_WIDTH / vecs_per_item; + + let mut items = self.data.clone(); + + // Extend the data array to be a multiple of the row size. + // This ensures memory safety when the array is passed to + // OpenGL to upload to the GPU. + while items.len() % items_per_row != 0 { + items.push(T::default()); + } + + items + } + + pub fn alloc(&mut self, count: usize) -> GpuStoreAddress { + let address = self.get_next_address(); + + for _ in 0..count { + self.data.push(T::default()); + } + + address + } + + pub fn get_next_address(&self) -> GpuStoreAddress { + GpuStoreAddress(self.data.len() as i32) + } + + pub fn get(&mut self, address: GpuStoreAddress) -> &T { + &self.data[address.0 as usize] + } + + pub fn get_mut(&mut self, address: GpuStoreAddress) -> &mut T { + &mut self.data[address.0 as usize] + } + + pub fn get_slice_mut(&mut self, + address: GpuStoreAddress, + count: usize) -> &mut [T] { + let offset = address.0 as usize; + &mut self.data[offset..offset + count] + } + + // TODO(gw): Implement incremental updates of + // GPU backed data, and support freelist for removing + // dynamic items. + + /* + pub fn free(&mut self, address: GpuStoreAddress) { + + } + + pub fn update(&mut self, address: GpuStoreAddress, data: T) { + + }*/ +} diff --git a/gfx/webrender/src/internal_types.rs b/gfx/webrender/src/internal_types.rs new file mode 100644 index 000000000000..2d05b7c1dc7c --- /dev/null +++ b/gfx/webrender/src/internal_types.rs @@ -0,0 +1,441 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use device::TextureFilter; +use euclid::{TypedPoint2D, UnknownUnit}; +use fnv::FnvHasher; +use offscreen_gl_context::{NativeGLContext, NativeGLContextHandle}; +use offscreen_gl_context::{GLContext, NativeGLContextMethods, GLContextDispatcher}; +use offscreen_gl_context::{OSMesaContext, OSMesaContextHandle}; +use offscreen_gl_context::{ColorAttachmentType, GLContextAttributes, GLLimits}; +use profiler::BackendProfileCounters; +use std::collections::{HashMap, HashSet}; +use std::f32; +use std::hash::BuildHasherDefault; +use std::{i32, usize}; +use std::path::PathBuf; +use std::sync::Arc; +use tiling; +use webrender_traits::{Epoch, ColorF, PipelineId, DeviceIntSize}; +use webrender_traits::{ImageFormat, MixBlendMode, NativeFontHandle}; +use webrender_traits::{ExternalImageId, ScrollLayerId, WebGLCommand}; + +// An ID for a texture that is owned by the +// texture cache module. This can include atlases +// or standalone textures allocated via the +// texture cache (e.g. if an image is too large +// to be added to an atlas). The texture cache +// manages the allocation and freeing of these +// IDs, and the rendering thread maintains a +// map from cache texture ID to native texture. + +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub struct CacheTextureId(pub usize); + +// Represents the source for a texture. +// These are passed from throughout the +// pipeline until they reach the rendering +// thread, where they are resolved to a +// native texture ID. + +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub enum SourceTexture { + Invalid, + TextureCache(CacheTextureId), + WebGL(u32), // Is actually a gl::GLuint + External(ExternalImageId), +} + +pub enum GLContextHandleWrapper { + Native(NativeGLContextHandle), + OSMesa(OSMesaContextHandle), +} + +impl GLContextHandleWrapper { + pub fn current_native_handle() -> Option { + NativeGLContext::current_handle().map(GLContextHandleWrapper::Native) + } + + pub fn current_osmesa_handle() -> Option { + OSMesaContext::current_handle().map(GLContextHandleWrapper::OSMesa) + } + + pub fn new_context(&self, + size: DeviceIntSize, + attributes: GLContextAttributes, + dispatcher: Option>) -> Result { + match *self { + GLContextHandleWrapper::Native(ref handle) => { + let ctx = GLContext::::new_shared_with_dispatcher(size.to_untyped(), + attributes, + ColorAttachmentType::Texture, + Some(handle), + dispatcher); + ctx.map(GLContextWrapper::Native) + } + GLContextHandleWrapper::OSMesa(ref handle) => { + let ctx = GLContext::::new_shared_with_dispatcher(size.to_untyped(), + attributes, + ColorAttachmentType::Texture, + Some(handle), + dispatcher); + ctx.map(GLContextWrapper::OSMesa) + } + } + } +} + +pub enum GLContextWrapper { + Native(GLContext), + OSMesa(GLContext), +} + +impl GLContextWrapper { + pub fn make_current(&self) { + match *self { + GLContextWrapper::Native(ref ctx) => { + ctx.make_current().unwrap(); + } + GLContextWrapper::OSMesa(ref ctx) => { + ctx.make_current().unwrap(); + } + } + } + + pub fn unbind(&self) { + match *self { + GLContextWrapper::Native(ref ctx) => { + ctx.unbind().unwrap(); + } + GLContextWrapper::OSMesa(ref ctx) => { + ctx.unbind().unwrap(); + } + } + } + + pub fn apply_command(&self, cmd: WebGLCommand) { + match *self { + GLContextWrapper::Native(ref ctx) => { + cmd.apply(ctx); + } + GLContextWrapper::OSMesa(ref ctx) => { + cmd.apply(ctx); + } + } + } + + pub fn get_info(&self) -> (DeviceIntSize, u32, GLLimits) { + match *self { + GLContextWrapper::Native(ref ctx) => { + let (real_size, texture_id) = { + let draw_buffer = ctx.borrow_draw_buffer().unwrap(); + (draw_buffer.size(), draw_buffer.get_bound_texture_id().unwrap()) + }; + + let limits = ctx.borrow_limits().clone(); + + (DeviceIntSize::from_untyped(&real_size), texture_id, limits) + } + GLContextWrapper::OSMesa(ref ctx) => { + let (real_size, texture_id) = { + let draw_buffer = ctx.borrow_draw_buffer().unwrap(); + (draw_buffer.size(), draw_buffer.get_bound_texture_id().unwrap()) + }; + + let limits = ctx.borrow_limits().clone(); + + (DeviceIntSize::from_untyped(&real_size), texture_id, limits) + } + } + } + + pub fn resize(&mut self, size: &DeviceIntSize) -> Result<(), &'static str> { + match *self { + GLContextWrapper::Native(ref mut ctx) => { + ctx.resize(size.to_untyped()) + } + GLContextWrapper::OSMesa(ref mut ctx) => { + ctx.resize(size.to_untyped()) + } + } + } +} + +const COLOR_FLOAT_TO_FIXED: f32 = 255.0; +pub const ANGLE_FLOAT_TO_FIXED: f32 = 65535.0; + +pub const ORTHO_NEAR_PLANE: f32 = -1000000.0; +pub const ORTHO_FAR_PLANE: f32 = 1000000.0; + +#[derive(Clone)] +pub enum FontTemplate { + Raw(Arc>), + Native(NativeFontHandle), +} + +#[derive(Debug, PartialEq, Eq)] +pub enum TextureSampler { + Color0, + Color1, + Color2, + Mask, + Cache, + Data16, + Data32, + Data64, + Data128, + Layers, + RenderTasks, + Geometry, + ResourceRects, +} + +impl TextureSampler { + pub fn color(n: usize) -> TextureSampler { + match n { + 0 => TextureSampler::Color0, + 1 => TextureSampler::Color1, + 2 => TextureSampler::Color2, + _ => { + panic!("There are only 3 color samplers."); + } + } + } +} + +/// Optional textures that can be used as a source in the shaders. +/// Textures that are not used by the batch are equal to TextureId::invalid(). +#[derive(Copy, Clone, Debug)] +pub struct BatchTextures { + pub colors: [SourceTexture; 3], +} + +impl BatchTextures { + pub fn no_texture() -> Self { + BatchTextures { + colors: [SourceTexture::Invalid; 3], + } + } +} + +// In some places we need to temporarily bind a texture to any slot. +pub const DEFAULT_TEXTURE: TextureSampler = TextureSampler::Color0; + +#[derive(Clone, Copy, Debug)] +pub enum VertexAttribute { + // vertex-frequency basic attributes + Position, + Color, + ColorTexCoord, + // instance-frequency primitive attributes + GlobalPrimId, + PrimitiveAddress, + TaskIndex, + ClipTaskIndex, + LayerIndex, + ElementIndex, + UserData, + ZIndex, +} + +#[derive(Clone, Copy, Debug)] +pub enum ClearAttribute { + // vertex frequency + Position, + // instance frequency + Rectangle, +} + +#[derive(Clone, Copy, Debug)] +pub enum BlurAttribute { + // vertex frequency + Position, + // instance frequency + RenderTaskIndex, + SourceTaskIndex, + Direction, +} + +#[derive(Clone, Copy, Debug)] +pub enum ClipAttribute { + // vertex frequency + Position, + // instance frequency + RenderTaskIndex, + LayerIndex, + DataIndex, + SegmentIndex, +} + +#[derive(Debug, Clone, Copy)] +#[repr(C)] +pub struct PackedColor { + pub r: u8, + pub g: u8, + pub b: u8, + pub a: u8, +} + +impl PackedColor { + pub fn from_color(color: &ColorF) -> PackedColor { + PackedColor { + r: (0.5 + color.r * COLOR_FLOAT_TO_FIXED).floor() as u8, + g: (0.5 + color.g * COLOR_FLOAT_TO_FIXED).floor() as u8, + b: (0.5 + color.b * COLOR_FLOAT_TO_FIXED).floor() as u8, + a: (0.5 + color.a * COLOR_FLOAT_TO_FIXED).floor() as u8, + } + } +} + +#[derive(Debug, Clone, Copy)] +#[repr(C)] +pub struct PackedVertex { + pub pos: [f32; 2], +} + +#[derive(Debug)] +#[repr(C)] +pub struct DebugFontVertex { + pub x: f32, + pub y: f32, + pub color: PackedColor, + pub u: f32, + pub v: f32, +} + +impl DebugFontVertex { + pub fn new(x: f32, y: f32, u: f32, v: f32, color: PackedColor) -> DebugFontVertex { + DebugFontVertex { + x: x, + y: y, + color: color, + u: u, + v: v, + } + } +} + +#[repr(C)] +pub struct DebugColorVertex { + pub x: f32, + pub y: f32, + pub color: PackedColor, +} + +impl DebugColorVertex { + pub fn new(x: f32, y: f32, color: PackedColor) -> DebugColorVertex { + DebugColorVertex { + x: x, + y: y, + color: color, + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum RenderTargetMode { + None, + SimpleRenderTarget, + LayerRenderTarget(i32), // Number of texture layers +} + +pub enum TextureUpdateOp { + Create(u32, u32, ImageFormat, TextureFilter, RenderTargetMode, Option>>), + Update(u32, u32, u32, u32, Arc>, Option), + Grow(u32, u32, ImageFormat, TextureFilter, RenderTargetMode), + Free +} + +pub type ExternalImageUpdateList = Vec; + +pub struct TextureUpdate { + pub id: CacheTextureId, + pub op: TextureUpdateOp, +} + +pub struct TextureUpdateList { + pub updates: Vec, +} + +impl TextureUpdateList { + pub fn new() -> TextureUpdateList { + TextureUpdateList { + updates: Vec::new(), + } + } + + #[inline] + pub fn push(&mut self, update: TextureUpdate) { + self.updates.push(update); + } +} + +/// Mostly wraps a tiling::Frame, adding a bit of extra information. +pub struct RendererFrame { + /// The last rendered epoch for each pipeline present in the frame. + /// This information is used to know if a certain transformation on the layout has + /// been rendered, which is necessary for reftests. + pub pipeline_epoch_map: HashMap>, + /// The layers that are currently affected by the over-scrolling animation. + pub layers_bouncing_back: HashSet>, + + pub frame: Option, +} + +impl RendererFrame { + pub fn new(pipeline_epoch_map: HashMap>, + layers_bouncing_back: HashSet>, + frame: Option) + -> RendererFrame { + RendererFrame { + pipeline_epoch_map: pipeline_epoch_map, + layers_bouncing_back: layers_bouncing_back, + frame: frame, + } + } +} + +pub enum ResultMsg { + RefreshShader(PathBuf), + NewFrame(RendererFrame, TextureUpdateList, ExternalImageUpdateList, BackendProfileCounters), +} + +#[repr(u32)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum AxisDirection { + Horizontal, + Vertical, +} + +#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq)] +pub struct StackingContextIndex(pub usize); + +#[derive(Clone, Copy, Debug)] +pub struct RectUv { + pub top_left: TypedPoint2D, + pub top_right: TypedPoint2D, + pub bottom_left: TypedPoint2D, + pub bottom_right: TypedPoint2D, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum LowLevelFilterOp { + Blur(Au, AxisDirection), + Brightness(Au), + Contrast(Au), + Grayscale(Au), + /// Fixed-point in `ANGLE_FLOAT_TO_FIXED` units. + HueRotate(i32), + Invert(Au), + Opacity(Au), + Saturate(Au), + Sepia(Au), +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum CompositionOp { + MixBlend(MixBlendMode), + Filter(LowLevelFilterOp), +} \ No newline at end of file diff --git a/gfx/webrender/src/layer.rs b/gfx/webrender/src/layer.rs new file mode 100644 index 000000000000..45a27726b3f0 --- /dev/null +++ b/gfx/webrender/src/layer.rs @@ -0,0 +1,279 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use euclid::Point3D; +use geometry::ray_intersects_rect; +use spring::{DAMPING, STIFFNESS, Spring}; +use webrender_traits::{LayerPoint, LayerRect, LayerSize, LayerToScrollTransform}; +use webrender_traits::{LayerToWorldTransform, PipelineId, ScrollEventPhase, ScrollLayerId}; +use webrender_traits::{ScrollLayerRect, ScrollLocation, ScrollToWorldTransform, WorldPoint}; +use webrender_traits::{WorldPoint4D}; + +#[cfg(target_os = "macos")] +const CAN_OVERSCROLL: bool = true; + +#[cfg(not(target_os = "macos"))] +const CAN_OVERSCROLL: bool = false; + + +/// Contains scrolling and transform information stacking contexts. +#[derive(Clone)] +pub struct Layer { + /// Manages scrolling offset, overscroll state etc. + pub scrolling: ScrollingState, + + /// Size of the content inside the scroll region (in logical pixels) + pub content_size: LayerSize, + + /// Viewing rectangle + pub local_viewport_rect: LayerRect, + + /// Viewing rectangle clipped against parent layer(s) + pub combined_local_viewport_rect: LayerRect, + + /// World transform for the viewport rect itself. + pub world_viewport_transform: LayerToWorldTransform, + + /// World transform for content within this layer + pub world_content_transform: LayerToWorldTransform, + + /// Transform for this layer, relative to parent scrollable layer. + pub local_transform: LayerToScrollTransform, + + /// Pipeline that this layer belongs to + pub pipeline_id: PipelineId, + + /// Child layers + pub children: Vec, +} + +impl Layer { + pub fn new(local_viewport_rect: &LayerRect, + content_size: LayerSize, + local_transform: &LayerToScrollTransform, + pipeline_id: PipelineId) + -> Layer { + Layer { + scrolling: ScrollingState::new(), + content_size: content_size, + local_viewport_rect: *local_viewport_rect, + combined_local_viewport_rect: *local_viewport_rect, + world_viewport_transform: LayerToWorldTransform::identity(), + world_content_transform: LayerToWorldTransform::identity(), + local_transform: *local_transform, + children: Vec::new(), + pipeline_id: pipeline_id, + } + } + + pub fn add_child(&mut self, child: ScrollLayerId) { + self.children.push(child); + } + + pub fn finalize(&mut self, scrolling: &ScrollingState) { + self.scrolling = *scrolling; + } + + pub fn overscroll_amount(&self) -> LayerSize { + let scrollable_width = self.scrollable_width(); + let overscroll_x = if self.scrolling.offset.x > 0.0 { + -self.scrolling.offset.x + } else if self.scrolling.offset.x < -scrollable_width { + -scrollable_width - self.scrolling.offset.x + } else { + 0.0 + }; + + let scrollable_height = self.scrollable_height(); + let overscroll_y = if self.scrolling.offset.y > 0.0 { + -self.scrolling.offset.y + } else if self.scrolling.offset.y < -scrollable_height { + -scrollable_height - self.scrolling.offset.y + } else { + 0.0 + }; + + LayerSize::new(overscroll_x, overscroll_y) + } + + pub fn set_scroll_origin(&mut self, origin: &LayerPoint) -> bool { + let scrollable_height = self.scrollable_height(); + let scrollable_width = self.scrollable_width(); + if scrollable_height <= 0. && scrollable_width <= 0. { + return false; + } + + let new_offset = LayerPoint::new((-origin.x).max(-scrollable_width).min(0.0).round(), + (-origin.y).max(-scrollable_height).min(0.0).round()); + if new_offset == self.scrolling.offset { + return false; + } + + self.scrolling.offset = new_offset; + self.scrolling.bouncing_back = false; + self.scrolling.started_bouncing_back = false; + return true; + } + + pub fn update_transform(&mut self, + parent_world_transform: &ScrollToWorldTransform, + parent_viewport_rect: &ScrollLayerRect) { + let inv_transform = self.local_transform.inverse().unwrap(); + let parent_viewport_rect_in_local_space = inv_transform.transform_rect(parent_viewport_rect) + .translate(&-self.scrolling.offset); + let local_viewport_rect = self.local_viewport_rect.translate(&-self.scrolling.offset); + let viewport_rect = parent_viewport_rect_in_local_space.intersection(&local_viewport_rect) + .unwrap_or(LayerRect::zero()); + + self.combined_local_viewport_rect = viewport_rect; + self.world_viewport_transform = parent_world_transform.pre_mul(&self.local_transform); + self.world_content_transform = self.world_viewport_transform + .pre_translated(self.scrolling.offset.x, + self.scrolling.offset.y, + 0.0); + } + + pub fn scrollable_height(&self) -> f32 { + self.content_size.height - self.local_viewport_rect.size.height + } + + pub fn scrollable_width(&self) -> f32 { + self.content_size.width - self.local_viewport_rect.size.width + } + + pub fn scroll(&mut self, scroll_location: ScrollLocation, phase: ScrollEventPhase) -> bool { + if self.scrolling.started_bouncing_back && phase == ScrollEventPhase::Move(false) { + return false; + } + + let mut delta = match scroll_location { + ScrollLocation::Delta(delta) => delta, + ScrollLocation::Start => { + if self.scrolling.offset.y.round() >= 0.0 { + // Nothing to do on this layer. + return false; + } + + self.scrolling.offset.y = 0.0; + return true; + }, + ScrollLocation::End => { + let end_pos = self.local_viewport_rect.size.height - self.content_size.height; + + if self.scrolling.offset.y.round() <= end_pos { + // Nothing to do on this layer. + return false; + } + + self.scrolling.offset.y = end_pos; + return true; + } + }; + + let overscroll_amount = self.overscroll_amount(); + let overscrolling = CAN_OVERSCROLL && (overscroll_amount.width != 0.0 || + overscroll_amount.height != 0.0); + if overscrolling { + if overscroll_amount.width != 0.0 { + delta.x /= overscroll_amount.width.abs() + } + if overscroll_amount.height != 0.0 { + delta.y /= overscroll_amount.height.abs() + } + } + + let scrollable_width = self.scrollable_width(); + let scrollable_height = self.scrollable_height(); + let is_unscrollable = scrollable_width <= 0. && scrollable_height <= 0.; + let original_layer_scroll_offset = self.scrolling.offset; + + if scrollable_width > 0. { + self.scrolling.offset.x = self.scrolling.offset.x + delta.x; + if is_unscrollable || !CAN_OVERSCROLL { + self.scrolling.offset.x = + self.scrolling.offset.x.min(0.0).max(-scrollable_width).round(); + } + } + + if scrollable_height > 0. { + self.scrolling.offset.y = self.scrolling.offset.y + delta.y; + if is_unscrollable || !CAN_OVERSCROLL { + self.scrolling.offset.y = + self.scrolling.offset.y.min(0.0).max(-scrollable_height).round(); + } + } + + if phase == ScrollEventPhase::Start || phase == ScrollEventPhase::Move(true) { + self.scrolling.started_bouncing_back = false + } else if overscrolling && + ((delta.x < 1.0 && delta.y < 1.0) || phase == ScrollEventPhase::End) { + self.scrolling.started_bouncing_back = true; + self.scrolling.bouncing_back = true + } + + if CAN_OVERSCROLL { + self.stretch_overscroll_spring(); + } + + self.scrolling.offset != original_layer_scroll_offset || + self.scrolling.started_bouncing_back + } + + pub fn stretch_overscroll_spring(&mut self) { + let overscroll_amount = self.overscroll_amount(); + self.scrolling.spring.coords(self.scrolling.offset, + self.scrolling.offset, + self.scrolling.offset + overscroll_amount); + } + + pub fn tick_scrolling_bounce_animation(&mut self) { + let finished = self.scrolling.spring.animate(); + self.scrolling.offset = self.scrolling.spring.current(); + if finished { + self.scrolling.bouncing_back = false + } + } + + pub fn ray_intersects_layer(&self, cursor: &WorldPoint) -> bool { + let inv = self.world_viewport_transform.inverse().unwrap(); + let z0 = -10000.0; + let z1 = 10000.0; + + let p0 = inv.transform_point4d(&WorldPoint4D::new(cursor.x, cursor.y, z0, 1.0)); + let p0 = Point3D::new(p0.x / p0.w, + p0.y / p0.w, + p0.z / p0.w); + let p1 = inv.transform_point4d(&WorldPoint4D::new(cursor.x, cursor.y, z1, 1.0)); + let p1 = Point3D::new(p1.x / p1.w, + p1.y / p1.w, + p1.z / p1.w); + + if self.scrollable_width() <= 0. && self.scrollable_height() <= 0. { + return false; + } + ray_intersects_rect(p0, p1, self.local_viewport_rect.to_untyped()) + } +} + +#[derive(Copy, Clone)] +pub struct ScrollingState { + pub offset: LayerPoint, + pub spring: Spring, + pub started_bouncing_back: bool, + pub bouncing_back: bool, + pub should_handoff_scroll: bool +} + +impl ScrollingState { + pub fn new() -> ScrollingState { + ScrollingState { + offset: LayerPoint::zero(), + spring: Spring::at(LayerPoint::zero(), STIFFNESS, DAMPING), + started_bouncing_back: false, + bouncing_back: false, + should_handoff_scroll: false + } + } +} + diff --git a/gfx/webrender/src/lib.rs b/gfx/webrender/src/lib.rs new file mode 100644 index 000000000000..a4d0f7709039 --- /dev/null +++ b/gfx/webrender/src/lib.rs @@ -0,0 +1,131 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//#![feature(mpsc_select)] + +//! A GPU based Webrender. +//! +//! It serves as an experimental render backend for [Servo](https://servo.org/), +//! but it can also be used as such in a standalone application. +//! +//! # External dependencies +//! Webrender currently depends on [FreeType](https://www.freetype.org/) +//! +//! # Api Structure +//! The main entry point to webrender is the `webrender::renderer::Renderer`. +//! +//! By calling `Renderer::new(...)` you get a `Renderer`, as well as a `RenderApiSender`. +//! Your `Renderer` is responsible to render the previously processed frames onto the screen. +//! +//! By calling `yourRenderApiSenderInstance.create_api()`, you'll get a `RenderApi` instance, +//! which is responsible for the processing of new frames. A worker thread is used internally to +//! untie the workload from the application thread and therefore be able +//! to make better use of multicore systems. +//! +//! What is referred to as a `frame`, is the current geometry on the screen. +//! A new Frame is created by calling [set_root_stacking_context()][newframe] on the `RenderApi`. +//! When the geometry is processed, the application will be informed via a `RenderNotifier`, +//! a callback which you employ with [set_render_notifier][notifier] on the `Renderer` +//! More information about [stacking contexts][stacking_contexts]. +//! +//! `set_root_stacking_context()` also needs to be supplied with `BuiltDisplayList`s. +//! These are obtained by finalizing a `DisplayListBuilder`. These are used to draw your geometry. +//! But it doesn't only contain trivial geometry, it can also store another StackingContext, as +//! they're nestable. +//! +//! Remember to insert the DisplayListId into the StackingContext as well, as they'll be referenced +//! from there. An Id for your DisplayList can be obtained by calling +//! `yourRenderApiInstance.next_display_list_id();` +//! +//! [stacking_contexts]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context +//! [newframe]: ../webrender_traits/struct.RenderApi.html#method.set_root_stacking_context +//! [notifier]: struct.Renderer.html#method.set_render_notifier + +#[macro_use] +extern crate lazy_static; +#[macro_use] +extern crate log; +#[macro_use] +extern crate bitflags; + +mod batch_builder; +mod debug_colors; +mod debug_font_data; +mod debug_render; +mod device; +mod frame; +mod freelist; +mod geometry; +mod gpu_store; +mod internal_types; +mod layer; +mod mask_cache; +mod prim_store; +mod profiler; +mod record; +mod render_backend; +mod resource_cache; +mod scene; +mod scroll_tree; +mod spring; +mod texture_cache; +mod tiling; +mod util; + +mod shader_source { + include!(concat!(env!("OUT_DIR"), "/shaders.rs")); +} + +pub use record::{ApiRecordingReceiver, set_recording_detour, WEBRENDER_RECORDING_HEADER}; + +mod platform { + #[cfg(target_os="macos")] + pub use platform::macos::font; + #[cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))] + pub use platform::unix::font; + #[cfg(target_os = "windows")] + pub use platform::windows::font; + + #[cfg(target_os="macos")] + pub mod macos { + pub mod font; + } + #[cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))] + pub mod unix { + pub mod font; + } + #[cfg(target_os = "windows")] + pub mod windows { + pub mod font; + } +} + +pub mod renderer; + +#[cfg(target_os="macos")] +extern crate core_graphics; +#[cfg(target_os="macos")] +extern crate core_text; + +#[cfg(all(unix, not(target_os="macos")))] +extern crate freetype; + +#[cfg(target_os = "windows")] +extern crate dwrote; + +extern crate app_units; +extern crate bincode; +extern crate euclid; +extern crate fnv; +extern crate gleam; +extern crate num_traits; +//extern crate notify; +extern crate time; +extern crate webrender_traits; +extern crate offscreen_gl_context; +extern crate byteorder; +extern crate threadpool; + +pub use renderer::{ExternalImage, ExternalImageSource, ExternalImageHandler}; +pub use renderer::{Renderer, RendererOptions}; diff --git a/gfx/webrender/src/mask_cache.rs b/gfx/webrender/src/mask_cache.rs new file mode 100644 index 000000000000..fd458bbfe85f --- /dev/null +++ b/gfx/webrender/src/mask_cache.rs @@ -0,0 +1,157 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use gpu_store::{GpuStore, GpuStoreAddress}; +use prim_store::{ClipData, GpuBlock32, PrimitiveStore}; +use prim_store::{CLIP_DATA_GPU_SIZE, MASK_DATA_GPU_SIZE}; +use util::{rect_from_points_f, TransformedRect}; +use webrender_traits::{AuxiliaryLists, BorderRadius, ClipRegion, ComplexClipRegion, ImageMask}; +use webrender_traits::{DeviceIntRect, DeviceIntSize, LayerRect, LayerToWorldTransform}; + +const MAX_COORD: f32 = 1.0e+16; + +#[derive(Clone, Debug)] +pub enum ClipSource { + NoClip, + Complex(LayerRect, f32), + Region(ClipRegion), +} + +impl ClipSource { + pub fn to_rect(&self) -> Option { + match self { + &ClipSource::NoClip => None, + &ClipSource::Complex(rect, _) => Some(rect), + &ClipSource::Region(ref region) => Some(region.main), + } + } +} +impl<'a> From<&'a ClipRegion> for ClipSource { + fn from(clip_region: &'a ClipRegion) -> ClipSource { + if clip_region.is_complex() { + ClipSource::Region(clip_region.clone()) + } else { + ClipSource::NoClip + } + } +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub struct ClipAddressRange { + pub start: GpuStoreAddress, + pub item_count: u32, +} + +#[derive(Clone, Debug)] +pub struct MaskCacheInfo { + pub clip_range: ClipAddressRange, + pub image: Option<(ImageMask, GpuStoreAddress)>, + pub local_rect: Option, + pub local_inner: Option, + pub inner_rect: DeviceIntRect, + pub outer_rect: DeviceIntRect, +} + +impl MaskCacheInfo { + /// Create a new mask cache info. It allocates the GPU store data but leaves + /// it unitialized for the following `update()` call to deal with. + pub fn new(source: &ClipSource, + clip_store: &mut GpuStore) + -> Option { + let (image, clip_range) = match source { + &ClipSource::NoClip => return None, + &ClipSource::Complex(..) => ( + None, + ClipAddressRange { + start: clip_store.alloc(CLIP_DATA_GPU_SIZE), + item_count: 1, + } + ), + &ClipSource::Region(ref region) => ( + region.image_mask.map(|info| + (info, clip_store.alloc(MASK_DATA_GPU_SIZE)) + ), + ClipAddressRange { + start: if region.complex.length > 0 { + clip_store.alloc(CLIP_DATA_GPU_SIZE * region.complex.length) + } else { + GpuStoreAddress(0) + }, + item_count: region.complex.length as u32, + } + ), + }; + + Some(MaskCacheInfo { + clip_range: clip_range, + image: image, + local_rect: None, + local_inner: None, + inner_rect: DeviceIntRect::zero(), + outer_rect: DeviceIntRect::zero(), + }) + } + + pub fn update(&mut self, + source: &ClipSource, + transform: &LayerToWorldTransform, + clip_store: &mut GpuStore, + device_pixel_ratio: f32, + aux_lists: &AuxiliaryLists) { + + if self.local_rect.is_none() { + let mut local_rect; + let mut local_inner: Option; + match source { + &ClipSource::NoClip => unreachable!(), + &ClipSource::Complex(rect, radius) => { + let slice = clip_store.get_slice_mut(self.clip_range.start, CLIP_DATA_GPU_SIZE); + let data = ClipData::uniform(rect, radius); + PrimitiveStore::populate_clip_data(slice, data); + debug_assert_eq!(self.clip_range.item_count, 1); + local_rect = Some(rect); + local_inner = ComplexClipRegion::new(rect, BorderRadius::uniform(radius)) + .get_inner_rect(); + } + &ClipSource::Region(ref region) => { + local_rect = Some(LayerRect::from_untyped(&rect_from_points_f(-MAX_COORD, -MAX_COORD, MAX_COORD, MAX_COORD))); + local_inner = match region.image_mask { + Some(ref mask) if !mask.repeat => { + local_rect = local_rect.and_then(|r| r.intersection(&mask.rect)); + None + }, + Some(_) => None, + None => local_rect, + }; + let clips = aux_lists.complex_clip_regions(®ion.complex); + assert_eq!(self.clip_range.item_count, clips.len() as u32); + let slice = clip_store.get_slice_mut(self.clip_range.start, CLIP_DATA_GPU_SIZE * clips.len()); + for (clip, chunk) in clips.iter().zip(slice.chunks_mut(CLIP_DATA_GPU_SIZE)) { + let data = ClipData::from_clip_region(clip); + PrimitiveStore::populate_clip_data(chunk, data); + local_rect = local_rect.and_then(|r| r.intersection(&clip.rect)); + local_inner = local_inner.and_then(|r| clip.get_inner_rect() + .and_then(|ref inner| r.intersection(&inner))); + } + } + }; + self.local_rect = Some(local_rect.unwrap_or(LayerRect::zero())); + self.local_inner = local_inner; + } + + let transformed = TransformedRect::new(self.local_rect.as_ref().unwrap(), + &transform, + device_pixel_ratio); + self.outer_rect = transformed.bounding_rect; + + self.inner_rect = if let Some(ref inner_rect) = self.local_inner { + let transformed = TransformedRect::new(inner_rect, + &transform, + device_pixel_ratio); + transformed.inner_rect + } else { + DeviceIntRect::new(self.outer_rect.origin, DeviceIntSize::zero()) + } + } +} diff --git a/gfx/webrender/src/platform/macos/font.rs b/gfx/webrender/src/platform/macos/font.rs new file mode 100644 index 000000000000..fba16d676dda --- /dev/null +++ b/gfx/webrender/src/platform/macos/font.rs @@ -0,0 +1,302 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use core_graphics::base::{kCGImageAlphaNoneSkipFirst, kCGImageAlphaPremultipliedLast}; +use core_graphics::base::kCGBitmapByteOrder32Little; +use core_graphics::color_space::CGColorSpace; +use core_graphics::context::{CGContext, CGTextDrawingMode}; +use core_graphics::data_provider::CGDataProvider; +use core_graphics::font::{CGFont, CGGlyph}; +use core_graphics::geometry::{CGPoint, CGSize, CGRect}; +use core_text::font::CTFont; +use core_text::font_descriptor::kCTFontDefaultOrientation; +use core_text; +use std::collections::HashMap; +use std::collections::hash_map::Entry; +use webrender_traits::{ColorU, FontKey, FontRenderMode, GlyphDimensions}; + +pub type NativeFontHandle = CGFont; + +pub struct FontContext { + cg_fonts: HashMap, + ct_fonts: HashMap<(FontKey, Au), CTFont>, +} + +pub struct RasterizedGlyph { + pub width: u32, + pub height: u32, + pub bytes: Vec, +} + +impl RasterizedGlyph { + pub fn blank() -> RasterizedGlyph { + RasterizedGlyph { + width: 0, + height: 0, + bytes: vec![], + } + } +} + +struct GlyphMetrics { + rasterized_left: i32, + rasterized_descent: i32, + rasterized_ascent: i32, + rasterized_width: u32, + rasterized_height: u32, +} + +// According to the Skia source code, there's no public API to +// determine if subpixel AA is supported. So jrmuizel ported +// this function from Skia which is used to check if a glyph +// can be rendered with subpixel AA. +fn supports_subpixel_aa() -> bool { + let mut cg_context = CGContext::create_bitmap_context(1, 1, 8, 4, + &CGColorSpace::create_device_rgb(), + kCGImageAlphaNoneSkipFirst | + kCGBitmapByteOrder32Little); + let ct_font = core_text::font::new_from_name("Helvetica", 16.).unwrap(); + cg_context.set_should_smooth_fonts(true); + cg_context.set_should_antialias(true); + cg_context.set_allows_font_smoothing(true); + cg_context.set_rgb_fill_color(1.0, 1.0, 1.0, 1.0); + let point = CGPoint {x: -1., y: 0.}; + let glyph = '|' as CGGlyph; + ct_font.draw_glyphs(&[glyph], &[point], cg_context.clone()); + let data = cg_context.data(); + data[0] != data[1] || data[1] != data[2] +} + +fn get_glyph_metrics(ct_font: &CTFont, glyph: CGGlyph) -> GlyphMetrics { + let bounds = ct_font.get_bounding_rects_for_glyphs(kCTFontDefaultOrientation, &[glyph]); + + let rasterized_left = bounds.origin.x.floor() as i32; + let rasterized_width = + (bounds.origin.x - (rasterized_left as f64) + bounds.size.width).ceil() as u32; + let rasterized_descent = (-bounds.origin.y).ceil() as i32; + let rasterized_ascent = (bounds.size.height + bounds.origin.y).ceil() as i32; + let rasterized_height = (rasterized_descent + rasterized_ascent) as u32; + + GlyphMetrics { + rasterized_ascent: rasterized_ascent, + rasterized_descent: rasterized_descent, + rasterized_left: rasterized_left, + rasterized_width: rasterized_width, + rasterized_height: rasterized_height, + } +} + +impl FontContext { + pub fn new() -> FontContext { + debug!("Test for subpixel AA support: {}", supports_subpixel_aa()); + + FontContext { + cg_fonts: HashMap::new(), + ct_fonts: HashMap::new(), + } + } + + pub fn add_raw_font(&mut self, font_key: &FontKey, bytes: &[u8]) { + if self.cg_fonts.contains_key(font_key) { + return + } + + let data_provider = CGDataProvider::from_buffer(bytes); + let cg_font = match CGFont::from_data_provider(data_provider) { + Err(_) => return, + Ok(cg_font) => cg_font, + }; + self.cg_fonts.insert((*font_key).clone(), cg_font); + } + + pub fn add_native_font(&mut self, font_key: &FontKey, native_font_handle: CGFont) { + if self.cg_fonts.contains_key(font_key) { + return + } + + self.cg_fonts.insert((*font_key).clone(), native_font_handle); + } + + fn get_ct_font(&mut self, + font_key: FontKey, + size: Au) -> Option { + match self.ct_fonts.entry(((font_key).clone(), size)) { + Entry::Occupied(entry) => Some((*entry.get()).clone()), + Entry::Vacant(entry) => { + let cg_font = match self.cg_fonts.get(&font_key) { + None => return None, + Some(cg_font) => cg_font, + }; + let ct_font = core_text::font::new_from_CGFont( + cg_font, + size.to_f64_px()); + entry.insert(ct_font.clone()); + Some(ct_font) + } + } + } + + pub fn get_glyph_dimensions(&mut self, + font_key: FontKey, + size: Au, + character: u32) -> Option { + self.get_ct_font(font_key, size).and_then(|ref ct_font| { + let glyph = character as CGGlyph; + let metrics = get_glyph_metrics(ct_font, glyph); + if metrics.rasterized_width == 0 || metrics.rasterized_height == 0 { + None + } else { + Some(GlyphDimensions { + left: metrics.rasterized_left, + top: metrics.rasterized_ascent, + width: metrics.rasterized_width as u32, + height: metrics.rasterized_height as u32, + }) + } + }) + } + + #[allow(dead_code)] + fn print_glyph_data(&mut self, data: &Vec, width: usize, height: usize) { + // Rust doesn't have step_by support on stable :( + for i in 0..height { + let current_height = i * width * 4; + + for pixel in data[current_height .. current_height + (width * 4)].chunks(4) { + let b = pixel[0]; + let g = pixel[1]; + let r = pixel[2]; + let a = pixel[3]; + print!("({}, {}, {}, {}) ", r, g, b, a); + } + println!(""); + } + } + + pub fn rasterize_glyph(&mut self, + font_key: FontKey, + size: Au, + color: ColorU, + character: u32, + render_mode: FontRenderMode) -> Option { + match self.get_ct_font(font_key, size) { + Some(ref ct_font) => { + let glyph = character as CGGlyph; + let metrics = get_glyph_metrics(ct_font, glyph); + if metrics.rasterized_width == 0 || metrics.rasterized_height == 0 { + return Some(RasterizedGlyph::blank()) + } + + let context_flags = match render_mode { + FontRenderMode::Subpixel => kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, + FontRenderMode::Alpha | FontRenderMode::Mono => kCGImageAlphaPremultipliedLast, + }; + + let mut cg_context = CGContext::create_bitmap_context(metrics.rasterized_width as usize, + metrics.rasterized_height as usize, + 8, + metrics.rasterized_width as usize * 4, + &CGColorSpace::create_device_rgb(), + context_flags); + + + // Tested on mac OS Sierra, 10.12 + // For Mono + alpha, the only values that matter are the alpha values. + // For subpixel, we need each individual rgb channel. + // CG has two individual glyphs for subpixel AA (pre-10.11, this is not true): + // 1) black text on white opaque background + // 2) white text on black opaque background + // Gecko does (1). Note, the BG must be opaque for subpixel AA to work. + // See https://bugzilla.mozilla.org/show_bug.cgi?id=1230366#c35 + // + // For grayscale / mono, CG still produces two glyphs, but it doesn't matter + // 1) black text on transparent white - only alpha values filled + // 2) white text on transparent black - channels == alpha + // + // If we draw grayscale/mono on an opaque background + // the RGB channels are the alpha values from transparent backgrounds + // with the alpha set as opaque. + // At the end of all this, WR expects individual RGB channels and ignores alpha + // for subpixel AA. + // For alpha/mono, WR ignores all channels other than alpha. + // Also note that WR expects text to be black bg with white text, so invert + // when we draw the glyphs. + let (antialias, smooth) = match render_mode { + FontRenderMode::Subpixel => (true, true), + FontRenderMode::Alpha => (true, false), + FontRenderMode::Mono => (false, false), + }; + + // These are always true in Gecko, even for non-AA fonts + cg_context.set_allows_font_subpixel_positioning(true); + cg_context.set_should_subpixel_position_fonts(true); + + cg_context.set_allows_font_smoothing(smooth); + cg_context.set_should_smooth_fonts(smooth); + cg_context.set_allows_antialiasing(antialias); + cg_context.set_should_antialias(antialias); + + let rasterization_origin = CGPoint { + x: -metrics.rasterized_left as f64, + y: metrics.rasterized_descent as f64, + }; + + // Always draw black text on a white background + // Fill the background + cg_context.set_rgb_fill_color(1.0, 1.0, 1.0, 1.0); + let rect = CGRect { + origin: CGPoint { + x: 0.0, + y: 0.0, + }, + size: CGSize { + width: metrics.rasterized_width as f64, + height: metrics.rasterized_height as f64, + } + }; + cg_context.fill_rect(rect); + + // Set the text color + cg_context.set_rgb_fill_color(0.0, 0.0, 0.0, 1.0); + cg_context.set_text_drawing_mode(CGTextDrawingMode::CGTextFill); + ct_font.draw_glyphs(&[glyph], &[rasterization_origin], cg_context.clone()); + + let mut rasterized_pixels = cg_context.data().to_vec(); + + // We need to invert the pixels back since right now + // transparent pixels are actually opaque white. + for i in 0..metrics.rasterized_height { + let current_height = (i * metrics.rasterized_width * 4) as usize; + let end_row = current_height + (metrics.rasterized_width as usize * 4); + + for mut pixel in rasterized_pixels[current_height .. end_row].chunks_mut(4) { + pixel[0] = 255 - pixel[0]; + pixel[1] = 255 - pixel[1]; + pixel[2] = 255 - pixel[2]; + + pixel[3] = match render_mode { + FontRenderMode::Subpixel => 255, + _ => { + assert_eq!(pixel[0], pixel[1]); + assert_eq!(pixel[0], pixel[2]); + pixel[0] + } + }; // end match + } // end row + } // end height + + Some(RasterizedGlyph { + width: metrics.rasterized_width, + height: metrics.rasterized_height, + bytes: rasterized_pixels, + }) + } + None => { + return Some(RasterizedGlyph::blank()); + } + } + } +} + diff --git a/gfx/webrender/src/platform/unix/font.rs b/gfx/webrender/src/platform/unix/font.rs new file mode 100644 index 000000000000..cd7038186e1f --- /dev/null +++ b/gfx/webrender/src/platform/unix/font.rs @@ -0,0 +1,256 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use webrender_traits::{FontKey, ColorU, FontRenderMode, GlyphDimensions, NativeFontHandle}; + +use freetype::freetype::{FT_Render_Mode, FT_Pixel_Mode}; +use freetype::freetype::{FT_Done_FreeType, FT_Library_SetLcdFilter}; +use freetype::freetype::{FT_Library, FT_Set_Char_Size}; +use freetype::freetype::{FT_Face, FT_Long, FT_UInt, FT_F26Dot6}; +use freetype::freetype::{FT_Init_FreeType, FT_Load_Glyph, FT_Render_Glyph}; +use freetype::freetype::{FT_New_Memory_Face, FT_GlyphSlot, FT_LcdFilter}; + +use std::{mem, ptr, slice}; +use std::collections::HashMap; + +struct Face { + face: FT_Face, +} + +pub struct FontContext { + lib: FT_Library, + faces: HashMap, +} + +pub struct RasterizedGlyph { + pub width: u32, + pub height: u32, + pub bytes: Vec, +} + +fn float_to_fixed(before: usize, f: f64) -> i32 { + ((1i32 << before) as f64 * f) as i32 +} + +fn float_to_fixed_ft(f: f64) -> i32 { + float_to_fixed(6, f) +} + +impl FontContext { + pub fn new() -> FontContext { +// let _pf = util::ProfileScope::new(" FontContext::new"); + let mut lib: FT_Library = ptr::null_mut(); + unsafe { + let result = FT_Init_FreeType(&mut lib); + if !result.succeeded() { + panic!("Unable to initialize FreeType library {:?}", result); + } + + // TODO(gw): Check result of this to determine if freetype build supports subpixel. + let result = FT_Library_SetLcdFilter(lib, FT_LcdFilter::FT_LCD_FILTER_DEFAULT); + if !result.succeeded() { + println!("WARN: Initializing a FreeType library build without subpixel AA enabled!"); + } + } + + FontContext { + lib: lib, + faces: HashMap::new(), + } + } + + pub fn add_raw_font(&mut self, font_key: &FontKey, bytes: &[u8]) { + if !self.faces.contains_key(&font_key) { + let mut face: FT_Face = ptr::null_mut(); + let face_index = 0 as FT_Long; + let result = unsafe { + FT_New_Memory_Face(self.lib, + bytes.as_ptr(), + bytes.len() as FT_Long, + face_index, + &mut face) + }; + if result.succeeded() && !face.is_null() { + self.faces.insert(*font_key, Face { + face: face, + //_bytes: bytes + }); + } else { + println!("WARN: webrender failed to load font {:?}", font_key); + } + } + } + + pub fn add_native_font(&mut self, _font_key: &FontKey, _native_font_handle: NativeFontHandle) { + panic!("TODO: Not supported on Linux"); + } + + fn load_glyph(&self, + font_key: FontKey, + size: Au, + character: u32) -> Option { + debug_assert!(self.faces.contains_key(&font_key)); + let face = self.faces.get(&font_key).unwrap(); + + unsafe { + let char_size = float_to_fixed_ft(size.to_f64_px()); + let result = FT_Set_Char_Size(face.face, char_size as FT_F26Dot6, 0, 0, 0); + assert!(result.succeeded()); + + let result = FT_Load_Glyph(face.face, character as FT_UInt, 0); + if result.succeeded() { + let void_glyph = (*face.face).glyph; + let slot_ptr: FT_GlyphSlot = mem::transmute(void_glyph); + assert!(!slot_ptr.is_null()); + return Some(slot_ptr); + } + } + + None + } + + pub fn get_glyph_dimensions(&self, + font_key: FontKey, + size: Au, + character: u32) -> Option { + self.load_glyph(font_key, size, character).and_then(|slot| { + let metrics = unsafe { &(*slot).metrics }; + if metrics.width == 0 || metrics.height == 0 { + None + } else { + Some(GlyphDimensions { + left: (metrics.horiBearingX >> 6) as i32, + top: (metrics.horiBearingY >> 6) as i32, + width: (metrics.width >> 6) as u32, + height: (metrics.height >> 6) as u32, + }) + } + }) + } + + pub fn rasterize_glyph(&mut self, + font_key: FontKey, + size: Au, + color: ColorU, + character: u32, + render_mode: FontRenderMode) -> Option { + let mut glyph = None; + + if let Some(slot) = self.load_glyph(font_key, + size, + character) { + let render_mode = match render_mode { + FontRenderMode::Mono => FT_Render_Mode::FT_RENDER_MODE_MONO, + FontRenderMode::Alpha => FT_Render_Mode::FT_RENDER_MODE_NORMAL, + FontRenderMode::Subpixel => FT_Render_Mode::FT_RENDER_MODE_LCD, + }; + + let result = unsafe { FT_Render_Glyph(slot, render_mode) }; + + if result.succeeded() { + let bitmap = unsafe { &(*slot).bitmap }; + + let metrics = unsafe { &(*slot).metrics }; + let mut glyph_width = (metrics.width >> 6) as i32; + let glyph_height = (metrics.height >> 6) as i32; + let mut final_buffer = Vec::with_capacity(glyph_width as usize * + glyph_height as usize * + 4); + + if bitmap.pixel_mode == FT_Pixel_Mode::FT_PIXEL_MODE_MONO as u8 { + // This is not exactly efficient... but it's only used by the + // reftest pass when we have AA disabled on glyphs. + let offset_x = unsafe { (metrics.horiBearingX >> 6) as i32 - (*slot).bitmap_left }; + let offset_y = unsafe { (metrics.horiBearingY >> 6) as i32 - (*slot).bitmap_top }; + + // Due to AA being disabled, the bitmap produced for mono + // glyphs is often smaller than the reported glyph dimensions. + // To account for this, place the rendered glyph within the + // box of the glyph dimensions, filling in invalid pixels with + // zero alpha. + for iy in 0..glyph_height { + let y = iy - offset_y; + for ix in 0..glyph_width { + let x = ix + offset_x; + let valid_byte = x >= 0 && + y >= 0 && + x < bitmap.width as i32 && + y < bitmap.rows as i32; + let byte_value = if valid_byte { + let byte_index = (y * bitmap.pitch as i32) + (x >> 3); + + unsafe { + let bit_index = x & 7; + let byte_ptr = bitmap.buffer.offset(byte_index as isize); + let bit = (*byte_ptr & (0x80 >> bit_index)) != 0; + if bit { + 0xff + } else { + 0 + } + } + } else { + 0 + }; + + final_buffer.extend_from_slice(&[ 0xff, 0xff, 0xff, byte_value ]); + } + } + } else if bitmap.pixel_mode == FT_Pixel_Mode::FT_PIXEL_MODE_GRAY as u8 { + // We can assume that the reported glyph dimensions exactly + // match the rasterized bitmap for normal alpha coverage glyphs. + + let buffer = unsafe { + slice::from_raw_parts( + bitmap.buffer, + (bitmap.width * bitmap.rows) as usize + ) + }; + + // Convert to RGBA. + for &byte in buffer.iter() { + final_buffer.extend_from_slice(&[ 0xff, 0xff, 0xff, byte ]); + } + } else if bitmap.pixel_mode == FT_Pixel_Mode::FT_PIXEL_MODE_LCD as u8 { + // Extra subpixel on each side of the glyph. + glyph_width += 2; + + for y in 0..bitmap.rows { + for x in 0..(bitmap.width / 3) { + let index = (y as i32 * bitmap.pitch) + (x as i32 * 3); + + unsafe { + let ptr = bitmap.buffer.offset(index as isize); + let b = *ptr; + let g = *(ptr.offset(1)); + let r = *(ptr.offset(2)); + + final_buffer.extend_from_slice(&[r, g, b, 0xff]); + } + } + } + } else { + panic!("Unexpected render mode: {}!", bitmap.pixel_mode); + } + + glyph = Some(RasterizedGlyph { + width: glyph_width as u32, + height: glyph_height as u32, + bytes: final_buffer, + }); + } + } + + glyph + } +} + +impl Drop for FontContext { + fn drop(&mut self) { + unsafe { + FT_Done_FreeType(self.lib); + } + } +} diff --git a/gfx/webrender/src/platform/windows/font.rs b/gfx/webrender/src/platform/windows/font.rs new file mode 100644 index 000000000000..5b0574edc1cb --- /dev/null +++ b/gfx/webrender/src/platform/windows/font.rs @@ -0,0 +1,192 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use std::collections::HashMap; +use webrender_traits::{FontKey, ColorU, FontRenderMode, GlyphDimensions}; + +use dwrote; + +lazy_static! { + static ref DEFAULT_FONT_DESCRIPTOR: dwrote::FontDescriptor = dwrote::FontDescriptor { + family_name: "Arial".to_owned(), + weight: dwrote::FontWeight::Regular, + stretch: dwrote::FontStretch::Normal, + style: dwrote::FontStyle::Normal, + }; +} + +pub struct FontContext { + fonts: HashMap, +} + +pub struct RasterizedGlyph { + pub width: u32, + pub height: u32, + pub bytes: Vec, +} + +impl FontContext { + pub fn new() -> FontContext { + FontContext { + fonts: HashMap::new(), + } + } + + pub fn add_raw_font(&mut self, font_key: &FontKey, data: &[u8]) { + if self.fonts.contains_key(font_key) { + return + } + + if let Some(font_file) = dwrote::FontFile::new_from_data(data) { + let face = font_file.create_face(0, dwrote::DWRITE_FONT_SIMULATIONS_NONE); + self.fonts.insert((*font_key).clone(), face); + } else { + // XXX add_raw_font needs to have a way to return an error + debug!("DWrite WR failed to load font from data, using Arial instead"); + self.add_native_font(font_key, DEFAULT_FONT_DESCRIPTOR.clone()); + } + } + + pub fn add_native_font(&mut self, font_key: &FontKey, font_handle: dwrote::FontDescriptor) { + if self.fonts.contains_key(font_key) { + return + } + + let system_fc = dwrote::FontCollection::system(); + let font = system_fc.get_font_from_descriptor(&font_handle).unwrap(); + let face = font.create_font_face(); + self.fonts.insert((*font_key).clone(), face); + } + + fn get_glyph_dimensions_and_maybe_rasterize(&self, + font_key: FontKey, + size: Au, + glyph: u32, + render_mode: Option) + -> (Option, Option) + { + let face = self.fonts.get(&font_key).unwrap(); + let glyph = glyph as u16; + + let glyph = glyph as u16; + let advance = 0.0f32; + let offset = dwrote::GlyphOffset { advanceOffset: 0.0, ascenderOffset: 0.0 }; + + let glyph_run = dwrote::DWRITE_GLYPH_RUN { + fontFace: unsafe { face.as_ptr() }, + fontEmSize: size.to_f32_px(), // size in DIPs (1/96", same as CSS pixels) + glyphCount: 1, + glyphIndices: &glyph, + glyphAdvances: &advance, + glyphOffsets: &offset, + isSideways: 0, + bidiLevel: 0, + }; + + // dwrite requires DWRITE_RENDERING_MODE_ALIASED if the texture + // type is DWRITE_TEXTURE_ALIASED_1x1. If CLEARTYPE_3x1, + // then the other modes can be used. + + // TODO(vlad): get_glyph_dimensions needs to take the render mode into account + // but the API doesn't give it to us right now. Just assume subpixel. + let (r_mode, m_mode, tex_type) = match render_mode { + Some(FontRenderMode::Mono) => (dwrote::DWRITE_RENDERING_MODE_ALIASED, + dwrote::DWRITE_MEASURING_MODE_GDI_NATURAL, + dwrote::DWRITE_TEXTURE_ALIASED_1x1), + Some(FontRenderMode::Alpha) => (dwrote::DWRITE_RENDERING_MODE_GDI_NATURAL, + dwrote::DWRITE_MEASURING_MODE_GDI_NATURAL, + dwrote::DWRITE_TEXTURE_CLEARTYPE_3x1), + Some(FontRenderMode::Subpixel) | None => (dwrote::DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL, + dwrote::DWRITE_MEASURING_MODE_GDI_NATURAL, + dwrote::DWRITE_TEXTURE_CLEARTYPE_3x1), + }; + + // XX use the xform to handle subpixel positioning (what skia does), I believe that keeps + //let xform = dwrote::DWRITE_MATRIX { m11: 1.0, m12: 0.0, m21: 0.0, m22: 1.0, dx: 0.0, dy: 0.0 }; + let analysis = dwrote::GlyphRunAnalysis::create(&glyph_run, 1.0, None, r_mode, m_mode, 0.0, 0.0); + let bounds = analysis.get_alpha_texture_bounds(tex_type); + + let width = (bounds.right - bounds.left) as u32; + let height = (bounds.bottom - bounds.top) as u32; + let dims = GlyphDimensions { + left: bounds.left, + top: -bounds.top, + width: width, + height: height, + }; + + // if empty, then nothing + if dims.width == 0 || dims.height == 0 { + return (None, None); + } + + // if we weren't asked to rasterize, we're done + if render_mode.is_none() { + return (Some(dims), None); + } + + let pixels = analysis.create_alpha_texture(tex_type, bounds); + let rgba_pixels = match render_mode.unwrap() { + FontRenderMode::Mono => { + let mut rgba_pixels = vec![0; pixels.len() * 4]; + for i in 0..pixels.len() { + rgba_pixels[i*4+0] = 0xff; + rgba_pixels[i*4+1] = 0xff; + rgba_pixels[i*4+2] = 0xff; + rgba_pixels[i*4+3] = pixels[i]; + } + rgba_pixels + } + FontRenderMode::Alpha => { + let mut rgba_pixels = vec![0; pixels.len()/3 * 4]; + for i in 0..pixels.len()/3 { + // TODO(vlad): we likely need to do something smarter + let alpha = (pixels[i*3+0] as u32 + pixels[i*3+0] as u32 + pixels[i*3+0] as u32) / 3; + rgba_pixels[i*4+0] = 0xff; + rgba_pixels[i*4+1] = 0xff; + rgba_pixels[i*4+2] = 0xff; + rgba_pixels[i*4+3] = alpha as u8; + } + rgba_pixels + } + FontRenderMode::Subpixel => { + let mut rgba_pixels = vec![0; pixels.len()/3 * 4]; + for i in 0..pixels.len()/3 { + rgba_pixels[i*4+0] = pixels[i*3+0]; + rgba_pixels[i*4+1] = pixels[i*3+1]; + rgba_pixels[i*4+2] = pixels[i*3+2]; + rgba_pixels[i*4+3] = 0xff; + } + rgba_pixels + } + }; + + (Some(dims), Some(RasterizedGlyph { + width: dims.width, + height: dims.height, + bytes: rgba_pixels, + })) + } + + pub fn get_glyph_dimensions(&self, + font_key: FontKey, + size: Au, + glyph: u32) -> Option { + let (maybe_dims, _) = + self.get_glyph_dimensions_and_maybe_rasterize(font_key, size, glyph, None); + maybe_dims + } + + pub fn rasterize_glyph(&mut self, + font_key: FontKey, + size: Au, + color: ColorU, + glyph: u32, + render_mode: FontRenderMode) -> Option { + let (_, maybe_glyph) = + self.get_glyph_dimensions_and_maybe_rasterize(font_key, size, glyph, Some(render_mode)); + maybe_glyph + } +} diff --git a/gfx/webrender/src/prim_store.rs b/gfx/webrender/src/prim_store.rs new file mode 100644 index 000000000000..c9cf57e3ae9a --- /dev/null +++ b/gfx/webrender/src/prim_store.rs @@ -0,0 +1,1291 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use euclid::Size2D; +use gpu_store::{GpuStore, GpuStoreAddress}; +use internal_types::SourceTexture; +use mask_cache::{ClipSource, MaskCacheInfo}; +use resource_cache::{ImageProperties, ResourceCache}; +use std::mem; +use std::usize; +use tiling::{RenderTask, RenderTaskLocation}; +use util::TransformedRect; +use webrender_traits::{AuxiliaryLists, ColorF, ImageKey, ImageRendering, YuvColorSpace}; +use webrender_traits::{ClipRegion, ComplexClipRegion, ItemRange, GlyphKey}; +use webrender_traits::{FontKey, FontRenderMode, WebGLContextId}; +use webrender_traits::{device_length, DeviceIntRect, DeviceIntSize}; +use webrender_traits::{DeviceRect, DevicePoint, DeviceSize}; +use webrender_traits::{LayerRect, LayerSize, LayerPoint}; +use webrender_traits::LayerToWorldTransform; + +pub const CLIP_DATA_GPU_SIZE: usize = 5; +pub const MASK_DATA_GPU_SIZE: usize = 1; + +/// Stores two coordinates in texel space. The coordinates +/// are stored in texel coordinates because the texture atlas +/// may grow. Storing them as texel coords and normalizing +/// the UVs in the vertex shader means nothing needs to be +/// updated on the CPU when the texture size changes. +#[derive(Clone)] +pub struct TexelRect { + pub uv0: DevicePoint, + pub uv1: DevicePoint, +} + +impl Default for TexelRect { + fn default() -> TexelRect { + TexelRect { + uv0: DevicePoint::zero(), + uv1: DevicePoint::zero(), + } + } +} + +/// For external images, it's not possible to know the +/// UV coords of the image (or the image data itself) +/// until the render thread receives the frame and issues +/// callbacks to the client application. For external +/// images that are visible, a DeferredResolve is created +/// that is stored in the frame. This allows the render +/// thread to iterate this list and update any changed +/// texture data and update the UV rect. +pub struct DeferredResolve { + pub resource_address: GpuStoreAddress, + pub image_properties: ImageProperties, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)] +pub struct SpecificPrimitiveIndex(pub usize); + +impl SpecificPrimitiveIndex { + pub fn invalid() -> SpecificPrimitiveIndex { + SpecificPrimitiveIndex(usize::MAX) + } +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)] +pub struct PrimitiveIndex(pub usize); + +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +pub enum PrimitiveKind { + Rectangle, + TextRun, + Image, + YuvImage, + Border, + Gradient, + RadialGradient, + BoxShadow, +} + +/// Geometry description for simple rectangular primitives, uploaded to the GPU. +#[derive(Debug, Clone)] +pub struct PrimitiveGeometry { + pub local_rect: LayerRect, + pub local_clip_rect: LayerRect, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum PrimitiveCacheKey { + BoxShadow(BoxShadowPrimitiveCacheKey), + TextShadow(PrimitiveIndex), +} + +// TODO(gw): Pack the fields here better! +#[derive(Debug)] +pub struct PrimitiveMetadata { + pub is_opaque: bool, + pub clip_source: Box, + pub clip_cache_info: Option, + pub prim_kind: PrimitiveKind, + pub cpu_prim_index: SpecificPrimitiveIndex, + pub gpu_prim_index: GpuStoreAddress, + pub gpu_data_address: GpuStoreAddress, + pub gpu_data_count: i32, + // An optional render task that is a dependency of + // drawing this primitive. For instance, box shadows + // use this to draw a portion of the box shadow to + // a render target to reduce the number of pixels + // that the box-shadow shader needs to run on. For + // text-shadow, this creates a render task chain + // that implements a 2-pass separable blur on a + // text run. + pub render_task: Option, + pub clip_task: Option, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct RectanglePrimitive { + pub color: ColorF, +} + +#[derive(Debug)] +pub enum ImagePrimitiveKind { + Image(ImageKey, ImageRendering, LayerSize), + WebGL(WebGLContextId), +} + +#[derive(Debug)] +pub struct ImagePrimitiveCpu { + pub kind: ImagePrimitiveKind, + pub color_texture_id: SourceTexture, + pub resource_address: GpuStoreAddress, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct ImagePrimitiveGpu { + pub stretch_size: LayerSize, + pub tile_spacing: LayerSize, +} + +#[derive(Debug)] +pub struct YuvImagePrimitiveCpu { + pub y_key: ImageKey, + pub u_key: ImageKey, + pub v_key: ImageKey, + pub y_texture_id: SourceTexture, + pub u_texture_id: SourceTexture, + pub v_texture_id: SourceTexture, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct YuvImagePrimitiveGpu { + pub y_uv0: DevicePoint, + pub y_uv1: DevicePoint, + pub u_uv0: DevicePoint, + pub u_uv1: DevicePoint, + pub v_uv0: DevicePoint, + pub v_uv1: DevicePoint, + pub size: LayerSize, + pub color_space: f32, + pub padding: f32, +} + +impl YuvImagePrimitiveGpu { + pub fn new(size: LayerSize, color_space: YuvColorSpace) -> Self { + YuvImagePrimitiveGpu { + y_uv0: DevicePoint::zero(), + y_uv1: DevicePoint::zero(), + u_uv0: DevicePoint::zero(), + u_uv1: DevicePoint::zero(), + v_uv0: DevicePoint::zero(), + v_uv1: DevicePoint::zero(), + size: size, + color_space: color_space as u32 as f32, + padding: 0.0, + } + } +} + +#[derive(Debug, Clone)] +pub struct BorderPrimitiveCpu { + pub inner_rect: LayerRect, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct BorderPrimitiveGpu { + pub style: [f32; 4], + pub widths: [f32; 4], + pub colors: [ColorF; 4], + pub radii: [LayerSize; 4], +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub struct BoxShadowPrimitiveCacheKey { + pub shadow_rect_size: Size2D, + pub border_radius: Au, + pub blur_radius: Au, + pub inverted: bool, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct BoxShadowPrimitiveGpu { + pub src_rect: LayerRect, + pub bs_rect: LayerRect, + pub color: ColorF, + pub border_radius: f32, + pub edge_size: f32, + pub blur_radius: f32, + pub inverted: f32, +} + +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +pub enum GradientType { + Horizontal, + Vertical, + Rotated, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct GradientStop { + color: ColorF, + offset: f32, + padding: [f32; 3], +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct GradientPrimitiveGpu { + pub start_point: LayerPoint, + pub end_point: LayerPoint, + pub kind: f32, + pub padding: [f32; 3], +} + +#[derive(Debug)] +pub struct GradientPrimitiveCpu { + pub stops_range: ItemRange, + pub kind: GradientType, + pub reverse_stops: bool, + pub cache_dirty: bool, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct RadialGradientPrimitiveGpu { + pub start_center: LayerPoint, + pub end_center: LayerPoint, + pub start_radius: f32, + pub end_radius: f32, + pub padding: [f32; 2], +} + +#[derive(Debug)] +pub struct RadialGradientPrimitiveCpu { + pub stops_range: ItemRange, + pub cache_dirty: bool, +} + +#[derive(Debug, Clone)] +#[repr(C)] +struct InstanceRect { + rect: LayerRect, +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct TextRunPrimitiveGpu { + pub color: ColorF, +} + +#[derive(Debug, Clone)] +pub struct TextRunPrimitiveCpu { + pub font_key: FontKey, + pub logical_font_size: Au, + pub blur_radius: Au, + pub glyph_range: ItemRange, + pub cache_dirty: bool, + // TODO(gw): Maybe make this an Arc for sharing with resource cache + pub glyph_indices: Vec, + pub color_texture_id: SourceTexture, + pub color: ColorF, + pub render_mode: FontRenderMode, + pub resource_address: GpuStoreAddress, +} + +#[derive(Debug, Clone)] +#[repr(C)] +struct GlyphPrimitive { + offset: LayerPoint, + padding: LayerPoint, +} + +#[derive(Debug, Clone)] +#[repr(C)] +struct ClipRect { + rect: LayerRect, + padding: [f32; 4], +} + +#[derive(Debug, Clone)] +#[repr(C)] +struct ClipCorner { + rect: LayerRect, + outer_radius_x: f32, + outer_radius_y: f32, + inner_radius_x: f32, + inner_radius_y: f32, +} + +impl ClipCorner { + fn uniform(rect: LayerRect, outer_radius: f32, inner_radius: f32) -> ClipCorner { + ClipCorner { + rect: rect, + outer_radius_x: outer_radius, + outer_radius_y: outer_radius, + inner_radius_x: inner_radius, + inner_radius_y: inner_radius, + } + } +} + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct ImageMaskData { + uv_rect: DeviceRect, + local_rect: LayerRect, +} + +#[derive(Debug, Clone)] +pub struct ClipData { + rect: ClipRect, + top_left: ClipCorner, + top_right: ClipCorner, + bottom_left: ClipCorner, + bottom_right: ClipCorner, +} + +impl ClipData { + pub fn from_clip_region(clip: &ComplexClipRegion) -> ClipData { + ClipData { + rect: ClipRect { + rect: clip.rect, + padding: [0.0, 0.0, 0.0, 0.0], + }, + top_left: ClipCorner { + rect: LayerRect::new( + LayerPoint::new(clip.rect.origin.x, clip.rect.origin.y), + LayerSize::new(clip.radii.top_left.width, clip.radii.top_left.height)), + outer_radius_x: clip.radii.top_left.width, + outer_radius_y: clip.radii.top_left.height, + inner_radius_x: 0.0, + inner_radius_y: 0.0, + }, + top_right: ClipCorner { + rect: LayerRect::new( + LayerPoint::new(clip.rect.origin.x + clip.rect.size.width - clip.radii.top_right.width, clip.rect.origin.y), + LayerSize::new(clip.radii.top_right.width, clip.radii.top_right.height)), + outer_radius_x: clip.radii.top_right.width, + outer_radius_y: clip.radii.top_right.height, + inner_radius_x: 0.0, + inner_radius_y: 0.0, + }, + bottom_left: ClipCorner { + rect: LayerRect::new( + LayerPoint::new(clip.rect.origin.x, clip.rect.origin.y + clip.rect.size.height - clip.radii.bottom_left.height), + LayerSize::new(clip.radii.bottom_left.width, clip.radii.bottom_left.height)), + outer_radius_x: clip.radii.bottom_left.width, + outer_radius_y: clip.radii.bottom_left.height, + inner_radius_x: 0.0, + inner_radius_y: 0.0, + }, + bottom_right: ClipCorner { + rect: LayerRect::new( + LayerPoint::new(clip.rect.origin.x + clip.rect.size.width - clip.radii.bottom_right.width, + clip.rect.origin.y + clip.rect.size.height - clip.radii.bottom_right.height), + LayerSize::new(clip.radii.bottom_right.width, clip.radii.bottom_right.height)), + outer_radius_x: clip.radii.bottom_right.width, + outer_radius_y: clip.radii.bottom_right.height, + inner_radius_x: 0.0, + inner_radius_y: 0.0, + }, + } + } + + pub fn uniform(rect: LayerRect, radius: f32) -> ClipData { + ClipData { + rect: ClipRect { + rect: rect, + padding: [0.0; 4], + }, + top_left: ClipCorner::uniform( + LayerRect::new( + LayerPoint::new(rect.origin.x, rect.origin.y), + LayerSize::new(radius, radius)), + radius, 0.0), + top_right: ClipCorner::uniform( + LayerRect::new( + LayerPoint::new(rect.origin.x + rect.size.width - radius, rect.origin.y), + LayerSize::new(radius, radius)), + radius, 0.0), + bottom_left: ClipCorner::uniform( + LayerRect::new( + LayerPoint::new(rect.origin.x, rect.origin.y + rect.size.height - radius), + LayerSize::new(radius, radius)), + radius, 0.0), + bottom_right: ClipCorner::uniform( + LayerRect::new( + LayerPoint::new(rect.origin.x + rect.size.width - radius, rect.origin.y + rect.size.height - radius), + LayerSize::new(radius, radius)), + radius, 0.0), + } + } +} + +#[derive(Debug)] +pub enum PrimitiveContainer { + Rectangle(RectanglePrimitive), + TextRun(TextRunPrimitiveCpu, TextRunPrimitiveGpu), + Image(ImagePrimitiveCpu, ImagePrimitiveGpu), + YuvImage(YuvImagePrimitiveCpu, YuvImagePrimitiveGpu), + Border(BorderPrimitiveCpu, BorderPrimitiveGpu), + Gradient(GradientPrimitiveCpu, GradientPrimitiveGpu), + RadialGradient(RadialGradientPrimitiveCpu, RadialGradientPrimitiveGpu), + BoxShadow(BoxShadowPrimitiveGpu, Vec), +} + +pub struct PrimitiveStore { + // CPU side information only + pub cpu_bounding_rects: Vec>, + pub cpu_text_runs: Vec, + pub cpu_images: Vec, + pub cpu_yuv_images: Vec, + pub cpu_gradients: Vec, + pub cpu_radial_gradients: Vec, + pub cpu_metadata: Vec, + pub cpu_borders: Vec, + + // Gets uploaded directly to GPU via vertex texture + pub gpu_geometry: GpuStore, + pub gpu_data16: GpuStore, + pub gpu_data32: GpuStore, + pub gpu_data64: GpuStore, + pub gpu_data128: GpuStore, + + // Resolved resource rects. + pub gpu_resource_rects: GpuStore, + + // General + prims_to_resolve: Vec, +} + +impl PrimitiveStore { + pub fn new() -> PrimitiveStore { + PrimitiveStore { + cpu_metadata: Vec::new(), + cpu_bounding_rects: Vec::new(), + cpu_text_runs: Vec::new(), + cpu_images: Vec::new(), + cpu_yuv_images: Vec::new(), + cpu_gradients: Vec::new(), + cpu_radial_gradients: Vec::new(), + cpu_borders: Vec::new(), + gpu_geometry: GpuStore::new(), + gpu_data16: GpuStore::new(), + gpu_data32: GpuStore::new(), + gpu_data64: GpuStore::new(), + gpu_data128: GpuStore::new(), + gpu_resource_rects: GpuStore::new(), + prims_to_resolve: Vec::new(), + } + } + + pub fn populate_clip_data(data: &mut [GpuBlock32], clip: ClipData) { + data[0] = GpuBlock32::from(clip.rect); + data[1] = GpuBlock32::from(clip.top_left); + data[2] = GpuBlock32::from(clip.top_right); + data[3] = GpuBlock32::from(clip.bottom_left); + data[4] = GpuBlock32::from(clip.bottom_right); + } + + pub fn add_primitive(&mut self, + geometry: PrimitiveGeometry, + clip_source: Box, + clip_info: Option, + container: PrimitiveContainer) -> PrimitiveIndex { + let prim_index = self.cpu_metadata.len(); + self.cpu_bounding_rects.push(None); + self.gpu_geometry.push(geometry); + + let metadata = match container { + PrimitiveContainer::Rectangle(rect) => { + let is_opaque = rect.color.a == 1.0; + let gpu_address = self.gpu_data16.push(rect); + + let metadata = PrimitiveMetadata { + is_opaque: is_opaque, + clip_source: clip_source, + clip_cache_info: clip_info, + prim_kind: PrimitiveKind::Rectangle, + cpu_prim_index: SpecificPrimitiveIndex::invalid(), + gpu_prim_index: gpu_address, + gpu_data_address: GpuStoreAddress(0), + gpu_data_count: 0, + render_task: None, + clip_task: None, + }; + + metadata + } + PrimitiveContainer::TextRun(mut text_cpu, text_gpu) => { + let gpu_address = self.gpu_data16.push(text_gpu); + let gpu_glyphs_address = self.gpu_data16.alloc(text_cpu.glyph_range.length); + text_cpu.resource_address = self.gpu_resource_rects.alloc(text_cpu.glyph_range.length); + + let metadata = PrimitiveMetadata { + is_opaque: false, + clip_source: clip_source, + clip_cache_info: clip_info, + prim_kind: PrimitiveKind::TextRun, + cpu_prim_index: SpecificPrimitiveIndex(self.cpu_text_runs.len()), + gpu_prim_index: gpu_address, + gpu_data_address: gpu_glyphs_address, + gpu_data_count: text_cpu.glyph_range.length as i32, + render_task: None, + clip_task: None, + }; + + self.cpu_text_runs.push(text_cpu); + metadata + } + PrimitiveContainer::Image(mut image_cpu, image_gpu) => { + image_cpu.resource_address = self.gpu_resource_rects.alloc(1); + + let gpu_address = self.gpu_data16.push(image_gpu); + + let metadata = PrimitiveMetadata { + is_opaque: false, + clip_source: clip_source, + clip_cache_info: clip_info, + prim_kind: PrimitiveKind::Image, + cpu_prim_index: SpecificPrimitiveIndex(self.cpu_images.len()), + gpu_prim_index: gpu_address, + gpu_data_address: GpuStoreAddress(0), + gpu_data_count: 0, + render_task: None, + clip_task: None, + }; + + self.cpu_images.push(image_cpu); + metadata + } + PrimitiveContainer::YuvImage(image_cpu, image_gpu) => { + let gpu_address = self.gpu_data64.push(image_gpu); + + let metadata = PrimitiveMetadata { + is_opaque: true, + clip_source: clip_source, + clip_cache_info: clip_info, + prim_kind: PrimitiveKind::YuvImage, + cpu_prim_index: SpecificPrimitiveIndex(self.cpu_yuv_images.len()), + gpu_prim_index: gpu_address, + gpu_data_address: GpuStoreAddress(0), + gpu_data_count: 0, + render_task: None, + clip_task: None, + }; + + self.cpu_yuv_images.push(image_cpu); + metadata + } + PrimitiveContainer::Border(border_cpu, border_gpu) => { + let gpu_address = self.gpu_data128.push(border_gpu); + + let metadata = PrimitiveMetadata { + is_opaque: false, + clip_source: clip_source, + clip_cache_info: clip_info, + prim_kind: PrimitiveKind::Border, + cpu_prim_index: SpecificPrimitiveIndex(self.cpu_borders.len()), + gpu_prim_index: gpu_address, + gpu_data_address: GpuStoreAddress(0), + gpu_data_count: 0, + render_task: None, + clip_task: None, + }; + + self.cpu_borders.push(border_cpu); + metadata + } + PrimitiveContainer::Gradient(gradient_cpu, gradient_gpu) => { + let gpu_address = self.gpu_data32.push(gradient_gpu); + let gpu_stops_address = self.gpu_data32.alloc(gradient_cpu.stops_range.length); + + let metadata = PrimitiveMetadata { + is_opaque: false, + clip_source: clip_source, + clip_cache_info: clip_info, + prim_kind: PrimitiveKind::Gradient, + cpu_prim_index: SpecificPrimitiveIndex(self.cpu_gradients.len()), + gpu_prim_index: gpu_address, + gpu_data_address: gpu_stops_address, + gpu_data_count: gradient_cpu.stops_range.length as i32, + render_task: None, + clip_task: None, + }; + + self.cpu_gradients.push(gradient_cpu); + metadata + } + PrimitiveContainer::RadialGradient(radial_gradient_cpu, radial_gradient_gpu) => { + let gpu_address = self.gpu_data32.push(radial_gradient_gpu); + let gpu_stops_address = self.gpu_data32.alloc(radial_gradient_cpu.stops_range.length); + + let metadata = PrimitiveMetadata { + is_opaque: false, + clip_source: clip_source, + clip_cache_info: clip_info, + prim_kind: PrimitiveKind::RadialGradient, + cpu_prim_index: SpecificPrimitiveIndex(self.cpu_radial_gradients.len()), + gpu_prim_index: gpu_address, + gpu_data_address: gpu_stops_address, + gpu_data_count: radial_gradient_cpu.stops_range.length as i32, + render_task: None, + clip_task: None, + }; + + self.cpu_radial_gradients.push(radial_gradient_cpu); + metadata + } + PrimitiveContainer::BoxShadow(box_shadow_gpu, instance_rects) => { + let cache_key = PrimitiveCacheKey::BoxShadow(BoxShadowPrimitiveCacheKey { + blur_radius: Au::from_f32_px(box_shadow_gpu.blur_radius), + border_radius: Au::from_f32_px(box_shadow_gpu.border_radius), + inverted: box_shadow_gpu.inverted != 0.0, + shadow_rect_size: Size2D::new(Au::from_f32_px(box_shadow_gpu.bs_rect.size.width), + Au::from_f32_px(box_shadow_gpu.bs_rect.size.height)), + }); + + // The actual cache size is calculated during prepare_prim_for_render(). + // This is necessary since the size may change depending on the device + // pixel ratio (for example, during zoom or moving the window to a + // monitor with a different device pixel ratio). + let cache_size = DeviceIntSize::zero(); + + // Create a render task for this box shadow primitive. This renders a small + // portion of the box shadow to a render target. That portion is then + // stretched over the actual primitive rect by the box shadow primitive + // shader, to reduce the number of pixels that the expensive box + // shadow shader needs to run on. + // TODO(gw): In the future, we can probably merge the box shadow + // primitive (stretch) shader with the generic cached primitive shader. + let render_task = RenderTask::new_prim_cache(cache_key, + cache_size, + PrimitiveIndex(prim_index)); + + let gpu_prim_address = self.gpu_data64.push(box_shadow_gpu); + let gpu_data_address = self.gpu_data16.get_next_address(); + + let metadata = PrimitiveMetadata { + is_opaque: false, + clip_source: clip_source, + clip_cache_info: None, + prim_kind: PrimitiveKind::BoxShadow, + cpu_prim_index: SpecificPrimitiveIndex::invalid(), + gpu_prim_index: gpu_prim_address, + gpu_data_address: gpu_data_address, + gpu_data_count: instance_rects.len() as i32, + render_task: Some(render_task), + clip_task: None, + }; + + for rect in instance_rects { + self.gpu_data16.push(InstanceRect { + rect: rect, + }); + } + + metadata + } + }; + + self.cpu_metadata.push(metadata); + + PrimitiveIndex(prim_index) + } + + fn resolve_clip_cache_internal(gpu_data32: &mut GpuStore, + clip_info: &MaskCacheInfo, + resource_cache: &ResourceCache) { + if let Some((ref mask, gpu_address)) = clip_info.image { + let cache_item = resource_cache.get_cached_image(mask.image, ImageRendering::Auto); + let mask_data = gpu_data32.get_slice_mut(gpu_address, MASK_DATA_GPU_SIZE); + mask_data[0] = GpuBlock32::from(ImageMaskData { + uv_rect: DeviceRect::new(cache_item.uv0, + DeviceSize::new(cache_item.uv1.x - cache_item.uv0.x, + cache_item.uv1.y - cache_item.uv0.y)), + local_rect: mask.rect, + }); + } + } + + pub fn resolve_clip_cache(&mut self, + clip_info: &MaskCacheInfo, + resource_cache: &ResourceCache) { + Self::resolve_clip_cache_internal(&mut self.gpu_data32, clip_info, resource_cache) + } + + pub fn resolve_primitives(&mut self, + resource_cache: &ResourceCache, + device_pixel_ratio: f32) -> Vec { + let mut deferred_resolves = Vec::new(); + + for prim_index in self.prims_to_resolve.drain(..) { + let metadata = &mut self.cpu_metadata[prim_index.0]; + if let Some(ref clip_info) = metadata.clip_cache_info { + Self::resolve_clip_cache_internal(&mut self.gpu_data32, clip_info, resource_cache); + } + + match metadata.prim_kind { + PrimitiveKind::Rectangle | + PrimitiveKind::Border | + PrimitiveKind::BoxShadow | + PrimitiveKind::Gradient | + PrimitiveKind::RadialGradient=> {} + PrimitiveKind::TextRun => { + let text = &mut self.cpu_text_runs[metadata.cpu_prim_index.0]; + let font_size_dp = text.logical_font_size.scale_by(device_pixel_ratio); + + let dest_rects = self.gpu_resource_rects.get_slice_mut(text.resource_address, + text.glyph_range.length); + let texture_id = resource_cache.get_glyphs(text.font_key, + font_size_dp, + text.color, + &text.glyph_indices, + text.render_mode, |index, uv0, uv1| { + let dest_rect = &mut dest_rects[index]; + dest_rect.uv0 = uv0; + dest_rect.uv1 = uv1; + }); + + text.color_texture_id = texture_id; + } + PrimitiveKind::Image => { + let image_cpu = &mut self.cpu_images[metadata.cpu_prim_index.0]; + + let (texture_id, cache_item) = match image_cpu.kind { + ImagePrimitiveKind::Image(image_key, image_rendering, _) => { + // Check if an external image that needs to be resolved + // by the render thread. + let image_properties = resource_cache.get_image_properties(image_key); + + match image_properties.external_id { + Some(external_id) => { + // This is an external texture - we will add it to + // the deferred resolves list to be patched by + // the render thread... + deferred_resolves.push(DeferredResolve { + resource_address: image_cpu.resource_address, + image_properties: image_properties, + }); + + (SourceTexture::External(external_id), None) + } + None => { + let cache_item = resource_cache.get_cached_image(image_key, image_rendering); + (cache_item.texture_id, Some(cache_item)) + } + } + } + ImagePrimitiveKind::WebGL(context_id) => { + let cache_item = resource_cache.get_webgl_texture(&context_id); + (cache_item.texture_id, Some(cache_item)) + } + }; + + if let Some(cache_item) = cache_item { + let resource_rect = self.gpu_resource_rects.get_mut(image_cpu.resource_address); + resource_rect.uv0 = cache_item.uv0; + resource_rect.uv1 = cache_item.uv1; + } + image_cpu.color_texture_id = texture_id; + } + PrimitiveKind::YuvImage => { + let image_cpu = &mut self.cpu_yuv_images[metadata.cpu_prim_index.0]; + let image_gpu: &mut YuvImagePrimitiveGpu = unsafe { + mem::transmute(self.gpu_data64.get_mut(metadata.gpu_prim_index)) + }; + + if image_cpu.y_texture_id == SourceTexture::Invalid { + let y_cache_item = resource_cache.get_cached_image(image_cpu.y_key, ImageRendering::Auto); + image_cpu.y_texture_id = y_cache_item.texture_id; + image_gpu.y_uv0 = y_cache_item.uv0; + image_gpu.y_uv1 = y_cache_item.uv1; + } + + if image_cpu.u_texture_id == SourceTexture::Invalid { + let u_cache_item = resource_cache.get_cached_image(image_cpu.u_key, ImageRendering::Auto); + image_cpu.u_texture_id = u_cache_item.texture_id; + image_gpu.u_uv0 = u_cache_item.uv0; + image_gpu.u_uv1 = u_cache_item.uv1; + } + + if image_cpu.v_texture_id == SourceTexture::Invalid { + let v_cache_item = resource_cache.get_cached_image(image_cpu.v_key, ImageRendering::Auto); + image_cpu.v_texture_id = v_cache_item.texture_id; + image_gpu.v_uv0 = v_cache_item.uv0; + image_gpu.v_uv1 = v_cache_item.uv1; + } + } + } + } + + deferred_resolves + } + + pub fn get_bounding_rect(&self, index: PrimitiveIndex) -> &Option { + &self.cpu_bounding_rects[index.0] + } + + pub fn set_clip_source(&mut self, index: PrimitiveIndex, source: ClipSource) { + let metadata = &mut self.cpu_metadata[index.0]; + let (rect, is_complex) = match source { + ClipSource::NoClip => (None, false), + ClipSource::Complex(rect, radius) => (Some(rect), radius > 0.0), + ClipSource::Region(ref region) => (Some(region.main), region.is_complex()), + }; + if let Some(rect) = rect { + self.gpu_geometry.get_mut(GpuStoreAddress(index.0 as i32)) + .local_clip_rect = rect; + if is_complex { + metadata.clip_cache_info = None; //CLIP TODO: re-use the existing GPU allocation + } + } + *metadata.clip_source.as_mut() = source; + } + + pub fn get_metadata(&self, index: PrimitiveIndex) -> &PrimitiveMetadata { + &self.cpu_metadata[index.0] + } + + pub fn prim_count(&self) -> usize { + self.cpu_metadata.len() + } + + pub fn build_bounding_rect(&mut self, + prim_index: PrimitiveIndex, + screen_rect: &DeviceIntRect, + layer_transform: &LayerToWorldTransform, + layer_combined_local_clip_rect: &LayerRect, + device_pixel_ratio: f32) -> bool { + let geom = &self.gpu_geometry.get(GpuStoreAddress(prim_index.0 as i32)); + + let bounding_rect = geom.local_rect + .intersection(&geom.local_clip_rect) + .and_then(|rect| rect.intersection(layer_combined_local_clip_rect)) + .and_then(|ref local_rect| { + let xf_rect = TransformedRect::new(local_rect, + layer_transform, + device_pixel_ratio); + xf_rect.bounding_rect.intersection(screen_rect) + }); + + self.cpu_bounding_rects[prim_index.0] = bounding_rect; + bounding_rect.is_some() + } + + /// Returns true if the bounding box needs to be updated. + pub fn prepare_prim_for_render(&mut self, + prim_index: PrimitiveIndex, + resource_cache: &mut ResourceCache, + layer_transform: &LayerToWorldTransform, + device_pixel_ratio: f32, + auxiliary_lists: &AuxiliaryLists) -> bool { + + let metadata = &mut self.cpu_metadata[prim_index.0]; + let mut prim_needs_resolve = false; + let mut rebuild_bounding_rect = false; + + if let Some(ref mut clip_info) = metadata.clip_cache_info { + clip_info.update(&metadata.clip_source, + layer_transform, + &mut self.gpu_data32, + device_pixel_ratio, + auxiliary_lists); + if let &ClipSource::Region(ClipRegion{ image_mask: Some(ref mask), .. }) = metadata.clip_source.as_ref() { + resource_cache.request_image(mask.image, ImageRendering::Auto); + prim_needs_resolve = true; + } + } + + match metadata.prim_kind { + PrimitiveKind::Rectangle | + PrimitiveKind::Border => {} + PrimitiveKind::BoxShadow => { + // TODO(gw): Account for zoom factor! + // Here, we calculate the size of the patch required in order + // to create the box shadow corner. First, scale it by the + // device pixel ratio since the cache shader expects vertices + // in device space. The shader adds a 1-pixel border around + // the patch, in order to prevent bilinear filter artifacts as + // the patch is clamped / mirrored across the box shadow rect. + let box_shadow_gpu: &BoxShadowPrimitiveGpu = unsafe { + mem::transmute(self.gpu_data64.get(metadata.gpu_prim_index)) + }; + let edge_size = box_shadow_gpu.edge_size.ceil() * device_pixel_ratio; + let edge_size = edge_size as i32 + 2; // Account for bilinear filtering + let cache_size = DeviceIntSize::new(edge_size, edge_size); + let location = RenderTaskLocation::Dynamic(None, cache_size); + metadata.render_task.as_mut().unwrap().location = location; + } + PrimitiveKind::TextRun => { + let text = &mut self.cpu_text_runs[metadata.cpu_prim_index.0]; + let font_size_dp = text.logical_font_size.scale_by(device_pixel_ratio); + prim_needs_resolve = true; + + if text.cache_dirty { + rebuild_bounding_rect = true; + text.cache_dirty = false; + + debug_assert!(metadata.gpu_data_count == text.glyph_range.length as i32); + debug_assert!(text.glyph_indices.is_empty()); + let src_glyphs = auxiliary_lists.glyph_instances(&text.glyph_range); + let dest_glyphs = self.gpu_data16.get_slice_mut(metadata.gpu_data_address, + text.glyph_range.length); + let mut glyph_key = GlyphKey::new(text.font_key, + font_size_dp, + text.color, + src_glyphs[0].index); + let mut local_rect = LayerRect::zero(); + let mut actual_glyph_count = 0; + + for src in src_glyphs { + glyph_key.index = src.index; + + let dimensions = match resource_cache.get_glyph_dimensions(&glyph_key) { + None => continue, + Some(dimensions) => dimensions, + }; + + // TODO(gw): Check for this and ensure platforms return None in this case!!! + debug_assert!(dimensions.width > 0 && dimensions.height > 0); + + let x = src.x + dimensions.left as f32 / device_pixel_ratio; + let y = src.y - dimensions.top as f32 / device_pixel_ratio; + + let width = dimensions.width as f32 / device_pixel_ratio; + let height = dimensions.height as f32 / device_pixel_ratio; + + let local_glyph_rect = LayerRect::new(LayerPoint::new(x, y), + LayerSize::new(width, height)); + local_rect = local_rect.union(&local_glyph_rect); + + dest_glyphs[actual_glyph_count] = GpuBlock16::from(GlyphPrimitive { + padding: LayerPoint::zero(), + offset: local_glyph_rect.origin, + }); + + text.glyph_indices.push(src.index); + + actual_glyph_count += 1; + } + + // Expand the rectangle of the text run by the blur radius. + let local_rect = local_rect.inflate(text.blur_radius.to_f32_px(), + text.blur_radius.to_f32_px()); + + let render_task = if text.blur_radius.0 == 0 { + None + } else { + // This is a text-shadow element. Create a render task that will + // render the text run to a target, and then apply a gaussian + // blur to that text run in order to build the actual primitive + // which will be blitted to the framebuffer. + let cache_width = (local_rect.size.width * device_pixel_ratio).ceil() as i32; + let cache_height = (local_rect.size.height * device_pixel_ratio).ceil() as i32; + let cache_size = DeviceIntSize::new(cache_width, cache_height); + let cache_key = PrimitiveCacheKey::TextShadow(prim_index); + let blur_radius = device_length(text.blur_radius.to_f32_px(), + device_pixel_ratio); + Some(RenderTask::new_blur(cache_key, + cache_size, + blur_radius, + prim_index)) + }; + + metadata.gpu_data_count = actual_glyph_count as i32; + metadata.render_task = render_task; + self.gpu_geometry.get_mut(GpuStoreAddress(prim_index.0 as i32)).local_rect = local_rect; + } + + resource_cache.request_glyphs(text.font_key, + font_size_dp, + text.color, + &text.glyph_indices, + text.render_mode); + } + PrimitiveKind::Image => { + let image_cpu = &mut self.cpu_images[metadata.cpu_prim_index.0]; + + prim_needs_resolve = true; + match image_cpu.kind { + ImagePrimitiveKind::Image(image_key, image_rendering, tile_spacing) => { + resource_cache.request_image(image_key, image_rendering); + + // TODO(gw): This doesn't actually need to be calculated each frame. + // It's cheap enough that it's not worth introducing a cache for images + // right now, but if we introduce a cache for images for some other + // reason then we might as well cache this with it. + let image_properties = resource_cache.get_image_properties(image_key); + metadata.is_opaque = image_properties.descriptor.is_opaque && + tile_spacing.width == 0.0 && + tile_spacing.height == 0.0; + } + ImagePrimitiveKind::WebGL(..) => {} + } + } + PrimitiveKind::YuvImage => { + let image_cpu = &mut self.cpu_yuv_images[metadata.cpu_prim_index.0]; + prim_needs_resolve = true; + + resource_cache.request_image(image_cpu.y_key, ImageRendering::Auto); + resource_cache.request_image(image_cpu.u_key, ImageRendering::Auto); + resource_cache.request_image(image_cpu.v_key, ImageRendering::Auto); + + // TODO(nical): Currently assuming no tile_spacing for yuv images. + metadata.is_opaque = true; + } + PrimitiveKind::Gradient => { + let gradient = &mut self.cpu_gradients[metadata.cpu_prim_index.0]; + if gradient.cache_dirty { + let src_stops = auxiliary_lists.gradient_stops(&gradient.stops_range); + + debug_assert!(metadata.gpu_data_count == gradient.stops_range.length as i32); + let dest_stops = self.gpu_data32.get_slice_mut(metadata.gpu_data_address, + gradient.stops_range.length); + + if gradient.reverse_stops { + for (src, dest) in src_stops.iter().rev().zip(dest_stops.iter_mut()) { + *dest = GpuBlock32::from(GradientStop { + offset: 1.0 - src.offset, + color: src.color, + padding: [0.0; 3], + }); + } + } else { + for (src, dest) in src_stops.iter().zip(dest_stops.iter_mut()) { + *dest = GpuBlock32::from(GradientStop { + offset: src.offset, + color: src.color, + padding: [0.0; 3], + }); + } + } + + gradient.cache_dirty = false; + } + } + PrimitiveKind::RadialGradient => { + let gradient = &mut self.cpu_radial_gradients[metadata.cpu_prim_index.0]; + if gradient.cache_dirty { + let src_stops = auxiliary_lists.gradient_stops(&gradient.stops_range); + + debug_assert!(metadata.gpu_data_count == gradient.stops_range.length as i32); + let dest_stops = self.gpu_data32.get_slice_mut(metadata.gpu_data_address, + gradient.stops_range.length); + + for (src, dest) in src_stops.iter().zip(dest_stops.iter_mut()) { + *dest = GpuBlock32::from(GradientStop { + offset: src.offset, + color: src.color, + padding: [0.0; 3], + }); + } + + gradient.cache_dirty = false; + } + } + } + + if prim_needs_resolve { + self.prims_to_resolve.push(prim_index); + } + + rebuild_bounding_rect + } +} + +#[derive(Clone)] +#[repr(C)] +pub struct GpuBlock16 { + data: [f32; 4], +} + +impl Default for GpuBlock16 { + fn default() -> GpuBlock16 { + GpuBlock16 { + data: unsafe { mem::uninitialized() } + } + } +} + +impl From for GpuBlock16 { + fn from(data: TextRunPrimitiveGpu) -> GpuBlock16 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock16 { + fn from(data: RectanglePrimitive) -> GpuBlock16 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock16 { + fn from(data: InstanceRect) -> GpuBlock16 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock16 { + fn from(data: ImagePrimitiveGpu) -> GpuBlock16 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock16 { + fn from(data: GlyphPrimitive) -> GpuBlock16 { + unsafe { + mem::transmute::(data) + } + } +} + +#[derive(Clone)] +#[repr(C)] +pub struct GpuBlock32 { + data: [f32; 8], +} + +impl Default for GpuBlock32 { + fn default() -> GpuBlock32 { + GpuBlock32 { + data: unsafe { mem::uninitialized() } + } + } +} + +impl From for GpuBlock32 { + fn from(data: GradientPrimitiveGpu) -> GpuBlock32 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock32 { + fn from(data: GradientStop) -> GpuBlock32 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock32 { + fn from(data: RadialGradientPrimitiveGpu) -> GpuBlock32 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock64 { + fn from(data: YuvImagePrimitiveGpu) -> GpuBlock64 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock32 { + fn from(data: ClipRect) -> GpuBlock32 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock32 { + fn from(data: ImageMaskData) -> GpuBlock32 { + unsafe { + mem::transmute::(data) + } + } +} + +impl From for GpuBlock32 { + fn from(data: ClipCorner) -> GpuBlock32 { + unsafe { + mem::transmute::(data) + } + } +} + +#[derive(Clone)] +#[repr(C)] +pub struct GpuBlock64 { + data: [f32; 16], +} + +impl Default for GpuBlock64 { + fn default() -> GpuBlock64 { + GpuBlock64 { + data: unsafe { mem::uninitialized() } + } + } +} + +impl From for GpuBlock64 { + fn from(data: BoxShadowPrimitiveGpu) -> GpuBlock64 { + unsafe { + mem::transmute::(data) + } + } +} + +#[derive(Clone)] +#[repr(C)] +pub struct GpuBlock128 { + data: [f32; 32], +} + +impl Default for GpuBlock128 { + fn default() -> GpuBlock128 { + GpuBlock128 { + data: unsafe { mem::uninitialized() } + } + } +} + +impl From for GpuBlock128 { + fn from(data: BorderPrimitiveGpu) -> GpuBlock128 { + unsafe { + mem::transmute::(data) + } + } +} + +//Test for one clip region contains another +trait InsideTest { + fn might_contain(&self, clip: &T) -> bool; +} + +impl InsideTest for ComplexClipRegion { + // Returns true if clip is inside self, can return false negative + fn might_contain(&self, clip: &ComplexClipRegion) -> bool { + let delta_left = clip.rect.origin.x - self.rect.origin.x; + let delta_top = clip.rect.origin.y - self.rect.origin.y; + let delta_right = self.rect.max_x() - clip.rect.max_x(); + let delta_bottom = self.rect.max_y() - clip.rect.max_y(); + + delta_left >= 0f32 && + delta_top >= 0f32 && + delta_right >= 0f32 && + delta_bottom >= 0f32 && + clip.radii.top_left.width >= self.radii.top_left.width - delta_left && + clip.radii.top_left.height >= self.radii.top_left.height - delta_top && + clip.radii.top_right.width >= self.radii.top_right.width - delta_right && + clip.radii.top_right.height >= self.radii.top_right.height - delta_top && + clip.radii.bottom_left.width >= self.radii.bottom_left.width - delta_left && + clip.radii.bottom_left.height >= self.radii.bottom_left.height - delta_bottom && + clip.radii.bottom_right.width >= self.radii.bottom_right.width - delta_right && + clip.radii.bottom_right.height >= self.radii.bottom_right.height - delta_bottom + } +} diff --git a/gfx/webrender/src/profiler.rs b/gfx/webrender/src/profiler.rs new file mode 100644 index 000000000000..d1f6d375d1a0 --- /dev/null +++ b/gfx/webrender/src/profiler.rs @@ -0,0 +1,677 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use debug_render::DebugRenderer; +use device::{GpuMarker, GpuSample, NamedTag}; +use euclid::{Point2D, Size2D, Rect}; +use std::collections::vec_deque::VecDeque; +use std::f32; +use std::mem; +use webrender_traits::ColorF; +use time::precise_time_ns; + +const GRAPH_WIDTH: f32 = 1024.0; +const GRAPH_HEIGHT: f32 = 320.0; +const GRAPH_PADDING: f32 = 8.0; +const GRAPH_FRAME_HEIGHT: f32 = 16.0; +const PROFILE_PADDING: f32 = 10.0; + +const ONE_SECOND_NS: u64 = 1000000000; + +#[derive(Debug, Clone)] +pub struct GpuProfileTag { + pub label: &'static str, + pub color: ColorF, +} + +impl NamedTag for GpuProfileTag { + fn get_label(&self) -> &str { + self.label + } +} + +trait ProfileCounter { + fn description(&self) -> &'static str; + fn value(&self) -> String; +} + +#[derive(Clone)] +pub struct IntProfileCounter { + description: &'static str, + value: usize, +} + +impl IntProfileCounter { + fn new(description: &'static str) -> IntProfileCounter { + IntProfileCounter { + description: description, + value: 0, + } + } + + fn reset(&mut self) { + self.value = 0; + } + + #[inline(always)] + pub fn inc(&mut self) { + self.value += 1; + } + + #[inline(always)] + pub fn add(&mut self, amount: usize) { + self.value += amount; + } + + #[inline(always)] + pub fn set(&mut self, amount: usize) { + self.value = amount; + } +} + +impl ProfileCounter for IntProfileCounter { + fn description(&self) -> &'static str { + self.description + } + + fn value(&self) -> String { + format!("{}", self.value) + } +} + +#[derive(Clone)] +pub struct ResourceProfileCounter { + description: &'static str, + value: usize, + size: usize, +} + +impl ResourceProfileCounter { + fn new(description: &'static str) -> ResourceProfileCounter { + ResourceProfileCounter { + description: description, + value: 0, + size: 0, + } + } + + #[allow(dead_code)] + fn reset(&mut self) { + self.value = 0; + self.size = 0; + } + + #[inline(always)] + pub fn inc(&mut self, size: usize) { + self.value += 1; + self.size += size; + } +} + +impl ProfileCounter for ResourceProfileCounter { + fn description(&self) -> &'static str { + self.description + } + + fn value(&self) -> String { + let size = self.size as f32 / (1024.0 * 1024.0); + format!("{} ({:.2} MB)", self.value, size) + } +} + +#[derive(Clone)] +pub struct TimeProfileCounter { + description: &'static str, + nanoseconds: u64, + invert: bool, +} + +impl TimeProfileCounter { + pub fn new(description: &'static str, invert: bool) -> TimeProfileCounter { + TimeProfileCounter { + description: description, + nanoseconds: 0, + invert: invert, + } + } + + fn reset(&mut self) { + self.nanoseconds = 0; + } + + #[allow(dead_code)] + pub fn set(&mut self, ns: u64) { + self.nanoseconds = ns; + } + + pub fn profile(&mut self, callback: F) -> T where F: FnOnce() -> T { + let t0 = precise_time_ns(); + let val = callback(); + let t1 = precise_time_ns(); + let ns = t1 - t0; + self.nanoseconds += ns; + val + } +} + +impl ProfileCounter for TimeProfileCounter { + fn description(&self) -> &'static str { + self.description + } + + fn value(&self) -> String { + if self.invert { + format!("{:.2} fps", 1000000000.0 / self.nanoseconds as f64) + } else { + format!("{:.2} ms", self.nanoseconds as f64 / 1000000.0) + } + } +} + +#[derive(Clone)] +pub struct AverageTimeProfileCounter { + description: &'static str, + average_over_ns: u64, + start_ns: u64, + sum_ns: u64, + num_samples: u64, + nanoseconds: u64, + invert: bool, +} + +impl AverageTimeProfileCounter { + pub fn new(description: &'static str, invert: bool, average_over_ns: u64) -> AverageTimeProfileCounter { + AverageTimeProfileCounter { + description: description, + average_over_ns: average_over_ns, + start_ns: precise_time_ns(), + sum_ns: 0, + num_samples: 0, + nanoseconds: 0, + invert: invert, + } + } + + #[allow(dead_code)] + fn reset(&mut self) { + self.start_ns = precise_time_ns(); + self.nanoseconds = 0; + self.sum_ns = 0; + self.num_samples = 0; + } + + pub fn set(&mut self, ns: u64) { + let now = precise_time_ns(); + if (now - self.start_ns) > self.average_over_ns && + self.num_samples > 0 { + self.nanoseconds = self.sum_ns / self.num_samples; + self.start_ns = now; + self.sum_ns = 0; + self.num_samples = 0; + } + self.sum_ns += ns; + self.num_samples += 1; + } + + #[allow(dead_code)] + pub fn profile(&mut self, callback: F) -> T where F: FnOnce() -> T { + let t0 = precise_time_ns(); + let val = callback(); + let t1 = precise_time_ns(); + self.set(t1 - t0); + val + } +} + +impl ProfileCounter for AverageTimeProfileCounter { + fn description(&self) -> &'static str { + self.description + } + + fn value(&self) -> String { + if self.invert { + format!("{:.2} fps", 1000000000.0 / self.nanoseconds as f64) + } else { + format!("{:.2} ms", self.nanoseconds as f64 / 1000000.0) + } + } +} + +pub struct FrameProfileCounters { + pub total_primitives: IntProfileCounter, + pub visible_primitives: IntProfileCounter, + pub passes: IntProfileCounter, + pub targets: IntProfileCounter, +} + +impl FrameProfileCounters { + pub fn new() -> FrameProfileCounters { + FrameProfileCounters { + total_primitives: IntProfileCounter::new("Total Primitives"), + visible_primitives: IntProfileCounter::new("Visible Primitives"), + passes: IntProfileCounter::new("Passes"), + targets: IntProfileCounter::new("Render Targets"), + } + } +} + +#[derive(Clone)] +pub struct BackendProfileCounters { + pub font_templates: ResourceProfileCounter, + pub image_templates: ResourceProfileCounter, + pub total_time: TimeProfileCounter, +} + +impl BackendProfileCounters { + pub fn new() -> BackendProfileCounters { + BackendProfileCounters { + font_templates: ResourceProfileCounter::new("Font Templates"), + image_templates: ResourceProfileCounter::new("Image Templates"), + total_time: TimeProfileCounter::new("Backend CPU Time", false), + } + } + + pub fn reset(&mut self) { + self.total_time.reset(); + } +} + +pub struct RendererProfileCounters { + pub frame_counter: IntProfileCounter, + pub frame_time: AverageTimeProfileCounter, + pub draw_calls: IntProfileCounter, + pub vertices: IntProfileCounter, + pub vao_count_and_size: ResourceProfileCounter, +} + +pub struct RendererProfileTimers { + pub cpu_time: TimeProfileCounter, + pub gpu_time: TimeProfileCounter, + pub gpu_samples: Vec>, +} + +impl RendererProfileCounters { + pub fn new() -> RendererProfileCounters { + RendererProfileCounters { + frame_counter: IntProfileCounter::new("Frame"), + frame_time: AverageTimeProfileCounter::new("FPS", true, ONE_SECOND_NS / 2), + draw_calls: IntProfileCounter::new("Draw Calls"), + vertices: IntProfileCounter::new("Vertices"), + vao_count_and_size: ResourceProfileCounter::new("VAO"), + } + } + + pub fn reset(&mut self) { + self.draw_calls.reset(); + self.vertices.reset(); + } +} + +impl RendererProfileTimers { + pub fn new() -> RendererProfileTimers { + RendererProfileTimers { + cpu_time: TimeProfileCounter::new("Compositor CPU Time", false), + gpu_samples: Vec::new(), + gpu_time: TimeProfileCounter::new("GPU Time", false), + } + } +} + +struct GraphStats { + min_value: f32, + mean_value: f32, + max_value: f32, +} + +struct ProfileGraph { + max_samples: usize, + values: VecDeque, +} + +impl ProfileGraph { + fn new(max_samples: usize) -> ProfileGraph { + ProfileGraph { + max_samples: max_samples, + values: VecDeque::new(), + } + } + + fn push(&mut self, ns: u64) { + let ms = ns as f64 / 1000000.0; + if self.values.len() == self.max_samples { + self.values.pop_back(); + } + self.values.push_front(ms as f32); + } + + fn stats(&self) -> GraphStats { + let mut stats = GraphStats { + min_value: f32::MAX, + mean_value: 0.0, + max_value: -f32::MAX, + }; + + for value in &self.values { + stats.min_value = stats.min_value.min(*value); + stats.mean_value = stats.mean_value + *value; + stats.max_value = stats.max_value.max(*value); + } + + if !self.values.is_empty() { + stats.mean_value = stats.mean_value / self.values.len() as f32; + } + + stats + } + + fn draw_graph(&self, + x: f32, + y: f32, + description: &'static str, + debug_renderer: &mut DebugRenderer) -> Rect { + let size = Size2D::new(600.0, 120.0); + let line_height = debug_renderer.line_height(); + let mut rect = Rect::new(Point2D::new(x, y), size); + let stats = self.stats(); + + let text_color = ColorF::new(1.0, 1.0, 0.0, 1.0); + let text_origin = rect.origin + Point2D::new(rect.size.width, 20.0); + debug_renderer.add_text(text_origin.x, + text_origin.y, + description, + &ColorF::new(0.0, 1.0, 0.0, 1.0)); + debug_renderer.add_text(text_origin.x, + text_origin.y + line_height, + &format!("Min: {:.2} ms", stats.min_value), + &text_color); + debug_renderer.add_text(text_origin.x, + text_origin.y + line_height * 2.0, + &format!("Mean: {:.2} ms", stats.mean_value), + &text_color); + debug_renderer.add_text(text_origin.x, + text_origin.y + line_height * 3.0, + &format!("Max: {:.2} ms", stats.max_value), + &text_color); + + rect.size.width += 140.0; + debug_renderer.add_quad(rect.origin.x, + rect.origin.y, + rect.origin.x + rect.size.width + 10.0, + rect.origin.y + rect.size.height, + &ColorF::new(0.1, 0.1, 0.1, 0.8), + &ColorF::new(0.2, 0.2, 0.2, 0.8)); + + let bx0 = x + 10.0; + let by0 = y + 10.0; + let bx1 = bx0 + size.width - 20.0; + let by1 = by0 + size.height - 20.0; + + let w = (bx1 - bx0) / self.max_samples as f32; + let h = by1 - by0; + + let color_t0 = ColorF::new(0.0, 1.0, 0.0, 1.0); + let color_b0 = ColorF::new(0.0, 0.7, 0.0, 1.0); + + let color_t1 = ColorF::new(0.0, 1.0, 0.0, 1.0); + let color_b1 = ColorF::new(0.0, 0.7, 0.0, 1.0); + + let color_t2 = ColorF::new(1.0, 0.0, 0.0, 1.0); + let color_b2 = ColorF::new(0.7, 0.0, 0.0, 1.0); + + for (index, sample) in self.values.iter().enumerate() { + let sample = *sample; + let x1 = bx1 - index as f32 * w; + let x0 = x1 - w; + + let y0 = by1 - (sample / stats.max_value) as f32 * h; + let y1 = by1; + + let (color_top, color_bottom) = if sample < 1000.0 / 60.0 { + (&color_t0, &color_b0) + } else if sample < 1000.0 / 30.0 { + (&color_t1, &color_b1) + } else { + (&color_t2, &color_b2) + }; + + debug_renderer.add_quad(x0, y0, x1, y1, color_top, color_bottom); + } + + rect + } +} + +struct GpuFrame { + total_time: u64, + samples: Vec>, +} + +struct GpuFrameCollection { + frames: VecDeque, +} + +impl GpuFrameCollection { + fn new() -> GpuFrameCollection { + GpuFrameCollection { + frames: VecDeque::new(), + } + } + + fn push(&mut self, total_time: u64, samples: Vec>) { + if self.frames.len() == 20 { + self.frames.pop_back(); + } + self.frames.push_front(GpuFrame { + total_time: total_time, + samples: samples, + }); + } +} + +impl GpuFrameCollection { + fn draw(&self, + x: f32, + y: f32, + debug_renderer: &mut DebugRenderer) -> Rect { + let bounding_rect = Rect::new(Point2D::new(x, y), + Size2D::new(GRAPH_WIDTH + 2.0 * GRAPH_PADDING, + GRAPH_HEIGHT + 2.0 * GRAPH_PADDING)); + let graph_rect = bounding_rect.inflate(-GRAPH_PADDING, -GRAPH_PADDING); + + debug_renderer.add_quad(bounding_rect.origin.x, + bounding_rect.origin.y, + bounding_rect.origin.x + bounding_rect.size.width, + bounding_rect.origin.y + bounding_rect.size.height, + &ColorF::new(0.1, 0.1, 0.1, 0.8), + &ColorF::new(0.2, 0.2, 0.2, 0.8)); + + let w = graph_rect.size.width; + let mut y0 = graph_rect.origin.y; + + let max_time = self.frames + .iter() + .max_by_key(|f| f.total_time) + .unwrap() + .total_time as f32; + + for frame in &self.frames { + let y1 = y0 + GRAPH_FRAME_HEIGHT; + + let mut current_ns = 0; + for sample in &frame.samples { + let x0 = graph_rect.origin.x + w * current_ns as f32 / max_time; + current_ns += sample.time_ns; + let x1 = graph_rect.origin.x + w * current_ns as f32 / max_time; + + let mut bottom_color = sample.tag.color; + bottom_color.a *= 0.5; + + debug_renderer.add_quad(x0, + y0, + x1, + y1, + &sample.tag.color, + &bottom_color); + } + + y0 = y1; + } + + bounding_rect + } +} + +pub struct Profiler { + x_left: f32, + y_left: f32, + x_right: f32, + y_right: f32, + backend_time: ProfileGraph, + compositor_time: ProfileGraph, + gpu_time: ProfileGraph, + gpu_frames: GpuFrameCollection, +} + +impl Profiler { + pub fn new() -> Profiler { + Profiler { + x_left: 0.0, + y_left: 0.0, + x_right: 0.0, + y_right: 0.0, + backend_time: ProfileGraph::new(600), + compositor_time: ProfileGraph::new(600), + gpu_time: ProfileGraph::new(600), + gpu_frames: GpuFrameCollection::new(), + } + } + + fn draw_counters(&mut self, + counters: &[&ProfileCounter], + debug_renderer: &mut DebugRenderer, + left: bool) { + let mut label_rect = Rect::zero(); + let mut value_rect = Rect::zero(); + let (mut current_x, mut current_y) = if left { + (self.x_left, self.y_left) + } else { + (self.x_right, self.y_right) + }; + let mut color_index = 0; + let line_height = debug_renderer.line_height(); + + let colors = [ + ColorF::new(1.0, 1.0, 1.0, 1.0), + ColorF::new(1.0, 1.0, 0.0, 1.0), + ]; + + for counter in counters { + let rect = debug_renderer.add_text(current_x, + current_y, + counter.description(), + &colors[color_index]); + color_index = (color_index+1) % colors.len(); + + label_rect = label_rect.union(&rect); + current_y += line_height; + } + + color_index = 0; + current_x = label_rect.origin.x + label_rect.size.width + 60.0; + current_y = if left { + self.y_left + } else { + self.y_right + }; + + for counter in counters { + let rect = debug_renderer.add_text(current_x, + current_y, + &counter.value(), + &colors[color_index]); + color_index = (color_index+1) % colors.len(); + + value_rect = value_rect.union(&rect); + current_y += line_height; + } + + let total_rect = label_rect.union(&value_rect).inflate(10.0, 10.0); + debug_renderer.add_quad(total_rect.origin.x, + total_rect.origin.y, + total_rect.origin.x + total_rect.size.width, + total_rect.origin.y + total_rect.size.height, + &ColorF::new(0.1, 0.1, 0.1, 0.8), + &ColorF::new(0.2, 0.2, 0.2, 0.8)); + let new_y = total_rect.origin.y + total_rect.size.height + 30.0; + if left { + self.y_left = new_y; + } else { + self.y_right = new_y; + } + } + + pub fn draw_profile(&mut self, + frame_profile: &FrameProfileCounters, + backend_profile: &BackendProfileCounters, + renderer_profile: &RendererProfileCounters, + renderer_timers: &mut RendererProfileTimers, + debug_renderer: &mut DebugRenderer) { + + let _gm = GpuMarker::new("profile"); + self.x_left = 20.0; + self.y_left = 40.0; + self.x_right = 400.0; + self.y_right = 40.0; + + self.draw_counters(&[ + &renderer_profile.frame_counter, + &renderer_profile.frame_time, + ], debug_renderer, true); + + self.draw_counters(&[ + &frame_profile.total_primitives, + &frame_profile.visible_primitives, + &frame_profile.passes, + &frame_profile.targets, + ], debug_renderer, true); + + self.draw_counters(&[ + &backend_profile.font_templates, + &backend_profile.image_templates, + ], debug_renderer, true); + + self.draw_counters(&[ + &renderer_profile.draw_calls, + &renderer_profile.vertices, + ], debug_renderer, true); + + self.draw_counters(&[ + &backend_profile.total_time, + &renderer_timers.cpu_time, + &renderer_timers.gpu_time, + ], debug_renderer, false); + + let mut gpu_time = 0; + let gpu_samples = mem::replace(&mut renderer_timers.gpu_samples, Vec::new()); + for sample in &gpu_samples { + gpu_time += sample.time_ns; + } + + self.backend_time.push(backend_profile.total_time.nanoseconds); + self.compositor_time.push(renderer_timers.cpu_time.nanoseconds); + self.gpu_time.push(gpu_time); + self.gpu_frames.push(gpu_time, gpu_samples); + + let rect = self.backend_time.draw_graph(self.x_left, self.y_left, "CPU (backend)", debug_renderer); + self.y_left += rect.size.height + PROFILE_PADDING; + let rect = self.compositor_time.draw_graph(self.x_left, self.y_left, "CPU (compositor)", debug_renderer); + self.y_left += rect.size.height + PROFILE_PADDING; + let rect = self.gpu_time.draw_graph(self.x_left, self.y_left, "GPU", debug_renderer); + self.y_left += rect.size.height + PROFILE_PADDING; + let rect = self.gpu_frames.draw(self.x_left, + self.y_left, + debug_renderer); + self.y_left += rect.size.height + PROFILE_PADDING; + } +} diff --git a/gfx/webrender/src/record.rs b/gfx/webrender/src/record.rs new file mode 100644 index 000000000000..55baa51c0799 --- /dev/null +++ b/gfx/webrender/src/record.rs @@ -0,0 +1,86 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use bincode::serde::serialize; +use bincode; +use std::mem; +use std::any::TypeId; +use std::fs::{File, OpenOptions}; +use std::io::Write; +use std::ops::DerefMut; +use std::sync::Mutex; +use webrender_traits::ApiMsg; +use byteorder::{LittleEndian, WriteBytesExt}; + +lazy_static! { + static ref WEBRENDER_RECORDING_DETOUR: Mutex>> = Mutex::new(None); +} + +pub static WEBRENDER_RECORDING_HEADER: u64 = 0xbeefbeefbeefbe01u64; +static mut CURRENT_FRAME_NUMBER: u32 = 0xffffffffu32; + +pub trait ApiRecordingReceiver: Send { + fn write_msg(&mut self, frame: u32, msg: &ApiMsg); + fn write_payload(&mut self, frame: u32, data: &[u8]); +} + +pub fn set_recording_detour(detour: Option>) { + let mut recorder = WEBRENDER_RECORDING_DETOUR.lock(); + *recorder.as_mut().unwrap().deref_mut() = detour; +} + +fn write_data(frame: u32, data: &[u8]) { + let filename = format!("record/frame_{}.bin", frame); + let mut file = if unsafe { CURRENT_FRAME_NUMBER != frame } { + unsafe { CURRENT_FRAME_NUMBER = frame; } + + let mut file = File::create(filename).unwrap(); + let apimsg_type_id = unsafe { + assert!(mem::size_of::() == mem::size_of::()); + mem::transmute::(TypeId::of::()) + }; + + file.write_u64::(WEBRENDER_RECORDING_HEADER).ok(); + file.write_u64::(apimsg_type_id).ok(); + file + } else { + OpenOptions::new().append(true).create(false).open(filename).unwrap() + }; + file.write_u32::(data.len() as u32).ok(); + file.write(data).ok(); +} + +pub fn write_msg(frame: u32, msg: &ApiMsg) { + match msg { + &ApiMsg::AddRawFont(..) | + &ApiMsg::AddNativeFont(..) | + &ApiMsg::AddImage(..) | + &ApiMsg::UpdateImage(..) | + &ApiMsg::DeleteImage(..)| + &ApiMsg::SetRootDisplayList(..) | + &ApiMsg::SetRootPipeline(..) | + &ApiMsg::Scroll(..) | + &ApiMsg::TickScrollingBounce | + &ApiMsg::WebGLCommand(..) => { + let mut recorder = WEBRENDER_RECORDING_DETOUR.lock(); + if let Some(ref mut recorder) = recorder.as_mut().unwrap().as_mut() { + recorder.write_msg(frame, &msg); + } else { + let buff = serialize(msg, bincode::SizeLimit::Infinite).unwrap(); + write_data(frame, &buff); + } + } + _ => {} + } +} + +pub fn write_payload(frame: u32, data: &[u8]) { + let mut recorder = WEBRENDER_RECORDING_DETOUR.lock(); + if let Some(ref mut recorder) = recorder.as_mut().unwrap().as_mut() { + recorder.write_payload(frame, data); + } else { + write_data(frame, &[]); //signal the payload + write_data(frame, data); + } +} diff --git a/gfx/webrender/src/render_backend.rs b/gfx/webrender/src/render_backend.rs new file mode 100644 index 000000000000..c67cfb1a8a95 --- /dev/null +++ b/gfx/webrender/src/render_backend.rs @@ -0,0 +1,492 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use byteorder::{LittleEndian, ReadBytesExt}; +use frame::Frame; +use internal_types::{FontTemplate, GLContextHandleWrapper, GLContextWrapper}; +use internal_types::{SourceTexture, ResultMsg, RendererFrame}; +use profiler::BackendProfileCounters; +use record; +use resource_cache::ResourceCache; +use scene::Scene; +use std::collections::HashMap; +use std::fs; +use std::io::{Cursor, Read}; +use std::sync::{Arc, Mutex}; +use std::sync::mpsc::Sender; +use texture_cache::TextureCache; +use webrender_traits::{ApiMsg, AuxiliaryLists, BuiltDisplayList, IdNamespace, ImageData}; +use webrender_traits::{RenderNotifier, RenderDispatcher, WebGLCommand, WebGLContextId}; +use webrender_traits::channel::{PayloadHelperMethods, PayloadReceiver, PayloadSender, MsgReceiver}; +use webrender_traits::{VRCompositorCommand, VRCompositorHandler}; +use tiling::FrameBuilderConfig; +use offscreen_gl_context::GLContextDispatcher; + +/// The render backend is responsible for transforming high level display lists into +/// GPU-friendly work which is then submitted to the renderer in the form of a frame::Frame. +/// +/// The render backend operates on its own thread. +pub struct RenderBackend { + api_rx: MsgReceiver, + payload_rx: PayloadReceiver, + payload_tx: PayloadSender, + result_tx: Sender, + + device_pixel_ratio: f32, + next_namespace_id: IdNamespace, + + resource_cache: ResourceCache, + + scene: Scene, + frame: Frame, + + notifier: Arc>>>, + webrender_context_handle: Option, + webgl_contexts: HashMap, + current_bound_webgl_context_id: Option, + enable_recording: bool, + main_thread_dispatcher: Arc>>>, + + next_webgl_id: usize, + + vr_compositor_handler: Arc>>> +} + +impl RenderBackend { + pub fn new(api_rx: MsgReceiver, + payload_rx: PayloadReceiver, + payload_tx: PayloadSender, + result_tx: Sender, + device_pixel_ratio: f32, + texture_cache: TextureCache, + enable_aa: bool, + notifier: Arc>>>, + webrender_context_handle: Option, + config: FrameBuilderConfig, + debug: bool, + enable_recording:bool, + main_thread_dispatcher: Arc>>>, + vr_compositor_handler: Arc>>>) -> RenderBackend { + + let resource_cache = ResourceCache::new(texture_cache, + enable_aa); + + RenderBackend { + api_rx: api_rx, + payload_rx: payload_rx, + payload_tx: payload_tx, + result_tx: result_tx, + device_pixel_ratio: device_pixel_ratio, + resource_cache: resource_cache, + scene: Scene::new(), + frame: Frame::new(debug, config), + next_namespace_id: IdNamespace(1), + notifier: notifier, + webrender_context_handle: webrender_context_handle, + webgl_contexts: HashMap::new(), + current_bound_webgl_context_id: None, + enable_recording:enable_recording, + main_thread_dispatcher: main_thread_dispatcher, + next_webgl_id: 0, + vr_compositor_handler: vr_compositor_handler + } + } + + pub fn run(&mut self) { + let mut profile_counters = BackendProfileCounters::new(); + let mut frame_counter: u32 = 0; + if self.enable_recording { + fs::create_dir("record").ok(); + } + + loop { + let msg = self.api_rx.recv(); + match msg { + Ok(msg) => { + if self.enable_recording { + record::write_msg(frame_counter, &msg); + } + match msg { + ApiMsg::AddRawFont(id, bytes) => { + profile_counters.font_templates.inc(bytes.len()); + self.resource_cache + .add_font_template(id, FontTemplate::Raw(Arc::new(bytes))); + } + ApiMsg::AddNativeFont(id, native_font_handle) => { + self.resource_cache + .add_font_template(id, FontTemplate::Native(native_font_handle)); + } + ApiMsg::GetGlyphDimensions(glyph_keys, tx) => { + let mut glyph_dimensions = Vec::with_capacity(glyph_keys.len()); + for glyph_key in &glyph_keys { + let glyph_dim = self.resource_cache.get_glyph_dimensions(glyph_key); + glyph_dimensions.push(glyph_dim); + }; + tx.send(glyph_dimensions).unwrap(); + } + ApiMsg::AddImage(id, descriptor, data) => { + if let ImageData::Raw(ref bytes) = data { + profile_counters.image_templates.inc(bytes.len()); + } + self.resource_cache.add_image_template(id, descriptor, data); + } + ApiMsg::UpdateImage(id, descriptor, bytes) => { + self.resource_cache.update_image_template(id, descriptor, bytes); + } + ApiMsg::DeleteImage(id) => { + self.resource_cache.delete_image_template(id); + } + ApiMsg::CloneApi(sender) => { + let result = self.next_namespace_id; + + let IdNamespace(id_namespace) = self.next_namespace_id; + self.next_namespace_id = IdNamespace(id_namespace + 1); + + sender.send(result).unwrap(); + } + ApiMsg::SetRootDisplayList(background_color, + epoch, + pipeline_id, + viewport_size, + display_list_descriptor, + auxiliary_lists_descriptor) => { + let mut leftover_auxiliary_data = vec![]; + let mut auxiliary_data; + loop { + auxiliary_data = self.payload_rx.recv().unwrap(); + { + let mut payload_reader = Cursor::new(&auxiliary_data[..]); + let payload_epoch = + payload_reader.read_u32::().unwrap(); + if payload_epoch == epoch.0 { + break + } + } + leftover_auxiliary_data.push(auxiliary_data) + } + for leftover_auxiliary_data in leftover_auxiliary_data { + self.payload_tx.send_vec(leftover_auxiliary_data).unwrap() + } + if self.enable_recording { + record::write_payload(frame_counter, &auxiliary_data); + } + + let mut auxiliary_data = Cursor::new(&mut auxiliary_data[4..]); + let mut built_display_list_data = + vec![0; display_list_descriptor.size()]; + auxiliary_data.read_exact(&mut built_display_list_data[..]).unwrap(); + let built_display_list = + BuiltDisplayList::from_data(built_display_list_data, + display_list_descriptor); + + let mut auxiliary_lists_data = + vec![0; auxiliary_lists_descriptor.size()]; + auxiliary_data.read_exact(&mut auxiliary_lists_data[..]).unwrap(); + let auxiliary_lists = + AuxiliaryLists::from_data(auxiliary_lists_data, + auxiliary_lists_descriptor); + + self.scene.set_root_display_list(pipeline_id, + epoch, + built_display_list, + background_color, + viewport_size, + auxiliary_lists); + self.build_scene(); + } + ApiMsg::SetRootPipeline(pipeline_id) => { + self.scene.set_root_pipeline_id(pipeline_id); + + if self.scene.display_lists.get(&pipeline_id).is_none() { + continue; + } + + self.build_scene(); + } + ApiMsg::Scroll(delta, cursor, move_phase) => { + let frame = profile_counters.total_time.profile(|| { + if self.frame.scroll(delta, cursor, move_phase) { + Some(self.render()) + } else { + None + } + }); + + match frame { + Some(frame) => { + self.publish_frame(frame, &mut profile_counters); + self.notify_compositor_of_new_scroll_frame(true) + } + None => self.notify_compositor_of_new_scroll_frame(false), + } + } + ApiMsg::ScrollLayersWithScrollId(origin, pipeline_id, scroll_root_id) => { + let frame = profile_counters.total_time.profile(|| { + if self.frame.scroll_layers(origin, pipeline_id, scroll_root_id) { + Some(self.render()) + } else { + None + } + }); + + match frame { + Some(frame) => { + self.publish_frame(frame, &mut profile_counters); + self.notify_compositor_of_new_scroll_frame(true) + } + None => self.notify_compositor_of_new_scroll_frame(false), + } + + } + ApiMsg::TickScrollingBounce => { + let frame = profile_counters.total_time.profile(|| { + self.frame.tick_scrolling_bounce_animations(); + self.render() + }); + + self.publish_frame_and_notify_compositor(frame, &mut profile_counters); + } + ApiMsg::TranslatePointToLayerSpace(..) => { + panic!("unused api - remove from webrender_traits"); + } + ApiMsg::GetScrollLayerState(tx) => { + tx.send(self.frame.get_scroll_layer_state()) + .unwrap() + } + ApiMsg::RequestWebGLContext(size, attributes, tx) => { + if let Some(ref wrapper) = self.webrender_context_handle { + let dispatcher: Option> = if cfg!(target_os = "windows") { + Some(Box::new(WebRenderGLDispatcher { + dispatcher: self.main_thread_dispatcher.clone() + })) + } else { + None + }; + + let result = wrapper.new_context(size, attributes, dispatcher); + + match result { + Ok(ctx) => { + let id = WebGLContextId(self.next_webgl_id); + self.next_webgl_id += 1; + + let (real_size, texture_id, limits) = ctx.get_info(); + + self.webgl_contexts.insert(id, ctx); + + self.resource_cache + .add_webgl_texture(id, SourceTexture::WebGL(texture_id), + real_size); + + tx.send(Ok((id, limits))).unwrap(); + }, + Err(msg) => { + tx.send(Err(msg.to_owned())).unwrap(); + } + } + } else { + tx.send(Err("Not implemented yet".to_owned())).unwrap(); + } + } + ApiMsg::ResizeWebGLContext(context_id, size) => { + let ctx = self.webgl_contexts.get_mut(&context_id).unwrap(); + ctx.make_current(); + match ctx.resize(&size) { + Ok(_) => { + // Update webgl texture size. Texture id may change too. + let (real_size, texture_id, _) = ctx.get_info(); + self.resource_cache + .update_webgl_texture(context_id, SourceTexture::WebGL(texture_id), + real_size); + }, + Err(msg) => { + error!("Error resizing WebGLContext: {}", msg); + } + } + } + ApiMsg::WebGLCommand(context_id, command) => { + // TODO: Buffer the commands and only apply them here if they need to + // be synchronous. + let ctx = &self.webgl_contexts[&context_id]; + ctx.make_current(); + ctx.apply_command(command); + self.current_bound_webgl_context_id = Some(context_id); + }, + + ApiMsg::VRCompositorCommand(context_id, command) => { + self.handle_vr_compositor_command(context_id, command); + } + ApiMsg::GenerateFrame => { + let frame = profile_counters.total_time.profile(|| { + self.render() + }); + if self.scene.root_pipeline_id.is_some() { + self.publish_frame_and_notify_compositor(frame, &mut profile_counters); + frame_counter += 1; + } + } + ApiMsg::ExternalEvent(evt) => { + let notifier = self.notifier.lock(); + notifier.unwrap() + .as_mut() + .unwrap() + .external_event(evt); + } + ApiMsg::ShutDown => { + let notifier = self.notifier.lock(); + notifier.unwrap() + .as_mut() + .unwrap() + .shut_down(); + break; + } + } + } + Err(..) => { + let notifier = self.notifier.lock(); + notifier.unwrap() + .as_mut() + .unwrap() + .shut_down(); + break; + } + } + } + } + + fn build_scene(&mut self) { + // Flatten the stacking context hierarchy + let mut new_pipeline_sizes = HashMap::new(); + + if let Some(id) = self.current_bound_webgl_context_id { + self.webgl_contexts[&id].unbind(); + self.current_bound_webgl_context_id = None; + } + + // When running in OSMesa mode with texture sharing, + // a flush is required on any GL contexts to ensure + // that read-back from the shared texture returns + // valid data! This should be fine to have run on all + // implementations - a single flush for each webgl + // context at the start of a render frame should + // incur minimal cost. + for (_, webgl_context) in &self.webgl_contexts { + webgl_context.make_current(); + webgl_context.apply_command(WebGLCommand::Flush); + webgl_context.unbind(); + } + + self.frame.create(&self.scene, &mut new_pipeline_sizes); + + let mut updated_pipeline_sizes = HashMap::new(); + + for (pipeline_id, old_size) in self.scene.pipeline_sizes.drain() { + let new_size = new_pipeline_sizes.remove(&pipeline_id); + + match new_size { + Some(new_size) => { + // Exists in both old and new -> check if size changed + if new_size != old_size { + let mut notifier = self.notifier.lock(); + notifier.as_mut() + .unwrap() + .as_mut() + .unwrap() + .pipeline_size_changed(pipeline_id, Some(new_size)); + } + + // Re-insert + updated_pipeline_sizes.insert(pipeline_id, new_size); + } + None => { + // Was existing, not in current frame anymore + let mut notifier = self.notifier.lock(); + notifier.as_mut() + .unwrap() + .as_mut() + .unwrap() + .pipeline_size_changed(pipeline_id, None); + } + } + } + + // Any remaining items are new pipelines + for (pipeline_id, new_size) in new_pipeline_sizes.drain() { + let mut notifier = self.notifier.lock(); + notifier.as_mut() + .unwrap() + .as_mut() + .unwrap() + .pipeline_size_changed(pipeline_id, Some(new_size)); + updated_pipeline_sizes.insert(pipeline_id, new_size); + } + + self.scene.pipeline_sizes = updated_pipeline_sizes; + } + + fn render(&mut self) -> RendererFrame { + let frame = self.frame.build(&mut self.resource_cache, + &self.scene.pipeline_auxiliary_lists, + self.device_pixel_ratio); + + frame + } + + fn publish_frame(&mut self, + frame: RendererFrame, + profile_counters: &mut BackendProfileCounters) { + let pending_update = self.resource_cache.pending_updates(); + let pending_external_image_update = self.resource_cache.pending_external_image_updates(); + let msg = ResultMsg::NewFrame(frame, pending_update, pending_external_image_update, profile_counters.clone()); + self.result_tx.send(msg).unwrap(); + profile_counters.reset(); + } + + fn publish_frame_and_notify_compositor(&mut self, + frame: RendererFrame, + profile_counters: &mut BackendProfileCounters) { + self.publish_frame(frame, profile_counters); + + // TODO(gw): This is kindof bogus to have to lock the notifier + // each time it's used. This is due to some nastiness + // in initialization order for Servo. Perhaps find a + // cleaner way to do this, or use the OnceMutex on crates.io? + let mut notifier = self.notifier.lock(); + notifier.as_mut().unwrap().as_mut().unwrap().new_frame_ready(); + } + + fn notify_compositor_of_new_scroll_frame(&mut self, composite_needed: bool) { + // TODO(gw): This is kindof bogus to have to lock the notifier + // each time it's used. This is due to some nastiness + // in initialization order for Servo. Perhaps find a + // cleaner way to do this, or use the OnceMutex on crates.io? + let mut notifier = self.notifier.lock(); + notifier.as_mut().unwrap().as_mut().unwrap().new_scroll_frame_ready(composite_needed); + } + + fn handle_vr_compositor_command(&mut self, ctx_id: WebGLContextId, cmd: VRCompositorCommand) { + let texture = match cmd { + VRCompositorCommand::SubmitFrame(..) => { + match self.resource_cache.get_webgl_texture(&ctx_id).texture_id { + SourceTexture::WebGL(texture_id) => Some(texture_id), + _=> None + } + }, + _ => None + }; + let mut handler = self.vr_compositor_handler.lock(); + handler.as_mut().unwrap().as_mut().unwrap().handle(cmd, texture); + } +} + +struct WebRenderGLDispatcher { + dispatcher: Arc>>> +} + +impl GLContextDispatcher for WebRenderGLDispatcher { + fn dispatch(&self, f: Box) { + let mut dispatcher = self.dispatcher.lock(); + dispatcher.as_mut().unwrap().as_mut().unwrap().dispatch(f); + } +} diff --git a/gfx/webrender/src/renderer.rs b/gfx/webrender/src/renderer.rs new file mode 100644 index 000000000000..d4373a8e5622 --- /dev/null +++ b/gfx/webrender/src/renderer.rs @@ -0,0 +1,1545 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! The webrender API. +//! +//! The `webrender::renderer` module provides the interface to webrender, which +//! is accessible through [`Renderer`][renderer] +//! +//! [renderer]: struct.Renderer.html + +use debug_colors; +use debug_render::DebugRenderer; +use device::{DepthFunction, Device, ProgramId, TextureId, VertexFormat, GpuMarker, GpuProfiler}; +use device::{TextureFilter, VAOId, VertexUsageHint, FileWatcherHandler, TextureTarget}; +use euclid::Matrix4D; +use fnv::FnvHasher; +use internal_types::{CacheTextureId, RendererFrame, ResultMsg, TextureUpdateOp}; +use internal_types::{ExternalImageUpdateList, TextureUpdateList, PackedVertex, RenderTargetMode}; +use internal_types::{ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE, SourceTexture}; +use internal_types::{BatchTextures, TextureSampler, GLContextHandleWrapper}; +use profiler::{Profiler, BackendProfileCounters}; +use profiler::{GpuProfileTag, RendererProfileTimers, RendererProfileCounters}; +use render_backend::RenderBackend; +use std::cmp; +use std::collections::HashMap; +use std::f32; +use std::hash::BuildHasherDefault; +use std::mem; +use std::path::PathBuf; +use std::sync::{Arc, Mutex}; +use std::sync::mpsc::{channel, Receiver, Sender}; +use std::thread; +use texture_cache::TextureCache; +use tiling::{Frame, FrameBuilderConfig, PrimitiveBatch, PrimitiveBatchData}; +use tiling::{BlurCommand, CacheClipInstance, PrimitiveInstance, RenderTarget}; +use time::precise_time_ns; +use util::TransformedRectKind; +use webrender_traits::{ColorF, Epoch, PipelineId, RenderNotifier, RenderDispatcher}; +use webrender_traits::{ExternalImageId, ImageFormat, RenderApiSender, RendererKind}; +use webrender_traits::{DeviceIntRect, DevicePoint, DeviceIntPoint, DeviceIntSize, DeviceUintSize}; +use webrender_traits::ImageDescriptor; +use webrender_traits::channel; +use webrender_traits::VRCompositorHandler; + +pub const VERTEX_TEXTURE_POOL: usize = 5; +pub const MAX_VERTEX_TEXTURE_WIDTH: usize = 1024; + +const GPU_TAG_CACHE_BOX_SHADOW: GpuProfileTag = GpuProfileTag { label: "C_BoxShadow", color: debug_colors::BLACK }; +const GPU_TAG_CACHE_CLIP: GpuProfileTag = GpuProfileTag { label: "C_Clip", color: debug_colors::PURPLE }; +const GPU_TAG_CACHE_TEXT_RUN: GpuProfileTag = GpuProfileTag { label: "C_TextRun", color: debug_colors::MISTYROSE }; +const GPU_TAG_INIT: GpuProfileTag = GpuProfileTag { label: "Init", color: debug_colors::WHITE }; +const GPU_TAG_SETUP_TARGET: GpuProfileTag = GpuProfileTag { label: "Target", color: debug_colors::SLATEGREY }; +const GPU_TAG_PRIM_RECT: GpuProfileTag = GpuProfileTag { label: "Rect", color: debug_colors::RED }; +const GPU_TAG_PRIM_IMAGE: GpuProfileTag = GpuProfileTag { label: "Image", color: debug_colors::GREEN }; +const GPU_TAG_PRIM_YUV_IMAGE: GpuProfileTag = GpuProfileTag { label: "YuvImage", color: debug_colors::DARKGREEN }; +const GPU_TAG_PRIM_BLEND: GpuProfileTag = GpuProfileTag { label: "Blend", color: debug_colors::LIGHTBLUE }; +const GPU_TAG_PRIM_COMPOSITE: GpuProfileTag = GpuProfileTag { label: "Composite", color: debug_colors::MAGENTA }; +const GPU_TAG_PRIM_TEXT_RUN: GpuProfileTag = GpuProfileTag { label: "TextRun", color: debug_colors::BLUE }; +const GPU_TAG_PRIM_GRADIENT: GpuProfileTag = GpuProfileTag { label: "Gradient", color: debug_colors::YELLOW }; +const GPU_TAG_PRIM_ANGLE_GRADIENT: GpuProfileTag = GpuProfileTag { label: "AngleGradient", color: debug_colors::POWDERBLUE }; +const GPU_TAG_PRIM_RADIAL_GRADIENT: GpuProfileTag = GpuProfileTag { label: "RadialGradient", color: debug_colors::LIGHTPINK }; +const GPU_TAG_PRIM_BOX_SHADOW: GpuProfileTag = GpuProfileTag { label: "BoxShadow", color: debug_colors::CYAN }; +const GPU_TAG_PRIM_BORDER: GpuProfileTag = GpuProfileTag { label: "Border", color: debug_colors::ORANGE }; +const GPU_TAG_PRIM_CACHE_IMAGE: GpuProfileTag = GpuProfileTag { label: "CacheImage", color: debug_colors::SILVER }; +const GPU_TAG_BLUR: GpuProfileTag = GpuProfileTag { label: "Blur", color: debug_colors::VIOLET }; + +#[derive(Debug, Copy, Clone, PartialEq)] +pub enum BlendMode { + None, + Alpha, + // Use the color of the text itself as a constant color blend factor. + Subpixel(ColorF), +} + +struct VertexDataTexture { + id: TextureId, +} + +impl VertexDataTexture { + fn new(device: &mut Device) -> VertexDataTexture { + let id = device.create_texture_ids(1, TextureTarget::Default)[0]; + + VertexDataTexture { + id: id, + } + } + + fn init(&mut self, + device: &mut Device, + data: &mut Vec) { + if data.is_empty() { + return; + } + + let item_size = mem::size_of::(); + debug_assert!(item_size % 16 == 0); + let vecs_per_item = item_size / 16; + + let items_per_row = MAX_VERTEX_TEXTURE_WIDTH / vecs_per_item; + + // Extend the data array to be a multiple of the row size. + // This ensures memory safety when the array is passed to + // OpenGL to upload to the GPU. + while data.len() % items_per_row != 0 { + data.push(T::default()); + } + + let width = items_per_row * vecs_per_item; + let height = data.len() / items_per_row; + + device.init_texture(self.id, + width as u32, + height as u32, + ImageFormat::RGBAF32, + TextureFilter::Nearest, + RenderTargetMode::None, + Some(unsafe { mem::transmute(data.as_slice()) } )); + } +} + +const TRANSFORM_FEATURE: &'static str = "TRANSFORM"; +const SUBPIXEL_AA_FEATURE: &'static str = "SUBPIXEL_AA"; +const CLIP_FEATURE: &'static str = "CLIP"; + +enum ShaderKind { + Primitive, + Cache, + ClipCache, +} + +struct LazilyCompiledShader { + id: Option, + name: &'static str, + kind: ShaderKind, + features: Vec<&'static str>, +} + +impl LazilyCompiledShader { + fn new(kind: ShaderKind, + name: &'static str, + features: &[&'static str], + device: &mut Device, + precache: bool) -> LazilyCompiledShader { + let mut shader = LazilyCompiledShader { + id: None, + name: name, + kind: kind, + features: features.to_vec(), + }; + + if precache { + shader.get(device); + } + + shader + } + + fn get(&mut self, device: &mut Device) -> ProgramId { + if self.id.is_none() { + let id = match self.kind { + ShaderKind::Primitive | ShaderKind::Cache => { + create_prim_shader(self.name, + device, + &self.features) + } + ShaderKind::ClipCache => { + create_clip_shader(self.name, device) + } + }; + self.id = Some(id); + } + + self.id.unwrap() + } +} + +struct PrimitiveShader { + simple: LazilyCompiledShader, + transform: LazilyCompiledShader, +} + +struct FileWatcher { + notifier: Arc>>>, + result_tx: Sender, +} + +impl FileWatcherHandler for FileWatcher { + fn file_changed(&self, path: PathBuf) { + self.result_tx.send(ResultMsg::RefreshShader(path)).ok(); + let mut notifier = self.notifier.lock(); + notifier.as_mut().unwrap().as_mut().unwrap().new_frame_ready(); + } +} + +fn _get_ubo_max_len(max_ubo_size: usize) -> usize { + let item_size = mem::size_of::(); + let max_items = max_ubo_size / item_size; + + // TODO(gw): Clamping to 1024 since some shader compilers + // seem to go very slow when you have high + // constants for array lengths. Investigate + // whether this clamping actually hurts performance! + cmp::min(max_items, 1024) +} + +impl PrimitiveShader { + fn new(name: &'static str, + device: &mut Device, + features: &[&'static str], + precache: bool) -> PrimitiveShader { + let simple = LazilyCompiledShader::new(ShaderKind::Primitive, + name, + features, + device, + precache); + + let mut transform_features = features.to_vec(); + transform_features.push(TRANSFORM_FEATURE); + + let transform = LazilyCompiledShader::new(ShaderKind::Primitive, + name, + &transform_features, + device, + precache); + + PrimitiveShader { + simple: simple, + transform: transform, + } + } + + fn get(&mut self, + device: &mut Device, + transform_kind: TransformedRectKind) -> ProgramId { + match transform_kind { + TransformedRectKind::AxisAligned => self.simple.get(device), + TransformedRectKind::Complex => self.transform.get(device), + } + } +} + +fn create_prim_shader(name: &'static str, + device: &mut Device, + features: &[&'static str]) -> ProgramId { + let mut prefix = format!("#define WR_MAX_VERTEX_TEXTURE_WIDTH {}\n", + MAX_VERTEX_TEXTURE_WIDTH); + + for feature in features { + prefix.push_str(&format!("#define WR_FEATURE_{}\n", feature)); + } + + let includes = &["prim_shared"]; + let program_id = device.create_program_with_prefix(name, + includes, + Some(prefix)); + debug!("PrimShader {}", name); + + program_id +} + +fn create_clip_shader(name: &'static str, device: &mut Device) -> ProgramId { + let prefix = format!("#define WR_MAX_VERTEX_TEXTURE_WIDTH {}\n + #define WR_FEATURE_TRANSFORM", + MAX_VERTEX_TEXTURE_WIDTH); + + let includes = &["prim_shared", "clip_shared"]; + let program_id = device.create_program_with_prefix(name, + includes, + Some(prefix)); + debug!("ClipShader {}", name); + + program_id +} + +struct VertexTextures { + layer_texture: VertexDataTexture, + render_task_texture: VertexDataTexture, + prim_geom_texture: VertexDataTexture, + data16_texture: VertexDataTexture, + data32_texture: VertexDataTexture, + data64_texture: VertexDataTexture, + data128_texture: VertexDataTexture, + resource_rects_texture: VertexDataTexture, +} + +impl VertexTextures { + fn new(device: &mut Device) -> VertexTextures { + VertexTextures { + layer_texture: VertexDataTexture::new(device), + render_task_texture: VertexDataTexture::new(device), + prim_geom_texture: VertexDataTexture::new(device), + data16_texture: VertexDataTexture::new(device), + data32_texture: VertexDataTexture::new(device), + data64_texture: VertexDataTexture::new(device), + data128_texture: VertexDataTexture::new(device), + resource_rects_texture: VertexDataTexture::new(device), + } + } + + fn init_frame(&mut self, device: &mut Device, frame: &mut Frame) { + self.data16_texture.init(device, &mut frame.gpu_data16); + self.data32_texture.init(device, &mut frame.gpu_data32); + self.data64_texture.init(device, &mut frame.gpu_data64); + self.data128_texture.init(device, &mut frame.gpu_data128); + self.prim_geom_texture.init(device, &mut frame.gpu_geometry); + self.resource_rects_texture.init(device, &mut frame.gpu_resource_rects); + self.layer_texture.init(device, &mut frame.layer_texture_data); + self.render_task_texture.init(device, &mut frame.render_task_data); + + device.bind_texture(TextureSampler::Layers, self.layer_texture.id); + device.bind_texture(TextureSampler::RenderTasks, self.render_task_texture.id); + device.bind_texture(TextureSampler::Geometry, self.prim_geom_texture.id); + device.bind_texture(TextureSampler::Data16, self.data16_texture.id); + device.bind_texture(TextureSampler::Data32, self.data32_texture.id); + device.bind_texture(TextureSampler::Data64, self.data64_texture.id); + device.bind_texture(TextureSampler::Data128, self.data128_texture.id); + device.bind_texture(TextureSampler::ResourceRects, self.resource_rects_texture.id); + } +} + +/// The renderer is responsible for submitting to the GPU the work prepared by the +/// RenderBackend. +pub struct Renderer { + result_rx: Receiver, + device: Device, + pending_texture_updates: Vec, + pending_shader_updates: Vec, + current_frame: Option, + + // These are "cache shaders". These shaders are used to + // draw intermediate results to cache targets. The results + // of these shaders are then used by the primitive shaders. + cs_box_shadow: LazilyCompiledShader, + cs_text_run: LazilyCompiledShader, + cs_blur: LazilyCompiledShader, + /// These are "cache clip shaders". These shaders are used to + /// draw clip instances into the cached clip mask. The results + /// of these shaders are also used by the primitive shaders. + cs_clip_rectangle: LazilyCompiledShader, + cs_clip_image: LazilyCompiledShader, + + // The are "primitive shaders". These shaders draw and blend + // final results on screen. They are aware of tile boundaries. + // Most draw directly to the framebuffer, but some use inputs + // from the cache shaders to draw. Specifically, the box + // shadow primitive shader stretches the box shadow cache + // output, and the cache_image shader blits the results of + // a cache shader (e.g. blur) to the screen. + ps_rectangle: PrimitiveShader, + ps_rectangle_clip: PrimitiveShader, + ps_text_run: PrimitiveShader, + ps_text_run_subpixel: PrimitiveShader, + ps_image: PrimitiveShader, + ps_yuv_image: PrimitiveShader, + ps_border: PrimitiveShader, + ps_gradient: PrimitiveShader, + ps_angle_gradient: PrimitiveShader, + ps_radial_gradient: PrimitiveShader, + ps_box_shadow: PrimitiveShader, + ps_cache_image: PrimitiveShader, + + ps_blend: LazilyCompiledShader, + ps_composite: LazilyCompiledShader, + + notifier: Arc>>>, + + enable_profiler: bool, + clear_framebuffer: bool, + clear_color: ColorF, + debug: DebugRenderer, + render_target_debug: bool, + backend_profile_counters: BackendProfileCounters, + profile_counters: RendererProfileCounters, + profiler: Profiler, + last_time: u64, + + render_targets: Vec, + + gpu_profile: GpuProfiler, + prim_vao_id: VAOId, + blur_vao_id: VAOId, + clip_vao_id: VAOId, + + vt_index: usize, + vertex_textures: [VertexTextures; VERTEX_TEXTURE_POOL], + + pipeline_epoch_map: HashMap>, + /// Used to dispatch functions to the main thread's event loop. + /// Required to allow GLContext sharing in some implementations like WGL. + main_thread_dispatcher: Arc>>>, + + /// A vector for fast resolves of texture cache IDs to + /// native texture IDs. This maps to a free-list managed + /// by the backend thread / texture cache. We free the + /// texture memory associated with a TextureId when its + /// texture cache ID is freed by the texture cache, but + /// reuse the TextureId when the texture caches's free + /// list reuses the texture cache ID. This saves having to + /// use a hashmap, and allows a flat vector for performance. + cache_texture_id_map: Vec, + + /// Optional trait object that allows the client + /// application to provide external buffers for image data. + external_image_handler: Option>, + + /// Map of external image IDs to native textures. + external_images: HashMap>, + + // Optional trait object that handles WebVR commands. + // Some WebVR commands such as SubmitFrame must be synced with the WebGL render thread. + vr_compositor_handler: Arc>>> +} + +impl Renderer { + /// Initializes webrender and creates a Renderer and RenderApiSender. + /// + /// # Examples + /// Initializes a Renderer with some reasonable values. For more information see + /// [RendererOptions][rendereroptions]. + /// [rendereroptions]: struct.RendererOptions.html + /// + /// ```rust,ignore + /// # use webrender::renderer::Renderer; + /// # use std::path::PathBuf; + /// let opts = webrender::RendererOptions { + /// device_pixel_ratio: 1.0, + /// resource_override_path: None, + /// enable_aa: false, + /// enable_profiler: false, + /// }; + /// let (renderer, sender) = Renderer::new(opts); + /// ``` + pub fn new(options: RendererOptions) -> (Renderer, RenderApiSender) { + let (api_tx, api_rx) = channel::msg_channel().unwrap(); + let (payload_tx, payload_rx) = channel::payload_channel().unwrap(); + let (result_tx, result_rx) = channel(); + + let notifier = Arc::new(Mutex::new(None)); + + let file_watch_handler = FileWatcher { + result_tx: result_tx.clone(), + notifier: notifier.clone(), + }; + + let mut device = Device::new(options.resource_override_path.clone(), + Box::new(file_watch_handler)); + // device-pixel ratio doesn't matter here - we are just creating resources. + device.begin_frame(1.0); + + let cs_box_shadow = LazilyCompiledShader::new(ShaderKind::Cache, + "cs_box_shadow", + &[], + &mut device, + options.precache_shaders); + let cs_text_run = LazilyCompiledShader::new(ShaderKind::Cache, + "cs_text_run", + &[], + &mut device, + options.precache_shaders); + let cs_blur = LazilyCompiledShader::new(ShaderKind::Cache, + "cs_blur", + &[], + &mut device, + options.precache_shaders); + + let cs_clip_rectangle = LazilyCompiledShader::new(ShaderKind::ClipCache, + "cs_clip_rectangle", + &[], + &mut device, + options.precache_shaders); + let cs_clip_image = LazilyCompiledShader::new(ShaderKind::ClipCache, + "cs_clip_image", + &[], + &mut device, + options.precache_shaders); + + let ps_rectangle = PrimitiveShader::new("ps_rectangle", + &mut device, + &[], + options.precache_shaders); + let ps_rectangle_clip = PrimitiveShader::new("ps_rectangle", + &mut device, + &[ CLIP_FEATURE ], + options.precache_shaders); + let ps_text_run = PrimitiveShader::new("ps_text_run", + &mut device, + &[], + options.precache_shaders); + let ps_text_run_subpixel = PrimitiveShader::new("ps_text_run", + &mut device, + &[ SUBPIXEL_AA_FEATURE ], + options.precache_shaders); + let ps_image = PrimitiveShader::new("ps_image", + &mut device, + &[], + options.precache_shaders); + let ps_yuv_image = PrimitiveShader::new("ps_yuv_image", + &mut device, + &[], + options.precache_shaders); + let ps_border = PrimitiveShader::new("ps_border", + &mut device, + &[], + options.precache_shaders); + + let ps_box_shadow = PrimitiveShader::new("ps_box_shadow", + &mut device, + &[], + options.precache_shaders); + + let ps_gradient = PrimitiveShader::new("ps_gradient", + &mut device, + &[], + options.precache_shaders); + let ps_angle_gradient = PrimitiveShader::new("ps_angle_gradient", + &mut device, + &[], + options.precache_shaders); + let ps_radial_gradient = PrimitiveShader::new("ps_radial_gradient", + &mut device, + &[], + options.precache_shaders); + let ps_cache_image = PrimitiveShader::new("ps_cache_image", + &mut device, + &[], + options.precache_shaders); + + let ps_blend = LazilyCompiledShader::new(ShaderKind::Primitive, + "ps_blend", + &[], + &mut device, + options.precache_shaders); + let ps_composite = LazilyCompiledShader::new(ShaderKind::Primitive, + "ps_composite", + &[], + &mut device, + options.precache_shaders); + + let mut texture_cache = TextureCache::new(); + + let white_pixels: Vec = vec![ + 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, + ]; + let mask_pixels: Vec = vec![ + 0xff, 0xff, + 0xff, 0xff, + ]; + // TODO: Ensure that the white texture can never get evicted when the cache supports LRU eviction! + let white_image_id = texture_cache.new_item_id(); + texture_cache.insert(white_image_id, + ImageDescriptor { + width: 2, + height: 2, + stride: None, + format: ImageFormat::RGBA8, + is_opaque: false, + }, + TextureFilter::Linear, + Arc::new(white_pixels)); + + let dummy_mask_image_id = texture_cache.new_item_id(); + texture_cache.insert(dummy_mask_image_id, + ImageDescriptor { + width: 2, + height: 2, + stride: None, + format: ImageFormat::A8, + is_opaque: false, + }, + TextureFilter::Linear, + Arc::new(mask_pixels)); + + let debug_renderer = DebugRenderer::new(&mut device); + + let vertex_textures = [ + VertexTextures::new(&mut device), + VertexTextures::new(&mut device), + VertexTextures::new(&mut device), + VertexTextures::new(&mut device), + VertexTextures::new(&mut device), + ]; + + let x0 = 0.0; + let y0 = 0.0; + let x1 = 1.0; + let y1 = 1.0; + + // TODO(gw): Consider separate VBO for quads vs border corners if VS ever shows up in profile! + let quad_indices: [u16; 6] = [ 0, 1, 2, 2, 1, 3 ]; + let quad_vertices = [ + PackedVertex { + pos: [x0, y0], + }, + PackedVertex { + pos: [x1, y0], + }, + PackedVertex { + pos: [x0, y1], + }, + PackedVertex { + pos: [x1, y1], + }, + ]; + + let prim_vao_id = device.create_vao(VertexFormat::Triangles, mem::size_of::() as i32); + device.bind_vao(prim_vao_id); + device.update_vao_indices(prim_vao_id, &quad_indices, VertexUsageHint::Static); + device.update_vao_main_vertices(prim_vao_id, &quad_vertices, VertexUsageHint::Static); + + let blur_vao_id = device.create_vao_with_new_instances(VertexFormat::Blur, mem::size_of::() as i32, prim_vao_id); + let clip_vao_id = device.create_vao_with_new_instances(VertexFormat::Clip, mem::size_of::() as i32, prim_vao_id); + + device.end_frame(); + + let main_thread_dispatcher = Arc::new(Mutex::new(None)); + let backend_notifier = notifier.clone(); + let backend_main_thread_dispatcher = main_thread_dispatcher.clone(); + + let vr_compositor = Arc::new(Mutex::new(None)); + let backend_vr_compositor = vr_compositor.clone(); + + // We need a reference to the webrender context from the render backend in order to share + // texture ids + let context_handle = match options.renderer_kind { + RendererKind::Native => GLContextHandleWrapper::current_native_handle(), + RendererKind::OSMesa => GLContextHandleWrapper::current_osmesa_handle(), + }; + + let config = FrameBuilderConfig::new(options.enable_scrollbars, + options.enable_subpixel_aa); + + let debug = options.debug; + let (device_pixel_ratio, enable_aa) = (options.device_pixel_ratio, options.enable_aa); + let render_target_debug = options.render_target_debug; + let payload_tx_for_backend = payload_tx.clone(); + let enable_recording = options.enable_recording; + thread::Builder::new().name("RenderBackend".to_string()).spawn(move || { + let mut backend = RenderBackend::new(api_rx, + payload_rx, + payload_tx_for_backend, + result_tx, + device_pixel_ratio, + texture_cache, + enable_aa, + backend_notifier, + context_handle, + config, + debug, + enable_recording, + backend_main_thread_dispatcher, + backend_vr_compositor); + backend.run(); + }).unwrap(); + + let renderer = Renderer { + result_rx: result_rx, + device: device, + current_frame: None, + pending_texture_updates: Vec::new(), + pending_shader_updates: Vec::new(), + cs_box_shadow: cs_box_shadow, + cs_text_run: cs_text_run, + cs_blur: cs_blur, + cs_clip_rectangle: cs_clip_rectangle, + cs_clip_image: cs_clip_image, + ps_rectangle: ps_rectangle, + ps_rectangle_clip: ps_rectangle_clip, + ps_text_run: ps_text_run, + ps_text_run_subpixel: ps_text_run_subpixel, + ps_image: ps_image, + ps_yuv_image: ps_yuv_image, + ps_border: ps_border, + ps_box_shadow: ps_box_shadow, + ps_gradient: ps_gradient, + ps_angle_gradient: ps_angle_gradient, + ps_radial_gradient: ps_radial_gradient, + ps_cache_image: ps_cache_image, + ps_blend: ps_blend, + ps_composite: ps_composite, + notifier: notifier, + debug: debug_renderer, + render_target_debug: render_target_debug, + backend_profile_counters: BackendProfileCounters::new(), + profile_counters: RendererProfileCounters::new(), + profiler: Profiler::new(), + enable_profiler: options.enable_profiler, + clear_framebuffer: options.clear_framebuffer, + clear_color: options.clear_color, + last_time: 0, + render_targets: Vec::new(), + gpu_profile: GpuProfiler::new(), + prim_vao_id: prim_vao_id, + blur_vao_id: blur_vao_id, + clip_vao_id: clip_vao_id, + vt_index: 0, + vertex_textures: vertex_textures, + pipeline_epoch_map: HashMap::with_hasher(Default::default()), + main_thread_dispatcher: main_thread_dispatcher, + cache_texture_id_map: Vec::new(), + external_image_handler: None, + external_images: HashMap::with_hasher(Default::default()), + vr_compositor_handler: vr_compositor + }; + + let sender = RenderApiSender::new(api_tx, payload_tx); + (renderer, sender) + } + + /// Sets the new RenderNotifier. + /// + /// The RenderNotifier will be called when processing e.g. of a (scrolling) frame is done, + /// and therefore the screen should be updated. + pub fn set_render_notifier(&self, notifier: Box) { + let mut notifier_arc = self.notifier.lock().unwrap(); + *notifier_arc = Some(notifier); + } + + /// Sets the new MainThreadDispatcher. + /// + /// Allows to dispatch functions to the main thread's event loop. + pub fn set_main_thread_dispatcher(&self, dispatcher: Box) { + let mut dispatcher_arc = self.main_thread_dispatcher.lock().unwrap(); + *dispatcher_arc = Some(dispatcher); + } + + /// Sets the VRCompositorHandler. + /// + /// It's used to handle WebVR render commands. + /// Some WebVR commands such as Vsync and SubmitFrame must be called in the WebGL render thread. + pub fn set_vr_compositor_handler(&self, creator: Box) { + let mut handler_arc = self.vr_compositor_handler.lock().unwrap(); + *handler_arc = Some(creator); + } + + /// Returns the Epoch of the current frame in a pipeline. + pub fn current_epoch(&self, pipeline_id: PipelineId) -> Option { + self.pipeline_epoch_map.get(&pipeline_id).cloned() + } + + /// Returns a HashMap containing the pipeline ids that have been received by the renderer and + /// their respective epochs since the last time the method was called. + pub fn flush_rendered_epochs(&mut self) -> HashMap> { + return mem::replace(&mut self.pipeline_epoch_map, HashMap::with_hasher(Default::default())); + } + + /// Processes the result queue. + /// + /// Should be called before `render()`, as texture cache updates are done here. + pub fn update(&mut self) { + // Pull any pending results and return the most recent. + while let Ok(msg) = self.result_rx.try_recv() { + match msg { + ResultMsg::NewFrame(frame, texture_update_list, external_image_update_list, profile_counters) => { + self.pending_texture_updates.push(texture_update_list); + + // When a new frame is ready, we could start to update all pending external image requests here. + self.release_external_images(external_image_update_list); + + self.backend_profile_counters = profile_counters; + + // Update the list of available epochs for use during reftests. + // This is a workaround for https://github.com/servo/servo/issues/13149. + for (pipeline_id, epoch) in &frame.pipeline_epoch_map { + self.pipeline_epoch_map.insert(*pipeline_id, *epoch); + } + + self.current_frame = Some(frame); + } + ResultMsg::RefreshShader(path) => { + self.pending_shader_updates.push(path); + } + } + } + } + + // Get the real (OpenGL) texture ID for a given source texture. + // For a texture cache texture, the IDs are stored in a vector + // map for fast access. For WebGL textures, the native texture ID + // is stored inline. When we add support for external textures, + // we will add a callback here that is able to ask the caller + // for the image data. + fn resolve_source_texture(&mut self, texture_id: &SourceTexture) -> TextureId { + match *texture_id { + SourceTexture::Invalid => TextureId::invalid(), + SourceTexture::WebGL(id) => TextureId::new(id), + SourceTexture::External(ref key) => { + *self.external_images + .get(key) + .expect("BUG: External image should be resolved by now!") + } + SourceTexture::TextureCache(index) => { + self.cache_texture_id_map[index.0] + } + } + } + + /// Set a callback for handling external images. + pub fn set_external_image_handler(&mut self, handler: Box) { + self.external_image_handler = Some(handler); + } + + /// Renders the current frame. + /// + /// A Frame is supplied by calling [set_root_stacking_context()][newframe]. + /// [newframe]: ../../webrender_traits/struct.RenderApi.html#method.set_root_stacking_context + pub fn render(&mut self, framebuffer_size: DeviceUintSize) { + if let Some(mut frame) = self.current_frame.take() { + if let Some(ref mut frame) = frame.frame { + let mut profile_timers = RendererProfileTimers::new(); + + // Block CPU waiting for last frame's GPU profiles to arrive. + // In general this shouldn't block unless heavily GPU limited. + if let Some(samples) = self.gpu_profile.build_samples() { + profile_timers.gpu_samples = samples; + } + + profile_timers.cpu_time.profile(|| { + self.device.begin_frame(frame.device_pixel_ratio); + self.gpu_profile.begin_frame(); + { + let _gm = self.gpu_profile.add_marker(GPU_TAG_INIT); + + self.device.disable_scissor(); + self.device.disable_depth(); + self.device.set_blend(false); + + //self.update_shaders(); + self.update_texture_cache(); + } + + self.draw_tile_frame(frame, &framebuffer_size); + + self.gpu_profile.end_frame(); + }); + + let current_time = precise_time_ns(); + let ns = current_time - self.last_time; + self.profile_counters.frame_time.set(ns); + + if self.enable_profiler { + self.profiler.draw_profile(&frame.profile_counters, + &self.backend_profile_counters, + &self.profile_counters, + &mut profile_timers, + &mut self.debug); + } + + self.profile_counters.reset(); + self.profile_counters.frame_counter.inc(); + + let debug_size = DeviceUintSize::new(framebuffer_size.width as u32, + framebuffer_size.height as u32); + self.debug.render(&mut self.device, &debug_size); + self.device.end_frame(); + self.last_time = current_time; + } + + // Restore frame - avoid borrow checker! + self.current_frame = Some(frame); + } + } + + pub fn layers_are_bouncing_back(&self) -> bool { + match self.current_frame { + None => false, + Some(ref current_frame) => !current_frame.layers_bouncing_back.is_empty(), + } + } + +/* + fn update_shaders(&mut self) { + let update_uniforms = !self.pending_shader_updates.is_empty(); + + for path in self.pending_shader_updates.drain(..) { + panic!("todo"); + //self.device.refresh_shader(path); + } + + if update_uniforms { + self.update_uniform_locations(); + } + } +*/ + + fn update_texture_cache(&mut self) { + let _gm = GpuMarker::new("texture cache update"); + let mut pending_texture_updates = mem::replace(&mut self.pending_texture_updates, vec![]); + for update_list in pending_texture_updates.drain(..) { + for update in update_list.updates { + match update.op { + TextureUpdateOp::Create(width, height, format, filter, mode, maybe_bytes) => { + let CacheTextureId(cache_texture_index) = update.id; + if self.cache_texture_id_map.len() == cache_texture_index { + // Create a new native texture, as requested by the texture cache. + let texture_id = self.device + .create_texture_ids(1, TextureTarget::Default)[0]; + self.cache_texture_id_map.push(texture_id); + } + let texture_id = self.cache_texture_id_map[cache_texture_index]; + + let maybe_slice = maybe_bytes.as_ref().map(|bytes|{ bytes.as_slice() }); + self.device.init_texture(texture_id, + width, + height, + format, + filter, + mode, + maybe_slice); + } + TextureUpdateOp::Grow(new_width, + new_height, + format, + filter, + mode) => { + let texture_id = self.cache_texture_id_map[update.id.0]; + self.device.resize_texture(texture_id, + new_width, + new_height, + format, + filter, + mode); + } + TextureUpdateOp::Update(x, y, width, height, bytes, stride) => { + let texture_id = self.cache_texture_id_map[update.id.0]; + self.device.update_texture(texture_id, + x, + y, + width, height, stride, + bytes.as_slice()); + } + TextureUpdateOp::Free => { + let texture_id = self.cache_texture_id_map[update.id.0]; + self.device.deinit_texture(texture_id); + } + } + } + } + } + + fn add_debug_rect(&mut self, + p0: DeviceIntPoint, + p1: DeviceIntPoint, + label: &str, + c: &ColorF) { + let tile_x0 = p0.x; + let tile_y0 = p0.y; + let tile_x1 = p1.x; + let tile_y1 = p1.y; + + self.debug.add_line(tile_x0, + tile_y0, + c, + tile_x1, + tile_y0, + c); + self.debug.add_line(tile_x0, + tile_y1, + c, + tile_x1, + tile_y1, + c); + self.debug.add_line(tile_x0, + tile_y0, + c, + tile_x0, + tile_y1, + c); + self.debug.add_line(tile_x1, + tile_y0, + c, + tile_x1, + tile_y1, + c); + if label.len() > 0 { + self.debug.add_text((tile_x0 as f32 + tile_x1 as f32) * 0.5, + (tile_y0 as f32 + tile_y1 as f32) * 0.5, + label, + c); + } + } + + fn draw_instanced_batch(&mut self, + data: &[T], + vao: VAOId, + shader: ProgramId, + textures: &BatchTextures, + projection: &Matrix4D) { + self.device.bind_vao(vao); + self.device.bind_program(shader, projection); + + for i in 0..textures.colors.len() { + let texture_id = self.resolve_source_texture(&textures.colors[i]); + self.device.bind_texture(TextureSampler::color(i), texture_id); + } + + self.device.update_vao_instances(vao, data, VertexUsageHint::Stream); + self.device.draw_indexed_triangles_instanced_u16(6, data.len() as i32); + self.profile_counters.vertices.add(6 * data.len()); + self.profile_counters.draw_calls.inc(); + } + + fn submit_batch(&mut self, + batch: &PrimitiveBatch, + projection: &Matrix4D) { + let transform_kind = batch.key.flags.transform_kind(); + let needs_clipping = batch.key.flags.needs_clipping(); + debug_assert!(!needs_clipping || batch.key.blend_mode == BlendMode::Alpha); + + let (data, marker, shader) = match &batch.data { + &PrimitiveBatchData::CacheImage(ref data) => { + let shader = self.ps_cache_image.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_CACHE_IMAGE, shader) + } + &PrimitiveBatchData::Blend(ref data) => { + let shader = self.ps_blend.get(&mut self.device); + (data, GPU_TAG_PRIM_BLEND, shader) + } + &PrimitiveBatchData::Composite(ref data) => { + // The composite shader only samples from sCache. + let shader = self.ps_composite.get(&mut self.device); + (data, GPU_TAG_PRIM_COMPOSITE, shader) + } + &PrimitiveBatchData::Rectangles(ref data) => { + let shader = if needs_clipping { + self.ps_rectangle_clip.get(&mut self.device, transform_kind) + } else { + self.ps_rectangle.get(&mut self.device, transform_kind) + }; + (data, GPU_TAG_PRIM_RECT, shader) + } + &PrimitiveBatchData::Image(ref data) => { + let shader = self.ps_image.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_IMAGE, shader) + } + &PrimitiveBatchData::YuvImage(ref data) => { + let shader = self.ps_yuv_image.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_YUV_IMAGE, shader) + } + &PrimitiveBatchData::Borders(ref data) => { + let shader = self.ps_border.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_BORDER, shader) + } + &PrimitiveBatchData::BoxShadow(ref data) => { + let shader = self.ps_box_shadow.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_BOX_SHADOW, shader) + } + &PrimitiveBatchData::TextRun(ref data) => { + let shader = match batch.key.blend_mode { + BlendMode::Subpixel(..) => self.ps_text_run_subpixel.get(&mut self.device, transform_kind), + BlendMode::Alpha | BlendMode::None => self.ps_text_run.get(&mut self.device, transform_kind), + }; + (data, GPU_TAG_PRIM_TEXT_RUN, shader) + } + &PrimitiveBatchData::AlignedGradient(ref data) => { + let shader = self.ps_gradient.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_GRADIENT, shader) + } + &PrimitiveBatchData::AngleGradient(ref data) => { + let shader = self.ps_angle_gradient.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_ANGLE_GRADIENT, shader) + } + &PrimitiveBatchData::RadialGradient(ref data) => { + let shader = self.ps_radial_gradient.get(&mut self.device, transform_kind); + (data, GPU_TAG_PRIM_RADIAL_GRADIENT, shader) + } + }; + + let _gm = self.gpu_profile.add_marker(marker); + let vao = self.prim_vao_id; + self.draw_instanced_batch(data, + vao, + shader, + &batch.key.textures, + projection); + } + + fn draw_target(&mut self, + render_target: Option<(TextureId, i32)>, + target: &RenderTarget, + target_size: &DeviceUintSize, + cache_texture: Option, + should_clear: bool, + background_color: Option) { + self.device.disable_depth(); + self.device.enable_depth_write(); + + let dimensions = [target_size.width, target_size.height]; + let projection = { + let _gm = self.gpu_profile.add_marker(GPU_TAG_SETUP_TARGET); + self.device.bind_draw_target(render_target, Some(dimensions)); + + self.device.set_blend(false); + self.device.set_blend_mode_alpha(); + if let Some(cache_texture) = cache_texture { + self.device.bind_texture(TextureSampler::Cache, cache_texture); + } + + let (color, projection) = match render_target { + Some(..) => ( + // The clear color here is chosen specifically such that: + // - The red channel is cleared to 1, so that the clip mask + // generation (which reads/writes the red channel) can + // assume that each allocated rect is opaque / non-clipped + // initially. + // - The alpha channel is cleared to 0, so that visual render + // tasks can assume that pixels are transparent if not + // rendered. (This is relied on by the compositing support + // for mix-blend-mode etc). + [1.0, 1.0, 1.0, 0.0], + Matrix4D::ortho(0.0, + target_size.width as f32, + 0.0, + target_size.height as f32, + ORTHO_NEAR_PLANE, + ORTHO_FAR_PLANE) + ), + None => ( + background_color.map_or(self.clear_color.to_array(), |color| { + color.to_array() + }), + Matrix4D::ortho(0.0, + target_size.width as f32, + target_size.height as f32, + 0.0, + ORTHO_NEAR_PLANE, + ORTHO_FAR_PLANE) + ), + }; + + let clear_depth = Some(1.0); + let clear_color = if should_clear { + Some(color) + } else { + None + }; + + self.device.clear_target(clear_color, clear_depth); + + projection + }; + + self.device.disable_depth_write(); + + // Draw any blurs for this target. + // Blurs are rendered as a standard 2-pass + // separable implementation. + // TODO(gw): In the future, consider having + // fast path blur shaders for common + // blur radii with fixed weights. + if !target.vertical_blurs.is_empty() || !target.horizontal_blurs.is_empty() { + let _gm = self.gpu_profile.add_marker(GPU_TAG_BLUR); + let vao = self.blur_vao_id; + + self.device.set_blend(false); + let shader = self.cs_blur.get(&mut self.device); + + self.draw_instanced_batch(&target.vertical_blurs, + vao, + shader, + &BatchTextures::no_texture(), + &projection); + self.draw_instanced_batch(&target.horizontal_blurs, + vao, + shader, + &BatchTextures::no_texture(), + &projection); + } + + // Draw any box-shadow caches for this target. + if !target.box_shadow_cache_prims.is_empty() { + self.device.set_blend(false); + let _gm = self.gpu_profile.add_marker(GPU_TAG_CACHE_BOX_SHADOW); + let vao = self.prim_vao_id; + let shader = self.cs_box_shadow.get(&mut self.device); + self.draw_instanced_batch(&target.box_shadow_cache_prims, + vao, + shader, + &BatchTextures::no_texture(), + &projection); + } + + // Draw the clip items into the tiled alpha mask. + { + let _gm = self.gpu_profile.add_marker(GPU_TAG_CACHE_CLIP); + let vao = self.clip_vao_id; + // switch to multiplicative blending + self.device.set_blend(true); + self.device.set_blend_mode_multiply(); + // draw rounded cornered rectangles + if !target.clip_batcher.rectangles.is_empty() { + let _gm2 = GpuMarker::new("clip rectangles"); + let shader = self.cs_clip_rectangle.get(&mut self.device); + self.draw_instanced_batch(&target.clip_batcher.rectangles, + vao, + shader, + &BatchTextures::no_texture(), + &projection); + } + // draw image masks + for (mask_texture_id, items) in target.clip_batcher.images.iter() { + let _gm2 = GpuMarker::new("clip images"); + let texture_id = self.resolve_source_texture(mask_texture_id); + self.device.bind_texture(TextureSampler::Mask, texture_id); + let shader = self.cs_clip_image.get(&mut self.device); + self.draw_instanced_batch(items, + vao, + shader, + &BatchTextures::no_texture(), + &projection); + } + } + + // Draw any textrun caches for this target. For now, this + // is only used to cache text runs that are to be blurred + // for text-shadow support. In the future it may be worth + // considering using this for (some) other text runs, since + // it removes the overhead of submitting many small glyphs + // to multiple tiles in the normal text run case. + if !target.text_run_cache_prims.is_empty() { + self.device.set_blend(true); + self.device.set_blend_mode_alpha(); + + let _gm = self.gpu_profile.add_marker(GPU_TAG_CACHE_TEXT_RUN); + let vao = self.prim_vao_id; + let shader = self.cs_text_run.get(&mut self.device); + + self.draw_instanced_batch(&target.text_run_cache_prims, + vao, + shader, + &target.text_run_textures, + &projection); + } + + let _gm2 = GpuMarker::new("alpha batches"); + self.device.set_blend(false); + let mut prev_blend_mode = BlendMode::None; + + self.device.set_depth_func(DepthFunction::Less); + self.device.enable_depth(); + self.device.enable_depth_write(); + + for batch in &target.alpha_batcher.opaque_batches { + self.submit_batch(batch, &projection); + } + + self.device.disable_depth_write(); + + for batch in &target.alpha_batcher.alpha_batches { + if batch.key.blend_mode != prev_blend_mode { + match batch.key.blend_mode { + BlendMode::None => { + self.device.set_blend(false); + } + BlendMode::Alpha => { + self.device.set_blend(true); + self.device.set_blend_mode_alpha(); + } + BlendMode::Subpixel(color) => { + self.device.set_blend(true); + self.device.set_blend_mode_subpixel(color); + } + } + prev_blend_mode = batch.key.blend_mode; + } + + self.submit_batch(batch, &projection); + } + + self.device.disable_depth(); + self.device.set_blend(false); + } + + fn update_deferred_resolves(&mut self, frame: &mut Frame) { + // The first thing we do is run through any pending deferred + // resolves, and use a callback to get the UV rect for this + // custom item. Then we patch the resource_rects structure + // here before it's uploaded to the GPU. + if !frame.deferred_resolves.is_empty() { + let handler = self.external_image_handler + .as_mut() + .expect("Found external image, but no handler set!"); + + for deferred_resolve in &frame.deferred_resolves { + GpuMarker::fire("deferred resolve"); + let props = &deferred_resolve.image_properties; + let external_id = props.external_id + .expect("BUG: Deferred resolves must be external images!"); + let image = handler.lock(external_id); + + let texture_id = match image.source { + ExternalImageSource::NativeTexture(texture_id) => TextureId::new(texture_id), + }; + + self.external_images.insert(external_id, texture_id); + let resource_rect_index = deferred_resolve.resource_address.0 as usize; + let resource_rect = &mut frame.gpu_resource_rects[resource_rect_index]; + resource_rect.uv0 = DevicePoint::new(image.u0, image.v0); + resource_rect.uv1 = DevicePoint::new(image.u1, image.v1); + } + } + } + + fn unlock_external_images(&mut self) { + if !self.external_images.is_empty() { + let handler = self.external_image_handler + .as_mut() + .expect("Found external image, but no handler set!"); + + for (external_id, _) in self.external_images.drain() { + handler.unlock(external_id); + } + } + } + + fn release_external_images(&mut self, mut pending_external_image_updates: ExternalImageUpdateList) { + if !pending_external_image_updates.is_empty() { + let handler = self.external_image_handler + .as_mut() + .expect("found external image updates, but no handler set!"); + + for external_id in pending_external_image_updates.drain(..) { + handler.release(external_id); + } + } + } + + fn draw_tile_frame(&mut self, + frame: &mut Frame, + framebuffer_size: &DeviceUintSize) { + let _gm = GpuMarker::new("tile frame draw"); + self.update_deferred_resolves(frame); + + // Some tests use a restricted viewport smaller than the main screen size. + // Ensure we clear the framebuffer in these tests. + // TODO(gw): Find a better solution for this? + let viewport_size = DeviceIntSize::new((frame.viewport_size.width * frame.device_pixel_ratio) as i32, + (frame.viewport_size.height * frame.device_pixel_ratio) as i32); + let needs_clear = viewport_size.width < framebuffer_size.width as i32 || + viewport_size.height < framebuffer_size.height as i32; + + { + let _gm2 = GpuMarker::new("debug rectangles"); + for debug_rect in frame.debug_rects.iter().rev() { + self.add_debug_rect(debug_rect.rect.origin, + debug_rect.rect.bottom_right(), + &debug_rect.label, + &debug_rect.color); + } + } + + self.device.disable_depth_write(); + self.device.disable_stencil(); + self.device.set_blend(false); + + if frame.passes.is_empty() { + self.device.clear_target(Some(self.clear_color.to_array()), Some(1.0)); + } else { + // Add new render targets to the pool if required. + let needed_targets = frame.passes.len() - 1; // framebuffer doesn't need a target! + let current_target_count = self.render_targets.len(); + if needed_targets > current_target_count { + let new_target_count = needed_targets - current_target_count; + let new_targets = self.device.create_texture_ids(new_target_count as i32, + TextureTarget::Array); + self.render_targets.extend_from_slice(&new_targets); + } + + // Init textures and render targets to match this scene. + for (pass, texture_id) in frame.passes.iter().zip(self.render_targets.iter()) { + self.device.init_texture(*texture_id, + frame.cache_size.width as u32, + frame.cache_size.height as u32, + ImageFormat::RGBA8, + TextureFilter::Linear, + RenderTargetMode::LayerRenderTarget(pass.targets.len() as i32), + None); + } + + // TODO(gw): This is a hack / workaround for #728. + // We should find a better way to implement these updates rather + // than wasting this extra memory, but for now it removes a large + // number of driver stalls. + self.vertex_textures[self.vt_index].init_frame(&mut self.device, frame); + self.vt_index = (self.vt_index + 1) % VERTEX_TEXTURE_POOL; + + let mut src_id = None; + + for (pass_index, pass) in frame.passes.iter().enumerate() { + let (do_clear, size, target_id) = if pass.is_framebuffer { + (self.clear_framebuffer || needs_clear, + framebuffer_size, + None) + } else { + (true, &frame.cache_size, Some(self.render_targets[pass_index])) + }; + + for (target_index, target) in pass.targets.iter().enumerate() { + let render_target = target_id.map(|texture_id| { + (texture_id, target_index as i32) + }); + self.draw_target(render_target, + target, + size, + src_id, + do_clear, + frame.background_color); + + } + + src_id = target_id; + } + + self.draw_render_target_debug(framebuffer_size); + } + + self.unlock_external_images(); + } + + pub fn debug_renderer<'a>(&'a mut self) -> &'a mut DebugRenderer { + &mut self.debug + } + + pub fn get_profiler_enabled(&mut self) -> bool { + self.enable_profiler + } + + pub fn set_profiler_enabled(&mut self, enabled: bool) { + self.enable_profiler = enabled; + } + + fn draw_render_target_debug(&mut self, + framebuffer_size: &DeviceUintSize) { + if self.render_target_debug { + // TODO(gw): Make the layout of the render targets a bit more sophisticated. + // Right now, it just draws them in one row at the bottom of the screen, + // with a fixed size. + let rt_debug_x0 = 16; + let rt_debug_y0 = 16; + let rt_debug_spacing = 16; + let rt_debug_size = 512; + let mut current_target = 0; + + for texture_id in &self.render_targets { + let layer_count = self.device.get_render_target_layer_count(*texture_id); + for layer_index in 0..layer_count { + let x0 = rt_debug_x0 + (rt_debug_spacing + rt_debug_size) * current_target; + let y0 = rt_debug_y0; + + // If we have more targets than fit on one row in screen, just early exit. + if x0 > framebuffer_size.width as i32 { + return; + } + + let dest_rect = DeviceIntRect::new(DeviceIntPoint::new(x0, y0), + DeviceIntSize::new(rt_debug_size, rt_debug_size)); + self.device.blit_render_target(Some((*texture_id, layer_index as i32)), + None, + dest_rect); + + current_target += 1; + } + } + } + } +} + +pub enum ExternalImageSource { + // TODO(gw): Work out the API for raw buffers. + //RawData(*const u8, usize), + NativeTexture(u32), // Is a gl::GLuint texture handle +} + +/// The data that an external client should provide about +/// an external image. The timestamp is used to test if +/// the renderer should upload new texture data this +/// frame. For instance, if providing video frames, the +/// application could call wr.render() whenever a new +/// video frame is ready. If the callback increments +/// the returned timestamp for a given image, the renderer +/// will know to re-upload the image data to the GPU. +/// Note that the UV coords are supplied in texel-space! +pub struct ExternalImage { + pub u0: f32, + pub v0: f32, + pub u1: f32, + pub v1: f32, + pub source: ExternalImageSource, +} + +/// The interfaces that an application can implement to support providing +/// external image buffers. +/// When the the application passes an external image to WR, it should kepp that +/// external image life time untile the release() call. +pub trait ExternalImageHandler { + /// Lock the external image. Then, WR could start to read the image content. + /// The WR client should not change the image content until the unlock() + /// call. + fn lock(&mut self, key: ExternalImageId) -> ExternalImage; + /// Unlock the external image. The WR should not read the image content + /// after this call. + fn unlock(&mut self, key: ExternalImageId); + /// Tell the WR client that it could start to release this external image. + fn release(&mut self, key: ExternalImageId); +} + +#[derive(Clone, Debug)] +pub struct RendererOptions { + pub device_pixel_ratio: f32, + pub resource_override_path: Option, + pub enable_aa: bool, + pub enable_profiler: bool, + pub debug: bool, + pub enable_recording: bool, + pub enable_scrollbars: bool, + pub precache_shaders: bool, + pub renderer_kind: RendererKind, + pub enable_subpixel_aa: bool, + pub clear_framebuffer: bool, + pub clear_color: ColorF, + pub render_target_debug: bool, +} + +impl Default for RendererOptions { + fn default() -> RendererOptions { + RendererOptions { + device_pixel_ratio: 1.0, + resource_override_path: None, + enable_aa: true, + enable_profiler: false, + debug: false, + enable_recording: false, + enable_scrollbars: false, + precache_shaders: false, + renderer_kind: RendererKind::Native, + enable_subpixel_aa: false, + clear_framebuffer: true, + clear_color: ColorF::new(1.0, 1.0, 1.0, 1.0), + render_target_debug: false, + } + } +} diff --git a/gfx/webrender/src/resource_cache.rs b/gfx/webrender/src/resource_cache.rs new file mode 100644 index 000000000000..8f6e21c799f0 --- /dev/null +++ b/gfx/webrender/src/resource_cache.rs @@ -0,0 +1,735 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use device::TextureFilter; +use fnv::FnvHasher; +use frame::FrameId; +use internal_types::{ExternalImageUpdateList, FontTemplate, SourceTexture, TextureUpdateList}; +use platform::font::{FontContext, RasterizedGlyph}; +use std::cell::RefCell; +use std::collections::{HashMap, HashSet}; +use std::collections::hash_map::Entry::{self, Occupied, Vacant}; +use std::fmt::Debug; +use std::hash::BuildHasherDefault; +use std::hash::Hash; +use std::mem; +use std::sync::{Arc, Barrier}; +use std::sync::mpsc::{channel, Receiver, Sender}; +use std::thread; +use texture_cache::{TextureCache, TextureCacheItemId}; +use webrender_traits::{Epoch, FontKey, GlyphKey, ImageKey, ImageFormat, ImageRendering}; +use webrender_traits::{FontRenderMode, ImageData, GlyphDimensions, WebGLContextId}; +use webrender_traits::{DevicePoint, DeviceIntSize, ImageDescriptor, ColorF}; +use webrender_traits::ExternalImageId; +use threadpool::ThreadPool; + +thread_local!(pub static FONT_CONTEXT: RefCell = RefCell::new(FontContext::new())); + +type GlyphCache = ResourceClassCache>; + +/// Message sent from the resource cache to the glyph cache thread. +enum GlyphCacheMsg { + /// Begin the frame - pass ownership of the glyph cache to the thread. + BeginFrame(FrameId, GlyphCache), + /// Add a new font. + AddFont(FontKey, FontTemplate), + /// Request glyphs for a text run. + RequestGlyphs(FontKey, Au, ColorF, Vec, FontRenderMode), + /// Finished requesting glyphs. Reply with new glyphs. + EndFrame, +} + +/// Results send from glyph cache thread back to main resource cache. +enum GlyphCacheResultMsg { + /// Return the glyph cache, and a list of newly rasterized glyphs. + EndFrame(GlyphCache, Vec), +} + +// These coordinates are always in texels. +// They are converted to normalized ST +// values in the vertex shader. The reason +// for this is that the texture may change +// dimensions (e.g. the pages in a texture +// atlas can grow). When this happens, by +// storing the coordinates as texel values +// we don't need to go through and update +// various CPU-side structures. +pub struct CacheItem { + pub texture_id: SourceTexture, + pub uv0: DevicePoint, + pub uv1: DevicePoint, +} + +#[derive(Clone, Hash, PartialEq, Eq, Debug, Ord, PartialOrd)] +pub struct RenderedGlyphKey { + pub key: GlyphKey, + pub render_mode: FontRenderMode, +} + +impl RenderedGlyphKey { + pub fn new(font_key: FontKey, + size: Au, + color: ColorF, + index: u32, + render_mode: FontRenderMode) -> RenderedGlyphKey { + RenderedGlyphKey { + key: GlyphKey::new(font_key, size, color, index), + render_mode: render_mode, + } + } +} + +pub struct ImageProperties { + pub descriptor: ImageDescriptor, + pub external_id: Option, +} + +#[derive(Debug, Copy, Clone, PartialEq)] +enum State { + Idle, + AddResources, + QueryResources, +} + +struct ImageResource { + data: ImageData, + descriptor: ImageDescriptor, + epoch: Epoch, +} + +struct CachedImageInfo { + texture_cache_id: TextureCacheItemId, + epoch: Epoch, +} + +pub struct ResourceClassCache { + resources: HashMap>, + last_access_times: HashMap>, +} + +impl ResourceClassCache where K: Clone + Hash + Eq + Debug, V: Resource { + fn new() -> ResourceClassCache { + ResourceClassCache { + resources: HashMap::with_hasher(Default::default()), + last_access_times: HashMap::with_hasher(Default::default()), + } + } + + fn contains_key(&self, key: &K) -> bool { + self.resources.contains_key(key) + } + + fn get(&self, key: &K, frame: FrameId) -> &V { + // This assert catches cases in which we accidentally request a resource that we forgot to + // mark as needed this frame. + debug_assert!(frame == *self.last_access_times + .get(key) + .expect("Didn't find the access time for a cached resource \ + with that ID!")); + self.resources.get(key).expect("Didn't find a cached resource with that ID!") + } + + fn insert(&mut self, key: K, value: V, frame: FrameId) { + self.last_access_times.insert(key.clone(), frame); + self.resources.insert(key, value); + } + + fn entry(&mut self, key: K, frame: FrameId) -> Entry { + self.last_access_times.insert(key.clone(), frame); + self.resources.entry(key) + } + + fn mark_as_needed(&mut self, key: &K, frame: FrameId) { + self.last_access_times.insert((*key).clone(), frame); + } + + fn expire_old_resources(&mut self, texture_cache: &mut TextureCache, frame_id: FrameId) { + let mut resources_to_destroy = vec![]; + for (key, this_frame_id) in &self.last_access_times { + if *this_frame_id < frame_id { + resources_to_destroy.push((*key).clone()) + } + } + for key in resources_to_destroy { + let resource = + self.resources + .remove(&key) + .expect("Resource was in `last_access_times` but not in `resources`!"); + self.last_access_times.remove(&key); + if let Some(texture_cache_item_id) = resource.texture_cache_item_id() { + texture_cache.free(texture_cache_item_id) + } + } + } +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +struct ImageRequest { + key: ImageKey, + rendering: ImageRendering, +} + +struct GlyphRasterJob { + key: RenderedGlyphKey, + result: Option, +} + +struct WebGLTexture { + id: SourceTexture, + size: DeviceIntSize, +} + +pub struct ResourceCache { + cached_glyphs: Option, + cached_images: ResourceClassCache, + + // TODO(pcwalton): Figure out the lifecycle of these. + webgl_textures: HashMap>, + + font_templates: HashMap>, + image_templates: HashMap>, + enable_aa: bool, + state: State, + current_frame_id: FrameId, + + texture_cache: TextureCache, + + // TODO(gw): We should expire (parts of) this cache semi-regularly! + cached_glyph_dimensions: HashMap, BuildHasherDefault>, + pending_image_requests: Vec, + glyph_cache_tx: Sender, + glyph_cache_result_queue: Receiver, + pending_external_image_update_list: ExternalImageUpdateList, +} + +impl ResourceCache { + pub fn new(texture_cache: TextureCache, + enable_aa: bool) -> ResourceCache { + let (glyph_cache_tx, glyph_cache_result_queue) = spawn_glyph_cache_thread(); + + ResourceCache { + cached_glyphs: Some(ResourceClassCache::new()), + cached_images: ResourceClassCache::new(), + webgl_textures: HashMap::with_hasher(Default::default()), + font_templates: HashMap::with_hasher(Default::default()), + image_templates: HashMap::with_hasher(Default::default()), + cached_glyph_dimensions: HashMap::with_hasher(Default::default()), + texture_cache: texture_cache, + state: State::Idle, + enable_aa: enable_aa, + current_frame_id: FrameId(0), + pending_image_requests: Vec::new(), + glyph_cache_tx: glyph_cache_tx, + glyph_cache_result_queue: glyph_cache_result_queue, + pending_external_image_update_list: ExternalImageUpdateList::new(), + } + } + + pub fn add_font_template(&mut self, font_key: FontKey, template: FontTemplate) { + // Push the new font to the glyph cache thread, and also store + // it locally for glyph metric requests. + self.glyph_cache_tx + .send(GlyphCacheMsg::AddFont(font_key, template.clone())) + .unwrap(); + self.font_templates.insert(font_key, template); + } + + pub fn add_image_template(&mut self, + image_key: ImageKey, + descriptor: ImageDescriptor, + data: ImageData) { + let resource = ImageResource { + descriptor: descriptor, + data: data, + epoch: Epoch(0), + }; + + self.image_templates.insert(image_key, resource); + } + + pub fn update_image_template(&mut self, + image_key: ImageKey, + descriptor: ImageDescriptor, + bytes: Vec) { + let next_epoch = match self.image_templates.get(&image_key) { + Some(image) => { + // This image should not be an external image. + match image.data { + ImageData::External(id) => { + panic!("Update an external image with buffer, id={} image_key={:?}", id.0, image_key); + }, + _ => {}, + } + + let Epoch(current_epoch) = image.epoch; + Epoch(current_epoch + 1) + } + None => { + Epoch(0) + } + }; + + let resource = ImageResource { + descriptor: descriptor, + data: ImageData::new(bytes), + epoch: next_epoch, + }; + + self.image_templates.insert(image_key, resource); + } + + pub fn delete_image_template(&mut self, image_key: ImageKey) { + let value = self.image_templates.remove(&image_key); + + // If the key is associated to an external image, pass the external id to renderer for cleanup. + if let Some(image) = value { + match image.data { + ImageData::External(id) => { + self.pending_external_image_update_list.push(id); + }, + _ => {}, + } + + return; + } + + println!("Delete the non-exist key:{:?}", image_key); + } + + pub fn add_webgl_texture(&mut self, id: WebGLContextId, texture_id: SourceTexture, size: DeviceIntSize) { + self.webgl_textures.insert(id, WebGLTexture { + id: texture_id, + size: size, + }); + } + + pub fn update_webgl_texture(&mut self, id: WebGLContextId, texture_id: SourceTexture, size: DeviceIntSize) { + let webgl_texture = self.webgl_textures.get_mut(&id).unwrap(); + + // Update new texture id and size + webgl_texture.id = texture_id; + webgl_texture.size = size; + } + + pub fn request_image(&mut self, + key: ImageKey, + rendering: ImageRendering) { + debug_assert!(self.state == State::AddResources); + self.pending_image_requests.push(ImageRequest { + key: key, + rendering: rendering, + }); + } + + pub fn request_glyphs(&mut self, + key: FontKey, + size: Au, + color: ColorF, + glyph_indices: &[u32], + render_mode: FontRenderMode) { + debug_assert!(self.state == State::AddResources); + let render_mode = self.get_glyph_render_mode(render_mode); + // Immediately request that the glyph cache thread start + // rasterizing glyphs from this request if they aren't + // already cached. + let msg = GlyphCacheMsg::RequestGlyphs(key, + size, + color, + glyph_indices.to_vec(), + render_mode); + self.glyph_cache_tx.send(msg).unwrap(); + } + + pub fn pending_updates(&mut self) -> TextureUpdateList { + self.texture_cache.pending_updates() + } + + pub fn pending_external_image_updates(&mut self) -> ExternalImageUpdateList { + mem::replace(&mut self.pending_external_image_update_list, ExternalImageUpdateList::new()) + } + + pub fn get_glyphs(&self, + font_key: FontKey, + size: Au, + color: ColorF, + glyph_indices: &[u32], + render_mode: FontRenderMode, + mut f: F) -> SourceTexture where F: FnMut(usize, DevicePoint, DevicePoint) { + debug_assert!(self.state == State::QueryResources); + let cache = self.cached_glyphs.as_ref().unwrap(); + let render_mode = self.get_glyph_render_mode(render_mode); + let mut glyph_key = RenderedGlyphKey::new(font_key, + size, + color, + 0, + render_mode); + let mut texture_id = None; + for (loop_index, glyph_index) in glyph_indices.iter().enumerate() { + glyph_key.key.index = *glyph_index; + let image_id = cache.get(&glyph_key, self.current_frame_id); + let cache_item = image_id.map(|image_id| self.texture_cache.get(image_id)); + if let Some(cache_item) = cache_item { + let uv0 = DevicePoint::new(cache_item.pixel_rect.top_left.x as f32, + cache_item.pixel_rect.top_left.y as f32); + let uv1 = DevicePoint::new(cache_item.pixel_rect.bottom_right.x as f32, + cache_item.pixel_rect.bottom_right.y as f32); + f(loop_index, uv0, uv1); + debug_assert!(texture_id == None || + texture_id == Some(cache_item.texture_id)); + texture_id = Some(cache_item.texture_id); + } + } + + texture_id.map_or(SourceTexture::Invalid, SourceTexture::TextureCache) + } + + pub fn get_glyph_dimensions(&mut self, glyph_key: &GlyphKey) -> Option { + match self.cached_glyph_dimensions.entry(glyph_key.clone()) { + Occupied(entry) => *entry.get(), + Vacant(entry) => { + let mut dimensions = None; + let font_template = &self.font_templates[&glyph_key.font_key]; + + FONT_CONTEXT.with(|font_context| { + let mut font_context = font_context.borrow_mut(); + match *font_template { + FontTemplate::Raw(ref bytes) => { + font_context.add_raw_font(&glyph_key.font_key, &**bytes); + } + FontTemplate::Native(ref native_font_handle) => { + font_context.add_native_font(&glyph_key.font_key, + (*native_font_handle).clone()); + } + } + + dimensions = font_context.get_glyph_dimensions(glyph_key.font_key, + glyph_key.size, + glyph_key.index); + }); + + *entry.insert(dimensions) + } + } + } + + #[inline] + pub fn get_cached_image(&self, + image_key: ImageKey, + image_rendering: ImageRendering) -> CacheItem { + debug_assert!(self.state == State::QueryResources); + let key = ImageRequest { + key: image_key, + rendering: image_rendering, + }; + let image_info = &self.cached_images.get(&key, self.current_frame_id); + let item = self.texture_cache.get(image_info.texture_cache_id); + CacheItem { + texture_id: SourceTexture::TextureCache(item.texture_id), + uv0: DevicePoint::new(item.pixel_rect.top_left.x as f32, + item.pixel_rect.top_left.y as f32), + uv1: DevicePoint::new(item.pixel_rect.bottom_right.x as f32, + item.pixel_rect.bottom_right.y as f32), + } + } + + pub fn get_image_properties(&self, image_key: ImageKey) -> ImageProperties { + let image_template = &self.image_templates[&image_key]; + + let external_id = match image_template.data { + ImageData::External(id) => Some(id), + ImageData::Raw(..) => None, + }; + + ImageProperties { + descriptor: image_template.descriptor, + external_id: external_id, + } + } + + #[inline] + pub fn get_webgl_texture(&self, context_id: &WebGLContextId) -> CacheItem { + let webgl_texture = &self.webgl_textures[context_id]; + CacheItem { + texture_id: webgl_texture.id, + uv0: DevicePoint::new(0.0, webgl_texture.size.height as f32), + uv1: DevicePoint::new(webgl_texture.size.width as f32, 0.0), + } + } + + pub fn expire_old_resources(&mut self, frame_id: FrameId) { + self.cached_images.expire_old_resources(&mut self.texture_cache, frame_id); + + let cached_glyphs = self.cached_glyphs.as_mut().unwrap(); + cached_glyphs.expire_old_resources(&mut self.texture_cache, frame_id); + } + + pub fn begin_frame(&mut self, frame_id: FrameId) { + debug_assert!(self.state == State::Idle); + self.state = State::AddResources; + self.current_frame_id = frame_id; + let glyph_cache = self.cached_glyphs.take().unwrap(); + self.glyph_cache_tx.send(GlyphCacheMsg::BeginFrame(frame_id, glyph_cache)).ok(); + } + + pub fn block_until_all_resources_added(&mut self) { + debug_assert!(self.state == State::AddResources); + self.state = State::QueryResources; + + // Tell the glyph cache thread that all glyphs have been requested + // and block, waiting for any pending glyphs to be rasterized. In the + // future, we will expand this to have a timeout. If the glyph rasterizing + // takes longer than the timeout, then we will select the best glyphs + // available in the cache, render with those, and then re-render at + // a later point when the correct resolution glyphs finally become + // available. + self.glyph_cache_tx.send(GlyphCacheMsg::EndFrame).unwrap(); + + // Loop until the end frame message is retrieved here. This loop + // doesn't serve any real purpose right now, but in the future + // it will be receiving small amounts of glyphs at a time, up until + // it decides that it should just render the frame. + while let Ok(result) = self.glyph_cache_result_queue.recv() { + match result { + GlyphCacheResultMsg::EndFrame(mut cache, glyph_jobs) => { + // Add any newly rasterized glyphs to the texture cache. + for job in glyph_jobs { + let image_id = job.result.and_then(|glyph| { + if glyph.width > 0 && glyph.height > 0 { + let image_id = self.texture_cache.new_item_id(); + self.texture_cache.insert(image_id, + ImageDescriptor { + width: glyph.width, + height: glyph.height, + stride: None, + format: ImageFormat::RGBA8, + is_opaque: false, + }, + TextureFilter::Linear, + Arc::new(glyph.bytes)); + Some(image_id) + } else { + None + } + }); + + cache.insert(job.key, image_id, self.current_frame_id); + } + + self.cached_glyphs = Some(cache); + break; + } + } + } + + for request in self.pending_image_requests.drain(..) { + let cached_images = &mut self.cached_images; + let image_template = &self.image_templates[&request.key]; + + match image_template.data { + ImageData::External(..) => {} + ImageData::Raw(ref bytes) => { + match cached_images.entry(request.clone(), self.current_frame_id) { + Occupied(entry) => { + let image_id = entry.get().texture_cache_id; + + if entry.get().epoch != image_template.epoch { + // TODO: Can we avoid the clone of the bytes here? + self.texture_cache.update(image_id, + image_template.descriptor, + bytes.clone()); + + // Update the cached epoch + *entry.into_mut() = CachedImageInfo { + texture_cache_id: image_id, + epoch: image_template.epoch, + }; + } + } + Vacant(entry) => { + let image_id = self.texture_cache.new_item_id(); + + let filter = match request.rendering { + ImageRendering::Pixelated => TextureFilter::Nearest, + ImageRendering::Auto | ImageRendering::CrispEdges => TextureFilter::Linear, + }; + + // TODO: Can we avoid the clone of the bytes here? + self.texture_cache.insert(image_id, + image_template.descriptor, + filter, + bytes.clone()); + + entry.insert(CachedImageInfo { + texture_cache_id: image_id, + epoch: image_template.epoch, + }); + } + } + } + } + } + } + + pub fn end_frame(&mut self) { + debug_assert!(self.state == State::QueryResources); + self.state = State::Idle; + } + + fn get_glyph_render_mode(&self, requested_mode: FontRenderMode) -> FontRenderMode { + if self.enable_aa { + requested_mode + } else { + FontRenderMode::Mono + } + } +} + +pub trait Resource { + fn texture_cache_item_id(&self) -> Option; +} + +impl Resource for TextureCacheItemId { + fn texture_cache_item_id(&self) -> Option { + Some(*self) + } +} + +impl Resource for Option { + fn texture_cache_item_id(&self) -> Option { + *self + } +} + +impl Resource for CachedImageInfo { + fn texture_cache_item_id(&self) -> Option { + Some(self.texture_cache_id) + } +} + +fn spawn_glyph_cache_thread() -> (Sender, Receiver) { + // Used for messages from resource cache -> glyph cache thread. + let (msg_tx, msg_rx) = channel(); + // Used for returning results from glyph cache thread -> resource cache. + let (result_tx, result_rx) = channel(); + // Used for rasterizer worker threads to send glyphs -> glyph cache thread. + let (glyph_tx, glyph_rx) = channel(); + + thread::Builder::new().name("GlyphCache".to_string()).spawn(move|| { + // TODO(gw): Use a heuristic to select best # of worker threads. + let worker_count = 4; + let thread_pool = ThreadPool::new(worker_count); + + let mut glyph_cache = None; + let mut current_frame_id = FrameId(0); + + // Maintain a set of glyphs that have been requested this + // frame. This ensures the glyph thread won't rasterize + // the same glyph more than once in a frame. This is required + // because the glyph cache hash table is not updated + // until the glyph cache is passed back to the resource + // cache which is able to add the items to the texture cache. + let mut pending_glyphs = HashSet::new(); + + while let Ok(msg) = msg_rx.recv() { + match msg { + GlyphCacheMsg::BeginFrame(frame_id, cache) => { + // We are beginning a new frame. Take ownership of the glyph + // cache hash map, so we can easily see which glyph requests + // actually need to be rasterized. + current_frame_id = frame_id; + glyph_cache = Some(cache); + } + GlyphCacheMsg::AddFont(font_key, font_template) => { + // Add a new font to the font context in each worker thread. + // Use a barrier to ensure that each worker in the pool handles + // one of these messages, to ensure that the new font gets + // added to each worker thread. + let barrier = Arc::new(Barrier::new(worker_count)); + for _ in 0..worker_count { + let barrier = barrier.clone(); + let font_template = font_template.clone(); + thread_pool.execute(move || { + FONT_CONTEXT.with(|font_context| { + let mut font_context = font_context.borrow_mut(); + match font_template { + FontTemplate::Raw(ref bytes) => { + font_context.add_raw_font(&font_key, &**bytes); + } + FontTemplate::Native(ref native_font_handle) => { + font_context.add_native_font(&font_key, + (*native_font_handle).clone()); + } + } + }); + + barrier.wait(); + }); + } + } + GlyphCacheMsg::RequestGlyphs(key, size, color, indices, render_mode) => { + // Request some glyphs for a text run. + // For any glyph that isn't currently in the cache, + // immeediately push a job to the worker thread pool + // to start rasterizing this glyph now! + let glyph_cache = glyph_cache.as_mut().unwrap(); + + for glyph_index in indices { + let glyph_key = RenderedGlyphKey::new(key, + size, + color, + glyph_index, + render_mode); + + glyph_cache.mark_as_needed(&glyph_key, current_frame_id); + if !glyph_cache.contains_key(&glyph_key) && + !pending_glyphs.contains(&glyph_key) { + let glyph_tx = glyph_tx.clone(); + pending_glyphs.insert(glyph_key.clone()); + thread_pool.execute(move || { + FONT_CONTEXT.with(move |font_context| { + let mut font_context = font_context.borrow_mut(); + let result = font_context.rasterize_glyph(glyph_key.key.font_key, + glyph_key.key.size, + glyph_key.key.color, + glyph_key.key.index, + render_mode); + glyph_tx.send((glyph_key, result)).unwrap(); + }); + }); + } + } + } + GlyphCacheMsg::EndFrame => { + // The resource cache has finished requesting glyphs. Block + // on completion of any pending glyph rasterizing jobs, and then + // return the list of new glyphs to the resource cache. + let cache = glyph_cache.take().unwrap(); + let mut rasterized_glyphs = Vec::new(); + while !pending_glyphs.is_empty() { + let (key, glyph) = glyph_rx.recv() + .expect("BUG: Should be glyphs pending!"); + debug_assert!(pending_glyphs.contains(&key)); + pending_glyphs.remove(&key); + rasterized_glyphs.push(GlyphRasterJob { + key: key, + result: glyph, + }); + } + // Ensure that the glyphs are always processed in the same + // order for a given text run (since iterating a hash set doesn't + // guarantee order). This can show up as very small float inaccuacry + // differences in rasterizers due to the different coordinates + // that text runs get associated with by the texture cache allocator. + rasterized_glyphs.sort_by(|a, b| { + a.key.cmp(&b.key) + }); + result_tx.send(GlyphCacheResultMsg::EndFrame(cache, rasterized_glyphs)).unwrap(); + } + } + } + }).unwrap(); + + (msg_tx, result_rx) +} diff --git a/gfx/webrender/src/scene.rs b/gfx/webrender/src/scene.rs new file mode 100644 index 000000000000..703c4295efb0 --- /dev/null +++ b/gfx/webrender/src/scene.rs @@ -0,0 +1,64 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use fnv::FnvHasher; +use std::collections::HashMap; +use std::hash::BuildHasherDefault; +use tiling::AuxiliaryListsMap; +use webrender_traits::{AuxiliaryLists, BuiltDisplayList, PipelineId, Epoch, ColorF}; +use webrender_traits::{DisplayItem, LayerSize}; + +/// A representation of the layout within the display port for a given document or iframe. +#[derive(Debug)] +pub struct ScenePipeline { + pub pipeline_id: PipelineId, + pub epoch: Epoch, + pub viewport_size: LayerSize, + pub background_color: Option, +} + +/// A complete representation of the layout bundling visible pipelines together. +pub struct Scene { + pub root_pipeline_id: Option, + pub pipeline_map: HashMap>, + pub pipeline_sizes: HashMap, + pub pipeline_auxiliary_lists: AuxiliaryListsMap, + pub display_lists: HashMap, BuildHasherDefault>, +} + +impl Scene { + pub fn new() -> Scene { + Scene { + root_pipeline_id: None, + pipeline_sizes: HashMap::new(), + pipeline_map: HashMap::with_hasher(Default::default()), + pipeline_auxiliary_lists: HashMap::with_hasher(Default::default()), + display_lists: HashMap::with_hasher(Default::default()), + } + } + + pub fn set_root_pipeline_id(&mut self, pipeline_id: PipelineId) { + self.root_pipeline_id = Some(pipeline_id); + } + + pub fn set_root_display_list(&mut self, + pipeline_id: PipelineId, + epoch: Epoch, + built_display_list: BuiltDisplayList, + background_color: Option, + viewport_size: LayerSize, + auxiliary_lists: AuxiliaryLists) { + self.pipeline_auxiliary_lists.insert(pipeline_id, auxiliary_lists); + self.display_lists.insert(pipeline_id, built_display_list.all_display_items().to_vec()); + + let new_pipeline = ScenePipeline { + pipeline_id: pipeline_id, + epoch: epoch, + viewport_size: viewport_size, + background_color: background_color, + }; + + self.pipeline_map.insert(pipeline_id, new_pipeline); + } +} diff --git a/gfx/webrender/src/scroll_tree.rs b/gfx/webrender/src/scroll_tree.rs new file mode 100644 index 000000000000..44f97643b823 --- /dev/null +++ b/gfx/webrender/src/scroll_tree.rs @@ -0,0 +1,309 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use fnv::FnvHasher; +use layer::{Layer, ScrollingState}; +use std::collections::{HashMap, HashSet}; +use std::hash::BuildHasherDefault; +use webrender_traits::{LayerPoint, PipelineId, ScrollEventPhase, ScrollLayerId, ScrollLayerInfo}; +use webrender_traits::{ScrollLayerPixel, ScrollLayerRect, ScrollLayerState, ScrollLocation}; +use webrender_traits::{ScrollToWorldTransform, ServoScrollRootId, WorldPoint}; +use webrender_traits::as_scroll_parent_rect; + +pub type ScrollStates = HashMap>; + +pub struct ScrollTree { + pub layers: HashMap>, + pub pending_scroll_offsets: HashMap<(PipelineId, ServoScrollRootId), LayerPoint>, + pub current_scroll_layer_id: Option, + pub root_scroll_layer_id: Option, +} + +impl ScrollTree { + pub fn new() -> ScrollTree { + ScrollTree { + layers: HashMap::with_hasher(Default::default()), + pending_scroll_offsets: HashMap::new(), + current_scroll_layer_id: None, + root_scroll_layer_id: None, + } + } + + pub fn collect_layers_bouncing_back(&self) + -> HashSet> { + let mut layers_bouncing_back = HashSet::with_hasher(Default::default()); + for (scroll_layer_id, layer) in self.layers.iter() { + if layer.scrolling.bouncing_back { + layers_bouncing_back.insert(*scroll_layer_id); + } + } + layers_bouncing_back + } + + pub fn get_scroll_layer(&self, + cursor: &WorldPoint, + scroll_layer_id: ScrollLayerId) + -> Option { + self.layers.get(&scroll_layer_id).and_then(|layer| { + for child_layer_id in layer.children.iter().rev() { + if let Some(layer_id) = self.get_scroll_layer(cursor, *child_layer_id) { + return Some(layer_id); + } + } + + if scroll_layer_id.info == ScrollLayerInfo::Fixed { + return None; + } + + if layer.ray_intersects_layer(cursor) { + Some(scroll_layer_id) + } else { + None + } + }) + } + + pub fn get_scroll_layer_state(&self) -> Vec { + let mut result = vec![]; + for (scroll_layer_id, scroll_layer) in self.layers.iter() { + match scroll_layer_id.info { + ScrollLayerInfo::Scrollable(_, servo_scroll_root_id) => { + result.push(ScrollLayerState { + pipeline_id: scroll_layer.pipeline_id, + scroll_root_id: servo_scroll_root_id, + scroll_offset: scroll_layer.scrolling.offset, + }) + } + ScrollLayerInfo::Fixed => {} + } + } + result + } + + pub fn drain(&mut self) -> ScrollStates { + let mut scroll_states = HashMap::with_hasher(Default::default()); + for (layer_id, old_layer) in &mut self.layers.drain() { + scroll_states.insert(layer_id, old_layer.scrolling); + } + scroll_states + } + + pub fn scroll_layers(&mut self, + origin: LayerPoint, + pipeline_id: PipelineId, + scroll_root_id: ServoScrollRootId) + -> bool { + let origin = LayerPoint::new(origin.x.max(0.0), origin.y.max(0.0)); + + let mut scrolled_a_layer = false; + let mut found_layer = false; + for (layer_id, layer) in self.layers.iter_mut() { + if layer_id.pipeline_id != pipeline_id { + continue; + } + + match layer_id.info { + ScrollLayerInfo::Scrollable(_, id) if id != scroll_root_id => continue, + ScrollLayerInfo::Fixed => continue, + _ => {} + } + + found_layer = true; + scrolled_a_layer |= layer.set_scroll_origin(&origin); + } + + if !found_layer { + self.pending_scroll_offsets.insert((pipeline_id, scroll_root_id), origin); + } + + scrolled_a_layer + } + + pub fn scroll(&mut self, + scroll_location: ScrollLocation, + cursor: WorldPoint, + phase: ScrollEventPhase) + -> bool { + let root_scroll_layer_id = match self.root_scroll_layer_id { + Some(root_scroll_layer_id) => root_scroll_layer_id, + None => return false, + }; + + let scroll_layer_id = match ( + phase, + self.get_scroll_layer(&cursor, root_scroll_layer_id), + self.current_scroll_layer_id) { + (ScrollEventPhase::Start, Some(scroll_layer_id), _) => { + self.current_scroll_layer_id = Some(scroll_layer_id); + scroll_layer_id + }, + (ScrollEventPhase::Start, None, _) => return false, + (_, _, Some(scroll_layer_id)) => scroll_layer_id, + (_, _, None) => return false, + }; + + let non_root_overscroll = if scroll_layer_id != root_scroll_layer_id { + // true if the current layer is overscrolling, + // and it is not the root scroll layer. + let child_layer = self.layers.get(&scroll_layer_id).unwrap(); + let overscroll_amount = child_layer.overscroll_amount(); + overscroll_amount.width != 0.0 || overscroll_amount.height != 0.0 + } else { + false + }; + + let switch_layer = match phase { + ScrollEventPhase::Start => { + // if this is a new gesture, we do not switch layer, + // however we do save the state of non_root_overscroll, + // for use in the subsequent Move phase. + let mut current_layer = self.layers.get_mut(&scroll_layer_id).unwrap(); + current_layer.scrolling.should_handoff_scroll = non_root_overscroll; + false + }, + ScrollEventPhase::Move(_) => { + // Switch layer if movement originated in a new gesture, + // from a non root layer in overscroll. + let current_layer = self.layers.get_mut(&scroll_layer_id).unwrap(); + current_layer.scrolling.should_handoff_scroll && non_root_overscroll + }, + ScrollEventPhase::End => { + // clean-up when gesture ends. + let mut current_layer = self.layers.get_mut(&scroll_layer_id).unwrap(); + current_layer.scrolling.should_handoff_scroll = false; + false + }, + }; + + let scroll_layer_info = if switch_layer { + root_scroll_layer_id.info + } else { + scroll_layer_id.info + }; + + let scroll_root_id = match scroll_layer_info { + ScrollLayerInfo::Scrollable(_, scroll_root_id) => scroll_root_id, + _ => unreachable!("Tried to scroll a non-scrolling layer."), + + }; + + let mut scrolled_a_layer = false; + for (layer_id, layer) in self.layers.iter_mut() { + if layer_id.pipeline_id != scroll_layer_id.pipeline_id { + continue; + } + + match layer_id.info { + ScrollLayerInfo::Scrollable(_, id) if id != scroll_root_id => continue, + ScrollLayerInfo::Fixed => continue, + _ => {} + } + + let scrolled_this_layer = layer.scroll(scroll_location, phase); + scrolled_a_layer = scrolled_a_layer || scrolled_this_layer; + } + scrolled_a_layer + } + + pub fn update_all_layer_transforms(&mut self) { + let root_scroll_layer_id = self.root_scroll_layer_id; + self.update_layer_transforms(root_scroll_layer_id); + } + + fn update_layer_transform(&mut self, + layer_id: ScrollLayerId, + parent_world_transform: &ScrollToWorldTransform, + parent_viewport_rect: &ScrollLayerRect) { + // TODO(gw): This is an ugly borrow check workaround to clone these. + // Restructure this to avoid the clones! + let (layer_transform_for_children, viewport_rect, layer_children) = { + match self.layers.get_mut(&layer_id) { + Some(layer) => { + layer.update_transform(parent_world_transform, parent_viewport_rect); + + (layer.world_content_transform.with_source::(), + as_scroll_parent_rect(&layer.combined_local_viewport_rect), + layer.children.clone()) + } + None => return, + } + }; + + for child_layer_id in layer_children { + self.update_layer_transform(child_layer_id, + &layer_transform_for_children, + &viewport_rect); + } + } + + pub fn update_layer_transforms(&mut self, root_scroll_layer_id: Option) { + if let Some(root_scroll_layer_id) = root_scroll_layer_id { + let root_viewport = self.layers[&root_scroll_layer_id].local_viewport_rect; + + self.update_layer_transform(root_scroll_layer_id, + &ScrollToWorldTransform::identity(), + &as_scroll_parent_rect(&root_viewport)); + + // Update any fixed layers + let mut fixed_layers = Vec::new(); + for (layer_id, _) in &self.layers { + match layer_id.info { + ScrollLayerInfo::Scrollable(..) => {} + ScrollLayerInfo::Fixed => { + fixed_layers.push(*layer_id); + } + } + } + + for layer_id in fixed_layers { + self.update_layer_transform(layer_id, + &ScrollToWorldTransform::identity(), + &as_scroll_parent_rect(&root_viewport)); + } + } + } + + pub fn tick_scrolling_bounce_animations(&mut self) { + for (_, layer) in &mut self.layers { + layer.tick_scrolling_bounce_animation() + } + } + + pub fn finalize_and_apply_pending_scroll_offsets(&mut self, old_states: ScrollStates) { + // TODO(gw): These are all independent - can be run through thread pool if it shows up + // in the profile! + for (scroll_layer_id, layer) in &mut self.layers { + let scrolling_state = match old_states.get(&scroll_layer_id) { + Some(old_scrolling_state) => *old_scrolling_state, + None => ScrollingState::new(), + }; + + layer.finalize(&scrolling_state); + + let scroll_root_id = match scroll_layer_id.info { + ScrollLayerInfo::Scrollable(_, scroll_root_id) => scroll_root_id, + _ => continue, + }; + + + let pipeline_id = scroll_layer_id.pipeline_id; + if let Some(pending_offset) = + self.pending_scroll_offsets.get_mut(&(pipeline_id, scroll_root_id)) { + layer.set_scroll_origin(pending_offset); + } + } + + } + + pub fn add_layer(&mut self, layer: Layer, id: ScrollLayerId, parent_id: Option) { + debug_assert!(!self.layers.contains_key(&id)); + self.layers.insert(id, layer); + + if let Some(parent_id) = parent_id { + debug_assert!(parent_id != id); + self.layers.get_mut(&parent_id).unwrap().add_child(id); + } + } +} + diff --git a/gfx/webrender/src/spring.rs b/gfx/webrender/src/spring.rs new file mode 100644 index 000000000000..55b04919a71e --- /dev/null +++ b/gfx/webrender/src/spring.rs @@ -0,0 +1,103 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use webrender_traits::LayerPoint; + +/// Some arbitrarily small positive number used as threshold value. +pub const EPSILON: f32 = 0.1; + +/// The default stiffness factor. +pub const STIFFNESS: f32 = 0.2; + +/// The default damping factor. +pub const DAMPING: f32 = 1.0; + +#[derive(Copy, Clone, Debug)] +pub struct Spring { + /// The current position of spring. + cur: LayerPoint, + /// The position of spring at previous tick. + prev: LayerPoint, + /// The destination of spring. + dest: LayerPoint, + /// How hard it springs back. + stiffness: f32, + /// Friction. 1.0 means no bounce. + damping: f32, +} + +impl Spring { + /// Create a new spring at location. + pub fn at(pos: LayerPoint, stiffness: f32, damping: f32) -> Spring { + Spring { + cur: pos, + prev: pos, + dest: pos, + stiffness: stiffness, + damping: damping, + } + } + + /// Set coords on a spring, mutating spring + pub fn coords(&mut self, cur: LayerPoint, prev: LayerPoint, dest: LayerPoint) { + self.cur = cur; + self.prev = prev; + self.dest = dest + } + + pub fn current(&self) -> LayerPoint { + self.cur + } + + /// Run one tick of the spring animation. Return true if the animation is complete. + pub fn animate(&mut self) -> bool { + if !is_resting(self.cur.x, self.prev.x, self.dest.x) || + !is_resting(self.cur.y, self.prev.y, self.dest.y) { + let next = LayerPoint::new(next(self.cur.x, + self.prev.x, + self.dest.x, + self.stiffness, + self.damping), + next(self.cur.y, + self.prev.y, + self.dest.y, + self.stiffness, + self.damping)); + let (cur, dest) = (self.cur, self.dest); + self.coords(next, cur, dest); + false + } else { + let dest = self.dest; + self.coords(dest, dest, dest); + true + } + } +} + +/// Given numbers, calculate the next position for a spring. +fn next(cur: f32, prev: f32, dest: f32, stiffness: f32, damping: f32) -> f32 { + // Calculate spring force + let fspring = -stiffness * (cur - dest); + + // Calculate velocity + let vel = cur - prev; + + // Calculate damping force. + let fdamping = -damping * vel; + + // Calc acceleration by adjusting spring force to damping force + let acc = fspring + fdamping; + + // Calculate new velocity after adding acceleration. Scale to framerate. + let nextv = vel + acc; + + // Calculate next position by integrating velocity. Scale to framerate. + let next = cur + nextv; + next +} + +/// Given numbers, calcluate if a spring is at rest. +fn is_resting(cur: f32, prev: f32, dest: f32) -> bool { + (cur - prev).abs() < EPSILON && (cur - dest).abs() < EPSILON +} diff --git a/gfx/webrender/src/texture_cache.rs b/gfx/webrender/src/texture_cache.rs new file mode 100644 index 000000000000..0a40151591bd --- /dev/null +++ b/gfx/webrender/src/texture_cache.rs @@ -0,0 +1,954 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use device::{MAX_TEXTURE_SIZE, TextureFilter}; +use fnv::FnvHasher; +use freelist::{FreeList, FreeListItem, FreeListItemId}; +use internal_types::{TextureUpdate, TextureUpdateOp}; +use internal_types::{CacheTextureId, RenderTargetMode, TextureUpdateList, RectUv}; +use std::cmp::{self, Ordering}; +use std::collections::HashMap; +use std::collections::hash_map::Entry; +use std::hash::BuildHasherDefault; +use std::mem; +use std::slice::Iter; +use std::sync::Arc; +use time; +use util; +use webrender_traits::{ImageFormat, DevicePixel, DeviceIntPoint}; +use webrender_traits::{DeviceUintRect, DeviceUintSize, DeviceUintPoint}; +use webrender_traits::ImageDescriptor; + +/// The number of bytes we're allowed to use for a texture. +const MAX_BYTES_PER_TEXTURE: u32 = 1024 * 1024 * 256; // 256MB + +/// The number of RGBA pixels we're allowed to use for a texture. +const MAX_RGBA_PIXELS_PER_TEXTURE: u32 = MAX_BYTES_PER_TEXTURE / 4; + +/// The desired initial size of each texture, in pixels. +const INITIAL_TEXTURE_SIZE: u32 = 1024; + +/// The desired initial area of each texture, in pixels squared. +const INITIAL_TEXTURE_AREA: u32 = INITIAL_TEXTURE_SIZE * INITIAL_TEXTURE_SIZE; + +/// The square root of the number of RGBA pixels we're allowed to use for a texture, rounded down. +/// to the next power of two. +const SQRT_MAX_RGBA_PIXELS_PER_TEXTURE: u32 = 8192; + +/// The minimum number of pixels on each side that we require for rects to be classified as +/// "medium" within the free list. +const MINIMUM_MEDIUM_RECT_SIZE: u32 = 16; + +/// The minimum number of pixels on each side that we require for rects to be classified as +/// "large" within the free list. +const MINIMUM_LARGE_RECT_SIZE: u32 = 32; + +/// The amount of time in milliseconds we give ourselves to coalesce rects before giving up. +const COALESCING_TIMEOUT: u64 = 100; + +/// The number of items that we process in the coalescing work list before checking whether we hit +/// the timeout. +const COALESCING_TIMEOUT_CHECKING_INTERVAL: usize = 256; + +pub type TextureCacheItemId = FreeListItemId; + +#[inline] +fn copy_pixels(src: &[u8], + target: &mut Vec, + x: u32, + y: u32, + count: u32, + width: u32, + stride: Option, + bpp: u32) { + let row_length = match stride { + Some(value) => value / bpp, + None => width, + }; + + let pixel_index = (y * row_length + x) * bpp; + for byte in src.iter().skip(pixel_index as usize).take((count * bpp) as usize) { + target.push(*byte); + } +} + +/// A texture allocator using the guillotine algorithm with the rectangle merge improvement. See +/// sections 2.2 and 2.2.5 in "A Thousand Ways to Pack the Bin - A Practical Approach to Two- +/// Dimensional Rectangle Bin Packing": +/// +/// http://clb.demon.fi/files/RectangleBinPack.pdf +/// +/// This approach was chosen because of its simplicity, good performance, and easy support for +/// dynamic texture deallocation. +pub struct TexturePage { + texture_id: CacheTextureId, + texture_size: DeviceUintSize, + free_list: FreeRectList, + allocations: u32, + dirty: bool, +} + +impl TexturePage { + pub fn new(texture_id: CacheTextureId, texture_size: DeviceUintSize) -> TexturePage { + let mut page = TexturePage { + texture_id: texture_id, + texture_size: texture_size, + free_list: FreeRectList::new(), + allocations: 0, + dirty: false, + }; + page.clear(); + page + } + + fn find_index_of_best_rect_in_bin(&self, bin: FreeListBin, requested_dimensions: &DeviceUintSize) + -> Option { + let mut smallest_index_and_area = None; + for (candidate_index, candidate_rect) in self.free_list.iter(bin).enumerate() { + if !requested_dimensions.fits_inside(&candidate_rect.size) { + continue + } + + let candidate_area = candidate_rect.size.width * candidate_rect.size.height; + smallest_index_and_area = Some((candidate_index, candidate_area)); + break + } + + smallest_index_and_area.map(|(index, _)| FreeListIndex(bin, index)) + } + + fn find_index_of_best_rect(&self, requested_dimensions: &DeviceUintSize) + -> Option { + match FreeListBin::for_size(requested_dimensions) { + FreeListBin::Large => { + self.find_index_of_best_rect_in_bin(FreeListBin::Large, requested_dimensions) + } + FreeListBin::Medium => { + match self.find_index_of_best_rect_in_bin(FreeListBin::Medium, + requested_dimensions) { + Some(index) => Some(index), + None => { + self.find_index_of_best_rect_in_bin(FreeListBin::Large, + requested_dimensions) + } + } + } + FreeListBin::Small => { + match self.find_index_of_best_rect_in_bin(FreeListBin::Small, + requested_dimensions) { + Some(index) => Some(index), + None => { + match self.find_index_of_best_rect_in_bin(FreeListBin::Medium, + requested_dimensions) { + Some(index) => Some(index), + None => { + self.find_index_of_best_rect_in_bin(FreeListBin::Large, + requested_dimensions) + } + } + } + } + } + } + } + + pub fn allocate(&mut self, + requested_dimensions: &DeviceUintSize) -> Option { + // First, try to find a suitable rect in the free list. We choose the smallest such rect + // in terms of area (Best-Area-Fit, BAF). + let mut index = self.find_index_of_best_rect(requested_dimensions); + + // If one couldn't be found and we're dirty, coalesce rects and try again. + if index.is_none() && self.dirty { + self.coalesce(); + index = self.find_index_of_best_rect(requested_dimensions) + } + + // If a rect still can't be found, fail. + let index = match index { + None => return None, + Some(index) => index, + }; + + // Remove the rect from the free list and decide how to guillotine it. We choose the split + // that results in the single largest area (Min Area Split Rule, MINAS). + let chosen_rect = self.free_list.remove(index); + let candidate_free_rect_to_right = + DeviceUintRect::new( + DeviceUintPoint::new(chosen_rect.origin.x + requested_dimensions.width, chosen_rect.origin.y), + DeviceUintSize::new(chosen_rect.size.width - requested_dimensions.width, requested_dimensions.height)); + let candidate_free_rect_to_bottom = + DeviceUintRect::new( + DeviceUintPoint::new(chosen_rect.origin.x, chosen_rect.origin.y + requested_dimensions.height), + DeviceUintSize::new(requested_dimensions.width, chosen_rect.size.height - requested_dimensions.height)); + let candidate_free_rect_to_right_area = candidate_free_rect_to_right.size.width * + candidate_free_rect_to_right.size.height; + let candidate_free_rect_to_bottom_area = candidate_free_rect_to_bottom.size.width * + candidate_free_rect_to_bottom.size.height; + + // Guillotine the rectangle. + let new_free_rect_to_right; + let new_free_rect_to_bottom; + if candidate_free_rect_to_right_area > candidate_free_rect_to_bottom_area { + new_free_rect_to_right = DeviceUintRect::new( + candidate_free_rect_to_right.origin, + DeviceUintSize::new(candidate_free_rect_to_right.size.width, + chosen_rect.size.height)); + new_free_rect_to_bottom = candidate_free_rect_to_bottom + } else { + new_free_rect_to_right = candidate_free_rect_to_right; + new_free_rect_to_bottom = + DeviceUintRect::new(candidate_free_rect_to_bottom.origin, + DeviceUintSize::new(chosen_rect.size.width, + candidate_free_rect_to_bottom.size.height)) + } + + // Add the guillotined rects back to the free list. If any changes were made, we're now + // dirty since coalescing might be able to defragment. + if !util::rect_is_empty(&new_free_rect_to_right) { + self.free_list.push(&new_free_rect_to_right); + self.dirty = true + } + if !util::rect_is_empty(&new_free_rect_to_bottom) { + self.free_list.push(&new_free_rect_to_bottom); + self.dirty = true + } + + // Bump the allocation counter. + self.allocations += 1; + + // Return the result. + Some(chosen_rect.origin) + } + + #[inline(never)] + fn coalesce(&mut self) { + // Iterate to a fixed point or until a timeout is reached. + let deadline = time::precise_time_ns() + COALESCING_TIMEOUT; + let mut free_list = mem::replace(&mut self.free_list, FreeRectList::new()).into_vec(); + let mut changed = false; + + // Combine rects that have the same width and are adjacent. + let mut new_free_list = Vec::new(); + free_list.sort_by(|a, b| { + match a.size.width.cmp(&b.size.width) { + Ordering::Equal => a.origin.x.cmp(&b.origin.x), + ordering => ordering, + } + }); + for work_index in 0..free_list.len() { + if work_index % COALESCING_TIMEOUT_CHECKING_INTERVAL == 0 && + time::precise_time_ns() >= deadline { + self.free_list = FreeRectList::from_slice(&free_list[..]); + self.dirty = true; + return + } + + if free_list[work_index].size.width == 0 { + continue + } + for candidate_index in (work_index + 1)..free_list.len() { + if free_list[work_index].size.width != free_list[candidate_index].size.width || + free_list[work_index].origin.x != free_list[candidate_index].origin.x { + break + } + if free_list[work_index].origin.y == free_list[candidate_index].max_y() || + free_list[work_index].max_y() == free_list[candidate_index].origin.y { + changed = true; + free_list[work_index] = + free_list[work_index].union(&free_list[candidate_index]); + free_list[candidate_index].size.width = 0 + } + new_free_list.push(free_list[work_index]) + } + new_free_list.push(free_list[work_index]) + } + free_list = new_free_list; + + // Combine rects that have the same height and are adjacent. + let mut new_free_list = Vec::new(); + free_list.sort_by(|a, b| { + match a.size.height.cmp(&b.size.height) { + Ordering::Equal => a.origin.y.cmp(&b.origin.y), + ordering => ordering, + } + }); + for work_index in 0..free_list.len() { + if work_index % COALESCING_TIMEOUT_CHECKING_INTERVAL == 0 && + time::precise_time_ns() >= deadline { + self.free_list = FreeRectList::from_slice(&free_list[..]); + self.dirty = true; + return + } + + if free_list[work_index].size.height == 0 { + continue + } + for candidate_index in (work_index + 1)..free_list.len() { + if free_list[work_index].size.height != + free_list[candidate_index].size.height || + free_list[work_index].origin.y != free_list[candidate_index].origin.y { + break + } + if free_list[work_index].origin.x == free_list[candidate_index].max_x() || + free_list[work_index].max_x() == free_list[candidate_index].origin.x { + changed = true; + free_list[work_index] = + free_list[work_index].union(&free_list[candidate_index]); + free_list[candidate_index].size.height = 0 + } + } + new_free_list.push(free_list[work_index]) + } + free_list = new_free_list; + + self.free_list = FreeRectList::from_slice(&free_list[..]); + self.dirty = changed + } + + pub fn clear(&mut self) { + self.free_list = FreeRectList::new(); + self.free_list.push(&DeviceUintRect::new( + DeviceUintPoint::zero(), + self.texture_size)); + self.allocations = 0; + self.dirty = false; + } + + fn free(&mut self, rect: &DeviceUintRect) { + debug_assert!(self.allocations > 0); + self.allocations -= 1; + if self.allocations == 0 { + self.clear(); + return + } + + self.free_list.push(rect); + self.dirty = true + } + + fn grow(&mut self, new_texture_size: DeviceUintSize) { + assert!(new_texture_size.width >= self.texture_size.width); + assert!(new_texture_size.height >= self.texture_size.height); + + let new_rects = [ + DeviceUintRect::new(DeviceUintPoint::new(self.texture_size.width, 0), + DeviceUintSize::new(new_texture_size.width - self.texture_size.width, + new_texture_size.height)), + + DeviceUintRect::new(DeviceUintPoint::new(0, self.texture_size.height), + DeviceUintSize::new(self.texture_size.width, + new_texture_size.height - self.texture_size.height)), + ]; + + for rect in &new_rects { + if rect.size.width > 0 && rect.size.height > 0 { + self.free_list.push(rect); + } + } + + self.texture_size = new_texture_size + } + + fn can_grow(&self) -> bool { + self.texture_size.width < max_texture_size() || + self.texture_size.height < max_texture_size() + } +} + +/// A binning free list. Binning is important to avoid sifting through lots of small strips when +/// allocating many texture items. +struct FreeRectList { + small: Vec, + medium: Vec, + large: Vec, +} + +impl FreeRectList { + fn new() -> FreeRectList { + FreeRectList { + small: vec![], + medium: vec![], + large: vec![], + } + } + + fn from_slice(vector: &[DeviceUintRect]) -> FreeRectList { + let mut free_list = FreeRectList::new(); + for rect in vector { + free_list.push(rect) + } + free_list + } + + fn push(&mut self, rect: &DeviceUintRect) { + match FreeListBin::for_size(&rect.size) { + FreeListBin::Small => self.small.push(*rect), + FreeListBin::Medium => self.medium.push(*rect), + FreeListBin::Large => self.large.push(*rect), + } + } + + fn remove(&mut self, index: FreeListIndex) -> DeviceUintRect { + match index.0 { + FreeListBin::Small => self.small.swap_remove(index.1), + FreeListBin::Medium => self.medium.swap_remove(index.1), + FreeListBin::Large => self.large.swap_remove(index.1), + } + } + + fn iter(&self, bin: FreeListBin) -> Iter { + match bin { + FreeListBin::Small => self.small.iter(), + FreeListBin::Medium => self.medium.iter(), + FreeListBin::Large => self.large.iter(), + } + } + + fn into_vec(mut self) -> Vec { + self.small.extend(self.medium.drain(..)); + self.small.extend(self.large.drain(..)); + self.small + } +} + +#[derive(Debug, Clone, Copy)] +struct FreeListIndex(FreeListBin, usize); + +#[derive(Debug, Clone, Copy, PartialEq)] +enum FreeListBin { + Small, + Medium, + Large, +} + +impl FreeListBin { + pub fn for_size(size: &DeviceUintSize) -> FreeListBin { + if size.width >= MINIMUM_LARGE_RECT_SIZE && size.height >= MINIMUM_LARGE_RECT_SIZE { + FreeListBin::Large + } else if size.width >= MINIMUM_MEDIUM_RECT_SIZE && + size.height >= MINIMUM_MEDIUM_RECT_SIZE { + FreeListBin::Medium + } else { + FreeListBin::Small + } + } +} + +#[derive(Debug, Clone)] +pub struct TextureCacheItem { + // Identifies the texture and array slice + pub texture_id: CacheTextureId, + + // The texture coordinates for this item + pub pixel_rect: RectUv, + + // The size of the entire texture (not just the allocated rectangle) + pub texture_size: DeviceUintSize, + + // The size of the actual allocated rectangle, + // and the requested size. The allocated size + // is the same as the requested in most cases, + // unless the item has a border added for + // bilinear filtering / texture bleeding purposes. + pub allocated_rect: DeviceUintRect, + pub requested_rect: DeviceUintRect, +} + +// Structure squat the width/height fields to maintain the free list information :) +impl FreeListItem for TextureCacheItem { + fn next_free_id(&self) -> Option { + if self.requested_rect.size.width == 0 { + debug_assert!(self.requested_rect.size.height == 0); + None + } else { + debug_assert!(self.requested_rect.size.width == 1); + Some(FreeListItemId::new(self.requested_rect.size.height)) + } + } + + fn set_next_free_id(&mut self, id: Option) { + match id { + Some(id) => { + self.requested_rect.size.width = 1; + self.requested_rect.size.height = id.value(); + } + None => { + self.requested_rect.size.width = 0; + self.requested_rect.size.height = 0; + } + } + } +} + +impl TextureCacheItem { + fn new(texture_id: CacheTextureId, + allocated_rect: DeviceUintRect, + requested_rect: DeviceUintRect, + texture_size: &DeviceUintSize) + -> TextureCacheItem { + TextureCacheItem { + texture_id: texture_id, + texture_size: *texture_size, + pixel_rect: RectUv { + top_left: DeviceIntPoint::new(requested_rect.origin.x as i32, + requested_rect.origin.y as i32), + top_right: DeviceIntPoint::new((requested_rect.origin.x + requested_rect.size.width) as i32, + requested_rect.origin.y as i32), + bottom_left: DeviceIntPoint::new(requested_rect.origin.x as i32, + (requested_rect.origin.y + requested_rect.size.height) as i32), + bottom_right: DeviceIntPoint::new((requested_rect.origin.x + requested_rect.size.width) as i32, + (requested_rect.origin.y + requested_rect.size.height) as i32) + }, + allocated_rect: allocated_rect, + requested_rect: requested_rect, + } + } +} + +struct TextureCacheArena { + pages_a8: Vec, + pages_rgb8: Vec, + pages_rgba8: Vec, +} + +impl TextureCacheArena { + fn new() -> TextureCacheArena { + TextureCacheArena { + pages_a8: Vec::new(), + pages_rgb8: Vec::new(), + pages_rgba8: Vec::new(), + } + } + + fn texture_page_for_id(&mut self, id: CacheTextureId) -> Option<&mut TexturePage> { + for page in self.pages_a8.iter_mut().chain(self.pages_rgb8.iter_mut()) + .chain(self.pages_rgba8.iter_mut()) { + if page.texture_id == id { + return Some(page) + } + } + None + } +} + +pub struct CacheTextureIdList { + next_id: usize, + free_list: Vec, +} + +impl CacheTextureIdList { + fn new() -> CacheTextureIdList { + CacheTextureIdList { + next_id: 0, + free_list: Vec::new(), + } + } + + fn allocate(&mut self) -> CacheTextureId { + // If nothing on the free list of texture IDs, + // allocate a new one. + if self.free_list.is_empty() { + self.free_list.push(self.next_id); + self.next_id += 1; + } + + let id = self.free_list.pop().unwrap(); + CacheTextureId(id) + } + + fn free(&mut self, id: CacheTextureId) { + self.free_list.push(id.0); + } +} + +pub struct TextureCache { + cache_id_list: CacheTextureIdList, + free_texture_levels: HashMap, BuildHasherDefault>, + items: FreeList, + arena: TextureCacheArena, + pending_updates: TextureUpdateList, +} + +#[derive(PartialEq, Eq, Debug)] +pub enum AllocationKind { + TexturePage, + Standalone, +} + +#[derive(Debug)] +pub struct AllocationResult { + kind: AllocationKind, + item: TextureCacheItem, +} + +impl TextureCache { + pub fn new() -> TextureCache { + TextureCache { + cache_id_list: CacheTextureIdList::new(), + free_texture_levels: HashMap::with_hasher(Default::default()), + items: FreeList::new(), + pending_updates: TextureUpdateList::new(), + arena: TextureCacheArena::new(), + } + } + + pub fn pending_updates(&mut self) -> TextureUpdateList { + mem::replace(&mut self.pending_updates, TextureUpdateList::new()) + } + + // TODO(gw): This API is a bit ugly (having to allocate an ID and + // then use it). But it has to be that way for now due to + // how the raster_jobs code works. + pub fn new_item_id(&mut self) -> TextureCacheItemId { + let new_item = TextureCacheItem { + pixel_rect: RectUv { + top_left: DeviceIntPoint::zero(), + top_right: DeviceIntPoint::zero(), + bottom_left: DeviceIntPoint::zero(), + bottom_right: DeviceIntPoint::zero(), + }, + allocated_rect: DeviceUintRect::zero(), + requested_rect: DeviceUintRect::zero(), + texture_size: DeviceUintSize::zero(), + texture_id: CacheTextureId(0), + }; + self.items.insert(new_item) + } + + pub fn allocate(&mut self, + image_id: TextureCacheItemId, + requested_width: u32, + requested_height: u32, + format: ImageFormat, + filter: TextureFilter) + -> AllocationResult { + let requested_size = DeviceUintSize::new(requested_width, requested_height); + + // TODO(gw): For now, anything that requests nearest filtering + // just fails to allocate in a texture page, and gets a standalone + // texture. This isn't ideal, as it causes lots of batch breaks, + // but is probably rare enough that it can be fixed up later (it's also + // fairly trivial to implement, just tedious). + if filter == TextureFilter::Nearest { + // Fall back to standalone texture allocation. + let texture_id = self.cache_id_list.allocate(); + let cache_item = TextureCacheItem::new( + texture_id, + DeviceUintRect::new(DeviceUintPoint::zero(), requested_size), + DeviceUintRect::new(DeviceUintPoint::zero(), requested_size), + &requested_size); + *self.items.get_mut(image_id) = cache_item; + + return AllocationResult { + item: self.items.get(image_id).clone(), + kind: AllocationKind::Standalone, + } + } + + let mode = RenderTargetMode::SimpleRenderTarget; + let page_list = match format { + ImageFormat::A8 => &mut self.arena.pages_a8, + ImageFormat::RGBA8 => &mut self.arena.pages_rgba8, + ImageFormat::RGB8 => &mut self.arena.pages_rgb8, + ImageFormat::Invalid | ImageFormat::RGBAF32 => unreachable!(), + }; + + let border_size = 1; + let allocation_size = DeviceUintSize::new(requested_width + border_size * 2, + requested_height + border_size * 2); + + // TODO(gw): Handle this sensibly (support failing to render items that can't fit?) + assert!(allocation_size.width < max_texture_size()); + assert!(allocation_size.height < max_texture_size()); + + // Loop until an allocation succeeds, growing or adding new + // texture pages as required. + loop { + let location = page_list.last_mut().and_then(|last_page| { + last_page.allocate(&allocation_size) + }); + + if let Some(location) = location { + let page = page_list.last_mut().unwrap(); + + let allocated_rect = DeviceUintRect::new(location, allocation_size); + let requested_rect = DeviceUintRect::new( + DeviceUintPoint::new(location.x + border_size, location.y + border_size), + requested_size); + + let cache_item = TextureCacheItem::new(page.texture_id, + allocated_rect, + requested_rect, + &page.texture_size); + *self.items.get_mut(image_id) = cache_item; + + return AllocationResult { + item: self.items.get(image_id).clone(), + kind: AllocationKind::TexturePage, + } + } + + if !page_list.is_empty() && page_list.last().unwrap().can_grow() { + let last_page = page_list.last_mut().unwrap(); + // Grow the texture. + let new_width = cmp::min(last_page.texture_size.width * 2, max_texture_size()); + let new_height = cmp::min(last_page.texture_size.height * 2, max_texture_size()); + let texture_size = DeviceUintSize::new(new_width, new_height); + self.pending_updates.push(TextureUpdate { + id: last_page.texture_id, + op: texture_grow_op(texture_size, format, mode), + }); + last_page.grow(texture_size); + + self.items.for_each_item(|item| { + if item.texture_id == last_page.texture_id { + item.texture_size = texture_size; + } + }); + + continue; + } + + // We need a new page. + let texture_size = initial_texture_size(); + let free_texture_levels_entry = self.free_texture_levels.entry(format); + let mut free_texture_levels = match free_texture_levels_entry { + Entry::Vacant(entry) => entry.insert(Vec::new()), + Entry::Occupied(entry) => entry.into_mut(), + }; + if free_texture_levels.is_empty() { + let texture_id = self.cache_id_list.allocate(); + + let update_op = TextureUpdate { + id: texture_id, + op: texture_create_op(texture_size, format, mode), + }; + self.pending_updates.push(update_op); + + free_texture_levels.push(FreeTextureLevel { + texture_id: texture_id, + }); + } + let free_texture_level = free_texture_levels.pop().unwrap(); + let texture_id = free_texture_level.texture_id; + + let page = TexturePage::new(texture_id, texture_size); + page_list.push(page); + } + } + + pub fn update(&mut self, + image_id: TextureCacheItemId, + descriptor: ImageDescriptor, + bytes: Arc>) { + let existing_item = self.items.get(image_id); + + // TODO(gw): Handle updates to size/format! + debug_assert!(existing_item.requested_rect.size.width == descriptor.width); + debug_assert!(existing_item.requested_rect.size.height == descriptor.height); + + let op = TextureUpdateOp::Update(existing_item.requested_rect.origin.x, + existing_item.requested_rect.origin.y, + descriptor.width, + descriptor.height, + bytes, + descriptor.stride); + + let update_op = TextureUpdate { + id: existing_item.texture_id, + op: op, + }; + + self.pending_updates.push(update_op); + } + + pub fn insert(&mut self, + image_id: TextureCacheItemId, + descriptor: ImageDescriptor, + filter: TextureFilter, + bytes: Arc>) { + let width = descriptor.width; + let height = descriptor.height; + let format = descriptor.format; + let stride = descriptor.stride; + + let result = self.allocate(image_id, + width, + height, + format, + filter); + + let op = match result.kind { + AllocationKind::TexturePage => { + let bpp = format.bytes_per_pixel().unwrap(); + + let mut top_row_bytes = Vec::new(); + let mut bottom_row_bytes = Vec::new(); + let mut left_column_bytes = Vec::new(); + let mut right_column_bytes = Vec::new(); + + copy_pixels(&bytes, &mut top_row_bytes, 0, 0, 1, width, stride, bpp); + copy_pixels(&bytes, &mut top_row_bytes, 0, 0, width, width, stride, bpp); + copy_pixels(&bytes, &mut top_row_bytes, width-1, 0, 1, width, stride, bpp); + + copy_pixels(&bytes, &mut bottom_row_bytes, 0, height-1, 1, width, stride, bpp); + copy_pixels(&bytes, &mut bottom_row_bytes, 0, height-1, width, width, stride, bpp); + copy_pixels(&bytes, &mut bottom_row_bytes, width-1, height-1, 1, width, stride, bpp); + + for y in 0..height { + copy_pixels(&bytes, &mut left_column_bytes, 0, y, 1, width, stride, bpp); + copy_pixels(&bytes, &mut right_column_bytes, width-1, y, 1, width, stride, bpp); + } + + let border_update_op_top = TextureUpdate { + id: result.item.texture_id, + op: TextureUpdateOp::Update(result.item.allocated_rect.origin.x, + result.item.allocated_rect.origin.y, + result.item.allocated_rect.size.width, + 1, + Arc::new(top_row_bytes), + None) + }; + + let border_update_op_bottom = TextureUpdate { + id: result.item.texture_id, + op: TextureUpdateOp::Update( + result.item.allocated_rect.origin.x, + result.item.allocated_rect.origin.y + + result.item.requested_rect.size.height + 1, + result.item.allocated_rect.size.width, + 1, + Arc::new(bottom_row_bytes), + None) + }; + + let border_update_op_left = TextureUpdate { + id: result.item.texture_id, + op: TextureUpdateOp::Update( + result.item.allocated_rect.origin.x, + result.item.requested_rect.origin.y, + 1, + result.item.requested_rect.size.height, + Arc::new(left_column_bytes), + None) + }; + + let border_update_op_right = TextureUpdate { + id: result.item.texture_id, + op: TextureUpdateOp::Update(result.item.allocated_rect.origin.x + result.item.requested_rect.size.width + 1, + result.item.requested_rect.origin.y, + 1, + result.item.requested_rect.size.height, + Arc::new(right_column_bytes), + None) + }; + + self.pending_updates.push(border_update_op_top); + self.pending_updates.push(border_update_op_bottom); + self.pending_updates.push(border_update_op_left); + self.pending_updates.push(border_update_op_right); + + TextureUpdateOp::Update(result.item.requested_rect.origin.x, + result.item.requested_rect.origin.y, + width, + height, + bytes, + stride) + } + AllocationKind::Standalone => { + TextureUpdateOp::Create(width, + height, + format, + filter, + RenderTargetMode::None, + Some(bytes)) + } + }; + + let update_op = TextureUpdate { + id: result.item.texture_id, + op: op, + }; + + self.pending_updates.push(update_op); + } + + pub fn get(&self, id: TextureCacheItemId) -> &TextureCacheItem { + self.items.get(id) + } + + pub fn free(&mut self, id: TextureCacheItemId) { + { + let item = self.items.get(id); + match self.arena.texture_page_for_id(item.texture_id) { + Some(texture_page) => texture_page.free(&item.allocated_rect), + None => { + // This is a standalone texture allocation. Just push it back onto the free + // list. + self.pending_updates.push(TextureUpdate { + id: item.texture_id, + op: TextureUpdateOp::Free, + }); + self.cache_id_list.free(item.texture_id); + } + } + } + + self.items.free(id) + } +} + +fn texture_create_op(texture_size: DeviceUintSize, format: ImageFormat, mode: RenderTargetMode) + -> TextureUpdateOp { + TextureUpdateOp::Create(texture_size.width, texture_size.height, format, TextureFilter::Linear, mode, None) +} + +fn texture_grow_op(texture_size: DeviceUintSize, + format: ImageFormat, + mode: RenderTargetMode) + -> TextureUpdateOp { + TextureUpdateOp::Grow(texture_size.width, + texture_size.height, + format, + TextureFilter::Linear, + mode) +} + +trait FitsInside { + fn fits_inside(&self, other: &Self) -> bool; +} + +impl FitsInside for DeviceUintSize { + fn fits_inside(&self, other: &DeviceUintSize) -> bool { + self.width <= other.width && self.height <= other.height + } +} + +/// FIXME(pcwalton): Would probably be more efficient as a bit vector. +#[derive(Clone, Copy)] +pub struct FreeTextureLevel { + texture_id: CacheTextureId, +} + +/// Returns the number of pixels on a side we start out with for our texture atlases. +fn initial_texture_size() -> DeviceUintSize { + let max_hardware_texture_size = *MAX_TEXTURE_SIZE as u32; + let initial_size = if max_hardware_texture_size * max_hardware_texture_size > INITIAL_TEXTURE_AREA { + INITIAL_TEXTURE_SIZE + } else { + max_hardware_texture_size + }; + DeviceUintSize::new(initial_size, initial_size) +} + +/// Returns the number of pixels on a side we're allowed to use for our texture atlases. +fn max_texture_size() -> u32 { + let max_hardware_texture_size = *MAX_TEXTURE_SIZE as u32; + if max_hardware_texture_size * max_hardware_texture_size > MAX_RGBA_PIXELS_PER_TEXTURE { + SQRT_MAX_RGBA_PIXELS_PER_TEXTURE + } else { + max_hardware_texture_size + } +} diff --git a/gfx/webrender/src/tiling.rs b/gfx/webrender/src/tiling.rs new file mode 100644 index 000000000000..f6950725765f --- /dev/null +++ b/gfx/webrender/src/tiling.rs @@ -0,0 +1,3068 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use batch_builder::BorderSideHelpers; +use fnv::FnvHasher; +use frame::FrameId; +use gpu_store::GpuStoreAddress; +use internal_types::{ANGLE_FLOAT_TO_FIXED, LowLevelFilterOp, CompositionOp}; +use internal_types::{BatchTextures, CacheTextureId, SourceTexture}; +use mask_cache::{ClipSource, MaskCacheInfo}; +use prim_store::{PrimitiveGeometry, RectanglePrimitive, PrimitiveContainer}; +use prim_store::{BorderPrimitiveCpu, BorderPrimitiveGpu, BoxShadowPrimitiveGpu}; +use prim_store::{ImagePrimitiveCpu, ImagePrimitiveGpu, YuvImagePrimitiveCpu, YuvImagePrimitiveGpu, ImagePrimitiveKind, }; +use prim_store::{PrimitiveKind, PrimitiveIndex, PrimitiveMetadata, TexelRect}; +use prim_store::{CLIP_DATA_GPU_SIZE, DeferredResolve}; +use prim_store::{GradientPrimitiveCpu, GradientPrimitiveGpu, GradientType}; +use prim_store::{RadialGradientPrimitiveCpu, RadialGradientPrimitiveGpu}; +use prim_store::{PrimitiveCacheKey, TextRunPrimitiveGpu, TextRunPrimitiveCpu}; +use prim_store::{PrimitiveStore, GpuBlock16, GpuBlock32, GpuBlock64, GpuBlock128}; +use profiler::FrameProfileCounters; +use renderer::BlendMode; +use resource_cache::ResourceCache; +use scroll_tree::ScrollTree; +use std::cmp; +use std::collections::{HashMap}; +use std::{i32, f32}; +use std::mem; +use std::hash::{BuildHasherDefault}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::usize; +use texture_cache::TexturePage; +use util::{self, rect_from_points, rect_from_points_f}; +use util::{TransformedRect, TransformedRectKind, subtract_rect, pack_as_float}; +use webrender_traits::{ColorF, FontKey, ImageKey, ImageRendering, MixBlendMode}; +use webrender_traits::{BorderDisplayItem, BorderSide, BorderStyle, YuvColorSpace}; +use webrender_traits::{AuxiliaryLists, ItemRange, BoxShadowClipMode, ClipRegion}; +use webrender_traits::{PipelineId, ScrollLayerId, WebGLContextId, FontRenderMode}; +use webrender_traits::{DeviceIntRect, DeviceIntPoint, DeviceIntSize, DeviceIntLength, device_length}; +use webrender_traits::{DeviceUintSize, DeviceUintPoint}; +use webrender_traits::{LayerRect, LayerPoint, LayerSize}; +use webrender_traits::{LayerToScrollTransform, LayerToWorldTransform, WorldToLayerTransform}; +use webrender_traits::{WorldPoint4D, ScrollLayerPixel, as_scroll_parent_rect}; + +// Special sentinel value recognized by the shader. It is considered to be +// a dummy task that doesn't mask out anything. +const OPAQUE_TASK_INDEX: RenderTaskIndex = RenderTaskIndex(i32::MAX as usize); + +const FLOATS_PER_RENDER_TASK_INFO: usize = 12; + +pub type AuxiliaryListsMap = HashMap>; + +trait AlphaBatchHelpers { + fn get_batch_kind(&self, metadata: &PrimitiveMetadata) -> AlphaBatchKind; + fn get_color_textures(&self, metadata: &PrimitiveMetadata) -> [SourceTexture; 3]; + fn get_blend_mode(&self, needs_blending: bool, metadata: &PrimitiveMetadata) -> BlendMode; + fn prim_affects_tile(&self, + prim_index: PrimitiveIndex, + tile_rect: &DeviceIntRect, + transform: &LayerToWorldTransform, + device_pixel_ratio: f32) -> bool; + fn add_prim_to_batch(&self, + prim_index: PrimitiveIndex, + batch: &mut PrimitiveBatch, + layer_index: StackingContextIndex, + task_index: RenderTaskIndex, + render_tasks: &RenderTaskCollection, + pass_index: RenderPassIndex, + z_sort_index: i32); +} + +impl AlphaBatchHelpers for PrimitiveStore { + fn get_batch_kind(&self, metadata: &PrimitiveMetadata) -> AlphaBatchKind { + let batch_kind = match metadata.prim_kind { + PrimitiveKind::Border => AlphaBatchKind::Border, + PrimitiveKind::BoxShadow => AlphaBatchKind::BoxShadow, + PrimitiveKind::Image => AlphaBatchKind::Image, + PrimitiveKind::YuvImage => AlphaBatchKind::YuvImage, + PrimitiveKind::Rectangle => AlphaBatchKind::Rectangle, + PrimitiveKind::RadialGradient => AlphaBatchKind::RadialGradient, + PrimitiveKind::TextRun => { + let text_run_cpu = &self.cpu_text_runs[metadata.cpu_prim_index.0]; + if text_run_cpu.blur_radius.0 == 0 { + AlphaBatchKind::TextRun + } else { + // Select a generic primitive shader that can blit the + // results of the cached text blur to the framebuffer, + // applying tile clipping etc. + AlphaBatchKind::CacheImage + } + } + PrimitiveKind::Gradient => { + let gradient = &self.cpu_gradients[metadata.cpu_prim_index.0]; + match gradient.kind { + GradientType::Horizontal | GradientType::Vertical => { + AlphaBatchKind::AlignedGradient + } + GradientType::Rotated => { + AlphaBatchKind::AngleGradient + } + } + } + }; + + batch_kind + } + + fn get_color_textures(&self, metadata: &PrimitiveMetadata) -> [SourceTexture; 3] { + let invalid = SourceTexture::Invalid; + match metadata.prim_kind { + PrimitiveKind::Border | + PrimitiveKind::BoxShadow | + PrimitiveKind::Rectangle | + PrimitiveKind::Gradient | + PrimitiveKind::RadialGradient => [invalid; 3], + PrimitiveKind::Image => { + let image_cpu = &self.cpu_images[metadata.cpu_prim_index.0]; + [image_cpu.color_texture_id, invalid, invalid] + } + PrimitiveKind::YuvImage => { + let image_cpu = &self.cpu_yuv_images[metadata.cpu_prim_index.0]; + [image_cpu.y_texture_id, image_cpu.u_texture_id, image_cpu.v_texture_id] + } + PrimitiveKind::TextRun => { + let text_run_cpu = &self.cpu_text_runs[metadata.cpu_prim_index.0]; + [text_run_cpu.color_texture_id, invalid, invalid] + } + } + } + + fn get_blend_mode(&self, needs_blending: bool, metadata: &PrimitiveMetadata) -> BlendMode { + match metadata.prim_kind { + PrimitiveKind::TextRun => { + let text_run_cpu = &self.cpu_text_runs[metadata.cpu_prim_index.0]; + if text_run_cpu.blur_radius.0 == 0 { + match text_run_cpu.render_mode { + FontRenderMode::Subpixel => BlendMode::Subpixel(text_run_cpu.color), + FontRenderMode::Alpha | FontRenderMode::Mono => BlendMode::Alpha, + } + } else { + // Text runs drawn to blur never get drawn with subpixel AA. + BlendMode::Alpha + } + } + _ => { + if needs_blending { + BlendMode::Alpha + } else { + BlendMode::None + } + } + } + } + + // Optional narrow phase intersection test, depending on primitive type. + fn prim_affects_tile(&self, + prim_index: PrimitiveIndex, + tile_rect: &DeviceIntRect, + transform: &LayerToWorldTransform, + device_pixel_ratio: f32) -> bool { + let metadata = self.get_metadata(prim_index); + match metadata.prim_kind { + PrimitiveKind::Rectangle | + PrimitiveKind::TextRun | + PrimitiveKind::Image | + PrimitiveKind::YuvImage | + PrimitiveKind::Gradient | + PrimitiveKind::RadialGradient | + PrimitiveKind::BoxShadow => true, + PrimitiveKind::Border => { + let border = &self.cpu_borders[metadata.cpu_prim_index.0]; + let inner_rect = TransformedRect::new(&border.inner_rect, + transform, + device_pixel_ratio); + + !inner_rect.bounding_rect.contains_rect(tile_rect) + } + } + } + + fn add_prim_to_batch(&self, + prim_index: PrimitiveIndex, + batch: &mut PrimitiveBatch, + layer_index: StackingContextIndex, + task_index: RenderTaskIndex, + render_tasks: &RenderTaskCollection, + child_pass_index: RenderPassIndex, + z_sort_index: i32) { + let metadata = self.get_metadata(prim_index); + let layer_index = layer_index.0 as i32; + let global_prim_id = prim_index.0 as i32; + let prim_address = metadata.gpu_prim_index; + let clip_task_index = match metadata.clip_task { + Some(ref clip_task) => { + render_tasks.get_task_index(&clip_task.id, child_pass_index) + } + None => { + OPAQUE_TASK_INDEX + } + }; + let task_index = task_index.0 as i32; + let clip_task_index = clip_task_index.0 as i32; + + match &mut batch.data { + &mut PrimitiveBatchData::Blend(..) | + &mut PrimitiveBatchData::Composite(..) => unreachable!(), + + &mut PrimitiveBatchData::Rectangles(ref mut data) => { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: 0, + user_data: [0, 0], + z_sort_index: z_sort_index, + }); + } + &mut PrimitiveBatchData::TextRun(ref mut data) => { + let text_cpu = &self.cpu_text_runs[metadata.cpu_prim_index.0]; + + for glyph_index in 0..metadata.gpu_data_count { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: metadata.gpu_data_address.0 + glyph_index, + user_data: [ text_cpu.resource_address.0 + glyph_index, 0 ], + z_sort_index: z_sort_index, + }); + } + } + &mut PrimitiveBatchData::Image(ref mut data) => { + let image_cpu = &self.cpu_images[metadata.cpu_prim_index.0]; + + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: 0, + user_data: [ image_cpu.resource_address.0, 0 ], + z_sort_index: z_sort_index, + }); + } + &mut PrimitiveBatchData::YuvImage(ref mut data) => { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: 0, + user_data: [ 0, 0 ], + z_sort_index: z_sort_index, + }); + } + &mut PrimitiveBatchData::Borders(ref mut data) => { + for border_segment in 0..8 { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: border_segment, + user_data: [ 0, 0 ], + z_sort_index: z_sort_index, + }); + } + } + &mut PrimitiveBatchData::AlignedGradient(ref mut data) => { + for part_index in 0..(metadata.gpu_data_count - 1) { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: metadata.gpu_data_address.0 + part_index, + user_data: [ 0, 0 ], + z_sort_index: z_sort_index, + }); + } + } + &mut PrimitiveBatchData::AngleGradient(ref mut data) => { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: metadata.gpu_data_address.0, + user_data: [ metadata.gpu_data_count, 0 ], + z_sort_index: z_sort_index, + }); + } + &mut PrimitiveBatchData::RadialGradient(ref mut data) => { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: metadata.gpu_data_address.0, + user_data: [ metadata.gpu_data_count, 0 ], + z_sort_index: z_sort_index, + }); + } + &mut PrimitiveBatchData::CacheImage(ref mut data) => { + // Find the render task index for the render task + // that this primitive depends on. Pass it to the + // shader so that it can sample from the cache texture + // at the correct location. + let cache_task_id = &metadata.render_task.as_ref().unwrap().id; + let cache_task_index = render_tasks.get_task_index(cache_task_id, + child_pass_index); + + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: 0, + user_data: [ cache_task_index.0 as i32, 0 ], + z_sort_index: z_sort_index, + }); + } + &mut PrimitiveBatchData::BoxShadow(ref mut data) => { + let cache_task_id = &metadata.render_task.as_ref().unwrap().id; + let cache_task_index = render_tasks.get_task_index(cache_task_id, + child_pass_index); + + for rect_index in 0..metadata.gpu_data_count { + data.push(PrimitiveInstance { + task_index: task_index, + clip_task_index: clip_task_index, + layer_index: layer_index, + global_prim_id: global_prim_id, + prim_address: prim_address, + sub_index: metadata.gpu_data_address.0 + rect_index, + user_data: [ cache_task_index.0 as i32, 0 ], + z_sort_index: z_sort_index, + }); + } + } + } + } +} + +#[derive(Debug)] +struct ScrollbarPrimitive { + scroll_layer_id: ScrollLayerId, + prim_index: PrimitiveIndex, + border_radius: f32, +} + +enum PrimitiveRunCmd { + PushStackingContext(StackingContextIndex), + PrimitiveRun(PrimitiveIndex, usize), + PopStackingContext, +} + +#[derive(Debug, Copy, Clone)] +pub enum PrimitiveFlags { + None, + Scrollbar(ScrollLayerId, f32) +} + +// TODO(gw): I've had to make several of these types below public +// with the changes for text-shadow. The proper solution +// is to split the render task and render target code into +// its own module. However, I'm avoiding that for now since +// this PR is large enough already, and other people are working +// on PRs that make use of render tasks. + +#[derive(Debug, Copy, Clone)] +pub struct RenderTargetIndex(usize); + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +struct RenderPassIndex(isize); + +#[derive(Debug, Copy, Clone, Eq, Hash, PartialEq)] +pub struct RenderTaskIndex(usize); + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum MaskCacheKey { + Primitive(PrimitiveIndex), + StackingContext(StackingContextIndex), +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum RenderTaskKey { + /// Draw this primitive to a cache target. + CachePrimitive(PrimitiveCacheKey), + /// Draw the tile alpha mask for a primitive. + CacheMask(MaskCacheKey), + /// Apply a vertical blur pass of given radius for this primitive. + VerticalBlur(i32, PrimitiveIndex), + /// Apply a horizontal blur pass of given radius for this primitive. + HorizontalBlur(i32, PrimitiveIndex), +} + +#[derive(Debug, Copy, Clone)] +pub enum RenderTaskId { + Static(RenderTaskIndex), + Dynamic(RenderTaskKey), +} + +struct DynamicTaskInfo { + index: RenderTaskIndex, + rect: DeviceIntRect, +} + +struct RenderTaskCollection { + render_task_data: Vec, + dynamic_tasks: HashMap<(RenderTaskKey, RenderPassIndex), DynamicTaskInfo, BuildHasherDefault>, +} + +impl RenderTaskCollection { + fn new(static_render_task_count: usize) -> RenderTaskCollection { + RenderTaskCollection { + render_task_data: vec![RenderTaskData::empty(); static_render_task_count], + dynamic_tasks: HashMap::with_hasher(Default::default()), + } + } + + fn add(&mut self, task: &RenderTask, pass: RenderPassIndex) -> RenderTaskIndex { + match task.id { + RenderTaskId::Static(index) => { + self.render_task_data[index.0] = task.write_task_data(); + index + } + RenderTaskId::Dynamic(key) => { + let index = RenderTaskIndex(self.render_task_data.len()); + let key = (key, pass); + debug_assert!(self.dynamic_tasks.contains_key(&key) == false); + self.dynamic_tasks.insert(key, DynamicTaskInfo { + index: index, + rect: match task.location { + RenderTaskLocation::Fixed(rect) => rect, + RenderTaskLocation::Dynamic(Some((origin, _)), size) => DeviceIntRect::new(origin, size), + RenderTaskLocation::Dynamic(None, _) => panic!("Expect the task to be already allocated here"), + }, + }); + self.render_task_data.push(task.write_task_data()); + index + } + } + } + + fn get_dynamic_allocation(&self, pass_index: RenderPassIndex, key: RenderTaskKey) -> Option<&DeviceIntRect> { + let key = (key, pass_index); + self.dynamic_tasks.get(&key) + .map(|task| &task.rect) + } + + fn get_static_task_index(&self, id: &RenderTaskId) -> RenderTaskIndex { + match id { + &RenderTaskId::Static(index) => index, + &RenderTaskId::Dynamic(..) => panic!("This is a bug - expected a static render task!"), + } + } + + fn get_task_index(&self, id: &RenderTaskId, pass_index: RenderPassIndex) -> RenderTaskIndex { + match id { + &RenderTaskId::Static(index) => index, + &RenderTaskId::Dynamic(key) => { + self.dynamic_tasks[&(key, pass_index)].index + } + } + } +} + +#[derive(Debug, Clone)] +pub struct RenderTaskData { + data: [f32; FLOATS_PER_RENDER_TASK_INFO], +} + +impl RenderTaskData { + fn empty() -> RenderTaskData { + RenderTaskData { + data: unsafe { mem::uninitialized() } + } + } +} + +impl Default for RenderTaskData { + fn default() -> RenderTaskData { + RenderTaskData { + data: unsafe { mem::uninitialized() }, + } + } +} + +impl Default for PrimitiveGeometry { + fn default() -> PrimitiveGeometry { + PrimitiveGeometry { + local_rect: unsafe { mem::uninitialized() }, + local_clip_rect: unsafe { mem::uninitialized() }, + } + } +} + +struct AlphaBatchTask { + task_id: RenderTaskId, + opaque_items: Vec, + alpha_items: Vec, +} + +/// Encapsulates the logic of building batches for items that are blended. +pub struct AlphaBatcher { + pub alpha_batches: Vec, + pub opaque_batches: Vec, + tasks: Vec, +} + +impl AlphaBatcher { + fn new() -> AlphaBatcher { + AlphaBatcher { + alpha_batches: Vec::new(), + opaque_batches: Vec::new(), + tasks: Vec::new(), + } + } + + fn add_task(&mut self, task: AlphaBatchTask) { + self.tasks.push(task); + } + + fn build(&mut self, + ctx: &RenderTargetContext, + render_tasks: &RenderTaskCollection, + child_pass_index: RenderPassIndex) { + let mut alpha_batches: Vec = vec![]; + let mut opaque_batches: Vec = vec![]; + + for task in &mut self.tasks { + let task_index = render_tasks.get_static_task_index(&task.task_id); + let mut existing_alpha_batch_index = 0; + let mut existing_opaque_batch_index = 0; + + for item in &task.alpha_items { + let batch_key = match item { + &AlphaRenderItem::Composite(..) => { + AlphaBatchKey::composite() + } + &AlphaRenderItem::Blend(..) => { + AlphaBatchKey::blend() + } + &AlphaRenderItem::Primitive(sc_index, prim_index, _) => { + // See if this task fits into the tile UBO + let layer = &ctx.layer_store[sc_index.0]; + let prim_metadata = ctx.prim_store.get_metadata(prim_index); + let transform_kind = layer.xf_rect.as_ref().unwrap().kind; + let needs_clipping = prim_metadata.clip_task.is_some(); + let needs_blending = transform_kind == TransformedRectKind::Complex || + !prim_metadata.is_opaque || + needs_clipping; + let blend_mode = ctx.prim_store.get_blend_mode(needs_blending, prim_metadata); + let needs_clipping_flag = if needs_clipping { + NEEDS_CLIPPING + } else { + AlphaBatchKeyFlags::empty() + }; + let flags = match transform_kind { + TransformedRectKind::AxisAligned => AXIS_ALIGNED | needs_clipping_flag, + _ => needs_clipping_flag, + }; + let batch_kind = ctx.prim_store.get_batch_kind(prim_metadata); + + let textures = BatchTextures { + colors: ctx.prim_store.get_color_textures(prim_metadata), + }; + + AlphaBatchKey::primitive(batch_kind, + flags, + blend_mode, + textures) + } + }; + + while existing_alpha_batch_index < alpha_batches.len() && + !alpha_batches[existing_alpha_batch_index].key.is_compatible_with(&batch_key) { + existing_alpha_batch_index += 1 + } + + if existing_alpha_batch_index == alpha_batches.len() { + let new_batch = match item { + &AlphaRenderItem::Composite(..) => { + PrimitiveBatch::composite() + } + &AlphaRenderItem::Blend(..) => { + PrimitiveBatch::blend() + } + &AlphaRenderItem::Primitive(_, prim_index, _) => { + // See if this task fits into the tile UBO + let prim_metadata = ctx.prim_store.get_metadata(prim_index); + let batch_kind = ctx.prim_store.get_batch_kind(prim_metadata); + PrimitiveBatch::new(batch_kind, batch_key) + } + }; + alpha_batches.push(new_batch) + } + + let batch = &mut alpha_batches[existing_alpha_batch_index]; + match item { + &AlphaRenderItem::Composite(src0_id, src1_id, info, z) => { + let ok = batch.pack_composite(render_tasks.get_static_task_index(&src0_id), + render_tasks.get_static_task_index(&src1_id), + render_tasks.get_static_task_index(&task.task_id), + info, + z); + debug_assert!(ok) + } + &AlphaRenderItem::Blend(src_id, info, z) => { + let ok = batch.pack_blend(render_tasks.get_static_task_index(&src_id), + render_tasks.get_static_task_index(&task.task_id), + info, + z); + debug_assert!(ok) + } + &AlphaRenderItem::Primitive(sc_index, prim_index, z) => { + ctx.prim_store.add_prim_to_batch(prim_index, + batch, + sc_index, + task_index, + render_tasks, + child_pass_index, + z); + } + } + } + + for item in task.opaque_items.iter().rev() { + let batch_key = match item { + &AlphaRenderItem::Composite(..) => unreachable!(), + &AlphaRenderItem::Blend(..) => unreachable!(), + &AlphaRenderItem::Primitive(sc_index, prim_index, _) => { + // See if this task fits into the tile UBO + let layer = &ctx.layer_store[sc_index.0]; + let prim_metadata = ctx.prim_store.get_metadata(prim_index); + let transform_kind = layer.xf_rect.as_ref().unwrap().kind; + let needs_clipping = prim_metadata.clip_task.is_some(); + let needs_blending = transform_kind == TransformedRectKind::Complex || + !prim_metadata.is_opaque || + needs_clipping; + let blend_mode = ctx.prim_store.get_blend_mode(needs_blending, prim_metadata); + let needs_clipping_flag = if needs_clipping { + NEEDS_CLIPPING + } else { + AlphaBatchKeyFlags::empty() + }; + let flags = match transform_kind { + TransformedRectKind::AxisAligned => AXIS_ALIGNED | needs_clipping_flag, + _ => needs_clipping_flag, + }; + let batch_kind = ctx.prim_store.get_batch_kind(prim_metadata); + + let textures = BatchTextures { + colors: ctx.prim_store.get_color_textures(prim_metadata), + }; + + AlphaBatchKey::primitive(batch_kind, + flags, + blend_mode, + textures) + } + }; + + while existing_opaque_batch_index < opaque_batches.len() && + !opaque_batches[existing_opaque_batch_index].key.is_compatible_with(&batch_key) { + existing_opaque_batch_index += 1 + } + + if existing_opaque_batch_index == opaque_batches.len() { + let new_batch = match item { + &AlphaRenderItem::Composite(..) => unreachable!(), + &AlphaRenderItem::Blend(..) => unreachable!(), + &AlphaRenderItem::Primitive(_, prim_index, _) => { + // See if this task fits into the tile UBO + let prim_metadata = ctx.prim_store.get_metadata(prim_index); + let batch_kind = ctx.prim_store.get_batch_kind(prim_metadata); + PrimitiveBatch::new(batch_kind, batch_key) + } + }; + opaque_batches.push(new_batch) + } + + let batch = &mut opaque_batches[existing_opaque_batch_index]; + match item { + &AlphaRenderItem::Composite(..) => unreachable!(), + &AlphaRenderItem::Blend(..) => unreachable!(), + &AlphaRenderItem::Primitive(sc_index, prim_index, z) => { + ctx.prim_store.add_prim_to_batch(prim_index, + batch, + sc_index, + task_index, + render_tasks, + child_pass_index, + z); + } + } + } + } + + self.alpha_batches.extend(alpha_batches.into_iter()); + self.opaque_batches.extend(opaque_batches.into_iter()); + } +} + +/// Batcher managing draw calls into the clip mask (in the RT cache). +#[derive(Debug)] +pub struct ClipBatcher { + /// Rectangle draws fill up the rectangles with rounded corners. + pub rectangles: Vec, + /// Image draws apply the image masking. + pub images: HashMap>, +} + +impl ClipBatcher { + fn new() -> ClipBatcher { + ClipBatcher { + rectangles: Vec::new(), + images: HashMap::new(), + } + } + + fn add(&mut self, + task_index: RenderTaskIndex, + clips: &[(StackingContextIndex, MaskCacheInfo)], + resource_cache: &ResourceCache, + geometry_kind: MaskGeometryKind) { + + for &(layer_id, ref info) in clips.iter() { + let instance = CacheClipInstance { + task_id: task_index.0 as i32, + layer_index: layer_id.0 as i32, + address: GpuStoreAddress(0), + segment: 0, + }; + + for clip_index in 0..info.clip_range.item_count as usize { + let offset = info.clip_range.start.0 + ((CLIP_DATA_GPU_SIZE * clip_index) as i32); + match geometry_kind { + MaskGeometryKind::Default => { + self.rectangles.push(CacheClipInstance { + address: GpuStoreAddress(offset), + segment: MaskSegment::All as i32, + ..instance + }); + } + MaskGeometryKind::CornersOnly => { + self.rectangles.extend(&[ + CacheClipInstance { + address: GpuStoreAddress(offset), + segment: MaskSegment::Corner_TopLeft as i32, + ..instance + }, + CacheClipInstance { + address: GpuStoreAddress(offset), + segment: MaskSegment::Corner_TopRight as i32, + ..instance + }, + CacheClipInstance { + address: GpuStoreAddress(offset), + segment: MaskSegment::Corner_BottomLeft as i32, + ..instance + }, + CacheClipInstance { + address: GpuStoreAddress(offset), + segment: MaskSegment::Corner_BottomRight as i32, + ..instance + }, + ]); + } + } + } + + if let Some((ref mask, address)) = info.image { + let cache_item = resource_cache.get_cached_image(mask.image, ImageRendering::Auto); + self.images.entry(cache_item.texture_id) + .or_insert(Vec::new()) + .push(CacheClipInstance { + address: address, + ..instance + }) + } + } + } +} + + +struct CompileTileContext<'a> { + layer_store: &'a [StackingContext], + prim_store: &'a PrimitiveStore, + render_task_id_counter: AtomicUsize, +} + +struct RenderTargetContext<'a> { + layer_store: &'a [StackingContext], + prim_store: &'a PrimitiveStore, + resource_cache: &'a ResourceCache, +} + +/// A render target represents a number of rendering operations on a surface. +pub struct RenderTarget { + pub alpha_batcher: AlphaBatcher, + pub clip_batcher: ClipBatcher, + pub box_shadow_cache_prims: Vec, + // List of text runs to be cached to this render target. + // TODO(gw): For now, assume that these all come from + // the same source texture id. This is almost + // always true except for pathological test + // cases with more than 4k x 4k of unique + // glyphs visible. Once the future glyph / texture + // cache changes land, this restriction will + // be removed anyway. + pub text_run_cache_prims: Vec, + pub text_run_textures: BatchTextures, + // List of blur operations to apply for this render target. + pub vertical_blurs: Vec, + pub horizontal_blurs: Vec, + page_allocator: TexturePage, +} + +impl RenderTarget { + fn new(size: DeviceUintSize) -> RenderTarget { + RenderTarget { + alpha_batcher: AlphaBatcher::new(), + clip_batcher: ClipBatcher::new(), + box_shadow_cache_prims: Vec::new(), + text_run_cache_prims: Vec::new(), + text_run_textures: BatchTextures::no_texture(), + vertical_blurs: Vec::new(), + horizontal_blurs: Vec::new(), + page_allocator: TexturePage::new(CacheTextureId(0), size), + } + } + + fn build(&mut self, + ctx: &RenderTargetContext, + render_tasks: &mut RenderTaskCollection, + child_pass_index: RenderPassIndex) { + self.alpha_batcher.build(ctx, + render_tasks, + child_pass_index); + } + + fn add_task(&mut self, + task: RenderTask, + ctx: &RenderTargetContext, + render_tasks: &RenderTaskCollection, + pass_index: RenderPassIndex) { + match task.kind { + RenderTaskKind::Alpha(info) => { + self.alpha_batcher.add_task(AlphaBatchTask { + task_id: task.id, + opaque_items: info.opaque_items, + alpha_items: info.alpha_items, + }); + } + RenderTaskKind::VerticalBlur(_, prim_index) => { + // Find the child render task that we are applying + // a vertical blur on. + // TODO(gw): Consider a simpler way for render tasks to find + // their child tasks than having to construct the + // correct id here. + let child_pass_index = RenderPassIndex(pass_index.0 - 1); + let task_key = RenderTaskKey::CachePrimitive(PrimitiveCacheKey::TextShadow(prim_index)); + let src_id = RenderTaskId::Dynamic(task_key); + self.vertical_blurs.push(BlurCommand { + task_id: render_tasks.get_task_index(&task.id, pass_index).0 as i32, + src_task_id: render_tasks.get_task_index(&src_id, child_pass_index).0 as i32, + blur_direction: BlurDirection::Vertical as i32, + padding: 0, + }); + } + RenderTaskKind::HorizontalBlur(blur_radius, prim_index) => { + // Find the child render task that we are applying + // a horizontal blur on. + let child_pass_index = RenderPassIndex(pass_index.0 - 1); + let src_id = RenderTaskId::Dynamic(RenderTaskKey::VerticalBlur(blur_radius.0, prim_index)); + self.horizontal_blurs.push(BlurCommand { + task_id: render_tasks.get_task_index(&task.id, pass_index).0 as i32, + src_task_id: render_tasks.get_task_index(&src_id, child_pass_index).0 as i32, + blur_direction: BlurDirection::Horizontal as i32, + padding: 0, + }); + } + RenderTaskKind::CachePrimitive(prim_index) => { + let prim_metadata = ctx.prim_store.get_metadata(prim_index); + + match prim_metadata.prim_kind { + PrimitiveKind::BoxShadow => { + self.box_shadow_cache_prims.push(PrimitiveInstance { + global_prim_id: prim_index.0 as i32, + prim_address: prim_metadata.gpu_prim_index, + task_index: render_tasks.get_task_index(&task.id, pass_index).0 as i32, + clip_task_index: 0, + layer_index: 0, + sub_index: 0, + user_data: [0; 2], + z_sort_index: 0, // z is disabled for rendering cache primitives + }); + } + PrimitiveKind::TextRun => { + let text = &ctx.prim_store.cpu_text_runs[prim_metadata.cpu_prim_index.0]; + // We only cache text runs with a text-shadow (for now). + debug_assert!(text.blur_radius.0 != 0); + + // TODO(gw): This should always be fine for now, since the texture + // atlas grows to 4k. However, it won't be a problem soon, once + // we switch the texture atlas to use texture layers! + let textures = BatchTextures { + colors: ctx.prim_store.get_color_textures(prim_metadata), + }; + + debug_assert!(textures.colors[0] != SourceTexture::Invalid); + debug_assert!(self.text_run_textures.colors[0] == SourceTexture::Invalid || + self.text_run_textures.colors[0] == textures.colors[0]); + self.text_run_textures = textures; + + for glyph_index in 0..prim_metadata.gpu_data_count { + self.text_run_cache_prims.push(PrimitiveInstance { + global_prim_id: prim_index.0 as i32, + prim_address: prim_metadata.gpu_prim_index, + task_index: render_tasks.get_task_index(&task.id, pass_index).0 as i32, + clip_task_index: 0, + layer_index: 0, + sub_index: prim_metadata.gpu_data_address.0 + glyph_index, + user_data: [ text.resource_address.0 + glyph_index, 0], + z_sort_index: 0, // z is disabled for rendering cache primitives + }); + } + } + _ => { + // No other primitives make use of primitive caching yet! + unreachable!() + } + } + } + RenderTaskKind::CacheMask(ref task_info) => { + let task_index = render_tasks.get_task_index(&task.id, pass_index); + self.clip_batcher.add(task_index, + &task_info.clips, + &ctx.resource_cache, + task_info.geometry_kind); + } + } + } +} + +/// A render pass represents a set of rendering operations that don't depend on one +/// another. +/// +/// A render pass can have several render targets if there wasn't enough space in one +/// target to do all of the rendering for that pass. +pub struct RenderPass { + pass_index: RenderPassIndex, + pub is_framebuffer: bool, + tasks: Vec, + pub targets: Vec, + size: DeviceUintSize, +} + +impl RenderPass { + fn new(pass_index: isize, + is_framebuffer: bool, + size: DeviceUintSize) -> RenderPass { + RenderPass { + pass_index: RenderPassIndex(pass_index), + is_framebuffer: is_framebuffer, + targets: vec![ RenderTarget::new(size) ], + tasks: vec![], + size: size, + } + } + + fn add_render_task(&mut self, task: RenderTask) { + self.tasks.push(task); + } + + fn allocate_target(&mut self, alloc_size: DeviceUintSize) -> DeviceUintPoint { + let existing_origin = self.targets + .last_mut() + .unwrap() + .page_allocator + .allocate(&alloc_size); + match existing_origin { + Some(origin) => origin, + None => { + let mut new_target = RenderTarget::new(self.size); + let origin = new_target.page_allocator + .allocate(&alloc_size) + .expect(&format!("Each render task must allocate <= size of one target! ({:?})", alloc_size)); + self.targets.push(new_target); + origin + } + } + } + + + fn build(&mut self, + ctx: &RenderTargetContext, + render_tasks: &mut RenderTaskCollection) { + // Step through each task, adding to batches as appropriate. + let tasks = mem::replace(&mut self.tasks, Vec::new()); + for mut task in tasks { + // Find a target to assign this task to, or create a new + // one if required. + match task.location { + RenderTaskLocation::Fixed(..) => {} + RenderTaskLocation::Dynamic(ref mut origin, ref size) => { + // See if this task is a duplicate from another tile. + // If so, just skip adding it! + match task.id { + RenderTaskId::Static(..) => {} + RenderTaskId::Dynamic(key) => { + // Look up cache primitive key in the render + // task data array. If a matching key exists + // (that is in this pass) there is no need + // to draw it again! + if let Some(rect) = render_tasks.get_dynamic_allocation(self.pass_index, key) { + debug_assert_eq!(rect.size, *size); + continue; + } + } + } + + let alloc_size = DeviceUintSize::new(size.width as u32, size.height as u32); + let alloc_origin = self.allocate_target(alloc_size); + + *origin = Some((DeviceIntPoint::new(alloc_origin.x as i32, + alloc_origin.y as i32), + RenderTargetIndex(self.targets.len() - 1))); + } + } + + render_tasks.add(&task, self.pass_index); + self.targets.last_mut().unwrap().add_task(task, + ctx, + render_tasks, + self.pass_index); + } + + for target in &mut self.targets { + let child_pass_index = RenderPassIndex(self.pass_index.0 - 1); + target.build(ctx, render_tasks, child_pass_index); + } + } +} + +#[derive(Debug, Clone)] +pub enum RenderTaskLocation { + Fixed(DeviceIntRect), + Dynamic(Option<(DeviceIntPoint, RenderTargetIndex)>, DeviceIntSize), +} + +#[derive(Debug, Clone)] +enum AlphaRenderItem { + Primitive(StackingContextIndex, PrimitiveIndex, i32), + Blend(RenderTaskId, LowLevelFilterOp, i32), + Composite(RenderTaskId, RenderTaskId, MixBlendMode, i32), +} + +#[derive(Debug, Clone)] +pub struct AlphaRenderTask { + actual_rect: DeviceIntRect, + opaque_items: Vec, + alpha_items: Vec, +} + +#[derive(Debug, Copy, Clone)] +#[repr(C)] +enum MaskSegment { + // This must match the SEGMENT_ values + // in clip_shared.glsl! + All = 0, + Corner_TopLeft, + Corner_TopRight, + Corner_BottomLeft, + Corner_BottomRight, +} + +#[derive(Debug, Copy, Clone)] +#[repr(C)] +enum MaskGeometryKind { + Default, // Draw the entire rect + CornersOnly, // Draw the corners (simple axis aligned mask) + // TODO(gw): Add more types here (e.g. 4 rectangles outside the inner rect) +} + +#[derive(Debug, Clone)] +pub struct CacheMaskTask { + actual_rect: DeviceIntRect, + inner_rect: DeviceIntRect, + clips: Vec<(StackingContextIndex, MaskCacheInfo)>, + geometry_kind: MaskGeometryKind, +} + +#[derive(Debug)] +enum MaskResult { + /// The mask is completely outside the region + Outside, + /// The mask is inside and needs to be processed + Inside(RenderTask), +} + +#[derive(Debug, Clone)] +pub enum RenderTaskKind { + Alpha(AlphaRenderTask), + CachePrimitive(PrimitiveIndex), + CacheMask(CacheMaskTask), + VerticalBlur(DeviceIntLength, PrimitiveIndex), + HorizontalBlur(DeviceIntLength, PrimitiveIndex), +} + +// TODO(gw): Consider storing these in a separate array and having +// primitives hold indices - this could avoid cloning +// when adding them as child tasks to tiles. +#[derive(Debug, Clone)] +pub struct RenderTask { + pub id: RenderTaskId, + pub location: RenderTaskLocation, + pub children: Vec, + pub kind: RenderTaskKind, +} + +impl RenderTask { + fn new_alpha_batch(actual_rect: DeviceIntRect, ctx: &CompileTileContext) -> RenderTask { + let task_index = ctx.render_task_id_counter.fetch_add(1, Ordering::Relaxed); + + RenderTask { + id: RenderTaskId::Static(RenderTaskIndex(task_index)), + children: Vec::new(), + location: RenderTaskLocation::Dynamic(None, actual_rect.size), + kind: RenderTaskKind::Alpha(AlphaRenderTask { + actual_rect: actual_rect, + alpha_items: Vec::new(), + opaque_items: Vec::new(), + }), + } + } + + pub fn new_prim_cache(key: PrimitiveCacheKey, + size: DeviceIntSize, + prim_index: PrimitiveIndex) -> RenderTask { + RenderTask { + id: RenderTaskId::Dynamic(RenderTaskKey::CachePrimitive(key)), + children: Vec::new(), + location: RenderTaskLocation::Dynamic(None, size), + kind: RenderTaskKind::CachePrimitive(prim_index), + } + } + + fn new_mask(actual_rect: DeviceIntRect, + mask_key: MaskCacheKey, + clips: &[(StackingContextIndex, MaskCacheInfo)], + layers: &[StackingContext]) + -> MaskResult { + if clips.is_empty() { + return MaskResult::Outside; + } + + // We scan through the clip stack and detect if our actual rectangle + // is in the intersection of all of all the outer bounds, + // and if it's completely inside the intersection of all of the inner bounds. + let result = clips.iter() + .fold(Some(actual_rect), |current, clip| { + current.and_then(|rect| rect.intersection(&clip.1.outer_rect)) + }); + + let task_rect = match result { + None => return MaskResult::Outside, + Some(rect) => rect, + }; + + let inner_rect = clips.iter() + .fold(Some(task_rect), |current, clip| { + current.and_then(|rect| rect.intersection(&clip.1.inner_rect)) + }); + + // TODO(gw): This optimization is very conservative for now. + // For now, only draw optimized geometry if it is + // a single aligned rect mask with rounded corners. + // In the future, we'll expand this to handle the + // more complex types of clip mask geometry. + let mut geometry_kind = MaskGeometryKind::Default; + + if inner_rect.is_some() && clips.len() == 1 { + let (sc_index, ref clip_info) = clips[0]; + + if clip_info.image.is_none() && + clip_info.clip_range.item_count == 1 && + layers[sc_index.0].xf_rect.as_ref().unwrap().kind == TransformedRectKind::AxisAligned { + geometry_kind = MaskGeometryKind::CornersOnly; + } + } + + let inner_rect = inner_rect.unwrap_or(DeviceIntRect::zero()); + + MaskResult::Inside(RenderTask { + id: RenderTaskId::Dynamic(RenderTaskKey::CacheMask(mask_key)), + children: Vec::new(), + location: RenderTaskLocation::Dynamic(None, task_rect.size), + kind: RenderTaskKind::CacheMask(CacheMaskTask { + actual_rect: task_rect, + inner_rect: inner_rect, + clips: clips.to_vec(), + geometry_kind: geometry_kind, + }), + }) + } + + // Construct a render task to apply a blur to a primitive. For now, + // this is only used for text runs, but we can probably extend this + // to handle general blurs to any render task in the future. + // The render task chain that is constructed looks like: + // + // PrimitiveCacheTask: Draw the text run. + // ^ + // | + // VerticalBlurTask: Apply the separable vertical blur to the primitive. + // ^ + // | + // HorizontalBlurTask: Apply the separable horizontal blur to the vertical blur. + // | + // +---- This is stored as the input task to the primitive shader. + // + pub fn new_blur(key: PrimitiveCacheKey, + size: DeviceIntSize, + blur_radius: DeviceIntLength, + prim_index: PrimitiveIndex) -> RenderTask { + let prim_cache_task = RenderTask::new_prim_cache(key, + size, + prim_index); + + let blur_target_size = size + DeviceIntSize::new(2 * blur_radius.0, + 2 * blur_radius.0); + + let blur_task_v = RenderTask { + id: RenderTaskId::Dynamic(RenderTaskKey::VerticalBlur(blur_radius.0, prim_index)), + children: vec![prim_cache_task], + location: RenderTaskLocation::Dynamic(None, blur_target_size), + kind: RenderTaskKind::VerticalBlur(blur_radius, prim_index), + }; + + let blur_task_h = RenderTask { + id: RenderTaskId::Dynamic(RenderTaskKey::HorizontalBlur(blur_radius.0, prim_index)), + children: vec![blur_task_v], + location: RenderTaskLocation::Dynamic(None, blur_target_size), + kind: RenderTaskKind::HorizontalBlur(blur_radius, prim_index), + }; + + blur_task_h + } + + fn as_alpha_batch<'a>(&'a mut self) -> &'a mut AlphaRenderTask { + match self.kind { + RenderTaskKind::Alpha(ref mut task) => task, + RenderTaskKind::CachePrimitive(..) | + RenderTaskKind::CacheMask(..) | + RenderTaskKind::VerticalBlur(..) | + RenderTaskKind::HorizontalBlur(..) => unreachable!(), + } + } + + // Write (up to) 8 floats of data specific to the type + // of render task that is provided to the GPU shaders + // via a vertex texture. + fn write_task_data(&self) -> RenderTaskData { + let (target_rect, target_index) = self.get_target_rect(); + match self.kind { + RenderTaskKind::Alpha(ref task) => { + debug_assert_eq!(target_rect.size, task.actual_rect.size); + RenderTaskData { + data: [ + task.actual_rect.origin.x as f32, + task.actual_rect.origin.y as f32, + target_rect.origin.x as f32, + target_rect.origin.y as f32, + task.actual_rect.size.width as f32, + task.actual_rect.size.height as f32, + target_index.0 as f32, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + } + } + RenderTaskKind::CachePrimitive(..) => { + RenderTaskData { + data: [ + target_rect.origin.x as f32, + target_rect.origin.y as f32, + target_rect.size.width as f32, + target_rect.size.height as f32, + target_index.0 as f32, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + } + } + RenderTaskKind::CacheMask(ref task) => { + debug_assert_eq!(target_rect.size, task.actual_rect.size); + RenderTaskData { + data: [ + target_rect.origin.x as f32, + target_rect.origin.y as f32, + (target_rect.origin.x + target_rect.size.width) as f32, + (target_rect.origin.y + target_rect.size.height) as f32, + task.actual_rect.origin.x as f32, + task.actual_rect.origin.y as f32, + target_index.0 as f32, + 0.0, + task.inner_rect.origin.x as f32, + task.inner_rect.origin.y as f32, + (task.inner_rect.origin.x + task.inner_rect.size.width) as f32, + (task.inner_rect.origin.y + task.inner_rect.size.height) as f32, + ], + } + } + RenderTaskKind::VerticalBlur(blur_radius, _) | + RenderTaskKind::HorizontalBlur(blur_radius, _) => { + RenderTaskData { + data: [ + target_rect.origin.x as f32, + target_rect.origin.y as f32, + target_rect.size.width as f32, + target_rect.size.height as f32, + target_index.0 as f32, + blur_radius.0 as f32, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ] + } + } + } + } + + fn get_target_rect(&self) -> (DeviceIntRect, RenderTargetIndex) { + match self.location { + RenderTaskLocation::Fixed(rect) => (rect, RenderTargetIndex(0)), + RenderTaskLocation::Dynamic(origin_and_target_index, size) => { + let (origin, target_index) = origin_and_target_index.expect("Should have been allocated by now!"); + (DeviceIntRect::new(origin, size), target_index) + } + } + } + + fn assign_to_passes(mut self, + pass_index: usize, + passes: &mut Vec) { + for child in self.children.drain(..) { + child.assign_to_passes(pass_index - 1, + passes); + } + + // Sanity check - can be relaxed if needed + match self.location { + RenderTaskLocation::Fixed(..) => { + debug_assert!(pass_index == passes.len() - 1); + } + RenderTaskLocation::Dynamic(..) => { + debug_assert!(pass_index < passes.len() - 1); + } + } + + let pass = &mut passes[pass_index]; + pass.add_render_task(self); + } + + fn max_depth(&self, + depth: usize, + max_depth: &mut usize) { + let depth = depth + 1; + *max_depth = cmp::max(*max_depth, depth); + for child in &self.children { + child.max_depth(depth, max_depth); + } + } +} + +pub const SCREEN_TILE_SIZE: i32 = 256; + +#[derive(Debug, Clone)] +pub struct DebugRect { + pub label: String, + pub color: ColorF, + pub rect: DeviceIntRect, +} + +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] +#[repr(u8)] +enum AlphaBatchKind { + Composite = 0, + Blend, + Rectangle, + TextRun, + Image, + YuvImage, + Border, + AlignedGradient, + AngleGradient, + RadialGradient, + BoxShadow, + CacheImage, +} + +bitflags! { + pub flags AlphaBatchKeyFlags: u8 { + const NEEDS_CLIPPING = 0b00000001, + const AXIS_ALIGNED = 0b00000010, + } +} + +impl AlphaBatchKeyFlags { + pub fn transform_kind(&self) -> TransformedRectKind { + if self.contains(AXIS_ALIGNED) { + TransformedRectKind::AxisAligned + } else { + TransformedRectKind::Complex + } + } + + pub fn needs_clipping(&self) -> bool { + self.contains(NEEDS_CLIPPING) + } +} + +#[derive(Copy, Clone, Debug)] +pub struct AlphaBatchKey { + kind: AlphaBatchKind, + pub flags: AlphaBatchKeyFlags, + pub blend_mode: BlendMode, + pub textures: BatchTextures, +} + +impl AlphaBatchKey { + fn blend() -> AlphaBatchKey { + AlphaBatchKey { + kind: AlphaBatchKind::Blend, + flags: AXIS_ALIGNED, + blend_mode: BlendMode::Alpha, + textures: BatchTextures::no_texture(), + } + } + + fn composite() -> AlphaBatchKey { + AlphaBatchKey { + kind: AlphaBatchKind::Composite, + flags: AXIS_ALIGNED, + blend_mode: BlendMode::Alpha, + textures: BatchTextures::no_texture(), + } + } + + fn primitive(kind: AlphaBatchKind, + flags: AlphaBatchKeyFlags, + blend_mode: BlendMode, + textures: BatchTextures) + -> AlphaBatchKey { + AlphaBatchKey { + kind: kind, + flags: flags, + blend_mode: blend_mode, + textures: textures, + } + } + + fn is_compatible_with(&self, other: &AlphaBatchKey) -> bool { + self.kind == other.kind && + self.flags == other.flags && + self.blend_mode == other.blend_mode && + textures_compatible(self.textures.colors[0], other.textures.colors[0]) && + textures_compatible(self.textures.colors[1], other.textures.colors[1]) && + textures_compatible(self.textures.colors[2], other.textures.colors[2]) + } +} + +#[repr(C)] +#[derive(Debug)] +pub enum BlurDirection { + Horizontal = 0, + Vertical, +} + +#[inline] +fn textures_compatible(t1: SourceTexture, t2: SourceTexture) -> bool { + t1 == SourceTexture::Invalid || t2 == SourceTexture::Invalid || t1 == t2 +} + +// All Packed Primitives below must be 16 byte aligned. +#[derive(Debug)] +pub struct BlurCommand { + task_id: i32, + src_task_id: i32, + blur_direction: i32, + padding: i32, +} + +/// A clipping primitive drawn into the clipping mask. +/// Could be an image or a rectangle, which defines the +/// way `address` is treated. +#[derive(Clone, Copy, Debug)] +pub struct CacheClipInstance { + task_id: i32, + layer_index: i32, + address: GpuStoreAddress, + segment: i32, +} + +#[derive(Debug, Clone)] +pub struct PrimitiveInstance { + global_prim_id: i32, + prim_address: GpuStoreAddress, + task_index: i32, + clip_task_index: i32, + layer_index: i32, + sub_index: i32, + z_sort_index: i32, + user_data: [i32; 2], +} + +impl PrimitiveInstance { + fn blend(src_task_id: i32, + target_task_id: i32, + op: i32, + amount: i32, + z_sort_index: i32) -> PrimitiveInstance { + PrimitiveInstance { + global_prim_id: -1, + prim_address: GpuStoreAddress(0), + task_index: target_task_id, + clip_task_index: -1, + layer_index: -1, + sub_index: op, + user_data: [src_task_id, amount], + z_sort_index: z_sort_index, + } + } + + fn composite(src_tasks_id: [i32; 2], + target_task_id: i32, + op: i32, + z_sort_index: i32) -> PrimitiveInstance { + PrimitiveInstance { + global_prim_id: -1, + prim_address: GpuStoreAddress(0), + task_index: target_task_id, + clip_task_index: -1, + layer_index: -1, + sub_index: op, + user_data: src_tasks_id, + z_sort_index: z_sort_index, + } + } +} + +#[derive(Debug)] +pub enum PrimitiveBatchData { + Rectangles(Vec), + TextRun(Vec), + Image(Vec), + YuvImage(Vec), + Borders(Vec), + AlignedGradient(Vec), + AngleGradient(Vec), + RadialGradient(Vec), + BoxShadow(Vec), + CacheImage(Vec), + Blend(Vec), + Composite(Vec), +} + +#[derive(Debug)] +pub struct PrimitiveBatch { + pub key: AlphaBatchKey, + pub data: PrimitiveBatchData, +} + +impl PrimitiveBatch { + fn blend() -> PrimitiveBatch { + PrimitiveBatch { + key: AlphaBatchKey::blend(), + data: PrimitiveBatchData::Blend(Vec::new()), + } + } + + fn composite() -> PrimitiveBatch { + PrimitiveBatch { + key: AlphaBatchKey::composite(), + data: PrimitiveBatchData::Composite(Vec::new()), + } + } + + fn pack_blend(&mut self, + src_rect_index: RenderTaskIndex, + target_rect_index: RenderTaskIndex, + filter: LowLevelFilterOp, + z_sort_index: i32) -> bool { + match &mut self.data { + &mut PrimitiveBatchData::Blend(ref mut ubo_data) => { + let (filter_mode, amount) = match filter { + LowLevelFilterOp::Blur(..) => (0, 0.0), + LowLevelFilterOp::Contrast(amount) => (1, amount.to_f32_px()), + LowLevelFilterOp::Grayscale(amount) => (2, amount.to_f32_px()), + LowLevelFilterOp::HueRotate(angle) => (3, (angle as f32) / ANGLE_FLOAT_TO_FIXED), + LowLevelFilterOp::Invert(amount) => (4, amount.to_f32_px()), + LowLevelFilterOp::Saturate(amount) => (5, amount.to_f32_px()), + LowLevelFilterOp::Sepia(amount) => (6, amount.to_f32_px()), + LowLevelFilterOp::Brightness(amount) => (7, amount.to_f32_px()), + LowLevelFilterOp::Opacity(amount) => (8, amount.to_f32_px()), + }; + + ubo_data.push(PrimitiveInstance::blend(src_rect_index.0 as i32, + target_rect_index.0 as i32, + filter_mode, + (amount * 65535.0).round() as i32, + z_sort_index)); + true + } + _ => false + } + } + + fn pack_composite(&mut self, + rect0_index: RenderTaskIndex, + rect1_index: RenderTaskIndex, + target_rect_index: RenderTaskIndex, + info: MixBlendMode, + z_sort_index: i32) -> bool { + match &mut self.data { + &mut PrimitiveBatchData::Composite(ref mut ubo_data) => { + ubo_data.push(PrimitiveInstance::composite([rect0_index.0 as i32, + rect1_index.0 as i32], + target_rect_index.0 as i32, + info as i32, + z_sort_index)); + true + } + _ => false + } + } + + fn new(batch_kind: AlphaBatchKind, + key: AlphaBatchKey) -> PrimitiveBatch { + let data = match batch_kind { + AlphaBatchKind::Rectangle => PrimitiveBatchData::Rectangles(Vec::new()), + AlphaBatchKind::TextRun => PrimitiveBatchData::TextRun(Vec::new()), + AlphaBatchKind::Image => PrimitiveBatchData::Image(Vec::new()), + AlphaBatchKind::YuvImage => PrimitiveBatchData::YuvImage(Vec::new()), + AlphaBatchKind::Border => PrimitiveBatchData::Borders(Vec::new()), + AlphaBatchKind::AlignedGradient => PrimitiveBatchData::AlignedGradient(Vec::new()), + AlphaBatchKind::AngleGradient => PrimitiveBatchData::AngleGradient(Vec::new()), + AlphaBatchKind::RadialGradient => PrimitiveBatchData::RadialGradient(Vec::new()), + AlphaBatchKind::BoxShadow => PrimitiveBatchData::BoxShadow(Vec::new()), + AlphaBatchKind::Blend | AlphaBatchKind::Composite => unreachable!(), + AlphaBatchKind::CacheImage => PrimitiveBatchData::CacheImage(Vec::new()), + }; + + PrimitiveBatch { + key: key, + data: data, + } + } +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub struct ScreenTileLayerIndex(usize); + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)] +pub struct StackingContextIndex(usize); + +#[derive(Debug)] +struct TileRange { + x0: i32, + y0: i32, + x1: i32, + y1: i32, +} + +struct StackingContext { + pipeline_id: PipelineId, + local_transform: LayerToScrollTransform, + local_rect: LayerRect, + scroll_layer_id: ScrollLayerId, + xf_rect: Option, + composite_kind: CompositeKind, + tile_range: Option, + clip_source: ClipSource, + clip_cache_info: Option, +} + +#[derive(Debug, Clone)] +pub struct PackedStackingContext { + transform: LayerToWorldTransform, + inv_transform: WorldToLayerTransform, + local_clip_rect: LayerRect, + screen_vertices: [WorldPoint4D; 4], +} + +impl Default for PackedStackingContext { + fn default() -> PackedStackingContext { + PackedStackingContext { + transform: LayerToWorldTransform::identity(), + inv_transform: WorldToLayerTransform::identity(), + local_clip_rect: LayerRect::zero(), + screen_vertices: [WorldPoint4D::zero(); 4], + } + } +} + +#[derive(Debug, Copy, Clone)] +enum CompositeKind { + None, + // Requires only a single texture as input (e.g. most filters) + Simple(LowLevelFilterOp), + // Requires two source textures (e.g. mix-blend-mode) + Complex(MixBlendMode), +} + +impl CompositeKind { + fn new(composition_ops: &[CompositionOp]) -> CompositeKind { + if composition_ops.is_empty() { + return CompositeKind::None; + } + + match composition_ops.first().unwrap() { + &CompositionOp::Filter(filter_op) => { + match filter_op { + LowLevelFilterOp::Opacity(opacity) => { + let opacityf = opacity.to_f32_px(); + if opacityf == 1.0 { + CompositeKind::None + } else { + CompositeKind::Simple(LowLevelFilterOp::Opacity(opacity)) + } + } + other_filter => CompositeKind::Simple(other_filter), + } + } + &CompositionOp::MixBlend(mode) => { + CompositeKind::Complex(mode) + } + } + } +} + +impl StackingContext { + fn is_visible(&self) -> bool { + self.xf_rect.is_some() + } + + fn can_contribute_to_scene(&self) -> bool { + match self.composite_kind { + CompositeKind::None | CompositeKind::Complex(..) => true, + CompositeKind::Simple(LowLevelFilterOp::Opacity(opacity)) => opacity > Au(0), + CompositeKind::Simple(..) => true, + } + } +} + +#[derive(Debug, Clone)] +pub struct ClearTile { + pub rect: DeviceIntRect, +} + +#[derive(Clone, Copy)] +pub struct FrameBuilderConfig { + pub enable_scrollbars: bool, + pub enable_subpixel_aa: bool, +} + +impl FrameBuilderConfig { + pub fn new(enable_scrollbars: bool, + enable_subpixel_aa: bool) -> FrameBuilderConfig { + FrameBuilderConfig { + enable_scrollbars: enable_scrollbars, + enable_subpixel_aa: enable_subpixel_aa, + } + } +} + +pub struct FrameBuilder { + screen_rect: LayerRect, + background_color: Option, + prim_store: PrimitiveStore, + cmds: Vec, + debug: bool, + config: FrameBuilderConfig, + + layer_store: Vec, + packed_layers: Vec, + + scrollbar_prims: Vec, +} + +/// A rendering-oriented representation of frame::Frame built by the render backend +/// and presented to the renderer. +pub struct Frame { + pub viewport_size: LayerSize, + pub background_color: Option, + pub device_pixel_ratio: f32, + pub debug_rects: Vec, + pub cache_size: DeviceUintSize, + pub passes: Vec, + pub profile_counters: FrameProfileCounters, + + pub layer_texture_data: Vec, + pub render_task_data: Vec, + pub gpu_data16: Vec, + pub gpu_data32: Vec, + pub gpu_data64: Vec, + pub gpu_data128: Vec, + pub gpu_geometry: Vec, + pub gpu_resource_rects: Vec, + + // List of textures that we don't know about yet + // from the backend thread. The render thread + // will use a callback to resolve these and + // patch the data structures. + pub deferred_resolves: Vec, +} + +/// Some extra per-tile information stored for debugging purposes. +#[derive(Debug)] +struct CompiledScreenTileInfo { + cmd_count: usize, + prim_count: usize, +} + +#[derive(Debug)] +struct CompiledScreenTile { + main_render_task: RenderTask, + required_pass_count: usize, + info: CompiledScreenTileInfo, +} + +impl CompiledScreenTile { + fn new(main_render_task: RenderTask, + info: CompiledScreenTileInfo) + -> CompiledScreenTile { + let mut required_pass_count = 0; + main_render_task.max_depth(0, &mut required_pass_count); + + CompiledScreenTile { + main_render_task: main_render_task, + required_pass_count: required_pass_count, + info: info, + } + } + + fn build(self, passes: &mut Vec) { + self.main_render_task.assign_to_passes(passes.len() - 1, + passes); + } +} + +#[derive(Debug, Eq, PartialEq, Copy, Clone)] +enum TileCommand { + PushLayer(StackingContextIndex), + PopLayer, + DrawPrimitive(PrimitiveIndex), +} + +#[derive(Debug)] +struct ScreenTile { + rect: DeviceIntRect, + cmds: Vec, + prim_count: usize, +} + +impl ScreenTile { + fn new(rect: DeviceIntRect) -> ScreenTile { + ScreenTile { + rect: rect, + cmds: Vec::new(), + prim_count: 0, + } + } + + #[inline(always)] + fn push_layer(&mut self, + sc_index: StackingContextIndex) { + self.cmds.push(TileCommand::PushLayer(sc_index)); + } + + #[inline(always)] + fn push_primitive(&mut self, prim_index: PrimitiveIndex) { + self.cmds.push(TileCommand::DrawPrimitive(prim_index)); + self.prim_count += 1; + } + + #[inline(always)] + fn pop_layer(&mut self, sc_index: StackingContextIndex) { + let last_cmd = *self.cmds.last().unwrap(); + if last_cmd == TileCommand::PushLayer(sc_index) { + self.cmds.pop(); + } else { + self.cmds.push(TileCommand::PopLayer); + } + } + + fn compile(self, ctx: &CompileTileContext) -> Option { + if self.prim_count == 0 { + return None; + } + + let cmd_count = self.cmds.len(); + let mut actual_prim_count = 0; + let mut next_z = 0; + + let mut sc_stack = Vec::new(); + let mut current_task = RenderTask::new_alpha_batch(self.rect, ctx); + let mut alpha_task_stack = Vec::new(); + + for cmd in self.cmds { + match cmd { + TileCommand::PushLayer(sc_index) => { + sc_stack.push(sc_index); + + let layer = &ctx.layer_store[sc_index.0]; + match layer.composite_kind { + CompositeKind::None => {} + CompositeKind::Simple(..) | CompositeKind::Complex(..) => { + let layer_rect = layer.xf_rect.as_ref().unwrap().bounding_rect; + let needed_rect = layer_rect.intersection(&self.rect) + .expect("bug if these don't overlap"); + let prev_task = mem::replace(&mut current_task, + RenderTask::new_alpha_batch(needed_rect, ctx)); + alpha_task_stack.push(prev_task); + } + } + } + TileCommand::PopLayer => { + let sc_index = sc_stack.pop().unwrap(); + + let layer = &ctx.layer_store[sc_index.0]; + match layer.composite_kind { + CompositeKind::None => {} + CompositeKind::Simple(info) => { + let mut prev_task = alpha_task_stack.pop().unwrap(); + let item = AlphaRenderItem::Blend(current_task.id, info, next_z); + next_z += 1; + prev_task.as_alpha_batch().alpha_items.push(item); + prev_task.children.push(current_task); + current_task = prev_task; + } + CompositeKind::Complex(info) => { + let backdrop = alpha_task_stack.pop().unwrap(); + + let mut composite_task = RenderTask::new_alpha_batch(self.rect, ctx); + + let item = AlphaRenderItem::Composite(backdrop.id, + current_task.id, + info, + next_z); + next_z += 1; + composite_task.as_alpha_batch().alpha_items.push(item); + + composite_task.children.push(backdrop); + composite_task.children.push(current_task); + + current_task = composite_task; + } + } + } + TileCommand::DrawPrimitive(prim_index) => { + let sc_index = *sc_stack.last().unwrap(); + let prim_metadata = ctx.prim_store.get_metadata(prim_index); + + // Add any dynamic render tasks needed to render this primitive + if let Some(ref render_task) = prim_metadata.render_task { + current_task.children.push(render_task.clone()); + } + if let Some(ref clip_task) = prim_metadata.clip_task { + current_task.children.push(clip_task.clone()); + } + + actual_prim_count += 1; + + let layer = &ctx.layer_store[sc_index.0]; + let transform_kind = layer.xf_rect.as_ref().unwrap().kind; + let needs_clipping = prim_metadata.clip_task.is_some(); + let needs_blending = transform_kind == TransformedRectKind::Complex || + !prim_metadata.is_opaque || + needs_clipping; + + let items = if needs_blending { + &mut current_task.as_alpha_batch().alpha_items + } else { + &mut current_task.as_alpha_batch().opaque_items + }; + items.push(AlphaRenderItem::Primitive(sc_index, prim_index, next_z)); + next_z += 1; + } + } + } + + debug_assert!(alpha_task_stack.is_empty()); + + let info = CompiledScreenTileInfo { + cmd_count: cmd_count, + prim_count: actual_prim_count, + }; + + current_task.location = RenderTaskLocation::Fixed(self.rect); + Some(CompiledScreenTile::new(current_task, info)) + } +} + +impl FrameBuilder { + pub fn new(viewport_size: LayerSize, + background_color: Option, + debug: bool, + config: FrameBuilderConfig) -> FrameBuilder { + FrameBuilder { + screen_rect: LayerRect::new(LayerPoint::zero(), viewport_size), + background_color: background_color, + layer_store: Vec::new(), + prim_store: PrimitiveStore::new(), + cmds: Vec::new(), + debug: debug, + packed_layers: Vec::new(), + scrollbar_prims: Vec::new(), + config: config, + } + } + + fn add_primitive(&mut self, + rect: &LayerRect, + clip_region: &ClipRegion, + container: PrimitiveContainer) -> PrimitiveIndex { + + let geometry = PrimitiveGeometry { + local_rect: *rect, + local_clip_rect: clip_region.main, + }; + let clip_source = if clip_region.is_complex() { + ClipSource::Region(clip_region.clone()) + } else { + ClipSource::NoClip + }; + let clip_info = MaskCacheInfo::new(&clip_source, + &mut self.prim_store.gpu_data32); + + let prim_index = self.prim_store.add_primitive(geometry, + Box::new(clip_source), + clip_info, + container); + + match self.cmds.last_mut().unwrap() { + &mut PrimitiveRunCmd::PrimitiveRun(_run_prim_index, ref mut count) => { + debug_assert!(_run_prim_index.0 + *count == prim_index.0); + *count += 1; + return prim_index; + } + &mut PrimitiveRunCmd::PushStackingContext(..) | + &mut PrimitiveRunCmd::PopStackingContext => {} + } + + self.cmds.push(PrimitiveRunCmd::PrimitiveRun(prim_index, 1)); + + prim_index + } + + pub fn push_layer(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + transform: LayerToScrollTransform, + pipeline_id: PipelineId, + scroll_layer_id: ScrollLayerId, + composition_operations: &[CompositionOp]) { + let sc_index = StackingContextIndex(self.layer_store.len()); + + let clip_source = clip_region.into(); + let clip_info = MaskCacheInfo::new(&clip_source, + &mut self.prim_store.gpu_data32); + + let sc = StackingContext { + local_rect: rect, + local_transform: transform, + scroll_layer_id: scroll_layer_id, + pipeline_id: pipeline_id, + xf_rect: None, + composite_kind: CompositeKind::new(composition_operations), + tile_range: None, + clip_source: clip_source, + clip_cache_info: clip_info, + }; + self.layer_store.push(sc); + + self.packed_layers.push(PackedStackingContext { + transform: LayerToWorldTransform::identity(), + inv_transform: WorldToLayerTransform::identity(), + screen_vertices: [WorldPoint4D::zero(); 4], + local_clip_rect: LayerRect::zero(), + }); + + self.cmds.push(PrimitiveRunCmd::PushStackingContext(sc_index)); + } + + pub fn pop_layer(&mut self) { + self.cmds.push(PrimitiveRunCmd::PopStackingContext); + } + + pub fn add_solid_rectangle(&mut self, + rect: &LayerRect, + clip_region: &ClipRegion, + color: &ColorF, + flags: PrimitiveFlags) { + if color.a == 0.0 { + return; + } + + let prim = RectanglePrimitive { + color: *color, + }; + + let prim_index = self.add_primitive(rect, + clip_region, + PrimitiveContainer::Rectangle(prim)); + + match flags { + PrimitiveFlags::None => {} + PrimitiveFlags::Scrollbar(scroll_layer_id, border_radius) => { + self.scrollbar_prims.push(ScrollbarPrimitive { + prim_index: prim_index, + scroll_layer_id: scroll_layer_id, + border_radius: border_radius, + }); + } + } + } + + pub fn supported_style(&mut self, border: &BorderSide) -> bool { + match border.style { + BorderStyle::Solid | + BorderStyle::None | + BorderStyle::Dotted | + BorderStyle::Dashed | + BorderStyle::Inset | + BorderStyle::Ridge | + BorderStyle::Groove | + BorderStyle::Outset | + BorderStyle::Double => { + return true; + } + _ => { + println!("TODO: Other border styles {:?}", border.style); + return false; + } + } + } + + pub fn add_border(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + border: &BorderDisplayItem) { + let radius = &border.radius; + let left = &border.left; + let right = &border.right; + let top = &border.top; + let bottom = &border.bottom; + + if !self.supported_style(left) || !self.supported_style(right) || + !self.supported_style(top) || !self.supported_style(bottom) { + println!("Unsupported border style, not rendering border"); + return; + } + + // These colors are used during inset/outset scaling. + let left_color = left.border_color(1.0, 2.0/3.0, 0.3, 0.7); + let top_color = top.border_color(1.0, 2.0/3.0, 0.3, 0.7); + let right_color = right.border_color(2.0/3.0, 1.0, 0.7, 0.3); + let bottom_color = bottom.border_color(2.0/3.0, 1.0, 0.7, 0.3); + + let tl_outer = LayerPoint::new(rect.origin.x, rect.origin.y); + let tl_inner = tl_outer + LayerPoint::new(radius.top_left.width.max(left.width), + radius.top_left.height.max(top.width)); + + let tr_outer = LayerPoint::new(rect.origin.x + rect.size.width, rect.origin.y); + let tr_inner = tr_outer + LayerPoint::new(-radius.top_right.width.max(right.width), + radius.top_right.height.max(top.width)); + + let bl_outer = LayerPoint::new(rect.origin.x, rect.origin.y + rect.size.height); + let bl_inner = bl_outer + LayerPoint::new(radius.bottom_left.width.max(left.width), + -radius.bottom_left.height.max(bottom.width)); + + let br_outer = LayerPoint::new(rect.origin.x + rect.size.width, + rect.origin.y + rect.size.height); + let br_inner = br_outer - LayerPoint::new(radius.bottom_right.width.max(right.width), + radius.bottom_right.height.max(bottom.width)); + + //Note: while similar to `ComplexClipRegion::get_inner_rect()` in spirit, + // this code is a bit more complex and can not there for be merged. + let inner_rect = rect_from_points_f(tl_inner.x.max(bl_inner.x), + tl_inner.y.max(tr_inner.y), + tr_inner.x.min(br_inner.x), + bl_inner.y.min(br_inner.y)); + + let prim_cpu = BorderPrimitiveCpu { + inner_rect: LayerRect::from_untyped(&inner_rect), + }; + + let prim_gpu = BorderPrimitiveGpu { + colors: [ left_color, top_color, right_color, bottom_color ], + widths: [ left.width, top.width, right.width, bottom.width ], + style: [ + pack_as_float(left.style as u32), + pack_as_float(top.style as u32), + pack_as_float(right.style as u32), + pack_as_float(bottom.style as u32), + ], + radii: [ + radius.top_left, + radius.top_right, + radius.bottom_right, + radius.bottom_left, + ], + }; + + self.add_primitive(&rect, + clip_region, + PrimitiveContainer::Border(prim_cpu, prim_gpu)); + } + + pub fn add_gradient(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + start_point: LayerPoint, + end_point: LayerPoint, + stops: ItemRange) { + // Fast paths for axis-aligned gradients: + let mut reverse_stops = false; + let kind = if start_point.x == end_point.x { + GradientType::Vertical + } else if start_point.y == end_point.y { + GradientType::Horizontal + } else { + reverse_stops = start_point.x > end_point.x; + GradientType::Rotated + }; + + let gradient_cpu = GradientPrimitiveCpu { + stops_range: stops, + kind: kind, + reverse_stops: reverse_stops, + cache_dirty: true, + }; + + // To get reftests exactly matching with reverse start/end + // points, it's necessary to reverse the gradient + // line in some cases. + let (sp, ep) = if reverse_stops { + (end_point, start_point) + } else { + (start_point, end_point) + }; + + let gradient_gpu = GradientPrimitiveGpu { + start_point: sp, + end_point: ep, + padding: [0.0, 0.0, 0.0], + kind: pack_as_float(kind as u32), + }; + + self.add_primitive(&rect, + clip_region, + PrimitiveContainer::Gradient(gradient_cpu, gradient_gpu)); + } + + pub fn add_radial_gradient(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + start_center: LayerPoint, + start_radius: f32, + end_center: LayerPoint, + end_radius: f32, + stops: ItemRange) { + let radial_gradient_cpu = RadialGradientPrimitiveCpu { + stops_range: stops, + cache_dirty: true, + }; + + let radial_gradient_gpu = RadialGradientPrimitiveGpu { + start_center: start_center, + end_center: end_center, + start_radius: start_radius, + end_radius: end_radius, + padding: [0.0, 0.0], + }; + + self.add_primitive(&rect, + clip_region, + PrimitiveContainer::RadialGradient(radial_gradient_cpu, radial_gradient_gpu)); + } + + pub fn add_text(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + font_key: FontKey, + size: Au, + blur_radius: Au, + color: &ColorF, + glyph_range: ItemRange) { + if color.a == 0.0 { + return + } + + if size.0 <= 0 { + return + } + + let (render_mode, glyphs_per_run) = if blur_radius == Au(0) { + // TODO(gw): Use a proper algorithm to select + // whether this item should be rendered with + // subpixel AA! + let render_mode = if self.config.enable_subpixel_aa { + FontRenderMode::Subpixel + } else { + FontRenderMode::Alpha + }; + + (render_mode, 8) + } else { + // TODO(gw): Support breaking up text shadow when + // the size of the text run exceeds the dimensions + // of the render target texture. + (FontRenderMode::Alpha, glyph_range.length) + }; + + let text_run_count = (glyph_range.length + glyphs_per_run - 1) / glyphs_per_run; + for run_index in 0..text_run_count { + let start = run_index * glyphs_per_run; + let end = cmp::min(start + glyphs_per_run, glyph_range.length); + let sub_range = ItemRange { + start: glyph_range.start + start, + length: end - start, + }; + + let prim_cpu = TextRunPrimitiveCpu { + font_key: font_key, + logical_font_size: size, + blur_radius: blur_radius, + glyph_range: sub_range, + cache_dirty: true, + glyph_indices: Vec::new(), + color_texture_id: SourceTexture::Invalid, + color: *color, + render_mode: render_mode, + resource_address: GpuStoreAddress(0), + }; + + let prim_gpu = TextRunPrimitiveGpu { + color: *color, + }; + + self.add_primitive(&rect, + clip_region, + PrimitiveContainer::TextRun(prim_cpu, prim_gpu)); + } + } + + pub fn add_box_shadow(&mut self, + box_bounds: &LayerRect, + clip_region: &ClipRegion, + box_offset: &LayerPoint, + color: &ColorF, + blur_radius: f32, + spread_radius: f32, + border_radius: f32, + clip_mode: BoxShadowClipMode) { + if color.a == 0.0 { + return + } + + // Fast path. + if blur_radius == 0.0 && spread_radius == 0.0 && clip_mode == BoxShadowClipMode::None { + self.add_solid_rectangle(&box_bounds, + clip_region, + color, + PrimitiveFlags::None); + return; + } + + let bs_rect = box_bounds.translate(box_offset) + .inflate(spread_radius, spread_radius); + + let outside_edge_size = 2.0 * blur_radius; + let inside_edge_size = outside_edge_size.max(border_radius); + let edge_size = outside_edge_size + inside_edge_size; + let outer_rect = bs_rect.inflate(outside_edge_size, outside_edge_size); + let mut instance_rects = Vec::new(); + let (prim_rect, inverted) = match clip_mode { + BoxShadowClipMode::Outset | BoxShadowClipMode::None => { + subtract_rect(&outer_rect, box_bounds, &mut instance_rects); + (outer_rect, 0.0) + } + BoxShadowClipMode::Inset => { + subtract_rect(box_bounds, &bs_rect, &mut instance_rects); + (*box_bounds, 1.0) + } + }; + + if edge_size == 0.0 { + for rect in &instance_rects { + self.add_solid_rectangle(rect, + clip_region, + color, + PrimitiveFlags::None) + } + } else { + let prim_gpu = BoxShadowPrimitiveGpu { + src_rect: *box_bounds, + bs_rect: bs_rect, + color: *color, + blur_radius: blur_radius, + border_radius: border_radius, + edge_size: edge_size, + inverted: inverted, + }; + + self.add_primitive(&prim_rect, + clip_region, + PrimitiveContainer::BoxShadow(prim_gpu, instance_rects)); + } + } + + pub fn add_webgl_rectangle(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + context_id: WebGLContextId) { + let prim_cpu = ImagePrimitiveCpu { + kind: ImagePrimitiveKind::WebGL(context_id), + color_texture_id: SourceTexture::Invalid, + resource_address: GpuStoreAddress(0), + }; + + let prim_gpu = ImagePrimitiveGpu { + stretch_size: rect.size, + tile_spacing: LayerSize::zero(), + }; + + self.add_primitive(&rect, + clip_region, + PrimitiveContainer::Image(prim_cpu, prim_gpu)); + } + + pub fn add_image(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + stretch_size: &LayerSize, + tile_spacing: &LayerSize, + image_key: ImageKey, + image_rendering: ImageRendering) { + let prim_cpu = ImagePrimitiveCpu { + kind: ImagePrimitiveKind::Image(image_key, + image_rendering, + *tile_spacing), + color_texture_id: SourceTexture::Invalid, + resource_address: GpuStoreAddress(0), + }; + + let prim_gpu = ImagePrimitiveGpu { + stretch_size: *stretch_size, + tile_spacing: *tile_spacing, + }; + + self.add_primitive(&rect, + clip_region, + PrimitiveContainer::Image(prim_cpu, prim_gpu)); + } + + pub fn add_yuv_image(&mut self, + rect: LayerRect, + clip_region: &ClipRegion, + y_image_key: ImageKey, + u_image_key: ImageKey, + v_image_key: ImageKey, + color_space: YuvColorSpace) { + + let prim_cpu = YuvImagePrimitiveCpu { + y_key: y_image_key, + u_key: u_image_key, + v_key: v_image_key, + y_texture_id: SourceTexture::Invalid, + u_texture_id: SourceTexture::Invalid, + v_texture_id: SourceTexture::Invalid, + }; + + let prim_gpu = YuvImagePrimitiveGpu::new(rect.size, color_space); + + self.add_primitive(&rect, + clip_region, + PrimitiveContainer::YuvImage(prim_cpu, prim_gpu)); + } + + /// Compute the contribution (bounding rectangles, and resources) of layers and their + /// primitives in screen space. + fn cull_layers(&mut self, + screen_rect: &DeviceIntRect, + scroll_tree: &ScrollTree, + auxiliary_lists_map: &AuxiliaryListsMap, + x_tile_count: i32, + y_tile_count: i32, + resource_cache: &mut ResourceCache, + profile_counters: &mut FrameProfileCounters, + device_pixel_ratio: f32) { + // Build layer screen rects. + // TODO(gw): This can be done earlier once update_layer_transforms() is fixed. + + // TODO(gw): Remove this stack once the layers refactor is done! + let mut layer_stack: Vec = Vec::new(); + let mut clip_info_stack = Vec::new(); + + for cmd in &self.cmds { + match cmd { + &PrimitiveRunCmd::PushStackingContext(sc_index) => { + layer_stack.push(sc_index); + let layer = &mut self.layer_store[sc_index.0]; + let packed_layer = &mut self.packed_layers[sc_index.0]; + + layer.xf_rect = None; + layer.tile_range = None; + + let scroll_layer = &scroll_tree.layers[&layer.scroll_layer_id]; + packed_layer.transform = scroll_layer.world_content_transform + .with_source::() // the scroll layer is considered a parent of layer + .pre_mul(&layer.local_transform); + packed_layer.inv_transform = packed_layer.transform.inverse().unwrap(); + + if !layer.can_contribute_to_scene() { + continue; + } + + let inv_layer_transform = layer.local_transform.inverse().unwrap(); + let local_viewport_rect = as_scroll_parent_rect(&scroll_layer.combined_local_viewport_rect); + let viewport_rect = inv_layer_transform.transform_rect(&local_viewport_rect); + let local_clip_rect = layer.clip_source.to_rect().unwrap_or(layer.local_rect); + let layer_local_rect = layer.local_rect + .intersection(&viewport_rect) + .and_then(|rect| rect.intersection(&local_clip_rect)); + + if let Some(layer_local_rect) = layer_local_rect { + let layer_xf_rect = TransformedRect::new(&layer_local_rect, + &packed_layer.transform, + device_pixel_ratio); + + if layer_xf_rect.bounding_rect.intersects(&screen_rect) { + packed_layer.screen_vertices = layer_xf_rect.vertices.clone(); + packed_layer.local_clip_rect = layer_local_rect; + + let layer_rect = layer_xf_rect.bounding_rect; + layer.xf_rect = Some(layer_xf_rect); + + let tile_x0 = layer_rect.origin.x / SCREEN_TILE_SIZE; + let tile_y0 = layer_rect.origin.y / SCREEN_TILE_SIZE; + let tile_x1 = (layer_rect.origin.x + layer_rect.size.width + SCREEN_TILE_SIZE - 1) / SCREEN_TILE_SIZE; + let tile_y1 = (layer_rect.origin.y + layer_rect.size.height + SCREEN_TILE_SIZE - 1) / SCREEN_TILE_SIZE; + + let tile_x0 = cmp::min(tile_x0, x_tile_count); + let tile_x0 = cmp::max(tile_x0, 0); + let tile_x1 = cmp::min(tile_x1, x_tile_count); + let tile_x1 = cmp::max(tile_x1, 0); + + let tile_y0 = cmp::min(tile_y0, y_tile_count); + let tile_y0 = cmp::max(tile_y0, 0); + let tile_y1 = cmp::min(tile_y1, y_tile_count); + let tile_y1 = cmp::max(tile_y1, 0); + + layer.tile_range = Some(TileRange { + x0: tile_x0, + y0: tile_y0, + x1: tile_x1, + y1: tile_y1, + }); + } + } + + if let Some(ref mut clip_info) = layer.clip_cache_info { + let auxiliary_lists = auxiliary_lists_map.get(&layer.pipeline_id) + .expect("No auxiliary lists?"); + clip_info.update(&layer.clip_source, + &packed_layer.transform, + &mut self.prim_store.gpu_data32, + device_pixel_ratio, + auxiliary_lists); + if let ClipSource::Region(ClipRegion{ image_mask: Some(ref mask), .. }) = layer.clip_source { + resource_cache.request_image(mask.image, ImageRendering::Auto); + //Note: no need to add the layer for resolve, all layers get resolved + } + + // Create a task for the layer mask, if needed, + // i.e. if there are rounded corners or image masks for the layer. + clip_info_stack.push((sc_index, clip_info.clone())); + } + + } + &PrimitiveRunCmd::PrimitiveRun(prim_index, prim_count) => { + let sc_index = layer_stack.last().unwrap(); + let layer = &self.layer_store[sc_index.0]; + if !layer.is_visible() { + continue; + } + + let packed_layer = &self.packed_layers[sc_index.0]; + let auxiliary_lists = auxiliary_lists_map.get(&layer.pipeline_id) + .expect("No auxiliary lists?"); + + for i in 0..prim_count { + let prim_index = PrimitiveIndex(prim_index.0 + i); + if self.prim_store.build_bounding_rect(prim_index, + screen_rect, + &packed_layer.transform, + &packed_layer.local_clip_rect, + device_pixel_ratio) { + if self.prim_store.prepare_prim_for_render(prim_index, + resource_cache, + &packed_layer.transform, + device_pixel_ratio, + auxiliary_lists) { + self.prim_store.build_bounding_rect(prim_index, + screen_rect, + &packed_layer.transform, + &packed_layer.local_clip_rect, + device_pixel_ratio); + } + + // If the primitive is visible, consider culling it via clip rect(s). + // If it is visible but has clips, create the clip task for it. + if let Some(prim_bounding_rect) = self.prim_store + .cpu_bounding_rects[prim_index.0] { + let prim_metadata = &mut self.prim_store.cpu_metadata[prim_index.0]; + let prim_clip_info = prim_metadata.clip_cache_info.as_ref(); + let mut visible = true; + + if let Some(info) = prim_clip_info { + clip_info_stack.push((*sc_index, info.clone())); + } + + // Try to create a mask if we may need to. + if !clip_info_stack.is_empty() { + // If the primitive doesn't have a specific clip, + // key the task ID off the stacking context. This means + // that two primitives which are only clipped by the + // stacking context stack can share clip masks during + // render task assignment to targets. + let (mask_key, mask_rect) = match prim_clip_info { + Some(..) => { + (MaskCacheKey::Primitive(prim_index), prim_bounding_rect) + } + None => { + let layer_rect = layer.xf_rect.as_ref().unwrap().bounding_rect; + (MaskCacheKey::StackingContext(*sc_index), layer_rect) + } + }; + let mask_opt = RenderTask::new_mask(mask_rect, + mask_key, + &clip_info_stack, + &self.layer_store); + match mask_opt { + MaskResult::Outside => { + // Primitive is completely clipped out. + prim_metadata.clip_task = None; + self.prim_store.cpu_bounding_rects[prim_index.0] = None; + visible = false; + } + MaskResult::Inside(task) => { + // Got a valid clip task, so store it for this primitive. + prim_metadata.clip_task = Some(task); + } + } + } + + if let Some(..) = prim_clip_info { + clip_info_stack.pop(); + } + + if visible { + profile_counters.visible_primitives.inc(); + } + } + } + } + } + &PrimitiveRunCmd::PopStackingContext => { + let sc_index = *layer_stack.last().unwrap(); + let layer = &mut self.layer_store[sc_index.0]; + if layer.can_contribute_to_scene() { + if layer.clip_cache_info.is_some() { + clip_info_stack.pop().unwrap(); + } + } + + layer_stack.pop().unwrap(); + } + } + } + } + + fn create_screen_tiles(&self, device_pixel_ratio: f32) -> (i32, i32, Vec) { + let dp_size = DeviceIntSize::from_lengths(device_length(self.screen_rect.size.width as f32, + device_pixel_ratio), + device_length(self.screen_rect.size.height as f32, + device_pixel_ratio)); + + let x_tile_size = SCREEN_TILE_SIZE; + let y_tile_size = SCREEN_TILE_SIZE; + let x_tile_count = (dp_size.width + x_tile_size - 1) / x_tile_size; + let y_tile_count = (dp_size.height + y_tile_size - 1) / y_tile_size; + + // Build screen space tiles, which are individual BSP trees. + let mut screen_tiles = Vec::new(); + for y in 0..y_tile_count { + let y0 = y * y_tile_size; + let y1 = y0 + y_tile_size; + + for x in 0..x_tile_count { + let x0 = x * x_tile_size; + let x1 = x0 + x_tile_size; + + let tile_rect = rect_from_points(DeviceIntLength::new(x0), + DeviceIntLength::new(y0), + DeviceIntLength::new(x1), + DeviceIntLength::new(y1)); + + screen_tiles.push(ScreenTile::new(tile_rect)); + } + } + + (x_tile_count, y_tile_count, screen_tiles) + } + + + fn assign_prims_to_screen_tiles(&self, + screen_tiles: &mut Vec, + x_tile_count: i32, + device_pixel_ratio: f32) { + let mut layer_stack: Vec = Vec::new(); + let mut clip_rect_stack = Vec::new(); + + for cmd in &self.cmds { + match cmd { + &PrimitiveRunCmd::PushStackingContext(sc_index) => { + layer_stack.push(sc_index); + + let layer = &self.layer_store[sc_index.0]; + if !layer.is_visible() { + continue; + } + + if let Some(ref clip_info) = layer.clip_cache_info { + clip_rect_stack.push(clip_info.outer_rect); + } + + let tile_range = layer.tile_range.as_ref().unwrap(); + for ly in tile_range.y0..tile_range.y1 { + for lx in tile_range.x0..tile_range.x1 { + let tile = &mut screen_tiles[(ly * x_tile_count + lx) as usize]; + tile.push_layer(sc_index); + } + } + } + &PrimitiveRunCmd::PrimitiveRun(first_prim_index, prim_count) => { + let sc_index = layer_stack.last().unwrap(); + + let layer = &self.layer_store[sc_index.0]; + if !layer.is_visible() { + continue; + } + let packed_layer = &self.packed_layers[sc_index.0]; + + let tile_range = layer.tile_range.as_ref().unwrap(); + let xf_rect = &layer.xf_rect.as_ref().unwrap(); + + for i in 0..prim_count { + let prim_index = PrimitiveIndex(first_prim_index.0 + i); + + // check the bounding box + let mut p_rect = match self.prim_store.get_bounding_rect(prim_index) { + &Some(r) => r, + &None => continue, + }; + // check the clip bounding rectangle + if let Some(ref clip_info) = self.prim_store.get_metadata(prim_index).clip_cache_info { + p_rect = match p_rect.intersection(&clip_info.outer_rect) { + Some(r) => r, + None => continue, + } + } else + // check the parent layer clip rectangle + if let Some(clip_rect) = clip_rect_stack.last() { + p_rect = match p_rect.intersection(clip_rect) { + Some(r) => r, + None => continue, + } + } + + // TODO(gw): Ensure that certain primitives (such as background-image) only get + // assigned to tiles where their containing layer intersects with. + // Does this cause any problems / demonstrate other bugs? + // Restrict the tiles by clamping to the layer tile indices... + + let p_tile_x0 = p_rect.origin.x / SCREEN_TILE_SIZE; + let p_tile_y0 = p_rect.origin.y / SCREEN_TILE_SIZE; + let p_tile_x1 = (p_rect.origin.x + p_rect.size.width + SCREEN_TILE_SIZE - 1) / SCREEN_TILE_SIZE; + let p_tile_y1 = (p_rect.origin.y + p_rect.size.height + SCREEN_TILE_SIZE - 1) / SCREEN_TILE_SIZE; + + for py in cmp::max(p_tile_y0, tile_range.y0) .. cmp::min(p_tile_y1, tile_range.y1) { + for px in cmp::max(p_tile_x0, tile_range.x0) .. cmp::min(p_tile_x1, tile_range.x1) { + let tile = &mut screen_tiles[(py * x_tile_count + px) as usize]; + + // TODO(gw): Support narrow phase for 3d transform elements! + if xf_rect.kind == TransformedRectKind::Complex || + self.prim_store.prim_affects_tile(prim_index, + &tile.rect, + &packed_layer.transform, + device_pixel_ratio) { + tile.push_primitive(prim_index); + } + } + } + } + } + &PrimitiveRunCmd::PopStackingContext => { + let sc_index = layer_stack.pop().unwrap(); + + let layer = &self.layer_store[sc_index.0]; + if !layer.is_visible() { + continue; + } + + if layer.clip_cache_info.is_some() { + clip_rect_stack.pop(); + } + + let tile_range = layer.tile_range.as_ref().unwrap(); + for ly in tile_range.y0..tile_range.y1 { + for lx in tile_range.x0..tile_range.x1 { + let tile = &mut screen_tiles[(ly * x_tile_count + lx) as usize]; + tile.pop_layer(sc_index); + } + } + } + } + } + } + + fn update_scroll_bars(&mut self, scroll_tree: &ScrollTree) { + let distance_from_edge = 8.0; + + for scrollbar_prim in &self.scrollbar_prims { + let mut geom = (*self.prim_store.gpu_geometry.get(GpuStoreAddress(scrollbar_prim.prim_index.0 as i32))).clone(); + let scroll_layer = &scroll_tree.layers[&scrollbar_prim.scroll_layer_id]; + + let scrollable_distance = scroll_layer.scrollable_height(); + + if scrollable_distance <= 0.0 { + geom.local_clip_rect.size = LayerSize::zero(); + *self.prim_store.gpu_geometry.get_mut(GpuStoreAddress(scrollbar_prim.prim_index.0 as i32)) = geom; + continue; + } + + let f = -scroll_layer.scrolling.offset.y / scrollable_distance; + + let min_y = scroll_layer.local_viewport_rect.origin.y - + scroll_layer.scrolling.offset.y + + distance_from_edge; + + let max_y = scroll_layer.local_viewport_rect.origin.y + + scroll_layer.local_viewport_rect.size.height - + scroll_layer.scrolling.offset.y - + geom.local_rect.size.height - + distance_from_edge; + + geom.local_rect.origin.x = scroll_layer.local_viewport_rect.origin.x + + scroll_layer.local_viewport_rect.size.width - + geom.local_rect.size.width - + distance_from_edge; + + geom.local_rect.origin.y = util::lerp(min_y, max_y, f); + geom.local_clip_rect = geom.local_rect; + + let clip_source = if scrollbar_prim.border_radius == 0.0 { + ClipSource::NoClip + } else { + ClipSource::Complex(geom.local_rect, scrollbar_prim.border_radius) + }; + self.prim_store.set_clip_source(scrollbar_prim.prim_index, clip_source); + *self.prim_store.gpu_geometry.get_mut(GpuStoreAddress(scrollbar_prim.prim_index.0 as i32)) = geom; + } + } + + pub fn build(&mut self, + resource_cache: &mut ResourceCache, + frame_id: FrameId, + scroll_tree: &ScrollTree, + auxiliary_lists_map: &AuxiliaryListsMap, + device_pixel_ratio: f32) -> Frame { + let mut profile_counters = FrameProfileCounters::new(); + profile_counters.total_primitives.set(self.prim_store.prim_count()); + + resource_cache.begin_frame(frame_id); + + let screen_rect = DeviceIntRect::new( + DeviceIntPoint::zero(), + DeviceIntSize::from_lengths(device_length(self.screen_rect.size.width as f32, + device_pixel_ratio), + device_length(self.screen_rect.size.height as f32, + device_pixel_ratio))); + + // Pick a size for the cache render targets to be. The main requirement is that it + // has to be at least as large as the framebuffer size. This ensures that it will + // always be able to allocate the worst case render task (such as a clip mask that + // covers the entire screen). + // However, there are some extremely subtle rounding errors that occur in the + // reftests under OSMesa if the cache targets are exactly the size of the + // framebuffer. To work around this, we'll align the cache size to a multiple + // of the tile size. This can be removed once the tiling code is gone. + // TODO(gw): Remove this hack once the tiling code is sorted out!! + let max_dimension = cmp::max(screen_rect.size.width, screen_rect.size.height); + let aligned_max_dimension = (max_dimension + SCREEN_TILE_SIZE - 1) & !(SCREEN_TILE_SIZE-1); + let cache_size = DeviceUintSize::new(aligned_max_dimension as u32, + aligned_max_dimension as u32); + + let mut debug_rects = Vec::new(); + + let (x_tile_count, y_tile_count, mut screen_tiles) = self.create_screen_tiles(device_pixel_ratio); + + self.update_scroll_bars(scroll_tree); + + self.cull_layers(&screen_rect, + scroll_tree, + auxiliary_lists_map, + x_tile_count, + y_tile_count, + resource_cache, + &mut profile_counters, + device_pixel_ratio); + + let mut compiled_screen_tiles = Vec::new(); + let mut max_passes_needed = 0; + + let mut render_tasks = { + let ctx = CompileTileContext { + layer_store: &self.layer_store, + prim_store: &self.prim_store, + + // This doesn't need to be atomic right now (all the screen tiles are + // compiled on a single thread). However, in the future each of the + // compile steps below will be run on a worker thread, which will + // require an atomic int here anyway. + render_task_id_counter: AtomicUsize::new(0), + }; + + if !self.layer_store.is_empty() { + self.assign_prims_to_screen_tiles(&mut screen_tiles, + x_tile_count, + device_pixel_ratio); + } + + // Build list of passes, target allocs that each tile needs. + for screen_tile in screen_tiles { + let rect = screen_tile.rect; + if let Some(compiled_screen_tile) = screen_tile.compile(&ctx) { + max_passes_needed = cmp::max(max_passes_needed, + compiled_screen_tile.required_pass_count); + if self.debug { + let label = format!("{}|{}", compiled_screen_tile.info.cmd_count, compiled_screen_tile.info.prim_count); + let color = ColorF::new(1.0, 0.0, 0.0, 1.0); + debug_rects.push(DebugRect { + label: label, + color: color, + rect: rect, + }); + } + compiled_screen_tiles.push(compiled_screen_tile); + } + } + + let static_render_task_count = ctx.render_task_id_counter.load(Ordering::SeqCst); + RenderTaskCollection::new(static_render_task_count) + }; + + resource_cache.block_until_all_resources_added(); + + for layer in self.layer_store.iter() { + if let Some(ref clip_info) = layer.clip_cache_info { + self.prim_store.resolve_clip_cache(clip_info, resource_cache); + } + } + + + let deferred_resolves = self.prim_store.resolve_primitives(resource_cache, device_pixel_ratio); + + let mut passes = Vec::new(); + + if !compiled_screen_tiles.is_empty() { + let ctx = RenderTargetContext { + layer_store: &self.layer_store, + prim_store: &self.prim_store, + resource_cache: resource_cache, + }; + + // Do the allocations now, assigning each tile's tasks to a render + // pass and target as required. + for index in 0..max_passes_needed { + passes.push(RenderPass::new(index as isize, + index == max_passes_needed-1, + cache_size)); + } + + for compiled_screen_tile in compiled_screen_tiles { + compiled_screen_tile.build(&mut passes); + } + + for pass in &mut passes { + pass.build(&ctx, &mut render_tasks); + + profile_counters.passes.inc(); + profile_counters.targets.add(pass.targets.len()); + } + } + + resource_cache.end_frame(); + + Frame { + device_pixel_ratio: device_pixel_ratio, + background_color: self.background_color, + viewport_size: self.screen_rect.size, + debug_rects: debug_rects, + profile_counters: profile_counters, + passes: passes, + cache_size: cache_size, + layer_texture_data: self.packed_layers.clone(), + render_task_data: render_tasks.render_task_data, + gpu_data16: self.prim_store.gpu_data16.build(), + gpu_data32: self.prim_store.gpu_data32.build(), + gpu_data64: self.prim_store.gpu_data64.build(), + gpu_data128: self.prim_store.gpu_data128.build(), + gpu_geometry: self.prim_store.gpu_geometry.build(), + gpu_resource_rects: self.prim_store.gpu_resource_rects.build(), + deferred_resolves: deferred_resolves, + } + } +} diff --git a/gfx/webrender/src/util.rs b/gfx/webrender/src/util.rs new file mode 100644 index 000000000000..b7b7316431a7 --- /dev/null +++ b/gfx/webrender/src/util.rs @@ -0,0 +1,305 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use euclid::{Point2D, Rect, Size2D}; +use euclid::{TypedRect, TypedPoint2D, TypedSize2D, TypedPoint4D, TypedMatrix4D}; +use webrender_traits::{DeviceIntRect, DeviceIntPoint, DeviceIntSize, DeviceIntLength}; +use webrender_traits::{LayerRect, WorldPoint4D, LayerPoint4D, LayerToWorldTransform}; +use num_traits::Zero; +use time::precise_time_ns; + +#[allow(dead_code)] +pub struct ProfileScope { + name: &'static str, + t0: u64, +} + +impl ProfileScope { + #[allow(dead_code)] + pub fn new(name: &'static str) -> ProfileScope { + ProfileScope { + name: name, + t0: precise_time_ns(), + } + } +} + +impl Drop for ProfileScope { + fn drop(&mut self) { + let t1 = precise_time_ns(); + let ms = (t1 - self.t0) as f64 / 1000000f64; + println!("{} {}", self.name, ms); + } +} + +// TODO: Implement these in euclid! +pub trait MatrixHelpers { + fn transform_point_and_perspective_project(&self, point: &TypedPoint4D) -> TypedPoint2D; + fn transform_rect(&self, rect: &TypedRect) -> TypedRect; + + /// Returns true if this matrix transforms an axis-aligned 2D rectangle to another axis-aligned + /// 2D rectangle. + fn can_losslessly_transform_a_2d_rect(&self) -> bool; + + /// Returns true if this matrix will transforms an axis-aligned 2D rectangle to another axis- + /// aligned 2D rectangle after perspective divide. + fn can_losslessly_transform_and_perspective_project_a_2d_rect(&self) -> bool; + + /// Clears out the portions of the matrix that `transform_rect()` uses. This allows the use of + /// `transform_rect()` while keeping the Z/W transform portions of the matrix intact. + fn reset_after_transforming_rect(&self) -> TypedMatrix4D; + + fn is_identity(&self) -> bool; +} + +impl MatrixHelpers for TypedMatrix4D { + fn transform_point_and_perspective_project(&self, point: &TypedPoint4D) -> TypedPoint2D { + let point = self.transform_point4d(point); + TypedPoint2D::new(point.x / point.w, point.y / point.w) + } + + fn transform_rect(&self, rect: &TypedRect) -> TypedRect { + let top_left = self.transform_point(&rect.origin); + let top_right = self.transform_point(&rect.top_right()); + let bottom_left = self.transform_point(&rect.bottom_left()); + let bottom_right = self.transform_point(&rect.bottom_right()); + TypedRect::from_points(&[top_left, top_right, bottom_right, bottom_left]) + } + + fn can_losslessly_transform_a_2d_rect(&self) -> bool { + self.m12 == 0.0 && self.m14 == 0.0 && self.m21 == 0.0 && self.m24 == 0.0 && self.m44 == 1.0 + } + + fn can_losslessly_transform_and_perspective_project_a_2d_rect(&self) -> bool { + self.m12 == 0.0 && self.m21 == 0.0 + } + + fn reset_after_transforming_rect(&self) -> TypedMatrix4D { + TypedMatrix4D::row_major( + 1.0, 0.0, self.m13, 0.0, + 0.0, 1.0, self.m23, 0.0, + self.m31, self.m32, self.m33, self.m34, + 0.0, 0.0, self.m43, 1.0, + ) + } + + fn is_identity(&self) -> bool { + *self == TypedMatrix4D::identity() + } +} + +pub trait RectHelpers where Self: Sized { + fn contains_rect(&self, other: &Self) -> bool; + fn from_floats(x0: f32, y0: f32, x1: f32, y1: f32) -> Self; + fn is_well_formed_and_nonempty(&self) -> bool; +} + +impl RectHelpers for TypedRect { + + fn contains_rect(&self, other: &Self) -> bool { + self.origin.x <= other.origin.x && + self.origin.y <= other.origin.y && + self.max_x() >= other.max_x() && + self.max_y() >= other.max_y() + } + + fn from_floats(x0: f32, y0: f32, x1: f32, y1: f32) -> Self { + TypedRect::new(TypedPoint2D::new(x0, y0), + TypedSize2D::new(x1 - x0, y1 - y0)) + } + + fn is_well_formed_and_nonempty(&self) -> bool { + self.size.width > 0.0 && self.size.height > 0.0 + } +} + +// Don't use `euclid`'s `is_empty` because that has effectively has an "and" in the conditional +// below instead of an "or". +pub fn rect_is_empty(rect: &TypedRect) -> bool { + rect.size.width == Zero::zero() || rect.size.height == Zero::zero() +} + +#[inline] +pub fn rect_from_points(x0: DeviceIntLength, + y0: DeviceIntLength, + x1: DeviceIntLength, + y1: DeviceIntLength) -> DeviceIntRect { + DeviceIntRect::new(DeviceIntPoint::from_lengths(x0, y0), + DeviceIntSize::from_lengths(x1 - x0, y1 - y0)) +} + +#[inline] +pub fn rect_from_points_f(x0: f32, + y0: f32, + x1: f32, + y1: f32) -> Rect { + Rect::new(Point2D::new(x0, y0), + Size2D::new(x1 - x0, y1 - y0)) +} + +pub fn lerp(a: f32, b: f32, t: f32) -> f32 { + (b - a) * t + a +} + +pub fn subtract_rect(rect: &TypedRect, + other: &TypedRect, + results: &mut Vec>) { + results.clear(); + + let int = rect.intersection(other); + match int { + Some(int) => { + let rx0 = rect.origin.x; + let ry0 = rect.origin.y; + let rx1 = rx0 + rect.size.width; + let ry1 = ry0 + rect.size.height; + + let ox0 = int.origin.x; + let oy0 = int.origin.y; + let ox1 = ox0 + int.size.width; + let oy1 = oy0 + int.size.height; + + let r = TypedRect::from_untyped(&rect_from_points_f(rx0, ry0, ox0, ry1)); + if r.size.width > 0.0 && r.size.height > 0.0 { + results.push(r); + } + let r = TypedRect::from_untyped(&rect_from_points_f(ox0, ry0, ox1, oy0)); + if r.size.width > 0.0 && r.size.height > 0.0 { + results.push(r); + } + let r = TypedRect::from_untyped(&rect_from_points_f(ox0, oy1, ox1, ry1)); + if r.size.width > 0.0 && r.size.height > 0.0 { + results.push(r); + } + let r = TypedRect::from_untyped(&rect_from_points_f(ox1, ry0, rx1, ry1)); + if r.size.width > 0.0 && r.size.height > 0.0 { + results.push(r); + } + } + None => { + results.push(*rect); + } + } +} +#[derive(Debug, Clone, Copy, Eq, PartialEq)] +#[repr(u8)] +pub enum TransformedRectKind { + AxisAligned = 0, + Complex = 1, +} + +#[derive(Debug, Clone)] +pub struct TransformedRect { + pub local_rect: LayerRect, + pub bounding_rect: DeviceIntRect, + pub inner_rect: DeviceIntRect, + pub vertices: [WorldPoint4D; 4], + pub kind: TransformedRectKind, +} + +impl TransformedRect { + pub fn new(rect: &LayerRect, + transform: &LayerToWorldTransform, + device_pixel_ratio: f32) -> TransformedRect { + + let kind = if transform.can_losslessly_transform_and_perspective_project_a_2d_rect() { + TransformedRectKind::AxisAligned + } else { + TransformedRectKind::Complex + }; + + // FIXME(gw): This code is meant to be a fast path for simple transforms. + // However, it fails on transforms that translate Z but result in an + // axis aligned rect. + +/* + match kind { + TransformedRectKind::AxisAligned => { + let v0 = transform.transform_point(&rect.origin); + let v1 = transform.transform_point(&rect.top_right()); + let v2 = transform.transform_point(&rect.bottom_left()); + let v3 = transform.transform_point(&rect.bottom_right()); + + let screen_min_dp = Point2D::new(DevicePixel((v0.x * device_pixel_ratio).floor() as i32), + DevicePixel((v0.y * device_pixel_ratio).floor() as i32)); + let screen_max_dp = Point2D::new(DevicePixel((v3.x * device_pixel_ratio).ceil() as i32), + DevicePixel((v3.y * device_pixel_ratio).ceil() as i32)); + + let screen_rect_dp = Rect::new(screen_min_dp, Size2D::new(screen_max_dp.x - screen_min_dp.x, + screen_max_dp.y - screen_min_dp.y)); + + TransformedRect { + local_rect: *rect, + vertices: [ + Point4D::new(v0.x, v0.y, 0.0, 1.0), + Point4D::new(v1.x, v1.y, 0.0, 1.0), + Point4D::new(v2.x, v2.y, 0.0, 1.0), + Point4D::new(v3.x, v3.y, 0.0, 1.0), + ], + bounding_rect: screen_rect_dp, + kind: kind, + } + } + TransformedRectKind::Complex => { + */ + let vertices = [ + transform.transform_point4d(&LayerPoint4D::new(rect.origin.x, + rect.origin.y, + 0.0, + 1.0)), + transform.transform_point4d(&LayerPoint4D::new(rect.bottom_left().x, + rect.bottom_left().y, + 0.0, + 1.0)), + transform.transform_point4d(&LayerPoint4D::new(rect.bottom_right().x, + rect.bottom_right().y, + 0.0, + 1.0)), + transform.transform_point4d(&LayerPoint4D::new(rect.top_right().x, + rect.top_right().y, + 0.0, + 1.0)), + ]; + + let (mut xs, mut ys) = ([0.0; 4], [0.0; 4]); + + for (vertex, (x, y)) in vertices.iter().zip(xs.iter_mut().zip(ys.iter_mut())) { + let inv_w = 1.0 / vertex.w; + *x = vertex.x * inv_w; + *y = vertex.y * inv_w; + } + + xs.sort_by(|a, b| a.partial_cmp(b).unwrap()); + ys.sort_by(|a, b| a.partial_cmp(b).unwrap()); + + let outer_min_dp = DeviceIntPoint::new((xs[0] * device_pixel_ratio).floor() as i32, + (ys[0] * device_pixel_ratio).floor() as i32); + let outer_max_dp = DeviceIntPoint::new((xs[3] * device_pixel_ratio).ceil() as i32, + (ys[3] * device_pixel_ratio).ceil() as i32); + let inner_min_dp = DeviceIntPoint::new((xs[1] * device_pixel_ratio).ceil() as i32, + (ys[1] * device_pixel_ratio).ceil() as i32); + let inner_max_dp = DeviceIntPoint::new((xs[2] * device_pixel_ratio).floor() as i32, + (ys[2] * device_pixel_ratio).floor() as i32); + + TransformedRect { + local_rect: *rect, + vertices: vertices, + bounding_rect: DeviceIntRect::new(outer_min_dp, + DeviceIntSize::new(outer_max_dp.x - outer_min_dp.x, + outer_max_dp.y - outer_min_dp.y)), + inner_rect: DeviceIntRect::new(inner_min_dp, + DeviceIntSize::new(inner_max_dp.x - inner_min_dp.x, + inner_max_dp.y - inner_min_dp.y)), + kind: kind, + } + /* + } + }*/ + } +} + +#[inline(always)] +pub fn pack_as_float(value: u32) -> f32 { + value as f32 + 0.5 +} diff --git a/gfx/webrender/tests/angle_shader_validation.rs b/gfx/webrender/tests/angle_shader_validation.rs new file mode 100644 index 000000000000..e1572dd8790d --- /dev/null +++ b/gfx/webrender/tests/angle_shader_validation.rs @@ -0,0 +1,85 @@ +extern crate angle; +#[macro_use] +extern crate lazy_static; +extern crate webrender; + +use angle::hl::{BuiltInResources, Output, ShaderSpec, ShaderValidator}; + +include!(concat!(env!("OUT_DIR"), "/shaders.rs")); + + +// from glslang +const FRAGMENT_SHADER: u32 = 0x8B30; +const VERTEX_SHADER: u32 = 0x8B31; + + +#[test] +fn validate_shaders() { + angle::hl::initialize().unwrap(); + + let shared_src = SHADERS.get("shared").unwrap(); + let prim_shared_src = SHADERS.get("prim_shared").unwrap(); + let clip_shared_src = SHADERS.get("clip_shared").unwrap(); + + for (filename, file_source) in SHADERS.iter() { + let is_prim = filename.starts_with("ps_"); + let is_clip = filename.starts_with("cs_"); + let is_vert = filename.ends_with(".vs"); + let is_frag = filename.ends_with(".fs"); + if !(is_prim ^ is_clip) || !(is_vert ^ is_frag) { + continue; + } + + + let base_filename = filename.splitn(2, '.').next().unwrap(); + let mut shader_prefix = format!("#version 300 es\n + // Base shader: {}\n + #define WR_MAX_VERTEX_TEXTURE_WIDTH {}\n", + base_filename, webrender::renderer::MAX_VERTEX_TEXTURE_WIDTH); + + if is_vert { + shader_prefix.push_str("#define WR_VERTEX_SHADER\n"); + } else { + shader_prefix.push_str("#define WR_FRAGMENT_SHADER\n"); + } + + let mut build_configs = vec!["#define WR_FEATURE_TRANSFORM\n"]; + if is_prim { + // the transform feature may be disabled for the prim shaders + build_configs.push("// WR_FEATURE_TRANSFORM disabled\n"); + } + + for config_prefix in build_configs { + let mut shader_source = String::new(); + shader_source.push_str(shader_prefix.as_str()); + shader_source.push_str(config_prefix); + shader_source.push_str(shared_src); + shader_source.push_str(prim_shared_src); + if is_clip { + shader_source.push_str(clip_shared_src); + } + if let Some(optional_src) = SHADERS.get(base_filename) { + shader_source.push_str(optional_src); + } + shader_source.push_str(file_source); + + + let gl_type = if is_vert { VERTEX_SHADER } else { FRAGMENT_SHADER }; + let resources = BuiltInResources::default(); + let validator = ShaderValidator::new(gl_type, + ShaderSpec::Gles3, + Output::Essl, + &resources).unwrap(); + + match validator.compile_and_translate(&[&shader_source]) { + Ok(_) => { + println!("Shader translated succesfully: {}", filename); + }, + Err(_) => { + panic!("Shader compilation failed: {}\n{}", + filename, validator.info_log()); + }, + } + } + } +} diff --git a/gfx/webrender/tests/bug_124.html b/gfx/webrender/tests/bug_124.html new file mode 100644 index 000000000000..a33d078dcb9d --- /dev/null +++ b/gfx/webrender/tests/bug_124.html @@ -0,0 +1,5 @@ + +
+
+
+ \ No newline at end of file diff --git a/gfx/webrender/tests/bug_134.html b/gfx/webrender/tests/bug_134.html new file mode 100644 index 000000000000..471503640ebc --- /dev/null +++ b/gfx/webrender/tests/bug_134.html @@ -0,0 +1,29 @@ + + +
+ +
\ No newline at end of file diff --git a/gfx/webrender/tests/bug_137.html b/gfx/webrender/tests/bug_137.html new file mode 100644 index 000000000000..c472327baf35 --- /dev/null +++ b/gfx/webrender/tests/bug_137.html @@ -0,0 +1,25 @@ + + +
\ No newline at end of file diff --git a/gfx/webrender/tests/bug_143.html b/gfx/webrender/tests/bug_143.html new file mode 100644 index 000000000000..967b53f8ffc8 --- /dev/null +++ b/gfx/webrender/tests/bug_143.html @@ -0,0 +1,11 @@ + +
\ No newline at end of file diff --git a/gfx/webrender/tests/bug_159.html b/gfx/webrender/tests/bug_159.html new file mode 100644 index 000000000000..e4619ba5c749 --- /dev/null +++ b/gfx/webrender/tests/bug_159.html @@ -0,0 +1,2 @@ +

foobar

+
\ No newline at end of file diff --git a/gfx/webrender/tests/bug_166.html b/gfx/webrender/tests/bug_166.html new file mode 100644 index 000000000000..8dbdbabf2959 --- /dev/null +++ b/gfx/webrender/tests/bug_166.html @@ -0,0 +1,10 @@ + + +
FOOBAR
+
FOOBAR
\ No newline at end of file diff --git a/gfx/webrender/tests/bug_176.html b/gfx/webrender/tests/bug_176.html new file mode 100644 index 000000000000..a47554b4c4ae --- /dev/null +++ b/gfx/webrender/tests/bug_176.html @@ -0,0 +1 @@ +
FOOBAR
\ No newline at end of file diff --git a/gfx/webrender/tests/bug_177.html b/gfx/webrender/tests/bug_177.html new file mode 100644 index 000000000000..b962333a4764 --- /dev/null +++ b/gfx/webrender/tests/bug_177.html @@ -0,0 +1,24 @@ + + +
+
+
+ diff --git a/gfx/webrender/tests/bug_178.html b/gfx/webrender/tests/bug_178.html new file mode 100644 index 000000000000..75e34a786ee1 --- /dev/null +++ b/gfx/webrender/tests/bug_178.html @@ -0,0 +1,24 @@ + + +
+
+
\ No newline at end of file diff --git a/gfx/webrender/tests/bug_203a.html b/gfx/webrender/tests/bug_203a.html new file mode 100644 index 000000000000..adca73e08947 --- /dev/null +++ b/gfx/webrender/tests/bug_203a.html @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/gfx/webrender/tests/bug_203b.html b/gfx/webrender/tests/bug_203b.html new file mode 100644 index 000000000000..dc8c41600cdb --- /dev/null +++ b/gfx/webrender/tests/bug_203b.html @@ -0,0 +1,14 @@ + + +
+

content

+ \ No newline at end of file diff --git a/gfx/webrender/tests/bug_servo_10136.html b/gfx/webrender/tests/bug_servo_10136.html new file mode 100644 index 000000000000..bca2e3dc29fc --- /dev/null +++ b/gfx/webrender/tests/bug_servo_10136.html @@ -0,0 +1,11 @@ + + +
whoa
diff --git a/gfx/webrender/tests/bug_servo_10164.html b/gfx/webrender/tests/bug_servo_10164.html new file mode 100644 index 000000000000..8377818cdde8 --- /dev/null +++ b/gfx/webrender/tests/bug_servo_10164.html @@ -0,0 +1,19 @@ + + +
+
+
diff --git a/gfx/webrender/tests/bug_servo_10307.html b/gfx/webrender/tests/bug_servo_10307.html new file mode 100644 index 000000000000..e1775939f110 --- /dev/null +++ b/gfx/webrender/tests/bug_servo_10307.html @@ -0,0 +1,12 @@ + +There should be a red square with a black border around it. +
diff --git a/gfx/webrender/tests/bug_servo_11358.html b/gfx/webrender/tests/bug_servo_11358.html new file mode 100644 index 000000000000..2e99b6ff8602 --- /dev/null +++ b/gfx/webrender/tests/bug_servo_11358.html @@ -0,0 +1,12 @@ + + diff --git a/gfx/webrender/tests/bug_servo_9983a.html b/gfx/webrender/tests/bug_servo_9983a.html new file mode 100644 index 000000000000..92830ed9b1fe --- /dev/null +++ b/gfx/webrender/tests/bug_servo_9983a.html @@ -0,0 +1,17 @@ + +Test passes if there is a single 100x100px orange square. +
diff --git a/gfx/webrender/tests/color_pattern_1.png b/gfx/webrender/tests/color_pattern_1.png new file mode 100644 index 0000000000000000000000000000000000000000..61b47eb268503c923ceb1461cb968a99895415e1 GIT binary patch literal 1693 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6%N?Bp530R%N1DIE+9Y$2X5 zjv*Cu-rhKv>*Ofla_}!-?-9X?Yx$=oS9ruuJz#d3iTCrJ>i3;@s?R_F9Bf)PbDnyBfBoI__V@o=F8}>)Zt=Y5n)B`7zK)-uAm8vW`z1fa1+RLBL-q3Y@0YKy zcWkO*__h8fL&6N{14X0k(Qp_|1EXnRGz|>XH1L-xo-0(=PyG1>V12{j>FVdQ&MBb@ E0GEd#p#T5? literal 0 HcmV?d00001 diff --git a/gfx/webrender/tests/color_pattern_2.png b/gfx/webrender/tests/color_pattern_2.png new file mode 100644 index 0000000000000000000000000000000000000000..e8605692b4bf1785945e327ceef74192897a34a3 GIT binary patch literal 49144 zcmXtZhY z-b>HASFF0K92zn)G5`QTQ;`3x2>?JrenJ5d;UPC;k4js}4c1diK^qZr1tMC<005K# zh0l`OzPY>IK7qLN4<8?^DlphmC=vMn7u_ftDeQ%eGH{>c&}3>D@lO+rc^s&VaU~JS zj#T_FV8d>Sp^mxF@XDcy)9)nGS2qpKP`K@urUk;p=1?-9>g6Qa z?yoS$5%==j$qpvaHi8g1dQkD>hsu4qt(Da+odr>M&m6ywnuQ>$H&N8N~5;Gbt|UeVSDj z1P?2*_jjt?4_!6_ExJT!*Rveg8aB%Vtri(XQp2YKuaormpp~<2nY0oW_J?O8LKcRI zi$}rv5nZ7<>^p6MR26r_z8BCIIl^DZ}jv)T$~awVC6# zInLib@w{Zwyp+Xh0nP8adg+2n?Ed=rWq&MtM~k9NN%|Z8R3+BjPXt~ksfpa-Q|w@r z^Iblhnj}soD1j}$6hWkYfFtxBP*wt`Fd_NP2kMmuV}j8KJ4xHiblE->`t^}M@Di>1Tf>rb0^z5ymxl`{ zu?k~B`z1|$el|miRBCc!{&nOPk{6MQ)6011e^H1X!np8;fN2ROP&d;M9+Cu>M1?Xj zxL9?{A@=G9Lod?KuD6JIaN^>Pcj~+U*8P_lLZ#%nGe}^s_&i16GIZ07>L7T zGWuPk7Gy6eApw~0O5o+e74nHv__jGlB;bcluNpxv+Jz`CaVK4#IDc`;H^%}h0I^8G z71DBI>LadRd7KxBkZ!qk&+u;{RC<3#^{G#U={DLb{{W>!{V_3vd94G?Anq$z3aBu- zFzk+_px}erzNGXG?R_JwHEJC!_Ixpi<#lXxd>)qfJ)+b9LyC=Uz9mH{fT@@(i8&nKq2MupetW)CInzSZ(9qbOEGURU#ClfA*_@%v z-dkzG@r<%~HPZzo$-}+N>LSR5%3<1IV&ua9ei0G6@b!Y$7IkzjP-Bni_9{Ggoje17 zGk1_<^j%v$=?vX)0VLUvB4^B`0*d4`HjP!h60y!BkPEOL?T#X$GUZ>}VCLN8bAO(v2wYRasRgKk5MN&;u&xH~=`+?~z;;GDH)B==2y7 zee>hpV~=`U^9AFOCDM8sQKVrLIQf?xZgENYVYUK=VFCqs9UJW$qg|pL>X)#(sa8XBQ6^{hw?1x)Wfu zCCqTrBGIV04m|jL4MXJ-sz#T^W%<{q!1wNehkw5ua7yHoZQoy?s=*kXeT9p&Ebl$$ z2$zeP0iEqtQ2eiZ<|1#A<(cL%6Zek)^2=-lM-itK8n}mcf&wZVBFz*b=g)pO) zo(@c_-7i!1CgsXR%sSPjC%HNNZcWZhT(XJ8107x`ZJtBT^^WJp@(Ncr>8_U_dT^Mz z&};ktu3EduflrMQpOXVrSdaXt=->_OxW#0{E8QQcKiJ8X4{VMw-j*-L)dA9k1A!fB zELYefSFj=xjNPa9YaP5$Q0vkTJ3BkEv9bSo?Ekj%_Nxm9(XqIW{e zp|a&f55aF+ElAis;@ue93+Ce(s-dZFFMP5v!#*$>B2WYDy{~ng)^pMn;65#YuJh}# zx$Kp92Epd8g733~d;no8nZa--2SuW&v#9H8Td!Hj+du>oj)40nfQU#)YYVvXwpCvj zs2n)=p;HR8UoMU4Pt=wj%6G^OgRU38BwFa4`|{f@5qoD_`m_0uEH>uc^biDVP-W`? zx_wYgXG*jsEGqT)Y>^@E*RpkU5FkrrX`|0wN>LGcXE4#zaDsu3uF;|ozEA2RrjW8N zkOF;b3v)raW-fRc=JfbgdrK4pCrEB}BOdv*_0tRs78FabjPQ`rUyEW=w4841g zA7;-^j}{TCHP@5#z$3yx>yuM1%NQpvZn3JlaGCWGRU*rTLGp5crWJ)jQHM$H+b$&L^iHT)MUDvmrM(peE(|B+Yf^ zrJTEppgeC7!`?(KV>Eg;{bs)V{i(s;K|zS_^WDh-!Pew!|KN`r0KWG#d3~e0_%g-2Zasf!jr|@n@^`E>G``)7gntvhW>P#u;ZxJxVyx27)hU8e-bX<8eWD zTKw^YppX$60iD!*zFLR<3DD}gX8B(l^3+SBQH}fhQXgB?i(H--o@ERBl@{s~T%3CT zcQGs53LvL*UM1x@zZ~r@K{O~~9T;1*+RN1NyR4s;NXFP8W*tDFg4)a;NW^-eo~{Zc za<(c*457~tS^ss!&BPQt5KnM((eu&a()?vdcA?(P?eATa)hxa5E*6gPm@Iml1(py< z*%5>?uw_WqMvR06w`nW31=o$2KY;Qhwp0`SEearrB{_k%D?Q^$6DlR25Q3Z5V}@(T z(8Q08*=_%uh>xGYv5z(I{Zrs+sI}Mp&Qu62jdqYFwouOogPt&igoU>iI zM^NrHT*9_*{o4&g0-8G8Cfk3XQb_H-mZQM`rE(V232hL_@}fx6fzLsr1?In6ixut? z5m`=HPoBB%MYYO-=iVQG5kGD^J^E)|-89qGvGT0LFQO1%l-x*-lp%N9=>Y&lplBf0 zeIvB7ooMp$#*I^N7+lmNl8Lb)nZMhrb9~=XM^Cwzcv^deYt9;pI|~W_Bsi zqp_oec!#?RkzZYVPhAkSZ6`J=z?oP^AoQR1Pf5>jPT!?q7JaNf^hDN+!~P69d60mz z-sU$4EE{Bk+s26vr!l#Iq6kphsVda})RMblYHVy|HSNj@c(|QS`*=R7&lL^Oeehf7 z^kEmdNywDVi~}7HS*%$#P%YPPI@?1fyK*|1+ji%jlu-GXJp0%w4PO{MWWD|wl@Wco zyA{b=94`&EDSDE%ntQv#lDh4@MLIi}TW3*TZ-12*?@fZAa!mBrQdh6$Ot>4#(Ap~o z0Ny44Wq0lAz@`30UY^DlXVAc9f$#M8qnl7tQ?t7}oO3~F0^`hhyxD5?UkHC0ZHZcPQkxPE&LyN&BLg;hrm$kq zwZrj9JP)_Tx)z=1YFQS38MkZqOeAdd1U@xQW*RnGBL&=_UbR!m!NM!ryMGQwadt!x z@g}e(aceFj!R@wx)V9ki0>l|}scL&v#jHk)ca8>)gh)$;gpZB;5egvDcb^7`2OP^= zZuhwQ+Ip^kE6|u+T^wTD7ey1@Z{xtx*o$eSSQFG*9fV4U{|$Y9$RK;Q(1#NY6b;yn zBv7B#gY2DhHrD{|7J~0-;}GJf>>o8AHUi@1D7Zb8Cl9gpkF>oXRb%F6@LIQAU0fQ- z4#teCJN*9YZ&~eNihNkJKxb7muLtnC|CB}|r+(-WhX^Ew`|fi*yq3A>ffnfVMXShR zLazZzq5Mr`6kta98~3VsKo&oS*wb#WIK=GwqR_^&xubWjIc!bH5Yf=+goKt4g2CW^ zmIU zOc(S8bUYa^M?nIbgp*DmMq3Dvr`+$R9dmAA49&w57o(upfLg=ejgY=nn#<##%wUZ2 z$kz7?>M#}Jgyq_iAUOe{WbMeF6^Wno&(EZy{XMtOc?5kEdKSxeAHrJ*TR2&F#5EM9 zCXbRs$eYNT>ul-z8JDnl0uIile~N>H^qV4ti;9%oh6&9d&KbtR>fTRp@W1d%*_M0|_kXINQ z2_;urLj$M(?V)7K5$x-P{mO4P-Jd5eP5OlaJ_3RI$~Zsza1{$eZ9g7G>PVT?-$P2n z^VHuXSOp#)eyK;CPh3a>~Uu5wjO zgwqg!ctGkKv@hO47%TsX8i_6!(Z?ct0Py{dj(MsVO~1|EqQm>_c(KV03k!?KehPG? zAC0aFvY#NWw2a6dDs=&cfHCc7C=*uGn1{?&)vhjlh6j5emwhXDd&r9AC!9;KztDR? zp#VNI+lIjab2`lgI-JB%q-E8IYCt)lr;=2SAtp0x3{%$PhQDRA!2%*oRATz+*662Z zuo*qyT~AL>@BaNB-{EBg)%2BVu6j>8dTn1S=E5}og9VwAc1ifCo?%XiQp2CbP=2pA z#@FKgn&ppV#_JLm5HT_K>Z7^=x&$~(nmm_htO0+ZLXx`bn5RsAzWskS}pH>r60^JrdzWWVi#( z#fJMMkS^o?XevCMuUQ?>Rjqa%1=#$JC*WwZ9>K0N9w}CGn3nntD5qq@j5EDvs@H<@ z*of-15KHJIxKTJHqawa6N{;c};^Jhx_7TNAyS#WC7F$x%FjZlMIsGhveYA!x0Lhy`z;s&9u@{%5c~M(8~n6KpoyBXub`x4wbtR~ zyz$3`m&$%!gvrJn*_48&WhY3Y#HFDGqUErFh&Dysm) zT_gJvU%~VqWexrN1<7IDWu-|b^u(?{)byXiB&{r*@71+R4w0*;kN7qjHfeSrNF>Q4 zZcCebZ-R87Ct|9#IvIiC5-=dWp$UY*aXr*oaluE**K7f=V_a^#iMhOK zpZ8ZkOH0ePts+B>DoyuO!d*_QF>y zI#k*rX04OQpyFdz+Yq*$Q$b;32^j9c1FB(B#bUKUn(g>OLtik9XRtXyE1E`0}PpK?A;rf$niAI6V|*YyU^167C}6jjxZ+gd@~ z|0_gY`jI}EX%=S%#?=-%C;s?>b_A6MY-)_WbUJn3P7}ZiFc>UD0|S& zxB{J+cUDa%15z|2^<(Ds%BMxeKEn=>ID=Y2?xks|_z5tk+sfW0y~DKIJhcW$qqY^mQ4&+*vL)*_^JQ`Q7;J45IB%7EBJr zFMn(G+zZ2Dh$siy1>R8w?mq7ievjNcv#=q-Vr+eRMcdR;&cHwh;UEm>sS`c?<+~PE z{qE^vYgN9W@P+jX)j=FBtzzHlgUjdc)bG%U7;k+#66s83+P78&4j&$ z+3$RM|6(p^4n0tW0#6y>&pRgr_D7pa@rw*Ye1?Cjkdf4IrGiqidv)(t-rXgi^$T^i z9?d+RQ=oq3(LUh~+ugM;SIs+4pSNpX(rr)EbSCfy~P5yTv)ngoC3*pkt1m_|1mWsX@tZ=A@ z_{p#i!JnG7Pxcb$4+9U{?_`>p_ls8$*DJ#-nDZ`=8`X}(y`TX~7^LS%8=b+29=_LuP^ zcgwcoh}DN8+Qk(y5sdHalm(z*bmzu+q4y8Zp6Bh}E@A|lYi23& zUvHIN?*DQC*Ej%U`EeW^9R71UC)na{>s_~p)8QbAjbf4Fk}VLF0Z6}x2ws=w#9cDn z1e?eiaURu7_oFN!16UK&UqTXr<}0cUTS>p&egii$tQI#DdQM}rrnKxMHP7|=n?5w=av2R-s?TUle%JCc;|t504G=jM5?FU{k7hfD z+FaL!_*|At+k;;2vD=NcYX^t!pqms_$0`CyDZO}<3I=IbYEfKaoHQ-=cq#)?{|<~) z>>AYPc)9U`b}C`9#`FPxL666svS~<)z4$3j!u2lh$xx(NeRk< zNQ6xIw}fegmAtMFcw8kUR3e56LMK_-4azbaVz6~jMK@sMeM(-&!MCdPd}%{qdbc4WI9ra79I&{=c+eu3{(<`Y?AKbf!UOCfl;2rA}*J)=Trz|wWbyCz|$#t$)zr05qe)cwYdWuGhv z#%Nk|&*Z5jh!3qsEO4+Lk*UbD^$RHJfui~PkR7v4O5?W@O|ISG-%`4s_t((Qb>;W? zz~lvr$HBxnB=)@&{*#}`<+OrNpy22g>zMK`V=?F^U<7r@Mb3)t*!0`~#yz9o`e=c6 z|BU|G?+qQL9(3c^pHjZK`3twGdof%)0_rD$LB>nK{Z^KixZx#@C2*{tsSvB_@e_{Q z&YIR1k{pmv!p{2P5V5tacLs|*LajIFhMfdgcP46~d;?zi`XKu0Mi8H9WVKx^Wh4O9 zXf^cj_nDfd>KJl$YpXWN{U8qVLn z3K6$`yE~7pLl+P^-5vFgSHeBySBREuc9F5Wbn-cW`6E{4jm= z#4|5+a@)OhkdFxwjEEDPB@;!(i3nja*lRqeiIQ)w@oY`y1gGAIm^D0H3~BE2yH7Ga za}=)_7MVQuiq?7H{f`BZV7&YmW3=y-`&O&+6fO2z-YOhK_zC(4ucwf9qovIA{h3m} z$hvoWext)IJ)}t9|Mf#&<+})7fe*>#NAHE3Nr`c8I@BfeV|FFRq0RUk1{2WAzJ4e* zD&-;rX1xQk=aCpC03J(yi1Hn^AF##paB5IUWLfmJAD=d2GWikBy@oA_ zfCL+5i=EUT^>{!*xu5d0g(?CwCF_Cgx9>bF0Ff<*x)~rl&w|MpNt(auss5{`woj1W z1wMyq4GX*Z_z&LyN+Z*i7B`G|f|Ejygk<325V$~;ob*@>Vc&aEgs0cQda~?}X@1?Q zVr^VXo(uO6G~5oA8g|55sPO}(0A9J9#Cm>!JV*nZT0qa;OZ;4tTg59X=wHX0UI;Z) zU-n^=e$y}F&n_{|A?>YE!|!iKWL7z`u-tw|c@Z>FZ#G`HwFoPP{W=1R0}pk9x&Vck zMtbr{yX=97F1b&0B}b@KoS5%V2*iAIbH*CDd~WMw&v)yd1HX_%=%Y|mVJYjgUQoM) zdg;FHJ0n$oB~9~m{8LIv?B3UN5mD(mWz9mNd!g{XM12c3T?htFRK_yE|M_ZI^BMM^ zrNv0JIzx1G;{+L>d7*J{koD*{6DM4Wv1P+;pAD()&=#q9Z1ohK@C-0bwmqoiF%`W|v;X^2?nifPtM#$dhxjT%7&u%R5-{Jq1 zsglFjZgL+0E>+-kFU;Zi29~+B6Fsgnruc>O<54(>O72$2f^o0KZ6|upYyTp<0yN@)S%f?_d+bb8eVZwa(rtQ zSeub=2=O)zy_0Xt(O`LnrQICB%1k+n$nobhwUE(;`ZK4N7eDsw2&e5q8P&!}@%#{} zbt%KKnq0^@zEpTxQvMLNBrfR5{5KXSu3lbIQIlRZ_YsKuE8yWgZou*?7M90MEFFh| z)V2RnPlW5;_G9d{YKPB`5jh7hvYvs3c30~crg!jbcG64D7g`FZ4lYG8xV=U)MrTj|42&K_tulN!F$ENG#YJcYoz$BSB2kA|@%o2QM;|QJ?3Y3rd;9rHqzPE_>axl% zaL4|himIWBc)i+SDk`I(#;*d!7+1X7<)`Ja^1IdngO?iGX7b-)9CnKB;rm(jPe%Nl zzj_C_kyLR~`oCAOQ_9`TQpynw=_dl=)MZajz7D)=3a!_3c4FpgIk-s|)lDB@7N*gnEL`&A#c5KXvW%kBel7$`+nOV=$9Ch}_Zw-lArva*J244T`#RfLHQcLp0Q zBNau`#*xV~!5e2h58o|9&7ONZWhjqO#w&VLnbr5Q7Hzej?X2)T5YW^@m^H_jS(2y| za15~oaA)dif>lN9EsSW<`8$0Wk+!Cm%1i1U5ii`BzF(M1ufot%@msb`hH3+dl09WC z%`k!eaBWI+UtrdXKs1m~fSN(tW>_y3VGx|&_o7b25Y9o;Ch- z{f;9}7DIMgXhV`k9R>=D7B<tM3hUi?{jm^&iamGEwg1AZ23@R2Pl|_X%S9DM+N)`? z1)JLY*B&R2JASk8JJ9Px7(pZmF`zZ!?Qsfdc})zw-?urd;4p<7ild6_Gm)2t2R{Z# z?p#p9k1ULQM#e_EB|ERkf|j4CZFM*&Pa`;RpyPz40^i_Uc|ga8EXe&nj>C_c(~}D$ zOn@iwl|ZKzkbAq+ie!f~PggWR;hPG>7f|=~IYSnI-Bfp1qsU-20IzowJ7EDJjXaB| z>%D)@6C7q|%MHQZi#!pm&aU*mLQ9(Os^3EoY{5ygt`h;I*UJEz zOyQ6sh6{Q*po0c;LJN)HD*Ar)mJ2Sa9`uj#9!x z4e4c$UrVW|G{0W-VR*Tqspbmwo-Q?eCGS8A*|9v~%$El`(pqN&Dj2rP%xpV2Ofxe%uY_8?^n;)u#m7we_x!Hyz`=NUh{i*tr z5HE5@7!y9DIVuY-)&Oj&{Fj{dhs`;>DhHq*665eA-FhMq3Vay*N|GS@<6tty1@`+- zJV?84><2GOJY8t5kz`3M2=5{!-lhMg>p?WZAH_whmOn=;wiyBgw0FM$o$nwRIdb9n zjcj1x3tY6Qm9-5>9u8%7IG~}IRucr)7f&qZkRdlAgkUH%eN1?IwhF{rv+v5GM$1wh z(nT=qDa9rqq*A_Fk}sdiWvF*JUoLavjO0uK#vz2EOOfi~pfN;zbU(trJ!i|gBFi6H z)2%ah(0_zN#$}Y)_!IPW*+;npQ73PW{t)@)X}Fc-ja;Evr~OSDG_rWtx^yFYd{lDP zYaf=)~X&^7T zKi@jsUu<05v@O(`jCNj>fBI6~i_VT4zMn(L#TsU~)LNLILXqn#cazv4M*N#Evcj@| z#XOqc4meF5-0|X0stnNVH)pXVv_HRGJE%0IUMqCp8ofQn8;$39m-TJ?B%9%X=RMnc z0VU+kvx9aX|GeIf*o3g0gcuYP-3MhfRr6YllRd2B>hH|6^gvZr%yLr|=2P$+ zCHTXn`fK0~8ttgiKilTU!1jF6A430SK7WE<8kR~ar%&p`RgyPud}Zu^k)i7`+>%4U zyi|Ww1`ZfC^6)aUQZfBsLRg^c1&BI#tY_fM$O4pV+o1VO17BaJ&#Fcxu1W$1pHDR( zkcNfN#w2vfe!OeN#!Q)7PFRiA_BL1FqjdA+>Mv8iI7a({NlWz( z3l^!?%lb)ay&VkXFX~28PRC;Dg`G`Jx-BL+b5Lsthogdo7Q>&L&#n4>*%Mt$a`pQG$V9#)m>%#zLfqU<#_Mf41i zP?byEHjZ#v_PhRe2JjQ~ye;H7EmDi-Q(&i!&8kgS1o|Ct5%T4HcbGNZ-Ij41^>p*a zpc0^nJs&0^IE6d*cPS%z!lY@~sa2IZ&FZ1qPtop#b{F9ge>zh2@t=+#p{hXz?zZj&y#%JwsV1GP;@^iah^=xK5 zjDkPfAMaAmeZ*#Ba?J3%fb8#ItK?dXtL=%^?vq;7D&4~?s1r~@Og7al>lFk00E#g# zkmj#Ol4*^((4K(H^}qLWG#B;cnOQVp6*XB|`2U{_RC{S>`B-tebm@$6LHUVk2?g{$F}y^F@*j6!q>{C}iuK+aY9)qR=2!3X zcF+!XAq&^&nN$`VAMji6Z!YYQ6LKghKGOgfk*6DBmIcv(;|32K5>2hVH=XHek{Ivi zvyuL_&i2Q<#XrV9=cHGf#r+2Uw~yb9+eO4*!V!KpoA+vwuUN~~89(^mPT$Sdb|U=L zv6##kVl}YTr5pb)@7tWsh=xZjJ;=J~Z;p;AfuC31U}-~T#u))1m#c=$13$=v{*v0@ zy5(5CS85}bD?|Oniyx3`v>d3^sz5(FI&x)svmHvMk>mM-xZZ;i@=9fc*ZXp zUH+fbB!TCj|Ad2<-m7A27z&_&_>-D_qc^J39oJF7W%JMe`#t%~zVZkHw?m6#w8Nrn zB)=L*Z?A)P_19b)xoWY0s&myX1+HuRSlHWn*o<7)#8+2vvB?j%pP_#8hDV|KOx3O! zD`tp1m^(+Jm~9QGGOu>p$sYO}L_EuNCQ6g}VHx$Sfe_^nVfljxv*pH!$nhjN{HL=g z^iy=UaE7gQP#V!*;~SR`3a*&Yc(?}xdP^15=LM5Q7#U+c_Wo*=DdIu!%q?#N4EKj~ z6WfX0r$WLQersz`u}m?l;R4Fgj3Zg@%)V(8rLyTy!@jaa#Ivkav>RuIvJ9JQz9s ze`FnAIdbNO9eBKYbua&|K!1NAEL_=a$xs0-tbIU-X~+xcw@Sd>7Z&QQWYd*xvCl8wi zXsvxO8w#+S;SWJ*QiBy?0$sj6qU#;spTc?tF zpLfM9w{&;f;Pl-zR9Kpjue7KxR&(+)#(43Pm)x!E=-<&nq|Qfoo%iR_7FWMeXrx~b z&1uMZB6{@NxLG_7lzMf(W^aB&F0>00KaF`l+rFH~Tn&=(?VQGWMH#_iD$r)OMd(=7 zOd<78Tq1yJ&(LAA#;m31YMEnVQ)fhpAp;u!8m$m=_*|&zWIWclx3?d6Fx&=y&V90s z_{`K?pCP~FcVWF$C5eswD#tY>xXec5Xz2zqh2MOO>8zYJVzD9#D}W1ig%@?(j2BOanMN4r@F8OgS)6b z_ir!P)p6jd{SeO8kz=_|BRMM_CE<(p>#BoKbUQkyWSTFnC?*Jo!>n-9#OwBXN$hpC zCBHLIwKwnYLqS3PryD|cHBZRv_z{;M!U}cWWxP?eJoHV#tA|t!d7ke@RD3j{h|6aj zDR*@y(bQ?#I?)CkcVGo$vJ{XYwH9;8h@^2|5w>|j|#%a8S7&D+ym3f zgIfhS{mVHmVgf*(FNt&Az zdmW!{CGro>l#cL?gE7<_Em`4Eh;KyNrP#I@F{o8?Fpr+0A>FrY)HSsXsn1hV4rSkh8bK!b@S3W_t>D|wMz zHs((r!&`?k$ek#YA5ay4!4`|3UjqaqIjn8GrQPWI)jAi(2cDIq>D1i0pE18Dg_BHX z{oASD{{40F9`&CO{1URO>~GYcDQpJ|7nstfqSnorp)s~N{qkFJ)jG)?Ub9f7br3^U z6Px%Wc{T~gBH9!Q#C#aO+f5#qQ5Mgf+;45Z^YKKqL*p z!~erhAqeFUTuBLFI+OkG1b-c%Ac&dbrB4wpEjuK(gB8gXP|;BhSFdn(nPjkJIWQ^h zEaQH%<%sexHrbWRW|g0seKTAf{6=-oUiZhxb;*OROsQc1^@(vJpKau5wv0l5wIIN? zTq#9`eg+zbNZ1~;m9)5=IafgPKqelsJF`W3$*h?kMbvqNd2n#X<$M)EQ38tZw|#FE zKHKVYV4PVSD1Nrwp$UO@f28kNw^l&2g_)|Vs_T<&!tCQM$hP@@AA}jUk$wNa!jk|nPQ88X7F~opkK_XwBC8c~=$f9k?)MvsE zg~{HpGj68Ik#fY7`#t0ehIt` zhY7WtCiX#baTdgM;^yD*xv8kb`n&w9zP<_^g@*QvJkbi1@LbwocH@z&0>@=XJkM)? zLQKrraXt6Rq|>8C9;-pW0S-QmoKXHr00Z3026Xa6eP8pDeP4h@-mca zwl!ih;EFt3F|u?`lAvtBac3has|KuZvmO5+&2PghvH-M6LM_}7ihs&#`9+&2@z*1c z)buAib@TgJc2regT3T96Y^>y$EIMdtXhxlC+!n|A?TI|$>gfobpWqq;&FU$ZYO>IU zpO3%4V#s35G{hlG=&l^~^ir5mO}fn63KL6R5Ty)#;wXo|MB_vY9-#}nC9M`}opcqDF%If03h1TF(zG1q5fPl` zD90=<6ms}VqkMZf^iT-sAwcs2pW8&0$MJg1sQ>|<%-+tBiLED`fN?ExbHM%X=YcqO zt1it_#FqOD2D!M#j$JIQ#ihm)s<`bn*9;mtE?y_{LYI~Akf;;KWiugyXo`%aus4>i zNlU-a%Y**V7U?AF$q(Vlc825IVII+246pDfG}6jMdXu|GBpp-2t^ZzfK%G;gc6fbr zmI&8xwoP0C6s4qKR%=&DLC~aj|2yVZw|GiJ)&}>YQZoC&LHzXBItG$rHs3q!r4;{@ zpW!lK&&r;NBT4tF%I;IWpa>;TT1$1*FnRN|<=7(7=hX&7G#^21eDCPPLzOy}P@A(A zPZl-uI$S0Qzi8UEgts5N97H>G6)iiXwz@@sa-1__j9aP#?~RZXoHjxGM%f+8%V}|Rk|C+i#RWt(eT!1I0W=?t zuz{I+1+O!hDDT>NMU;7+SKCr=4kn!(of`ESA!kwNr!Jk@AIN-1wY|~%22$kEVv67y zLWN{&dkQwR(GMG^oH+FXHg^GhJ#yFmaPJV|WCj@c4_K7^u*=byA^APN)!xM13&?2K zPa6CWIjo;sC7kC3 z&vE+VZ^z+p46)$|PAN2U$ag2Bf8JB&eyevq%9xNxrKD(YZ~yferHRhPBBcw^E{uov zjrOVBPpwxG50=$bNT3WwT$oNPAXL^~7oI~(jP%%RdfMuu5fsdZFa?>~W^VtDoi*F$ zSuL0!G7RLNs$hKD2dc*TPtJv^_Y;*N;(WbHk4dac?RJ8n<%AS5sH!nomF-0&Ld zuoRPV;kM)7h_o7CVim=c4pCX*^N~;^KoYHUCFkz7>Qu)U%QA%%543``5#hW}nuP;s z9Xh!uzv}tJI(?+ki10*r(3iCOjDG_%+dgBpvZf5G<9H4`SXN2EsUjQLSEx??%%nX* zfb$deS^4ea>IB;+t*MC(X-LzFijHotRpTX)qs`BK-EF#8trO;boyF~7jfj{WZi=g> z;zZN^Rnp?Z)*K-9etLu&nR2NVtw0Uu*Hs^ksIZah;#eDQsQh@jRW}0o29LVwF>TCImGHtu3NbI(8-jX-&NLObph`vxM={yiuiU6-kNfo*{xy>f)Jf6R?FYJQkw4*D(ZFY^^K6TouC27|x zb_9iFsTTq=MF^!@iru$;QuT0BO*D`xtDu*;r8sB4EKW&p>YYJJe<9950ppnK<%_}n%e@Er zh@=%P|Y*HjP4nT~m7?_RX$^XR~cWz!`5jDj|qxh_Ld1EWkt*TKmBuUeK7izK3@@lhqjh z7SROP`PU8NBWj+xC@=cE*~rLsl7T^RgT>{v+*DV)Ggf}^axG;5`2K9Adl|)bJ$+y( z$_xL!A)yx928cx3%qZMXU&RfyoX^?hCoD z7+62GLBFefhqW=bC`1vXXG3=_;n_B3bhbZR=@u8SUL@ zp>}>_mZ(zQH;l!}rqfbRrUc&eD3NZ~J^jcs=zPRRz$-uQDWGQ^Wcsx>0Z|`o2Vhku zSx$L9g)|N$Tcj*8-1LEF)(B~l{g;w8?Swml?&6)S*o@c|eIc^Gd8DPz-oIpU9go%DaV<5FA{njW zSxLFyLtr;&ZxwQ=+XTe$;C|LVbYsAfJL%Q&v}~ENrT8UI(A>4`97w^h7Ow;}>8uMt zt$}HSIK2s@kwr>d2XWdG)dDb1^@*I@yvoWR8VeK32YQRcI7VZL`ydHm=p<#QhvEf# z&s7L(*WyUcK7!E&fq<7p{hebevq#(kN?(Tvs)4vxy9(77n$$}5V*on^kJ}|eBpkuh z6n3M}zt4Q%VP}i}lL*i6TD|{__;#7mF#SZ!*Z1HWCa+IhgYCNeLye~yox(!>gYa+MHW`wKjV$pQ*3u_dgn zZ4(r<1uhpuMpuI*Bvj?-0Hzhj`Kj;7=>|*OjU|^x>d4h-Htxovnt)6E_Kud&nD5VTy@%(>GZ&o@Y` z1#DxF9#I{%(+vC|JS=RnT!|C{P!Uyiz0ytQGvmpz7aB@vZr6+QgkM^2q+X6V-9LQU zhgZA#L5uDfPfII)hSA%OdNXmI9b+y%CfBHZX%UYVdcVU-0W40kvMo$nJ7f zaE2J_Y3n>S=6&Owd+k#lQ)!_9$ch7SpjJNn-kWk+uUw5!rtZKv_l9b6u>@E}(EWJp z76CP5!g-1vYeJI&Jx~pLablg$gfp1&0KT*f+C!xztg{v6b~K!LJi%?d#s~lcL?6aa zs3_8@7gb8O@j)cZLLm+lXoN-fot`!{!C^6q&8E`e2zdYS`@SmzlqbT%!kqr!ynty< zW~al}nuwzDe%0VnQxmX?K3yXAU1F&bAls#n8Gtxwjp{Ewtt3xbk=(_m=5pV=TH*;)G zmvS6F?^z1^T3)$K+v9m+3xV@a*Z9TyeS|ptD&e`@CNB5cPz^JK?i#&!ZGQ@>c+b1e!22@>SkJ=+RpQ!F^m-=cR1UO9hu@{zFCP}Xq} zh6>l3jCcHhd?|bc0+l3e%VayIiUtvdh zd<;<5prwg3Fa-u~vVO3oz+D2CJL8kcho}wsV8TVudn0h6Hb;WYYT$9tE>-Jaw5s-kL=`zVG|DZbQMl)FC4ze5rk;!OLL zA6k2QuJTO4m1cxNpVgyvZ!pwYHfLjZzJu%c4khzFO(={WIRK~)g_*Eet$nZ7`U~S& z4~)m>mBO=S)b%xoEJl4%h(@EbPHG^??NRkw1|4SM@3@w26Fg!(VBG>h_UD{VXYmmT z`KJRxA=`b{*`fukGkLiw-RjlrmwE+0ID}oO-KObu)tOy2Ky>a{ zIhmQkW;uc1Y1Uxx@E3sG_5UH*^?l)g`3IXkKVPtW|FV0nJL@`1@&Qj>alcJq3eJMt zE{=Uqj19HnNzZMl3!F`@HfaHlgzbqA0J3A?UbMo1fzQ!?d2G{PtrC24@apo#0BTchLeDs&QLMEEPM z#a}sc(>KuabB#pxFn)F9bxo)z;DT*Vk^%Na9lv)EYTCpFpu%@|>WTf^W*X0V=K36x ztZ1gj>ygl1b7j(_kdYGP0i(4JuND|sOm0-!*+0O`RU(%wNdNN7olnEon}~nGX}78} z)TPm`>H(^9y45b$^JSZmvu?1e-A;!ThwZ*K?lYp=@bDqx{Kj38j;9Uoj>vL|Ye_8{ zLp3J0Q$w-YPTVQYNs50eAXGrFL)HI2n= z_5vFfE_>Yi&k6I(z#ZdYxj0+l`5e)^6BK};bb(}Ln8H_XtEC5+;(oSQ8Nm+g&sVC^ zYPZ@>WUyGQ_4y0vby;if`n>dB?4z9S&k-cNf>u{T{lxb?Ak5v}{Cr<_GLxq#j5kUc zgF&}g)UZq2s9kG`J=HF&ODHP0sWnr%FWcKmBWvS$M`uQosb3KVCy+n9^ZWa-)b=EO zc;xQ>^Vs2I-PKFf>3czXP)Rv;g+kl17St>;p~W zvzF#xOeKeOx3aR|>d}D}=+8j!$-C{`Q{DQ4UX{i_Wzrzg4_IZi9@hpZz*@2|f{vQ&F4Zob$ou+A zHYgqunx7x+M7K7q=PA@l@aNEPdXm4-XeeyVD^Aa7jv!YQ*}qd8RnY z32O1bO2yRp-AXi)4%z_8bQpt7w_QbpINid^3_nTQlYxSMK<5Yh2I80Al^%dZV(s# zATEi%x8_i5+@Q;e>r+^3izM}Q-!8Vth&B{WZt?^clQ~>0N1M&(+pbhwO&3WtK9W#~ z-xCK-5AL)f`hCcC&EH(8Nv$*+fqK}q|9yBU5P{_UU3$yS=-uig1`{fKz>49aM76Zl zai~zEy|JO{>FE{{4hir+V0^whpULy@l{uX~8PPN4w&h)6yonL-CDFNEKNz8yihj7d zlDxks85j!}b#OrG?vZ-DBd)P^x={N_raU(ebc|)w?EO?pO6D`;Fq)a)Rc4*vFRW3m zw_KSxCeAo@#SI(O*#3he>D$IuqgfO^JS-X=Ls*=osGf!fx7{k|Hy;c!F`92xFn5*i zBpyp>IQlE%T;noN!&mTdhOq#qH^KN7maefZ*eFR-s_fRypXwOjV zh)N99&8^-Vz1fl&J-tj}6+=6R4Ym_I;{vweDBWPR!7va{POoz*Bo;Tk!S#}e?miZu z=UrzFh!>oevfQqr2iW7}Ql?``73{Xr=dDn`XMW8Ub&;qDz#8Gz>V*XDrpECJ6d{!R{VB#T{x6XB_2Rg($Bc z*Ekx+J?>D4ut_7Fr;8d*xz1{(jrKcSF2Ap}b1@PwtVA493kZUH;?fR{okR7))oi+8 zIp*UQq#mMhH5s9$qh2Ri6eA)Qaq3$X_csk%$WK09FGRcIR zMyW!TYQ)vIU7=!Fg$B8nDY2e3eq)OwfeObthls>VTf>NK-V85|KbRAC&G`LU?842J zizYqq2i)6hXw;}X3d;Ngh&01-ii$nqwiXEs{4o9Dt7dNg;p;J>3)5|sj2QK74f+uj zjf~8riK87-Lz_b=vU(vsv{HzS!YeWRN=h(*^*uibVc{Iy<4a;^szqsaJbtnaS`GbE{pcHa`tr_wl_r7btH}Rssj5Nq5>~r|+dEIf|JJw*J)+ob^I*vM^IZ6lbTM&FS z?FXu8UTQ4KmVUZ{r^o3e@%AyhRkSdp;*?z7Wng z-LZtewRN=0>eY;wMaVGx%-V~GFn|=^=O6! zVzGyV8IY^n-HuL}CyK)wK};boZ^XX^^B8irykN>{L4@SPdt#z3+H7b)uG{&j%}bxH8suMQ!f6fBi|c!TWNsQx>+K$T1#Ub zUgt+x8J)T>ky+FkXEQ{+y~?1D)V@?&zWCN4oMU9jvVa2~78Va9gI=H;zkN!*s~9Aw ziYPPBW(-xVS~iz}0nof`kto0ib=S|+)*Jhg_gy;3x5u4WJm}Y3My*!cNHydZg#e9tMojXk(0F+_71IJ zFxKlg?jKB$n)IPiWXVG+7pCqugDGqeJ|ttGy&0wP$_?$ty!XH0Tu*hN(^`mdl)ru< zc4@z5zjxzLMxnz(U=md8ynt6}yc}Psg~t4)-IE{Uf#YG0*%KMqs`Jd7X3kivxW;NS zhqKtoF3`|qxO%u2>VJTlJ9p_ug+b$u@)&+oKXp=YqU7ZLV<7O^GX4r|d^y(m)ARNC zD?vG)9JB|Ls%4m)?J6l% zRiea1AyF}K6m<0QdLvu_EiBOUqB%sh>MPf&7dGF-pDv;;oi_n`ncRP z^K5@*Vvhf@Fugg4FwAaEuwD*l^n!QR{KD+cg?)e#lSUuU&F%~Q_VDcKmq{JI1cC3t z`Yz<+lal|=hQ-uI^~V6o>)##l|6MgpN1`pR$lmiSIZeLsbL!rd$4uo(NzHub&q(f$ zx8$Qd87pfF**`M*wsf?*Z3LI1#boKF_=)|H6PW< z3BTR93jlQNb>Lw^{)=!w^XMiu@c&^O*dO4nd`=M3fk@uZ6pTBh>rU>*Zak;c?-VF; z_Cc~P$>i+g>_+W5cP@r?@^iYnrn7-h5tf>YNDF}sKm3?Z&mSiOu?M>ys6`xiq_pjKi(-rOJUOU!$X!Gt)m~^@oQU5urp}4PnmAuQ{(WI) zJQ&2d=PdR5&3{8=#*MpIo}$t~vU8dm6lh20g^9PAMvbkwepQXHhPTNVR%vl^1p*WB ziZHTiD`RNB)#^D@heSs&q1!G&sk`&T&}Sf_LrsjVvaZpeIs0^!G5U)W>?(xQOBn8R zS!RQmAJwMg5XV|r+N~YPxwW$FWJE4`+y?ZzUV^xpno+NJbLCxFX;u4p;Iy%Fh<|bi ziLc%mrW1@(k2>X{ktF)v_X8#?pcpCG-k1O1n~Qe^-Wx*eh6XSA_~w zNz$cH^2ILc^>GUHK9tr0b9DOqFry z&)YhSf%Q_oxuwH#n_9r)_+gW%?6Ni|kA=z4d&~6&`RJbcbgT`yt%?OGqD>Y8toKiM zH*aHOqwI}ICDZa{h7W2#2XN>Z>xG=;OR(}>H17qPy-REBi zlz*xfLE+jnI^l>9tO9u|*PF>Ds?MH2e)MiUJOS<8)bc?>zRE&@gnl%*hpK&%M15J`Z9zfXpQ+_;`y0 zn#oh*q@?uK*@0SJWlHw@H~^Pnl(o%M<2<_}yhiF2h_?Ki8D&qCj?&TmA!tjuG}e^T zq{tZcupPSE#s(FUZJmU@V7DhJiuq#;sCE#c#HD5)*+PwGG8ijFPAQ4Mmk^SnF?07u z6Y)#Wbz)6lZLei+cDX4Ng*K}us+DUwuNrr<+D{018lS**10t{I-)h;}wfBSDpk}{? zW^`VZ@Fh=!^}5!$9f=mw=@WUKNG{7{_y5(`lTf6nj1O*z3f4mq@&-!M2y{#=b&NTU z)5UpgRe8pTFSpdJ@{Md8f+88LgGGjcBVWRx_XCAT6X^Fes(a5(I#dCb3^ZrhBr=w` z*0;@#>1(`|vMS{P3aJxc=iuBwd2zEhA(2Q`Ub0(J%b3k{lo#5LXf3%)oqS87A8v6<)2=nirvX z4``3BzPt;%MKp^FuqHJP7u#PeMoRNn?k;>D3&`Fl`n27 zc=lk>ozg3wE=Q9GJ5ow*nfCfeiE|L@Bnp(X2tG>P}vgXks(#qe^4Q zZGyLY*MhQe9jM*>EWBZ|n|+I;v`W?|8RHQyEiR3PrRJ%6a|P(L4@P1P@7Gk|*KQ1o zs?~X6fZhyIOe+gS`_7}SnETPW{*~?HuSXel&N7z3U;g<*6u0=Na~k9pS)?6ffO*!8 zpX%+V5K)g*Mf&U%CI6B@x-@yAr^)7K`3Bg6UqO%pmo!xEuS)*VIQ;mBMm5i*?w;t! zf4s0ZG`!J#2k$ou*I6ss2x!8@aLLZ5oqr@j+Q_C>g^!L>cDjD@U`C*rgg+l0r94eQ0MqxwlbI}tHhjQr3*Z`Y zR+Go2G6`dCWDg~qrSmwKd|fak6?^SVO)>aYg!s5FA_zCkD!5WpYIXM93`Rd)rdIX5 z=3jJDw0HlS-7P)Hh1lp!fO6=HvpP)Cd^=5IAIIQHO@n74K;f=Uzk3UbG$7QunCf^k z14~Rf7U}h(Wn}8h#&vEu*lEqCWGCA z^Rd-PZ9?DMtD!6&J9C!SaH5RGx!9Dg5iJ^1fu4k^1tB({?1+8*r1@yT)$Vbp>GUTa z$eF4~U(hHBa%Ui7I7R5hNyE;<*s}*YVDyL5+xk2FQ&v$zs3%yNy=a@+aHo&UpE?B+ zm7vky80KffdbCGA?(_I4Fh_)QZuy$a>xIGVIaWgGcbuO$&Z=ImY^eZ}G%H)gOpS!S z5W|gf0!&Ud6Nn%sSfxQ%sQ@?<%n)g*E~FlCf-#j`{h>B2>`30X#t{E@!qW7Qp=K6+ zVr1xpAZ#JIJOxEwoOme?#P4XAY{MNd{(wRF{%!htO)+Itq?zyUpg(TZc;_HB41$&* z%}N73(AYkAcf`u4gr};ec4$?Xj@=uerQPT=hcY!zFKR|Ftk~(#EuP&cthB?@!tDNG z7BUJcYV3F5(4RMsfyu=99b33TfoXE(wV>K=B6z$mgQQ($_&q&by zu}6WXn7q6znnK+yBT&R`h2-3 zCAm|bM0{ap)Yb1(#TKhz!jUbHzmX#Zgk)l2)5mg7tM2$9#n{NrK(~vqiC6)l9c?R} z6_b}UBfmy|db+Vx>Zj($cGN{!z)c9d*y>%u4DB||k^&1VgpQ8J?>eD_#Ptf44)8Sqh{^%m?fD4mJWq-W1QxJaWghI`<8q~BCl+`3?d?vmDgR;`8>}(l z89~{CD#ZyLHz)92kkopYKssa9O!8KWNJMSxvd@tt*QqQ+-S$<;(~#j@Aunki_$%@I+KzrMactNqrW_I6Gh z0Iu8C#!-uNoHLcaORN=Md-Z5VXJn!Udpm?SfwFWAwb^QZ@M6NCijDNm?vex5-jAC% zkeV1^<1U4`c7iL#3^EU~wVi*+i{*Sv?W@Oe>wANeoxM}2(`L^pAa~?puN9P#jnFmw zuTa7ZQNA1lwCZe9Qg>XmAVi1SwS99HF+3a3dZ%YfCmg}4SOzmhncB05HD4|1x#jg_f9PKa6yP})D(y>lxaIzcN{ z&=kK30!}jvle}jG&K6>kdW<={YRKlaC^B4&q}$=CB;ok>cH?JRy`$5^w@)qr)!xI~ z8(=ja93PK(b8{oM5LjGHb^vcVqE?|SRtF4)xM~knxTTClrgk8V`iQf&rw=gJj2Gu(3B4o1+$V zXJTRvo-io$=?JuIZ6q?8vfb~8`xqzf5S_r5IEB-T@nOP!tA{ok_x|eo+;0ykxYdrd zSD8G`|C8y#l>}q}g7A+Ubg@k-E!)54VdB-m+z;~L1i^%ZT;U)E5NLjAGB3(PB$)fu zx3!Ac6fkW~_&+J8i3S?5J6=1QGD`Pef;y=!vIEpSAAKw!<%$KYuRyjYV7H=iKsBCi zFBL{wpo&dN*hGK<6R1(2 z1S#kDla7GKqaprxgKylD(H3hSd~0EOGPyv-LYD+wYXg-6!NkE2vi4{@km&+il(FRH zwLH8ww2Sqf#esC{Y+>Zr*Vi_=m)OAx^A-)k8go#~xgDpXz8sXoPjr`b^5SS0Sc#$p z3!#SH8;DF3%dEop1bzUhK&3|A?Ayb;aX||}HD91e6w*I15a{)Eu>hc-aJ%!*U2l%4 zstSCOy**rCm(=a0PZ}^kPlD{_<(=~2BzO-1t{E$u_~ z>2eE4AU<9!rxu9xU@@CQuLq+n9xvSwa~AIkF9`S4A+${*5>FOE1=1lQ7b0G( z`Za7RJbjFv%U_dct2qjYKdlR~W$Mz7bIuUr90wV{G3IypTBTs7kfq&h?# z9R4ta-)zgA_(A;A0ukdhZ)Kyt{N~CUqL*$!~}8hw(O&dfw?RYi&j^yeEgHi zhP!ui64uuza1pbbt*3*n^uQfvS(s>2**8&)03s#i@$TYHlG#Qw zDUh&t>nPv-MiK7pHtBP-%vwADSf6>Wy?2^BSK(9c zj6B7Nwq+?7HG~WfKQx0SV!?>u@4v|fObwo9t3ydRsz||tT7m>#-A|Tk4XQYTqYgpZ zZUCZhsG@t-i{_3Hx;so)iW~s^rj5UqPheF}Wkch6@#<8Rm7SdpSZA+9xQz64Od%m5 zfPV%6_xkrRM(A&OZBQnU-`(9ErJ2>!)5GQ22nz7Cr>&IN?NqJ2zuBS|<4Kj4YW;ZG zt^aZ#sNJ4#b09*Ju&>1p4E%RHiu)WA5|WUW1#31%vdD5Sj8o@iM71|)Bi_rDG#{ae zhle*#o?h??Uu}WlwpECr;xI!_Qb-O2=&jZ_t1x5hbPJ4B(NLCCBCEl~|Lpv2GoGe*~iZOkvG2bwFF;7f+o46am@**PFj5QM;P$B`sv3kNbi zumWv{=R+D&0+Atww7%k$unA(yE<=#qxv-dvVTNa`&_E<4Bn%1)D%WiAu*5<_${*vb zR-`&xYaj(=$&~#*on^J#Kr2y}a&%-jGBOH?Y5#n)Ae7Jj#FZ4R32U+09Ud3}F1g3* z?M*G$_~-li>0F`P!3;Pbj*gEDRB4VSN%`=3^6{BC|Hd#P-1GTPbSFv0%kWvQRB8=C z?%IN!Ss~-|JSr7@)olpd%CD5L4 zm)sYbrfM(+x3%%a#71pSIaNelSOCzb3-D2K z*%5!h;_?lMT4xx2KdQ7A_V_s7n)cQ{Lae2!a~|(~`;1*-!~yqeBpC|0d~xIUfpEC> z_*o$NQ1zh;>o!op(kuZ>>FaJrM!f~1?Uv+F1QZUxU$q8-rGtY)GzJ}KEmM#p6`IfM zez?ooyb!JQe6bWNz`W`|by6?{{NT(??EX-A6Ck|;0EnLh3{KX8^8t$(y;t?i1^vX0{hP%V zWsf=%@4-FdLbIsYsrLR`UFa?$lN#8a$gmB>%U7U6*?}fp6V~fn=5)Kq0|qVzAfvg0 zfEJbOeXu`2pG*$RNZ^*cEb|oDW`;2CPd_cR4H!~#`>akt)eDtpe^Fy%2v z)e%S=&zHPe?v|(q=W}#y-w!Av*wAdvq5!B_rMyNR7A-1G zTKks-xd!BPnDR~GKn)eVG7&#=Uc{m}K&uVz3}OCsaB)EccyMZS_8e*oMj@B{;M@M8 z%HP9Cq+o*wW=z6{1BFBeyaTIe2n%2lb*Zq!e<$T)^T?>i&wh7#UHt)YQ^I!MRm$We z=jRoXad2n=Q!}nc~zjC&l^*h%SnI?o!gI!8}!HSXh+6`y+A};8VW* z9?!|G&B@6bK~1E8!53dku{(3#S{7Z)&U^2D)!Zy`sLL8#m zHrojy_jmBF}wI1x>GMNnhfCiKOVQ9K1STSXk zua(-+w}%$_B4<~#rMpAL)?bg8lo~rd(L>W2%*%G8aJB5Xu`1?lAnigV`eZnY_V)vj z4Be6>k=DzVcP3l$)mF`=hF)i2a3H2QwS-RH9_K<~2(C&1T9&K*&M+-?B-xCjqaS|^ zzKp#+eRM*lMN=Zlm~#^Q)L9b-%)p5G2p3Lju6p6(Uum##NYqozv6g(Bt#bF^Z=QEt zzHk6b)}R%gvH#GR35R1v_O?@_-ZF&LQCJ?8)i?!=gxr9v(5|mrsU6eQh6V`=63=7C z=1P{DUNeGqv3=GxP6AKDRY=YBih#oTOm1LxH61LNt*LZBoY1{`={Ih0@hS@h_&hLH zWad99$`#qfF~Y}!c<8yoDJxj&pH+M1{8dpKlHghXjNf;lF2F_Ho=!C&4prcOvU z>!m%UaHtjOgKH74m4*oF82bEQ{H~RJ67g=p{a+)n{Mua@t1)ml8g=sVz8_ITfxk}& zS$+E^aQhv=P{()0^OS6RG~M8~j9hpml@eLia7g{}rNUA1o0lV8nQ%1i?p?fYU(&Vq zRtCpTvFCEvGr^AJjf(2iq^bwH(jZ5c~99pOaOM~lmT8e?d><6i$l}q~@5{KzN*ofB=_eMcyI_?c;QF5-F zV*#lVs2QD=7Qk(C#=JKG@&tcGoilVI!VzOB+%m=D35-HQpBk?X=|n*Sp^D#wYV+Ud z$grzR9R2Ttq^3;yJe5?igYTBgJr20Wg)kZu_TkEyVx2}(Ay^HGKr@E$2BH2+??jTX zoMigRHQQ~joR|zfJ+{ae!H(GK>`0n)M9BVv72?UWVLdT{LvB7G(u@Aik-|1dk=C^&4)MO9V6k~>A+8D!=yJ(o()gHh?8PXm_+)GOvO`1qIcC`ols(9cEX7#E|KTx@HKU+N;j}o05yvyjsla6;|=^bG3u5{5F!cUj>8aU9(@Knguk2hB0rj< zmT7oCF;4fiQ@<|PScFcQ|4sK0r$+XiQ!4-gpL@;cD(`c`Qe3CIFLTvrT4h5e+HgK& z*`|p5UhIm!0kNNB`qU1gA^6*81cczSIP`m1bmtUt=SX#-6Auq-&RM-I&J3E+IgQ=J zhRS%WjN5mSBOwISpdmnOx<3+6oh9rN9Cb@V^-u=G37X4}3n&{HWPA|ILHX)hbJi)2 zC3_zTl2Zys(N=dA+LX=YHN;?is_F3cP99)9jgiiu5u??UdCw3H&4SX?ede|Y<{ol6bMU#SY zfnh#Z5h?J~Z0%0xa+a^)Va|63pDBgqCtpuICCEz-oKAnyU+jLhtkD&aNe_AsGiBDre( zmNW@9x+xQ`G|k-@WQYS2 z&(B49{bCf1Nu;^{oQb6&MEY0mlUO%a0ZN!4!m} zeGPf^NKLx~C3}CZuW~TBd3{?rxze&bggo2ACLvK=sTfk1#T95TlFpk3+;h%4+9+$! z!~PEZ)97<(xLfVe3U9U8khaco6{I}!@S@4=EY;?88D|Ilu8;JsSD|!{f?`FWbTu0L zm8!7`j@>2OACUT7<-e@6ia5WC&Nf=A-g06LAx8*~L{YRRl{5clzb{!3Ja||N+Bt*M z{^I{}=l*d6>J{cT7boVya@dn#Ih`n@{pc9Qx5nKf2p8aqAl?qhY9wgPJB!CVxCZYm zFb{~c8AmCz&DW2y<@tAu>3u%oinExvYqfp=lAHVPqsD@^;>2rPat~q96KBpR?pzc$6d<#}Qf5uBDqV?O5TKjE} zM;4M$w$Mi7FcJRJunTb-Nxx`w$BG=PnKjeO>~h!FX}7Z)7PQ^>qjd&aD0ep3xa?4V zA?Ie0z&kq5X-KX($=XR>>?No;J{QVqbJ*`6jugfl7O^wT^V{G!zX?q1DTyeQFcn)X zKC5F5C?1l&M`Zk~q^(6)1f~A8Y3Yu`@`x;x3K0#As6e159TN0Gz*(hx;AY!bRMPL> zEG7}Wn?@o+bVr_8mV!Q0%YOH{>FSWFL$zr_Uv@wHMy;9Q&8h<1Z-2M$U{$%} z4q$2-9jjlU7y;M?BLE4v5dhP~C}NQ?&27ieengDEGQHu5zHzoL0}$a?YacS{5Y5V_ zcpT!ocTr?w5>Z(+ z)Da>k$!5&!&~U60_f8?>rh#ZcUZv!(pGTFud~LQG+*vnAq?|asg`JPnyr&xrkO*G7 zsXO!_u%@}Yv>!U9A1~kNzJWQv*J-a!T#{s#)oSEI5lCV*n5kF+BBG7SXl$LZO;g&^ zdf6A6jr1+cmcXnJTzzQ)5;C&k>IHxewFV$qO9GHCY;d_oDiNo-4WwESHBPa4^x--C z`;IyfhUe;+J!2ec2)=MT@vwpTvyuug%B@7isra)DsgCT??g2PM^GaC~&7`9EKMw3l zrg?u8*GGCaanlIZf<^7DjPqXzww@BEJlr_VL8mu2gFh>D9qvMN4wjzbgG+`y#GLjE zEWDfV)qn1`;TFE;ZVF}1v6FZ6L|TJAG>;3OTHQrIxVHNkhO@bZmuhT!fuW!?OpZrl z==yM&Ls5(({`=#wE&h9|Dk_?^$yh)?vaknvbbd|^FaTsAAt8w&s8X*A?d$7Xj_rq0 z$MRw5IEp&{g?ZDCd99PyctD)yYblWMtB`K(pZB6DtEYGygJB?$DA#1q9nh&$4!0-`2_K2* zs_%30>Nf(=T~r1JUst+4!^l=bhuGivx>J9;ObJ%ZNuQE|e{+>MfrBFkPzCJYbmF2= zOn%*W)Pp0@a@F1W4dgqoa%&Np+!_g@F52Z#>?qDSLu$2|HJ5E*t`|%D0C_7X7uQ0Q zg+drS?kLZ{ZWC2^1yn%9(Fwo{y6wVCt$dKqUP)YJZ67K8HD(S*lDQdBqMwoH{dZRK zf3tP~g*Jg?Mc?64gzL7}kXqw$rYJ+1Ac%iqc}~fBAZhTf+$-j(uCH4m#}FTmeK)uH z8r&mnjr^p*TA1;mD>v~M&^2Zc*tW~96`j1Z)bW8@$c{@5-PME7jSL-Ed!?s_R4_IH zy5T{*C}Chp#?-#RQfKriofwC4AsCvK{uQ}HgFt+feoI?;ayX7a4{~czP z99ibiWSvVX%be$|DMeGPo%l;mKUkb&h~uD@tckp{vdxD}>1AZuQNqx~B&C+0Jr}@I z!gixM5@2(t+-9$b!`9dhtnL`wxn)Rpxju}PbbA0)Gh* zjbqRw?Xg;WyP{J+?SbbF6k0Jc7dUGuT=A})ECUfs*v~VOwVxHn;|+9qhi4i&8i%iZV7E+z#dLtysaI*on3AH;j3q6@%n0%d{#vZcuob1wehRjA zM1i~3Z_aKKj_=-XQoPC>4^RPQ1B?W9TxHSK&_~x|jb^L3jtq16hS4?Xot2`EA62b03$qe*i5_q?Gn08r7e1(G$k-tgT|~8Kg6RD+Avrbbwf`XXpLg zm>UuevRsVL=XL-TF@*|t@Q-w{M<}9V^aP$E)9yvi;Vpnr{d-gpkq*p6qh|1WnYMH$ zV@Ls&QaTVxPBy!I73opXI{j>_)DM1ItjS;cS=M}cP0dS~I4r>;eGI@ac(ogLSm6N5 zGvYV50TUh{EcpEVfWvOg*dO9hY^zOu91`P{u{s5c0ad@KW|;@t62I?DB|xL{m^Puw zm{z10N0G8M!Npx47x*k{xyBj;7-nSM90IVv*N+bwW?2>hNcf++((~b@!C{vlu)H>R zfKxO9io|gs6pk5d5b4=EH2`A>7?Qm{Fi!+1bD#=>AqKJr(y{{oM2+H+meDp+7C@lDVr5UN#e{eCJRHB!+Sk7K-4PYX5|GSLxm`TQi)<{ zT^U01oe7cCFeOHMjUv`Zsj=@$0DN??*d{+;Yh5o_blV*RpDtGqFE6Jg2z^DX)YDd3 zbx*mAuxCIC=HuKb{JrTr;EbTAG{xbV;7s$C4k0bK``Dtt^+iQRL-d1G0cpVSI0Bk! zV5;49`$3)#|HyoNTU3630TSyUGua-u+TvGEWn%!d8^cX@C@4eT#pYOCfpM2oHz)$6 z6_#n5Lx0s{WQ|N+;sK68rAvv017X&Tt>C&$;%x1PfBhHvVODH)|$p~PhxwO8X0RZnn<_pDO5eRt40Zzo&T+U=>lPN~+@>Y(- zNs=T3FjkRZK2pqssd#8E@E=>cI0hYqW3=jwE`KR#Fw61jKJR6+4YJCCTwO;1WMcE6 z&}meS38&9gO!Wxoll9|rex&pv-h@;$-Af7ZOD; zsi*zlUwl}MhLF9zbAWXrFOzR!Ibgst{D{R0yz3SX29DTP5C53{q7D%r#tdPzkIFLc z{6lXYfy16-6Zc1@P;vbA?(j+2bl2~r1`z+v=(z=O_oag&M8IMcG&MJeY0;(&L%_Fo z^M{0lbh=ogCJsRwizmeF?d^ql$zn1ITk!V&zVE<#vo7W&Lx{vn1k_jrr}2Rm4uT*) za!&Kg(J{4{t}b1Jg$zTYR%y(_{BF#=;?Swjz3A;p76_7^kZBfdX)qETI!McS!yIy- z|7{n>*Pn)xugGVLz8q$3vtjpLKT75tmKF!c?&Z8hjFahxy;Cer>!o(uQiVKn`<-e% zM^f}qq&M;|Y|t}uxIPO|exQVIQuKb1vh?F}K?jQa5P^>VP?Vesl+^YyKD-$?l2~FU zCS(BG56IX!+wBtoWChhnO!6`?!~-m20m+U=E_s0Wff>+~kqFIaXXEj|?tvy3Q~X~5 zC_UH0>({Sm4U;lYC%+`CtkoE$lH9lU81weJ{aTgog`hPpRz@>o+F zV*h^0QlwFaIs#Mve$aIh3Ir!Qp5R1>6GrL5A6I_Nx>4&;D~(T~3Q_GrH5Poefc`uB zqbRG8<6|2It#WdpW=(ifLh9ZYEh1RF_)prjnTYi|*T#{Jv}QwNOCt>cNbRYgdoHyUJt_m_PE{-Nmnvj~R9fEUqc4pnW zbqpFbNbi`;%uL>U?>&wkJEpho>#x6Nz7Ee{A%6Y!S3dvzb5c@L*s^7d!E+a4FoW63 zRwG+iA;mc3kb)dZ$VNVsFY&~MOjM-fMG}>X$B#IkU#`HP`+68WTf?X*`kEN;ZXGy~ z!CSY&ix=?u=kVKa2KSo>d}DA+CtyE?N`jh*Y8XXWuP`mm0Dvr~ELM(PNs5Pc+!gIl zwrA@eY)s{`do>ZpcjYeiIX!y=FFxLl$GFFg$ZkBMl#XOfWD-0EX{P z786E)>8YNYT(@^Z>SD$oPxy zt#UkD2W=%ol~M2;1i$zDotXMo3jP89xBa;ubRDOmPLiU?%29w2QvM*u`b+DfY14~b zyx3f4Z8@YJ4MWyAYZQ4kk zEfWw(b--du)S<{>zj5OSs2pFJF{{Vm`&3G9oojv0CgTTKK7Kh)Sx%A-wl=T`t7g7? z_m+wy16J99zX!o17|nd3j>ezbA?G^mMC^Q>)b?WNwJK|KPqw z`>z#iweGj2Xes^>e~5eyM^R_d*~C-wGxHLhLt4v8u0Nk9y+{NvnID{*Ji<&U*dn~ z4)5>YO@wZ)#N4@3ufPP#AbkNU&O?DFp`}Q1Pr*Llo;GK#*ZQiET!Cd1jHD>vM$Sau z!6;i0Nappc=A*n8Vc4*Zlr3uw>30P1DKcrOH?RwIB=SJ!TbPE)79vp~>3UPF}IW#LW~tcoEAc;MUD`{)7(*} zHu{TOqK^1h$TH!Q-=6joZ1Kx7_qS546ha7*C-TJ4;%8AoRIvISo5UtP1Jp&5ND}P~ zOpEG@x*|~|nmt~!?P&kG3Rkg8tkT=}wzw@Ego6cl9X&8)?mXcF>Ojlz<$~C=P*vd~;jijW=sp$23B079(-PjVoNCR)PGL zE@Ft`UEbBwKF~x%8gi7Qc;RJm`&PCxn88M`-<|IK!Y@=UpbhUuFTw~jy1zsd%tchr z(-MJ#yVT+#)kwmN=TsmSH`FMZeG?ns;k* z<&7(pOD$*mo{b?8(&vHSsA46zk|I3(ZQg#{JO#S-*bemP9Fp2~JCZ6~6AFY7j%4#5 z`x(YYy7L!~6c@{6<48rGl7em0UZ&9mO&_prr~&+d%;fmGL}zMFb53(wFTv;l2N=je zz4BXK7;6MBaDfhVAj`}gw=87|C6oXHijsOvV=*w<=vHT5la2~I6SW23eHUtUn?kK7 zWbRxXOw{r(nKX&dmMk&4y%2V9zs4liH6Tvj9tsAEYy|CulG>r@E!Ge$;x4ih`W8of*7!FfAgq z4SmVvB_%ihdcb6O|9yy!m3~fF!>r{NAtYp8$?nG}hM=23y3I?!44H zToYqUP=RL}eL;)K-ck%h#zI3VrZRU#MkGpx6|7(#>&PRIag1Xk6HQj<>Eb3gX+S7bp8MTnaLgzBqBl7npi_?SE^`hiP&1SXi=qA zRf>MvYPHpmDq7T9OHkF?LeT`V@5Gwg6Nx1%mPjIz$ex+|`{M{%X1Vvy9iM)GPmg(E z<}PRE-t)faywCgndShCkr85|*@>`TZ4Qeyq_c4DCpZoXeY^r|NfdlaJ%Mct)OiT=m z6`eT|krkIoVx>fu4PQn|#T40l>m(gPJAw$_8jQ}McG6JY%IX1TUmMxUMd>N)pfm*fTjW@uEHb5#E(HSzwc-*q4(DsP>;utBODeQT5 z5A6@NC$5h1SP)rM#-dVCt5)J`uUaLHf;pNrIZOZkws5Wk$RFv*HUNFuh%e^rw5daf z=|bDih$QV;#1l_WXmWWJ7l4042Sk8HUBDZWMxiDvYY4(2X^(JFZou;Fw;}L>g>9+> zQy9$W?4>&&u-NQ1(ZT?j8v)$)^=0t~AJBcS>!{38H$Dc{~um*(|`G zc1PRM&DXRL@Pzrgo+V@@yPZP*x8BcKx{00`6W1;$m99` z`$;x>`uie^AId|v0dOLpk65UtMKTD6Qnd-+KsflOA{>57=ne|10t-eUWD|-$f$Kbe zPoC>a&<;xZO!^|K?3x?B{EVe4u!Rg|C7syMVm{c~ zjFai^PS)cT98N8uZ96#uM!`-21r zTQ8JroR6@iwNw;4NkX<6O2&(7+#;ulOtyBMMlAaTB8s$iu=0415X+2~hJ8BVC(IAk zk0H`&&8Xb~VoCB8rbi70zzoDZzi7ruFD#{O6ynD%Zc-hciOZ%(M-25ioAf-@ul$3T zS2CWSsd#v#~z(zpP(P%>&&WB>p@VgbKkL>SUaDw2dhONrzQ zAAaJ@4%x+Wl2uypBs|K%<)%gLoci&Fiqiu<=9&dbu*=W}JL6jPw zKR*C}|2XE%8B2b?yeXeN?14`e@1@uP)FfWBz@V-~aDhPPFply(#Fs?A<6BLR{gjUo zdFDlF1Dr&8rre9beo7Cq<{%W5l%T_h9$Y7cPx%QKi_;5e${8A%OHV7p{rf8Qt&AYs z05oU-O)d8r7sRbP3_T+4PT6hff7PEZJBka}X1Zna+mPSP4*QL9G4P^s)!?^5>w)gK z---ev4|^HB zMA6#09F_ntJpT9Fh)%4wgEU2q3k#PBKL9f&zRWR=iBuzjpZJVe0{DQ%IGRzTko)wP zBs)zFK*LLyurtWK-eyJtj)-3?7U6X%&m+`EgSI-^ie{%p2yKdI3d`SH&fUuDR;iLI zCDCzzM}B|%@$dTrrX_S#a`tTL0!de{)FUV;f}o&nT)ARREe<=>hQX^c01b$yzlsDQ z4<0g$@mwH~AR>%zWKpykRv128bE}MfXQ| z{;wetfr{7a`3>O!R!-3NAnfz)Sw3vJBI$5rXtc-3HLd^>C&9veqs~KeV=%NA-*h(-y+-C*vv5-+_ zhwddAz*=6kP%E(<>3qUmVyMSq+A;Y0DzatX=!uEi8-T{=Wrh_$ctFjnRXGgAAX2m} zC*DSa%+U>i-d@kP?%N3K6^2v369d-{wAu*h^g31#T1~5yt;7hR9YR3aO5);R(j@uY zCnZ&4A>?U${f3q%_;_4)mfWy znp3o(X_1uUK5SuuN-&Wa=_A$affxNl`(v+HzkIx4^aA>9>GSlBzkwF0ot*$;$Uk^6m@AfKigV|lr$dK> z^zXl(_;^z_D_nrd>Kh2yPoAv)2<1rU5$+rWKZ)f;zRnfsnq*bxx-La@(<5(fyO5H|C%ZEV5_2Y zoVhRc^5vSi5zm-U5l&i60xCq}E2c7q zuPr`-zF-6H*eOkxSfZ` zL#lb-qSEq2l0Cgi@$w?Ae0j3WB&>fsd9umRk}6gtzD5mV0|L0*paDNzxB$nF!7a;6 zZH0M^%5XtU9Ev~jvfQ%R)_oh78(P-i-r0F4k!|FcqW^sQ=S-g{BY0^F@D;L$H78C$ zyLMnnDnSWVs@&$sA3tN@z%|&}c_X4+RVo`j#%coqurh53b<1C&4acoLlu@oxi>5@8 zZsE&1lf!b}V-Ra(A6u>w2x1#y^pq{Ikwis4WK~Nmursjst+m7jSoR;u z?)-%e1eWtug2Dt3ABvyqx-!9N*|csQ$(AiA@$r!nooNB93_wPPJA3!O%7qJoj2IDu zukSsp8)S-&yg@%Un*6*HiEN>_DkEgc2sGjXM`?=(%5&0p(wWgLpfYzk$jgfBx*R_I z68rYOB76HLXV21mi@dx75I2Bqh7L7Z=F1pUQCo2LASs>=i3p0|TAgc(_s(_7W%;n> zX4Qifcm6_JBhog^_*wh*HD4*%TADOD%b7DRu(uzC5LH*7{;tXiSWsZk;lu4%u;63P zoqHaG!Jh5ggHUoWDWxxeGRDNxU}Mg4l9sARAk&%16pXuSy}3^~JydmmfG+Iff)vP@ z$a&=DDvv)nf8Mk|!5EbitN9216m^{+MEXWcFy+^tJJ+_IA0!qm7>&Js0V0MX0AU1-=SEmUu>pvVuE)ZKquICb z)hE?r0dC!Tj&tXpSJeo)%;eKj%0$70bA)zO$9x{TB_=VIU-+=ts)G}`Y@s(bxM|g~ zFGV%v(yl<}%^Sms6D`rp^j6=#U4`Ui^O}4m@zF}E)))#6Knx-`QXY=LXy7VkGDp%_ zq2Vh@`G@6sYu#Je7d-u~b$T7YeE18KrYcyMGsZuNWx^5#pN|}YPnCz`D`Loy-)PtF zXpwgwA;wwt!Ay}HQ^+;|iHVh1wQ4Y-p>L6vR>9~tyLZ1vR+cSNg$0fju#vv_A)HVX zn8_A;Qx+u^RZR0Ci`htDT*(3?mNDGodc7rba-5$G;j^;JuwzFM^X84=^y%gn4Z(#A z$~(coX#@bmiEf_40O6~^dZ3!MB z@|kCf|K7SKhW=VQ{Yv8LnZi#${l~hoDtSndd@9)H!GtIDANenSR z>D^oY98?Xb^vyYAXvRoKjRUqHbAp!a$$yQn9H&}+tX;c06B%i|bd`t4Lt3{!PSd7m zaCR;pNTk>6m_2&}Sy}SMP+YUJ`0U3Y6}3;14*;NIMM#k^&gqSar*SOxi8~@C`V+vo z(8sYCkFmS+Ze{H=LS*YmzWe4o5#(bFMnmgU!t-xSR<0bvkRfu`73~qCpi=-Zvs;?% z(FTK#6DL|RfBqOwpKc+m^8=ha*Mw`=Xp&h4rig!LK24(KRk5Ik*BI^!{~y|#2}2;l0~+U(lZg`^~P5oI184;eM;7o45dIVMbzoLrGLYX*{< zDt_tKtt08uWv8a+xO=xUD^?7npuiCahkSyA!)ek)T|m>CH3Nx@Q<;szEM`-%Dh6(;aQQg;T*PwfMxN^np9*QYjHl2$X8}Zz8%2J)5 z(g0y>yOjE**ke5<#gnyb2e5keJE}WB6h7IsDf?B(wQIFmwru#5&JS?>cpD-kl~g7+ zPew*r)~+2uL4g>s78E$LWy|Yq-yTFkfwC~ut5@qN?ECa7tjmK27r30`KnIiyagnrU0U@1C;QcWk61_%el22lH|vJqv0eF59LZDVtv&Ez|Z z$hmB{YR)G5z)=WG(@6LpUpIGY+cxKe!e5W{`xL= z?;6*0_Vv9>-@Y61^0GYtH5ha(TJ)h}4}KvpL`Bgv>}g%VJSQiv)v85YKmgZj*CxH3 z@qnoJLPGGnt!${Pcm#0b1e7cT{+McrawXk?*C;8Yw+whs*|{E*R56J~qZT2_P|;2C zOkrc+jV84Lnw@UOq4tMxlNl;)l0k@dP9yfLpa8~2!Mf_Yb9R zU3FtGNrH_V`*HcQ`G9Xn$2_`p*+H{rQD(P0e!Mk1cdA!<8M1OEHOu;M?*ITFb4f%& zRLm5ed*JCwe2p61s#c8zKR=Qyijd=p)288+CqF9@R2YCqkHEtNJ4vE0A}*#aLc-O2 zPMW&l;6iqE-NA|0=DloZnx0{2m!0G}ng0#?Zs<#B|4{4{hh;sc2co`KY0qXc7A_Qq zK(3ZbNh(%M;{5r>RIY4`0J}=S57GTX5^ar(S$rP?A!oGc-IDA-s!jZp!EIoRJQ?_jB;GnE5H|Ed(n4BDS%c14c(il5; zuA+{a>*U1Q=bz`-ci*LcbToCYUZu{}t5m;v6PH}`ei)1A$;pA6H$|e))vFL4&AJsU z2+GgLbUvcdGody(7$DmvoB3nrlkHYIwJyUwgRmZ9vci80`Rezh4rLI4`qpCO0l^C0O;CvJFQxsl)e3f2NhVmcA(-Rw1Y!F0|&05 zrc6;tfb-`A*}VC6l+I0^opb2YWhc)+|93ItwryK?PM>a}=vYN*cla=`?A@z)zb(Cb z(Z@&#uvc<2mG0lCVsbK`4<1lHEe)5P99(ilLekvAkw#9Ac%`Mmg9nhDEb3nyS@J6_ z=`9!a!NCBhnxA5O@b)MFmykI7{8@H(*-4IzvIHw6_~Y$A7_?@P{Czqi%IYedJw!)C zaImu6fYGDpGk^XVWhYXBma?QK*}c0n)vDd1N)^kRZ8vXLXZ`v&Wv8n*}8h}+;V*r|+X~yXmr@8NQpQMUOYzx{(e9d@u2eX6smcK`> z>$PZeyp84UJ0T+fRJac6*N2lQp-&$;eAx2#O`D!!=1d!h6h6i(K@hp<^$u*@*pKXN z^J!F3Q7^D+)nHYfzmS3gM^>+Xn=4o9n%yoftsLvuzlC0JoehkSugT)YAF_M*YwZ2& z71{9;#;9`pHWicA>BV1cBu`db3oMuRGQ|~y8nZfdl8%o1Ir{Z{x5y}V%09vC*v{C4HbrxF_4zf@qDt#~E|03bEhlPz2N7)=;5 z80^@+`!&MDdug%?VKCSe8rt7vB28|t6YJIu(9H2^Fxc~8xhFlx|3%X?XXGpBmY}i9 zr$4|26=Axn&t=u#>QaOZIs<2#ondQ_tvv92fZkpk(b)Sw_vsndlMHtg$zFpH4nGYv zR-K$+`Er;s19V1vp2VtEgQ;EHMtQ_WcxDCwAU3ux2M=~A_Fi6|6YJN%#j#`RE5I7V zV6bQN=02t31Plf{Hf?%?#6(}s&ShUvK?KD zvo*)rnK*xcRr{(T4irk76lEP)5QQy@ghX`xXcm3Ah^;-glIfmF=Uts~D9~>9dcMhd z2Cf;1URT1Xe1fo77QFpR`Rp^;vPIMnEXudverI#1UrC;+0RT97@MU6R#PB>VtsE;> z3?nwy{BT`8cI?{Km7P1gJP8}#v*$I<&(|h0k_u^0WvaZBlX-Lfdfs2Mgt{>?vJ63; zt5+$LrEa-2x_*814$s7$1BgIVdF4rrkqlUlR+Ny4sTaf250(=8W+=%;N@-O{t3YcF z1Hb^b_SnkjGahT}+aV(SenyRZNESVMz|o`d+~Y{-o<0BK+i$ zix+8d`7(LV&LnwzBN-q2(Q*HNDkaHRO)ko=&YjuPr;p_gjq#njo30I@KKZ)<=x6j3 zy}h0bffv~H#wJd-I?1E5#xp(r68t#({8{oeoGVAZ7)iC1YBc@4sfb#(F}}W{j6z~! zG|QKFduH?gr_@2$BRpKuP*n>8&csr+%WX8MUM-vK9j;XEdj}8Y3$kW;bq21xbxMdcvf9RZ(LtQHZ$e-o>|H(P6+B*y=ejPI1GCBOxVdjpV%a+%- zkW|UMF?7mz;?+H`TGfh@_}%j3g;OsSuMlrz?Cjv=$(n?R_jqYckG}{b~e>--sF7a#->Y7YeakZHEy!^mA!=b4Ci{C>x!P}K8ZeDt#g$O4|QryMQMAaEqh+ugZ~wO zvE0`en;U|xEa=h&E?jV6)27$a>+R{-aleLPzvdVTjK)p^Dc9MV#Un?OR>8Q?hZZ>G z=hJ)378+irH%P@w`Vh7F@hdP4+`i4-D#mjdETZyms|;3XKl}60<70jsDv|10TDDyY z2~`tV_TDn9=IUeSj$!7fGjS{^;_a)8kpC)gRr5@u*Td_tLy?pZ0Q&U{W#!7DxEYCf z)Q%bmO*0SS1a!{LrRQIN*=#D{o{_=3zy4aP^8?hoa)s_&ZR7d0GZ^T%VMD34b$f$> zt~++nFEkYA9CiNe#^=vl-T491Jv{i&Pd`yNHkM|mPxHgXiCnHPDd4I_gsw(Wrj(K^!vS*LA%>!Wdpg~Wb!cond@zoDM(D3qQ z>cqt{X6{_J1qJcQjIRIxV*dZ++-5&50|Wtc5etWxfgb=7DQSnD)w+L$yt?;Q9P^Z| z)wMj)lBlLp^!>B1>5X}cdcpKYs`-SX#aD`ryI;Rs2 zhY#bCVg0-lVAbHkM&G|yrw;SSj3Id2Hp-`^(K<4c&!;2QM9YN!GSHy^b%Ze#wz`N2o0)(QFYy%0MG# z&V;Ell;&>V_M=_9BW&KRF6i1g4G{{$PqC9qlx0oy@gZcy2&>nX+Z{ekr@ea>P0b`= zd-v{~ZlOMz2B6lpYYh714|EErG`IZx*wUvD54=q4sFhDm<)eiQanL~h@nnk@v^uFS zG`8A5|M2|Tv)qb`;%vQoBH+AEozl@ImQd&ea6@$G`oP;XBbaXx3xcMlz046ZB7{3t ztrzJiurFZ2M+-=+P`YebA$8*Fuxjusd9nXR(IG;Ct<<<#vP8)qg%=V0Gw>ul8B%nRj08pD4<7J7)|6>lP!U@MxbI+67MZv{v_K?Dfy0$ z?CaEt6RlbqbxigP4W+?l%O$Gh@bSEPEcp0i>kiVob#XOHA0Mbu1FBVn%9X`pvzM0; ztn=^yS6A`(W1771beQP@xIX^d6Co$*i*Wc=L%5EL&rDl^mDQk5v^>F%AZ0RUrnp@H zGNJuTS6LJ%a#qdB358N7%7Tt)Bs38 z=$mg6qre#j;Fg)mo9ox}+&|W7^s6-ju31?O4++6D)jH2I!0jqk2=CdGMBk^keD(Nv zhOS&`^|1l+9UQ1~=MKr<>QsXO;j}GV7D~hwC_04tvm@sD8Cc_j&veUV_Jr9O?5%eQ z0<0XelK2|&PyXNJY!gC8gwVo@6zwO}LOevx3+bZm z#;%jmwKqGU=U;zOUO`9lzJH$)At6?G{=)MIZQDk38FTnTbb38+u3xW7=Le{I=ML{L zT}tO2J8;U)#m-=$Yea-5#|GHZwX1cVAK=Cft2)2+WFka9)Key_40W!muWw(Ht~7vEiT zazu!$jJd9VY%K3BUrzZn)AKK-6dD1!j=}C*w^IG4brpO{qB9t1bNo0T&!12I=x9wv zH-CReeHhIXR8F(B#rigAwHg2-IB3Ay0mKHxGH%W|9IQs#l=2#x`145u)Ym-uhg}=3J^ei z^>{)?gs`jgE?jafl<>8N6@Z2ME0ZR{e@qqev674o4|?_tsI=!CY@Nl~9+^N{xu9WtN4iOv{W^|b@;K~)v*5pkwdGchEy}dcpyg3~X z9wazCoU=`us6Jk3|Nf;*Z>!<|69eE-;6TGmN`|$?x#x3_H3QbLa_CC#RJlX4cQTVF zPqw;UW|>H-+JGP;{6>tBx724127^80$N$Xx?=K-g-`FVUJw)Xt^B8pkmPBuF&&r`g zNvKv00GI4+`iF*6^M-ZvKc&Rft;?T%`%>U2fBG~9Q)FtLmYWY-nz9}>emM=atOd$Cm=vQtVs?oRqX4b=yo*1~>{leime9iR?aO5q`F$W5<1L+}Ib- zCt=mCfrH3VF_C2e03Nx!v-JJ178S*7yLPd&b7!-i>W{bIw!ZU&keao!^J{~3@*ss+3JsQ!xLW%vtKMG4k`I<} zx#4BAogZLFw;gQnX5NQoHUB`tf1rK)|6S(?h>HuLQ>T68=6;Rb&JTbjR+BBh7Jcx6 zC%>-J#BWLTt`PKASOmak`%w{U%DhM{P065 z-QB&^as97cQFY8xuazq$arvx!Y4dxn)ZhzAQnFXFGm!#FJZFVcldg*ip(&o**BuR3RBx#W(7mEgwor5|2t{Y)3z84(zoA!D;aEXo>}9@S$%J~r>9FJmMoD@HESkGARTYnQoDO^ z!i0a30hplCmy)EA;UUuG$&;n`m%J}EJKaoj%5hTF@r(YMHExz>?JM^BR+1#c)6O($ zlIFLe?ANSW<4QDcj3h|~)){~_4-cv9_U%T$`;v9!BDC#!C_(2gYxAy zJ5Qpwx8#wQrs=&Bc?)g~V>5KmH zNb`^qy%V*&nB^r&3M<{23nk(Vdoml5hz*D(!7rgylM?}`lOTr z_-*iDMudcr?vRqwhcjO3vH*G3=pWyItRty`4w~8t|FCRF- zp_gA)yq`t-^@EKY&2Lk=vM4U!sS|YQ0M)A--|oNx=-AQtXA05I0PIK92rf-pxisQy z#1mgLo@=$QnN<2M@3Q>8_Xtvuz!Tc9A8&@1PA9dRv^0^Xt2AKgx#ys5TWHfpJW`r85$U}1=Zm`2 z8las4m-6ho}mun3P0h zn>N%jBf+JVFQ-mr+L!8!Ng_!MU$%@{6DC+x@X2;@p?-8UH*3^Te?C(zT?!w3VEu9I z?V)~shGl2td+i#R5MoaUP%|Lc^O(n@Y2}x(YSqTpg=S;IR zRv)J%)#IxZT|XLEOXb_kB8r0y$11_mAAW$ZzEZz`Nov==N@QdkyuH=ckQDR+Rs&_Q z`^V2u>KPWs*%z$WAFG;>z<~}OG%*6dzx_6Ye^*yWt|Zm|`G;l0htqlYZj;+gnKX%S zrcBY~e5H8lB{*_Kv%?)j6y_+zfKceY3ETn_fcuED3n@S#!J z@EWiTwIWBQc;_AX;}7ePQ@i$64jkx!pPv@ah3A1V?0oOskt{jal%RzXIMTK)uk77R zp0o8CVo#7H2CrJh?D6CAdhnpwN4Kj~As{xEETwW$1K8QIYRC}k#l*03$dF>U{bxV^Xq(Ot z+L-<#)IiJ5uN}^L&XiBnPDEcz)!>q3mC53>A3rPp<`5v}@!uL3=5Tg~O`A;nbS+_< z&JS?UHpM}2`}xr(GLj1lYu2ZiElcp$tt3^dWQ%42knHWvyDL}n(&59LZPJ9u)~#7H zaG=f3hep$wLjHFez?Shz^s&5=0-BsxpK@)9H3QcW**a2W@*M_N0#*t%nWIuA*t%6H zxGAAgqYFevwy{Cy7uc*iaI&{I9ry3&M9Y@4w%6-)3|PCCOA3vKT8_4BN3&C>=-sj< zs4U89k>kffWwjqu{O_s&SfK*eB(_Y1Qy5zww+W3J!P>PT zH^ii6%MDL z&42RpVEuaQk5htwvjOnAuk927py8#4*z2t?9&2A<&#>jghz*Ek`o!s!OMkrjF%hvu z@(dX_PN)W%qHo^~L_~B`5agpCn;QUtd?zQ~TDOk5MuJ!Nb?nGT3pFggB9|Y2fP43f zzn72z!-qq?da!OC$gC7(l5?fGQxT*l9u zh5qp*DAwPfz8g1|lH0O5*RR9u*``0gc1>tIHEIOE{ibe2pt180L`@2fHEuOUXV6hG zxuWLBRkIpkUtrJR-v)EB(M8q`SVx^}W~9ewBP73{A&!nBGTi^MZPV%W%$hZxxpP0k zUZWZba(HG2ppc)(kLQg)|KxU+D)a~sC)Lx&Mc9ooVS>D{+~{Z+I#gVxg$w2T2vSpp z%U5Im%_{(fXuT2u5D*)HOSU}8F_&x?MlBpgoPQj@4gHM<(G4u`lm|?(u8nH&^n~zm zs8S`1KmUA#@#BAf=52W91_0o%?%k;s989dO*51vrcQ0(&qHLe|co;oel-rs#Nu+z3 zBQ#Wb+`kO|&GY|4Y~cuW&|6jw_Py)Nlu1*#RqYlFM=zvid`)F1*#hiU-$u2RDFea5 zQFQOV?b)B4|B(UUhselhciw^m_{5Tyx*1YZgx+)Y>M(Gi>F{0~c>m%5 zh5@jJBM?l-1hhTUmem7SbF=zQCQY40#S|;1AfEsl_&{HTKLu!O01F^`f?e z12@;M)%-zH0kBQWwZHr`KA%C3tG21UdYzu=`qA_Y?MJV_df}XBqx-}YkzQ%KnwC}M z=8D;*v1gu6r)TTdV7hhFrdqNbo}B@>bO~O3QLMR}qFFQ8umNf+oWIFo%oy>cwlT3l zdEie(jLA{7>0&Pf2Q)ZNX|%umD~GP+W)17>G)hSP^V~mN2)w}M`j@G4rwVZa+D29y z+mMC8yR;&OOA|NKY zbV-P5*jPuuHKK%kQSKr9OMe0TP@lIy8d2e0d$hm&5#1s<*-D*4RDpc~H)`JCO5H2O z)QjPfd+}hHV{MMn=6D+uduxO}a1Kykt*jKAH^Z=DLL0^sHEP`8HHvmq1RuBk3JGHlUmf!8$bS;6wxqN@7EU?`S|q+*aK__b^=NYssCS?{}-Y( zCm^j{8rN!HBhEjL>$R?v=VaPU{{GJIwl@HJU_9a?SxHU~eEO+aMV3o^d`v%W{n8QQA=1D^y;O4f0;M}cMNkn65zqCS*LmP2-@Dq30ceQc)S>i9iiXzSzFN(z?wKZG^ z5B`ncejBR30Wz?y0hm7hX}rB!oSk9XG_icAw4_#E9yDwSSFc*v1{w514E3$yI-;W= zM^tw^2Nb%}v=spO z+8<~yRk~M6(&@F=_o&S+jl6y|DXDLi>(?czLkI0HkDZ+d_mic0RH}4 zXd-82X?xtVWnsn)7&+4NXdp3Bgz#Dr1J#1^h~c}97N!v6(7%fOKMyfpxDLegR1NUX zBCAXmkK7-TQ8t5z9uIj~{vm1Q(@3q5N@|5v3`JttZK3U7h*Pc; z_k8bBAbww$Qn5$WcZ;~WfycjD$j%`KB7N80hi3um=GFyO$66QVeUR@}V{ zJ$q{3`9b`$qeh7|+mMi_nH0wO^2=w^`2pU + + + test - fixed position + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/gfx/webrender/tests/mix-blend-mode-2.html b/gfx/webrender/tests/mix-blend-mode-2.html new file mode 100644 index 000000000000..8c7b028b4202 --- /dev/null +++ b/gfx/webrender/tests/mix-blend-mode-2.html @@ -0,0 +1,85 @@ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/gfx/webrender/tests/mix-blend-mode.html b/gfx/webrender/tests/mix-blend-mode.html new file mode 100644 index 000000000000..565feb74feff --- /dev/null +++ b/gfx/webrender/tests/mix-blend-mode.html @@ -0,0 +1,47 @@ + + + + + + +
+
+
+
+
+ + diff --git a/gfx/webrender/tests/nav-1.html b/gfx/webrender/tests/nav-1.html new file mode 100644 index 000000000000..7c3e21bb8041 --- /dev/null +++ b/gfx/webrender/tests/nav-1.html @@ -0,0 +1,15 @@ + + + + nav1 + + + + Goto nav2 + + diff --git a/gfx/webrender/tests/nav-2.html b/gfx/webrender/tests/nav-2.html new file mode 100644 index 000000000000..f05399f329b7 --- /dev/null +++ b/gfx/webrender/tests/nav-2.html @@ -0,0 +1,15 @@ + + + + nav2 + + + + Goto nav1 + + diff --git a/gfx/webrender_bindings/Cargo.toml b/gfx/webrender_bindings/Cargo.toml new file mode 100644 index 000000000000..beba1262504b --- /dev/null +++ b/gfx/webrender_bindings/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "webrender_bindings" +version = "0.1.0" +authors = ["The Mozilla Project Developers"] +license = "MPL-2.0" + +[dependencies] +webrender_traits = {path = "../webrender_traits", version = "0.11.0"} +euclid = "0.10" +app_units = "0.3" +gleam = "0.2" +fnv="1.0" + +[dependencies.webrender] +path = "../webrender" +version = "0.11.0" +default-features = false +features = ["codegen"] + +[target.'cfg(target_os = "macos")'.dependencies] +core-foundation = "0.2.2" + +[target.'cfg(target_os = "windows")'.dependencies] +kernel32-sys = "0.2" +winapi = "0.2.8" diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs new file mode 100644 index 000000000000..4d1e5ff4f4cb --- /dev/null +++ b/gfx/webrender_bindings/src/bindings.rs @@ -0,0 +1,1011 @@ +use fnv::FnvHasher; +use std::collections::HashMap; +use std::ffi::CString; +use std::hash::BuildHasherDefault; +use std::{mem, slice}; +use std::os::raw::{c_void, c_char}; +use gleam::gl; +use webrender_traits::{BorderSide, BorderStyle, BorderRadius}; +use webrender_traits::{PipelineId, ClipRegion}; +use webrender_traits::{Epoch, ColorF, GlyphInstance, ImageDescriptor}; +use webrender_traits::{FilterOp, ImageData, ImageFormat, ImageKey, ImageMask, ImageRendering, RendererKind, MixBlendMode}; +use webrender_traits::{ExternalImageId, RenderApi, FontKey}; +use webrender_traits::{DeviceUintSize, ExternalEvent}; +use webrender_traits::{LayoutPoint, LayoutRect, LayoutSize, LayoutTransform}; +use webrender::renderer::{Renderer, RendererOptions}; +use webrender::renderer::{ExternalImage, ExternalImageHandler, ExternalImageSource}; +use std::sync::{Arc, Mutex, Condvar}; +use app_units::Au; + +extern crate webrender_traits; + +fn pipeline_id_to_u64(id: PipelineId) -> u64 { (id.0 as u64) << 32 + id.1 as u64 } +fn u64_to_pipeline_id(id: u64) -> PipelineId { PipelineId((id >> 32) as u32, id as u32) } + +fn font_key_to_u64(key: FontKey) -> u64 { unsafe { mem::transmute(key) } } +fn u64_to_font_key(key: u64) -> FontKey { unsafe { mem::transmute(key) } } + +fn get_proc_address(glcontext_ptr: *mut c_void, name: &str) -> *const c_void{ + + extern { + fn get_proc_address_from_glcontext(glcontext_ptr: *mut c_void, procname: *const c_char) -> *const c_void; + } + + let symbol_name = CString::new(name).unwrap(); + let symbol = unsafe { + get_proc_address_from_glcontext(glcontext_ptr, symbol_name.as_ptr()) + }; + + // For now panic, not sure we should be though or if we can recover + if symbol.is_null() { + // XXX Bug 1322949 Make whitelist for extensions + println!("Could not find symbol {:?} by glcontext", symbol_name); + } + + symbol as *const _ +} + +extern { + fn is_in_compositor_thread() -> bool; + fn is_in_render_thread() -> bool; +} + +#[no_mangle] +pub extern fn wr_renderer_update(renderer: &mut Renderer) { + renderer.update(); +} + +#[no_mangle] +pub extern fn wr_renderer_render(renderer: &mut Renderer, width: u32, height: u32) { + renderer.render(DeviceUintSize::new(width, height)); +} + +// Call wr_renderer_render() before calling this function. +#[no_mangle] +pub unsafe extern fn wr_renderer_readback(width: u32, height: u32, + dst_buffer: *mut u8, buffer_size: usize) { + assert!(is_in_render_thread()); + + gl::flush(); + + let mut slice = slice::from_raw_parts_mut(dst_buffer, buffer_size); + gl::read_pixels_into_buffer(0, 0, + width as gl::GLsizei, + height as gl::GLsizei, + gl::BGRA, + gl::UNSIGNED_BYTE, + slice); +} + +#[no_mangle] +pub extern fn wr_renderer_set_profiler_enabled(renderer: &mut Renderer, enabled: bool) { + renderer.set_profiler_enabled(enabled); +} + +#[no_mangle] +pub extern fn wr_renderer_current_epoch(renderer: &mut Renderer, + pipeline_id: PipelineId, + out_epoch: &mut Epoch) -> bool { + if let Some(epoch) = renderer.current_epoch(pipeline_id) { + *out_epoch = epoch; + return true; + } + return false; +} + +#[no_mangle] +pub unsafe extern fn wr_renderer_delete(renderer: *mut Renderer) { + Box::from_raw(renderer); +} + +#[no_mangle] +pub unsafe extern fn wr_api_delete(api: *mut RenderApi) { + let api = Box::from_raw(api); + api.shut_down(); +} + +#[no_mangle] +pub unsafe extern fn wr_api_set_root_display_list(api: &mut RenderApi, + state: &mut WrState, + epoch: Epoch, + viewport_width: f32, + viewport_height: f32) { + let root_background_color = ColorF::new(0.3, 0.0, 0.0, 1.0); + let frame_builder = mem::replace(&mut state.frame_builder, + WebRenderFrameBuilder::new(state.pipeline_id)); + //let (dl_builder, aux_builder) = fb.dl_builder.finalize(); + api.set_root_display_list(Some(root_background_color), + epoch, + LayoutSize::new(viewport_width, viewport_height), + frame_builder.dl_builder); + api.generate_frame(); +} +#[no_mangle] +pub extern fn wr_window_new(window_id: u64, + enable_profiler: bool, + out_api: &mut *mut RenderApi, + out_renderer: &mut *mut Renderer) { + assert!(unsafe { is_in_render_thread() }); + + let opts = RendererOptions { + device_pixel_ratio: 1.0, + resource_override_path: None, + enable_aa: false, + enable_subpixel_aa: false, + enable_profiler: enable_profiler, + enable_recording: false, + enable_scrollbars: false, + precache_shaders: false, + renderer_kind: RendererKind::Native, + debug: false, + clear_framebuffer: true, + render_target_debug: false, + clear_color: ColorF::new(1.0, 1.0, 1.0, 1.0), + }; + + let (renderer, sender) = Renderer::new(opts); + renderer.set_render_notifier(Box::new(CppNotifier { window_id: window_id })); + + *out_api = Box::into_raw(Box::new(sender.create_api())); + *out_renderer = Box::into_raw(Box::new(renderer)); +} + +// Call MakeCurrent before this. +#[no_mangle] +pub extern fn wr_gl_init(gl_context: *mut c_void) { + assert!(unsafe { is_in_render_thread() }); + + gl::load_with(|symbol| get_proc_address(gl_context, symbol)); + gl::clear_color(0.3, 0.0, 0.0, 1.0); + + let version = gl::get_string(gl::VERSION); + + println!("WebRender - OpenGL version new {}", version); +} + +#[no_mangle] +pub extern fn wr_state_new(width: u32, height: u32, pipeline: u64) -> *mut WrState { + assert!(unsafe { is_in_compositor_thread() }); + let pipeline_id = u64_to_pipeline_id(pipeline); + + let state = Box::new(WrState { + size: (width, height), + pipeline_id: pipeline_id, + z_index: 0, + frame_builder: WebRenderFrameBuilder::new(pipeline_id), + }); + + Box::into_raw(state) +} + +#[no_mangle] +pub extern fn wr_state_delete(state:*mut WrState) { + assert!(unsafe { is_in_compositor_thread() }); + + unsafe { + Box::from_raw(state); + } +} + +#[no_mangle] +pub extern fn wr_dp_begin(state: &mut WrState, width: u32, height: u32) { + assert!( unsafe { is_in_compositor_thread() }); + state.size = (width, height); + state.frame_builder.dl_builder.list.clear(); + state.z_index = 0; + + let bounds = LayoutRect::new(LayoutPoint::new(0.0, 0.0), LayoutSize::new(width as f32, height as f32)); + + state.frame_builder.dl_builder.push_stacking_context( + webrender_traits::ScrollPolicy::Scrollable, + bounds, + ClipRegion::simple(&bounds), + 0, + &LayoutTransform::identity(), + &LayoutTransform::identity(), + webrender_traits::MixBlendMode::Normal, + Vec::new(), + ); +} + +#[no_mangle] +pub extern fn wr_dp_end(state: &mut WrState, api: &mut RenderApi, epoch: u32) { + assert!( unsafe { is_in_compositor_thread() }); + let root_background_color = ColorF::new(0.3, 0.0, 0.0, 1.0); + let pipeline_id = state.pipeline_id; + let (width, height) = state.size; + + state.frame_builder.dl_builder.pop_stacking_context(); + + let fb = mem::replace(&mut state.frame_builder, WebRenderFrameBuilder::new(pipeline_id)); + + api.set_root_display_list(Some(root_background_color), + Epoch(epoch), + LayoutSize::new(width as f32, height as f32), + fb.dl_builder); + api.generate_frame(); +} + +#[no_mangle] +pub unsafe extern fn wr_renderer_flush_rendered_epochs(renderer: &mut Renderer) -> *mut Vec<(PipelineId, Epoch)> { + let map = renderer.flush_rendered_epochs(); + let pipeline_epochs = Box::new(map.into_iter().collect()); + return Box::into_raw(pipeline_epochs); +} + +#[no_mangle] +pub unsafe extern fn wr_rendered_epochs_next(pipeline_epochs: &mut Vec<(PipelineId, Epoch)>, + out_pipeline: &mut u64, + out_epoch: &mut u32) -> bool { + if let Some((pipeline, epoch)) = pipeline_epochs.pop() { + *out_pipeline = mem::transmute(pipeline); + *out_epoch = mem::transmute(epoch); + return true; + } + return false; +} + +#[no_mangle] +pub unsafe extern fn wr_rendered_epochs_delete(pipeline_epochs: *mut Vec<(PipelineId, Epoch)>) { + Box::from_raw(pipeline_epochs); +} + + +struct CppNotifier { + window_id: u64, +} + +unsafe impl Send for CppNotifier {} + +extern { + fn wr_notifier_new_frame_ready(window_id: u64); + fn wr_notifier_new_scroll_frame_ready(window_id: u64, composite_needed: bool); + fn wr_notifier_pipeline_size_changed(window_id: u64, pipeline: u64, new_width: f32, new_height: f32); + fn wr_notifier_external_event(window_id: u64, raw_event: usize); +} + +impl webrender_traits::RenderNotifier for CppNotifier { + fn new_frame_ready(&mut self) { + unsafe { + wr_notifier_new_frame_ready(self.window_id); + } + } + + fn new_scroll_frame_ready(&mut self, composite_needed: bool) { + unsafe { + wr_notifier_new_scroll_frame_ready(self.window_id, composite_needed); + } + } + + fn pipeline_size_changed(&mut self, + pipeline_id: PipelineId, + new_size: Option) { + let (w, h) = if let Some(size) = new_size { + (size.width, size.height) + } else { + (0.0, 0.0) + }; + unsafe { + let id = pipeline_id_to_u64(pipeline_id); + wr_notifier_pipeline_size_changed(self.window_id, id, w, h); + } + } + + fn external_event(&mut self, event: ExternalEvent) { + unsafe { + wr_notifier_external_event(self.window_id, event.unwrap()); + } + } +} + +// RenderThread WIP notes: +// In order to separate the compositor thread (or ipc receiver) and the render +// thread, some of the logic below needs to be rewritten. In particular +// the WrWindowState and Notifier implementations aren't designed to work with +// a separate render thread. +// As part of that I am moving the bindings closer to WebRender's API boundary, +// and moving more of the logic in C++ land. +// This work is tracked by bug 1328602. +// +// See RenderThread.h for some notes about how the pieces fit together. + +pub struct WebRenderFrameBuilder { + pub root_pipeline_id: PipelineId, + pub dl_builder: webrender_traits::DisplayListBuilder, +} + +impl WebRenderFrameBuilder { + pub fn new(root_pipeline_id: PipelineId) -> WebRenderFrameBuilder { + WebRenderFrameBuilder { + root_pipeline_id: root_pipeline_id, + dl_builder: webrender_traits::DisplayListBuilder::new(root_pipeline_id), + } + } +} + +// XXX (bug 1328602) - This will be removed soon-ish. +struct Notifier { + render_notifier: Arc<(Mutex, Condvar)>, +} + +impl webrender_traits::RenderNotifier for Notifier { + fn new_frame_ready(&mut self) { + assert!( unsafe { !is_in_compositor_thread() }); + let &(ref lock, ref cvar) = &*self.render_notifier; + let mut finished = lock.lock().unwrap(); + *finished = true; + cvar.notify_one(); + } + fn new_scroll_frame_ready(&mut self, _: bool) { + } + + fn pipeline_size_changed(&mut self, + _: PipelineId, + _: Option) { + } +} + +// XXX (bug 1328602) - This will be removed soon-ish. +pub struct WrWindowState { + renderer: Renderer, + api: RenderApi, + root_pipeline_id: PipelineId, + size: DeviceUintSize, + render_notifier_lock: Arc<(Mutex, Condvar)>, + pipeline_epoch_map: HashMap>, + pipeline_sync_list: Vec, +} + +pub struct WrState { + size: (u32, u32), + pipeline_id: PipelineId, + z_index: i32, + frame_builder: WebRenderFrameBuilder, +} + +#[repr(C)] +enum WrExternalImageType { + TEXTURE_HANDLE, + + // TODO(Jerry): handle shmem or cpu raw buffers. + //// MEM_OR_SHMEM, +} + +#[repr(C)] +struct WrExternalImageStruct { + image_type: WrExternalImageType, + + // Texture coordinate + u0: f32, + v0: f32, + u1: f32, + v1: f32, + + // external buffer handle + handle: u32, + + // TODO(Jerry): handle shmem or cpu raw buffers. + //// buff: *const u8, + //// size: usize, +} + +type LockExternalImageCallback = fn(*mut c_void, ExternalImageId) -> WrExternalImageStruct; +type UnlockExternalImageCallback = fn(*mut c_void, ExternalImageId); +type ReleaseExternalImageCallback = fn(*mut c_void, ExternalImageId); + +#[repr(C)] +pub struct WrExternalImageHandler { + external_image_obj: *mut c_void, + lock_func: LockExternalImageCallback, + unlock_func: UnlockExternalImageCallback, + release_func: ReleaseExternalImageCallback, +} + +impl ExternalImageHandler for WrExternalImageHandler { + fn lock(&mut self, id: ExternalImageId) -> ExternalImage { + let image = (self.lock_func)(self.external_image_obj, id); + + match image.image_type { + WrExternalImageType::TEXTURE_HANDLE => + ExternalImage { + u0: image.u0, + v0: image.v0, + u1: image.u1, + v1: image.v1, + source: ExternalImageSource::NativeTexture(image.handle) + }, + } + } + + fn unlock(&mut self, id: ExternalImageId) { + (self.unlock_func)(self.external_image_obj, id); + } + + fn release(&mut self, id: ExternalImageId) { + (self.release_func)(self.external_image_obj, id); + } +} + +#[repr(C)] +pub enum WrMixBlendMode +{ + Normal, + Multiply, + Screen, + Overlay, + Darken, + Lighten, + ColorDodge, + ColorBurn, + HardLight, + SoftLight, + Difference, + Exclusion, + Hue, + Saturation, + Color, + Luminosity, +} + +impl WrMixBlendMode +{ + pub fn to_mix_blend_mode(self) -> MixBlendMode + { + match self + { + WrMixBlendMode::Normal => MixBlendMode::Normal, + WrMixBlendMode::Multiply => MixBlendMode::Multiply, + WrMixBlendMode::Screen => MixBlendMode::Screen, + WrMixBlendMode::Overlay => MixBlendMode::Overlay, + WrMixBlendMode::Darken => MixBlendMode::Darken, + WrMixBlendMode::Lighten => MixBlendMode::Lighten, + WrMixBlendMode::ColorDodge => MixBlendMode::ColorDodge, + WrMixBlendMode::ColorBurn => MixBlendMode::ColorBurn, + WrMixBlendMode::HardLight => MixBlendMode::HardLight, + WrMixBlendMode::SoftLight => MixBlendMode::SoftLight, + WrMixBlendMode::Difference => MixBlendMode::Difference, + WrMixBlendMode::Exclusion => MixBlendMode::Exclusion, + WrMixBlendMode::Hue => MixBlendMode::Hue, + WrMixBlendMode::Saturation => MixBlendMode::Saturation, + WrMixBlendMode::Color => MixBlendMode::Color, + WrMixBlendMode::Luminosity => MixBlendMode::Luminosity, + } + } +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_init_window(root_pipeline_id: u64, + glcontext_ptr: *mut c_void, + enable_profiler: bool, + external_image_handler: *mut WrExternalImageHandler) -> *mut WrWindowState { + assert!( unsafe { is_in_compositor_thread() }); + gl::load_with(|symbol| get_proc_address(glcontext_ptr, symbol)); + gl::clear_color(0.3, 0.0, 0.0, 1.0); + + let version = gl::get_string(gl::VERSION); + + println!("OpenGL version new {}", version); + + let opts = RendererOptions { + device_pixel_ratio: 1.0, + resource_override_path: None, + enable_aa: true, + enable_subpixel_aa: true, + enable_profiler: enable_profiler, + enable_recording: false, + enable_scrollbars: false, + precache_shaders: false, + renderer_kind: RendererKind::Native, + debug: false, + clear_framebuffer: true, + render_target_debug: false, + clear_color: ColorF::new(1.0, 1.0, 1.0, 1.0), + }; + + let (mut renderer, sender) = Renderer::new(opts); + let api = sender.create_api(); + + let notification_lock = Arc::new((Mutex::new(false), Condvar::new())); + let notification_lock_clone = notification_lock.clone(); + let notifier = Box::new(Notifier{render_notifier: notification_lock}); + renderer.set_render_notifier(notifier); + + if !external_image_handler.is_null() { + renderer.set_external_image_handler(Box::new( + unsafe { + WrExternalImageHandler { + external_image_obj: (*external_image_handler).external_image_obj, + lock_func: (*external_image_handler).lock_func, + unlock_func: (*external_image_handler).unlock_func, + release_func: (*external_image_handler).release_func, + } + })); + } + + let pipeline_id = u64_to_pipeline_id(root_pipeline_id); + api.set_root_pipeline(pipeline_id); + api.generate_frame(); + + let state = Box::new(WrWindowState { + renderer: renderer, + api: api, + root_pipeline_id: pipeline_id, + size: DeviceUintSize::new(0, 0), + render_notifier_lock: notification_lock_clone, + pipeline_epoch_map: HashMap::with_hasher(Default::default()), + pipeline_sync_list: Vec::new(), + }); + Box::into_raw(state) +} + +// TODO: Remove. +// This is the code specific to WrWindowState that was taken out of wr_create. +#[no_mangle] +pub extern fn wr_window_init_pipeline_epoch(window: &mut WrWindowState, pipeline: u64, width: u32, height: u32,) { + let pipeline_id = u64_to_pipeline_id(pipeline); + if pipeline_id == window.root_pipeline_id { + window.size = DeviceUintSize::new(width, height); + } + window.pipeline_epoch_map.insert(pipeline_id, Epoch(0)); +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_window_dp_begin(window: &mut WrWindowState, state: &mut WrState, width: u32, height: u32) { + if state.pipeline_id == window.root_pipeline_id { + window.size = DeviceUintSize::new(width, height); + } + + wr_dp_begin(state, width, height); +} + +#[no_mangle] +pub extern fn wr_dp_push_stacking_context(state:&mut WrState, bounds: WrRect, overflow: WrRect, mask: *const WrImageMask, opacity: f32, transform: &LayoutTransform, mix_blend_mode: WrMixBlendMode) +{ + assert!( unsafe { is_in_compositor_thread() }); + state.z_index += 1; + + let bounds = bounds.to_rect(); + let overflow = overflow.to_rect(); + let mix_blend_mode = mix_blend_mode.to_mix_blend_mode(); + // convert from the C type to the Rust type + let mask = unsafe { mask.as_ref().map(|&WrImageMask{image, ref rect,repeat}| ImageMask{image: image, rect: rect.to_rect(), repeat: repeat}) }; + + let clip_region = state.frame_builder.dl_builder.new_clip_region(&overflow, vec![], mask); + + let mut filters: Vec = Vec::new(); + if opacity < 1.0 { + filters.push(FilterOp::Opacity(opacity)); + } + + state.frame_builder.dl_builder.push_stacking_context(webrender_traits::ScrollPolicy::Scrollable, + bounds, + clip_region, + state.z_index, + transform, + &LayoutTransform::identity(), + mix_blend_mode, + filters); + +} + +#[no_mangle] +pub extern fn wr_dp_pop_stacking_context(state: &mut WrState) +{ + assert!( unsafe { is_in_compositor_thread() }); + state.frame_builder.dl_builder.pop_stacking_context() +} + +// TODO: Remove. +fn wait_for_epoch(window: &mut WrWindowState) { + let &(ref lock, ref cvar) = &*window.render_notifier_lock; + let mut finished = lock.lock().unwrap(); + + window.pipeline_sync_list.push(window.root_pipeline_id); + + 'outer: for pipeline_id in window.pipeline_sync_list.iter() { + let epoch = window.pipeline_epoch_map.get(pipeline_id); + if epoch.is_none() { + // We could only push a pipeline_id for iframe without setting its root_display_list data. + continue; + } + + if epoch.unwrap().0 == 0 { + // This pipeline_id is not set the display_list yet, so skip the waiting. + continue; + } + + loop { + // Update all epochs. + window.renderer.update(); + + if let Some(rendered_epoch) = window.renderer.current_epoch(*pipeline_id) { + if *(epoch.unwrap()) == rendered_epoch { + continue 'outer; + } + } + + // If the epoch is not matched, starts to wait for next frame updating. + while !*finished { + finished = cvar.wait(finished).unwrap(); + } + // For the next sync one + *finished = false; + } + } + window.pipeline_sync_list.clear(); +} + +// TODO: Remove. +#[no_mangle] +pub fn wr_composite_window(window: &mut WrWindowState) { + assert!(unsafe { is_in_compositor_thread() }); + + gl::clear(gl::COLOR_BUFFER_BIT); + + wait_for_epoch(window); + window.renderer.render(window.size); +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_window_dp_end(window: &mut WrWindowState, state: &mut WrState) { + assert!( unsafe { is_in_compositor_thread() }); + let root_background_color = ColorF::new(0.3, 0.0, 0.0, 1.0); + let pipeline_id = state.pipeline_id; + let (width, height) = state.size; + + if let Some(epoch) = window.pipeline_epoch_map.get_mut(&pipeline_id) { + (*epoch).0 += 1; + + state.frame_builder.dl_builder.pop_stacking_context(); + + let fb = mem::replace(&mut state.frame_builder, WebRenderFrameBuilder::new(pipeline_id)); + + //let (dl_builder, aux_builder) = fb.dl_builder.finalize(); + window.api.set_root_display_list(Some(root_background_color), + *epoch, + LayoutSize::new(width as f32, height as f32), + fb.dl_builder); + window.api.generate_frame(); + + return; + } + + panic!("Could not find epoch for pipeline_id:({},{})", pipeline_id.0, pipeline_id.1); +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_add_image(window: &mut WrWindowState, width: u32, height: u32, stride: u32, format: ImageFormat, bytes: * const u8, size: usize) -> ImageKey { + wr_api_add_image(&mut window.api, width, height, stride, format, bytes, size) +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_add_external_image_texture(window: &mut WrWindowState, width: u32, height: u32, format: ImageFormat, external_image_id: u64) -> ImageKey { + wr_api_add_external_image_texture(&mut window.api, width, height, format, external_image_id) +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_update_image(window: &mut WrWindowState, key: ImageKey, width: u32, height: u32, format: ImageFormat, bytes: * const u8, size: usize) { + wr_api_update_image(&mut window.api, key, width, height, format, bytes, size); +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_delete_image(window: &mut WrWindowState, key: ImageKey) { + wr_api_delete_image(&mut window.api, key); +} + +#[no_mangle] +pub extern fn wr_api_set_root_pipeline(api: &mut RenderApi, pipeline_id: u64) { + api.set_root_pipeline(u64_to_pipeline_id(pipeline_id)); + api.generate_frame(); +} + +#[no_mangle] +pub extern fn wr_api_add_image(api: &mut RenderApi, width: u32, height: u32, stride: u32, format: ImageFormat, bytes: * const u8, size: usize) -> ImageKey { + assert!( unsafe { is_in_compositor_thread() }); + let bytes = unsafe { slice::from_raw_parts(bytes, size).to_owned() }; + let stride_option = match stride { + 0 => None, + _ => Some(stride), + }; + + api.add_image(ImageDescriptor{width: width, height: height, stride: stride_option, format: format, is_opaque: false}, ImageData::new(bytes)) +} + +#[no_mangle] +pub extern fn wr_api_add_external_image_texture(api: &mut RenderApi, width: u32, height: u32, format: ImageFormat, external_image_id: u64) -> ImageKey { + assert!( unsafe { is_in_compositor_thread() }); + api.add_image(ImageDescriptor{width:width, height:height, stride:None, format: format, is_opaque: false}, ImageData::External(ExternalImageId(external_image_id))) +} + +#[no_mangle] +pub extern fn wr_api_update_image(api: &mut RenderApi, key: ImageKey, width: u32, height: u32, format: ImageFormat, bytes: * const u8, size: usize) { + assert!( unsafe { is_in_compositor_thread() }); + let bytes = unsafe { slice::from_raw_parts(bytes, size).to_owned() }; + api.update_image(key, ImageDescriptor{width:width, height:height, stride:None, format:format, is_opaque: false}, bytes); +} +#[no_mangle] +pub extern fn wr_api_delete_image(api: &mut RenderApi, key: ImageKey) { + assert!( unsafe { is_in_compositor_thread() }); + api.delete_image(key) +} + +#[no_mangle] +pub extern fn wr_api_send_external_event(api: &mut RenderApi, evt: usize) { + assert!(unsafe { is_in_compositor_thread() }); + + api.send_external_event(ExternalEvent::from_raw(evt)); +} + + +#[no_mangle] +pub extern fn wr_dp_push_rect(state: &mut WrState, rect: WrRect, clip: WrRect, r: f32, g: f32, b: f32, a: f32) { + assert!( unsafe { is_in_compositor_thread() }); + let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip.to_rect(), Vec::new(), None); + + state.frame_builder.dl_builder.push_rect( + rect.to_rect(), + clip_region, + ColorF::new(r, g, b, a)); +} + +#[no_mangle] +pub extern fn wr_dp_push_border(state: &mut WrState, rect: WrRect, clip: WrRect, + top: WrBorderSide, right: WrBorderSide, bottom: WrBorderSide, left: WrBorderSide, + top_left_radius: WrLayoutSize, top_right_radius: WrLayoutSize, + bottom_left_radius: WrLayoutSize, bottom_right_radius: WrLayoutSize) { + assert!( unsafe { is_in_compositor_thread() }); + let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip.to_rect(), Vec::new(), None); + let radius = BorderRadius { top_left: top_left_radius.to_layout_size(), + top_right: top_right_radius.to_layout_size(), + bottom_left: bottom_left_radius.to_layout_size(), + bottom_right: bottom_right_radius.to_layout_size() }; + state.frame_builder.dl_builder.push_border( + rect.to_rect(), + clip_region, + left.to_border_side(), + top.to_border_side(), + right.to_border_side(), + bottom.to_border_side(), + radius); +} + +#[no_mangle] +pub extern fn wr_window_dp_push_iframe(window: &mut WrWindowState, state: &mut WrState, rect: WrRect, clip: WrRect, layers_id: u64) { + assert!( unsafe { is_in_compositor_thread() }); + + let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip.to_rect(), + Vec::new(), + None); + let pipeline_id = PipelineId((layers_id >> 32) as u32, layers_id as u32); + window.pipeline_sync_list.push(pipeline_id); + state.frame_builder.dl_builder.push_iframe(rect.to_rect(), + clip_region, + pipeline_id); +} + +#[no_mangle] +pub extern fn wr_dp_push_iframe(state: &mut WrState, rect: WrRect, clip: WrRect, layers_id: u64) { + assert!( unsafe { is_in_compositor_thread() }); + + let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip.to_rect(), + Vec::new(), + None); + let pipeline_id = u64_to_pipeline_id(layers_id); + state.frame_builder.dl_builder.push_iframe(rect.to_rect(), + clip_region, + pipeline_id); +} + +#[repr(C)] +pub struct WrColor +{ + r: f32, + g: f32, + b: f32, + a: f32 +} + +impl WrColor +{ + pub fn to_color(&self) -> ColorF + { + ColorF::new(self.r, self.g, self.b, self.a) + } +} + +#[repr(C)] +pub struct WrBorderSide +{ + width: f32, + color: WrColor, + style: BorderStyle +} + +impl WrBorderSide +{ + pub fn to_border_side(&self) -> BorderSide + { + BorderSide { width: self.width, color: self.color.to_color(), style: self.style } + } +} + +#[repr(C)] +pub struct WrLayoutSize +{ + width: f32, + height: f32 +} + +impl WrLayoutSize +{ + pub fn to_layout_size(&self) -> LayoutSize + { + LayoutSize::new(self.width, self.height) + } +} + +#[repr(C)] +pub struct WrRect +{ + x: f32, + y: f32, + width: f32, + height: f32 +} + +impl WrRect +{ + pub fn to_rect(&self) -> LayoutRect + { + LayoutRect::new(LayoutPoint::new(self.x, self.y), LayoutSize::new(self.width, self.height)) + } +} + +#[repr(C)] +pub struct WrImageMask +{ + image: ImageKey, + rect: WrRect, + repeat: bool +} + +impl WrImageMask +{ + pub fn to_image_mask(&self) -> ImageMask + { + ImageMask { image: self.image, rect: self.rect.to_rect(), repeat: self.repeat } + } +} + +#[repr(C)] +pub enum WrTextureFilter +{ + Linear, + Point, +} +impl WrTextureFilter +{ + pub fn to_image_rendering(self) -> ImageRendering + { + match self + { + WrTextureFilter::Linear => ImageRendering::Auto, + WrTextureFilter::Point => ImageRendering::Pixelated, + } + } +} + +#[no_mangle] +pub extern fn wr_dp_push_image(state:&mut WrState, bounds: WrRect, clip : WrRect, mask: *const WrImageMask, filter: WrTextureFilter, key: ImageKey) { + assert!( unsafe { is_in_compositor_thread() }); + + let bounds = bounds.to_rect(); + let clip = clip.to_rect(); + + // convert from the C type to the Rust type, mapping NULL to None + let mask = unsafe { mask.as_ref().map(|m| m.to_image_mask()) }; + let image_rendering = filter.to_image_rendering(); + + let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip, Vec::new(), mask); + state.frame_builder.dl_builder.push_image( + bounds, + clip_region, + bounds.size, + bounds.size, + image_rendering, + key + ); +} + +#[no_mangle] +pub extern fn wr_api_add_raw_font(api: &mut RenderApi, + font_buffer: *mut u8, + buffer_size: usize) -> u64 +{ + assert!( unsafe { is_in_compositor_thread() }); + + let font_slice = unsafe { + slice::from_raw_parts(font_buffer, buffer_size as usize) + }; + let mut font_vector = Vec::new(); + font_vector.extend_from_slice(font_slice); + + return font_key_to_u64(api.add_raw_font(font_vector)); +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_window_add_raw_font(window: &mut WrWindowState, + font_buffer: *mut u8, + buffer_size: usize) -> u64 +{ + return wr_api_add_raw_font(&mut window.api, font_buffer, buffer_size); +} + +#[no_mangle] +pub extern fn wr_dp_push_text(state: &mut WrState, + bounds: WrRect, + clip: WrRect, + color: WrColor, + font_key: u64, + glyphs: *mut GlyphInstance, + glyph_count: u32, + glyph_size: f32) +{ + assert!( unsafe { is_in_compositor_thread() }); + + let font_key = u64_to_font_key(font_key); + + let glyph_slice = unsafe { + slice::from_raw_parts(glyphs, glyph_count as usize) + }; + let mut glyph_vector = Vec::new(); + glyph_vector.extend_from_slice(&glyph_slice); + + let colorf = ColorF::new(color.r, color.g, color.b, color.a); + + let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip.to_rect(), Vec::new(), None); + + state.frame_builder.dl_builder.push_text(bounds.to_rect(), + clip_region, + glyph_vector, + font_key, + colorf, + Au::from_f32_px(glyph_size), + Au::from_px(0)); +} + +#[no_mangle] +pub extern fn wr_window_remove_pipeline(window: &mut WrWindowState, state: &WrState) { + window.pipeline_epoch_map.remove(&state.pipeline_id); +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_readback_into_buffer(width: u32, height: u32, + dst_buffer: *mut u8, buffer_size: usize) { + unsafe { + let mut slice = slice::from_raw_parts_mut(dst_buffer, buffer_size); + gl::read_pixels_into_buffer(0, 0, + width as gl::GLsizei, + height as gl::GLsizei, + gl::BGRA, + gl::UNSIGNED_BYTE, + slice); + } +} + +// TODO: Remove. +#[no_mangle] +pub extern fn wr_profiler_set_enabled(window: &mut WrWindowState, enabled: bool) +{ + assert!( unsafe { is_in_compositor_thread() }); + window.renderer.set_profiler_enabled(enabled); +} diff --git a/gfx/webrender_bindings/src/lib.rs b/gfx/webrender_bindings/src/lib.rs new file mode 100644 index 000000000000..62dddc04ce72 --- /dev/null +++ b/gfx/webrender_bindings/src/lib.rs @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +extern crate webrender; +extern crate webrender_traits; +extern crate euclid; +extern crate app_units; +extern crate gleam; +extern crate fnv; + +#[cfg(target_os="macos")] +extern crate core_foundation; + +#[cfg(target_os="windows")] +extern crate kernel32; +#[cfg(target_os="windows")] +extern crate winapi; + +#[allow(non_snake_case)] +pub mod bindings; diff --git a/gfx/webrender_traits/Cargo.toml b/gfx/webrender_traits/Cargo.toml new file mode 100644 index 000000000000..2064f49163bd --- /dev/null +++ b/gfx/webrender_traits/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "webrender_traits" +version = "0.11.0" +authors = ["Glenn Watson "] +license = "MPL-2.0" +repository = "https://github.com/servo/webrender" +build = "build.rs" +workspace = ".." + +[features] +default = ["codegen"] +nightly = ["euclid/unstable", "serde/unstable"] +codegen = ["serde_codegen", "serde_codegen/with-syntex"] +ipc = ["ipc-channel"] + +[dependencies] +app_units = "0.3.0" +byteorder = "0.5" +euclid = "0.10.3" +gleam = "0.2" +heapsize = "0.3.6" +offscreen_gl_context = {version = "0.5.0", features = ["serde_serialization"]} +serde = "0.8" +serde_derive = {version = "0.8", optional = true} +ipc-channel = { version = "0.5.0", optional = true } + +[target.'cfg(target_os = "macos")'.dependencies] +core-graphics = "0.5" + +[target.'cfg(target_os = "windows")'.dependencies] +dwrote = "0.1.1" + +[build-dependencies.serde_codegen] +version = "0.8" +default_features = false +optional = true diff --git a/gfx/webrender_traits/build.rs b/gfx/webrender_traits/build.rs new file mode 100644 index 000000000000..c07d8d8a6eba --- /dev/null +++ b/gfx/webrender_traits/build.rs @@ -0,0 +1,46 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#[cfg(all(feature = "serde_codegen", not(feature = "serde_derive")))] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/types.rs"); + let dst = Path::new(&out_dir).join("types.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + println!("cargo:rerun-if-changed=src/types.rs"); + } +} + +#[cfg(all(feature = "serde_derive", not(feature = "serde_codegen")))] +mod inner { + pub fn main() {} +} + +#[cfg(all(feature = "serde_codegen", feature = "serde_derive"))] +mod inner { + pub fn main() { + panic!("serde_codegen and serde_derive are both used. \ + You probably forgot --no-default-features.") + } +} + +#[cfg(not(any(feature = "serde_codegen", feature = "serde_derive")))] +mod inner { + pub fn main() { + panic!("Neither serde_codegen nor serde_derive are used. " + "You probably want --features serde_derive --no-default-features.") + } +} + +fn main() { + inner::main(); +} diff --git a/gfx/webrender_traits/src/api.rs b/gfx/webrender_traits/src/api.rs new file mode 100644 index 000000000000..e4069dc52733 --- /dev/null +++ b/gfx/webrender_traits/src/api.rs @@ -0,0 +1,257 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use byteorder::{LittleEndian, WriteBytesExt}; +use channel::{self, MsgSender, PayloadHelperMethods, PayloadSender}; +use offscreen_gl_context::{GLContextAttributes, GLLimits}; +use std::cell::Cell; +use {ApiMsg, ColorF, DisplayListBuilder, Epoch, ImageDescriptor}; +use {FontKey, IdNamespace, ImageKey, NativeFontHandle, PipelineId}; +use {RenderApiSender, ResourceId, ScrollEventPhase, ScrollLayerState, ScrollLocation, ServoScrollRootId}; +use {GlyphKey, GlyphDimensions, ImageData, WebGLContextId, WebGLCommand}; +use {DeviceIntSize, LayoutPoint, LayoutSize, WorldPoint}; +use VRCompositorCommand; +use ExternalEvent; + +impl RenderApiSender { + pub fn new(api_sender: MsgSender, + payload_sender: PayloadSender) + -> RenderApiSender { + RenderApiSender { + api_sender: api_sender, + payload_sender: payload_sender, + } + } + + pub fn create_api(&self) -> RenderApi { + let RenderApiSender { + ref api_sender, + ref payload_sender + } = *self; + let (sync_tx, sync_rx) = channel::msg_channel().unwrap(); + let msg = ApiMsg::CloneApi(sync_tx); + api_sender.send(msg).unwrap(); + RenderApi { + api_sender: api_sender.clone(), + payload_sender: payload_sender.clone(), + id_namespace: sync_rx.recv().unwrap(), + next_id: Cell::new(ResourceId(0)), + } + } +} + +pub struct RenderApi { + pub api_sender: MsgSender, + pub payload_sender: PayloadSender, + pub id_namespace: IdNamespace, + pub next_id: Cell, +} + +impl RenderApi { + pub fn clone_sender(&self) -> RenderApiSender { + RenderApiSender::new(self.api_sender.clone(), self.payload_sender.clone()) + } + + pub fn add_raw_font(&self, bytes: Vec) -> FontKey { + let new_id = self.next_unique_id(); + let key = FontKey::new(new_id.0, new_id.1); + let msg = ApiMsg::AddRawFont(key, bytes); + self.api_sender.send(msg).unwrap(); + key + } + + pub fn add_native_font(&self, native_font_handle: NativeFontHandle) -> FontKey { + let new_id = self.next_unique_id(); + let key = FontKey::new(new_id.0, new_id.1); + let msg = ApiMsg::AddNativeFont(key, native_font_handle); + self.api_sender.send(msg).unwrap(); + key + } + + /// Gets the dimensions for the supplied glyph keys + /// + /// Note: Internally, the internal texture cache doesn't store + /// 'empty' textures (height or width = 0) + /// This means that glyph dimensions e.g. for spaces (' ') will mostly be None. + pub fn get_glyph_dimensions(&self, glyph_keys: Vec) + -> Vec> { + let (tx, rx) = channel::msg_channel().unwrap(); + let msg = ApiMsg::GetGlyphDimensions(glyph_keys, tx); + self.api_sender.send(msg).unwrap(); + rx.recv().unwrap() + } + + /// Creates an `ImageKey`. + pub fn alloc_image(&self) -> ImageKey { + let new_id = self.next_unique_id(); + ImageKey::new(new_id.0, new_id.1) + } + + /// Adds an image and returns the corresponding `ImageKey`. + pub fn add_image(&self, + descriptor: ImageDescriptor, + data: ImageData) -> ImageKey { + let key = self.alloc_image(); + let msg = ApiMsg::AddImage(key, descriptor, data); + self.api_sender.send(msg).unwrap(); + key + } + + /// Updates a specific image. + /// + /// Currently doesn't support changing dimensions or format by updating. + // TODO: Support changing dimensions (and format) during image update? + pub fn update_image(&self, + key: ImageKey, + descriptor: ImageDescriptor, + bytes: Vec) { + let msg = ApiMsg::UpdateImage(key, descriptor, bytes); + self.api_sender.send(msg).unwrap(); + } + + /// Deletes the specific image. + pub fn delete_image(&self, key: ImageKey) { + let msg = ApiMsg::DeleteImage(key); + self.api_sender.send(msg).unwrap(); + } + + /// Sets the root pipeline. + /// + /// # Examples + /// + /// ```ignore + /// let (mut renderer, sender) = webrender::renderer::Renderer::new(opts); + /// let api = sender.create_api(); + /// ... + /// let pipeline_id = PipelineId(0,0); + /// api.set_root_pipeline(pipeline_id); + /// ``` + pub fn set_root_pipeline(&self, pipeline_id: PipelineId) { + let msg = ApiMsg::SetRootPipeline(pipeline_id); + self.api_sender.send(msg).unwrap(); + } + + /// Supplies a new frame to WebRender. + /// + /// Non-blocking, it notifies a worker process which processes the display list. + /// When it's done and a RenderNotifier has been set in `webrender::renderer::Renderer`, + /// [new_frame_ready()][notifier] gets called. + /// + /// Note: Scrolling doesn't require an own Frame. + /// + /// Arguments: + /// + /// * `background_color`: The background color of this pipeline. + /// * `epoch`: The unique Frame ID, monotonically increasing. + /// * `pipeline_id`: The ID of the pipeline that is supplying this display list. + /// * `viewport_size`: The size of the viewport for this frame. + /// * `display_list`: The root Display list used in this frame. + /// * `auxiliary_lists`: Various items that the display lists and stacking contexts reference. + /// + /// [notifier]: trait.RenderNotifier.html#tymethod.new_frame_ready + pub fn set_root_display_list(&self, + background_color: Option, + epoch: Epoch, + viewport_size: LayoutSize, + builder: DisplayListBuilder) { + let pipeline_id = builder.pipeline_id; + let (display_list, auxiliary_lists) = builder.finalize(); + let msg = ApiMsg::SetRootDisplayList(background_color, + epoch, + pipeline_id, + viewport_size, + display_list.descriptor().clone(), + *auxiliary_lists.descriptor()); + self.api_sender.send(msg).unwrap(); + + let mut payload = vec![]; + payload.write_u32::(epoch.0).unwrap(); + payload.extend_from_slice(display_list.data()); + payload.extend_from_slice(auxiliary_lists.data()); + self.payload_sender.send_vec(payload).unwrap(); + } + + /// Scrolls the scrolling layer under the `cursor` + /// + /// Webrender looks for the layer closest to the user + /// which has `ScrollPolicy::Scrollable` set. + pub fn scroll(&self, scroll_location: ScrollLocation, cursor: WorldPoint, phase: ScrollEventPhase) { + let msg = ApiMsg::Scroll(scroll_location, cursor, phase); + self.api_sender.send(msg).unwrap(); + } + + pub fn scroll_layers_with_scroll_root_id(&self, + new_scroll_origin: LayoutPoint, + pipeline_id: PipelineId, + scroll_root_id: ServoScrollRootId) { + let msg = ApiMsg::ScrollLayersWithScrollId(new_scroll_origin, pipeline_id, scroll_root_id); + self.api_sender.send(msg).unwrap(); + } + + pub fn tick_scrolling_bounce_animations(&self) { + let msg = ApiMsg::TickScrollingBounce; + self.api_sender.send(msg).unwrap(); + } + + /// Translates a point from viewport coordinates to layer space + pub fn translate_point_to_layer_space(&self, point: &WorldPoint) + -> (LayoutPoint, PipelineId) { + let (tx, rx) = channel::msg_channel().unwrap(); + let msg = ApiMsg::TranslatePointToLayerSpace(*point, tx); + self.api_sender.send(msg).unwrap(); + rx.recv().unwrap() + } + + pub fn get_scroll_layer_state(&self) -> Vec { + let (tx, rx) = channel::msg_channel().unwrap(); + let msg = ApiMsg::GetScrollLayerState(tx); + self.api_sender.send(msg).unwrap(); + rx.recv().unwrap() + } + + pub fn request_webgl_context(&self, size: &DeviceIntSize, attributes: GLContextAttributes) + -> Result<(WebGLContextId, GLLimits), String> { + let (tx, rx) = channel::msg_channel().unwrap(); + let msg = ApiMsg::RequestWebGLContext(*size, attributes, tx); + self.api_sender.send(msg).unwrap(); + rx.recv().unwrap() + } + + pub fn resize_webgl_context(&self, context_id: WebGLContextId, size: &DeviceIntSize) { + let msg = ApiMsg::ResizeWebGLContext(context_id, *size); + self.api_sender.send(msg).unwrap(); + } + + pub fn send_webgl_command(&self, context_id: WebGLContextId, command: WebGLCommand) { + let msg = ApiMsg::WebGLCommand(context_id, command); + self.api_sender.send(msg).unwrap(); + } + + pub fn generate_frame(&self) { + let msg = ApiMsg::GenerateFrame; + self.api_sender.send(msg).unwrap(); + } + + pub fn send_vr_compositor_command(&self, context_id: WebGLContextId, command: VRCompositorCommand) { + let msg = ApiMsg::VRCompositorCommand(context_id, command); + self.api_sender.send(msg).unwrap(); + } + + pub fn send_external_event(&self, evt: ExternalEvent) { + let msg = ApiMsg::ExternalEvent(evt); + self.api_sender.send(msg).unwrap(); + } + + pub fn shut_down(&self) { + self.api_sender.send(ApiMsg::ShutDown).unwrap(); + } + + #[inline] + fn next_unique_id(&self) -> (u32, u32) { + let IdNamespace(namespace) = self.id_namespace; + let ResourceId(id) = self.next_id.get(); + self.next_id.set(ResourceId(id + 1)); + (namespace, id) + } +} diff --git a/gfx/webrender_traits/src/channel.rs b/gfx/webrender_traits/src/channel.rs new file mode 100644 index 000000000000..d4e52b0541ec --- /dev/null +++ b/gfx/webrender_traits/src/channel.rs @@ -0,0 +1,15 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// A helper to handle the interface difference between +// IpcBytesSender and Sender> +pub trait PayloadHelperMethods { + fn send_vec(&self, data: Vec) -> Result<(), Error>; +} + +#[cfg(not(feature = "ipc"))] +include!("channel_mpsc.rs"); + +#[cfg(feature = "ipc")] +include!("channel_ipc.rs"); diff --git a/gfx/webrender_traits/src/channel_ipc.rs b/gfx/webrender_traits/src/channel_ipc.rs new file mode 100644 index 000000000000..27134d4d77dc --- /dev/null +++ b/gfx/webrender_traits/src/channel_ipc.rs @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use serde::{Deserialize, Serialize}; +use std::io::Error; + +use ipc_channel::ipc::{self, IpcSender, IpcReceiver, IpcBytesSender, IpcBytesReceiver}; + +/// +/// Handles the channel implementation when IPC is enabled. +/// + +pub type MsgSender = IpcSender; + +pub type MsgReceiver = IpcReceiver; + +pub type PayloadSender = IpcBytesSender; + +pub type PayloadReceiver = IpcBytesReceiver; + +impl PayloadHelperMethods for PayloadSender { + fn send_vec(&self, data: Vec) -> Result<(), Error> { + self.send(&data) + } +} + +pub fn msg_channel() -> Result<(MsgSender, MsgReceiver), Error> { + ipc::channel() +} + +pub fn payload_channel() -> Result<(PayloadSender, PayloadReceiver), Error> { + ipc::bytes_channel() +} diff --git a/gfx/webrender_traits/src/channel_mpsc.rs b/gfx/webrender_traits/src/channel_mpsc.rs new file mode 100644 index 000000000000..e163d3283f42 --- /dev/null +++ b/gfx/webrender_traits/src/channel_mpsc.rs @@ -0,0 +1,93 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use serde::{Deserialize, Serialize}; +use std::io::{Error, ErrorKind}; + +use serde::{Deserializer, Serializer}; + +use std::sync::mpsc; + +/// +/// Handles the channel implementation when in process channels are enabled. +/// + +pub type PayloadSender = MsgSender>; + +pub type PayloadReceiver = MsgReceiver>; + +impl PayloadHelperMethods for PayloadSender { + fn send_vec(&self, data: Vec) -> Result<(), Error> { + self.send(data) + } +} + +pub struct MsgReceiver { + rx: mpsc::Receiver, +} + +impl MsgReceiver { + pub fn recv(&self) -> Result { + use std::io; + use std::error::Error; + self.rx.recv().map_err(|e| io::Error::new(ErrorKind::Other, e.description())) + } +} + +#[derive(Clone)] +pub struct MsgSender { + tx: mpsc::Sender, +} + +impl MsgSender { + pub fn send(&self, data: T) -> Result<(), Error> { + self.tx.send(data).map_err(|_| Error::new(ErrorKind::Other, "cannot send on closed channel")) + } +} + +pub fn payload_channel() -> Result<(PayloadSender, PayloadReceiver), Error> { + let (tx, rx) = mpsc::channel(); + Ok((PayloadSender { tx: tx }, PayloadReceiver { rx: rx })) +} + +pub fn msg_channel() -> Result<(MsgSender, MsgReceiver), Error> { + let (tx, rx) = mpsc::channel(); + Ok((MsgSender { tx: tx }, MsgReceiver { rx: rx })) +} + +/// +/// These serialize methods are needed to satisfy the compiler +/// which uses these implementations for IPC, and also for the +/// recording tool. The recording tool only outputs messages +/// that don't contain Senders or Receivers, so in theory +/// these should never be called in the in-process config. +/// If they are called, there may be a bug in the messages +/// that the replay tool is writing. +/// + +impl Serialize for MsgReceiver { + fn serialize(&self, _: &mut S) -> Result<(), S::Error> { + unreachable!(); + } +} + +impl Serialize for MsgSender { + fn serialize(&self, _: &mut S) -> Result<(), S::Error> { + unreachable!(); + } +} + +impl Deserialize for MsgReceiver { + fn deserialize(_: &mut D) -> Result, D::Error> + where D: Deserializer { + unreachable!(); + } +} + +impl Deserialize for MsgSender { + fn deserialize(_: &mut D) -> Result, D::Error> + where D: Deserializer { + unreachable!(); + } +} diff --git a/gfx/webrender_traits/src/display_item.rs b/gfx/webrender_traits/src/display_item.rs new file mode 100644 index 000000000000..9fc8b9fa6343 --- /dev/null +++ b/gfx/webrender_traits/src/display_item.rs @@ -0,0 +1,179 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use display_list::AuxiliaryListsBuilder; +use {BorderRadius, BorderDisplayItem, ClipRegion, ColorF, ComplexClipRegion}; +use {FontKey, ImageKey, PipelineId, ScrollLayerId, ScrollLayerInfo, ServoScrollRootId}; +use {ImageMask, ItemRange}; +use {LayoutSize, LayoutPoint, LayoutRect}; + +impl BorderDisplayItem { + pub fn top_left_inner_radius(&self) -> LayoutSize { + LayoutSize::new((self.radius.top_left.width - self.left.width).max(0.0), + (self.radius.top_left.height - self.top.width).max(0.0)) + } + + pub fn top_right_inner_radius(&self) -> LayoutSize { + LayoutSize::new((self.radius.top_right.width - self.right.width).max(0.0), + (self.radius.top_right.height - self.top.width).max(0.0)) + } + + pub fn bottom_left_inner_radius(&self) -> LayoutSize { + LayoutSize::new((self.radius.bottom_left.width - self.left.width).max(0.0), + (self.radius.bottom_left.height - self.bottom.width).max(0.0)) + } + + pub fn bottom_right_inner_radius(&self) -> LayoutSize { + LayoutSize::new((self.radius.bottom_right.width - self.right.width).max(0.0), + (self.radius.bottom_right.height - self.bottom.width).max(0.0)) + } +} + +impl BorderRadius { + pub fn zero() -> BorderRadius { + BorderRadius { + top_left: LayoutSize::new(0.0, 0.0), + top_right: LayoutSize::new(0.0, 0.0), + bottom_left: LayoutSize::new(0.0, 0.0), + bottom_right: LayoutSize::new(0.0, 0.0), + } + } + + pub fn uniform(radius: f32) -> BorderRadius { + BorderRadius { + top_left: LayoutSize::new(radius, radius), + top_right: LayoutSize::new(radius, radius), + bottom_left: LayoutSize::new(radius, radius), + bottom_right: LayoutSize::new(radius, radius), + } + } + + pub fn is_uniform(&self) -> Option { + let uniform_radius = LayoutSize::new(self.top_left.width, self.top_left.width); + if self.top_right == uniform_radius && + self.bottom_left == uniform_radius && + self.bottom_right == uniform_radius { + Some(uniform_radius.width) + } else { + None + } + } + + pub fn is_zero(&self) -> bool { + if let Some(radius) = self.is_uniform() { + radius == 0.0 + } else { + false + } + } +} + +impl ClipRegion { + pub fn new(rect: &LayoutRect, + complex: Vec, + image_mask: Option, + auxiliary_lists_builder: &mut AuxiliaryListsBuilder) + -> ClipRegion { + ClipRegion { + main: *rect, + complex: auxiliary_lists_builder.add_complex_clip_regions(&complex), + image_mask: image_mask, + } + } + + pub fn simple(rect: &LayoutRect) -> ClipRegion { + ClipRegion { + main: *rect, + complex: ItemRange::empty(), + image_mask: None, + } + } + + pub fn is_complex(&self) -> bool { + self.complex.length !=0 || self.image_mask.is_some() + } +} + +impl ColorF { + pub fn new(r: f32, g: f32, b: f32, a: f32) -> ColorF { + ColorF { + r: r, + g: g, + b: b, + a: a, + } + } + + pub fn scale_rgb(&self, scale: f32) -> ColorF { + ColorF { + r: self.r * scale, + g: self.g * scale, + b: self.b * scale, + a: self.a, + } + } + + pub fn to_array(&self) -> [f32; 4] { + [self.r, self.g, self.b, self.a] + } +} + +impl ComplexClipRegion { + /// Create a new complex clip region. + pub fn new(rect: LayoutRect, radii: BorderRadius) -> ComplexClipRegion { + ComplexClipRegion { + rect: rect, + radii: radii, + } + } + + //TODO: move to `util` module? + /// Return an aligned rectangle that is fully inside the clip region. + pub fn get_inner_rect(&self) -> Option { + let xl = self.rect.origin.x + + self.radii.top_left.width.max(self.radii.bottom_left.width); + let xr = self.rect.origin.x + self.rect.size.width - + self.radii.top_right.width.max(self.radii.bottom_right.width); + let yt = self.rect.origin.y + + self.radii.top_left.height.max(self.radii.top_right.height); + let yb = self.rect.origin.y + self.rect.size.height - + self.radii.bottom_left.height.max(self.radii.bottom_right.height); + if xl <= xr && yt <= yb { + Some(LayoutRect::new(LayoutPoint::new(xl, yt), LayoutSize::new(xr-xl, yb-yt))) + } else { + None + } + } +} + +impl FontKey { + pub fn new(key0: u32, key1: u32) -> FontKey { + FontKey(key0, key1) + } +} + +impl ImageKey { + pub fn new(key0: u32, key1: u32) -> ImageKey { + ImageKey(key0, key1) + } +} + +impl ScrollLayerId { + pub fn new(pipeline_id: PipelineId, + index: usize, + scroll_root_id: ServoScrollRootId) + -> ScrollLayerId { + ScrollLayerId { + pipeline_id: pipeline_id, + info: ScrollLayerInfo::Scrollable(index, scroll_root_id), + } + } + + pub fn create_fixed(pipeline_id: PipelineId) -> ScrollLayerId { + ScrollLayerId { + pipeline_id: pipeline_id, + info: ScrollLayerInfo::Fixed, + } + } +} diff --git a/gfx/webrender_traits/src/display_list.rs b/gfx/webrender_traits/src/display_list.rs new file mode 100644 index 000000000000..11dc1de9e339 --- /dev/null +++ b/gfx/webrender_traits/src/display_list.rs @@ -0,0 +1,557 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use app_units::Au; +use std::mem; +use std::slice; +use {AuxiliaryLists, AuxiliaryListsDescriptor, BorderDisplayItem, BorderRadius}; +use {BorderSide, BoxShadowClipMode, BoxShadowDisplayItem, BuiltDisplayList}; +use {BuiltDisplayListDescriptor, ClipRegion, ComplexClipRegion, ColorF}; +use {DisplayItem, DisplayListMode, FilterOp, YuvColorSpace}; +use {FontKey, GlyphInstance, GradientDisplayItem, RadialGradientDisplayItem, GradientStop, IframeDisplayItem}; +use {ImageDisplayItem, ImageKey, ImageMask, ImageRendering, ItemRange, MixBlendMode, PipelineId}; +use {PushScrollLayerItem, PushStackingContextDisplayItem, RectangleDisplayItem, ScrollLayerId}; +use {ScrollPolicy, ServoScrollRootId, SpecificDisplayItem, StackingContext, TextDisplayItem}; +use {WebGLContextId, WebGLDisplayItem, YuvImageDisplayItem}; +use {LayoutTransform, LayoutPoint, LayoutRect, LayoutSize}; + +impl BuiltDisplayListDescriptor { + pub fn size(&self) -> usize { + self.display_list_items_size + self.display_items_size + } +} + +impl BuiltDisplayList { + pub fn from_data(data: Vec, descriptor: BuiltDisplayListDescriptor) -> BuiltDisplayList { + BuiltDisplayList { + data: data, + descriptor: descriptor, + } + } + + pub fn data(&self) -> &[u8] { + &self.data[..] + } + + pub fn descriptor(&self) -> &BuiltDisplayListDescriptor { + &self.descriptor + } + + pub fn all_display_items<'a>(&'a self) -> &'a [DisplayItem] { + unsafe { + convert_blob_to_pod(&self.data[0..self.descriptor.display_list_items_size]) + } + } +} + +#[derive(Clone)] +pub struct DisplayListBuilder { + pub mode: DisplayListMode, + pub list: Vec, + auxiliary_lists_builder: AuxiliaryListsBuilder, + pub pipeline_id: PipelineId, + next_scroll_layer_id: usize, +} + +impl DisplayListBuilder { + pub fn new(pipeline_id: PipelineId) -> DisplayListBuilder { + DisplayListBuilder { + mode: DisplayListMode::Default, + list: Vec::new(), + auxiliary_lists_builder: AuxiliaryListsBuilder::new(), + pipeline_id: pipeline_id, + next_scroll_layer_id: 0, + } + } + + pub fn print_display_list(&mut self) { + for item in &self.list { + println!("{:?}", item); + } + } + + pub fn push_rect(&mut self, + rect: LayoutRect, + clip: ClipRegion, + color: ColorF) { + let item = RectangleDisplayItem { + color: color, + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::Rectangle(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + + pub fn push_image(&mut self, + rect: LayoutRect, + clip: ClipRegion, + stretch_size: LayoutSize, + tile_spacing: LayoutSize, + image_rendering: ImageRendering, + key: ImageKey) { + let item = ImageDisplayItem { + image_key: key, + stretch_size: stretch_size, + tile_spacing: tile_spacing, + image_rendering: image_rendering, + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::Image(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + + pub fn push_yuv_image(&mut self, + rect: LayoutRect, + clip: ClipRegion, + y_key: ImageKey, + u_key: ImageKey, + v_key: ImageKey, + color_space: YuvColorSpace) { + self.list.push(DisplayItem { + item: SpecificDisplayItem::YuvImage(YuvImageDisplayItem { + y_image_key: y_key, + u_image_key: u_key, + v_image_key: v_key, + color_space: color_space, + }), + rect: rect, + clip: clip, + }); + } + + pub fn push_webgl_canvas(&mut self, + rect: LayoutRect, + clip: ClipRegion, + context_id: WebGLContextId) { + let item = WebGLDisplayItem { + context_id: context_id, + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::WebGL(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + + pub fn push_text(&mut self, + rect: LayoutRect, + clip: ClipRegion, + glyphs: Vec, + font_key: FontKey, + color: ColorF, + size: Au, + blur_radius: Au) { + // Sanity check - anything with glyphs bigger than this + // is probably going to consume too much memory to render + // efficiently anyway. This is specifically to work around + // the font_advance.html reftest, which creates a very large + // font as a crash test - the rendering is also ignored + // by the azure renderer. + if size < Au::from_px(4096) { + let item = TextDisplayItem { + color: color, + glyphs: self.auxiliary_lists_builder.add_glyph_instances(&glyphs), + font_key: font_key, + size: size, + blur_radius: blur_radius, + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::Text(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + } + + pub fn push_border(&mut self, + rect: LayoutRect, + clip: ClipRegion, + left: BorderSide, + top: BorderSide, + right: BorderSide, + bottom: BorderSide, + radius: BorderRadius) { + let item = BorderDisplayItem { + left: left, + top: top, + right: right, + bottom: bottom, + radius: radius, + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::Border(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + + pub fn push_box_shadow(&mut self, + rect: LayoutRect, + clip: ClipRegion, + box_bounds: LayoutRect, + offset: LayoutPoint, + color: ColorF, + blur_radius: f32, + spread_radius: f32, + border_radius: f32, + clip_mode: BoxShadowClipMode) { + let item = BoxShadowDisplayItem { + box_bounds: box_bounds, + offset: offset, + color: color, + blur_radius: blur_radius, + spread_radius: spread_radius, + border_radius: border_radius, + clip_mode: clip_mode, + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::BoxShadow(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + + pub fn push_gradient(&mut self, + rect: LayoutRect, + clip: ClipRegion, + start_point: LayoutPoint, + end_point: LayoutPoint, + stops: Vec) { + let item = GradientDisplayItem { + start_point: start_point, + end_point: end_point, + stops: self.auxiliary_lists_builder.add_gradient_stops(&stops), + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::Gradient(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + + pub fn push_radial_gradient(&mut self, + rect: LayoutRect, + clip: ClipRegion, + start_center: LayoutPoint, + start_radius: f32, + end_center: LayoutPoint, + end_radius: f32, + stops: Vec) { + let item = RadialGradientDisplayItem { + start_center: start_center, + start_radius: start_radius, + end_center: end_center, + end_radius: end_radius, + stops: self.auxiliary_lists_builder.add_gradient_stops(&stops), + }; + + let display_item = DisplayItem { + item: SpecificDisplayItem::RadialGradient(item), + rect: rect, + clip: clip, + }; + + self.list.push(display_item); + } + + pub fn push_stacking_context(&mut self, + scroll_policy: ScrollPolicy, + bounds: LayoutRect, + clip: ClipRegion, + z_index: i32, + transform: &LayoutTransform, + perspective: &LayoutTransform, + mix_blend_mode: MixBlendMode, + filters: Vec) { + let stacking_context = StackingContext { + scroll_policy: scroll_policy, + bounds: bounds, + z_index: z_index, + transform: transform.clone(), + perspective: perspective.clone(), + mix_blend_mode: mix_blend_mode, + filters: self.auxiliary_lists_builder.add_filters(&filters), + }; + + let item = DisplayItem { + item: SpecificDisplayItem::PushStackingContext(PushStackingContextDisplayItem { + stacking_context: stacking_context + }), + rect: LayoutRect::zero(), + clip: clip, + }; + self.list.push(item); + } + + pub fn pop_stacking_context(&mut self) { + let item = DisplayItem { + item: SpecificDisplayItem::PopStackingContext, + rect: LayoutRect::zero(), + clip: ClipRegion::simple(&LayoutRect::zero()), + }; + self.list.push(item); + } + + pub fn push_scroll_layer(&mut self, + clip: LayoutRect, + content_size: LayoutSize, + scroll_root_id: ServoScrollRootId) { + let scroll_layer_id = self.next_scroll_layer_id; + self.next_scroll_layer_id += 1; + + let item = PushScrollLayerItem { + content_size: content_size, + id: ScrollLayerId::new(self.pipeline_id, scroll_layer_id, scroll_root_id), + }; + + let item = DisplayItem { + item: SpecificDisplayItem::PushScrollLayer(item), + rect: clip, + clip: ClipRegion::simple(&LayoutRect::zero()), + }; + self.list.push(item); + } + + pub fn pop_scroll_layer(&mut self) { + let item = DisplayItem { + item: SpecificDisplayItem::PopScrollLayer, + rect: LayoutRect::zero(), + clip: ClipRegion::simple(&LayoutRect::zero()), + }; + self.list.push(item); + } + + pub fn push_iframe(&mut self, rect: LayoutRect, clip: ClipRegion, pipeline_id: PipelineId) { + let item = DisplayItem { + item: SpecificDisplayItem::Iframe(IframeDisplayItem { pipeline_id: pipeline_id }), + rect: rect, + clip: clip, + }; + self.list.push(item); + } + + pub fn new_clip_region(&mut self, + rect: &LayoutRect, + complex: Vec, + image_mask: Option) + -> ClipRegion { + ClipRegion::new(rect, complex, image_mask, &mut self.auxiliary_lists_builder) + } + + pub fn finalize(self) -> (BuiltDisplayList, AuxiliaryLists) { + unsafe { + let blob = convert_pod_to_blob(&self.list).to_vec(); + let display_list_items_size = blob.len(); + + (BuiltDisplayList { + descriptor: BuiltDisplayListDescriptor { + mode: self.mode, + display_list_items_size: display_list_items_size, + display_items_size: 0, + }, + data: blob, + }, + self.auxiliary_lists_builder.finalize()) + } + } +} + +impl ItemRange { + pub fn new(backing_list: &mut Vec, items: &[T]) -> ItemRange where T: Copy + Clone { + let start = backing_list.len(); + backing_list.extend_from_slice(items); + ItemRange { + start: start, + length: items.len(), + } + } + + pub fn empty() -> ItemRange { + ItemRange { + start: 0, + length: 0, + } + } + + pub fn get<'a, T>(&self, backing_list: &'a [T]) -> &'a [T] { + &backing_list[self.start..(self.start + self.length)] + } + + pub fn get_mut<'a, T>(&self, backing_list: &'a mut [T]) -> &'a mut [T] { + &mut backing_list[self.start..(self.start + self.length)] + } +} + +#[derive(Clone)] +pub struct AuxiliaryListsBuilder { + gradient_stops: Vec, + complex_clip_regions: Vec, + filters: Vec, + glyph_instances: Vec, +} + +impl AuxiliaryListsBuilder { + pub fn new() -> AuxiliaryListsBuilder { + AuxiliaryListsBuilder { + gradient_stops: Vec::new(), + complex_clip_regions: Vec::new(), + filters: Vec::new(), + glyph_instances: Vec::new(), + } + } + + pub fn add_gradient_stops(&mut self, gradient_stops: &[GradientStop]) -> ItemRange { + ItemRange::new(&mut self.gradient_stops, gradient_stops) + } + + pub fn gradient_stops(&self, gradient_stops_range: &ItemRange) -> &[GradientStop] { + gradient_stops_range.get(&self.gradient_stops[..]) + } + + pub fn add_complex_clip_regions(&mut self, complex_clip_regions: &[ComplexClipRegion]) + -> ItemRange { + ItemRange::new(&mut self.complex_clip_regions, complex_clip_regions) + } + + pub fn complex_clip_regions(&self, complex_clip_regions_range: &ItemRange) + -> &[ComplexClipRegion] { + complex_clip_regions_range.get(&self.complex_clip_regions[..]) + } + + pub fn add_filters(&mut self, filters: &[FilterOp]) -> ItemRange { + ItemRange::new(&mut self.filters, filters) + } + + pub fn filters(&self, filters_range: &ItemRange) -> &[FilterOp] { + filters_range.get(&self.filters[..]) + } + + pub fn add_glyph_instances(&mut self, glyph_instances: &[GlyphInstance]) -> ItemRange { + ItemRange::new(&mut self.glyph_instances, glyph_instances) + } + + pub fn glyph_instances(&self, glyph_instances_range: &ItemRange) -> &[GlyphInstance] { + glyph_instances_range.get(&self.glyph_instances[..]) + } + + pub fn finalize(self) -> AuxiliaryLists { + unsafe { + let mut blob = convert_pod_to_blob(&self.gradient_stops).to_vec(); + let gradient_stops_size = blob.len(); + blob.extend_from_slice(convert_pod_to_blob(&self.complex_clip_regions)); + let complex_clip_regions_size = blob.len() - gradient_stops_size; + blob.extend_from_slice(convert_pod_to_blob(&self.filters)); + let filters_size = blob.len() - (complex_clip_regions_size + gradient_stops_size); + blob.extend_from_slice(convert_pod_to_blob(&self.glyph_instances)); + let glyph_instances_size = blob.len() - + (complex_clip_regions_size + gradient_stops_size + filters_size); + + AuxiliaryLists { + data: blob, + descriptor: AuxiliaryListsDescriptor { + gradient_stops_size: gradient_stops_size, + complex_clip_regions_size: complex_clip_regions_size, + filters_size: filters_size, + glyph_instances_size: glyph_instances_size, + }, + } + } + } +} + +impl AuxiliaryListsDescriptor { + pub fn size(&self) -> usize { + self.gradient_stops_size + self.complex_clip_regions_size + self.filters_size + + self.glyph_instances_size + } +} + +impl AuxiliaryLists { + /// Creates a new `AuxiliaryLists` instance from a descriptor and data received over a channel. + pub fn from_data(data: Vec, descriptor: AuxiliaryListsDescriptor) -> AuxiliaryLists { + AuxiliaryLists { + data: data, + descriptor: descriptor, + } + } + + pub fn data(&self) -> &[u8] { + &self.data[..] + } + + pub fn descriptor(&self) -> &AuxiliaryListsDescriptor { + &self.descriptor + } + + /// Returns the gradient stops described by `gradient_stops_range`. + pub fn gradient_stops(&self, gradient_stops_range: &ItemRange) -> &[GradientStop] { + unsafe { + let end = self.descriptor.gradient_stops_size; + gradient_stops_range.get(convert_blob_to_pod(&self.data[0..end])) + } + } + + /// Returns the complex clipping regions described by `complex_clip_regions_range`. + pub fn complex_clip_regions(&self, complex_clip_regions_range: &ItemRange) + -> &[ComplexClipRegion] { + let start = self.descriptor.gradient_stops_size; + let end = start + self.descriptor.complex_clip_regions_size; + unsafe { + complex_clip_regions_range.get(convert_blob_to_pod(&self.data[start..end])) + } + } + + /// Returns the filters described by `filters_range`. + pub fn filters(&self, filters_range: &ItemRange) -> &[FilterOp] { + let start = self.descriptor.gradient_stops_size + + self.descriptor.complex_clip_regions_size; + let end = start + self.descriptor.filters_size; + unsafe { + filters_range.get(convert_blob_to_pod(&self.data[start..end])) + } + } + + /// Returns the glyph instances described by `glyph_instances_range`. + pub fn glyph_instances(&self, glyph_instances_range: &ItemRange) -> &[GlyphInstance] { + let start = self.descriptor.gradient_stops_size + + self.descriptor.complex_clip_regions_size + self.descriptor.filters_size; + unsafe { + glyph_instances_range.get(convert_blob_to_pod(&self.data[start..])) + } + } +} + +unsafe fn convert_pod_to_blob(data: &[T]) -> &[u8] where T: Copy + 'static { + slice::from_raw_parts(data.as_ptr() as *const u8, data.len() * mem::size_of::()) +} + +unsafe fn convert_blob_to_pod(blob: &[u8]) -> &[T] where T: Copy + 'static { + slice::from_raw_parts(blob.as_ptr() as *const T, blob.len() / mem::size_of::()) +} + diff --git a/gfx/webrender_traits/src/lib.rs b/gfx/webrender_traits/src/lib.rs new file mode 100644 index 000000000000..e6771db6ca24 --- /dev/null +++ b/gfx/webrender_traits/src/lib.rs @@ -0,0 +1,46 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#![cfg_attr(feature = "nightly", feature(nonzero))] +#![cfg_attr(feature = "serde_derive", feature(rustc_attrs, structural_match))] + +extern crate app_units; +extern crate byteorder; +#[cfg(feature = "nightly")] +extern crate core; +extern crate euclid; +extern crate gleam; +#[macro_use] +extern crate heapsize; +#[cfg(feature = "ipc")] +extern crate ipc_channel; +extern crate offscreen_gl_context; +extern crate serde; +#[cfg(feature = "serde_derive")] +#[macro_use] +extern crate serde_derive; + +#[cfg(target_os = "macos")] +extern crate core_graphics; + +#[cfg(target_os = "windows")] +extern crate dwrote; + +#[cfg(feature = "serde_codegen")] +include!(concat!(env!("OUT_DIR"), "/types.rs")); + +#[cfg(feature = "serde_derive")] +include!("types.rs"); + +mod units; +mod api; +pub mod channel; +mod display_item; +mod display_list; +mod stacking_context; +mod webgl; + +pub use api::RenderApi; +pub use display_list::DisplayListBuilder; +pub use units::*; diff --git a/gfx/webrender_traits/src/stacking_context.rs b/gfx/webrender_traits/src/stacking_context.rs new file mode 100644 index 000000000000..2740b9f4b4c2 --- /dev/null +++ b/gfx/webrender_traits/src/stacking_context.rs @@ -0,0 +1,29 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use display_list::AuxiliaryListsBuilder; +use {FilterOp, MixBlendMode, ScrollPolicy, StackingContext}; +use {LayoutTransform, LayoutRect}; + +impl StackingContext { + pub fn new(scroll_policy: ScrollPolicy, + bounds: LayoutRect, + z_index: i32, + transform: &LayoutTransform, + perspective: &LayoutTransform, + mix_blend_mode: MixBlendMode, + filters: Vec, + auxiliary_lists_builder: &mut AuxiliaryListsBuilder) + -> StackingContext { + StackingContext { + scroll_policy: scroll_policy, + bounds: bounds, + z_index: z_index, + transform: transform.clone(), + perspective: perspective.clone(), + mix_blend_mode: mix_blend_mode, + filters: auxiliary_lists_builder.add_filters(&filters), + } + } +} diff --git a/gfx/webrender_traits/src/types.rs b/gfx/webrender_traits/src/types.rs new file mode 100644 index 000000000000..8522f1265e1e --- /dev/null +++ b/gfx/webrender_traits/src/types.rs @@ -0,0 +1,910 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Every serialisable type is defined in this file to only codegen one file +// for the serde implementations. + +use app_units::Au; +use channel::{PayloadSender, MsgSender}; +#[cfg(feature = "nightly")] +use core::nonzero::NonZero; +use offscreen_gl_context::{GLContextAttributes, GLLimits}; +use std::sync::Arc; + +#[cfg(target_os = "macos")] use core_graphics::font::CGFont; +#[cfg(target_os = "windows")] use dwrote::FontDescriptor; + +#[derive(Debug, Copy, Clone)] +pub enum RendererKind { + Native, + OSMesa, +} + +#[derive(Clone, Deserialize, Serialize)] +pub enum ApiMsg { + AddRawFont(FontKey, Vec), + AddNativeFont(FontKey, NativeFontHandle), + /// Gets the glyph dimensions + GetGlyphDimensions(Vec, MsgSender>>), + /// Adds an image from the resource cache. + AddImage(ImageKey, ImageDescriptor, ImageData), + /// Updates the the resource cache with the new image data. + UpdateImage(ImageKey, ImageDescriptor, Vec), + /// Drops an image from the resource cache. + DeleteImage(ImageKey), + CloneApi(MsgSender), + /// Supplies a new frame to WebRender. + /// + /// After receiving this message, WebRender will read the display list, followed by the + /// auxiliary lists, from the payload channel. + SetRootDisplayList(Option, + Epoch, + PipelineId, + LayoutSize, + BuiltDisplayListDescriptor, + AuxiliaryListsDescriptor), + SetRootPipeline(PipelineId), + Scroll(ScrollLocation, WorldPoint, ScrollEventPhase), + ScrollLayersWithScrollId(LayoutPoint, PipelineId, ServoScrollRootId), + TickScrollingBounce, + TranslatePointToLayerSpace(WorldPoint, MsgSender<(LayoutPoint, PipelineId)>), + GetScrollLayerState(MsgSender>), + RequestWebGLContext(DeviceIntSize, GLContextAttributes, MsgSender>), + ResizeWebGLContext(WebGLContextId, DeviceIntSize), + WebGLCommand(WebGLContextId, WebGLCommand), + GenerateFrame, + // WebVR commands that must be called in the WebGL render thread. + VRCompositorCommand(WebGLContextId, VRCompositorCommand), + /// An opaque handle that must be passed to the render notifier. It is used by Gecko + /// to forward gecko-specific messages to the render thread preserving the ordering + /// within the other messages. + ExternalEvent(ExternalEvent), + ShutDown, +} + +/// An opaque pointer-sized value. +#[derive(Clone, Deserialize, Serialize)] +pub struct ExternalEvent { + raw: usize, +} + +unsafe impl Send for ExternalEvent {} + +impl ExternalEvent { + pub fn from_raw(raw: usize) -> Self { ExternalEvent { raw: raw } } + /// Consumes self to make it obvious that the event should be forwarded only once. + pub fn unwrap(self) -> usize { self.raw } +} + +#[derive(Copy, Clone, Deserialize, Serialize, Debug)] +pub struct GlyphDimensions { + pub left: i32, + pub top: i32, + pub width: u32, + pub height: u32, +} + +#[derive(Clone, Deserialize, Serialize)] +pub struct AuxiliaryLists { + /// The concatenation of: gradient stops, complex clip regions, filters, and glyph instances, + /// in that order. + data: Vec, + descriptor: AuxiliaryListsDescriptor, +} + +/// Describes the memory layout of the auxiliary lists. +/// +/// Auxiliary lists consist of some number of gradient stops, complex clip regions, filters, and +/// glyph instances, in that order. +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub struct AuxiliaryListsDescriptor { + gradient_stops_size: usize, + complex_clip_regions_size: usize, + filters_size: usize, + glyph_instances_size: usize, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct BorderDisplayItem { + pub left: BorderSide, + pub right: BorderSide, + pub top: BorderSide, + pub bottom: BorderSide, + pub radius: BorderRadius, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct BorderRadius { + pub top_left: LayoutSize, + pub top_right: LayoutSize, + pub bottom_left: LayoutSize, + pub bottom_right: LayoutSize, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct BorderSide { + pub width: f32, + pub color: ColorF, + pub style: BorderStyle, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub enum BorderStyle { + None, + Solid, + Double, + Dotted, + Dashed, + Hidden, + Groove, + Ridge, + Inset, + Outset, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub enum BoxShadowClipMode { + None, + Outset, + Inset, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct BoxShadowDisplayItem { + pub box_bounds: LayoutRect, + pub offset: LayoutPoint, + pub color: ColorF, + pub blur_radius: f32, + pub spread_radius: f32, + pub border_radius: f32, + pub clip_mode: BoxShadowClipMode, +} + +/// A display list. +#[derive(Clone, Deserialize, Serialize)] +pub struct BuiltDisplayList { + data: Vec, + descriptor: BuiltDisplayListDescriptor, +} + +/// Describes the memory layout of a display list. +/// +/// A display list consists of some number of display list items, followed by a number of display +/// items. +#[derive(Copy, Clone, Deserialize, Serialize)] +pub struct BuiltDisplayListDescriptor { + pub mode: DisplayListMode, + + /// The size in bytes of the display list items in this display list. + display_list_items_size: usize, + /// The size in bytes of the display items in this display list. + display_items_size: usize, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct ColorF { + pub r: f32, + pub g: f32, + pub b: f32, + pub a: f32, +} +known_heap_size!(0, ColorF); + +#[derive(Clone, Copy, Hash, Eq, Debug, Deserialize, PartialEq, PartialOrd, Ord, Serialize)] +pub struct ColorU { + pub r: u8, + pub g: u8, + pub b: u8, + pub a: u8, +} + +impl From for ColorU { + fn from(color: ColorF) -> ColorU { + ColorU { + r: ColorU::round_to_int(color.r), + g: ColorU::round_to_int(color.g), + b: ColorU::round_to_int(color.b), + a: ColorU::round_to_int(color.a), + } + } +} + +impl Into for ColorU { + fn into(self) -> ColorF { + ColorF { + r: self.r as f32 / 255.0, + g: self.g as f32 / 255.0, + b: self.b as f32 / 255.0, + a: self.a as f32 / 255.0, + } + } +} + +impl ColorU { + fn round_to_int(x: f32) -> u8 { + debug_assert!((0.0 <= x) && (x <= 1.0)); + let f = (255.0 * x) + 0.5; + let val = f.floor(); + debug_assert!(val <= 255.0); + val as u8 + } + + pub fn new(r: u8, g: u8, b: u8, a: u8) -> ColorU { + ColorU { + r: r, + g: g, + b: b, + a: a, + } + } +} + +#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct ImageDescriptor { + pub format: ImageFormat, + pub width: u32, + pub height: u32, + pub stride: Option, + pub is_opaque: bool, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct ImageMask { + pub image: ImageKey, + pub rect: LayoutRect, + pub repeat: bool, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct ClipRegion { + pub main: LayoutRect, + pub complex: ItemRange, + pub image_mask: Option, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct ComplexClipRegion { + /// The boundaries of the rectangle. + pub rect: LayoutRect, + /// Border radii of this rectangle. + pub radii: BorderRadius, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct DisplayItem { + pub item: SpecificDisplayItem, + pub rect: LayoutRect, + pub clip: ClipRegion, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum DisplayListMode { + Default, + PseudoFloat, + PseudoPositionedContent, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub struct Epoch(pub u32); + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum FilterOp { + Blur(Au), + Brightness(f32), + Contrast(f32), + Grayscale(f32), + HueRotate(f32), + Invert(f32), + Opacity(f32), + Saturate(f32), + Sepia(f32), +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Ord, PartialOrd)] +pub struct FontKey(u32, u32); + +#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Ord, PartialOrd)] +pub enum FontRenderMode { + Mono, + Alpha, + Subpixel, +} + +#[derive(Clone, Hash, PartialEq, Eq, Debug, Deserialize, Serialize, Ord, PartialOrd)] +pub struct GlyphKey { + pub font_key: FontKey, + // The font size is in *device* pixels, not logical pixels. + // It is stored as an Au since we need sub-pixel sizes, but + // can't store as a f32 due to use of this type as a hash key. + // TODO(gw): Perhaps consider having LogicalAu and DeviceAu + // or something similar to that. + pub size: Au, + pub index: u32, + pub color: ColorU, +} + +impl GlyphKey { + pub fn new(font_key: FontKey, + size: Au, + color: ColorF, + index: u32) -> GlyphKey { + GlyphKey { + font_key: font_key, + size: size, + color: ColorU::from(color), + index: index, + } + } +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum FragmentType { + FragmentBody, + BeforePseudoContent, + AfterPseudoContent, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct GlyphInstance { + pub index: u32, + pub x: f32, + pub y: f32, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct GradientDisplayItem { + pub start_point: LayoutPoint, + pub end_point: LayoutPoint, + pub stops: ItemRange, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct GradientStop { + pub offset: f32, + pub color: ColorF, +} +known_heap_size!(0, GradientStop); + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct RadialGradientDisplayItem { + pub start_center: LayoutPoint, + pub start_radius: f32, + pub end_center: LayoutPoint, + pub end_radius: f32, + pub stops: ItemRange, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct PushStackingContextDisplayItem { + pub stacking_context: StackingContext, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct PushScrollLayerItem { + pub content_size: LayoutSize, + pub id: ScrollLayerId, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct IframeDisplayItem { + pub pipeline_id: PipelineId, +} + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub struct IdNamespace(pub u32); + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct ImageDisplayItem { + pub image_key: ImageKey, + pub stretch_size: LayoutSize, + pub tile_spacing: LayoutSize, + pub image_rendering: ImageRendering, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct YuvImageDisplayItem { + pub y_image_key: ImageKey, + pub u_image_key: ImageKey, + pub v_image_key: ImageKey, + pub color_space: YuvColorSpace, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum ImageFormat { + Invalid, + A8, + RGB8, + RGBA8, + RGBAF32, +} + +impl ImageFormat { + pub fn bytes_per_pixel(self) -> Option { + match self { + ImageFormat::A8 => Some(1), + ImageFormat::RGB8 => Some(3), + ImageFormat::RGBA8 => Some(4), + ImageFormat::RGBAF32 => Some(16), + ImageFormat::Invalid => None, + } + } +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum YuvColorSpace { + Rec601 = 1, // The values must match the ones in prim_shared.glsl + Rec709 = 2, +} + +/// An arbitrary identifier for an external image provided by the +/// application. It must be a unique identifier for each external +/// image. +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)] +pub struct ExternalImageId(pub u64); + +#[derive(Clone, Serialize, Deserialize)] +pub enum ImageData { + Raw(Arc>), + External(ExternalImageId), +} + +impl ImageData { + pub fn new(bytes: Vec) -> ImageData { + ImageData::Raw(Arc::new(bytes)) + } + + pub fn new_shared(bytes: Arc>) -> ImageData { + ImageData::Raw(bytes) + } +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ImageKey(u32, u32); + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum ImageRendering { + Auto, + CrispEdges, + Pixelated, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ItemRange { + pub start: usize, + pub length: usize, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum MixBlendMode { + Normal, + Multiply, + Screen, + Overlay, + Darken, + Lighten, + ColorDodge, + ColorBurn, + HardLight, + SoftLight, + Difference, + Exclusion, + Hue, + Saturation, + Color, + Luminosity, +} + +#[cfg(target_os = "macos")] +pub type NativeFontHandle = CGFont; + +/// Native fonts are not used on Linux; all fonts are raw. +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +#[cfg_attr(not(any(target_os = "macos", target_os = "windows")), derive(Clone, Serialize, Deserialize))] +pub struct NativeFontHandle; + +#[cfg(target_os = "windows")] +pub type NativeFontHandle = FontDescriptor; + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct PipelineId(pub u32, pub u32); + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct RectangleDisplayItem { + pub color: ColorF, +} + +#[derive(Clone, Deserialize, Serialize)] +pub struct RenderApiSender { + api_sender: MsgSender, + payload_sender: PayloadSender, +} + +pub trait RenderNotifier: Send { + fn new_frame_ready(&mut self); + fn new_scroll_frame_ready(&mut self, composite_needed: bool); + fn pipeline_size_changed(&mut self, pipeline_id: PipelineId, size: Option); + fn external_event(&mut self, _evt: ExternalEvent) { unimplemented!() } + fn shut_down(&mut self) {} +} + +// Trait to allow dispatching functions to a specific thread or event loop. +pub trait RenderDispatcher: Send { + fn dispatch(&self, Box); +} + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub struct ResourceId(pub u32); + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub enum ScrollEventPhase { + /// The user started scrolling. + Start, + /// The user performed a scroll. The Boolean flag indicates whether the user's fingers are + /// down, if a touchpad is in use. (If false, the event is a touchpad fling.) + Move(bool), + /// The user ended scrolling. + End, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ScrollLayerId { + pub pipeline_id: PipelineId, + pub info: ScrollLayerInfo, +} + +impl ScrollLayerId { + pub fn root(pipeline_id: PipelineId) -> ScrollLayerId { + ScrollLayerId { + pipeline_id: pipeline_id, + info: ScrollLayerInfo::Scrollable(0, ServoScrollRootId(0)), + } + } + + pub fn scroll_root_id(&self) -> Option { + match self.info { + ScrollLayerInfo::Scrollable(_, scroll_root_id) => Some(scroll_root_id), + ScrollLayerInfo::Fixed => None, + } + } +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum ScrollLayerInfo { + Fixed, + Scrollable(usize, ServoScrollRootId) +} + +#[derive(Clone, Deserialize, Serialize)] +pub struct ScrollLayerState { + pub pipeline_id: PipelineId, + pub scroll_root_id: ServoScrollRootId, + pub scroll_offset: LayoutPoint, +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub enum ScrollPolicy { + Scrollable, + Fixed, +} +known_heap_size!(0, ScrollPolicy); + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum ScrollLocation { + /// Scroll by a certain amount. + Delta(LayoutPoint), + /// Scroll to very top of element. + Start, + /// Scroll to very bottom of element. + End +} + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct ServoScrollRootId(pub usize); + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub enum SpecificDisplayItem { + Rectangle(RectangleDisplayItem), + Text(TextDisplayItem), + Image(ImageDisplayItem), + YuvImage(YuvImageDisplayItem), + WebGL(WebGLDisplayItem), + Border(BorderDisplayItem), + BoxShadow(BoxShadowDisplayItem), + Gradient(GradientDisplayItem), + RadialGradient(RadialGradientDisplayItem), + Iframe(IframeDisplayItem), + PushStackingContext(PushStackingContextDisplayItem), + PopStackingContext, + PushScrollLayer(PushScrollLayerItem), + PopScrollLayer, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct StackingContext { + pub scroll_policy: ScrollPolicy, + pub bounds: LayoutRect, + pub z_index: i32, + pub transform: LayoutTransform, + pub perspective: LayoutTransform, + pub mix_blend_mode: MixBlendMode, + pub filters: ItemRange, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct TextDisplayItem { + pub glyphs: ItemRange, + pub font_key: FontKey, + pub size: Au, + pub color: ColorF, + pub blur_radius: Au, +} + +#[derive(Clone, Deserialize, Serialize)] +pub enum WebGLCommand { + GetContextAttributes(MsgSender), + ActiveTexture(u32), + BlendColor(f32, f32, f32, f32), + BlendEquation(u32), + BlendEquationSeparate(u32, u32), + BlendFunc(u32, u32), + BlendFuncSeparate(u32, u32, u32, u32), + AttachShader(WebGLProgramId, WebGLShaderId), + DetachShader(WebGLProgramId, WebGLShaderId), + BindAttribLocation(WebGLProgramId, u32, String), + BufferData(u32, Vec, u32), + BufferSubData(u32, isize, Vec), + Clear(u32), + ClearColor(f32, f32, f32, f32), + ClearDepth(f64), + ClearStencil(i32), + ColorMask(bool, bool, bool, bool), + CullFace(u32), + FrontFace(u32), + DepthFunc(u32), + DepthMask(bool), + DepthRange(f64, f64), + Enable(u32), + Disable(u32), + CompileShader(WebGLShaderId, String), + CopyTexImage2D(u32, i32, u32, i32, i32, i32, i32, i32), + CopyTexSubImage2D(u32, i32, i32, i32, i32, i32, i32, i32), + CreateBuffer(MsgSender>), + CreateFramebuffer(MsgSender>), + CreateRenderbuffer(MsgSender>), + CreateTexture(MsgSender>), + CreateProgram(MsgSender>), + CreateShader(u32, MsgSender>), + DeleteBuffer(WebGLBufferId), + DeleteFramebuffer(WebGLFramebufferId), + DeleteRenderbuffer(WebGLRenderbufferId), + DeleteTexture(WebGLTextureId), + DeleteProgram(WebGLProgramId), + DeleteShader(WebGLShaderId), + BindBuffer(u32, Option), + BindFramebuffer(u32, WebGLFramebufferBindingRequest), + BindRenderbuffer(u32, Option), + BindTexture(u32, Option), + DisableVertexAttribArray(u32), + DrawArrays(u32, i32, i32), + DrawElements(u32, i32, u32, i64), + EnableVertexAttribArray(u32), + FramebufferRenderbuffer(u32, u32, u32, Option), + FramebufferTexture2D(u32, u32, u32, Option, i32), + GetBufferParameter(u32, u32, MsgSender>), + GetParameter(u32, MsgSender>), + GetProgramParameter(WebGLProgramId, u32, MsgSender>), + GetShaderParameter(WebGLShaderId, u32, MsgSender>), + GetActiveAttrib(WebGLProgramId, u32, MsgSender>), + GetActiveUniform(WebGLProgramId, u32, MsgSender>), + GetAttribLocation(WebGLProgramId, String, MsgSender>), + GetUniformLocation(WebGLProgramId, String, MsgSender>), + GetVertexAttrib(u32, u32, MsgSender>), + GetShaderInfoLog(WebGLShaderId, MsgSender), + GetProgramInfoLog(WebGLProgramId, MsgSender), + PolygonOffset(f32, f32), + RenderbufferStorage(u32, u32, i32, i32), + ReadPixels(i32, i32, i32, i32, u32, u32, MsgSender>), + SampleCoverage(f32, bool), + Scissor(i32, i32, i32, i32), + StencilFunc(u32, i32, u32), + StencilFuncSeparate(u32, u32, i32, u32), + StencilMask(u32), + StencilMaskSeparate(u32, u32), + StencilOp(u32, u32, u32), + StencilOpSeparate(u32, u32, u32, u32), + Hint(u32, u32), + IsEnabled(u32, MsgSender), + LineWidth(f32), + PixelStorei(u32, i32), + LinkProgram(WebGLProgramId), + Uniform1f(i32, f32), + Uniform1fv(i32, Vec), + Uniform1i(i32, i32), + Uniform1iv(i32, Vec), + Uniform2f(i32, f32, f32), + Uniform2fv(i32, Vec), + Uniform2i(i32, i32, i32), + Uniform2iv(i32, Vec), + Uniform3f(i32, f32, f32, f32), + Uniform3fv(i32, Vec), + Uniform3i(i32, i32, i32, i32), + Uniform3iv(i32, Vec), + Uniform4f(i32, f32, f32, f32, f32), + Uniform4fv(i32, Vec), + Uniform4i(i32, i32, i32, i32, i32), + Uniform4iv(i32, Vec), + UniformMatrix2fv(i32, bool, Vec), + UniformMatrix3fv(i32, bool, Vec), + UniformMatrix4fv(i32, bool, Vec), + UseProgram(WebGLProgramId), + ValidateProgram(WebGLProgramId), + VertexAttrib(u32, f32, f32, f32, f32), + VertexAttribPointer(u32, i32, u32, bool, i32, u32), + VertexAttribPointer2f(u32, i32, bool, i32, u32), + Viewport(i32, i32, i32, i32), + TexImage2D(u32, i32, i32, i32, i32, u32, u32, Vec), + TexParameteri(u32, u32, i32), + TexParameterf(u32, u32, f32), + TexSubImage2D(u32, i32, i32, i32, i32, i32, u32, u32, Vec), + DrawingBufferWidth(MsgSender), + DrawingBufferHeight(MsgSender), + Finish(MsgSender<()>), + Flush, + GenerateMipmap(u32), +} + +#[cfg(feature = "nightly")] +macro_rules! define_resource_id_struct { + ($name:ident) => { + #[derive(Clone, Copy, PartialEq)] + pub struct $name(NonZero); + + impl $name { + #[inline] + unsafe fn new(id: u32) -> Self { + $name(NonZero::new(id)) + } + + #[inline] + fn get(self) -> u32 { + *self.0 + } + } + + }; +} + +#[cfg(not(feature = "nightly"))] +macro_rules! define_resource_id_struct { + ($name:ident) => { + #[derive(Clone, Copy, PartialEq)] + pub struct $name(u32); + + impl $name { + #[inline] + unsafe fn new(id: u32) -> Self { + $name(id) + } + + #[inline] + fn get(self) -> u32 { + self.0 + } + } + }; +} + +macro_rules! define_resource_id { + ($name:ident) => { + define_resource_id_struct!($name); + + impl ::serde::Deserialize for $name { + fn deserialize(deserializer: &mut D) -> Result + where D: ::serde::Deserializer + { + let id = try!(u32::deserialize(deserializer)); + if id == 0 { + Err(::serde::Error::invalid_value("expected a non-zero value")) + } else { + Ok(unsafe { $name::new(id) }) + } + } + } + + impl ::serde::Serialize for $name { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: ::serde::Serializer + { + self.get().serialize(serializer) + } + } + + impl ::std::fmt::Debug for $name { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter) + -> Result<(), ::std::fmt::Error> { + fmt.debug_tuple(stringify!($name)) + .field(&self.get()) + .finish() + } + } + + impl ::std::fmt::Display for $name { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter) + -> Result<(), ::std::fmt::Error> { + write!(fmt, "{}", self.get()) + } + } + + impl ::heapsize::HeapSizeOf for $name { + fn heap_size_of_children(&self) -> usize { 0 } + } + } +} + +define_resource_id!(WebGLBufferId); +define_resource_id!(WebGLFramebufferId); +define_resource_id!(WebGLRenderbufferId); +define_resource_id!(WebGLTextureId); +define_resource_id!(WebGLProgramId); +define_resource_id!(WebGLShaderId); + +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub struct WebGLContextId(pub usize); + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct WebGLDisplayItem { + pub context_id: WebGLContextId, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub enum WebGLError { + InvalidEnum, + InvalidFramebufferOperation, + InvalidOperation, + InvalidValue, + OutOfMemory, + ContextLost, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum WebGLFramebufferBindingRequest { + Explicit(WebGLFramebufferId), + Default, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum WebGLParameter { + Int(i32), + Bool(bool), + String(String), + Float(f32), + FloatArray(Vec), + Invalid, +} + +pub type WebGLResult = Result; + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum WebGLShaderParameter { + Int(i32), + Bool(bool), + Invalid, +} + +pub type VRCompositorId = u64; + +// WebVR commands that must be called in the WebGL render thread. +#[derive(Clone, Deserialize, Serialize)] +pub enum VRCompositorCommand { + Create(VRCompositorId), + SyncPoses(VRCompositorId, f64, f64, MsgSender,()>>), + SubmitFrame(VRCompositorId, [f32; 4], [f32; 4]), + Release(VRCompositorId) +} + +// Trait object that handles WebVR commands. +// Receives the texture_id associated to the WebGLContext. +pub trait VRCompositorHandler: Send { + fn handle(&mut self, command: VRCompositorCommand, texture_id: Option); +} \ No newline at end of file diff --git a/gfx/webrender_traits/src/units.rs b/gfx/webrender_traits/src/units.rs new file mode 100644 index 000000000000..7e1d5a040f82 --- /dev/null +++ b/gfx/webrender_traits/src/units.rs @@ -0,0 +1,93 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! A collection of coordinate spaces and their corresponding Point, Size and Rect types. +//! +//! Physical pixels take into account the device pixel ratio and their dimensions tend +//! to correspond to the allocated size of resources in memory, while logical pixels +//! don't have the device pixel ratio applied which means they are agnostic to the usage +//! of hidpi screens and the like. +//! +//! The terms "layer" and "stacking context" can be used interchangeably +//! in the context of coordinate systems. + +use euclid::{TypedMatrix4D, TypedRect, TypedPoint2D, TypedSize2D, TypedPoint4D, Length}; + +/// Geometry in the coordinate system of the render target (screen or intermediate +/// surface) in physical pixels. +#[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct DevicePixel; + +pub type DeviceIntRect = TypedRect; +pub type DeviceIntPoint = TypedPoint2D; +pub type DeviceIntSize = TypedSize2D; +pub type DeviceIntLength = Length; + +pub type DeviceUintRect = TypedRect; +pub type DeviceUintPoint = TypedPoint2D; +pub type DeviceUintSize = TypedSize2D; + +pub type DeviceRect = TypedRect; +pub type DevicePoint = TypedPoint2D; +pub type DeviceSize = TypedSize2D; + +/// Geometry in a stacking context's local coordinate space (logical pixels). +/// +/// For now layout pixels are equivalent to layer pixels, but it may change. +pub type LayoutPixel = LayerPixel; + +pub type LayoutRect = LayerRect; +pub type LayoutPoint = LayerPoint; +pub type LayoutSize = LayerSize; + +/// Geometry in a layer's local coordinate space (logical pixels). +#[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct LayerPixel; + +pub type LayerRect = TypedRect; +pub type LayerPoint = TypedPoint2D; +pub type LayerSize = TypedSize2D; +pub type LayerPoint4D = TypedPoint4D; + +/// Geometry in a layer's scrollable parent coordinate space (logical pixels). +/// +/// Some layers are scrollable while some are not. There is a distinction between +/// a layer's parent layer and a layer's scrollable parent layer (its closest parent +/// that is scrollable, but not necessarily its immediate parent). Most of the internal +/// transforms are expressed in terms of the scrollable parent and not the immediate +/// parent. +#[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct ScrollLayerPixel; + +pub type ScrollLayerRect = TypedRect; +pub type ScrollLayerPoint = TypedPoint2D; +pub type ScrollLayerSize = TypedSize2D; + +/// Geometry in the document's coordinate space (logical pixels). +#[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct WorldPixel; + +pub type WorldRect = TypedRect; +pub type WorldPoint = TypedPoint2D; +pub type WorldSize = TypedSize2D; +pub type WorldPoint4D = TypedPoint4D; + + +pub type LayoutTransform = TypedMatrix4D; +pub type LayerTransform = TypedMatrix4D; +pub type LayerToScrollTransform = TypedMatrix4D; +pub type ScrollToLayerTransform = TypedMatrix4D; +pub type LayerToWorldTransform = TypedMatrix4D; +pub type WorldToLayerTransform = TypedMatrix4D; +pub type ScrollToWorldTransform = TypedMatrix4D; + + +pub fn device_length(value: f32, device_pixel_ratio: f32) -> DeviceIntLength { + DeviceIntLength::new((value * device_pixel_ratio).round() as i32) +} + +pub fn as_scroll_parent_rect(rect: &LayerRect) -> ScrollLayerRect { + ScrollLayerRect::from_untyped(&rect.to_untyped()) +} + diff --git a/gfx/webrender_traits/src/webgl.rs b/gfx/webrender_traits/src/webgl.rs new file mode 100644 index 000000000000..80c8cce6dceb --- /dev/null +++ b/gfx/webrender_traits/src/webgl.rs @@ -0,0 +1,708 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use channel::MsgSender; +use gleam::gl; +use offscreen_gl_context::{GLContext, NativeGLContextMethods}; +use std::fmt; +use {WebGLBufferId, WebGLCommand, WebGLError, WebGLFramebufferBindingRequest}; +use {WebGLFramebufferId, WebGLParameter, WebGLProgramId, WebGLRenderbufferId}; +use {WebGLResult, WebGLShaderId, WebGLTextureId}; + +impl fmt::Debug for WebGLCommand { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use WebGLCommand::*; + let name = match *self { + GetContextAttributes(..) => "GetContextAttributes", + ActiveTexture(..) => "ActiveTexture", + BlendColor(..) => "BlendColor", + BlendEquation(..) => "BlendEquation", + BlendEquationSeparate(..) => "BlendEquationSeparate", + BlendFunc(..) => "BlendFunc", + BlendFuncSeparate(..) => "BlendFuncSeparate", + AttachShader(..) => "AttachShader", + DetachShader(..) => "DetachShader", + BindAttribLocation(..) => "BindAttribLocation", + BufferData(..) => "BufferData", + BufferSubData(..) => "BufferSubData", + Clear(..) => "Clear", + ClearColor(..) => "ClearColor", + ClearDepth(..) => "ClearDepth", + ClearStencil(..) => "ClearStencil", + ColorMask(..) => "ColorMask", + CopyTexImage2D(..) => "CopyTexImage2D", + CopyTexSubImage2D(..) => "CopyTexSubImage2D", + CullFace(..) => "CullFace", + FrontFace(..) => "FrontFace", + DepthFunc(..) => "DepthFunc", + DepthMask(..) => "DepthMask", + DepthRange(..) => "DepthRange", + Enable(..) => "Enable", + Disable(..) => "Disable", + CompileShader(..) => "CompileShader", + CreateBuffer(..) => "CreateBuffer", + CreateFramebuffer(..) => "CreateFramebuffer", + CreateRenderbuffer(..) => "CreateRenderbuffer", + CreateTexture(..) => "CreateTexture", + CreateProgram(..) => "CreateProgram", + CreateShader(..) => "CreateShader", + DeleteBuffer(..) => "DeleteBuffer", + DeleteFramebuffer(..) => "DeleteFramebuffer", + DeleteRenderbuffer(..) => "DeleteRenderBuffer", + DeleteTexture(..) => "DeleteTexture", + DeleteProgram(..) => "DeleteProgram", + DeleteShader(..) => "DeleteShader", + BindBuffer(..) => "BindBuffer", + BindFramebuffer(..) => "BindFramebuffer", + BindRenderbuffer(..) => "BindRenderbuffer", + BindTexture(..) => "BindTexture", + DisableVertexAttribArray(..) => "DisableVertexAttribArray", + DrawArrays(..) => "DrawArrays", + DrawElements(..) => "DrawElements", + EnableVertexAttribArray(..) => "EnableVertexAttribArray", + FramebufferRenderbuffer(..) => "FramebufferRenderbuffer", + FramebufferTexture2D(..) => "FramebufferTexture2D", + GetBufferParameter(..) => "GetBufferParameter", + GetParameter(..) => "GetParameter", + GetProgramParameter(..) => "GetProgramParameter", + GetShaderParameter(..) => "GetShaderParameter", + GetActiveAttrib(..) => "GetActiveAttrib", + GetActiveUniform(..) => "GetActiveUniform", + GetAttribLocation(..) => "GetAttribLocation", + GetUniformLocation(..) => "GetUniformLocation", + GetShaderInfoLog(..) => "GetShaderInfoLog", + GetProgramInfoLog(..) => "GetProgramInfoLog", + GetVertexAttrib(..) => "GetVertexAttrib", + PolygonOffset(..) => "PolygonOffset", + ReadPixels(..) => "ReadPixels", + RenderbufferStorage(..) => "RenderbufferStorage", + SampleCoverage(..) => "SampleCoverage", + Scissor(..) => "Scissor", + StencilFunc(..) => "StencilFunc", + StencilFuncSeparate(..) => "StencilFuncSeparate", + StencilMask(..) => "StencilMask", + StencilMaskSeparate(..) => "StencilMaskSeparate", + StencilOp(..) => "StencilOp", + StencilOpSeparate(..) => "StencilOpSeparate", + Hint(..) => "Hint", + IsEnabled(..) => "IsEnabled", + LineWidth(..) => "LineWidth", + PixelStorei(..) => "PixelStorei", + LinkProgram(..) => "LinkProgram", + Uniform1f(..) => "Uniform1f", + Uniform1fv(..) => "Uniform1fv", + Uniform1i(..) => "Uniform1i", + Uniform1iv(..) => "Uniform1iv", + Uniform2f(..) => "Uniform2f", + Uniform2fv(..) => "Uniform2fv", + Uniform2i(..) => "Uniform2i", + Uniform2iv(..) => "Uniform2iv", + Uniform3f(..) => "Uniform3f", + Uniform3fv(..) => "Uniform3fv", + Uniform3i(..) => "Uniform3i", + Uniform3iv(..) => "Uniform3iv", + Uniform4f(..) => "Uniform4f", + Uniform4fv(..) => "Uniform4fv", + Uniform4i(..) => "Uniform4i", + Uniform4iv(..) => "Uniform4iv", + UniformMatrix2fv(..) => "UniformMatrix2fv", + UniformMatrix3fv(..) => "UniformMatrix3fv", + UniformMatrix4fv(..) => "UniformMatrix4fv", + UseProgram(..) => "UseProgram", + ValidateProgram(..) => "ValidateProgram", + VertexAttrib(..) => "VertexAttrib", + VertexAttribPointer2f(..) => "VertexAttribPointer2f", + VertexAttribPointer(..) => "VertexAttribPointer", + Viewport(..) => "Viewport", + TexImage2D(..) => "TexImage2D", + TexParameteri(..) => "TexParameteri", + TexParameterf(..) => "TexParameterf", + TexSubImage2D(..) => "TexSubImage2D", + DrawingBufferWidth(..) => "DrawingBufferWidth", + DrawingBufferHeight(..) => "DrawingBufferHeight", + Finish(..) => "Finish", + Flush => "Flush", + GenerateMipmap(..) => "GenerateMipmap", + }; + + write!(f, "CanvasWebGLMsg::{}(..)", name) + } +} + +impl WebGLCommand { + /// NOTE: This method consumes the command + pub fn apply(self, ctx: &GLContext) { + match self { + WebGLCommand::GetContextAttributes(sender) => + sender.send(*ctx.borrow_attributes()).unwrap(), + WebGLCommand::ActiveTexture(target) => + gl::active_texture(target), + WebGLCommand::AttachShader(program_id, shader_id) => + gl::attach_shader(program_id.get(), shader_id.get()), + WebGLCommand::DetachShader(program_id, shader_id) => + gl::detach_shader(program_id.get(), shader_id.get()), + WebGLCommand::BindAttribLocation(program_id, index, name) => + gl::bind_attrib_location(program_id.get(), index, &name), + WebGLCommand::BlendColor(r, g, b, a) => + gl::blend_color(r, g, b, a), + WebGLCommand::BlendEquation(mode) => + gl::blend_equation(mode), + WebGLCommand::BlendEquationSeparate(mode_rgb, mode_alpha) => + gl::blend_equation_separate(mode_rgb, mode_alpha), + WebGLCommand::BlendFunc(src, dest) => + gl::blend_func(src, dest), + WebGLCommand::BlendFuncSeparate(src_rgb, dest_rgb, src_alpha, dest_alpha) => + gl::blend_func_separate(src_rgb, dest_rgb, src_alpha, dest_alpha), + WebGLCommand::BufferData(buffer_type, data, usage) => + gl::buffer_data(buffer_type, &data, usage), + WebGLCommand::BufferSubData(buffer_type, offset, data) => + gl::buffer_sub_data(buffer_type, offset, &data), + WebGLCommand::Clear(mask) => + gl::clear(mask), + WebGLCommand::ClearColor(r, g, b, a) => + gl::clear_color(r, g, b, a), + WebGLCommand::ClearDepth(depth) => + gl::clear_depth(depth), + WebGLCommand::ClearStencil(stencil) => + gl::clear_stencil(stencil), + WebGLCommand::ColorMask(r, g, b, a) => + gl::color_mask(r, g, b, a), + WebGLCommand::CopyTexImage2D(target, level, internal_format, x, y, width, height, border) => + gl::copy_tex_image_2d(target, level, internal_format, x, y, width, height, border), + WebGLCommand::CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height) => + gl::copy_tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height), + WebGLCommand::CullFace(mode) => + gl::cull_face(mode), + WebGLCommand::DepthFunc(func) => + gl::depth_func(func), + WebGLCommand::DepthMask(flag) => + gl::depth_mask(flag), + WebGLCommand::DepthRange(near, far) => + gl::depth_range(near, far), + WebGLCommand::Disable(cap) => + gl::disable(cap), + WebGLCommand::Enable(cap) => + gl::enable(cap), + WebGLCommand::FramebufferRenderbuffer(target, attachment, renderbuffertarget, rb) => + gl::framebuffer_renderbuffer(target, attachment, renderbuffertarget, rb.map_or(0, WebGLRenderbufferId::get)), + WebGLCommand::FramebufferTexture2D(target, attachment, textarget, texture, level) => + gl::framebuffer_texture_2d(target, attachment, textarget, texture.map_or(0, WebGLTextureId::get), level), + WebGLCommand::FrontFace(mode) => + gl::front_face(mode), + WebGLCommand::DisableVertexAttribArray(attrib_id) => + gl::disable_vertex_attrib_array(attrib_id), + WebGLCommand::DrawArrays(mode, first, count) => + gl::draw_arrays(mode, first, count), + WebGLCommand::DrawElements(mode, count, type_, offset) => + gl::draw_elements(mode, count, type_, offset as u32), + WebGLCommand::EnableVertexAttribArray(attrib_id) => + gl::enable_vertex_attrib_array(attrib_id), + WebGLCommand::Hint(name, val) => + gl::hint(name, val), + WebGLCommand::IsEnabled(cap, chan) => + chan.send(gl::is_enabled(cap) != 0).unwrap(), + WebGLCommand::LineWidth(width) => + gl::line_width(width), + WebGLCommand::PixelStorei(name, val) => + gl::pixel_store_i(name, val), + WebGLCommand::PolygonOffset(factor, units) => + gl::polygon_offset(factor, units), + WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, chan) => + Self::read_pixels(x, y, width, height, format, pixel_type, chan), + WebGLCommand::RenderbufferStorage(target, format, width, height) => + gl::renderbuffer_storage(target, format, width, height), + WebGLCommand::SampleCoverage(value, invert) => + gl::sample_coverage(value, invert), + WebGLCommand::Scissor(x, y, width, height) => + gl::scissor(x, y, width, height), + WebGLCommand::StencilFunc(func, ref_, mask) => + gl::stencil_func(func, ref_, mask), + WebGLCommand::StencilFuncSeparate(face, func, ref_, mask) => + gl::stencil_func_separate(face, func, ref_, mask), + WebGLCommand::StencilMask(mask) => + gl::stencil_mask(mask), + WebGLCommand::StencilMaskSeparate(face, mask) => + gl::stencil_mask_separate(face, mask), + WebGLCommand::StencilOp(fail, zfail, zpass) => + gl::stencil_op(fail, zfail, zpass), + WebGLCommand::StencilOpSeparate(face, fail, zfail, zpass) => + gl::stencil_op_separate(face, fail, zfail, zpass), + WebGLCommand::GetActiveAttrib(program_id, index, chan) => + Self::active_attrib(program_id, index, chan), + WebGLCommand::GetActiveUniform(program_id, index, chan) => + Self::active_uniform(program_id, index, chan), + WebGLCommand::GetAttribLocation(program_id, name, chan) => + Self::attrib_location(program_id, name, chan), + WebGLCommand::GetVertexAttrib(index, pname, chan) => + Self::vertex_attrib(index, pname, chan), + WebGLCommand::GetBufferParameter(target, param_id, chan) => + Self::buffer_parameter(target, param_id, chan), + WebGLCommand::GetParameter(param_id, chan) => + Self::parameter(param_id, chan), + WebGLCommand::GetProgramParameter(program_id, param_id, chan) => + Self::program_parameter(program_id, param_id, chan), + WebGLCommand::GetShaderParameter(shader_id, param_id, chan) => + Self::shader_parameter(shader_id, param_id, chan), + WebGLCommand::GetUniformLocation(program_id, name, chan) => + Self::uniform_location(program_id, name, chan), + WebGLCommand::GetShaderInfoLog(shader_id, chan) => + Self::shader_info_log(shader_id, chan), + WebGLCommand::GetProgramInfoLog(program_id, chan) => + Self::program_info_log(program_id, chan), + WebGLCommand::CompileShader(shader_id, source) => + Self::compile_shader(shader_id, source), + WebGLCommand::CreateBuffer(chan) => + Self::create_buffer(chan), + WebGLCommand::CreateFramebuffer(chan) => + Self::create_framebuffer(chan), + WebGLCommand::CreateRenderbuffer(chan) => + Self::create_renderbuffer(chan), + WebGLCommand::CreateTexture(chan) => + Self::create_texture(chan), + WebGLCommand::CreateProgram(chan) => + Self::create_program(chan), + WebGLCommand::CreateShader(shader_type, chan) => + Self::create_shader(shader_type, chan), + WebGLCommand::DeleteBuffer(id) => + gl::delete_buffers(&[id.get()]), + WebGLCommand::DeleteFramebuffer(id) => + gl::delete_framebuffers(&[id.get()]), + WebGLCommand::DeleteRenderbuffer(id) => + gl::delete_renderbuffers(&[id.get()]), + WebGLCommand::DeleteTexture(id) => + gl::delete_textures(&[id.get()]), + WebGLCommand::DeleteProgram(id) => + gl::delete_program(id.get()), + WebGLCommand::DeleteShader(id) => + gl::delete_shader(id.get()), + WebGLCommand::BindBuffer(target, id) => + gl::bind_buffer(target, id.map_or(0, WebGLBufferId::get)), + WebGLCommand::BindFramebuffer(target, request) => + Self::bind_framebuffer(target, request, ctx), + WebGLCommand::BindRenderbuffer(target, id) => + gl::bind_renderbuffer(target, id.map_or(0, WebGLRenderbufferId::get)), + WebGLCommand::BindTexture(target, id) => + gl::bind_texture(target, id.map_or(0, WebGLTextureId::get)), + WebGLCommand::LinkProgram(program_id) => + gl::link_program(program_id.get()), + WebGLCommand::Uniform1f(uniform_id, v) => + gl::uniform_1f(uniform_id, v), + WebGLCommand::Uniform1fv(uniform_id, v) => + gl::uniform_1fv(uniform_id, &v), + WebGLCommand::Uniform1i(uniform_id, v) => + gl::uniform_1i(uniform_id, v), + WebGLCommand::Uniform1iv(uniform_id, v) => + gl::uniform_1iv(uniform_id, &v), + WebGLCommand::Uniform2f(uniform_id, x, y) => + gl::uniform_2f(uniform_id, x, y), + WebGLCommand::Uniform2fv(uniform_id, v) => + gl::uniform_2fv(uniform_id, &v), + WebGLCommand::Uniform2i(uniform_id, x, y) => + gl::uniform_2i(uniform_id, x, y), + WebGLCommand::Uniform2iv(uniform_id, v) => + gl::uniform_2iv(uniform_id, &v), + WebGLCommand::Uniform3f(uniform_id, x, y, z) => + gl::uniform_3f(uniform_id, x, y, z), + WebGLCommand::Uniform3fv(uniform_id, v) => + gl::uniform_3fv(uniform_id, &v), + WebGLCommand::Uniform3i(uniform_id, x, y, z) => + gl::uniform_3i(uniform_id, x, y, z), + WebGLCommand::Uniform3iv(uniform_id, v) => + gl::uniform_3iv(uniform_id, &v), + WebGLCommand::Uniform4f(uniform_id, x, y, z, w) => + gl::uniform_4f(uniform_id, x, y, z, w), + WebGLCommand::Uniform4fv(uniform_id, v) => + gl::uniform_4fv(uniform_id, &v), + WebGLCommand::Uniform4i(uniform_id, x, y, z, w) => + gl::uniform_4i(uniform_id, x, y, z, w), + WebGLCommand::Uniform4iv(uniform_id, v) => + gl::uniform_4iv(uniform_id, &v), + WebGLCommand::UniformMatrix2fv(uniform_id, transpose, v) => + gl::uniform_matrix_2fv(uniform_id, transpose, &v), + WebGLCommand::UniformMatrix3fv(uniform_id, transpose, v) => + gl::uniform_matrix_3fv(uniform_id, transpose, &v), + WebGLCommand::UniformMatrix4fv(uniform_id, transpose, v) => + gl::uniform_matrix_4fv(uniform_id, transpose, &v), + WebGLCommand::UseProgram(program_id) => + gl::use_program(program_id.get()), + WebGLCommand::ValidateProgram(program_id) => + gl::validate_program(program_id.get()), + WebGLCommand::VertexAttrib(attrib_id, x, y, z, w) => + gl::vertex_attrib_4f(attrib_id, x, y, z, w), + WebGLCommand::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset) => + gl::vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset), + WebGLCommand::VertexAttribPointer(attrib_id, size, data_type, normalized, stride, offset) => + gl::vertex_attrib_pointer(attrib_id, size, data_type, normalized, stride, offset), + WebGLCommand::Viewport(x, y, width, height) => + gl::viewport(x, y, width, height), + WebGLCommand::TexImage2D(target, level, internal, width, height, format, data_type, data) => + gl::tex_image_2d(target, level, internal, width, height, /*border*/0, format, data_type, Some(&data)), + WebGLCommand::TexParameteri(target, name, value) => + gl::tex_parameter_i(target, name, value), + WebGLCommand::TexParameterf(target, name, value) => + gl::tex_parameter_f(target, name, value), + WebGLCommand::TexSubImage2D(target, level, xoffset, yoffset, x, y, width, height, data) => + gl::tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height, &data), + WebGLCommand::DrawingBufferWidth(sender) => + sender.send(ctx.borrow_draw_buffer().unwrap().size().width).unwrap(), + WebGLCommand::DrawingBufferHeight(sender) => + sender.send(ctx.borrow_draw_buffer().unwrap().size().height).unwrap(), + WebGLCommand::Finish(sender) => + Self::finish(sender), + WebGLCommand::Flush => + gl::flush(), + WebGLCommand::GenerateMipmap(target) => + gl::generate_mipmap(target), + } + + // FIXME: Use debug_assertions once tests are run with them + let error = gl::get_error(); + assert!(error == gl::NO_ERROR, "Unexpected WebGL error: 0x{:x} ({})", error, error); + } + + fn read_pixels(x: i32, y: i32, width: i32, height: i32, format: u32, pixel_type: u32, + chan: MsgSender>) { + let result = gl::read_pixels(x, y, width, height, format, pixel_type); + chan.send(result).unwrap() + } + + fn active_attrib(program_id: WebGLProgramId, + index: u32, + chan: MsgSender>) { + let result = if index >= gl::get_program_iv(program_id.get(), gl::ACTIVE_ATTRIBUTES) as u32 { + Err(WebGLError::InvalidValue) + } else { + Ok(gl::get_active_attrib(program_id.get(), index)) + }; + chan.send(result).unwrap(); + } + + fn active_uniform(program_id: WebGLProgramId, + index: u32, + chan: MsgSender>) { + let result = if index >= gl::get_program_iv(program_id.get(), gl::ACTIVE_UNIFORMS) as u32 { + Err(WebGLError::InvalidValue) + } else { + Ok(gl::get_active_uniform(program_id.get(), index)) + }; + chan.send(result).unwrap(); + } + + fn attrib_location(program_id: WebGLProgramId, + name: String, + chan: MsgSender> ) { + let attrib_location = gl::get_attrib_location(program_id.get(), &name); + + let attrib_location = if attrib_location == -1 { + None + } else { + Some(attrib_location) + }; + + chan.send(attrib_location).unwrap(); + } + + fn parameter(param_id: u32, + chan: MsgSender>) { + let result = match param_id { + gl::ACTIVE_TEXTURE | + //gl::ALPHA_BITS | + gl::BLEND_DST_ALPHA | + gl::BLEND_DST_RGB | + gl::BLEND_EQUATION_ALPHA | + gl::BLEND_EQUATION_RGB | + gl::BLEND_SRC_ALPHA | + gl::BLEND_SRC_RGB | + //gl::BLUE_BITS | + gl::CULL_FACE_MODE | + //gl::DEPTH_BITS | + gl::DEPTH_FUNC | + gl::FRONT_FACE | + //gl::GENERATE_MIPMAP_HINT | + //gl::GREEN_BITS | + //gl::IMPLEMENTATION_COLOR_READ_FORMAT | + //gl::IMPLEMENTATION_COLOR_READ_TYPE | + gl::MAX_COMBINED_TEXTURE_IMAGE_UNITS | + gl::MAX_CUBE_MAP_TEXTURE_SIZE | + //gl::MAX_FRAGMENT_UNIFORM_VECTORS | + gl::MAX_RENDERBUFFER_SIZE | + gl::MAX_TEXTURE_IMAGE_UNITS | + gl::MAX_TEXTURE_SIZE | + //gl::MAX_VARYING_VECTORS | + gl::MAX_VERTEX_ATTRIBS | + gl::MAX_VERTEX_TEXTURE_IMAGE_UNITS | + //gl::MAX_VERTEX_UNIFORM_VECTORS | + gl::PACK_ALIGNMENT | + //gl::RED_BITS | + gl::SAMPLE_BUFFERS | + gl::SAMPLES | + gl::STENCIL_BACK_FAIL | + gl::STENCIL_BACK_FUNC | + gl::STENCIL_BACK_PASS_DEPTH_FAIL | + gl::STENCIL_BACK_PASS_DEPTH_PASS | + gl::STENCIL_BACK_REF | + gl::STENCIL_BACK_VALUE_MASK | + gl::STENCIL_BACK_WRITEMASK | + //gl::STENCIL_BITS | + gl::STENCIL_CLEAR_VALUE | + gl::STENCIL_FAIL | + gl::STENCIL_FUNC | + gl::STENCIL_PASS_DEPTH_FAIL | + gl::STENCIL_PASS_DEPTH_PASS | + gl::STENCIL_REF | + gl::STENCIL_VALUE_MASK | + gl::STENCIL_WRITEMASK | + gl::SUBPIXEL_BITS | + gl::UNPACK_ALIGNMENT => + //gl::UNPACK_COLORSPACE_CONVERSION_WEBGL => + Ok(WebGLParameter::Int(gl::get_integer_v(param_id))), + + gl::BLEND | + gl::CULL_FACE | + gl::DEPTH_TEST | + gl::DEPTH_WRITEMASK | + gl::DITHER | + gl::POLYGON_OFFSET_FILL | + gl::SAMPLE_COVERAGE_INVERT | + gl::STENCIL_TEST => + //gl::UNPACK_FLIP_Y_WEBGL | + //gl::UNPACK_PREMULTIPLY_ALPHA_WEBGL => + Ok(WebGLParameter::Bool(gl::get_boolean_v(param_id) != 0)), + + gl::DEPTH_CLEAR_VALUE | + gl::LINE_WIDTH | + gl::POLYGON_OFFSET_FACTOR | + gl::POLYGON_OFFSET_UNITS | + gl::SAMPLE_COVERAGE_VALUE => + Ok(WebGLParameter::Float(gl::get_float_v(param_id))), + + gl::VERSION => Ok(WebGLParameter::String("WebGL 1.0".to_owned())), + gl::RENDERER | + gl::VENDOR => Ok(WebGLParameter::String("Mozilla/Servo".to_owned())), + gl::SHADING_LANGUAGE_VERSION => Ok(WebGLParameter::String("WebGL GLSL ES 1.0".to_owned())), + + // TODO(zbarsky, emilio): Implement support for the following valid parameters + // Float32Array + gl::ALIASED_LINE_WIDTH_RANGE | + //gl::ALIASED_POINT_SIZE_RANGE | + //gl::BLEND_COLOR | + gl::COLOR_CLEAR_VALUE | + gl::DEPTH_RANGE | + + // WebGLBuffer + gl::ARRAY_BUFFER_BINDING | + gl::ELEMENT_ARRAY_BUFFER_BINDING | + + // WebGLFrameBuffer + gl::FRAMEBUFFER_BINDING | + + // WebGLRenderBuffer + gl::RENDERBUFFER_BINDING | + + // WebGLProgram + gl::CURRENT_PROGRAM | + + // WebGLTexture + gl::TEXTURE_BINDING_2D | + gl::TEXTURE_BINDING_CUBE_MAP | + + // sequence + gl::COLOR_WRITEMASK | + + // Uint32Array + gl::COMPRESSED_TEXTURE_FORMATS | + + // Int32Array + gl::MAX_VIEWPORT_DIMS | + gl::SCISSOR_BOX | + gl::VIEWPORT => Err(WebGLError::InvalidEnum), + + // Invalid parameters + _ => Err(WebGLError::InvalidEnum) + }; + + chan.send(result).unwrap(); + } + + fn finish(chan: MsgSender<()>) { + gl::finish(); + chan.send(()).unwrap(); + } + + fn vertex_attrib(index: u32, + pname: u32, + chan: MsgSender>) { + let result = if index >= gl::get_integer_v(gl::MAX_VERTEX_ATTRIBS) as u32 { + Err(WebGLError::InvalidValue) + } else { + match pname { + gl::VERTEX_ATTRIB_ARRAY_ENABLED | + gl::VERTEX_ATTRIB_ARRAY_NORMALIZED => + Ok(WebGLParameter::Bool(gl::get_vertex_attrib_iv(index, pname) != 0)), + gl::VERTEX_ATTRIB_ARRAY_SIZE | + gl::VERTEX_ATTRIB_ARRAY_STRIDE | + gl::VERTEX_ATTRIB_ARRAY_TYPE => + Ok(WebGLParameter::Int(gl::get_vertex_attrib_iv(index, pname))), + gl::CURRENT_VERTEX_ATTRIB => + Ok(WebGLParameter::FloatArray(gl::get_vertex_attrib_fv(index, pname))), + // gl::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING should return WebGLBuffer + _ => Err(WebGLError::InvalidEnum), + } + }; + + chan.send(result).unwrap(); + } + + fn buffer_parameter(target: u32, + param_id: u32, + chan: MsgSender>) { + let result = match param_id { + gl::BUFFER_SIZE | + gl::BUFFER_USAGE => + Ok(WebGLParameter::Int(gl::get_buffer_parameter_iv(target, param_id))), + _ => Err(WebGLError::InvalidEnum), + }; + + chan.send(result).unwrap(); + } + + fn program_parameter(program_id: WebGLProgramId, + param_id: u32, + chan: MsgSender>) { + let result = match param_id { + gl::DELETE_STATUS | + gl::LINK_STATUS | + gl::VALIDATE_STATUS => + Ok(WebGLParameter::Bool(gl::get_program_iv(program_id.get(), param_id) != 0)), + gl::ATTACHED_SHADERS | + gl::ACTIVE_ATTRIBUTES | + gl::ACTIVE_UNIFORMS => + Ok(WebGLParameter::Int(gl::get_program_iv(program_id.get(), param_id))), + _ => Err(WebGLError::InvalidEnum), + }; + + chan.send(result).unwrap(); + } + + fn shader_parameter(shader_id: WebGLShaderId, + param_id: u32, + chan: MsgSender>) { + let result = match param_id { + gl::SHADER_TYPE => + Ok(WebGLParameter::Int(gl::get_shader_iv(shader_id.get(), param_id))), + gl::DELETE_STATUS | + gl::COMPILE_STATUS => + Ok(WebGLParameter::Bool(gl::get_shader_iv(shader_id.get(), param_id) != 0)), + _ => Err(WebGLError::InvalidEnum), + }; + + chan.send(result).unwrap(); + } + + fn uniform_location(program_id: WebGLProgramId, + name: String, + chan: MsgSender>) { + let location = gl::get_uniform_location(program_id.get(), &name); + let location = if location == -1 { + None + } else { + Some(location) + }; + + chan.send(location).unwrap(); + } + + + fn shader_info_log(shader_id: WebGLShaderId, chan: MsgSender) { + let log = gl::get_shader_info_log(shader_id.get()); + chan.send(log).unwrap(); + } + + fn program_info_log(program_id: WebGLProgramId, chan: MsgSender) { + let log = gl::get_program_info_log(program_id.get()); + chan.send(log).unwrap(); + } + + fn create_buffer(chan: MsgSender>) { + let buffer = gl::gen_buffers(1)[0]; + let buffer = if buffer == 0 { + None + } else { + Some(unsafe { WebGLBufferId::new(buffer) }) + }; + chan.send(buffer).unwrap(); + } + + fn create_framebuffer(chan: MsgSender>) { + let framebuffer = gl::gen_framebuffers(1)[0]; + let framebuffer = if framebuffer == 0 { + None + } else { + Some(unsafe { WebGLFramebufferId::new(framebuffer) }) + }; + chan.send(framebuffer).unwrap(); + } + + + fn create_renderbuffer(chan: MsgSender>) { + let renderbuffer = gl::gen_renderbuffers(1)[0]; + let renderbuffer = if renderbuffer == 0 { + None + } else { + Some(unsafe { WebGLRenderbufferId::new(renderbuffer) }) + }; + chan.send(renderbuffer).unwrap(); + } + + fn create_texture(chan: MsgSender>) { + let texture = gl::gen_textures(1)[0]; + let texture = if texture == 0 { + None + } else { + Some(unsafe { WebGLTextureId::new(texture) }) + }; + chan.send(texture).unwrap(); + } + + + fn create_program(chan: MsgSender>) { + let program = gl::create_program(); + let program = if program == 0 { + None + } else { + Some(unsafe { WebGLProgramId::new(program) }) + }; + chan.send(program).unwrap(); + } + + fn create_shader(shader_type: u32, chan: MsgSender>) { + let shader = gl::create_shader(shader_type); + let shader = if shader == 0 { + None + } else { + Some(unsafe { WebGLShaderId::new(shader) }) + }; + chan.send(shader).unwrap(); + } + + #[inline] + fn bind_framebuffer(target: u32, + request: WebGLFramebufferBindingRequest, + ctx: &GLContext) { + let id = match request { + WebGLFramebufferBindingRequest::Explicit(id) => id.get(), + WebGLFramebufferBindingRequest::Default => + ctx.borrow_draw_buffer().unwrap().get_framebuffer(), + }; + + gl::bind_framebuffer(target, id); + } + + + #[inline] + fn compile_shader(shader_id: WebGLShaderId, source: String) { + gl::shader_source(shader_id.get(), &[source.as_bytes()]); + gl::compile_shader(shader_id.get()); + } +} From 3b39cf43fc018477601401d15df9bcb874f5befe Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:52 -0500 Subject: [PATCH 63/70] Bug 1335525 - Update libgkrust to include webrender as an optional feature. r=froydnj MozReview-Commit-ID: 8usfSqFWkZ0 --- toolkit/library/gtest/rust/Cargo.toml | 1 + toolkit/library/rust/Cargo.toml | 1 + toolkit/library/rust/shared/Cargo.toml | 2 ++ toolkit/library/rust/shared/lib.rs | 2 ++ 4 files changed, 6 insertions(+) diff --git a/toolkit/library/gtest/rust/Cargo.toml b/toolkit/library/gtest/rust/Cargo.toml index 719aa674e41a..21627fc580aa 100644 --- a/toolkit/library/gtest/rust/Cargo.toml +++ b/toolkit/library/gtest/rust/Cargo.toml @@ -8,6 +8,7 @@ description = "Testing code for libgkrust" [features] bindgen = ["gkrust-shared/bindgen"] servo = ["gkrust-shared/servo"] +quantum_render = ["gkrust-shared/quantum_render"] [dependencies] mp4parse-gtest = { path = "../../../../dom/media/gtest" } diff --git a/toolkit/library/rust/Cargo.toml b/toolkit/library/rust/Cargo.toml index 1ba190a7b39c..586ef94fb94f 100644 --- a/toolkit/library/rust/Cargo.toml +++ b/toolkit/library/rust/Cargo.toml @@ -8,6 +8,7 @@ description = "Rust code for libxul" [features] bindgen = ["gkrust-shared/bindgen"] servo = ["gkrust-shared/servo"] +quantum_render = ["gkrust-shared/quantum_render"] [dependencies] gkrust-shared = { path = "shared" } diff --git a/toolkit/library/rust/shared/Cargo.toml b/toolkit/library/rust/shared/Cargo.toml index 5f192938d630..b9260ba86592 100644 --- a/toolkit/library/rust/shared/Cargo.toml +++ b/toolkit/library/rust/shared/Cargo.toml @@ -10,11 +10,13 @@ geckoservo = { path = "../../geckolib", optional = true } mp4parse_capi = { path = "../../../../media/libstagefright/binding/mp4parse_capi" } nsstring = { path = "../../../../xpcom/rust/nsstring" } rust_url_capi = { path = "../../../../netwerk/base/rust-url-capi" } +webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true } [features] default = [] bindgen = ["geckoservo/bindgen"] servo = ["geckoservo"] +quantum_render = ["webrender_bindings"] [lib] path = "lib.rs" diff --git a/toolkit/library/rust/shared/lib.rs b/toolkit/library/rust/shared/lib.rs index c26c8e227f23..4f572bd4b1c6 100644 --- a/toolkit/library/rust/shared/lib.rs +++ b/toolkit/library/rust/shared/lib.rs @@ -8,3 +8,5 @@ extern crate geckoservo; extern crate mp4parse_capi; extern crate nsstring; extern crate rust_url_capi; +#[cfg(feature = "quantum_render")] +extern crate webrender_bindings; From 10d3b0ebbe8b4d20b86921cbce2f56c17170a993 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:53 -0500 Subject: [PATCH 64/70] Bug 1335525 - Add webrender dependencies to third_party/rust. r=gfx MozReview-Commit-ID: L77ffKqR5QU --- .../rust/app_units/.cargo-checksum.json | 1 + third_party/rust/app_units/.cargo-ok | 0 third_party/rust/app_units/.gitignore | 2 + third_party/rust/app_units/.travis.yml | 8 + third_party/rust/app_units/Cargo.toml | 18 + third_party/rust/app_units/README.md | 3 + third_party/rust/app_units/src/app_unit.rs | 315 + third_party/rust/app_units/src/lib.rs | 16 + third_party/rust/bincode/.cargo-checksum.json | 1 + third_party/rust/bincode/.cargo-ok | 0 third_party/rust/bincode/.gitignore | 5 + third_party/rust/bincode/.travis.yml | 29 + third_party/rust/bincode/Cargo.toml | 29 + third_party/rust/bincode/LICENSE.md | 21 + third_party/rust/bincode/examples/basic.rs | 31 + third_party/rust/bincode/logo.png | Bin 0 -> 258333 bytes third_party/rust/bincode/readme.dev.md | 39 + third_party/rust/bincode/readme.md | 72 + third_party/rust/bincode/src/lib.rs | 79 + third_party/rust/bincode/src/refbox.rs | 434 + .../rust/bincode/src/rustc_serialize/mod.rs | 102 + .../bincode/src/rustc_serialize/reader.rs | 392 + .../bincode/src/rustc_serialize/writer.rs | 422 + third_party/rust/bincode/src/serde/mod.rs | 123 + third_party/rust/bincode/src/serde/reader.rs | 571 + third_party/rust/bincode/src/serde/writer.rs | 642 + third_party/rust/bincode/tests/test.rs | 579 + third_party/rust/bit-set/.cargo-checksum.json | 1 + third_party/rust/bit-set/.cargo-ok | 0 third_party/rust/bit-set/.gitignore | 2 + third_party/rust/bit-set/.travis.yml | 18 + third_party/rust/bit-set/Cargo.toml | 20 + third_party/rust/bit-set/LICENSE-APACHE | 201 + third_party/rust/bit-set/LICENSE-MIT | 25 + third_party/rust/bit-set/README.md | 6 + third_party/rust/bit-set/deploy-docs.sh | 20 + third_party/rust/bit-set/src/lib.rs | 1436 + third_party/rust/bit-vec/.cargo-checksum.json | 1 + third_party/rust/bit-vec/.cargo-ok | 0 third_party/rust/bit-vec/.gitignore | 2 + third_party/rust/bit-vec/.travis.yml | 19 + third_party/rust/bit-vec/Cargo.toml | 17 + third_party/rust/bit-vec/LICENSE-APACHE | 201 + third_party/rust/bit-vec/LICENSE-MIT | 25 + third_party/rust/bit-vec/README.md | 6 + third_party/rust/bit-vec/benches/extern.rs | 22 + third_party/rust/bit-vec/crusader.sh | 11 + third_party/rust/bit-vec/deploy-docs.sh | 20 + third_party/rust/bit-vec/src/bench.rs | 116 + third_party/rust/bit-vec/src/lib.rs | 2089 + .../rust/bitflags/.cargo-checksum.json | 1 + third_party/rust/bitflags/.cargo-ok | 0 third_party/rust/bitflags/.gitignore | 2 + third_party/rust/bitflags/.travis.yml | 24 + third_party/rust/bitflags/Cargo.toml | 13 + third_party/rust/bitflags/LICENSE-APACHE | 201 + third_party/rust/bitflags/LICENSE-MIT | 25 + third_party/rust/bitflags/README.md | 24 + third_party/rust/bitflags/src/lib.rs | 808 + third_party/rust/bitflags/tests/external.rs | 21 + .../rust/bitflags/tests/external_no_std.rs | 22 + .../rust/byteorder-0.5.3/.cargo-checksum.json | 1 + third_party/rust/byteorder-0.5.3/.cargo-ok | 0 third_party/rust/byteorder-0.5.3/.gitignore | 6 + third_party/rust/byteorder-0.5.3/.travis.yml | 15 + third_party/rust/byteorder-0.5.3/COPYING | 3 + third_party/rust/byteorder-0.5.3/Cargo.toml | 25 + third_party/rust/byteorder-0.5.3/LICENSE-MIT | 21 + third_party/rust/byteorder-0.5.3/Makefile | 14 + third_party/rust/byteorder-0.5.3/README.md | 59 + third_party/rust/byteorder-0.5.3/UNLICENSE | 24 + .../rust/byteorder-0.5.3/benches/bench.rs | 148 + third_party/rust/byteorder-0.5.3/session.vim | 1 + third_party/rust/byteorder-0.5.3/src/lib.rs | 802 + third_party/rust/byteorder-0.5.3/src/new.rs | 269 + third_party/rust/cgl/.cargo-checksum.json | 1 + third_party/rust/cgl/.cargo-ok | 0 third_party/rust/cgl/.gitignore | 2 + third_party/rust/cgl/.travis.yml | 8 + third_party/rust/cgl/COPYING | 5 + third_party/rust/cgl/Cargo.toml | 11 + third_party/rust/cgl/LICENSE-APACHE | 201 + third_party/rust/cgl/LICENSE-MIT | 25 + third_party/rust/cgl/README.md | 4 + third_party/rust/cgl/src/cgl.rs | 196 + third_party/rust/cgl/src/lib.rs | 18 + .../core-foundation-sys/.cargo-checksum.json | 1 + .../rust/core-foundation-sys/.cargo-ok | 0 .../rust/core-foundation-sys/Cargo.toml | 13 + third_party/rust/core-foundation-sys/build.rs | 12 + .../rust/core-foundation-sys/src/array.rs | 61 + .../rust/core-foundation-sys/src/base.rs | 75 + .../rust/core-foundation-sys/src/bundle.rs | 31 + .../rust/core-foundation-sys/src/data.rs | 22 + .../rust/core-foundation-sys/src/date.rs | 15 + .../core-foundation-sys/src/dictionary.rs | 79 + .../rust/core-foundation-sys/src/error.rs | 32 + .../rust/core-foundation-sys/src/lib.rs | 26 + .../core-foundation-sys/src/messageport.rs | 79 + .../rust/core-foundation-sys/src/number.rs | 59 + .../core-foundation-sys/src/propertylist.rs | 37 + .../rust/core-foundation-sys/src/runloop.rs | 164 + .../rust/core-foundation-sys/src/set.rs | 52 + .../rust/core-foundation-sys/src/string.rs | 320 + .../rust/core-foundation-sys/src/url.rs | 156 + .../rust/core-foundation/.cargo-checksum.json | 1 + third_party/rust/core-foundation/.cargo-ok | 0 third_party/rust/core-foundation/Cargo.toml | 15 + third_party/rust/core-foundation/src/array.rs | 160 + third_party/rust/core-foundation/src/base.rs | 142 + .../rust/core-foundation/src/boolean.rs | 44 + .../rust/core-foundation/src/bundle.rs | 46 + third_party/rust/core-foundation/src/data.rs | 68 + .../rust/core-foundation/src/dictionary.rs | 118 + third_party/rust/core-foundation/src/error.rs | 77 + third_party/rust/core-foundation/src/lib.rs | 98 + .../rust/core-foundation/src/number.rs | 85 + .../rust/core-foundation/src/propertylist.rs | 87 + .../rust/core-foundation/src/runloop.rs | 140 + third_party/rust/core-foundation/src/set.rs | 45 + .../rust/core-foundation/src/string.rs | 152 + third_party/rust/core-foundation/src/url.rs | 63 + .../rust/core-graphics/.cargo-checksum.json | 1 + third_party/rust/core-graphics/.cargo-ok | 0 third_party/rust/core-graphics/.gitignore | 14 + third_party/rust/core-graphics/.travis.yml | 13 + third_party/rust/core-graphics/COPYRIGHT | 5 + third_party/rust/core-graphics/Cargo.toml | 17 + third_party/rust/core-graphics/LICENSE-APACHE | 201 + third_party/rust/core-graphics/LICENSE-MIT | 25 + third_party/rust/core-graphics/README.md | 3 + third_party/rust/core-graphics/src/base.rs | 55 + .../rust/core-graphics/src/color_space.rs | 86 + third_party/rust/core-graphics/src/context.rs | 238 + .../rust/core-graphics/src/data_provider.rs | 107 + third_party/rust/core-graphics/src/display.rs | 77 + third_party/rust/core-graphics/src/event.rs | 285 + .../rust/core-graphics/src/event_source.rs | 97 + third_party/rust/core-graphics/src/font.rs | 147 + .../rust/core-graphics/src/geometry.rs | 84 + third_party/rust/core-graphics/src/lib.rs | 23 + third_party/rust/core-graphics/src/private.rs | 116 + .../rust/core-text/.cargo-checksum.json | 1 + third_party/rust/core-text/.cargo-ok | 0 third_party/rust/core-text/.gitignore | 14 + third_party/rust/core-text/.travis.yml | 8 + third_party/rust/core-text/COPYRIGHT | 5 + third_party/rust/core-text/Cargo.toml | 14 + third_party/rust/core-text/LICENSE-APACHE | 201 + third_party/rust/core-text/LICENSE-MIT | 25 + third_party/rust/core-text/README.md | 3 + third_party/rust/core-text/src/font.rs | 519 + .../rust/core-text/src/font_collection.rs | 160 + .../rust/core-text/src/font_descriptor.rs | 369 + .../rust/core-text/src/font_manager.rs | 40 + third_party/rust/core-text/src/lib.rs | 23 + third_party/rust/dwrote/.cargo-checksum.json | 1 + third_party/rust/dwrote/.cargo-ok | 0 third_party/rust/dwrote/.gitignore | 5 + third_party/rust/dwrote/Cargo.toml | 30 + third_party/rust/dwrote/README.md | 12 + third_party/rust/dwrote/build.rs | 46 + .../rust/dwrote/src/bitmap_render_target.rs | 124 + third_party/rust/dwrote/src/com_helpers.rs | 116 + third_party/rust/dwrote/src/comptr.rs | 115 + third_party/rust/dwrote/src/font.rs | 87 + .../rust/dwrote/src/font_collection.rs | 135 + third_party/rust/dwrote/src/font_face.rs | 137 + third_party/rust/dwrote/src/font_family.rs | 76 + third_party/rust/dwrote/src/font_file.rs | 126 + .../rust/dwrote/src/font_file_loader_impl.rs | 200 + third_party/rust/dwrote/src/gdi_interop.rs | 43 + .../rust/dwrote/src/glyph_run_analysis.rs | 72 + third_party/rust/dwrote/src/helpers.rs | 67 + third_party/rust/dwrote/src/lib.rs | 123 + .../rust/dwrote/src/rendering_params.rs | 35 + third_party/rust/dwrote/src/test.rs | 122 + third_party/rust/dwrote/src/types.rs | 80 + .../rust/error-chain/.cargo-checksum.json | 1 + third_party/rust/error-chain/.cargo-ok | 0 third_party/rust/error-chain/.gitignore | 3 + third_party/rust/error-chain/.travis.yml | 45 + third_party/rust/error-chain/CHANGELOG.md | 82 + third_party/rust/error-chain/Cargo.toml | 22 + third_party/rust/error-chain/README.md | 36 + third_party/rust/error-chain/examples/all.rs | 36 + third_party/rust/error-chain/examples/doc.rs | 29 + .../rust/error-chain/examples/quickstart.rs | 61 + third_party/rust/error-chain/examples/size.rs | 40 + .../rust/error-chain/src/error_chain.rs | 405 + .../rust/error-chain/src/example_generated.rs | 38 + third_party/rust/error-chain/src/lib.rs | 581 + .../rust/error-chain/src/quick_error.rs | 529 + .../rust/error-chain/src/quick_main.rs | 77 + .../rust/error-chain/tests/quick_main.rs | 30 + third_party/rust/error-chain/tests/tests.rs | 543 + third_party/rust/euclid/.cargo-checksum.json | 1 + third_party/rust/euclid/.cargo-ok | 0 third_party/rust/euclid/.gitignore | 2 + third_party/rust/euclid/.travis.yml | 19 + third_party/rust/euclid/COPYRIGHT | 5 + third_party/rust/euclid/Cargo.toml | 21 + third_party/rust/euclid/LICENSE-APACHE | 201 + third_party/rust/euclid/LICENSE-MIT | 25 + third_party/rust/euclid/README.md | 5 + third_party/rust/euclid/src/approxeq.rs | 47 + third_party/rust/euclid/src/length.rs | 301 + third_party/rust/euclid/src/lib.rs | 110 + third_party/rust/euclid/src/macros.rs | 86 + third_party/rust/euclid/src/matrix2d.rs | 404 + third_party/rust/euclid/src/matrix4d.rs | 797 + third_party/rust/euclid/src/num.rs | 66 + third_party/rust/euclid/src/point.rs | 939 + third_party/rust/euclid/src/rect.rs | 671 + third_party/rust/euclid/src/scale_factor.rs | 171 + third_party/rust/euclid/src/side_offsets.rs | 283 + third_party/rust/euclid/src/size.rs | 276 + third_party/rust/euclid/src/trig.rs | 50 + third_party/rust/fnv/.cargo-checksum.json | 1 + third_party/rust/fnv/.cargo-ok | 0 third_party/rust/fnv/.gitignore | 2 + third_party/rust/fnv/.travis.yml | 8 + third_party/rust/fnv/Cargo.toml | 13 + third_party/rust/fnv/README.md | 81 + third_party/rust/fnv/lib.rs | 349 + .../rust/freetype/.cargo-checksum.json | 1 + third_party/rust/freetype/.cargo-ok | 0 third_party/rust/freetype/.gitignore | 7 + third_party/rust/freetype/.travis.yml | 14 + third_party/rust/freetype/COPYRIGHT | 5 + third_party/rust/freetype/Cargo.toml | 19 + third_party/rust/freetype/LICENSE-APACHE | 201 + third_party/rust/freetype/LICENSE-MIT | 25 + third_party/rust/freetype/Makefile.in | 37 + third_party/rust/freetype/README.md | 3 + third_party/rust/freetype/configure | 5 + third_party/rust/freetype/etc/bindgen.sh | 24 + third_party/rust/freetype/etc/bindings.h | 5 + third_party/rust/freetype/src/freetype.rs | 1562 + third_party/rust/freetype/src/lib.rs | 37 + third_party/rust/freetype/src/tt_os2.rs | 50 + .../rust/gdi32-sys/.cargo-checksum.json | 1 + third_party/rust/gdi32-sys/.cargo-ok | 0 third_party/rust/gdi32-sys/Cargo.toml | 17 + third_party/rust/gdi32-sys/README.md | 13 + third_party/rust/gdi32-sys/build.rs | 6 + third_party/rust/gdi32-sys/src/lib.rs | 703 + .../rust/gl_generator/.cargo-checksum.json | 1 + third_party/rust/gl_generator/.cargo-ok | 0 third_party/rust/gl_generator/Cargo.toml | 26 + third_party/rust/gl_generator/README.md | 165 + .../generators/debug_struct_gen.rs | 239 + .../gl_generator/generators/global_gen.rs | 241 + .../rust/gl_generator/generators/mod.rs | 103 + .../gl_generator/generators/static_gen.rs | 87 + .../generators/static_struct_gen.rs | 132 + .../gl_generator/generators/struct_gen.rs | 215 + .../generators/templates/types/egl.rs | 52 + .../generators/templates/types/gl.rs | 83 + .../generators/templates/types/glx.rs | 127 + .../generators/templates/types/wgl.rs | 138 + third_party/rust/gl_generator/lib.rs | 81 + third_party/rust/gl_generator/registry/mod.rs | 158 + .../rust/gl_generator/registry/parse.rs | 1154 + third_party/rust/gleam/.cargo-checksum.json | 1 + third_party/rust/gleam/.cargo-ok | 0 third_party/rust/gleam/.gitignore | 2 + third_party/rust/gleam/.travis.yml | 3 + third_party/rust/gleam/COPYING | 5 + third_party/rust/gleam/Cargo.toml | 13 + third_party/rust/gleam/LICENSE-APACHE | 201 + third_party/rust/gleam/LICENSE-MIT | 25 + third_party/rust/gleam/README.md | 6 + third_party/rust/gleam/build.rs | 40 + third_party/rust/gleam/src/gl.rs | 1521 + third_party/rust/gleam/src/lib.rs | 17 + .../rust/heapsize/.cargo-checksum.json | 1 + third_party/rust/heapsize/.cargo-ok | 0 third_party/rust/heapsize/.gitignore | 3 + third_party/rust/heapsize/.travis.yml | 19 + third_party/rust/heapsize/Cargo.toml | 14 + third_party/rust/heapsize/README.md | 5 + third_party/rust/heapsize/appveyor.yml | 23 + third_party/rust/heapsize/build.rs | 37 + third_party/rust/heapsize/src/lib.rs | 323 + third_party/rust/heapsize/tests/tests.rs | 171 + .../rust/kernel32-sys/.cargo-checksum.json | 1 + third_party/rust/kernel32-sys/.cargo-ok | 0 third_party/rust/kernel32-sys/Cargo.toml | 17 + third_party/rust/kernel32-sys/README.md | 13 + third_party/rust/kernel32-sys/build.rs | 6 + third_party/rust/kernel32-sys/src/lib.rs | 2754 + .../rust/khronos_api/.cargo-checksum.json | 1 + third_party/rust/khronos_api/.cargo-ok | 0 third_party/rust/khronos_api/Cargo.toml | 18 + third_party/rust/khronos_api/README.md | 14 + .../rust/khronos_api/api/GL/glcorearb.h | 3617 ++ third_party/rust/khronos_api/api/GL/glext.h | 12046 ++++ third_party/rust/khronos_api/api/GL/glxext.h | 926 + third_party/rust/khronos_api/api/GL/wglext.h | 840 + third_party/rust/khronos_api/api/Makefile | 72 + third_party/rust/khronos_api/api/README.txt | 2 + third_party/rust/khronos_api/api/egl.xml | 2357 + .../rust/khronos_api/api/genheaders.py | 578 + third_party/rust/khronos_api/api/gl.xml | 46153 ++++++++++++++++ third_party/rust/khronos_api/api/glx.xml | 2161 + third_party/rust/khronos_api/api/readme.pdf | Bin 0 -> 130102 bytes third_party/rust/khronos_api/api/readme.tex | 1002 + third_party/rust/khronos_api/api/reg.py | 1162 + third_party/rust/khronos_api/api/registry.rnc | 288 + third_party/rust/khronos_api/api/wgl.xml | 1967 + third_party/rust/khronos_api/src/lib.rs | 27 + .../rust/lazy_static/.cargo-checksum.json | 1 + third_party/rust/lazy_static/.cargo-ok | 0 third_party/rust/lazy_static/.gitignore | 4 + third_party/rust/lazy_static/.travis.yml | 24 + third_party/rust/lazy_static/Cargo.toml | 20 + third_party/rust/lazy_static/LICENSE | 21 + third_party/rust/lazy_static/README.md | 81 + third_party/rust/lazy_static/src/core_lazy.rs | 27 + third_party/rust/lazy_static/src/lazy.rs | 32 + third_party/rust/lazy_static/src/lib.rs | 137 + .../rust/lazy_static/src/nightly_lazy.rs | 40 + third_party/rust/lazy_static/tests/no_std.rs | 21 + third_party/rust/lazy_static/tests/test.rs | 129 + third_party/rust/log/.cargo-checksum.json | 1 + third_party/rust/log/.cargo-ok | 0 third_party/rust/log/.gitignore | 2 + third_party/rust/log/.travis.yml | 31 + third_party/rust/log/Cargo.toml | 36 + third_party/rust/log/LICENSE-APACHE | 201 + third_party/rust/log/LICENSE-MIT | 25 + third_party/rust/log/README.md | 160 + third_party/rust/log/appveyor.yml | 18 + third_party/rust/log/src/lib.rs | 1013 + third_party/rust/log/src/macros.rs | 155 + third_party/rust/log/tests/filters.rs | 76 + third_party/rust/matches/.cargo-checksum.json | 2 +- third_party/rust/matches/Cargo.toml | 2 +- third_party/rust/matches/LICENSE | 25 + .../rust/metadeps/.cargo-checksum.json | 1 + third_party/rust/metadeps/.cargo-ok | 0 third_party/rust/metadeps/.gitignore | 2 + third_party/rust/metadeps/Cargo.toml | 17 + third_party/rust/metadeps/README.md | 30 + third_party/rust/metadeps/src/lib.rs | 84 + third_party/rust/metadeps/tests/test.rs | 76 + third_party/rust/metadeps/tests/testdata.pc | 8 + third_party/rust/metadeps/tests/testlib.pc | 10 + .../toml-missing-file/no-cargo-toml-here | 1 + .../rust/num-traits/.cargo-checksum.json | 1 + third_party/rust/num-traits/.cargo-ok | 0 third_party/rust/num-traits/Cargo.toml | 12 + third_party/rust/num-traits/src/bounds.rs | 71 + third_party/rust/num-traits/src/cast.rs | 450 + third_party/rust/num-traits/src/float.rs | 1346 + third_party/rust/num-traits/src/identities.rs | 104 + third_party/rust/num-traits/src/int.rs | 376 + third_party/rust/num-traits/src/lib.rs | 236 + .../rust/num-traits/src/ops/checked.rs | 91 + third_party/rust/num-traits/src/ops/mod.rs | 2 + .../rust/num-traits/src/ops/saturating.rs | 28 + third_party/rust/num-traits/src/pow.rs | 73 + third_party/rust/num-traits/src/sign.rs | 161 + .../offscreen_gl_context/.cargo-checksum.json | 1 + .../rust/offscreen_gl_context/.cargo-ok | 0 .../rust/offscreen_gl_context/.gitignore | 3 + .../rust/offscreen_gl_context/.travis.yml | 28 + .../rust/offscreen_gl_context/Cargo.toml | 43 + .../rust/offscreen_gl_context/Makefile | 8 + .../rust/offscreen_gl_context/README.md | 3 + .../rust/offscreen_gl_context/build.rs | 51 + .../offscreen_gl_context/src/draw_buffer.rs | 275 + .../offscreen_gl_context/src/gl_context.rs | 195 + .../src/gl_context_attributes.rs | 73 + .../src/gl_context_capabilities.rs | 32 + .../offscreen_gl_context/src/gl_feature.rs | 36 + .../offscreen_gl_context/src/gl_formats.rs | 68 + .../offscreen_gl_context/src/gl_limits.rs | 44 + .../rust/offscreen_gl_context/src/lib.rs | 80 + .../offscreen_gl_context/src/platform/mod.rs | 57 + .../src/platform/not_implemented/mod.rs | 2 + .../not_implemented/native_gl_context.rs | 40 + .../src/platform/with_cgl/mod.rs | 3 + .../platform/with_cgl/native_gl_context.rs | 168 + .../src/platform/with_egl/mod.rs | 9 + .../platform/with_egl/native_gl_context.rs | 156 + .../src/platform/with_egl/utils.rs | 85 + .../src/platform/with_glx/mod.rs | 3 + .../platform/with_glx/native_gl_context.rs | 145 + .../src/platform/with_glx/utils.rs | 153 + .../src/platform/with_osmesa/mod.rs | 125 + .../src/platform/with_wgl/mod.rs | 15 + .../platform/with_wgl/native_gl_context.rs | 228 + .../src/platform/with_wgl/utils.rs | 712 + .../src/platform/with_wgl/wgl_attributes.rs | 82 + .../rust/offscreen_gl_context/src/tests.rs | 382 + .../rust/osmesa-sys/.cargo-checksum.json | 1 + third_party/rust/osmesa-sys/.cargo-ok | 0 third_party/rust/osmesa-sys/.gitignore | 2 + third_party/rust/osmesa-sys/Cargo.toml | 14 + third_party/rust/osmesa-sys/README.txt | 3 + third_party/rust/osmesa-sys/lib.rs | 92 + third_party/rust/quote/.cargo-checksum.json | 1 + third_party/rust/quote/.cargo-ok | 0 third_party/rust/quote/Cargo.toml | 10 + third_party/rust/quote/src/ident.rs | 57 + third_party/rust/quote/src/lib.rs | 252 + third_party/rust/quote/src/to_tokens.rs | 357 + third_party/rust/quote/src/tokens.rs | 150 + .../rust/redox_syscall/.cargo-checksum.json | 1 + third_party/rust/redox_syscall/.cargo-ok | 0 third_party/rust/redox_syscall/.gitignore | 2 + third_party/rust/redox_syscall/Cargo.toml | 9 + .../rust/redox_syscall/src/arch/arm.rs | 72 + .../rust/redox_syscall/src/arch/x86.rs | 72 + .../rust/redox_syscall/src/arch/x86_64.rs | 72 + third_party/rust/redox_syscall/src/call.rs | 292 + third_party/rust/redox_syscall/src/data.rs | 146 + third_party/rust/redox_syscall/src/error.rs | 315 + third_party/rust/redox_syscall/src/flag.rs | 84 + third_party/rust/redox_syscall/src/io/dma.rs | 76 + third_party/rust/redox_syscall/src/io/io.rs | 67 + third_party/rust/redox_syscall/src/io/mmio.rs | 31 + third_party/rust/redox_syscall/src/io/mod.rs | 11 + third_party/rust/redox_syscall/src/io/pio.rs | 89 + third_party/rust/redox_syscall/src/lib.rs | 47 + third_party/rust/redox_syscall/src/number.rs | 64 + third_party/rust/redox_syscall/src/scheme.rs | 232 + .../rust/rustc-serialize/.cargo-checksum.json | 1 + third_party/rust/rustc-serialize/.cargo-ok | 0 third_party/rust/rustc-serialize/.gitignore | 2 + third_party/rust/rustc-serialize/.travis.yml | 24 + third_party/rust/rustc-serialize/Cargo.toml | 18 + .../rust/rustc-serialize/LICENSE-APACHE | 201 + third_party/rust/rustc-serialize/LICENSE-MIT | 25 + third_party/rust/rustc-serialize/README.md | 24 + third_party/rust/rustc-serialize/appveyor.yml | 17 + .../rust/rustc-serialize/benches/base64.rs | 48 + .../rust/rustc-serialize/benches/hex.rs | 28 + .../rust/rustc-serialize/benches/json.rs | 84 + .../rust/rustc-serialize/src/base64.rs | 488 + .../rustc-serialize/src/collection_impls.rs | 186 + third_party/rust/rustc-serialize/src/hex.rs | 221 + third_party/rust/rustc-serialize/src/json.rs | 3992 ++ third_party/rust/rustc-serialize/src/lib.rs | 69 + .../rust/rustc-serialize/src/serialize.rs | 1671 + third_party/rust/serde/.cargo-checksum.json | 1 + third_party/rust/serde/.cargo-ok | 0 third_party/rust/serde/Cargo.toml | 25 + third_party/rust/serde/src/bytes.rs | 252 + .../rust/serde/src/de/from_primitive.rs | 409 + third_party/rust/serde/src/de/impls.rs | 1306 + third_party/rust/serde/src/de/mod.rs | 830 + third_party/rust/serde/src/de/value.rs | 1067 + third_party/rust/serde/src/error.rs | 44 + third_party/rust/serde/src/iter.rs | 61 + third_party/rust/serde/src/lib.rs | 58 + third_party/rust/serde/src/macros.rs | 179 + third_party/rust/serde/src/ser/impls.rs | 725 + third_party/rust/serde/src/ser/mod.rs | 412 + third_party/rust/serde/src/utils.rs | 72 + .../rust/serde_codegen/.cargo-checksum.json | 1 + third_party/rust/serde_codegen/.cargo-ok | 0 third_party/rust/serde_codegen/Cargo.toml | 29 + third_party/rust/serde_codegen/src/bound.rs | 121 + third_party/rust/serde_codegen/src/de.rs | 1040 + third_party/rust/serde_codegen/src/lib.rs | 172 + third_party/rust/serde_codegen/src/ser.rs | 570 + .../.cargo-checksum.json | 1 + .../rust/serde_codegen_internals/.cargo-ok | 0 .../rust/serde_codegen_internals/Cargo.toml | 18 + .../rust/serde_codegen_internals/src/ast.rs | 116 + .../rust/serde_codegen_internals/src/attr.rs | 543 + .../rust/serde_codegen_internals/src/ctxt.rs | 43 + .../rust/serde_codegen_internals/src/lib.rs | 10 + .../rust/shared_library/.cargo-checksum.json | 1 + third_party/rust/shared_library/.cargo-ok | 0 third_party/rust/shared_library/.gitignore | 2 + third_party/rust/shared_library/.travis.yml | 15 + third_party/rust/shared_library/Cargo.toml | 11 + .../shared_library/src/dynamic_library.rs | 359 + third_party/rust/shared_library/src/lib.rs | 175 + third_party/rust/syn/.cargo-checksum.json | 1 + third_party/rust/syn/.cargo-ok | 0 third_party/rust/syn/Cargo.toml | 33 + third_party/rust/syn/src/aster/generics.rs | 233 + third_party/rust/syn/src/aster/ident.rs | 39 + third_party/rust/syn/src/aster/invoke.rs | 16 + third_party/rust/syn/src/aster/lifetime.rs | 103 + third_party/rust/syn/src/aster/mod.rs | 33 + third_party/rust/syn/src/aster/path.rs | 331 + third_party/rust/syn/src/aster/qpath.rs | 146 + third_party/rust/syn/src/aster/ty.rs | 578 + third_party/rust/syn/src/aster/ty_param.rs | 262 + .../rust/syn/src/aster/where_predicate.rs | 259 + third_party/rust/syn/src/attr.rs | 293 + third_party/rust/syn/src/constant.rs | 167 + third_party/rust/syn/src/data.rs | 245 + third_party/rust/syn/src/escape.rs | 292 + third_party/rust/syn/src/expr.rs | 1665 + third_party/rust/syn/src/generics.rs | 446 + third_party/rust/syn/src/helper.rs | 137 + third_party/rust/syn/src/ident.rs | 129 + third_party/rust/syn/src/item.rs | 1477 + third_party/rust/syn/src/krate.rs | 57 + third_party/rust/syn/src/lib.rs | 170 + third_party/rust/syn/src/lit.rs | 455 + third_party/rust/syn/src/mac.rs | 430 + third_party/rust/syn/src/macro_input.rs | 110 + third_party/rust/syn/src/nom.rs | 495 + third_party/rust/syn/src/op.rs | 192 + third_party/rust/syn/src/registry.rs | 392 + third_party/rust/syn/src/space.rs | 99 + third_party/rust/syn/src/ty.rs | 865 + third_party/rust/syn/src/visit.rs | 296 + third_party/rust/syntex/.cargo-checksum.json | 1 + third_party/rust/syntex/.cargo-ok | 0 third_party/rust/syntex/Cargo.toml | 13 + third_party/rust/syntex/src/error.rs | 46 + third_party/rust/syntex/src/lib.rs | 11 + third_party/rust/syntex/src/registry.rs | 234 + third_party/rust/syntex/src/resolver.rs | 92 + third_party/rust/syntex/src/stack.rs | 63 + .../rust/syntex_errors/.cargo-checksum.json | 1 + third_party/rust/syntex_errors/.cargo-ok | 0 third_party/rust/syntex_errors/Cargo.toml | 16 + .../rust/syntex_errors/src/diagnostic.rs | 202 + .../syntex_errors/src/diagnostic_builder.rs | 196 + third_party/rust/syntex_errors/src/emitter.rs | 1219 + third_party/rust/syntex_errors/src/lib.rs | 533 + third_party/rust/syntex_errors/src/lock.rs | 115 + .../rust/syntex_errors/src/registry.rs | 26 + third_party/rust/syntex_errors/src/snippet.rs | 188 + .../rust/syntex_errors/src/styled_buffer.rs | 145 + .../rust/syntex_pos/.cargo-checksum.json | 1 + third_party/rust/syntex_pos/.cargo-ok | 0 third_party/rust/syntex_pos/Cargo.toml | 11 + third_party/rust/syntex_pos/src/lib.rs | 725 + .../rust/syntex_syntax/.cargo-checksum.json | 1 + third_party/rust/syntex_syntax/.cargo-ok | 0 third_party/rust/syntex_syntax/Cargo.toml | 18 + third_party/rust/syntex_syntax/src/abi.rs | 178 + third_party/rust/syntex_syntax/src/ast.rs | 1924 + third_party/rust/syntex_syntax/src/attr.rs | 1037 + third_party/rust/syntex_syntax/src/codemap.rs | 1278 + third_party/rust/syntex_syntax/src/config.rs | 312 + .../rust/syntex_syntax/src/diagnostic_list.rs | 205 + .../syntex_syntax/src/diagnostics/macros.rs | 138 + .../syntex_syntax/src/diagnostics/metadata.rs | 101 + .../syntex_syntax/src/diagnostics/plugin.rs | 241 + third_party/rust/syntex_syntax/src/entry.rs | 44 + .../rust/syntex_syntax/src/ext/base.rs | 849 + .../rust/syntex_syntax/src/ext/build.rs | 1208 + .../rust/syntex_syntax/src/ext/decorator.rs | 316 + third_party/rust/syntex_syntax/src/ext/env.rs | 99 + .../rust/syntex_syntax/src/ext/expand.rs | 1008 + .../rust/syntex_syntax/src/ext/hygiene.rs | 134 + .../syntex_syntax/src/ext/placeholders.rs | 236 + .../syntex_syntax/src/ext/proc_macro_shim.rs | 72 + .../rust/syntex_syntax/src/ext/quote.rs | 950 + .../rust/syntex_syntax/src/ext/source_util.rs | 196 + .../syntex_syntax/src/ext/tt/macro_parser.rs | 547 + .../syntex_syntax/src/ext/tt/macro_rules.rs | 810 + .../syntex_syntax/src/ext/tt/transcribe.rs | 300 + .../rust/syntex_syntax/src/feature_gate.rs | 1489 + third_party/rust/syntex_syntax/src/fold.rs | 1399 + third_party/rust/syntex_syntax/src/json.rs | 356 + third_party/rust/syntex_syntax/src/lib.rs | 135 + .../rust/syntex_syntax/src/parse/attr.rs | 266 + .../rust/syntex_syntax/src/parse/classify.rs | 56 + .../rust/syntex_syntax/src/parse/common.rs | 36 + .../syntex_syntax/src/parse/lexer/comments.rs | 456 + .../rust/syntex_syntax/src/parse/lexer/mod.rs | 1929 + .../src/parse/lexer/unicode_chars.rs | 253 + .../rust/syntex_syntax/src/parse/mod.rs | 1006 + .../rust/syntex_syntax/src/parse/obsolete.rs | 66 + .../rust/syntex_syntax/src/parse/parser.rs | 6172 +++ .../rust/syntex_syntax/src/parse/token.rs | 334 + .../rust/syntex_syntax/src/print/pp.rs | 640 + .../rust/syntex_syntax/src/print/pprust.rs | 3126 ++ third_party/rust/syntex_syntax/src/ptr.rs | 217 + .../rust/syntex_syntax/src/show_span.rs | 86 + .../rust/syntex_syntax/src/std_inject.rs | 94 + third_party/rust/syntex_syntax/src/str.rs | 24 + third_party/rust/syntex_syntax/src/symbol.rs | 312 + third_party/rust/syntex_syntax/src/test.rs | 718 + .../rust/syntex_syntax/src/test_snippet.rs | 546 + .../rust/syntex_syntax/src/tokenstream.rs | 1128 + .../syntex_syntax/src/util/lev_distance.rs | 84 + .../rust/syntex_syntax/src/util/move_map.rs | 77 + .../rust/syntex_syntax/src/util/node_count.rs | 156 + .../rust/syntex_syntax/src/util/parser.rs | 217 + .../syntex_syntax/src/util/parser_testing.rs | 172 + .../syntex_syntax/src/util/small_vector.rs | 329 + .../rust/syntex_syntax/src/util/thin_vec.rs | 59 + third_party/rust/syntex_syntax/src/visit.rs | 812 + third_party/rust/term/.cargo-checksum.json | 1 + third_party/rust/term/.cargo-ok | 0 third_party/rust/term/.gitignore | 2 + third_party/rust/term/.travis.yml | 11 + third_party/rust/term/Cargo.toml | 17 + third_party/rust/term/LICENSE-APACHE | 201 + third_party/rust/term/LICENSE-MIT | 25 + third_party/rust/term/README.md | 36 + third_party/rust/term/appveyor.yml | 17 + third_party/rust/term/rustfmt.toml | 3 + third_party/rust/term/scripts/id_rsa.enc | Bin 0 -> 1680 bytes .../rust/term/scripts/travis-doc-upload.cfg | 3 + third_party/rust/term/src/lib.rs | 402 + third_party/rust/term/src/terminfo/mod.rs | 339 + third_party/rust/term/src/terminfo/parm.rs | 717 + .../rust/term/src/terminfo/parser/compiled.rs | 218 + .../rust/term/src/terminfo/parser/names.rs | 154 + .../rust/term/src/terminfo/searcher.rs | 80 + third_party/rust/term/src/win.rs | 301 + third_party/rust/term/tests/data/dumb | Bin 0 -> 308 bytes third_party/rust/term/tests/data/linux | Bin 0 -> 1780 bytes .../rust/term/tests/data/linux-16color | Bin 0 -> 1858 bytes third_party/rust/term/tests/data/linux-basic | Bin 0 -> 1664 bytes third_party/rust/term/tests/data/linux-c | Bin 0 -> 2120 bytes third_party/rust/term/tests/data/linux-c-nc | Bin 0 -> 1766 bytes third_party/rust/term/tests/data/linux-koi8 | Bin 0 -> 1808 bytes third_party/rust/term/tests/data/linux-koi8r | Bin 0 -> 1814 bytes third_party/rust/term/tests/data/linux-lat | Bin 0 -> 1822 bytes third_party/rust/term/tests/data/linux-m | Bin 0 -> 1770 bytes third_party/rust/term/tests/data/linux-nic | Bin 0 -> 1810 bytes third_party/rust/term/tests/data/linux-vt | Bin 0 -> 1702 bytes third_party/rust/term/tests/data/linux2.2 | Bin 0 -> 1788 bytes third_party/rust/term/tests/data/linux2.6 | Bin 0 -> 1785 bytes third_party/rust/term/tests/data/linux2.6.26 | Bin 0 -> 1789 bytes third_party/rust/term/tests/data/linux3.0 | Bin 0 -> 1788 bytes third_party/rust/term/tests/data/rxvt | Bin 0 -> 2285 bytes third_party/rust/term/tests/data/rxvt-16color | Bin 0 -> 2497 bytes .../rust/term/tests/data/rxvt-256color | Bin 0 -> 2427 bytes third_party/rust/term/tests/data/rxvt-88color | Bin 0 -> 2425 bytes third_party/rust/term/tests/data/rxvt-basic | Bin 0 -> 2145 bytes third_party/rust/term/tests/data/rxvt-color | Bin 0 -> 2229 bytes third_party/rust/term/tests/data/rxvt-cygwin | Bin 0 -> 2251 bytes .../rust/term/tests/data/rxvt-cygwin-native | Bin 0 -> 2269 bytes third_party/rust/term/tests/data/rxvt-xpm | Bin 0 -> 2227 bytes third_party/rust/term/tests/data/screen | Bin 0 -> 1587 bytes .../rust/term/tests/data/screen-256color | Bin 0 -> 1912 bytes third_party/rust/term/tests/data/xterm | Bin 0 -> 3412 bytes .../rust/term/tests/data/xterm-256color | Bin 0 -> 3462 bytes third_party/rust/term/tests/terminfo.rs | 25 + .../rust/threadpool/.cargo-checksum.json | 1 + third_party/rust/threadpool/.cargo-ok | 0 third_party/rust/threadpool/.gitignore | 2 + third_party/rust/threadpool/.travis.yml | 21 + third_party/rust/threadpool/CHANGES.md | 36 + third_party/rust/threadpool/Cargo.toml | 16 + third_party/rust/threadpool/LICENSE-APACHE | 201 + third_party/rust/threadpool/LICENSE-MIT | 25 + third_party/rust/threadpool/README.md | 48 + third_party/rust/threadpool/lib.rs | 646 + third_party/rust/time/.cargo-checksum.json | 1 + third_party/rust/time/.cargo-ok | 0 third_party/rust/time/.gitignore | 2 + third_party/rust/time/.travis.yml | 27 + third_party/rust/time/Cargo.toml | 27 + third_party/rust/time/LICENSE-APACHE | 201 + third_party/rust/time/LICENSE-MIT | 25 + third_party/rust/time/README.md | 30 + third_party/rust/time/appveyor.yml | 17 + .../rust/time/benches/precise_time_ns.rs | 11 + third_party/rust/time/src/display.rs | 260 + third_party/rust/time/src/duration.rs | 648 + third_party/rust/time/src/lib.rs | 1277 + third_party/rust/time/src/parse.rs | 394 + third_party/rust/time/src/sys.rs | 841 + third_party/rust/toml/.cargo-checksum.json | 1 + third_party/rust/toml/.cargo-ok | 0 third_party/rust/toml/.gitignore | 2 + third_party/rust/toml/.travis.yml | 31 + third_party/rust/toml/Cargo.toml | 26 + third_party/rust/toml/LICENSE-APACHE | 201 + third_party/rust/toml/LICENSE-MIT | 25 + third_party/rust/toml/README.md | 26 + third_party/rust/toml/examples/toml2json.rs | 57 + third_party/rust/toml/src/decoder/mod.rs | 240 + .../rust/toml/src/decoder/rustc_serialize.rs | 371 + third_party/rust/toml/src/decoder/serde.rs | 773 + third_party/rust/toml/src/display.rs | 209 + third_party/rust/toml/src/encoder/mod.rs | 203 + .../rust/toml/src/encoder/rustc_serialize.rs | 748 + third_party/rust/toml/src/encoder/serde.rs | 339 + third_party/rust/toml/src/lib.rs | 492 + third_party/rust/toml/src/parser.rs | 1627 + third_party/rust/toml/tests/README.md | 1 + third_party/rust/toml/tests/formatting.rs | 52 + .../array-mixed-types-ints-and-floats.json | 15 + third_party/rust/toml/tests/invalid.rs | 108 + .../array-mixed-types-arrays-and-ints.toml | 1 + .../array-mixed-types-ints-and-floats.toml | 1 + .../array-mixed-types-strings-and-ints.toml | 1 + .../invalid/datetime-malformed-no-leads.toml | 1 + .../invalid/datetime-malformed-no-secs.toml | 1 + .../invalid/datetime-malformed-no-t.toml | 1 + .../invalid/datetime-malformed-no-z.toml | 1 + .../datetime-malformed-with-milli.toml | 1 + .../tests/invalid/duplicate-key-table.toml | 5 + .../toml/tests/invalid/duplicate-keys.toml | 2 + .../toml/tests/invalid/duplicate-tables.toml | 2 + .../tests/invalid/empty-implicit-table.toml | 1 + .../rust/toml/tests/invalid/empty-table.toml | 1 + .../tests/invalid/float-no-leading-zero.toml | 2 + .../invalid/float-no-trailing-digits.toml | 2 + .../toml/tests/invalid/key-after-array.toml | 1 + .../toml/tests/invalid/key-after-table.toml | 1 + .../rust/toml/tests/invalid/key-empty.toml | 1 + .../rust/toml/tests/invalid/key-hash.toml | 1 + .../rust/toml/tests/invalid/key-newline.toml | 2 + .../toml/tests/invalid/key-open-bracket.toml | 1 + .../invalid/key-single-open-bracket.toml | 1 + .../rust/toml/tests/invalid/key-space.toml | 1 + .../toml/tests/invalid/key-start-bracket.toml | 3 + .../toml/tests/invalid/key-two-equals.toml | 1 + .../tests/invalid/string-bad-byte-escape.toml | 1 + .../toml/tests/invalid/string-bad-escape.toml | 1 + .../tests/invalid/string-byte-escapes.toml | 1 + .../toml/tests/invalid/string-no-close.toml | 1 + .../tests/invalid/table-array-implicit.toml | 14 + .../table-array-malformed-bracket.toml | 2 + .../invalid/table-array-malformed-empty.toml | 2 + .../rust/toml/tests/invalid/table-empty.toml | 1 + .../invalid/table-nested-brackets-close.toml | 2 + .../invalid/table-nested-brackets-open.toml | 2 + .../toml/tests/invalid/table-whitespace.toml | 1 + .../toml/tests/invalid/table-with-pound.toml | 2 + .../invalid/text-after-array-entries.toml | 4 + .../tests/invalid/text-after-integer.toml | 1 + .../toml/tests/invalid/text-after-string.toml | 1 + .../toml/tests/invalid/text-after-table.toml | 1 + .../invalid/text-before-array-separator.toml | 4 + .../toml/tests/invalid/text-in-array.toml | 5 + third_party/rust/toml/tests/valid.rs | 195 + .../rust/toml/tests/valid/array-empty.json | 11 + .../rust/toml/tests/valid/array-empty.toml | 1 + .../rust/toml/tests/valid/array-nospaces.json | 10 + .../rust/toml/tests/valid/array-nospaces.toml | 1 + .../toml/tests/valid/arrays-hetergeneous.json | 19 + .../toml/tests/valid/arrays-hetergeneous.toml | 1 + .../rust/toml/tests/valid/arrays-nested.json | 13 + .../rust/toml/tests/valid/arrays-nested.toml | 1 + third_party/rust/toml/tests/valid/arrays.json | 34 + third_party/rust/toml/tests/valid/arrays.toml | 8 + third_party/rust/toml/tests/valid/bool.json | 4 + third_party/rust/toml/tests/valid/bool.toml | 2 + .../toml/tests/valid/comments-everywhere.json | 12 + .../toml/tests/valid/comments-everywhere.toml | 24 + .../rust/toml/tests/valid/datetime.json | 3 + .../rust/toml/tests/valid/datetime.toml | 1 + third_party/rust/toml/tests/valid/empty.json | 1 + third_party/rust/toml/tests/valid/empty.toml | 0 .../rust/toml/tests/valid/example-bom.toml | 5 + .../rust/toml/tests/valid/example-v0.3.0.json | 1 + .../rust/toml/tests/valid/example-v0.3.0.toml | 182 + .../rust/toml/tests/valid/example-v0.4.0.json | 1 + .../rust/toml/tests/valid/example-v0.4.0.toml | 235 + .../rust/toml/tests/valid/example.json | 14 + .../rust/toml/tests/valid/example.toml | 5 + .../rust/toml/tests/valid/example2.json | 1 + .../rust/toml/tests/valid/example2.toml | 47 + third_party/rust/toml/tests/valid/float.json | 4 + third_party/rust/toml/tests/valid/float.toml | 2 + .../rust/toml/tests/valid/hard_example.json | 1 + .../rust/toml/tests/valid/hard_example.toml | 33 + .../valid/implicit-and-explicit-after.json | 10 + .../valid/implicit-and-explicit-after.toml | 5 + .../valid/implicit-and-explicit-before.json | 10 + .../valid/implicit-and-explicit-before.toml | 5 + .../toml/tests/valid/implicit-groups.json | 9 + .../toml/tests/valid/implicit-groups.toml | 2 + .../rust/toml/tests/valid/integer.json | 4 + .../rust/toml/tests/valid/integer.toml | 2 + .../toml/tests/valid/key-equals-nospace.json | 3 + .../toml/tests/valid/key-equals-nospace.toml | 1 + .../rust/toml/tests/valid/key-space.json | 3 + .../rust/toml/tests/valid/key-space.toml | 1 + .../toml/tests/valid/key-special-chars.json | 5 + .../toml/tests/valid/key-special-chars.toml | 1 + .../rust/toml/tests/valid/key-with-pound.json | 3 + .../rust/toml/tests/valid/key-with-pound.toml | 1 + .../rust/toml/tests/valid/long-float.json | 4 + .../rust/toml/tests/valid/long-float.toml | 2 + .../rust/toml/tests/valid/long-integer.json | 4 + .../rust/toml/tests/valid/long-integer.toml | 2 + .../toml/tests/valid/multiline-string.json | 30 + .../toml/tests/valid/multiline-string.toml | 23 + .../tests/valid/raw-multiline-string.json | 14 + .../tests/valid/raw-multiline-string.toml | 9 + .../rust/toml/tests/valid/raw-string.json | 30 + .../rust/toml/tests/valid/raw-string.toml | 7 + .../rust/toml/tests/valid/string-empty.json | 6 + .../rust/toml/tests/valid/string-empty.toml | 1 + .../rust/toml/tests/valid/string-escapes.json | 50 + .../rust/toml/tests/valid/string-escapes.toml | 12 + .../rust/toml/tests/valid/string-simple.json | 6 + .../rust/toml/tests/valid/string-simple.toml | 1 + .../toml/tests/valid/string-with-pound.json | 7 + .../toml/tests/valid/string-with-pound.toml | 2 + .../tests/valid/table-array-implicit.json | 7 + .../tests/valid/table-array-implicit.toml | 2 + .../toml/tests/valid/table-array-many.json | 16 + .../toml/tests/valid/table-array-many.toml | 11 + .../toml/tests/valid/table-array-nest.json | 18 + .../toml/tests/valid/table-array-nest.toml | 17 + .../toml/tests/valid/table-array-one.json | 8 + .../toml/tests/valid/table-array-one.toml | 3 + .../rust/toml/tests/valid/table-empty.json | 3 + .../rust/toml/tests/valid/table-empty.toml | 1 + .../toml/tests/valid/table-sub-empty.json | 3 + .../toml/tests/valid/table-sub-empty.toml | 2 + .../toml/tests/valid/table-whitespace.json | 3 + .../toml/tests/valid/table-whitespace.toml | 1 + .../toml/tests/valid/table-with-pound.json | 5 + .../toml/tests/valid/table-with-pound.toml | 2 + .../rust/toml/tests/valid/unicode-escape.json | 4 + .../rust/toml/tests/valid/unicode-escape.toml | 2 + .../toml/tests/valid/unicode-literal.json | 3 + .../toml/tests/valid/unicode-literal.toml | 1 + .../rust/unicode-xid/.cargo-checksum.json | 1 + third_party/rust/unicode-xid/.cargo-ok | 0 third_party/rust/unicode-xid/.gitignore | 3 + third_party/rust/unicode-xid/.travis.yml | 25 + third_party/rust/unicode-xid/COPYRIGHT | 7 + third_party/rust/unicode-xid/Cargo.toml | 26 + third_party/rust/unicode-xid/LICENSE-APACHE | 201 + third_party/rust/unicode-xid/LICENSE-MIT | 25 + third_party/rust/unicode-xid/README.md | 34 + .../rust/unicode-xid/scripts/unicode.py | 187 + third_party/rust/unicode-xid/src/lib.rs | 87 + third_party/rust/unicode-xid/src/tables.rs | 426 + third_party/rust/unicode-xid/src/tests.rs | 113 + .../rust/user32-sys/.cargo-checksum.json | 1 + third_party/rust/user32-sys/.cargo-ok | 0 third_party/rust/user32-sys/Cargo.toml | 17 + third_party/rust/user32-sys/README.md | 13 + third_party/rust/user32-sys/build.rs | 6 + third_party/rust/user32-sys/src/lib.rs | 1104 + .../rust/winapi-build/.cargo-checksum.json | 1 + third_party/rust/winapi-build/.cargo-ok | 0 third_party/rust/winapi-build/Cargo.toml | 11 + third_party/rust/winapi-build/src/lib.rs | 14 + third_party/rust/winapi/.cargo-checksum.json | 1 + third_party/rust/winapi/.cargo-ok | 0 third_party/rust/winapi/Cargo.toml | 61 + third_party/rust/winapi/LICENSE.md | 21 + third_party/rust/winapi/src/activation.rs | 5 + third_party/rust/winapi/src/audioclient.rs | 71 + .../rust/winapi/src/audiosessiontypes.rs | 11 + third_party/rust/winapi/src/basetsd.rs | 99 + third_party/rust/winapi/src/bcrypt.rs | 356 + third_party/rust/winapi/src/cfg.rs | 134 + third_party/rust/winapi/src/cfgmgr32.rs | 758 + third_party/rust/winapi/src/combaseapi.rs | 17 + third_party/rust/winapi/src/commctrl.rs | 3578 ++ third_party/rust/winapi/src/commdlg.rs | 583 + third_party/rust/winapi/src/corsym.rs | 79 + third_party/rust/winapi/src/d2d1.rs | 734 + third_party/rust/winapi/src/d2dbasetypes.rs | 61 + third_party/rust/winapi/src/d3d10shader.rs | 110 + third_party/rust/winapi/src/d3d11.rs | 2665 + third_party/rust/winapi/src/d3d11shader.rs | 320 + third_party/rust/winapi/src/d3d12.rs | 2324 + third_party/rust/winapi/src/d3d12sdklayers.rs | 1063 + third_party/rust/winapi/src/d3d12shader.rs | 320 + third_party/rust/winapi/src/d3d9.rs | 713 + third_party/rust/winapi/src/d3d9caps.rs | 349 + third_party/rust/winapi/src/d3d9types.rs | 1397 + third_party/rust/winapi/src/d3dcommon.rs | 753 + third_party/rust/winapi/src/d3dcompiler.rs | 74 + third_party/rust/winapi/src/dbghelp.rs | 340 + third_party/rust/winapi/src/dcommon.rs | 18 + third_party/rust/winapi/src/devpropdef.rs | 71 + third_party/rust/winapi/src/docobj.rs | 22 + third_party/rust/winapi/src/dpapi.rs | 11 + third_party/rust/winapi/src/dsgetdc.rs | 113 + third_party/rust/winapi/src/dsound.rs | 132 + third_party/rust/winapi/src/dsrole.rs | 50 + third_party/rust/winapi/src/dwmapi.rs | 9 + third_party/rust/winapi/src/dwrite.rs | 1038 + third_party/rust/winapi/src/dxgi.rs | 240 + third_party/rust/winapi/src/dxgi1_2.rs | 288 + third_party/rust/winapi/src/dxgi1_3.rs | 131 + third_party/rust/winapi/src/dxgi1_4.rs | 82 + third_party/rust/winapi/src/dxgiformat.rs | 124 + third_party/rust/winapi/src/dxgitype.rs | 86 + third_party/rust/winapi/src/errhandlingapi.rs | 7 + third_party/rust/winapi/src/excpt.rs | 14 + third_party/rust/winapi/src/fileapi.rs | 152 + third_party/rust/winapi/src/gl.rs | 35 + third_party/rust/winapi/src/guiddef.rs | 20 + third_party/rust/winapi/src/heapapi.rs | 12 + third_party/rust/winapi/src/hidclass.rs | 56 + third_party/rust/winapi/src/hidpi.rs | 182 + third_party/rust/winapi/src/hidsdi.rs | 15 + third_party/rust/winapi/src/hidusage.rs | 270 + third_party/rust/winapi/src/hstring.rs | 16 + third_party/rust/winapi/src/http.rs | 828 + third_party/rust/winapi/src/imm.rs | 3 + third_party/rust/winapi/src/inaddr.rs | 22 + third_party/rust/winapi/src/inspectable.rs | 15 + third_party/rust/winapi/src/ksmedia.rs | 18 + third_party/rust/winapi/src/lib.rs | 368 + third_party/rust/winapi/src/libloaderapi.rs | 23 + third_party/rust/winapi/src/lmaccess.rs | 853 + third_party/rust/winapi/src/lmcons.rs | 55 + third_party/rust/winapi/src/lmdfs.rs | 311 + third_party/rust/winapi/src/lmerrlog.rs | 263 + third_party/rust/winapi/src/lmjoin.rs | 80 + third_party/rust/winapi/src/lsalookup.rs | 69 + third_party/rust/winapi/src/macros.rs | 270 + third_party/rust/winapi/src/memoryapi.rs | 19 + third_party/rust/winapi/src/minschannel.rs | 56 + third_party/rust/winapi/src/minwinbase.rs | 253 + third_party/rust/winapi/src/minwindef.rs | 89 + third_party/rust/winapi/src/mmdeviceapi.rs | 63 + third_party/rust/winapi/src/mmreg.rs | 304 + third_party/rust/winapi/src/mmsystem.rs | 259 + third_party/rust/winapi/src/mscat.rs | 28 + third_party/rust/winapi/src/mssip.rs | 103 + third_party/rust/winapi/src/nb30.rs | 200 + third_party/rust/winapi/src/ncrypt.rs | 9 + third_party/rust/winapi/src/ntdef.rs | 7 + third_party/rust/winapi/src/ntsecapi.rs | 1589 + third_party/rust/winapi/src/ntstatus.rs | 2474 + third_party/rust/winapi/src/oaidl.rs | 590 + third_party/rust/winapi/src/objbase.rs | 5 + third_party/rust/winapi/src/objidl.rs | 100 + third_party/rust/winapi/src/objidlbase.rs | 93 + third_party/rust/winapi/src/olectl.rs | 10 + third_party/rust/winapi/src/pdh.rs | 52 + third_party/rust/winapi/src/playsoundapi.rs | 19 + .../rust/winapi/src/processsnapshot.rs | 58 + .../rust/winapi/src/processthreadsapi.rs | 62 + third_party/rust/winapi/src/propidl.rs | 10 + third_party/rust/winapi/src/propsys.rs | 4 + third_party/rust/winapi/src/prsht.rs | 262 + third_party/rust/winapi/src/psapi.rs | 166 + third_party/rust/winapi/src/qos.rs | 16 + third_party/rust/winapi/src/reason.rs | 63 + .../rust/winapi/src/restrictederrorinfo.rs | 9 + third_party/rust/winapi/src/roapi.rs | 13 + third_party/rust/winapi/src/roerrorapi.rs | 11 + third_party/rust/winapi/src/rpc.rs | 5 + third_party/rust/winapi/src/rpcdce.rs | 535 + third_party/rust/winapi/src/sapi.rs | 2431 + third_party/rust/winapi/src/schannel.rs | 333 + third_party/rust/winapi/src/servprov.rs | 11 + third_party/rust/winapi/src/setupapi.rs | 1301 + third_party/rust/winapi/src/shellapi.rs | 62 + .../rust/winapi/src/shellscalingapi.rs | 19 + third_party/rust/winapi/src/shlguid.rs | 2 + third_party/rust/winapi/src/shlobj.rs | 94 + third_party/rust/winapi/src/shobjidl.rs | 652 + third_party/rust/winapi/src/shtypes.rs | 40 + third_party/rust/winapi/src/spapidef.rs | 48 + third_party/rust/winapi/src/sql.rs | 179 + third_party/rust/winapi/src/sqltypes.rs | 130 + third_party/rust/winapi/src/sspi.rs | 657 + third_party/rust/winapi/src/strmif.rs | 4 + third_party/rust/winapi/src/subauth.rs | 198 + third_party/rust/winapi/src/synchapi.rs | 14 + third_party/rust/winapi/src/sysinfoapi.rs | 46 + third_party/rust/winapi/src/threadpoolapi.rs | 7 + third_party/rust/winapi/src/timezoneapi.rs | 27 + third_party/rust/winapi/src/tlhelp32.rs | 104 + third_party/rust/winapi/src/unknwnbase.rs | 29 + third_party/rust/winapi/src/urlhist.rs | 56 + third_party/rust/winapi/src/urlmon.rs | 6 + third_party/rust/winapi/src/usb.rs | 18 + third_party/rust/winapi/src/usbspec.rs | 41 + third_party/rust/winapi/src/usp10.rs | 201 + third_party/rust/winapi/src/vadefs.rs | 7 + third_party/rust/winapi/src/vsbackup.rs | 303 + third_party/rust/winapi/src/vss.rs | 256 + third_party/rust/winapi/src/vsserror.rs | 85 + third_party/rust/winapi/src/vswriter.rs | 241 + third_party/rust/winapi/src/werapi.rs | 8 + third_party/rust/winapi/src/winbase.rs | 552 + third_party/rust/winapi/src/wincon.rs | 198 + third_party/rust/winapi/src/wincred.rs | 209 + third_party/rust/winapi/src/wincrypt.rs | 2206 + third_party/rust/winapi/src/windef.rs | 57 + third_party/rust/winapi/src/windowscodecs.rs | 363 + third_party/rust/winapi/src/windowsx.rs | 22 + third_party/rust/winapi/src/winerror.rs | 6065 ++ third_party/rust/winapi/src/winevt.rs | 40 + third_party/rust/winapi/src/wingdi.rs | 1238 + third_party/rust/winapi/src/winhttp.rs | 441 + third_party/rust/winapi/src/winioctl.rs | 754 + third_party/rust/winapi/src/winnetwk.rs | 275 + third_party/rust/winapi/src/winnls.rs | 164 + third_party/rust/winapi/src/winnt.rs | 2368 + third_party/rust/winapi/src/winreg.rs | 41 + third_party/rust/winapi/src/winscard.rs | 269 + third_party/rust/winapi/src/winsmcrd.rs | 157 + third_party/rust/winapi/src/winsock2.rs | 429 + third_party/rust/winapi/src/winspool.rs | 29 + third_party/rust/winapi/src/winstring.rs | 3 + third_party/rust/winapi/src/winsvc.rs | 200 + third_party/rust/winapi/src/winusb.rs | 33 + third_party/rust/winapi/src/winusbio.rs | 18 + third_party/rust/winapi/src/winuser.rs | 2334 + third_party/rust/winapi/src/ws2def.rs | 279 + third_party/rust/winapi/src/ws2ipdef.rs | 42 + third_party/rust/winapi/src/ws2spi.rs | 57 + third_party/rust/winapi/src/ws2tcpip.rs | 27 + third_party/rust/winapi/src/wtypes.rs | 75 + third_party/rust/winapi/src/wtypesbase.rs | 37 + third_party/rust/winapi/src/xinput.rs | 118 + third_party/rust/x11/.cargo-checksum.json | 1 + third_party/rust/x11/.cargo-ok | 0 third_party/rust/x11/Cargo.toml | 52 + third_party/rust/x11/build.rs | 9 + third_party/rust/x11/examples/hello-world.rs | 89 + third_party/rust/x11/examples/input.rs | 384 + third_party/rust/x11/examples/xrecord.rs | 127 + third_party/rust/x11/src/dpms.rs | 44 + third_party/rust/x11/src/glx.rs | 191 + third_party/rust/x11/src/internal.rs | 41 + third_party/rust/x11/src/keysym.rs | 1332 + third_party/rust/x11/src/lib.rs | 37 + third_party/rust/x11/src/link.rs | 22 + third_party/rust/x11/src/xcursor.rs | 211 + third_party/rust/x11/src/xf86vmode.rs | 149 + third_party/rust/x11/src/xfixes.rs | 13 + third_party/rust/x11/src/xft.rs | 219 + third_party/rust/x11/src/xinerama.rs | 66 + third_party/rust/x11/src/xinput.rs | 165 + third_party/rust/x11/src/xinput2.rs | 757 + third_party/rust/x11/src/xlib.rs | 3212 ++ third_party/rust/x11/src/xlib_xcb.rs | 10 + third_party/rust/x11/src/xmd.rs | 12 + third_party/rust/x11/src/xmu.rs | 199 + third_party/rust/x11/src/xrandr.rs | 555 + third_party/rust/x11/src/xrecord.rs | 137 + third_party/rust/x11/src/xrender.rs | 463 + third_party/rust/x11/src/xss.rs | 100 + third_party/rust/x11/src/xt.rs | 398 + third_party/rust/x11/src/xtest.rs | 42 + third_party/rust/xml-rs/.cargo-checksum.json | 1 + third_party/rust/xml-rs/.cargo-ok | 0 third_party/rust/xml-rs/.gitignore | 8 + third_party/rust/xml-rs/.travis.yml | 28 + third_party/rust/xml-rs/Cargo.toml | 21 + third_party/rust/xml-rs/Changelog.md | 43 + third_party/rust/xml-rs/LICENSE | 21 + third_party/rust/xml-rs/Readme.md | 236 + third_party/rust/xml-rs/design.md | 37 + third_party/rust/xml-rs/src/analyze.rs | 97 + third_party/rust/xml-rs/src/attribute.rs | 102 + third_party/rust/xml-rs/src/common.rs | 135 + third_party/rust/xml-rs/src/escape.rs | 112 + third_party/rust/xml-rs/src/lib.rs | 24 + third_party/rust/xml-rs/src/macros.rs | 30 + third_party/rust/xml-rs/src/name.rs | 301 + third_party/rust/xml-rs/src/namespace.rs | 483 + third_party/rust/xml-rs/src/reader/config.rs | 119 + third_party/rust/xml-rs/src/reader/error.rs | 121 + third_party/rust/xml-rs/src/reader/events.rs | 219 + third_party/rust/xml-rs/src/reader/lexer.rs | 840 + third_party/rust/xml-rs/src/reader/mod.rs | 125 + .../xml-rs/src/reader/parser/inside_cdata.rs | 32 + .../reader/parser/inside_closing_tag_name.rs | 34 + .../src/reader/parser/inside_comment.rs | 32 + .../src/reader/parser/inside_declaration.rs | 151 + .../src/reader/parser/inside_doctype.rs | 16 + .../src/reader/parser/inside_opening_tag.rs | 108 + .../parser/inside_processing_instruction.rs | 96 + .../src/reader/parser/inside_reference.rs | 65 + .../rust/xml-rs/src/reader/parser/mod.rs | 600 + .../xml-rs/src/reader/parser/outside_tag.rs | 130 + third_party/rust/xml-rs/src/util.rs | 107 + third_party/rust/xml-rs/src/writer/config.rs | 146 + third_party/rust/xml-rs/src/writer/emitter.rs | 427 + third_party/rust/xml-rs/src/writer/events.rs | 240 + third_party/rust/xml-rs/src/writer/mod.rs | 83 + .../rust/xml-rs/tests/documents/sample_1.xml | 34 + .../xml-rs/tests/documents/sample_1_full.txt | 58 + .../xml-rs/tests/documents/sample_1_short.txt | 37 + .../rust/xml-rs/tests/documents/sample_2.xml | 15 + .../xml-rs/tests/documents/sample_2_full.txt | 41 + .../xml-rs/tests/documents/sample_2_short.txt | 30 + .../rust/xml-rs/tests/documents/sample_3.xml | 13 + .../xml-rs/tests/documents/sample_3_full.txt | 23 + .../xml-rs/tests/documents/sample_3_short.txt | 14 + .../rust/xml-rs/tests/documents/sample_4.xml | 15 + .../xml-rs/tests/documents/sample_4_full.txt | 23 + .../xml-rs/tests/documents/sample_4_short.txt | 14 + third_party/rust/xml-rs/tests/event_reader.rs | 442 + third_party/rust/xml-rs/tests/event_writer.rs | 168 + toolkit/library/gtest/rust/Cargo.lock | 538 +- toolkit/library/rust/Cargo.lock | 538 +- 1096 files changed, 277079 insertions(+), 14 deletions(-) create mode 100644 third_party/rust/app_units/.cargo-checksum.json create mode 100644 third_party/rust/app_units/.cargo-ok create mode 100644 third_party/rust/app_units/.gitignore create mode 100644 third_party/rust/app_units/.travis.yml create mode 100644 third_party/rust/app_units/Cargo.toml create mode 100644 third_party/rust/app_units/README.md create mode 100644 third_party/rust/app_units/src/app_unit.rs create mode 100644 third_party/rust/app_units/src/lib.rs create mode 100644 third_party/rust/bincode/.cargo-checksum.json create mode 100644 third_party/rust/bincode/.cargo-ok create mode 100644 third_party/rust/bincode/.gitignore create mode 100644 third_party/rust/bincode/.travis.yml create mode 100644 third_party/rust/bincode/Cargo.toml create mode 100644 third_party/rust/bincode/LICENSE.md create mode 100644 third_party/rust/bincode/examples/basic.rs create mode 100644 third_party/rust/bincode/logo.png create mode 100644 third_party/rust/bincode/readme.dev.md create mode 100644 third_party/rust/bincode/readme.md create mode 100644 third_party/rust/bincode/src/lib.rs create mode 100644 third_party/rust/bincode/src/refbox.rs create mode 100644 third_party/rust/bincode/src/rustc_serialize/mod.rs create mode 100644 third_party/rust/bincode/src/rustc_serialize/reader.rs create mode 100644 third_party/rust/bincode/src/rustc_serialize/writer.rs create mode 100644 third_party/rust/bincode/src/serde/mod.rs create mode 100644 third_party/rust/bincode/src/serde/reader.rs create mode 100644 third_party/rust/bincode/src/serde/writer.rs create mode 100644 third_party/rust/bincode/tests/test.rs create mode 100644 third_party/rust/bit-set/.cargo-checksum.json create mode 100644 third_party/rust/bit-set/.cargo-ok create mode 100644 third_party/rust/bit-set/.gitignore create mode 100644 third_party/rust/bit-set/.travis.yml create mode 100644 third_party/rust/bit-set/Cargo.toml create mode 100644 third_party/rust/bit-set/LICENSE-APACHE create mode 100644 third_party/rust/bit-set/LICENSE-MIT create mode 100644 third_party/rust/bit-set/README.md create mode 100755 third_party/rust/bit-set/deploy-docs.sh create mode 100644 third_party/rust/bit-set/src/lib.rs create mode 100644 third_party/rust/bit-vec/.cargo-checksum.json create mode 100644 third_party/rust/bit-vec/.cargo-ok create mode 100644 third_party/rust/bit-vec/.gitignore create mode 100644 third_party/rust/bit-vec/.travis.yml create mode 100644 third_party/rust/bit-vec/Cargo.toml create mode 100644 third_party/rust/bit-vec/LICENSE-APACHE create mode 100644 third_party/rust/bit-vec/LICENSE-MIT create mode 100644 third_party/rust/bit-vec/README.md create mode 100644 third_party/rust/bit-vec/benches/extern.rs create mode 100755 third_party/rust/bit-vec/crusader.sh create mode 100755 third_party/rust/bit-vec/deploy-docs.sh create mode 100644 third_party/rust/bit-vec/src/bench.rs create mode 100644 third_party/rust/bit-vec/src/lib.rs create mode 100644 third_party/rust/bitflags/.cargo-checksum.json create mode 100644 third_party/rust/bitflags/.cargo-ok create mode 100644 third_party/rust/bitflags/.gitignore create mode 100644 third_party/rust/bitflags/.travis.yml create mode 100644 third_party/rust/bitflags/Cargo.toml create mode 100644 third_party/rust/bitflags/LICENSE-APACHE create mode 100644 third_party/rust/bitflags/LICENSE-MIT create mode 100644 third_party/rust/bitflags/README.md create mode 100644 third_party/rust/bitflags/src/lib.rs create mode 100644 third_party/rust/bitflags/tests/external.rs create mode 100644 third_party/rust/bitflags/tests/external_no_std.rs create mode 100644 third_party/rust/byteorder-0.5.3/.cargo-checksum.json create mode 100644 third_party/rust/byteorder-0.5.3/.cargo-ok create mode 100644 third_party/rust/byteorder-0.5.3/.gitignore create mode 100644 third_party/rust/byteorder-0.5.3/.travis.yml create mode 100644 third_party/rust/byteorder-0.5.3/COPYING create mode 100644 third_party/rust/byteorder-0.5.3/Cargo.toml create mode 100644 third_party/rust/byteorder-0.5.3/LICENSE-MIT create mode 100644 third_party/rust/byteorder-0.5.3/Makefile create mode 100644 third_party/rust/byteorder-0.5.3/README.md create mode 100644 third_party/rust/byteorder-0.5.3/UNLICENSE create mode 100644 third_party/rust/byteorder-0.5.3/benches/bench.rs create mode 100644 third_party/rust/byteorder-0.5.3/session.vim create mode 100644 third_party/rust/byteorder-0.5.3/src/lib.rs create mode 100644 third_party/rust/byteorder-0.5.3/src/new.rs create mode 100644 third_party/rust/cgl/.cargo-checksum.json create mode 100644 third_party/rust/cgl/.cargo-ok create mode 100644 third_party/rust/cgl/.gitignore create mode 100644 third_party/rust/cgl/.travis.yml create mode 100644 third_party/rust/cgl/COPYING create mode 100644 third_party/rust/cgl/Cargo.toml create mode 100644 third_party/rust/cgl/LICENSE-APACHE create mode 100644 third_party/rust/cgl/LICENSE-MIT create mode 100644 third_party/rust/cgl/README.md create mode 100644 third_party/rust/cgl/src/cgl.rs create mode 100644 third_party/rust/cgl/src/lib.rs create mode 100644 third_party/rust/core-foundation-sys/.cargo-checksum.json create mode 100644 third_party/rust/core-foundation-sys/.cargo-ok create mode 100644 third_party/rust/core-foundation-sys/Cargo.toml create mode 100644 third_party/rust/core-foundation-sys/build.rs create mode 100644 third_party/rust/core-foundation-sys/src/array.rs create mode 100644 third_party/rust/core-foundation-sys/src/base.rs create mode 100644 third_party/rust/core-foundation-sys/src/bundle.rs create mode 100644 third_party/rust/core-foundation-sys/src/data.rs create mode 100644 third_party/rust/core-foundation-sys/src/date.rs create mode 100644 third_party/rust/core-foundation-sys/src/dictionary.rs create mode 100644 third_party/rust/core-foundation-sys/src/error.rs create mode 100644 third_party/rust/core-foundation-sys/src/lib.rs create mode 100644 third_party/rust/core-foundation-sys/src/messageport.rs create mode 100644 third_party/rust/core-foundation-sys/src/number.rs create mode 100644 third_party/rust/core-foundation-sys/src/propertylist.rs create mode 100644 third_party/rust/core-foundation-sys/src/runloop.rs create mode 100644 third_party/rust/core-foundation-sys/src/set.rs create mode 100644 third_party/rust/core-foundation-sys/src/string.rs create mode 100644 third_party/rust/core-foundation-sys/src/url.rs create mode 100644 third_party/rust/core-foundation/.cargo-checksum.json create mode 100644 third_party/rust/core-foundation/.cargo-ok create mode 100644 third_party/rust/core-foundation/Cargo.toml create mode 100644 third_party/rust/core-foundation/src/array.rs create mode 100644 third_party/rust/core-foundation/src/base.rs create mode 100644 third_party/rust/core-foundation/src/boolean.rs create mode 100644 third_party/rust/core-foundation/src/bundle.rs create mode 100644 third_party/rust/core-foundation/src/data.rs create mode 100644 third_party/rust/core-foundation/src/dictionary.rs create mode 100644 third_party/rust/core-foundation/src/error.rs create mode 100644 third_party/rust/core-foundation/src/lib.rs create mode 100644 third_party/rust/core-foundation/src/number.rs create mode 100644 third_party/rust/core-foundation/src/propertylist.rs create mode 100644 third_party/rust/core-foundation/src/runloop.rs create mode 100644 third_party/rust/core-foundation/src/set.rs create mode 100644 third_party/rust/core-foundation/src/string.rs create mode 100644 third_party/rust/core-foundation/src/url.rs create mode 100644 third_party/rust/core-graphics/.cargo-checksum.json create mode 100644 third_party/rust/core-graphics/.cargo-ok create mode 100644 third_party/rust/core-graphics/.gitignore create mode 100644 third_party/rust/core-graphics/.travis.yml create mode 100644 third_party/rust/core-graphics/COPYRIGHT create mode 100644 third_party/rust/core-graphics/Cargo.toml create mode 100644 third_party/rust/core-graphics/LICENSE-APACHE create mode 100644 third_party/rust/core-graphics/LICENSE-MIT create mode 100644 third_party/rust/core-graphics/README.md create mode 100644 third_party/rust/core-graphics/src/base.rs create mode 100644 third_party/rust/core-graphics/src/color_space.rs create mode 100644 third_party/rust/core-graphics/src/context.rs create mode 100644 third_party/rust/core-graphics/src/data_provider.rs create mode 100644 third_party/rust/core-graphics/src/display.rs create mode 100644 third_party/rust/core-graphics/src/event.rs create mode 100644 third_party/rust/core-graphics/src/event_source.rs create mode 100644 third_party/rust/core-graphics/src/font.rs create mode 100644 third_party/rust/core-graphics/src/geometry.rs create mode 100644 third_party/rust/core-graphics/src/lib.rs create mode 100644 third_party/rust/core-graphics/src/private.rs create mode 100644 third_party/rust/core-text/.cargo-checksum.json create mode 100644 third_party/rust/core-text/.cargo-ok create mode 100644 third_party/rust/core-text/.gitignore create mode 100644 third_party/rust/core-text/.travis.yml create mode 100644 third_party/rust/core-text/COPYRIGHT create mode 100644 third_party/rust/core-text/Cargo.toml create mode 100644 third_party/rust/core-text/LICENSE-APACHE create mode 100644 third_party/rust/core-text/LICENSE-MIT create mode 100644 third_party/rust/core-text/README.md create mode 100644 third_party/rust/core-text/src/font.rs create mode 100644 third_party/rust/core-text/src/font_collection.rs create mode 100644 third_party/rust/core-text/src/font_descriptor.rs create mode 100644 third_party/rust/core-text/src/font_manager.rs create mode 100644 third_party/rust/core-text/src/lib.rs create mode 100644 third_party/rust/dwrote/.cargo-checksum.json create mode 100644 third_party/rust/dwrote/.cargo-ok create mode 100644 third_party/rust/dwrote/.gitignore create mode 100644 third_party/rust/dwrote/Cargo.toml create mode 100644 third_party/rust/dwrote/README.md create mode 100644 third_party/rust/dwrote/build.rs create mode 100644 third_party/rust/dwrote/src/bitmap_render_target.rs create mode 100644 third_party/rust/dwrote/src/com_helpers.rs create mode 100644 third_party/rust/dwrote/src/comptr.rs create mode 100644 third_party/rust/dwrote/src/font.rs create mode 100644 third_party/rust/dwrote/src/font_collection.rs create mode 100644 third_party/rust/dwrote/src/font_face.rs create mode 100644 third_party/rust/dwrote/src/font_family.rs create mode 100644 third_party/rust/dwrote/src/font_file.rs create mode 100644 third_party/rust/dwrote/src/font_file_loader_impl.rs create mode 100644 third_party/rust/dwrote/src/gdi_interop.rs create mode 100644 third_party/rust/dwrote/src/glyph_run_analysis.rs create mode 100644 third_party/rust/dwrote/src/helpers.rs create mode 100644 third_party/rust/dwrote/src/lib.rs create mode 100644 third_party/rust/dwrote/src/rendering_params.rs create mode 100644 third_party/rust/dwrote/src/test.rs create mode 100644 third_party/rust/dwrote/src/types.rs create mode 100644 third_party/rust/error-chain/.cargo-checksum.json create mode 100644 third_party/rust/error-chain/.cargo-ok create mode 100644 third_party/rust/error-chain/.gitignore create mode 100644 third_party/rust/error-chain/.travis.yml create mode 100644 third_party/rust/error-chain/CHANGELOG.md create mode 100644 third_party/rust/error-chain/Cargo.toml create mode 100644 third_party/rust/error-chain/README.md create mode 100644 third_party/rust/error-chain/examples/all.rs create mode 100644 third_party/rust/error-chain/examples/doc.rs create mode 100644 third_party/rust/error-chain/examples/quickstart.rs create mode 100644 third_party/rust/error-chain/examples/size.rs create mode 100644 third_party/rust/error-chain/src/error_chain.rs create mode 100644 third_party/rust/error-chain/src/example_generated.rs create mode 100644 third_party/rust/error-chain/src/lib.rs create mode 100644 third_party/rust/error-chain/src/quick_error.rs create mode 100644 third_party/rust/error-chain/src/quick_main.rs create mode 100644 third_party/rust/error-chain/tests/quick_main.rs create mode 100644 third_party/rust/error-chain/tests/tests.rs create mode 100644 third_party/rust/euclid/.cargo-checksum.json create mode 100644 third_party/rust/euclid/.cargo-ok create mode 100644 third_party/rust/euclid/.gitignore create mode 100644 third_party/rust/euclid/.travis.yml create mode 100644 third_party/rust/euclid/COPYRIGHT create mode 100644 third_party/rust/euclid/Cargo.toml create mode 100644 third_party/rust/euclid/LICENSE-APACHE create mode 100644 third_party/rust/euclid/LICENSE-MIT create mode 100644 third_party/rust/euclid/README.md create mode 100644 third_party/rust/euclid/src/approxeq.rs create mode 100644 third_party/rust/euclid/src/length.rs create mode 100644 third_party/rust/euclid/src/lib.rs create mode 100644 third_party/rust/euclid/src/macros.rs create mode 100644 third_party/rust/euclid/src/matrix2d.rs create mode 100644 third_party/rust/euclid/src/matrix4d.rs create mode 100644 third_party/rust/euclid/src/num.rs create mode 100644 third_party/rust/euclid/src/point.rs create mode 100644 third_party/rust/euclid/src/rect.rs create mode 100644 third_party/rust/euclid/src/scale_factor.rs create mode 100644 third_party/rust/euclid/src/side_offsets.rs create mode 100644 third_party/rust/euclid/src/size.rs create mode 100644 third_party/rust/euclid/src/trig.rs create mode 100644 third_party/rust/fnv/.cargo-checksum.json create mode 100644 third_party/rust/fnv/.cargo-ok create mode 100644 third_party/rust/fnv/.gitignore create mode 100644 third_party/rust/fnv/.travis.yml create mode 100644 third_party/rust/fnv/Cargo.toml create mode 100644 third_party/rust/fnv/README.md create mode 100644 third_party/rust/fnv/lib.rs create mode 100644 third_party/rust/freetype/.cargo-checksum.json create mode 100644 third_party/rust/freetype/.cargo-ok create mode 100644 third_party/rust/freetype/.gitignore create mode 100644 third_party/rust/freetype/.travis.yml create mode 100644 third_party/rust/freetype/COPYRIGHT create mode 100644 third_party/rust/freetype/Cargo.toml create mode 100644 third_party/rust/freetype/LICENSE-APACHE create mode 100644 third_party/rust/freetype/LICENSE-MIT create mode 100644 third_party/rust/freetype/Makefile.in create mode 100644 third_party/rust/freetype/README.md create mode 100755 third_party/rust/freetype/configure create mode 100755 third_party/rust/freetype/etc/bindgen.sh create mode 100644 third_party/rust/freetype/etc/bindings.h create mode 100644 third_party/rust/freetype/src/freetype.rs create mode 100644 third_party/rust/freetype/src/lib.rs create mode 100644 third_party/rust/freetype/src/tt_os2.rs create mode 100644 third_party/rust/gdi32-sys/.cargo-checksum.json create mode 100644 third_party/rust/gdi32-sys/.cargo-ok create mode 100644 third_party/rust/gdi32-sys/Cargo.toml create mode 100644 third_party/rust/gdi32-sys/README.md create mode 100644 third_party/rust/gdi32-sys/build.rs create mode 100644 third_party/rust/gdi32-sys/src/lib.rs create mode 100644 third_party/rust/gl_generator/.cargo-checksum.json create mode 100644 third_party/rust/gl_generator/.cargo-ok create mode 100644 third_party/rust/gl_generator/Cargo.toml create mode 100644 third_party/rust/gl_generator/README.md create mode 100644 third_party/rust/gl_generator/generators/debug_struct_gen.rs create mode 100644 third_party/rust/gl_generator/generators/global_gen.rs create mode 100644 third_party/rust/gl_generator/generators/mod.rs create mode 100644 third_party/rust/gl_generator/generators/static_gen.rs create mode 100644 third_party/rust/gl_generator/generators/static_struct_gen.rs create mode 100644 third_party/rust/gl_generator/generators/struct_gen.rs create mode 100644 third_party/rust/gl_generator/generators/templates/types/egl.rs create mode 100644 third_party/rust/gl_generator/generators/templates/types/gl.rs create mode 100644 third_party/rust/gl_generator/generators/templates/types/glx.rs create mode 100644 third_party/rust/gl_generator/generators/templates/types/wgl.rs create mode 100644 third_party/rust/gl_generator/lib.rs create mode 100644 third_party/rust/gl_generator/registry/mod.rs create mode 100644 third_party/rust/gl_generator/registry/parse.rs create mode 100644 third_party/rust/gleam/.cargo-checksum.json create mode 100644 third_party/rust/gleam/.cargo-ok create mode 100644 third_party/rust/gleam/.gitignore create mode 100644 third_party/rust/gleam/.travis.yml create mode 100644 third_party/rust/gleam/COPYING create mode 100644 third_party/rust/gleam/Cargo.toml create mode 100644 third_party/rust/gleam/LICENSE-APACHE create mode 100644 third_party/rust/gleam/LICENSE-MIT create mode 100644 third_party/rust/gleam/README.md create mode 100644 third_party/rust/gleam/build.rs create mode 100644 third_party/rust/gleam/src/gl.rs create mode 100644 third_party/rust/gleam/src/lib.rs create mode 100644 third_party/rust/heapsize/.cargo-checksum.json create mode 100644 third_party/rust/heapsize/.cargo-ok create mode 100644 third_party/rust/heapsize/.gitignore create mode 100644 third_party/rust/heapsize/.travis.yml create mode 100644 third_party/rust/heapsize/Cargo.toml create mode 100644 third_party/rust/heapsize/README.md create mode 100644 third_party/rust/heapsize/appveyor.yml create mode 100644 third_party/rust/heapsize/build.rs create mode 100644 third_party/rust/heapsize/src/lib.rs create mode 100644 third_party/rust/heapsize/tests/tests.rs create mode 100644 third_party/rust/kernel32-sys/.cargo-checksum.json create mode 100644 third_party/rust/kernel32-sys/.cargo-ok create mode 100644 third_party/rust/kernel32-sys/Cargo.toml create mode 100644 third_party/rust/kernel32-sys/README.md create mode 100644 third_party/rust/kernel32-sys/build.rs create mode 100644 third_party/rust/kernel32-sys/src/lib.rs create mode 100644 third_party/rust/khronos_api/.cargo-checksum.json create mode 100644 third_party/rust/khronos_api/.cargo-ok create mode 100644 third_party/rust/khronos_api/Cargo.toml create mode 100644 third_party/rust/khronos_api/README.md create mode 100755 third_party/rust/khronos_api/api/GL/glcorearb.h create mode 100755 third_party/rust/khronos_api/api/GL/glext.h create mode 100755 third_party/rust/khronos_api/api/GL/glxext.h create mode 100755 third_party/rust/khronos_api/api/GL/wglext.h create mode 100755 third_party/rust/khronos_api/api/Makefile create mode 100755 third_party/rust/khronos_api/api/README.txt create mode 100755 third_party/rust/khronos_api/api/egl.xml create mode 100755 third_party/rust/khronos_api/api/genheaders.py create mode 100755 third_party/rust/khronos_api/api/gl.xml create mode 100755 third_party/rust/khronos_api/api/glx.xml create mode 100755 third_party/rust/khronos_api/api/readme.pdf create mode 100755 third_party/rust/khronos_api/api/readme.tex create mode 100755 third_party/rust/khronos_api/api/reg.py create mode 100755 third_party/rust/khronos_api/api/registry.rnc create mode 100755 third_party/rust/khronos_api/api/wgl.xml create mode 100644 third_party/rust/khronos_api/src/lib.rs create mode 100644 third_party/rust/lazy_static/.cargo-checksum.json create mode 100644 third_party/rust/lazy_static/.cargo-ok create mode 100644 third_party/rust/lazy_static/.gitignore create mode 100644 third_party/rust/lazy_static/.travis.yml create mode 100644 third_party/rust/lazy_static/Cargo.toml create mode 100644 third_party/rust/lazy_static/LICENSE create mode 100644 third_party/rust/lazy_static/README.md create mode 100644 third_party/rust/lazy_static/src/core_lazy.rs create mode 100644 third_party/rust/lazy_static/src/lazy.rs create mode 100644 third_party/rust/lazy_static/src/lib.rs create mode 100644 third_party/rust/lazy_static/src/nightly_lazy.rs create mode 100644 third_party/rust/lazy_static/tests/no_std.rs create mode 100644 third_party/rust/lazy_static/tests/test.rs create mode 100644 third_party/rust/log/.cargo-checksum.json create mode 100644 third_party/rust/log/.cargo-ok create mode 100644 third_party/rust/log/.gitignore create mode 100644 third_party/rust/log/.travis.yml create mode 100644 third_party/rust/log/Cargo.toml create mode 100644 third_party/rust/log/LICENSE-APACHE create mode 100644 third_party/rust/log/LICENSE-MIT create mode 100644 third_party/rust/log/README.md create mode 100644 third_party/rust/log/appveyor.yml create mode 100644 third_party/rust/log/src/lib.rs create mode 100644 third_party/rust/log/src/macros.rs create mode 100644 third_party/rust/log/tests/filters.rs create mode 100644 third_party/rust/matches/LICENSE create mode 100644 third_party/rust/metadeps/.cargo-checksum.json create mode 100644 third_party/rust/metadeps/.cargo-ok create mode 100644 third_party/rust/metadeps/.gitignore create mode 100644 third_party/rust/metadeps/Cargo.toml create mode 100644 third_party/rust/metadeps/README.md create mode 100644 third_party/rust/metadeps/src/lib.rs create mode 100644 third_party/rust/metadeps/tests/test.rs create mode 100644 third_party/rust/metadeps/tests/testdata.pc create mode 100644 third_party/rust/metadeps/tests/testlib.pc create mode 100644 third_party/rust/metadeps/tests/toml-missing-file/no-cargo-toml-here create mode 100644 third_party/rust/num-traits/.cargo-checksum.json create mode 100644 third_party/rust/num-traits/.cargo-ok create mode 100644 third_party/rust/num-traits/Cargo.toml create mode 100644 third_party/rust/num-traits/src/bounds.rs create mode 100644 third_party/rust/num-traits/src/cast.rs create mode 100644 third_party/rust/num-traits/src/float.rs create mode 100644 third_party/rust/num-traits/src/identities.rs create mode 100644 third_party/rust/num-traits/src/int.rs create mode 100644 third_party/rust/num-traits/src/lib.rs create mode 100644 third_party/rust/num-traits/src/ops/checked.rs create mode 100644 third_party/rust/num-traits/src/ops/mod.rs create mode 100644 third_party/rust/num-traits/src/ops/saturating.rs create mode 100644 third_party/rust/num-traits/src/pow.rs create mode 100644 third_party/rust/num-traits/src/sign.rs create mode 100644 third_party/rust/offscreen_gl_context/.cargo-checksum.json create mode 100644 third_party/rust/offscreen_gl_context/.cargo-ok create mode 100644 third_party/rust/offscreen_gl_context/.gitignore create mode 100644 third_party/rust/offscreen_gl_context/.travis.yml create mode 100644 third_party/rust/offscreen_gl_context/Cargo.toml create mode 100644 third_party/rust/offscreen_gl_context/Makefile create mode 100644 third_party/rust/offscreen_gl_context/README.md create mode 100644 third_party/rust/offscreen_gl_context/build.rs create mode 100644 third_party/rust/offscreen_gl_context/src/draw_buffer.rs create mode 100644 third_party/rust/offscreen_gl_context/src/gl_context.rs create mode 100644 third_party/rust/offscreen_gl_context/src/gl_context_attributes.rs create mode 100644 third_party/rust/offscreen_gl_context/src/gl_context_capabilities.rs create mode 100644 third_party/rust/offscreen_gl_context/src/gl_feature.rs create mode 100644 third_party/rust/offscreen_gl_context/src/gl_formats.rs create mode 100644 third_party/rust/offscreen_gl_context/src/gl_limits.rs create mode 100644 third_party/rust/offscreen_gl_context/src/lib.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/mod.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/not_implemented/mod.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/not_implemented/native_gl_context.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_cgl/mod.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_cgl/native_gl_context.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_egl/mod.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_egl/native_gl_context.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_egl/utils.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_glx/mod.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_glx/native_gl_context.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_glx/utils.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_osmesa/mod.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_wgl/mod.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_wgl/utils.rs create mode 100644 third_party/rust/offscreen_gl_context/src/platform/with_wgl/wgl_attributes.rs create mode 100644 third_party/rust/offscreen_gl_context/src/tests.rs create mode 100644 third_party/rust/osmesa-sys/.cargo-checksum.json create mode 100644 third_party/rust/osmesa-sys/.cargo-ok create mode 100644 third_party/rust/osmesa-sys/.gitignore create mode 100644 third_party/rust/osmesa-sys/Cargo.toml create mode 100644 third_party/rust/osmesa-sys/README.txt create mode 100644 third_party/rust/osmesa-sys/lib.rs create mode 100644 third_party/rust/quote/.cargo-checksum.json create mode 100644 third_party/rust/quote/.cargo-ok create mode 100644 third_party/rust/quote/Cargo.toml create mode 100644 third_party/rust/quote/src/ident.rs create mode 100644 third_party/rust/quote/src/lib.rs create mode 100644 third_party/rust/quote/src/to_tokens.rs create mode 100644 third_party/rust/quote/src/tokens.rs create mode 100644 third_party/rust/redox_syscall/.cargo-checksum.json create mode 100644 third_party/rust/redox_syscall/.cargo-ok create mode 100644 third_party/rust/redox_syscall/.gitignore create mode 100644 third_party/rust/redox_syscall/Cargo.toml create mode 100644 third_party/rust/redox_syscall/src/arch/arm.rs create mode 100644 third_party/rust/redox_syscall/src/arch/x86.rs create mode 100644 third_party/rust/redox_syscall/src/arch/x86_64.rs create mode 100644 third_party/rust/redox_syscall/src/call.rs create mode 100644 third_party/rust/redox_syscall/src/data.rs create mode 100644 third_party/rust/redox_syscall/src/error.rs create mode 100644 third_party/rust/redox_syscall/src/flag.rs create mode 100644 third_party/rust/redox_syscall/src/io/dma.rs create mode 100644 third_party/rust/redox_syscall/src/io/io.rs create mode 100644 third_party/rust/redox_syscall/src/io/mmio.rs create mode 100644 third_party/rust/redox_syscall/src/io/mod.rs create mode 100644 third_party/rust/redox_syscall/src/io/pio.rs create mode 100644 third_party/rust/redox_syscall/src/lib.rs create mode 100644 third_party/rust/redox_syscall/src/number.rs create mode 100644 third_party/rust/redox_syscall/src/scheme.rs create mode 100644 third_party/rust/rustc-serialize/.cargo-checksum.json create mode 100644 third_party/rust/rustc-serialize/.cargo-ok create mode 100644 third_party/rust/rustc-serialize/.gitignore create mode 100644 third_party/rust/rustc-serialize/.travis.yml create mode 100644 third_party/rust/rustc-serialize/Cargo.toml create mode 100644 third_party/rust/rustc-serialize/LICENSE-APACHE create mode 100644 third_party/rust/rustc-serialize/LICENSE-MIT create mode 100644 third_party/rust/rustc-serialize/README.md create mode 100644 third_party/rust/rustc-serialize/appveyor.yml create mode 100644 third_party/rust/rustc-serialize/benches/base64.rs create mode 100644 third_party/rust/rustc-serialize/benches/hex.rs create mode 100644 third_party/rust/rustc-serialize/benches/json.rs create mode 100644 third_party/rust/rustc-serialize/src/base64.rs create mode 100644 third_party/rust/rustc-serialize/src/collection_impls.rs create mode 100644 third_party/rust/rustc-serialize/src/hex.rs create mode 100644 third_party/rust/rustc-serialize/src/json.rs create mode 100644 third_party/rust/rustc-serialize/src/lib.rs create mode 100644 third_party/rust/rustc-serialize/src/serialize.rs create mode 100644 third_party/rust/serde/.cargo-checksum.json create mode 100644 third_party/rust/serde/.cargo-ok create mode 100644 third_party/rust/serde/Cargo.toml create mode 100644 third_party/rust/serde/src/bytes.rs create mode 100644 third_party/rust/serde/src/de/from_primitive.rs create mode 100644 third_party/rust/serde/src/de/impls.rs create mode 100644 third_party/rust/serde/src/de/mod.rs create mode 100644 third_party/rust/serde/src/de/value.rs create mode 100644 third_party/rust/serde/src/error.rs create mode 100644 third_party/rust/serde/src/iter.rs create mode 100644 third_party/rust/serde/src/lib.rs create mode 100644 third_party/rust/serde/src/macros.rs create mode 100644 third_party/rust/serde/src/ser/impls.rs create mode 100644 third_party/rust/serde/src/ser/mod.rs create mode 100644 third_party/rust/serde/src/utils.rs create mode 100644 third_party/rust/serde_codegen/.cargo-checksum.json create mode 100644 third_party/rust/serde_codegen/.cargo-ok create mode 100644 third_party/rust/serde_codegen/Cargo.toml create mode 100644 third_party/rust/serde_codegen/src/bound.rs create mode 100644 third_party/rust/serde_codegen/src/de.rs create mode 100644 third_party/rust/serde_codegen/src/lib.rs create mode 100644 third_party/rust/serde_codegen/src/ser.rs create mode 100644 third_party/rust/serde_codegen_internals/.cargo-checksum.json create mode 100644 third_party/rust/serde_codegen_internals/.cargo-ok create mode 100644 third_party/rust/serde_codegen_internals/Cargo.toml create mode 100644 third_party/rust/serde_codegen_internals/src/ast.rs create mode 100644 third_party/rust/serde_codegen_internals/src/attr.rs create mode 100644 third_party/rust/serde_codegen_internals/src/ctxt.rs create mode 100644 third_party/rust/serde_codegen_internals/src/lib.rs create mode 100644 third_party/rust/shared_library/.cargo-checksum.json create mode 100644 third_party/rust/shared_library/.cargo-ok create mode 100644 third_party/rust/shared_library/.gitignore create mode 100644 third_party/rust/shared_library/.travis.yml create mode 100644 third_party/rust/shared_library/Cargo.toml create mode 100644 third_party/rust/shared_library/src/dynamic_library.rs create mode 100644 third_party/rust/shared_library/src/lib.rs create mode 100644 third_party/rust/syn/.cargo-checksum.json create mode 100644 third_party/rust/syn/.cargo-ok create mode 100644 third_party/rust/syn/Cargo.toml create mode 100644 third_party/rust/syn/src/aster/generics.rs create mode 100644 third_party/rust/syn/src/aster/ident.rs create mode 100644 third_party/rust/syn/src/aster/invoke.rs create mode 100644 third_party/rust/syn/src/aster/lifetime.rs create mode 100644 third_party/rust/syn/src/aster/mod.rs create mode 100644 third_party/rust/syn/src/aster/path.rs create mode 100644 third_party/rust/syn/src/aster/qpath.rs create mode 100644 third_party/rust/syn/src/aster/ty.rs create mode 100644 third_party/rust/syn/src/aster/ty_param.rs create mode 100644 third_party/rust/syn/src/aster/where_predicate.rs create mode 100644 third_party/rust/syn/src/attr.rs create mode 100644 third_party/rust/syn/src/constant.rs create mode 100644 third_party/rust/syn/src/data.rs create mode 100644 third_party/rust/syn/src/escape.rs create mode 100644 third_party/rust/syn/src/expr.rs create mode 100644 third_party/rust/syn/src/generics.rs create mode 100644 third_party/rust/syn/src/helper.rs create mode 100644 third_party/rust/syn/src/ident.rs create mode 100644 third_party/rust/syn/src/item.rs create mode 100644 third_party/rust/syn/src/krate.rs create mode 100644 third_party/rust/syn/src/lib.rs create mode 100644 third_party/rust/syn/src/lit.rs create mode 100644 third_party/rust/syn/src/mac.rs create mode 100644 third_party/rust/syn/src/macro_input.rs create mode 100644 third_party/rust/syn/src/nom.rs create mode 100644 third_party/rust/syn/src/op.rs create mode 100644 third_party/rust/syn/src/registry.rs create mode 100644 third_party/rust/syn/src/space.rs create mode 100644 third_party/rust/syn/src/ty.rs create mode 100644 third_party/rust/syn/src/visit.rs create mode 100644 third_party/rust/syntex/.cargo-checksum.json create mode 100644 third_party/rust/syntex/.cargo-ok create mode 100644 third_party/rust/syntex/Cargo.toml create mode 100644 third_party/rust/syntex/src/error.rs create mode 100644 third_party/rust/syntex/src/lib.rs create mode 100644 third_party/rust/syntex/src/registry.rs create mode 100644 third_party/rust/syntex/src/resolver.rs create mode 100644 third_party/rust/syntex/src/stack.rs create mode 100644 third_party/rust/syntex_errors/.cargo-checksum.json create mode 100644 third_party/rust/syntex_errors/.cargo-ok create mode 100644 third_party/rust/syntex_errors/Cargo.toml create mode 100644 third_party/rust/syntex_errors/src/diagnostic.rs create mode 100644 third_party/rust/syntex_errors/src/diagnostic_builder.rs create mode 100644 third_party/rust/syntex_errors/src/emitter.rs create mode 100644 third_party/rust/syntex_errors/src/lib.rs create mode 100644 third_party/rust/syntex_errors/src/lock.rs create mode 100644 third_party/rust/syntex_errors/src/registry.rs create mode 100644 third_party/rust/syntex_errors/src/snippet.rs create mode 100644 third_party/rust/syntex_errors/src/styled_buffer.rs create mode 100644 third_party/rust/syntex_pos/.cargo-checksum.json create mode 100644 third_party/rust/syntex_pos/.cargo-ok create mode 100644 third_party/rust/syntex_pos/Cargo.toml create mode 100644 third_party/rust/syntex_pos/src/lib.rs create mode 100644 third_party/rust/syntex_syntax/.cargo-checksum.json create mode 100644 third_party/rust/syntex_syntax/.cargo-ok create mode 100644 third_party/rust/syntex_syntax/Cargo.toml create mode 100644 third_party/rust/syntex_syntax/src/abi.rs create mode 100644 third_party/rust/syntex_syntax/src/ast.rs create mode 100644 third_party/rust/syntex_syntax/src/attr.rs create mode 100644 third_party/rust/syntex_syntax/src/codemap.rs create mode 100644 third_party/rust/syntex_syntax/src/config.rs create mode 100644 third_party/rust/syntex_syntax/src/diagnostic_list.rs create mode 100644 third_party/rust/syntex_syntax/src/diagnostics/macros.rs create mode 100644 third_party/rust/syntex_syntax/src/diagnostics/metadata.rs create mode 100644 third_party/rust/syntex_syntax/src/diagnostics/plugin.rs create mode 100644 third_party/rust/syntex_syntax/src/entry.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/base.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/build.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/decorator.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/env.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/expand.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/hygiene.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/placeholders.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/proc_macro_shim.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/quote.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/source_util.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/tt/macro_parser.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/tt/macro_rules.rs create mode 100644 third_party/rust/syntex_syntax/src/ext/tt/transcribe.rs create mode 100644 third_party/rust/syntex_syntax/src/feature_gate.rs create mode 100644 third_party/rust/syntex_syntax/src/fold.rs create mode 100644 third_party/rust/syntex_syntax/src/json.rs create mode 100644 third_party/rust/syntex_syntax/src/lib.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/attr.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/classify.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/common.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/lexer/comments.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/lexer/mod.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/lexer/unicode_chars.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/mod.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/obsolete.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/parser.rs create mode 100644 third_party/rust/syntex_syntax/src/parse/token.rs create mode 100644 third_party/rust/syntex_syntax/src/print/pp.rs create mode 100644 third_party/rust/syntex_syntax/src/print/pprust.rs create mode 100644 third_party/rust/syntex_syntax/src/ptr.rs create mode 100644 third_party/rust/syntex_syntax/src/show_span.rs create mode 100644 third_party/rust/syntex_syntax/src/std_inject.rs create mode 100644 third_party/rust/syntex_syntax/src/str.rs create mode 100644 third_party/rust/syntex_syntax/src/symbol.rs create mode 100644 third_party/rust/syntex_syntax/src/test.rs create mode 100644 third_party/rust/syntex_syntax/src/test_snippet.rs create mode 100644 third_party/rust/syntex_syntax/src/tokenstream.rs create mode 100644 third_party/rust/syntex_syntax/src/util/lev_distance.rs create mode 100644 third_party/rust/syntex_syntax/src/util/move_map.rs create mode 100644 third_party/rust/syntex_syntax/src/util/node_count.rs create mode 100644 third_party/rust/syntex_syntax/src/util/parser.rs create mode 100644 third_party/rust/syntex_syntax/src/util/parser_testing.rs create mode 100644 third_party/rust/syntex_syntax/src/util/small_vector.rs create mode 100644 third_party/rust/syntex_syntax/src/util/thin_vec.rs create mode 100644 third_party/rust/syntex_syntax/src/visit.rs create mode 100644 third_party/rust/term/.cargo-checksum.json create mode 100644 third_party/rust/term/.cargo-ok create mode 100644 third_party/rust/term/.gitignore create mode 100644 third_party/rust/term/.travis.yml create mode 100644 third_party/rust/term/Cargo.toml create mode 100644 third_party/rust/term/LICENSE-APACHE create mode 100644 third_party/rust/term/LICENSE-MIT create mode 100644 third_party/rust/term/README.md create mode 100644 third_party/rust/term/appveyor.yml create mode 100644 third_party/rust/term/rustfmt.toml create mode 100644 third_party/rust/term/scripts/id_rsa.enc create mode 100644 third_party/rust/term/scripts/travis-doc-upload.cfg create mode 100644 third_party/rust/term/src/lib.rs create mode 100644 third_party/rust/term/src/terminfo/mod.rs create mode 100644 third_party/rust/term/src/terminfo/parm.rs create mode 100644 third_party/rust/term/src/terminfo/parser/compiled.rs create mode 100644 third_party/rust/term/src/terminfo/parser/names.rs create mode 100644 third_party/rust/term/src/terminfo/searcher.rs create mode 100644 third_party/rust/term/src/win.rs create mode 100644 third_party/rust/term/tests/data/dumb create mode 100644 third_party/rust/term/tests/data/linux create mode 100644 third_party/rust/term/tests/data/linux-16color create mode 100644 third_party/rust/term/tests/data/linux-basic create mode 100644 third_party/rust/term/tests/data/linux-c create mode 100644 third_party/rust/term/tests/data/linux-c-nc create mode 100644 third_party/rust/term/tests/data/linux-koi8 create mode 100644 third_party/rust/term/tests/data/linux-koi8r create mode 100644 third_party/rust/term/tests/data/linux-lat create mode 100644 third_party/rust/term/tests/data/linux-m create mode 100644 third_party/rust/term/tests/data/linux-nic create mode 100644 third_party/rust/term/tests/data/linux-vt create mode 100644 third_party/rust/term/tests/data/linux2.2 create mode 100644 third_party/rust/term/tests/data/linux2.6 create mode 100644 third_party/rust/term/tests/data/linux2.6.26 create mode 100644 third_party/rust/term/tests/data/linux3.0 create mode 100644 third_party/rust/term/tests/data/rxvt create mode 100644 third_party/rust/term/tests/data/rxvt-16color create mode 100644 third_party/rust/term/tests/data/rxvt-256color create mode 100644 third_party/rust/term/tests/data/rxvt-88color create mode 100644 third_party/rust/term/tests/data/rxvt-basic create mode 100644 third_party/rust/term/tests/data/rxvt-color create mode 100644 third_party/rust/term/tests/data/rxvt-cygwin create mode 100644 third_party/rust/term/tests/data/rxvt-cygwin-native create mode 100644 third_party/rust/term/tests/data/rxvt-xpm create mode 100644 third_party/rust/term/tests/data/screen create mode 100644 third_party/rust/term/tests/data/screen-256color create mode 100644 third_party/rust/term/tests/data/xterm create mode 100644 third_party/rust/term/tests/data/xterm-256color create mode 100644 third_party/rust/term/tests/terminfo.rs create mode 100644 third_party/rust/threadpool/.cargo-checksum.json create mode 100644 third_party/rust/threadpool/.cargo-ok create mode 100644 third_party/rust/threadpool/.gitignore create mode 100644 third_party/rust/threadpool/.travis.yml create mode 100644 third_party/rust/threadpool/CHANGES.md create mode 100644 third_party/rust/threadpool/Cargo.toml create mode 100644 third_party/rust/threadpool/LICENSE-APACHE create mode 100644 third_party/rust/threadpool/LICENSE-MIT create mode 100644 third_party/rust/threadpool/README.md create mode 100644 third_party/rust/threadpool/lib.rs create mode 100644 third_party/rust/time/.cargo-checksum.json create mode 100644 third_party/rust/time/.cargo-ok create mode 100644 third_party/rust/time/.gitignore create mode 100644 third_party/rust/time/.travis.yml create mode 100644 third_party/rust/time/Cargo.toml create mode 100644 third_party/rust/time/LICENSE-APACHE create mode 100644 third_party/rust/time/LICENSE-MIT create mode 100644 third_party/rust/time/README.md create mode 100644 third_party/rust/time/appveyor.yml create mode 100644 third_party/rust/time/benches/precise_time_ns.rs create mode 100644 third_party/rust/time/src/display.rs create mode 100644 third_party/rust/time/src/duration.rs create mode 100644 third_party/rust/time/src/lib.rs create mode 100644 third_party/rust/time/src/parse.rs create mode 100644 third_party/rust/time/src/sys.rs create mode 100644 third_party/rust/toml/.cargo-checksum.json create mode 100644 third_party/rust/toml/.cargo-ok create mode 100644 third_party/rust/toml/.gitignore create mode 100644 third_party/rust/toml/.travis.yml create mode 100644 third_party/rust/toml/Cargo.toml create mode 100644 third_party/rust/toml/LICENSE-APACHE create mode 100644 third_party/rust/toml/LICENSE-MIT create mode 100644 third_party/rust/toml/README.md create mode 100644 third_party/rust/toml/examples/toml2json.rs create mode 100644 third_party/rust/toml/src/decoder/mod.rs create mode 100644 third_party/rust/toml/src/decoder/rustc_serialize.rs create mode 100644 third_party/rust/toml/src/decoder/serde.rs create mode 100644 third_party/rust/toml/src/display.rs create mode 100644 third_party/rust/toml/src/encoder/mod.rs create mode 100644 third_party/rust/toml/src/encoder/rustc_serialize.rs create mode 100644 third_party/rust/toml/src/encoder/serde.rs create mode 100644 third_party/rust/toml/src/lib.rs create mode 100644 third_party/rust/toml/src/parser.rs create mode 100644 third_party/rust/toml/tests/README.md create mode 100644 third_party/rust/toml/tests/formatting.rs create mode 100644 third_party/rust/toml/tests/invalid-encoder/array-mixed-types-ints-and-floats.json create mode 100644 third_party/rust/toml/tests/invalid.rs create mode 100644 third_party/rust/toml/tests/invalid/array-mixed-types-arrays-and-ints.toml create mode 100644 third_party/rust/toml/tests/invalid/array-mixed-types-ints-and-floats.toml create mode 100644 third_party/rust/toml/tests/invalid/array-mixed-types-strings-and-ints.toml create mode 100644 third_party/rust/toml/tests/invalid/datetime-malformed-no-leads.toml create mode 100644 third_party/rust/toml/tests/invalid/datetime-malformed-no-secs.toml create mode 100644 third_party/rust/toml/tests/invalid/datetime-malformed-no-t.toml create mode 100644 third_party/rust/toml/tests/invalid/datetime-malformed-no-z.toml create mode 100644 third_party/rust/toml/tests/invalid/datetime-malformed-with-milli.toml create mode 100644 third_party/rust/toml/tests/invalid/duplicate-key-table.toml create mode 100644 third_party/rust/toml/tests/invalid/duplicate-keys.toml create mode 100644 third_party/rust/toml/tests/invalid/duplicate-tables.toml create mode 100644 third_party/rust/toml/tests/invalid/empty-implicit-table.toml create mode 100644 third_party/rust/toml/tests/invalid/empty-table.toml create mode 100644 third_party/rust/toml/tests/invalid/float-no-leading-zero.toml create mode 100644 third_party/rust/toml/tests/invalid/float-no-trailing-digits.toml create mode 100644 third_party/rust/toml/tests/invalid/key-after-array.toml create mode 100644 third_party/rust/toml/tests/invalid/key-after-table.toml create mode 100644 third_party/rust/toml/tests/invalid/key-empty.toml create mode 100644 third_party/rust/toml/tests/invalid/key-hash.toml create mode 100644 third_party/rust/toml/tests/invalid/key-newline.toml create mode 100644 third_party/rust/toml/tests/invalid/key-open-bracket.toml create mode 100644 third_party/rust/toml/tests/invalid/key-single-open-bracket.toml create mode 100644 third_party/rust/toml/tests/invalid/key-space.toml create mode 100644 third_party/rust/toml/tests/invalid/key-start-bracket.toml create mode 100644 third_party/rust/toml/tests/invalid/key-two-equals.toml create mode 100644 third_party/rust/toml/tests/invalid/string-bad-byte-escape.toml create mode 100644 third_party/rust/toml/tests/invalid/string-bad-escape.toml create mode 100644 third_party/rust/toml/tests/invalid/string-byte-escapes.toml create mode 100644 third_party/rust/toml/tests/invalid/string-no-close.toml create mode 100644 third_party/rust/toml/tests/invalid/table-array-implicit.toml create mode 100644 third_party/rust/toml/tests/invalid/table-array-malformed-bracket.toml create mode 100644 third_party/rust/toml/tests/invalid/table-array-malformed-empty.toml create mode 100644 third_party/rust/toml/tests/invalid/table-empty.toml create mode 100644 third_party/rust/toml/tests/invalid/table-nested-brackets-close.toml create mode 100644 third_party/rust/toml/tests/invalid/table-nested-brackets-open.toml create mode 100644 third_party/rust/toml/tests/invalid/table-whitespace.toml create mode 100644 third_party/rust/toml/tests/invalid/table-with-pound.toml create mode 100644 third_party/rust/toml/tests/invalid/text-after-array-entries.toml create mode 100644 third_party/rust/toml/tests/invalid/text-after-integer.toml create mode 100644 third_party/rust/toml/tests/invalid/text-after-string.toml create mode 100644 third_party/rust/toml/tests/invalid/text-after-table.toml create mode 100644 third_party/rust/toml/tests/invalid/text-before-array-separator.toml create mode 100644 third_party/rust/toml/tests/invalid/text-in-array.toml create mode 100644 third_party/rust/toml/tests/valid.rs create mode 100644 third_party/rust/toml/tests/valid/array-empty.json create mode 100644 third_party/rust/toml/tests/valid/array-empty.toml create mode 100644 third_party/rust/toml/tests/valid/array-nospaces.json create mode 100644 third_party/rust/toml/tests/valid/array-nospaces.toml create mode 100644 third_party/rust/toml/tests/valid/arrays-hetergeneous.json create mode 100644 third_party/rust/toml/tests/valid/arrays-hetergeneous.toml create mode 100644 third_party/rust/toml/tests/valid/arrays-nested.json create mode 100644 third_party/rust/toml/tests/valid/arrays-nested.toml create mode 100644 third_party/rust/toml/tests/valid/arrays.json create mode 100644 third_party/rust/toml/tests/valid/arrays.toml create mode 100644 third_party/rust/toml/tests/valid/bool.json create mode 100644 third_party/rust/toml/tests/valid/bool.toml create mode 100644 third_party/rust/toml/tests/valid/comments-everywhere.json create mode 100644 third_party/rust/toml/tests/valid/comments-everywhere.toml create mode 100644 third_party/rust/toml/tests/valid/datetime.json create mode 100644 third_party/rust/toml/tests/valid/datetime.toml create mode 100644 third_party/rust/toml/tests/valid/empty.json create mode 100644 third_party/rust/toml/tests/valid/empty.toml create mode 100644 third_party/rust/toml/tests/valid/example-bom.toml create mode 100644 third_party/rust/toml/tests/valid/example-v0.3.0.json create mode 100644 third_party/rust/toml/tests/valid/example-v0.3.0.toml create mode 100644 third_party/rust/toml/tests/valid/example-v0.4.0.json create mode 100644 third_party/rust/toml/tests/valid/example-v0.4.0.toml create mode 100644 third_party/rust/toml/tests/valid/example.json create mode 100644 third_party/rust/toml/tests/valid/example.toml create mode 100644 third_party/rust/toml/tests/valid/example2.json create mode 100644 third_party/rust/toml/tests/valid/example2.toml create mode 100644 third_party/rust/toml/tests/valid/float.json create mode 100644 third_party/rust/toml/tests/valid/float.toml create mode 100644 third_party/rust/toml/tests/valid/hard_example.json create mode 100644 third_party/rust/toml/tests/valid/hard_example.toml create mode 100644 third_party/rust/toml/tests/valid/implicit-and-explicit-after.json create mode 100644 third_party/rust/toml/tests/valid/implicit-and-explicit-after.toml create mode 100644 third_party/rust/toml/tests/valid/implicit-and-explicit-before.json create mode 100644 third_party/rust/toml/tests/valid/implicit-and-explicit-before.toml create mode 100644 third_party/rust/toml/tests/valid/implicit-groups.json create mode 100644 third_party/rust/toml/tests/valid/implicit-groups.toml create mode 100644 third_party/rust/toml/tests/valid/integer.json create mode 100644 third_party/rust/toml/tests/valid/integer.toml create mode 100644 third_party/rust/toml/tests/valid/key-equals-nospace.json create mode 100644 third_party/rust/toml/tests/valid/key-equals-nospace.toml create mode 100644 third_party/rust/toml/tests/valid/key-space.json create mode 100644 third_party/rust/toml/tests/valid/key-space.toml create mode 100644 third_party/rust/toml/tests/valid/key-special-chars.json create mode 100644 third_party/rust/toml/tests/valid/key-special-chars.toml create mode 100644 third_party/rust/toml/tests/valid/key-with-pound.json create mode 100644 third_party/rust/toml/tests/valid/key-with-pound.toml create mode 100644 third_party/rust/toml/tests/valid/long-float.json create mode 100644 third_party/rust/toml/tests/valid/long-float.toml create mode 100644 third_party/rust/toml/tests/valid/long-integer.json create mode 100644 third_party/rust/toml/tests/valid/long-integer.toml create mode 100644 third_party/rust/toml/tests/valid/multiline-string.json create mode 100644 third_party/rust/toml/tests/valid/multiline-string.toml create mode 100644 third_party/rust/toml/tests/valid/raw-multiline-string.json create mode 100644 third_party/rust/toml/tests/valid/raw-multiline-string.toml create mode 100644 third_party/rust/toml/tests/valid/raw-string.json create mode 100644 third_party/rust/toml/tests/valid/raw-string.toml create mode 100644 third_party/rust/toml/tests/valid/string-empty.json create mode 100644 third_party/rust/toml/tests/valid/string-empty.toml create mode 100644 third_party/rust/toml/tests/valid/string-escapes.json create mode 100644 third_party/rust/toml/tests/valid/string-escapes.toml create mode 100644 third_party/rust/toml/tests/valid/string-simple.json create mode 100644 third_party/rust/toml/tests/valid/string-simple.toml create mode 100644 third_party/rust/toml/tests/valid/string-with-pound.json create mode 100644 third_party/rust/toml/tests/valid/string-with-pound.toml create mode 100644 third_party/rust/toml/tests/valid/table-array-implicit.json create mode 100644 third_party/rust/toml/tests/valid/table-array-implicit.toml create mode 100644 third_party/rust/toml/tests/valid/table-array-many.json create mode 100644 third_party/rust/toml/tests/valid/table-array-many.toml create mode 100644 third_party/rust/toml/tests/valid/table-array-nest.json create mode 100644 third_party/rust/toml/tests/valid/table-array-nest.toml create mode 100644 third_party/rust/toml/tests/valid/table-array-one.json create mode 100644 third_party/rust/toml/tests/valid/table-array-one.toml create mode 100644 third_party/rust/toml/tests/valid/table-empty.json create mode 100644 third_party/rust/toml/tests/valid/table-empty.toml create mode 100644 third_party/rust/toml/tests/valid/table-sub-empty.json create mode 100644 third_party/rust/toml/tests/valid/table-sub-empty.toml create mode 100644 third_party/rust/toml/tests/valid/table-whitespace.json create mode 100644 third_party/rust/toml/tests/valid/table-whitespace.toml create mode 100644 third_party/rust/toml/tests/valid/table-with-pound.json create mode 100644 third_party/rust/toml/tests/valid/table-with-pound.toml create mode 100644 third_party/rust/toml/tests/valid/unicode-escape.json create mode 100644 third_party/rust/toml/tests/valid/unicode-escape.toml create mode 100644 third_party/rust/toml/tests/valid/unicode-literal.json create mode 100644 third_party/rust/toml/tests/valid/unicode-literal.toml create mode 100644 third_party/rust/unicode-xid/.cargo-checksum.json create mode 100644 third_party/rust/unicode-xid/.cargo-ok create mode 100644 third_party/rust/unicode-xid/.gitignore create mode 100644 third_party/rust/unicode-xid/.travis.yml create mode 100644 third_party/rust/unicode-xid/COPYRIGHT create mode 100644 third_party/rust/unicode-xid/Cargo.toml create mode 100644 third_party/rust/unicode-xid/LICENSE-APACHE create mode 100644 third_party/rust/unicode-xid/LICENSE-MIT create mode 100644 third_party/rust/unicode-xid/README.md create mode 100755 third_party/rust/unicode-xid/scripts/unicode.py create mode 100644 third_party/rust/unicode-xid/src/lib.rs create mode 100644 third_party/rust/unicode-xid/src/tables.rs create mode 100644 third_party/rust/unicode-xid/src/tests.rs create mode 100644 third_party/rust/user32-sys/.cargo-checksum.json create mode 100644 third_party/rust/user32-sys/.cargo-ok create mode 100644 third_party/rust/user32-sys/Cargo.toml create mode 100644 third_party/rust/user32-sys/README.md create mode 100644 third_party/rust/user32-sys/build.rs create mode 100644 third_party/rust/user32-sys/src/lib.rs create mode 100644 third_party/rust/winapi-build/.cargo-checksum.json create mode 100644 third_party/rust/winapi-build/.cargo-ok create mode 100644 third_party/rust/winapi-build/Cargo.toml create mode 100644 third_party/rust/winapi-build/src/lib.rs create mode 100644 third_party/rust/winapi/.cargo-checksum.json create mode 100644 third_party/rust/winapi/.cargo-ok create mode 100644 third_party/rust/winapi/Cargo.toml create mode 100644 third_party/rust/winapi/LICENSE.md create mode 100644 third_party/rust/winapi/src/activation.rs create mode 100644 third_party/rust/winapi/src/audioclient.rs create mode 100644 third_party/rust/winapi/src/audiosessiontypes.rs create mode 100644 third_party/rust/winapi/src/basetsd.rs create mode 100644 third_party/rust/winapi/src/bcrypt.rs create mode 100644 third_party/rust/winapi/src/cfg.rs create mode 100644 third_party/rust/winapi/src/cfgmgr32.rs create mode 100644 third_party/rust/winapi/src/combaseapi.rs create mode 100644 third_party/rust/winapi/src/commctrl.rs create mode 100644 third_party/rust/winapi/src/commdlg.rs create mode 100644 third_party/rust/winapi/src/corsym.rs create mode 100644 third_party/rust/winapi/src/d2d1.rs create mode 100644 third_party/rust/winapi/src/d2dbasetypes.rs create mode 100644 third_party/rust/winapi/src/d3d10shader.rs create mode 100644 third_party/rust/winapi/src/d3d11.rs create mode 100644 third_party/rust/winapi/src/d3d11shader.rs create mode 100644 third_party/rust/winapi/src/d3d12.rs create mode 100644 third_party/rust/winapi/src/d3d12sdklayers.rs create mode 100644 third_party/rust/winapi/src/d3d12shader.rs create mode 100644 third_party/rust/winapi/src/d3d9.rs create mode 100644 third_party/rust/winapi/src/d3d9caps.rs create mode 100644 third_party/rust/winapi/src/d3d9types.rs create mode 100644 third_party/rust/winapi/src/d3dcommon.rs create mode 100644 third_party/rust/winapi/src/d3dcompiler.rs create mode 100644 third_party/rust/winapi/src/dbghelp.rs create mode 100644 third_party/rust/winapi/src/dcommon.rs create mode 100644 third_party/rust/winapi/src/devpropdef.rs create mode 100644 third_party/rust/winapi/src/docobj.rs create mode 100644 third_party/rust/winapi/src/dpapi.rs create mode 100644 third_party/rust/winapi/src/dsgetdc.rs create mode 100644 third_party/rust/winapi/src/dsound.rs create mode 100644 third_party/rust/winapi/src/dsrole.rs create mode 100644 third_party/rust/winapi/src/dwmapi.rs create mode 100644 third_party/rust/winapi/src/dwrite.rs create mode 100644 third_party/rust/winapi/src/dxgi.rs create mode 100644 third_party/rust/winapi/src/dxgi1_2.rs create mode 100644 third_party/rust/winapi/src/dxgi1_3.rs create mode 100644 third_party/rust/winapi/src/dxgi1_4.rs create mode 100644 third_party/rust/winapi/src/dxgiformat.rs create mode 100644 third_party/rust/winapi/src/dxgitype.rs create mode 100644 third_party/rust/winapi/src/errhandlingapi.rs create mode 100644 third_party/rust/winapi/src/excpt.rs create mode 100644 third_party/rust/winapi/src/fileapi.rs create mode 100644 third_party/rust/winapi/src/gl.rs create mode 100644 third_party/rust/winapi/src/guiddef.rs create mode 100644 third_party/rust/winapi/src/heapapi.rs create mode 100644 third_party/rust/winapi/src/hidclass.rs create mode 100644 third_party/rust/winapi/src/hidpi.rs create mode 100644 third_party/rust/winapi/src/hidsdi.rs create mode 100644 third_party/rust/winapi/src/hidusage.rs create mode 100644 third_party/rust/winapi/src/hstring.rs create mode 100644 third_party/rust/winapi/src/http.rs create mode 100644 third_party/rust/winapi/src/imm.rs create mode 100644 third_party/rust/winapi/src/inaddr.rs create mode 100644 third_party/rust/winapi/src/inspectable.rs create mode 100644 third_party/rust/winapi/src/ksmedia.rs create mode 100644 third_party/rust/winapi/src/lib.rs create mode 100644 third_party/rust/winapi/src/libloaderapi.rs create mode 100644 third_party/rust/winapi/src/lmaccess.rs create mode 100644 third_party/rust/winapi/src/lmcons.rs create mode 100644 third_party/rust/winapi/src/lmdfs.rs create mode 100644 third_party/rust/winapi/src/lmerrlog.rs create mode 100644 third_party/rust/winapi/src/lmjoin.rs create mode 100644 third_party/rust/winapi/src/lsalookup.rs create mode 100644 third_party/rust/winapi/src/macros.rs create mode 100644 third_party/rust/winapi/src/memoryapi.rs create mode 100644 third_party/rust/winapi/src/minschannel.rs create mode 100644 third_party/rust/winapi/src/minwinbase.rs create mode 100644 third_party/rust/winapi/src/minwindef.rs create mode 100644 third_party/rust/winapi/src/mmdeviceapi.rs create mode 100644 third_party/rust/winapi/src/mmreg.rs create mode 100644 third_party/rust/winapi/src/mmsystem.rs create mode 100644 third_party/rust/winapi/src/mscat.rs create mode 100644 third_party/rust/winapi/src/mssip.rs create mode 100644 third_party/rust/winapi/src/nb30.rs create mode 100644 third_party/rust/winapi/src/ncrypt.rs create mode 100644 third_party/rust/winapi/src/ntdef.rs create mode 100644 third_party/rust/winapi/src/ntsecapi.rs create mode 100644 third_party/rust/winapi/src/ntstatus.rs create mode 100644 third_party/rust/winapi/src/oaidl.rs create mode 100644 third_party/rust/winapi/src/objbase.rs create mode 100644 third_party/rust/winapi/src/objidl.rs create mode 100644 third_party/rust/winapi/src/objidlbase.rs create mode 100644 third_party/rust/winapi/src/olectl.rs create mode 100644 third_party/rust/winapi/src/pdh.rs create mode 100644 third_party/rust/winapi/src/playsoundapi.rs create mode 100644 third_party/rust/winapi/src/processsnapshot.rs create mode 100644 third_party/rust/winapi/src/processthreadsapi.rs create mode 100644 third_party/rust/winapi/src/propidl.rs create mode 100644 third_party/rust/winapi/src/propsys.rs create mode 100644 third_party/rust/winapi/src/prsht.rs create mode 100644 third_party/rust/winapi/src/psapi.rs create mode 100644 third_party/rust/winapi/src/qos.rs create mode 100644 third_party/rust/winapi/src/reason.rs create mode 100644 third_party/rust/winapi/src/restrictederrorinfo.rs create mode 100644 third_party/rust/winapi/src/roapi.rs create mode 100644 third_party/rust/winapi/src/roerrorapi.rs create mode 100644 third_party/rust/winapi/src/rpc.rs create mode 100644 third_party/rust/winapi/src/rpcdce.rs create mode 100644 third_party/rust/winapi/src/sapi.rs create mode 100644 third_party/rust/winapi/src/schannel.rs create mode 100644 third_party/rust/winapi/src/servprov.rs create mode 100644 third_party/rust/winapi/src/setupapi.rs create mode 100644 third_party/rust/winapi/src/shellapi.rs create mode 100644 third_party/rust/winapi/src/shellscalingapi.rs create mode 100644 third_party/rust/winapi/src/shlguid.rs create mode 100644 third_party/rust/winapi/src/shlobj.rs create mode 100644 third_party/rust/winapi/src/shobjidl.rs create mode 100644 third_party/rust/winapi/src/shtypes.rs create mode 100644 third_party/rust/winapi/src/spapidef.rs create mode 100644 third_party/rust/winapi/src/sql.rs create mode 100644 third_party/rust/winapi/src/sqltypes.rs create mode 100644 third_party/rust/winapi/src/sspi.rs create mode 100644 third_party/rust/winapi/src/strmif.rs create mode 100644 third_party/rust/winapi/src/subauth.rs create mode 100644 third_party/rust/winapi/src/synchapi.rs create mode 100644 third_party/rust/winapi/src/sysinfoapi.rs create mode 100644 third_party/rust/winapi/src/threadpoolapi.rs create mode 100644 third_party/rust/winapi/src/timezoneapi.rs create mode 100644 third_party/rust/winapi/src/tlhelp32.rs create mode 100644 third_party/rust/winapi/src/unknwnbase.rs create mode 100644 third_party/rust/winapi/src/urlhist.rs create mode 100644 third_party/rust/winapi/src/urlmon.rs create mode 100644 third_party/rust/winapi/src/usb.rs create mode 100644 third_party/rust/winapi/src/usbspec.rs create mode 100644 third_party/rust/winapi/src/usp10.rs create mode 100644 third_party/rust/winapi/src/vadefs.rs create mode 100644 third_party/rust/winapi/src/vsbackup.rs create mode 100644 third_party/rust/winapi/src/vss.rs create mode 100644 third_party/rust/winapi/src/vsserror.rs create mode 100644 third_party/rust/winapi/src/vswriter.rs create mode 100644 third_party/rust/winapi/src/werapi.rs create mode 100644 third_party/rust/winapi/src/winbase.rs create mode 100644 third_party/rust/winapi/src/wincon.rs create mode 100644 third_party/rust/winapi/src/wincred.rs create mode 100644 third_party/rust/winapi/src/wincrypt.rs create mode 100644 third_party/rust/winapi/src/windef.rs create mode 100644 third_party/rust/winapi/src/windowscodecs.rs create mode 100644 third_party/rust/winapi/src/windowsx.rs create mode 100644 third_party/rust/winapi/src/winerror.rs create mode 100644 third_party/rust/winapi/src/winevt.rs create mode 100644 third_party/rust/winapi/src/wingdi.rs create mode 100644 third_party/rust/winapi/src/winhttp.rs create mode 100644 third_party/rust/winapi/src/winioctl.rs create mode 100644 third_party/rust/winapi/src/winnetwk.rs create mode 100644 third_party/rust/winapi/src/winnls.rs create mode 100644 third_party/rust/winapi/src/winnt.rs create mode 100644 third_party/rust/winapi/src/winreg.rs create mode 100644 third_party/rust/winapi/src/winscard.rs create mode 100644 third_party/rust/winapi/src/winsmcrd.rs create mode 100644 third_party/rust/winapi/src/winsock2.rs create mode 100644 third_party/rust/winapi/src/winspool.rs create mode 100644 third_party/rust/winapi/src/winstring.rs create mode 100644 third_party/rust/winapi/src/winsvc.rs create mode 100644 third_party/rust/winapi/src/winusb.rs create mode 100644 third_party/rust/winapi/src/winusbio.rs create mode 100644 third_party/rust/winapi/src/winuser.rs create mode 100644 third_party/rust/winapi/src/ws2def.rs create mode 100644 third_party/rust/winapi/src/ws2ipdef.rs create mode 100644 third_party/rust/winapi/src/ws2spi.rs create mode 100644 third_party/rust/winapi/src/ws2tcpip.rs create mode 100644 third_party/rust/winapi/src/wtypes.rs create mode 100644 third_party/rust/winapi/src/wtypesbase.rs create mode 100644 third_party/rust/winapi/src/xinput.rs create mode 100644 third_party/rust/x11/.cargo-checksum.json create mode 100644 third_party/rust/x11/.cargo-ok create mode 100644 third_party/rust/x11/Cargo.toml create mode 100644 third_party/rust/x11/build.rs create mode 100644 third_party/rust/x11/examples/hello-world.rs create mode 100644 third_party/rust/x11/examples/input.rs create mode 100644 third_party/rust/x11/examples/xrecord.rs create mode 100644 third_party/rust/x11/src/dpms.rs create mode 100644 third_party/rust/x11/src/glx.rs create mode 100644 third_party/rust/x11/src/internal.rs create mode 100644 third_party/rust/x11/src/keysym.rs create mode 100644 third_party/rust/x11/src/lib.rs create mode 100644 third_party/rust/x11/src/link.rs create mode 100644 third_party/rust/x11/src/xcursor.rs create mode 100644 third_party/rust/x11/src/xf86vmode.rs create mode 100644 third_party/rust/x11/src/xfixes.rs create mode 100644 third_party/rust/x11/src/xft.rs create mode 100644 third_party/rust/x11/src/xinerama.rs create mode 100644 third_party/rust/x11/src/xinput.rs create mode 100644 third_party/rust/x11/src/xinput2.rs create mode 100644 third_party/rust/x11/src/xlib.rs create mode 100644 third_party/rust/x11/src/xlib_xcb.rs create mode 100644 third_party/rust/x11/src/xmd.rs create mode 100644 third_party/rust/x11/src/xmu.rs create mode 100644 third_party/rust/x11/src/xrandr.rs create mode 100644 third_party/rust/x11/src/xrecord.rs create mode 100644 third_party/rust/x11/src/xrender.rs create mode 100644 third_party/rust/x11/src/xss.rs create mode 100644 third_party/rust/x11/src/xt.rs create mode 100644 third_party/rust/x11/src/xtest.rs create mode 100644 third_party/rust/xml-rs/.cargo-checksum.json create mode 100644 third_party/rust/xml-rs/.cargo-ok create mode 100644 third_party/rust/xml-rs/.gitignore create mode 100644 third_party/rust/xml-rs/.travis.yml create mode 100644 third_party/rust/xml-rs/Cargo.toml create mode 100644 third_party/rust/xml-rs/Changelog.md create mode 100644 third_party/rust/xml-rs/LICENSE create mode 100644 third_party/rust/xml-rs/Readme.md create mode 100644 third_party/rust/xml-rs/design.md create mode 100644 third_party/rust/xml-rs/src/analyze.rs create mode 100644 third_party/rust/xml-rs/src/attribute.rs create mode 100644 third_party/rust/xml-rs/src/common.rs create mode 100644 third_party/rust/xml-rs/src/escape.rs create mode 100644 third_party/rust/xml-rs/src/lib.rs create mode 100644 third_party/rust/xml-rs/src/macros.rs create mode 100644 third_party/rust/xml-rs/src/name.rs create mode 100644 third_party/rust/xml-rs/src/namespace.rs create mode 100644 third_party/rust/xml-rs/src/reader/config.rs create mode 100644 third_party/rust/xml-rs/src/reader/error.rs create mode 100644 third_party/rust/xml-rs/src/reader/events.rs create mode 100644 third_party/rust/xml-rs/src/reader/lexer.rs create mode 100644 third_party/rust/xml-rs/src/reader/mod.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_cdata.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_closing_tag_name.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_comment.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_declaration.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_doctype.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_opening_tag.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_processing_instruction.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/inside_reference.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/mod.rs create mode 100644 third_party/rust/xml-rs/src/reader/parser/outside_tag.rs create mode 100644 third_party/rust/xml-rs/src/util.rs create mode 100644 third_party/rust/xml-rs/src/writer/config.rs create mode 100644 third_party/rust/xml-rs/src/writer/emitter.rs create mode 100644 third_party/rust/xml-rs/src/writer/events.rs create mode 100644 third_party/rust/xml-rs/src/writer/mod.rs create mode 100644 third_party/rust/xml-rs/tests/documents/sample_1.xml create mode 100644 third_party/rust/xml-rs/tests/documents/sample_1_full.txt create mode 100644 third_party/rust/xml-rs/tests/documents/sample_1_short.txt create mode 100644 third_party/rust/xml-rs/tests/documents/sample_2.xml create mode 100644 third_party/rust/xml-rs/tests/documents/sample_2_full.txt create mode 100644 third_party/rust/xml-rs/tests/documents/sample_2_short.txt create mode 100644 third_party/rust/xml-rs/tests/documents/sample_3.xml create mode 100644 third_party/rust/xml-rs/tests/documents/sample_3_full.txt create mode 100644 third_party/rust/xml-rs/tests/documents/sample_3_short.txt create mode 100644 third_party/rust/xml-rs/tests/documents/sample_4.xml create mode 100644 third_party/rust/xml-rs/tests/documents/sample_4_full.txt create mode 100644 third_party/rust/xml-rs/tests/documents/sample_4_short.txt create mode 100644 third_party/rust/xml-rs/tests/event_reader.rs create mode 100644 third_party/rust/xml-rs/tests/event_writer.rs diff --git a/third_party/rust/app_units/.cargo-checksum.json b/third_party/rust/app_units/.cargo-checksum.json new file mode 100644 index 000000000000..a6d8c203c1eb --- /dev/null +++ b/third_party/rust/app_units/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"12cc0f91b51fedf41ae1670d1624ee1d78a284bdb101645b60a06a12de16c069",".travis.yml":"6b96b2c6bfd7e1acef4b825a2813fc4277859eb9400a16800db8835c25e4087d","Cargo.toml":"789b93a48ce76901375209d5462408469c31809e09a98e71370c57187a4b0923","README.md":"9f048d969f9f8333cdcdb892744cd0816e4f2922c8817fa5e9e07f9472fe1050","src/app_unit.rs":"71b0ac2fa378427883649def1a03008ac9d4eb45addd084b7d9885867049551e","src/lib.rs":"2df7d863c47d8b22f9af66caeafa87e6a206ee713a8aeaa55c5a80a42a92513b"},"package":"636ee56f12e31dbc11dc0a1ac6004f08b04e6e6595963716fc8130e90d4e04cf"} \ No newline at end of file diff --git a/third_party/rust/app_units/.cargo-ok b/third_party/rust/app_units/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/app_units/.gitignore b/third_party/rust/app_units/.gitignore new file mode 100644 index 000000000000..2c96eb1b6517 --- /dev/null +++ b/third_party/rust/app_units/.gitignore @@ -0,0 +1,2 @@ +target/ +Cargo.lock diff --git a/third_party/rust/app_units/.travis.yml b/third_party/rust/app_units/.travis.yml new file mode 100644 index 000000000000..a9df73baa47a --- /dev/null +++ b/third_party/rust/app_units/.travis.yml @@ -0,0 +1,8 @@ +language: rust +notifications: + webhooks: http://build.servo.org:54856/travis + +rust: + - stable + - beta + - nightly diff --git a/third_party/rust/app_units/Cargo.toml b/third_party/rust/app_units/Cargo.toml new file mode 100644 index 000000000000..0d8362b61189 --- /dev/null +++ b/third_party/rust/app_units/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "app_units" +version = "0.3.0" +authors = ["The Servo Project Developers"] +description = "Servo app units type (Au)" +documentation = "http://doc.servo.org/app_units/" +repository = "https://github.com/servo/app_units" +license = "MPL-2.0" + +[features] +default = [] +plugins = [] + +[dependencies] +heapsize = "0.3" +num-traits = "0.1.32" +rustc-serialize = "0.3" +serde = "0.8" diff --git a/third_party/rust/app_units/README.md b/third_party/rust/app_units/README.md new file mode 100644 index 000000000000..fab29a33d721 --- /dev/null +++ b/third_party/rust/app_units/README.md @@ -0,0 +1,3 @@ +# app-units + +[Documentation](http://doc.servo.org/app_units/index.html) diff --git a/third_party/rust/app_units/src/app_unit.rs b/third_party/rust/app_units/src/app_unit.rs new file mode 100644 index 000000000000..1679841c44cc --- /dev/null +++ b/third_party/rust/app_units/src/app_unit.rs @@ -0,0 +1,315 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use heapsize::HeapSizeOf; +use num_traits::Zero; +use rustc_serialize::{Encodable, Encoder}; +use serde::de::{Deserialize, Deserializer}; +use serde::ser::{Serialize, Serializer}; +use std::default::Default; +use std::fmt; +use std::i32; +use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, Sub, SubAssign}; + +/// The number of app units in a pixel. +pub const AU_PER_PX: i32 = 60; + +#[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Eq, Ord)] +pub struct Au(pub i32); + +impl HeapSizeOf for Au { + fn heap_size_of_children(&self) -> usize { 0 } +} + +impl Deserialize for Au { + fn deserialize(deserializer: &mut D) -> Result { + Ok(Au(try!(i32::deserialize(deserializer)))) + } +} + +impl Serialize for Au { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> { + self.0.serialize(serializer) + } +} + +impl Default for Au { + #[inline] + fn default() -> Au { + Au(0) + } +} + +impl Zero for Au { + #[inline] + fn zero() -> Au { + Au(0) + } + + #[inline] + fn is_zero(&self) -> bool { + self.0 == 0 + } +} + +pub const MIN_AU: Au = Au(i32::MIN); +pub const MAX_AU: Au = Au(i32::MAX); + +impl Encodable for Au { + fn encode(&self, e: &mut S) -> Result<(), S::Error> { + e.emit_f64(self.to_f64_px()) + } +} + +impl fmt::Debug for Au { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}px", self.to_f64_px()) + } +} + +impl Add for Au { + type Output = Au; + + #[inline] + fn add(self, other: Au) -> Au { + Au(self.0.wrapping_add(other.0)) + } +} + +impl Sub for Au { + type Output = Au; + + #[inline] + fn sub(self, other: Au) -> Au { + Au(self.0.wrapping_sub(other.0)) + } + +} + +impl Mul for Au { + type Output = Au; + + #[inline] + fn mul(self, other: i32) -> Au { + Au(self.0.wrapping_mul(other)) + } +} + +impl Div for Au { + type Output = Au; + + #[inline] + fn div(self, other: i32) -> Au { + Au(self.0 / other) + } +} + +impl Rem for Au { + type Output = Au; + + #[inline] + fn rem(self, other: i32) -> Au { + Au(self.0 % other) + } +} + +impl Neg for Au { + type Output = Au; + + #[inline] + fn neg(self) -> Au { + Au(-self.0) + } +} + +impl AddAssign for Au { + #[inline] + fn add_assign(&mut self, other: Au) { + *self = *self + other; + } +} + +impl SubAssign for Au { + #[inline] + fn sub_assign(&mut self, other: Au) { + *self = *self - other; + } +} + +impl MulAssign for Au { + #[inline] + fn mul_assign(&mut self, other: i32) { + *self = *self * other; + } +} + +impl DivAssign for Au { + #[inline] + fn div_assign(&mut self, other: i32) { + *self = *self / other; + } +} + +impl Au { + /// FIXME(pcwalton): Workaround for lack of cross crate inlining of newtype structs! + #[inline] + pub fn new(value: i32) -> Au { + Au(value) + } + + #[inline] + pub fn scale_by(self, factor: f32) -> Au { + Au(((self.0 as f32) * factor) as i32) + } + + #[inline] + pub fn from_px(px: i32) -> Au { + Au((px * AU_PER_PX) as i32) + } + + /// Rounds this app unit down to the pixel towards zero and returns it. + #[inline] + pub fn to_px(self) -> i32 { + self.0 / AU_PER_PX + } + + /// Ceil this app unit to the appropriate pixel boundary and return it. + #[inline] + pub fn ceil_to_px(self) -> i32 { + ((self.0 as f64) / (AU_PER_PX as f64)).ceil() as i32 + } + + #[inline] + pub fn to_nearest_px(self) -> i32 { + ((self.0 as f64) / (AU_PER_PX as f64)).round() as i32 + } + + #[inline] + pub fn to_nearest_pixel(self, pixels_per_px: f32) -> f32 { + ((self.0 as f32) / (AU_PER_PX as f32) * pixels_per_px).round() / pixels_per_px + } + + #[inline] + pub fn to_f32_px(self) -> f32 { + (self.0 as f32) / (AU_PER_PX as f32) + } + + #[inline] + pub fn to_f64_px(self) -> f64 { + (self.0 as f64) / (AU_PER_PX as f64) + } + + #[inline] + pub fn from_f32_px(px: f32) -> Au { + Au((px * (AU_PER_PX as f32)) as i32) + } + + #[inline] + pub fn from_f64_px(px: f64) -> Au { + Au((px * (AU_PER_PX as f64)) as i32) + } +} + +#[test] +fn create() { + assert_eq!(Au::zero(), Au(0)); + assert_eq!(Au::default(), Au(0)); + assert_eq!(Au::new(7), Au(7)); +} + +#[test] +fn operations() { + assert_eq!(Au(7) + Au(5), Au(12)); + assert_eq!(MAX_AU + Au(1), MIN_AU); + + assert_eq!(Au(7) - Au(5), Au(2)); + assert_eq!(MIN_AU - Au(1), MAX_AU); + + assert_eq!(Au(7) * 5, Au(35)); + assert_eq!(MAX_AU * -1, MIN_AU + Au(1)); + assert_eq!(MIN_AU * -1, MIN_AU); + + assert_eq!(Au(35) / 5, Au(7)); + assert_eq!(Au(35) % 6, Au(5)); + + assert_eq!(-Au(7), Au(-7)); +} + +#[test] +#[should_panic] +fn overflowing_div() { + MIN_AU / -1; +} + +#[test] +#[should_panic] +fn overflowing_rem() { + MIN_AU % -1; +} + +#[test] +fn scale() { + assert_eq!(Au(12).scale_by(1.5), Au(18)); +} + +#[test] +fn convert() { + assert_eq!(Au::from_px(5), Au(300)); + + assert_eq!(Au(300).to_px(), 5); + assert_eq!(Au(330).to_px(), 5); + assert_eq!(Au(350).to_px(), 5); + assert_eq!(Au(360).to_px(), 6); + + assert_eq!(Au(300).ceil_to_px(), 5); + assert_eq!(Au(310).ceil_to_px(), 6); + assert_eq!(Au(330).ceil_to_px(), 6); + assert_eq!(Au(350).ceil_to_px(), 6); + assert_eq!(Au(360).ceil_to_px(), 6); + + assert_eq!(Au(300).to_nearest_px(), 5); + assert_eq!(Au(310).to_nearest_px(), 5); + assert_eq!(Au(330).to_nearest_px(), 6); + assert_eq!(Au(350).to_nearest_px(), 6); + assert_eq!(Au(360).to_nearest_px(), 6); + + assert_eq!(Au(60).to_nearest_pixel(2.), 1.); + assert_eq!(Au(70).to_nearest_pixel(2.), 1.); + assert_eq!(Au(80).to_nearest_pixel(2.), 1.5); + assert_eq!(Au(90).to_nearest_pixel(2.), 1.5); + assert_eq!(Au(100).to_nearest_pixel(2.), 1.5); + assert_eq!(Au(110).to_nearest_pixel(2.), 2.); + assert_eq!(Au(120).to_nearest_pixel(2.), 2.); + + assert_eq!(Au(300).to_f32_px(), 5.); + assert_eq!(Au(312).to_f32_px(), 5.2); + assert_eq!(Au(330).to_f32_px(), 5.5); + assert_eq!(Au(348).to_f32_px(), 5.8); + assert_eq!(Au(360).to_f32_px(), 6.); + + assert_eq!(Au(300).to_f64_px(), 5.); + assert_eq!(Au(312).to_f64_px(), 5.2); + assert_eq!(Au(330).to_f64_px(), 5.5); + assert_eq!(Au(348).to_f64_px(), 5.8); + assert_eq!(Au(360).to_f64_px(), 6.); + + assert_eq!(Au::from_f32_px(5.), Au(300)); + assert_eq!(Au::from_f32_px(5.2), Au(312)); + assert_eq!(Au::from_f32_px(5.5), Au(330)); + assert_eq!(Au::from_f32_px(5.8), Au(348)); + assert_eq!(Au::from_f32_px(6.), Au(360)); + + assert_eq!(Au::from_f64_px(5.), Au(300)); + assert_eq!(Au::from_f64_px(5.2), Au(312)); + assert_eq!(Au::from_f64_px(5.5), Au(330)); + assert_eq!(Au::from_f64_px(5.8), Au(348)); + assert_eq!(Au::from_f64_px(6.), Au(360)); +} + +#[test] +fn heapsize() { + use heapsize::HeapSizeOf; + fn f(_: T) {} + f(Au::new(0)); +} diff --git a/third_party/rust/app_units/src/lib.rs b/third_party/rust/app_units/src/lib.rs new file mode 100644 index 000000000000..359b85cd75d2 --- /dev/null +++ b/third_party/rust/app_units/src/lib.rs @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! An Au is an "App Unit" and represents 1/60th of a CSS pixel. It was +//! originally proposed in 2002 as a standard unit of measure in Gecko. +//! See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info. + +extern crate heapsize; +extern crate num_traits; +extern crate rustc_serialize; +extern crate serde; + +mod app_unit; + +pub use app_unit::{Au, MIN_AU, MAX_AU, AU_PER_PX}; diff --git a/third_party/rust/bincode/.cargo-checksum.json b/third_party/rust/bincode/.cargo-checksum.json new file mode 100644 index 000000000000..e869625e964a --- /dev/null +++ b/third_party/rust/bincode/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"e084df3ce631ce22082bd63f9e421e7f4d7a2408d6520de532f6a649e4d320dd",".travis.yml":"cb3f687453522852cb74371892a77d5e6eb61d771b8ef27f6cc6628e556de3d6","Cargo.toml":"d631ecb2eef5a18307a68e795080ed073851c9bea0800405cad98642ed3cc053","LICENSE.md":"90d7e062634054e6866d3c81e6a2b3058a840e6af733e98e80bdfe1a7dec6912","examples/basic.rs":"cdf97f2c4facbc202bf9e1496030d09bef3b7cd5538407325a38f0fe2e49415e","logo.png":"ebc5305aae938c1f834cf35302faa8be0f1b7b8c3c3beef5cf6b2f68b9628c35","readme.dev.md":"43bad3bcc13a5c057344d3ba7f64bd2b313f8c133d6afa068108df73e8e8facd","readme.md":"1fe1bda36327400cfedfcf103d58091c8465067b62706b0a368d287ca0312cd9","src/lib.rs":"1a85a12afad0b6150b8dbede093d19f4a32a3cd6976ee018a625fbc05051bf80","src/refbox.rs":"f0470baabbf0f9852df939c2535865793dc31c9d9d35eecf9c237a9df431a9fc","src/rustc_serialize/mod.rs":"188f5ff7fc9c5e0ac1404b919ceafac5ce4385950d22ae470ddc1775d2a0643b","src/rustc_serialize/reader.rs":"7983c37556fdef552bfeba386d557863fb5113c8fada55d4cf6a605f13214253","src/rustc_serialize/writer.rs":"684844799673fce3c54f1aca42430b6730da13473d732ee2954ebc56994ebd95","src/serde/mod.rs":"7818bbe5c320af2a15762c421d5471865a7364e1c9754c57960402fdcf09c595","src/serde/reader.rs":"1f88a55923dfc3ad82ec32571c9c7ca42818d996897966dea08a595f804d117f","src/serde/writer.rs":"d987134b3a00eb17a25e601757ad20607dd1de8989452266e9e4e7955fcd87f1","tests/test.rs":"b72a5902be11c3210dd56814276ff036155eba10d5f0aa566c86e7a1ce463adf"},"package":"55eb0b7fd108527b0c77860f75eca70214e11a8b4c6ef05148c54c05a25d48ad"} \ No newline at end of file diff --git a/third_party/rust/bincode/.cargo-ok b/third_party/rust/bincode/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/bincode/.gitignore b/third_party/rust/bincode/.gitignore new file mode 100644 index 000000000000..9208baf5b752 --- /dev/null +++ b/third_party/rust/bincode/.gitignore @@ -0,0 +1,5 @@ +/target +/Cargo.lock +*.swp +*.swo +.cargo diff --git a/third_party/rust/bincode/.travis.yml b/third_party/rust/bincode/.travis.yml new file mode 100644 index 000000000000..23b588ed4a3a --- /dev/null +++ b/third_party/rust/bincode/.travis.yml @@ -0,0 +1,29 @@ +lang: c +after_success: | + [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + cargo doc && + echo "" > target/doc/index.html && + sudo pip install ghp-import && + ghp-import -n target/doc && + git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages + +env: + matrix: + - CHANNEL='stable' + - CHANNEL='beta' + - CHANNEL='nightly' + global: + - secure: SZSxNqg9wiGx8EnJhifJ2kb/aCRcLim9TzTQyfurPqd8qVGkDOeVjTtbs+VTxLVXYtMJAz+YYnrQDwsu8kc/uYpQajU+gRMqNGEP5gNj3Ha5iNGDasAS6piIHQSMROayZ+D9g22nlGnjk8t9eZtLHC/Z8IWMCnjcIHvqMFY6cgI= + +install: + - curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh > ./rustup.sh + - chmod +x ./rustup.sh + - ./rustup.sh --yes + +script: + - multirust default $CHANNEL + - cargo build + - cargo build --no-default-features --features "rustc-serialize" + - cargo build --no-default-features --features "serde" + - if [ $CHANNEL = 'nightly' ] ; then cargo test ; fi diff --git a/third_party/rust/bincode/Cargo.toml b/third_party/rust/bincode/Cargo.toml new file mode 100644 index 000000000000..3b8bdb3f89ed --- /dev/null +++ b/third_party/rust/bincode/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "bincode" +version = "0.6.1" +authors = ["Ty Overby ", "Francesco Mazzoli "] + +repository = "https://github.com/TyOverby/bincode" +documentation = "http://tyoverby.github.io/bincode/bincode/" +keywords = ["binary", "encode", "decode", "serialize", "deserialize"] + +license = "MIT" +description = "A binary serialization / deserialization strategy and implementation with serde and rustc-serialize backends." + +[dependencies] +byteorder = "1.0.0" +num-traits = "0.1.32" + +[dependencies.rustc-serialize] +version = "0.3.*" +optional = true + +[dependencies.serde] +version = "0.8.*" +optional = true + +[dev-dependencies] +serde_derive = "0.8.*" + +[features] +default = ["rustc-serialize", "serde"] diff --git a/third_party/rust/bincode/LICENSE.md b/third_party/rust/bincode/LICENSE.md new file mode 100644 index 000000000000..26b1f00a2797 --- /dev/null +++ b/third_party/rust/bincode/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ty Overby + +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. diff --git a/third_party/rust/bincode/examples/basic.rs b/third_party/rust/bincode/examples/basic.rs new file mode 100644 index 000000000000..670f6bc0aafb --- /dev/null +++ b/third_party/rust/bincode/examples/basic.rs @@ -0,0 +1,31 @@ +extern crate bincode; +extern crate rustc_serialize; + +use bincode::SizeLimit; +use bincode::rustc_serialize::{encode, decode}; + +#[derive(RustcEncodable, RustcDecodable, PartialEq)] +struct Entity { + x: f32, + y: f32, +} + +#[derive(RustcEncodable, RustcDecodable, PartialEq)] +struct World { + entities: Vec +} + +fn main() { + let world = World { + entities: vec![Entity {x: 0.0, y: 4.0}, Entity {x: 10.0, y: 20.5}] + }; + + let encoded: Vec = encode(&world, SizeLimit::Infinite).unwrap(); + + // 8 bytes for the length of the vector, 4 bytes per float. + assert_eq!(encoded.len(), 8 + 4 * 4); + + let decoded: World = decode(&encoded[..]).unwrap(); + + assert!(world == decoded); +} diff --git a/third_party/rust/bincode/logo.png b/third_party/rust/bincode/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b2c454d1f2103b1a9279c9c6acc6e6a23bb7b76d GIT binary patch literal 258333 zcmeF41z=tE^~cY1e{q*4X-lCLXo2Dkch|v&4gU`tj1Aa;4c&l^4H?5-=4``;`>^<*zwbHcd%owUBM(2o=Pq}Pi0_~S_dQy~ zv^PJ$@3iy(2l`s?;vf6zha9l4Wc1I&uRe7LpSXT>;E6vL@f7G^liYiMDIYp6J?OCg z9E;64g>~CraoqP$6RDAd_TB5)%T3aLZP8Vx%)lZhlZmz0ys+w!)?4#l2LE<6_dWO# z2R{9#j=QFF%6^v}f$Ruu*by)f&k$scv(s%xdKro#9_eH1{zl_kM&mrQ`^=6&b_7Om z1PnwtuzNLbYet1bGn#AP&*)uFcF)-n$c{jE1cpBXX5C}}6{!)#&t3uTt@yL9H#F3? zW@D=R$u8Lu$c{jE1U9A-Fbv_q2@N1QHFnDk;Lr@;#&kK^bIFcCb_B8`F#HktDn__M z*zfBGaD^|8W32l7@DH5bB0B=v5y+0f#xertrF=-Q{lc%I@zn1i7(X)c@9b zoO()G-ZC!0|JIdfuQodZqcH-w$txqh!42G(>#W9bE;p>BafaD_W=9}90@)E5yU&h5b_B8`umMNFjOAN?xWUojmtQYWsH}`2mv5Z?Av*%u z5y+0fT1H@vHfAl`uK0C2onD^cUGejE{domW;mW(v6CMqhSIy{Grg!CIW`E0$Kz0PO zBk)a(zzS5F6%RkS5nNwuo=TV8f2UN2yd@VgAr}m|ZhF0@)GBj=%;QfiDf=ifC}fpT9bbwQ&qzd-E;1_L^&?s&2eQ!y(DU zV`6tYWyc-%lnIk2OHa68y4%~u<8w$J2C}HQP@HbB^z{U!ysA{H%1b3bFIU3huy|c= zar-=CF`LA0vwd|EBluG+ku&9mWSg;LSeDmEYjB6CXrZ7ii!#)8jVR+ zMTHa;;!-ItD;4D)VhyFW zeyN1Jy2R!6Nfd)+wYnsyC|Al$i^Q5pi!awBKH3^MU0(U%mAt%s$?^Eb@3I-_x3H){Hmj|XR3a*|SW+5W+N7<& zM=b2am9dI9$0@lO`10}!gSZ~U&`$ekn#`ItQ+C>Ms{HiwE5vH~a&8*Rpl8>~jzD$< zMtlTTTX8bnBOP|c5fZmz6t>(^;z^7GhM^!oU;H_K@qw!P+PkHrqf1QjxcD)6R)-b$ zIV4Gpmeb>u-qu#}dt4Zt4ryp>liY#=F=vtz#CY254za>(Oklt5ZVV|Wm&}+XjiK^5 z-O|z0Bn6?ot+@M63NN+$)dS)#p`iMB9RiC%Oeh_OXATmD6dG`J6go<@fv)| zuI>(Tfn@b>8q^qz#W`+JD$2)5I2w`;&MmjFRBTqWc-XJ*!|HHIZ+B2)gaG1^pg62n z3~W%`ey`YF4k;)sk^;X+Y&NG@Y%a-Tdq3x8vs$F5uTT2>`(@VKFUX%BdjzBI8t!ms z*Uyf?COra;jSceq-`^@_m1-mM<yM@xfJhW+Md?OJtgPh_Si}*`wl*}VVWpz@u z3kV9gG#Utk4g(U21~7(BiDBr>7PDbw67eJk1h*E0vT)uU*>Tt1BovEEJ4VaQCDm0` z%RUF$B+hzvyG6n#s%XR_`5rg_&qyedkWW9KAxX1Y9Jud#JPNWU(A_4bMa9yIK{Z+3 z9K#_MecciX#>7V5qX{oLB{5w5d?~CpNd%N>w^;>qhjlhfh-3E$x-q;KX=-nf;?jH& zYo#=|_egudETv=0q&JokivxWvXC4M!$3MGdM_|K_K!#^I5{*btPmg>yW4g4qweVhM zq@=h^cG-D1ar183MmR(jj)mpJPv4U#AASN)u1z-Ie3ERn&Gyn9Yml4&a0Bm7~#q%p)c&}*E{^sgQX+t1Q8WT-NdaWl}_QJ zW^h66(xZmKWS4X(A#RUV%BssTY<7%e3|G|-GINO+7u8O(r7s8?iv`3FqKftPOC}t} zzNDBnawW|^1$3CeMNWYRbKHLE=x&$Z&MwK=aB2B034$|&GOMb`N*V;0W>7-?A#r&; z7$}e%u5l)TQFHik*<%vHfU8>`>g|ov}`hMSWB$)&6* z@ptvpiWP$!=3L`un?z$Fi4pg-nA0Fxk^IsUuG7svO)_il4C!xa zkx);U^fb?sr=R}2OdL0M<)P00mK}jrMqs!v_9~mN^y}=|U&v#RJSwvn&6X%}{XX6^ zC!wBW&fH%XELgDNp?S3E6SGsj~mR2gsJ= zw_=9_1eT~ofF?kuN!xp7@^JP7B6Vg>cvPAkBszm8u!M= zeiG@plvI>R&A4%r28nt}^0-TKC7NbWfWJI%E_)ZLt*#>e7{)ygNjY)LKsYI>OhSTz zF0nA91;as!q(usGljD66uGuQNIV599E~PUm-1TfCW{A(~w{o>4llN<{y(XW1_L-ED zJS-!gZ6$mX;raOFlg}j(U}EQ0`Sq`UJtEit(b}mcFTLuej>LYb(dUn@uhP7F~{-F^5Cz-a^sCRNX#0OC+~j(4=4dB zaxAws>IDLYct1_D+oZi^mq~kq<}C8g$FIu`S6wep|LgB^+wbmNhocT}lM#y%-g@gT za_>Wbk+RJuOJ(hN<1Avhzxu*EywTBit$UO7+|YSY<|0h zx-mu=5SQ04wYax{Tqy%lWr!EXKxrw9Lmb5W`g*(h&TM3yBjGqm(H?#Xg0+p+#dib1~^|cpIgPo zgW}NmA&An75p?HxBm$!Jat=vQpoN)4Clh^GHTh$=b8gXIvhd>kl)R>-6+0Vj~svO(NZi`1aqty#YOVj`!n#`dL>~7 zq<{=_@;p*FzF2lE*+ssn|5UEJ{1-B&bb?%Q#g(ALl3|_4AMU(e7BwuA-`@256}HRB z%-MKG{Xyx%HMatcQc1kAl2X}n;$~vEdX07a6MgdAn{SqP-+E78{Ljn0pX+9bS2*x$ ze_S^we30GEoH+~XjEh7?nWRWISTF@SPA{~X9LXyw5r@wycH(<>;)63j{zQ_@LUt#J zslOMOml=szoH=F_pTh-WG~u4Q#gBoAl9&jQ@lArB0E?0d1`Hz?=nF^=?sAA^iXV5} zY&R4CBLPF=0*DAgi(oj3;eqVZ7^yhtlmI2VEOzN7si8Ab#%&c3NskWDTiV2&q?u>j z@C-=P;qVZ%u=2-Z#7g>uy&NZ30zJ6UTt@^Wj^iyZ3||HpJB1tE4=Qw-18i^M=P=iX z%Ry{2gUj8)gBFV>Bo<2Yut62_r=)#x4CENt7!6^djM)-3;d;Z^zg(@*8<>n@kW_T5`J5nZpFI~VE{GwIlHe>bSwBwZbBM|L8XiW}C^?Z)3EgAp?bf-Zt~N%o6%1b&+E zh2sPboo>$0;xZz}WrgJuAV}zD-+^GC5hq9_a}2@*>^Y-H+=PA zXAcn2Wu&Fk1R8xljs;9~0b6ZutUkP%?&fyGo<;~z3RX49zZQJ|5J5zz!!P+IWM;Yv zaQ16F!OGQSm;dDvNb+p?^ZZh7#~s2)RJSKriljciP+VBUB3B`?72+(!o7QE~K>Ni% zzCh}Btdc`_IS`*TE(?3-$j{HeK@QpbaJm2PN4~b((@#EKKK$ry`QZ;Q0+od2xWf*X z!;d~z%u%=8dB^YN=U4vXYul{)L6mIiJ@?%ux8Hsj*E9g_X3w1|=bU@4-1Mto$<90N zw(2Hw$W<3#MF8?skTeKqCih%9rW)gxmS8YSde$Tz&CSw8 zcELxYBof8mIrtnu*-p?csHt4_hwW)8CGDI{5_RPP(R5cw7t<%k(Cf~{_?a<=z*GmB z5>uKWpABP&4^ZfnWXvIH45bS=+Y`jF0U7ONWYT0lEF9B9>e!#}G0r8~7m^SUQZv~Z zTUWpMFs2|&;ABSpz+WqKng$d}ZUX~_Oil*|o}gyDA4nR7lS42u9u*f4x|@Oxbo4lYiH+ z{Zt**JMR3Qluyo;OHV$J-*TiW^o2Zd*OPMTg_lzavFmCFeut^M%j1tfB&Yx2ES_$& z9CO%Fa`0gX$pQNuEhl~dBpFjXcD38;7r(yoI@x#MeT*|=n2NVyYIpK%1t-iD8Ik$zCpKJ-w*L3M`qDXL57#U zg!;Q&UVI+}J1ahAMMaeni0kTTlNd%NjPFZ6L>gL`VjwfDV<7+-l-}Nc0tkJO?V&dk{u4u^Dsth(_*KmO<=nX#Z=8oK*r&b&nip|BT}6~=c? z5v(&4#Y<|S5zc^%b4lVer|`MsaD0OJ+i64?Q}Gmria=p+AHmJA^!4|V?TAQ6Tc31e z`08PAhoj7)!3crGxXhbBPa5hM67=hk#Y+}S!_p>cZ|{<&P4)802k*7{P&& zz`MvmawS^`AwkNj3ZQ&tq#~zAc9^=$TKBj4 zgl(WX{7de;>j4Srgii2#uLE|IKmX;gYut9>!UgidCm+eN$DFu)y+7W4kL`>1KKK&Zp&1_x+Vud}!}@2^o#4 z+wCBC-SdE4cEP2x<9<8KW4Hd9=YI91ll$+xSAKTmRlFwy$pZx)Z@lrQ+$IBM)5 z9J&gvMhQwZ(j_6jGr@rV+wCt&uVyRQzXjuDBePlK~-Y2r!gZTxJI;;JyekJ=|dzWgWTjYeH~a@`%@U_qH2ZpT6b}XYEqI8Alu`{nmg4)BW=DGq1_it#-f@8BS@F zNp{*{XL;bMhea-k$kbgX%kO@6Cth4H@6lixoQ&ad6^_prjtc)QDBa;cDh?bnrgF@X zu0UCRu}nxxtBdg>GZM&zrL7lw38BWoD20-~ZV10TRdp?gx+FnBz1=-X&lE`^MlOe# zM*?JZ{pGjGvEMsQjy!NT3U*f>{B5VKK2EUWaYGoD2yUg;sO3?^r<@oQF89Cw{esl@ zC1ieMhrIpQdt{5LQzaI$NH1|Wm)|KJp&rS^ETnhMu%rVdD@a~Y^A;p=(#@cjSC&x> z4e2qQMtxzSlvdSB0(9zvz?dPyGOlcQT;RnLXWrI9uCeUqhSR~hq7|x;`%5j`hQC(vg#1*eM z`}6U`0ZeKXeR#`U5)+G_JN8bI0WLuK7I1U?aN0=7 zD4Th~#|!219}b_aXeHimAqF4DWsj%A22fIR0M~RfXTBEqyGaTd#HyPIqMnicsB^3GA)Ktm? zcRV8JUv`7!lP_4+AP%yN)qdo`HPyd`xZEo)M;(3;f##(A`|~E5|G`USc+15Rgvkl| z3*tT};p=FDbB@_g0*2%ZXtx&vp_kvi@Md~D`lMZ5VM;_6fATW1Ju=yl64k(~>+ARX zWWt2;QkLVB@-1q};^oMah6b6i&DP??(B@Eb;)bPNff|G{oAChXjJ%|wNt$q*-~R6h z($mr_P1E1w`?ypwE33PbNkt^kmK2}OD+!WCAvi$U<$rVp@KonCEEEfI<$+~o*HwwK zaUzB(bBMV1@L2f`#Ma6-Dq|wcD)E7poY;6=$d6?KThPg#r-Qjyq45Yc4rQ_B!l%Vrw0;=Qi68Z%4ye+sBM^ z(9|*V3h|VNC5vP+MriBpcA_MOvJ#XNI$&}tt2?UY9iX_Lo^IlUK1q=+4kp6H60Jr+ z*i6=Y-#zvu#ee-Ujz0LR%LoFO{a9pSeS`ev>1XAshwcH9_M%LIu_k_LCDYx{!yk$E zV;fg~_y^x>_S0|c2-xr#;xHk;UhtKczH~sk2pe^GH8c4RR4@!>9F*pzEhbOA>S#P9 z!cvZW!bwYHzukr(XVb*uC!c*HXI+1e^zvtM8(}G8?yDFYk9Wu)cB(w zSWf=X$cW3X@3V!ULye2cxG}YuL91-x+CqNv&&%Y->xYkMm+f;+|E}T-ulq|`T{DIl zLYLg}t6$1?2OKIp?zn^Ov!fOpj_wjABkYE34`z&Q!uKNtl!hoD%In*pb|Ml%+WvMCpvaam0WhwxpMFQ4@v?loTeGmV4Wj} zg8@!}pj{-0X3qR##E+ZZ;ifYJemnyc?w=+LR$L%yNsXzR5D~Fw%9&I^bEt~}X8>#! z_7bUc)Ip%hkv~2DjBGP`XrZYUkMsGg4<+qQ%fy0_yUTnRY{-R>HKIfU{fAT;(V;s7ll~A2TFYoG#5>F=tGB$*QhLJl21EL-BuoZ>|v>`t(N!y@c?>d&9cK@ zd&y>7O-2B*bySX<-RY(=0vW4v{ZJP(Au5Wx#1!_3 zAELHT>I|*Ay1Kfd?qd0R*WYxboOt|k;y3w81cu~ae|}m{J?#g}zhCtSMT$MGJ<{6O zPJk)Kc_0Q_X&C;`Ipqz)EQ-5tKD!t zzF2wm*KtQ`L(;^}mSXjfq;mU^ttUVj&0WX64R5nTze6T%vlVrCK`F1TC6Qq(C0M{||D@?{7oI zt5M$m$5T>WRF2EiG`tJ`A6r}NCcn)~OZ_6T0UCHZK~KvP5Q-1caijijQq5Mk zi=Eh^Ibjwj<`+h-vEIb7TNxa~=bnFdwc9QG;^miKmjAr{qMUHbQJg#KCI%i1$+R~= zkP9w6f7xmy{_ltwLXAnBd&b%F>T9pd$%h|ckg7-gOjol*rPdTHX}PbH_#0@C!rlzk zB^IhVf*3-Tx=|8!jEZk93=U8MpW=B__^!&UO795;C}zfG9qq-&OnvCSd&*y)dQx_s zJYE{-y=y2-1c&*6j`n$OEc>7N*)+NOXIIL_7hftfrq9An9Nvq(v0TTR&Z9Da3`z(v z8TbQ9>&sQ4v0+An>97=9N@eEsg{Ybg?urh!Z>7Jfipl5GW-kBwn4`WcxBcNpR7Qq2 zv9xzCm20lPUT(PMYGQPtG76%ffBbn0iJ8dPuxQ0rZB4EG^N|<9q%I6uT1xV&<>n`T zBUk+V3i;86=fMW)U1<+p?XB|2!w<-T`|mHmz2_GB$t@RAUFK%Xlq?F(qROk0WRF?) z++&}Wwj0S`M#K=>NJMNip+<@e@<3lBczVCNEx@G@SrV_KuaYPFLS>{s8K7Dz2w#=NA7P;3ER!Zpl2=}PY5695>~^@!pH(lH z|NH{!>Rx?lCL9mRf8KaTzJJQ8a^&#`%Rv|-Rd0Cgktd|UQ6^h&wf02l`4?X-um9~; zdGph^xGLn|`LlERPV(4`k4e8RD*GLBfE<0?;d17=r^;UY?$Zn)_g3S^k0X|5l3jM%UczMm|NiI4<&~H6<)Hl! zlI?fiNhWSNIzjXeIjUN3to&Csg6bMCGlogBwQ*AzO%dXR=*ihB*Bs8W-L~7xV^mR5DROlc%rsg|IJ?g`cKPc~h z^uC;X=Gii3>h^5Oe;>vX<5`bLvFh9cXIIlN6Jx09yi=W z8)7KG_~kWn>BX1GF)w^q&OGNV1R3|nAeLhA2cmOc5-X%KsV{CpJqq>*n5?y_QJ#A6 zZ_+fkg_`FpW%u2`Gwfrp%LXt#zCwh9#a#ybY+VjCn%nfE@2@>Vy*ZRI@#2ID4y!nX zy1=TDW+7{wMn+m`EnZ6DR7=r@;mi;x^yC*H65-$x`Dz@NpKI0#E+2|-;s+;aSz8gM{+OK`^nCsfN%dRol2xul$wH#HM#R5%Z{N|fUE6u2@!WGhj zx=9-m+uMg{ zGoXmHE*GKQ(SCpXJ@VP7AIT$k{{_-B;>aetpw*R1UTJ|8I!h6INHLb3($d@}oy`%+ zu@%UZk3Yp&PFR;ier=oWci2fD=5G{fy62vKPM&@IRk`n$M<9$B7`=hDCx_knp-kFp zYkBjHcfPj$hWOx1L--{c(oEbYVE9%Y7^71SiI47P+UoJIBD^^4d?%G7I=7}BaIAtj zAJi2`NaJUSGbJ=6z<2#9S7&g&(#*aivkZbPM`p*H@?HWroears$XtNIFIA-{O1}U+cXw8sz+K;5~R#d z$LM+SBBl&N%On`#)Q5JDq!=Fg-dcq@%}mP$)Q zvusan_UOG1Bm_|omvQJ6p5ctLlfs8%jy=}+8>YZP#b4~m_YFq`W+=y7m(bsrM)Awt zZ-NF<&%716tbUYd5^xA5E=tBa&F#=)PT_(^Xl?SRDK&}EDF~B#0GtN zI2%5nfpoPYvk5e4rFDRXR(46%6;$C?I#he8im~E)^|#EBF%?-6)zQ31>$-1M6Y7I% z5+>do2RW%uUIs<-F||-GAe5$BBI#yQ`#Cg{lG1WH=9pvTlv7S# z*Tawcc3z&-pVPPF?P;$`TewB+t~_yedu5NRU8Q!+STe{-IsJ648X3K%TNUQ1$uDKR zTA`Y0ccz06)t(}wv%LPs8*n6TG6vm(HcC&wnDqr3q0RI^MFF4t+r@;IB&>DTS+o*h zqSz42Ack<$bMwO7#2n&D36gA0$Q_OMP6RO^q6(3^pBP0PI!zt|t6}Gu0&?vf>v=RsSNwhF(w`PcI7v(L&O|9F?=qj|Y5XkoOkeao%3k=e7S z%VHGS-<&=Tj$t1SjlPEjmQ89aYWa6~e8M%Iukvi~yzO>*^KFRF#MoOX{p=6XQUd&w zB1siTrmmECY38ii@{^zbbWOWj=kIR1;RafCG{P4Z)ZTMt%$Q1VoF5NEpbG3L&ji>gT;?jgM)d0VxCF6l4ip&U|CSuS;B>!h1Wucy10u7bU? zbVtH#Po|7ZxX0Cju!~gBY|2!wp^Oweuvdwmr z<(LzWLIcnxt=;WV!GiMn(vRegw_lcaT3yuDPLPwS{8-;*{_L6Z*MIz7PB{Arqzl_* zkL`aTlbBp2;iZ*DpDgXHmw6vAmCl~klsS$-PC?_5dmOi$9B}lWQd3wX`7*}1tQJ`; zjV+6$m@z0UaZ;aO|4kagO%D;ekmoW`4h?baG&puZ4`^&|B$iZVC~9k>qy$0NSTsa? z_yi?(1=5fE6y^o0su(Mu@KQxdstj-0ILE1h_6Ul2`#=>{@bEtT@I(3F!}m}X4;gNc z6Iu0WG>HD&IO&CcR9adk#f3%muGmiI&Yp#UY?M|BRnRyngeO4XPAQ`*gTzQIH8<4L z$XR6m!g|B~EJHjqq7?%qqw1>b#EJ%F1r5IZ$e`IEx98Birm(Qk5WiIc&j`nxjT~7) zegWvbAGgN>qO%jq@G?nxq`bU}`-m%yrelnCySavL+A##E5ih0kA&;a;A`xZcQpIo@ zcM)hWM1oD5VV9RBqzR=V4TID|;g~~=O%=?GQ54s*$_&k}7cBZhe(;0S2FMTd9=2CxVpWRXyx+KX+>weyNfCm2Ziq@s0&TVnp57yrPj}$ zZ9IMzr1ifI%Oj6IB5%I_63GLS4DmF^L_6u3KpIvlDaxnMw6=-1%lt+2C5oYIpktq^ zmc01<(=?|FVo1#5pi&1wWmGsMk}*l>XGot#F{YY?(u9-NfQAsjNTy<9A~yFiRUa89 zB0tEj83bc@nk5gZw2rPmdQ;G*6)vE*Up4af+#f$pxzWnZDK;Uq6Jse5Pwy~GVupdgnE0S8`qHJ0C&MSD+gxmm4D*?tNMBB#W$ z{6V_@bu%e=T(nvxYwm__RFIFkN>e*7uDu`vQZmw_}FFI)f}$B)RvYx3?p zZ^=)7{1d6Fso5a6Unk*5|MH+*@RM_7Lh<$-Q(ykHw1*ny7OFd5e(p5{eGwZ*!*I(j zCrQoN8ae*BjdfFsN7js8XpVaCJ4Glp}4H_|j(r||XtwqILx z)gVE`udleVf6@a}G#u>0w}T@?;Had4w}QKD2L_rklO64Cbf72YNc+1e3JeJ>VT?L1 zeQTMEC69(I--bmAWA*j*#tdKqLpiYyO1i{g;QxfAC(y%05u?>wn>esq9vW3BU&WhW zC{dcOxOqxbj8|GApcZc9%NCM_=%D|kKL?A+Amw3U;yl0!(wi=}ZEI;3t2r&XsEp>4 zmQNFlu+vvHgLRGI^Juz|ok{}HNG~d+TII-XknYxQV5Wtv6(J*hb1(j1n~^T&ZG|M- zhff#AUvB5#=H>b&iFMAUZ-kZy#o8Za`s_~6=HUDbQ!gk-dr!RvP1&JLAvN@g;`OKiu=Nf(YWEg$1pPXjo2nHekG$jD^$cMWr=QW~OJ#lFkO8 zH*uv=T9iy^wASQauDlFbV0HOQN{eZntg(X)vwSNIq06UIH2A)}7+PrD*%g(XLO-p! z2y`vxMb!@Mz?uXFpJ6b!(b0)uS1{Z!P6AuKhCjJs27EM+vT)99pj%v=wAIVa&tqy; z_9|kIWRpC=q#!UbjaAIYfOSHyT-e)3U&cx)z^Hk1NTVx@8DCXX?R`MC6uxZ6k~ZL> zrf?H*lR8Q3s+^CN^sPd^KKwfmqK{6Xr7MrV2*HRrFnm#7^ti%x3~M0|b(GSA`HPoI zQF#RhHY53@f;Cv-0j4WlEJi`V&OP$do~^6BPh3n~5zbW&sh^rjeI?w$J2ThhXB&NG zQk=K?>M2^o*>LU&2cW-3FaS)c@Kc`!HwIQ&+L~eM1%jF#Udb)6(?(6CoDN<4?753P z|Ife4>#w{bS6uZAunAw5^hPoS<;_u=Y68%q*pL6Es5R3u^!oZG# z1oDXHYxxO{3}wug+kygg-SGOK#73}(t~T_?`ofZ*hv-L1i4>O=&}-BV^E@gopyH+V zO$Pe2Fg|&pH|3YaLB~k~Zwuxxl9m?MS=xXU3MqGHZ65}%x(F>Z9?m#pmY0t_Ig^Rk zi{T-z;KWG!3C^Z4h+emfLc(#eGT~r|v_ZCC`!-S%($Nzz`lI^s$*mypLU>Ld3dR+Y zxY*8O%@``YMFheML30HqIcP^!%U1j?B+#k-REsEq@Yp;w($44HbBqjvHqwYiLHr%0 zkRgn!u`#~Wcn8QQ!E>Rp69+#0<`X7BWUE1cs=}BUtr*;p8c)0d8z?NC49lU193nGk zd@(9_^0ilAmTh*KBKgiLWB(DJxvMX`N`83KMJpM>RS&KK-c!GSrW|w75pvzHf61ND z#Vlu@bp|QuXAESu>NacoJ(tX3oZx8^K%n9bwH`1SdD-7Ynre+ECv`g!p4{*znW}|_LBrVcf z-$3w?)_0%^?eD4oMkrEtfD&@^3V6XajhV;n7lMF@aomKLXe1~BQX_rnjYY{cB&fO$ z;!bKYYhy#BESNo?Y)4R9a3O;jkBo_?6QJQVE^reDP+iOVrHzCUI%)jUC9O;Nxvf7lS2B3dvMCj+9jVpdRBK(LJnMusp@$TNcswed_Y!LKx( zwKOQ!L0WoAW24b1x`au|iBT@3?7`%=OKxE<`$VCX=zfrU;>IP;h5zIO!P-gnrwM%a zg#yOQk;FaL15ws&+I8JK>K?ZMF6Go-{pLbYY(l1o-;TxF>- zai&lv&;~f_nwJz6%eLEZDL343wOmJ;$_MYgZv>u4>XG>D^N;1AgZE#)yZ^rbid=Bc zg=F~%+6`ej_P7&d$@B&C{ul2VYZn(((rul9H|Tvhid~xL0mai-jzJ-e5Dztx>obnG7#(BqqTgia2SdRmcnBhTZIIETAf0X`Toldp;QIGtq_uW%B5K4`R?)L$Djh zO^h+V)24qeo7K@;QLPZy_SQS^&|rIbsEbu)=( zq!jN!GnyM>S);jCS3}8P8~dU!qJubLlK7C7LR76EQa4TGOEzL3ef^yn2a(W)&t`}K z4R8TSiE3Ss4>v8%%Md4q)zRE&OoA@RcVAz0#?qU%@h?tZ@QJk2^W{7*Ei|m1m>f^o zjMxh=K?XP0O5DdvZZ3ksQ}v9YM6yVVo4?w!gwT{?4WBe>1Wc%AdeLLFteSR zM2nxXu%+#!h3RI`_-d0F7pYzy(^#UHIFtucVhF}=2g(>u+;uPGOe-{sh6^Dwb`l4) z5C?Qy+(weZ3KB>&Sn(K+s z^Htrr2!+YyzPRUVBzt-T(hD*)+==@iCf=Eg`>mu? z?J885?}y>sg^*>8K9h|`@~D(l>!1Ger2OagSLDWD|4O#rdTaKxZZBw%gjPWf#l%Jj zBqoJKI}_4?3qPDEYr7qGmfqi7L)^DpybuGo-DYcg$j+bv$X-L=-wlXO#e{4QBjg zf|DRx)mpPy!pNkwkkxbxHRBSu!J)zRjiA2kXYvXJyCpz;(nq{djc|sNB4uz}F^YQK z4lH?lry^E_DLrJAxyS&h(oM`wv*5)gMbgvREd}KzM&?}IHRTK`(?GS{X3m}iVnNK3 zeI*b@98+B?9fVnKyX`i)_uhNg*$^t1$!1lLMPp_m)1*K zY3J5YW>@2Z*dk(bWl=S)^^-axsi* z9DSTe7pSGNy<1K={#XpH8nSg;bP}4lSsfb>ylzUU%vlE`bH^WUm&v>CLOd-ly{T3Z zzKI4eTMp}_^f_1r-AbGOco;*C;u3A;FZZ3F6S&D1K3B%O5tB6x_^=MK)|JPN8!Iyx z&J>?j-#NWwdRF@XBrWzjB-fTpLW^gDbLyv~*NWNoweEZ!R~W<)u6<7f@l;Mzp~ptB zY_}bmV1nvN;#e9tO5)OKk^sm6kC5!LkCuEI!@^Mb++MPbxYQt$xC7oD$_%B{jC~sx zO_BsiS`_7B>_CJWkWnwlEy`WCB~Xwg7~Wi1=1K}83l3YfesTi!ZqW{T4G=g zb$du+`H+gu>LR4EKp1m2p5{W$4hq;-FJc|K4fDj67wD8|@|G4AZ@Fbc@^ z+Vq&jK8W!}Whq^|l&M`p8HyQ~+zbj;Srr$mz5U9EBNpt%@b+sd4ax%+44E>kwN6uc zb@_$)25PP+W3I@#pYVVhSubqk2q?Op!sZ=!-%BpOVh@UdaLevw0=($^HJ9}w_+kB-X1cL`Mm7C27y=u;sKLHkhdckR7(tGi1AypXbF=6 zh?Uw(8|X6^)Sq8ch{QR_6vIDv?mUA&q-6UXjAnvZY7diXA92QGPWZkYc-S!`a{rtN z4Td6$dGwu0OGQaFG_QUm>5)s(_E46OroAmSTa1&_Ws#`S*OHC#By|IN7n{V$z~9V6Y4@NlHg^^mA>u{x;+sY_6*F_qkER4zjv)LQ8cD;wQdkiT-`a4 zlD>jbT%9g5ulXPXO*4N3Fg)6x!w=GqlhjD1sp;Z7KM2eWd0W*4qP;-~ z-aPEgs9I1P#kl2vS&ZC(Ywt#H%Y)JMyNfa4#PLvTP~+sHK-z@*LJ*Fmql~x_l#4Lu zr~O=G7~m2TGFFVK3IKMq{uspfTF8W3K{rJlUrE+Z3}6f|p{1dfhBsV0vCJgMwYZ?r z;6e8Ehvl?W&yq<~rjFPRQzRb7*bXcjC-lh{lg7#`ue>bB9(&wckCSB5xaWcUl zTGtgSncNihFXb4y)J>LnDkVSxb{ADi857Pq1~}l7s`?7+3l@L;RUt37g3G>=t6X^^Bzq`MQ!M!B>#G)pgUyp;gIg*cK$o6LR- z7IhCbuv}YPi@QppFi8^466cU;&}spV#Av2C1)7M%v#Uh;G|u&F^+*IaTB}B!yd(~c zsg9+_^fbQM)7l}HJjlvSE^f%mO24sU1eM4f$AAVvp?mGvg+{K+Gi4aPmx~QPO6b4q^^du8kNqM!j<4%=T zL-y|NDmZ8I*`=7|y{~v#vgq#RbK1MSGl-mxts=FPYNbrcNn#`%zUOs;k?}zkX(apUo{jEgjNqDCnXE#YANymK()Yo3VHi9f!&Yj0d2y6pEK} zu%5O~L+^`uO#HZ(K@7H=3Cm=|Wya`MQZ1sBTV)mUC0$)I=QCn%sJ5o5E}FY&9+_gB zffCEe6e|*(xcgSb7%9QzTs5?_6fLt<0L2N6xQG2GG08nGLgKa@AyxVZv3OAou<0cXHtwm&hKw?k`)?fOzu>n|(1NDvnZv8Q`}D&6_As38Z(Sf$`q5X zV4Ktx)ySuT>BHXlP&cR>KORN`<(@oqK0+)$Yrf=LOEAEN>_VO8M!2g?#N3|^Ws_Di zghRcMjcq-R7ipGGi~H4uP?uR7nJ5=dHJ{9J97T+tn^{MTz^x#h2pQ1^g67?1mB&x1 z+t@B?ozADIs7T6i70odW9SM!NSzTE&slIu`9CR5C z_R8FO^FbWQ;2;)Z!O|8K(EFA1nmK2#SV&=!w4{-!UPCw%; z+Wh_4D6d@p#SniOi@`O4w);WM`H;1P(nF337a8JpkVvGK#1%OTWv8hl7baNs)YJ>L zkSqzdK(ODQcwx{d(?0nOq~3vK(A#h>1Jt2+@vIWxA4pEDx{DG29p4Efv6_QzDsFQQ zh|s7UV0g4vHq9VA;AU7r2tg_y9AuAeRO-j5UU0&d((6itb{uveiZogTuMxFPe^HmV zcHCwtzO<8w@Jk*^f_BR2+Nsga@Pet4(r|*RxP*ugG5JaXNtPH!DIa5?npm2cP?1CJ zrJ5$&oCjYs1Io67VoE@6U7$rxa;Ph+<7Q#9aUtZ8099z#vA2gVOvLFlVG$-vnNNs9 zCn^Wx4H}oUV@$&wr#i2ab0XnE><&m`WS>oZm&8c*q7`PfMcLMG==7TrH*|t7;|Zs{ z@y1&i65@oo|9)a+iky@pQ-UEb;u=y+h&jYIb1rFE*$lnf8?NBXE zz5zoR0mCajEDxi!Y|-+C45K9e*5pY?Bikm>qjF$8A;0YnO}%~ik2R_iT7Hi zH{C6b{q@qev`r#yaVm?NhPB_}tgObZYRnk9_VRn>reEG?m>^{j=yRFJGo}?{wH1@( z^2@In&TiLhU46b+yKE?HyxJ2O;umJnpB>lO(891gE-rDO@OM z6=@PBi>H5#!YD5$aWwQ^DbH$H&5`us)B#%d?`l@th(0a^70&!4HB?XJ_c0O3ZVqCOf|?_hSiVAp%JT!Qt5(WZE9^H^N)kb{Z>`i5D6Gf znjl65kF<>D)|G@mTnIPhODhSJmX-!tv~YnzrAb4)*6vSZ#?%n=^vH+PK9OB_-$M>N z?8psv_wKm+J~{u~Gv&(5u9maUIa{WT-_AHTBeB9ca4|e{T9M*HL5IjLkv!sdF{hmV zgOjOt*$zZ_`U>k0|HpjZlRy9ZPx9GzpHQ<;s01ohkO{7X#^963O^}afek!F^HN)TW z5Vugf@;eCYn#5^t{z9tjic#jRq!gA2s^K0FaYrM#8q?3F^`Z}U?OO7c1_7!nYm67x z<12-tXF`p zyB$=mHOO8ji#P^SNy@73X+ge8iRg-3ln9-NCckEnlXO(_7Lz58QayspY;qMDvf;V; zpd60b3}vPSE}gn|WAbYl|A684IB*-ielJ~r+6i6cU~Fj!%(*D#Nkbe;MAq2noSC!b zxffqHGz;xiS~!Tid8wJ!aEF_CWJM*0P!(-Jpka)A7qQ?*P>l_jS&^Zi%(;c~xb+CLXICY)Gm;981AKZ$+A;3tZug%`cfYB z6JL%JwsE=P8EWz~fZ3rmn2^WYu1tDxDQ$Tdf0jLyA^C zLM6vHH7-JytAGj<)%>TrgqQY}=l^5yCHtWBRKNipUt5a{jNU&kaNSrs1#vH9Ak~iU zfGh!NXw7O@R~tsu$Fsmohr7OD(PEi3cfK5a@DaF|M|`7qwWYN|esjyMGH2dwVw7eX zKYj}tKc)^3Cd{>$Q4-ot4RpOMTC`9m)J>9$F8+~`0QyExdNdCH%o8siDl%d{0!HE# zbviQQX9FR_fmvzA9d8P*a#Kqye8R91SkLhCra>Uevx9zS#G^9MD>Cqv6e&gex=_fi z!d+8Qfqq=NC1R(z{oAsry0jC6mw{fSYCRf`3wCrPj#?~X+{?XiSwsa5;R8kAgkueKsSPvw8NV>q3mR8ceqaxY5}lxw zGNXEkYWTE9I0xg`4;t5JDT7h$V>_*UDF?w;)@a-ias`wg3o%VI8j`*69}94Giwbg$ zOyax+i;(W>lbxqdHaLJuV!cY4u~Q;eRD{TZ8@aVmP-Y;!u%xL)I+*xi7|B?SWsGOR z1zTYDyhVngyy~hONH~;zst0>oRi!4e4H%)n%*!1THuz~6hVUz6r$AAS;WEJZb;CHaXSnQm z>$lgQe$WLONL92jp+%S?DG)&?30@|~HCuzCaq zlqah6mx?o}|KNvfsK~E`8e>9w#1#ubdjmd=>H=EW*LaYe9;2kR6t$SRY_{2E(%RBu zxJT7vDjDvSk@Z#0NNxDr)Y6P$rR!7!g1hh{iz%ZkMMh2Qe@!4#v#O@>a=i5F^K$?F zk4QVU%npuY=bU@^dGZcBvTyY7db{MKkEY3IpU>dYO-eZlqpF%}<2#l9fA*P|q`ab1 zZoKI>gXq1n+-l8Od%Y+C#Y<(%me9K}0-;C;)FBmwC@_fcX|nP`5W6ZVjl}ZlM<2;6 zuf9rn)+9A#+G}ga8k18a_n;f$3Vro=-~BsMS2u1X4!6dAG&VNMKmYkxdF`ziCCbFr z)!Z}iE|Rp{eV09HioB&v-F~W!8$XWc%P>`I+~4|qxthJNXbjh9_iNjBWDM;B5JM8m zgay~kfq~Nk6f3C2fn2$rrj=o0h_PsgK?Na3EItsAm3Wx8h0~Y3v%Pa|C%Vaef9k2H z${u^{3AYf`h4M!iHN%={Xsw4bG;s@JaJY<>H3%+b=nwk7k$I0mg>g9Hxm8vpbq}=x zBUwV+v9@k3t}HGzNN`=1K{nrji#LK$HUndh2%rLL3MDBm^-Vr(9j*b?YMX%SBPdiece&gTL{9-$kBwzr~ zz>g%E7p=)R-h5LYS_i)3a8B^%n|~$GKL5NN{r#im*4uwC_F}ut>6k-O3t2bnq8l38 zWzLeta{r(2mY$_O@|)k@Ldb&(q)}Q{F@(zu6V~C&;H?1;mwmhrC$S;ojUEE)X3$D6 z)B}gb!%G7-q^O#V@<|szVUVJAWc86w+pmcRzZvxL#^DzdBoZ@=`v^TA|^k|{Xk9q+()fDZ=Ta7 z@BQ~Tu1msxXWiK)pXPu%(9h@Jk{ zTThldAN-@d+4P>AcEu@DXe)$luQIA8c%A`y;;~2N!`D6UphV2$y}mg5_J`$7SCR=ijf~?%`}TymghR3EacwLy8Nx%94&5nszpBu$vl3JCzFB z=qN$FD5Xt~AdtG?(h*O`h3+#HZL|-H*1Kkxjc)`re(j_B#X+W8Oa4@-b@7~~7)FQ8 zpR>TIIZng3i-N8cLA~?grv{DZH^2KWF}5u?z6)C6j6zJx!Bj}b){K{}5TjKgwOYqk z(&OlsmckZv2&WUG7`f+CRj)HXtL%5!fl}n8w+-lvoIht|k`7Zd`i@?sy}=5nIHEt^ zdHd}$yJ?~P>Iu|!s9tK0G{{r;|4BZ6d74bwYFnB0@;rI$rYB_Q{k|jLz4&`@FZ1Q} zGtWWvBQ7U>|3vxQ-=8*~fe}3^cD9<}m?FYWXK|>+4-b$TI*kqVkOmQGW->yrk06FF zM){X^!q(YW<5~&C3RJc$NmC$gftjNEAi>L(T{g}U=p++v#l2S}=+Ztk#DrD4Un^f6 zXi!F}s?kh$bzQa0uU{hj?6aqwbmGY}ZtU>n^1q3zA9&MHO6n!~M8$^^tdp<^^Ptug z(abx-q^*X3q?XTVD^P|i%q0KTQX#blWr==)#_o&g%xzezZ@{-(PrI zF8;$$q>u!cinG4;+$-|tzuu64J^e4a{)X#N3BOsM{>MM0bwPvNcG<0jJZLq+pEJ)n zOJc5s+;H7BMhttU9gn~-t1*P@2?Iyq#D=pA?RSwz!aq%Mv5C^M1er{YX%&{xUXmwG zD@;_WCWV|+5L$<3Ir|ag%oxc6O7y6*Xe490Zp$7Y?eLPwM#TkKw+q=Mwo+*)jah0B z>wc0XQ6{p2GCHTh{cM0DrENk#{p<^Q=dEdS_E~4hZoBOvn@`+klgPTNW`!oRHZLEC zIn*j1q|b~HRa#2D@Fk1r5IBM=EoKPrnh;}30Y;>#HW?5lLCO{*rJvB26n4O9EDt_# zuN?UO{bZYRIuM$wU~lxwLw7tbk3RA!VUGbvRlP|MZ949`_aUh*t(BXv|CMw>G%uC{ zIpeCcWp4c(S-fz;h@akSjN(_vSquH}s};Y&pL#(GDYC)pPT(vXRV5lf(#i-M^cgR` zZB;4RNtu`%H$e65QalhT20clpQ=3C+2es_7agKnKEUOAbs1U@`1{z2~&*?D~5UbzqaVAwOYds5%gQX z%MfHsNCy*vwmVTTLWw}@%d}Z9WDv-ONc5stZ&k)HKC`yM^HAF0qrg@L+*Bk@>-RcF zX)0XbYs+pAP~sk{&Xwwf>Cf7Zt_1>NI}M)OkguM&#TN3z^DmI?VB8nd{&2t-YZ-PloIO7E0O6L;4O{BwRmWU*dOi@XGXISD3ow4jWf|X zf!9Teee`SPkEWJKa(U@L&r_!4l1XE?qzo)3|DE?PTsM~-a@fHJMPRUFl~6QYS63&W zOq&LXP0+-sNYXiGdGkBnXusHqa}#xT*BG~<#6cu?cUjvcYf z@_KUVcR^dgH04$tN6Vb)uLU@yK9Qii3RtFrZK|R%lFJvfzL1IAZ>{E5ax;0dxPGA= za@^sPW6d)_%3#M*YDfuec-7U@3=iVy)Q0BE+wZ?O*y`)`*?@Px(k|54tuAP|y3beI z!3O_j+?aAwjLdLEnpLyjN}X2(W+K}3}^(PCxo{G+OnA-cyn*+zRm>gNe% z7-pA^as-qGTu5ZaS3wH$pAkf9

Nbn#p-m9$m5nA$9vInJ$_89F9$vkO06II(quLQImq{&N=cY=DN5neur{hn7x zZw0O_ius-O*&HbuQ)BSpmK|y^?wtt&tj4e$oTaup(STxzMl>V6EI0dK1q3%vW4ERY zudXPipqS1zh~H_`U}3lrC1W;QinBwKT(K+MxdeifD%mrV%W^|F*h!4!fkt{?T2r=c z=?`PfND*tp5-X(?PDBXRu4zhH8JTHVw*h2Uk{HW`_B%vzK)V-d&6$Y`W#qh|u@gzo zE*tF#RMynVyVTX4b@n-O<&{@+-$ssX$3;)cz2VOy-!KiKK)JNzPgJfP3UAJ}F>QW3t5Nt&7(M(U8pezbx1|Fd@< zfNfRR|39)NOO|BIdnS&vHv|Yfp->>KLJNfy3bfFcLQC1D&;gX)Md4ps_?1=m-i1;& zlsytifb1Q|dk;;^`hU)Sk}a+ly-c_YVgRwSp=R{yJ|tI%-S zaYvxEY>YhhvoM=EU`*69yI~3IQTV6lcrZ@4PouO`3XkpShcSGJgRu7^OXzj6t;Z zDNz_URy0cQXtGa@FD}QO4B-~@c@-{3yY9Bj#%}vu=LP^mE6FjYCRXW|qa_aXw9_9f zd(LgIt;)JKdF{>ja5#2}pR6$c`g%Ov{jkLKI41+%upvQW!P{ANQ*f%)WV}&Gb}S7g zK*Y*$TfNC{l!9E*Dmxb7Z?AFO(c8(*%abY7rtj$8+~WSJa$wS!@$$}VuVK+r5Bw>! z3^x-)xdG+GX%mohiz^=F1{Dvr6VKm-7dKKkqH-w1Y$M4Dz#G7!y9j4*B`Aind}IIp zO`yc}wX3MsCgZ1$ller4*jV}3ziyYk_um~oH;K$y9LWDA&pqOyW{g*Xw1!V{5Xeun45eXClS%XejXUM$dU**3MND`Sk<8_8uCYzz*MwX0xMWtKoKe(swO*d8aUzPoiIs`p;%p^&E{IP#S&34Mfi4%viYo;y)5=?S4|C0yXVvV;|)*F=*eD0!v z9S7&v-}+FVdH8ldmNfAeP9l^?HG_%4jLH&`g9M1gU{@#55FRJ+t62iyOq@mUo;HAQd4&0@I4q&1Y8~Y?L-zE74qovc7h` zNhWQ>M{cN!2A|Zt2ez&bA^ot4;G1VFl=>KvkI~Y4$$hY*aj`TGp@JsS_Y2Sel^k=- z(emBz9V3pSGAZ_rm$T3Ojr`!uT6ufnI}&by0>-Jle3#QusI-gEgQ*+6s#vf>-g@Q@ zdHmmx$jIFCM0G>@3lb>xqiEO%5tSV8O&D=W4>i`m7k%#Uf5DI*x#_0=Bg}6tLFou! zMsPQO&1y+WM=PvmG#K9cTS?}D-YwKvE3L4A-jEjO^w(IwwOxN=jmnR zanj9|hq_)H!d}><7z1THa`LL+D#H0-TWB50Ux0HOoiu23^(3|wP(`s8P) zogp_OtC%(WfcOKb$bc4hSaNyWjq`BL+kONh#29NQU1Mf?vA9Au$ssps1i7^<#Um5F zQ>CteZ1;Fi4P|K}vh5heK{-S_ZuLWrr4-8I*5%TU7fK84^9-U{{QJ?@hO)`-y3RT0 zT$wz1yj*qJwQ~8zSIY@M{+{fA&}=e?c_C(EQtBIrX`Gvscq`@3JN{4Jg=@S0wmYP> zba1a54LYE@fUPNUAWW_z2@I1DZzd3I582wI_dhHfh(T^AL2inRG;4rcnnrfSXH&2< zRJS@WvHYDFbGk^U7Q(g3hV~d$v9#3^M;;qP2cW4oYMoGwx#g3vMUZ;Y$G-gFtCH$m3= z0H;6=Nn?i2&^m>ATu5}|8!x(pc|+)T=Eby$?~?quT9z+gj`c-Yyv{5sC;Qa4Ds$!> zA+u-Al4qZJ3WNFQ<&~#jCwWafUSQfK=1*{FDTk*SB8Q}F{$sY zNv>`6B?C9w{&qhZBs|IQFZ;bLT(XqVBn<>%zzz`ip%jd()lEr#kHf@q^5%^c7jgTE zRxM!$INjlq7Sf=3Apctla}gwddI})w&dkHUkn8baNQZUS4B~;>4V;U~k^Ao}AJ2P3 z?zrQ2DJ&)v5ftOF+;F?U@~=gMPdt3DF*Y7MX_Bm7^O3BtSc2;)DgKJ5%YucAvHD7t z8~%3Fkc~wnP6wZo@VK^a1<6EQeA{j*DINu3K^O>3(%f!5LJA5^Zr34ebkK@0Z6ki3 z#t2X?a%Y^n(=1^csB(Lio*bavvcN$o!XfF=*46#typQA;zxcT!gFA_^5P-7Nfzz(r zQIxndbNPVki7|vHiBhnz#ztd|R6^DG$`)(lju4rJG_na7umV|$9h8Muuyc?^IUH)0 zefQW~-XZx%D)GD?d+b3e8#R7NMqs#-;St!>2t*OvXgbE>vi(M&2MD#zO@iUp0om3* zRwwDwstJdihGGQc7FoNYT2>OKNu>j&$X2@WCC)(Wl!e)h9h*Ws2Gez}G9V^z@1RdPK)0e$g6-H=`81#9faS~i zTmwGJ@WJ5`7#@L*j(`o;P-na;7CXuAW-3M!_vvqMpiDlqCEMEre6~j$Tk_0(ubq9> zr@10qWed=^%HjRt5f~nU%^m?&C>h$YTMJ_Vu^T7j74_ZkUw`-g{ZDPdk%1}G?h2HR z?^Sy5tGutL^gh>fd=qW-TsXWnJOaZb@HH6$O*uF~83-&A7Y-D$W`HWT#i4#wYwv#c z*6{W|w=KFeT<7oz43EH9V+1r-q{SBZqqg(`6X4hTVK+|w4SY{e4VyY|U0I8Qq`66R zA`X|~5f~nU;St!jBhXueOk2I>ehJX(OI>|_&kJQ=7koTlZo2s>T2!lXL-Z2ED7JN=9^GH%L9DH)M3rDa9L z##kd0ri~y)=jV$it@#fcTC3!u-<~H2?su5nq9J|qvZZ|Ikz&h<%HoPua@_GJ%aMm4 zDoZ~5w08$T$KLC&{a3y*YkxWa*O$vDt3Q^OP@`OOuy{hQvz5r4Qz{`21#mVFP}LvH`~^|Hs< zeK5xEk`5CIH;SL9L(Vz(47vOE`{dLg|444S>F=`3u6t~v=7CS&b@#3E`kSxF7615+ z?78zUgc!nR(N@4yWXsyB74px2-X{C)x3B!<)E~)@e){u)D;YjIJOZ0F0y;kjo>!Z7 z`|w4Bj(}Y$y>8aHdz>v$w9fS%cm=`aW8F6m+DP(=+S*$2=V!_@|9(Pp@<(iLa|C>d%2{WhDSOYJA~*j1I#_;! zKy-!0LqrXm$>h~0ql!n$rN6&O&OYaKx$xXejQ7gbfBeg4w=sO-@CfuCf#iAD`^@m( zR*pdJ75SGKpX+%88PHb)LRa$io`q`tO8-g*0fGH>1@1fL!mJ9d=JnX@1HDoZ7gFgZ8e_-Fb4 z@jsG_E;vX2c-{Z&U*YhP;Sm@ffiG+X43nE6^AeDzP@|f_b0G zKmLBJ-2eDLrL1g(WTts>RIZf2{^pv((B%bZ@u|Ov_3&O;>cqlGBf4B|9weLocnWGys%ylKH$5u z|Ne)PXgMa|J?6*q+RM-JYyrv6^vS;-`lr1A(Z}-Yi_iA1aCmQc1cpc8iyZ-VM7I9% z7hk-deXLN}w~ldmW2KAaSesQkV`ImSja_*2MX`_k^JB{*3uAA!yb^n4>8-KHSKJwU zwf@Q2yZ#qqFIGJt`|gjAj=lN6*Ed;fptCL39;=U?ecmr(_dI!5tU9_nRu^3nTh#Ps z?1WRl9Xs!wU-YS?E4Fg|C$T;DoDutU#dERR(1KW7Y+dZR41yZ4^4&Tz2L^}Tm1 zD=T8B|M2+u!LHcSB_GB1-g}SO+BK_sU&!7|FTNO?JZWNV@shU~<>pu@))0I1gI8kv z&)&D+wZjL7M__mazPJ&HyP8<+uqFS~ZR?*>iuw<5jH7ijIhM4&N$rVsdz+t-()^d^ zOpz7qKask2!pxw*7?CqdGKr$(GM^ zA-QUr1S5WV@Ycs9y~`(mz2U|_HP~d#h-q@hPtTM;UV9s1ZrsulYJwFnkg+?L%jK8+ zuFv(ocOSUtPPzQ5OU%Kh`YJj4JIBk7H~yU%UZZTSpYtHS)=#Wl~XD z1NYMT^&6b+_{2TQO$@H_$Dm;h*6}ZQi6m?R6c{bwOR&*BvO+zs=LahTpHCy#rj}S& zNSq{fNI|t5BS}e?w@_RF8A@hpjzpzyL#=d@@g|2TteYxMK=6fsza*o_j1Vu@+O>gN zS-yUiJa*^va_>EN4|=--)(tmYFRj65Y4W#=BPAw#%$XtgT>FSzG3Z?+Bm>yJnc2u1 zJLSx?&XaS`IY)NeZTCU%_|DPamaDJ6MqYmHf3g=*VYA4nGjeR1yzt!9a^x{54tn44 ziLb{9sI30q&ps>feekj5qHU`poO(($CLXUF(}umJbo6)$AXBg2P$8X|V3ZZ*OI~pa zb0?J~B@vlCb%NyQkgFoaMx^!tVXAXE9+qrhmU!H5?AXYF#<_utk~%G|Es{YPcst2} zLS%$@q}ipVxrHRmspj5Pu%U|xtDWXwr!+OS5Z);uKA%@sty@nN*gEl%K`KUHQULfS z!cn&nI$o11j~J=iNShQD4Zj&u@|v`Hq3NBl%zbvrYqIkX=4 z6A_1Vb3)ms%6o5rC^PriSpv~k@etIo`r~>TJEmM_?7CY|<9)W=ZU@m@W3quH$hibP zjB4U9f)%#42Z-+K7pG>0>RUAWYbYR2caAhRpyDQL&S_`-tnXF5_EX6}dcq0E5xe{q z*=PS*61E3q{G`#cWa&ydve%WvJ732U2!?{PcI|rE=kV|I_zo$XvbUr%HBtlQ>1^5{ z6(7DWjn$PV*|!(jb{*THci$!Sa{$BHd|9+~G2d*nbUD*xJt5w^$l#Pm==B!9PaCEh z*~NKc*Gy+@r>8rl5M$e>7QZZAv6|4)*nR<=5kN555s?BG_?FgYDI7Tx?}W9Ii7~Kh zR#O}JwIb@#<)S*?EvT&Mx+U&+DME!w-w+Kda8DJPkOw}%H z>1|-x8!XKQ{ITk=$%`+(B>6?TGOBE}{o2ORL;)4M+a;MUhpb#v0fk0J zcQQ5&SS*C@J{4-my1J=RoT*M}4Ash$PyJhtI`UiH=lgF!*+nZQGshzhl}+>qD{T5P zaay@{R@4c4uyoR9V2aCp z3={rc{aC})*9kU6$XEL5{3YZAD3O|FD6e%tp!JG<9xDya_XOZQ;OA4k= z1;m;p)0Z!m71g+eb;w5xUzJR^7pj;1pZMVB(|6y5kus@#G~$6uiDeduC%ZuM0q0OC zEOSQBkjk~I<)c@h8qzn~V@ksVSRknNTYzTdgmF-0T`&!63OO6`?-TpxVD}$`oN=yM zYqRP}u-3Kpb+3M|sI7>L4e#=^!XUT9AkpKE%~sM0pAK*~H1%MOdNTB#{^{TRs9R zU+W}`mxeR{Dir-DydF35@mlF1+PNEMeT!)7=sw@lOj@7!kx!U6GiiB8p0f!pkomZ)UO^YmGIl zmdhm4$oaCN@CwQx3aSuC<;b`ZBbbAh|Egw3uO6g_jA?53;H;9Ah4vy0e=MWSu zta~h`4X#jW@`7u?(LiK;a`WOgTFiO9wl^5)Jt?dt`K3PdLKWT1uxJi;GSHl}0}Md` zB0@ZU2M)vec?FWiKy0+c`!aKnJ!NI(VyO={7_wZ!(d!$CTC@73ndIBr0ozu;jGi(D zZ@pAx7(S_oIxH%_ncRQ>eRBEbL&p|vc`t_U4*i6cb@ba&DhA<>_%^#DsmSS? zrNPz!brvM^62L|Vq)3Vv)2~d#Hcn}2YQ{#Egu%=kAK(;h4@*acReaqy)K&%6xc5+QBnc*X_#c2SWQh{xnBuH(0AwcS@+Qf!=T3VKu%1Qg!1$tzpSfi5EsB#wPp>O?c2nMJ?+S{GHHPb z%FWKjT+W4}QmI*=Va>C0vZbx63hr!#v_j0d-72jkf(men?26~JOX-w}0AMXy*FF$` zeXTUtR$zDBDD{nvQc}P|Fa!lS<;nVBmW3~Izq$lETJ$0qqf}a-8~Sxbfk3b6U9z*X zWMy?14fU0>eA!w#e(o`S?&;Z8Dz3Js zk^`L>X=fSIz2|KIEnQ^p`q!N@_vCK^eA&oCQb@AWDWANzQ0}_z-u^cXAKByxEJY4> z_g(jx@I~jHcY&GIo4jcUzQD;hm7kj}tEx%0h#W77oGlDB7L2gpff6q*T`~a>mkV!H zz9&0?(*-4zj_kRkwhpCZhJ+pM09-^OHvYlUxYK+jl^QHX>L*khFsHqmQDAk~bpY*~N%lICU$oY@NvA)C2FxQxrN#2z`ycc)-)HMVvdF*p!9qFY zsDltFJLp4;)VI-(ih4Ql;Dh^I-Lu=pvo|)Y2~0qWkmpp^HArp6Cp{PR*}D108vxza za@e;I5*Pm|kF#viVwo{@7en^8HaDY~I58g>-f^8rAt{XR<30c~DH~mr#I!a%alGI$EYI0{!AxHqq zoeZ!b!wJ|2A`*i*it(G72K5OxL?Qv6s|c-lsv^r~jPT}NLSJ>@wOGLj&1U>iLNjdS zhVkpLyyga#+ z5zeP#vgU9*0Wk-1#WrN^CDF^O%!Vkf3O{P9HIp;vwDIA_yNfd zsLAF)JADXCH7>Xf=nk6EI;)}PF@HrUl1eGpp6xToSk7_z?(0}PsP1=zj4T+^8W~9qxnHIvs2~z8*Y$4{rL~_ld~?C!}r@$Y-t&?W^IM6 zX;>#`UU`O$8ehiB4hsTs)-zO+3aX(p_~Aj6sRMm#)@z|EghK;JBcP2im@JLh0B+N zsm*j`eL;!2@+4eUVdh?lc@+TUGBJ7a*wDrj?x_YA+J=(S&-d36z{EwB3|*Ma0GL@N z*d3zyE6C4BuAYG#tRFTz!2Cl25@2rQ601>5R8!r74PkCh9&9ic9Z+n!zC3AatcMot z5;X%-YOafgNb~DrtRpGPPGb+83kxl2snUi%AO}h}0I+qS^;UK~O^F;Rx@P2>Bl1h= zSBK=$mzwp}ECDD%{Qxka+1^rxf&`mmWR7m?wb_Ew0Slc15G&58t>aJ?zn0x%lL@K+pm|z26)*yIhw5QFB6XHML2I7tzMbl8P*$wFv{|60}1A zU*exaUoQvkdypJ_*x`NZ?Y*m7 zyS#!DJOo~qxhH%dN~8lhYN=j5LI?q^U2(Tw+QZp-(0E`3*D<&u+|gJzZBKgiiynZRnWTT@#v-}~NN`RjGp z$)0=d^QC%x1v)=ek;82><|$4BhUAqL@O7f~g|e$g0~=y4y0ETjX>CHu5;o>BAd`%r zFhK%JX)#reISv$6GfIe-a0*Hl#tBw6)rG=^?=6PbqzjXsY={sW{`nouyEK3$giNnN z4Xj~-)0vNH5IRv9F+Y@QjB`v_BihP=#SUUP9mDy-mz51=N4O_9-?kr3Gpwrup*=kt zixAj)fK-(uaN{Ua>ZLBd6^jYvftb*wqS1B%o~re>17=O_EfN68+YnRPSrEd=CmZW( zu5?M>U#PKiJj4^>fx5XGYK%sh(MjF_?q92Gda zCs+~ynrq_|kDuNEnG9F}B&%H~1MTv6g~pyY$_+&YpGFIr9E{AIOj9o=tFt3&k^Tl$0Ql&d5qblZB9%Hr&W3I?v(J{PQ^uj%&ykon4f$jdVpJ$z z*!w1^#R=t8p*Ee^En^kg98%K`||9$-J*xE!_~inXn|9i>R7vEJz5dN0rG$;^}u)oY|MD-QsNV#KiA zi&q&C3rB#D8sj!p1&UCC#bS`nJc{F7&(vfq>4Zh`8H$|4fF)Fq^{ZexP`9iKT?lUr z(bl%v+GSbwI!SXQfJIQ+g!xJoIic6#mI+g)$_Gn6mA!UPxUco6Fb8TukEu7u{SQ1O zCqNlociGKy*)?Y&Patq0fR~9;X&M8U4qINme67s;XsNvY_Qw)wiW27fpR)VzgHfOT zTbl!We90x3$Wh0fBHumkNIBuuW5ieJfc34GRCk(m5n@b1v9^7g)U6K6pRT=LX3m@` zPdxbqa>eZa6`CUh4%{Hue!UO75X!Hwz|sJAEK}J!OgdC5pAB0#ar_v$?k|6qkLJyj zUtM&uQ5Njzqt(TvNrjq9#jdarGp-yI7&a)Tou*HfYkqY);pXO{J$9pwRSF1i5rD-7 z@YkUERnLxw#s)+$n7E*wZH0wY#JnVn)OiEA_YZ-EGlWzhVQ>BZj{MYIbygYjB>LD`5&w`l%Og=lzQ!ivQ#Bv7c#z7 zfXNTxl1{%>E6hy90}F8D-gS$Y5UPF`I46`SV3x;&`4~8m>fsrwOYM0(Fd7fTVk;@u zP*)4bg(+J`7A7>X**tS0hShNQ#=IwQWQkO*sF3EycG`hjM8iB(#jwT+Ff_jg7Zuc) z&`Kg2pwvy>*5lTs?eQ|v!}=IH2#~zp1%E}Ac_0hWqMjrQRwHsUB@=nWvISML4p3UP zWSvYHKT$GmK6&rqg~a=-x0;RDlPs%@AKK{8b$|V<%>CZ?~DB-5sjl>-i)B@U?2 z7D(_VpDvXTURxkjCr^|Uj+-NM4nGl1HCFpuSWZ0YWSKr~s+@oRFXgExULZ-zXqkHw zfgp0-kn>sc`|GZi_g-Hh=?K4Xz3nyx`+ZG%`ZTCxJMb#f=fdILAd@fCTX>Nj`c1-S^~>Lk^M09(`2G%FB1?K~r-vm3K{?I2{|nRKrP(!H52Z zC+`wxMxoqr>*F$UG%`B4)U(ez>_!pG7N7tRsVMTdI&4;JYir1uR$&x*VN6+a(7M(! zk0KB$YBTuw&3}-}4I9iSw)7olDN0CnUz_(|yjJo`(FS`7DG!y6$;_^MT_lxIUOuQb z4PB?e+ZO0z!2!%NQLrGp%PYVX2AR8hqDT~_NDjbC`)SC?TN+zr`DdTtjnyU@c}48k z$>?#@F(b3d%H=B*LX2HuAcXToRu^nB+G8kAKY&;`a*Wh8)<_;oq1MW3sjI3K4{UKG z_K0c7D|7Pmqz>R$*=7hiq7P&1>e?zq3U;Z3buKP09+G!$LnBN#6VzdX8q>Nh@Uwmu z5UpZSgL=;T7ehE}s6$o@bzh5L75`1tp}R48`kANYrI%kY0@sd?7RkbOZQ7(=ji5LK z3Qkkr(F56guf4H?$H7~{c4J_n-AZmE-f9P={`1d2CyOy*sY8IQ(LI#?C@&u=vuDkc zF=NW0=v@GILPH(D@pJsV_R5Pgf8Kmqwsfg9VRF;Ohq}{@U1ZLob2eLcrR2W)Sq_&? zkH8O4IYm~kUTHLxxftpCyk2Bs5u>4WvmF2w(qaGBtgDvw>(|MZS6wB?9(UZPEB=D6 zP-Efme(yy2Hc^ZmP>J~f!qQLPgAEPJAx9h~vuBLk>Yn+L!KuP2QQrRWQ+aQBg?zen zjlBEBKjqB7JtoUYN12X6cPesAr2=u5N3M?THF7_tzP(Uuoyr2E0L{U8TiM!XsKAbv zdYL+N77=x-0A-Xl0I6D;G*qsU0PK7a7C4G4q05D$g99-jU9KSTA+I^lZ3YBcjSP6jDMG6#~dqS zY^DKu)4xG3?p@;+@9qE1gGK+T7ENU-x}>P_?3R>a5ZwIH(nTYciRMJcm5D8>Di=bq zaQWEJML6fh^(=sQ#uy_1qi;oK2?)-tUtY7+pw5(qwYd?C$_!g^gzIvts>WGmTdbwv25!KikoQM=(ZL1RAOW38yHbEU`{veznj!1xH}bG}S|yDPSrvYSC+% z_B@2%u5tq1;8t^-9o;a+P<4Q$mLMPL0}tGX`_uzynF4&c>6i@=6^4)afukRk17__f zbLSo}JI|Pbk^yzR7QNSM#M(o;xdM8 zHY-QXMu?FqtTlC4; z31g+bp-LXU=N9?()i+3?2Sp#U?nLRCgNY+s_d5z!ch0Wm@+ex^Ma!4Tq7{o}N-EYD z09hAyzb(iMa{#O$?5ldWG@^`gc(DGct7BZ#jnXrts1*78JbCt+XRyr3+qw>M_lOat za?m$s$sez}R33fi1$pGLC*|!Y?~$?@`{F;H55N|q*g+wL+o2KDff++pEM8XUlmeRp z93@v3Tr8+lu+wcl7DqX*RfMo6qD_svdKFWd-e5o|AurTb;e!v~kxMVRT&Co zf|Gx`0JfqH)GSs$>@?N>%Pew(Rk)px>w?w+`&&{{%sUPlXZ#>;U|IN_tLs-gLii}u zg^h12&7OwLEGpy2m7_pdEhnCQlAQJPGvx=Tp1PfTJ$Q4vD5pW)R&7`-|9SjDIpxCN z$%rf`S;%@T*#`U02d{b4XIk-v?_>;B(w{-}7xjNm=L^s{oVkpj(H5i7>B2n5$@~dn zx}>&-ogFdhL>w_=pV_kbrAIN@8SGo^--iy^^e)~@20>UhR*wDF964&v0dmhnPsmkQ zT`eVLW26x3vbnNR3INQtOHz%}Xk&G3$vL}4t#L~?peR+xgYi+BDHW&2tkZFj)H57N z0Oo*TLKT*2jn$nu-gr%Z^V{Fa@uwdn)Aycegs&;s4^|=gbg+_#I|d?>7@&zmmj!_wM+1xyCVoNuJGHLvt~xP?dx0Vc^*^J9hQYq; z&VR`*xBXL2z2N&YbD!NT~4p zSKUsMq+{eBT<0=jWxGqFQ9WQLPxqPb4SmVQ_#(gi!7Fm)kG>^tT@xu9tdF z4Usj%N;WQ6>Q1JB+0ho30ClL$Q0r3PTpt4UAnuns>6BklfxnaI$OUjUp5G1s?{5Z# zPdVjBTQaoUs${g=>1kvmR0NQl2>1QUjFfaH_5d(o-e^dw|}OHWeZ?O*h*yHPRR3D9(hxiELyd^p z@=Fmmg!O35mZLpeNw}hZC8_V$YSX{Qe)nv_0hL=WShxV|eKd1u(zSLsAFeJE3K$_+ zO3i?smJTHaJD-AYsv7B%<;pnJn{ex}$#!Kk0UAH!t0CTX?9=UN7@^uc09_jONBQRh zAT@1k0N}~Z_2SYMl0s*e0YfT=ts?XqcAd(0Yt9-6{fP0;4$$QQimW2Ya_NU*wNSnxvqRM`3?2U&MARvRj1Nty znXBfHA|=Q9iNmF}uUG0ZGl%t>#D`;TYn^&WP3;Ex-KAH^X;+*qs{&OL<|EEz<-YHx zrzI`wk>~&Wyc~M)5!m{jEDt?)zs#61UGDtzBShB-VT7GdbPTtge(|Yt&%^i2habFe z+DZOn`fYV0`LNkm+eUTu(;N?)vm}$1&ZVX^JYOC%N;_0WcNwIP?(=4R;(L9rjX%Al zILR{s7_?%Ts?mGXn3y@_e%N?11Gw=^w(zV{Pa}}4=tS1YAG#WAh$WT%q^TzZapgu9 z=R>^_^%!bNqoFte54HbPd$c;JJ~ynV2E%2!KwjvC%JtyN<%0^uD*<-NgQig_KJ^QA zd7OlO&meFo)S00^-Rv_lm^hvIUaJgJuv|&a>>)7-_V$GBc+&#DeCj;gC!nWm@BzV2sOh90iqpvRp@g%@pUbMd&mUvJs2ft zV{;e-EXl=aa(ifhHO8cZjvem^2LL}}WU*X!*%k5-UO>r3>)T!+sO_raq$J> zR%W#W6P6r8>Z`0!#Zm1Y1W3S)B@MH-7>kmzhTy%V!U4E3lL>URvRDC>M8(N17$H-q zO*0yBt#4bF#5*a&{qC;YZXrtjktXiqP_+rZD?3Yduowzn8pT-w#{4rf8$GNrXiZw{ zoH=B`up1+E!$O7b59#7x|601#w=%;{IPOwxf|}(2F27B79z9L|^rt@~iz3OB4R!~8 zpf@d3uE9Xr)EM&lgZM@x3~=w?S!lVvwq_7K`(h(eX_3!eIfXTh3j;DL7hYBjw>Lmk>eHNqv1T?Bb&kp71J zh*&xUT+K_SZ(g5Ll5P`62ztz9c?Ymg^F5voTy}@+e1z32R z(H=wNOBR~kbmWK)7-TEguq{g*Qu;OVqf<{c7}9@E_PccR4%A+ee~AtTU#;pn6z$Yh z$HF~J;HMSoajQ=jH0!cy9k=i?2_>u(dJ;)}5W~Uwa>NOT$xh>U=BszhXKyc)rEjm2 zbIv~-S!9Byw$N9}l7h@)&Ydgs-}_XSe!7ZK84d(MPT6^%3C1e>GtAjd(RPyBvJNKw z<#YqV2pi#@(h-7raYuj=6o)$UV3^c`CA2zyZfQv@O+EK%DlnE-GUTlLv0MLS7j`F|h*Z}RBL-CHNuu#=~DxBJVw@H%4$FBhhm%g=1PCDgS07BJd zeC*KOTJ&M`9-T1LCr&jy-KRJUYb+uqB{RKFRLnm43nKVTK&8I?b7MmW|1K!xyGGsuJ#PD3SoQ0uDKeF3UobrLt}#JFC`LDd~=q)s>Q zO`~!8AbFMCYr!qTj+#*|np263)&|&jB74xZX$rROOq@0A*BfvXwa|yo5)ZEpn_@l7n)Peo_Z)oar6%^cg8*)N z#?NF868?AK0&Wc?UQ;Jr6KFkx?@n@$_pF*8!+vF zhju#gs{&}1DzpP^oq)9p{4`{F8j~&zbr)f>wPVq%$v48-;dIg;4;IsvMDcXvilLOI zmwOtC?5X^@E}qKaDX6yr(k4U-z^Xj3ljrpk0!0PI?U*KLMz0k3eK(Y@Qi;t7L^VjC zeuL|HX6TXS z6joF9r_*!#!7(KK^1~l}ZtEWFYHQ!RP5&Ms;l zeCVc515tV>)C#(NXQ2wQI*qq>7~71dmKvG5??kLnt4-b7eajcn+%n*w7_3kxLDgJ% zi4(h52~Y$f&C*iYjKn-uMxs^dU$o}#5$JzfkMw%!8jBVdEzl%+c{zLlsNEv%OtdDB zLUBN$Y+czzUk0hX6;-(clIDC&VoiYPWLdDyxr6%m1T zj;bgE>P(YLcj7!6VnS)!j39ug@t_=NmF#hQn+V@R2j5Bc#28L&f5UWYr1YJnOMW~yVj8#fA+ z6lhY2AI~^w=CL-$OLJPP)nzIaZUIJ#*=W0vs>o?S{i(e3_FIFD^jGJwzI!zg^`JV| zNXjwZX$a9$n$b2A0*3D;h&Dw9iZM(zTpEf7qQZ&jA_t#1A|M(zIT=g7tfQl57fb{G zbmM`3$nnV-KddJ$TEkk66A!CbB``v7*B!mC3)A%05YZ<2Pgm!91BiMAm+`OuX6T z7L4JCg}p{=6hI8K;z0#?kx^+zZHv~os8Um3_j6ly4Bm#?;%FZ*&tif{QMb8JrG~IC zSg~O(;dzV55l|~LW@5;wXl&rdj27D)D}AroR6qLHrEVEIjwWk3lu(LN-R!Gzp&I&W zAe2tnn-sR4$cKUeCPprX)mKW<2W5rX4FINZl4nC(p)s=3(vTU#CgtS<{wmvpg$gop zdyPk$l~N14RkMR?o*~JDovjDtyxJx<9v<3K?N^k0?NE&>&$J_d_Fy&KhHTJ5EI40g zj*0Nm1|Y^@w>1&98ceF~RYAH(I@YcO9HC5M-xa`%P){}xV#P*E_WIfu`T3c@kUI!5 zw99V0^&jM~$PtDO${GTM#UmWWF3HG%U3?3u^!YA=m;t0C`e`NvO&GaggvC;$_gS( zw6(}zGFV|Nu=*_@Jp#dfB_LOwc{U(<@!4G0NYRIymrELbK#KKmp-R9F~7 zUX(Bq0wgca;G;JaTY*IzGbqfj*-ip9YON&RPaEpv)+XE^O7L`F+f0}mB3}}Ux@)o{ ziInGl(+B;b1BnM>w|7Zgr@z{7E``0~fl*bH(oWGM8Wtb%$m&r_gq0nHMYZ~-S0{m5 zci;7Ra!I--`S8ZJ`_!fIr7W;<6~VrQ2yrM!NGefVPlN)}{K0}2=4G1+uy*A-BQMnK zTLst{scJWaNS-xNSSmF4G46I%k3*$7SbVZ^IZ<|4N5IJ<6(&STxQ%Z{ZHcJE12`$@ zyVZ~o3ay0ktjATs30v&V^%0+42)Y7ad-xKb zQ^G{W5;drYv&M`eRzAut1ZO%g+jVS^^S0F0V0V>gat1hIpIe!aHtuWUxKfM}V!9}x ze%Xr&O=BKHA4cb){$p|}BYOKcSD4;?(M=fRDn9&deB*)`X?h7)qGM)~VE|^@P88}a!~&;La#NwWR4%6)Tb1=`goI+E zZ3J*DNda(jeMAz43M(lpK)a9T5kQOa&NB!esn@D3Qd#Q^D7G}%Xp_AOmQ5{vb77T( ztiXO0DEe(?qO}&{!zk)GqLs{VYd-8q&$gv~QIf^{uk*>ko|0t>g7FD#MQXK%*Ij=ONBIx`z+x7_v;VJo6o*2 z-#q@C67xWsBWG$sURArIMjpTKZTaPUe>TsT92pj&Bn|h#VgjtzLy7J&XAdSX0nkXm zFk#|Y(a^okOu&&NdFf2LFrH6)lsqQ4508ra-K#t0XqQUux=ABtw?< z?ePM)V;lNOx9}cEjGKUUJ-I}25FbZ0)rAs7RagCT)|G|d@ADZc|_e(xQSz5e9wCR#4&>vd{}lq#+iHV zAs_s6A?!y)iU_;wgB2>7RwCD2bFJKZ>m5u?SV{8uS>V$pZ!LaVo_qN^CBUhtpP-jK`}E^{xScYE1SdW;x<06*04x6* zsGDlS{+5m^H}&)l;?^7N^l8n&m}|{fU~R?6N_TXeuqgx_Iy;b;Wurt1V#y07;zFS? zankho9sPf-@lNh{|7$+a5tRd~mAq1Q9ex%Y#-Rhia>F{R6}TqMRg!cjHUQF*irEW5 z+k&II*X5N-bzfExL;6UtSy3U%OY9Yn*e8Q1msRqmy8Kt(#5GH%qU@lb_-wOH)W z^Fnsudw3O$b+*)DJ;BiB;qgWwBKDm=Mpn0r9R-fIy>&8Noz~klsbA%xel*?DM%rUSw%4~JM?tX!!O^Se0mH`g)2Gk9uG@+omFEQjpjJHQ z)np}vQFKh%OCcT;ET0>BnrcTw09$~My#ZisLCYFM(Gg^oS0TBYvaH7!E(TR)(yIZ0 zEzPZjrO8I&L}Ucya~haY>3L;2mGv&n2mI1AVW9|B0^1C!%~0t8U={-ytCM(1Nulwd z)Ay&ghMFituWv?Xr@Cb~AgpdOm6f~ML|TEX8Hg*Dy|5T1*+@O!4bg$_AVXjy`{Nnpx6m!Ylr3^wc5C-R&JideP)`leJn93l)&Hhzu4 zW^#J6U}|Qi;t`_|tEAzOPy`2nxCde<#yeJ-q6<-mCLhns9xb0NeRH$g-O(?y>Nf6ZgBJqt4iXef*!L@{_qgLDi4P zI5HC!P6rE7xS=B0LaD8)gt=KT-NoDz~tf(b~`m)-RL09Z+<#5Iq0%>oRtHIR?Rg84K030P09XDtG6kF@1|KIHpql zvyryDuSwq6M1Q$dl_nbcM8m*nznfVQ)Fw}hnvQ7ll}Z){^%zNGtn;7`cX%Ay`5HBcjJ7Z_tP>4IX@&_24T24Jn%*5LHYaSfGXLRh0E zR&90!Ic)@LQD2`A6PQe>+b|TciU`7v5Pia%kK89J=}{4l7php#H}ibjzZ_MrFg7u~ zSnPc2wJ6k7?%M@;*VQ#5AB)Mpv-g*u|LkWZ%b8-v?yLAmzed&kH?FA`9~q%Mn4sBM zC{<6TM(=8T-+{?h8qrZ0RFapYHAWBMgiBKssx=GeOIb;=nU7!g@v)GOiDOYK7Gtai zmoZqDI3dF`_MU(`r<04`tH6{vuCgZwU^R31U5S_Vfnklh?tfPx~QziTka|uDi*cuNF-didZr4ySn)fU=d zquUug;DiIyAFEE{dx z`A(Wis_m!#X4-eBV`78yMs4Ffx?u9$HtZ0)ppH{O#URQQ4RamERj>mPZif1$CghA+ zP^W%OgdDOO8_HC|U_bfby(aT~vMjm(NPqc{=x46cjrl7L$VBs0$rWrdNmkrh9>ggm zJLdg&!1-vBWG~5xnh`U_P^_rfrJXTN&4a)G3KW%!S~zDwL8pjSdK)rtd;;oZPcFs` z2NeDLKmIOr4m?CE-l>;8Pns!NDP95;=3~zmmAtZ%^2$4}$)U&1CgEx+awi1mOcwQT zT|u6|CvSR2CghGIb=)mf4Yh!wt`)~gTT*a}x2SE?R?lviOxtOOTyWmG7!Nn%GntNu z{t8+B;R>RC=91W9ADK9H06Cs{25M0yj2RQ_*Qz&Bd%VrW5BFr_o&NN*&k-zeAqof$ z`Qnq+t5zBi${sZ-aivvf&)y(gI*x<1HOL)(59>?Aw>4afz)xbQ= z!q5e4lMV&sfGSdORImCBKuA}zg4{wQH|s?H7sfE%0o9~Fs1dZ{>VKRL_^a$tjj{CHG;#tx;&Hgx8Jd2q5d>8lA{$j+2U#g$IOsv8X;(c&L^-#Tk%V zY*KSs9EiY(JTYX_!r5W_G=gkXD_V9~|BpWUjOXZ-+y8YZfhY$Nqx2o@ufTpY;(^xs zO35gkW|9`WNmLG7Ar8i>4U3Ne?}8PG&k{RO;?AWq_RWp8((WPVKg3IVI>8IOC*zJk zAcGMm7Dd=Y`gK2v1%x^&2cMjYvx%FmeH}EV-e9R<86SQ0A)_q$%fzK2(I`N!rtmKYrK(h+ zc3ov;nuu2YeI58|M^TcspjFjOJDsc7n@5JG;+=Sn3tcPJT^e?S9U6*;fRkaRGWi!| zvZyOtjAXp(wx%(#_`!sTxM;}xlpWP?p#x<^HVO_so`x%>R~0FMsvFlx?WbD!Yw$x} z3Cb9?DMV>UKUGoF+5|q9halFT`QOPYGEx~s_fa=!o z1Iq&p(+fsG86x7TC!Sgwq7*y!p87u2z0reMq^SmZE}C|RTS}dX7?^xt7BEco)8IwY zbOQ*J_IiB)$;Yk9s7G`wQ4-sU<3>;(2M5dkkOZ}umRxt;4RS1?_RC*gEDzoDl+4&= zl2nK4@gi}^s?W#}A9RbqrbB91*UGH@_LK*1yN8dvfC+}_h6QituNiP{+;q)i$F1g+ zEygC1$=MBhz};b53>tXw9~LkHrS^`v7U~<@xGhm$=iA$@mvWIjNh!biQUw5 z-+SWMZ1zvzw_|QhjIMd;O;%-@8KoH4!bP7g0#s0jKz*q~g#p4K8Zd)G)Zhr}-lpN7 z)tFYl^)q+`w+8s8a z^;E@+E({v)U!Qx!s?~TjHORkizguR_`s(`}_x*S}87Gr8j_;zqhGfZDJ(N$@2vB^} zxKg?hH3TtbQm>*Q79TkU1+s3*BCJ75C3i%*to&>t3zur#lZ!Q*l8#C!z_4FliEy=!r-FWYKkufxqMhXgB z#7wpRL9z6{D^UaYB_6C#y@@OIS3z*$#~;dq1)oY)#d;H(Yx+(*%jnUgW%hpiLVj6p zdCB+m-quFqJs7YZ>wGW3?Oj2yJq zZ(0>++D0RkMQ1JudQH{E0?Q8goVA+zjcL9?UC(QsnA2!;_0l#VDR zeIjYmpg23~8^uQeiU4fAX53Q0<@yE`MNHmysNDSg61n%D`(*0W$-Tz#>$0Pwiz-Zp zI)m-f-ndQ*Crmft+1d&9-o%2a3sWX0OHrtF1P*AAgJ_Y9kuV^@K-TUi35xpPD+u+J zfoD_C`E9e+jRl{xdTd+yiUur66O{A%c*#cwzA5R7#0};yK2)W`kTt0BYZOxjEjqdF zL~B*DT;)`X16+wXf(^s2TQW;?oT?2@#G5cc`~2t&PY|(e0g_Hyl%oQvc0v^ftZ+7D zSVT>UA|tawt=JHXN0c3eI`XLRDvAOdEI{w4)L!-}3ebJ1LcOBCrb5m=_X2ru-h6Bp zi)Gd~c9%jXWNTfsy!Pr_vTpSTqNRA{{s$hAvEwGv9?z*an&;GwL5g`$bLAix>^O(j zU-+%J-Zo=eS5u23B3C~7c%gj!(L9;8|7=;ezQTk{+j*y5aBUlFvXiUJ-IkV$iV8Vy z?s0gK0G1d@*I-MihSIvsshwyp#@9|1Fsih15Ld5=@XQ)`B1$wGe;C_I*y|u3B{@7z%+KsQ&^=cRUlk+Z?d9S@F8RK`CkrSsgz9m>iAR}bXY3OlH3=?Rq zK^%e|D&wqT5kDe|04r1Vvd<(lx?Uc=?{33ge3=Ia>M#k&x}QXk^)87ciQnF5b+1o7 z-4|LDTBEmUjKamAeJ1J+(hfDCG4+&n(NM^fCQm|k6O>bacpBGPA&(U`;ASYw2Garn z(F-2fw_1%i2KB*3`~&m=n@>MoBu_r^w9KFPv9Y)F`w0WZ9UAxU{dY)mqP}Ju108dY z=6ivl)#58Jy&xA}e6j2~d#e2Tmfw=hc8WB2)T4Pt6YBNJ;V14V%{<$??|&jc{n;sU z^4yc;q*G7hgHhm36sxYpp7qNy1LnPt?x=fC9{8Kz+`m`%4nO?RUi(9_qtu_u5hKVf zAq`Qi5DyX7UUPj$36Z8rt~ED7Hk4^9fT;fhD0kFuP}hBpM5A_v>+ntAXW#wguDkBo zs&4tI+l?Xjm${f+4=fNGlp+Re>>>(K5ZP`QW16aS3r@k0+p5|eYv`^_rOHvhbzx@J z-r9@;r4H|{FD5|o7LU8mWdkS!-w6;7R1|J3(9zpBuk?bbezzzvMUhWkb#x5ehs~M8ed;lxfjud4Oi0KAEPUvZ6PjnUF4LoY~(frOQhc40;LO6K@iu@Y_IHp)NGlw`$T#9sdweA(|;(p-hMv~ z(pJAVsbBk|rFU1XV?+8^8`|cL3~7&538b=6ja#Tn6gANatJxKgq9M^z0m=}7Sl8Ji zdE^FY!Dzn|R#=}?6*kSV-fBF3184uU!W8l~KaD5DEylUt4OvDu6u z=5V5g3bmoYB5+1WBSDb)_SKFP>n!Fi0XSHUoVJ|0`ei)oaV}UdGcTXL%DL4sXV!U zgBRMSZkS@p4HLUP&u2|+ZO4Y3QQ7hiY|XN;6+86My-fPE4AQZ^@YKWd?Zc0?YNE=G z$r-xO@zN7ip+>+y?I&l*cYbh~9C7%8WUC^a6z)kYS7QG2=<`M%s=-nZoU^;k+<$lR z@PUmZU0dF1#d7o2x62i1DKEY98Z#b7b{T&v^J5;tdJgNbK67FqlaD9gw0YZ!#l*UL z>+0IP7KipKqy6S(=i<4fz!$*14)rFQXzU45jAUUR?fC1oK#^{{6wI7ArA&PR2Oe|D&i zxk4^bqS55zffB@?Q!NihmzOg&wp`S)J%_FLx8J{Io#z1IrY1!KfUN5hd%df(Cai)| z0-*G~-eFy@e^t0mK=rUX>=;rAd>@jQmP7qN~59npL#pd9kTt+A+PMZfnQf^7x~V%eX0J zgH^ow91hGE%us=+lLsXRuCKV`^>pJ=f>f&DiY*_070;N4!K$cQkpk`oU@%JN?cA zD03XxFB)HIY$jDJt#*%^p(qNg*9CP`QC$ak7ReoV-y>tnN9~A@_J#FHJ&Fp7%M7dQ zKy;-sH`Tr}i0BAI0K^Wk%>+RX5Tru`w%VW|i}MJ2ta?o-LpM$gK9p=p)8h+!mW?&M zIp6+9D8l5bH#HIUyiQy#@oU*l95KMfVGWR=3IkOjc=1MP!Mwu37wtxQ;&0;|vEuro zx2Z$FdaYSUJicuXB(~#Cnq#z&bsBcQPyz^bvvNit04_D!Ne{90G~Z_)ky^CqZGGD_ zC(IwKEsMgm8i)X{ciw-OocznVOf(`Uw}fQLy!Gl*=>9hRkFm;u9k%?am6dKF(u|w*iMQW&+t1H}QMn*8eY|vne!{io5rCnNbO$P$z*RC0cRN*{sQFFdH>Ozga!VTBifj9t z%WXwfy>8WSXONPBvCW^53Mx8@``y6-J*PgZIYcy0(E-NYDyxK#nH9W=Fi{#nLEXc& zB(E@uZ3_bveKMEz{GsjyCK?doVjVCw3-M)=YXi5T+}vD~!^7=%8t49=n+M*qo~8G> z+wQmpO7{P^_vKNV9o2o++jRF#Z?kD6&5SIK7UUo!O9MhH0u1KJf`GwsFvcM15RyZj zlYbKDz}$mW0&+XA8$31n*-B!p(4(d=9IOz-*q?ow6n zeed=6bx*5D8g1yta+Ojy!vm)2aCE`3As=+hbS}^Bi`m zzI@}A;m$knSagUpSa+0l5e=!k2j}1H*oK}VM%)kV$Nq$SFr^98k*D z;2741^OVD*IA6C{)~{nAYXL((e>fM*=Rfzrl}_^%WMZ}S2k~vN!7G{&e8;1+Il^xZ z7(_XM*VSb!ad0obSq!b{!)`D8q*4=yJwbJZN=v6F=}h0~79fukt<{l1K1U3(4H%8X zsS`VPZ4KMD?F8@kaON39_(sV=6LFs+Cu7+V)h_lldLIYE*S_{=;aA>qJzgQ&v764} z@XbH{>+s2s{$4om+>KBmUyBLNFba;J*zk!@ek?q4-&5fq{`U`Xl;$$*>^%_fd*DHI zm33-Sbr-&5Ko-6slyDmITLV-%|JEoM7VA+=SCYe`Fkmu;fe<#(E_`Yk!)PZDZsKHe znu!y-H*eV${@uU-58;bn{KK#YlY|sv%~CsFbqW z#QTLAdbzps7n_IhOkxy@&a(qMVJz!if$u;#J#FeJ#8Doc8ESRj{+*9ILy90wMDb!W zrQpcm&Me$yaw!I8u%Hsia7=i8=Kr(K+<>^!7la5@FD_3FIUOE+;QKgxqdTm>o~VYy>M7hKKYL_;d(hf?4N~so7`E5uW;iW{lvftH=H<*iR0Xi z;mcq7TKL@${hL$XNEgmJbCqr;t;vNVDoU}qc7 zsqR}XXCg1du0l)umt)UJoI8Z$7C5cuR0bb>tZNC?9gRkfD;yzN*0F75AP_^Bosdf? zi4&U~R=@I)9W2}G#4kxde$fYD>|;2%n;UHM@M-m>6*_>Nj?tZ?H(>V>Ne)=R!M0;g z84ob(#csUgcr9OwE#m3Z_hL4E54I#?5E^G7kaY1p8gc?F7Jl^bk1(khd;Q@9{mQjx zhNqu+4pV5>qoUxnGzq3rfuEYU5At^4#J&S3_M%rB@FBksgD1}v=_Hkx!m?+)xfNza znmMze@64#DGI#5i?f9{5$0iWt_|A;p3mYJ&T=imEST}y~(2>E9UuU@Owy%fRU3bl? zRP`k#n+qJ+FuJf?&;&Q?z&{>m+kv^FoMO|5k$Kr&2pt$YM($K}@X)^Sa~uJ15c^5? zVZX;0MR3P3S7r8mV)cJ9Z|JR%_q>HM?te3hF}j?z2AzjroZ!lTRNo0~lg#~^I+k|g z3vE9}IP~C(oYYyeupVc=Xe@vPWy5BQT~u~2Wk&#PgTg1yZHgywcG@sLR-T2^gcuZ8 zI7vFc#Geynb8gN7%qCrhclh(yVu3U^YTJo}9xk}>JggJ5+EDTFPrJAQGs>~02Y+($ zO=aKS;qb(dp9$}Hm(J*$8pn?xI$!qI>HSjd^y<5-Z~ zjpbnDNAc>0?-TuahaOz95{(00j0Fu%+G{}<;#TA5Xl!%l2q7@W zK0db{`u+kG;&KBB&L&ssw*q9@XwU=bQVy+Ii4UQBG2!iSxcpVGl6MSOfe%7PQM`Py zV2&|gcQ@F4@mn}PZ~ygo%8vxMt{z91um_U{xwGr$tvkZC*S#@(;~Te!4I9o|IE79V zNnLP+oEW%lU?tvl(SF&MCeU8cHhXZ0IJdK&#!PmOQtijK);pfwgvo_^D0wfIP3^%1 zPXAappC+mA5J10{19AB`bG@fe$=;70+3%E=$C<7RHgsHrE{1}0!ip(5(roov17S7x z4d<^(JKkGIaMT)qiF)zT!kvc}Ajy;BfIki7rf~lkv5?^^aF3yBEKbFgMeHku0SdeZ zjAQCNe%@q01~G}7JJ!g@BK|Nq({vKQhMc#t6GwpY@ZK}gt2{Jv2)~%yg=g~0aADf-5R?S-~-I^73`6EXI#q@x3{5eFQDl$f43Km@%*V+!|Bxw>auIlgNwh0!>bPiYXS|09i zzXnSe9(#Nf4tT)CD@_CS>WfnIEghCP4q6V#2p!bk8?wr}YGCV{Pm zgCMIi50#ihrR|&V(A?s6$4>mh;X6kgCIPm$;dC0j2JA;~l&=Cj>TJf~jsCA|Bl z-w0>n5SP_ME5h^J4r8Onz1S}Kmw|&_8{``!OJxP2+?ui%_027ToR(;c9A1j4>#n;N zv!&ODYp=dOeC9K^z7&hlvd*k`-dI~EnginaG}hJO-vG|a?Lm*5yD*G!CtlRy9&{vn z@e|HP-^2T{up9h&UI$Nzmp!AvhWBBj^boc2D`AF4yk+T?s5qBtHMDcmJ?3XVMU;1BP z!h++6!qu<63|nqr6{e50p+Wu;ekqrSfAQ}3VI33AITgP37vBt@x%CU-^}lv)_|><+ zE*!*mH75=o3-|oR--Rn)yAivho^7llMC@&vyL>5ojnS1LQ%xAmkj}DR;?c`DZVZ2g z4F-9NJQtLo&Y`|>&tIuob9QWg7R`-y4GXui2)PXtGyCujzo%DMKJ4fI{b;MQ~$0)bBq0aeXR|NyHvr+>@&dpO)w?+p!(|Q4C!5<9p&M3z?r_7f!|)Od0L*sWT)< zeMD{(##6gWj@-P6WFwxF81FgWzzhm=OWX-8UgSW?VH{#Hg6{PI_I&R?V^D_YkDzBb z%`Un-gbHbC6A^ z?cWK(<^ljJz+_;Rfh%;p^2%$&t)Kp{VbcT8hCliE9pPt>{4AV-T^9yc_J-@PzcT#d zFJ2HXx?}^sy>w&RP=8q7-50*~Kkp9r+;uNr@9vQO{;5LxRnngvQA@m=mQ8xc0`!Z* z#ZC^wUHMpE2G65DlAXgOPMbFkt>83evWV~^wm>`1isdvJj-mGAz#6({Ice{=U;nDD)-D1h=1l2fDv)g-});c&}lT0q1thYZ)Uq%ufBO88kNDsxHc z5>3jmSfjiKltsXc)B^hK#`xU`6>18-J2T=i%&m_&xB64P`-0Zh)OL)w+?dCRwm0c1TK)I9 z>2DR@dI>_3E@+<38idHGy^s}qh1>#zD@sOi`pz~Ok>@e;gzy9Vj)kF(gYr#6-t#H1 z6_L1lFh zoN(SXJ{`_Jdqeo}fBr~#|9jsP?*5zagwKBdi}-cqua9!zgE|9_@q;(LE4=6Zzl$xE zbt@boAUJoI<}jBcNZBRFvv>~5FkOBD#6;<#r+hD6g3K;ftH|uwEMnJMz#D2U!kjYn zxlh8W@rXdS8J@w)vs2MP<#@sUSYp?^e0gZY(z_wdxZoQW&j=ky&u|peZ6>j}pSxgm zp;Oc0J+C@lteQ2JC9gjxTNlx?;17}`RAmxZmqiGJb#$z46dbvtI3n8*h?%VFQ3$i< z7xS&c>kw9QkHLVOA2<*m8h%uEOz6X_Zz<-xsOnEn!dMHBW^jXKf*9zf*Q<91+ejJYy8!DlxSN{%VrT_bo^fEt#NMkqszjG^5cTT*9{wO9eml zZ!ZoX`ryCDjte_chfrAn-}KDm;o@`FhI3wV38dsskoL?OQVFL0A$dMvkTr?5pFDuL z9Q31b`odApuSZ9P|cbz@EO(DE}di{mgl zC^(phdvakAa}4K$VgiP&EIEN!;{H{uF$o(xss-U1>b`=%|1Q)PkTbK{cv!Ww&Y0K-`C(lCsbBunwh=Qxgv9L0C`p1yuKMy%Pz2BUqe)`p?}> z3(Jhi=OpGCM*(u-~oH;@w=ZX>oAb1gBEQFfx0*qJl zo9F?HzaV*8vt2?=} z@r0W>Ixnx#14bz-LpeGR{;WtI3?&CC<4(tz0`b#eh{_}gR21St&^)bW@~q~k=Wq!l zf8mOBPCvK1>Rn5F60)Yy!$p_Bmi1!BLRkRMSRQj5&h1HL;0FgtrqNEh(M2~0 zNT$##G59#a6Vu=bd$5oHFr48ux_>9Il{v89~x?8kHHAt7Y{< zs{>SgXD!cyAUBL=tBt@sr*RyAIEJcr0V7dG>`X(uVsxyE89`21xGTOtWK}3fP(EeZ zIYxEd^{CE08E7{?xGzxn+Yf#ZXMUdSz5olP?5P#QA8W0PgT4BOGYJPrhr#cLV>l|X zZ*VELwmy!(F-)r7kJVJz)UX@#gE1py309)W01DP8_v7Fh`LRQ%CIzj`UJq4Pt96XD z376vx@;Oq#xev(j3Q?4cX>vhhavchjPSmj1{=uVrX=aI8CM3K*n`dac+o-7K3 zNsxH`g}f3zN2ky|b)e0manmtMYPHw3`#lR6BS`rO`%Fui^OAAU@h#kQl39>)PE zdvusQz{Z0xfB6uI7tfNhz`FcGUUq7oVG#<)$A^1BNeE{I0k{$p&-57Ln9kecbif@9|q3EcHlb(~hB+@oGMQM{-@4aWorljqHTy$Rn z<%Jm-oW2)ZDcg}q623b1P34ll;0O(q*a)Obja_{N8&PWwiH?sOFi0aOCu{sdEv!W= z&F6<#2q-pm5XHcJ6f*NB&NrgWGNQ7IMAR+*F~T4+BUG%CuoOk{)MAWFQ9&XlG(P@t zG74f!nbp!7*L*@;0ji*%1pGk?PG$?GQ9O+&+MJK(sokBXd~c|H5h3TPKpsE0kfG|C zEu{R@N!DYJKOKJmv!BBmpFa=118bxQco@@a@SY5(hs6ju`n?l_T-+0&9k0%l*dJg? z{|Y%ZHdOc$YTgbq>t55EO!fMdtN9qHLqm0qkjRO04}NTUIrAQv-C05TifLlHA;pkffb zv+Jiwb*h@Je0+q5x^i9<P~cRY5h)Dr!i)gPE$UH7IgZ~olltX<;9d&A7a%Xz zGjj~jlAL-CC{gTfbp9Zjq--scN|rdg{VW#=tz0>cmKj+&Q`P_hc?tY3(j~8O5xW&2 zF@aLXcrnrluXmcHlmZl4oMftChm+*>!jsQ``CHSOa%Yy!e#htj#~+2=&paBI46O@G zSD%kH`g<^08WXMI^v3Wla1@&`@QlwMY)ssR6=8IU9oUtIoR?r(Uib3VVdK~u3y7*lKPf(O0Ud>W$;4XV|`0`jB{%+@fk+Ox;ly8EQ1cJcpX(*>LG2( zIO#?&f=&XqXlqUlj*twD8JLh!`m+(#{ zKnW9jWb0N!1~OUh%#_&j=p4jBfT77we9e-Hjl>9T3=m?0Y&1nh6zH6oWL&_AFdl;> zlGA0bIzeC~&sdpyno|0h13Wngg@yn2JNJYKfAC#6H0(ZuIj{%!Yz-5b-`j?Hw_URN0(O|k z)S5&4cZI`;_Fw`w&N0D(-D4x%kO4o`SYet*?+Ca5`R(G2D6XMy zi78T@(>AYFI@V)vqoC)Av^Xj{im$%rdw(B7VJ?8yO?0oU^W-wQi?;YHz*Psei8@~I zZBil?;ve%T#PKspandf~ZIzOo=Ov)=fu+39Q#`&0QiOCvMHfoue_rrMO%S9oz$aXk zHn<=oUr+^+7Y)hyd$`yChC!!Uay#B89>%u>2Q+IC-!|8>DA7 z3;ini%tZaZ_ump8e&|8G4zI*<7dUqpqsAS*I2|56t*-td?7fNeK(Qom><|ue!kk%Z z$kkijeS=tWat5}#!(ry=Eq3+xW8-DuaNY9Mp77PL{YkiJ!^Ja+&g!C~rSfVE(W1a- z;FXrUS!o@yHX?PHZ$gCgM?STx*yBW<=O8laq&*VHsv5~<+7GrFYsX=8#B&y<*JLsP z3s6WS*5sV7bY|)Zpf>o4<8w|>fVzqt$HU!=#k-C?D@2W>#HzR&#tW+@Wxi0Nu=?64 z5HG3ZQm{xyig%Yt%({?plzYO{GFV#5nDR8Hr6!$Ajqt=)L86XX3Gt*h?MMc=2oBMS zz&k4gCNEpL3CWP`n+r*ukoT%kR;HZJX)5xPvN>Xtc%3dvmRIs7j9!rJ1(7e$C0D<~ zwt03r?&uAC%7`ibgCG7d{N%BpV3Xu!*o2ikQV)hfoU=2CrLW7D4~AZx1=J2l*M)(L zrP#i|Z*T~MBRyg1&;WL)!AXP1uqzElmvO;5%qraH`A0?ohR+n@LT*lXm%4QT^7zlh%iDVL`tYCt~z zwP9{E@usE}PTp+FIo7fgCtrf;hq4rv4cp<_KbPS?481a@yzBf?)}LTYPNR^+)%ayJ4dk- zHH~8}o*9UiGqF%-_s;dS7 z13ug$ACbU|BRdm8b08B+DCJ_sk;;(i7Ym%z2$QCl*_5>@vzHP=wAo8ZY1cJ>&Uqa9 zR<1p}o)4e<{Aa_4UwU=;{`bCvfnqoeY#c&wB(I=YmNq^*fnMPmIPQ}b7jGK)q&1CI zC8HQX;m9&ygC{WGunkM|xRw72Y}l}D#hFNVBkv%l;2g(aaNb5ov!blcK-BJ)uiJ6x+r&M?>uS85^p;9d= zPh?VSbM47u&X2_4R}d9BYhJ;!PUm+g^t;2W?ombyxA z`=_3I3g=1OC2e~e?}x|H-P5g<+R$C%CIGB`SQpFP6;K~I*|!%vGVt3LPe`NZp#M3D zGgrsp1=%&@iSg~MI|%9@bUP*P>9yV*A3XzkNFeu;Or81v~^jRl3R;m{ts}u;UY>Q(&!|CinP{s?^RJm zI|nfEVN^O22&IbL3bJxS6_9q5XPEV@tOo{$f8G%lb^_At4 zt+lz+3DX>TMSGx=WT10a9B&WWiDHwXlanbcD1+dzosb6qtTh2HY*qJWj!-1Fe9@AK z0Mb-7P%%VRgYpNLc*w^-vSAU(Oa9~HC5U<{jV6&l&w(6s2|0VJMRgcragi3#C$D@Q zk1);!a6UPW&}A2`)Bw0Z5-|xOTG^FLvN1CS!xS(AqhU_eiwPQ$A=;3{iAM6|Qihk) z8D`Wi!4_k=1>^w%P-W*FPvhxXm-6B>E5Xaj@}sJutCG_QD>6&@3TK*|6?WQO7At{O zFD);7X;OAnMCn=Dlm@N1ba?tPF}F{WLymNOipO3g1KWa(j6wwClIFWU@U(Y`cV{B{ z1+PwYfZ7(Qm+H?nWu*XK^WhXDQ!p1%Y75BGhzh3iNwmfq004u7{>QHYjYW|0wO^~~ zBqO`LPy|--jmRe*DU?SFEGjnT>vTDy6c2zrPs*Gl#qy{ysW6f+j~TR)OQPa~cDRsL z;3Vvtm=&%jm*A*NqtX>rGx3`#uY%Q!8Z?`-%-iRUofC8~7tj3k<; zt9X)!hm05GD-Wk(o;`bZ#iCpRTb)oGzK4>Q|76vLv4|ZW=Hs8VY2&F}cqI@0D6aW% zgmj?%hx+Eul>B4xsN}0$$0rWOD@sHZQgeg^I*J!o@>{w{L7|`+3w+|Jrcp~n6%j52 z88MxS$g;rnsWXr_`GGSoll~-okljIp);t-Xl=vtf{f2MdW z$V^DH$rG(+LoiF+`QT3;2x>r$+f_jRjOy%PpqNbp+$&@%2g#^mR+m==2TZ_ueInb0 ztA4=IQXS)KE+-mGTdvfEy|?68g%8P1BuVJh=-wIwk??0WRUJ%rt)0n71*jv83_PPz zOf3Yo@(+cK!OI@mIRF?c*Y%A?(FSLkKoes{mKssR&=B;AFqolp0uiG!n^ch^m~c_+N$jm9XYwJDAVODp39l(t~9OVi$q*9WoKev$Sdky$eMFvzIis| z$9x7a|4jIv=Xa&lx?#^94=mZf*|ShS`SXq(nS~H}SzUF>iAM4Ks&G$Hr%0i72_V*U zg%i)(nY1zBI=a~dB`|!FAk*5S%TbW>W4st5GXWQ*f)9Bx2h!iJ+rfM^1VEF8`P>{{dr!A6kJxDtRSmTo8zaS9IR&qIcm(o{A?o zqA;*`j9Xgfp)l2p2n@uaY?e!IxR?Y>i#-KOfCthcEkyBVnatCW(+azsh2f~~PEouo zed1Tlt%6qyP_lw?oRjmYpmUUXcU%XQ(+>B0D?EwYj8CilD6dgwqkSpQ@%*04P<@Iy zTJIf8?_TdvfqVQz;QZ5_k3Ct zMiIM|I7t%OM2-2906^eOusFHgE)d~d<7!BB~vPj zR#J7Kgeq#%+At$-QY6z|qhUm3w@Q!oRzmMuUUQ>znnf<`ZB-9bZ)=KTz&3* zPHtnzsh|UhOCSVOvYm#BazLK60lNum!q?{E>5Nu0GJri|2xD;Fi?*b)O3N#w zS~pYsb2`VW;^%p}d8}BmmS$ocectayM+gn1KrY6#^8zT?Fw98$)Mz-sU1PU@hAJS3 z8~@0n0$#*tDrcU@$;_OLG1Ld3!ns>4sp-%dT$FGS6y;TLKv6NJ@Cx8}Lft0L&pZ;d zBq$53)O?MngT$YFKjqx1s0q*$YIe!()EX|aq9vP=w2;sG;I?Q1y*bJg|NZXoh7jihR1uhcRB#nS z6Ig|PwGw5faT`_O^7#nZab^-nM1~@6s#k=ojPxv(CKb!9HAW$<{FteAy#4#aHV1mN9rH$6{iK|>BBVLHF+Nnd}93xJvcU(G2jzTdAo)y;1 zt8mSWWg@O6^agH-Py^C=c{HYycok=q=}%mlOiFFo3s6)oqY?`%;R*g`Wh!F<1e7au zyyS86CK{+jNl6HAe}?=_z%1n(nHukMnqcLj2zlH{vYXq7prR9Yq$>W7Tg99B{^vYe zy|d0#@obg86+G%@GG>w`&w~7_%93>SXCy3zAM0oVzAjh|3dGO#?j*D z5=^v}hlOS#{4USe%Su#_=bQkStcKE4P9k!?3R4~20Gc8$1BEzK!~{&Ipo(Q21(jf~ zyU}cx5db6-envqg3;eF=2Gw30^RzNBMwpCTlb6t>%AsXQe3hl9wM>jNIHjhNlM)G3 z(=!BB%bI$TO7FaY>LPK^pvEU>Mz-a&(>t6v49-+jbGx>}qYkGIUZ=@S_;by3Su@c) zPP!-T6id0~nB(}}^OZB=Qw^ROSgi4)12BQPyt3=An$4% z5-~I7Ik`L-A(U*xC!i{*18&UWgK%h!*z<&7Q-U{fR6useC3(~hA@TrXbb^Hp(mOIU z7}weDgvUH)c>r9TmhdFd(n*-WwDgfk@d`LSl%E#r}6IeekTUwnI4jM${g;ny1Vnq zc{{G>dAfXWMNS+Zj*2j#Wz@=sz$DEfbW6#xj z73wsAz_n3rOH(JGeDn+hjG2|^`mC3@w}Y=`-sT#2mq5C)D#6l5`9ZN*sT z^aWYz@-k^9Wv1H3Z-QYsTo`bYNJI-BY)Hrfi#XqUTzbm7ZkZTeS$1( zEPFLhg>e;JX;1Sm#)#Hdn!K=$xN5ZApb3X25{?NJV`@G;q7o#dKvvO!ZgL|*CLb=e z1OUkVkEo<0s=`Tu7%p;UEDJ(}JpOJ(LV2h@(2*fG;E;1|r4~Z+RJjyiC=<&d6H;>t z`i-;jJ4OyrpuRlRM9%;0uyBoq}b@l=17L&08;JYS*e2c#&#qnd^uOQ(1V?rGk0o;iFW + +[![Build Status](https://travis-ci.org/TyOverby/bincode.svg)](https://travis-ci.org/TyOverby/bincode) +[![](http://meritbadge.herokuapp.com/bincode)](https://crates.io/crates/bincode) + +A compact encoder / decoder pair that uses an binary zero-fluff encoding scheme. +The size of the encoded object will be the same or smaller than the size that +the object takes up in memory in a running Rust program. + +In addition to exposing two simple funcitons that encode to Vec and decode +from Vec, binary-encode exposes a Reader/Writer API that makes it work +perfectly with other stream-based apis such as rust files, network streams, +and the [flate2-rs](https://github.com/alexcrichton/flate2-rs) compression +library. + +[Api Documentation](http://tyoverby.github.io/bincode/bincode/) + +## Example + +^code(./examples/basic.rs) + + +## Details + +The encoding (and thus decoding) proceeds unsurprisingly -- primitive +types are encoded according to the underlying `Writer`, tuples and +structs are encoded by encoding their fields one-by-one, and enums are +encoded by first writing out the tag representing the variant and +then the contents. + +However, there are some implementation details to be aware of: + +* `isize`/`usize` are encoded as `i64`/`u64`, for portability. +* enums variants are encoded as a `u32` instead that as a `uint`. + `u32` is enough for all practical uses. +* `str` is encoded as `(u64, &[u8])`, where the `u64` is the number of + bytes contained in the encoded string. diff --git a/third_party/rust/bincode/readme.md b/third_party/rust/bincode/readme.md new file mode 100644 index 000000000000..ffc1658bba5f --- /dev/null +++ b/third_party/rust/bincode/readme.md @@ -0,0 +1,72 @@ +# Bincode + + + +[![Build Status](https://travis-ci.org/TyOverby/bincode.svg)](https://travis-ci.org/TyOverby/bincode) +[![](http://meritbadge.herokuapp.com/bincode)](https://crates.io/crates/bincode) +[![](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) + +A compact encoder / decoder pair that uses an binary zero-fluff encoding scheme. +The size of the encoded object will be the same or smaller than the size that +the object takes up in memory in a running Rust program. + +In addition to exposing two simple functions that encode to Vec and decode +from Vec, binary-encode exposes a Reader/Writer API that makes it work +perfectly with other stream-based apis such as rust files, network streams, +and the [flate2-rs](https://github.com/alexcrichton/flate2-rs) compression +library. + +[Api Documentation](http://tyoverby.github.io/bincode/bincode/) + +## Example +```rust +extern crate bincode; +extern crate rustc_serialize; + +use bincode::SizeLimit; +use bincode::rustc_serialize::{encode, decode}; + +#[derive(RustcEncodable, RustcDecodable, PartialEq)] +struct Entity { + x: f32, + y: f32, +} + +#[derive(RustcEncodable, RustcDecodable, PartialEq)] +struct World { + entities: Vec +} + +fn main() { + let world = World { + entities: vec![Entity {x: 0.0, y: 4.0}, Entity {x: 10.0, y: 20.5}] + }; + + let encoded: Vec = encode(&world, SizeLimit::Infinite).unwrap(); + + // 8 bytes for the length of the vector, 4 bytes per float. + assert_eq!(encoded.len(), 8 + 4 * 4); + + let decoded: World = decode(&encoded[..]).unwrap(); + + assert!(world == decoded); +} + +``` + + +## Details + +The encoding (and thus decoding) proceeds unsurprisingly -- primitive +types are encoded according to the underlying `Writer`, tuples and +structs are encoded by encoding their fields one-by-one, and enums are +encoded by first writing out the tag representing the variant and +then the contents. + +However, there are some implementation details to be aware of: + +* `isize`/`usize` are encoded as `i64`/`u64`, for portability. +* enums variants are encoded as a `u32` instead of a `uint`. + `u32` is enough for all practical uses. +* `str` is encoded as `(u64, &[u8])`, where the `u64` is the number of + bytes contained in the encoded string. diff --git a/third_party/rust/bincode/src/lib.rs b/third_party/rust/bincode/src/lib.rs new file mode 100644 index 000000000000..138a9e08e9fd --- /dev/null +++ b/third_party/rust/bincode/src/lib.rs @@ -0,0 +1,79 @@ +//! `bincode` is a crate for encoding and decoding using a tiny binary +//! serialization strategy. +//! +//! There are simple functions for encoding to `Vec` and decoding from +//! `&[u8]`, but the meat of the library is the `encode_into` and `decode_from` +//! functions which respectively allow encoding into a `std::io::Writer` +//! and decoding from a `std::io::Buffer`. +//! +//! ## Modules +//! There are two ways to encode and decode structs using `bincode`, either using `rustc_serialize` +//! or the `serde` crate. `rustc_serialize` and `serde` are crates and and also the names of their +//! corresponding modules inside of `bincode`. Both modules have exactly equivalant functions, and +//! and the only difference is whether or not the library user wants to use `rustc_serialize` or +//! `serde`. +//! +//! ### Using Basic Functions +//! +//! ```rust +//! #![allow(unstable)] +//! extern crate bincode; +//! use bincode::rustc_serialize::{encode, decode}; +//! fn main() { +//! // The object that we will serialize. +//! let target = Some("hello world".to_string()); +//! // The maximum size of the encoded message. +//! let limit = bincode::SizeLimit::Bounded(20); +//! +//! let encoded: Vec = encode(&target, limit).unwrap(); +//! let decoded: Option = decode(&encoded[..]).unwrap(); +//! assert_eq!(target, decoded); +//! } +//! ``` + +#![crate_name = "bincode"] +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +#![doc(html_logo_url = "./icon.png")] + +#[cfg(feature = "rustc-serialize")] +extern crate rustc_serialize as rustc_serialize_crate; +extern crate byteorder; +extern crate num_traits; +#[cfg(feature = "serde")] +extern crate serde as serde_crate; + + +pub use refbox::{RefBox, StrBox, SliceBox}; + +mod refbox; +#[cfg(feature = "rustc-serialize")] +pub mod rustc_serialize; +#[cfg(feature = "serde")] +pub mod serde; + +/// A limit on the amount of bytes that can be read or written. +/// +/// Size limits are an incredibly important part of both encoding and decoding. +/// +/// In order to prevent DOS attacks on a decoder, it is important to limit the +/// amount of bytes that a single encoded message can be; otherwise, if you +/// are decoding bytes right off of a TCP stream for example, it would be +/// possible for an attacker to flood your server with a 3TB vec, causing the +/// decoder to run out of memory and crash your application! +/// Because of this, you can provide a maximum-number-of-bytes that can be read +/// during decoding, and the decoder will explicitly fail if it has to read +/// any more than that. +/// +/// On the other side, you want to make sure that you aren't encoding a message +/// that is larger than your decoder expects. By supplying a size limit to an +/// encoding function, the encoder will verify that the structure can be encoded +/// within that limit. This verification occurs before any bytes are written to +/// the Writer, so recovering from an error is easy. +#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)] +pub enum SizeLimit { + Infinite, + Bounded(u64) +} + diff --git a/third_party/rust/bincode/src/refbox.rs b/third_party/rust/bincode/src/refbox.rs new file mode 100644 index 000000000000..fb9112416dc2 --- /dev/null +++ b/third_party/rust/bincode/src/refbox.rs @@ -0,0 +1,434 @@ +use std::boxed::Box; +use std::ops::Deref; + +#[cfg(feature = "rustc-serialize")] +use rustc_serialize_crate::{Encodable, Encoder, Decodable, Decoder}; + +#[cfg(feature = "serde")] +use serde_crate as serde; + +/// A struct for encoding nested reference types. +/// +/// Encoding large objects by reference is really handy. For example, +/// `encode(&large_hashmap, ...)` encodes the large structure without having to +/// own the hashmap. However, it is impossible to serialize a reference if that +/// reference is inside of a struct. +/// +/// ```ignore rust +/// // Not possible, rustc can not decode the reference. +/// #[derive(RustcEncoding, RustcDecoding)] +/// struct Message<'a> { +/// big_map: &'a HashMap, +/// message_type: String, +/// } +/// ``` +/// +/// This is because on the decoding side, you can't create the Message struct +/// because it needs to have a reference to a HashMap, which is impossible because +/// during deserialization, all members need to be owned by the deserialized +/// object. +/// +/// This is where RefBox comes in. During serialization, it serializs a reference, +/// but during deserialization, it puts that sub-object into a box! +/// +/// ```ignore rust +/// // This works! +/// #[derive(RustcEncoding, RustcDecoding)] +/// struct Message<'a> { +/// big_map: RefBox<'a, HashMap>, +/// message_type: String +/// } +/// ``` +/// +/// Now we can write +/// +/// ```ignore rust +/// let my_map = HashMap::new(); +/// let my_msg = Message { +/// big_map: RefBox::new(&my_map), +/// message_type: "foo".to_string() +/// }; +/// +/// let encoded = encode(&my_msg, ...).unwrap(); +/// let decoded: Message<'static> = decode(&encoded[]).unwrap(); +/// ``` +/// +/// Notice that we managed to encode and decode a struct with a nested reference +/// and that the decoded message has the lifetime `'static` which shows us +/// that the message owns everything inside it completely. +/// +/// Please don't stick RefBox inside deep data structures. It is much better +/// suited in the outermost layer of whatever it is that you are encoding. +#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Clone)] +pub struct RefBox<'a, T: 'a> { + inner: RefBoxInner<'a, T, Box> +} + +/// Like a RefBox, but encoding from a `str` and decoedes to a `String`. +#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Clone)] +pub struct StrBox<'a> { + inner: RefBoxInner<'a, str, String> +} + +/// Like a RefBox, but encodes from a `[T]` and encodes to a `Vec`. +#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Clone)] +pub struct SliceBox<'a, T: 'a> { + inner: RefBoxInner<'a, [T], Vec> +} + +#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] +enum RefBoxInner<'a, A: 'a + ?Sized, B> { + Ref(&'a A), + Box(B) +} + +impl<'a, T> Clone for RefBoxInner<'a, T, Box> where T: Clone { + fn clone(&self) -> RefBoxInner<'a, T, Box> { + match *self { + RefBoxInner::Ref(reff) => RefBoxInner::Box(Box::new(reff.clone())), + RefBoxInner::Box(ref boxed) => RefBoxInner::Box(boxed.clone()) + } + } +} + +impl<'a> Clone for RefBoxInner<'a, str, String> { + fn clone(&self) -> RefBoxInner<'a, str, String> { + match *self { + RefBoxInner::Ref(reff) => RefBoxInner::Box(String::from(reff)), + RefBoxInner::Box(ref boxed) => RefBoxInner::Box(boxed.clone()) + } + } +} + +impl<'a, T> Clone for RefBoxInner<'a, [T], Vec> where T: Clone { + fn clone(&self) -> RefBoxInner<'a, [T], Vec> { + match *self { + RefBoxInner::Ref(reff) => RefBoxInner::Box(Vec::from(reff)), + RefBoxInner::Box(ref boxed) => RefBoxInner::Box(boxed.clone()) + } + } +} + +impl <'a, T> RefBox<'a, T> { + /// Creates a new RefBox that looks at a borrowed value. + pub fn new(v: &'a T) -> RefBox<'a, T> { + RefBox { + inner: RefBoxInner::Ref(v) + } + } +} + +impl RefBox<'static, T> { + /// Takes the value out of this refbox. + /// + /// Fails if this refbox was not created out of a deserialization. + /// + /// Unless you are doing some really weird things with static references, + /// this function will never fail. + pub fn take(self) -> Box { + match self.inner { + RefBoxInner::Box(b) => b, + _ => unreachable!() + } + } + + /// Tries to take the value out of this refbox. + pub fn try_take(self) -> Result, RefBox<'static, T>> { + match self.inner { + RefBoxInner::Box(b) => Ok(b), + o => Err(RefBox{ inner: o}) + } + } +} + +#[cfg(feature = "rustc-serialize")] +impl <'a, T: Encodable> Encodable for RefBox<'a, T> { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + self.inner.encode(s) + } +} + +#[cfg(feature = "rustc-serialize")] +impl Decodable for RefBox<'static, T> { + fn decode(d: &mut D) -> Result, D::Error> { + let inner = try!(Decodable::decode(d)); + Ok(RefBox{inner: inner}) + } +} + +#[cfg(feature = "serde")] +impl<'a, T> serde::Serialize for RefBox<'a, T> + where T: serde::Serialize, +{ + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: serde::Serializer + { + serde::Serialize::serialize(&self.inner, serializer) + } +} + +#[cfg(feature = "serde")] +impl<'a, T: serde::Deserialize> serde::Deserialize for RefBox<'a, T> { + fn deserialize(deserializer: &mut D) -> Result + where D: serde::Deserializer + { + let inner = try!(serde::Deserialize::deserialize(deserializer)); + Ok(RefBox{ inner: inner }) + } +} + +impl<'a> StrBox<'a> { + /// Creates a new StrBox that looks at a borrowed value. + pub fn new(s: &'a str) -> StrBox<'a> { + StrBox { + inner: RefBoxInner::Ref(s) + } + } + + /// Extract a String from a StrBox. + pub fn into_string(self) -> String { + match self.inner { + RefBoxInner::Ref(s) => String::from(s), + RefBoxInner::Box(s) => s + } + } + + /// Convert to an Owned `SliceBox`. + pub fn to_owned(self) -> StrBox<'static> { + match self.inner { + RefBoxInner::Ref(s) => StrBox::boxed(String::from(s)), + RefBoxInner::Box(s) => StrBox::boxed(s) + } + } +} + +impl<'a> AsRef for StrBox<'a> { + fn as_ref(&self) -> &str { + match self.inner { + RefBoxInner::Ref(ref s) => s, + RefBoxInner::Box(ref s) => s + } + } +} + +impl StrBox<'static> { + /// Creates a new StrBox made from an allocated String. + pub fn boxed(s: String) -> StrBox<'static> { + StrBox { inner: RefBoxInner::Box(s) } + } + + /// Takes the value out of this refbox. + /// + /// Fails if this refbox was not created out of a deserialization. + /// + /// Unless you are doing some really weird things with static references, + /// this function will never fail. + pub fn take(self) -> String { + match self.inner { + RefBoxInner::Box(b) => b, + RefBoxInner::Ref(b) => String::from(b) + } + } + + /// Tries to take the value out of this refbox. + pub fn try_take(self) -> Result> { + match self.inner { + RefBoxInner::Box(b) => Ok(b), + o => Err(StrBox{ inner: o}) + } + } +} + +#[cfg(feature = "rustc-serialize")] +impl <'a> Encodable for StrBox<'a> { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + self.inner.encode(s) + } +} + +#[cfg(feature = "rustc-serialize")] +impl Decodable for StrBox<'static> { + fn decode(d: &mut D) -> Result, D::Error> { + let inner: RefBoxInner<'static, str, String> = try!(Decodable::decode(d)); + Ok(StrBox{inner: inner}) + } +} + +#[cfg(feature = "serde")] +impl<'a> serde::Serialize for StrBox<'a> { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: serde::Serializer + { + serde::Serialize::serialize(&self.inner, serializer) + } +} + +#[cfg(feature = "serde")] +impl serde::Deserialize for StrBox<'static> { + fn deserialize(deserializer: &mut D) -> Result + where D: serde::Deserializer + { + let inner = try!(serde::Deserialize::deserialize(deserializer)); + Ok(StrBox{ inner: inner }) + } +} + +// +// SliceBox +// + +impl <'a, T> SliceBox<'a, T> { + /// Creates a new RefBox that looks at a borrowed value. + pub fn new(v: &'a [T]) -> SliceBox<'a, T> { + SliceBox { + inner: RefBoxInner::Ref(v) + } + } + + /// Extract a `Vec` from a `SliceBox`. + pub fn into_vec(self) -> Vec where T: Clone { + match self.inner { + RefBoxInner::Ref(s) => s.to_vec(), + RefBoxInner::Box(s) => s + } + } + + /// Convert to an Owned `SliceBox`. + pub fn to_owned(self) -> SliceBox<'static, T> where T: Clone { + match self.inner { + RefBoxInner::Ref(s) => SliceBox::boxed(s.to_vec()), + RefBoxInner::Box(s) => SliceBox::boxed(s) + } + } +} + +impl SliceBox<'static, T> { + /// Creates a new SliceBox made from an allocated `Vec`. + pub fn boxed(s: Vec) -> SliceBox<'static, T> { + SliceBox { inner: RefBoxInner::Box(s) } + } + + /// Takes the value out of this refbox. + /// + /// Fails if this refbox was not created out of a deserialization. + /// + /// Unless you are doing some really weird things with static references, + /// this function will never fail. + pub fn take(self) -> Vec { + match self.inner { + RefBoxInner::Box(b) => b, + _ => unreachable!() + } + } + + /// Tries to take the value out of this refbox. + pub fn try_take(self) -> Result, SliceBox<'static, T>> { + match self.inner { + RefBoxInner::Box(b) => Ok(b), + o => Err(SliceBox{ inner: o}) + } + } +} + +#[cfg(feature = "rustc-serialize")] +impl <'a, T: Encodable> Encodable for SliceBox<'a, T> { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + self.inner.encode(s) + } +} + +#[cfg(feature = "rustc-serialize")] +impl Decodable for SliceBox<'static, T> { + fn decode(d: &mut D) -> Result, D::Error> { + let inner: RefBoxInner<'static, [T], Vec> = try!(Decodable::decode(d)); + Ok(SliceBox{inner: inner}) + } +} + +#[cfg(feature = "serde")] +impl<'a, T> serde::Serialize for SliceBox<'a, T> + where T: serde::Serialize, +{ + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: serde::Serializer + { + serde::Serialize::serialize(&self.inner, serializer) + } +} + +#[cfg(feature = "serde")] +impl<'a, T: serde::Deserialize> serde::Deserialize for SliceBox<'a, T> { + fn deserialize(deserializer: &mut D) -> Result + where D: serde::Deserializer + { + let inner = try!(serde::Deserialize::deserialize(deserializer)); + Ok(SliceBox{ inner: inner }) + } +} + +#[cfg(feature = "rustc-serialize")] +impl <'a, A: Encodable + ?Sized, B: Encodable> Encodable for RefBoxInner<'a, A, B> { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + match self { + &RefBoxInner::Ref(ref r) => r.encode(s), + &RefBoxInner::Box(ref b) => b.encode(s) + } + } +} + +#[cfg(feature = "serde")] +impl<'a, A: ?Sized, B> serde::Serialize for RefBoxInner<'a, A, B> + where A: serde::Serialize, + B: serde::Serialize, +{ + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: serde::Serializer + { + match self { + &RefBoxInner::Ref(ref r) => serde::Serialize::serialize(r, serializer), + &RefBoxInner::Box(ref b) => serde::Serialize::serialize(b, serializer), + } + } +} + +#[cfg(feature = "rustc-serialize")] +impl Decodable for RefBoxInner<'static, A, B> { + fn decode(d: &mut D) -> Result, D::Error> { + let decoded = try!(Decodable::decode(d)); + Ok(RefBoxInner::Box(decoded)) + } +} + +#[cfg(feature = "serde")] +impl<'a, A: ?Sized, B> serde::Deserialize for RefBoxInner<'a, A, B> + where B: serde::Deserialize, +{ + fn deserialize(deserializer: &mut D) -> Result + where D: serde::Deserializer + { + let deserialized = try!(serde::Deserialize::deserialize(deserializer)); + Ok(RefBoxInner::Box(deserialized)) + } +} + +impl <'a, T> Deref for RefBox<'a, T> { + type Target = T; + + fn deref(&self) -> &T { + match &self.inner { + &RefBoxInner::Ref(ref t) => t, + &RefBoxInner::Box(ref b) => b.deref() + } + } +} + +impl <'a, T> Deref for SliceBox<'a, T> { + type Target = [T]; + + fn deref(&self) -> &[T] { + match &self.inner { + &RefBoxInner::Ref(ref t) => t, + &RefBoxInner::Box(ref b) => b.deref() + } + } +} diff --git a/third_party/rust/bincode/src/rustc_serialize/mod.rs b/third_party/rust/bincode/src/rustc_serialize/mod.rs new file mode 100644 index 000000000000..2b75e804bcc7 --- /dev/null +++ b/third_party/rust/bincode/src/rustc_serialize/mod.rs @@ -0,0 +1,102 @@ +//! A collection of serialization and deserialization functions +//! that use the `rustc_serialize` crate for the encodable and decodable +//! implementation. + +use rustc_serialize_crate::{Encodable, Decodable}; +use std::io::{Write, Read}; +use ::SizeLimit; + +pub use self::writer::{SizeChecker, EncoderWriter, EncodingResult, EncodingError}; +pub use self::reader::{DecoderReader, DecodingResult, DecodingError, InvalidEncoding}; + +mod reader; +mod writer; + +/// Encodes an encodable object into a `Vec` of bytes. +/// +/// If the encoding would take more bytes than allowed by `size_limit`, +/// an error is returned. +pub fn encode(t: &T, size_limit: SizeLimit) -> EncodingResult> { + // Since we are putting values directly into a vector, we can do size + // computation out here and pre-allocate a buffer of *exactly* + // the right size. + let mut w = if let SizeLimit::Bounded(l) = size_limit { + let actual_size = encoded_size_bounded(t, l); + let actual_size = try!(actual_size.ok_or(EncodingError::SizeLimit)); + Vec::with_capacity(actual_size as usize) + } else { + vec![] + }; + + match encode_into(t, &mut w, SizeLimit::Infinite) { + Ok(()) => Ok(w), + Err(e) => Err(e) + } +} + +/// Decodes a slice of bytes into an object. +/// +/// This method does not have a size-limit because if you already have the bytes +/// in memory, then you don't gain anything by having a limiter. +pub fn decode(b: &[u8]) -> DecodingResult { + let mut b = b; + decode_from(&mut b, SizeLimit::Infinite) +} + +/// Encodes an object directly into a `Writer`. +/// +/// If the encoding would take more bytes than allowed by `size_limit`, an error +/// is returned and *no bytes* will be written into the `Writer`. +/// +/// If this returns an `EncodingError` (other than SizeLimit), assume that the +/// writer is in an invalid state, as writing could bail out in the middle of +/// encoding. +pub fn encode_into(t: &T, + w: &mut W, + size_limit: SizeLimit) + -> EncodingResult<()> { + try!(match size_limit { + SizeLimit::Infinite => Ok(()), + SizeLimit::Bounded(x) => { + let mut size_checker = SizeChecker::new(x); + t.encode(&mut size_checker) + } + }); + + t.encode(&mut writer::EncoderWriter::new(w)) +} + +/// Decoes an object directly from a `Buffer`ed Reader. +/// +/// If the provided `SizeLimit` is reached, the decode will bail immediately. +/// A SizeLimit can help prevent an attacker from flooding your server with +/// a neverending stream of values that runs your server out of memory. +/// +/// If this returns an `DecodingError`, assume that the buffer that you passed +/// in is in an invalid state, as the error could be returned during any point +/// in the reading. +pub fn decode_from(r: &mut R, size_limit: SizeLimit) -> DecodingResult { + Decodable::decode(&mut reader::DecoderReader::new(r, size_limit)) +} + + +/// Returns the size that an object would be if encoded using bincode. +/// +/// This is used internally as part of the check for encode_into, but it can +/// be useful for preallocating buffers if thats your style. +pub fn encoded_size(t: &T) -> u64 { + use std::u64::MAX; + let mut size_checker = SizeChecker::new(MAX); + t.encode(&mut size_checker).ok(); + size_checker.written +} + +/// Given a maximum size limit, check how large an object would be if it +/// were to be encoded. +/// +/// If it can be encoded in `max` or fewer bytes, that number will be returned +/// inside `Some`. If it goes over bounds, then None is returned. +pub fn encoded_size_bounded(t: &T, max: u64) -> Option { + let mut size_checker = SizeChecker::new(max); + t.encode(&mut size_checker).ok().map(|_| size_checker.written) +} diff --git a/third_party/rust/bincode/src/rustc_serialize/reader.rs b/third_party/rust/bincode/src/rustc_serialize/reader.rs new file mode 100644 index 000000000000..ba1fd31a5082 --- /dev/null +++ b/third_party/rust/bincode/src/rustc_serialize/reader.rs @@ -0,0 +1,392 @@ +use std::io::Read; +use std::io::Error as IoError; +use std::error::Error; +use std::fmt; +use std::convert::From; + +use rustc_serialize_crate::Decoder; + +use byteorder::{BigEndian, ReadBytesExt}; +use ::SizeLimit; + +#[derive(Eq, PartialEq, Clone, Debug)] +pub struct InvalidEncoding { + pub desc: &'static str, + pub detail: Option, +} + +impl fmt::Display for InvalidEncoding { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match *self { + InvalidEncoding { detail: None, desc } => + write!(fmt, "{}", desc), + InvalidEncoding { detail: Some(ref detail), desc } => + write!(fmt, "{} ({})", desc, detail) + } + } +} + +/// An error that can be produced during decoding. +/// +/// If decoding from a Buffer, assume that the buffer has been left +/// in an invalid state. +#[derive(Debug)] +pub enum DecodingError { + /// If the error stems from the reader that is being used + /// during decoding, that error will be stored and returned here. + IoError(IoError), + /// If the bytes in the reader are not decodable because of an invalid + /// encoding, this error will be returned. This error is only possible + /// if a stream is corrupted. A stream produced from `encode` or `encode_into` + /// should **never** produce an InvalidEncoding error. + InvalidEncoding(InvalidEncoding), + /// If decoding a message takes more than the provided size limit, this + /// error is returned. + SizeLimit +} + +impl fmt::Display for DecodingError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match *self { + DecodingError::IoError(ref ioerr) => + write!(fmt, "IoError: {}", ioerr), + DecodingError::InvalidEncoding(ref ib) => + write!(fmt, "InvalidEncoding: {}", ib), + DecodingError::SizeLimit => + write!(fmt, "SizeLimit") + } + } +} + +pub type DecodingResult = Result; + +fn wrap_io(err: IoError) -> DecodingError { + DecodingError::IoError(err) +} + +impl Error for DecodingError { + fn description(&self) -> &str { + match *self { + DecodingError::IoError(ref err) => Error::description(err), + DecodingError::InvalidEncoding(ref ib) => ib.desc, + DecodingError::SizeLimit => "the size limit for decoding has been reached" + } + } + + fn cause(&self) -> Option<&Error> { + match *self { + DecodingError::IoError(ref err) => err.cause(), + DecodingError::InvalidEncoding(_) => None, + DecodingError::SizeLimit => None + } + } +} + +impl From for DecodingError { + fn from(err: IoError) -> DecodingError { + DecodingError::IoError(err) + } +} + +/// A Decoder that reads bytes from a buffer. +/// +/// This struct should rarely be used. +/// In most cases, prefer the `decode_from` function. +/// +/// ```rust,ignore +/// let dr = bincode::rustc_serialize::DecoderReader::new(&mut some_reader, SizeLimit::Infinite); +/// let result: T = Decodable::decode(&mut dr); +/// let bytes_read = dr.bytes_read(); +/// ``` +pub struct DecoderReader<'a, R: 'a> { + reader: &'a mut R, + size_limit: SizeLimit, + read: u64 +} + +impl<'a, R: Read> DecoderReader<'a, R> { + pub fn new(r: &'a mut R, size_limit: SizeLimit) -> DecoderReader<'a, R> { + DecoderReader { + reader: r, + size_limit: size_limit, + read: 0 + } + } + + /// Returns the number of bytes read from the contained Reader. + pub fn bytes_read(&self) -> u64 { + self.read + } +} + +impl <'a, A> DecoderReader<'a, A> { + fn read_bytes(&mut self, count: u64) -> Result<(), DecodingError> { + self.read = match self.read.checked_add(count) { + Some(read) => read, + None => return Err(DecodingError::SizeLimit), + }; + match self.size_limit { + SizeLimit::Infinite => Ok(()), + SizeLimit::Bounded(x) if self.read <= x => Ok(()), + SizeLimit::Bounded(_) => Err(DecodingError::SizeLimit) + } + } + + fn read_type(&mut self) -> Result<(), DecodingError> { + use std::mem::size_of; + self.read_bytes(size_of::() as u64) + } +} + +impl<'a, R: Read> Decoder for DecoderReader<'a, R> { + type Error = DecodingError; + + fn read_nil(&mut self) -> DecodingResult<()> { + Ok(()) + } + fn read_usize(&mut self) -> DecodingResult { + Ok(try!(self.read_u64().map(|x| x as usize))) + } + fn read_u64(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_u64::().map_err(wrap_io) + } + fn read_u32(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_u32::().map_err(wrap_io) + } + fn read_u16(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_u16::().map_err(wrap_io) + } + fn read_u8(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_u8().map_err(wrap_io) + } + fn read_isize(&mut self) -> DecodingResult { + self.read_i64().map(|x| x as isize) + } + fn read_i64(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_i64::().map_err(wrap_io) + } + fn read_i32(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_i32::().map_err(wrap_io) + } + fn read_i16(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_i16::().map_err(wrap_io) + } + fn read_i8(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_i8().map_err(wrap_io) + } + fn read_bool(&mut self) -> DecodingResult { + let x = try!(self.read_i8()); + match x { + 1 => Ok(true), + 0 => Ok(false), + _ => Err(DecodingError::InvalidEncoding(InvalidEncoding{ + desc: "invalid u8 when decoding bool", + detail: Some(format!("Expected 0 or 1, got {}", x)) + })), + } + } + fn read_f64(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_f64::().map_err(wrap_io) + } + fn read_f32(&mut self) -> DecodingResult { + try!(self.read_type::()); + self.reader.read_f32::().map_err(wrap_io) + } + fn read_char(&mut self) -> DecodingResult { + use std::str; + + let error = DecodingError::InvalidEncoding(InvalidEncoding { + desc: "Invalid char encoding", + detail: None + }); + + let mut buf = [0]; + + let _ = try!(self.reader.read(&mut buf[..])); + let first_byte = buf[0]; + let width = utf8_char_width(first_byte); + if width == 1 { return Ok(first_byte as char) } + if width == 0 { return Err(error)} + + let mut buf = [first_byte, 0, 0, 0]; + { + let mut start = 1; + while start < width { + match try!(self.reader.read(&mut buf[start .. width])) { + n if n == width - start => break, + n if n < width - start => { start += n; } + _ => return Err(error) + } + } + } + + let res = try!(match str::from_utf8(&buf[..width]).ok() { + Some(s) => Ok(s.chars().next().unwrap()), + None => Err(error) + }); + + try!(self.read_bytes(res.len_utf8() as u64)); + Ok(res) + } + + fn read_str(&mut self) -> DecodingResult { + let len = try!(self.read_usize()); + try!(self.read_bytes(len as u64)); + + let mut buff = Vec::new(); + try!(self.reader.by_ref().take(len as u64).read_to_end(&mut buff)); + match String::from_utf8(buff) { + Ok(s) => Ok(s), + Err(err) => Err(DecodingError::InvalidEncoding(InvalidEncoding { + desc: "error while decoding utf8 string", + detail: Some(format!("Decoding error: {}", err)) + })), + } + } + fn read_enum(&mut self, _: &str, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_enum_variant(&mut self, names: &[&str], mut f: F) -> DecodingResult + where F: FnMut(&mut DecoderReader<'a, R>, usize) -> DecodingResult + { + let id = try!(self.read_u32()); + let id = id as usize; + if id >= names.len() { + Err(DecodingError::InvalidEncoding(InvalidEncoding { + desc: "out of bounds tag when reading enum variant", + detail: Some(format!("Expected tag < {}, got {}", names.len(), id)) + })) + } else { + f(self, id) + } + } + fn read_enum_variant_arg(&mut self, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_enum_struct_variant(&mut self, names: &[&str], f: F) -> DecodingResult + where F: FnMut(&mut DecoderReader<'a, R>, usize) -> DecodingResult + { + self.read_enum_variant(names, f) + } + fn read_enum_struct_variant_field(&mut self, + _: &str, + f_idx: usize, + f: F) + -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + self.read_enum_variant_arg(f_idx, f) + } + fn read_struct(&mut self, _: &str, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_struct_field(&mut self, _: &str, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_tuple(&mut self, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_tuple_arg(&mut self, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_tuple_struct(&mut self, _: &str, len: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + self.read_tuple(len, f) + } + fn read_tuple_struct_arg(&mut self, a_idx: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + self.read_tuple_arg(a_idx, f) + } + fn read_option(&mut self, mut f: F) -> DecodingResult + where F: FnMut(&mut DecoderReader<'a, R>, bool) -> DecodingResult + { + let x = try!(self.read_u8()); + match x { + 1 => f(self, true), + 0 => f(self, false), + _ => Err(DecodingError::InvalidEncoding(InvalidEncoding { + desc: "invalid tag when decoding Option", + detail: Some(format!("Expected 0 or 1, got {}", x)) + })), + } + } + fn read_seq(&mut self, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>, usize) -> DecodingResult + { + let len = try!(self.read_usize()); + f(self, len) + } + fn read_seq_elt(&mut self, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_map(&mut self, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>, usize) -> DecodingResult + { + let len = try!(self.read_usize()); + f(self, len) + } + fn read_map_elt_key(&mut self, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn read_map_elt_val(&mut self, _: usize, f: F) -> DecodingResult + where F: FnOnce(&mut DecoderReader<'a, R>) -> DecodingResult + { + f(self) + } + fn error(&mut self, err: &str) -> DecodingError { + DecodingError::InvalidEncoding(InvalidEncoding { + desc: "user-induced error", + detail: Some(err.to_string()), + }) + } +} + +static UTF8_CHAR_WIDTH: [u8; 256] = [ +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7F +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF +0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF +4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF +]; + +fn utf8_char_width(b: u8) -> usize { + UTF8_CHAR_WIDTH[b as usize] as usize +} diff --git a/third_party/rust/bincode/src/rustc_serialize/writer.rs b/third_party/rust/bincode/src/rustc_serialize/writer.rs new file mode 100644 index 000000000000..2ab8da4aca9b --- /dev/null +++ b/third_party/rust/bincode/src/rustc_serialize/writer.rs @@ -0,0 +1,422 @@ +use std::io::Write; +use std::io::Error as IoError; +use std::error::Error; +use std::fmt; + +use rustc_serialize_crate::Encoder; + +use byteorder::{BigEndian, WriteBytesExt}; + +pub type EncodingResult = Result; + + +/// An error that can be produced during encoding. +#[derive(Debug)] +pub enum EncodingError { + /// An error originating from the underlying `Writer`. + IoError(IoError), + /// An object could not be encoded with the given size limit. + /// + /// This error is returned before any bytes are written to the + /// output `Writer`. + SizeLimit, +} + +/// An Encoder that encodes values directly into a Writer. +/// +/// This struct should not be used often. +/// For most cases, prefer the `encode_into` function. +pub struct EncoderWriter<'a, W: 'a> { + writer: &'a mut W, +} + +pub struct SizeChecker { + pub size_limit: u64, + pub written: u64 +} + +fn wrap_io(err: IoError) -> EncodingError { + EncodingError::IoError(err) +} + +impl fmt::Display for EncodingError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + EncodingError::IoError(ref err) => write!(f, "IoError: {}", err), + EncodingError::SizeLimit => write!(f, "SizeLimit") + } + } +} + +impl Error for EncodingError { + fn description(&self) -> &str { + match *self { + EncodingError::IoError(ref err) => Error::description(err), + EncodingError::SizeLimit => "the size limit for decoding has been reached" + } + } + + fn cause(&self) -> Option<&Error> { + match *self { + EncodingError::IoError(ref err) => err.cause(), + EncodingError::SizeLimit => None + } + } +} + +impl <'a, W: Write> EncoderWriter<'a, W> { + pub fn new(w: &'a mut W) -> EncoderWriter<'a, W> { + EncoderWriter { + writer: w, + } + } +} + +impl SizeChecker { + pub fn new(limit: u64) -> SizeChecker { + SizeChecker { + size_limit: limit, + written: 0 + } + } + + fn add_raw(&mut self, size: usize) -> EncodingResult<()> { + self.written += size as u64; + if self.written <= self.size_limit { + Ok(()) + } else { + Err(EncodingError::SizeLimit) + } + } + + fn add_value(&mut self, t: T) -> EncodingResult<()> { + use std::mem::size_of_val; + self.add_raw(size_of_val(&t)) + } +} + +impl<'a, W: Write> Encoder for EncoderWriter<'a, W> { + type Error = EncodingError; + + fn emit_nil(&mut self) -> EncodingResult<()> { + Ok(()) + } + fn emit_usize(&mut self, v: usize) -> EncodingResult<()> { + self.emit_u64(v as u64) + } + fn emit_u64(&mut self, v: u64) -> EncodingResult<()> { + self.writer.write_u64::(v).map_err(wrap_io) + } + fn emit_u32(&mut self, v: u32) -> EncodingResult<()> { + self.writer.write_u32::(v).map_err(wrap_io) + } + fn emit_u16(&mut self, v: u16) -> EncodingResult<()> { + self.writer.write_u16::(v).map_err(wrap_io) + } + fn emit_u8(&mut self, v: u8) -> EncodingResult<()> { + self.writer.write_u8(v).map_err(wrap_io) + } + fn emit_isize(&mut self, v: isize) -> EncodingResult<()> { + self.emit_i64(v as i64) + } + fn emit_i64(&mut self, v: i64) -> EncodingResult<()> { + self.writer.write_i64::(v).map_err(wrap_io) + } + fn emit_i32(&mut self, v: i32) -> EncodingResult<()> { + self.writer.write_i32::(v).map_err(wrap_io) + } + fn emit_i16(&mut self, v: i16) -> EncodingResult<()> { + self.writer.write_i16::(v).map_err(wrap_io) + } + fn emit_i8(&mut self, v: i8) -> EncodingResult<()> { + self.writer.write_i8(v).map_err(wrap_io) + } + fn emit_bool(&mut self, v: bool) -> EncodingResult<()> { + self.writer.write_u8(if v {1} else {0}).map_err(wrap_io) + } + fn emit_f64(&mut self, v: f64) -> EncodingResult<()> { + self.writer.write_f64::(v).map_err(wrap_io) + } + fn emit_f32(&mut self, v: f32) -> EncodingResult<()> { + self.writer.write_f32::(v).map_err(wrap_io) + } + fn emit_char(&mut self, v: char) -> EncodingResult<()> { + // TODO: change this back once unicode works + //let mut cbuf = [0; 4]; + //let sz = v.encode_utf8(&mut cbuf[..]).unwrap_or(0); + //let ptr = &cbuf[..sz]; + //self.writer.write_all(ptr).map_err(EncodingError::IoError) + + let mut inter = String::with_capacity(1); + inter.push(v); + self.writer.write_all(inter.as_bytes()).map_err(EncodingError::IoError) + } + fn emit_str(&mut self, v: &str) -> EncodingResult<()> { + try!(self.emit_usize(v.len())); + self.writer.write_all(v.as_bytes()).map_err(EncodingError::IoError) + } + fn emit_enum(&mut self, __: &str, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_enum_variant(&mut self, _: &str, v_id: usize, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + let max_u32: u32 = ::std::u32::MAX; + if v_id > (max_u32 as usize) { + panic!("Variant tag doesn't fit in a u32") + } + try!(self.emit_u32(v_id as u32)); + f(self) + } + fn emit_enum_variant_arg(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_enum_struct_variant(&mut self, + v_name: &str, + v_id: usize, + len: usize, + f: F) + -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + self.emit_enum_variant(v_name, v_id, len, f) + } + fn emit_enum_struct_variant_field(&mut self, _: &str, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_struct(&mut self, _: &str, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_struct_field(&mut self, _: &str, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_tuple(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_tuple_arg(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_tuple_struct(&mut self, _: &str, len: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + self.emit_tuple(len, f) + } + fn emit_tuple_struct_arg(&mut self, f_idx: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + self.emit_tuple_arg(f_idx, f) + } + fn emit_option(&mut self, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_option_none(&mut self) -> EncodingResult<()> { + self.writer.write_u8(0).map_err(wrap_io) + } + fn emit_option_some(&mut self, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + try!(self.writer.write_u8(1).map_err(wrap_io)); + f(self) + } + fn emit_seq(&mut self, len: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + try!(self.emit_usize(len)); + f(self) + } + fn emit_seq_elt(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_map(&mut self, len: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + try!(self.emit_usize(len)); + f(self) + } + fn emit_map_elt_key(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + fn emit_map_elt_val(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut EncoderWriter<'a, W>) -> EncodingResult<()> + { + f(self) + } + +} + +impl Encoder for SizeChecker { + type Error = EncodingError; + + fn emit_nil(&mut self) -> EncodingResult<()> { + Ok(()) + } + fn emit_usize(&mut self, v: usize) -> EncodingResult<()> { + self.add_value(v as u64) + } + fn emit_u64(&mut self, v: u64) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_u32(&mut self, v: u32) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_u16(&mut self, v: u16) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_u8(&mut self, v: u8) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_isize(&mut self, v: isize) -> EncodingResult<()> { + self.add_value(v as i64) + } + fn emit_i64(&mut self, v: i64) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_i32(&mut self, v: i32) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_i16(&mut self, v: i16) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_i8(&mut self, v: i8) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_bool(&mut self, _: bool) -> EncodingResult<()> { + self.add_value(0 as u8) + } + fn emit_f64(&mut self, v: f64) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_f32(&mut self, v: f32) -> EncodingResult<()> { + self.add_value(v) + } + fn emit_char(&mut self, v: char) -> EncodingResult<()> { + self.add_raw(v.len_utf8()) + } + fn emit_str(&mut self, v: &str) -> EncodingResult<()> { + try!(self.add_value(0 as u64)); + self.add_raw(v.len()) + } + fn emit_enum(&mut self, __: &str, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_enum_variant(&mut self, _: &str, v_id: usize, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + try!(self.add_value(v_id as u32)); + f(self) + } + fn emit_enum_variant_arg(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_enum_struct_variant(&mut self, + _: &str, + _: usize, + _: usize, + f: F) + -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_enum_struct_variant_field(&mut self, _: &str, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_struct(&mut self, _: &str, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_struct_field(&mut self, _: &str, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_tuple(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_tuple_arg(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_tuple_struct(&mut self, _: &str, len: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + self.emit_tuple(len, f) + } + fn emit_tuple_struct_arg(&mut self, f_idx: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + self.emit_tuple_arg(f_idx, f) + } + fn emit_option(&mut self, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_option_none(&mut self) -> EncodingResult<()> { + self.add_value(0 as u8) + } + fn emit_option_some(&mut self, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + try!(self.add_value(1 as u8)); + f(self) + } + fn emit_seq(&mut self, len: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + try!(self.emit_usize(len)); + f(self) + } + fn emit_seq_elt(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_map(&mut self, len: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + try!(self.emit_usize(len)); + f(self) + } + fn emit_map_elt_key(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + fn emit_map_elt_val(&mut self, _: usize, f: F) -> EncodingResult<()> + where F: FnOnce(&mut SizeChecker) -> EncodingResult<()> + { + f(self) + } + +} diff --git a/third_party/rust/bincode/src/serde/mod.rs b/third_party/rust/bincode/src/serde/mod.rs new file mode 100644 index 000000000000..b6a30d417b45 --- /dev/null +++ b/third_party/rust/bincode/src/serde/mod.rs @@ -0,0 +1,123 @@ +//! A collection of serialization and deserialization functions +//! that use the `serde` crate for the serializable and deserializable +//! implementation. + +use std::io::{Write, Read}; +use ::SizeLimit; + +pub use self::reader::{ + Deserializer, + DeserializeResult, + DeserializeError, + InvalidEncoding +}; + +pub use self::writer::{ + Serializer, + SerializeResult, + SerializeError, +}; + +use self::writer::SizeChecker; + +use serde_crate as serde; + +mod reader; +mod writer; + +/// Serializes an object directly into a `Writer`. +/// +/// If the serialization would take more bytes than allowed by `size_limit`, an error +/// is returned and *no bytes* will be written into the `Writer`. +/// +/// If this returns an `SerializeError` (other than SizeLimit), assume that the +/// writer is in an invalid state, as writing could bail out in the middle of +/// serializing. +pub fn serialize_into(writer: &mut W, value: &T, size_limit: SizeLimit) -> SerializeResult<()> + where W: Write, T: serde::Serialize, +{ + match size_limit { + SizeLimit::Infinite => { } + SizeLimit::Bounded(x) => { + let mut size_checker = SizeChecker::new(x); + try!(value.serialize(&mut size_checker)) + } + } + + let mut serializer = Serializer::new(writer); + serde::Serialize::serialize(value, &mut serializer) +} + +/// Serializes a serializable object into a `Vec` of bytes. +/// +/// If the serialization would take more bytes than allowed by `size_limit`, +/// an error is returned. +pub fn serialize(value: &T, size_limit: SizeLimit) -> SerializeResult> + where T: serde::Serialize, +{ + // Since we are putting values directly into a vector, we can do size + // computation out here and pre-allocate a buffer of *exactly* + // the right size. + let mut writer = match size_limit { + SizeLimit::Bounded(size_limit) => { + let actual_size = match serialized_size_bounded(value, size_limit) { + Some(actual_size) => actual_size, + None => { return Err(SerializeError::SizeLimit); } + }; + Vec::with_capacity(actual_size as usize) + } + SizeLimit::Infinite => Vec::new() + }; + + try!(serialize_into(&mut writer, value, SizeLimit::Infinite)); + Ok(writer) +} + +/// Returns the size that an object would be if serialized using bincode. +/// +/// This is used internally as part of the check for encode_into, but it can +/// be useful for preallocating buffers if thats your style. +pub fn serialized_size(value: &T) -> u64 { + use std::u64::MAX; + let mut size_checker = SizeChecker::new(MAX); + value.serialize(&mut size_checker).ok(); + size_checker.written +} + +/// Given a maximum size limit, check how large an object would be if it +/// were to be serialized. +/// +/// If it can be serialized in `max` or fewer bytes, that number will be returned +/// inside `Some`. If it goes over bounds, then None is returned. +pub fn serialized_size_bounded(value: &T, max: u64) -> Option { + let mut size_checker = SizeChecker::new(max); + value.serialize(&mut size_checker).ok().map(|_| size_checker.written) +} + +/// Deserializes an object directly from a `Buffer`ed Reader. +/// +/// If the provided `SizeLimit` is reached, the deserialization will bail immediately. +/// A SizeLimit can help prevent an attacker from flooding your server with +/// a neverending stream of values that runs your server out of memory. +/// +/// If this returns an `DeserializeError`, assume that the buffer that you passed +/// in is in an invalid state, as the error could be returned during any point +/// in the reading. +pub fn deserialize_from(reader: &mut R, size_limit: SizeLimit) -> DeserializeResult + where R: Read, + T: serde::Deserialize, +{ + let mut deserializer = Deserializer::new(reader, size_limit); + serde::Deserialize::deserialize(&mut deserializer) +} + +/// Deserializes a slice of bytes into an object. +/// +/// This method does not have a size-limit because if you already have the bytes +/// in memory, then you don't gain anything by having a limiter. +pub fn deserialize(bytes: &[u8]) -> DeserializeResult + where T: serde::Deserialize, +{ + let mut reader = bytes; + deserialize_from(&mut reader, SizeLimit::Infinite) +} diff --git a/third_party/rust/bincode/src/serde/reader.rs b/third_party/rust/bincode/src/serde/reader.rs new file mode 100644 index 000000000000..00ea18c8046e --- /dev/null +++ b/third_party/rust/bincode/src/serde/reader.rs @@ -0,0 +1,571 @@ +use std::io::Read; +use std::io::Error as IoError; +use std::error::Error; +use std::fmt; +use std::convert::From; + +use byteorder::{BigEndian, ReadBytesExt}; +use num_traits; +use serde_crate as serde; +use serde_crate::de::value::ValueDeserializer; + +use ::SizeLimit; + +#[derive(Eq, PartialEq, Clone, Debug)] +pub struct InvalidEncoding { + pub desc: &'static str, + pub detail: Option, +} + +impl fmt::Display for InvalidEncoding { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match *self { + InvalidEncoding { detail: None, desc } => + write!(fmt, "{}", desc), + InvalidEncoding { detail: Some(ref detail), desc } => + write!(fmt, "{} ({})", desc, detail) + } + } +} + +/// An error that can be produced during decoding. +/// +/// If decoding from a Buffer, assume that the buffer has been left +/// in an invalid state. +#[derive(Debug)] +pub enum DeserializeError { + /// If the error stems from the reader that is being used + /// during decoding, that error will be stored and returned here. + IoError(IoError), + /// If the bytes in the reader are not decodable because of an invalid + /// encoding, this error will be returned. This error is only possible + /// if a stream is corrupted. A stream produced from `encode` or `encode_into` + /// should **never** produce an InvalidEncoding error. + InvalidEncoding(InvalidEncoding), + /// If decoding a message takes more than the provided size limit, this + /// error is returned. + SizeLimit, + Serde(serde::de::value::Error) +} + +impl Error for DeserializeError { + fn description(&self) -> &str { + match *self { + DeserializeError::IoError(ref err) => Error::description(err), + DeserializeError::InvalidEncoding(ref ib) => ib.desc, + DeserializeError::SizeLimit => "the size limit for decoding has been reached", + DeserializeError::Serde(ref s) => s.description(), + + } + } + + fn cause(&self) -> Option<&Error> { + match *self { + DeserializeError::IoError(ref err) => err.cause(), + DeserializeError::InvalidEncoding(_) => None, + DeserializeError::SizeLimit => None, + DeserializeError::Serde(ref s) => s.cause(), + } + } +} + +impl From for DeserializeError { + fn from(err: IoError) -> DeserializeError { + DeserializeError::IoError(err) + } +} + +impl From for DeserializeError { + fn from(err: serde::de::value::Error) -> DeserializeError { + DeserializeError::Serde(err) + } +} + +impl fmt::Display for DeserializeError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match *self { + DeserializeError::IoError(ref ioerr) => + write!(fmt, "IoError: {}", ioerr), + DeserializeError::InvalidEncoding(ref ib) => + write!(fmt, "InvalidEncoding: {}", ib), + DeserializeError::SizeLimit => + write!(fmt, "SizeLimit"), + DeserializeError::Serde(ref s) => + s.fmt(fmt), + } + } +} + +impl serde::de::Error for DeserializeError { + fn custom>(desc: T) -> DeserializeError { + DeserializeError::Serde(serde::de::value::Error::Custom(desc.into())) + } + + fn end_of_stream() -> DeserializeError { + DeserializeError::Serde(serde::de::value::Error::EndOfStream) + } +} + +pub type DeserializeResult = Result; + + +/// A Deserializer that reads bytes from a buffer. +/// +/// This struct should rarely be used. +/// In most cases, prefer the `decode_from` function. +/// +/// ```rust,ignore +/// let d = Deserializer::new(&mut some_reader, SizeLimit::new()); +/// serde::Deserialize::deserialize(&mut deserializer); +/// let bytes_read = d.bytes_read(); +/// ``` +pub struct Deserializer<'a, R: 'a> { + reader: &'a mut R, + size_limit: SizeLimit, + read: u64 +} + +impl<'a, R: Read> Deserializer<'a, R> { + pub fn new(r: &'a mut R, size_limit: SizeLimit) -> Deserializer<'a, R> { + Deserializer { + reader: r, + size_limit: size_limit, + read: 0 + } + } + + /// Returns the number of bytes read from the contained Reader. + pub fn bytes_read(&self) -> u64 { + self.read + } + + fn read_bytes(&mut self, count: u64) -> Result<(), DeserializeError> { + self.read += count; + match self.size_limit { + SizeLimit::Infinite => Ok(()), + SizeLimit::Bounded(x) if self.read <= x => Ok(()), + SizeLimit::Bounded(_) => Err(DeserializeError::SizeLimit) + } + } + + fn read_type(&mut self) -> Result<(), DeserializeError> { + use std::mem::size_of; + self.read_bytes(size_of::() as u64) + } + + fn read_string(&mut self) -> DeserializeResult { + let len = try!(serde::Deserialize::deserialize(self)); + try!(self.read_bytes(len)); + + let mut buffer = Vec::new(); + try!(self.reader.by_ref().take(len as u64).read_to_end(&mut buffer)); + + String::from_utf8(buffer).map_err(|err| + DeserializeError::InvalidEncoding(InvalidEncoding { + desc: "error while decoding utf8 string", + detail: Some(format!("Deserialize error: {}", err)) + })) + } +} + +macro_rules! impl_nums { + ($ty:ty, $dser_method:ident, $visitor_method:ident, $reader_method:ident) => { + #[inline] + fn $dser_method(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + try!(self.read_type::<$ty>()); + let value = try!(self.reader.$reader_method::()); + visitor.$visitor_method(value) + } + } +} + + +impl<'a, R: Read> serde::Deserializer for Deserializer<'a, R> { + type Error = DeserializeError; + + #[inline] + fn deserialize(&mut self, _visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + let message = "bincode does not support Deserializer::deserialize"; + Err(DeserializeError::Serde(serde::de::value::Error::Custom(message.into()))) + } + + fn deserialize_bool(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + let value: u8 = try!(serde::Deserialize::deserialize(self)); + match value { + 1 => visitor.visit_bool(true), + 0 => visitor.visit_bool(false), + value => { + Err(DeserializeError::InvalidEncoding(InvalidEncoding { + desc: "invalid u8 when decoding bool", + detail: Some(format!("Expected 0 or 1, got {}", value)) + })) + } + } + } + + impl_nums!(u16, deserialize_u16, visit_u16, read_u16); + impl_nums!(u32, deserialize_u32, visit_u32, read_u32); + impl_nums!(u64, deserialize_u64, visit_u64, read_u64); + impl_nums!(i16, deserialize_i16, visit_i16, read_i16); + impl_nums!(i32, deserialize_i32, visit_i32, read_i32); + impl_nums!(i64, deserialize_i64, visit_i64, read_i64); + impl_nums!(f32, deserialize_f32, visit_f32, read_f32); + impl_nums!(f64, deserialize_f64, visit_f64, read_f64); + + + #[inline] + fn deserialize_u8(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + try!(self.read_type::()); + visitor.visit_u8(try!(self.reader.read_u8())) + } + + #[inline] + fn deserialize_usize(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + try!(self.read_type::()); + let value = try!(self.reader.read_u64::()); + match num_traits::cast(value) { + Some(value) => visitor.visit_usize(value), + None => Err(DeserializeError::Serde(serde::de::value::Error::Custom("expected usize".into()))) + } + } + + #[inline] + fn deserialize_i8(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + try!(self.read_type::()); + visitor.visit_i8(try!(self.reader.read_i8())) + } + + #[inline] + fn deserialize_isize(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + try!(self.read_type::()); + let value = try!(self.reader.read_i64::()); + match num_traits::cast(value) { + Some(value) => visitor.visit_isize(value), + None => Err(DeserializeError::Serde(serde::de::value::Error::Custom("expected isize".into()))), + } + } + + fn deserialize_unit(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + visitor.visit_unit() + } + + fn deserialize_char(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + use std::str; + + let error = DeserializeError::InvalidEncoding(InvalidEncoding { + desc: "Invalid char encoding", + detail: None + }); + + let mut buf = [0]; + + let _ = try!(self.reader.read(&mut buf[..])); + let first_byte = buf[0]; + let width = utf8_char_width(first_byte); + if width == 1 { return visitor.visit_char(first_byte as char) } + if width == 0 { return Err(error)} + + let mut buf = [first_byte, 0, 0, 0]; + { + let mut start = 1; + while start < width { + match try!(self.reader.read(&mut buf[start .. width])) { + n if n == width - start => break, + n if n < width - start => { start += n; } + _ => return Err(error) + } + } + } + + let res = try!(match str::from_utf8(&buf[..width]).ok() { + Some(s) => Ok(s.chars().next().unwrap()), + None => Err(error) + }); + + visitor.visit_char(res) + } + + fn deserialize_str(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + visitor.visit_str(&try!(self.read_string())) + } + + fn deserialize_string(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + visitor.visit_string(try!(self.read_string())) + } + + fn deserialize_bytes(&mut self, visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + self.deserialize_seq(visitor) + } + + fn deserialize_enum(&mut self, + _enum: &'static str, + _variants: &'static [&'static str], + mut visitor: V) -> Result + where V: serde::de::EnumVisitor, + { + visitor.visit(self) + } + + fn deserialize_tuple(&mut self, + _len: usize, + mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + struct TupleVisitor<'a, 'b: 'a, R: Read + 'b>(&'a mut Deserializer<'b, R>); + + impl<'a, 'b: 'a, R: Read + 'b> serde::de::SeqVisitor for TupleVisitor<'a, 'b, R> { + type Error = DeserializeError; + + fn visit(&mut self) -> Result, Self::Error> + where T: serde::de::Deserialize, + { + let value = try!(serde::Deserialize::deserialize(self.0)); + Ok(Some(value)) + } + + fn end(&mut self) -> Result<(), Self::Error> { + Ok(()) + } + } + + visitor.visit_seq(TupleVisitor(self)) + } + + fn deserialize_seq_fixed_size(&mut self, + _: usize, + visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + self.deserialize_seq(visitor) + } + + fn deserialize_option(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + let value: u8 = try!(serde::de::Deserialize::deserialize(self)); + match value { + 0 => visitor.visit_none(), + 1 => visitor.visit_some(self), + _ => Err(DeserializeError::InvalidEncoding(InvalidEncoding { + desc: "invalid tag when decoding Option", + detail: Some(format!("Expected 0 or 1, got {}", value)) + })), + } + } + + fn deserialize_seq(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + struct SeqVisitor<'a, 'b: 'a, R: Read + 'b> { + deserializer: &'a mut Deserializer<'b, R>, + len: usize, + } + + impl<'a, 'b: 'a, R: Read + 'b> serde::de::SeqVisitor for SeqVisitor<'a, 'b, R> { + type Error = DeserializeError; + + fn visit(&mut self) -> Result, Self::Error> + where T: serde::de::Deserialize, + { + if self.len > 0 { + self.len -= 1; + let value = try!(serde::Deserialize::deserialize(self.deserializer)); + Ok(Some(value)) + } else { + Ok(None) + } + } + + fn end(&mut self) -> Result<(), Self::Error> { + if self.len == 0 { + Ok(()) + } else { + Err(DeserializeError::Serde(serde::de::value::Error::Custom("expected end".into()))) + } + } + } + + let len = try!(serde::Deserialize::deserialize(self)); + + visitor.visit_seq(SeqVisitor { deserializer: self, len: len }) + } + + fn deserialize_map(&mut self, mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + struct MapVisitor<'a, 'b: 'a, R: Read + 'b> { + deserializer: &'a mut Deserializer<'b, R>, + len: usize, + } + + impl<'a, 'b: 'a, R: Read + 'b> serde::de::MapVisitor for MapVisitor<'a, 'b, R> { + type Error = DeserializeError; + + fn visit_key(&mut self) -> Result, Self::Error> + where K: serde::de::Deserialize, + { + if self.len > 0 { + self.len -= 1; + let key = try!(serde::Deserialize::deserialize(self.deserializer)); + Ok(Some(key)) + } else { + Ok(None) + } + } + + fn visit_value(&mut self) -> Result + where V: serde::de::Deserialize, + { + let value = try!(serde::Deserialize::deserialize(self.deserializer)); + Ok(value) + } + + fn end(&mut self) -> Result<(), Self::Error> { + if self.len == 0 { + Ok(()) + } else { + Err(DeserializeError::Serde(serde::de::value::Error::Custom("expected end".into()))) + } + } + } + + let len = try!(serde::Deserialize::deserialize(self)); + + visitor.visit_map(MapVisitor { deserializer: self, len: len }) + } + + fn deserialize_struct(&mut self, + _name: &str, + fields: &'static [&'static str], + visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + self.deserialize_tuple(fields.len(), visitor) + } + + fn deserialize_struct_field(&mut self, + _visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + let message = "bincode does not support Deserializer::deserialize_struct_field"; + Err(DeserializeError::Serde(serde::de::value::Error::Custom(message.into()))) + } + + fn deserialize_newtype_struct(&mut self, + _name: &str, + mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + visitor.visit_newtype_struct(self) + } + + fn deserialize_unit_struct(&mut self, + _name: &'static str, + mut visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + visitor.visit_unit() + } + + fn deserialize_tuple_struct(&mut self, + _name: &'static str, + len: usize, + visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + self.deserialize_tuple(len, visitor) + } + + fn deserialize_ignored_any(&mut self, + _visitor: V) -> DeserializeResult + where V: serde::de::Visitor, + { + let message = "bincode does not support Deserializer::deserialize_ignored_any"; + Err(DeserializeError::Serde(serde::de::value::Error::Custom(message.into()))) + } +} + +impl<'a, R: Read> serde::de::VariantVisitor for Deserializer<'a, R> { + type Error = DeserializeError; + + fn visit_variant(&mut self) -> Result + where V: serde::Deserialize, + { + let index: u32 = try!(serde::Deserialize::deserialize(self)); + let mut deserializer = (index as usize).into_deserializer(); + let attempt: Result = serde::Deserialize::deserialize(&mut deserializer); + Ok(try!(attempt)) + } + + fn visit_unit(&mut self) -> Result<(), Self::Error> { + Ok(()) + } + + fn visit_newtype(&mut self) -> Result + where T: serde::de::Deserialize, + { + serde::de::Deserialize::deserialize(self) + } + + fn visit_tuple(&mut self, + len: usize, + visitor: V) -> Result + where V: serde::de::Visitor, + { + serde::de::Deserializer::deserialize_tuple(self, len, visitor) + } + + fn visit_struct(&mut self, + fields: &'static [&'static str], + visitor: V) -> Result + where V: serde::de::Visitor, + { + serde::de::Deserializer::deserialize_tuple(self, fields.len(), visitor) + } +} +static UTF8_CHAR_WIDTH: [u8; 256] = [ +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7F +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF +0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF +4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF +]; + +fn utf8_char_width(b: u8) -> usize { + UTF8_CHAR_WIDTH[b as usize] as usize +} diff --git a/third_party/rust/bincode/src/serde/writer.rs b/third_party/rust/bincode/src/serde/writer.rs new file mode 100644 index 000000000000..58666eb9f8f9 --- /dev/null +++ b/third_party/rust/bincode/src/serde/writer.rs @@ -0,0 +1,642 @@ +use std::error::Error; +use std::fmt; +use std::io::Error as IoError; +use std::io::Write; +use std::u32; + +use serde_crate as serde; + +use byteorder::{BigEndian, WriteBytesExt}; + +pub type SerializeResult = Result; + + +/// An error that can be produced during encoding. +#[derive(Debug)] +pub enum SerializeError { + /// An error originating from the underlying `Writer`. + IoError(IoError), + /// An object could not be encoded with the given size limit. + /// + /// This error is returned before any bytes are written to the + /// output `Writer`. + SizeLimit, + /// A custom error message + Custom(String) +} + +/// An Serializer that encodes values directly into a Writer. +/// +/// This struct should not be used often. +/// For most cases, prefer the `encode_into` function. +pub struct Serializer<'a, W: 'a> { + writer: &'a mut W, +} + +fn wrap_io(err: IoError) -> SerializeError { + SerializeError::IoError(err) +} + +impl serde::ser::Error for SerializeError { + fn custom>(msg: T) -> Self { + SerializeError::Custom(msg.into()) + } +} + +impl fmt::Display for SerializeError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + SerializeError::IoError(ref err) => write!(f, "IoError: {}", err), + SerializeError::Custom(ref s) => write!(f, "Custom Error {}", s), + SerializeError::SizeLimit => write!(f, "SizeLimit"), + } + } +} + +impl Error for SerializeError { + fn description(&self) -> &str { + match *self { + SerializeError::IoError(ref err) => Error::description(err), + SerializeError::SizeLimit => "the size limit for decoding has been reached", + SerializeError::Custom(_) => "a custom serialization error was reported", + } + } + + fn cause(&self) -> Option<&Error> { + match *self { + SerializeError::IoError(ref err) => err.cause(), + SerializeError::SizeLimit => None, + SerializeError::Custom(_) => None, + } + } +} + +impl<'a, W: Write> Serializer<'a, W> { + pub fn new(w: &'a mut W) -> Serializer<'a, W> { + Serializer { + writer: w, + } + } + + fn add_enum_tag(&mut self, tag: usize) -> SerializeResult<()> { + if tag > u32::MAX as usize { + panic!("Variant tag doesn't fit in a u32") + } + + serde::Serializer::serialize_u32(self, tag as u32) + } +} + +impl<'a, W: Write> serde::Serializer for Serializer<'a, W> { + type Error = SerializeError; + type SeqState = (); + type TupleState = (); + type TupleStructState = (); + type TupleVariantState = (); + type MapState = (); + type StructState = (); + type StructVariantState = (); + + fn serialize_unit(&mut self) -> SerializeResult<()> { Ok(()) } + + fn serialize_unit_struct(&mut self, _: &'static str) -> SerializeResult<()> { Ok(()) } + + fn serialize_bool(&mut self, v: bool) -> SerializeResult<()> { + self.writer.write_u8(if v {1} else {0}).map_err(wrap_io) + } + + fn serialize_u8(&mut self, v: u8) -> SerializeResult<()> { + self.writer.write_u8(v).map_err(wrap_io) + } + + fn serialize_u16(&mut self, v: u16) -> SerializeResult<()> { + self.writer.write_u16::(v).map_err(wrap_io) + } + + fn serialize_u32(&mut self, v: u32) -> SerializeResult<()> { + self.writer.write_u32::(v).map_err(wrap_io) + } + + fn serialize_u64(&mut self, v: u64) -> SerializeResult<()> { + self.writer.write_u64::(v).map_err(wrap_io) + } + + fn serialize_usize(&mut self, v: usize) -> SerializeResult<()> { + self.serialize_u64(v as u64) + } + + fn serialize_i8(&mut self, v: i8) -> SerializeResult<()> { + self.writer.write_i8(v).map_err(wrap_io) + } + + fn serialize_i16(&mut self, v: i16) -> SerializeResult<()> { + self.writer.write_i16::(v).map_err(wrap_io) + } + + fn serialize_i32(&mut self, v: i32) -> SerializeResult<()> { + self.writer.write_i32::(v).map_err(wrap_io) + } + + fn serialize_i64(&mut self, v: i64) -> SerializeResult<()> { + self.writer.write_i64::(v).map_err(wrap_io) + } + + fn serialize_isize(&mut self, v: isize) -> SerializeResult<()> { + self.serialize_i64(v as i64) + } + + fn serialize_f32(&mut self, v: f32) -> SerializeResult<()> { + self.writer.write_f32::(v).map_err(wrap_io) + } + + fn serialize_f64(&mut self, v: f64) -> SerializeResult<()> { + self.writer.write_f64::(v).map_err(wrap_io) + } + + fn serialize_str(&mut self, v: &str) -> SerializeResult<()> { + try!(self.serialize_usize(v.len())); + self.writer.write_all(v.as_bytes()).map_err(SerializeError::IoError) + } + + fn serialize_char(&mut self, c: char) -> SerializeResult<()> { + self.writer.write_all(encode_utf8(c).as_slice()).map_err(SerializeError::IoError) + } + + fn serialize_bytes(&mut self, v: &[u8]) -> SerializeResult<()> { + try!(self.serialize_usize(v.len())); + self.writer.write_all(v).map_err(SerializeError::IoError) + } + + fn serialize_none(&mut self) -> SerializeResult<()> { + self.writer.write_u8(0).map_err(wrap_io) + } + + fn serialize_some(&mut self, v: T) -> SerializeResult<()> + where T: serde::Serialize, + { + try!(self.writer.write_u8(1).map_err(wrap_io)); + v.serialize(self) + } + + fn serialize_seq(&mut self, len: Option) -> SerializeResult<()> { + let len = len.expect("do not know how to serialize a sequence with no length"); + self.serialize_usize(len) + } + + fn serialize_seq_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_seq_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_seq_fixed_size(&mut self, len: usize) -> SerializeResult<()> { + self.serialize_seq(Some(len)) + } + + fn serialize_tuple(&mut self, _len: usize) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_tuple_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_struct(&mut self, _name: &'static str, _len: usize) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_struct_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_tuple_struct_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str, + _len: usize) -> SerializeResult<()> + { + self.add_enum_tag(variant_index) + } + + fn serialize_tuple_variant_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_tuple_variant_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_map(&mut self, len: Option) -> SerializeResult<()> { + let len = len.expect("do not know how to serialize a map with no length"); + self.serialize_usize(len) + } + + fn serialize_map_key(&mut self, _: &mut (), key: K) -> SerializeResult<()> + where K: serde::Serialize, + { + key.serialize(self) + } + + fn serialize_map_value(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_map_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_struct(&mut self, _name: &'static str, _len: usize) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_struct_elt(&mut self, _: &mut (), _key: &'static str, value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_struct_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_struct_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str, + _len: usize) -> SerializeResult<()> + { + self.add_enum_tag(variant_index) + } + + fn serialize_struct_variant_elt(&mut self, _: &mut (), _key: &'static str, value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_struct_variant_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_newtype_struct(&mut self, + _name: &'static str, + value: T) -> SerializeResult<()> + where T: serde::ser::Serialize, + { + value.serialize(self) + } + + fn serialize_newtype_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str, + value: T) -> SerializeResult<()> + where T: serde::ser::Serialize, + { + try!(self.add_enum_tag(variant_index)); + value.serialize(self) + } + + fn serialize_unit_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str) -> SerializeResult<()> { + self.add_enum_tag(variant_index) + } +} + +pub struct SizeChecker { + pub size_limit: u64, + pub written: u64 +} + +impl SizeChecker { + pub fn new(limit: u64) -> SizeChecker { + SizeChecker { + size_limit: limit, + written: 0 + } + } + + fn add_raw(&mut self, size: usize) -> SerializeResult<()> { + self.written += size as u64; + if self.written <= self.size_limit { + Ok(()) + } else { + Err(SerializeError::SizeLimit) + } + } + + fn add_value(&mut self, t: T) -> SerializeResult<()> { + use std::mem::size_of_val; + self.add_raw(size_of_val(&t)) + } + + fn add_enum_tag(&mut self, tag: usize) -> SerializeResult<()> { + if tag > u32::MAX as usize { + panic!("Variant tag doesn't fit in a u32") + } + + self.add_value(tag as u32) + } +} + +impl serde::Serializer for SizeChecker { + type Error = SerializeError; + type SeqState = (); + type TupleState = (); + type TupleStructState = (); + type TupleVariantState = (); + type MapState = (); + type StructState = (); + type StructVariantState = (); + + fn serialize_unit(&mut self) -> SerializeResult<()> { Ok(()) } + + fn serialize_unit_struct(&mut self, _: &'static str) -> SerializeResult<()> { Ok(()) } + + fn serialize_bool(&mut self, _: bool) -> SerializeResult<()> { + self.add_value(0 as u8) + } + + fn serialize_u8(&mut self, v: u8) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_u16(&mut self, v: u16) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_u32(&mut self, v: u32) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_u64(&mut self, v: u64) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_usize(&mut self, v: usize) -> SerializeResult<()> { + self.serialize_u64(v as u64) + } + + fn serialize_i8(&mut self, v: i8) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_i16(&mut self, v: i16) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_i32(&mut self, v: i32) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_i64(&mut self, v: i64) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_isize(&mut self, v: isize) -> SerializeResult<()> { + self.serialize_i64(v as i64) + } + + fn serialize_f32(&mut self, v: f32) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_f64(&mut self, v: f64) -> SerializeResult<()> { + self.add_value(v) + } + + fn serialize_str(&mut self, v: &str) -> SerializeResult<()> { + try!(self.add_value(0 as u64)); + self.add_raw(v.len()) + } + + fn serialize_char(&mut self, c: char) -> SerializeResult<()> { + self.add_raw(encode_utf8(c).as_slice().len()) + } + + fn serialize_bytes(&mut self, v: &[u8]) -> SerializeResult<()> { + try!(self.add_value(0 as u64)); + self.add_raw(v.len()) + } + + fn serialize_none(&mut self) -> SerializeResult<()> { + self.add_value(0 as u8) + } + + fn serialize_some(&mut self, v: T) -> SerializeResult<()> + where T: serde::Serialize, + { + try!(self.add_value(1 as u8)); + v.serialize(self) + } + + fn serialize_seq(&mut self, len: Option) -> SerializeResult<()> { + let len = len.expect("do not know how to serialize a sequence with no length"); + + self.serialize_usize(len) + } + + fn serialize_seq_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_seq_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_seq_fixed_size(&mut self, len: usize) -> SerializeResult<()> { + self.serialize_seq(Some(len)) + } + + fn serialize_tuple(&mut self, _len: usize) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_tuple_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_struct(&mut self, _name: &'static str, _len: usize) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_struct_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_tuple_struct_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_tuple_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str, + _len: usize) -> SerializeResult<()> + { + self.add_enum_tag(variant_index) + } + + fn serialize_tuple_variant_elt(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_tuple_variant_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_map(&mut self, len: Option) -> SerializeResult<()> + { + let len = len.expect("do not know how to serialize a map with no length"); + + self.serialize_usize(len) + } + + fn serialize_map_key(&mut self, _: &mut (), key: K) -> SerializeResult<()> + where K: serde::Serialize, + { + key.serialize(self) + } + + fn serialize_map_value(&mut self, _: &mut (), value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_map_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_struct(&mut self, _name: &'static str, _len: usize) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_struct_elt(&mut self, _: &mut (), _key: &'static str, value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_struct_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_struct_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str, + _len: usize) -> SerializeResult<()> + { + self.add_enum_tag(variant_index) + } + + fn serialize_struct_variant_elt(&mut self, _: &mut (), _field: &'static str, value: V) -> SerializeResult<()> + where V: serde::Serialize, + { + value.serialize(self) + } + + fn serialize_struct_variant_end(&mut self, _: ()) -> SerializeResult<()> { + Ok(()) + } + + fn serialize_newtype_struct(&mut self, _name: &'static str, v: V) -> SerializeResult<()> { + v.serialize(self) + } + + fn serialize_unit_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str) -> SerializeResult<()> { + self.add_enum_tag(variant_index) + } + + fn serialize_newtype_variant(&mut self, + _name: &'static str, + variant_index: usize, + _variant: &'static str, + value: V) -> SerializeResult<()> + { + try!(self.add_enum_tag(variant_index)); + value.serialize(self) + } +} + +const TAG_CONT: u8 = 0b1000_0000; +const TAG_TWO_B: u8 = 0b1100_0000; +const TAG_THREE_B: u8 = 0b1110_0000; +const TAG_FOUR_B: u8 = 0b1111_0000; +const MAX_ONE_B: u32 = 0x80; +const MAX_TWO_B: u32 = 0x800; +const MAX_THREE_B: u32 = 0x10000; + +fn encode_utf8(c: char) -> EncodeUtf8 { + let code = c as u32; + let mut buf = [0; 4]; + let pos = if code < MAX_ONE_B { + buf[3] = code as u8; + 3 + } else if code < MAX_TWO_B { + buf[2] = (code >> 6 & 0x1F) as u8 | TAG_TWO_B; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 2 + } else if code < MAX_THREE_B { + buf[1] = (code >> 12 & 0x0F) as u8 | TAG_THREE_B; + buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 1 + } else { + buf[0] = (code >> 18 & 0x07) as u8 | TAG_FOUR_B; + buf[1] = (code >> 12 & 0x3F) as u8 | TAG_CONT; + buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 0 + }; + EncodeUtf8 { buf: buf, pos: pos } +} + +struct EncodeUtf8 { + buf: [u8; 4], + pos: usize, +} + +impl EncodeUtf8 { + fn as_slice(&self) -> &[u8] { + &self.buf[self.pos..] + } +} diff --git a/third_party/rust/bincode/tests/test.rs b/third_party/rust/bincode/tests/test.rs new file mode 100644 index 000000000000..13c0dc14252a --- /dev/null +++ b/third_party/rust/bincode/tests/test.rs @@ -0,0 +1,579 @@ +#![feature(proc_macro)] + +#[macro_use] +extern crate serde_derive; + +extern crate bincode; +extern crate rustc_serialize; +extern crate serde; + +use std::fmt::Debug; +use std::collections::HashMap; +use std::ops::Deref; + +use rustc_serialize::{Encodable, Encoder, Decodable, Decoder}; + +use bincode::{RefBox, StrBox, SliceBox}; + +use bincode::SizeLimit::{self, Infinite, Bounded}; +use bincode::rustc_serialize::{encode, decode, decode_from, DecodingError}; +use bincode::serde::{serialize, deserialize, deserialize_from, DeserializeError, DeserializeResult}; + +fn proxy_encode(element: &V, size_limit: SizeLimit) -> Vec + where V: Encodable + Decodable + serde::Serialize + serde::Deserialize + PartialEq + Debug + 'static +{ + let v1 = bincode::rustc_serialize::encode(element, size_limit).unwrap(); + let v2 = bincode::serde::serialize(element, size_limit).unwrap(); + assert_eq!(v1, v2); + + v1 +} + +fn proxy_decode(slice: &[u8]) -> V + where V: Encodable + Decodable + serde::Serialize + serde::Deserialize + PartialEq + Debug + 'static +{ + let e1 = bincode::rustc_serialize::decode(slice).unwrap(); + let e2 = bincode::serde::deserialize(slice).unwrap(); + + assert_eq!(e1, e2); + + e1 +} + +fn proxy_encoded_size(element: &V) -> u64 + where V: Encodable + serde::Serialize + PartialEq + Debug + 'static +{ + let ser_size = bincode::rustc_serialize::encoded_size(element); + let serde_size = bincode::serde::serialized_size(element); + assert_eq!(ser_size, serde_size); + ser_size +} + +fn the_same(element: V) + where V: Encodable+Decodable+serde::Serialize+serde::Deserialize+PartialEq+Debug+'static +{ + // Make sure that the bahavior isize correct when wrapping with a RefBox. + fn ref_box_correct(v: &V) -> bool + where V: Encodable + Decodable + PartialEq + Debug + 'static + { + let rf = RefBox::new(v); + let encoded = bincode::rustc_serialize::encode(&rf, Infinite).unwrap(); + let decoded: RefBox<'static, V> = bincode::rustc_serialize::decode(&encoded[..]).unwrap(); + + decoded.take().deref() == v + } + + let size = proxy_encoded_size(&element); + + let encoded = proxy_encode(&element, Infinite); + let decoded = proxy_decode(&encoded[..]); + + assert_eq!(element, decoded); + assert_eq!(size, encoded.len() as u64); + assert!(ref_box_correct(&element)); +} + +#[test] +fn test_numbers() { + // unsigned positive + the_same(5u8); + the_same(5u16); + the_same(5u32); + the_same(5u64); + the_same(5usize); + // signed positive + the_same(5i8); + the_same(5i16); + the_same(5i32); + the_same(5i64); + the_same(5isize); + // signed negative + the_same(-5i8); + the_same(-5i16); + the_same(-5i32); + the_same(-5i64); + the_same(-5isize); + // floating + the_same(-100f32); + the_same(0f32); + the_same(5f32); + the_same(-100f64); + the_same(5f64); +} + +#[test] +fn test_string() { + the_same("".to_string()); + the_same("a".to_string()); +} + +#[test] +fn test_tuple() { + the_same((1isize,)); + the_same((1isize,2isize,3isize)); + the_same((1isize,"foo".to_string(),())); +} + +#[test] +fn test_basic_struct() { + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, PartialEq, Debug)] + struct Easy { + x: isize, + s: String, + y: usize + } + the_same(Easy{x: -4, s: "foo".to_string(), y: 10}); +} + +#[test] +fn test_nested_struct() { + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, PartialEq, Debug)] + struct Easy { + x: isize, + s: String, + y: usize + } + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, PartialEq, Debug)] + struct Nest { + f: Easy, + b: usize, + s: Easy + } + + the_same(Nest { + f: Easy {x: -1, s: "foo".to_string(), y: 20}, + b: 100, + s: Easy {x: -100, s: "bar".to_string(), y: 20} + }); +} + +#[test] +fn test_struct_newtype() { + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, PartialEq, Debug)] + struct NewtypeStr(usize); + + the_same(NewtypeStr(5)); +} + +#[test] +fn test_struct_tuple() { + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, PartialEq, Debug)] + struct TubStr(usize, String, f32); + + the_same(TubStr(5, "hello".to_string(), 3.2)); +} + +#[test] +fn test_option() { + the_same(Some(5usize)); + the_same(Some("foo bar".to_string())); + the_same(None::); +} + +#[test] +fn test_enum() { + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, PartialEq, Debug)] + enum TestEnum { + NoArg, + OneArg(usize), + Args(usize, usize), + AnotherNoArg, + StructLike{x: usize, y: f32} + } + the_same(TestEnum::NoArg); + the_same(TestEnum::OneArg(4)); + the_same(TestEnum::Args(4, 5)); + the_same(TestEnum::AnotherNoArg); + the_same(TestEnum::StructLike{x: 4, y: 3.14159}); + the_same(vec![TestEnum::NoArg, TestEnum::OneArg(5), TestEnum::AnotherNoArg, + TestEnum::StructLike{x: 4, y:1.4}]); +} + +#[test] +fn test_vec() { + let v: Vec = vec![]; + the_same(v); + the_same(vec![1u64]); + the_same(vec![1u64,2,3,4,5,6]); +} + +#[test] +fn test_map() { + let mut m = HashMap::new(); + m.insert(4u64, "foo".to_string()); + m.insert(0u64, "bar".to_string()); + the_same(m); +} + +#[test] +fn test_bool() { + the_same(true); + the_same(false); +} + +#[test] +fn test_unicode() { + the_same("å".to_string()); + the_same("aåååååååa".to_string()); +} + +#[test] +fn test_fixed_size_array() { + the_same([24u32; 32]); + the_same([1u64, 2, 3, 4, 5, 6, 7, 8]); + the_same([0u8; 19]); +} + +#[test] +fn decoding_errors() { + fn isize_invalid_encoding(res: bincode::rustc_serialize::DecodingResult) { + match res { + Ok(_) => panic!("Expecting error"), + Err(DecodingError::IoError(_)) => panic!("Expecting InvalidEncoding"), + Err(DecodingError::SizeLimit) => panic!("Expecting InvalidEncoding"), + Err(DecodingError::InvalidEncoding(_)) => {}, + } + } + + isize_invalid_encoding(decode::(&vec![0xA][..])); + isize_invalid_encoding(decode::(&vec![0, 0, 0, 0, 0, 0, 0, 1, 0xFF][..])); + // Out-of-bounds variant + #[derive(RustcEncodable, RustcDecodable, Serialize)] + enum Test { + One, + Two, + }; + isize_invalid_encoding(decode::(&vec![0, 0, 0, 5][..])); + isize_invalid_encoding(decode::>(&vec![5, 0][..])); +} + +#[test] +fn deserializing_errors() { + fn isize_invalid_deserialize(res: DeserializeResult) { + match res { + Err(DeserializeError::InvalidEncoding(_)) => {}, + Err(DeserializeError::Serde(serde::de::value::Error::UnknownVariant(_))) => {}, + Err(DeserializeError::Serde(serde::de::value::Error::InvalidValue(_))) => {}, + _ => panic!("Expecting InvalidEncoding, got {:?}", res), + } + } + + isize_invalid_deserialize(deserialize::(&vec![0xA][..])); + isize_invalid_deserialize(deserialize::(&vec![0, 0, 0, 0, 0, 0, 0, 1, 0xFF][..])); + // Out-of-bounds variant + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, Debug)] + enum Test { + One, + Two, + }; + isize_invalid_deserialize(deserialize::(&vec![0, 0, 0, 5][..])); + isize_invalid_deserialize(deserialize::>(&vec![5, 0][..])); +} + +#[test] +fn too_big_decode() { + let encoded = vec![0,0,0,3]; + let decoded: Result = decode_from(&mut &encoded[..], Bounded(3)); + assert!(decoded.is_err()); + + let encoded = vec![0,0,0,3]; + let decoded: Result = decode_from(&mut &encoded[..], Bounded(4)); + assert!(decoded.is_ok()); +} + +#[test] +fn too_big_deserialize() { + let serialized = vec![0,0,0,3]; + let deserialized: Result = deserialize_from(&mut &serialized[..], Bounded(3)); + assert!(deserialized.is_err()); + + let serialized = vec![0,0,0,3]; + let deserialized: Result = deserialize_from(&mut &serialized[..], Bounded(4)); + assert!(deserialized.is_ok()); +} + +#[test] +fn char_serialization() { + let chars = "Aa\0☺♪"; + for c in chars.chars() { + let encoded = serialize(&c, Bounded(4)).expect("serializing char failed"); + let decoded: char = deserialize(&encoded).expect("deserializing failed"); + assert_eq!(decoded, c); + } +} + +#[test] +fn too_big_char_decode() { + let encoded = vec![0x41]; + let decoded: Result = decode_from(&mut &encoded[..], Bounded(1)); + assert!(decoded.is_ok()); + assert_eq!(decoded.unwrap(), 'A'); +} + +#[test] +fn too_big_char_deserialize() { + let serialized = vec![0x41]; + let deserialized: Result = deserialize_from(&mut &serialized[..], Bounded(1)); + assert!(deserialized.is_ok()); + assert_eq!(deserialized.unwrap(), 'A'); +} + +#[test] +fn too_big_encode() { + assert!(encode(&0u32, Bounded(3)).is_err()); + assert!(encode(&0u32, Bounded(4)).is_ok()); + + assert!(encode(&"abcde", Bounded(8 + 4)).is_err()); + assert!(encode(&"abcde", Bounded(8 + 5)).is_ok()); +} + +#[test] +fn too_big_serialize() { + assert!(serialize(&0u32, Bounded(3)).is_err()); + assert!(serialize(&0u32, Bounded(4)).is_ok()); + + assert!(serialize(&"abcde", Bounded(8 + 4)).is_err()); + assert!(serialize(&"abcde", Bounded(8 + 5)).is_ok()); +} + +#[test] +fn test_proxy_encoded_size() { + assert!(proxy_encoded_size(&0u8) == 1); + assert!(proxy_encoded_size(&0u16) == 2); + assert!(proxy_encoded_size(&0u32) == 4); + assert!(proxy_encoded_size(&0u64) == 8); + + // length isize stored as u64 + assert!(proxy_encoded_size(&"") == 8); + assert!(proxy_encoded_size(&"a") == 8 + 1); + + assert!(proxy_encoded_size(&vec![0u32, 1u32, 2u32]) == 8 + 3 * (4)) + +} + +#[test] +fn test_serialized_size() { + assert!(proxy_encoded_size(&0u8) == 1); + assert!(proxy_encoded_size(&0u16) == 2); + assert!(proxy_encoded_size(&0u32) == 4); + assert!(proxy_encoded_size(&0u64) == 8); + + // length isize stored as u64 + assert!(proxy_encoded_size(&"") == 8); + assert!(proxy_encoded_size(&"a") == 8 + 1); + + assert!(proxy_encoded_size(&vec![0u32, 1u32, 2u32]) == 8 + 3 * (4)) +} + +#[test] +fn encode_box() { + the_same(Box::new(5)); +} + +#[test] +fn test_refbox_encode() { + let large_object = vec![1u32,2,3,4,5,6]; + let mut large_map = HashMap::new(); + large_map.insert(1, 2); + + + #[derive(RustcEncodable, RustcDecodable, Debug)] + enum Message<'a> { + M1(RefBox<'a, Vec>), + M2(RefBox<'a, HashMap>) + } + + // Test 1 + { + let encoded = encode(&Message::M1(RefBox::new(&large_object)), Infinite).unwrap(); + let decoded: Message<'static> = decode(&encoded[..]).unwrap(); + + match decoded { + Message::M1(b) => assert!(b.take().deref() == &large_object), + _ => assert!(false) + } + } + + // Test 2 + { + let encoded = encode(&Message::M2(RefBox::new(&large_map)), Infinite).unwrap(); + let decoded: Message<'static> = decode(&encoded[..]).unwrap(); + + match decoded { + Message::M2(b) => assert!(b.take().deref() == &large_map), + _ => assert!(false) + } + } +} + +#[test] +fn test_refbox_serialize() { + let large_object = vec![1u32,2,3,4,5,6]; + let mut large_map = HashMap::new(); + large_map.insert(1, 2); + + + #[derive(RustcEncodable, RustcDecodable, Serialize, Deserialize, Debug)] + enum Message<'a> { + M1(RefBox<'a, Vec>), + M2(RefBox<'a, HashMap>) + } + + // Test 1 + { + let serialized = serialize(&Message::M1(RefBox::new(&large_object)), Infinite).unwrap(); + let deserialized: Message<'static> = deserialize_from(&mut &serialized[..], Infinite).unwrap(); + + match deserialized { + Message::M1(b) => assert!(b.take().deref() == &large_object), + _ => assert!(false) + } + } + + // Test 2 + { + let serialized = serialize(&Message::M2(RefBox::new(&large_map)), Infinite).unwrap(); + let deserialized: Message<'static> = deserialize_from(&mut &serialized[..], Infinite).unwrap(); + + match deserialized { + Message::M2(b) => assert!(b.take().deref() == &large_map), + _ => assert!(false) + } + } +} + +#[test] +fn test_strbox_encode() { + let strx: &'static str = "hello world"; + let encoded = encode(&StrBox::new(strx), Infinite).unwrap(); + let decoded: StrBox<'static> = decode(&encoded[..]).unwrap(); + let stringx: String = decoded.take(); + assert!(strx == &stringx[..]); +} + +#[test] +fn test_strbox_serialize() { + let strx: &'static str = "hello world"; + let serialized = serialize(&StrBox::new(strx), Infinite).unwrap(); + let deserialized: StrBox<'static> = deserialize_from(&mut &serialized[..], Infinite).unwrap(); + let stringx: String = deserialized.take(); + assert!(strx == &stringx[..]); +} + +#[test] +fn test_slicebox_encode() { + let slice = [1u32, 2, 3 ,4, 5]; + let encoded = encode(&SliceBox::new(&slice), Infinite).unwrap(); + let decoded: SliceBox<'static, u32> = decode(&encoded[..]).unwrap(); + { + let sb: &[u32] = &decoded; + assert!(slice == sb); + } + let vecx: Vec = decoded.take(); + assert!(slice == &vecx[..]); +} + +#[test] +fn test_slicebox_serialize() { + let slice = [1u32, 2, 3 ,4, 5]; + let serialized = serialize(&SliceBox::new(&slice), Infinite).unwrap(); + let deserialized: SliceBox<'static, u32> = deserialize_from(&mut &serialized[..], Infinite).unwrap(); + { + let sb: &[u32] = &deserialized; + assert!(slice == sb); + } + let vecx: Vec = deserialized.take(); + assert!(slice == &vecx[..]); +} + +#[test] +fn test_multi_strings_encode() { + assert!(encode(&("foo", "bar", "baz"), Infinite).is_ok()); +} + +#[test] +fn test_multi_strings_serialize() { + assert!(serialize(&("foo", "bar", "baz"), Infinite).is_ok()); +} + +#[test] +fn test_oom_protection() { + use std::io::Cursor; + #[derive(RustcEncodable, RustcDecodable)] + struct FakeVec { + len: u64, + byte: u8 + } + let x = bincode::rustc_serialize::encode(&FakeVec { len: 0xffffffffffffffffu64, byte: 1 }, bincode::SizeLimit::Bounded(10)).unwrap(); + let y : Result, _> = bincode::rustc_serialize::decode_from(&mut Cursor::new(&x[..]), bincode::SizeLimit::Bounded(10)); + assert!(y.is_err()); +} + +#[test] +fn path_buf() { + use std::path::{Path, PathBuf}; + let path = Path::new("foo").to_path_buf(); + let serde_encoded = bincode::serde::serialize(&path, Infinite).unwrap(); + let decoded: PathBuf = bincode::serde::deserialize(&serde_encoded).unwrap(); + assert!(path.to_str() == decoded.to_str()); +} + +#[test] +fn bytes() { + let data = b"abc\0123"; + let b = bincode::rustc_serialize::encode(&data, Infinite).unwrap(); + let s = bincode::serde::serialize(&data, Infinite).unwrap(); + assert_eq!(b, s); + + use serde::bytes::Bytes; + let s2 = bincode::serde::serialize(&Bytes::new(data), Infinite).unwrap(); + assert_eq!(s, s2); +} + +#[test] +fn test_manual_enum_encoding() { + #[derive(PartialEq)] + enum Enumeration { + Variant1, + Variant2 { val: u64 } + } + + impl Encodable for Enumeration { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_enum("Enumeration", |s| { + match *self { + Enumeration::Variant1 => { + s.emit_enum_variant("Variant1", 0, 0, |_| Ok(())) + }, + Enumeration::Variant2 { val } => { + s.emit_enum_struct_variant("Variant2", 1, 1, |s| { + s.emit_enum_struct_variant_field("val", 0, |s| s.emit_u64(val)) + }) + } + } + }) + } + } + + impl Decodable for Enumeration { + fn decode(s: &mut D) -> Result { + s.read_enum("Enumeration", |s| { + s.read_enum_struct_variant(&["Variant1", "Variant2"], |s, num| { + match num { + 0 => Ok(Enumeration::Variant1), + 1 => Ok(Enumeration::Variant2 { val: try!(s.read_u64()) }), + _ => Err(s.error("Unknown enum variant")) + } + }) + }) + } + } + + let encoded = bincode::rustc_serialize::encode(&Enumeration::Variant1, Infinite).unwrap(); + let decoded: Enumeration = decode(&encoded[..]).unwrap(); + assert!(decoded == Enumeration::Variant1); + + let encoded = bincode::rustc_serialize::encode(&Enumeration::Variant2 { val: 42 }, Infinite).unwrap(); + let decoded: Enumeration = decode(&encoded[..]).unwrap(); + assert!(decoded == Enumeration::Variant2 { val: 42 }); +} diff --git a/third_party/rust/bit-set/.cargo-checksum.json b/third_party/rust/bit-set/.cargo-checksum.json new file mode 100644 index 000000000000..634dab4dc518 --- /dev/null +++ b/third_party/rust/bit-set/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"e684c9479b485343f5b932e8f9de7ac046accfb4c1e3c534e6e0fb9e0c8d919b","Cargo.toml":"a30078c3db5bccf6a567ad9ae78a6258d18b990034eda7e4ce8f4b3041ff2aa9","LICENSE-APACHE":"8173d5c29b4f956d532781d2b86e4e30f83e6b7878dce18c919451d6ba707c90","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"d3a2993cd15ac201b30c86fe69f2bb692b386875eace571715007637d7ca7abf","deploy-docs.sh":"7b66111b124c1c7e59cb84cf110d98b5cb783bd35a676e970d9b3035e55f7dfd","src/lib.rs":"7276279f7008dd633d0bb90cc0ff73de170b89d69644fb21c35728c94e913c4d"},"package":"d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"} \ No newline at end of file diff --git a/third_party/rust/bit-set/.cargo-ok b/third_party/rust/bit-set/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/bit-set/.gitignore b/third_party/rust/bit-set/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/third_party/rust/bit-set/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/third_party/rust/bit-set/.travis.yml b/third_party/rust/bit-set/.travis.yml new file mode 100644 index 000000000000..3838a7073a3c --- /dev/null +++ b/third_party/rust/bit-set/.travis.yml @@ -0,0 +1,18 @@ +language: rust +sudo: false +matrix: + include: + - rust: stable + - rust: nightly + env: FEATURES="--features nightly" +script: + - cargo build $FEATURES + - cargo test $FEATURES + - cargo doc --no-deps +after_success: | + [ "$TRAVIS_RUST_VERSION" = nightly ] && + [ "$TRAVIS_BRANCH" = master ] && + [ "$TRAVIS_PULL_REQUEST" = false ] && + bash deploy-docs.sh +notifications: + webhooks: http://huon.me:54857/travis diff --git a/third_party/rust/bit-set/Cargo.toml b/third_party/rust/bit-set/Cargo.toml new file mode 100644 index 000000000000..c1042ccbaf98 --- /dev/null +++ b/third_party/rust/bit-set/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "bit-set" +version = "0.4.0" +authors = ["Alexis Beingessner "] +license = "MIT/Apache-2.0" +description = "A set of bits" +repository = "https://github.com/contain-rs/bit-set" +homepage = "https://github.com/contain-rs/bit-set" +documentation = "https://contain-rs.github.io/bit-set/bit_set" +keywords = ["data-structures", "bitset"] +readme = "README.md" + +[dev-dependencies] +rand = "0.3" + +[dependencies] +bit-vec = "0.4" + +[features] +nightly = [] diff --git a/third_party/rust/bit-set/LICENSE-APACHE b/third_party/rust/bit-set/LICENSE-APACHE new file mode 100644 index 000000000000..11069edd7901 --- /dev/null +++ b/third_party/rust/bit-set/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/bit-set/LICENSE-MIT b/third_party/rust/bit-set/LICENSE-MIT new file mode 100644 index 000000000000..40b8817a47be --- /dev/null +++ b/third_party/rust/bit-set/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2016 The Rust Project Developers + +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. diff --git a/third_party/rust/bit-set/README.md b/third_party/rust/bit-set/README.md new file mode 100644 index 000000000000..7146fe798e99 --- /dev/null +++ b/third_party/rust/bit-set/README.md @@ -0,0 +1,6 @@ +A Set of bits. + +Documentation is available at https://contain-rs.github.io/bit-set/bit_set. + +[![Build Status](https://travis-ci.org/contain-rs/bit-set.svg?branch=master)](https://travis-ci.org/contain-rs/bit-set) +[![crates.io](http://meritbadge.herokuapp.com/bit-set)](https://crates.io/crates/bit-set) diff --git a/third_party/rust/bit-set/deploy-docs.sh b/third_party/rust/bit-set/deploy-docs.sh new file mode 100755 index 000000000000..c8f25ee86b6c --- /dev/null +++ b/third_party/rust/bit-set/deploy-docs.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -o errexit -o nounset + +rev=$(git rev-parse --short HEAD) + +cd target/doc + +git init +git config user.email 'FlashCat@users.noreply.github.com' +git config user.name 'FlashCat' +git remote add upstream "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" +git fetch upstream gh-pages +git reset upstream/gh-pages + +touch . + +git add -A . +git commit -m "rebuild pages at ${rev}" +git push -q upstream HEAD:gh-pages diff --git a/third_party/rust/bit-set/src/lib.rs b/third_party/rust/bit-set/src/lib.rs new file mode 100644 index 000000000000..c88f61ebde61 --- /dev/null +++ b/third_party/rust/bit-set/src/lib.rs @@ -0,0 +1,1436 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! An implementation of a set using a bit vector as an underlying +//! representation for holding unsigned numerical elements. +//! +//! It should also be noted that the amount of storage necessary for holding a +//! set of objects is proportional to the maximum of the objects when viewed +//! as a `usize`. +//! +//! # Examples +//! +//! ``` +//! use bit_set::BitSet; +//! +//! // It's a regular set +//! let mut s = BitSet::new(); +//! s.insert(0); +//! s.insert(3); +//! s.insert(7); +//! +//! s.remove(7); +//! +//! if !s.contains(7) { +//! println!("There is no 7"); +//! } +//! +//! // Can initialize from a `BitVec` +//! let other = BitSet::from_bytes(&[0b11010000]); +//! +//! s.union_with(&other); +//! +//! // Print 0, 1, 3 in some order +//! for x in s.iter() { +//! println!("{}", x); +//! } +//! +//! // Can convert back to a `BitVec` +//! let bv = s.into_bit_vec(); +//! assert!(bv[3]); +//! ``` + +#![cfg_attr(all(test, feature = "nightly"), feature(test))] +#[cfg(all(test, feature = "nightly"))] extern crate test; +#[cfg(all(test, feature = "nightly"))] extern crate rand; +extern crate bit_vec; + +use bit_vec::{BitVec, Blocks, BitBlock}; +use std::cmp::Ordering; +use std::cmp; +use std::fmt; +use std::hash; +use std::iter::{self, Chain, Enumerate, FromIterator, Repeat, Skip, Take}; + +type MatchWords<'a, B> = Chain>, Skip>>>>; + +/// Computes how many blocks are needed to store that many bits +fn blocks_for_bits(bits: usize) -> usize { + // If we want 17 bits, dividing by 32 will produce 0. So we add 1 to make sure we + // reserve enough. But if we want exactly a multiple of 32, this will actually allocate + // one too many. So we need to check if that's the case. We can do that by computing if + // bitwise AND by `32 - 1` is 0. But LLVM should be able to optimize the semantically + // superior modulo operator on a power of two to this. + // + // Note that we can technically avoid this branch with the expression + // `(nbits + BITS - 1) / 32::BITS`, but if nbits is almost usize::MAX this will overflow. + if bits % B::bits() == 0 { + bits / B::bits() + } else { + bits / B::bits() + 1 + } +} + +// Take two BitVec's, and return iterators of their words, where the shorter one +// has been padded with 0's +fn match_words<'a, 'b, B: BitBlock>(a: &'a BitVec, b: &'b BitVec) + -> (MatchWords<'a, B>, MatchWords<'b, B>) +{ + let a_len = a.storage().len(); + let b_len = b.storage().len(); + + // have to uselessly pretend to pad the longer one for type matching + if a_len < b_len { + (a.blocks().enumerate().chain(iter::repeat(B::zero()).enumerate().take(b_len).skip(a_len)), + b.blocks().enumerate().chain(iter::repeat(B::zero()).enumerate().take(0).skip(0))) + } else { + (a.blocks().enumerate().chain(iter::repeat(B::zero()).enumerate().take(0).skip(0)), + b.blocks().enumerate().chain(iter::repeat(B::zero()).enumerate().take(a_len).skip(b_len))) + } +} + +pub struct BitSet { + bit_vec: BitVec, +} + +impl Clone for BitSet { + fn clone(&self) -> Self { + BitSet { + bit_vec: self.bit_vec.clone(), + } + } + + fn clone_from(&mut self, other: &Self) { + self.bit_vec.clone_from(&other.bit_vec); + } +} + +impl Default for BitSet { + #[inline] + fn default() -> Self { BitSet { bit_vec: Default::default() } } +} + +impl FromIterator for BitSet { + fn from_iter>(iter: I) -> Self { + let mut ret = Self::default(); + ret.extend(iter); + ret + } +} + +impl Extend for BitSet { + #[inline] + fn extend>(&mut self, iter: I) { + for i in iter { + self.insert(i); + } + } +} + +impl PartialOrd for BitSet { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option { + self.iter().partial_cmp(other) + } +} + +impl Ord for BitSet { + #[inline] + fn cmp(&self, other: &Self) -> Ordering { + self.iter().cmp(other) + } +} + +impl PartialEq for BitSet { + #[inline] + fn eq(&self, other: &Self) -> bool { + self.iter().eq(other) + } +} + +impl Eq for BitSet {} + +impl BitSet { + /// Creates a new empty `BitSet`. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::new(); + /// ``` + #[inline] + pub fn new() -> Self { + Self::default() + } + + /// Creates a new `BitSet` with initially no contents, able to + /// hold `nbits` elements without resizing. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::with_capacity(100); + /// assert!(s.capacity() >= 100); + /// ``` + #[inline] + pub fn with_capacity(nbits: usize) -> Self { + let bit_vec = BitVec::from_elem(nbits, false); + Self::from_bit_vec(bit_vec) + } + + /// Creates a new `BitSet` from the given bit vector. + /// + /// # Examples + /// + /// ``` + /// extern crate bit_vec; + /// extern crate bit_set; + /// + /// fn main() { + /// use bit_vec::BitVec; + /// use bit_set::BitSet; + /// + /// let bv = BitVec::from_bytes(&[0b01100000]); + /// let s = BitSet::from_bit_vec(bv); + /// + /// // Print 1, 2 in arbitrary order + /// for x in s.iter() { + /// println!("{}", x); + /// } + /// } + /// ``` + #[inline] + pub fn from_bit_vec(bit_vec: BitVec) -> Self { + BitSet { bit_vec: bit_vec } + } + + pub fn from_bytes(bytes: &[u8]) -> Self { + BitSet { bit_vec: BitVec::from_bytes(bytes) } + } +} + +impl BitSet { + + /// Returns the capacity in bits for this bit vector. Inserting any + /// element less than this amount will not trigger a resizing. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::with_capacity(100); + /// assert!(s.capacity() >= 100); + /// ``` + #[inline] + pub fn capacity(&self) -> usize { + self.bit_vec.capacity() + } + + /// Reserves capacity for the given `BitSet` to contain `len` distinct elements. In the case + /// of `BitSet` this means reallocations will not occur as long as all inserted elements + /// are less than `len`. + /// + /// The collection may reserve more space to avoid frequent reallocations. + /// + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::new(); + /// s.reserve_len(10); + /// assert!(s.capacity() >= 10); + /// ``` + pub fn reserve_len(&mut self, len: usize) { + let cur_len = self.bit_vec.len(); + if len >= cur_len { + self.bit_vec.reserve(len - cur_len); + } + } + + /// Reserves the minimum capacity for the given `BitSet` to contain `len` distinct elements. + /// In the case of `BitSet` this means reallocations will not occur as long as all inserted + /// elements are less than `len`. + /// + /// Note that the allocator may give the collection more space than it requests. Therefore + /// capacity can not be relied upon to be precisely minimal. Prefer `reserve_len` if future + /// insertions are expected. + /// + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::new(); + /// s.reserve_len_exact(10); + /// assert!(s.capacity() >= 10); + /// ``` + pub fn reserve_len_exact(&mut self, len: usize) { + let cur_len = self.bit_vec.len(); + if len >= cur_len { + self.bit_vec.reserve_exact(len - cur_len); + } + } + + /// Consumes this set to return the underlying bit vector. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::new(); + /// s.insert(0); + /// s.insert(3); + /// + /// let bv = s.into_bit_vec(); + /// assert!(bv[0]); + /// assert!(bv[3]); + /// ``` + #[inline] + pub fn into_bit_vec(self) -> BitVec { + self.bit_vec + } + + /// Returns a reference to the underlying bit vector. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::new(); + /// s.insert(0); + /// + /// let bv = s.get_ref(); + /// assert_eq!(bv[0], true); + /// ``` + #[inline] + pub fn get_ref(&self) -> &BitVec { + &self.bit_vec + } + + #[inline] + fn other_op(&mut self, other: &Self, mut f: F) where F: FnMut(B, B) -> B { + // Unwrap BitVecs + let self_bit_vec = &mut self.bit_vec; + let other_bit_vec = &other.bit_vec; + + let self_len = self_bit_vec.len(); + let other_len = other_bit_vec.len(); + + // Expand the vector if necessary + if self_len < other_len { + self_bit_vec.grow(other_len - self_len, false); + } + + // virtually pad other with 0's for equal lengths + let other_words = { + let (_, result) = match_words(self_bit_vec, other_bit_vec); + result + }; + + // Apply values found in other + for (i, w) in other_words { + let old = self_bit_vec.storage()[i]; + let new = f(old, w); + unsafe { + self_bit_vec.storage_mut()[i] = new; + } + } + } + + /// Truncates the underlying vector to the least length required. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut s = BitSet::new(); + /// s.insert(32183231); + /// s.remove(32183231); + /// + /// // Internal storage will probably be bigger than necessary + /// println!("old capacity: {}", s.capacity()); + /// + /// // Now should be smaller + /// s.shrink_to_fit(); + /// println!("new capacity: {}", s.capacity()); + /// ``` + #[inline] + pub fn shrink_to_fit(&mut self) { + let bit_vec = &mut self.bit_vec; + // Obtain original length + let old_len = bit_vec.storage().len(); + // Obtain coarse trailing zero length + let n = bit_vec.storage().iter().rev().take_while(|&&n| n == B::zero()).count(); + // Truncate + let trunc_len = cmp::max(old_len - n, 1); + unsafe { + bit_vec.storage_mut().truncate(trunc_len); + bit_vec.set_len(trunc_len * B::bits()); + } + } + + /// Iterator over each usize stored in the `BitSet`. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let s = BitSet::from_bytes(&[0b01001010]); + /// + /// // Print 1, 4, 6 in arbitrary order + /// for x in s.iter() { + /// println!("{}", x); + /// } + /// ``` + #[inline] + pub fn iter(&self) -> Iter { + Iter(BlockIter::from_blocks(self.bit_vec.blocks())) + } + + /// Iterator over each usize stored in `self` union `other`. + /// See [union_with](#method.union_with) for an efficient in-place version. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = BitSet::from_bytes(&[0b01101000]); + /// let b = BitSet::from_bytes(&[0b10100000]); + /// + /// // Print 0, 1, 2, 4 in arbitrary order + /// for x in a.union(&b) { + /// println!("{}", x); + /// } + /// ``` + #[inline] + pub fn union<'a>(&'a self, other: &'a Self) -> Union<'a, B> { + fn or(w1: B, w2: B) -> B { w1 | w2 } + + Union(BlockIter::from_blocks(TwoBitPositions { + set: self.bit_vec.blocks(), + other: other.bit_vec.blocks(), + merge: or, + })) + } + + /// Iterator over each usize stored in `self` intersect `other`. + /// See [intersect_with](#method.intersect_with) for an efficient in-place version. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = BitSet::from_bytes(&[0b01101000]); + /// let b = BitSet::from_bytes(&[0b10100000]); + /// + /// // Print 2 + /// for x in a.intersection(&b) { + /// println!("{}", x); + /// } + /// ``` + #[inline] + pub fn intersection<'a>(&'a self, other: &'a Self) -> Intersection<'a, B> { + fn bitand(w1: B, w2: B) -> B { w1 & w2 } + let min = cmp::min(self.bit_vec.len(), other.bit_vec.len()); + + Intersection(BlockIter::from_blocks(TwoBitPositions { + set: self.bit_vec.blocks(), + other: other.bit_vec.blocks(), + merge: bitand, + }).take(min)) + } + + /// Iterator over each usize stored in the `self` setminus `other`. + /// See [difference_with](#method.difference_with) for an efficient in-place version. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = BitSet::from_bytes(&[0b01101000]); + /// let b = BitSet::from_bytes(&[0b10100000]); + /// + /// // Print 1, 4 in arbitrary order + /// for x in a.difference(&b) { + /// println!("{}", x); + /// } + /// + /// // Note that difference is not symmetric, + /// // and `b - a` means something else. + /// // This prints 0 + /// for x in b.difference(&a) { + /// println!("{}", x); + /// } + /// ``` + #[inline] + pub fn difference<'a>(&'a self, other: &'a Self) -> Difference<'a, B> { + fn diff(w1: B, w2: B) -> B { w1 & !w2 } + + Difference(BlockIter::from_blocks(TwoBitPositions { + set: self.bit_vec.blocks(), + other: other.bit_vec.blocks(), + merge: diff, + })) + } + + /// Iterator over each usize stored in the symmetric difference of `self` and `other`. + /// See [symmetric_difference_with](#method.symmetric_difference_with) for + /// an efficient in-place version. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = BitSet::from_bytes(&[0b01101000]); + /// let b = BitSet::from_bytes(&[0b10100000]); + /// + /// // Print 0, 1, 4 in arbitrary order + /// for x in a.symmetric_difference(&b) { + /// println!("{}", x); + /// } + /// ``` + #[inline] + pub fn symmetric_difference<'a>(&'a self, other: &'a Self) -> SymmetricDifference<'a, B> { + fn bitxor(w1: B, w2: B) -> B { w1 ^ w2 } + + SymmetricDifference(BlockIter::from_blocks(TwoBitPositions { + set: self.bit_vec.blocks(), + other: other.bit_vec.blocks(), + merge: bitxor, + })) + } + + /// Unions in-place with the specified other bit vector. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = 0b01101000; + /// let b = 0b10100000; + /// let res = 0b11101000; + /// + /// let mut a = BitSet::from_bytes(&[a]); + /// let b = BitSet::from_bytes(&[b]); + /// let res = BitSet::from_bytes(&[res]); + /// + /// a.union_with(&b); + /// assert_eq!(a, res); + /// ``` + #[inline] + pub fn union_with(&mut self, other: &Self) { + self.other_op(other, |w1, w2| w1 | w2); + } + + /// Intersects in-place with the specified other bit vector. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = 0b01101000; + /// let b = 0b10100000; + /// let res = 0b00100000; + /// + /// let mut a = BitSet::from_bytes(&[a]); + /// let b = BitSet::from_bytes(&[b]); + /// let res = BitSet::from_bytes(&[res]); + /// + /// a.intersect_with(&b); + /// assert_eq!(a, res); + /// ``` + #[inline] + pub fn intersect_with(&mut self, other: &Self) { + self.other_op(other, |w1, w2| w1 & w2); + } + + /// Makes this bit vector the difference with the specified other bit vector + /// in-place. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = 0b01101000; + /// let b = 0b10100000; + /// let a_b = 0b01001000; // a - b + /// let b_a = 0b10000000; // b - a + /// + /// let mut bva = BitSet::from_bytes(&[a]); + /// let bvb = BitSet::from_bytes(&[b]); + /// let bva_b = BitSet::from_bytes(&[a_b]); + /// let bvb_a = BitSet::from_bytes(&[b_a]); + /// + /// bva.difference_with(&bvb); + /// assert_eq!(bva, bva_b); + /// + /// let bva = BitSet::from_bytes(&[a]); + /// let mut bvb = BitSet::from_bytes(&[b]); + /// + /// bvb.difference_with(&bva); + /// assert_eq!(bvb, bvb_a); + /// ``` + #[inline] + pub fn difference_with(&mut self, other: &Self) { + self.other_op(other, |w1, w2| w1 & !w2); + } + + /// Makes this bit vector the symmetric difference with the specified other + /// bit vector in-place. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let a = 0b01101000; + /// let b = 0b10100000; + /// let res = 0b11001000; + /// + /// let mut a = BitSet::from_bytes(&[a]); + /// let b = BitSet::from_bytes(&[b]); + /// let res = BitSet::from_bytes(&[res]); + /// + /// a.symmetric_difference_with(&b); + /// assert_eq!(a, res); + /// ``` + #[inline] + pub fn symmetric_difference_with(&mut self, other: &Self) { + self.other_op(other, |w1, w2| w1 ^ w2); + } + +/* + /// Moves all elements from `other` into `Self`, leaving `other` empty. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut a = BitSet::new(); + /// a.insert(2); + /// a.insert(6); + /// + /// let mut b = BitSet::new(); + /// b.insert(1); + /// b.insert(3); + /// b.insert(6); + /// + /// a.append(&mut b); + /// + /// assert_eq!(a.len(), 4); + /// assert_eq!(b.len(), 0); + /// assert_eq!(a, BitSet::from_bytes(&[0b01110010])); + /// ``` + pub fn append(&mut self, other: &mut Self) { + self.union_with(other); + other.clear(); + } + + /// Splits the `BitSet` into two at the given key including the key. + /// Retains the first part in-place while returning the second part. + /// + /// # Examples + /// + /// ``` + /// use bit_set::BitSet; + /// + /// let mut a = BitSet::new(); + /// a.insert(2); + /// a.insert(6); + /// a.insert(1); + /// a.insert(3); + /// + /// let b = a.split_off(3); + /// + /// assert_eq!(a.len(), 2); + /// assert_eq!(b.len(), 2); + /// assert_eq!(a, BitSet::from_bytes(&[0b01100000])); + /// assert_eq!(b, BitSet::from_bytes(&[0b00010010])); + /// ``` + pub fn split_off(&mut self, at: usize) -> Self { + let mut other = BitSet::new(); + + if at == 0 { + swap(self, &mut other); + return other; + } else if at >= self.bit_vec.len() { + return other; + } + + // Calculate block and bit at which to split + let w = at / BITS; + let b = at % BITS; + + // Pad `other` with `w` zero blocks, + // append `self`'s blocks in the range from `w` to the end to `other` + other.bit_vec.storage_mut().extend(repeat(0u32).take(w) + .chain(self.bit_vec.storage()[w..].iter().cloned())); + other.bit_vec.nbits = self.bit_vec.nbits; + + if b > 0 { + other.bit_vec.storage_mut()[w] &= !0 << b; + } + + // Sets `bit_vec.len()` and fixes the last block as well + self.bit_vec.truncate(at); + + other + } +*/ + + /// Returns the number of set bits in this set. + #[inline] + pub fn len(&self) -> usize { + self.bit_vec.blocks().fold(0, |acc, n| acc + n.count_ones() as usize) + } + + /// Returns whether there are no bits set in this set + #[inline] + pub fn is_empty(&self) -> bool { + self.bit_vec.none() + } + + /// Clears all bits in this set + #[inline] + pub fn clear(&mut self) { + self.bit_vec.clear(); + } + + /// Returns `true` if this set contains the specified integer. + #[inline] + pub fn contains(&self, value: usize) -> bool { + let bit_vec = &self.bit_vec; + value < bit_vec.len() && bit_vec[value] + } + + /// Returns `true` if the set has no elements in common with `other`. + /// This is equivalent to checking for an empty intersection. + #[inline] + pub fn is_disjoint(&self, other: &Self) -> bool { + self.intersection(other).next().is_none() + } + + /// Returns `true` if the set is a subset of another. + #[inline] + pub fn is_subset(&self, other: &Self) -> bool { + let self_bit_vec = &self.bit_vec; + let other_bit_vec = &other.bit_vec; + let other_blocks = blocks_for_bits::(other_bit_vec.len()); + + // Check that `self` intersect `other` is self + self_bit_vec.blocks().zip(other_bit_vec.blocks()).all(|(w1, w2)| w1 & w2 == w1) && + // Make sure if `self` has any more blocks than `other`, they're all 0 + self_bit_vec.blocks().skip(other_blocks).all(|w| w == B::zero()) + } + + /// Returns `true` if the set is a superset of another. + #[inline] + pub fn is_superset(&self, other: &Self) -> bool { + other.is_subset(self) + } + + /// Adds a value to the set. Returns `true` if the value was not already + /// present in the set. + pub fn insert(&mut self, value: usize) -> bool { + if self.contains(value) { + return false; + } + + // Ensure we have enough space to hold the new element + let len = self.bit_vec.len(); + if value >= len { + self.bit_vec.grow(value - len + 1, false) + } + + self.bit_vec.set(value, true); + return true; + } + + /// Removes a value from the set. Returns `true` if the value was + /// present in the set. + pub fn remove(&mut self, value: usize) -> bool { + if !self.contains(value) { + return false; + } + + self.bit_vec.set(value, false); + + return true; + } +} + +impl fmt::Debug for BitSet { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_set().entries(self).finish() + } +} + +impl hash::Hash for BitSet { + fn hash(&self, state: &mut H) { + for pos in self { + pos.hash(state); + } + } +} + +#[derive(Clone)] +struct BlockIter { + head: B, + head_offset: usize, + tail: T, +} + +impl BlockIter where T: Iterator { + fn from_blocks(mut blocks: T) -> BlockIter { + let h = blocks.next().unwrap_or(B::zero()); + BlockIter {tail: blocks, head: h, head_offset: 0} + } +} + +/// An iterator combining two `BitSet` iterators. +#[derive(Clone)] +struct TwoBitPositions<'a, B: 'a> { + set: Blocks<'a, B>, + other: Blocks<'a, B>, + merge: fn(B, B) -> B, +} + +/// An iterator for `BitSet`. +#[derive(Clone)] +pub struct Iter<'a, B: 'a>(BlockIter, B>); +#[derive(Clone)] +pub struct Union<'a, B: 'a>(BlockIter, B>); +#[derive(Clone)] +pub struct Intersection<'a, B: 'a>(Take, B>>); +#[derive(Clone)] +pub struct Difference<'a, B: 'a>(BlockIter, B>); +#[derive(Clone)] +pub struct SymmetricDifference<'a, B: 'a>(BlockIter, B>); + +impl<'a, T, B: BitBlock> Iterator for BlockIter where T: Iterator { + type Item = usize; + + fn next(&mut self) -> Option { + while self.head == B::zero() { + match self.tail.next() { + Some(w) => self.head = w, + None => return None + } + self.head_offset += B::bits(); + } + + // from the current block, isolate the + // LSB and subtract 1, producing k: + // a block with a number of set bits + // equal to the index of the LSB + let k = (self.head & (!self.head + B::one())) - B::one(); + // update block, removing the LSB + self.head = self.head & (self.head - B::one()); + // return offset + (index of LSB) + Some(self.head_offset + (B::count_ones(k) as usize)) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + match self.tail.size_hint() { + (_, Some(h)) => (0, Some(1 + h * B::bits())), + _ => (0, None) + } + } +} + +impl<'a, B: BitBlock> Iterator for TwoBitPositions<'a, B> { + type Item = B; + + fn next(&mut self) -> Option { + match (self.set.next(), self.other.next()) { + (Some(a), Some(b)) => Some((self.merge)(a, b)), + (Some(a), None) => Some((self.merge)(a, B::zero())), + (None, Some(b)) => Some((self.merge)(B::zero(), b)), + _ => return None + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (a, au) = self.set.size_hint(); + let (b, bu) = self.other.size_hint(); + + let upper = match (au, bu) { + (Some(au), Some(bu)) => Some(cmp::max(au, bu)), + _ => None + }; + + (cmp::max(a, b), upper) + } +} + +impl<'a, B: BitBlock> Iterator for Iter<'a, B> { + type Item = usize; + + #[inline] fn next(&mut self) -> Option { self.0.next() } + #[inline] fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } +} + +impl<'a, B: BitBlock> Iterator for Union<'a, B> { + type Item = usize; + + #[inline] fn next(&mut self) -> Option { self.0.next() } + #[inline] fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } +} + +impl<'a, B: BitBlock> Iterator for Intersection<'a, B> { + type Item = usize; + + #[inline] fn next(&mut self) -> Option { self.0.next() } + #[inline] fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } +} + +impl<'a, B: BitBlock> Iterator for Difference<'a, B> { + type Item = usize; + + #[inline] fn next(&mut self) -> Option { self.0.next() } + #[inline] fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } +} + +impl<'a, B: BitBlock> Iterator for SymmetricDifference<'a, B> { + type Item = usize; + + #[inline] fn next(&mut self) -> Option { self.0.next() } + #[inline] fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } +} + +impl<'a, B: BitBlock> IntoIterator for &'a BitSet { + type Item = usize; + type IntoIter = Iter<'a, B>; + + fn into_iter(self) -> Iter<'a, B> { + self.iter() + } +} + +#[cfg(test)] +mod tests { + use std::cmp::Ordering::{Equal, Greater, Less}; + use super::BitSet; + use bit_vec::BitVec; + + #[test] + fn test_bit_set_show() { + let mut s = BitSet::new(); + s.insert(1); + s.insert(10); + s.insert(50); + s.insert(2); + assert_eq!("{1, 2, 10, 50}", format!("{:?}", s)); + } + + #[test] + fn test_bit_set_from_usizes() { + let usizes = vec![0, 2, 2, 3]; + let a: BitSet = usizes.into_iter().collect(); + let mut b = BitSet::new(); + b.insert(0); + b.insert(2); + b.insert(3); + assert_eq!(a, b); + } + + #[test] + fn test_bit_set_iterator() { + let usizes = vec![0, 2, 2, 3]; + let bit_vec: BitSet = usizes.into_iter().collect(); + + let idxs: Vec<_> = bit_vec.iter().collect(); + assert_eq!(idxs, [0, 2, 3]); + + let long: BitSet = (0..10000).filter(|&n| n % 2 == 0).collect(); + let real: Vec<_> = (0..10000/2).map(|x| x*2).collect(); + + let idxs: Vec<_> = long.iter().collect(); + assert_eq!(idxs, real); + } + + #[test] + fn test_bit_set_frombit_vec_init() { + let bools = [true, false]; + let lengths = [10, 64, 100]; + for &b in &bools { + for &l in &lengths { + let bitset = BitSet::from_bit_vec(BitVec::from_elem(l, b)); + assert_eq!(bitset.contains(1), b); + assert_eq!(bitset.contains((l-1)), b); + assert!(!bitset.contains(l)); + } + } + } + + #[test] + fn test_bit_vec_masking() { + let b = BitVec::from_elem(140, true); + let mut bs = BitSet::from_bit_vec(b); + assert!(bs.contains(139)); + assert!(!bs.contains(140)); + assert!(bs.insert(150)); + assert!(!bs.contains(140)); + assert!(!bs.contains(149)); + assert!(bs.contains(150)); + assert!(!bs.contains(151)); + } + + #[test] + fn test_bit_set_basic() { + let mut b = BitSet::new(); + assert!(b.insert(3)); + assert!(!b.insert(3)); + assert!(b.contains(3)); + assert!(b.insert(4)); + assert!(!b.insert(4)); + assert!(b.contains(3)); + assert!(b.insert(400)); + assert!(!b.insert(400)); + assert!(b.contains(400)); + assert_eq!(b.len(), 3); + } + + #[test] + fn test_bit_set_intersection() { + let mut a = BitSet::new(); + let mut b = BitSet::new(); + + assert!(a.insert(11)); + assert!(a.insert(1)); + assert!(a.insert(3)); + assert!(a.insert(77)); + assert!(a.insert(103)); + assert!(a.insert(5)); + + assert!(b.insert(2)); + assert!(b.insert(11)); + assert!(b.insert(77)); + assert!(b.insert(5)); + assert!(b.insert(3)); + + let expected = [3, 5, 11, 77]; + let actual: Vec<_> = a.intersection(&b).collect(); + assert_eq!(actual, expected); + } + + #[test] + fn test_bit_set_difference() { + let mut a = BitSet::new(); + let mut b = BitSet::new(); + + assert!(a.insert(1)); + assert!(a.insert(3)); + assert!(a.insert(5)); + assert!(a.insert(200)); + assert!(a.insert(500)); + + assert!(b.insert(3)); + assert!(b.insert(200)); + + let expected = [1, 5, 500]; + let actual: Vec<_> = a.difference(&b).collect(); + assert_eq!(actual, expected); + } + + #[test] + fn test_bit_set_symmetric_difference() { + let mut a = BitSet::new(); + let mut b = BitSet::new(); + + assert!(a.insert(1)); + assert!(a.insert(3)); + assert!(a.insert(5)); + assert!(a.insert(9)); + assert!(a.insert(11)); + + assert!(b.insert(3)); + assert!(b.insert(9)); + assert!(b.insert(14)); + assert!(b.insert(220)); + + let expected = [1, 5, 11, 14, 220]; + let actual: Vec<_> = a.symmetric_difference(&b).collect(); + assert_eq!(actual, expected); + } + + #[test] + fn test_bit_set_union() { + let mut a = BitSet::new(); + let mut b = BitSet::new(); + assert!(a.insert(1)); + assert!(a.insert(3)); + assert!(a.insert(5)); + assert!(a.insert(9)); + assert!(a.insert(11)); + assert!(a.insert(160)); + assert!(a.insert(19)); + assert!(a.insert(24)); + assert!(a.insert(200)); + + assert!(b.insert(1)); + assert!(b.insert(5)); + assert!(b.insert(9)); + assert!(b.insert(13)); + assert!(b.insert(19)); + + let expected = [1, 3, 5, 9, 11, 13, 19, 24, 160, 200]; + let actual: Vec<_> = a.union(&b).collect(); + assert_eq!(actual, expected); + } + + #[test] + fn test_bit_set_subset() { + let mut set1 = BitSet::new(); + let mut set2 = BitSet::new(); + + assert!(set1.is_subset(&set2)); // {} {} + set2.insert(100); + assert!(set1.is_subset(&set2)); // {} { 1 } + set2.insert(200); + assert!(set1.is_subset(&set2)); // {} { 1, 2 } + set1.insert(200); + assert!(set1.is_subset(&set2)); // { 2 } { 1, 2 } + set1.insert(300); + assert!(!set1.is_subset(&set2)); // { 2, 3 } { 1, 2 } + set2.insert(300); + assert!(set1.is_subset(&set2)); // { 2, 3 } { 1, 2, 3 } + set2.insert(400); + assert!(set1.is_subset(&set2)); // { 2, 3 } { 1, 2, 3, 4 } + set2.remove(100); + assert!(set1.is_subset(&set2)); // { 2, 3 } { 2, 3, 4 } + set2.remove(300); + assert!(!set1.is_subset(&set2)); // { 2, 3 } { 2, 4 } + set1.remove(300); + assert!(set1.is_subset(&set2)); // { 2 } { 2, 4 } + } + + #[test] + fn test_bit_set_is_disjoint() { + let a = BitSet::from_bytes(&[0b10100010]); + let b = BitSet::from_bytes(&[0b01000000]); + let c = BitSet::new(); + let d = BitSet::from_bytes(&[0b00110000]); + + assert!(!a.is_disjoint(&d)); + assert!(!d.is_disjoint(&a)); + + assert!(a.is_disjoint(&b)); + assert!(a.is_disjoint(&c)); + assert!(b.is_disjoint(&a)); + assert!(b.is_disjoint(&c)); + assert!(c.is_disjoint(&a)); + assert!(c.is_disjoint(&b)); + } + + #[test] + fn test_bit_set_union_with() { + //a should grow to include larger elements + let mut a = BitSet::new(); + a.insert(0); + let mut b = BitSet::new(); + b.insert(5); + let expected = BitSet::from_bytes(&[0b10000100]); + a.union_with(&b); + assert_eq!(a, expected); + + // Standard + let mut a = BitSet::from_bytes(&[0b10100010]); + let mut b = BitSet::from_bytes(&[0b01100010]); + let c = a.clone(); + a.union_with(&b); + b.union_with(&c); + assert_eq!(a.len(), 4); + assert_eq!(b.len(), 4); + } + + #[test] + fn test_bit_set_intersect_with() { + // Explicitly 0'ed bits + let mut a = BitSet::from_bytes(&[0b10100010]); + let mut b = BitSet::from_bytes(&[0b00000000]); + let c = a.clone(); + a.intersect_with(&b); + b.intersect_with(&c); + assert!(a.is_empty()); + assert!(b.is_empty()); + + // Uninitialized bits should behave like 0's + let mut a = BitSet::from_bytes(&[0b10100010]); + let mut b = BitSet::new(); + let c = a.clone(); + a.intersect_with(&b); + b.intersect_with(&c); + assert!(a.is_empty()); + assert!(b.is_empty()); + + // Standard + let mut a = BitSet::from_bytes(&[0b10100010]); + let mut b = BitSet::from_bytes(&[0b01100010]); + let c = a.clone(); + a.intersect_with(&b); + b.intersect_with(&c); + assert_eq!(a.len(), 2); + assert_eq!(b.len(), 2); + } + + #[test] + fn test_bit_set_difference_with() { + // Explicitly 0'ed bits + let mut a = BitSet::from_bytes(&[0b00000000]); + let b = BitSet::from_bytes(&[0b10100010]); + a.difference_with(&b); + assert!(a.is_empty()); + + // Uninitialized bits should behave like 0's + let mut a = BitSet::new(); + let b = BitSet::from_bytes(&[0b11111111]); + a.difference_with(&b); + assert!(a.is_empty()); + + // Standard + let mut a = BitSet::from_bytes(&[0b10100010]); + let mut b = BitSet::from_bytes(&[0b01100010]); + let c = a.clone(); + a.difference_with(&b); + b.difference_with(&c); + assert_eq!(a.len(), 1); + assert_eq!(b.len(), 1); + } + + #[test] + fn test_bit_set_symmetric_difference_with() { + //a should grow to include larger elements + let mut a = BitSet::new(); + a.insert(0); + a.insert(1); + let mut b = BitSet::new(); + b.insert(1); + b.insert(5); + let expected = BitSet::from_bytes(&[0b10000100]); + a.symmetric_difference_with(&b); + assert_eq!(a, expected); + + let mut a = BitSet::from_bytes(&[0b10100010]); + let b = BitSet::new(); + let c = a.clone(); + a.symmetric_difference_with(&b); + assert_eq!(a, c); + + // Standard + let mut a = BitSet::from_bytes(&[0b11100010]); + let mut b = BitSet::from_bytes(&[0b01101010]); + let c = a.clone(); + a.symmetric_difference_with(&b); + b.symmetric_difference_with(&c); + assert_eq!(a.len(), 2); + assert_eq!(b.len(), 2); + } + + #[test] + fn test_bit_set_eq() { + let a = BitSet::from_bytes(&[0b10100010]); + let b = BitSet::from_bytes(&[0b00000000]); + let c = BitSet::new(); + + assert!(a == a); + assert!(a != b); + assert!(a != c); + assert!(b == b); + assert!(b == c); + assert!(c == c); + } + + #[test] + fn test_bit_set_cmp() { + let a = BitSet::from_bytes(&[0b10100010]); + let b = BitSet::from_bytes(&[0b00000000]); + let c = BitSet::new(); + + assert_eq!(a.cmp(&b), Greater); + assert_eq!(a.cmp(&c), Greater); + assert_eq!(b.cmp(&a), Less); + assert_eq!(b.cmp(&c), Equal); + assert_eq!(c.cmp(&a), Less); + assert_eq!(c.cmp(&b), Equal); + } + + #[test] + fn test_bit_vec_remove() { + let mut a = BitSet::new(); + + assert!(a.insert(1)); + assert!(a.remove(1)); + + assert!(a.insert(100)); + assert!(a.remove(100)); + + assert!(a.insert(1000)); + assert!(a.remove(1000)); + a.shrink_to_fit(); + } + + #[test] + fn test_bit_vec_clone() { + let mut a = BitSet::new(); + + assert!(a.insert(1)); + assert!(a.insert(100)); + assert!(a.insert(1000)); + + let mut b = a.clone(); + + assert!(a == b); + + assert!(b.remove(1)); + assert!(a.contains(1)); + + assert!(a.remove(1000)); + assert!(b.contains(1000)); + } + +/* + #[test] + fn test_bit_set_append() { + let mut a = BitSet::new(); + a.insert(2); + a.insert(6); + + let mut b = BitSet::new(); + b.insert(1); + b.insert(3); + b.insert(6); + + a.append(&mut b); + + assert_eq!(a.len(), 4); + assert_eq!(b.len(), 0); + assert!(b.capacity() >= 6); + + assert_eq!(a, BitSet::from_bytes(&[0b01110010])); + } + + #[test] + fn test_bit_set_split_off() { + // Split at 0 + let mut a = BitSet::from_bytes(&[0b10100000, 0b00010010, 0b10010010, + 0b00110011, 0b01101011, 0b10101101]); + + let b = a.split_off(0); + + assert_eq!(a.len(), 0); + assert_eq!(b.len(), 21); + + assert_eq!(b, BitSet::from_bytes(&[0b10100000, 0b00010010, 0b10010010, + 0b00110011, 0b01101011, 0b10101101]); + + // Split behind last element + let mut a = BitSet::from_bytes(&[0b10100000, 0b00010010, 0b10010010, + 0b00110011, 0b01101011, 0b10101101]); + + let b = a.split_off(50); + + assert_eq!(a.len(), 21); + assert_eq!(b.len(), 0); + + assert_eq!(a, BitSet::from_bytes(&[0b10100000, 0b00010010, 0b10010010, + 0b00110011, 0b01101011, 0b10101101])); + + // Split at arbitrary element + let mut a = BitSet::from_bytes(&[0b10100000, 0b00010010, 0b10010010, + 0b00110011, 0b01101011, 0b10101101]); + + let b = a.split_off(34); + + assert_eq!(a.len(), 12); + assert_eq!(b.len(), 9); + + assert_eq!(a, BitSet::from_bytes(&[0b10100000, 0b00010010, 0b10010010, + 0b00110011, 0b01000000])); + assert_eq!(b, BitSet::from_bytes(&[0, 0, 0, 0, + 0b00101011, 0b10101101])); + } +*/ +} + +#[cfg(all(test, feature = "nightly"))] +mod bench { + use super::BitSet; + use bit_vec::BitVec; + use rand::{Rng, thread_rng, ThreadRng}; + + use test::{Bencher, black_box}; + + const BENCH_BITS: usize = 1 << 14; + const BITS: usize = 32; + + fn rng() -> ThreadRng { + thread_rng() + } + + #[bench] + fn bench_bit_vecset_small(b: &mut Bencher) { + let mut r = rng(); + let mut bit_vec = BitSet::new(); + b.iter(|| { + for _ in 0..100 { + bit_vec.insert((r.next_u32() as usize) % BITS); + } + black_box(&bit_vec); + }); + } + + #[bench] + fn bench_bit_vecset_big(b: &mut Bencher) { + let mut r = rng(); + let mut bit_vec = BitSet::new(); + b.iter(|| { + for _ in 0..100 { + bit_vec.insert((r.next_u32() as usize) % BENCH_BITS); + } + black_box(&bit_vec); + }); + } + + #[bench] + fn bench_bit_vecset_iter(b: &mut Bencher) { + let bit_vec = BitSet::from_bit_vec(BitVec::from_fn(BENCH_BITS, + |idx| {idx % 3 == 0})); + b.iter(|| { + let mut sum = 0; + for idx in &bit_vec { + sum += idx as usize; + } + sum + }) + } +} diff --git a/third_party/rust/bit-vec/.cargo-checksum.json b/third_party/rust/bit-vec/.cargo-checksum.json new file mode 100644 index 000000000000..c6d49568646c --- /dev/null +++ b/third_party/rust/bit-vec/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"26dbdd3f33aeefa6216804c025626b8e2bef5c05103410faa5e6e93f20331cbe","Cargo.toml":"895a872c944e7c0f4b6f54bae20c6eb0df2f3b3a67a896fc56d1f22b42f5033e","LICENSE-APACHE":"8173d5c29b4f956d532781d2b86e4e30f83e6b7878dce18c919451d6ba707c90","LICENSE-MIT":"7b63ecd5f1902af1b63729947373683c32745c16a10e8e6292e2e2dcd7e90ae0","README.md":"2a42423b7acd5af0ee7f47dcc430b267cfe4661ced77131af2d6e97e6a15377a","benches/extern.rs":"30152d15cc55493d06396baf9eebb90c8f32b314f0dc77398ac8a121bd5ff917","crusader.sh":"e656dcb62d5122a64d55f837992e63cfd3beee37cf74c5ab6ff178a3c7ef943e","deploy-docs.sh":"7b66111b124c1c7e59cb84cf110d98b5cb783bd35a676e970d9b3035e55f7dfd","src/bench.rs":"a24345464fdbc70b5b877d13fa1b9da809ba4917e592d5de69f01b8b1340e8bb","src/lib.rs":"7b754cfc597877bbae0e94283cce684a3bf62771a2ec5f01838c84dc3c180f8b"},"package":"5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"} \ No newline at end of file diff --git a/third_party/rust/bit-vec/.cargo-ok b/third_party/rust/bit-vec/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/bit-vec/.gitignore b/third_party/rust/bit-vec/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/third_party/rust/bit-vec/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/third_party/rust/bit-vec/.travis.yml b/third_party/rust/bit-vec/.travis.yml new file mode 100644 index 000000000000..a7adcf1f6101 --- /dev/null +++ b/third_party/rust/bit-vec/.travis.yml @@ -0,0 +1,19 @@ +language: rust +sudo: false +matrix: + include: + - rust: stable + - rust: nightly + env: FEATURES="--features nightly" +script: + - cargo build $FEATURES + - cargo test $FEATURES + - cargo doc --no-deps + - bash crusader.sh +after_success: | + [ "$TRAVIS_RUST_VERSION" = nightly ] && + [ "$TRAVIS_BRANCH" = master ] && + [ "$TRAVIS_PULL_REQUEST" = false ] && + bash deploy-docs.sh +notifications: + webhooks: http://huon.me:54857/travis diff --git a/third_party/rust/bit-vec/Cargo.toml b/third_party/rust/bit-vec/Cargo.toml new file mode 100644 index 000000000000..a5f89d895232 --- /dev/null +++ b/third_party/rust/bit-vec/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "bit-vec" +version = "0.4.3" +authors = ["Alexis Beingessner "] +license = "MIT/Apache-2.0" +description = "A vector of bits" +repository = "https://github.com/contain-rs/bit-vec" +homepage = "https://github.com/contain-rs/bit-vec" +documentation = "https://contain-rs.github.io/bit-vec/bit_vec" +keywords = ["data-structures", "bitvec", "bitmask", "bitmap", "bit"] +readme = "README.md" + +[dev-dependencies] +rand = "*" + +[features] +nightly = [] diff --git a/third_party/rust/bit-vec/LICENSE-APACHE b/third_party/rust/bit-vec/LICENSE-APACHE new file mode 100644 index 000000000000..11069edd7901 --- /dev/null +++ b/third_party/rust/bit-vec/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/bit-vec/LICENSE-MIT b/third_party/rust/bit-vec/LICENSE-MIT new file mode 100644 index 000000000000..e69282e381bc --- /dev/null +++ b/third_party/rust/bit-vec/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2015 The Rust Project Developers + +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. diff --git a/third_party/rust/bit-vec/README.md b/third_party/rust/bit-vec/README.md new file mode 100644 index 000000000000..6f523f232881 --- /dev/null +++ b/third_party/rust/bit-vec/README.md @@ -0,0 +1,6 @@ +A Vec of bits. + +Documentation is available at https://contain-rs.github.io/bit-vec/bit_vec. + +[![Build Status](https://travis-ci.org/contain-rs/bit-vec.svg?branch=master)](https://travis-ci.org/contain-rs/bit-vec) +[![crates.io](http://meritbadge.herokuapp.com/bit-vec)](https://crates.io/crates/bit-vec) diff --git a/third_party/rust/bit-vec/benches/extern.rs b/third_party/rust/bit-vec/benches/extern.rs new file mode 100644 index 000000000000..74aa2f7c5a0e --- /dev/null +++ b/third_party/rust/bit-vec/benches/extern.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![cfg(all(test, feature = "nightly"))] + +#![feature(test)] + +extern crate test; +extern crate rand; +extern crate bit_vec; + +pub use bit_vec::BitVec; + +#[path = "../src/bench.rs"] +mod bench; diff --git a/third_party/rust/bit-vec/crusader.sh b/third_party/rust/bit-vec/crusader.sh new file mode 100755 index 000000000000..8becfed7ccc3 --- /dev/null +++ b/third_party/rust/bit-vec/crusader.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +git clone https://github.com/brson/cargo-crusader +cd cargo-crusader +cargo build --release +export PATH=$PATH:`pwd`/target/release/ +cd ../ + +cargo crusader + +exit diff --git a/third_party/rust/bit-vec/deploy-docs.sh b/third_party/rust/bit-vec/deploy-docs.sh new file mode 100755 index 000000000000..c8f25ee86b6c --- /dev/null +++ b/third_party/rust/bit-vec/deploy-docs.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -o errexit -o nounset + +rev=$(git rev-parse --short HEAD) + +cd target/doc + +git init +git config user.email 'FlashCat@users.noreply.github.com' +git config user.name 'FlashCat' +git remote add upstream "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" +git fetch upstream gh-pages +git reset upstream/gh-pages + +touch . + +git add -A . +git commit -m "rebuild pages at ${rev}" +git push -q upstream HEAD:gh-pages diff --git a/third_party/rust/bit-vec/src/bench.rs b/third_party/rust/bit-vec/src/bench.rs new file mode 100644 index 000000000000..29922720c8a7 --- /dev/null +++ b/third_party/rust/bit-vec/src/bench.rs @@ -0,0 +1,116 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use super::BitVec; +use rand::{Rng, weak_rng, XorShiftRng}; + +use test::{Bencher, black_box}; + +const BENCH_BITS : usize = 1 << 14; +const U32_BITS: usize = 32; + +fn rng() -> XorShiftRng { + weak_rng() +} + +#[bench] +fn bench_usize_small(b: &mut Bencher) { + let mut r = rng(); + let mut bit_vec = 0 as usize; + b.iter(|| { + for _ in 0..100 { + bit_vec |= 1 << ((r.next_u32() as usize) % U32_BITS); + } + black_box(&bit_vec); + }); +} + +#[bench] +fn bench_bit_set_big_fixed(b: &mut Bencher) { + let mut r = rng(); + let mut bit_vec = BitVec::from_elem(BENCH_BITS, false); + b.iter(|| { + for _ in 0..100 { + bit_vec.set((r.next_u32() as usize) % BENCH_BITS, true); + } + black_box(&bit_vec); + }); +} + +#[bench] +fn bench_bit_set_big_variable(b: &mut Bencher) { + let mut r = rng(); + let mut bit_vec = BitVec::from_elem(BENCH_BITS, false); + b.iter(|| { + for _ in 0..100 { + bit_vec.set((r.next_u32() as usize) % BENCH_BITS, r.gen()); + } + black_box(&bit_vec); + }); +} + +#[bench] +fn bench_bit_set_small(b: &mut Bencher) { + let mut r = rng(); + let mut bit_vec = BitVec::from_elem(U32_BITS, false); + b.iter(|| { + for _ in 0..100 { + bit_vec.set((r.next_u32() as usize) % U32_BITS, true); + } + black_box(&bit_vec); + }); +} + +#[bench] +fn bench_bit_vec_big_union(b: &mut Bencher) { + let mut b1 = BitVec::from_elem(BENCH_BITS, false); + let b2 = BitVec::from_elem(BENCH_BITS, false); + b.iter(|| { + b1.union(&b2) + }) +} + +#[bench] +fn bench_bit_vec_small_iter(b: &mut Bencher) { + let bit_vec = BitVec::from_elem(U32_BITS, false); + b.iter(|| { + let mut sum = 0; + for _ in 0..10 { + for pres in &bit_vec { + sum += pres as usize; + } + } + sum + }) +} + +#[bench] +fn bench_bit_vec_big_iter(b: &mut Bencher) { + let bit_vec = BitVec::from_elem(BENCH_BITS, false); + b.iter(|| { + let mut sum = 0; + for pres in &bit_vec { + sum += pres as usize; + } + sum + }) +} + +#[bench] +fn bench_from_elem(b: &mut Bencher) { + let cap = black_box(BENCH_BITS); + let bit = black_box(true); + b.iter(|| { + // create a BitVec and popcount it + BitVec::from_elem(cap, bit).blocks() + .fold(0, |acc, b| acc + b.count_ones()) + }); + b.bytes = cap as u64 / 8; +} diff --git a/third_party/rust/bit-vec/src/lib.rs b/third_party/rust/bit-vec/src/lib.rs new file mode 100644 index 000000000000..e3fd024b667b --- /dev/null +++ b/third_party/rust/bit-vec/src/lib.rs @@ -0,0 +1,2089 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// FIXME(Gankro): BitVec and BitSet are very tightly coupled. Ideally (for +// maintenance), they should be in separate files/modules, with BitSet only +// using BitVec's public API. This will be hard for performance though, because +// `BitVec` will not want to leak its internal representation while its internal +// representation as `u32`s must be assumed for best performance. + +// FIXME(tbu-): `BitVec`'s methods shouldn't be `union`, `intersection`, but +// rather `or` and `and`. + +// (1) Be careful, most things can overflow here because the amount of bits in +// memory can overflow `usize`. +// (2) Make sure that the underlying vector has no excess length: +// E. g. `nbits == 16`, `storage.len() == 2` would be excess length, +// because the last word isn't used at all. This is important because some +// methods rely on it (for *CORRECTNESS*). +// (3) Make sure that the unused bits in the last word are zeroed out, again +// other methods rely on it for *CORRECTNESS*. +// (4) `BitSet` is tightly coupled with `BitVec`, so any changes you make in +// `BitVec` will need to be reflected in `BitSet`. + +//! Collections implemented with bit vectors. +//! +//! # Examples +//! +//! This is a simple example of the [Sieve of Eratosthenes][sieve] +//! which calculates prime numbers up to a given limit. +//! +//! [sieve]: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes +//! +//! ``` +//! use bit_vec::BitVec; +//! +//! let max_prime = 10000; +//! +//! // Store the primes as a BitVec +//! let primes = { +//! // Assume all numbers are prime to begin, and then we +//! // cross off non-primes progressively +//! let mut bv = BitVec::from_elem(max_prime, true); +//! +//! // Neither 0 nor 1 are prime +//! bv.set(0, false); +//! bv.set(1, false); +//! +//! for i in 2.. 1 + (max_prime as f64).sqrt() as usize { +//! // if i is a prime +//! if bv[i] { +//! // Mark all multiples of i as non-prime (any multiples below i * i +//! // will have been marked as non-prime previously) +//! for j in i.. { +//! if i * j >= max_prime { +//! break; +//! } +//! bv.set(i * j, false) +//! } +//! } +//! } +//! bv +//! }; +//! +//! // Simple primality tests below our max bound +//! let print_primes = 20; +//! print!("The primes below {} are: ", print_primes); +//! for x in 0..print_primes { +//! if primes.get(x).unwrap_or(false) { +//! print!("{} ", x); +//! } +//! } +//! println!(""); +//! +//! let num_primes = primes.iter().filter(|x| *x).count(); +//! println!("There are {} primes below {}", num_primes, max_prime); +//! assert_eq!(num_primes, 1_229); +//! ``` + +#![cfg_attr(all(test, feature = "nightly"), feature(test))] +#[cfg(all(test, feature = "nightly"))] extern crate test; +#[cfg(all(test, feature = "nightly"))] extern crate rand; + +use std::cmp::Ordering; +use std::cmp; +use std::fmt; +use std::hash; +use std::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat}; +use std::iter::FromIterator; +use std::slice; +use std::{u8, usize}; + +type MutBlocks<'a, B> = slice::IterMut<'a, B>; +type MatchWords<'a, B> = Chain>, Skip>>>>; + +use std::ops::*; + +/// Abstracts over a pile of bits (basically unsigned primitives) +pub trait BitBlock: + Copy + + Add + + Sub + + Shl + + Shr + + Not + + BitAnd + + BitOr + + BitXor + + Rem + + Eq + + Ord + + hash::Hash + +{ + /// How many bits it has + fn bits() -> usize; + /// How many bytes it has + #[inline] + fn bytes() -> usize { Self::bits() / 8 } + /// Convert a byte into this type (lowest-order bits set) + fn from_byte(byte: u8) -> Self; + /// Count the number of 1's in the bitwise repr + fn count_ones(self) -> usize; + /// Get `0` + fn zero() -> Self; + /// Get `1` + fn one() -> Self; +} + +macro_rules! bit_block_impl { + ($(($t: ty, $size: expr)),*) => ($( + impl BitBlock for $t { + #[inline] + fn bits() -> usize { $size } + #[inline] + fn from_byte(byte: u8) -> Self { byte as $t } + #[inline] + fn count_ones(self) -> usize { self.count_ones() as usize } + #[inline] + fn one() -> Self { 1 } + #[inline] + fn zero() -> Self { 0 } + } + )*) +} + +bit_block_impl!{ + (u8, 8), + (u16, 16), + (u32, 32), + (u64, 64), + (usize, std::mem::size_of::() * 8) +} + + +fn reverse_bits(byte: u8) -> u8 { + let mut result = 0; + for i in 0..u8::bits() { + result = result | ((byte >> i) & 1) << (u8::bits() - 1 - i); + } + result +} + +static TRUE: bool = true; +static FALSE: bool = false; + +/// The bitvector type. +/// +/// # Examples +/// +/// ``` +/// use bit_vec::BitVec; +/// +/// let mut bv = BitVec::from_elem(10, false); +/// +/// // insert all primes less than 10 +/// bv.set(2, true); +/// bv.set(3, true); +/// bv.set(5, true); +/// bv.set(7, true); +/// println!("{:?}", bv); +/// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); +/// +/// // flip all values in bitvector, producing non-primes less than 10 +/// bv.negate(); +/// println!("{:?}", bv); +/// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); +/// +/// // reset bitvector to empty +/// bv.clear(); +/// println!("{:?}", bv); +/// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); +/// ``` +pub struct BitVec { + /// Internal representation of the bit vector + storage: Vec, + /// The number of valid bits in the internal representation + nbits: usize +} + +// FIXME(Gankro): NopeNopeNopeNopeNope (wait for IndexGet to be a thing) +impl Index for BitVec { + type Output = bool; + + #[inline] + fn index(&self, i: usize) -> &bool { + if self.get(i).expect("index out of bounds") { + &TRUE + } else { + &FALSE + } + } +} + +/// Computes how many blocks are needed to store that many bits +fn blocks_for_bits(bits: usize) -> usize { + // If we want 17 bits, dividing by 32 will produce 0. So we add 1 to make sure we + // reserve enough. But if we want exactly a multiple of 32, this will actually allocate + // one too many. So we need to check if that's the case. We can do that by computing if + // bitwise AND by `32 - 1` is 0. But LLVM should be able to optimize the semantically + // superior modulo operator on a power of two to this. + // + // Note that we can technically avoid this branch with the expression + // `(nbits + U32_BITS - 1) / 32::BITS`, but if nbits is almost usize::MAX this will overflow. + if bits % B::bits() == 0 { + bits / B::bits() + } else { + bits / B::bits() + 1 + } +} + +/// Computes the bitmask for the final word of the vector +fn mask_for_bits(bits: usize) -> B { + // Note especially that a perfect multiple of U32_BITS should mask all 1s. + (!B::zero()) >> ((B::bits() - bits % B::bits()) % B::bits()) +} + +type B = u32; + +impl BitVec { + + /// Creates an empty `BitVec`. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// let mut bv = BitVec::new(); + /// ``` + pub fn new() -> Self { + Default::default() + } + + /// Creates a `BitVec` that holds `nbits` elements, setting each element + /// to `bit`. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(10, false); + /// assert_eq!(bv.len(), 10); + /// for x in bv.iter() { + /// assert_eq!(x, false); + /// } + /// ``` + pub fn from_elem(nbits: usize, bit: bool) -> Self { + let nblocks = blocks_for_bits::(nbits); + let mut bit_vec = BitVec { + storage: vec![if bit { !B::zero() } else { B::zero() }; nblocks], + nbits: nbits + }; + bit_vec.fix_last_block(); + bit_vec + } + + /// Constructs a new, empty `BitVec` with the specified capacity. + /// + /// The bitvector will be able to hold at least `capacity` bits without + /// reallocating. If `capacity` is 0, it will not allocate. + /// + /// It is important to note that this function does not specify the + /// *length* of the returned bitvector, but only the *capacity*. + pub fn with_capacity(nbits: usize) -> Self { + BitVec { + storage: Vec::with_capacity(blocks_for_bits::(nbits)), + nbits: 0, + } + } + + /// Transforms a byte-vector into a `BitVec`. Each byte becomes eight bits, + /// with the most significant bits of each byte coming first. Each + /// bit becomes `true` if equal to 1 or `false` if equal to 0. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let bv = BitVec::from_bytes(&[0b10100000, 0b00010010]); + /// assert!(bv.eq_vec(&[true, false, true, false, + /// false, false, false, false, + /// false, false, false, true, + /// false, false, true, false])); + /// ``` + pub fn from_bytes(bytes: &[u8]) -> Self { + let len = bytes.len().checked_mul(u8::bits()).expect("capacity overflow"); + let mut bit_vec = BitVec::with_capacity(len); + let complete_words = bytes.len() / B::bytes(); + let extra_bytes = bytes.len() % B::bytes(); + + bit_vec.nbits = len; + + for i in 0..complete_words { + let mut accumulator = B::zero(); + for idx in 0..B::bytes() { + accumulator = accumulator | + (B::from_byte(reverse_bits(bytes[i * B::bytes() + idx])) << (idx * 8)) + } + bit_vec.storage.push(accumulator); + } + + if extra_bytes > 0 { + let mut last_word = B::zero(); + for (i, &byte) in bytes[complete_words * B::bytes()..].iter().enumerate() { + last_word = last_word | + (B::from_byte(reverse_bits(byte)) << (i * 8)); + } + bit_vec.storage.push(last_word); + } + + bit_vec + } + + /// Creates a `BitVec` of the specified length where the value at each index + /// is `f(index)`. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let bv = BitVec::from_fn(5, |i| { i % 2 == 0 }); + /// assert!(bv.eq_vec(&[true, false, true, false, true])); + /// ``` + pub fn from_fn(len: usize, mut f: F) -> Self + where F: FnMut(usize) -> bool + { + let mut bit_vec = BitVec::from_elem(len, false); + for i in 0..len { + bit_vec.set(i, f(i)); + } + bit_vec + } +} + +impl BitVec { + /// Applies the given operation to the blocks of self and other, and sets + /// self to be the result. This relies on the caller not to corrupt the + /// last word. + #[inline] + fn process(&mut self, other: &BitVec, mut op: F) -> bool + where F: FnMut(B, B) -> B { + assert_eq!(self.len(), other.len()); + // This could theoretically be a `debug_assert!`. + assert_eq!(self.storage.len(), other.storage.len()); + let mut changed_bits = B::zero(); + for (a, b) in self.blocks_mut().zip(other.blocks()) { + let w = op(*a, b); + changed_bits = changed_bits | (*a ^ w); + *a = w; + } + changed_bits != B::zero() + } + + /// Iterator over mutable refs to the underlying blocks of data. + fn blocks_mut(&mut self) -> MutBlocks { + // (2) + self.storage.iter_mut() + } + + /// Iterator over the underlying blocks of data + pub fn blocks(&self) -> Blocks { + // (2) + Blocks{iter: self.storage.iter()} + } + + /// Exposes the raw block storage of this BitVec + /// + /// Only really intended for BitSet. + pub fn storage(&self) -> &[B] { + &self.storage + } + + /// Exposes the raw block storage of this BitVec + /// + /// Can probably cause unsafety. Only really intended for BitSet. + pub unsafe fn storage_mut(&mut self) -> &mut Vec { + &mut self.storage + } + + /// An operation might screw up the unused bits in the last block of the + /// `BitVec`. As per (3), it's assumed to be all 0s. This method fixes it up. + fn fix_last_block(&mut self) { + let extra_bits = self.len() % B::bits(); + if extra_bits > 0 { + let mask = (B::one() << extra_bits) - B::one(); + let storage_len = self.storage.len(); + let block = &mut self.storage[storage_len - 1]; + *block = *block & mask; + } + } + + + /// Retrieves the value at index `i`, or `None` if the index is out of bounds. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let bv = BitVec::from_bytes(&[0b01100000]); + /// assert_eq!(bv.get(0), Some(false)); + /// assert_eq!(bv.get(1), Some(true)); + /// assert_eq!(bv.get(100), None); + /// + /// // Can also use array indexing + /// assert_eq!(bv[1], true); + /// ``` + #[inline] + pub fn get(&self, i: usize) -> Option { + if i >= self.nbits { + return None; + } + let w = i / B::bits(); + let b = i % B::bits(); + self.storage.get(w).map(|&block| + (block & (B::one() << b)) != B::zero() + ) + } + + /// Sets the value of a bit at an index `i`. + /// + /// # Panics + /// + /// Panics if `i` is out of bounds. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(5, false); + /// bv.set(3, true); + /// assert_eq!(bv[3], true); + /// ``` + #[inline] + pub fn set(&mut self, i: usize, x: bool) { + assert!(i < self.nbits, "index out of bounds: {:?} >= {:?}", i, self.nbits); + let w = i / B::bits(); + let b = i % B::bits(); + let flag = B::one() << b; + let val = if x { self.storage[w] | flag } + else { self.storage[w] & !flag }; + self.storage[w] = val; + } + + /// Sets all bits to 1. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let before = 0b01100000; + /// let after = 0b11111111; + /// + /// let mut bv = BitVec::from_bytes(&[before]); + /// bv.set_all(); + /// assert_eq!(bv, BitVec::from_bytes(&[after])); + /// ``` + #[inline] + pub fn set_all(&mut self) { + for w in &mut self.storage { *w = !B::zero(); } + self.fix_last_block(); + } + + /// Flips all bits. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let before = 0b01100000; + /// let after = 0b10011111; + /// + /// let mut bv = BitVec::from_bytes(&[before]); + /// bv.negate(); + /// assert_eq!(bv, BitVec::from_bytes(&[after])); + /// ``` + #[inline] + pub fn negate(&mut self) { + for w in &mut self.storage { *w = !*w; } + self.fix_last_block(); + } + + /// Calculates the union of two bitvectors. This acts like the bitwise `or` + /// function. + /// + /// Sets `self` to the union of `self` and `other`. Both bitvectors must be + /// the same length. Returns `true` if `self` changed. + /// + /// # Panics + /// + /// Panics if the bitvectors are of different lengths. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let a = 0b01100100; + /// let b = 0b01011010; + /// let res = 0b01111110; + /// + /// let mut a = BitVec::from_bytes(&[a]); + /// let b = BitVec::from_bytes(&[b]); + /// + /// assert!(a.union(&b)); + /// assert_eq!(a, BitVec::from_bytes(&[res])); + /// ``` + #[inline] + pub fn union(&mut self, other: &Self) -> bool { + self.process(other, |w1, w2| (w1 | w2)) + } + + /// Calculates the intersection of two bitvectors. This acts like the + /// bitwise `and` function. + /// + /// Sets `self` to the intersection of `self` and `other`. Both bitvectors + /// must be the same length. Returns `true` if `self` changed. + /// + /// # Panics + /// + /// Panics if the bitvectors are of different lengths. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let a = 0b01100100; + /// let b = 0b01011010; + /// let res = 0b01000000; + /// + /// let mut a = BitVec::from_bytes(&[a]); + /// let b = BitVec::from_bytes(&[b]); + /// + /// assert!(a.intersect(&b)); + /// assert_eq!(a, BitVec::from_bytes(&[res])); + /// ``` + #[inline] + pub fn intersect(&mut self, other: &Self) -> bool { + self.process(other, |w1, w2| (w1 & w2)) + } + + /// Calculates the difference between two bitvectors. + /// + /// Sets each element of `self` to the value of that element minus the + /// element of `other` at the same index. Both bitvectors must be the same + /// length. Returns `true` if `self` changed. + /// + /// # Panics + /// + /// Panics if the bitvectors are of different length. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let a = 0b01100100; + /// let b = 0b01011010; + /// let a_b = 0b00100100; // a - b + /// let b_a = 0b00011010; // b - a + /// + /// let mut bva = BitVec::from_bytes(&[a]); + /// let bvb = BitVec::from_bytes(&[b]); + /// + /// assert!(bva.difference(&bvb)); + /// assert_eq!(bva, BitVec::from_bytes(&[a_b])); + /// + /// let bva = BitVec::from_bytes(&[a]); + /// let mut bvb = BitVec::from_bytes(&[b]); + /// + /// assert!(bvb.difference(&bva)); + /// assert_eq!(bvb, BitVec::from_bytes(&[b_a])); + /// ``` + #[inline] + pub fn difference(&mut self, other: &Self) -> bool { + self.process(other, |w1, w2| (w1 & !w2)) + } + + /// Returns `true` if all bits are 1. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(5, true); + /// assert_eq!(bv.all(), true); + /// + /// bv.set(1, false); + /// assert_eq!(bv.all(), false); + /// ``` + pub fn all(&self) -> bool { + let mut last_word = !B::zero(); + // Check that every block but the last is all-ones... + self.blocks().all(|elem| { + let tmp = last_word; + last_word = elem; + tmp == !B::zero() + // and then check the last one has enough ones + }) && (last_word == mask_for_bits(self.nbits)) + } + + /// Returns an iterator over the elements of the vector in order. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let bv = BitVec::from_bytes(&[0b01110100, 0b10010010]); + /// assert_eq!(bv.iter().filter(|x| *x).count(), 7); + /// ``` + #[inline] + pub fn iter(&self) -> Iter { + Iter { bit_vec: self, range: 0..self.nbits } + } + +/* + /// Moves all bits from `other` into `Self`, leaving `other` empty. + /// + /// # Examples + /// + /// ``` + /// # #![feature(collections, bit_vec_append_split_off)] + /// use bit_vec::BitVec; + /// + /// let mut a = BitVec::from_bytes(&[0b10000000]); + /// let mut b = BitVec::from_bytes(&[0b01100001]); + /// + /// a.append(&mut b); + /// + /// assert_eq!(a.len(), 16); + /// assert_eq!(b.len(), 0); + /// assert!(a.eq_vec(&[true, false, false, false, false, false, false, false, + /// false, true, true, false, false, false, false, true])); + /// ``` + pub fn append(&mut self, other: &mut Self) { + let b = self.len() % B::bits(); + + self.nbits += other.len(); + other.nbits = 0; + + if b == 0 { + self.storage.append(&mut other.storage); + } else { + self.storage.reserve(other.storage.len()); + + for block in other.storage.drain(..) { + { + let last = self.storage.last_mut().unwrap(); + *last = *last | (block << b); + } + self.storage.push(block >> (B::bits() - b)); + } + } + } + + /// Splits the `BitVec` into two at the given bit, + /// retaining the first half in-place and returning the second one. + /// + /// # Panics + /// + /// Panics if `at` is out of bounds. + /// + /// # Examples + /// + /// ``` + /// # #![feature(collections, bit_vec_append_split_off)] + /// use bit_vec::BitVec; + /// let mut a = BitVec::new(); + /// a.push(true); + /// a.push(false); + /// a.push(false); + /// a.push(true); + /// + /// let b = a.split_off(2); + /// + /// assert_eq!(a.len(), 2); + /// assert_eq!(b.len(), 2); + /// assert!(a.eq_vec(&[true, false])); + /// assert!(b.eq_vec(&[false, true])); + /// ``` + pub fn split_off(&mut self, at: usize) -> Self { + assert!(at <= self.len(), "`at` out of bounds"); + + let mut other = BitVec::new(); + + if at == 0 { + swap(self, &mut other); + return other; + } else if at == self.len() { + return other; + } + + let w = at / B::bits(); + let b = at % B::bits(); + other.nbits = self.nbits - at; + self.nbits = at; + if b == 0 { + // Split at block boundary + other.storage = self.storage.split_off(w); + } else { + other.storage.reserve(self.storage.len() - w); + + { + let mut iter = self.storage[w..].iter(); + let mut last = *iter.next().unwrap(); + for &cur in iter { + other.storage.push((last >> b) | (cur << (B::bits() - b))); + last = cur; + } + other.storage.push(last >> b); + } + + self.storage.truncate(w + 1); + self.fix_last_block(); + } + + other + } +*/ + + /// Returns `true` if all bits are 0. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(10, false); + /// assert_eq!(bv.none(), true); + /// + /// bv.set(3, true); + /// assert_eq!(bv.none(), false); + /// ``` + pub fn none(&self) -> bool { + self.blocks().all(|w| w == B::zero()) + } + + /// Returns `true` if any bit is 1. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(10, false); + /// assert_eq!(bv.any(), false); + /// + /// bv.set(3, true); + /// assert_eq!(bv.any(), true); + /// ``` + #[inline] + pub fn any(&self) -> bool { + !self.none() + } + + /// Organises the bits into bytes, such that the first bit in the + /// `BitVec` becomes the high-order bit of the first byte. If the + /// size of the `BitVec` is not a multiple of eight then trailing bits + /// will be filled-in with `false`. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(3, true); + /// bv.set(1, false); + /// + /// assert_eq!(bv.to_bytes(), [0b10100000]); + /// + /// let mut bv = BitVec::from_elem(9, false); + /// bv.set(2, true); + /// bv.set(8, true); + /// + /// assert_eq!(bv.to_bytes(), [0b00100000, 0b10000000]); + /// ``` + pub fn to_bytes(&self) -> Vec { + // Oh lord, we're mapping this to bytes bit-by-bit! + fn bit(bit_vec: &BitVec, byte: usize, bit: usize) -> u8 { + let offset = byte * 8 + bit; + if offset >= bit_vec.nbits { + 0 + } else { + (bit_vec[offset] as u8) << (7 - bit) + } + } + + let len = self.nbits / 8 + + if self.nbits % 8 == 0 { 0 } else { 1 }; + (0..len).map(|i| + bit(self, i, 0) | + bit(self, i, 1) | + bit(self, i, 2) | + bit(self, i, 3) | + bit(self, i, 4) | + bit(self, i, 5) | + bit(self, i, 6) | + bit(self, i, 7) + ).collect() + } + + /// Compares a `BitVec` to a slice of `bool`s. + /// Both the `BitVec` and slice must have the same length. + /// + /// # Panics + /// + /// Panics if the `BitVec` and slice are of different length. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let bv = BitVec::from_bytes(&[0b10100000]); + /// + /// assert!(bv.eq_vec(&[true, false, true, false, + /// false, false, false, false])); + /// ``` + pub fn eq_vec(&self, v: &[bool]) -> bool { + assert_eq!(self.nbits, v.len()); + self.iter().zip(v.iter().cloned()).all(|(b1, b2)| b1 == b2) + } + + /// Shortens a `BitVec`, dropping excess elements. + /// + /// If `len` is greater than the vector's current length, this has no + /// effect. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_bytes(&[0b01001011]); + /// bv.truncate(2); + /// assert!(bv.eq_vec(&[false, true])); + /// ``` + pub fn truncate(&mut self, len: usize) { + if len < self.len() { + self.nbits = len; + // This fixes (2). + self.storage.truncate(blocks_for_bits::(len)); + self.fix_last_block(); + } + } + + /// Reserves capacity for at least `additional` more bits to be inserted in the given + /// `BitVec`. The collection may reserve more space to avoid frequent reallocations. + /// + /// # Panics + /// + /// Panics if the new capacity overflows `usize`. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(3, false); + /// bv.reserve(10); + /// assert_eq!(bv.len(), 3); + /// assert!(bv.capacity() >= 13); + /// ``` + pub fn reserve(&mut self, additional: usize) { + let desired_cap = self.len().checked_add(additional).expect("capacity overflow"); + let storage_len = self.storage.len(); + if desired_cap > self.capacity() { + self.storage.reserve(blocks_for_bits::(desired_cap) - storage_len); + } + } + + /// Reserves the minimum capacity for exactly `additional` more bits to be inserted in the + /// given `BitVec`. Does nothing if the capacity is already sufficient. + /// + /// Note that the allocator may give the collection more space than it requests. Therefore + /// capacity can not be relied upon to be precisely minimal. Prefer `reserve` if future + /// insertions are expected. + /// + /// # Panics + /// + /// Panics if the new capacity overflows `usize`. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_elem(3, false); + /// bv.reserve(10); + /// assert_eq!(bv.len(), 3); + /// assert!(bv.capacity() >= 13); + /// ``` + pub fn reserve_exact(&mut self, additional: usize) { + let desired_cap = self.len().checked_add(additional).expect("capacity overflow"); + let storage_len = self.storage.len(); + if desired_cap > self.capacity() { + self.storage.reserve_exact(blocks_for_bits::(desired_cap) - storage_len); + } + } + + /// Returns the capacity in bits for this bit vector. Inserting any + /// element less than this amount will not trigger a resizing. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::new(); + /// bv.reserve(10); + /// assert!(bv.capacity() >= 10); + /// ``` + #[inline] + pub fn capacity(&self) -> usize { + self.storage.capacity().checked_mul(B::bits()).unwrap_or(usize::MAX) + } + + /// Grows the `BitVec` in-place, adding `n` copies of `value` to the `BitVec`. + /// + /// # Panics + /// + /// Panics if the new len overflows a `usize`. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_bytes(&[0b01001011]); + /// bv.grow(2, true); + /// assert_eq!(bv.len(), 10); + /// assert_eq!(bv.to_bytes(), [0b01001011, 0b11000000]); + /// ``` + pub fn grow(&mut self, n: usize, value: bool) { + // Note: we just bulk set all the bits in the last word in this fn in multiple places + // which is technically wrong if not all of these bits are to be used. However, at the end + // of this fn we call `fix_last_block` at the end of this fn, which should fix this. + + let new_nbits = self.nbits.checked_add(n).expect("capacity overflow"); + let new_nblocks = blocks_for_bits::(new_nbits); + let full_value = if value { !B::zero() } else { B::zero() }; + + // Correct the old tail word, setting or clearing formerly unused bits + let num_cur_blocks = blocks_for_bits::(self.nbits); + if self.nbits % B::bits() > 0 { + let mask = mask_for_bits::(self.nbits); + if value { + let block = &mut self.storage[num_cur_blocks - 1]; + *block = *block | !mask; + } else { + // Extra bits are already zero by invariant. + } + } + + // Fill in words after the old tail word + let stop_idx = cmp::min(self.storage.len(), new_nblocks); + for idx in num_cur_blocks..stop_idx { + self.storage[idx] = full_value; + } + + // Allocate new words, if needed + if new_nblocks > self.storage.len() { + let to_add = new_nblocks - self.storage.len(); + self.storage.extend(repeat(full_value).take(to_add)); + } + + // Adjust internal bit count + self.nbits = new_nbits; + + self.fix_last_block(); + } + + /// Removes the last bit from the BitVec, and returns it. Returns None if the BitVec is empty. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::from_bytes(&[0b01001001]); + /// assert_eq!(bv.pop(), Some(true)); + /// assert_eq!(bv.pop(), Some(false)); + /// assert_eq!(bv.len(), 6); + /// ``` + pub fn pop(&mut self) -> Option { + if self.is_empty() { + None + } else { + let i = self.nbits - 1; + let ret = self[i]; + // (3) + self.set(i, false); + self.nbits = i; + if self.nbits % B::bits() == 0 { + // (2) + self.storage.pop(); + } + Some(ret) + } + } + + /// Pushes a `bool` onto the end. + /// + /// # Examples + /// + /// ``` + /// use bit_vec::BitVec; + /// + /// let mut bv = BitVec::new(); + /// bv.push(true); + /// bv.push(false); + /// assert!(bv.eq_vec(&[true, false])); + /// ``` + pub fn push(&mut self, elem: bool) { + if self.nbits % B::bits() == 0 { + self.storage.push(B::zero()); + } + let insert_pos = self.nbits; + self.nbits = self.nbits.checked_add(1).expect("Capacity overflow"); + self.set(insert_pos, elem); + } + + /// Returns the total number of bits in this vector + #[inline] + pub fn len(&self) -> usize { self.nbits } + + /// Sets the number of bits that this BitVec considers initialized. + /// + /// Almost certainly can cause bad stuff. Only really intended for BitSet. + pub unsafe fn set_len(&mut self, len: usize) { + self.nbits = len; + } + + /// Returns true if there are no bits in this vector + #[inline] + pub fn is_empty(&self) -> bool { self.len() == 0 } + + /// Clears all bits in this vector. + #[inline] + pub fn clear(&mut self) { + for w in &mut self.storage { *w = B::zero(); } + } +} + +impl Default for BitVec { + #[inline] + fn default() -> Self { BitVec { storage: Vec::new(), nbits: 0 } } +} + +impl FromIterator for BitVec { + fn from_iter>(iter: I) -> Self { + let mut ret: Self = Default::default(); + ret.extend(iter); + ret + } +} + +impl Extend for BitVec { + #[inline] + fn extend>(&mut self, iterable: I) { + let iterator = iterable.into_iter(); + let (min, _) = iterator.size_hint(); + self.reserve(min); + for element in iterator { + self.push(element) + } + } +} + +impl Clone for BitVec { + #[inline] + fn clone(&self) -> Self { + BitVec { storage: self.storage.clone(), nbits: self.nbits } + } + + #[inline] + fn clone_from(&mut self, source: &Self) { + self.nbits = source.nbits; + self.storage.clone_from(&source.storage); + } +} + +impl PartialOrd for BitVec { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for BitVec { + #[inline] + fn cmp(&self, other: &Self) -> Ordering { + let mut a = self.iter(); + let mut b = other.iter(); + loop { + match (a.next(), b.next()) { + (Some(x), Some(y)) => match x.cmp(&y) { + Ordering::Equal => {} + otherwise => return otherwise, + }, + (None, None) => return Ordering::Equal, + (None, _) => return Ordering::Less, + (_, None) => return Ordering::Greater, + } + } + } +} + +impl fmt::Debug for BitVec { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + for bit in self { + try!(write!(fmt, "{}", if bit { 1 } else { 0 })); + } + Ok(()) + } +} + +impl hash::Hash for BitVec { + fn hash(&self, state: &mut H) { + self.nbits.hash(state); + for elem in self.blocks() { + elem.hash(state); + } + } +} + +impl cmp::PartialEq for BitVec { + #[inline] + fn eq(&self, other: &Self) -> bool { + if self.nbits != other.nbits { + return false; + } + self.blocks().zip(other.blocks()).all(|(w1, w2)| w1 == w2) + } +} + +impl cmp::Eq for BitVec {} + +/// An iterator for `BitVec`. +#[derive(Clone)] +pub struct Iter<'a, B: 'a = u32> { + bit_vec: &'a BitVec, + range: Range, +} + +impl<'a, B: BitBlock> Iterator for Iter<'a, B> { + type Item = bool; + + #[inline] + fn next(&mut self) -> Option { + // NB: indexing is slow for extern crates when it has to go through &TRUE or &FALSE + // variables. get is more direct, and unwrap is fine since we're sure of the range. + self.range.next().map(|i| self.bit_vec.get(i).unwrap()) + } + + fn size_hint(&self) -> (usize, Option) { + self.range.size_hint() + } +} + +impl<'a, B: BitBlock> DoubleEndedIterator for Iter<'a, B> { + #[inline] + fn next_back(&mut self) -> Option { + self.range.next_back().map(|i| self.bit_vec.get(i).unwrap()) + } +} + +impl<'a, B: BitBlock> ExactSizeIterator for Iter<'a, B> {} + + +impl<'a, B: BitBlock> IntoIterator for &'a BitVec { + type Item = bool; + type IntoIter = Iter<'a, B>; + + fn into_iter(self) -> Iter<'a, B> { + self.iter() + } +} + + +pub struct IntoIter { + bit_vec: BitVec, + range: Range, +} + +impl Iterator for IntoIter { + type Item = bool; + + #[inline] + fn next(&mut self) -> Option { + self.range.next().map(|i| self.bit_vec.get(i).unwrap()) + } +} + +impl DoubleEndedIterator for IntoIter { + #[inline] + fn next_back(&mut self) -> Option { + self.range.next_back().map(|i| self.bit_vec.get(i).unwrap()) + } +} + +impl ExactSizeIterator for IntoIter {} + +impl IntoIterator for BitVec { + type Item = bool; + type IntoIter = IntoIter; + + fn into_iter(self) -> IntoIter { + let nbits = self.nbits; + IntoIter { bit_vec: self, range: 0..nbits } + } +} + +/// An iterator over the blocks of a `BitVec`. +#[derive(Clone)] +pub struct Blocks<'a, B: 'a> { + iter: slice::Iter<'a, B>, +} + +impl<'a, B: BitBlock> Iterator for Blocks<'a, B> { + type Item = B; + + #[inline] + fn next(&mut self) -> Option { + self.iter.next().cloned() + } + + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } +} + +impl<'a, B: BitBlock> DoubleEndedIterator for Blocks<'a, B> { + #[inline] + fn next_back(&mut self) -> Option { + self.iter.next_back().cloned() + } +} + +impl<'a, B: BitBlock> ExactSizeIterator for Blocks<'a, B> {} + + + + + + + + + + + +#[cfg(test)] +mod tests { + use super::{BitVec, Iter}; + + // This is stupid, but I want to differentiate from a "random" 32 + const U32_BITS: usize = 32; + + #[test] + fn test_to_str() { + let zerolen = BitVec::new(); + assert_eq!(format!("{:?}", zerolen), ""); + + let eightbits = BitVec::from_elem(8, false); + assert_eq!(format!("{:?}", eightbits), "00000000") + } + + #[test] + fn test_0_elements() { + let act = BitVec::new(); + let exp = Vec::new(); + assert!(act.eq_vec(&exp)); + assert!(act.none() && act.all()); + } + + #[test] + fn test_1_element() { + let mut act = BitVec::from_elem(1, false); + assert!(act.eq_vec(&[false])); + assert!(act.none() && !act.all()); + act = BitVec::from_elem(1, true); + assert!(act.eq_vec(&[true])); + assert!(!act.none() && act.all()); + } + + #[test] + fn test_2_elements() { + let mut b = BitVec::from_elem(2, false); + b.set(0, true); + b.set(1, false); + assert_eq!(format!("{:?}", b), "10"); + assert!(!b.none() && !b.all()); + } + + #[test] + fn test_10_elements() { + let mut act; + // all 0 + + act = BitVec::from_elem(10, false); + assert!((act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false]))); + assert!(act.none() && !act.all()); + // all 1 + + act = BitVec::from_elem(10, true); + assert!((act.eq_vec(&[true, true, true, true, true, true, true, true, true, true]))); + assert!(!act.none() && act.all()); + // mixed + + act = BitVec::from_elem(10, false); + act.set(0, true); + act.set(1, true); + act.set(2, true); + act.set(3, true); + act.set(4, true); + assert!((act.eq_vec(&[true, true, true, true, true, false, false, false, false, false]))); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(10, false); + act.set(5, true); + act.set(6, true); + act.set(7, true); + act.set(8, true); + act.set(9, true); + assert!((act.eq_vec(&[false, false, false, false, false, true, true, true, true, true]))); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(10, false); + act.set(0, true); + act.set(3, true); + act.set(6, true); + act.set(9, true); + assert!((act.eq_vec(&[true, false, false, true, false, false, true, false, false, true]))); + assert!(!act.none() && !act.all()); + } + + #[test] + fn test_31_elements() { + let mut act; + // all 0 + + act = BitVec::from_elem(31, false); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false])); + assert!(act.none() && !act.all()); + // all 1 + + act = BitVec::from_elem(31, true); + assert!(act.eq_vec( + &[true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true])); + assert!(!act.none() && act.all()); + // mixed + + act = BitVec::from_elem(31, false); + act.set(0, true); + act.set(1, true); + act.set(2, true); + act.set(3, true); + act.set(4, true); + act.set(5, true); + act.set(6, true); + act.set(7, true); + assert!(act.eq_vec( + &[true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(31, false); + act.set(16, true); + act.set(17, true); + act.set(18, true); + act.set(19, true); + act.set(20, true); + act.set(21, true); + act.set(22, true); + act.set(23, true); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, true, true, true, true, true, true, true, true, + false, false, false, false, false, false, false])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(31, false); + act.set(24, true); + act.set(25, true); + act.set(26, true); + act.set(27, true); + act.set(28, true); + act.set(29, true); + act.set(30, true); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, true, true, true, true, true, true, true])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(31, false); + act.set(3, true); + act.set(17, true); + act.set(30, true); + assert!(act.eq_vec( + &[false, false, false, true, false, false, false, false, false, false, false, false, + false, false, false, false, false, true, false, false, false, false, false, false, + false, false, false, false, false, false, true])); + assert!(!act.none() && !act.all()); + } + + #[test] + fn test_32_elements() { + let mut act; + // all 0 + + act = BitVec::from_elem(32, false); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false])); + assert!(act.none() && !act.all()); + // all 1 + + act = BitVec::from_elem(32, true); + assert!(act.eq_vec( + &[true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true])); + assert!(!act.none() && act.all()); + // mixed + + act = BitVec::from_elem(32, false); + act.set(0, true); + act.set(1, true); + act.set(2, true); + act.set(3, true); + act.set(4, true); + act.set(5, true); + act.set(6, true); + act.set(7, true); + assert!(act.eq_vec( + &[true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(32, false); + act.set(16, true); + act.set(17, true); + act.set(18, true); + act.set(19, true); + act.set(20, true); + act.set(21, true); + act.set(22, true); + act.set(23, true); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, true, true, true, true, true, true, true, true, + false, false, false, false, false, false, false, false])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(32, false); + act.set(24, true); + act.set(25, true); + act.set(26, true); + act.set(27, true); + act.set(28, true); + act.set(29, true); + act.set(30, true); + act.set(31, true); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, true, true, true, true, true, true, true, true])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(32, false); + act.set(3, true); + act.set(17, true); + act.set(30, true); + act.set(31, true); + assert!(act.eq_vec( + &[false, false, false, true, false, false, false, false, false, false, false, false, + false, false, false, false, false, true, false, false, false, false, false, false, + false, false, false, false, false, false, true, true])); + assert!(!act.none() && !act.all()); + } + + #[test] + fn test_33_elements() { + let mut act; + // all 0 + + act = BitVec::from_elem(33, false); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false])); + assert!(act.none() && !act.all()); + // all 1 + + act = BitVec::from_elem(33, true); + assert!(act.eq_vec( + &[true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true])); + assert!(!act.none() && act.all()); + // mixed + + act = BitVec::from_elem(33, false); + act.set(0, true); + act.set(1, true); + act.set(2, true); + act.set(3, true); + act.set(4, true); + act.set(5, true); + act.set(6, true); + act.set(7, true); + assert!(act.eq_vec( + &[true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(33, false); + act.set(16, true); + act.set(17, true); + act.set(18, true); + act.set(19, true); + act.set(20, true); + act.set(21, true); + act.set(22, true); + act.set(23, true); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, true, true, true, true, true, true, true, true, + false, false, false, false, false, false, false, false, false])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(33, false); + act.set(24, true); + act.set(25, true); + act.set(26, true); + act.set(27, true); + act.set(28, true); + act.set(29, true); + act.set(30, true); + act.set(31, true); + assert!(act.eq_vec( + &[false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, true, true, true, true, true, true, true, true, false])); + assert!(!act.none() && !act.all()); + // mixed + + act = BitVec::from_elem(33, false); + act.set(3, true); + act.set(17, true); + act.set(30, true); + act.set(31, true); + act.set(32, true); + assert!(act.eq_vec( + &[false, false, false, true, false, false, false, false, false, false, false, false, + false, false, false, false, false, true, false, false, false, false, false, false, + false, false, false, false, false, false, true, true, true])); + assert!(!act.none() && !act.all()); + } + + #[test] + fn test_equal_differing_sizes() { + let v0 = BitVec::from_elem(10, false); + let v1 = BitVec::from_elem(11, false); + assert!(v0 != v1); + } + + #[test] + fn test_equal_greatly_differing_sizes() { + let v0 = BitVec::from_elem(10, false); + let v1 = BitVec::from_elem(110, false); + assert!(v0 != v1); + } + + #[test] + fn test_equal_sneaky_small() { + let mut a = BitVec::from_elem(1, false); + a.set(0, true); + + let mut b = BitVec::from_elem(1, true); + b.set(0, true); + + assert_eq!(a, b); + } + + #[test] + fn test_equal_sneaky_big() { + let mut a = BitVec::from_elem(100, false); + for i in 0..100 { + a.set(i, true); + } + + let mut b = BitVec::from_elem(100, true); + for i in 0..100 { + b.set(i, true); + } + + assert_eq!(a, b); + } + + #[test] + fn test_from_bytes() { + let bit_vec = BitVec::from_bytes(&[0b10110110, 0b00000000, 0b11111111]); + let str = concat!("10110110", "00000000", "11111111"); + assert_eq!(format!("{:?}", bit_vec), str); + } + + #[test] + fn test_to_bytes() { + let mut bv = BitVec::from_elem(3, true); + bv.set(1, false); + assert_eq!(bv.to_bytes(), [0b10100000]); + + let mut bv = BitVec::from_elem(9, false); + bv.set(2, true); + bv.set(8, true); + assert_eq!(bv.to_bytes(), [0b00100000, 0b10000000]); + } + + #[test] + fn test_from_bools() { + let bools = vec![true, false, true, true]; + let bit_vec: BitVec = bools.iter().map(|n| *n).collect(); + assert_eq!(format!("{:?}", bit_vec), "1011"); + } + + #[test] + fn test_to_bools() { + let bools = vec![false, false, true, false, false, true, true, false]; + assert_eq!(BitVec::from_bytes(&[0b00100110]).iter().collect::>(), bools); + } + + #[test] + fn test_bit_vec_iterator() { + let bools = vec![true, false, true, true]; + let bit_vec: BitVec = bools.iter().map(|n| *n).collect(); + + assert_eq!(bit_vec.iter().collect::>(), bools); + + let long: Vec<_> = (0..10000).map(|i| i % 2 == 0).collect(); + let bit_vec: BitVec = long.iter().map(|n| *n).collect(); + assert_eq!(bit_vec.iter().collect::>(), long) + } + + #[test] + fn test_small_difference() { + let mut b1 = BitVec::from_elem(3, false); + let mut b2 = BitVec::from_elem(3, false); + b1.set(0, true); + b1.set(1, true); + b2.set(1, true); + b2.set(2, true); + assert!(b1.difference(&b2)); + assert!(b1[0]); + assert!(!b1[1]); + assert!(!b1[2]); + } + + #[test] + fn test_big_difference() { + let mut b1 = BitVec::from_elem(100, false); + let mut b2 = BitVec::from_elem(100, false); + b1.set(0, true); + b1.set(40, true); + b2.set(40, true); + b2.set(80, true); + assert!(b1.difference(&b2)); + assert!(b1[0]); + assert!(!b1[40]); + assert!(!b1[80]); + } + + #[test] + fn test_small_clear() { + let mut b = BitVec::from_elem(14, true); + assert!(!b.none() && b.all()); + b.clear(); + assert!(b.none() && !b.all()); + } + + #[test] + fn test_big_clear() { + let mut b = BitVec::from_elem(140, true); + assert!(!b.none() && b.all()); + b.clear(); + assert!(b.none() && !b.all()); + } + + #[test] + fn test_bit_vec_lt() { + let mut a = BitVec::from_elem(5, false); + let mut b = BitVec::from_elem(5, false); + + assert!(!(a < b) && !(b < a)); + b.set(2, true); + assert!(a < b); + a.set(3, true); + assert!(a < b); + a.set(2, true); + assert!(!(a < b) && b < a); + b.set(0, true); + assert!(a < b); + } + + #[test] + fn test_ord() { + let mut a = BitVec::from_elem(5, false); + let mut b = BitVec::from_elem(5, false); + + assert!(a <= b && a >= b); + a.set(1, true); + assert!(a > b && a >= b); + assert!(b < a && b <= a); + b.set(1, true); + b.set(2, true); + assert!(b > a && b >= a); + assert!(a < b && a <= b); + } + + + #[test] + fn test_small_bit_vec_tests() { + let v = BitVec::from_bytes(&[0]); + assert!(!v.all()); + assert!(!v.any()); + assert!(v.none()); + + let v = BitVec::from_bytes(&[0b00010100]); + assert!(!v.all()); + assert!(v.any()); + assert!(!v.none()); + + let v = BitVec::from_bytes(&[0xFF]); + assert!(v.all()); + assert!(v.any()); + assert!(!v.none()); + } + + #[test] + fn test_big_bit_vec_tests() { + let v = BitVec::from_bytes(&[ // 88 bits + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0]); + assert!(!v.all()); + assert!(!v.any()); + assert!(v.none()); + + let v = BitVec::from_bytes(&[ // 88 bits + 0, 0, 0b00010100, 0, + 0, 0, 0, 0b00110100, + 0, 0, 0]); + assert!(!v.all()); + assert!(v.any()); + assert!(!v.none()); + + let v = BitVec::from_bytes(&[ // 88 bits + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF]); + assert!(v.all()); + assert!(v.any()); + assert!(!v.none()); + } + + #[test] + fn test_bit_vec_push_pop() { + let mut s = BitVec::from_elem(5 * U32_BITS - 2, false); + assert_eq!(s.len(), 5 * U32_BITS - 2); + assert_eq!(s[5 * U32_BITS - 3], false); + s.push(true); + s.push(true); + assert_eq!(s[5 * U32_BITS - 2], true); + assert_eq!(s[5 * U32_BITS - 1], true); + // Here the internal vector will need to be extended + s.push(false); + assert_eq!(s[5 * U32_BITS], false); + s.push(false); + assert_eq!(s[5 * U32_BITS + 1], false); + assert_eq!(s.len(), 5 * U32_BITS + 2); + // Pop it all off + assert_eq!(s.pop(), Some(false)); + assert_eq!(s.pop(), Some(false)); + assert_eq!(s.pop(), Some(true)); + assert_eq!(s.pop(), Some(true)); + assert_eq!(s.len(), 5 * U32_BITS - 2); + } + + #[test] + fn test_bit_vec_truncate() { + let mut s = BitVec::from_elem(5 * U32_BITS, true); + + assert_eq!(s, BitVec::from_elem(5 * U32_BITS, true)); + assert_eq!(s.len(), 5 * U32_BITS); + s.truncate(4 * U32_BITS); + assert_eq!(s, BitVec::from_elem(4 * U32_BITS, true)); + assert_eq!(s.len(), 4 * U32_BITS); + // Truncating to a size > s.len() should be a noop + s.truncate(5 * U32_BITS); + assert_eq!(s, BitVec::from_elem(4 * U32_BITS, true)); + assert_eq!(s.len(), 4 * U32_BITS); + s.truncate(3 * U32_BITS - 10); + assert_eq!(s, BitVec::from_elem(3 * U32_BITS - 10, true)); + assert_eq!(s.len(), 3 * U32_BITS - 10); + s.truncate(0); + assert_eq!(s, BitVec::from_elem(0, true)); + assert_eq!(s.len(), 0); + } + + #[test] + fn test_bit_vec_reserve() { + let mut s = BitVec::from_elem(5 * U32_BITS, true); + // Check capacity + assert!(s.capacity() >= 5 * U32_BITS); + s.reserve(2 * U32_BITS); + assert!(s.capacity() >= 7 * U32_BITS); + s.reserve(7 * U32_BITS); + assert!(s.capacity() >= 12 * U32_BITS); + s.reserve_exact(7 * U32_BITS); + assert!(s.capacity() >= 12 * U32_BITS); + s.reserve(7 * U32_BITS + 1); + assert!(s.capacity() >= 12 * U32_BITS + 1); + // Check that length hasn't changed + assert_eq!(s.len(), 5 * U32_BITS); + s.push(true); + s.push(false); + s.push(true); + assert_eq!(s[5 * U32_BITS - 1], true); + assert_eq!(s[5 * U32_BITS - 0], true); + assert_eq!(s[5 * U32_BITS + 1], false); + assert_eq!(s[5 * U32_BITS + 2], true); + } + + #[test] + fn test_bit_vec_grow() { + let mut bit_vec = BitVec::from_bytes(&[0b10110110, 0b00000000, 0b10101010]); + bit_vec.grow(32, true); + assert_eq!(bit_vec, BitVec::from_bytes(&[0b10110110, 0b00000000, 0b10101010, + 0xFF, 0xFF, 0xFF, 0xFF])); + bit_vec.grow(64, false); + assert_eq!(bit_vec, BitVec::from_bytes(&[0b10110110, 0b00000000, 0b10101010, + 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0])); + bit_vec.grow(16, true); + assert_eq!(bit_vec, BitVec::from_bytes(&[0b10110110, 0b00000000, 0b10101010, + 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF])); + } + + #[test] + fn test_bit_vec_extend() { + let mut bit_vec = BitVec::from_bytes(&[0b10110110, 0b00000000, 0b11111111]); + let ext = BitVec::from_bytes(&[0b01001001, 0b10010010, 0b10111101]); + bit_vec.extend(ext.iter()); + assert_eq!(bit_vec, BitVec::from_bytes(&[0b10110110, 0b00000000, 0b11111111, + 0b01001001, 0b10010010, 0b10111101])); + } + +/* nightly + #[test] + fn test_bit_vec_append() { + // Append to BitVec that holds a multiple of U32_BITS bits + let mut a = BitVec::from_bytes(&[0b10100000, 0b00010010, 0b10010010, 0b00110011]); + let mut b = BitVec::new(); + b.push(false); + b.push(true); + b.push(true); + + a.append(&mut b); + + assert_eq!(a.len(), 35); + assert_eq!(b.len(), 0); + assert!(b.capacity() >= 3); + + assert!(a.eq_vec(&[true, false, true, false, false, false, false, false, + false, false, false, true, false, false, true, false, + true, false, false, true, false, false, true, false, + false, false, true, true, false, false, true, true, + false, true, true])); + + // Append to arbitrary BitVec + let mut a = BitVec::new(); + a.push(true); + a.push(false); + + let mut b = BitVec::from_bytes(&[0b10100000, 0b00010010, 0b10010010, 0b00110011, 0b10010101]); + + a.append(&mut b); + + assert_eq!(a.len(), 42); + assert_eq!(b.len(), 0); + assert!(b.capacity() >= 40); + + assert!(a.eq_vec(&[true, false, true, false, true, false, false, false, + false, false, false, false, false, true, false, false, + true, false, true, false, false, true, false, false, + true, false, false, false, true, true, false, false, + true, true, true, false, false, true, false, true, + false, true])); + + // Append to empty BitVec + let mut a = BitVec::new(); + let mut b = BitVec::from_bytes(&[0b10100000, 0b00010010, 0b10010010, 0b00110011, 0b10010101]); + + a.append(&mut b); + + assert_eq!(a.len(), 40); + assert_eq!(b.len(), 0); + assert!(b.capacity() >= 40); + + assert!(a.eq_vec(&[true, false, true, false, false, false, false, false, + false, false, false, true, false, false, true, false, + true, false, false, true, false, false, true, false, + false, false, true, true, false, false, true, true, + true, false, false, true, false, true, false, true])); + + // Append empty BitVec + let mut a = BitVec::from_bytes(&[0b10100000, 0b00010010, 0b10010010, 0b00110011, 0b10010101]); + let mut b = BitVec::new(); + + a.append(&mut b); + + assert_eq!(a.len(), 40); + assert_eq!(b.len(), 0); + + assert!(a.eq_vec(&[true, false, true, false, false, false, false, false, + false, false, false, true, false, false, true, false, + true, false, false, true, false, false, true, false, + false, false, true, true, false, false, true, true, + true, false, false, true, false, true, false, true])); + } + + + #[test] + fn test_bit_vec_split_off() { + // Split at 0 + let mut a = BitVec::new(); + a.push(true); + a.push(false); + a.push(false); + a.push(true); + + let b = a.split_off(0); + + assert_eq!(a.len(), 0); + assert_eq!(b.len(), 4); + + assert!(b.eq_vec(&[true, false, false, true])); + + // Split at last bit + a.truncate(0); + a.push(true); + a.push(false); + a.push(false); + a.push(true); + + let b = a.split_off(4); + + assert_eq!(a.len(), 4); + assert_eq!(b.len(), 0); + + assert!(a.eq_vec(&[true, false, false, true])); + + // Split at block boundary + let mut a = BitVec::from_bytes(&[0b10100000, 0b00010010, 0b10010010, 0b00110011, 0b11110011]); + + let b = a.split_off(32); + + assert_eq!(a.len(), 32); + assert_eq!(b.len(), 8); + + assert!(a.eq_vec(&[true, false, true, false, false, false, false, false, + false, false, false, true, false, false, true, false, + true, false, false, true, false, false, true, false, + false, false, true, true, false, false, true, true])); + assert!(b.eq_vec(&[true, true, true, true, false, false, true, true])); + + // Don't split at block boundary + let mut a = BitVec::from_bytes(&[0b10100000, 0b00010010, 0b10010010, 0b00110011, + 0b01101011, 0b10101101]); + + let b = a.split_off(13); + + assert_eq!(a.len(), 13); + assert_eq!(b.len(), 35); + + assert!(a.eq_vec(&[true, false, true, false, false, false, false, false, + false, false, false, true, false])); + assert!(b.eq_vec(&[false, true, false, true, false, false, true, false, + false, true, false, false, false, true, true, false, + false, true, true, false, true, true, false, true, + false, true, true, true, false, true, false, true, + true, false, true])); + } +*/ + + #[test] + fn test_into_iter() { + let bools = vec![true, false, true, true]; + let bit_vec: BitVec = bools.iter().map(|n| *n).collect(); + let mut iter = bit_vec.into_iter(); + assert_eq!(Some(true), iter.next()); + assert_eq!(Some(false), iter.next()); + assert_eq!(Some(true), iter.next()); + assert_eq!(Some(true), iter.next()); + assert_eq!(None, iter.next()); + assert_eq!(None, iter.next()); + + let bit_vec: BitVec = bools.iter().map(|n| *n).collect(); + let mut iter = bit_vec.into_iter(); + assert_eq!(Some(true), iter.next_back()); + assert_eq!(Some(true), iter.next_back()); + assert_eq!(Some(false), iter.next_back()); + assert_eq!(Some(true), iter.next_back()); + assert_eq!(None, iter.next_back()); + assert_eq!(None, iter.next_back()); + + let bit_vec: BitVec = bools.iter().map(|n| *n).collect(); + let mut iter = bit_vec.into_iter(); + assert_eq!(Some(true), iter.next_back()); + assert_eq!(Some(true), iter.next()); + assert_eq!(Some(false), iter.next()); + assert_eq!(Some(true), iter.next_back()); + assert_eq!(None, iter.next()); + assert_eq!(None, iter.next_back()); + } + + #[test] + fn iter() { + let b = BitVec::with_capacity(10); + let _a: Iter = b.iter(); + } +} + +#[cfg(all(test, feature = "nightly"))] mod bench; + diff --git a/third_party/rust/bitflags/.cargo-checksum.json b/third_party/rust/bitflags/.cargo-checksum.json new file mode 100644 index 000000000000..c2012b545406 --- /dev/null +++ b/third_party/rust/bitflags/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"2b615144d3f4b2e63ba6ec435cc18df7d76354aa07c2a02d6c707028cc448784","Cargo.toml":"db8c2e9ea912c5f3d2d89cf4cf936c448300e356b0fb533db8875923cb135256","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"8cfbc986af45867d9e620188af2392320fe6e0d9536753ba415c94ab522f5fb5","src/lib.rs":"618ce383bb219725363fba174fc66beb4874d9682e5da953f9e3e9cb3f786d5f","tests/external.rs":"546e549ec831876a5dc272bd0537adc9e9886c6da54656c825e7bffc079e2c74","tests/external_no_std.rs":"48929f5109aabc156442d5ae2ab07b4bce5d648488bf49dba725f6ab23bcb48a"},"package":"aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"} \ No newline at end of file diff --git a/third_party/rust/bitflags/.cargo-ok b/third_party/rust/bitflags/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/bitflags/.gitignore b/third_party/rust/bitflags/.gitignore new file mode 100644 index 000000000000..4fffb2f89cbd --- /dev/null +++ b/third_party/rust/bitflags/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/third_party/rust/bitflags/.travis.yml b/third_party/rust/bitflags/.travis.yml new file mode 100644 index 000000000000..60344466a177 --- /dev/null +++ b/third_party/rust/bitflags/.travis.yml @@ -0,0 +1,24 @@ +language: rust +rust: + - stable + - beta + - nightly +sudo: false +script: + - cargo build --verbose + - cargo test --verbose + - cargo doc +after_success: | + [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + [ $TRAVIS_RUST_VERSION = nightly ] && + echo '' > target/doc/index.html && + pip install ghp-import --user $USER && + $HOME/.local/bin/ghp-import -n target/doc && + git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages +env: + global: + secure: d+l63TtlF6cfFVDGauYRexgx4lBww4ORqqK4Vt75nWbiCbjZYsKXbcTUdhAr193nIVGiNW50A8SekM01F3EngHwHwr6u5kFleOggm+HA0kkBVeX+k2A4WCVVfYI+gth+zk99WaF8h46MA0evhx6FYDoqeyl9oqmVifI4kaqhMwc= +notifications: + email: + on_success: never diff --git a/third_party/rust/bitflags/Cargo.toml b/third_party/rust/bitflags/Cargo.toml new file mode 100644 index 000000000000..042497e9caf7 --- /dev/null +++ b/third_party/rust/bitflags/Cargo.toml @@ -0,0 +1,13 @@ +[package] + +name = "bitflags" +version = "0.7.0" +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/rust-lang/bitflags" +homepage = "https://github.com/rust-lang/bitflags" +documentation = "https://doc.rust-lang.org/bitflags" +description = """ +A macro to generate structures which behave like bitflags. +""" diff --git a/third_party/rust/bitflags/LICENSE-APACHE b/third_party/rust/bitflags/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/bitflags/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/bitflags/LICENSE-MIT b/third_party/rust/bitflags/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/bitflags/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +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. diff --git a/third_party/rust/bitflags/README.md b/third_party/rust/bitflags/README.md new file mode 100644 index 000000000000..3edd8a361ef4 --- /dev/null +++ b/third_party/rust/bitflags/README.md @@ -0,0 +1,24 @@ +bitflags +======== + +A Rust macro to generate structures which behave like a set of bitflags + +[![Build Status](https://travis-ci.org/rust-lang-nursery/bitflags.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/bitflags) + +[Documentation](https://doc.rust-lang.org/bitflags) + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +bitflags = "0.6" +``` + +and this to your crate root: + +```rust +#[macro_use] +extern crate bitflags; +``` diff --git a/third_party/rust/bitflags/src/lib.rs b/third_party/rust/bitflags/src/lib.rs new file mode 100644 index 000000000000..698799dab2ea --- /dev/null +++ b/third_party/rust/bitflags/src/lib.rs @@ -0,0 +1,808 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A typesafe bitmask flag generator. + +#![no_std] + +#[cfg(test)] +#[macro_use] +extern crate std; + +// Re-export libstd/libcore using an alias so that the macros can work in no_std +// crates while remaining compatible with normal crates. +#[allow(private_in_public)] +#[doc(hidden)] +pub use core as __core; + +/// The `bitflags!` macro generates a `struct` that holds a set of C-style +/// bitmask flags. It is useful for creating typesafe wrappers for C APIs. +/// +/// The flags should only be defined for integer types, otherwise unexpected +/// type errors may occur at compile time. +/// +/// # Example +/// +/// ```{.rust} +/// #[macro_use] +/// extern crate bitflags; +/// +/// bitflags! { +/// flags Flags: u32 { +/// const FLAG_A = 0b00000001, +/// const FLAG_B = 0b00000010, +/// const FLAG_C = 0b00000100, +/// const FLAG_ABC = FLAG_A.bits +/// | FLAG_B.bits +/// | FLAG_C.bits, +/// } +/// } +/// +/// fn main() { +/// let e1 = FLAG_A | FLAG_C; +/// let e2 = FLAG_B | FLAG_C; +/// assert_eq!((e1 | e2), FLAG_ABC); // union +/// assert_eq!((e1 & e2), FLAG_C); // intersection +/// assert_eq!((e1 - e2), FLAG_A); // set difference +/// assert_eq!(!e2, FLAG_A); // set complement +/// } +/// ``` +/// +/// The generated `struct`s can also be extended with type and trait +/// implementations: +/// +/// ```{.rust} +/// #[macro_use] +/// extern crate bitflags; +/// +/// use std::fmt; +/// +/// bitflags! { +/// flags Flags: u32 { +/// const FLAG_A = 0b00000001, +/// const FLAG_B = 0b00000010, +/// } +/// } +/// +/// impl Flags { +/// pub fn clear(&mut self) { +/// self.bits = 0; // The `bits` field can be accessed from within the +/// // same module where the `bitflags!` macro was invoked. +/// } +/// } +/// +/// impl fmt::Display for Flags { +/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +/// write!(f, "hi!") +/// } +/// } +/// +/// fn main() { +/// let mut flags = FLAG_A | FLAG_B; +/// flags.clear(); +/// assert!(flags.is_empty()); +/// assert_eq!(format!("{}", flags), "hi!"); +/// assert_eq!(format!("{:?}", FLAG_A | FLAG_B), "FLAG_A | FLAG_B"); +/// assert_eq!(format!("{:?}", FLAG_B), "FLAG_B"); +/// } +/// ``` +/// +/// # Visibility +/// +/// The generated struct and its associated flag constants are not exported +/// out of the current module by default. A definition can be exported out of +/// the current module by adding `pub` before `flags`: +/// +/// ```{.rust},ignore +/// #[macro_use] +/// extern crate bitflags; +/// +/// mod example { +/// bitflags! { +/// pub flags Flags1: u32 { +/// const FLAG_A = 0b00000001, +/// } +/// } +/// bitflags! { +/// flags Flags2: u32 { +/// const FLAG_B = 0b00000010, +/// } +/// } +/// } +/// +/// fn main() { +/// let flag1 = example::FLAG_A; +/// let flag2 = example::FLAG_B; // error: const `FLAG_B` is private +/// } +/// ``` +/// +/// # Attributes +/// +/// Attributes can be attached to the generated `struct` by placing them +/// before the `flags` keyword. +/// +/// # Trait implementations +/// +/// The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash` +/// traits automatically derived for the `struct` using the `derive` attribute. +/// Additional traits can be derived by providing an explicit `derive` +/// attribute on `flags`. +/// +/// The `Extend` and `FromIterator` traits are implemented for the `struct`, +/// too: `Extend` adds the union of the instances of the `struct` iterated over, +/// while `FromIterator` calculates the union. +/// +/// The `Debug` trait is also implemented by displaying the bits value of the +/// internal struct. +/// +/// ## Operators +/// +/// The following operator traits are implemented for the generated `struct`: +/// +/// - `BitOr` and `BitOrAssign`: union +/// - `BitAnd` and `BitAndAssign`: intersection +/// - `BitXor` and `BitXorAssign`: toggle +/// - `Sub` and `SubAssign`: set difference +/// - `Not`: set complement +/// +/// As long as the assignment operators are unstable rust feature they are only +/// available with the crate feature `assignment_ops` enabled. +/// +/// # Methods +/// +/// The following methods are defined for the generated `struct`: +/// +/// - `empty`: an empty set of flags +/// - `all`: the set of all flags +/// - `bits`: the raw value of the flags currently stored +/// - `from_bits`: convert from underlying bit representation, unless that +/// representation contains bits that do not correspond to a flag +/// - `from_bits_truncate`: convert from underlying bit representation, dropping +/// any bits that do not correspond to flags +/// - `is_empty`: `true` if no flags are currently stored +/// - `is_all`: `true` if all flags are currently set +/// - `intersects`: `true` if there are flags common to both `self` and `other` +/// - `contains`: `true` all of the flags in `other` are contained within `self` +/// - `insert`: inserts the specified flags in-place +/// - `remove`: removes the specified flags in-place +/// - `toggle`: the specified flags will be inserted if not present, and removed +/// if they are. +#[macro_export] +macro_rules! bitflags { + ($(#[$attr:meta])* pub flags $BitFlags:ident: $T:ty { + $($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+ + }) => { + #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)] + $(#[$attr])* + pub struct $BitFlags { + bits: $T, + } + + $($(#[$Flag_attr])* pub const $Flag: $BitFlags = $BitFlags { bits: $value };)+ + + bitflags! { + @_impl flags $BitFlags: $T { + $($(#[$Flag_attr])* const $Flag = $value),+ + } + } + }; + ($(#[$attr:meta])* flags $BitFlags:ident: $T:ty { + $($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+ + }) => { + #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)] + $(#[$attr])* + struct $BitFlags { + bits: $T, + } + + $($(#[$Flag_attr])* const $Flag: $BitFlags = $BitFlags { bits: $value };)+ + + bitflags! { + @_impl flags $BitFlags: $T { + $($(#[$Flag_attr])* const $Flag = $value),+ + } + } + }; + (@_impl flags $BitFlags:ident: $T:ty { + $($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+ + }) => { + impl $crate::__core::fmt::Debug for $BitFlags { + fn fmt(&self, f: &mut $crate::__core::fmt::Formatter) -> $crate::__core::fmt::Result { + // This convoluted approach is to handle #[cfg]-based flag + // omission correctly. Some of the $Flag variants may not be + // defined in this module so we create an inner module which + // defines *all* flags to the value of 0. We then create a + // second inner module that defines all of the flags with #[cfg] + // to their real values. Afterwards the glob will import + // variants from the second inner module, shadowing all + // defined variants, leaving only the undefined ones with the + // bit value of 0. + #[allow(dead_code)] + #[allow(unused_assignments)] + mod dummy { + // We can't use the real $BitFlags struct because it may be + // private, which prevents us from using it to define + // public constants. + pub struct $BitFlags { + bits: u64, + } + mod real_flags { + use super::$BitFlags; + $($(#[$Flag_attr])* pub const $Flag: $BitFlags = $BitFlags { + bits: super::super::$Flag.bits as u64 + };)+ + } + // Now we define the "undefined" versions of the flags. + // This way, all the names exist, even if some are #[cfg]ed + // out. + $(const $Flag: $BitFlags = $BitFlags { bits: 0 };)+ + + #[inline] + pub fn fmt(self_: u64, + f: &mut $crate::__core::fmt::Formatter) + -> $crate::__core::fmt::Result { + // Now we import the real values for the flags. + // Only ones that are #[cfg]ed out will be 0. + use self::real_flags::*; + + let mut first = true; + $( + // $Flag.bits == 0 means that $Flag doesn't exist + if $Flag.bits != 0 && self_ & $Flag.bits as u64 == $Flag.bits as u64 { + if !first { + try!(f.write_str(" | ")); + } + first = false; + try!(f.write_str(stringify!($Flag))); + } + )+ + Ok(()) + } + } + dummy::fmt(self.bits as u64, f) + } + } + + #[allow(dead_code)] + impl $BitFlags { + /// Returns an empty set of flags. + #[inline] + pub fn empty() -> $BitFlags { + $BitFlags { bits: 0 } + } + + /// Returns the set containing all flags. + #[inline] + pub fn all() -> $BitFlags { + // See above `dummy` module for why this approach is taken. + #[allow(dead_code)] + mod dummy { + pub struct $BitFlags { + bits: u64, + } + mod real_flags { + use super::$BitFlags; + $($(#[$Flag_attr])* pub const $Flag: $BitFlags = $BitFlags { + bits: super::super::$Flag.bits as u64 + };)+ + } + $(const $Flag: $BitFlags = $BitFlags { bits: 0 };)+ + + #[inline] + pub fn all() -> u64 { + use self::real_flags::*; + $($Flag.bits)|+ + } + } + $BitFlags { bits: dummy::all() as $T } + } + + /// Returns the raw value of the flags currently stored. + #[inline] + pub fn bits(&self) -> $T { + self.bits + } + + /// Convert from underlying bit representation, unless that + /// representation contains bits that do not correspond to a flag. + #[inline] + pub fn from_bits(bits: $T) -> $crate::__core::option::Option<$BitFlags> { + if (bits & !$BitFlags::all().bits()) == 0 { + $crate::__core::option::Option::Some($BitFlags { bits: bits }) + } else { + $crate::__core::option::Option::None + } + } + + /// Convert from underlying bit representation, dropping any bits + /// that do not correspond to flags. + #[inline] + pub fn from_bits_truncate(bits: $T) -> $BitFlags { + $BitFlags { bits: bits } & $BitFlags::all() + } + + /// Returns `true` if no flags are currently stored. + #[inline] + pub fn is_empty(&self) -> bool { + *self == $BitFlags::empty() + } + + /// Returns `true` if all flags are currently set. + #[inline] + pub fn is_all(&self) -> bool { + *self == $BitFlags::all() + } + + /// Returns `true` if there are flags common to both `self` and `other`. + #[inline] + pub fn intersects(&self, other: $BitFlags) -> bool { + !(*self & other).is_empty() + } + + /// Returns `true` all of the flags in `other` are contained within `self`. + #[inline] + pub fn contains(&self, other: $BitFlags) -> bool { + (*self & other) == other + } + + /// Inserts the specified flags in-place. + #[inline] + pub fn insert(&mut self, other: $BitFlags) { + self.bits |= other.bits; + } + + /// Removes the specified flags in-place. + #[inline] + pub fn remove(&mut self, other: $BitFlags) { + self.bits &= !other.bits; + } + + /// Toggles the specified flags in-place. + #[inline] + pub fn toggle(&mut self, other: $BitFlags) { + self.bits ^= other.bits; + } + } + + impl $crate::__core::ops::BitOr for $BitFlags { + type Output = $BitFlags; + + /// Returns the union of the two sets of flags. + #[inline] + fn bitor(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits | other.bits } + } + } + + impl $crate::__core::ops::BitOrAssign for $BitFlags { + + /// Adds the set of flags. + #[inline] + fn bitor_assign(&mut self, other: $BitFlags) { + self.bits |= other.bits; + } + } + + impl $crate::__core::ops::BitXor for $BitFlags { + type Output = $BitFlags; + + /// Returns the left flags, but with all the right flags toggled. + #[inline] + fn bitxor(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits ^ other.bits } + } + } + + impl $crate::__core::ops::BitXorAssign for $BitFlags { + + /// Toggles the set of flags. + #[inline] + fn bitxor_assign(&mut self, other: $BitFlags) { + self.bits ^= other.bits; + } + } + + impl $crate::__core::ops::BitAnd for $BitFlags { + type Output = $BitFlags; + + /// Returns the intersection between the two sets of flags. + #[inline] + fn bitand(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits & other.bits } + } + } + + impl $crate::__core::ops::BitAndAssign for $BitFlags { + + /// Disables all flags disabled in the set. + #[inline] + fn bitand_assign(&mut self, other: $BitFlags) { + self.bits &= other.bits; + } + } + + impl $crate::__core::ops::Sub for $BitFlags { + type Output = $BitFlags; + + /// Returns the set difference of the two sets of flags. + #[inline] + fn sub(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits & !other.bits } + } + } + + impl $crate::__core::ops::SubAssign for $BitFlags { + + /// Disables all flags enabled in the set. + #[inline] + fn sub_assign(&mut self, other: $BitFlags) { + self.bits &= !other.bits; + } + } + + impl $crate::__core::ops::Not for $BitFlags { + type Output = $BitFlags; + + /// Returns the complement of this set of flags. + #[inline] + fn not(self) -> $BitFlags { + $BitFlags { bits: !self.bits } & $BitFlags::all() + } + } + + impl $crate::__core::iter::Extend<$BitFlags> for $BitFlags { + fn extend>(&mut self, iterator: T) { + for item in iterator { + self.insert(item) + } + } + } + + impl $crate::__core::iter::FromIterator<$BitFlags> for $BitFlags { + fn from_iter>(iterator: T) -> $BitFlags { + let mut result = Self::empty(); + result.extend(iterator); + result + } + } + }; + ($(#[$attr:meta])* pub flags $BitFlags:ident: $T:ty { + $($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+, + }) => { + bitflags! { + $(#[$attr])* + pub flags $BitFlags: $T { + $($(#[$Flag_attr])* const $Flag = $value),+ + } + } + }; + ($(#[$attr:meta])* flags $BitFlags:ident: $T:ty { + $($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+, + }) => { + bitflags! { + $(#[$attr])* + flags $BitFlags: $T { + $($(#[$Flag_attr])* const $Flag = $value),+ + } + } + }; +} + +#[cfg(test)] +#[allow(non_upper_case_globals, dead_code)] +mod tests { + use std::hash::{SipHasher, Hash, Hasher}; + + bitflags! { + #[doc = "> The first principle is that you must not fool yourself — and"] + #[doc = "> you are the easiest person to fool."] + #[doc = "> "] + #[doc = "> - Richard Feynman"] + flags Flags: u32 { + const FlagA = 0b00000001, + #[doc = " macros are way better at generating code than trans is"] + const FlagB = 0b00000010, + const FlagC = 0b00000100, + #[doc = "* cmr bed"] + #[doc = "* strcat table"] + #[doc = " wait what?"] + const FlagABC = FlagA.bits + | FlagB.bits + | FlagC.bits, + } + } + + bitflags! { + flags _CfgFlags: u32 { + #[cfg(windows)] + const _CfgA = 0b01, + #[cfg(unix)] + const _CfgB = 0b01, + #[cfg(windows)] + const _CfgC = _CfgA.bits | 0b10, + } + } + + bitflags! { + flags AnotherSetOfFlags: i8 { + const AnotherFlag = -1_i8, + } + } + + #[test] + fn test_bits(){ + assert_eq!(Flags::empty().bits(), 0b00000000); + assert_eq!(FlagA.bits(), 0b00000001); + assert_eq!(FlagABC.bits(), 0b00000111); + + assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00); + assert_eq!(AnotherFlag.bits(), !0_i8); + } + + #[test] + fn test_from_bits() { + assert_eq!(Flags::from_bits(0), Some(Flags::empty())); + assert_eq!(Flags::from_bits(0b1), Some(FlagA)); + assert_eq!(Flags::from_bits(0b10), Some(FlagB)); + assert_eq!(Flags::from_bits(0b11), Some(FlagA | FlagB)); + assert_eq!(Flags::from_bits(0b1000), None); + + assert_eq!(AnotherSetOfFlags::from_bits(!0_i8), Some(AnotherFlag)); + } + + #[test] + fn test_from_bits_truncate() { + assert_eq!(Flags::from_bits_truncate(0), Flags::empty()); + assert_eq!(Flags::from_bits_truncate(0b1), FlagA); + assert_eq!(Flags::from_bits_truncate(0b10), FlagB); + assert_eq!(Flags::from_bits_truncate(0b11), (FlagA | FlagB)); + assert_eq!(Flags::from_bits_truncate(0b1000), Flags::empty()); + assert_eq!(Flags::from_bits_truncate(0b1001), FlagA); + + assert_eq!(AnotherSetOfFlags::from_bits_truncate(0_i8), AnotherSetOfFlags::empty()); + } + + #[test] + fn test_is_empty(){ + assert!(Flags::empty().is_empty()); + assert!(!FlagA.is_empty()); + assert!(!FlagABC.is_empty()); + + assert!(!AnotherFlag.is_empty()); + } + + #[test] + fn test_is_all() { + assert!(Flags::all().is_all()); + assert!(!FlagA.is_all()); + assert!(FlagABC.is_all()); + + assert!(AnotherFlag.is_all()); + } + + #[test] + fn test_two_empties_do_not_intersect() { + let e1 = Flags::empty(); + let e2 = Flags::empty(); + assert!(!e1.intersects(e2)); + + assert!(AnotherFlag.intersects(AnotherFlag)); + } + + #[test] + fn test_empty_does_not_intersect_with_full() { + let e1 = Flags::empty(); + let e2 = FlagABC; + assert!(!e1.intersects(e2)); + } + + #[test] + fn test_disjoint_intersects() { + let e1 = FlagA; + let e2 = FlagB; + assert!(!e1.intersects(e2)); + } + + #[test] + fn test_overlapping_intersects() { + let e1 = FlagA; + let e2 = FlagA | FlagB; + assert!(e1.intersects(e2)); + } + + #[test] + fn test_contains() { + let e1 = FlagA; + let e2 = FlagA | FlagB; + assert!(!e1.contains(e2)); + assert!(e2.contains(e1)); + assert!(FlagABC.contains(e2)); + + assert!(AnotherFlag.contains(AnotherFlag)); + } + + #[test] + fn test_insert(){ + let mut e1 = FlagA; + let e2 = FlagA | FlagB; + e1.insert(e2); + assert_eq!(e1, e2); + + let mut e3 = AnotherSetOfFlags::empty(); + e3.insert(AnotherFlag); + assert_eq!(e3, AnotherFlag); + } + + #[test] + fn test_remove(){ + let mut e1 = FlagA | FlagB; + let e2 = FlagA | FlagC; + e1.remove(e2); + assert_eq!(e1, FlagB); + + let mut e3 = AnotherFlag; + e3.remove(AnotherFlag); + assert_eq!(e3, AnotherSetOfFlags::empty()); + } + + #[test] + fn test_operators() { + let e1 = FlagA | FlagC; + let e2 = FlagB | FlagC; + assert_eq!((e1 | e2), FlagABC); // union + assert_eq!((e1 & e2), FlagC); // intersection + assert_eq!((e1 - e2), FlagA); // set difference + assert_eq!(!e2, FlagA); // set complement + assert_eq!(e1 ^ e2, FlagA | FlagB); // toggle + let mut e3 = e1; + e3.toggle(e2); + assert_eq!(e3, FlagA | FlagB); + + let mut m4 = AnotherSetOfFlags::empty(); + m4.toggle(AnotherSetOfFlags::empty()); + assert_eq!(m4, AnotherSetOfFlags::empty()); + } + + #[test] + fn test_assignment_operators() { + let mut m1 = Flags::empty(); + let e1 = FlagA | FlagC; + // union + m1 |= FlagA; + assert_eq!(m1, FlagA); + // intersection + m1 &= e1; + assert_eq!(m1, FlagA); + // set difference + m1 -= m1; + assert_eq!(m1, Flags::empty()); + // toggle + m1 ^= e1; + assert_eq!(m1, e1); + } + + #[test] + fn test_extend() { + let mut flags; + + flags = Flags::empty(); + flags.extend([].iter().cloned()); + assert_eq!(flags, Flags::empty()); + + flags = Flags::empty(); + flags.extend([FlagA, FlagB].iter().cloned()); + assert_eq!(flags, FlagA | FlagB); + + flags = FlagA; + flags.extend([FlagA, FlagB].iter().cloned()); + assert_eq!(flags, FlagA | FlagB); + + flags = FlagB; + flags.extend([FlagA, FlagABC].iter().cloned()); + assert_eq!(flags, FlagABC); + } + + #[test] + fn test_from_iterator() { + assert_eq!([].iter().cloned().collect::(), Flags::empty()); + assert_eq!([FlagA, FlagB].iter().cloned().collect::(), FlagA | FlagB); + assert_eq!([FlagA, FlagABC].iter().cloned().collect::(), FlagABC); + } + + #[test] + fn test_lt() { + let mut a = Flags::empty(); + let mut b = Flags::empty(); + + assert!(!(a < b) && !(b < a)); + b = FlagB; + assert!(a < b); + a = FlagC; + assert!(!(a < b) && b < a); + b = FlagC | FlagB; + assert!(a < b); + } + + #[test] + fn test_ord() { + let mut a = Flags::empty(); + let mut b = Flags::empty(); + + assert!(a <= b && a >= b); + a = FlagA; + assert!(a > b && a >= b); + assert!(b < a && b <= a); + b = FlagB; + assert!(b > a && b >= a); + assert!(a < b && a <= b); + } + + fn hash(t: &T) -> u64 { + let mut s = SipHasher::new_with_keys(0, 0); + t.hash(&mut s); + s.finish() + } + + #[test] + fn test_hash() { + let mut x = Flags::empty(); + let mut y = Flags::empty(); + assert_eq!(hash(&x), hash(&y)); + x = Flags::all(); + y = FlagABC; + assert_eq!(hash(&x), hash(&y)); + } + + #[test] + fn test_debug() { + assert_eq!(format!("{:?}", FlagA | FlagB), "FlagA | FlagB"); + assert_eq!(format!("{:?}", FlagABC), "FlagA | FlagB | FlagC | FlagABC"); + } + + mod submodule { + bitflags! { + pub flags PublicFlags: i8 { + const FlagX = 0, + } + } + bitflags! { + flags PrivateFlags: i8 { + const FlagY = 0, + } + } + + #[test] + fn test_private() { + let _ = FlagY; + } + } + + #[test] + fn test_public() { + let _ = submodule::FlagX; + } + + mod t1 { + mod foo { + pub type Bar = i32; + } + + bitflags! { + /// baz + flags Flags: foo::Bar { + const A = 0b00000001, + #[cfg(foo)] + const B = 0b00000010, + #[cfg(foo)] + const C = 0b00000010, + } + } + } +} diff --git a/third_party/rust/bitflags/tests/external.rs b/third_party/rust/bitflags/tests/external.rs new file mode 100644 index 000000000000..0f0c7f665fbc --- /dev/null +++ b/third_party/rust/bitflags/tests/external.rs @@ -0,0 +1,21 @@ +#![allow(dead_code)] + +#[macro_use] +extern crate bitflags; + +bitflags! { + /// baz + flags Flags: u32 { + const A = 0b00000001, + #[doc = "bar"] + const B = 0b00000010, + const C = 0b00000100, + #[doc = "foo"] + const ABC = A.bits | B.bits | C.bits, + } +} + +#[test] +fn smoke() { + assert_eq!(ABC, A | B | C); +} diff --git a/third_party/rust/bitflags/tests/external_no_std.rs b/third_party/rust/bitflags/tests/external_no_std.rs new file mode 100644 index 000000000000..46526fd71298 --- /dev/null +++ b/third_party/rust/bitflags/tests/external_no_std.rs @@ -0,0 +1,22 @@ +#![allow(dead_code)] +#![no_std] + +#[macro_use] +extern crate bitflags; + +bitflags! { + /// baz + flags Flags: u32 { + const A = 0b00000001, + #[doc = "bar"] + const B = 0b00000010, + const C = 0b00000100, + #[doc = "foo"] + const ABC = A.bits | B.bits | C.bits, + } +} + +#[test] +fn smoke() { + assert_eq!(ABC, A | B | C); +} diff --git a/third_party/rust/byteorder-0.5.3/.cargo-checksum.json b/third_party/rust/byteorder-0.5.3/.cargo-checksum.json new file mode 100644 index 000000000000..88feac215bd7 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"2879af3c0512f976015d532e2d768f04ff22fdcf8745b69b955b78fda321c3fb",".travis.yml":"81545ce3c6c72111a68434464c3f9fa8df9cbe39759a081fac527628ab21ae0c","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"a7282931b50dff2e463f82baaed95a9d76636bc0fef3e921acd8ca69eab32b83","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","Makefile":"a45a128685a2ae7d4fa39d310786674417ee113055ef290a11f88002285865fc","README.md":"fbcc46b6d0a585096737f50922818b59016b69d959b05f1b29863b2af8e4da43","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","benches/bench.rs":"f583692d829c8dfe19b1d5b9e968ccf5c74d6733367ca183edff74041a6afedd","session.vim":"95cb1d7caf0ff7fbe76ec911988d908ddd883381c925ba64b537695bc9f021c4","src/lib.rs":"ef9e7a218fa3a4912c47f6840d32b975940d98277b6c9be85e8d7d045552eb87","src/new.rs":"161c21b7ebb5668c7cc70b46b0eb37709e06bb9c854f2fdfc6ce3d3babcbf3de"},"package":"0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"} \ No newline at end of file diff --git a/third_party/rust/byteorder-0.5.3/.cargo-ok b/third_party/rust/byteorder-0.5.3/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/byteorder-0.5.3/.gitignore b/third_party/rust/byteorder-0.5.3/.gitignore new file mode 100644 index 000000000000..1fec0efb811c --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/.gitignore @@ -0,0 +1,6 @@ +.*.swp +doc +tags +build +target +Cargo.lock diff --git a/third_party/rust/byteorder-0.5.3/.travis.yml b/third_party/rust/byteorder-0.5.3/.travis.yml new file mode 100644 index 000000000000..d6a279372c56 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/.travis.yml @@ -0,0 +1,15 @@ +language: rust +matrix: + include: + - rust: "nightly" + env: TEST_SUITE=suite_nightly + - rust: "beta" + env: TEST_SUITE=suite_beta + - rust: "stable" + env: TEST_SUITE=suite_stable +script: + - cargo build --verbose + - cargo test --verbose + - if [ "$TEST_SUITE" = "suite_nightly" ]; then + cargo bench --verbose; + fi diff --git a/third_party/rust/byteorder-0.5.3/COPYING b/third_party/rust/byteorder-0.5.3/COPYING new file mode 100644 index 000000000000..bb9c20a094e4 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/COPYING @@ -0,0 +1,3 @@ +This project is dual-licensed under the Unlicense and MIT licenses. + +You may use this code under the terms of either license. diff --git a/third_party/rust/byteorder-0.5.3/Cargo.toml b/third_party/rust/byteorder-0.5.3/Cargo.toml new file mode 100644 index 000000000000..32894e646cda --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "byteorder" +version = "0.5.3" #:version +authors = ["Andrew Gallant "] +description = "Library for reading/writing numbers in big-endian and little-endian." +documentation = "http://burntsushi.net/rustdoc/byteorder/" +homepage = "https://github.com/BurntSushi/byteorder" +repository = "https://github.com/BurntSushi/byteorder" +readme = "README.md" +keywords = ["byte", "endian", "big-endian", "little-endian", "binary"] +license = "Unlicense/MIT" + +[lib] +name = "byteorder" + +[dev-dependencies] +quickcheck = "0.2" +rand = "0.3" + +[features] +default = ["std"] +std = [] + +[profile.bench] +opt-level = 3 diff --git a/third_party/rust/byteorder-0.5.3/LICENSE-MIT b/third_party/rust/byteorder-0.5.3/LICENSE-MIT new file mode 100644 index 000000000000..3b0a5dc09c1e --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/LICENSE-MIT @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Andrew Gallant + +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. diff --git a/third_party/rust/byteorder-0.5.3/Makefile b/third_party/rust/byteorder-0.5.3/Makefile new file mode 100644 index 000000000000..9f956f4c4338 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/Makefile @@ -0,0 +1,14 @@ +all: + echo Nothing to do... + +ctags: + ctags --recurse --options=ctags.rust --languages=Rust + +docs: + cargo doc + in-dir ./target/doc fix-perms + rscp ./target/doc/* gopher:~/www/burntsushi.net/rustdoc/ + +push: + git push origin master + git push github master diff --git a/third_party/rust/byteorder-0.5.3/README.md b/third_party/rust/byteorder-0.5.3/README.md new file mode 100644 index 000000000000..5640f3e66487 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/README.md @@ -0,0 +1,59 @@ +This crate provides convenience methods for encoding and decoding numbers in +either big-endian or little-endian order. This is meant to replace the old +methods defined on the standard library `Reader` and `Writer` traits. + +[![Build status](https://api.travis-ci.org/BurntSushi/byteorder.png)](https://travis-ci.org/BurntSushi/byteorder) +[![](http://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder) + +Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). + + +### Documentation + +[http://burntsushi.net/rustdoc/byteorder/](http://burntsushi.net/rustdoc/byteorder/). + +The documentation includes examples. + + +### Installation + +This crate works with Cargo and is on +[crates.io](https://crates.io/crates/byteorder). The package is regularly +updated. Add it to your `Cargo.toml` like so: + +```toml +[dependencies] +byteorder = "0.5" +``` + +If you want to augment existing `Read` and `Write` traits, then import the +extension methods like so: + +```rust +extern crate byteorder; + +use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian}; +``` + +For example: + +```rust +use std::io::Cursor; +use byteorder::{BigEndian, ReadBytesExt}; + +let mut rdr = Cursor::new(vec![2, 5, 3, 0]); +// Note that we use type parameters to indicate which kind of byte order +// we want! +assert_eq!(517, rdr.read_u16::().unwrap()); +assert_eq!(768, rdr.read_u16::().unwrap()); +``` + +### `no_std` crates + +This crate has a feature, `std`, that is enabled by default. To use this crate +in a `no_std` context, add the following to your `Cargo.toml`: + +```toml +[dependencies] +byteorder = { version = "0.5", default-features = false } +``` diff --git a/third_party/rust/byteorder-0.5.3/UNLICENSE b/third_party/rust/byteorder-0.5.3/UNLICENSE new file mode 100644 index 000000000000..68a49daad8ff --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/third_party/rust/byteorder-0.5.3/benches/bench.rs b/third_party/rust/byteorder-0.5.3/benches/bench.rs new file mode 100644 index 000000000000..51d57b3da7b1 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/benches/bench.rs @@ -0,0 +1,148 @@ +#![feature(test)] + +extern crate byteorder; +extern crate test; + +macro_rules! bench_num { + ($name:ident, $read:ident, $bytes:expr, $data:expr) => ( + mod $name { + use byteorder::{ByteOrder, BigEndian, NativeEndian, LittleEndian}; + use super::test::Bencher; + use super::test::black_box as bb; + + const NITER: usize = 100_000; + + #[bench] + fn read_big_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(BigEndian::$read(&buf, $bytes)); + } + }); + } + + #[bench] + fn read_little_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(LittleEndian::$read(&buf, $bytes)); + } + }); + } + + #[bench] + fn read_native_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(NativeEndian::$read(&buf, $bytes)); + } + }); + } + } + ); + ($ty:ident, $max:ident, + $read:ident, $write:ident, $size:expr, $data:expr) => ( + mod $ty { + use std::$ty; + use byteorder::{ByteOrder, BigEndian, NativeEndian, LittleEndian}; + use super::test::Bencher; + use super::test::black_box as bb; + + const NITER: usize = 100_000; + + #[bench] + fn read_big_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(BigEndian::$read(&buf)); + } + }); + } + + #[bench] + fn read_little_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(LittleEndian::$read(&buf)); + } + }); + } + + #[bench] + fn read_native_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(NativeEndian::$read(&buf)); + } + }); + } + + #[bench] + fn write_big_endian(b: &mut Bencher) { + let mut buf = $data; + let n = $ty::$max; + b.iter(|| { + for _ in 0..NITER { + bb(BigEndian::$write(&mut buf, n)); + } + }); + } + + #[bench] + fn write_little_endian(b: &mut Bencher) { + let mut buf = $data; + let n = $ty::$max; + b.iter(|| { + for _ in 0..NITER { + bb(LittleEndian::$write(&mut buf, n)); + } + }); + } + + #[bench] + fn write_native_endian(b: &mut Bencher) { + let mut buf = $data; + let n = $ty::$max; + b.iter(|| { + for _ in 0..NITER { + bb(NativeEndian::$write(&mut buf, n)); + } + }); + } + } + ); +} + +bench_num!(u16, MAX, read_u16, write_u16, 2, [1, 2]); +bench_num!(i16, MAX, read_i16, write_i16, 2, [1, 2]); +bench_num!(u32, MAX, read_u32, write_u32, 4, [1, 2, 3, 4]); +bench_num!(i32, MAX, read_i32, write_i32, 4, [1, 2, 3, 4]); +bench_num!(u64, MAX, read_u64, write_u64, 8, [1, 2, 3, 4, 5, 6, 7, 8]); +bench_num!(i64, MAX, read_i64, write_i64, 8, [1, 2, 3, 4, 5, 6, 7, 8]); +bench_num!(f32, MAX, read_f32, write_f32, 4, [1, 2, 3, 4]); +bench_num!(f64, MAX, read_f64, write_f64, 8, + [1, 2, 3, 4, 5, 6, 7, 8]); + +bench_num!(uint_1, read_uint, 1, [1]); +bench_num!(uint_2, read_uint, 2, [1, 2]); +bench_num!(uint_3, read_uint, 3, [1, 2, 3]); +bench_num!(uint_4, read_uint, 4, [1, 2, 3, 4]); +bench_num!(uint_5, read_uint, 5, [1, 2, 3, 4, 5]); +bench_num!(uint_6, read_uint, 6, [1, 2, 3, 4, 5, 6]); +bench_num!(uint_7, read_uint, 7, [1, 2, 3, 4, 5, 6, 7]); +bench_num!(uint_8, read_uint, 8, [1, 2, 3, 4, 5, 6, 7, 8]); + +bench_num!(int_1, read_int, 1, [1]); +bench_num!(int_2, read_int, 2, [1, 2]); +bench_num!(int_3, read_int, 3, [1, 2, 3]); +bench_num!(int_4, read_int, 4, [1, 2, 3, 4]); +bench_num!(int_5, read_int, 5, [1, 2, 3, 4, 5]); +bench_num!(int_6, read_int, 6, [1, 2, 3, 4, 5, 6]); +bench_num!(int_7, read_int, 7, [1, 2, 3, 4, 5, 6, 7]); +bench_num!(int_8, read_int, 8, [1, 2, 3, 4, 5, 6, 7, 8]); diff --git a/third_party/rust/byteorder-0.5.3/session.vim b/third_party/rust/byteorder-0.5.3/session.vim new file mode 100644 index 000000000000..213c95660bcd --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/session.vim @@ -0,0 +1 @@ +au BufWritePost *.rs silent!make ctags > /dev/null 2>&1 diff --git a/third_party/rust/byteorder-0.5.3/src/lib.rs b/third_party/rust/byteorder-0.5.3/src/lib.rs new file mode 100644 index 000000000000..a25bab6e0f92 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/src/lib.rs @@ -0,0 +1,802 @@ +/*! +This crate provides convenience methods for encoding and decoding numbers +in either big-endian or little-endian order. + +The organization of the crate is pretty simple. A trait, `ByteOrder`, specifies +byte conversion methods for each type of number in Rust (sans numbers that have +a platform dependent size like `usize` and `isize`). Two types, `BigEndian` +and `LittleEndian` implement these methods. Finally, `ReadBytesExt` and +`WriteBytesExt` provide convenience methods available to all types that +implement `Read` and `Write`. + +# Examples + +Read unsigned 16 bit big-endian integers from a `Read` type: + +```rust +use std::io::Cursor; +use byteorder::{BigEndian, ReadBytesExt}; + +let mut rdr = Cursor::new(vec![2, 5, 3, 0]); +// Note that we use type parameters to indicate which kind of byte order +// we want! +assert_eq!(517, rdr.read_u16::().unwrap()); +assert_eq!(768, rdr.read_u16::().unwrap()); +``` + +Write unsigned 16 bit little-endian integers to a `Write` type: + +```rust +use byteorder::{LittleEndian, WriteBytesExt}; + +let mut wtr = vec![]; +wtr.write_u16::(517).unwrap(); +wtr.write_u16::(768).unwrap(); +assert_eq!(wtr, vec![5, 2, 0, 3]); +``` +*/ + +#![crate_name = "byteorder"] +#![doc(html_root_url = "http://burntsushi.net/rustdoc/byteorder")] + +#![cfg_attr(not(feature = "std"), no_std)] + +#![deny(missing_docs)] + +#[cfg(feature = "std")] +extern crate core; + +use core::mem::transmute; +use core::ptr::copy_nonoverlapping; + +#[cfg(feature = "std")] +pub use new::{ReadBytesExt, WriteBytesExt}; + +#[cfg(feature = "std")] +mod new; + +#[inline] +fn extend_sign(val: u64, nbytes: usize) -> i64 { + let shift = (8 - nbytes) * 8; + (val << shift) as i64 >> shift +} + +#[inline] +fn unextend_sign(val: i64, nbytes: usize) -> u64 { + let shift = (8 - nbytes) * 8; + (val << shift) as u64 >> shift +} + +#[inline] +fn pack_size(n: u64) -> usize { + if n < 1 << 8 { + 1 + } else if n < 1 << 16 { + 2 + } else if n < 1 << 24 { + 3 + } else if n < 1 << 32 { + 4 + } else if n < 1 << 40 { + 5 + } else if n < 1 << 48 { + 6 + } else if n < 1 << 56 { + 7 + } else { + 8 + } +} + +/// ByteOrder describes types that can serialize integers as bytes. +/// +/// Note that `Self` does not appear anywhere in this trait's definition! +/// Therefore, in order to use it, you'll need to use syntax like +/// `T::read_u16(&[0, 1])` where `T` implements `ByteOrder`. +/// +/// This crate provides two types that implement `ByteOrder`: `BigEndian` +/// and `LittleEndian`. +/// +/// # Examples +/// +/// Write and read `u32` numbers in little endian order: +/// +/// ```rust +/// use byteorder::{ByteOrder, LittleEndian}; +/// +/// let mut buf = [0; 4]; +/// LittleEndian::write_u32(&mut buf, 1_000_000); +/// assert_eq!(1_000_000, LittleEndian::read_u32(&buf)); +/// ``` +/// +/// Write and read `i16` numbers in big endian order: +/// +/// ```rust +/// use byteorder::{ByteOrder, BigEndian}; +/// +/// let mut buf = [0; 2]; +/// BigEndian::write_i16(&mut buf, -50_000); +/// assert_eq!(-50_000, BigEndian::read_i16(&buf)); +/// ``` +pub trait ByteOrder { + /// Reads an unsigned 16 bit integer from `buf`. + /// + /// Panics when `buf.len() < 2`. + fn read_u16(buf: &[u8]) -> u16; + + /// Reads an unsigned 32 bit integer from `buf`. + /// + /// Panics when `buf.len() < 4`. + fn read_u32(buf: &[u8]) -> u32; + + /// Reads an unsigned 64 bit integer from `buf`. + /// + /// Panics when `buf.len() < 8`. + fn read_u64(buf: &[u8]) -> u64; + + /// Reads an unsigned n-bytes integer from `buf`. + /// + /// Panics when `nbytes < 1` or `nbytes > 8` or + /// `buf.len() < nbytes` + fn read_uint(buf: &[u8], nbytes: usize) -> u64; + + /// Writes an unsigned 16 bit integer `n` to `buf`. + /// + /// Panics when `buf.len() < 2`. + fn write_u16(buf: &mut [u8], n: u16); + + /// Writes an unsigned 32 bit integer `n` to `buf`. + /// + /// Panics when `buf.len() < 4`. + fn write_u32(buf: &mut [u8], n: u32); + + /// Writes an unsigned 64 bit integer `n` to `buf`. + /// + /// Panics when `buf.len() < 8`. + fn write_u64(buf: &mut [u8], n: u64); + + /// Writes an unsigned integer `n` to `buf` using only `nbytes`. + /// + /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 8`, then + /// this method panics. + fn write_uint(buf: &mut [u8], n: u64, nbytes: usize); + + /// Reads a signed 16 bit integer from `buf`. + /// + /// Panics when `buf.len() < 2`. + #[inline] + fn read_i16(buf: &[u8]) -> i16 { + Self::read_u16(buf) as i16 + } + + /// Reads a signed 32 bit integer from `buf`. + /// + /// Panics when `buf.len() < 4`. + #[inline] + fn read_i32(buf: &[u8]) -> i32 { + Self::read_u32(buf) as i32 + } + + /// Reads a signed 64 bit integer from `buf`. + /// + /// Panics when `buf.len() < 8`. + #[inline] + fn read_i64(buf: &[u8]) -> i64 { + Self::read_u64(buf) as i64 + } + + /// Reads a signed n-bytes integer from `buf`. + /// + /// Panics when `nbytes < 1` or `nbytes > 8` or + /// `buf.len() < nbytes` + #[inline] + fn read_int(buf: &[u8], nbytes: usize) -> i64 { + extend_sign(Self::read_uint(buf, nbytes), nbytes) + } + + /// Reads a IEEE754 single-precision (4 bytes) floating point number. + /// + /// Panics when `buf.len() < 4`. + #[inline] + fn read_f32(buf: &[u8]) -> f32 { + unsafe { transmute(Self::read_u32(buf)) } + } + + /// Reads a IEEE754 double-precision (8 bytes) floating point number. + /// + /// Panics when `buf.len() < 8`. + #[inline] + fn read_f64(buf: &[u8]) -> f64 { + unsafe { transmute(Self::read_u64(buf)) } + } + + /// Writes a signed 16 bit integer `n` to `buf`. + /// + /// Panics when `buf.len() < 2`. + #[inline] + fn write_i16(buf: &mut [u8], n: i16) { + Self::write_u16(buf, n as u16) + } + + /// Writes a signed 32 bit integer `n` to `buf`. + /// + /// Panics when `buf.len() < 4`. + #[inline] + fn write_i32(buf: &mut [u8], n: i32) { + Self::write_u32(buf, n as u32) + } + + /// Writes a signed 64 bit integer `n` to `buf`. + /// + /// Panics when `buf.len() < 8`. + #[inline] + fn write_i64(buf: &mut [u8], n: i64) { + Self::write_u64(buf, n as u64) + } + + /// Writes a signed integer `n` to `buf` using only `nbytes`. + /// + /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 8`, then + /// this method panics. + #[inline] + fn write_int(buf: &mut [u8], n: i64, nbytes: usize) { + Self::write_uint(buf, unextend_sign(n, nbytes), nbytes) + } + + /// Writes a IEEE754 single-precision (4 bytes) floating point number. + /// + /// Panics when `buf.len() < 4`. + #[inline] + fn write_f32(buf: &mut [u8], n: f32) { + Self::write_u32(buf, unsafe { transmute(n) }) + } + + /// Writes a IEEE754 double-precision (8 bytes) floating point number. + /// + /// Panics when `buf.len() < 8`. + #[inline] + fn write_f64(buf: &mut [u8], n: f64) { + Self::write_u64(buf, unsafe { transmute(n) }) + } +} + +/// Defines big-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +#[allow(missing_copy_implementations)] pub enum BigEndian {} + +/// Defines little-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +#[allow(missing_copy_implementations)] pub enum LittleEndian {} + +/// Defines network byte order serialization. +/// +/// Network byte order is defined by [RFC 1700][1] to be big-endian, and is +/// referred to in several protocol specifications. This type is an alias of +/// BigEndian. +/// +/// [1]: https://tools.ietf.org/html/rfc1700 +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +pub type NetworkEndian = BigEndian; + +/// Defines system native-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +#[cfg(target_endian = "little")] +pub type NativeEndian = LittleEndian; + +/// Defines system native-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +#[cfg(target_endian = "big")] +pub type NativeEndian = BigEndian; + +macro_rules! read_num_bytes { + ($ty:ty, $size:expr, $src:expr, $which:ident) => ({ + assert!($size == ::core::mem::size_of::<$ty>()); + assert!($size <= $src.len()); + let mut data: $ty = 0; + unsafe { + copy_nonoverlapping( + $src.as_ptr(), + &mut data as *mut $ty as *mut u8, + $size); + } + data.$which() + }); +} + +macro_rules! write_num_bytes { + ($ty:ty, $size:expr, $n:expr, $dst:expr, $which:ident) => ({ + assert!($size <= $dst.len()); + unsafe { + // N.B. https://github.com/rust-lang/rust/issues/22776 + let bytes = transmute::<_, [u8; $size]>($n.$which()); + copy_nonoverlapping((&bytes).as_ptr(), $dst.as_mut_ptr(), $size); + } + }); +} + +impl ByteOrder for BigEndian { + #[inline] + fn read_u16(buf: &[u8]) -> u16 { + read_num_bytes!(u16, 2, buf, to_be) + } + + #[inline] + fn read_u32(buf: &[u8]) -> u32 { + read_num_bytes!(u32, 4, buf, to_be) + } + + #[inline] + fn read_u64(buf: &[u8]) -> u64 { + read_num_bytes!(u64, 8, buf, to_be) + } + + #[inline] + fn read_uint(buf: &[u8], nbytes: usize) -> u64 { + assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len()); + let mut out = [0u8; 8]; + let ptr_out = out.as_mut_ptr(); + unsafe { + copy_nonoverlapping( + buf.as_ptr(), ptr_out.offset((8 - nbytes) as isize), nbytes); + (*(ptr_out as *const u64)).to_be() + } + } + + #[inline] + fn write_u16(buf: &mut [u8], n: u16) { + write_num_bytes!(u16, 2, n, buf, to_be); + } + + #[inline] + fn write_u32(buf: &mut [u8], n: u32) { + write_num_bytes!(u32, 4, n, buf, to_be); + } + + #[inline] + fn write_u64(buf: &mut [u8], n: u64) { + write_num_bytes!(u64, 8, n, buf, to_be); + } + + #[inline] + fn write_uint(buf: &mut [u8], n: u64, nbytes: usize) { + assert!(pack_size(n) <= nbytes && nbytes <= 8); + assert!(nbytes <= buf.len()); + unsafe { + let bytes: [u8; 8] = transmute(n.to_be()); + copy_nonoverlapping( + bytes.as_ptr().offset((8 - nbytes) as isize), + buf.as_mut_ptr(), + nbytes); + } + } +} + +impl ByteOrder for LittleEndian { + #[inline] + fn read_u16(buf: &[u8]) -> u16 { + read_num_bytes!(u16, 2, buf, to_le) + } + + #[inline] + fn read_u32(buf: &[u8]) -> u32 { + read_num_bytes!(u32, 4, buf, to_le) + } + + #[inline] + fn read_u64(buf: &[u8]) -> u64 { + read_num_bytes!(u64, 8, buf, to_le) + } + + #[inline] + fn read_uint(buf: &[u8], nbytes: usize) -> u64 { + assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len()); + let mut out = [0u8; 8]; + let ptr_out = out.as_mut_ptr(); + unsafe { + copy_nonoverlapping(buf.as_ptr(), ptr_out, nbytes); + (*(ptr_out as *const u64)).to_le() + } + } + + #[inline] + fn write_u16(buf: &mut [u8], n: u16) { + write_num_bytes!(u16, 2, n, buf, to_le); + } + + #[inline] + fn write_u32(buf: &mut [u8], n: u32) { + write_num_bytes!(u32, 4, n, buf, to_le); + } + + #[inline] + fn write_u64(buf: &mut [u8], n: u64) { + write_num_bytes!(u64, 8, n, buf, to_le); + } + + #[inline] + fn write_uint(buf: &mut [u8], n: u64, nbytes: usize) { + assert!(pack_size(n as u64) <= nbytes && nbytes <= 8); + assert!(nbytes <= buf.len()); + unsafe { + let bytes: [u8; 8] = transmute(n.to_le()); + copy_nonoverlapping(bytes.as_ptr(), buf.as_mut_ptr(), nbytes); + } + } +} + +#[cfg(test)] +mod test { + extern crate quickcheck; + extern crate rand; + + use test::rand::thread_rng; + use test::quickcheck::{QuickCheck, StdGen, Testable}; + + const U64_MAX: u64 = ::std::u64::MAX; + const I64_MAX: u64 = ::std::i64::MAX as u64; + + fn qc_sized(f: A, size: u64) { + QuickCheck::new() + .gen(StdGen::new(thread_rng(), size as usize)) + .tests(1_00) + .max_tests(10_000) + .quickcheck(f); + } + + macro_rules! qc_byte_order { + ($name:ident, $ty_int:ident, $max:expr, + $bytes:expr, $read:ident, $write:ident) => ( + mod $name { + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + use super::qc_sized; + + #[test] + fn big_endian() { + let max = ($max - 1) >> (8 * (8 - $bytes)); + fn prop(n: $ty_int) -> bool { + let mut buf = [0; 8]; + BigEndian::$write(&mut buf, n, $bytes); + n == BigEndian::$read(&mut buf[..$bytes], $bytes) + } + qc_sized(prop as fn($ty_int) -> bool, max); + } + + #[test] + fn little_endian() { + let max = ($max - 1) >> (8 * (8 - $bytes)); + fn prop(n: $ty_int) -> bool { + let mut buf = [0; 8]; + LittleEndian::$write(&mut buf, n, $bytes); + n == LittleEndian::$read(&mut buf[..$bytes], $bytes) + } + qc_sized(prop as fn($ty_int) -> bool, max); + } + + #[test] + fn native_endian() { + let max = ($max - 1) >> (8 * (8 - $bytes)); + fn prop(n: $ty_int) -> bool { + let mut buf = [0; 8]; + NativeEndian::$write(&mut buf, n, $bytes); + n == NativeEndian::$read(&mut buf[..$bytes], $bytes) + } + qc_sized(prop as fn($ty_int) -> bool, max); + } + } + ); + ($name:ident, $ty_int:ident, $max:expr, + $read:ident, $write:ident) => ( + mod $name { + use std::mem::size_of; + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + use super::qc_sized; + + #[test] + fn big_endian() { + fn prop(n: $ty_int) -> bool { + let bytes = size_of::<$ty_int>(); + let mut buf = [0; 8]; + BigEndian::$write(&mut buf[8 - bytes..], n); + n == BigEndian::$read(&mut buf[8 - bytes..]) + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn little_endian() { + fn prop(n: $ty_int) -> bool { + let bytes = size_of::<$ty_int>(); + let mut buf = [0; 8]; + LittleEndian::$write(&mut buf[..bytes], n); + n == LittleEndian::$read(&mut buf[..bytes]) + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn native_endian() { + fn prop(n: $ty_int) -> bool { + let bytes = size_of::<$ty_int>(); + let mut buf = [0; 8]; + NativeEndian::$write(&mut buf[..bytes], n); + n == NativeEndian::$read(&mut buf[..bytes]) + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + } + ); + } + + qc_byte_order!(prop_u16, u16, ::std::u16::MAX as u64, read_u16, write_u16); + qc_byte_order!(prop_i16, i16, ::std::i16::MAX as u64, read_i16, write_i16); + qc_byte_order!(prop_u32, u32, ::std::u32::MAX as u64, read_u32, write_u32); + qc_byte_order!(prop_i32, i32, ::std::i32::MAX as u64, read_i32, write_i32); + qc_byte_order!(prop_u64, u64, ::std::u64::MAX as u64, read_u64, write_u64); + qc_byte_order!(prop_i64, i64, ::std::i64::MAX as u64, read_i64, write_i64); + qc_byte_order!(prop_f32, f32, ::std::u64::MAX as u64, read_f32, write_f32); + qc_byte_order!(prop_f64, f64, ::std::i64::MAX as u64, read_f64, write_f64); + + qc_byte_order!(prop_uint_1, u64, super::U64_MAX, 1, read_uint, write_uint); + qc_byte_order!(prop_uint_2, u64, super::U64_MAX, 2, read_uint, write_uint); + qc_byte_order!(prop_uint_3, u64, super::U64_MAX, 3, read_uint, write_uint); + qc_byte_order!(prop_uint_4, u64, super::U64_MAX, 4, read_uint, write_uint); + qc_byte_order!(prop_uint_5, u64, super::U64_MAX, 5, read_uint, write_uint); + qc_byte_order!(prop_uint_6, u64, super::U64_MAX, 6, read_uint, write_uint); + qc_byte_order!(prop_uint_7, u64, super::U64_MAX, 7, read_uint, write_uint); + qc_byte_order!(prop_uint_8, u64, super::U64_MAX, 8, read_uint, write_uint); + + qc_byte_order!(prop_int_1, i64, super::I64_MAX, 1, read_int, write_int); + qc_byte_order!(prop_int_2, i64, super::I64_MAX, 2, read_int, write_int); + qc_byte_order!(prop_int_3, i64, super::I64_MAX, 3, read_int, write_int); + qc_byte_order!(prop_int_4, i64, super::I64_MAX, 4, read_int, write_int); + qc_byte_order!(prop_int_5, i64, super::I64_MAX, 5, read_int, write_int); + qc_byte_order!(prop_int_6, i64, super::I64_MAX, 6, read_int, write_int); + qc_byte_order!(prop_int_7, i64, super::I64_MAX, 7, read_int, write_int); + qc_byte_order!(prop_int_8, i64, super::I64_MAX, 8, read_int, write_int); + + macro_rules! qc_bytes_ext { + ($name:ident, $ty_int:ident, $max:expr, + $bytes:expr, $read:ident, $write:ident) => ( + mod $name { + use std::io::Cursor; + use { + ReadBytesExt, WriteBytesExt, + BigEndian, NativeEndian, LittleEndian, + }; + use super::qc_sized; + + #[test] + fn big_endian() { + let max = ($max - 1) >> (8 * (8 - $bytes)); + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::(n).unwrap(); + let mut rdr = Vec::new(); + rdr.extend(wtr[8 - $bytes..].iter().map(|&x|x)); + let mut rdr = Cursor::new(rdr); + n == rdr.$read::($bytes).unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, max); + } + + #[test] + fn little_endian() { + let max = ($max - 1) >> (8 * (8 - $bytes)); + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::(n).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::($bytes).unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, max); + } + + #[test] + fn native_endian() { + let max = ($max - 1) >> (8 * (8 - $bytes)); + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::(n).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::($bytes).unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, max); + } + } + ); + ($name:ident, $ty_int:ident, $max:expr, $read:ident, $write:ident) => ( + mod $name { + use std::io::Cursor; + use { + ReadBytesExt, WriteBytesExt, + BigEndian, NativeEndian, LittleEndian, + }; + use super::qc_sized; + + #[test] + fn big_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::(n).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::().unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn little_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::(n).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::().unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn native_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::(n).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::().unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + } + ); + } + + qc_bytes_ext!(prop_ext_u16, u16, ::std::u16::MAX as u64, read_u16, write_u16); + qc_bytes_ext!(prop_ext_i16, i16, ::std::i16::MAX as u64, read_i16, write_i16); + qc_bytes_ext!(prop_ext_u32, u32, ::std::u32::MAX as u64, read_u32, write_u32); + qc_bytes_ext!(prop_ext_i32, i32, ::std::i32::MAX as u64, read_i32, write_i32); + qc_bytes_ext!(prop_ext_u64, u64, ::std::u64::MAX as u64, read_u64, write_u64); + qc_bytes_ext!(prop_ext_i64, i64, ::std::i64::MAX as u64, read_i64, write_i64); + qc_bytes_ext!(prop_ext_f32, f32, ::std::u64::MAX as u64, read_f32, write_f32); + qc_bytes_ext!(prop_ext_f64, f64, ::std::i64::MAX as u64, read_f64, write_f64); + + qc_bytes_ext!(prop_ext_uint_1, u64, super::U64_MAX, 1, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_2, u64, super::U64_MAX, 2, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_3, u64, super::U64_MAX, 3, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_4, u64, super::U64_MAX, 4, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_5, u64, super::U64_MAX, 5, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_6, u64, super::U64_MAX, 6, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_7, u64, super::U64_MAX, 7, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_8, u64, super::U64_MAX, 8, read_uint, write_u64); + + qc_bytes_ext!(prop_ext_int_1, i64, super::I64_MAX, 1, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_2, i64, super::I64_MAX, 2, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_3, i64, super::I64_MAX, 3, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_4, i64, super::I64_MAX, 4, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_5, i64, super::I64_MAX, 5, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_6, i64, super::I64_MAX, 6, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_7, i64, super::I64_MAX, 7, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_8, i64, super::I64_MAX, 8, read_int, write_i64); + + // Test that all of the byte conversion functions panic when given a + // buffer that is too small. + // + // These tests are critical to ensure safety, otherwise we might end up + // with a buffer overflow. + macro_rules! too_small { + ($name:ident, $maximally_small:expr, $zero:expr, + $read:ident, $write:ident) => ( + mod $name { + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + + #[test] + #[should_panic] + fn read_big_endian() { + let buf = [0; $maximally_small]; + BigEndian::$read(&buf); + } + + #[test] + #[should_panic] + fn read_little_endian() { + let buf = [0; $maximally_small]; + LittleEndian::$read(&buf); + } + + #[test] + #[should_panic] + fn read_native_endian() { + let buf = [0; $maximally_small]; + NativeEndian::$read(&buf); + } + + #[test] + #[should_panic] + fn write_big_endian() { + let mut buf = [0; $maximally_small]; + BigEndian::$write(&mut buf, $zero); + } + + #[test] + #[should_panic] + fn write_little_endian() { + let mut buf = [0; $maximally_small]; + LittleEndian::$write(&mut buf, $zero); + } + + #[test] + #[should_panic] + fn write_native_endian() { + let mut buf = [0; $maximally_small]; + NativeEndian::$write(&mut buf, $zero); + } + } + ); + ($name:ident, $maximally_small:expr, $read:ident) => ( + mod $name { + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + + #[test] + #[should_panic] + fn read_big_endian() { + let buf = [0; $maximally_small]; + BigEndian::$read(&buf, $maximally_small + 1); + } + + #[test] + #[should_panic] + fn read_little_endian() { + let buf = [0; $maximally_small]; + LittleEndian::$read(&buf, $maximally_small + 1); + } + + #[test] + #[should_panic] + fn read_native_endian() { + let buf = [0; $maximally_small]; + NativeEndian::$read(&buf, $maximally_small + 1); + } + } + ); + } + + too_small!(small_u16, 1, 0, read_u16, write_u16); + too_small!(small_i16, 1, 0, read_i16, write_i16); + too_small!(small_u32, 3, 0, read_u32, write_u32); + too_small!(small_i32, 3, 0, read_i32, write_i32); + too_small!(small_u64, 7, 0, read_u64, write_u64); + too_small!(small_i64, 7, 0, read_i64, write_i64); + too_small!(small_f32, 3, 0.0, read_f32, write_f32); + too_small!(small_f64, 7, 0.0, read_f64, write_f64); + + too_small!(small_uint_1, 1, read_uint); + too_small!(small_uint_2, 2, read_uint); + too_small!(small_uint_3, 3, read_uint); + too_small!(small_uint_4, 4, read_uint); + too_small!(small_uint_5, 5, read_uint); + too_small!(small_uint_6, 6, read_uint); + too_small!(small_uint_7, 7, read_uint); + + too_small!(small_int_1, 1, read_int); + too_small!(small_int_2, 2, read_int); + too_small!(small_int_3, 3, read_int); + too_small!(small_int_4, 4, read_int); + too_small!(small_int_5, 5, read_int); + too_small!(small_int_6, 6, read_int); + too_small!(small_int_7, 7, read_int); + + #[test] + fn uint_bigger_buffer() { + use {ByteOrder, LittleEndian}; + let n = LittleEndian::read_uint(&[1, 2, 3, 4, 5, 6, 7, 8], 5); + assert_eq!(n, 0x0504030201); + } +} diff --git a/third_party/rust/byteorder-0.5.3/src/new.rs b/third_party/rust/byteorder-0.5.3/src/new.rs new file mode 100644 index 000000000000..b5f37700f960 --- /dev/null +++ b/third_party/rust/byteorder-0.5.3/src/new.rs @@ -0,0 +1,269 @@ +use std::io::{self, Result}; + +use ByteOrder; + +/// Extends `Read` with methods for reading numbers. (For `std::io`.) +/// +/// Most of the methods defined here have an unconstrained type parameter that +/// must be explicitly instantiated. Typically, it is instantiated with either +/// the `BigEndian` or `LittleEndian` types defined in this crate. +/// +/// # Examples +/// +/// Read unsigned 16 bit big-endian integers from a `Read`: +/// +/// ```rust +/// use std::io::Cursor; +/// use byteorder::{BigEndian, ReadBytesExt}; +/// +/// let mut rdr = Cursor::new(vec![2, 5, 3, 0]); +/// assert_eq!(517, rdr.read_u16::().unwrap()); +/// assert_eq!(768, rdr.read_u16::().unwrap()); +/// ``` +pub trait ReadBytesExt: io::Read { + /// Reads an unsigned 8 bit integer from the underlying reader. + /// + /// Note that since this reads a single byte, no byte order conversions + /// are used. It is included for completeness. + #[inline] + fn read_u8(&mut self) -> Result { + let mut buf = [0; 1]; + try!(self.read_exact(&mut buf)); + Ok(buf[0]) + } + + /// Reads a signed 8 bit integer from the underlying reader. + /// + /// Note that since this reads a single byte, no byte order conversions + /// are used. It is included for completeness. + #[inline] + fn read_i8(&mut self) -> Result { + let mut buf = [0; 1]; + try!(self.read_exact(&mut buf)); + Ok(buf[0] as i8) + } + + /// Reads an unsigned 16 bit integer from the underlying reader. + #[inline] + fn read_u16(&mut self) -> Result { + let mut buf = [0; 2]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u16(&buf)) + } + + /// Reads a signed 16 bit integer from the underlying reader. + #[inline] + fn read_i16(&mut self) -> Result { + let mut buf = [0; 2]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i16(&buf)) + } + + /// Reads an unsigned 32 bit integer from the underlying reader. + #[inline] + fn read_u32(&mut self) -> Result { + let mut buf = [0; 4]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u32(&buf)) + } + + /// Reads a signed 32 bit integer from the underlying reader. + #[inline] + fn read_i32(&mut self) -> Result { + let mut buf = [0; 4]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i32(&buf)) + } + + /// Reads an unsigned 64 bit integer from the underlying reader. + #[inline] + fn read_u64(&mut self) -> Result { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u64(&buf)) + } + + /// Reads a signed 64 bit integer from the underlying reader. + #[inline] + fn read_i64(&mut self) -> Result { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i64(&buf)) + } + + /// Reads an unsigned n-bytes integer from the underlying reader. + #[inline] + fn read_uint(&mut self, nbytes: usize) -> Result { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf[..nbytes])); + Ok(T::read_uint(&buf[..nbytes], nbytes)) + } + + /// Reads a signed n-bytes integer from the underlying reader. + #[inline] + fn read_int(&mut self, nbytes: usize) -> Result { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf[..nbytes])); + Ok(T::read_int(&buf[..nbytes], nbytes)) + } + + /// Reads a IEEE754 single-precision (4 bytes) floating point number from + /// the underlying reader. + #[inline] + fn read_f32(&mut self) -> Result { + let mut buf = [0; 4]; + try!(self.read_exact(&mut buf)); + Ok(T::read_f32(&buf)) + } + + /// Reads a IEEE754 double-precision (8 bytes) floating point number from + /// the underlying reader. + #[inline] + fn read_f64(&mut self) -> Result { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf)); + Ok(T::read_f64(&buf)) + } +} + +/// All types that implement `Read` get methods defined in `ReadBytesExt` +/// for free. +impl ReadBytesExt for R {} + +/// Extends `Write` with methods for writing numbers. (For `std::io`.) +/// +/// Most of the methods defined here have an unconstrained type parameter that +/// must be explicitly instantiated. Typically, it is instantiated with either +/// the `BigEndian` or `LittleEndian` types defined in this crate. +/// +/// # Examples +/// +/// Write unsigned 16 bit big-endian integers to a `Write`: +/// +/// ```rust +/// use byteorder::{BigEndian, WriteBytesExt}; +/// +/// let mut wtr = vec![]; +/// wtr.write_u16::(517).unwrap(); +/// wtr.write_u16::(768).unwrap(); +/// assert_eq!(wtr, vec![2, 5, 3, 0]); +/// ``` +pub trait WriteBytesExt: io::Write { + /// Writes an unsigned 8 bit integer to the underlying writer. + /// + /// Note that since this writes a single byte, no byte order conversions + /// are used. It is included for completeness. + #[inline] + fn write_u8(&mut self, n: u8) -> Result<()> { + self.write_all(&[n]) + } + + /// Writes a signed 8 bit integer to the underlying writer. + /// + /// Note that since this writes a single byte, no byte order conversions + /// are used. It is included for completeness. + #[inline] + fn write_i8(&mut self, n: i8) -> Result<()> { + self.write_all(&[n as u8]) + } + + /// Writes an unsigned 16 bit integer to the underlying writer. + #[inline] + fn write_u16(&mut self, n: u16) -> Result<()> { + let mut buf = [0; 2]; + T::write_u16(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 16 bit integer to the underlying writer. + #[inline] + fn write_i16(&mut self, n: i16) -> Result<()> { + let mut buf = [0; 2]; + T::write_i16(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned 32 bit integer to the underlying writer. + #[inline] + fn write_u32(&mut self, n: u32) -> Result<()> { + let mut buf = [0; 4]; + T::write_u32(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 32 bit integer to the underlying writer. + #[inline] + fn write_i32(&mut self, n: i32) -> Result<()> { + let mut buf = [0; 4]; + T::write_i32(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned 64 bit integer to the underlying writer. + #[inline] + fn write_u64(&mut self, n: u64) -> Result<()> { + let mut buf = [0; 8]; + T::write_u64(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 64 bit integer to the underlying writer. + #[inline] + fn write_i64(&mut self, n: i64) -> Result<()> { + let mut buf = [0; 8]; + T::write_i64(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned n-bytes integer to the underlying writer. + /// + /// If the given integer is not representable in the given number of bytes, + /// this method panics. If `nbytes > 8`, this method panics. + #[inline] + fn write_uint( + &mut self, + n: u64, + nbytes: usize, + ) -> Result<()> { + let mut buf = [0; 8]; + T::write_uint(&mut buf, n, nbytes); + self.write_all(&buf[0..nbytes]) + } + + /// Writes a signed n-bytes integer to the underlying writer. + /// + /// If the given integer is not representable in the given number of bytes, + /// this method panics. If `nbytes > 8`, this method panics. + #[inline] + fn write_int( + &mut self, + n: i64, + nbytes: usize, + ) -> Result<()> { + let mut buf = [0; 8]; + T::write_int(&mut buf, n, nbytes); + self.write_all(&buf[0..nbytes]) + } + + /// Writes a IEEE754 single-precision (4 bytes) floating point number to + /// the underlying writer. + #[inline] + fn write_f32(&mut self, n: f32) -> Result<()> { + let mut buf = [0; 4]; + T::write_f32(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a IEEE754 double-precision (8 bytes) floating point number to + /// the underlying writer. + #[inline] + fn write_f64(&mut self, n: f64) -> Result<()> { + let mut buf = [0; 8]; + T::write_f64(&mut buf, n); + self.write_all(&buf) + } +} + +/// All types that implement `Write` get methods defined in `WriteBytesExt` +/// for free. +impl WriteBytesExt for W {} diff --git a/third_party/rust/cgl/.cargo-checksum.json b/third_party/rust/cgl/.cargo-checksum.json new file mode 100644 index 000000000000..8fc25a0c97fa --- /dev/null +++ b/third_party/rust/cgl/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"944bf600c6230664922a011cbca026699969f2f89f6c7ff689835836ccd7b1de",".travis.yml":"ea512c9287deceaab4ee436a1246874c84e7a422a90cd3aa3e8f9d3121824674","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"e651a297d1d1445870a6380de53f1fd33f4ac9c349ff4197d740e24c9a16ca47","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"5b2cad1e1bd53b9f986974a23dbcbd951270a567d6c661f3584707d7ad198e82","src/cgl.rs":"d41fea7f18c07912f485d041baeb99010023084b449af69c6c92dfdcaf1c96e8","src/lib.rs":"8a86ac23aaea868d951a1c51300670d1eda525681d0b144964a6c81737f485e6"},"package":"8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10"} \ No newline at end of file diff --git a/third_party/rust/cgl/.cargo-ok b/third_party/rust/cgl/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/cgl/.gitignore b/third_party/rust/cgl/.gitignore new file mode 100644 index 000000000000..fa8d85ac52f1 --- /dev/null +++ b/third_party/rust/cgl/.gitignore @@ -0,0 +1,2 @@ +Cargo.lock +target diff --git a/third_party/rust/cgl/.travis.yml b/third_party/rust/cgl/.travis.yml new file mode 100644 index 000000000000..2a209a9d2658 --- /dev/null +++ b/third_party/rust/cgl/.travis.yml @@ -0,0 +1,8 @@ +os: osx +language: rust +sudo: false +branches: + except: + - master +notifications: + webhooks: http://build.servo.org:54856/travis diff --git a/third_party/rust/cgl/COPYING b/third_party/rust/cgl/COPYING new file mode 100644 index 000000000000..8b7291ad281c --- /dev/null +++ b/third_party/rust/cgl/COPYING @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 or the MIT license +, at your +option. All files in the project carrying such notice may not be +copied, modified, or distributed except according to those terms. diff --git a/third_party/rust/cgl/Cargo.toml b/third_party/rust/cgl/Cargo.toml new file mode 100644 index 000000000000..535806f9bea3 --- /dev/null +++ b/third_party/rust/cgl/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "cgl" +license = "MIT / Apache-2.0" +version = "0.1.5" +authors = ["The Servo Project Developers"] +description = "Rust bindings for CGL on Mac" +repository = "https://github.com/servo/cgl-rs" + +[dependencies] +libc = "0.2" +gleam = "0.2" diff --git a/third_party/rust/cgl/LICENSE-APACHE b/third_party/rust/cgl/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/cgl/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/cgl/LICENSE-MIT b/third_party/rust/cgl/LICENSE-MIT new file mode 100644 index 000000000000..807526f57f3a --- /dev/null +++ b/third_party/rust/cgl/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2012-2013 Mozilla Foundation + +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. diff --git a/third_party/rust/cgl/README.md b/third_party/rust/cgl/README.md new file mode 100644 index 000000000000..3db2088430f6 --- /dev/null +++ b/third_party/rust/cgl/README.md @@ -0,0 +1,4 @@ +rust-cgl +======== + +Rust bindings for CGL on Mac diff --git a/third_party/rust/cgl/src/cgl.rs b/third_party/rust/cgl/src/cgl.rs new file mode 100644 index 000000000000..98d15322014e --- /dev/null +++ b/third_party/rust/cgl/src/cgl.rs @@ -0,0 +1,196 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Mac-specific OpenGL bindings. + +#![allow(non_upper_case_globals)] + +use gleam::gl::{GLenum, GLint, GLsizei, GLuint}; +use libc::{c_void, c_int, c_char}; + +pub type CGLPixelFormatAttribute = c_int; +pub type CGLContextParameter = c_int; +pub type CGLContextEnable = c_int; +pub type CGLGlobalOption = c_int; +pub type CGLError = c_int; + +pub type CGLPixelFormatObj = *mut c_void; +pub type CGLContextObj = *mut c_void; +pub type CGLShareGroupObj = *mut c_void; +pub type IOSurfaceRef = *mut c_void; + +pub const kCGLNoError: CGLError = 0; + +pub const kCGLPFAAllRenderers: CGLPixelFormatAttribute = 1; +pub const kCGLPFADoubleBuffer: CGLPixelFormatAttribute = 5; +pub const kCGLPFAStereo: CGLPixelFormatAttribute = 6; +pub const kCGLPFAAuxBuffers: CGLPixelFormatAttribute = 7; +pub const kCGLPFAColorSize: CGLPixelFormatAttribute = 8; +pub const kCGLPFAAlphaSize: CGLPixelFormatAttribute = 11; +pub const kCGLPFADepthSize: CGLPixelFormatAttribute = 12; +pub const kCGLPFAStencilSize: CGLPixelFormatAttribute = 13; +pub const kCGLPFAAccumSize: CGLPixelFormatAttribute = 14; +pub const kCGLPFAMinimumPolicy: CGLPixelFormatAttribute = 51; +pub const kCGLPFAMaximumPolicy: CGLPixelFormatAttribute = 52; +pub const kCGLPFAOffScreen: CGLPixelFormatAttribute = 53; +pub const kCGLPFAFullScreen: CGLPixelFormatAttribute = 54; +pub const kCGLPFASampleBuffers: CGLPixelFormatAttribute = 55; +pub const kCGLPFASamples: CGLPixelFormatAttribute = 56; +pub const kCGLPFAAuxDepthStencil: CGLPixelFormatAttribute = 57; +pub const kCGLPFAColorFloat: CGLPixelFormatAttribute = 58; +pub const kCGLPFAMultisample: CGLPixelFormatAttribute = 59; +pub const kCGLPFASupersample: CGLPixelFormatAttribute = 60; +pub const kCGLPFASampleAlpha: CGLPixelFormatAttribute = 61; +pub const kCGLPFARendererID: CGLPixelFormatAttribute = 70; +pub const kCGLPFASingleRenderer: CGLPixelFormatAttribute = 71; +pub const kCGLPFANoRecovery: CGLPixelFormatAttribute = 72; +pub const kCGLPFAAccelerated: CGLPixelFormatAttribute = 73; +pub const kCGLPFAClosestPolicy: CGLPixelFormatAttribute = 74; +pub const kCGLPFARobust: CGLPixelFormatAttribute = 75; +pub const kCGLPFABackingStore: CGLPixelFormatAttribute = 76; +pub const kCGLPFAMPSafe: CGLPixelFormatAttribute = 78; +pub const kCGLPFAWindow: CGLPixelFormatAttribute = 80; +pub const kCGLPFAMultiScreen: CGLPixelFormatAttribute = 81; +pub const kCGLPFACompliant: CGLPixelFormatAttribute = 83; +pub const kCGLPFADisplayMask: CGLPixelFormatAttribute = 84; +pub const kCGLPFAPBuffer: CGLPixelFormatAttribute = 90; +pub const kCGLPFARemotePBuffer: CGLPixelFormatAttribute = 91; +pub const kCGLPFAAllowOfflineRenderers: CGLPixelFormatAttribute = 96; +pub const kCGLPFAAcceleratedCompute: CGLPixelFormatAttribute = 97; +pub const kCGLPFAOpenGLProfile: CGLPixelFormatAttribute = 99; +pub const kCGLPFAVirtualScreenCount: CGLPixelFormatAttribute = 128; + +pub const kCGLCESwapRectangle: CGLContextEnable = 201; +pub const kCGLCESwapLimit: CGLContextEnable = 203; +pub const kCGLCERasterization: CGLContextEnable = 221; +pub const kCGLCEStateValidation: CGLContextEnable = 301; +pub const kCGLCESurfaceBackingSize: CGLContextEnable = 305; +pub const kCGLCEDisplayListOptimization: CGLContextEnable = 307; +pub const kCGLCEMPEngine: CGLContextEnable = 313; +pub const kCGLCECrashOnRemovedFunctions: CGLContextEnable = 316; + +pub const kCGLCPSwapRectangle: CGLContextParameter = 200; +pub const kCGLCPSwapInterval: CGLContextParameter = 222; +pub const kCGLCPDispatchTableSize: CGLContextParameter = 224; +pub const kCGLCPClientStorage: CGLContextParameter = 226; +pub const kCGLCPSurfaceTexture: CGLContextParameter = 228; +pub const kCGLCPSurfaceOrder: CGLContextParameter = 235; +pub const kCGLCPSurfaceOpacity: CGLContextParameter = 236; +pub const kCGLCPSurfaceBackingSize: CGLContextParameter = 304; +pub const kCGLCPSurfaceSurfaceVolatile: CGLContextParameter = 306; +pub const kCGLCPReclaimResources: CGLContextParameter = 308; +pub const kCGLCPCurrentRendererID: CGLContextParameter = 309; +pub const kCGLCPGPUVertexProcessing: CGLContextParameter = 310; +pub const kCGLCPGPUFragmentProcessing: CGLContextParameter = 311; +pub const kCGLCPHasDrawable: CGLContextParameter = 314; +pub const kCGLCPMPSwapsInFlight: CGLContextParameter = 315; + +pub const kCGLGOFormatCacheSize: CGLGlobalOption = 501; +pub const kCGLGOClearFormatCache: CGLGlobalOption = 502; +pub const kCGLGORetainRenderers: CGLGlobalOption = 503; +pub const kCGLGOResetLibrary: CGLGlobalOption = 504; +pub const kCGLGOUseErrorHandler: CGLGlobalOption = 505; +pub const kCGLGOUseBuildCache: CGLGlobalOption = 506; + +pub const CORE_BOOLEAN_ATTRIBUTES: &'static [CGLPixelFormatAttribute] = + &[kCGLPFAAllRenderers, + kCGLPFADoubleBuffer, + kCGLPFAStereo, + kCGLPFAAuxBuffers, + kCGLPFAMinimumPolicy, + kCGLPFAMaximumPolicy, + kCGLPFAOffScreen, + kCGLPFAFullScreen, + kCGLPFAAuxDepthStencil, + kCGLPFAColorFloat, + kCGLPFAMultisample, + kCGLPFASupersample, + kCGLPFASampleAlpha, + kCGLPFASingleRenderer, + kCGLPFANoRecovery, + kCGLPFAAccelerated, + kCGLPFAClosestPolicy, + kCGLPFARobust, + kCGLPFABackingStore, + kCGLPFAMPSafe, + kCGLPFAWindow, + kCGLPFAMultiScreen, + kCGLPFACompliant, + kCGLPFAPBuffer, + kCGLPFARemotePBuffer, + kCGLPFAAllowOfflineRenderers, + kCGLPFAAcceleratedCompute]; + +pub const CORE_INTEGER_ATTRIBUTES: &'static [CGLPixelFormatAttribute] = + &[kCGLPFAColorSize, + kCGLPFAAlphaSize, + kCGLPFADepthSize, + kCGLPFAStencilSize, + kCGLPFAAccumSize, + kCGLPFASampleBuffers, + kCGLPFASamples, + kCGLPFARendererID, + kCGLPFADisplayMask, + kCGLPFAOpenGLProfile, + kCGLPFAVirtualScreenCount]; + +#[link(name = "OpenGL", kind = "framework")] +extern { + // CGLCurrent.h + + pub fn CGLSetCurrentContext(ctx: CGLContextObj) -> CGLError; + pub fn CGLGetCurrentContext() -> CGLContextObj; + pub fn CGLGetShareGroup(context: CGLContextObj) -> CGLShareGroupObj; + + // OpenGL.h + + // Pixel format functions + pub fn CGLChoosePixelFormat(attribs: *const CGLPixelFormatAttribute, + pix: *mut CGLPixelFormatObj, + npix: *mut GLint) -> CGLError; + pub fn CGLDescribePixelFormat(pix: CGLPixelFormatObj, + pix_num: GLint, + attrib: CGLPixelFormatAttribute, + value: *mut GLint) -> CGLError; + pub fn CGLDestroyPixelFormat(pix: CGLPixelFormatObj) -> CGLError; + + // Context functions + pub fn CGLCreateContext(pix: CGLPixelFormatObj, share: CGLContextObj, ctx: *mut CGLContextObj) -> + CGLError; + pub fn CGLDestroyContext(ctx: CGLContextObj) -> CGLError; + pub fn CGLGetPixelFormat(ctx: CGLContextObj) -> CGLPixelFormatObj; + + // Getting and Setting Context Options + pub fn CGLEnable(ctx: CGLContextObj, pname: CGLContextEnable) -> CGLError; + pub fn CGLDisable(ctx: CGLContextObj, pname: CGLContextEnable) -> CGLError; + pub fn CGLIsEnabled(ctx: CGLContextObj, pname: CGLContextEnable, enable: &mut GLint) -> CGLError; + pub fn CGLSetParameter(ctx: CGLContextObj, pname: CGLContextParameter, params: &GLint) -> CGLError; + pub fn CGLGetParameter(ctx: CGLContextObj, pname: CGLContextParameter, params: &mut GLint) -> CGLError; + + // Locking functions + pub fn CGLLockContext(ctx: CGLContextObj) -> CGLError; + pub fn CGLUnlockContext(ctx: CGLContextObj) -> CGLError; + + // Getting and Setting Global Information + pub fn CGLSetOption(pname: CGLGlobalOption, param: &GLint) -> CGLError; + pub fn CGLGetOption(pname: CGLGlobalOption, param: &mut GLint) -> CGLError; + pub fn CGLSetGlobalOption(pname: CGLGlobalOption, param: &GLint) -> CGLError; + pub fn CGLGetGlobalOption(pname: CGLGlobalOption, param: &mut GLint) -> CGLError; + pub fn CGLGetVersion (major: &mut GLint, minor: &mut GLint) -> CGLError; + + // CGLIOSurface.h + + pub fn CGLTexImageIOSurface2D(ctx: CGLContextObj, target: GLenum, internal_format: GLenum, + width: GLsizei, height: GLsizei, format: GLenum, ty: GLenum, + ioSurface: IOSurfaceRef, plane: GLuint) -> CGLError; + + // https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CGL_OpenGL/#//apple_ref/c/func/CGLErrorString + + pub fn CGLErrorString(error: CGLError) -> *const c_char; +} diff --git a/third_party/rust/cgl/src/lib.rs b/third_party/rust/cgl/src/lib.rs new file mode 100644 index 000000000000..42845ba18ed2 --- /dev/null +++ b/third_party/rust/cgl/src/lib.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "cgl"] +#![crate_type = "lib"] + +extern crate libc; +extern crate gleam; + +pub use cgl::*; + +mod cgl; diff --git a/third_party/rust/core-foundation-sys/.cargo-checksum.json b/third_party/rust/core-foundation-sys/.cargo-checksum.json new file mode 100644 index 000000000000..098aeca5d5c8 --- /dev/null +++ b/third_party/rust/core-foundation-sys/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"f99593f6c99ed02fd0bd95592e27fd84e0e7508f5ad4c27a185d0c29c1bc38e2","build.rs":"4dbf3e5a423e5eba48fc7f11e4f7638c054e53a3750c888059a96d96f8923ef2","src/array.rs":"d648ed8cf0ccb72c3ca0d9e018a3db804edad9685739eba13f8f515e04f3708b","src/base.rs":"36e8ba1ef798331679972e532a61447a327c2af7697631cb25040b581839410c","src/bundle.rs":"ff5f5253f331b7fa054414a3f256d74760e3ce805b720cdb735a2e46cc66dce6","src/data.rs":"21e968951fe56e080d33474f4438de2dfb7e0c8af426a6dfb100efdd6c530eec","src/date.rs":"f6cdcb94658fafc5bacb83cfbd20ad97502b8ddf6bd1c0c0d6a2545a4f7b7420","src/dictionary.rs":"97c40c1afc719b970968179112ad76c3c89b6b4eb4ea18f7ac3f059d98cce736","src/error.rs":"61bc31a401ec6c8495668175eade9284e257da056fc666af74a5555af5daf33f","src/lib.rs":"8bdbc6ed8fcbbc5b69d7634031ff44d50b9ac789279eb89b80c280ea156c98b3","src/messageport.rs":"59ba92ca90bb9b3162b6df44188fac18cd979250f33a52361144c902e86529bd","src/number.rs":"8881c7cd1b510c654c445485de898f83abda91557fd3e6f9daccf2d1b9c4c57e","src/propertylist.rs":"cc2b27f8f8ebc80c03871b7b1ad50ee348539b016078ce721c86b8cd5f9d75bd","src/runloop.rs":"7feab3bbb9913c3b40285bc37b920f9fe4d937d1db08d8ae69a2ec9597713598","src/set.rs":"51e978fc81d4c55013dfc6df4e76c58daaf5deedf9aafda0f6a9e04e7575272c","src/string.rs":"27b92e8e5d3fc95a521dc6447ccfefd9eb28ec5f42bd8571defd124d950b133f","src/url.rs":"bd9f162e2e3e316267b0d36c4d0551dbf2435a40bd1e69bbe0efafd72d232432"},"package":"065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d"} \ No newline at end of file diff --git a/third_party/rust/core-foundation-sys/.cargo-ok b/third_party/rust/core-foundation-sys/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/core-foundation-sys/Cargo.toml b/third_party/rust/core-foundation-sys/Cargo.toml new file mode 100644 index 000000000000..be9d63f0bf58 --- /dev/null +++ b/third_party/rust/core-foundation-sys/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "core-foundation-sys" +description = "Bindings to Core Foundation for OS X" +homepage = "https://github.com/servo/core-foundation-rs" +repository = "https://github.com/servo/core-foundation-rs" +version = "0.2.3" +authors = ["The Servo Project Developers"] +license = "MIT / Apache-2.0" +build = "build.rs" +links = "CoreFoundation.framework" + +[dependencies] +libc = "0.2" diff --git a/third_party/rust/core-foundation-sys/build.rs b/third_party/rust/core-foundation-sys/build.rs new file mode 100644 index 000000000000..a1a0ea1020cf --- /dev/null +++ b/third_party/rust/core-foundation-sys/build.rs @@ -0,0 +1,12 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rustc-link-lib=framework=CoreFoundation"); +} diff --git a/third_party/rust/core-foundation-sys/src/array.rs b/third_party/rust/core-foundation-sys/src/array.rs new file mode 100644 index 000000000000..2574ecae42f6 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/array.rs @@ -0,0 +1,61 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::c_void; + +use base::{CFRange, CFIndex, CFAllocatorRef, CFTypeID}; + +/// FIXME(pcwalton): This is wrong. +pub type CFArrayRetainCallBack = *const u8; + +/// FIXME(pcwalton): This is wrong. +pub type CFArrayReleaseCallBack = *const u8; + +/// FIXME(pcwalton): This is wrong. +pub type CFArrayCopyDescriptionCallBack = *const u8; + +/// FIXME(pcwalton): This is wrong. +pub type CFArrayEqualCallBack = *const u8; + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct CFArrayCallBacks { + pub version: CFIndex, + pub retain: CFArrayRetainCallBack, + pub release: CFArrayReleaseCallBack, + pub copyDescription: CFArrayCopyDescriptionCallBack, + pub equal: CFArrayEqualCallBack, +} + +#[repr(C)] +pub struct __CFArray(c_void); + +pub type CFArrayRef = *const __CFArray; + +extern { + /* + * CFArray.h + */ + pub static kCFTypeArrayCallBacks: CFArrayCallBacks; + + pub fn CFArrayCreate(allocator: CFAllocatorRef, values: *const *const c_void, + numValues: CFIndex, callBacks: *const CFArrayCallBacks) -> CFArrayRef; + pub fn CFArrayCreateCopy(allocator: CFAllocatorRef , theArray: CFArrayRef) -> CFArrayRef; + + // CFArrayBSearchValues + // CFArrayContainsValue + pub fn CFArrayGetCount(theArray: CFArrayRef) -> CFIndex; + // CFArrayGetCountOfValue + // CFArrayGetFirstIndexOfValue + // CFArrayGetLastIndexOfValue + pub fn CFArrayGetValues(theArray: CFArrayRef, range: CFRange, values: *mut *const c_void); + pub fn CFArrayGetValueAtIndex(theArray: CFArrayRef, idx: CFIndex) -> *const c_void; + // CFArrayApplyFunction + pub fn CFArrayGetTypeID() -> CFTypeID; +} diff --git a/third_party/rust/core-foundation-sys/src/base.rs b/third_party/rust/core-foundation-sys/src/base.rs new file mode 100644 index 000000000000..5f29cd55974f --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/base.rs @@ -0,0 +1,75 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::{c_uint, c_long, c_ulong, c_void}; + +pub type Boolean = u8; +pub type CFIndex = c_long; +pub type mach_port_t = c_uint; +pub type CFAllocatorRef = *const c_void; +pub type CFNullRef = *const c_void; +pub type CFHashCode = c_ulong; +pub type CFTypeID = c_ulong; +pub type CFTypeRef = *const c_void; +pub type CFOptionFlags = u32; +pub type OSStatus = i32; + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct CFRange { + pub location: CFIndex, + pub length: CFIndex +} + +// for back-compat +impl CFRange { + pub fn init(location: CFIndex, length: CFIndex) -> CFRange { + CFRange { + location: location, + length: length, + } + } +} + +extern { + /* + * CFBase.h + */ + + /* CFAllocator Reference */ + // N.B. Many CFAllocator functions and constants are omitted here. + pub static kCFAllocatorDefault: CFAllocatorRef; + pub static kCFAllocatorSystemDefault: CFAllocatorRef; + pub static kCFAllocatorMalloc: CFAllocatorRef; + pub static kCFAllocatorMallocZone: CFAllocatorRef; + pub static kCFAllocatorNull: CFAllocatorRef; + pub static kCFAllocatorUseContext: CFAllocatorRef; + + /* CFNull Reference */ + + pub static kCFNull: CFNullRef; + + /* CFType Reference */ + + //fn CFCopyDescription + //fn CFCopyTypeIDDescription + //fn CFEqual + //fn CFGetAllocator + pub fn CFEqual(cf1: CFTypeRef, cf2: CFTypeRef) -> Boolean; + pub fn CFGetRetainCount(cf: CFTypeRef) -> CFIndex; + pub fn CFGetTypeID(cf: CFTypeRef) -> CFTypeID; + pub fn CFHash(cf: CFTypeRef) -> CFHashCode; + //fn CFMakeCollectable + pub fn CFRelease(cf: CFTypeRef); + pub fn CFRetain(cf: CFTypeRef) -> CFTypeRef; + pub fn CFShow(obj: CFTypeRef); + + /* Base Utilities Reference */ + // N.B. Some things missing here. +} diff --git a/third_party/rust/core-foundation-sys/src/bundle.rs b/third_party/rust/core-foundation-sys/src/bundle.rs new file mode 100644 index 000000000000..51746a6c9385 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/bundle.rs @@ -0,0 +1,31 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::c_void; + +use base::CFTypeID; +use dictionary::CFDictionaryRef; +use string::CFStringRef; + +#[repr(C)] +pub struct __CFBundle(c_void); + +pub type CFBundleRef = *const __CFBundle; + +extern { + /* + * CFBundle.h + */ + pub fn CFBundleGetBundleWithIdentifier(bundleID: CFStringRef) -> CFBundleRef; + pub fn CFBundleGetFunctionPointerForName(bundle: CFBundleRef, function_name: CFStringRef) -> *const c_void; + pub fn CFBundleGetMainBundle() -> CFBundleRef; + pub fn CFBundleGetInfoDictionary(bundle: CFBundleRef) -> CFDictionaryRef; + + pub fn CFBundleGetTypeID() -> CFTypeID; +} diff --git a/third_party/rust/core-foundation-sys/src/data.rs b/third_party/rust/core-foundation-sys/src/data.rs new file mode 100644 index 000000000000..6a42b2b387d4 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/data.rs @@ -0,0 +1,22 @@ +use libc::c_void; + +use base::{CFAllocatorRef, CFTypeID, CFIndex}; + +#[repr(C)] +pub struct __CFData(c_void); + +pub type CFDataRef = *const __CFData; + +extern { + /* + * CFData.h + */ + + pub fn CFDataCreate(allocator: CFAllocatorRef, + bytes: *const u8, length: CFIndex) -> CFDataRef; + //fn CFDataFind + pub fn CFDataGetBytePtr(theData: CFDataRef) -> *const u8; + pub fn CFDataGetLength(theData: CFDataRef) -> CFIndex; + + pub fn CFDataGetTypeID() -> CFTypeID; +} diff --git a/third_party/rust/core-foundation-sys/src/date.rs b/third_party/rust/core-foundation-sys/src/date.rs new file mode 100644 index 000000000000..c6cac2d9542c --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/date.rs @@ -0,0 +1,15 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub type CFTimeInterval = f64; +pub type CFAbsoluteTime = CFTimeInterval; + +extern { + pub fn CFAbsoluteTimeGetCurrent() -> CFAbsoluteTime; +} diff --git a/third_party/rust/core-foundation-sys/src/dictionary.rs b/third_party/rust/core-foundation-sys/src/dictionary.rs new file mode 100644 index 000000000000..bf51bb101c3b --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/dictionary.rs @@ -0,0 +1,79 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::{c_void}; + +use base::{CFAllocatorRef, CFIndex, CFTypeID, Boolean}; + +pub type CFDictionaryApplierFunction = extern "C" fn (key: *const c_void, + value: *const c_void, + context: *mut c_void); +pub type CFDictionaryCopyDescriptionCallBack = *const u8; +pub type CFDictionaryEqualCallBack = *const u8; +pub type CFDictionaryHashCallBack = *const u8; +pub type CFDictionaryReleaseCallBack = *const u8; +pub type CFDictionaryRetainCallBack = *const u8; + +#[allow(dead_code)] +#[repr(C)] +#[derive(Clone, Copy)] +pub struct CFDictionaryKeyCallBacks { + pub version: CFIndex, + pub retain: CFDictionaryRetainCallBack, + pub release: CFDictionaryReleaseCallBack, + pub copyDescription: CFDictionaryCopyDescriptionCallBack, + pub equal: CFDictionaryEqualCallBack, + pub hash: CFDictionaryHashCallBack +} + +#[allow(dead_code)] +#[repr(C)] +#[derive(Clone, Copy)] +pub struct CFDictionaryValueCallBacks { + pub version: CFIndex, + pub retain: CFDictionaryRetainCallBack, + pub release: CFDictionaryReleaseCallBack, + pub copyDescription: CFDictionaryCopyDescriptionCallBack, + pub equal: CFDictionaryEqualCallBack +} + +#[repr(C)] +pub struct __CFDictionary(c_void); + +pub type CFDictionaryRef = *const __CFDictionary; +pub type CFMutableDictionaryRef = *const __CFDictionary; + +extern { + /* + * CFDictionary.h + */ + + pub static kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks; + pub static kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks; + + pub fn CFDictionaryContainsKey(theDict: CFDictionaryRef, key: *const c_void) -> Boolean; + pub fn CFDictionaryCreate(allocator: CFAllocatorRef, keys: *const *const c_void, values: *const *const c_void, + numValues: CFIndex, keyCallBacks: *const CFDictionaryKeyCallBacks, + valueCallBacks: *const CFDictionaryValueCallBacks) + -> CFDictionaryRef; + pub fn CFDictionaryGetCount(theDict: CFDictionaryRef) -> CFIndex; + pub fn CFDictionaryGetTypeID() -> CFTypeID; + pub fn CFDictionaryGetValueIfPresent(theDict: CFDictionaryRef, key: *const c_void, value: *mut *const c_void) + -> Boolean; + pub fn CFDictionaryApplyFunction(theDict: CFDictionaryRef, + applier: CFDictionaryApplierFunction, + context: *mut c_void); + pub fn CFDictionarySetValue(theDict: CFMutableDictionaryRef, + key: *const c_void, + value: *const c_void); + pub fn CFDictionaryGetKeysAndValues(theDict: CFDictionaryRef, + keys: *mut *const c_void, + values: *mut *const c_void); + +} diff --git a/third_party/rust/core-foundation-sys/src/error.rs b/third_party/rust/core-foundation-sys/src/error.rs new file mode 100644 index 000000000000..68097dad7cb1 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/error.rs @@ -0,0 +1,32 @@ +// Copyright 2016 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::c_void; + +use base::{CFTypeID, CFIndex}; +use string::CFStringRef; + +#[repr(C)] +pub struct __CFError(c_void); + +pub type CFErrorRef = *mut __CFError; + +extern "C" { + pub fn CFErrorGetTypeID() -> CFTypeID; + + pub static kCFErrorDomainPOSIX: CFStringRef; + pub static kCFErrorDomainOSStatus: CFStringRef; + pub static kCFErrorDomainMach: CFStringRef; + pub static kCFErrorDomainCocoa: CFStringRef; + + pub fn CFErrorGetDomain(err: CFErrorRef) -> CFStringRef; + pub fn CFErrorGetCode(err: CFErrorRef) -> CFIndex; + + pub fn CFErrorCopyDescription(err: CFErrorRef) -> CFStringRef; +} diff --git a/third_party/rust/core-foundation-sys/src/lib.rs b/third_party/rust/core-foundation-sys/src/lib.rs new file mode 100644 index 000000000000..b39da9755be3 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/lib.rs @@ -0,0 +1,26 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, improper_ctypes)] + +extern crate libc; + +pub mod array; +pub mod base; +pub mod bundle; +pub mod data; +pub mod date; +pub mod dictionary; +pub mod error; +pub mod messageport; +pub mod number; +pub mod propertylist; +pub mod runloop; +pub mod set; +pub mod string; +pub mod url; diff --git a/third_party/rust/core-foundation-sys/src/messageport.rs b/third_party/rust/core-foundation-sys/src/messageport.rs new file mode 100644 index 000000000000..9b15a4d06991 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/messageport.rs @@ -0,0 +1,79 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::c_void; + +use base::{CFAllocatorRef, CFIndex, CFTypeID, Boolean}; +use data::CFDataRef; +use date::CFTimeInterval; +use runloop::CFRunLoopSourceRef; +use string::CFStringRef; + +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct CFMessagePortContext { + pub version: CFIndex, + pub info: *mut c_void, + pub retain: Option *const c_void>, + pub release: Option, + pub copyDescription: Option CFStringRef>, +} + +pub type CFMessagePortCallBack = Option< + unsafe extern fn(local: CFMessagePortRef, + msgid: i32, + data: CFDataRef, + info: *mut c_void) -> CFDataRef>; + +pub type CFMessagePortInvalidationCallBack = Option< + unsafe extern "C" fn(ms: CFMessagePortRef, info: *mut c_void)>; + +#[repr(C)] +pub struct __CFMessagePort(c_void); +pub type CFMessagePortRef = *const __CFMessagePort; + +extern { + /* + * CFMessagePort.h + */ + pub fn CFMessagePortGetTypeID() -> CFTypeID; + pub fn CFMessagePortCreateLocal(allocator: CFAllocatorRef, + name: CFStringRef, + callout: CFMessagePortCallBack, + context: *const CFMessagePortContext, + shouldFreeInfo: *mut Boolean) + -> CFMessagePortRef; + pub fn CFMessagePortCreateRemote(allocator: CFAllocatorRef, + name: CFStringRef) -> CFMessagePortRef; + pub fn CFMessagePortIsRemote(ms: CFMessagePortRef) -> Boolean; + pub fn CFMessagePortGetName(ms: CFMessagePortRef) -> CFStringRef; + pub fn CFMessagePortSetName(ms: CFMessagePortRef, newName: CFStringRef) + -> Boolean; + pub fn CFMessagePortGetContext(ms: CFMessagePortRef, + context: *mut CFMessagePortContext); + pub fn CFMessagePortInvalidate(ms: CFMessagePortRef); + pub fn CFMessagePortIsValid(ms: CFMessagePortRef) -> Boolean; + pub fn CFMessagePortGetInvalidationCallBack(ms: CFMessagePortRef) + -> CFMessagePortInvalidationCallBack; + pub fn CFMessagePortSetInvalidationCallBack(ms: CFMessagePortRef, + callout: CFMessagePortInvalidationCallBack); + pub fn CFMessagePortSendRequest(remote: CFMessagePortRef, msgid: i32, + data: CFDataRef, + sendTimeout: CFTimeInterval, + rcvTimeout: CFTimeInterval, + replyMode: CFStringRef, + returnData: *mut CFDataRef) -> i32; + pub fn CFMessagePortCreateRunLoopSource(allocator: CFAllocatorRef, + local: CFMessagePortRef, + order: CFIndex) + -> CFRunLoopSourceRef; + // CFMessagePortSetDispatchQueue +} diff --git a/third_party/rust/core-foundation-sys/src/number.rs b/third_party/rust/core-foundation-sys/src/number.rs new file mode 100644 index 000000000000..05758f3114ba --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/number.rs @@ -0,0 +1,59 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::c_void; + +use base::{CFAllocatorRef, CFTypeID}; + +#[repr(C)] +pub struct __CFBoolean(c_void); + +pub type CFBooleanRef = *const __CFBoolean; + +pub type CFNumberType = u32; + +// members of enum CFNumberType +// static kCFNumberSInt8Type: CFNumberType = 1; +// static kCFNumberSInt16Type: CFNumberType = 2; +pub static kCFNumberSInt32Type: CFNumberType = 3; +pub static kCFNumberSInt64Type: CFNumberType = 4; +// static kCFNumberFloat32Type: CFNumberType = 5; +pub static kCFNumberFloat64Type: CFNumberType = 6; +// static kCFNumberCharType: CFNumberType = 7; +// static kCFNumberShortType: CFNumberType = 8; +// static kCFNumberIntType: CFNumberType = 9; +// static kCFNumberLongType: CFNumberType = 10; +// static kCFNumberLongLongType: CFNumberType = 11; +// static kCFNumberFloatType: CFNumberType = 12; +// static kCFNumberDoubleType: CFNumberType = 13; +// static kCFNumberCFIndexType: CFNumberType = 14; +// static kCFNumberNSIntegerType: CFNumberType = 15; +// static kCFNumberCGFloatType: CFNumberType = 16; +// static kCFNumberMaxType: CFNumberType = 16; + +#[repr(C)] +pub struct __CFNumber; + +pub type CFNumberRef = *const __CFNumber; + +extern { + /* + * CFNumber.h + */ + pub static kCFBooleanTrue: CFBooleanRef; + pub static kCFBooleanFalse: CFBooleanRef; + + pub fn CFBooleanGetTypeID() -> CFTypeID; + pub fn CFNumberCreate(allocator: CFAllocatorRef, theType: CFNumberType, valuePtr: *const c_void) + -> CFNumberRef; + //fn CFNumberGetByteSize + pub fn CFNumberGetValue(number: CFNumberRef, theType: CFNumberType, valuePtr: *mut c_void) -> bool; + //fn CFNumberCompare + pub fn CFNumberGetTypeID() -> CFTypeID; +} diff --git a/third_party/rust/core-foundation-sys/src/propertylist.rs b/third_party/rust/core-foundation-sys/src/propertylist.rs new file mode 100644 index 000000000000..2396ef998939 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/propertylist.rs @@ -0,0 +1,37 @@ +use base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeRef}; +use data::CFDataRef; +use error::CFErrorRef; + +pub type CFPropertyListRef = CFTypeRef; + +pub type CFPropertyListFormat = CFIndex; +pub const kCFPropertyListOpenStepFormat: CFPropertyListFormat = 1; +pub const kCFPropertyListXMLFormat_v1_0: CFPropertyListFormat = 100; +pub const kCFPropertyListBinaryFormat_v1_0: CFPropertyListFormat = 200; + +pub type CFPropertyListMutabilityOptions = CFOptionFlags; +pub const kCFPropertyListImmutable: CFPropertyListMutabilityOptions = 0; +pub const kCFPropertyListMutableContainers: CFPropertyListMutabilityOptions = 1; +pub const kCFPropertyListMutableContainersAndLeaves: CFPropertyListMutabilityOptions = 2; + +extern "C" { + // CFPropertyList.h + // + + // fn CFPropertyListCreateDeepCopy + // fn CFPropertyListIsValid + pub fn CFPropertyListCreateWithData(allocator: CFAllocatorRef, + data: CFDataRef, + options: CFPropertyListMutabilityOptions, + format: *mut CFPropertyListFormat, + error: *mut CFErrorRef) + -> CFPropertyListRef; + // fn CFPropertyListCreateWithStream + // fn CFPropertyListWrite + pub fn CFPropertyListCreateData(allocator: CFAllocatorRef, + propertyList: CFPropertyListRef, + format: CFPropertyListFormat, + options: CFOptionFlags, + error: *mut CFErrorRef) + -> CFDataRef; +} diff --git a/third_party/rust/core-foundation-sys/src/runloop.rs b/third_party/rust/core-foundation-sys/src/runloop.rs new file mode 100644 index 000000000000..86414a5ee1d4 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/runloop.rs @@ -0,0 +1,164 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::c_void; + +use array::CFArrayRef; +use base::{Boolean, CFIndex, CFTypeID, CFAllocatorRef, CFOptionFlags, CFHashCode, mach_port_t}; +use date::{CFAbsoluteTime, CFTimeInterval}; +use string::CFStringRef; + +#[repr(C)] +pub struct __CFRunLoop(c_void); + +pub type CFRunLoopRef = *const __CFRunLoop; + +#[repr(C)] +pub struct __CFRunLoopSource(c_void); + +pub type CFRunLoopSourceRef = *const __CFRunLoopSource; + +#[repr(C)] +pub struct __CFRunLoopObserver(c_void); + +pub type CFRunLoopObserverRef = *const __CFRunLoopObserver; + +// Reasons for CFRunLoopRunInMode() to Return +pub const kCFRunLoopRunFinished: i32 = 1; +pub const kCFRunLoopRunStopped: i32 = 2; +pub const kCFRunLoopRunTimedOut: i32 = 3; +pub const kCFRunLoopRunHandledSource: i32 = 4; + +// Run Loop Observer Activities +//typedef CF_OPTIONS(CFOptionFlags, CFRunLoopActivity) { +pub type CFRunLoopActivity = CFOptionFlags; +pub const kCFRunLoopEntry: CFOptionFlags = 1 << 0; +pub const kCFRunLoopBeforeTimers: CFOptionFlags = 1 << 1; +pub const kCFRunLoopBeforeSources: CFOptionFlags = 1 << 2; +pub const kCFRunLoopBeforeWaiting: CFOptionFlags = 1 << 5; +pub const kCFRunLoopAfterWaiting: CFOptionFlags = 1 << 6; +pub const kCFRunLoopExit: CFOptionFlags = 1 << 7; +pub const kCFRunLoopAllActivities: CFOptionFlags = 0x0FFFFFFF; + +#[repr(C)] +pub struct CFRunLoopSourceContext { + pub version: CFIndex, + pub info: *mut c_void, + pub retain: extern "C" fn (info: *const c_void) -> *const c_void, + pub release: extern "C" fn (info: *const c_void), + pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef, + pub equal: extern "C" fn (info1: *const c_void, info2: *const c_void) -> Boolean, + pub hash: extern "C" fn (info: *const c_void) -> CFHashCode, + pub schedule: extern "C" fn (info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef), + pub cancel: extern "C" fn (info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef), + pub perform: extern "C" fn (info: *const c_void), +} + +#[repr(C)] +pub struct CFRunLoopSourceContext1 { + pub version: CFIndex, + pub info: *mut c_void, + pub retain: extern "C" fn (info: *const c_void) -> *const c_void, + pub release: extern "C" fn (info: *const c_void), + pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef, + pub equal: extern "C" fn (info1: *const c_void, info2: *const c_void) -> Boolean, + pub hash: extern "C" fn (info: *const c_void) -> CFHashCode, + // note that the following two fields are platform dependent in the C header, the ones here are for OS X + pub getPort: extern "C" fn (info: *mut c_void) -> mach_port_t, + pub perform: extern "C" fn (msg: *mut c_void, size: CFIndex, allocator: CFAllocatorRef, info: *mut c_void) -> *mut c_void, +} + +#[repr(C)] +pub struct CFRunLoopObserverContext { + pub version: CFIndex, + pub info: *mut c_void, + pub retain: extern "C" fn (info: *const c_void) -> *const c_void, + pub release: extern "C" fn (info: *const c_void), + pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef, +} + +pub type CFRunLoopObserverCallBack = extern "C" fn (observer: CFRunLoopObserverRef, activity: CFRunLoopActivity, info: *mut c_void); + +#[repr(C)] +pub struct CFRunLoopTimerContext { + pub version: CFIndex, + pub info: *mut c_void, + pub retain: extern "C" fn (info: *const c_void) -> *const c_void, + pub release: extern "C" fn (info: *const c_void), + pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef, +} + +pub type CFRunLoopTimerCallBack = extern "C" fn (timer: CFRunLoopTimerRef, info: *mut c_void); + +#[repr(C)] +pub struct __CFRunLoopTimer; + +pub type CFRunLoopTimerRef = *const __CFRunLoopTimer; + +extern { + /* + * CFRunLoop.h + */ + pub static kCFRunLoopDefaultMode: CFStringRef; + pub static kCFRunLoopCommonModes: CFStringRef; + pub fn CFRunLoopGetTypeID() -> CFTypeID; + pub fn CFRunLoopGetCurrent() -> CFRunLoopRef; + pub fn CFRunLoopGetMain() -> CFRunLoopRef; + pub fn CFRunLoopCopyCurrentMode(rl: CFRunLoopRef) -> CFStringRef; + pub fn CFRunLoopCopyAllModes(rl: CFRunLoopRef) -> CFArrayRef; + pub fn CFRunLoopAddCommonMode(rl: CFRunLoopRef, mode: CFStringRef); + pub fn CFRunLoopGetNextTimerFireDate(rl: CFRunLoopRef, mode: CFStringRef) -> CFAbsoluteTime; + pub fn CFRunLoopRun(); + pub fn CFRunLoopRunInMode(mode: CFStringRef, seconds: CFTimeInterval, returnAfterSourceHandled: Boolean) -> i32; + pub fn CFRunLoopIsWaiting(rl: CFRunLoopRef) -> Boolean; + pub fn CFRunLoopWakeUp(rl: CFRunLoopRef); + pub fn CFRunLoopStop(rl: CFRunLoopRef); + // fn CFRunLoopPerformBlock(rl: CFRunLoopRef, mode: CFTypeRef, block: void (^)(void)); + pub fn CFRunLoopContainsSource(rl: CFRunLoopRef, source: CFRunLoopSourceRef, mode: CFStringRef) -> Boolean; + pub fn CFRunLoopAddSource(rl: CFRunLoopRef, source: CFRunLoopSourceRef, mode: CFStringRef); + pub fn CFRunLoopRemoveSource(rl: CFRunLoopRef, source: CFRunLoopSourceRef, mode: CFStringRef); + pub fn CFRunLoopContainsObserver(rl: CFRunLoopRef, observer: CFRunLoopObserverRef, mode: CFStringRef) -> Boolean; + pub fn CFRunLoopAddObserver(rl: CFRunLoopRef, observer: CFRunLoopObserverRef, mode: CFStringRef); + pub fn CFRunLoopRemoveObserver(rl: CFRunLoopRef, observer: CFRunLoopObserverRef, mode: CFStringRef); + pub fn CFRunLoopContainsTimer(rl: CFRunLoopRef, timer: CFRunLoopTimerRef, mode: CFStringRef) -> Boolean; + pub fn CFRunLoopAddTimer(rl: CFRunLoopRef, timer: CFRunLoopTimerRef, mode: CFStringRef); + pub fn CFRunLoopRemoveTimer(rl: CFRunLoopRef, timer: CFRunLoopTimerRef, mode: CFStringRef); + + pub fn CFRunLoopSourceGetTypeID() -> CFTypeID; + pub fn CFRunLoopSourceCreate(allocator: CFAllocatorRef, order: CFIndex, context: *mut CFRunLoopSourceContext) -> CFRunLoopSourceRef; + pub fn CFRunLoopSourceGetOrder(source: CFRunLoopSourceRef) -> CFIndex; + pub fn CFRunLoopSourceInvalidate(source: CFRunLoopSourceRef); + pub fn CFRunLoopSourceIsValid(source: CFRunLoopSourceRef) -> Boolean; + pub fn CFRunLoopSourceGetContext(source: CFRunLoopSourceRef, context: *mut CFRunLoopSourceContext); + pub fn CFRunLoopSourceSignal(source: CFRunLoopSourceRef); + + pub fn CFRunLoopObserverGetTypeID() -> CFTypeID; + pub fn CFRunLoopObserverCreate(allocator: CFAllocatorRef, activities: CFOptionFlags, repeats: Boolean, order: CFIndex, callout: CFRunLoopObserverCallBack, context: *mut CFRunLoopObserverContext) -> CFRunLoopObserverRef; + // fn CFRunLoopObserverCreateWithHandler(allocator: CFAllocatorRef, activities: CFOptionFlags, repeats: Boolean, order: CFIndex, block: void (^) (CFRunLoopObserverRef observer, CFRunLoopActivity activity)) -> CFRunLoopObserverRef; + pub fn CFRunLoopObserverGetActivities(observer: CFRunLoopObserverRef) -> CFOptionFlags; + pub fn CFRunLoopObserverDoesRepeat(observer: CFRunLoopObserverRef) -> Boolean; + pub fn CFRunLoopObserverGetOrder(observer: CFRunLoopObserverRef) -> CFIndex; + pub fn CFRunLoopObserverInvalidate(observer: CFRunLoopObserverRef); + pub fn CFRunLoopObserverIsValid(observer: CFRunLoopObserverRef) -> Boolean; + pub fn CFRunLoopObserverGetContext(observer: CFRunLoopObserverRef, context: *mut CFRunLoopObserverContext); + + pub fn CFRunLoopTimerGetTypeID() -> CFTypeID; + pub fn CFRunLoopTimerCreate(allocator: CFAllocatorRef, fireDate: CFAbsoluteTime, interval: CFTimeInterval, flags: CFOptionFlags, order: CFIndex, callout: CFRunLoopTimerCallBack, context: *mut CFRunLoopTimerContext) -> CFRunLoopTimerRef; + // fn CFRunLoopTimerCreateWithHandler(allocator: CFAllocatorRef, fireDate: CFAbsoluteTime, interval: CFTimeInterval, flags: CFOptionFlags, order: CFIndex, block: void (^) (CFRunLoopTimerRef timer)) -> CFRunLoopTimerRef; + pub fn CFRunLoopTimerGetNextFireDate(timer: CFRunLoopTimerRef) -> CFAbsoluteTime; + pub fn CFRunLoopTimerSetNextFireDate(timer: CFRunLoopTimerRef, fireDate: CFAbsoluteTime); + pub fn CFRunLoopTimerGetInterval(timer: CFRunLoopTimerRef) -> CFTimeInterval; + pub fn CFRunLoopTimerDoesRepeat(timer: CFRunLoopTimerRef) -> Boolean; + pub fn CFRunLoopTimerGetOrder(timer: CFRunLoopTimerRef) -> CFIndex; + pub fn CFRunLoopTimerInvalidate(timer: CFRunLoopTimerRef); + pub fn CFRunLoopTimerIsValid(timer: CFRunLoopTimerRef) -> Boolean; + pub fn CFRunLoopTimerGetContext(timer: CFRunLoopTimerRef, context: *mut CFRunLoopTimerContext); + pub fn CFRunLoopTimerGetTolerance(timer: CFRunLoopTimerRef) -> CFTimeInterval; + pub fn CFRunLoopTimerSetTolerance(timer: CFRunLoopTimerRef, tolerance: CFTimeInterval); +} diff --git a/third_party/rust/core-foundation-sys/src/set.rs b/third_party/rust/core-foundation-sys/src/set.rs new file mode 100644 index 000000000000..0e7e64c42f30 --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/set.rs @@ -0,0 +1,52 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::c_void; + +use base::{CFAllocatorRef, CFIndex, CFTypeID}; + +pub type CFSetRetainCallBack = *const u8; +pub type CFSetReleaseCallBack = *const u8; +pub type CFSetCopyDescriptionCallBack = *const u8; +pub type CFSetEqualCallBack = *const u8; +pub type CFSetHashCallBack = *const u8; + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct CFSetCallBacks { + pub version: CFIndex, + pub retain: CFSetRetainCallBack, + pub release: CFSetReleaseCallBack, + pub copyDescription: CFSetCopyDescriptionCallBack, + pub equal: CFSetEqualCallBack, + pub hash: CFSetHashCallBack, +} + +#[repr(C)] +pub struct __CFSet(c_void); + +pub type CFSetRef = *const __CFSet; + +extern { + /* + * CFSet.h + */ + + pub static kCFTypeSetCallBacks: CFSetCallBacks; + + /* Creating Sets */ + pub fn CFSetCreate(allocator: CFAllocatorRef, values: *const *const c_void, numValues: CFIndex, + callBacks: *const CFSetCallBacks) -> CFSetRef; + + /* Applying a Function to Set Members */ + //fn CFSetApplyFunction + + pub fn CFSetGetTypeID() -> CFTypeID; +} + diff --git a/third_party/rust/core-foundation-sys/src/string.rs b/third_party/rust/core-foundation-sys/src/string.rs new file mode 100644 index 000000000000..6095bca8711b --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/string.rs @@ -0,0 +1,320 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use libc::{c_char, c_ushort, c_void}; + +use base::{Boolean, CFOptionFlags, CFIndex, CFAllocatorRef, CFRange, CFTypeID}; + +pub type UniChar = c_ushort; + +// CFString.h + +pub type CFStringCompareFlags = CFOptionFlags; +//static kCFCompareCaseInsensitive: CFStringCompareFlags = 1; +//static kCFCompareBackwards: CFStringCompareFlags = 4; +//static kCFCompareAnchored: CFStringCompareFlags = 8; +//static kCFCompareNonliteral: CFStringCompareFlags = 16; +//static kCFCompareLocalized: CFStringCompareFlags = 32; +//static kCFCompareNumerically: CFStringCompareFlags = 64; +//static kCFCompareDiacriticInsensitive: CFStringCompareFlags = 128; +//static kCFCompareWidthInsensitive: CFStringCompareFlags = 256; +//static kCFCompareForcedOrdering: CFStringCompareFlags = 512; + +pub type CFStringEncoding = u32; + +// OS X built-in encodings. + +//static kCFStringEncodingMacRoman: CFStringEncoding = 0; +//static kCFStringEncodingWindowsLatin1: CFStringEncoding = 0x0500; +//static kCFStringEncodingISOLatin1: CFStringEncoding = 0x0201; +//static kCFStringEncodingNextStepLatin: CFStringEncoding = 0x0B01; +//static kCFStringEncodingASCII: CFStringEncoding = 0x0600; +//static kCFStringEncodingUnicode: CFStringEncoding = 0x0100; +pub static kCFStringEncodingUTF8: CFStringEncoding = 0x08000100; +//static kCFStringEncodingNonLossyASCII: CFStringEncoding = 0x0BFF; + +//static kCFStringEncodingUTF16: CFStringEncoding = 0x0100; +//static kCFStringEncodingUTF16BE: CFStringEncoding = 0x10000100; +//static kCFStringEncodingUTF16LE: CFStringEncoding = 0x14000100; +//static kCFStringEncodingUTF32: CFStringEncoding = 0x0c000100; +//static kCFStringEncodingUTF32BE: CFStringEncoding = 0x18000100; +//static kCFStringEncodingUTF32LE: CFStringEncoding = 0x1c000100; + + +// CFStringEncodingExt.h + +pub type CFStringEncodings = CFIndex; + +// External encodings, except those defined above. +// Defined above: kCFStringEncodingMacRoman = 0 +//static kCFStringEncodingMacJapanese: CFStringEncoding = 1; +//static kCFStringEncodingMacChineseTrad: CFStringEncoding = 2; +//static kCFStringEncodingMacKorean: CFStringEncoding = 3; +//static kCFStringEncodingMacArabic: CFStringEncoding = 4; +//static kCFStringEncodingMacHebrew: CFStringEncoding = 5; +//static kCFStringEncodingMacGreek: CFStringEncoding = 6; +//static kCFStringEncodingMacCyrillic: CFStringEncoding = 7; +//static kCFStringEncodingMacDevanagari: CFStringEncoding = 9; +//static kCFStringEncodingMacGurmukhi: CFStringEncoding = 10; +//static kCFStringEncodingMacGujarati: CFStringEncoding = 11; +//static kCFStringEncodingMacOriya: CFStringEncoding = 12; +//static kCFStringEncodingMacBengali: CFStringEncoding = 13; +//static kCFStringEncodingMacTamil: CFStringEncoding = 14; +//static kCFStringEncodingMacTelugu: CFStringEncoding = 15; +//static kCFStringEncodingMacKannada: CFStringEncoding = 16; +//static kCFStringEncodingMacMalayalam: CFStringEncoding = 17; +//static kCFStringEncodingMacSinhalese: CFStringEncoding = 18; +//static kCFStringEncodingMacBurmese: CFStringEncoding = 19; +//static kCFStringEncodingMacKhmer: CFStringEncoding = 20; +//static kCFStringEncodingMacThai: CFStringEncoding = 21; +//static kCFStringEncodingMacLaotian: CFStringEncoding = 22; +//static kCFStringEncodingMacGeorgian: CFStringEncoding = 23; +//static kCFStringEncodingMacArmenian: CFStringEncoding = 24; +//static kCFStringEncodingMacChineseSimp: CFStringEncoding = 25; +//static kCFStringEncodingMacTibetan: CFStringEncoding = 26; +//static kCFStringEncodingMacMongolian: CFStringEncoding = 27; +//static kCFStringEncodingMacEthiopic: CFStringEncoding = 28; +//static kCFStringEncodingMacCentralEurRoman: CFStringEncoding = 29; +//static kCFStringEncodingMacVietnamese: CFStringEncoding = 30; +//static kCFStringEncodingMacExtArabic: CFStringEncoding = 31; +//static kCFStringEncodingMacSymbol: CFStringEncoding = 33; +//static kCFStringEncodingMacDingbats: CFStringEncoding = 34; +//static kCFStringEncodingMacTurkish: CFStringEncoding = 35; +//static kCFStringEncodingMacCroatian: CFStringEncoding = 36; +//static kCFStringEncodingMacIcelandic: CFStringEncoding = 37; +//static kCFStringEncodingMacRomanian: CFStringEncoding = 38; +//static kCFStringEncodingMacCeltic: CFStringEncoding = 39; +//static kCFStringEncodingMacGaelic: CFStringEncoding = 40; +//static kCFStringEncodingMacFarsi: CFStringEncoding = 0x8C; +//static kCFStringEncodingMacUkrainian: CFStringEncoding = 0x98; +//static kCFStringEncodingMacInuit: CFStringEncoding = 0xEC; +//static kCFStringEncodingMacVT100: CFStringEncoding = 0xFC; +//static kCFStringEncodingMacHFS: CFStringEncoding = 0xFF; +// Defined above: kCFStringEncodingISOLatin1 = 0x0201 +//static kCFStringEncodingISOLatin2: CFStringEncoding = 0x0202; +//static kCFStringEncodingISOLatin3: CFStringEncoding = 0x0203; +//static kCFStringEncodingISOLatin4: CFStringEncoding = 0x0204; +//static kCFStringEncodingISOLatinCyrillic: CFStringEncoding = 0x0205; +//static kCFStringEncodingISOLatinArabic: CFStringEncoding = 0x0206; +//static kCFStringEncodingISOLatinGreek: CFStringEncoding = 0x0207; +//static kCFStringEncodingISOLatinHebrew: CFStringEncoding = 0x0208; +//static kCFStringEncodingISOLatin5: CFStringEncoding = 0x0209; +//static kCFStringEncodingISOLatin6: CFStringEncoding = 0x020A; +//static kCFStringEncodingISOLatinThai: CFStringEncoding = 0x020B; +//static kCFStringEncodingISOLatin7: CFStringEncoding = 0x020D; +//static kCFStringEncodingISOLatin8: CFStringEncoding = 0x020E; +//static kCFStringEncodingISOLatin9: CFStringEncoding = 0x020F; +//static kCFStringEncodingISOLatin10: CFStringEncoding = 0x0210; +//static kCFStringEncodingDOSLatinUS: CFStringEncoding = 0x0400; +//static kCFStringEncodingDOSGreek: CFStringEncoding = 0x0405; +//static kCFStringEncodingDOSBalticRim: CFStringEncoding = 0x0406; +//static kCFStringEncodingDOSLatin1: CFStringEncoding = 0x0410; +//static kCFStringEncodingDOSGreek1: CFStringEncoding = 0x0411; +//static kCFStringEncodingDOSLatin2: CFStringEncoding = 0x0412; +//static kCFStringEncodingDOSCyrillic: CFStringEncoding = 0x0413; +//static kCFStringEncodingDOSTurkish: CFStringEncoding = 0x0414; +//static kCFStringEncodingDOSPortuguese: CFStringEncoding = 0x0415; +//static kCFStringEncodingDOSIcelandic: CFStringEncoding = 0x0416; +//static kCFStringEncodingDOSHebrew: CFStringEncoding = 0x0417; +//static kCFStringEncodingDOSCanadianFrench: CFStringEncoding = 0x0418; +//static kCFStringEncodingDOSArabic: CFStringEncoding = 0x0419; +//static kCFStringEncodingDOSNordic: CFStringEncoding = 0x041A; +//static kCFStringEncodingDOSRussian: CFStringEncoding = 0x041B; +//static kCFStringEncodingDOSGreek2: CFStringEncoding = 0x041C; +//static kCFStringEncodingDOSThai: CFStringEncoding = 0x041D; +//static kCFStringEncodingDOSJapanese: CFStringEncoding = 0x0420; +//static kCFStringEncodingDOSChineseSimplif: CFStringEncoding = 0x0421; +//static kCFStringEncodingDOSKorean: CFStringEncoding = 0x0422; +//static kCFStringEncodingDOSChineseTrad: CFStringEncoding = 0x0423; +// Defined above: kCFStringEncodingWindowsLatin1 = 0x0500 +//static kCFStringEncodingWindowsLatin2: CFStringEncoding = 0x0501; +//static kCFStringEncodingWindowsCyrillic: CFStringEncoding = 0x0502; +//static kCFStringEncodingWindowsGreek: CFStringEncoding = 0x0503; +//static kCFStringEncodingWindowsLatin5: CFStringEncoding = 0x0504; +//static kCFStringEncodingWindowsHebrew: CFStringEncoding = 0x0505; +//static kCFStringEncodingWindowsArabic: CFStringEncoding = 0x0506; +//static kCFStringEncodingWindowsBalticRim: CFStringEncoding = 0x0507; +//static kCFStringEncodingWindowsVietnamese: CFStringEncoding = 0x0508; +//static kCFStringEncodingWindowsKoreanJohab: CFStringEncoding = 0x0510; +// Defined above: kCFStringEncodingASCII = 0x0600 +//static kCFStringEncodingANSEL: CFStringEncoding = 0x0601; +//static kCFStringEncodingJIS_X0201_76: CFStringEncoding = 0x0620; +//static kCFStringEncodingJIS_X0208_83: CFStringEncoding = 0x0621; +//static kCFStringEncodingJIS_X0208_90: CFStringEncoding = 0x0622; +//static kCFStringEncodingJIS_X0212_90: CFStringEncoding = 0x0623; +//static kCFStringEncodingJIS_C6226_78: CFStringEncoding = 0x0624; +//static kCFStringEncodingShiftJIS_X0213: CFStringEncoding = 0x0628; +//static kCFStringEncodingShiftJIS_X0213_MenKuTen: CFStringEncoding = 0x0629; +//static kCFStringEncodingGB_2312_80: CFStringEncoding = 0x0630; +//static kCFStringEncodingGBK_95: CFStringEncoding = 0x0631; +//static kCFStringEncodingGB_18030_2000: CFStringEncoding = 0x0632; +//static kCFStringEncodingKSC_5601_87: CFStringEncoding = 0x0640; +//static kCFStringEncodingKSC_5601_92_Johab: CFStringEncoding = 0x0641; +//static kCFStringEncodingCNS_11643_92_P1: CFStringEncoding = 0x0651; +//static kCFStringEncodingCNS_11643_92_P2: CFStringEncoding = 0x0652; +//static kCFStringEncodingCNS_11643_92_P3: CFStringEncoding = 0x0653; +//static kCFStringEncodingISO_2022_JP: CFStringEncoding = 0x0820; +//static kCFStringEncodingISO_2022_JP_2: CFStringEncoding = 0x0821; +//static kCFStringEncodingISO_2022_JP_1: CFStringEncoding = 0x0822; +//static kCFStringEncodingISO_2022_JP_3: CFStringEncoding = 0x0823; +//static kCFStringEncodingISO_2022_CN: CFStringEncoding = 0x0830; +//static kCFStringEncodingISO_2022_CN_EXT: CFStringEncoding = 0x0831; +//static kCFStringEncodingISO_2022_KR: CFStringEncoding = 0x0840; +//static kCFStringEncodingEUC_JP: CFStringEncoding = 0x0920; +//static kCFStringEncodingEUC_CN: CFStringEncoding = 0x0930; +//static kCFStringEncodingEUC_TW: CFStringEncoding = 0x0931; +//static kCFStringEncodingEUC_KR: CFStringEncoding = 0x0940; +//static kCFStringEncodingShiftJIS: CFStringEncoding = 0x0A01; +//static kCFStringEncodingKOI8_R: CFStringEncoding = 0x0A02; +//static kCFStringEncodingBig5: CFStringEncoding = 0x0A03; +//static kCFStringEncodingMacRomanLatin1: CFStringEncoding = 0x0A04; +//static kCFStringEncodingHZ_GB_2312: CFStringEncoding = 0x0A05; +//static kCFStringEncodingBig5_HKSCS_1999: CFStringEncoding = 0x0A06; +//static kCFStringEncodingVISCII: CFStringEncoding = 0x0A07; +//static kCFStringEncodingKOI8_U: CFStringEncoding = 0x0A08; +//static kCFStringEncodingBig5_E: CFStringEncoding = 0x0A09; +// Defined above: kCFStringEncodingNextStepLatin = 0x0B01 +//static kCFStringEncodingNextStepJapanese: CFStringEncoding = 0x0B02; +//static kCFStringEncodingEBCDIC_US: CFStringEncoding = 0x0C01; +//static kCFStringEncodingEBCDIC_CP037: CFStringEncoding = 0x0C02; +//static kCFStringEncodingUTF7: CFStringEncoding = 0x04000100; +//static kCFStringEncodingUTF7_IMAP: CFStringEncoding = 0x0A10; +//static kCFStringEncodingShiftJIS_X0213_00: CFStringEncoding = 0x0628; /* Deprecated */ + +#[repr(C)] +pub struct __CFString(c_void); + +pub type CFStringRef = *const __CFString; + +extern { + /* + * CFString.h + */ + + // N.B. organized according to "Functions by task" in docs + + /* Creating a CFString */ + //fn CFSTR + //fn CFStringCreateArrayBySeparatingStrings + //fn CFStringCreateByCombiningStrings + //fn CFStringCreateCopy + //fn CFStringCreateFromExternalRepresentation + pub fn CFStringCreateWithBytes(alloc: CFAllocatorRef, + bytes: *const u8, + numBytes: CFIndex, + encoding: CFStringEncoding, + isExternalRepresentation: Boolean, + contentsDeallocator: CFAllocatorRef) + -> CFStringRef; + pub fn CFStringCreateWithBytesNoCopy(alloc: CFAllocatorRef, + bytes: *const u8, + numBytes: CFIndex, + encoding: CFStringEncoding, + isExternalRepresentation: Boolean, + contentsDeallocator: CFAllocatorRef) + -> CFStringRef; + //fn CFStringCreateWithCharacters + //fn CFStringCreateWithCharactersNoCopy + pub fn CFStringCreateWithCString(alloc: CFAllocatorRef, + cStr: *const c_char, + encoding: CFStringEncoding) + -> CFStringRef; + //fn CFStringCreateWithCStringNoCopy + //fn CFStringCreateWithFormat + //fn CFStringCreateWithFormatAndArguments + //fn CFStringCreateWithPascalString + //fn CFStringCreateWithPascalStringNoCopy + //fn CFStringCreateWithSubstring + + /* Searching Strings */ + //fn CFStringCreateArrayWithFindResults + //fn CFStringFind + //fn CFStringFindCharacterFromSet + //fn CFStringFindWithOptions + //fn CFStringFindWithOptionsAndLocale + //fn CFStringGetLineBounds + + /* Comparing Strings */ + //fn CFStringCompare + //fn CFStringCompareWithOptions + //fn CFStringCompareWithOptionsAndLocale + //fn CFStringHasPrefix + //fn CFStringHasSuffix + + /* Accessing Characters */ + //fn CFStringCreateExternalRepresentation + pub fn CFStringGetBytes(theString: CFStringRef, + range: CFRange, + encoding: CFStringEncoding, + lossByte: u8, + isExternalRepresentation: Boolean, + buffer: *mut u8, + maxBufLen: CFIndex, + usedBufLen: *mut CFIndex) + -> CFIndex; + //fn CFStringGetCharacterAtIndex + //fn CFStringGetCharacters + //fn CFStringGetCharactersPtr + //fn CFStringGetCharacterFromInlineBuffer + pub fn CFStringGetCString(theString: CFStringRef, + buffer: *mut c_char, + bufferSize: CFIndex, + encoding: CFStringEncoding) + -> Boolean; + pub fn CFStringGetCStringPtr(theString: CFStringRef, + encoding: CFStringEncoding) + -> *const c_char; + pub fn CFStringGetLength(theString: CFStringRef) -> CFIndex; + //fn CFStringGetPascalString + //fn CFStringGetPascalStringPtr + //fn CFStringGetRangeOfComposedCharactersAtIndex + //fn CFStringInitInlineBuffer + + /* Working With Hyphenation */ + //fn CFStringGetHyphenationLocationBeforeIndex + //fn CFStringIsHyphenationAvailableForLocale + + /* Working With Encodings */ + //fn CFStringConvertEncodingToIANACharSetName + //fn CFStringConvertEncodingToNSStringEncoding + //fn CFStringConvertEncodingToWindowsCodepage + //fn CFStringConvertIANACharSetNameToEncoding + //fn CFStringConvertNSStringEncodingToEncoding + //fn CFStringConvertWindowsCodepageToEncoding + //fn CFStringGetFastestEncoding + //fn CFStringGetListOfAvailableEncodings + //fn CFStringGetMaximumSizeForEncoding + //fn CFStringGetMostCompatibleMacStringEncoding + //fn CFStringGetNameOfEncoding + //fn CFStringGetSmallestEncoding + //fn CFStringGetSystemEncoding + //fn CFStringIsEncodingAvailable + + /* Getting Numeric Values */ + //fn CFStringGetDoubleValue + //fn CFStringGetIntValue + + /* Getting String Properties */ + //fn CFShowStr + pub fn CFStringGetTypeID() -> CFTypeID; + + /* String File System Representations */ + //fn CFStringCreateWithFileSystemRepresentation + //fn CFStringGetFileSystemRepresentation + //fn CFStringGetMaximumSizeOfFileSystemRepresentation + + /* Getting Paragraph Bounds */ + //fn CFStringGetParagraphBounds + + /* Managing Surrogates */ + //fn CFStringGetLongCharacterForSurrogatePair + //fn CFStringGetSurrogatePairForLongCharacter + //fn CFStringIsSurrogateHighCharacter + //fn CFStringIsSurrogateLowCharacter +} diff --git a/third_party/rust/core-foundation-sys/src/url.rs b/third_party/rust/core-foundation-sys/src/url.rs new file mode 100644 index 000000000000..443f893d19ac --- /dev/null +++ b/third_party/rust/core-foundation-sys/src/url.rs @@ -0,0 +1,156 @@ +// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +use libc::c_void; + +use base::{CFOptionFlags, CFIndex, CFAllocatorRef, Boolean, CFTypeID}; +use string::CFStringRef; + +#[repr(C)] +pub struct __CFURL(c_void); + +pub type CFURLRef = *const __CFURL; + +pub type CFURLBookmarkCreationOptions = CFOptionFlags; + +pub type CFURLPathStyle = CFIndex; + +/* typedef CF_ENUM(CFIndex, CFURLPathStyle) */ +pub const kCFURLPOSIXPathStyle: CFURLPathStyle = 0; +pub const kCFURLHFSPathStyle: CFURLPathStyle = 1; +pub const kCFURLWindowsPathStyle: CFURLPathStyle = 2; + +// static kCFURLBookmarkCreationPreferFileIDResolutionMask: CFURLBookmarkCreationOptions = +// (1 << 8) as u32; +// static kCFURLBookmarkCreationMinimalBookmarkMask: CFURLBookmarkCreationOptions = +// (1 << 9) as u32; +// static kCFURLBookmarkCreationSuitableForBookmarkFile: CFURLBookmarkCreationOptions = +// (1 << 10) as u32; +// static kCFURLBookmarkCreationWithSecurityScope: CFURLBookmarkCreationOptions = +// (1 << 11) as u32; +// static kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess: CFURLBookmarkCreationOptions = +// (1 << 12) as u32; + +// TODO: there are a lot of missing keys and constants. Add if you are bored or need them. + +extern { + /* + * CFURL.h + */ + + /* Common File System Resource Keys */ + // static kCFURLAttributeModificationDateKey: CFStringRef; + // static kCFURLContentAccessDateKey: CFStringRef; + // static kCFURLContentModificationDateKey: CFStringRef; + // static kCFURLCreationDateKey: CFStringRef; + // static kCFURLCustomIconKey: CFStringRef; + // static kCFURLEffectiveIconKey: CFStringRef; + // static kCFURLFileResourceIdentifierKey: CFStringRef; + // static kCFURLFileSecurityKey: CFStringRef; + // static kCFURLHasHiddenExtensionKey: CFStringRef; + // static kCFURLIsDirectoryKey: CFStringRef; + // static kCFURLIsExecutableKey: CFStringRef; + // static kCFURLIsHiddenKey: CFStringRef; + // static kCFURLIsPackageKey: CFStringRef; + // static kCFURLIsReadableKey: CFStringRef; + // static kCFURLIsRegularFileKey: CFStringRef; + // static kCFURLIsSymbolicLinkKey: CFStringRef; + // static kCFURLIsSystemImmutableKey: CFStringRef; + // static kCFURLIsUserImmutableKey: CFStringRef; + // static kCFURLIsVolumeKey: CFStringRef; + // static kCFURLIsWritableKey: CFStringRef; + // static kCFURLLabelColorKey: CFStringRef; + // static kCFURLLabelNumberKey: CFStringRef; + // static kCFURLLinkCountKey: CFStringRef; + // static kCFURLLocalizedLabelKey: CFStringRef; + // static kCFURLLocalizedNameKey: CFStringRef; + // static kCFURLLocalizedTypeDescriptionKey: CFStringRef; + // static kCFURLNameKey: CFStringRef; + // static kCFURLParentDirectoryURLKey: CFStringRef; + // static kCFURLPreferredIOBlockSizeKey: CFStringRef; + // static kCFURLTypeIdentifierKey: CFStringRef; + // static kCFURLVolumeIdentifierKey: CFStringRef; + // static kCFURLVolumeURLKey: CFStringRef; + // static kCFURLIsExcludedFromBackupKey: CFStringRef; + // static kCFURLFileResourceTypeKey: CFStringRef; + + /* Creating a CFURL */ + //fn CFURLCopyAbsoluteURL + //fn CFURLCreateAbsoluteURLWithBytes + //fn CFURLCreateByResolvingBookmarkData + //fn CFURLCreateCopyAppendingPathComponent + //fn CFURLCreateCopyAppendingPathExtension + //fn CFURLCreateCopyDeletingLastPathComponent + //fn CFURLCreateCopyDeletingPathExtension + //fn CFURLCreateFilePathURL + //fn CFURLCreateFileReferenceURL + //fn CFURLCreateFromFileSystemRepresentation + //fn CFURLCreateFromFileSystemRepresentationRelativeToBase + //fn CFURLCreateFromFSRef + //fn CFURLCreateWithBytes + //fn CFURLCreateWithFileSystemPath + pub fn CFURLCreateWithFileSystemPath(allocator: CFAllocatorRef, filePath: CFStringRef, pathStyle: CFURLPathStyle, isDirectory: Boolean) -> CFURLRef; + //fn CFURLCreateWithFileSystemPathRelativeToBase + //fn CFURLCreateWithString(allocator: CFAllocatorRef, urlString: CFStringRef, + // baseURL: CFURLRef) -> CFURLRef; + + /* Accessing the Parts of a URL */ + //fn CFURLCanBeDecomposed + //fn CFURLCopyFileSystemPath + //fn CFURLCopyFragment + //fn CFURLCopyHostName + //fn CFURLCopyLastPathComponent + //fn CFURLCopyNetLocation + //fn CFURLCopyParameterString + //fn CFURLCopyPassword + //fn CFURLCopyPath + //fn CFURLCopyPathExtension + //fn CFURLCopyQueryString + //fn CFURLCopyResourceSpecifier + //fn CFURLCopyScheme + //fn CFURLCopyStrictPath + //fn CFURLCopyUserName + //fn CFURLGetPortNumber + //fn CFURLHasDirectoryPath + + /* Converting URLs to Other Representations */ + //fn CFURLCreateData(allocator: CFAllocatorRef, url: CFURLRef, + // encoding: CFStringEncoding, escapeWhitespace: bool) -> CFDataRef; + //fn CFURLCreateStringByAddingPercentEscapes + //fn CFURLCreateStringByReplacingPercentEscapes + //fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding + //fn CFURLGetFileSystemRepresentation + //fn CFURLGetFSRef + pub fn CFURLGetString(anURL: CFURLRef) -> CFStringRef; + + /* Getting URL Properties */ + //fn CFURLGetBaseURL(anURL: CFURLRef) -> CFURLRef; + //fn CFURLGetBytes + //fn CFURLGetByteRangeForComponent + pub fn CFURLGetTypeID() -> CFTypeID; + //fn CFURLResourceIsReachable + + /* Getting and Setting File System Resource Properties */ + //fn CFURLClearResourcePropertyCache + //fn CFURLClearResourcePropertyCacheForKey + //fn CFURLCopyResourcePropertiesForKeys + //fn CFURLCopyResourcePropertyForKey + //fn CFURLCreateResourcePropertiesForKeysFromBookmarkData + //fn CFURLCreateResourcePropertyForKeyFromBookmarkData + //fn CFURLSetResourcePropertiesForKeys + //fn CFURLSetResourcePropertyForKey + //fn CFURLSetTemporaryResourcePropertyForKey + + /* Working with Bookmark Data */ + //fn CFURLCreateBookmarkData + //fn CFURLCreateBookmarkDataFromAliasRecord + //fn CFURLCreateBookmarkDataFromFile + //fn CFURLWriteBookmarkDataToFile + //fn CFURLStartAccessingSecurityScopedResource + //fn CFURLStopAccessingSecurityScopedResource +} diff --git a/third_party/rust/core-foundation/.cargo-checksum.json b/third_party/rust/core-foundation/.cargo-checksum.json new file mode 100644 index 000000000000..e7f9a58b27e0 --- /dev/null +++ b/third_party/rust/core-foundation/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"35ac94f7615ebe24f1285927f03712dde336117e666cfa7cf595d0524bc47b8d","src/array.rs":"ceeb3298fb939ead81914a0e6a555098e59f97c47e62adb625273bde2bb299a4","src/base.rs":"540c85a6600503e2bdf34087e7e921615b094f7493099c7e319c76f34ab97a02","src/boolean.rs":"112adb640ded232cba59eb27edafcf4a3c045cca6f4b0ecb53bb48b741c2139a","src/bundle.rs":"bd172a5e0cc1dffc80edf17da59b90120d0a110181f50f212589b0334fcba72c","src/data.rs":"fc44b08e644b66ae471bb7c8141ec6be7cf5f35eb985dbca5924668a67f0efe5","src/dictionary.rs":"0f3129629db02ea233d08fd937e8290c40f401d644f6a8afc13717094a767559","src/error.rs":"0edbf66bcaa8a68f1de77b9056696b6be4f2dc773f4561f4279e6494cc38453a","src/lib.rs":"71ee7a83a7012138b5a86897f5617d2742c668ccc69664a8c5b4cf080486ddd8","src/number.rs":"262db248c88ac08a3d28d0940ef25fe796fd4ebcf1eeea7bb8a6caa3abdc97f9","src/propertylist.rs":"ec814aa190bc6cf8c2bb3f2d5c65e1a706a770701c8589d29fc01bddad6a11c6","src/runloop.rs":"10e35be9104db16c064dfcb3454a71d00c498fda6145eba53f6e43cb37ee9c15","src/set.rs":"f98fbd31b107f27680727676ab7a3725d6b4370f428e58759ca680eb339a5ea3","src/string.rs":"ec5420a3916e5ebd2cc487ffc605d8fe8de7d09cae8c9fecbf20aa21595f4bee","src/url.rs":"2bdc580d8fa4556c9466923aeccc845257fee9fb5e960b8ff84d6bfead994335"},"package":"25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67"} \ No newline at end of file diff --git a/third_party/rust/core-foundation/.cargo-ok b/third_party/rust/core-foundation/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/core-foundation/Cargo.toml b/third_party/rust/core-foundation/Cargo.toml new file mode 100644 index 000000000000..7be9bae027ca --- /dev/null +++ b/third_party/rust/core-foundation/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "core-foundation" +description = "Bindings to Core Foundation for OS X" +homepage = "https://github.com/servo/core-foundation-rs" +repository = "https://github.com/servo/core-foundation-rs" +version = "0.2.3" +authors = ["The Servo Project Developers"] +license = "MIT / Apache-2.0" + +[dependencies.core-foundation-sys] +path = "../core-foundation-sys" +version = "0.2.3" + +[dependencies] +libc = "0.2" diff --git a/third_party/rust/core-foundation/src/array.rs b/third_party/rust/core-foundation/src/array.rs new file mode 100644 index 000000000000..3859b0a5b0f6 --- /dev/null +++ b/third_party/rust/core-foundation/src/array.rs @@ -0,0 +1,160 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Heterogeneous immutable arrays. + +pub use core_foundation_sys::array::*; +pub use core_foundation_sys::base::{CFIndex, CFRelease}; +use core_foundation_sys::base::{CFTypeRef, kCFAllocatorDefault}; +use libc::c_void; +use std::mem; + +use base::{CFIndexConvertible, TCFType, CFRange}; + +/// A heterogeneous immutable array. +pub struct CFArray(CFArrayRef); + +impl Drop for CFArray { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +pub struct CFArrayIterator<'a> { + array: &'a CFArray, + index: CFIndex, +} + +impl<'a> Iterator for CFArrayIterator<'a> { + type Item = *const c_void; + + fn next(&mut self) -> Option<*const c_void> { + if self.index >= self.array.len() { + None + } else { + let value = self.array.get(self.index); + self.index += 1; + Some(value) + } + } +} + +impl_TCFType!(CFArray, CFArrayRef, CFArrayGetTypeID); + +impl CFArray { + /// Creates a new `CFArray` with the given elements, which must be `CFType` objects. + pub fn from_CFTypes(elems: &[T]) -> CFArray where T: TCFType { + unsafe { + let elems: Vec = elems.iter().map(|elem| elem.as_CFTypeRef()).collect(); + let array_ref = CFArrayCreate(kCFAllocatorDefault, + mem::transmute(elems.as_ptr()), + elems.len().to_CFIndex(), + &kCFTypeArrayCallBacks); + TCFType::wrap_under_create_rule(array_ref) + } + } + + /// Iterates over the elements of this `CFArray`. + /// + /// Careful; the loop body must wrap the reference properly. Generally, when array elements are + /// Core Foundation objects (not always true), they need to be wrapped with + /// `TCFType::wrap_under_get_rule()`. + #[inline] + pub fn iter<'a>(&'a self) -> CFArrayIterator<'a> { + CFArrayIterator { + array: self, + index: 0 + } + } + + #[inline] + pub fn len(&self) -> CFIndex { + unsafe { + CFArrayGetCount(self.0) + } + } + + #[inline] + pub fn get(&self, index: CFIndex) -> *const c_void { + assert!(index < self.len()); + unsafe { + CFArrayGetValueAtIndex(self.0, index) + } + } + + pub fn get_values(&self, range: CFRange) -> Vec<*const c_void> { + let mut vec = Vec::with_capacity(range.length as usize); + unsafe { + CFArrayGetValues(self.0, range, vec.as_mut_ptr()); + vec.set_len(range.length as usize); + vec + } + } + + pub fn get_all_values(&self) -> Vec<*const c_void> { + self.get_values(CFRange { + location: 0, + length: self.len() + }) + } +} + +impl<'a> IntoIterator for &'a CFArray { + type Item = *const c_void; + type IntoIter = CFArrayIterator<'a>; + + fn into_iter(self) -> CFArrayIterator<'a> { + self.iter() + } +} + +#[test] +fn should_box_and_unbox() { + use number::{CFNumber, number}; + + let n1 = number(1); + let n2 = number(2); + let n3 = number(3); + let n4 = number(4); + let n5 = number(5); + + let arr = CFArray::from_CFTypes(&[ + n1.as_CFType(), + n2.as_CFType(), + n3.as_CFType(), + n4.as_CFType(), + n5.as_CFType(), + ]); + + assert!(arr.get_all_values() == &[n1.as_CFTypeRef(), + n2.as_CFTypeRef(), + n3.as_CFTypeRef(), + n4.as_CFTypeRef(), + n5.as_CFTypeRef()]); + + unsafe { + let mut sum = 0; + + for elem in arr.iter() { + let number: CFNumber = TCFType::wrap_under_get_rule(mem::transmute(elem)); + sum += number.to_i64().unwrap() + } + + assert!(sum == 15); + + for elem in arr.iter() { + let number: CFNumber = TCFType::wrap_under_get_rule(mem::transmute(elem)); + sum += number.to_i64().unwrap() + } + + assert!(sum == 30); + } +} diff --git a/third_party/rust/core-foundation/src/base.rs b/third_party/rust/core-foundation/src/base.rs new file mode 100644 index 000000000000..3f4bcea169f2 --- /dev/null +++ b/third_party/rust/core-foundation/src/base.rs @@ -0,0 +1,142 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use core_foundation_sys::base::*; + +pub trait CFIndexConvertible { + /// Always use this method to construct a `CFIndex` value. It performs bounds checking to + /// ensure the value is in range. + fn to_CFIndex(self) -> CFIndex; +} + +impl CFIndexConvertible for usize { + #[inline] + fn to_CFIndex(self) -> CFIndex { + let max_CFIndex = CFIndex::max_value(); + if self > (max_CFIndex as usize) { + panic!("value out of range") + } + self as CFIndex + } +} + +/// Superclass of all Core Foundation objects. +pub struct CFType(CFTypeRef); + +impl Clone for CFType { + #[inline] + fn clone(&self) -> CFType { + unsafe { + TCFType::wrap_under_get_rule(self.0) + } + } +} + +impl Drop for CFType { + fn drop(&mut self) { + unsafe { + CFRelease(self.0) + } + } +} + +/// All Core Foundation types implement this trait. The type parameter `TypeRef` specifies the +/// associated Core Foundation type: e.g. for `CFType` this is `CFTypeRef`; for `CFArray` this is +/// `CFArrayRef`. +pub trait TCFType { + /// Returns the object as its concrete TypeRef. + fn as_concrete_TypeRef(&self) -> ConcreteTypeRef; + + /// Returns an instance of the object, wrapping the underlying `CFTypeRef` subclass. Use this + /// when following Core Foundation's "Create Rule". The reference count is *not* bumped. + unsafe fn wrap_under_create_rule(obj: ConcreteTypeRef) -> Self; + + /// Returns the type ID for this class. + fn type_id() -> CFTypeID; + + /// Returns the object as a wrapped `CFType`. The reference count is incremented by one. + #[inline] + fn as_CFType(&self) -> CFType { + unsafe { + TCFType::wrap_under_get_rule(self.as_CFTypeRef()) + } + } + + /// Returns the object as a raw `CFTypeRef`. The reference count is not adjusted. + fn as_CFTypeRef(&self) -> CFTypeRef; + + /// Returns an instance of the object, wrapping the underlying `CFTypeRef` subclass. Use this + /// when following Core Foundation's "Get Rule". The reference count *is* bumped. + unsafe fn wrap_under_get_rule(reference: ConcreteTypeRef) -> Self; + + /// Returns the reference count of the object. It is unwise to do anything other than test + /// whether the return value of this method is greater than zero. + #[inline] + fn retain_count(&self) -> CFIndex { + unsafe { + CFGetRetainCount(self.as_CFTypeRef()) + } + } + + /// Returns the type ID of this object. + #[inline] + fn type_of(&self) -> CFTypeID { + unsafe { + CFGetTypeID(self.as_CFTypeRef()) + } + } + + /// Writes a debugging version of this object on standard error. + fn show(&self) { + unsafe { + CFShow(self.as_CFTypeRef()) + } + } + + /// Returns true if this value is an instance of another type. + #[inline] + fn instance_of>(&self) -> bool { + self.type_of() == >::type_id() + } +} + +impl TCFType for CFType { + #[inline] + fn as_concrete_TypeRef(&self) -> CFTypeRef { + self.0 + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CFTypeRef) -> CFType { + let reference: CFTypeRef = CFRetain(reference); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + self.as_concrete_TypeRef() + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CFTypeRef) -> CFType { + CFType(obj) + } + + #[inline] + fn type_id() -> CFTypeID { + // FIXME(pcwalton): Is this right? + 0 + } + + #[inline] + fn instance_of>(&self) -> bool { + // Since this is the root of the type hierarchy, we always answer yes. + true + } +} diff --git a/third_party/rust/core-foundation/src/boolean.rs b/third_party/rust/core-foundation/src/boolean.rs new file mode 100644 index 000000000000..8e6ca3bf83e0 --- /dev/null +++ b/third_party/rust/core-foundation/src/boolean.rs @@ -0,0 +1,44 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A Boolean type. + +use core_foundation_sys::base::{CFRelease}; +pub use core_foundation_sys::number::{CFBooleanRef, CFBooleanGetTypeID, kCFBooleanTrue, kCFBooleanFalse}; + +use base::TCFType; + +/// A Boolean type. +/// +/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug. +pub struct CFBoolean(CFBooleanRef); + +impl Drop for CFBoolean { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFBoolean, CFBooleanRef, CFBooleanGetTypeID); + +impl CFBoolean { + pub fn true_value() -> CFBoolean { + unsafe { + TCFType::wrap_under_get_rule(kCFBooleanTrue) + } + } + + pub fn false_value() -> CFBoolean { + unsafe { + TCFType::wrap_under_get_rule(kCFBooleanFalse) + } + } +} diff --git a/third_party/rust/core-foundation/src/bundle.rs b/third_party/rust/core-foundation/src/bundle.rs new file mode 100644 index 000000000000..834422553646 --- /dev/null +++ b/third_party/rust/core-foundation/src/bundle.rs @@ -0,0 +1,46 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Core Foundation Bundle Type + +pub use core_foundation_sys::bundle::*; +use core_foundation_sys::base::CFRelease; + +use base::{TCFType}; +use dictionary::CFDictionary; + +/// A Bundle type. +pub struct CFBundle(CFBundleRef); + +impl Drop for CFBundle { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl CFBundle { + pub fn main_bundle() -> CFBundle { + unsafe { + let bundle_ref = CFBundleGetMainBundle(); + TCFType::wrap_under_get_rule(bundle_ref) + } + } + + pub fn info_dictionary(&self) -> CFDictionary { + unsafe { + let info_dictionary = CFBundleGetInfoDictionary(self.0); + TCFType::wrap_under_get_rule(info_dictionary) + } + } +} + +impl_TCFType!(CFBundle, CFBundleRef, CFBundleGetTypeID); + diff --git a/third_party/rust/core-foundation/src/data.rs b/third_party/rust/core-foundation/src/data.rs new file mode 100644 index 000000000000..7d83a615c13e --- /dev/null +++ b/third_party/rust/core-foundation/src/data.rs @@ -0,0 +1,68 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Core Foundation byte buffers. + +pub use core_foundation_sys::data::*; +use core_foundation_sys::base::{CFIndex, CFRelease}; +use core_foundation_sys::base::{kCFAllocatorDefault}; +use std::ops::Deref; +use std::slice; + +use base::{CFIndexConvertible, TCFType}; + +/// A byte buffer. +pub struct CFData(CFDataRef); + +impl Drop for CFData { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFData, CFDataRef, CFDataGetTypeID); + +impl CFData { + pub fn from_buffer(buffer: &[u8]) -> CFData { + unsafe { + let data_ref = CFDataCreate(kCFAllocatorDefault, + buffer.as_ptr(), + buffer.len().to_CFIndex()); + TCFType::wrap_under_create_rule(data_ref) + } + } + + /// Returns a pointer to the underlying bytes in this data. Note that this byte buffer is + /// read-only. + #[inline] + pub fn bytes<'a>(&'a self) -> &'a [u8] { + unsafe { + slice::from_raw_parts(CFDataGetBytePtr(self.0), self.len() as usize) + } + } + + /// Returns the length of this byte buffer. + #[inline] + pub fn len(&self) -> CFIndex { + unsafe { + CFDataGetLength(self.0) + } + } +} + +impl Deref for CFData { + type Target = [u8]; + + #[inline] + fn deref(&self) -> &[u8] { + self.bytes() + } +} diff --git a/third_party/rust/core-foundation/src/dictionary.rs b/third_party/rust/core-foundation/src/dictionary.rs new file mode 100644 index 000000000000..9953c4b10500 --- /dev/null +++ b/third_party/rust/core-foundation/src/dictionary.rs @@ -0,0 +1,118 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Dictionaries of key-value pairs. + +pub use core_foundation_sys::dictionary::*; +use core_foundation_sys::base::CFRelease; +use core_foundation_sys::base::{CFTypeRef, kCFAllocatorDefault}; +use libc::c_void; +use std::mem; +use std::ptr; + +use base::{CFType, CFIndexConvertible, TCFType}; + +/// An immutable dictionary of key-value pairs. +pub struct CFDictionary(CFDictionaryRef); + +impl Drop for CFDictionary { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFDictionary, CFDictionaryRef, CFDictionaryGetTypeID); + +impl CFDictionary { + pub fn from_CFType_pairs(pairs: &[(K, V)]) -> CFDictionary + where K: TCFType, V: TCFType { + let (keys, values): (Vec,Vec) = + pairs.iter() + .map(|&(ref key, ref value)| (key.as_CFTypeRef(), value.as_CFTypeRef())) + .unzip(); + + unsafe { + let dictionary_ref = CFDictionaryCreate(kCFAllocatorDefault, + mem::transmute(keys.as_ptr()), + mem::transmute(values.as_ptr()), + keys.len().to_CFIndex(), + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + TCFType::wrap_under_create_rule(dictionary_ref) + } + } + + #[inline] + pub fn len(&self) -> usize { + unsafe { + CFDictionaryGetCount(self.0) as usize + } + } + + #[inline] + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + + #[inline] + pub fn contains_key(&self, key: *const c_void) -> bool { + unsafe { + CFDictionaryContainsKey(self.0, key) != 0 + } + } + + #[inline] + pub fn find(&self, key: *const c_void) -> Option<*const c_void> { + unsafe { + let mut value: *const c_void = ptr::null(); + if CFDictionaryGetValueIfPresent(self.0, key, &mut value) != 0 { + Some(value) + } else { + None + } + } + } + + #[inline] + pub fn get(&self, key: *const c_void) -> *const c_void { + let value = self.find(key); + if value.is_none() { + panic!("No entry found for key {:p}", key); + } + value.unwrap() + } + + /// A convenience function to retrieve `CFType` instances. + #[inline] + pub unsafe fn get_CFType(&self, key: *const c_void) -> CFType { + let value: CFTypeRef = mem::transmute(self.get(key)); + TCFType::wrap_under_get_rule(value) + } + + #[inline] + pub unsafe fn set_value(&self, key: *const c_void, value: *const c_void) { + CFDictionarySetValue(self.0, key, value) + } + + pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) { + let length = self.len(); + let mut keys = Vec::with_capacity(length); + let mut values = Vec::with_capacity(length); + + unsafe { + CFDictionaryGetKeysAndValues(self.0, keys.as_mut_ptr(), values.as_mut_ptr()); + keys.set_len(length); + values.set_len(length); + } + + (keys, values) + } +} diff --git a/third_party/rust/core-foundation/src/error.rs b/third_party/rust/core-foundation/src/error.rs new file mode 100644 index 000000000000..af9b26f4e166 --- /dev/null +++ b/third_party/rust/core-foundation/src/error.rs @@ -0,0 +1,77 @@ +// Copyright 2016 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Core Foundation errors. + +use core_foundation_sys::error::*; +use core_foundation_sys::base::CFRelease; +use std::error::Error; +use std::fmt; + +use base::{CFIndex, TCFType}; +use string::CFString; + +/// An error value. +pub struct CFError(CFErrorRef); + +impl Drop for CFError { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFError, CFErrorRef, CFErrorGetTypeID); + +impl fmt::Debug for CFError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("CFError") + .field("domain", &self.domain()) + .field("code", &self.code()) + .field("description", &self.description()) + .finish() + } +} + +impl fmt::Display for CFError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "{}", self.description()) + } +} + +impl Error for CFError { + fn description(&self) -> &str { + "a Core Foundation error" + } +} + +impl CFError { + /// Returns a string identifying the domain with which this error is + /// associated. + pub fn domain(&self) -> CFString { + unsafe { + let s = CFErrorGetDomain(self.0); + CFString::wrap_under_get_rule(s) + } + } + + /// Returns the code identifying this type of error. + pub fn code(&self) -> CFIndex { + unsafe { CFErrorGetCode(self.0) } + } + + /// Returns a human-presentable description of the error. + pub fn description(&self) -> CFString { + unsafe { + let s = CFErrorCopyDescription(self.0); + CFString::wrap_under_create_rule(s) + } + } +} diff --git a/third_party/rust/core-foundation/src/lib.rs b/third_party/rust/core-foundation/src/lib.rs new file mode 100644 index 000000000000..f4ca71d83f41 --- /dev/null +++ b/third_party/rust/core-foundation/src/lib.rs @@ -0,0 +1,98 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![allow(non_snake_case)] + +extern crate core_foundation_sys; +extern crate libc; + +#[macro_export] +macro_rules! impl_TCFType { + ($ty:ident, $raw:ident, $ty_id:ident) => { + impl $crate::base::TCFType<$raw> for $ty { + #[inline] + fn as_concrete_TypeRef(&self) -> $raw { + self.0 + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: $raw) -> $ty { + let reference = ::std::mem::transmute(::core_foundation_sys::base::CFRetain(::std::mem::transmute(reference))); + $crate::base::TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> ::core_foundation_sys::base::CFTypeRef { + unsafe { + ::std::mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: $raw) -> $ty { + $ty(obj) + } + + #[inline] + fn type_id() -> ::core_foundation_sys::base::CFTypeID { + unsafe { + $ty_id() + } + } + } + } +} + +pub mod array; +pub mod base; +pub mod boolean; +pub mod data; +pub use core_foundation_sys::date; // back compat +pub mod dictionary; +pub mod error; +pub mod number; +pub mod set; +pub mod string; +pub mod url; +pub mod bundle; +pub mod propertylist; +pub mod runloop; + +#[cfg(test)] +pub mod test { + #[test] + fn test_stuff() { + use base::TCFType; + use boolean::CFBoolean; + use number::number; + use dictionary::CFDictionary; + use string::CFString; + + /*let n = CFNumber::new_number(42 as i32); + io::println(format!("%d", (&n).retain_count() as int)); + (&n).show();*/ + + let bar = CFString::from_static_string("Bar"); + let baz = CFString::from_static_string("Baz"); + let boo = CFString::from_static_string("Boo"); + let foo = CFString::from_static_string("Foo"); + let tru = CFBoolean::true_value(); + let n42 = number(42); + + let d = CFDictionary::from_CFType_pairs(&[ + (bar.as_CFType(), boo.as_CFType()), + (baz.as_CFType(), tru.as_CFType()), + (foo.as_CFType(), n42.as_CFType()), + ]); + + let (v1, v2) = d.get_keys_and_values(); + + assert!(v1 == &[bar.as_CFTypeRef(), baz.as_CFTypeRef(), foo.as_CFTypeRef()]); + assert!(v2 == &[boo.as_CFTypeRef(), tru.as_CFTypeRef(), n42.as_CFTypeRef()]); + } +} diff --git a/third_party/rust/core-foundation/src/number.rs b/third_party/rust/core-foundation/src/number.rs new file mode 100644 index 000000000000..771c75eb984c --- /dev/null +++ b/third_party/rust/core-foundation/src/number.rs @@ -0,0 +1,85 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Immutable numbers. + +use core_foundation_sys::base::{CFRelease, kCFAllocatorDefault}; +pub use core_foundation_sys::number::*; +use std::mem; + +use base::{TCFType}; + +/// An immutable numeric value. +pub struct CFNumber(CFNumberRef); + +impl Drop for CFNumber { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFNumber, CFNumberRef, CFNumberGetTypeID); + +// TODO(pcwalton): Floating point. +impl CFNumber { + #[inline] + pub fn from_i32(value: i32) -> CFNumber { + unsafe { + let number_ref = CFNumberCreate(kCFAllocatorDefault, + kCFNumberSInt32Type, + mem::transmute(&value)); + TCFType::wrap_under_create_rule(number_ref) + } + } + + #[inline] + pub fn to_i64(&self) -> Option { + unsafe { + let mut value: i64 = 0; + let ok = CFNumberGetValue(self.0, kCFNumberSInt64Type, mem::transmute(&mut value)); + if ok { Some(value) } else { None } + } + } + + #[inline] + pub fn to_f64(&self) -> Option { + unsafe { + let mut value: f64 = 0.0; + let ok = CFNumberGetValue(self.0, kCFNumberFloat64Type, mem::transmute(&mut value)); + if ok { Some(value) } else { None } + } + } + + #[inline] + pub fn from_i64(value: i64) -> CFNumber { + unsafe { + let number_ref = CFNumberCreate(kCFAllocatorDefault, + kCFNumberSInt64Type, + mem::transmute(&value)); + TCFType::wrap_under_create_rule(number_ref) + } + } + + #[inline] + pub fn from_f64(value: f64) -> CFNumber { + unsafe { + let number_ref = CFNumberCreate(kCFAllocatorDefault, + kCFNumberFloat64Type, + mem::transmute(&value)); + TCFType::wrap_under_create_rule(number_ref) + } + } +} + +/// A convenience function to create CFNumbers. +pub fn number(value: i64) -> CFNumber { + CFNumber::from_i64(value) +} diff --git a/third_party/rust/core-foundation/src/propertylist.rs b/third_party/rust/core-foundation/src/propertylist.rs new file mode 100644 index 000000000000..9b175fe4c310 --- /dev/null +++ b/third_party/rust/core-foundation/src/propertylist.rs @@ -0,0 +1,87 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Core Foundation property lists + +use std::ptr; + +use libc::c_void; + +use error::CFError; +use data::CFData; +use base::{TCFType}; + +pub use core_foundation_sys::propertylist::*; +use core_foundation_sys::error::CFErrorRef; +use core_foundation_sys::base::{kCFAllocatorDefault}; + +pub fn create_with_data(data: CFData, + options: CFPropertyListMutabilityOptions) + -> Result<(*const c_void, CFPropertyListFormat), CFError> { + unsafe { + let mut error: CFErrorRef = ptr::null_mut(); + let mut format: CFPropertyListFormat = 0; + let property_list = CFPropertyListCreateWithData(kCFAllocatorDefault, + data.as_concrete_TypeRef(), + options, + &mut format, + &mut error); + if property_list.is_null() { + Err(TCFType::wrap_under_create_rule(error)) + } else { + Ok((property_list, format)) + } + } +} + +pub fn create_data(property_list: *const c_void, format: CFPropertyListFormat) -> Result { + unsafe { + let mut error: CFErrorRef = ptr::null_mut(); + let data_ref = CFPropertyListCreateData(kCFAllocatorDefault, + property_list, + format, + 0, + &mut error); + if data_ref.is_null() { + Err(TCFType::wrap_under_create_rule(error)) + } else { + Ok(TCFType::wrap_under_create_rule(data_ref)) + } + } +} + +#[cfg(test)] +pub mod test { + #[test] + fn test_property_list_serialization() { + use base::{TCFType, CFEqual}; + use boolean::CFBoolean; + use number::number; + use dictionary::CFDictionary; + use string::CFString; + use super::*; + + let bar = CFString::from_static_string("Bar"); + let baz = CFString::from_static_string("Baz"); + let boo = CFString::from_static_string("Boo"); + let foo = CFString::from_static_string("Foo"); + let tru = CFBoolean::true_value(); + let n42 = number(42); + + let dict1 = CFDictionary::from_CFType_pairs(&[(bar.as_CFType(), boo.as_CFType()), + (baz.as_CFType(), tru.as_CFType()), + (foo.as_CFType(), n42.as_CFType())]); + + let data = create_data(dict1.as_CFTypeRef(), kCFPropertyListXMLFormat_v1_0).unwrap(); + let (dict2, _) = create_with_data(data, kCFPropertyListImmutable).unwrap(); + unsafe { + assert!(CFEqual(dict1.as_CFTypeRef(), dict2) == 1); + } + } +} diff --git a/third_party/rust/core-foundation/src/runloop.rs b/third_party/rust/core-foundation/src/runloop.rs new file mode 100644 index 000000000000..5655535858cf --- /dev/null +++ b/third_party/rust/core-foundation/src/runloop.rs @@ -0,0 +1,140 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_upper_case_globals)] + +pub use core_foundation_sys::runloop::*; +use core_foundation_sys::base::{CFIndex, CFRelease}; +use core_foundation_sys::base::{kCFAllocatorDefault, CFOptionFlags}; +use core_foundation_sys::string::CFStringRef; +use core_foundation_sys::date::{CFAbsoluteTime, CFTimeInterval}; + +use base::{TCFType}; +use string::{CFString}; + +pub struct CFRunLoop(CFRunLoopRef); + +impl Drop for CFRunLoop { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFRunLoop, CFRunLoopRef, CFRunLoopGetTypeID); + +impl CFRunLoop { + pub fn get_current() -> CFRunLoop { + unsafe { + let run_loop_ref = CFRunLoopGetCurrent(); + TCFType::wrap_under_get_rule(run_loop_ref) + } + } + + pub fn get_main() -> CFRunLoop { + unsafe { + let run_loop_ref = CFRunLoopGetMain(); + TCFType::wrap_under_get_rule(run_loop_ref) + } + } + + pub fn run_current() { + unsafe { + CFRunLoopRun(); + } + } + + pub fn stop(&self) { + unsafe { + CFRunLoopStop(self.0); + } + } + + pub fn current_mode(&self) -> Option { + unsafe { + let string_ref = CFRunLoopCopyCurrentMode(self.0); + if string_ref.is_null() { + return None; + } + + let cf_string: CFString = TCFType::wrap_under_create_rule(string_ref); + Some(cf_string.to_string()) + } + } + + pub fn contains_timer(&self, timer: &CFRunLoopTimer, mode: CFStringRef) -> bool { + unsafe { + CFRunLoopContainsTimer(self.0, timer.0, mode) != 0 + } + } + + pub fn add_timer(&self, timer: &CFRunLoopTimer, mode: CFStringRef) { + unsafe { + CFRunLoopAddTimer(self.0, timer.0, mode); + } + } + +} + +pub struct CFRunLoopTimer(CFRunLoopTimerRef); + +impl Drop for CFRunLoopTimer { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFRunLoopTimer, CFRunLoopTimerRef, CFRunLoopTimerGetTypeID); + +impl CFRunLoopTimer { + pub fn new(fireDate: CFAbsoluteTime, interval: CFTimeInterval, flags: CFOptionFlags, order: CFIndex, callout: CFRunLoopTimerCallBack, context: *mut CFRunLoopTimerContext) -> CFRunLoopTimer { + unsafe { + let timer_ref = CFRunLoopTimerCreate(kCFAllocatorDefault, fireDate, interval, flags, order, callout, context); + TCFType::wrap_under_create_rule(timer_ref) + } + } +} + +#[cfg(test)] +mod test { + use super::*; + use core_foundation_sys::date::{CFAbsoluteTime, CFAbsoluteTimeGetCurrent}; + use std::mem; + use libc::c_void; + + #[test] + fn wait_200_milliseconds() { + let run_loop = CFRunLoop::get_current(); + let mut now = unsafe { CFAbsoluteTimeGetCurrent() }; + let mut context = unsafe { CFRunLoopTimerContext { + version: 0, + info: mem::transmute(&mut now), + retain: mem::zeroed(), + release: mem::zeroed(), + copyDescription: mem::zeroed(), + } }; + + + let run_loop_timer = CFRunLoopTimer::new(now + 0.20f64, 0f64, 0, 0, timer_popped, &mut context); + run_loop.add_timer(&run_loop_timer, kCFRunLoopDefaultMode); + + CFRunLoop::run_current(); + } + + extern "C" fn timer_popped(_timer: CFRunLoopTimerRef, _info: *mut c_void) { + let previous_now_ptr: *const CFAbsoluteTime = unsafe { mem::transmute(_info) }; + let previous_now = unsafe { *previous_now_ptr }; + let now = unsafe { CFAbsoluteTimeGetCurrent() }; + assert!(now - previous_now > 0.19 && now - previous_now < 0.21); + CFRunLoop::get_current().stop(); + } +} diff --git a/third_party/rust/core-foundation/src/set.rs b/third_party/rust/core-foundation/src/set.rs new file mode 100644 index 000000000000..8224a20907c5 --- /dev/null +++ b/third_party/rust/core-foundation/src/set.rs @@ -0,0 +1,45 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! An immutable bag of elements. + +pub use core_foundation_sys::set::*; +use core_foundation_sys::base::CFRelease; +use core_foundation_sys::base::{CFTypeRef, kCFAllocatorDefault}; + +use base::{CFIndexConvertible, TCFType}; + +use std::mem; + +/// An immutable bag of elements. +pub struct CFSet(CFSetRef); + +impl Drop for CFSet { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFSet, CFSetRef, CFSetGetTypeID); + +impl CFSet { + /// Creates a new set from a list of `CFType` instances. + pub fn from_slice(elems: &[T]) -> CFSet where T: TCFType { + unsafe { + let elems: Vec = elems.iter().map(|elem| elem.as_CFTypeRef()).collect(); + let set_ref = CFSetCreate(kCFAllocatorDefault, + mem::transmute(elems.as_ptr()), + elems.len().to_CFIndex(), + &kCFTypeSetCallBacks); + TCFType::wrap_under_create_rule(set_ref) + } + } +} diff --git a/third_party/rust/core-foundation/src/string.rs b/third_party/rust/core-foundation/src/string.rs new file mode 100644 index 000000000000..051ca9a4e3b2 --- /dev/null +++ b/third_party/rust/core-foundation/src/string.rs @@ -0,0 +1,152 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Immutable strings. + +pub use core_foundation_sys::string::*; + +use base::{CFIndexConvertible, TCFType}; + +use core_foundation_sys::base::{Boolean, CFIndex, CFRange, CFRelease}; +use core_foundation_sys::base::{kCFAllocatorDefault, kCFAllocatorNull}; +use std::fmt; +use std::str::{self, FromStr}; +use std::ptr; +use std::ffi::CStr; + +/// An immutable string in one of a variety of encodings. +pub struct CFString(CFStringRef); + +impl Clone for CFString { + #[inline] + fn clone(&self) -> CFString { + unsafe { + TCFType::wrap_under_get_rule(self.0) + } + } +} + +impl Drop for CFString { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFString, CFStringRef, CFStringGetTypeID); + +impl FromStr for CFString { + type Err = (); + + /// See also CFString::new for a variant of this which does not return a Result + #[inline] + fn from_str(string: &str) -> Result { + Ok(CFString::new(string)) + } +} + +impl fmt::Display for CFString { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + unsafe { + // Do this without allocating if we can get away with it + let c_string = CFStringGetCStringPtr(self.0, kCFStringEncodingUTF8); + if c_string != ptr::null() { + let c_str = CStr::from_ptr(c_string); + fmt.write_str(str::from_utf8_unchecked(c_str.to_bytes())) + } else { + let char_len = self.char_len(); + + // First, ask how big the buffer ought to be. + let mut bytes_required: CFIndex = 0; + CFStringGetBytes(self.0, + CFRange { location: 0, length: char_len }, + kCFStringEncodingUTF8, + 0, + false as Boolean, + ptr::null_mut(), + 0, + &mut bytes_required); + + // Then, allocate the buffer and actually copy. + let mut buffer = vec![b'\x00'; bytes_required as usize]; + + let mut bytes_used: CFIndex = 0; + let chars_written = CFStringGetBytes(self.0, + CFRange { location: 0, length: char_len }, + kCFStringEncodingUTF8, + 0, + false as Boolean, + buffer.as_mut_ptr(), + buffer.len().to_CFIndex(), + &mut bytes_used) as usize; + assert!(chars_written.to_CFIndex() == char_len); + + // This is dangerous; we over-allocate and null-terminate the string (during + // initialization). + assert!(bytes_used == buffer.len().to_CFIndex()); + fmt.write_str(str::from_utf8_unchecked(&buffer)) + } + } + } +} + +impl fmt::Debug for CFString { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "\"{}\"", self) + } +} + + +impl CFString { + /// Creates a new `CFString` instance from a Rust string. + #[inline] + pub fn new(string: &str) -> CFString { + unsafe { + let string_ref = CFStringCreateWithBytes(kCFAllocatorDefault, + string.as_ptr(), + string.len().to_CFIndex(), + kCFStringEncodingUTF8, + false as Boolean, + kCFAllocatorNull); + CFString::wrap_under_create_rule(string_ref) + } + } + + /// Like `CFString::new`, but references a string that can be used as a backing store + /// by virtue of being statically allocated. + #[inline] + pub fn from_static_string(string: &'static str) -> CFString { + unsafe { + let string_ref = CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, + string.as_ptr(), + string.len().to_CFIndex(), + kCFStringEncodingUTF8, + false as Boolean, + kCFAllocatorNull); + TCFType::wrap_under_create_rule(string_ref) + } + } + + /// Returns the number of characters in the string. + #[inline] + pub fn char_len(&self) -> CFIndex { + unsafe { + CFStringGetLength(self.0) + } + } +} + +#[test] +fn string_and_back() { + let original = "The quick brown fox jumped over the slow lazy dog."; + let cfstr = CFString::from_static_string(original); + let converted = cfstr.to_string(); + assert!(converted == original); +} diff --git a/third_party/rust/core-foundation/src/url.rs b/third_party/rust/core-foundation/src/url.rs new file mode 100644 index 000000000000..bf2bc1e0e191 --- /dev/null +++ b/third_party/rust/core-foundation/src/url.rs @@ -0,0 +1,63 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A URL type for Core Foundation. + +pub use core_foundation_sys::url::*; + +use base::{TCFType}; +use string::{CFString}; + +use core_foundation_sys::base::{kCFAllocatorDefault, CFRelease}; +use std::fmt; + +pub struct CFURL(CFURLRef); + +impl Drop for CFURL { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl_TCFType!(CFURL, CFURLRef, CFURLGetTypeID); + +impl fmt::Debug for CFURL { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + unsafe { + let string: CFString = TCFType::wrap_under_get_rule(CFURLGetString(self.0)); + write!(f, "{}", string.to_string()) + } + } +} + +impl CFURL { + pub fn from_file_system_path(filePath: CFString, pathStyle: CFURLPathStyle, isDirectory: bool) -> CFURL { + unsafe { + let url_ref = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, filePath.as_concrete_TypeRef(), pathStyle, isDirectory as u8); + TCFType::wrap_under_create_rule(url_ref) + } + } + + pub fn get_string(&self) -> CFString { + unsafe { + TCFType::wrap_under_get_rule(CFURLGetString(self.0)) + } + } +} + +#[test] +fn file_url_from_path() { + let path = "/usr/local/foo/"; + let cfstr_path = CFString::from_static_string(path); + let cfurl = CFURL::from_file_system_path(cfstr_path, kCFURLPOSIXPathStyle, true); + assert!(cfurl.get_string().to_string() == "file:///usr/local/foo/"); +} diff --git a/third_party/rust/core-graphics/.cargo-checksum.json b/third_party/rust/core-graphics/.cargo-checksum.json new file mode 100644 index 000000000000..d79621172e4d --- /dev/null +++ b/third_party/rust/core-graphics/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"d0114f648b7f61e473b61c6d682fefaa4e3fadf2101aff056e2ffc52e9229d87",".travis.yml":"b71b9a6f84b9263b2b89be6ec90dff5920ee68cf9e5768d73ed71957de2d0670","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"369e564eec78780281f752fa17783b729951c2d703e1dce0f234f8c81ab79d24","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"3f3d5d69bd79b146cc3c0402de6260f7531c04e6a44b080f4ec7c8cedebd1337","src/color_space.rs":"7d447e774e85cc33de574637a93c9a8550b681c8d4b94e99f95261ea9740e288","src/context.rs":"7c764ffde2e0ebaecd30ced31ece29f82ddea2f3c8145f4ea59882df38fec0d2","src/data_provider.rs":"899a5762ea472b828e1726e1cefc8d2dbd237772ce171cf6b31a79f144ce8df1","src/display.rs":"906cbcb13f8214308a6afcfb3abdd04e409f48ce62673574d40087486f38b36d","src/event.rs":"7f25a98207f200f10717c2765179ece8ba02600767b7c194c49854e7bfaa470c","src/event_source.rs":"6d1c1378dab8988c46dd3bf20639913716418980b9b490a37a0d5120c60ad580","src/font.rs":"635ee3d1039c807e00fe93b974c9e375c532f09c99322dd93b9496783a662c0a","src/geometry.rs":"9f59dcf55f393a3fa001afe8aea68a85a3c9a06239aeafe6da5d2823ed37b271","src/lib.rs":"efed3638b05e6a806a6fa0c544893afeec931f6c6889bd4a69d8fd2f9838967f","src/private.rs":"87c96ed2002bd567bf02535b4c6e8e3f22827afb2dd92ee17d91cfb45bc6072c"},"package":"8bd94d0f0b2bbcbfeeb670fc48654afde7a13c2c551ca9d2b9a6cfafdafe1a64"} \ No newline at end of file diff --git a/third_party/rust/core-graphics/.cargo-ok b/third_party/rust/core-graphics/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/core-graphics/.gitignore b/third_party/rust/core-graphics/.gitignore new file mode 100644 index 000000000000..c34fbd05160e --- /dev/null +++ b/third_party/rust/core-graphics/.gitignore @@ -0,0 +1,14 @@ +*~ +*# +*.o +*.a +*.so +*.dylib +*.dSYM +*.dll +*.dummy +cocoa-test +build +/target +/doc +/Cargo.lock diff --git a/third_party/rust/core-graphics/.travis.yml b/third_party/rust/core-graphics/.travis.yml new file mode 100644 index 000000000000..f741543bbb4e --- /dev/null +++ b/third_party/rust/core-graphics/.travis.yml @@ -0,0 +1,13 @@ +language: rust +os: osx +rust: + - nightly + - beta + - stable + +script: + - cargo test + - cargo test --features="elcapitan" + +notifications: + webhooks: http://build.servo.org:54856/travis diff --git a/third_party/rust/core-graphics/COPYRIGHT b/third_party/rust/core-graphics/COPYRIGHT new file mode 100644 index 000000000000..8b7291ad281c --- /dev/null +++ b/third_party/rust/core-graphics/COPYRIGHT @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 or the MIT license +, at your +option. All files in the project carrying such notice may not be +copied, modified, or distributed except according to those terms. diff --git a/third_party/rust/core-graphics/Cargo.toml b/third_party/rust/core-graphics/Cargo.toml new file mode 100644 index 000000000000..18d4f615c50a --- /dev/null +++ b/third_party/rust/core-graphics/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "core-graphics" +description = "Bindings to Core Graphics for OS X" +homepage = "https://github.com/servo/core-graphics-rs" +repository = "https://github.com/servo/core-graphics-rs" +version = "0.5.0" +authors = ["The Servo Project Developers"] +license = "MIT / Apache-2.0" + +[features] +default = [] +elcapitan = [] + +[dependencies] +libc = "0.2" +core-foundation = "0.2" +serde = "0.8" diff --git a/third_party/rust/core-graphics/LICENSE-APACHE b/third_party/rust/core-graphics/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/core-graphics/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/core-graphics/LICENSE-MIT b/third_party/rust/core-graphics/LICENSE-MIT new file mode 100644 index 000000000000..807526f57f3a --- /dev/null +++ b/third_party/rust/core-graphics/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2012-2013 Mozilla Foundation + +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. diff --git a/third_party/rust/core-graphics/README.md b/third_party/rust/core-graphics/README.md new file mode 100644 index 000000000000..a23522df9533 --- /dev/null +++ b/third_party/rust/core-graphics/README.md @@ -0,0 +1,3 @@ +# core-graphics-rs + +[![Build Status](https://travis-ci.org/servo/core-graphics-rs.svg?branch=master)](https://travis-ci.org/servo/core-graphics-rs) diff --git a/third_party/rust/core-graphics/src/base.rs b/third_party/rust/core-graphics/src/base.rs new file mode 100644 index 000000000000..9cfb0a902e91 --- /dev/null +++ b/third_party/rust/core-graphics/src/base.rs @@ -0,0 +1,55 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// this file defines CGFloat, as well as stubbed data types. + +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +use libc; + +#[cfg(any(target_arch = "x86", + target_arch = "arm", + target_arch = "aarch64"))] +pub type boolean_t = libc::c_int; +#[cfg(target_arch = "x86_64")] +pub type boolean_t = libc::c_uint; + +#[cfg(target_pointer_width = "64")] +pub type CGFloat = libc::c_double; +#[cfg(not(target_pointer_width = "64"))] +pub type CGFloat = libc::c_float; + +pub type CGError = libc::int32_t; + +pub type CGAffineTransform = (); + +pub const kCGImageAlphaNone: u32 = 0; +pub const kCGImageAlphaPremultipliedLast: u32 = 1; +pub const kCGImageAlphaPremultipliedFirst: u32 = 2; +pub const kCGImageAlphaLast: u32 = 3; +pub const kCGImageAlphaFirst: u32 = 4; +pub const kCGImageAlphaNoneSkipLast: u32 = 5; +pub const kCGImageAlphaNoneSkipFirst: u32 = 6; + +pub const kCGBitmapByteOrderDefault: u32 = (0 << 12); +pub const kCGBitmapByteOrder16Little: u32 = (1 << 12); +pub const kCGBitmapByteOrder32Little: u32 = (2 << 12); +pub const kCGBitmapByteOrder16Big: u32 = (3 << 12); +pub const kCGBitmapByteOrder32Big: u32 = (4 << 12); + +#[cfg(target_endian = "big")] +pub const kCGBitmapByteOrder16Host: u32 = kCGBitmapByteOrder16Big; +#[cfg(target_endian = "big")] +pub const kCGBitmapByteOrder32Host: u32 = kCGBitmapByteOrder32Big; + +#[cfg(target_endian = "little")] +pub const kCGBitmapByteOrder16Host: u32 = kCGBitmapByteOrder16Little; +#[cfg(target_endian = "little")] +pub const kCGBitmapByteOrder32Host: u32 = kCGBitmapByteOrder32Little; diff --git a/third_party/rust/core-graphics/src/color_space.rs b/third_party/rust/core-graphics/src/color_space.rs new file mode 100644 index 000000000000..10a728a89547 --- /dev/null +++ b/third_party/rust/core-graphics/src/color_space.rs @@ -0,0 +1,86 @@ +// Copyright 2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; +use std::mem; + +#[repr(C)] +pub struct __CGColorSpace; + +pub type CGColorSpaceRef = *const __CGColorSpace; + +pub struct CGColorSpace { + obj: CGColorSpaceRef, +} + +impl Drop for CGColorSpace { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl Clone for CGColorSpace { + fn clone(&self) -> CGColorSpace { + unsafe { + TCFType::wrap_under_get_rule(self.as_concrete_TypeRef()) + } + } +} + +impl TCFType for CGColorSpace { + #[inline] + fn as_concrete_TypeRef(&self) -> CGColorSpaceRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CGColorSpaceRef) -> CGColorSpace { + let reference: CGColorSpaceRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CGColorSpaceRef) -> CGColorSpace { + CGColorSpace { + obj: obj, + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CGColorSpaceGetTypeID() + } + } +} + +impl CGColorSpace { + pub fn create_device_rgb() -> CGColorSpace { + unsafe { + let result = CGColorSpaceCreateDeviceRGB(); + TCFType::wrap_under_create_rule(result) + } + } +} + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + fn CGColorSpaceCreateDeviceRGB() -> CGColorSpaceRef; + fn CGColorSpaceGetTypeID() -> CFTypeID; +} + diff --git a/third_party/rust/core-graphics/src/context.rs b/third_party/rust/core-graphics/src/context.rs new file mode 100644 index 000000000000..ffb8a160efa5 --- /dev/null +++ b/third_party/rust/core-graphics/src/context.rs @@ -0,0 +1,238 @@ +// Copyright 2015 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use base::CGFloat; +use color_space::{CGColorSpace, CGColorSpaceRef}; +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; +use libc::{c_void, size_t}; +use std::mem; +use std::ptr; +use std::slice; +use geometry::CGRect; + +#[repr(C)] +pub enum CGTextDrawingMode { + CGTextFill, + CGTextStroke, + CGTextFillStroke, + CGTextInvisible, + CGTextFillClip, + CGTextStrokeClip, + CGTextClip +} + +#[repr(C)] +pub struct __CGContext; + +pub type CGContextRef = *const __CGContext; + +pub struct CGContext { + obj: CGContextRef, +} + +impl Drop for CGContext { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl Clone for CGContext { + fn clone(&self) -> CGContext { + unsafe { + TCFType::wrap_under_get_rule(self.as_concrete_TypeRef()) + } + } +} + +impl TCFType for CGContext { + #[inline] + fn as_concrete_TypeRef(&self) -> CGContextRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CGContextRef) -> CGContext { + let reference: CGContextRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CGContextRef) -> CGContext { + CGContext { + obj: obj, + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CGContextGetTypeID() + } + } +} + +impl CGContext { + pub fn create_bitmap_context(width: size_t, + height: size_t, + bits_per_component: size_t, + bytes_per_row: size_t, + space: &CGColorSpace, + bitmap_info: u32) + -> CGContext { + unsafe { + let result = CGBitmapContextCreate(ptr::null_mut(), + width, + height, + bits_per_component, + bytes_per_row, + space.as_concrete_TypeRef(), + bitmap_info); + TCFType::wrap_under_create_rule(result) + } + } + + pub fn data(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut( + CGBitmapContextGetData(self.as_concrete_TypeRef()) as *mut u8, + (self.height() * self.bytes_per_row()) as usize) + } + } + + pub fn width(&self) -> size_t { + unsafe { + CGBitmapContextGetWidth(self.as_concrete_TypeRef()) + } + } + + pub fn height(&self) -> size_t { + unsafe { + CGBitmapContextGetHeight(self.as_concrete_TypeRef()) + } + } + + pub fn bytes_per_row(&self) -> size_t { + unsafe { + CGBitmapContextGetBytesPerRow(self.as_concrete_TypeRef()) + } + } + + pub fn set_rgb_fill_color(&self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) { + unsafe { + CGContextSetRGBFillColor(self.as_concrete_TypeRef(), red, green, blue, alpha) + } + } + + pub fn set_allows_font_smoothing(&self, allows_font_smoothing: bool) { + unsafe { + CGContextSetAllowsFontSmoothing(self.as_concrete_TypeRef(), allows_font_smoothing) + } + } + + pub fn set_should_smooth_fonts(&self, should_smooth_fonts: bool) { + unsafe { + CGContextSetShouldSmoothFonts(self.as_concrete_TypeRef(), should_smooth_fonts) + } + } + + pub fn set_allows_antialiasing(&self, allows_antialiasing: bool) { + unsafe { + CGContextSetAllowsAntialiasing(self.as_concrete_TypeRef(), allows_antialiasing) + } + } + + pub fn set_should_antialias(&self, should_antialias: bool) { + unsafe { + CGContextSetShouldAntialias(self.as_concrete_TypeRef(), should_antialias) + } + } + + pub fn set_allows_font_subpixel_quantization(&self, allows_font_subpixel_quantization: bool) { + unsafe { + CGContextSetAllowsFontSubpixelQuantization(self.as_concrete_TypeRef(), allows_font_subpixel_quantization) + } + } + + pub fn set_should_subpixel_quantize_fonts(&self, should_subpixel_quantize_fonts: bool) { + unsafe { + CGContextSetShouldSubpixelQuantizeFonts(self.as_concrete_TypeRef(), should_subpixel_quantize_fonts) + } + } + + pub fn set_allows_font_subpixel_positioning(&self, allows_font_subpixel_positioning: bool) { + unsafe { + CGContextSetAllowsFontSubpixelPositioning(self.as_concrete_TypeRef(), allows_font_subpixel_positioning) + } + } + + pub fn set_should_subpixel_position_fonts(&self, should_subpixel_position_fonts: bool) { + unsafe { + CGContextSetShouldSubpixelPositionFonts(self.as_concrete_TypeRef(), should_subpixel_position_fonts) + } + } + + pub fn set_text_drawing_mode(&self, mode: CGTextDrawingMode) { + unsafe { + CGContextSetTextDrawingMode(self.as_concrete_TypeRef(), mode) + } + } + + pub fn fill_rect(&self, rect: CGRect) { + unsafe { + CGContextFillRect(self.as_concrete_TypeRef(), rect) + } + } +} + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + fn CGBitmapContextCreate(data: *mut c_void, + width: size_t, + height: size_t, + bitsPerComponent: size_t, + bytesPerRow: size_t, + space: CGColorSpaceRef, + bitmapInfo: u32) + -> CGContextRef; + fn CGBitmapContextGetData(context: CGContextRef) -> *mut c_void; + fn CGBitmapContextGetWidth(context: CGContextRef) -> size_t; + fn CGBitmapContextGetHeight(context: CGContextRef) -> size_t; + fn CGBitmapContextGetBytesPerRow(context: CGContextRef) -> size_t; + fn CGContextGetTypeID() -> CFTypeID; + fn CGContextSetAllowsFontSmoothing(c: CGContextRef, allowsFontSmoothing: bool); + fn CGContextSetShouldSmoothFonts(c: CGContextRef, shouldSmoothFonts: bool); + fn CGContextSetAllowsAntialiasing(c: CGContextRef, allowsAntialiasing: bool); + fn CGContextSetShouldAntialias(c: CGContextRef, shouldAntialias: bool); + fn CGContextSetAllowsFontSubpixelQuantization(c: CGContextRef, + allowsFontSubpixelQuantization: bool); + fn CGContextSetShouldSubpixelQuantizeFonts(c: CGContextRef, + shouldSubpixelQuantizeFonts: bool); + fn CGContextSetAllowsFontSubpixelPositioning(c: CGContextRef, + allowsFontSubpixelPositioning: bool); + fn CGContextSetShouldSubpixelPositionFonts(c: CGContextRef, + shouldSubpixelPositionFonts: bool); + fn CGContextSetTextDrawingMode(c: CGContextRef, mode: CGTextDrawingMode); + fn CGContextSetRGBFillColor(context: CGContextRef, + red: CGFloat, + green: CGFloat, + blue: CGFloat, + alpha: CGFloat); + fn CGContextFillRect(context: CGContextRef, + rect: CGRect); +} + diff --git a/third_party/rust/core-graphics/src/data_provider.rs b/third_party/rust/core-graphics/src/data_provider.rs new file mode 100644 index 000000000000..fe449a29c93e --- /dev/null +++ b/third_party/rust/core-graphics/src/data_provider.rs @@ -0,0 +1,107 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; + +use libc::{c_void, size_t}; +use std::mem; +use std::ptr; + +pub type CGDataProviderGetBytesCallback = *const u8; +pub type CGDataProviderReleaseInfoCallback = *const u8; +pub type CGDataProviderRewindCallback = *const u8; +pub type CGDataProviderSkipBytesCallback = *const u8; +pub type CGDataProviderSkipForwardCallback = *const u8; + +pub type CGDataProviderGetBytePointerCallback = *const u8; +pub type CGDataProviderGetBytesAtOffsetCallback = *const u8; +pub type CGDataProviderReleaseBytePointerCallback = *const u8; +pub type CGDataProviderReleaseDataCallback = *const u8; +pub type CGDataProviderGetBytesAtPositionCallback = *const u8; + +#[repr(C)] +pub struct __CGDataProvider; + +pub type CGDataProviderRef = *const __CGDataProvider; + +pub struct CGDataProvider { + obj: CGDataProviderRef, +} + +impl Drop for CGDataProvider { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl TCFType for CGDataProvider { + #[inline] + fn as_concrete_TypeRef(&self) -> CGDataProviderRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CGDataProviderRef) -> CGDataProvider { + let reference: CGDataProviderRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CGDataProviderRef) -> CGDataProvider { + CGDataProvider { + obj: obj, + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CGDataProviderGetTypeID() + } + } +} + +impl CGDataProvider { + pub fn from_buffer(buffer: &[u8]) -> CGDataProvider { + unsafe { + let result = CGDataProviderCreateWithData(ptr::null_mut(), + buffer.as_ptr() as *const c_void, + buffer.len() as size_t, + ptr::null()); + TCFType::wrap_under_create_rule(result) + } + } +} + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + //fn CGDataProviderCopyData + //fn CGDataProviderCreateDirect + //fn CGDataProviderCreateSequential + //fn CGDataProviderCreateWithCFData + fn CGDataProviderCreateWithData(info: *mut c_void, + data: *const c_void, + size: size_t, + releaseData: CGDataProviderReleaseDataCallback + ) -> CGDataProviderRef; + //fn CGDataProviderCreateWithFilename(filename: *c_char) -> CGDataProviderRef; + //fn CGDataProviderCreateWithURL + fn CGDataProviderGetTypeID() -> CFTypeID; + //fn CGDataProviderRelease(provider: CGDataProviderRef); + //fn CGDataProviderRetain(provider: CGDataProviderRef) -> CGDataProviderRef; +} diff --git a/third_party/rust/core-graphics/src/display.rs b/third_party/rust/core-graphics/src/display.rs new file mode 100644 index 000000000000..491e277ca837 --- /dev/null +++ b/third_party/rust/core-graphics/src/display.rs @@ -0,0 +1,77 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_upper_case_globals)] + +extern crate core_foundation; + +use libc; +pub use base::{CGError, boolean_t}; +pub use geometry::{CGRect, CGPoint, CGSize}; + +pub type CGDirectDisplayID = libc::uint32_t; +pub type CGWindowID = libc::uint32_t; + +pub const kCGNullWindowID: CGWindowID = 0 as CGWindowID; + + +pub type CGWindowListOption = libc::uint32_t; + +pub const kCGWindowListOptionAll: CGWindowListOption = 0; +pub const kCGWindowListOptionOnScreenOnly: CGWindowListOption = 1 << 0; +pub const kCGWindowListOptionOnScreenAboveWindow: CGWindowListOption = 1 << 1; +pub const kCGWindowListOptionOnScreenBelowWindow: CGWindowListOption = 1 << 2; +pub const kCGWindowListOptionIncludingWindow: CGWindowListOption = 1 << 3; +pub const kCGWindowListExcludeDesktopElements: CGWindowListOption = 1 << 4; + + +pub use core_foundation::dictionary::{ CFDictionary, CFDictionaryRef, CFDictionaryGetValueIfPresent }; +pub use core_foundation::array::{ CFArray, CFArrayRef }; +pub use core_foundation::array::{ CFArrayGetCount, CFArrayGetValueAtIndex }; +pub use core_foundation::base::{ CFIndex, CFRelease, CFTypeRef }; + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + pub fn CGMainDisplayID() -> CGDirectDisplayID; + pub fn CGDisplayIsActive(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsAsleep(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsBuiltin(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsInHWMirrorSet(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsInMirrorSet(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsMain(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsOnline(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayIsStereo(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayMirrorsDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID; + pub fn CGDisplayPrimaryDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID; + pub fn CGDisplayRotation(display: CGDirectDisplayID) -> libc::c_double; + pub fn CGDisplayScreenSize(display: CGDirectDisplayID) -> CGSize; + pub fn CGDisplaySerialNumber(display: CGDirectDisplayID) -> libc::uint32_t; + pub fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> libc::uint32_t; + pub fn CGDisplayUsesOpenGLAcceleration(display: CGDirectDisplayID) -> boolean_t; + pub fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> libc::uint32_t; + pub fn CGGetActiveDisplayList(max_displays: libc::uint32_t, + active_displays: *mut CGDirectDisplayID, + display_count: *mut libc::uint32_t) -> CGError; + pub fn CGDisplayModelNumber(display: CGDirectDisplayID) -> libc::uint32_t; + pub fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> libc::size_t; + pub fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> libc::size_t; + pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect; + + // mouse stuff + pub fn CGDisplayHideCursor(display: CGDirectDisplayID) -> CGError; + pub fn CGDisplayShowCursor(display: CGDirectDisplayID) -> CGError; + pub fn CGDisplayMoveCursorToPoint(display: CGDirectDisplayID, point: CGPoint) -> CGError; + pub fn CGWarpMouseCursorPosition(point: CGPoint) -> CGError; + pub fn CGAssociateMouseAndMouseCursorPosition(connected: bool) -> CGError; + + // Window Services Reference + pub fn CGWindowListCopyWindowInfo(option: CGWindowListOption, relativeToWindow: CGWindowID ) -> CFArrayRef; + +} diff --git a/third_party/rust/core-graphics/src/event.rs b/third_party/rust/core-graphics/src/event.rs new file mode 100644 index 000000000000..f68b8a7783ba --- /dev/null +++ b/third_party/rust/core-graphics/src/event.rs @@ -0,0 +1,285 @@ +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; +use geometry::CGPoint; +use event_source::{CGEventSource,CGEventSourceRef}; + +use libc; +use std::mem; +use std::ptr; + +pub type CGKeyCode = libc::uint16_t; + +/// Flags for events +/// +/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h) +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub enum CGEventFlags { + // Device-independent modifier key bits. + AlphaShift = 0x00010000, + Shift = 0x00020000, + Control = 0x00040000, + Alternate = 0x00080000, + Command = 0x00100000, + + // Special key identifiers. + Help = 0x00400000, + SecondaryFn = 0x00800000, + + // Identifies key events from numeric keypad area on extended keyboards. + NumericPad = 0x00200000, + + // Indicates if mouse/pen movement events are not being coalesced + NonCoalesced = 0x00000100, +} + +/// Constants that specify the different types of input events. +/// +/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h) +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub enum CGEventType { + Null = 1 << 0, + + // Mouse events. + LeftMouseDown = 1 << 1, + LeftMouseUp = 1 << 2, + RightMouseDown = 1 << 3, + RightMouseUp = 1 << 4, + MouseMoved = 1 << 5, + LeftMouseDragged = 1 << 6, + RightMouseDragged = 1 << 7, + + // Keyboard events. + KeyDown = 1 << 10, + KeyUp = 1 << 11, + FlagsChanged = 1 << 12, + + // Specialized control devices. + ScrollWheel = 1 << 22, + TabletPointer = 1 << 23, + TabletProximity = 1 << 24, + OtherMouseDown = 1 << 25, + OtherMouseUp = 1 << 26, + OtherMouseDragged = 1 << 27, + + // Out of band event types. These are delivered to the event tap callback + // to notify it of unusual conditions that disable the event tap. + TapDisabledByTimeout = 0xFFFFFFFE, + TapDisabledByUserInput = 0xFFFFFFFF, +} + +// Constants that specify buttons on a one, two, or three-button mouse. +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub enum CGMouseButton { + Left, + Right, + Center, +} + +/// Possible tapping points for events. +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub enum CGEventTapLocation { + HID, + Session, + AnnotatedSession, +} + +#[repr(C)] +pub struct __CGEvent; + +pub type CGEventRef = *const __CGEvent; + +pub struct CGEvent { + obj: CGEventRef, +} + +impl Clone for CGEvent { + #[inline] + fn clone(&self) -> CGEvent { + unsafe { + TCFType::wrap_under_get_rule(self.obj) + } + } +} + +impl Drop for CGEvent { + fn drop(&mut self) { + unsafe { + let ptr = self.as_CFTypeRef(); + assert!(ptr != ptr::null()); + CFRelease(ptr); + } + } +} + +impl TCFType for CGEvent { + #[inline] + fn as_concrete_TypeRef(&self) -> CGEventRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CGEventRef) -> CGEvent { + let reference: CGEventRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CGEventRef) -> CGEvent { + CGEvent { + obj: obj, + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CGEventGetTypeID() + } + } +} + +impl CGEvent { + pub fn new(source: CGEventSource) -> Result { + unsafe { + let event_ref = CGEventCreate(source.as_concrete_TypeRef()); + if event_ref != ptr::null() { + Ok(TCFType::wrap_under_create_rule(event_ref)) + } else { + Err(()) + } + } + } + + pub fn new_keyboard_event( + source: CGEventSource, + keycode: CGKeyCode, + keydown: bool + ) -> Result { + unsafe { + let event_ref = CGEventCreateKeyboardEvent(source.as_concrete_TypeRef(), keycode, keydown); + if event_ref != ptr::null() { + Ok(TCFType::wrap_under_create_rule(event_ref)) + } else { + Err(()) + } + } + } + + pub fn new_mouse_event( + source: CGEventSource, + mouse_type: CGEventType, + mouse_cursor_position: CGPoint, + mouse_button: CGMouseButton + ) -> Result { + unsafe { + let event_ref = CGEventCreateMouseEvent(source.as_concrete_TypeRef(), mouse_type, + mouse_cursor_position, mouse_button); + if event_ref != ptr::null() { + Ok(TCFType::wrap_under_create_rule(event_ref)) + } else { + Err(()) + } + } + } + + pub fn post(&self, tap_location: CGEventTapLocation) { + unsafe { + CGEventPost(tap_location, self.as_concrete_TypeRef()); + } + } + + pub fn location(&self) -> CGPoint { + unsafe { + CGEventGetLocation(self.as_concrete_TypeRef()) + } + } + + #[cfg(feature = "elcapitan")] + pub fn post_to_pid(&self, pid: libc::pid_t) { + unsafe { + CGEventPostToPid(pid, self.as_concrete_TypeRef()); + } + } + + pub fn set_flags(&self, flags: CGEventFlags) { + unsafe { + CGEventSetFlags(self.as_concrete_TypeRef(), flags); + } + } + + pub fn get_flags(&self) -> CGEventFlags { + unsafe { + CGEventGetFlags(self.as_concrete_TypeRef()) + } + } +} + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + /// Return the type identifier for the opaque type `CGEventRef'. + fn CGEventGetTypeID() -> CFTypeID; + + /// Return a new event using the event source `source'. If `source' is NULL, + /// the default source is used. + fn CGEventCreate(source: CGEventSourceRef) -> CGEventRef; + + /// Return a new keyboard event. + /// + /// The event source may be taken from another event, or may be NULL. Based + /// on the virtual key code values entered, the appropriate key down, key up, + /// or flags changed events are generated. + /// + /// All keystrokes needed to generate a character must be entered, including + /// SHIFT, CONTROL, OPTION, and COMMAND keys. For example, to produce a 'Z', + /// the SHIFT key must be down, the 'z' key must go down, and then the SHIFT + /// and 'z' key must be released: + fn CGEventCreateKeyboardEvent(source: CGEventSourceRef, keycode: CGKeyCode, + keydown: bool) -> CGEventRef; + + /// Return a new mouse event. + /// + /// The event source may be taken from another event, or may be NULL. + /// `mouseType' should be one of the mouse event types. `mouseCursorPosition' + /// should be the position of the mouse cursor in global coordinates. + /// `mouseButton' should be the button that's changing state; `mouseButton' + /// is ignored unless `mouseType' is one of `kCGEventOtherMouseDown', + /// `kCGEventOtherMouseDragged', or `kCGEventOtherMouseUp'. + /// + /// The current implemementation of the event system supports a maximum of + /// thirty-two buttons. Mouse button 0 is the primary button on the mouse. + /// Mouse button 1 is the secondary mouse button (right). Mouse button 2 is + /// the center button, and the remaining buttons are in USB device order. + fn CGEventCreateMouseEvent(source: CGEventSourceRef, mouseType: CGEventType, + mouseCursorPosition: CGPoint, mouseButton: CGMouseButton) -> CGEventRef; + + /// Post an event into the event stream at a specified location. + /// + /// This function posts the specified event immediately before any event taps + /// instantiated for that location, and the event passes through any such + /// taps. + fn CGEventPost(tapLocation: CGEventTapLocation, event: CGEventRef); + + #[cfg(feature = "elcapitan")] + /// Post an event to a specified process ID + fn CGEventPostToPid(pid: libc::pid_t, event: CGEventRef); + + /// Set the event flags of an event. + fn CGEventSetFlags(event: CGEventRef, flags: CGEventFlags); + + /// Return the event flags of an event. + fn CGEventGetFlags(event: CGEventRef) -> CGEventFlags; + + /// Return the location of an event in global display coordinates. + /// CGPointZero is returned if event is not a valid CGEventRef. + fn CGEventGetLocation(event: CGEventRef) -> CGPoint; +} diff --git a/third_party/rust/core-graphics/src/event_source.rs b/third_party/rust/core-graphics/src/event_source.rs new file mode 100644 index 000000000000..32bbaefbbb10 --- /dev/null +++ b/third_party/rust/core-graphics/src/event_source.rs @@ -0,0 +1,97 @@ +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; + +use std::mem; +use std::ptr; + +/// Possible source states of an event source. +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub enum CGEventSourceStateID { + Private = -1, + CombinedSessionState = 0, + HIDSystemState = 1, +} + +#[repr(C)] +pub struct __CGEventSource; + +pub type CGEventSourceRef = *const __CGEventSource; + +pub struct CGEventSource { + obj: CGEventSourceRef, +} + +impl Clone for CGEventSource { + #[inline] + fn clone(&self) -> CGEventSource { + unsafe { + TCFType::wrap_under_get_rule(self.obj) + } + } +} + +impl Drop for CGEventSource { + fn drop(&mut self) { + unsafe { + let ptr = self.as_CFTypeRef(); + assert!(ptr != ptr::null()); + CFRelease(ptr); + } + } +} + +impl TCFType for CGEventSource { + #[inline] + fn as_concrete_TypeRef(&self) -> CGEventSourceRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CGEventSourceRef) -> CGEventSource { + let reference: CGEventSourceRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CGEventSourceRef) -> CGEventSource { + CGEventSource { + obj: obj, + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CGEventSourceGetTypeID() + } + } +} + +impl CGEventSource { + pub fn new(state_id: CGEventSourceStateID) -> Result { + unsafe { + let event_source_ref = CGEventSourceCreate(state_id); + if event_source_ref != ptr::null() { + Ok(TCFType::wrap_under_create_rule(event_source_ref)) + } else { + Err(()) + } + } + } +} + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + /// Return the type identifier for the opaque type `CGEventSourceRef'. + fn CGEventSourceGetTypeID() -> CFTypeID; + + /// Return a Quartz event source created with a specified source state. + fn CGEventSourceCreate(stateID: CGEventSourceStateID) -> CGEventSourceRef; +} diff --git a/third_party/rust/core-graphics/src/font.rs b/third_party/rust/core-graphics/src/font.rs new file mode 100644 index 000000000000..e3e270062606 --- /dev/null +++ b/third_party/rust/core-graphics/src/font.rs @@ -0,0 +1,147 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; +use core_foundation::string::{CFString, CFStringRef}; +use data_provider::{CGDataProvider, CGDataProviderRef}; + +use libc; +use serde::de::{self, Deserialize, Deserializer}; +use serde::ser::{Serialize, Serializer}; +use std::mem; +use std::ptr; + +pub type CGGlyph = libc::c_ushort; + +#[repr(C)] +pub struct __CGFont; + +pub type CGFontRef = *const __CGFont; + +pub struct CGFont { + obj: CGFontRef, +} + +unsafe impl Send for CGFont {} +unsafe impl Sync for CGFont {} + +impl Serialize for CGFont { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer { + let postscript_name = self.postscript_name().to_string(); + postscript_name.serialize(serializer) + } +} + +impl Deserialize for CGFont { + fn deserialize(deserializer: &mut D) -> Result where D: Deserializer { + let postscript_name: String = try!(Deserialize::deserialize(deserializer)); + CGFont::from_name(&CFString::new(&*postscript_name)).map_err(|_| { + de::Error::invalid_value("Couldn't find a font with that PostScript name!") + }) + } +} + +impl Clone for CGFont { + #[inline] + fn clone(&self) -> CGFont { + unsafe { + TCFType::wrap_under_get_rule(self.obj) + } + } +} + +impl Drop for CGFont { + fn drop(&mut self) { + unsafe { + let ptr = self.as_CFTypeRef(); + assert!(ptr != ptr::null()); + CFRelease(ptr); + } + } +} + +impl TCFType for CGFont { + #[inline] + fn as_concrete_TypeRef(&self) -> CGFontRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CGFontRef) -> CGFont { + let reference: CGFontRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CGFontRef) -> CGFont { + CGFont { + obj: obj, + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CGFontGetTypeID() + } + } +} + +impl CGFont { + pub fn from_data_provider(provider: CGDataProvider) -> Result { + unsafe { + let font_ref = CGFontCreateWithDataProvider(provider.as_concrete_TypeRef()); + if font_ref != ptr::null() { + Ok(TCFType::wrap_under_create_rule(font_ref)) + } else { + Err(()) + } + } + } + + pub fn from_name(name: &CFString) -> Result { + unsafe { + let font_ref = CGFontCreateWithFontName(name.as_concrete_TypeRef()); + if font_ref != ptr::null() { + Ok(TCFType::wrap_under_create_rule(font_ref)) + } else { + Err(()) + } + } + } + + pub fn postscript_name(&self) -> CFString { + unsafe { + let string_ref = CGFontCopyPostScriptName(self.obj); + TCFType::wrap_under_create_rule(string_ref) + } + } +} + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + // TODO: basically nothing has bindings (even commented-out) besides what we use. + fn CGFontCreateWithDataProvider(provider: CGDataProviderRef) -> CGFontRef; + fn CGFontCreateWithFontName(name: CFStringRef) -> CGFontRef; + fn CGFontGetTypeID() -> CFTypeID; + + fn CGFontCopyPostScriptName(font: CGFontRef) -> CFStringRef; + + // These do the same thing as CFRetain/CFRelease, except + // gracefully handle a NULL argument. We don't use them. + //fn CGFontRetain(font: CGFontRef); + //fn CGFontRelease(font: CGFontRef); +} diff --git a/third_party/rust/core-graphics/src/geometry.rs b/third_party/rust/core-graphics/src/geometry.rs new file mode 100644 index 000000000000..e4145dac5641 --- /dev/null +++ b/third_party/rust/core-graphics/src/geometry.rs @@ -0,0 +1,84 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use base::CGFloat; + +pub const CG_ZERO_POINT: CGPoint = CGPoint { + x: 0.0, + y: 0.0, +}; + +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub struct CGSize { + pub width: CGFloat, + pub height: CGFloat, +} + +impl CGSize { + #[inline] + pub fn new(width: CGFloat, height: CGFloat) -> CGSize { + CGSize { + width: width, + height: height, + } + } +} + +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub struct CGPoint { + pub x: CGFloat, + pub y: CGFloat, +} + +impl CGPoint { + #[inline] + pub fn new(x: CGFloat, y: CGFloat) -> CGPoint { + CGPoint { + x: x, + y: y, + } + } +} + +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub struct CGRect { + pub origin: CGPoint, + pub size: CGSize +} + +impl CGRect { + #[inline] + pub fn new(origin: &CGPoint, size: &CGSize) -> CGRect { + CGRect { + origin: *origin, + size: *size, + } + } + + #[inline] + pub fn inset(&self, size: &CGSize) -> CGRect { + unsafe { + ffi::CGRectInset(*self, size.width, size.height) + } + } +} + +mod ffi { + use base::CGFloat; + use geometry::CGRect; + + #[link(name = "ApplicationServices", kind = "framework")] + extern { + pub fn CGRectInset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect; + } +} + diff --git a/third_party/rust/core-graphics/src/lib.rs b/third_party/rust/core-graphics/src/lib.rs new file mode 100644 index 000000000000..fed16b22ded9 --- /dev/null +++ b/third_party/rust/core-graphics/src/lib.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate libc; +extern crate core_foundation; +extern crate serde; + +pub mod base; +pub mod color_space; +pub mod context; +pub mod data_provider; +pub mod display; +pub mod event; +pub mod event_source; +pub mod font; +pub mod geometry; +pub mod private; diff --git a/third_party/rust/core-graphics/src/private.rs b/third_party/rust/core-graphics/src/private.rs new file mode 100644 index 000000000000..11231a91176f --- /dev/null +++ b/third_party/rust/core-graphics/src/private.rs @@ -0,0 +1,116 @@ +// Copyright 2016 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Evil private APIs. +//! +//! These are liable to change at any time. Use with caution! + +use geometry::CGRect; +use libc::{c_int, c_uint}; +use std::ptr; + +pub struct CGSRegion { + region: ffi::CGSRegionRef, +} + +impl Drop for CGSRegion { + fn drop(&mut self) { + unsafe { + ffi::CGSRegionRelease(self.region) + } + } +} + +impl CGSRegion { + #[inline] + pub fn from_rect(rect: &CGRect) -> CGSRegion { + unsafe { + let mut region = ptr::null_mut(); + assert!(ffi::CGSNewRegionWithRect(rect, &mut region) == 0); + CGSRegion { + region: region, + } + } + } + + #[inline] + pub fn from_rects(rects: &[CGRect]) -> CGSRegion { + unsafe { + let mut region = ptr::null_mut(); + assert!(ffi::CGSNewRegionWithRectList(rects.as_ptr(), + rects.len() as c_uint, + &mut region) == 0); + CGSRegion { + region: region, + } + } + } +} + +/// This should always be memory-safe; the window server rejects any invalid surface IDs. +pub struct CGSSurface { + context_id: c_uint, + window_number: c_int, + surface_id: c_uint, +} + +impl CGSSurface { + #[inline] + pub fn from_ids(context_id: c_uint, window_number: c_int, surface_id: c_uint) -> CGSSurface { + CGSSurface { + context_id: context_id, + window_number: window_number, + surface_id: surface_id, + } + } + + #[inline] + pub fn id(&self) -> c_uint { + self.surface_id + } + + #[inline] + pub fn set_shape(&self, region: &CGSRegion) { + unsafe { + assert!(ffi::CGSSetSurfaceShape(self.context_id, + self.window_number, + self.surface_id, + region.region) == 0) + } + } +} + +mod ffi { + use geometry::CGRect; + use libc::{c_int, c_uint}; + + // This is an enum so that we can't easily make instances of this opaque type. + pub enum CGSRegionObject {} + + pub type CGError = OSStatus; + pub type CGSRegionRef = *mut CGSRegionObject; + pub type OSStatus = i32; + + #[link(name = "ApplicationServices", kind = "framework")] + extern { + pub fn CGSRegionRelease(region: CGSRegionRef); + pub fn CGSNewRegionWithRect(rect: *const CGRect, outRegion: *mut CGSRegionRef) -> CGError; + pub fn CGSNewRegionWithRectList(rects: *const CGRect, + rectCount: c_uint, + outRegion: *mut CGSRegionRef) + -> CGError; + + pub fn CGSSetSurfaceShape(contextID: c_uint, + windowNumber: c_int, + surfaceID: c_uint, + region: CGSRegionRef) + -> CGError; + } +} + diff --git a/third_party/rust/core-text/.cargo-checksum.json b/third_party/rust/core-text/.cargo-checksum.json new file mode 100644 index 000000000000..9b7520b814bf --- /dev/null +++ b/third_party/rust/core-text/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"d0114f648b7f61e473b61c6d682fefaa4e3fadf2101aff056e2ffc52e9229d87",".travis.yml":"6aad961651169d31d79c0595624d1777b5c4cbb4cf2bed9a126c7e72d29411fd","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"e185b9d848cdb6eda1bafc616b76c2452f80861f098610c5568ea68aa06f8877","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"d9df5c37cb98436dbf8162af9c3449fea1eab41511d326840759d46d514bcada","src/font_collection.rs":"d4ca7f741fd54b4b22b823833dfa1f1ccd78a26cf112119ae992572835e48df6","src/font_descriptor.rs":"cedc4bd303abd4519c7c95201672ce5652f7396cd34383c059f945eefb64623b","src/font_manager.rs":"de5e22620528322d6811d01f03975c53b676ec743297590de5e17a45393df0f1","src/lib.rs":"b1fc720a9ab7ae4f054f0767e05ba5640b2d9fc8c34d05ae04f25b9dd44f6b81"},"package":"642fa40165b6c53bbd3f636951ffc3e1a3fd3c47e7d00598523c3e8c9321ed0c"} \ No newline at end of file diff --git a/third_party/rust/core-text/.cargo-ok b/third_party/rust/core-text/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/core-text/.gitignore b/third_party/rust/core-text/.gitignore new file mode 100644 index 000000000000..c34fbd05160e --- /dev/null +++ b/third_party/rust/core-text/.gitignore @@ -0,0 +1,14 @@ +*~ +*# +*.o +*.a +*.so +*.dylib +*.dSYM +*.dll +*.dummy +cocoa-test +build +/target +/doc +/Cargo.lock diff --git a/third_party/rust/core-text/.travis.yml b/third_party/rust/core-text/.travis.yml new file mode 100644 index 000000000000..ed3f5dd0f4ee --- /dev/null +++ b/third_party/rust/core-text/.travis.yml @@ -0,0 +1,8 @@ +language: rust +rust: + - nightly + - beta + - stable +os: osx +notifications: + webhooks: http://build.servo.org:54856/travis diff --git a/third_party/rust/core-text/COPYRIGHT b/third_party/rust/core-text/COPYRIGHT new file mode 100644 index 000000000000..8b7291ad281c --- /dev/null +++ b/third_party/rust/core-text/COPYRIGHT @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 or the MIT license +, at your +option. All files in the project carrying such notice may not be +copied, modified, or distributed except according to those terms. diff --git a/third_party/rust/core-text/Cargo.toml b/third_party/rust/core-text/Cargo.toml new file mode 100644 index 000000000000..0a567018d7b7 --- /dev/null +++ b/third_party/rust/core-text/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "core-text" +version = "2.0.1" +authors = ["The Servo Project Developers"] +description = "Bindings to the Core Text framework." +license = "MIT/Apache-2.0" +repository = "https://github.com/servo/core-text-rs" + +[dependencies] +libc = "0.2" + +[target.x86_64-apple-darwin.dependencies] +core-foundation = "0.2" +core-graphics = "0.5" diff --git a/third_party/rust/core-text/LICENSE-APACHE b/third_party/rust/core-text/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/core-text/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/core-text/LICENSE-MIT b/third_party/rust/core-text/LICENSE-MIT new file mode 100644 index 000000000000..807526f57f3a --- /dev/null +++ b/third_party/rust/core-text/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2012-2013 Mozilla Foundation + +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. diff --git a/third_party/rust/core-text/README.md b/third_party/rust/core-text/README.md new file mode 100644 index 000000000000..b72bf11b1dec --- /dev/null +++ b/third_party/rust/core-text/README.md @@ -0,0 +1,3 @@ +# core-text-rs + +[![Build Status](https://travis-ci.org/servo/core-text-rs.svg?branch=master)](https://travis-ci.org/servo/core-text-rs) diff --git a/third_party/rust/core-text/src/font.rs b/third_party/rust/core-text/src/font.rs new file mode 100644 index 000000000000..abda98e15073 --- /dev/null +++ b/third_party/rust/core-text/src/font.rs @@ -0,0 +1,519 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_upper_case_globals)] + +use font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation}; +use font_descriptor::{CTFontSymbolicTraits, CTFontTraits, SymbolicTraitAccessors, TraitAccessors}; + +use core_foundation::base::{CFIndex, CFOptionFlags, CFTypeID, CFRelease, CFRetain, CFTypeRef, TCFType}; +use core_foundation::data::{CFData, CFDataRef}; +use core_foundation::dictionary::CFDictionaryRef; +use core_foundation::string::{CFString, CFStringRef, UniChar}; +use core_foundation::url::{CFURL, CFURLRef}; +use core_graphics::base::{CGAffineTransform, CGFloat}; +use core_graphics::context::{CGContext, CGContextRef}; +use core_graphics::font::{CGGlyph, CGFont, CGFontRef}; +use core_graphics::geometry::{CGPoint, CGRect, CGSize}; + +use libc::{self, size_t}; +use std::mem; +use std::ptr; + +pub type CTFontUIFontType = u32; +// kCTFontNoFontType: CTFontUIFontType = -1; +pub const kCTFontUserFontType: CTFontUIFontType = 0; +pub const kCTFontUserFixedPitchFontType: CTFontUIFontType = 1; +pub const kCTFontSystemFontType: CTFontUIFontType = 2; +pub const kCTFontEmphasizedSystemFontType: CTFontUIFontType = 3; +pub const kCTFontSmallSystemFontType: CTFontUIFontType = 4; +pub const kCTFontSmallEmphasizedSystemFontType: CTFontUIFontType = 5; +pub const kCTFontMiniSystemFontType: CTFontUIFontType = 6; +pub const kCTFontMiniEmphasizedSystemFontType: CTFontUIFontType = 7; +pub const kCTFontViewsFontType: CTFontUIFontType = 8; +pub const kCTFontApplicationFontType: CTFontUIFontType = 9; +pub const kCTFontLabelFontType: CTFontUIFontType = 10; +pub const kCTFontMenuTitleFontType: CTFontUIFontType = 11; +pub const kCTFontMenuItemFontType: CTFontUIFontType = 12; +pub const kCTFontMenuItemMarkFontType: CTFontUIFontType = 13; +pub const kCTFontMenuItemCmdKeyFontType: CTFontUIFontType = 14; +pub const kCTFontWindowTitleFontType: CTFontUIFontType = 15; +pub const kCTFontPushButtonFontType: CTFontUIFontType = 16; +pub const kCTFontUtilityWindowTitleFontType: CTFontUIFontType = 17; +pub const kCTFontAlertHeaderFontType: CTFontUIFontType = 18; +pub const kCTFontSystemDetailFontType: CTFontUIFontType = 19; +pub const kCTFontEmphasizedSystemDetailFontType: CTFontUIFontType = 20; +pub const kCTFontToolbarFontType: CTFontUIFontType = 21; +pub const kCTFontSmallToolbarFontType: CTFontUIFontType = 22; +pub const kCTFontMessageFontType: CTFontUIFontType = 23; +pub const kCTFontPaletteFontType: CTFontUIFontType = 24; +pub const kCTFontToolTipFontType: CTFontUIFontType = 25; +pub const kCTFontControlContentFontType: CTFontUIFontType = 26; + +pub type CTFontTableTag = u32; +// TODO: create bindings for enum with 'chars' values + +pub type CTFontTableOptions = u32; +pub const kCTFontTableOptionsNoOptions: CTFontTableOptions = 0; +pub const kCTFontTableOptionsExcludeSynthetic: CTFontTableOptions = (1 << 0); + +pub type CTFontOptions = CFOptionFlags; +pub const kCTFontOptionsDefault: CTFontOptions = 0; +pub const kCTFontOptionsPreventAutoActivation: CTFontOptions = (1 << 0); +pub const kCTFontOptionsPreferSystemFont: CTFontOptions = (1 << 2); + +#[repr(C)] +struct __CTFont; + +pub type CTFontRef = *const __CTFont; + +#[derive(Debug)] +pub struct CTFont { + obj: CTFontRef, +} + +impl Drop for CTFont { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl Clone for CTFont { + #[inline] + fn clone(&self) -> CTFont { + unsafe { + TCFType::wrap_under_get_rule(self.obj) + } + } +} + +impl TCFType for CTFont { + #[inline] + fn as_concrete_TypeRef(&self) -> CTFontRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CTFontRef) -> CTFont { + let reference: CTFontRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CTFontRef) -> CTFont { + CTFont { + obj: obj, + } + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CTFontGetTypeID() + } + } +} + +pub fn new_from_CGFont(cgfont: &CGFont, pt_size: f64) -> CTFont { + unsafe { + let font_ref = CTFontCreateWithGraphicsFont(cgfont.as_concrete_TypeRef(), + pt_size as CGFloat, + ptr::null(), + ptr::null()); + TCFType::wrap_under_create_rule(font_ref) + } +} + +pub fn new_from_descriptor(desc: &CTFontDescriptor, pt_size: f64) -> CTFont { + unsafe { + let font_ref = CTFontCreateWithFontDescriptor(desc.as_concrete_TypeRef(), + pt_size as CGFloat, + ptr::null()); + TCFType::wrap_under_create_rule(font_ref) + } +} + +pub fn new_from_name(name: &str, pt_size: f64) -> Result { + unsafe { + let name: CFString = name.parse().unwrap(); + let font_ref = CTFontCreateWithName(name.as_concrete_TypeRef(), + pt_size as CGFloat, + ptr::null()); + if font_ref.is_null() { + Err(()) + } else { + Ok(TCFType::wrap_under_create_rule(font_ref)) + } + } +} + +impl CTFont { + // Properties + pub fn symbolic_traits(&self) -> CTFontSymbolicTraits { + unsafe { + CTFontGetSymbolicTraits(self.obj) + } + } +} + +impl CTFont { + // Creation methods + pub fn copy_to_CGFont(&self) -> CGFont { + unsafe { + let cgfont_ref = CTFontCopyGraphicsFont(self.obj, ptr::null_mut()); + TCFType::wrap_under_create_rule(cgfont_ref) + } + } + + pub fn clone_with_font_size(&self, size: f64) -> CTFont { + unsafe { + let font_ref = CTFontCreateCopyWithAttributes(self.obj, + size as CGFloat, + ptr::null(), + ptr::null()); + TCFType::wrap_under_create_rule(font_ref) + } + } + + // Names + pub fn family_name(&self) -> String { + let value = get_string_by_name_key(self, kCTFontFamilyNameKey); + value.expect("Fonts should always have a family name.") + } + + pub fn face_name(&self) -> String { + let value = get_string_by_name_key(self, kCTFontSubFamilyNameKey); + value.expect("Fonts should always have a face name.") + } + + pub fn unique_name(&self) -> String { + let value = get_string_by_name_key(self, kCTFontUniqueNameKey); + value.expect("Fonts should always have a unique name.") + } + + pub fn postscript_name(&self) -> String { + let value = get_string_by_name_key(self, kCTFontPostScriptNameKey); + value.expect("Fonts should always have a PostScript name.") + } + + pub fn all_traits(&self) -> CTFontTraits { + unsafe { + TCFType::wrap_under_create_rule(CTFontCopyTraits(self.obj)) + } + } + + // Font metrics + pub fn ascent(&self) -> CGFloat { + unsafe { + CTFontGetAscent(self.obj) + } + } + + pub fn descent(&self) -> CGFloat { + unsafe { + CTFontGetDescent(self.obj) + } + } + + pub fn underline_thickness(&self) -> CGFloat { + unsafe { + CTFontGetUnderlineThickness(self.obj) + } + } + + pub fn underline_position(&self) -> CGFloat { + unsafe { + CTFontGetUnderlinePosition(self.obj) + } + } + + pub fn bounding_box(&self) -> CGRect { + unsafe { + CTFontGetBoundingBox(self.obj) + } + } + + pub fn leading(&self) -> CGFloat { + unsafe { + CTFontGetLeading(self.obj) + } + } + + pub fn units_per_em(&self) -> libc::c_uint { + unsafe { + CTFontGetUnitsPerEm(self.obj) + } + } + + pub fn x_height(&self) -> CGFloat { + unsafe { + CTFontGetXHeight(self.obj) + } + } + + pub fn pt_size(&self) -> CGFloat { + unsafe { + CTFontGetSize(self.obj) + } + } + + pub fn get_glyphs_for_characters(&self, characters: *const UniChar, glyphs: *mut CGGlyph, count: CFIndex) + -> bool { + unsafe { + CTFontGetGlyphsForCharacters(self.obj, characters, glyphs, count) + } + } + + pub fn get_advances_for_glyphs(&self, + orientation: CTFontOrientation, + glyphs: *const CGGlyph, + advances: *mut CGSize, + count: CFIndex) + -> f64 { + unsafe { + CTFontGetAdvancesForGlyphs(self.obj, orientation, glyphs, advances, count) as f64 + } + } + + pub fn get_font_table(&self, tag: u32) -> Option { + unsafe { + let result = CTFontCopyTable(self.obj, + tag as CTFontTableTag, + kCTFontTableOptionsExcludeSynthetic); + if result.is_null() { + None + } else { + Some(TCFType::wrap_under_create_rule(result)) + } + } + } + + pub fn get_bounding_rects_for_glyphs(&self, orientation: CTFontOrientation, glyphs: &[CGGlyph]) + -> CGRect { + unsafe { + let mut result = CTFontGetBoundingRectsForGlyphs(self.as_concrete_TypeRef(), + orientation, + glyphs.as_ptr(), + ptr::null_mut(), + glyphs.len() as CFIndex); + result + } + } + + pub fn draw_glyphs(&self, glyphs: &[CGGlyph], positions: &[CGPoint], context: CGContext) { + assert!(glyphs.len() == positions.len()); + unsafe { + CTFontDrawGlyphs(self.as_concrete_TypeRef(), + glyphs.as_ptr(), + positions.as_ptr(), + glyphs.len() as size_t, + context.as_concrete_TypeRef()) + } + } + + pub fn url(&self) -> Option { + unsafe { + let result = CTFontCopyAttribute(self.obj, kCTFontURLAttribute); + if result.is_null() { + None + } else { + Some(TCFType::wrap_under_create_rule(result as CFURLRef)) + } + } + } +} + +// Helper methods +fn get_string_by_name_key(font: &CTFont, name_key: CFStringRef) -> Option { + unsafe { + let result = CTFontCopyName(font.as_concrete_TypeRef(), name_key); + if result.is_null() { + None + } else { + let string: CFString = TCFType::wrap_under_create_rule(result); + Some(string.to_string()) + } + } +} + +pub fn debug_font_names(font: &CTFont) { + fn get_key(font: &CTFont, key: CFStringRef) -> String { + get_string_by_name_key(font, key).unwrap() + } + + println!("kCTFontFamilyNameKey: {}", get_key(font, kCTFontFamilyNameKey)); + println!("kCTFontSubFamilyNameKey: {}", get_key(font, kCTFontSubFamilyNameKey)); + println!("kCTFontStyleNameKey: {}", get_key(font, kCTFontStyleNameKey)); + println!("kCTFontUniqueNameKey: {}", get_key(font, kCTFontUniqueNameKey)); + println!("kCTFontFullNameKey: {}", get_key(font, kCTFontFullNameKey)); + println!("kCTFontPostScriptNameKey: {}", get_key(font, kCTFontPostScriptNameKey)); +} + +pub fn debug_font_traits(font: &CTFont) { + let sym = font.symbolic_traits(); + println!("kCTFontItalicTrait: {}", sym.is_italic()); + println!("kCTFontBoldTrait: {}", sym.is_bold()); + println!("kCTFontExpandedTrait: {}", sym.is_expanded()); + println!("kCTFontCondensedTrait: {}", sym.is_condensed()); + println!("kCTFontMonoSpaceTrait: {}", sym.is_monospace()); + + let traits = font.all_traits(); + println!("kCTFontWeightTrait: {}", traits.normalized_weight()); +// println!("kCTFontWidthTrait: {}", traits.normalized_width()); +// println!("kCTFontSlantTrait: {}", traits.normalized_slant()); +} + +#[link(name = "ApplicationServices", kind = "framework")] +extern { + /* + * CTFont.h + */ + + /* Name Specifier Constants */ + //static kCTFontCopyrightNameKey: CFStringRef; + static kCTFontFamilyNameKey: CFStringRef; + static kCTFontSubFamilyNameKey: CFStringRef; + static kCTFontStyleNameKey: CFStringRef; + static kCTFontUniqueNameKey: CFStringRef; + static kCTFontFullNameKey: CFStringRef; + //static kCTFontVersionNameKey: CFStringRef; + static kCTFontPostScriptNameKey: CFStringRef; + //static kCTFontTrademarkNameKey: CFStringRef; + //static kCTFontManufacturerNameKey: CFStringRef; + //static kCTFontDesignerNameKey: CFStringRef; + //static kCTFontDescriptionNameKey: CFStringRef; + //static kCTFontVendorURLNameKey: CFStringRef; + //static kCTFontDesignerURLNameKey: CFStringRef; + //static kCTFontLicenseNameKey: CFStringRef; + //static kCTFontLicenseURLNameKey: CFStringRef; + //static kCTFontSampleTextNameKey: CFStringRef; + //static kCTFontPostScriptCIDNameKey: CFStringRef; + + //static kCTFontVariationAxisIdentifierKey: CFStringRef; + //static kCTFontVariationAxisMinimumValueKey: CFStringRef; + //static kCTFontVariationAxisMaximumValueKey: CFStringRef; + //static kCTFontVariationAxisDefaultValueKey: CFStringRef; + //static kCTFontVariationAxisNameKey: CFStringRef; + + //static kCTFontFeatureTypeIdentifierKey: CFStringRef; + //static kCTFontFeatureTypeNameKey: CFStringRef; + //static kCTFontFeatureTypeExclusiveKey: CFStringRef; + //static kCTFontFeatureTypeSelectorsKey: CFStringRef; + //static kCTFontFeatureSelectorIdentifierKey: CFStringRef; + //static kCTFontFeatureSelectorNameKey: CFStringRef; + //static kCTFontFeatureSelectorDefaultKey: CFStringRef; + //static kCTFontFeatureSelectorSettingKey: CFStringRef; + + static kCTFontURLAttribute: CFStringRef; + + // N.B. Unlike most Cocoa bindings, this extern block is organized according + // to the documentation's Functions By Task listing, because there so many functions. + + /* Creating Fonts */ + fn CTFontCreateWithName(name: CFStringRef, size: CGFloat, matrix: *const CGAffineTransform) -> CTFontRef; + //fn CTFontCreateWithNameAndOptions + fn CTFontCreateWithFontDescriptor(descriptor: CTFontDescriptorRef, size: CGFloat, + matrix: *const CGAffineTransform) -> CTFontRef; + //fn CTFontCreateWithFontDescriptorAndOptions + //fn CTFontCreateUIFontForLanguage + fn CTFontCreateCopyWithAttributes(font: CTFontRef, size: CGFloat, matrix: *const CGAffineTransform, + attributes: CTFontDescriptorRef) -> CTFontRef; + //fn CTFontCreateCopyWithSymbolicTraits + //fn CTFontCreateCopyWithFamily + //fn CTFontCreateForString + + /* Getting Font Data */ + //fn CTFontCopyFontDescriptor(font: CTFontRef) -> CTFontDescriptorRef; + fn CTFontCopyAttribute(font: CTFontRef, attribute: CFStringRef) -> CFTypeRef; + fn CTFontGetSize(font: CTFontRef) -> CGFloat; + //fn CTFontGetMatrix + fn CTFontGetSymbolicTraits(font: CTFontRef) -> CTFontSymbolicTraits; + fn CTFontCopyTraits(font: CTFontRef) -> CFDictionaryRef; + + /* Getting Font Names */ + //fn CTFontCopyPostScriptName(font: CTFontRef) -> CFStringRef; + //fn CTFontCopyFamilyName(font: CTFontRef) -> CFStringRef; + //fn CTFontCopyFullName(font: CTFontRef) -> CFStringRef; + //fn CTFontCopyDisplayName(font: CTFontRef) -> CFStringRef; + fn CTFontCopyName(font: CTFontRef, nameKey: CFStringRef) -> CFStringRef; + //fn CTFontCopyLocalizedName(font: CTFontRef, nameKey: CFStringRef, + // language: *CFStringRef) -> CFStringRef; + + /* Working With Encoding */ + //fn CTFontCopyCharacterSet + //fn CTFontGetStringEncoding + //fn CTFontCopySupportedLanguages + + /* Getting Font Metrics */ + fn CTFontGetAscent(font: CTFontRef) -> CGFloat; + fn CTFontGetDescent(font: CTFontRef) -> CGFloat; + fn CTFontGetLeading(font: CTFontRef) -> CGFloat; + fn CTFontGetUnitsPerEm(font: CTFontRef) -> libc::c_uint; + //fn CTFontGetGlyphCount + fn CTFontGetBoundingBox(font: CTFontRef) -> CGRect; + fn CTFontGetUnderlinePosition(font: CTFontRef) -> CGFloat; + fn CTFontGetUnderlineThickness(font: CTFontRef) -> CGFloat; + //fn CTFontGetSlantAngle + //fn CTFontGetCapHeight + fn CTFontGetXHeight(font: CTFontRef) -> CGFloat; + + /* Getting Glyph Data */ + //fn CTFontCreatePathForGlyph + //fn CTFontGetGlyphWithName + fn CTFontGetBoundingRectsForGlyphs(font: CTFontRef, + orientation: CTFontOrientation, + glyphs: *const CGGlyph, + boundingRects: *mut CGRect, + count: CFIndex) + -> CGRect; + fn CTFontGetAdvancesForGlyphs(font: CTFontRef, orientation: CTFontOrientation, glyphs: *const CGGlyph, advances: *mut CGSize, count: CFIndex) -> libc::c_double; + //fn CTFontGetVerticalTranslationsForGlyphs + + /* Working With Font Variations */ + //fn CTFontCopyVariationAxes + //fn CTFontCopyVariation + + /* Getting Font Features */ + //fn CTFontCopyFeatures + //fn CTFontCopyFeatureSettings + + /* Working with Glyphs */ + fn CTFontGetGlyphsForCharacters(font: CTFontRef, characters: *const UniChar, glyphs: *mut CGGlyph, count: CFIndex) -> bool; + fn CTFontDrawGlyphs(font: CTFontRef, + glyphs: *const CGGlyph, + positions: *const CGPoint, + count: size_t, + context: CGContextRef); + //fn CTFontGetLigatureCaretPositions + + /* Converting Fonts */ + fn CTFontCopyGraphicsFont(font: CTFontRef, attributes: *mut CTFontDescriptorRef) -> CGFontRef; + fn CTFontCreateWithGraphicsFont(graphicsFont: CGFontRef, size: CGFloat, + matrix: *const CGAffineTransform, + attributes: CTFontDescriptorRef) -> CTFontRef; + //fn CTFontGetPlatformFont + //fn CTFontCreateWithPlatformFont + //fn CTFontCreateWithQuickdrawInstance + + /* Getting Font Table Data */ + //fn CTFontCopyAvailableTables(font: CTFontRef, options: CTFontTableOptions) -> CFArrayRef; + fn CTFontCopyTable(font: CTFontRef, table: CTFontTableTag, options: CTFontTableOptions) -> CFDataRef; + + fn CTFontGetTypeID() -> CFTypeID; +} + diff --git a/third_party/rust/core-text/src/font_collection.rs b/third_party/rust/core-text/src/font_collection.rs new file mode 100644 index 000000000000..c2c5414d2316 --- /dev/null +++ b/third_party/rust/core-text/src/font_collection.rs @@ -0,0 +1,160 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use font_descriptor; +use font_descriptor::{CTFontDescriptor, CTFontDescriptorCreateMatchingFontDescriptors}; +use font_manager::CTFontManagerCopyAvailableFontFamilyNames; + +use core_foundation::array::{CFArray, CFArrayRef}; +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; +use core_foundation::dictionary::{CFDictionary, CFDictionaryRef}; +use core_foundation::number::CFNumber; +use core_foundation::set::CFSet; +use core_foundation::string::{CFString, CFStringRef}; + +use std::mem; +use std::ptr; + +#[repr(C)] +struct __CTFontCollection; + +pub type CTFontCollectionRef = *const __CTFontCollection; + +#[derive(Debug)] +pub struct CTFontCollection { + obj: CTFontCollectionRef, +} + +impl Drop for CTFontCollection { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl TCFType for CTFontCollection { + #[inline] + fn as_concrete_TypeRef(&self) -> CTFontCollectionRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CTFontCollectionRef) -> CTFontCollection { + let reference: CTFontCollectionRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CTFontCollectionRef) -> CTFontCollection { + CTFontCollection { + obj: obj, + } + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CTFontCollectionGetTypeID() + } + } +} + +impl CTFontCollection { + pub fn get_descriptors(&self) -> CFArray { + // surprise! this function follows the Get rule, despite being named *Create*. + // So we have to addRef it to avoid CTFontCollection from double freeing it later. + unsafe { + TCFType::wrap_under_get_rule(CTFontCollectionCreateMatchingFontDescriptors(self.obj)) + } + } +} + +pub fn new_from_descriptors(descs: &CFArray) -> CTFontCollection { + unsafe { + let key: CFString = TCFType::wrap_under_get_rule(kCTFontCollectionRemoveDuplicatesOption); + let value = CFNumber::from_i64(1); + let options = CFDictionary::from_CFType_pairs(&[ (key.as_CFType(), value.as_CFType()) ]); + let font_collection_ref = + CTFontCollectionCreateWithFontDescriptors(descs.as_concrete_TypeRef(), + options.as_concrete_TypeRef()); + TCFType::wrap_under_create_rule(font_collection_ref) + } +} + +pub fn create_for_all_families() -> CTFontCollection { + unsafe { + let key: CFString = TCFType::wrap_under_get_rule(kCTFontCollectionRemoveDuplicatesOption); + let value = CFNumber::from_i64(1); + let options = CFDictionary::from_CFType_pairs(&[ (key.as_CFType(), value.as_CFType()) ]); + let font_collection_ref = + CTFontCollectionCreateFromAvailableFonts(options.as_concrete_TypeRef()); + TCFType::wrap_under_create_rule(font_collection_ref) + } +} + +pub fn create_for_family(family: &str) -> Option { + use font_descriptor::kCTFontFamilyNameAttribute; + + unsafe { + let family_attr: CFString = TCFType::wrap_under_get_rule(kCTFontFamilyNameAttribute); + let family_name: CFString = family.parse().unwrap(); + let specified_attrs = CFDictionary::from_CFType_pairs(&[ + (family_attr.as_CFType(), family_name.as_CFType()) + ]); + + let wildcard_desc: CTFontDescriptor = + font_descriptor::new_from_attributes(&specified_attrs); + let mandatory_attrs = CFSet::from_slice(&[ family_attr.as_CFType() ]); + let matched_descs = CTFontDescriptorCreateMatchingFontDescriptors( + wildcard_desc.as_concrete_TypeRef(), + mandatory_attrs.as_concrete_TypeRef()); + if matched_descs == ptr::null() { + return None; + } + let matched_descs: CFArray = TCFType::wrap_under_create_rule(matched_descs); + // I suppose one doesn't even need the CTFontCollection object at this point. + // But we stick descriptors into and out of it just to provide a nice wrapper API. + Some(new_from_descriptors(&matched_descs)) + } +} + +pub fn get_family_names() -> CFArray { + unsafe { + TCFType::wrap_under_create_rule(CTFontManagerCopyAvailableFontFamilyNames()) + } +} + +extern { + /* + * CTFontCollection.h + */ + + static kCTFontCollectionRemoveDuplicatesOption: CFStringRef; + + //fn CTFontCollectionCreateCopyWithFontDescriptors(original: CTFontCollectionRef, + // descriptors: CFArrayRef, + // options: CFDictionaryRef) -> CTFontCollectionRef; + fn CTFontCollectionCreateFromAvailableFonts(options: CFDictionaryRef) -> CTFontCollectionRef; + // this stupid function doesn't actually do any wildcard expansion; + // it just chooses the best match. Use + // CTFontDescriptorCreateMatchingDescriptors instead. + fn CTFontCollectionCreateMatchingFontDescriptors(collection: CTFontCollectionRef) -> CFArrayRef; + fn CTFontCollectionCreateWithFontDescriptors(descriptors: CFArrayRef, + options: CFDictionaryRef) -> CTFontCollectionRef; + //fn CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback; + fn CTFontCollectionGetTypeID() -> CFTypeID; +} diff --git a/third_party/rust/core-text/src/font_descriptor.rs b/third_party/rust/core-text/src/font_descriptor.rs new file mode 100644 index 000000000000..2b655b9772be --- /dev/null +++ b/third_party/rust/core-text/src/font_descriptor.rs @@ -0,0 +1,369 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_upper_case_globals)] + +use core_foundation::array::CFArrayRef; +use core_foundation::base::{CFRelease, CFRetain, CFType, CFTypeID, CFTypeRef, TCFType}; +use core_foundation::dictionary::{CFDictionary, CFDictionaryRef}; +use core_foundation::number::{CFNumber, CFNumberRef}; +use core_foundation::set::CFSetRef; +use core_foundation::string::{CFString, CFStringRef}; +use core_foundation::url::{CFURL, CFURLRef}; +use core_graphics::base::CGFloat; + +use std::mem; + +/* +* CTFontTraits.h +*/ +// actually, these are extern enums +pub type CTFontFormat = u32; +pub const kCTFontFormatUnrecognized: CTFontFormat = 0; +pub const kCTFontFormatOpenTypePostScript: CTFontFormat = 1; +pub const kCTFontFormatOpenTypeTrueType: CTFontFormat = 2; +pub const kCTFontFormatTrueType: CTFontFormat = 3; +pub const kCTFontFormatPostScript: CTFontFormat = 4; +pub const kCTFontFormatBitmap: CTFontFormat = 5; + +pub const kCTFontClassMaskShift: u32 = 28; + +pub type CTFontSymbolicTraits = u32; +pub const kCTFontItalicTrait: CTFontSymbolicTraits = (1 << 0); +pub const kCTFontBoldTrait: CTFontSymbolicTraits = (1 << 1); +pub const kCTFontExpandedTrait: CTFontSymbolicTraits = (1 << 5); +pub const kCTFontCondensedTrait: CTFontSymbolicTraits = (1 << 6); +pub const kCTFontMonoSpaceTrait: CTFontSymbolicTraits = (1 << 10); +pub const kCTFontVerticalTrait: CTFontSymbolicTraits = (1 << 11); +pub const kCTFontUIOptimizedTrait: CTFontSymbolicTraits = (1 << 12); +pub const kCTFontColorGlyphsTrait: CTFontSymbolicTraits = (1 << 13); +pub const kCTFontClassMaskTrait: CTFontSymbolicTraits = (15 << kCTFontClassMaskShift ); + +pub trait SymbolicTraitAccessors { + fn is_italic(&self) -> bool; + fn is_bold(&self) -> bool; + fn is_expanded(&self) -> bool; + fn is_condensed(&self) -> bool; + fn is_monospace(&self) -> bool; +} + +impl SymbolicTraitAccessors for CTFontSymbolicTraits { + fn is_italic(&self) -> bool { (*self & kCTFontItalicTrait) != 0 } + fn is_bold(&self) -> bool { (*self & kCTFontBoldTrait) != 0 } + fn is_expanded(&self) -> bool { (*self & kCTFontExpandedTrait) != 0 } + fn is_condensed(&self) -> bool { (*self & kCTFontCondensedTrait) != 0 } + fn is_monospace(&self) -> bool { (*self & kCTFontMonoSpaceTrait) != 0 } +} + +pub type CTFontStylisticClass = u32; +pub const kCTFontUnknownClass: CTFontStylisticClass = (0 << kCTFontClassMaskShift ); +pub const kCTFontOldStyleSerifsClass: CTFontStylisticClass = (1 << kCTFontClassMaskShift ); +pub const kCTFontTransitionalSerifsClass: CTFontStylisticClass = (2 << kCTFontClassMaskShift ); +pub const kCTFontModernSerifsClass: CTFontStylisticClass = (3 << kCTFontClassMaskShift ); +pub const kCTFontClarendonSerifsClass: CTFontStylisticClass = (4 << kCTFontClassMaskShift ); +pub const kCTFontSlabSerifsClass: CTFontStylisticClass = (5 << kCTFontClassMaskShift ); +pub const kCTFontFreeformSerifsClass: CTFontStylisticClass = (7 << kCTFontClassMaskShift ); +pub const kCTFontSansSerifClass: CTFontStylisticClass = (8 << kCTFontClassMaskShift ); +pub const kCTFontOrnamentalsClass: CTFontStylisticClass = (9 << kCTFontClassMaskShift ); +pub const kCTFontScriptsClass: CTFontStylisticClass = (10 << kCTFontClassMaskShift ); +pub const kCTFontSymbolicClass: CTFontStylisticClass = (12 << kCTFontClassMaskShift ); + +pub trait StylisticClassAccessors { + fn is_serif(&self) -> bool; + fn is_sans_serif(&self) -> bool; + fn is_script(&self) -> bool; + fn is_fantasy(&self) -> bool; + fn is_symbols(&self) -> bool; +} + +impl StylisticClassAccessors for CTFontStylisticClass { + fn is_serif(&self) -> bool { + let any_serif_class = kCTFontOldStyleSerifsClass + | kCTFontTransitionalSerifsClass + | kCTFontModernSerifsClass + | kCTFontClarendonSerifsClass + | kCTFontSlabSerifsClass + | kCTFontFreeformSerifsClass; + + return (*self & any_serif_class) != 0; + } + + fn is_sans_serif(&self) -> bool { + return (*self & kCTFontSansSerifClass) != 0; + } + + fn is_script(&self) -> bool { + return (*self & kCTFontScriptsClass) != 0; + } + + fn is_fantasy(&self) -> bool { + return (*self & kCTFontOrnamentalsClass) != 0; + } + + fn is_symbols(&self) -> bool { + return (*self & kCTFontSymbolicClass) != 0; + } +} + +pub type CTFontAttributes = CFDictionary; + +pub type CTFontTraits = CFDictionary; + +pub trait TraitAccessors { + fn symbolic_traits(&self) -> CTFontSymbolicTraits; + fn normalized_weight(&self) -> f64; + fn normalized_width(&self) -> f64; + fn normalized_slant(&self) -> f64; +} + +trait TraitAccessorPrivate { + unsafe fn extract_number_for_key(&self, key: CFStringRef) -> CFNumber; +} + +impl TraitAccessorPrivate for CTFontTraits { + unsafe fn extract_number_for_key(&self, key: CFStringRef) -> CFNumber { + let cftype = self.get_CFType(mem::transmute(key)); + assert!(cftype.instance_of::()); + TCFType::wrap_under_get_rule(mem::transmute(cftype.as_CFTypeRef())) + } + +} + +impl TraitAccessors for CTFontTraits { + fn symbolic_traits(&self) -> CTFontSymbolicTraits { + unsafe { + let number = self.extract_number_for_key(kCTFontSymbolicTrait); + number.to_i64().unwrap() as u32 + } + } + + fn normalized_weight(&self) -> f64 { + unsafe { + let number = self.extract_number_for_key(kCTFontWeightTrait); + number.to_f64().unwrap() + } + } + + fn normalized_width(&self) -> f64 { + unsafe { + let number = self.extract_number_for_key(kCTFontWidthTrait); + number.to_f64().unwrap() + } + } + + fn normalized_slant(&self) -> f64 { + unsafe { + let number = self.extract_number_for_key(kCTFontSlantTrait); + number.to_f64().unwrap() + } + } +} + +/* +* CTFontDescriptor.h +*/ +pub type CTFontOrientation = u32; +pub const kCTFontDefaultOrientation: CTFontOrientation = 0; +pub const kCTFontHorizontalOrientation: CTFontOrientation = 1; +pub const kCTFontVerticalOrientation: CTFontOrientation = 2; + +pub type CTFontPriority = u32; +pub const kCTFontPrioritySystem: CTFontPriority = 10000; +pub const kCTFontPriorityNetwork: CTFontPriority = 20000; +pub const kCTFontPriorityComputer: CTFontPriority = 30000; +pub const kCTFontPriorityUser: CTFontPriority = 40000; +pub const kCTFontPriorityDynamic: CTFontPriority = 50000; +pub const kCTFontPriorityProcess: CTFontPriority = 60000; + +#[repr(C)] +struct __CTFontDescriptor; + +pub type CTFontDescriptorRef = *const __CTFontDescriptor; + +#[derive(Debug)] +pub struct CTFontDescriptor { + obj: CTFontDescriptorRef, +} + +impl Drop for CTFontDescriptor { + fn drop(&mut self) { + unsafe { + CFRelease(self.as_CFTypeRef()) + } + } +} + +impl TCFType for CTFontDescriptor { + #[inline] + fn as_concrete_TypeRef(&self) -> CTFontDescriptorRef { + self.obj + } + + #[inline] + unsafe fn wrap_under_get_rule(reference: CTFontDescriptorRef) -> CTFontDescriptor { + let reference: CTFontDescriptorRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] + unsafe fn wrap_under_create_rule(obj: CTFontDescriptorRef) -> CTFontDescriptor { + CTFontDescriptor { + obj: obj, + } + } + + #[inline] + fn type_id() -> CFTypeID { + unsafe { + CTFontDescriptorGetTypeID() + } + } +} + +impl CTFontDescriptor { + fn get_string_attribute(&self, attribute: CFStringRef) -> Option { + unsafe { + let value = CTFontDescriptorCopyAttribute(self.obj, attribute); + if value.is_null() { + return None + } + + let value: CFType = TCFType::wrap_under_get_rule(value); + assert!(value.instance_of::()); + let s: CFString = TCFType::wrap_under_get_rule(mem::transmute(value.as_CFTypeRef())); + Some(s.to_string()) + } + } + +} + +impl CTFontDescriptor { + pub fn family_name(&self) -> String { + let value = self.get_string_attribute(kCTFontDisplayNameAttribute); + value.expect("A font2 must have a non-null font family name.") + } + + pub fn font_name(&self) -> String { + let value = self.get_string_attribute(kCTFontNameAttribute); + value.expect("A font must have a non-null name.") + } + + pub fn style_name(&self) -> String { + let value = self.get_string_attribute(kCTFontStyleNameAttribute); + value.expect("A font must have a non-null style name.") + } + + pub fn display_name(&self) -> String { + let value = self.get_string_attribute(kCTFontDisplayNameAttribute); + value.expect("A font must have a non-null display name.") + } + + pub fn font_path(&self) -> String { + unsafe { + let value = CTFontDescriptorCopyAttribute(self.obj, kCTFontURLAttribute); + assert!(!value.is_null()); + + let value: CFType = TCFType::wrap_under_get_rule(value); + assert!(value.instance_of::()); + let url: CFURL = TCFType::wrap_under_get_rule(mem::transmute(value.as_CFTypeRef())); + format!("{:?}", url) + } + } +} + +pub fn new_from_attributes(attributes: &CFDictionary) -> CTFontDescriptor { + unsafe { + let result: CTFontDescriptorRef = + CTFontDescriptorCreateWithAttributes(attributes.as_concrete_TypeRef()); + TCFType::wrap_under_create_rule(result) + } +} + +pub fn debug_descriptor(desc: &CTFontDescriptor) { + println!("family: {}", desc.family_name()); + println!("name: {}", desc.font_name()); + println!("style: {}", desc.style_name()); + println!("display: {}", desc.display_name()); + println!("path: {}", desc.font_path()); + desc.show(); +} + +extern { + /* + * CTFontTraits.h + */ + + // font trait constants + pub static kCTFontSymbolicTrait: CFStringRef; + pub static kCTFontWeightTrait: CFStringRef; + pub static kCTFontWidthTrait: CFStringRef; + pub static kCTFontSlantTrait: CFStringRef; + + /* + * CTFontDescriptor.h + */ + + // font attribute constants. Note that the name-related attributes + // here are somewhat flaky. Servo creates CTFont instances and + // then uses CTFontCopyName to get more fine-grained names. + pub static kCTFontURLAttribute: CFStringRef; // value: CFURLRef + pub static kCTFontNameAttribute: CFStringRef; // value: CFStringRef + pub static kCTFontDisplayNameAttribute: CFStringRef; // value: CFStringRef + pub static kCTFontFamilyNameAttribute: CFStringRef; // value: CFStringRef + pub static kCTFontStyleNameAttribute: CFStringRef; // value: CFStringRef + pub static kCTFontTraitsAttribute: CFStringRef; + pub static kCTFontVariationAttribute: CFStringRef; + pub static kCTFontSizeAttribute: CFStringRef; + pub static kCTFontMatrixAttribute: CFStringRef; + pub static kCTFontCascadeListAttribute: CFStringRef; + pub static kCTFontCharacterSetAttribute: CFStringRef; + pub static kCTFontLanguagesAttribute: CFStringRef; + pub static kCTFontBaselineAdjustAttribute: CFStringRef; + pub static kCTFontMacintoshEncodingsAttribute: CFStringRef; + pub static kCTFontFeaturesAttribute: CFStringRef; + pub static kCTFontFeatureSettingsAttribute: CFStringRef; + pub static kCTFontFixedAdvanceAttribute: CFStringRef; + pub static kCTFontOrientationAttribute: CFStringRef; + pub static kCTFontFormatAttribute: CFStringRef; + pub static kCTFontRegistrationScopeAttribute: CFStringRef; + pub static kCTFontPriorityAttribute: CFStringRef; + pub static kCTFontEnabledAttribute: CFStringRef; + + pub fn CTFontDescriptorCopyAttribute(descriptor: CTFontDescriptorRef, + attribute: CFStringRef) -> CFTypeRef; + pub fn CTFontDescriptorCopyAttributes(descriptor: CTFontDescriptorRef) -> CFDictionaryRef; + pub fn CTFontDescriptorCopyLocalizedAttribute(descriptor: CTFontDescriptorRef, + attribute: CFStringRef, + language: *mut CFStringRef) -> CFTypeRef; + pub fn CTFontDescriptorCreateCopyWithAttributes(original: CTFontDescriptorRef, + attributes: CFDictionaryRef) -> CTFontDescriptorRef; + pub fn CTFontDescriptorCreateCopyWithFeature(original: CTFontDescriptorRef, + featureTypeIdentifier: CFNumberRef, + featureSelectorIdentifier: CFNumberRef) -> CTFontDescriptorRef; + pub fn CTFontDescriptorCreateCopyWithVariation(original: CTFontDescriptorRef, + variationIdentifier: CFNumberRef, + variationValue: CGFloat) -> CTFontDescriptorRef; + pub fn CTFontDescriptorCreateMatchingFontDescriptor(descriptor: CTFontDescriptorRef, + mandatoryAttributes: CFSetRef) -> CTFontDescriptorRef; + pub fn CTFontDescriptorCreateWithAttributes(attributes: CFDictionaryRef) -> CTFontDescriptorRef; + pub fn CTFontDescriptorCreateWithNameAndSize(name: CFStringRef, size: CGFloat) -> CTFontDescriptorRef; + pub fn CTFontDescriptorGetTypeID() -> CFTypeID; +} + +extern { + pub fn CTFontDescriptorCreateMatchingFontDescriptors(descriptor: CTFontDescriptorRef, + mandatoryAttributes: CFSetRef) -> CFArrayRef; +} diff --git a/third_party/rust/core-text/src/font_manager.rs b/third_party/rust/core-text/src/font_manager.rs new file mode 100644 index 000000000000..d9eca050996d --- /dev/null +++ b/third_party/rust/core-text/src/font_manager.rs @@ -0,0 +1,40 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use core_foundation::array::CFArrayRef; +use core_foundation::url::CFURLRef; + +extern { + /* + * CTFontManager.h + */ + + // Incomplete function bindings are mostly related to CoreText font matching, which + // we implement in a platform-independent manner using FontMatcher. + + //pub fn CTFontManagerCompareFontFamilyNames + pub fn CTFontManagerCopyAvailableFontURLs() -> CFArrayRef; + pub fn CTFontManagerCopyAvailableFontFamilyNames() -> CFArrayRef; + pub fn CTFontManagerCopyAvailablePostScriptNames() -> CFArrayRef; + pub fn CTFontManagerCreateFontDescriptorsFromURL(fileURL: CFURLRef) -> CFArrayRef; + //pub fn CTFontManagerCreateFontRequestRunLoopSource + //pub fn CTFontManagerEnableFontDescriptors + //pub fn CTFontManagerGetAutoActivationSetting + //pub fn CTFontManagerGetScopeForURL + //pub fn CTFontManagerGetAutoActivationSetting + //pub fn CTFontManagerGetScopeForURL + pub fn CTFontManagerIsSupportedFont(fontURL: CFURLRef) -> bool; + //pub fn CTFontManagerRegisterFontsForURL + //pub fn CTFontManagerRegisterFontsForURLs + //pub fn CTFontManagerRegisterGraphicsFont + //pub fn CTFontManagerSetAutoActivationSetting + //pub fn CTFontManagerUnregisterFontsForURL + //pub fn CTFontManagerUnregisterFontsForURLs + //pub fn CTFontManagerUnregisterGraphicsFont +} diff --git a/third_party/rust/core-text/src/lib.rs b/third_party/rust/core-text/src/lib.rs new file mode 100644 index 000000000000..d564bc60a8c7 --- /dev/null +++ b/third_party/rust/core-text/src/lib.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "core_text"] +#![crate_type = "rlib"] + +#![allow(non_snake_case)] + +extern crate libc; + +extern crate core_foundation; +extern crate core_graphics; + +pub mod font; +pub mod font_collection; +pub mod font_descriptor; +pub mod font_manager; diff --git a/third_party/rust/dwrote/.cargo-checksum.json b/third_party/rust/dwrote/.cargo-checksum.json new file mode 100644 index 000000000000..f5f68448e82a --- /dev/null +++ b/third_party/rust/dwrote/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"172610b244a5ee8a8e2f1f045058b8abf9291d84bb76bf8779d2fd420419c2d6","Cargo.toml":"abcd85b16e3dd0a0b5213e74b9b23c0ac8e9e484d187588d4f64de717904bc88","README.md":"d69d75705e2582721cbfb2d3b4b2af052c71679057a0b2ac53a22c03f1755bba","build.rs":"b40ce243f62825724b4a45092a8e658d71fa952a6840b83f3bee58e719a56d3b","src/bitmap_render_target.rs":"d3b229f85a9804ac52976431657727b410e7d5253283df046e46d98c196f0a3a","src/com_helpers.rs":"fccb4b36379ae3454a88aa32a8e5c09e46ef5f5626266dde1fe5f40a992de39c","src/comptr.rs":"218435689f505769686e07cfc5428852dda90b849a0d48e670f632307f5edc7c","src/font.rs":"9bdf3134c6ad3639eab3da4419c9b43aad2673797f6fdc65841da2c82e1f3af4","src/font_collection.rs":"969fa3abf141dc3504774886f4783fda4a74cd5a198c643f8a77fc1af4e75258","src/font_face.rs":"47fe777fec8102ef665f5c02f57992e3a36c856fc9647ec69d04b7a39828e83b","src/font_family.rs":"403da9f8f9903cbe7f9f79636497b273f9885e200f53af99f9d4e483f11d6889","src/font_file.rs":"60ad02fc25765a2c113175ea372e98a2be0d84aa65fef9246b6a0192e63ff708","src/font_file_loader_impl.rs":"0d304ad99ff1e6874510a1498223329d798ff75b417e3db7e823a695003dfe92","src/gdi_interop.rs":"98922996afc5b8c8304cb65e7c965419003825dfa172a3e11fe69bf3d768551c","src/glyph_run_analysis.rs":"d30d8b41b047815ab5770c730b7a6d09939f2347b4a4257b87bebec08a5794fe","src/helpers.rs":"5d6f164468234ca8806dc1cea117b42dbfae80cc4c9ae965cb0556efdb364682","src/lib.rs":"6f6cc21f3cbe3403beb1d620c59284463a06b588f7344302310b7723b0eafcc2","src/rendering_params.rs":"be1d1c433f76926c285d8ecdb747c5d9cc6a6c10c1a1890c0760cd99755ed471","src/test.rs":"d77e45f8866abeea070cbbafd4cbde62d875292e8d191310a04c70091978547c","src/types.rs":"784235c15d61fb0d001373575169aa473c92af18dcbc1709a5b2bbaa3a7ceb22"},"package":"b5c3d72c5042f43ee02587b5f3256efc6252c2194fbbb0dfa0bd0b6da2491501"} \ No newline at end of file diff --git a/third_party/rust/dwrote/.cargo-ok b/third_party/rust/dwrote/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/dwrote/.gitignore b/third_party/rust/dwrote/.gitignore new file mode 100644 index 000000000000..10fff9e85a5d --- /dev/null +++ b/third_party/rust/dwrote/.gitignore @@ -0,0 +1,5 @@ +target +Cargo.lock +*~ +#~# + diff --git a/third_party/rust/dwrote/Cargo.toml b/third_party/rust/dwrote/Cargo.toml new file mode 100644 index 000000000000..6e6c90980cfd --- /dev/null +++ b/third_party/rust/dwrote/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "dwrote" +description = "Lightweight binding to DirectWrite." +repository = "https://github.com/vvuk/dwrote-rs" +license = "MPL-2.0" +version = "0.1.6" +authors = ["Vladimir Vukicevic "] +build = "build.rs" + +[lib] +name = "dwrote" + +[features] +default = ["codegen"] +nightly = ["serde/unstable"] +codegen = ["serde_codegen", "serde_codegen/with-syntex"] + +[dependencies] +libc = "0.2" +lazy_static = "0.2" +winapi = "0.2" +kernel32-sys = "0.2" +gdi32-sys = "0.2" +serde = "0.8" +serde_derive = {version = "0.8", optional = true} + +[build-dependencies.serde_codegen] +version = "0.8" +default_features = false +optional = true diff --git a/third_party/rust/dwrote/README.md b/third_party/rust/dwrote/README.md new file mode 100644 index 000000000000..d436740898eb --- /dev/null +++ b/third_party/rust/dwrote/README.md @@ -0,0 +1,12 @@ +# dwrote +A thin wrapper around Windows DirectWrite for Rust + +Dwrote provides access to pieces of DirectWrite needed by WebRender +and Servo. It can be easily extended to other parts of DirectWrite, +but full mapping of the DirectWrite API is not a goal (pull requests +accepted, of course). + +There are a few additional helper functions on individual types that +don't exist in DirectWrite, and a few have had their signatures changed, +but for the most part this library attempts to replicate the DirectWrite +API. diff --git a/third_party/rust/dwrote/build.rs b/third_party/rust/dwrote/build.rs new file mode 100644 index 000000000000..c07d8d8a6eba --- /dev/null +++ b/third_party/rust/dwrote/build.rs @@ -0,0 +1,46 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#[cfg(all(feature = "serde_codegen", not(feature = "serde_derive")))] +mod inner { + extern crate serde_codegen; + + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/types.rs"); + let dst = Path::new(&out_dir).join("types.rs"); + + serde_codegen::expand(&src, &dst).unwrap(); + println!("cargo:rerun-if-changed=src/types.rs"); + } +} + +#[cfg(all(feature = "serde_derive", not(feature = "serde_codegen")))] +mod inner { + pub fn main() {} +} + +#[cfg(all(feature = "serde_codegen", feature = "serde_derive"))] +mod inner { + pub fn main() { + panic!("serde_codegen and serde_derive are both used. \ + You probably forgot --no-default-features.") + } +} + +#[cfg(not(any(feature = "serde_codegen", feature = "serde_derive")))] +mod inner { + pub fn main() { + panic!("Neither serde_codegen nor serde_derive are used. " + "You probably want --features serde_derive --no-default-features.") + } +} + +fn main() { + inner::main(); +} diff --git a/third_party/rust/dwrote/src/bitmap_render_target.rs b/third_party/rust/dwrote/src/bitmap_render_target.rs new file mode 100644 index 000000000000..61fd03d6c768 --- /dev/null +++ b/third_party/rust/dwrote/src/bitmap_render_target.rs @@ -0,0 +1,124 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::slice; +use std::cell::UnsafeCell; +use std::mem::{zeroed, size_of}; + +use comptr::ComPtr; +use winapi; +use gdi32; +use super::{FontFace, RenderingParams}; + +#[derive(Debug)] +pub struct BitmapRenderTarget { + native: UnsafeCell>, +} + +impl BitmapRenderTarget { + pub fn take(native: ComPtr) -> BitmapRenderTarget { + BitmapRenderTarget { + native: UnsafeCell::new(native), + } + } + + pub unsafe fn as_ptr(&self) -> *mut winapi::IDWriteBitmapRenderTarget { + (*self.native.get()).as_ptr() + } + + // A dip is 1/96th of an inch, so this value is the number of pixels per inch divided by 96. + pub fn set_pixels_per_dip(&self, ppd: f32) { + unsafe { + (*self.native.get()).SetPixelsPerDip(ppd); + } + } + + pub fn get_memory_dc(&self) -> winapi::HDC { + unsafe { + (*self.native.get()).GetMemoryDC() + } + } + + pub fn draw_glyph_run(&self, + baseline_origin_x: f32, + baseline_origin_y: f32, + measuring_mode: winapi::DWRITE_MEASURING_MODE, + font_face: &FontFace, + em_size: f32, + glyph_indices: &[u16], + glyph_advances: &[f32], + glyph_offsets: &[winapi::DWRITE_GLYPH_OFFSET], + rendering_params: &RenderingParams, + color: &(f32, f32, f32)) + -> winapi::RECT + { + unsafe { + assert!(glyph_indices.len() == glyph_advances.len()); + assert!(glyph_indices.len() == glyph_offsets.len()); + + let r = (color.0 * 255.0) as u8; + let g = (color.1 * 255.0) as u8; + let b = (color.2 * 255.0) as u8; + + let mut glyph_run: winapi::DWRITE_GLYPH_RUN = zeroed(); + glyph_run.fontFace = font_face.as_ptr(); + glyph_run.fontEmSize = em_size; + glyph_run.glyphCount = glyph_indices.len() as u32; + glyph_run.glyphIndices = glyph_indices.as_ptr(); + glyph_run.glyphAdvances = glyph_advances.as_ptr(); + glyph_run.glyphOffsets = glyph_offsets.as_ptr(); + glyph_run.isSideways = 0; + glyph_run.bidiLevel = 0; + + let mut rect: winapi::RECT = zeroed(); + let hr = (*self.native.get()).DrawGlyphRun(baseline_origin_x, + baseline_origin_y, + measuring_mode, + &glyph_run, + rendering_params.as_ptr(), + winapi::RGB(r,g,b), + &mut rect); + assert!(hr == 0); + rect + } + } + + // This function expects to have glyphs rendered in WHITE, + // and pulls out a u8 vector of width*height*4 size with + // the coverage value (we pull out R) broadcast to the alpha + // channel, with the color white. That is, it performs: + // RGBX -> xxxR, where xxx = 0xff + pub fn get_opaque_values_as_mask(&self) -> Vec { + // Now grossness to pull out the pixels + unsafe { + let memory_dc = self.get_memory_dc(); + let mut bitmap: winapi::BITMAP = zeroed(); + let ret = gdi32::GetObjectW(gdi32::GetCurrentObject(memory_dc, winapi::OBJ_BITMAP), + size_of::() as i32, + &mut bitmap as *mut _ as *mut winapi::c_void); + assert!(ret == size_of::() as i32); + assert!(bitmap.bmBitsPixel == 32); + + let width = bitmap.bmWidth as usize; + let stride = bitmap.bmWidthBytes as usize; + let height = bitmap.bmHeight as usize; + + let mut out_bytes: Vec = vec![0; width * height * 4]; + let mut out_u32 = slice::from_raw_parts_mut(out_bytes.as_mut_ptr() as *mut u32, + width * height); + + for row in 0..height { + let in_offset = (row * stride) as isize; + let in_u32 = slice::from_raw_parts(bitmap.bmBits.offset(in_offset) as *const u32, + width); + for col in 0..width { + let r = in_u32[col] & 0xff; + out_u32[width*row + col] = (r << 24) | (0x00ffffffu32); + } + } + + out_bytes + } + } +} diff --git a/third_party/rust/dwrote/src/com_helpers.rs b/third_party/rust/dwrote/src/com_helpers.rs new file mode 100644 index 000000000000..92bb45d76bfb --- /dev/null +++ b/third_party/rust/dwrote/src/com_helpers.rs @@ -0,0 +1,116 @@ + +// This is only handy for implementing a single-interface-implementing IUnknown. +// +// it assumes that there's a UuidOf$interface GUID globally defined + +DEFINE_GUID!{UuidOfIUnknown, 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} + +macro_rules! guid_equals { + ($left:expr, $right:expr) => { + $left.Data1 == $right.Data1 && + $left.Data2 == $right.Data2 && + $left.Data3 == $right.Data3 && + $left.Data4 == $right.Data4 + } +} + +macro_rules! implement_iunknown { + ($interface:ident, $iuud:ident, $typ:ident) => { + IUnknownVtbl { + QueryInterface: { + unsafe extern "system" fn QueryInterface(This: *mut IUnknown, + riid: REFIID, + ppvObject: *mut *mut c_void) -> HRESULT { + let this = if guid_equals!(*riid, $iuud) { + mem::transmute(This) + } else if guid_equals!(*riid, UuidOfIUnknown) { + mem::transmute(This) + } else { + return $crate::winapi::E_NOINTERFACE; + }; + + (*This).AddRef(); + *ppvObject = this; + return S_OK; + } + QueryInterface + }, + AddRef: { + unsafe extern "system" fn AddRef(This: *mut IUnknown) -> ULONG { + let this = $typ::from_interface(This); + let count = this.refcount.fetch_add(1, atomic::Ordering::Relaxed) + 1; + count as ULONG + } + AddRef + }, + Release: { + unsafe extern "system" fn Release(This: *mut IUnknown) -> ULONG { + let this = $typ::from_interface(This); + let count = this.refcount.fetch_sub(1, atomic::Ordering::Release) - 1; + if count == 0 { + FontFileStream::destroy(This); + } + count as ULONG + } + Release + }, + } + }; + (static $interface:ident, $iuud:ident, $typ:ident) => { + IUnknownVtbl { + QueryInterface: { + unsafe extern "system" fn QueryInterface(This: *mut IUnknown, + riid: REFIID, + ppvObject: *mut *mut c_void) -> HRESULT { + let this = if guid_equals!(*riid, $iuud) { + mem::transmute(This) + } else if guid_equals!(*riid, UuidOfIUnknown) { + mem::transmute(This) + } else { + return $crate::winapi::E_NOINTERFACE; + }; + + (*This).AddRef(); + *ppvObject = this; + return S_OK; + } + QueryInterface + }, + AddRef: { + unsafe extern "system" fn AddRef(_This: *mut IUnknown) -> ULONG { + 1 + } + AddRef + }, + Release: { + unsafe extern "system" fn Release(_This: *mut IUnknown) -> ULONG { + 1 + } + Release + }, + } + } +} + +#[repr(C)] +pub struct ComRepr(*const Vtbl, Type); + +pub trait Com where Self: Sized { + type Vtbl: 'static; + + fn vtbl() -> &'static Self::Vtbl; + + fn into_interface(self) -> *mut Interface { + let com = Box::new(ComRepr(Self::vtbl(), self)); + Box::into_raw(com) as *mut Interface + } + + unsafe fn from_interface<'a>(thing: *mut Interface) -> &'a mut Self { + &mut (*(thing as *mut ComRepr)).1 + } + + unsafe fn destroy(thing: *mut Interface) { + Box::from_raw(thing as *mut ComRepr); + } +} + diff --git a/third_party/rust/dwrote/src/comptr.rs b/third_party/rust/dwrote/src/comptr.rs new file mode 100644 index 000000000000..4f9dbc196ddc --- /dev/null +++ b/third_party/rust/dwrote/src/comptr.rs @@ -0,0 +1,115 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::ops::{Deref, DerefMut}; +use std::ptr; +use winapi::{IUnknown, REFIID, S_OK, E_NOINTERFACE}; + +#[derive(Debug)] +pub struct ComPtr { + ptr: *mut T, +} + +impl ComPtr { + pub fn new() -> Self { + ComPtr { ptr: ptr::null_mut() } + } + + pub fn from_ptr(ptr: *mut T) -> Self { + unsafe { + if !ptr.is_null() { + (*(ptr as *mut IUnknown)).AddRef(); + } + } + ComPtr { ptr: ptr } + } + + pub fn already_addrefed(ptr: *mut T) -> Self { + ComPtr { ptr: ptr } + } + + pub fn getter_addrefs(&mut self) -> *mut *mut Q { + self.release(); + return &mut self.ptr as *mut *mut _ as *mut *mut Q; + } + + pub fn as_ptr(&self) -> *mut T { + self.ptr + } + + pub fn query_interface(&self, iid: REFIID) -> Option> { + if self.ptr.is_null() { + return None; + } + + unsafe { + let mut p = ComPtr::::new(); + let hr = (*(self.ptr as *mut IUnknown)).QueryInterface(iid, p.getter_addrefs()); + if hr == S_OK { + return Some(p); + } + assert!(hr == E_NOINTERFACE); + return None; + } + } + + pub fn addref(&self) { + unsafe { + assert!(!self.ptr.is_null()); + (*(self.ptr as *mut IUnknown)).AddRef(); + } + } + + pub fn release(&self) { + unsafe { + if !self.ptr.is_null() { + (*(self.ptr as *mut IUnknown)).Release(); + } + } + } + + pub fn forget(&mut self) -> *mut T { + let ptr = self.ptr; + self.ptr = ptr::null_mut(); + ptr + } +} + +impl Clone for ComPtr { + fn clone(&self) -> Self { + if !self.ptr.is_null() { + self.addref(); + } + ComPtr { ptr: self.ptr } + } +} + +impl Deref for ComPtr { + type Target = T; + fn deref(&self) -> &T { + assert!(!self.ptr.is_null()); + unsafe { &mut *self.ptr } + } +} + +impl DerefMut for ComPtr { + fn deref_mut(&mut self) -> &mut T { + assert!(!self.ptr.is_null()); + unsafe { &mut *self.ptr } + } +} + +impl PartialEq for ComPtr { + fn eq(&self, other: &ComPtr) -> bool { + self.ptr == other.ptr + } +} + +impl Drop for ComPtr { + fn drop(&mut self) { + self.release(); + } +} + +unsafe impl Send for ComPtr {} diff --git a/third_party/rust/dwrote/src/font.rs b/third_party/rust/dwrote/src/font.rs new file mode 100644 index 000000000000..07037117fa96 --- /dev/null +++ b/third_party/rust/dwrote/src/font.rs @@ -0,0 +1,87 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::cell::UnsafeCell; + +use comptr::ComPtr; +use winapi; +use std::mem; + +use super::*; +use helpers::*; + +#[derive(Debug)] +pub struct Font { + native: UnsafeCell>, +} + +impl Font { + pub fn take(native: ComPtr) -> Font { + Font { + native: UnsafeCell::new(native), + } + } + + pub unsafe fn as_ptr(&self) -> *mut winapi::IDWriteFont { + (*self.native.get()).as_ptr() + } + + pub fn to_descriptor(&self) -> FontDescriptor { + FontDescriptor { + family_name: self.family_name(), + stretch: self.stretch(), + style: self.style(), + weight: self.weight(), + } + } + + pub fn stretch(&self) -> FontStretch { + unsafe { + mem::transmute::((*self.native.get()).GetStretch().0) + } + } + + pub fn style(&self) -> FontStyle { + unsafe { + mem::transmute::((*self.native.get()).GetStyle().0) + } + } + + pub fn weight(&self) -> FontWeight { + unsafe { + mem::transmute::((*self.native.get()).GetWeight().0) + } + } + + pub fn family_name(&self) -> String { + unsafe { + let mut family: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFontFamily(family.getter_addrefs()); + assert!(hr == 0); + + FontFamily::take(family).name() + } + } + + pub fn face_name(&self) -> String { + unsafe { + let mut names: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFaceNames(names.getter_addrefs()); + assert!(hr == 0); + + get_locale_string(&mut names) + } + } + + pub fn create_font_face(&self) -> FontFace { + // FIXME create_font_face should cache the FontFace and return it, + // there's a 1:1 relationship + unsafe { + let mut face: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).CreateFontFace(face.getter_addrefs()); + assert!(hr == 0); + FontFace::take(face) + } + } +} diff --git a/third_party/rust/dwrote/src/font_collection.rs b/third_party/rust/dwrote/src/font_collection.rs new file mode 100644 index 000000000000..96a49d74f80e --- /dev/null +++ b/third_party/rust/dwrote/src/font_collection.rs @@ -0,0 +1,135 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use comptr::ComPtr; +use winapi; +use winapi::FALSE; +use std::cell::UnsafeCell; + +use super::{DWriteFactory, FontFamily, Font, FontFace, FontDescriptor}; +use helpers::*; + +#[derive(Debug)] +pub struct FontCollectionFamilyIterator { + collection: ComPtr, + curr: u32, + count: u32, +} + +impl Iterator for FontCollectionFamilyIterator { + type Item = FontFamily; + fn next(&mut self) -> Option { + if self.curr == self.count { + return None; + } + + unsafe { + let mut family: ComPtr = ComPtr::new(); + let hr = self.collection.GetFontFamily(self.curr, family.getter_addrefs()); + assert!(hr == 0); + self.curr += 1; + Some(FontFamily::take(family)) + } + } +} + +pub struct FontCollection { + native: UnsafeCell>, +} + +impl FontCollection { + pub fn system() -> FontCollection { + unsafe { + let mut native: ComPtr = ComPtr::new(); + let hr = (*DWriteFactory()).GetSystemFontCollection(native.getter_addrefs(), FALSE); + assert!(hr == 0); + + FontCollection { + native: UnsafeCell::new(native) + } + } + } + + pub fn take(native: ComPtr) -> FontCollection { + FontCollection { + native: UnsafeCell::new(native) + } + } + + pub unsafe fn as_ptr(&self) -> *mut winapi::IDWriteFontCollection { + (*self.native.get()).as_ptr() + } + + + pub fn families_iter(&self) -> FontCollectionFamilyIterator { + unsafe { + FontCollectionFamilyIterator { + collection: (*self.native.get()).clone(), + curr: 0, + count: (*self.native.get()).GetFontFamilyCount(), + } + } + } + + pub fn get_font_family_count(&self) -> u32 { + unsafe { + (*self.native.get()).GetFontFamilyCount() + } + } + + pub fn get_font_family(&self, index: u32) -> FontFamily { + unsafe { + let mut family: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFontFamily(index, family.getter_addrefs()); + assert!(hr == 0); + FontFamily::take(family) + } + } + + // Find a font matching the given font descriptor in this + // font collection. + pub fn get_font_from_descriptor(&self, desc: &FontDescriptor) -> Option { + if let Some(family) = self.get_font_family_by_name(&desc.family_name) { + let font = family.get_first_matching_font(desc.weight, desc.stretch, desc.style); + // Exact matches only here + if font.weight() == desc.weight && + font.stretch() == desc.stretch && + font.style() == desc.style + { + return Some(font); + } + } + + None + } + + pub fn get_font_from_face(&self, face: &FontFace) -> Option { + unsafe { + let mut font: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFontFromFontFace(face.as_ptr(), font.getter_addrefs()); + if hr != 0 { + return None; + } + Some(Font::take(font)) + } + } + + pub fn get_font_family_by_name(&self, family_name: &str) -> Option { + unsafe { + let mut index: u32 = 0; + let mut exists: winapi::BOOL = winapi::FALSE; + let hr = (*self.native.get()).FindFamilyName(family_name.to_wide_null().as_ptr(), &mut index, &mut exists); + assert!(hr == 0); + if exists == winapi::FALSE { + return None; + } + + let mut family: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFontFamily(index, family.getter_addrefs()); + assert!(hr == 0); + + Some(FontFamily::take(family)) + } + } +} diff --git a/third_party/rust/dwrote/src/font_face.rs b/third_party/rust/dwrote/src/font_face.rs new file mode 100644 index 000000000000..5e0a5af61246 --- /dev/null +++ b/third_party/rust/dwrote/src/font_face.rs @@ -0,0 +1,137 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::slice; +use std::ptr; +use std::cell::UnsafeCell; +use std::mem::zeroed; + +use comptr::ComPtr; +use super::{FontMetrics, FontFile}; + +use winapi; + +#[derive(Debug)] +pub struct FontFace { + native: UnsafeCell>, + metrics: FontMetrics, +} + +impl FontFace { + pub fn take(native: ComPtr) -> FontFace { + unsafe { + let mut metrics: FontMetrics = zeroed(); + let cell = UnsafeCell::new(native); + (*cell.get()).GetMetrics(&mut metrics); + FontFace { + native: cell, + metrics: metrics, + } + } + } + + pub unsafe fn as_ptr(&self) -> *mut winapi::IDWriteFontFace { + (*self.native.get()).as_ptr() + } + + pub fn get_files(&self) -> Vec { + unsafe { + let mut number_of_files: u32 = 0; + let hr = (*self.native.get()).GetFiles(&mut number_of_files, ptr::null_mut()); + assert!(hr == 0); + + let mut file_ptrs: Vec<*mut winapi::IDWriteFontFile> = + vec![ptr::null_mut(); number_of_files as usize]; + let hr = (*self.native.get()).GetFiles(&mut number_of_files, file_ptrs.as_mut_ptr()); + assert!(hr == 0); + + file_ptrs.iter().map(|p| FontFile::take(ComPtr::already_addrefed(*p))).collect() + } + } + + pub fn get_glyph_count(&self) -> u16 { + unsafe { + (*self.native.get()).GetGlyphCount() + } + } + + pub fn metrics(&self) -> &FontMetrics { + &self.metrics + } + + pub fn get_metrics(&self) -> FontMetrics { + unsafe { + let mut metrics: winapi::DWRITE_FONT_METRICS = zeroed(); + (*self.native.get()).GetMetrics(&mut metrics); + metrics + } + } + + pub fn get_glyph_indices(&self, code_points: &[u32]) -> Vec { + unsafe { + let mut glyph_indices: Vec = vec![0; code_points.len()]; + let hr = (*self.native.get()).GetGlyphIndices(code_points.as_ptr(), + code_points.len() as u32, + glyph_indices.as_mut_ptr()); + assert!(hr == 0); + glyph_indices + } + } + + pub fn get_design_glyph_metrics(&self, glyph_indices: &[u16], is_sideways: bool) -> Vec { + unsafe { + let mut metrics: Vec = vec![zeroed(); glyph_indices.len()]; + let hr = (*self.native.get()).GetDesignGlyphMetrics(glyph_indices.as_ptr(), + glyph_indices.len() as u32, + metrics.as_mut_ptr(), + is_sideways as winapi::BOOL); + assert!(hr == 0); + metrics + } + } + + pub fn get_gdi_compatible_glyph_metrics(&self, em_size: f32, pixels_per_dip: f32, transform: *const winapi::DWRITE_MATRIX, + use_gdi_natural: bool, glyph_indices: &[u16], is_sideways: bool) + -> Vec + { + unsafe { + let mut metrics: Vec = vec![zeroed(); glyph_indices.len()]; + let hr = (*self.native.get()).GetGdiCompatibleGlyphMetrics(em_size, pixels_per_dip, + transform, + use_gdi_natural as winapi::BOOL, + glyph_indices.as_ptr(), + glyph_indices.len() as u32, + metrics.as_mut_ptr(), + is_sideways as winapi::BOOL); + assert!(hr == 0); + metrics + } + } + + pub fn get_font_table(&self, opentype_table_tag: u32) -> Option> { + unsafe { + let mut table_data_ptr: *const u8 = ptr::null_mut(); + let mut table_size: u32 = 0; + let mut table_context: *mut winapi::c_void = ptr::null_mut(); + let mut exists: winapi::BOOL = winapi::FALSE; + + let hr = (*self.native.get()).TryGetFontTable(opentype_table_tag, + &mut table_data_ptr as *mut *const _ as *mut *const winapi::c_void, + &mut table_size, + &mut table_context, + &mut exists); + assert!(hr == 0); + + if exists == winapi::FALSE { + return None; + } + + let table_bytes = slice::from_raw_parts(table_data_ptr, table_size as usize).to_vec(); + + (*self.native.get()).ReleaseFontTable(table_context); + + Some(table_bytes) + } + } +} diff --git a/third_party/rust/dwrote/src/font_family.rs b/third_party/rust/dwrote/src/font_family.rs new file mode 100644 index 000000000000..3e802e56cdcc --- /dev/null +++ b/third_party/rust/dwrote/src/font_family.rs @@ -0,0 +1,76 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::cell::UnsafeCell; + +use comptr::ComPtr; +use winapi; + +use super::*; +use helpers::*; + +#[derive(Debug)] +pub struct FontFamily { + native: UnsafeCell>, +} + +impl FontFamily { + pub fn take(native: ComPtr) -> FontFamily { + FontFamily { + native: UnsafeCell::new(native) + } + } + + pub unsafe fn as_ptr(&self) -> *mut winapi::IDWriteFontFamily { + (*self.native.get()).as_ptr() + } + + pub fn name(&self) -> String { + unsafe { + let mut family_names: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFamilyNames(family_names.getter_addrefs()); + assert!(hr == 0); + + get_locale_string(&mut family_names) + } + } + + pub fn get_first_matching_font(&self, + weight: FontWeight, + stretch: FontStretch, + style: FontStyle) + -> Font + { + unsafe { + let mut font: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFirstMatchingFont(weight.t(), stretch.t(), style.t(), font.getter_addrefs()); + assert!(hr == 0); + Font::take(font) + } + } + + pub fn get_font_collection(&self) -> FontCollection { + unsafe { + let mut collection: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFontCollection(collection.getter_addrefs()); + assert!(hr == 0); + FontCollection::take(collection) + } + } + + pub fn get_font_count(&self) -> u32 { + unsafe { + (*self.native.get()).GetFontCount() + } + } + + pub fn get_font(&self, index: u32) -> Font { + unsafe { + let mut font: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetFont(index, font.getter_addrefs()); + assert!(hr == 0); + Font::take(font) + } + } +} diff --git a/third_party/rust/dwrote/src/font_file.rs b/third_party/rust/dwrote/src/font_file.rs new file mode 100644 index 000000000000..f68f25abcbc7 --- /dev/null +++ b/third_party/rust/dwrote/src/font_file.rs @@ -0,0 +1,126 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::slice; +use std::ptr; +use std::cell::UnsafeCell; + +use comptr::ComPtr; + +use winapi; + +use font_file_loader_impl::DataFontHelper; +use font_face::FontFace; +use super::DWriteFactory; + +#[derive(Debug)] +pub struct FontFile { + native: UnsafeCell>, + data_key: usize, + face_type: winapi::DWRITE_FONT_FACE_TYPE, +} + +impl FontFile { + pub fn new_from_data(data: &[u8]) -> Option { + let (font_file, key) = DataFontHelper::register_font_data(data); + + let mut ff = FontFile { + native: UnsafeCell::new(font_file), + data_key: key, + face_type: winapi::DWRITE_FONT_FACE_TYPE_UNKNOWN, + }; + + if ff.analyze() == false { + DataFontHelper::unregister_font_data(key); + return None; + } + + Some(ff) + } + + fn analyze(&mut self) -> bool { + let mut face_type = winapi::DWRITE_FONT_FACE_TYPE_UNKNOWN; + unsafe { + let mut supported = 0; + let mut _file_type = winapi::DWRITE_FONT_FILE_TYPE_UNKNOWN; + let mut _num_faces = 0; + + let hr = (*self.as_ptr()).Analyze(&mut supported, &mut _file_type, &mut face_type, &mut _num_faces); + if hr != 0 || supported == 0 { + return false; + } + } + self.face_type = face_type; + true + } + + pub fn take(native: ComPtr) -> FontFile { + let mut ff = FontFile { + native: UnsafeCell::new(native), + data_key: 0, + face_type: winapi::DWRITE_FONT_FACE_TYPE_UNKNOWN, + }; + ff.analyze(); + ff + } + + pub fn data_key(&self) -> Option { + if self.data_key != 0 { + Some(self.data_key) + } else { + None + } + } + + pub unsafe fn as_ptr(&self) -> *mut winapi::IDWriteFontFile { + (*self.native.get()).as_ptr() + } + + // This is a helper to read the contents of this FontFile, + // without requiring callers to deal with loaders, keys, + // or streams. + pub fn get_font_file_bytes(&self) -> Vec { + unsafe { + let mut ref_key: *const winapi::c_void = ptr::null(); + let mut ref_key_size: u32 = 0; + let hr = (*self.native.get()).GetReferenceKey(&mut ref_key, &mut ref_key_size); + assert!(hr == 0); + + let mut loader: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).GetLoader(loader.getter_addrefs()); + assert!(hr == 0); + + let mut stream: ComPtr = ComPtr::new(); + let hr = loader.CreateStreamFromKey(ref_key, ref_key_size, stream.getter_addrefs()); + assert!(hr == 0); + + let mut file_size: u64 = 0; + let hr = stream.GetFileSize(&mut file_size); + assert!(hr == 0); + + let mut fragment_start: *const winapi::c_void = ptr::null(); + let mut fragment_context: *mut winapi::c_void = ptr::null_mut(); + let hr = stream.ReadFileFragment(&mut fragment_start, 0, file_size, &mut fragment_context); + assert!(hr == 0); + + let in_ptr = slice::from_raw_parts(fragment_start as *const u8, file_size as usize); + let bytes = in_ptr.to_vec(); + + stream.ReleaseFileFragment(fragment_context); + + bytes + } + } + + pub fn create_face(&self, face_index: u32, simulations: winapi::DWRITE_FONT_SIMULATIONS) -> FontFace { + unsafe { + let mut face: ComPtr = ComPtr::new(); + let ptr = self.as_ptr(); + let hr = (*DWriteFactory()).CreateFontFace(self.face_type, 1, &ptr, + face_index, simulations, face.getter_addrefs()); + assert!(hr == 0); + FontFace::take(face) + } + } +} diff --git a/third_party/rust/dwrote/src/font_file_loader_impl.rs b/third_party/rust/dwrote/src/font_file_loader_impl.rs new file mode 100644 index 000000000000..3c99733bbc43 --- /dev/null +++ b/third_party/rust/dwrote/src/font_file_loader_impl.rs @@ -0,0 +1,200 @@ +#![allow(non_snake_case, non_upper_case_globals)] + +use std::{mem, ptr}; +use std::collections::HashMap; +use std::sync::{Mutex, atomic}; +use std::marker::Send; +use winapi::{IUnknown, IUnknownVtbl}; +use winapi::{IDWriteFontFileStream, IDWriteFontFileStreamVtbl}; +use winapi::{IDWriteFontFileLoader, IDWriteFontFileLoaderVtbl}; +use winapi::IDWriteFontFile; +use winapi::{E_FAIL, E_INVALIDARG, E_NOTIMPL, S_OK}; +use winapi::{c_void, UINT32, UINT64, ULONG, HRESULT, REFIID}; + +use super::DWriteFactory; +use comptr::ComPtr; +use com_helpers::*; + +struct FontFileLoader; + +DEFINE_GUID!{UuidOfIDWriteFontFileLoader, 0x727cad4e, 0xd6af, 0x4c9e, 0x8a, 0x08, 0xd6, 0x95, 0xb1, 0x1c, 0xaa, 0x49} +DEFINE_GUID!{UuidOfIDWriteFontFileStream, 0x6d4865fe, 0x0ab8, 0x4d91, 0x8f, 0x62, 0x5d, 0xd6, 0xbe, 0x34, 0xa3, 0xe0} + +const FontFileLoaderVtbl: &'static IDWriteFontFileLoaderVtbl = &IDWriteFontFileLoaderVtbl { + parent: implement_iunknown!(static IDWriteFontFileLoader, UuidOfIDWriteFontFileLoader, FontFileLoader), + CreateStreamFromKey: { + unsafe extern "system" fn CreateStreamFromKey( + _This: *mut IDWriteFontFileLoader, + fontFileReferenceKey: *const c_void, + fontFileReferenceKeySize: UINT32, + fontFileStream: *mut *mut IDWriteFontFileStream) -> HRESULT + { + if fontFileReferenceKey.is_null() || fontFileStream.is_null() { + return E_INVALIDARG + } + assert!(fontFileReferenceKeySize == mem::size_of::() as UINT32); + let key = *(fontFileReferenceKey as *const usize); + let stream = match FONT_FILE_STREAM_MAP.lock().unwrap().get_mut(&key) { + None => { + *fontFileStream = ptr::null_mut(); + return E_FAIL + } + Some(file_stream) => { + file_stream.as_ptr() + } + }; + + *fontFileStream = stream; + S_OK + } + CreateStreamFromKey + } +}; + +impl Com for FontFileLoader { + type Vtbl = IDWriteFontFileLoaderVtbl; + fn vtbl() -> &'static IDWriteFontFileLoaderVtbl { FontFileLoaderVtbl } +} + +impl Com for FontFileLoader { + type Vtbl = IUnknownVtbl; + fn vtbl() -> &'static IUnknownVtbl { &FontFileLoaderVtbl.parent } +} + +impl FontFileLoader { + pub fn new() -> FontFileLoader { + FontFileLoader + } +} + +unsafe impl Send for FontFileLoader {} +unsafe impl Sync for FontFileLoader {} + +struct FontFileStream { + refcount: atomic::AtomicUsize, + data: Vec, +} + +const FontFileStreamVtbl: &'static IDWriteFontFileStreamVtbl = &IDWriteFontFileStreamVtbl { + parent: implement_iunknown!(IDWriteFontFileStream, UuidOfIDWriteFontFileStream, FontFileStream), + ReadFileFragment: { + unsafe extern "system" fn ReadFileFragment( + This: *mut IDWriteFontFileStream, + fragmentStart: *mut *const c_void, + fileOffset: UINT64, + fragmentSize: UINT64, + fragmentContext: *mut *mut c_void) -> HRESULT + { + let this = FontFileStream::from_interface(This); + *fragmentContext = ptr::null_mut(); + if (fileOffset + fragmentSize) as usize > this.data.len() { + return E_INVALIDARG + } + let index = fileOffset as usize; + *fragmentStart = this.data[index..].as_mut_ptr() as *const c_void; + S_OK + } + ReadFileFragment + }, + ReleaseFileFragment: { + unsafe extern "system" fn ReleaseFileFragment( + _This: *mut IDWriteFontFileStream, + _fragmentContext: *mut c_void) + { + } + ReleaseFileFragment + }, + GetFileSize: { + unsafe extern "system" fn GetFileSize( + This: *mut IDWriteFontFileStream, + fileSize: *mut UINT64) -> HRESULT + { + let this = FontFileStream::from_interface(This); + *fileSize = this.data.len() as UINT64; + S_OK + } + GetFileSize + }, + GetLastWriteTime: { + unsafe extern "system" fn GetLastWriteTime( + _This: *mut IDWriteFontFileStream, + _lastWriteTime: *mut UINT64) -> HRESULT + { + E_NOTIMPL + } + GetLastWriteTime + }, +}; + +impl FontFileStream { + pub fn new(data: &[u8]) -> FontFileStream { + FontFileStream { + refcount: atomic::ATOMIC_USIZE_INIT, + data: data.to_vec(), + } + } +} + +impl Com for FontFileStream { + type Vtbl = IDWriteFontFileStreamVtbl; + fn vtbl() -> &'static IDWriteFontFileStreamVtbl { FontFileStreamVtbl } +} + +impl Com for FontFileStream { + type Vtbl = IUnknownVtbl; + fn vtbl() -> &'static IUnknownVtbl { &FontFileStreamVtbl.parent } +} + +static mut FONT_FILE_KEY: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT; + +lazy_static! { + static ref FONT_FILE_STREAM_MAP: Mutex>> = { + Mutex::new(HashMap::new()) + }; + + static ref FONT_FILE_LOADER: Mutex> = { + let ffl_native = FontFileLoader::new(); + let ffl = ComPtr::::from_ptr(ffl_native.into_interface()); + unsafe { + let hr = (*DWriteFactory()).RegisterFontFileLoader(ffl.as_ptr()); + assert!(hr == 0); + } + Mutex::new(ffl) + }; +} + +pub struct DataFontHelper; + +impl DataFontHelper { + pub fn register_font_data(font_data: &[u8]) -> (ComPtr, usize) { + unsafe { + let key = FONT_FILE_KEY.fetch_add(1, atomic::Ordering::Relaxed); + let font_file_stream_native = FontFileStream::new(font_data); + let font_file_stream = ComPtr::from_ptr(font_file_stream_native.into_interface()); + { + let mut map = FONT_FILE_STREAM_MAP.lock().unwrap(); + map.insert(key, font_file_stream); + } + + let mut font_file: ComPtr = ComPtr::new(); + { + let loader = FONT_FILE_LOADER.lock().unwrap(); + let hr = (*DWriteFactory()).CreateCustomFontFileReference( + mem::transmute(&key), + mem::size_of::() as UINT32, + loader.as_ptr(), + font_file.getter_addrefs()); + assert!(hr == S_OK); + } + + (font_file, key) + } + } + + pub fn unregister_font_data(key: usize) { + let mut map = FONT_FILE_STREAM_MAP.lock().unwrap(); + if map.remove(&key).is_none() { + panic!("unregister_font_data: trying to unregister key that is no longer registered"); + } + } +} \ No newline at end of file diff --git a/third_party/rust/dwrote/src/gdi_interop.rs b/third_party/rust/dwrote/src/gdi_interop.rs new file mode 100644 index 000000000000..ea01376259f0 --- /dev/null +++ b/third_party/rust/dwrote/src/gdi_interop.rs @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::ptr; +use std::cell::UnsafeCell; + +use comptr::ComPtr; +use winapi; +use super::{DWriteFactory, BitmapRenderTarget}; + +#[derive(Debug)] +pub struct GdiInterop { + native: UnsafeCell>, +} + +impl GdiInterop { + pub fn create() -> GdiInterop { + unsafe { + let mut native: ComPtr = ComPtr::new(); + let hr = (*DWriteFactory()).GetGdiInterop(native.getter_addrefs()); + assert!(hr == 0); + GdiInterop::take(native) + } + } + + pub fn take(native: ComPtr) -> GdiInterop { + GdiInterop { + native: UnsafeCell::new(native), + } + } + + pub fn create_bitmap_render_target(&self, width: u32, height: u32) -> BitmapRenderTarget { + unsafe { + let mut native: ComPtr = ComPtr::new(); + let hr = (*self.native.get()).CreateBitmapRenderTarget(ptr::null_mut(), + width, height, + native.getter_addrefs()); + assert!(hr == 0); + BitmapRenderTarget::take(native) + } + } +} diff --git a/third_party/rust/dwrote/src/glyph_run_analysis.rs b/third_party/rust/dwrote/src/glyph_run_analysis.rs new file mode 100644 index 000000000000..160e8ee14cb0 --- /dev/null +++ b/third_party/rust/dwrote/src/glyph_run_analysis.rs @@ -0,0 +1,72 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::ptr; +use std::cell::UnsafeCell; + +use comptr::ComPtr; +use winapi; +use std::mem; +use super::DWriteFactory; + +#[derive(Debug)] +pub struct GlyphRunAnalysis { + native: UnsafeCell>, +} + +impl GlyphRunAnalysis { + pub fn create(glyph_run: &winapi::DWRITE_GLYPH_RUN, + pixels_per_dip: f32, + transform: Option, + rendering_mode: winapi::DWRITE_RENDERING_MODE, + measuring_mode: winapi::DWRITE_MEASURING_MODE, + baseline_x: f32, + baseline_y: f32) -> GlyphRunAnalysis + { + unsafe { + let mut native: ComPtr = ComPtr::new(); + let hr = (*DWriteFactory()).CreateGlyphRunAnalysis(glyph_run as *const winapi::DWRITE_GLYPH_RUN, + pixels_per_dip, + transform.as_ref().map(|x| x as *const _).unwrap_or(ptr::null()), + rendering_mode, measuring_mode, + baseline_x, baseline_y, + native.getter_addrefs()); + assert!(hr == 0); + GlyphRunAnalysis::take(native) + } + } + + pub fn take(native: ComPtr) -> GlyphRunAnalysis { + GlyphRunAnalysis { + native: UnsafeCell::new(native), + } + } + + pub fn get_alpha_texture_bounds(&self, texture_type: winapi::DWRITE_TEXTURE_TYPE) -> winapi::RECT { + unsafe { + let mut rect: winapi::RECT = mem::zeroed(); + rect.left = 1234; + rect.top = 1234; + let hr = (*self.native.get()).GetAlphaTextureBounds(texture_type, &mut rect); + assert!(hr == 0); + rect + } + } + + pub fn create_alpha_texture(&self, texture_type: winapi::DWRITE_TEXTURE_TYPE, rect: winapi::RECT) -> Vec { + unsafe { + let rect_pixels = (rect.right - rect.left) * (rect.bottom - rect.top); + let rect_bytes = rect_pixels * match texture_type { + winapi::DWRITE_TEXTURE_ALIASED_1x1 => 1, + winapi::DWRITE_TEXTURE_CLEARTYPE_3x1 => 3, + _ => panic!("bad texture type specified"), + }; + + let mut out_bytes: Vec = vec![0; rect_bytes as usize]; + let hr = (*self.native.get()).CreateAlphaTexture(texture_type, &rect, out_bytes.as_mut_ptr(), out_bytes.len() as u32); + assert!(hr == 0); + out_bytes + } + } +} diff --git a/third_party/rust/dwrote/src/helpers.rs b/third_party/rust/dwrote/src/helpers.rs new file mode 100644 index 000000000000..def499d93685 --- /dev/null +++ b/third_party/rust/dwrote/src/helpers.rs @@ -0,0 +1,67 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use winapi::IDWriteLocalizedStrings; +use winapi::wchar_t; +use comptr::ComPtr; +use winapi::winerror::S_OK; +use winapi::minwindef::{BOOL, FALSE}; +use kernel32; +use std::ffi::{OsStr}; +use std::os::windows::ffi::{OsStrExt}; + +lazy_static! { + static ref SYSTEM_LOCALE: Vec = { + unsafe { + let mut locale: Vec = vec![0; 85]; + kernel32::GetUserDefaultLocaleName(locale.as_mut_ptr(), locale.len() as i32 - 1); + locale + } + }; + static ref EN_US_LOCALE: Vec = { + OsStr::new("en-us").encode_wide().collect() + }; +} + +pub fn get_locale_string(strings: &mut ComPtr) -> String { + unsafe { + let mut index: u32 = 0; + let mut exists: BOOL = FALSE; + let hr = strings.FindLocaleName((*SYSTEM_LOCALE).as_ptr(), &mut index, &mut exists); + if hr != S_OK || exists == FALSE { + let hr = strings.FindLocaleName((*EN_US_LOCALE).as_ptr(), &mut index, &mut exists); + if hr != S_OK || exists == FALSE { + // Ultimately fall back to first locale on list + index = 0; + } + } + + let mut length: u32 = 0; + let hr = strings.GetStringLength(index, &mut length); + assert!(hr == 0); + + let mut name: Vec = Vec::with_capacity(length as usize + 1); + let hr = strings.GetString(index, name.as_mut_ptr(), length + 1); + assert!(hr == 0); + name.set_len(length as usize); + + String::from_utf16(&name).ok().unwrap() + } +} + +// ToWide from https://github.com/retep998/wio-rs/blob/master/src/wide.rs + +pub trait ToWide { + fn to_wide(&self) -> Vec; + fn to_wide_null(&self) -> Vec; +} + +impl ToWide for T where T: AsRef { + fn to_wide(&self) -> Vec { + self.as_ref().encode_wide().collect() + } + fn to_wide_null(&self) -> Vec { + self.as_ref().encode_wide().chain(Some(0)).collect() + } +} diff --git a/third_party/rust/dwrote/src/lib.rs b/third_party/rust/dwrote/src/lib.rs new file mode 100644 index 000000000000..5b1261a43945 --- /dev/null +++ b/third_party/rust/dwrote/src/lib.rs @@ -0,0 +1,123 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#![cfg_attr(feature = "serde_derive", feature(proc_macro, rustc_attrs, structural_match))] +#![allow(non_upper_case_globals)] + +#[cfg(feature = "serde_derive")] +#[macro_use] +extern crate serde_derive; + +#[macro_use] +extern crate lazy_static; +#[macro_use(DEFINE_GUID)] +extern crate winapi; +extern crate gdi32; +extern crate kernel32; +extern crate libc; +extern crate serde; + +#[cfg(feature = "serde_codegen")] +include!(concat!(env!("OUT_DIR"), "/types.rs")); + +#[cfg(feature = "serde_derive")] +include!("types.rs"); + +use winapi::DWRITE_FACTORY_TYPE_SHARED; +use winapi::IDWriteFactory; +use std::ffi::CString; + +use comptr::ComPtr; +use winapi::S_OK; + +mod comptr; +mod helpers; +use helpers::ToWide; +use std::os::raw::c_void; + +#[cfg(test)] +mod test; + +// We still use the DWrite structs for things like metrics; re-export them +// here +pub use winapi::DWRITE_FONT_METRICS as FontMetrics; +pub use winapi::DWRITE_GLYPH_OFFSET as GlyphOffset; +pub use winapi::{DWRITE_MATRIX, DWRITE_GLYPH_RUN}; +pub use winapi::{DWRITE_RENDERING_MODE_DEFAULT, + DWRITE_RENDERING_MODE_ALIASED, + DWRITE_RENDERING_MODE_GDI_CLASSIC, + DWRITE_RENDERING_MODE_GDI_NATURAL, + DWRITE_RENDERING_MODE_NATURAL, + DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + DWRITE_RENDERING_MODE_OUTLINE, + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC, + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC}; +pub use winapi::{DWRITE_MEASURING_MODE_NATURAL, + DWRITE_MEASURING_MODE_GDI_CLASSIC, + DWRITE_MEASURING_MODE_GDI_NATURAL}; +pub use winapi::{DWRITE_FONT_SIMULATIONS_NONE, + DWRITE_FONT_SIMULATIONS_BOLD, + DWRITE_FONT_SIMULATIONS_OBLIQUE}; +pub use winapi::{DWRITE_TEXTURE_ALIASED_1x1, DWRITE_TEXTURE_CLEARTYPE_3x1}; +pub use winapi::{DWRITE_RENDERING_MODE}; +pub use winapi::{DWRITE_MEASURING_MODE}; +pub use winapi::{DWRITE_TEXTURE_TYPE}; + +#[macro_use] mod com_helpers; + +mod bitmap_render_target; pub use bitmap_render_target::BitmapRenderTarget; +mod font; pub use font::Font; +mod font_collection; pub use font_collection::FontCollection; +mod font_face; pub use font_face::FontFace; +mod font_family; pub use font_family::FontFamily; +mod font_file; pub use font_file::FontFile; +mod gdi_interop; pub use gdi_interop::GdiInterop; +mod rendering_params; pub use rendering_params::RenderingParams; +mod glyph_run_analysis; pub use glyph_run_analysis::GlyphRunAnalysis; + +// This is an internal implementation of FontFileLoader, for our utility +// functions. We don't wrap the DWriteFontFileLoader interface and +// related things. +mod font_file_loader_impl; + +DEFINE_GUID!{UuidOfIDWriteFactory, 0xb859ee5a, 0xd838, 0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48} + +unsafe impl Sync for ComPtr { } + +lazy_static! { + static ref DWRITE_FACTORY_RAW_PTR: usize = { + unsafe { + type DWriteCreateFactoryType = extern "system" fn(winapi::DWRITE_FACTORY_TYPE, winapi::REFIID, *mut *mut winapi::IUnknown) -> winapi::HRESULT; + + let dwrite_dll = kernel32::LoadLibraryW("dwrite.dll".to_wide_null().as_ptr()); + assert!(!dwrite_dll.is_null()); + let create_factory_name = CString::new("DWriteCreateFactory").unwrap(); + let dwrite_create_factory_ptr = + kernel32::GetProcAddress(dwrite_dll, create_factory_name.as_ptr() as winapi::LPCSTR); + assert!(!dwrite_create_factory_ptr.is_null()); + + let dwrite_create_factory = + mem::transmute::<*const c_void, DWriteCreateFactoryType>(dwrite_create_factory_ptr); + + let mut factory: ComPtr = ComPtr::new(); + let hr = dwrite_create_factory( + DWRITE_FACTORY_TYPE_SHARED, + &UuidOfIDWriteFactory, + factory.getter_addrefs()); + assert!(hr == S_OK); + factory.forget() as usize + } + }; +} + +// FIXME vlad would be nice to return, say, FactoryPtr +// that has a DerefMut impl, so that we can write +// DWriteFactory().SomeOperation() as opposed to +// (*DWriteFactory()).SomeOperation() +#[allow(non_snake_case)] +fn DWriteFactory() -> *mut IDWriteFactory { + (*DWRITE_FACTORY_RAW_PTR) as *mut IDWriteFactory +} diff --git a/third_party/rust/dwrote/src/rendering_params.rs b/third_party/rust/dwrote/src/rendering_params.rs new file mode 100644 index 000000000000..1bb214b8b9f4 --- /dev/null +++ b/third_party/rust/dwrote/src/rendering_params.rs @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::cell::UnsafeCell; + +use comptr::ComPtr; +use winapi; +use super::DWriteFactory; + +#[derive(Debug)] +pub struct RenderingParams { + native: UnsafeCell>, +} + +impl RenderingParams { + pub fn create_for_primary_monitor() -> RenderingParams { + unsafe { + let mut native: ComPtr = ComPtr::new(); + let hr = (*DWriteFactory()).CreateRenderingParams(native.getter_addrefs()); + assert!(hr == 0); + RenderingParams::take(native) + } + } + + pub fn take(native: ComPtr) -> RenderingParams { + RenderingParams { + native: UnsafeCell::new(native), + } + } + + pub unsafe fn as_ptr(&self) -> *mut winapi::IDWriteRenderingParams { + (*self.native.get()).as_ptr() + } +} diff --git a/third_party/rust/dwrote/src/test.rs b/third_party/rust/dwrote/src/test.rs new file mode 100644 index 000000000000..2d2fe33ca8f8 --- /dev/null +++ b/third_party/rust/dwrote/src/test.rs @@ -0,0 +1,122 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use super::*; + +#[test] +fn test_system_family_iter() { + let system_fc = FontCollection::system(); + let count = system_fc.families_iter().count(); + assert!(count > 0); + assert!(system_fc.families_iter().find(|f| f.name() == "Arial").is_some()); +} + +#[test] +fn test_descriptor_round_trip() { + let system_fc = FontCollection::system(); + + let arial_family = system_fc.get_font_family_by_name("Arial").unwrap(); + let arial_font = arial_family.get_first_matching_font(FontWeight::Regular, + FontStretch::Normal, + FontStyle::Normal); + + let descriptor = arial_font.to_descriptor(); + assert!(descriptor.family_name == "Arial"); + + let arial_font_2 = system_fc.get_font_from_descriptor(&descriptor).unwrap(); + let descriptor2 = arial_font_2.to_descriptor(); + assert_eq!(descriptor, descriptor2); +} + +#[test] +fn test_get_font_file_bytes() { + let system_fc = FontCollection::system(); + + let arial_family = system_fc.get_font_family_by_name("Arial").unwrap(); + let arial_font = arial_family.get_first_matching_font(FontWeight::Regular, + FontStretch::Normal, + FontStyle::Normal); + let face = arial_font.create_font_face(); + let files = face.get_files(); + assert!(files.len() > 0); + + let bytes = files[0].get_font_file_bytes(); + assert!(bytes.len() > 0); +} + +#[test] +fn test_create_font_file_from_bytes() { + let system_fc = FontCollection::system(); + + let arial_family = system_fc.get_font_family_by_name("Arial").unwrap(); + let arial_font = arial_family.get_first_matching_font(FontWeight::Regular, + FontStretch::Normal, + FontStyle::Normal); + let face = arial_font.create_font_face(); + let files = face.get_files(); + assert!(files.len() > 0); + + let bytes = files[0].get_font_file_bytes(); + assert!(bytes.len() > 0); + + // now go back + let new_font = FontFile::new_from_data(&bytes); + assert!(new_font.is_some()); + + let new_font = new_font.unwrap(); +} + +#[test] +fn test_glyph_image() { + let system_fc = FontCollection::system(); + let arial_family = system_fc.get_font_family_by_name("Arial").unwrap(); + let arial_font = arial_family.get_first_matching_font(FontWeight::Regular, + FontStretch::Normal, + FontStyle::Normal); + + let face = arial_font.create_font_face(); + let a_index = face.get_glyph_indices(&['A' as u32])[0]; + + let metrics = face.get_metrics(); + println!("Metrics:\n======\n{:?}\n======", metrics); + + let gm = face.get_design_glyph_metrics(&[a_index], false)[0]; + println!("Glyph metrics:\n======\n{:?}\n======", gm); + + let device_pixel_ratio = 1.0f32; + let em_size = 10.0f32; + + let design_units_per_pixel = face.metrics().designUnitsPerEm as f32 / 16. as f32; + let scaled_design_units_to_pixels = (em_size * device_pixel_ratio) / design_units_per_pixel; + + let width = (gm.advanceWidth as i32 - (gm.leftSideBearing + gm.rightSideBearing)) as f32 * scaled_design_units_to_pixels; + let height = (gm.advanceHeight as i32 - (gm.topSideBearing + gm.bottomSideBearing)) as f32 * scaled_design_units_to_pixels; + let x = (-gm.leftSideBearing) as f32 * scaled_design_units_to_pixels; + let y = (gm.verticalOriginY - gm.topSideBearing) as f32 * scaled_design_units_to_pixels; + + // FIXME I'm pretty sure we need to do a proper RoundOut type + // operation on this rect to properly handle any aliasing + let left_i = x.floor() as i32; + let top_i = (height - y).floor() as i32; + let width_u = width.ceil() as u32; + let height_u = height.ceil() as u32; + + println!("GlyphDimensions: {} {} {} {}", left_i, top_i, width_u, height_u); + + let gdi_interop = GdiInterop::create(); + let rt = gdi_interop.create_bitmap_render_target(width_u, height_u); + let rp = RenderingParams::create_for_primary_monitor(); + rt.set_pixels_per_dip(device_pixel_ratio); + rt.draw_glyph_run(x as f32, y as f32, + DWRITE_MEASURING_MODE_NATURAL, + &face, + em_size, + &[a_index], + &[0f32], + &[GlyphOffset { advanceOffset: 0., ascenderOffset: 0. }], + &rp, + &(255.0f32, 255.0f32, 255.0f32)); + let bytes = rt.get_opaque_values_as_mask(); + println!("bytes length: {}", bytes.len()); +} diff --git a/third_party/rust/dwrote/src/types.rs b/third_party/rust/dwrote/src/types.rs new file mode 100644 index 000000000000..30f7ccbd18c9 --- /dev/null +++ b/third_party/rust/dwrote/src/types.rs @@ -0,0 +1,80 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* this is include!()'d in lib.rs */ +use std::mem; + +// mirrors DWRITE_FONT_WEIGHT +#[repr(u32)] +#[derive(Deserialize, Serialize, PartialEq, Debug, Clone, Copy)] +pub enum FontWeight { + Thin = 100, + ExtraLight = 200, + Light = 300, + SemiLight = 350, + Regular = 400, + Medium = 500, + SemiBold = 600, + Bold = 700, + ExtraBold = 800, + Black = 900, + ExtraBlack = 950, +} + +impl FontWeight { + fn t(&self) -> winapi::DWRITE_FONT_WEIGHT { + unsafe { mem::transmute::(*self) } + } + pub fn to_u32(&self) -> u32 { unsafe { mem::transmute::(*self) } } + pub fn from_u32(v: u32) -> FontWeight { unsafe { mem::transmute::(v) } } +} + +// mirrors DWRITE_FONT_STRETCH +#[repr(u32)] +#[derive(Deserialize, Serialize, PartialEq, Debug, Clone, Copy)] +pub enum FontStretch { + Undefined = 0, + UltraCondensed = 1, + ExtraCondensed = 2, + Condensed = 3, + SemiCondensed = 4, + Normal = 5, + SemiExpanded = 6, + Expanded = 7, + ExtraExpanded = 8, + UltraExpanded = 9, +} + +impl FontStretch { + fn t(&self) -> winapi::DWRITE_FONT_STRETCH { + unsafe { mem::transmute::(*self) } + } + pub fn to_u32(&self) -> u32 { unsafe { mem::transmute::(*self) } } + pub fn from_u32(v: u32) -> FontStretch { unsafe { mem::transmute::(v) } } +} + +// mirrors DWRITE_FONT_STYLE +#[repr(u32)] +#[derive(Deserialize, Serialize, PartialEq, Debug, Clone, Copy)] +pub enum FontStyle { + Normal = 0, + Oblique = 1, + Italic = 2, +} + +impl FontStyle { + fn t(&self) -> winapi::DWRITE_FONT_STYLE { + unsafe { mem::transmute::(*self) } + } + pub fn to_u32(&self) -> u32 { unsafe { mem::transmute::(*self) } } + pub fn from_u32(v: u32) -> FontStyle { unsafe { mem::transmute::(v) } } +} + +#[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] +pub struct FontDescriptor { + pub family_name: String, + pub weight: FontWeight, + pub stretch: FontStretch, + pub style: FontStyle, +} diff --git a/third_party/rust/error-chain/.cargo-checksum.json b/third_party/rust/error-chain/.cargo-checksum.json new file mode 100644 index 000000000000..bbf5dd380481 --- /dev/null +++ b/third_party/rust/error-chain/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"ed8bb3864902ddf6322e6b1d6358bcaec9b51382a5216b9526ad0987ae430b0d",".travis.yml":"d56246d6c8796c638b5012c2d7a91d9b6ec101b6a47128e2d4bfa957c1c784e8","CHANGELOG.md":"8eb613d4a417752d4d1c81e065853e5ba0a21530e0881886c2ae4ffbf0ce57cd","Cargo.toml":"9e551bbef17e031db548e1a81f52d249c94db73a194daf0fe2906bc9404b9805","README.md":"6771ca940645b2f7e7a018c8cd25b25f8bf35786e229b54fa2fded1f2d0ae411","examples/all.rs":"2e6d530e95907bde1e49bda7fde7167568d08a370ade44a153612e2d1cb899d7","examples/doc.rs":"574948eb776c3d363f5cff9a48015bab6c17828c7306dc3eb8818afa90a31a83","examples/quickstart.rs":"0cd227741ed3559c0ead90dcc643cef30b73255d9c9f15c2ee20c4a1085d6f5c","examples/size.rs":"7922acd891dfd06f1d36308a3ccdf03def2646b2f39bfd1b15cf2896247bad8f","src/error_chain.rs":"236c4feead97661b33541434ae71f32c279738a81d0d4b7ce9c50550d5d6a662","src/example_generated.rs":"edaead3c4911afd0a0870cfcab11f8835eb17447031d227bbb5d17210379f778","src/lib.rs":"14ce5d1e76185e762db2414b51411095ddd38207a6f4d9dd50d4a041e7b77d88","src/quick_error.rs":"1889b9ca1f7a5e9124275fd5da81e709d0d6bd3b06915bf320c23d4c4f083301","src/quick_main.rs":"755028c2b4305482a1ab86f8b1b68a95eac22b331c94e14d29777dc69dad1bf4","tests/quick_main.rs":"1d6a726856b954d4cffddab00602583921972ceeeb2bf7ba9ebbac6a51584b53","tests/tests.rs":"2f7ceee2f9808d0985c848d99fe967e8f0b549cf144d4d692a5c5d1c2ba7d660"},"package":"318cb3c71ee4cdea69fdc9e15c173b245ed6063e1709029e8fd32525a881120f"} \ No newline at end of file diff --git a/third_party/rust/error-chain/.cargo-ok b/third_party/rust/error-chain/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/error-chain/.gitignore b/third_party/rust/error-chain/.gitignore new file mode 100644 index 000000000000..98171f1fe031 --- /dev/null +++ b/third_party/rust/error-chain/.gitignore @@ -0,0 +1,3 @@ +*~ +target/ +Cargo.lock \ No newline at end of file diff --git a/third_party/rust/error-chain/.travis.yml b/third_party/rust/error-chain/.travis.yml new file mode 100644 index 000000000000..31d92970348f --- /dev/null +++ b/third_party/rust/error-chain/.travis.yml @@ -0,0 +1,45 @@ +language: rust +rust: +- stable +- beta +- nightly +# Oldest supported version for all features. +# Use of https://github.com/rust-lang/rfcs/pull/16 +- 1.13.0 +# Oldest supported version as dependency, with no features, tests, or examples. +- 1.10.0 + +sudo: false +cache: cargo +addons: + apt: + packages: + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev + +before_script: +- | + pip install 'travis-cargo<0.2' --user && + export PATH=$HOME/.local/bin:$PATH + +script: +- travis-cargo build -- $FEATURES +- travis-cargo --skip 1.10.0 test -- $FEATURES + +after_success: +- travis-cargo --only stable doc +- travis-cargo --only stable doc-upload + +env: + global: + - secure: ncxJbvJM1vCZfcEftjsFKJMxxhKLgWKaR8Go9AMo0VB5fB2XVW/6NYO5bQEEYpOf1Nc/+2FbI2+Dkz0S/mJpUcNSfBgablCHgwU2sHse7KsoaqfHj2mf1E3exjzSHoP96hPGicC5zAjSXFjCgJPOUSGqqRaJ7z5AsJLhJT6LuK7QpvwPBZzklUN8T+n1sVmws8TNmRIbaniq/q6wYHANHcy6Dl59dx4sKwniUGiZdUhCiddVpoxbECSxc0A8mN2pk7/aW+WGxK3goBs5ZF7+JXF318F62pDcXQmR5CX6WdpenIcJ25g1Vg1WhQ4Ifpe17CN0bfxV8ShuzrQUThCDMffZCo9XySBtODdEowwK1UIpjnFLfIxjOs45Cd8o3tM2j0CfvtnjOz6BCdUU0qiwNPPNx0wFkx3ZiOfSh+FhBhvyPM12HN2tdN0esgVBItFmEci+sSIIXqjVL6DNiu5zTjbu0bs6COwlUWdmL6vmsZtq5tl7Cno9+C3szxRVAkShGydd04l9NYjqNEzTa1EPG50OsnVRKGdRiFzSxhc3BWExNKvcQ4v867t6/PpPkW6s4oXmYI3+De+8O7ExWc6a4alcrDXKlMs5fCb5Pcd4Ju9kowcjkoJo5yf2wW3Ox5R8SJpaEEpvyhx5O/qtIxjhHNzeo8Wsr/6gdNDv20r91TI= + - TRAVIS_CARGO_NIGHTLY_FEATURE="" + matrix: + - FEATURES=--features=backtrace + - FEATURES=--no-default-features + +matrix: + exclude: + - env: FEATURES=--features=backtrace + rust: 1.10.0 diff --git a/third_party/rust/error-chain/CHANGELOG.md b/third_party/rust/error-chain/CHANGELOG.md new file mode 100644 index 000000000000..0d9cb55c7805 --- /dev/null +++ b/third_party/rust/error-chain/CHANGELOG.md @@ -0,0 +1,82 @@ +# Unreleased + +# 0.7.2 + +- Add `quick_main!` (#88). +- `allow(unused)` for the `Result` wrapper. +- Minimum rust version supported is not 1.10 on some conditions (#103). + +# 0.7.1 + +- [Add the `bail!` macro](https://github.com/brson/error-chain/pull/76) + +# 0.7.0 + +- [Rollback several design changes to fix regressions](https://github.com/brson/error-chain/pull/75) +- New `Variant(Error) #[attrs]` for `links` and `foreign_links`. +- Hide implementation details from the doc. +- Always generate `Error::backtrace`. + +# 0.6.2 + +- Allow dead code. + +# 0.6.1 + +- Fix wrong trait constraint in ResultExt implementation (#66). + +# 0.6.0 + +- Conditional compilation for error variants. +- Backtrace generation is now a feature. +- More standard trait implementations for extra convenience. +- Remove ChainErr. +- Remove need to specify `ErrorKind` in `links {}`. +- Add ResultExt trait. +- Error.1 is a struct instead of a tuple. +- Error is now a struct. +- The declarations order is more flexible. +- Way better error reporting when there is a syntax error in the macro call. +- `Result` generation can be disabled. +- At most one declaration of each type can be present. + +# 0.5.0 + +- [Only generate backtraces with RUST_BACKTRACE set](https://github.com/brson/error-chain/pull/27) +- [Fixup matching, disallow repeating "types" section](https://github.com/brson/error-chain/pull/26) +- [Fix tests on stable/beta](https://github.com/brson/error-chain/pull/28) +- [Only deploy docs when tagged](https://github.com/brson/error-chain/pull/30) + +Contributors: benaryorg, Brian Anderson, Georg Brandl + +# 0.4.2 + +- [Fix the resolution of the ErrorKind description method](https://github.com/brson/error-chain/pull/24) + +Contributors: Brian Anderson + +# 0.4.1 (yanked) + +- [Fix a problem with resolving methods of the standard Error type](https://github.com/brson/error-chain/pull/22) + +Contributors: Brian Anderson + +# 0.4.0 (yanked) + +- [Remove the foreign link description and forward to the foreign error](https://github.com/brson/error-chain/pull/19) +- [Allow missing sections](https://github.com/brson/error-chain/pull/17) + +Contributors: Brian Anderson, Taylor Cramer + +# 0.3.0 + +- [Forward Display implementation for foreign errors](https://github.com/brson/error-chain/pull/13) + +Contributors: Brian Anderson, Taylor Cramer + +# 0.2.2 + +- [Don't require `types` section in macro invocation](https://github.com/brson/error-chain/pull/8) +- [Add "quick start" to README](https://github.com/brson/error-chain/pull/9) + +Contributors: Brian Anderson, Jake Shadle, Nate Mara diff --git a/third_party/rust/error-chain/Cargo.toml b/third_party/rust/error-chain/Cargo.toml new file mode 100644 index 000000000000..dfbaa7f409b5 --- /dev/null +++ b/third_party/rust/error-chain/Cargo.toml @@ -0,0 +1,22 @@ +[package] + +name = "error-chain" +version = "0.7.2" +authors = [ "Brian Anderson ", + "Paul Colomiets ", + "Colin Kiegel ", + "Yamakaky "] +description = "Yet another error boilerplate library." + +documentation = "https://docs.rs/error-chain" +homepage = "https://github.com/brson/error-chain" +repository = "https://github.com/brson/error-chain" + +license = "MIT/Apache-2.0" + +[features] +default = ["backtrace", "example_generated"] +example_generated = [] + +[dependencies] +backtrace = { version = "0.3", optional = true } diff --git a/third_party/rust/error-chain/README.md b/third_party/rust/error-chain/README.md new file mode 100644 index 000000000000..1e9bbf4caa2e --- /dev/null +++ b/third_party/rust/error-chain/README.md @@ -0,0 +1,36 @@ +# error-chain - Consistent error handling for Rust + +[![Build Status](https://api.travis-ci.org/brson/error-chain.svg?branch=master)](https://travis-ci.org/brson/error-chain) +[![Latest Version](https://img.shields.io/crates/v/error-chain.svg)](https://crates.io/crates/error-chain) +[![License](https://img.shields.io/github/license/brson/error-chain.svg)](https://github.com/brson/error-chain) + +`error-chain` makes it easy to take full advantage of Rust's error +handling features without the overhead of maintaining boilerplate +error types and conversions. It implements an opinionated strategy for +defining your own error types, as well as conversions from others' +error types. + +[Documentation (crates.io)](https://docs.rs/error-chain). + +[Documentation (master)](https://brson.github.io/error-chain). + +## Quick start + +If you just want to set up your new project with error-chain, +follow the [quickstart.rs] template, and read this [intro] +to error-chain. + +[quickstart.rs]: https://github.com/brson/error-chain/blob/master/examples/quickstart.rs +[intro]: http://brson.github.io/2016/11/30/starting-with-error-chain + +## Supported Rust version + +Please view the beginning of the [Travis configuration file](.travis.yml) +to see the oldest supported Rust version. + +Note that `error-chain` supports older versions of Rust when built with +`default-features = false`. + +## License + +MIT/Apache-2.0 diff --git a/third_party/rust/error-chain/examples/all.rs b/third_party/rust/error-chain/examples/all.rs new file mode 100644 index 000000000000..7df6080988d0 --- /dev/null +++ b/third_party/rust/error-chain/examples/all.rs @@ -0,0 +1,36 @@ +#[macro_use] +extern crate error_chain; + +pub mod inner { + error_chain! {} +} + +#[cfg(feature = "a_feature")] +pub mod feature { + error_chain! {} +} + +error_chain! { + // Types generated by the macro. If empty of absent, it defaults to + // Error, ErrorKind, Result; + types { + // With custom names: + MyError, MyErrorKind, MyResult; + // Without the `Result` wrapper: + // Error, ErrorKind; + } + + // Automatic bindings to others error types generated by `error_chain!`. + links { + Inner(inner::Error, inner::ErrorKind); + // Attributes can be added at the end of the declaration. + Feature(feature::Error, feature::ErrorKind) #[cfg(feature = "a_feature")]; + } + + // Bindings to types implementing std::error::Error. + foreign_links { + Io(::std::io::Error); + } +} + +fn main() {} diff --git a/third_party/rust/error-chain/examples/doc.rs b/third_party/rust/error-chain/examples/doc.rs new file mode 100644 index 000000000000..103040458c6f --- /dev/null +++ b/third_party/rust/error-chain/examples/doc.rs @@ -0,0 +1,29 @@ +#![deny(missing_docs)] + +//! This module is used to check that all generated items are documented. + +#[macro_use] +extern crate error_chain; + +/// Inner module. +pub mod inner { + error_chain! { + } +} + +error_chain! { + links { + Inner(inner::Error, inner::ErrorKind) #[doc = "Doc"]; + } + foreign_links { + Io(::std::io::Error) #[doc = "Io"]; + } + errors { + /// Doc + Test2 { + + } + } +} + +fn main() {} diff --git a/third_party/rust/error-chain/examples/quickstart.rs b/third_party/rust/error-chain/examples/quickstart.rs new file mode 100644 index 000000000000..7c53ad3ebfae --- /dev/null +++ b/third_party/rust/error-chain/examples/quickstart.rs @@ -0,0 +1,61 @@ +// Simple and robust error handling with error-chain! +// Use this as a template for new projects. + +// `error_chain!` can recurse deeply +#![recursion_limit = "1024"] + +// Import the macro. Don't forget to add `error-chain` in your +// `Cargo.toml`! +#[macro_use] +extern crate error_chain; + +// We'll put our errors in an `errors` module, and other modules in +// this crate will `use errors::*;` to get access to everything +// `error_chain!` creates. +mod errors { + // Create the Error, ErrorKind, ResultExt, and Result types + error_chain! { } +} + +use errors::*; + +fn main() { + if let Err(ref e) = run() { + use ::std::io::Write; + let stderr = &mut ::std::io::stderr(); + let errmsg = "Error writing to stderr"; + + writeln!(stderr, "error: {}", e).expect(errmsg); + + for e in e.iter().skip(1) { + writeln!(stderr, "caused by: {}", e).expect(errmsg); + } + + // The backtrace is not always generated. Try to run this example + // with `RUST_BACKTRACE=1`. + if let Some(backtrace) = e.backtrace() { + writeln!(stderr, "backtrace: {:?}", backtrace).expect(errmsg); + } + + ::std::process::exit(1); + } +} + +// Use this macro to auto-generate the main above. You may want to +// set the `RUST_BACKTRACE` env variable to see a backtrace. +//quick_main!(run); + + +// Most functions will return the `Result` type, imported from the +// `errors` module. It is a typedef of the standard `Result` type +// for which the error type is always our own `Error`. +fn run() -> Result<()> { + use std::fs::File; + + // This operation will fail + File::open("tretrete") + .chain_err(|| "unable to open tretrete file")?; + + Ok(()) +} + diff --git a/third_party/rust/error-chain/examples/size.rs b/third_party/rust/error-chain/examples/size.rs new file mode 100644 index 000000000000..01f677b49113 --- /dev/null +++ b/third_party/rust/error-chain/examples/size.rs @@ -0,0 +1,40 @@ +#[macro_use] +extern crate error_chain; + +use std::mem::{size_of, size_of_val}; + +error_chain! { + errors { + AVariant + Another + } +} + +fn main() { + println!("Memory usage in bytes"); + println!("---------------------"); + println!("Result<()>: {}", size_of::>()); + println!(" (): {}", size_of::<()>()); + println!(" Error: {}", size_of::()); + println!(" ErrorKind: {}", size_of::()); + let msg = ErrorKind::Msg("test".into()); + println!(" ErrorKind::Msg: {}", size_of_val(&msg)); + println!(" String: {}", size_of::()); + println!(" State: {}", size_of::()); + #[cfg(feature = "backtrace")] + { + let state = error_chain::State { + next_error: None, + backtrace: None, + }; + println!(" State.next_error: {}", size_of_val(&state.next_error)); + println!(" State.backtrace: {}", size_of_val(&state.backtrace)); + } + #[cfg(not(feature = "backtrace"))] + { + let state = error_chain::State { + next_error: None, + }; + println!(" State.next_error: {}", size_of_val(&state.next_error)); + } +} diff --git a/third_party/rust/error-chain/src/error_chain.rs b/third_party/rust/error-chain/src/error_chain.rs new file mode 100644 index 000000000000..1ea18c537ece --- /dev/null +++ b/third_party/rust/error-chain/src/error_chain.rs @@ -0,0 +1,405 @@ +/// Prefer to use `error_chain` instead of this macro. +#[macro_export] +macro_rules! error_chain_processed { + // Default values for `types`. + ( + types {} + $( $rest: tt )* + ) => { + error_chain_processed! { + types { + Error, ErrorKind, ResultExt, Result; + } + $( $rest )* + } + }; + // With `Result` wrapper. + ( + types { + $error_name:ident, $error_kind_name:ident, + $result_ext_name:ident, $result_name:ident; + } + $( $rest: tt )* + ) => { + error_chain_processed! { + types { + $error_name, $error_kind_name, + $result_ext_name; + } + $( $rest )* + } + /// Convenient wrapper around `std::Result`. + #[allow(unused)] + pub type $result_name = ::std::result::Result; + }; + // Without `Result` wrapper. + ( + types { + $error_name:ident, $error_kind_name:ident, + $result_ext_name:ident; + } + + links { + $( $link_variant:ident ( $link_error_path:path, $link_kind_path:path ) + $( #[$meta_links:meta] )*; ) * + } + + foreign_links { + $( $foreign_link_variant:ident ( $foreign_link_error_path:path ) + $( #[$meta_foreign_links:meta] )*; )* + } + + errors { + $( $error_chunks:tt ) * + } + + ) => { + /// The Error type. + /// + /// This struct is made of three things: + /// + /// - an `ErrorKind` which is used to determine the type of the error. + /// - a backtrace, generated when the error is created. + /// - an error chain, used for the implementation of `Error::cause()`. + #[derive(Debug)] + pub struct $error_name( + // The members must be `pub` for `links`. + /// The kind of the error. + #[doc(hidden)] + pub $error_kind_name, + /// Contains the error chain and the backtrace. + #[doc(hidden)] + pub $crate::State, + ); + + impl $crate::ChainedError for $error_name { + type ErrorKind = $error_kind_name; + + fn new(kind: $error_kind_name, state: $crate::State) -> $error_name { + $error_name(kind, state) + } + + fn from_kind(kind: Self::ErrorKind) -> Self { + Self::from_kind(kind) + } + + fn kind(&self) -> &Self::ErrorKind { + self.kind() + } + + fn iter(&self) -> $crate::ErrorChainIter { + $crate::ErrorChainIter(Some(self)) + } + + fn backtrace(&self) -> Option<&$crate::Backtrace> { + self.backtrace() + } + + impl_extract_backtrace!($error_name + $error_kind_name + $([$link_error_path, $(#[$meta_links])*])*); + } + + #[allow(dead_code)] + impl $error_name { + /// Constructs an error from a kind, and generates a backtrace. + pub fn from_kind(kind: $error_kind_name) -> $error_name { + $error_name( + kind, + $crate::State::default(), + ) + } + + /// Returns the kind of the error. + pub fn kind(&self) -> &$error_kind_name { + &self.0 + } + + /// Iterates over the error chain. + pub fn iter(&self) -> $crate::ErrorChainIter { + $crate::ChainedError::iter(self) + } + + /// Returns the backtrace associated with this error. + pub fn backtrace(&self) -> Option<&$crate::Backtrace> { + self.1.backtrace() + } + } + + impl ::std::error::Error for $error_name { + fn description(&self) -> &str { + self.0.description() + } + + fn cause(&self) -> Option<&::std::error::Error> { + match self.1.next_error { + Some(ref c) => Some(&**c), + None => { + match self.0 { + $( + $(#[$meta_foreign_links])* + $error_kind_name::$foreign_link_variant(ref foreign_err) => { + foreign_err.cause() + } + ) * + _ => None + } + } + } + } + } + + impl ::std::fmt::Display for $error_name { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::std::fmt::Display::fmt(&self.0, f) + } + } + + $( + $(#[$meta_links])* + impl From<$link_error_path> for $error_name { + fn from(e: $link_error_path) -> Self { + $error_name( + $error_kind_name::$link_variant(e.0), + e.1, + ) + } + } + ) * + + $( + $(#[$meta_foreign_links])* + impl From<$foreign_link_error_path> for $error_name { + fn from(e: $foreign_link_error_path) -> Self { + $error_name::from_kind( + $error_kind_name::$foreign_link_variant(e) + ) + } + } + ) * + + impl From<$error_kind_name> for $error_name { + fn from(e: $error_kind_name) -> Self { + $error_name::from_kind(e) + } + } + + impl<'a> From<&'a str> for $error_name { + fn from(s: &'a str) -> Self { + $error_name::from_kind(s.into()) + } + } + + impl From for $error_name { + fn from(s: String) -> Self { + $error_name::from_kind(s.into()) + } + } + + impl ::std::ops::Deref for $error_name { + type Target = $error_kind_name; + + fn deref(&self) -> &Self::Target { + &self.0 + } + } + + + // The ErrorKind type + // -------------- + + quick_error! { + /// The kind of an error. + #[derive(Debug)] + pub enum $error_kind_name { + + /// A convenient variant for String. + Msg(s: String) { + description(&s) + display("{}", s) + } + + $( + $(#[$meta_links])* + $link_variant(e: $link_kind_path) { + description(e.description()) + display("{}", e) + } + ) * + + $( + $(#[$meta_foreign_links])* + $foreign_link_variant(err: $foreign_link_error_path) { + description(::std::error::Error::description(err)) + display("{}", err) + } + ) * + + $($error_chunks)* + } + } + + $( + $(#[$meta_links])* + impl From<$link_kind_path> for $error_kind_name { + fn from(e: $link_kind_path) -> Self { + $error_kind_name::$link_variant(e) + } + } + ) * + + impl<'a> From<&'a str> for $error_kind_name { + fn from(s: &'a str) -> Self { + $error_kind_name::Msg(s.to_string()) + } + } + + impl From for $error_kind_name { + fn from(s: String) -> Self { + $error_kind_name::Msg(s) + } + } + + impl From<$error_name> for $error_kind_name { + fn from(e: $error_name) -> Self { + e.0 + } + } + + // The ResultExt trait defines the `chain_err` method. + + /// Additional methods for `Result`, for easy interaction with this crate. + pub trait $result_ext_name { + /// If the `Result` is an `Err` then `chain_err` evaluates the closure, + /// which returns *some type that can be converted to `ErrorKind`*, boxes + /// the original error to store as the cause, then returns a new error + /// containing the original error. + fn chain_err(self, callback: F) -> ::std::result::Result + where F: FnOnce() -> EK, + EK: Into<$error_kind_name>; + } + + impl $result_ext_name for ::std::result::Result where E: ::std::error::Error + Send + 'static { + fn chain_err(self, callback: F) -> ::std::result::Result + where F: FnOnce() -> EK, + EK: Into<$error_kind_name> { + self.map_err(move |e| { + let state = $crate::State::new::<$error_name>(Box::new(e), ); + $crate::ChainedError::new(callback().into(), state) + }) + } + } + + + }; +} + +/// Internal macro used for reordering of the fields. +#[doc(hidden)] +#[macro_export] +macro_rules! error_chain_processing { + ( + ({}, $b:tt, $c:tt, $d:tt) + types $content:tt + $( $tail:tt )* + ) => { + error_chain_processing! { + ($content, $b, $c, $d) + $($tail)* + } + }; + ( + ($a:tt, {}, $c:tt, $d:tt) + links $content:tt + $( $tail:tt )* + ) => { + error_chain_processing! { + ($a, $content, $c, $d) + $($tail)* + } + }; + ( + ($a:tt, $b:tt, {}, $d:tt) + foreign_links $content:tt + $( $tail:tt )* + ) => { + error_chain_processing! { + ($a, $b, $content, $d) + $($tail)* + } + }; + ( + ($a:tt, $b:tt, $c:tt, {}) + errors $content:tt + $( $tail:tt )* + ) => { + error_chain_processing! { + ($a, $b, $c, $content) + $($tail)* + } + }; + ( ($a:tt, $b:tt, $c:tt, $d:tt) ) => { + error_chain_processed! { + types $a + links $b + foreign_links $c + errors $d + } + }; +} + +/// This macro is used for handling of duplicated and out-of-order fields. For +/// the exact rules, see `error_chain_processed`. +#[macro_export] +macro_rules! error_chain { + ( $( $block_name:ident { $( $block_content:tt )* } )* ) => { + error_chain_processing! { + ({}, {}, {}, {}) + $($block_name { $( $block_content )* })* + } + }; +} + +/// Macro used to manage the `backtrace` feature. +/// +/// See +/// https://www.reddit.com/r/rust/comments/57virt/hey_rustaceans_got_an_easy_question_ask_here/da5r4ti/?context=3 +/// for more details. +#[macro_export] +#[doc(hidden)] +#[cfg(feature = "backtrace")] +macro_rules! impl_extract_backtrace { + ($error_name: ident + $error_kind_name: ident + $([$link_error_path: path, $(#[$meta_links: meta])*])*) => { + fn extract_backtrace(e: &(::std::error::Error + Send + 'static)) + -> Option<::std::sync::Arc<$crate::Backtrace>> { + if let Some(e) = e.downcast_ref::<$error_name>() { + return e.1.backtrace.clone(); + } + $( + $( #[$meta_links] )* + { + if let Some(e) = e.downcast_ref::<$link_error_path>() { + return e.1.backtrace.clone(); + } + } + ) * + None + } + } +} + +/// Macro used to manage the `backtrace` feature. +/// +/// See +/// https://www.reddit.com/r/rust/comments/57virt/hey_rustaceans_got_an_easy_question_ask_here/da5r4ti/?context=3 +/// for more details. +#[macro_export] +#[doc(hidden)] +#[cfg(not(feature = "backtrace"))] +macro_rules! impl_extract_backtrace { + ($error_name: ident + $error_kind_name: ident + $([$link_error_path: path, $(#[$meta_links: meta])*])*) => {} +} diff --git a/third_party/rust/error-chain/src/example_generated.rs b/third_party/rust/error-chain/src/example_generated.rs new file mode 100644 index 000000000000..453dfa0e5bd2 --- /dev/null +++ b/third_party/rust/error-chain/src/example_generated.rs @@ -0,0 +1,38 @@ +//! This modules show an example of code generated by the macro. IT MUST NOT BE +//! USED OUTSIDE THIS CRATE. +//! +//! This is the basic error structure. You can see that `ErrorKind` +//! has been populated in a variety of ways. All `ErrorKind`s get a +//! `Msg` variant for basic errors. When strings are converted to +//! `ErrorKind`s they become `ErrorKind::Msg`. The "links" defined in +//! the macro are expanded to the `Inner` variant, and the +//! "foreign links" to the `Io` variant. +//! +//! Both types come with a variety of `From` conversions as well: +//! `Error` can be created from `ErrorKind`, `&str` and `String`, +//! and the `links` and `foreign_links` error types. `ErrorKind` +//! can be created from the corresponding `ErrorKind`s of the link +//! types, as well as from `&str` and `String`. +//! +//! `into()` and `From::from` are used heavily to massage types into +//! the right shape. Which one to use in any specific case depends on +//! the influence of type inference, but there are some patterns that +//! arise frequently. + +/// Another code generated by the macro. +pub mod inner { + error_chain! {} +} + +error_chain! { + links { + Inner(inner::Error, inner::ErrorKind) #[doc = "Link to another `ErrorChain`."]; + } + foreign_links { + Io(::std::io::Error) #[doc = "Link to a `std::error::Error` type."]; + } + errors { + #[doc = "A custom error kind."] + Custom + } +} diff --git a/third_party/rust/error-chain/src/lib.rs b/third_party/rust/error-chain/src/lib.rs new file mode 100644 index 000000000000..e297e5a422ba --- /dev/null +++ b/third_party/rust/error-chain/src/lib.rs @@ -0,0 +1,581 @@ +#![deny(missing_docs)] + +//! A library for consistent and reliable error handling +//! +//! error-chain makes it easy to take full advantage of Rust's +//! powerful error handling features without the overhead of +//! maintaining boilerplate error types and conversions. It implements +//! an opinionated strategy for defining your own error types, as well +//! as conversions from others' error types. +//! +//! ## Quick start +//! +//! If you just want to set up your new project with error-chain, +//! follow the [quickstart.rs] template, and read this [intro] +//! to error-chain. +//! +//! [quickstart.rs]: https://github.com/brson/error-chain/blob/master/examples/quickstart.rs +//! [intro]: http://brson.github.io/2016/11/30/starting-with-error-chain +//! +//! ## Why error chain? +//! +//! * error-chain is easy to configure. Handle errors robustly with minimal +//! effort. +//! * Basic error handling requires no maintenance of custom error types +//! nor the `From` conversions that make `?` work. +//! * error-chain scales from simple error handling strategies to more +//! rigorous. Return formatted strings for simple errors, only +//! introducing error variants and their strong typing as needed for +//! advanced error recovery. +//! * error-chain makes it trivial to correctly manage the [cause] of +//! the errors generated by your own code. This is the "chaining" +//! in "error-chain". +//! +//! [cause]: https://doc.rust-lang.org/std/error/trait.Error.html#method.cause +//! +//! ## Principles of error-chain +//! +//! error-chain is based on the following principles: +//! +//! * No error should ever be discarded. This library primarily +//! makes it easy to "chain" errors with the `chain_err` method. +//! * Introducing new errors is trivial. Simple errors can be introduced +//! at the error site with just a string. +//! * Handling errors is possible with pattern matching. +//! * Conversions between error types are done in an automatic and +//! consistent way - `From` conversion behavior is never specified +//! explicitly. +//! * Errors implement Send. +//! * Errors can carry backtraces. +//! +//! Similar to other libraries like [error-type] and [quick-error], +//! this library introduces the error chaining mechanism originally +//! employed by Cargo. The `error_chain!` macro declares the types +//! and implementation boilerplate necessary for fulfilling a +//! particular error-handling strategy. Most importantly it defines a +//! custom error type (called `Error` by convention) and the `From` +//! conversions that let the `try!` macro and `?` operator work. +//! +//! This library differs in a few ways from previous error libs: +//! +//! * Instead of defining the custom `Error` type as an enum, it is a +//! struct containing an `ErrorKind` (which defines the +//! `description` and `display` methods for the error), an opaque, +//! optional, boxed `std::error::Error + Send + 'static` object +//! (which defines the `cause`, and establishes the links in the +//! error chain), and a `Backtrace`. +//! * The macro also defines a `ResultExt` trait that defines a +//! `chain_err` method. This method on all `std::error::Error + Send + 'static` +//! types extends the error chain by boxing the current +//! error into an opaque object and putting it inside a new concrete +//! error. +//! * It provides automatic `From` conversions between other error types +//! defined by the `error_chain!` that preserve type information, +//! and facilitate seamless error composition and matching of composed +//! errors. +//! * It provides automatic `From` conversions between any other error +//! type that hides the type of the other error in the `cause` box. +//! * If `RUST_BACKTRACE` is enabled, it collects a single backtrace at +//! the earliest opportunity and propagates it down the stack through +//! `From` and `ResultExt` conversions. +//! +//! To accomplish its goals it makes some tradeoffs: +//! +//! * The split between the `Error` and `ErrorKind` types can make it +//! slightly more cumbersome to instantiate new (unchained) errors, +//! requiring an `Into` or `From` conversion; as well as slightly +//! more cumbersome to match on errors with another layer of types +//! to match. +//! * Because the error type contains `std::error::Error + Send + 'static` objects, +//! it can't implement `PartialEq` for easy comparisons. +//! +//! ## Declaring error types +//! +//! Generally, you define one family of error types per crate, though +//! it's also perfectly fine to define error types on a finer-grained +//! basis, such as per module. +//! +//! Assuming you are using crate-level error types, typically you will +//! define an `errors` module and inside it call `error_chain!`: +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! mod other_error { +//! error_chain! {} +//! } +//! +//! error_chain! { +//! // The type defined for this error. These are the conventional +//! // and recommended names, but they can be arbitrarily chosen. +//! // It is also possible to leave this block out entirely, or +//! // leave it empty, and these names will be used automatically. +//! types { +//! Error, ErrorKind, ResultExt, Result; +//! } +//! +//! // Without the `Result` wrapper: +//! // +//! // types { +//! // Error, ErrorKind, ResultExt; +//! // } +//! +//! // Automatic conversions between this error chain and other +//! // error chains. In this case, it will e.g. generate an +//! // `ErrorKind` variant called `Dist` which in turn contains +//! // the `rustup_dist::ErrorKind`, with conversions from +//! // `rustup_dist::Error`. +//! // +//! // Optionally, some attributes can be added to a variant. +//! // +//! // This section can be empty. +//! links { +//! Another(other_error::Error, other_error::ErrorKind) #[cfg(unix)]; +//! } +//! +//! // Automatic conversions between this error chain and other +//! // error types not defined by the `error_chain!`. These will be +//! // wrapped in a new error with, in this case, the +//! // `ErrorKind::Temp` variant. The description and cause will +//! // forward to the description and cause of the original error. +//! // +//! // Optionally, some attributes can be added to a variant. +//! // +//! // This section can be empty. +//! foreign_links { +//! Fmt(::std::fmt::Error); +//! Io(::std::io::Error) #[cfg(unix)]; +//! } +//! +//! // Define additional `ErrorKind` variants. The syntax here is +//! // the same as `quick_error!`, but the `from()` and `cause()` +//! // syntax is not supported. +//! errors { +//! InvalidToolchainName(t: String) { +//! description("invalid toolchain name") +//! display("invalid toolchain name: '{}'", t) +//! } +//! } +//! } +//! +//! # fn main() {} +//! ``` +//! +//! Each section, `types`, `links`, `foreign_links`, and `errors` may +//! be omitted if it is empty. +//! +//! This populates the module with a number of definitions, +//! the most important of which are the `Error` type +//! and the `ErrorKind` type. An example of generated code can be found in the +//! [example_generated](example_generated) module. +//! +//! ## Returning new errors +//! +//! Introducing new error chains, with a string message: +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! # fn main() {} +//! # error_chain! {} +//! fn foo() -> Result<()> { +//! Err("foo error!".into()) +//! } +//! ``` +//! +//! Introducing new error chains, with an `ErrorKind`: +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! # fn main() {} +//! error_chain! { +//! errors { FooError } +//! } +//! +//! fn foo() -> Result<()> { +//! Err(ErrorKind::FooError.into()) +//! } +//! ``` +//! +//! Note that the return type is the typedef `Result`, which is +//! defined by the macro as `pub type Result = +//! ::std::result::Result`. Note that in both cases +//! `.into()` is called to convert a type into the `Error` type; both +//! strings and `ErrorKind` have `From` conversions to turn them into +//! `Error`. +//! +//! When the error is emitted inside a `try!` macro or behind the +//! `?` operator, the explicit conversion isn't needed; `try!` will +//! automatically convert `Err(ErrorKind)` to `Err(Error)`. So the +//! below is equivalent to the previous: +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! # fn main() {} +//! # error_chain! { errors { FooError } } +//! fn foo() -> Result<()> { +//! Ok(try!(Err(ErrorKind::FooError))) +//! } +//! +//! fn bar() -> Result<()> { +//! Ok(try!(Err("bogus!"))) +//! } +//! ``` +//! +//! ## The `bail!` macro +//! +//! The above method of introducing new errors works but is a little +//! verbose. Instead we can use the `bail!` macro, which, much like `try!` +//! and `?`, performs an early return with conversions. With `bail!` the +//! previous examples look like: +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! # fn main() {} +//! # error_chain! { errors { FooError } } +//! fn foo() -> Result<()> { +//! bail!(ErrorKind::FooError); +//! +//! Ok(()) +//! } +//! +//! fn bar() -> Result<()> { +//! bail!("bogus!"); +//! +//! Ok(()) +//! } +//! ``` +//! +//! ## Chaining errors +//! +//! To extend the error chain: +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! # fn main() {} +//! # error_chain! {} +//! # fn do_something() -> Result<()> { unimplemented!() } +//! # fn test() -> Result<()> { +//! let res: Result<()> = do_something().chain_err(|| "something went wrong"); +//! # Ok(()) +//! # } +//! ``` +//! +//! `chain_err` can be called on any `Result` type where the contained +//! error type implements `std::error::Error + Send + 'static`. If +//! the `Result` is an `Err` then `chain_err` evaluates the closure, +//! which returns *some type that can be converted to `ErrorKind`*, +//! boxes the original error to store as the cause, then returns a new +//! error containing the original error. +//! +//! ## Matching errors +//! +//! error-chain error variants are matched with simple patterns. +//! `Error` is a tuple struct and its first field is the `ErrorKind`, +//! making dispatching on error kinds relatively compact: +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! # fn main() { +//! error_chain! { +//! errors { +//! InvalidToolchainName(t: String) { +//! description("invalid toolchain name") +//! display("invalid toolchain name: '{}'", t) +//! } +//! } +//! } +//! +//! match Error::from("error!") { +//! Error(ErrorKind::InvalidToolchainName(_), _) => { } +//! Error(ErrorKind::Msg(_), _) => { } +//! } +//! # } +//! ``` +//! +//! Chained errors are also matched with (relatively) compact syntax +//! +//! ``` +//! # #[macro_use] extern crate error_chain; +//! mod utils { +//! error_chain! { +//! errors { +//! BadStuff { +//! description("bad stuff") +//! } +//! } +//! } +//! } +//! +//! mod app { +//! error_chain! { +//! links { +//! Utils(::utils::Error, ::utils::ErrorKind); +//! } +//! } +//! } +//! +//! +//! # fn main() { +//! match app::Error::from("error!") { +//! app::Error(app::ErrorKind::Utils(utils::ErrorKind::BadStuff), _) => { } +//! _ => { } +//! } +//! # } +//! ``` +//! +//! ## Foreign links +//! +//! Errors that do not conform to the same conventions as this library +//! can still be included in the error chain. They are considered "foreign +//! errors", and are declared using the `foreign_links` block of the +//! `error_chain!` macro. `Error`s are automatically created from +//! foreign errors by the `try!` macro. +//! +//! Foreign links and regular links have one crucial difference: +//! `From` conversions for regular links *do not introduce a new error +//! into the error chain*, while conversions for foreign links *always +//! introduce a new error into the error chain*. So for the example +//! above all errors deriving from the `temp::Error` type will be +//! presented to the user as a new `ErrorKind::Temp` variant, and the +//! cause will be the original `temp::Error` error. In contrast, when +//! `rustup_utils::Error` is converted to `Error` the two `ErrorKind`s +//! are converted between each other to create a new `Error` but the +//! old error is discarded; there is no "cause" created from the +//! original error. +//! +//! ## Backtraces +//! +//! If the `RUST_BACKTRACE` environment variable is set to anything +//! but ``0``, the earliest non-foreign error to be generated creates +//! a single backtrace, which is passed through all `From` conversions +//! and `chain_err` invocations of compatible types. To read the +//! backtrace just call the `backtrace()` method. +//! +//! Backtrace generation can be disabled by turning off the `backtrace` feature. +//! +//! ## Iteration +//! +//! The `iter` method returns an iterator over the chain of error boxes. +//! +//! [error-type]: https://github.com/DanielKeep/rust-error-type +//! [quick-error]: https://github.com/tailhook/quick-error + + +#[cfg(feature = "backtrace")] +extern crate backtrace; + +use std::error; +use std::iter::Iterator; +#[cfg(feature = "backtrace")] +use std::sync::Arc; + +#[cfg(feature = "backtrace")] +pub use backtrace::Backtrace; +#[cfg(not(feature = "backtrace"))] +/// Dummy type used when the `backtrace` feature is disabled. +pub type Backtrace = (); + +#[macro_use] +mod quick_error; +#[macro_use] +mod error_chain; +#[macro_use] +mod quick_main; +pub use quick_main::ExitCode; +#[cfg(feature = "example_generated")] +pub mod example_generated; + +/// Iterator over the error chain using the `Error::cause()` method. +pub struct ErrorChainIter<'a>(pub Option<&'a error::Error>); + +impl<'a> Iterator for ErrorChainIter<'a> { + type Item = &'a error::Error; + + fn next<'b>(&'b mut self) -> Option<&'a error::Error> { + match self.0.take() { + Some(e) => { + self.0 = e.cause(); + Some(e) + } + None => None, + } + } +} + +/// Returns a backtrace of the current call stack if `RUST_BACKTRACE` +/// is set to anything but ``0``, and `None` otherwise. This is used +/// in the generated error implementations. +#[cfg(feature = "backtrace")] +#[doc(hidden)] +pub fn make_backtrace() -> Option> { + match std::env::var_os("RUST_BACKTRACE") { + Some(ref val) if val != "0" => Some(Arc::new(Backtrace::new())), + _ => None, + } +} + +/// This trait is implemented on all the errors generated by the `error_chain` +/// macro. +pub trait ChainedError: error::Error + Send + 'static { + /// Associated kind type. + type ErrorKind; + + /// Constructs an error from a kind, and generates a backtrace. + fn from_kind(kind: Self::ErrorKind) -> Self where Self: Sized; + + /// Returns the kind of the error. + fn kind(&self) -> &Self::ErrorKind; + + /// Iterates over the error chain. + fn iter(&self) -> ErrorChainIter; + + /// Returns the backtrace associated with this error. + fn backtrace(&self) -> Option<&Backtrace>; + + /// Creates an error from its parts. + #[doc(hidden)] + fn new(kind: Self::ErrorKind, state: State) -> Self where Self: Sized; + + /// Returns the first known backtrace, either from its State or from one + /// of the errors from `foreign_links`. + #[cfg(feature = "backtrace")] + #[doc(hidden)] + fn extract_backtrace(e: &(error::Error + Send + 'static)) -> Option> + where Self: Sized; +} + +/// Common state between errors. +#[derive(Debug)] +#[doc(hidden)] +pub struct State { + /// Next error in the error chain. + pub next_error: Option>, + /// Backtrace for the current error. + #[cfg(feature = "backtrace")] + pub backtrace: Option>, +} + +impl Default for State { + #[cfg(feature = "backtrace")] + fn default() -> State { + State { + next_error: None, + backtrace: make_backtrace(), + } + } + + #[cfg(not(feature = "backtrace"))] + fn default() -> State { + State { next_error: None } + } +} + +impl State { + /// Creates a new State type + #[cfg(feature = "backtrace")] + pub fn new(e: Box) -> State { + let backtrace = CE::extract_backtrace(&*e).or_else(make_backtrace); + State { + next_error: Some(e), + backtrace: backtrace, + } + } + + /// Creates a new State type + #[cfg(not(feature = "backtrace"))] + pub fn new(e: Box) -> State { + State { next_error: Some(e) } + } + + /// Returns the inner backtrace if present. + #[cfg(feature = "backtrace")] + pub fn backtrace(&self) -> Option<&Backtrace> { + self.backtrace.as_ref().map(|v| &**v) + } + + /// Returns the inner backtrace if present. + #[cfg(not(feature = "backtrace"))] + pub fn backtrace(&self) -> Option<&Backtrace> { + None + } +} + +/// Exits a function early with an error +/// +/// The `bail!` macro provides an easy way to exit a function. +/// `bail!(expr)` is equivalent to writing. +/// +/// ``` +/// # #[macro_use] extern crate error_chain; +/// # error_chain! { } +/// # fn main() { } +/// # fn foo() -> Result<()> { +/// # let expr = ""; +/// return Err(expr.into()); +/// # } +/// ``` +/// +/// And as shorthand it takes a formatting string a la `println!`: +/// +/// ``` +/// # #[macro_use] extern crate error_chain; +/// # error_chain! { } +/// # fn main() { } +/// # fn foo() -> Result<()> { +/// # let n = 0; +/// bail!("bad number: {}", n); +/// # } +/// ``` +/// +/// # Examples +/// +/// Bailing on a custom error: +/// +/// ``` +/// # #[macro_use] extern crate error_chain; +/// # fn main() {} +/// error_chain! { +/// errors { FooError } +/// } +/// +/// fn foo() -> Result<()> { +/// if bad_condition() { +/// bail!(ErrorKind::FooError); +/// } +/// +/// Ok(()) +/// } +/// +/// # fn bad_condition() -> bool { true } +/// ``` +/// +/// Bailing on a formatted string: +/// +/// ``` +/// # #[macro_use] extern crate error_chain; +/// # fn main() {} +/// error_chain! { } +/// +/// fn foo() -> Result<()> { +/// if let Some(bad_num) = bad_condition() { +/// bail!("so bad: {}", bad_num); +/// } +/// +/// Ok(()) +/// } +/// +/// # fn bad_condition() -> Option { None } +/// ``` +#[macro_export] +macro_rules! bail { + ($e:expr) => { + return Err($e.into()); + }; + ($fmt:expr, $($arg:tt)+) => { + return Err(format!($fmt, $($arg)+).into()); + }; +} + +#[doc(hidden)] +pub mod mock { + error_chain!{} +} diff --git a/third_party/rust/error-chain/src/quick_error.rs b/third_party/rust/error-chain/src/quick_error.rs new file mode 100644 index 000000000000..46ed8fe21a3e --- /dev/null +++ b/third_party/rust/error-chain/src/quick_error.rs @@ -0,0 +1,529 @@ +// From https://github.com/tailhook/quick-error +// Changes: +// - replace `impl Error` by `impl Item::description` +// - $imeta + +#[macro_export] +macro_rules! quick_error { + ( $(#[$meta:meta])* + pub enum $name:ident { $($chunks:tt)* } + ) => { + quick_error!(SORT [pub enum $name $(#[$meta])* ] + items [] buf [] + queue [ $($chunks)* ]); + }; + ( $(#[$meta:meta])* + enum $name:ident { $($chunks:tt)* } + ) => { + quick_error!(SORT [enum $name $(#[$meta])* ] + items [] buf [] + queue [ $($chunks)* ]); + }; + // Queue is empty, can do the work + (SORT [enum $name:ident $( #[$meta:meta] )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [ ] + queue [ ] + ) => { + quick_error!(ENUM_DEFINITION [enum $name $( #[$meta] )*] + body [] + queue [$($( #[$imeta] )* + => $iitem: $imode [$( $ivar: $ityp ),*] )*] + ); + quick_error!(IMPLEMENTATIONS $name {$( + $iitem: $imode [$(#[$imeta])*] [$( $ivar: $ityp ),*] {$( $ifuncs )*} + )*}); + $( + quick_error!(ERROR_CHECK $imode $($ifuncs)*); + )* + }; + (SORT [pub enum $name:ident $( #[$meta:meta] )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [ ] + queue [ ] + ) => { + quick_error!(ENUM_DEFINITION [pub enum $name $( #[$meta] )*] + body [] + queue [$($( #[$imeta] )* + => $iitem: $imode [$( $ivar: $ityp ),*] )*] + ); + quick_error!(IMPLEMENTATIONS $name {$( + $iitem: $imode [$(#[$imeta])*] [$( $ivar: $ityp ),*] {$( $ifuncs )*} + )*}); + $( + quick_error!(ERROR_CHECK $imode $($ifuncs)*); + )* + }; + // Add meta to buffer + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )*] + queue [ #[$qmeta:meta] $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*] + buf [$( #[$bmeta] )* #[$qmeta] ] + queue [$( $tail )*]); + }; + // Add ident to buffer + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )*] + queue [ $qitem:ident $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* + => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*] + buf [$(#[$bmeta])* => $qitem : UNIT [ ] ] + queue [$( $tail )*]); + }; + // Flush buffer on meta after ident + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )* + => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ] + queue [ #[$qmeta:meta] $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + enum [$( $(#[$emeta])* => $eitem $(( $($etyp),* ))* )* + $(#[$bmeta])* => $bitem: $bmode $(( $($btyp),* ))*] + items [$($( #[$imeta:meta] )* + => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )* + $bitem: $bmode [$( $bvar:$btyp ),*] {} ] + buf [ #[$qmeta] ] + queue [$( $tail )*]); + }; + // Add tuple enum-variant + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )* => $bitem:ident: UNIT [ ] ] + queue [($( $qvar:ident: $qtyp:ty ),+) $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*] + buf [$( #[$bmeta] )* => $bitem: TUPLE [$( $qvar:$qtyp ),*] ] + queue [$( $tail )*] + ); + }; + // Add struct enum-variant - e.g. { descr: &'static str } + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )* => $bitem:ident: UNIT [ ] ] + queue [{ $( $qvar:ident: $qtyp:ty ),+} $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*] + buf [$( #[$bmeta] )* => $bitem: STRUCT [$( $qvar:$qtyp ),*] ] + queue [$( $tail )*]); + }; + // Add struct enum-variant, with excess comma - e.g. { descr: &'static str, } + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )* => $bitem:ident: UNIT [ ] ] + queue [{$( $qvar:ident: $qtyp:ty ),+ ,} $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*] + buf [$( #[$bmeta] )* => $bitem: STRUCT [$( $qvar:$qtyp ),*] ] + queue [$( $tail )*]); + }; + // Add braces and flush always on braces + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )* + => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ] + queue [ {$( $qfuncs:tt )*} $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )* + $(#[$bmeta])* => $bitem: $bmode [$( $bvar:$btyp ),*] {$( $qfuncs )*} ] + buf [ ] + queue [$( $tail )*]); + }; + // Flush buffer on double ident + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )* + => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ] + queue [ $qitem:ident $( $tail:tt )*] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )* + $(#[$bmeta])* => $bitem: $bmode [$( $bvar:$btyp ),*] {} ] + buf [ => $qitem : UNIT [ ] ] + queue [$( $tail )*]); + }; + // Flush buffer on end + (SORT [$( $def:tt )*] + items [$($( #[$imeta:meta] )* + => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*] + {$( $ifuncs:tt )*} )* ] + buf [$( #[$bmeta:meta] )* + => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ] + queue [ ] + ) => { + quick_error!(SORT [$( $def )*] + items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )* + $(#[$bmeta])* => $bitem: $bmode [$( $bvar:$btyp ),*] {} ] + buf [ ] + queue [ ]); + }; + // Public enum (Queue Empty) + (ENUM_DEFINITION [pub enum $name:ident $( #[$meta:meta] )*] + body [$($( #[$imeta:meta] )* + => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ] + queue [ ] + ) => { + $(#[$meta])* + pub enum $name { + $( + $(#[$imeta])* + $iitem $(($( $ttyp ),*))* $({$( $svar: $styp ),*})*, + )* + } + }; + // Private enum (Queue Empty) + (ENUM_DEFINITION [enum $name:ident $( #[$meta:meta] )*] + body [$($( #[$imeta:meta] )* + => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ] + queue [ ] + ) => { + $(#[$meta])* + enum $name { + $( + $(#[$imeta])* + $iitem $(($( $ttyp ),*))* $({$( $svar: $styp ),*})*, + )* + } + }; + // Unit variant + (ENUM_DEFINITION [$( $def:tt )*] + body [$($( #[$imeta:meta] )* + => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ] + queue [$( #[$qmeta:meta] )* + => $qitem:ident: UNIT [ ] $( $queue:tt )*] + ) => { + quick_error!(ENUM_DEFINITION [ $($def)* ] + body [$($( #[$imeta] )* => $iitem ($(($( $ttyp ),+))*) {$({$( $svar: $styp ),*})*} )* + $( #[$qmeta] )* => $qitem () {} ] + queue [ $($queue)* ] + ); + }; + // Tuple variant + (ENUM_DEFINITION [$( $def:tt )*] + body [$($( #[$imeta:meta] )* + => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ] + queue [$( #[$qmeta:meta] )* + => $qitem:ident: TUPLE [$( $qvar:ident: $qtyp:ty ),+] $( $queue:tt )*] + ) => { + quick_error!(ENUM_DEFINITION [ $($def)* ] + body [$($( #[$imeta] )* => $iitem ($(($( $ttyp ),+))*) {$({$( $svar: $styp ),*})*} )* + $( #[$qmeta] )* => $qitem (($( $qtyp ),*)) {} ] + queue [ $($queue)* ] + ); + }; + // Struct variant + (ENUM_DEFINITION [$( $def:tt )*] + body [$($( #[$imeta:meta] )* + => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ] + queue [$( #[$qmeta:meta] )* + => $qitem:ident: STRUCT [$( $qvar:ident: $qtyp:ty ),*] $( $queue:tt )*] + ) => { + quick_error!(ENUM_DEFINITION [ $($def)* ] + body [$($( #[$imeta] )* => $iitem ($(($( $ttyp ),+))*) {$({$( $svar: $styp ),*})*} )* + $( #[$qmeta] )* => $qitem () {{$( $qvar: $qtyp ),*}} ] + queue [ $($queue)* ] + ); + }; + (IMPLEMENTATIONS + $name:ident {$( + $item:ident: $imode:tt [$(#[$imeta:meta])*] [$( $var:ident: $typ:ty ),*] {$( $funcs:tt )*} + )*} + ) => { + #[allow(unused)] + impl ::std::fmt::Display for $name { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter) + -> ::std::fmt::Result + { + match *self { + $( + $(#[$imeta])* + quick_error!(ITEM_PATTERN + $name $item: $imode [$( ref $var ),*] + ) => { + let display_fn = quick_error!(FIND_DISPLAY_IMPL + $name $item: $imode + {$( $funcs )*}); + + display_fn(self, fmt) + } + )* + } + } + } + /*#[allow(unused)] + impl ::std::error::Error for $name { + fn description(&self) -> &str { + match *self { + $( + quick_error!(ITEM_PATTERN + $name $item: $imode [$( ref $var ),*] + ) => { + quick_error!(FIND_DESCRIPTION_IMPL + $item: $imode self fmt [$( $var ),*] + {$( $funcs )*}) + } + )* + } + } + fn cause(&self) -> Option<&::std::error::Error> { + match *self { + $( + quick_error!(ITEM_PATTERN + $name $item: $imode [$( ref $var ),*] + ) => { + quick_error!(FIND_CAUSE_IMPL + $item: $imode [$( $var ),*] + {$( $funcs )*}) + } + )* + } + } + }*/ + #[allow(unused)] + impl $name { + /// A string describing the error kind. + pub fn description(&self) -> &str { + match *self { + $( + $(#[$imeta])* + quick_error!(ITEM_PATTERN + $name $item: $imode [$( ref $var ),*] + ) => { + quick_error!(FIND_DESCRIPTION_IMPL + $item: $imode self fmt [$( $var ),*] + {$( $funcs )*}) + } + )* + } + } + } + $( + quick_error!(FIND_FROM_IMPL + $name $item: $imode [$( $var:$typ ),*] + {$( $funcs )*}); + )* + }; + (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt + { display($self_:tt) -> ($( $exprs:tt )*) $( $tail:tt )*} + ) => { + |quick_error!(IDENT $self_): &$name, f: &mut ::std::fmt::Formatter| { + write!(f, $( $exprs )*) + } + }; + (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt + { display($pattern:expr) $( $tail:tt )*} + ) => { + |_, f: &mut ::std::fmt::Formatter| { write!(f, $pattern) } + }; + (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt + { display($pattern:expr, $( $exprs:tt )*) $( $tail:tt )*} + ) => { + |_, f: &mut ::std::fmt::Formatter| { write!(f, $pattern, $( $exprs )*) } + }; + (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt + { $t:tt $( $tail:tt )*} + ) => { + quick_error!(FIND_DISPLAY_IMPL + $name $item: $imode + {$( $tail )*}) + }; + (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt + { } + ) => { + |self_: &$name, f: &mut ::std::fmt::Formatter| { + write!(f, "{}", self_.description()) + } + }; + (FIND_DESCRIPTION_IMPL $item:ident: $imode:tt $me:ident $fmt:ident + [$( $var:ident ),*] + { description($expr:expr) $( $tail:tt )*} + ) => { + $expr + }; + (FIND_DESCRIPTION_IMPL $item:ident: $imode:tt $me:ident $fmt:ident + [$( $var:ident ),*] + { $t:tt $( $tail:tt )*} + ) => { + quick_error!(FIND_DESCRIPTION_IMPL + $item: $imode $me $fmt [$( $var ),*] + {$( $tail )*}) + }; + (FIND_DESCRIPTION_IMPL $item:ident: $imode:tt $me:ident $fmt:ident + [$( $var:ident ),*] + { } + ) => { + stringify!($item) + }; + (FIND_CAUSE_IMPL $item:ident: $imode:tt + [$( $var:ident ),*] + { cause($expr:expr) $( $tail:tt )*} + ) => { + Some($expr) + }; + (FIND_CAUSE_IMPL $item:ident: $imode:tt + [$( $var:ident ),*] + { $t:tt $( $tail:tt )*} + ) => { + quick_error!(FIND_CAUSE_IMPL + $item: $imode [$( $var ),*] + { $($tail)* }) + }; + (FIND_CAUSE_IMPL $item:ident: $imode:tt + [$( $var:ident ),*] + { } + ) => { + None + }; + (FIND_FROM_IMPL $name:ident $item:ident: $imode:tt + [$( $var:ident: $typ:ty ),*] + { from() $( $tail:tt )*} + ) => { + $( + impl From<$typ> for $name { + fn from($var: $typ) -> $name { + $name::$item($var) + } + } + )* + quick_error!(FIND_FROM_IMPL + $name $item: $imode [$( $var:$typ ),*] + {$( $tail )*}); + }; + (FIND_FROM_IMPL $name:ident $item:ident: UNIT + [ ] + { from($ftyp:ty) $( $tail:tt )*} + ) => { + impl From<$ftyp> for $name { + fn from(_discarded_error: $ftyp) -> $name { + $name::$item + } + } + quick_error!(FIND_FROM_IMPL + $name $item: UNIT [ ] + {$( $tail )*}); + }; + (FIND_FROM_IMPL $name:ident $item:ident: TUPLE + [$( $var:ident: $typ:ty ),*] + { from($fvar:ident: $ftyp:ty) -> ($( $texpr:expr ),*) $( $tail:tt )*} + ) => { + impl From<$ftyp> for $name { + fn from($fvar: $ftyp) -> $name { + $name::$item($( $texpr ),*) + } + } + quick_error!(FIND_FROM_IMPL + $name $item: TUPLE [$( $var:$typ ),*] + { $($tail)* }); + }; + (FIND_FROM_IMPL $name:ident $item:ident: STRUCT + [$( $var:ident: $typ:ty ),*] + { from($fvar:ident: $ftyp:ty) -> {$( $tvar:ident: $texpr:expr ),*} $( $tail:tt )*} + ) => { + impl From<$ftyp> for $name { + fn from($fvar: $ftyp) -> $name { + $name::$item { + $( $tvar: $texpr ),* + } + } + } + quick_error!(FIND_FROM_IMPL + $name $item: STRUCT [$( $var:$typ ),*] + { $($tail)* }); + }; + (FIND_FROM_IMPL $name:ident $item:ident: $imode:tt + [$( $var:ident: $typ:ty ),*] + { $t:tt $( $tail:tt )*} + ) => { + quick_error!(FIND_FROM_IMPL + $name $item: $imode [$( $var:$typ ),*] + {$( $tail )*} + ); + }; + (FIND_FROM_IMPL $name:ident $item:ident: $imode:tt + [$( $var:ident: $typ:ty ),*] + { } + ) => { + }; + (ITEM_BODY $(#[$imeta:meta])* $item:ident: UNIT + ) => { }; + (ITEM_BODY $(#[$imeta:meta])* $item:ident: TUPLE + [$( $typ:ty ),*] + ) => { + ($( $typ ),*) + }; + (ITEM_BODY $(#[$imeta:meta])* $item:ident: STRUCT + [$( $var:ident: $typ:ty ),*] + ) => { + {$( $var:$typ ),*} + }; + (ITEM_PATTERN $name:ident $item:ident: UNIT [] + ) => { + $name::$item + }; + (ITEM_PATTERN $name:ident $item:ident: TUPLE + [$( ref $var:ident ),*] + ) => { + $name::$item ($( ref $var ),*) + }; + (ITEM_PATTERN $name:ident $item:ident: STRUCT + [$( ref $var:ident ),*] + ) => { + $name::$item {$( ref $var ),*} + }; + // This one should match all allowed sequences in "funcs" but not match + // anything else. + // This is to contrast FIND_* clauses which just find stuff they need and + // skip everything else completely + (ERROR_CHECK $imode:tt display($self_:tt) -> ($( $exprs:tt )*) $( $tail:tt )*) + => { quick_error!(ERROR_CHECK $imode $($tail)*); }; + (ERROR_CHECK $imode:tt display($pattern: expr) $( $tail:tt )*) + => { quick_error!(ERROR_CHECK $imode $($tail)*); }; + (ERROR_CHECK $imode:tt display($pattern: expr, $( $exprs:tt )*) $( $tail:tt )*) + => { quick_error!(ERROR_CHECK $imode $($tail)*); }; + (ERROR_CHECK $imode:tt description($expr:expr) $( $tail:tt )*) + => { quick_error!(ERROR_CHECK $imode $($tail)*); }; + (ERROR_CHECK $imode:tt cause($expr:expr) $($tail:tt)*) + => { quick_error!(ERROR_CHECK $imode $($tail)*); }; + (ERROR_CHECK $imode:tt from() $($tail:tt)*) + => { quick_error!(ERROR_CHECK $imode $($tail)*); }; + (ERROR_CHECK $imode:tt from($ftyp:ty) $($tail:tt)*) + => { quick_error!(ERROR_CHECK $imode $($tail)*); }; + (ERROR_CHECK TUPLE from($fvar:ident: $ftyp:ty) -> ($( $e:expr ),*) $( $tail:tt )*) + => { quick_error!(ERROR_CHECK TUPLE $($tail)*); }; + (ERROR_CHECK STRUCT from($fvar:ident: $ftyp:ty) -> {$( $v:ident: $e:expr ),*} $( $tail:tt )*) + => { quick_error!(ERROR_CHECK STRUCT $($tail)*); }; + (ERROR_CHECK $imode:tt ) => {}; + // Utility functions + (IDENT $ident:ident) => { $ident } +} diff --git a/third_party/rust/error-chain/src/quick_main.rs b/third_party/rust/error-chain/src/quick_main.rs new file mode 100644 index 000000000000..ce7eae6e47f7 --- /dev/null +++ b/third_party/rust/error-chain/src/quick_main.rs @@ -0,0 +1,77 @@ +/// Convenient wrapper to be able to use `try!` and such in the main. You can +/// use it with a separated function: +/// +/// ```ignore +/// # #[macro_use] extern crate error_chain; +/// # error_chain! {} +/// quick_main!(run); +/// +/// fn run() -> Result<()> { +/// Err("error".into()) +/// } +/// ``` +/// +/// or with a closure: +/// +/// ```ignore +/// # #[macro_use] extern crate error_chain; +/// # error_chain! {} +/// quick_main!(|| -> Result<()> { +/// Err("error".into()) +/// }); +/// ``` +/// +/// You can also set the exit value of the process by returning a type that implements [`ExitCode`](trait.ExitCode.html): +/// +/// ```ignore +/// # #[macro_use] extern crate error_chain; +/// # error_chain! {} +/// quick_main!(run); +/// +/// fn run() -> Result { +/// Err("error".into()) +/// } +/// ``` +#[macro_export] +macro_rules! quick_main { + ($main:expr) => { + fn main() { + use ::std::io::Write; + let stderr = &mut ::std::io::stderr(); + let errmsg = "Error writing to stderr"; + + ::std::process::exit(match $main() { + Ok(ret) => $crate::ExitCode::code(ret), + Err(ref e) => { + let e: &$crate::ChainedError = e; + writeln!(stderr, "Error: {}", e).expect(errmsg); + + for e in e.iter().skip(1) { + writeln!(stderr, "Caused by: {}", e).expect(errmsg); + } + + if let Some(backtrace) = e.backtrace() { + writeln!(stderr, "{:?}", backtrace).expect(errmsg); + } + + 1 + } + }); + } + }; +} + +/// Represents a value that can be used as the exit status of the process. +/// See [`quick_main!`](macro.quick_main.html). +pub trait ExitCode { + /// Returns the value to use as the exit status. + fn code(self) -> i32; +} + +impl ExitCode for i32 { + fn code(self) -> i32 { self } +} + +impl ExitCode for () { + fn code(self) -> i32 { 0 } +} diff --git a/third_party/rust/error-chain/tests/quick_main.rs b/third_party/rust/error-chain/tests/quick_main.rs new file mode 100644 index 000000000000..3acda0f2a3a3 --- /dev/null +++ b/third_party/rust/error-chain/tests/quick_main.rs @@ -0,0 +1,30 @@ +#![allow(dead_code)] +#[macro_use] +extern crate error_chain; + +error_chain!(); + +mod unit { + use super::*; + quick_main!(run); + + fn run() -> Result<()> { + Ok(()) + } +} + +mod i32 { + use super::*; + quick_main!(run); + + fn run() -> Result { + Ok(1) + } +} + +mod closure { + use super::*; + quick_main!(|| -> Result<()> { + Ok(()) + }); +} diff --git a/third_party/rust/error-chain/tests/tests.rs b/third_party/rust/error-chain/tests/tests.rs new file mode 100644 index 000000000000..1d7544c33716 --- /dev/null +++ b/third_party/rust/error-chain/tests/tests.rs @@ -0,0 +1,543 @@ +#![allow(dead_code)] +//#![feature(trace_macros)] +// +//trace_macros!(true); + +#[macro_use] +extern crate error_chain; + +#[test] +fn smoke_test_1() { + error_chain! { + types { + Error, ErrorKind, ResultExt, Result; + } + + links { } + + foreign_links { } + + errors { } + }; +} + +#[test] +fn smoke_test_2() { + error_chain! { + types { } + + links { } + + foreign_links { } + + errors { } + }; +} + +#[test] +fn smoke_test_3() { + error_chain! { + links { } + + foreign_links { } + + errors { } + }; +} + +#[test] +fn smoke_test_4() { + error_chain! { + links { } + + foreign_links { } + + errors { + HttpStatus(e: u32) { + description("http request returned an unsuccessful status code") + display("http request returned an unsuccessful status code: {}", e) + } + } + }; +} + +#[test] +fn smoke_test_5() { + error_chain! { + types { } + + links { } + + foreign_links { } + + errors { + HttpStatus(e: u32) { + description("http request returned an unsuccessful status code") + display("http request returned an unsuccessful status code: {}", e) + } + } + }; +} + +#[test] +fn smoke_test_6() { + error_chain! { + errors { + HttpStatus(e: u32) { + description("http request returned an unsuccessful status code") + display("http request returned an unsuccessful status code: {}", e) + } + } + }; +} + +#[test] +fn smoke_test_7() { + error_chain! { + types { } + + foreign_links { } + + errors { + HttpStatus(e: u32) { + description("http request returned an unsuccessful status code") + display("http request returned an unsuccessful status code: {}", e) + } + } + }; +} + +#[test] +fn smoke_test_8() { + error_chain! { + types { } + + links { } + links { } + + foreign_links { } + foreign_links { } + + errors { + FileNotFound + AccessDenied + } + }; +} + +#[test] +fn order_test_1() { + error_chain! { types { } links { } foreign_links { } errors { } }; +} + +#[test] +fn order_test_2() { + error_chain! { links { } types { } foreign_links { } errors { } }; +} + +#[test] +fn order_test_3() { + error_chain! { foreign_links { } links { } errors { } types { } }; +} + +#[test] +fn order_test_4() { + error_chain! { errors { } types { } foreign_links { } }; +} + +#[test] +fn order_test_5() { + error_chain! { foreign_links { } types { } }; +} + +#[test] +fn order_test_6() { + error_chain! { + links { } + + errors { + HttpStatus(e: u32) { + description("http request returned an unsuccessful status code") + display("http request returned an unsuccessful status code: {}", e) + } + } + + + foreign_links { } + }; +} + +#[test] +fn order_test_7() { + error_chain! { + links { } + + foreign_links { } + + types { + Error, ErrorKind, ResultExt, Result; + } + }; +} + + +#[test] +fn order_test_8() { + error_chain! { + links { } + + foreign_links { } + foreign_links { } + + types { + Error, ErrorKind, ResultExt, Result; + } + }; +} + +#[test] +fn empty() { + error_chain! { }; +} + +#[test] +#[cfg(feature = "backtrace")] +fn has_backtrace_depending_on_env() { + use std::env; + + error_chain! { + types {} + links {} + foreign_links {} + errors { + MyError + } + } + + let original_value = env::var_os("RUST_BACKTRACE"); + + // missing RUST_BACKTRACE and RUST_BACKTRACE=0 + env::remove_var("RUST_BACKTRACE"); + let err = Error::from(ErrorKind::MyError); + assert!(err.backtrace().is_none()); + env::set_var("RUST_BACKTRACE", "0"); + let err = Error::from(ErrorKind::MyError); + assert!(err.backtrace().is_none()); + + // RUST_BACKTRACE set to anything but 0 + env::set_var("RUST_BACKTRACE", "yes"); + let err = Error::from(ErrorKind::MyError); + assert!(err.backtrace().is_some()); + + if let Some(var) = original_value { + env::set_var("RUST_BACKTRACE", var); + } +} + +#[test] +fn chain_err() { + use std::fmt; + + error_chain! { + foreign_links { + Fmt(fmt::Error); + } + errors { + Test + } + } + + let _: Result<()> = Err(fmt::Error).chain_err(|| ""); + let _: Result<()> = Err(Error::from_kind(ErrorKind::Test)).chain_err(|| ""); +} + +#[test] +fn links() { + mod test { + error_chain! {} + } + + error_chain! { + links { + Test(test::Error, test::ErrorKind); + } + } +} + +#[cfg(test)] +mod foreign_link_test { + + use std::fmt; + + // Note: foreign errors must be `pub` because they appear in the + // signature of the public foreign_link_error_path + #[derive(Debug)] + pub struct ForeignError { + cause: ForeignErrorCause + } + + impl ::std::error::Error for ForeignError { + fn description(&self) -> &'static str { + "Foreign error description" + } + + fn cause(&self) -> Option<&::std::error::Error> { Some(&self.cause) } + } + + impl fmt::Display for ForeignError { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "Foreign error display") + } + } + + #[derive(Debug)] + pub struct ForeignErrorCause {} + + impl ::std::error::Error for ForeignErrorCause { + fn description(&self) -> &'static str { + "Foreign error cause description" + } + + fn cause(&self) -> Option<&::std::error::Error> { None } + } + + impl fmt::Display for ForeignErrorCause { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "Foreign error cause display") + } + } + + error_chain! { + types{ + Error, ErrorKind, ResultExt, Result; + } + links {} + foreign_links { + Foreign(ForeignError); + Io(::std::io::Error); + } + errors {} + } + + #[test] + fn display_underlying_error() { + let chained_error = try_foreign_error().err().unwrap(); + assert_eq!( + format!("{}", ForeignError{ cause: ForeignErrorCause{} }), + format!("{}", chained_error) + ); + } + + #[test] + fn finds_cause() { + let chained_error = try_foreign_error().err().unwrap(); + assert_eq!( + format!("{}", ForeignErrorCause{}), + format!("{}", ::std::error::Error::cause(&chained_error).unwrap()) + ); + } + + #[test] + fn iterates() { + let chained_error = try_foreign_error().err().unwrap(); + let mut error_iter = chained_error.iter(); + assert_eq!( + format!("{}", ForeignError{ cause: ForeignErrorCause{} }), + format!("{}", error_iter.next().unwrap()) + ); + assert_eq!( + format!("{}", ForeignErrorCause{}), + format!("{}", error_iter.next().unwrap()) + ); + assert_eq!( + format!("{:?}", None as Option<&::std::error::Error>), + format!("{:?}", error_iter.next()) + ); + } + + fn try_foreign_error() -> Result<()> { + try!(Err(ForeignError{ + cause: ForeignErrorCause{} + })); + Ok(()) + } +} + +#[cfg(test)] +mod attributes_test { + #[allow(unused_imports)] + use std::io; + + #[cfg(not(test))] + mod inner { + error_chain! { + + } + } + + error_chain! { + types { + Error, ErrorKind, ResultExt, Result; + } + + links { + Inner(inner::Error, inner::ErrorKind) #[cfg(not(test))]; + } + + foreign_links { + Io(io::Error) #[cfg(not(test))]; + } + + errors { + #[cfg(not(test))] + AnError { + + } + } + } +} + +#[test] +fn with_result() { + error_chain! { + types { + Error, ErrorKind, ResultExt, Result; + } + } + let _: Result<()> = Ok(()); +} + +#[test] +fn without_result() { + error_chain! { + types { + Error, ErrorKind, ResultExt; + } + } + let _: Result<(), ()> = Ok(()); +} + +#[test] +fn documentation() { + mod inner { + error_chain! {} + } + + error_chain! { + links { + Inner(inner::Error, inner::ErrorKind) #[doc = "Doc"]; + } + foreign_links { + Io(::std::io::Error) #[doc = "Doc"]; + } + errors { + /// Doc + Variant + } + } +} + +#[cfg(test)] +mod multiple_error_same_mod { + error_chain! { + types { + MyError, MyErrorKind, MyResultExt, MyResult; + } + } + error_chain! {} +} + +#[doc(test)] +#[deny(dead_code)] +mod allow_dead_code { + error_chain! {} +} + +// Make sure links actually work! +#[test] +fn rustup_regression() { + error_chain! { + links { + Download(error_chain::mock::Error, error_chain::mock::ErrorKind); + } + + foreign_links { } + + errors { + LocatingWorkingDir { + description("could not locate working directory") + } + } + } +} + +#[test] +fn error_patterns() { + error_chain! { + links { } + + foreign_links { } + + errors { } + } + + // Tuples look nice when matching errors + match Error::from("Test") { + Error(ErrorKind::Msg(_), _) => { + } + } +} + +#[test] +fn error_first() { + error_chain! { + errors { + LocatingWorkingDir { + description("could not locate working directory") + } + } + + links { + Download(error_chain::mock::Error, error_chain::mock::ErrorKind); + } + + foreign_links { } + } +} + +#[test] +fn bail() { + error_chain! { + errors { Foo } + } + + fn foo() -> Result<()> { + bail!(ErrorKind::Foo) + } + + fn bar() -> Result<()> { + bail!("bar") + } + + fn baz() -> Result<()> { + bail!("{}", "baz") + } +} + +/// Since the `types` declaration is a list of symbols, check if we +/// don't change their meaning or order. +#[test] +fn types_declarations() { + error_chain! { + types { + MyError, MyErrorKind, MyResultExt, MyResult; + } + } + + MyError::from_kind(MyErrorKind::Msg("".into())); + + let err: Result<(), ::std::io::Error> = Ok(()); + MyResultExt::chain_err(err, || "").unwrap(); + + let _: MyResult<()> = Ok(()); +} diff --git a/third_party/rust/euclid/.cargo-checksum.json b/third_party/rust/euclid/.cargo-checksum.json new file mode 100644 index 000000000000..c521a24aad75 --- /dev/null +++ b/third_party/rust/euclid/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"118514fd9c4958df0d25584cda4917186c46011569f55ef350530c1ad3fbdb48",".travis.yml":"13d3e5a7bf83b04c8e8cfa14f0297bd8366d68391d977dd547f64707dffc275a","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"9484a5c54400981285d2c2389d07a6638334dd2b64caab8b18b4009111932e8b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"7a5648f52b09d3213348177860171d4f19b0fdda55e8fed7c04dafcb0ed9c215","src/approxeq.rs":"2987e046c90d948b6c7d7ddba52d10c8b7520d71dc0a50dbe7665de128d7410e","src/length.rs":"27e6f997c2eafdb22d1eab8054e49e77a61c31ea491b50b2c4569d3e847f3e70","src/lib.rs":"3ad04d3c1a18f697c8d28a1fbe871a4c75e0e957008745c6a4990e8fb07663d1","src/macros.rs":"1e999b322c2093c9c945386d15c3e95bd657c06b02e78235556db0bdbd162318","src/matrix2d.rs":"78d3b44e46be2b9c0ed1d98473cbbed78941cbf8cc76266be9f420966f1c1607","src/matrix4d.rs":"c3325f30a7a35575104a6b02fd0740d5be22e032881808550f28d22ea8eef625","src/num.rs":"62286aa642ce3afa7ebd950f50bf2197d8722907f2e23a2e2ea6690484d8b250","src/point.rs":"a585ad405a69505792efb624f0c0e6345b92b27a2c77e9a4366d6192ac914ef0","src/rect.rs":"d9bc96b8a3bc52ab2d49b53c4687e13230ab5d2920ea60e4070dea153489a633","src/scale_factor.rs":"3cffe0e88f035b8b5c9b27b105fb2825db5f317d7e067c88ee5d51cac4e6e583","src/side_offsets.rs":"f85526a421ffda63ff01a3478d4162c8717eef68e942acfa2fd9a1adee02ebb2","src/size.rs":"48fbec0b24056bed77e5a776338b277a2a5ad6ad836cac5c4b9c8c784753c82f","src/trig.rs":"6b207980052d13c625272f2a70a22f7741b59513c2a4882385926f497c763a63"},"package":"0c274f13773ec277a48408d0c7a8dc935ad4bfe190f4cfccd0126d203afc3c83"} \ No newline at end of file diff --git a/third_party/rust/euclid/.cargo-ok b/third_party/rust/euclid/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/euclid/.gitignore b/third_party/rust/euclid/.gitignore new file mode 100644 index 000000000000..80faedecfd74 --- /dev/null +++ b/third_party/rust/euclid/.gitignore @@ -0,0 +1,2 @@ +Cargo.lock +/target/ diff --git a/third_party/rust/euclid/.travis.yml b/third_party/rust/euclid/.travis.yml new file mode 100644 index 000000000000..a12141757c47 --- /dev/null +++ b/third_party/rust/euclid/.travis.yml @@ -0,0 +1,19 @@ +language: rust + +notifications: + webhooks: http://build.servo.org:54856/travis + +matrix: + include: + - rust: stable + env: FEATURES="" + - rust: beta + env: FEATURES="" + - rust: nightly + env: FEATURES="" + - rust: nightly + env: FEATURES="unstable" + +script: + - cargo build --verbose --features "$FEATURES" + - cargo test --verbose --features "$FEATURES" diff --git a/third_party/rust/euclid/COPYRIGHT b/third_party/rust/euclid/COPYRIGHT new file mode 100644 index 000000000000..8b7291ad281c --- /dev/null +++ b/third_party/rust/euclid/COPYRIGHT @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 or the MIT license +, at your +option. All files in the project carrying such notice may not be +copied, modified, or distributed except according to those terms. diff --git a/third_party/rust/euclid/Cargo.toml b/third_party/rust/euclid/Cargo.toml new file mode 100644 index 000000000000..3a2e645f3796 --- /dev/null +++ b/third_party/rust/euclid/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "euclid" +version = "0.10.3" +authors = ["The Servo Project Developers"] +description = "Geometry primitives" +documentation = "http://doc.servo.org/euclid/" +repository = "https://github.com/servo/euclid" +license = "MIT / Apache-2.0" + +[features] +unstable = [] + +[dependencies] +heapsize = "0.3" +rustc-serialize = "0.3.2" +num-traits = {version = "0.1.32", default-features = false} +log = "0.3.1" +serde = "0.8" + +[dev-dependencies] +rand = "0.3.7" diff --git a/third_party/rust/euclid/LICENSE-APACHE b/third_party/rust/euclid/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/euclid/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/euclid/LICENSE-MIT b/third_party/rust/euclid/LICENSE-MIT new file mode 100644 index 000000000000..807526f57f3a --- /dev/null +++ b/third_party/rust/euclid/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2012-2013 Mozilla Foundation + +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. diff --git a/third_party/rust/euclid/README.md b/third_party/rust/euclid/README.md new file mode 100644 index 000000000000..5d21d9e6e5e5 --- /dev/null +++ b/third_party/rust/euclid/README.md @@ -0,0 +1,5 @@ +# euclid + +This is a small library for geometric types. + +[Documentation](http://doc.servo.org/euclid/) diff --git a/third_party/rust/euclid/src/approxeq.rs b/third_party/rust/euclid/src/approxeq.rs new file mode 100644 index 000000000000..10151110669a --- /dev/null +++ b/third_party/rust/euclid/src/approxeq.rs @@ -0,0 +1,47 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +/// Trait for testing approximate equality +pub trait ApproxEq { + fn approx_epsilon() -> Eps; + fn approx_eq(&self, other: &Self) -> bool; + fn approx_eq_eps(&self, other: &Self, approx_epsilon: &Eps) -> bool; +} + +impl ApproxEq for f32 { + #[inline] + fn approx_epsilon() -> f32 { 1.0e-6 } + + #[inline] + fn approx_eq(&self, other: &f32) -> bool { + self.approx_eq_eps(other, &1.0e-6) + } + + #[inline] + fn approx_eq_eps(&self, other: &f32, approx_epsilon: &f32) -> bool { + (*self - *other).abs() < *approx_epsilon + } +} + + +impl ApproxEq for f64 { + #[inline] + fn approx_epsilon() -> f64 { 1.0e-6 } + + #[inline] + fn approx_eq(&self, other: &f64) -> bool { + self.approx_eq_eps(other, &1.0e-6) + } + + #[inline] + fn approx_eq_eps(&self, other: &f64, approx_epsilon: &f64) -> bool { + (*self - *other).abs() < *approx_epsilon + } +} diff --git a/third_party/rust/euclid/src/length.rs b/third_party/rust/euclid/src/length.rs new file mode 100644 index 000000000000..0f7bf4ef1ff0 --- /dev/null +++ b/third_party/rust/euclid/src/length.rs @@ -0,0 +1,301 @@ +// Copyright 2014 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +//! A one-dimensional length, tagged with its units. + +use scale_factor::ScaleFactor; +use num::Zero; + +use heapsize::HeapSizeOf; +use num_traits::{NumCast, Saturating}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use std::cmp::Ordering; +use std::ops::{Add, Sub, Mul, Div, Neg}; +use std::ops::{AddAssign, SubAssign}; +use std::marker::PhantomData; +use std::fmt; + +/// A one-dimensional distance, with value represented by `T` and unit of measurement `Unit`. +/// +/// `T` can be any numeric type, for example a primitive type like u64 or f32. +/// +/// `Unit` is not used in the representation of a Length value. It is used only at compile time +/// to ensure that a Length stored with one unit is converted explicitly before being used in an +/// expression that requires a different unit. It may be a type without values, such as an empty +/// enum. +/// +/// You can multiply a Length by a `scale_factor::ScaleFactor` to convert it from one unit to +/// another. See the `ScaleFactor` docs for an example. +// Uncomment the derive, and remove the macro call, once heapsize gets +// PhantomData support. +#[derive(RustcDecodable, RustcEncodable)] +pub struct Length(pub T, PhantomData); + +impl Clone for Length { + fn clone(&self) -> Self { + Length(self.0.clone(), PhantomData) + } +} + +impl Copy for Length {} + +impl HeapSizeOf for Length { + fn heap_size_of_children(&self) -> usize { + self.0.heap_size_of_children() + } +} + +impl Deserialize for Length where T: Deserialize { + fn deserialize(deserializer: &mut D) -> Result,D::Error> + where D: Deserializer { + Ok(Length(try!(Deserialize::deserialize(deserializer)), PhantomData)) + } +} + +impl Serialize for Length where T: Serialize { + fn serialize(&self, serializer: &mut S) -> Result<(),S::Error> where S: Serializer { + self.0.serialize(serializer) + } +} + +impl Length { + pub fn new(x: T) -> Length { + Length(x, PhantomData) + } +} + +impl Length { + pub fn get(&self) -> T { + self.0.clone() + } +} + +impl fmt::Debug for Length { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.get().fmt(f) + } +} + +impl fmt::Display for Length { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.get().fmt(f) + } +} + +// length + length +impl> Add for Length { + type Output = Length; + fn add(self, other: Length) -> Length { + Length::new(self.get() + other.get()) + } +} + +// length += length +impl> AddAssign for Length { + fn add_assign(&mut self, other: Length) { + self.0 += other.get(); + } +} + +// length - length +impl> Sub> for Length { + type Output = Length; + fn sub(self, other: Length) -> ::Output { + Length::new(self.get() - other.get()) + } +} + +// length -= length +impl> SubAssign for Length { + fn sub_assign(&mut self, other: Length) { + self.0 -= other.get(); + } +} + +// Saturating length + length and length - length. +impl Saturating for Length { + fn saturating_add(self, other: Length) -> Length { + Length::new(self.get().saturating_add(other.get())) + } + + fn saturating_sub(self, other: Length) -> Length { + Length::new(self.get().saturating_sub(other.get())) + } +} + +// length / length +impl> Div> for Length { + type Output = ScaleFactor; + #[inline] + fn div(self, other: Length) -> ScaleFactor { + ScaleFactor::new(self.get() / other.get()) + } +} + +// length * scaleFactor +impl> Mul> for Length { + type Output = Length; + #[inline] + fn mul(self, scale: ScaleFactor) -> Length { + Length::new(self.get() * scale.get()) + } +} + +// length / scaleFactor +impl> Div> for Length { + type Output = Length; + #[inline] + fn div(self, scale: ScaleFactor) -> Length { + Length::new(self.get() / scale.get()) + } +} + +// -length +impl > Neg for Length { + type Output = Length; + #[inline] + fn neg(self) -> Length { + Length::new(-self.get()) + } +} + +impl Length { + /// Cast from one numeric representation to another, preserving the units. + pub fn cast(&self) -> Option> { + NumCast::from(self.get()).map(Length::new) + } +} + +impl PartialEq for Length { + fn eq(&self, other: &Length) -> bool { self.get().eq(&other.get()) } +} + +impl PartialOrd for Length { + fn partial_cmp(&self, other: &Length) -> Option { + self.get().partial_cmp(&other.get()) + } +} + +impl Eq for Length {} + +impl Ord for Length { + fn cmp(&self, other: &Length) -> Ordering { self.get().cmp(&other.get()) } +} + +impl Zero for Length { + fn zero() -> Length { + Length::new(Zero::zero()) + } +} + +#[cfg(test)] +mod tests { + use super::Length; + use num_traits::Saturating; + use scale_factor::ScaleFactor; + + enum Inch {} + enum Mm {} + + #[test] + fn test_length() { + let mm_per_inch: ScaleFactor = ScaleFactor::new(25.4); + + let one_foot: Length = Length::new(12.0); + let two_feet = one_foot.clone() + one_foot.clone(); + let zero_feet = one_foot.clone() - one_foot.clone(); + + assert_eq!(one_foot.get(), 12.0); + assert_eq!(two_feet.get(), 24.0); + assert_eq!(zero_feet.get(), 0.0); + + assert!(one_foot == one_foot); + assert!(two_feet != one_foot); + + assert!(zero_feet < one_foot); + assert!(zero_feet <= one_foot); + assert!(two_feet > one_foot); + assert!(two_feet >= one_foot); + + assert!( two_feet <= two_feet); + assert!( two_feet >= two_feet); + assert!(!(two_feet > two_feet)); + assert!(!(two_feet < two_feet)); + + let one_foot_in_mm: Length = one_foot * mm_per_inch; + + assert_eq!(one_foot_in_mm, Length::new(304.8)); + assert_eq!(one_foot_in_mm / one_foot, mm_per_inch); + + let back_to_inches: Length = one_foot_in_mm / mm_per_inch; + assert_eq!(one_foot, back_to_inches); + + let int_foot: Length = one_foot.cast().unwrap(); + assert_eq!(int_foot.get(), 12); + + let negative_one_foot = -one_foot; + assert_eq!(negative_one_foot.get(), -12.0); + + let negative_two_feet = -two_feet; + assert_eq!(negative_two_feet.get(), -24.0); + + let zero_feet: Length = Length::new(0.0); + let negative_zero_feet = -zero_feet; + assert_eq!(negative_zero_feet.get(), 0.0); + } + + #[test] + fn test_add() { + let length1: Length = Length::new(250); + let length2: Length = Length::new(5); + + let result = length1 + length2; + + assert_eq!(result.get(), 255); + } + + #[test] + fn test_saturating_add() { + let length1: Length = Length::new(250); + let length2: Length = Length::new(6); + + let result = length1.saturating_add(length2); + + assert_eq!(result.get(), 255); + } + + #[test] + fn test_saturating_sub() { + let length1: Length = Length::new(5); + let length2: Length = Length::new(10); + + let result = length1.saturating_sub(length2); + + assert_eq!(result.get(), 0); + } + + #[test] + fn test_addassign() { + let one_cm: Length = Length::new(10.0); + let mut measurement: Length = Length::new(5.0); + + measurement += one_cm; + + assert_eq!(measurement.get(), 15.0); + } + + #[test] + fn test_subassign() { + let one_cm: Length = Length::new(10.0); + let mut measurement: Length = Length::new(5.0); + + measurement -= one_cm; + + assert_eq!(measurement.get(), -5.0); + } +} diff --git a/third_party/rust/euclid/src/lib.rs b/third_party/rust/euclid/src/lib.rs new file mode 100644 index 000000000000..09a1e3e5c68d --- /dev/null +++ b/third_party/rust/euclid/src/lib.rs @@ -0,0 +1,110 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![cfg_attr(feature = "unstable", feature(asm, repr_simd, test))] + +//! A collection of strongly typed math tools for computer graphics with an inclination +//! towards 2d graphics and layout. +//! +//! All types are generic over the the scalar type of their component (f32, i32, etc.), +//! and tagged with a generic Unit parameter which is useful to prevent mixing +//! values from different spaces. For example it should not be legal to translate +//! a screen-space position by a world-space vector and this can be expressed using +//! the generic Unit parameter. +//! +//! This unit system is not mandatory and all Typed* structures have an alias +//! with the default unit: `UnknownUnit`. +//! for example ```Point2D``` is equivalent to ```TypedPoint2D```. +//! Client code typically creates a set of aliases for each type and doesn't need +//! to deal with the specifics of typed units further. For example: +//! +//! ```rust +//! use euclid::*; +//! pub struct ScreenSpace; +//! pub type ScreenPoint = TypedPoint2D; +//! pub type ScreenSize = TypedSize2D; +//! pub struct WorldSpace; +//! pub type WorldPoint = TypedPoint3D; +//! pub type ProjectionMatrix = TypedMatrix4D; +//! // etc... +//! ``` +//! +//! Components are accessed in their scalar form by default for convenience, and most +//! types additionally implement strongly typed accessors which return typed ```Length``` wrappers. +//! For example: +//! +//! ```rust +//! # use euclid::*; +//! # pub struct WorldSpace; +//! # pub type WorldPoint = TypedPoint3D; +//! let p = WorldPoint::new(0.0, 1.0, 1.0); +//! // p.x is an f32. +//! println!("p.x = {:?} ", p.x); +//! // p.x is a Length. +//! println!("p.x_typed() = {:?} ", p.x_typed()); +//! // Length::get returns the scalar value (f32). +//! assert_eq!(p.x, p.x_typed().get()); +//! ``` + +extern crate heapsize; + +#[macro_use] +extern crate log; +extern crate rustc_serialize; +extern crate serde; + +#[cfg(test)] +extern crate rand; +#[cfg(feature = "unstable")] +extern crate test; +extern crate num_traits; + +pub use length::Length; +pub use scale_factor::ScaleFactor; +pub use matrix2d::{Matrix2D, TypedMatrix2D}; +pub use matrix4d::{Matrix4D, TypedMatrix4D}; +pub use point::{ + Point2D, TypedPoint2D, + Point3D, TypedPoint3D, + Point4D, TypedPoint4D, +}; +pub use rect::{Rect, TypedRect}; +pub use side_offsets::{SideOffsets2D, TypedSideOffsets2D}; +#[cfg(feature = "unstable")] pub use side_offsets::SideOffsets2DSimdI32; +pub use size::{Size2D, TypedSize2D}; + +pub mod approxeq; +pub mod length; +#[macro_use] +mod macros; +pub mod matrix2d; +pub mod matrix4d; +pub mod num; +pub mod point; +pub mod rect; +pub mod scale_factor; +pub mod side_offsets; +pub mod size; +mod trig; + +/// The default unit. +#[derive(Clone, Copy, RustcDecodable, RustcEncodable)] +pub struct UnknownUnit; + +/// Unit for angles in radians. +pub struct Rad; + +/// Unit for angles in degrees. +pub struct Deg; + +/// A value in radians. +pub type Radians = Length; + +/// A value in Degrees. +pub type Degrees = Length; diff --git a/third_party/rust/euclid/src/macros.rs b/third_party/rust/euclid/src/macros.rs new file mode 100644 index 000000000000..8984c4e12dfb --- /dev/null +++ b/third_party/rust/euclid/src/macros.rs @@ -0,0 +1,86 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! define_matrix { + ( + $(#[$attr:meta])* + pub struct $name:ident { + $(pub $field:ident: T,)+ + } + ) => ( + $(#[$attr])* + pub struct $name { + $(pub $field: T,)+ + _unit: PhantomData<($($phantom),+)> + } + + impl Clone for $name { + fn clone(&self) -> Self { + $name { + $($field: self.$field.clone(),)+ + _unit: PhantomData, + } + } + } + + impl Copy for $name {} + + impl ::heapsize::HeapSizeOf for $name + where T: ::heapsize::HeapSizeOf + { + fn heap_size_of_children(&self) -> usize { + $(self.$field.heap_size_of_children() +)+ 0 + } + } + + impl ::serde::Deserialize for $name + where T: ::serde::Deserialize + { + fn deserialize(deserializer: &mut D) -> Result + where D: ::serde::Deserializer + { + let ($($field,)+) = + try!(::serde::Deserialize::deserialize(deserializer)); + Ok($name { + $($field: $field,)+ + _unit: PhantomData, + }) + } + } + + impl ::serde::Serialize for $name + where T: ::serde::Serialize + { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: ::serde::Serializer + { + ($(&self.$field,)+).serialize(serializer) + } + } + + impl ::std::cmp::Eq for $name + where T: ::std::cmp::Eq {} + + impl ::std::cmp::PartialEq for $name + where T: ::std::cmp::PartialEq + { + fn eq(&self, other: &Self) -> bool { + true $(&& self.$field == other.$field)+ + } + } + + impl ::std::hash::Hash for $name + where T: ::std::hash::Hash + { + fn hash(&self, h: &mut H) { + $(self.$field.hash(h);)+ + } + } + ) +} diff --git a/third_party/rust/euclid/src/matrix2d.rs b/third_party/rust/euclid/src/matrix2d.rs new file mode 100644 index 000000000000..c75e2bf3295b --- /dev/null +++ b/third_party/rust/euclid/src/matrix2d.rs @@ -0,0 +1,404 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use super::{UnknownUnit, Radians}; +use num::{One, Zero}; +use point::TypedPoint2D; +use rect::TypedRect; +use std::ops::{Add, Mul, Div, Sub}; +use std::marker::PhantomData; +use approxeq::ApproxEq; +use trig::Trig; +use std::fmt; + +define_matrix! { + /// A 2d transform stored as a 2 by 3 matrix in row-major order in memory, + /// useful to represent 2d transformations. + /// + /// Matrices can be parametrized over the source and destination units, to describe a + /// transformation from a space to another. + /// For example, TypedMatrix2D::transform_point4d + /// takes a TypedPoint2D and returns a TypedPoint2D. + /// + /// Matrices expose a set of convenience methods for pre- and post-transformations. + /// A pre-transformation corresponds to adding an operation that is applied before + /// the rest of the transformation, while a post-transformation adds an operation + /// that is appled after. + pub struct TypedMatrix2D { + pub m11: T, pub m12: T, + pub m21: T, pub m22: T, + pub m31: T, pub m32: T, + } +} + +/// The default 2d matrix type with no units. +pub type Matrix2D = TypedMatrix2D; + +impl TypedMatrix2D { + /// Create a matrix specifying its components in row-major order. + pub fn row_major(m11: T, m12: T, m21: T, m22: T, m31: T, m32: T) -> TypedMatrix2D { + TypedMatrix2D { + m11: m11, m12: m12, + m21: m21, m22: m22, + m31: m31, m32: m32, + _unit: PhantomData, + } + } + + /// Create a matrix specifying its components in column-major order. + pub fn column_major(m11: T, m21: T, m31: T, m12: T, m22: T, m32: T) -> TypedMatrix2D { + TypedMatrix2D { + m11: m11, m12: m12, + m21: m21, m22: m22, + m31: m31, m32: m32, + _unit: PhantomData, + } + } + + /// Returns an array containing this matrix's terms in row-major order (the order + /// in which the matrix is actually laid out in memory). + pub fn to_row_major_array(&self) -> [T; 6] { + [ + self.m11, self.m12, + self.m21, self.m22, + self.m31, self.m32 + ] + } + + /// Returns an array containing this matrix's terms in column-major order. + pub fn to_column_major_array(&self) -> [T; 6] { + [ + self.m11, self.m21, self.m31, + self.m12, self.m22, self.m32 + ] + } + + /// Drop the units, preserving only the numeric value. + pub fn to_untyped(&self) -> Matrix2D { + Matrix2D::row_major( + self.m11, self.m12, + self.m21, self.m22, + self.m31, self.m32 + ) + } + + /// Tag a unitless value with units. + pub fn from_untyped(p: &Matrix2D) -> TypedMatrix2D { + TypedMatrix2D::row_major( + p.m11, p.m12, + p.m21, p.m22, + p.m31, p.m32 + ) + } +} + +impl TypedMatrix2D +where T: Copy + Clone + + Add + + Mul + + Div + + Sub + + Trig + + PartialOrd + + One + Zero { + + pub fn identity() -> TypedMatrix2D { + let (_0, _1) = (Zero::zero(), One::one()); + TypedMatrix2D::row_major( + _1, _0, + _0, _1, + _0, _0 + ) + } + + /// Returns the multiplication of the two matrices such that mat's transformation + /// applies after self's transformation. + pub fn post_mul(&self, mat: &TypedMatrix2D) -> TypedMatrix2D { + TypedMatrix2D::row_major( + self.m11 * mat.m11 + self.m12 * mat.m21, + self.m11 * mat.m12 + self.m12 * mat.m22, + self.m21 * mat.m11 + self.m22 * mat.m21, + self.m21 * mat.m12 + self.m22 * mat.m22, + self.m31 * mat.m11 + self.m32 * mat.m21 + mat.m31, + self.m31 * mat.m12 + self.m32 * mat.m22 + mat.m32, + ) + } + + /// Returns the multiplication of the two matrices such that mat's transformation + /// applies before self's transformation. + pub fn pre_mul(&self, mat: &TypedMatrix2D) -> TypedMatrix2D { + mat.post_mul(self) + } + + /// Returns a translation matrix. + pub fn create_translation(x: T, y: T) -> TypedMatrix2D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + TypedMatrix2D::row_major( + _1, _0, + _0, _1, + x, y + ) + } + + /// Applies a translation after self's transformation and returns the resulting matrix. + pub fn post_translated(&self, x: T, y: T) -> TypedMatrix2D { + self.post_mul(&TypedMatrix2D::create_translation(x, y)) + } + + /// Applies a translation before self's transformation and returns the resulting matrix. + pub fn pre_translated(&self, x: T, y: T) -> TypedMatrix2D { + self.pre_mul(&TypedMatrix2D::create_translation(x, y)) + } + + /// Returns a scale matrix. + pub fn create_scale(x: T, y: T) -> TypedMatrix2D { + let _0 = Zero::zero(); + TypedMatrix2D::row_major( + x, _0, + _0, y, + _0, _0 + ) + } + + /// Applies a scale after self's transformation and returns the resulting matrix. + pub fn post_scaled(&self, x: T, y: T) -> TypedMatrix2D { + self.post_mul(&TypedMatrix2D::create_scale(x, y)) + } + + /// Applies a scale before self's transformation and returns the resulting matrix. + pub fn pre_scaled(&self, x: T, y: T) -> TypedMatrix2D { + TypedMatrix2D::row_major( + self.m11 * x, self.m12, + self.m21, self.m22 * y, + self.m31, self.m32 + ) + } + + /// Returns a rotation matrix. + pub fn create_rotation(theta: Radians) -> TypedMatrix2D { + let _0 = Zero::zero(); + let cos = theta.get().cos(); + let sin = theta.get().sin(); + TypedMatrix2D::row_major( + cos, _0 - sin, + sin, cos, + _0, _0 + ) + } + + /// Applies a rotation after self's transformation and returns the resulting matrix. + pub fn post_rotated(&self, theta: Radians) -> TypedMatrix2D { + self.post_mul(&TypedMatrix2D::create_rotation(theta)) + } + + /// Applies a rotation after self's transformation and returns the resulting matrix. + pub fn pre_rotated(&self, theta: Radians) -> TypedMatrix2D { + self.pre_mul(&TypedMatrix2D::create_rotation(theta)) + } + + /// Returns the given point transformed by this matrix. + #[inline] + pub fn transform_point(&self, point: &TypedPoint2D) -> TypedPoint2D { + TypedPoint2D::new(point.x * self.m11 + point.y * self.m21 + self.m31, + point.x * self.m12 + point.y * self.m22 + self.m32) + } + + /// Returns a rectangle that encompasses the result of transforming the given rectangle by this + /// matrix. + #[inline] + pub fn transform_rect(&self, rect: &TypedRect) -> TypedRect { + TypedRect::from_points(&[ + self.transform_point(&rect.origin), + self.transform_point(&rect.top_right()), + self.transform_point(&rect.bottom_left()), + self.transform_point(&rect.bottom_right()), + ]) + } + + /// Computes and returns the determinant of this matrix. + pub fn determinant(&self) -> T { + self.m11 * self.m22 - self.m12 * self.m21 + } + + /// Returns the inverse matrix if possible. + pub fn inverse(&self) -> Option> { + let det = self.determinant(); + + let _0: T = Zero::zero(); + let _1: T = One::one(); + + if det == _0 { + return None; + } + + let inv_det = _1 / det; + Some(TypedMatrix2D::row_major( + inv_det * self.m22, + inv_det * (_0 - self.m12), + inv_det * (_0 - self.m21), + inv_det * self.m11, + inv_det * (self.m21 * self.m32 - self.m22 * self.m31), + inv_det * (self.m31 * self.m12 - self.m11 * self.m32), + )) + } + + /// Returns the same matrix with a different destination unit. + #[inline] + pub fn with_destination(&self) -> TypedMatrix2D { + TypedMatrix2D::row_major( + self.m11, self.m12, + self.m21, self.m22, + self.m31, self.m32, + ) + } + + /// Returns the same matrix with a different source unit. + #[inline] + pub fn with_source(&self) -> TypedMatrix2D { + TypedMatrix2D::row_major( + self.m11, self.m12, + self.m21, self.m22, + self.m31, self.m32, + ) + } +} + +impl, Src, Dst> TypedMatrix2D { + pub fn approx_eq(&self, other: &Self) -> bool { + self.m11.approx_eq(&other.m11) && self.m12.approx_eq(&other.m12) && + self.m21.approx_eq(&other.m21) && self.m22.approx_eq(&other.m22) && + self.m31.approx_eq(&other.m31) && self.m32.approx_eq(&other.m32) + } +} + +impl fmt::Debug for TypedMatrix2D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.to_row_major_array().fmt(f) + } +} + +#[cfg(test)] +mod test { + use super::*; + use approxeq::ApproxEq; + use point::Point2D; + use Radians; + + use std::f32::consts::FRAC_PI_2; + + type Mat = Matrix2D; + + fn rad(v: f32) -> Radians { Radians::new(v) } + + #[test] + pub fn test_translation() { + let t1 = Mat::create_translation(1.0, 2.0); + let t2 = Mat::identity().pre_translated(1.0, 2.0); + let t3 = Mat::identity().post_translated(1.0, 2.0); + assert_eq!(t1, t2); + assert_eq!(t1, t3); + + assert_eq!(t1.transform_point(&Point2D::new(1.0, 1.0)), Point2D::new(2.0, 3.0)); + + assert_eq!(t1.post_mul(&t1), Mat::create_translation(2.0, 4.0)); + } + + #[test] + pub fn test_rotation() { + let r1 = Mat::create_rotation(rad(FRAC_PI_2)); + let r2 = Mat::identity().pre_rotated(rad(FRAC_PI_2)); + let r3 = Mat::identity().post_rotated(rad(FRAC_PI_2)); + assert_eq!(r1, r2); + assert_eq!(r1, r3); + + assert!(r1.transform_point(&Point2D::new(1.0, 2.0)).approx_eq(&Point2D::new(2.0, -1.0))); + + assert!(r1.post_mul(&r1).approx_eq(&Mat::create_rotation(rad(FRAC_PI_2*2.0)))); + } + + #[test] + pub fn test_scale() { + let s1 = Mat::create_scale(2.0, 3.0); + let s2 = Mat::identity().pre_scaled(2.0, 3.0); + let s3 = Mat::identity().post_scaled(2.0, 3.0); + assert_eq!(s1, s2); + assert_eq!(s1, s3); + + assert!(s1.transform_point(&Point2D::new(2.0, 2.0)).approx_eq(&Point2D::new(4.0, 6.0))); + } + + #[test] + fn test_column_major() { + assert_eq!( + Mat::row_major( + 1.0, 2.0, + 3.0, 4.0, + 5.0, 6.0 + ), + Mat::column_major( + 1.0, 3.0, 5.0, + 2.0, 4.0, 6.0, + ) + ); + } + + #[test] + pub fn test_inverse_simple() { + let m1 = Mat::identity(); + let m2 = m1.inverse().unwrap(); + assert!(m1.approx_eq(&m2)); + } + + #[test] + pub fn test_inverse_scale() { + let m1 = Mat::create_scale(1.5, 0.3); + let m2 = m1.inverse().unwrap(); + assert!(m1.pre_mul(&m2).approx_eq(&Mat::identity())); + } + + #[test] + pub fn test_inverse_translate() { + let m1 = Mat::create_translation(-132.0, 0.3); + let m2 = m1.inverse().unwrap(); + assert!(m1.pre_mul(&m2).approx_eq(&Mat::identity())); + } + + #[test] + fn test_inverse_none() { + assert!(Mat::create_scale(2.0, 0.0).inverse().is_none()); + assert!(Mat::create_scale(2.0, 2.0).inverse().is_some()); + } + + #[test] + pub fn test_pre_post() { + let m1 = Matrix2D::identity().post_scaled(1.0, 2.0).post_translated(1.0, 2.0); + let m2 = Matrix2D::identity().pre_translated(1.0, 2.0).pre_scaled(1.0, 2.0); + assert!(m1.approx_eq(&m2)); + + let r = Mat::create_rotation(rad(FRAC_PI_2)); + let t = Mat::create_translation(2.0, 3.0); + + let a = Point2D::new(1.0, 1.0); + + assert!(r.post_mul(&t).transform_point(&a).approx_eq(&Point2D::new(3.0, 2.0))); + assert!(t.post_mul(&r).transform_point(&a).approx_eq(&Point2D::new(4.0, -3.0))); + assert!(t.post_mul(&r).transform_point(&a).approx_eq(&r.transform_point(&t.transform_point(&a)))); + + assert!(r.pre_mul(&t).transform_point(&a).approx_eq(&Point2D::new(4.0, -3.0))); + assert!(t.pre_mul(&r).transform_point(&a).approx_eq(&Point2D::new(3.0, 2.0))); + assert!(t.pre_mul(&r).transform_point(&a).approx_eq(&t.transform_point(&r.transform_point(&a)))); + } + + #[test] + fn test_size_of() { + use std::mem::size_of; + assert_eq!(size_of::>(), 6*size_of::()); + assert_eq!(size_of::>(), 6*size_of::()); + } +} \ No newline at end of file diff --git a/third_party/rust/euclid/src/matrix4d.rs b/third_party/rust/euclid/src/matrix4d.rs new file mode 100644 index 000000000000..fb5b9d419684 --- /dev/null +++ b/third_party/rust/euclid/src/matrix4d.rs @@ -0,0 +1,797 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use super::{UnknownUnit, Radians}; +use approxeq::ApproxEq; +use trig::Trig; +use point::{TypedPoint2D, TypedPoint3D, TypedPoint4D}; +use rect::TypedRect; +use matrix2d::TypedMatrix2D; +use scale_factor::ScaleFactor; +use num::{One, Zero}; +use std::ops::{Add, Mul, Sub, Div, Neg}; +use std::marker::PhantomData; +use std::fmt; + +define_matrix! { + /// A 4 by 4 matrix stored in row-major order in memory, useful to represent + /// 3d transformations. + /// + /// Matrices can be parametrized over the source and destination units, to describe a + /// transformation from a space to another. + /// For example, TypedMatrix4D::transform_point4d + /// takes a TypedPoint4D and returns a TypedPoint4D. + /// + /// Matrices expose a set of convenience methods for pre- and post-transformations. + /// A pre-transformation corresponds to adding an operation that is applied before + /// the rest of the transformation, while a post-transformation adds an operation + /// that is appled after. + pub struct TypedMatrix4D { + pub m11: T, pub m12: T, pub m13: T, pub m14: T, + pub m21: T, pub m22: T, pub m23: T, pub m24: T, + pub m31: T, pub m32: T, pub m33: T, pub m34: T, + pub m41: T, pub m42: T, pub m43: T, pub m44: T, + } +} + +/// The default 4d matrix type with no units. +pub type Matrix4D = TypedMatrix4D; + +impl TypedMatrix4D { + /// Create a matrix specifying its components in row-major order. + /// + /// For example, the translation terms m41, m42, m43 on the last row with the + /// row-major convention) are the 13rd, 14th and 15th parameters. + #[inline] + pub fn row_major( + m11: T, m12: T, m13: T, m14: T, + m21: T, m22: T, m23: T, m24: T, + m31: T, m32: T, m33: T, m34: T, + m41: T, m42: T, m43: T, m44: T) + -> TypedMatrix4D { + TypedMatrix4D { + m11: m11, m12: m12, m13: m13, m14: m14, + m21: m21, m22: m22, m23: m23, m24: m24, + m31: m31, m32: m32, m33: m33, m34: m34, + m41: m41, m42: m42, m43: m43, m44: m44, + _unit: PhantomData, + } + } + + /// Create a matrix specifying its components in column-major order. + /// + /// For example, the translation terms m41, m42, m43 on the last column with the + /// column-major convention) are the 4th, 8th and 12nd parameters. + #[inline] + pub fn column_major( + m11: T, m21: T, m31: T, m41: T, + m12: T, m22: T, m32: T, m42: T, + m13: T, m23: T, m33: T, m43: T, + m14: T, m24: T, m34: T, m44: T) + -> TypedMatrix4D { + TypedMatrix4D { + m11: m11, m12: m12, m13: m13, m14: m14, + m21: m21, m22: m22, m23: m23, m24: m24, + m31: m31, m32: m32, m33: m33, m34: m34, + m41: m41, m42: m42, m43: m43, m44: m44, + _unit: PhantomData, + } + } +} + +impl TypedMatrix4D +where T: Copy + Clone + + Add + + Sub + + Mul + + Div + + Neg + + ApproxEq + + PartialOrd + + Trig + + One + Zero { + + /// Create a 4 by 4 matrix representing a 2d transformation, specifying its components + /// in row-major order. + #[inline] + pub fn row_major_2d(m11: T, m12: T, m21: T, m22: T, m41: T, m42: T) -> TypedMatrix4D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + TypedMatrix4D::row_major( + m11, m12, _0, _0, + m21, m22, _0, _0, + _0, _0, _1, _0, + m41, m42, _0, _1 + ) + } + + /// Create an orthogonal projection matrix. + pub fn ortho(left: T, right: T, + bottom: T, top: T, + near: T, far: T) -> TypedMatrix4D { + let tx = -((right + left) / (right - left)); + let ty = -((top + bottom) / (top - bottom)); + let tz = -((far + near) / (far - near)); + + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + let _2 = _1 + _1; + TypedMatrix4D::row_major( + _2 / (right - left), _0 , _0 , _0, + _0 , _2 / (top - bottom), _0 , _0, + _0 , _0 , -_2 / (far - near), _0, + tx , ty , tz , _1 + ) + } + + #[inline] + pub fn identity() -> TypedMatrix4D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + TypedMatrix4D::row_major( + _1, _0, _0, _0, + _0, _1, _0, _0, + _0, _0, _1, _0, + _0, _0, _0, _1 + ) + } + + /// Returns true if this matrix can be represented with a TypedMatrix2D. + /// + /// See https://drafts.csswg.org/css-transforms/#2d-matrix + #[inline] + pub fn is_2d(&self) -> bool { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + self.m31 == _0 && self.m32 == _0 && + self.m13 == _0 && self.m23 == _0 && + self.m43 == _0 && self.m14 == _0 && + self.m24 == _0 && self.m34 == _0 && + self.m33 == _1 && self.m44 == _1 + } + + /// Create a 2D matrix picking the relevent terms from this matrix. + /// + /// This method assumes that self represents a 2d transformation, callers + /// should check that self.is_2d() returns true beforehand. + pub fn to_2d(&self) -> TypedMatrix2D { + TypedMatrix2D::row_major( + self.m11, self.m12, + self.m21, self.m22, + self.m41, self.m42 + ) + } + + pub fn approx_eq(&self, other: &TypedMatrix4D) -> bool { + self.m11.approx_eq(&other.m11) && self.m12.approx_eq(&other.m12) && + self.m13.approx_eq(&other.m13) && self.m14.approx_eq(&other.m14) && + self.m21.approx_eq(&other.m21) && self.m22.approx_eq(&other.m22) && + self.m23.approx_eq(&other.m23) && self.m24.approx_eq(&other.m24) && + self.m31.approx_eq(&other.m31) && self.m32.approx_eq(&other.m32) && + self.m33.approx_eq(&other.m33) && self.m34.approx_eq(&other.m34) && + self.m41.approx_eq(&other.m41) && self.m42.approx_eq(&other.m42) && + self.m43.approx_eq(&other.m43) && self.m44.approx_eq(&other.m44) + } + + /// Returns the same matrix with a different destination unit. + #[inline] + pub fn with_destination(&self) -> TypedMatrix4D { + TypedMatrix4D::row_major( + self.m11, self.m12, self.m13, self.m14, + self.m21, self.m22, self.m23, self.m24, + self.m31, self.m32, self.m33, self.m34, + self.m41, self.m42, self.m43, self.m44, + ) + } + + /// Returns the same matrix with a different source unit. + #[inline] + pub fn with_source(&self) -> TypedMatrix4D { + TypedMatrix4D::row_major( + self.m11, self.m12, self.m13, self.m14, + self.m21, self.m22, self.m23, self.m24, + self.m31, self.m32, self.m33, self.m34, + self.m41, self.m42, self.m43, self.m44, + ) + } + + /// Drop the units, preserving only the numeric value. + #[inline] + pub fn to_untyped(&self) -> Matrix4D { + Matrix4D::row_major( + self.m11, self.m12, self.m13, self.m14, + self.m21, self.m22, self.m23, self.m24, + self.m31, self.m32, self.m33, self.m34, + self.m41, self.m42, self.m43, self.m44, + ) + } + + /// Tag a unitless value with units. + #[inline] + pub fn from_untyped(m: &Matrix4D) -> Self { + TypedMatrix4D::row_major( + m.m11, m.m12, m.m13, m.m14, + m.m21, m.m22, m.m23, m.m24, + m.m31, m.m32, m.m33, m.m34, + m.m41, m.m42, m.m43, m.m44, + ) + } + + /// Returns the multiplication of the two matrices such that mat's transformation + /// applies after self's transformation. + pub fn post_mul(&self, mat: &TypedMatrix4D) -> TypedMatrix4D { + TypedMatrix4D::row_major( + self.m11 * mat.m11 + self.m12 * mat.m21 + self.m13 * mat.m31 + self.m14 * mat.m41, + self.m11 * mat.m12 + self.m12 * mat.m22 + self.m13 * mat.m32 + self.m14 * mat.m42, + self.m11 * mat.m13 + self.m12 * mat.m23 + self.m13 * mat.m33 + self.m14 * mat.m43, + self.m11 * mat.m14 + self.m12 * mat.m24 + self.m13 * mat.m34 + self.m14 * mat.m44, + self.m21 * mat.m11 + self.m22 * mat.m21 + self.m23 * mat.m31 + self.m24 * mat.m41, + self.m21 * mat.m12 + self.m22 * mat.m22 + self.m23 * mat.m32 + self.m24 * mat.m42, + self.m21 * mat.m13 + self.m22 * mat.m23 + self.m23 * mat.m33 + self.m24 * mat.m43, + self.m21 * mat.m14 + self.m22 * mat.m24 + self.m23 * mat.m34 + self.m24 * mat.m44, + self.m31 * mat.m11 + self.m32 * mat.m21 + self.m33 * mat.m31 + self.m34 * mat.m41, + self.m31 * mat.m12 + self.m32 * mat.m22 + self.m33 * mat.m32 + self.m34 * mat.m42, + self.m31 * mat.m13 + self.m32 * mat.m23 + self.m33 * mat.m33 + self.m34 * mat.m43, + self.m31 * mat.m14 + self.m32 * mat.m24 + self.m33 * mat.m34 + self.m34 * mat.m44, + self.m41 * mat.m11 + self.m42 * mat.m21 + self.m43 * mat.m31 + self.m44 * mat.m41, + self.m41 * mat.m12 + self.m42 * mat.m22 + self.m43 * mat.m32 + self.m44 * mat.m42, + self.m41 * mat.m13 + self.m42 * mat.m23 + self.m43 * mat.m33 + self.m44 * mat.m43, + self.m41 * mat.m14 + self.m42 * mat.m24 + self.m43 * mat.m34 + self.m44 * mat.m44, + ) + } + + /// Returns the multiplication of the two matrices such that mat's transformation + /// applies before self's transformation. + pub fn pre_mul(&self, mat: &TypedMatrix4D) -> TypedMatrix4D { + mat.post_mul(self) + } + + /// Returns the inverse matrix if possible. + pub fn inverse(&self) -> Option> { + let det = self.determinant(); + + if det == Zero::zero() { + return None; + } + + // todo(gw): this could be made faster by special casing + // for simpler matrix types. + let m = TypedMatrix4D::row_major( + self.m23*self.m34*self.m42 - self.m24*self.m33*self.m42 + + self.m24*self.m32*self.m43 - self.m22*self.m34*self.m43 - + self.m23*self.m32*self.m44 + self.m22*self.m33*self.m44, + + self.m14*self.m33*self.m42 - self.m13*self.m34*self.m42 - + self.m14*self.m32*self.m43 + self.m12*self.m34*self.m43 + + self.m13*self.m32*self.m44 - self.m12*self.m33*self.m44, + + self.m13*self.m24*self.m42 - self.m14*self.m23*self.m42 + + self.m14*self.m22*self.m43 - self.m12*self.m24*self.m43 - + self.m13*self.m22*self.m44 + self.m12*self.m23*self.m44, + + self.m14*self.m23*self.m32 - self.m13*self.m24*self.m32 - + self.m14*self.m22*self.m33 + self.m12*self.m24*self.m33 + + self.m13*self.m22*self.m34 - self.m12*self.m23*self.m34, + + self.m24*self.m33*self.m41 - self.m23*self.m34*self.m41 - + self.m24*self.m31*self.m43 + self.m21*self.m34*self.m43 + + self.m23*self.m31*self.m44 - self.m21*self.m33*self.m44, + + self.m13*self.m34*self.m41 - self.m14*self.m33*self.m41 + + self.m14*self.m31*self.m43 - self.m11*self.m34*self.m43 - + self.m13*self.m31*self.m44 + self.m11*self.m33*self.m44, + + self.m14*self.m23*self.m41 - self.m13*self.m24*self.m41 - + self.m14*self.m21*self.m43 + self.m11*self.m24*self.m43 + + self.m13*self.m21*self.m44 - self.m11*self.m23*self.m44, + + self.m13*self.m24*self.m31 - self.m14*self.m23*self.m31 + + self.m14*self.m21*self.m33 - self.m11*self.m24*self.m33 - + self.m13*self.m21*self.m34 + self.m11*self.m23*self.m34, + + self.m22*self.m34*self.m41 - self.m24*self.m32*self.m41 + + self.m24*self.m31*self.m42 - self.m21*self.m34*self.m42 - + self.m22*self.m31*self.m44 + self.m21*self.m32*self.m44, + + self.m14*self.m32*self.m41 - self.m12*self.m34*self.m41 - + self.m14*self.m31*self.m42 + self.m11*self.m34*self.m42 + + self.m12*self.m31*self.m44 - self.m11*self.m32*self.m44, + + self.m12*self.m24*self.m41 - self.m14*self.m22*self.m41 + + self.m14*self.m21*self.m42 - self.m11*self.m24*self.m42 - + self.m12*self.m21*self.m44 + self.m11*self.m22*self.m44, + + self.m14*self.m22*self.m31 - self.m12*self.m24*self.m31 - + self.m14*self.m21*self.m32 + self.m11*self.m24*self.m32 + + self.m12*self.m21*self.m34 - self.m11*self.m22*self.m34, + + self.m23*self.m32*self.m41 - self.m22*self.m33*self.m41 - + self.m23*self.m31*self.m42 + self.m21*self.m33*self.m42 + + self.m22*self.m31*self.m43 - self.m21*self.m32*self.m43, + + self.m12*self.m33*self.m41 - self.m13*self.m32*self.m41 + + self.m13*self.m31*self.m42 - self.m11*self.m33*self.m42 - + self.m12*self.m31*self.m43 + self.m11*self.m32*self.m43, + + self.m13*self.m22*self.m41 - self.m12*self.m23*self.m41 - + self.m13*self.m21*self.m42 + self.m11*self.m23*self.m42 + + self.m12*self.m21*self.m43 - self.m11*self.m22*self.m43, + + self.m12*self.m23*self.m31 - self.m13*self.m22*self.m31 + + self.m13*self.m21*self.m32 - self.m11*self.m23*self.m32 - + self.m12*self.m21*self.m33 + self.m11*self.m22*self.m33 + ); + + let _1: T = One::one(); + Some(m.mul_s(_1 / det)) + } + + /// Compute the determinant of the matrix. + pub fn determinant(&self) -> T { + self.m14 * self.m23 * self.m32 * self.m41 - + self.m13 * self.m24 * self.m32 * self.m41 - + self.m14 * self.m22 * self.m33 * self.m41 + + self.m12 * self.m24 * self.m33 * self.m41 + + self.m13 * self.m22 * self.m34 * self.m41 - + self.m12 * self.m23 * self.m34 * self.m41 - + self.m14 * self.m23 * self.m31 * self.m42 + + self.m13 * self.m24 * self.m31 * self.m42 + + self.m14 * self.m21 * self.m33 * self.m42 - + self.m11 * self.m24 * self.m33 * self.m42 - + self.m13 * self.m21 * self.m34 * self.m42 + + self.m11 * self.m23 * self.m34 * self.m42 + + self.m14 * self.m22 * self.m31 * self.m43 - + self.m12 * self.m24 * self.m31 * self.m43 - + self.m14 * self.m21 * self.m32 * self.m43 + + self.m11 * self.m24 * self.m32 * self.m43 + + self.m12 * self.m21 * self.m34 * self.m43 - + self.m11 * self.m22 * self.m34 * self.m43 - + self.m13 * self.m22 * self.m31 * self.m44 + + self.m12 * self.m23 * self.m31 * self.m44 + + self.m13 * self.m21 * self.m32 * self.m44 - + self.m11 * self.m23 * self.m32 * self.m44 - + self.m12 * self.m21 * self.m33 * self.m44 + + self.m11 * self.m22 * self.m33 * self.m44 + } + + /// Multiplies all of the matrix's component by a scalar and returns the result. + pub fn mul_s(&self, x: T) -> TypedMatrix4D { + TypedMatrix4D::row_major( + self.m11 * x, self.m12 * x, self.m13 * x, self.m14 * x, + self.m21 * x, self.m22 * x, self.m23 * x, self.m24 * x, + self.m31 * x, self.m32 * x, self.m33 * x, self.m34 * x, + self.m41 * x, self.m42 * x, self.m43 * x, self.m44 * x + ) + } + + /// Convenience function to create a scale matrix from a ScaleFactor. + pub fn from_scale_factor(scale: ScaleFactor) -> TypedMatrix4D { + TypedMatrix4D::create_scale(scale.get(), scale.get(), scale.get()) + } + + /// Returns the given 2d point transformed by this matrix. + /// + /// The input point must be use the unit Src, and the returned point has the unit Dst. + #[inline] + pub fn transform_point(&self, p: &TypedPoint2D) -> TypedPoint2D { + self.transform_point4d(&TypedPoint4D::new(p.x, p.y, Zero::zero(), One::one())).to_2d() + } + + /// Returns the given 3d point transformed by this matrix. + /// + /// The input point must be use the unit Src, and the returned point has the unit Dst. + #[inline] + pub fn transform_point3d(&self, p: &TypedPoint3D) -> TypedPoint3D { + self.transform_point4d(&TypedPoint4D::new(p.x, p.y, p.z, One::one())).to_3d() + } + + /// Returns the given 4d point transformed by this matrix. + /// + /// The input point must be use the unit Src, and the returned point has the unit Dst. + #[inline] + pub fn transform_point4d(&self, p: &TypedPoint4D) -> TypedPoint4D { + let x = p.x * self.m11 + p.y * self.m21 + p.z * self.m31 + p.w * self.m41; + let y = p.x * self.m12 + p.y * self.m22 + p.z * self.m32 + p.w * self.m42; + let z = p.x * self.m13 + p.y * self.m23 + p.z * self.m33 + p.w * self.m43; + let w = p.x * self.m14 + p.y * self.m24 + p.z * self.m34 + p.w * self.m44; + TypedPoint4D::new(x, y, z, w) + } + + /// Returns a rectangle that encompasses the result of transforming the given rectangle by this + /// matrix. + pub fn transform_rect(&self, rect: &TypedRect) -> TypedRect { + TypedRect::from_points(&[ + self.transform_point(&rect.origin), + self.transform_point(&rect.top_right()), + self.transform_point(&rect.bottom_left()), + self.transform_point(&rect.bottom_right()), + ]) + } + + /// Create a 3d translation matrix + pub fn create_translation(x: T, y: T, z: T) -> TypedMatrix4D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + TypedMatrix4D::row_major( + _1, _0, _0, _0, + _0, _1, _0, _0, + _0, _0, _1, _0, + x, y, z, _1 + ) + } + + /// Returns a matrix with a translation applied before self's transformation. + pub fn pre_translated(&self, x: T, y: T, z: T) -> TypedMatrix4D { + self.pre_mul(&TypedMatrix4D::create_translation(x, y, z)) + } + + /// Returns a matrix with a translation applied after self's transformation. + pub fn post_translated(&self, x: T, y: T, z: T) -> TypedMatrix4D { + self.post_mul(&TypedMatrix4D::create_translation(x, y, z)) + } + + /// Create a 3d scale matrix + pub fn create_scale(x: T, y: T, z: T) -> TypedMatrix4D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + TypedMatrix4D::row_major( + x, _0, _0, _0, + _0, y, _0, _0, + _0, _0, z, _0, + _0, _0, _0, _1 + ) + } + + /// Returns a matrix with a scale applied before self's transformation. + pub fn pre_scaled(&self, x: T, y: T, z: T) -> TypedMatrix4D { + TypedMatrix4D::row_major( + self.m11 * x, self.m12, self.m13, self.m14, + self.m21 , self.m22 * y, self.m23, self.m24, + self.m31 , self.m32, self.m33 * z, self.m34, + self.m41 , self.m42, self.m43, self.m44 + ) + } + + /// Returns a matrix with a scale applied after self's transformation. + pub fn post_scaled(&self, x: T, y: T, z: T) -> TypedMatrix4D { + self.post_mul(&TypedMatrix4D::create_scale(x, y, z)) + } + + /// Create a 3d rotation matrix from an angle / axis. + /// The supplied axis must be normalized. + pub fn create_rotation(x: T, y: T, z: T, theta: Radians) -> TypedMatrix4D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + let _2 = _1 + _1; + + let xx = x * x; + let yy = y * y; + let zz = z * z; + + let half_theta = theta.get() / _2; + let sc = half_theta.sin() * half_theta.cos(); + let sq = half_theta.sin() * half_theta.sin(); + + TypedMatrix4D::row_major( + _1 - _2 * (yy + zz) * sq, + _2 * (x * y * sq - z * sc), + _2 * (x * z * sq + y * sc), + _0, + + _2 * (x * y * sq + z * sc), + _1 - _2 * (xx + zz) * sq, + _2 * (y * z * sq - x * sc), + _0, + + _2 * (x * z * sq - y * sc), + _2 * (y * z * sq + x * sc), + _1 - _2 * (xx + yy) * sq, + _0, + + _0, + _0, + _0, + _1 + ) + } + + /// Returns a matrix with a rotation applied after self's transformation. + pub fn post_rotated(&self, x: T, y: T, z: T, theta: Radians) -> TypedMatrix4D { + self.post_mul(&TypedMatrix4D::create_rotation(x, y, z, theta)) + } + + /// Returns a matrix with a rotation applied before self's transformation. + pub fn pre_rotated(&self, x: T, y: T, z: T, theta: Radians) -> TypedMatrix4D { + self.pre_mul(&TypedMatrix4D::create_rotation(x, y, z, theta)) + } + + /// Create a 2d skew matrix. + /// + /// See https://drafts.csswg.org/css-transforms/#funcdef-skew + pub fn create_skew(alpha: Radians, beta: Radians) -> TypedMatrix4D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + let (sx, sy) = (beta.get().tan(), alpha.get().tan()); + TypedMatrix4D::row_major( + _1, sx, _0, _0, + sy, _1, _0, _0, + _0, _0, _1, _0, + _0, _0, _0, _1 + ) + } + + /// Create a simple perspective projection matrix + pub fn create_perspective(d: T) -> TypedMatrix4D { + let (_0, _1): (T, T) = (Zero::zero(), One::one()); + TypedMatrix4D::row_major( + _1, _0, _0, _0, + _0, _1, _0, _0, + _0, _0, _1, -_1 / d, + _0, _0, _0, _1 + ) + } +} + +impl TypedMatrix4D { + /// Returns an array containing this matrix's terms in row-major order (the order + /// in which the matrix is actually laid out in memory). + pub fn to_row_major_array(&self) -> [T; 16] { + [ + self.m11, self.m12, self.m13, self.m14, + self.m21, self.m22, self.m23, self.m24, + self.m31, self.m32, self.m33, self.m34, + self.m41, self.m42, self.m43, self.m44 + ] + } + + /// Returns an array containing this matrix's terms in column-major order. + pub fn to_column_major_array(&self) -> [T; 16] { + [ + self.m11, self.m21, self.m31, self.m41, + self.m12, self.m22, self.m32, self.m42, + self.m13, self.m23, self.m33, self.m43, + self.m14, self.m24, self.m34, self.m44 + ] + } + + /// Returns an array containing this matrix's 4 rows in (in row-major order) + /// as arrays. + /// + /// This is a convenience method to interface with other libraries like glium. + pub fn to_row_arrays(&self) -> [[T; 4];4] { + [ + [self.m11, self.m12, self.m13, self.m14], + [self.m21, self.m22, self.m23, self.m24], + [self.m31, self.m32, self.m33, self.m34], + [self.m41, self.m42, self.m43, self.m44] + ] + } + + /// Returns an array containing this matrix's 4 columns in (in row-major order, + /// or 4 rows in column-major order) as arrays. + /// + /// This is a convenience method to interface with other libraries like glium. + pub fn to_column_arrays(&self) -> [[T; 4]; 4] { + [ + [self.m11, self.m21, self.m31, self.m41], + [self.m12, self.m22, self.m32, self.m42], + [self.m13, self.m23, self.m33, self.m43], + [self.m14, self.m24, self.m34, self.m44] + ] + } +} + +impl fmt::Debug for TypedMatrix4D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.to_row_major_array().fmt(f) + } +} + +#[cfg(test)] +mod tests { + use approxeq::ApproxEq; + use matrix2d::Matrix2D; + use point::{Point2D, Point3D, Point4D}; + use Radians; + use super::*; + + use std::f32::consts::FRAC_PI_2; + + type Mf32 = Matrix4D; + + // For convenience. + fn rad(v: f32) -> Radians { Radians::new(v) } + + #[test] + pub fn test_translation() { + let t1 = Mf32::create_translation(1.0, 2.0, 3.0); + let t2 = Mf32::identity().pre_translated(1.0, 2.0, 3.0); + let t3 = Mf32::identity().post_translated(1.0, 2.0, 3.0); + assert_eq!(t1, t2); + assert_eq!(t1, t3); + + assert_eq!(t1.transform_point3d(&Point3D::new(1.0, 1.0, 1.0)), Point3D::new(2.0, 3.0, 4.0)); + assert_eq!(t1.transform_point(&Point2D::new(1.0, 1.0)), Point2D::new(2.0, 3.0)); + + assert_eq!(t1.post_mul(&t1), Mf32::create_translation(2.0, 4.0, 6.0)); + + assert!(!t1.is_2d()); + assert_eq!(Mf32::create_translation(1.0, 2.0, 3.0).to_2d(), Matrix2D::create_translation(1.0, 2.0)); + } + + #[test] + pub fn test_rotation() { + let r1 = Mf32::create_rotation(0.0, 0.0, 1.0, rad(FRAC_PI_2)); + let r2 = Mf32::identity().pre_rotated(0.0, 0.0, 1.0, rad(FRAC_PI_2)); + let r3 = Mf32::identity().post_rotated(0.0, 0.0, 1.0, rad(FRAC_PI_2)); + assert_eq!(r1, r2); + assert_eq!(r1, r3); + + assert!(r1.transform_point3d(&Point3D::new(1.0, 2.0, 3.0)).approx_eq(&Point3D::new(2.0, -1.0, 3.0))); + assert!(r1.transform_point(&Point2D::new(1.0, 2.0)).approx_eq(&Point2D::new(2.0, -1.0))); + + assert!(r1.post_mul(&r1).approx_eq(&Mf32::create_rotation(0.0, 0.0, 1.0, rad(FRAC_PI_2*2.0)))); + + assert!(r1.is_2d()); + assert!(r1.to_2d().approx_eq(&Matrix2D::create_rotation(rad(FRAC_PI_2)))); + } + + #[test] + pub fn test_scale() { + let s1 = Mf32::create_scale(2.0, 3.0, 4.0); + let s2 = Mf32::identity().pre_scaled(2.0, 3.0, 4.0); + let s3 = Mf32::identity().post_scaled(2.0, 3.0, 4.0); + assert_eq!(s1, s2); + assert_eq!(s1, s3); + + assert!(s1.transform_point3d(&Point3D::new(2.0, 2.0, 2.0)).approx_eq(&Point3D::new(4.0, 6.0, 8.0))); + assert!(s1.transform_point(&Point2D::new(2.0, 2.0)).approx_eq(&Point2D::new(4.0, 6.0))); + + assert_eq!(s1.post_mul(&s1), Mf32::create_scale(4.0, 9.0, 16.0)); + + assert!(!s1.is_2d()); + assert_eq!(Mf32::create_scale(2.0, 3.0, 0.0).to_2d(), Matrix2D::create_scale(2.0, 3.0)); + } + + #[test] + pub fn test_ortho() { + let (left, right, bottom, top) = (0.0f32, 1.0f32, 0.1f32, 1.0f32); + let (near, far) = (-1.0f32, 1.0f32); + let result = Mf32::ortho(left, right, bottom, top, near, far); + let expected = Mf32::row_major( + 2.0, 0.0, 0.0, 0.0, + 0.0, 2.22222222, 0.0, 0.0, + 0.0, 0.0, -1.0, 0.0, + -1.0, -1.22222222, -0.0, 1.0 + ); + debug!("result={:?} expected={:?}", result, expected); + assert!(result.approx_eq(&expected)); + } + + #[test] + pub fn test_is_2d() { + assert!(Mf32::identity().is_2d()); + assert!(Mf32::create_rotation(0.0, 0.0, 1.0, rad(0.7854)).is_2d()); + assert!(!Mf32::create_rotation(0.0, 1.0, 0.0, rad(0.7854)).is_2d()); + } + + #[test] + pub fn test_row_major_2d() { + let m1 = Mf32::row_major_2d(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); + let m2 = Mf32::row_major( + 1.0, 2.0, 0.0, 0.0, + 3.0, 4.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 5.0, 6.0, 0.0, 1.0 + ); + assert_eq!(m1, m2); + } + + #[test] + fn test_column_major() { + assert_eq!( + Mf32::row_major( + 1.0, 2.0, 3.0, 4.0, + 5.0, 6.0, 7.0, 8.0, + 9.0, 10.0, 11.0, 12.0, + 13.0, 14.0, 15.0, 16.0, + ), + Mf32::column_major( + 1.0, 5.0, 9.0, 13.0, + 2.0, 6.0, 10.0, 14.0, + 3.0, 7.0, 11.0, 15.0, + 4.0, 8.0, 12.0, 16.0, + ) + ); + } + + #[test] + pub fn test_inverse_simple() { + let m1 = Mf32::identity(); + let m2 = m1.inverse().unwrap(); + assert!(m1.approx_eq(&m2)); + } + + #[test] + pub fn test_inverse_scale() { + let m1 = Mf32::create_scale(1.5, 0.3, 2.1); + let m2 = m1.inverse().unwrap(); + assert!(m1.pre_mul(&m2).approx_eq(&Mf32::identity())); + } + + #[test] + pub fn test_inverse_translate() { + let m1 = Mf32::create_translation(-132.0, 0.3, 493.0); + let m2 = m1.inverse().unwrap(); + assert!(m1.pre_mul(&m2).approx_eq(&Mf32::identity())); + } + + #[test] + pub fn test_inverse_rotate() { + let m1 = Mf32::create_rotation(0.0, 1.0, 0.0, rad(1.57)); + let m2 = m1.inverse().unwrap(); + assert!(m1.pre_mul(&m2).approx_eq(&Mf32::identity())); + } + + #[test] + pub fn test_inverse_transform_point_2d() { + let m1 = Mf32::create_translation(100.0, 200.0, 0.0); + let m2 = m1.inverse().unwrap(); + assert!(m1.pre_mul(&m2).approx_eq(&Mf32::identity())); + + let p1 = Point2D::new(1000.0, 2000.0); + let p2 = m1.transform_point(&p1); + assert!(p2.eq(&Point2D::new(1100.0, 2200.0))); + + let p3 = m2.transform_point(&p2); + assert!(p3.eq(&p1)); + } + + #[test] + fn test_inverse_none() { + assert!(Mf32::create_scale(2.0, 0.0, 2.0).inverse().is_none()); + assert!(Mf32::create_scale(2.0, 2.0, 2.0).inverse().is_some()); + } + + #[test] + pub fn test_pre_post() { + let m1 = Matrix4D::identity().post_scaled(1.0, 2.0, 3.0).post_translated(1.0, 2.0, 3.0); + let m2 = Matrix4D::identity().pre_translated(1.0, 2.0, 3.0).pre_scaled(1.0, 2.0, 3.0); + assert!(m1.approx_eq(&m2)); + + let r = Mf32::create_rotation(0.0, 0.0, 1.0, rad(FRAC_PI_2)); + let t = Mf32::create_translation(2.0, 3.0, 0.0); + + let a = Point3D::new(1.0, 1.0, 1.0); + + assert!(r.post_mul(&t).transform_point3d(&a).approx_eq(&Point3D::new(3.0, 2.0, 1.0))); + assert!(t.post_mul(&r).transform_point3d(&a).approx_eq(&Point3D::new(4.0, -3.0, 1.0))); + assert!(t.post_mul(&r).transform_point3d(&a).approx_eq(&r.transform_point3d(&t.transform_point3d(&a)))); + + assert!(r.pre_mul(&t).transform_point3d(&a).approx_eq(&Point3D::new(4.0, -3.0, 1.0))); + assert!(t.pre_mul(&r).transform_point3d(&a).approx_eq(&Point3D::new(3.0, 2.0, 1.0))); + assert!(t.pre_mul(&r).transform_point3d(&a).approx_eq(&t.transform_point3d(&r.transform_point3d(&a)))); + } + + #[test] + fn test_size_of() { + use std::mem::size_of; + assert_eq!(size_of::>(), 16*size_of::()); + assert_eq!(size_of::>(), 16*size_of::()); + } + + #[test] + pub fn test_transform_associativity() { + let m1 = Mf32::row_major(3.0, 2.0, 1.5, 1.0, + 0.0, 4.5, -1.0, -4.0, + 0.0, 3.5, 2.5, 40.0, + 0.0, 3.0, 0.0, 1.0); + let m2 = Mf32::row_major(1.0, -1.0, 3.0, 0.0, + -1.0, 0.5, 0.0, 2.0, + 1.5, -2.0, 6.0, 0.0, + -2.5, 6.0, 1.0, 1.0); + + let p = Point4D::new(1.0, 3.0, 5.0, 1.0); + let p1 = m2.pre_mul(&m1).transform_point4d(&p); + let p2 = m2.transform_point4d(&m1.transform_point4d(&p)); + assert!(p1.approx_eq(&p2)); + } +} diff --git a/third_party/rust/euclid/src/num.rs b/third_party/rust/euclid/src/num.rs new file mode 100644 index 000000000000..b612624273ed --- /dev/null +++ b/third_party/rust/euclid/src/num.rs @@ -0,0 +1,66 @@ +// Copyright 2014 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +//! A one-dimensional length, tagged with its units. + +use num_traits; + + +pub trait Zero { + fn zero() -> Self; +} + +impl Zero for T { + fn zero() -> T { num_traits::Zero::zero() } +} + +pub trait One { + fn one() -> Self; +} + +impl One for T { + fn one() -> T { num_traits::One::one() } +} + +pub trait Round : Copy { fn round(self) -> Self; } +pub trait Floor : Copy { fn floor(self) -> Self; } +pub trait Ceil : Copy { fn ceil(self) -> Self; } + +impl Round for f32 { fn round(self) -> Self { self.round() } } +impl Round for f64 { fn round(self) -> Self { self.round() } } +impl Round for i16 { fn round(self) -> Self { self } } +impl Round for u16 { fn round(self) -> Self { self } } +impl Round for i32 { fn round(self) -> Self { self } } +impl Round for i64 { fn round(self) -> Self { self } } +impl Round for u32 { fn round(self) -> Self { self } } +impl Round for u64 { fn round(self) -> Self { self } } +impl Round for usize { fn round(self) -> Self { self } } +impl Round for isize { fn round(self) -> Self { self } } + +impl Floor for f32 { fn floor(self) -> Self { self.floor() } } +impl Floor for f64 { fn floor(self) -> Self { self.floor() } } +impl Floor for i16 { fn floor(self) -> Self { self } } +impl Floor for u16 { fn floor(self) -> Self { self } } +impl Floor for i32 { fn floor(self) -> Self { self } } +impl Floor for i64 { fn floor(self) -> Self { self } } +impl Floor for u32 { fn floor(self) -> Self { self } } +impl Floor for u64 { fn floor(self) -> Self { self } } +impl Floor for usize { fn floor(self) -> Self { self } } +impl Floor for isize { fn floor(self) -> Self { self } } + +impl Ceil for f32 { fn ceil(self) -> Self { self.ceil() } } +impl Ceil for f64 { fn ceil(self) -> Self { self.ceil() } } +impl Ceil for i16 { fn ceil(self) -> Self { self } } +impl Ceil for u16 { fn ceil(self) -> Self { self } } +impl Ceil for i32 { fn ceil(self) -> Self { self } } +impl Ceil for i64 { fn ceil(self) -> Self { self } } +impl Ceil for u32 { fn ceil(self) -> Self { self } } +impl Ceil for u64 { fn ceil(self) -> Self { self } } +impl Ceil for usize { fn ceil(self) -> Self { self } } +impl Ceil for isize { fn ceil(self) -> Self { self } } + diff --git a/third_party/rust/euclid/src/point.rs b/third_party/rust/euclid/src/point.rs new file mode 100644 index 000000000000..85babca436aa --- /dev/null +++ b/third_party/rust/euclid/src/point.rs @@ -0,0 +1,939 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use super::UnknownUnit; +use approxeq::ApproxEq; +use length::Length; +use scale_factor::ScaleFactor; +use size::TypedSize2D; +use num::*; +use num_traits::{Float, NumCast}; +use std::fmt; +use std::ops::{Add, Neg, Mul, Sub, Div}; +use std::marker::PhantomData; + +define_matrix! { + /// A 2d Point tagged with a unit. + #[derive(RustcDecodable, RustcEncodable)] + pub struct TypedPoint2D { + pub x: T, + pub y: T, + } +} + +/// Default 2d point type with no unit. +/// +/// `Point2D` provides the same methods as `TypedPoint2D`. +pub type Point2D = TypedPoint2D; + +impl TypedPoint2D { + /// Constructor, setting all components to zero. + #[inline] + pub fn zero() -> TypedPoint2D { + TypedPoint2D::new(Zero::zero(), Zero::zero()) + } + + /// Convert into a 3d point. + #[inline] + pub fn to_3d(&self) -> TypedPoint3D { + TypedPoint3D::new(self.x, self.y, Zero::zero()) + } +} + +impl fmt::Debug for TypedPoint2D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "({:?},{:?})", self.x, self.y) + } +} + +impl fmt::Display for TypedPoint2D { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "({},{})", self.x, self.y) + } +} + +impl TypedPoint2D { + /// Constructor taking scalar values directly. + #[inline] + pub fn new(x: T, y: T) -> TypedPoint2D { + TypedPoint2D { x: x, y: y, _unit: PhantomData } + } + + /// Constructor taking properly typed Lengths instead of scalar values. + #[inline] + pub fn from_lengths(x: Length, y: Length) -> TypedPoint2D { + TypedPoint2D::new(x.0, y.0) + } + + /// Returns self.x as a Length carrying the unit. + #[inline] + pub fn x_typed(&self) -> Length { Length::new(self.x) } + + /// Returns self.y as a Length carrying the unit. + #[inline] + pub fn y_typed(&self) -> Length { Length::new(self.y) } + + /// Drop the units, preserving only the numeric value. + #[inline] + pub fn to_untyped(&self) -> Point2D { + TypedPoint2D::new(self.x, self.y) + } + + /// Tag a unitless value with units. + #[inline] + pub fn from_untyped(p: &Point2D) -> TypedPoint2D { + TypedPoint2D::new(p.x, p.y) + } + + #[inline] + pub fn to_array(&self) -> [T; 2] { + [self.x, self.y] + } +} + +impl TypedPoint2D +where T: Copy + Mul + Add + Sub { + /// Dot product. + #[inline] + pub fn dot(self, other: TypedPoint2D) -> T { + self.x * other.x + self.y * other.y + } + + /// Returns the norm of the cross product [self.x, self.y, 0] x [other.x, other.y, 0].. + #[inline] + pub fn cross(self, other: TypedPoint2D) -> T { + self.x * other.y - self.y * other.x + } +} + +impl, U> Add for TypedPoint2D { + type Output = TypedPoint2D; + fn add(self, other: TypedPoint2D) -> TypedPoint2D { + TypedPoint2D::new(self.x + other.x, self.y + other.y) + } +} + +impl, U> Add> for TypedPoint2D { + type Output = TypedPoint2D; + fn add(self, other: TypedSize2D) -> TypedPoint2D { + TypedPoint2D::new(self.x + other.width, self.y + other.height) + } +} + +impl, U> TypedPoint2D { + pub fn add_size(&self, other: &TypedSize2D) -> TypedPoint2D { + TypedPoint2D::new(self.x + other.width, self.y + other.height) + } +} + +impl, U> Sub for TypedPoint2D { + type Output = TypedPoint2D; + fn sub(self, other: TypedPoint2D) -> TypedPoint2D { + TypedPoint2D::new(self.x - other.x, self.y - other.y) + } +} + +impl , U> Neg for TypedPoint2D { + type Output = TypedPoint2D; + #[inline] + fn neg(self) -> TypedPoint2D { + TypedPoint2D::new(-self.x, -self.y) + } +} + +impl TypedPoint2D { + pub fn min(self, other: TypedPoint2D) -> TypedPoint2D { + TypedPoint2D::new(self.x.min(other.x), self.y.min(other.y)) + } + + pub fn max(self, other: TypedPoint2D) -> TypedPoint2D { + TypedPoint2D::new(self.x.max(other.x), self.y.max(other.y)) + } +} + +impl, U> Mul for TypedPoint2D { + type Output = TypedPoint2D; + #[inline] + fn mul(self, scale: T) -> TypedPoint2D { + TypedPoint2D::new(self.x * scale, self.y * scale) + } +} + +impl, U> Div for TypedPoint2D { + type Output = TypedPoint2D; + #[inline] + fn div(self, scale: T) -> TypedPoint2D { + TypedPoint2D::new(self.x / scale, self.y / scale) + } +} + +impl, U1, U2> Mul> for TypedPoint2D { + type Output = TypedPoint2D; + #[inline] + fn mul(self, scale: ScaleFactor) -> TypedPoint2D { + TypedPoint2D::new(self.x * scale.get(), self.y * scale.get()) + } +} + +impl, U1, U2> Div> for TypedPoint2D { + type Output = TypedPoint2D; + #[inline] + fn div(self, scale: ScaleFactor) -> TypedPoint2D { + TypedPoint2D::new(self.x / scale.get(), self.y / scale.get()) + } +} + +impl TypedPoint2D { + /// Rounds each component to the nearest integer value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + /// For example { -0.1, -0.8 }.round() == { 0.0, -1.0 } + pub fn round(&self) -> Self { + TypedPoint2D::new(self.x.round(), self.y.round()) + } +} + +impl TypedPoint2D { + /// Rounds each component to the smallest integer equal or greater than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + /// For example { -0.1, -0.8 }.ceil() == { 0.0, 0.0 }. + pub fn ceil(&self) -> Self { + TypedPoint2D::new(self.x.ceil(), self.y.ceil()) + } +} + +impl TypedPoint2D { + /// Rounds each component to the biggest integer equal or lower than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + /// For example { -0.1, -0.8 }.floor() == { -1.0, -1.0 }. + pub fn floor(&self) -> Self { + TypedPoint2D::new(self.x.floor(), self.y.floor()) + } +} + +impl TypedPoint2D { + /// Cast from one numeric representation to another, preserving the units. + /// + /// When casting from floating point to integer coordinates, the decimals are truncated + /// as one would expect from a simple cast, but this behavior does not always make sense + /// geometrically. Consider using round(), ceil or floor() before casting. + pub fn cast(&self) -> Option> { + match (NumCast::from(self.x), NumCast::from(self.y)) { + (Some(x), Some(y)) => Some(TypedPoint2D::new(x, y)), + _ => None + } + } + + // Convenience functions for common casts + + /// Cast into an f32 vector. + pub fn to_f32(&self) -> TypedPoint2D { + self.cast().unwrap() + } + + /// Cast into an usize point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_uint(&self) -> TypedPoint2D { + self.cast().unwrap() + } + + /// Cast into an i32 point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i32(&self) -> TypedPoint2D { + self.cast().unwrap() + } + + /// Cast into an i64 point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i64(&self) -> TypedPoint2D { + self.cast().unwrap() + } +} + +impl, U> ApproxEq> for TypedPoint2D { + #[inline] + fn approx_epsilon() -> Self { + TypedPoint2D::new(T::approx_epsilon(), T::approx_epsilon()) + } + + #[inline] + fn approx_eq(&self, other: &Self) -> bool { + self.x.approx_eq(&other.x) && self.y.approx_eq(&other.y) + } + + #[inline] + fn approx_eq_eps(&self, other: &Self, eps: &Self) -> bool { + self.x.approx_eq_eps(&other.x, &eps.x) && self.y.approx_eq_eps(&other.y, &eps.y) + } +} + +define_matrix! { + /// A 3d Point tagged with a unit. + #[derive(RustcDecodable, RustcEncodable)] + pub struct TypedPoint3D { + pub x: T, + pub y: T, + pub z: T, + } +} + +/// Default 3d point type with no unit. +/// +/// `Point3D` provides the same methods as `TypedPoint3D`. +pub type Point3D = TypedPoint3D; + +impl TypedPoint3D { + /// Constructor, setting all copmonents to zero. + #[inline] + pub fn zero() -> TypedPoint3D { + TypedPoint3D::new(Zero::zero(), Zero::zero(), Zero::zero()) + } +} + +impl fmt::Debug for TypedPoint3D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "({:?},{:?},{:?})", self.x, self.y, self.z) + } +} + +impl fmt::Display for TypedPoint3D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "({},{},{})", self.x, self.y, self.z) + } +} + +impl TypedPoint3D { + /// Constructor taking scalar values directly. + #[inline] + pub fn new(x: T, y: T, z: T) -> TypedPoint3D { + TypedPoint3D { x: x, y: y, z: z, _unit: PhantomData } + } + + /// Constructor taking properly typed Lengths instead of scalar values. + #[inline] + pub fn from_lengths(x: Length, y: Length, z: Length) -> TypedPoint3D { + TypedPoint3D::new(x.0, y.0, z.0) + } + + /// Returns self.x as a Length carrying the unit. + #[inline] + pub fn x_typed(&self) -> Length { Length::new(self.x) } + + /// Returns self.y as a Length carrying the unit. + #[inline] + pub fn y_typed(&self) -> Length { Length::new(self.y) } + + /// Returns self.z as a Length carrying the unit. + #[inline] + pub fn z_typed(&self) -> Length { Length::new(self.z) } + + #[inline] + pub fn to_array(&self) -> [T; 3] { [self.x, self.y, self.z] } + + /// Drop the units, preserving only the numeric value. + #[inline] + pub fn to_untyped(&self) -> Point3D { + TypedPoint3D::new(self.x, self.y, self.z) + } + + /// Tag a unitless value with units. + #[inline] + pub fn from_untyped(p: &Point3D) -> TypedPoint3D { + TypedPoint3D::new(p.x, p.y, p.z) + } + + /// Convert into a 2d point. + #[inline] + pub fn to_2d(&self) -> TypedPoint2D { + TypedPoint2D::new(self.x, self.y) + } +} + +impl + + Add + + Sub + + Copy, U> TypedPoint3D { + + // Dot product. + #[inline] + pub fn dot(self, other: TypedPoint3D) -> T { + self.x * other.x + + self.y * other.y + + self.z * other.z + } + + // Cross product. + #[inline] + pub fn cross(self, other: TypedPoint3D) -> TypedPoint3D { + TypedPoint3D::new(self.y * other.z - self.z * other.y, + self.z * other.x - self.x * other.z, + self.x * other.y - self.y * other.x) + } +} + +impl, U> Add for TypedPoint3D { + type Output = TypedPoint3D; + fn add(self, other: TypedPoint3D) -> TypedPoint3D { + TypedPoint3D::new(self.x + other.x, + self.y + other.y, + self.z + other.z) + } +} + +impl, U> Sub for TypedPoint3D { + type Output = TypedPoint3D; + fn sub(self, other: TypedPoint3D) -> TypedPoint3D { + TypedPoint3D::new(self.x - other.x, + self.y - other.y, + self.z - other.z) + } +} + +impl , U> Neg for TypedPoint3D { + type Output = TypedPoint3D; + #[inline] + fn neg(self) -> TypedPoint3D { + TypedPoint3D::new(-self.x, -self.y, -self.z) + } +} + +impl TypedPoint3D { + pub fn min(self, other: TypedPoint3D) -> TypedPoint3D { + TypedPoint3D::new(self.x.min(other.x), + self.y.min(other.y), + self.z.min(other.z)) + } + + pub fn max(self, other: TypedPoint3D) -> TypedPoint3D { + TypedPoint3D::new(self.x.max(other.x), self.y.max(other.y), + self.z.max(other.z)) + } +} + +impl TypedPoint3D { + /// Rounds each component to the nearest integer value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn round(&self) -> Self { + TypedPoint3D::new(self.x.round(), self.y.round(), self.z.round()) + } +} + +impl TypedPoint3D { + /// Rounds each component to the smallest integer equal or greater than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn ceil(&self) -> Self { + TypedPoint3D::new(self.x.ceil(), self.y.ceil(), self.z.ceil()) + } +} + +impl TypedPoint3D { + /// Rounds each component to the biggest integer equal or lower than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn floor(&self) -> Self { + TypedPoint3D::new(self.x.floor(), self.y.floor(), self.z.floor()) + } +} + +impl TypedPoint3D { + /// Cast from one numeric representation to another, preserving the units. + /// + /// When casting from floating point to integer coordinates, the decimals are truncated + /// as one would expect from a simple cast, but this behavior does not always make sense + /// geometrically. Consider using round(), ceil or floor() before casting. + pub fn cast(&self) -> Option> { + match (NumCast::from(self.x), + NumCast::from(self.y), + NumCast::from(self.z)) { + (Some(x), Some(y), Some(z)) => Some(TypedPoint3D::new(x, y, z)), + _ => None + } + } + + // Convenience functions for common casts + + /// Cast into an f32 vector. + pub fn to_f32(&self) -> TypedPoint3D { + self.cast().unwrap() + } + + /// Cast into an usize point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_uint(&self) -> TypedPoint3D { + self.cast().unwrap() + } + + /// Cast into an i32 point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i32(&self) -> TypedPoint3D { + self.cast().unwrap() + } + + /// Cast into an i64 point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i64(&self) -> TypedPoint3D { + self.cast().unwrap() + } +} + +impl, U> ApproxEq> for TypedPoint3D { + #[inline] + fn approx_epsilon() -> Self { + TypedPoint3D::new(T::approx_epsilon(), T::approx_epsilon(), T::approx_epsilon()) + } + + #[inline] + fn approx_eq(&self, other: &Self) -> bool { + self.x.approx_eq(&other.x) + && self.y.approx_eq(&other.y) + && self.z.approx_eq(&other.z) + } + + #[inline] + fn approx_eq_eps(&self, other: &Self, eps: &Self) -> bool { + self.x.approx_eq_eps(&other.x, &eps.x) + && self.y.approx_eq_eps(&other.y, &eps.y) + && self.z.approx_eq_eps(&other.z, &eps.z) + } +} + +define_matrix! { + /// A 4d Point tagged with a unit. + #[derive(RustcDecodable, RustcEncodable)] + pub struct TypedPoint4D { + pub x: T, + pub y: T, + pub z: T, + pub w: T, + } +} + +/// Default 4d point with no unit. +/// +/// `Point4D` provides the same methods as `TypedPoint4D`. +pub type Point4D = TypedPoint4D; + +impl TypedPoint4D { + /// Constructor, setting all copmonents to zero. + #[inline] + pub fn zero() -> TypedPoint4D { + TypedPoint4D::new(Zero::zero(), Zero::zero(), Zero::zero(), Zero::zero()) + } +} + +impl fmt::Debug for TypedPoint4D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "({:?},{:?},{:?},{:?})", self.x, self.y, self.z, self.w) + } +} + +impl fmt::Display for TypedPoint4D { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "({},{},{},{})", self.x, self.y, self.z, self.w) + } +} + +impl TypedPoint4D { + /// Constructor taking scalar values directly. + #[inline] + pub fn new(x: T, y: T, z: T, w: T) -> TypedPoint4D { + TypedPoint4D { x: x, y: y, z: z, w: w, _unit: PhantomData } + } + + /// Constructor taking properly typed Lengths instead of scalar values. + #[inline] + pub fn from_lengths(x: Length, + y: Length, + z: Length, + w: Length) -> TypedPoint4D { + TypedPoint4D::new(x.0, y.0, z.0, w.0) + } + + /// Returns self.x as a Length carrying the unit. + #[inline] + pub fn x_typed(&self) -> Length { Length::new(self.x) } + + /// Returns self.y as a Length carrying the unit. + #[inline] + pub fn y_typed(&self) -> Length { Length::new(self.y) } + + /// Returns self.z as a Length carrying the unit. + #[inline] + pub fn z_typed(&self) -> Length { Length::new(self.z) } + + /// Returns self.w as a Length carrying the unit. + #[inline] + pub fn w_typed(&self) -> Length { Length::new(self.w) } + + /// Drop the units, preserving only the numeric value. + #[inline] + pub fn to_untyped(&self) -> Point4D { + TypedPoint4D::new(self.x, self.y, self.z, self.w) + } + + /// Tag a unitless value with units. + #[inline] + pub fn from_untyped(p: &Point4D) -> TypedPoint4D { + TypedPoint4D::new(p.x, p.y, p.z, p.w) + } + + #[inline] + pub fn to_array(&self) -> [T; 4] { + [self.x, self.y, self.z, self.w] + } +} + +impl, U> TypedPoint4D { + /// Convert into a 2d point. + #[inline] + pub fn to_2d(self) -> TypedPoint2D { + TypedPoint2D::new(self.x / self.w, self.y / self.w) + } + + /// Convert into a 3d point. + #[inline] + pub fn to_3d(self) -> TypedPoint3D { + TypedPoint3D::new(self.x / self.w, self.y / self.w, self.z / self.w) + } +} + +impl, U> Add for TypedPoint4D { + type Output = TypedPoint4D; + fn add(self, other: TypedPoint4D) -> TypedPoint4D { + TypedPoint4D::new(self.x + other.x, + self.y + other.y, + self.z + other.z, + self.w + other.w) + } +} + +impl, U> Sub for TypedPoint4D { + type Output = TypedPoint4D; + fn sub(self, other: TypedPoint4D) -> TypedPoint4D { + TypedPoint4D::new(self.x - other.x, + self.y - other.y, + self.z - other.z, + self.w - other.w) + } +} + +impl , U> Neg for TypedPoint4D { + type Output = TypedPoint4D; + #[inline] + fn neg(self) -> TypedPoint4D { + TypedPoint4D::new(-self.x, -self.y, -self.z, -self.w) + } +} + +impl TypedPoint4D { + pub fn min(self, other: TypedPoint4D) -> TypedPoint4D { + TypedPoint4D::new(self.x.min(other.x), self.y.min(other.y), + self.z.min(other.z), self.w.min(other.w)) + } + + pub fn max(self, other: TypedPoint4D) -> TypedPoint4D { + TypedPoint4D::new(self.x.max(other.x), self.y.max(other.y), + self.z.max(other.z), self.w.max(other.w)) + } +} + +impl TypedPoint4D { + /// Rounds each component to the nearest integer value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn round(&self) -> Self { + TypedPoint4D::new(self.x.round(), self.y.round(), self.z.round(), self.w.round()) + } +} + +impl TypedPoint4D { + /// Rounds each component to the smallest integer equal or greater than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn ceil(&self) -> Self { + TypedPoint4D::new(self.x.ceil(), self.y.ceil(), self.z.ceil(), self.w.ceil()) + } +} + +impl TypedPoint4D { + /// Rounds each component to the biggest integer equal or lower than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn floor(&self) -> Self { + TypedPoint4D::new(self.x.floor(), self.y.floor(), self.z.floor(), self.w.floor()) + } +} + +impl TypedPoint4D { + /// Cast from one numeric representation to another, preserving the units. + /// + /// When casting from floating point to integer coordinates, the decimals are truncated + /// as one would expect from a simple cast, but this behavior does not always make sense + /// geometrically. Consider using round(), ceil or floor() before casting. + pub fn cast(&self) -> Option> { + match (NumCast::from(self.x), + NumCast::from(self.y), + NumCast::from(self.z), + NumCast::from(self.w)) { + (Some(x), Some(y), Some(z), Some(w)) => Some(TypedPoint4D::new(x, y, z, w)), + _ => None + } + } + + // Convenience functions for common casts + + /// Cast into an f32 vector. + pub fn to_f32(&self) -> TypedPoint4D { + self.cast().unwrap() + } + + /// Cast into an usize point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_uint(&self) -> TypedPoint4D { + self.cast().unwrap() + } + + /// Cast into an i32 point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i32(&self) -> TypedPoint4D { + self.cast().unwrap() + } + + /// Cast into an i64 point, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i64(&self) -> TypedPoint4D { + self.cast().unwrap() + } +} + +impl, U> ApproxEq for TypedPoint4D { + fn approx_epsilon() -> T { + T::approx_epsilon() + } + + fn approx_eq_eps(&self, other: &Self, approx_epsilon: &T) -> bool { + self.x.approx_eq_eps(&other.x, approx_epsilon) + && self.y.approx_eq_eps(&other.y, approx_epsilon) + && self.z.approx_eq_eps(&other.z, approx_epsilon) + && self.w.approx_eq_eps(&other.w, approx_epsilon) + } + + fn approx_eq(&self, other: &Self) -> bool { + self.approx_eq_eps(&other, &Self::approx_epsilon()) + } +} + +pub fn point2(x: T, y: T) -> TypedPoint2D { + TypedPoint2D::new(x, y) +} + +pub fn point3(x: T, y: T, z: T) -> TypedPoint3D { + TypedPoint3D::new(x, y, z) +} + +pub fn point4(x: T, y: T, z: T, w: T) -> TypedPoint4D { + TypedPoint4D::new(x, y, z, w) +} + +#[cfg(test)] +mod point2d { + use super::Point2D; + + #[test] + pub fn test_scalar_mul() { + let p1: Point2D = Point2D::new(3.0, 5.0); + + let result = p1 * 5.0; + + assert_eq!(result, Point2D::new(15.0, 25.0)); + } + + #[test] + pub fn test_dot() { + let p1: Point2D = Point2D::new(2.0, 7.0); + let p2: Point2D = Point2D::new(13.0, 11.0); + assert_eq!(p1.dot(p2), 103.0); + } + + #[test] + pub fn test_cross() { + let p1: Point2D = Point2D::new(4.0, 7.0); + let p2: Point2D = Point2D::new(13.0, 8.0); + let r = p1.cross(p2); + assert_eq!(r, -59.0); + } + + #[test] + pub fn test_min() { + let p1 = Point2D::new(1.0, 3.0); + let p2 = Point2D::new(2.0, 2.0); + + let result = p1.min(p2); + + assert_eq!(result, Point2D::new(1.0, 2.0)); + } + + #[test] + pub fn test_max() { + let p1 = Point2D::new(1.0, 3.0); + let p2 = Point2D::new(2.0, 2.0); + + let result = p1.max(p2); + + assert_eq!(result, Point2D::new(2.0, 3.0)); + } +} + +#[cfg(test)] +mod typedpoint2d { + use super::TypedPoint2D; + use scale_factor::ScaleFactor; + + pub enum Mm {} + pub enum Cm {} + + pub type Point2DMm = TypedPoint2D; + pub type Point2DCm = TypedPoint2D; + + #[test] + pub fn test_add() { + let p1 = Point2DMm::new(1.0, 2.0); + let p2 = Point2DMm::new(3.0, 4.0); + + let result = p1 + p2; + + assert_eq!(result, Point2DMm::new(4.0, 6.0)); + } + + #[test] + pub fn test_scalar_mul() { + let p1 = Point2DMm::new(1.0, 2.0); + let cm_per_mm: ScaleFactor = ScaleFactor::new(0.1); + + let result = p1 * cm_per_mm; + + assert_eq!(result, Point2DCm::new(0.1, 0.2)); + } +} + +#[cfg(test)] +mod point3d { + use super::Point3D; + + #[test] + pub fn test_dot() { + let p1 = Point3D::new(7.0, 21.0, 32.0); + let p2 = Point3D::new(43.0, 5.0, 16.0); + assert_eq!(p1.dot(p2), 918.0); + } + + #[test] + pub fn test_cross() { + let p1 = Point3D::new(4.0, 7.0, 9.0); + let p2 = Point3D::new(13.0, 8.0, 3.0); + let p3 = p1.cross(p2); + assert_eq!(p3, Point3D::new(-51.0, 105.0, -59.0)); + } + + #[test] + pub fn test_min() { + let p1 = Point3D::new(1.0, 3.0, 5.0); + let p2 = Point3D::new(2.0, 2.0, -1.0); + + let result = p1.min(p2); + + assert_eq!(result, Point3D::new(1.0, 2.0, -1.0)); + } + + #[test] + pub fn test_max() { + let p1 = Point3D::new(1.0, 3.0, 5.0); + let p2 = Point3D::new(2.0, 2.0, -1.0); + + let result = p1.max(p2); + + assert_eq!(result, Point3D::new(2.0, 3.0, 5.0)); + } +} + +#[cfg(test)] +mod point4d { + use super::Point4D; + + #[test] + pub fn test_add() { + let p1 = Point4D::new(7.0, 21.0, 32.0, 1.0); + let p2 = Point4D::new(43.0, 5.0, 16.0, 2.0); + + let result = p1 + p2; + + assert_eq!(result, Point4D::new(50.0, 26.0, 48.0, 3.0)); + } + + #[test] + pub fn test_sub() { + let p1 = Point4D::new(7.0, 21.0, 32.0, 1.0); + let p2 = Point4D::new(43.0, 5.0, 16.0, 2.0); + + let result = p1 - p2; + + assert_eq!(result, Point4D::new(-36.0, 16.0, 16.0, -1.0)); + } + + #[test] + pub fn test_min() { + let p1 = Point4D::new(1.0, 3.0, 5.0, 7.0); + let p2 = Point4D::new(2.0, 2.0, -1.0, 10.0); + + let result = p1.min(p2); + + assert_eq!(result, Point4D::new(1.0, 2.0, -1.0, 7.0)); + } + + #[test] + pub fn test_max() { + let p1 = Point4D::new(1.0, 3.0, 5.0, 7.0); + let p2 = Point4D::new(2.0, 2.0, -1.0, 10.0); + + let result = p1.max(p2); + + assert_eq!(result, Point4D::new(2.0, 3.0, 5.0, 10.0)); + } +} diff --git a/third_party/rust/euclid/src/rect.rs b/third_party/rust/euclid/src/rect.rs new file mode 100644 index 000000000000..fff6a1f90a07 --- /dev/null +++ b/third_party/rust/euclid/src/rect.rs @@ -0,0 +1,671 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use super::UnknownUnit; +use length::Length; +use scale_factor::ScaleFactor; +use num::*; +use point::TypedPoint2D; +use size::TypedSize2D; + +use heapsize::HeapSizeOf; +use num_traits::NumCast; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use std::cmp::PartialOrd; +use std::fmt; +use std::ops::{Add, Sub, Mul, Div}; + +/// A 2d Rectangle optionally tagged with a unit. +#[derive(RustcDecodable, RustcEncodable)] +pub struct TypedRect { + pub origin: TypedPoint2D, + pub size: TypedSize2D, +} + +/// The default rectangle type with no unit. +pub type Rect = TypedRect; + +impl HeapSizeOf for TypedRect { + fn heap_size_of_children(&self) -> usize { + self.origin.heap_size_of_children() + self.size.heap_size_of_children() + } +} + +impl Deserialize for TypedRect { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer + { + let (origin, size) = try!(Deserialize::deserialize(deserializer)); + Ok(TypedRect::new(origin, size)) + } +} + +impl Serialize for TypedRect { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer + { + (&self.origin, &self.size).serialize(serializer) + } +} + +impl Copy for TypedRect {} + +impl Clone for TypedRect { + fn clone(&self) -> TypedRect { *self } +} + +impl PartialEq> for TypedRect { + fn eq(&self, other: &TypedRect) -> bool { + self.origin.eq(&other.origin) && self.size.eq(&other.size) + } +} + +impl Eq for TypedRect {} + +impl fmt::Debug for TypedRect { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "TypedRect({:?} at {:?})", self.size, self.origin) + } +} + +impl fmt::Display for TypedRect { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "Rect({} at {})", self.size, self.origin) + } +} + +impl TypedRect { + /// Constructor. + pub fn new(origin: TypedPoint2D, size: TypedSize2D) -> TypedRect { + TypedRect { + origin: origin, + size: size, + } + } +} + +impl TypedRect +where T: Copy + Clone + Zero + PartialOrd + PartialEq + Add + Sub { + #[inline] + pub fn intersects(&self, other: &TypedRect) -> bool { + self.origin.x < other.origin.x + other.size.width && + other.origin.x < self.origin.x + self.size.width && + self.origin.y < other.origin.y + other.size.height && + other.origin.y < self.origin.y + self.size.height + } + + #[inline] + pub fn max_x(&self) -> T { + self.origin.x + self.size.width + } + + #[inline] + pub fn min_x(&self) -> T { + self.origin.x + } + + #[inline] + pub fn max_y(&self) -> T { + self.origin.y + self.size.height + } + + #[inline] + pub fn min_y(&self) -> T { + self.origin.y + } + + #[inline] + pub fn max_x_typed(&self) -> Length { + Length::new(self.max_x()) + } + + #[inline] + pub fn min_x_typed(&self) -> Length { + Length::new(self.min_x()) + } + + #[inline] + pub fn max_y_typed(&self) -> Length { + Length::new(self.max_y()) + } + + #[inline] + pub fn min_y_typed(&self) -> Length { + Length::new(self.min_y()) + } + + #[inline] + pub fn intersection(&self, other: &TypedRect) -> Option> { + if !self.intersects(other) { + return None; + } + + let upper_left = TypedPoint2D::new(max(self.min_x(), other.min_x()), + max(self.min_y(), other.min_y())); + let lower_right_x = min(self.max_x(), other.max_x()); + let lower_right_y = min(self.max_y(), other.max_y()); + + Some(TypedRect::new(upper_left, TypedSize2D::new(lower_right_x - upper_left.x, + lower_right_y - upper_left.y))) + } + + /// Translates the rect by a vector. + #[inline] + pub fn translate(&self, other: &TypedPoint2D) -> TypedRect { + TypedRect::new( + TypedPoint2D::new(self.origin.x + other.x, self.origin.y + other.y), + self.size + ) + } + + /// Returns true if this rectangle contains the point. Points are considered + /// in the rectangle if they are on the left or top edge, but outside if they + /// are on the right or bottom edge. + #[inline] + pub fn contains(&self, other: &TypedPoint2D) -> bool { + self.origin.x <= other.x && other.x < self.origin.x + self.size.width && + self.origin.y <= other.y && other.y < self.origin.y + self.size.height + } + + /// Returns true if this rectangle contains the interior of rect. Always + /// returns true if rect is empty, and always returns false if rect is + /// nonempty but this rectangle is empty. + #[inline] + pub fn contains_rect(&self, rect: &TypedRect) -> bool { + rect.is_empty() || + (self.min_x() <= rect.min_x() && rect.max_x() <= self.max_x() && + self.min_y() <= rect.min_y() && rect.max_y() <= self.max_y()) + } + + #[inline] + pub fn inflate(&self, width: T, height: T) -> TypedRect { + TypedRect::new( + TypedPoint2D::new(self.origin.x - width, self.origin.y - height), + TypedSize2D::new(self.size.width + width + width, self.size.height + height + height), + ) + } + + #[inline] + pub fn inflate_typed(&self, width: Length, height: Length) -> TypedRect { + self.inflate(width.get(), height.get()) + } + + #[inline] + pub fn top_right(&self) -> TypedPoint2D { + TypedPoint2D::new(self.max_x(), self.origin.y) + } + + #[inline] + pub fn bottom_left(&self) -> TypedPoint2D { + TypedPoint2D::new(self.origin.x, self.max_y()) + } + + #[inline] + pub fn bottom_right(&self) -> TypedPoint2D { + TypedPoint2D::new(self.max_x(), self.max_y()) + } + + #[inline] + pub fn translate_by_size(&self, size: &TypedSize2D) -> TypedRect { + self.translate(&TypedPoint2D::new(size.width, size.height)) + } + + /// Returns the smallest rectangle containing the four points. + pub fn from_points(points: &[TypedPoint2D]) -> Self { + if points.len() == 0 { + return TypedRect::zero(); + } + let (mut min_x, mut min_y) = (points[0].x, points[0].y); + let (mut max_x, mut max_y) = (min_x, min_y); + for point in &points[1..] { + if point.x < min_x { + min_x = point.x + } + if point.x > max_x { + max_x = point.x + } + if point.y < min_y { + min_y = point.y + } + if point.y > max_y { + max_y = point.y + } + } + TypedRect::new(TypedPoint2D::new(min_x, min_y), + TypedSize2D::new(max_x - min_x, max_y - min_y)) + } +} + +impl TypedRect +where T: Copy + Clone + PartialOrd + Add + Sub + Zero { + #[inline] + pub fn union(&self, other: &TypedRect) -> TypedRect { + if self.size == Zero::zero() { + return *other; + } + if other.size == Zero::zero() { + return *self; + } + + let upper_left = TypedPoint2D::new(min(self.min_x(), other.min_x()), + min(self.min_y(), other.min_y())); + + let lower_right_x = max(self.max_x(), other.max_x()); + let lower_right_y = max(self.max_y(), other.max_y()); + + TypedRect::new( + upper_left, + TypedSize2D::new(lower_right_x - upper_left.x, lower_right_y - upper_left.y) + ) + } +} + +impl TypedRect { + #[inline] + pub fn scale(&self, x: Scale, y: Scale) -> TypedRect + where T: Copy + Clone + Mul { + TypedRect::new( + TypedPoint2D::new(self.origin.x * x, self.origin.y * y), + TypedSize2D::new(self.size.width * x, self.size.height * y) + ) + } +} + +impl TypedRect { + /// Constructor, setting all sides to zero. + pub fn zero() -> TypedRect { + TypedRect::new( + TypedPoint2D::zero(), + TypedSize2D::zero(), + ) + } + + /// Returns true if the size is zero, regardless of the origin's value. + pub fn is_empty(&self) -> bool { + self.size.width == Zero::zero() || self.size.height == Zero::zero() + } +} + + +pub fn min(x: T, y: T) -> T { + if x <= y { x } else { y } +} + +pub fn max(x: T, y: T) -> T { + if x >= y { x } else { y } +} + +impl, U> Mul for TypedRect { + type Output = TypedRect; + #[inline] + fn mul(self, scale: T) -> TypedRect { + TypedRect::new(self.origin * scale, self.size * scale) + } +} + +impl, U> Div for TypedRect { + type Output = TypedRect; + #[inline] + fn div(self, scale: T) -> TypedRect { + TypedRect::new(self.origin / scale, self.size / scale) + } +} + +impl, U1, U2> Mul> for TypedRect { + type Output = TypedRect; + #[inline] + fn mul(self, scale: ScaleFactor) -> TypedRect { + TypedRect::new(self.origin * scale, self.size * scale) + } +} + +impl, U1, U2> Div> for TypedRect { + type Output = TypedRect; + #[inline] + fn div(self, scale: ScaleFactor) -> TypedRect { + TypedRect::new(self.origin / scale, self.size / scale) + } +} + +impl TypedRect { + /// Drop the units, preserving only the numeric value. + pub fn to_untyped(&self) -> Rect { + TypedRect::new(self.origin.to_untyped(), self.size.to_untyped()) + } + + /// Tag a unitless value with units. + pub fn from_untyped(r: &Rect) -> TypedRect { + TypedRect::new(TypedPoint2D::from_untyped(&r.origin), TypedSize2D::from_untyped(&r.size)) + } +} + +impl TypedRect { + /// Cast from one numeric representation to another, preserving the units. + /// + /// When casting from floating point to integer coordinates, the decimals are truncated + /// as one would expect from a simple cast, but this behavior does not always make sense + /// geometrically. Consider using round(), round_in or round_out() before casting. + pub fn cast(&self) -> Option> { + match (self.origin.cast(), self.size.cast()) { + (Some(origin), Some(size)) => Some(TypedRect::new(origin, size)), + _ => None + } + } +} + +impl + Sub, U> TypedRect { + /// Return a rectangle with edges rounded to integer coordinates, such that + /// the returned rectangle has the same set of pixel centers as the original + /// one. + /// Edges at offset 0.5 round up. + /// Suitable for most places where integral device coordinates + /// are needed, but note that any translation should be applied first to + /// avoid pixel rounding errors. + /// Note that this is *not* rounding to nearest integer if the values are negative. + /// They are always rounding as floor(n + 0.5). + pub fn round(&self) -> Self { + let origin = self.origin.round(); + let size = self.origin.add_size(&self.size).round() - origin; + TypedRect::new(origin, TypedSize2D::new(size.x, size.y)) + } + + /// Return a rectangle with edges rounded to integer coordinates, such that + /// the original rectangle contains the resulting rectangle. + pub fn round_in(&self) -> Self { + let origin = self.origin.ceil(); + let size = self.origin.add_size(&self.size).floor() - origin; + TypedRect::new(origin, TypedSize2D::new(size.x, size.y)) + } + + /// Return a rectangle with edges rounded to integer coordinates, such that + /// the original rectangle is contained in the resulting rectangle. + pub fn round_out(&self) -> Self { + let origin = self.origin.floor(); + let size = self.origin.add_size(&self.size).ceil() - origin; + TypedRect::new(origin, TypedSize2D::new(size.x, size.y)) + } +} + +// Convenience functions for common casts +impl TypedRect { + /// Cast into an f32 vector. + pub fn to_f32(&self) -> TypedRect { + self.cast().unwrap() + } + + /// Cast into an usize vector, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), round_in() or round_out() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_uint(&self) -> TypedRect { + self.cast().unwrap() + } + + /// Cast into an i32 vector, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), round_in() or round_out() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i32(&self) -> TypedRect { + self.cast().unwrap() + } + + /// Cast into an i64 vector, truncating decimals if any. + /// + /// When casting from floating point vectors, it is worth considering whether + /// to round(), round_in() or round_out() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i64(&self) -> TypedRect { + self.cast().unwrap() + } +} + +/// Shorthand for TypedRect::new(TypedPoint2D::new(x, y), TypedSize2D::new(w, h)). +pub fn rect(x: T, y: T, w: T, h: T) -> TypedRect { + TypedRect::new(TypedPoint2D::new(x, y), TypedSize2D::new(w, h)) +} + +#[cfg(test)] +mod tests { + use point::Point2D; + use size::Size2D; + use super::*; + + #[test] + fn test_min_max() { + assert!(min(0u32, 1u32) == 0u32); + assert!(min(-1.0f32, 0.0f32) == -1.0f32); + + assert!(max(0u32, 1u32) == 1u32); + assert!(max(-1.0f32, 0.0f32) == 0.0f32); + } + + #[test] + fn test_translate() { + let p = Rect::new(Point2D::new(0u32, 0u32), Size2D::new(50u32, 40u32)); + let pp = p.translate(&Point2D::new(10,15)); + + assert!(pp.size.width == 50); + assert!(pp.size.height == 40); + assert!(pp.origin.x == 10); + assert!(pp.origin.y == 15); + + + let r = Rect::new(Point2D::new(-10, -5), Size2D::new(50, 40)); + let rr = r.translate(&Point2D::new(0,-10)); + + assert!(rr.size.width == 50); + assert!(rr.size.height == 40); + assert!(rr.origin.x == -10); + assert!(rr.origin.y == -15); + } + + #[test] + fn test_translate_by_size() { + let p = Rect::new(Point2D::new(0u32, 0u32), Size2D::new(50u32, 40u32)); + let pp = p.translate_by_size(&Size2D::new(10,15)); + + assert!(pp.size.width == 50); + assert!(pp.size.height == 40); + assert!(pp.origin.x == 10); + assert!(pp.origin.y == 15); + + + let r = Rect::new(Point2D::new(-10, -5), Size2D::new(50, 40)); + let rr = r.translate_by_size(&Size2D::new(0,-10)); + + assert!(rr.size.width == 50); + assert!(rr.size.height == 40); + assert!(rr.origin.x == -10); + assert!(rr.origin.y == -15); + } + + #[test] + fn test_union() { + let p = Rect::new(Point2D::new(0, 0), Size2D::new(50, 40)); + let q = Rect::new(Point2D::new(20,20), Size2D::new(5, 5)); + let r = Rect::new(Point2D::new(-15, -30), Size2D::new(200, 15)); + let s = Rect::new(Point2D::new(20, -15), Size2D::new(250, 200)); + + let pq = p.union(&q); + assert!(pq.origin == Point2D::new(0, 0)); + assert!(pq.size == Size2D::new(50, 40)); + + let pr = p.union(&r); + assert!(pr.origin == Point2D::new(-15, -30)); + assert!(pr.size == Size2D::new(200, 70)); + + let ps = p.union(&s); + assert!(ps.origin == Point2D::new(0, -15)); + assert!(ps.size == Size2D::new(270, 200)); + + } + + #[test] + fn test_intersection() { + let p = Rect::new(Point2D::new(0, 0), Size2D::new(10, 20)); + let q = Rect::new(Point2D::new(5, 15), Size2D::new(10, 10)); + let r = Rect::new(Point2D::new(-5, -5), Size2D::new(8, 8)); + + let pq = p.intersection(&q); + assert!(pq.is_some()); + let pq = pq.unwrap(); + assert!(pq.origin == Point2D::new(5, 15)); + assert!(pq.size == Size2D::new(5, 5)); + + let pr = p.intersection(&r); + assert!(pr.is_some()); + let pr = pr.unwrap(); + assert!(pr.origin == Point2D::new(0, 0)); + assert!(pr.size == Size2D::new(3, 3)); + + let qr = q.intersection(&r); + assert!(qr.is_none()); + } + + #[test] + fn test_contains() { + let r = Rect::new(Point2D::new(-20, 15), Size2D::new(100, 200)); + + assert!(r.contains(&Point2D::new(0, 50))); + assert!(r.contains(&Point2D::new(-10, 200))); + + // The `contains` method is inclusive of the top/left edges, but not the + // bottom/right edges. + assert!(r.contains(&Point2D::new(-20, 15))); + assert!(!r.contains(&Point2D::new(80, 15))); + assert!(!r.contains(&Point2D::new(80, 215))); + assert!(!r.contains(&Point2D::new(-20, 215))); + + // Points beyond the top-left corner. + assert!(!r.contains(&Point2D::new(-25, 15))); + assert!(!r.contains(&Point2D::new(-15, 10))); + + // Points beyond the top-right corner. + assert!(!r.contains(&Point2D::new(85, 20))); + assert!(!r.contains(&Point2D::new(75, 10))); + + // Points beyond the bottom-right corner. + assert!(!r.contains(&Point2D::new(85, 210))); + assert!(!r.contains(&Point2D::new(75, 220))); + + // Points beyond the bottom-left corner. + assert!(!r.contains(&Point2D::new(-25, 210))); + assert!(!r.contains(&Point2D::new(-15, 220))); + + let r = Rect::new(Point2D::new(-20.0, 15.0), Size2D::new(100.0, 200.0)); + assert!(r.contains_rect(&r)); + assert!(!r.contains_rect(&r.translate(&Point2D::new( 0.1, 0.0)))); + assert!(!r.contains_rect(&r.translate(&Point2D::new(-0.1, 0.0)))); + assert!(!r.contains_rect(&r.translate(&Point2D::new( 0.0, 0.1)))); + assert!(!r.contains_rect(&r.translate(&Point2D::new( 0.0, -0.1)))); + // Empty rectangles are always considered as contained in other rectangles, + // even if their origin is not. + let p = Point2D::new(1.0, 1.0); + assert!(!r.contains(&p)); + assert!(r.contains_rect(&Rect::new(p, Size2D::zero()))); + } + + #[test] + fn test_scale() { + let p = Rect::new(Point2D::new(0u32, 0u32), Size2D::new(50u32, 40u32)); + let pp = p.scale(10, 15); + + assert!(pp.size.width == 500); + assert!(pp.size.height == 600); + assert!(pp.origin.x == 0); + assert!(pp.origin.y == 0); + + let r = Rect::new(Point2D::new(-10, -5), Size2D::new(50, 40)); + let rr = r.scale(1, 20); + + assert!(rr.size.width == 50); + assert!(rr.size.height == 800); + assert!(rr.origin.x == -10); + assert!(rr.origin.y == -100); + } + + #[test] + fn test_inflate() { + let p = Rect::new(Point2D::new(0, 0), Size2D::new(10, 10)); + let pp = p.inflate(10, 20); + + assert!(pp.size.width == 30); + assert!(pp.size.height == 50); + assert!(pp.origin.x == -10); + assert!(pp.origin.y == -20); + + let r = Rect::new(Point2D::new(0, 0), Size2D::new(10, 20)); + let rr = r.inflate(-2, -5); + + assert!(rr.size.width == 6); + assert!(rr.size.height == 10); + assert!(rr.origin.x == 2); + assert!(rr.origin.y == 5); + } + + #[test] + fn test_min_max_x_y() { + let p = Rect::new(Point2D::new(0u32, 0u32), Size2D::new(50u32, 40u32)); + assert!(p.max_y() == 40); + assert!(p.min_y() == 0); + assert!(p.max_x() == 50); + assert!(p.min_x() == 0); + + let r = Rect::new(Point2D::new(-10, -5), Size2D::new(50, 40)); + assert!(r.max_y() == 35); + assert!(r.min_y() == -5); + assert!(r.max_x() == 40); + assert!(r.min_x() == -10); + } + + #[test] + fn test_is_empty() { + assert!(Rect::new(Point2D::new(0u32, 0u32), Size2D::new(0u32, 0u32)).is_empty()); + assert!(Rect::new(Point2D::new(0u32, 0u32), Size2D::new(10u32, 0u32)).is_empty()); + assert!(Rect::new(Point2D::new(0u32, 0u32), Size2D::new(0u32, 10u32)).is_empty()); + assert!(!Rect::new(Point2D::new(0u32, 0u32), Size2D::new(1u32, 1u32)).is_empty()); + assert!(Rect::new(Point2D::new(10u32, 10u32), Size2D::new(0u32, 0u32)).is_empty()); + assert!(Rect::new(Point2D::new(10u32, 10u32), Size2D::new(10u32, 0u32)).is_empty()); + assert!(Rect::new(Point2D::new(10u32, 10u32), Size2D::new(0u32, 10u32)).is_empty()); + assert!(!Rect::new(Point2D::new(10u32, 10u32), Size2D::new(1u32, 1u32)).is_empty()); + } + + #[test] + fn test_round() { + let mut x = -2.0; + let mut y = -2.0; + let mut w = -2.0; + let mut h = -2.0; + while x < 2.0 { + while y < 2.0 { + while w < 2.0 { + while h < 2.0 { + let rect = Rect::new(Point2D::new(x, y), Size2D::new(w, h)); + + assert!(rect.contains_rect(&rect.round_in())); + assert!(rect.round_in().inflate(1.0, 1.0).contains_rect(&rect)); + + assert!(rect.round_out().contains_rect(&rect)); + assert!(rect.inflate(1.0, 1.0).contains_rect(&rect.round_out())); + + assert!(rect.inflate(1.0, 1.0).contains_rect(&rect.round())); + assert!(rect.round().inflate(1.0, 1.0).contains_rect(&rect)); + + h += 0.1; + } + w += 0.1; + } + y += 0.1; + } + x += 0.1 + } + } +} diff --git a/third_party/rust/euclid/src/scale_factor.rs b/third_party/rust/euclid/src/scale_factor.rs new file mode 100644 index 000000000000..bd0048868abb --- /dev/null +++ b/third_party/rust/euclid/src/scale_factor.rs @@ -0,0 +1,171 @@ +// Copyright 2014 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +//! A type-checked scaling factor between units. + +use num::One; + +use heapsize::HeapSizeOf; +use num_traits::NumCast; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use std::fmt; +use std::ops::{Add, Mul, Sub, Div}; +use std::marker::PhantomData; + +/// A scaling factor between two different units of measurement. +/// +/// This is effectively a type-safe float, intended to be used in combination with other types like +/// `length::Length` to enforce conversion between systems of measurement at compile time. +/// +/// `Src` and `Dst` represent the units before and after multiplying a value by a `ScaleFactor`. They +/// may be types without values, such as empty enums. For example: +/// +/// ```rust +/// use euclid::scale_factor::ScaleFactor; +/// use euclid::length::Length; +/// enum Mm {}; +/// enum Inch {}; +/// +/// let mm_per_inch: ScaleFactor = ScaleFactor::new(25.4); +/// +/// let one_foot: Length = Length::new(12.0); +/// let one_foot_in_mm: Length = one_foot * mm_per_inch; +/// ``` +#[derive(RustcDecodable, RustcEncodable)] +pub struct ScaleFactor(pub T, PhantomData<(Src, Dst)>); + +impl HeapSizeOf for ScaleFactor { + fn heap_size_of_children(&self) -> usize { + self.0.heap_size_of_children() + } +} + +impl Deserialize for ScaleFactor where T: Deserialize { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer { + Ok(ScaleFactor(try!(Deserialize::deserialize(deserializer)), PhantomData)) + } +} + +impl Serialize for ScaleFactor where T: Serialize { + fn serialize(&self, serializer: &mut S) -> Result<(),S::Error> where S: Serializer { + self.0.serialize(serializer) + } +} + +impl ScaleFactor { + pub fn new(x: T) -> ScaleFactor { + ScaleFactor(x, PhantomData) + } +} + +impl ScaleFactor { + pub fn get(&self) -> T { + self.0.clone() + } +} + +impl, Src, Dst> ScaleFactor { + /// The inverse ScaleFactor (1.0 / self). + pub fn inv(&self) -> ScaleFactor { + let one: T = One::one(); + ScaleFactor::new(one / self.get()) + } +} + +// scale0 * scale1 +impl, A, B, C> +Mul> for ScaleFactor { + type Output = ScaleFactor; + #[inline] + fn mul(self, other: ScaleFactor) -> ScaleFactor { + ScaleFactor::new(self.get() * other.get()) + } +} + +// scale0 + scale1 +impl, Src, Dst> Add for ScaleFactor { + type Output = ScaleFactor; + #[inline] + fn add(self, other: ScaleFactor) -> ScaleFactor { + ScaleFactor::new(self.get() + other.get()) + } +} + +// scale0 - scale1 +impl, Src, Dst> Sub for ScaleFactor { + type Output = ScaleFactor; + #[inline] + fn sub(self, other: ScaleFactor) -> ScaleFactor { + ScaleFactor::new(self.get() - other.get()) + } +} + +impl ScaleFactor { + /// Cast from one numeric representation to another, preserving the units. + pub fn cast(&self) -> Option> { + NumCast::from(self.get()).map(ScaleFactor::new) + } +} + +// FIXME: Switch to `derive(PartialEq, Clone)` after this Rust issue is fixed: +// https://github.com/mozilla/rust/issues/7671 + +impl PartialEq for ScaleFactor { + fn eq(&self, other: &ScaleFactor) -> bool { + self.0 == other.0 + } +} + +impl Clone for ScaleFactor { + fn clone(&self) -> ScaleFactor { + ScaleFactor::new(self.get()) + } +} + +impl Copy for ScaleFactor {} + +impl fmt::Debug for ScaleFactor { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.0.fmt(f) + } +} + +impl fmt::Display for ScaleFactor { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.0.fmt(f) + } +} + +#[cfg(test)] +mod tests { + use super::ScaleFactor; + + enum Inch {} + enum Cm {} + enum Mm {} + + #[test] + fn test_scale_factor() { + let mm_per_inch: ScaleFactor = ScaleFactor::new(25.4); + let cm_per_mm: ScaleFactor = ScaleFactor::new(0.1); + + let mm_per_cm: ScaleFactor = cm_per_mm.inv(); + assert_eq!(mm_per_cm.get(), 10.0); + + let cm_per_inch: ScaleFactor = mm_per_inch * cm_per_mm; + assert_eq!(cm_per_inch, ScaleFactor::new(2.54)); + + let a: ScaleFactor = ScaleFactor::new(2); + let b: ScaleFactor = ScaleFactor::new(3); + assert!(a != b); + assert_eq!(a, a.clone()); + assert_eq!(a.clone() + b.clone(), ScaleFactor::new(5)); + assert_eq!(a - b, ScaleFactor::new(-1)); + } +} diff --git a/third_party/rust/euclid/src/side_offsets.rs b/third_party/rust/euclid/src/side_offsets.rs new file mode 100644 index 000000000000..7a1a7487e2e7 --- /dev/null +++ b/third_party/rust/euclid/src/side_offsets.rs @@ -0,0 +1,283 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A group of side offsets, which correspond to top/left/bottom/right for borders, padding, +//! and margins in CSS. + +use super::UnknownUnit; +use length::Length; +use num::Zero; +use std::fmt; +use std::ops::Add; +use std::marker::PhantomData; + +#[cfg(feature = "unstable")] +use heapsize::HeapSizeOf; + +/// A group of side offsets, which correspond to top/left/bottom/right for borders, padding, +/// and margins in CSS, optionally tagged with a unit. +define_matrix! { + pub struct TypedSideOffsets2D { + pub top: T, + pub right: T, + pub bottom: T, + pub left: T, + } +} + +impl fmt::Debug for TypedSideOffsets2D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "({:?},{:?},{:?},{:?})", + self.top, self.right, self.bottom, self.left) + } +} + +/// The default side offset type with no unit. +pub type SideOffsets2D = TypedSideOffsets2D; + +impl TypedSideOffsets2D { + /// Constructor taking a scalar for each side. + pub fn new(top: T, right: T, bottom: T, left: T) -> TypedSideOffsets2D { + TypedSideOffsets2D { + top: top, + right: right, + bottom: bottom, + left: left, + _unit: PhantomData, + } + } + + /// Constructor taking a typed Length for each side. + pub fn from_lengths(top: Length, + right: Length, + bottom: Length, + left: Length) -> TypedSideOffsets2D { + TypedSideOffsets2D::new(top.0, right.0, bottom.0, left.0) + } + + /// Access self.top as a typed Length instead of a scalar value. + pub fn top_typed(&self) -> Length { Length::new(self.top) } + + /// Access self.right as a typed Length instead of a scalar value. + pub fn right_typed(&self) -> Length { Length::new(self.right) } + + /// Access self.bottom as a typed Length instead of a scalar value. + pub fn bottom_typed(&self) -> Length { Length::new(self.bottom) } + + /// Access self.left as a typed Length instead of a scalar value. + pub fn left_typed(&self) -> Length { Length::new(self.left) } + + /// Constructor setting the same value to all sides, taking a scalar value directly. + pub fn new_all_same(all: T) -> TypedSideOffsets2D { + TypedSideOffsets2D::new(all, all, all, all) + } + + /// Constructor setting the same value to all sides, taking a typed Length. + pub fn from_length_all_same(all: Length) -> TypedSideOffsets2D { + TypedSideOffsets2D::new_all_same(all.0) + } +} + +impl TypedSideOffsets2D where T: Add + Copy { + pub fn horizontal(&self) -> T { + self.left + self.right + } + + pub fn vertical(&self) -> T { + self.top + self.bottom + } + + pub fn horizontal_typed(&self) -> Length { + Length::new(self.horizontal()) + } + + pub fn vertical_typed(&self) -> Length { + Length::new(self.vertical()) + } +} + +impl Add for TypedSideOffsets2D where T : Copy + Add { + type Output = TypedSideOffsets2D; + fn add(self, other: TypedSideOffsets2D) -> TypedSideOffsets2D { + TypedSideOffsets2D::new( + self.top + other.top, + self.right + other.right, + self.bottom + other.bottom, + self.left + other.left, + ) + } +} + +impl TypedSideOffsets2D { + /// Constructor, setting all sides to zero. + pub fn zero() -> TypedSideOffsets2D { + TypedSideOffsets2D::new( + Zero::zero(), + Zero::zero(), + Zero::zero(), + Zero::zero(), + ) + } +} + +/// A SIMD enabled version of TypedSideOffsets2D specialized for i32. +#[cfg(feature = "unstable")] +#[derive(Clone, Copy, PartialEq)] +#[repr(simd)] +pub struct SideOffsets2DSimdI32 { + pub top: i32, + pub bottom: i32, + pub right: i32, + pub left: i32, +} + +#[cfg(feature = "unstable")] +impl HeapSizeOf for SideOffsets2DSimdI32 { + fn heap_size_of_children(&self) -> usize { 0 } +} + +#[cfg(feature = "unstable")] +impl SideOffsets2DSimdI32 { + #[inline] + pub fn new(top: i32, right: i32, bottom: i32, left: i32) -> SideOffsets2DSimdI32 { + SideOffsets2DSimdI32 { + top: top, + bottom: bottom, + right: right, + left: left, + } + } +} + +#[cfg(feature = "unstable")] +impl SideOffsets2DSimdI32 { + #[inline] + pub fn new_all_same(all: i32) -> SideOffsets2DSimdI32 { + SideOffsets2DSimdI32::new(all.clone(), all.clone(), all.clone(), all.clone()) + } +} + +#[cfg(feature = "unstable")] +impl SideOffsets2DSimdI32 { + #[inline] + pub fn horizontal(&self) -> i32 { + self.left + self.right + } + + #[inline] + pub fn vertical(&self) -> i32 { + self.top + self.bottom + } +} + +/*impl Add for SideOffsets2DSimdI32 { + type Output = SideOffsets2DSimdI32; + #[inline] + fn add(self, other: SideOffsets2DSimdI32) -> SideOffsets2DSimdI32 { + self + other // Use SIMD addition + } +}*/ + +#[cfg(feature = "unstable")] +impl SideOffsets2DSimdI32 { + #[inline] + pub fn zero() -> SideOffsets2DSimdI32 { + SideOffsets2DSimdI32 { + top: 0, + bottom: 0, + right: 0, + left: 0, + } + } + + #[cfg(not(target_arch = "x86_64"))] + #[inline] + pub fn is_zero(&self) -> bool { + self.top == 0 && self.right == 0 && self.bottom == 0 && self.left == 0 + } + + #[cfg(target_arch = "x86_64")] + #[inline] + pub fn is_zero(&self) -> bool { + let is_zero: bool; + unsafe { + asm! { + "ptest $1, $1 + setz $0" + : "=r"(is_zero) + : "x"(*self) + : + : "intel" + }; + } + is_zero + } +} + +#[cfg(feature = "unstable")] +#[cfg(test)] +mod tests { + use super::SideOffsets2DSimdI32; + + #[test] + fn test_is_zero() { + assert!(SideOffsets2DSimdI32::new_all_same(0).is_zero()); + assert!(!SideOffsets2DSimdI32::new_all_same(1).is_zero()); + assert!(!SideOffsets2DSimdI32::new(1, 0, 0, 0).is_zero()); + assert!(!SideOffsets2DSimdI32::new(0, 1, 0, 0).is_zero()); + assert!(!SideOffsets2DSimdI32::new(0, 0, 1, 0).is_zero()); + assert!(!SideOffsets2DSimdI32::new(0, 0, 0, 1).is_zero()); + } +} + +#[cfg(feature = "unstable")] +#[cfg(bench)] +mod bench { + use test::BenchHarness; + use std::num::Zero; + use rand::{XorShiftRng, Rng}; + use super::SideOffsets2DSimdI32; + + #[cfg(target_arch = "x86")] + #[cfg(target_arch = "x86_64")] + #[bench] + fn bench_naive_is_zero(bh: &mut BenchHarness) { + fn is_zero(x: &SideOffsets2DSimdI32) -> bool { + x.top.is_zero() && x.right.is_zero() && x.bottom.is_zero() && x.left.is_zero() + } + let mut rng = XorShiftRng::new().unwrap(); + bh.iter(|| is_zero(&rng.gen::())) + } + + #[bench] + fn bench_is_zero(bh: &mut BenchHarness) { + let mut rng = XorShiftRng::new().unwrap(); + bh.iter(|| rng.gen::().is_zero()) + } + + #[bench] + fn bench_naive_add(bh: &mut BenchHarness) { + fn add(x: &SideOffsets2DSimdI32, y: &SideOffsets2DSimdI32) -> SideOffsets2DSimdI32 { + SideOffsets2DSimdI32 { + top: x.top + y.top, + right: x.right + y.right, + bottom: x.bottom + y.bottom, + left: x.left + y.left, + } + } + let mut rng = XorShiftRng::new().unwrap(); + bh.iter(|| add(&rng.gen::(), &rng.gen::())) + } + + #[bench] + fn bench_add(bh: &mut BenchHarness) { + let mut rng = XorShiftRng::new().unwrap(); + bh.iter(|| rng.gen::() + rng.gen::()) + } +} diff --git a/third_party/rust/euclid/src/size.rs b/third_party/rust/euclid/src/size.rs new file mode 100644 index 000000000000..2f8979b1d874 --- /dev/null +++ b/third_party/rust/euclid/src/size.rs @@ -0,0 +1,276 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use super::UnknownUnit; +use length::Length; +use scale_factor::ScaleFactor; +use num::*; + +use num_traits::NumCast; +use std::fmt; +use std::ops::{Add, Div, Mul, Sub}; +use std::marker::PhantomData; + +/// A 2d size tagged with a unit. +define_matrix! { + #[derive(RustcDecodable, RustcEncodable)] + pub struct TypedSize2D { + pub width: T, + pub height: T, + } +} + +/// Default 2d size type with no unit. +/// +/// `Size2D` provides the same methods as `TypedSize2D`. +pub type Size2D = TypedSize2D; + +impl fmt::Debug for TypedSize2D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}×{:?}", self.width, self.height) + } +} + +impl fmt::Display for TypedSize2D { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "({}x{})", self.width, self.height) + } +} + +impl TypedSize2D { + /// Constructor taking scalar values. + pub fn new(width: T, height: T) -> TypedSize2D { + TypedSize2D { + width: width, + height: height, + _unit: PhantomData, + } + } +} + +impl TypedSize2D { + /// Constructor taking scalar stronlgy typed lengths. + pub fn from_lengths(width: Length, height: Length) -> TypedSize2D { + TypedSize2D::new(width.get(), height.get()) + } +} + +impl TypedSize2D { + /// Rounds each component to the nearest integer value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn round(&self) -> Self { + TypedSize2D::new(self.width.round(), self.height.round()) + } +} + +impl TypedSize2D { + /// Rounds each component to the smallest integer equal or greater than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn ceil(&self) -> Self { + TypedSize2D::new(self.height.ceil(), self.width.ceil()) + } +} + +impl TypedSize2D { + /// Rounds each component to the biggest integer equal or lower than the orginal value. + /// + /// This behavior is preserved for negative values (unlike the basic cast). + pub fn floor(&self) -> Self { + TypedSize2D::new(self.width.floor(), self.height.floor()) + } +} + +impl, U> Add for TypedSize2D { + type Output = TypedSize2D; + fn add(self, other: TypedSize2D) -> TypedSize2D { + TypedSize2D::new(self.width + other.width, self.height + other.height) + } +} + +impl, U> Sub for TypedSize2D { + type Output = TypedSize2D; + fn sub(self, other: TypedSize2D) -> TypedSize2D { + TypedSize2D::new(self.width - other.width, self.height - other.height) + } +} + +impl, U> TypedSize2D { + pub fn area(&self) -> U { self.width * self.height } +} + +impl TypedSize2D { + pub fn zero() -> TypedSize2D { + TypedSize2D::new( + Zero::zero(), + Zero::zero(), + ) + } +} + +impl Zero for TypedSize2D { + fn zero() -> TypedSize2D { + TypedSize2D::new( + Zero::zero(), + Zero::zero(), + ) + } +} + +impl, U> Mul for TypedSize2D { + type Output = TypedSize2D; + #[inline] + fn mul(self, scale: T) -> TypedSize2D { + TypedSize2D::new(self.width * scale, self.height * scale) + } +} + +impl, U> Div for TypedSize2D { + type Output = TypedSize2D; + #[inline] + fn div(self, scale: T) -> TypedSize2D { + TypedSize2D::new(self.width / scale, self.height / scale) + } +} + +impl, U1, U2> Mul> for TypedSize2D { + type Output = TypedSize2D; + #[inline] + fn mul(self, scale: ScaleFactor) -> TypedSize2D { + TypedSize2D::new(self.width * scale.get(), self.height * scale.get()) + } +} + +impl, U1, U2> Div> for TypedSize2D { + type Output = TypedSize2D; + #[inline] + fn div(self, scale: ScaleFactor) -> TypedSize2D { + TypedSize2D::new(self.width / scale.get(), self.height / scale.get()) + } +} + +impl TypedSize2D { + /// Returns self.width as a Length carrying the unit. + #[inline] + pub fn width_typed(&self) -> Length { Length::new(self.width) } + + /// Returns self.height as a Length carrying the unit. + #[inline] + pub fn height_typed(&self) -> Length { Length::new(self.height) } + + #[inline] + pub fn to_array(&self) -> [T; 2] { [self.width, self.height] } + + /// Drop the units, preserving only the numeric value. + pub fn to_untyped(&self) -> Size2D { + TypedSize2D::new(self.width, self.height) + } + + /// Tag a unitless value with units. + pub fn from_untyped(p: &Size2D) -> TypedSize2D { + TypedSize2D::new(p.width, p.height) + } +} + +impl TypedSize2D { + /// Cast from one numeric representation to another, preserving the units. + /// + /// When casting from floating point to integer coordinates, the decimals are truncated + /// as one would expect from a simple cast, but this behavior does not always marke sense + /// geometrically. Consider using round(), ceil or floor() before casting. + pub fn cast(&self) -> Option> { + match (NumCast::from(self.width), NumCast::from(self.height)) { + (Some(w), Some(h)) => Some(TypedSize2D::new(w, h)), + _ => None + } + } + + // Convenience functions for common casts + + /// Cast into an f32 size. + pub fn to_f32(&self) -> TypedSize2D { + self.cast().unwrap() + } + + /// Cast into an usize size, truncating decimals if any. + /// + /// When casting from floating point sizes, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_uint(&self) -> TypedSize2D { + self.cast().unwrap() + } + + /// Cast into an i32 size, truncating decimals if any. + /// + /// When casting from floating point sizes, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i32(&self) -> TypedSize2D { + self.cast().unwrap() + } + + /// Cast into an i64 size, truncating decimals if any. + /// + /// When casting from floating point sizes, it is worth considering whether + /// to round(), ceil() or floor() before the cast in order to obtain the desired + /// conversion behavior. + pub fn to_i64(&self) -> TypedSize2D { + self.cast().unwrap() + } +} + +/// Shorthand for TypedSize2D::new(w, h). +pub fn size2(w: T, h: T) -> TypedSize2D { + TypedSize2D::new(w, h) +} + +#[cfg(test)] +mod size2d { + use super::Size2D; + + #[test] + pub fn test_add() { + let p1 = Size2D::new(1.0, 2.0); + let p2 = Size2D::new(3.0, 4.0); + assert_eq!(p1 + p2, Size2D::new(4.0, 6.0)); + + let p1 = Size2D::new(1.0, 2.0); + let p2 = Size2D::new(0.0, 0.0); + assert_eq!(p1 + p2, Size2D::new(1.0, 2.0)); + + let p1 = Size2D::new(1.0, 2.0); + let p2 = Size2D::new(-3.0, -4.0); + assert_eq!(p1 + p2, Size2D::new(-2.0, -2.0)); + + let p1 = Size2D::new(0.0, 0.0); + let p2 = Size2D::new(0.0, 0.0); + assert_eq!(p1 + p2, Size2D::new(0.0, 0.0)); + } + + #[test] + pub fn test_sub() { + let p1 = Size2D::new(1.0, 2.0); + let p2 = Size2D::new(3.0, 4.0); + assert_eq!(p1 - p2, Size2D::new(-2.0, -2.0)); + + let p1 = Size2D::new(1.0, 2.0); + let p2 = Size2D::new(0.0, 0.0); + assert_eq!(p1 - p2, Size2D::new(1.0, 2.0)); + + let p1 = Size2D::new(1.0, 2.0); + let p2 = Size2D::new(-3.0, -4.0); + assert_eq!(p1 - p2, Size2D::new(4.0, 6.0)); + + let p1 = Size2D::new(0.0, 0.0); + let p2 = Size2D::new(0.0, 0.0); + assert_eq!(p1 - p2, Size2D::new(0.0, 0.0)); + } +} diff --git a/third_party/rust/euclid/src/trig.rs b/third_party/rust/euclid/src/trig.rs new file mode 100644 index 000000000000..6f3f348a9b1a --- /dev/null +++ b/third_party/rust/euclid/src/trig.rs @@ -0,0 +1,50 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +/// Trait for basic trigonometry functions, so they can be used on generic numeric types +pub trait Trig { + fn sin(self) -> Self; + fn cos(self) -> Self; + fn tan(self) -> Self; +} + +impl Trig for f32 { + #[inline] + fn sin(self) -> f32 { + self.sin() + } + + #[inline] + fn cos(self) -> f32 { + self.cos() + } + + #[inline] + fn tan(self) -> f32 { + self.tan() + } +} + +impl Trig for f64 { + #[inline] + fn sin(self) -> f64 { + self.sin() + } + + #[inline] + fn cos(self) -> f64 { + self.cos() + } + + #[inline] + fn tan(self) -> f64 { + self.tan() + } +} diff --git a/third_party/rust/fnv/.cargo-checksum.json b/third_party/rust/fnv/.cargo-checksum.json new file mode 100644 index 000000000000..0d7d29945392 --- /dev/null +++ b/third_party/rust/fnv/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"29b74b95210896ce634c11a9037638668473b5a1b3b1716c505cb04dbb6341fa","Cargo.toml":"19864ecb948c0e7be14ead11068a2c689a4d31a684c85b6ad1bdf4a26d893516","README.md":"772c547b8e78764f07cc22f2294cb7c691cb20f30d459ed45a65c2434b1ca8a9","lib.rs":"2e2be31e9c90c9b2b0fe223f64f4b4bb24487e370e1cd2fbcce70d30f50fc452"},"package":"6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"} \ No newline at end of file diff --git a/third_party/rust/fnv/.cargo-ok b/third_party/rust/fnv/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/fnv/.gitignore b/third_party/rust/fnv/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/third_party/rust/fnv/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/third_party/rust/fnv/.travis.yml b/third_party/rust/fnv/.travis.yml new file mode 100644 index 000000000000..9c58f03c6661 --- /dev/null +++ b/third_party/rust/fnv/.travis.yml @@ -0,0 +1,8 @@ +language: rust +rust: + - nightly + - beta + - stable + +notifications: + webhooks: http://build.servo.org:54856/travis diff --git a/third_party/rust/fnv/Cargo.toml b/third_party/rust/fnv/Cargo.toml new file mode 100644 index 000000000000..c4011504898c --- /dev/null +++ b/third_party/rust/fnv/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "fnv" +version = "1.0.5" +authors = ["Alex Crichton "] +description = "Fowler–Noll–Vo hash function" +license = "Apache-2.0 / MIT" +readme = "README.md" +repository = "https://github.com/servo/rust-fnv" +documentation = "https://doc.servo.org/fnv/" + +[lib] +name = "fnv" +path = "lib.rs" diff --git a/third_party/rust/fnv/README.md b/third_party/rust/fnv/README.md new file mode 100644 index 000000000000..96001e22deb3 --- /dev/null +++ b/third_party/rust/fnv/README.md @@ -0,0 +1,81 @@ +# rust-fnv + +An implementation of the [Fowler–Noll–Vo hash function][chongo]. + +### [Read the documentation](https://doc.servo.org/fnv/) + + +## About + +The FNV hash function is a custom `Hasher` implementation that is more +efficient for smaller hash keys. + +[The Rust FAQ states that][faq] while the default `Hasher` implementation, +SipHash, is good in many cases, it is notably slower than other algorithms +with short keys, such as when you have a map of integers to other values. +In cases like these, [FNV is demonstrably faster][graphs]. + +Its disadvantages are that it performs badly on larger inputs, and +provides no protection against collision attacks, where a malicious user +can craft specific keys designed to slow a hasher down. Thus, it is +important to profile your program to ensure that you are using small hash +keys, and be certain that your program could not be exposed to malicious +inputs (including being a networked server). + +The Rust compiler itself uses FNV, as it is not worried about +denial-of-service attacks, and can assume that its inputs are going to be +small—a perfect use case for FNV. + + +## Usage + +To include this crate in your program, add the following to your `Cargo.toml`: + +```toml +[dependencies] +fnv = "1.0.3" +``` + + +## Using FNV in a HashMap + +The `FnvHashMap` type alias is the easiest way to use the standard library’s +`HashMap` with FNV. + +```rust +use fnv::FnvHashMap; + +let mut map = FnvHashMap::default(); +map.insert(1, "one"); +map.insert(2, "two"); + +map = FnvHashMap::with_capacity_and_hasher(10, Default::default()); +map.insert(1, "one"); +map.insert(2, "two"); +``` + +Note, the standard library’s `HashMap::new` and `HashMap::with_capacity` +are only implemented for the `RandomState` hasher, so using `Default` to +get the hasher is the next best option. + + +## Using FNV in a HashSet + +Similarly, `FnvHashSet` is a type alias for the standard library’s `HashSet` +with FNV. + +```rust +use fnv::FnvHashSet; + +let mut set = FnvHashSet::default(); +set.insert(1); +set.insert(2); + +set = FnvHashSet::with_capacity_and_hasher(10, Default::default()); +set.insert(1); +set.insert(2); +``` + +[chongo]: http://www.isthe.com/chongo/tech/comp/fnv/index.html +[faq]: https://www.rust-lang.org/faq.html#why-are-rusts-hashmaps-slow +[graphs]: http://cglab.ca/~abeinges/blah/hash-rs/ diff --git a/third_party/rust/fnv/lib.rs b/third_party/rust/fnv/lib.rs new file mode 100644 index 000000000000..1fc5d28c2000 --- /dev/null +++ b/third_party/rust/fnv/lib.rs @@ -0,0 +1,349 @@ +//! An implementation of the [Fowler–Noll–Vo hash function][chongo]. +//! +//! ## About +//! +//! The FNV hash function is a custom `Hasher` implementation that is more +//! efficient for smaller hash keys. +//! +//! [The Rust FAQ states that][faq] while the default `Hasher` implementation, +//! SipHash, is good in many cases, it is notably slower than other algorithms +//! with short keys, such as when you have a map of integers to other values. +//! In cases like these, [FNV is demonstrably faster][graphs]. +//! +//! Its disadvantages are that it performs badly on larger inputs, and +//! provides no protection against collision attacks, where a malicious user +//! can craft specific keys designed to slow a hasher down. Thus, it is +//! important to profile your program to ensure that you are using small hash +//! keys, and be certain that your program could not be exposed to malicious +//! inputs (including being a networked server). +//! +//! The Rust compiler itself uses FNV, as it is not worried about +//! denial-of-service attacks, and can assume that its inputs are going to be +//! small—a perfect use case for FNV. +//! +//! +//! ## Using FNV in a `HashMap` +//! +//! The `FnvHashMap` type alias is the easiest way to use the standard library’s +//! `HashMap` with FNV. +//! +//! ```rust +//! use fnv::FnvHashMap; +//! +//! let mut map = FnvHashMap::default(); +//! map.insert(1, "one"); +//! map.insert(2, "two"); +//! +//! map = FnvHashMap::with_capacity_and_hasher(10, Default::default()); +//! map.insert(1, "one"); +//! map.insert(2, "two"); +//! ``` +//! +//! Note, the standard library’s `HashMap::new` and `HashMap::with_capacity` +//! are only implemented for the `RandomState` hasher, so using `Default` to +//! get the hasher is the next best option. +//! +//! ## Using FNV in a `HashSet` +//! +//! Similarly, `FnvHashSet` is a type alias for the standard library’s `HashSet` +//! with FNV. +//! +//! ```rust +//! use fnv::FnvHashSet; +//! +//! let mut set = FnvHashSet::default(); +//! set.insert(1); +//! set.insert(2); +//! +//! set = FnvHashSet::with_capacity_and_hasher(10, Default::default()); +//! set.insert(1); +//! set.insert(2); +//! ``` +//! +//! [chongo]: http://www.isthe.com/chongo/tech/comp/fnv/index.html +//! [faq]: https://www.rust-lang.org/faq.html#why-are-rusts-hashmaps-slow +//! [graphs]: http://cglab.ca/~abeinges/blah/hash-rs/ + + +use std::default::Default; +use std::hash::{Hasher, BuildHasherDefault}; +use std::collections::{HashMap, HashSet}; + +/// An implementation of the Fowler–Noll–Vo hash function. +/// +/// See the [crate documentation](index.html) for more details. +#[allow(missing_copy_implementations)] +pub struct FnvHasher(u64); + +impl Default for FnvHasher { + + #[inline] + fn default() -> FnvHasher { + FnvHasher(0xcbf29ce484222325) + } +} + +impl FnvHasher { + /// Create an FNV hasher starting with a state corresponding + /// to the hash `key`. + #[inline] + pub fn with_key(key: u64) -> FnvHasher { + FnvHasher(key) + } +} + +impl Hasher for FnvHasher { + #[inline] + fn finish(&self) -> u64 { + self.0 + } + + #[inline] + fn write(&mut self, bytes: &[u8]) { + let FnvHasher(mut hash) = *self; + + for byte in bytes.iter() { + hash = hash ^ (*byte as u64); + hash = hash.wrapping_mul(0x100000001b3); + } + + *self = FnvHasher(hash); + } +} + +/// A builder for default FNV hashers. +pub type FnvBuildHasher = BuildHasherDefault; + +/// A `HashMap` using a default FNV hasher. +pub type FnvHashMap = HashMap; + +/// A `HashSet` using a default FNV hasher. +pub type FnvHashSet = HashSet; + + +#[cfg(test)] +mod test { + use super::*; + use std::hash::Hasher; + + fn fnv1a(bytes: &[u8]) -> u64 { + let mut hasher = FnvHasher::default(); + hasher.write(bytes); + hasher.finish() + } + + fn repeat_10(bytes: &[u8]) -> Vec { + (0..10).flat_map(|_| bytes.iter().cloned()).collect() + } + + fn repeat_500(bytes: &[u8]) -> Vec { + (0..500).flat_map(|_| bytes.iter().cloned()).collect() + } + + #[test] + fn basic_tests() { + assert_eq!(fnv1a(b""), 0xcbf29ce484222325); + assert_eq!(fnv1a(b"a"), 0xaf63dc4c8601ec8c); + assert_eq!(fnv1a(b"b"), 0xaf63df4c8601f1a5); + assert_eq!(fnv1a(b"c"), 0xaf63de4c8601eff2); + assert_eq!(fnv1a(b"d"), 0xaf63d94c8601e773); + assert_eq!(fnv1a(b"e"), 0xaf63d84c8601e5c0); + assert_eq!(fnv1a(b"f"), 0xaf63db4c8601ead9); + assert_eq!(fnv1a(b"fo"), 0x08985907b541d342); + assert_eq!(fnv1a(b"foo"), 0xdcb27518fed9d577); + assert_eq!(fnv1a(b"foob"), 0xdd120e790c2512af); + assert_eq!(fnv1a(b"fooba"), 0xcac165afa2fef40a); + assert_eq!(fnv1a(b"foobar"), 0x85944171f73967e8); + assert_eq!(fnv1a(b"\0"), 0xaf63bd4c8601b7df); + assert_eq!(fnv1a(b"a\0"), 0x089be207b544f1e4); + assert_eq!(fnv1a(b"b\0"), 0x08a61407b54d9b5f); + assert_eq!(fnv1a(b"c\0"), 0x08a2ae07b54ab836); + assert_eq!(fnv1a(b"d\0"), 0x0891b007b53c4869); + assert_eq!(fnv1a(b"e\0"), 0x088e4a07b5396540); + assert_eq!(fnv1a(b"f\0"), 0x08987c07b5420ebb); + assert_eq!(fnv1a(b"fo\0"), 0xdcb28a18fed9f926); + assert_eq!(fnv1a(b"foo\0"), 0xdd1270790c25b935); + assert_eq!(fnv1a(b"foob\0"), 0xcac146afa2febf5d); + assert_eq!(fnv1a(b"fooba\0"), 0x8593d371f738acfe); + assert_eq!(fnv1a(b"foobar\0"), 0x34531ca7168b8f38); + assert_eq!(fnv1a(b"ch"), 0x08a25607b54a22ae); + assert_eq!(fnv1a(b"cho"), 0xf5faf0190cf90df3); + assert_eq!(fnv1a(b"chon"), 0xf27397910b3221c7); + assert_eq!(fnv1a(b"chong"), 0x2c8c2b76062f22e0); + assert_eq!(fnv1a(b"chongo"), 0xe150688c8217b8fd); + assert_eq!(fnv1a(b"chongo "), 0xf35a83c10e4f1f87); + assert_eq!(fnv1a(b"chongo w"), 0xd1edd10b507344d0); + assert_eq!(fnv1a(b"chongo wa"), 0x2a5ee739b3ddb8c3); + assert_eq!(fnv1a(b"chongo was"), 0xdcfb970ca1c0d310); + assert_eq!(fnv1a(b"chongo was "), 0x4054da76daa6da90); + assert_eq!(fnv1a(b"chongo was h"), 0xf70a2ff589861368); + assert_eq!(fnv1a(b"chongo was he"), 0x4c628b38aed25f17); + assert_eq!(fnv1a(b"chongo was her"), 0x9dd1f6510f78189f); + assert_eq!(fnv1a(b"chongo was here"), 0xa3de85bd491270ce); + assert_eq!(fnv1a(b"chongo was here!"), 0x858e2fa32a55e61d); + assert_eq!(fnv1a(b"chongo was here!\n"), 0x46810940eff5f915); + assert_eq!(fnv1a(b"ch\0"), 0xf5fadd190cf8edaa); + assert_eq!(fnv1a(b"cho\0"), 0xf273ed910b32b3e9); + assert_eq!(fnv1a(b"chon\0"), 0x2c8c5276062f6525); + assert_eq!(fnv1a(b"chong\0"), 0xe150b98c821842a0); + assert_eq!(fnv1a(b"chongo\0"), 0xf35aa3c10e4f55e7); + assert_eq!(fnv1a(b"chongo \0"), 0xd1ed680b50729265); + assert_eq!(fnv1a(b"chongo w\0"), 0x2a5f0639b3dded70); + assert_eq!(fnv1a(b"chongo wa\0"), 0xdcfbaa0ca1c0f359); + assert_eq!(fnv1a(b"chongo was\0"), 0x4054ba76daa6a430); + assert_eq!(fnv1a(b"chongo was \0"), 0xf709c7f5898562b0); + assert_eq!(fnv1a(b"chongo was h\0"), 0x4c62e638aed2f9b8); + assert_eq!(fnv1a(b"chongo was he\0"), 0x9dd1a8510f779415); + assert_eq!(fnv1a(b"chongo was her\0"), 0xa3de2abd4911d62d); + assert_eq!(fnv1a(b"chongo was here\0"), 0x858e0ea32a55ae0a); + assert_eq!(fnv1a(b"chongo was here!\0"), 0x46810f40eff60347); + assert_eq!(fnv1a(b"chongo was here!\n\0"), 0xc33bce57bef63eaf); + assert_eq!(fnv1a(b"cu"), 0x08a24307b54a0265); + assert_eq!(fnv1a(b"cur"), 0xf5b9fd190cc18d15); + assert_eq!(fnv1a(b"curd"), 0x4c968290ace35703); + assert_eq!(fnv1a(b"curds"), 0x07174bd5c64d9350); + assert_eq!(fnv1a(b"curds "), 0x5a294c3ff5d18750); + assert_eq!(fnv1a(b"curds a"), 0x05b3c1aeb308b843); + assert_eq!(fnv1a(b"curds an"), 0xb92a48da37d0f477); + assert_eq!(fnv1a(b"curds and"), 0x73cdddccd80ebc49); + assert_eq!(fnv1a(b"curds and "), 0xd58c4c13210a266b); + assert_eq!(fnv1a(b"curds and w"), 0xe78b6081243ec194); + assert_eq!(fnv1a(b"curds and wh"), 0xb096f77096a39f34); + assert_eq!(fnv1a(b"curds and whe"), 0xb425c54ff807b6a3); + assert_eq!(fnv1a(b"curds and whey"), 0x23e520e2751bb46e); + assert_eq!(fnv1a(b"curds and whey\n"), 0x1a0b44ccfe1385ec); + assert_eq!(fnv1a(b"cu\0"), 0xf5ba4b190cc2119f); + assert_eq!(fnv1a(b"cur\0"), 0x4c962690ace2baaf); + assert_eq!(fnv1a(b"curd\0"), 0x0716ded5c64cda19); + assert_eq!(fnv1a(b"curds\0"), 0x5a292c3ff5d150f0); + assert_eq!(fnv1a(b"curds \0"), 0x05b3e0aeb308ecf0); + assert_eq!(fnv1a(b"curds a\0"), 0xb92a5eda37d119d9); + assert_eq!(fnv1a(b"curds an\0"), 0x73ce41ccd80f6635); + assert_eq!(fnv1a(b"curds and\0"), 0xd58c2c132109f00b); + assert_eq!(fnv1a(b"curds and \0"), 0xe78baf81243f47d1); + assert_eq!(fnv1a(b"curds and w\0"), 0xb0968f7096a2ee7c); + assert_eq!(fnv1a(b"curds and wh\0"), 0xb425a84ff807855c); + assert_eq!(fnv1a(b"curds and whe\0"), 0x23e4e9e2751b56f9); + assert_eq!(fnv1a(b"curds and whey\0"), 0x1a0b4eccfe1396ea); + assert_eq!(fnv1a(b"curds and whey\n\0"), 0x54abd453bb2c9004); + assert_eq!(fnv1a(b"hi"), 0x08ba5f07b55ec3da); + assert_eq!(fnv1a(b"hi\0"), 0x337354193006cb6e); + assert_eq!(fnv1a(b"hello"), 0xa430d84680aabd0b); + assert_eq!(fnv1a(b"hello\0"), 0xa9bc8acca21f39b1); + assert_eq!(fnv1a(b"\xff\x00\x00\x01"), 0x6961196491cc682d); + assert_eq!(fnv1a(b"\x01\x00\x00\xff"), 0xad2bb1774799dfe9); + assert_eq!(fnv1a(b"\xff\x00\x00\x02"), 0x6961166491cc6314); + assert_eq!(fnv1a(b"\x02\x00\x00\xff"), 0x8d1bb3904a3b1236); + assert_eq!(fnv1a(b"\xff\x00\x00\x03"), 0x6961176491cc64c7); + assert_eq!(fnv1a(b"\x03\x00\x00\xff"), 0xed205d87f40434c7); + assert_eq!(fnv1a(b"\xff\x00\x00\x04"), 0x6961146491cc5fae); + assert_eq!(fnv1a(b"\x04\x00\x00\xff"), 0xcd3baf5e44f8ad9c); + assert_eq!(fnv1a(b"\x40\x51\x4e\x44"), 0xe3b36596127cd6d8); + assert_eq!(fnv1a(b"\x44\x4e\x51\x40"), 0xf77f1072c8e8a646); + assert_eq!(fnv1a(b"\x40\x51\x4e\x4a"), 0xe3b36396127cd372); + assert_eq!(fnv1a(b"\x4a\x4e\x51\x40"), 0x6067dce9932ad458); + assert_eq!(fnv1a(b"\x40\x51\x4e\x54"), 0xe3b37596127cf208); + assert_eq!(fnv1a(b"\x54\x4e\x51\x40"), 0x4b7b10fa9fe83936); + assert_eq!(fnv1a(b"127.0.0.1"), 0xaabafe7104d914be); + assert_eq!(fnv1a(b"127.0.0.1\0"), 0xf4d3180b3cde3eda); + assert_eq!(fnv1a(b"127.0.0.2"), 0xaabafd7104d9130b); + assert_eq!(fnv1a(b"127.0.0.2\0"), 0xf4cfb20b3cdb5bb1); + assert_eq!(fnv1a(b"127.0.0.3"), 0xaabafc7104d91158); + assert_eq!(fnv1a(b"127.0.0.3\0"), 0xf4cc4c0b3cd87888); + assert_eq!(fnv1a(b"64.81.78.68"), 0xe729bac5d2a8d3a7); + assert_eq!(fnv1a(b"64.81.78.68\0"), 0x74bc0524f4dfa4c5); + assert_eq!(fnv1a(b"64.81.78.74"), 0xe72630c5d2a5b352); + assert_eq!(fnv1a(b"64.81.78.74\0"), 0x6b983224ef8fb456); + assert_eq!(fnv1a(b"64.81.78.84"), 0xe73042c5d2ae266d); + assert_eq!(fnv1a(b"64.81.78.84\0"), 0x8527e324fdeb4b37); + assert_eq!(fnv1a(b"feedface"), 0x0a83c86fee952abc); + assert_eq!(fnv1a(b"feedface\0"), 0x7318523267779d74); + assert_eq!(fnv1a(b"feedfacedaffdeed"), 0x3e66d3d56b8caca1); + assert_eq!(fnv1a(b"feedfacedaffdeed\0"), 0x956694a5c0095593); + assert_eq!(fnv1a(b"feedfacedeadbeef"), 0xcac54572bb1a6fc8); + assert_eq!(fnv1a(b"feedfacedeadbeef\0"), 0xa7a4c9f3edebf0d8); + assert_eq!(fnv1a(b"line 1\nline 2\nline 3"), 0x7829851fac17b143); + assert_eq!(fnv1a(b"chongo /\\../\\"), 0x2c8f4c9af81bcf06); + assert_eq!(fnv1a(b"chongo /\\../\\\0"), 0xd34e31539740c732); + assert_eq!(fnv1a(b"chongo (Landon Curt Noll) /\\../\\"), 0x3605a2ac253d2db1); + assert_eq!(fnv1a(b"chongo (Landon Curt Noll) /\\../\\\0"), 0x08c11b8346f4a3c3); + assert_eq!(fnv1a(b"http://antwrp.gsfc.nasa.gov/apod/astropix.html"), 0x6be396289ce8a6da); + assert_eq!(fnv1a(b"http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash"), 0xd9b957fb7fe794c5); + assert_eq!(fnv1a(b"http://epod.usra.edu/"), 0x05be33da04560a93); + assert_eq!(fnv1a(b"http://exoplanet.eu/"), 0x0957f1577ba9747c); + assert_eq!(fnv1a(b"http://hvo.wr.usgs.gov/cam3/"), 0xda2cc3acc24fba57); + assert_eq!(fnv1a(b"http://hvo.wr.usgs.gov/cams/HMcam/"), 0x74136f185b29e7f0); + assert_eq!(fnv1a(b"http://hvo.wr.usgs.gov/kilauea/update/deformation.html"), 0xb2f2b4590edb93b2); + assert_eq!(fnv1a(b"http://hvo.wr.usgs.gov/kilauea/update/images.html"), 0xb3608fce8b86ae04); + assert_eq!(fnv1a(b"http://hvo.wr.usgs.gov/kilauea/update/maps.html"), 0x4a3a865079359063); + assert_eq!(fnv1a(b"http://hvo.wr.usgs.gov/volcanowatch/current_issue.html"), 0x5b3a7ef496880a50); + assert_eq!(fnv1a(b"http://neo.jpl.nasa.gov/risk/"), 0x48fae3163854c23b); + assert_eq!(fnv1a(b"http://norvig.com/21-days.html"), 0x07aaa640476e0b9a); + assert_eq!(fnv1a(b"http://primes.utm.edu/curios/home.php"), 0x2f653656383a687d); + assert_eq!(fnv1a(b"http://slashdot.org/"), 0xa1031f8e7599d79c); + assert_eq!(fnv1a(b"http://tux.wr.usgs.gov/Maps/155.25-19.5.html"), 0xa31908178ff92477); + assert_eq!(fnv1a(b"http://volcano.wr.usgs.gov/kilaueastatus.php"), 0x097edf3c14c3fb83); + assert_eq!(fnv1a(b"http://www.avo.alaska.edu/activity/Redoubt.php"), 0xb51ca83feaa0971b); + assert_eq!(fnv1a(b"http://www.dilbert.com/fast/"), 0xdd3c0d96d784f2e9); + assert_eq!(fnv1a(b"http://www.fourmilab.ch/gravitation/orbits/"), 0x86cd26a9ea767d78); + assert_eq!(fnv1a(b"http://www.fpoa.net/"), 0xe6b215ff54a30c18); + assert_eq!(fnv1a(b"http://www.ioccc.org/index.html"), 0xec5b06a1c5531093); + assert_eq!(fnv1a(b"http://www.isthe.com/cgi-bin/number.cgi"), 0x45665a929f9ec5e5); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/bio.html"), 0x8c7609b4a9f10907); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/index.html"), 0x89aac3a491f0d729); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/src/calc/lucas-calc"), 0x32ce6b26e0f4a403); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/astro/venus2004.html"), 0x614ab44e02b53e01); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/astro/vita.html"), 0xfa6472eb6eef3290); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/comp/c/expert.html"), 0x9e5d75eb1948eb6a); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/comp/calc/index.html"), 0xb6d12ad4a8671852); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/comp/fnv/index.html"), 0x88826f56eba07af1); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/math/number/howhigh.html"), 0x44535bf2645bc0fd); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/math/number/number.html"), 0x169388ffc21e3728); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/math/prime/mersenne.html"), 0xf68aac9e396d8224); + assert_eq!(fnv1a(b"http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest"), 0x8e87d7e7472b3883); + assert_eq!(fnv1a(b"http://www.lavarnd.org/cgi-bin/corpspeak.cgi"), 0x295c26caa8b423de); + assert_eq!(fnv1a(b"http://www.lavarnd.org/cgi-bin/haiku.cgi"), 0x322c814292e72176); + assert_eq!(fnv1a(b"http://www.lavarnd.org/cgi-bin/rand-none.cgi"), 0x8a06550eb8af7268); + assert_eq!(fnv1a(b"http://www.lavarnd.org/cgi-bin/randdist.cgi"), 0xef86d60e661bcf71); + assert_eq!(fnv1a(b"http://www.lavarnd.org/index.html"), 0x9e5426c87f30ee54); + assert_eq!(fnv1a(b"http://www.lavarnd.org/what/nist-test.html"), 0xf1ea8aa826fd047e); + assert_eq!(fnv1a(b"http://www.macosxhints.com/"), 0x0babaf9a642cb769); + assert_eq!(fnv1a(b"http://www.mellis.com/"), 0x4b3341d4068d012e); + assert_eq!(fnv1a(b"http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm"), 0xd15605cbc30a335c); + assert_eq!(fnv1a(b"http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm"), 0x5b21060aed8412e5); + assert_eq!(fnv1a(b"http://www.paulnoll.com/"), 0x45e2cda1ce6f4227); + assert_eq!(fnv1a(b"http://www.pepysdiary.com/"), 0x50ae3745033ad7d4); + assert_eq!(fnv1a(b"http://www.sciencenews.org/index/home/activity/view"), 0xaa4588ced46bf414); + assert_eq!(fnv1a(b"http://www.skyandtelescope.com/"), 0xc1b0056c4a95467e); + assert_eq!(fnv1a(b"http://www.sput.nl/~rob/sirius.html"), 0x56576a71de8b4089); + assert_eq!(fnv1a(b"http://www.systemexperts.com/"), 0xbf20965fa6dc927e); + assert_eq!(fnv1a(b"http://www.tq-international.com/phpBB3/index.php"), 0x569f8383c2040882); + assert_eq!(fnv1a(b"http://www.travelquesttours.com/index.htm"), 0xe1e772fba08feca0); + assert_eq!(fnv1a(b"http://www.wunderground.com/global/stations/89606.html"), 0x4ced94af97138ac4); + assert_eq!(fnv1a(&repeat_10(b"21701")), 0xc4112ffb337a82fb); + assert_eq!(fnv1a(&repeat_10(b"M21701")), 0xd64a4fd41de38b7d); + assert_eq!(fnv1a(&repeat_10(b"2^21701-1")), 0x4cfc32329edebcbb); + assert_eq!(fnv1a(&repeat_10(b"\x54\xc5")), 0x0803564445050395); + assert_eq!(fnv1a(&repeat_10(b"\xc5\x54")), 0xaa1574ecf4642ffd); + assert_eq!(fnv1a(&repeat_10(b"23209")), 0x694bc4e54cc315f9); + assert_eq!(fnv1a(&repeat_10(b"M23209")), 0xa3d7cb273b011721); + assert_eq!(fnv1a(&repeat_10(b"2^23209-1")), 0x577c2f8b6115bfa5); + assert_eq!(fnv1a(&repeat_10(b"\x5a\xa9")), 0xb7ec8c1a769fb4c1); + assert_eq!(fnv1a(&repeat_10(b"\xa9\x5a")), 0x5d5cfce63359ab19); + assert_eq!(fnv1a(&repeat_10(b"391581216093")), 0x33b96c3cd65b5f71); + assert_eq!(fnv1a(&repeat_10(b"391581*2^216093-1")), 0xd845097780602bb9); + assert_eq!(fnv1a(&repeat_10(b"\x05\xf9\x9d\x03\x4c\x81")), 0x84d47645d02da3d5); + assert_eq!(fnv1a(&repeat_10(b"FEDCBA9876543210")), 0x83544f33b58773a5); + assert_eq!(fnv1a(&repeat_10(b"\xfe\xdc\xba\x98\x76\x54\x32\x10")), 0x9175cbb2160836c5); + assert_eq!(fnv1a(&repeat_10(b"EFCDAB8967452301")), 0xc71b3bc175e72bc5); + assert_eq!(fnv1a(&repeat_10(b"\xef\xcd\xab\x89\x67\x45\x23\x01")), 0x636806ac222ec985); + assert_eq!(fnv1a(&repeat_10(b"0123456789ABCDEF")), 0xb6ef0e6950f52ed5); + assert_eq!(fnv1a(&repeat_10(b"\x01\x23\x45\x67\x89\xab\xcd\xef")), 0xead3d8a0f3dfdaa5); + assert_eq!(fnv1a(&repeat_10(b"1032547698BADCFE")), 0x922908fe9a861ba5); + assert_eq!(fnv1a(&repeat_10(b"\x10\x32\x54\x76\x98\xba\xdc\xfe")), 0x6d4821de275fd5c5); + assert_eq!(fnv1a(&repeat_500(b"\x00")), 0x1fe3fce62bd816b5); + assert_eq!(fnv1a(&repeat_500(b"\x07")), 0xc23e9fccd6f70591); + assert_eq!(fnv1a(&repeat_500(b"~")), 0xc1af12bdfe16b5b5); + assert_eq!(fnv1a(&repeat_500(b"\x7f")), 0x39e9f18f2f85e221); + } +} diff --git a/third_party/rust/freetype/.cargo-checksum.json b/third_party/rust/freetype/.cargo-checksum.json new file mode 100644 index 000000000000..17b7b3737a66 --- /dev/null +++ b/third_party/rust/freetype/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"13342ffa9256624fdc9d3a0323c8d454e42648391683e844a58f752f48925c8c",".travis.yml":"b66e958a27e280a79ae1742be91e02cbaf7392851d430f19b13f3619861860e2","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"7d09decba6c94743746eb13ebd51735356ec6a1125d33da708d3e141148c81c3","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","Makefile.in":"7348b5f8a577048279b3f98e2c2b5705f506cf5b4b1e6bb542cc0b1e62468411","README.md":"755e885eb12f7b0b459c8b579f20cd941e55f0197b947591131daf048c5d7bc6","configure":"e0e6ba778e5f5784fa87abf235aa4f3da750d922bfb26a34803d9674577d56ec","etc/bindgen.sh":"116938e8c7a4500e056f719c66bdc896739c8b0a34a16e6a29a9e335f7458648","etc/bindings.h":"f6110c7a692e24f9c6d1c4a78ba8a7750952b397b86a5ac466353c7c57cfb7bb","src/freetype.rs":"0e27e13cca4f79569718fa4c247b8f7020388d8a84ad5f971c376a0658073cfa","src/lib.rs":"812e79af46e33a93420c8301ad95392f5e8a57266b3e43c47085c6dd0c63653f","src/tt_os2.rs":"9517c53fc4e575ceb615d554dc72812dcbb532bf94883d51202b24caae1a1418"},"package":"fde23272c687e4570aefec06cb71174ec0f5284b725deac4e77ba2665d635faf"} \ No newline at end of file diff --git a/third_party/rust/freetype/.cargo-ok b/third_party/rust/freetype/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/freetype/.gitignore b/third_party/rust/freetype/.gitignore new file mode 100644 index 000000000000..945c94a57a41 --- /dev/null +++ b/third_party/rust/freetype/.gitignore @@ -0,0 +1,7 @@ +*.dummy +*.rlib +*.so +Makefile +/doc +/target +/Cargo.lock diff --git a/third_party/rust/freetype/.travis.yml b/third_party/rust/freetype/.travis.yml new file mode 100644 index 000000000000..17626741eff3 --- /dev/null +++ b/third_party/rust/freetype/.travis.yml @@ -0,0 +1,14 @@ +language: rust +sudo: false + +rust: + - stable + - beta + - nightly + +script: + - cargo build + - cargo test + +notifications: + webhooks: http://build.servo.org:54856/travis diff --git a/third_party/rust/freetype/COPYRIGHT b/third_party/rust/freetype/COPYRIGHT new file mode 100644 index 000000000000..8b7291ad281c --- /dev/null +++ b/third_party/rust/freetype/COPYRIGHT @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 or the MIT license +, at your +option. All files in the project carrying such notice may not be +copied, modified, or distributed except according to those terms. diff --git a/third_party/rust/freetype/Cargo.toml b/third_party/rust/freetype/Cargo.toml new file mode 100644 index 000000000000..0c4db38fe89f --- /dev/null +++ b/third_party/rust/freetype/Cargo.toml @@ -0,0 +1,19 @@ +[package] +description = "Bindings for Freetype used by Servo" +license = "Apache-2.0 / MIT" +name = "freetype" +version = "0.2.0" +authors = ["The Servo Project Developers"] +documentation = "http://doc.servo.org/freetype/" +repository = "https://github.com/servo/rust-freetype" + +[features] +default = ["servo-freetype-sys"] + +[lib] +name = "freetype" +crate-type = ["rlib"] + +[dependencies] +servo-freetype-sys = { version = "4.0.2", optional = true } +libc = "0.2" diff --git a/third_party/rust/freetype/LICENSE-APACHE b/third_party/rust/freetype/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/freetype/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/freetype/LICENSE-MIT b/third_party/rust/freetype/LICENSE-MIT new file mode 100644 index 000000000000..807526f57f3a --- /dev/null +++ b/third_party/rust/freetype/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2012-2013 Mozilla Foundation + +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. diff --git a/third_party/rust/freetype/Makefile.in b/third_party/rust/freetype/Makefile.in new file mode 100644 index 000000000000..422283553af4 --- /dev/null +++ b/third_party/rust/freetype/Makefile.in @@ -0,0 +1,37 @@ +VPATH=%VPATH% + +RUSTC ?= rustc +RUSTFLAGS ?= +EXT_DEPS ?= +RUSTDOC ?= rustdoc +RUSTDOC_FLAGS ?= +RUSTDOC_TARGET ?= doc + +ifeq ($(CFG_OSTYPE),linux-androideabi) +RUSTFLAGS += -L./../../android/libfreetype2/.libs +endif + +RUST_SRC=$(shell find $(VPATH)/src -type f -name '*.rs') + +.PHONY: all clean +all: libfreetype-servo.dummy + +libfreetype-servo.dummy: src/lib.rs $(RUST_SRC) $(EXT_DEPS) + $(RUSTC) $(RUSTFLAGS) $< --out-dir . -C extra-filename=-servo + touch $@ + +freetype-test: src/lib.rs $(RUST_SRC) + $(RUSTC) $(RUSTFLAGS) $< -o $@ --test + +check: freetype-test + ./freetype-test + +.PHONY: doc +doc: $(RUSTDOC_TARGET)/freetype/index.html + +$(RUSTDOC_TARGET)/freetype/index.html: src/lib.rs $(RUST_SRC) $(EXT_DEPS) + $(RUSTDOC) $(RUSTDOC_FLAGS) $< -o $(RUSTDOC_TARGET) + +clean: + rm -f *.o *.a *.so *.dylib *.rlib *.dll *.dummy *-test + diff --git a/third_party/rust/freetype/README.md b/third_party/rust/freetype/README.md new file mode 100644 index 000000000000..e2dd1259b284 --- /dev/null +++ b/third_party/rust/freetype/README.md @@ -0,0 +1,3 @@ +# rust-freetype + +[Documentation](http://doc.servo.org/freetype/) diff --git a/third_party/rust/freetype/configure b/third_party/rust/freetype/configure new file mode 100755 index 000000000000..ed6c06e04d86 --- /dev/null +++ b/third_party/rust/freetype/configure @@ -0,0 +1,5 @@ +#!/bin/bash + +SRCDIR="$(cd $(dirname $0) && pwd)" +sed "s#%VPATH%#${SRCDIR}#" ${SRCDIR}/Makefile.in > Makefile + diff --git a/third_party/rust/freetype/etc/bindgen.sh b/third_party/rust/freetype/etc/bindgen.sh new file mode 100755 index 000000000000..9cce64708223 --- /dev/null +++ b/third_party/rust/freetype/etc/bindgen.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +cd "$(dirname $0)" + +# We replace the FT_ integer types of known widths, since we can do better. +# +# We blacklist FT_Error and import our own in order to have convenience methods +# on it instead of being a plain integer. +"${BINDGEN}" bindings.h -o ../src/freetype.rs \ + --no-unstable-rust \ + --blacklist-type "FT_(Int16|UInt16|Int32|UInt32|Int16|Int64|UInt64)" \ + --raw-line "pub type FT_Int16 = i16;" \ + --raw-line "pub type FT_UInt16 = u16;" \ + --raw-line "pub type FT_Int32 = i32;" \ + --raw-line "pub type FT_UInt32 = u32;" \ + --raw-line "pub type FT_Int64= i64;" \ + --raw-line "pub type FT_UInt64= u64;" \ + --blacklist-type "FT_Error" \ + --raw-line "pub use FT_Error;" \ + --generate=functions,types,vars \ + --whitelist-function="FT_.*" \ + --whitelist-type="FT_.*" \ + --whitelist-var="FT_.*" \ + -- -I/usr/include/freetype2 diff --git a/third_party/rust/freetype/etc/bindings.h b/third_party/rust/freetype/etc/bindings.h new file mode 100644 index 000000000000..5308bbc1a2cd --- /dev/null +++ b/third_party/rust/freetype/etc/bindings.h @@ -0,0 +1,5 @@ +#include +#include +#include +#include +#include diff --git a/third_party/rust/freetype/src/freetype.rs b/third_party/rust/freetype/src/freetype.rs new file mode 100644 index 000000000000..232888e0c725 --- /dev/null +++ b/third_party/rust/freetype/src/freetype.rs @@ -0,0 +1,1562 @@ +/* automatically generated by rust-bindgen */ + +pub type FT_Int16 = i16; +pub type FT_UInt16 = u16; +pub type FT_Int32 = i32; +pub type FT_UInt32 = u32; +pub type FT_Int64= i64; +pub type FT_UInt64= u64; +pub use FT_Error; + +#[repr(C)] +pub struct __BindgenUnionField(::std::marker::PhantomData); +impl __BindgenUnionField { + #[inline] + pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) } + #[inline] + pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) } + #[inline] + pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) } +} +impl ::std::default::Default for __BindgenUnionField { + #[inline] + fn default() -> Self { Self::new() } +} +impl ::std::clone::Clone for __BindgenUnionField { + #[inline] + fn clone(&self) -> Self { Self::new() } +} +impl ::std::marker::Copy for __BindgenUnionField { } +impl ::std::fmt::Debug for __BindgenUnionField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fmt.write_str("__BindgenUnionField") + } +} +pub const FT_RENDER_POOL_SIZE: ::std::os::raw::c_uint = 16384; +pub const FT_MAX_MODULES: ::std::os::raw::c_uint = 32; +pub const FT_OUTLINE_NONE: ::std::os::raw::c_uint = 0; +pub const FT_OUTLINE_OWNER: ::std::os::raw::c_uint = 1; +pub const FT_OUTLINE_EVEN_ODD_FILL: ::std::os::raw::c_uint = 2; +pub const FT_OUTLINE_REVERSE_FILL: ::std::os::raw::c_uint = 4; +pub const FT_OUTLINE_IGNORE_DROPOUTS: ::std::os::raw::c_uint = 8; +pub const FT_OUTLINE_SMART_DROPOUTS: ::std::os::raw::c_uint = 16; +pub const FT_OUTLINE_INCLUDE_STUBS: ::std::os::raw::c_uint = 32; +pub const FT_OUTLINE_HIGH_PRECISION: ::std::os::raw::c_uint = 256; +pub const FT_OUTLINE_SINGLE_PASS: ::std::os::raw::c_uint = 512; +pub const FT_CURVE_TAG_ON: ::std::os::raw::c_uint = 1; +pub const FT_CURVE_TAG_CONIC: ::std::os::raw::c_uint = 0; +pub const FT_CURVE_TAG_CUBIC: ::std::os::raw::c_uint = 2; +pub const FT_CURVE_TAG_HAS_SCANMODE: ::std::os::raw::c_uint = 4; +pub const FT_CURVE_TAG_TOUCH_X: ::std::os::raw::c_uint = 8; +pub const FT_CURVE_TAG_TOUCH_Y: ::std::os::raw::c_uint = 16; +pub const FT_CURVE_TAG_TOUCH_BOTH: ::std::os::raw::c_uint = 24; +pub const FT_Curve_Tag_On: ::std::os::raw::c_uint = 1; +pub const FT_Curve_Tag_Conic: ::std::os::raw::c_uint = 0; +pub const FT_Curve_Tag_Cubic: ::std::os::raw::c_uint = 2; +pub const FT_Curve_Tag_Touch_X: ::std::os::raw::c_uint = 8; +pub const FT_Curve_Tag_Touch_Y: ::std::os::raw::c_uint = 16; +pub const FT_RASTER_FLAG_DEFAULT: ::std::os::raw::c_uint = 0; +pub const FT_RASTER_FLAG_AA: ::std::os::raw::c_uint = 1; +pub const FT_RASTER_FLAG_DIRECT: ::std::os::raw::c_uint = 2; +pub const FT_RASTER_FLAG_CLIP: ::std::os::raw::c_uint = 4; +pub const FT_ERR_BASE: ::std::os::raw::c_uint = 0; +pub const FT_FACE_FLAG_SCALABLE: ::std::os::raw::c_uint = 1; +pub const FT_FACE_FLAG_FIXED_SIZES: ::std::os::raw::c_uint = 2; +pub const FT_FACE_FLAG_FIXED_WIDTH: ::std::os::raw::c_uint = 4; +pub const FT_FACE_FLAG_SFNT: ::std::os::raw::c_uint = 8; +pub const FT_FACE_FLAG_HORIZONTAL: ::std::os::raw::c_uint = 16; +pub const FT_FACE_FLAG_VERTICAL: ::std::os::raw::c_uint = 32; +pub const FT_FACE_FLAG_KERNING: ::std::os::raw::c_uint = 64; +pub const FT_FACE_FLAG_FAST_GLYPHS: ::std::os::raw::c_uint = 128; +pub const FT_FACE_FLAG_MULTIPLE_MASTERS: ::std::os::raw::c_uint = 256; +pub const FT_FACE_FLAG_GLYPH_NAMES: ::std::os::raw::c_uint = 512; +pub const FT_FACE_FLAG_EXTERNAL_STREAM: ::std::os::raw::c_uint = 1024; +pub const FT_FACE_FLAG_HINTER: ::std::os::raw::c_uint = 2048; +pub const FT_FACE_FLAG_CID_KEYED: ::std::os::raw::c_uint = 4096; +pub const FT_FACE_FLAG_TRICKY: ::std::os::raw::c_uint = 8192; +pub const FT_FACE_FLAG_COLOR: ::std::os::raw::c_uint = 16384; +pub const FT_STYLE_FLAG_ITALIC: ::std::os::raw::c_uint = 1; +pub const FT_STYLE_FLAG_BOLD: ::std::os::raw::c_uint = 2; +pub const FT_OPEN_MEMORY: ::std::os::raw::c_uint = 1; +pub const FT_OPEN_STREAM: ::std::os::raw::c_uint = 2; +pub const FT_OPEN_PATHNAME: ::std::os::raw::c_uint = 4; +pub const FT_OPEN_DRIVER: ::std::os::raw::c_uint = 8; +pub const FT_OPEN_PARAMS: ::std::os::raw::c_uint = 16; +pub const FT_LOAD_DEFAULT: ::std::os::raw::c_uint = 0; +pub const FT_LOAD_NO_SCALE: ::std::os::raw::c_uint = 1; +pub const FT_LOAD_NO_HINTING: ::std::os::raw::c_uint = 2; +pub const FT_LOAD_RENDER: ::std::os::raw::c_uint = 4; +pub const FT_LOAD_NO_BITMAP: ::std::os::raw::c_uint = 8; +pub const FT_LOAD_VERTICAL_LAYOUT: ::std::os::raw::c_uint = 16; +pub const FT_LOAD_FORCE_AUTOHINT: ::std::os::raw::c_uint = 32; +pub const FT_LOAD_CROP_BITMAP: ::std::os::raw::c_uint = 64; +pub const FT_LOAD_PEDANTIC: ::std::os::raw::c_uint = 128; +pub const FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH: ::std::os::raw::c_uint = 512; +pub const FT_LOAD_NO_RECURSE: ::std::os::raw::c_uint = 1024; +pub const FT_LOAD_IGNORE_TRANSFORM: ::std::os::raw::c_uint = 2048; +pub const FT_LOAD_MONOCHROME: ::std::os::raw::c_uint = 4096; +pub const FT_LOAD_LINEAR_DESIGN: ::std::os::raw::c_uint = 8192; +pub const FT_LOAD_NO_AUTOHINT: ::std::os::raw::c_uint = 32768; +pub const FT_LOAD_COLOR: ::std::os::raw::c_uint = 1048576; +pub const FT_LOAD_COMPUTE_METRICS: ::std::os::raw::c_uint = 2097152; +pub const FT_LOAD_BITMAP_METRICS_ONLY: ::std::os::raw::c_uint = 4194304; +pub const FT_LOAD_ADVANCE_ONLY: ::std::os::raw::c_uint = 256; +pub const FT_LOAD_SBITS_ONLY: ::std::os::raw::c_uint = 16384; +pub const FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS: ::std::os::raw::c_uint = 1; +pub const FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES: ::std::os::raw::c_uint = 2; +pub const FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID: ::std::os::raw::c_uint = 4; +pub const FT_SUBGLYPH_FLAG_SCALE: ::std::os::raw::c_uint = 8; +pub const FT_SUBGLYPH_FLAG_XY_SCALE: ::std::os::raw::c_uint = 64; +pub const FT_SUBGLYPH_FLAG_2X2: ::std::os::raw::c_uint = 128; +pub const FT_SUBGLYPH_FLAG_USE_MY_METRICS: ::std::os::raw::c_uint = 512; +pub const FT_FSTYPE_INSTALLABLE_EMBEDDING: ::std::os::raw::c_uint = 0; +pub const FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING: ::std::os::raw::c_uint = 2; +pub const FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING: ::std::os::raw::c_uint = 4; +pub const FT_FSTYPE_EDITABLE_EMBEDDING: ::std::os::raw::c_uint = 8; +pub const FT_FSTYPE_NO_SUBSETTING: ::std::os::raw::c_uint = 256; +pub const FT_FSTYPE_BITMAP_EMBEDDING_ONLY: ::std::os::raw::c_uint = 512; +pub const FT_MODULE_FONT_DRIVER: ::std::os::raw::c_uint = 1; +pub const FT_MODULE_RENDERER: ::std::os::raw::c_uint = 2; +pub const FT_MODULE_HINTER: ::std::os::raw::c_uint = 4; +pub const FT_MODULE_STYLER: ::std::os::raw::c_uint = 8; +pub const FT_MODULE_DRIVER_SCALABLE: ::std::os::raw::c_uint = 256; +pub const FT_MODULE_DRIVER_NO_OUTLINES: ::std::os::raw::c_uint = 512; +pub const FT_MODULE_DRIVER_HAS_HINTER: ::std::os::raw::c_uint = 1024; +pub const FT_MODULE_DRIVER_HINTS_LIGHTLY: ::std::os::raw::c_uint = 2048; +pub type FT_Fast = ::std::os::raw::c_int; +pub type FT_UFast = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_MemoryRec_ { + pub user: *mut ::std::os::raw::c_void, + pub alloc: FT_Alloc_Func, + pub free: FT_Free_Func, + pub realloc: FT_Realloc_Func, +} +#[test] +fn bindgen_test_layout_FT_MemoryRec_() { + assert_eq!(::std::mem::size_of::() , 32usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_MemoryRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Memory = *mut FT_MemoryRec_; +pub type FT_Alloc_Func = + ::std::option::Option *mut ::std::os::raw::c_void>; +pub type FT_Free_Func = + ::std::option::Option; +pub type FT_Realloc_Func = + ::std::option::Option *mut ::std::os::raw::c_void>; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_StreamRec_ { + pub base: *mut ::std::os::raw::c_uchar, + pub size: ::std::os::raw::c_ulong, + pub pos: ::std::os::raw::c_ulong, + pub descriptor: FT_StreamDesc, + pub pathname: FT_StreamDesc, + pub read: FT_Stream_IoFunc, + pub close: FT_Stream_CloseFunc, + pub memory: FT_Memory, + pub cursor: *mut ::std::os::raw::c_uchar, + pub limit: *mut ::std::os::raw::c_uchar, +} +#[test] +fn bindgen_test_layout_FT_StreamRec_() { + assert_eq!(::std::mem::size_of::() , 80usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_StreamRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Stream = *mut FT_StreamRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_StreamDesc_ { + pub value: __BindgenUnionField<::std::os::raw::c_long>, + pub pointer: __BindgenUnionField<*mut ::std::os::raw::c_void>, + pub bindgen_union_field: u64, +} +#[test] +fn bindgen_test_layout_FT_StreamDesc_() { + assert_eq!(::std::mem::size_of::() , 8usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_StreamDesc_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_StreamDesc_ as FT_StreamDesc; +pub type FT_Stream_IoFunc = + ::std::option::Option ::std::os::raw::c_ulong>; +pub type FT_Stream_CloseFunc = + ::std::option::Option; +pub use self::FT_StreamRec_ as FT_StreamRec; +pub type FT_Pos = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Vector_ { + pub x: FT_Pos, + pub y: FT_Pos, +} +#[test] +fn bindgen_test_layout_FT_Vector_() { + assert_eq!(::std::mem::size_of::() , 16usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Vector_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Vector_ as FT_Vector; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_BBox_ { + pub xMin: FT_Pos, + pub yMin: FT_Pos, + pub xMax: FT_Pos, + pub yMax: FT_Pos, +} +#[test] +fn bindgen_test_layout_FT_BBox_() { + assert_eq!(::std::mem::size_of::() , 32usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_BBox_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_BBox_ as FT_BBox; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_Pixel_Mode_ { + FT_PIXEL_MODE_NONE = 0, + FT_PIXEL_MODE_MONO = 1, + FT_PIXEL_MODE_GRAY = 2, + FT_PIXEL_MODE_GRAY2 = 3, + FT_PIXEL_MODE_GRAY4 = 4, + FT_PIXEL_MODE_LCD = 5, + FT_PIXEL_MODE_LCD_V = 6, + FT_PIXEL_MODE_BGRA = 7, + FT_PIXEL_MODE_MAX = 8, +} +pub use self::FT_Pixel_Mode_ as FT_Pixel_Mode; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Bitmap_ { + pub rows: ::std::os::raw::c_uint, + pub width: ::std::os::raw::c_uint, + pub pitch: ::std::os::raw::c_int, + pub buffer: *mut ::std::os::raw::c_uchar, + pub num_grays: ::std::os::raw::c_ushort, + pub pixel_mode: ::std::os::raw::c_uchar, + pub palette_mode: ::std::os::raw::c_uchar, + pub palette: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_FT_Bitmap_() { + assert_eq!(::std::mem::size_of::() , 40usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Bitmap_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Bitmap_ as FT_Bitmap; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Outline_ { + pub n_contours: ::std::os::raw::c_short, + pub n_points: ::std::os::raw::c_short, + pub points: *mut FT_Vector, + pub tags: *mut ::std::os::raw::c_char, + pub contours: *mut ::std::os::raw::c_short, + pub flags: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_FT_Outline_() { + assert_eq!(::std::mem::size_of::() , 40usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Outline_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Outline_ as FT_Outline; +pub type FT_Outline_MoveToFunc = + ::std::option::Option ::std::os::raw::c_int>; +pub type FT_Outline_LineToFunc = + ::std::option::Option ::std::os::raw::c_int>; +pub type FT_Outline_ConicToFunc = + ::std::option::Option ::std::os::raw::c_int>; +pub type FT_Outline_CubicToFunc = + ::std::option::Option ::std::os::raw::c_int>; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Outline_Funcs_ { + pub move_to: FT_Outline_MoveToFunc, + pub line_to: FT_Outline_LineToFunc, + pub conic_to: FT_Outline_ConicToFunc, + pub cubic_to: FT_Outline_CubicToFunc, + pub shift: ::std::os::raw::c_int, + pub delta: FT_Pos, +} +#[test] +fn bindgen_test_layout_FT_Outline_Funcs_() { + assert_eq!(::std::mem::size_of::() , 48usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Outline_Funcs_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Outline_Funcs_ as FT_Outline_Funcs; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_Glyph_Format_ { + FT_GLYPH_FORMAT_NONE = 0, + FT_GLYPH_FORMAT_COMPOSITE = 1668246896, + FT_GLYPH_FORMAT_BITMAP = 1651078259, + FT_GLYPH_FORMAT_OUTLINE = 1869968492, + FT_GLYPH_FORMAT_PLOTTER = 1886154612, +} +pub use self::FT_Glyph_Format_ as FT_Glyph_Format; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_RasterRec_ { + pub _address: u8, +} +impl Clone for FT_RasterRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Raster = *mut FT_RasterRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Span_ { + pub x: ::std::os::raw::c_short, + pub len: ::std::os::raw::c_ushort, + pub coverage: ::std::os::raw::c_uchar, +} +#[test] +fn bindgen_test_layout_FT_Span_() { + assert_eq!(::std::mem::size_of::() , 6usize); + assert_eq!(::std::mem::align_of::() , 2usize); +} +impl Clone for FT_Span_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Span_ as FT_Span; +pub type FT_SpanFunc = + ::std::option::Option; +pub type FT_Raster_BitTest_Func = + ::std::option::Option ::std::os::raw::c_int>; +pub type FT_Raster_BitSet_Func = + ::std::option::Option; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Raster_Params_ { + pub target: *const FT_Bitmap, + pub source: *const ::std::os::raw::c_void, + pub flags: ::std::os::raw::c_int, + pub gray_spans: FT_SpanFunc, + pub black_spans: FT_SpanFunc, + pub bit_test: FT_Raster_BitTest_Func, + pub bit_set: FT_Raster_BitSet_Func, + pub user: *mut ::std::os::raw::c_void, + pub clip_box: FT_BBox, +} +#[test] +fn bindgen_test_layout_FT_Raster_Params_() { + assert_eq!(::std::mem::size_of::() , 96usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Raster_Params_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Raster_Params_ as FT_Raster_Params; +pub type FT_Raster_NewFunc = + ::std::option::Option ::std::os::raw::c_int>; +pub type FT_Raster_DoneFunc = + ::std::option::Option; +pub type FT_Raster_ResetFunc = + ::std::option::Option; +pub type FT_Raster_SetModeFunc = + ::std::option::Option ::std::os::raw::c_int>; +pub type FT_Raster_RenderFunc = + ::std::option::Option ::std::os::raw::c_int>; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Raster_Funcs_ { + pub glyph_format: FT_Glyph_Format, + pub raster_new: FT_Raster_NewFunc, + pub raster_reset: FT_Raster_ResetFunc, + pub raster_set_mode: FT_Raster_SetModeFunc, + pub raster_render: FT_Raster_RenderFunc, + pub raster_done: FT_Raster_DoneFunc, +} +#[test] +fn bindgen_test_layout_FT_Raster_Funcs_() { + assert_eq!(::std::mem::size_of::() , 48usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Raster_Funcs_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Raster_Funcs_ as FT_Raster_Funcs; +pub type FT_Bool = ::std::os::raw::c_uchar; +pub type FT_FWord = ::std::os::raw::c_short; +pub type FT_UFWord = ::std::os::raw::c_ushort; +pub type FT_Char = ::std::os::raw::c_char; +pub type FT_Byte = ::std::os::raw::c_uchar; +pub type FT_Bytes = *const FT_Byte; +pub type FT_Tag = FT_UInt32; +pub type FT_String = ::std::os::raw::c_char; +pub type FT_Short = ::std::os::raw::c_short; +pub type FT_UShort = ::std::os::raw::c_ushort; +pub type FT_Int = ::std::os::raw::c_int; +pub type FT_UInt = ::std::os::raw::c_uint; +pub type FT_Long = ::std::os::raw::c_long; +pub type FT_ULong = ::std::os::raw::c_ulong; +pub type FT_F2Dot14 = ::std::os::raw::c_short; +pub type FT_F26Dot6 = ::std::os::raw::c_long; +pub type FT_Fixed = ::std::os::raw::c_long; +pub type FT_Pointer = *mut ::std::os::raw::c_void; +pub type FT_Offset = usize; +pub type FT_PtrDist = isize; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_UnitVector_ { + pub x: FT_F2Dot14, + pub y: FT_F2Dot14, +} +#[test] +fn bindgen_test_layout_FT_UnitVector_() { + assert_eq!(::std::mem::size_of::() , 4usize); + assert_eq!(::std::mem::align_of::() , 2usize); +} +impl Clone for FT_UnitVector_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_UnitVector_ as FT_UnitVector; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Matrix_ { + pub xx: FT_Fixed, + pub xy: FT_Fixed, + pub yx: FT_Fixed, + pub yy: FT_Fixed, +} +#[test] +fn bindgen_test_layout_FT_Matrix_() { + assert_eq!(::std::mem::size_of::() , 32usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Matrix_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Matrix_ as FT_Matrix; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Data_ { + pub pointer: *const FT_Byte, + pub length: FT_Int, +} +#[test] +fn bindgen_test_layout_FT_Data_() { + assert_eq!(::std::mem::size_of::() , 16usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Data_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Data_ as FT_Data; +pub type FT_Generic_Finalizer = + ::std::option::Option; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Generic_ { + pub data: *mut ::std::os::raw::c_void, + pub finalizer: FT_Generic_Finalizer, +} +#[test] +fn bindgen_test_layout_FT_Generic_() { + assert_eq!(::std::mem::size_of::() , 16usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Generic_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Generic_ as FT_Generic; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_ListNodeRec_ { + pub prev: FT_ListNode, + pub next: FT_ListNode, + pub data: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_FT_ListNodeRec_() { + assert_eq!(::std::mem::size_of::() , 24usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_ListNodeRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_ListNode = *mut FT_ListNodeRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_ListRec_ { + pub head: FT_ListNode, + pub tail: FT_ListNode, +} +#[test] +fn bindgen_test_layout_FT_ListRec_() { + assert_eq!(::std::mem::size_of::() , 16usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_ListRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_List = *mut FT_ListRec_; +pub use self::FT_ListNodeRec_ as FT_ListNodeRec; +pub use self::FT_ListRec_ as FT_ListRec; +pub const FT_Mod_Err_Base: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Autofit: _bindgen_ty_19 = + _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_BDF: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Bzip2: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Cache: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_CFF: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_CID: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Gzip: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_LZW: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_OTvalid: _bindgen_ty_19 = + _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_PCF: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_PFR: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_PSaux: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_PShinter: _bindgen_ty_19 = + _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_PSnames: _bindgen_ty_19 = + _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Raster: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_SFNT: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Smooth: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_TrueType: _bindgen_ty_19 = + _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Type1: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Type42: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Winfonts: _bindgen_ty_19 = + _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_GXvalid: _bindgen_ty_19 = + _bindgen_ty_19::FT_Mod_Err_Base; +pub const FT_Mod_Err_Max: _bindgen_ty_19 = _bindgen_ty_19::FT_Mod_Err_Max; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum _bindgen_ty_19 { FT_Mod_Err_Base = 0, FT_Mod_Err_Max = 1, } +pub const FT_Err_Ok: _bindgen_ty_20 = _bindgen_ty_20::FT_Err_Ok; +pub const FT_Err_Cannot_Open_Resource: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Cannot_Open_Resource; +pub const FT_Err_Unknown_File_Format: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Unknown_File_Format; +pub const FT_Err_Invalid_File_Format: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_File_Format; +pub const FT_Err_Invalid_Version: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Version; +pub const FT_Err_Lower_Module_Version: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Lower_Module_Version; +pub const FT_Err_Invalid_Argument: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Argument; +pub const FT_Err_Unimplemented_Feature: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Unimplemented_Feature; +pub const FT_Err_Invalid_Table: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Table; +pub const FT_Err_Invalid_Offset: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Offset; +pub const FT_Err_Array_Too_Large: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Array_Too_Large; +pub const FT_Err_Missing_Module: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Module; +pub const FT_Err_Missing_Property: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Property; +pub const FT_Err_Invalid_Glyph_Index: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Glyph_Index; +pub const FT_Err_Invalid_Character_Code: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Character_Code; +pub const FT_Err_Invalid_Glyph_Format: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Glyph_Format; +pub const FT_Err_Cannot_Render_Glyph: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Cannot_Render_Glyph; +pub const FT_Err_Invalid_Outline: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Outline; +pub const FT_Err_Invalid_Composite: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Composite; +pub const FT_Err_Too_Many_Hints: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Too_Many_Hints; +pub const FT_Err_Invalid_Pixel_Size: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Pixel_Size; +pub const FT_Err_Invalid_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Handle; +pub const FT_Err_Invalid_Library_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Library_Handle; +pub const FT_Err_Invalid_Driver_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Driver_Handle; +pub const FT_Err_Invalid_Face_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Face_Handle; +pub const FT_Err_Invalid_Size_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Size_Handle; +pub const FT_Err_Invalid_Slot_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Slot_Handle; +pub const FT_Err_Invalid_CharMap_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_CharMap_Handle; +pub const FT_Err_Invalid_Cache_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Cache_Handle; +pub const FT_Err_Invalid_Stream_Handle: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Stream_Handle; +pub const FT_Err_Too_Many_Drivers: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Too_Many_Drivers; +pub const FT_Err_Too_Many_Extensions: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Too_Many_Extensions; +pub const FT_Err_Out_Of_Memory: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Out_Of_Memory; +pub const FT_Err_Unlisted_Object: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Unlisted_Object; +pub const FT_Err_Cannot_Open_Stream: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Cannot_Open_Stream; +pub const FT_Err_Invalid_Stream_Seek: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Stream_Seek; +pub const FT_Err_Invalid_Stream_Skip: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Stream_Skip; +pub const FT_Err_Invalid_Stream_Read: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Stream_Read; +pub const FT_Err_Invalid_Stream_Operation: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Stream_Operation; +pub const FT_Err_Invalid_Frame_Operation: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Frame_Operation; +pub const FT_Err_Nested_Frame_Access: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Nested_Frame_Access; +pub const FT_Err_Invalid_Frame_Read: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Frame_Read; +pub const FT_Err_Raster_Uninitialized: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Raster_Uninitialized; +pub const FT_Err_Raster_Corrupted: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Raster_Corrupted; +pub const FT_Err_Raster_Overflow: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Raster_Overflow; +pub const FT_Err_Raster_Negative_Height: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Raster_Negative_Height; +pub const FT_Err_Too_Many_Caches: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Too_Many_Caches; +pub const FT_Err_Invalid_Opcode: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Opcode; +pub const FT_Err_Too_Few_Arguments: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Too_Few_Arguments; +pub const FT_Err_Stack_Overflow: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Stack_Overflow; +pub const FT_Err_Code_Overflow: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Code_Overflow; +pub const FT_Err_Bad_Argument: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Bad_Argument; +pub const FT_Err_Divide_By_Zero: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Divide_By_Zero; +pub const FT_Err_Invalid_Reference: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Reference; +pub const FT_Err_Debug_OpCode: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Debug_OpCode; +pub const FT_Err_ENDF_In_Exec_Stream: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_ENDF_In_Exec_Stream; +pub const FT_Err_Nested_DEFS: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Nested_DEFS; +pub const FT_Err_Invalid_CodeRange: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_CodeRange; +pub const FT_Err_Execution_Too_Long: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Execution_Too_Long; +pub const FT_Err_Too_Many_Function_Defs: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Too_Many_Function_Defs; +pub const FT_Err_Too_Many_Instruction_Defs: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Too_Many_Instruction_Defs; +pub const FT_Err_Table_Missing: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Table_Missing; +pub const FT_Err_Horiz_Header_Missing: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Horiz_Header_Missing; +pub const FT_Err_Locations_Missing: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Locations_Missing; +pub const FT_Err_Name_Table_Missing: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Name_Table_Missing; +pub const FT_Err_CMap_Table_Missing: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_CMap_Table_Missing; +pub const FT_Err_Hmtx_Table_Missing: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Hmtx_Table_Missing; +pub const FT_Err_Post_Table_Missing: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Post_Table_Missing; +pub const FT_Err_Invalid_Horiz_Metrics: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Horiz_Metrics; +pub const FT_Err_Invalid_CharMap_Format: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_CharMap_Format; +pub const FT_Err_Invalid_PPem: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_PPem; +pub const FT_Err_Invalid_Vert_Metrics: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Vert_Metrics; +pub const FT_Err_Could_Not_Find_Context: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Could_Not_Find_Context; +pub const FT_Err_Invalid_Post_Table_Format: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Post_Table_Format; +pub const FT_Err_Invalid_Post_Table: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Invalid_Post_Table; +pub const FT_Err_Syntax_Error: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Syntax_Error; +pub const FT_Err_Stack_Underflow: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Stack_Underflow; +pub const FT_Err_Ignore: _bindgen_ty_20 = _bindgen_ty_20::FT_Err_Ignore; +pub const FT_Err_No_Unicode_Glyph_Name: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_No_Unicode_Glyph_Name; +pub const FT_Err_Glyph_Too_Big: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Glyph_Too_Big; +pub const FT_Err_Missing_Startfont_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Startfont_Field; +pub const FT_Err_Missing_Font_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Font_Field; +pub const FT_Err_Missing_Size_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Size_Field; +pub const FT_Err_Missing_Fontboundingbox_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Fontboundingbox_Field; +pub const FT_Err_Missing_Chars_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Chars_Field; +pub const FT_Err_Missing_Startchar_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Startchar_Field; +pub const FT_Err_Missing_Encoding_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Encoding_Field; +pub const FT_Err_Missing_Bbx_Field: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Missing_Bbx_Field; +pub const FT_Err_Bbx_Too_Big: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Bbx_Too_Big; +pub const FT_Err_Corrupted_Font_Header: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Corrupted_Font_Header; +pub const FT_Err_Corrupted_Font_Glyphs: _bindgen_ty_20 = + _bindgen_ty_20::FT_Err_Corrupted_Font_Glyphs; +pub const FT_Err_Max: _bindgen_ty_20 = _bindgen_ty_20::FT_Err_Max; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum _bindgen_ty_20 { + FT_Err_Ok = 0, + FT_Err_Cannot_Open_Resource = 1, + FT_Err_Unknown_File_Format = 2, + FT_Err_Invalid_File_Format = 3, + FT_Err_Invalid_Version = 4, + FT_Err_Lower_Module_Version = 5, + FT_Err_Invalid_Argument = 6, + FT_Err_Unimplemented_Feature = 7, + FT_Err_Invalid_Table = 8, + FT_Err_Invalid_Offset = 9, + FT_Err_Array_Too_Large = 10, + FT_Err_Missing_Module = 11, + FT_Err_Missing_Property = 12, + FT_Err_Invalid_Glyph_Index = 16, + FT_Err_Invalid_Character_Code = 17, + FT_Err_Invalid_Glyph_Format = 18, + FT_Err_Cannot_Render_Glyph = 19, + FT_Err_Invalid_Outline = 20, + FT_Err_Invalid_Composite = 21, + FT_Err_Too_Many_Hints = 22, + FT_Err_Invalid_Pixel_Size = 23, + FT_Err_Invalid_Handle = 32, + FT_Err_Invalid_Library_Handle = 33, + FT_Err_Invalid_Driver_Handle = 34, + FT_Err_Invalid_Face_Handle = 35, + FT_Err_Invalid_Size_Handle = 36, + FT_Err_Invalid_Slot_Handle = 37, + FT_Err_Invalid_CharMap_Handle = 38, + FT_Err_Invalid_Cache_Handle = 39, + FT_Err_Invalid_Stream_Handle = 40, + FT_Err_Too_Many_Drivers = 48, + FT_Err_Too_Many_Extensions = 49, + FT_Err_Out_Of_Memory = 64, + FT_Err_Unlisted_Object = 65, + FT_Err_Cannot_Open_Stream = 81, + FT_Err_Invalid_Stream_Seek = 82, + FT_Err_Invalid_Stream_Skip = 83, + FT_Err_Invalid_Stream_Read = 84, + FT_Err_Invalid_Stream_Operation = 85, + FT_Err_Invalid_Frame_Operation = 86, + FT_Err_Nested_Frame_Access = 87, + FT_Err_Invalid_Frame_Read = 88, + FT_Err_Raster_Uninitialized = 96, + FT_Err_Raster_Corrupted = 97, + FT_Err_Raster_Overflow = 98, + FT_Err_Raster_Negative_Height = 99, + FT_Err_Too_Many_Caches = 112, + FT_Err_Invalid_Opcode = 128, + FT_Err_Too_Few_Arguments = 129, + FT_Err_Stack_Overflow = 130, + FT_Err_Code_Overflow = 131, + FT_Err_Bad_Argument = 132, + FT_Err_Divide_By_Zero = 133, + FT_Err_Invalid_Reference = 134, + FT_Err_Debug_OpCode = 135, + FT_Err_ENDF_In_Exec_Stream = 136, + FT_Err_Nested_DEFS = 137, + FT_Err_Invalid_CodeRange = 138, + FT_Err_Execution_Too_Long = 139, + FT_Err_Too_Many_Function_Defs = 140, + FT_Err_Too_Many_Instruction_Defs = 141, + FT_Err_Table_Missing = 142, + FT_Err_Horiz_Header_Missing = 143, + FT_Err_Locations_Missing = 144, + FT_Err_Name_Table_Missing = 145, + FT_Err_CMap_Table_Missing = 146, + FT_Err_Hmtx_Table_Missing = 147, + FT_Err_Post_Table_Missing = 148, + FT_Err_Invalid_Horiz_Metrics = 149, + FT_Err_Invalid_CharMap_Format = 150, + FT_Err_Invalid_PPem = 151, + FT_Err_Invalid_Vert_Metrics = 152, + FT_Err_Could_Not_Find_Context = 153, + FT_Err_Invalid_Post_Table_Format = 154, + FT_Err_Invalid_Post_Table = 155, + FT_Err_Syntax_Error = 160, + FT_Err_Stack_Underflow = 161, + FT_Err_Ignore = 162, + FT_Err_No_Unicode_Glyph_Name = 163, + FT_Err_Glyph_Too_Big = 164, + FT_Err_Missing_Startfont_Field = 176, + FT_Err_Missing_Font_Field = 177, + FT_Err_Missing_Size_Field = 178, + FT_Err_Missing_Fontboundingbox_Field = 179, + FT_Err_Missing_Chars_Field = 180, + FT_Err_Missing_Startchar_Field = 181, + FT_Err_Missing_Encoding_Field = 182, + FT_Err_Missing_Bbx_Field = 183, + FT_Err_Bbx_Too_Big = 184, + FT_Err_Corrupted_Font_Header = 185, + FT_Err_Corrupted_Font_Glyphs = 186, + FT_Err_Max = 187, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Glyph_Metrics_ { + pub width: FT_Pos, + pub height: FT_Pos, + pub horiBearingX: FT_Pos, + pub horiBearingY: FT_Pos, + pub horiAdvance: FT_Pos, + pub vertBearingX: FT_Pos, + pub vertBearingY: FT_Pos, + pub vertAdvance: FT_Pos, +} +#[test] +fn bindgen_test_layout_FT_Glyph_Metrics_() { + assert_eq!(::std::mem::size_of::() , 64usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Glyph_Metrics_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Glyph_Metrics_ as FT_Glyph_Metrics; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Bitmap_Size_ { + pub height: FT_Short, + pub width: FT_Short, + pub size: FT_Pos, + pub x_ppem: FT_Pos, + pub y_ppem: FT_Pos, +} +#[test] +fn bindgen_test_layout_FT_Bitmap_Size_() { + assert_eq!(::std::mem::size_of::() , 32usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Bitmap_Size_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Bitmap_Size_ as FT_Bitmap_Size; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_LibraryRec_ { + pub _address: u8, +} +impl Clone for FT_LibraryRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Library = *mut FT_LibraryRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_ModuleRec_ { + pub _address: u8, +} +impl Clone for FT_ModuleRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Module = *mut FT_ModuleRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_DriverRec_ { + pub _address: u8, +} +impl Clone for FT_DriverRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Driver = *mut FT_DriverRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_RendererRec_ { + pub _address: u8, +} +impl Clone for FT_RendererRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Renderer = *mut FT_RendererRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_FaceRec_ { + pub num_faces: FT_Long, + pub face_index: FT_Long, + pub face_flags: FT_Long, + pub style_flags: FT_Long, + pub num_glyphs: FT_Long, + pub family_name: *mut FT_String, + pub style_name: *mut FT_String, + pub num_fixed_sizes: FT_Int, + pub available_sizes: *mut FT_Bitmap_Size, + pub num_charmaps: FT_Int, + pub charmaps: *mut FT_CharMap, + pub generic: FT_Generic, + pub bbox: FT_BBox, + pub units_per_EM: FT_UShort, + pub ascender: FT_Short, + pub descender: FT_Short, + pub height: FT_Short, + pub max_advance_width: FT_Short, + pub max_advance_height: FT_Short, + pub underline_position: FT_Short, + pub underline_thickness: FT_Short, + pub glyph: FT_GlyphSlot, + pub size: FT_Size, + pub charmap: FT_CharMap, + pub driver: FT_Driver, + pub memory: FT_Memory, + pub stream: FT_Stream, + pub sizes_list: FT_ListRec, + pub autohint: FT_Generic, + pub extensions: *mut ::std::os::raw::c_void, + pub internal: FT_Face_Internal, +} +#[test] +fn bindgen_test_layout_FT_FaceRec_() { + assert_eq!(::std::mem::size_of::() , 248usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_FaceRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Face = *mut FT_FaceRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_SizeRec_ { + pub face: FT_Face, + pub generic: FT_Generic, + pub metrics: FT_Size_Metrics, + pub internal: FT_Size_Internal, +} +#[test] +fn bindgen_test_layout_FT_SizeRec_() { + assert_eq!(::std::mem::size_of::() , 88usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_SizeRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Size = *mut FT_SizeRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_GlyphSlotRec_ { + pub library: FT_Library, + pub face: FT_Face, + pub next: FT_GlyphSlot, + pub reserved: FT_UInt, + pub generic: FT_Generic, + pub metrics: FT_Glyph_Metrics, + pub linearHoriAdvance: FT_Fixed, + pub linearVertAdvance: FT_Fixed, + pub advance: FT_Vector, + pub format: FT_Glyph_Format, + pub bitmap: FT_Bitmap, + pub bitmap_left: FT_Int, + pub bitmap_top: FT_Int, + pub outline: FT_Outline, + pub num_subglyphs: FT_UInt, + pub subglyphs: FT_SubGlyph, + pub control_data: *mut ::std::os::raw::c_void, + pub control_len: ::std::os::raw::c_long, + pub lsb_delta: FT_Pos, + pub rsb_delta: FT_Pos, + pub other: *mut ::std::os::raw::c_void, + pub internal: FT_Slot_Internal, +} +#[test] +fn bindgen_test_layout_FT_GlyphSlotRec_() { + assert_eq!(::std::mem::size_of::() , 304usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_GlyphSlotRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_GlyphSlot = *mut FT_GlyphSlotRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_CharMapRec_ { + pub face: FT_Face, + pub encoding: FT_Encoding, + pub platform_id: FT_UShort, + pub encoding_id: FT_UShort, +} +#[test] +fn bindgen_test_layout_FT_CharMapRec_() { + assert_eq!(::std::mem::size_of::() , 16usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_CharMapRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_CharMap = *mut FT_CharMapRec_; +pub const FT_Encoding__FT_ENCODING_MS_SJIS: FT_Encoding_ = + FT_Encoding_::FT_ENCODING_SJIS; +pub const FT_Encoding__FT_ENCODING_MS_GB2312: FT_Encoding_ = + FT_Encoding_::FT_ENCODING_GB2312; +pub const FT_Encoding__FT_ENCODING_MS_BIG5: FT_Encoding_ = + FT_Encoding_::FT_ENCODING_BIG5; +pub const FT_Encoding__FT_ENCODING_MS_WANSUNG: FT_Encoding_ = + FT_Encoding_::FT_ENCODING_WANSUNG; +pub const FT_Encoding__FT_ENCODING_MS_JOHAB: FT_Encoding_ = + FT_Encoding_::FT_ENCODING_JOHAB; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_Encoding_ { + FT_ENCODING_NONE = 0, + FT_ENCODING_MS_SYMBOL = 1937337698, + FT_ENCODING_UNICODE = 1970170211, + FT_ENCODING_SJIS = 1936353651, + FT_ENCODING_GB2312 = 1734484000, + FT_ENCODING_BIG5 = 1651074869, + FT_ENCODING_WANSUNG = 2002873971, + FT_ENCODING_JOHAB = 1785686113, + FT_ENCODING_ADOBE_STANDARD = 1094995778, + FT_ENCODING_ADOBE_EXPERT = 1094992453, + FT_ENCODING_ADOBE_CUSTOM = 1094992451, + FT_ENCODING_ADOBE_LATIN_1 = 1818326065, + FT_ENCODING_OLD_LATIN_2 = 1818326066, + FT_ENCODING_APPLE_ROMAN = 1634889070, +} +pub use self::FT_Encoding_ as FT_Encoding; +pub use self::FT_CharMapRec_ as FT_CharMapRec; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Face_InternalRec_ { + pub _address: u8, +} +impl Clone for FT_Face_InternalRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Face_Internal = *mut FT_Face_InternalRec_; +pub use self::FT_FaceRec_ as FT_FaceRec; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Size_InternalRec_ { + pub _address: u8, +} +impl Clone for FT_Size_InternalRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Size_Internal = *mut FT_Size_InternalRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Size_Metrics_ { + pub x_ppem: FT_UShort, + pub y_ppem: FT_UShort, + pub x_scale: FT_Fixed, + pub y_scale: FT_Fixed, + pub ascender: FT_Pos, + pub descender: FT_Pos, + pub height: FT_Pos, + pub max_advance: FT_Pos, +} +#[test] +fn bindgen_test_layout_FT_Size_Metrics_() { + assert_eq!(::std::mem::size_of::() , 56usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Size_Metrics_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Size_Metrics_ as FT_Size_Metrics; +pub use self::FT_SizeRec_ as FT_SizeRec; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_SubGlyphRec_ { + pub _address: u8, +} +impl Clone for FT_SubGlyphRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_SubGlyph = *mut FT_SubGlyphRec_; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Slot_InternalRec_ { + pub _address: u8, +} +impl Clone for FT_Slot_InternalRec_ { + fn clone(&self) -> Self { *self } +} +pub type FT_Slot_Internal = *mut FT_Slot_InternalRec_; +pub use self::FT_GlyphSlotRec_ as FT_GlyphSlotRec; +extern "C" { + pub fn FT_Init_FreeType(alibrary: *mut FT_Library) -> FT_Error; +} +extern "C" { + pub fn FT_Done_FreeType(library: FT_Library) -> FT_Error; +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Parameter_ { + pub tag: FT_ULong, + pub data: FT_Pointer, +} +#[test] +fn bindgen_test_layout_FT_Parameter_() { + assert_eq!(::std::mem::size_of::() , 16usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Parameter_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Parameter_ as FT_Parameter; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Open_Args_ { + pub flags: FT_UInt, + pub memory_base: *const FT_Byte, + pub memory_size: FT_Long, + pub pathname: *mut FT_String, + pub stream: FT_Stream, + pub driver: FT_Module, + pub num_params: FT_Int, + pub params: *mut FT_Parameter, +} +#[test] +fn bindgen_test_layout_FT_Open_Args_() { + assert_eq!(::std::mem::size_of::() , 64usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Open_Args_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Open_Args_ as FT_Open_Args; +extern "C" { + pub fn FT_New_Face(library: FT_Library, + filepathname: *const ::std::os::raw::c_char, + face_index: FT_Long, aface: *mut FT_Face) -> FT_Error; +} +extern "C" { + pub fn FT_New_Memory_Face(library: FT_Library, file_base: *const FT_Byte, + file_size: FT_Long, face_index: FT_Long, + aface: *mut FT_Face) -> FT_Error; +} +extern "C" { + pub fn FT_Open_Face(library: FT_Library, args: *const FT_Open_Args, + face_index: FT_Long, aface: *mut FT_Face) -> FT_Error; +} +extern "C" { + pub fn FT_Attach_File(face: FT_Face, + filepathname: *const ::std::os::raw::c_char) + -> FT_Error; +} +extern "C" { + pub fn FT_Attach_Stream(face: FT_Face, parameters: *mut FT_Open_Args) + -> FT_Error; +} +extern "C" { + pub fn FT_Reference_Face(face: FT_Face) -> FT_Error; +} +extern "C" { + pub fn FT_Done_Face(face: FT_Face) -> FT_Error; +} +extern "C" { + pub fn FT_Select_Size(face: FT_Face, strike_index: FT_Int) -> FT_Error; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_Size_Request_Type_ { + FT_SIZE_REQUEST_TYPE_NOMINAL = 0, + FT_SIZE_REQUEST_TYPE_REAL_DIM = 1, + FT_SIZE_REQUEST_TYPE_BBOX = 2, + FT_SIZE_REQUEST_TYPE_CELL = 3, + FT_SIZE_REQUEST_TYPE_SCALES = 4, + FT_SIZE_REQUEST_TYPE_MAX = 5, +} +pub use self::FT_Size_Request_Type_ as FT_Size_Request_Type; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Size_RequestRec_ { + pub type_: FT_Size_Request_Type, + pub width: FT_Long, + pub height: FT_Long, + pub horiResolution: FT_UInt, + pub vertResolution: FT_UInt, +} +#[test] +fn bindgen_test_layout_FT_Size_RequestRec_() { + assert_eq!(::std::mem::size_of::() , 32usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Size_RequestRec_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Size_RequestRec_ as FT_Size_RequestRec; +pub type FT_Size_Request = *mut FT_Size_RequestRec_; +extern "C" { + pub fn FT_Request_Size(face: FT_Face, req: FT_Size_Request) -> FT_Error; +} +extern "C" { + pub fn FT_Set_Char_Size(face: FT_Face, char_width: FT_F26Dot6, + char_height: FT_F26Dot6, horz_resolution: FT_UInt, + vert_resolution: FT_UInt) -> FT_Error; +} +extern "C" { + pub fn FT_Set_Pixel_Sizes(face: FT_Face, pixel_width: FT_UInt, + pixel_height: FT_UInt) -> FT_Error; +} +extern "C" { + pub fn FT_Load_Glyph(face: FT_Face, glyph_index: FT_UInt, + load_flags: FT_Int32) -> FT_Error; +} +extern "C" { + pub fn FT_Load_Char(face: FT_Face, char_code: FT_ULong, + load_flags: FT_Int32) -> FT_Error; +} +extern "C" { + pub fn FT_Set_Transform(face: FT_Face, matrix: *mut FT_Matrix, + delta: *mut FT_Vector); +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_Render_Mode_ { + FT_RENDER_MODE_NORMAL = 0, + FT_RENDER_MODE_LIGHT = 1, + FT_RENDER_MODE_MONO = 2, + FT_RENDER_MODE_LCD = 3, + FT_RENDER_MODE_LCD_V = 4, + FT_RENDER_MODE_MAX = 5, +} +pub use self::FT_Render_Mode_ as FT_Render_Mode; +extern "C" { + pub fn FT_Render_Glyph(slot: FT_GlyphSlot, render_mode: FT_Render_Mode) + -> FT_Error; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_Kerning_Mode_ { + FT_KERNING_DEFAULT = 0, + FT_KERNING_UNFITTED = 1, + FT_KERNING_UNSCALED = 2, +} +pub use self::FT_Kerning_Mode_ as FT_Kerning_Mode; +extern "C" { + pub fn FT_Get_Kerning(face: FT_Face, left_glyph: FT_UInt, + right_glyph: FT_UInt, kern_mode: FT_UInt, + akerning: *mut FT_Vector) -> FT_Error; +} +extern "C" { + pub fn FT_Get_Track_Kerning(face: FT_Face, point_size: FT_Fixed, + degree: FT_Int, akerning: *mut FT_Fixed) + -> FT_Error; +} +extern "C" { + pub fn FT_Get_Glyph_Name(face: FT_Face, glyph_index: FT_UInt, + buffer: FT_Pointer, buffer_max: FT_UInt) + -> FT_Error; +} +extern "C" { + pub fn FT_Get_Postscript_Name(face: FT_Face) + -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn FT_Select_Charmap(face: FT_Face, encoding: FT_Encoding) + -> FT_Error; +} +extern "C" { + pub fn FT_Set_Charmap(face: FT_Face, charmap: FT_CharMap) -> FT_Error; +} +extern "C" { + pub fn FT_Get_Charmap_Index(charmap: FT_CharMap) -> FT_Int; +} +extern "C" { + pub fn FT_Get_Char_Index(face: FT_Face, charcode: FT_ULong) -> FT_UInt; +} +extern "C" { + pub fn FT_Get_First_Char(face: FT_Face, agindex: *mut FT_UInt) + -> FT_ULong; +} +extern "C" { + pub fn FT_Get_Next_Char(face: FT_Face, char_code: FT_ULong, + agindex: *mut FT_UInt) -> FT_ULong; +} +extern "C" { + pub fn FT_Get_Name_Index(face: FT_Face, glyph_name: *mut FT_String) + -> FT_UInt; +} +extern "C" { + pub fn FT_Get_SubGlyph_Info(glyph: FT_GlyphSlot, sub_index: FT_UInt, + p_index: *mut FT_Int, p_flags: *mut FT_UInt, + p_arg1: *mut FT_Int, p_arg2: *mut FT_Int, + p_transform: *mut FT_Matrix) -> FT_Error; +} +extern "C" { + pub fn FT_Get_FSType_Flags(face: FT_Face) -> FT_UShort; +} +extern "C" { + pub fn FT_Face_GetCharVariantIndex(face: FT_Face, charcode: FT_ULong, + variantSelector: FT_ULong) -> FT_UInt; +} +extern "C" { + pub fn FT_Face_GetCharVariantIsDefault(face: FT_Face, charcode: FT_ULong, + variantSelector: FT_ULong) + -> FT_Int; +} +extern "C" { + pub fn FT_Face_GetVariantSelectors(face: FT_Face) -> *mut FT_UInt32; +} +extern "C" { + pub fn FT_Face_GetVariantsOfChar(face: FT_Face, charcode: FT_ULong) + -> *mut FT_UInt32; +} +extern "C" { + pub fn FT_Face_GetCharsOfVariant(face: FT_Face, variantSelector: FT_ULong) + -> *mut FT_UInt32; +} +extern "C" { + pub fn FT_MulDiv(a: FT_Long, b: FT_Long, c: FT_Long) -> FT_Long; +} +extern "C" { + pub fn FT_MulFix(a: FT_Long, b: FT_Long) -> FT_Long; +} +extern "C" { + pub fn FT_DivFix(a: FT_Long, b: FT_Long) -> FT_Long; +} +extern "C" { + pub fn FT_RoundFix(a: FT_Fixed) -> FT_Fixed; +} +extern "C" { + pub fn FT_CeilFix(a: FT_Fixed) -> FT_Fixed; +} +extern "C" { + pub fn FT_FloorFix(a: FT_Fixed) -> FT_Fixed; +} +extern "C" { + pub fn FT_Vector_Transform(vec: *mut FT_Vector, matrix: *const FT_Matrix); +} +extern "C" { + pub fn FT_Library_Version(library: FT_Library, amajor: *mut FT_Int, + aminor: *mut FT_Int, apatch: *mut FT_Int); +} +extern "C" { + pub fn FT_Face_CheckTrueTypePatents(face: FT_Face) -> FT_Bool; +} +extern "C" { + pub fn FT_Face_SetUnpatentedHinting(face: FT_Face, value: FT_Bool) + -> FT_Bool; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_LcdFilter_ { + FT_LCD_FILTER_NONE = 0, + FT_LCD_FILTER_DEFAULT = 1, + FT_LCD_FILTER_LIGHT = 2, + FT_LCD_FILTER_LEGACY1 = 3, + FT_LCD_FILTER_LEGACY = 16, + FT_LCD_FILTER_MAX = 17, +} +pub use self::FT_LcdFilter_ as FT_LcdFilter; +extern "C" { + pub fn FT_Library_SetLcdFilter(library: FT_Library, filter: FT_LcdFilter) + -> FT_Error; +} +extern "C" { + pub fn FT_Library_SetLcdFilterWeights(library: FT_Library, + weights: + *mut ::std::os::raw::c_uchar) + -> FT_Error; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_Sfnt_Tag_ { + FT_SFNT_HEAD = 0, + FT_SFNT_MAXP = 1, + FT_SFNT_OS2 = 2, + FT_SFNT_HHEA = 3, + FT_SFNT_VHEA = 4, + FT_SFNT_POST = 5, + FT_SFNT_PCLT = 6, + FT_SFNT_MAX = 7, +} +pub use self::FT_Sfnt_Tag_ as FT_Sfnt_Tag; +extern "C" { + pub fn FT_Get_Sfnt_Table(face: FT_Face, tag: FT_Sfnt_Tag) + -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn FT_Load_Sfnt_Table(face: FT_Face, tag: FT_ULong, offset: FT_Long, + buffer: *mut FT_Byte, length: *mut FT_ULong) + -> FT_Error; +} +extern "C" { + pub fn FT_Sfnt_Table_Info(face: FT_Face, table_index: FT_UInt, + tag: *mut FT_ULong, length: *mut FT_ULong) + -> FT_Error; +} +extern "C" { + pub fn FT_Get_CMap_Language_ID(charmap: FT_CharMap) -> FT_ULong; +} +extern "C" { + pub fn FT_Get_CMap_Format(charmap: FT_CharMap) -> FT_Long; +} +pub type FT_Module_Interface = FT_Pointer; +pub type FT_Module_Constructor = + ::std::option::Option ::std::os::raw::c_int>; +pub type FT_Module_Destructor = + ::std::option::Option; +pub type FT_Module_Requester = + ::std::option::Option *mut ::std::os::raw::c_void>; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct FT_Module_Class_ { + pub module_flags: FT_ULong, + pub module_size: FT_Long, + pub module_name: *const FT_String, + pub module_version: FT_Fixed, + pub module_requires: FT_Fixed, + pub module_interface: *const ::std::os::raw::c_void, + pub module_init: FT_Module_Constructor, + pub module_done: FT_Module_Destructor, + pub get_interface: FT_Module_Requester, +} +#[test] +fn bindgen_test_layout_FT_Module_Class_() { + assert_eq!(::std::mem::size_of::() , 72usize); + assert_eq!(::std::mem::align_of::() , 8usize); +} +impl Clone for FT_Module_Class_ { + fn clone(&self) -> Self { *self } +} +pub use self::FT_Module_Class_ as FT_Module_Class; +extern "C" { + pub fn FT_Add_Module(library: FT_Library, clazz: *const FT_Module_Class) + -> FT_Error; +} +extern "C" { + pub fn FT_Get_Module(library: FT_Library, + module_name: *const ::std::os::raw::c_char) + -> FT_Module; +} +extern "C" { + pub fn FT_Remove_Module(library: FT_Library, module: FT_Module) + -> FT_Error; +} +extern "C" { + pub fn FT_Property_Set(library: FT_Library, module_name: *const FT_String, + property_name: *const FT_String, + value: *const ::std::os::raw::c_void) -> FT_Error; +} +extern "C" { + pub fn FT_Property_Get(library: FT_Library, module_name: *const FT_String, + property_name: *const FT_String, + value: *mut ::std::os::raw::c_void) -> FT_Error; +} +extern "C" { + pub fn FT_Reference_Library(library: FT_Library) -> FT_Error; +} +extern "C" { + pub fn FT_New_Library(memory: FT_Memory, alibrary: *mut FT_Library) + -> FT_Error; +} +extern "C" { + pub fn FT_Done_Library(library: FT_Library) -> FT_Error; +} +pub type FT_DebugHook_Func = + ::std::option::Option; +extern "C" { + pub fn FT_Set_Debug_Hook(library: FT_Library, hook_index: FT_UInt, + debug_hook: FT_DebugHook_Func); +} +extern "C" { + pub fn FT_Add_Default_Modules(library: FT_Library); +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum FT_TrueTypeEngineType_ { + FT_TRUETYPE_ENGINE_TYPE_NONE = 0, + FT_TRUETYPE_ENGINE_TYPE_UNPATENTED = 1, + FT_TRUETYPE_ENGINE_TYPE_PATENTED = 2, +} +pub use self::FT_TrueTypeEngineType_ as FT_TrueTypeEngineType; +extern "C" { + pub fn FT_Get_TrueType_Engine_Type(library: FT_Library) + -> FT_TrueTypeEngineType; +} diff --git a/third_party/rust/freetype/src/lib.rs b/third_party/rust/freetype/src/lib.rs new file mode 100644 index 000000000000..7831e2ecffec --- /dev/null +++ b/third_party/rust/freetype/src/lib.rs @@ -0,0 +1,37 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "freetype"] +#![crate_type = "lib"] +#![crate_type = "dylib"] +#![crate_type = "rlib"] + +#![allow(non_snake_case)] +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +#[cfg(feature = "servo-freetype-sys")] +extern crate freetype_sys; +extern crate libc; + +/// A wrapper over FT_Error so we can add convenience methods on it. +#[repr(C)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +pub struct FT_Error(pub ::std::os::raw::c_int); + +impl FT_Error { + #[inline] + pub fn succeeded(&self) -> bool { + self.0 == freetype::FT_Err_Ok as ::std::os::raw::c_int + } +} + +#[allow(improper_ctypes)] // https://github.com/rust-lang/rust/issues/34798 +pub mod freetype; +pub mod tt_os2; diff --git a/third_party/rust/freetype/src/tt_os2.rs b/third_party/rust/freetype/src/tt_os2.rs new file mode 100644 index 000000000000..b2e9a659a20c --- /dev/null +++ b/third_party/rust/freetype/src/tt_os2.rs @@ -0,0 +1,50 @@ +// Copyright 2013 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use freetype::{FT_UShort, FT_Short, FT_ULong, FT_Byte}; + +#[repr(C)] +pub struct TT_OS2 { + pub version: FT_UShort, + pub xAvgCharWidth: FT_Short, + pub usWeightClass: FT_UShort, + pub usWidthClass: FT_UShort, + pub fsType: FT_Short, + pub ySubscriptXSize: FT_Short, + pub ySubscriptYSize: FT_Short, + pub ySubscriptXOffset: FT_Short, + pub ySubscriptYOffset: FT_Short, + pub ySuperscriptXSize: FT_Short, + pub ySuperscriptYSize: FT_Short, + pub ySuperscriptXOffset: FT_Short, + pub ySuperscriptYOffset: FT_Short, + pub yStrikeoutSize: FT_Short, + pub yStrikeoutPosition: FT_Short, + pub sFamilyClass: FT_Short, + + pub panose: [FT_Byte; 10], + + pub ulUnicodeRange1: FT_ULong, /* Bits 0-31 */ + pub ulUnicodeRange2: FT_ULong, /* Bits 32-63 */ + pub ulUnicodeRange3: FT_ULong, /* Bits 64-95 */ + pub ulUnicodeRange4: FT_ULong, /* Bits 96-127 */ + + /* only version 1 tables */ + + pub ulCodePageRange1: FT_ULong, /* Bits 0-31 */ + pub ulCodePageRange2: FT_ULong, /* Bits 32-63 */ + + /* only version 2 tables */ + + pub sxHeight: FT_Short, + pub sCapHeight: FT_Short, + pub usDefaultChar: FT_UShort, + pub usBreakChar: FT_UShort, + pub usMaxContext: FT_UShort, +} diff --git a/third_party/rust/gdi32-sys/.cargo-checksum.json b/third_party/rust/gdi32-sys/.cargo-checksum.json new file mode 100644 index 000000000000..dfa36cfe7e24 --- /dev/null +++ b/third_party/rust/gdi32-sys/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"20862f3ca447bad787627843d50ec7ce037076883780fb76d38a5168ce53f270","README.md":"fe7c514d58e569be2a6a59dab506a93acb1a99e298bd98760ffdb665e215c962","build.rs":"42ed995baf6047cc983e11482f23285fc5488399453d82155e8342d77fd9c73a","src/lib.rs":"0d06d543ee154316afd6e86d6f3e5789b41a0e722682a69c81b77c65549af95c"},"package":"0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"} \ No newline at end of file diff --git a/third_party/rust/gdi32-sys/.cargo-ok b/third_party/rust/gdi32-sys/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/gdi32-sys/Cargo.toml b/third_party/rust/gdi32-sys/Cargo.toml new file mode 100644 index 000000000000..7bd02211ea4f --- /dev/null +++ b/third_party/rust/gdi32-sys/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "gdi32-sys" +version = "0.2.0" +authors = ["Peter Atashian "] +description = "Contains function definitions for the Windows API library gdi32. See winapi for types and constants." +documentation = "https://retep998.github.io/doc/gdi32/" +repository = "https://github.com/retep998/winapi-rs" +readme = "README.md" +keywords = ["windows", "ffi", "win32"] +license = "MIT" +build = "build.rs" +[lib] +name = "gdi32" +[dependencies] +winapi = { version = "0.2.5", path = "../.." } +[build-dependencies] +winapi-build = { version = "0.1.1", path = "../../build" } diff --git a/third_party/rust/gdi32-sys/README.md b/third_party/rust/gdi32-sys/README.md new file mode 100644 index 000000000000..e397ba0360e8 --- /dev/null +++ b/third_party/rust/gdi32-sys/README.md @@ -0,0 +1,13 @@ +# gdi32 # +Contains function definitions for the Windows API library gdi32. See winapi for types and constants. + +```toml +[dependencies] +gdi32-sys = "0.2.0" +``` + +```rust +extern crate gdi32; +``` + +[Documentation](https://retep998.github.io/doc/gdi32/) diff --git a/third_party/rust/gdi32-sys/build.rs b/third_party/rust/gdi32-sys/build.rs new file mode 100644 index 000000000000..c6484cade654 --- /dev/null +++ b/third_party/rust/gdi32-sys/build.rs @@ -0,0 +1,6 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +extern crate build; +fn main() { + build::link("gdi32", false) +} diff --git a/third_party/rust/gdi32-sys/src/lib.rs b/third_party/rust/gdi32-sys/src/lib.rs new file mode 100644 index 000000000000..efa82def2718 --- /dev/null +++ b/third_party/rust/gdi32-sys/src/lib.rs @@ -0,0 +1,703 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! FFI bindings to gdi32. +#![cfg(windows)] +extern crate winapi; +use winapi::*; +extern "system" { + pub fn AbortDoc(hdc: HDC) -> c_int; + pub fn AbortPath(hdc: HDC) -> BOOL; + pub fn AddFontMemResourceEx( + pbFont: PVOID, cbSize: DWORD, pdv: PVOID, pcFonts: *mut DWORD, + ) -> HANDLE; + pub fn AddFontResourceA(lpszFilename: LPCSTR) -> c_int; + pub fn AddFontResourceExA(lpszFilename: LPCSTR, fl: DWORD, pdv: PVOID) -> c_int; + pub fn AddFontResourceExW(lpszFilename: LPCWSTR, fl: DWORD, pdv: PVOID) -> c_int; + pub fn AddFontResourceW(lpszFilename: LPCWSTR) -> c_int; + pub fn AngleArc( + hdc: HDC, X: c_int, Y: c_int, dwRadius: DWORD, eStartAngle: FLOAT, eSweepAngle: FLOAT, + ) -> BOOL; + pub fn AnimatePalette( + hpal: HPALETTE, iStartIndex: UINT, cEntries: UINT, ppe: *const PALETTEENTRY, + ) -> BOOL; + pub fn Arc( + hdc: HDC, nLeftRect: c_int, nTopRect: c_int, nRightRect: c_int, nBottomRect: c_int, + nXStartArc: c_int, nYStartArc: c_int, nXEndArc: c_int, nYEndArc: c_int, + ) -> BOOL; + pub fn ArcTo( + hdc: HDC, nLeftRect: c_int, nTopRect: c_int, nRightRect: c_int, nBottomRect: c_int, + nXRadial1: c_int, nYRadial1: c_int, nXRadial2: c_int, nYRadial2: c_int, + ) -> BOOL; + pub fn BeginPath(hdc: HDC) -> BOOL; + pub fn BitBlt( + hdc: HDC, x: c_int, y: c_int, cx: c_int, cy: c_int, hdcSrc: HDC, x1: c_int, y1: c_int, + rop: DWORD, + ) -> BOOL; + pub fn CancelDC(hdc: HDC) -> BOOL; + pub fn CheckColorsInGamut( + hDC: HDC, lpRGBTriples: LPVOID, lpBuffer: LPVOID, nCount: UINT, + ) -> BOOL; + pub fn ChoosePixelFormat(hdc: HDC, ppfd: *const PIXELFORMATDESCRIPTOR) -> c_int; + pub fn Chord( + hdc: HDC, nLeftRect: c_int, nTopRect: c_int, nRightRect: c_int, nBottomRect: c_int, + nXRadial1: c_int, nYRadial1: c_int, nXRadial2: c_int, nYRadial2: c_int, + ) -> BOOL; + pub fn CloseEnhMetaFile(hdc: HDC) -> HENHMETAFILE; + pub fn CloseFigure(hdc: HDC) -> BOOL; + pub fn CloseMetaFile(hdc: HDC) -> HMETAFILE; + pub fn ColorCorrectPalette( + hDC: HDC, hPalette: HPALETTE, dwFirstEntry: DWORD, dwNumOfEntries: DWORD, + ) -> BOOL; + pub fn ColorMatchToTarget(hDC: HDC, hdcTarget: HDC, uiAction: UINT) -> BOOL; + pub fn CombineRgn( + hrgnDst: HRGN, hrgnSrc1: HRGN, hrgnSrc2: HRGN, fnCombineMode: c_int, + ) -> c_int; + pub fn CombineTransform( + lpxformResult: LPXFORM, lpxform1: *const XFORM, lpxform2: *const XFORM, + ) -> BOOL; + pub fn CopyEnhMetaFileA(hemfSrc: HENHMETAFILE, lpszFile: LPCSTR) -> HENHMETAFILE; + pub fn CopyEnhMetaFileW(hemfSrc: HENHMETAFILE, lpszFile: LPCWSTR) -> HENHMETAFILE; + pub fn CopyMetaFileA(hmfSrc: HMETAFILE, lpszFile: LPCSTR) -> HMETAFILE; + pub fn CopyMetaFileW(hmfSrc: HMETAFILE, lpszFile: LPCWSTR) -> HMETAFILE; + pub fn CreateBitmap( + nWidth: c_int, nHeight: c_int, nPlanes: UINT, nBitCount: UINT, lpBits: *const c_void, + ) -> HBITMAP; + pub fn CreateBitmapIndirect(pbm: *const BITMAP) -> HBITMAP; + pub fn CreateBrushIndirect(lplb: *const LOGBRUSH) -> HBRUSH; + pub fn CreateColorSpaceA(lpLogColorSpace: LPLOGCOLORSPACEA) -> HCOLORSPACE; + pub fn CreateColorSpaceW(lpLogColorSpace: LPLOGCOLORSPACEW) -> HCOLORSPACE; + pub fn CreateCompatibleBitmap(hdc: HDC, cx: c_int, cy: c_int) -> HBITMAP; + pub fn CreateCompatibleDC(hdc: HDC) -> HDC; + pub fn CreateDCA( + lpszDriver: LPCSTR, lpszDevice: LPCSTR, lpszOutput: LPCSTR, lpInitData: *const DEVMODEA, + ) -> HDC; + pub fn CreateDCW( + lpszDriver: LPCWSTR, lpszDevice: LPCWSTR, lpszOutput: LPCWSTR, lpInitData: *const DEVMODEW, + ) -> HDC; + pub fn CreateDIBPatternBrush(hglbDIBPacked: HGLOBAL, fuColorSpec: UINT) -> HBRUSH; + pub fn CreateDIBPatternBrushPt(lpPackedDIB: *const VOID, iUsage: UINT) -> HBRUSH; + pub fn CreateDIBSection( + hdc: HDC, lpbmi: *const BITMAPINFO, usage: UINT, ppvBits: *mut *mut c_void, + hSection: HANDLE, offset: DWORD, + ) -> HBITMAP; + pub fn CreateDIBitmap( + hdc: HDC, pbmih: *const BITMAPINFOHEADER, flInit: DWORD, pjBits: *const c_void, + pbmi: *const BITMAPINFO, iUsage: UINT, + ) -> HBITMAP; + pub fn CreateDiscardableBitmap(hdc: HDC, nWidth: c_int, nHeight: c_int) -> HBITMAP; + pub fn CreateEllipticRgn( + nLeftRect: c_int, nTopRect: c_int, nRightRect: c_int, nBottomRect: c_int, + ) -> HRGN; + pub fn CreateEllipticRgnIndirect(lprc: *const RECT) -> HRGN; + pub fn CreateEnhMetaFileA( + hdcRef: HDC, lpFilename: LPCSTR, lpRect: *const RECT, lpDescription: LPCSTR, + ) -> HDC; + pub fn CreateEnhMetaFileW( + hdcRef: HDC, lpFilename: LPCWSTR, lpRect: *const RECT, lpDescription: LPCWSTR, + ) -> HDC; + pub fn CreateFontA( + cHeight: c_int, cWidth: c_int, cEscapement: c_int, cOrientation: c_int, cWeight: c_int, + bItalic: DWORD, bUnderline: DWORD, bStrikeOut: DWORD, iCharSet: DWORD, + iOutPrecision: DWORD, iClipPrecision: DWORD, iQuality: DWORD, iPitchAndFamily: DWORD, + pszFaceName: LPCSTR, + ) -> HFONT; + pub fn CreateFontIndirectA(lplf: *const LOGFONTA) -> HFONT; + pub fn CreateFontIndirectExA(penumlfex: *const ENUMLOGFONTEXDVA) -> HFONT; + pub fn CreateFontIndirectExW(penumlfex: *const ENUMLOGFONTEXDVW) -> HFONT; + pub fn CreateFontIndirectW(lplf: *const LOGFONTW) -> HFONT; + pub fn CreateFontW( + cHeight: c_int, cWidth: c_int, cEscapement: c_int, cOrientation: c_int, cWeight: c_int, + bItalic: DWORD, bUnderline: DWORD, bStrikeOut: DWORD, iCharSet: DWORD, + iOutPrecision: DWORD, iClipPrecision: DWORD, iQuality: DWORD, iPitchAndFamily: DWORD, + pszFaceName: LPCWSTR, + ) -> HFONT; + pub fn CreateHalftonePalette(hdc: HDC) -> HPALETTE; + pub fn CreateHatchBrush(fnStyle: c_int, clrref: COLORREF) -> HBRUSH; + pub fn CreateICA( + lpszDriver: LPCSTR, lpszDevice: LPCSTR, lpszOutput: LPCSTR, lpdvmInit: *const DEVMODEA, + ) -> HDC; + pub fn CreateICW( + lpszDriver: LPCWSTR, lpszDevice: LPCWSTR, lpszOutput: LPCWSTR, lpdvmInit: *const DEVMODEW, + ) -> HDC; + pub fn CreateMetaFileA(lpszFile: LPCSTR) -> HDC; + pub fn CreateMetaFileW(lpszFile: LPCWSTR) -> HDC; + pub fn CreatePalette(lplgpl: *const LOGPALETTE) -> HPALETTE; + pub fn CreatePatternBrush(hbmp: HBITMAP) -> HBRUSH; + pub fn CreatePen(fnPenStyle: c_int, nWidth: c_int, crColor: COLORREF) -> HPEN; + pub fn CreatePenIndirect(lplgpn: *const LOGPEN) -> HPEN; + pub fn CreatePolyPolygonRgn( + lppt: *const POINT, lpPolyCounts: *const INT, nCount: c_int, fnPolyFillMode: c_int, + ) -> HRGN; + pub fn CreatePolygonRgn(lppt: *const POINT, cPoints: c_int, fnPolyFillMode: c_int) -> HRGN; + pub fn CreateRectRgn( + nLeftRect: c_int, nTopRect: c_int, nRightRect: c_int, nBottomRect: c_int, + ) -> HRGN; + pub fn CreateRectRgnIndirect(lprect: *const RECT) -> HRGN; + pub fn CreateRoundRectRgn( + x1: c_int, y1: c_int, x2: c_int, y2: c_int, w: c_int, h: c_int + ) -> HRGN; + pub fn CreateScalableFontResourceA( + fdwHidden: DWORD, lpszFont: LPCSTR, lpszFile: LPCSTR, lpszPath: LPCSTR + ) -> BOOL; + pub fn CreateScalableFontResourceW( + fdwHidden: DWORD, lpszFont: LPCWSTR, lpszFile: LPCWSTR, lpszPath: LPCWSTR + ) -> BOOL; + pub fn CreateSolidBrush(color: COLORREF) -> HBRUSH; + // pub fn D3DKMTAcquireKeyedMutex(); + // pub fn D3DKMTAcquireKeyedMutex2(); + // pub fn D3DKMTCacheHybridQueryValue(); + // pub fn D3DKMTCheckExclusiveOwnership(); + // pub fn D3DKMTCheckMonitorPowerState(); + // pub fn D3DKMTCheckMultiPlaneOverlaySupport(); + // pub fn D3DKMTCheckOcclusion(); + // pub fn D3DKMTCheckSharedResourceAccess(); + // pub fn D3DKMTCheckVidPnExclusiveOwnership(); + // pub fn D3DKMTCloseAdapter(); + // pub fn D3DKMTConfigureSharedResource(); + // pub fn D3DKMTCreateAllocation(); + // pub fn D3DKMTCreateAllocation2(); + // pub fn D3DKMTCreateContext(); + // pub fn D3DKMTCreateDCFromMemory(); + // pub fn D3DKMTCreateDevice(); + // pub fn D3DKMTCreateKeyedMutex(); + // pub fn D3DKMTCreateKeyedMutex2(); + // pub fn D3DKMTCreateOutputDupl(); + // pub fn D3DKMTCreateOverlay(); + // pub fn D3DKMTCreateSynchronizationObject(); + // pub fn D3DKMTCreateSynchronizationObject2(); + // pub fn D3DKMTDestroyAllocation(); + // pub fn D3DKMTDestroyContext(); + // pub fn D3DKMTDestroyDCFromMemory(); + // pub fn D3DKMTDestroyDevice(); + // pub fn D3DKMTDestroyKeyedMutex(); + // pub fn D3DKMTDestroyOutputDupl(); + // pub fn D3DKMTDestroyOverlay(); + // pub fn D3DKMTDestroySynchronizationObject(); + // pub fn D3DKMTEnumAdapters(); + // pub fn D3DKMTEscape(); + // pub fn D3DKMTFlipOverlay(); + // pub fn D3DKMTGetCachedHybridQueryValue(); + // pub fn D3DKMTGetContextInProcessSchedulingPriority(); + // pub fn D3DKMTGetContextSchedulingPriority(); + // pub fn D3DKMTGetDeviceState(); + // pub fn D3DKMTGetDisplayModeList(); + // pub fn D3DKMTGetMultisampleMethodList(); + // pub fn D3DKMTGetOverlayState(); + // pub fn D3DKMTGetPresentHistory(); + // pub fn D3DKMTGetPresentQueueEvent(); + // pub fn D3DKMTGetProcessSchedulingPriorityClass(); + // pub fn D3DKMTGetRuntimeData(); + // pub fn D3DKMTGetScanLine(); + // pub fn D3DKMTGetSharedPrimaryHandle(); + // pub fn D3DKMTGetSharedResourceAdapterLuid(); + // pub fn D3DKMTInvalidateActiveVidPn(); + // pub fn D3DKMTLock(); + // pub fn D3DKMTNetDispGetNextChunkInfo(); + // pub fn D3DKMTNetDispQueryMiracastDisplayDeviceStatus(); + // pub fn D3DKMTNetDispQueryMiracastDisplayDeviceSupport(); + // pub fn D3DKMTNetDispStartMiracastDisplayDevice2(); + // pub fn D3DKMTNetDispStopMiracastDisplayDevice(); + // pub fn D3DKMTOfferAllocations(); + // pub fn D3DKMTOpenAdapterFromDeviceName(); + // pub fn D3DKMTOpenAdapterFromGdiDisplayName(); + // pub fn D3DKMTOpenAdapterFromHdc(); + // pub fn D3DKMTOpenAdapterFromLuid(); + // pub fn D3DKMTOpenKeyedMutex(); + // pub fn D3DKMTOpenKeyedMutex2(); + // pub fn D3DKMTOpenNtHandleFromName(); + // pub fn D3DKMTOpenResource(); + // pub fn D3DKMTOpenResource2(); + // pub fn D3DKMTOpenResourceFromNtHandle(); + // pub fn D3DKMTOpenSyncObjectFromNtHandle(); + // pub fn D3DKMTOpenSynchronizationObject(); + // pub fn D3DKMTOutputDuplGetFrameInfo(); + // pub fn D3DKMTOutputDuplGetMetaData(); + // pub fn D3DKMTOutputDuplGetPointerShapeData(); + // pub fn D3DKMTOutputDuplPresent(); + // pub fn D3DKMTOutputDuplReleaseFrame(); + // pub fn D3DKMTPinDirectFlipResources(); + // pub fn D3DKMTPollDisplayChildren(); + // pub fn D3DKMTPresent(); + // pub fn D3DKMTPresentMultiPlaneOverlay(); + // pub fn D3DKMTQueryAdapterInfo(); + // pub fn D3DKMTQueryAllocationResidency(); + // pub fn D3DKMTQueryRemoteVidPnSourceFromGdiDisplayName(); + // pub fn D3DKMTQueryResourceInfo(); + // pub fn D3DKMTQueryResourceInfoFromNtHandle(); + // pub fn D3DKMTQueryStatistics(); + // pub fn D3DKMTReclaimAllocations(); + // pub fn D3DKMTReleaseKeyedMutex(); + // pub fn D3DKMTReleaseKeyedMutex2(); + // pub fn D3DKMTReleaseProcessVidPnSourceOwners(); + // pub fn D3DKMTRender(); + // pub fn D3DKMTSetAllocationPriority(); + // pub fn D3DKMTSetContextInProcessSchedulingPriority(); + // pub fn D3DKMTSetContextSchedulingPriority(); + // pub fn D3DKMTSetDisplayMode(); + // pub fn D3DKMTSetDisplayPrivateDriverFormat(); + // pub fn D3DKMTSetGammaRamp(); + // pub fn D3DKMTSetProcessSchedulingPriorityClass(); + // pub fn D3DKMTSetQueuedLimit(); + // pub fn D3DKMTSetStereoEnabled(); + // pub fn D3DKMTSetVidPnSourceOwner(); + // pub fn D3DKMTSetVidPnSourceOwner1(); + // pub fn D3DKMTShareObjects(); + // pub fn D3DKMTSharedPrimaryLockNotification(); + // pub fn D3DKMTSharedPrimaryUnLockNotification(); + // pub fn D3DKMTSignalSynchronizationObject(); + // pub fn D3DKMTSignalSynchronizationObject2(); + // pub fn D3DKMTUnlock(); + // pub fn D3DKMTUnpinDirectFlipResources(); + // pub fn D3DKMTUpdateOverlay(); + // pub fn D3DKMTWaitForIdle(); + // pub fn D3DKMTWaitForSynchronizationObject(); + // pub fn D3DKMTWaitForSynchronizationObject2(); + // pub fn D3DKMTWaitForVerticalBlankEvent(); + // pub fn D3DKMTWaitForVerticalBlankEvent2(); + pub fn DPtoLP(hdc: HDC, lppt: *mut POINT, c: c_int) -> BOOL; + pub fn DeleteColorSpace(hcs: HCOLORSPACE) -> BOOL; + pub fn DeleteDC(hdc: HDC) -> BOOL; + pub fn DeleteEnhMetaFile(hmf: HENHMETAFILE) -> BOOL; + pub fn DeleteMetaFile(hmf: HMETAFILE) -> BOOL; + pub fn DeleteObject(ho: HGDIOBJ) -> BOOL; + pub fn DescribePixelFormat( + hdc: HDC, iPixelFormat: c_int, nBytes: UINT, ppfd: LPPIXELFORMATDESCRIPTOR, + ) -> c_int; + // pub fn DeviceCapabilitiesExA(); + // pub fn DeviceCapabilitiesExW(); + pub fn DrawEscape(hdc: HDC, iEscape: c_int, cjIn: c_int, lpIn: LPCSTR) -> c_int; + pub fn Ellipse(hdc: HDC, left: c_int, top: c_int, right: c_int, bottom: c_int) -> BOOL; + // pub fn EnableEUDC(); + pub fn EndDoc(hdc: HDC) -> c_int; + // pub fn EndFormPage(); + pub fn EndPage(hdc: HDC) -> c_int; + pub fn EndPath(hdc: HDC) -> BOOL; + pub fn EnumEnhMetaFile( + hdc: HDC, hmf: HENHMETAFILE, lpProc: ENHMFENUMPROC, param: LPVOID, lpRect: *const RECT + ) -> BOOL; + pub fn EnumFontFamiliesA( + hdc: HDC, lpLogfont: LPCSTR, lpProc: FONTENUMPROCA, lParam: LPARAM + ) -> c_int; + pub fn EnumFontFamiliesExA( + hdc: HDC, lpLogfont: LPLOGFONTA, lpProc: FONTENUMPROCA, lParam: LPARAM, dwFlags: DWORD + ) -> c_int; + pub fn EnumFontFamiliesExW( + hdc: HDC, lpLogfont: LPLOGFONTW, lpProc: FONTENUMPROCW, lParam: LPARAM, dwFlags: DWORD + ) -> c_int; + pub fn EnumFontFamiliesW( + hdc: HDC, lpLogfont: LPCWSTR, lpProc: FONTENUMPROCW, lParam: LPARAM + ) -> c_int; + pub fn EnumFontsA( + hdc: HDC, lpLogfont: LPCSTR, lpProc: FONTENUMPROCA, lParam: LPARAM + ) -> c_int; + pub fn EnumFontsW( + hdc: HDC, lpLogfont: LPCWSTR, lpProc: FONTENUMPROCW, lParam: LPARAM + ) -> c_int; + pub fn EnumICMProfilesA( + hdc: HDC, iproc: ICMENUMPROCA, param: LPARAM + ) -> c_int; + pub fn EnumICMProfilesW( + hdc: HDC, iproc: ICMENUMPROCW, param: LPARAM + ) -> c_int; + pub fn EnumMetaFile( + hdc: HDC, hmf: HMETAFILE, mproc: MFENUMPROC, param: LPARAM + ) -> BOOL; + pub fn EnumObjects( + hdc: HDC, nType: c_int, lpFunc: GOBJENUMPROC, lParam: LPARAM + ) -> c_int; + pub fn EqualRgn(hrgn1: HRGN, hrgn2: HRGN) -> BOOL; + pub fn Escape(hdc: HDC, iEscape: c_int, cjIn: c_int, pvIn: LPCSTR, pvOut: LPVOID) -> c_int; + // pub fn EudcLoadLinkW(); + // pub fn EudcUnloadLinkW(); + pub fn ExcludeClipRect(hdc: HDC, left: c_int, top: c_int, right: c_int, bottom: c_int) -> c_int; + pub fn ExtCreatePen( + iPenStyle: DWORD, cWidth: DWORD, plbrush: *const LOGBRUSH, cStyle: DWORD, pstyle: *const DWORD + ) -> HPEN; + pub fn ExtCreateRegion(lpx: *const XFORM, nCount: DWORD, lpData: *const RGNDATA) -> HRGN; + pub fn ExtEscape( + hdc: HDC, iEscape: c_int, cjInput: c_int, lpInData: LPCSTR, cjOutput: c_int, lpOutData: LPSTR + ) -> c_int; + pub fn ExtFloodFill(hdc: HDC, x: c_int, y: c_int, color: COLORREF, utype: UINT) -> BOOL; + pub fn ExtSelectClipRgn(hdc: HDC, hrgn: HRGN, mode: c_int) -> c_int; + pub fn ExtTextOutA( + hdc: HDC, x: c_int, y: c_int, options: UINT, lprect: *const RECT, lpString: LPCSTR, c: UINT, + lpDx: *const INT + ) -> BOOL; + pub fn ExtTextOutW( + hdc: HDC, x: c_int, y: c_int, options: UINT, lprect: *const RECT, lpString: LPCWSTR, c: UINT, + lpDx: *const INT + ) -> BOOL; + pub fn FillPath(hdc: HDC) -> BOOL; + pub fn FillRgn(hdc: HDC, hrgn: HRGN, hbr: HBRUSH) -> BOOL; + pub fn FixBrushOrgEx(hdc: HDC, x: c_int, y: c_int, ptl: LPPOINT) -> BOOL; + pub fn FlattenPath(hdc: HDC) -> BOOL; + pub fn FloodFill(hdc: HDC, x: c_int, y: c_int, color: COLORREF) -> BOOL; + pub fn FrameRgn(hdc: HDC, hrgn: HRGN, hbr: HBRUSH, w: c_int, h: c_int) -> BOOL; + pub fn GdiAlphaBlend( + hdcDest: HDC, xoriginDest: c_int, yoriginDest: c_int, wDest: c_int, hDest: c_int, + hdcSrc: HDC, xoriginSrc: c_int, yoriginSrc: c_int, wSrc: c_int, hSrc: c_int, + ftn: BLENDFUNCTION + ) -> BOOL; + // pub fn GdiArtificialDecrementDriver(); + pub fn GdiComment(hdc: HDC, nSize: UINT, lpData: *const BYTE) -> BOOL; + // pub fn GdiDeleteSpoolFileHandle(); + // pub fn GdiEndDocEMF(); + // pub fn GdiEndPageEMF(); + pub fn GdiFlush() -> BOOL; + pub fn GdiGetBatchLimit() -> DWORD; + // pub fn GdiGetDC(); + // pub fn GdiGetDevmodeForPage(); + // pub fn GdiGetPageCount(); + // pub fn GdiGetPageHandle(); + // pub fn GdiGetSpoolFileHandle(); + pub fn GdiGradientFill( + hdc: HDC, pVertex: PTRIVERTEX, nVertex: ULONG, pMesh: PVOID, nCount: ULONG, ulMode: ULONG + ) -> BOOL; + // pub fn GdiPlayDCScript(); + // pub fn GdiPlayEMF(); + // pub fn GdiPlayJournal(); + // pub fn GdiPlayPageEMF(); + // pub fn GdiPlayPrivatePageEMF(); + // pub fn GdiPlayScript(); + // pub fn GdiResetDCEMF(); + pub fn GdiSetBatchLimit(dw: DWORD) -> DWORD; + // pub fn GdiStartDocEMF(); + // pub fn GdiStartPageEMF(); + pub fn GdiTransparentBlt( + hdcDest: HDC, xoriginDest: c_int, yoriginDest: c_int, wDest: c_int, hDest: c_int, hdcSrc: HDC, + xoriginSrc: c_int, yoriginSrc: c_int, wSrc: c_int, hSrc: c_int, crTransparent: UINT + ) -> BOOL; + pub fn GetArcDirection(hdc: HDC) -> c_int; + pub fn GetAspectRatioFilterEx(hdc: HDC, lpsize: LPSIZE) -> BOOL; + pub fn GetBitmapBits(hbit: HBITMAP, cb: LONG, lpvBits: LPVOID) -> LONG; + pub fn GetBitmapDimensionEx(hbit: HBITMAP, lpsize: LPSIZE) -> BOOL; + pub fn GetBkColor(hdc: HDC) -> COLORREF; + pub fn GetBkMode(hdc: HDC) -> c_int; + pub fn GetBoundsRect(hdc: HDC, lprect: LPRECT, flags: UINT) -> UINT; + pub fn GetBrushOrgEx(hdc: HDC, lppt: LPPOINT) -> BOOL; + pub fn GetCharABCWidthsA( hdc: HDC, wFirst: UINT, wLast: UINT, lpABC: LPABC) -> BOOL; + pub fn GetCharABCWidthsFloatA( + hdc: HDC, iFirst: UINT, iLast: UINT, lpABC: LPABCFLOAT + ) -> BOOL; + pub fn GetCharABCWidthsFloatW( + hdc: HDC, iFirst: UINT, iLast: UINT, lpABC: LPABCFLOAT + ) -> BOOL; + pub fn GetCharABCWidthsI(hdc: HDC, giFirst: UINT, cgi: UINT, pgi: LPWORD, pabc: LPABC) -> BOOL; + pub fn GetCharABCWidthsW(hdc: HDC, wFirst: UINT, wLast: UINT, lpABC: LPABC) -> BOOL; + pub fn GetCharWidth32A(hdc: HDC, iFirst: UINT, iLast: UINT, lpBuffer: LPINT) -> BOOL; + pub fn GetCharWidth32W(hdc: HDC, iFirst: UINT, iLast: UINT, lpBuffer: LPINT) -> BOOL; + pub fn GetCharWidthA(hdc: HDC, iFirst: UINT, iLast: UINT, lpBuffer: LPINT) -> BOOL; + pub fn GetCharWidthFloatA(hdc: HDC, iFirst: UINT, iLast: UINT, lpBuffer: PFLOAT) -> BOOL; + pub fn GetCharWidthFloatW(hdc: HDC, iFirst: UINT, iLast: UINT, lpBuffer: PFLOAT) -> BOOL; + pub fn GetCharWidthI(hdc: HDC, giFirst: UINT, cgi: UINT, pgi: LPWORD, piWidths: LPINT) -> BOOL; + pub fn GetCharWidthW(hdc: HDC, iFirst: UINT, iLast: UINT, lpBuffer: LPINT) -> BOOL; + pub fn GetCharacterPlacementA( + hdc: HDC, lpString: LPCSTR, nCount: c_int, nMexExtent: c_int, lpResults: LPGCP_RESULTSA, + dwFlags: DWORD + ) -> DWORD; + pub fn GetCharacterPlacementW( + hdc: HDC, lpString: LPCWSTR, nCount: c_int, nMexExtent: c_int, lpResults: LPGCP_RESULTSW, + dwFlags: DWORD + ) -> DWORD; + pub fn GetClipBox(hdc: HDC, lprect: LPRECT) -> c_int; + pub fn GetClipRgn(hdc: HDC, hrgn: HRGN) -> c_int; + pub fn GetColorAdjustment(hdc: HDC, lpca: LPCOLORADJUSTMENT) -> BOOL; + pub fn GetColorSpace(hdc: HDC) -> HCOLORSPACE; + pub fn GetCurrentObject(hdc: HDC, tp: UINT) -> HGDIOBJ; + pub fn GetCurrentPositionEx(hdc: HDC, lppt: LPPOINT) -> BOOL; + pub fn GetDCBrushColor(hdc: HDC) -> COLORREF; + pub fn GetDCOrgEx(hdc: HDC, lppt: LPPOINT) -> BOOL; + pub fn GetDCPenColor(hdc: HDC) -> COLORREF; + pub fn GetDIBColorTable(hdc: HDC, iStart: UINT, cEntries: UINT, prgbq: *mut RGBQUAD) -> UINT; + pub fn GetDIBits( + hdc: HDC, hbm: HBITMAP, start: UINT, cLines: UINT, lpvBits: LPVOID, lpbmi: LPBITMAPINFO, + usage: UINT + ) -> c_int; + pub fn GetDeviceCaps(hdc: HDC, nIndex: c_int) -> c_int; + pub fn GetDeviceGammaRamp(hdc: HDC, lpRamp: LPVOID) -> BOOL; + pub fn GetEnhMetaFileA(lpName: LPCSTR) -> HENHMETAFILE; + pub fn GetEnhMetaFileBits(hEMF: HENHMETAFILE, nSize: UINT, lpData: LPBYTE) -> UINT; + pub fn GetEnhMetaFileDescriptionA(hemf: HENHMETAFILE, cchBuffer: UINT, lpDescription: LPSTR) -> UINT; + pub fn GetEnhMetaFileDescriptionW(hemf: HENHMETAFILE, cchBuffer: UINT, lpDescription: LPWSTR) -> UINT; + pub fn GetEnhMetaFileHeader( + hemf: HENHMETAFILE, nSize: UINT, lpEnhMetaHeader: LPENHMETAHEADER + ) -> UINT; + pub fn GetEnhMetaFilePaletteEntries( + hemf: HENHMETAFILE, nNumEntries: UINT, lpPaletteEntries: LPPALETTEENTRY + ) -> UINT; + pub fn GetEnhMetaFilePixelFormat( + hemf: HENHMETAFILE, cbBuffer: UINT, ppfd: *mut PIXELFORMATDESCRIPTOR + ) -> UINT; + pub fn GetEnhMetaFileW(lpName: LPCWSTR) -> HENHMETAFILE; + // pub fn GetFontAssocStatus(); + pub fn GetFontData( + hdc: HDC, dwTable: DWORD, dwOffset: DWORD, pvBuffer: PVOID, cjBuffer: DWORD + ) -> DWORD; + pub fn GetFontLanguageInfo(hdc: HDC) -> DWORD; + // pub fn GetFontResourceInfoW(); + pub fn GetFontUnicodeRanges(hdc: HDC, lpgs: LPGLYPHSET) -> DWORD; + pub fn GetGlyphIndicesA(hdc: HDC, lpstr: LPCSTR, c: c_int, pgi: LPWORD, fl: DWORD) -> DWORD; + pub fn GetGlyphIndicesW(hdc: HDC, lpstr: LPCWSTR, c: c_int, pgi: LPWORD, fl: DWORD) -> DWORD; + // pub fn GetGlyphOutline(); + pub fn GetGlyphOutlineA( + hdc: HDC, uChar: UINT, fuFormat: UINT, lpgm: LPGLYPHMETRICS, cjBuffer: DWORD, + pvBuffer: LPVOID, lpmat2: *const MAT2 + ) -> DWORD; + pub fn GetGlyphOutlineW( + hdc: HDC, uChar: UINT, fuFormat: UINT, lpgm: LPGLYPHMETRICS, cjBuffer: DWORD, + pvBuffer: LPVOID, lpmat2: *const MAT2 + ) -> DWORD; + pub fn GetGraphicsMode(hdc: HDC) -> c_int; + pub fn GetICMProfileA(hdc: HDC, pBufSize: LPDWORD, pszFilename: LPSTR) -> BOOL; + pub fn GetICMProfileW(hdc: HDC, pBufSize: LPDWORD, pszFilename: LPWSTR) -> BOOL; + // pub fn GetKerningPairs(); + pub fn GetKerningPairsA(hdc: HDC, nPairs: DWORD, lpKernPair: LPKERNINGPAIR) -> DWORD; + pub fn GetKerningPairsW(hdc: HDC, nPairs: DWORD, lpKernPair: LPKERNINGPAIR) -> DWORD; + pub fn GetLayout(hdc: HDC) -> DWORD; + pub fn GetLogColorSpaceA( + hColorSpace: HCOLORSPACE, lpBuffer: LPLOGCOLORSPACEA, nSize: DWORD + ) -> BOOL; + pub fn GetLogColorSpaceW( + hColorSpace: HCOLORSPACE, lpBuffer: LPLOGCOLORSPACEW, nSize: DWORD + ) -> BOOL; + pub fn GetMapMode(hdc: HDC) -> c_int; + pub fn GetMetaFileA(lpName: LPCSTR) -> HMETAFILE; + pub fn GetMetaFileBitsEx(hMF: HMETAFILE, cbBuffer: UINT, lpData: LPVOID) -> UINT; + pub fn GetMetaFileW(lpName: LPCWSTR) -> HMETAFILE; + pub fn GetMetaRgn(hdc: HDC, hrgn: HRGN) -> c_int; + pub fn GetMiterLimit(hdc: HDC, plimit: PFLOAT) -> BOOL; + pub fn GetNearestColor(hdc: HDC, color: COLORREF) -> COLORREF; + pub fn GetNearestPaletteIndex(h: HPALETTE, color: COLORREF) -> UINT; + pub fn GetObjectA(h: HANDLE, c: c_int, pv: LPVOID) -> c_int; + pub fn GetObjectType(h: HGDIOBJ) -> DWORD; + pub fn GetObjectW(h: HANDLE, c: c_int, pv: LPVOID) -> c_int; + pub fn GetOutlineTextMetricsA(hdc: HDC, cjCopy: UINT, potm: LPOUTLINETEXTMETRICA) -> UINT; + pub fn GetOutlineTextMetricsW(hdc: HDC, cjCopy: UINT, potm: LPOUTLINETEXTMETRICW) -> UINT; + pub fn GetPaletteEntries( + hpal: HPALETTE, iStart: UINT, cEntries: UINT, pPalEntries: LPPALETTEENTRY + ) -> UINT; + pub fn GetPath(hdc: HDC, apt: LPPOINT, aj: LPBYTE, cpt: c_int) -> c_int; + pub fn GetPixel(hdc: HDC, x: c_int, y: c_int) -> COLORREF; + pub fn GetPixelFormat(hdc: HDC) -> c_int; + pub fn GetPolyFillMode(hdc: HDC) -> c_int; + pub fn GetROP2(hdc: HDC) -> c_int; + pub fn GetRandomRgn (hdc: HDC, hrgn: HRGN, i: INT) -> c_int; + pub fn GetRasterizerCaps(lpraststat: LPRASTERIZER_STATUS, cjBytes: UINT) -> BOOL; + pub fn GetRegionData(hrgn: HRGN, nCount: DWORD, lpRgnData: LPRGNDATA) -> DWORD; + // pub fn GetRelAbs(); + pub fn GetRgnBox(hrgn: HRGN, lprc: LPRECT) -> c_int; + pub fn GetStockObject(i: c_int) -> HGDIOBJ; + pub fn GetStretchBltMode(hdc: HDC) -> c_int; + pub fn GetSystemPaletteEntries(hdc: HDC, iStart: UINT, cEntries: UINT, pPalEntries: LPPALETTEENTRY) -> UINT; + pub fn GetSystemPaletteUse(hdc: HDC) -> UINT; + pub fn GetTextAlign(hdc: HDC) -> UINT; + pub fn GetTextCharacterExtra(hdc: HDC) -> c_int; + pub fn GetTextCharset(hdc: HDC) -> c_int; + pub fn GetTextCharsetInfo(hdc: HDC, lpSig: LPFONTSIGNATURE, dwFlags: DWORD) -> c_int; + pub fn GetTextColor(hdc: HDC) -> COLORREF; + pub fn GetTextExtentExPointA( + hdc: HDC, lpszString: LPCSTR, cchString: c_int, nMaxExtent: c_int, lpnFit: LPINT, + lpnDx: LPINT, lpSize: LPSIZE + ) -> BOOL; + pub fn GetTextExtentExPointI(hdc: HDC, lpwszString: LPWORD, cwchString: c_int, nMaxExtent: c_int, + lpnFit: LPINT, lpnDx: LPINT, lpSize: LPSIZE + ) -> BOOL; + pub fn GetTextExtentExPointW( + hdc: HDC, lpszString: LPCWSTR, cchString: c_int, nMaxExtent: c_int, lpnFit: LPINT, + lpnDx: LPINT, lpSize: LPSIZE + ) -> BOOL; + pub fn GetTextExtentPoint32A(hdc: HDC, lpString: LPCSTR, c: c_int, psizl: LPSIZE) -> BOOL; + pub fn GetTextExtentPoint32W(hdc: HDC, lpString: LPCWSTR, c: c_int, psizl: LPSIZE) -> BOOL; + pub fn GetTextExtentPointA(hdc: HDC, lpString: LPCSTR, c: c_int, lpsz: LPSIZE) -> BOOL; + pub fn GetTextExtentPointI(hdc: HDC, pgiIn: LPWORD, cgi: c_int, psize: LPSIZE) -> BOOL; + pub fn GetTextExtentPointW(hdc: HDC, lpString: LPCWSTR, c: c_int, lpsz: LPSIZE) -> BOOL; + pub fn GetTextFaceA(hdc: HDC, c: c_int, lpName: LPSTR) -> c_int; + pub fn GetTextFaceW(hdc: HDC, c: c_int, lpName: LPWSTR) -> c_int; + pub fn GetTextMetricsA(hdc: HDC, lptm: LPTEXTMETRICA) -> BOOL; + pub fn GetTextMetricsW(hdc: HDC, lptm: *mut TEXTMETRICW) -> BOOL; + pub fn GetViewportExtEx(hdc: HDC, lpsize: LPSIZE) -> BOOL; + pub fn GetViewportOrgEx(hdc: HDC, lppoint: LPPOINT) -> BOOL; + pub fn GetWinMetaFileBits( + hemf: HENHMETAFILE, cbData16: UINT, pData16: LPBYTE, iMapMode: INT, hdcRef: HDC + ) -> UINT; + pub fn GetWindowExtEx(hdc: HDC, lpsize: LPSIZE) -> BOOL; + pub fn GetWindowOrgEx(hdc: HDC, lppoint: LPPOINT) -> BOOL; + pub fn GetWorldTransform(hdc: HDC, lpxf: LPXFORM) -> BOOL; + pub fn IntersectClipRect( + hdc: HDC, left: c_int, top: c_int, right: c_int, bottom: c_int + ) -> c_int; + pub fn InvertRgn(hdc: HDC, hrgn: HRGN) -> BOOL; + pub fn LPtoDP(hdc: HDC, lppt: LPPOINT, c: c_int) -> BOOL; + pub fn LineDDA( + nXStart: c_int, nYStart: c_int, nXEnd: c_int, nYEnd: c_int, lpLineFunc: LINEDDAPROC, + lpData: LPARAM, + ) -> BOOL; + pub fn LineTo(hdc: HDC, nXEnd: c_int, nYEnd: c_int) -> BOOL; + pub fn MaskBlt( + hdcDest: HDC, xDest: c_int, yDest: c_int, width: c_int, height: c_int, hdcSrc: HDC, + xSrc: c_int, ySrc: c_int, hbmMask: HBITMAP, xMask: c_int, yMask: c_int, rop: DWORD + ) -> BOOL; + pub fn ModifyWorldTransform(hdc: HDC, lpxf: *const XFORM, mode: DWORD) -> BOOL; + pub fn MoveToEx(hdc: HDC, X: c_int, Y: c_int, lpPoint:LPPOINT) -> BOOL; + pub fn OffsetClipRgn(hdc: HDC, x: c_int, y: c_int) -> c_int; + pub fn OffsetRgn(hrgn: HRGN, x: c_int, y: c_int) -> c_int; + pub fn OffsetViewportOrgEx(hdc: HDC, x: c_int, y: c_int, lppt: LPPOINT) -> BOOL; + pub fn OffsetWindowOrgEx(hdc: HDC, x: c_int, y: c_int, lppt: LPPOINT) -> BOOL; + pub fn PaintRgn(hdc: HDC, hrgn: HRGN) -> BOOL; + pub fn PatBlt( + hdc: HDC, nXLeft: c_int, nYLeft: c_int, nWidth: c_int, nHeight: c_int, dwRop: DWORD, + ) -> BOOL; + pub fn PathToRegion(hdc: HDC) -> HRGN; + pub fn Pie( + hdc: HDC, nLeftRect: c_int, nTopRect: c_int, nRightRect: c_int, nBottomRect: c_int, nXRadial1: c_int, + nYRadial1: c_int, nXRadial2: c_int, nYRadial2: c_int, + ) -> BOOL; + pub fn PlayEnhMetaFile(hdc: HDC, hmf: HENHMETAFILE, lprect: *const RECT) -> BOOL; + pub fn PlayEnhMetaFileRecord( + hdc: HDC, pht: LPHANDLETABLE, pmr: *const ENHMETARECORD,cht: UINT + ) -> BOOL; + pub fn PlayMetaFile(hdc: HDC, hmf: HMETAFILE) -> BOOL; + pub fn PlayMetaFileRecord(hdc: HDC, lpHandleTable: LPHANDLETABLE, lpMR: LPMETARECORD, noObjs: UINT) -> BOOL; + pub fn PlgBlt(hdcDest: HDC, lpPoint: *const POINT, hdcSrc: HDC, xSrc: c_int, ySrc: c_int, + width: c_int, height: c_int, hbmMask: HBITMAP, xMask: c_int, yMask: c_int + ) -> BOOL; + pub fn PolyBezier(hdc: HDC, lppt: *const POINT, cPoints: DWORD) -> BOOL; + pub fn PolyBezierTo(hdc: HDC, lppt: *const POINT, cPoints: DWORD) -> BOOL; + pub fn PolyDraw(hdc: HDC, lppt: *const POINT, lpbTypes: *const BYTE, cCount: c_int) -> BOOL; + pub fn PolyPolygon( + hdc: HDC, lpPoints: *const POINT, lpPolyCounts: *const INT, cCount: DWORD, + ) -> BOOL; + pub fn PolyPolyline( + hdc: HDC, lppt: *const POINT, lpdwPolyPoints: *const DWORD, cCount: DWORD, + ) -> BOOL; + pub fn PolyTextOutA(hdc: HDC, ppt: *const POLYTEXTA, nstrings: c_int) -> BOOL; + pub fn PolyTextOutW(hdc: HDC, ppt: *const POLYTEXTW, nstrings: c_int) -> BOOL; + pub fn Polygon(hdc: HDC, lpPoints: *const POINT, nCount: c_int) -> BOOL; + pub fn Polyline(hdc: HDC, lppt: *const POINT, cCount: c_int) -> BOOL; + pub fn PolylineTo(hdc: HDC, lppt: *const POINT, cCount: DWORD) -> BOOL; + pub fn PtInRegion(hrgn: HRGN, x: c_int, y: c_int) -> BOOL; + pub fn PtVisible(hdc: HDC, x: c_int, y: c_int) -> BOOL; + pub fn RealizePalette(hdc: HDC) -> UINT; + pub fn RectInRegion(hrgn: HRGN, lprect: *const RECT) -> BOOL; + pub fn RectVisible(hdc: HDC, lprect: *const RECT) -> BOOL; + pub fn Rectangle(hdc: HDC, left: c_int, top: c_int, right: c_int, bottom: c_int) -> BOOL; + pub fn RemoveFontMemResourceEx(h: HANDLE) -> BOOL; + pub fn RemoveFontResourceA(lpFileName: LPCSTR) -> BOOL; + pub fn RemoveFontResourceExA(name: LPCSTR, fl: DWORD, pdv: PVOID) -> BOOL; + pub fn RemoveFontResourceExW(name: LPCWSTR, fl: DWORD, pdv: PVOID) -> BOOL; + pub fn RemoveFontResourceW(lpFileName: LPCWSTR) -> BOOL; + pub fn ResetDCA(hdc: HDC, lpdm: *const DEVMODEA) -> HDC; + pub fn ResetDCW(hdc: HDC, lpdm: *const DEVMODEW) -> HDC; + pub fn ResizePalette(hpal: HPALETTE, n: UINT) -> BOOL; + pub fn RestoreDC(hdc: HDC, nSavedDC: c_int) -> BOOL; + pub fn RoundRect( + hdc: HDC, nLeftRect: c_int, nTopRect: c_int, nRightRect: c_int, nBottomRect: c_int, + nWidth: c_int, nHeight: c_int, + ) -> BOOL; + pub fn SaveDC(hdc: HDC) -> c_int; + pub fn ScaleViewportExtEx( + hdc: HDC,xn: c_int, dx: c_int, yn: c_int, yd: c_int, lpsz: LPSIZE + ) -> BOOL; + pub fn ScaleWindowExtEx( + hdc: HDC, xn: c_int, xd: c_int, yn: c_int, yd: c_int, lpsz: LPSIZE + ) -> BOOL; + // pub fn SelectBrushLocal(); + pub fn SelectClipPath(hdc: HDC, mode: c_int) -> BOOL; + pub fn SelectClipRgn(hdc: HDC, hrgn: HRGN) -> c_int; + // pub fn SelectFontLocal(); + pub fn SelectObject(hdc: HDC, h: HGDIOBJ) -> HGDIOBJ; + pub fn SelectPalette(hdc: HDC, hPal: HPALETTE, bForceBkgd: BOOL) -> HPALETTE; + pub fn SetAbortProc(hdc: HDC, aproc: ABORTPROC) -> c_int; + pub fn SetArcDirection(hdc: HDC, ArcDirection: c_int) -> c_int; + pub fn SetBitmapBits(hbm: HBITMAP, cb: DWORD, pvBits: *const VOID) -> LONG; + pub fn SetBitmapDimensionEx(hbm: HBITMAP, w: c_int, h: c_int, lpsz: LPSIZE) -> BOOL; + pub fn SetBkColor(hdc: HDC, color: COLORREF) -> COLORREF; + pub fn SetBkMode(hdc: HDC, mode: c_int) -> c_int; + pub fn SetBoundsRect(hdc: HDC, lprect: *const RECT, flags: UINT) -> UINT; + pub fn SetBrushOrgEx(hdc: HDC, x: c_int, y: c_int, lppt: LPPOINT) -> BOOL; + pub fn SetColorAdjustment(hdc: HDC, lpca: *const COLORADJUSTMENT) -> BOOL; + pub fn SetColorSpace(hdc: HDC, hcs: HCOLORSPACE) -> HCOLORSPACE; + pub fn SetDCBrushColor(hdc: HDC, color: COLORREF) -> COLORREF; + pub fn SetDCPenColor(hdc: HDC, color: COLORREF) -> COLORREF; + pub fn SetDIBColorTable(hdc: HDC, iStart: UINT, cEntries: UINT, prgbq: *const RGBQUAD) -> UINT; + pub fn SetDIBits( + hdc: HDC, hbm: HBITMAP, start: UINT, cLines: UINT, lpBits: *const VOID, + lpbmi: *const BITMAPINFO, ColorUse: UINT + ) -> c_int; + pub fn SetDIBitsToDevice( + hdc: HDC, xDest: c_int, yDest: c_int, w: DWORD, h: DWORD, xSrc: c_int, ySrc: c_int, + StartScan: UINT, cLines: UINT, lpvBits: *const VOID, lpbmi: *const BITMAPINFO, ColorUse: UINT + ) -> c_int; + pub fn SetDeviceGammaRamp(hdc: HDC, lpRamp: LPVOID) -> BOOL; + pub fn SetEnhMetaFileBits(nSize: UINT, pb: *const BYTE) -> HENHMETAFILE; + // pub fn SetFontEnumeration(); + pub fn SetGraphicsMode(hdc: HDC, iMode: c_int) -> c_int; + pub fn SetICMMode(hdc: HDC, mode: c_int) -> c_int; + pub fn SetICMProfileA(hdc: HDC, lpFileName: LPSTR) -> BOOL; + pub fn SetICMProfileW(hdc: HDC, lpFileName: LPWSTR) -> BOOL; + pub fn SetLayout(hdc: HDC, l: DWORD) -> DWORD; + // pub fn SetMagicColors(); + pub fn SetMapMode(hdc: HDC, mode: c_int) -> c_int; + pub fn SetMapperFlags(hdc: HDC, flags: DWORD) -> DWORD; + pub fn SetMetaFileBitsEx(cbBuffer: UINT, lpData: *const BYTE) -> HMETAFILE; + pub fn SetMetaRgn(hdc: HDC) -> c_int; + pub fn SetMiterLimit(hdc: HDC, limit: FLOAT, old: PFLOAT) -> BOOL; + pub fn SetPaletteEntries( + hpal: HPALETTE, iStart: UINT, cEntries: UINT, pPalEntries: *const PALETTEENTRY + ) -> UINT; + pub fn SetPixel(hdc: HDC, x: c_int, y: c_int, color: COLORREF) -> COLORREF; + pub fn SetPixelFormat( + hdc: HDC, iPixelFormat: c_int, ppfd: *const PIXELFORMATDESCRIPTOR, + ) -> BOOL; + pub fn SetPixelV(hdc: HDC, x: c_int, y: c_int, color: COLORREF) -> BOOL; + pub fn SetPolyFillMode(hdc: HDC, iPolyFillMode: c_int) -> c_int; + pub fn SetROP2(hdc: HDC, rop2: c_int) -> c_int; + pub fn SetRectRgn(hrgn: HRGN, left: c_int, top: c_int, right: c_int, bottom: c_int) -> BOOL; + // pub fn SetRelAbs(); + pub fn SetStretchBltMode(hdc: HDC, mode: c_int) -> c_int; + pub fn SetSystemPaletteUse(hdc: HDC, uuse: UINT) -> UINT; + pub fn SetTextAlign(hdc: HDC, align: UINT) -> UINT; + pub fn SetTextCharacterExtra(hdc: HDC, extra: c_int) -> c_int; + pub fn SetTextColor(hdc: HDC, color: COLORREF) -> COLORREF; + pub fn SetTextJustification(hdc: HDC, extra: c_int, count: c_int) -> BOOL; + pub fn SetViewportExtEx(hdc: HDC, x: c_int, y: c_int, lpsz: *mut SIZE) -> BOOL; + pub fn SetViewportOrgEx(hdc: HDC, x: c_int, y: c_int, lppt: *mut POINT) -> BOOL; + pub fn SetWinMetaFileBits( + nSize: UINT, lpMeta16Data: *const BYTE, hdcRef: HDC, lpMFP: *const METAFILEPICT + ) -> HENHMETAFILE; + pub fn SetWindowExtEx(hdc: HDC, x: c_int, y: c_int, lppt: *mut SIZE) -> BOOL; + pub fn SetWindowOrgEx(hdc: HDC, x: c_int, y: c_int, lppt: LPPOINT) -> BOOL; + pub fn SetWorldTransform(hdc: HDC, lpxf: *const XFORM) -> BOOL; + pub fn StartDocA(hdc: HDC, lpdi: *const DOCINFOA) -> c_int; + pub fn StartDocW(hdc: HDC, lpdi: *const DOCINFOW) -> c_int; + // pub fn StartFormPage(); + pub fn StartPage(hdc: HDC) -> c_int; + pub fn StretchBlt( + hdcDest: HDC, xDest: c_int, yDest: c_int, wDest: c_int, hDest: c_int, hdcSrc: HDC, + xSrc: c_int, ySrc: c_int, wSrc: c_int, hSrc: c_int, rop: DWORD + ) -> BOOL; + pub fn StretchDIBits( + hdc: HDC, XDest: c_int, YDest: c_int, nDestWidth: c_int, + nDestHeight: c_int, XSrc: c_int, YSrc: c_int, nSrcWidth: c_int, + nSrcHeight: c_int, lpBits: *const VOID, lpBitsInfo: *const BITMAPINFO, + iUsage: UINT, dwRop: DWORD, + ) -> c_int; + pub fn StrokeAndFillPath(hdc: HDC) -> BOOL; + pub fn StrokePath(hdc: HDC) -> BOOL; + pub fn SwapBuffers(hdc: HDC) -> BOOL; + pub fn TextOutA(hdc: HDC, x: c_int, y: c_int, lpString: LPCSTR, c: c_int) -> BOOL; + pub fn TextOutW(hdc: HDC, x: c_int, y: c_int, lpString: LPCWSTR, c: c_int) -> BOOL; + pub fn TranslateCharsetInfo( + lpSrc: *const DWORD, lpCs: LPCHARSETINFO, dwFlags: DWORD + ) -> BOOL; + pub fn UnrealizeObject(h: HGDIOBJ) -> BOOL; + pub fn UpdateColors(hdc: HDC) -> BOOL; + pub fn UpdateICMRegKeyA( + reserved: DWORD, lpszCMID: LPSTR, lpszFileName: LPSTR, command: UINT + ) -> BOOL; + pub fn UpdateICMRegKeyW( + reserved: DWORD, lpszCMID: LPWSTR, lpszFileName: LPWSTR, command: UINT + ) -> BOOL; + pub fn WidenPath(hdc: HDC) -> BOOL; + // pub fn gdiPlaySpoolStream(); +} diff --git a/third_party/rust/gl_generator/.cargo-checksum.json b/third_party/rust/gl_generator/.cargo-checksum.json new file mode 100644 index 000000000000..60bbf8fbbafe --- /dev/null +++ b/third_party/rust/gl_generator/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"45aea41e3c3f3bf616649f9f826bfe25b3910c6f39906a9fe8803c62dc8e4c8f","README.md":"d1c8edfeedee664271d3b462513477aa098359ede91d24179451705ec99db7b6","generators/debug_struct_gen.rs":"2fdbee9077f560479e06269564bd7d7550600b2687a66273abc08d96afd41cf1","generators/global_gen.rs":"1bcddeb9e2a7cd32ce0fd0b8eb5435c78246165975b2a3ebd799c8f4f7095c58","generators/mod.rs":"62e090f77e146cb4b0f4bb898c4b4754f6733b3fa6f51b73e349cb1b66fbeb31","generators/static_gen.rs":"5758fb47c6f33d24f38248f2b504ce7174414b01b9f25f8c22503f5e9493e549","generators/static_struct_gen.rs":"7c8d6bc8916276b43c5bc84da313a317bf277f13c502e11763587a30add3591b","generators/struct_gen.rs":"2795f531122f794070cdf0bf0d11baf0472d2afd611656bbc44563ac513ec67a","generators/templates/types/egl.rs":"10d4a1b0444960e00bdb37de5eed54588119233177faed86662efe20407df660","generators/templates/types/gl.rs":"eefc1aef9ed4751b4ffa8cbf498347555bc8d4f2650c50e78c2864dad5eb64fc","generators/templates/types/glx.rs":"5bdd0b621d1aac0c8dda8ffa95ce9c7a7614146ff129f18b3a36cf51c3985a61","generators/templates/types/wgl.rs":"f4d21c7c793df4a8256f7f496d2940987bf38a1c3acab06b57dfad2e29d4f713","lib.rs":"4d68840c600a1025025438454d68d70e6da3891f2a5bb33406d4255cb257cda1","registry/mod.rs":"8b901725292a2c4dbb2c882a83b2c05ffd1148af36c7cb9c2c0339e1bb661d7c","registry/parse.rs":"362ce237b7b6e9a71649e597e585281fda7e26e2c0d3694af357438129c7d7ef"},"package":"f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55"} \ No newline at end of file diff --git a/third_party/rust/gl_generator/.cargo-ok b/third_party/rust/gl_generator/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/gl_generator/Cargo.toml b/third_party/rust/gl_generator/Cargo.toml new file mode 100644 index 000000000000..444cfa502352 --- /dev/null +++ b/third_party/rust/gl_generator/Cargo.toml @@ -0,0 +1,26 @@ +[package] + +name = "gl_generator" +version = "0.5.2" +authors = ["Brendan Zabarauskas ", + "Corey Richardson", + "Arseny Kapoulkine" +] +description = "Code generators for creating bindings to the Khronos OpenGL APIs." +license = "Apache-2.0" + +homepage = "https://github.com/bjz/gl-rs/gl_generator/" +repository = "https://github.com/bjz/gl-rs/" +readme = "README.md" + +[lib] +name = "gl_generator" +path = "lib.rs" + +[features] +unstable_generator_utils = [] + +[dependencies] +khronos_api = { version = "1.0.0", path = "../khronos_api" } +log = "0.3.5" +xml-rs = "0.3.0" diff --git a/third_party/rust/gl_generator/README.md b/third_party/rust/gl_generator/README.md new file mode 100644 index 000000000000..e870a2c21f31 --- /dev/null +++ b/third_party/rust/gl_generator/README.md @@ -0,0 +1,165 @@ +# gl_generator + +[![Version](https://img.shields.io/crates/v/gl_generator.svg)](https://crates.io/crates/gl_generator) +[![License](https://img.shields.io/crates/l/gl_generator.svg)](https://github.com/bjz/gl-rs/blob/master/LICENSE) +[![Downloads](https://img.shields.io/crates/d/gl_generator.svg)](https://crates.io/crates/gl_generator) + +Code generators for creating bindings to the Khronos OpenGL APIs. + +## Usage + +If you need a specific version of OpenGL, or you need a different API +(OpenGL ES, EGL, WGL, GLX), or if you need certain extensions, you should use +the `gl_generator` plugin instead. + +See [gfx_gl](https://github.com/gfx-rs/gfx_gl) for an example of using a +custom gfx-rs loader for a project. + +Add this to your `Cargo.toml`: + +```toml +[build-dependencies] +gl_generator = "0.5.0" +``` + +Under the `[package]` section, add: + +```toml +build = "build.rs" +``` + +Create a `build.rs` to pull your specific version/API: + +```rust +extern crate gl_generator; + +use gl_generator::{Registry, Api, Profile, Fallbacks, GlobalGenerator}; +use std::env; +use std::fs::File; +use std::path::Path; + +fn main() { + let dest = env::var("OUT_DIR").unwrap(); + let mut file = File::create(&Path::new(&dest).join("bindings.rs")).unwrap(); + + Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); +} +``` + +Then use it like this: + +```rust +mod gl { + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +} + +/// Simple loading example +fn main() { + let window = ...; + + // Assuming `window` is GLFW: initialize, and made current + gl::load_with(|s| window.get_proc_address(s)); +} +``` + +The `build.rs` file will generate all the OpenGL functions in a file named, +`bindings.rs` plus all enumerations, and all types in the `types` submodule. + +## Generator types + +### Global generator + +The global generator is the one used by default by the `gl` crate. See above +for more details. + +### Struct generator + +The struct generator is a cleaner alternative to the global generator. + +The main difference is that you must call `gl::Gl::load_with` instead of +`gl::load_with`, and this functions returns a struct of type `Gl`. The OpenGL +functions are not static functions but member functions in this `Gl` struct. +This is important when the GL functions are associated with the current +context, as is true on Windows. + +The enumerations and types are still static and available in a similar way as +in the global generator. + +### Static generator + +The static generator generates plain old bindings. You don't need to load the +functions. + +This generator should only be used only if the platform you are compiling for +is guaranteed to support the requested API. Otherwise you will get a +compilation error. +For example, you can use it for WGL and OpenGL 1.1 on Windows or GLX and +OpenGL 1.3 on Linux, because Windows and Linux are guaranteed to provide +implementations for these APIs. + +You will need to manually provide the linkage. For example to use WGL or +OpenGL 1.1 on Windows, you will need to add +`#[link="OpenGL32.lib"] extern {}` somewhere in your code. + +### Custom Generators + +The `gl_generator` can be extended with custom generators. This is a niche +feature useful only in very rare cases. To create a custom generator, implement +the `gl_generator::Generator` trait. See the source of the +`gl_generator::generators` module for examples. + +Various utility functions are provided in the `generators` module, but the api +is unstable, so it has been placed behind a feature flag. In access these +functions, you will need to add the `"unstable_generator_utils"` feature to +your `Cargo.toml`: + +```toml +[build-dependencies.gl_generator] +version = "0.4.2" +features = ["unstable_generator_utils"] +``` + +## Extra features + +The global and struct generators will attempt to use fallbacks functions when +they are available. For example, if `glGenFramebuffers` cannot be loaded it will +also attempt to load `glGenFramebuffersEXT` as a fallback. + +## Changelog + +### v0.5.0 + +- Rename `Ns` to `API`, and expose at the top level +- Remove the need for clients to depend on the `khronos_api` crate by + determining the XML source based on the requested `API` +- Use a `(u8, u8)` instead of a string for the target version number +- Use a `Profile` enum instead of a string for the profile +- Remove unused fields from `Registry` +- Accept types satisfying `AsRef<[&str]>` for extension lists +- Separate parsing and generation stages in API +- Hide `registry::{Feature, Filter, Require, Remove, Extension}` types from the + public API +- Move `registry::{Fallbacks, Api, Profile}` types to top level module +- Remove `GlxOpcode::type` field +- Make `ty` fields on `Enum` and `Binding` take `Cow<'static, str>`s to reduce + allocations + +### v0.4.2 + +- Update crate metadata + +### v0.4.1 + +- Upgrade `khronos_api` to v1.0.0 + +### v0.4.0 + +- Upgrade `xml-rs` to v0.2.2 +- Use `raw::c_void` for `GLvoid` +- Remove `registry::{Group, EnumNs, CmdNs}` +- Remove `groups` field from `registry::Registry` +- Remove `is_safe` field from `registry::Cmd` +- Remove `comment` field from `registry::{Require, Remove, GlxOpcode}` +- Downgrade `khronos_api` to be a dev-dependency diff --git a/third_party/rust/gl_generator/generators/debug_struct_gen.rs b/third_party/rust/gl_generator/generators/debug_struct_gen.rs new file mode 100644 index 000000000000..dbb70edd1b07 --- /dev/null +++ b/third_party/rust/gl_generator/generators/debug_struct_gen.rs @@ -0,0 +1,239 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +use registry::Registry; +use std::io; + +#[allow(missing_copy_implementations)] +pub struct DebugStructGenerator; + +impl super::Generator for DebugStructGenerator { + fn write(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(write_header(dest)); + try!(write_type_aliases(registry, dest)); + try!(write_enums(registry, dest)); + try!(write_fnptr_struct_def(dest)); + try!(write_panicking_fns(registry, dest)); + try!(write_struct(registry, dest)); + try!(write_impl(registry, dest)); + Ok(()) + } +} + +/// Creates a `__gl_imports` module which contains all the external symbols that we need for the +/// bindings. +fn write_header(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, r#" + mod __gl_imports {{ + pub use std::mem; + pub use std::marker::Send; + pub use std::os::raw; + }} + "#) +} + +/// Creates a `types` module which contains all the type aliases. +/// +/// See also `generators::gen_types`. +fn write_type_aliases(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, r#" + pub mod types {{ + #![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)] + "#)); + + try!(super::gen_types(registry.api, dest)); + + writeln!(dest, "}}") +} + +/// Creates all the `` elements at the root of the bindings. +fn write_enums(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + for enm in ®istry.enums { + try!(super::gen_enum_item(enm, "types::", dest)); + } + + Ok(()) +} + +/// Creates a `FnPtr` structure which contains the store for a single binding. +fn write_fnptr_struct_def(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, " + #[allow(dead_code, missing_copy_implementations)] + #[derive(Clone)] + pub struct FnPtr {{ + /// The function pointer that will be used when calling the function. + f: *const __gl_imports::raw::c_void, + /// True if the pointer points to a real function, false if points to a `panic!` fn. + is_loaded: bool, + }} + + impl FnPtr {{ + /// Creates a `FnPtr` from a load attempt. + fn new(ptr: *const __gl_imports::raw::c_void) -> FnPtr {{ + if ptr.is_null() {{ + FnPtr {{ + f: missing_fn_panic as *const __gl_imports::raw::c_void, + is_loaded: false + }} + }} else {{ + FnPtr {{ f: ptr, is_loaded: true }} + }} + }} + + /// Returns `true` if the function has been successfully loaded. + /// + /// If it returns `false`, calling the corresponding function will fail. + #[inline] + #[allow(dead_code)] + pub fn is_loaded(&self) -> bool {{ + self.is_loaded + }} + }} + ") +} + +/// Creates a `panicking` module which contains one function per GL command. +/// +/// These functions are the mocks that are called if the real function could not be loaded. +fn write_panicking_fns(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, + "#[inline(never)] + fn missing_fn_panic() -> ! {{ + panic!(\"{api} function was not loaded\") + }}", + api = registry.api + ) +} + +/// Creates a structure which stores all the `FnPtr` of the bindings. +/// +/// The name of the struct corresponds to the namespace. +fn write_struct(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, " + #[allow(non_camel_case_types, non_snake_case, dead_code)] + #[derive(Clone)] + pub struct {api} {{", + api = super::gen_struct_name(registry.api) + )); + + for cmd in ®istry.cmds { + if let Some(v) = registry.aliases.get(&cmd.proto.ident) { + try!(writeln!(dest, "/// Fallbacks: {}", v.join(", "))); + } + try!(writeln!(dest, "pub {name}: FnPtr,", name = cmd.proto.ident)); + } + + writeln!(dest, "}}") +} + +/// Creates the `impl` of the structure created by `write_struct`. +fn write_impl(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, + "impl {api} {{ + /// Load each OpenGL symbol using a custom load function. This allows for the + /// use of functions like `glfwGetProcAddress` or `SDL_GL_GetProcAddress`. + /// + /// ~~~ignore + /// let gl = Gl::load_with(|s| glfw.get_proc_address(s)); + /// ~~~ + #[allow(dead_code, unused_variables)] + pub fn load_with(mut loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{ + #[inline(never)] + fn do_metaloadfn(loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void, + symbol: &str, + symbols: &[&str]) + -> *const __gl_imports::raw::c_void {{ + let mut ptr = loadfn(symbol); + if ptr.is_null() {{ + for &sym in symbols {{ + ptr = loadfn(sym); + if !ptr.is_null() {{ break; }} + }} + }} + ptr + }} + let mut metaloadfn = |symbol: &str, symbols: &[&str]| {{ + do_metaloadfn(&mut loadfn, symbol, symbols) + }}; + {api} {{", + api = super::gen_struct_name(registry.api) + )); + + for cmd in ®istry.cmds { + try!(writeln!(dest, + "{name}: FnPtr::new(metaloadfn(\"{symbol}\", &[{fallbacks}])),", + name = cmd.proto.ident, + symbol = super::gen_symbol_name(registry.api, &cmd.proto.ident), + fallbacks = match registry.aliases.get(&cmd.proto.ident) { + Some(fbs) => { + fbs.iter() + .map(|name| format!("\"{}\"", super::gen_symbol_name(registry.api, &name))) + .collect::>().join(", ") + }, + None => format!(""), + }, + )) + } + + try!(writeln!(dest, + "}} + }}" + )); + + for cmd in ®istry.cmds { + let idents = super::gen_parameters(cmd, true, false); + let typed_params = super::gen_parameters(cmd, false, true); + let println = format!("println!(\"[OpenGL] {}({})\" {});", + cmd.proto.ident, + (0 .. idents.len()).map(|_| "{:?}".to_string()).collect::>().join(", "), + idents.iter().zip(typed_params.iter()) + .map(|(name, ty)| { + if ty.contains("GLDEBUGPROC") { + format!(", \"\"") + } else { + format!(", {}", name) + } + }).collect::>().concat()); + + try!(writeln!(dest, + "#[allow(non_snake_case, unused_variables, dead_code)] + #[inline] pub unsafe fn {name}(&self, {params}) -> {return_suffix} {{ \ + {println} + let r = __gl_imports::mem::transmute::<_, extern \"system\" fn({typed_params}) -> {return_suffix}>\ + (self.{name}.f)({idents}); + {print_err} + r + }}", + name = cmd.proto.ident, + params = super::gen_parameters(cmd, true, true).join(", "), + typed_params = typed_params.join(", "), + return_suffix = cmd.proto.ty, + idents = idents.join(", "), + println = println, + print_err = if cmd.proto.ident != "GetError" && registry.cmds.iter().find(|cmd| cmd.proto.ident == "GetError").is_some() { + format!(r#"match __gl_imports::mem::transmute::<_, extern "system" fn() -> u32> + (self.GetError.f)() {{ 0 => (), r => println!("[OpenGL] ^ GL error triggered: {{}}", r) }}"#) + } else { + format!("") + } + )) + } + + writeln!(dest, + "}} + + unsafe impl __gl_imports::Send for {api} {{}}", + api = super::gen_struct_name(registry.api) + ) +} diff --git a/third_party/rust/gl_generator/generators/global_gen.rs b/third_party/rust/gl_generator/generators/global_gen.rs new file mode 100644 index 000000000000..eaefc1dec62e --- /dev/null +++ b/third_party/rust/gl_generator/generators/global_gen.rs @@ -0,0 +1,241 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +use registry::Registry; +use std::io; + +#[allow(missing_copy_implementations)] +pub struct GlobalGenerator; + +impl super::Generator for GlobalGenerator { + fn write(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(write_header(dest)); + try!(write_metaloadfn(dest)); + try!(write_type_aliases(registry, dest)); + try!(write_enums(registry, dest)); + try!(write_fns(registry, dest)); + try!(write_fnptr_struct_def(dest)); + try!(write_ptrs(registry, dest)); + try!(write_fn_mods(registry, dest)); + try!(write_panicking_fns(registry, dest)); + try!(write_load_fn(registry, dest)); + Ok(()) + } +} + +/// Creates a `__gl_imports` module which contains all the external symbols that we need for the +/// bindings. +fn write_header(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, r#" + mod __gl_imports {{ + pub use std::mem; + pub use std::os::raw; + }} + "#) +} + +/// Creates the metaloadfn function for fallbacks +fn write_metaloadfn(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, r#" + #[inline(never)] + fn metaloadfn(mut loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void, + symbol: &str, + fallbacks: &[&str]) -> *const __gl_imports::raw::c_void {{ + let mut ptr = loadfn(symbol); + if ptr.is_null() {{ + for &sym in fallbacks {{ + ptr = loadfn(sym); + if !ptr.is_null() {{ break; }} + }} + }} + ptr + }} + "#) +} + +/// Creates a `types` module which contains all the type aliases. +/// +/// See also `generators::gen_types`. +fn write_type_aliases(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, r#" + pub mod types {{ + #![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)] + "#)); + + try!(super::gen_types(registry.api, dest)); + + writeln!(dest, " + }} + ") +} + +/// Creates all the `` elements at the root of the bindings. +fn write_enums(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + for enm in ®istry.enums { + try!(super::gen_enum_item(enm, "types::", dest)); + } + + Ok(()) +} + +/// Creates the functions corresponding to the GL commands. +/// +/// The function calls the corresponding function pointer stored in the `storage` module created +/// by `write_ptrs`. +fn write_fns(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + for cmd in ®istry.cmds { + if let Some(v) = registry.aliases.get(&cmd.proto.ident) { + try!(writeln!(dest, "/// Fallbacks: {}", v.join(", "))); + } + + try!(writeln!(dest, + "#[allow(non_snake_case, unused_variables, dead_code)] #[inline] + pub unsafe fn {name}({params}) -> {return_suffix} {{ \ + __gl_imports::mem::transmute::<_, extern \"system\" fn({typed_params}) -> {return_suffix}>\ + (storage::{name}.f)({idents}) \ + }}", + name = cmd.proto.ident, + params = super::gen_parameters(cmd, true, true).join(", "), + typed_params = super::gen_parameters(cmd, false, true).join(", "), + return_suffix = cmd.proto.ty, + idents = super::gen_parameters(cmd, true, false).join(", "), + )); + } + + Ok(()) +} + +/// Creates a `FnPtr` structure which contains the store for a single binding. +fn write_fnptr_struct_def(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, " + #[allow(missing_copy_implementations)] + pub struct FnPtr {{ + /// The function pointer that will be used when calling the function. + f: *const __gl_imports::raw::c_void, + /// True if the pointer points to a real function, false if points to a `panic!` fn. + is_loaded: bool, + }} + + impl FnPtr {{ + /// Creates a `FnPtr` from a load attempt. + pub fn new(ptr: *const __gl_imports::raw::c_void) -> FnPtr {{ + if ptr.is_null() {{ + FnPtr {{ f: missing_fn_panic as *const __gl_imports::raw::c_void, is_loaded: false }} + }} else {{ + FnPtr {{ f: ptr, is_loaded: true }} + }} + }} + }} + ") +} + +/// Creates a `storage` module which contains a static `FnPtr` per GL command in the registry. +fn write_ptrs(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + + try!(writeln!(dest, + "mod storage {{ + #![allow(non_snake_case)] + use super::__gl_imports::raw; + use super::FnPtr;")); + + for c in ®istry.cmds { + try!(writeln!(dest, + "pub static mut {name}: FnPtr = FnPtr {{ + f: super::missing_fn_panic as *const raw::c_void, + is_loaded: false + }};", + name = c.proto.ident + )); + } + + writeln!(dest, "}}") +} + +/// Creates one module for each GL command. +/// +/// Each module contains `is_loaded` and `load_with` which interact with the `storage` module +/// created by `write_ptrs`. +fn write_fn_mods(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + for c in ®istry.cmds { + let fallbacks = match registry.aliases.get(&c.proto.ident) { + Some(v) => { + let names = v.iter().map(|name| format!("\"{}\"", super::gen_symbol_name(registry.api, &name[..]))).collect::>(); + format!("&[{}]", names.join(", ")) + }, None => "&[]".to_string(), + }; + let fnname = &c.proto.ident[..]; + let symbol = super::gen_symbol_name(registry.api, &c.proto.ident[..]); + let symbol = &symbol[..]; + + try!(writeln!(dest, r##" + #[allow(non_snake_case)] + pub mod {fnname} {{ + use super::{{storage, metaloadfn}}; + use super::__gl_imports::raw; + use super::FnPtr; + + #[inline] + #[allow(dead_code)] + pub fn is_loaded() -> bool {{ + unsafe {{ storage::{fnname}.is_loaded }} + }} + + #[allow(dead_code)] + pub fn load_with(mut loadfn: F) where F: FnMut(&str) -> *const raw::c_void {{ + unsafe {{ + storage::{fnname} = FnPtr::new(metaloadfn(&mut loadfn, "{symbol}", {fallbacks})) + }} + }} + }} + "##, fnname = fnname, fallbacks = fallbacks, symbol = symbol)); + } + + Ok(()) +} + +/// Creates a `missing_fn_panic` function. +/// +/// This function is the mock that is called if the real function could not be called. +fn write_panicking_fns(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, + "#[inline(never)] + fn missing_fn_panic() -> ! {{ + panic!(\"{api} function was not loaded\") + }} + ", api = registry.api) +} + +/// Creates the `load_with` function. +/// +/// The function calls `load_with` in each module created by `write_fn_mods`. +fn write_load_fn(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, " + /// Load each OpenGL symbol using a custom load function. This allows for the + /// use of functions like `glfwGetProcAddress` or `SDL_GL_GetProcAddress`. + /// ~~~ignore + /// gl::load_with(|s| glfw.get_proc_address(s)); + /// ~~~ + #[allow(dead_code)] + pub fn load_with(mut loadfn: F) where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{ + ")); + + for c in ®istry.cmds { + try!(writeln!(dest, "{cmd_name}::load_with(|s| loadfn(s));", + cmd_name = &c.proto.ident[..])); + } + + writeln!(dest, " + }} + ") +} diff --git a/third_party/rust/gl_generator/generators/mod.rs b/third_party/rust/gl_generator/generators/mod.rs new file mode 100644 index 000000000000..9a43271733d3 --- /dev/null +++ b/third_party/rust/gl_generator/generators/mod.rs @@ -0,0 +1,103 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +use Api; +use registry::{Enum, Registry, Cmd}; +use std::io; + +pub mod debug_struct_gen; +pub mod global_gen; +pub mod static_gen; +pub mod struct_gen; +pub mod static_struct_gen; + +/// Trait for a bindings generator. +pub trait Generator { + /// Builds the GL bindings. + fn write(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write; +} + +pub fn gen_struct_name(api: Api) -> &'static str { + match api { + Api::Gl => "Gl", + Api::Glx => "Glx", + Api::Wgl => "Wgl", + Api::Egl => "Egl", + Api::GlCore => "GlCore", + Api::Gles1 => "Gles1", + Api::Gles2 => "Gles2", + } +} + +/// This function generates a `const name: type = value;` item. +pub fn gen_enum_item(enm: &Enum, types_prefix: &str, dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, + "#[allow(dead_code, non_upper_case_globals)] pub const {ident}: {types_prefix}{ty} = {value}{cast_suffix};", + ident = enm.ident, + types_prefix = if enm.ty == "&'static str" { "" } else { types_prefix }, + ty = enm.ty, + value = enm.value, + cast_suffix = match enm.cast { + true => format!(" as {}{}", types_prefix, enm.ty), + false => String::new(), + }, + ) +} + +/// Generates all the type aliases for a namespace. +/// +/// Aliases are either `pub type = ...` or `#[repr(C)] pub struct ... { ... }` and contain all the +/// things that we can't obtain from the XML files. +pub fn gen_types(api: Api, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, "{}", include_str!("templates/types/gl.rs"))); + + match api { + Api::Glx => try!(writeln!(dest, "{}", include_str!("templates/types/glx.rs"))), + Api::Wgl => try!(writeln!(dest, "{}", include_str!("templates/types/wgl.rs"))), + Api::Egl => try!(writeln!(dest, "{}", include_str!("templates/types/egl.rs"))), + _ => {}, + } + + Ok(()) +} + +/// Generates the list of Rust `Arg`s that a `Cmd` requires. +pub fn gen_parameters(cmd: &Cmd, with_idents: bool, with_types: bool) -> Vec { + cmd.params.iter() + .map(|binding| { + // returning + if with_idents && with_types { + format!("{}: {}", binding.ident, binding.ty) + } else if with_types { + format!("{}", binding.ty) + } else if with_idents { + format!("{}", binding.ident) + } else { + panic!() + } + }) + .collect() +} + +/// Generates the native symbol name of a `Cmd`. +/// +/// Example results: `"glClear"`, `"wglCreateContext"`, etc. +pub fn gen_symbol_name(api: Api, cmd: &str) -> String { + match api { + Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => format!("gl{}", cmd), + Api::Glx => format!("glX{}", cmd), + Api::Wgl => format!("wgl{}", cmd), + Api::Egl => format!("egl{}", cmd), + } +} diff --git a/third_party/rust/gl_generator/generators/static_gen.rs b/third_party/rust/gl_generator/generators/static_gen.rs new file mode 100644 index 000000000000..fbcfa464ac69 --- /dev/null +++ b/third_party/rust/gl_generator/generators/static_gen.rs @@ -0,0 +1,87 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +use registry::Registry; +use std::io; + +#[allow(missing_copy_implementations)] +pub struct StaticGenerator; + +impl super::Generator for StaticGenerator { + fn write(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(write_header(dest)); + try!(write_type_aliases(registry, dest)); + try!(write_enums(registry, dest)); + try!(write_fns(registry, dest)); + Ok(()) + } +} + +/// Creates a `__gl_imports` module which contains all the external symbols that we need for the +/// bindings. +fn write_header(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, r#" + mod __gl_imports {{ + pub use std::mem; + pub use std::os::raw; + }} + "#) +} + +/// Creates a `types` module which contains all the type aliases. +/// +/// See also `generators::gen_types`. +fn write_type_aliases(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, r#" + pub mod types {{ + #![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)] + "#)); + + try!(super::gen_types(registry.api, dest)); + + writeln!(dest, " + }} + ") +} + +/// Creates all the `` elements at the root of the bindings. +fn write_enums(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + for enm in ®istry.enums { + try!(super::gen_enum_item(enm, "types::", dest)); + } + + Ok(()) +} + +/// io::Writes all functions corresponding to the GL bindings. +/// +/// These are foreign functions, they don't have any content. +fn write_fns(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, " + #[allow(non_snake_case, unused_variables, dead_code)] + extern \"system\" {{")); + + for cmd in ®istry.cmds { + try!(writeln!(dest, + "#[link_name=\"{symbol}\"] + pub fn {name}({params}) -> {return_suffix};", + symbol = super::gen_symbol_name(registry.api, &cmd.proto.ident), + name = cmd.proto.ident, + params = super::gen_parameters(cmd, true, true).join(", "), + return_suffix = cmd.proto.ty, + )); + } + + writeln!(dest, "}}") +} diff --git a/third_party/rust/gl_generator/generators/static_struct_gen.rs b/third_party/rust/gl_generator/generators/static_struct_gen.rs new file mode 100644 index 000000000000..638bf27b4017 --- /dev/null +++ b/third_party/rust/gl_generator/generators/static_struct_gen.rs @@ -0,0 +1,132 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +use registry::Registry; +use std::io; + +#[allow(missing_copy_implementations)] +pub struct StaticStructGenerator; + +impl super::Generator for StaticStructGenerator { + fn write(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(write_header(dest)); + try!(write_type_aliases(registry, dest)); + try!(write_enums(registry, dest)); + try!(write_struct(registry, dest)); + try!(write_impl(registry, dest)); + try!(write_fns(registry, dest)); + Ok(()) + } +} + +/// Creates a `__gl_imports` module which contains all the external symbols that we need for the +/// bindings. +fn write_header(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, r#" + mod __gl_imports {{ + pub use std::mem; + pub use std::os::raw; + }} + "#) +} + +/// Creates a `types` module which contains all the type aliases. +/// +/// See also `generators::gen_types`. +fn write_type_aliases(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, r#" + pub mod types {{ + #![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)] + "#)); + + try!(super::gen_types(registry.api, dest)); + + writeln!(dest, "}}") +} + +/// Creates all the `` elements at the root of the bindings. +fn write_enums(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + for enm in ®istry.enums { + try!(super::gen_enum_item(enm, "types::", dest)); + } + + Ok(()) +} + +/// Creates a stub structure. +/// +/// The name of the struct corresponds to the namespace. +fn write_struct(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, " + #[allow(non_camel_case_types, non_snake_case, dead_code)] + #[derive(Copy, Clone)] + pub struct {api};", + api = super::gen_struct_name(registry.api), + ) +} + +/// Creates the `impl` of the structure created by `write_struct`. +fn write_impl(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, + "impl {api} {{ + /// Stub function. + #[allow(dead_code)] + pub fn load_with(mut _loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{ + {api} + }}", + api = super::gen_struct_name(registry.api), + )); + + for cmd in ®istry.cmds { + try!(writeln!(dest, + "#[allow(non_snake_case)] + // #[allow(unused_variables)] + #[allow(dead_code)] + #[inline] + pub unsafe fn {name}(&self, {typed_params}) -> {return_suffix} {{ + {name}({idents}) + }}", + name = cmd.proto.ident, + typed_params = super::gen_parameters(cmd, true, true).join(", "), + return_suffix = cmd.proto.ty, + idents = super::gen_parameters(cmd, true, false).join(", "), + )); + } + + writeln!(dest, "}}") +} + +/// io::Writes all functions corresponding to the GL bindings. +/// +/// These are foreign functions, they don't have any content. +fn write_fns(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + + try!(writeln!(dest, " + #[allow(non_snake_case)] + #[allow(unused_variables)] + #[allow(dead_code)] + extern \"system\" {{")); + + for cmd in ®istry.cmds { + try!(writeln!(dest, + "#[link_name=\"{symbol}\"] fn {name}({params}) -> {return_suffix};", + symbol = super::gen_symbol_name(registry.api, &cmd.proto.ident), + name = cmd.proto.ident, + params = super::gen_parameters(cmd, true, true).join(", "), + return_suffix = cmd.proto.ty, + )); + } + + writeln!(dest, "}}") +} diff --git a/third_party/rust/gl_generator/generators/struct_gen.rs b/third_party/rust/gl_generator/generators/struct_gen.rs new file mode 100644 index 000000000000..d3c10e941c2a --- /dev/null +++ b/third_party/rust/gl_generator/generators/struct_gen.rs @@ -0,0 +1,215 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +use registry::Registry; +use std::io; + +#[allow(missing_copy_implementations)] +pub struct StructGenerator; + +impl super::Generator for StructGenerator { + fn write(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(write_header(dest)); + try!(write_type_aliases(registry, dest)); + try!(write_enums(registry, dest)); + try!(write_fnptr_struct_def(dest)); + try!(write_panicking_fns(registry, dest)); + try!(write_struct(registry, dest)); + try!(write_impl(registry, dest)); + Ok(()) + } +} + +/// Creates a `__gl_imports` module which contains all the external symbols that we need for the +/// bindings. +fn write_header(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, r#" + mod __gl_imports {{ + pub use std::mem; + pub use std::marker::Send; + pub use std::os::raw; + }} + "#) +} + +/// Creates a `types` module which contains all the type aliases. +/// +/// See also `generators::gen_types`. +fn write_type_aliases(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, r#" + pub mod types {{ + #![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)] + "#)); + + try!(super::gen_types(registry.api, dest)); + + writeln!(dest, "}}") +} + +/// Creates all the `` elements at the root of the bindings. +fn write_enums(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + for enm in ®istry.enums { + try!(super::gen_enum_item(enm, "types::", dest)); + } + + Ok(()) +} + +/// Creates a `FnPtr` structure which contains the store for a single binding. +fn write_fnptr_struct_def(dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, " + #[allow(dead_code, missing_copy_implementations)] + #[derive(Clone)] + pub struct FnPtr {{ + /// The function pointer that will be used when calling the function. + f: *const __gl_imports::raw::c_void, + /// True if the pointer points to a real function, false if points to a `panic!` fn. + is_loaded: bool, + }} + + impl FnPtr {{ + /// Creates a `FnPtr` from a load attempt. + fn new(ptr: *const __gl_imports::raw::c_void) -> FnPtr {{ + if ptr.is_null() {{ + FnPtr {{ + f: missing_fn_panic as *const __gl_imports::raw::c_void, + is_loaded: false + }} + }} else {{ + FnPtr {{ f: ptr, is_loaded: true }} + }} + }} + + /// Returns `true` if the function has been successfully loaded. + /// + /// If it returns `false`, calling the corresponding function will fail. + #[inline] + #[allow(dead_code)] + pub fn is_loaded(&self) -> bool {{ + self.is_loaded + }} + }} + ") +} + +/// Creates a `panicking` module which contains one function per GL command. +/// +/// These functions are the mocks that are called if the real function could not be loaded. +fn write_panicking_fns(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + writeln!(dest, + "#[inline(never)] + fn missing_fn_panic() -> ! {{ + panic!(\"{api} function was not loaded\") + }}", + api = registry.api + ) +} + +/// Creates a structure which stores all the `FnPtr` of the bindings. +/// +/// The name of the struct corresponds to the namespace. +fn write_struct(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, " + #[allow(non_camel_case_types, non_snake_case, dead_code)] + #[derive(Clone)] + pub struct {api} {{", + api = super::gen_struct_name(registry.api) + )); + + for cmd in ®istry.cmds { + if let Some(v) = registry.aliases.get(&cmd.proto.ident) { + try!(writeln!(dest, "/// Fallbacks: {}", v.join(", "))); + } + try!(writeln!(dest, "pub {name}: FnPtr,", name = cmd.proto.ident)); + } + + writeln!(dest, "}}") +} + +/// Creates the `impl` of the structure created by `write_struct`. +fn write_impl(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write { + try!(writeln!(dest, + "impl {api} {{ + /// Load each OpenGL symbol using a custom load function. This allows for the + /// use of functions like `glfwGetProcAddress` or `SDL_GL_GetProcAddress`. + /// + /// ~~~ignore + /// let gl = Gl::load_with(|s| glfw.get_proc_address(s)); + /// ~~~ + #[allow(dead_code, unused_variables)] + pub fn load_with(mut loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{ + #[inline(never)] + fn do_metaloadfn(loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void, + symbol: &str, + symbols: &[&str]) + -> *const __gl_imports::raw::c_void {{ + let mut ptr = loadfn(symbol); + if ptr.is_null() {{ + for &sym in symbols {{ + ptr = loadfn(sym); + if !ptr.is_null() {{ break; }} + }} + }} + ptr + }} + let mut metaloadfn = |symbol: &str, symbols: &[&str]| {{ + do_metaloadfn(&mut loadfn, symbol, symbols) + }}; + {api} {{", + api = super::gen_struct_name(registry.api) + )); + + for cmd in ®istry.cmds { + try!(writeln!(dest, + "{name}: FnPtr::new(metaloadfn(\"{symbol}\", &[{fallbacks}])),", + name = cmd.proto.ident, + symbol = super::gen_symbol_name(registry.api, &cmd.proto.ident), + fallbacks = match registry.aliases.get(&cmd.proto.ident) { + Some(fbs) => { + fbs.iter() + .map(|name| format!("\"{}\"", super::gen_symbol_name(registry.api, &name))) + .collect::>().join(", ") + }, + None => format!(""), + }, + )) + } + + try!(writeln!(dest, + "}} + }}" + )); + + for cmd in ®istry.cmds { + try!(writeln!(dest, + "#[allow(non_snake_case, unused_variables, dead_code)] + #[inline] pub unsafe fn {name}(&self, {params}) -> {return_suffix} {{ \ + __gl_imports::mem::transmute::<_, extern \"system\" fn({typed_params}) -> {return_suffix}>\ + (self.{name}.f)({idents}) \ + }}", + name = cmd.proto.ident, + params = super::gen_parameters(cmd, true, true).join(", "), + typed_params = super::gen_parameters(cmd, false, true).join(", "), + return_suffix = cmd.proto.ty, + idents = super::gen_parameters(cmd, true, false).join(", "), + )) + } + + writeln!(dest, + "}} + + unsafe impl __gl_imports::Send for {api} {{}}", + api = super::gen_struct_name(registry.api) + ) +} diff --git a/third_party/rust/gl_generator/generators/templates/types/egl.rs b/third_party/rust/gl_generator/generators/templates/types/egl.rs new file mode 100644 index 000000000000..82b4c718034e --- /dev/null +++ b/third_party/rust/gl_generator/generators/templates/types/egl.rs @@ -0,0 +1,52 @@ +// platform-specific aliases are unknown +// IMPORTANT: these are alises to the same level of the bindings +// the values must be defined by the user +pub type khronos_utime_nanoseconds_t = super::khronos_utime_nanoseconds_t; +pub type khronos_uint64_t = super::khronos_uint64_t; +pub type khronos_ssize_t = super::khronos_ssize_t; +pub type EGLNativeDisplayType = super::EGLNativeDisplayType; +pub type EGLNativePixmapType = super::EGLNativePixmapType; +pub type EGLNativeWindowType = super::EGLNativeWindowType; +pub type EGLint = super::EGLint; +pub type NativeDisplayType = super::NativeDisplayType; +pub type NativePixmapType = super::NativePixmapType; +pub type NativeWindowType = super::NativeWindowType; + +// EGL alises +pub type Bool = EGLBoolean; // TODO: not sure +pub type EGLBoolean = super::__gl_imports::raw::c_uint; +pub type EGLenum = super::__gl_imports::raw::c_uint; +pub type EGLAttribKHR = isize; +pub type EGLAttrib = isize; +pub type EGLConfig = *const super::__gl_imports::raw::c_void; +pub type EGLContext = *const super::__gl_imports::raw::c_void; +pub type EGLDeviceEXT = *const super::__gl_imports::raw::c_void; +pub type EGLDisplay = *const super::__gl_imports::raw::c_void; +pub type EGLSurface = *const super::__gl_imports::raw::c_void; +pub type EGLClientBuffer = *const super::__gl_imports::raw::c_void; +pub type __eglMustCastToProperFunctionPointerType = extern "system" fn() -> (); +pub type EGLImageKHR = *const super::__gl_imports::raw::c_void; +pub type EGLImage = *const super::__gl_imports::raw::c_void; +pub type EGLOutputLayerEXT = *const super::__gl_imports::raw::c_void; +pub type EGLOutputPortEXT = *const super::__gl_imports::raw::c_void; +pub type EGLSyncKHR = *const super::__gl_imports::raw::c_void; +pub type EGLSync = *const super::__gl_imports::raw::c_void; +pub type EGLTimeKHR = khronos_utime_nanoseconds_t; +pub type EGLTime = khronos_utime_nanoseconds_t; +pub type EGLSyncNV = *const super::__gl_imports::raw::c_void; +pub type EGLTimeNV = khronos_utime_nanoseconds_t; +pub type EGLuint64NV = khronos_utime_nanoseconds_t; +pub type EGLStreamKHR = *const super::__gl_imports::raw::c_void; +pub type EGLuint64KHR = khronos_uint64_t; +pub type EGLNativeFileDescriptorKHR = super::__gl_imports::raw::c_int; +pub type EGLsizeiANDROID = khronos_ssize_t; +pub type EGLSetBlobFuncANDROID = extern "system" fn(*const super::__gl_imports::raw::c_void, EGLsizeiANDROID, *const super::__gl_imports::raw::c_void, EGLsizeiANDROID) -> (); +pub type EGLGetBlobFuncANDROID = extern "system" fn(*const super::__gl_imports::raw::c_void, EGLsizeiANDROID, *mut super::__gl_imports::raw::c_void, EGLsizeiANDROID) -> EGLsizeiANDROID; + +#[repr(C)] +pub struct EGLClientPixmapHI { + pData: *const super::__gl_imports::raw::c_void, + iWidth: EGLint, + iHeight: EGLint, + iStride: EGLint, +} diff --git a/third_party/rust/gl_generator/generators/templates/types/gl.rs b/third_party/rust/gl_generator/generators/templates/types/gl.rs new file mode 100644 index 000000000000..c1d2dd904e3c --- /dev/null +++ b/third_party/rust/gl_generator/generators/templates/types/gl.rs @@ -0,0 +1,83 @@ +// Common types from OpenGL 1.1 +pub type GLenum = super::__gl_imports::raw::c_uint; +pub type GLboolean = super::__gl_imports::raw::c_uchar; +pub type GLbitfield = super::__gl_imports::raw::c_uint; +pub type GLvoid = super::__gl_imports::raw::c_void; +pub type GLbyte = super::__gl_imports::raw::c_char; +pub type GLshort = super::__gl_imports::raw::c_short; +pub type GLint = super::__gl_imports::raw::c_int; +pub type GLclampx = super::__gl_imports::raw::c_int; +pub type GLubyte = super::__gl_imports::raw::c_uchar; +pub type GLushort = super::__gl_imports::raw::c_ushort; +pub type GLuint = super::__gl_imports::raw::c_uint; +pub type GLsizei = super::__gl_imports::raw::c_int; +pub type GLfloat = super::__gl_imports::raw::c_float; +pub type GLclampf = super::__gl_imports::raw::c_float; +pub type GLdouble = super::__gl_imports::raw::c_double; +pub type GLclampd = super::__gl_imports::raw::c_double; +pub type GLeglImageOES = *const super::__gl_imports::raw::c_void; +pub type GLchar = super::__gl_imports::raw::c_char; +pub type GLcharARB = super::__gl_imports::raw::c_char; + +#[cfg(target_os = "macos")] pub type GLhandleARB = *const super::__gl_imports::raw::c_void; +#[cfg(not(target_os = "macos"))] pub type GLhandleARB = super::__gl_imports::raw::c_uint; + +pub type GLhalfARB = super::__gl_imports::raw::c_ushort; +pub type GLhalf = super::__gl_imports::raw::c_ushort; + +// Must be 32 bits +pub type GLfixed = GLint; + +pub type GLintptr = isize; +pub type GLsizeiptr = isize; +pub type GLint64 = i64; +pub type GLuint64 = u64; +pub type GLintptrARB = isize; +pub type GLsizeiptrARB = isize; +pub type GLint64EXT = i64; +pub type GLuint64EXT = u64; + +pub enum __GLsync {} +pub type GLsync = *const __GLsync; + + // compatible with OpenCL cl_context +pub enum _cl_context {} +pub enum _cl_event {} + +pub type GLDEBUGPROC = extern "system" fn(source: GLenum, gltype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void); +pub type GLDEBUGPROCARB = extern "system" fn(source: GLenum, gltype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void); +pub type GLDEBUGPROCKHR = extern "system" fn(source: GLenum, gltype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void); + +// GLES 1 types +// "pub type GLclampx = i32;", + +// GLES 1/2 types (tagged for GLES 1) +// "pub type GLbyte = i8;", +// "pub type GLubyte = u8;", +// "pub type GLfloat = GLfloat;", +// "pub type GLclampf = GLfloat;", +// "pub type GLfixed = i32;", +// "pub type GLint64 = i64;", +// "pub type GLuint64 = u64;", +// "pub type GLintptr = intptr_t;", +// "pub type GLsizeiptr = ssize_t;", + +// GLES 1/2 types (tagged for GLES 2 - attribute syntax is limited) +// "pub type GLbyte = i8;", +// "pub type GLubyte = u8;", +// "pub type GLfloat = GLfloat;", +// "pub type GLclampf = GLfloat;", +// "pub type GLfixed = i32;", +// "pub type GLint64 = i64;", +// "pub type GLuint64 = u64;", +// "pub type GLint64EXT = i64;", +// "pub type GLuint64EXT = u64;", +// "pub type GLintptr = intptr_t;", +// "pub type GLsizeiptr = ssize_t;", + +// GLES 2 types (none currently) + +// Vendor extension types +pub type GLDEBUGPROCAMD = extern "system" fn(id: GLuint, category: GLenum, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void); +pub type GLhalfNV = super::__gl_imports::raw::c_ushort; +pub type GLvdpauSurfaceNV = GLintptr; diff --git a/third_party/rust/gl_generator/generators/templates/types/glx.rs b/third_party/rust/gl_generator/generators/templates/types/glx.rs new file mode 100644 index 000000000000..23b5d03a0f4b --- /dev/null +++ b/third_party/rust/gl_generator/generators/templates/types/glx.rs @@ -0,0 +1,127 @@ +pub type XID = super::__gl_imports::raw::c_ulong; +pub type Bool = super::__gl_imports::raw::c_int; // Not sure if this is correct... +pub enum Display {} + +pub type Font = XID; +pub type Pixmap = XID; +pub enum Visual {} // TODO: not sure +pub type VisualID = super::__gl_imports::raw::c_ulong; // TODO: not sure +pub type Window = XID; +pub type GLXFBConfigID = XID; +pub type GLXFBConfig = *const super::__gl_imports::raw::c_void; +pub type GLXContextID = XID; +pub type GLXContext = *const super::__gl_imports::raw::c_void; +pub type GLXPixmap = XID; +pub type GLXDrawable = XID; +pub type GLXWindow = XID; +pub type GLXPbuffer = XID; +pub type __GLXextFuncPtr = extern "system" fn(); +pub type GLXVideoCaptureDeviceNV = XID; +pub type GLXVideoDeviceNV = super::__gl_imports::raw::c_int; +pub type GLXVideoSourceSGIX = XID; +pub type GLXFBConfigIDSGIX = XID; +pub type GLXFBConfigSGIX = *const super::__gl_imports::raw::c_void; +pub type GLXPbufferSGIX = XID; + +#[repr(C)] +pub struct XVisualInfo { + pub visual: *mut Visual, + pub visualid: VisualID, + pub screen: super::__gl_imports::raw::c_int, + pub depth: super::__gl_imports::raw::c_int, + pub class: super::__gl_imports::raw::c_int, + pub red_mask: super::__gl_imports::raw::c_ulong, + pub green_mask: super::__gl_imports::raw::c_ulong, + pub blue_mask: super::__gl_imports::raw::c_ulong, + pub colormap_size: super::__gl_imports::raw::c_int, + pub bits_per_rgb: super::__gl_imports::raw::c_int, +} + +#[repr(C)] +pub struct GLXPbufferClobberEvent { + pub event_type: super::__gl_imports::raw::c_int, // GLX_DAMAGED or GLX_SAVED + pub draw_type: super::__gl_imports::raw::c_int, // GLX_WINDOW or GLX_PBUFFER + pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server + pub send_event: Bool, // true if this came for SendEvent request + pub display: *const Display, // display the event was read from + pub drawable: GLXDrawable, // XID of Drawable + pub buffer_mask: super::__gl_imports::raw::c_uint, // mask indicating which buffers are affected + pub aux_buffer: super::__gl_imports::raw::c_uint, // which aux buffer was affected + pub x: super::__gl_imports::raw::c_int, + pub y: super::__gl_imports::raw::c_int, + pub width: super::__gl_imports::raw::c_int, + pub height: super::__gl_imports::raw::c_int, + pub count: super::__gl_imports::raw::c_int, // if nonzero, at least this many more +} + +#[repr(C)] +pub struct GLXBufferSwapComplete { + pub type_: super::__gl_imports::raw::c_int, + pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server + pub send_event: Bool, // true if this came from a SendEvent request + pub display: *const Display, // Display the event was read from + pub drawable: GLXDrawable, // drawable on which event was requested in event mask + pub event_type: super::__gl_imports::raw::c_int, + pub ust: i64, + pub msc: i64, + pub sbc: i64, +} + +// typedef union __GLXEvent { +// GLXPbufferClobberEvent glxpbufferclobber; +// GLXBufferSwapComplete glxbufferswapcomplete; +// long pad[24]; +// } + +#[repr(C)] +pub struct GLXBufferClobberEventSGIX { + pub type_: super::__gl_imports::raw::c_int, + pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server + pub send_event: Bool, // true if this came for SendEvent request + pub display: *const Display, // display the event was read from + pub drawable: GLXDrawable, // i.d. of Drawable + pub event_type: super::__gl_imports::raw::c_int, // GLX_DAMAGED_SGIX or GLX_SAVED_SGIX + pub draw_type: super::__gl_imports::raw::c_int, // GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX + pub mask: super::__gl_imports::raw::c_uint, // mask indicating which buffers are affected + pub x: super::__gl_imports::raw::c_int, + pub y: super::__gl_imports::raw::c_int, + pub width: super::__gl_imports::raw::c_int, + pub height: super::__gl_imports::raw::c_int, + pub count: super::__gl_imports::raw::c_int, // if nonzero, at least this many more +} + +#[repr(C)] +pub struct GLXHyperpipeNetworkSGIX { + pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] + pub networkId: super::__gl_imports::raw::c_int, +} + +#[repr(C)] +pub struct GLXHyperpipeConfigSGIX { + pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] + pub channel: super::__gl_imports::raw::c_int, + pub participationType: super::__gl_imports::raw::c_uint, + pub timeSlice: super::__gl_imports::raw::c_int, +} + +#[repr(C)] +pub struct GLXPipeRect { + pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] + pub srcXOrigin: super::__gl_imports::raw::c_int, + pub srcYOrigin: super::__gl_imports::raw::c_int, + pub srcWidth: super::__gl_imports::raw::c_int, + pub srcHeight: super::__gl_imports::raw::c_int, + pub destXOrigin: super::__gl_imports::raw::c_int, + pub destYOrigin: super::__gl_imports::raw::c_int, + pub destWidth: super::__gl_imports::raw::c_int, + pub destHeight: super::__gl_imports::raw::c_int, +} + +#[repr(C)] +pub struct GLXPipeRectLimits { + pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] + pub XOrigin: super::__gl_imports::raw::c_int, + pub YOrigin: super::__gl_imports::raw::c_int, + pub maxHeight: super::__gl_imports::raw::c_int, + pub maxWidth: super::__gl_imports::raw::c_int, +} diff --git a/third_party/rust/gl_generator/generators/templates/types/wgl.rs b/third_party/rust/gl_generator/generators/templates/types/wgl.rs new file mode 100644 index 000000000000..c2d1939065fc --- /dev/null +++ b/third_party/rust/gl_generator/generators/templates/types/wgl.rs @@ -0,0 +1,138 @@ +// From WinNT.h + +pub type CHAR = super::__gl_imports::raw::c_char; +pub type HANDLE = PVOID; +pub type LONG = super::__gl_imports::raw::c_long; +pub type LPCSTR = *const super::__gl_imports::raw::c_char; +pub type VOID = (); +// #define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name +pub type HPBUFFERARB = *const super::__gl_imports::raw::c_void; +pub type HPBUFFEREXT = *const super::__gl_imports::raw::c_void; +pub type HVIDEOOUTPUTDEVICENV = *const super::__gl_imports::raw::c_void; +pub type HPVIDEODEV = *const super::__gl_imports::raw::c_void; +pub type HPGPUNV = *const super::__gl_imports::raw::c_void; +pub type HGPUNV = *const super::__gl_imports::raw::c_void; +pub type HVIDEOINPUTDEVICENV = *const super::__gl_imports::raw::c_void; + +// From Windef.h + +pub type BOOL = super::__gl_imports::raw::c_int; +pub type BYTE = super::__gl_imports::raw::c_uchar; +pub type COLORREF = DWORD; +pub type FLOAT = super::__gl_imports::raw::c_float; +pub type HDC = HANDLE; +pub type HENHMETAFILE = HANDLE; +pub type HGLRC = *const super::__gl_imports::raw::c_void; +pub type INT = super::__gl_imports::raw::c_int; +pub type PVOID = *const super::__gl_imports::raw::c_void; +pub type LPVOID = *const super::__gl_imports::raw::c_void; +pub type PROC = extern "system" fn(); // Not sure about this one :/ + +#[repr(C)] +pub struct RECT { + left: LONG, + top: LONG, + right: LONG, + bottom: LONG, +} + +pub type UINT = super::__gl_imports::raw::c_uint; +pub type USHORT = super::__gl_imports::raw::c_ushort; +pub type WORD = super::__gl_imports::raw::c_ushort; + +// From BaseTsd.h + +pub type INT32 = i32; +pub type INT64 = i64; + +// From IntSafe.h + +pub type DWORD = super::__gl_imports::raw::c_ulong; + +// From Wingdi.h + +#[repr(C)] +pub struct POINTFLOAT { + pub x: FLOAT, + pub y: FLOAT, +} + +#[repr(C)] +pub struct GLYPHMETRICSFLOAT { + pub gmfBlackBoxX: FLOAT, + pub gmfBlackBoxY: FLOAT, + pub gmfptGlyphOrigin: POINTFLOAT, + pub gmfCellIncX: FLOAT, + pub gmfCellIncY: FLOAT, +} +pub type LPGLYPHMETRICSFLOAT = *const GLYPHMETRICSFLOAT; + +#[repr(C)] +pub struct LAYERPLANEDESCRIPTOR { + pub nSize: WORD, + pub nVersion: WORD, + pub dwFlags: DWORD, + pub iPixelType: BYTE, + pub cColorBits: BYTE, + pub cRedBits: BYTE, + pub cRedShift: BYTE, + pub cGreenBits: BYTE, + pub cGreenShift: BYTE, + pub cBlueBits: BYTE, + pub cBlueShift: BYTE, + pub cAlphaBits: BYTE, + pub cAlphaShift: BYTE, + pub cAccumBits: BYTE, + pub cAccumRedBits: BYTE, + pub cAccumGreenBits: BYTE, + pub cAccumBlueBits: BYTE, + pub cAccumAlphaBits: BYTE, + pub cDepthBits: BYTE, + pub cStencilBits: BYTE, + pub cAuxBuffers: BYTE, + pub iLayerType: BYTE, + pub bReserved: BYTE, + pub crTransparent: COLORREF, +} + +#[repr(C)] +pub struct PIXELFORMATDESCRIPTOR { + pub nSize: WORD, + pub nVersion: WORD, + pub dwFlags: DWORD, + pub iPixelType: BYTE, + pub cColorBits: BYTE, + pub cRedBits: BYTE, + pub cRedShift: BYTE, + pub cGreenBits: BYTE, + pub cGreenShift: BYTE, + pub cBlueBits: BYTE, + pub cBlueShift: BYTE, + pub cAlphaBits: BYTE, + pub cAlphaShift: BYTE, + pub cAccumBits: BYTE, + pub cAccumRedBits: BYTE, + pub cAccumGreenBits: BYTE, + pub cAccumBlueBits: BYTE, + pub cAccumAlphaBits: BYTE, + pub cDepthBits: BYTE, + pub cStencilBits: BYTE, + pub cAuxBuffers: BYTE, + pub iLayerType: BYTE, + pub bReserved: BYTE, + pub dwLayerMask: DWORD, + pub dwVisibleMask: DWORD, + pub dwDamageMask: DWORD, +} + +#[repr(C)] +pub struct _GPU_DEVICE { + cb: DWORD, + DeviceName: [CHAR; 32], + DeviceString: [CHAR; 128], + Flags: DWORD, + rcVirtualScreen: RECT, +} + +pub struct GPU_DEVICE(_GPU_DEVICE); +pub struct PGPU_DEVICE(*const _GPU_DEVICE); diff --git a/third_party/rust/gl_generator/lib.rs b/third_party/rust/gl_generator/lib.rs new file mode 100644 index 000000000000..e49582291738 --- /dev/null +++ b/third_party/rust/gl_generator/lib.rs @@ -0,0 +1,81 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +//! An OpenGL bindings generator. It defines a function named `generate_bindings` which can be +//! used to generate all constants and functions of a given OpenGL version. +//! +//! # Example +//! +//! In `build.rs`: +//! +//! ```no_run +//! extern crate gl_generator; +//! +//! use gl_generator::{Registry, Api, Profile, Fallbacks, GlobalGenerator}; +//! use std::env; +//! use std::fs::File; +//! use std::path::Path; +//! +//! fn main() { +//! let dest = env::var("OUT_DIR").unwrap(); +//! let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap(); +//! +//! Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) +//! .write_bindings(GlobalGenerator, &mut file) +//! .unwrap(); +//! } +//! ``` +//! +//! In your project: +//! +//! ```ignore +//! include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); +//! ``` +//! +//! # About EGL +//! +//! When you generate bindings for EGL, the following platform-specific types must be declared +//! *at the same level where you include the bindings*: +//! +//! - `khronos_utime_nanoseconds_t` +//! - `khronos_uint64_t` +//! - `khronos_ssize_t` +//! - `EGLNativeDisplayType` +//! - `EGLNativePixmapType` +//! - `EGLNativeWindowType` +//! - `EGLint` +//! - `NativeDisplayType` +//! - `NativePixmapType` +//! - `NativeWindowType` +//! + +#[macro_use] +extern crate log; +extern crate xml; + +#[cfg(feature = "unstable_generator_utils")] +pub mod generators; +#[cfg(not(feature = "unstable_generator_utils"))] +mod generators; + +mod registry; + +pub use generators::Generator; +pub use generators::debug_struct_gen::DebugStructGenerator; +pub use generators::global_gen::GlobalGenerator; +pub use generators::static_gen::StaticGenerator; +pub use generators::static_struct_gen::StaticStructGenerator; +pub use generators::struct_gen::StructGenerator; + +pub use registry::*; diff --git a/third_party/rust/gl_generator/registry/mod.rs b/third_party/rust/gl_generator/registry/mod.rs new file mode 100644 index 000000000000..497a877d182d --- /dev/null +++ b/third_party/rust/gl_generator/registry/mod.rs @@ -0,0 +1,158 @@ +// Copyright 2015-2016 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +extern crate khronos_api; + +use std::borrow::Cow; +use std::collections::{BTreeSet, HashMap, HashSet}; +use std::fmt; +use std::hash::{Hash, Hasher}; +use std::io; +use std::ops::Add; + +use Generator; + +mod parse; + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum Api { Gl, Glx, Wgl, Egl, GlCore, Gles1, Gles2 } + +impl fmt::Display for Api { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match *self { + Api::Gl => write!(fmt, "gl"), + Api::Glx => write!(fmt, "glx"), + Api::Wgl => write!(fmt, "wgl"), + Api::Egl => write!(fmt, "egl"), + Api::GlCore => write!(fmt, "glcore"), + Api::Gles1 => write!(fmt, "gles1"), + Api::Gles2 => write!(fmt, "gles2"), + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum Fallbacks { All, None } + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum Profile { Core, Compatibility } + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Enum { + pub ident: String, + pub value: String, + pub cast: bool, + pub alias: Option, + pub ty: Cow<'static, str>, +} + +impl Hash for Enum { + fn hash(&self, state: &mut H) { + self.ident.hash(state); + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Binding { + pub ident: String, + pub ty: Cow<'static, str>, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Cmd { + pub proto: Binding, + pub params: Vec, + pub alias: Option, + pub vecequiv: Option, + pub glx: Option, +} + +impl Hash for Cmd { + fn hash(&self, state: &mut H) { + self.proto.ident.hash(state); + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct GlxOpcode { + pub opcode: String, + pub name: Option, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Registry { + pub api: Api, + pub enums: HashSet, + pub cmds: HashSet, + pub aliases: HashMap>, +} + +impl Registry { + pub fn new<'a, Exts>(api: Api, version: (u8, u8), profile: Profile, fallbacks: Fallbacks, extensions: Exts) -> Registry where + Exts: AsRef<[&'a str]>, + { + let (major, minor) = version; + let extensions = extensions.as_ref().iter() + .map(<&str>::to_string) + .collect(); + + let filter = parse::Filter { + api: api, + fallbacks: fallbacks, + extensions: extensions, + version: format!("{}.{}", major, minor), + profile: profile, + }; + + let src = match api { + Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => khronos_api::GL_XML, + Api::Glx => khronos_api::GLX_XML, + Api::Wgl => khronos_api::WGL_XML, + Api::Egl => khronos_api::EGL_XML, + }; + + parse::from_xml(src, filter) + } + + pub fn write_bindings(&self, generator: G, output: &mut W) -> io::Result<()> where + G: Generator, + W: io::Write, + { + generator.write(&self, output) + } + + /// Returns a set of all the types used in the supplied registry. This is useful + /// for working out what conversions are needed for the specific registry. + pub fn get_tys(&self) -> BTreeSet<&str> { + let mut tys = BTreeSet::new(); + for def in &self.cmds { + tys.insert(def.proto.ty.as_ref()); + for param in &def.params { + tys.insert(param.ty.as_ref()); + } + } + tys + } +} + +impl Add for Registry { + type Output = Registry; + + fn add(mut self, other: Registry) -> Registry { + self.enums.extend(other.enums); + self.cmds.extend(other.cmds); + self.aliases.extend(other.aliases); + self + } +} diff --git a/third_party/rust/gl_generator/registry/parse.rs b/third_party/rust/gl_generator/registry/parse.rs new file mode 100644 index 000000000000..570c9cee2bee --- /dev/null +++ b/third_party/rust/gl_generator/registry/parse.rs @@ -0,0 +1,1154 @@ +// Copyright 2015 Brendan Zabarauskas and the gl-rs developers +// +// 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. + +extern crate khronos_api; + +use std::borrow::Cow; +use std::collections::hash_map::Entry; +use std::collections::BTreeSet; +use std::collections::HashSet; +use std::collections::HashMap; +use std::io; +use xml::attribute::OwnedAttribute; +use xml::EventReader as XmlEventReader; +use xml::reader::XmlEvent; + +use {Fallbacks, Api, Profile}; +use registry::{Binding, Cmd, Enum, GlxOpcode, Registry}; + +pub fn from_xml(src: R, filter: Filter) -> Registry { + XmlEventReader::new(src).into_iter() + .map(Result::unwrap) + .filter_map(ParseEvent::from_xml) + .parse(filter) +} + +#[derive(Debug, PartialEq, Eq)] +struct Attribute { + key: String, + value: String, +} + +impl Attribute { + fn new(key: Key, value: Value) -> Attribute where + Key: ToString, + Value: ToString, + { + Attribute { + key: key.to_string(), + value: value.to_string(), + } + } +} + +impl From for Attribute { + fn from(attribute: OwnedAttribute) -> Attribute { + Attribute::new(attribute.name.local_name, attribute.value) + } +} + +#[derive(Debug, PartialEq, Eq)] +enum ParseEvent { + Start(String, Vec), + End(String), + Text(String), +} + +impl ParseEvent { + fn from_xml(event: XmlEvent) -> Option { + match event { + XmlEvent::StartDocument { .. } => None, + XmlEvent::EndDocument => None, + XmlEvent::StartElement { name, attributes, .. } => { + let attributes = attributes.into_iter() + .map(Attribute::from) + .collect(); + Some(ParseEvent::Start(name.local_name, attributes)) + }, + XmlEvent::EndElement { name } => Some(ParseEvent::End(name.local_name)), + XmlEvent::Characters(chars) => Some(ParseEvent::Text(chars)), + XmlEvent::ProcessingInstruction { .. } => None, + XmlEvent::CData(_) => None, + XmlEvent::Comment(_) => None, + XmlEvent::Whitespace(_) => None, + } + } +} + +fn api_from_str(src: &str) -> Result { + match src { + "gl" => Ok(Api::Gl), + "glx" => Ok(Api::Glx), + "wgl" => Ok(Api::Wgl), + "egl" => Ok(Api::Egl), + "glcore" => Ok(Api::GlCore), + "gles1" => Ok(Api::Gles1), + "gles2" => Ok(Api::Gles2), + _ => Err(()), + } +} + +fn profile_from_str(src: &str) -> Result { + match src { + "core" => Ok(Profile::Core), + "compatibility" => Ok(Profile::Compatibility), + _ => Err(()), + } +} + +fn underscore_numeric_prefix(src: &str) -> String { + match src.chars().next() { + Some(c) if c.is_numeric() => format!("_{}", src), + Some(_) | None => src.to_string(), + } +} + +fn underscore_keyword(ident: String) -> String { + match ident.as_ref() { + "in" => "in_".to_string(), + "ref" => "ref_".to_string(), + "type" => "type_".to_string(), + _ => ident, + } +} + +fn trim_str<'a>(s: &'a str, trim: &str) -> &'a str { + if s.starts_with(trim) { &s[trim.len()..] } else { s } +} + +fn trim_enum_prefix(ident: &str, api: Api) -> String { + let ident = match api { + Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => trim_str(ident, "GL_"), + Api::Glx => trim_str(ident, "GLX_"), + Api::Wgl => trim_str(ident, "WGL_"), + Api::Egl => trim_str(ident, "EGL_"), + }; + underscore_numeric_prefix(ident) +} + +fn make_enum(ident: String, ty: Option, value: String, alias: Option) -> Enum { + let (ty, value, cast) = { + if value.starts_with("((") && value.ends_with(")") { + // Some enums have a value of the form `'((' type ')' expr ')'`. + + // nothing to see here.... + // just brute forcing some paren matching... (ノ ◕ ◡ ◕)ノ *:・゚✧ + let working = &value[2 .. value.len() - 1]; + if let Some((i, _)) = working.match_indices(")").next() { + let ty = working[.. i].to_string(); + let value = working[i + 1 ..].to_string(); + + (Cow::Owned(ty), value, true) + } else { + panic!("Unexpected value format: {}", value) + } + } else { + let ty = match ty { + Some(ref ty) if ty == "u" => "GLuint", + Some(ref ty) if ty == "ull" => "GLuint64", + Some(ty) => panic!("Unhandled enum type: {}", ty), + None if value.starts_with("\"") => "&'static str", + None if ident == "TRUE" || ident == "FALSE" => "GLboolean", + None => "GLenum", + }; + (Cow::Borrowed(ty), value, false) + } + }; + + Enum { + ident: ident, + value: value, + cast: cast, + alias: alias, + ty: ty, + } +} + +fn trim_cmd_prefix(ident: &str, api: Api) -> &str { + match api { + Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => trim_str(ident, "gl"), + Api::Glx => trim_str(ident, "glX"), + Api::Wgl => trim_str(ident, "wgl"), + Api::Egl => trim_str(ident, "egl"), + } +} + +fn merge_map(a: &mut HashMap>, b: HashMap>) { + for (k, v) in b { + match a.entry(k) { + Entry::Occupied(mut ent) => { ent.get_mut().extend(v); }, + Entry::Vacant(ent) => { ent.insert(v); } + } + } +} + +#[derive(Clone)] +struct Feature { + pub api: Api, + pub name: String, + pub number: String, + pub requires: Vec, + pub removes: Vec, +} + +#[derive(Clone)] +struct Require { + /// A reference to the earlier types, by name + pub enums: Vec, + /// A reference to the earlier types, by name + pub commands: Vec, +} + +#[derive(Clone)] +struct Remove { + // always Core, for now + pub profile: Profile, + /// A reference to the earlier types, by name + pub enums: Vec, + /// A reference to the earlier types, by name + pub commands: Vec, +} + +#[derive(Clone)] +struct Extension { + pub name: String, + /// which apis this extension is defined for (see Feature.api) + pub supported: Vec, + pub requires: Vec, +} + +pub struct Filter { + pub api: Api, + pub fallbacks: Fallbacks, + pub extensions: BTreeSet, + pub profile: Profile, + pub version: String, +} + +trait Parse: Sized + Iterator { + fn parse(mut self, filter: Filter) -> Registry { + self.consume_start_element("registry"); + + let mut enums = Vec::new(); + let mut cmds = Vec::new(); + let mut features = Vec::new(); + let mut extensions = Vec::new(); + let mut aliases = HashMap::new(); + + while let Some(event) = self.next() { + match event { + // ignores + ParseEvent::Text(_) => (), + ParseEvent::Start(ref name, _) if name == "comment" => self.skip_to_end("comment"), + ParseEvent::Start(ref name, _) if name == "types" => self.skip_to_end("types"), + ParseEvent::Start(ref name, _) if name == "groups" => self.skip_to_end("groups"), + + // add enum namespace + ParseEvent::Start(ref name, _) if name == "enums" => { + enums.extend(self.consume_enums(filter.api)); + } + + // add command namespace + ParseEvent::Start(ref name, _) if name == "commands" => { + let (new_cmds, new_aliases) = self.consume_cmds(filter.api); + cmds.extend(new_cmds); + merge_map(&mut aliases, new_aliases); + } + + ParseEvent::Start(ref name, ref attributes) if name == "feature" => { + debug!("Parsing feature: {:?}", attributes); + features.push(Feature::convert(&mut self, &attributes)); + } + + ParseEvent::Start(ref name, _) if name == "extensions" => { + loop { + match self.next().unwrap() { + ParseEvent::Start(ref name, ref attributes) if name == "extension" => { + extensions.push(Extension::convert(&mut self, &attributes)); + } + ParseEvent::End(ref name) if name == "extensions" => break, + event => panic!("Unexpected message {:?}", event), + } + } + } + + // finished building the registry + ParseEvent::End(ref name) if name == "registry" => break, + + // error handling + event => panic!("Expected , found: {:?}", event), + } + } + + let mut desired_enums = HashSet::new(); + let mut desired_cmds = HashSet::new(); + + // find the features we want + let mut found_feature = false; + for feature in &features { + // XXX: verify that the string comparison with <= actually works as desired + if feature.api == filter.api && feature.number <= filter.version { + for require in &feature.requires { + desired_enums.extend(require.enums.iter().map(|x| x.clone())); + desired_cmds.extend(require.commands.iter().map(|x| x.clone())); + } + + for remove in &feature.removes { + if remove.profile == filter.profile { + for enm in &remove.enums { + debug!("Removing {}", enm); + desired_enums.remove(enm); + } + for cmd in &remove.commands { + debug!("Removing {}", cmd); + desired_cmds.remove(cmd); + } + } + } + } + if feature.number == filter.version { + found_feature = true; + } + } + + if !found_feature { + panic!("Did not find version {} in the registry", filter.version); + } + + for extension in &extensions { + if filter.extensions.contains(&extension.name) { + if !extension.supported.contains(&filter.api) { + panic!("Requested {}, which doesn't support the {} API", extension.name, filter.api); + } + for require in &extension.requires { + desired_enums.extend(require.enums.iter().map(|x| x.clone())); + desired_cmds.extend(require.commands.iter().map(|x| x.clone())); + } + } + } + + let is_desired_enum = |e: &Enum| { + desired_enums.contains(&("GL_".to_string() + &e.ident)) || + desired_enums.contains(&("WGL_".to_string() + &e.ident)) || + desired_enums.contains(&("GLX_".to_string() + &e.ident)) || + desired_enums.contains(&("EGL_".to_string() + &e.ident)) + }; + + let is_desired_cmd = |c: &Cmd| { + desired_cmds.contains(&("gl".to_string() + &c.proto.ident)) || + desired_cmds.contains(&("wgl".to_string() + &c.proto.ident)) || + desired_cmds.contains(&("glX".to_string() + &c.proto.ident)) || + desired_cmds.contains(&("egl".to_string() + &c.proto.ident)) + }; + + Registry { + api: filter.api, + enums: enums.into_iter().filter(is_desired_enum).collect(), + cmds: cmds.into_iter().filter(is_desired_cmd).collect(), + aliases: if filter.fallbacks == Fallbacks::None { HashMap::new() } else { aliases }, + } + } + + fn consume_characters(&mut self) -> String { + match self.next().unwrap() { + ParseEvent::Text(ch) => ch, + event => panic!("Expected characters, found: {:?}", event), + } + } + + fn consume_start_element(&mut self, expected_name: &str) -> Vec { + match self.next().unwrap() { + ParseEvent::Start(name, attributes) => { + if expected_name == name { attributes } else { + panic!("Expected <{}>, found: <{}>", expected_name, name) + } + } + event => panic!("Expected <{}>, found: {:?}", expected_name, event), + } + } + + fn consume_end_element(&mut self, expected_name: &str) { + match self.next().unwrap() { + ParseEvent::End(ref name) if expected_name == name => (), + event => panic!("Expected , found: {:?}", expected_name, event), + } + } + + fn skip_to_end(&mut self, expected_name: &str) { + loop { + match self.next().unwrap() { + ParseEvent::End(ref name) if expected_name == name => break, + _ => {}, + } + } + } + + fn consume_two<'a, T: FromXml, U: FromXml>(&mut self, one: &'a str, two: &'a str, end: &'a str) -> (Vec, Vec) { + debug!("consume_two: looking for {} and {} until {}", one, two, end); + + let mut ones = Vec::new(); + let mut twos = Vec::new(); + + loop { + match self.next().unwrap() { + ParseEvent::Start(ref name, ref attributes) => { + debug!("Found start element <{:?} {:?}>", name, attributes); + debug!("one and two are {} and {}", one, two); + + let n = name.clone(); + + if one == n { + ones.push(FromXml::convert(self, &attributes)); + } else if "type" == n { + // XXX: GL1.1 contains types, which we never care about anyway. + // Make sure consume_two doesn't get used for things which *do* + // care about type. + warn!("Ignoring type!"); + continue; + } else if two == n { + twos.push(FromXml::convert(self, &attributes)); + } else { + panic!("Unexpected element: <{:?} {:?}>", n, &attributes); + } + }, + ParseEvent::End(ref name) => { + debug!("Found end element ", name); + + if one == name || two == name { + continue; + } else if "type" == name { + // XXX: GL1.1 contains types, which we never care about anyway. + // Make sure consume_two doesn't get used for things which *do* + // care about type. + warn!("Ignoring type!"); + continue; + } else if end == name { + return (ones, twos); + } else { + panic!("Unexpected end element {:?}", name); + } + }, + event => panic!("Unexpected message {:?}", event) } + } + } + + fn consume_enums(&mut self, api: Api) -> Vec { + let mut enums = Vec::new(); + loop { + match self.next().unwrap() { + // ignores + ParseEvent::Text(_) => {}, + ParseEvent::Start(ref name, _) if name == "unused" => self.skip_to_end("unused"), + + // add enum definition + ParseEvent::Start(ref name, ref attributes) if name == "enum" => { + enums.push(self.consume_enum(api, attributes)); + }, + + // finished building the namespace + ParseEvent::End(ref name) if name == "enums" => break, + // error handling + event => panic!("Expected , found: {:?}", event), + } + } + enums + } + + fn consume_enum(&mut self, api: Api, attributes: &[Attribute]) -> Enum { + let ident = trim_enum_prefix(&get_attribute(&attributes, "name").unwrap(), api).to_string(); + let value = get_attribute(&attributes, "value").unwrap(); + let alias = get_attribute(&attributes, "alias"); + let ty = get_attribute(&attributes, "type"); + self.consume_end_element("enum"); + + make_enum(ident, ty, value, alias) + } + + fn consume_cmds(&mut self, api: Api) -> (Vec, HashMap>) { + let mut cmds = Vec::new(); + let mut aliases: HashMap> = HashMap::new(); + loop { + match self.next().unwrap() { + // add command definition + ParseEvent::Start(ref name, _) if name == "command" => { + let new = self.consume_cmd(api); + if let Some(ref v) = new.alias { + match aliases.entry(v.clone()) { + Entry::Occupied(mut ent) => { ent.get_mut().push(new.proto.ident.clone()); }, + Entry::Vacant(ent) => { ent.insert(vec![new.proto.ident.clone()]); } + } + } + cmds.push(new); + } + // finished building the namespace + ParseEvent::End(ref name) if name == "commands" => break, + // error handling + event => panic!("Expected , found: {:?}", event), + } + } + (cmds, aliases) + } + + fn consume_cmd(&mut self, api: Api) -> Cmd { + // consume command prototype + self.consume_start_element("proto"); + let mut proto = self.consume_binding("proto"); + proto.ident = trim_cmd_prefix(&proto.ident, api).to_string(); + + let mut params = Vec::new(); + let mut alias = None; + let mut vecequiv = None; + let mut glx = None; + loop { + match self.next().unwrap() { + ParseEvent::Start(ref name, _) if name == "param" => { + params.push(self.consume_binding("param")); + } + ParseEvent::Start(ref name, ref attributes) if name == "alias" => { + alias = get_attribute(&attributes, "name"); + alias = alias.map(|t| trim_cmd_prefix(&t, api).to_string()); + self.consume_end_element("alias"); + } + ParseEvent::Start(ref name, ref attributes) if name == "vecequiv" => { + vecequiv = get_attribute(&attributes, "vecequiv"); + self.consume_end_element("vecequiv"); + } + ParseEvent::Start(ref name, ref attributes) if name == "glx" => { + glx = Some(GlxOpcode { + opcode: get_attribute(&attributes, "opcode").unwrap(), + name: get_attribute(&attributes, "name"), + }); + self.consume_end_element("glx"); + } + ParseEvent::End(ref name) if name == "command" => break, + event => panic!("Expected , found: {:?}", event), + } + } + + Cmd { + proto: proto, + params: params, + alias: alias, + vecequiv: vecequiv, + glx: glx, + } + } + + fn consume_binding(&mut self, outside_tag: &str) -> Binding { + // consume type + let mut ty = String::new(); + loop { + match self.next().unwrap() { + ParseEvent::Text(text) => ty.push_str(&text), + ParseEvent::Start(ref name, _) if name == "ptype" => (), + ParseEvent::End(ref name) if name == "ptype" => (), + ParseEvent::Start(ref name, _) if name == "name" => break, + event => panic!("Expected binding, found: {:?}", event), + } + } + + // consume identifier + let ident = underscore_keyword(self.consume_characters()); + self.consume_end_element("name"); + + // consume the type suffix + loop { + match self.next().unwrap() { + ParseEvent::Text(text) => ty.push_str(&text), + ParseEvent::End(ref name) if name == outside_tag => break, + event => panic!("Expected binding, found: {:?}", event), + } + } + + Binding { + ident: ident, + ty: to_rust_ty(ty), + } + } +} + +impl Parse for T where + T: Sized + Iterator, +{} + +fn get_attribute(attribs: &[Attribute], key: &str) -> Option { + attribs.iter() + .find(|attrib| attrib.key == key) + .map(|attrib| attrib.value.clone()) +} + +trait FromXml { + fn convert(parser: &mut P, a: &[Attribute]) -> Self; +} + +impl FromXml for Require { + fn convert(parser: &mut P, _: &[Attribute]) -> Require { + debug!("Doing a FromXml on Require"); + let (enums, commands) = parser.consume_two("enum", "command", "require"); + Require { + enums: enums, + commands: commands + } + } +} + +impl FromXml for Remove { + fn convert(parser: &mut P, a: &[Attribute]) -> Remove { + debug!("Doing a FromXml on Remove"); + let profile = get_attribute(a, "profile").unwrap(); + let profile = profile_from_str(&profile).unwrap(); + let (enums, commands) = parser.consume_two("enum", "command", "remove"); + + Remove { + profile: profile, + enums: enums, + commands: commands + } + } +} + +impl FromXml for Feature { + fn convert(parser: &mut P, a: &[Attribute]) -> Feature { + debug!("Doing a FromXml on Feature"); + let api = get_attribute(a, "api").unwrap(); + let api = api_from_str(&api).unwrap(); + let name = get_attribute(a, "name").unwrap(); + let number = get_attribute(a, "number").unwrap(); + + debug!("Found api = {}, name = {}, number = {}", api, name, number); + + let (require, remove) = parser.consume_two("require", "remove", "feature"); + + Feature { + api: api, + name: name, + number: number, + requires: require, + removes: remove + } + } +} + +impl FromXml for Extension { + fn convert(parser: &mut P, a: &[Attribute]) -> Extension { + debug!("Doing a FromXml on Extension"); + let name = get_attribute(a, "name").unwrap(); + let supported = get_attribute(a, "supported").unwrap() + .split('|') + .map(api_from_str) + .map(Result::unwrap) + .collect::>(); + let mut require = Vec::new(); + loop { + match parser.next().unwrap() { + ParseEvent::Start(ref name, ref attributes) if name == "require" => { + require.push(FromXml::convert(parser, &attributes)); + } + ParseEvent::End(ref name) if name == "extension" => break, + event => panic!("Unexpected message {:?}", event) + } + } + + Extension { + name: name, + supported: supported, + requires: require + } + } +} + +impl FromXml for String { + fn convert(_: &mut P, a: &[Attribute]) -> String { + get_attribute(a, "name").unwrap() + } +} + +/// Converts a C style type definition to the Rust equivalent +pub fn to_rust_ty>(ty: T) -> Cow<'static, str> { + let ty = match ty.as_ref() { + // gl.xml types + "GLDEBUGPROC" => "types::GLDEBUGPROC", + "GLDEBUGPROCAMD" => "types::GLDEBUGPROCAMD", + "GLDEBUGPROCARB" => "types::GLDEBUGPROCARB", + "GLDEBUGPROCKHR" => "types::GLDEBUGPROCKHR", + "GLbitfield" => "types::GLbitfield", + "GLboolean" => "types::GLboolean", + "GLbyte" => "types::GLbyte", + "GLclampd" => "types::GLclampd", + "GLclampf" => "types::GLclampf", + "GLclampx" => "types::GLclampx", + "GLdouble" => "types::GLdouble", + "GLeglImageOES" => "types::GLeglImageOES", + "GLenum" => "types::GLenum", + "GLfixed" => "types::GLfixed", + "GLfloat" => "types::GLfloat", + "GLhalfNV" => "types::GLhalfNV", + "GLhandleARB" => "types::GLhandleARB", + "GLint" => "types::GLint", + "GLint64" => "types::GLint64", + "GLint64EXT" => "types::GLint64EXT", + "GLintptr" => "types::GLintptr", + "GLintptrARB" => "types::GLintptrARB", + "GLshort" => "types::GLshort", + "GLsizei" => "types::GLsizei", + "GLsizeiptr" => "types::GLsizeiptr", + "GLsizeiptrARB" => "types::GLsizeiptrARB", + "GLsync" => "types::GLsync", + "GLubyte" => "types::GLubyte", + "GLuint" => "types::GLuint", + "GLuint64" => "types::GLuint64", + "GLuint64EXT" => "types::GLuint64EXT", + "GLushort" => "types::GLushort", + "GLvdpauSurfaceNV" => "types::GLvdpauSurfaceNV", + "void " => "()", + "GLboolean *" => "*mut types::GLboolean", + "GLchar *" => "*mut types::GLchar", + "GLcharARB *" => "*mut types::GLcharARB", + "GLdouble *" => "*mut types::GLdouble", + "GLenum *" => "*mut types::GLenum", + "GLfixed *" => "*mut types::GLfixed", + "GLfloat *" => "*mut types::GLfloat", + "GLhandleARB *" => "*mut types::GLhandleARB", + "GLint *" => "*mut types::GLint", + "GLint64 *" => "*mut types::GLint64", + "GLint64EXT *" => "*mut types::GLint64EXT", + "GLsizei *" => "*mut types::GLsizei", + "GLubyte *" => "*mut types::GLubyte", + "GLuint *" => "*mut types::GLuint", + "GLuint [2]" => "*mut [types::GLuint; 2]", + "GLuint64 *" => "*mut types::GLuint64", + "GLuint64EXT *" => "*mut types::GLuint64EXT", + "GLushort *" => "*mut types::GLushort", + "GLvoid *" => "*mut types::GLvoid", + "GLvoid **" => "*const *mut types::GLvoid", + "void *" => "*mut __gl_imports::raw::c_void", + "void **" => "*const *mut __gl_imports::raw::c_void", + "const GLboolean *" => "*const types::GLboolean", + "const GLbyte *" => "*const types::GLbyte", + "const GLchar *" => "*const types::GLchar", + "const GLcharARB *" => "*const types::GLcharARB", + "const GLclampf *" => "*const types::GLclampf", + "const GLdouble *" => "*const types::GLdouble", + "const GLenum *" => "*const types::GLenum", + "const GLfixed *" => "*const types::GLfixed", + "const GLfloat" => "types::GLfloat", + "const GLfloat *" => "*const types::GLfloat", + "const GLhalfNV *" => "*const types::GLhalfNV", + "const GLint *" => "*const types::GLint", + "const GLint64 *" => "*const types::GLint64", + "const GLint64EXT *" => "*const types::GLint64EXT", + "const GLintptr *" => "*const types::GLintptr", + "const GLshort *" => "*const types::GLshort", + "const GLsizei *" => "*const types::GLsizei", + "const GLsizeiptr *" => "*const types::GLsizeiptr", + "const GLubyte *" => "*const types::GLubyte", + "const GLuint *" => "*const types::GLuint", + "const GLuint64 *" => "*const types::GLuint64", + "const GLuint64EXT *" => "*const types::GLuint64EXT", + "const GLushort *" => "*const types::GLushort", + "const GLvdpauSurfaceNV *" => "*const types::GLvdpauSurfaceNV", + "const GLvoid *" => "*const types::GLvoid", + "const void *" => "*const __gl_imports::raw::c_void", + "const void **" => "*const *const __gl_imports::raw::c_void", + "const void *const*" => "*const *const __gl_imports::raw::c_void", + "const GLboolean **" => "*const *const types::GLboolean", + "const GLchar **" => "*const *const types::GLchar", + "const GLcharARB **" => "*const *const types::GLcharARB", + "const GLvoid **" => "*const *const types::GLvoid", + "const GLchar *const*" => "*const *const types::GLchar", + "const GLvoid *const*" => "*const *const types::GLvoid", + "struct _cl_context *" => "*const types::_cl_context", + "struct _cl_event *" => "*const types::_cl_event", + "GLuint[2]" => "[Gluint; 2]", + + // glx.xml types + "Bool" => "types::Bool", + "Colormap" => "types::Colormap", + "DMbuffer" => "types::DMbuffer", + "Font" => "types::Font", + "GLXContext" => "types::GLXContext", + "GLXContextID" => "types::GLXContextID", + "GLXDrawable" => "types::GLXDrawable", + "GLXFBConfig" => "types::GLXFBConfig", + "GLXFBConfigSGIX" => "types::GLXFBConfigSGIX", + "GLXPbuffer" => "types::GLXPbuffer", + "GLXPbufferSGIX" => "types::GLXPbufferSGIX", + "GLXPixmap" => "types::GLXPixmap", + "GLXVideoCaptureDeviceNV" => "types::GLXVideoCaptureDeviceNV", + "GLXVideoDeviceNV" => "types::GLXVideoDeviceNV", + "GLXVideoSourceSGIX" => "types::GLXVideoSourceSGIX", + "GLXWindow" => "types::GLXWindow", + // "GLboolean" => "types::GLboolean", + // "GLenum" => "types::GLenum", + // "GLint" => "types::GLint", + // "GLsizei" => "types::GLsizei", + // "GLuint" => "types::GLuint", + "Pixmap" => "types::Pixmap", + "Status" => "types::Status", + "VLNode" => "types::VLNode", + "VLPath" => "types::VLPath", + "VLServer" => "types::VLServer", + "Window" => "types::Window", + "__GLXextFuncPtr" => "types::__GLXextFuncPtr", + "const GLXContext" => "const types::GLXContext", + "float " => "__gl_imports::raw::c_float", + "int " => "__gl_imports::raw::c_int", + "int64_t" => "i64", + "unsigned int " => "__gl_imports::raw::c_uint", + "unsigned long " => "__gl_imports::raw::c_ulong", + // "void " => "()", + "DMparams *" => "*mut types::DMparams", + "Display *" => "*mut types::Display", + "GLXFBConfig *" => "*mut types::GLXFBConfig", + "GLXFBConfigSGIX *" => "*mut types::GLXFBConfigSGIX", + "GLXHyperpipeConfigSGIX *" => "*mut types::GLXHyperpipeConfigSGIX", + "GLXHyperpipeNetworkSGIX *" => "*mut types::GLXHyperpipeNetworkSGIX", + "GLXVideoCaptureDeviceNV *" => "*mut types::GLXVideoCaptureDeviceNV", + "GLXVideoDeviceNV *" => "*mut types::GLXVideoDeviceNV", + // "GLuint *" => "*mut types::GLuint", + "XVisualInfo *" => "*mut types::XVisualInfo", + // "const GLubyte *" => "*GLubyte", + "const char *" => "*const __gl_imports::raw::c_char", + "const int *" => "*const __gl_imports::raw::c_int", + // "const void *" => "*const __gl_imports::raw::c_void", + "int *" => "*mut __gl_imports::raw::c_int", + "int32_t *" => "*mut i32", + "int64_t *" => "*mut i64", + "long *" => "*mut __gl_imports::raw::c_long", + "unsigned int *" => "*mut __gl_imports::raw::c_uint", + "unsigned long *" => "*mut __gl_imports::raw::c_ulong", + // "void *" => "*mut __gl_imports::raw::c_void", + + // wgl.xml types + "BOOL" => "types::BOOL", + "DWORD" => "types::DWORD", + "FLOAT" => "types::FLOAT", + // "GLbitfield" => "types::GLbitfield", + // "GLboolean" => "types::GLboolean", + // "GLenum" => "types::GLenum", + // "GLfloat" => "types::GLfloat", + // "GLint" => "types::GLint", + // "GLsizei" => "types::GLsizei", + // "GLuint" => "types::GLuint", + // "GLushort" => "types::GLushort", + "HANDLE" => "types::HANDLE", + "HDC" => "types::HDC", + "HENHMETAFILE" => "types::HENHMETAFILE", + "HGLRC" => "types::HGLRC", + "HGPUNV" => "types::HGPUNV", + "HPBUFFERARB" => "types::HPBUFFERARB", + "HPBUFFEREXT" => "types::HPBUFFEREXT", + "HPVIDEODEV" => "types::HPVIDEODEV", + "HVIDEOINPUTDEVICENV" => "types::HVIDEOINPUTDEVICENV", + "HVIDEOOUTPUTDEVICENV" => "types::HVIDEOOUTPUTDEVICENV", + "INT" => "types::INT", + "INT64" => "types::INT64", + "LPCSTR" => "types::LPCSTR", + "LPGLYPHMETRICSFLOAT" => "types::LPGLYPHMETRICSFLOAT", + "LPVOID" => "types::LPVOID", + "PGPU_DEVICE" => "types::PGPU_DEVICE", + "PROC" => "types::PROC", + "UINT" => "types::UINT", + "VOID" => "types::VOID", + // "int " => "__gl_imports::raw::c_int", + // "unsigned int " => "__gl_imports::raw::c_uint", + // "void " => "()", + "BOOL *" => "*mut types::BOOL", + "DWORD *" => "*mut types::DWORD", + "FLOAT *" => "*mut types::FLOAT", + // "GLuint *" => "*mut types::GLuint", + "HANDLE *" => "*mut types::HANDLE", + "HGPUNV *" => "*mut types::HGPUNV", + "HPVIDEODEV *" => "*mut types::HPVIDEODEV", + "HVIDEOINPUTDEVICENV *" => "*mut types::HVIDEOINPUTDEVICENV", + "HVIDEOOUTPUTDEVICENV *" => "*mut types::HVIDEOOUTPUTDEVICENV", + "INT32 *" => "*mut types::INT32", + "INT64 *" => "*mut types::INT64", + "UINT *" => "*mut types::UINT", + "USHORT *" => "*mut types::USHORT", + "const COLORREF *" => "*const types::COLORREF", + "const DWORD *" => "*const types::DWORD", + "const FLOAT *" => "*const types::FLOAT", + // "const GLushort *" => "*const types::GLushort", + "const HANDLE *" => "*const types::HANDLE", + "const HGPUNV *" => "*const types::HGPUNV", + "const LAYERPLANEDESCRIPTOR *" => "*const types::LAYERPLANEDESCRIPTOR", + "const LPVOID *" => "*const types::LPVOID", + "const PIXELFORMATDESCRIPTOR *" => "*const types::IXELFORMATDESCRIPTOR", + "const USHORT *" => "*const types::USHORT", + // "const char *" => "*const __gl_imports::raw::c_char", + // "const int *" => "*const __gl_imports::raw::c_int", + "float *" => "*mut __gl_imports::raw::c_float", + // "int *" => "*mut __gl_imports::raw::c_int", + // "unsigned long *" => "*mut __gl_imports::raw::c_ulong", + // "void *" => "*mut __gl_imports::raw::c_void", + + // elx.xml types + "khronos_utime_nanoseconds_t" => "types::khronos_utime_nanoseconds_t", + "khronos_uint64_t" => "types::khronos_uint64_t", + "khronos_ssize_t" => "types::khronos_ssize_t", + "EGLNativeDisplayType" => "types::EGLNativeDisplayType", + "EGLNativePixmapType" => "types::EGLNativePixmapType", + "EGLNativeWindowType" => "types::EGLNativeWindowType", + "EGLint" => "types::EGLint", + "EGLint *" => "*mut types::EGLint", + "const EGLint *" => "*const types::EGLint", + "NativeDisplayType" => "types::NativeDisplayType", + "NativePixmapType" => "types::NativePixmapType", + "NativeWindowType" => "types::NativeWindowType", + //"Bool" => "types::Bool", + "EGLBoolean" => "types::EGLBoolean", + "EGLenum" => "types::EGLenum", + "EGLAttribKHR" => "types::EGLAttribKHR", + "EGLAttrib" => "types::EGLAttrib", + "EGLAttrib *" => "*mut types::EGLAttrib", + "const EGLAttrib *" => "*const types::EGLAttrib", + "EGLConfig" => "types::EGLConfig", + "EGLConfig *" => "*mut types::EGLConfig", + "EGLContext" => "types::EGLContext", + "EGLDeviceEXT" => "types::EGLDeviceEXT", + "EGLDisplay" => "types::EGLDisplay", + "EGLSurface" => "types::EGLSurface", + "EGLClientBuffer" => "types::EGLClientBuffer", + "__eglMustCastToProperFunctionPointerType" => "types::__eglMustCastToProperFunctionPointerType", + "EGLImageKHR" => "types::EGLImageKHR", + "EGLImage" => "types::EGLImage", + "EGLOutputLayerEXT" => "types::EGLOutputLayerEXT", + "EGLOutputPortEXT" => "types::EGLOutputPortEXT", + "EGLSyncKHR" => "types::EGLSyncKHR", + "EGLSync" => "types::EGLSync", + "EGLTimeKHR" => "types::EGLTimeKHR", + "EGLTime" => "types::EGLTime", + "EGLSyncNV" => "types::EGLSyncNV", + "EGLTimeNV" => "types::EGLTimeNV", + "EGLuint64NV" => "types::EGLuint64NV", + "EGLStreamKHR" => "types::EGLStreamKHR", + "EGLuint64KHR" => "types::EGLuint64KHR", + "EGLNativeFileDescriptorKHR" => "types::EGLNativeFileDescriptorKHR", + "EGLsizeiANDROID" => "types::EGLsizeiANDROID", + "EGLSetBlobFuncANDROID" => "types::EGLSetBlobFuncANDROID", + "EGLGetBlobFuncANDROID" => "types::EGLGetBlobFuncANDROID", + "EGLClientPixmapHI" => "types::EGLClientPixmapHI", + "struct EGLClientPixmapHI *" => "*const types::EGLClientPixmapHI", + "const EGLAttribKHR *" => "*const types::EGLAttribKHR", + "const EGLuint64KHR *" => "*const types::EGLuint64KHR", + "EGLAttribKHR *" => "*mut types::EGLAttribKHR", + "EGLDeviceEXT *" => "*mut types::EGLDeviceEXT", + "EGLNativeDisplayType *" => "*mut types::EGLNativeDisplayType", + "EGLNativePixmapType *" => "*mut types::EGLNativePixmapType", + "EGLNativeWindowType *" => "*mut types::EGLNativeWindowType", + "EGLOutputLayerEXT *" => "*mut types::EGLOutputLayerEXT", + "EGLTimeKHR *" => "*mut types::EGLTimeKHR", + "EGLOutputPortEXT *" => "*mut types::EGLOutputPortEXT", + "EGLuint64KHR *" => "*mut types::EGLuint64KHR", + + // failure + _ => panic!("Type conversion not implemented for `{}`", ty.as_ref()), + }; + + Cow::Borrowed(ty) +} + +#[cfg(test)] +mod tests { + mod underscore_numeric_prefix { + use registry::parse; + + #[test] + fn test_numeric_prefix() { + assert_eq!(parse::underscore_numeric_prefix("3"), "_3"); + assert_eq!(parse::underscore_numeric_prefix("123_FOO"), "_123_FOO"); + } + + #[test] + fn test_non_numeric_prefix() { + assert_eq!(parse::underscore_numeric_prefix(""), ""); + assert_eq!(parse::underscore_numeric_prefix("A"), "A"); + assert_eq!(parse::underscore_numeric_prefix("FOO"), "FOO"); + } + } + + mod underscore_keyword { + use registry::parse; + + #[test] + fn test_keyword() { + assert_eq!(parse::underscore_keyword("in".to_string()), "in_"); + assert_eq!(parse::underscore_keyword("ref".to_string()), "ref_"); + assert_eq!(parse::underscore_keyword("type".to_string()), "type_"); + } + + #[test] + fn test_non_keyword() { + assert_eq!(parse::underscore_keyword("foo".to_string()), "foo"); + assert_eq!(parse::underscore_keyword("bar".to_string()), "bar"); + } + } + mod make_enum { + use registry::parse; + + #[test] + fn test_cast_0() { + let e = parse::make_enum("FOO".to_string(), None, "((EGLint)-1)".to_string(), Some("BAR".to_string())); + assert_eq!(e.ident, "FOO"); + assert_eq!((&*e.ty, &*e.value), ("EGLint", "-1")); + assert_eq!(e.alias, Some("BAR".to_string())); + } + + #[test] + fn test_cast_1() { + let e = parse::make_enum("FOO".to_string(), None, "((EGLint)(-1))".to_string(), Some("BAR".to_string())); + assert_eq!(e.ident, "FOO"); + assert_eq!((&*e.ty, &*e.value), ("EGLint", "(-1)")); + assert_eq!(e.alias, Some("BAR".to_string())); + } + + #[test] + fn test_no_type() { + let e = parse::make_enum("FOO".to_string(), None, "value".to_string(), Some("BAR".to_string())); + assert_eq!(e.ident, "FOO"); + assert_eq!(e.value, "value"); + assert_eq!(e.alias, Some("BAR".to_string())); + assert_eq!(e.ty, "GLenum"); + assert_eq!(e.cast, false); + } + + #[test] + fn test_u() { + let e = parse::make_enum("FOO".to_string(), Some("u".to_string()), String::new(), None); + assert_eq!(e.ty, "GLuint"); + } + + #[test] + fn test_ull() { + let e = parse::make_enum("FOO".to_string(), Some("ull".to_string()), String::new(), None); + assert_eq!(e.ty, "GLuint64"); + } + + #[test] + #[should_panic] + fn test_unknown_type() { + parse::make_enum("FOO".to_string(), Some("blargh".to_string()), String::new(), None); + } + + #[test] + fn test_value_str() { + let e = parse::make_enum("FOO".to_string(), None, "\"hi\"".to_string(), None); + assert_eq!(e.ty, "&'static str"); + } + + #[test] + fn test_ident_true() { + let e = parse::make_enum("TRUE".to_string(), None, String::new(), None); + assert_eq!(e.ty, "GLboolean"); + } + + #[test] + fn test_ident_false() { + let e = parse::make_enum("FALSE".to_string(), None, String::new(), None); + assert_eq!(e.ty, "GLboolean"); + } + } + + mod parse_event { + mod from_xml { + use xml::attribute::OwnedAttribute; + use xml::common::XmlVersion; + use xml::name::OwnedName; + use xml::namespace::Namespace; + use xml::reader::XmlEvent; + + use registry::parse::{Attribute, ParseEvent}; + + #[test] + fn test_start_event() { + let given = XmlEvent::StartElement { + name: OwnedName::local("element"), + attributes: vec![ + OwnedAttribute::new(OwnedName::local("attr1"), "val1"), + OwnedAttribute::new(OwnedName::local("attr2"), "val2"), + ], + namespace: Namespace::empty(), + }; + let expected = ParseEvent::Start( + "element".to_string(), + vec![ + Attribute::new("attr1", "val1"), + Attribute::new("attr2", "val2"), + ], + ); + assert_eq!(ParseEvent::from_xml(given), Some(expected)); + } + + #[test] + fn test_end_element() { + let given = XmlEvent::EndElement { + name: OwnedName::local("element"), + }; + let expected = ParseEvent::End("element".to_string()); + assert_eq!(ParseEvent::from_xml(given), Some(expected)); + } + + #[test] + fn test_characters() { + let given = XmlEvent::Characters("text".to_string()); + let expected = ParseEvent::Text("text".to_string()); + assert_eq!(ParseEvent::from_xml(given), Some(expected)); + } + + #[test] + fn test_start_document() { + let given = XmlEvent::StartDocument { + version: XmlVersion::Version10, + encoding: "".to_string(), + standalone: None, + }; + assert_eq!(ParseEvent::from_xml(given), None); + } + + #[test] + fn test_end_document() { + let given = XmlEvent::EndDocument; + assert_eq!(ParseEvent::from_xml(given), None); + } + + #[test] + fn test_processing_instruction() { + let given = XmlEvent::ProcessingInstruction { + name: "".to_string(), + data: None, + }; + assert_eq!(ParseEvent::from_xml(given), None); + } + + #[test] + fn test_cdata() { + let given = XmlEvent::CData("CData".to_string()); + assert_eq!(ParseEvent::from_xml(given), None); + } + + #[test] + fn test_comment() { + let given = XmlEvent::Comment("Comment".to_string()); + assert_eq!(ParseEvent::from_xml(given), None); + } + + #[test] + fn test_whitespace() { + let given = XmlEvent::Whitespace("Whitespace".to_string()); + assert_eq!(ParseEvent::from_xml(given), None); + } + } + } +} diff --git a/third_party/rust/gleam/.cargo-checksum.json b/third_party/rust/gleam/.cargo-checksum.json new file mode 100644 index 000000000000..447b49a7a708 --- /dev/null +++ b/third_party/rust/gleam/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"46f5e5da873985b56fc97643a27f610feec18724aad8e899379f3b8c84c329ae","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"08c1304ddded710af219247d613a1f5ea16ded3641dfd70a3a8823e131e1e8d5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"2de24b7458d6b88f20324303a48acf64a4f2bbfb83d2ec4d6ff2b4f4a1fd2275","build.rs":"5b2abf3e2b85f4d0bdbbaa5778c8fd7480eb151db3bd699ec63b77fa3afdfd7b","src/gl.rs":"feb6da4fc27e8ed2661c5327875323cf129b6709eb7558dde03741af28d60802","src/lib.rs":"ad33ebcb3f4a0edc36e95c837cda6f01a0be8a6ab1bcf485565fb03f70831324"},"package":"7a3023edde169b7767a71d2e5dd8e8903ac3b1436ff659225310928db87d6a8a"} \ No newline at end of file diff --git a/third_party/rust/gleam/.cargo-ok b/third_party/rust/gleam/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/gleam/.gitignore b/third_party/rust/gleam/.gitignore new file mode 100644 index 000000000000..4fffb2f89cbd --- /dev/null +++ b/third_party/rust/gleam/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/third_party/rust/gleam/.travis.yml b/third_party/rust/gleam/.travis.yml new file mode 100644 index 000000000000..ecdd3619b68e --- /dev/null +++ b/third_party/rust/gleam/.travis.yml @@ -0,0 +1,3 @@ +language: rust +notifications: + webhooks: http://build.servo.org:54856/travis diff --git a/third_party/rust/gleam/COPYING b/third_party/rust/gleam/COPYING new file mode 100644 index 000000000000..8b7291ad281c --- /dev/null +++ b/third_party/rust/gleam/COPYING @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 or the MIT license +, at your +option. All files in the project carrying such notice may not be +copied, modified, or distributed except according to those terms. diff --git a/third_party/rust/gleam/Cargo.toml b/third_party/rust/gleam/Cargo.toml new file mode 100644 index 000000000000..3b7cb2c8e8b0 --- /dev/null +++ b/third_party/rust/gleam/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "gleam" +version = "0.2.31" +license = "Apache-2.0/MIT" +authors = ["The Servo Project Developers"] +build = "build.rs" +documentation = "http://doc.servo.org/gleam/" +repository = "https://github.com/servo/gleam" +description = "Generated OpenGL bindings and wrapper for Servo." + +[build-dependencies] +gl_generator = "0.5.0" +pkg-config = "0.3.8" diff --git a/third_party/rust/gleam/LICENSE-APACHE b/third_party/rust/gleam/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/gleam/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/gleam/LICENSE-MIT b/third_party/rust/gleam/LICENSE-MIT new file mode 100644 index 000000000000..807526f57f3a --- /dev/null +++ b/third_party/rust/gleam/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2012-2013 Mozilla Foundation + +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. diff --git a/third_party/rust/gleam/README.md b/third_party/rust/gleam/README.md new file mode 100644 index 000000000000..da405dc4cf7a --- /dev/null +++ b/third_party/rust/gleam/README.md @@ -0,0 +1,6 @@ +servo-gl +======== + +[Documentation](http://doc.servo.org/gleam/) + +OpenGL bindings for Servo diff --git a/third_party/rust/gleam/build.rs b/third_party/rust/gleam/build.rs new file mode 100644 index 000000000000..b1542e759b03 --- /dev/null +++ b/third_party/rust/gleam/build.rs @@ -0,0 +1,40 @@ +extern crate gl_generator; +extern crate pkg_config; + +use std::env; +use std::fs::File; +use std::path::Path; +use gl_generator::{Registry, Api, Profile, Fallbacks}; + +fn main() { + let dest = env::var("OUT_DIR").unwrap(); + let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap(); + + let target = env::var("TARGET").unwrap(); + + if target.contains("android") { + let extensions = ["GL_EXT_texture_format_BGRA8888"]; + // GLES 2.0 bindings for Android + Registry::new(Api::Gles2, (3, 0), Profile::Core, Fallbacks::All, extensions) + .write_bindings(gl_generator::StaticGenerator, &mut file) + .unwrap(); + + println!("cargo:rustc-link-lib=GLESv3"); + } else { + let extensions = ["GL_ARB_texture_rectangle", "GL_EXT_debug_marker"]; + // OpenGL 3.3 bindings for Linux/Mac/Windows + Registry::new(Api::Gl, (3, 3), Profile::Core, Fallbacks::All, extensions) + .write_bindings(gl_generator::GlobalGenerator, &mut file) + .unwrap(); + + if target.contains("darwin") { + println!("cargo:rustc-link-lib=framework=OpenGL"); + } else if target.contains("windows") { + println!("cargo:rustc-link-lib=opengl32"); + } else { + if let Err(_) = pkg_config::probe_library("gl") { + println!("cargo:rustc-link-lib=GL"); + } + } + } +} diff --git a/third_party/rust/gleam/src/gl.rs b/third_party/rust/gleam/src/gl.rs new file mode 100644 index 000000000000..524939d43484 --- /dev/null +++ b/third_party/rust/gleam/src/gl.rs @@ -0,0 +1,1521 @@ +// Copyright 2014 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; +use std::mem::size_of; +use std::os::raw::{c_char, c_int, c_void}; +use std::ptr; +use std::str::{self}; +use std::iter::repeat; +use std::ffi::{CString, CStr}; +use ffi; + +pub use ffi::types::*; +pub use ffi::*; + +#[inline] +pub fn buffer_data(target: GLenum, data: &[T], usage: GLenum) { + unsafe { + ffi::BufferData(target, + (data.len() * size_of::()) as GLsizeiptr, + data.as_ptr() as *const GLvoid, + usage); + } +} + +#[inline] +pub fn buffer_data_raw(target: GLenum, data: &T, usage: GLenum) { + unsafe { + ffi::BufferData(target, + size_of::() as GLsizeiptr, + data as *const T as *const GLvoid, + usage); + } +} + +#[inline] +pub fn buffer_sub_data(target: GLenum, offset: isize, data: &[T]) { + unsafe { + ffi::BufferSubData(target, + offset, + (data.len() * size_of::()) as GLsizeiptr, + data.as_ptr() as *const GLvoid); + } +} + +pub fn shader_source(shader: GLuint, strings: &[&[u8]]) { + let pointers: Vec<*const u8> = strings.iter().map(|string| (*string).as_ptr()).collect(); + let lengths: Vec = strings.iter().map(|string| string.len() as GLint).collect(); + unsafe { + ffi::ShaderSource(shader, pointers.len() as GLsizei, + pointers.as_ptr() as *const *const GLchar, lengths.as_ptr()); + } + drop(lengths); + drop(pointers); +} + +#[cfg(not(target_os="android"))] +pub fn read_buffer(mode: GLenum) { + unsafe { + ffi::ReadBuffer(mode); + } +} + +fn calculate_length(width: GLsizei, height: GLsizei, format: GLenum, pixel_type: GLenum) -> usize { + let colors = match format { + ffi::RGB => 3, +#[cfg(not(target_os="android"))] + ffi::BGR => 3, + + ffi::RGBA => 4, +#[cfg(not(target_os="android"))] + ffi::BGRA => 4, + + ffi::ALPHA => 1, +#[cfg(target_os="android")] + ffi::LUMINANCE => 1, + _ => panic!("unsupported format for read_pixels"), + }; + let depth = match pixel_type { + ffi::UNSIGNED_BYTE => 1, + _ => panic!("unsupported pixel_type for read_pixels"), + }; + + return (width * height * colors * depth) as usize; +} + +pub fn read_pixels_into_buffer(x: GLint, y: GLint, width: GLsizei, height: GLsizei, + format: GLenum, pixel_type: GLenum, dst_buffer: &mut [u8]) { + // Assumes that the user properly allocated the size for dst_buffer. + assert!(calculate_length(width, height, format, pixel_type) == dst_buffer.len()); + + unsafe { + // We don't want any alignment padding on pixel rows. + ffi::PixelStorei(ffi::PACK_ALIGNMENT, 1); + ffi::ReadPixels(x, y, width, height, format, pixel_type, dst_buffer.as_mut_ptr() as *mut c_void); + } +} + +pub fn read_pixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, pixel_type: GLenum) -> Vec { + let len = calculate_length(width, height, format, pixel_type); + let mut pixels: Vec = Vec::new(); + pixels.reserve(len); + unsafe { pixels.set_len(len); } + + read_pixels_into_buffer(x, y, width, height, format, pixel_type, pixels.as_mut_slice()); + + pixels +} + +#[inline] +pub fn sample_coverage(value: GLclampf, invert: bool) { + unsafe { + ffi::SampleCoverage(value, invert as GLboolean); + } +} + +#[inline] +pub fn polygon_offset(factor: GLfloat, units: GLfloat) { + unsafe { + ffi::PolygonOffset(factor, units); + } +} + +#[inline] +pub fn pixel_store_i(name: GLenum, param: GLint) { + unsafe { + ffi::PixelStorei(name, param); + } +} + +#[inline] +pub fn gen_buffers(n: GLsizei) -> Vec { + unsafe { + let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect(); + ffi::GenBuffers(n, result.as_mut_ptr()); + return result; + } +} + +#[inline] +pub fn gen_renderbuffers(n: GLsizei) -> Vec { + unsafe { + let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect(); + ffi::GenRenderbuffers(n, result.as_mut_ptr()); + return result; + } +} + +#[inline] +pub fn gen_framebuffers(n: GLsizei) -> Vec { + unsafe { + let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect(); + ffi::GenFramebuffers(n, result.as_mut_ptr()); + return result; + } +} + +#[inline] +pub fn gen_textures(n: GLsizei) -> Vec { + unsafe { + let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect(); + ffi::GenTextures(n, result.as_mut_ptr()); + return result; + } +} + +#[inline] +pub fn gen_vertex_arrays(n: GLsizei) -> Vec { + unsafe { + let mut result: Vec<_> = repeat(0 as GLuint).take(n as usize).collect(); + ffi::GenVertexArrays(n, result.as_mut_ptr()); + return result; + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn gen_queries(n: GLsizei) -> Vec { + unsafe { + let mut result = vec![0; n as usize]; + ffi::GenQueries(n, result.as_mut_ptr()); + return result; + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn begin_query(target: GLenum, id: GLuint) { + unsafe { + ffi::BeginQuery(target, id); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn end_query(target: GLenum) { + unsafe { + ffi::EndQuery(target); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn query_counter(id: GLuint, target: GLenum) { + unsafe { + ffi::QueryCounter(id, target); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn get_query_object_iv(id: GLuint, pname: GLenum) -> i32 { + unsafe { + let mut result = 0; + ffi::GetQueryObjectiv(id, pname, &mut result); + result + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn get_query_object_uiv(id: GLuint, pname: GLenum) -> u32 { + unsafe { + let mut result = 0; + ffi::GetQueryObjectuiv(id, pname, &mut result); + result + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn get_query_object_i64v(id: GLuint, pname: GLenum) -> i64 { + unsafe { + let mut result = 0; + ffi::GetQueryObjecti64v(id, pname, &mut result); + result + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn get_query_object_ui64v(id: GLuint, pname: GLenum) -> u64 { + unsafe { + let mut result = 0; + ffi::GetQueryObjectui64v(id, pname, &mut result); + result + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn delete_queries(queries: &[GLuint]) { + unsafe { + ffi::DeleteQueries(queries.len() as GLsizei, queries.as_ptr()); + } +} + +#[inline] +pub fn delete_vertex_arrays(vertex_arrays: &[GLuint]) { + unsafe { + ffi::DeleteVertexArrays(vertex_arrays.len() as GLsizei, vertex_arrays.as_ptr()); + } +} + +#[inline] +pub fn delete_buffers(buffers: &[GLuint]) { + unsafe { + ffi::DeleteBuffers(buffers.len() as GLsizei, buffers.as_ptr()); + } +} + +#[inline] +pub fn delete_renderbuffers(renderbuffers: &[GLuint]) { + unsafe { + ffi::DeleteRenderbuffers(renderbuffers.len() as GLsizei, renderbuffers.as_ptr()); + } +} + +#[inline] +pub fn delete_framebuffers(framebuffers: &[GLuint]) { + unsafe { + ffi::DeleteFramebuffers(framebuffers.len() as GLsizei, framebuffers.as_ptr()); + } +} + +// NB: The name of this function is wrong, it's here for compatibility reasons, +// but should be removed. +#[inline] +pub fn delete_frame_buffers(framebuffers: &[GLuint]) { + delete_framebuffers(framebuffers); +} + +#[inline] +pub fn delete_textures(textures: &[GLuint]) { + unsafe { + ffi::DeleteTextures(textures.len() as GLsizei, textures.as_ptr()); + } +} + +#[inline] +pub fn framebuffer_renderbuffer(target: GLenum, + attachment: GLenum, + renderbuffertarget: GLenum, + renderbuffer: GLuint) { + unsafe { + ffi::FramebufferRenderbuffer(target, + attachment, + renderbuffertarget, + renderbuffer); + } +} + +#[inline] +pub fn renderbuffer_storage(target: GLenum, + internalformat: GLenum, + width: GLsizei, + height: GLsizei) { + unsafe { + ffi::RenderbufferStorage(target, + internalformat, + width, + height); + } +} + +#[inline] +pub fn depth_func(func: GLenum) { + unsafe { + ffi::DepthFunc(func); + } +} + +#[inline] +pub fn active_texture(texture: GLenum) { + unsafe { + ffi::ActiveTexture(texture); + } +} + +#[inline] +pub fn attach_shader(program: GLuint, shader: GLuint) { + unsafe { + ffi::AttachShader(program, shader); + } +} + +#[inline] +pub fn bind_attrib_location(program: GLuint, index: GLuint, name: &str) { + let c_string = CString::new(name).unwrap(); + unsafe { + ffi::BindAttribLocation(program, index, c_string.as_ptr()) + } +} + +#[inline] +pub fn get_uniform_block_index(program: GLuint, name: &str) -> GLuint { + let c_string = CString::new(name).unwrap(); + unsafe { + ffi::GetUniformBlockIndex(program, c_string.as_ptr()) + } +} + +#[inline] +pub fn bind_buffer_base(target: GLenum, index: GLuint, buffer: GLuint) { + unsafe { + ffi::BindBufferBase(target, index, buffer); + } +} + +#[inline] +pub fn uniform_block_binding(program: GLuint, uniform_block_index: GLuint, uniform_block_binding: GLuint) { + unsafe { + ffi::UniformBlockBinding(program, uniform_block_index, uniform_block_binding); + } +} + +#[inline] +pub fn bind_buffer(target: GLenum, buffer: GLuint) { + unsafe { + ffi::BindBuffer(target, buffer); + } +} + +#[inline] +pub fn bind_vertex_array(vao: GLuint) { + unsafe { + ffi::BindVertexArray(vao); + } +} + +#[inline] +pub fn bind_renderbuffer(target: GLenum, renderbuffer: GLuint) { + unsafe { + ffi::BindRenderbuffer(target, renderbuffer); + } +} + +#[inline] +pub fn bind_framebuffer(target: GLenum, framebuffer: GLuint) { + unsafe { + ffi::BindFramebuffer(target, framebuffer); + } +} + +#[inline] +pub fn bind_texture(target: GLenum, texture: GLuint) { + unsafe { + ffi::BindTexture(target, texture); + } +} + +// FIXME: Does not verify buffer size -- unsafe! +pub fn tex_image_2d(target: GLenum, + level: GLint, + internal_format: GLint, + width: GLsizei, + height: GLsizei, + border: GLint, + format: GLenum, + ty: GLenum, + opt_data: Option<&[u8]>) { + match opt_data { + Some(data) => { + unsafe { + ffi::TexImage2D(target, level, internal_format, width, height, border, format, ty, + data.as_ptr() as *const GLvoid); + } + } + None => { + unsafe { + ffi::TexImage2D(target, level, internal_format, width, height, border, format, ty, + ptr::null()); + } + } + } +} + +pub fn compressed_tex_image_2d(target: GLenum, + level: GLint, + internal_format: GLenum, + width: GLsizei, + height: GLsizei, + border: GLint, + data: &[u8]) { + unsafe { + ffi::CompressedTexImage2D(target, level, internal_format, width, height, border, + data.len() as GLsizei, data.as_ptr() as *const GLvoid); + } +} + +pub fn compressed_tex_sub_image_2d(target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + width: GLsizei, + height: GLsizei, + format: GLenum, + data: &[u8]) { + unsafe { + ffi::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, + data.len() as GLsizei, data.as_ptr() as *const GLvoid); + } +} + +// FIXME: Does not verify buffer size -- unsafe! +pub fn tex_image_3d(target: GLenum, + level: GLint, + internal_format: GLint, + width: GLsizei, + height: GLsizei, + depth: GLsizei, + border: GLint, + format: GLenum, + ty: GLenum, + opt_data: Option<&[u8]>) { + unsafe { + let pdata = match opt_data { + Some(data) => mem::transmute(data.as_ptr()), + None => ptr::null(), + }; + ffi::TexImage3D(target, + level, + internal_format, + width, + height, + depth, + border, + format, + ty, + pdata); + } +} + +pub fn copy_tex_image_2d(target: GLenum, + level: GLint, + internal_format: GLenum, + x: GLint, + y: GLint, + width: GLsizei, + height: GLsizei, + border: GLint) { + unsafe { + ffi::CopyTexImage2D(target, + level, + internal_format, + x, + y, + width, + height, + border); + } +} + +pub fn copy_tex_sub_image_2d(target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + x: GLint, + y: GLint, + width: GLsizei, + height: GLsizei) { + unsafe { + ffi::CopyTexSubImage2D(target, + level, + xoffset, + yoffset, + x, + y, + width, + height); + } +} + +#[inline] +pub fn copy_tex_sub_image_3d(target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + zoffset: GLint, + x: GLint, + y: GLint, + width: GLsizei, + height: GLsizei) { + unsafe { + ffi::CopyTexSubImage3D(target, + level, + xoffset, + yoffset, + zoffset, + x, + y, + width, + height); + } +} + +pub fn tex_sub_image_2d(target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + width: GLsizei, + height: GLsizei, + format: GLenum, + ty: GLenum, + data: &[u8]) { + unsafe { + ffi::TexSubImage2D(target, level, xoffset, yoffset, width, height, format, ty, data.as_ptr() as *const c_void); + } +} + +pub fn tex_sub_image_3d(target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + zoffset: GLint, + width: GLsizei, + height: GLsizei, + depth: GLsizei, + format: GLenum, + ty: GLenum, + data: &[u8]) { + unsafe { + ffi::TexSubImage3D(target, + level, + xoffset, + yoffset, + zoffset, + width, + height, + depth, + format, + ty, + data.as_ptr() as *const c_void); + } +} + +#[inline] +pub fn get_integer_v(name: GLenum) -> GLint { + let mut result: GLint = 0 as GLint; + unsafe { + ffi::GetIntegerv(name, &mut result); + } + result +} + +#[inline] +pub fn get_boolean_v(name: GLenum) -> GLboolean { + let mut result: GLboolean = 0 as GLboolean; + unsafe { + ffi::GetBooleanv(name, &mut result); + } + result +} + + +#[inline] +pub fn get_float_v(name: GLenum) -> GLfloat { + let mut result: GLfloat = 0 as GLfloat; + unsafe { + ffi::GetFloatv(name, &mut result); + } + result +} + +#[inline] +pub fn tex_parameter_i(target: GLenum, pname: GLenum, param: GLint) { + unsafe { + ffi::TexParameteri(target, pname, param); + } +} + +#[inline] +pub fn tex_parameter_f(target: GLenum, pname: GLenum, param: GLfloat) { + unsafe { + ffi::TexParameterf(target, pname, param); + } +} + +#[inline] +pub fn framebuffer_texture_2d(target: GLenum, + attachment: GLenum, + textarget: GLenum, + texture: GLuint, + level: GLint) { + unsafe { + ffi::FramebufferTexture2D(target, attachment, textarget, texture, level); + } +} + +#[inline] +pub fn framebuffer_texture_layer(target: GLenum, + attachment: GLenum, + texture: GLuint, + level: GLint, + layer: GLint) { + unsafe { + ffi::FramebufferTextureLayer(target, attachment, texture, level, layer); + } +} + +#[inline] +pub fn blit_framebuffer(srcX0: GLint, + srcY0: GLint, + srcX1: GLint, + srcY1: GLint, + dstX0: GLint, + dstY0: GLint, + dstX1: GLint, + dstY1: GLint, + mask: GLbitfield, + filter: GLenum) { + unsafe { + ffi::BlitFramebuffer(srcX0, + srcY0, + srcX1, + srcY1, + dstX0, + dstY0, + dstX1, + dstY1, + mask, + filter); + } +} + +#[inline] +pub fn vertex_attrib_4f(index: GLuint, + x: GLfloat, + y: GLfloat, + z: GLfloat, + w: GLfloat) { + unsafe { + ffi::VertexAttrib4f(index, x, y, z, w) + } +} + +#[inline] +pub fn vertex_attrib_pointer_f32(index: GLuint, + size: GLint, + normalized: bool, + stride: GLsizei, + offset: GLuint) { + unsafe { + ffi::VertexAttribPointer(index, + size, + ffi::FLOAT, + normalized as GLboolean, + stride, + offset as *const GLvoid) + } +} + +#[inline] +pub fn vertex_attrib_pointer(index: GLuint, + size: GLint, + type_: GLenum, + normalized: bool, + stride: GLsizei, + offset: GLuint) { + unsafe { + ffi::VertexAttribPointer(index, + size, + type_, + normalized as GLboolean, + stride, + offset as *const GLvoid) + } +} + +#[inline] +pub fn vertex_attrib_i_pointer(index: GLuint, + size: GLint, + type_: GLenum, + stride: GLsizei, + offset: GLuint) { + unsafe { + ffi::VertexAttribIPointer(index, + size, + type_, + stride, + offset as *const GLvoid) + } +} + +#[inline] +pub fn vertex_attrib_divisor(index: GLuint, divisor: GLuint) { + unsafe { + ffi::VertexAttribDivisor(index, divisor) + } +} + +#[inline] +pub fn viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) { + unsafe { + ffi::Viewport(x, y, width, height); + } +} + +#[inline] +pub fn scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei) { + unsafe { + ffi::Scissor(x, y, width, height); + } +} + +#[inline] +pub fn line_width(width: GLfloat) { + unsafe { + ffi::LineWidth(width); + } +} + +#[inline] +pub fn use_program(program: GLuint) { + unsafe { + ffi::UseProgram(program); + } +} + +#[inline] +pub fn validate_program(program: GLuint) { + unsafe { + ffi::ValidateProgram(program); + } +} + +#[inline] +pub fn draw_arrays(mode: GLenum, first: GLint, count: GLsizei) { + unsafe { + return ffi::DrawArrays(mode, first, count); + } +} + +#[inline] +pub fn draw_arrays_instanced(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei) { + unsafe { + return ffi::DrawArraysInstanced(mode, first, count, primcount); + } +} + +#[inline] +pub fn draw_elements(mode: GLenum, count: GLsizei, element_type: GLenum, indices_offset: GLuint) { + unsafe { + return ffi::DrawElements(mode, count, element_type, indices_offset as *const c_void) + } +} + +#[inline] +pub fn draw_elements_instanced(mode: GLenum, + count: GLsizei, + element_type: GLenum, + indices_offset: GLuint, + primcount: GLsizei) { + unsafe { + return ffi::DrawElementsInstanced(mode, + count, + element_type, + indices_offset as *const c_void, + primcount) + } +} + +#[inline] +pub fn blend_color(r: f32, g: f32, b: f32, a: f32) { + unsafe { + ffi::BlendColor(r, g, b, a); + } +} + +#[inline] +pub fn blend_func(sfactor: GLenum, dfactor: GLenum) { + unsafe { + ffi::BlendFunc(sfactor, dfactor); + } +} + +#[inline] +pub fn blend_func_separate(src_rgb: GLenum, dest_rgb: GLenum, src_alpha: GLenum, dest_alpha: GLenum) { + unsafe { + ffi::BlendFuncSeparate(src_rgb, dest_rgb, src_alpha, dest_alpha); + } +} + +#[inline] +pub fn blend_equation(mode: GLenum) { + unsafe { + ffi::BlendEquation(mode); + } +} + +#[inline] +pub fn blend_equation_separate(mode_rgb: GLenum, mode_alpha: GLenum) { + unsafe { + ffi::BlendEquationSeparate(mode_rgb, mode_alpha); + } +} + +#[inline] +pub fn color_mask(r: bool, g: bool, b: bool, a: bool) { + unsafe { + ffi::ColorMask(r as GLboolean, g as GLboolean, b as GLboolean, a as GLboolean); + } +} + +#[inline] +pub fn cull_face(mode: GLenum) { + unsafe { + ffi::CullFace(mode); + } +} + +#[inline] +pub fn front_face(mode: GLenum) { + unsafe { + ffi::FrontFace(mode); + } +} + +#[inline] +pub fn enable(cap: GLenum) { + unsafe { + ffi::Enable(cap); + } +} + +#[inline] +pub fn disable(cap: GLenum) { + unsafe { + ffi::Disable(cap); + } +} + +#[inline] +pub fn hint(param_name: GLenum, param_val: GLenum) { + unsafe { + ffi::Hint(param_name, param_val); + } +} + +#[inline] +pub fn is_enabled(cap: GLenum) -> GLboolean { + unsafe { + ffi::IsEnabled(cap) + } +} + +#[inline] +pub fn is_shader(shader: GLuint) -> GLboolean { + unsafe { + ffi::IsShader(shader) + } +} + +#[inline] +pub fn is_texture(texture: GLenum) -> GLboolean { + unsafe { + ffi::IsTexture(texture) + } +} + +#[inline] +pub fn is_framebuffer(framebuffer: GLenum) -> GLboolean { + unsafe { + ffi::IsFramebuffer(framebuffer) + } +} + +#[inline] +pub fn is_renderbuffer(renderbuffer: GLenum) -> GLboolean { + unsafe { + ffi::IsRenderbuffer(renderbuffer) + } +} + +#[inline] +pub fn check_frame_buffer_status(target: GLenum) -> GLenum { + unsafe { + ffi::CheckFramebufferStatus(target) + } +} + +#[inline] +pub fn enable_vertex_attrib_array(index: GLuint) { + unsafe { + ffi::EnableVertexAttribArray(index); + } +} + +#[inline] +pub fn disable_vertex_attrib_array(index: GLuint) { + unsafe { + ffi::DisableVertexAttribArray(index); + } +} + +#[inline] +pub fn uniform_1f(location: GLint, v0: GLfloat) { + unsafe { + ffi::Uniform1f(location, v0); + } +} + +#[inline] +pub fn uniform_1fv(location: GLint, values: &[f32]) { + unsafe { + ffi::Uniform1fv(location, + values.len() as GLsizei, + values.as_ptr()); + } +} + +#[inline] +pub fn uniform_1i(location: GLint, v0: GLint) { + unsafe { + ffi::Uniform1i(location, v0); + } +} + +#[inline] +pub fn uniform_1iv(location: GLint, values: &[i32]) { + unsafe { + ffi::Uniform1iv(location, + values.len() as GLsizei, + values.as_ptr()); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn uniform_1ui(location: GLint, v0: GLuint) { + unsafe { + ffi::Uniform1ui(location, v0); + } +} + +#[inline] +pub fn uniform_2f(location: GLint, v0: GLfloat, v1: GLfloat) { + unsafe { + ffi::Uniform2f(location, v0, v1); + } +} + +#[inline] +pub fn uniform_2fv(location: GLint, values: &[f32]) { + unsafe { + ffi::Uniform2fv(location, + (values.len() / 2) as GLsizei, + values.as_ptr()); + } +} + +#[inline] +pub fn uniform_2i(location: GLint, v0: GLint, v1: GLint) { + unsafe { + ffi::Uniform2i(location, v0, v1); + } +} + +#[inline] +pub fn uniform_2iv(location: GLint, values: &[i32]) { + unsafe { + ffi::Uniform2iv(location, + (values.len() / 2) as GLsizei, + values.as_ptr()); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn uniform_2ui(location: GLint, v0: GLuint, v1: GLuint) { + unsafe { + ffi::Uniform2ui(location, v0, v1); + } +} + +#[inline] +pub fn uniform_3f(location: GLint, v0: GLfloat, v1: GLfloat, v2: GLfloat) { + unsafe { + ffi::Uniform3f(location, v0, v1, v2); + } +} + +#[inline] +pub fn uniform_3fv(location: GLint, values: &[f32]) { + unsafe { + ffi::Uniform3fv(location, + (values.len() / 3) as GLsizei, + values.as_ptr()); + } +} + +#[inline] +pub fn uniform_3i(location: GLint, v0: GLint, v1: GLint, v2: GLint) { + unsafe { + ffi::Uniform3i(location, v0, v1, v2); + } +} + +#[inline] +pub fn uniform_3iv(location: GLint, values: &[i32]) { + unsafe { + ffi::Uniform3iv(location, + (values.len() / 3) as GLsizei, + values.as_ptr()); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn uniform_3ui(location: GLint, v0: GLuint, v1: GLuint, v2: GLuint) { + unsafe { + ffi::Uniform3ui(location, v0, v1, v2); + } +} + +#[inline] +pub fn uniform_4f(location: GLint, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) { + unsafe { + ffi::Uniform4f(location, x, y, z, w); + } +} + +#[inline] +pub fn uniform_4i(location: GLint, x: GLint, y: GLint, z: GLint, w: GLint) { + unsafe { + ffi::Uniform4i(location, x, y, z, w); + } +} + +#[inline] +pub fn uniform_4iv(location: GLint, values: &[i32]) { + unsafe { + ffi::Uniform4iv(location, + (values.len() / 4) as GLsizei, + values.as_ptr()); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn uniform_4ui(location: GLint, x: GLuint, y: GLuint, z: GLuint, w: GLuint) { + unsafe { + ffi::Uniform4ui(location, x, y, z, w); + } +} + +#[inline] +pub fn uniform_4fv(location: GLint, values: &[f32]) { + unsafe { + ffi::Uniform4fv(location, + (values.len() / 4) as GLsizei, + values.as_ptr()); + } +} + +#[inline] +pub fn uniform_matrix_2fv(location: GLint, transpose: bool, value: &[f32]) { + unsafe { + ffi::UniformMatrix2fv(location, + (value.len() / 4) as GLsizei, + transpose as GLboolean, + value.as_ptr()); + } +} + +#[inline] +pub fn uniform_matrix_3fv(location: GLint, transpose: bool, value: &[f32]) { + unsafe { + ffi::UniformMatrix3fv(location, + (value.len() / 9) as GLsizei, + transpose as GLboolean, + value.as_ptr()); + } +} + +#[inline] +pub fn uniform_matrix_4fv(location: GLint, transpose: bool, value: &[f32]) { + unsafe { + ffi::UniformMatrix4fv(location, + (value.len() / 16) as GLsizei, + transpose as GLboolean, + value.as_ptr()); + } +} + +#[inline] +pub fn depth_mask(flag: bool) { + unsafe { + ffi::DepthMask(flag as GLboolean); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn depth_range(near: f64, far: f64) { + unsafe { + ffi::DepthRange(near as GLclampd, far as GLclampd); + } +} + +#[cfg(target_os="android")] +#[inline] +pub fn depth_range(near: f64, far: f64) { + unsafe { + ffi::DepthRangef(near as GLclampf, far as GLclampf); + } +} + +#[inline] +pub fn get_active_attrib(program: GLuint, index: GLuint) -> (i32, u32, String) { + let buf_size = get_program_iv(program, ffi::ACTIVE_ATTRIBUTE_MAX_LENGTH); + let mut name = vec![0u8; buf_size as usize]; + let mut length = 0 as GLsizei; + let mut size = 0 as i32; + let mut type_ = 0 as u32; + unsafe { + ffi::GetActiveAttrib(program, index, buf_size, &mut length, &mut size, &mut type_, name.as_mut_ptr() as *mut GLchar); + } + name.truncate(if length > 0 {length as usize} else {0}); + (size, type_, String::from_utf8(name).unwrap()) +} + +#[inline] +pub fn get_active_uniform(program: GLuint, index: GLuint) -> (i32, u32, String) { + let buf_size = get_program_iv(program, ffi::ACTIVE_UNIFORM_MAX_LENGTH); + let mut name = vec![0 as u8; buf_size as usize]; + let mut length: GLsizei = 0; + let mut size: i32 = 0; + let mut type_: u32 = 0; + + unsafe { + ffi::GetActiveUniform(program, index, buf_size, &mut length, &mut size, + &mut type_, name.as_mut_ptr() as *mut GLchar); + } + + name.truncate(if length > 0 { length as usize } else { 0 }); + + (size, type_, String::from_utf8(name).unwrap()) +} + +#[inline] +pub fn get_attrib_location(program: GLuint, name: &str) -> c_int { + let name = CString::new(name).unwrap(); + unsafe { + ffi::GetAttribLocation(program, name.as_ptr()) + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn get_frag_data_location(program: GLuint, name: &str) -> c_int { + let name = CString::new(name).unwrap(); + unsafe { + ffi::GetFragDataLocation(program, name.as_ptr()) + } +} + +#[inline] +pub fn get_uniform_location(program: GLuint, name: &str) -> c_int { + let name = CString::new(name).unwrap(); + unsafe { + ffi::GetUniformLocation(program, name.as_ptr()) + } +} + +pub fn get_program_info_log(program: GLuint) -> String { + unsafe { + let mut result = vec![0u8; 1024]; + let mut result_len: GLsizei = 0 as GLsizei; + ffi::GetProgramInfoLog(program, + 1024 as GLsizei, + &mut result_len, + result.as_mut_ptr() as *mut GLchar); + result.truncate(if result_len > 0 {result_len as usize} else {0}); + String::from_utf8(result).unwrap() + } +} + +#[inline] +pub fn get_program_iv(program: GLuint, pname: GLenum) -> GLint { + unsafe { + let mut result: GLint = 0 as GLint; + ffi::GetProgramiv(program, pname, &mut result); + return result; + } +} + +#[inline] +pub fn get_vertex_attrib_iv(index: GLuint, pname: GLenum) -> GLint { + unsafe { + let mut result: GLint = 0 as GLint; + ffi::GetVertexAttribiv(index, pname, &mut result); + return result; + } +} + +#[inline] +pub fn get_vertex_attrib_fv(index: GLuint, pname: GLenum) -> Vec { + unsafe { + let mut result = vec![0 as GLfloat; 4]; + ffi::GetVertexAttribfv(index, pname, result.as_mut_ptr()); + return result; + } +} + +#[inline] +pub fn get_buffer_parameter_iv(target: GLuint, pname: GLenum) -> GLint { + unsafe { + let mut result: GLint = 0 as GLint; + ffi::GetBufferParameteriv(target, pname, &mut result); + return result; + } +} + +pub fn get_shader_info_log(shader: GLuint) -> String { + unsafe { + let mut result = vec![0u8; 1024]; + let mut result_len: GLsizei = 0 as GLsizei; + ffi::GetShaderInfoLog(shader, + 1024 as GLsizei, + &mut result_len, + result.as_mut_ptr() as *mut GLchar); + result.truncate(if result_len > 0 {result_len as usize} else {0}); + String::from_utf8(result).unwrap() + } +} + +#[inline] +pub fn get_string(which: GLenum) -> String { + unsafe { + let llstr = ffi::GetString(which); + if !llstr.is_null() { + return str::from_utf8_unchecked(CStr::from_ptr(llstr as *const c_char).to_bytes()).to_string(); + } else { + return "".to_string(); + } + } +} + +#[inline] +pub fn get_shader_iv(shader: GLuint, pname: GLenum) -> GLint { + unsafe { + let mut result: GLint = 0 as GLint; + ffi::GetShaderiv(shader, pname, &mut result); + return result; + } +} + +#[inline] +pub fn compile_shader(shader: GLuint) { + unsafe { + ffi::CompileShader(shader); + } +} + +#[inline] +pub fn create_program() -> GLuint { + unsafe { + return ffi::CreateProgram(); + } +} + +#[inline] +pub fn delete_program(program: GLuint) { + unsafe { + ffi::DeleteProgram(program); + } +} + +#[inline] +pub fn create_shader(shader_type: GLenum) -> GLuint { + unsafe { + return ffi::CreateShader(shader_type); + } +} + +#[inline] +pub fn delete_shader(shader: GLuint) { + unsafe { + ffi::DeleteShader(shader); + } +} + +#[inline] +pub fn detach_shader(program: GLuint, shader: GLuint) { + unsafe { + ffi::DetachShader(program, shader); + } +} + +#[inline] +pub fn link_program(program: GLuint) { + unsafe { + return ffi::LinkProgram(program); + } +} + +#[inline] +pub fn clear_color(r: f32, g: f32, b: f32, a: f32) { + unsafe { + ffi::ClearColor(r, g, b, a); + } +} + +#[inline] +pub fn clear(buffer_mask: GLbitfield) { + unsafe { + ffi::Clear(buffer_mask); + } +} + +#[cfg(not(target_os="android"))] +#[inline] +pub fn clear_depth(depth: f64) { + unsafe { + ffi::ClearDepth(depth as GLclampd); + } +} + +#[cfg(target_os="android")] +#[inline] +pub fn clear_depth(depth: f64) { + unsafe { + ffi::ClearDepthf(depth as GLclampf); + } +} + +#[inline] +pub fn clear_stencil(s: GLint) { + unsafe { + ffi::ClearStencil(s); + } +} + +#[inline] +pub fn flush() { + unsafe { + ffi::Flush(); + } +} + +#[inline] +pub fn finish() { + unsafe { + ffi::Finish(); + } +} + +#[inline] +pub fn get_error() -> GLenum { + unsafe { + ffi::GetError() + } +} + +#[inline] +pub fn stencil_mask(mask: GLuint) { + unsafe { + ffi::StencilMask(mask) + } +} + +#[inline] +pub fn stencil_mask_separate(face: GLenum, mask: GLuint) { + unsafe { + ffi::StencilMaskSeparate(face, mask) + } +} + +#[inline] +pub fn stencil_func(func: GLenum, + ref_: GLint, + mask: GLuint) { + unsafe { + ffi::StencilFunc(func, ref_, mask) + } +} + +#[inline] +pub fn stencil_func_separate(face: GLenum, + func: GLenum, + ref_: GLint, + mask: GLuint) { + unsafe { + ffi::StencilFuncSeparate(face, func, ref_, mask) + } +} + +#[inline] +pub fn stencil_op(sfail: GLenum, + dpfail: GLenum, + dppass: GLenum) { + unsafe { + ffi::StencilOp(sfail, dpfail, dppass) + } +} + +#[inline] +pub fn stencil_op_separate(face: GLenum, + sfail: GLenum, + dpfail: GLenum, + dppass: GLenum) { + unsafe { + ffi::StencilOpSeparate(face, sfail, dpfail, dppass) + } +} + +#[cfg(target_os="android")] +extern { + pub fn glEGLImageTargetTexture2DOES(target: GLenum, image: GLeglImageOES); +} + +#[cfg(target_os="android")] +pub fn egl_image_target_texture2d_oes(target: GLenum, image: GLeglImageOES) { + unsafe { + glEGLImageTargetTexture2DOES(target, image); + } +} + +#[inline] +pub fn generate_mipmap(target: GLenum) { + unsafe { + ffi::GenerateMipmap(target) + } +} + +#[inline] +#[cfg(not(target_os="android"))] +pub fn insert_event_marker_ext(message: &str) { + if ffi::InsertEventMarkerEXT::is_loaded() { + unsafe { + ffi::InsertEventMarkerEXT(message.len() as GLsizei, message.as_ptr() as *const _); + } + } +} + +#[inline] +#[cfg(not(target_os="android"))] +pub fn push_group_marker_ext(message: &str) { + if ffi::PushGroupMarkerEXT::is_loaded() { + unsafe { + ffi::PushGroupMarkerEXT(message.len() as GLsizei, message.as_ptr() as *const _); + } + } +} + +#[inline] +#[cfg(not(target_os="android"))] +pub fn pop_group_marker_ext() { + if ffi::PopGroupMarkerEXT::is_loaded() { + unsafe { + ffi::PopGroupMarkerEXT(); + } + } +} diff --git a/third_party/rust/gleam/src/lib.rs b/third_party/rust/gleam/src/lib.rs new file mode 100644 index 000000000000..77f5ea7f8664 --- /dev/null +++ b/third_party/rust/gleam/src/lib.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Servo Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "gleam"] +#![crate_type = "lib"] + +pub mod gl; + +mod ffi { + include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); +} diff --git a/third_party/rust/heapsize/.cargo-checksum.json b/third_party/rust/heapsize/.cargo-checksum.json new file mode 100644 index 000000000000..590b4466a86a --- /dev/null +++ b/third_party/rust/heapsize/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"97503c8cf1fc53fd41e237662402477c0ab257225d25fe21470494a0b1bbec3c",".travis.yml":"1108708721703f4562646e1e7c6f6c924fa997835714bcc6a3ff8a58382134f1","Cargo.toml":"723e5918946fdb518ed1ad3e03ae9104b980cbe85bbee1989dc4197570ba6d73","README.md":"9a38b16bccde5db28c34d79134f02d2cdcbbab224b9a68ace93c5b85b5ef38f2","appveyor.yml":"130e820ab60abf8d08f3a91d4b0158e6a581c180385e12850113adb362eb158c","build.rs":"e13e88ed285a829256d3c6987563a663c37e335457d090125a3e19b1a97fec8e","src/lib.rs":"ab4e0a2e6d0ac700df5dbb7a2c83542cb82c94d4e46c632a4114fec93d6aba0a","tests/tests.rs":"f642da7b54b6cde55cf25fe84b2e6b27356d26b351d42a38e944b93e0c1fa24f"},"package":"5a376f7402b85be6e0ba504243ecbc0709c48019ecc6286d0540c2e359050c88"} \ No newline at end of file diff --git a/third_party/rust/heapsize/.cargo-ok b/third_party/rust/heapsize/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/heapsize/.gitignore b/third_party/rust/heapsize/.gitignore new file mode 100644 index 000000000000..d4f917d3d50d --- /dev/null +++ b/third_party/rust/heapsize/.gitignore @@ -0,0 +1,3 @@ +target +Cargo.lock +*.swp diff --git a/third_party/rust/heapsize/.travis.yml b/third_party/rust/heapsize/.travis.yml new file mode 100644 index 000000000000..ef8e20c3ffe5 --- /dev/null +++ b/third_party/rust/heapsize/.travis.yml @@ -0,0 +1,19 @@ +language: rust +rust: + - 1.8.0 + - nightly + - beta + - stable + +os: + - linux + - osx + +notifications: + webhooks: http://build.servo.org:54856/travis + +script: + - cargo test + - "[ $TRAVIS_RUST_VERSION != nightly ] || cargo test --features unstable" + - "[ $TRAVIS_RUST_VERSION != nightly ] || cargo test --manifest-path derive/Cargo.toml" + diff --git a/third_party/rust/heapsize/Cargo.toml b/third_party/rust/heapsize/Cargo.toml new file mode 100644 index 000000000000..62be5b66b37a --- /dev/null +++ b/third_party/rust/heapsize/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "heapsize" +version = "0.3.8" +authors = [ "The Servo Project Developers" ] +description = "Infrastructure for measuring the total runtime size of an object on the heap" +license = "MPL-2.0" +repository = "https://github.com/servo/heapsize" +build = "build.rs" + +[target.'cfg(windows)'.dependencies] +kernel32-sys = "0.2.1" + +[features] +unstable = [] diff --git a/third_party/rust/heapsize/README.md b/third_party/rust/heapsize/README.md new file mode 100644 index 000000000000..f89a960cba85 --- /dev/null +++ b/third_party/rust/heapsize/README.md @@ -0,0 +1,5 @@ +# heapsize + +In support of measuring heap allocations in Rust programs. + +[API Documentation](https://doc.servo.org/heapsize/) diff --git a/third_party/rust/heapsize/appveyor.yml b/third_party/rust/heapsize/appveyor.yml new file mode 100644 index 000000000000..595b08c2d166 --- /dev/null +++ b/third_party/rust/heapsize/appveyor.yml @@ -0,0 +1,23 @@ +environment: + matrix: + - FEATURES: "" + - FEATURES: "unstable" + +platform: + - i686-pc-windows-gnu + - i686-pc-windows-msvc + - x86_64-pc-windows-gnu + - x86_64-pc-windows-msvc + +install: + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:PLATFORM}.exe" + - rust-nightly-%PLATFORM%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" + - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin + - rustc -V + - cargo -V + +build_script: + - cargo build --verbose --features "%FEATURES%" + +test_script: + - cargo test --verbose --features "%FEATURES%" diff --git a/third_party/rust/heapsize/build.rs b/third_party/rust/heapsize/build.rs new file mode 100644 index 000000000000..9e299e6b19d6 --- /dev/null +++ b/third_party/rust/heapsize/build.rs @@ -0,0 +1,37 @@ +use std::env::var; +use std::process::Command; +use std::str; + +fn main() { + let verbose = Command::new(var("RUSTC").unwrap_or("rustc".into())) + .arg("--version") + .arg("--verbose") + .output() + .unwrap() + .stdout; + let verbose = str::from_utf8(&verbose).unwrap(); + let mut commit_date = None; + let mut release = None; + for line in verbose.lines() { + let mut parts = line.split(':'); + match parts.next().unwrap().trim() { + "commit-date" => commit_date = Some(parts.next().unwrap().trim()), + "release" => release = Some(parts.next().unwrap().trim()), + _ => {} + } + } + let version = release.unwrap().split('-').next().unwrap();; + let mut version_components = version.split('.').map(|s| s.parse::().unwrap()); + let version = ( + version_components.next().unwrap(), + version_components.next().unwrap(), + version_components.next().unwrap(), + // "unknown" sorts after "2016-02-14", which is what we want to defaut to unprefixed + // https://github.com/servo/heapsize/pull/44#issuecomment-187935883 + commit_date.unwrap() + ); + assert_eq!(version_components.next(), None); + if version < (1, 8, 0, "2016-02-14") { + println!("cargo:rustc-cfg=prefixed_jemalloc"); + } +} diff --git a/third_party/rust/heapsize/src/lib.rs b/third_party/rust/heapsize/src/lib.rs new file mode 100644 index 000000000000..d27789aa59e1 --- /dev/null +++ b/third_party/rust/heapsize/src/lib.rs @@ -0,0 +1,323 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! Data structure measurement. + +#[cfg(target_os = "windows")] +extern crate kernel32; + +#[cfg(target_os = "windows")] +use kernel32::{GetProcessHeap, HeapSize, HeapValidate}; +use std::borrow::Cow; +use std::cell::{Cell, RefCell}; +use std::collections::{BTreeMap, HashSet, HashMap, LinkedList, VecDeque}; +use std::hash::BuildHasher; +use std::hash::Hash; +use std::marker::PhantomData; +use std::mem::size_of; +use std::net::{Ipv4Addr, Ipv6Addr}; +use std::os::raw::c_void; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize}; +use std::rc::Rc; + +/// Get the size of a heap block. +/// +/// Ideally Rust would expose a function like this in std::rt::heap. +/// +/// `unsafe` because the caller must ensure that the pointer is from jemalloc. +/// FIXME: This probably interacts badly with custom allocators: +/// https://doc.rust-lang.org/book/custom-allocators.html +pub unsafe fn heap_size_of(ptr: *const c_void) -> usize { + if ptr == 0x01 as *const c_void { + 0 + } else { + heap_size_of_impl(ptr) + } +} + +#[cfg(not(target_os = "windows"))] +unsafe fn heap_size_of_impl(ptr: *const c_void) -> usize { + // The C prototype is `je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr)`. On some + // platforms `JEMALLOC_USABLE_SIZE_CONST` is `const` and on some it is empty. But in practice + // this function doesn't modify the contents of the block that `ptr` points to, so we use + // `*const c_void` here. + extern "C" { + #[cfg_attr(any(prefixed_jemalloc, target_os = "macos", target_os = "android"), link_name = "je_malloc_usable_size")] + fn malloc_usable_size(ptr: *const c_void) -> usize; + } + malloc_usable_size(ptr) +} + +#[cfg(target_os = "windows")] +pub unsafe fn heap_size_of_impl(mut ptr: *const c_void) -> usize { + let heap = GetProcessHeap(); + + if HeapValidate(heap, 0, ptr) == 0 { + ptr = *(ptr as *const *const c_void).offset(-1); + } + + HeapSize(heap, 0, ptr) as usize +} + +// The simplest trait for measuring the size of heap data structures. More complex traits that +// return multiple measurements -- e.g. measure text separately from images -- are also possible, +// and should be used when appropriate. +// +pub trait HeapSizeOf { + /// Measure the size of any heap-allocated structures that hang off this value, but not the + /// space taken up by the value itself (i.e. what size_of:: measures, more or less); that + /// space is handled by the implementation of HeapSizeOf for Box below. + fn heap_size_of_children(&self) -> usize; +} + +// There are two possible ways to measure the size of `self` when it's on the heap: compute it +// (with `::std::rt::heap::usable_size(::std::mem::size_of::(), 0)`) or measure it directly +// using the heap allocator (with `heap_size_of`). We do the latter, for the following reasons. +// +// * The heap allocator is the true authority for the sizes of heap blocks; its measurement is +// guaranteed to be correct. In comparison, size computations are error-prone. (For example, the +// `rt::heap::usable_size` function used in some of Rust's non-default allocator implementations +// underestimate the true usable size of heap blocks, which is safe in general but would cause +// under-measurement here.) +// +// * If we measure something that isn't a heap block, we'll get a crash. This keeps us honest, +// which is important because unsafe code is involved and this can be gotten wrong. +// +// However, in the best case, the two approaches should give the same results. +// +impl HeapSizeOf for Box { + fn heap_size_of_children(&self) -> usize { + // Measure size of `self`. + unsafe { + heap_size_of(&**self as *const T as *const c_void) + (**self).heap_size_of_children() + } + } +} + +impl HeapSizeOf for [T] { + fn heap_size_of_children(&self) -> usize { + self.iter().fold(0, |size, item| size + item.heap_size_of_children()) + } +} + +impl HeapSizeOf for String { + fn heap_size_of_children(&self) -> usize { + unsafe { + heap_size_of(self.as_ptr() as *const c_void) + } + } +} + +impl<'a, T: ?Sized> HeapSizeOf for &'a T { + fn heap_size_of_children(&self) -> usize { + 0 + } +} + +impl HeapSizeOf for Option { + fn heap_size_of_children(&self) -> usize { + match *self { + None => 0, + Some(ref x) => x.heap_size_of_children() + } + } +} + +impl HeapSizeOf for Result { + fn heap_size_of_children(&self) -> usize { + match *self { + Ok(ref x) => x.heap_size_of_children(), + Err(ref e) => e.heap_size_of_children(), + } + } +} + +impl<'a, B: ?Sized + ToOwned> HeapSizeOf for Cow<'a, B> where B::Owned: HeapSizeOf { + fn heap_size_of_children(&self) -> usize { + match *self { + Cow::Borrowed(_) => 0, + Cow::Owned(ref b) => b.heap_size_of_children(), + } + } +} + +impl HeapSizeOf for () { + fn heap_size_of_children(&self) -> usize { + 0 + } +} + +impl HeapSizeOf for (T1, T2) + where T1: HeapSizeOf, T2 :HeapSizeOf +{ + fn heap_size_of_children(&self) -> usize { + self.0.heap_size_of_children() + + self.1.heap_size_of_children() + } +} + +impl HeapSizeOf for (T1, T2, T3) + where T1: HeapSizeOf, T2 :HeapSizeOf, T3: HeapSizeOf +{ + fn heap_size_of_children(&self) -> usize { + self.0.heap_size_of_children() + + self.1.heap_size_of_children() + + self.2.heap_size_of_children() + } +} + +impl HeapSizeOf for (T1, T2, T3, T4) + where T1: HeapSizeOf, T2 :HeapSizeOf, T3: HeapSizeOf, T4: HeapSizeOf +{ + fn heap_size_of_children(&self) -> usize { + self.0.heap_size_of_children() + + self.1.heap_size_of_children() + + self.2.heap_size_of_children() + + self.3.heap_size_of_children() + } +} + +impl HeapSizeOf for (T1, T2, T3, T4, T5) + where T1: HeapSizeOf, T2 :HeapSizeOf, T3: HeapSizeOf, T4: HeapSizeOf, T5: HeapSizeOf +{ + fn heap_size_of_children(&self) -> usize { + self.0.heap_size_of_children() + + self.1.heap_size_of_children() + + self.2.heap_size_of_children() + + self.3.heap_size_of_children() + + self.4.heap_size_of_children() + } +} + +impl HeapSizeOf for Arc { + fn heap_size_of_children(&self) -> usize { + (**self).heap_size_of_children() + } +} + +impl HeapSizeOf for RefCell { + fn heap_size_of_children(&self) -> usize { + self.borrow().heap_size_of_children() + } +} + +impl HeapSizeOf for Cell { + fn heap_size_of_children(&self) -> usize { + self.get().heap_size_of_children() + } +} + +impl HeapSizeOf for Vec { + fn heap_size_of_children(&self) -> usize { + self.iter().fold( + unsafe { heap_size_of(self.as_ptr() as *const c_void) }, + |n, elem| n + elem.heap_size_of_children()) + } +} + +impl HeapSizeOf for VecDeque { + fn heap_size_of_children(&self) -> usize { + self.iter().fold( + // FIXME: get the buffer pointer for heap_size_of(), capacity() is a lower bound: + self.capacity() * size_of::(), + |n, elem| n + elem.heap_size_of_children()) + } +} + +impl HeapSizeOf for Vec> { + fn heap_size_of_children(&self) -> usize { + // The fate of measuring Rc is still undecided, but we still want to measure + // the space used for storing them. + unsafe { + heap_size_of(self.as_ptr() as *const c_void) + } + } +} + +impl HeapSizeOf for HashSet + where T: Eq + Hash, S: BuildHasher { + fn heap_size_of_children(&self) -> usize { + //TODO(#6908) measure actual bucket memory usage instead of approximating + let size = self.capacity() * (size_of::() + size_of::()); + self.iter().fold(size, |n, value| { + n + value.heap_size_of_children() + }) + } +} + +impl HeapSizeOf for HashMap + where K: Eq + Hash, S: BuildHasher { + fn heap_size_of_children(&self) -> usize { + //TODO(#6908) measure actual bucket memory usage instead of approximating + let size = self.capacity() * (size_of::() + size_of::() + size_of::()); + self.iter().fold(size, |n, (key, value)| { + n + key.heap_size_of_children() + value.heap_size_of_children() + }) + } +} + +// PhantomData is always 0. +impl HeapSizeOf for PhantomData { + fn heap_size_of_children(&self) -> usize { + 0 + } +} + +// A linked list has an overhead of two words per item. +impl HeapSizeOf for LinkedList { + fn heap_size_of_children(&self) -> usize { + let mut size = 0; + for item in self { + size += 2 * size_of::() + size_of::() + item.heap_size_of_children(); + } + size + } +} + +// FIXME: Overhead for the BTreeMap nodes is not accounted for. +impl HeapSizeOf for BTreeMap { + fn heap_size_of_children(&self) -> usize { + let mut size = 0; + for (key, value) in self.iter() { + size += size_of::<(K, V)>() + + key.heap_size_of_children() + + value.heap_size_of_children(); + } + size + } +} + +/// For use on types defined in external crates +/// with known heap sizes. +#[macro_export] +macro_rules! known_heap_size( + ($size:expr, $($ty:ty),+) => ( + $( + impl $crate::HeapSizeOf for $ty { + #[inline(always)] + fn heap_size_of_children(&self) -> usize { + $size + } + } + )+ + ); + ($size: expr, $($ty:ident<$($gen:ident),+>),+) => ( + $( + impl<$($gen: $crate::HeapSizeOf),+> $crate::HeapSizeOf for $ty<$($gen),+> { + #[inline(always)] + fn heap_size_of_children(&self) -> usize { + $size + } + } + )+ + ); +); + +known_heap_size!(0, char, str); +known_heap_size!(0, u8, u16, u32, u64, usize); +known_heap_size!(0, i8, i16, i32, i64, isize); +known_heap_size!(0, bool, f32, f64); +known_heap_size!(0, AtomicBool, AtomicIsize, AtomicUsize); +known_heap_size!(0, Ipv4Addr, Ipv6Addr); diff --git a/third_party/rust/heapsize/tests/tests.rs b/third_party/rust/heapsize/tests/tests.rs new file mode 100644 index 000000000000..97da29de7b7f --- /dev/null +++ b/third_party/rust/heapsize/tests/tests.rs @@ -0,0 +1,171 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#![cfg_attr(feature= "unstable", feature(alloc, heap_api, repr_simd))] + +extern crate heapsize; + +use heapsize::{HeapSizeOf, heap_size_of}; +use std::os::raw::c_void; + +pub const EMPTY: *mut () = 0x1 as *mut (); + +#[cfg(feature = "unstable")] +mod unstable { + extern crate alloc; + + use heapsize::{HeapSizeOf, heap_size_of}; + use std::os::raw::c_void; + + #[repr(C, simd)] + struct OverAligned(u64, u64, u64, u64); + + #[test] + fn check_empty() { + assert_eq!(::EMPTY, alloc::heap::EMPTY); + } + + #[cfg(not(target_os = "windows"))] + #[test] + fn test_alloc() { + unsafe { + // A 64 byte request is allocated exactly. + let x = alloc::heap::allocate(64, 0); + assert_eq!(heap_size_of(x as *const c_void), 64); + alloc::heap::deallocate(x, 64, 0); + + // A 255 byte request is rounded up to 256 bytes. + let x = alloc::heap::allocate(255, 0); + assert_eq!(heap_size_of(x as *const c_void), 256); + alloc::heap::deallocate(x, 255, 0); + + // A 1MiB request is allocated exactly. + let x = alloc::heap::allocate(1024 * 1024, 0); + assert_eq!(heap_size_of(x as *const c_void), 1024 * 1024); + alloc::heap::deallocate(x, 1024 * 1024, 0); + + // An overaligned 1MiB request is allocated exactly. + let x = alloc::heap::allocate(1024 * 1024, 32); + assert_eq!(heap_size_of(x as *const c_void), 1024 * 1024); + alloc::heap::deallocate(x, 1024 * 1024, 32); + } + } + + #[cfg(target_os = "windows")] + #[test] + fn test_alloc() { + unsafe { + // A 64 byte request is allocated exactly. + let x = alloc::heap::allocate(64, 0); + assert_eq!(heap_size_of(x as *const c_void), 64); + alloc::heap::deallocate(x, 64, 0); + + // A 255 byte request is allocated exactly. + let x = alloc::heap::allocate(255, 0); + assert_eq!(heap_size_of(x as *const c_void), 255); + alloc::heap::deallocate(x, 255, 0); + + // A 1MiB request is allocated exactly. + let x = alloc::heap::allocate(1024 * 1024, 0); + assert_eq!(heap_size_of(x as *const c_void), 1024 * 1024); + alloc::heap::deallocate(x, 1024 * 1024, 0); + + // An overaligned 1MiB request is over-allocated. + let x = alloc::heap::allocate(1024 * 1024, 32); + assert_eq!(heap_size_of(x as *const c_void), 1024 * 1024 + 32); + alloc::heap::deallocate(x, 1024 * 1024, 32); + } + } + + #[cfg(not(target_os = "windows"))] + #[test] + fn test_simd() { + let x = Box::new(OverAligned(0, 0, 0, 0)); + assert_eq!(unsafe { heap_size_of(&*x as *const _ as *const c_void) }, 32); + } + + #[cfg(target_os = "windows")] + #[test] + fn test_simd() { + let x = Box::new(OverAligned(0, 0, 0, 0)); + assert_eq!(unsafe { heap_size_of(&*x as *const _ as *const c_void) }, 32 + 32); + } + + #[test] + fn test_boxed_str() { + let x = "raclette".to_owned().into_boxed_str(); + assert_eq!(x.heap_size_of_children(), 8); + } +} + +#[test] +fn test_heap_size() { + + // Note: jemalloc often rounds up request sizes. However, it does not round up for request + // sizes of 8 and higher that are powers of two. We take advantage of knowledge here to make + // the sizes of various heap-allocated blocks predictable. + + //----------------------------------------------------------------------- + // Start with basic heap block measurement. + + unsafe { + // EMPTY is the special non-null address used to represent zero-size allocations. + assert_eq!(heap_size_of(EMPTY as *const c_void), 0); + } + + //----------------------------------------------------------------------- + // Test HeapSizeOf implementations for various built-in types. + + // Not on the heap; 0 bytes. + let x = 0i64; + assert_eq!(x.heap_size_of_children(), 0); + + // An i64 is 8 bytes. + let x = Box::new(0i64); + assert_eq!(x.heap_size_of_children(), 8); + + // An ascii string with 16 chars is 16 bytes in UTF-8. + let string = String::from("0123456789abcdef"); + assert_eq!(string.heap_size_of_children(), 16); + + let string_ref: (&String, ()) = (&string, ()); + assert_eq!(string_ref.heap_size_of_children(), 0); + + let slice: &str = &*string; + assert_eq!(slice.heap_size_of_children(), 0); + + // Not on the heap. + let x: Option = None; + assert_eq!(x.heap_size_of_children(), 0); + + // Not on the heap. + let x = Some(0i64); + assert_eq!(x.heap_size_of_children(), 0); + + // The `Some` is not on the heap, but the Box is. + let x = Some(Box::new(0i64)); + assert_eq!(x.heap_size_of_children(), 8); + + // Not on the heap. + let x = ::std::sync::Arc::new(0i64); + assert_eq!(x.heap_size_of_children(), 0); + + // The `Arc` is not on the heap, but the Box is. + let x = ::std::sync::Arc::new(Box::new(0i64)); + assert_eq!(x.heap_size_of_children(), 8); + + // Zero elements, no heap storage. + let x: Vec = vec![]; + assert_eq!(x.heap_size_of_children(), 0); + + // Four elements, 8 bytes per element. + let x = vec![0i64, 1i64, 2i64, 3i64]; + assert_eq!(x.heap_size_of_children(), 32); +} + +#[test] +fn test_boxed_slice() { + let x = vec![1i64, 2i64].into_boxed_slice(); + assert_eq!(x.heap_size_of_children(), 16) +} diff --git a/third_party/rust/kernel32-sys/.cargo-checksum.json b/third_party/rust/kernel32-sys/.cargo-checksum.json new file mode 100644 index 000000000000..18c5faa1d458 --- /dev/null +++ b/third_party/rust/kernel32-sys/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"79c920ca9323e28acd5f5a80f2ce0ab81aa6227584397a9f742e78dce36a2117","README.md":"00afb50f0a5a7d548e40feb1f09ce8fa678b46e04c9a72d909fa36fb85fb2200","build.rs":"89e77c6e9e79dcd782fd006431b948d093ec4aeda3b69a280ec857077b7f2020","src/lib.rs":"ab0a8a104a6f747f6389a70d26a62e156ab97cc7c8f4daf1de99b820024da993"},"package":"7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"} \ No newline at end of file diff --git a/third_party/rust/kernel32-sys/.cargo-ok b/third_party/rust/kernel32-sys/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/kernel32-sys/Cargo.toml b/third_party/rust/kernel32-sys/Cargo.toml new file mode 100644 index 000000000000..5d28426f342e --- /dev/null +++ b/third_party/rust/kernel32-sys/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "kernel32-sys" +version = "0.2.2" +authors = ["Peter Atashian "] +description = "Contains function definitions for the Windows API library kernel32. See winapi for types and constants." +documentation = "https://retep998.github.io/doc/kernel32/" +repository = "https://github.com/retep998/winapi-rs" +readme = "README.md" +keywords = ["windows", "ffi", "win32"] +license = "MIT" +build = "build.rs" +[lib] +name = "kernel32" +[dependencies] +winapi = { version = "0.2.5", path = "../.." } +[build-dependencies] +winapi-build = { version = "0.1.1", path = "../../build" } diff --git a/third_party/rust/kernel32-sys/README.md b/third_party/rust/kernel32-sys/README.md new file mode 100644 index 000000000000..07ee5a6d6f87 --- /dev/null +++ b/third_party/rust/kernel32-sys/README.md @@ -0,0 +1,13 @@ +# kernel32 # +Contains function definitions for the Windows API library kernel32. See winapi for types and constants. + +```toml +[dependencies] +kernel32-sys = "0.2.1" +``` + +```rust +extern crate kernel32; +``` + +[Documentation](https://retep998.github.io/doc/kernel32/) diff --git a/third_party/rust/kernel32-sys/build.rs b/third_party/rust/kernel32-sys/build.rs new file mode 100644 index 000000000000..cf323fc2e505 --- /dev/null +++ b/third_party/rust/kernel32-sys/build.rs @@ -0,0 +1,6 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +extern crate build; +fn main() { + build::link("kernel32", false) +} diff --git a/third_party/rust/kernel32-sys/src/lib.rs b/third_party/rust/kernel32-sys/src/lib.rs new file mode 100644 index 000000000000..ca7683594c1e --- /dev/null +++ b/third_party/rust/kernel32-sys/src/lib.rs @@ -0,0 +1,2754 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! FFI bindings to kernel32. +#![cfg(windows)] +extern crate winapi; +use winapi::*; +extern "system" { + pub fn AcquireSRWLockExclusive(SRWLock: PSRWLOCK); + pub fn AcquireSRWLockShared(SRWLock: PSRWLOCK); + pub fn ActivateActCtx(hActCtx: HANDLE, lpCookie: *mut ULONG_PTR) -> BOOL; + pub fn AddAtomA(lpString: LPCSTR) -> ATOM; + pub fn AddAtomW(lpString: LPCWSTR) -> ATOM; + pub fn AddConsoleAliasA(Source: LPSTR, Target: LPSTR, ExeName: LPSTR) -> BOOL; + pub fn AddConsoleAliasW(Source: LPWSTR, Target: LPWSTR, ExeName: LPWSTR) -> BOOL; + pub fn AddDllDirectory(NewDirectory: PCWSTR) -> DLL_DIRECTORY_COOKIE; + pub fn AddIntegrityLabelToBoundaryDescriptor( + BoundaryDescriptor: *mut HANDLE, IntegrityLabel: PSID, + ) -> BOOL; + // pub fn AddLocalAlternateComputerNameA(); + // pub fn AddLocalAlternateComputerNameW(); + pub fn AddRefActCtx(hActCtx: HANDLE); + pub fn AddResourceAttributeAce( + pAcl: PACL, dwAceRevision: DWORD, AceFlags: DWORD, AccessMask: DWORD, pSid: PSID, + pAttributeInfo: PCLAIM_SECURITY_ATTRIBUTES_INFORMATION, pReturnLength: PDWORD, + ) -> BOOL; + pub fn AddSIDToBoundaryDescriptor(BoundaryDescriptor: *mut HANDLE, RequiredSid: PSID) -> BOOL; + pub fn AddScopedPolicyIDAce( + pAcl: PACL, dwAceRevision: DWORD, AceFlags: DWORD, AccessMask: DWORD, pSid: PSID, + ) -> BOOL; + pub fn AddSecureMemoryCacheCallback(pfnCallBack: PSECURE_MEMORY_CACHE_CALLBACK) -> BOOL; + pub fn AddVectoredContinueHandler(First: ULONG, Handler: PVECTORED_EXCEPTION_HANDLER) -> PVOID; + pub fn AddVectoredExceptionHandler( + First: ULONG, Handler: PVECTORED_EXCEPTION_HANDLER, + ) -> PVOID; + pub fn AllocConsole() -> BOOL; + pub fn AllocateUserPhysicalPages( + hProcess: HANDLE, NumberOfPages: PULONG_PTR, PageArray: PULONG_PTR, + ) -> BOOL; + pub fn AllocateUserPhysicalPagesNuma( + hProcess: HANDLE, NumberOfPages: PULONG_PTR, PageArray: PULONG_PTR, nndPreferred: DWORD, + ) -> BOOL; + // pub fn AppXGetOSMaxVersionTested(); + pub fn ApplicationRecoveryFinished(bSuccess: BOOL); + pub fn ApplicationRecoveryInProgress(pbCancelled: PBOOL) -> HRESULT; + pub fn AreFileApisANSI() -> BOOL; + pub fn AssignProcessToJobObject(hJob: HANDLE, hProcess: HANDLE) -> BOOL; + pub fn AttachConsole(dwProcessId: DWORD) -> BOOL; + pub fn BackupRead( + hFile: HANDLE, lpBuffer: LPBYTE, nNumberOfBytesToRead: DWORD, lpNumberOfBytesRead: LPDWORD, + bAbort: BOOL, bProcessSecurity: BOOL, lpContext: *mut LPVOID, + ) -> BOOL; + pub fn BackupSeek( + hFile: HANDLE, dwLowBytesToSeek: DWORD, dwHighBytesToSeek: DWORD, + lpdwLowByteSeeked: LPDWORD, lpdwHighByteSeeked: LPDWORD, lpContext: *mut LPVOID, + ) -> BOOL; + pub fn BackupWrite( + hFile: HANDLE, lpBuffer: LPBYTE, nNumberOfBytesToWrite: DWORD, + lpNumberOfBytesWritten: LPDWORD, bAbort: BOOL, bProcessSecurity: BOOL, + lpContext: *mut LPVOID, + ) -> BOOL; + // pub fn BaseSetLastNTError(); + pub fn Beep(dwFreq: DWORD, dwDuration: DWORD) -> BOOL; + pub fn BeginUpdateResourceA(pFileName: LPCSTR, bDeleteExistingResources: BOOL) -> HANDLE; + pub fn BeginUpdateResourceW(pFileName: LPCWSTR, bDeleteExistingResources: BOOL) -> HANDLE; + pub fn BindIoCompletionCallback( + FileHandle: HANDLE, Function: LPOVERLAPPED_COMPLETION_ROUTINE, Flags: ULONG, + ) -> BOOL; + pub fn BuildCommDCBA(lpDef: LPCSTR, lpDCB: LPDCB) -> BOOL; + pub fn BuildCommDCBAndTimeoutsA( + lpDef: LPCSTR, lpDCB: LPDCB, lpCommTimeouts: LPCOMMTIMEOUTS, + ) -> BOOL; + pub fn BuildCommDCBAndTimeoutsW( + lpDef: LPCWSTR, lpDCB: LPDCB, lpCommTimeouts: LPCOMMTIMEOUTS, + ) -> BOOL; + pub fn BuildCommDCBW(lpDef: LPCWSTR, lpDCB: LPDCB) -> BOOL; + pub fn CallNamedPipeA( + lpNamedPipeName: LPCSTR, lpInBuffer: LPVOID, nInBufferSize: DWORD, lpOutBuffer: LPVOID, + nOutBufferSize: DWORD, lpBytesRead: LPDWORD, nTimeOut: DWORD, + ) -> BOOL; + pub fn CallNamedPipeW( + lpNamedPipeName: LPCWSTR, lpInBuffer: LPVOID, nInBufferSize: DWORD, lpOutBuffer: LPVOID, + nOutBufferSize: DWORD, lpBytesRead: LPDWORD, nTimeOut: DWORD, + ) -> BOOL; + pub fn CallbackMayRunLong(pci: PTP_CALLBACK_INSTANCE) -> BOOL; + pub fn CalloutOnFiberStack( + lpFiber: PVOID, lpStartAddress: PFIBER_CALLOUT_ROUTINE, lpParameter: PVOID, + ) -> PVOID; + pub fn CancelDeviceWakeupRequest(hDevice: HANDLE) -> BOOL; + pub fn CancelIo(hFile: HANDLE) -> BOOL; + pub fn CancelIoEx(hFile: HANDLE, lpOverlapped: LPOVERLAPPED) -> BOOL; + pub fn CancelSynchronousIo(hThread: HANDLE) -> BOOL; + pub fn CancelThreadpoolIo(pio: PTP_IO); + pub fn CancelTimerQueueTimer(TimerQueue: HANDLE, Timer: HANDLE) -> BOOL; + pub fn CancelWaitableTimer(hTimer: HANDLE) -> BOOL; + pub fn CeipIsOptedIn() -> BOOL; + pub fn ChangeTimerQueueTimer( + TimerQueue: HANDLE, Timer: HANDLE, DueTime: ULONG, Period: ULONG, + ) -> BOOL; + // pub fn CheckElevation(); + // pub fn CheckElevationEnabled(); + pub fn CheckNameLegalDOS8Dot3A( + lpName: LPCSTR, lpOemName: LPSTR, OemNameSize: DWORD, pbNameContainsSpaces: PBOOL, + pbNameLegal: PBOOL, + ) -> BOOL; + pub fn CheckNameLegalDOS8Dot3W( + lpName: LPCWSTR, lpOemName: LPSTR, OemNameSize: DWORD, pbNameContainsSpaces: PBOOL, + pbNameLegal: PBOOL, + ) -> BOOL; + pub fn CheckRemoteDebuggerPresent(hProcess: HANDLE, pbDebuggerPresent: PBOOL) -> BOOL; + pub fn CheckTokenCapability( + TokenHandle: HANDLE, CapabilitySidToCheck: PSID, HasCapability: PBOOL, + ) -> BOOL; + pub fn CheckTokenMembershipEx( + TokenHandle: HANDLE, SidToCheck: PSID, Flags: DWORD, IsMember: PBOOL, + ) -> BOOL; + pub fn ClearCommBreak(hFile: HANDLE) -> BOOL; + pub fn ClearCommError(hFile: HANDLE, lpErrors: LPDWORD, lpStat: LPCOMSTAT) -> BOOL; + pub fn CloseHandle(hObject: HANDLE) -> BOOL; + // pub fn ClosePackageInfo(); + pub fn ClosePrivateNamespace(Handle: HANDLE, Flags: ULONG) -> BOOLEAN; + // pub fn CloseState(); + pub fn CloseThreadpool(ptpp: PTP_POOL); + pub fn CloseThreadpoolCleanupGroup(ptpcg: PTP_CLEANUP_GROUP); + pub fn CloseThreadpoolCleanupGroupMembers( + ptpcg: PTP_CLEANUP_GROUP, fCancelPendingCallbacks: BOOL, pvCleanupContext: PVOID, + ); + pub fn CloseThreadpoolIo(pio: PTP_IO); + pub fn CloseThreadpoolTimer(pti: PTP_TIMER); + pub fn CloseThreadpoolWait(pwa: PTP_WAIT); + pub fn CloseThreadpoolWork(pwk: PTP_WORK); + pub fn CommConfigDialogA(lpszName: LPCSTR, hWnd: HWND, lpCC: LPCOMMCONFIG) -> BOOL; + pub fn CommConfigDialogW(lpszName: LPCWSTR, hWnd: HWND, lpCC: LPCOMMCONFIG) -> BOOL; + pub fn CompareFileTime(lpFileTime1: *const FILETIME, lpFileTime2: *const FILETIME) -> LONG; + pub fn CompareStringA( + Locale: LCID, dwCmpFlags: DWORD, lpString1: PCNZCH, cchCount1: c_int, lpString2: PCNZCH, + cchCount2: c_int, + ) -> c_int; + pub fn CompareStringEx( + lpLocaleName: LPCWSTR, dwCmpFlags: DWORD, lpString1: LPCWCH, cchCount1: c_int, + lpString2: LPCWCH, cchCount2: c_int, lpVersionInformation: LPNLSVERSIONINFO, + lpReserved: LPVOID, lParam: LPARAM, + ) -> c_int; + pub fn CompareStringOrdinal( + lpString1: LPCWCH, cchCount1: c_int, lpString2: LPCWCH, cchCount2: c_int, bIgnoreCase: BOOL, + ) -> c_int; + pub fn CompareStringW( + Locale: LCID, dwCmpFlags: DWORD, lpString1: PCNZWCH, cchCount1: c_int, lpString2: PCNZWCH, + cchCount2: c_int, + ) -> c_int; + pub fn ConnectNamedPipe(hNamedPipe: HANDLE, lpOverlapped: LPOVERLAPPED) -> BOOL; + pub fn ContinueDebugEvent( + dwProcessId: DWORD, dwThreadId: DWORD, dwContinueStatus: DWORD, + ) -> BOOL; + pub fn ConvertDefaultLocale(Locale: LCID) -> LCID; + pub fn ConvertFiberToThread() -> BOOL; + pub fn ConvertThreadToFiber(lpParameter: LPVOID) -> LPVOID; + pub fn ConvertThreadToFiberEx(lpParameter: LPVOID, dwFlags: DWORD) -> LPVOID; + pub fn CopyContext(Destination: PCONTEXT, ContextFlags: DWORD, Source: PCONTEXT) -> BOOL; + pub fn CopyFile2( + pwszExistingFileName: PCWSTR, pwszNewFileName: PCWSTR, + pExtendedParameters: *mut COPYFILE2_EXTENDED_PARAMETERS, + ) -> HRESULT; + pub fn CopyFileA( + lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, bFailIfExists: BOOL + ) -> BOOL; + pub fn CopyFileExA( + lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, + ) -> BOOL; + pub fn CopyFileExW( + lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, + ) -> BOOL; + pub fn CopyFileTransactedA( + lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, hTransaction: HANDLE, + ) -> BOOL; + pub fn CopyFileTransactedW( + lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, hTransaction: HANDLE, + ) -> BOOL; + pub fn CopyFileW( + lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, bFailIfExists: BOOL + ) -> BOOL; + pub fn CreateActCtxA(pActCtx: PCACTCTXA) -> HANDLE; + pub fn CreateActCtxW(pActCtx: PCACTCTXW) -> HANDLE; + pub fn CreateBoundaryDescriptorA(Name: LPCSTR, Flags: ULONG) -> HANDLE; + pub fn CreateBoundaryDescriptorW(Name: LPCWSTR, Flags: ULONG) -> HANDLE; + pub fn CreateConsoleScreenBuffer( + dwDesiredAccess: DWORD, dwShareMode: DWORD, + lpSecurityAttributes: *const SECURITY_ATTRIBUTES, dwFlags: DWORD, + lpScreenBufferData: LPVOID, + ) -> HANDLE; + pub fn CreateDirectoryA( + lpPathName: LPCSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateDirectoryExA( + lpTemplateDirectory: LPCSTR, lpNewDirectory: LPCSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateDirectoryExW( + lpTemplateDirectory: LPCWSTR, lpNewDirectory: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateDirectoryTransactedA( + lpTemplateDirectory: LPCSTR, lpNewDirectory: LPCSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, hTransaction: HANDLE, + ) -> BOOL; + pub fn CreateDirectoryTransactedW( + lpTemplateDirectory: LPCWSTR, lpNewDirectory: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, hTransaction: HANDLE, + ) -> BOOL; + pub fn CreateDirectoryW( + lpPathName: LPCWSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateEventA( + lpEventAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, bInitialState: BOOL, + lpName: LPCSTR, + ) -> HANDLE; + pub fn CreateEventW( + lpEventAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, bInitialState: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn CreateEventExA( + lpEventAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCSTR, dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateEventExW( + lpEventAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCWSTR, dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateFiber( + dwStackSize: SIZE_T, lpStartAddress: LPFIBER_START_ROUTINE, lpParameter: LPVOID, + ) -> LPVOID; + pub fn CreateFiberEx( + dwStackCommitSize: SIZE_T, dwStackReserveSize: SIZE_T, dwFlags: DWORD, + lpStartAddress: LPFIBER_START_ROUTINE, lpParameter: LPVOID, + ) -> LPVOID; + pub fn CreateFile2( + lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, + dwCreationDisposition: DWORD, pCreateExParams: LPCREATEFILE2_EXTENDED_PARAMETERS, + ) -> HANDLE; + pub fn CreateFileA( + lpFileName: LPCSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, + ) -> HANDLE; + pub fn CreateFileMappingA( + hFile: HANDLE, lpAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, + dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCSTR, + ) -> HANDLE; + pub fn CreateFileMappingFromApp( + hFile: HANDLE, SecurityAttributes: PSECURITY_ATTRIBUTES, PageProtection: ULONG, + MaximumSize: ULONG64, Name: PCWSTR, + ) -> HANDLE; + pub fn CreateFileMappingNumaA( + hFile: HANDLE, lpFileMappingAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, + dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCSTR, nndPreferred: DWORD, + ) -> HANDLE; + pub fn CreateFileMappingNumaW( + hFile: HANDLE, lpFileMappingAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, + dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCWSTR, nndPreferred: DWORD, + ) -> HANDLE; + pub fn CreateFileMappingW( + hFile: HANDLE, lpAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, + dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCWSTR, + ) -> HANDLE; + pub fn CreateFileTransactedA( + lpFileName: LPCSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, hTransaction: HANDLE, + pusMiniVersion: PUSHORT, lpExtendedParameter: PVOID, + ) -> HANDLE; + pub fn CreateFileTransactedW( + lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, hTransaction: HANDLE, + pusMiniVersion: PUSHORT, lpExtendedParameter: PVOID, + ) -> HANDLE; + pub fn CreateFileW( + lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, + ) -> HANDLE; + pub fn CreateHardLinkA( + lpFileName: LPCSTR, lpExistingFileName: LPCSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateHardLinkTransactedA( + lpFileName: LPCSTR, lpExistingFileName: LPCSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + hTransaction: HANDLE, + ) -> BOOL; + pub fn CreateHardLinkTransactedW( + lpFileName: LPCWSTR, lpExistingFileName: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, hTransaction: HANDLE, + ); + pub fn CreateHardLinkW( + lpFileName: LPCWSTR, lpExistingFileName: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateIoCompletionPort( + FileHandle: HANDLE, ExistingCompletionPort: HANDLE, CompletionKey: ULONG_PTR, + NumberOfConcurrentThreads: DWORD, + ) -> HANDLE; + pub fn CreateJobObjectA(lpJobAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCSTR) -> HANDLE; + pub fn CreateJobObjectW(lpJobAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCWSTR) -> HANDLE; + pub fn CreateJobSet(NumJob: ULONG, UserJobSet: PJOB_SET_ARRAY, Flags: ULONG) -> BOOL; + pub fn CreateMailslotA( + lpName: LPCSTR, nMaxMessageSize: DWORD, lReadTimeout: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn CreateMailslotW( + lpName: LPCWSTR, nMaxMessageSize: DWORD, lReadTimeout: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn CreateMemoryResourceNotification( + NotificationType: MEMORY_RESOURCE_NOTIFICATION_TYPE, + ) -> HANDLE; + pub fn CreateMutexA( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, bInitialOwner: BOOL, lpName: LPCSTR, + ) -> HANDLE; + pub fn CreateMutexExA( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCSTR, dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateMutexExW( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCWSTR, dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateMutexW( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, bInitialOwner: BOOL, lpName: LPCWSTR, + ) -> HANDLE; + pub fn CreateNamedPipeA( + lpName: LPCSTR, dwOpenMode: DWORD, dwPipeMode: DWORD, nMaxInstances: DWORD, + nOutBufferSize: DWORD, nInBufferSize: DWORD, nDefaultTimeOut: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn CreateNamedPipeW( + lpName: LPCWSTR, dwOpenMode: DWORD, dwPipeMode: DWORD, nMaxInstances: DWORD, + nOutBufferSize: DWORD, nInBufferSize: DWORD, nDefaultTimeOut: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn CreatePipe( + hReadPipe: PHANDLE, hWritePipe: PHANDLE, lpPipeAttributes: LPSECURITY_ATTRIBUTES, + nSize: DWORD, + ) -> BOOL; + pub fn CreatePrivateNamespaceA( + lpPrivateNamespaceAttributes: LPSECURITY_ATTRIBUTES, lpBoundaryDescriptor: LPVOID, + lpAliasPrefix: LPCSTR, + ) -> HANDLE; + pub fn CreatePrivateNamespaceW( + lpPrivateNamespaceAttributes: LPSECURITY_ATTRIBUTES, lpBoundaryDescriptor: LPVOID, + lpAliasPrefix: LPCWSTR, + ) -> HANDLE; + pub fn CreateProcessA( + lpApplicationName: LPCSTR, lpCommandLine: LPSTR, lpProcessAttributes: LPSECURITY_ATTRIBUTES, + lpThreadAttributes: LPSECURITY_ATTRIBUTES, bInheritHandles: BOOL, dwCreationFlags: DWORD, + lpEnvironment: LPVOID, lpCurrentDirectory: LPCSTR, lpStartupInfo: LPSTARTUPINFOA, + lpProcessInformation: LPPROCESS_INFORMATION, + ) -> BOOL; + pub fn CreateProcessW( + lpApplicationName: LPCWSTR, lpCommandLine: LPWSTR, + lpProcessAttributes: LPSECURITY_ATTRIBUTES, lpThreadAttributes: LPSECURITY_ATTRIBUTES, + bInheritHandles: BOOL, dwCreationFlags: DWORD, lpEnvironment: LPVOID, + lpCurrentDirectory: LPCWSTR, lpStartupInfo: LPSTARTUPINFOW, + lpProcessInformation: LPPROCESS_INFORMATION, + ) -> BOOL; + pub fn CreateRemoteThread( + hProcess: HANDLE, lpThreadAttributes: LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, + lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: LPVOID, dwCreationFlags: DWORD, + lpThreadId: LPDWORD, + ) -> HANDLE; + pub fn CreateRemoteThreadEx( + hProcess: HANDLE, lpThreadAttributes: LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, + lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: LPVOID, dwCreationFlags: DWORD, + lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, lpThreadId: LPDWORD, + ) -> HANDLE; + pub fn CreateSemaphoreA( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, + lpName: LPCSTR, + ) -> HANDLE; + pub fn CreateSemaphoreExA( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, + lpName: LPCSTR, dwFlags: DWORD, dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateSemaphoreExW( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, + lpName: LPCWSTR, dwFlags: DWORD, dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateSemaphoreW( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn CreateSymbolicLinkA( + lpSymlinkFileName: LPCSTR, lpTargetFileName: LPCSTR, dwFlags: DWORD, + ) -> BOOLEAN; + pub fn CreateSymbolicLinkTransactedA( + lpSymlinkFileName: LPCSTR, lpTargetFileName: LPCSTR, dwFlags: DWORD, hTransaction: HANDLE, + ) -> BOOLEAN; + pub fn CreateSymbolicLinkTransactedW( + lpSymlinkFileName: LPCWSTR, lpTargetFileName: LPCWSTR, dwFlags: DWORD, hTransaction: HANDLE, + ) -> BOOLEAN; + pub fn CreateSymbolicLinkW( + lpSymlinkFileName: LPCWSTR, lpTargetFileName: LPCWSTR, dwFlags: DWORD, + ) -> BOOLEAN; + pub fn CreateTapePartition( + hDevice: HANDLE, dwPartitionMethod: DWORD, dwCount: DWORD, dwSize: DWORD, + ) -> DWORD; + pub fn CreateThread( + lpThreadAttributes: LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, + lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: LPVOID, dwCreationFlags: DWORD, + lpThreadId: LPDWORD, + ) -> HANDLE; + pub fn CreateThreadpool(reserved: PVOID) -> PTP_POOL; + pub fn CreateThreadpoolCleanupGroup() -> PTP_CLEANUP_GROUP; + pub fn CreateThreadpoolIo( + fl: HANDLE, pfnio: PTP_WIN32_IO_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_IO; + pub fn CreateThreadpoolTimer( + pfnti: PTP_TIMER_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_TIMER; + pub fn CreateThreadpoolWait( + pfnwa: PTP_WAIT_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_WAIT; + pub fn CreateThreadpoolWork( + pfnwk: PTP_WORK_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_WORK; + pub fn CreateTimerQueue() -> HANDLE; + pub fn CreateTimerQueueTimer( + phNewTimer: PHANDLE, TimerQueue: HANDLE, Callback: WAITORTIMERCALLBACK, Parameter: PVOID, + DueTime: DWORD, Period: DWORD, Flags: ULONG, + ) -> BOOL; + pub fn CreateToolhelp32Snapshot(dwFlags: DWORD, th32ProcessID: DWORD) -> HANDLE; + #[cfg(target_arch = "x86_64")] + pub fn CreateUmsCompletionList(UmsCompletionList: *mut PUMS_COMPLETION_LIST) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn CreateUmsThreadContext(lpUmsThread: *mut PUMS_CONTEXT) -> BOOL; + pub fn CreateWaitableTimerA( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, lpTimerName: LPCSTR, + ) -> HANDLE; + pub fn CreateWaitableTimerExA( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, lpTimerName: LPCSTR, dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateWaitableTimerExW( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, lpTimerName: LPCWSTR, dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateWaitableTimerW( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, lpTimerName: LPCWSTR, + ) -> HANDLE; + // pub fn CtrlRoutine(); + pub fn DeactivateActCtx(dwFlags: DWORD, ulCookie: ULONG_PTR) -> BOOL; + pub fn DebugActiveProcess(dwProcessId: DWORD) -> BOOL; + pub fn DebugActiveProcessStop(dwProcessId: DWORD) -> BOOL; + pub fn DebugBreak(); + pub fn DebugBreakProcess(Process: HANDLE) -> BOOL; + pub fn DebugSetProcessKillOnExit(KillOnExit: BOOL) -> BOOL; + pub fn DecodePointer(Ptr: PVOID) -> PVOID; + pub fn DecodeSystemPointer(Ptr: PVOID) -> PVOID; + pub fn DefineDosDeviceA(dwFlags: DWORD, lpDeviceName: LPCSTR, lpTargetPath: LPCSTR) -> BOOL; + pub fn DefineDosDeviceW(dwFlags: DWORD, lpDeviceName: LPCWSTR, lpTargetPath: LPCWSTR) -> BOOL; + pub fn DelayLoadFailureHook(pszDllName: LPCSTR, pszProcName: LPCSTR) -> FARPROC; + pub fn DeleteAtom(nAtom: ATOM) -> ATOM; + pub fn DeleteBoundaryDescriptor(BoundaryDescriptor: HANDLE); + pub fn DeleteCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); + pub fn DeleteFiber(lpFiber: LPVOID); + pub fn DeleteFileA(lpFileName: LPCSTR) -> BOOL; + pub fn DeleteFileTransactedA(lpFileName: LPCSTR, hTransaction: HANDLE) -> BOOL; + pub fn DeleteFileTransactedW(lpFileName: LPCWSTR, hTransaction: HANDLE) -> BOOL; + pub fn DeleteFileW(lpFileName: LPCWSTR) -> BOOL; + pub fn DeleteProcThreadAttributeList(lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST); + pub fn DeleteSynchronizationBarrier(lpBarrier: LPSYNCHRONIZATION_BARRIER) -> BOOL; + pub fn DeleteTimerQueue(TimerQueue: HANDLE) -> BOOL; + pub fn DeleteTimerQueueEx(TimerQueue: HANDLE, CompletionEvent: HANDLE) -> BOOL; + pub fn DeleteTimerQueueTimer( + TimerQueue: HANDLE, Timer: HANDLE, CompletionEvent: HANDLE, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn DeleteUmsCompletionList(UmsCompletionList: PUMS_COMPLETION_LIST) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn DeleteUmsThreadContext(UmsThread: PUMS_CONTEXT) -> BOOL; + pub fn DeleteVolumeMountPointA(lpszVolumeMountPoint: LPCSTR) -> BOOL; + pub fn DeleteVolumeMountPointW(lpszVolumeMountPoint: LPCWSTR) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn DequeueUmsCompletionListItems( + UmsCompletionList: PUMS_COMPLETION_LIST, WaitTimeOut: DWORD, + UmsThreadList: *mut PUMS_CONTEXT, + ) -> BOOL; + pub fn DeviceIoControl( + hDevice: HANDLE, dwIoControlCode: DWORD, lpInBuffer: LPVOID, nInBufferSize: DWORD, + lpOutBuffer: LPVOID, nOutBufferSize: DWORD, lpBytesReturned: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn DisableThreadLibraryCalls(hLibModule: HMODULE) -> BOOL; + pub fn DisableThreadProfiling(PerformanceDataHandle: HANDLE) -> DWORD; + pub fn DisassociateCurrentThreadFromCallback(pci: PTP_CALLBACK_INSTANCE); + pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL; + pub fn DnsHostnameToComputerNameA( + Hostname: LPCSTR, ComputerName: LPCSTR, nSize: LPDWORD, + ) -> BOOL; + pub fn DnsHostnameToComputerNameExW( + Hostname: LPCWSTR, ComputerName: LPWSTR, nSize: LPDWORD, + ) -> BOOL; + pub fn DnsHostnameToComputerNameW( + Hostname: LPCWSTR, ComputerName: LPWSTR, nSize: LPDWORD, + ) -> BOOL; + pub fn DosDateTimeToFileTime(wFatDate: WORD, wFatTime: WORD, lpFileTime: LPFILETIME) -> BOOL; + // pub fn DosPathToSessionPathW(); + pub fn DuplicateHandle( + hSourceProcessHandle: HANDLE, hSourceHandle: HANDLE, hTargetProcessHandle: HANDLE, + lpTargetHandle: LPHANDLE, dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwOptions: DWORD, + ) -> BOOL; + pub fn EnableThreadProfiling( + ThreadHandle: HANDLE, Flags: DWORD, HardwareCounters: DWORD64, + PerformanceDataHandle: *mut HANDLE, + ) -> BOOL; + pub fn EncodePointer(Ptr: PVOID) -> PVOID; + pub fn EncodeSystemPointer(Ptr: PVOID) -> PVOID; + pub fn EndUpdateResourceA(hUpdate: HANDLE, fDiscard: BOOL) -> BOOL; + pub fn EndUpdateResourceW(hUpdate: HANDLE, fDiscard: BOOL) -> BOOL; + pub fn EnterCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); + pub fn EnterSynchronizationBarrier( + lpBarrier: LPSYNCHRONIZATION_BARRIER, dwFlags: DWORD, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn EnterUmsSchedulingMode(SchedulerStartupInfo: PUMS_SCHEDULER_STARTUP_INFO) -> BOOL; + pub fn EnumCalendarInfoA( + lpCalInfoEnumProc: CALINFO_ENUMPROCA, Locale: LCID, Calendar: CALID, CalType: CALTYPE, + ) -> BOOL; + pub fn EnumCalendarInfoExA( + lpCalInfoEnumProcEx: CALINFO_ENUMPROCEXA, Locale: LCID, Calendar: CALID, CalType: CALTYPE, + ) -> BOOL; + pub fn EnumCalendarInfoExEx( + pCalInfoEnumProcExEx: CALINFO_ENUMPROCEXEX, lpLocaleName: LPCWSTR, Calendar: CALID, + lpReserved: LPCWSTR, CalType: CALTYPE, lParam: LPARAM, + ) -> BOOL; + pub fn EnumCalendarInfoExW( + lpCalInfoEnumProcEx: CALINFO_ENUMPROCEXW, Locale: LCID, Calendar: CALID, CalType: CALTYPE, + ) -> BOOL; + pub fn EnumCalendarInfoW( + lpCalInfoEnumProc: CALINFO_ENUMPROCW, Locale: LCID, Calendar: CALID, CalType: CALTYPE, + ) -> BOOL; + pub fn EnumDateFormatsA( + lpDateFmtEnumProc: DATEFMT_ENUMPROCA, Locale: LCID, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDateFormatsExA( + lpDateFmtEnumProcEx: DATEFMT_ENUMPROCEXA, Locale: LCID, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDateFormatsExEx( + lpDateFmtEnumProcExEx: DATEFMT_ENUMPROCEXEX, lpLocaleName: LPCWSTR, dwFlags: DWORD, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumDateFormatsExW( + lpDateFmtEnumProcEx: DATEFMT_ENUMPROCEXW, Locale: LCID, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDateFormatsW( + lpDateFmtEnumProc: DATEFMT_ENUMPROCW, Locale: LCID, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumLanguageGroupLocalesA( + lpLangGroupLocaleEnumProc: LANGGROUPLOCALE_ENUMPROCA, LanguageGroup: LGRPID, dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumLanguageGroupLocalesW( + lpLangGroupLocaleEnumProc: LANGGROUPLOCALE_ENUMPROCW, LanguageGroup: LGRPID, dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceLanguagesA( + hModule: HMODULE, lpType: LPCSTR, lpName: LPCSTR, lpEnumFunc: ENUMRESLANGPROCA, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceLanguagesExA( + hModule: HMODULE, lpType: LPCSTR, lpName: LPCSTR, lpEnumFunc: ENUMRESLANGPROCA, + lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceLanguagesExW( + hModule: HMODULE, lpType: LPCWSTR, lpName: LPCWSTR, lpEnumFunc: ENUMRESLANGPROCW, + lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceLanguagesW( + hModule: HMODULE, lpType: LPCWSTR, lpName: LPCWSTR, lpEnumFunc: ENUMRESLANGPROCW, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceNamesA( + hModule: HMODULE, lpType: LPCSTR, lpEnumFunc: ENUMRESNAMEPROCA, lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceNamesExA( + hModule: HMODULE, lpType: LPCSTR, lpEnumFunc: ENUMRESNAMEPROCA, lParam: LONG_PTR, + dwFlags: DWORD, LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceNamesExW( + hModule: HMODULE, lpType: LPCWSTR, lpEnumFunc: ENUMRESNAMEPROCW, lParam: LONG_PTR, + dwFlags: DWORD, LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceNamesW( + hModule: HMODULE, lpType: LPCWSTR, lpEnumFunc: ENUMRESNAMEPROCW, lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceTypesA( + hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCA, lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceTypesExA( + hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCA, lParam: LONG_PTR, dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceTypesExW( + hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCW, lParam: LONG_PTR, dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceTypesW( + hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCW, lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumSystemCodePagesA(lpCodePageEnumProc: CODEPAGE_ENUMPROCA, dwFlags: DWORD) -> BOOL; + pub fn EnumSystemCodePagesW(lpCodePageEnumProc: CODEPAGE_ENUMPROCW, dwFlags: DWORD) -> BOOL; + pub fn EnumSystemFirmwareTables( + FirmwareTableProviderSignature: DWORD, pFirmwareTableEnumBuffer: PVOID, BufferSize: DWORD, + ) -> UINT; + pub fn EnumSystemGeoID( + GeoClass: GEOCLASS, ParentGeoId: GEOID, lpGeoEnumProc: GEO_ENUMPROC, + ) -> BOOL; + pub fn EnumSystemLanguageGroupsA( + lpLanguageGroupEnumProc: LANGUAGEGROUP_ENUMPROCA, dwFlags: DWORD, lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumSystemLanguageGroupsW( + lpLanguageGroupEnumProc: LANGUAGEGROUP_ENUMPROCW, dwFlags: DWORD, lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumSystemLocalesA(lpLocaleEnumProc: LOCALE_ENUMPROCA, dwFlags: DWORD) -> BOOL; + pub fn EnumSystemLocalesEx( + lpLocaleEnumProcEx: LOCALE_ENUMPROCEX, dwFlags: DWORD, lParam: LPARAM, lpReserved: LPVOID, + ) -> BOOL; + pub fn EnumSystemLocalesW(lpLocaleEnumProc: LOCALE_ENUMPROCW, dwFlags: DWORD) -> BOOL; + pub fn EnumTimeFormatsA( + lpTimeFmtEnumProc: TIMEFMT_ENUMPROCA, Locale: LCID, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumTimeFormatsEx( + lpTimeFmtEnumProcEx: TIMEFMT_ENUMPROCEX, lpLocaleName: LPCWSTR, dwFlags: DWORD, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumTimeFormatsW( + lpTimeFmtEnumProc: TIMEFMT_ENUMPROCW, Locale: LCID, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumUILanguagesA( + lpUILanguageEnumProc: UILANGUAGE_ENUMPROCA, dwFlags: DWORD, lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumUILanguagesW( + lpUILanguageEnumProc: UILANGUAGE_ENUMPROCW, dwFlags: DWORD, lParam: LONG_PTR, + ) -> BOOL; + // pub fn EnumerateLocalComputerNamesA(); + // pub fn EnumerateLocalComputerNamesW(); + pub fn EraseTape(hDevice: HANDLE, dwEraseType: DWORD, bImmediate: BOOL) -> DWORD; + pub fn EscapeCommFunction(hFile: HANDLE, dwFunc: DWORD) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn ExecuteUmsThread(UmsThread: PUMS_CONTEXT) -> BOOL; + pub fn ExitProcess(uExitCode: UINT); + pub fn ExitThread(dwExitCode: DWORD); + pub fn ExpandEnvironmentStringsA(lpSrc: LPCSTR, lpDst: LPSTR, nSize: DWORD) -> DWORD; + pub fn ExpandEnvironmentStringsW(lpSrc: LPCWSTR, lpDst: LPWSTR, nSize: DWORD) -> DWORD; + pub fn FatalAppExitA(uAction: UINT, lpMessageText: LPCSTR); + pub fn FatalAppExitW(uAction: UINT, lpMessageText: LPCWSTR); + pub fn FatalExit(ExitCode: c_int); + pub fn FileTimeToDosDateTime( + lpFileTime: *const FILETIME, lpFatDate: LPWORD, lpFatTime: LPWORD, + ) -> BOOL; + pub fn FileTimeToLocalFileTime( + lpFileTime: *const FILETIME, lpLocalFileTime: LPFILETIME, + ) -> BOOL; + pub fn FileTimeToSystemTime( + lpFileTime: *const FILETIME, lpSystemTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn FillConsoleOutputAttribute( + hConsoleOutput: HANDLE, wAttribute: WORD, nLength: DWORD, dwWriteCoord: COORD, + lpNumberOfAttrsWritten: LPDWORD, + ) -> BOOL; + pub fn FillConsoleOutputCharacterA( + hConsoleOutput: HANDLE, cCharacter: CHAR, nLength: DWORD, dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn FillConsoleOutputCharacterW( + hConsoleOutput: HANDLE, cCharacter: WCHAR, nLength: DWORD, dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn FindActCtxSectionGuid( + dwFlags: DWORD, lpExtensionGuid: *const GUID, ulSectionId: ULONG, lpGuidToFind: *const GUID, + ReturnedData: PACTCTX_SECTION_KEYED_DATA, + ) -> BOOL; + pub fn FindActCtxSectionStringA( + dwFlags: DWORD, lpExtensionGuid: *const GUID, ulSectionId: ULONG, lpStringToFind: LPCSTR, + ReturnedData: PACTCTX_SECTION_KEYED_DATA, + ) -> BOOL; + pub fn FindActCtxSectionStringW( + dwFlags: DWORD, lpExtensionGuid: *const GUID, ulSectionId: ULONG, lpStringToFind: LPCWSTR, + ReturnedData: PACTCTX_SECTION_KEYED_DATA, + ) -> BOOL; + pub fn FindAtomA(lpString: LPCSTR) -> ATOM; + pub fn FindAtomW(lpString: LPCWSTR) -> ATOM; + pub fn FindClose(hFindFile: HANDLE) -> BOOL; + pub fn FindCloseChangeNotification(hChangeHandle: HANDLE) -> BOOL; + pub fn FindFirstChangeNotificationA( + lpPathName: LPCSTR, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, + ) -> HANDLE; + pub fn FindFirstChangeNotificationW( + lpPathName: LPCWSTR, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, + ) -> HANDLE; + pub fn FindFirstFileA(lpFileName: LPCSTR, lpFindFileData: LPWIN32_FIND_DATAA) -> HANDLE; + pub fn FindFirstFileExA( + lpFileName: LPCSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, + ) -> HANDLE; + pub fn FindFirstFileExW( + lpFileName: LPCWSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, + ) -> HANDLE; + pub fn FindFirstFileNameTransactedW( + lpFileName: LPCWSTR, dwFlags: DWORD, StringLength: LPDWORD, LinkName: PWSTR, + hTransaction: HANDLE, + ) -> HANDLE; + pub fn FindFirstFileNameW( + lpFileName: LPCWSTR, dwFlags: DWORD, StringLength: LPDWORD, LinkName: PWSTR, + ) -> HANDLE; + pub fn FindFirstFileTransactedA( + lpFileName: LPCSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, + hTransaction: HANDLE, + ) -> HANDLE; + pub fn FindFirstFileTransactedW( + lpFileName: LPCWSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, + hTransaction: HANDLE, + ) -> HANDLE; + pub fn FindFirstFileW(lpFileName: LPCWSTR, lpFindFileData: LPWIN32_FIND_DATAW) -> HANDLE; + pub fn FindFirstStreamTransactedW( + lpFileName: LPCWSTR, InfoLevel: STREAM_INFO_LEVELS, lpFindStreamData: LPVOID, + dwFlags: DWORD, hTransaction: HANDLE, + ) -> HANDLE; + pub fn FindFirstStreamW( + lpFileName: LPCWSTR, InfoLevel: STREAM_INFO_LEVELS, lpFindStreamData: LPVOID, + dwFlags: DWORD, + ) -> HANDLE; + pub fn FindFirstVolumeA(lpszVolumeName: LPSTR, cchBufferLength: DWORD) -> HANDLE; + pub fn FindFirstVolumeMountPointA( + lpszRootPathName: LPCSTR, lpszVolumeMountPoint: LPSTR, cchBufferLength: DWORD, + ) -> HANDLE; + pub fn FindFirstVolumeMountPointW( + lpszRootPathName: LPCWSTR, lpszVolumeMountPoint: LPWSTR, cchBufferLength: DWORD, + ) -> HANDLE; + pub fn FindFirstVolumeW(lpszVolumeName: LPWSTR, cchBufferLength: DWORD) -> HANDLE; + pub fn FindNLSString( + Locale: LCID, dwFindNLSStringFlags: DWORD, lpStringSource: LPCWSTR, cchSource: c_int, + lpStringValue: LPCWSTR, cchValue: c_int, pcchFound: LPINT, + ) -> c_int; + pub fn FindNLSStringEx( + lpLocaleName: LPCWSTR, dwFindNLSStringFlags: DWORD, lpStringSource: LPCWSTR, + cchSource: c_int, lpStringValue: LPCWSTR, cchValue: c_int, pcchFound: LPINT, + lpVersionInformation: LPNLSVERSIONINFO, lpReserved: LPVOID, sortHandle: LPARAM, + ) -> c_int; + pub fn FindNextChangeNotification(hChangeHandle: HANDLE) -> BOOL; + pub fn FindNextFileA(hFindFile: HANDLE, lpFindFileData: LPWIN32_FIND_DATAA) -> BOOL; + pub fn FindNextFileNameW(hFindStream: HANDLE, StringLength: LPDWORD, LinkName: PWSTR) -> BOOL; + pub fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: LPWIN32_FIND_DATAW) -> BOOL; + pub fn FindNextStreamW(hFindStream: HANDLE, lpFindStreamData: LPVOID) -> BOOL; + pub fn FindNextVolumeA( + hFindVolume: HANDLE, lpszVolumeName: LPSTR, cchBufferLength: DWORD, + ) -> BOOL; + pub fn FindNextVolumeMountPointA( + hFindVolumeMountPoint: HANDLE, lpszVolumeMountPoint: LPSTR, cchBufferLength: DWORD, + ) -> BOOL; + pub fn FindNextVolumeMountPointW( + hFindVolumeMountPoint: HANDLE, lpszVolumeMountPoint: LPWSTR, cchBufferLength: DWORD, + ) -> BOOL; + pub fn FindNextVolumeW( + hFindVolume: HANDLE, lpszVolumeName: LPWSTR, cchBufferLength: DWORD, + ) -> BOOL; + // pub fn FindPackagesByPackageFamily(); + pub fn FindResourceA(hModule: HMODULE, lpName: LPCSTR, lpType: LPCSTR) -> HRSRC; + pub fn FindResourceExA( + hModule: HMODULE, lpName: LPCSTR, lpType: LPCSTR, wLanguage: WORD, + ) -> HRSRC; + pub fn FindResourceExW( + hModule: HMODULE, lpName: LPCWSTR, lpType: LPCWSTR, wLanguage: WORD, + ) -> HRSRC; + pub fn FindResourceW(hModule: HMODULE, lpName: LPCWSTR, lpType: LPCWSTR) -> HRSRC; + pub fn FindStringOrdinal( + dwFindStringOrdinalFlags: DWORD, lpStringSource: LPCWSTR, cchSource: c_int, + lpStringValue: LPCWSTR, cchValue: c_int, bIgnoreCase: BOOL, + ) -> c_int; + pub fn FindVolumeClose(hFindVolume: HANDLE) -> BOOL; + pub fn FindVolumeMountPointClose(hFindVolumeMountPoint: HANDLE) -> BOOL; + pub fn FlsAlloc(lpCallback: PFLS_CALLBACK_FUNCTION) -> DWORD; + pub fn FlsFree(dwFlsIndex: DWORD) -> BOOL; + pub fn FlsGetValue(dwFlsIndex: DWORD) -> PVOID; + pub fn FlsSetValue(dwFlsIndex: DWORD, lpFlsData: PVOID) -> BOOL; + pub fn FlushConsoleInputBuffer(hConsoleInput: HANDLE) -> BOOL; + pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL; + pub fn FlushInstructionCache(hProcess: HANDLE, lpBaseAddress: LPCVOID, dwSize: SIZE_T) -> BOOL; + pub fn FlushProcessWriteBuffers(); + pub fn FlushViewOfFile(lpBaseAddress: LPCVOID, dwNumberOfBytesToFlush: SIZE_T) -> BOOL; + pub fn FoldStringA( + dwMapFlags: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpDestStr: LPSTR, cchDest: c_int, + ) -> c_int; + pub fn FoldStringW( + dwMapFlags: DWORD, lpSrcStr: LPCWCH, cchSrc: c_int, lpDestStr: LPWSTR, cchDest: c_int, + ) -> c_int; + // pub fn FormatApplicationUserModelId(); + pub fn FormatMessageA( + dwFlags: DWORD, lpSource: LPCVOID, dwMessageId: DWORD, dwLanguageId: DWORD, + lpBuffer: LPSTR, nSize: DWORD, Arguments: *mut va_list, + ) -> DWORD; + pub fn FormatMessageW( + dwFlags: DWORD, lpSource: LPCVOID, dwMessageId: DWORD, dwLanguageId: DWORD, + lpBuffer: LPWSTR, nSize: DWORD, Arguments: *mut va_list, + ) -> DWORD; + pub fn FreeConsole() -> BOOL; + pub fn FreeEnvironmentStringsA(penv: LPCH) -> BOOL; + pub fn FreeEnvironmentStringsW(penv: LPWCH) -> BOOL; + pub fn FreeLibrary(hLibModule: HMODULE) -> BOOL; + pub fn FreeLibraryAndExitThread(hLibModule: HMODULE, dwExitCode: DWORD); + pub fn FreeLibraryWhenCallbackReturns(pci: PTP_CALLBACK_INSTANCE, module: HMODULE); + pub fn FreeResource(hResData: HGLOBAL) -> BOOL; + pub fn FreeUserPhysicalPages( + hProcess: HANDLE, NumberOfPages: PULONG_PTR, PageArray: PULONG_PTR, + ) -> BOOL; + pub fn GenerateConsoleCtrlEvent(dwCtrlEvent: DWORD, dwProcessGroupId: DWORD) -> BOOL; + pub fn GetACP() -> UINT; + pub fn GetActiveProcessorCount(GroupNumber: WORD) -> DWORD; + pub fn GetActiveProcessorGroupCount() -> WORD; + pub fn GetAppContainerAce( + Acl: PACL, StartingAceIndex: DWORD, AppContainerAce: *mut PVOID, + AppContainerAceIndex: *mut DWORD, + ) -> BOOL; + pub fn GetAppContainerNamedObjectPath( + Token: HANDLE, AppContainerSid: PSID, ObjectPathLength: ULONG, ObjectPath: LPWSTR, + ReturnLength: PULONG, + ) -> BOOL; + pub fn GetApplicationRecoveryCallback( + hProcess: HANDLE, pRecoveryCallback: *mut APPLICATION_RECOVERY_CALLBACK, + ppvParameter: *mut PVOID, pdwPingInterval: PDWORD, pdwFlags: PDWORD, + ) -> HRESULT; + pub fn GetApplicationRestartSettings( + hProcess: HANDLE, pwzCommandline: PWSTR, pcchSize: PDWORD, pdwFlags: PDWORD, + ) -> HRESULT; + // pub fn GetApplicationUserModelId(); + pub fn GetAtomNameA(nAtom: ATOM, lpBuffer: LPSTR, nSize: c_int) -> UINT; + pub fn GetAtomNameW(nAtom: ATOM, lpBuffer: LPWSTR, nSize: c_int) -> UINT; + pub fn GetBinaryTypeA(lpApplicationName: LPCSTR, lpBinaryType: LPDWORD) -> BOOL; + pub fn GetBinaryTypeW(lpApplicationName: LPCWSTR, lpBinaryType: LPDWORD) -> BOOL; + pub fn GetCPInfo(CodePage: UINT, lpCPInfo: LPCPINFO) -> BOOL; + pub fn GetCPInfoExA(CodePage: UINT, dwFlags: DWORD, lpCPInfoEx: LPCPINFOEXA) -> BOOL; + pub fn GetCPInfoExW(CodePage: UINT, dwFlags: DWORD, lpCPInfoEx: LPCPINFOEXW) -> BOOL; + pub fn GetCachedSigningLevel( + File: HANDLE, Flags: PULONG, SigningLevel: PULONG, Thumbprint: PUCHAR, + ThumbprintSize: PULONG, ThumbprintAlgorithm: PULONG, + ) -> BOOL; + pub fn GetCalendarInfoA( + Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPSTR, cchData: c_int, + lpValue: LPDWORD, + ) -> c_int; + pub fn GetCalendarInfoEx( + lpLocaleName: LPCWSTR, Calendar: CALID, lpReserved: LPCWSTR, CalType: CALTYPE, + lpCalData: LPWSTR, cchData: c_int, lpValue: LPDWORD, + ) -> c_int; + pub fn GetCalendarInfoW( + Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPWSTR, cchData: c_int, + lpValue: LPDWORD, + ) -> c_int; + pub fn GetCommConfig(hCommDev: HANDLE, lpCC: LPCOMMCONFIG, lpdwSize: LPDWORD) -> BOOL; + pub fn GetCommMask(hFile: HANDLE, lpEvtMask: LPDWORD) -> BOOL; + pub fn GetCommModemStatus(hFile: HANDLE, lpModemStat: LPDWORD) -> BOOL; + pub fn GetCommProperties(hFile: HANDLE, lpCommProp: LPCOMMPROP) -> BOOL; + pub fn GetCommState(hFile: HANDLE, lpDCB: LPDCB) -> BOOL; + pub fn GetCommTimeouts(hFile: HANDLE, lpCommTimeouts: LPCOMMTIMEOUTS) -> BOOL; + pub fn GetCommandLineA() -> LPSTR; + pub fn GetCommandLineW() -> LPWSTR; + pub fn GetCompressedFileSizeA(lpFileName: LPCSTR, lpFileSizeHigh: LPDWORD) -> DWORD; + pub fn GetCompressedFileSizeTransactedA( + lpFileName: LPCSTR, lpFileSizeHigh: LPDWORD, hTransaction: HANDLE, + ) -> DWORD; + pub fn GetCompressedFileSizeTransactedW( + lpFileName: LPCWSTR, lpFileSizeHigh: LPDWORD, hTransaction: HANDLE, + ); + pub fn GetCompressedFileSizeW(lpFileName: LPCWSTR, lpFileSizeHigh: LPDWORD) -> DWORD; + pub fn GetComputerNameA(lpBuffer: LPSTR, nSize: LPDWORD) -> BOOL; + pub fn GetComputerNameExA( + NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPSTR, nSize: LPDWORD, + ) -> BOOL; + pub fn GetComputerNameExW( + NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPWSTR, nSize: LPDWORD, + ) -> BOOL; + pub fn GetComputerNameW(lpBuffer: LPWSTR, nSize: LPDWORD) -> BOOL; + pub fn GetConsoleAliasA( + Source: LPSTR, TargetBuffer: LPSTR, TargetBufferLength: DWORD, ExeName: LPSTR, + ) -> DWORD; + pub fn GetConsoleAliasExesA(ExeNameBuffer: LPSTR, ExeNameBufferLength: DWORD) -> DWORD; + pub fn GetConsoleAliasExesLengthA() -> DWORD; + pub fn GetConsoleAliasExesLengthW() -> DWORD; + pub fn GetConsoleAliasExesW(ExeNameBuffer: LPWSTR, ExeNameBufferLength: DWORD) -> DWORD; + pub fn GetConsoleAliasW( + Source: LPWSTR, TargetBuffer: LPWSTR, TargetBufferLength: DWORD, ExeName: LPWSTR, + ) -> DWORD; + pub fn GetConsoleAliasesA( + AliasBuffer: LPSTR, AliasBufferLength: DWORD, ExeName: LPSTR, + ) -> DWORD; + pub fn GetConsoleAliasesLengthA(ExeName: LPSTR) -> DWORD; + pub fn GetConsoleAliasesLengthW(ExeName: LPWSTR) -> DWORD; + pub fn GetConsoleAliasesW( + AliasBuffer: LPWSTR, AliasBufferLength: DWORD, ExeName: LPWSTR, + ) -> DWORD; + pub fn GetConsoleCP() -> UINT; + pub fn GetConsoleCursorInfo( + hConsoleOutput: HANDLE, lpConsoleCursorInfo: PCONSOLE_CURSOR_INFO, + ) -> BOOL; + pub fn GetConsoleDisplayMode(lpModeFlags: LPDWORD) -> BOOL; + pub fn GetConsoleFontSize(hConsoleOutput: HANDLE, nFont: DWORD) -> COORD; + pub fn GetConsoleHistoryInfo(lpConsoleHistoryInfo: PCONSOLE_HISTORY_INFO) -> BOOL; + pub fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL; + pub fn GetConsoleOriginalTitleA(lpConsoleTitle: LPSTR, nSize: DWORD) -> DWORD; + pub fn GetConsoleOriginalTitleW(lpConsoleTitle: LPWSTR, nSize: DWORD) -> DWORD; + pub fn GetConsoleOutputCP() -> UINT; + pub fn GetConsoleProcessList(lpdwProcessList: LPDWORD, dwProcessCount: DWORD) -> DWORD; + pub fn GetConsoleScreenBufferInfo( + hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: PCONSOLE_SCREEN_BUFFER_INFO, + ) -> BOOL; + pub fn GetConsoleScreenBufferInfoEx( + hConsoleOutput: HANDLE, lpConsoleScreenBufferInfoEx: PCONSOLE_SCREEN_BUFFER_INFOEX, + ) -> BOOL; + pub fn GetConsoleSelectionInfo(lpConsoleSelectionInfo: PCONSOLE_SELECTION_INFO) -> BOOL; + pub fn GetConsoleTitleA(lpConsoleTitle: LPSTR, nSize: DWORD) -> DWORD; + pub fn GetConsoleTitleW(lpConsoleTitle: LPWSTR, nSize: DWORD) -> DWORD; + pub fn GetConsoleWindow() -> HWND; + pub fn GetCurrencyFormatA( + Locale: LCID, dwFlags: DWORD, lpValue: LPCSTR, lpFormat: *const CURRENCYFMTA, + lpCurrencyStr: LPSTR, cchCurrency: c_int, + ) -> c_int; + pub fn GetCurrencyFormatEx( + lpLocaleName: LPCWSTR, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const CURRENCYFMTW, + lpCurrencyStr: LPWSTR, cchCurrency: c_int, + ) -> c_int; + pub fn GetCurrencyFormatW( + Locale: LCID, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const CURRENCYFMTW, + lpCurrencyStr: LPWSTR, cchCurrency: c_int, + ) -> c_int; + pub fn GetCurrentActCtx(lphActCtx: *mut HANDLE) -> BOOL; + // pub fn GetCurrentApplicationUserModelId(); + pub fn GetCurrentConsoleFont( + hConsoleOutput: HANDLE, bMaximumWindow: BOOL, lpConsoleCurrentFont: PCONSOLE_FONT_INFO, + ) -> BOOL; + pub fn GetCurrentConsoleFontEx( + hConsoleOutput: HANDLE, bMaximumWindow: BOOL, lpConsoleCurrentFontEx: PCONSOLE_FONT_INFOEX, + ) -> BOOL; + pub fn GetCurrentDirectoryA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; + pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; + // pub fn GetCurrentPackageFamilyName(); + // pub fn GetCurrentPackageFullName(); + // pub fn GetCurrentPackageId(); + // pub fn GetCurrentPackageInfo(); + // pub fn GetCurrentPackagePath(); + pub fn GetCurrentProcess() -> HANDLE; + pub fn GetCurrentProcessId() -> DWORD; + pub fn GetCurrentProcessorNumber() -> DWORD; + pub fn GetCurrentProcessorNumberEx(ProcNumber: PPROCESSOR_NUMBER); + pub fn GetCurrentThread() -> HANDLE; + pub fn GetCurrentThreadId() -> DWORD; + pub fn GetCurrentThreadStackLimits(LowLimit: PULONG_PTR, HighLimit: PULONG_PTR); + #[cfg(target_arch = "x86_64")] + pub fn GetCurrentUmsThread() -> PUMS_CONTEXT; + pub fn GetDateFormatA( + Locale: LCID, dwFlags: DWORD, lpDate: *const SYSTEMTIME, lpFormat: LPCSTR, lpDateStr: LPSTR, + cchDate: c_int, + ) -> c_int; + pub fn GetDateFormatEx( + lpLocaleName: LPCWSTR, dwFlags: DWORD, lpDate: *const SYSTEMTIME, lpFormat: LPCWSTR, + lpDateStr: LPWSTR, cchDate: c_int, lpCalendar: LPCWSTR, + ) -> c_int; + pub fn GetDateFormatW( + Locale: LCID, dwFlags: DWORD, lpDate: *const SYSTEMTIME, lpFormat: LPCWSTR, + lpDateStr: LPWSTR, cchDate: c_int, + ) -> c_int; + pub fn GetDefaultCommConfigA(lpszName: LPCSTR, lpCC: LPCOMMCONFIG, lpdwSize: LPDWORD) -> BOOL; + pub fn GetDefaultCommConfigW(lpszName: LPCWSTR, lpCC: LPCOMMCONFIG, lpdwSize: LPDWORD) -> BOOL; + pub fn GetDevicePowerState(hDevice: HANDLE, pfOn: *mut BOOL) -> BOOL; + pub fn GetDiskFreeSpaceA( + lpRootPathName: LPCSTR, lpSectorsPerCluster: LPDWORD, lpBytesPerSector: LPDWORD, + lpNumberOfFreeClusters: LPDWORD, lpTotalNumberOfClusters: LPDWORD, + ) -> BOOL; + pub fn GetDiskFreeSpaceExA( + lpDirectoryName: LPCSTR, lpFreeBytesAvailableToCaller: PULARGE_INTEGER, + lpTotalNumberOfBytes: PULARGE_INTEGER, lpTotalNumberOfFreeBytes: PULARGE_INTEGER, + ) -> BOOL; + pub fn GetDiskFreeSpaceExW( + lpDirectoryName: LPCWSTR, lpFreeBytesAvailableToCaller: PULARGE_INTEGER, + lpTotalNumberOfBytes: PULARGE_INTEGER, lpTotalNumberOfFreeBytes: PULARGE_INTEGER, + ) -> BOOL; + pub fn GetDiskFreeSpaceW( + lpRootPathName: LPCWSTR, lpSectorsPerCluster: LPDWORD, lpBytesPerSector: LPDWORD, + lpNumberOfFreeClusters: LPDWORD, lpTotalNumberOfClusters: LPDWORD, + ) -> BOOL; + pub fn GetDllDirectoryA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; + pub fn GetDllDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; + pub fn GetDriveTypeA(lpRootPathName: LPCSTR) -> UINT; + pub fn GetDriveTypeW(lpRootPathName: LPCWSTR) -> UINT; + pub fn GetDurationFormat( + Locale: LCID, dwFlags: DWORD, lpDuration: *const SYSTEMTIME, ullDuration: ULONGLONG, + lpFormat: LPCWSTR, lpDurationStr: LPWSTR, cchDuration: c_int, + ) -> c_int; + pub fn GetDurationFormatEx( + lpLocaleName: LPCWSTR, dwFlags: DWORD, lpDuration: *const SYSTEMTIME, + ullDuration: ULONGLONG, lpFormat: LPCWSTR, lpDurationStr: LPWSTR, cchDuration: c_int, + ) -> c_int; + pub fn GetDynamicTimeZoneInformation( + pTimeZoneInformation: PDYNAMIC_TIME_ZONE_INFORMATION, + ) -> DWORD; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn GetEnabledXStateFeatures() -> DWORD64; + pub fn GetEnvironmentStrings() -> LPCH; + pub fn GetEnvironmentStringsW() -> LPWCH; + pub fn GetEnvironmentVariableA(lpName: LPCSTR, lpBuffer: LPSTR, nSize: DWORD) -> DWORD; + pub fn GetEnvironmentVariableW(lpName: LPCWSTR, lpBuffer: LPWSTR, nSize: DWORD) -> DWORD; + // pub fn GetEraNameCountedString(); + pub fn GetErrorMode() -> UINT; + pub fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: LPDWORD) -> BOOL; + pub fn GetExitCodeThread(hThread: HANDLE, lpExitCode: LPDWORD) -> BOOL; + pub fn GetFileAttributesA(lpFileName: LPCSTR) -> DWORD; + pub fn GetFileAttributesExA( + lpFileName: LPCSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, + ) -> BOOL; + pub fn GetFileAttributesExW( + lpFileName: LPCWSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, + ) -> BOOL; + pub fn GetFileAttributesTransactedA( + lpFileName: LPCSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, + hTransaction: HANDLE, + ) -> BOOL; + pub fn GetFileAttributesTransactedW( + lpFileName: LPCWSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, + hTransaction: HANDLE, + ) -> BOOL; + pub fn GetFileAttributesW(lpFileName: LPCWSTR) -> DWORD; + pub fn GetFileBandwidthReservation( + hFile: HANDLE, lpPeriodMilliseconds: LPDWORD, lpBytesPerPeriod: LPDWORD, + pDiscardable: LPBOOL, lpTransferSize: LPDWORD, lpNumOutstandingRequests: LPDWORD, + ) -> BOOL; + pub fn GetFileInformationByHandle( + hFile: HANDLE, lpFileInformation: LPBY_HANDLE_FILE_INFORMATION, + ) -> BOOL; + pub fn GetFileInformationByHandleEx( + hFile: HANDLE, FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, lpFileInformation: LPVOID, + dwBufferSize: DWORD, + ) -> BOOL; + pub fn GetFileMUIInfo( + dwFlags: DWORD, pcwszFilePath: PCWSTR, pFileMUIInfo: PFILEMUIINFO, + pcbFileMUIInfo: *mut DWORD, + ) -> BOOL; + pub fn GetFileMUIPath( + dwFlags: DWORD, pcwszFilePath: PCWSTR, pwszLanguage: PWSTR, pcchLanguage: PULONG, + pwszFileMUIPath: PWSTR, pcchFileMUIPath: PULONG, pululEnumerator: PULONGLONG, + ) -> BOOL; + pub fn GetFileSize(hFile: HANDLE, lpFileSizeHigh: LPDWORD) -> DWORD; + pub fn GetFileSizeEx(hFile: HANDLE, lpFileSize: PLARGE_INTEGER) -> BOOL; + pub fn GetFileTime( + hFile: HANDLE, lpCreationTime: LPFILETIME, lpLastAccessTime: LPFILETIME, + lpLastWriteTime: LPFILETIME, + ) -> BOOL; + pub fn GetFileType(hFile: HANDLE) -> DWORD; + pub fn GetFinalPathNameByHandleA( + hFile: HANDLE, lpszFilePath: LPSTR, cchFilePath: DWORD, dwFlags: DWORD, + ) -> DWORD; + pub fn GetFinalPathNameByHandleW( + hFile: HANDLE, lpszFilePath: LPWSTR, cchFilePath: DWORD, dwFlags: DWORD, + ) -> DWORD; + pub fn GetFirmwareEnvironmentVariableA( + lpName: LPCSTR, lpGuid: LPCSTR, pBuffer: PVOID, nSize: DWORD, + ) -> DWORD; + pub fn GetFirmwareEnvironmentVariableExA( + lpName: LPCSTR, lpGuid: LPCSTR, pBuffer: PVOID, nSize: DWORD, pdwAttribubutes: PDWORD, + ) -> DWORD; + pub fn GetFirmwareEnvironmentVariableExW( + lpName: LPCWSTR, lpGuid: LPCWSTR, pBuffer: PVOID, nSize: DWORD, pdwAttribubutes: PDWORD, + ) -> DWORD; + pub fn GetFirmwareEnvironmentVariableW( + lpName: LPCWSTR, lpGuid: LPCWSTR, pBuffer: PVOID, nSize: DWORD, + ) -> DWORD; + pub fn GetFirmwareType(FirmwareType: PFIRMWARE_TYPE) -> BOOL; + pub fn GetFullPathNameA( + lpFileName: LPCSTR, nBufferLength: DWORD, lpBuffer: LPSTR, lpFilePart: *mut LPSTR, + ) -> DWORD; + pub fn GetFullPathNameTransactedA( + lpFileName: LPCSTR, nBufferLength: DWORD, lpBuffer: LPSTR, lpFilePart: *mut LPSTR, + hTransaction: HANDLE, + ) -> DWORD; + pub fn GetFullPathNameTransactedW( + lpFileName: LPCWSTR, nBufferLength: DWORD, lpBuffer: LPWSTR, lpFilePart: *mut LPWSTR, + hTransaction: HANDLE, + ); + pub fn GetFullPathNameW( + lpFileName: LPCWSTR, nBufferLength: DWORD, lpBuffer: LPWSTR, lpFilePart: *mut LPWSTR, + ) -> DWORD; + pub fn GetGeoInfoA( + Location: GEOID, GeoType: GEOTYPE, lpGeoData: LPSTR, cchData: c_int, LangId: LANGID, + ) -> c_int; + pub fn GetGeoInfoW( + Location: GEOID, GeoType: GEOTYPE, lpGeoData: LPWSTR, cchData: c_int, LangId: LANGID, + ) -> c_int; + pub fn GetHandleInformation(hObject: HANDLE, lpdwFlags: LPDWORD) -> BOOL; + pub fn GetLargePageMinimum() -> SIZE_T; + pub fn GetLargestConsoleWindowSize(hConsoleOutput: HANDLE) -> COORD; + pub fn GetLastError() -> DWORD; + pub fn GetLocalTime(lpSystemTime: LPSYSTEMTIME); + pub fn GetLocaleInfoA( + Locale: LCID, LCType: LCTYPE, lpLCData: LPSTR, cchData: c_int, + ) -> c_int; + pub fn GetLocaleInfoEx( + lpLocaleName: LPCWSTR, LCType: LCTYPE, lpLCData: LPWSTR, cchData: c_int, + ) -> c_int; + pub fn GetLocaleInfoW( + Locale: LCID, LCType: LCTYPE, lpLCData: LPWSTR, cchData: c_int, + ) -> c_int; + pub fn GetLogicalDriveStringsA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; + pub fn GetLogicalDriveStringsW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; + pub fn GetLogicalDrives() -> DWORD; + pub fn GetLogicalProcessorInformation( + Buffer: PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, ReturnedLength: PDWORD, + ) -> BOOL; + pub fn GetLogicalProcessorInformationEx( + RelationshipType: LOGICAL_PROCESSOR_RELATIONSHIP, + Buffer: PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, + ReturnedLength: PDWORD, + ) -> BOOL; + pub fn GetLongPathNameA(lpszShortPath: LPCSTR, lpszLongPath: LPSTR, cchBuffer: DWORD) -> DWORD; + pub fn GetLongPathNameTransactedA( + lpszShortPath: LPCSTR, lpszLongPath: LPSTR, cchBuffer: DWORD, hTransaction: HANDLE, + ) -> DWORD; + pub fn GetLongPathNameTransactedW( + lpszShortPath: LPCWSTR, lpszLongPath: LPWSTR, cchBuffer: DWORD, hTransaction: HANDLE, + ) -> DWORD; + pub fn GetLongPathNameW( + lpszShortPath: LPCWSTR, lpszLongPath: LPWSTR, cchBuffer: DWORD, + ) -> DWORD; + pub fn GetMailslotInfo( + hMailslot: HANDLE, lpMaxMessageSize: LPDWORD, lpNextSize: LPDWORD, lpMessageCount: LPDWORD, + lpReadTimeout: LPDWORD, + ) -> BOOL; + pub fn GetMaximumProcessorCount(GroupNumber: WORD) -> DWORD; + pub fn GetMaximumProcessorGroupCount() -> WORD; + pub fn GetMemoryErrorHandlingCapabilities(Capabilities: PULONG) -> BOOL; + pub fn GetModuleFileNameA( + hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn GetModuleFileNameW( + hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn GetModuleHandleA(lpModuleName: LPCSTR) -> HMODULE; + pub fn GetModuleHandleExA( + dwFlags: DWORD, lpModuleName: LPCSTR, phModule: *mut HMODULE, + ) -> BOOL; + pub fn GetModuleHandleExW( + dwFlags: DWORD, lpModuleName: LPCWSTR, phModule: *mut HMODULE, + ) -> BOOL; + pub fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE; + pub fn GetNLSVersion( + Function: NLS_FUNCTION, Locale: LCID, lpVersionInformation: LPNLSVERSIONINFO, + ) -> BOOL; + pub fn GetNLSVersionEx( + function: NLS_FUNCTION, lpLocaleName: LPCWSTR, lpVersionInformation: LPNLSVERSIONINFOEX, + ) -> BOOL; + // pub fn GetNamedPipeAttribute(); + pub fn GetNamedPipeClientComputerNameA( + Pipe: HANDLE, ClientComputerName: LPSTR, ClientComputerNameLength: ULONG, + ) -> BOOL; + pub fn GetNamedPipeClientComputerNameW( + Pipe: HANDLE, ClientComputerName: LPWSTR, ClientComputerNameLength: ULONG, + ) -> BOOL; + pub fn GetNamedPipeClientProcessId(Pipe: HANDLE, ClientProcessId: PULONG) -> BOOL; + pub fn GetNamedPipeClientSessionId(Pipe: HANDLE, ClientSessionId: PULONG) -> BOOL; + pub fn GetNamedPipeHandleStateA( + hNamedPipe: HANDLE, lpState: LPDWORD, lpCurInstances: LPDWORD, + lpMaxCollectionCount: LPDWORD, lpCollectDataTimeout: LPDWORD, lpUserName: LPSTR, + nMaxUserNameSize: DWORD, + ) -> BOOL; + pub fn GetNamedPipeHandleStateW( + hNamedPipe: HANDLE, lpState: LPDWORD, lpCurInstances: LPDWORD, + lpMaxCollectionCount: LPDWORD, lpCollectDataTimeout: LPDWORD, lpUserName: LPWSTR, + nMaxUserNameSize: DWORD, + ) -> BOOL; + pub fn GetNamedPipeInfo( + hNamedPipe: HANDLE, lpFlags: LPDWORD, lpOutBufferSize: LPDWORD, lpInBufferSize: LPDWORD, + lpMaxInstances: LPDWORD, + ) -> BOOL; + pub fn GetNamedPipeServerProcessId(Pipe: HANDLE, ServerProcessId: PULONG) -> BOOL; + pub fn GetNamedPipeServerSessionId(Pipe: HANDLE, ServerSessionId: PULONG) -> BOOL; + pub fn GetNativeSystemInfo(lpSystemInfo: LPSYSTEM_INFO); + #[cfg(target_arch = "x86_64")] + pub fn GetNextUmsListItem(UmsContext: PUMS_CONTEXT) -> PUMS_CONTEXT; + pub fn GetNumaAvailableMemoryNode(Node: UCHAR, AvailableBytes: PULONGLONG) -> BOOL; + pub fn GetNumaAvailableMemoryNodeEx(Node: USHORT, AvailableBytes: PULONGLONG) -> BOOL; + pub fn GetNumaHighestNodeNumber(HighestNodeNumber: PULONG) -> BOOL; + pub fn GetNumaNodeNumberFromHandle(hFile: HANDLE, NodeNumber: PUSHORT) -> BOOL; + pub fn GetNumaNodeProcessorMask(Node: UCHAR, ProcessorMask: PULONGLONG) -> BOOL; + pub fn GetNumaNodeProcessorMaskEx(Node: USHORT, ProcessorMask: PGROUP_AFFINITY) -> BOOL; + pub fn GetNumaProcessorNode(Processor: UCHAR, NodeNumber: PUCHAR) -> BOOL; + pub fn GetNumaProcessorNodeEx(Processor: PPROCESSOR_NUMBER, NodeNumber: PUSHORT) -> BOOL; + pub fn GetNumaProximityNode(ProximityId: ULONG, NodeNumber: PUCHAR) -> BOOL; + pub fn GetNumaProximityNodeEx(ProximityId: ULONG, NodeNumber: PUSHORT) -> BOOL; + pub fn GetNumberFormatA( + Locale: LCID, dwFlags: DWORD, lpValue: LPCSTR, lpFormat: *const NUMBERFMTA, + lpNumberStr: LPSTR, cchNumber: c_int, + ) -> c_int; + pub fn GetNumberFormatEx( + lpLocaleName: LPCWSTR, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const NUMBERFMTW, + lpNumberStr: LPWSTR, cchNumber: c_int, + ) -> c_int; + pub fn GetNumberFormatW( + Locale: LCID, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const NUMBERFMTW, + lpNumberStr: LPWSTR, cchNumber: c_int, + ) -> c_int; + pub fn GetNumberOfConsoleInputEvents(hConsoleInput: HANDLE, lpNumberOfEvents: LPDWORD) -> BOOL; + pub fn GetNumberOfConsoleMouseButtons(lpNumberOfMouseButtons: LPDWORD) -> BOOL; + pub fn GetOEMCP() -> UINT; + pub fn GetOverlappedResult( + hFile: HANDLE, lpOverlapped: LPOVERLAPPED, lpNumberOfBytesTransferred: LPDWORD, bWait: BOOL, + ) -> BOOL; + pub fn GetOverlappedResultEx( + hFile: HANDLE, lpOverlapped: LPOVERLAPPED, lpNumberOfBytesTransferred: LPDWORD, + dwMilliseconds: DWORD, bAlertable: BOOL, + ) -> BOOL; + // pub fn GetPackageApplicationIds(); + // pub fn GetPackageFamilyName(); + // pub fn GetPackageFullName(); + // pub fn GetPackageId(); + // pub fn GetPackageInfo(); + // pub fn GetPackagePath(); + // pub fn GetPackagePathByFullName(); + // pub fn GetPackagesByPackageFamily(); + pub fn GetPhysicallyInstalledSystemMemory(TotalMemoryInKilobytes: PULONGLONG) -> BOOL; + pub fn GetPriorityClass(hProcess: HANDLE) -> DWORD; + pub fn GetPrivateProfileIntA( + lpAppName: LPCSTR, lpKeyName: LPCSTR, nDefault: INT, lpFileName: LPCSTR, + ) -> UINT; + pub fn GetPrivateProfileIntW( + lpAppName: LPCWSTR, lpKeyName: LPCWSTR, nDefault: INT, lpFileName: LPCWSTR, + ) -> UINT; + pub fn GetPrivateProfileSectionA( + lpAppName: LPCSTR, lpReturnedString: LPSTR, nSize: DWORD, lpFileName: LPCSTR, + ) -> DWORD; + pub fn GetPrivateProfileSectionNamesA( + lpszReturnBuffer: LPSTR, nSize: DWORD, lpFileName: LPCSTR, + ) -> DWORD; + pub fn GetPrivateProfileSectionNamesW( + lpszReturnBuffer: LPWSTR, nSize: DWORD, lpFileName: LPCWSTR, + ) -> DWORD; + pub fn GetPrivateProfileSectionW( + lpAppName: LPCWSTR, lpReturnedString: LPWSTR, nSize: DWORD, lpFileName: LPCWSTR, + ) -> DWORD; + pub fn GetPrivateProfileStringA( + lpAppName: LPCSTR, lpKeyName: LPCSTR, lpDefault: LPCSTR, lpReturnedString: LPSTR, + nSize: DWORD, lpFileName: LPCSTR, + ) -> DWORD; + pub fn GetPrivateProfileStringW( + lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpDefault: LPCWSTR, lpReturnedString: LPWSTR, + nSize: DWORD, lpFileName: LPCWSTR, + ) -> DWORD; + pub fn GetPrivateProfileStructA( + lpszSection: LPCSTR, lpszKey: LPCSTR, lpStruct: LPVOID, uSizeStruct: UINT, szFile: LPCSTR, + ) -> BOOL; + pub fn GetPrivateProfileStructW( + lpszSection: LPCWSTR, lpszKey: LPCWSTR, lpStruct: LPVOID, uSizeStruct: UINT, + szFile: LPCWSTR, + ) -> BOOL; + pub fn GetProcAddress(hModule: HMODULE, lpProcName: LPCSTR) -> FARPROC; + pub fn GetProcessAffinityMask( + hProcess: HANDLE, lpProcessAffinityMask: PDWORD_PTR, lpSystemAffinityMask: PDWORD_PTR, + ) -> BOOL; + pub fn GetProcessDEPPolicy(hProcess: HANDLE, lpFlags: LPDWORD, lpPermanent: PBOOL) -> BOOL; + pub fn GetProcessGroupAffinity( + hProcess: HANDLE, GroupCount: PUSHORT, GroupArray: PUSHORT, + ) -> BOOL; + pub fn GetProcessHandleCount(hProcess: HANDLE, pdwHandleCount: PDWORD) -> BOOL; + pub fn GetProcessHeap() -> HANDLE; + pub fn GetProcessHeaps(NumberOfHeaps: DWORD, ProcessHeaps: PHANDLE) -> DWORD; + pub fn GetProcessId(Process: HANDLE) -> DWORD; + pub fn GetProcessIdOfThread(Thread: HANDLE) -> DWORD; + pub fn GetProcessInformation( + hProcess: HANDLE, ProcessInformationClass: PROCESS_INFORMATION_CLASS, + ProcessInformation: LPVOID, ProcessInformationSize: DWORD, + ) -> BOOL; + pub fn GetProcessIoCounters(hProcess: HANDLE, lpIoCounters: PIO_COUNTERS) -> BOOL; + pub fn GetProcessMitigationPolicy( + hProcess: HANDLE, MitigationPolicy: PROCESS_MITIGATION_POLICY, lpBuffer: PVOID, + dwLength: SIZE_T, + ) -> BOOL; + pub fn GetProcessPreferredUILanguages( + dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn GetProcessPriorityBoost(hProcess: HANDLE, pDisablePriorityBoost: PBOOL) -> BOOL; + pub fn GetProcessShutdownParameters(lpdwLevel: LPDWORD, lpdwFlags: LPDWORD) -> BOOL; + pub fn GetProcessTimes( + hProcess: HANDLE, lpCreationTime: LPFILETIME, lpExitTime: LPFILETIME, + lpKernelTime: LPFILETIME, lpUserTime: LPFILETIME, + ) -> BOOL; + pub fn GetProcessVersion(ProcessId: DWORD) -> DWORD; + pub fn GetProcessWorkingSetSize( + hProcess: HANDLE, lpMinimumWorkingSetSize: PSIZE_T, lpMaximumWorkingSetSize: PSIZE_T, + ) -> BOOL; + pub fn GetProcessWorkingSetSizeEx( + hProcess: HANDLE, lpMinimumWorkingSetSize: PSIZE_T, lpMaximumWorkingSetSize: PSIZE_T, + Flags: PDWORD, + ) -> BOOL; + pub fn GetProcessorSystemCycleTime( + Group: USHORT, Buffer: PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION, ReturnedLength: PDWORD, + ) -> BOOL; + pub fn GetProductInfo( + dwOSMajorVersion: DWORD, dwOSMinorVersion: DWORD, dwSpMajorVersion: DWORD, + dwSpMinorVersion: DWORD, pdwReturnedProductType: PDWORD, + ) -> BOOL; + pub fn GetProfileIntA(lpAppName: LPCSTR, lpKeyName: LPCSTR, nDefault: INT) -> UINT; + pub fn GetProfileIntW(lpAppName: LPCWSTR, lpKeyName: LPCWSTR, nDefault: INT) -> UINT; + pub fn GetProfileSectionA(lpAppName: LPCSTR, lpReturnedString: LPSTR, nSize: DWORD) -> DWORD; + pub fn GetProfileSectionW(lpAppName: LPCWSTR, lpReturnedString: LPWSTR, nSize: DWORD) -> DWORD; + pub fn GetProfileStringA( + lpAppName: LPCSTR, lpKeyName: LPCSTR, lpDefault: LPCSTR, lpReturnedString: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetProfileStringW( + lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpDefault: LPCWSTR, lpReturnedString: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetQueuedCompletionStatus( + CompletionPort: HANDLE, lpNumberOfBytesTransferred: LPDWORD, lpCompletionKey: PULONG_PTR, + lpOverlapped: *mut LPOVERLAPPED, dwMilliseconds: DWORD, + ) -> BOOL; + pub fn GetQueuedCompletionStatusEx( + CompletionPort: HANDLE, lpCompletionPortEntries: LPOVERLAPPED_ENTRY, ulCount: ULONG, + ulNumEntriesRemoved: PULONG, dwMilliseconds: DWORD, fAlertable: BOOL, + ) -> BOOL; + pub fn GetShortPathNameA( + lpszLongPath: LPCSTR, lpszShortPath: LPSTR, cchBuffer: DWORD, + ) -> DWORD; + pub fn GetShortPathNameW( + lpszLongPath: LPCWSTR, lpszShortPath: LPWSTR, cchBuffer: DWORD, + ) -> DWORD; + // pub fn GetStagedPackagePathByFullName(); + pub fn GetStartupInfoA(lpStartupInfo: LPSTARTUPINFOA); + pub fn GetStartupInfoW(lpStartupInfo: LPSTARTUPINFOW); + // pub fn GetStateFolder(); + pub fn GetStdHandle(nStdHandle: DWORD) -> HANDLE; + pub fn GetStringScripts( + dwFlags: DWORD, lpString: LPCWSTR, cchString: c_int, lpScripts: LPWSTR, cchScripts: c_int, + ) -> c_int; + pub fn GetStringTypeA( + Locale: LCID, dwInfoType: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpCharType: LPWORD, + ) -> BOOL; + pub fn GetStringTypeExA( + Locale: LCID, dwInfoType: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpCharType: LPWORD, + ) -> BOOL; + pub fn GetStringTypeExW( + Locale: LCID, dwInfoType: DWORD, lpSrcStr: LPCWCH, cchSrc: c_int, lpCharType: LPWORD, + ) -> BOOL; + pub fn GetStringTypeW( + dwInfoType: DWORD, lpSrcStr: LPCWCH, cchSrc: c_int, lpCharType: LPWORD, + ) -> BOOL; + // pub fn GetSystemAppDataKey(); + pub fn GetSystemDEPPolicy() -> DEP_SYSTEM_POLICY_TYPE; + pub fn GetSystemDefaultLCID() -> LCID; + pub fn GetSystemDefaultLangID() -> LANGID; + pub fn GetSystemDefaultLocaleName(lpLocaleName: LPWSTR, cchLocaleName: c_int) -> c_int; + pub fn GetSystemDefaultUILanguage() -> LANGID; + pub fn GetSystemDirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; + pub fn GetSystemDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; + pub fn GetSystemFileCacheSize( + lpMinimumFileCacheSize: PSIZE_T, lpMaximumFileCacheSize: PSIZE_T, lpFlags: PDWORD, + ) -> BOOL; + pub fn GetSystemFirmwareTable( + FirmwareTableProviderSignature: DWORD, FirmwareTableID: DWORD, pFirmwareTableBuffer: PVOID, + BufferSize: DWORD, + ) -> UINT; + pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO); + pub fn GetSystemPowerStatus(lpSystemPowerStatus: LPSYSTEM_POWER_STATUS) -> BOOL; + pub fn GetSystemPreferredUILanguages( + dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn GetSystemRegistryQuota(pdwQuotaAllowed: PDWORD, pdwQuotaUsed: PDWORD) -> BOOL; + pub fn GetSystemTime(lpSystemTime: LPSYSTEMTIME); + pub fn GetSystemTimeAdjustment( + lpTimeAdjustment: PDWORD, lpTimeIncrement: PDWORD, lpTimeAdjustmentDisabled: PBOOL, + ) -> BOOL; + pub fn GetSystemTimeAsFileTime(lpSystemTimeAsFileTime: LPFILETIME); + pub fn GetSystemTimePreciseAsFileTime(lpSystemTimeAsFileTime: LPFILETIME); + pub fn GetSystemTimes( + lpIdleTime: LPFILETIME, lpKernelTime: LPFILETIME, lpUserTime: LPFILETIME, + ) -> BOOL; + pub fn GetSystemWindowsDirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; + pub fn GetSystemWindowsDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; + pub fn GetSystemWow64DirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; + pub fn GetSystemWow64DirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; + pub fn GetTapeParameters( + hDevice: HANDLE, dwOperation: DWORD, lpdwSize: LPDWORD, lpTapeInformation: LPVOID + ) -> DWORD; + pub fn GetTapePosition( + hDevice: HANDLE, dwPositionType: DWORD, lpdwPartition: LPDWORD, + lpdwOffsetLow: LPDWORD, lpdwOffsetHigh: LPDWORD + ) -> DWORD; + pub fn GetTapeStatus(hDevice: HANDLE) -> DWORD; + pub fn GetTempFileNameA( + lpPathName: LPCSTR, lpPrefixString: LPCSTR, uUnique: UINT, lpTempFileName: LPSTR, + ) -> UINT; + pub fn GetTempFileNameW( + lpPathName: LPCWSTR, lpPrefixString: LPCWSTR, uUnique: UINT, lpTempFileName: LPWSTR, + ) -> UINT; + pub fn GetTempPathA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; + pub fn GetTempPathW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; + pub fn GetThreadContext(hThread: HANDLE, lpContext: LPCONTEXT) -> BOOL; + pub fn GetThreadErrorMode() -> DWORD; + pub fn GetThreadGroupAffinity(hThread: HANDLE, GroupAffinity: PGROUP_AFFINITY) -> BOOL; + pub fn GetThreadIOPendingFlag(hThread: HANDLE, lpIOIsPending: PBOOL) -> BOOL; + pub fn GetThreadId(Thread: HANDLE) -> DWORD; + pub fn GetThreadIdealProcessorEx(hThread: HANDLE, lpIdealProcessor: PPROCESSOR_NUMBER) -> BOOL; + pub fn GetThreadInformation( + hThread: HANDLE, ThreadInformationClass: THREAD_INFORMATION_CLASS, + ThreadInformation: LPVOID, ThreadInformationSize: DWORD, + ) -> BOOL; + pub fn GetThreadLocale() -> LCID; + pub fn GetThreadPreferredUILanguages( + dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn GetThreadPriority(hThread: HANDLE) -> c_int; + pub fn GetThreadPriorityBoost(hThread: HANDLE, pDisablePriorityBoost: PBOOL) -> BOOL; + pub fn GetThreadSelectorEntry( + hThread: HANDLE, dwSelector: DWORD, lpSelectorEntry: LPLDT_ENTRY, + ) -> BOOL; + pub fn GetThreadTimes( + hThread: HANDLE, lpCreationTime: LPFILETIME, lpExitTime: LPFILETIME, + lpKernelTime: LPFILETIME, lpUserTime: LPFILETIME, + ) -> BOOL; + pub fn GetThreadUILanguage() -> LANGID; + pub fn GetTickCount() -> DWORD; + pub fn GetTickCount64() -> ULONGLONG; + pub fn GetTimeFormatA( + Locale: LCID, dwFlags: DWORD, lpTime: *const SYSTEMTIME, lpFormat: LPCSTR, + lpTimeStr: LPSTR, cchTime: c_int, + ) -> c_int; + pub fn GetTimeFormatEx( + lpLocaleName: LPCWSTR, dwFlags: DWORD, lpTime: *const SYSTEMTIME, lpFormat: LPCWSTR, + lpTimeStr: LPWSTR, cchTime: c_int, + ) -> c_int; + pub fn GetTimeFormatW( + Locale: LCID, dwFlags: DWORD, lpTime: *const SYSTEMTIME, lpFormat: LPCWSTR, + lpTimeStr: LPWSTR, cchTime: c_int, + ) -> c_int; + pub fn GetTimeZoneInformation(lpTimeZoneInformation: LPTIME_ZONE_INFORMATION) -> DWORD; + pub fn GetTimeZoneInformationForYear( + wYear: USHORT, pdtzi: PDYNAMIC_TIME_ZONE_INFORMATION, ptzi: LPTIME_ZONE_INFORMATION, + ) -> BOOL; + pub fn GetUILanguageInfo( + dwFlags: DWORD, pwmszLanguage: PCZZWSTR, pwszFallbackLanguages: PZZWSTR, + pcchFallbackLanguages: PDWORD, pAttributes: PDWORD, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn GetUmsCompletionListEvent( + UmsCompletionList: PUMS_COMPLETION_LIST, UmsCompletionEvent: PHANDLE, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn GetUmsSystemThreadInformation( + ThreadHandle: HANDLE, SystemThreadInfo: PUMS_SYSTEM_THREAD_INFORMATION, + ) -> BOOL; + pub fn GetUserDefaultLCID() -> LCID; + pub fn GetUserDefaultLangID() -> LANGID; + pub fn GetUserDefaultLocaleName(lpLocaleName: LPWSTR, cchLocaleName: c_int) -> c_int; + pub fn GetUserDefaultUILanguage() -> LANGID; + pub fn GetUserGeoID(GeoClass: GEOCLASS) -> GEOID; + pub fn GetUserPreferredUILanguages( + dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn GetVersion() -> DWORD; + pub fn GetVersionExA(lpVersionInformation: LPOSVERSIONINFOA) -> BOOL; + pub fn GetVersionExW(lpVersionInformation: LPOSVERSIONINFOW) -> BOOL; + pub fn GetVolumeInformationA( + lpRootPathName: LPCSTR, lpVolumeNameBuffer: LPSTR, nVolumeNameSize: DWORD, + lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, + lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPSTR, nFileSystemNameSize: DWORD, + ) -> BOOL; + pub fn GetVolumeInformationByHandleW( + hFile: HANDLE, lpVolumeNameBuffer: LPWSTR, nVolumeNameSize: DWORD, + lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, + lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPWSTR, nFileSystemNameSize: DWORD, + ) -> BOOL; + pub fn GetVolumeInformationW( + lpRootPathName: LPCWSTR, lpVolumeNameBuffer: LPWSTR, nVolumeNameSize: DWORD, + lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, + lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPWSTR, nFileSystemNameSize: DWORD, + ) -> BOOL; + pub fn GetVolumeNameForVolumeMountPointA( + lpszVolumeMountPoint: LPCSTR, lpszVolumeName: LPSTR, cchBufferLength: DWORD, + ) -> BOOL; + pub fn GetVolumeNameForVolumeMountPointW( + lpszVolumeMountPoint: LPCWSTR, lpszVolumeName: LPWSTR, cchBufferLength: DWORD, + ) -> BOOL; + pub fn GetVolumePathNameA( + lpszFileName: LPCSTR, lpszVolumePathName: LPSTR, cchBufferLength: DWORD, + ) -> BOOL; + pub fn GetVolumePathNameW( + lpszFileName: LPCWSTR, lpszVolumePathName: LPWSTR, cchBufferLength: DWORD, + ) -> BOOL; + pub fn GetVolumePathNamesForVolumeNameA( + lpszVolumeName: LPCSTR, lpszVolumePathNames: LPCH, cchBufferLength: DWORD, + lpcchReturnLength: PDWORD, + ) -> BOOL; + pub fn GetVolumePathNamesForVolumeNameW( + lpszVolumeName: LPCWSTR, lpszVolumePathNames: LPWCH, cchBufferLength: DWORD, + lpcchReturnLength: PDWORD, + ) -> BOOL; + pub fn GetWindowsDirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; + pub fn GetWindowsDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; + pub fn GetWriteWatch( + dwFlags: DWORD, lpBaseAddress: PVOID, dwRegionSize: SIZE_T, lpAddresses: *mut PVOID, + lpdwCount: *mut ULONG_PTR, lpdwGranularity: LPDWORD, + ) -> UINT; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn GetXStateFeaturesMask(Context: PCONTEXT, FeatureMask: PDWORD64) -> BOOL; + pub fn GlobalAddAtomA(lpString: LPCSTR) -> ATOM; + pub fn GlobalAddAtomExA(lpString: LPCSTR, Flags: DWORD) -> ATOM; + pub fn GlobalAddAtomExW(lpString: LPCWSTR, Flags: DWORD) -> ATOM; + pub fn GlobalAddAtomW(lpString: LPCWSTR) -> ATOM; + pub fn GlobalAlloc(uFlags: UINT, dwBytes: SIZE_T) -> HGLOBAL; + pub fn GlobalCompact(dwMinFree: DWORD) -> SIZE_T; + pub fn GlobalDeleteAtom(nAtom: ATOM) -> ATOM; + pub fn GlobalFindAtomA(lpString: LPCSTR) -> ATOM; + pub fn GlobalFindAtomW(lpString: LPCWSTR) -> ATOM; + pub fn GlobalFix(hMem: HGLOBAL); + pub fn GlobalFlags(hMem: HGLOBAL) -> UINT; + pub fn GlobalFree(hMem: HGLOBAL) -> HGLOBAL; + pub fn GlobalGetAtomNameA(nAtom: ATOM, lpBuffer: LPSTR, nSize: c_int) -> UINT; + pub fn GlobalGetAtomNameW(nAtom: ATOM, lpBuffer: LPWSTR, nSize: c_int) -> UINT; + pub fn GlobalHandle(pMem: LPCVOID) -> HGLOBAL; + pub fn GlobalLock(hMem: HGLOBAL) -> LPVOID; + pub fn GlobalMemoryStatus(lpBuffer: LPMEMORYSTATUS); + pub fn GlobalMemoryStatusEx(lpBuffer: LPMEMORYSTATUSEX) -> BOOL; + pub fn GlobalReAlloc(hMem: HGLOBAL, dwBytes: SIZE_T, uFlags: UINT) -> HGLOBAL; + pub fn GlobalSize(hMem: HGLOBAL) -> SIZE_T; + pub fn GlobalUnWire(hMem: HGLOBAL) -> BOOL; + pub fn GlobalUnfix(hMem: HGLOBAL); + pub fn GlobalUnlock(hMem: HGLOBAL) -> BOOL; + pub fn GlobalWire(hMem: HGLOBAL) -> LPVOID; + pub fn Heap32First(lphe: LPHEAPENTRY32, th32ProcessID: DWORD, th32HeapID: ULONG_PTR) -> BOOL; + pub fn Heap32ListFirst(hSnapshot: HANDLE, lphl: LPHEAPLIST32) -> BOOL; + pub fn Heap32ListNext(hSnapshot: HANDLE, lphl: LPHEAPLIST32) -> BOOL; + pub fn Heap32Next(lphe: LPHEAPENTRY32) -> BOOL; + pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; + pub fn HeapCompact(hHeap: HANDLE, dwFlags: DWORD) -> SIZE_T; + pub fn HeapCreate(flOptions: DWORD, dwInitialSize: SIZE_T, dwMaximumSize: SIZE_T) -> HANDLE; + pub fn HeapDestroy(hHeap: HANDLE) -> BOOL; + pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL; + pub fn HeapLock(hHeap: HANDLE) -> BOOL; + pub fn HeapQueryInformation( + HeapHandle: HANDLE, HeapInformationClass: HEAP_INFORMATION_CLASS, HeapInformation: PVOID, + HeapInformationLength: SIZE_T, ReturnLength: PSIZE_T, + ) -> BOOL; + pub fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID, dwBytes: SIZE_T) -> LPVOID; + pub fn HeapSetInformation( + HeapHandle: HANDLE, HeapInformationClass: HEAP_INFORMATION_CLASS, HeapInformation: PVOID, + HeapInformationLength: SIZE_T, + ) -> BOOL; + pub fn HeapSize(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPCVOID) -> SIZE_T; + pub fn HeapSummary(hHeap: HANDLE, dwFlags: DWORD, lpSummary: LPHEAP_SUMMARY) -> BOOL; + pub fn HeapUnlock(hHeap: HANDLE) -> BOOL; + pub fn HeapValidate(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPCVOID) -> BOOL; + pub fn HeapWalk(hHeap: HANDLE, lpEntry: LPPROCESS_HEAP_ENTRY) -> BOOL; + pub fn InitAtomTable(nSize: DWORD) -> BOOL; + pub fn InitOnceBeginInitialize( + lpInitOnce: LPINIT_ONCE, dwFlags: DWORD, fPending: PBOOL, lpContext: *mut LPVOID, + ) -> BOOL; + pub fn InitOnceComplete( + lpInitOnce: LPINIT_ONCE, dwFlags: DWORD, lpContext: LPVOID, + ) -> BOOL; + pub fn InitOnceExecuteOnce( + InitOnce: PINIT_ONCE, InitFn: PINIT_ONCE_FN, Parameter: PVOID, Context: *mut LPVOID, + ) -> BOOL; + pub fn InitOnceInitialize(InitOnce: PINIT_ONCE); + pub fn InitializeConditionVariable(ConditionVariable: PCONDITION_VARIABLE); + pub fn InitializeContext( + Buffer: PVOID, ContextFlags: DWORD, Context: *mut PCONTEXT, ContextLength: PDWORD, + ) -> BOOL; + pub fn InitializeCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); + pub fn InitializeCriticalSectionAndSpinCount( + lpCriticalSection: LPCRITICAL_SECTION, dwSpinCount: DWORD, + ) -> BOOL; + pub fn InitializeCriticalSectionEx( + lpCriticalSection: LPCRITICAL_SECTION, dwSpinCount: DWORD, Flags: DWORD, + ) -> BOOL; + pub fn InitializeProcThreadAttributeList( + lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, dwAttributeCount: DWORD, dwFlags: DWORD, + lpSize: PSIZE_T, + ) -> BOOL; + pub fn InitializeSListHead(ListHead: PSLIST_HEADER); + pub fn InitializeSRWLock(SRWLock: PSRWLOCK); + pub fn InitializeSynchronizationBarrier( + lpBarrier: LPSYNCHRONIZATION_BARRIER, lTotalThreads: LONG, lSpinCount: LONG, + ) -> BOOL; + pub fn InstallELAMCertificateInfo(ELAMFile: HANDLE) -> BOOL; + #[cfg(target_arch = "x86")] + pub fn InterlockedCompareExchange( + Destination: *mut LONG, ExChange: LONG, Comperand: LONG, + ) -> LONG; + #[cfg(target_arch = "x86")] + pub fn InterlockedCompareExchange64( + Destination: *mut LONG64, ExChange: LONG64, Comperand: LONG64, + ) -> LONG64; + #[cfg(target_arch = "x86")] + pub fn InterlockedDecrement(Addend: *mut LONG) -> LONG; + #[cfg(target_arch = "x86")] + pub fn InterlockedExchange(Target: *mut LONG, Value: LONG) -> LONG; + #[cfg(target_arch = "x86")] + pub fn InterlockedExchangeAdd(Addend: *mut LONG, Value: LONG) -> LONG; + pub fn InterlockedFlushSList(ListHead: PSLIST_HEADER) -> PSLIST_ENTRY; + #[cfg(target_arch = "x86")] + pub fn InterlockedIncrement(Addend: *mut LONG) -> LONG; + pub fn InterlockedPopEntrySList(ListHead: PSLIST_HEADER) -> PSLIST_ENTRY; + pub fn InterlockedPushEntrySList( + ListHead: PSLIST_HEADER, ListEntry: PSLIST_ENTRY, + ) -> PSLIST_ENTRY; + pub fn InterlockedPushListSListEx( + ListHead: PSLIST_HEADER, List: PSLIST_ENTRY, ListEnd: PSLIST_ENTRY, Count: ULONG, + ) -> PSLIST_ENTRY; + pub fn IsBadCodePtr(lpfn: FARPROC) -> BOOL; + pub fn IsBadHugeReadPtr(lp: *const VOID, ucb: UINT_PTR) -> BOOL; + pub fn IsBadHugeWritePtr(lp: LPVOID, ucb: UINT_PTR) -> BOOL; + pub fn IsBadReadPtr(lp: *const VOID, ucb: UINT_PTR) -> BOOL; + pub fn IsBadStringPtrA(lpsz: LPCSTR, ucchMax: UINT_PTR) -> BOOL; + pub fn IsBadStringPtrW(lpsz: LPCWSTR, ucchMax: UINT_PTR) -> BOOL; + pub fn IsBadWritePtr(lp: LPVOID, ucb: UINT_PTR) -> BOOL; + pub fn IsDBCSLeadByte(TestChar: BYTE) -> BOOL; + pub fn IsDBCSLeadByteEx(CodePage: UINT, TestChar: BYTE) -> BOOL; + pub fn IsDebuggerPresent() -> BOOL; + pub fn IsNLSDefinedString( + Function: NLS_FUNCTION, dwFlags: DWORD, lpVersionInformation: LPNLSVERSIONINFO, + lpString: LPCWSTR, cchStr: INT, + ) -> BOOL; + pub fn IsNativeVhdBoot(NativeVhdBoot: PBOOL) -> BOOL; + pub fn IsNormalizedString(NormForm: NORM_FORM, lpString: LPCWSTR, cwLength: c_int) -> BOOL; + pub fn IsProcessCritical(hProcess: HANDLE, Critical: PBOOL) -> BOOL; + pub fn IsProcessInJob(ProcessHandle: HANDLE, JobHandle: HANDLE, Result: PBOOL) -> BOOL; + pub fn IsProcessorFeaturePresent(ProcessorFeature: DWORD) -> BOOL; + pub fn IsSystemResumeAutomatic() -> BOOL; + pub fn IsThreadAFiber() -> BOOL; + pub fn IsThreadpoolTimerSet(pti: PTP_TIMER) -> BOOL; + pub fn IsValidCodePage(CodePage: UINT) -> BOOL; + pub fn IsValidLanguageGroup(LanguageGroup: LGRPID, dwFlags: DWORD) -> BOOL; + pub fn IsValidLocale(Locale: LCID, dwFlags: DWORD) -> BOOL; + pub fn IsValidLocaleName(lpLocaleName: LPCWSTR) -> BOOL; + pub fn IsValidNLSVersion( + function: NLS_FUNCTION, lpLocaleName: LPCWSTR, lpVersionInformation: LPNLSVERSIONINFOEX, + ) -> BOOL; + pub fn IsWow64Process(hProcess: HANDLE, Wow64Process: PBOOL) -> BOOL; + pub fn K32EmptyWorkingSet(hProcess: HANDLE) -> BOOL; + pub fn K32EnumDeviceDrivers(lpImageBase: *mut LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) -> BOOL; + pub fn K32EnumPageFilesA( + pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID, + ) -> BOOL; + pub fn K32EnumPageFilesW( + pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID, + ) -> BOOL; + pub fn K32EnumProcessModules( + hProcess: HANDLE, lphModule: *mut HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, + ) -> BOOL; + pub fn K32EnumProcessModulesEx( + hProcess: HANDLE, lphModule: *mut HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, + dwFilterFlag: DWORD, + ) -> BOOL; + pub fn K32EnumProcesses( + lpidProcess: *mut DWORD, cb: DWORD, lpcbNeeded: LPDWORD, + ) -> BOOL; + pub fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) -> DWORD; + pub fn K32GetDeviceDriverBaseNameW( + ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) -> DWORD; + pub fn K32GetDeviceDriverFileNameW( + ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetMappedFileNameA( + hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetMappedFileNameW( + hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleBaseNameA( + hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleBaseNameW( + hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleFileNameExA( + hProcess: HANDLE, hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleFileNameExW( + hProcess: HANDLE, hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleInformation( + hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD, + ) -> BOOL; + pub fn K32GetPerformanceInfo( + pPerformanceInformation: PPERFORMANCE_INFORMATION, cb: DWORD, + ) -> BOOL; + pub fn K32GetProcessImageFileNameA( + hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetProcessImageFileNameW( + hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetProcessMemoryInfo( + Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD, + ) -> BOOL; + pub fn K32GetWsChanges( + hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD, + ) -> BOOL; + pub fn K32GetWsChangesEx( + hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: PDWORD, + ) -> BOOL; + pub fn K32InitializeProcessForWsWatch(hProcess: HANDLE) -> BOOL; + pub fn K32QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) -> BOOL; + pub fn K32QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) -> BOOL; + pub fn LCIDToLocaleName(Locale: LCID, lpName: LPWSTR, cchName: c_int, dwFlags: DWORD) -> c_int; + pub fn LCMapStringA( + Locale: LCID, dwMapFlags: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpDestStr: LPSTR, + cchDest: c_int, + ) -> c_int; + pub fn LCMapStringEx( + lpLocaleName: LPCWSTR, dwMapFlags: DWORD, lpSrcStr: LPCWSTR, cchSrc: c_int, + lpDestStr: LPWSTR, cchDest: c_int, lpVersionInformation: LPNLSVERSIONINFO, + lpReserved: LPVOID, sortHandle: LPARAM, + ) -> c_int; + pub fn LCMapStringW( + Locale: LCID, dwMapFlags: DWORD, lpSrcStr: LPCWSTR, cchSrc: c_int, lpDestStr: LPWSTR, + cchDest: c_int, + ) -> c_int; + pub fn LeaveCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); + pub fn LeaveCriticalSectionWhenCallbackReturns( + pci: PTP_CALLBACK_INSTANCE, pcs: PCRITICAL_SECTION, + ); + // pub fn LoadAppInitDlls(); + pub fn LoadLibraryA(lpFileName: LPCSTR) -> HMODULE; + pub fn LoadLibraryExA(lpLibFileName: LPCSTR, hFile: HANDLE, dwFlags: DWORD) -> HMODULE; + pub fn LoadLibraryExW(lpLibFileName: LPCWSTR, hFile: HANDLE, dwFlags: DWORD) -> HMODULE; + pub fn LoadLibraryW(lpFileName: LPCWSTR) -> HMODULE; + pub fn LoadModule(lpModuleName: LPCSTR, lpParameterBlock: LPVOID) -> DWORD; + pub fn LoadPackagedLibrary(lpwLibFileName: LPCWSTR, Reserved: DWORD) -> HMODULE; + pub fn LoadResource(hModule: HMODULE, hResInfo: HRSRC) -> HGLOBAL; + // pub fn LoadStringBaseExW(); + // pub fn LoadStringBaseW(); + pub fn LocalAlloc(uFlags: UINT, uBytes: SIZE_T) -> HLOCAL; + pub fn LocalCompact(uMinFree: UINT) -> SIZE_T; + pub fn LocalFileTimeToFileTime( + lpLocalFileTime: *const FILETIME, lpFileTime: LPFILETIME, + ) -> BOOL; + pub fn LocalFlags(hMem: HLOCAL) -> UINT; + pub fn LocalFree(hMem: HLOCAL) -> HLOCAL; + pub fn LocalHandle(pMem: LPCVOID) -> HLOCAL; + pub fn LocalLock(hMem: HLOCAL) -> LPVOID; + pub fn LocalReAlloc(hMem: HLOCAL, uBytes: SIZE_T, uFlags: UINT) -> HLOCAL; + pub fn LocalShrink(hMem: HLOCAL, cbNewSize: UINT) -> SIZE_T; + pub fn LocalSize(hMem: HLOCAL) -> SIZE_T; + pub fn LocalUnlock(hMem: HLOCAL) -> BOOL; + pub fn LocaleNameToLCID(lpName: LPCWSTR, dwFlags: DWORD) -> LCID; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn LocateXStateFeature(Context: PCONTEXT, FeatureId: DWORD, Length: PDWORD) -> PVOID; + pub fn LockFile( + hFile: HANDLE, dwFileOffsetLow: DWORD, dwFileOffsetHigh: DWORD, + nNumberOfBytesToLockLow: DWORD, nNumberOfBytesToLockHigh: DWORD, + ) -> BOOL; + pub fn LockFileEx( + hFile: HANDLE, dwFlags: DWORD, dwReserved: DWORD, nNumberOfBytesToLockLow: DWORD, + nNumberOfBytesToLockHigh: DWORD, lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn LockResource(hResData: HGLOBAL) -> LPVOID; + pub fn MapUserPhysicalPages( + VirtualAddress: PVOID, NumberOfPages: ULONG_PTR, PageArray: PULONG_PTR, + ) -> BOOL; + pub fn MapUserPhysicalPagesScatter( + VirtualAddresses: *mut PVOID, NumberOfPages: ULONG_PTR, PageArray: PULONG_PTR, + ) -> BOOL; + pub fn MapViewOfFile( + hFileMappingObject: HANDLE, dwDesiredAccess: DWORD, dwFileOffsetHigh: DWORD, + dwFileOffsetLow: DWORD, dwNumberOfBytesToMap: SIZE_T, + ) -> LPVOID; + pub fn MapViewOfFileEx( + hFileMappingObject: HANDLE, dwDesiredAccess: DWORD, dwFileOffsetHigh: DWORD, + dwFileOffsetLow: DWORD, dwNumberOfBytesToMap: SIZE_T, lpBaseAddress: LPVOID, + ) -> LPVOID; + pub fn MapViewOfFileExNuma( + hFileMappingObject: HANDLE, dwDesiredAccess: DWORD, dwFileOffsetHigh: DWORD, + dwFileOffsetLow: DWORD, dwNumberOfBytesToMap: SIZE_T, lpBaseAddress: LPVOID, + nndPreferred: DWORD, + ) -> LPVOID; + pub fn MapViewOfFileFromApp( + hFileMappingObject: HANDLE, DesiredAccess: ULONG, FileOffset: ULONG64, + NumberOfBytesToMap: SIZE_T, + ) -> PVOID; + pub fn Module32First(hSnapshot: HANDLE, lpme: LPMODULEENTRY32) -> BOOL; + pub fn Module32FirstW(hSnapshot: HANDLE, lpme: LPMODULEENTRY32W) -> BOOL; + pub fn Module32Next(hSnapshot: HANDLE, lpme: LPMODULEENTRY32) -> BOOL; + pub fn Module32NextW(hSnapshot: HANDLE, lpme: LPMODULEENTRY32W) -> BOOL; + pub fn MoveFileA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR) -> BOOL; + pub fn MoveFileExA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, dwFlags: DWORD) -> BOOL; + pub fn MoveFileExW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, dwFlags: DWORD) -> BOOL; + pub fn MoveFileTransactedA( + lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, dwFlags: DWORD, hTransaction: HANDLE, + ) -> BOOL; + pub fn MoveFileTransactedW( + lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, dwFlags: DWORD, hTransaction: HANDLE, + ) -> BOOL; + pub fn MoveFileW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR) -> BOOL; + pub fn MoveFileWithProgressA( + lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, dwFlags: DWORD, + ) -> BOOL; + pub fn MoveFileWithProgressW( + lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, dwFlags: DWORD, + ) -> BOOL; + pub fn MulDiv(nNumber: c_int, nNumerator: c_int, nDenominator: c_int) -> c_int; + pub fn MultiByteToWideChar( + CodePage: UINT, dwFlags: DWORD, lpMultiByteStr: LPCSTR, cbMultiByte: c_int, + lpWideCharStr: LPWSTR, cchWideChar: c_int, + ) -> c_int; + pub fn NeedCurrentDirectoryForExePathA(ExeName: LPCSTR) -> BOOL; + pub fn NeedCurrentDirectoryForExePathW(ExeName: LPCWSTR) -> BOOL; + pub fn NormalizeString( + NormForm: NORM_FORM, lpSrcString: LPCWSTR, cwSrcLength: c_int, lpDstString: LPWSTR, + cwDstLength: c_int, + ) -> c_int; + // pub fn NotifyMountMgr(); + pub fn NotifyUILanguageChange( + dwFlags: DWORD, pcwstrNewLanguage: PCWSTR, pcwstrPreviousLanguage: PCWSTR, + dwReserved: DWORD, pdwStatusRtrn: PDWORD, + ) -> BOOL; + // pub fn OOBEComplete(); + pub fn OpenEventA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; + pub fn OpenEventW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; + pub fn OpenFile(lpFileName: LPCSTR, lpReOpenBuff: LPOFSTRUCT, uStyle: UINT) -> HFILE; + pub fn OpenFileById( + hVolumeHint: HANDLE, lpFileId: LPFILE_ID_DESCRIPTOR, dwDesiredAccess: DWORD, + dwShareMode: DWORD, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + dwFlagsAndAttributes: DWORD, + ) -> HANDLE; + pub fn OpenFileMappingA( + dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR, + ) -> HANDLE; + pub fn OpenFileMappingW( + dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR, + ) -> HANDLE; + pub fn OpenJobObjectA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; + pub fn OpenJobObjectW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; + pub fn OpenMutexA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; + pub fn OpenMutexW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; + // pub fn OpenPackageInfoByFullName(); + pub fn OpenPrivateNamespaceA(lpBoundaryDescriptor: LPVOID, lpAliasPrefix: LPCSTR) -> HANDLE; + pub fn OpenPrivateNamespaceW(lpBoundaryDescriptor: LPVOID, lpAliasPrefix: LPCWSTR) -> HANDLE; + pub fn OpenProcess(dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwProcessId: DWORD) -> HANDLE; + pub fn OpenSemaphoreA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; + pub fn OpenSemaphoreW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; + // pub fn OpenState(); + // pub fn OpenStateExplicit(); + pub fn OpenThread(dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwThreadId: DWORD) -> HANDLE; + pub fn OpenWaitableTimerA( + dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpTimerName: LPCSTR, + ) -> HANDLE; + pub fn OpenWaitableTimerW( + dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpTimerName: LPCWSTR, + ) -> HANDLE; + pub fn OutputDebugStringA(lpOutputString: LPCSTR); + pub fn OutputDebugStringW(lpOutputString: LPCWSTR); + // pub fn PackageFamilyNameFromFullName(); + // pub fn PackageFamilyNameFromId(); + // pub fn PackageFullNameFromId(); + // pub fn PackageIdFromFullName(); + // pub fn PackageNameAndPublisherIdFromFamilyName(); + // pub fn ParseApplicationUserModelId(); + pub fn PeekConsoleInputA( + hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn PeekConsoleInputW( + hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn PeekNamedPipe( + hNamedPipe: HANDLE, lpBuffer: LPVOID, nBufferSize: DWORD, lpBytesRead: LPDWORD, + lpTotalBytesAvail: LPDWORD, lpBytesLeftThisMessage: LPDWORD, + ) -> BOOL; + pub fn PostQueuedCompletionStatus( + CompletionPort: HANDLE, dwNumberOfBytesTransferred: DWORD, dwCompletionKey: ULONG_PTR, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn PowerClearRequest(PowerRequest: HANDLE, RequestType: POWER_REQUEST_TYPE) -> BOOL; + pub fn PowerCreateRequest(Context: PREASON_CONTEXT) -> HANDLE; + pub fn PowerSetRequest(PowerRequest: HANDLE, RequestType: POWER_REQUEST_TYPE) -> BOOL; + pub fn PrefetchVirtualMemory( + hProcess: HANDLE, NumberOfEntries: ULONG_PTR, VirtualAddresses: PWIN32_MEMORY_RANGE_ENTRY, + Flags: ULONG, + ) -> BOOL; + pub fn PrepareTape(hDevice: HANDLE, dwOperation: DWORD, bImmediate: BOOL) -> DWORD; + pub fn Process32First(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32) -> BOOL; + pub fn Process32FirstW(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32W) -> BOOL; + pub fn Process32Next(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32) -> BOOL; + pub fn Process32NextW(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32W) -> BOOL; + pub fn ProcessIdToSessionId(dwProcessId: DWORD, pSessionId: *mut DWORD) -> BOOL; + pub fn PssCaptureSnapshot( + ProcessHandle: HANDLE, CaptureFlags: PSS_CAPTURE_FLAGS, ThreadContextFlags: DWORD, + SnapshotHandle: *mut HPSS, + ) -> DWORD; + pub fn PssDuplicateSnapshot( + SourceProcessHandle: HANDLE, SnapshotHandle: HPSS, TargetProcessHandle: HANDLE, + TargetSnapshotHandle: *mut HPSS, Flags: PSS_DUPLICATE_FLAGS, + ) -> DWORD; + pub fn PssFreeSnapshot(ProcessHandle: HANDLE, SnapshotHandle: HPSS) -> DWORD; + pub fn PssQuerySnapshot( + SnapshotHandle: HPSS, InformationClass: PSS_QUERY_INFORMATION_CLASS, Buffer: *mut c_void, + BufferLength: DWORD, + ) -> DWORD; + pub fn PssWalkMarkerCreate( + Allocator: *const PSS_ALLOCATOR, WalkMarkerHandle: *mut HPSSWALK, + ) -> DWORD; + pub fn PssWalkMarkerFree(WalkMarkerHandle: HPSSWALK) -> DWORD; + pub fn PssWalkMarkerGetPosition(WalkMarkerHandle: HPSSWALK, Position: *mut ULONG_PTR) -> DWORD; + // pub fn PssWalkMarkerRewind(); + // pub fn PssWalkMarkerSeek(); + pub fn PssWalkMarkerSeekToBeginning(WalkMarkerHandle: HPSS) -> DWORD; + pub fn PssWalkMarkerSetPosition(WalkMarkerHandle: HPSSWALK, Position: ULONG_PTR) -> DWORD; + // pub fn PssWalkMarkerTell(); + pub fn PssWalkSnapshot( + SnapshotHandle: HPSS, InformationClass: PSS_WALK_INFORMATION_CLASS, + WalkMarkerHandle: HPSSWALK, Buffer: *mut c_void, BufferLength: DWORD, + ) -> DWORD; + pub fn PulseEvent(hEvent: HANDLE) -> BOOL; + pub fn PurgeComm(hFile: HANDLE, dwFlags: DWORD) -> BOOL; + pub fn QueryActCtxSettingsW( + dwFlags: DWORD, hActCtx: HANDLE, settingsNameSpace: PCWSTR, settingName: PCWSTR, + pvBuffer: PWSTR, dwBuffer: SIZE_T, pdwWrittenOrRequired: *mut SIZE_T, + ) -> BOOL; + pub fn QueryActCtxW( + dwFlags: DWORD, hActCtx: HANDLE, pvSubInstance: PVOID, ulInfoClass: ULONG, pvBuffer: PVOID, + cbBuffer: SIZE_T, pcbWrittenOrRequired: *mut SIZE_T, + ) -> BOOL; + pub fn QueryDepthSList(ListHead: PSLIST_HEADER) -> USHORT; + pub fn QueryDosDeviceA(lpDeviceName: LPCSTR, lpTargetPath: LPSTR, ucchMax: DWORD) -> DWORD; + pub fn QueryDosDeviceW(lpDeviceName: LPCWSTR, lpTargetPath: LPWSTR, ucchMax: DWORD) -> DWORD; + pub fn QueryFullProcessImageNameA( + hProcess: HANDLE, dwFlags: DWORD, lpExeName: LPSTR, lpdwSize: PDWORD, + ) -> BOOL; + pub fn QueryFullProcessImageNameW( + hProcess: HANDLE, dwFlags: DWORD, lpExeName: LPWSTR, lpdwSize: PDWORD, + ) -> BOOL; + pub fn QueryIdleProcessorCycleTime( + BufferLength: PULONG, ProcessorIdleCycleTime: PULONG64, + ) -> BOOL; + pub fn QueryIdleProcessorCycleTimeEx( + Group: USHORT, BufferLength: PULONG, ProcessorIdleCycleTime: PULONG64, + ) -> BOOL; + pub fn QueryInformationJobObject( + hJob: HANDLE, JobObjectInformationClass: JOBOBJECTINFOCLASS, + lpJobObjectInformation: LPVOID, cbJobObjectInformationLength: DWORD, + lpReturnLength: LPDWORD, + ) -> BOOL; + pub fn QueryMemoryResourceNotification( + ResourceNotificationHandle: HANDLE, ResourceState: PBOOL, + ) -> BOOL; + pub fn QueryPerformanceCounter(lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL; + pub fn QueryPerformanceFrequency(lpFrequency: *mut LARGE_INTEGER) -> BOOL; + pub fn QueryProcessAffinityUpdateMode(hProcess: HANDLE, lpdwFlags: LPDWORD) -> BOOL; + pub fn QueryProcessCycleTime(ProcessHandle: HANDLE, CycleTime: PULONG64) -> BOOL; + pub fn QueryProtectedPolicy(PolicyGuid: LPCGUID, PolicyValue: PULONG_PTR) -> BOOL; + pub fn QueryThreadCycleTime(ThreadHandle: HANDLE, CycleTime: PULONG64) -> BOOL; + pub fn QueryThreadProfiling(ThreadHandle: HANDLE, Enabled: PBOOLEAN) -> DWORD; + pub fn QueryThreadpoolStackInformation( + ptpp: PTP_POOL, ptpsi: PTP_POOL_STACK_INFORMATION, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn QueryUmsThreadInformation( + UmsThread: PUMS_CONTEXT, UmsThreadInfoClass: UMS_THREAD_INFO_CLASS, + UmsThreadInformation: PVOID, UmsThreadInformationLength: ULONG, ReturnLength: PULONG, + ) -> BOOL; + pub fn QueryUnbiasedInterruptTime(UnbiasedTime: PULONGLONG) -> BOOL; + pub fn QueueUserAPC(pfnAPC: PAPCFUNC, hThread: HANDLE, dwData: ULONG_PTR) -> DWORD; + pub fn QueueUserWorkItem( + Function: LPTHREAD_START_ROUTINE, Context: PVOID, Flags: ULONG, + ) -> BOOL; + pub fn RaiseException( + dwExceptionCode: DWORD, dwExceptionFlags: DWORD, nNumberOfArguments: DWORD, + lpArguments: *const ULONG_PTR, + ); + pub fn RaiseFailFastException( + pExceptionRecord: PEXCEPTION_RECORD, pContextRecord: PCONTEXT, dwFlags: DWORD, + ); + pub fn ReOpenFile( + hOriginalFile: HANDLE, dwDesiredAccess: DWORD, dwShareMode: DWORD, dwFlags: DWORD, + ) -> HANDLE; + pub fn ReadConsoleA( + hConsoleInput: HANDLE, lpBuffer: LPVOID, nNumberOfCharsToRead: DWORD, + lpNumberOfCharsRead: LPDWORD, pInputControl: PCONSOLE_READCONSOLE_CONTROL, + ) -> BOOL; + pub fn ReadConsoleInputA( + hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleInputW( + hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleOutputA( + hConsoleOutput: HANDLE, lpBuffer: PCHAR_INFO, dwBufferSize: COORD, dwBufferCoord: COORD, + lpReadRegion: PSMALL_RECT, + ) -> BOOL; + pub fn ReadConsoleOutputAttribute( + hConsoleOutput: HANDLE, lpAttribute: LPWORD, nLength: DWORD, dwReadCoord: COORD, + lpNumberOfAttrsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleOutputCharacterA( + hConsoleOutput: HANDLE, lpCharacter: LPSTR, nLength: DWORD, dwReadCoord: COORD, + lpNumberOfCharsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleOutputCharacterW( + hConsoleOutput: HANDLE, lpCharacter: LPWSTR, nLength: DWORD, dwReadCoord: COORD, + lpNumberOfCharsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleOutputW( + hConsoleOutput: HANDLE, lpBuffer: PCHAR_INFO, dwBufferSize: COORD, dwBufferCoord: COORD, + lpReadRegion: PSMALL_RECT, + ) -> BOOL; + pub fn ReadConsoleW( + hConsoleInput: HANDLE, lpBuffer: LPVOID, nNumberOfCharsToRead: DWORD, + lpNumberOfCharsRead: LPDWORD, pInputControl: PCONSOLE_READCONSOLE_CONTROL, + ) -> BOOL; + pub fn ReadDirectoryChangesW( + hDirectory: HANDLE, lpBuffer: LPVOID, nBufferLength: DWORD, bWatchSubtree: BOOL, + dwNotifyFilter: DWORD, lpBytesReturned: LPDWORD, lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; + pub fn ReadFile( + hFile: HANDLE, lpBuffer: LPVOID, nNumberOfBytesToRead: DWORD, lpNumberOfBytesRead: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn ReadFileEx( + hFile: HANDLE, lpBuffer: LPVOID, nNumberOfBytesToRead: DWORD, lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; + pub fn ReadFileScatter( + hFile: HANDLE, aSegmentArray: *mut FILE_SEGMENT_ELEMENT, nNumberOfBytesToRead: DWORD, + lpReserved: LPDWORD, lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn ReadProcessMemory( + hProcess: HANDLE, lpBaseAddress: LPCVOID, lpBuffer: LPVOID, nSize: SIZE_T, + lpNumberOfBytesRead: *mut SIZE_T, + ) -> BOOL; + pub fn ReadThreadProfilingData( + PerformanceDataHandle: HANDLE, Flags: DWORD, PerformanceData: PPERFORMANCE_DATA, + ) -> DWORD; + pub fn RegisterApplicationRecoveryCallback( + pRecoveyCallback: APPLICATION_RECOVERY_CALLBACK, pvParameter: PVOID, dwPingInterval: DWORD, + dwFlags: DWORD, + ) -> HRESULT; + pub fn RegisterApplicationRestart(pwzCommandline: PCWSTR, dwFlags: DWORD) -> HRESULT; + pub fn RegisterBadMemoryNotification(Callback: PBAD_MEMORY_CALLBACK_ROUTINE) -> PVOID; + // pub fn RegisterWaitForInputIdle(); + pub fn RegisterWaitForSingleObject( + phNewWaitObject: PHANDLE, hObject: HANDLE, Callback: WAITORTIMERCALLBACK, Context: PVOID, + dwMilliseconds: ULONG, dwFlags: ULONG, + ) -> BOOL; + pub fn RegisterWaitForSingleObjectEx( + hObject: HANDLE, Callback: WAITORTIMERCALLBACK, Context: PVOID, dwMilliseconds: ULONG, + dwFlags: ULONG, + ) -> HANDLE; + // pub fn RegisterWaitUntilOOBECompleted(); + pub fn ReleaseActCtx(hActCtx: HANDLE); + pub fn ReleaseMutex(hMutex: HANDLE) -> BOOL; + pub fn ReleaseMutexWhenCallbackReturns(pci: PTP_CALLBACK_INSTANCE, mutex: HANDLE); + pub fn ReleaseSRWLockExclusive(SRWLock: PSRWLOCK); + pub fn ReleaseSRWLockShared(SRWLock: PSRWLOCK); + pub fn ReleaseSemaphore( + hSemaphore: HANDLE, lReleaseCount: LONG, lpPreviousCount: LPLONG, + ) -> BOOL; + pub fn ReleaseSemaphoreWhenCallbackReturns( + pci: PTP_CALLBACK_INSTANCE, sem: HANDLE, crel: DWORD, + ); + pub fn RemoveDirectoryA(lpPathName: LPCSTR) -> BOOL; + pub fn RemoveDirectoryTransactedA(lpPathName: LPCSTR, hTransaction: HANDLE) -> BOOL; + pub fn RemoveDirectoryTransactedW(lpPathName: LPCWSTR, hTransaction: HANDLE) -> BOOL; + pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL; + pub fn RemoveDllDirectory(Cookie: DLL_DIRECTORY_COOKIE) -> BOOL; + // pub fn RemoveLocalAlternateComputerNameA(); + // pub fn RemoveLocalAlternateComputerNameW(); + pub fn RemoveSecureMemoryCacheCallback(pfnCallBack: PSECURE_MEMORY_CACHE_CALLBACK) -> BOOL; + pub fn RemoveVectoredContinueHandler(Handle: PVOID) -> ULONG; + pub fn RemoveVectoredExceptionHandler(Handle: PVOID) -> ULONG; + pub fn ReplaceFileA( + lpReplacedFileName: LPCSTR, lpReplacementFileName: LPCSTR, lpBackupFileName: LPCSTR, + dwReplaceFlags: DWORD, lpExclude: LPVOID, lpReserved: LPVOID, + ); + pub fn ReplaceFileW( + lpReplacedFileName: LPCWSTR, lpReplacementFileName: LPCWSTR, lpBackupFileName: LPCWSTR, + dwReplaceFlags: DWORD, lpExclude: LPVOID, lpReserved: LPVOID, + ); + pub fn ReplacePartitionUnit( + TargetPartition: PWSTR, SparePartition: PWSTR, Flags: ULONG, + ) -> BOOL; + pub fn RequestDeviceWakeup(hDevice: HANDLE) -> BOOL; + pub fn RequestWakeupLatency(latency: LATENCY_TIME) -> BOOL; + pub fn ResetEvent(hEvent: HANDLE) -> BOOL; + pub fn ResetWriteWatch(lpBaseAddress: LPVOID, dwRegionSize: SIZE_T) -> UINT; + // pub fn ResolveDelayLoadedAPI(); + // pub fn ResolveDelayLoadsFromDll(); + pub fn ResolveLocaleName( + lpNameToResolve: LPCWSTR, lpLocaleName: LPWSTR, cchLocaleName: c_int, + ) -> c_int; + pub fn RestoreLastError(dwErrCode: DWORD); + pub fn ResumeThread(hThread: HANDLE) -> DWORD; + #[cfg(target_arch = "arm")] + pub fn RtlAddFunctionTable( + FunctionTable: PRUNTIME_FUNCTION, EntryCount: DWORD, BaseAddress: DWORD, + ) -> BOOLEAN; + #[cfg(target_arch = "x86_64")] + pub fn RtlAddFunctionTable( + FunctionTable: PRUNTIME_FUNCTION, EntryCount: DWORD, BaseAddress: DWORD64, + ) -> BOOLEAN; + pub fn RtlCaptureContext(ContextRecord: PCONTEXT); + pub fn RtlCaptureStackBackTrace( + FramesToSkip: DWORD, FramesToCapture: DWORD, BackTrace: *mut PVOID, BackTraceHash: PDWORD, + ) -> WORD; + // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn RtlCompareMemory(Source1: *const VOID, Source2: *const VOID, Length: SIZE_T) -> SIZE_T; + // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn RtlCopyMemory(Destination: PVOID, Source: *const VOID, Length: SIZE_T); + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn RtlDeleteFunctionTable(FunctionTable: PRUNTIME_FUNCTION) -> BOOLEAN; + // pub fn RtlFillMemory(); + #[cfg(target_arch = "arm")] + pub fn RtlInstallFunctionTableCallback( + TableIdentifier: DWORD, BaseAddress: DWORD, Length: DWORD, + Callback: PGET_RUNTIME_FUNCTION_CALLBACK, Context: PVOID, OutOfProcessCallbackDll: PCWSTR, + ) -> BOOLEAN; + #[cfg(target_arch = "x86_64")] + pub fn RtlInstallFunctionTableCallback( + TableIdentifier: DWORD64, BaseAddress: DWORD64, Length: DWORD, + Callback: PGET_RUNTIME_FUNCTION_CALLBACK, Context: PVOID, OutOfProcessCallbackDll: PCWSTR, + ) -> BOOLEAN; + #[cfg(target_arch = "arm")] + pub fn RtlLookupFunctionEntry( + ControlPc: ULONG_PTR, ImageBase: PDWORD, HistoryTable: PUNWIND_HISTORY_TABLE, + ) -> PRUNTIME_FUNCTION; + #[cfg(target_arch = "x86_64")] + pub fn RtlLookupFunctionEntry( + ControlPc: DWORD64, ImageBase: PDWORD64, HistoryTable: PUNWIND_HISTORY_TABLE, + ) -> PRUNTIME_FUNCTION; + // pub fn RtlMoveMemory(); + // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn RtlPcToFileHeader(PcValue: PVOID, BaseOfImage: *mut PVOID) -> PVOID; + // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + // pub fn RtlRaiseException(); + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn RtlRestoreContext(ContextRecord: PCONTEXT, ExceptionRecord: *mut EXCEPTION_RECORD); + pub fn RtlUnwind( + TargetFrame: PVOID, TargetIp: PVOID, ExceptionRecord: PEXCEPTION_RECORD, ReturnValue: PVOID, + ); + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn RtlUnwindEx( + TargetFrame: PVOID, TargetIp: PVOID, ExceptionRecord: PEXCEPTION_RECORD, ReturnValue: PVOID, + ContextRecord: PCONTEXT, HistoryTable: PUNWIND_HISTORY_TABLE, + ); + #[cfg(target_arch = "arm")] + pub fn RtlVirtualUnwind( + HandlerType: DWORD, ImageBase: DWORD, ControlPc: DWORD, FunctionEntry: PRUNTIME_FUNCTION, + ContextRecord: PCONTEXT, HandlerData: *mut PVOID, EstablisherFrame: PDWORD, + ContextPointers: PKNONVOLATILE_CONTEXT_POINTERS, + ) -> PEXCEPTION_ROUTINE; + #[cfg(target_arch = "x86_64")] + pub fn RtlVirtualUnwind( + HandlerType: DWORD, ImageBase: DWORD64, ControlPc: DWORD64, + FunctionEntry: PRUNTIME_FUNCTION, ContextRecord: PCONTEXT, HandlerData: *mut PVOID, + EstablisherFrame: PDWORD64, ContextPointers: PKNONVOLATILE_CONTEXT_POINTERS, + ) -> PEXCEPTION_ROUTINE; + // pub fn RtlZeroMemory(); + pub fn ScrollConsoleScreenBufferA( + hConsoleOutput: HANDLE, lpScrollRectangle: *const SMALL_RECT, + lpClipRectangle: *const SMALL_RECT, dwDestinationOrigin: COORD, lpFill: *const CHAR_INFO, + ) -> BOOL; + pub fn ScrollConsoleScreenBufferW( + hConsoleOutput: HANDLE, lpScrollRectangle: *const SMALL_RECT, + lpClipRectangle: *const SMALL_RECT, dwDestinationOrigin: COORD, lpFill: *const CHAR_INFO, + ) -> BOOL; + pub fn SearchPathA( + lpPath: LPCSTR, lpFileName: LPCSTR, lpExtension: LPCSTR, nBufferLength: DWORD, + lpBuffer: LPSTR, lpFilePart: *mut LPSTR, + ) -> DWORD; + pub fn SearchPathW( + lpPath: LPCWSTR, lpFileName: LPCWSTR, lpExtension: LPCWSTR, nBufferLength: DWORD, + lpBuffer: LPWSTR, lpFilePart: *mut LPWSTR, + ) -> DWORD; + pub fn SetCachedSigningLevel( + SourceFiles: PHANDLE, SourceFileCount: ULONG, Flags: ULONG, TargetFile: HANDLE, + ) -> BOOL; + pub fn SetCalendarInfoA( + Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPCSTR, + ) -> BOOL; + pub fn SetCalendarInfoW( + Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPCWSTR, + ) -> BOOL; + pub fn SetCommBreak(hFile: HANDLE) -> BOOL; + pub fn SetCommConfig(hCommDev: HANDLE, lpCC: LPCOMMCONFIG, dwSize: DWORD) -> BOOL; + pub fn SetCommMask(hFile: HANDLE, dwEvtMask: DWORD) -> BOOL; + pub fn SetCommState(hFile: HANDLE, lpDCB: LPDCB) -> BOOL; + pub fn SetCommTimeouts(hFile: HANDLE, lpCommTimeouts: LPCOMMTIMEOUTS) -> BOOL; + pub fn SetComputerNameA(lpComputerName: LPCSTR) -> BOOL; + pub fn SetComputerNameEx2W( + NameType: COMPUTER_NAME_FORMAT, Flags: DWORD, lpBuffer: LPCWSTR, + ) -> BOOL; + pub fn SetComputerNameExA(NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPCSTR) -> BOOL; + pub fn SetComputerNameExW(NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPCWSTR) -> BOOL; + pub fn SetComputerNameW(lpComputerName: LPCWSTR) -> BOOL; + pub fn SetConsoleActiveScreenBuffer(hConsoleOutput: HANDLE) -> BOOL; + pub fn SetConsoleCP(wCodePageID: UINT) -> BOOL; + pub fn SetConsoleCtrlHandler(HandlerRoutine: PHANDLER_ROUTINE, Add: BOOL) -> BOOL; + // pub fn SetConsoleCursor(); + pub fn SetConsoleCursorInfo( + hConsoleOutput: HANDLE, lpConsoleCursorInfo: *const CONSOLE_CURSOR_INFO, + ) -> BOOL; + pub fn SetConsoleCursorPosition(hConsoleOutput: HANDLE, dwCursorPosition: COORD) -> BOOL; + pub fn SetConsoleDisplayMode( + hConsoleOutput: HANDLE, dwFlags: DWORD, lpNewScreenBufferDimensions: PCOORD, + ) -> BOOL; + pub fn SetConsoleHistoryInfo(lpConsoleHistoryInfo: PCONSOLE_HISTORY_INFO) -> BOOL; + pub fn SetConsoleMode(hConsoleHandle: HANDLE, dwMode: DWORD) -> BOOL; + pub fn SetConsoleOutputCP(wCodePageID: UINT) -> BOOL; + pub fn SetConsoleScreenBufferInfoEx( + hConsoleOutput: HANDLE, lpConsoleScreenBufferInfoEx: PCONSOLE_SCREEN_BUFFER_INFOEX, + ) -> BOOL; + pub fn SetConsoleScreenBufferSize(hConsoleOutput: HANDLE, dwSize: COORD) -> BOOL; + pub fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) -> BOOL; + pub fn SetConsoleTitleA(lpConsoleTitle: LPCSTR) -> BOOL; + pub fn SetConsoleTitleW(lpConsoleTitle: LPCWSTR) -> BOOL; + pub fn SetConsoleWindowInfo( + hConsoleOutput: HANDLE, bAbsolute: BOOL, lpConsoleWindow: *const SMALL_RECT, + ) -> BOOL; + pub fn SetCriticalSectionSpinCount( + lpCriticalSection: LPCRITICAL_SECTION, dwSpinCount: DWORD, + ) -> DWORD; + pub fn SetCurrentConsoleFontEx( + hConsoleOutput: HANDLE, bMaximumWindow: BOOL, lpConsoleCurrentFontEx: PCONSOLE_FONT_INFOEX, + ) -> BOOL; + pub fn SetCurrentDirectoryA(lpPathName: LPCSTR) -> BOOL; + pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL; + pub fn SetDefaultCommConfigA(lpszName: LPCSTR, lpCC: LPCOMMCONFIG, dwSize: DWORD) -> BOOL; + pub fn SetDefaultCommConfigW(lpszName: LPCWSTR, lpCC: LPCOMMCONFIG, dwSize: DWORD) -> BOOL; + pub fn SetDefaultDllDirectories(DirectoryFlags: DWORD) -> BOOL; + pub fn SetDllDirectoryA(lpPathName: LPCSTR) -> BOOL; + pub fn SetDllDirectoryW(lpPathName: LPCWSTR) -> BOOL; + pub fn SetDynamicTimeZoneInformation( + lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, + ) -> BOOL; + pub fn SetEndOfFile(hFile: HANDLE) -> BOOL; + pub fn SetEnvironmentStringsA(NewEnvironment: LPCH) -> BOOL; + pub fn SetEnvironmentStringsW(NewEnvironment: LPWCH) -> BOOL; + pub fn SetEnvironmentVariableA(lpName: LPCSTR, lpValue: LPCSTR) -> BOOL; + pub fn SetEnvironmentVariableW(lpName: LPCWSTR, lpValue: LPCWSTR) -> BOOL; + pub fn SetErrorMode(uMode: UINT) -> UINT; + pub fn SetEvent(hEvent: HANDLE) -> BOOL; + pub fn SetEventWhenCallbackReturns(pci: PTP_CALLBACK_INSTANCE, evt: HANDLE); + pub fn SetFileApisToANSI(); + pub fn SetFileApisToOEM(); + pub fn SetFileAttributesA(lpFileName: LPCSTR, dwFileAttributes: DWORD) -> BOOL; + pub fn SetFileAttributesTransactedA( + lpFileName: LPCSTR, dwFileAttributes: DWORD, hTransaction: HANDLE, + ) -> BOOL; + pub fn SetFileAttributesTransactedW( + lpFileName: LPCWSTR, dwFileAttributes: DWORD, hTransaction: HANDLE, + ) -> BOOL; + pub fn SetFileAttributesW(lpFileName: LPCWSTR, dwFileAttributes: DWORD) -> BOOL; + pub fn SetFileBandwidthReservation( + hFile: HANDLE, nPeriodMilliseconds: DWORD, nBytesPerPeriod: DWORD, bDiscardable: BOOL, + lpTransferSize: LPDWORD, lpNumOutstandingRequests: LPDWORD, + ) -> BOOL; + pub fn SetFileCompletionNotificationModes(FileHandle: HANDLE, Flags: UCHAR) -> BOOL; + pub fn SetFileInformationByHandle( + hFile: HANDLE, FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, lpFileInformation: LPVOID, + dwBufferSize: DWORD, + ) -> BOOL; + pub fn SetFileIoOverlappedRange( + FileHandle: HANDLE, OverlappedRangeStart: PUCHAR, Length: ULONG, + ) -> BOOL; + pub fn SetFilePointer( + hFile: HANDLE, lDistanceToMove: LONG, lpDistanceToMoveHigh: PLONG, dwMoveMethod: DWORD, + ) -> DWORD; + pub fn SetFilePointerEx( + hFile: HANDLE, liDistanceToMove: LARGE_INTEGER, lpNewFilePointer: PLARGE_INTEGER, + dwMoveMethod: DWORD, + ) -> BOOL; + pub fn SetFileShortNameA(hFile: HANDLE, lpShortName: LPCSTR) -> BOOL; + pub fn SetFileShortNameW(hFile: HANDLE, lpShortName: LPCWSTR) -> BOOL; + pub fn SetFileTime( + hFile: HANDLE, lpCreationTime: *const FILETIME, lpLastAccessTime: *const FILETIME, + lpLastWriteTime: *const FILETIME, + ) -> BOOL; + pub fn SetFileValidData(hFile: HANDLE, ValidDataLength: LONGLONG) -> BOOL; + pub fn SetFirmwareEnvironmentVariableA( + lpName: LPCSTR, lpGuid: LPCSTR, pValue: PVOID, nSize: DWORD, + ) -> BOOL; + pub fn SetFirmwareEnvironmentVariableExA( + lpName: LPCSTR, lpGuid: LPCSTR, pValue: PVOID, nSize: DWORD, dwAttributes: DWORD, + ) -> BOOL; + pub fn SetFirmwareEnvironmentVariableExW( + lpName: LPCWSTR, lpGuid: LPCWSTR, pValue: PVOID, nSize: DWORD, dwAttributes: DWORD, + ) -> BOOL; + pub fn SetFirmwareEnvironmentVariableW( + lpName: LPCWSTR, lpGuid: LPCWSTR, pValue: PVOID, nSize: DWORD, + ) -> BOOL; + pub fn SetHandleCount(uNumber: UINT) -> UINT; + pub fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) -> BOOL; + pub fn SetInformationJobObject( + hJob: HANDLE, JobObjectInformationClass: JOBOBJECTINFOCLASS, + lpJobObjectInformation: LPVOID, cbJobObjectInformationLength: DWORD, + ) -> BOOL; + pub fn SetLastError(dwErrCode: DWORD); + // pub fn SetLocalPrimaryComputerNameA(); + // pub fn SetLocalPrimaryComputerNameW(); + pub fn SetLocalTime(lpSystemTime: *const SYSTEMTIME) -> BOOL; + pub fn SetLocaleInfoA(Locale: LCID, LCType: LCTYPE, lpLCData: LPCSTR) -> BOOL; + pub fn SetLocaleInfoW(Locale: LCID, LCType: LCTYPE, lpLCData: LPCWSTR) -> BOOL; + pub fn SetMailslotInfo(hMailslot: HANDLE, lReadTimeout: DWORD) -> BOOL; + pub fn SetMessageWaitingIndicator(hMsgIndicator: HANDLE, ulMsgCount: ULONG) -> BOOL; + pub fn SetNamedPipeAttribute( + Pipe: HANDLE, AttributeType: PIPE_ATTRIBUTE_TYPE, AttributeName: PSTR, + AttributeValue: PVOID, AttributeValueLength: SIZE_T, + ) -> BOOL; + pub fn SetNamedPipeHandleState( + hNamedPipe: HANDLE, lpMode: LPDWORD, lpMaxCollectionCount: LPDWORD, + lpCollectDataTimeout: LPDWORD, + ) -> BOOL; + pub fn SetPriorityClass(hProcess: HANDLE, dwPriorityClass: DWORD) -> BOOL; + pub fn SetProcessAffinityMask(hProcess: HANDLE, dwProcessAffinityMask: DWORD) -> BOOL; + pub fn SetProcessAffinityUpdateMode(hProcess: HANDLE, dwFlags: DWORD) -> BOOL; + pub fn SetProcessDEPPolicy(dwFlags: DWORD) -> BOOL; + pub fn SetProcessInformation( + hProcess: HANDLE, ProcessInformationClass: PROCESS_INFORMATION_CLASS, + ProcessInformation: LPVOID, ProcessInformationSize: DWORD, + ) -> BOOL; + pub fn SetProcessMitigationPolicy( + MitigationPolicy: PROCESS_MITIGATION_POLICY, lpBuffer: PVOID, dwLength: SIZE_T, + ) -> BOOL; + pub fn SetProcessPreferredUILanguages( + dwFlags: DWORD, pwszLanguagesBuffer: PCZZWSTR, pulNumLanguages: PULONG, + ) -> BOOL; + pub fn SetProcessPriorityBoost(hProcess: HANDLE, bDisablePriorityBoost: BOOL) -> BOOL; + pub fn SetProcessShutdownParameters(dwLevel: DWORD, dwFlags: DWORD) -> BOOL; + pub fn SetProcessWorkingSetSize( + hProcess: HANDLE, dwMinimumWorkingSetSize: SIZE_T, dwMaximumWorkingSetSize: SIZE_T, + ) -> BOOL; + pub fn SetProcessWorkingSetSizeEx( + hProcess: HANDLE, dwMinimumWorkingSetSize: SIZE_T, dwMaximumWorkingSetSize: SIZE_T, + Flags: DWORD, + ) -> BOOL; + pub fn SetProtectedPolicy( + PolicyGuid: LPCGUID, PolicyValue: ULONG_PTR, OldPolicyValue: PULONG_PTR, + ) -> BOOL; + pub fn SetSearchPathMode(Flags: DWORD) -> BOOL; + pub fn SetStdHandle(nStdHandle: DWORD, hHandle: HANDLE) -> BOOL; + pub fn SetStdHandleEx(nStdHandle: DWORD, hHandle: HANDLE, phPrevValue: PHANDLE) -> BOOL; + pub fn SetSystemFileCacheSize( + MinimumFileCacheSize: SIZE_T, MaximumFileCacheSize: SIZE_T, Flags: DWORD, + ) -> BOOL; + pub fn SetSystemPowerState(fSuspend: BOOL, fForce: BOOL) -> BOOL; + pub fn SetSystemTime(lpSystemTime: *const SYSTEMTIME) -> BOOL; + pub fn SetSystemTimeAdjustment(dwTimeAdjustment: DWORD, bTimeAdjustmentDisabled: BOOL) -> BOOL; + pub fn SetTapeParameters( + hDevice: HANDLE, dwOperation: DWORD, lpTapeInformation: LPVOID, + ) -> DWORD; + pub fn SetTapePosition( + hDevice: HANDLE, dwPositionMethod: DWORD, dwPartition: DWORD, + dwOffsetLow: DWORD, dwOffsetHigh: DWORD, bImmediate: BOOL + ) -> DWORD; + pub fn SetThreadAffinityMask(hThread: HANDLE, dwThreadAffinityMask: DWORD_PTR) -> DWORD_PTR; + pub fn SetThreadContext(hThread: HANDLE, lpContext: *const CONTEXT) -> BOOL; + pub fn SetThreadErrorMode(dwNewMode: DWORD, lpOldMode: LPDWORD) -> BOOL; + pub fn SetThreadExecutionState(esFlags: EXECUTION_STATE) -> EXECUTION_STATE; + pub fn SetThreadGroupAffinity( + hThread: HANDLE, GroupAffinity: *const GROUP_AFFINITY, + PreviousGroupAffinity: PGROUP_AFFINITY, + ) -> BOOL; + pub fn SetThreadIdealProcessor(hThread: HANDLE, dwIdealProcessor: DWORD) -> DWORD; + pub fn SetThreadIdealProcessorEx( + hThread: HANDLE, lpIdealProcessor: PPROCESSOR_NUMBER, + lpPreviousIdealProcessor: PPROCESSOR_NUMBER, + ) -> BOOL; + pub fn SetThreadInformation( + hThread: HANDLE, ThreadInformationClass: THREAD_INFORMATION_CLASS, + ThreadInformation: LPVOID, ThreadInformationSize: DWORD, + ); + pub fn SetThreadLocale(Locale: LCID) -> BOOL; + pub fn SetThreadPreferredUILanguages( + dwFlags: DWORD, pwszLanguagesBuffer: PCZZWSTR, pulNumLanguages: PULONG, + ) -> BOOL; + pub fn SetThreadPriority(hThread: HANDLE, nPriority: c_int) -> BOOL; + pub fn SetThreadPriorityBoost(hThread: HANDLE, bDisablePriorityBoost: BOOL) -> BOOL; + pub fn SetThreadStackGuarantee(StackSizeInBytes: PULONG) -> BOOL; + pub fn SetThreadUILanguage(LangId: LANGID) -> LANGID; + pub fn SetThreadpoolStackInformation( + ptpp: PTP_POOL, ptpsi: PTP_POOL_STACK_INFORMATION, + ) -> BOOL; + pub fn SetThreadpoolThreadMaximum(ptpp: PTP_POOL, cthrdMost: DWORD); + pub fn SetThreadpoolThreadMinimum(ptpp: PTP_POOL, cthrdMic: DWORD) -> BOOL; + pub fn SetThreadpoolTimer( + pti: PTP_TIMER, pftDueTime: PFILETIME, msPeriod: DWORD, msWindowLength: DWORD, + ); + pub fn SetThreadpoolTimerEx( + pti: PTP_TIMER, pftDueTime: PFILETIME, msPeriod: DWORD, msWindowLength: DWORD, + ) -> BOOL; + pub fn SetThreadpoolWait(pwa: PTP_WAIT, h: HANDLE, pftTimeout: PFILETIME); + pub fn SetThreadpoolWaitEx( + pwa: PTP_WAIT, h: HANDLE, pftTimeout: PFILETIME, Reserved: PVOID, + ) -> BOOL; + pub fn SetTimeZoneInformation(lpTimeZoneInformation: *const TIME_ZONE_INFORMATION) -> BOOL; + pub fn SetTimerQueueTimer( + TimerQueue: HANDLE, Callback: WAITORTIMERCALLBACK, Parameter: PVOID, DueTime: DWORD, + Period: DWORD, PreferIo: BOOL, + ) -> HANDLE; + #[cfg(target_arch = "x86_64")] + pub fn SetUmsThreadInformation( + UmsThread: PUMS_CONTEXT, UmsThreadInfoClass: UMS_THREAD_INFO_CLASS, + UmsThreadInformation: PVOID, UmsThreadInformationLength: ULONG, + ) -> BOOL; + pub fn SetUnhandledExceptionFilter( + lpTopLevelExceptionFilter: LPTOP_LEVEL_EXCEPTION_FILTER, + ) -> LPTOP_LEVEL_EXCEPTION_FILTER; + pub fn SetUserGeoID(GeoId: GEOID) -> BOOL; + pub fn SetVolumeLabelA(lpRootPathName: LPCSTR, lpVolumeName: LPCSTR) -> BOOL; + pub fn SetVolumeLabelW(lpRootPathName: LPCWSTR, lpVolumeName: LPCWSTR) -> BOOL; + pub fn SetVolumeMountPointA(lpszVolumeMountPoint: LPCSTR, lpszVolumeName: LPCSTR) -> BOOL; + pub fn SetVolumeMountPointW(lpszVolumeMountPoint: LPCWSTR, lpszVolumeName: LPCWSTR) -> BOOL; + pub fn SetWaitableTimer( + hTimer: HANDLE, lpDueTime: *const LARGE_INTEGER, lPeriod: LONG, + pfnCompletionRoutine: PTIMERAPCROUTINE, lpArgToCompletionRoutine: LPVOID, fResume: BOOL, + ) -> BOOL; + pub fn SetWaitableTimerEx( + hTimer: HANDLE, lpDueTime: *const LARGE_INTEGER, lPeriod: LONG, + pfnCompletionRoutine: PTIMERAPCROUTINE, lpArgToCompletionRoutine: LPVOID, + WakeContext: PREASON_CONTEXT, TolerableDelay: ULONG, + ) -> BOOL; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn SetXStateFeaturesMask(Context: PCONTEXT, FeatureMask: DWORD64) -> BOOL; + pub fn SetupComm(hFile: HANDLE, dwInQueue: DWORD, dwOutQueue: DWORD) -> BOOL; + pub fn SignalObjectAndWait( + hObjectToSignal: HANDLE, hObjectToWaitOn: HANDLE, dwMilliseconds: DWORD, bAlertable: BOOL, + ) -> DWORD; + pub fn SizeofResource(hModule: HMODULE, hResInfo: HRSRC) -> DWORD; + pub fn Sleep(dwMilliseconds: DWORD); + pub fn SleepConditionVariableCS( + ConditionVariable: PCONDITION_VARIABLE, CriticalSection: PCRITICAL_SECTION, + dwMilliseconds: DWORD, + ) -> BOOL; + pub fn SleepConditionVariableSRW( + ConditionVariable: PCONDITION_VARIABLE, SRWLock: PSRWLOCK, dwMilliseconds: DWORD, + Flags: ULONG, + ) -> BOOL; + pub fn SleepEx(dwMilliseconds: DWORD, bAlertable: BOOL) -> DWORD; + pub fn StartThreadpoolIo(pio: PTP_IO); + pub fn SubmitThreadpoolWork(pwk: PTP_WORK); + pub fn SuspendThread(hThread: HANDLE) -> DWORD; + pub fn SwitchToFiber(lpFiber: LPVOID); + pub fn SwitchToThread() -> BOOL; + pub fn SystemTimeToFileTime(lpSystemTime: *const SYSTEMTIME, lpFileTime: LPFILETIME) -> BOOL; + pub fn SystemTimeToTzSpecificLocalTime( + lpTimeZoneInformation: *const TIME_ZONE_INFORMATION, lpUniversalTime: *const SYSTEMTIME, + lpLocalTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn SystemTimeToTzSpecificLocalTimeEx( + lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, + lpUniversalTime: *const SYSTEMTIME, lpLocalTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn TerminateJobObject(hJob: HANDLE, uExitCode: UINT) -> BOOL; + pub fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) -> BOOL; + pub fn TerminateThread(hThread: HANDLE, dwExitCode: DWORD) -> BOOL; + pub fn Thread32First(hSnapshot: HANDLE, lpte: LPTHREADENTRY32) -> BOOL; + pub fn Thread32Next(hSnapshot: HANDLE, lpte: LPTHREADENTRY32) -> BOOL; + pub fn TlsAlloc() -> DWORD; + pub fn TlsFree(dwTlsIndex: DWORD) -> BOOL; + pub fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID; + pub fn TlsSetValue(dwTlsIndex: DWORD, lpTlsValue: LPVOID) -> BOOL; + pub fn Toolhelp32ReadProcessMemory(th32ProcessID: DWORD, lpBaseAddress: LPCVOID, + lpBuffer: LPVOID, cbRead: SIZE_T, lpNumberOfBytesRead: *mut SIZE_T + ) -> BOOL; + pub fn TransactNamedPipe( + hNamedPipe: HANDLE, lpInBuffer: LPVOID, nInBufferSize: DWORD, lpOutBuffer: LPVOID, + nOutBufferSize: DWORD, lpBytesRead: LPDWORD, lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn TransmitCommChar(hFile: HANDLE, cChar: c_char) -> BOOL; + pub fn TryAcquireSRWLockExclusive(SRWLock: PSRWLOCK) -> BOOLEAN; + pub fn TryAcquireSRWLockShared(SRWLock: PSRWLOCK) -> BOOLEAN; + pub fn TryEnterCriticalSection(lpCriticalSection: LPCRITICAL_SECTION) -> BOOL; + pub fn TrySubmitThreadpoolCallback( + pfns: PTP_SIMPLE_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, + ) -> BOOL; + pub fn TzSpecificLocalTimeToSystemTime( + lpTimeZoneInformation: *const TIME_ZONE_INFORMATION, lpLocalTime: *const SYSTEMTIME, + lpUniversalTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn TzSpecificLocalTimeToSystemTimeEx( + lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, + lpLocalTime: *const SYSTEMTIME, lpUniversalTime: LPSYSTEMTIME, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn UmsThreadYield(SchedulerParam: PVOID) -> BOOL; + pub fn UnhandledExceptionFilter(ExceptionInfo: *mut EXCEPTION_POINTERS) -> LONG; + pub fn UnlockFile( + hFile: HANDLE, dwFileOffsetLow: DWORD, dwFileOffsetHigh: DWORD, + nNumberOfBytesToUnlockLow: DWORD, nNumberOfBytesToUnlockHigh: DWORD, + ) -> BOOL; + pub fn UnlockFileEx( + hFile: HANDLE, dwReserved: DWORD, nNumberOfBytesToUnlockLow: DWORD, + nNumberOfBytesToUnlockHigh: DWORD, lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL; + pub fn UnregisterApplicationRecoveryCallback() -> HRESULT; + pub fn UnregisterApplicationRestart() -> HRESULT; + pub fn UnregisterBadMemoryNotification(RegistrationHandle: PVOID) -> BOOL; + pub fn UnregisterWait(WaitHandle: HANDLE) -> BOOL; + pub fn UnregisterWaitEx(WaitHandle: HANDLE, CompletionEvent: HANDLE) -> BOOL; + // pub fn UnregisterWaitUntilOOBECompleted(); + pub fn UpdateProcThreadAttribute( + lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, dwFlags: DWORD, Attribute: DWORD_PTR, + lpValue: PVOID, cbSize: SIZE_T, lpPreviousValue: PVOID, lpReturnSize: PSIZE_T, + ) -> BOOL; + pub fn UpdateResourceA( + hUpdate: HANDLE, lpType: LPCSTR, lpName: LPCSTR, wLanguage: WORD, lpData: LPVOID, cb: DWORD, + ) -> BOOL; + pub fn UpdateResourceW( + hUpdate: HANDLE, lpType: LPCWSTR, lpName: LPCWSTR, wLanguage: WORD, lpData: LPVOID, + cb: DWORD, + ) -> BOOL; + pub fn VerLanguageNameA(wLang: DWORD, szLang: LPSTR, cchLang: DWORD) -> DWORD; + pub fn VerLanguageNameW(wLang: DWORD, szLang: LPWSTR, cchLang: DWORD) -> DWORD; + pub fn VerSetConditionMask( + ConditionMask: ULONGLONG, TypeMask: DWORD, Condition: BYTE, + ) -> ULONGLONG; + pub fn VerifyScripts( + dwFlags: DWORD, lpLocaleScripts: LPCWSTR, cchLocaleScripts: c_int, lpTestScripts: LPCWSTR, + cchTestScripts: c_int, + ) -> BOOL; + pub fn VerifyVersionInfoA( + lpVersionInformation: LPOSVERSIONINFOEXA, dwTypeMask: DWORD, dwlConditionMask: DWORDLONG, + ) -> BOOL; + pub fn VerifyVersionInfoW( + lpVersionInformation: LPOSVERSIONINFOEXW, dwTypeMask: DWORD, dwlConditionMask: DWORDLONG, + ) -> BOOL; + pub fn VirtualAlloc( + lpAddress: LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, flProtect: DWORD, + ) -> LPVOID; + pub fn VirtualAllocEx( + hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, + flProtect: DWORD, + ) -> LPVOID; + pub fn VirtualAllocExNuma( + hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, + flProtect: DWORD, nndPreferred: DWORD, + ) -> LPVOID; + pub fn VirtualFree(lpAddress: LPVOID, dwSize: SIZE_T, dwFreeType: DWORD) -> BOOL; + pub fn VirtualFreeEx( + hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, dwFreeType: DWORD, + ) -> BOOL; + pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL; + pub fn VirtualProtect( + lpAddress: LPVOID, dwSize: SIZE_T, flNewProtect: DWORD, lpflOldProtect: PDWORD, + ) -> BOOL; + pub fn VirtualProtectEx( + hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, flNewProtect: DWORD, + lpflOldProtect: DWORD, + ) -> BOOL; + pub fn VirtualQuery( + lpAddress: LPCVOID, lpBuffer: PMEMORY_BASIC_INFORMATION, dwLength: SIZE_T, + ) -> SIZE_T; + pub fn VirtualQueryEx( + hProcess: HANDLE, lpAddress: LPCVOID, lpBuffer: PMEMORY_BASIC_INFORMATION, dwLength: SIZE_T, + ) -> SIZE_T; + pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL; + pub fn WTSGetActiveConsoleSessionId() -> DWORD; + pub fn WaitCommEvent(hFile: HANDLE, lpEvtMask: LPDWORD, lpOverlapped: LPOVERLAPPED) -> BOOL; + pub fn WaitForDebugEvent(lpDebugEvent: LPDEBUG_EVENT, dwMilliseconds: DWORD) -> BOOL; + pub fn WaitForMultipleObjects( + nCount: DWORD, lpHandles: *const HANDLE, bWaitAll: BOOL, dwMilliseconds: DWORD, + ) -> DWORD; + pub fn WaitForMultipleObjectsEx( + nCount: DWORD, lpHandles: *const HANDLE, bWaitAll: BOOL, dwMilliseconds: DWORD, + bAlertable: BOOL, + ) -> DWORD; + pub fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD; + pub fn WaitForSingleObjectEx( + hHandle: HANDLE, dwMilliseconds: DWORD, bAlertable: BOOL, + ) -> DWORD; + pub fn WaitForThreadpoolIoCallbacks(pio: PTP_IO, fCancelPendingCallbacks: BOOL); + pub fn WaitForThreadpoolTimerCallbacks(pti: PTP_TIMER, fCancelPendingCallbacks: BOOL); + pub fn WaitForThreadpoolWaitCallbacks(pwa: PTP_WAIT, fCancelPendingCallbacks: BOOL); + pub fn WaitForThreadpoolWorkCallbacks(pwk: PTP_WORK, fCancelPendingCallbacks: BOOL); + pub fn WaitNamedPipeA(lpNamedPipeName: LPCSTR, nTimeOut: DWORD) -> BOOL; + pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR, nTimeOut: DWORD) -> BOOL; + pub fn WakeAllConditionVariable(ConditionVariable: PCONDITION_VARIABLE); + pub fn WakeConditionVariable(ConditionVariable: PCONDITION_VARIABLE); + pub fn WerGetFlags(hProcess: HANDLE, pdwFlags: PDWORD) -> HRESULT; + pub fn WerRegisterFile( + pwzFile: PCWSTR, regFileType: WER_REGISTER_FILE_TYPE, dwFlags: DWORD, + ) -> HRESULT; + pub fn WerRegisterMemoryBlock(pvAddress: PVOID, dwSize: DWORD) -> HRESULT; + pub fn WerRegisterRuntimeExceptionModule( + pwszOutOfProcessCallbackDll: PCWSTR, pContext: PVOID, + ) -> HRESULT; + pub fn WerSetFlags(dwFlags: DWORD) -> HRESULT; + pub fn WerUnregisterFile(pwzFilePath: PCWSTR) -> HRESULT; + pub fn WerUnregisterMemoryBlock(pvAddress: PVOID) -> HRESULT; + pub fn WerUnregisterRuntimeExceptionModule( + pwszOutOfProcessCallbackDll: PCWSTR, pContext: PVOID, + ) -> HRESULT; + // pub fn WerpInitiateRemoteRecovery(); + pub fn WideCharToMultiByte( + CodePage: UINT, dwFlags: DWORD, lpWideCharStr: LPCWSTR, cchWideChar: c_int, + lpMultiByteStr: LPSTR, cbMultiByte: c_int, lpDefaultChar: LPCSTR, lpUsedDefaultChar: LPBOOL, + ) -> c_int; + pub fn WinExec(lpCmdLine: LPCSTR, uCmdShow: UINT) -> UINT; + pub fn Wow64DisableWow64FsRedirection(OldValue: *mut PVOID) -> BOOL; + pub fn Wow64EnableWow64FsRedirection(Wow64FsEnableRedirection: BOOLEAN) -> BOOLEAN; + pub fn Wow64GetThreadContext(hThread: HANDLE, lpContext: PWOW64_CONTEXT) -> BOOL; + pub fn Wow64GetThreadSelectorEntry( + hThread: HANDLE, dwSelector: DWORD, lpSelectorEntry: PWOW64_LDT_ENTRY, + ) -> BOOL; + pub fn Wow64RevertWow64FsRedirection(OlValue: PVOID) -> BOOL; + pub fn Wow64SetThreadContext(hThread: HANDLE, lpContext: *const WOW64_CONTEXT) -> BOOL; + pub fn Wow64SuspendThread(hThread: HANDLE) -> DWORD; + pub fn WriteConsoleA( + hConsoleOutput: HANDLE, lpBuffer: *const VOID, nNumberOfCharsToWrite: DWORD, + lpNumberOfCharsWritten: LPDWORD, lpReserved: LPVOID, + ) -> BOOL; + pub fn WriteConsoleInputA( + hConsoleInput: HANDLE, lpBuffer: *const INPUT_RECORD, nLength: DWORD, + lpNumberOfEventsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleInputW( + hConsoleInput: HANDLE, lpBuffer: *const INPUT_RECORD, nLength: DWORD, + lpNumberOfEventsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleOutputA( + hConsoleOutput: HANDLE, lpBuffer: *const CHAR_INFO, dwBufferSize: COORD, + dwBufferCoord: COORD, lpWriteRegion: PSMALL_RECT, + ) -> BOOL; + pub fn WriteConsoleOutputAttribute( + hConsoleOutput: HANDLE, lpAttribute: *const WORD, nLength: DWORD, dwWriteCoord: COORD, + lpNumberOfAttrsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleOutputCharacterA( + hConsoleOutput: HANDLE, lpCharacter: LPCSTR, nLength: DWORD, dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleOutputCharacterW( + hConsoleOutput: HANDLE, lpCharacter: LPCWSTR, nLength: DWORD, dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleOutputW( + hConsoleOutput: HANDLE, lpBuffer: *const CHAR_INFO, dwBufferSize: COORD, + dwBufferCoord: COORD, lpWriteRegion: PSMALL_RECT, + ) -> BOOL; + pub fn WriteConsoleW( + hConsoleOutput: HANDLE, lpBuffer: *const VOID, nNumberOfCharsToWrite: DWORD, + lpNumberOfCharsWritten: LPDWORD, lpReserved: LPVOID, + ) -> BOOL; + pub fn WriteFile( + hFile: HANDLE, lpBuffer: LPCVOID, nNumberOfBytesToWrite: DWORD, + lpNumberOfBytesWritten: LPDWORD, lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WriteFileEx( + hFile: HANDLE, lpBuffer: LPCVOID, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; + pub fn WriteFileGather( + hFile: HANDLE, aSegmentArray: *mut FILE_SEGMENT_ELEMENT, nNumberOfBytesToWrite: DWORD, + lpReserved: LPDWORD, lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WritePrivateProfileSectionA( + lpAppName: LPCSTR, lpString: LPCSTR, lpFileName: LPCSTR, + ) -> BOOL; + pub fn WritePrivateProfileSectionW( + lpAppName: LPCWSTR, lpString: LPCWSTR, lpFileName: LPCWSTR, + ) -> BOOL; + pub fn WritePrivateProfileStringA( + lpAppName: LPCSTR, lpKeyName: LPCSTR, lpString: LPCSTR, lpFileName: LPCSTR, + ) -> BOOL; + pub fn WritePrivateProfileStringW( + lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpString: LPCWSTR, lpFileName: LPCWSTR, + ) -> BOOL; + pub fn WritePrivateProfileStructA( + lpszSection: LPCSTR, lpszKey: LPCSTR, lpStruct: LPVOID, uSizeStruct: UINT, szFile: LPCSTR, + ) -> BOOL; + pub fn WritePrivateProfileStructW( + lpszSection: LPCWSTR, lpszKey: LPCWSTR, lpStruct: LPVOID, uSizeStruct: UINT, + szFile: LPCWSTR, + ) -> BOOL; + pub fn WriteProcessMemory( + hProcess: HANDLE, lpBaseAddress: LPVOID, lpBuffer: LPCVOID, nSize: SIZE_T, + lpNumberOfBytesWritten: *mut SIZE_T, + ) -> BOOL; + pub fn WriteProfileSectionA(lpAppName: LPCSTR, lpString: LPCSTR) -> BOOL; + pub fn WriteProfileSectionW(lpAppName: LPCWSTR, lpString: LPCWSTR) -> BOOL; + pub fn WriteProfileStringA(lpAppName: LPCSTR, lpKeyName: LPCSTR, lpString: LPCSTR) -> BOOL; + pub fn WriteProfileStringW(lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpString: LPCWSTR) -> BOOL; + pub fn WriteTapemark( + hDevice: HANDLE, dwTapemarkType: DWORD, dwTapemarkCount: DWORD, bImmediate: BOOL, + ) -> DWORD; + pub fn ZombifyActCtx(hActCtx: HANDLE) -> BOOL; + pub fn _hread(hFile: HFILE, lpBuffer: LPVOID, lBytes: c_long) -> c_long; + pub fn _hwrite(hFile: HFILE, lpBuffer: LPCCH, lBytes: c_long) -> c_long; + pub fn _lclose(hFile: HFILE) -> HFILE; + pub fn _lcreat(lpPathName: LPCSTR, iAttrubute: c_int) -> HFILE; + pub fn _llseek(hFile: HFILE, lOffset: LONG, iOrigin: c_int) -> LONG; + pub fn _lopen(lpPathName: LPCSTR, iReadWrite: c_int) -> HFILE; + pub fn _lread(hFile: HFILE, lpBuffer: LPVOID, uBytes: UINT) -> UINT; + pub fn _lwrite(hFile: HFILE, lpBuffer: LPCCH, uBytes: UINT) -> UINT; + pub fn lstrcat(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; + pub fn lstrcatA(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; + pub fn lstrcatW(lpString1: LPWSTR, lpString2: LPCWSTR) -> LPSTR; + pub fn lstrcmp(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; + pub fn lstrcmpA(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; + pub fn lstrcmpW(lpString1: LPCWSTR, lpString2: LPCWSTR) -> c_int; + pub fn lstrcmpi(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; + pub fn lstrcmpiA(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; + pub fn lstrcmpiW(lpString1: LPCWSTR, lpString2: LPCWSTR) -> c_int; + pub fn lstrcpy(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; + pub fn lstrcpyA(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; + pub fn lstrcpyW(lpString1: LPWSTR, lpString2: LPCWSTR) -> LPSTR; + pub fn lstrcpyn(lpString1: LPSTR, lpString2: LPCSTR, iMaxLength: c_int) -> LPSTR; + pub fn lstrcpynA(lpString1: LPSTR, lpString2: LPCSTR, iMaxLength: c_int) -> LPSTR; + pub fn lstrcpynW(lpString1: LPWSTR, lpString2: LPCWSTR, iMaxLength: c_int) -> LPSTR; + pub fn lstrlen(lpString: LPCSTR) -> c_int; + pub fn lstrlenA(lpString: LPCSTR) -> c_int; + pub fn lstrlenW(lpString: LPCWSTR) -> c_int; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_lstrcmpW(String1: PCUWSTR, String2: PCUWSTR) -> c_int; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_lstrcmpiW(String1: PCUWSTR, String2: PCUWSTR) -> c_int; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_lstrlenW(String: LPCUWSTR) -> c_int; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_wcschr(String: PCUWSTR, Character: WCHAR) -> PUWSTR; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_wcscpy(Destination: PUWSTR, Source: PCUWSTR) -> PUWSTR; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_wcsicmp(String1: PCUWSTR, String2: PCUWSTR) -> c_int; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_wcslen(String: PCUWSTR) -> size_t; + #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] + pub fn uaw_wcsrchr(String: PCUWSTR, Character: WCHAR) -> PUWSTR; +} diff --git a/third_party/rust/khronos_api/.cargo-checksum.json b/third_party/rust/khronos_api/.cargo-checksum.json new file mode 100644 index 000000000000..8cbc21b71906 --- /dev/null +++ b/third_party/rust/khronos_api/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"201ece82276abe0662d235dcfe1736ca1306da4e54dba43b07301939c21a03c9","README.md":"4584b28d97d885822adc66e1eae8a329bd5e3b13a5dd887006c08bc5adc0a917","api/GL/glcorearb.h":"d411f59f28484725f6a2927d8f283ef10bf8e14d3b685e76de30c3871ca176e6","api/GL/glext.h":"fd30a350477613fb9a0b3cdaa5b22b18fed56cdbd369c587058c71ea83c8935b","api/GL/glxext.h":"0024c262e896dd3bfcd8c458e809bd2910d8eeae1316998a0654cdb75e5f2019","api/GL/wglext.h":"2fdace6ceefaf6bee7a5d821bcd599774689da354c7670839df4f4a836fd8386","api/Makefile":"fa42b2bf27a450c5be83f3178ca08f9bd24f611786dd503033b84c98ae67d37f","api/README.txt":"8c0b31285b1ce7d661ebdbf2f884264c9a588f7721221a2ad5fba7cafdf5b76f","api/egl.xml":"2590ce135d8b5364f11ae4ca04a0abe1fa781cde99a2b4ade8a2f0fdac09d5e4","api/genheaders.py":"3ddf420a48450c0d74b5c95d956ac09f4aceff2e225b148f0d1415a14f182a11","api/gl.xml":"5cf25ca370fd8c13407192533d5aa6febc4c16b7038882ae75d106f555e8f0e1","api/glx.xml":"9653c70d281fbac1c28292ef6532f41a9aee3c6998260d186b860f7cc2cc7ecd","api/readme.pdf":"26b9a42b4bc0803ee4854d5aa908b76bf08cafb478fd2e772a3b6cf6820daa2f","api/readme.tex":"542e27bcbd975f5c24e19fc2b89d62e8a4af8657f5f0ecebfac1c2640e23a5b6","api/reg.py":"469c294591df494d727bf13333b7080f04ba7c4938baeff14a5ead95b0cbd7c8","api/registry.rnc":"e76be90498a47ab63f9f0eb10b6a63d795a9e4b5a0bde2c89f1709ed8ebf937e","api/wgl.xml":"38b53bc1bc2c16dce1cc627feebcda4fb666c2d23ab0baf09bdecf6cb85bb005","src/lib.rs":"59d07cea8beca750b13ac49d4b1e37e23e753640517ee644bcddf50d431166eb"},"package":"09c9d3760673c427d46f91a0350f0a84a52e6bc5a84adf26dc610b6c52436630"} \ No newline at end of file diff --git a/third_party/rust/khronos_api/.cargo-ok b/third_party/rust/khronos_api/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/khronos_api/Cargo.toml b/third_party/rust/khronos_api/Cargo.toml new file mode 100644 index 000000000000..ecf2952711a1 --- /dev/null +++ b/third_party/rust/khronos_api/Cargo.toml @@ -0,0 +1,18 @@ +[package] + +name = "khronos_api" +version = "1.0.0" +authors = [ + "Brendan Zabarauskas ", + "Corey Richardson", + "Arseny Kapoulkine", + "Pierre Krieger " +] +description = "The Khronos XML API Registry, exposed as byte string constants." +license = "Apache-2.0" + +homepage = "https://github.com/bjz/gl-rs/khronos_api/" +repository = "https://github.com/bjz/gl-rs/" +readme = "README.md" + +keywords = ["opengl", "khronos"] diff --git a/third_party/rust/khronos_api/README.md b/third_party/rust/khronos_api/README.md new file mode 100644 index 000000000000..1143a764a34e --- /dev/null +++ b/third_party/rust/khronos_api/README.md @@ -0,0 +1,14 @@ +# khronos_api + +[![Version](https://img.shields.io/crates/v/khronos_api.svg)](https://crates.io/crates/khronos_api) +[![License](https://img.shields.io/crates/l/khronos_api.svg)](https://github.com/bjz/gl-rs/blob/master/LICENSE) +[![Downloads](https://img.shields.io/crates/d/khronos_api.svg)](https://crates.io/crates/khronos_api) + +The Khronos XML API Registry, exposed as byte string constants. + +The following constants are provided: + +- `GL_XML`: the contents of [`gl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml) +- `EGL_XML`: the contents of [`egl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/egl.xml) +- `WGL_XML`: the contents of [`wgl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml) +- `GLX_XML`: the contents of [`glx.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/glx.xml) diff --git a/third_party/rust/khronos_api/api/GL/glcorearb.h b/third_party/rust/khronos_api/api/GL/glcorearb.h new file mode 100755 index 000000000000..18b0cfa5bbc1 --- /dev/null +++ b/third_party/rust/khronos_api/api/GL/glcorearb.h @@ -0,0 +1,3617 @@ +#ifndef __glcorearb_h_ +#define __glcorearb_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision$ on $Date$ +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/* glcorearb.h is for use with OpenGL core profile implementations. +** It should should be placed in the same directory as gl.h and +** included as . +** +** glcorearb.h includes only APIs in the latest OpenGL core profile +** implementation together with APIs in newer ARB extensions which +** can be supported by the core profile. It does not, and never will +** include functionality removed from the core profile, such as +** fixed-function vertex and fragment processing. +** +** Do not #include both and either of or +** in the same source file. +*/ + +/* Generated C header for: + * API: gl + * Profile: core + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: glcore + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_VERSION_1_0 +#define GL_VERSION_1_0 1 +typedef void GLvoid; +typedef unsigned int GLenum; +typedef float GLfloat; +typedef int GLint; +typedef int GLsizei; +typedef unsigned int GLbitfield; +typedef double GLdouble; +typedef unsigned int GLuint; +typedef unsigned char GLboolean; +typedef unsigned char GLubyte; +typedef void (APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); +typedef void (APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); +typedef void (APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size); +typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum buf); +typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); +typedef void (APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); +typedef void (APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); +typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap); +typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap); +typedef void (APIENTRYP PFNGLFINISHPROC) (void); +typedef void (APIENTRYP PFNGLFLUSHPROC) (void); +typedef void (APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); +typedef void (APIENTRYP PFNGLLOGICOPPROC) (GLenum opcode); +typedef void (APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); +typedef void (APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); +typedef void (APIENTRYP PFNGLPIXELSTOREFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLREADBUFFERPROC) (GLenum src); +typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +typedef void (APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data); +typedef void (APIENTRYP PFNGLGETDOUBLEVPROC) (GLenum pname, GLdouble *data); +typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void); +typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data); +typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); +typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); +typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble near, GLdouble far); +typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullFace (GLenum mode); +GLAPI void APIENTRY glFrontFace (GLenum mode); +GLAPI void APIENTRY glHint (GLenum target, GLenum mode); +GLAPI void APIENTRY glLineWidth (GLfloat width); +GLAPI void APIENTRY glPointSize (GLfloat size); +GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode); +GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glDrawBuffer (GLenum buf); +GLAPI void APIENTRY glClear (GLbitfield mask); +GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glClearStencil (GLint s); +GLAPI void APIENTRY glClearDepth (GLdouble depth); +GLAPI void APIENTRY glStencilMask (GLuint mask); +GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI void APIENTRY glDepthMask (GLboolean flag); +GLAPI void APIENTRY glDisable (GLenum cap); +GLAPI void APIENTRY glEnable (GLenum cap); +GLAPI void APIENTRY glFinish (void); +GLAPI void APIENTRY glFlush (void); +GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GLAPI void APIENTRY glLogicOp (GLenum opcode); +GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GLAPI void APIENTRY glDepthFunc (GLenum func); +GLAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); +GLAPI void APIENTRY glReadBuffer (GLenum src); +GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GLAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); +GLAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *data); +GLAPI GLenum APIENTRY glGetError (void); +GLAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *data); +GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data); +GLAPI const GLubyte *APIENTRY glGetString (GLenum name); +GLAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap); +GLAPI void APIENTRY glDepthRange (GLdouble near, GLdouble far); +GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_VERSION_1_0 */ + +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 +typedef float GLclampf; +typedef double GLclampd; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_NONE 0 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_VIEWPORT 0x0BA2 +#define GL_DITHER 0x0BD0 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F +#define GL_TEXTURE 0x1702 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_REPEAT 0x2901 +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_VERTEX_ARRAY 0x8074 +typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); +typedef void (APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params); +typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); +GLAPI void APIENTRY glGetPointerv (GLenum pname, void **params); +GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GLAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); +GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GLAPI GLboolean APIENTRY glIsTexture (GLuint texture); +#endif +#endif /* GL_VERSION_1_1 */ + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_VERSION_1_2 */ + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum texture); +GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img); +#endif +#endif /* GL_VERSION_1_3 */ + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); +GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glBlendEquation (GLenum mode); +#endif +#endif /* GL_VERSION_1_4 */ + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#include +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptr; +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_SRC1_ALPHA 0x8589 +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); +typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQuery (GLuint id); +GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQuery (GLenum target); +GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); +GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_VERSION_1_5 */ + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +typedef char GLchar; +typedef short GLshort; +typedef signed char GLbyte; +typedef unsigned short GLushort; +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY glCompileShader (GLuint shader); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum type); +GLAPI void APIENTRY glDeleteProgram (GLuint program); +GLAPI void APIENTRY glDeleteShader (GLuint shader); +GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GLAPI GLboolean APIENTRY glIsProgram (GLuint program); +GLAPI GLboolean APIENTRY glIsShader (GLuint shader); +GLAPI void APIENTRY glLinkProgram (GLuint program); +GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GLAPI void APIENTRY glUseProgram (GLuint program); +GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glValidateProgram (GLuint program); +GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +#endif +#endif /* GL_VERSION_2_0 */ + +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_VERSION_2_1 */ + +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +typedef unsigned short GLhalf; +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_COLOR_ATTACHMENT16 0x8CF0 +#define GL_COLOR_ATTACHMENT17 0x8CF1 +#define GL_COLOR_ATTACHMENT18 0x8CF2 +#define GL_COLOR_ATTACHMENT19 0x8CF3 +#define GL_COLOR_ATTACHMENT20 0x8CF4 +#define GL_COLOR_ATTACHMENT21 0x8CF5 +#define GL_COLOR_ATTACHMENT22 0x8CF6 +#define GL_COLOR_ATTACHMENT23 0x8CF7 +#define GL_COLOR_ATTACHMENT24 0x8CF8 +#define GL_COLOR_ATTACHMENT25 0x8CF9 +#define GL_COLOR_ATTACHMENT26 0x8CFA +#define GL_COLOR_ATTACHMENT27 0x8CFB +#define GL_COLOR_ATTACHMENT28 0x8CFC +#define GL_COLOR_ATTACHMENT29 0x8CFD +#define GL_COLOR_ATTACHMENT30 0x8CFE +#define GL_COLOR_ATTACHMENT31 0x8CFF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_HALF_FLOAT 0x140B +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); +GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); +GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedback (void); +GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); +GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRender (void); +GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index); +GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmap (GLenum target); +GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glBindVertexArray (GLuint array); +GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); +#endif +#endif /* GL_VERSION_3_0 */ + +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFFu +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); +GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#endif +#endif /* GL_VERSION_3_1 */ + +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +typedef struct __GLsync *GLsync; +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif +typedef uint64_t GLuint64; +typedef int64_t GLint64; +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_DEPTH_CLAMP 0x864F +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); +typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +GLAPI void APIENTRY glProvokingVertex (GLenum mode); +GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); +GLAPI GLboolean APIENTRY glIsSync (GLsync sync); +GLAPI void APIENTRY glDeleteSync (GLsync sync); +GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); +GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); +#endif +#endif /* GL_VERSION_3_2 */ + +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#define GL_SRC1_COLOR 0x88F9 +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_SAMPLER_BINDING 0x8919 +#define GL_RGB10_A2UI 0x906F +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#define GL_INT_2_10_10_10_REV 0x8D9F +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); +typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); +typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); +GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); +GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); +GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); +GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); +GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); +GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); +GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); +GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); +GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); +GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); +GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +#endif +#endif /* GL_VERSION_3_3 */ + +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +#define GL_PATCHES 0x000E +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +#define GL_ISOLINES 0x8E7A +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRACTIONAL_EVEN 0x8E7C +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect); +typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); +typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); +typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); +typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShading (GLfloat value); +GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect); +GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect); +GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); +GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); +GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); +GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); +GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); +GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); +GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedback (void); +GLAPI void APIENTRY glResumeTransformFeedback (void); +GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); +GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); +GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); +GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); +GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); +#endif +#endif /* GL_VERSION_4_0 */ + +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_RGB565 0x8D62 +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings); +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReleaseShaderCompiler (void); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GLAPI void APIENTRY glClearDepthf (GLfloat d); +GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); +GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); +GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); +GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); +GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); +GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); +GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); +#endif +#endif /* GL_VERSION_4_1 */ + +#ifndef GL_VERSION_4_2 +#define GL_VERSION_4_2 1 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 +#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 +#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 +#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A +#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B +#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C +#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D +#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E +#define GL_NUM_SAMPLE_COUNTS 0x9380 +#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_1D 0x904C +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_2D_RECT 0x904F +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_BUFFER 0x9051 +#define GL_IMAGE_1D_ARRAY 0x9052 +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 +#define GL_INT_IMAGE_1D 0x9057 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_2D_RECT 0x905A +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_BUFFER 0x905C +#define GL_INT_IMAGE_1D_ARRAY 0x905D +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C +#define GL_MAX_IMAGE_SAMPLES 0x906D +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); +GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); +GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +#endif +#endif /* GL_VERSION_4_2 */ + +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_MAX_WIDTH 0x827E +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_MIPMAP 0x8293 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_COLOR_ENCODING 0x8296 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_FILTER 0x829A +#define GL_VERTEX_TEXTURE 0x829B +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#define GL_NAME_LENGTH 0x92F9 +#define GL_TYPE 0x92FA +#define GL_ARRAY_SIZE 0x92FB +#define GL_OFFSET 0x92FC +#define GL_BLOCK_INDEX 0x92FD +#define GL_ARRAY_STRIDE 0x92FE +#define GL_MATRIX_STRIDE 0x92FF +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_LOCATION 0x930E +#define GL_LOCATION_INDEX 0x930F +#define GL_IS_PER_PATCH 0x92E7 +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF +#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_VERTEX_BINDING_BUFFER 0x8F4F +typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); +typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); +GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); +GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); +GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI void APIENTRY glPopDebugGroup (void); +GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_VERSION_4_3 */ + +#ifndef GL_VERSION_4_4 +#define GL_VERSION_4_4 1 +#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_TEXTURE_BUFFER_BINDING 0x8C2A +#define GL_MAP_PERSISTENT_BIT 0x0040 +#define GL_MAP_COHERENT_BIT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT 0x0100 +#define GL_CLIENT_STORAGE_BIT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F +#define GL_BUFFER_STORAGE_FLAGS 0x8220 +#define GL_CLEAR_TEXTURE 0x9365 +#define GL_LOCATION_COMPONENT 0x934A +#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B +#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C +#define GL_QUERY_BUFFER 0x9192 +#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 +#define GL_QUERY_BUFFER_BINDING 0x9193 +#define GL_QUERY_RESULT_NO_WAIT 0x9194 +#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 +typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers); +GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#endif +#endif /* GL_VERSION_4_4 */ + +#ifndef GL_VERSION_4_5 +#define GL_VERSION_4_5 1 +#define GL_CONTEXT_LOST 0x0507 +#define GL_NEGATIVE_ONE_TO_ONE 0x935E +#define GL_ZERO_TO_ONE 0x935F +#define GL_CLIP_ORIGIN 0x935C +#define GL_CLIP_DEPTH_MODE 0x935D +#define GL_QUERY_WAIT_INVERTED 0x8E17 +#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 +#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 +#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A +#define GL_MAX_CULL_DISTANCES 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA +#define GL_TEXTURE_TARGET 0x1006 +#define GL_QUERY_TARGET 0x82EA +#define GL_GUILTY_CONTEXT_RESET 0x8253 +#define GL_INNOCENT_CONTEXT_RESET 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET 0x8252 +#define GL_NO_RESET_NOTIFICATION 0x8261 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC +typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); +typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil); +typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); +typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth); +GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers); +GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access); +GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer); +GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params); +GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf); +GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src); +GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil); +GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures); +GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param); +GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture); +GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture); +GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays); +GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer); +GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); +GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); +GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); +GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void); +GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glTextureBarrier (void); +#endif +#endif /* GL_VERSION_4_5 */ + +#ifndef GL_ARB_ES2_compatibility +#define GL_ARB_ES2_compatibility 1 +#endif /* GL_ARB_ES2_compatibility */ + +#ifndef GL_ARB_ES3_1_compatibility +#define GL_ARB_ES3_1_compatibility 1 +#endif /* GL_ARB_ES3_1_compatibility */ + +#ifndef GL_ARB_ES3_compatibility +#define GL_ARB_ES3_compatibility 1 +#endif /* GL_ARB_ES3_compatibility */ + +#ifndef GL_ARB_arrays_of_arrays +#define GL_ARB_arrays_of_arrays 1 +#endif /* GL_ARB_arrays_of_arrays */ + +#ifndef GL_ARB_base_instance +#define GL_ARB_base_instance 1 +#endif /* GL_ARB_base_instance */ + +#ifndef GL_ARB_bindless_texture +#define GL_ARB_bindless_texture 1 +typedef uint64_t GLuint64EXT; +#define GL_UNSIGNED_INT64_ARB 0x140F +typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture); +GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler); +GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle); +GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access); +GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle); +GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value); +GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value); +GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle); +GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params); +#endif +#endif /* GL_ARB_bindless_texture */ + +#ifndef GL_ARB_blend_func_extended +#define GL_ARB_blend_func_extended 1 +#endif /* GL_ARB_blend_func_extended */ + +#ifndef GL_ARB_buffer_storage +#define GL_ARB_buffer_storage 1 +#endif /* GL_ARB_buffer_storage */ + +#ifndef GL_ARB_cl_event +#define GL_ARB_cl_event 1 +struct _cl_context; +struct _cl_event; +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 +typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#endif +#endif /* GL_ARB_cl_event */ + +#ifndef GL_ARB_clear_buffer_object +#define GL_ARB_clear_buffer_object 1 +#endif /* GL_ARB_clear_buffer_object */ + +#ifndef GL_ARB_clear_texture +#define GL_ARB_clear_texture 1 +#endif /* GL_ARB_clear_texture */ + +#ifndef GL_ARB_clip_control +#define GL_ARB_clip_control 1 +#endif /* GL_ARB_clip_control */ + +#ifndef GL_ARB_compressed_texture_pixel_storage +#define GL_ARB_compressed_texture_pixel_storage 1 +#endif /* GL_ARB_compressed_texture_pixel_storage */ + +#ifndef GL_ARB_compute_shader +#define GL_ARB_compute_shader 1 +#endif /* GL_ARB_compute_shader */ + +#ifndef GL_ARB_compute_variable_group_size +#define GL_ARB_compute_variable_group_size 1 +#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 +#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB +#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 +#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +#endif +#endif /* GL_ARB_compute_variable_group_size */ + +#ifndef GL_ARB_conditional_render_inverted +#define GL_ARB_conditional_render_inverted 1 +#endif /* GL_ARB_conditional_render_inverted */ + +#ifndef GL_ARB_conservative_depth +#define GL_ARB_conservative_depth 1 +#endif /* GL_ARB_conservative_depth */ + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 +#endif /* GL_ARB_copy_buffer */ + +#ifndef GL_ARB_copy_image +#define GL_ARB_copy_image 1 +#endif /* GL_ARB_copy_image */ + +#ifndef GL_ARB_cull_distance +#define GL_ARB_cull_distance 1 +#endif /* GL_ARB_cull_distance */ + +#ifndef GL_ARB_debug_output +#define GL_ARB_debug_output 1 +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#endif +#endif /* GL_ARB_debug_output */ + +#ifndef GL_ARB_depth_buffer_float +#define GL_ARB_depth_buffer_float 1 +#endif /* GL_ARB_depth_buffer_float */ + +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +#endif /* GL_ARB_depth_clamp */ + +#ifndef GL_ARB_derivative_control +#define GL_ARB_derivative_control 1 +#endif /* GL_ARB_derivative_control */ + +#ifndef GL_ARB_direct_state_access +#define GL_ARB_direct_state_access 1 +#endif /* GL_ARB_direct_state_access */ + +#ifndef GL_ARB_draw_buffers_blend +#define GL_ARB_draw_buffers_blend 1 +typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif +#endif /* GL_ARB_draw_buffers_blend */ + +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 +#endif /* GL_ARB_draw_elements_base_vertex */ + +#ifndef GL_ARB_draw_indirect +#define GL_ARB_draw_indirect 1 +#endif /* GL_ARB_draw_indirect */ + +#ifndef GL_ARB_enhanced_layouts +#define GL_ARB_enhanced_layouts 1 +#endif /* GL_ARB_enhanced_layouts */ + +#ifndef GL_ARB_explicit_attrib_location +#define GL_ARB_explicit_attrib_location 1 +#endif /* GL_ARB_explicit_attrib_location */ + +#ifndef GL_ARB_explicit_uniform_location +#define GL_ARB_explicit_uniform_location 1 +#endif /* GL_ARB_explicit_uniform_location */ + +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 +#endif /* GL_ARB_fragment_coord_conventions */ + +#ifndef GL_ARB_fragment_layer_viewport +#define GL_ARB_fragment_layer_viewport 1 +#endif /* GL_ARB_fragment_layer_viewport */ + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_ARB_framebuffer_no_attachments 1 +#endif /* GL_ARB_framebuffer_no_attachments */ + +#ifndef GL_ARB_framebuffer_object +#define GL_ARB_framebuffer_object 1 +#endif /* GL_ARB_framebuffer_object */ + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_ARB_framebuffer_sRGB 1 +#endif /* GL_ARB_framebuffer_sRGB */ + +#ifndef GL_ARB_get_program_binary +#define GL_ARB_get_program_binary 1 +#endif /* GL_ARB_get_program_binary */ + +#ifndef GL_ARB_get_texture_sub_image +#define GL_ARB_get_texture_sub_image 1 +#endif /* GL_ARB_get_texture_sub_image */ + +#ifndef GL_ARB_gpu_shader5 +#define GL_ARB_gpu_shader5 1 +#endif /* GL_ARB_gpu_shader5 */ + +#ifndef GL_ARB_gpu_shader_fp64 +#define GL_ARB_gpu_shader_fp64 1 +#endif /* GL_ARB_gpu_shader_fp64 */ + +#ifndef GL_ARB_half_float_vertex +#define GL_ARB_half_float_vertex 1 +#endif /* GL_ARB_half_float_vertex */ + +#ifndef GL_ARB_imaging +#define GL_ARB_imaging 1 +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_EQUATION 0x8009 +#endif /* GL_ARB_imaging */ + +#ifndef GL_ARB_indirect_parameters +#define GL_ARB_indirect_parameters 1 +#define GL_PARAMETER_BUFFER_ARB 0x80EE +#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#endif +#endif /* GL_ARB_indirect_parameters */ + +#ifndef GL_ARB_internalformat_query +#define GL_ARB_internalformat_query 1 +#endif /* GL_ARB_internalformat_query */ + +#ifndef GL_ARB_internalformat_query2 +#define GL_ARB_internalformat_query2 1 +#define GL_SRGB_DECODE_ARB 0x8299 +#endif /* GL_ARB_internalformat_query2 */ + +#ifndef GL_ARB_invalidate_subdata +#define GL_ARB_invalidate_subdata 1 +#endif /* GL_ARB_invalidate_subdata */ + +#ifndef GL_ARB_map_buffer_alignment +#define GL_ARB_map_buffer_alignment 1 +#endif /* GL_ARB_map_buffer_alignment */ + +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 +#endif /* GL_ARB_map_buffer_range */ + +#ifndef GL_ARB_multi_bind +#define GL_ARB_multi_bind 1 +#endif /* GL_ARB_multi_bind */ + +#ifndef GL_ARB_multi_draw_indirect +#define GL_ARB_multi_draw_indirect 1 +#endif /* GL_ARB_multi_draw_indirect */ + +#ifndef GL_ARB_occlusion_query2 +#define GL_ARB_occlusion_query2 1 +#endif /* GL_ARB_occlusion_query2 */ + +#ifndef GL_ARB_pipeline_statistics_query +#define GL_ARB_pipeline_statistics_query 1 +#define GL_VERTICES_SUBMITTED_ARB 0x82EE +#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 +#endif /* GL_ARB_pipeline_statistics_query */ + +#ifndef GL_ARB_program_interface_query +#define GL_ARB_program_interface_query 1 +#endif /* GL_ARB_program_interface_query */ + +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 +#endif /* GL_ARB_provoking_vertex */ + +#ifndef GL_ARB_query_buffer_object +#define GL_ARB_query_buffer_object 1 +#endif /* GL_ARB_query_buffer_object */ + +#ifndef GL_ARB_robust_buffer_access_behavior +#define GL_ARB_robust_buffer_access_behavior 1 +#endif /* GL_ARB_robust_buffer_access_behavior */ + +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); +typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); +GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); +GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img); +GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +#endif +#endif /* GL_ARB_robustness */ + +#ifndef GL_ARB_robustness_isolation +#define GL_ARB_robustness_isolation 1 +#endif /* GL_ARB_robustness_isolation */ + +#ifndef GL_ARB_sample_shading +#define GL_ARB_sample_shading 1 +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); +#endif +#endif /* GL_ARB_sample_shading */ + +#ifndef GL_ARB_sampler_objects +#define GL_ARB_sampler_objects 1 +#endif /* GL_ARB_sampler_objects */ + +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 +#endif /* GL_ARB_seamless_cube_map */ + +#ifndef GL_ARB_seamless_cubemap_per_texture +#define GL_ARB_seamless_cubemap_per_texture 1 +#endif /* GL_ARB_seamless_cubemap_per_texture */ + +#ifndef GL_ARB_separate_shader_objects +#define GL_ARB_separate_shader_objects 1 +#endif /* GL_ARB_separate_shader_objects */ + +#ifndef GL_ARB_shader_atomic_counters +#define GL_ARB_shader_atomic_counters 1 +#endif /* GL_ARB_shader_atomic_counters */ + +#ifndef GL_ARB_shader_bit_encoding +#define GL_ARB_shader_bit_encoding 1 +#endif /* GL_ARB_shader_bit_encoding */ + +#ifndef GL_ARB_shader_draw_parameters +#define GL_ARB_shader_draw_parameters 1 +#endif /* GL_ARB_shader_draw_parameters */ + +#ifndef GL_ARB_shader_group_vote +#define GL_ARB_shader_group_vote 1 +#endif /* GL_ARB_shader_group_vote */ + +#ifndef GL_ARB_shader_image_load_store +#define GL_ARB_shader_image_load_store 1 +#endif /* GL_ARB_shader_image_load_store */ + +#ifndef GL_ARB_shader_image_size +#define GL_ARB_shader_image_size 1 +#endif /* GL_ARB_shader_image_size */ + +#ifndef GL_ARB_shader_precision +#define GL_ARB_shader_precision 1 +#endif /* GL_ARB_shader_precision */ + +#ifndef GL_ARB_shader_stencil_export +#define GL_ARB_shader_stencil_export 1 +#endif /* GL_ARB_shader_stencil_export */ + +#ifndef GL_ARB_shader_storage_buffer_object +#define GL_ARB_shader_storage_buffer_object 1 +#endif /* GL_ARB_shader_storage_buffer_object */ + +#ifndef GL_ARB_shader_subroutine +#define GL_ARB_shader_subroutine 1 +#endif /* GL_ARB_shader_subroutine */ + +#ifndef GL_ARB_shader_texture_image_samples +#define GL_ARB_shader_texture_image_samples 1 +#endif /* GL_ARB_shader_texture_image_samples */ + +#ifndef GL_ARB_shading_language_420pack +#define GL_ARB_shading_language_420pack 1 +#endif /* GL_ARB_shading_language_420pack */ + +#ifndef GL_ARB_shading_language_include +#define GL_ARB_shading_language_include 1 +#define GL_SHADER_INCLUDE_ARB 0x8DAE +#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 +#define GL_NAMED_STRING_TYPE_ARB 0x8DEA +typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#endif +#endif /* GL_ARB_shading_language_include */ + +#ifndef GL_ARB_shading_language_packing +#define GL_ARB_shading_language_packing 1 +#endif /* GL_ARB_shading_language_packing */ + +#ifndef GL_ARB_sparse_buffer +#define GL_ARB_sparse_buffer 1 +#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 +#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#endif +#endif /* GL_ARB_sparse_buffer */ + +#ifndef GL_ARB_sparse_texture +#define GL_ARB_sparse_texture 1 +#define GL_TEXTURE_SPARSE_ARB 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 +#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA +#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#endif +#endif /* GL_ARB_sparse_texture */ + +#ifndef GL_ARB_stencil_texturing +#define GL_ARB_stencil_texturing 1 +#endif /* GL_ARB_stencil_texturing */ + +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 +#endif /* GL_ARB_sync */ + +#ifndef GL_ARB_tessellation_shader +#define GL_ARB_tessellation_shader 1 +#endif /* GL_ARB_tessellation_shader */ + +#ifndef GL_ARB_texture_barrier +#define GL_ARB_texture_barrier 1 +#endif /* GL_ARB_texture_barrier */ + +#ifndef GL_ARB_texture_buffer_object_rgb32 +#define GL_ARB_texture_buffer_object_rgb32 1 +#endif /* GL_ARB_texture_buffer_object_rgb32 */ + +#ifndef GL_ARB_texture_buffer_range +#define GL_ARB_texture_buffer_range 1 +#endif /* GL_ARB_texture_buffer_range */ + +#ifndef GL_ARB_texture_compression_bptc +#define GL_ARB_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F +#endif /* GL_ARB_texture_compression_bptc */ + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_ARB_texture_compression_rgtc 1 +#endif /* GL_ARB_texture_compression_rgtc */ + +#ifndef GL_ARB_texture_cube_map_array +#define GL_ARB_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F +#endif /* GL_ARB_texture_cube_map_array */ + +#ifndef GL_ARB_texture_gather +#define GL_ARB_texture_gather 1 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F +#endif /* GL_ARB_texture_gather */ + +#ifndef GL_ARB_texture_mirror_clamp_to_edge +#define GL_ARB_texture_mirror_clamp_to_edge 1 +#endif /* GL_ARB_texture_mirror_clamp_to_edge */ + +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 +#endif /* GL_ARB_texture_multisample */ + +#ifndef GL_ARB_texture_query_levels +#define GL_ARB_texture_query_levels 1 +#endif /* GL_ARB_texture_query_levels */ + +#ifndef GL_ARB_texture_query_lod +#define GL_ARB_texture_query_lod 1 +#endif /* GL_ARB_texture_query_lod */ + +#ifndef GL_ARB_texture_rg +#define GL_ARB_texture_rg 1 +#endif /* GL_ARB_texture_rg */ + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_ARB_texture_rgb10_a2ui 1 +#endif /* GL_ARB_texture_rgb10_a2ui */ + +#ifndef GL_ARB_texture_stencil8 +#define GL_ARB_texture_stencil8 1 +#endif /* GL_ARB_texture_stencil8 */ + +#ifndef GL_ARB_texture_storage +#define GL_ARB_texture_storage 1 +#endif /* GL_ARB_texture_storage */ + +#ifndef GL_ARB_texture_storage_multisample +#define GL_ARB_texture_storage_multisample 1 +#endif /* GL_ARB_texture_storage_multisample */ + +#ifndef GL_ARB_texture_swizzle +#define GL_ARB_texture_swizzle 1 +#endif /* GL_ARB_texture_swizzle */ + +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 +#endif /* GL_ARB_texture_view */ + +#ifndef GL_ARB_timer_query +#define GL_ARB_timer_query 1 +#endif /* GL_ARB_timer_query */ + +#ifndef GL_ARB_transform_feedback2 +#define GL_ARB_transform_feedback2 1 +#endif /* GL_ARB_transform_feedback2 */ + +#ifndef GL_ARB_transform_feedback3 +#define GL_ARB_transform_feedback3 1 +#endif /* GL_ARB_transform_feedback3 */ + +#ifndef GL_ARB_transform_feedback_instanced +#define GL_ARB_transform_feedback_instanced 1 +#endif /* GL_ARB_transform_feedback_instanced */ + +#ifndef GL_ARB_transform_feedback_overflow_query +#define GL_ARB_transform_feedback_overflow_query 1 +#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED +#endif /* GL_ARB_transform_feedback_overflow_query */ + +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 +#endif /* GL_ARB_uniform_buffer_object */ + +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 +#endif /* GL_ARB_vertex_array_bgra */ + +#ifndef GL_ARB_vertex_array_object +#define GL_ARB_vertex_array_object 1 +#endif /* GL_ARB_vertex_array_object */ + +#ifndef GL_ARB_vertex_attrib_64bit +#define GL_ARB_vertex_attrib_64bit 1 +#endif /* GL_ARB_vertex_attrib_64bit */ + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 +#endif /* GL_ARB_vertex_attrib_binding */ + +#ifndef GL_ARB_vertex_type_10f_11f_11f_rev +#define GL_ARB_vertex_type_10f_11f_11f_rev 1 +#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ + +#ifndef GL_ARB_vertex_type_2_10_10_10_rev +#define GL_ARB_vertex_type_2_10_10_10_rev 1 +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ + +#ifndef GL_ARB_viewport_array +#define GL_ARB_viewport_array 1 +#endif /* GL_ARB_viewport_array */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#endif /* GL_KHR_context_flush_control */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +#endif /* GL_KHR_debug */ + +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 +#endif /* GL_KHR_robustness */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_hdr */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif /* GL_KHR_texture_compression_astc_ldr */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/rust/khronos_api/api/GL/glext.h b/third_party/rust/khronos_api/api/GL/glext.h new file mode 100755 index 000000000000..64f707081595 --- /dev/null +++ b/third_party/rust/khronos_api/api/GL/glext.h @@ -0,0 +1,12046 @@ +#ifndef __glext_h_ +#define __glext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision$ on $Date$ +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +#define GL_GLEXT_VERSION 20150809 + +/* Generated C header for: + * API: gl + * Profile: compatibility + * Versions considered: .* + * Versions emitted: 1\.[2-9]|[234]\.[0-9] + * Default extensions included: gl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_VERSION_1_2 */ + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum texture); +GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img); +GLAPI void APIENTRY glClientActiveTexture (GLenum texture); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); +#endif +#endif /* GL_VERSION_1_3 */ + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); +GLAPI void APIENTRY glFogCoordf (GLfloat coord); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord); +GLAPI void APIENTRY glFogCoordd (GLdouble coord); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord); +GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v); +GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v); +GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v); +GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2iv (const GLint *v); +GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *v); +GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3iv (const GLint *v); +GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *v); +GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glBlendEquation (GLenum mode); +#endif +#endif /* GL_VERSION_1_4 */ + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#include +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptr; +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_SRC1_ALPHA 0x8589 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC2_ALPHA 0x858A +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); +typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQuery (GLuint id); +GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQuery (GLenum target); +GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); +GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_VERSION_1_5 */ + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +typedef char GLchar; +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY glCompileShader (GLuint shader); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum type); +GLAPI void APIENTRY glDeleteProgram (GLuint program); +GLAPI void APIENTRY glDeleteShader (GLuint shader); +GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GLAPI GLboolean APIENTRY glIsProgram (GLuint program); +GLAPI GLboolean APIENTRY glIsShader (GLuint shader); +GLAPI void APIENTRY glLinkProgram (GLuint program); +GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GLAPI void APIENTRY glUseProgram (GLuint program); +GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glValidateProgram (GLuint program); +GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +#endif +#endif /* GL_VERSION_2_0 */ + +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_VERSION_2_1 */ + +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +typedef unsigned short GLhalf; +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_COLOR_ATTACHMENT16 0x8CF0 +#define GL_COLOR_ATTACHMENT17 0x8CF1 +#define GL_COLOR_ATTACHMENT18 0x8CF2 +#define GL_COLOR_ATTACHMENT19 0x8CF3 +#define GL_COLOR_ATTACHMENT20 0x8CF4 +#define GL_COLOR_ATTACHMENT21 0x8CF5 +#define GL_COLOR_ATTACHMENT22 0x8CF6 +#define GL_COLOR_ATTACHMENT23 0x8CF7 +#define GL_COLOR_ATTACHMENT24 0x8CF8 +#define GL_COLOR_ATTACHMENT25 0x8CF9 +#define GL_COLOR_ATTACHMENT26 0x8CFA +#define GL_COLOR_ATTACHMENT27 0x8CFB +#define GL_COLOR_ATTACHMENT28 0x8CFC +#define GL_COLOR_ATTACHMENT29 0x8CFD +#define GL_COLOR_ATTACHMENT30 0x8CFE +#define GL_COLOR_ATTACHMENT31 0x8CFF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#define GL_INDEX 0x8222 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_HALF_FLOAT 0x140B +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_ALPHA_INTEGER 0x8D97 +typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); +GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); +GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedback (void); +GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); +GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRender (void); +GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index); +GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmap (GLenum target); +GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glBindVertexArray (GLuint array); +GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); +#endif +#endif /* GL_VERSION_3_0 */ + +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFFu +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); +GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#endif +#endif /* GL_VERSION_3_1 */ + +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +typedef struct __GLsync *GLsync; +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif +typedef uint64_t GLuint64; +typedef int64_t GLint64; +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_DEPTH_CLAMP 0x864F +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); +typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +GLAPI void APIENTRY glProvokingVertex (GLenum mode); +GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); +GLAPI GLboolean APIENTRY glIsSync (GLsync sync); +GLAPI void APIENTRY glDeleteSync (GLsync sync); +GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); +GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); +#endif +#endif /* GL_VERSION_3_2 */ + +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#define GL_SRC1_COLOR 0x88F9 +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_SAMPLER_BINDING 0x8919 +#define GL_RGB10_A2UI 0x906F +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#define GL_INT_2_10_10_10_REV 0x8D9F +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); +typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); +typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); +GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); +GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); +GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); +GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); +GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); +GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); +GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); +GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); +GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); +GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); +GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color); +GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color); +GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color); +GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color); +GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color); +GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color); +#endif +#endif /* GL_VERSION_3_3 */ + +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +#define GL_PATCHES 0x000E +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +#define GL_ISOLINES 0x8E7A +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRACTIONAL_EVEN 0x8E7C +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect); +typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); +typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); +typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); +typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShading (GLfloat value); +GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect); +GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect); +GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); +GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); +GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); +GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); +GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); +GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); +GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedback (void); +GLAPI void APIENTRY glResumeTransformFeedback (void); +GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); +GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); +GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); +GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); +GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); +#endif +#endif /* GL_VERSION_4_0 */ + +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_RGB565 0x8D62 +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings); +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReleaseShaderCompiler (void); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GLAPI void APIENTRY glClearDepthf (GLfloat d); +GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); +GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); +GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); +GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); +GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); +GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); +GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); +#endif +#endif /* GL_VERSION_4_1 */ + +#ifndef GL_VERSION_4_2 +#define GL_VERSION_4_2 1 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 +#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 +#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 +#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A +#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B +#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C +#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D +#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E +#define GL_NUM_SAMPLE_COUNTS 0x9380 +#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_1D 0x904C +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_2D_RECT 0x904F +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_BUFFER 0x9051 +#define GL_IMAGE_1D_ARRAY 0x9052 +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 +#define GL_INT_IMAGE_1D 0x9057 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_2D_RECT 0x905A +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_BUFFER 0x905C +#define GL_INT_IMAGE_1D_ARRAY 0x905D +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C +#define GL_MAX_IMAGE_SAMPLES 0x906D +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); +GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); +GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +#endif +#endif /* GL_VERSION_4_2 */ + +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_MAX_WIDTH 0x827E +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_MIPMAP 0x8293 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_COLOR_ENCODING 0x8296 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_FILTER 0x829A +#define GL_VERTEX_TEXTURE 0x829B +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#define GL_NAME_LENGTH 0x92F9 +#define GL_TYPE 0x92FA +#define GL_ARRAY_SIZE 0x92FB +#define GL_OFFSET 0x92FC +#define GL_BLOCK_INDEX 0x92FD +#define GL_ARRAY_STRIDE 0x92FE +#define GL_MATRIX_STRIDE 0x92FF +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_LOCATION 0x930E +#define GL_LOCATION_INDEX 0x930F +#define GL_IS_PER_PATCH 0x92E7 +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF +#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_VERTEX_BINDING_BUFFER 0x8F4F +#define GL_DISPLAY_LIST 0x82E7 +typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); +typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); +GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); +GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); +GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI void APIENTRY glPopDebugGroup (void); +GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_VERSION_4_3 */ + +#ifndef GL_VERSION_4_4 +#define GL_VERSION_4_4 1 +#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_TEXTURE_BUFFER_BINDING 0x8C2A +#define GL_MAP_PERSISTENT_BIT 0x0040 +#define GL_MAP_COHERENT_BIT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT 0x0100 +#define GL_CLIENT_STORAGE_BIT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F +#define GL_BUFFER_STORAGE_FLAGS 0x8220 +#define GL_CLEAR_TEXTURE 0x9365 +#define GL_LOCATION_COMPONENT 0x934A +#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B +#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C +#define GL_QUERY_BUFFER 0x9192 +#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 +#define GL_QUERY_BUFFER_BINDING 0x9193 +#define GL_QUERY_RESULT_NO_WAIT 0x9194 +#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 +typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers); +GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#endif +#endif /* GL_VERSION_4_4 */ + +#ifndef GL_VERSION_4_5 +#define GL_VERSION_4_5 1 +#define GL_CONTEXT_LOST 0x0507 +#define GL_NEGATIVE_ONE_TO_ONE 0x935E +#define GL_ZERO_TO_ONE 0x935F +#define GL_CLIP_ORIGIN 0x935C +#define GL_CLIP_DEPTH_MODE 0x935D +#define GL_QUERY_WAIT_INVERTED 0x8E17 +#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 +#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 +#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A +#define GL_MAX_CULL_DISTANCES 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA +#define GL_TEXTURE_TARGET 0x1006 +#define GL_QUERY_TARGET 0x82EA +#define GL_GUILTY_CONTEXT_RESET 0x8253 +#define GL_INNOCENT_CONTEXT_RESET 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET 0x8252 +#define GL_NO_RESET_NOTIFICATION 0x8261 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC +typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); +typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil); +typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); +typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLGETNMAPDVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLGETNMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth); +GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers); +GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access); +GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer); +GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params); +GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf); +GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src); +GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil); +GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures); +GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param); +GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture); +GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture); +GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays); +GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer); +GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); +GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); +GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); +GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void); +GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glGetnMapdv (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfv (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapiv (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfv (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuiv (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusv (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStipple (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTable (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +GLAPI void APIENTRY glGetnConvolutionFilter (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +GLAPI void APIENTRY glGetnSeparableFilter (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +GLAPI void APIENTRY glGetnHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glGetnMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glTextureBarrier (void); +#endif +#endif /* GL_VERSION_4_5 */ + +#ifndef GL_ARB_ES2_compatibility +#define GL_ARB_ES2_compatibility 1 +#endif /* GL_ARB_ES2_compatibility */ + +#ifndef GL_ARB_ES3_1_compatibility +#define GL_ARB_ES3_1_compatibility 1 +#endif /* GL_ARB_ES3_1_compatibility */ + +#ifndef GL_ARB_ES3_2_compatibility +#define GL_ARB_ES3_2_compatibility 1 +#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE +#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381 +#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382 +typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveBoundingBoxARB (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_ARB_ES3_2_compatibility */ + +#ifndef GL_ARB_ES3_compatibility +#define GL_ARB_ES3_compatibility 1 +#endif /* GL_ARB_ES3_compatibility */ + +#ifndef GL_ARB_arrays_of_arrays +#define GL_ARB_arrays_of_arrays 1 +#endif /* GL_ARB_arrays_of_arrays */ + +#ifndef GL_ARB_base_instance +#define GL_ARB_base_instance 1 +#endif /* GL_ARB_base_instance */ + +#ifndef GL_ARB_bindless_texture +#define GL_ARB_bindless_texture 1 +typedef uint64_t GLuint64EXT; +#define GL_UNSIGNED_INT64_ARB 0x140F +typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture); +GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler); +GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle); +GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access); +GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle); +GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value); +GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value); +GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle); +GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params); +#endif +#endif /* GL_ARB_bindless_texture */ + +#ifndef GL_ARB_blend_func_extended +#define GL_ARB_blend_func_extended 1 +#endif /* GL_ARB_blend_func_extended */ + +#ifndef GL_ARB_buffer_storage +#define GL_ARB_buffer_storage 1 +#endif /* GL_ARB_buffer_storage */ + +#ifndef GL_ARB_cl_event +#define GL_ARB_cl_event 1 +struct _cl_context; +struct _cl_event; +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 +typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#endif +#endif /* GL_ARB_cl_event */ + +#ifndef GL_ARB_clear_buffer_object +#define GL_ARB_clear_buffer_object 1 +#endif /* GL_ARB_clear_buffer_object */ + +#ifndef GL_ARB_clear_texture +#define GL_ARB_clear_texture 1 +#endif /* GL_ARB_clear_texture */ + +#ifndef GL_ARB_clip_control +#define GL_ARB_clip_control 1 +#endif /* GL_ARB_clip_control */ + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); +#endif +#endif /* GL_ARB_color_buffer_float */ + +#ifndef GL_ARB_compatibility +#define GL_ARB_compatibility 1 +#endif /* GL_ARB_compatibility */ + +#ifndef GL_ARB_compressed_texture_pixel_storage +#define GL_ARB_compressed_texture_pixel_storage 1 +#endif /* GL_ARB_compressed_texture_pixel_storage */ + +#ifndef GL_ARB_compute_shader +#define GL_ARB_compute_shader 1 +#endif /* GL_ARB_compute_shader */ + +#ifndef GL_ARB_compute_variable_group_size +#define GL_ARB_compute_variable_group_size 1 +#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 +#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB +#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 +#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +#endif +#endif /* GL_ARB_compute_variable_group_size */ + +#ifndef GL_ARB_conditional_render_inverted +#define GL_ARB_conditional_render_inverted 1 +#endif /* GL_ARB_conditional_render_inverted */ + +#ifndef GL_ARB_conservative_depth +#define GL_ARB_conservative_depth 1 +#endif /* GL_ARB_conservative_depth */ + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 +#endif /* GL_ARB_copy_buffer */ + +#ifndef GL_ARB_copy_image +#define GL_ARB_copy_image 1 +#endif /* GL_ARB_copy_image */ + +#ifndef GL_ARB_cull_distance +#define GL_ARB_cull_distance 1 +#endif /* GL_ARB_cull_distance */ + +#ifndef GL_ARB_debug_output +#define GL_ARB_debug_output 1 +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#endif +#endif /* GL_ARB_debug_output */ + +#ifndef GL_ARB_depth_buffer_float +#define GL_ARB_depth_buffer_float 1 +#endif /* GL_ARB_depth_buffer_float */ + +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +#endif /* GL_ARB_depth_clamp */ + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif /* GL_ARB_depth_texture */ + +#ifndef GL_ARB_derivative_control +#define GL_ARB_derivative_control 1 +#endif /* GL_ARB_derivative_control */ + +#ifndef GL_ARB_direct_state_access +#define GL_ARB_direct_state_access 1 +#endif /* GL_ARB_direct_state_access */ + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_ARB_draw_buffers */ + +#ifndef GL_ARB_draw_buffers_blend +#define GL_ARB_draw_buffers_blend 1 +typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif +#endif /* GL_ARB_draw_buffers_blend */ + +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 +#endif /* GL_ARB_draw_elements_base_vertex */ + +#ifndef GL_ARB_draw_indirect +#define GL_ARB_draw_indirect 1 +#endif /* GL_ARB_draw_indirect */ + +#ifndef GL_ARB_draw_instanced +#define GL_ARB_draw_instanced 1 +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_ARB_draw_instanced */ + +#ifndef GL_ARB_enhanced_layouts +#define GL_ARB_enhanced_layouts 1 +#endif /* GL_ARB_enhanced_layouts */ + +#ifndef GL_ARB_explicit_attrib_location +#define GL_ARB_explicit_attrib_location 1 +#endif /* GL_ARB_explicit_attrib_location */ + +#ifndef GL_ARB_explicit_uniform_location +#define GL_ARB_explicit_uniform_location 1 +#endif /* GL_ARB_explicit_uniform_location */ + +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 +#endif /* GL_ARB_fragment_coord_conventions */ + +#ifndef GL_ARB_fragment_layer_viewport +#define GL_ARB_fragment_layer_viewport 1 +#endif /* GL_ARB_fragment_layer_viewport */ + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const void *string); +GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, void *string); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); +#endif +#endif /* GL_ARB_fragment_program */ + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif /* GL_ARB_fragment_program_shadow */ + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif /* GL_ARB_fragment_shader */ + +#ifndef GL_ARB_fragment_shader_interlock +#define GL_ARB_fragment_shader_interlock 1 +#endif /* GL_ARB_fragment_shader_interlock */ + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_ARB_framebuffer_no_attachments 1 +#endif /* GL_ARB_framebuffer_no_attachments */ + +#ifndef GL_ARB_framebuffer_object +#define GL_ARB_framebuffer_object 1 +#endif /* GL_ARB_framebuffer_object */ + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_ARB_framebuffer_sRGB 1 +#endif /* GL_ARB_framebuffer_sRGB */ + +#ifndef GL_ARB_geometry_shader4 +#define GL_ARB_geometry_shader4 1 +#define GL_LINES_ADJACENCY_ARB 0x000A +#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B +#define GL_TRIANGLES_ADJACENCY_ARB 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D +#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 +#define GL_GEOMETRY_SHADER_ARB 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif +#endif /* GL_ARB_geometry_shader4 */ + +#ifndef GL_ARB_get_program_binary +#define GL_ARB_get_program_binary 1 +#endif /* GL_ARB_get_program_binary */ + +#ifndef GL_ARB_get_texture_sub_image +#define GL_ARB_get_texture_sub_image 1 +#endif /* GL_ARB_get_texture_sub_image */ + +#ifndef GL_ARB_gpu_shader5 +#define GL_ARB_gpu_shader5 1 +#endif /* GL_ARB_gpu_shader5 */ + +#ifndef GL_ARB_gpu_shader_fp64 +#define GL_ARB_gpu_shader_fp64 1 +#endif /* GL_ARB_gpu_shader_fp64 */ + +#ifndef GL_ARB_gpu_shader_int64 +#define GL_ARB_gpu_shader_int64 1 +#define GL_INT64_ARB 0x140E +#define GL_INT64_VEC2_ARB 0x8FE9 +#define GL_INT64_VEC3_ARB 0x8FEA +#define GL_INT64_VEC4_ARB 0x8FEB +#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7 +typedef void (APIENTRYP PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x); +typedef void (APIENTRYP PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y); +typedef void (APIENTRYP PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (APIENTRYP PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64 *params); +typedef void (APIENTRYP PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64 *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64ARB (GLint location, GLint64 x); +GLAPI void APIENTRY glUniform2i64ARB (GLint location, GLint64 x, GLint64 y); +GLAPI void APIENTRY glUniform3i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z); +GLAPI void APIENTRY glUniform4i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +GLAPI void APIENTRY glUniform1i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform2i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform3i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform4i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform1ui64ARB (GLint location, GLuint64 x); +GLAPI void APIENTRY glUniform2ui64ARB (GLint location, GLuint64 x, GLuint64 y); +GLAPI void APIENTRY glUniform3ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +GLAPI void APIENTRY glUniform4ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +GLAPI void APIENTRY glUniform1ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform2ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform3ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform4ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glGetUniformi64vARB (GLuint program, GLint location, GLint64 *params); +GLAPI void APIENTRY glGetUniformui64vARB (GLuint program, GLint location, GLuint64 *params); +GLAPI void APIENTRY glGetnUniformi64vARB (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glGetnUniformui64vARB (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); +GLAPI void APIENTRY glProgramUniform1i64ARB (GLuint program, GLint location, GLint64 x); +GLAPI void APIENTRY glProgramUniform2i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y); +GLAPI void APIENTRY glProgramUniform3i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); +GLAPI void APIENTRY glProgramUniform4i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +GLAPI void APIENTRY glProgramUniform1i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform2i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform3i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform4i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform1ui64ARB (GLuint program, GLint location, GLuint64 x); +GLAPI void APIENTRY glProgramUniform2ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y); +GLAPI void APIENTRY glProgramUniform3ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +GLAPI void APIENTRY glProgramUniform4ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +GLAPI void APIENTRY glProgramUniform1ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform2ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform3ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform4ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +#endif +#endif /* GL_ARB_gpu_shader_int64 */ + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +typedef unsigned short GLhalfARB; +#define GL_HALF_FLOAT_ARB 0x140B +#endif /* GL_ARB_half_float_pixel */ + +#ifndef GL_ARB_half_float_vertex +#define GL_ARB_half_float_vertex 1 +#endif /* GL_ARB_half_float_vertex */ + +#ifndef GL_ARB_imaging +#define GL_ARB_imaging 1 +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_EQUATION 0x8009 +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, void *table); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, void *image); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glResetHistogram (GLenum target); +GLAPI void APIENTRY glResetMinmax (GLenum target); +#endif +#endif /* GL_ARB_imaging */ + +#ifndef GL_ARB_indirect_parameters +#define GL_ARB_indirect_parameters 1 +#define GL_PARAMETER_BUFFER_ARB 0x80EE +#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#endif +#endif /* GL_ARB_indirect_parameters */ + +#ifndef GL_ARB_instanced_arrays +#define GL_ARB_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor); +#endif +#endif /* GL_ARB_instanced_arrays */ + +#ifndef GL_ARB_internalformat_query +#define GL_ARB_internalformat_query 1 +#endif /* GL_ARB_internalformat_query */ + +#ifndef GL_ARB_internalformat_query2 +#define GL_ARB_internalformat_query2 1 +#define GL_SRGB_DECODE_ARB 0x8299 +#endif /* GL_ARB_internalformat_query2 */ + +#ifndef GL_ARB_invalidate_subdata +#define GL_ARB_invalidate_subdata 1 +#endif /* GL_ARB_invalidate_subdata */ + +#ifndef GL_ARB_map_buffer_alignment +#define GL_ARB_map_buffer_alignment 1 +#endif /* GL_ARB_map_buffer_alignment */ + +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 +#endif /* GL_ARB_map_buffer_range */ + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_ARB_matrix_palette */ + +#ifndef GL_ARB_multi_bind +#define GL_ARB_multi_bind 1 +#endif /* GL_ARB_multi_bind */ + +#ifndef GL_ARB_multi_draw_indirect +#define GL_ARB_multi_draw_indirect 1 +#endif /* GL_ARB_multi_draw_indirect */ + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLfloat value, GLboolean invert); +#endif +#endif /* GL_ARB_multisample */ + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum texture); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v); +#endif +#endif /* GL_ARB_multitexture */ + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id); +GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQueryARB (GLenum target); +GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params); +#endif +#endif /* GL_ARB_occlusion_query */ + +#ifndef GL_ARB_occlusion_query2 +#define GL_ARB_occlusion_query2 1 +#endif /* GL_ARB_occlusion_query2 */ + +#ifndef GL_ARB_parallel_shader_compile +#define GL_ARB_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0 +#define GL_COMPLETION_STATUS_ARB 0x91B1 +typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMaxShaderCompilerThreadsARB (GLuint count); +#endif +#endif /* GL_ARB_parallel_shader_compile */ + +#ifndef GL_ARB_pipeline_statistics_query +#define GL_ARB_pipeline_statistics_query 1 +#define GL_VERTICES_SUBMITTED_ARB 0x82EE +#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 +#endif /* GL_ARB_pipeline_statistics_query */ + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif /* GL_ARB_pixel_buffer_object */ + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params); +#endif +#endif /* GL_ARB_point_parameters */ + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif /* GL_ARB_point_sprite */ + +#ifndef GL_ARB_post_depth_coverage +#define GL_ARB_post_depth_coverage 1 +#endif /* GL_ARB_post_depth_coverage */ + +#ifndef GL_ARB_program_interface_query +#define GL_ARB_program_interface_query 1 +#endif /* GL_ARB_program_interface_query */ + +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 +#endif /* GL_ARB_provoking_vertex */ + +#ifndef GL_ARB_query_buffer_object +#define GL_ARB_query_buffer_object 1 +#endif /* GL_ARB_query_buffer_object */ + +#ifndef GL_ARB_robust_buffer_access_behavior +#define GL_ARB_robust_buffer_access_behavior 1 +#endif /* GL_ARB_robust_buffer_access_behavior */ + +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); +typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); +GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); +GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img); +GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +#endif +#endif /* GL_ARB_robustness */ + +#ifndef GL_ARB_robustness_isolation +#define GL_ARB_robustness_isolation 1 +#endif /* GL_ARB_robustness_isolation */ + +#ifndef GL_ARB_sample_locations +#define GL_ARB_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340 +#define GL_SAMPLE_LOCATION_ARB 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343 +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLEVALUATEDEPTHVALUESARBPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSampleLocationsfvARB (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvARB (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glEvaluateDepthValuesARB (void); +#endif +#endif /* GL_ARB_sample_locations */ + +#ifndef GL_ARB_sample_shading +#define GL_ARB_sample_shading 1 +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); +#endif +#endif /* GL_ARB_sample_shading */ + +#ifndef GL_ARB_sampler_objects +#define GL_ARB_sampler_objects 1 +#endif /* GL_ARB_sampler_objects */ + +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 +#endif /* GL_ARB_seamless_cube_map */ + +#ifndef GL_ARB_seamless_cubemap_per_texture +#define GL_ARB_seamless_cubemap_per_texture 1 +#endif /* GL_ARB_seamless_cubemap_per_texture */ + +#ifndef GL_ARB_separate_shader_objects +#define GL_ARB_separate_shader_objects 1 +#endif /* GL_ARB_separate_shader_objects */ + +#ifndef GL_ARB_shader_atomic_counter_ops +#define GL_ARB_shader_atomic_counter_ops 1 +#endif /* GL_ARB_shader_atomic_counter_ops */ + +#ifndef GL_ARB_shader_atomic_counters +#define GL_ARB_shader_atomic_counters 1 +#endif /* GL_ARB_shader_atomic_counters */ + +#ifndef GL_ARB_shader_ballot +#define GL_ARB_shader_ballot 1 +#endif /* GL_ARB_shader_ballot */ + +#ifndef GL_ARB_shader_bit_encoding +#define GL_ARB_shader_bit_encoding 1 +#endif /* GL_ARB_shader_bit_encoding */ + +#ifndef GL_ARB_shader_clock +#define GL_ARB_shader_clock 1 +#endif /* GL_ARB_shader_clock */ + +#ifndef GL_ARB_shader_draw_parameters +#define GL_ARB_shader_draw_parameters 1 +#endif /* GL_ARB_shader_draw_parameters */ + +#ifndef GL_ARB_shader_group_vote +#define GL_ARB_shader_group_vote 1 +#endif /* GL_ARB_shader_group_vote */ + +#ifndef GL_ARB_shader_image_load_store +#define GL_ARB_shader_image_load_store 1 +#endif /* GL_ARB_shader_image_load_store */ + +#ifndef GL_ARB_shader_image_size +#define GL_ARB_shader_image_size 1 +#endif /* GL_ARB_shader_image_size */ + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif +typedef char GLcharARB; +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif +#endif /* GL_ARB_shader_objects */ + +#ifndef GL_ARB_shader_precision +#define GL_ARB_shader_precision 1 +#endif /* GL_ARB_shader_precision */ + +#ifndef GL_ARB_shader_stencil_export +#define GL_ARB_shader_stencil_export 1 +#endif /* GL_ARB_shader_stencil_export */ + +#ifndef GL_ARB_shader_storage_buffer_object +#define GL_ARB_shader_storage_buffer_object 1 +#endif /* GL_ARB_shader_storage_buffer_object */ + +#ifndef GL_ARB_shader_subroutine +#define GL_ARB_shader_subroutine 1 +#endif /* GL_ARB_shader_subroutine */ + +#ifndef GL_ARB_shader_texture_image_samples +#define GL_ARB_shader_texture_image_samples 1 +#endif /* GL_ARB_shader_texture_image_samples */ + +#ifndef GL_ARB_shader_texture_lod +#define GL_ARB_shader_texture_lod 1 +#endif /* GL_ARB_shader_texture_lod */ + +#ifndef GL_ARB_shader_viewport_layer_array +#define GL_ARB_shader_viewport_layer_array 1 +#endif /* GL_ARB_shader_viewport_layer_array */ + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif /* GL_ARB_shading_language_100 */ + +#ifndef GL_ARB_shading_language_420pack +#define GL_ARB_shading_language_420pack 1 +#endif /* GL_ARB_shading_language_420pack */ + +#ifndef GL_ARB_shading_language_include +#define GL_ARB_shading_language_include 1 +#define GL_SHADER_INCLUDE_ARB 0x8DAE +#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 +#define GL_NAMED_STRING_TYPE_ARB 0x8DEA +typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#endif +#endif /* GL_ARB_shading_language_include */ + +#ifndef GL_ARB_shading_language_packing +#define GL_ARB_shading_language_packing 1 +#endif /* GL_ARB_shading_language_packing */ + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif /* GL_ARB_shadow */ + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif /* GL_ARB_shadow_ambient */ + +#ifndef GL_ARB_sparse_buffer +#define GL_ARB_sparse_buffer 1 +#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 +#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#endif +#endif /* GL_ARB_sparse_buffer */ + +#ifndef GL_ARB_sparse_texture +#define GL_ARB_sparse_texture 1 +#define GL_TEXTURE_SPARSE_ARB 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 +#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA +#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#endif +#endif /* GL_ARB_sparse_texture */ + +#ifndef GL_ARB_sparse_texture2 +#define GL_ARB_sparse_texture2 1 +#endif /* GL_ARB_sparse_texture2 */ + +#ifndef GL_ARB_sparse_texture_clamp +#define GL_ARB_sparse_texture_clamp 1 +#endif /* GL_ARB_sparse_texture_clamp */ + +#ifndef GL_ARB_stencil_texturing +#define GL_ARB_stencil_texturing 1 +#endif /* GL_ARB_stencil_texturing */ + +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 +#endif /* GL_ARB_sync */ + +#ifndef GL_ARB_tessellation_shader +#define GL_ARB_tessellation_shader 1 +#endif /* GL_ARB_tessellation_shader */ + +#ifndef GL_ARB_texture_barrier +#define GL_ARB_texture_barrier 1 +#endif /* GL_ARB_texture_barrier */ + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif /* GL_ARB_texture_border_clamp */ + +#ifndef GL_ARB_texture_buffer_object +#define GL_ARB_texture_buffer_object 1 +#define GL_TEXTURE_BUFFER_ARB 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E +typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer); +#endif +#endif /* GL_ARB_texture_buffer_object */ + +#ifndef GL_ARB_texture_buffer_object_rgb32 +#define GL_ARB_texture_buffer_object_rgb32 1 +#endif /* GL_ARB_texture_buffer_object_rgb32 */ + +#ifndef GL_ARB_texture_buffer_range +#define GL_ARB_texture_buffer_range 1 +#endif /* GL_ARB_texture_buffer_range */ + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void *img); +#endif +#endif /* GL_ARB_texture_compression */ + +#ifndef GL_ARB_texture_compression_bptc +#define GL_ARB_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F +#endif /* GL_ARB_texture_compression_bptc */ + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_ARB_texture_compression_rgtc 1 +#endif /* GL_ARB_texture_compression_rgtc */ + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif /* GL_ARB_texture_cube_map */ + +#ifndef GL_ARB_texture_cube_map_array +#define GL_ARB_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F +#endif /* GL_ARB_texture_cube_map_array */ + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif /* GL_ARB_texture_env_add */ + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif /* GL_ARB_texture_env_combine */ + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif /* GL_ARB_texture_env_crossbar */ + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif /* GL_ARB_texture_env_dot3 */ + +#ifndef GL_ARB_texture_filter_minmax +#define GL_ARB_texture_filter_minmax 1 +#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366 +#define GL_WEIGHTED_AVERAGE_ARB 0x9367 +#endif /* GL_ARB_texture_filter_minmax */ + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif /* GL_ARB_texture_float */ + +#ifndef GL_ARB_texture_gather +#define GL_ARB_texture_gather 1 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F +#endif /* GL_ARB_texture_gather */ + +#ifndef GL_ARB_texture_mirror_clamp_to_edge +#define GL_ARB_texture_mirror_clamp_to_edge 1 +#endif /* GL_ARB_texture_mirror_clamp_to_edge */ + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif /* GL_ARB_texture_mirrored_repeat */ + +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 +#endif /* GL_ARB_texture_multisample */ + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif /* GL_ARB_texture_non_power_of_two */ + +#ifndef GL_ARB_texture_query_levels +#define GL_ARB_texture_query_levels 1 +#endif /* GL_ARB_texture_query_levels */ + +#ifndef GL_ARB_texture_query_lod +#define GL_ARB_texture_query_lod 1 +#endif /* GL_ARB_texture_query_lod */ + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif /* GL_ARB_texture_rectangle */ + +#ifndef GL_ARB_texture_rg +#define GL_ARB_texture_rg 1 +#endif /* GL_ARB_texture_rg */ + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_ARB_texture_rgb10_a2ui 1 +#endif /* GL_ARB_texture_rgb10_a2ui */ + +#ifndef GL_ARB_texture_stencil8 +#define GL_ARB_texture_stencil8 1 +#endif /* GL_ARB_texture_stencil8 */ + +#ifndef GL_ARB_texture_storage +#define GL_ARB_texture_storage 1 +#endif /* GL_ARB_texture_storage */ + +#ifndef GL_ARB_texture_storage_multisample +#define GL_ARB_texture_storage_multisample 1 +#endif /* GL_ARB_texture_storage_multisample */ + +#ifndef GL_ARB_texture_swizzle +#define GL_ARB_texture_swizzle 1 +#endif /* GL_ARB_texture_swizzle */ + +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 +#endif /* GL_ARB_texture_view */ + +#ifndef GL_ARB_timer_query +#define GL_ARB_timer_query 1 +#endif /* GL_ARB_timer_query */ + +#ifndef GL_ARB_transform_feedback2 +#define GL_ARB_transform_feedback2 1 +#endif /* GL_ARB_transform_feedback2 */ + +#ifndef GL_ARB_transform_feedback3 +#define GL_ARB_transform_feedback3 1 +#endif /* GL_ARB_transform_feedback3 */ + +#ifndef GL_ARB_transform_feedback_instanced +#define GL_ARB_transform_feedback_instanced 1 +#endif /* GL_ARB_transform_feedback_instanced */ + +#ifndef GL_ARB_transform_feedback_overflow_query +#define GL_ARB_transform_feedback_overflow_query 1 +#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED +#endif /* GL_ARB_transform_feedback_overflow_query */ + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); +#endif +#endif /* GL_ARB_transpose_matrix */ + +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 +#endif /* GL_ARB_uniform_buffer_object */ + +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 +#endif /* GL_ARB_vertex_array_bgra */ + +#ifndef GL_ARB_vertex_array_object +#define GL_ARB_vertex_array_object 1 +#endif /* GL_ARB_vertex_array_object */ + +#ifndef GL_ARB_vertex_attrib_64bit +#define GL_ARB_vertex_attrib_64bit 1 +#endif /* GL_ARB_vertex_attrib_64bit */ + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 +#endif /* GL_ARB_vertex_attrib_binding */ + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights); +GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights); +GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights); +GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights); +GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights); +GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights); +GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights); +GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights); +GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glVertexBlendARB (GLint count); +#endif +#endif /* GL_ARB_vertex_blend */ + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +typedef ptrdiff_t GLsizeiptrARB; +typedef ptrdiff_t GLintptrARB; +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +typedef void *(APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer); +GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); +GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +GLAPI void *APIENTRY glMapBufferARB (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_ARB_vertex_buffer_object */ + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, void **pointer); +#endif +#endif /* GL_ARB_vertex_program */ + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name); +#endif +#endif /* GL_ARB_vertex_shader */ + +#ifndef GL_ARB_vertex_type_10f_11f_11f_rev +#define GL_ARB_vertex_type_10f_11f_11f_rev 1 +#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ + +#ifndef GL_ARB_vertex_type_2_10_10_10_rev +#define GL_ARB_vertex_type_2_10_10_10_rev 1 +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ + +#ifndef GL_ARB_viewport_array +#define GL_ARB_viewport_array 1 +#endif /* GL_ARB_viewport_array */ + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v); +GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v); +GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); +#endif +#endif /* GL_ARB_window_pos */ + +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#endif /* GL_KHR_context_flush_control */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +#endif /* GL_KHR_debug */ + +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 +#endif /* GL_KHR_robustness */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_hdr */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif /* GL_KHR_texture_compression_astc_ldr */ + +#ifndef GL_OES_byte_coordinates +#define GL_OES_byte_coordinates 1 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2BOESPROC) (GLenum texture, GLbyte s, GLbyte t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD1BOESPROC) (GLbyte s); +typedef void (APIENTRYP PFNGLTEXCOORD1BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD2BOESPROC) (GLbyte s, GLbyte t); +typedef void (APIENTRYP PFNGLTEXCOORD2BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r); +typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q); +typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x, GLbyte y); +typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z, GLbyte w); +typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s); +GLAPI void APIENTRY glMultiTexCoord1bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glMultiTexCoord2bOES (GLenum texture, GLbyte s, GLbyte t); +GLAPI void APIENTRY glMultiTexCoord2bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glMultiTexCoord3bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r); +GLAPI void APIENTRY glMultiTexCoord3bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glMultiTexCoord4bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); +GLAPI void APIENTRY glMultiTexCoord4bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glTexCoord1bOES (GLbyte s); +GLAPI void APIENTRY glTexCoord1bvOES (const GLbyte *coords); +GLAPI void APIENTRY glTexCoord2bOES (GLbyte s, GLbyte t); +GLAPI void APIENTRY glTexCoord2bvOES (const GLbyte *coords); +GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r); +GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords); +GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q); +GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords); +GLAPI void APIENTRY glVertex2bOES (GLbyte x, GLbyte y); +GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords); +GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y, GLbyte z); +GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords); +GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z, GLbyte w); +GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords); +#endif +#endif /* GL_OES_byte_coordinates */ + +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif /* GL_OES_compressed_paletted_texture */ + +#ifndef GL_OES_fixed_point +#define GL_OES_fixed_point 1 +typedef GLint GLfixed; +#define GL_FIXED_OES 0x140C +typedef void (APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref); +typedef void (APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth); +typedef void (APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); +typedef void (APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f); +typedef void (APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param); +typedef void (APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +typedef void (APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation); +typedef void (APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param); +typedef void (APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width); +typedef void (APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param); +typedef void (APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); +typedef void (APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +typedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); +typedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); +typedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLACCUMXOESPROC) (GLenum op, GLfixed value); +typedef void (APIENTRYP PFNGLBITMAPXOESPROC) (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap); +typedef void (APIENTRYP PFNGLBLENDCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLCLEARACCUMXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLCOLOR3XOESPROC) (GLfixed red, GLfixed green, GLfixed blue); +typedef void (APIENTRYP PFNGLCOLOR3XVOESPROC) (const GLfixed *components); +typedef void (APIENTRYP PFNGLCOLOR4XVOESPROC) (const GLfixed *components); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLEVALCOORD1XOESPROC) (GLfixed u); +typedef void (APIENTRYP PFNGLEVALCOORD1XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLEVALCOORD2XOESPROC) (GLfixed u, GLfixed v); +typedef void (APIENTRYP PFNGLEVALCOORD2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLFEEDBACKBUFFERXOESPROC) (GLsizei n, GLenum type, const GLfixed *buffer); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETMAPXVOESPROC) (GLenum target, GLenum query, GLfixed *v); +typedef void (APIENTRYP PFNGLGETMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLGETPIXELMAPXVPROC) (GLenum map, GLint size, GLfixed *values); +typedef void (APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERXVOESPROC) (GLenum target, GLint level, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLINDEXXOESPROC) (GLfixed component); +typedef void (APIENTRYP PFNGLINDEXXVOESPROC) (const GLfixed *component); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMAP1XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points); +typedef void (APIENTRYP PFNGLMAP2XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points); +typedef void (APIENTRYP PFNGLMAPGRID1XOESPROC) (GLint n, GLfixed u1, GLfixed u2); +typedef void (APIENTRYP PFNGLMAPGRID2XOESPROC) (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1XOESPROC) (GLenum texture, GLfixed s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2XOESPROC) (GLenum texture, GLfixed s, GLfixed t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLNORMAL3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLPASSTHROUGHXOESPROC) (GLfixed token); +typedef void (APIENTRYP PFNGLPIXELMAPXPROC) (GLenum map, GLint size, const GLfixed *values); +typedef void (APIENTRYP PFNGLPIXELSTOREXPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLPIXELTRANSFERXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLPIXELZOOMXOESPROC) (GLfixed xfactor, GLfixed yfactor); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESXOESPROC) (GLsizei n, const GLuint *textures, const GLfixed *priorities); +typedef void (APIENTRYP PFNGLRASTERPOS2XOESPROC) (GLfixed x, GLfixed y); +typedef void (APIENTRYP PFNGLRASTERPOS2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLRASTERPOS3XOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLRASTERPOS3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLRASTERPOS4XOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed w); +typedef void (APIENTRYP PFNGLRASTERPOS4XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLRECTXOESPROC) (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2); +typedef void (APIENTRYP PFNGLRECTXVOESPROC) (const GLfixed *v1, const GLfixed *v2); +typedef void (APIENTRYP PFNGLTEXCOORD1XOESPROC) (GLfixed s); +typedef void (APIENTRYP PFNGLTEXCOORD1XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXCOORD2XOESPROC) (GLfixed s, GLfixed t); +typedef void (APIENTRYP PFNGLTEXCOORD2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXCOORD3XOESPROC) (GLfixed s, GLfixed t, GLfixed r); +typedef void (APIENTRYP PFNGLTEXCOORD3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXCOORD4XOESPROC) (GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (APIENTRYP PFNGLTEXCOORD4XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLVERTEX2XOESPROC) (GLfixed x); +typedef void (APIENTRYP PFNGLVERTEX2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLVERTEX3XOESPROC) (GLfixed x, GLfixed y); +typedef void (APIENTRYP PFNGLVERTEX3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLVERTEX4XOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLVERTEX4XVOESPROC) (const GLfixed *coords); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref); +GLAPI void APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glClearDepthxOES (GLfixed depth); +GLAPI void APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation); +GLAPI void APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glDepthRangexOES (GLfixed n, GLfixed f); +GLAPI void APIENTRY glFogxOES (GLenum pname, GLfixed param); +GLAPI void APIENTRY glFogxvOES (GLenum pname, const GLfixed *param); +GLAPI void APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +GLAPI void APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation); +GLAPI void APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glLightModelxOES (GLenum pname, GLfixed param); +GLAPI void APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param); +GLAPI void APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param); +GLAPI void APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glLineWidthxOES (GLfixed width); +GLAPI void APIENTRY glLoadMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param); +GLAPI void APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param); +GLAPI void APIENTRY glMultMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GLAPI void APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz); +GLAPI void APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +GLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glPointSizexOES (GLfixed size); +GLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); +GLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glAccumxOES (GLenum op, GLfixed value); +GLAPI void APIENTRY glBitmapxOES (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap); +GLAPI void APIENTRY glBlendColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glClearAccumxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glColor3xOES (GLfixed red, GLfixed green, GLfixed blue); +GLAPI void APIENTRY glColor3xvOES (const GLfixed *components); +GLAPI void APIENTRY glColor4xvOES (const GLfixed *components); +GLAPI void APIENTRY glConvolutionParameterxOES (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glConvolutionParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glEvalCoord1xOES (GLfixed u); +GLAPI void APIENTRY glEvalCoord1xvOES (const GLfixed *coords); +GLAPI void APIENTRY glEvalCoord2xOES (GLfixed u, GLfixed v); +GLAPI void APIENTRY glEvalCoord2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glFeedbackBufferxOES (GLsizei n, GLenum type, const GLfixed *buffer); +GLAPI void APIENTRY glGetConvolutionParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetHistogramParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetLightxOES (GLenum light, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetMapxvOES (GLenum target, GLenum query, GLfixed *v); +GLAPI void APIENTRY glGetMaterialxOES (GLenum face, GLenum pname, GLfixed param); +GLAPI void APIENTRY glGetPixelMapxv (GLenum map, GLint size, GLfixed *values); +GLAPI void APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetTexLevelParameterxvOES (GLenum target, GLint level, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glIndexxOES (GLfixed component); +GLAPI void APIENTRY glIndexxvOES (const GLfixed *component); +GLAPI void APIENTRY glLoadTransposeMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMap1xOES (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points); +GLAPI void APIENTRY glMap2xOES (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points); +GLAPI void APIENTRY glMapGrid1xOES (GLint n, GLfixed u1, GLfixed u2); +GLAPI void APIENTRY glMapGrid2xOES (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2); +GLAPI void APIENTRY glMultTransposeMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMultiTexCoord1xOES (GLenum texture, GLfixed s); +GLAPI void APIENTRY glMultiTexCoord1xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glMultiTexCoord2xOES (GLenum texture, GLfixed s, GLfixed t); +GLAPI void APIENTRY glMultiTexCoord2xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glMultiTexCoord3xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r); +GLAPI void APIENTRY glMultiTexCoord3xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glMultiTexCoord4xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glNormal3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glPassThroughxOES (GLfixed token); +GLAPI void APIENTRY glPixelMapx (GLenum map, GLint size, const GLfixed *values); +GLAPI void APIENTRY glPixelStorex (GLenum pname, GLfixed param); +GLAPI void APIENTRY glPixelTransferxOES (GLenum pname, GLfixed param); +GLAPI void APIENTRY glPixelZoomxOES (GLfixed xfactor, GLfixed yfactor); +GLAPI void APIENTRY glPrioritizeTexturesxOES (GLsizei n, const GLuint *textures, const GLfixed *priorities); +GLAPI void APIENTRY glRasterPos2xOES (GLfixed x, GLfixed y); +GLAPI void APIENTRY glRasterPos2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glRasterPos3xOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glRasterPos3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glRasterPos4xOES (GLfixed x, GLfixed y, GLfixed z, GLfixed w); +GLAPI void APIENTRY glRasterPos4xvOES (const GLfixed *coords); +GLAPI void APIENTRY glRectxOES (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2); +GLAPI void APIENTRY glRectxvOES (const GLfixed *v1, const GLfixed *v2); +GLAPI void APIENTRY glTexCoord1xOES (GLfixed s); +GLAPI void APIENTRY glTexCoord1xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexCoord2xOES (GLfixed s, GLfixed t); +GLAPI void APIENTRY glTexCoord2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexCoord3xOES (GLfixed s, GLfixed t, GLfixed r); +GLAPI void APIENTRY glTexCoord3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexCoord4xOES (GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GLAPI void APIENTRY glTexCoord4xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glVertex2xOES (GLfixed x); +GLAPI void APIENTRY glVertex2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glVertex3xOES (GLfixed x, GLfixed y); +GLAPI void APIENTRY glVertex3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glVertex4xOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glVertex4xvOES (const GLfixed *coords); +#endif +#endif /* GL_OES_fixed_point */ + +#ifndef GL_OES_query_matrix +#define GL_OES_query_matrix 1 +typedef GLbitfield (APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLbitfield APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent); +#endif +#endif /* GL_OES_query_matrix */ + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif /* GL_OES_read_format */ + +#ifndef GL_OES_single_precision +#define GL_OES_single_precision 1 +typedef void (APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); +typedef void (APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); +typedef void (APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f); +typedef void (APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +typedef void (APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation); +typedef void (APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearDepthfOES (GLclampf depth); +GLAPI void APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); +GLAPI void APIENTRY glDepthRangefOES (GLclampf n, GLclampf f); +GLAPI void APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +GLAPI void APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation); +GLAPI void APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +#endif +#endif /* GL_OES_single_precision */ + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif /* GL_3DFX_multisample */ + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask); +#endif +#endif /* GL_3DFX_tbuffer */ + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif /* GL_3DFX_texture_compression_FXT1 */ + +#ifndef GL_AMD_blend_minmax_factor +#define GL_AMD_blend_minmax_factor 1 +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D +#endif /* GL_AMD_blend_minmax_factor */ + +#ifndef GL_AMD_conservative_depth +#define GL_AMD_conservative_depth 1 +#endif /* GL_AMD_conservative_depth */ + +#ifndef GL_AMD_debug_output +#define GL_AMD_debug_output 1 +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); +#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 +#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 +#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 +#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A +#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B +#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C +#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D +#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E +#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F +#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 +typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#endif +#endif /* GL_AMD_debug_output */ + +#ifndef GL_AMD_depth_clamp_separate +#define GL_AMD_depth_clamp_separate 1 +#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E +#define GL_DEPTH_CLAMP_FAR_AMD 0x901F +#endif /* GL_AMD_depth_clamp_separate */ + +#ifndef GL_AMD_draw_buffers_blend +#define GL_AMD_draw_buffers_blend 1 +typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +#endif +#endif /* GL_AMD_draw_buffers_blend */ + +#ifndef GL_AMD_gcn_shader +#define GL_AMD_gcn_shader 1 +#endif /* GL_AMD_gcn_shader */ + +#ifndef GL_AMD_gpu_shader_int64 +#define GL_AMD_gpu_shader_int64 1 +typedef int64_t GLint64EXT; +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params); +GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_AMD_gpu_shader_int64 */ + +#ifndef GL_AMD_interleaved_elements +#define GL_AMD_interleaved_elements 1 +#define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4 +#define GL_VERTEX_ID_SWIZZLE_AMD 0x91A5 +typedef void (APIENTRYP PFNGLVERTEXATTRIBPARAMETERIAMDPROC) (GLuint index, GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribParameteriAMD (GLuint index, GLenum pname, GLint param); +#endif +#endif /* GL_AMD_interleaved_elements */ + +#ifndef GL_AMD_multi_draw_indirect +#define GL_AMD_multi_draw_indirect 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); +#endif +#endif /* GL_AMD_multi_draw_indirect */ + +#ifndef GL_AMD_name_gen_delete +#define GL_AMD_name_gen_delete 1 +#define GL_DATA_BUFFER_AMD 0x9151 +#define GL_PERFORMANCE_MONITOR_AMD 0x9152 +#define GL_QUERY_OBJECT_AMD 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 +#define GL_SAMPLER_OBJECT_AMD 0x9155 +typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names); +typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names); +typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names); +GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names); +GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name); +#endif +#endif /* GL_AMD_name_gen_delete */ + +#ifndef GL_AMD_occlusion_query_event +#define GL_AMD_occlusion_query_event 1 +#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F +#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001 +#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002 +#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004 +#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008 +#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF +typedef void (APIENTRYP PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glQueryObjectParameteruiAMD (GLenum target, GLuint id, GLenum pname, GLuint param); +#endif +#endif /* GL_AMD_occlusion_query_event */ + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); +GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +#endif /* GL_AMD_performance_monitor */ + +#ifndef GL_AMD_pinned_memory +#define GL_AMD_pinned_memory 1 +#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 +#endif /* GL_AMD_pinned_memory */ + +#ifndef GL_AMD_query_buffer_object +#define GL_AMD_query_buffer_object 1 +#define GL_QUERY_BUFFER_AMD 0x9192 +#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 +#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 +#endif /* GL_AMD_query_buffer_object */ + +#ifndef GL_AMD_sample_positions +#define GL_AMD_sample_positions 1 +#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F +typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val); +#endif +#endif /* GL_AMD_sample_positions */ + +#ifndef GL_AMD_seamless_cubemap_per_texture +#define GL_AMD_seamless_cubemap_per_texture 1 +#endif /* GL_AMD_seamless_cubemap_per_texture */ + +#ifndef GL_AMD_shader_atomic_counter_ops +#define GL_AMD_shader_atomic_counter_ops 1 +#endif /* GL_AMD_shader_atomic_counter_ops */ + +#ifndef GL_AMD_shader_stencil_export +#define GL_AMD_shader_stencil_export 1 +#endif /* GL_AMD_shader_stencil_export */ + +#ifndef GL_AMD_shader_trinary_minmax +#define GL_AMD_shader_trinary_minmax 1 +#endif /* GL_AMD_shader_trinary_minmax */ + +#ifndef GL_AMD_sparse_texture +#define GL_AMD_sparse_texture 1 +#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A +#define GL_MIN_SPARSE_LEVEL_AMD 0x919B +#define GL_MIN_LOD_WARNING_AMD 0x919C +#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 +typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#endif +#endif /* GL_AMD_sparse_texture */ + +#ifndef GL_AMD_stencil_operation_extended +#define GL_AMD_stencil_operation_extended 1 +#define GL_SET_AMD 0x874A +#define GL_REPLACE_VALUE_AMD 0x874B +#define GL_STENCIL_OP_VALUE_AMD 0x874C +#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D +typedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value); +#endif +#endif /* GL_AMD_stencil_operation_extended */ + +#ifndef GL_AMD_texture_texture4 +#define GL_AMD_texture_texture4 1 +#endif /* GL_AMD_texture_texture4 */ + +#ifndef GL_AMD_transform_feedback3_lines_triangles +#define GL_AMD_transform_feedback3_lines_triangles 1 +#endif /* GL_AMD_transform_feedback3_lines_triangles */ + +#ifndef GL_AMD_transform_feedback4 +#define GL_AMD_transform_feedback4 1 +#define GL_STREAM_RASTERIZATION_AMD 0x91A0 +#endif /* GL_AMD_transform_feedback4 */ + +#ifndef GL_AMD_vertex_shader_layer +#define GL_AMD_vertex_shader_layer 1 +#endif /* GL_AMD_vertex_shader_layer */ + +#ifndef GL_AMD_vertex_shader_tessellator +#define GL_AMD_vertex_shader_tessellator 1 +#define GL_SAMPLER_BUFFER_AMD 0x9001 +#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 +#define GL_TESSELLATION_MODE_AMD 0x9004 +#define GL_TESSELLATION_FACTOR_AMD 0x9005 +#define GL_DISCRETE_AMD 0x9006 +#define GL_CONTINUOUS_AMD 0x9007 +typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor); +GLAPI void APIENTRY glTessellationModeAMD (GLenum mode); +#endif +#endif /* GL_AMD_vertex_shader_tessellator */ + +#ifndef GL_AMD_vertex_shader_viewport_index +#define GL_AMD_vertex_shader_viewport_index 1 +#endif /* GL_AMD_vertex_shader_viewport_index */ + +#ifndef GL_APPLE_aux_depth_stencil +#define GL_APPLE_aux_depth_stencil 1 +#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 +#endif /* GL_APPLE_aux_depth_stencil */ + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif /* GL_APPLE_client_storage */ + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#define GL_ELEMENT_ARRAY_APPLE 0x8A0C +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const void *pointer); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif +#endif /* GL_APPLE_element_array */ + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name); +#endif +#endif /* GL_APPLE_fence */ + +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 +#define GL_HALF_APPLE 0x140B +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#define GL_COLOR_FLOAT_APPLE 0x8A0F +#endif /* GL_APPLE_float_pixels */ + +#ifndef GL_APPLE_flush_buffer_range +#define GL_APPLE_flush_buffer_range 1 +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 +typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_APPLE_flush_buffer_range */ + +#ifndef GL_APPLE_object_purgeable +#define GL_APPLE_object_purgeable 1 +#define GL_BUFFER_OBJECT_APPLE 0x85B3 +#define GL_RELEASED_APPLE 0x8A19 +#define GL_VOLATILE_APPLE 0x8A1A +#define GL_RETAINED_APPLE 0x8A1B +#define GL_UNDEFINED_APPLE 0x8A1C +#define GL_PURGEABLE_APPLE 0x8A1D +typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); +GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); +GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params); +#endif +#endif /* GL_APPLE_object_purgeable */ + +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_RGB_RAW_422_APPLE 0x8A51 +#endif /* GL_APPLE_rgb_422 */ + +#ifndef GL_APPLE_row_bytes +#define GL_APPLE_row_bytes 1 +#define GL_PACK_ROW_BYTES_APPLE 0x8A15 +#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 +#endif /* GL_APPLE_row_bytes */ + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif /* GL_APPLE_specular_vector */ + +#ifndef GL_APPLE_texture_range +#define GL_APPLE_texture_range 1 +#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 +#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 +#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC +#define GL_STORAGE_PRIVATE_APPLE 0x85BD +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const void *pointer); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const void *pointer); +GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_APPLE_texture_range */ + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif /* GL_APPLE_transform_hint */ + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array); +#endif +#endif /* GL_APPLE_vertex_array_object */ + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CLIENT_APPLE 0x85B4 +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, void *pointer); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, void *pointer); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param); +#endif +#endif /* GL_APPLE_vertex_array_range */ + +#ifndef GL_APPLE_vertex_program_evaluators +#define GL_APPLE_vertex_program_evaluators 1 +#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 +#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 +#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 +#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 +#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 +#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 +#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 +#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 +#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 +#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname); +GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname); +GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname); +GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +#endif +#endif /* GL_APPLE_vertex_program_evaluators */ + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#define GL_YCBCR_422_APPLE 0x85B9 +#endif /* GL_APPLE_ycbcr_422 */ + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_ATI_draw_buffers */ + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum type, const void *pointer); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif +#endif /* GL_ATI_element_array */ + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param); +#endif +#endif /* GL_ATI_envmap_bumpmap */ + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle); +GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value); +#endif +#endif /* GL_ATI_fragment_shader */ + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +typedef void *(APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void *APIENTRY glMapObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer); +#endif +#endif /* GL_ATI_map_object_buffer */ + +#ifndef GL_ATI_meminfo +#define GL_ATI_meminfo 1 +#define GL_VBO_FREE_MEMORY_ATI 0x87FB +#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC +#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD +#endif /* GL_ATI_meminfo */ + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +#define GL_RGBA_FLOAT_MODE_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif /* GL_ATI_pixel_format_float */ + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param); +#endif +#endif /* GL_ATI_pn_triangles */ + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif +#endif /* GL_ATI_separate_stencil */ + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif /* GL_ATI_text_fragment_shader */ + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif /* GL_ATI_texture_env_combine3 */ + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif /* GL_ATI_texture_float */ + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif /* GL_ATI_texture_mirror_once */ + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const void *pointer, GLenum usage); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params); +#endif +#endif /* GL_ATI_vertex_array_object */ + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params); +#endif +#endif /* GL_ATI_vertex_attrib_array_object */ + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x); +GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords); +GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param); +#endif +#endif /* GL_ATI_vertex_streams */ + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif /* GL_EXT_422_pixels */ + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#define GL_ABGR_EXT 0x8000 +#endif /* GL_EXT_abgr */ + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif /* GL_EXT_bgra */ + +#ifndef GL_EXT_bindable_uniform +#define GL_EXT_bindable_uniform 1 +#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 +#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 +#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 +#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED +#define GL_UNIFORM_BUFFER_EXT 0x8DEE +#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF +typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); +typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); +typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer); +GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location); +GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location); +#endif +#endif /* GL_EXT_bindable_uniform */ + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +#endif +#endif /* GL_EXT_blend_color */ + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha); +#endif +#endif /* GL_EXT_blend_equation_separate */ + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif +#endif /* GL_EXT_blend_func_separate */ + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif /* GL_EXT_blend_logic_op */ + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_BLEND_EQUATION_EXT 0x8009 +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum mode); +#endif +#endif /* GL_EXT_blend_minmax */ + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif /* GL_EXT_blend_subtract */ + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif /* GL_EXT_clip_volume_hint */ + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif /* GL_EXT_cmyka */ + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif +#endif /* GL_EXT_color_subtable */ + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif +#endif /* GL_EXT_compiled_vertex_array */ + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, void *image); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +#endif +#endif /* GL_EXT_convolution */ + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *v); +GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *v); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v); +GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v); +GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_coordinate_frame */ + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_EXT_copy_texture */ + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params); +#endif +#endif /* GL_EXT_cull_vertex */ + +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +typedef void (APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_EXT_debug_label */ + +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GLAPI void APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GLAPI void APIENTRY glPopGroupMarkerEXT (void); +#endif +#endif /* GL_EXT_debug_marker */ + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax); +#endif +#endif /* GL_EXT_depth_bounds_test */ + +#ifndef GL_EXT_direct_state_access +#define GL_EXT_direct_state_access 1 +#define GL_PROGRAM_MATRIX_EXT 0x8E2D +#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E +#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F +typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); +typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data); +typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void **data); +typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, void *img); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, void *img); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void **params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); +typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void **param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode); +GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glMatrixPopEXT (GLenum mode); +GLAPI void APIENTRY glMatrixPushEXT (GLenum mode); +GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask); +GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask); +GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture); +GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); +GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params); +GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data); +GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, void **data); +GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index); +GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index); +GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, void *img); +GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, void *img); +GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void *APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access); +GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer); +GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, void **params); +GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params); +GLAPI void APIENTRY glEnableClientStateiEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glDisableClientStateiEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glGetFloati_vEXT (GLenum pname, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetDoublei_vEXT (GLenum pname, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetPointeri_vEXT (GLenum pname, GLuint index, void **params); +GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string); +GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, void *string); +GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target); +GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target); +GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode); +GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode); +GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glVertexArrayVertexOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayEdgeFlagOffsetEXT (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayIndexOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayNormalOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayMultiTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayFogCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArraySecondaryColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayVertexAttribOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayVertexAttribIOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glEnableVertexArrayEXT (GLuint vaobj, GLenum array); +GLAPI void APIENTRY glDisableVertexArrayEXT (GLuint vaobj, GLenum array); +GLAPI void APIENTRY glEnableVertexArrayAttribEXT (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glDisableVertexArrayAttribEXT (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glGetVertexArrayIntegervEXT (GLuint vaobj, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayPointervEXT (GLuint vaobj, GLenum pname, void **param); +GLAPI void APIENTRY glGetVertexArrayIntegeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayPointeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, void **param); +GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); +GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor); +#endif +#endif /* GL_EXT_direct_state_access */ + +#ifndef GL_EXT_draw_buffers2 +#define GL_EXT_draw_buffers2 1 +typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +#endif +#endif /* GL_EXT_draw_buffers2 */ + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_EXT_draw_instanced */ + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +#endif +#endif /* GL_EXT_draw_range_elements */ + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_fog_coord */ + +#ifndef GL_EXT_framebuffer_blit +#define GL_EXT_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_EXT_framebuffer_blit */ + +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_EXT_framebuffer_multisample */ + +#ifndef GL_EXT_framebuffer_multisample_blit_scaled +#define GL_EXT_framebuffer_multisample_blit_scaled 1 +#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA +#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB +#endif /* GL_EXT_framebuffer_multisample_blit_scaled */ + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target); +#endif +#endif /* GL_EXT_framebuffer_object */ + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_EXT_framebuffer_sRGB 1 +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#endif /* GL_EXT_framebuffer_sRGB */ + +#ifndef GL_EXT_geometry_shader4 +#define GL_EXT_geometry_shader4 1 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +#endif +#endif /* GL_EXT_geometry_shader4 */ + +#ifndef GL_EXT_gpu_program_parameters +#define GL_EXT_gpu_program_parameters 1 +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#endif +#endif /* GL_EXT_gpu_program_parameters */ + +#ifndef GL_EXT_gpu_shader4 +#define GL_EXT_gpu_shader4 1 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD +#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 +#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 +#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 +#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 +#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 +#define GL_INT_SAMPLER_1D_EXT 0x8DC9 +#define GL_INT_SAMPLER_2D_EXT 0x8DCA +#define GL_INT_SAMPLER_3D_EXT 0x8DCB +#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC +#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD +#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 +typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value); +#endif +#endif /* GL_EXT_gpu_shader4 */ + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glResetHistogramEXT (GLenum target); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum target); +#endif +#endif /* GL_EXT_histogram */ + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif /* GL_EXT_index_array_formats */ + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref); +#endif +#endif /* GL_EXT_index_func */ + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode); +#endif +#endif /* GL_EXT_index_material */ + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif /* GL_EXT_index_texture */ + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum mode); +GLAPI void APIENTRY glTextureLightEXT (GLenum pname); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode); +#endif +#endif /* GL_EXT_light_texture */ + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif /* GL_EXT_misc_attribute */ + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#endif +#endif /* GL_EXT_multi_draw_arrays */ + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern); +#endif +#endif /* GL_EXT_multisample */ + +#ifndef GL_EXT_packed_depth_stencil +#define GL_EXT_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif /* GL_EXT_packed_depth_stencil */ + +#ifndef GL_EXT_packed_float +#define GL_EXT_packed_float 1 +#define GL_R11F_G11F_B10F_EXT 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B +#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C +#endif /* GL_EXT_packed_float */ + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif /* GL_EXT_packed_pixels */ + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table); +GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, void *data); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +#endif +#endif /* GL_EXT_paletted_texture */ + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif /* GL_EXT_pixel_buffer_object */ + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +#endif +#endif /* GL_EXT_pixel_transform */ + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif /* GL_EXT_pixel_transform_color_table */ + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params); +#endif +#endif /* GL_EXT_point_parameters */ + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); +#endif +#endif /* GL_EXT_polygon_offset */ + +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + +#ifndef GL_EXT_provoking_vertex +#define GL_EXT_provoking_vertex 1 +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_PROVOKING_VERTEX_EXT 0x8E4F +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); +#endif +#endif /* GL_EXT_provoking_vertex */ + +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); +#endif +#endif /* GL_EXT_raster_multisample */ + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif /* GL_EXT_rescale_normal */ + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_secondary_color */ + +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#define GL_ACTIVE_PROGRAM_EXT 0x8B8D +typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program); +typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program); +GLAPI void APIENTRY glActiveProgramEXT (GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string); +#endif +#endif /* GL_EXT_separate_shader_objects */ + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif /* GL_EXT_separate_specular_color */ + +#ifndef GL_EXT_shader_image_load_formatted +#define GL_EXT_shader_image_load_formatted 1 +#endif /* GL_EXT_shader_image_load_formatted */ + +#ifndef GL_EXT_shader_image_load_store +#define GL_EXT_shader_image_load_store 1 +#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 +#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A +#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B +#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C +#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D +#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E +#define GL_IMAGE_1D_EXT 0x904C +#define GL_IMAGE_2D_EXT 0x904D +#define GL_IMAGE_3D_EXT 0x904E +#define GL_IMAGE_2D_RECT_EXT 0x904F +#define GL_IMAGE_CUBE_EXT 0x9050 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_IMAGE_1D_ARRAY_EXT 0x9052 +#define GL_IMAGE_2D_ARRAY_EXT 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 +#define GL_INT_IMAGE_1D_EXT 0x9057 +#define GL_INT_IMAGE_2D_EXT 0x9058 +#define GL_INT_IMAGE_3D_EXT 0x9059 +#define GL_INT_IMAGE_2D_RECT_EXT 0x905A +#define GL_INT_IMAGE_CUBE_EXT 0x905B +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D +#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C +#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D +#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 +#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 +#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); +#endif +#endif /* GL_EXT_shader_image_load_store */ + +#ifndef GL_EXT_shader_integer_mix +#define GL_EXT_shader_integer_mix 1 +#endif /* GL_EXT_shader_integer_mix */ + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif /* GL_EXT_shadow_funcs */ + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif /* GL_EXT_shared_texture_palette */ + +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + +#ifndef GL_EXT_stencil_clear_tag +#define GL_EXT_stencil_clear_tag 1 +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 +typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag); +#endif +#endif /* GL_EXT_stencil_clear_tag */ + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face); +#endif +#endif /* GL_EXT_stencil_two_side */ + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif /* GL_EXT_stencil_wrap */ + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +#endif +#endif /* GL_EXT_subtexture */ + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif /* GL_EXT_texture */ + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +#endif +#endif /* GL_EXT_texture3D */ + +#ifndef GL_EXT_texture_array +#define GL_EXT_texture_array 1 +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif +#endif /* GL_EXT_texture_array */ + +#ifndef GL_EXT_texture_buffer_object +#define GL_EXT_texture_buffer_object 1 +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E +typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +#endif +#endif /* GL_EXT_texture_buffer_object */ + +#ifndef GL_EXT_texture_compression_latc +#define GL_EXT_texture_compression_latc 1 +#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 +#endif /* GL_EXT_texture_compression_latc */ + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif /* GL_EXT_texture_compression_rgtc */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif /* GL_EXT_texture_compression_s3tc */ + +#ifndef GL_EXT_texture_cube_map +#define GL_EXT_texture_cube_map 1 +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif /* GL_EXT_texture_cube_map */ + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif /* GL_EXT_texture_env_add */ + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif /* GL_EXT_texture_env_combine */ + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif /* GL_EXT_texture_env_dot3 */ + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif /* GL_EXT_texture_filter_anisotropic */ + +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#endif /* GL_EXT_texture_filter_minmax */ + +#ifndef GL_EXT_texture_integer +#define GL_EXT_texture_integer 1 +#define GL_RGBA32UI_EXT 0x8D70 +#define GL_RGB32UI_EXT 0x8D71 +#define GL_ALPHA32UI_EXT 0x8D72 +#define GL_INTENSITY32UI_EXT 0x8D73 +#define GL_LUMINANCE32UI_EXT 0x8D74 +#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 +#define GL_RGBA16UI_EXT 0x8D76 +#define GL_RGB16UI_EXT 0x8D77 +#define GL_ALPHA16UI_EXT 0x8D78 +#define GL_INTENSITY16UI_EXT 0x8D79 +#define GL_LUMINANCE16UI_EXT 0x8D7A +#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B +#define GL_RGBA8UI_EXT 0x8D7C +#define GL_RGB8UI_EXT 0x8D7D +#define GL_ALPHA8UI_EXT 0x8D7E +#define GL_INTENSITY8UI_EXT 0x8D7F +#define GL_LUMINANCE8UI_EXT 0x8D80 +#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 +#define GL_RGBA32I_EXT 0x8D82 +#define GL_RGB32I_EXT 0x8D83 +#define GL_ALPHA32I_EXT 0x8D84 +#define GL_INTENSITY32I_EXT 0x8D85 +#define GL_LUMINANCE32I_EXT 0x8D86 +#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 +#define GL_RGBA16I_EXT 0x8D88 +#define GL_RGB16I_EXT 0x8D89 +#define GL_ALPHA16I_EXT 0x8D8A +#define GL_INTENSITY16I_EXT 0x8D8B +#define GL_LUMINANCE16I_EXT 0x8D8C +#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D +#define GL_RGBA8I_EXT 0x8D8E +#define GL_RGB8I_EXT 0x8D8F +#define GL_ALPHA8I_EXT 0x8D90 +#define GL_INTENSITY8I_EXT 0x8D91 +#define GL_LUMINANCE8I_EXT 0x8D92 +#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 +#define GL_RED_INTEGER_EXT 0x8D94 +#define GL_GREEN_INTEGER_EXT 0x8D95 +#define GL_BLUE_INTEGER_EXT 0x8D96 +#define GL_ALPHA_INTEGER_EXT 0x8D97 +#define GL_RGB_INTEGER_EXT 0x8D98 +#define GL_RGBA_INTEGER_EXT 0x8D99 +#define GL_BGR_INTEGER_EXT 0x8D9A +#define GL_BGRA_INTEGER_EXT 0x8D9B +#define GL_LUMINANCE_INTEGER_EXT 0x8D9C +#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D +#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); +typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha); +GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#endif +#endif /* GL_EXT_texture_integer */ + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif /* GL_EXT_texture_lod_bias */ + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif /* GL_EXT_texture_mirror_clamp */ + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif +#endif /* GL_EXT_texture_object */ + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); +#endif +#endif /* GL_EXT_texture_perturb_normal */ + +#ifndef GL_EXT_texture_sRGB +#define GL_EXT_texture_sRGB 1 +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB8_EXT 0x8C41 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#define GL_SLUMINANCE_EXT 0x8C46 +#define GL_SLUMINANCE8_EXT 0x8C47 +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif /* GL_EXT_texture_sRGB */ + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif /* GL_EXT_texture_sRGB_decode */ + +#ifndef GL_EXT_texture_shared_exponent +#define GL_EXT_texture_shared_exponent 1 +#define GL_RGB9_E5_EXT 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E +#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F +#endif /* GL_EXT_texture_shared_exponent */ + +#ifndef GL_EXT_texture_snorm +#define GL_EXT_texture_snorm 1 +#define GL_ALPHA_SNORM 0x9010 +#define GL_LUMINANCE_SNORM 0x9011 +#define GL_LUMINANCE_ALPHA_SNORM 0x9012 +#define GL_INTENSITY_SNORM 0x9013 +#define GL_ALPHA8_SNORM 0x9014 +#define GL_LUMINANCE8_SNORM 0x9015 +#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 +#define GL_INTENSITY8_SNORM 0x9017 +#define GL_ALPHA16_SNORM 0x9018 +#define GL_LUMINANCE16_SNORM 0x9019 +#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A +#define GL_INTENSITY16_SNORM 0x901B +#define GL_RED_SNORM 0x8F90 +#define GL_RG_SNORM 0x8F91 +#define GL_RGB_SNORM 0x8F92 +#define GL_RGBA_SNORM 0x8F93 +#endif /* GL_EXT_texture_snorm */ + +#ifndef GL_EXT_texture_swizzle +#define GL_EXT_texture_swizzle 1 +#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 +#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 +#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 +#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 +#endif /* GL_EXT_texture_swizzle */ + +#ifndef GL_EXT_timer_query +#define GL_EXT_timer_query 1 +#define GL_TIME_ELAPSED_EXT 0x88BF +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +#endif +#endif /* GL_EXT_timer_query */ + +#ifndef GL_EXT_transform_feedback +#define GL_EXT_transform_feedback 1 +#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F +#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C +#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 +#define GL_RASTERIZER_DISCARD_EXT 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedbackEXT (void); +GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +#endif +#endif /* GL_EXT_transform_feedback */ + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, void **params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint i); +GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer); +GLAPI void APIENTRY glGetPointervEXT (GLenum pname, void **params); +GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +#endif +#endif /* GL_EXT_vertex_array */ + +#ifndef GL_EXT_vertex_array_bgra +#define GL_EXT_vertex_array_bgra 1 +#endif /* GL_EXT_vertex_array_bgra */ + +#ifndef GL_EXT_vertex_attrib_64bit +#define GL_EXT_vertex_attrib_64bit 1 +#define GL_DOUBLE_VEC2_EXT 0x8FFC +#define GL_DOUBLE_VEC3_EXT 0x8FFD +#define GL_DOUBLE_VEC4_EXT 0x8FFE +#define GL_DOUBLE_MAT2_EXT 0x8F46 +#define GL_DOUBLE_MAT3_EXT 0x8F47 +#define GL_DOUBLE_MAT4_EXT 0x8F48 +#define GL_DOUBLE_MAT2x3_EXT 0x8F49 +#define GL_DOUBLE_MAT2x4_EXT 0x8F4A +#define GL_DOUBLE_MAT3x2_EXT 0x8F4B +#define GL_DOUBLE_MAT3x4_EXT 0x8F4C +#define GL_DOUBLE_MAT4x2_EXT 0x8F4D +#define GL_DOUBLE_MAT4x3_EXT 0x8F4E +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params); +#endif +#endif /* GL_EXT_vertex_attrib_64bit */ + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const void *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const void *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const void *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, void **data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id); +GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1); +GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num); +GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const void *addr); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const void *addr); +GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr); +GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr); +GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr); +GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr); +GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr); +GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr); +GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr); +GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr); +GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const void *addr); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, void **data); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +#endif +#endif /* GL_EXT_vertex_shader */ + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6 +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT 0x1700 +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_vertex_weighting */ + +#ifndef GL_EXT_x11_sync_object +#define GL_EXT_x11_sync_object 1 +#define GL_SYNC_X11_FENCE_EXT 0x90E1 +typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); +#endif +#endif /* GL_EXT_x11_sync_object */ + +#ifndef GL_GREMEDY_frame_terminator +#define GL_GREMEDY_frame_terminator 1 +typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameTerminatorGREMEDY (void); +#endif +#endif /* GL_GREMEDY_frame_terminator */ + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const void *string); +#endif +#endif /* GL_GREMEDY_string_marker */ + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif /* GL_HP_convolution_border_modes */ + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params); +#endif +#endif /* GL_HP_image_transform */ + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif /* GL_HP_occlusion_test */ + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif /* GL_HP_texture_lighting */ + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#define GL_CULL_VERTEX_IBM 103050 +#endif /* GL_IBM_cull_vertex */ + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride); +#endif +#endif /* GL_IBM_multimode_draw_arrays */ + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif /* GL_IBM_rasterpos_clip */ + +#ifndef GL_IBM_static_data +#define GL_IBM_static_data 1 +#define GL_ALL_STATIC_DATA_IBM 103060 +#define GL_STATIC_VERTEX_ARRAY_IBM 103061 +typedef void (APIENTRYP PFNGLFLUSHSTATICDATAIBMPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushStaticDataIBM (GLenum target); +#endif +#endif /* GL_IBM_static_data */ + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_IBM_texture_mirrored_repeat 1 +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif /* GL_IBM_texture_mirrored_repeat */ + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean **pointer, GLint ptrstride); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +#endif +#endif /* GL_IBM_vertex_array_lists */ + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif +#endif /* GL_INGR_blend_func_separate */ + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif /* GL_INGR_color_clamp */ + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#define GL_INTERLACE_READ_INGR 0x8568 +#endif /* GL_INGR_interlace_read */ + +#ifndef GL_INTEL_fragment_shader_ordering +#define GL_INTEL_fragment_shader_ordering 1 +#endif /* GL_INTEL_fragment_shader_ordering */ + +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 +typedef void (APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); +#endif +#endif /* GL_INTEL_framebuffer_CMAA */ + +#ifndef GL_INTEL_map_texture +#define GL_INTEL_map_texture 1 +#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF +#define GL_LAYOUT_DEFAULT_INTEL 0 +#define GL_LAYOUT_LINEAR_INTEL 1 +#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2 +typedef void (APIENTRYP PFNGLSYNCTEXTUREINTELPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level); +typedef void *(APIENTRYP PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSyncTextureINTEL (GLuint texture); +GLAPI void APIENTRY glUnmapTexture2DINTEL (GLuint texture, GLint level); +GLAPI void *APIENTRY glMapTexture2DINTEL (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout); +#endif +#endif /* GL_INTEL_map_texture */ + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void **pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const void **pointer); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const void **pointer); +GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const void **pointer); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const void **pointer); +#endif +#endif /* GL_INTEL_parallel_arrays */ + +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 +typedef void (APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); +typedef void (APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); +typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); +typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); +typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); +GLAPI void APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); +GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); +GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); +GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#endif +#endif /* GL_INTEL_performance_query */ + +#ifndef GL_MESAX_texture_stack +#define GL_MESAX_texture_stack 1 +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E +#endif /* GL_MESAX_texture_stack */ + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#define GL_PACK_INVERT_MESA 0x8758 +#endif /* GL_MESA_pack_invert */ + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif +#endif /* GL_MESA_resize_buffers */ + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v); +#endif +#endif /* GL_MESA_window_pos */ + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif /* GL_MESA_ycbcr_texture */ + +#ifndef GL_NVX_conditional_render +#define GL_NVX_conditional_render 1 +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginConditionalRenderNVX (GLuint id); +GLAPI void APIENTRY glEndConditionalRenderNVX (void); +#endif +#endif /* GL_NVX_conditional_render */ + +#ifndef GL_NVX_gpu_memory_info +#define GL_NVX_gpu_memory_info 1 +#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 +#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 +#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 +#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A +#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B +#endif /* GL_NVX_gpu_memory_info */ + +#ifndef GL_NV_bindless_multi_draw_indirect +#define GL_NV_bindless_multi_draw_indirect 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +#endif +#endif /* GL_NV_bindless_multi_draw_indirect */ + +#ifndef GL_NV_bindless_multi_draw_indirect_count +#define GL_NV_bindless_multi_draw_indirect_count 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessCountNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessCountNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#endif +#endif /* GL_NV_bindless_multi_draw_indirect_count */ + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 +typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture); +GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); +GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); +GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); +GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); +GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); +GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); +GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); +GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); +GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); +#endif +#endif /* GL_NV_bindless_texture */ + +#ifndef GL_NV_blend_equation_advanced +#define GL_NV_blend_equation_advanced 1 +#define GL_BLEND_OVERLAP_NV 0x9281 +#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLUE_NV 0x1905 +#define GL_COLORBURN_NV 0x929A +#define GL_COLORDODGE_NV 0x9299 +#define GL_CONJOINT_NV 0x9284 +#define GL_CONTRAST_NV 0x92A1 +#define GL_DARKEN_NV 0x9297 +#define GL_DIFFERENCE_NV 0x929E +#define GL_DISJOINT_NV 0x9283 +#define GL_DST_ATOP_NV 0x928F +#define GL_DST_IN_NV 0x928B +#define GL_DST_NV 0x9287 +#define GL_DST_OUT_NV 0x928D +#define GL_DST_OVER_NV 0x9289 +#define GL_EXCLUSION_NV 0x92A0 +#define GL_GREEN_NV 0x1904 +#define GL_HARDLIGHT_NV 0x929B +#define GL_HARDMIX_NV 0x92A9 +#define GL_HSL_COLOR_NV 0x92AF +#define GL_HSL_HUE_NV 0x92AD +#define GL_HSL_LUMINOSITY_NV 0x92B0 +#define GL_HSL_SATURATION_NV 0x92AE +#define GL_INVERT_OVG_NV 0x92B4 +#define GL_INVERT_RGB_NV 0x92A3 +#define GL_LIGHTEN_NV 0x9298 +#define GL_LINEARBURN_NV 0x92A5 +#define GL_LINEARDODGE_NV 0x92A4 +#define GL_LINEARLIGHT_NV 0x92A7 +#define GL_MINUS_CLAMPED_NV 0x92B3 +#define GL_MINUS_NV 0x929F +#define GL_MULTIPLY_NV 0x9294 +#define GL_OVERLAY_NV 0x9296 +#define GL_PINLIGHT_NV 0x92A8 +#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 +#define GL_PLUS_CLAMPED_NV 0x92B1 +#define GL_PLUS_DARKER_NV 0x9292 +#define GL_PLUS_NV 0x9291 +#define GL_RED_NV 0x1903 +#define GL_SCREEN_NV 0x9295 +#define GL_SOFTLIGHT_NV 0x929C +#define GL_SRC_ATOP_NV 0x928E +#define GL_SRC_IN_NV 0x928A +#define GL_SRC_NV 0x9286 +#define GL_SRC_OUT_NV 0x928C +#define GL_SRC_OVER_NV 0x9288 +#define GL_UNCORRELATED_NV 0x9282 +#define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_XOR_NV 0x1506 +typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendParameteriNV (GLenum pname, GLint value); +GLAPI void APIENTRY glBlendBarrierNV (void); +#endif +#endif /* GL_NV_blend_equation_advanced */ + +#ifndef GL_NV_blend_equation_advanced_coherent +#define GL_NV_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 +#endif /* GL_NV_blend_equation_advanced_coherent */ + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif /* GL_NV_blend_square */ + +#ifndef GL_NV_command_list +#define GL_NV_command_list 1 +#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000 +#define GL_NOP_COMMAND_NV 0x0001 +#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002 +#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003 +#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004 +#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005 +#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006 +#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007 +#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008 +#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009 +#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000A +#define GL_BLEND_COLOR_COMMAND_NV 0x000B +#define GL_STENCIL_REF_COMMAND_NV 0x000C +#define GL_LINE_WIDTH_COMMAND_NV 0x000D +#define GL_POLYGON_OFFSET_COMMAND_NV 0x000E +#define GL_ALPHA_REF_COMMAND_NV 0x000F +#define GL_VIEWPORT_COMMAND_NV 0x0010 +#define GL_SCISSOR_COMMAND_NV 0x0011 +#define GL_FRONT_FACE_COMMAND_NV 0x0012 +typedef void (APIENTRYP PFNGLCREATESTATESNVPROC) (GLsizei n, GLuint *states); +typedef void (APIENTRYP PFNGLDELETESTATESNVPROC) (GLsizei n, const GLuint *states); +typedef GLboolean (APIENTRYP PFNGLISSTATENVPROC) (GLuint state); +typedef void (APIENTRYP PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode); +typedef GLuint (APIENTRYP PFNGLGETCOMMANDHEADERNVPROC) (GLenum tokenID, GLuint size); +typedef GLushort (APIENTRYP PFNGLGETSTAGEINDEXNVPROC) (GLenum shadertype); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSNVPROC) (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSADDRESSNVPROC) (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESNVPROC) (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC) (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLCREATECOMMANDLISTSNVPROC) (GLsizei n, GLuint *lists); +typedef void (APIENTRYP PFNGLDELETECOMMANDLISTSNVPROC) (GLsizei n, const GLuint *lists); +typedef GLboolean (APIENTRYP PFNGLISCOMMANDLISTNVPROC) (GLuint list); +typedef void (APIENTRYP PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC) (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLCOMMANDLISTSEGMENTSNVPROC) (GLuint list, GLuint segments); +typedef void (APIENTRYP PFNGLCOMPILECOMMANDLISTNVPROC) (GLuint list); +typedef void (APIENTRYP PFNGLCALLCOMMANDLISTNVPROC) (GLuint list); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCreateStatesNV (GLsizei n, GLuint *states); +GLAPI void APIENTRY glDeleteStatesNV (GLsizei n, const GLuint *states); +GLAPI GLboolean APIENTRY glIsStateNV (GLuint state); +GLAPI void APIENTRY glStateCaptureNV (GLuint state, GLenum mode); +GLAPI GLuint APIENTRY glGetCommandHeaderNV (GLenum tokenID, GLuint size); +GLAPI GLushort APIENTRY glGetStageIndexNV (GLenum shadertype); +GLAPI void APIENTRY glDrawCommandsNV (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); +GLAPI void APIENTRY glDrawCommandsAddressNV (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); +GLAPI void APIENTRY glDrawCommandsStatesNV (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glDrawCommandsStatesAddressNV (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glCreateCommandListsNV (GLsizei n, GLuint *lists); +GLAPI void APIENTRY glDeleteCommandListsNV (GLsizei n, const GLuint *lists); +GLAPI GLboolean APIENTRY glIsCommandListNV (GLuint list); +GLAPI void APIENTRY glListDrawCommandsStatesClientNV (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glCommandListSegmentsNV (GLuint list, GLuint segments); +GLAPI void APIENTRY glCompileCommandListNV (GLuint list); +GLAPI void APIENTRY glCallCommandListNV (GLuint list); +#endif +#endif /* GL_NV_command_list */ + +#ifndef GL_NV_compute_program5 +#define GL_NV_compute_program5 1 +#define GL_COMPUTE_PROGRAM_NV 0x90FB +#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC +#endif /* GL_NV_compute_program5 */ + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRenderNV (void); +#endif +#endif /* GL_NV_conditional_render */ + +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); +#endif +#endif /* GL_NV_conservative_raster */ + +#ifndef GL_NV_conservative_raster_dilate +#define GL_NV_conservative_raster_dilate 1 +#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379 +#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A +#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B +typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat value); +#endif +#endif /* GL_NV_conservative_raster_dilate */ + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif /* GL_NV_copy_depth_to_color */ + +#ifndef GL_NV_copy_image +#define GL_NV_copy_image 1 +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_NV_copy_image */ + +#ifndef GL_NV_deep_texture3D +#define GL_NV_deep_texture3D 1 +#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0 +#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV 0x90D1 +#endif /* GL_NV_deep_texture3D */ + +#ifndef GL_NV_depth_buffer_float +#define GL_NV_depth_buffer_float 1 +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF +typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glClearDepthdNV (GLdouble depth); +GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax); +#endif +#endif /* GL_NV_depth_buffer_float */ + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#define GL_DEPTH_CLAMP_NV 0x864F +#endif /* GL_NV_depth_clamp */ + +#ifndef GL_NV_draw_texture +#define GL_NV_draw_texture 1 +typedef void (APIENTRYP PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +#endif +#endif /* GL_NV_draw_texture */ + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points); +GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode); +#endif +#endif /* GL_NV_evaluators */ + +#ifndef GL_NV_explicit_multisample +#define GL_NV_explicit_multisample 1 +#define GL_SAMPLE_POSITION_NV 0x8E50 +#define GL_SAMPLE_MASK_NV 0x8E51 +#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 +#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 +#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 +#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 +#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 +#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 +#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 +#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); +typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask); +GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer); +#endif +#endif /* GL_NV_explicit_multisample */ + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence); +GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GLAPI void APIENTRY glFinishFenceNV (GLuint fence); +GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); +#endif +#endif /* GL_NV_fence */ + +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif /* GL_NV_float_buffer */ + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +#endif /* GL_NV_fog_distance */ + +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color); +#endif +#endif /* GL_NV_fragment_coverage_to_color */ + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif +#endif /* GL_NV_fragment_program */ + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif /* GL_NV_fragment_program2 */ + +#ifndef GL_NV_fragment_program4 +#define GL_NV_fragment_program4 1 +#endif /* GL_NV_fragment_program4 */ + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif /* GL_NV_fragment_program_option */ + +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GLAPI void APIENTRY glCoverageModulationNV (GLenum components); +#endif +#endif /* GL_NV_framebuffer_mixed_samples */ + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_NV_framebuffer_multisample_coverage 1 +#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB +#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_NV_framebuffer_multisample_coverage */ + +#ifndef GL_NV_geometry_program4 +#define GL_NV_geometry_program4 1 +#define GL_GEOMETRY_PROGRAM_NV 0x8C26 +#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 +#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 +typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); +GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif +#endif /* GL_NV_geometry_program4 */ + +#ifndef GL_NV_geometry_shader4 +#define GL_NV_geometry_shader4 1 +#endif /* GL_NV_geometry_shader4 */ + +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + +#ifndef GL_NV_gpu_program4 +#define GL_NV_gpu_program4 1 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 +#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 +#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 +#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 +#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 +#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 +#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params); +GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params); +#endif +#endif /* GL_NV_gpu_program4 */ + +#ifndef GL_NV_gpu_program5 +#define GL_NV_gpu_program5 1 +#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C +#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F +#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 +#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 +typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param); +#endif +#endif /* GL_NV_gpu_program5 */ + +#ifndef GL_NV_gpu_program5_mem_extended +#define GL_NV_gpu_program5_mem_extended 1 +#endif /* GL_NV_gpu_program5_mem_extended */ + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 +#endif /* GL_NV_gpu_shader5 */ + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +typedef unsigned short GLhalfNV; +#define GL_HALF_FLOAT_NV 0x140B +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +#endif +#endif /* GL_NV_half_float */ + +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif /* GL_NV_light_max_exponent */ + +#ifndef GL_NV_multisample_coverage +#define GL_NV_multisample_coverage 1 +#endif /* GL_NV_multisample_coverage */ + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif /* GL_NV_multisample_filter_hint */ + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params); +#endif +#endif /* GL_NV_occlusion_query */ + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif /* GL_NV_packed_depth_stencil */ + +#ifndef GL_NV_parameter_buffer_object +#define GL_NV_parameter_buffer_object 1 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 +#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 +#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 +#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params); +#endif +#endif /* GL_NV_parameter_buffer_object */ + +#ifndef GL_NV_parameter_buffer_object2 +#define GL_NV_parameter_buffer_object2 1 +#endif /* GL_NV_parameter_buffer_object2 */ + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_BOLD_BIT_NV 0x01 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 +#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 +#define GL_FONT_ASCENDER_BIT_NV 0x00200000 +#define GL_FONT_DESCENDER_BIT_NV 0x00400000 +#define GL_FONT_HEIGHT_BIT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 +#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_2_BYTES_NV 0x1407 +#define GL_3_BYTES_NV 0x1408 +#define GL_4_BYTES_NV 0x1409 +#define GL_EYE_LINEAR_NV 0x2400 +#define GL_OBJECT_LINEAR_NV 0x2401 +#define GL_CONSTANT_NV 0x8576 +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D +typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path); +typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); +typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); +typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); +typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); +typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); +typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); +typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); +typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); +GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); +GLAPI GLboolean APIENTRY glIsPathNV (GLuint path); +GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString); +GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); +GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); +GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); +GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); +GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); +GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); +GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); +GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); +GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func); +GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); +GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); +GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); +GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); +GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); +GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); +GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); +GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); +GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GLAPI void APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); +GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); +#endif +#endif /* GL_NV_path_rendering */ + +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const void *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const void *pointer); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target); +#endif +#endif /* GL_NV_pixel_data_range */ + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params); +#endif +#endif /* GL_NV_point_sprite */ + +#ifndef GL_NV_present_video +#define GL_NV_present_video 1 +#define GL_FRAME_NV 0x8E26 +#define GL_FIELDS_NV 0x8E27 +#define GL_CURRENT_TIME_NV 0x8E28 +#define GL_NUM_FILL_STREAMS_NV 0x8E29 +#define GL_PRESENT_TIME_NV 0x8E2A +#define GL_PRESENT_DURATION_NV 0x8E2B +typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); +typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); +GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params); +#endif +#endif /* GL_NV_present_video */ + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); +#endif +#endif /* GL_NV_primitive_restart */ + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param); +GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params); +#endif +#endif /* GL_NV_register_combiners */ + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params); +#endif +#endif /* GL_NV_register_combiners2 */ + +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + +#ifndef GL_NV_shader_atomic_counters +#define GL_NV_shader_atomic_counters 1 +#endif /* GL_NV_shader_atomic_counters */ + +#ifndef GL_NV_shader_atomic_float +#define GL_NV_shader_atomic_float 1 +#endif /* GL_NV_shader_atomic_float */ + +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + +#ifndef GL_NV_shader_atomic_int64 +#define GL_NV_shader_atomic_int64 1 +#endif /* GL_NV_shader_atomic_int64 */ + +#ifndef GL_NV_shader_buffer_load +#define GL_NV_shader_buffer_load 1 +#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D +#define GL_GPU_ADDRESS_NV 0x8F34 +#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 +typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access); +typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target); +typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target); +typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access); +typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer); +typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result); +typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); +typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access); +GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target); +GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target); +GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access); +GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer); +GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer); +GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result); +GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value); +GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value); +GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_NV_shader_buffer_load */ + +#ifndef GL_NV_shader_buffer_store +#define GL_NV_shader_buffer_store 1 +#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 +#endif /* GL_NV_shader_buffer_store */ + +#ifndef GL_NV_shader_storage_buffer_object +#define GL_NV_shader_storage_buffer_object 1 +#endif /* GL_NV_shader_storage_buffer_object */ + +#ifndef GL_NV_shader_thread_group +#define GL_NV_shader_thread_group 1 +#define GL_WARP_SIZE_NV 0x9339 +#define GL_WARPS_PER_SM_NV 0x933A +#define GL_SM_COUNT_NV 0x933B +#endif /* GL_NV_shader_thread_group */ + +#ifndef GL_NV_shader_thread_shuffle +#define GL_NV_shader_thread_shuffle 1 +#endif /* GL_NV_shader_thread_shuffle */ + +#ifndef GL_NV_tessellation_program5 +#define GL_NV_tessellation_program5 1 +#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 +#define GL_TESS_CONTROL_PROGRAM_NV 0x891E +#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F +#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 +#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 +#endif /* GL_NV_tessellation_program5 */ + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif /* GL_NV_texgen_emboss */ + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif /* GL_NV_texgen_reflection */ + +#ifndef GL_NV_texture_barrier +#define GL_NV_texture_barrier 1 +typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureBarrierNV (void); +#endif +#endif /* GL_NV_texture_barrier */ + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif /* GL_NV_texture_compression_vtc */ + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif /* GL_NV_texture_env_combine4 */ + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif /* GL_NV_texture_expand_normal */ + +#ifndef GL_NV_texture_multisample +#define GL_NV_texture_multisample 1 +#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 +#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +#endif +#endif /* GL_NV_texture_multisample */ + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif /* GL_NV_texture_rectangle */ + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3 +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif /* GL_NV_texture_shader */ + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif /* GL_NV_texture_shader2 */ + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif /* GL_NV_texture_shader3 */ + +#ifndef GL_NV_transform_feedback +#define GL_NV_transform_feedback 1 +#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 +#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 +#define GL_TEXTURE_COORD_NV 0x8C79 +#define GL_CLIP_DISTANCE_NV 0x8C7A +#define GL_VERTEX_ID_NV 0x8C7B +#define GL_PRIMITIVE_ID_NV 0x8C7C +#define GL_GENERIC_ATTRIB_NV 0x8C7D +#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 +#define GL_ACTIVE_VARYINGS_NV 0x8C81 +#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 +#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 +#define GL_PRIMITIVES_GENERATED_NV 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 +#define GL_RASTERIZER_DISCARD_NV 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B +#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C +#define GL_SEPARATE_ATTRIBS_NV 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F +#define GL_LAYER_NV 0x8DAA +#define GL_NEXT_BUFFER_NV -2 +#define GL_SKIP_COMPONENTS4_NV -3 +#define GL_SKIP_COMPONENTS3_NV -4 +#define GL_SKIP_COMPONENTS2_NV -5 +#define GL_SKIP_COMPONENTS1_NV -6 +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); +typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedbackNV (void); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLsizei count, const GLint *attribs, GLenum bufferMode); +GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); +GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name); +GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location); +GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); +#endif +#endif /* GL_NV_transform_feedback */ + +#ifndef GL_NV_transform_feedback2 +#define GL_NV_transform_feedback2 1 +#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedbackNV (void); +GLAPI void APIENTRY glResumeTransformFeedbackNV (void); +GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); +#endif +#endif /* GL_NV_transform_feedback2 */ + +#ifndef GL_NV_uniform_buffer_unified_memory +#define GL_NV_uniform_buffer_unified_memory 1 +#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E +#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F +#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370 +#endif /* GL_NV_uniform_buffer_unified_memory */ + +#ifndef GL_NV_vdpau_interop +#define GL_NV_vdpau_interop 1 +typedef GLintptr GLvdpauSurfaceNV; +#define GL_SURFACE_STATE_NV 0x86EB +#define GL_SURFACE_REGISTERED_NV 0x86FD +#define GL_SURFACE_MAPPED_NV 0x8700 +#define GL_WRITE_DISCARD_NV 0x88BE +typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const void *vdpDevice, const void *getProcAddress); +typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); +typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVDPAUInitNV (const void *vdpDevice, const void *getProcAddress); +GLAPI void APIENTRY glVDPAUFiniNV (void); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); +GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#endif +#endif /* GL_NV_vdpau_interop */ + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const void *pointer); +#endif +#endif /* GL_NV_vertex_array_range */ + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif /* GL_NV_vertex_array_range2 */ + +#ifndef GL_NV_vertex_attrib_integer_64bit +#define GL_NV_vertex_attrib_integer_64bit 1 +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x); +GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); +#endif +#endif /* GL_NV_vertex_attrib_integer_64bit */ + +#ifndef GL_NV_vertex_buffer_unified_memory +#define GL_NV_vertex_buffer_unified_memory 1 +#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E +#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F +#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 +#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 +#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 +#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 +#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 +#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 +#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 +#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 +#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 +#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 +#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A +#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B +#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C +#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D +#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E +#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F +#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 +#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 +#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 +#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 +#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 +#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 +#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 +typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); +typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); +GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride); +GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); +GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result); +#endif +#endif /* GL_NV_vertex_buffer_unified_memory */ + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, void **pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences); +GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params); +GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, void **pointer); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id); +GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v); +#endif +#endif /* GL_NV_vertex_program */ + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif /* GL_NV_vertex_program1_1 */ + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif /* GL_NV_vertex_program2 */ + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif /* GL_NV_vertex_program2_option */ + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif /* GL_NV_vertex_program3 */ + +#ifndef GL_NV_vertex_program4 +#define GL_NV_vertex_program4 1 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); +#endif +#endif /* GL_NV_vertex_program4 */ + +#ifndef GL_NV_video_capture +#define GL_NV_video_capture 1 +#define GL_VIDEO_BUFFER_NV 0x9020 +#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 +#define GL_FIELD_UPPER_NV 0x9022 +#define GL_FIELD_LOWER_NV 0x9023 +#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 +#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 +#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 +#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 +#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 +#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 +#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A +#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B +#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C +#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D +#define GL_PARTIAL_SUCCESS_NV 0x902E +#define GL_SUCCESS_NV 0x902F +#define GL_FAILURE_NV 0x9030 +#define GL_YCBYCR8_422_NV 0x9031 +#define GL_YCBAYCR8A_4224_NV 0x9032 +#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 +#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 +#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 +#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 +#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 +#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 +#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 +#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A +#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B +#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C +typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); +typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot); +GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot); +GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); +GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); +GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); +GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); +#endif +#endif /* GL_NV_video_capture */ + +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 +#endif /* GL_NV_viewport_array2 */ + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif /* GL_OML_interlace */ + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif /* GL_OML_resample */ + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif /* GL_OML_subsample */ + +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview */ + +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 +#endif /* GL_OVR_multiview2 */ + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode); +#endif +#endif /* GL_PGI_misc_hints */ + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif /* GL_PGI_vertex_hints */ + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif /* GL_REND_screen_coordinates */ + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#define GL_RGBA_DXT5_S3TC 0x83A4 +#define GL_RGBA4_DXT5_S3TC 0x83A5 +#endif /* GL_S3_s3tc */ + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points); +#endif +#endif /* GL_SGIS_detail_texture */ + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points); +#endif +#endif /* GL_SGIS_fog_function */ + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif /* GL_SGIS_generate_mipmap */ + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern); +#endif +#endif /* GL_SGIS_multisample */ + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params); +#endif +#endif /* GL_SGIS_pixel_texture */ + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif /* GL_SGIS_point_line_texgen */ + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params); +#endif +#endif /* GL_SGIS_point_parameters */ + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points); +#endif +#endif /* GL_SGIS_sharpen_texture */ + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels); +#endif +#endif /* GL_SGIS_texture4D */ + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif /* GL_SGIS_texture_border_clamp */ + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif +#endif /* GL_SGIS_texture_color_mask */ + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif /* GL_SGIS_texture_edge_clamp */ + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif +#endif /* GL_SGIS_texture_filter4 */ + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif /* GL_SGIS_texture_lod */ + +#ifndef GL_SGIS_texture_select +#define GL_SGIS_texture_select 1 +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif /* GL_SGIS_texture_select */ + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#define GL_ASYNC_MARKER_SGIX 0x8329 +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker); +#endif +#endif /* GL_SGIX_async */ + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif /* GL_SGIX_async_histogram */ + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif /* GL_SGIX_async_pixel */ + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif /* GL_SGIX_blend_alpha_minmax */ + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif /* GL_SGIX_calligraphic_fragment */ + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif /* GL_SGIX_clipmap */ + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif /* GL_SGIX_convolution_accuracy */ + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif /* GL_SGIX_depth_pass_instrument */ + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif /* GL_SGIX_depth_texture */ + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif +#endif /* GL_SGIX_flush_raster */ + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif /* GL_SGIX_fog_offset */ + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params); +GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param); +#endif +#endif /* GL_SGIX_fragment_lighting */ + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint factor); +#endif +#endif /* GL_SGIX_framezoom */ + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const void *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const void *params); +#endif +#endif /* GL_SGIX_igloo_interface */ + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker); +#endif +#endif /* GL_SGIX_instruments */ + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#define GL_INTERLACE_SGIX 0x8094 +#endif /* GL_SGIX_interlace */ + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif /* GL_SGIX_ir_instrument1 */ + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#define GL_LIST_PRIORITY_SGIX 0x8182 +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params); +GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param); +GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params); +#endif +#endif /* GL_SGIX_list_priority */ + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode); +#endif +#endif /* GL_SGIX_pixel_texture */ + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif /* GL_SGIX_pixel_tiles */ + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +GLAPI void APIENTRY glDeformSGIX (GLbitfield mask); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask); +#endif +#endif /* GL_SGIX_polynomial_ffd */ + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation); +#endif +#endif /* GL_SGIX_reference_plane */ + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#define GL_PACK_RESAMPLE_SGIX 0x842E +#define GL_UNPACK_RESAMPLE_SGIX 0x842F +#define GL_RESAMPLE_REPLICATE_SGIX 0x8433 +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif /* GL_SGIX_resample */ + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif /* GL_SGIX_scalebias_hint */ + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif /* GL_SGIX_shadow */ + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif /* GL_SGIX_shadow_ambient */ + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params); +#endif +#endif /* GL_SGIX_sprite */ + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif /* GL_SGIX_subsample */ + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif +#endif /* GL_SGIX_tag_sample_buffer */ + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif /* GL_SGIX_texture_add_env */ + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif /* GL_SGIX_texture_coordinate_clamp */ + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif /* GL_SGIX_texture_lod_bias */ + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif /* GL_SGIX_texture_multi_buffer */ + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif /* GL_SGIX_texture_scale_bias */ + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif /* GL_SGIX_vertex_preclip */ + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif /* GL_SGIX_ycrcb */ + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif /* GL_SGIX_ycrcb_subsample */ + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif /* GL_SGIX_ycrcba */ + +#ifndef GL_SGI_color_matrix +#define GL_SGI_color_matrix 1 +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif /* GL_SGI_color_matrix */ + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, void *table); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params); +#endif +#endif /* GL_SGI_color_table */ + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif /* GL_SGI_texture_color_table */ + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif +#endif /* GL_SUNX_constant_data */ + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif /* GL_SUN_convolution_border_modes */ + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor); +#endif +#endif /* GL_SUN_global_alpha */ + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif +#endif /* GL_SUN_mesh_array */ + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif /* GL_SUN_slice_accum */ + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void **pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const void **pointer); +#endif +#endif /* GL_SUN_triangle_list */ + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif +#endif /* GL_SUN_vertex */ + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif /* GL_WIN_phong_shading */ + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif /* GL_WIN_specular_fog */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/rust/khronos_api/api/GL/glxext.h b/third_party/rust/khronos_api/api/GL/glxext.h new file mode 100755 index 000000000000..77f1bb2522ea --- /dev/null +++ b/third_party/rust/khronos_api/api/GL/glxext.h @@ -0,0 +1,926 @@ +#ifndef __glxext_h_ +#define __glxext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision$ on $Date$ +*/ + +#define GLX_GLXEXT_VERSION 20150623 + +/* Generated C header for: + * API: glx + * Versions considered: .* + * Versions emitted: 1\.[3-9] + * Default extensions included: glx + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 +typedef XID GLXContextID; +typedef struct __GLXFBConfigRec *GLXFBConfig; +typedef XID GLXWindow; +typedef XID GLXPbuffer; +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +typedef GLXFBConfig *( *PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig *( *PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int ( *PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow ( *PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( *PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap ( *PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void ( *PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer ( *PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void ( *PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( *PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext ( *PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool ( *PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef int ( *PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( *PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void ( *PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#ifdef GLX_GLXEXT_PROTOTYPES +GLXFBConfig *glXGetFBConfigs (Display *dpy, int screen, int *nelements); +GLXFBConfig *glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements); +int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value); +XVisualInfo *glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config); +GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +void glXDestroyWindow (Display *dpy, GLXWindow win); +GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap); +GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list); +void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf); +void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +GLXDrawable glXGetCurrentReadDrawable (void); +int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value); +void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask); +void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif +#endif /* GLX_VERSION_1_3 */ + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 +typedef void ( *__GLXextFuncPtr)(void); +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 +typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); +#ifdef GLX_GLXEXT_PROTOTYPES +__GLXextFuncPtr glXGetProcAddress (const GLubyte *procName); +#endif +#endif /* GLX_VERSION_1_4 */ + +#ifndef GLX_ARB_context_flush_control +#define GLX_ARB_context_flush_control 1 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif /* GLX_ARB_context_flush_control */ + +#ifndef GLX_ARB_create_context +#define GLX_ARB_create_context 1 +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +#ifdef GLX_GLXEXT_PROTOTYPES +GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +#endif +#endif /* GLX_ARB_create_context */ + +#ifndef GLX_ARB_create_context_profile +#define GLX_ARB_create_context_profile 1 +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#endif /* GLX_ARB_create_context_profile */ + +#ifndef GLX_ARB_create_context_robustness +#define GLX_ARB_create_context_robustness 1 +#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 +#endif /* GLX_ARB_create_context_robustness */ + +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#endif /* GLX_ARB_fbconfig_float */ + +#ifndef GLX_ARB_framebuffer_sRGB +#define GLX_ARB_framebuffer_sRGB 1 +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 +#endif /* GLX_ARB_framebuffer_sRGB */ + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); +#ifdef GLX_GLXEXT_PROTOTYPES +__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); +#endif +#endif /* GLX_ARB_get_proc_address */ + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#endif /* GLX_ARB_multisample */ + +#ifndef GLX_ARB_robustness_application_isolation +#define GLX_ARB_robustness_application_isolation 1 +#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 +#endif /* GLX_ARB_robustness_application_isolation */ + +#ifndef GLX_ARB_robustness_share_group_isolation +#define GLX_ARB_robustness_share_group_isolation 1 +#endif /* GLX_ARB_robustness_share_group_isolation */ + +#ifndef GLX_ARB_vertex_buffer_object +#define GLX_ARB_vertex_buffer_object 1 +#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 +#endif /* GLX_ARB_vertex_buffer_object */ + +#ifndef GLX_3DFX_multisample +#define GLX_3DFX_multisample 1 +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#endif /* GLX_3DFX_multisample */ + +#ifndef GLX_AMD_gpu_association +#define GLX_AMD_gpu_association 1 +#define GLX_GPU_VENDOR_AMD 0x1F00 +#define GLX_GPU_RENDERER_STRING_AMD 0x1F01 +#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define GLX_GPU_RAM_AMD 0x21A3 +#define GLX_GPU_CLOCK_AMD 0x21A4 +#define GLX_GPU_NUM_PIPES_AMD 0x21A5 +#define GLX_GPU_NUM_SIMD_AMD 0x21A6 +#define GLX_GPU_NUM_RB_AMD 0x21A7 +#define GLX_GPU_NUM_SPI_AMD 0x21A8 +typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids); +typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); +typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx); +typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list); +typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList); +typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx); +typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx); +typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GLX_GLXEXT_PROTOTYPES +unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids); +int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); +unsigned int glXGetContextGPUIDAMD (GLXContext ctx); +GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list); +GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList); +Bool glXDeleteAssociatedContextAMD (GLXContext ctx); +Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx); +GLXContext glXGetCurrentAssociatedContextAMD (void); +void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GLX_AMD_gpu_association */ + +#ifndef GLX_EXT_buffer_age +#define GLX_EXT_buffer_age 1 +#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 +#endif /* GLX_EXT_buffer_age */ + +#ifndef GLX_EXT_create_context_es2_profile +#define GLX_EXT_create_context_es2_profile 1 +#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif /* GLX_EXT_create_context_es2_profile */ + +#ifndef GLX_EXT_create_context_es_profile +#define GLX_EXT_create_context_es_profile 1 +#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 +#endif /* GLX_EXT_create_context_es_profile */ + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_EXT_fbconfig_packed_float 1 +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 +#endif /* GLX_EXT_fbconfig_packed_float */ + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_EXT_framebuffer_sRGB 1 +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 +#endif /* GLX_EXT_framebuffer_sRGB */ + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +typedef Display *( *PFNGLXGETCURRENTDISPLAYEXTPROC) (void); +typedef int ( *PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); +typedef GLXContextID ( *PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( *PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void ( *PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); +#ifdef GLX_GLXEXT_PROTOTYPES +Display *glXGetCurrentDisplayEXT (void); +int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value); +GLXContextID glXGetContextIDEXT (const GLXContext context); +GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID); +void glXFreeContextEXT (Display *dpy, GLXContext context); +#endif +#endif /* GLX_EXT_import_context */ + +#ifndef GLX_EXT_stereo_tree +#define GLX_EXT_stereo_tree 1 +typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + int extension; + int evtype; + GLXDrawable window; + Bool stereo_tree; +} GLXStereoNotifyEventEXT; +#define GLX_STEREO_TREE_EXT 0x20F5 +#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001 +#define GLX_STEREO_NOTIFY_EXT 0x00000000 +#endif /* GLX_EXT_stereo_tree */ + +#ifndef GLX_EXT_swap_control +#define GLX_EXT_swap_control 1 +#define GLX_SWAP_INTERVAL_EXT 0x20F1 +#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 +typedef void ( *PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval); +#endif +#endif /* GLX_EXT_swap_control */ + +#ifndef GLX_EXT_swap_control_tear +#define GLX_EXT_swap_control_tear 1 +#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3 +#endif /* GLX_EXT_swap_control_tear */ + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_EXT_texture_from_pixmap 1 +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 +#define GLX_TEXTURE_FORMAT_EXT 0x20D5 +#define GLX_TEXTURE_TARGET_EXT 0x20D6 +#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA +#define GLX_TEXTURE_1D_EXT 0x20DB +#define GLX_TEXTURE_2D_EXT 0x20DC +#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD +#define GLX_FRONT_LEFT_EXT 0x20DE +#define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_LEFT_EXT 0x20E0 +#define GLX_BACK_RIGHT_EXT 0x20E1 +#define GLX_FRONT_EXT 0x20DE +#define GLX_BACK_EXT 0x20E0 +#define GLX_AUX0_EXT 0x20E2 +#define GLX_AUX1_EXT 0x20E3 +#define GLX_AUX2_EXT 0x20E4 +#define GLX_AUX3_EXT 0x20E5 +#define GLX_AUX4_EXT 0x20E6 +#define GLX_AUX5_EXT 0x20E7 +#define GLX_AUX6_EXT 0x20E8 +#define GLX_AUX7_EXT 0x20E9 +#define GLX_AUX8_EXT 0x20EA +#define GLX_AUX9_EXT 0x20EB +typedef void ( *PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +typedef void ( *PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer); +#endif +#endif /* GLX_EXT_texture_from_pixmap */ + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#endif /* GLX_EXT_visual_info */ + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +#endif /* GLX_EXT_visual_rating */ + +#ifndef GLX_INTEL_swap_event +#define GLX_INTEL_swap_event 1 +#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 +#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 +#define GLX_COPY_COMPLETE_INTEL 0x8181 +#define GLX_FLIP_COMPLETE_INTEL 0x8182 +#endif /* GLX_INTEL_swap_event */ + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 +typedef unsigned int ( *PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); +#ifdef GLX_GLXEXT_PROTOTYPES +unsigned int glXGetAGPOffsetMESA (const void *pointer); +#endif +#endif /* GLX_MESA_agp_offset */ + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +typedef void ( *PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif +#endif /* GLX_MESA_copy_sub_buffer */ + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#ifdef GLX_GLXEXT_PROTOTYPES +GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif +#endif /* GLX_MESA_pixmap_colormap */ + +#ifndef GLX_MESA_query_renderer +#define GLX_MESA_query_renderer 1 +#define GLX_RENDERER_VENDOR_ID_MESA 0x8183 +#define GLX_RENDERER_DEVICE_ID_MESA 0x8184 +#define GLX_RENDERER_VERSION_MESA 0x8185 +#define GLX_RENDERER_ACCELERATED_MESA 0x8186 +#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 +#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 +#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 +#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A +#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B +#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C +#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D +#define GLX_RENDERER_ID_MESA 0x818E +typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value); +typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute); +typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value); +typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value); +const char *glXQueryCurrentRendererStringMESA (int attribute); +Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value); +const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute); +#endif +#endif /* GLX_MESA_query_renderer */ + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable); +#endif +#endif /* GLX_MESA_release_buffers */ + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXSet3DfxModeMESA (int mode); +#endif +#endif /* GLX_MESA_set_3dfx_mode */ + +#ifndef GLX_NV_copy_buffer +#define GLX_NV_copy_buffer 1 +typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif +#endif /* GLX_NV_copy_buffer */ + +#ifndef GLX_NV_copy_image +#define GLX_NV_copy_image 1 +typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GLX_NV_copy_image */ + +#ifndef GLX_NV_delay_before_swap +#define GLX_NV_delay_before_swap 1 +typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds); +#endif +#endif /* GLX_NV_delay_before_swap */ + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#endif /* GLX_NV_float_buffer */ + +#ifndef GLX_NV_multisample_coverage +#define GLX_NV_multisample_coverage 1 +#define GLX_COVERAGE_SAMPLES_NV 100001 +#define GLX_COLOR_SAMPLES_NV 0x20B3 +#endif /* GLX_NV_multisample_coverage */ + +#ifndef GLX_NV_present_video +#define GLX_NV_present_video 1 +#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 +typedef unsigned int *( *PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements); +typedef int ( *PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); +#ifdef GLX_GLXEXT_PROTOTYPES +unsigned int *glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements); +int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); +#endif +#endif /* GLX_NV_present_video */ + +#ifndef GLX_NV_swap_group +#define GLX_NV_swap_group 1 +typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group); +typedef Bool ( *PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier); +typedef Bool ( *PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); +typedef Bool ( *PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); +typedef Bool ( *PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count); +typedef Bool ( *PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group); +Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier); +Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); +Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); +Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count); +Bool glXResetFrameCountNV (Display *dpy, int screen); +#endif +#endif /* GLX_NV_swap_group */ + +#ifndef GLX_NV_video_capture +#define GLX_NV_video_capture 1 +typedef XID GLXVideoCaptureDeviceNV; +#define GLX_DEVICE_ID_NV 0x20CD +#define GLX_UNIQUE_ID_NV 0x20CE +#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF +typedef int ( *PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +typedef GLXVideoCaptureDeviceNV *( *PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements); +typedef void ( *PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); +typedef int ( *PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +typedef void ( *PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); +#ifdef GLX_GLXEXT_PROTOTYPES +int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +GLXVideoCaptureDeviceNV *glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements); +void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device); +int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device); +#endif +#endif /* GLX_NV_video_capture */ + +#ifndef GLX_NV_video_out +#define GLX_NV_video_out 1 +typedef unsigned int GLXVideoDeviceNV; +#define GLX_VIDEO_OUT_COLOR_NV 0x20C3 +#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 +#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 +#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define GLX_VIDEO_OUT_FRAME_NV 0x20C8 +#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 +#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA +#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB +#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC +typedef int ( *PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); +typedef int ( *PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice); +typedef int ( *PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); +typedef int ( *PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf); +typedef int ( *PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); +typedef int ( *PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#ifdef GLX_GLXEXT_PROTOTYPES +int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); +int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice); +int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); +int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf); +int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); +int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif +#endif /* GLX_NV_video_out */ + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 +#endif /* GLX_OML_swap_method */ + +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GLX_OML_sync_control extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif +typedef Bool ( *PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( *PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +typedef int64_t ( *PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( *PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( *PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#endif +#endif /* GLX_OML_sync_control */ + +#ifndef GLX_SGIS_blended_overlay +#define GLX_SGIS_blended_overlay 1 +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#endif /* GLX_SGIS_blended_overlay */ + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 +#endif /* GLX_SGIS_multisample */ + +#ifndef GLX_SGIS_shared_multisample +#define GLX_SGIS_shared_multisample 1 +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#endif /* GLX_SGIS_shared_multisample */ + +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +typedef XID GLXPbufferSGIX; +#ifdef _DM_BUFFER_H_ +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +typedef Bool ( *PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif +#endif /* _DM_BUFFER_H_ */ +#endif /* GLX_SGIX_dmbuffer */ + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +typedef int ( *PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX *( *PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); +typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef GLXContext ( *PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); +typedef GLXFBConfigSGIX ( *PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); +#ifdef GLX_GLXEXT_PROTOTYPES +int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +GLXFBConfigSGIX *glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements); +GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +XVisualInfo *glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config); +GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis); +#endif +#endif /* GLX_SGIX_fbconfig */ + +#ifndef GLX_SGIX_hyperpipe +#define GLX_SGIX_hyperpipe 1 +typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int networkId; +} GLXHyperpipeNetworkSGIX; +typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int channel; + unsigned int participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; +typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int srcXOrigin, srcYOrigin, srcWidth, srcHeight; + int destXOrigin, destYOrigin, destWidth, destHeight; +} GLXPipeRect; +typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int XOrigin, YOrigin, maxHeight, maxWidth; +} GLXPipeRectLimits; +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 +typedef GLXHyperpipeNetworkSGIX *( *PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); +typedef int ( *PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +typedef GLXHyperpipeConfigSGIX *( *PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); +typedef int ( *PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); +typedef int ( *PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); +typedef int ( *PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +typedef int ( *PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +typedef int ( *PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#ifdef GLX_GLXEXT_PROTOTYPES +GLXHyperpipeNetworkSGIX *glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes); +int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +GLXHyperpipeConfigSGIX *glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes); +int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId); +int glXBindHyperpipeSGIX (Display *dpy, int hpId); +int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#endif +#endif /* GLX_SGIX_hyperpipe */ + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); +typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); +typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#ifdef GLX_GLXEXT_PROTOTYPES +GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf); +int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask); +void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif +#endif /* GLX_SGIX_pbuffer */ + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +typedef void ( *PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( *PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier); +Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max); +#endif +#endif /* GLX_SGIX_swap_barrier */ + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +typedef void ( *PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif +#endif /* GLX_SGIX_swap_group */ + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +typedef int ( *PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); +typedef int ( *PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); +typedef int ( *PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( *PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( *PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); +#ifdef GLX_GLXEXT_PROTOTYPES +int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window); +int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h); +int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype); +#endif +#endif /* GLX_SGIX_video_resize */ + +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +typedef XID GLXVideoSourceSGIX; +#ifdef _VL_H +typedef GLXVideoSourceSGIX ( *PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +typedef void ( *PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#ifdef GLX_GLXEXT_PROTOTYPES +GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif +#endif /* _VL_H */ +#endif /* GLX_SGIX_video_source */ + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 +#endif /* GLX_SGIX_visual_select_group */ + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +typedef void ( *PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXCushionSGI (Display *dpy, Window window, float cushion); +#endif +#endif /* GLX_SGI_cushion */ + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +typedef Bool ( *PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +GLXDrawable glXGetCurrentReadDrawableSGI (void); +#endif +#endif /* GLX_SGI_make_current_read */ + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +typedef int ( *PFNGLXSWAPINTERVALSGIPROC) (int interval); +#ifdef GLX_GLXEXT_PROTOTYPES +int glXSwapIntervalSGI (int interval); +#endif +#endif /* GLX_SGI_swap_control */ + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +typedef int ( *PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); +typedef int ( *PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); +#ifdef GLX_GLXEXT_PROTOTYPES +int glXGetVideoSyncSGI (unsigned int *count); +int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count); +#endif +#endif /* GLX_SGI_video_sync */ + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#ifdef GLX_GLXEXT_PROTOTYPES +Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif +#endif /* GLX_SUN_get_transparent_index */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/rust/khronos_api/api/GL/wglext.h b/third_party/rust/khronos_api/api/GL/wglext.h new file mode 100755 index 000000000000..422d7534bf23 --- /dev/null +++ b/third_party/rust/khronos_api/api/GL/wglext.h @@ -0,0 +1,840 @@ +#ifndef __wglext_h_ +#define __wglext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision$ on $Date$ +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#define WGL_WGLEXT_VERSION 20150623 + +/* Generated C header for: + * API: wgl + * Versions considered: .* + * Versions emitted: _nomatch_^ + * Default extensions included: wgl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#ifdef WGL_WGLEXT_PROTOTYPES +HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType); +VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion); +BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height); +BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif +#endif /* WGL_ARB_buffer_region */ + +#ifndef WGL_ARB_context_flush_control +#define WGL_ARB_context_flush_control 1 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif /* WGL_ARB_context_flush_control */ + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +#ifdef WGL_WGLEXT_PROTOTYPES +HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif +#endif /* WGL_ARB_create_context */ + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile 1 +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define ERROR_INVALID_PROFILE_ARB 0x2096 +#endif /* WGL_ARB_create_context_profile */ + +#ifndef WGL_ARB_create_context_robustness +#define WGL_ARB_create_context_robustness 1 +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 +#endif /* WGL_ARB_create_context_robustness */ + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#ifdef WGL_WGLEXT_PROTOTYPES +const char *WINAPI wglGetExtensionsStringARB (HDC hdc); +#endif +#endif /* WGL_ARB_extensions_string */ + +#ifndef WGL_ARB_framebuffer_sRGB +#define WGL_ARB_framebuffer_sRGB 1 +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 +#endif /* WGL_ARB_framebuffer_sRGB */ + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +HDC WINAPI wglGetCurrentReadDCARB (void); +#endif +#endif /* WGL_ARB_make_current_read */ + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif /* WGL_ARB_multisample */ + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +DECLARE_HANDLE(HPBUFFERARB); +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer); +int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC); +BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer); +BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif +#endif /* WGL_ARB_pbuffer */ + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif +#endif /* WGL_ARB_pixel_format */ + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif /* WGL_ARB_pixel_format_float */ + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); +BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); +BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif +#endif /* WGL_ARB_render_texture */ + +#ifndef WGL_ARB_robustness_application_isolation +#define WGL_ARB_robustness_application_isolation 1 +#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 +#endif /* WGL_ARB_robustness_application_isolation */ + +#ifndef WGL_ARB_robustness_share_group_isolation +#define WGL_ARB_robustness_share_group_isolation 1 +#endif /* WGL_ARB_robustness_share_group_isolation */ + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif /* WGL_3DFX_multisample */ + +#ifndef WGL_3DL_stereo_control +#define WGL_3DL_stereo_control 1 +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState); +#endif +#endif /* WGL_3DL_stereo_control */ + +#ifndef WGL_AMD_gpu_association +#define WGL_AMD_gpu_association 1 +#define WGL_GPU_VENDOR_AMD 0x1F00 +#define WGL_GPU_RENDERER_STRING_AMD 0x1F01 +#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define WGL_GPU_RAM_AMD 0x21A3 +#define WGL_GPU_CLOCK_AMD 0x21A4 +#define WGL_GPU_NUM_PIPES_AMD 0x21A5 +#define WGL_GPU_NUM_SIMD_AMD 0x21A6 +#define WGL_GPU_NUM_RB_AMD 0x21A7 +#define WGL_GPU_NUM_SPI_AMD 0x21A8 +typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids); +typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data); +typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList); +typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); +typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef WGL_WGLEXT_PROTOTYPES +UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids); +INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data); +UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc); +HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id); +HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList); +BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc); +BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc); +HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void); +VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* WGL_AMD_gpu_association */ + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#endif /* WGL_ATI_pixel_format_float */ + +#ifndef WGL_EXT_create_context_es2_profile +#define WGL_EXT_create_context_es2_profile 1 +#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif /* WGL_EXT_create_context_es2_profile */ + +#ifndef WGL_EXT_create_context_es_profile +#define WGL_EXT_create_context_es_profile 1 +#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 +#endif /* WGL_EXT_create_context_es_profile */ + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif /* WGL_EXT_depth_float */ + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#ifdef WGL_WGLEXT_PROTOTYPES +GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id); +GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length); +GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id); +VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id); +#endif +#endif /* WGL_EXT_display_color_table */ + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +const char *WINAPI wglGetExtensionsStringEXT (void); +#endif +#endif /* WGL_EXT_extensions_string */ + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_EXT_framebuffer_sRGB 1 +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 +#endif /* WGL_EXT_framebuffer_sRGB */ + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif +#endif /* WGL_EXT_make_current_read */ + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif /* WGL_EXT_multisample */ + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +DECLARE_HANDLE(HPBUFFEREXT); +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer); +int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC); +BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer); +BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif +#endif /* WGL_EXT_pbuffer */ + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif +#endif /* WGL_EXT_pixel_format */ + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_EXT_pixel_format_packed_float 1 +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 +#endif /* WGL_EXT_pixel_format_packed_float */ + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglSwapIntervalEXT (int interval); +int WINAPI wglGetSwapIntervalEXT (void); +#endif +#endif /* WGL_EXT_swap_control */ + +#ifndef WGL_EXT_swap_control_tear +#define WGL_EXT_swap_control_tear 1 +#endif /* WGL_EXT_swap_control_tear */ + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue); +BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue); +#endif +#endif /* WGL_I3D_digital_video_control */ + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue); +BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue); +BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif +#endif /* WGL_I3D_gamma */ + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglEnableGenlockI3D (HDC hDC); +BOOL WINAPI wglDisableGenlockI3D (HDC hDC); +BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag); +BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource); +BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource); +BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge); +BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge); +BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate); +BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate); +BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay); +BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay); +BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif +#endif /* WGL_I3D_genlock */ + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#ifdef WGL_WGLEXT_PROTOTYPES +LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags); +BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress); +BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count); +#endif +#endif /* WGL_I3D_image_buffer */ + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglEnableFrameLockI3D (void); +BOOL WINAPI wglDisableFrameLockI3D (void); +BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag); +BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag); +#endif +#endif /* WGL_I3D_swap_frame_lock */ + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetFrameUsageI3D (float *pUsage); +BOOL WINAPI wglBeginFrameTrackingI3D (void); +BOOL WINAPI wglEndFrameTrackingI3D (void); +BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif +#endif /* WGL_I3D_swap_frame_usage */ + +#ifndef WGL_NV_DX_interop +#define WGL_NV_DX_interop 1 +#define WGL_ACCESS_READ_ONLY_NV 0x00000000 +#define WGL_ACCESS_READ_WRITE_NV 0x00000001 +#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002 +typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle); +typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice); +typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); +typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); +typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); +typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle); +HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice); +BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice); +HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); +BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject); +BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access); +BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); +BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); +#endif +#endif /* WGL_NV_DX_interop */ + +#ifndef WGL_NV_DX_interop2 +#define WGL_NV_DX_interop2 1 +#endif /* WGL_NV_DX_interop2 */ + +#ifndef WGL_NV_copy_image +#define WGL_NV_copy_image 1 +typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* WGL_NV_copy_image */ + +#ifndef WGL_NV_delay_before_swap +#define WGL_NV_delay_before_swap 1 +typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds); +#endif +#endif /* WGL_NV_delay_before_swap */ + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif /* WGL_NV_float_buffer */ + +#ifndef WGL_NV_gpu_affinity +#define WGL_NV_gpu_affinity 1 +DECLARE_HANDLE(HGPUNV); +struct _GPU_DEVICE { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; +}; +typedef struct _GPU_DEVICE *PGPU_DEVICE; +#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 +#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 +typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); +typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); +typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu); +BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList); +BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +BOOL WINAPI wglDeleteDCNV (HDC hdc); +#endif +#endif /* WGL_NV_gpu_affinity */ + +#ifndef WGL_NV_multisample_coverage +#define WGL_NV_multisample_coverage 1 +#define WGL_COVERAGE_SAMPLES_NV 0x2042 +#define WGL_COLOR_SAMPLES_NV 0x20B9 +#endif /* WGL_NV_multisample_coverage */ + +#ifndef WGL_NV_present_video +#define WGL_NV_present_video 1 +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 +typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); +BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue); +#endif +#endif /* WGL_NV_present_video */ + +#ifndef WGL_NV_render_depth_texture +#define WGL_NV_render_depth_texture 1 +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif /* WGL_NV_render_depth_texture */ + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_NV_render_texture_rectangle 1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif /* WGL_NV_render_texture_rectangle */ + +#ifndef WGL_NV_swap_group +#define WGL_NV_swap_group 1 +typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); +typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); +typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier); +typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count); +typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group); +BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier); +BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier); +BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count); +BOOL WINAPI wglResetFrameCountNV (HDC hDC); +#endif +#endif /* WGL_NV_swap_group */ + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#ifdef WGL_WGLEXT_PROTOTYPES +void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +void WINAPI wglFreeMemoryNV (void *pointer); +#endif +#endif /* WGL_NV_vertex_array_range */ + +#ifndef WGL_NV_video_capture +#define WGL_NV_video_capture 1 +DECLARE_HANDLE(HVIDEOINPUTDEVICENV); +#define WGL_UNIQUE_ID_NV 0x20CE +#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF +typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); +BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); +BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +#endif +#endif /* WGL_NV_video_capture */ + +#ifndef WGL_NV_video_output +#define WGL_NV_video_output 1 +DECLARE_HANDLE(HPVIDEODEV); +#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 +#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 +#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 +#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 +#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 +#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 +#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define WGL_VIDEO_OUT_FRAME 0x20C8 +#define WGL_VIDEO_OUT_FIELD_1 0x20C9 +#define WGL_VIDEO_OUT_FIELD_2 0x20CA +#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB +#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC +typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); +typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice); +BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer); +BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif +#endif /* WGL_NV_video_output */ + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator); +INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif +#endif /* WGL_OML_sync_control */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/rust/khronos_api/api/Makefile b/third_party/rust/khronos_api/api/Makefile new file mode 100755 index 000000000000..4181d9737dd5 --- /dev/null +++ b/third_party/rust/khronos_api/api/Makefile @@ -0,0 +1,72 @@ +# Copyright (c) 2013-2014 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and/or associated documentation files (the +# "Materials"), to deal in the Materials without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Materials, and to +# permit persons to whom the Materials are 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 Materials. +# +# THE MATERIALS ARE 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 +# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +# Generator scripts and options +# GENOPTS can be e.g. '-noprotect' + +PYFILES = genheaders.py reg.py +GENOPTS = +GENHEADERS = genheaders.py $(GENOPTS) + +# Generate all headers for GL / GLES / WGL / GLX / EGL +# Different headers depend on different XML registry files + +GLHEADERS = GL/glext.h GL/glcorearb.h \ + GLES/gl.h GLES/glext.h \ + GLES2/gl2.h GLES2/gl2ext.h \ + GLES3/gl3.h +GLXHEADERS = GL/glx.h GL/glxext.h +WGLHEADERS = GL/wgl.h GL/wglext.h +EGLHEADERS = EGL/egl.h EGL/eglext.h +ALLHEADERS = $(GLHEADERS) $(GLXHEADERS) $(WGLHEADERS) $(EGLHEADERS) + +default: $(ALLHEADERS) + +$(GLHEADERS): gl.xml $(PYFILES) + $(GENHEADERS) $@ + +$(GLXHEADERS): glx.xml $(PYFILES) + $(GENHEADERS) $@ -registry glx.xml + +$(WGLHEADERS): wgl.xml $(PYFILES) + $(GENHEADERS) $@ -registry wgl.xml + +# Not finished yet +$(EGLHEADERS): egl.xml $(PYFILES) + $(GENHEADERS) $@ -registry egl.xml + +# Generate Relax NG XML schema from Compact schema + +registry.rng: registry.rnc + trang registry.rnc registry.rng + +# Verify all registry XML files against the schema + +validate: + jing -c registry.rnc gl.xml + jing -c registry.rnc glx.xml + jing -c registry.rnc wgl.xml + jing -c registry.rnc egl.xml + +clean: + +clobber: clean + -rm -f diag.txt dumpReg.txt errwarn.txt diff --git a/third_party/rust/khronos_api/api/README.txt b/third_party/rust/khronos_api/api/README.txt new file mode 100755 index 000000000000..24e805ce9176 --- /dev/null +++ b/third_party/rust/khronos_api/api/README.txt @@ -0,0 +1,2 @@ +This text document has been replaced by a PDF. See readme.pdf . The PDF +is generated using LaTeX from readme.tex . diff --git a/third_party/rust/khronos_api/api/egl.xml b/third_party/rust/khronos_api/api/egl.xml new file mode 100755 index 000000000000..91575d2cf9fe --- /dev/null +++ b/third_party/rust/khronos_api/api/egl.xml @@ -0,0 +1,2357 @@ + + + + + + + + + #include <KHR/khrplatform.h> + #include <EGL/eglplatform.h> + + + + + + + + + + + + + + typedef unsigned int EGLBoolean; + typedef unsigned int EGLenum; + typedef intptr_t EGLAttribKHR; + typedef intptr_t EGLAttrib; + typedef void *EGLClientBuffer; + typedef void *EGLConfig; + typedef void *EGLContext; + typedef void *EGLDeviceEXT; + typedef void *EGLDisplay; + typedef void *EGLImage; + typedef void *EGLImageKHR; + typedef void *EGLOutputLayerEXT; + typedef void *EGLOutputPortEXT; + typedef void *EGLStreamKHR; + typedef void *EGLSurface; + typedef void *EGLSync; + typedef void *EGLSyncKHR; + typedef void *EGLSyncNV; + typedef void (*__eglMustCastToProperFunctionPointerType)(void); + typedef khronos_utime_nanoseconds_t EGLTimeKHR; + typedef khronos_utime_nanoseconds_t EGLTime; + typedef khronos_utime_nanoseconds_t EGLTimeNV; + typedef khronos_utime_nanoseconds_t EGLuint64NV; + typedef khronos_uint64_t EGLuint64KHR; + typedef int EGLNativeFileDescriptorKHR; + typedef khronos_ssize_t EGLsizeiANDROID; + typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); + typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); + struct EGLClientPixmapHI { + void *pData; + EGLint iWidth; + EGLint iHeight; + EGLint iStride; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EGLBoolean eglBindAPI + EGLenum api + + + EGLBoolean eglBindTexImage + EGLDisplay dpy + EGLSurface surface + EGLint buffer + + + EGLBoolean eglChooseConfig + EGLDisplay dpy + const EGLint *attrib_list + EGLConfig *configs + EGLint config_size + EGLint *num_config + + + EGLint eglClientWaitSync + EGLDisplay dpy + EGLSync sync + EGLint flags + EGLTime timeout + + + EGLint eglClientWaitSyncKHR + EGLDisplay dpy + EGLSyncKHR sync + EGLint flags + EGLTimeKHR timeout + + + + EGLint eglClientWaitSyncNV + EGLSyncNV sync + EGLint flags + EGLTimeNV timeout + + + EGLBoolean eglCopyBuffers + EGLDisplay dpy + EGLSurface surface + EGLNativePixmapType target + + + EGLContext eglCreateContext + EGLDisplay dpy + EGLConfig config + EGLContext share_context + const EGLint *attrib_list + + + EGLImageKHR eglCreateDRMImageMESA + EGLDisplay dpy + const EGLint *attrib_list + + + EGLSyncNV eglCreateFenceSyncNV + EGLDisplay dpy + EGLenum condition + const EGLint *attrib_list + + + EGLImage eglCreateImage + EGLDisplay dpy + EGLContext ctx + EGLenum target + EGLClientBuffer buffer + const EGLAttrib *attrib_list + + + EGLImageKHR eglCreateImageKHR + EGLDisplay dpy + EGLContext ctx + EGLenum target + EGLClientBuffer buffer + const EGLint *attrib_list + + + EGLSurface eglCreatePbufferFromClientBuffer + EGLDisplay dpy + EGLenum buftype + EGLClientBuffer buffer + EGLConfig config + const EGLint *attrib_list + + + EGLSurface eglCreatePbufferSurface + EGLDisplay dpy + EGLConfig config + const EGLint *attrib_list + + + EGLSurface eglCreatePixmapSurface + EGLDisplay dpy + EGLConfig config + EGLNativePixmapType pixmap + const EGLint *attrib_list + + + EGLSurface eglCreatePixmapSurfaceHI + EGLDisplay dpy + EGLConfig config + struct EGLClientPixmapHI *pixmap + + + EGLSurface eglCreatePlatformPixmapSurface + EGLDisplay dpy + EGLConfig config + void *native_pixmap + const EGLAttrib *attrib_list + + + EGLSurface eglCreatePlatformPixmapSurfaceEXT + EGLDisplay dpy + EGLConfig config + void *native_pixmap + const EGLint *attrib_list + + + EGLSurface eglCreatePlatformWindowSurface + EGLDisplay dpy + EGLConfig config + void *native_window + const EGLAttrib *attrib_list + + + EGLSurface eglCreatePlatformWindowSurfaceEXT + EGLDisplay dpy + EGLConfig config + void *native_window + const EGLint *attrib_list + + + EGLStreamKHR eglCreateStreamFromFileDescriptorKHR + EGLDisplay dpy + EGLNativeFileDescriptorKHR file_descriptor + + + EGLStreamKHR eglCreateStreamKHR + EGLDisplay dpy + const EGLint *attrib_list + + + EGLSurface eglCreateStreamProducerSurfaceKHR + EGLDisplay dpy + EGLConfig config + EGLStreamKHR stream + const EGLint *attrib_list + + + EGLSyncKHR eglCreateStreamSyncNV + EGLDisplay dpy + EGLStreamKHR stream + EGLenum type + const EGLint *attrib_list + + + EGLSync eglCreateSync + EGLDisplay dpy + EGLenum type + const EGLAttrib *attrib_list + + + EGLSyncKHR eglCreateSyncKHR + EGLDisplay dpy + EGLenum type + const EGLint *attrib_list + + + EGLSyncKHR eglCreateSync64KHR + EGLDisplay dpy + EGLenum type + const EGLAttribKHR *attrib_list + + + + EGLSurface eglCreateWindowSurface + EGLDisplay dpy + EGLConfig config + EGLNativeWindowType win + const EGLint *attrib_list + + + EGLBoolean eglDestroyContext + EGLDisplay dpy + EGLContext ctx + + + EGLBoolean eglDestroyImage + EGLDisplay dpy + EGLImage image + + + EGLBoolean eglDestroyImageKHR + EGLDisplay dpy + EGLImageKHR image + + + + EGLBoolean eglDestroyStreamKHR + EGLDisplay dpy + EGLStreamKHR stream + + + EGLBoolean eglDestroySurface + EGLDisplay dpy + EGLSurface surface + + + EGLBoolean eglDestroySync + EGLDisplay dpy + EGLSync sync + + + EGLBoolean eglDestroySyncKHR + EGLDisplay dpy + EGLSyncKHR sync + + + + EGLBoolean eglDestroySyncNV + EGLSyncNV sync + + + EGLint eglDupNativeFenceFDANDROID + EGLDisplay dpy + EGLSyncKHR sync + + + EGLBoolean eglExportDMABUFImageMESA + EGLDisplay dpy + EGLImageKHR image + int *fds + EGLint *strides + EGLint *offsets + + + EGLBoolean eglExportDMABUFImageQueryMESA + EGLDisplay dpy + EGLImageKHR image + int *fourcc + int *num_planes + EGLuint64KHR *modifiers + + + EGLBoolean eglExportDRMImageMESA + EGLDisplay dpy + EGLImageKHR image + EGLint *name + EGLint *handle + EGLint *stride + + + EGLBoolean eglFenceNV + EGLSyncNV sync + + + EGLBoolean eglGetConfigAttrib + EGLDisplay dpy + EGLConfig config + EGLint attribute + EGLint *value + + + EGLBoolean eglGetConfigs + EGLDisplay dpy + EGLConfig *configs + EGLint config_size + EGLint *num_config + + + EGLContext eglGetCurrentContext + + + EGLDisplay eglGetCurrentDisplay + + + EGLSurface eglGetCurrentSurface + EGLint readdraw + + + EGLDisplay eglGetDisplay + EGLNativeDisplayType display_id + + + EGLint eglGetError + + + EGLBoolean eglGetOutputLayersEXT + EGLDisplay dpy + const EGLAttrib *attrib_list + EGLOutputLayerEXT *layers + EGLint max_layers + EGLint *num_layers + + + EGLBoolean eglGetOutputPortsEXT + EGLDisplay dpy + const EGLAttrib *attrib_list + EGLOutputPortEXT *ports + EGLint max_ports + EGLint *num_ports + + + EGLDisplay eglGetPlatformDisplay + EGLenum platform + void *native_display + const EGLAttrib *attrib_list + + + EGLDisplay eglGetPlatformDisplayEXT + EGLenum platform + void *native_display + const EGLint *attrib_list + + + __eglMustCastToProperFunctionPointerType eglGetProcAddress + const char *procname + + + EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR + EGLDisplay dpy + EGLStreamKHR stream + + + EGLBoolean eglGetSyncAttrib + EGLDisplay dpy + EGLSync sync + EGLint attribute + EGLAttrib *value + + + EGLBoolean eglGetSyncAttribKHR + EGLDisplay dpy + EGLSyncKHR sync + EGLint attribute + EGLint *value + + + EGLBoolean eglGetSyncAttribNV + EGLSyncNV sync + EGLint attribute + EGLint *value + + + EGLuint64NV eglGetSystemTimeFrequencyNV + + + EGLuint64NV eglGetSystemTimeNV + + + EGLBoolean eglInitialize + EGLDisplay dpy + EGLint *major + EGLint *minor + + + EGLBoolean eglLockSurfaceKHR + EGLDisplay dpy + EGLSurface surface + const EGLint *attrib_list + + + EGLBoolean eglMakeCurrent + EGLDisplay dpy + EGLSurface draw + EGLSurface read + EGLContext ctx + + + EGLBoolean eglOutputLayerAttribEXT + EGLDisplay dpy + EGLOutputLayerEXT layer + EGLint attribute + EGLAttrib value + + + EGLBoolean eglOutputPortAttribEXT + EGLDisplay dpy + EGLOutputPortEXT port + EGLint attribute + EGLAttrib value + + + EGLBoolean eglPostSubBufferNV + EGLDisplay dpy + EGLSurface surface + EGLint x + EGLint y + EGLint width + EGLint height + + + EGLenum eglQueryAPI + + + EGLBoolean eglQueryContext + EGLDisplay dpy + EGLContext ctx + EGLint attribute + EGLint *value + + + EGLBoolean eglQueryDeviceAttribEXT + EGLDeviceEXT device + EGLint attribute + EGLAttrib *value + + + const char *eglQueryDeviceStringEXT + EGLDeviceEXT device + EGLint name + + + EGLBoolean eglQueryDevicesEXT + EGLint max_devices + EGLDeviceEXT *devices + EGLint *num_devices + + + EGLBoolean eglQueryDisplayAttribEXT + EGLDisplay dpy + EGLint attribute + EGLAttrib *value + + + EGLBoolean eglQueryNativeDisplayNV + EGLDisplay dpy + EGLNativeDisplayType *display_id + + + EGLBoolean eglQueryNativePixmapNV + EGLDisplay dpy + EGLSurface surf + EGLNativePixmapType *pixmap + + + EGLBoolean eglQueryNativeWindowNV + EGLDisplay dpy + EGLSurface surf + EGLNativeWindowType *window + + + EGLBoolean eglQueryOutputLayerAttribEXT + EGLDisplay dpy + EGLOutputLayerEXT layer + EGLint attribute + EGLAttrib *value + + + const char *eglQueryOutputLayerStringEXT + EGLDisplay dpy + EGLOutputLayerEXT layer + EGLint name + + + EGLBoolean eglQueryOutputPortAttribEXT + EGLDisplay dpy + EGLOutputPortEXT port + EGLint attribute + EGLAttrib *value + + + const char *eglQueryOutputPortStringEXT + EGLDisplay dpy + EGLOutputPortEXT port + EGLint name + + + EGLBoolean eglQueryStreamKHR + EGLDisplay dpy + EGLStreamKHR stream + EGLenum attribute + EGLint *value + + + EGLBoolean eglQueryStreamTimeKHR + EGLDisplay dpy + EGLStreamKHR stream + EGLenum attribute + EGLTimeKHR *value + + + EGLBoolean eglQueryStreamu64KHR + EGLDisplay dpy + EGLStreamKHR stream + EGLenum attribute + EGLuint64KHR *value + + + const char *eglQueryString + EGLDisplay dpy + EGLint name + + + EGLBoolean eglQuerySurface + EGLDisplay dpy + EGLSurface surface + EGLint attribute + EGLint *value + + + EGLBoolean eglQuerySurface64KHR + EGLDisplay dpy + EGLSurface surface + EGLint attribute + EGLAttribKHR *value + + + EGLBoolean eglQuerySurfacePointerANGLE + EGLDisplay dpy + EGLSurface surface + EGLint attribute + void **value + + + EGLBoolean eglReleaseTexImage + EGLDisplay dpy + EGLSurface surface + EGLint buffer + + + EGLBoolean eglReleaseThread + + + void eglSetBlobCacheFuncsANDROID + EGLDisplay dpy + EGLSetBlobFuncANDROID set + EGLGetBlobFuncANDROID get + + + EGLBoolean eglSetDamageRegionKHR + EGLDisplay dpy + EGLSurface surface + EGLint *rects + EGLint n_rects + + + EGLBoolean eglSignalSyncKHR + EGLDisplay dpy + EGLSyncKHR sync + EGLenum mode + + + EGLBoolean eglSignalSyncNV + EGLSyncNV sync + EGLenum mode + + + EGLBoolean eglStreamAttribKHR + EGLDisplay dpy + EGLStreamKHR stream + EGLenum attribute + EGLint value + + + EGLBoolean eglStreamConsumerAcquireKHR + EGLDisplay dpy + EGLStreamKHR stream + + + EGLBoolean eglStreamConsumerGLTextureExternalKHR + EGLDisplay dpy + EGLStreamKHR stream + + + EGLBoolean eglStreamConsumerOutputEXT + EGLDisplay dpy + EGLStreamKHR stream + EGLOutputLayerEXT layer + + + EGLBoolean eglStreamConsumerReleaseKHR + EGLDisplay dpy + EGLStreamKHR stream + + + EGLBoolean eglSurfaceAttrib + EGLDisplay dpy + EGLSurface surface + EGLint attribute + EGLint value + + + EGLBoolean eglSwapBuffers + EGLDisplay dpy + EGLSurface surface + + + EGLBoolean eglSwapBuffersWithDamageEXT + EGLDisplay dpy + EGLSurface surface + EGLint *rects + EGLint n_rects + + + EGLBoolean eglSwapBuffersWithDamageKHR + EGLDisplay dpy + EGLSurface surface + EGLint *rects + EGLint n_rects + + + EGLBoolean eglSwapBuffersRegionNOK + EGLDisplay dpy + EGLSurface surface + EGLint numRects + const EGLint *rects + + + EGLBoolean eglSwapBuffersRegion2NOK + EGLDisplay dpy + EGLSurface surface + EGLint numRects + const EGLint *rects + + + EGLBoolean eglSwapInterval + EGLDisplay dpy + EGLint interval + + + EGLBoolean eglTerminate + EGLDisplay dpy + + + EGLBoolean eglUnlockSurfaceKHR + EGLDisplay dpy + EGLSurface surface + + + EGLBoolean eglWaitClient + + + EGLBoolean eglWaitGL + + + EGLBoolean eglWaitNative + EGLint engine + + + EGLBoolean eglWaitSync + EGLDisplay dpy + EGLSync sync + EGLint flags + + + EGLint eglWaitSyncKHR + EGLDisplay dpy + EGLSyncKHR sync + EGLint flags + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/rust/khronos_api/api/genheaders.py b/third_party/rust/khronos_api/api/genheaders.py new file mode 100755 index 000000000000..fef79ea46cba --- /dev/null +++ b/third_party/rust/khronos_api/api/genheaders.py @@ -0,0 +1,578 @@ +#!/usr/bin/env python +# +# Copyright (c) 2013-2015 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and/or associated documentation files (the +# "Materials"), to deal in the Materials without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Materials, and to +# permit persons to whom the Materials are 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 Materials. +# +# THE MATERIALS ARE 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 +# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +import sys, time, pdb, string, cProfile +from reg import * + +# debug - start header generation in debugger +# dump - dump registry after loading +# profile - enable Python profiling +# protect - whether to use #ifndef protections +# registry - use specified XML registry instead of gl.xml +# target - string name of target header, or all targets if None +# timeit - time length of registry loading & header generation +# validate - validate return & parameter group tags against +debug = False +dump = False +profile = False +protect = True +target = None +timeit = False +validate= False +# Default input / log files +errFilename = None +diagFilename = 'diag.txt' +regFilename = 'gl.xml' + +if __name__ == '__main__': + i = 1 + while (i < len(sys.argv)): + arg = sys.argv[i] + i = i + 1 + if (arg == '-debug'): + write('Enabling debug (-debug)', file=sys.stderr) + debug = True + elif (arg == '-dump'): + write('Enabling dump (-dump)', file=sys.stderr) + dump = True + elif (arg == '-noprotect'): + write('Disabling inclusion protection in output headers', file=sys.stderr) + protect = False + elif (arg == '-profile'): + write('Enabling profiling (-profile)', file=sys.stderr) + profile = True + elif (arg == '-registry'): + regFilename = sys.argv[i] + i = i+1 + write('Using registry ', regFilename, file=sys.stderr) + elif (arg == '-time'): + write('Enabling timing (-time)', file=sys.stderr) + timeit = True + elif (arg == '-validate'): + write('Enabling group validation (-validate)', file=sys.stderr) + validate = True + elif (arg[0:1] == '-'): + write('Unrecognized argument:', arg, file=sys.stderr) + exit(1) + else: + target = arg + write('Using target', target, file=sys.stderr) + +# Simple timer functions +startTime = None +def startTimer(): + global startTime + startTime = time.clock() +def endTimer(msg): + global startTime + endTime = time.clock() + if (timeit): + write(msg, endTime - startTime) + startTime = None + +# Load & parse registry +reg = Registry() + +startTimer() +tree = etree.parse(regFilename) +endTimer('Time to make ElementTree =') + +startTimer() +reg.loadElementTree(tree) +endTimer('Time to parse ElementTree =') + +if (validate): + reg.validateGroups() + +if (dump): + write('***************************************') + write('Performing Registry dump to regdump.txt') + write('***************************************') + reg.dumpReg(filehandle = open('regdump.txt','w')) + +# Turn a list of strings into a regexp string matching exactly those strings +def makeREstring(list): + return '^(' + '|'.join(list) + ')$' + +# These are "mandatory" OpenGL ES 1 extensions, to +# be included in the core GLES/gl.h header. +es1CoreList = [ + 'GL_OES_read_format', + 'GL_OES_compressed_paletted_texture', + 'GL_OES_point_size_array', + 'GL_OES_point_sprite' +] + +# Descriptive names for various regexp patterns used to select +# versions and extensions + +allVersions = allExtensions = '.*' +noVersions = noExtensions = None +gl12andLaterPat = '1\.[2-9]|[234]\.[0-9]' +gles2onlyPat = '2\.[0-9]' +gles2and30Pat = '2\.[0-9]|3.0' +gles2and30and31Pat = '2.[0-9]|3.[01]' +es1CorePat = makeREstring(es1CoreList) +# Extensions in old glcorearb.h but not yet tagged accordingly in gl.xml +glCoreARBPat = None +glx13andLaterPat = '1\.[3-9]' + +# Copyright text prefixing all headers (list of strings). +prefixStrings = [ + '/*', + '** Copyright (c) 2013-2015 The Khronos Group Inc.', + '**', + '** Permission is hereby granted, free of charge, to any person obtaining a', + '** copy of this software and/or associated documentation files (the', + '** "Materials"), to deal in the Materials without restriction, including', + '** without limitation the rights to use, copy, modify, merge, publish,', + '** distribute, sublicense, and/or sell copies of the Materials, and to', + '** permit persons to whom the Materials are 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 Materials.', + '**', + '** THE MATERIALS ARE 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', + '** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.', + '*/', + '/*', + '** This header is generated from the Khronos OpenGL / OpenGL ES XML', + '** API Registry. The current version of the Registry, generator scripts', + '** used to make the header, and the header can be found at', + '** http://www.opengl.org/registry/', + '**', + '** Khronos $' + 'Revision$ on $' + 'Date$', + '*/', + '' +] + +# glext.h / glcorearb.h define calling conventions inline (no GL *platform.h) +glExtPlatformStrings = [ + '#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)', + '#ifndef WIN32_LEAN_AND_MEAN', + '#define WIN32_LEAN_AND_MEAN 1', + '#endif', + '#include ', + '#endif', + '', + '#ifndef APIENTRY', + '#define APIENTRY', + '#endif', + '#ifndef APIENTRYP', + '#define APIENTRYP APIENTRY *', + '#endif', + '#ifndef GLAPI', + '#define GLAPI extern', + '#endif', + '' +] + +glCorearbPlatformStrings = glExtPlatformStrings + [ + '/* glcorearb.h is for use with OpenGL core profile implementations.', + '** It should should be placed in the same directory as gl.h and', + '** included as .', + '**', + '** glcorearb.h includes only APIs in the latest OpenGL core profile', + '** implementation together with APIs in newer ARB extensions which ', + '** can be supported by the core profile. It does not, and never will', + '** include functionality removed from the core profile, such as', + '** fixed-function vertex and fragment processing.', + '**', + '** Do not #include both and either of or', + '** in the same source file.', + '*/', + '' +] + +# wglext.h needs Windows include +wglPlatformStrings = [ + '#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)', + '#define WIN32_LEAN_AND_MEAN 1', + '#include ', + '#endif', + '', +] + +# GLES 1/2/3 core .h have separate *platform.h files to define calling conventions +gles1PlatformStrings = [ '#include ', '' ] +gles2PlatformStrings = [ '#include ', '' ] +gles3PlatformStrings = [ '#include ', '' ] +eglPlatformStrings = [ '#include ', '' ] + +# GLES headers have a small addition to calling convention headers for function pointer typedefs +apiEntryPrefixStrings = [ + '#ifndef GL_APIENTRYP', + '#define GL_APIENTRYP GL_APIENTRY*', + '#endif', + '' +] + +# Insert generation date in a comment for headers not having *GLEXT_VERSION macros +genDateCommentString = [ + format("/* Generated on date %s */" % time.strftime("%Y%m%d")), + '' +] + +# GL_GLEXT_VERSION is defined only in glext.h +glextVersionStrings = [ + format("#define GL_GLEXT_VERSION %s" % time.strftime("%Y%m%d")), + '' +] +# WGL_WGLEXT_VERSION is defined only in wglext.h +wglextVersionStrings = [ + format("#define WGL_WGLEXT_VERSION %s" % time.strftime("%Y%m%d")), + '' +] +# GLX_GLXEXT_VERSION is defined only in glxext.h +glxextVersionStrings = [ + format("#define GLX_GLXEXT_VERSION %s" % time.strftime("%Y%m%d")), + '' +] +# EGL_EGLEXT_VERSION is defined only in eglext.h +eglextVersionStrings = [ + format("#define EGL_EGLEXT_VERSION %s" % time.strftime("%Y%m%d")), + '' +] + +# Defaults for generating re-inclusion protection wrappers (or not) +protectFile = protect +protectFeature = protect +protectProto = protect + +buildList = [ + # GL API 1.2+ + extensions - GL/glext.h + CGeneratorOptions( + filename = 'GL/glext.h', + apiname = 'gl', + profile = 'compatibility', + versions = allVersions, + emitversions = gl12andLaterPat, + defaultExtensions = 'gl', # Default extensions for GL + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + glExtPlatformStrings + glextVersionStrings, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GLAPI ', + apientry = 'APIENTRY ', + apientryp = 'APIENTRYP '), + # GL core profile + extensions - GL/glcorearb.h + CGeneratorOptions( + filename = 'GL/glcorearb.h', + apiname = 'gl', + profile = 'core', + versions = allVersions, + emitversions = allVersions, + defaultExtensions = 'glcore', # Default extensions for GL core profile (only) + addExtensions = glCoreARBPat, + removeExtensions = None, + prefixText = prefixStrings + glCorearbPlatformStrings, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GLAPI ', + apientry = 'APIENTRY ', + apientryp = 'APIENTRYP '), + # GLES 1.x API + mandatory extensions - GLES/gl.h (no function pointers) + CGeneratorOptions( + filename = 'GLES/gl.h', + apiname = 'gles1', + profile = 'common', + versions = allVersions, + emitversions = allVersions, + defaultExtensions = None, # No default extensions + addExtensions = es1CorePat, # Add mandatory ES1 extensions in GLES1/gl.h + removeExtensions = None, + prefixText = prefixStrings + gles1PlatformStrings + genDateCommentString, + genFuncPointers = False, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = False, # Core ES API functions are in the static link libraries + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GL_API ', + apientry = 'GL_APIENTRY ', + apientryp = 'GL_APIENTRYP '), + # GLES 1.x extensions - GLES/glext.h + CGeneratorOptions( + filename = 'GLES/glext.h', + apiname = 'gles1', + profile = 'common', + versions = allVersions, + emitversions = noVersions, + defaultExtensions = 'gles1', # Default extensions for GLES 1 + addExtensions = None, + removeExtensions = es1CorePat, # Remove mandatory ES1 extensions in GLES1/glext.h + prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GL_API ', + apientry = 'GL_APIENTRY ', + apientryp = 'GL_APIENTRYP '), + # GLES 2.0 API - GLES2/gl2.h (now with function pointers) + CGeneratorOptions( + filename = 'GLES2/gl2.h', + apiname = 'gles2', + profile = 'common', + versions = gles2onlyPat, + emitversions = allVersions, + defaultExtensions = None, # No default extensions + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + gles2PlatformStrings + apiEntryPrefixStrings + genDateCommentString, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, # Core ES API functions are in the static link libraries + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GL_APICALL ', + apientry = 'GL_APIENTRY ', + apientryp = 'GL_APIENTRYP '), + # GLES 3.1 / 3.0 / 2.0 extensions - GLES2/gl2ext.h + CGeneratorOptions( + filename = 'GLES2/gl2ext.h', + apiname = 'gles2', + profile = 'common', + versions = gles2onlyPat, + emitversions = None, + defaultExtensions = 'gles2', # Default extensions for GLES 2 + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GL_APICALL ', + apientry = 'GL_APIENTRY ', + apientryp = 'GL_APIENTRYP '), + # GLES 3.1 API - GLES3/gl31.h (now with function pointers) + CGeneratorOptions( + filename = 'GLES3/gl31.h', + apiname = 'gles2', + profile = 'common', + versions = gles2and30and31Pat, + emitversions = allVersions, + defaultExtensions = None, # No default extensions + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + genDateCommentString, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, # Core ES API functions are in the static link libraries + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GL_APICALL ', + apientry = 'GL_APIENTRY ', + apientryp = 'GL_APIENTRYP '), + # GLES 3.0 API - GLES3/gl3.h (now with function pointers) + CGeneratorOptions( + filename = 'GLES3/gl3.h', + apiname = 'gles2', + profile = 'common', + versions = gles2and30Pat, + emitversions = allVersions, + defaultExtensions = None, # No default extensions + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + genDateCommentString, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, # Core ES API functions are in the static link libraries + protectProtoStr = 'GL_GLEXT_PROTOTYPES', + apicall = 'GL_APICALL ', + apientry = 'GL_APIENTRY ', + apientryp = 'GL_APIENTRYP '), + # EGL API - EGL/egl.h (no function pointers, yet @@@) + CGeneratorOptions( + filename = 'EGL/egl.h', + apiname = 'egl', + profile = None, + versions = allVersions, + emitversions = allVersions, + defaultExtensions = None, # No default extensions + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + eglPlatformStrings + genDateCommentString, + genFuncPointers = False, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = False, + protectProtoStr = 'EGL_EGLEXT_PROTOTYPES', + apicall = 'EGLAPI ', + apientry = 'EGLAPIENTRY ', + apientryp = 'EGLAPIENTRYP '), + # EGL extensions - EGL/eglext.h (no function pointers, yet @@@) + CGeneratorOptions( + filename = 'EGL/eglext.h', + apiname = 'egl', + profile = None, + versions = allVersions, + emitversions = None, + defaultExtensions = 'egl', # Default extensions for EGL + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + eglPlatformStrings + eglextVersionStrings, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'EGL_EGLEXT_PROTOTYPES', + apicall = 'EGLAPI ', + apientry = 'EGLAPIENTRY ', + apientryp = 'EGLAPIENTRYP '), + # GLX 1.* API - GL/glx.h + CGeneratorOptions( + filename = 'GL/glx.h', + apiname = 'glx', + profile = None, + versions = allVersions, + emitversions = allVersions, + defaultExtensions = None, # No default extensions + addExtensions = None, + removeExtensions = None, + # add glXPlatformStrings? + prefixText = prefixStrings + genDateCommentString, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'GLX_GLXEXT_PROTOTYPES', + apicall = '', + apientry = '', + apientryp = ' *'), + # GLX 1.3+ API + extensions - GL/glxext.h (no function pointers, yet @@@) + CGeneratorOptions( + filename = 'GL/glxext.h', + apiname = 'glx', + profile = None, + versions = allVersions, + emitversions = glx13andLaterPat, + defaultExtensions = 'glx', # Default extensions for GLX + addExtensions = None, + removeExtensions = None, + # add glXPlatformStrings? + prefixText = prefixStrings + glxextVersionStrings, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'GLX_GLXEXT_PROTOTYPES', + apicall = '', + apientry = '', + apientryp = ' *'), + # WGL API + extensions - GL/wgl.h (no function pointers, yet @@@) + CGeneratorOptions( + filename = 'GL/wgl.h', + apiname = 'wgl', + profile = None, + versions = allVersions, + emitversions = allVersions, + defaultExtensions = 'wgl', # Default extensions for WGL + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + wglPlatformStrings + genDateCommentString, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'WGL_WGLEXT_PROTOTYPES', + apicall = '', + apientry = 'WINAPI ', + apientryp = 'WINAPI * '), + # WGL extensions - GL/wglext.h (no function pointers, yet @@@) + CGeneratorOptions( + filename = 'GL/wglext.h', + apiname = 'wgl', + profile = None, + versions = allVersions, + emitversions = None, + defaultExtensions = 'wgl', # Default extensions for WGL + addExtensions = None, + removeExtensions = None, + prefixText = prefixStrings + wglPlatformStrings + wglextVersionStrings, + genFuncPointers = True, + protectFile = protectFile, + protectFeature = protectFeature, + protectProto = protectProto, + protectProtoStr = 'WGL_WGLEXT_PROTOTYPES', + apicall = '', + apientry = 'WINAPI ', + apientryp = 'WINAPI * '), + # End of list + None +] + +# create error/warning & diagnostic files +if (errFilename): + errWarn = open(errFilename,'w') +else: + errWarn = sys.stderr +diag = open(diagFilename, 'w') + +def genHeaders(): + # Loop over targets, building each + generated = 0 + for genOpts in buildList: + if (genOpts == None): + break + if (target and target != genOpts.filename): + # write('*** Skipping', genOpts.filename) + continue + write('*** Building', genOpts.filename) + generated = generated + 1 + startTimer() + gen = COutputGenerator(errFile=errWarn, + warnFile=errWarn, + diagFile=diag) + reg.setGenerator(gen) + reg.apiGen(genOpts) + write('** Generated', genOpts.filename) + endTimer('Time to generate ' + genOpts.filename + ' =') + if (target and generated == 0): + write('Failed to generate target:', target) + +if (debug): + pdb.run('genHeaders()') +elif (profile): + import cProfile, pstats + cProfile.run('genHeaders()', 'profile.txt') + p = pstats.Stats('profile.txt') + p.strip_dirs().sort_stats('time').print_stats(50) +else: + genHeaders() diff --git a/third_party/rust/khronos_api/api/gl.xml b/third_party/rust/khronos_api/api/gl.xml new file mode 100755 index 000000000000..5cd4b87f7069 --- /dev/null +++ b/third_party/rust/khronos_api/api/gl.xml @@ -0,0 +1,46153 @@ + + + +Copyright (c) 2013-2015 The Khronos Group Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and/or associated documentation files (the +"Materials"), to deal in the Materials without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Materials, and to +permit persons to whom the Materials are 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 Materials. + +THE MATERIALS ARE 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 +MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +------------------------------------------------------------------------ + +This file, gl.xml, is the OpenGL and OpenGL API Registry. The older +".spec" file format has been retired and will no longer be updated with +new extensions and API versions. The canonical version of the registry, +together with documentation, schema, and Python generator scripts used +to generate C header files for OpenGL and OpenGL ES, can always be found +in the Khronos Registry at + http://www.opengl.org/registry/ + + + + + + #include <stddef.h> + #include <KHR/khrplatform.h> + #ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +#elif defined(__sun__) || defined(__digital__) +#include <inttypes.h> +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include <inttypes.h> +#elif defined(__SCO__) || defined(__USLC__) +#include <stdint.h> +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include <stdint.h> +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include <inttypes.h> +#endif +#endif + + typedef unsigned int GLenum; + typedef unsigned char GLboolean; + typedef unsigned int GLbitfield; + typedef void GLvoid; + typedef signed char GLbyte; + typedef short GLshort; + typedef int GLint; + typedef int GLclampx; + typedef unsigned char GLubyte; + typedef unsigned short GLushort; + typedef unsigned int GLuint; + typedef int GLsizei; + typedef float GLfloat; + typedef float GLclampf; + typedef double GLdouble; + typedef double GLclampd; + typedef void *GLeglImageOES; + typedef char GLchar; + typedef char GLcharARB; + #ifdef __APPLE__ +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif + typedef unsigned short GLhalfARB; + typedef unsigned short GLhalf; + typedef GLint GLfixed; + typedef ptrdiff_t GLintptr; + typedef ptrdiff_t GLsizeiptr; + typedef int64_t GLint64; + typedef uint64_t GLuint64; + typedef ptrdiff_t GLintptrARB; + typedef ptrdiff_t GLsizeiptrARB; + typedef int64_t GLint64EXT; + typedef uint64_t GLuint64EXT; + typedef struct __GLsync *GLsync; + struct _cl_context; + struct _cl_event; + typedef void ( *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + typedef void ( *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + typedef void ( *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + + typedef khronos_int32_t GLclampx; + + typedef khronos_int8_t GLbyte; + typedef khronos_uint8_t GLubyte; + typedef khronos_float_t GLfloat; + typedef khronos_float_t GLclampf; + typedef khronos_int32_t GLfixed; + typedef khronos_int64_t GLint64; + typedef khronos_uint64_t GLuint64; + typedef khronos_intptr_t GLintptr; + typedef khronos_ssize_t GLsizeiptr; + + typedef khronos_int8_t GLbyte; + typedef khronos_uint8_t GLubyte; + typedef khronos_float_t GLfloat; + typedef khronos_float_t GLclampf; + typedef khronos_int32_t GLfixed; + typedef khronos_int64_t GLint64; + typedef khronos_uint64_t GLuint64; + typedef khronos_int64_t GLint64EXT; + typedef khronos_uint64_t GLuint64EXT; + typedef khronos_intptr_t GLintptr; + typedef khronos_ssize_t GLsizeiptr; + + + typedef void ( *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); + typedef unsigned short GLhalfNV; + typedef GLintptr GLvdpauSurfaceNV; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + void glAccum + GLenum op + GLfloat value + + + + void glAccumxOES + GLenum op + GLfixed value + + + void glActiveProgramEXT + GLuint program + + + void glActiveShaderProgram + GLuint pipeline + GLuint program + + + void glActiveShaderProgramEXT + GLuint pipeline + GLuint program + + + void glActiveStencilFaceEXT + GLenum face + + + + void glActiveTexture + GLenum texture + + + + void glActiveTextureARB + GLenum texture + + + + + void glActiveVaryingNV + GLuint program + const GLchar *name + + + void glAlphaFragmentOp1ATI + GLenum op + GLuint dst + GLuint dstMod + GLuint arg1 + GLuint arg1Rep + GLuint arg1Mod + + + void glAlphaFragmentOp2ATI + GLenum op + GLuint dst + GLuint dstMod + GLuint arg1 + GLuint arg1Rep + GLuint arg1Mod + GLuint arg2 + GLuint arg2Rep + GLuint arg2Mod + + + void glAlphaFragmentOp3ATI + GLenum op + GLuint dst + GLuint dstMod + GLuint arg1 + GLuint arg1Rep + GLuint arg1Mod + GLuint arg2 + GLuint arg2Rep + GLuint arg2Mod + GLuint arg3 + GLuint arg3Rep + GLuint arg3Mod + + + void glAlphaFunc + GLenum func + GLfloat ref + + + + void glAlphaFuncQCOM + GLenum func + GLclampf ref + + + void glAlphaFuncx + GLenum func + GLfixed ref + + + void glAlphaFuncxOES + GLenum func + GLfixed ref + + + void glApplyFramebufferAttachmentCMAAINTEL + + + void glApplyTextureEXT + GLenum mode + + + GLboolean glAreProgramsResidentNV + GLsizei n + const GLuint *programs + GLboolean *residences + + + + GLboolean glAreTexturesResident + GLsizei n + const GLuint *textures + GLboolean *residences + + + + GLboolean glAreTexturesResidentEXT + GLsizei n + const GLuint *textures + GLboolean *residences + + + + void glArrayElement + GLint i + + + void glArrayElementEXT + GLint i + + + + void glArrayObjectATI + GLenum array + GLint size + GLenum type + GLsizei stride + GLuint buffer + GLuint offset + + + void glAsyncMarkerSGIX + GLuint marker + + + void glAttachObjectARB + GLhandleARB containerObj + GLhandleARB obj + + + + void glAttachShader + GLuint program + GLuint shader + + + void glBegin + GLenum mode + + + + void glBeginConditionalRender + GLuint id + GLenum mode + + + void glBeginConditionalRenderNV + GLuint id + GLenum mode + + + + + void glBeginConditionalRenderNVX + GLuint id + + + void glBeginFragmentShaderATI + + + void glBeginOcclusionQueryNV + GLuint id + + + void glBeginPerfMonitorAMD + GLuint monitor + + + void glBeginPerfQueryINTEL + GLuint queryHandle + + + void glBeginQuery + GLenum target + GLuint id + + + + void glBeginQueryARB + GLenum target + GLuint id + + + + void glBeginQueryEXT + GLenum target + GLuint id + + + void glBeginQueryIndexed + GLenum target + GLuint index + GLuint id + + + void glBeginTransformFeedback + GLenum primitiveMode + + + void glBeginTransformFeedbackEXT + GLenum primitiveMode + + + + void glBeginTransformFeedbackNV + GLenum primitiveMode + + + + void glBeginVertexShaderEXT + + + void glBeginVideoCaptureNV + GLuint video_capture_slot + + + void glBindAttribLocation + GLuint program + GLuint index + const GLchar *name + + + void glBindAttribLocationARB + GLhandleARB programObj + GLuint index + const GLcharARB *name + + + + void glBindBuffer + GLenum target + GLuint buffer + + + void glBindBufferARB + GLenum target + GLuint buffer + + + + void glBindBufferBase + GLenum target + GLuint index + GLuint buffer + + + void glBindBufferBaseEXT + GLenum target + GLuint index + GLuint buffer + + + + void glBindBufferBaseNV + GLenum target + GLuint index + GLuint buffer + + + + void glBindBufferOffsetEXT + GLenum target + GLuint index + GLuint buffer + GLintptr offset + + + void glBindBufferOffsetNV + GLenum target + GLuint index + GLuint buffer + GLintptr offset + + + + void glBindBufferRange + GLenum target + GLuint index + GLuint buffer + GLintptr offset + GLsizeiptr size + + + void glBindBufferRangeEXT + GLenum target + GLuint index + GLuint buffer + GLintptr offset + GLsizeiptr size + + + + void glBindBufferRangeNV + GLenum target + GLuint index + GLuint buffer + GLintptr offset + GLsizeiptr size + + + + void glBindBuffersBase + GLenum target + GLuint first + GLsizei count + const GLuint *buffers + + + void glBindBuffersRange + GLenum target + GLuint first + GLsizei count + const GLuint *buffers + const GLintptr *offsets + const GLsizeiptr *sizes + + + void glBindFragDataLocation + GLuint program + GLuint color + const GLchar *name + + + void glBindFragDataLocationEXT + GLuint program + GLuint color + const GLchar *name + + + + void glBindFragDataLocationIndexed + GLuint program + GLuint colorNumber + GLuint index + const GLchar *name + + + void glBindFragmentShaderATI + GLuint id + + + void glBindFramebuffer + GLenum target + GLuint framebuffer + + + + void glBindFramebufferEXT + GLenum target + GLuint framebuffer + + + + void glBindFramebufferOES + GLenum target + GLuint framebuffer + + + void glBindImageTexture + GLuint unit + GLuint texture + GLint level + GLboolean layered + GLint layer + GLenum access + GLenum format + + + void glBindImageTextureEXT + GLuint index + GLuint texture + GLint level + GLboolean layered + GLint layer + GLenum access + GLint format + + + void glBindImageTextures + GLuint first + GLsizei count + const GLuint *textures + + + GLuint glBindLightParameterEXT + GLenum light + GLenum value + + + GLuint glBindMaterialParameterEXT + GLenum face + GLenum value + + + void glBindMultiTextureEXT + GLenum texunit + GLenum target + GLuint texture + + + GLuint glBindParameterEXT + GLenum value + + + void glBindProgramARB + GLenum target + GLuint program + + + + void glBindProgramNV + GLenum target + GLuint id + + + + + void glBindProgramPipeline + GLuint pipeline + + + void glBindProgramPipelineEXT + GLuint pipeline + + + void glBindRenderbuffer + GLenum target + GLuint renderbuffer + + + + void glBindRenderbufferEXT + GLenum target + GLuint renderbuffer + + + + void glBindRenderbufferOES + GLenum target + GLuint renderbuffer + + + void glBindSampler + GLuint unit + GLuint sampler + + + void glBindSamplers + GLuint first + GLsizei count + const GLuint *samplers + + + GLuint glBindTexGenParameterEXT + GLenum unit + GLenum coord + GLenum value + + + void glBindTexture + GLenum target + GLuint texture + + + + void glBindTextureEXT + GLenum target + GLuint texture + + + + + void glBindTextureUnit + GLuint unit + GLuint texture + + + GLuint glBindTextureUnitParameterEXT + GLenum unit + GLenum value + + + void glBindTextures + GLuint first + GLsizei count + const GLuint *textures + + + void glBindTransformFeedback + GLenum target + GLuint id + + + void glBindTransformFeedbackNV + GLenum target + GLuint id + + + void glBindVertexArray + GLuint array + + + + void glBindVertexArrayAPPLE + GLuint array + + + void glBindVertexArrayOES + GLuint array + + + + void glBindVertexBuffer + GLuint bindingindex + GLuint buffer + GLintptr offset + GLsizei stride + + + void glBindVertexBuffers + GLuint first + GLsizei count + const GLuint *buffers + const GLintptr *offsets + const GLsizei *strides + + + void glBindVertexShaderEXT + GLuint id + + + void glBindVideoCaptureStreamBufferNV + GLuint video_capture_slot + GLuint stream + GLenum frame_region + GLintptrARB offset + + + void glBindVideoCaptureStreamTextureNV + GLuint video_capture_slot + GLuint stream + GLenum frame_region + GLenum target + GLuint texture + + + void glBinormal3bEXT + GLbyte bx + GLbyte by + GLbyte bz + + + + void glBinormal3bvEXT + const GLbyte *v + + + void glBinormal3dEXT + GLdouble bx + GLdouble by + GLdouble bz + + + + void glBinormal3dvEXT + const GLdouble *v + + + void glBinormal3fEXT + GLfloat bx + GLfloat by + GLfloat bz + + + + void glBinormal3fvEXT + const GLfloat *v + + + void glBinormal3iEXT + GLint bx + GLint by + GLint bz + + + + void glBinormal3ivEXT + const GLint *v + + + void glBinormal3sEXT + GLshort bx + GLshort by + GLshort bz + + + + void glBinormal3svEXT + const GLshort *v + + + void glBinormalPointerEXT + GLenum type + GLsizei stride + const void *pointer + + + void glBitmap + GLsizei width + GLsizei height + GLfloat xorig + GLfloat yorig + GLfloat xmove + GLfloat ymove + const GLubyte *bitmap + + + + + void glBitmapxOES + GLsizei width + GLsizei height + GLfixed xorig + GLfixed yorig + GLfixed xmove + GLfixed ymove + const GLubyte *bitmap + + + void glBlendBarrier + + + void glBlendBarrierKHR + + + + void glBlendBarrierNV + + + + void glBlendColor + GLfloat red + GLfloat green + GLfloat blue + GLfloat alpha + + + + void glBlendColorEXT + GLfloat red + GLfloat green + GLfloat blue + GLfloat alpha + + + + + void glBlendColorxOES + GLfixed red + GLfixed green + GLfixed blue + GLfixed alpha + + + void glBlendEquation + GLenum mode + + + + void glBlendEquationEXT + GLenum mode + + + + + void glBlendEquationIndexedAMD + GLuint buf + GLenum mode + + + + void glBlendEquationOES + GLenum mode + + + void glBlendEquationSeparate + GLenum modeRGB + GLenum modeAlpha + + + + void glBlendEquationSeparateEXT + GLenum modeRGB + GLenum modeAlpha + + + + + void glBlendEquationSeparateIndexedAMD + GLuint buf + GLenum modeRGB + GLenum modeAlpha + + + + void glBlendEquationSeparateOES + GLenum modeRGB + GLenum modeAlpha + + + void glBlendEquationSeparatei + GLuint buf + GLenum modeRGB + GLenum modeAlpha + + + void glBlendEquationSeparateiARB + GLuint buf + GLenum modeRGB + GLenum modeAlpha + + + + void glBlendEquationSeparateiEXT + GLuint buf + GLenum modeRGB + GLenum modeAlpha + + + + void glBlendEquationSeparateiOES + GLuint buf + GLenum modeRGB + GLenum modeAlpha + + + + void glBlendEquationi + GLuint buf + GLenum mode + + + void glBlendEquationiARB + GLuint buf + GLenum mode + + + + void glBlendEquationiEXT + GLuint buf + GLenum mode + + + + void glBlendEquationiOES + GLuint buf + GLenum mode + + + + void glBlendFunc + GLenum sfactor + GLenum dfactor + + + + void glBlendFuncIndexedAMD + GLuint buf + GLenum src + GLenum dst + + + + void glBlendFuncSeparate + GLenum sfactorRGB + GLenum dfactorRGB + GLenum sfactorAlpha + GLenum dfactorAlpha + + + + void glBlendFuncSeparateEXT + GLenum sfactorRGB + GLenum dfactorRGB + GLenum sfactorAlpha + GLenum dfactorAlpha + + + + + void glBlendFuncSeparateINGR + GLenum sfactorRGB + GLenum dfactorRGB + GLenum sfactorAlpha + GLenum dfactorAlpha + + + + + void glBlendFuncSeparateIndexedAMD + GLuint buf + GLenum srcRGB + GLenum dstRGB + GLenum srcAlpha + GLenum dstAlpha + + + + void glBlendFuncSeparateOES + GLenum srcRGB + GLenum dstRGB + GLenum srcAlpha + GLenum dstAlpha + + + void glBlendFuncSeparatei + GLuint buf + GLenum srcRGB + GLenum dstRGB + GLenum srcAlpha + GLenum dstAlpha + + + void glBlendFuncSeparateiARB + GLuint buf + GLenum srcRGB + GLenum dstRGB + GLenum srcAlpha + GLenum dstAlpha + + + + void glBlendFuncSeparateiEXT + GLuint buf + GLenum srcRGB + GLenum dstRGB + GLenum srcAlpha + GLenum dstAlpha + + + + void glBlendFuncSeparateiOES + GLuint buf + GLenum srcRGB + GLenum dstRGB + GLenum srcAlpha + GLenum dstAlpha + + + + void glBlendFunci + GLuint buf + GLenum src + GLenum dst + + + void glBlendFunciARB + GLuint buf + GLenum src + GLenum dst + + + + void glBlendFunciEXT + GLuint buf + GLenum src + GLenum dst + + + + void glBlendFunciOES + GLuint buf + GLenum src + GLenum dst + + + + void glBlendParameteriNV + GLenum pname + GLint value + + + void glBlitFramebuffer + GLint srcX0 + GLint srcY0 + GLint srcX1 + GLint srcY1 + GLint dstX0 + GLint dstY0 + GLint dstX1 + GLint dstY1 + GLbitfield mask + GLenum filter + + + + void glBlitFramebufferANGLE + GLint srcX0 + GLint srcY0 + GLint srcX1 + GLint srcY1 + GLint dstX0 + GLint dstY0 + GLint dstX1 + GLint dstY1 + GLbitfield mask + GLenum filter + + + void glBlitFramebufferEXT + GLint srcX0 + GLint srcY0 + GLint srcX1 + GLint srcY1 + GLint dstX0 + GLint dstY0 + GLint dstX1 + GLint dstY1 + GLbitfield mask + GLenum filter + + + + + void glBlitFramebufferNV + GLint srcX0 + GLint srcY0 + GLint srcX1 + GLint srcY1 + GLint dstX0 + GLint dstY0 + GLint dstX1 + GLint dstY1 + GLbitfield mask + GLenum filter + + + + void glBlitNamedFramebuffer + GLuint readFramebuffer + GLuint drawFramebuffer + GLint srcX0 + GLint srcY0 + GLint srcX1 + GLint srcY1 + GLint dstX0 + GLint dstY0 + GLint dstX1 + GLint dstY1 + GLbitfield mask + GLenum filter + + + void glBufferAddressRangeNV + GLenum pname + GLuint index + GLuint64EXT address + GLsizeiptr length + + + void glBufferData + GLenum target + GLsizeiptr size + const void *data + GLenum usage + + + void glBufferDataARB + GLenum target + GLsizeiptrARB size + const void *data + GLenum usage + + + + void glBufferPageCommitmentARB + GLenum target + GLintptr offset + GLsizeiptr size + GLboolean commit + + + void glBufferParameteriAPPLE + GLenum target + GLenum pname + GLint param + + + void glBufferStorage + GLenum target + GLsizeiptr size + const void *data + GLbitfield flags + + + void glBufferStorageEXT + GLenum target + GLsizeiptr size + const void *data + GLbitfield flags + + + + void glBufferSubData + GLenum target + GLintptr offset + GLsizeiptr size + const void *data + + + void glBufferSubDataARB + GLenum target + GLintptrARB offset + GLsizeiptrARB size + const void *data + + + + void glCallCommandListNV + GLuint list + + + void glCallList + GLuint list + + + + void glCallLists + GLsizei n + GLenum type + const void *lists + + + + GLenum glCheckFramebufferStatus + GLenum target + + + + GLenum glCheckFramebufferStatusEXT + GLenum target + + + + + GLenum glCheckFramebufferStatusOES + GLenum target + + + GLenum glCheckNamedFramebufferStatus + GLuint framebuffer + GLenum target + + + GLenum glCheckNamedFramebufferStatusEXT + GLuint framebuffer + GLenum target + + + void glClampColor + GLenum target + GLenum clamp + + + + void glClampColorARB + GLenum target + GLenum clamp + + + + + void glClear + GLbitfield mask + + + + void glClearAccum + GLfloat red + GLfloat green + GLfloat blue + GLfloat alpha + + + + void glClearAccumxOES + GLfixed red + GLfixed green + GLfixed blue + GLfixed alpha + + + void glClearBufferData + GLenum target + GLenum internalformat + GLenum format + GLenum type + const void *data + + + void glClearBufferSubData + GLenum target + GLenum internalformat + GLintptr offset + GLsizeiptr size + GLenum format + GLenum type + const void *data + + + void glClearBufferfi + GLenum buffer + GLint drawbuffer + GLfloat depth + GLint stencil + + + void glClearBufferfv + GLenum buffer + GLint drawbuffer + const GLfloat *value + + + void glClearBufferiv + GLenum buffer + GLint drawbuffer + const GLint *value + + + void glClearBufferuiv + GLenum buffer + GLint drawbuffer + const GLuint *value + + + void glClearColor + GLfloat red + GLfloat green + GLfloat blue + GLfloat alpha + + + + void glClearColorIiEXT + GLint red + GLint green + GLint blue + GLint alpha + + + + void glClearColorIuiEXT + GLuint red + GLuint green + GLuint blue + GLuint alpha + + + + void glClearColorx + GLfixed red + GLfixed green + GLfixed blue + GLfixed alpha + + + void glClearColorxOES + GLfixed red + GLfixed green + GLfixed blue + GLfixed alpha + + + void glClearDepth + GLdouble depth + + + + void glClearDepthdNV + GLdouble depth + + + + void glClearDepthf + GLfloat d + + + void glClearDepthfOES + GLclampf depth + + + + + void glClearDepthx + GLfixed depth + + + void glClearDepthxOES + GLfixed depth + + + void glClearIndex + GLfloat c + + + + void glClearNamedBufferData + GLuint buffer + GLenum internalformat + GLenum format + GLenum type + const void *data + + + void glClearNamedBufferDataEXT + GLuint buffer + GLenum internalformat + GLenum format + GLenum type + const void *data + + + void glClearNamedBufferSubData + GLuint buffer + GLenum internalformat + GLintptr offset + GLsizeiptr size + GLenum format + GLenum type + const void *data + + + void glClearNamedBufferSubDataEXT + GLuint buffer + GLenum internalformat + GLsizeiptr offset + GLsizeiptr size + GLenum format + GLenum type + const void *data + + + void glClearNamedFramebufferfi + GLuint framebuffer + GLenum buffer + const GLfloat depth + GLint stencil + + + void glClearNamedFramebufferfv + GLuint framebuffer + GLenum buffer + GLint drawbuffer + const GLfloat *value + + + void glClearNamedFramebufferiv + GLuint framebuffer + GLenum buffer + GLint drawbuffer + const GLint *value + + + void glClearNamedFramebufferuiv + GLuint framebuffer + GLenum buffer + GLint drawbuffer + const GLuint *value + + + void glClearStencil + GLint s + + + + void glClearTexImage + GLuint texture + GLint level + GLenum format + GLenum type + const void *data + + + void glClearTexSubImage + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + const void *data + + + void glClientActiveTexture + GLenum texture + + + void glClientActiveTextureARB + GLenum texture + + + + void glClientActiveVertexStreamATI + GLenum stream + + + void glClientAttribDefaultEXT + GLbitfield mask + + + GLenum glClientWaitSync + GLsync sync + GLbitfield flags + GLuint64 timeout + + + GLenum glClientWaitSyncAPPLE + GLsync sync + GLbitfield flags + GLuint64 timeout + + + + void glClipControl + GLenum origin + GLenum depth + + + void glClipPlane + GLenum plane + const GLdouble *equation + + + + void glClipPlanef + GLenum p + const GLfloat *eqn + + + void glClipPlanefIMG + GLenum p + const GLfloat *eqn + + + void glClipPlanefOES + GLenum plane + const GLfloat *equation + + + + void glClipPlanex + GLenum plane + const GLfixed *equation + + + void glClipPlanexIMG + GLenum p + const GLfixed *eqn + + + void glClipPlanexOES + GLenum plane + const GLfixed *equation + + + void glColor3b + GLbyte red + GLbyte green + GLbyte blue + + + + void glColor3bv + const GLbyte *v + + + + void glColor3d + GLdouble red + GLdouble green + GLdouble blue + + + + void glColor3dv + const GLdouble *v + + + + void glColor3f + GLfloat red + GLfloat green + GLfloat blue + + + + void glColor3fVertex3fSUN + GLfloat r + GLfloat g + GLfloat b + GLfloat x + GLfloat y + GLfloat z + + + void glColor3fVertex3fvSUN + const GLfloat *c + const GLfloat *v + + + void glColor3fv + const GLfloat *v + + + + void glColor3hNV + GLhalfNV red + GLhalfNV green + GLhalfNV blue + + + + void glColor3hvNV + const GLhalfNV *v + + + + void glColor3i + GLint red + GLint green + GLint blue + + + + void glColor3iv + const GLint *v + + + + void glColor3s + GLshort red + GLshort green + GLshort blue + + + + void glColor3sv + const GLshort *v + + + + void glColor3ub + GLubyte red + GLubyte green + GLubyte blue + + + + void glColor3ubv + const GLubyte *v + + + + void glColor3ui + GLuint red + GLuint green + GLuint blue + + + + void glColor3uiv + const GLuint *v + + + + void glColor3us + GLushort red + GLushort green + GLushort blue + + + + void glColor3usv + const GLushort *v + + + + void glColor3xOES + GLfixed red + GLfixed green + GLfixed blue + + + void glColor3xvOES + const GLfixed *components + + + void glColor4b + GLbyte red + GLbyte green + GLbyte blue + GLbyte alpha + + + + void glColor4bv + const GLbyte *v + + + + void glColor4d + GLdouble red + GLdouble green + GLdouble blue + GLdouble alpha + + + + void glColor4dv + const GLdouble *v + + + + void glColor4f + GLfloat red + GLfloat green + GLfloat blue + GLfloat alpha + + + + void glColor4fNormal3fVertex3fSUN + GLfloat r + GLfloat g + GLfloat b + GLfloat a + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glColor4fNormal3fVertex3fvSUN + const GLfloat *c + const GLfloat *n + const GLfloat *v + + + void glColor4fv + const GLfloat *v + + + + void glColor4hNV + GLhalfNV red + GLhalfNV green + GLhalfNV blue + GLhalfNV alpha + + + + void glColor4hvNV + const GLhalfNV *v + + + + void glColor4i + GLint red + GLint green + GLint blue + GLint alpha + + + + void glColor4iv + const GLint *v + + + + void glColor4s + GLshort red + GLshort green + GLshort blue + GLshort alpha + + + + void glColor4sv + const GLshort *v + + + + void glColor4ub + GLubyte red + GLubyte green + GLubyte blue + GLubyte alpha + + + + void glColor4ubVertex2fSUN + GLubyte r + GLubyte g + GLubyte b + GLubyte a + GLfloat x + GLfloat y + + + void glColor4ubVertex2fvSUN + const GLubyte *c + const GLfloat *v + + + void glColor4ubVertex3fSUN + GLubyte r + GLubyte g + GLubyte b + GLubyte a + GLfloat x + GLfloat y + GLfloat z + + + void glColor4ubVertex3fvSUN + const GLubyte *c + const GLfloat *v + + + void glColor4ubv + const GLubyte *v + + + + void glColor4ui + GLuint red + GLuint green + GLuint blue + GLuint alpha + + + + void glColor4uiv + const GLuint *v + + + + void glColor4us + GLushort red + GLushort green + GLushort blue + GLushort alpha + + + + void glColor4usv + const GLushort *v + + + + void glColor4x + GLfixed red + GLfixed green + GLfixed blue + GLfixed alpha + + + void glColor4xOES + GLfixed red + GLfixed green + GLfixed blue + GLfixed alpha + + + void glColor4xvOES + const GLfixed *components + + + void glColorFormatNV + GLint size + GLenum type + GLsizei stride + + + void glColorFragmentOp1ATI + GLenum op + GLuint dst + GLuint dstMask + GLuint dstMod + GLuint arg1 + GLuint arg1Rep + GLuint arg1Mod + + + void glColorFragmentOp2ATI + GLenum op + GLuint dst + GLuint dstMask + GLuint dstMod + GLuint arg1 + GLuint arg1Rep + GLuint arg1Mod + GLuint arg2 + GLuint arg2Rep + GLuint arg2Mod + + + void glColorFragmentOp3ATI + GLenum op + GLuint dst + GLuint dstMask + GLuint dstMod + GLuint arg1 + GLuint arg1Rep + GLuint arg1Mod + GLuint arg2 + GLuint arg2Rep + GLuint arg2Mod + GLuint arg3 + GLuint arg3Rep + GLuint arg3Mod + + + void glColorMask + GLboolean red + GLboolean green + GLboolean blue + GLboolean alpha + + + + void glColorMaskIndexedEXT + GLuint index + GLboolean r + GLboolean g + GLboolean b + GLboolean a + + + + void glColorMaski + GLuint index + GLboolean r + GLboolean g + GLboolean b + GLboolean a + + + void glColorMaskiEXT + GLuint index + GLboolean r + GLboolean g + GLboolean b + GLboolean a + + + + void glColorMaskiOES + GLuint index + GLboolean r + GLboolean g + GLboolean b + GLboolean a + + + + void glColorMaterial + GLenum face + GLenum mode + + + + void glColorP3ui + GLenum type + GLuint color + + + void glColorP3uiv + GLenum type + const GLuint *color + + + void glColorP4ui + GLenum type + GLuint color + + + void glColorP4uiv + GLenum type + const GLuint *color + + + void glColorPointer + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glColorPointerEXT + GLint size + GLenum type + GLsizei stride + GLsizei count + const void *pointer + + + void glColorPointerListIBM + GLint size + GLenum type + GLint stride + const void **pointer + GLint ptrstride + + + void glColorPointervINTEL + GLint size + GLenum type + const void **pointer + + + void glColorSubTable + GLenum target + GLsizei start + GLsizei count + GLenum format + GLenum type + const void *data + + + + + void glColorSubTableEXT + GLenum target + GLsizei start + GLsizei count + GLenum format + GLenum type + const void *data + + + + void glColorTable + GLenum target + GLenum internalformat + GLsizei width + GLenum format + GLenum type + const void *table + + + + + void glColorTableEXT + GLenum target + GLenum internalFormat + GLsizei width + GLenum format + GLenum type + const void *table + + + + void glColorTableParameterfv + GLenum target + GLenum pname + const GLfloat *params + + + + void glColorTableParameterfvSGI + GLenum target + GLenum pname + const GLfloat *params + + + + + void glColorTableParameteriv + GLenum target + GLenum pname + const GLint *params + + + + void glColorTableParameterivSGI + GLenum target + GLenum pname + const GLint *params + + + + + void glColorTableSGI + GLenum target + GLenum internalformat + GLsizei width + GLenum format + GLenum type + const void *table + + + + + void glCombinerInputNV + GLenum stage + GLenum portion + GLenum variable + GLenum input + GLenum mapping + GLenum componentUsage + + + + void glCombinerOutputNV + GLenum stage + GLenum portion + GLenum abOutput + GLenum cdOutput + GLenum sumOutput + GLenum scale + GLenum bias + GLboolean abDotProduct + GLboolean cdDotProduct + GLboolean muxSum + + + + void glCombinerParameterfNV + GLenum pname + GLfloat param + + + + void glCombinerParameterfvNV + GLenum pname + const GLfloat *params + + + + void glCombinerParameteriNV + GLenum pname + GLint param + + + + void glCombinerParameterivNV + GLenum pname + const GLint *params + + + + void glCombinerStageParameterfvNV + GLenum stage + GLenum pname + const GLfloat *params + + + void glCommandListSegmentsNV + GLuint list + GLuint segments + + + void glCompileCommandListNV + GLuint list + + + void glCompileShader + GLuint shader + + + void glCompileShaderARB + GLhandleARB shaderObj + + + + void glCompileShaderIncludeARB + GLuint shader + GLsizei count + const GLchar *const*path + const GLint *length + + + void glCompressedMultiTexImage1DEXT + GLenum texunit + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLint border + GLsizei imageSize + const void *bits + + + void glCompressedMultiTexImage2DEXT + GLenum texunit + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLint border + GLsizei imageSize + const void *bits + + + void glCompressedMultiTexImage3DEXT + GLenum texunit + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLsizei imageSize + const void *bits + + + void glCompressedMultiTexSubImage1DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLsizei imageSize + const void *bits + + + void glCompressedMultiTexSubImage2DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLsizei imageSize + const void *bits + + + void glCompressedMultiTexSubImage3DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLsizei imageSize + const void *bits + + + void glCompressedTexImage1D + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLint border + GLsizei imageSize + const void *data + + + + + void glCompressedTexImage1DARB + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLint border + GLsizei imageSize + const void *data + + + + + void glCompressedTexImage2D + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLint border + GLsizei imageSize + const void *data + + + + + void glCompressedTexImage2DARB + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLint border + GLsizei imageSize + const void *data + + + + + void glCompressedTexImage3D + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLsizei imageSize + const void *data + + + + + void glCompressedTexImage3DARB + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLsizei imageSize + const void *data + + + + + void glCompressedTexImage3DOES + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLsizei imageSize + const void *data + + + + void glCompressedTexSubImage1D + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLsizei imageSize + const void *data + + + + + void glCompressedTexSubImage1DARB + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLsizei imageSize + const void *data + + + + + void glCompressedTexSubImage2D + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLsizei imageSize + const void *data + + + + + void glCompressedTexSubImage2DARB + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLsizei imageSize + const void *data + + + + + void glCompressedTexSubImage3D + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLsizei imageSize + const void *data + + + + + void glCompressedTexSubImage3DARB + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLsizei imageSize + const void *data + + + + + void glCompressedTexSubImage3DOES + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLsizei imageSize + const void *data + + + + void glCompressedTextureImage1DEXT + GLuint texture + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLint border + GLsizei imageSize + const void *bits + + + void glCompressedTextureImage2DEXT + GLuint texture + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLint border + GLsizei imageSize + const void *bits + + + void glCompressedTextureImage3DEXT + GLuint texture + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLsizei imageSize + const void *bits + + + void glCompressedTextureSubImage1D + GLuint texture + GLint level + GLint xoffset + GLsizei width + GLenum format + GLsizei imageSize + const void *data + + + void glCompressedTextureSubImage1DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLsizei imageSize + const void *bits + + + void glCompressedTextureSubImage2D + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLsizei imageSize + const void *data + + + void glCompressedTextureSubImage2DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLsizei imageSize + const void *bits + + + void glCompressedTextureSubImage3D + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLsizei imageSize + const void *data + + + void glCompressedTextureSubImage3DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLsizei imageSize + const void *bits + + + void glConservativeRasterParameterfNV + GLenum pname + GLfloat value + + + void glConvolutionFilter1D + GLenum target + GLenum internalformat + GLsizei width + GLenum format + GLenum type + const void *image + + + + + void glConvolutionFilter1DEXT + GLenum target + GLenum internalformat + GLsizei width + GLenum format + GLenum type + const void *image + + + + + void glConvolutionFilter2D + GLenum target + GLenum internalformat + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *image + + + + + void glConvolutionFilter2DEXT + GLenum target + GLenum internalformat + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *image + + + + + void glConvolutionParameterf + GLenum target + GLenum pname + GLfloat params + + + + void glConvolutionParameterfEXT + GLenum target + GLenum pname + GLfloat params + + + + + void glConvolutionParameterfv + GLenum target + GLenum pname + const GLfloat *params + + + + void glConvolutionParameterfvEXT + GLenum target + GLenum pname + const GLfloat *params + + + + + void glConvolutionParameteri + GLenum target + GLenum pname + GLint params + + + + void glConvolutionParameteriEXT + GLenum target + GLenum pname + GLint params + + + + + void glConvolutionParameteriv + GLenum target + GLenum pname + const GLint *params + + + + void glConvolutionParameterivEXT + GLenum target + GLenum pname + const GLint *params + + + + + void glConvolutionParameterxOES + GLenum target + GLenum pname + GLfixed param + + + void glConvolutionParameterxvOES + GLenum target + GLenum pname + const GLfixed *params + + + void glCopyBufferSubData + GLenum readTarget + GLenum writeTarget + GLintptr readOffset + GLintptr writeOffset + GLsizeiptr size + + + void glCopyBufferSubDataNV + GLenum readTarget + GLenum writeTarget + GLintptr readOffset + GLintptr writeOffset + GLsizeiptr size + + + + void glCopyColorSubTable + GLenum target + GLsizei start + GLint x + GLint y + GLsizei width + + + + void glCopyColorSubTableEXT + GLenum target + GLsizei start + GLint x + GLint y + GLsizei width + + + + void glCopyColorTable + GLenum target + GLenum internalformat + GLint x + GLint y + GLsizei width + + + + void glCopyColorTableSGI + GLenum target + GLenum internalformat + GLint x + GLint y + GLsizei width + + + + + void glCopyConvolutionFilter1D + GLenum target + GLenum internalformat + GLint x + GLint y + GLsizei width + + + + void glCopyConvolutionFilter1DEXT + GLenum target + GLenum internalformat + GLint x + GLint y + GLsizei width + + + + + void glCopyConvolutionFilter2D + GLenum target + GLenum internalformat + GLint x + GLint y + GLsizei width + GLsizei height + + + + void glCopyConvolutionFilter2DEXT + GLenum target + GLenum internalformat + GLint x + GLint y + GLsizei width + GLsizei height + + + + + void glCopyImageSubData + GLuint srcName + GLenum srcTarget + GLint srcLevel + GLint srcX + GLint srcY + GLint srcZ + GLuint dstName + GLenum dstTarget + GLint dstLevel + GLint dstX + GLint dstY + GLint dstZ + GLsizei srcWidth + GLsizei srcHeight + GLsizei srcDepth + + + void glCopyImageSubDataEXT + GLuint srcName + GLenum srcTarget + GLint srcLevel + GLint srcX + GLint srcY + GLint srcZ + GLuint dstName + GLenum dstTarget + GLint dstLevel + GLint dstX + GLint dstY + GLint dstZ + GLsizei srcWidth + GLsizei srcHeight + GLsizei srcDepth + + + + void glCopyImageSubDataNV + GLuint srcName + GLenum srcTarget + GLint srcLevel + GLint srcX + GLint srcY + GLint srcZ + GLuint dstName + GLenum dstTarget + GLint dstLevel + GLint dstX + GLint dstY + GLint dstZ + GLsizei width + GLsizei height + GLsizei depth + + + + void glCopyImageSubDataOES + GLuint srcName + GLenum srcTarget + GLint srcLevel + GLint srcX + GLint srcY + GLint srcZ + GLuint dstName + GLenum dstTarget + GLint dstLevel + GLint dstX + GLint dstY + GLint dstZ + GLsizei srcWidth + GLsizei srcHeight + GLsizei srcDepth + + + + void glCopyMultiTexImage1DEXT + GLenum texunit + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLint border + + + void glCopyMultiTexImage2DEXT + GLenum texunit + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLsizei height + GLint border + + + void glCopyMultiTexSubImage1DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLint x + GLint y + GLsizei width + + + void glCopyMultiTexSubImage2DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + void glCopyMultiTexSubImage3DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + void glCopyNamedBufferSubData + GLuint readBuffer + GLuint writeBuffer + GLintptr readOffset + GLintptr writeOffset + GLsizeiptr size + + + void glCopyPathNV + GLuint resultPath + GLuint srcPath + + + void glCopyPixels + GLint x + GLint y + GLsizei width + GLsizei height + GLenum type + + + + void glCopyTexImage1D + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLint border + + + + void glCopyTexImage1DEXT + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLint border + + + + + void glCopyTexImage2D + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLsizei height + GLint border + + + + void glCopyTexImage2DEXT + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLsizei height + GLint border + + + + + void glCopyTexSubImage1D + GLenum target + GLint level + GLint xoffset + GLint x + GLint y + GLsizei width + + + + void glCopyTexSubImage1DEXT + GLenum target + GLint level + GLint xoffset + GLint x + GLint y + GLsizei width + + + + + void glCopyTexSubImage2D + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + + void glCopyTexSubImage2DEXT + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + + + void glCopyTexSubImage3D + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + + void glCopyTexSubImage3DEXT + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + + + void glCopyTexSubImage3DOES + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + + void glCopyTextureImage1DEXT + GLuint texture + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLint border + + + void glCopyTextureImage2DEXT + GLuint texture + GLenum target + GLint level + GLenum internalformat + GLint x + GLint y + GLsizei width + GLsizei height + GLint border + + + void glCopyTextureLevelsAPPLE + GLuint destinationTexture + GLuint sourceTexture + GLint sourceBaseLevel + GLsizei sourceLevelCount + + + void glCopyTextureSubImage1D + GLuint texture + GLint level + GLint xoffset + GLint x + GLint y + GLsizei width + + + void glCopyTextureSubImage1DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLint x + GLint y + GLsizei width + + + void glCopyTextureSubImage2D + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + void glCopyTextureSubImage2DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + void glCopyTextureSubImage3D + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + void glCopyTextureSubImage3DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLint x + GLint y + GLsizei width + GLsizei height + + + void glCoverFillPathInstancedNV + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLenum coverMode + GLenum transformType + const GLfloat *transformValues + + + void glCoverFillPathNV + GLuint path + GLenum coverMode + + + void glCoverStrokePathInstancedNV + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLenum coverMode + GLenum transformType + const GLfloat *transformValues + + + void glCoverStrokePathNV + GLuint path + GLenum coverMode + + + void glCoverageMaskNV + GLboolean mask + + + void glCoverageModulationNV + GLenum components + + + void glCoverageModulationTableNV + GLsizei n + const GLfloat *v + + + void glCoverageOperationNV + GLenum operation + + + void glCreateBuffers + GLsizei n + GLuint *buffers + + + void glCreateCommandListsNV + GLsizei n + GLuint *lists + + + void glCreateFramebuffers + GLsizei n + GLuint *framebuffers + + + void glCreatePerfQueryINTEL + GLuint queryId + GLuint *queryHandle + + + GLuint glCreateProgram + + + GLhandleARB glCreateProgramObjectARB + + + + void glCreateProgramPipelines + GLsizei n + GLuint *pipelines + + + void glCreateQueries + GLenum target + GLsizei n + GLuint *ids + + + void glCreateRenderbuffers + GLsizei n + GLuint *renderbuffers + + + void glCreateSamplers + GLsizei n + GLuint *samplers + + + GLuint glCreateShader + GLenum type + + + GLhandleARB glCreateShaderObjectARB + GLenum shaderType + + + + GLuint glCreateShaderProgramEXT + GLenum type + const GLchar *string + + + GLuint glCreateShaderProgramv + GLenum type + GLsizei count + const GLchar *const*strings + + + GLuint glCreateShaderProgramvEXT + GLenum type + GLsizei count + const GLchar **strings + + + void glCreateStatesNV + GLsizei n + GLuint *states + + + GLsync glCreateSyncFromCLeventARB + struct _cl_context *context + struct _cl_event *event + GLbitfield flags + + + void glCreateTextures + GLenum target + GLsizei n + GLuint *textures + + + void glCreateTransformFeedbacks + GLsizei n + GLuint *ids + + + void glCreateVertexArrays + GLsizei n + GLuint *arrays + + + void glCullFace + GLenum mode + + + + void glCullParameterdvEXT + GLenum pname + GLdouble *params + + + void glCullParameterfvEXT + GLenum pname + GLfloat *params + + + void glCurrentPaletteMatrixARB + GLint index + + + + void glCurrentPaletteMatrixOES + GLuint matrixpaletteindex + + + void glDebugMessageCallback + GLDEBUGPROC callback + const void *userParam + + + void glDebugMessageCallbackAMD + GLDEBUGPROCAMD callback + void *userParam + + + void glDebugMessageCallbackARB + GLDEBUGPROCARB callback + const void *userParam + + + + void glDebugMessageCallbackKHR + GLDEBUGPROCKHR callback + const void *userParam + + + + void glDebugMessageControl + GLenum source + GLenum type + GLenum severity + GLsizei count + const GLuint *ids + GLboolean enabled + + + void glDebugMessageControlARB + GLenum source + GLenum type + GLenum severity + GLsizei count + const GLuint *ids + GLboolean enabled + + + + void glDebugMessageControlKHR + GLenum source + GLenum type + GLenum severity + GLsizei count + const GLuint *ids + GLboolean enabled + + + + void glDebugMessageEnableAMD + GLenum category + GLenum severity + GLsizei count + const GLuint *ids + GLboolean enabled + + + void glDebugMessageInsert + GLenum source + GLenum type + GLuint id + GLenum severity + GLsizei length + const GLchar *buf + + + void glDebugMessageInsertAMD + GLenum category + GLenum severity + GLuint id + GLsizei length + const GLchar *buf + + + void glDebugMessageInsertARB + GLenum source + GLenum type + GLuint id + GLenum severity + GLsizei length + const GLchar *buf + + + + void glDebugMessageInsertKHR + GLenum source + GLenum type + GLuint id + GLenum severity + GLsizei length + const GLchar *buf + + + + void glDeformSGIX + GLbitfield mask + + + + void glDeformationMap3dSGIX + GLenum target + GLdouble u1 + GLdouble u2 + GLint ustride + GLint uorder + GLdouble v1 + GLdouble v2 + GLint vstride + GLint vorder + GLdouble w1 + GLdouble w2 + GLint wstride + GLint worder + const GLdouble *points + + + + void glDeformationMap3fSGIX + GLenum target + GLfloat u1 + GLfloat u2 + GLint ustride + GLint uorder + GLfloat v1 + GLfloat v2 + GLint vstride + GLint vorder + GLfloat w1 + GLfloat w2 + GLint wstride + GLint worder + const GLfloat *points + + + + void glDeleteAsyncMarkersSGIX + GLuint marker + GLsizei range + + + void glDeleteBuffers + GLsizei n + const GLuint *buffers + + + void glDeleteBuffersARB + GLsizei n + const GLuint *buffers + + + + void glDeleteCommandListsNV + GLsizei n + const GLuint *lists + + + void glDeleteFencesAPPLE + GLsizei n + const GLuint *fences + + + void glDeleteFencesNV + GLsizei n + const GLuint *fences + + + + void glDeleteFragmentShaderATI + GLuint id + + + void glDeleteFramebuffers + GLsizei n + const GLuint *framebuffers + + + + void glDeleteFramebuffersEXT + GLsizei n + const GLuint *framebuffers + + + + + void glDeleteFramebuffersOES + GLsizei n + const GLuint *framebuffers + + + void glDeleteLists + GLuint list + GLsizei range + + + + void glDeleteNamedStringARB + GLint namelen + const GLchar *name + + + void glDeleteNamesAMD + GLenum identifier + GLuint num + const GLuint *names + + + void glDeleteObjectARB + GLhandleARB obj + + + void glDeleteOcclusionQueriesNV + GLsizei n + const GLuint *ids + + + void glDeletePathsNV + GLuint path + GLsizei range + + + void glDeletePerfMonitorsAMD + GLsizei n + GLuint *monitors + + + void glDeletePerfQueryINTEL + GLuint queryHandle + + + void glDeleteProgram + GLuint program + + + + void glDeleteProgramPipelines + GLsizei n + const GLuint *pipelines + + + void glDeleteProgramPipelinesEXT + GLsizei n + const GLuint *pipelines + + + void glDeleteProgramsARB + GLsizei n + const GLuint *programs + + + + void glDeleteProgramsNV + GLsizei n + const GLuint *programs + + + + + void glDeleteQueries + GLsizei n + const GLuint *ids + + + + void glDeleteQueriesARB + GLsizei n + const GLuint *ids + + + + void glDeleteQueriesEXT + GLsizei n + const GLuint *ids + + + void glDeleteRenderbuffers + GLsizei n + const GLuint *renderbuffers + + + + void glDeleteRenderbuffersEXT + GLsizei n + const GLuint *renderbuffers + + + + + void glDeleteRenderbuffersOES + GLsizei n + const GLuint *renderbuffers + + + void glDeleteSamplers + GLsizei count + const GLuint *samplers + + + void glDeleteShader + GLuint shader + + + + void glDeleteStatesNV + GLsizei n + const GLuint *states + + + void glDeleteSync + GLsync sync + + + void glDeleteSyncAPPLE + GLsync sync + + + + void glDeleteTextures + GLsizei n + const GLuint *textures + + + + void glDeleteTexturesEXT + GLsizei n + const GLuint *textures + + + + void glDeleteTransformFeedbacks + GLsizei n + const GLuint *ids + + + void glDeleteTransformFeedbacksNV + GLsizei n + const GLuint *ids + + + + void glDeleteVertexArrays + GLsizei n + const GLuint *arrays + + + + void glDeleteVertexArraysAPPLE + GLsizei n + const GLuint *arrays + + + + void glDeleteVertexArraysOES + GLsizei n + const GLuint *arrays + + + + void glDeleteVertexShaderEXT + GLuint id + + + void glDepthBoundsEXT + GLclampd zmin + GLclampd zmax + + + + void glDepthBoundsdNV + GLdouble zmin + GLdouble zmax + + + + void glDepthFunc + GLenum func + + + + void glDepthMask + GLboolean flag + + + + void glDepthRange + GLdouble near + GLdouble far + + + + void glDepthRangeArrayfvNV + GLuint first + GLsizei count + const GLfloat *v + + + void glDepthRangeArrayv + GLuint first + GLsizei count + const GLdouble *v + + + void glDepthRangeIndexed + GLuint index + GLdouble n + GLdouble f + + + void glDepthRangeIndexedfNV + GLuint index + GLfloat n + GLfloat f + + + void glDepthRangedNV + GLdouble zNear + GLdouble zFar + + + + void glDepthRangef + GLfloat n + GLfloat f + + + void glDepthRangefOES + GLclampf n + GLclampf f + + + + + void glDepthRangex + GLfixed n + GLfixed f + + + void glDepthRangexOES + GLfixed n + GLfixed f + + + void glDetachObjectARB + GLhandleARB containerObj + GLhandleARB attachedObj + + + + void glDetachShader + GLuint program + GLuint shader + + + void glDetailTexFuncSGIS + GLenum target + GLsizei n + const GLfloat *points + + + + void glDisable + GLenum cap + + + + void glDisableClientState + GLenum array + + + void glDisableClientStateIndexedEXT + GLenum array + GLuint index + + + void glDisableClientStateiEXT + GLenum array + GLuint index + + + void glDisableDriverControlQCOM + GLuint driverControl + + + void glDisableIndexedEXT + GLenum target + GLuint index + + + + void glDisableVariantClientStateEXT + GLuint id + + + void glDisableVertexArrayAttrib + GLuint vaobj + GLuint index + + + void glDisableVertexArrayAttribEXT + GLuint vaobj + GLuint index + + + void glDisableVertexArrayEXT + GLuint vaobj + GLenum array + + + void glDisableVertexAttribAPPLE + GLuint index + GLenum pname + + + void glDisableVertexAttribArray + GLuint index + + + void glDisableVertexAttribArrayARB + GLuint index + + + + void glDisablei + GLenum target + GLuint index + + + void glDisableiEXT + GLenum target + GLuint index + + + + void glDisableiNV + GLenum target + GLuint index + + + + void glDisableiOES + GLenum target + GLuint index + + + + void glDiscardFramebufferEXT + GLenum target + GLsizei numAttachments + const GLenum *attachments + + + void glDispatchCompute + GLuint num_groups_x + GLuint num_groups_y + GLuint num_groups_z + + + void glDispatchComputeGroupSizeARB + GLuint num_groups_x + GLuint num_groups_y + GLuint num_groups_z + GLuint group_size_x + GLuint group_size_y + GLuint group_size_z + + + void glDispatchComputeIndirect + GLintptr indirect + + + void glDrawArrays + GLenum mode + GLint first + GLsizei count + + + + void glDrawArraysEXT + GLenum mode + GLint first + GLsizei count + + + + + void glDrawArraysIndirect + GLenum mode + const void *indirect + + + void glDrawArraysInstanced + GLenum mode + GLint first + GLsizei count + GLsizei instancecount + + + void glDrawArraysInstancedANGLE + GLenum mode + GLint first + GLsizei count + GLsizei primcount + + + + void glDrawArraysInstancedARB + GLenum mode + GLint first + GLsizei count + GLsizei primcount + + + + void glDrawArraysInstancedBaseInstance + GLenum mode + GLint first + GLsizei count + GLsizei instancecount + GLuint baseinstance + + + void glDrawArraysInstancedBaseInstanceEXT + GLenum mode + GLint first + GLsizei count + GLsizei instancecount + GLuint baseinstance + + + + void glDrawArraysInstancedEXT + GLenum mode + GLint start + GLsizei count + GLsizei primcount + + + + void glDrawArraysInstancedNV + GLenum mode + GLint first + GLsizei count + GLsizei primcount + + + + void glDrawBuffer + GLenum buf + + + + void glDrawBuffers + GLsizei n + const GLenum *bufs + + + + void glDrawBuffersARB + GLsizei n + const GLenum *bufs + + + + void glDrawBuffersATI + GLsizei n + const GLenum *bufs + + + + + void glDrawBuffersEXT + GLsizei n + const GLenum *bufs + + + + void glDrawBuffersIndexedEXT + GLint n + const GLenum *location + const GLint *indices + + + void glDrawBuffersNV + GLsizei n + const GLenum *bufs + + + void glDrawCommandsAddressNV + GLenum primitiveMode + const GLuint64 *indirects + const GLsizei *sizes + GLuint count + + + void glDrawCommandsNV + GLenum primitiveMode + GLuint buffer + const GLintptr *indirects + const GLsizei *sizes + GLuint count + + + void glDrawCommandsStatesAddressNV + const GLuint64 *indirects + const GLsizei *sizes + const GLuint *states + const GLuint *fbos + GLuint count + + + void glDrawCommandsStatesNV + GLuint buffer + const GLintptr *indirects + const GLsizei *sizes + const GLuint *states + const GLuint *fbos + GLuint count + + + void glDrawElementArrayAPPLE + GLenum mode + GLint first + GLsizei count + + + void glDrawElementArrayATI + GLenum mode + GLsizei count + + + void glDrawElements + GLenum mode + GLsizei count + GLenum type + const void *indices + + + void glDrawElementsBaseVertex + GLenum mode + GLsizei count + GLenum type + const void *indices + GLint basevertex + + + void glDrawElementsBaseVertexEXT + GLenum mode + GLsizei count + GLenum type + const void *indices + GLint basevertex + + + + void glDrawElementsBaseVertexOES + GLenum mode + GLsizei count + GLenum type + const void *indices + GLint basevertex + + + + void glDrawElementsIndirect + GLenum mode + GLenum type + const void *indirect + + + void glDrawElementsInstanced + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + + + void glDrawElementsInstancedANGLE + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei primcount + + + + void glDrawElementsInstancedARB + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei primcount + + + + void glDrawElementsInstancedBaseInstance + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + GLuint baseinstance + + + void glDrawElementsInstancedBaseInstanceEXT + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + GLuint baseinstance + + + + void glDrawElementsInstancedBaseVertex + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + GLint basevertex + + + void glDrawElementsInstancedBaseVertexBaseInstance + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + GLint basevertex + GLuint baseinstance + + + void glDrawElementsInstancedBaseVertexBaseInstanceEXT + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + GLint basevertex + GLuint baseinstance + + + + void glDrawElementsInstancedBaseVertexEXT + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + GLint basevertex + + + + void glDrawElementsInstancedBaseVertexOES + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei instancecount + GLint basevertex + + + + void glDrawElementsInstancedEXT + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei primcount + + + + void glDrawElementsInstancedNV + GLenum mode + GLsizei count + GLenum type + const void *indices + GLsizei primcount + + + + void glDrawMeshArraysSUN + GLenum mode + GLint first + GLsizei count + GLsizei width + + + void glDrawPixels + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *pixels + + + + + void glDrawRangeElementArrayAPPLE + GLenum mode + GLuint start + GLuint end + GLint first + GLsizei count + + + void glDrawRangeElementArrayATI + GLenum mode + GLuint start + GLuint end + GLsizei count + + + void glDrawRangeElements + GLenum mode + GLuint start + GLuint end + GLsizei count + GLenum type + const void *indices + + + void glDrawRangeElementsBaseVertex + GLenum mode + GLuint start + GLuint end + GLsizei count + GLenum type + const void *indices + GLint basevertex + + + void glDrawRangeElementsBaseVertexEXT + GLenum mode + GLuint start + GLuint end + GLsizei count + GLenum type + const void *indices + GLint basevertex + + + + void glDrawRangeElementsBaseVertexOES + GLenum mode + GLuint start + GLuint end + GLsizei count + GLenum type + const void *indices + GLint basevertex + + + + void glDrawRangeElementsEXT + GLenum mode + GLuint start + GLuint end + GLsizei count + GLenum type + const void *indices + + + + void glDrawTexfOES + GLfloat x + GLfloat y + GLfloat z + GLfloat width + GLfloat height + + + void glDrawTexfvOES + const GLfloat *coords + + + void glDrawTexiOES + GLint x + GLint y + GLint z + GLint width + GLint height + + + void glDrawTexivOES + const GLint *coords + + + void glDrawTexsOES + GLshort x + GLshort y + GLshort z + GLshort width + GLshort height + + + void glDrawTexsvOES + const GLshort *coords + + + void glDrawTextureNV + GLuint texture + GLuint sampler + GLfloat x0 + GLfloat y0 + GLfloat x1 + GLfloat y1 + GLfloat z + GLfloat s0 + GLfloat t0 + GLfloat s1 + GLfloat t1 + + + void glDrawTexxOES + GLfixed x + GLfixed y + GLfixed z + GLfixed width + GLfixed height + + + void glDrawTexxvOES + const GLfixed *coords + + + void glDrawTransformFeedback + GLenum mode + GLuint id + + + void glDrawTransformFeedbackInstanced + GLenum mode + GLuint id + GLsizei instancecount + + + void glDrawTransformFeedbackNV + GLenum mode + GLuint id + + + + void glDrawTransformFeedbackStream + GLenum mode + GLuint id + GLuint stream + + + void glDrawTransformFeedbackStreamInstanced + GLenum mode + GLuint id + GLuint stream + GLsizei instancecount + + + void glEGLImageTargetRenderbufferStorageOES + GLenum target + GLeglImageOES image + + + void glEGLImageTargetTexture2DOES + GLenum target + GLeglImageOES image + + + void glEdgeFlag + GLboolean flag + + + + void glEdgeFlagFormatNV + GLsizei stride + + + void glEdgeFlagPointer + GLsizei stride + const void *pointer + + + void glEdgeFlagPointerEXT + GLsizei stride + GLsizei count + const GLboolean *pointer + + + void glEdgeFlagPointerListIBM + GLint stride + const GLboolean **pointer + GLint ptrstride + + + void glEdgeFlagv + const GLboolean *flag + + + + void glElementPointerAPPLE + GLenum type + const void *pointer + + + void glElementPointerATI + GLenum type + const void *pointer + + + void glEnable + GLenum cap + + + + void glEnableClientState + GLenum array + + + void glEnableClientStateIndexedEXT + GLenum array + GLuint index + + + void glEnableClientStateiEXT + GLenum array + GLuint index + + + void glEnableDriverControlQCOM + GLuint driverControl + + + void glEnableIndexedEXT + GLenum target + GLuint index + + + + void glEnableVariantClientStateEXT + GLuint id + + + void glEnableVertexArrayAttrib + GLuint vaobj + GLuint index + + + void glEnableVertexArrayAttribEXT + GLuint vaobj + GLuint index + + + void glEnableVertexArrayEXT + GLuint vaobj + GLenum array + + + void glEnableVertexAttribAPPLE + GLuint index + GLenum pname + + + void glEnableVertexAttribArray + GLuint index + + + void glEnableVertexAttribArrayARB + GLuint index + + + + void glEnablei + GLenum target + GLuint index + + + void glEnableiEXT + GLenum target + GLuint index + + + + void glEnableiNV + GLenum target + GLuint index + + + + void glEnableiOES + GLenum target + GLuint index + + + + void glEnd + + + + void glEndConditionalRender + + + + void glEndConditionalRenderNV + + + + void glEndConditionalRenderNVX + + + + void glEndFragmentShaderATI + + + void glEndList + + + + void glEndOcclusionQueryNV + + + void glEndPerfMonitorAMD + GLuint monitor + + + void glEndPerfQueryINTEL + GLuint queryHandle + + + void glEndQuery + GLenum target + + + + void glEndQueryARB + GLenum target + + + + void glEndQueryEXT + GLenum target + + + void glEndQueryIndexed + GLenum target + GLuint index + + + void glEndTilingQCOM + GLbitfield preserveMask + + + void glEndTransformFeedback + + + void glEndTransformFeedbackEXT + + + + void glEndTransformFeedbackNV + + + + void glEndVertexShaderEXT + + + void glEndVideoCaptureNV + GLuint video_capture_slot + + + void glEvalCoord1d + GLdouble u + + + + void glEvalCoord1dv + const GLdouble *u + + + + void glEvalCoord1f + GLfloat u + + + + void glEvalCoord1fv + const GLfloat *u + + + + void glEvalCoord1xOES + GLfixed u + + + void glEvalCoord1xvOES + const GLfixed *coords + + + void glEvalCoord2d + GLdouble u + GLdouble v + + + + void glEvalCoord2dv + const GLdouble *u + + + + void glEvalCoord2f + GLfloat u + GLfloat v + + + + void glEvalCoord2fv + const GLfloat *u + + + + void glEvalCoord2xOES + GLfixed u + GLfixed v + + + void glEvalCoord2xvOES + const GLfixed *coords + + + void glEvalMapsNV + GLenum target + GLenum mode + + + void glEvalMesh1 + GLenum mode + GLint i1 + GLint i2 + + + + void glEvalMesh2 + GLenum mode + GLint i1 + GLint i2 + GLint j1 + GLint j2 + + + + void glEvalPoint1 + GLint i + + + + void glEvalPoint2 + GLint i + GLint j + + + + void glEvaluateDepthValuesARB + + + void glExecuteProgramNV + GLenum target + GLuint id + const GLfloat *params + + + + void glExtGetBufferPointervQCOM + GLenum target + void **params + + + void glExtGetBuffersQCOM + GLuint *buffers + GLint maxBuffers + GLint *numBuffers + + + void glExtGetFramebuffersQCOM + GLuint *framebuffers + GLint maxFramebuffers + GLint *numFramebuffers + + + void glExtGetProgramBinarySourceQCOM + GLuint program + GLenum shadertype + GLchar *source + GLint *length + + + void glExtGetProgramsQCOM + GLuint *programs + GLint maxPrograms + GLint *numPrograms + + + void glExtGetRenderbuffersQCOM + GLuint *renderbuffers + GLint maxRenderbuffers + GLint *numRenderbuffers + + + void glExtGetShadersQCOM + GLuint *shaders + GLint maxShaders + GLint *numShaders + + + void glExtGetTexLevelParameterivQCOM + GLuint texture + GLenum face + GLint level + GLenum pname + GLint *params + + + void glExtGetTexSubImageQCOM + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + void *texels + + + void glExtGetTexturesQCOM + GLuint *textures + GLint maxTextures + GLint *numTextures + + + GLboolean glExtIsProgramBinaryQCOM + GLuint program + + + void glExtTexObjectStateOverrideiQCOM + GLenum target + GLenum pname + GLint param + + + void glExtractComponentEXT + GLuint res + GLuint src + GLuint num + + + void glFeedbackBuffer + GLsizei size + GLenum type + GLfloat *buffer + + + + void glFeedbackBufferxOES + GLsizei n + GLenum type + const GLfixed *buffer + + + GLsync glFenceSync + GLenum condition + GLbitfield flags + + + GLsync glFenceSyncAPPLE + GLenum condition + GLbitfield flags + + + + void glFinalCombinerInputNV + GLenum variable + GLenum input + GLenum mapping + GLenum componentUsage + + + + void glFinish + + + + GLint glFinishAsyncSGIX + GLuint *markerp + + + void glFinishFenceAPPLE + GLuint fence + + + void glFinishFenceNV + GLuint fence + + + + void glFinishObjectAPPLE + GLenum object + GLint name + + + void glFinishTextureSUNX + + + void glFlush + + + + void glFlushMappedBufferRange + GLenum target + GLintptr offset + GLsizeiptr length + + + void glFlushMappedBufferRangeAPPLE + GLenum target + GLintptr offset + GLsizeiptr size + + + + void glFlushMappedBufferRangeEXT + GLenum target + GLintptr offset + GLsizeiptr length + + + + void glFlushMappedNamedBufferRange + GLuint buffer + GLintptr offset + GLsizeiptr length + + + void glFlushMappedNamedBufferRangeEXT + GLuint buffer + GLintptr offset + GLsizeiptr length + + + void glFlushPixelDataRangeNV + GLenum target + + + void glFlushRasterSGIX + + + + void glFlushStaticDataIBM + GLenum target + + + void glFlushVertexArrayRangeAPPLE + GLsizei length + void *pointer + + + void glFlushVertexArrayRangeNV + + + void glFogCoordFormatNV + GLenum type + GLsizei stride + + + void glFogCoordPointer + GLenum type + GLsizei stride + const void *pointer + + + void glFogCoordPointerEXT + GLenum type + GLsizei stride + const void *pointer + + + + void glFogCoordPointerListIBM + GLenum type + GLint stride + const void **pointer + GLint ptrstride + + + void glFogCoordd + GLdouble coord + + + + void glFogCoorddEXT + GLdouble coord + + + + + void glFogCoorddv + const GLdouble *coord + + + + void glFogCoorddvEXT + const GLdouble *coord + + + + + void glFogCoordf + GLfloat coord + + + + void glFogCoordfEXT + GLfloat coord + + + + + void glFogCoordfv + const GLfloat *coord + + + + void glFogCoordfvEXT + const GLfloat *coord + + + + + void glFogCoordhNV + GLhalfNV fog + + + + void glFogCoordhvNV + const GLhalfNV *fog + + + + void glFogFuncSGIS + GLsizei n + const GLfloat *points + + + + void glFogf + GLenum pname + GLfloat param + + + + void glFogfv + GLenum pname + const GLfloat *params + + + + void glFogi + GLenum pname + GLint param + + + + void glFogiv + GLenum pname + const GLint *params + + + + void glFogx + GLenum pname + GLfixed param + + + void glFogxOES + GLenum pname + GLfixed param + + + void glFogxv + GLenum pname + const GLfixed *param + + + void glFogxvOES + GLenum pname + const GLfixed *param + + + void glFragmentColorMaterialSGIX + GLenum face + GLenum mode + + + void glFragmentCoverageColorNV + GLuint color + + + void glFragmentLightModelfSGIX + GLenum pname + GLfloat param + + + void glFragmentLightModelfvSGIX + GLenum pname + const GLfloat *params + + + void glFragmentLightModeliSGIX + GLenum pname + GLint param + + + void glFragmentLightModelivSGIX + GLenum pname + const GLint *params + + + void glFragmentLightfSGIX + GLenum light + GLenum pname + GLfloat param + + + void glFragmentLightfvSGIX + GLenum light + GLenum pname + const GLfloat *params + + + void glFragmentLightiSGIX + GLenum light + GLenum pname + GLint param + + + void glFragmentLightivSGIX + GLenum light + GLenum pname + const GLint *params + + + void glFragmentMaterialfSGIX + GLenum face + GLenum pname + GLfloat param + + + void glFragmentMaterialfvSGIX + GLenum face + GLenum pname + const GLfloat *params + + + void glFragmentMaterialiSGIX + GLenum face + GLenum pname + GLint param + + + void glFragmentMaterialivSGIX + GLenum face + GLenum pname + const GLint *params + + + void glFrameTerminatorGREMEDY + + + void glFrameZoomSGIX + GLint factor + + + + void glFramebufferDrawBufferEXT + GLuint framebuffer + GLenum mode + + + void glFramebufferDrawBuffersEXT + GLuint framebuffer + GLsizei n + const GLenum *bufs + + + void glFramebufferParameteri + GLenum target + GLenum pname + GLint param + + + void glFramebufferReadBufferEXT + GLuint framebuffer + GLenum mode + + + void glFramebufferRenderbuffer + GLenum target + GLenum attachment + GLenum renderbuffertarget + GLuint renderbuffer + + + + void glFramebufferRenderbufferEXT + GLenum target + GLenum attachment + GLenum renderbuffertarget + GLuint renderbuffer + + + + + void glFramebufferRenderbufferOES + GLenum target + GLenum attachment + GLenum renderbuffertarget + GLuint renderbuffer + + + void glFramebufferSampleLocationsfvARB + GLenum target + GLuint start + GLsizei count + const GLfloat *v + + + void glFramebufferSampleLocationsfvNV + GLenum target + GLuint start + GLsizei count + const GLfloat *v + + + void glFramebufferTexture + GLenum target + GLenum attachment + GLuint texture + GLint level + + + void glFramebufferTexture1D + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + + + + void glFramebufferTexture1DEXT + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + + + + + void glFramebufferTexture2D + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + + + + void glFramebufferTexture2DEXT + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + + + + + void glFramebufferTexture2DMultisampleEXT + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + GLsizei samples + + + void glFramebufferTexture2DMultisampleIMG + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + GLsizei samples + + + void glFramebufferTexture2DOES + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + + + void glFramebufferTexture3D + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + GLint zoffset + + + + void glFramebufferTexture3DEXT + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + GLint zoffset + + + + + void glFramebufferTexture3DOES + GLenum target + GLenum attachment + GLenum textarget + GLuint texture + GLint level + GLint zoffset + + + + void glFramebufferTextureARB + GLenum target + GLenum attachment + GLuint texture + GLint level + + + + void glFramebufferTextureEXT + GLenum target + GLenum attachment + GLuint texture + GLint level + + + + void glFramebufferTextureFaceARB + GLenum target + GLenum attachment + GLuint texture + GLint level + GLenum face + + + void glFramebufferTextureFaceEXT + GLenum target + GLenum attachment + GLuint texture + GLint level + GLenum face + + + + void glFramebufferTextureLayer + GLenum target + GLenum attachment + GLuint texture + GLint level + GLint layer + + + + void glFramebufferTextureLayerARB + GLenum target + GLenum attachment + GLuint texture + GLint level + GLint layer + + + + void glFramebufferTextureLayerEXT + GLenum target + GLenum attachment + GLuint texture + GLint level + GLint layer + + + + void glFramebufferTextureMultiviewOVR + GLenum target + GLenum attachment + GLuint texture + GLint level + GLint baseViewIndex + GLsizei numViews + + + void glFramebufferTextureOES + GLenum target + GLenum attachment + GLuint texture + GLint level + + + + void glFreeObjectBufferATI + GLuint buffer + + + void glFrontFace + GLenum mode + + + + void glFrustum + GLdouble left + GLdouble right + GLdouble bottom + GLdouble top + GLdouble zNear + GLdouble zFar + + + + void glFrustumf + GLfloat l + GLfloat r + GLfloat b + GLfloat t + GLfloat n + GLfloat f + + + void glFrustumfOES + GLfloat l + GLfloat r + GLfloat b + GLfloat t + GLfloat n + GLfloat f + + + + void glFrustumx + GLfixed l + GLfixed r + GLfixed b + GLfixed t + GLfixed n + GLfixed f + + + void glFrustumxOES + GLfixed l + GLfixed r + GLfixed b + GLfixed t + GLfixed n + GLfixed f + + + GLuint glGenAsyncMarkersSGIX + GLsizei range + + + void glGenBuffers + GLsizei n + GLuint *buffers + + + void glGenBuffersARB + GLsizei n + GLuint *buffers + + + + void glGenFencesAPPLE + GLsizei n + GLuint *fences + + + void glGenFencesNV + GLsizei n + GLuint *fences + + + + GLuint glGenFragmentShadersATI + GLuint range + + + void glGenFramebuffers + GLsizei n + GLuint *framebuffers + + + + void glGenFramebuffersEXT + GLsizei n + GLuint *framebuffers + + + + + void glGenFramebuffersOES + GLsizei n + GLuint *framebuffers + + + GLuint glGenLists + GLsizei range + + + + void glGenNamesAMD + GLenum identifier + GLuint num + GLuint *names + + + void glGenOcclusionQueriesNV + GLsizei n + GLuint *ids + + + GLuint glGenPathsNV + GLsizei range + + + void glGenPerfMonitorsAMD + GLsizei n + GLuint *monitors + + + void glGenProgramPipelines + GLsizei n + GLuint *pipelines + + + void glGenProgramPipelinesEXT + GLsizei n + GLuint *pipelines + + + void glGenProgramsARB + GLsizei n + GLuint *programs + + + + void glGenProgramsNV + GLsizei n + GLuint *programs + + + + + void glGenQueries + GLsizei n + GLuint *ids + + + + void glGenQueriesARB + GLsizei n + GLuint *ids + + + + void glGenQueriesEXT + GLsizei n + GLuint *ids + + + void glGenRenderbuffers + GLsizei n + GLuint *renderbuffers + + + + void glGenRenderbuffersEXT + GLsizei n + GLuint *renderbuffers + + + + + void glGenRenderbuffersOES + GLsizei n + GLuint *renderbuffers + + + void glGenSamplers + GLsizei count + GLuint *samplers + + + GLuint glGenSymbolsEXT + GLenum datatype + GLenum storagetype + GLenum range + GLuint components + + + void glGenTextures + GLsizei n + GLuint *textures + + + + void glGenTexturesEXT + GLsizei n + GLuint *textures + + + + void glGenTransformFeedbacks + GLsizei n + GLuint *ids + + + void glGenTransformFeedbacksNV + GLsizei n + GLuint *ids + + + + void glGenVertexArrays + GLsizei n + GLuint *arrays + + + + void glGenVertexArraysAPPLE + GLsizei n + GLuint *arrays + + + + void glGenVertexArraysOES + GLsizei n + GLuint *arrays + + + + GLuint glGenVertexShadersEXT + GLuint range + + + void glGenerateMipmap + GLenum target + + + + void glGenerateMipmapEXT + GLenum target + + + + + void glGenerateMipmapOES + GLenum target + + + void glGenerateMultiTexMipmapEXT + GLenum texunit + GLenum target + + + void glGenerateTextureMipmap + GLuint texture + + + void glGenerateTextureMipmapEXT + GLuint texture + GLenum target + + + void glGetActiveAtomicCounterBufferiv + GLuint program + GLuint bufferIndex + GLenum pname + GLint *params + + + void glGetActiveAttrib + GLuint program + GLuint index + GLsizei bufSize + GLsizei *length + GLint *size + GLenum *type + GLchar *name + + + void glGetActiveAttribARB + GLhandleARB programObj + GLuint index + GLsizei maxLength + GLsizei *length + GLint *size + GLenum *type + GLcharARB *name + + + + void glGetActiveSubroutineName + GLuint program + GLenum shadertype + GLuint index + GLsizei bufsize + GLsizei *length + GLchar *name + + + void glGetActiveSubroutineUniformName + GLuint program + GLenum shadertype + GLuint index + GLsizei bufsize + GLsizei *length + GLchar *name + + + void glGetActiveSubroutineUniformiv + GLuint program + GLenum shadertype + GLuint index + GLenum pname + GLint *values + + + void glGetActiveUniform + GLuint program + GLuint index + GLsizei bufSize + GLsizei *length + GLint *size + GLenum *type + GLchar *name + + + void glGetActiveUniformARB + GLhandleARB programObj + GLuint index + GLsizei maxLength + GLsizei *length + GLint *size + GLenum *type + GLcharARB *name + + + + void glGetActiveUniformBlockName + GLuint program + GLuint uniformBlockIndex + GLsizei bufSize + GLsizei *length + GLchar *uniformBlockName + + + void glGetActiveUniformBlockiv + GLuint program + GLuint uniformBlockIndex + GLenum pname + GLint *params + + + void glGetActiveUniformName + GLuint program + GLuint uniformIndex + GLsizei bufSize + GLsizei *length + GLchar *uniformName + + + void glGetActiveUniformsiv + GLuint program + GLsizei uniformCount + const GLuint *uniformIndices + GLenum pname + GLint *params + + + void glGetActiveVaryingNV + GLuint program + GLuint index + GLsizei bufSize + GLsizei *length + GLsizei *size + GLenum *type + GLchar *name + + + void glGetArrayObjectfvATI + GLenum array + GLenum pname + GLfloat *params + + + void glGetArrayObjectivATI + GLenum array + GLenum pname + GLint *params + + + void glGetAttachedObjectsARB + GLhandleARB containerObj + GLsizei maxCount + GLsizei *count + GLhandleARB *obj + + + void glGetAttachedShaders + GLuint program + GLsizei maxCount + GLsizei *count + GLuint *shaders + + + GLint glGetAttribLocation + GLuint program + const GLchar *name + + + GLint glGetAttribLocationARB + GLhandleARB programObj + const GLcharARB *name + + + + void glGetBooleanIndexedvEXT + GLenum target + GLuint index + GLboolean *data + + + + void glGetBooleani_v + GLenum target + GLuint index + GLboolean *data + + + void glGetBooleanv + GLenum pname + GLboolean *data + + + + void glGetBufferParameteri64v + GLenum target + GLenum pname + GLint64 *params + + + void glGetBufferParameteriv + GLenum target + GLenum pname + GLint *params + + + void glGetBufferParameterivARB + GLenum target + GLenum pname + GLint *params + + + + void glGetBufferParameterui64vNV + GLenum target + GLenum pname + GLuint64EXT *params + + + void glGetBufferPointerv + GLenum target + GLenum pname + void **params + + + void glGetBufferPointervARB + GLenum target + GLenum pname + void **params + + + + void glGetBufferPointervOES + GLenum target + GLenum pname + void **params + + + + void glGetBufferSubData + GLenum target + GLintptr offset + GLsizeiptr size + void *data + + + void glGetBufferSubDataARB + GLenum target + GLintptrARB offset + GLsizeiptrARB size + void *data + + + + void glGetClipPlane + GLenum plane + GLdouble *equation + + + + void glGetClipPlanef + GLenum plane + GLfloat *equation + + + void glGetClipPlanefOES + GLenum plane + GLfloat *equation + + + + void glGetClipPlanex + GLenum plane + GLfixed *equation + + + void glGetClipPlanexOES + GLenum plane + GLfixed *equation + + + void glGetColorTable + GLenum target + GLenum format + GLenum type + void *table + + + + + void glGetColorTableEXT + GLenum target + GLenum format + GLenum type + void *data + + + + void glGetColorTableParameterfv + GLenum target + GLenum pname + GLfloat *params + + + + void glGetColorTableParameterfvEXT + GLenum target + GLenum pname + GLfloat *params + + + + void glGetColorTableParameterfvSGI + GLenum target + GLenum pname + GLfloat *params + + + + void glGetColorTableParameteriv + GLenum target + GLenum pname + GLint *params + + + + void glGetColorTableParameterivEXT + GLenum target + GLenum pname + GLint *params + + + + void glGetColorTableParameterivSGI + GLenum target + GLenum pname + GLint *params + + + + void glGetColorTableSGI + GLenum target + GLenum format + GLenum type + void *table + + + + void glGetCombinerInputParameterfvNV + GLenum stage + GLenum portion + GLenum variable + GLenum pname + GLfloat *params + + + + void glGetCombinerInputParameterivNV + GLenum stage + GLenum portion + GLenum variable + GLenum pname + GLint *params + + + + void glGetCombinerOutputParameterfvNV + GLenum stage + GLenum portion + GLenum pname + GLfloat *params + + + + void glGetCombinerOutputParameterivNV + GLenum stage + GLenum portion + GLenum pname + GLint *params + + + + void glGetCombinerStageParameterfvNV + GLenum stage + GLenum pname + GLfloat *params + + + GLuint glGetCommandHeaderNV + GLenum tokenID + GLuint size + + + void glGetCompressedMultiTexImageEXT + GLenum texunit + GLenum target + GLint lod + void *img + + + void glGetCompressedTexImage + GLenum target + GLint level + void *img + + + + + void glGetCompressedTexImageARB + GLenum target + GLint level + void *img + + + + + void glGetCompressedTextureImage + GLuint texture + GLint level + GLsizei bufSize + void *pixels + + + void glGetCompressedTextureImageEXT + GLuint texture + GLenum target + GLint lod + void *img + + + void glGetCompressedTextureSubImage + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLsizei bufSize + void *pixels + + + void glGetConvolutionFilter + GLenum target + GLenum format + GLenum type + void *image + + + + + void glGetConvolutionFilterEXT + GLenum target + GLenum format + GLenum type + void *image + + + + void glGetConvolutionParameterfv + GLenum target + GLenum pname + GLfloat *params + + + + void glGetConvolutionParameterfvEXT + GLenum target + GLenum pname + GLfloat *params + + + + void glGetConvolutionParameteriv + GLenum target + GLenum pname + GLint *params + + + + void glGetConvolutionParameterivEXT + GLenum target + GLenum pname + GLint *params + + + + void glGetConvolutionParameterxvOES + GLenum target + GLenum pname + GLfixed *params + + + void glGetCoverageModulationTableNV + GLsizei bufsize + GLfloat *v + + + GLuint glGetDebugMessageLog + GLuint count + GLsizei bufSize + GLenum *sources + GLenum *types + GLuint *ids + GLenum *severities + GLsizei *lengths + GLchar *messageLog + + + GLuint glGetDebugMessageLogAMD + GLuint count + GLsizei bufsize + GLenum *categories + GLuint *severities + GLuint *ids + GLsizei *lengths + GLchar *message + + + GLuint glGetDebugMessageLogARB + GLuint count + GLsizei bufSize + GLenum *sources + GLenum *types + GLuint *ids + GLenum *severities + GLsizei *lengths + GLchar *messageLog + + + + GLuint glGetDebugMessageLogKHR + GLuint count + GLsizei bufSize + GLenum *sources + GLenum *types + GLuint *ids + GLenum *severities + GLsizei *lengths + GLchar *messageLog + + + + void glGetDetailTexFuncSGIS + GLenum target + GLfloat *points + + + + void glGetDoubleIndexedvEXT + GLenum target + GLuint index + GLdouble *data + + + + void glGetDoublei_v + GLenum target + GLuint index + GLdouble *data + + + void glGetDoublei_vEXT + GLenum pname + GLuint index + GLdouble *params + + + + void glGetDoublev + GLenum pname + GLdouble *data + + + + void glGetDriverControlStringQCOM + GLuint driverControl + GLsizei bufSize + GLsizei *length + GLchar *driverControlString + + + void glGetDriverControlsQCOM + GLint *num + GLsizei size + GLuint *driverControls + + + GLenum glGetError + + + + void glGetFenceivNV + GLuint fence + GLenum pname + GLint *params + + + + void glGetFinalCombinerInputParameterfvNV + GLenum variable + GLenum pname + GLfloat *params + + + + void glGetFinalCombinerInputParameterivNV + GLenum variable + GLenum pname + GLint *params + + + + void glGetFirstPerfQueryIdINTEL + GLuint *queryId + + + void glGetFixedv + GLenum pname + GLfixed *params + + + void glGetFixedvOES + GLenum pname + GLfixed *params + + + void glGetFloatIndexedvEXT + GLenum target + GLuint index + GLfloat *data + + + + void glGetFloati_v + GLenum target + GLuint index + GLfloat *data + + + void glGetFloati_vEXT + GLenum pname + GLuint index + GLfloat *params + + + + void glGetFloati_vNV + GLenum target + GLuint index + GLfloat *data + + + + void glGetFloatv + GLenum pname + GLfloat *data + + + + void glGetFogFuncSGIS + GLfloat *points + + + GLint glGetFragDataIndex + GLuint program + const GLchar *name + + + GLint glGetFragDataLocation + GLuint program + const GLchar *name + + + GLint glGetFragDataLocationEXT + GLuint program + const GLchar *name + + + + void glGetFragmentLightfvSGIX + GLenum light + GLenum pname + GLfloat *params + + + void glGetFragmentLightivSGIX + GLenum light + GLenum pname + GLint *params + + + void glGetFragmentMaterialfvSGIX + GLenum face + GLenum pname + GLfloat *params + + + void glGetFragmentMaterialivSGIX + GLenum face + GLenum pname + GLint *params + + + void glGetFramebufferAttachmentParameteriv + GLenum target + GLenum attachment + GLenum pname + GLint *params + + + + void glGetFramebufferAttachmentParameterivEXT + GLenum target + GLenum attachment + GLenum pname + GLint *params + + + + + void glGetFramebufferAttachmentParameterivOES + GLenum target + GLenum attachment + GLenum pname + GLint *params + + + void glGetFramebufferParameteriv + GLenum target + GLenum pname + GLint *params + + + void glGetFramebufferParameterivEXT + GLuint framebuffer + GLenum pname + GLint *params + + + GLenum glGetGraphicsResetStatus + + + GLenum glGetGraphicsResetStatusARB + + + GLenum glGetGraphicsResetStatusEXT + + + GLenum glGetGraphicsResetStatusKHR + + + + GLhandleARB glGetHandleARB + GLenum pname + + + void glGetHistogram + GLenum target + GLboolean reset + GLenum format + GLenum type + void *values + + + + + void glGetHistogramEXT + GLenum target + GLboolean reset + GLenum format + GLenum type + void *values + + + + void glGetHistogramParameterfv + GLenum target + GLenum pname + GLfloat *params + + + + void glGetHistogramParameterfvEXT + GLenum target + GLenum pname + GLfloat *params + + + + void glGetHistogramParameteriv + GLenum target + GLenum pname + GLint *params + + + + void glGetHistogramParameterivEXT + GLenum target + GLenum pname + GLint *params + + + + void glGetHistogramParameterxvOES + GLenum target + GLenum pname + GLfixed *params + + + GLuint64 glGetImageHandleARB + GLuint texture + GLint level + GLboolean layered + GLint layer + GLenum format + + + GLuint64 glGetImageHandleNV + GLuint texture + GLint level + GLboolean layered + GLint layer + GLenum format + + + void glGetImageTransformParameterfvHP + GLenum target + GLenum pname + GLfloat *params + + + void glGetImageTransformParameterivHP + GLenum target + GLenum pname + GLint *params + + + void glGetInfoLogARB + GLhandleARB obj + GLsizei maxLength + GLsizei *length + GLcharARB *infoLog + + + GLint glGetInstrumentsSGIX + + + + void glGetInteger64i_v + GLenum target + GLuint index + GLint64 *data + + + void glGetInteger64v + GLenum pname + GLint64 *data + + + void glGetInteger64vAPPLE + GLenum pname + GLint64 *params + + + + void glGetIntegerIndexedvEXT + GLenum target + GLuint index + GLint *data + + + + void glGetIntegeri_v + GLenum target + GLuint index + GLint *data + + + void glGetIntegeri_vEXT + GLenum target + GLuint index + GLint *data + + + void glGetIntegerui64i_vNV + GLenum value + GLuint index + GLuint64EXT *result + + + void glGetIntegerui64vNV + GLenum value + GLuint64EXT *result + + + void glGetIntegerv + GLenum pname + GLint *data + + + + void glGetInternalformatSampleivNV + GLenum target + GLenum internalformat + GLsizei samples + GLenum pname + GLsizei bufSize + GLint *params + + + void glGetInternalformati64v + GLenum target + GLenum internalformat + GLenum pname + GLsizei bufSize + GLint64 *params + + + void glGetInternalformativ + GLenum target + GLenum internalformat + GLenum pname + GLsizei bufSize + GLint *params + + + void glGetInvariantBooleanvEXT + GLuint id + GLenum value + GLboolean *data + + + void glGetInvariantFloatvEXT + GLuint id + GLenum value + GLfloat *data + + + void glGetInvariantIntegervEXT + GLuint id + GLenum value + GLint *data + + + void glGetLightfv + GLenum light + GLenum pname + GLfloat *params + + + + void glGetLightiv + GLenum light + GLenum pname + GLint *params + + + + void glGetLightxOES + GLenum light + GLenum pname + GLfixed *params + + + void glGetLightxv + GLenum light + GLenum pname + GLfixed *params + + + void glGetLightxvOES + GLenum light + GLenum pname + GLfixed *params + + + void glGetListParameterfvSGIX + GLuint list + GLenum pname + GLfloat *params + + + void glGetListParameterivSGIX + GLuint list + GLenum pname + GLint *params + + + void glGetLocalConstantBooleanvEXT + GLuint id + GLenum value + GLboolean *data + + + void glGetLocalConstantFloatvEXT + GLuint id + GLenum value + GLfloat *data + + + void glGetLocalConstantIntegervEXT + GLuint id + GLenum value + GLint *data + + + void glGetMapAttribParameterfvNV + GLenum target + GLuint index + GLenum pname + GLfloat *params + + + void glGetMapAttribParameterivNV + GLenum target + GLuint index + GLenum pname + GLint *params + + + void glGetMapControlPointsNV + GLenum target + GLuint index + GLenum type + GLsizei ustride + GLsizei vstride + GLboolean packed + void *points + + + void glGetMapParameterfvNV + GLenum target + GLenum pname + GLfloat *params + + + void glGetMapParameterivNV + GLenum target + GLenum pname + GLint *params + + + void glGetMapdv + GLenum target + GLenum query + GLdouble *v + + + + void glGetMapfv + GLenum target + GLenum query + GLfloat *v + + + + void glGetMapiv + GLenum target + GLenum query + GLint *v + + + + void glGetMapxvOES + GLenum target + GLenum query + GLfixed *v + + + void glGetMaterialfv + GLenum face + GLenum pname + GLfloat *params + + + + void glGetMaterialiv + GLenum face + GLenum pname + GLint *params + + + + void glGetMaterialxOES + GLenum face + GLenum pname + GLfixed param + + + void glGetMaterialxv + GLenum face + GLenum pname + GLfixed *params + + + void glGetMaterialxvOES + GLenum face + GLenum pname + GLfixed *params + + + void glGetMinmax + GLenum target + GLboolean reset + GLenum format + GLenum type + void *values + + + + + void glGetMinmaxEXT + GLenum target + GLboolean reset + GLenum format + GLenum type + void *values + + + + void glGetMinmaxParameterfv + GLenum target + GLenum pname + GLfloat *params + + + + void glGetMinmaxParameterfvEXT + GLenum target + GLenum pname + GLfloat *params + + + + void glGetMinmaxParameteriv + GLenum target + GLenum pname + GLint *params + + + + void glGetMinmaxParameterivEXT + GLenum target + GLenum pname + GLint *params + + + + void glGetMultiTexEnvfvEXT + GLenum texunit + GLenum target + GLenum pname + GLfloat *params + + + void glGetMultiTexEnvivEXT + GLenum texunit + GLenum target + GLenum pname + GLint *params + + + void glGetMultiTexGendvEXT + GLenum texunit + GLenum coord + GLenum pname + GLdouble *params + + + void glGetMultiTexGenfvEXT + GLenum texunit + GLenum coord + GLenum pname + GLfloat *params + + + void glGetMultiTexGenivEXT + GLenum texunit + GLenum coord + GLenum pname + GLint *params + + + void glGetMultiTexImageEXT + GLenum texunit + GLenum target + GLint level + GLenum format + GLenum type + void *pixels + + + void glGetMultiTexLevelParameterfvEXT + GLenum texunit + GLenum target + GLint level + GLenum pname + GLfloat *params + + + void glGetMultiTexLevelParameterivEXT + GLenum texunit + GLenum target + GLint level + GLenum pname + GLint *params + + + void glGetMultiTexParameterIivEXT + GLenum texunit + GLenum target + GLenum pname + GLint *params + + + void glGetMultiTexParameterIuivEXT + GLenum texunit + GLenum target + GLenum pname + GLuint *params + + + void glGetMultiTexParameterfvEXT + GLenum texunit + GLenum target + GLenum pname + GLfloat *params + + + void glGetMultiTexParameterivEXT + GLenum texunit + GLenum target + GLenum pname + GLint *params + + + void glGetMultisamplefv + GLenum pname + GLuint index + GLfloat *val + + + void glGetMultisamplefvNV + GLenum pname + GLuint index + GLfloat *val + + + + void glGetNamedBufferParameteri64v + GLuint buffer + GLenum pname + GLint64 *params + + + void glGetNamedBufferParameteriv + GLuint buffer + GLenum pname + GLint *params + + + void glGetNamedBufferParameterivEXT + GLuint buffer + GLenum pname + GLint *params + + + void glGetNamedBufferParameterui64vNV + GLuint buffer + GLenum pname + GLuint64EXT *params + + + void glGetNamedBufferPointerv + GLuint buffer + GLenum pname + void **params + + + void glGetNamedBufferPointervEXT + GLuint buffer + GLenum pname + void **params + + + void glGetNamedBufferSubData + GLuint buffer + GLintptr offset + GLsizeiptr size + void *data + + + void glGetNamedBufferSubDataEXT + GLuint buffer + GLintptr offset + GLsizeiptr size + void *data + + + void glGetNamedFramebufferAttachmentParameteriv + GLuint framebuffer + GLenum attachment + GLenum pname + GLint *params + + + void glGetNamedFramebufferAttachmentParameterivEXT + GLuint framebuffer + GLenum attachment + GLenum pname + GLint *params + + + void glGetNamedFramebufferParameteriv + GLuint framebuffer + GLenum pname + GLint *param + + + void glGetNamedFramebufferParameterivEXT + GLuint framebuffer + GLenum pname + GLint *params + + + void glGetNamedProgramLocalParameterIivEXT + GLuint program + GLenum target + GLuint index + GLint *params + + + void glGetNamedProgramLocalParameterIuivEXT + GLuint program + GLenum target + GLuint index + GLuint *params + + + void glGetNamedProgramLocalParameterdvEXT + GLuint program + GLenum target + GLuint index + GLdouble *params + + + void glGetNamedProgramLocalParameterfvEXT + GLuint program + GLenum target + GLuint index + GLfloat *params + + + void glGetNamedProgramStringEXT + GLuint program + GLenum target + GLenum pname + void *string + + + void glGetNamedProgramivEXT + GLuint program + GLenum target + GLenum pname + GLint *params + + + void glGetNamedRenderbufferParameteriv + GLuint renderbuffer + GLenum pname + GLint *params + + + void glGetNamedRenderbufferParameterivEXT + GLuint renderbuffer + GLenum pname + GLint *params + + + void glGetNamedStringARB + GLint namelen + const GLchar *name + GLsizei bufSize + GLint *stringlen + GLchar *string + + + void glGetNamedStringivARB + GLint namelen + const GLchar *name + GLenum pname + GLint *params + + + void glGetNextPerfQueryIdINTEL + GLuint queryId + GLuint *nextQueryId + + + void glGetObjectBufferfvATI + GLuint buffer + GLenum pname + GLfloat *params + + + void glGetObjectBufferivATI + GLuint buffer + GLenum pname + GLint *params + + + void glGetObjectLabel + GLenum identifier + GLuint name + GLsizei bufSize + GLsizei *length + GLchar *label + + + void glGetObjectLabelEXT + GLenum type + GLuint object + GLsizei bufSize + GLsizei *length + GLchar *label + + + void glGetObjectLabelKHR + GLenum identifier + GLuint name + GLsizei bufSize + GLsizei *length + GLchar *label + + + + void glGetObjectParameterfvARB + GLhandleARB obj + GLenum pname + GLfloat *params + + + void glGetObjectParameterivAPPLE + GLenum objectType + GLuint name + GLenum pname + GLint *params + + + void glGetObjectParameterivARB + GLhandleARB obj + GLenum pname + GLint *params + + + void glGetObjectPtrLabel + const void *ptr + GLsizei bufSize + GLsizei *length + GLchar *label + + + void glGetObjectPtrLabelKHR + const void *ptr + GLsizei bufSize + GLsizei *length + GLchar *label + + + + void glGetOcclusionQueryivNV + GLuint id + GLenum pname + GLint *params + + + void glGetOcclusionQueryuivNV + GLuint id + GLenum pname + GLuint *params + + + void glGetPathColorGenfvNV + GLenum color + GLenum pname + GLfloat *value + + + void glGetPathColorGenivNV + GLenum color + GLenum pname + GLint *value + + + void glGetPathCommandsNV + GLuint path + GLubyte *commands + + + void glGetPathCoordsNV + GLuint path + GLfloat *coords + + + void glGetPathDashArrayNV + GLuint path + GLfloat *dashArray + + + GLfloat glGetPathLengthNV + GLuint path + GLsizei startSegment + GLsizei numSegments + + + void glGetPathMetricRangeNV + GLbitfield metricQueryMask + GLuint firstPathName + GLsizei numPaths + GLsizei stride + GLfloat *metrics + + + void glGetPathMetricsNV + GLbitfield metricQueryMask + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLsizei stride + GLfloat *metrics + + + void glGetPathParameterfvNV + GLuint path + GLenum pname + GLfloat *value + + + void glGetPathParameterivNV + GLuint path + GLenum pname + GLint *value + + + void glGetPathSpacingNV + GLenum pathListMode + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLfloat advanceScale + GLfloat kerningScale + GLenum transformType + GLfloat *returnedSpacing + + + void glGetPathTexGenfvNV + GLenum texCoordSet + GLenum pname + GLfloat *value + + + void glGetPathTexGenivNV + GLenum texCoordSet + GLenum pname + GLint *value + + + void glGetPerfCounterInfoINTEL + GLuint queryId + GLuint counterId + GLuint counterNameLength + GLchar *counterName + GLuint counterDescLength + GLchar *counterDesc + GLuint *counterOffset + GLuint *counterDataSize + GLuint *counterTypeEnum + GLuint *counterDataTypeEnum + GLuint64 *rawCounterMaxValue + + + void glGetPerfMonitorCounterDataAMD + GLuint monitor + GLenum pname + GLsizei dataSize + GLuint *data + GLint *bytesWritten + + + void glGetPerfMonitorCounterInfoAMD + GLuint group + GLuint counter + GLenum pname + void *data + + + void glGetPerfMonitorCounterStringAMD + GLuint group + GLuint counter + GLsizei bufSize + GLsizei *length + GLchar *counterString + + + void glGetPerfMonitorCountersAMD + GLuint group + GLint *numCounters + GLint *maxActiveCounters + GLsizei counterSize + GLuint *counters + + + void glGetPerfMonitorGroupStringAMD + GLuint group + GLsizei bufSize + GLsizei *length + GLchar *groupString + + + void glGetPerfMonitorGroupsAMD + GLint *numGroups + GLsizei groupsSize + GLuint *groups + + + void glGetPerfQueryDataINTEL + GLuint queryHandle + GLuint flags + GLsizei dataSize + GLvoid *data + GLuint *bytesWritten + + + void glGetPerfQueryIdByNameINTEL + GLchar *queryName + GLuint *queryId + + + void glGetPerfQueryInfoINTEL + GLuint queryId + GLuint queryNameLength + GLchar *queryName + GLuint *dataSize + GLuint *noCounters + GLuint *noInstances + GLuint *capsMask + + + void glGetPixelMapfv + GLenum map + GLfloat *values + + + + + void glGetPixelMapuiv + GLenum map + GLuint *values + + + + + void glGetPixelMapusv + GLenum map + GLushort *values + + + + + void glGetPixelMapxv + GLenum map + GLint size + GLfixed *values + + + void glGetPixelTexGenParameterfvSGIS + GLenum pname + GLfloat *params + + + void glGetPixelTexGenParameterivSGIS + GLenum pname + GLint *params + + + void glGetPixelTransformParameterfvEXT + GLenum target + GLenum pname + GLfloat *params + + + + void glGetPixelTransformParameterivEXT + GLenum target + GLenum pname + GLint *params + + + + void glGetPointerIndexedvEXT + GLenum target + GLuint index + void **data + + + void glGetPointeri_vEXT + GLenum pname + GLuint index + void **params + + + void glGetPointerv + GLenum pname + void **params + + + + void glGetPointervEXT + GLenum pname + void **params + + + + void glGetPointervKHR + GLenum pname + void **params + + + + void glGetPolygonStipple + GLubyte *mask + + + + + void glGetProgramBinary + GLuint program + GLsizei bufSize + GLsizei *length + GLenum *binaryFormat + void *binary + + + void glGetProgramBinaryOES + GLuint program + GLsizei bufSize + GLsizei *length + GLenum *binaryFormat + void *binary + + + + void glGetProgramEnvParameterIivNV + GLenum target + GLuint index + GLint *params + + + void glGetProgramEnvParameterIuivNV + GLenum target + GLuint index + GLuint *params + + + void glGetProgramEnvParameterdvARB + GLenum target + GLuint index + GLdouble *params + + + void glGetProgramEnvParameterfvARB + GLenum target + GLuint index + GLfloat *params + + + void glGetProgramInfoLog + GLuint program + GLsizei bufSize + GLsizei *length + GLchar *infoLog + + + + void glGetProgramInterfaceiv + GLuint program + GLenum programInterface + GLenum pname + GLint *params + + + void glGetProgramLocalParameterIivNV + GLenum target + GLuint index + GLint *params + + + void glGetProgramLocalParameterIuivNV + GLenum target + GLuint index + GLuint *params + + + void glGetProgramLocalParameterdvARB + GLenum target + GLuint index + GLdouble *params + + + void glGetProgramLocalParameterfvARB + GLenum target + GLuint index + GLfloat *params + + + void glGetProgramNamedParameterdvNV + GLuint id + GLsizei len + const GLubyte *name + GLdouble *params + + + + void glGetProgramNamedParameterfvNV + GLuint id + GLsizei len + const GLubyte *name + GLfloat *params + + + + void glGetProgramParameterdvNV + GLenum target + GLuint index + GLenum pname + GLdouble *params + + + + void glGetProgramParameterfvNV + GLenum target + GLuint index + GLenum pname + GLfloat *params + + + + void glGetProgramPipelineInfoLog + GLuint pipeline + GLsizei bufSize + GLsizei *length + GLchar *infoLog + + + void glGetProgramPipelineInfoLogEXT + GLuint pipeline + GLsizei bufSize + GLsizei *length + GLchar *infoLog + + + void glGetProgramPipelineiv + GLuint pipeline + GLenum pname + GLint *params + + + void glGetProgramPipelineivEXT + GLuint pipeline + GLenum pname + GLint *params + + + GLuint glGetProgramResourceIndex + GLuint program + GLenum programInterface + const GLchar *name + + + GLint glGetProgramResourceLocation + GLuint program + GLenum programInterface + const GLchar *name + + + GLint glGetProgramResourceLocationIndex + GLuint program + GLenum programInterface + const GLchar *name + + + void glGetProgramResourceName + GLuint program + GLenum programInterface + GLuint index + GLsizei bufSize + GLsizei *length + GLchar *name + + + void glGetProgramResourcefvNV + GLuint program + GLenum programInterface + GLuint index + GLsizei propCount + const GLenum *props + GLsizei bufSize + GLsizei *length + GLfloat *params + + + void glGetProgramResourceiv + GLuint program + GLenum programInterface + GLuint index + GLsizei propCount + const GLenum *props + GLsizei bufSize + GLsizei *length + GLint *params + + + void glGetProgramStageiv + GLuint program + GLenum shadertype + GLenum pname + GLint *values + + + void glGetProgramStringARB + GLenum target + GLenum pname + void *string + + + void glGetProgramStringNV + GLuint id + GLenum pname + GLubyte *program + + + + void glGetProgramSubroutineParameteruivNV + GLenum target + GLuint index + GLuint *param + + + void glGetProgramiv + GLuint program + GLenum pname + GLint *params + + + + void glGetProgramivARB + GLenum target + GLenum pname + GLint *params + + + void glGetProgramivNV + GLuint id + GLenum pname + GLint *params + + + + void glGetQueryBufferObjecti64v + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + + void glGetQueryBufferObjectiv + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + + void glGetQueryBufferObjectui64v + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + + void glGetQueryBufferObjectuiv + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + + void glGetQueryIndexediv + GLenum target + GLuint index + GLenum pname + GLint *params + + + void glGetQueryObjecti64v + GLuint id + GLenum pname + GLint64 *params + + + void glGetQueryObjecti64vEXT + GLuint id + GLenum pname + GLint64 *params + + + + + void glGetQueryObjectiv + GLuint id + GLenum pname + GLint *params + + + + void glGetQueryObjectivARB + GLuint id + GLenum pname + GLint *params + + + + void glGetQueryObjectivEXT + GLuint id + GLenum pname + GLint *params + + + + void glGetQueryObjectui64v + GLuint id + GLenum pname + GLuint64 *params + + + void glGetQueryObjectui64vEXT + GLuint id + GLenum pname + GLuint64 *params + + + + + void glGetQueryObjectuiv + GLuint id + GLenum pname + GLuint *params + + + + void glGetQueryObjectuivARB + GLuint id + GLenum pname + GLuint *params + + + + void glGetQueryObjectuivEXT + GLuint id + GLenum pname + GLuint *params + + + void glGetQueryiv + GLenum target + GLenum pname + GLint *params + + + + void glGetQueryivARB + GLenum target + GLenum pname + GLint *params + + + + void glGetQueryivEXT + GLenum target + GLenum pname + GLint *params + + + void glGetRenderbufferParameteriv + GLenum target + GLenum pname + GLint *params + + + + void glGetRenderbufferParameterivEXT + GLenum target + GLenum pname + GLint *params + + + + + void glGetRenderbufferParameterivOES + GLenum target + GLenum pname + GLint *params + + + void glGetSamplerParameterIiv + GLuint sampler + GLenum pname + GLint *params + + + void glGetSamplerParameterIivEXT + GLuint sampler + GLenum pname + GLint *params + + + + void glGetSamplerParameterIivOES + GLuint sampler + GLenum pname + GLint *params + + + + void glGetSamplerParameterIuiv + GLuint sampler + GLenum pname + GLuint *params + + + void glGetSamplerParameterIuivEXT + GLuint sampler + GLenum pname + GLuint *params + + + + void glGetSamplerParameterIuivOES + GLuint sampler + GLenum pname + GLuint *params + + + + void glGetSamplerParameterfv + GLuint sampler + GLenum pname + GLfloat *params + + + void glGetSamplerParameteriv + GLuint sampler + GLenum pname + GLint *params + + + void glGetSeparableFilter + GLenum target + GLenum format + GLenum type + void *row + void *column + void *span + + + + + void glGetSeparableFilterEXT + GLenum target + GLenum format + GLenum type + void *row + void *column + void *span + + + + void glGetShaderInfoLog + GLuint shader + GLsizei bufSize + GLsizei *length + GLchar *infoLog + + + + void glGetShaderPrecisionFormat + GLenum shadertype + GLenum precisiontype + GLint *range + GLint *precision + + + void glGetShaderSource + GLuint shader + GLsizei bufSize + GLsizei *length + GLchar *source + + + void glGetShaderSourceARB + GLhandleARB obj + GLsizei maxLength + GLsizei *length + GLcharARB *source + + + + void glGetShaderiv + GLuint shader + GLenum pname + GLint *params + + + + void glGetSharpenTexFuncSGIS + GLenum target + GLfloat *points + + + + GLushort glGetStageIndexNV + GLenum shadertype + + + const GLubyte *glGetString + GLenum name + + + + const GLubyte *glGetStringi + GLenum name + GLuint index + + + GLuint glGetSubroutineIndex + GLuint program + GLenum shadertype + const GLchar *name + + + GLint glGetSubroutineUniformLocation + GLuint program + GLenum shadertype + const GLchar *name + + + void glGetSynciv + GLsync sync + GLenum pname + GLsizei bufSize + GLsizei *length + GLint *values + + + void glGetSyncivAPPLE + GLsync sync + GLenum pname + GLsizei bufSize + GLsizei *length + GLint *values + + + + void glGetTexBumpParameterfvATI + GLenum pname + GLfloat *param + + + void glGetTexBumpParameterivATI + GLenum pname + GLint *param + + + void glGetTexEnvfv + GLenum target + GLenum pname + GLfloat *params + + + + void glGetTexEnviv + GLenum target + GLenum pname + GLint *params + + + + void glGetTexEnvxv + GLenum target + GLenum pname + GLfixed *params + + + void glGetTexEnvxvOES + GLenum target + GLenum pname + GLfixed *params + + + void glGetTexFilterFuncSGIS + GLenum target + GLenum filter + GLfloat *weights + + + + void glGetTexGendv + GLenum coord + GLenum pname + GLdouble *params + + + + void glGetTexGenfv + GLenum coord + GLenum pname + GLfloat *params + + + + void glGetTexGenfvOES + GLenum coord + GLenum pname + GLfloat *params + + + void glGetTexGeniv + GLenum coord + GLenum pname + GLint *params + + + + void glGetTexGenivOES + GLenum coord + GLenum pname + GLint *params + + + void glGetTexGenxvOES + GLenum coord + GLenum pname + GLfixed *params + + + void glGetTexImage + GLenum target + GLint level + GLenum format + GLenum type + void *pixels + + + + + void glGetTexLevelParameterfv + GLenum target + GLint level + GLenum pname + GLfloat *params + + + + void glGetTexLevelParameteriv + GLenum target + GLint level + GLenum pname + GLint *params + + + + void glGetTexLevelParameterxvOES + GLenum target + GLint level + GLenum pname + GLfixed *params + + + void glGetTexParameterIiv + GLenum target + GLenum pname + GLint *params + + + + void glGetTexParameterIivEXT + GLenum target + GLenum pname + GLint *params + + + + void glGetTexParameterIivOES + GLenum target + GLenum pname + GLint *params + + + + void glGetTexParameterIuiv + GLenum target + GLenum pname + GLuint *params + + + + void glGetTexParameterIuivEXT + GLenum target + GLenum pname + GLuint *params + + + + void glGetTexParameterIuivOES + GLenum target + GLenum pname + GLuint *params + + + + void glGetTexParameterPointervAPPLE + GLenum target + GLenum pname + void **params + + + void glGetTexParameterfv + GLenum target + GLenum pname + GLfloat *params + + + + void glGetTexParameteriv + GLenum target + GLenum pname + GLint *params + + + + void glGetTexParameterxv + GLenum target + GLenum pname + GLfixed *params + + + void glGetTexParameterxvOES + GLenum target + GLenum pname + GLfixed *params + + + GLuint64 glGetTextureHandleARB + GLuint texture + + + GLuint64 glGetTextureHandleNV + GLuint texture + + + void glGetTextureImage + GLuint texture + GLint level + GLenum format + GLenum type + GLsizei bufSize + void *pixels + + + void glGetTextureImageEXT + GLuint texture + GLenum target + GLint level + GLenum format + GLenum type + void *pixels + + + void glGetTextureLevelParameterfv + GLuint texture + GLint level + GLenum pname + GLfloat *params + + + void glGetTextureLevelParameterfvEXT + GLuint texture + GLenum target + GLint level + GLenum pname + GLfloat *params + + + void glGetTextureLevelParameteriv + GLuint texture + GLint level + GLenum pname + GLint *params + + + void glGetTextureLevelParameterivEXT + GLuint texture + GLenum target + GLint level + GLenum pname + GLint *params + + + void glGetTextureParameterIiv + GLuint texture + GLenum pname + GLint *params + + + void glGetTextureParameterIivEXT + GLuint texture + GLenum target + GLenum pname + GLint *params + + + void glGetTextureParameterIuiv + GLuint texture + GLenum pname + GLuint *params + + + void glGetTextureParameterIuivEXT + GLuint texture + GLenum target + GLenum pname + GLuint *params + + + void glGetTextureParameterfv + GLuint texture + GLenum pname + GLfloat *params + + + void glGetTextureParameterfvEXT + GLuint texture + GLenum target + GLenum pname + GLfloat *params + + + void glGetTextureParameteriv + GLuint texture + GLenum pname + GLint *params + + + void glGetTextureParameterivEXT + GLuint texture + GLenum target + GLenum pname + GLint *params + + + GLuint64 glGetTextureSamplerHandleARB + GLuint texture + GLuint sampler + + + GLuint64 glGetTextureSamplerHandleNV + GLuint texture + GLuint sampler + + + void glGetTextureSubImage + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + GLsizei bufSize + void *pixels + + + void glGetTrackMatrixivNV + GLenum target + GLuint address + GLenum pname + GLint *params + + + + void glGetTransformFeedbackVarying + GLuint program + GLuint index + GLsizei bufSize + GLsizei *length + GLsizei *size + GLenum *type + GLchar *name + + + void glGetTransformFeedbackVaryingEXT + GLuint program + GLuint index + GLsizei bufSize + GLsizei *length + GLsizei *size + GLenum *type + GLchar *name + + + + void glGetTransformFeedbackVaryingNV + GLuint program + GLuint index + GLint *location + + + void glGetTransformFeedbacki64_v + GLuint xfb + GLenum pname + GLuint index + GLint64 *param + + + void glGetTransformFeedbacki_v + GLuint xfb + GLenum pname + GLuint index + GLint *param + + + void glGetTransformFeedbackiv + GLuint xfb + GLenum pname + GLint *param + + + void glGetTranslatedShaderSourceANGLE + GLuint shader + GLsizei bufsize + GLsizei *length + GLchar *source + + + GLuint glGetUniformBlockIndex + GLuint program + const GLchar *uniformBlockName + + + GLint glGetUniformBufferSizeEXT + GLuint program + GLint location + + + void glGetUniformIndices + GLuint program + GLsizei uniformCount + const GLchar *const*uniformNames + GLuint *uniformIndices + + + GLint glGetUniformLocation + GLuint program + const GLchar *name + + + GLint glGetUniformLocationARB + GLhandleARB programObj + const GLcharARB *name + + + + GLintptr glGetUniformOffsetEXT + GLuint program + GLint location + + + void glGetUniformSubroutineuiv + GLenum shadertype + GLint location + GLuint *params + + + void glGetUniformdv + GLuint program + GLint location + GLdouble *params + + + void glGetUniformfv + GLuint program + GLint location + GLfloat *params + + + void glGetUniformfvARB + GLhandleARB programObj + GLint location + GLfloat *params + + + + void glGetUniformi64vARB + GLuint program + GLint location + GLint64 *params + + + void glGetUniformi64vNV + GLuint program + GLint location + GLint64EXT *params + + + void glGetUniformiv + GLuint program + GLint location + GLint *params + + + void glGetUniformivARB + GLhandleARB programObj + GLint location + GLint *params + + + + void glGetUniformui64vARB + GLuint program + GLint location + GLuint64 *params + + + void glGetUniformui64vNV + GLuint program + GLint location + GLuint64EXT *params + + + void glGetUniformuiv + GLuint program + GLint location + GLuint *params + + + void glGetUniformuivEXT + GLuint program + GLint location + GLuint *params + + + + void glGetVariantArrayObjectfvATI + GLuint id + GLenum pname + GLfloat *params + + + void glGetVariantArrayObjectivATI + GLuint id + GLenum pname + GLint *params + + + void glGetVariantBooleanvEXT + GLuint id + GLenum value + GLboolean *data + + + void glGetVariantFloatvEXT + GLuint id + GLenum value + GLfloat *data + + + void glGetVariantIntegervEXT + GLuint id + GLenum value + GLint *data + + + void glGetVariantPointervEXT + GLuint id + GLenum value + void **data + + + GLint glGetVaryingLocationNV + GLuint program + const GLchar *name + + + void glGetVertexArrayIndexed64iv + GLuint vaobj + GLuint index + GLenum pname + GLint64 *param + + + void glGetVertexArrayIndexediv + GLuint vaobj + GLuint index + GLenum pname + GLint *param + + + void glGetVertexArrayIntegeri_vEXT + GLuint vaobj + GLuint index + GLenum pname + GLint *param + + + void glGetVertexArrayIntegervEXT + GLuint vaobj + GLenum pname + GLint *param + + + void glGetVertexArrayPointeri_vEXT + GLuint vaobj + GLuint index + GLenum pname + void **param + + + void glGetVertexArrayPointervEXT + GLuint vaobj + GLenum pname + void **param + + + void glGetVertexArrayiv + GLuint vaobj + GLenum pname + GLint *param + + + void glGetVertexAttribArrayObjectfvATI + GLuint index + GLenum pname + GLfloat *params + + + void glGetVertexAttribArrayObjectivATI + GLuint index + GLenum pname + GLint *params + + + void glGetVertexAttribIiv + GLuint index + GLenum pname + GLint *params + + + void glGetVertexAttribIivEXT + GLuint index + GLenum pname + GLint *params + + + + void glGetVertexAttribIuiv + GLuint index + GLenum pname + GLuint *params + + + void glGetVertexAttribIuivEXT + GLuint index + GLenum pname + GLuint *params + + + + void glGetVertexAttribLdv + GLuint index + GLenum pname + GLdouble *params + + + void glGetVertexAttribLdvEXT + GLuint index + GLenum pname + GLdouble *params + + + + void glGetVertexAttribLi64vNV + GLuint index + GLenum pname + GLint64EXT *params + + + void glGetVertexAttribLui64vARB + GLuint index + GLenum pname + GLuint64EXT *params + + + void glGetVertexAttribLui64vNV + GLuint index + GLenum pname + GLuint64EXT *params + + + void glGetVertexAttribPointerv + GLuint index + GLenum pname + void **pointer + + + + void glGetVertexAttribPointervARB + GLuint index + GLenum pname + void **pointer + + + + void glGetVertexAttribPointervNV + GLuint index + GLenum pname + void **pointer + + + + void glGetVertexAttribdv + GLuint index + GLenum pname + GLdouble *params + + + + void glGetVertexAttribdvARB + GLuint index + GLenum pname + GLdouble *params + + + + + void glGetVertexAttribdvNV + GLuint index + GLenum pname + GLdouble *params + + + + + void glGetVertexAttribfv + GLuint index + GLenum pname + GLfloat *params + + + + void glGetVertexAttribfvARB + GLuint index + GLenum pname + GLfloat *params + + + + + void glGetVertexAttribfvNV + GLuint index + GLenum pname + GLfloat *params + + + + + void glGetVertexAttribiv + GLuint index + GLenum pname + GLint *params + + + + void glGetVertexAttribivARB + GLuint index + GLenum pname + GLint *params + + + + + void glGetVertexAttribivNV + GLuint index + GLenum pname + GLint *params + + + + + void glGetVideoCaptureStreamdvNV + GLuint video_capture_slot + GLuint stream + GLenum pname + GLdouble *params + + + void glGetVideoCaptureStreamfvNV + GLuint video_capture_slot + GLuint stream + GLenum pname + GLfloat *params + + + void glGetVideoCaptureStreamivNV + GLuint video_capture_slot + GLuint stream + GLenum pname + GLint *params + + + void glGetVideoCaptureivNV + GLuint video_capture_slot + GLenum pname + GLint *params + + + void glGetVideoi64vNV + GLuint video_slot + GLenum pname + GLint64EXT *params + + + void glGetVideoivNV + GLuint video_slot + GLenum pname + GLint *params + + + void glGetVideoui64vNV + GLuint video_slot + GLenum pname + GLuint64EXT *params + + + void glGetVideouivNV + GLuint video_slot + GLenum pname + GLuint *params + + + void glGetnColorTable + GLenum target + GLenum format + GLenum type + GLsizei bufSize + void *table + + + void glGetnColorTableARB + GLenum target + GLenum format + GLenum type + GLsizei bufSize + void *table + + + void glGetnCompressedTexImage + GLenum target + GLint lod + GLsizei bufSize + void *pixels + + + void glGetnCompressedTexImageARB + GLenum target + GLint lod + GLsizei bufSize + void *img + + + void glGetnConvolutionFilter + GLenum target + GLenum format + GLenum type + GLsizei bufSize + void *image + + + void glGetnConvolutionFilterARB + GLenum target + GLenum format + GLenum type + GLsizei bufSize + void *image + + + void glGetnHistogram + GLenum target + GLboolean reset + GLenum format + GLenum type + GLsizei bufSize + void *values + + + void glGetnHistogramARB + GLenum target + GLboolean reset + GLenum format + GLenum type + GLsizei bufSize + void *values + + + void glGetnMapdv + GLenum target + GLenum query + GLsizei bufSize + GLdouble *v + + + void glGetnMapdvARB + GLenum target + GLenum query + GLsizei bufSize + GLdouble *v + + + void glGetnMapfv + GLenum target + GLenum query + GLsizei bufSize + GLfloat *v + + + void glGetnMapfvARB + GLenum target + GLenum query + GLsizei bufSize + GLfloat *v + + + void glGetnMapiv + GLenum target + GLenum query + GLsizei bufSize + GLint *v + + + void glGetnMapivARB + GLenum target + GLenum query + GLsizei bufSize + GLint *v + + + void glGetnMinmax + GLenum target + GLboolean reset + GLenum format + GLenum type + GLsizei bufSize + void *values + + + void glGetnMinmaxARB + GLenum target + GLboolean reset + GLenum format + GLenum type + GLsizei bufSize + void *values + + + void glGetnPixelMapfv + GLenum map + GLsizei bufSize + GLfloat *values + + + void glGetnPixelMapfvARB + GLenum map + GLsizei bufSize + GLfloat *values + + + void glGetnPixelMapuiv + GLenum map + GLsizei bufSize + GLuint *values + + + void glGetnPixelMapuivARB + GLenum map + GLsizei bufSize + GLuint *values + + + void glGetnPixelMapusv + GLenum map + GLsizei bufSize + GLushort *values + + + void glGetnPixelMapusvARB + GLenum map + GLsizei bufSize + GLushort *values + + + void glGetnPolygonStipple + GLsizei bufSize + GLubyte *pattern + + + void glGetnPolygonStippleARB + GLsizei bufSize + GLubyte *pattern + + + void glGetnSeparableFilter + GLenum target + GLenum format + GLenum type + GLsizei rowBufSize + void *row + GLsizei columnBufSize + void *column + void *span + + + void glGetnSeparableFilterARB + GLenum target + GLenum format + GLenum type + GLsizei rowBufSize + void *row + GLsizei columnBufSize + void *column + void *span + + + void glGetnTexImage + GLenum target + GLint level + GLenum format + GLenum type + GLsizei bufSize + void *pixels + + + void glGetnTexImageARB + GLenum target + GLint level + GLenum format + GLenum type + GLsizei bufSize + void *img + + + void glGetnUniformdv + GLuint program + GLint location + GLsizei bufSize + GLdouble *params + + + void glGetnUniformdvARB + GLuint program + GLint location + GLsizei bufSize + GLdouble *params + + + void glGetnUniformfv + GLuint program + GLint location + GLsizei bufSize + GLfloat *params + + + void glGetnUniformfvARB + GLuint program + GLint location + GLsizei bufSize + GLfloat *params + + + void glGetnUniformfvEXT + GLuint program + GLint location + GLsizei bufSize + GLfloat *params + + + void glGetnUniformfvKHR + GLuint program + GLint location + GLsizei bufSize + GLfloat *params + + + + void glGetnUniformi64vARB + GLuint program + GLint location + GLsizei bufSize + GLint64 *params + + + void glGetnUniformiv + GLuint program + GLint location + GLsizei bufSize + GLint *params + + + void glGetnUniformivARB + GLuint program + GLint location + GLsizei bufSize + GLint *params + + + void glGetnUniformivEXT + GLuint program + GLint location + GLsizei bufSize + GLint *params + + + void glGetnUniformivKHR + GLuint program + GLint location + GLsizei bufSize + GLint *params + + + + void glGetnUniformui64vARB + GLuint program + GLint location + GLsizei bufSize + GLuint64 *params + + + void glGetnUniformuiv + GLuint program + GLint location + GLsizei bufSize + GLuint *params + + + void glGetnUniformuivARB + GLuint program + GLint location + GLsizei bufSize + GLuint *params + + + void glGetnUniformuivKHR + GLuint program + GLint location + GLsizei bufSize + GLuint *params + + + + void glGlobalAlphaFactorbSUN + GLbyte factor + + + void glGlobalAlphaFactordSUN + GLdouble factor + + + void glGlobalAlphaFactorfSUN + GLfloat factor + + + void glGlobalAlphaFactoriSUN + GLint factor + + + void glGlobalAlphaFactorsSUN + GLshort factor + + + void glGlobalAlphaFactorubSUN + GLubyte factor + + + void glGlobalAlphaFactoruiSUN + GLuint factor + + + void glGlobalAlphaFactorusSUN + GLushort factor + + + void glHint + GLenum target + GLenum mode + + + + void glHintPGI + GLenum target + GLint mode + + + void glHistogram + GLenum target + GLsizei width + GLenum internalformat + GLboolean sink + + + + void glHistogramEXT + GLenum target + GLsizei width + GLenum internalformat + GLboolean sink + + + + + void glIglooInterfaceSGIX + GLenum pname + const void *params + + + + void glImageTransformParameterfHP + GLenum target + GLenum pname + GLfloat param + + + void glImageTransformParameterfvHP + GLenum target + GLenum pname + const GLfloat *params + + + void glImageTransformParameteriHP + GLenum target + GLenum pname + GLint param + + + void glImageTransformParameterivHP + GLenum target + GLenum pname + const GLint *params + + + GLsync glImportSyncEXT + GLenum external_sync_type + GLintptr external_sync + GLbitfield flags + + + void glIndexFormatNV + GLenum type + GLsizei stride + + + void glIndexFuncEXT + GLenum func + GLclampf ref + + + void glIndexMask + GLuint mask + + + + void glIndexMaterialEXT + GLenum face + GLenum mode + + + void glIndexPointer + GLenum type + GLsizei stride + const void *pointer + + + void glIndexPointerEXT + GLenum type + GLsizei stride + GLsizei count + const void *pointer + + + void glIndexPointerListIBM + GLenum type + GLint stride + const void **pointer + GLint ptrstride + + + void glIndexd + GLdouble c + + + + void glIndexdv + const GLdouble *c + + + + void glIndexf + GLfloat c + + + + void glIndexfv + const GLfloat *c + + + + void glIndexi + GLint c + + + + void glIndexiv + const GLint *c + + + + void glIndexs + GLshort c + + + + void glIndexsv + const GLshort *c + + + + void glIndexub + GLubyte c + + + + void glIndexubv + const GLubyte *c + + + + void glIndexxOES + GLfixed component + + + void glIndexxvOES + const GLfixed *component + + + void glInitNames + + + + void glInsertComponentEXT + GLuint res + GLuint src + GLuint num + + + void glInsertEventMarkerEXT + GLsizei length + const GLchar *marker + + + void glInstrumentsBufferSGIX + GLsizei size + GLint *buffer + + + + void glInterleavedArrays + GLenum format + GLsizei stride + const void *pointer + + + void glInterpolatePathsNV + GLuint resultPath + GLuint pathA + GLuint pathB + GLfloat weight + + + void glInvalidateBufferData + GLuint buffer + + + void glInvalidateBufferSubData + GLuint buffer + GLintptr offset + GLsizeiptr length + + + void glInvalidateFramebuffer + GLenum target + GLsizei numAttachments + const GLenum *attachments + + + void glInvalidateNamedFramebufferData + GLuint framebuffer + GLsizei numAttachments + const GLenum *attachments + + + void glInvalidateNamedFramebufferSubData + GLuint framebuffer + GLsizei numAttachments + const GLenum *attachments + GLint x + GLint y + GLsizei width + GLsizei height + + + void glInvalidateSubFramebuffer + GLenum target + GLsizei numAttachments + const GLenum *attachments + GLint x + GLint y + GLsizei width + GLsizei height + + + void glInvalidateTexImage + GLuint texture + GLint level + + + void glInvalidateTexSubImage + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + + + GLboolean glIsAsyncMarkerSGIX + GLuint marker + + + GLboolean glIsBuffer + GLuint buffer + + + GLboolean glIsBufferARB + GLuint buffer + + + + GLboolean glIsBufferResidentNV + GLenum target + + + GLboolean glIsCommandListNV + GLuint list + + + GLboolean glIsEnabled + GLenum cap + + + + GLboolean glIsEnabledIndexedEXT + GLenum target + GLuint index + + + + GLboolean glIsEnabledi + GLenum target + GLuint index + + + GLboolean glIsEnablediEXT + GLenum target + GLuint index + + + + GLboolean glIsEnablediNV + GLenum target + GLuint index + + + + GLboolean glIsEnablediOES + GLenum target + GLuint index + + + + GLboolean glIsFenceAPPLE + GLuint fence + + + GLboolean glIsFenceNV + GLuint fence + + + + GLboolean glIsFramebuffer + GLuint framebuffer + + + + GLboolean glIsFramebufferEXT + GLuint framebuffer + + + + + GLboolean glIsFramebufferOES + GLuint framebuffer + + + GLboolean glIsImageHandleResidentARB + GLuint64 handle + + + GLboolean glIsImageHandleResidentNV + GLuint64 handle + + + GLboolean glIsList + GLuint list + + + + GLboolean glIsNameAMD + GLenum identifier + GLuint name + + + GLboolean glIsNamedBufferResidentNV + GLuint buffer + + + GLboolean glIsNamedStringARB + GLint namelen + const GLchar *name + + + GLboolean glIsObjectBufferATI + GLuint buffer + + + GLboolean glIsOcclusionQueryNV + GLuint id + + + GLboolean glIsPathNV + GLuint path + + + GLboolean glIsPointInFillPathNV + GLuint path + GLuint mask + GLfloat x + GLfloat y + + + GLboolean glIsPointInStrokePathNV + GLuint path + GLfloat x + GLfloat y + + + GLboolean glIsProgram + GLuint program + + + + GLboolean glIsProgramARB + GLuint program + + + + GLboolean glIsProgramNV + GLuint id + + + + + GLboolean glIsProgramPipeline + GLuint pipeline + + + GLboolean glIsProgramPipelineEXT + GLuint pipeline + + + GLboolean glIsQuery + GLuint id + + + + GLboolean glIsQueryARB + GLuint id + + + + GLboolean glIsQueryEXT + GLuint id + + + GLboolean glIsRenderbuffer + GLuint renderbuffer + + + + GLboolean glIsRenderbufferEXT + GLuint renderbuffer + + + + + GLboolean glIsRenderbufferOES + GLuint renderbuffer + + + GLboolean glIsSampler + GLuint sampler + + + GLboolean glIsShader + GLuint shader + + + + GLboolean glIsStateNV + GLuint state + + + GLboolean glIsSync + GLsync sync + + + GLboolean glIsSyncAPPLE + GLsync sync + + + + GLboolean glIsTexture + GLuint texture + + + + GLboolean glIsTextureEXT + GLuint texture + + + + GLboolean glIsTextureHandleResidentARB + GLuint64 handle + + + GLboolean glIsTextureHandleResidentNV + GLuint64 handle + + + GLboolean glIsTransformFeedback + GLuint id + + + GLboolean glIsTransformFeedbackNV + GLuint id + + + + GLboolean glIsVariantEnabledEXT + GLuint id + GLenum cap + + + GLboolean glIsVertexArray + GLuint array + + + + GLboolean glIsVertexArrayAPPLE + GLuint array + + + + GLboolean glIsVertexArrayOES + GLuint array + + + + GLboolean glIsVertexAttribEnabledAPPLE + GLuint index + GLenum pname + + + void glLabelObjectEXT + GLenum type + GLuint object + GLsizei length + const GLchar *label + + + void glLightEnviSGIX + GLenum pname + GLint param + + + void glLightModelf + GLenum pname + GLfloat param + + + + void glLightModelfv + GLenum pname + const GLfloat *params + + + + void glLightModeli + GLenum pname + GLint param + + + + void glLightModeliv + GLenum pname + const GLint *params + + + + void glLightModelx + GLenum pname + GLfixed param + + + void glLightModelxOES + GLenum pname + GLfixed param + + + void glLightModelxv + GLenum pname + const GLfixed *param + + + void glLightModelxvOES + GLenum pname + const GLfixed *param + + + void glLightf + GLenum light + GLenum pname + GLfloat param + + + + void glLightfv + GLenum light + GLenum pname + const GLfloat *params + + + + void glLighti + GLenum light + GLenum pname + GLint param + + + + void glLightiv + GLenum light + GLenum pname + const GLint *params + + + + void glLightx + GLenum light + GLenum pname + GLfixed param + + + void glLightxOES + GLenum light + GLenum pname + GLfixed param + + + void glLightxv + GLenum light + GLenum pname + const GLfixed *params + + + void glLightxvOES + GLenum light + GLenum pname + const GLfixed *params + + + void glLineStipple + GLint factor + GLushort pattern + + + + void glLineWidth + GLfloat width + + + + void glLineWidthx + GLfixed width + + + void glLineWidthxOES + GLfixed width + + + void glLinkProgram + GLuint program + + + void glLinkProgramARB + GLhandleARB programObj + + + + void glListBase + GLuint base + + + + void glListDrawCommandsStatesClientNV + GLuint list + GLuint segment + const void **indirects + const GLsizei *sizes + const GLuint *states + const GLuint *fbos + GLuint count + + + void glListParameterfSGIX + GLuint list + GLenum pname + GLfloat param + + + + void glListParameterfvSGIX + GLuint list + GLenum pname + const GLfloat *params + + + + void glListParameteriSGIX + GLuint list + GLenum pname + GLint param + + + + void glListParameterivSGIX + GLuint list + GLenum pname + const GLint *params + + + + void glLoadIdentity + + + + void glLoadIdentityDeformationMapSGIX + GLbitfield mask + + + + void glLoadMatrixd + const GLdouble *m + + + + void glLoadMatrixf + const GLfloat *m + + + + void glLoadMatrixx + const GLfixed *m + + + void glLoadMatrixxOES + const GLfixed *m + + + void glLoadName + GLuint name + + + + void glLoadPaletteFromModelViewMatrixOES + + + void glLoadProgramNV + GLenum target + GLuint id + GLsizei len + const GLubyte *program + + + + void glLoadTransposeMatrixd + const GLdouble *m + + + void glLoadTransposeMatrixdARB + const GLdouble *m + + + + void glLoadTransposeMatrixf + const GLfloat *m + + + void glLoadTransposeMatrixfARB + const GLfloat *m + + + + void glLoadTransposeMatrixxOES + const GLfixed *m + + + void glLockArraysEXT + GLint first + GLsizei count + + + void glLogicOp + GLenum opcode + + + + void glMakeBufferNonResidentNV + GLenum target + + + void glMakeBufferResidentNV + GLenum target + GLenum access + + + void glMakeImageHandleNonResidentARB + GLuint64 handle + + + void glMakeImageHandleNonResidentNV + GLuint64 handle + + + void glMakeImageHandleResidentARB + GLuint64 handle + GLenum access + + + void glMakeImageHandleResidentNV + GLuint64 handle + GLenum access + + + void glMakeNamedBufferNonResidentNV + GLuint buffer + + + void glMakeNamedBufferResidentNV + GLuint buffer + GLenum access + + + void glMakeTextureHandleNonResidentARB + GLuint64 handle + + + void glMakeTextureHandleNonResidentNV + GLuint64 handle + + + void glMakeTextureHandleResidentARB + GLuint64 handle + + + void glMakeTextureHandleResidentNV + GLuint64 handle + + + void glMap1d + GLenum target + GLdouble u1 + GLdouble u2 + GLint stride + GLint order + const GLdouble *points + + + + void glMap1f + GLenum target + GLfloat u1 + GLfloat u2 + GLint stride + GLint order + const GLfloat *points + + + + void glMap1xOES + GLenum target + GLfixed u1 + GLfixed u2 + GLint stride + GLint order + GLfixed points + + + void glMap2d + GLenum target + GLdouble u1 + GLdouble u2 + GLint ustride + GLint uorder + GLdouble v1 + GLdouble v2 + GLint vstride + GLint vorder + const GLdouble *points + + + + void glMap2f + GLenum target + GLfloat u1 + GLfloat u2 + GLint ustride + GLint uorder + GLfloat v1 + GLfloat v2 + GLint vstride + GLint vorder + const GLfloat *points + + + + void glMap2xOES + GLenum target + GLfixed u1 + GLfixed u2 + GLint ustride + GLint uorder + GLfixed v1 + GLfixed v2 + GLint vstride + GLint vorder + GLfixed points + + + void *glMapBuffer + GLenum target + GLenum access + + + void *glMapBufferARB + GLenum target + GLenum access + + + + void *glMapBufferOES + GLenum target + GLenum access + + + + void *glMapBufferRange + GLenum target + GLintptr offset + GLsizeiptr length + GLbitfield access + + + + void *glMapBufferRangeEXT + GLenum target + GLintptr offset + GLsizeiptr length + GLbitfield access + + + + void glMapControlPointsNV + GLenum target + GLuint index + GLenum type + GLsizei ustride + GLsizei vstride + GLint uorder + GLint vorder + GLboolean packed + const void *points + + + void glMapGrid1d + GLint un + GLdouble u1 + GLdouble u2 + + + + void glMapGrid1f + GLint un + GLfloat u1 + GLfloat u2 + + + + void glMapGrid1xOES + GLint n + GLfixed u1 + GLfixed u2 + + + void glMapGrid2d + GLint un + GLdouble u1 + GLdouble u2 + GLint vn + GLdouble v1 + GLdouble v2 + + + + void glMapGrid2f + GLint un + GLfloat u1 + GLfloat u2 + GLint vn + GLfloat v1 + GLfloat v2 + + + + void glMapGrid2xOES + GLint n + GLfixed u1 + GLfixed u2 + GLfixed v1 + GLfixed v2 + + + void *glMapNamedBuffer + GLuint buffer + GLenum access + + + void *glMapNamedBufferEXT + GLuint buffer + GLenum access + + + void *glMapNamedBufferRange + GLuint buffer + GLintptr offset + GLsizeiptr length + GLbitfield access + + + void *glMapNamedBufferRangeEXT + GLuint buffer + GLintptr offset + GLsizeiptr length + GLbitfield access + + + void *glMapObjectBufferATI + GLuint buffer + + + void glMapParameterfvNV + GLenum target + GLenum pname + const GLfloat *params + + + void glMapParameterivNV + GLenum target + GLenum pname + const GLint *params + + + void *glMapTexture2DINTEL + GLuint texture + GLint level + GLbitfield access + GLint *stride + GLenum *layout + + + void glMapVertexAttrib1dAPPLE + GLuint index + GLuint size + GLdouble u1 + GLdouble u2 + GLint stride + GLint order + const GLdouble *points + + + void glMapVertexAttrib1fAPPLE + GLuint index + GLuint size + GLfloat u1 + GLfloat u2 + GLint stride + GLint order + const GLfloat *points + + + void glMapVertexAttrib2dAPPLE + GLuint index + GLuint size + GLdouble u1 + GLdouble u2 + GLint ustride + GLint uorder + GLdouble v1 + GLdouble v2 + GLint vstride + GLint vorder + const GLdouble *points + + + void glMapVertexAttrib2fAPPLE + GLuint index + GLuint size + GLfloat u1 + GLfloat u2 + GLint ustride + GLint uorder + GLfloat v1 + GLfloat v2 + GLint vstride + GLint vorder + const GLfloat *points + + + void glMaterialf + GLenum face + GLenum pname + GLfloat param + + + + void glMaterialfv + GLenum face + GLenum pname + const GLfloat *params + + + + void glMateriali + GLenum face + GLenum pname + GLint param + + + + void glMaterialiv + GLenum face + GLenum pname + const GLint *params + + + + void glMaterialx + GLenum face + GLenum pname + GLfixed param + + + void glMaterialxOES + GLenum face + GLenum pname + GLfixed param + + + void glMaterialxv + GLenum face + GLenum pname + const GLfixed *param + + + void glMaterialxvOES + GLenum face + GLenum pname + const GLfixed *param + + + void glMatrixFrustumEXT + GLenum mode + GLdouble left + GLdouble right + GLdouble bottom + GLdouble top + GLdouble zNear + GLdouble zFar + + + void glMatrixIndexPointerARB + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glMatrixIndexPointerOES + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glMatrixIndexubvARB + GLint size + const GLubyte *indices + + + + void glMatrixIndexuivARB + GLint size + const GLuint *indices + + + + void glMatrixIndexusvARB + GLint size + const GLushort *indices + + + + void glMatrixLoad3x2fNV + GLenum matrixMode + const GLfloat *m + + + void glMatrixLoad3x3fNV + GLenum matrixMode + const GLfloat *m + + + void glMatrixLoadIdentityEXT + GLenum mode + + + void glMatrixLoadTranspose3x3fNV + GLenum matrixMode + const GLfloat *m + + + void glMatrixLoadTransposedEXT + GLenum mode + const GLdouble *m + + + void glMatrixLoadTransposefEXT + GLenum mode + const GLfloat *m + + + void glMatrixLoaddEXT + GLenum mode + const GLdouble *m + + + void glMatrixLoadfEXT + GLenum mode + const GLfloat *m + + + void glMatrixMode + GLenum mode + + + + void glMatrixMult3x2fNV + GLenum matrixMode + const GLfloat *m + + + void glMatrixMult3x3fNV + GLenum matrixMode + const GLfloat *m + + + void glMatrixMultTranspose3x3fNV + GLenum matrixMode + const GLfloat *m + + + void glMatrixMultTransposedEXT + GLenum mode + const GLdouble *m + + + void glMatrixMultTransposefEXT + GLenum mode + const GLfloat *m + + + void glMatrixMultdEXT + GLenum mode + const GLdouble *m + + + void glMatrixMultfEXT + GLenum mode + const GLfloat *m + + + void glMatrixOrthoEXT + GLenum mode + GLdouble left + GLdouble right + GLdouble bottom + GLdouble top + GLdouble zNear + GLdouble zFar + + + void glMatrixPopEXT + GLenum mode + + + void glMatrixPushEXT + GLenum mode + + + void glMatrixRotatedEXT + GLenum mode + GLdouble angle + GLdouble x + GLdouble y + GLdouble z + + + void glMatrixRotatefEXT + GLenum mode + GLfloat angle + GLfloat x + GLfloat y + GLfloat z + + + void glMatrixScaledEXT + GLenum mode + GLdouble x + GLdouble y + GLdouble z + + + void glMatrixScalefEXT + GLenum mode + GLfloat x + GLfloat y + GLfloat z + + + void glMatrixTranslatedEXT + GLenum mode + GLdouble x + GLdouble y + GLdouble z + + + void glMatrixTranslatefEXT + GLenum mode + GLfloat x + GLfloat y + GLfloat z + + + void glMaxShaderCompilerThreadsARB + GLuint count + + + void glMemoryBarrier + GLbitfield barriers + + + void glMemoryBarrierByRegion + GLbitfield barriers + + + void glMemoryBarrierEXT + GLbitfield barriers + + + + void glMinSampleShading + GLfloat value + + + void glMinSampleShadingARB + GLfloat value + + + + void glMinSampleShadingOES + GLfloat value + + + + void glMinmax + GLenum target + GLenum internalformat + GLboolean sink + + + + void glMinmaxEXT + GLenum target + GLenum internalformat + GLboolean sink + + + + + void glMultMatrixd + const GLdouble *m + + + + void glMultMatrixf + const GLfloat *m + + + + void glMultMatrixx + const GLfixed *m + + + void glMultMatrixxOES + const GLfixed *m + + + void glMultTransposeMatrixd + const GLdouble *m + + + void glMultTransposeMatrixdARB + const GLdouble *m + + + + void glMultTransposeMatrixf + const GLfloat *m + + + void glMultTransposeMatrixfARB + const GLfloat *m + + + + void glMultTransposeMatrixxOES + const GLfixed *m + + + void glMultiDrawArrays + GLenum mode + const GLint *first + const GLsizei *count + GLsizei drawcount + + + void glMultiDrawArraysEXT + GLenum mode + const GLint *first + const GLsizei *count + GLsizei primcount + + + + void glMultiDrawArraysIndirect + GLenum mode + const void *indirect + GLsizei drawcount + GLsizei stride + + + void glMultiDrawArraysIndirectAMD + GLenum mode + const void *indirect + GLsizei primcount + GLsizei stride + + + + void glMultiDrawArraysIndirectBindlessCountNV + GLenum mode + const void *indirect + GLsizei drawCount + GLsizei maxDrawCount + GLsizei stride + GLint vertexBufferCount + + + void glMultiDrawArraysIndirectBindlessNV + GLenum mode + const void *indirect + GLsizei drawCount + GLsizei stride + GLint vertexBufferCount + + + void glMultiDrawArraysIndirectCountARB + GLenum mode + GLintptr indirect + GLintptr drawcount + GLsizei maxdrawcount + GLsizei stride + + + void glMultiDrawArraysIndirectEXT + GLenum mode + const void *indirect + GLsizei drawcount + GLsizei stride + + + + void glMultiDrawElementArrayAPPLE + GLenum mode + const GLint *first + const GLsizei *count + GLsizei primcount + + + void glMultiDrawElements + GLenum mode + const GLsizei *count + GLenum type + const void *const*indices + GLsizei drawcount + + + void glMultiDrawElementsBaseVertex + GLenum mode + const GLsizei *count + GLenum type + const void *const*indices + GLsizei drawcount + const GLint *basevertex + + + void glMultiDrawElementsBaseVertexEXT + GLenum mode + const GLsizei *count + GLenum type + const void *const*indices + GLsizei primcount + const GLint *basevertex + + + + void glMultiDrawElementsBaseVertexOES + GLenum mode + const GLsizei *count + GLenum type + const void *const*indices + GLsizei primcount + const GLint *basevertex + + + + void glMultiDrawElementsEXT + GLenum mode + const GLsizei *count + GLenum type + const void *const*indices + GLsizei primcount + + + + void glMultiDrawElementsIndirect + GLenum mode + GLenum type + const void *indirect + GLsizei drawcount + GLsizei stride + + + void glMultiDrawElementsIndirectAMD + GLenum mode + GLenum type + const void *indirect + GLsizei primcount + GLsizei stride + + + + void glMultiDrawElementsIndirectBindlessCountNV + GLenum mode + GLenum type + const void *indirect + GLsizei drawCount + GLsizei maxDrawCount + GLsizei stride + GLint vertexBufferCount + + + void glMultiDrawElementsIndirectBindlessNV + GLenum mode + GLenum type + const void *indirect + GLsizei drawCount + GLsizei stride + GLint vertexBufferCount + + + void glMultiDrawElementsIndirectCountARB + GLenum mode + GLenum type + GLintptr indirect + GLintptr drawcount + GLsizei maxdrawcount + GLsizei stride + + + void glMultiDrawElementsIndirectEXT + GLenum mode + GLenum type + const void *indirect + GLsizei drawcount + GLsizei stride + + + + void glMultiDrawRangeElementArrayAPPLE + GLenum mode + GLuint start + GLuint end + const GLint *first + const GLsizei *count + GLsizei primcount + + + void glMultiModeDrawArraysIBM + const GLenum *mode + const GLint *first + const GLsizei *count + GLsizei primcount + GLint modestride + + + void glMultiModeDrawElementsIBM + const GLenum *mode + const GLsizei *count + GLenum type + const void *const*indices + GLsizei primcount + GLint modestride + + + void glMultiTexBufferEXT + GLenum texunit + GLenum target + GLenum internalformat + GLuint buffer + + + void glMultiTexCoord1bOES + GLenum texture + GLbyte s + + + void glMultiTexCoord1bvOES + GLenum texture + const GLbyte *coords + + + void glMultiTexCoord1d + GLenum target + GLdouble s + + + + void glMultiTexCoord1dARB + GLenum target + GLdouble s + + + + + void glMultiTexCoord1dv + GLenum target + const GLdouble *v + + + + void glMultiTexCoord1dvARB + GLenum target + const GLdouble *v + + + + + void glMultiTexCoord1f + GLenum target + GLfloat s + + + + void glMultiTexCoord1fARB + GLenum target + GLfloat s + + + + + void glMultiTexCoord1fv + GLenum target + const GLfloat *v + + + + void glMultiTexCoord1fvARB + GLenum target + const GLfloat *v + + + + + void glMultiTexCoord1hNV + GLenum target + GLhalfNV s + + + + void glMultiTexCoord1hvNV + GLenum target + const GLhalfNV *v + + + + void glMultiTexCoord1i + GLenum target + GLint s + + + + void glMultiTexCoord1iARB + GLenum target + GLint s + + + + + void glMultiTexCoord1iv + GLenum target + const GLint *v + + + + void glMultiTexCoord1ivARB + GLenum target + const GLint *v + + + + + void glMultiTexCoord1s + GLenum target + GLshort s + + + + void glMultiTexCoord1sARB + GLenum target + GLshort s + + + + + void glMultiTexCoord1sv + GLenum target + const GLshort *v + + + + void glMultiTexCoord1svARB + GLenum target + const GLshort *v + + + + + void glMultiTexCoord1xOES + GLenum texture + GLfixed s + + + void glMultiTexCoord1xvOES + GLenum texture + const GLfixed *coords + + + void glMultiTexCoord2bOES + GLenum texture + GLbyte s + GLbyte t + + + void glMultiTexCoord2bvOES + GLenum texture + const GLbyte *coords + + + void glMultiTexCoord2d + GLenum target + GLdouble s + GLdouble t + + + + void glMultiTexCoord2dARB + GLenum target + GLdouble s + GLdouble t + + + + + void glMultiTexCoord2dv + GLenum target + const GLdouble *v + + + + void glMultiTexCoord2dvARB + GLenum target + const GLdouble *v + + + + + void glMultiTexCoord2f + GLenum target + GLfloat s + GLfloat t + + + + void glMultiTexCoord2fARB + GLenum target + GLfloat s + GLfloat t + + + + + void glMultiTexCoord2fv + GLenum target + const GLfloat *v + + + + void glMultiTexCoord2fvARB + GLenum target + const GLfloat *v + + + + + void glMultiTexCoord2hNV + GLenum target + GLhalfNV s + GLhalfNV t + + + + void glMultiTexCoord2hvNV + GLenum target + const GLhalfNV *v + + + + void glMultiTexCoord2i + GLenum target + GLint s + GLint t + + + + void glMultiTexCoord2iARB + GLenum target + GLint s + GLint t + + + + + void glMultiTexCoord2iv + GLenum target + const GLint *v + + + + void glMultiTexCoord2ivARB + GLenum target + const GLint *v + + + + + void glMultiTexCoord2s + GLenum target + GLshort s + GLshort t + + + + void glMultiTexCoord2sARB + GLenum target + GLshort s + GLshort t + + + + + void glMultiTexCoord2sv + GLenum target + const GLshort *v + + + + void glMultiTexCoord2svARB + GLenum target + const GLshort *v + + + + + void glMultiTexCoord2xOES + GLenum texture + GLfixed s + GLfixed t + + + void glMultiTexCoord2xvOES + GLenum texture + const GLfixed *coords + + + void glMultiTexCoord3bOES + GLenum texture + GLbyte s + GLbyte t + GLbyte r + + + void glMultiTexCoord3bvOES + GLenum texture + const GLbyte *coords + + + void glMultiTexCoord3d + GLenum target + GLdouble s + GLdouble t + GLdouble r + + + + void glMultiTexCoord3dARB + GLenum target + GLdouble s + GLdouble t + GLdouble r + + + + + void glMultiTexCoord3dv + GLenum target + const GLdouble *v + + + + void glMultiTexCoord3dvARB + GLenum target + const GLdouble *v + + + + + void glMultiTexCoord3f + GLenum target + GLfloat s + GLfloat t + GLfloat r + + + + void glMultiTexCoord3fARB + GLenum target + GLfloat s + GLfloat t + GLfloat r + + + + + void glMultiTexCoord3fv + GLenum target + const GLfloat *v + + + + void glMultiTexCoord3fvARB + GLenum target + const GLfloat *v + + + + + void glMultiTexCoord3hNV + GLenum target + GLhalfNV s + GLhalfNV t + GLhalfNV r + + + + void glMultiTexCoord3hvNV + GLenum target + const GLhalfNV *v + + + + void glMultiTexCoord3i + GLenum target + GLint s + GLint t + GLint r + + + + void glMultiTexCoord3iARB + GLenum target + GLint s + GLint t + GLint r + + + + + void glMultiTexCoord3iv + GLenum target + const GLint *v + + + + void glMultiTexCoord3ivARB + GLenum target + const GLint *v + + + + + void glMultiTexCoord3s + GLenum target + GLshort s + GLshort t + GLshort r + + + + void glMultiTexCoord3sARB + GLenum target + GLshort s + GLshort t + GLshort r + + + + + void glMultiTexCoord3sv + GLenum target + const GLshort *v + + + + void glMultiTexCoord3svARB + GLenum target + const GLshort *v + + + + + void glMultiTexCoord3xOES + GLenum texture + GLfixed s + GLfixed t + GLfixed r + + + void glMultiTexCoord3xvOES + GLenum texture + const GLfixed *coords + + + void glMultiTexCoord4bOES + GLenum texture + GLbyte s + GLbyte t + GLbyte r + GLbyte q + + + void glMultiTexCoord4bvOES + GLenum texture + const GLbyte *coords + + + void glMultiTexCoord4d + GLenum target + GLdouble s + GLdouble t + GLdouble r + GLdouble q + + + + void glMultiTexCoord4dARB + GLenum target + GLdouble s + GLdouble t + GLdouble r + GLdouble q + + + + + void glMultiTexCoord4dv + GLenum target + const GLdouble *v + + + + void glMultiTexCoord4dvARB + GLenum target + const GLdouble *v + + + + + void glMultiTexCoord4f + GLenum target + GLfloat s + GLfloat t + GLfloat r + GLfloat q + + + + void glMultiTexCoord4fARB + GLenum target + GLfloat s + GLfloat t + GLfloat r + GLfloat q + + + + + void glMultiTexCoord4fv + GLenum target + const GLfloat *v + + + + void glMultiTexCoord4fvARB + GLenum target + const GLfloat *v + + + + + void glMultiTexCoord4hNV + GLenum target + GLhalfNV s + GLhalfNV t + GLhalfNV r + GLhalfNV q + + + + void glMultiTexCoord4hvNV + GLenum target + const GLhalfNV *v + + + + void glMultiTexCoord4i + GLenum target + GLint s + GLint t + GLint r + GLint q + + + + void glMultiTexCoord4iARB + GLenum target + GLint s + GLint t + GLint r + GLint q + + + + + void glMultiTexCoord4iv + GLenum target + const GLint *v + + + + void glMultiTexCoord4ivARB + GLenum target + const GLint *v + + + + + void glMultiTexCoord4s + GLenum target + GLshort s + GLshort t + GLshort r + GLshort q + + + + void glMultiTexCoord4sARB + GLenum target + GLshort s + GLshort t + GLshort r + GLshort q + + + + + void glMultiTexCoord4sv + GLenum target + const GLshort *v + + + + void glMultiTexCoord4svARB + GLenum target + const GLshort *v + + + + + void glMultiTexCoord4x + GLenum texture + GLfixed s + GLfixed t + GLfixed r + GLfixed q + + + void glMultiTexCoord4xOES + GLenum texture + GLfixed s + GLfixed t + GLfixed r + GLfixed q + + + void glMultiTexCoord4xvOES + GLenum texture + const GLfixed *coords + + + void glMultiTexCoordP1ui + GLenum texture + GLenum type + GLuint coords + + + void glMultiTexCoordP1uiv + GLenum texture + GLenum type + const GLuint *coords + + + void glMultiTexCoordP2ui + GLenum texture + GLenum type + GLuint coords + + + void glMultiTexCoordP2uiv + GLenum texture + GLenum type + const GLuint *coords + + + void glMultiTexCoordP3ui + GLenum texture + GLenum type + GLuint coords + + + void glMultiTexCoordP3uiv + GLenum texture + GLenum type + const GLuint *coords + + + void glMultiTexCoordP4ui + GLenum texture + GLenum type + GLuint coords + + + void glMultiTexCoordP4uiv + GLenum texture + GLenum type + const GLuint *coords + + + void glMultiTexCoordPointerEXT + GLenum texunit + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glMultiTexEnvfEXT + GLenum texunit + GLenum target + GLenum pname + GLfloat param + + + + void glMultiTexEnvfvEXT + GLenum texunit + GLenum target + GLenum pname + const GLfloat *params + + + void glMultiTexEnviEXT + GLenum texunit + GLenum target + GLenum pname + GLint param + + + + void glMultiTexEnvivEXT + GLenum texunit + GLenum target + GLenum pname + const GLint *params + + + void glMultiTexGendEXT + GLenum texunit + GLenum coord + GLenum pname + GLdouble param + + + + void glMultiTexGendvEXT + GLenum texunit + GLenum coord + GLenum pname + const GLdouble *params + + + void glMultiTexGenfEXT + GLenum texunit + GLenum coord + GLenum pname + GLfloat param + + + + void glMultiTexGenfvEXT + GLenum texunit + GLenum coord + GLenum pname + const GLfloat *params + + + void glMultiTexGeniEXT + GLenum texunit + GLenum coord + GLenum pname + GLint param + + + + void glMultiTexGenivEXT + GLenum texunit + GLenum coord + GLenum pname + const GLint *params + + + void glMultiTexImage1DEXT + GLenum texunit + GLenum target + GLint level + GLint internalformat + GLsizei width + GLint border + GLenum format + GLenum type + const void *pixels + + + void glMultiTexImage2DEXT + GLenum texunit + GLenum target + GLint level + GLint internalformat + GLsizei width + GLsizei height + GLint border + GLenum format + GLenum type + const void *pixels + + + void glMultiTexImage3DEXT + GLenum texunit + GLenum target + GLint level + GLint internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLenum format + GLenum type + const void *pixels + + + void glMultiTexParameterIivEXT + GLenum texunit + GLenum target + GLenum pname + const GLint *params + + + void glMultiTexParameterIuivEXT + GLenum texunit + GLenum target + GLenum pname + const GLuint *params + + + void glMultiTexParameterfEXT + GLenum texunit + GLenum target + GLenum pname + GLfloat param + + + + void glMultiTexParameterfvEXT + GLenum texunit + GLenum target + GLenum pname + const GLfloat *params + + + void glMultiTexParameteriEXT + GLenum texunit + GLenum target + GLenum pname + GLint param + + + + void glMultiTexParameterivEXT + GLenum texunit + GLenum target + GLenum pname + const GLint *params + + + void glMultiTexRenderbufferEXT + GLenum texunit + GLenum target + GLuint renderbuffer + + + void glMultiTexSubImage1DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLenum type + const void *pixels + + + void glMultiTexSubImage2DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *pixels + + + void glMultiTexSubImage3DEXT + GLenum texunit + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + const void *pixels + + + void glNamedBufferData + GLuint buffer + GLsizeiptr size + const void *data + GLenum usage + + + void glNamedBufferDataEXT + GLuint buffer + GLsizeiptr size + const void *data + GLenum usage + + + void glNamedBufferPageCommitmentARB + GLuint buffer + GLintptr offset + GLsizeiptr size + GLboolean commit + + + void glNamedBufferPageCommitmentEXT + GLuint buffer + GLintptr offset + GLsizeiptr size + GLboolean commit + + + void glNamedBufferStorage + GLuint buffer + GLsizeiptr size + const void *data + GLbitfield flags + + + void glNamedBufferStorageEXT + GLuint buffer + GLsizeiptr size + const void *data + GLbitfield flags + + + + void glNamedBufferSubData + GLuint buffer + GLintptr offset + GLsizeiptr size + const void *data + + + void glNamedBufferSubDataEXT + GLuint buffer + GLintptr offset + GLsizeiptr size + const void *data + + + + void glNamedCopyBufferSubDataEXT + GLuint readBuffer + GLuint writeBuffer + GLintptr readOffset + GLintptr writeOffset + GLsizeiptr size + + + void glNamedFramebufferDrawBuffer + GLuint framebuffer + GLenum buf + + + void glNamedFramebufferDrawBuffers + GLuint framebuffer + GLsizei n + const GLenum *bufs + + + void glNamedFramebufferParameteri + GLuint framebuffer + GLenum pname + GLint param + + + void glNamedFramebufferParameteriEXT + GLuint framebuffer + GLenum pname + GLint param + + + void glNamedFramebufferReadBuffer + GLuint framebuffer + GLenum src + + + void glNamedFramebufferRenderbuffer + GLuint framebuffer + GLenum attachment + GLenum renderbuffertarget + GLuint renderbuffer + + + void glNamedFramebufferRenderbufferEXT + GLuint framebuffer + GLenum attachment + GLenum renderbuffertarget + GLuint renderbuffer + + + void glNamedFramebufferSampleLocationsfvARB + GLuint framebuffer + GLuint start + GLsizei count + const GLfloat *v + + + void glNamedFramebufferSampleLocationsfvNV + GLuint framebuffer + GLuint start + GLsizei count + const GLfloat *v + + + void glNamedFramebufferTexture + GLuint framebuffer + GLenum attachment + GLuint texture + GLint level + + + void glNamedFramebufferTexture1DEXT + GLuint framebuffer + GLenum attachment + GLenum textarget + GLuint texture + GLint level + + + void glNamedFramebufferTexture2DEXT + GLuint framebuffer + GLenum attachment + GLenum textarget + GLuint texture + GLint level + + + void glNamedFramebufferTexture3DEXT + GLuint framebuffer + GLenum attachment + GLenum textarget + GLuint texture + GLint level + GLint zoffset + + + void glNamedFramebufferTextureEXT + GLuint framebuffer + GLenum attachment + GLuint texture + GLint level + + + void glNamedFramebufferTextureFaceEXT + GLuint framebuffer + GLenum attachment + GLuint texture + GLint level + GLenum face + + + void glNamedFramebufferTextureLayer + GLuint framebuffer + GLenum attachment + GLuint texture + GLint level + GLint layer + + + void glNamedFramebufferTextureLayerEXT + GLuint framebuffer + GLenum attachment + GLuint texture + GLint level + GLint layer + + + void glNamedProgramLocalParameter4dEXT + GLuint program + GLenum target + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glNamedProgramLocalParameter4dvEXT + GLuint program + GLenum target + GLuint index + const GLdouble *params + + + void glNamedProgramLocalParameter4fEXT + GLuint program + GLenum target + GLuint index + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glNamedProgramLocalParameter4fvEXT + GLuint program + GLenum target + GLuint index + const GLfloat *params + + + void glNamedProgramLocalParameterI4iEXT + GLuint program + GLenum target + GLuint index + GLint x + GLint y + GLint z + GLint w + + + + void glNamedProgramLocalParameterI4ivEXT + GLuint program + GLenum target + GLuint index + const GLint *params + + + void glNamedProgramLocalParameterI4uiEXT + GLuint program + GLenum target + GLuint index + GLuint x + GLuint y + GLuint z + GLuint w + + + + void glNamedProgramLocalParameterI4uivEXT + GLuint program + GLenum target + GLuint index + const GLuint *params + + + void glNamedProgramLocalParameters4fvEXT + GLuint program + GLenum target + GLuint index + GLsizei count + const GLfloat *params + + + void glNamedProgramLocalParametersI4ivEXT + GLuint program + GLenum target + GLuint index + GLsizei count + const GLint *params + + + void glNamedProgramLocalParametersI4uivEXT + GLuint program + GLenum target + GLuint index + GLsizei count + const GLuint *params + + + void glNamedProgramStringEXT + GLuint program + GLenum target + GLenum format + GLsizei len + const void *string + + + void glNamedRenderbufferStorage + GLuint renderbuffer + GLenum internalformat + GLsizei width + GLsizei height + + + void glNamedRenderbufferStorageEXT + GLuint renderbuffer + GLenum internalformat + GLsizei width + GLsizei height + + + void glNamedRenderbufferStorageMultisample + GLuint renderbuffer + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + void glNamedRenderbufferStorageMultisampleCoverageEXT + GLuint renderbuffer + GLsizei coverageSamples + GLsizei colorSamples + GLenum internalformat + GLsizei width + GLsizei height + + + void glNamedRenderbufferStorageMultisampleEXT + GLuint renderbuffer + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + void glNamedStringARB + GLenum type + GLint namelen + const GLchar *name + GLint stringlen + const GLchar *string + + + void glNewList + GLuint list + GLenum mode + + + + GLuint glNewObjectBufferATI + GLsizei size + const void *pointer + GLenum usage + + + void glNormal3b + GLbyte nx + GLbyte ny + GLbyte nz + + + + void glNormal3bv + const GLbyte *v + + + + void glNormal3d + GLdouble nx + GLdouble ny + GLdouble nz + + + + void glNormal3dv + const GLdouble *v + + + + void glNormal3f + GLfloat nx + GLfloat ny + GLfloat nz + + + + void glNormal3fVertex3fSUN + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glNormal3fVertex3fvSUN + const GLfloat *n + const GLfloat *v + + + void glNormal3fv + const GLfloat *v + + + + void glNormal3hNV + GLhalfNV nx + GLhalfNV ny + GLhalfNV nz + + + + void glNormal3hvNV + const GLhalfNV *v + + + + void glNormal3i + GLint nx + GLint ny + GLint nz + + + + void glNormal3iv + const GLint *v + + + + void glNormal3s + GLshort nx + GLshort ny + GLshort nz + + + + void glNormal3sv + const GLshort *v + + + + void glNormal3x + GLfixed nx + GLfixed ny + GLfixed nz + + + void glNormal3xOES + GLfixed nx + GLfixed ny + GLfixed nz + + + void glNormal3xvOES + const GLfixed *coords + + + void glNormalFormatNV + GLenum type + GLsizei stride + + + void glNormalP3ui + GLenum type + GLuint coords + + + void glNormalP3uiv + GLenum type + const GLuint *coords + + + void glNormalPointer + GLenum type + GLsizei stride + const void *pointer + + + void glNormalPointerEXT + GLenum type + GLsizei stride + GLsizei count + const void *pointer + + + void glNormalPointerListIBM + GLenum type + GLint stride + const void **pointer + GLint ptrstride + + + void glNormalPointervINTEL + GLenum type + const void **pointer + + + void glNormalStream3bATI + GLenum stream + GLbyte nx + GLbyte ny + GLbyte nz + + + void glNormalStream3bvATI + GLenum stream + const GLbyte *coords + + + void glNormalStream3dATI + GLenum stream + GLdouble nx + GLdouble ny + GLdouble nz + + + void glNormalStream3dvATI + GLenum stream + const GLdouble *coords + + + void glNormalStream3fATI + GLenum stream + GLfloat nx + GLfloat ny + GLfloat nz + + + void glNormalStream3fvATI + GLenum stream + const GLfloat *coords + + + void glNormalStream3iATI + GLenum stream + GLint nx + GLint ny + GLint nz + + + void glNormalStream3ivATI + GLenum stream + const GLint *coords + + + void glNormalStream3sATI + GLenum stream + GLshort nx + GLshort ny + GLshort nz + + + void glNormalStream3svATI + GLenum stream + const GLshort *coords + + + void glObjectLabel + GLenum identifier + GLuint name + GLsizei length + const GLchar *label + + + void glObjectLabelKHR + GLenum identifier + GLuint name + GLsizei length + const GLchar *label + + + + void glObjectPtrLabel + const void *ptr + GLsizei length + const GLchar *label + + + void glObjectPtrLabelKHR + const void *ptr + GLsizei length + const GLchar *label + + + + GLenum glObjectPurgeableAPPLE + GLenum objectType + GLuint name + GLenum option + + + GLenum glObjectUnpurgeableAPPLE + GLenum objectType + GLuint name + GLenum option + + + void glOrtho + GLdouble left + GLdouble right + GLdouble bottom + GLdouble top + GLdouble zNear + GLdouble zFar + + + + void glOrthof + GLfloat l + GLfloat r + GLfloat b + GLfloat t + GLfloat n + GLfloat f + + + void glOrthofOES + GLfloat l + GLfloat r + GLfloat b + GLfloat t + GLfloat n + GLfloat f + + + + void glOrthox + GLfixed l + GLfixed r + GLfixed b + GLfixed t + GLfixed n + GLfixed f + + + void glOrthoxOES + GLfixed l + GLfixed r + GLfixed b + GLfixed t + GLfixed n + GLfixed f + + + void glPNTrianglesfATI + GLenum pname + GLfloat param + + + void glPNTrianglesiATI + GLenum pname + GLint param + + + void glPassTexCoordATI + GLuint dst + GLuint coord + GLenum swizzle + + + void glPassThrough + GLfloat token + + + + void glPassThroughxOES + GLfixed token + + + void glPatchParameterfv + GLenum pname + const GLfloat *values + + + void glPatchParameteri + GLenum pname + GLint value + + + void glPatchParameteriEXT + GLenum pname + GLint value + + + + void glPatchParameteriOES + GLenum pname + GLint value + + + + void glPathColorGenNV + GLenum color + GLenum genMode + GLenum colorFormat + const GLfloat *coeffs + + + void glPathCommandsNV + GLuint path + GLsizei numCommands + const GLubyte *commands + GLsizei numCoords + GLenum coordType + const void *coords + + + void glPathCoordsNV + GLuint path + GLsizei numCoords + GLenum coordType + const void *coords + + + void glPathCoverDepthFuncNV + GLenum func + + + void glPathDashArrayNV + GLuint path + GLsizei dashCount + const GLfloat *dashArray + + + void glPathFogGenNV + GLenum genMode + + + GLenum glPathGlyphIndexArrayNV + GLuint firstPathName + GLenum fontTarget + const void *fontName + GLbitfield fontStyle + GLuint firstGlyphIndex + GLsizei numGlyphs + GLuint pathParameterTemplate + GLfloat emScale + + + GLenum glPathGlyphIndexRangeNV + GLenum fontTarget + const void *fontName + GLbitfield fontStyle + GLuint pathParameterTemplate + GLfloat emScale + GLuint baseAndCount[2] + + + void glPathGlyphRangeNV + GLuint firstPathName + GLenum fontTarget + const void *fontName + GLbitfield fontStyle + GLuint firstGlyph + GLsizei numGlyphs + GLenum handleMissingGlyphs + GLuint pathParameterTemplate + GLfloat emScale + + + void glPathGlyphsNV + GLuint firstPathName + GLenum fontTarget + const void *fontName + GLbitfield fontStyle + GLsizei numGlyphs + GLenum type + const void *charcodes + GLenum handleMissingGlyphs + GLuint pathParameterTemplate + GLfloat emScale + + + GLenum glPathMemoryGlyphIndexArrayNV + GLuint firstPathName + GLenum fontTarget + GLsizeiptr fontSize + const void *fontData + GLsizei faceIndex + GLuint firstGlyphIndex + GLsizei numGlyphs + GLuint pathParameterTemplate + GLfloat emScale + + + void glPathParameterfNV + GLuint path + GLenum pname + GLfloat value + + + void glPathParameterfvNV + GLuint path + GLenum pname + const GLfloat *value + + + void glPathParameteriNV + GLuint path + GLenum pname + GLint value + + + void glPathParameterivNV + GLuint path + GLenum pname + const GLint *value + + + void glPathStencilDepthOffsetNV + GLfloat factor + GLfloat units + + + void glPathStencilFuncNV + GLenum func + GLint ref + GLuint mask + + + void glPathStringNV + GLuint path + GLenum format + GLsizei length + const void *pathString + + + void glPathSubCommandsNV + GLuint path + GLsizei commandStart + GLsizei commandsToDelete + GLsizei numCommands + const GLubyte *commands + GLsizei numCoords + GLenum coordType + const void *coords + + + void glPathSubCoordsNV + GLuint path + GLsizei coordStart + GLsizei numCoords + GLenum coordType + const void *coords + + + void glPathTexGenNV + GLenum texCoordSet + GLenum genMode + GLint components + const GLfloat *coeffs + + + void glPauseTransformFeedback + + + void glPauseTransformFeedbackNV + + + + void glPixelDataRangeNV + GLenum target + GLsizei length + const void *pointer + + + void glPixelMapfv + GLenum map + GLsizei mapsize + const GLfloat *values + + + + + void glPixelMapuiv + GLenum map + GLsizei mapsize + const GLuint *values + + + + + void glPixelMapusv + GLenum map + GLsizei mapsize + const GLushort *values + + + + + void glPixelMapx + GLenum map + GLint size + const GLfixed *values + + + void glPixelStoref + GLenum pname + GLfloat param + + + + void glPixelStorei + GLenum pname + GLint param + + + + void glPixelStorex + GLenum pname + GLfixed param + + + void glPixelTexGenParameterfSGIS + GLenum pname + GLfloat param + + + void glPixelTexGenParameterfvSGIS + GLenum pname + const GLfloat *params + + + void glPixelTexGenParameteriSGIS + GLenum pname + GLint param + + + void glPixelTexGenParameterivSGIS + GLenum pname + const GLint *params + + + void glPixelTexGenSGIX + GLenum mode + + + + void glPixelTransferf + GLenum pname + GLfloat param + + + + void glPixelTransferi + GLenum pname + GLint param + + + + void glPixelTransferxOES + GLenum pname + GLfixed param + + + void glPixelTransformParameterfEXT + GLenum target + GLenum pname + GLfloat param + + + + void glPixelTransformParameterfvEXT + GLenum target + GLenum pname + const GLfloat *params + + + void glPixelTransformParameteriEXT + GLenum target + GLenum pname + GLint param + + + + void glPixelTransformParameterivEXT + GLenum target + GLenum pname + const GLint *params + + + void glPixelZoom + GLfloat xfactor + GLfloat yfactor + + + + void glPixelZoomxOES + GLfixed xfactor + GLfixed yfactor + + + GLboolean glPointAlongPathNV + GLuint path + GLsizei startSegment + GLsizei numSegments + GLfloat distance + GLfloat *x + GLfloat *y + GLfloat *tangentX + GLfloat *tangentY + + + void glPointParameterf + GLenum pname + GLfloat param + + + + void glPointParameterfARB + GLenum pname + GLfloat param + + + + + void glPointParameterfEXT + GLenum pname + GLfloat param + + + + void glPointParameterfSGIS + GLenum pname + GLfloat param + + + + void glPointParameterfv + GLenum pname + const GLfloat *params + + + + void glPointParameterfvARB + GLenum pname + const GLfloat *params + + + + + void glPointParameterfvEXT + GLenum pname + const GLfloat *params + + + + void glPointParameterfvSGIS + GLenum pname + const GLfloat *params + + + + void glPointParameteri + GLenum pname + GLint param + + + + void glPointParameteriNV + GLenum pname + GLint param + + + + + void glPointParameteriv + GLenum pname + const GLint *params + + + + void glPointParameterivNV + GLenum pname + const GLint *params + + + + + void glPointParameterx + GLenum pname + GLfixed param + + + void glPointParameterxOES + GLenum pname + GLfixed param + + + void glPointParameterxv + GLenum pname + const GLfixed *params + + + void glPointParameterxvOES + GLenum pname + const GLfixed *params + + + void glPointSize + GLfloat size + + + + void glPointSizePointerOES + GLenum type + GLsizei stride + const void *pointer + + + void glPointSizex + GLfixed size + + + void glPointSizexOES + GLfixed size + + + GLint glPollAsyncSGIX + GLuint *markerp + + + GLint glPollInstrumentsSGIX + GLint *marker_p + + + + void glPolygonMode + GLenum face + GLenum mode + + + + void glPolygonModeNV + GLenum face + GLenum mode + + + + void glPolygonOffset + GLfloat factor + GLfloat units + + + + void glPolygonOffsetClampEXT + GLfloat factor + GLfloat units + GLfloat clamp + + + + void glPolygonOffsetEXT + GLfloat factor + GLfloat bias + + + + void glPolygonOffsetx + GLfixed factor + GLfixed units + + + void glPolygonOffsetxOES + GLfixed factor + GLfixed units + + + void glPolygonStipple + const GLubyte *mask + + + + + void glPopAttrib + + + + void glPopClientAttrib + + + void glPopDebugGroup + + + void glPopDebugGroupKHR + + + + void glPopGroupMarkerEXT + + + void glPopMatrix + + + + void glPopName + + + + void glPresentFrameDualFillNV + GLuint video_slot + GLuint64EXT minPresentTime + GLuint beginPresentTimeId + GLuint presentDurationId + GLenum type + GLenum target0 + GLuint fill0 + GLenum target1 + GLuint fill1 + GLenum target2 + GLuint fill2 + GLenum target3 + GLuint fill3 + + + void glPresentFrameKeyedNV + GLuint video_slot + GLuint64EXT minPresentTime + GLuint beginPresentTimeId + GLuint presentDurationId + GLenum type + GLenum target0 + GLuint fill0 + GLuint key0 + GLenum target1 + GLuint fill1 + GLuint key1 + + + void glPrimitiveBoundingBox + GLfloat minX + GLfloat minY + GLfloat minZ + GLfloat minW + GLfloat maxX + GLfloat maxY + GLfloat maxZ + GLfloat maxW + + + void glPrimitiveBoundingBoxARB + GLfloat minX + GLfloat minY + GLfloat minZ + GLfloat minW + GLfloat maxX + GLfloat maxY + GLfloat maxZ + GLfloat maxW + + + + void glPrimitiveBoundingBoxEXT + GLfloat minX + GLfloat minY + GLfloat minZ + GLfloat minW + GLfloat maxX + GLfloat maxY + GLfloat maxZ + GLfloat maxW + + + + void glPrimitiveBoundingBoxOES + GLfloat minX + GLfloat minY + GLfloat minZ + GLfloat minW + GLfloat maxX + GLfloat maxY + GLfloat maxZ + GLfloat maxW + + + + void glPrimitiveRestartIndex + GLuint index + + + void glPrimitiveRestartIndexNV + GLuint index + + + void glPrimitiveRestartNV + + + void glPrioritizeTextures + GLsizei n + const GLuint *textures + const GLfloat *priorities + + + + void glPrioritizeTexturesEXT + GLsizei n + const GLuint *textures + const GLclampf *priorities + + + + + void glPrioritizeTexturesxOES + GLsizei n + const GLuint *textures + const GLfixed *priorities + + + void glProgramBinary + GLuint program + GLenum binaryFormat + const void *binary + GLsizei length + + + void glProgramBinaryOES + GLuint program + GLenum binaryFormat + const void *binary + GLint length + + + + void glProgramBufferParametersIivNV + GLenum target + GLuint bindingIndex + GLuint wordIndex + GLsizei count + const GLint *params + + + void glProgramBufferParametersIuivNV + GLenum target + GLuint bindingIndex + GLuint wordIndex + GLsizei count + const GLuint *params + + + void glProgramBufferParametersfvNV + GLenum target + GLuint bindingIndex + GLuint wordIndex + GLsizei count + const GLfloat *params + + + void glProgramEnvParameter4dARB + GLenum target + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glProgramEnvParameter4dvARB + GLenum target + GLuint index + const GLdouble *params + + + void glProgramEnvParameter4fARB + GLenum target + GLuint index + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glProgramEnvParameter4fvARB + GLenum target + GLuint index + const GLfloat *params + + + void glProgramEnvParameterI4iNV + GLenum target + GLuint index + GLint x + GLint y + GLint z + GLint w + + + + void glProgramEnvParameterI4ivNV + GLenum target + GLuint index + const GLint *params + + + void glProgramEnvParameterI4uiNV + GLenum target + GLuint index + GLuint x + GLuint y + GLuint z + GLuint w + + + + void glProgramEnvParameterI4uivNV + GLenum target + GLuint index + const GLuint *params + + + void glProgramEnvParameters4fvEXT + GLenum target + GLuint index + GLsizei count + const GLfloat *params + + + + void glProgramEnvParametersI4ivNV + GLenum target + GLuint index + GLsizei count + const GLint *params + + + void glProgramEnvParametersI4uivNV + GLenum target + GLuint index + GLsizei count + const GLuint *params + + + void glProgramLocalParameter4dARB + GLenum target + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glProgramLocalParameter4dvARB + GLenum target + GLuint index + const GLdouble *params + + + void glProgramLocalParameter4fARB + GLenum target + GLuint index + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glProgramLocalParameter4fvARB + GLenum target + GLuint index + const GLfloat *params + + + void glProgramLocalParameterI4iNV + GLenum target + GLuint index + GLint x + GLint y + GLint z + GLint w + + + + void glProgramLocalParameterI4ivNV + GLenum target + GLuint index + const GLint *params + + + void glProgramLocalParameterI4uiNV + GLenum target + GLuint index + GLuint x + GLuint y + GLuint z + GLuint w + + + + void glProgramLocalParameterI4uivNV + GLenum target + GLuint index + const GLuint *params + + + void glProgramLocalParameters4fvEXT + GLenum target + GLuint index + GLsizei count + const GLfloat *params + + + + void glProgramLocalParametersI4ivNV + GLenum target + GLuint index + GLsizei count + const GLint *params + + + void glProgramLocalParametersI4uivNV + GLenum target + GLuint index + GLsizei count + const GLuint *params + + + void glProgramNamedParameter4dNV + GLuint id + GLsizei len + const GLubyte *name + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glProgramNamedParameter4dvNV + GLuint id + GLsizei len + const GLubyte *name + const GLdouble *v + + + + void glProgramNamedParameter4fNV + GLuint id + GLsizei len + const GLubyte *name + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glProgramNamedParameter4fvNV + GLuint id + GLsizei len + const GLubyte *name + const GLfloat *v + + + + void glProgramParameter4dNV + GLenum target + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glProgramParameter4dvNV + GLenum target + GLuint index + const GLdouble *v + + + + void glProgramParameter4fNV + GLenum target + GLuint index + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glProgramParameter4fvNV + GLenum target + GLuint index + const GLfloat *v + + + + void glProgramParameteri + GLuint program + GLenum pname + GLint value + + + void glProgramParameteriARB + GLuint program + GLenum pname + GLint value + + + + void glProgramParameteriEXT + GLuint program + GLenum pname + GLint value + + + + void glProgramParameters4dvNV + GLenum target + GLuint index + GLsizei count + const GLdouble *v + + + + void glProgramParameters4fvNV + GLenum target + GLuint index + GLsizei count + const GLfloat *v + + + + void glProgramPathFragmentInputGenNV + GLuint program + GLint location + GLenum genMode + GLint components + const GLfloat *coeffs + + + void glProgramStringARB + GLenum target + GLenum format + GLsizei len + const void *string + + + void glProgramSubroutineParametersuivNV + GLenum target + GLsizei count + const GLuint *params + + + void glProgramUniform1d + GLuint program + GLint location + GLdouble v0 + + + void glProgramUniform1dEXT + GLuint program + GLint location + GLdouble x + + + void glProgramUniform1dv + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform1dvEXT + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform1f + GLuint program + GLint location + GLfloat v0 + + + void glProgramUniform1fEXT + GLuint program + GLint location + GLfloat v0 + + + + void glProgramUniform1fv + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + void glProgramUniform1fvEXT + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + + void glProgramUniform1i + GLuint program + GLint location + GLint v0 + + + void glProgramUniform1i64ARB + GLuint program + GLint location + GLint64 x + + + void glProgramUniform1i64NV + GLuint program + GLint location + GLint64EXT x + + + void glProgramUniform1i64vARB + GLuint program + GLint location + GLsizei count + const GLint64 *value + + + void glProgramUniform1i64vNV + GLuint program + GLint location + GLsizei count + const GLint64EXT *value + + + void glProgramUniform1iEXT + GLuint program + GLint location + GLint v0 + + + + void glProgramUniform1iv + GLuint program + GLint location + GLsizei count + const GLint *value + + + void glProgramUniform1ivEXT + GLuint program + GLint location + GLsizei count + const GLint *value + + + + void glProgramUniform1ui + GLuint program + GLint location + GLuint v0 + + + void glProgramUniform1ui64ARB + GLuint program + GLint location + GLuint64 x + + + void glProgramUniform1ui64NV + GLuint program + GLint location + GLuint64EXT x + + + void glProgramUniform1ui64vARB + GLuint program + GLint location + GLsizei count + const GLuint64 *value + + + void glProgramUniform1ui64vNV + GLuint program + GLint location + GLsizei count + const GLuint64EXT *value + + + void glProgramUniform1uiEXT + GLuint program + GLint location + GLuint v0 + + + + void glProgramUniform1uiv + GLuint program + GLint location + GLsizei count + const GLuint *value + + + void glProgramUniform1uivEXT + GLuint program + GLint location + GLsizei count + const GLuint *value + + + + void glProgramUniform2d + GLuint program + GLint location + GLdouble v0 + GLdouble v1 + + + void glProgramUniform2dEXT + GLuint program + GLint location + GLdouble x + GLdouble y + + + void glProgramUniform2dv + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform2dvEXT + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform2f + GLuint program + GLint location + GLfloat v0 + GLfloat v1 + + + void glProgramUniform2fEXT + GLuint program + GLint location + GLfloat v0 + GLfloat v1 + + + + void glProgramUniform2fv + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + void glProgramUniform2fvEXT + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + + void glProgramUniform2i + GLuint program + GLint location + GLint v0 + GLint v1 + + + void glProgramUniform2i64ARB + GLuint program + GLint location + GLint64 x + GLint64 y + + + void glProgramUniform2i64NV + GLuint program + GLint location + GLint64EXT x + GLint64EXT y + + + void glProgramUniform2i64vARB + GLuint program + GLint location + GLsizei count + const GLint64 *value + + + void glProgramUniform2i64vNV + GLuint program + GLint location + GLsizei count + const GLint64EXT *value + + + void glProgramUniform2iEXT + GLuint program + GLint location + GLint v0 + GLint v1 + + + + void glProgramUniform2iv + GLuint program + GLint location + GLsizei count + const GLint *value + + + void glProgramUniform2ivEXT + GLuint program + GLint location + GLsizei count + const GLint *value + + + + void glProgramUniform2ui + GLuint program + GLint location + GLuint v0 + GLuint v1 + + + void glProgramUniform2ui64ARB + GLuint program + GLint location + GLuint64 x + GLuint64 y + + + void glProgramUniform2ui64NV + GLuint program + GLint location + GLuint64EXT x + GLuint64EXT y + + + void glProgramUniform2ui64vARB + GLuint program + GLint location + GLsizei count + const GLuint64 *value + + + void glProgramUniform2ui64vNV + GLuint program + GLint location + GLsizei count + const GLuint64EXT *value + + + void glProgramUniform2uiEXT + GLuint program + GLint location + GLuint v0 + GLuint v1 + + + + void glProgramUniform2uiv + GLuint program + GLint location + GLsizei count + const GLuint *value + + + void glProgramUniform2uivEXT + GLuint program + GLint location + GLsizei count + const GLuint *value + + + + void glProgramUniform3d + GLuint program + GLint location + GLdouble v0 + GLdouble v1 + GLdouble v2 + + + void glProgramUniform3dEXT + GLuint program + GLint location + GLdouble x + GLdouble y + GLdouble z + + + void glProgramUniform3dv + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform3dvEXT + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform3f + GLuint program + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + + + void glProgramUniform3fEXT + GLuint program + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + + + + void glProgramUniform3fv + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + void glProgramUniform3fvEXT + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + + void glProgramUniform3i + GLuint program + GLint location + GLint v0 + GLint v1 + GLint v2 + + + void glProgramUniform3i64ARB + GLuint program + GLint location + GLint64 x + GLint64 y + GLint64 z + + + void glProgramUniform3i64NV + GLuint program + GLint location + GLint64EXT x + GLint64EXT y + GLint64EXT z + + + void glProgramUniform3i64vARB + GLuint program + GLint location + GLsizei count + const GLint64 *value + + + void glProgramUniform3i64vNV + GLuint program + GLint location + GLsizei count + const GLint64EXT *value + + + void glProgramUniform3iEXT + GLuint program + GLint location + GLint v0 + GLint v1 + GLint v2 + + + + void glProgramUniform3iv + GLuint program + GLint location + GLsizei count + const GLint *value + + + void glProgramUniform3ivEXT + GLuint program + GLint location + GLsizei count + const GLint *value + + + + void glProgramUniform3ui + GLuint program + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + + + void glProgramUniform3ui64ARB + GLuint program + GLint location + GLuint64 x + GLuint64 y + GLuint64 z + + + void glProgramUniform3ui64NV + GLuint program + GLint location + GLuint64EXT x + GLuint64EXT y + GLuint64EXT z + + + void glProgramUniform3ui64vARB + GLuint program + GLint location + GLsizei count + const GLuint64 *value + + + void glProgramUniform3ui64vNV + GLuint program + GLint location + GLsizei count + const GLuint64EXT *value + + + void glProgramUniform3uiEXT + GLuint program + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + + + + void glProgramUniform3uiv + GLuint program + GLint location + GLsizei count + const GLuint *value + + + void glProgramUniform3uivEXT + GLuint program + GLint location + GLsizei count + const GLuint *value + + + + void glProgramUniform4d + GLuint program + GLint location + GLdouble v0 + GLdouble v1 + GLdouble v2 + GLdouble v3 + + + void glProgramUniform4dEXT + GLuint program + GLint location + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + void glProgramUniform4dv + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform4dvEXT + GLuint program + GLint location + GLsizei count + const GLdouble *value + + + void glProgramUniform4f + GLuint program + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + GLfloat v3 + + + void glProgramUniform4fEXT + GLuint program + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + GLfloat v3 + + + + void glProgramUniform4fv + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + void glProgramUniform4fvEXT + GLuint program + GLint location + GLsizei count + const GLfloat *value + + + + void glProgramUniform4i + GLuint program + GLint location + GLint v0 + GLint v1 + GLint v2 + GLint v3 + + + void glProgramUniform4i64ARB + GLuint program + GLint location + GLint64 x + GLint64 y + GLint64 z + GLint64 w + + + void glProgramUniform4i64NV + GLuint program + GLint location + GLint64EXT x + GLint64EXT y + GLint64EXT z + GLint64EXT w + + + void glProgramUniform4i64vARB + GLuint program + GLint location + GLsizei count + const GLint64 *value + + + void glProgramUniform4i64vNV + GLuint program + GLint location + GLsizei count + const GLint64EXT *value + + + void glProgramUniform4iEXT + GLuint program + GLint location + GLint v0 + GLint v1 + GLint v2 + GLint v3 + + + + void glProgramUniform4iv + GLuint program + GLint location + GLsizei count + const GLint *value + + + void glProgramUniform4ivEXT + GLuint program + GLint location + GLsizei count + const GLint *value + + + + void glProgramUniform4ui + GLuint program + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + GLuint v3 + + + void glProgramUniform4ui64ARB + GLuint program + GLint location + GLuint64 x + GLuint64 y + GLuint64 z + GLuint64 w + + + void glProgramUniform4ui64NV + GLuint program + GLint location + GLuint64EXT x + GLuint64EXT y + GLuint64EXT z + GLuint64EXT w + + + void glProgramUniform4ui64vARB + GLuint program + GLint location + GLsizei count + const GLuint64 *value + + + void glProgramUniform4ui64vNV + GLuint program + GLint location + GLsizei count + const GLuint64EXT *value + + + void glProgramUniform4uiEXT + GLuint program + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + GLuint v3 + + + + void glProgramUniform4uiv + GLuint program + GLint location + GLsizei count + const GLuint *value + + + void glProgramUniform4uivEXT + GLuint program + GLint location + GLsizei count + const GLuint *value + + + + void glProgramUniformHandleui64ARB + GLuint program + GLint location + GLuint64 value + + + void glProgramUniformHandleui64NV + GLuint program + GLint location + GLuint64 value + + + void glProgramUniformHandleui64vARB + GLuint program + GLint location + GLsizei count + const GLuint64 *values + + + void glProgramUniformHandleui64vNV + GLuint program + GLint location + GLsizei count + const GLuint64 *values + + + void glProgramUniformMatrix2dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix2dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix2fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix2fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix2x3dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix2x3dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix2x3fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix2x3fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix2x4dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix2x4dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix2x4fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix2x4fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix3dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix3dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix3fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix3fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix3x2dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix3x2dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix3x2fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix3x2fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix3x4dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix3x4dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix3x4fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix3x4fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix4dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix4dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix4fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix4fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix4x2dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix4x2dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix4x2fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix4x2fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformMatrix4x3dv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix4x3dvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glProgramUniformMatrix4x3fv + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glProgramUniformMatrix4x3fvEXT + GLuint program + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glProgramUniformui64NV + GLuint program + GLint location + GLuint64EXT value + + + void glProgramUniformui64vNV + GLuint program + GLint location + GLsizei count + const GLuint64EXT *value + + + void glProgramVertexLimitNV + GLenum target + GLint limit + + + void glProvokingVertex + GLenum mode + + + void glProvokingVertexEXT + GLenum mode + + + + void glPushAttrib + GLbitfield mask + + + + void glPushClientAttrib + GLbitfield mask + + + void glPushClientAttribDefaultEXT + GLbitfield mask + + + void glPushDebugGroup + GLenum source + GLuint id + GLsizei length + const GLchar *message + + + void glPushDebugGroupKHR + GLenum source + GLuint id + GLsizei length + const GLchar *message + + + + void glPushGroupMarkerEXT + GLsizei length + const GLchar *marker + + + void glPushMatrix + + + + void glPushName + GLuint name + + + + void glQueryCounter + GLuint id + GLenum target + + + void glQueryCounterEXT + GLuint id + GLenum target + + + + GLbitfield glQueryMatrixxOES + GLfixed *mantissa + GLint *exponent + + + void glQueryObjectParameteruiAMD + GLenum target + GLuint id + GLenum pname + GLuint param + + + void glRasterPos2d + GLdouble x + GLdouble y + + + + void glRasterPos2dv + const GLdouble *v + + + + void glRasterPos2f + GLfloat x + GLfloat y + + + + void glRasterPos2fv + const GLfloat *v + + + + void glRasterPos2i + GLint x + GLint y + + + + void glRasterPos2iv + const GLint *v + + + + void glRasterPos2s + GLshort x + GLshort y + + + + void glRasterPos2sv + const GLshort *v + + + + void glRasterPos2xOES + GLfixed x + GLfixed y + + + void glRasterPos2xvOES + const GLfixed *coords + + + void glRasterPos3d + GLdouble x + GLdouble y + GLdouble z + + + + void glRasterPos3dv + const GLdouble *v + + + + void glRasterPos3f + GLfloat x + GLfloat y + GLfloat z + + + + void glRasterPos3fv + const GLfloat *v + + + + void glRasterPos3i + GLint x + GLint y + GLint z + + + + void glRasterPos3iv + const GLint *v + + + + void glRasterPos3s + GLshort x + GLshort y + GLshort z + + + + void glRasterPos3sv + const GLshort *v + + + + void glRasterPos3xOES + GLfixed x + GLfixed y + GLfixed z + + + void glRasterPos3xvOES + const GLfixed *coords + + + void glRasterPos4d + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glRasterPos4dv + const GLdouble *v + + + + void glRasterPos4f + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glRasterPos4fv + const GLfloat *v + + + + void glRasterPos4i + GLint x + GLint y + GLint z + GLint w + + + + void glRasterPos4iv + const GLint *v + + + + void glRasterPos4s + GLshort x + GLshort y + GLshort z + GLshort w + + + + void glRasterPos4sv + const GLshort *v + + + + void glRasterPos4xOES + GLfixed x + GLfixed y + GLfixed z + GLfixed w + + + void glRasterPos4xvOES + const GLfixed *coords + + + void glRasterSamplesEXT + GLuint samples + GLboolean fixedsamplelocations + + + void glReadBuffer + GLenum src + + + + void glReadBufferIndexedEXT + GLenum src + GLint index + + + void glReadBufferNV + GLenum mode + + + void glReadInstrumentsSGIX + GLint marker + + + + void glReadPixels + GLint x + GLint y + GLsizei width + GLsizei height + GLenum format + GLenum type + void *pixels + + + + + void glReadnPixels + GLint x + GLint y + GLsizei width + GLsizei height + GLenum format + GLenum type + GLsizei bufSize + void *data + + + void glReadnPixelsARB + GLint x + GLint y + GLsizei width + GLsizei height + GLenum format + GLenum type + GLsizei bufSize + void *data + + + + void glReadnPixelsEXT + GLint x + GLint y + GLsizei width + GLsizei height + GLenum format + GLenum type + GLsizei bufSize + void *data + + + + void glReadnPixelsKHR + GLint x + GLint y + GLsizei width + GLsizei height + GLenum format + GLenum type + GLsizei bufSize + void *data + + + + void glRectd + GLdouble x1 + GLdouble y1 + GLdouble x2 + GLdouble y2 + + + + void glRectdv + const GLdouble *v1 + const GLdouble *v2 + + + + void glRectf + GLfloat x1 + GLfloat y1 + GLfloat x2 + GLfloat y2 + + + + void glRectfv + const GLfloat *v1 + const GLfloat *v2 + + + + void glRecti + GLint x1 + GLint y1 + GLint x2 + GLint y2 + + + + void glRectiv + const GLint *v1 + const GLint *v2 + + + + void glRects + GLshort x1 + GLshort y1 + GLshort x2 + GLshort y2 + + + + void glRectsv + const GLshort *v1 + const GLshort *v2 + + + + void glRectxOES + GLfixed x1 + GLfixed y1 + GLfixed x2 + GLfixed y2 + + + void glRectxvOES + const GLfixed *v1 + const GLfixed *v2 + + + void glReferencePlaneSGIX + const GLdouble *equation + + + + void glReleaseShaderCompiler + + + GLint glRenderMode + GLenum mode + + + + void glRenderbufferStorage + GLenum target + GLenum internalformat + GLsizei width + GLsizei height + + + + void glRenderbufferStorageEXT + GLenum target + GLenum internalformat + GLsizei width + GLsizei height + + + + + void glRenderbufferStorageMultisample + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + + void glRenderbufferStorageMultisampleANGLE + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + void glRenderbufferStorageMultisampleAPPLE + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + void glRenderbufferStorageMultisampleCoverageNV + GLenum target + GLsizei coverageSamples + GLsizei colorSamples + GLenum internalformat + GLsizei width + GLsizei height + + + void glRenderbufferStorageMultisampleEXT + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + + + void glRenderbufferStorageMultisampleIMG + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + void glRenderbufferStorageMultisampleNV + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + + + + void glRenderbufferStorageOES + GLenum target + GLenum internalformat + GLsizei width + GLsizei height + + + void glReplacementCodePointerSUN + GLenum type + GLsizei stride + const void **pointer + + + void glReplacementCodeubSUN + GLubyte code + + + void glReplacementCodeubvSUN + const GLubyte *code + + + void glReplacementCodeuiColor3fVertex3fSUN + GLuint rc + GLfloat r + GLfloat g + GLfloat b + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiColor3fVertex3fvSUN + const GLuint *rc + const GLfloat *c + const GLfloat *v + + + void glReplacementCodeuiColor4fNormal3fVertex3fSUN + GLuint rc + GLfloat r + GLfloat g + GLfloat b + GLfloat a + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiColor4fNormal3fVertex3fvSUN + const GLuint *rc + const GLfloat *c + const GLfloat *n + const GLfloat *v + + + void glReplacementCodeuiColor4ubVertex3fSUN + GLuint rc + GLubyte r + GLubyte g + GLubyte b + GLubyte a + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiColor4ubVertex3fvSUN + const GLuint *rc + const GLubyte *c + const GLfloat *v + + + void glReplacementCodeuiNormal3fVertex3fSUN + GLuint rc + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiNormal3fVertex3fvSUN + const GLuint *rc + const GLfloat *n + const GLfloat *v + + + void glReplacementCodeuiSUN + GLuint code + + + void glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN + GLuint rc + GLfloat s + GLfloat t + GLfloat r + GLfloat g + GLfloat b + GLfloat a + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN + const GLuint *rc + const GLfloat *tc + const GLfloat *c + const GLfloat *n + const GLfloat *v + + + void glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN + GLuint rc + GLfloat s + GLfloat t + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN + const GLuint *rc + const GLfloat *tc + const GLfloat *n + const GLfloat *v + + + void glReplacementCodeuiTexCoord2fVertex3fSUN + GLuint rc + GLfloat s + GLfloat t + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiTexCoord2fVertex3fvSUN + const GLuint *rc + const GLfloat *tc + const GLfloat *v + + + void glReplacementCodeuiVertex3fSUN + GLuint rc + GLfloat x + GLfloat y + GLfloat z + + + void glReplacementCodeuiVertex3fvSUN + const GLuint *rc + const GLfloat *v + + + void glReplacementCodeuivSUN + const GLuint *code + + + void glReplacementCodeusSUN + GLushort code + + + void glReplacementCodeusvSUN + const GLushort *code + + + void glRequestResidentProgramsNV + GLsizei n + const GLuint *programs + + + + void glResetHistogram + GLenum target + + + + void glResetHistogramEXT + GLenum target + + + + + void glResetMinmax + GLenum target + + + + void glResetMinmaxEXT + GLenum target + + + + + void glResizeBuffersMESA + + + void glResolveDepthValuesNV + + + void glResolveMultisampleFramebufferAPPLE + + + void glResumeTransformFeedback + + + void glResumeTransformFeedbackNV + + + + void glRotated + GLdouble angle + GLdouble x + GLdouble y + GLdouble z + + + + void glRotatef + GLfloat angle + GLfloat x + GLfloat y + GLfloat z + + + + void glRotatex + GLfixed angle + GLfixed x + GLfixed y + GLfixed z + + + void glRotatexOES + GLfixed angle + GLfixed x + GLfixed y + GLfixed z + + + void glSampleCoverage + GLfloat value + GLboolean invert + + + + void glSampleCoverageARB + GLfloat value + GLboolean invert + + + + void glSampleCoveragex + GLclampx value + GLboolean invert + + + void glSampleCoveragexOES + GLclampx value + GLboolean invert + + + void glSampleMapATI + GLuint dst + GLuint interp + GLenum swizzle + + + void glSampleMaskEXT + GLclampf value + GLboolean invert + + + void glSampleMaskIndexedNV + GLuint index + GLbitfield mask + + + void glSampleMaskSGIS + GLclampf value + GLboolean invert + + + + + void glSampleMaski + GLuint maskNumber + GLbitfield mask + + + void glSamplePatternEXT + GLenum pattern + + + void glSamplePatternSGIS + GLenum pattern + + + + + void glSamplerParameterIiv + GLuint sampler + GLenum pname + const GLint *param + + + void glSamplerParameterIivEXT + GLuint sampler + GLenum pname + const GLint *param + + + + void glSamplerParameterIivOES + GLuint sampler + GLenum pname + const GLint *param + + + + void glSamplerParameterIuiv + GLuint sampler + GLenum pname + const GLuint *param + + + void glSamplerParameterIuivEXT + GLuint sampler + GLenum pname + const GLuint *param + + + + void glSamplerParameterIuivOES + GLuint sampler + GLenum pname + const GLuint *param + + + + void glSamplerParameterf + GLuint sampler + GLenum pname + GLfloat param + + + void glSamplerParameterfv + GLuint sampler + GLenum pname + const GLfloat *param + + + void glSamplerParameteri + GLuint sampler + GLenum pname + GLint param + + + void glSamplerParameteriv + GLuint sampler + GLenum pname + const GLint *param + + + void glScaled + GLdouble x + GLdouble y + GLdouble z + + + + void glScalef + GLfloat x + GLfloat y + GLfloat z + + + + void glScalex + GLfixed x + GLfixed y + GLfixed z + + + void glScalexOES + GLfixed x + GLfixed y + GLfixed z + + + void glScissor + GLint x + GLint y + GLsizei width + GLsizei height + + + + void glScissorArrayv + GLuint first + GLsizei count + const GLint *v + + + void glScissorArrayvNV + GLuint first + GLsizei count + const GLint *v + + + + void glScissorIndexed + GLuint index + GLint left + GLint bottom + GLsizei width + GLsizei height + + + void glScissorIndexedNV + GLuint index + GLint left + GLint bottom + GLsizei width + GLsizei height + + + + void glScissorIndexedv + GLuint index + const GLint *v + + + void glScissorIndexedvNV + GLuint index + const GLint *v + + + + void glSecondaryColor3b + GLbyte red + GLbyte green + GLbyte blue + + + + void glSecondaryColor3bEXT + GLbyte red + GLbyte green + GLbyte blue + + + + + void glSecondaryColor3bv + const GLbyte *v + + + + void glSecondaryColor3bvEXT + const GLbyte *v + + + + + void glSecondaryColor3d + GLdouble red + GLdouble green + GLdouble blue + + + + void glSecondaryColor3dEXT + GLdouble red + GLdouble green + GLdouble blue + + + + + void glSecondaryColor3dv + const GLdouble *v + + + + void glSecondaryColor3dvEXT + const GLdouble *v + + + + + void glSecondaryColor3f + GLfloat red + GLfloat green + GLfloat blue + + + + void glSecondaryColor3fEXT + GLfloat red + GLfloat green + GLfloat blue + + + + + void glSecondaryColor3fv + const GLfloat *v + + + + void glSecondaryColor3fvEXT + const GLfloat *v + + + + + void glSecondaryColor3hNV + GLhalfNV red + GLhalfNV green + GLhalfNV blue + + + + void glSecondaryColor3hvNV + const GLhalfNV *v + + + + void glSecondaryColor3i + GLint red + GLint green + GLint blue + + + + void glSecondaryColor3iEXT + GLint red + GLint green + GLint blue + + + + + void glSecondaryColor3iv + const GLint *v + + + + void glSecondaryColor3ivEXT + const GLint *v + + + + + void glSecondaryColor3s + GLshort red + GLshort green + GLshort blue + + + + void glSecondaryColor3sEXT + GLshort red + GLshort green + GLshort blue + + + + + void glSecondaryColor3sv + const GLshort *v + + + + void glSecondaryColor3svEXT + const GLshort *v + + + + + void glSecondaryColor3ub + GLubyte red + GLubyte green + GLubyte blue + + + + void glSecondaryColor3ubEXT + GLubyte red + GLubyte green + GLubyte blue + + + + + void glSecondaryColor3ubv + const GLubyte *v + + + + void glSecondaryColor3ubvEXT + const GLubyte *v + + + + + void glSecondaryColor3ui + GLuint red + GLuint green + GLuint blue + + + + void glSecondaryColor3uiEXT + GLuint red + GLuint green + GLuint blue + + + + + void glSecondaryColor3uiv + const GLuint *v + + + + void glSecondaryColor3uivEXT + const GLuint *v + + + + + void glSecondaryColor3us + GLushort red + GLushort green + GLushort blue + + + + void glSecondaryColor3usEXT + GLushort red + GLushort green + GLushort blue + + + + + void glSecondaryColor3usv + const GLushort *v + + + + void glSecondaryColor3usvEXT + const GLushort *v + + + + + void glSecondaryColorFormatNV + GLint size + GLenum type + GLsizei stride + + + void glSecondaryColorP3ui + GLenum type + GLuint color + + + void glSecondaryColorP3uiv + GLenum type + const GLuint *color + + + void glSecondaryColorPointer + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glSecondaryColorPointerEXT + GLint size + GLenum type + GLsizei stride + const void *pointer + + + + void glSecondaryColorPointerListIBM + GLint size + GLenum type + GLint stride + const void **pointer + GLint ptrstride + + + void glSelectBuffer + GLsizei size + GLuint *buffer + + + + void glSelectPerfMonitorCountersAMD + GLuint monitor + GLboolean enable + GLuint group + GLint numCounters + GLuint *counterList + + + void glSeparableFilter2D + GLenum target + GLenum internalformat + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *row + const void *column + + + + + void glSeparableFilter2DEXT + GLenum target + GLenum internalformat + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *row + const void *column + + + + + void glSetFenceAPPLE + GLuint fence + + + void glSetFenceNV + GLuint fence + GLenum condition + + + void glSetFragmentShaderConstantATI + GLuint dst + const GLfloat *value + + + void glSetInvariantEXT + GLuint id + GLenum type + const void *addr + + + void glSetLocalConstantEXT + GLuint id + GLenum type + const void *addr + + + void glSetMultisamplefvAMD + GLenum pname + GLuint index + const GLfloat *val + + + void glShadeModel + GLenum mode + + + + void glShaderBinary + GLsizei count + const GLuint *shaders + GLenum binaryformat + const void *binary + GLsizei length + + + void glShaderOp1EXT + GLenum op + GLuint res + GLuint arg1 + + + void glShaderOp2EXT + GLenum op + GLuint res + GLuint arg1 + GLuint arg2 + + + void glShaderOp3EXT + GLenum op + GLuint res + GLuint arg1 + GLuint arg2 + GLuint arg3 + + + void glShaderSource + GLuint shader + GLsizei count + const GLchar *const*string + const GLint *length + + + void glShaderSourceARB + GLhandleARB shaderObj + GLsizei count + const GLcharARB **string + const GLint *length + + + + void glShaderStorageBlockBinding + GLuint program + GLuint storageBlockIndex + GLuint storageBlockBinding + + + void glSharpenTexFuncSGIS + GLenum target + GLsizei n + const GLfloat *points + + + + void glSpriteParameterfSGIX + GLenum pname + GLfloat param + + + + void glSpriteParameterfvSGIX + GLenum pname + const GLfloat *params + + + + void glSpriteParameteriSGIX + GLenum pname + GLint param + + + + void glSpriteParameterivSGIX + GLenum pname + const GLint *params + + + + void glStartInstrumentsSGIX + + + + void glStartTilingQCOM + GLuint x + GLuint y + GLuint width + GLuint height + GLbitfield preserveMask + + + void glStateCaptureNV + GLuint state + GLenum mode + + + void glStencilClearTagEXT + GLsizei stencilTagBits + GLuint stencilClearTag + + + + void glStencilFillPathInstancedNV + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLenum fillMode + GLuint mask + GLenum transformType + const GLfloat *transformValues + + + void glStencilFillPathNV + GLuint path + GLenum fillMode + GLuint mask + + + void glStencilFunc + GLenum func + GLint ref + GLuint mask + + + + void glStencilFuncSeparate + GLenum face + GLenum func + GLint ref + GLuint mask + + + void glStencilFuncSeparateATI + GLenum frontfunc + GLenum backfunc + GLint ref + GLuint mask + + + void glStencilMask + GLuint mask + + + + void glStencilMaskSeparate + GLenum face + GLuint mask + + + void glStencilOp + GLenum fail + GLenum zfail + GLenum zpass + + + + void glStencilOpSeparate + GLenum face + GLenum sfail + GLenum dpfail + GLenum dppass + + + void glStencilOpSeparateATI + GLenum face + GLenum sfail + GLenum dpfail + GLenum dppass + + + + void glStencilOpValueAMD + GLenum face + GLuint value + + + void glStencilStrokePathInstancedNV + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLint reference + GLuint mask + GLenum transformType + const GLfloat *transformValues + + + void glStencilStrokePathNV + GLuint path + GLint reference + GLuint mask + + + void glStencilThenCoverFillPathInstancedNV + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLenum fillMode + GLuint mask + GLenum coverMode + GLenum transformType + const GLfloat *transformValues + + + void glStencilThenCoverFillPathNV + GLuint path + GLenum fillMode + GLuint mask + GLenum coverMode + + + void glStencilThenCoverStrokePathInstancedNV + GLsizei numPaths + GLenum pathNameType + const void *paths + GLuint pathBase + GLint reference + GLuint mask + GLenum coverMode + GLenum transformType + const GLfloat *transformValues + + + void glStencilThenCoverStrokePathNV + GLuint path + GLint reference + GLuint mask + GLenum coverMode + + + void glStopInstrumentsSGIX + GLint marker + + + + void glStringMarkerGREMEDY + GLsizei len + const void *string + + + void glSubpixelPrecisionBiasNV + GLuint xbits + GLuint ybits + + + void glSwizzleEXT + GLuint res + GLuint in + GLenum outX + GLenum outY + GLenum outZ + GLenum outW + + + void glSyncTextureINTEL + GLuint texture + + + void glTagSampleBufferSGIX + + + + void glTangent3bEXT + GLbyte tx + GLbyte ty + GLbyte tz + + + + void glTangent3bvEXT + const GLbyte *v + + + void glTangent3dEXT + GLdouble tx + GLdouble ty + GLdouble tz + + + + void glTangent3dvEXT + const GLdouble *v + + + void glTangent3fEXT + GLfloat tx + GLfloat ty + GLfloat tz + + + + void glTangent3fvEXT + const GLfloat *v + + + void glTangent3iEXT + GLint tx + GLint ty + GLint tz + + + + void glTangent3ivEXT + const GLint *v + + + void glTangent3sEXT + GLshort tx + GLshort ty + GLshort tz + + + + void glTangent3svEXT + const GLshort *v + + + void glTangentPointerEXT + GLenum type + GLsizei stride + const void *pointer + + + void glTbufferMask3DFX + GLuint mask + + + void glTessellationFactorAMD + GLfloat factor + + + void glTessellationModeAMD + GLenum mode + + + GLboolean glTestFenceAPPLE + GLuint fence + + + GLboolean glTestFenceNV + GLuint fence + + + + GLboolean glTestObjectAPPLE + GLenum object + GLuint name + + + void glTexBuffer + GLenum target + GLenum internalformat + GLuint buffer + + + void glTexBufferARB + GLenum target + GLenum internalformat + GLuint buffer + + + + void glTexBufferEXT + GLenum target + GLenum internalformat + GLuint buffer + + + + void glTexBufferOES + GLenum target + GLenum internalformat + GLuint buffer + + + + void glTexBufferRange + GLenum target + GLenum internalformat + GLuint buffer + GLintptr offset + GLsizeiptr size + + + void glTexBufferRangeEXT + GLenum target + GLenum internalformat + GLuint buffer + GLintptr offset + GLsizeiptr size + + + + void glTexBufferRangeOES + GLenum target + GLenum internalformat + GLuint buffer + GLintptr offset + GLsizeiptr size + + + + void glTexBumpParameterfvATI + GLenum pname + const GLfloat *param + + + void glTexBumpParameterivATI + GLenum pname + const GLint *param + + + void glTexCoord1bOES + GLbyte s + + + void glTexCoord1bvOES + const GLbyte *coords + + + void glTexCoord1d + GLdouble s + + + + void glTexCoord1dv + const GLdouble *v + + + + void glTexCoord1f + GLfloat s + + + + void glTexCoord1fv + const GLfloat *v + + + + void glTexCoord1hNV + GLhalfNV s + + + + void glTexCoord1hvNV + const GLhalfNV *v + + + + void glTexCoord1i + GLint s + + + + void glTexCoord1iv + const GLint *v + + + + void glTexCoord1s + GLshort s + + + + void glTexCoord1sv + const GLshort *v + + + + void glTexCoord1xOES + GLfixed s + + + void glTexCoord1xvOES + const GLfixed *coords + + + void glTexCoord2bOES + GLbyte s + GLbyte t + + + void glTexCoord2bvOES + const GLbyte *coords + + + void glTexCoord2d + GLdouble s + GLdouble t + + + + void glTexCoord2dv + const GLdouble *v + + + + void glTexCoord2f + GLfloat s + GLfloat t + + + + void glTexCoord2fColor3fVertex3fSUN + GLfloat s + GLfloat t + GLfloat r + GLfloat g + GLfloat b + GLfloat x + GLfloat y + GLfloat z + + + void glTexCoord2fColor3fVertex3fvSUN + const GLfloat *tc + const GLfloat *c + const GLfloat *v + + + void glTexCoord2fColor4fNormal3fVertex3fSUN + GLfloat s + GLfloat t + GLfloat r + GLfloat g + GLfloat b + GLfloat a + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glTexCoord2fColor4fNormal3fVertex3fvSUN + const GLfloat *tc + const GLfloat *c + const GLfloat *n + const GLfloat *v + + + void glTexCoord2fColor4ubVertex3fSUN + GLfloat s + GLfloat t + GLubyte r + GLubyte g + GLubyte b + GLubyte a + GLfloat x + GLfloat y + GLfloat z + + + void glTexCoord2fColor4ubVertex3fvSUN + const GLfloat *tc + const GLubyte *c + const GLfloat *v + + + void glTexCoord2fNormal3fVertex3fSUN + GLfloat s + GLfloat t + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + + + void glTexCoord2fNormal3fVertex3fvSUN + const GLfloat *tc + const GLfloat *n + const GLfloat *v + + + void glTexCoord2fVertex3fSUN + GLfloat s + GLfloat t + GLfloat x + GLfloat y + GLfloat z + + + void glTexCoord2fVertex3fvSUN + const GLfloat *tc + const GLfloat *v + + + void glTexCoord2fv + const GLfloat *v + + + + void glTexCoord2hNV + GLhalfNV s + GLhalfNV t + + + + void glTexCoord2hvNV + const GLhalfNV *v + + + + void glTexCoord2i + GLint s + GLint t + + + + void glTexCoord2iv + const GLint *v + + + + void glTexCoord2s + GLshort s + GLshort t + + + + void glTexCoord2sv + const GLshort *v + + + + void glTexCoord2xOES + GLfixed s + GLfixed t + + + void glTexCoord2xvOES + const GLfixed *coords + + + void glTexCoord3bOES + GLbyte s + GLbyte t + GLbyte r + + + void glTexCoord3bvOES + const GLbyte *coords + + + void glTexCoord3d + GLdouble s + GLdouble t + GLdouble r + + + + void glTexCoord3dv + const GLdouble *v + + + + void glTexCoord3f + GLfloat s + GLfloat t + GLfloat r + + + + void glTexCoord3fv + const GLfloat *v + + + + void glTexCoord3hNV + GLhalfNV s + GLhalfNV t + GLhalfNV r + + + + void glTexCoord3hvNV + const GLhalfNV *v + + + + void glTexCoord3i + GLint s + GLint t + GLint r + + + + void glTexCoord3iv + const GLint *v + + + + void glTexCoord3s + GLshort s + GLshort t + GLshort r + + + + void glTexCoord3sv + const GLshort *v + + + + void glTexCoord3xOES + GLfixed s + GLfixed t + GLfixed r + + + void glTexCoord3xvOES + const GLfixed *coords + + + void glTexCoord4bOES + GLbyte s + GLbyte t + GLbyte r + GLbyte q + + + void glTexCoord4bvOES + const GLbyte *coords + + + void glTexCoord4d + GLdouble s + GLdouble t + GLdouble r + GLdouble q + + + + void glTexCoord4dv + const GLdouble *v + + + + void glTexCoord4f + GLfloat s + GLfloat t + GLfloat r + GLfloat q + + + + void glTexCoord4fColor4fNormal3fVertex4fSUN + GLfloat s + GLfloat t + GLfloat p + GLfloat q + GLfloat r + GLfloat g + GLfloat b + GLfloat a + GLfloat nx + GLfloat ny + GLfloat nz + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + void glTexCoord4fColor4fNormal3fVertex4fvSUN + const GLfloat *tc + const GLfloat *c + const GLfloat *n + const GLfloat *v + + + void glTexCoord4fVertex4fSUN + GLfloat s + GLfloat t + GLfloat p + GLfloat q + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + void glTexCoord4fVertex4fvSUN + const GLfloat *tc + const GLfloat *v + + + void glTexCoord4fv + const GLfloat *v + + + + void glTexCoord4hNV + GLhalfNV s + GLhalfNV t + GLhalfNV r + GLhalfNV q + + + + void glTexCoord4hvNV + const GLhalfNV *v + + + + void glTexCoord4i + GLint s + GLint t + GLint r + GLint q + + + + void glTexCoord4iv + const GLint *v + + + + void glTexCoord4s + GLshort s + GLshort t + GLshort r + GLshort q + + + + void glTexCoord4sv + const GLshort *v + + + + void glTexCoord4xOES + GLfixed s + GLfixed t + GLfixed r + GLfixed q + + + void glTexCoord4xvOES + const GLfixed *coords + + + void glTexCoordFormatNV + GLint size + GLenum type + GLsizei stride + + + void glTexCoordP1ui + GLenum type + GLuint coords + + + void glTexCoordP1uiv + GLenum type + const GLuint *coords + + + void glTexCoordP2ui + GLenum type + GLuint coords + + + void glTexCoordP2uiv + GLenum type + const GLuint *coords + + + void glTexCoordP3ui + GLenum type + GLuint coords + + + void glTexCoordP3uiv + GLenum type + const GLuint *coords + + + void glTexCoordP4ui + GLenum type + GLuint coords + + + void glTexCoordP4uiv + GLenum type + const GLuint *coords + + + void glTexCoordPointer + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glTexCoordPointerEXT + GLint size + GLenum type + GLsizei stride + GLsizei count + const void *pointer + + + void glTexCoordPointerListIBM + GLint size + GLenum type + GLint stride + const void **pointer + GLint ptrstride + + + void glTexCoordPointervINTEL + GLint size + GLenum type + const void **pointer + + + void glTexEnvf + GLenum target + GLenum pname + GLfloat param + + + + void glTexEnvfv + GLenum target + GLenum pname + const GLfloat *params + + + + void glTexEnvi + GLenum target + GLenum pname + GLint param + + + + void glTexEnviv + GLenum target + GLenum pname + const GLint *params + + + + void glTexEnvx + GLenum target + GLenum pname + GLfixed param + + + void glTexEnvxOES + GLenum target + GLenum pname + GLfixed param + + + void glTexEnvxv + GLenum target + GLenum pname + const GLfixed *params + + + void glTexEnvxvOES + GLenum target + GLenum pname + const GLfixed *params + + + void glTexFilterFuncSGIS + GLenum target + GLenum filter + GLsizei n + const GLfloat *weights + + + + void glTexGend + GLenum coord + GLenum pname + GLdouble param + + + + void glTexGendv + GLenum coord + GLenum pname + const GLdouble *params + + + + void glTexGenf + GLenum coord + GLenum pname + GLfloat param + + + + void glTexGenfOES + GLenum coord + GLenum pname + GLfloat param + + + void glTexGenfv + GLenum coord + GLenum pname + const GLfloat *params + + + + void glTexGenfvOES + GLenum coord + GLenum pname + const GLfloat *params + + + void glTexGeni + GLenum coord + GLenum pname + GLint param + + + + void glTexGeniOES + GLenum coord + GLenum pname + GLint param + + + void glTexGeniv + GLenum coord + GLenum pname + const GLint *params + + + + void glTexGenivOES + GLenum coord + GLenum pname + const GLint *params + + + void glTexGenxOES + GLenum coord + GLenum pname + GLfixed param + + + void glTexGenxvOES + GLenum coord + GLenum pname + const GLfixed *params + + + void glTexImage1D + GLenum target + GLint level + GLint internalformat + GLsizei width + GLint border + GLenum format + GLenum type + const void *pixels + + + + + void glTexImage2D + GLenum target + GLint level + GLint internalformat + GLsizei width + GLsizei height + GLint border + GLenum format + GLenum type + const void *pixels + + + + + void glTexImage2DMultisample + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLboolean fixedsamplelocations + + + void glTexImage2DMultisampleCoverageNV + GLenum target + GLsizei coverageSamples + GLsizei colorSamples + GLint internalFormat + GLsizei width + GLsizei height + GLboolean fixedSampleLocations + + + void glTexImage3D + GLenum target + GLint level + GLint internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLenum format + GLenum type + const void *pixels + + + + + void glTexImage3DEXT + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLenum format + GLenum type + const void *pixels + + + + + void glTexImage3DMultisample + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedsamplelocations + + + void glTexImage3DMultisampleCoverageNV + GLenum target + GLsizei coverageSamples + GLsizei colorSamples + GLint internalFormat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedSampleLocations + + + void glTexImage3DOES + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLenum format + GLenum type + const void *pixels + + + + void glTexImage4DSGIS + GLenum target + GLint level + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLsizei size4d + GLint border + GLenum format + GLenum type + const void *pixels + + + + void glTexPageCommitmentARB + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLboolean commit + + + void glTexPageCommitmentEXT + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLboolean commit + + + + void glTexParameterIiv + GLenum target + GLenum pname + const GLint *params + + + + void glTexParameterIivEXT + GLenum target + GLenum pname + const GLint *params + + + + void glTexParameterIivOES + GLenum target + GLenum pname + const GLint *params + + + + void glTexParameterIuiv + GLenum target + GLenum pname + const GLuint *params + + + + void glTexParameterIuivEXT + GLenum target + GLenum pname + const GLuint *params + + + + void glTexParameterIuivOES + GLenum target + GLenum pname + const GLuint *params + + + + void glTexParameterf + GLenum target + GLenum pname + GLfloat param + + + + void glTexParameterfv + GLenum target + GLenum pname + const GLfloat *params + + + + void glTexParameteri + GLenum target + GLenum pname + GLint param + + + + void glTexParameteriv + GLenum target + GLenum pname + const GLint *params + + + + void glTexParameterx + GLenum target + GLenum pname + GLfixed param + + + void glTexParameterxOES + GLenum target + GLenum pname + GLfixed param + + + void glTexParameterxv + GLenum target + GLenum pname + const GLfixed *params + + + void glTexParameterxvOES + GLenum target + GLenum pname + const GLfixed *params + + + void glTexRenderbufferNV + GLenum target + GLuint renderbuffer + + + void glTexStorage1D + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + + + void glTexStorage1DEXT + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + + + + void glTexStorage2D + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + + + void glTexStorage2DEXT + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + + + + void glTexStorage2DMultisample + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLboolean fixedsamplelocations + + + void glTexStorage3D + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + + + void glTexStorage3DEXT + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + + + + void glTexStorage3DMultisample + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedsamplelocations + + + void glTexStorage3DMultisampleOES + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedsamplelocations + + + + void glTexStorageSparseAMD + GLenum target + GLenum internalFormat + GLsizei width + GLsizei height + GLsizei depth + GLsizei layers + GLbitfield flags + + + void glTexSubImage1D + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLenum type + const void *pixels + + + + + void glTexSubImage1DEXT + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLenum type + const void *pixels + + + + + void glTexSubImage2D + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *pixels + + + + + void glTexSubImage2DEXT + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *pixels + + + + + void glTexSubImage3D + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + const void *pixels + + + + + void glTexSubImage3DEXT + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + const void *pixels + + + + + void glTexSubImage3DOES + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + const void *pixels + + + + void glTexSubImage4DSGIS + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLint woffset + GLsizei width + GLsizei height + GLsizei depth + GLsizei size4d + GLenum format + GLenum type + const void *pixels + + + + void glTextureBarrier + + + void glTextureBarrierNV + + + + void glTextureBuffer + GLuint texture + GLenum internalformat + GLuint buffer + + + void glTextureBufferEXT + GLuint texture + GLenum target + GLenum internalformat + GLuint buffer + + + void glTextureBufferRange + GLuint texture + GLenum internalformat + GLuint buffer + GLintptr offset + GLsizeiptr size + + + void glTextureBufferRangeEXT + GLuint texture + GLenum target + GLenum internalformat + GLuint buffer + GLintptr offset + GLsizeiptr size + + + void glTextureColorMaskSGIS + GLboolean red + GLboolean green + GLboolean blue + GLboolean alpha + + + + void glTextureImage1DEXT + GLuint texture + GLenum target + GLint level + GLint internalformat + GLsizei width + GLint border + GLenum format + GLenum type + const void *pixels + + + void glTextureImage2DEXT + GLuint texture + GLenum target + GLint level + GLint internalformat + GLsizei width + GLsizei height + GLint border + GLenum format + GLenum type + const void *pixels + + + void glTextureImage2DMultisampleCoverageNV + GLuint texture + GLenum target + GLsizei coverageSamples + GLsizei colorSamples + GLint internalFormat + GLsizei width + GLsizei height + GLboolean fixedSampleLocations + + + void glTextureImage2DMultisampleNV + GLuint texture + GLenum target + GLsizei samples + GLint internalFormat + GLsizei width + GLsizei height + GLboolean fixedSampleLocations + + + void glTextureImage3DEXT + GLuint texture + GLenum target + GLint level + GLint internalformat + GLsizei width + GLsizei height + GLsizei depth + GLint border + GLenum format + GLenum type + const void *pixels + + + void glTextureImage3DMultisampleCoverageNV + GLuint texture + GLenum target + GLsizei coverageSamples + GLsizei colorSamples + GLint internalFormat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedSampleLocations + + + void glTextureImage3DMultisampleNV + GLuint texture + GLenum target + GLsizei samples + GLint internalFormat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedSampleLocations + + + void glTextureLightEXT + GLenum pname + + + void glTextureMaterialEXT + GLenum face + GLenum mode + + + void glTextureNormalEXT + GLenum mode + + + void glTexturePageCommitmentEXT + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLboolean commit + + + void glTextureParameterIiv + GLuint texture + GLenum pname + const GLint *params + + + void glTextureParameterIivEXT + GLuint texture + GLenum target + GLenum pname + const GLint *params + + + void glTextureParameterIuiv + GLuint texture + GLenum pname + const GLuint *params + + + void glTextureParameterIuivEXT + GLuint texture + GLenum target + GLenum pname + const GLuint *params + + + void glTextureParameterf + GLuint texture + GLenum pname + GLfloat param + + + void glTextureParameterfEXT + GLuint texture + GLenum target + GLenum pname + GLfloat param + + + + void glTextureParameterfv + GLuint texture + GLenum pname + const GLfloat *param + + + void glTextureParameterfvEXT + GLuint texture + GLenum target + GLenum pname + const GLfloat *params + + + void glTextureParameteri + GLuint texture + GLenum pname + GLint param + + + void glTextureParameteriEXT + GLuint texture + GLenum target + GLenum pname + GLint param + + + + void glTextureParameteriv + GLuint texture + GLenum pname + const GLint *param + + + void glTextureParameterivEXT + GLuint texture + GLenum target + GLenum pname + const GLint *params + + + void glTextureRangeAPPLE + GLenum target + GLsizei length + const void *pointer + + + void glTextureRenderbufferEXT + GLuint texture + GLenum target + GLuint renderbuffer + + + void glTextureStorage1D + GLuint texture + GLsizei levels + GLenum internalformat + GLsizei width + + + void glTextureStorage1DEXT + GLuint texture + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + + + void glTextureStorage2D + GLuint texture + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + + + void glTextureStorage2DEXT + GLuint texture + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + + + void glTextureStorage2DMultisample + GLuint texture + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLboolean fixedsamplelocations + + + void glTextureStorage2DMultisampleEXT + GLuint texture + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLboolean fixedsamplelocations + + + void glTextureStorage3D + GLuint texture + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + + + void glTextureStorage3DEXT + GLuint texture + GLenum target + GLsizei levels + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + + + void glTextureStorage3DMultisample + GLuint texture + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedsamplelocations + + + void glTextureStorage3DMultisampleEXT + GLuint texture + GLenum target + GLsizei samples + GLenum internalformat + GLsizei width + GLsizei height + GLsizei depth + GLboolean fixedsamplelocations + + + void glTextureStorageSparseAMD + GLuint texture + GLenum target + GLenum internalFormat + GLsizei width + GLsizei height + GLsizei depth + GLsizei layers + GLbitfield flags + + + void glTextureSubImage1D + GLuint texture + GLint level + GLint xoffset + GLsizei width + GLenum format + GLenum type + const void *pixels + + + void glTextureSubImage1DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLsizei width + GLenum format + GLenum type + const void *pixels + + + void glTextureSubImage2D + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *pixels + + + void glTextureSubImage2DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLsizei width + GLsizei height + GLenum format + GLenum type + const void *pixels + + + void glTextureSubImage3D + GLuint texture + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + const void *pixels + + + void glTextureSubImage3DEXT + GLuint texture + GLenum target + GLint level + GLint xoffset + GLint yoffset + GLint zoffset + GLsizei width + GLsizei height + GLsizei depth + GLenum format + GLenum type + const void *pixels + + + void glTextureView + GLuint texture + GLenum target + GLuint origtexture + GLenum internalformat + GLuint minlevel + GLuint numlevels + GLuint minlayer + GLuint numlayers + + + void glTextureViewEXT + GLuint texture + GLenum target + GLuint origtexture + GLenum internalformat + GLuint minlevel + GLuint numlevels + GLuint minlayer + GLuint numlayers + + + + void glTextureViewOES + GLuint texture + GLenum target + GLuint origtexture + GLenum internalformat + GLuint minlevel + GLuint numlevels + GLuint minlayer + GLuint numlayers + + + + void glTrackMatrixNV + GLenum target + GLuint address + GLenum matrix + GLenum transform + + + + void glTransformFeedbackAttribsNV + GLsizei count + const GLint *attribs + GLenum bufferMode + + + void glTransformFeedbackBufferBase + GLuint xfb + GLuint index + GLuint buffer + + + void glTransformFeedbackBufferRange + GLuint xfb + GLuint index + GLuint buffer + GLintptr offset + GLsizeiptr size + + + void glTransformFeedbackStreamAttribsNV + GLsizei count + const GLint *attribs + GLsizei nbuffers + const GLint *bufstreams + GLenum bufferMode + + + void glTransformFeedbackVaryings + GLuint program + GLsizei count + const GLchar *const*varyings + GLenum bufferMode + + + void glTransformFeedbackVaryingsEXT + GLuint program + GLsizei count + const GLchar *const*varyings + GLenum bufferMode + + + + void glTransformFeedbackVaryingsNV + GLuint program + GLsizei count + const GLint *locations + GLenum bufferMode + + + void glTransformPathNV + GLuint resultPath + GLuint srcPath + GLenum transformType + const GLfloat *transformValues + + + void glTranslated + GLdouble x + GLdouble y + GLdouble z + + + + void glTranslatef + GLfloat x + GLfloat y + GLfloat z + + + + void glTranslatex + GLfixed x + GLfixed y + GLfixed z + + + void glTranslatexOES + GLfixed x + GLfixed y + GLfixed z + + + void glUniform1d + GLint location + GLdouble x + + + void glUniform1dv + GLint location + GLsizei count + const GLdouble *value + + + void glUniform1f + GLint location + GLfloat v0 + + + void glUniform1fARB + GLint location + GLfloat v0 + + + + void glUniform1fv + GLint location + GLsizei count + const GLfloat *value + + + void glUniform1fvARB + GLint location + GLsizei count + const GLfloat *value + + + + void glUniform1i + GLint location + GLint v0 + + + void glUniform1i64ARB + GLint location + GLint64 x + + + void glUniform1i64NV + GLint location + GLint64EXT x + + + void glUniform1i64vARB + GLint location + GLsizei count + const GLint64 *value + + + void glUniform1i64vNV + GLint location + GLsizei count + const GLint64EXT *value + + + void glUniform1iARB + GLint location + GLint v0 + + + + void glUniform1iv + GLint location + GLsizei count + const GLint *value + + + void glUniform1ivARB + GLint location + GLsizei count + const GLint *value + + + + void glUniform1ui + GLint location + GLuint v0 + + + void glUniform1ui64ARB + GLint location + GLuint64 x + + + void glUniform1ui64NV + GLint location + GLuint64EXT x + + + void glUniform1ui64vARB + GLint location + GLsizei count + const GLuint64 *value + + + void glUniform1ui64vNV + GLint location + GLsizei count + const GLuint64EXT *value + + + void glUniform1uiEXT + GLint location + GLuint v0 + + + + void glUniform1uiv + GLint location + GLsizei count + const GLuint *value + + + void glUniform1uivEXT + GLint location + GLsizei count + const GLuint *value + + + + void glUniform2d + GLint location + GLdouble x + GLdouble y + + + void glUniform2dv + GLint location + GLsizei count + const GLdouble *value + + + void glUniform2f + GLint location + GLfloat v0 + GLfloat v1 + + + void glUniform2fARB + GLint location + GLfloat v0 + GLfloat v1 + + + + void glUniform2fv + GLint location + GLsizei count + const GLfloat *value + + + void glUniform2fvARB + GLint location + GLsizei count + const GLfloat *value + + + + void glUniform2i + GLint location + GLint v0 + GLint v1 + + + void glUniform2i64ARB + GLint location + GLint64 x + GLint64 y + + + void glUniform2i64NV + GLint location + GLint64EXT x + GLint64EXT y + + + void glUniform2i64vARB + GLint location + GLsizei count + const GLint64 *value + + + void glUniform2i64vNV + GLint location + GLsizei count + const GLint64EXT *value + + + void glUniform2iARB + GLint location + GLint v0 + GLint v1 + + + + void glUniform2iv + GLint location + GLsizei count + const GLint *value + + + void glUniform2ivARB + GLint location + GLsizei count + const GLint *value + + + + void glUniform2ui + GLint location + GLuint v0 + GLuint v1 + + + void glUniform2ui64ARB + GLint location + GLuint64 x + GLuint64 y + + + void glUniform2ui64NV + GLint location + GLuint64EXT x + GLuint64EXT y + + + void glUniform2ui64vARB + GLint location + GLsizei count + const GLuint64 *value + + + void glUniform2ui64vNV + GLint location + GLsizei count + const GLuint64EXT *value + + + void glUniform2uiEXT + GLint location + GLuint v0 + GLuint v1 + + + + void glUniform2uiv + GLint location + GLsizei count + const GLuint *value + + + void glUniform2uivEXT + GLint location + GLsizei count + const GLuint *value + + + + void glUniform3d + GLint location + GLdouble x + GLdouble y + GLdouble z + + + void glUniform3dv + GLint location + GLsizei count + const GLdouble *value + + + void glUniform3f + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + + + void glUniform3fARB + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + + + + void glUniform3fv + GLint location + GLsizei count + const GLfloat *value + + + void glUniform3fvARB + GLint location + GLsizei count + const GLfloat *value + + + + void glUniform3i + GLint location + GLint v0 + GLint v1 + GLint v2 + + + void glUniform3i64ARB + GLint location + GLint64 x + GLint64 y + GLint64 z + + + void glUniform3i64NV + GLint location + GLint64EXT x + GLint64EXT y + GLint64EXT z + + + void glUniform3i64vARB + GLint location + GLsizei count + const GLint64 *value + + + void glUniform3i64vNV + GLint location + GLsizei count + const GLint64EXT *value + + + void glUniform3iARB + GLint location + GLint v0 + GLint v1 + GLint v2 + + + + void glUniform3iv + GLint location + GLsizei count + const GLint *value + + + void glUniform3ivARB + GLint location + GLsizei count + const GLint *value + + + + void glUniform3ui + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + + + void glUniform3ui64ARB + GLint location + GLuint64 x + GLuint64 y + GLuint64 z + + + void glUniform3ui64NV + GLint location + GLuint64EXT x + GLuint64EXT y + GLuint64EXT z + + + void glUniform3ui64vARB + GLint location + GLsizei count + const GLuint64 *value + + + void glUniform3ui64vNV + GLint location + GLsizei count + const GLuint64EXT *value + + + void glUniform3uiEXT + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + + + + void glUniform3uiv + GLint location + GLsizei count + const GLuint *value + + + void glUniform3uivEXT + GLint location + GLsizei count + const GLuint *value + + + + void glUniform4d + GLint location + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + void glUniform4dv + GLint location + GLsizei count + const GLdouble *value + + + void glUniform4f + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + GLfloat v3 + + + void glUniform4fARB + GLint location + GLfloat v0 + GLfloat v1 + GLfloat v2 + GLfloat v3 + + + + void glUniform4fv + GLint location + GLsizei count + const GLfloat *value + + + void glUniform4fvARB + GLint location + GLsizei count + const GLfloat *value + + + + void glUniform4i + GLint location + GLint v0 + GLint v1 + GLint v2 + GLint v3 + + + void glUniform4i64ARB + GLint location + GLint64 x + GLint64 y + GLint64 z + GLint64 w + + + void glUniform4i64NV + GLint location + GLint64EXT x + GLint64EXT y + GLint64EXT z + GLint64EXT w + + + void glUniform4i64vARB + GLint location + GLsizei count + const GLint64 *value + + + void glUniform4i64vNV + GLint location + GLsizei count + const GLint64EXT *value + + + void glUniform4iARB + GLint location + GLint v0 + GLint v1 + GLint v2 + GLint v3 + + + + void glUniform4iv + GLint location + GLsizei count + const GLint *value + + + void glUniform4ivARB + GLint location + GLsizei count + const GLint *value + + + + void glUniform4ui + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + GLuint v3 + + + void glUniform4ui64ARB + GLint location + GLuint64 x + GLuint64 y + GLuint64 z + GLuint64 w + + + void glUniform4ui64NV + GLint location + GLuint64EXT x + GLuint64EXT y + GLuint64EXT z + GLuint64EXT w + + + void glUniform4ui64vARB + GLint location + GLsizei count + const GLuint64 *value + + + void glUniform4ui64vNV + GLint location + GLsizei count + const GLuint64EXT *value + + + void glUniform4uiEXT + GLint location + GLuint v0 + GLuint v1 + GLuint v2 + GLuint v3 + + + + void glUniform4uiv + GLint location + GLsizei count + const GLuint *value + + + void glUniform4uivEXT + GLint location + GLsizei count + const GLuint *value + + + + void glUniformBlockBinding + GLuint program + GLuint uniformBlockIndex + GLuint uniformBlockBinding + + + void glUniformBufferEXT + GLuint program + GLint location + GLuint buffer + + + void glUniformHandleui64ARB + GLint location + GLuint64 value + + + void glUniformHandleui64NV + GLint location + GLuint64 value + + + void glUniformHandleui64vARB + GLint location + GLsizei count + const GLuint64 *value + + + void glUniformHandleui64vNV + GLint location + GLsizei count + const GLuint64 *value + + + void glUniformMatrix2dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix2fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glUniformMatrix2fvARB + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix2x3dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix2x3fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix2x3fvNV + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix2x4dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix2x4fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix2x4fvNV + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix3dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix3fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glUniformMatrix3fvARB + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix3x2dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix3x2fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix3x2fvNV + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix3x4dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix3x4fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix3x4fvNV + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix4dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix4fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + void glUniformMatrix4fvARB + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix4x2dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix4x2fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix4x2fvNV + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix4x3dv + GLint location + GLsizei count + GLboolean transpose + const GLdouble *value + + + void glUniformMatrix4x3fv + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformMatrix4x3fvNV + GLint location + GLsizei count + GLboolean transpose + const GLfloat *value + + + + void glUniformSubroutinesuiv + GLenum shadertype + GLsizei count + const GLuint *indices + + + void glUniformui64NV + GLint location + GLuint64EXT value + + + void glUniformui64vNV + GLint location + GLsizei count + const GLuint64EXT *value + + + void glUnlockArraysEXT + + + GLboolean glUnmapBuffer + GLenum target + + + GLboolean glUnmapBufferARB + GLenum target + + + + GLboolean glUnmapBufferOES + GLenum target + + + + GLboolean glUnmapNamedBuffer + GLuint buffer + + + GLboolean glUnmapNamedBufferEXT + GLuint buffer + + + void glUnmapObjectBufferATI + GLuint buffer + + + void glUnmapTexture2DINTEL + GLuint texture + GLint level + + + void glUpdateObjectBufferATI + GLuint buffer + GLuint offset + GLsizei size + const void *pointer + GLenum preserve + + + void glUseProgram + GLuint program + + + void glUseProgramObjectARB + GLhandleARB programObj + + + + void glUseProgramStages + GLuint pipeline + GLbitfield stages + GLuint program + + + void glUseProgramStagesEXT + GLuint pipeline + GLbitfield stages + GLuint program + + + void glUseShaderProgramEXT + GLenum type + GLuint program + + + void glVDPAUFiniNV + + + void glVDPAUGetSurfaceivNV + GLvdpauSurfaceNV surface + GLenum pname + GLsizei bufSize + GLsizei *length + GLint *values + + + void glVDPAUInitNV + const void *vdpDevice + const void *getProcAddress + + + GLboolean glVDPAUIsSurfaceNV + GLvdpauSurfaceNV surface + + + void glVDPAUMapSurfacesNV + GLsizei numSurfaces + const GLvdpauSurfaceNV *surfaces + + + GLvdpauSurfaceNV glVDPAURegisterOutputSurfaceNV + const void *vdpSurface + GLenum target + GLsizei numTextureNames + const GLuint *textureNames + + + GLvdpauSurfaceNV glVDPAURegisterVideoSurfaceNV + const void *vdpSurface + GLenum target + GLsizei numTextureNames + const GLuint *textureNames + + + void glVDPAUSurfaceAccessNV + GLvdpauSurfaceNV surface + GLenum access + + + void glVDPAUUnmapSurfacesNV + GLsizei numSurface + const GLvdpauSurfaceNV *surfaces + + + void glVDPAUUnregisterSurfaceNV + GLvdpauSurfaceNV surface + + + void glValidateProgram + GLuint program + + + void glValidateProgramARB + GLhandleARB programObj + + + + void glValidateProgramPipeline + GLuint pipeline + + + void glValidateProgramPipelineEXT + GLuint pipeline + + + void glVariantArrayObjectATI + GLuint id + GLenum type + GLsizei stride + GLuint buffer + GLuint offset + + + void glVariantPointerEXT + GLuint id + GLenum type + GLuint stride + const void *addr + + + void glVariantbvEXT + GLuint id + const GLbyte *addr + + + void glVariantdvEXT + GLuint id + const GLdouble *addr + + + void glVariantfvEXT + GLuint id + const GLfloat *addr + + + void glVariantivEXT + GLuint id + const GLint *addr + + + void glVariantsvEXT + GLuint id + const GLshort *addr + + + void glVariantubvEXT + GLuint id + const GLubyte *addr + + + void glVariantuivEXT + GLuint id + const GLuint *addr + + + void glVariantusvEXT + GLuint id + const GLushort *addr + + + void glVertex2bOES + GLbyte x + GLbyte y + + + void glVertex2bvOES + const GLbyte *coords + + + void glVertex2d + GLdouble x + GLdouble y + + + + void glVertex2dv + const GLdouble *v + + + + void glVertex2f + GLfloat x + GLfloat y + + + + void glVertex2fv + const GLfloat *v + + + + void glVertex2hNV + GLhalfNV x + GLhalfNV y + + + + void glVertex2hvNV + const GLhalfNV *v + + + + void glVertex2i + GLint x + GLint y + + + + void glVertex2iv + const GLint *v + + + + void glVertex2s + GLshort x + GLshort y + + + + void glVertex2sv + const GLshort *v + + + + void glVertex2xOES + GLfixed x + + + void glVertex2xvOES + const GLfixed *coords + + + void glVertex3bOES + GLbyte x + GLbyte y + GLbyte z + + + void glVertex3bvOES + const GLbyte *coords + + + void glVertex3d + GLdouble x + GLdouble y + GLdouble z + + + + void glVertex3dv + const GLdouble *v + + + + void glVertex3f + GLfloat x + GLfloat y + GLfloat z + + + + void glVertex3fv + const GLfloat *v + + + + void glVertex3hNV + GLhalfNV x + GLhalfNV y + GLhalfNV z + + + + void glVertex3hvNV + const GLhalfNV *v + + + + void glVertex3i + GLint x + GLint y + GLint z + + + + void glVertex3iv + const GLint *v + + + + void glVertex3s + GLshort x + GLshort y + GLshort z + + + + void glVertex3sv + const GLshort *v + + + + void glVertex3xOES + GLfixed x + GLfixed y + + + void glVertex3xvOES + const GLfixed *coords + + + void glVertex4bOES + GLbyte x + GLbyte y + GLbyte z + GLbyte w + + + void glVertex4bvOES + const GLbyte *coords + + + void glVertex4d + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glVertex4dv + const GLdouble *v + + + + void glVertex4f + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glVertex4fv + const GLfloat *v + + + + void glVertex4hNV + GLhalfNV x + GLhalfNV y + GLhalfNV z + GLhalfNV w + + + + void glVertex4hvNV + const GLhalfNV *v + + + + void glVertex4i + GLint x + GLint y + GLint z + GLint w + + + + void glVertex4iv + const GLint *v + + + + void glVertex4s + GLshort x + GLshort y + GLshort z + GLshort w + + + + void glVertex4sv + const GLshort *v + + + + void glVertex4xOES + GLfixed x + GLfixed y + GLfixed z + + + void glVertex4xvOES + const GLfixed *coords + + + void glVertexArrayAttribBinding + GLuint vaobj + GLuint attribindex + GLuint bindingindex + + + void glVertexArrayAttribFormat + GLuint vaobj + GLuint attribindex + GLint size + GLenum type + GLboolean normalized + GLuint relativeoffset + + + void glVertexArrayAttribIFormat + GLuint vaobj + GLuint attribindex + GLint size + GLenum type + GLuint relativeoffset + + + void glVertexArrayAttribLFormat + GLuint vaobj + GLuint attribindex + GLint size + GLenum type + GLuint relativeoffset + + + void glVertexArrayBindVertexBufferEXT + GLuint vaobj + GLuint bindingindex + GLuint buffer + GLintptr offset + GLsizei stride + + + void glVertexArrayBindingDivisor + GLuint vaobj + GLuint bindingindex + GLuint divisor + + + void glVertexArrayColorOffsetEXT + GLuint vaobj + GLuint buffer + GLint size + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayEdgeFlagOffsetEXT + GLuint vaobj + GLuint buffer + GLsizei stride + GLintptr offset + + + void glVertexArrayElementBuffer + GLuint vaobj + GLuint buffer + + + void glVertexArrayFogCoordOffsetEXT + GLuint vaobj + GLuint buffer + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayIndexOffsetEXT + GLuint vaobj + GLuint buffer + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayMultiTexCoordOffsetEXT + GLuint vaobj + GLuint buffer + GLenum texunit + GLint size + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayNormalOffsetEXT + GLuint vaobj + GLuint buffer + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayParameteriAPPLE + GLenum pname + GLint param + + + void glVertexArrayRangeAPPLE + GLsizei length + void *pointer + + + void glVertexArrayRangeNV + GLsizei length + const void *pointer + + + void glVertexArraySecondaryColorOffsetEXT + GLuint vaobj + GLuint buffer + GLint size + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayTexCoordOffsetEXT + GLuint vaobj + GLuint buffer + GLint size + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayVertexAttribBindingEXT + GLuint vaobj + GLuint attribindex + GLuint bindingindex + + + void glVertexArrayVertexAttribDivisorEXT + GLuint vaobj + GLuint index + GLuint divisor + + + void glVertexArrayVertexAttribFormatEXT + GLuint vaobj + GLuint attribindex + GLint size + GLenum type + GLboolean normalized + GLuint relativeoffset + + + void glVertexArrayVertexAttribIFormatEXT + GLuint vaobj + GLuint attribindex + GLint size + GLenum type + GLuint relativeoffset + + + void glVertexArrayVertexAttribIOffsetEXT + GLuint vaobj + GLuint buffer + GLuint index + GLint size + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayVertexAttribLFormatEXT + GLuint vaobj + GLuint attribindex + GLint size + GLenum type + GLuint relativeoffset + + + void glVertexArrayVertexAttribLOffsetEXT + GLuint vaobj + GLuint buffer + GLuint index + GLint size + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexArrayVertexAttribOffsetEXT + GLuint vaobj + GLuint buffer + GLuint index + GLint size + GLenum type + GLboolean normalized + GLsizei stride + GLintptr offset + + + void glVertexArrayVertexBindingDivisorEXT + GLuint vaobj + GLuint bindingindex + GLuint divisor + + + void glVertexArrayVertexBuffer + GLuint vaobj + GLuint bindingindex + GLuint buffer + GLintptr offset + GLsizei stride + + + void glVertexArrayVertexBuffers + GLuint vaobj + GLuint first + GLsizei count + const GLuint *buffers + const GLintptr *offsets + const GLsizei *strides + + + void glVertexArrayVertexOffsetEXT + GLuint vaobj + GLuint buffer + GLint size + GLenum type + GLsizei stride + GLintptr offset + + + void glVertexAttrib1d + GLuint index + GLdouble x + + + + void glVertexAttrib1dARB + GLuint index + GLdouble x + + + + + void glVertexAttrib1dNV + GLuint index + GLdouble x + + + + + void glVertexAttrib1dv + GLuint index + const GLdouble *v + + + + void glVertexAttrib1dvARB + GLuint index + const GLdouble *v + + + + + void glVertexAttrib1dvNV + GLuint index + const GLdouble *v + + + + + void glVertexAttrib1f + GLuint index + GLfloat x + + + + void glVertexAttrib1fARB + GLuint index + GLfloat x + + + + + void glVertexAttrib1fNV + GLuint index + GLfloat x + + + + + void glVertexAttrib1fv + GLuint index + const GLfloat *v + + + + void glVertexAttrib1fvARB + GLuint index + const GLfloat *v + + + + + void glVertexAttrib1fvNV + GLuint index + const GLfloat *v + + + + + void glVertexAttrib1hNV + GLuint index + GLhalfNV x + + + + void glVertexAttrib1hvNV + GLuint index + const GLhalfNV *v + + + + void glVertexAttrib1s + GLuint index + GLshort x + + + + void glVertexAttrib1sARB + GLuint index + GLshort x + + + + + void glVertexAttrib1sNV + GLuint index + GLshort x + + + + + void glVertexAttrib1sv + GLuint index + const GLshort *v + + + + void glVertexAttrib1svARB + GLuint index + const GLshort *v + + + + + void glVertexAttrib1svNV + GLuint index + const GLshort *v + + + + + void glVertexAttrib2d + GLuint index + GLdouble x + GLdouble y + + + + void glVertexAttrib2dARB + GLuint index + GLdouble x + GLdouble y + + + + + void glVertexAttrib2dNV + GLuint index + GLdouble x + GLdouble y + + + + + void glVertexAttrib2dv + GLuint index + const GLdouble *v + + + + void glVertexAttrib2dvARB + GLuint index + const GLdouble *v + + + + + void glVertexAttrib2dvNV + GLuint index + const GLdouble *v + + + + + void glVertexAttrib2f + GLuint index + GLfloat x + GLfloat y + + + + void glVertexAttrib2fARB + GLuint index + GLfloat x + GLfloat y + + + + + void glVertexAttrib2fNV + GLuint index + GLfloat x + GLfloat y + + + + + void glVertexAttrib2fv + GLuint index + const GLfloat *v + + + + void glVertexAttrib2fvARB + GLuint index + const GLfloat *v + + + + + void glVertexAttrib2fvNV + GLuint index + const GLfloat *v + + + + + void glVertexAttrib2hNV + GLuint index + GLhalfNV x + GLhalfNV y + + + + void glVertexAttrib2hvNV + GLuint index + const GLhalfNV *v + + + + void glVertexAttrib2s + GLuint index + GLshort x + GLshort y + + + + void glVertexAttrib2sARB + GLuint index + GLshort x + GLshort y + + + + + void glVertexAttrib2sNV + GLuint index + GLshort x + GLshort y + + + + + void glVertexAttrib2sv + GLuint index + const GLshort *v + + + + void glVertexAttrib2svARB + GLuint index + const GLshort *v + + + + + void glVertexAttrib2svNV + GLuint index + const GLshort *v + + + + + void glVertexAttrib3d + GLuint index + GLdouble x + GLdouble y + GLdouble z + + + + void glVertexAttrib3dARB + GLuint index + GLdouble x + GLdouble y + GLdouble z + + + + + void glVertexAttrib3dNV + GLuint index + GLdouble x + GLdouble y + GLdouble z + + + + + void glVertexAttrib3dv + GLuint index + const GLdouble *v + + + + void glVertexAttrib3dvARB + GLuint index + const GLdouble *v + + + + + void glVertexAttrib3dvNV + GLuint index + const GLdouble *v + + + + + void glVertexAttrib3f + GLuint index + GLfloat x + GLfloat y + GLfloat z + + + + void glVertexAttrib3fARB + GLuint index + GLfloat x + GLfloat y + GLfloat z + + + + + void glVertexAttrib3fNV + GLuint index + GLfloat x + GLfloat y + GLfloat z + + + + + void glVertexAttrib3fv + GLuint index + const GLfloat *v + + + + void glVertexAttrib3fvARB + GLuint index + const GLfloat *v + + + + + void glVertexAttrib3fvNV + GLuint index + const GLfloat *v + + + + + void glVertexAttrib3hNV + GLuint index + GLhalfNV x + GLhalfNV y + GLhalfNV z + + + + void glVertexAttrib3hvNV + GLuint index + const GLhalfNV *v + + + + void glVertexAttrib3s + GLuint index + GLshort x + GLshort y + GLshort z + + + + void glVertexAttrib3sARB + GLuint index + GLshort x + GLshort y + GLshort z + + + + + void glVertexAttrib3sNV + GLuint index + GLshort x + GLshort y + GLshort z + + + + + void glVertexAttrib3sv + GLuint index + const GLshort *v + + + + void glVertexAttrib3svARB + GLuint index + const GLshort *v + + + + + void glVertexAttrib3svNV + GLuint index + const GLshort *v + + + + + void glVertexAttrib4Nbv + GLuint index + const GLbyte *v + + + void glVertexAttrib4NbvARB + GLuint index + const GLbyte *v + + + + void glVertexAttrib4Niv + GLuint index + const GLint *v + + + void glVertexAttrib4NivARB + GLuint index + const GLint *v + + + + void glVertexAttrib4Nsv + GLuint index + const GLshort *v + + + void glVertexAttrib4NsvARB + GLuint index + const GLshort *v + + + + void glVertexAttrib4Nub + GLuint index + GLubyte x + GLubyte y + GLubyte z + GLubyte w + + + void glVertexAttrib4NubARB + GLuint index + GLubyte x + GLubyte y + GLubyte z + GLubyte w + + + + void glVertexAttrib4Nubv + GLuint index + const GLubyte *v + + + + void glVertexAttrib4NubvARB + GLuint index + const GLubyte *v + + + + + void glVertexAttrib4Nuiv + GLuint index + const GLuint *v + + + void glVertexAttrib4NuivARB + GLuint index + const GLuint *v + + + + void glVertexAttrib4Nusv + GLuint index + const GLushort *v + + + void glVertexAttrib4NusvARB + GLuint index + const GLushort *v + + + + void glVertexAttrib4bv + GLuint index + const GLbyte *v + + + void glVertexAttrib4bvARB + GLuint index + const GLbyte *v + + + + void glVertexAttrib4d + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glVertexAttrib4dARB + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + + void glVertexAttrib4dNV + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + + void glVertexAttrib4dv + GLuint index + const GLdouble *v + + + + void glVertexAttrib4dvARB + GLuint index + const GLdouble *v + + + + + void glVertexAttrib4dvNV + GLuint index + const GLdouble *v + + + + + void glVertexAttrib4f + GLuint index + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glVertexAttrib4fARB + GLuint index + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + + void glVertexAttrib4fNV + GLuint index + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + + void glVertexAttrib4fv + GLuint index + const GLfloat *v + + + + void glVertexAttrib4fvARB + GLuint index + const GLfloat *v + + + + + void glVertexAttrib4fvNV + GLuint index + const GLfloat *v + + + + + void glVertexAttrib4hNV + GLuint index + GLhalfNV x + GLhalfNV y + GLhalfNV z + GLhalfNV w + + + + void glVertexAttrib4hvNV + GLuint index + const GLhalfNV *v + + + + void glVertexAttrib4iv + GLuint index + const GLint *v + + + void glVertexAttrib4ivARB + GLuint index + const GLint *v + + + + void glVertexAttrib4s + GLuint index + GLshort x + GLshort y + GLshort z + GLshort w + + + + void glVertexAttrib4sARB + GLuint index + GLshort x + GLshort y + GLshort z + GLshort w + + + + + void glVertexAttrib4sNV + GLuint index + GLshort x + GLshort y + GLshort z + GLshort w + + + + + void glVertexAttrib4sv + GLuint index + const GLshort *v + + + + void glVertexAttrib4svARB + GLuint index + const GLshort *v + + + + + void glVertexAttrib4svNV + GLuint index + const GLshort *v + + + + + void glVertexAttrib4ubNV + GLuint index + GLubyte x + GLubyte y + GLubyte z + GLubyte w + + + + + void glVertexAttrib4ubv + GLuint index + const GLubyte *v + + + void glVertexAttrib4ubvARB + GLuint index + const GLubyte *v + + + + void glVertexAttrib4ubvNV + GLuint index + const GLubyte *v + + + + + void glVertexAttrib4uiv + GLuint index + const GLuint *v + + + void glVertexAttrib4uivARB + GLuint index + const GLuint *v + + + + void glVertexAttrib4usv + GLuint index + const GLushort *v + + + void glVertexAttrib4usvARB + GLuint index + const GLushort *v + + + + void glVertexAttribArrayObjectATI + GLuint index + GLint size + GLenum type + GLboolean normalized + GLsizei stride + GLuint buffer + GLuint offset + + + void glVertexAttribBinding + GLuint attribindex + GLuint bindingindex + + + void glVertexAttribDivisor + GLuint index + GLuint divisor + + + void glVertexAttribDivisorANGLE + GLuint index + GLuint divisor + + + + void glVertexAttribDivisorARB + GLuint index + GLuint divisor + + + + void glVertexAttribDivisorEXT + GLuint index + GLuint divisor + + + + void glVertexAttribDivisorNV + GLuint index + GLuint divisor + + + + void glVertexAttribFormat + GLuint attribindex + GLint size + GLenum type + GLboolean normalized + GLuint relativeoffset + + + void glVertexAttribFormatNV + GLuint index + GLint size + GLenum type + GLboolean normalized + GLsizei stride + + + void glVertexAttribI1i + GLuint index + GLint x + + + + void glVertexAttribI1iEXT + GLuint index + GLint x + + + + + void glVertexAttribI1iv + GLuint index + const GLint *v + + + void glVertexAttribI1ivEXT + GLuint index + const GLint *v + + + + void glVertexAttribI1ui + GLuint index + GLuint x + + + + void glVertexAttribI1uiEXT + GLuint index + GLuint x + + + + + void glVertexAttribI1uiv + GLuint index + const GLuint *v + + + void glVertexAttribI1uivEXT + GLuint index + const GLuint *v + + + + void glVertexAttribI2i + GLuint index + GLint x + GLint y + + + + void glVertexAttribI2iEXT + GLuint index + GLint x + GLint y + + + + + void glVertexAttribI2iv + GLuint index + const GLint *v + + + void glVertexAttribI2ivEXT + GLuint index + const GLint *v + + + + void glVertexAttribI2ui + GLuint index + GLuint x + GLuint y + + + + void glVertexAttribI2uiEXT + GLuint index + GLuint x + GLuint y + + + + + void glVertexAttribI2uiv + GLuint index + const GLuint *v + + + void glVertexAttribI2uivEXT + GLuint index + const GLuint *v + + + + void glVertexAttribI3i + GLuint index + GLint x + GLint y + GLint z + + + + void glVertexAttribI3iEXT + GLuint index + GLint x + GLint y + GLint z + + + + + void glVertexAttribI3iv + GLuint index + const GLint *v + + + void glVertexAttribI3ivEXT + GLuint index + const GLint *v + + + + void glVertexAttribI3ui + GLuint index + GLuint x + GLuint y + GLuint z + + + + void glVertexAttribI3uiEXT + GLuint index + GLuint x + GLuint y + GLuint z + + + + + void glVertexAttribI3uiv + GLuint index + const GLuint *v + + + void glVertexAttribI3uivEXT + GLuint index + const GLuint *v + + + + void glVertexAttribI4bv + GLuint index + const GLbyte *v + + + void glVertexAttribI4bvEXT + GLuint index + const GLbyte *v + + + + void glVertexAttribI4i + GLuint index + GLint x + GLint y + GLint z + GLint w + + + + void glVertexAttribI4iEXT + GLuint index + GLint x + GLint y + GLint z + GLint w + + + + + void glVertexAttribI4iv + GLuint index + const GLint *v + + + void glVertexAttribI4ivEXT + GLuint index + const GLint *v + + + + void glVertexAttribI4sv + GLuint index + const GLshort *v + + + void glVertexAttribI4svEXT + GLuint index + const GLshort *v + + + + void glVertexAttribI4ubv + GLuint index + const GLubyte *v + + + void glVertexAttribI4ubvEXT + GLuint index + const GLubyte *v + + + + void glVertexAttribI4ui + GLuint index + GLuint x + GLuint y + GLuint z + GLuint w + + + + void glVertexAttribI4uiEXT + GLuint index + GLuint x + GLuint y + GLuint z + GLuint w + + + + + void glVertexAttribI4uiv + GLuint index + const GLuint *v + + + void glVertexAttribI4uivEXT + GLuint index + const GLuint *v + + + + void glVertexAttribI4usv + GLuint index + const GLushort *v + + + void glVertexAttribI4usvEXT + GLuint index + const GLushort *v + + + + void glVertexAttribIFormat + GLuint attribindex + GLint size + GLenum type + GLuint relativeoffset + + + void glVertexAttribIFormatNV + GLuint index + GLint size + GLenum type + GLsizei stride + + + void glVertexAttribIPointer + GLuint index + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glVertexAttribIPointerEXT + GLuint index + GLint size + GLenum type + GLsizei stride + const void *pointer + + + + void glVertexAttribL1d + GLuint index + GLdouble x + + + void glVertexAttribL1dEXT + GLuint index + GLdouble x + + + + void glVertexAttribL1dv + GLuint index + const GLdouble *v + + + void glVertexAttribL1dvEXT + GLuint index + const GLdouble *v + + + + void glVertexAttribL1i64NV + GLuint index + GLint64EXT x + + + void glVertexAttribL1i64vNV + GLuint index + const GLint64EXT *v + + + void glVertexAttribL1ui64ARB + GLuint index + GLuint64EXT x + + + void glVertexAttribL1ui64NV + GLuint index + GLuint64EXT x + + + void glVertexAttribL1ui64vARB + GLuint index + const GLuint64EXT *v + + + void glVertexAttribL1ui64vNV + GLuint index + const GLuint64EXT *v + + + void glVertexAttribL2d + GLuint index + GLdouble x + GLdouble y + + + void glVertexAttribL2dEXT + GLuint index + GLdouble x + GLdouble y + + + + void glVertexAttribL2dv + GLuint index + const GLdouble *v + + + void glVertexAttribL2dvEXT + GLuint index + const GLdouble *v + + + + void glVertexAttribL2i64NV + GLuint index + GLint64EXT x + GLint64EXT y + + + void glVertexAttribL2i64vNV + GLuint index + const GLint64EXT *v + + + void glVertexAttribL2ui64NV + GLuint index + GLuint64EXT x + GLuint64EXT y + + + void glVertexAttribL2ui64vNV + GLuint index + const GLuint64EXT *v + + + void glVertexAttribL3d + GLuint index + GLdouble x + GLdouble y + GLdouble z + + + void glVertexAttribL3dEXT + GLuint index + GLdouble x + GLdouble y + GLdouble z + + + + void glVertexAttribL3dv + GLuint index + const GLdouble *v + + + void glVertexAttribL3dvEXT + GLuint index + const GLdouble *v + + + + void glVertexAttribL3i64NV + GLuint index + GLint64EXT x + GLint64EXT y + GLint64EXT z + + + void glVertexAttribL3i64vNV + GLuint index + const GLint64EXT *v + + + void glVertexAttribL3ui64NV + GLuint index + GLuint64EXT x + GLuint64EXT y + GLuint64EXT z + + + void glVertexAttribL3ui64vNV + GLuint index + const GLuint64EXT *v + + + void glVertexAttribL4d + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + void glVertexAttribL4dEXT + GLuint index + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glVertexAttribL4dv + GLuint index + const GLdouble *v + + + void glVertexAttribL4dvEXT + GLuint index + const GLdouble *v + + + + void glVertexAttribL4i64NV + GLuint index + GLint64EXT x + GLint64EXT y + GLint64EXT z + GLint64EXT w + + + void glVertexAttribL4i64vNV + GLuint index + const GLint64EXT *v + + + void glVertexAttribL4ui64NV + GLuint index + GLuint64EXT x + GLuint64EXT y + GLuint64EXT z + GLuint64EXT w + + + void glVertexAttribL4ui64vNV + GLuint index + const GLuint64EXT *v + + + void glVertexAttribLFormat + GLuint attribindex + GLint size + GLenum type + GLuint relativeoffset + + + void glVertexAttribLFormatNV + GLuint index + GLint size + GLenum type + GLsizei stride + + + void glVertexAttribLPointer + GLuint index + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glVertexAttribLPointerEXT + GLuint index + GLint size + GLenum type + GLsizei stride + const void *pointer + + + + void glVertexAttribP1ui + GLuint index + GLenum type + GLboolean normalized + GLuint value + + + void glVertexAttribP1uiv + GLuint index + GLenum type + GLboolean normalized + const GLuint *value + + + void glVertexAttribP2ui + GLuint index + GLenum type + GLboolean normalized + GLuint value + + + void glVertexAttribP2uiv + GLuint index + GLenum type + GLboolean normalized + const GLuint *value + + + void glVertexAttribP3ui + GLuint index + GLenum type + GLboolean normalized + GLuint value + + + void glVertexAttribP3uiv + GLuint index + GLenum type + GLboolean normalized + const GLuint *value + + + void glVertexAttribP4ui + GLuint index + GLenum type + GLboolean normalized + GLuint value + + + void glVertexAttribP4uiv + GLuint index + GLenum type + GLboolean normalized + const GLuint *value + + + void glVertexAttribParameteriAMD + GLuint index + GLenum pname + GLint param + + + void glVertexAttribPointer + GLuint index + GLint size + GLenum type + GLboolean normalized + GLsizei stride + const void *pointer + + + void glVertexAttribPointerARB + GLuint index + GLint size + GLenum type + GLboolean normalized + GLsizei stride + const void *pointer + + + + void glVertexAttribPointerNV + GLuint index + GLint fsize + GLenum type + GLsizei stride + const void *pointer + + + void glVertexAttribs1dvNV + GLuint index + GLsizei count + const GLdouble *v + + + + void glVertexAttribs1fvNV + GLuint index + GLsizei count + const GLfloat *v + + + + void glVertexAttribs1hvNV + GLuint index + GLsizei n + const GLhalfNV *v + + + + void glVertexAttribs1svNV + GLuint index + GLsizei count + const GLshort *v + + + + void glVertexAttribs2dvNV + GLuint index + GLsizei count + const GLdouble *v + + + + void glVertexAttribs2fvNV + GLuint index + GLsizei count + const GLfloat *v + + + + void glVertexAttribs2hvNV + GLuint index + GLsizei n + const GLhalfNV *v + + + + void glVertexAttribs2svNV + GLuint index + GLsizei count + const GLshort *v + + + + void glVertexAttribs3dvNV + GLuint index + GLsizei count + const GLdouble *v + + + + void glVertexAttribs3fvNV + GLuint index + GLsizei count + const GLfloat *v + + + + void glVertexAttribs3hvNV + GLuint index + GLsizei n + const GLhalfNV *v + + + + void glVertexAttribs3svNV + GLuint index + GLsizei count + const GLshort *v + + + + void glVertexAttribs4dvNV + GLuint index + GLsizei count + const GLdouble *v + + + + void glVertexAttribs4fvNV + GLuint index + GLsizei count + const GLfloat *v + + + + void glVertexAttribs4hvNV + GLuint index + GLsizei n + const GLhalfNV *v + + + + void glVertexAttribs4svNV + GLuint index + GLsizei count + const GLshort *v + + + + void glVertexAttribs4ubvNV + GLuint index + GLsizei count + const GLubyte *v + + + + void glVertexBindingDivisor + GLuint bindingindex + GLuint divisor + + + void glVertexBlendARB + GLint count + + + + void glVertexBlendEnvfATI + GLenum pname + GLfloat param + + + void glVertexBlendEnviATI + GLenum pname + GLint param + + + void glVertexFormatNV + GLint size + GLenum type + GLsizei stride + + + void glVertexP2ui + GLenum type + GLuint value + + + void glVertexP2uiv + GLenum type + const GLuint *value + + + void glVertexP3ui + GLenum type + GLuint value + + + void glVertexP3uiv + GLenum type + const GLuint *value + + + void glVertexP4ui + GLenum type + GLuint value + + + void glVertexP4uiv + GLenum type + const GLuint *value + + + void glVertexPointer + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glVertexPointerEXT + GLint size + GLenum type + GLsizei stride + GLsizei count + const void *pointer + + + void glVertexPointerListIBM + GLint size + GLenum type + GLint stride + const void **pointer + GLint ptrstride + + + void glVertexPointervINTEL + GLint size + GLenum type + const void **pointer + + + void glVertexStream1dATI + GLenum stream + GLdouble x + + + void glVertexStream1dvATI + GLenum stream + const GLdouble *coords + + + void glVertexStream1fATI + GLenum stream + GLfloat x + + + void glVertexStream1fvATI + GLenum stream + const GLfloat *coords + + + void glVertexStream1iATI + GLenum stream + GLint x + + + void glVertexStream1ivATI + GLenum stream + const GLint *coords + + + void glVertexStream1sATI + GLenum stream + GLshort x + + + void glVertexStream1svATI + GLenum stream + const GLshort *coords + + + void glVertexStream2dATI + GLenum stream + GLdouble x + GLdouble y + + + void glVertexStream2dvATI + GLenum stream + const GLdouble *coords + + + void glVertexStream2fATI + GLenum stream + GLfloat x + GLfloat y + + + void glVertexStream2fvATI + GLenum stream + const GLfloat *coords + + + void glVertexStream2iATI + GLenum stream + GLint x + GLint y + + + void glVertexStream2ivATI + GLenum stream + const GLint *coords + + + void glVertexStream2sATI + GLenum stream + GLshort x + GLshort y + + + void glVertexStream2svATI + GLenum stream + const GLshort *coords + + + void glVertexStream3dATI + GLenum stream + GLdouble x + GLdouble y + GLdouble z + + + void glVertexStream3dvATI + GLenum stream + const GLdouble *coords + + + void glVertexStream3fATI + GLenum stream + GLfloat x + GLfloat y + GLfloat z + + + void glVertexStream3fvATI + GLenum stream + const GLfloat *coords + + + void glVertexStream3iATI + GLenum stream + GLint x + GLint y + GLint z + + + void glVertexStream3ivATI + GLenum stream + const GLint *coords + + + void glVertexStream3sATI + GLenum stream + GLshort x + GLshort y + GLshort z + + + void glVertexStream3svATI + GLenum stream + const GLshort *coords + + + void glVertexStream4dATI + GLenum stream + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + void glVertexStream4dvATI + GLenum stream + const GLdouble *coords + + + void glVertexStream4fATI + GLenum stream + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + void glVertexStream4fvATI + GLenum stream + const GLfloat *coords + + + void glVertexStream4iATI + GLenum stream + GLint x + GLint y + GLint z + GLint w + + + void glVertexStream4ivATI + GLenum stream + const GLint *coords + + + void glVertexStream4sATI + GLenum stream + GLshort x + GLshort y + GLshort z + GLshort w + + + void glVertexStream4svATI + GLenum stream + const GLshort *coords + + + void glVertexWeightPointerEXT + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glVertexWeightfEXT + GLfloat weight + + + + void glVertexWeightfvEXT + const GLfloat *weight + + + + void glVertexWeighthNV + GLhalfNV weight + + + + void glVertexWeighthvNV + const GLhalfNV *weight + + + + GLenum glVideoCaptureNV + GLuint video_capture_slot + GLuint *sequence_num + GLuint64EXT *capture_time + + + void glVideoCaptureStreamParameterdvNV + GLuint video_capture_slot + GLuint stream + GLenum pname + const GLdouble *params + + + void glVideoCaptureStreamParameterfvNV + GLuint video_capture_slot + GLuint stream + GLenum pname + const GLfloat *params + + + void glVideoCaptureStreamParameterivNV + GLuint video_capture_slot + GLuint stream + GLenum pname + const GLint *params + + + void glViewport + GLint x + GLint y + GLsizei width + GLsizei height + + + + void glViewportArrayv + GLuint first + GLsizei count + const GLfloat *v + + + void glViewportArrayvNV + GLuint first + GLsizei count + const GLfloat *v + + + + void glViewportIndexedf + GLuint index + GLfloat x + GLfloat y + GLfloat w + GLfloat h + + + void glViewportIndexedfNV + GLuint index + GLfloat x + GLfloat y + GLfloat w + GLfloat h + + + + void glViewportIndexedfv + GLuint index + const GLfloat *v + + + void glViewportIndexedfvNV + GLuint index + const GLfloat *v + + + + void glWaitSync + GLsync sync + GLbitfield flags + GLuint64 timeout + + + void glWaitSyncAPPLE + GLsync sync + GLbitfield flags + GLuint64 timeout + + + + void glWeightPathsNV + GLuint resultPath + GLsizei numPaths + const GLuint *paths + const GLfloat *weights + + + void glWeightPointerARB + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glWeightPointerOES + GLint size + GLenum type + GLsizei stride + const void *pointer + + + void glWeightbvARB + GLint size + const GLbyte *weights + + + + void glWeightdvARB + GLint size + const GLdouble *weights + + + + void glWeightfvARB + GLint size + const GLfloat *weights + + + + void glWeightivARB + GLint size + const GLint *weights + + + + void glWeightsvARB + GLint size + const GLshort *weights + + + + void glWeightubvARB + GLint size + const GLubyte *weights + + + + void glWeightuivARB + GLint size + const GLuint *weights + + + + void glWeightusvARB + GLint size + const GLushort *weights + + + + void glWindowPos2d + GLdouble x + GLdouble y + + + + void glWindowPos2dARB + GLdouble x + GLdouble y + + + + + void glWindowPos2dMESA + GLdouble x + GLdouble y + + + + + void glWindowPos2dv + const GLdouble *v + + + + void glWindowPos2dvARB + const GLdouble *v + + + + + void glWindowPos2dvMESA + const GLdouble *v + + + + void glWindowPos2f + GLfloat x + GLfloat y + + + + void glWindowPos2fARB + GLfloat x + GLfloat y + + + + + void glWindowPos2fMESA + GLfloat x + GLfloat y + + + + + void glWindowPos2fv + const GLfloat *v + + + + void glWindowPos2fvARB + const GLfloat *v + + + + + void glWindowPos2fvMESA + const GLfloat *v + + + + void glWindowPos2i + GLint x + GLint y + + + + void glWindowPos2iARB + GLint x + GLint y + + + + + void glWindowPos2iMESA + GLint x + GLint y + + + + + void glWindowPos2iv + const GLint *v + + + + void glWindowPos2ivARB + const GLint *v + + + + + void glWindowPos2ivMESA + const GLint *v + + + + void glWindowPos2s + GLshort x + GLshort y + + + + void glWindowPos2sARB + GLshort x + GLshort y + + + + + void glWindowPos2sMESA + GLshort x + GLshort y + + + + + void glWindowPos2sv + const GLshort *v + + + + void glWindowPos2svARB + const GLshort *v + + + + + void glWindowPos2svMESA + const GLshort *v + + + + void glWindowPos3d + GLdouble x + GLdouble y + GLdouble z + + + + void glWindowPos3dARB + GLdouble x + GLdouble y + GLdouble z + + + + + void glWindowPos3dMESA + GLdouble x + GLdouble y + GLdouble z + + + + + void glWindowPos3dv + const GLdouble *v + + + + void glWindowPos3dvARB + const GLdouble *v + + + + + void glWindowPos3dvMESA + const GLdouble *v + + + + void glWindowPos3f + GLfloat x + GLfloat y + GLfloat z + + + + void glWindowPos3fARB + GLfloat x + GLfloat y + GLfloat z + + + + + void glWindowPos3fMESA + GLfloat x + GLfloat y + GLfloat z + + + + + void glWindowPos3fv + const GLfloat *v + + + + void glWindowPos3fvARB + const GLfloat *v + + + + + void glWindowPos3fvMESA + const GLfloat *v + + + + void glWindowPos3i + GLint x + GLint y + GLint z + + + + void glWindowPos3iARB + GLint x + GLint y + GLint z + + + + + void glWindowPos3iMESA + GLint x + GLint y + GLint z + + + + + void glWindowPos3iv + const GLint *v + + + + void glWindowPos3ivARB + const GLint *v + + + + + void glWindowPos3ivMESA + const GLint *v + + + + void glWindowPos3s + GLshort x + GLshort y + GLshort z + + + + void glWindowPos3sARB + GLshort x + GLshort y + GLshort z + + + + + void glWindowPos3sMESA + GLshort x + GLshort y + GLshort z + + + + + void glWindowPos3sv + const GLshort *v + + + + void glWindowPos3svARB + const GLshort *v + + + + + void glWindowPos3svMESA + const GLshort *v + + + + void glWindowPos4dMESA + GLdouble x + GLdouble y + GLdouble z + GLdouble w + + + + void glWindowPos4dvMESA + const GLdouble *v + + + void glWindowPos4fMESA + GLfloat x + GLfloat y + GLfloat z + GLfloat w + + + + void glWindowPos4fvMESA + const GLfloat *v + + + void glWindowPos4iMESA + GLint x + GLint y + GLint z + GLint w + + + + void glWindowPos4ivMESA + const GLint *v + + + void glWindowPos4sMESA + GLshort x + GLshort y + GLshort z + GLshort w + + + + void glWindowPos4svMESA + const GLshort *v + + + void glWriteMaskEXT + GLuint res + GLuint in + GLenum outX + GLenum outY + GLenum outZ + GLenum outW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/rust/khronos_api/api/glx.xml b/third_party/rust/khronos_api/api/glx.xml new file mode 100755 index 000000000000..025e9f93b746 --- /dev/null +++ b/third_party/rust/khronos_api/api/glx.xml @@ -0,0 +1,2161 @@ + + + + + + + + + = 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + typedef XID GLXFBConfigID; + typedef struct __GLXFBConfigRec *GLXFBConfig; + typedef XID GLXContextID; + typedef struct __GLXcontextRec *GLXContext; + typedef XID GLXPixmap; + typedef XID GLXDrawable; + typedef XID GLXWindow; + typedef XID GLXPbuffer; + typedef void ( *__GLXextFuncPtr)(void); + typedef XID GLXVideoCaptureDeviceNV; + typedef unsigned int GLXVideoDeviceNV; + typedef XID GLXVideoSourceSGIX; + typedef XID GLXFBConfigIDSGIX; + typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; + typedef XID GLXPbufferSGIX; + + typedef struct { + int event_type; /* GLX_DAMAGED or GLX_SAVED */ + int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* XID of Drawable */ + unsigned int buffer_mask; /* mask indicating which buffers are affected */ + unsigned int aux_buffer; /* which aux buffer was affected */ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXPbufferClobberEvent; + + typedef struct { + int type; + unsigned long 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 */ + GLXDrawable drawable; /* drawable on which event was requested in event mask */ + int event_type; + int64_t ust; + int64_t msc; + int64_t sbc; +} GLXBufferSwapComplete; + + typedef union __GLXEvent { + GLXPbufferClobberEvent glxpbufferclobber; + GLXBufferSwapComplete glxbufferswapcomplete; + long pad[24]; +} GLXEvent; + + typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + int extension; + int evtype; + GLXDrawable window; + Bool stereo_tree; +} GLXStereoNotifyEventEXT; + + typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXBufferClobberEventSGIX; + + typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int networkId; +} GLXHyperpipeNetworkSGIX; + + typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int channel; + unsigned int participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; + + typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int srcXOrigin, srcYOrigin, srcWidth, srcHeight; + int destXOrigin, destYOrigin, destWidth, destHeight; +} GLXPipeRect; + + typedef struct { + char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */ + int XOrigin, YOrigin, maxHeight, maxWidth; +} GLXPipeRectLimits; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bool glXAssociateDMPbufferSGIX + Display *dpy + GLXPbufferSGIX pbuffer + DMparams *params + DMbuffer dmbuffer + + + int glXBindChannelToWindowSGIX + Display *display + int screen + int channel + Window window + + + int glXBindHyperpipeSGIX + Display *dpy + int hpId + + + Bool glXBindSwapBarrierNV + Display *dpy + GLuint group + GLuint barrier + + + void glXBindSwapBarrierSGIX + Display *dpy + GLXDrawable drawable + int barrier + + + void glXBindTexImageEXT + Display *dpy + GLXDrawable drawable + int buffer + const int *attrib_list + + + int glXBindVideoCaptureDeviceNV + Display *dpy + unsigned int video_capture_slot + GLXVideoCaptureDeviceNV device + + + int glXBindVideoDeviceNV + Display *dpy + unsigned int video_slot + unsigned int video_device + const int *attrib_list + + + int glXBindVideoImageNV + Display *dpy + GLXVideoDeviceNV VideoDevice + GLXPbuffer pbuf + int iVideoBuffer + + + void glXBlitContextFramebufferAMD + GLXContext dstCtx + GLint srcX0 + GLint srcY0 + GLint srcX1 + GLint srcY1 + GLint dstX0 + GLint dstY0 + GLint dstX1 + GLint dstY1 + GLbitfield mask + GLenum filter + + + int glXChannelRectSGIX + Display *display + int screen + int channel + int x + int y + int w + int h + + + int glXChannelRectSyncSGIX + Display *display + int screen + int channel + GLenum synctype + + + GLXFBConfig *glXChooseFBConfig + Display *dpy + int screen + const int *attrib_list + int *nelements + + + GLXFBConfigSGIX *glXChooseFBConfigSGIX + Display *dpy + int screen + int *attrib_list + int *nelements + + + XVisualInfo *glXChooseVisual + Display *dpy + int screen + int *attribList + + + void glXCopyBufferSubDataNV + Display *dpy + GLXContext readCtx + GLXContext writeCtx + GLenum readTarget + GLenum writeTarget + GLintptr readOffset + GLintptr writeOffset + GLsizeiptr size + + + void glXNamedCopyBufferSubDataNV + Display *dpy + GLXContext readCtx + GLXContext writeCtx + GLuint readBuffer + GLuint writeBuffer + GLintptr readOffset + GLintptr writeOffset + GLsizeiptr size + + + void glXCopyContext + Display *dpy + GLXContext src + GLXContext dst + unsigned long mask + + + void glXCopyImageSubDataNV + Display *dpy + GLXContext srcCtx + GLuint srcName + GLenum srcTarget + GLint srcLevel + GLint srcX + GLint srcY + GLint srcZ + GLXContext dstCtx + GLuint dstName + GLenum dstTarget + GLint dstLevel + GLint dstX + GLint dstY + GLint dstZ + GLsizei width + GLsizei height + GLsizei depth + + + void glXCopySubBufferMESA + Display *dpy + GLXDrawable drawable + int x + int y + int width + int height + + + GLXContext glXCreateAssociatedContextAMD + unsigned int id + GLXContext share_list + + + GLXContext glXCreateAssociatedContextAttribsAMD + unsigned int id + GLXContext share_context + const int *attribList + + + GLXContext glXCreateContextAttribsARB + Display *dpy + GLXFBConfig config + GLXContext share_context + Bool direct + const int *attrib_list + + + GLXContext glXCreateContext + Display *dpy + XVisualInfo *vis + GLXContext shareList + Bool direct + + + GLXContext glXCreateContextWithConfigSGIX + Display *dpy + GLXFBConfigSGIX config + int render_type + GLXContext share_list + Bool direct + + + GLXPbufferSGIX glXCreateGLXPbufferSGIX + Display *dpy + GLXFBConfigSGIX config + unsigned int width + unsigned int height + int *attrib_list + + + GLXPixmap glXCreateGLXPixmap + Display *dpy + XVisualInfo *visual + Pixmap pixmap + + + GLXPixmap glXCreateGLXPixmapMESA + Display *dpy + XVisualInfo *visual + Pixmap pixmap + Colormap cmap + + + GLXPixmap glXCreateGLXPixmapWithConfigSGIX + Display *dpy + GLXFBConfigSGIX config + Pixmap pixmap + + + GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX + Display *display + int screen + VLServer server + VLPath path + int nodeClass + VLNode drainNode + + + GLXContext glXCreateNewContext + Display *dpy + GLXFBConfig config + int render_type + GLXContext share_list + Bool direct + + + GLXPbuffer glXCreatePbuffer + Display *dpy + GLXFBConfig config + const int *attrib_list + + + GLXPixmap glXCreatePixmap + Display *dpy + GLXFBConfig config + Pixmap pixmap + const int *attrib_list + + + GLXWindow glXCreateWindow + Display *dpy + GLXFBConfig config + Window win + const int *attrib_list + + + void glXCushionSGI + Display *dpy + Window window + float cushion + + + Bool glXDelayBeforeSwapNV + Display *dpy + GLXDrawable drawable + GLfloat seconds + + + Bool glXDeleteAssociatedContextAMD + GLXContext ctx + + + void glXDestroyContext + Display *dpy + GLXContext ctx + + + void glXDestroyGLXPbufferSGIX + Display *dpy + GLXPbufferSGIX pbuf + + + void glXDestroyGLXPixmap + Display *dpy + GLXPixmap pixmap + + + void glXDestroyGLXVideoSourceSGIX + Display *dpy + GLXVideoSourceSGIX glxvideosource + + + int glXDestroyHyperpipeConfigSGIX + Display *dpy + int hpId + + + void glXDestroyPbuffer + Display *dpy + GLXPbuffer pbuf + + + void glXDestroyPixmap + Display *dpy + GLXPixmap pixmap + + + void glXDestroyWindow + Display *dpy + GLXWindow win + + + GLXVideoCaptureDeviceNV *glXEnumerateVideoCaptureDevicesNV + Display *dpy + int screen + int *nelements + + + unsigned int *glXEnumerateVideoDevicesNV + Display *dpy + int screen + int *nelements + + + void glXFreeContextEXT + Display *dpy + GLXContext context + + + unsigned int glXGetAGPOffsetMESA + const void *pointer + + + const char *glXGetClientString + Display *dpy + int name + + + int glXGetConfig + Display *dpy + XVisualInfo *visual + int attrib + int *value + + + unsigned int glXGetContextGPUIDAMD + GLXContext ctx + + + GLXContextID glXGetContextIDEXT + const GLXContext context + + + GLXContext glXGetCurrentAssociatedContextAMD + + + GLXContext glXGetCurrentContext + + + Display *glXGetCurrentDisplayEXT + + + Display *glXGetCurrentDisplay + + + GLXDrawable glXGetCurrentDrawable + + + GLXDrawable glXGetCurrentReadDrawableSGI + + + GLXDrawable glXGetCurrentReadDrawable + + + int glXGetFBConfigAttrib + Display *dpy + GLXFBConfig config + int attribute + int *value + + + int glXGetFBConfigAttribSGIX + Display *dpy + GLXFBConfigSGIX config + int attribute + int *value + + + GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX + Display *dpy + XVisualInfo *vis + + + GLXFBConfig *glXGetFBConfigs + Display *dpy + int screen + int *nelements + + + unsigned int glXGetGPUIDsAMD + unsigned int maxCount + unsigned int *ids + + + int glXGetGPUInfoAMD + unsigned int id + int property + GLenum dataType + unsigned int size + void *data + + + Bool glXGetMscRateOML + Display *dpy + GLXDrawable drawable + int32_t *numerator + int32_t *denominator + + + __GLXextFuncPtr glXGetProcAddressARB + const GLubyte *procName + + + __GLXextFuncPtr glXGetProcAddress + const GLubyte *procName + + + void glXGetSelectedEvent + Display *dpy + GLXDrawable draw + unsigned long *event_mask + + + void glXGetSelectedEventSGIX + Display *dpy + GLXDrawable drawable + unsigned long *mask + + + Bool glXGetSyncValuesOML + Display *dpy + GLXDrawable drawable + int64_t *ust + int64_t *msc + int64_t *sbc + + + Status glXGetTransparentIndexSUN + Display *dpy + Window overlay + Window underlay + long *pTransparentIndex + + + int glXGetVideoDeviceNV + Display *dpy + int screen + int numVideoDevices + GLXVideoDeviceNV *pVideoDevice + + + int glXGetVideoInfoNV + Display *dpy + int screen + GLXVideoDeviceNV VideoDevice + unsigned long *pulCounterOutputPbuffer + unsigned long *pulCounterOutputVideo + + + int glXGetVideoSyncSGI + unsigned int *count + + + XVisualInfo *glXGetVisualFromFBConfig + Display *dpy + GLXFBConfig config + + + XVisualInfo *glXGetVisualFromFBConfigSGIX + Display *dpy + GLXFBConfigSGIX config + + + int glXHyperpipeAttribSGIX + Display *dpy + int timeSlice + int attrib + int size + void *attribList + + + int glXHyperpipeConfigSGIX + Display *dpy + int networkId + int npipes + GLXHyperpipeConfigSGIX *cfg + int *hpId + + + GLXContext glXImportContextEXT + Display *dpy + GLXContextID contextID + + + Bool glXIsDirect + Display *dpy + GLXContext ctx + + + Bool glXJoinSwapGroupNV + Display *dpy + GLXDrawable drawable + GLuint group + + + void glXJoinSwapGroupSGIX + Display *dpy + GLXDrawable drawable + GLXDrawable member + + + void glXLockVideoCaptureDeviceNV + Display *dpy + GLXVideoCaptureDeviceNV device + + + Bool glXMakeAssociatedContextCurrentAMD + GLXContext ctx + + + Bool glXMakeContextCurrent + Display *dpy + GLXDrawable draw + GLXDrawable read + GLXContext ctx + + + Bool glXMakeCurrent + Display *dpy + GLXDrawable drawable + GLXContext ctx + + + Bool glXMakeCurrentReadSGI + Display *dpy + GLXDrawable draw + GLXDrawable read + GLXContext ctx + + + int glXQueryChannelDeltasSGIX + Display *display + int screen + int channel + int *x + int *y + int *w + int *h + + + int glXQueryChannelRectSGIX + Display *display + int screen + int channel + int *dx + int *dy + int *dw + int *dh + + + int glXQueryContext + Display *dpy + GLXContext ctx + int attribute + int *value + + + int glXQueryContextInfoEXT + Display *dpy + GLXContext context + int attribute + int *value + + + Bool glXQueryCurrentRendererIntegerMESA + int attribute + unsigned int *value + + + const char *glXQueryCurrentRendererStringMESA + int attribute + + + void glXQueryDrawable + Display *dpy + GLXDrawable draw + int attribute + unsigned int *value + + + Bool glXQueryExtension + Display *dpy + int *errorb + int *event + + + const char *glXQueryExtensionsString + Display *dpy + int screen + + + Bool glXQueryFrameCountNV + Display *dpy + int screen + GLuint *count + + + int glXQueryGLXPbufferSGIX + Display *dpy + GLXPbufferSGIX pbuf + int attribute + unsigned int *value + + + int glXQueryHyperpipeAttribSGIX + Display *dpy + int timeSlice + int attrib + int size + void *returnAttribList + + + int glXQueryHyperpipeBestAttribSGIX + Display *dpy + int timeSlice + int attrib + int size + void *attribList + void *returnAttribList + + + GLXHyperpipeConfigSGIX *glXQueryHyperpipeConfigSGIX + Display *dpy + int hpId + int *npipes + + + GLXHyperpipeNetworkSGIX *glXQueryHyperpipeNetworkSGIX + Display *dpy + int *npipes + + + Bool glXQueryMaxSwapBarriersSGIX + Display *dpy + int screen + int *max + + + Bool glXQueryMaxSwapGroupsNV + Display *dpy + int screen + GLuint *maxGroups + GLuint *maxBarriers + + + Bool glXQueryRendererIntegerMESA + Display *dpy + int screen + int renderer + int attribute + unsigned int *value + + + const char *glXQueryRendererStringMESA + Display *dpy + int screen + int renderer + int attribute + + + const char *glXQueryServerString + Display *dpy + int screen + int name + + + Bool glXQuerySwapGroupNV + Display *dpy + GLXDrawable drawable + GLuint *group + GLuint *barrier + + + Bool glXQueryVersion + Display *dpy + int *maj + int *min + + + int glXQueryVideoCaptureDeviceNV + Display *dpy + GLXVideoCaptureDeviceNV device + int attribute + int *value + + + Bool glXReleaseBuffersMESA + Display *dpy + GLXDrawable drawable + + + void glXReleaseTexImageEXT + Display *dpy + GLXDrawable drawable + int buffer + + + void glXReleaseVideoCaptureDeviceNV + Display *dpy + GLXVideoCaptureDeviceNV device + + + int glXReleaseVideoDeviceNV + Display *dpy + int screen + GLXVideoDeviceNV VideoDevice + + + int glXReleaseVideoImageNV + Display *dpy + GLXPbuffer pbuf + + + Bool glXResetFrameCountNV + Display *dpy + int screen + + + void glXSelectEvent + Display *dpy + GLXDrawable draw + unsigned long event_mask + + + void glXSelectEventSGIX + Display *dpy + GLXDrawable drawable + unsigned long mask + + + int glXSendPbufferToVideoNV + Display *dpy + GLXPbuffer pbuf + int iBufferType + unsigned long *pulCounterPbuffer + GLboolean bBlock + + + Bool glXSet3DfxModeMESA + int mode + + + void glXSwapBuffers + Display *dpy + GLXDrawable drawable + + + int64_t glXSwapBuffersMscOML + Display *dpy + GLXDrawable drawable + int64_t target_msc + int64_t divisor + int64_t remainder + + + void glXSwapIntervalEXT + Display *dpy + GLXDrawable drawable + int interval + + + int glXSwapIntervalSGI + int interval + + + void glXUseXFont + Font font + int first + int count + int list + + + Bool glXWaitForMscOML + Display *dpy + GLXDrawable drawable + int64_t target_msc + int64_t divisor + int64_t remainder + int64_t *ust + int64_t *msc + int64_t *sbc + + + Bool glXWaitForSbcOML + Display *dpy + GLXDrawable drawable + int64_t target_sbc + int64_t *ust + int64_t *msc + int64_t *sbc + + + void glXWaitGL + + + int glXWaitVideoSyncSGI + int divisor + int remainder + unsigned int *count + + + void glXWaitX + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/rust/khronos_api/api/readme.pdf b/third_party/rust/khronos_api/api/readme.pdf new file mode 100755 index 0000000000000000000000000000000000000000..7debab58baa670f485bf7101d93e9485a72183d3 GIT binary patch literal 130102 zcma&OW2`VsyEeFgariCP;tn+Tg2*%_Na^72ADIXjvd*g(2( zrliW*ZHdB<+$+iIvNmbqFN>ZN)*hr-C;>eEi@W0 z`h(M^arNcAn&Q`zieO-f#8#Jy?qFk$2%0O>n8 z8EX^A8mFKXuOvhhWF1TZ){VPQBHIQqLf4c|KTR`opwvfak64PqN~jkX8nbvnFp5V* zwP$a6 zT-SxD_JBIAD<6j)#f2OD+b zM`4*9ZD4{p4%cRe9AgNKp2Q%j0JX3>$afVLITw70b_d#`k5}b?hmQJQ2mKi4iwki6 zBh9AcR1`ScACraE*;{tib!jECc6U)oae7lpS@)M@XLpvC*@t?oQ`5R@W2$M&qb>Ww z=h^OE`6NoEqxhvEpKio)rTIDTslXJ?^1Rku3!=;JsgnkkjIed@Gd~$0^siO|T_om% ziNe`q=IzDGxg-yt&LO5JA>e{@G-B|hql^Np+#piViRp@nSod0jsx}g_r)vF zh3}7g^^=-Xy#z97An?{t>jw~@jL@JhdN|E-wgt=@ry8} z=k^j|UKK+4NX+fU12|Uc(DV@c=RdXroe*`j>jWd@T3H}9SoxDVPQJ4^nWYHrQV@1!LEyrXjx&S-`*=Sf0tTB0y-pg5R#A{N|38rdi&iJV=SmiO-;y&t0f5k&`mK^h7Fc z>#oSp5p#Smh>DsWODinlnHxJR&M-^XomZ|2XLVXqz4J!2-x`c@mfdjJdDqS-XYnx{$c>y}t;S5|U>cJ;-%3p3fpLEyKg%b?k z$1ej{R*wN^VMO7G{e^2%!c2S`apDMm=_T`25xm0SohNw(R& zp1&~`yo7|h)s{*-F}`^{kE1mL0yPdL2r}x-rH~Xd-8X6`2V{CD@7@+>B1WX}r@*5O z!Y+qnIwdU+KyF*qEFPzNY44=ppt{I$ON387Tb0;e-QYsn{XjsA1f_gx8P8HBu~&{pX>d zb)XX=M1XSG-v}%`{z#*b(Lo($r*7EZ zrW@ycI9G~{TX}k*`qU?jt50((a8$_?gg>fU)PE>hJay2lnqtDE~ft$}EO@9623%u%FiXnln}|}e9%EL_2a8oknEEREg;qLmvGcJ z5H=w3f_O$|C1n;sZ=z)ru4-^H+Rx`Gv{z@GxhU$!m;{9F)yAGGJX$hIz&8Hl3X)RB zkK|>j8V-+npA3^5v%0A?4)g|HDgLY46{#w)Hnr`F^*I|Kf!Pzpb)C% z)s{SACVuCXZ*my?(q9B_1Tdg`-3i|0e?OvkVcIpT<^QeY0&W%pjDu?M3ciCzkjzFa z2e;uh5=$b!A@hFko)B#4rf|(_-$FH5ak#jb;I5Hh zkRtABvBPCVA47h(KQpd3;#%1a$4*>_zeWnMjcP$@~^1x_k`JW|~bnof_-Z ztGk9F_1yq@<_G$6CHB@=$2?=TM5P*>3n| z$tA0sIE2?iqF=NlAs1>UIz@aa_x%SQ`P(3$Zp}R2g`kBh^g<0UV*^U zcQH3+G1IoIq6)LWQa#&L&$%*ismb3BUFl#|J%d$!z4z(${zMJa(vfPmZ!!<6hIMCH z8Mu`F%t{!pzl4#wCAFv!#JRQw{Cbb{h z?i$#!dm_j@j>wjPKNtbytQJwJ;ziZ~Leu@=*9%Y$ET2vX`?JFAs7AKXTZo+bXQ6r% z*BQ-(D;M(@O)xoAqo^lD0oln%lP2xyn4=vi-$l~VYyZ2&y}JQyJ`loYa~xjU6#mS( zoWvc1=wosos)*5yCc3(|GnW^iUS&TW(4wR8u^6{>dE5@rM8;*3kt(E&Q$u0L zqQYVfnG?_YD6lM}o>tqUnL4UTvS@SM(asFvI3#)XeBKvXOgh31{0MahQ|W9&Tl&z$PGb5La930ZOxK?X zjaFnPRKpjx-lwbXirofikulYnM0uDRr6hwJ5JIL!yGs>@wXi*3T6bPq;MgON&KbY) zdbJN7hj$}DXS?p*?%G5qExW)oF7VI0eG)uI-p$DMdsX3uzVCFa8u6E&51Pu$tqA3y z_8nQ_)=OdKSJ`5c`2kl#%3`Diu-wMHy_N#b49YS)2umNO5r&{uE~Wk*j6FBW_37zB zHYN)e#k;JG2Veiu8)>0Mcp6!hWT(lvs#9z7bd=30jBB6kGcd)B7S!>$9|Ix%$bE(# z0yFK;71|f}4XYSCe!(I70*hH_l)9BiL9de$0f#aZQ|* zlSKv{s?+BY6!iqF#dmeXtw{?Lo+gP zu>PmO*`lfAgv5dB^IA7g)Ll-pQ&m@ktn!DHS_N8&YE;1%sY$TY&7+K6aillplz2Pz1WxQ&>mkh-iXBq}${aTqgmxB}q z$=pGH!cZrcQlWoSv?SckPQ`WqLc@gaNLRzi7{6d?cKX~{8U~gSVMZI@8PIpoNJJlO zbamnwyg_GJJa`*;gq?f{QJuZMjhIjvzbR#c-xS^rVjP>m2e2`WPzSJ)Y@Zn4OF?;1 zjdwy$gE=CBS`y92l*)4?tKPZLWPvT-z++mdJ+}feC~ui&KVKftR%?*h&%zG z4*`|f2*ra8C!LJnHc*Cqf-e-sq!a@KPD%g}(9V^$kcjnZQ6duK3Z8m6pm^xKA2-+o zJEuKbglv*CJ-d6~_@v+nW5AC)fKCAMoS(DaH+<1yl8g#Rk#{H@zcz4UF+eOl3x2+# z)VUB6w-`JzxZeU)PKiJ;0k{nkLl2%eoKzevcIksL!5#jMUn9W)Bd~77-vwOR5W0|< z-D}rEie$)D^uEtn1PdB02_&LM5}F4}6|z3fT`2O;@P0o96vGQ8R_cU+36<4=T+_HP z`V6+at7Bm$luD0!pH9_fhi7w5UFL{qNsV81E_VhG;Jut)rf17YzGtVl-gkpaA0KDM ztI-x&Wrp7G&)dVRxZ52Uz0IrrX5~`p2KDY9%d=_?U!`3`tC0LHz{zscGbA2cQNRm% zfj+Ry$EgX~fzO6$1S)J{2vK270yQ=<6r3b0Y#1y%@Wv@y+mxpMY1N&xv#>~mzp#t$ z@0o2w1s}jZkgo0OugEXSxef1Z-KDBo)=o0n4RZHHHqIKs_ejvs;p>MNx-0lH4u7A* z$uCI9m=p+21=@4v?sVGayP=m$8;S_7St9IVK^bl4`{#(`f;S4~Oqu5Q#}n1FckIG@ zt1X6(woj$qsZjc@|HZNfkKHY6%ZJ6YMQ>-Nou)*V3zVO(9$o9q=@mRK&b@fgx2IOs z(u(EIbe5~sb#?D{kB{ayWc%*!s@kP>Lp5Igu+LjAqWE&XxsGD%u5HT+;A5PSBM)(z z?%vLF)<{Y^y5lTbybrRZoPPM%VamtJci%&oCr=;7M35JFwXXH5TbtIi=T7dOXRX#HGZ!TMPNtO+{YGAsK!mbeZuhSZ2Xha@N?zdr%=EtURb3~Kj|UygvoHdWiOjZ)L=N#+ z9bQRu^2W`@bL3PKOs*slQz?4ued7>aK*MS)Su-D(g`vFi<=lKqD_b8@Pd1xBHXuh& zZYa@lehq;MP-Crz^(BY)pRLNcwg2m)O=;a%94HDD1BrvgMd7A&SH3UbSNLaP3?vQ; z7mb_NUHiU$-(leBzZY`p+_sPbG+?ygDy-4-Q@~~EV+XVX$NeB- zTs+AbXoMbsnCxphm)xsI`eNSLiW0elD&EF42WR~x38L;8|GfCBxBcd?j+1_nBjh9c zGz#sIn3rW8Uia)<-~8Ix{3pObITexX^8@GKK`!7*?K=0+iW|G5Aa&ru8P)l08wnWiWVs zISqf0JjQ2guRyd|MY9H&#ut%639T{KpxTq=B|-QCr-4BUm6evE+L043GPwh%kyRhd zS3O7AK#aS^Y!_~yGKN*9GrdUIFJY1MJgAE(phZ=QW}jb z9QQZ)S;T3tLx=TCXpa&^g$H=Po`{E!*=G!D#7ht_<-o);+*Ebl)2v1c=uAr!ZJYF)Rd;5}z-(}+@{=q-h zT%)Q-rnvFe*M|X1vZd*gg}Om}9wiYg4*Q;E$EkjeI&k<%Xn(_JON+}FwNCiNgb+D0 z<2u0pij+Vroc%@+hsKsQq7_FnrGgE-YxUgMd!9=DylmP5dDNfOa@DP>(qtU)it86z zH)mDUSu>qd`p|_Bo7%Vi1?3*8lq>i~jbu+ab+a|wsIb>jQ8pG8f>*jhkJK?|o%Z42 z-KeqBowrAI&tWtqOyq_+J7#|fq8KF7rX_#&d@^!)LkSIZ%3weS4Z!O=+LT12WeixZAtpxy(X3V#WjQ#hd)*LVQBZGiGKhhGRp+hJ#1CyuY?YpD5gB04;gEU z@E+Pt_+m6h&>ifNGrgQ%8)Y7YA?^n^h8Yi)r1Np$!yKs6hnFow%(t;~)L}SkrYs;; zT~s9vShFrq*(~sIBS2DvuAcWF5f1=$(`GOkhzIutwMr_-P7YxhdISx1DMXF0mhGQ{ zhW+4?lBZ0%wZ6)2`QMOgd6Y)t56*!%r*vbyIEiEWi_Bh^*<+C-{&(FTsK9z$#qD3g zUML7UZ)wJdR}o@TVO>G>i}OPuc87GImCc6?07T$FR@3223S$~BG>6*E9iEHA`U^u=3A6wt;s|a;f<{0G{sqdxaR!areqx&k z3#k>;rL$3zk|cRps-bx}5kV?DdNV_etYc|vs2;&3G$!cV!$^1c6?9K>8v_>Z$eTfiRvUi)oVyDoF6nI)*d?Rk(Ks;A+BT8espP=L$BiYJ z6Sc*s-;B{b8z__Q66J#J1sg$==7l?*ENyR*D}PH+4wm=QM(kb^uCO=uE_GFyg5KTXNAwh=jFeX}t55^uhg+3w%9ts@p$X^u#y?mPykrI>)!XYA!Zyd@ zY|DC_qt;?-xD6a`T*>+tHNm__UG2r004BHpzAOMJg3b5pkX1##J@r!&F#mNdn{NZ& z?xAm2hkO#y%p{E^1HNpvqAcvSRvAfM=#k`BCL(V zR`fr z1MsEuH7D}6M9I~@iNB$&h#F|gp-jXPRN;BUj|QE+`3qjI;w^?D5(tO724@8XA6Xqr zx}l)TUN36CwaKf5CtlzWr~s4oxMBGZqfoUX6%5JgQ=jx+Czp5GqygXbIK@ZUnJQC|xhMgw8T zh7#4ln($f=oNqhKCK*m0%QI}qgHQ{V7GBJ$*-vA6y#0rG3vqjuY|E`Wh!-4GJB)Y3 zDvJl)VYQFFk=!K{LU)~nwuD3rw;^nyn)258;{`E0+7!>tU&$kV7L$^@!Y!mQ=I6=p zadI-?{Xl0(R@w`e9~;nn zSspBkkgc5%J51gTY4LG$_H^`W3idc2J$@1F@$qt}%dU1}!&<+xwMnid0jDZ|aBotl zk9*S^YUPkNJh6UR&%&{x{enUCoM-%tB4B6!7e&Cr{vWs6depVtwpgKk@9O5YPL|S1 zUDWnksb^>}HkXRab~Il3H=3(OPvJ>&6d!j;K+wi1IqZKcI3CW^Awn|gI6BIMI=LAQFpGK9>sc2NDZ-_{pG;C+rww4zi!c5Txrt z#!#siYiu+-(k3H9Y4eR5kh}>tk3WPg=A%OLQEPSZ#?MDWMER7Ze>WeP%+c+P#%6uo zu@-Xh5H;r1Pt(N^h`Nl5<8rB4ixdcZnFM2^MDJ)Hy*&(NypQegY$Xhc_ej;1{qVQ# zeS|Hf(_{LlkxvYPw`p4Rc<^M|v~5X9`Vb1VHMVvt^kr+Hk zIU)}0N59|1M3nmhrxI7xm0%G0(V(q7f?9B&6947v;~7c;S?k`H+?Q?z^DZ$Lo^t7{ zJ+*0BfFzUBhVg;8jx|_n!Kw)6Y_!b-Bz+>^bo+_9*2TQK!sOWn4}yjgj4)aupZT1_ z4tuJlN9ANvF_GP=p1YD{zP)xo0;ZW~Ks^L|+YL+9P|#U`lpuWZg!9N;vg1vBR0cVG5)=Qgt~tcBTC4|IqxZeTKkf*1l1 zqu4m#ZD~#Ep8@5Pe~U|(&t4dzN0Ts62s#Jnc9l6=X+xTlH0!`#m3iw)eS7BE0~#-F zCI1I{wm&5%BE70IWd_p$I4Yb7U)38?z6`mxyKjLCiYH$P$=u_z9t7(7xwCglRXJv& zY0?31@T!vji^!7mD=Oq&YBKr;ebJJn%QN6_U(TX93acto9$L#f%=hx!h`L#Hd>W`W zpd2cFeNyXUJh1|-?b>T2D{GslcUYK$@2{U z0&la!YY!RQ<|ThshT|2PLy}kao~m(Nw6dTta9&B{4MC^OsiD|3j%vvQim|3Pw1!#H zBWWFkQ0S~Vr~yt53YM&kZ$wEU*mX=^+tVr~6_1h?;>YMjc+ye`^6$;<(vkwD z1`z^F^JmkJ@Y;`~4|OHK-G~(>79lPjY7k6`crGT)YDkM-7~HRew5$<2WKXQtE6akJTH z`!e>x{8e4YUVovS0N7r;n@u=)O7P0Hw?pEZLk6?a`!xjI+ZpX98}`#N*;6Zh?K8jM zY>hQ&U+bsTPLRU>Or4)+9fo%JI1?lONC%e5R|1RZ-%g?WYDZzeZ7rISS_16QX_41t zPw-TE=5nh+WND;gTs7}SFjTmIKe25b09`6A`02lzX{?&iCH$+Nm;^7l-c4hi;k6O| z;x0?8`vn&cKwkH6B*gwNB*gJgEAzj{|Ns8A5_PS*e{8AmT;2WFB>!}HaqY+ephZIV zjtHHAlRvQe2ftKvO$~KL;&xI~pRXCakcMM2skxr8BRh6%sMGtnz0-DZ)~6Xk+a52s z*8^uF7KI4znB|lGx_FI9rg0XrY{=rnX~FgvqB%hu7e=VTJ)M>0mYo|VY>?O1`fjw! z*8H2zg4&Mw_s+{&*suS!F#*?vNTO+dOOj{v%tQp1@T>3_=iV`)oO0kb*IZvx20+So zp&J?0mPO8?W1ElDumftgI!pE^d}w7Wkc>9ysYK9&G1*8h)`W0`c2(U9RT7~z&(pr| z2S<3^Q$KU_(G=Tn={KfR>oSu}L?J5|iU?qHP@ZEb0fo+9;$%N{iXJG>l2ch*pI+r| zYJ1WoAQQX?dy5tdSR4!tmF)wc&KcO#mTG7~j#Qf#1{mH<2M|=m4ejL8zKMpadwgka zUaJIlyUwEixwXQ<;@|}?ZORYOiGPYdj%88vr^LB%_lSAchVel)P?DDv@UN7xjaT8~ zVqtG`EAWjW4(MK{!J%ci6}Jj?t0kBZU3(m0LC~veikFL*QZ&#E zC(xm?-GH_J0pGn*WQyeP+4m*^ z&abJ=+x%ILYWLd65ZT8%mu+S=i&`GH1=ga9duQeJAh69v4~d{s)q6ARx*BJ(pyXDp z3wDQr0fmAmC9|y0ySzED;|s=Ukl@uvxkywVOr_!Dr#XvhDV^UHElUy>x^ji6gj1K- zy}mQt902EC4~|`ISptj*?nw2V;AIc{v+OdcJO6`YoOv-hC67bc9*P_ff6mtBTQtDS zOFvV+EfOiHv9%=VI}ji`-@=!MI&DItu9;`!CYD(UyaX=oOUNJ9EQ5S`P&iL73RyO5 zpcuRby)7x7#e3sc%42*|$P28%xvm+0GCqgHS+{v(4|-mg)R4rPf}vfd8`bZ$Z&FyD z$iY-&!Lx5TZ*^NQ^RO3df?fu*E~T4(rOsZ)BAv&8;7F+iwyL-U5eXn2Wm3b8cf->5 z^l$6975W!B;v<>96peX7Zn&jgJz9$jWCiAw=3QJqwW)Lm-6>tvqmgBGymd%TDQ4d6 za5d<%{a3OQ`)fu#`&1jFjKyk|7G@+)x!&^3Sdmm|>)OPCx@<~kqV3a6GW)84rUI$& zVs7H_Z$Fw+SxWo;zDw5Y3dUf@{vsPGWK_yY0`VFxrN!S6OWT0S6?^^tXUp75kAN>? ztU8+ZRKoOQ9~6F|E0OAs8(@k>icEfRV9mtibWUvt*>_>ZNA1#l$(Sa%`cxYS4lR13 z020IeR7w`-`bY#fFMP>`T!)4F(u|6M=rkf+h3cTv6Ze6E4HI=7y2|_K`S6I+{$Ze) zyy_u(iZljdl_S1Z2W)zwwLq}W>Ci+8EBrnWKpxCXrCH;jvC3MsNTD$J-s=yC0tEnCe-z*UyV&~+yaxn5Na+yz2>?fsG4ba~$ zK+0;32v})c$S;nZH7Fb~V9xS5uuvL6>=L3~An+-5(a0*2amkr=*X0T`0~J5o^dbt$ zJI~dhJSs|{%oImMoSB5yefCpECnCOCVP74mGsLgVYw<|x#WmxH3SxhKMRJm~A5XKa zsdqZbXyJcku~V4BAKp$%Dp3CegYas4M$y8M!W;KI`5hJWUsUC%d5 zvBiU{X6X&g&ku`rr40DCHobvM$>Dsv&xip6Dd2bJhlb>2a;XxCJykcg>BD;|R`u(U zD^j0|f@ugS@gWPU9bC==!<3A@&gHSi-fghuDq)y!Y+2Vgv_$P8jtjm(Ef--5Yb5~~ zPap|Rn!2%hxLbj6XasQJvSRL_TbaIrBW%YX=@{DOoWWZrv(0N|Bg zJpal6c@qg?uAYC`n>Xt$s=g=^N-#?>^Z9}V5~(MY{0-%;`;o>=5$u+USkZm%kU8Cd z^<4ZELJu1X=hqMTn)0Zz;+odzr&!DXq?HrKEtLYmlc`gH-teKXRlUR5^<6hLsCRT3 z*aTjWRV33b*XFL%O~A(~dQ{rX(eeJm8B4&22cJKzx3R5Nxb*?&YI4Ktbg$XX_3c|X zC@#xWpDF05;Lzc+kF`(LoF1_4^|#zerIo<{)@Ffyw*>B{U-^T-qsCHh>roO^LN5aV z2hLlZ!|prO8Q_c*rAT|(lK2)D;xl*$7 z_+zmc?)q>`#N^MPt>d51S$AkCFYU(8VmVe*Zl<3Zciw5WE)>0<-b3H7liSNv6=GGv zdS$DQ&MrNO5_Rjulm&()$-3Lel`womM;ypmkNd+oy|sd6ZucY{>$acI+qNt#~W zK>OwH_`CO*M?5A5Y3XDYkV7U*bYdKRV7 zN5)Wx`kJj(R~em?BBy5-kGZW;)jGevQjw4T4oKbJG8P6k$oObzCB+#699Kj2fgJWp zEEgFjWZO0$2T0=M16b$V2K>0D&qBa84PvYl0x zJQNi%Ga|pxh?GnW_(U=snf&1X20$kRX)@e_-loly~9pDe8LvW*P zD0bb!=KBXdCI;eI3+r3a4Wc(P(F)TqXRg$KzJ*bJGL8XX3Zjs~V(QpuYKESGCtBQ~ zJUsnz?>2v0{&$fTB>4QLyUI>ON?8dPbesph))A<5ax*II302C3WETAq)2*Je2dY^- zdq=%AlbE&(Bpvhhki&yckwJb@b2tqRUU(Y?m@J)9dqRre0oraJjg7mjBU`?24jJ-L zJZ3{pWEe9>}qCOm$K074H~w zr`8yj${+2rC2Ucboo)gL!*qU zjt(lKl7v4J;K*rvZ-K;_h$jd9>_< zB>T{bd{mTf@{b>Njs&1VP8rc)oKoE_jM6=_Y@a5gy{&4#R#%4X5&6-~F?6yC5Okn~ z@Z5fO37k=W#u0R02%~iOn($VC%BmhQve{N35=$n<&#_=w8T*?f^b200FXdiX5E^El zpc(p|ZXe_DQO`*Qf=U1H-|LSTCgjvxZmG}!+6=n4-cEcrqJ(+5b&-za=%Hm=%W#JJ z+bgWanAFo%fx9*D+wbDrrtCd5#k|dG3vG+bO?Yv%{7^G`r3x+UKSB^DgmGsv`5b<| zjv-@dS^db3MW|6LOWK6mZ^wzC^5*!`A$9=YAfszpAz{(T#$#y8wwRie#)MeY#Yqxm z;d<$XI+tE)VL1W5%f>76@L%SHzj!hp?a*sKQGR~U_m$+>^m z2?OH;!8U3dWD9@WfHY$7Y}M_3C_i{;OwVZOt2_3Av#$+|p0;t2Rec~sHEgRo#mvX1 zM&@+oMCtE|nTy)mH(JJU)iK8ZQW^q&$of&0GSl7F{s6&0MNt25B4wukw*wO_^#5^R zw?};|c8e9>XHKpCA_{s~I}(|q!U1i)G)p8hpIp9=L_k2RnMOHPTPKlSZ;v3Xb3>D8 zUF7o^fo>?{AcIM0X~S03434h+^V{V4@YH61&O2{duztgm>xqM`Alg(hIM{(fi=+uI zm-xr~KuNNvtCM!=Ia{Hw!i7bTUZBU2>$mv>26>{OP#vBU7~6=2`f5pGuhXRn2uOlF zYSX1~KblFMWhKRXTG8DldS68RHnc0lV)0T`4;@lTH_l#Z4*FcY3?tXX6$D%{H1^*n*9ZxWn@A6Wd^8E6QP_ZcP#jriXzjG;Fy3vdi4 z$YIgpU;$hj`WAUUU2Hp`xoV~etRO1y5JQ#bDdm`}ZP0W_{C#wIE-)-AY_4*o*qfAs z;5jEfcUup@e1N&u&Sj6AP*72|b~~-)Rd3E#tt6a3Vm_BV-D3IMzZ<4SL(4;-SLp+v zew@bmYH*{EQ&iA^gC6#?h$oyiQYyLkO@OJ>Za$&R9!eL*LLVGpw8YxD&@}48fNw6v zQ`i^16pxtJ9g=Mb^9A8~l5J)Q>Tlctt}tTMT+1Ag;Bn!2|3sA@HHuyX-1q+107!aP zUyl2%hL@BT+$k9dw><+9G709%(Bjqk*|NlV@rXSW$`$eK1PsBiwW1{9(oJMd z=dF-62I;i3rouVSQo9D zn9ycp6?|`(Utepyq}LZ5N}(4sw3 zCxN};q*nhHVOA0jfF z{v>euCkjW<9Z4Y$2$@DFp>Nh8G^V0UNiZDp^;KJnPuxsxoxtJketEWae*P1W*fo+m zM5VIJy|m@=?$FwCMqW}zcF%9UnD*E*fdR_mT_IYoz0_^u=np*I$`%h&$Z?zr1$m!)`Ta1ItQW-A0fD$%o>Tx4wm1mL+UEb5!M%Nrs2}5Z>~`{ z3vXCh*vGA%Y9@E9B1i}nf`@vxm9D${9K zZ%OyB2m1Ew?a}f35d1$_Nw;?*wRM|!Z7+O9N8Y_B@np$Q2`8_RA0rTg$MeIDcSFw8 zoy%HgBd2ykYS!{6Giz)%9|Z27UZ7~E$MVTZ6US1Bqt{*gJ8X8NMnhH9&fOECcOXw1 z$)$UZg#`#HG@FZr;n8!JQayB;JH2*<`CVKsb?`d^tSmM8SZ$YD*L6GirE+WA-I%{> z3AnNFNb);;m*s7Cu#|R4VkDM1rWQO8{&@l$VPstgW$D5S%a7;wGvAjZeeXi;lK;jS z|F#o|iGk@qwO%D^8g@sl@c%@v^pC_q3`0W1B>6P;5Q+FBpfs(!Wu@TgSq&lUg#;5> zoqfGSLXF4sSJt2U_w)9*cBau{Q3$v@IS2K+GIO+cN{ocSC)rC2e@%qZg%pj621p8{ z<4T_v@*;$-xe3sZj!*4ccB}uo3v$R#PrcP$)b$JeoQy~`sY*Z}8JhRf>SN_>b8O}j4 zuB@uAt&L4DxAwNIM)D1a)H`&~`QzkglK1OqXjHmaXd%u%Qk_yeSO8<3Oh8F4t3?Bt z^FlHuX0E8qQo3>2V-y#UVeE5wlZnUzGJ_;E0|kW&eRAJ4PrX0UT`=`kDZ&sU8IcuP z0ioNc$aG5fCl_6Ok!TT2T0m-a@t-VzMVk+hT2kk;=ut{1ISN&lfMa{DkvYZ^QmGK# zo>UM&BXAYtkQg6dh}eDYY&reVc&qvFP=1DE5Pr-Eb_dBZl$=y7!P7%(@sA+EdG!1r zK|F>8usG1$mabaVb>*1$RLS8G>j=^#2&6`rtes6WwE7tk_j$dF%MNo&m7A{y(6wZ! zK0gMPI3c$hz!KXpQ0+5SsNzjKtfu)HMYTUDx>bJ+_aaR-l7r;=)I?_vVz|_0u3|DT z+`TO#9jW1fq=o$JWH!zlE98_72A+PgH(y!O@}=MWC%=H;_bqt$A#@2RG;gj$Ntx>T zIez;O@N_VKcR+`Ct7S@vG~w-|#yQP97EzJr`mG%G5d+&Le4#h;ZBv`@%szL^CC0g?En2HO(%6|) zKr+lGJAPNu`$m}w0*jOvmtrRn_QFVzI|o(i=C-zSG^IrqqfF6Hl0`RFeLA~&>!z<+ zVhi}){R>>fm2MN^CcwYy*Er>oa0v&Yhhm?=1MQY(3F*-ye3Xuo|N z;)=1QD;BO_qqj`C`pl)6ojK82z&J{&LCNQmOe?O53GWH0J{@W@Hx}C#xN#}&>5Bde z1qn!s;H{&nQi8m9TC+eXQten*y*Rcl=<=xH9gL31vvqP3lUv%+9k}w3hrS5$-%~M7_#_w;XKML2h&O+JWc4O_{0lqgHEw7?S)r*IdIQ%lmdO>H( zZU*$DI#4HB(HWO)T26sSr-vC`7*?UG;(&gj$R=#&osQPg>%YScYuB;e?oSo;ER#rs zHT45%dbn?QkaxS#Oh1y31(R|4xnm)X7w@Rw4}+#h5F01|T5likx9SJ2F)_BkHitr< zWI(JtA)0(o&zDd3xJ`FMJA0GC!q3(MFC)^#mMBlC&9AbmD*xZ8Le!sxIy9ND^ z(9>KZ(*9SDkcQHmIH1g|i;ccKXcYN>L0krge`#{D{d3g$KMcEa)VFN^`ANe+8Xf!= z3PiZ7CteCM9Edo;s8}YmUtuAv6MS`1laMfhQewlQua}8SO40aSss@cV%qwFmgQ@8- z={Z<#R?q&|yUU%y4=*wTo;rq*Lql6GSdn^lLRgF;i87N~HK{K!IpRXvem02BMaNW4 zX(C9-rs_gkl$*S^%#Y4DBMhJb>*6`;oYz}!-NP^1M3x}Sqtav zUX*=eqq0;?lUaE_A|faR5YJAb6z$;vp?s-UFwshOd{$1)i>ZYKMhdPBaFIwRGn3g; z2Be7oxkA9nJLVW;JFO&Q?bKoYt0BU*G%t#Ry_j9qwI^lK{$?s`okh+QpifOyOAT9V zb||+y1R)OSlu(3Hn_KyY@o7p%LY;VtkZ<`l*V>*hsR^pKGUtCo9kJQKW`MN$a9dnkcH^>0kkOoZqq_5S4aZWTyyu+FX=VLN z0AR-nQUZziE1n39kcT7`7d)*a@pFj*<#~=i9$XL)WU-qaDCqPbGtzM9eR42*UK@(1 zKm*6G@s=mk!fPK6ISPy(SD9%&ZsAY(Dk?_7c?yNo#Nt2mq2SCLn!1-;ZM;vMn!tln z88tjVkf!giwda)TreeaUM`%{Y1+Yi=xh7zyk~%X=xph|hL|Klf;2dSZlhP^Re77=d z>uj~{v{i!S2aHCSRx}dTN;qU2UKg~7iO{YZRzoQd1ZeAg0K1u)T8=N{N+NKVH7(pQ^j&okEU#(Z`w!>W6ODS%u|}@=bx~HEFzYW%7pC`h-=?Cudg$5`dK$VVtmt$ zOC@Ghgi#oESm)FbgzXZh9)jTHu97)_A&mC-w$Mo2XrSeF7UA3u z6?9%=tl;vv)ktODSS+%{tnE@85?$qp_hW6+Akj#9>Eb%5QIxX^JWo3=CsMLR8_k)u zGAJ_CQ>dd&qf`h-uCHVt)a}fPPYLWk47w8uqqtvlOl+fNXuVxe+-jpL^y|onF*_mQ zDK|>QXVD+&q8dZR*P%NQiHL~gfkOmm57wL;OIxd*P;Ht$;|^rU8pgpVR`WE>`eBr8 zi3h-zo<#QbyjHr)k8tNm@AN)&Ke)q9$6GC)LvG9S3o^S4?bg-v^4`PlL@q)$5~2nh zy+=WT(zOfv=jYww=lB7&01+&5{vkib@9q9PJUF;|9d2#KNBhZmztq!sD$btBXZwD5 zA6!doRJ1+KjSkmn8)ZJl|L&=o7L-Nu8|j9j3Qvak*^w?6%gyuo_~6eyaaa9VYiT`2 zm#?pE--cU8d9CEccklnw3k$BYi4v6=cmlidxBEMZ49Om8WJ&GcpRk5!JRFl!l}z9v z9uHfh?CtEH@7z0}vTS%79rc86g0ZyJ)@~@Me&1E}s;&J&zjkZVhvX;k-dn`ou=>6x zQoiN@ShK-Bi~JDrTK!{cTFZO|Hy`h-ko;FVfDs=)z4Z=Mhy1m6<**8npl`kj4spp5 zeCb|+9R#$xEiI}Ap=n+o2Nt#1ckmt&QRfb}MWr<)7^nvEt>AS+ zk|Zv_P7od0BX^$d=``q(X7FP5oU=xQcM~&Kp zWnH?`cu%>OtJoDD3ihl1J6|9eBiq=BQe+`uM1}dp2}jm$XRwe+Wy!LA>@mu{*24C} z6|%{yxW0b6(x`jyt53P}4h+_XLEBiX7AIL@T{Rna9N(GLJFUKM99y$-x7YXfnuZS# zXPhaj;ySXxry$-+l!#+^l5>z#lFvY;D(jAtQ*SRqhbM`PgWEZ~+uvc_86HrCB?p*lAbe6XRglNu;m&tkO~ zF<3;$lvA2WFEX}~>t`7>dW!^MrfG7pw>ENjiaZnQoQUQ({%lsv8@);L#o8B$Vl@_7 z^iA9h@&(S8?qYR4&b-U!rGrW^fB5O)%WJCdq=C=nfoEwiZe!k3;rqLpR~hl$|12JR z5XKXbFVH&_-TXXBv<(T!Zc#wa78542VHp%&R};>O_sj<^bJHdI_e~jKvg^ZRJF~00 zJ(f-}inofaaLN`B*>p#GAnClqX6*zaT>Y&Y)B<@04wGLx+F@qa>AkZPFybU2$2uaU zM-*nmQ0U>uNefmWH7;O#6RHMwp@)gd&<5o_swPn`-uSGfbx);4qfzWoXv?q*{6Si6MU+g)KY-tOLaU&*zp3YG^y z7kHmP0mHe@jYIqpMF9s1=Wqpw*=Ai7IlZx$OeWcpNi;90Rtn&QZWB2E{JWv~8wlUE z8OIVJ{t_N%Va4n<3k%>UdD;JJ(MUb+BtD7%(gI*oZTc*g9h`vBPBIGg=rYHS{XZ=;y64Hgw;#_qsM&7aw|4onFRRE#`nawEg ztJX4}Q-$n0g=tNtaAsf@?Y9mj^sK@SwV*N#EwWD`F{&;u7*@ie7skitrwo%j0X4NB zAI>k~quXPZ)%w!gZ4|m9Meq$0Uh5i+_=Yn?k3Y z&!thY$S7K^VT&UjTnQ|>My4Rvl(z(M!&7+w5a$X{M35y8hxQyx?Z#Gag@7aoA#~!{?1AnV_^&pe$5xxFGup`h<8K>)g2)OH{nsJT zc=8`Q1L16nySIPX4J}KfD?B7FOsB@mFjZ#hfEy$z@tg{VEK$(Ej~o{) zNq?pC^yPtLy+tl+)3?(E_N8=DzImn%2y!*~Ri5uS&S0Ohf{KkT_XuFzRaDjiN*xGmwa%+%0uRw-BDVot#-H_}|s{ZwP)VhkoS_zqn!ctsF~ zYRiO%S&3i|EX7C@3PYj{mhhLmIJX7ELsSZ6pAyvJN!2STuF9GCUK z>{M~ZIN+$w4(}Iv68+In*SMk3#SX8LVx!OD#(_PeN(`X1DZ^S9XSL09iN25|$s(OS zg2?t`sd~kk)Y#gt$Dvod>ND4NH@b)4KAh;CT`)ejz75;+lrj0H_pY=aO&Ir(=0;;} z^1U<}(BGj9(bo}j(7%)jX1pFSbS2!K7-1Z3y$kEB zv*VaRI4c$Nvaf_F`&4DH=XlaAmzJCKa%K$Z5R(Qer@LG5>f?DO3Zhxrc275pXgZ*Q zh_tET>#(De6DLNCvd~NIRf!_Z6VI{r+NneW{5E)s5h7VkmBNKme2NhqG5MJ(#Lh~Y zN)9b)timlh0Lq>_YwRHe4>VngqNqi+;IaD(OG`OX5(vD?FX|id)2QS16VjwcA1Q>- z)%7}b{g!^!{m>i-Nn}P(-jBtFAq4dww~xVH0k^d8v|-AW?n~bGKx>gWPzn($Kz`X{ z+X1_h>pe^s@WJ;tTV(R=Co!V5zrM?SU?Jw0?bBo}l@Qdr>+WWAs%@P55S0m@fUN&f5j9T3C^gTPi0bNb0-V39+7?c z6g20!#Y6#DPgbNqE>vzbvRNmJy>>GP^4Fh5oJxqBk9Ey`kbs>WY@Y0Z%)G-A-eO|* zd20<=3FOCX%zzJmz;X4T+2}6XfVCR(=S0kDlPes`EA)lo7P~tlyKX>YSX86}(=Hxq zHX|cQ&PM-9-tgGIXp}e1G?giV4yC2%bqF`Vp?qEIZcg5ra(tVyI-BzIqOvXM9Xs%_ zoBB;-^VB@Lj%|{BPGFK+6j^SJGF$dkr zDJLFlr{B{I5?Uqug+~g)A0NUq30E4qBO_+1@Torz?X$k?0wm4kg zBi0d(V=Z`Y$Wct>x4%vbbC5?Lsc;666_$=~0vAcl;v;jH8<(Y}1+gD!s<+ksxY??A zeJ1cdgCo<#aE91IFroGOaU_wNR^bvksG+G-brPC1y4)a`-~)!wzfv^0!fha%D_aQ} zs=>r{*!85~&y~jZ%QESqGNKiz;!J8qmV3P93Jkct&kGv%y3pVur|~>T0i5_g%GIas zHhmcemgXe*nnj@ii$V^t(KhQb}iPd9zLmn9m_s$J|ILVky;^#`D5EZCic#9TXzjINF=qZsm2wXr%C{1G55dcvE+*IBy#f*h!?G=w zrqq{$Z6fnnjp{*?XL@z22g~g-_O}RD2|24;zVhp^W6fz%~0PaYg7?} zaQueZiGB#{)2|8R!iA;v_NpH?TlpufBtS7w&Y5+r+;E2!pm zIfkCNAzBuh1;ip~JkV2}7j}@NT9GVR%}|e`69r;JR03<^yZna4&+)d4?Ac{Rj+*w_ zFA1-v%E<=Nd81&u^fP;xzL0t80KRExWt##z89__6vdeq8+cgIfJbTsa1?#fEiK`yN zuXP$o!K!bvTWGkF(PclTrAobj`hDa2#m5{L`4kUbFjQQ`Tgu9^icyw0oa)|BX5(=! z-GgCe5{_R!`W;OyWzu?DM*vqWFfG0gNtA&Lxm{xP8leB&N$9Bt6_)Zi3HMPTU;H9Ahl| z^jYoCvI10f=*)x&M!>3wSYM(}*Ege3jT~Dzo;LsIR-EI?xtiAFB}D5qma~xMZ(@ZO zM~}JLr;(Bj3_D{kBX$28FC_SB7Wy3}auSUAL65TEoAzAsXE~=p9KAQj^FNr|PPP;R zm68ZJSi0OzCH>a`#Yt}f$>AB#S;>+Un<(bi=R$vM?WX%=v%js7K8`i!2{{&`P%*GO z3HWmKb_+J2RIa)@S=GC%Asw9|JpHcO4(VXOMw~NvJ9%^rWkgNH+k|uldBpO9Nu=v` zJ5@Zag{SYDRig~e$nID=zIE=SfLLSD0gzz`qsdTzl@}z91q7N6n+R@OQjkanH*8;# z+gf zRP+8^5yEg_k7N%0Zr~=}=yPW=0Vkhweh_h^+2ugH&=^C@8B+R?P0U47%Mg?*J*_0S z&S;S<5NRBTA)hv0F{x8a$`9G- zU{{d~OGp-zf42m{A=|cgl*fXA`r*JX_8nxUC<|ds$k8Hsg+Rq3ny>eJIVCpbB77nW zAoNl%v@^niP8hi&GK~gfnEt?%6cZuXoW`_ zOGzl!a~0dZCcxd&s4#iF!S^}S3Lr@ow1Im>FdGOtX5MuxWS;@GP~2|#tH%NJTO#=_ z#3&mgywUvf1_MF8hg|Ln)o=48vS(_*wkXUvP1FOP>Zrp!PtUa+^4s3<$Jc-_F#Ef2 zWBqs!Y9mMacc|}477%e{fiZ~Oi6{Y{&KQ(E{ag(HN;FK{{h!QaX8ZrmC;y)Wd2G!8 zU&%bjKcme5m|qTSDcWPR!}$FZwM=emMb|Wt= zo$Kd@;y#7|>>`2U3O~!)S#O3A*+JAof5;s>Aq(ehRvg0CfS9&hS!;6DYpKAjaVW#2wu!x42@B zyEY>SHzWuINT$rPcY;2re&ou!nEQd{vO^Lv8Qj;hk@-l5G62zWnB)tR%wH-#MU5C% zj`0k;zYO}pz5{fik6^bl zn#-j`{bmPBu|d&iEDTSOOxU?_0Z@5DRycvU#|k(Y3Si534NOxK5OT#C%u5w}(?(hV zXL~BL4xAJK8Bq}dAnkX_Cko;jMP><*0$GfpZHtzOjP67+M*X0jIDMpfCkeC>SJN>G zkeKKI!gpF`XOaPMe|V4*l4*rPmrN0(+d`n*(gKLc4M-FckvYg55*Z0Wh_3+9#P${0 zE@ayGbO$_CDC23KoI~{?<7feq$vj#>x}x_skoMpQWC`DbZD11^Vd&AqJPox`-{cKY z9*4dFic6Hl#KntmuKibyS8?UZ7Kh8ZyWi{1ZvDG+zIZSEa%TAA%x{5K3^*?RZv4*m zdWwI{mbx+X>9@EQpCJY6dAf%6>F@$WM2YyM!#3)?{<=?y>4k5Nq({Tw9<^p+NMx{qYbb(ok zx&#a;LRFroK0sVE-5f4*JNxQjn%Y*ythgH2Qb$ciF6>!Pl;4D0DHQmr%Bq@Fmr;Ff zWmUp7D-@Dj<;kiPCc8G3L>a$;&PX;FC8<`Gb}cJn&3S7OawqIM@8aU)KGUDYc{g+{ z-n_E+uI;+#qeWldcHaDx<@tH>=IQ9XpI;Sa$I{cCMz8yCN7IL_xCMku>la>ed8Fcd1E(C0TL!nShTBoi<)ZC+wqvznzB(K^ zr)9#eFRGYwU9z&7h@p2XdN#gQKZ-J9@p0vX)?L~9s1(-pgX&Fu5%*`aw@V&F0|kvl z<6ChbM#5zpalXBDu)-T8v7P^TFGwd4r(e`Z0DuuIkJfet&supzE1syv9E@*IClLXo zbYz9Oo>$F3rcUJ0I=mDxaMq$~h~z;r!ZmzQc~klVZc~5T^mDT$hT_F^@ugJ}lhm+` zO*e4Aa;r=RH8-ThK5vxd?y!2HC*NY7igc`)$80yY3F%$p)sl#vO4~WDy@e7wDbKZ2 zb|ME=vR0MT;JLK|iEVbO$=gq7-xL2&7SaRP`T2UuC0xlRUCCt`C?sZytY!l9p%@-J zg}BO(3YMY90pS6gX^HIge3&8w&!V z)<7hTFc8Kg5E{A3tv{$I=hJxE{Zm=R(_-E&jdE=ILFK-Bzs&k$)%l>F9`A#vufxmb zjXI`El%x<^Rdt!Vq$Oh51tm+8!d6w~^E{rc1tL_a4+a(`pUeIyVFAo3`98YA0|e09kC9Ld0kjx7DJl z>_b~gyG9V#1=qY!)(W0isv4KPR<*!uU&ytE2)pW=>ME)`KS9~&Mi9W52SAtlp!cYm zbvi7e>B4fesGVgJ5Z<)6cw`(@7Oel7Pr6)!daX5ch-XJT10LE-ch^A`f#h9^UJmA7jj0a2<@m1mW<++R>d ze@K8K!YjXo3rszOSch6HAr0zgCYt7&#z+mwy|bw}*iIeBJI;7(^OZK=ui3@Tf+p&< zy8N@HtF&>;@5NVjJx8ME(yT2}5ub!e?F8ldhB&NfBo_{>ec%I8%%Y*xg5X2G+>azH4=l{cCHzpGA(0 znCVA@W+#Ife{^hIH)CjZ>Wr~ia6=6&CmmS=mGF|LFVvj4Wy>aW=<3R((QkkRgLLiPQ;9KL4~bMP0#r*FkJ zvJbvI$m*-$&LKyT$D_P^tTXQZo-t`Zf0jhm3zPVLyzwdGBhRlh zsc$}T=Modk3kpuO$P2It56t-l;A=qYu5FdCqHU@^M!ckq3VkoO^&2F?SJn|NduR|G2j zFnyp8^%JPza2FcEsrJF))^YRyUb9NxK|O}acJ^pat~JuEV#4AVYCZ67Hua(A6G#`Y z#=}d-;2YoZ_PV)mm`lq5R@e_jt`dJrmo`J8idbM6LSQz;IpYdzm7z0?jtY}SA7h+Y zoFl1TbutAa`R)j_b|N$jL-;tl!~-z*6udG-=A35A9#P-E$1wY~mC9BE87yqX$(6GU zo(mBcbCV*gbgpVtmt{6eA#rXOZ`&p-1t$;XpeI>K08}rQa%ZJ5O58oCjiksCQV29} zrdtYchD4mls>pI28WX)D|5bI9{>f+J*uk}NeGfYcyyMhlafjFUD^P^~W$8s#ReN~{ z5LxZnJA%--GpM0EX^(*7&yju8lX3l#Oo9%<=_RIq z>?4Jc-yHLZskXb_6Yzo9L1}n6^ z)zuo5eGQPlo)5S@ z8v55UWn`p-By|xuyleR6EA5_tRpqg^1$FNmT9k?GZB5Xu4_7k;_;R$4h`wjj;OG$= zq%}9MY5{m$iS|bXslQA8N-Q>r<&9*S~ADvl086sI>KnmuQr&icFCy7p40 zIs(h=fwZ7(Ac8|JQYg+#t*1EznIK<&+|F0jVm(~(T=9yD-1{s4rA^I_ z!>K18QERh?F!k=|Jt{TBhqG=NKKYV(3kJJcz)wJUQ>~$ND^2F#^BlQpY?_MNPC}sz zca!@JjhohM?b5SJHR5 z5>{Va{ET4s1-n+S3d-A>>GXZfRcnQ-y%y#V4njN;5=R|G!XKZH>{L;I17&p;*k3zn zio?+Xf36SnXiXK*6XnqzoC$x8@+hT++sk6IR<^h2(bm-1A4ZRxhUBB4mXCY4 z74Q2YA6x2>d4iI*;xeY~kWSWiU>z2QZ&cKCk|<5r(5S70#RPuqDw(^llU3o%$=-XN z6s#s!oeeU_d5VorU4(nBpRZ;BgF^L52^LU3_pZ>Kru&Y~0$uAymJuG<(I1Hs@uxpD znn8+V_ctP4Ll1e`0vR88IiR}Rw+P3;+`JP$45ndky~i-3R)eF7Tn3Jx#~mMLH;&k- zRcHVJaeGk!B)nvw+#HOpZ$(O~UbkM;j_aaBGhVU0^~;`OhF?nA`x?}y^u3kMZx4&Z zt)9|bn*Sv~_}5raZb?!tc>P-erw?eK#!TE@ZQAC0Z*h$xdAGDBJ~rd(ZO25p5?c7iZs>Zv4-Id6bWt{xe%j z=0YRixXjFrBmxqASRCNwBf#g_%!)*2m_BlgXv}UjLtPrTpGgOl|+*Q6DQNLM##IQ6D2sDB;Y7K_A z8Md!d8qjv#1_a#cGw(=y%QpOA?HbTCxaFiEx(A8^5>A=UN>$lPHVNWQaW^<~<>aAz zMk?@rh!#SS5aCt%$H*BC805C)kM7(pq=%z|tp`@$6nw?(B?+7^7IWsJ_&$X2hkIg0@wt& zOZvkKaT~5CvkDVPN6^fq^Yj+X*5Y?@CC8Jdnl$I>$wcwu#dn-%ab?l7L3MTV6<2%O zc{@F@8$gXo5|ildZqa2RkSaV1O+?xfqBni+2@R6!j-wQ%f>&*|(Jx8=2(Dh3wI3vb zEq_1EZsrRnXIT`*C=ePD7ax}XY+W=^RyMS|93;mchA5PJowIGTs7aAThmb^3qiEHK zAZ3xvMM7#=n(V5UlJTXw)E_V=(%{MUZ&UjHm0~FSF8Y>~NQvlad}rLELtXizs2@`qJTHQQ5(Ig7uWrB6?lM%(x1ddal>&V3cYb{SD{?m<0cJm}b}M zdy%%pHNEIsPrV_|0f`OBLqep&+efH_3Xj{TieKX4Tz+H)5c@sC&1v*q9svpFIFRS^ z>as~f#$!b6UmVES=A4%RkpPH0km}sRN*DR(H3W<-(G^PWWFr9RJ0SneZjnw?;bb^z zup8Ag{l;f4R!HdFxgI+?g4Fmb>6i*6pqq|Yjf*&^{>%~jA|W|qlsVxHjj<#_uON00 zrn=@fJqFA&Y$?*Yy{9-O9nB7LU>fGn%VPr2OoLteirbo~2n##ZX;$zIluBBuEk2p! zoC_I{q2z`~jTD2R5nsa8Wi~s$Zq5sHGRL-iXN$!?UuPam8Oe|Y378JTtRFzQ2v4?( z3I_*Rtquu|MU<~$EifNJid<_#U)_Vm<|~(|wJ&#p3DRqlgCU`MptP+U@ZL1qz?>fj zyHKaB;!)u#GiH7VUVDGAw5SD7Nd&kq_G#`0s!)q8SbNh{HwL-lS~Ni77CQI0t7`Jr zHG&flaezrS8!rIwOtj=c_@`CJAfSc9X-{@6MDkW=_2%LT{lApSI@ z@MJYn3SGIukO#09HqxA6lVAEFS!1++&Z6N*>5odyS`*zyPxiP>VKi?{}h77MigNTk_; z031RWP;hyY1uV8^$B~f-EI5r*9INd%m|04XdW%*&O-pST@kG>WdOQ+xCaeU%QOtka zYsomBUl9XJqBjA2ejnNK4!ObwAgR?B0tT~|6A&w)hlC^svql)e=5e~#o83ROMlJLt zaLg}%4VDFP?Noyybft-kyppUQuz_JO!*vg=T655*N9iY0#NKA)i zT8+|IGsxY}a)E_9yPZROG+9TpMJ#Rtp@20oe)b(b7a}q0d+zC{+ohYB#>EMZ+dN~j zga>DR9b@5q5drXP6yn&@b_G`#u>FnLNpV4+ewS3Uw&c`SCe?heievLKGJ?6TpJlSr z+WUREenHBXo6ROLxa!XtlXb*lGxbbPyX5N8p!d7Fimz7jufye!NX=coOSk5>IhDAk z{E@2Ao%Z5ZYS)bRZ;4bx85puAc>0WFLWI0ev(Pl_ok-nIe;fY%?HzbUhna4ie)YKe ziDz+sScyeRG)mI>shgF*5rDl$o|XT4B;@21&$*=kE(JqLGXafIovmHB-pyBWQ*{1Zx#v}rr(!yqYF78B=`f2udZ?-O&;At5hZgTu#D0)Kv6~eJizX*)>sg1jz#69{nhZ0)&+mm zGH^4p-Dy+D=wg*~-8q1~`Dgm%`*F+#IZuBIkt4}|Dh}Yxhd(+wb&cKZ4=|i?2Ya^R_9)_nkFv4WL4?fJw1HKG zifMFz=GXo>co{d$pJyA5?(oqf2Xt0gM4O= zZyWu>5cZfm zJ~NnGQ9FW6>ajNS*zcEF8=b1Dtev^-7lij%L4_ahsw`mg zm(j;!I9(tQ{iGBbjTQ{N`FC%$Q-1ON%MR{G4q(uCAnP>vyuv){FwfwLjb!8L(CFuo zxA11yKWBTUEPDOxcgc zBkX1*Xeg0D70Vzln~FLs4IK;~zLT}goT;tGydkV4s06pfl{L*#;5{I~o-+XpXAZV{ z)Es98h^Ea&HA3*3rHIw+JpsdaGrJSI0z17|!ft^X)x0$(~q zfaiR;AzeZkl#@o}fhNVm4O^-cc0Dpu16v$qqFMWj09}b9G_ZCy$QzRoRS3xSSs2mr z`79pBhQpGdL23A>4}#2l#)p=vkLkjmVryD|Z;KCJ^sc8I%Z7%qn9bF1Im17J?ne{yjNc`p&DyA=s8u8`FtQ+oD(6eRv~c zLY{c{xfg@WL6`n3J?4ljZnt}u>Ug#C&Eet;8aM?xR+;8+ z$c-eB>i7!yXWKxxQLtfE!S)k-TjW`@z1G5V7`|$V-|B01I)hZ@`Jy<{F}f$h|Ul@9i+QZ}g`e>Kz^;9L1d3`EB4 zPK;lJNWrUs_$zu)F3dxb)t$)AP$yvF24JDi0f2yNumXK(j#pEL;4i^qSadOawTsko z5i&V4!k`l%2q&#Ue?($CsRfT+` zslzb31Fy3GKMlQ0q8Kn;LaJoB{u?!%y?%RVsNx>N#doV2q`|1BXQ*^QyO-l1yfZ*# z>3lM@xD0Cj1?aNkn(tN5`X|V+elpi5&P#F`QxDEfNjYXe^-P;*p0~}B=iaI25H{{K z-M?YDFm%ynoM;y!>T{$P(5jNXLvUqPV|L zOgTQOOUy=BPx|d`@9}!$QNb=1K@GD2Mhr!^-nm*mdhfYA z%xp{cbdP7D3?gyK5%xQaq#k3-95X@ylHulu5v^R9mMaBfY3}MhpQ)3={mz&9Lr!}A z>tHevTVdV!OnmFRjN<`2<0UXyS@_$vUOCq3s`T3NiDl1>`Md9o`Y%KkN(?33f?HCA z+`foa86U>0oAQK@3mRuA<;?91idT1uBSJKvaD1tzt72FBz}hNj@>czv&D&VKij5)B z3RaT?TlNg+_kx#>LVHulx?+{G%?XGaK1o)dWqg5e44iL;be z%zmg|y8$BYwm!wW1BQ*`47V8cqos6MmmFS6-{Htff2iDt?N}j?xs$dRET8T&4Za!B z?!otOXwCX6QCE33Mw}Q|XxSAlnA;+LBFvoSXX4XLxGIz_Qcsjw+NXC(#&H2&lLHHA4u>q~>pG2*cIr1GZ!d zhn1nV3Gy}|W=<5F)UF*MiwTJ;(=ciSz|Mg1!bv5O=J_`9iYa1w2J7R4D%G^(hQw%6 zeRqR47?l37Jcy;8uTs`lH)UOF6`{9_>Xo83A#4XZQHhO+qP}n zwym>m+qP|6XWKUB%+1W?=6-K(zR5~DsqUnIR8^-}t@VINE8`WbtAGJy=k;?El#~h1 z1kJ>nWpe-tRuM|}(K+DCQm|<6mkS#*gMqIyaJ4Ge!nmmkYW#TSGHP1x1$H34!&N0< ztqlZQjKeEF#;p3a*>0t<{4%1zU^F^mxH?_1ePw7NCcKEd>_T#O{SnlI-IFHYl&T2h45K`;dxAquo7>yfCc`p`A+$?tO+{(Arp2jC?-R(E4y zrx9s~hm+!)8Q>A%EH1}6%`!Zy#$_r6$}7TPAdKOn>h=6%OdLoq?_O~kCF!~3o#Eni>Lnc7}gU& zGZ|V9gpUr#dG|p<3ng5&tfRo@;=1kG*de?w+*I6J%c2Xo1is9MH(z6Z@{;)={PjeU7vvclP96r`;2%eb_}2nb-U;h zi3EO15}=WPPUaoPhEiDj6t`=Wh6s@iF*tDWEpL}9b!|^nxs`;N0HJh)BPXtfTLFQ; zn*IILU@*-Xv!)WnL!C@eyzvpL^;bv~v&%eJq}Y&7tb;A&U~zWmyzlSag${%l1ziGc z(Ls^%^dMj1l+XYT)r8ysI+9Z6{nJ?UOlh9RnU&L*7s7lFwe2p5r2ztDIJFAqlsbV% z*euoSrPvf$CQQFnERV4=(GDZ^FQ{8UV95V$8!@B>Xgyr(7)?>pc=&vgG_U?u zz5Z_EL`-dNIc=Z>7|C#MZW^0w@Ojllc7!kY`*jHwO~|^h&+i{cSIt;=37bY!nPYp` zGNjGAk>wZL&rbZ-A{(*ZQr!Y>HFg?PRphvc;kAj4QIdes4#l4{Z)wlVdA7gtClesYQk+rhVCz^4#Y}BzYMY+LKA< zjt8K_Gmj>PqSNb-h8U}DusiKd}92^p}3EvdOlQwia^#(2Kxxp%Qx&uVq zg?iHyxLsJ34ae=|1p=WIET{ItGt1UsLx7CKGXV`cMD;|8T%(V&nMlt14+K#&5SG{_CP@9F=JG zi$@nrNCsH_Ndpb_VQ94Rsew-QW zaA?{K$?8%+IDGy5RJXS?ZI%?Z`m?ir%f=)nLbEcOsX<}O_BwL%x*xAFy5+z7%i;HW zqE?2EZzw$!koP6*JASc!@WtMi*ppsbBQfNW{>o+_H&#uzYipmPI$8mw1wYuPOS$TD-mf4TWvdn5bx5vhf^scM>iuJm) zErA=oUOb;b#Om{LlZ|iCm?{{CZ;e`if-AY>KX*ZXGDOWrx!DIEJshx^9i^_;!VokRU?nawwu z9aV;j5MwUnyWpzao#r(>H}hw3pM9=!au1=IxznH78PZg=TKw}w6%uOO#dKirlUk=C zisIEQu+cmr$hP}6fCX^dNM?n##&V$&5M!JF^F`^h*bF)my z?ruO<$iO#ST+kSD-E(hk7T@Jm>B-X4i11(L_OLYkNo4Bz7(DNWf*{|;iB}PKr}s=F zEOr}X-phGLO9*>NfA36e(7x}d zNRm8UuD9NQvc-ucqMGwK9G~?LdO6U$C9iG4e>Xh1Sq|yP*f-g{b)0GLu6=Kf2}4EQ zWxbE){>TOCZsAx)*gzJRQmGjT4CYKSXm%`Zm|Bviuntx84=Si)l(ADK4WtQ6GG>5y zt9P+o_5csnI3c22dNaWpg@MeXt8; z5FE=sm;<&5ya<75AfAjz5~1%PC2dI#EkbVUHS{82szU>0D!{%B3Rv44Xd^)Ggg2|M zJgq`|8Lp$lIzJp#gfQP})KAQsB+i%D>pi{4YFsBV9ywcrP*Qye%zm7Jez#eGL!uE| zSP}FQ2xN(Z1%s8)rH@c36o(2-GGvS3bo$}yHeG%uOV8QcD#`>?g3 z62UF3CO66v?1fBJ8w=Y80(tlEF>$1L-Tnw=B3#G`6PFUAm@&lhjHkr$BLNUh9>aCu z^AKQ4Ct`5R0IaaoSX=bvS(ANcTOOAZDm8$BLz zGyKpB+(hY%5U-LqqtI7=nLHJL|_G*sHM_R1H%y^mfy=zqdZs z^K{>juaV8c~}-q&u=5cX=WasaY2qD(IPF$bqOe%O49^wTr+^Oa9FI*ccoQy!;} zP;nn)!;T&=U|>w(cP$-lOyqV;fl&ibE5f*QaWk*4cWUsXd})hc#t0RG_Ub-4f&P34 zFwoT*gbRk>MWqdki8y&F7@G8UeY((H{#;{U)U1RAdSd;NGmyW@!MLSp67C)=L?amJ zA9l&s>GTvws;nQ;xe}d7KvSHgIg1Sb*MK3KSm}Exy&)8?F&#v4%FQty9I*nZa^sl? z6zFrh<@fiettg$NFDcDDZmCzUkVuN&hB;^INeVl_Ee%kj5i0bqUJFvNOqAkmnr8ZQ zhayG#LiC41j?`Z~Na^H=4WD4-qX^c@Fb{>b zp)*Ua$}!Y=2^zzVq#5h`?#wBoqLF(MjnfGfRd9PPeOb}vUcZ>4quxt==*JSg zuQwq0bk6cnr1X12i4>`6zjYTmk9xp^1)NK;Z-_Zr1Nx<76NpcyjtJ)gbTT@eZH9!l zBBT*cV{;u{W%qelh@SfPUc)ooOwF}B>o*OUP2=9fEu)Cd;R;2Fbz*ofyRzDuBHTVs6pMi&XEFFDamD}H}!?et3w zzx+NgPIB_8Wt)wxT6**qXC+G?{v=@<>eRN5T&#thgdq3s&a=oSZ^2)}CR;u%?etyM zzCPm5EVy0z+x>by#$95zxU>Y?2WAuhgD9RZc@1giF5dvN+g?|+Om} z!{Ebo^-x-CzpeOg;W(y}rd~~W5r;~|_(v)H6kEUwM%1Wi8ah0|x6XeDJK2adLvy;*AC8+}Jaa=?T?3y92Ugt>4Y zlWIA0&+Y%dTXC=5s0o+K>}T{LivX*E0;~kR@MP=RW@hPhV;fE*oe{!H(=KxXCZ34$ zf^Ru_(MX@QdArW~XF@$eGkjBxX9I6?_Ln8b-OYS9=Q;YvfOq0vxVb4JP(rSJnRqO2 zih8jK6Mq)>`o`d*k=x5G15EwEX5tDC7Hg-tqDq{f+NKQ{QKN5@)pe~c|FriJ+xPF- zKj&alDTC9sRz7@N>x+H2+31L_45-2Z0rXd|35EhBelvpAU3-i^yBvj=eg7O}hM(ol z$*1GYi6iJAi*LzSqBqnL%my^cfnu>+qPLrfGY(>%m_p%RsxrUs{R4%CpYqFiF_vU zZ&+iXZ1n*V#EFx7da!l-HI#mLldCZ@j064dXd;n=hcwm_mWFTXBEYHje@h@nUkLca z(dMZUHyHYEzQ|@w~3bp@C&q@AtkQxx(@+l za<>}_fOw86OP`Qi;uZNMV?IHCYk0S00djZH!JRdEKqVXev>$SBU0>q7@=1GIUVmy> zLzl^>0PvQRix&@vvFH3p{(MN48dHugVfYXf*kGI8wm-}(jdOIhxvmI%^os3{1ExlC*#DzJ>C7v{RQ3>Gs>NoM&A4&5FL$f?r6itVQ82X05 z5XaYKV8h^*qYp{bLoNiv^}W@0rf6=N-ze$F?URp)SBf(+1BcHGw*VUBPyEAoZ*|s- zMdd#kN}ARkzT7MLyf((cY@`e`=)tO33Cs!8A0dLA&^Gz9)~jpr5HjdjBH=u{J^whp zY{bN9a$~$d{U{{Wd?yu})5(M<-yl@5yer#6=x9Dfc~VO<%T=ZsE-o9Q-lfExxP&&+-H3PK1j_yq^*F)gZmNg$!(vEZ3DQRL&$f+zYPFcI>R7?%Y z0=|5yqR~`B8W9CvTlqAU*IS9p#vn#;0;1xLL}@q;8H+@m9FFsXkj6GQ?Ez_(Z*?@m zsY3+5a79)?lKZdeIr11oy@NCMyE)nbKh!BeiRgr?{OuG%YX~C;_n{__5T16|tOFYm zn)klgCabT?-k1xuP*Medk=wH9e==S+_7}77VC(3K4q!gNM$;C*D4lAA|I(aJoqdEq ziF}<2^*OeR-`2voTKlQB+O7;sntM^8;CXl_v9vIQD5~#}_OugqVq~ z0S{)h-jxxy=FJ|^aO5a|EdOHAaluNU*8*h6o{&*WmhHRKYX8;PJL&7=fd@kjqFAk! z9p+?~5@922h`>cuPy<=Vn8ktFWiSJxAGaVt&e+&SM&;W7P|?J>W~+UX8<@zR_1bT*7(C<(&}F+<DacJUY78y4yT`0x?LmwEO4ps!q7n>3S>7*`(LbD$_SjoO9E5_WlmAFi{*Kuet6 zfIsh6bYbnAX!lE$T&nPnOcH}Q#&WWv$u%wpEHGvB8o-|Z?K+jDk0lA}r%5AO@`~*5 znsm{{adzU1BCxU*5VL&8@d%~6P8YWWF_$aGj+0bEBy;W$DFK%8F9efdDu|A_6m7tY z{Z3LS(Fdqx2K&numV|J58|~B9=o&MJk`OTi(rSo#q&zdf+5zB~G>7wC@u2VYV$;W- zgJVbWOWb_+B{xmV6t8?!fV+%IVeG==lIXH>qwe?cx}{#Fze6aqjaG~K65Y6!Q=sz{ zo5xZy`8QKY>~MKClm*<$P4-wRB@xJG(H;FEN4_U|uh!NooW$jMkpIhiFtCP7N{xG`45kl^wusnAc-8*+OQV-1aYY#wSlXQ;2*IH*P z@8aljkMB)#FSE02Olc)6VGHJWvVXed_|9~#nQ)-gYa<3y4gE$>V0Y*5aH6Z|(^eG~ZMgBTD--1$ag6ExbX zX~(UI$Yytz0gnktph{it{zj|CwsZBk|33I}hM*y^0sfp#f=Eh2MYWHcfRzF&O>vMz zX3QFASTV3(4e~1C;ZDCer=?ilyFNLbvv|-+7qbk|5TZg>Frw(Kwpp*N>3mk6+?#Y& zU54$lhmBTMZ8{!YC*~Mm`ZBLeAM32O@#8Ri90-EQQvDjGF~2l66+Ny#WK<>UN5l~? z9$d3-5l=Gv1J4DO?Jc6Tf)uFYp-c5Kn`>JmZv&=inmGU031a2^4}!RC9RCaI``?(L z8O^D%$6ytE=hE|I}wR)t09WV*O34%Fvb4vL9z*=SJ#`4 zwK0GJSb@97;Mm);$D1b^1c6}&$dUaoumnpiHdg@BaR(aoY~H)hUo_7zzc9HxeZoCH2R|sFHZ0%P} zjy%|hbqLH_QR@ceJn@P*4%i6$Ht(h%&#qC!aU%Nwdhs@t>&@%Z0Z`)){VZOma5eT~ z)l{=q7e|iiiMMA=7+?nTEr74HuK~}LP~(UVVQdb>wbTri47)%RYhgy|H2Cq&J!L#e z{y4OL1kKER8r>otqs(y=l~VQhQO!(9zS8g=+6MBv+1%8n-A%gz-*M0QPuxfj>8E(R z?}arLtRhGO?3UOiEG1#7o7()DV5l`aBeG0`l6}TucUEFyy^Yg~oK%Z>_kEm3EeW!{Mdi+0JY1M)8B^cl z%@}mD2R1*l-3I+&(^HoIDL-lUPb+k0YQxF)Vp`TMaK-UFq~;BJ^$RJ_(YoOk=w66| z@@#rVT?E~oQE!5^$-Fw22qZ&xJ#?6ZxQ5RR>g(V@EbD^B=ANcSLx*teQ`4M!{ah#w z)twLS*!lsRC=W5(3gCmW8qLolKXM;DKDX`{&C_^${X%A>KbKt|W;n*yPMG zys9TE-Xr{9H<=L}kdlRFlI>)pyoA$OpnaUISXrCmR=AHb%5~}HysiSPipi*X>PeIi z?PY|xMWtF;2S&wO;ASw}goHZ#aGHAxh^L2au;{o=AQ47E(HFxxoMx^8ijIv2f~W{5 zF4Sh4L%3A4!0ry{@tD{|Lm`J8A<&LE+Z6%mmi5XEt4R@pG5rB#!t(@-Wedm^$V1qQ zL)a0kBD$u;P*i3f z%Lu%AN->p-zt!n)j1a8lYL| zrFRfG1Tm@w>giOf?(*8PCQP|0G7|I!UMl?vCo=!NJlqT+F(%c9z>6t=i;g0&>mX=};Z0t5w1gm}PS3Vgzs#9Xbk{enb?^6%*hRKuXs5?w z^eH;N@9V+s@%>bO{lTP4mub6gI+cYQrD+_4YdTjeI>s_)J3rBMR7w+Xk)x}-U9wKE zb1_D{hY_P@B4$scJIos zOEO%%=l!>i`)jQ0_l9k&?rwc&WQLVQj?cI0+s@th{r=+n#;a0!spj{}@8|AjYHDw> zW6xq<82uT4K^?L0i$GrrBh5_3>ca|)`!k$R&<&h>~1Y`Qm{=atL$*Yo{^Y2g01 z{pW3o^~A5edpzl!`E@d<+(DPF^Rx96qII=t?Ob#eYO}a;I=$kg&^3cmaz^hY4`C5k z(ML+c{mHG-?W)0TvtrXwSCzYTqg%~A1fA$`!Fi0Uu$_N6E}A?=`IGqI$sD2#9}%v3 zemoVET9_jz6;nNV`oTO}Y6OVTw5O2hK>|al3`+PypAg0hHd=@mBG_wA>nUSUKvRn* z=ChR<^|+kTu~jb(vnu9l=YYtV1b;G~hWSLvN%Xd1Jl(>i8Qb5#Ch1-y>DxrIm6cSI zjj5^a+EmJi?k?xOw8+fmj-1BDXfB}ycL7)}-KiRq%WS&DytzR>>}{fa7y75C*DTcI z@-I>`c^ZLk3y7g{vUd)f@&@;(oCT5ZKU*-EcNb7Bc;TA4a)FO*D3|GU>Ubxw8pZA@v&M^~IqAT-czKO22sq1^W5F9(g<;%jp zs?~YouFlmW1`Rc1FOp+1kko0a+RKaEb>!}@4KI8ZytU-EhP;;71$3L8w6Kjz74kj# zExGG7@Hw-d`{P_~ekxO63b@ypswKQ-l{n05w6%Mtqd}q#^r9zZ8e=XQj03T3Hj0p5 zTJF>-`7iAtEk86BJHAVyo_u)*D$zIvgLM?mIDWwhrW?zH z_0DR4rN1f=yJ4?Fhj}zGl)heKJJfxggfs4`!AxEf&Ptn8=UqX z_ebp1j33L9JQ~CmA$cIX&(2hV=&^MF^e^>C%PFwl6{ab|^1ya$ysHA!qj9bDTL+?3 z2e$S{4;ItjY3;ZC&#`3BMf_q{iNK=>J>#^#6tCQ%iRBF*=}aec9SDgUELg(n zFMrU1x14;hCz7$O==xIzh$@LOH3Mtu&jOsUz{v*-xUMpyA5axIRLJY=^%PEMYbhR$ zw=a(ZfsJPa-Hf7!YVz>L+Bz_}4QWqX#&JKjlfl$(87@cu_v>whGs@~T)G>{PDI7|s z*^7L-Gme@p)MPJ?@i|x;*Y!!yPJdFC=Cde?COC(OD+HVhiT4!Ol%cA)LEXAe^3O4< zuktm8=9%@vmWkgX_ud6`Sl&;OIKM+X>?lsS)@ocBt^`gYqqNb?O4r&|7bL&RLmxFD zs`+wLM7K;y*ozM|4#+hB*dtG{Y7-DlJs>2Q2Inv?(^&ti4po9b-B=``stRcid3`Bb zMeB6!2rsaZGr}x-XHT^M4S#~b?Vw(!ndFme7P_0@c9Ov3AYG&;Qk4|Y2lb9TPrVVz zo@IT9kPaoiY93c-s-yJ4E2a#Se8FVqGhmML@xLi#w)ofz<%F}2N~$kg5vGU`f9dnd z{wlB15ZeZ-vh<729+wg#AteC| zLJ|^tb7O}v0SGK+TQ3>xLc9YdQ6$kOArVfnLkdf^2s`(*)%W|Geagvg?%ikCd)xD` z&+*B?Y;o=+r9DJL2*qGdLe7pZ0YXq!TRRO46d=&8Lx2E}$J~U6at`q>9XDnJ;3z6! zI7{@~nBW>3kVuh%gAvK363z*%lFJR$?g_XJM6?}5M1T+g4ubSEg>XUzlmOf%SOa*W z1Av;&3=%j-10C$$DP(({P|o9z3s|jY17K%pI6&UF1Gp%Mpk9u;j+qZ9wkepcfLYTY z2cVmdiW2nnB@dy-$W4Mo2L#gD)#V(RgP_Bpt_|5r4&Y9)2$v5mD4?@Luo|FG3e3_k zm%uOmchDH@Y(o&ypTfnEO~SpN8YBRTL#T#e79wTJ+1xsU8sHCZepNNte28%NFN50W z&_3k;+zCK?NBb|_YuRg^fWqnCtN}H3Ix^1H6{Kq`=(+$dA%H9>D_t@810=we&G!_- zRYX9+*MOZtIq^D@>D}jrK|oM58$e9u-P{L)TCD;H(m-ec*H0zl8#PSj%){(zBLg{k z1T#|L>!qKQf_emMK)^I;EI!{8PW$l*GVJ0PjwYjsYDW?t%ff3HS&D2rl+N_c;9B z_vGfy?VEQ%e$z_?dmMte9USsU;PU8=g8dSHU$dG^*R@{6;)DzNnY2=dV~KN2tWYh^aQD zI(LJ-Iu#!0{_J`l%5A=s1E99`Kj+C5NEmr8=wWg8b{&H~cD&X#MsK?@OLWtsN|w0Q zbnVhMlw_+~;;h%;US%@XleIu@YLaY-IQu_xm63+cB~KK0oE+JTXw8|1E*LMrN|59d z!Eh}WNadmJ`IopVKtd}%XXD;tX!d&5W>(tpY~xOUi0}%2mAYJK+0#CbVX$W@Je7{2 zQVv@`;2hPhyZP7#Idx^==+EWVhs9t&U_h5_uwF`{%tC{+zw?ux9FsZ(m;O2517Ed! z*`{USx_>$Bn&7puOf<}JrHprqBaD2}s?B|!825K>7=yj4YLKdnNqu&5*W$dVeAQr7 zy>tvhed~R-ay$I(Xyg8%@ z_;O~i#*9UutKlH{Fj~9xLgxj}4+O8fAM~nv7FafDUQx>@Z-d6yH9DEN?iEq4EbW8J zOJ=dS(+Y31YfQ|kUh4`aPV2Ue6-oCX1^Mvt)!?<1RgRjUO-pu(dnOem$Z)ftcN4O4 zX?l84Gr}%dTQxh%g9R|0N<)Nhk}^#Xx%UNIpMX=4HkQ~h=so$OCgCn_KEjD zobHLcWs>UM`|2r8+WOJdOt8K8y;8HAN*z_FvLE0>qjh5xO{HJo+=&f(sgBVUc#-6< z$}NQS%H23jEZtB%UkyKMH0Ze_4cv2xyIGgX1nf^sKJn09j`Pt2+X~m7T!(3Ine;P8ZJEGI?iSDPNrPwa-cdpo1g6p1zx||A07U9YUwqk zwY{qkB!QpAc`DMKJ+74g+`9b9v2GKL`|<2O>wOE+vY?xK*UHxYQ&tzM{t2B%FXz8Z zCn*7zFk8EFb}aKc=y%p`9#a#sAG%;Fg!OtC0N#!$tKH0UopO|$wugQ533eJn$ZnQ* z0>;V+^?~0`5S(U9=d&fjCYH2LB^1iw>N=WB=B<R<;b3Oh}LL^Cao7pji`jZl5fv>rDJG>4k zToWrcom!%0P3pM+n%`Z>q6)~Q8@t$?FeTlYTlCi(gE;0^wWgJQ`u;ACr1qos$$UZsHlV{FDltO<^`85iYGS0&}Z$}H0LRr-S zqCT^$k~vqDK)Cw*I~Z-(>MHCZT}yC)n%pP6?a;e9Pj`vG-E;QORz^b`b;Yd8M>>uy zwrG3uDxb>U%wOL@y)Df1(c7u#R)O|}LZU21fNdRNAAF5dOTj6Qwik-}$y?ho z@l!!}Nb^_~MH;uif%>*^biKWES{$(OjRK}Cj4I9g`_$PtzjeDAVX@~YIZMur?{8>N z+55;h#efUWfnQIM9*yBvepO-Qy0uh{v@GZJoJX$7*KkbefR=}I>YY(8JaNVEdYHKh zJ#}^2*C7xtra#sZ84`9s3GNgEFqu% zE1l!J5w8;8O|=tmi9wdzVl#`9B&!Lg9Z2P>;&Qr<^VG8px1WGx>{RzInAI%hpR`Pg zZTbRgj7{a};)>+7%gFYRshq@AD3aD@>Y7=tQA3tJhf!E@*660nb(gYkq0=INXl2>* zF8`o+rl?i<4n!LEhAYvlm>Xr?b!xQ>k@Tn^%3p{knd_BQWiMA-N{Xq!wIp9asNGsn z<;MiLlSPpJN1|7Lo7V@c*U#QJFU@!IC(&@sx&ybMhN3i>F)x@V%qw)f`2;%58SB z*v16?->31Azb8l73(zpEww&h5WLrg$)G4h8*eS0AQtK`;9AtX$Yk3g?MaC`z4=-RE zyLBDJa2?>mPgKdU%eCU~ys)ai-CyGH>dO8f)2oEHCtFh*_Td;2X`VB8v#sZ{m2a%} z80sy{yE1oLI$g)x{W-e9Pq!7=7`-z*2b(0Uhaz?*Wwz?wb%*y}ybbvHIss^5vRyjxUaSp zX8a=s-+pg(w(W2y5aP@qidty)PHx>-e^fd4i+=~z2IfW37L~5O5cYO>kmV&vHFCSZ ze$1UO26{MAUk1Q`x9=)QoL=;}#3(heA1~8#53TX#wRbDmPz~bD3D7?dYDSNn>yIB6 zJAS>%ED10_Rv&=Pf*5R&1EC|XGEDTzDkwxb3K?q`YD}MwP>Ir=R|_-aW(Z8K=Db-`umvti_W#yXFCX+V$yO2pFK*K~l@s zuA(?h*bn_RJ+8AMGYQ8tP*0U%!!pY07aoJht#=L%^D1#Zi_|ceSy?MDjevBF9G5%! zI}NlOFJnQb&P4~~e~(heNyYYfm=+J0|6tS!iBtd43xVY@9~&~}m+}*7r+yUG5C4u~ z7g+MZc|S^6+2N?5xNDbfD*Yg+06`G%(h;*s^!{9#;(#KIH7z1Vi&&lZPmFT-SL|#> z>*tNo`?I3gf}-qeeCRnrWF4G$st&s5%li1aMjhWXNsDCHSNYlD;F?0?hFKhKp?7XO z?(>k@h+_l?ZW0@1FCjjS%3kVl^Dm>eTMZq;gjtDd5=E%Zj1?@MN_=!`p4_WU59Et0 zlTXV`hkjKr5${oGy@1BYsHy0jjynNX@%S_{;*7x4aJD zg_g!HC*Ts~vH3D{10CK|=J{h%YM04!4E}8m-lP#@Zg(9L-F!^&BQ?*FA`GE>*0*x%rzlUGTW9-nb5Y{i@BYTY=6+v z`|3@~n(hLI^U|=HI{z|ug_4mc2!dzmo?|;Hfi_XO#b+bqb$7g0$eoUuPWt)Vjo%y{ zsWO>&kHFWxXk8BV0i!Si9dEIUi}il*Z@D45dPB=z#UZQ&pRFkbI<3EAly^-n!6>j6 zqUGJ{vEG+~@OxMBt4Q*l?3Pa~_f2l8bTV1p2_g@j9KRh&Q+p}2$|aqgNKbtHGuAs$ zq|jC){|K7p(M>Eet#KR26`i{ly>~P9)vHJ zmA8ljLRf}h(~@b7c48EJqQUdmW|N{mdA}hhG2C-}aVvk&$IfZM>bybTNtxDPPB8o~ zjkX>%akuR59lqYHd4WcA_#1N##Da+ubvQnmes*+Gt{8eJv)CLU^3yjI*9hu- zyKxjs=M8TgX-_G#W5)K3hTL#POTcOVA=az4Z-{cq*+?sLFEHikJC&<-J&8Ic`@2>a zLwW*%5zu6w?sYk37eX_!LFMTSwl8T3)O~Py!S2t}?SF@h#k~a9RxgD<9(d2?rgBbl zyECU)$CS*(>xdP=*5Mm6D9T8y2Fk3I+8pW$DSs{W$2^}{G91lE4i<{{;@lGm%gSizwjsU{m4@Mbhp*M7KOKSBSO{k3dWjC zs{I-dF+)=cMP|WO%APCA?R`^d?FjGcv7vFP@gxPfNRH;^!Dn^`(VBSV{r>EDfZMZX zF=YqKsbmu%D?8qdK+_Wv3F@kINL!#PhYa0snpdc1Zw@w7)OY&7m7zd2ihrvjL23_2Hj zjHSEZ5-GHfTYgZKJ$P2I+!LH+CwrsLH4Bj+=AACu+B-M)jj+}BBF>LQHlt_mq9Va0 z!tCy#3x6gAqs<+CJ5DUqS(LfdB_9%c6o*Vz+}}dMcV{y)jW!*8#Z_Qf2j7l;8=ok7 z(1M>G-=d}+`3Gx#zUO{lYY-q{bA#~GhJx`xipKGbxDCwn@t9_mn5ENbD`T{8}EWf;h_`bKd~EPQHY8s8j1pliQ5tYD^E6>d8Wr1u+spQOcklyXd; zZW}DW4^LD5cvF05Ajd}W-J39QifmD#B{p4|XRAD#jlE3Zs86c@6RIsZr@rgbm+?BI zlt{-68|@WrE|Z&R7J~V$Tns*$<1;)>pPrHN zqe|PVB|5wy=r8CkDrasBtjUy!I-O|iO$7UXeG?4W8DuZ=gEu1DD}}8~N7oADdosdz zFxN+AZ9J?SRoZjtH783)^$TNL>gCnZA>X*g1-V*LBta5gg7LSW=!|(tx?nQ5mL>eF z#o{@(m)nO1Xk~t|%IslW$A$ADx*o$%{%+8_`^stwhR6dw68)zp*EmpFLs#^}oL)Jr zlVp$;8V9+Wxht*7ZNWdHqQDc=!$kBj4fNfCgNf?*p#`YYoWc@OirEu6ep)GbvUt!K z+5OK{QyHuZX9;ktP-T?K3BSM!3}A9Sah=dmeqJ!JLL#2ckXan?w93lG$!e7(ugvQV zQiycAo@KOde!%6`Y@ilVbVPxoiMg{EkHN}|tzS)Mi-?N|M(4$j3{ZviE@U!(Cl-;A z{lhr^mXRGg-NBhOU1Lq`r3O>H&g@{}<@Zu62@xoS8n^e?`l16X^4;#ACmz?+Ul%%`?mSjN$wmNlcsfg$(7ZciY>FAPVdRIarq1#TQ!ts3>=Bl zUKKd#vXKLIleUDf>Y{u-nfmPme`ZFDt`8^hT{Gsckee9C;MKvs8CeV6%sq@>-4^Gx zVGY>1rUB44vC^8j3gHVzRgb=Yw%~&srd@^Y(68W5yW>&bz$WsvNv~@eLq>Mt+ze(z zexzH9lKz5N>^3kpH_g(NI2vbZdlW7-5iEX0%M*KM-iz2_!vthXv1lSOXhSpMK54L0 zof(x^iSCy|0 zzG^nrB{O`Xg@w(C=sW zf@faR#vp6BBRcQ+9Gz4{VZal?_V`u^62^R=T!&arKdyfY;9q(IzqI*`-R769Ll@v? zn}Az!WXPC{KB@ok&1(e6Nw%?&{nl_alwQx8Yns<5pnFr!F&v2z`2Wmr*5$gd<xgTBd%H8$;Rk$y?ZV9uS8rtr)5 z+i;o*dYKrI$0p!NdkyN43D*U(?B;fh=c@BGhSV_$dR>fJ%;lF;2e`)kEp zj3e}{VR4_UeMam;DDt}>lG=ZGmcI`TfHDBznwIMM&bZcK^;d81l^%ZpPkEEceLXdZ zf3zg}J|Rm$4^@d~3rdx%-4#6`RBNitBgYAYZy|4|tPE#%1=sNS8u)n{=I4;G;da(kZ((ueZLWdR5n`&C>DAh0 z!#s;H?b8h)N#!ZfA4&$?eg1yAo5q3GnDvgE0t zcfH^7moBMg6_&H7%pixrxp1*X<(q@}@yv3=toEo|^E)5Fa(I0>E9bl_s#*%@v^0kR zAyBpLko~dA(w{XSSxhK-J%=mC)Lpk`Xer>EO;pHiyO&@wlDozx4x?Z$T$Fx6DDUGb zlF7h`m%wqyI!*sl64ODs7DIiNvOI&w)P-3suWS^L=@1uiHWMa-?`5hXmX@QSu$=8J ztl1_YqEulW+Re{0Oa(2){>H|Ma$6xFptNr15Z@zCz{CsxT)E77_HE_V%8uNP0%d;T ze40;Nx8bj$ZXaXYGFrPb^hXa<|DCc8nB38Q4L8PYBkI>8jg4EmgTalS!%og!Pq&2>B2;7wr%%0 zZQHi{v~AnAZQHhO+qP}n?r;9&J~P1$Cak0?t6=ZU!dq#@J4hgb%PK}v2r|GzEO=p@>{>AzaLK_o%AP9CyyARO|G4- zzrZY&foH;~QXJWiw|M>B8ac8(PLAKKh4wMpwbN|(kWFm1<1nu&2iJ~N6lGaxkXMJR zjqj>zLB-029VfzCiv`J+)v^0(Dquyf+EXfYe=cJ^t?)gaZ-w;TrzuIMfF8m3ysW|L zk)Da$z!17Hy+C|9E&b6z7EzD;%oZCZd`4~nhs;GyBi2a<4zYC56E@C-;+1g$k&-j%eY(v%{U>*JBU@#MI$Y^@4t0bq$B_$OI_ zjp%S<@OCO}w5>7?(}##e`LB_L#OHbnk&h3f0QH!88i&L6(%%d1k~W{Vb;=9nQ( zMIXay==N8#udzYb};D9)0BC)+~9k zv_db8XpP*Zjj`oD?Q%*Jw0-jZykMpJ4GKS$lGuf7q0%JROtNe(o_y7&ijgKXMAqas zcA|^|vURVjeFXfHZI|@g@cc&GpITJ5MDTIoF_7Zgy3fx9x})XW>t^a*=Qy9~cFpLN z$3tU9s2&_wZWG98GPa0dUM~b998+c`*ITn^gdVHn3}?hdzyB(10=(x?I}famh;q9e zWp+w3@O323mG_bV=9-of%~?~fCc2(ha{Em6ZtnlRxyO4(g`!Fo%D>D=*GJ)@=@d^P zR8W~|R9Z`{nD3*5GcQy@SIZmt*z!ydcQ(a47-V@v%Ys*ae&(%7WL;;TZ5opPnUaE= zH5`nGKRsE%$RaCIZ`w-h4E-Jx<)W7+SJ`b6_ilZaL<_$qF(CEM7>k$t#4YfB68eeE zc$HYW`MVH{NyK;NDFvzuTaK=K2iCe83S*y_{>!I{M(FWD2l3Y zj45z7MRaLOL-qC{-1xC7Q%uNJPtFf$^b_ME^8k?>TON`&atVlfxO%#tPUx24%PEYo zl$$Xn{j>woO5iV11BvXyg-sUm%)t{geOz`S(cEx=Wp_Um$yh<>wn)(48rJA08&Z=F zY3BDU)I>VWSf@{&WLK}SA{TVBzJHe9jU>j?&FbpAVtCFt@!^WXz7VTS>?Q`wuwGU6 zSrAfj4Gwy23v;_cg^I@GVWnx*DKVm)k;pIRL2X=BL4vwh9Qm%lXH+qoB7U+d1Rb5vzHBLjF|U_M7d=s9n?6CI@Y1_Mo*u=YT>_P!b+7?pc6CcP#Y0s;>N9xE`I*Ff(pAow)CqwN$ zv)^KmmX9{{d0#7ea?^9c2_j1Oz1}e~(A%iHd|N}e`bx8(&w0^rl3*&%$wVgSf>du&;@H?tf<>5ELGG!}0`Z|l zOgvwb!R?RCPc)^)-#Lsr&%iq^@~|wPgO~V;?HCG!5ssmx#R6l*pTtktjLm=Vf~E7B z(Yl1zG@|xDqTcRmS0HN?g+vMlhh7bH3?2a%8q4UH_DS5VV3KeIddztegtFD`FK&`i z-qLQix}o$clQpS^rF&4gxkSSDBhWitcHeL`D-Nl9@7PRtwhSh&7H|AR${agT(YW(~ z`YS+7%@M``!K3;Sl(j#t&b_aSEm?yVaeBeP7XavY@aliTp|Jf|uV5gsGqfb&;rX8k z(SJ!J7ADsJIWZBiF){qFNh5Yf_W%E+kvpVv($*r|qDUo_I4eO9MEtJToer0TzkqoB ze>&5u=Up&CPvrRB6eVc>mqRMdlCT!eV1fObK_R(tUNF>8Epdb+6g>dt&E&<;Kqf-4K z49>ws07ndhYlYlaTO^=OprAkkdlIf;T!hee;Q19`2+K?$Ts5d~`ubBnAlv@DA>jL` zM*#Is-nm{x{{7xSD*@8r$O_smduzX z#%2L zPy#t1B>MROZUhP4t&QKC-7{r@^wU!drtZg+0X;-)3Crh)@=j>QLjszd!9BeD%8T`@ zg?j%0)~A31uMgr7H~<68##8q14eMK{$U)O8T+_YJr0W2|J-kp4WPUVnILv zQ(<_#@ywsLf`wYITi}9ntNd3~1A59+n+2!xZvJkO0D;{P%(D{8Z7=A2nEZ%|#CK(3 zds6sGf%fF|t@YUfK@G!#5T$1c`jh<2(G6?WTOD8Ue6)_k=oB~5=3fhkbu@4a_f z9-dOn@FubYt?lH`uI1K3<6}G$oAR*dyfk@WBR8j%VMPonSZ*Wp8&2YXzj>|!4F-F*Z(tl_Gm~P==zu}JK->0yDY@@N?f6i)M&Ada;3GGYE)p4;JaN4> zKgTii0O*Ai!1m&?J>nm<7{q!rz`8D*SRkiC@Rxz zr^?R$%#GtRy0u>fVihrr^+f$o*{yr7T|mPc5YahKn(YETC2D*zrYz{Eb?Be(6%^F^ zZyq<)Y93h5uSV#kgYx%2APM(Eyq_$@oR2&dy(G4oWDauDNe7!yJjxPb@ndNLf) zcIRwJo~BZG;vy`w%=E`7Mt2!upsL>Jo!;iKDd{7uda2}qFeG1JGWu!=V>`lD*0i2P zDag2m`nbzVeKTf`>UJ2usN;$!uhMJ9g_KzKnc%q&7>w>%!DzVU4 zYleHe_WmDA#*QaJ%%7?c$%8lg;=rsDMG?>dIrPyuTguCuk)+kyorSC4P@@$6GuL5q zf4h=|wU70MQsFEa+!qSq&Gsz&7E(JlOlK0NretzIqd)pGx}VELb9}F2+iNpTp+h`M z9i8K2_2tR66aK7MX?GXgcyD71Cf%5OR~PzHJI{(X@4m4B0M%}J_?e^SXW8(L|{~a!P##gPV2E7(s#XXWgM*4S=ST`9M23o0T z22>mNt_LTK0!Iq#iQJ)V#Il3IPWO8-;@n_EuNp96Jtc#8olehX7EN6CR<+~hyv@@l zwyiEcR3N_l)73`?{^!+kKZo)CoHnZ@{+`uBSWxl0cXnG^Jch0@tXGA#E#4?PNnE-& zZ3Jn0zjy;L?UWSDTm!LM1)+7T)SN`Btmp;%R@O~geuHpZ@7&y}_}N4fPCMI^X~v(w zGNUZX{&Q#6IxJ_9`=c+TG3C!I|0`jEoG%etaW@W#6y#jHZEv@n&Z7nqEw;CSrl8Y2 zHyuMPd8*G74YuEi+nHO~-0_n?^8-#Q0Ck`fVZv3`06$mrZJ=?3)+7G`qJ>_eSi{VY zHd5|Fee%3~iJSS-dzrAUR!|~C$t^v4DxT+ZrXR*oNbB8S$n5&B537^* zC_qG7rfT_~#NuWS(3B7<16LYp8(pTUg#PitLG%e(-XOZh;S~`Bu{@;Iu)5s_o;<)w zL^$h8Zg73Am*H%Y(xIMy?3AACpm{W`-^{O!W9B~p$1r>)1|syVKc71gpHQor(^EHU zz5$g;7JaWjT;0j*muEM3Wb>Ww;X4(l5o#)fmgBv#BfS!Tf83QQ)oJZ;Ngsv|!h=%Q z@s)9vffFOyY&?7EYNDE`!)f+UgeRO|QG)jTk@#m#Sv=7Mwk0XJIu=Z+2#)<1euVQ3#Z^kI7J|#fGc-b}24@ zwWBgNiw2S?$VzsWlTy~pX5=?^M2XtxA7IKe8{X-9-(}(IVl@dchi&~F-yX(l za_}^iAcK*L(X;#4S|1wPdm^Q-({ea&$g+J7-%QFiqFuq0j$Nl!0C<KbaQ3C)wlJ zHpmc86pzX^@h3HnNQ>g$pWYa&_CU>KbS<`pIYdS~IYI03Aod>Y{YzB#8FBJdro@4_ zXetn8uagdRBeru85`Fcuj8E<>71bgQ+z5xOk)SWd4*vv%L6fi699L?hQ`LfQ${@HTI~;L%_LGq!jzg5QORx3fmd{-teiErJvSsJhFkac29B~aAi{s@a;Bf>L}-%R^koPW8| zk#TEQOhhm=f^;3RQT=$LT_uZ+2!~s{xUOsDyQD(o+iVOnb|99cB&p%0OMz z#Htd-*KFy{#ceZvGX5UcZKc`T zl-;oT@WhlXc%e@St!~<|nhcVa%{xp(QvEilu~j^9J=6PGeVp3ur?c7WwDS*fxAB+n z>-#x9rJn|t5=rUy(sPcq8J^fQ*%279LvxfiA1DmAYqHMi>wtgkmi)=R?j#99Mb*1SSt7uOm4a zxwB8mZw@)(7(JTg4lK1-P{Qqz!SHbV@G29*AF=r7Hz4fMn~WnhAH z9eH$UOLuH+HLo=I2g)|hbq=z(C&_!0URl^~$B9$1eWs@`j0SO`tu@1 zbci?(tG5!zCY@RLN4zd-{}nuMYY+ zamU^f<|FBY4w1k8ML)#me#Pd+Fb+gmdu0a|XZ09YnL`tHBC59^a0ds3Nem&~9x_6Q z4d-NHx(+yg1=I}Fdt(%QkWW^}e>v2YyW?Cn;mRrc%R)eX$|qHH7wUN2QC9x+S!tOT zw#^)(a=GaJxJ*@B5XuO)5lGHpuWx-MqI+E$DCc=R4*mN?8VQrc4@}b5sY>Cbmh4-l zGjYf1ypRqMJ0QB}4lzzre>Eh`UTO9!J=Ei7FM-@_8s-#BWx2Rv6f>ms98OfXNy;W^ zKlh>B^ha*v96dWp#PPIb;cyF-X6GTUES;D-e^+-Mcczh&xax=$p=`bnV)g@wws_h?9yWs-4xok`!`z9^@=LGz%Az- z^i5w&_EYRTYFywq=L~!Ce(}0*OV~6VD}{0Ry~du%34PvyqkRI>Vb#7T`N63I1(iSv z2N7lLmqRAaC0%7Jo>xK)zrS;;L|0ORYmEtkR$TDxq^eoO=#g>GLl_*(vaB=Q89+~P z#Y|UA4ta?j?zxe%IuH@E@{h z{QJJemOj9N>j~vsw4h$@{e~tt!VYZPAj;G5NE;qo9`qKrrQfh(jtjWEPB{Z$x(J?j z6Z7b0&JMHZiLaz0`Ep6U>`~klro5Dmno<4IcSXxfv{DO^BaC~}!{LLC*TJjkSww5Y zr{c(xL24PnK z6(=ex3zL6FbJF6k7=Qe@D|q4vfkuzt$R^7rPmyWKoLhW4WuX(bNx07E_lira!L?QL=Kw}Fl!eh$?_wOAeCo67UP(~N z;>8<3gLC9ZfbwRlUJKXNp6FA3k6hW+^mjtf#OTdD_~9=U2E4I>XIpiH6C zYDf4XGPjC0Ej1({7`GYvPuD(rucX8uAram=o}klmHKqyo49aLVHe3sN&NIH*>Dk%o z)Hv5F%KA8g*O`yKDv7N>^)idba-nj5P<;GyZazRuRlW(;Z=}pHTec<1fpag#OWbj>Zx?_d1R}i0=Hb+AN3O8a^cdxxySBg0y8osJRWHu74O@5*Yc(X>7JjrFQp4Km(n%SdSr ztk;aj4?r7<(t0#!uh~zi+o{TSa&f6>@iU9aPH~-C&JAC5nf%OrXD}@5m!eq z3t&S|;00}>MQ6swx#Wa&-1dYejlHhaXG&~undx%RR7^fZ=N7F}`ml5^nOZEOL&Ka@ zn&mQG{t1tp`2W4GID408ptVUg?FkNI&RyT?x;C}sfo5dLQqw~uu`Z=#>l=?bs)}6e z^K39Im9!hn+pga%<=Wr6#$?L3Ghs^*k(rjc57g**7RszV+>T(3iN1o)eG~Sa;@u%d zGpT6ZzYXyHfZBfQc=G-mqoFg_S+@CdIkMy`moj)BZU&pj<2tPCEi*|yKk+h?-gmUhK}rwC(x4%DYj#eI$_?lXYaHb90sMLSy zZ7H%Ga9Nb%R5cUUz^eQDw@f!@w~?bOeFnRD32ty3eqv3=^siunIK$kIiZ=-h4&F?j z>@br!ONSGK&6OF%~Kp(FOey!9@!3F-V+u5Df%iYbXS=o zKGVXy((s=p`#DBOPc!~uh3jGyhH78tduXls zcUeUg)yY*;VaElx@W)EKCLZ?GwXAY^Vtk7U(87Z{@V7hvmg91x9O6^Y#1BKxhH$1h zy5VkmnuCg1+sh1h#V9kH5s7YRYSs_m-kyR4Ifwb{tV>Y2b9W=y?ihZpM(%!wO1mlP zmSQ9`Wcpbd7BRtJP`RNg+SAc}YUhy?5FFV)Znc%=R|7b$HD}NsKmB{tnZkk#wHC{d zU&L;}6=cBHEr34~)Z&ddUYsI`D6=IEv}g<>vxbedx0AagF+_EX+ND{Vy-8vx zW+SA}@rF5>(b}R`|h8PrgT2(4i8G~u#|I3rSne3#%J+%y`o@vHVOQK zF~rm<$fuRi)31C??WrMsC{vas$xh@LrE5oU+j6&O@v*0+~Y`P zn2m(qsnN5`LKX);9lhADeGD3Vp%poH$rg3Q60R2aP^;K`O!}UGtQj>wVgX1b5RD6gW_+AA=K0ae0MP6V}uu7u+;8|Y-@%Z3H z&w=}h`aU!&a$iza7iyGmoTbbj-dWCvT9(eHy|D3@X|8KY?mb(ZBYsE~Yhiw;ly?ld z?VG+f_B*LrGtUh;sWxuTx5NvISp}!OHU-bfXE*n<$yHhvO=t#5G_}_3!7nqg1Iuvg zbMk*C_YbA$VSVQL#?bPre)~@rx3e5ezd+z`!7wG`NeZNDcRR3*Cyr3ru)e)oXi4>$ z`Rq1DE_+Hjxhom{cV?U}xgkm9m)`e1T}>>_egn!Yt#&C~1U-aJS}4MeP&S ziJR3XY-|>JT(x@Ip^$DfKq)Hc)2RxrfCBFMCVX}^e7}HLuHJK`dT0ys$F|MMqh6N6 zPzFVH2%KeTsiNsLuEuM?J+|IRfp3lBbsr+DWwbcDfWcxWk&80>Zr1-vy4Pk6YCUD@ zBz0xv;(2)fkA_tf=eP?HZJ9b@gh_bhG_VjeE-!TAWR#nMWFhjJZq3OfF6pP zKR33gR`=+H1tZcotsHMZaudEC&#yfTpq~>pdcdi&J;s~zI=FpV3)EV<#Bp~VKv1sh zfa{VgoZQ1n);4SoLmcTGNPEzzG414UDQahp*B-;&*3$%SL_|NT5LP&pgifBU#Q2+F z*l|bX{Oq(c2R?P~RK;=id;~IhuF4((f=NyZ&Agc)STDyoP7FooN9Si6yJ8LGl!8o$=Fe3#2u30+|- z1V4G-D^~y%?}oO6pSbL5kP$y)X+8w@7-+O)ri@ibBbUhy4C;{I`$pf$fKp)%5P3$% z_$(xlwr;ZY*IW|kt-LWi9a#0M=Ah=!@J&>e5)#G?K?xTFu?4IK=7^5Ty>S-|%xaP& z?Olh8aPi%xHZtJgnc>bWCn(O8KY-V{rocW^E*l zPlDwJf)_+{Z6yjNAYd23H3vZg#sW>x0G8I))`mI;GT`=NhlFKzLh_eXk;utRO}*u( z1q1^{Z~qQGxs?@#WYGE_{x{d1-<;irFo*qweemm1z=Q(xpAG<0g0&(LP}dbyQk2CJ zAf+pVL4w=_!G)^aegf+^qA&$q=w>$%?|9u0|w>Gmfe2}wKCP&3N^;iu#B=baxI9b9<0g~fLRC< z)hfT}NH4u_9pHS%e+Bk!w}QR7rPcLg)wa`D_=^q+8&5pHnT!_@@nI)xG{3iPiq;AR z2Y`z#uBpKFk9gQ~MJ4|N+;f8B{;m*I`k97)(nAZOa%)+!`$NzF2@sq`cxET{zXZsd zd;<6q0N5nIcF6C2BD(-~2SAl5V2kkAk9Q96S95w|Q*(Cy^bY9zD-ig*$KV=>$=~l5 z!%8R&AlF_H6VkE;Fc|WKSBCt}ItC!dl8oQmF@xF6{K5>1&%N6fg%qWSP|phwfEZgN zFt9fNZdLegsMyH(Bdnse_V-2pR%Q6#Nk>NmM#>Cr4XjPRQ)RG5vuLOVDzxsxM%_tjP$pBUlh@tWEIn@0}Uwf$UIT<0K{lDyl z_KJgqUKZ8Wx^&)p{ z@)c2|mZFs)1Ld=vY{g+*UOxF(045gBd1vVD266sObSU{550F`MRLVwp7cr}1l$WO7q|2H?-} zH<1RCRetVyjafGy~GcOQs|M94w>;cUmY2KxG{ht8JUfo5GB;q2QzU;0!=k0I#_78^7A78_+$PB&J zeS1d~Bia2N6A4hrQuD#c?WF0uWo_5;JsHa1QUBtZ<`?a3s1P=O(^H+}5OD#M*gboB zwb)raS(=GD$~52$;=H}P9+PSgs#w3ZBy)`iAqDw0-@PtR3A7rXi_ z=AcsBZ9E*F8e6vGED7zuw^?sxK4B{hkhnyBhi07y>Y1$;3kEB@M_N!S%rd|=tUQg; zgzMOXI+q6*iLcVGX*YOxg7FHao&+~Ly3N*7E5kxUty8bmB!e?pQ2hk z)HY%kp}~u%?IH$U%|WxV9#wE%Sa6_Zr=4?lmE(D|x0A-oPBcRsIj#|T%^rqsIV!JI zt_}Pj>~O|PpxupHs*tr0L4v_&Q1UToM(1x#!gxe5G=3C+VJ#{DfgN`u4by^S}P{D+*kyRYn1qlTe-C*~jdf|+L zN8z{Zw8p24Ad5WOVCBBep7#F*qi~Bl>Hbf2GRFb?w64JhJEJo66Aw#=AHERv+7Z(L zsi&Yk%#AY;u+seXwW?89cMyzYU8ftFTdjy6v=F_{yI2_*NtM0T#&)CE>Y(D-k>|4e z_yat?hftis@k4=CS+Ofyq6y*$J%9<|xm1g2FRK^PeTkCMuIkkr2CWN>UuqUbF*=~- zLWh<7CfeiwCX9Wzami9juo~M8^8SZ`@>|OUmZJyXsBBSs9W~DSYNa~{bIZGLKxx{S zxq&5Odw1%*fZt^cds4=xD1{+Dqf}$Y!q~A~ijQU$7o13YV#}&8uELwtl;XU96%|O@ zx?@hqf^Rxk*3iR}rl)M$o4U*C1nF3qAuoQw)p<4_GTqpgn2JZ!?^+32@hIfvMS@iL zjmNjD!o7IH*rz^Y&uy)=v-6{>#t>KHz%N39X5e$kdvC+kjJw)$DqCD_+CpbEU5HPh z^iOfDQMG?BzV1gjzcdUCv1>~_p0OyIl12?D*!cMDv^is7J1}|K?l8Uj>7quv(c$7xwLisS%!B+l`qAn8q^sE;0YYLhUsaZjSDr2cNvk}y^Jd|E5Pf5r ze5Bjx1fG;*xO2aC^P6t*m$l<=doM)tVwGP8Aw>MF$jp7vwf?4sG{vO1ghdFB@9vvw zL3C0~uwul(H=+mRkUF(W1CK{&GmFJ>Be{p%A+e09**4z_>*P|%dtQ)q+=oj$DDMRQ zxr1lS=|nlV)sC02b$IlU@ClxOgmtoU&|pe%(#QzLET&&)UOT|v=*do=r);g%4g)p~ zhgaR2un%86dv1YtT_C-E`Qi8Xvysb6R1~Z7=WG=BcKMwBHUr}D4u2QgbFLMdBB&@hkKp{~Sj?;UZ`TL*mAx zYxl_QmX{XerTj=g9-q999x&9zF<7F8lx zq$DCyEe<|RMLRJ{B2sWrLDWg*=D{MaSY&mMj;GGF@w8<3p}2ZhKt{j22otu0Qg^E5 zqZ4pQ0-5GJ@qVxb>{hgw=}Gp2qJbL<*v z?=RkAp8c+XsqMe~p~%eF0d4uO>r7z68ld2Ccun`MN+d)p`8M`9as_j5*NBt0{6mB| zfL7JJ_3pBe?uLw&EIRuc`{imy+P1iatY1)2>mPR$H-}7!$WZ@L(bu<Xu@M@i|$d0T+xI3gMod5N(yja}Q$S&-B_D#QM?>;*C8VC~=aN%A-D!K={ zdYH;F)0^waxvI%lj6D&U?V3X7AI*dYwpKRUo&K2~k9yVb|9v0tRT4q01nHBRHDnAU zRYs7i2Efs~jyBap1ia&^k57dbC^wzCV>*9=7wx|4j6RH+`ANXYwBH|Q=12LJWWb|m z6^0-Q8cBtBCoMD?3R3xxyb1(;aTejU(rNlA9KQ@%>jC+A+*m*js9qMV7P?qDKdEWS z4ne83nhAf`j&=nvIfmMxT6q^}J_g#?puP&;dzdDfs09f+Xz$1I5T)6U_4D`G=1%)| z}y)*vet!&KAl>PcnGfG0@(Vay7Nug1Kks``&fKw9@ zD8+cOuEuBL!g*S+2jKpLdXt^1{ytWE3?37n3p#rlcVYk=@C>=Qru#YvPF4k9@a~6C zZE8G!D~T?B`LcvV{vh5{4{S^x$LHRuiMmKKmpx)RozZ9XaPuaL6HQDgJ9L?{XV9MT z%SMbaWaK``$JZGMR*LdJM2?ix3{koYOq-?4#Mz86>8lzQhVjf^yQ9a|KmJD^%QF;8 zbPVatEG-0qL7hJc$KeS7I6QMfcu6e_$_|p&*wY||bKJRkL9-1B zud%(6Pp{8%&j}p}e|Y--6Ojh)yUh6L;s5X5_oYmj0#nc`Y&f!&^d3rWzwQQ@14ktJ zhvhUGA%nvh^x+_^3%#xfWx`kOqZf>kIYUeX#YP^WDpD{rC9c#`3wchs%2`{LGGsw_ z$ahDU?a5IXd#B3K8ICJMC)0;lum3LC5;CZOr7G3jv4s+12%*C-Rqt3c==7>me7Jp* zxpulTsMfz`!QfZi6zx5j%OVq9mO>7rk!lpJ(1oRwgkCVL9uRcKL#;uHCpBpXNr&T< zZqNfv(pyMF!9PjAHJ=XEVAY42I$Cr{c090IC2*EW9jZ8z10z~ew;-8@qSuODz;c=NxD$t&4+9U4j|prRftLr z)3v-c(DO<3wR7mVH#i*YAIR_+Eg@T#d_wcgf!YWRj(h${55eLAr|YBK55BQ_6n-OK z>SS4id_=?n^Vn1Gw?5A`5r>adohvugcZtR|PK}^5^htB>92kV_oC_LztRFo8Ymx*i(ir?)HT z5AhhrzMa6nNz2JE)aY#?^j9N^b`#!pfqp?kOeNjbbjeV~$GrD^C_~f~)TT>{_FEH@ zcrZPFRc&eCu#Z78mNRNhcYEmjb5!XO8ewB-m03E!!?R5DkXu`4+Npe&%E4u`&IF#C zI2y)6!7f+EOX4QPx<`F)`~KU0RJBii`7)Gzl1<)eenp)Pb82G^AflKZu13LySgPk3 z?hg%xWoENu<4H)7kDF2Q`UIm}T+ljK#54;QU8UL5-s{0~Es6X_^q zxaw+7L)`E@8aSJ*2N>6623oNU^=9V6*uWsD(N%@Txuo72`Q>@4ea`%q@ywvpeGy(U z=KKB>9UNH)bMqcg%P@I(Rq{T77VVrDpw0W#%?!dS9EFt-K-!D|$haOxKM}sPUB8EH zMqEK=Yb+Ld*8{82VeLW;_UJ2`qQ-#~l%zb&O~^c&d*5KI=7K#ifMbKZN>V5&84A~2 zJ0>WpmD5e_s9(1iVs%pXL00VgH!Ct}x?>K+he`S*~3Vp>BnoGC% zFu^MS6c=>l%*oain@c=|dP}9!{7@s~inwtKPSJYICu+frr|gLs`8i-<|A8IaGfnZq zg<#-sZpDO3$JJ0EO6`YL5b0*ix{9cD&Rv(2F8F+Z$S@z@_w*k8nQgyrq^S!~uS=Mx zr0j+DqJGo9Uzj3nt#|s?>HS_Q6^%WHBu=-uaWnSVic+cl#bUu0IY?JB+y-(!c^>aD+9WnME2k9eBAi0uK@o!j_rk!S~7e7 zqDyp!Yu~UEyz!~@GjuD7WD}BLig)%OADz%(*7Yb)k3VHU6>+-Y%R6{$JSv6S9qm)G z5{IZP#N?EwC?g``YAh8;ytfn-(VElceWHpc4qr!VCK6>`ss^q=^sEBOgK$(_RyIZ0(7}Ha8U;?kPrN9qsPU^ zXenjWQuv=@v11BpqUe8=2G8kAO;QUl3p!d(j1PGxLk#ZD_8M7lVC6M~---KUzCXew z)IE^7`f_W2Qy;1GiKr#kWjM!fmbl&jl}PGu+*0K{#4+XQHs%?-L7{O55NH*eH~AZ~ ziL-8nc(`BVre(|#&OkS4X*7iBHS|YH7d+kyo0{ugw0mC@p{=V-ehsIU%rMv9%>Jlc^!@&pPq}#F z$@yzV!KxZFRHkhaGhto5+i;z?mX&GInYNWv84+fL|sO?Q(}`@!x>Io^B7U2BQZi+%YJT zL0hmQChFfAn5y?R)>RbPN2YeNhDiAIP)VfM^nJAzOXT6Uy1(#1#a~JM_u%s0m%Fd=Ob&X%6$u7uAWq_Tb# zd}aCU)zQ@*HEue?&y^xlGyJTj3hUZtgJ2l9Pfc*bnhqR_PB2V{=XG~smJSBo6d%R= z^;QUheBa8=9SXqD^bsFCh%tG39 zIxqQk23;zsZ@1nv4TJMM%oSlkTd0F_y1RzU3nLxYEf&2V2UA7d3-EJ}T^`LS>=hFPUuol1;6)l0@V-&oQ!Uk1 zgWg3p$&WtzYd`bPs(k_M>72Fpqqlbd1k*zIw;76X&SP(>OTipdut`eF zIKb1Yv6#3J>z-^)q_4T307sOR?0x~n0v~Cre&@1OB=H{6TZ95zCFer%dghn-w&oDR z^pB(%r#BSUoskfz7y1xaEz)OxxAKXaTzXBJfhEf5)qHr;A8fO{oo0Jw0lquN*;W5L z>cz9n@Xw2DVR}3Cw?zpYk{zTp@^eoFP0X1vivFN`$XA|>@oD3(a;qy3y7rp6)Di6RwytPDRgTRy%3tpp{Z>R%HY8n`CSDHgz`mC~yhpzBbdnwZWo^9|TrHkNF8#rY73 zSA^28Ad36maCuM=E?WwMcjnCS>TW&?7qir5kPSQ$!K0tV@3!p}Ze*#^!WQd3(E6@K z6iS6hu!=yg1HlP_PxPslq(O1*O+D}Io&noi0kL?b2?@@w&Zf6T2DpcFd+@plt)lF2 zuRXgEr(w7=NDq@+eDH(UHWbxC^ox%+auY3>&BXi6(}EHsWMTEfU>B_=iZb38@5iy) z5mKBi6OY}q1sTW!{0(R{fimL#>UO|xL3BS70yx|7>isoksDy~S>X9|J5t}IDg1{1~ zRrB1(fROBr@5vpA^YCyVOp`R~;JAzQI|Hj! zPjuV@bE0Mqx~j))yO|TRW0vz3JCu}u@C2ZGR7dz0 zkmN~=A6-(ILpf301TirzAx?|8;4}qN{zct)v}jmmfqzb5?(Mcibrk2r9^}+95ZUGO z%*h%Me@Gib7b;x;7rq%<4E+@Pm&PznfbAE#>}~NJ8VwfM>PMYWTV~8f{j}{0K*$ZUA!`L>g<_?*ZQ=Yh}; z?Wxb_>u)Vm6ye=IO^?fz@6%vko*4}CCQL<&5@%iOAk0I!EszY!j<<3Q-JBM?6%EcN zZ-gN`N`+6{dD1z^;;LIh%KT>(rHS}oOlKp)|3lb2#%RJs?Ycc}d)l^bw6O2juCkM2}$MaSX3d&k!{!`Cc_8!Hi-Qm`&pG zjAad;f9w&nk#}Z(5(MWji;=DOVH00An`Cph9qX@Si&k%meI=0TgYr|9Nd~wCiKEaZ z*4`cwt6{oL?NP&6Fh^T_obu|X4BQPBL`|35Keg*@B7TJvcvpF9>DeB}m>kMEt^~I| zF>#d_<}%Z5Dj+k>l3JLW@jpV@ zV4N3bS@NXh0v^?^h+Aue!zo}fzBG4m{2XFV7P!W@&!%)VDt>+)NE;u)mML9(=X2|* zO|x*XF-F~|?A>Y~aDN=(cDdP5;sy1$6)7eZ)~601+_KV~!Gw^Jlg448Iw?+wQwY3_uO>`Vk%;q(j1Yq*L1%GzLZ|O)(7YAymw8iR6TXz0y&Lj$%?a- zwBH^_qwm&_#xh1fCW7RiAzoATWPglso%%I{=KpukRu}u1=ZmE3x0G4K4ih}nSlKtaE(}Uwb5b4TbJs) zs}eYGg}Lhe9{*@%3rTPY`a-xnz}^LGF)_O1>#+BXqbLS=JB}0b8W#LjOAhysjfsM& zJ`KVUv?xS|C>(fIp6L4hx~3Ye-6$fDB8{s?TbkFcFH5F!!qmG+IXu)H)Ivs0$UOxu z&n#UZCU-)Fn})u5Ax`cB{r-@+@+DEl;ih(V6GFy{<91-%!ipG>@R+V2UV1tBTgQ&o zy_751nIQbJn1eVy=Vf5G28*LNNr||I8OPKnnItQ|D1zfSh4!>ckep85G)shf69v^4s(84Qpd4x5p-PJ(T$T}30L_E3B)wUW&MAAYx`*LFl~=hWaUKOaa21FP%3_S*)rm_8Vk zI$_d$b{vmczK>t;a!bju4S>iMO>+2-!0|z7)_KZG{I9%`ynPF`yy{2>*1KxUw_dNG zK!faI^qkzTYhP=)CAi@5v&m1hYzA!5*Hh9AEcj|^V;^vr`KcMA#bPJ-v3GIENXU15 z((i`jO4*axyhY`-NTwpEycR5VFD}HSC+w2Z9d|uGPVj?;;en<$p69PqI5PI3ILE&( z*X(vfh-|xJ)it1Wb^2eOWfunl=QCFN_v+~_E$+oL)!nd+w2JC)aD!6J2-5#H8Tu*BI#=nGQ)Y@;M$>o|9a@Y7WBOlDf z@Hz3J(JbgQL;Ni+*P#Y0Mis?#Y$@qROW?nhV&M-_#?+E5)@Q@vugDVTHu+QCSlBx4mfLaxGk$94(B~W&K`n^J^AXQfdWF{i zeQ$NJfo%7Wsuuj6U^$=sy5t%M7cSw`%NdGQdtlS-lF>gskchfc@c5qpy{UISQC}pRRe?p~wqo0(Iaf2k?4V^c}a-5G5_pE35qqIqL zduBLXoeYJ2v*yJh5bI*R{bM^89+LLJ zH$ttB)Wt3!T}muRqbBSqReH2j%P_{^ddJ5*Lh#`UasnYkv}35FNdb$iO*LMSugd_ZQfhbEmhd;I1L z{DDctfTqym(l=crkPI10Az0$Y<2&PN#$P+Y{0P?A=7h#e{k-5I4|g>Wz(gXY zjUoraIQD^2ZBb9O7h?--6!kUXkkMSY1}tGoak#=P&hFx^2^=$|j$xr^b)|a= zYX3G#3evx6?>CS*>Egpj@?nyI!u!V!89n8yQJ@e|_5>ug{I9iyH1FSri-+!+86Z7^m8& zd-b~sKF+-&&20~aG%?fEK_Z7cEeoNHaa0ctM4ck;ngR!(b@p~whu(M!C^lr}Oyr@M z>as0;tMzY5skXhhwWvHg(hd`3N8mSB6)leMFfC7 zU`cO`0F$XyY6=m0yEFzFG|*a);8j+PFKiZ3NoP@;b{+V=jQ$*e#y(8QeDU{y_M`#7 zJefZa%*t8qFrBmS9D`UOawU=UZ5t)GTDCMStTpA%M)cR6or>;D;K9P>3_()<#v4#; zW_b;BDV1%ngug0KJn7oVZ{z!q@q#98HC=)W8I-TPu!UdY*eU{V=7)ARHQ#aGCT$O_ zE2!`yo4Dk2mZnBm7;lZ>gZ#y5Z_Ynswo(Cq8cg=-$dI}O2XeKSp(PX_QPo8FKjoKu z=V(kVQ+_YvtgG=o4(_WE!=TC6M$+{Qq3T#U@IBOI(8NxlF+=(1T7PInC|~`dbU8xf zvXT%Jp#4fNHt()F$ZpW^hA$6jQ(7}P-ZDDJ>SCGCjxbOm7h5`LmS87L8jVp#e}pU# z5Ju5rB6zL9Vw+Rb?KWIw-VP z6iceZ#u#hiU0`-QbW&1yUri#-RxU5;K{9FHV_^BcT7{~4 zU}hg#Y|!5on)|%F_rKfv{9MkO8ioaD1LfpA8T5QbK8Z(OX?A_6scy_o@dsyfe&=Qw zFrNLb@T9tpfjba;vp9$_LdYeGpZ9nmbp9>Ii)WvrTlbRu9m3|=;41#$vR5z8wg|B= z=5U#g*I0jk*By_|B2M+MDy~j6L}w>Nsu9Ipx8jEy zTyk*3alrK;Hu+NkYMZjdiIKpVpi`+j#Y!-y;st`wX9%NL76W1t|0^<1Mu+aZ6Cbl@ zwaAzm`q^hCm}jVAu1v3v69akpN%VWBiiR0)H24X*?inReMUo-|qA<*7Gk_7Wel;NU z64fSpcqm#M^C&E>*|}fN?rqpxyB5wGs--B}`}1F!PE_;cIWUcu)E~v(kqpz$EJCs6 z>yM&{2GMN*%TZUJ%IFfbH$EkF3LU8~PkQbGCNF1O0|M5~r}4yCq^hI4Cs^t> zq-&D(kciyOSN0}p{5BF4KXvOL!`83ZzRmnTh`#0o@Vq`o!9**9$A$t5tnpnnP%7%7a%NRuR+bX%^K zVfepp^geSOpqH)nS8333M9JJ`siG2g*G@VcG_*qb*qA;YOC`d75x>E$V|08C5z>O7g_jMw;A6net!%w(>b- z!bEMV^i&y^(Vo0@Dq!GJ`%9GLuUfpQ z(S6{LO}Ez?RK0l+{UV3(C9yX&XP)Vh#>Q@>c>JE0feIq(!gL+=2ghXi5P01O($^-X zDobd!TsTlpvPgTNCykrR311X4Ro#!FxqpITn@doMRTbCx1V$WZ9C5H^v6OI~&)H)% z4+|$eP8i&W%tYioz!JE%{6*yP$y0tbRs}qcWGmK0F(3DaP>;G-cA#F)NPa*KAu0la z)kLL7O9kmSnB6uuzq0lT&0TR=3v`BQDtjJHZwSkRQQW0nWp%r}dhUChXSKNSr+qzr zv`>v8{_8Q%;+3oo9Fke}4L8t^N0nspn@z!XJ;s3ky)(}3omd5xgp|3G@d`E6d zYMo{*iR`k2mKlx-#qDOFK04!-JZv0GC?x>6wwRJ34w3qOTFi&D53I3Qe<5*qhMN&! zEXBX5^D9$`hYXW922xE=ugi;GmZV_Qm41&8icvC*UCBA*E-m6%#Ur4}Xu zKM`Q?O;)sjbq`O!^?Sct{HN=0OVvU%Jo&)7GW%sb~U6g}> z#4X?u_8MyBedGYokV01Bgw+Kq8~otJ$3B^4If-`cdd_!*ug3H<2hO89GsFK8&etJ} z%oY3((4VQwHy^R04Di=G2eUP|xq7Eb8f70PWYInTS59u%M*CI z9o1Mf25NT4R^{H4m(Uo-kkE3!@c=y381=(dfu5u4 z!n>%sypz=5#d`(?XWJIkUVrIA5A#7XEiGuj=L;InUX&M?dMBJR#U3jt{zZePCL66j zG?^-xUxb^AvAjEgh?HQk{y?+|Cp5t#;Swdzsz8zVQ2A)metxr{wQi9QQD9$K8)tUg zW1y)HBlN&-#LK+sQ&#pkE%SNhRoY}^p4kwfmCMoLmA@)8BfH~C_^g=;9|@TDCeJp1 z1kE%ao0$#qyT~qgbD4!kF!OVy`pDWT)P`D(+4^bP&ffIV5 zB-}ve#!yc9iU88_J3KXPhMzx5u5HAvFtcd+>m)QN&uIo4TPC-1ribpv6sje;RWg&( z&~V5s6sqrO4F`LUpHG9Fz&e;`mR6dfL7`M07TvXrmU_1C?#k~7Z= zWI;9{mZ!Wx|C<}dWUnPuOf-H9&5*73<9dm|k$ic9B0-_ICcizeAzb_4ull~pkeJkf z<>xW=7y#y>oe4CeyR6*6u`u*-TAu6)Lfu^3wi1zVXEt4|(I~XXxi4pWL%vng-9L?t z!YKs;H>-GDA7NaJQsYD6*zj(NRCugetQ;;)gf6>zmKSedY&lRD5@EJP=CVw$#i29j zq@whCn%CiAVDjV@=X8UT9`yjd0L0V7%+>tmX?%#NBj zeLA2~*6_;{)i%qomynhAGG%U0q+G6+c=cev2Y}8PRS{a*Ep5XC6f)$uwQ-l~rg=!-VqbPq zV>ZpR6BHZT7Q)ANJY-eUn1Im|51K>g5-KFHiNQXXu)cHB;7rh7gsI@&5@hw+G0%#O zZr10S0I2Uc#;irnV5Y&ND6+ok?Alug@(iv_ERVE@@CjJ3#l}>1zuPK-de8hYc%t2H z_(zvs6&x@QLe1LF*&W*|!PvvRuU$5-7E^I0UCXCSWC0ev&huqqh*kG0a~|6^0t1Ej z#l;87Pm+sXonH*oEA3l%a#PK?mLCo2gN!Pp=MwH=@|~TV1}xG=(7b^M&>|#3+E`9j zj*IWE`lPIRkgusYqt%<^7Q&9STT+_pcMje8gB6DT_0gQj%%9d$t zca-?r)#wd!UTCi(5NR51eoc2}2G&~eu5(;jOc4d0or}tKa$dUmyAQ3mQA!MUl% zk}wCj-Tib)SPw!TUz&aH%!(EBzt32Dk);YxaS>}+i+>BzpQqRJV;;lm?bErIJNkPy zhX)XGC0Ls{Ngr_N(%X8)x>!``nr2xUrzcQ~ll=~zkv~XT2}L;`xh6=`JL;vhQFy>C zG=$cGfR)lE8~pSUaG8GlI+UwAniLWLqYNB+MgmBO_7^{0y`NcJE-r4u+J6lfLaP@o zp0oeKkif&<&LGSJ3haW>ZktNFK@2rLAM5|SWJL#Z4C`CST7mUnOSx?uURJ7pL52Hb zYA{iJ9XGc+b(}o5Uo&-^A^EMmN0bL^Hbz0t)yy|I7lNla@miBWVv{0UyV#Y6lzB*! zq@bg?FJCoXxd7u!w3X-lG;N&U8tJ9Jw+pB$-6Q%v6T8EBIi!sRZ+h8VM8C~hPTOdF zb;Rg})6&Gu!P|lpn^DGG91`DhFGCll8OKBk-X4_@JEFPZ1*nur8h&s6mR5(h@)AG} z3#g(s60h(Fn@^xG>%U%SqC zErdzq(RlE_TEmK{0jt)Jnz<_+|M*sM_m`u8V2~&fyqRDBw4%3-@Mq)Vo0b#&d3*Sz zoOe=ugjkVa8tyX>6soP%ENZa5NsmtUX$#6@PT|QlaX-#|FY*-v2}uCpB9l zn26bJBX?p(mVt(6#~84azm~&}W)KfBHg}CepLmFMe&c!GwF;Ivlc3_l#RrVqR>qiL z2m7sRpG?Jd7GG~sEcZ<$OM=gQc6~0V!6&wxv-;#T-(@i!onlPWa;}X~`d;FkL&DMw zdt#vPZF%?yL{fI^Ba@;S)%Qiq^fDoktf+rhSc0LTooJS&Vc8eao!mjgW{EL6{H?Qo z3`MTxuZshmH}ooEQmn$b8G6KVfs!3tWa-?@aG}y0n=C&!ucZjI?XW77z|yl0^ZHiI zFRAT6tbm;6aN|THV|kk7dqBDT85c;}Z{U z(gbK6qOk(+yeFO#i;$b8dT1mOri}NO@FO*$re8m5bs%0D{0>S8_aFF;#x>0a5ySV{ zxaazkldk?b(&>B^L>28^1qIxjkISDu#b3<_-PHTaxM*qVBCX0Erg{3W`+A}YH-`-z zhSilwXvh&zS?N9)b2Z0HIC>x6n5UoBB8^OK8yqg~rqt9rUmeUGC}#>!sk9tJH=)+M z3xmVJkocRJ4W5w*q@JEbcOUUissR150wigHKM8uxB1A>;=Qu?*N2GLt+gpb>Ra!(g z=$q=)_WXLb?*1Lo+bFC%7j&v2krPbaZ(7akI|1fAaGt9mIzdV(-aO1zD7gKRQuyBis^JHOplafg@PA$D=N2mYb zW^Yv5qnfAdM@yFnx)+osHLBu-^!WyBLgB2^O-#cYkonF5uhReF>tjR2jG{}{)8EOw z^937zwM2jkBB$8z0nmtH&1nqNI&r&E+pYf$zkF+Cs~=|aSrkw>e?kp(4fO5Kh$%qb z(3ec!?&m~3AbESkZao3ZGKG+3RcCa!kxA>g^OsawcnRg}|7@mBZCF04&T+h~-v+1( zQ0s~!=70+j|(qh+Hho{c^uq>&1>IC@jh$VOz7@ma-Zw$RZ*hVG{#43eAaRJrm84ps0eV!#_RG*=c_;Vyy&8k z_}S(CN!sLcuR+|_WUs(+#0sKJPx5NaO#Uc>`r9Jij3HpCJB|H0)vyAt%hsOP@;ru! zK~#kHz>j4WPc=Ql$Wss<{%-`cIG{5w%EIVg-ReX)>Q%=q_&nHSBE2EBd1s!WjgjTi zPTes4#9zi}{lKKNy)H@@LU9D}gC(?hnEkuf$%64sddy=d^;7IYTJcU=;ZBKWx2QG) zA>6V8pGZ^3sMw+$sNlZG1KlA!D{`_S#wLV9qZmu~Y>*nxS(I%GO zC}LObB|OtLn-gnd2S94@#gMOD&eR)sz~{O)KM70R-t1EY2AEGjZDiQ+8+AG?2gylkTD3HKNVxeO-e6mYr6AsXbqAoT zo#|q{VjXmIui8coXUz3sWEbqaNzk+P#H(UYCqm0<(nU*bk+62G7^)aO6p}Uy4>$`l zta=JDYpJr4$q!;X^jiYSyFzv_7o%f<>gSpVDg9k}!Q_EAj9VFeY2!%@grj4Ja;+tW z+U6Vabkk&~eWpZ`qDh~RpVrDyysR15A_R-wXv1pbo!rSOv&CpJ+wOyadw5k-s|2o|EItR8{#M`vj>bl@ zE_!C5dDaZVVV8Z{IO8W@`0W}@cGWB_8~(O)tdbe^5Q*5MNs1!cina`zI>yrIn)}^~ z2zWa!lZD-Zr-fJK2w2buIl4%ozgy7$enW?Ox4Hd>0XnkOh;_3aef$o<1J`O(%0KPp z5-RMb`??N&J5fE&-(BA%Ph5#)gnOM3+2!TM-Fu-8urH_AvpY9P;`;q@ z9&;;B&>bh6mN7k>_0AOeeBrU4b&IfmvQubg?3gEb1$g%jNf(fu9P_J2!f9q~8uuvY(6rh>9n+?arqb(c0_ES-dh9;~|*q~U^) zir(&X#XDmR!KO%Svwpc+Z&DfdvrREn$18Yj6Q~`j%_KBu#5m1{d*+8bzZVHKi`jd2 z{}_6q+$%BROGmYodzrDOg&5R(y=MH0nQ491u1b1M0QIwsfPK zLmS;|NQnPPnKS3OfKEl`!qn9k3G-+?wdr<_jL=;0XhzsId(zf-%kmcD&O$|VaiH8( z^iX83R*M=;R+;%s6TL18$CZQv}cpPY-x`G zQ``vJjn&4QDN8<4epj0hGdPsM{HRxGuJ7SR*exn1>X}rhA6J{U_fEWm@9XkRf&Wsq zlgjSs#QT=aVn2y9t|p}SuL%MTE>NwHnfJT&=c*YkZVYj;2)(**eevf1#Yp;?MV%bi z`uJ8aI;7WQ?^n9}Pd#P%$!JiM{z;;jJ}jXv1kvoA-P4G5d@Mpx7?u*By#}B`+s~s@ zmdEHFsnLtv+P7I5O_4ZXpJnG(u#erGI_y@LPy*Nd!%lUbkq)93w_TC5W(?(hYqc@> zF$%@2*b$;23^z%FB$nvNJ&-10u6c70cA|jTBc#c8^ni>R5>|L;JeUaTS*R6vOaR{u zHim%QvUSXeQ$G_4r4_--v*%Ax!4BlLf8UKqd5yUfE zzzRfnl2@8oJ}O_$2f6e9Fi(o~Le_@4aERfteu8lSw8sMmacm^tc4AJYF*U7mv`Zkf zg^eK9tHSs+&_!V!hPKyK_Zc#f(t(raqF$CIwhe{3I{;_zH3Dh2AQt8^tEau|#RfMR zbNE=1iCZ#4L6Eu<sUQKN?L$t@}c z&ymE6PrtMZm9wcqI~mXRinO=K7pJEHRgQN2OS^p|XbdV`7@kd_?mvbXG4n~e8Yo|h z1M(SYYCN2F*4vSB5Z^4EgfyqbwWrNCqKQzMN^sWC>j?3WT}*Js-+^u%NL>Y;eDI0% z6snv1{z+m2(P&m%S+vJYM=0{X`pK`%#Hi1o9h$XQS92o&I|YTE`~T~}pyKIZO2jB{ zWTot43(F`+#LUD5%P3~)co(x2+tSp@WFZ_h)f9=}1m^u+LirE;tm;y|V z?M+N!1q5K7U7Sn}ZDBn&uC=wDH%GC3SL@ftOjve4T}P9#^)H5%d1dKVTQ4WT$cK`w zq*Nqm96v6-XHh{a**8K)F7F%T6% zSZ31FD5ep7IiO`|%f#g{*cIbggUN*w7lhD%vQ7b;&9Vt%JCGX;p>rKLhOsZR5#WYs z5zIR18P72bi-~#z!L1uqFyOi01Z9RvWINcagT5n#IY7Q&d&s5f(K0HGB4A zPEi+<5eYiI5|v5Ch(L}obRv;)1zco1rF$EaA_j?)&{H4UItuid?F)UlP#oo>oIap>A??d6@7tgn=xeD=hbr_eVu0GC9b$$9eI=(zg@t9Lc+Yh~?Ez5${ zx697YN4=GTalq;u7y6y-gA$6R*ffLK1|A97=@p4H%xi+kaHLQkjEnA(%TNXR5%tyP zW;vYK*0+~U(yyQ0;07LP*$YG>nMCqXexYGEqCNML5#R&)l*DauDKUgg;=+eF(^?po zQCj3TnRw>jkPIx#z{X#)$Vhk22q3a3Xc&DE9+}Q4ThJD=a2Uj%3naW+FowfhGM0?p zgd`>D)+h8JxMVsPLQzXgXz0;A;DKczelSwPi!Ofx?!P0_9!az%?fHzx`#~7FBMZq% zVVRhEUa)Fj7Kh~Jj4Z5TGWKX3mn=-p5W$#m>b58;mAQaN;E-knV30DYO4Dp%WqMUu zko`5U?0+ggeND=Pco6eE}(S0zE@LCOqNX z`-yL!`X(<>u=&(d`HvW2J|W_r%#nrk^s!G=@Q}zZsEF7vY|xu5VdCcsf-yugX>^ih z!fd6biQQ2Sa#~?alJK#j>Lq&|lLzh(&@zcSSAm102@>!`QRz>4$yi!p2qyMAN?1%9 zCa-zt*JKf8!g!i+C*}7^?2OMz3Qb;b^#_aFSR&HeAfUd30lx}qGudK^+f+qo%J*>C zl6cWCm9#G)-T{B-F#eJgvq{ad1vTJw$~JiiSV%#e$hl(ANX#6=V(2DjHO@=$Bv5F$ z5<6lE0js3T`Gs15;7(E|j)>nA0k9M+2e=sqr6x##DcKozqch)QvM}I|Y8)0vofE3a zCY}Ew4HSHEbq?eLTVus}9)3a2 z*kV%3U`?gvdf8EOiR)uS8kb8B3f2%0t+qu z^b=OIeg(5b?hxMu61T)?65J5SU@2H#4TZJMvFsJqHe|-L`N$TtT^LBm+a46I)b&my zLNJn~$7;)Ii6wdz1hg6+LI0|>l}d)zqWKl6eW0ZhA3%#5X?G#ExdPqG#}@3@A&=iN?M=bWXoh0%sLhR^MvU&G=!qKCv9 z!r_c9tZb*Ft7scFfEM>_g@Rt?2*d4bg*5KiH!G4vF0@5n-9ljx5JFxBXNMtat@ZZx z-NQABAK|SF2bg6;NnL;pZ2S`OZ3%7pFRYeMts~YWc^62cV^!3tJDcmxwqNZstvXHc za%B>|Ic;?T^++6ath9hfZ%h%9!+%m{(S;V+#%o}rQ(m-?=xPSVOG@J1>#+%Z?l+RY zw?;A6J@|pN!eG#L;(HH3vWT!12LY#79kvR-&Rh;IAdVaW?k9Cnm?T}4LY1?VBzMW6 z+?foTQ{TxPz!MSeFwdQT7K2q0-WBN#Dmpbjl6}%OmO28t8n<7MCk#=7_97G#(P`#L z3f;iwsDDfr@g`URKFK(DOsq8MwAtwLpEm>wSjZ%_U~C~ZDIN{M4L7GNQqUunN5>oo zQNf64V-ro0Lp|^7AFjFUwk>)61cz*}^}*#5fsC0lW`-lmo2qunu!i<>ADW%;1Lg zwebVQ3EQBtOE5E^Uv{|C=y^Ffc*g?yP8VUB7wu3zW&Ed z34VQhgM~qN9*>!fzq)U-S~BuKbU`?MH`8@qS-^@D^56oxI;g2v3aP zKipsDkGFXkE&6kKKpfnc(H296xsyD>$~bgoQ;A%Bi{jfiPMuTus$NknO%+Oy8z@47 zXA(PRm$zc&c;gsCIsS4^<G)@4zk&29K4k>dVi#AF8nvWSKVHg4fQ z=C8GXoNe&WpZ^K${Qe51jbn{le1J#)9MI_2<{^k#%lAv+%2i zO&xCokNbBojy^757gvs32T01e)$L13Gh4G=isbLwB<^;XC&9k zI-rQI`&9G@RI3W7zP$r~cfW;CA;s zJztu=3XF#PeHDbuw5~OJ)qPc*7qwnc*>h^vYo5x2WFMC!1bo=eS!;} z+#f&R9bMHZU!_N@;K|nN?5SkC&Mq#}YYg?=F16KWQ+HKGU@<~iUSeN`z8%Kp&Cmqi zkxr$myQgDU24fxY;-Fb;#=P3ORqgW8bhYx?9?rGcu1;a5Rt|GY?q8Lka{lt|MgF#v z| zYCDWwOm*8CaGH~%Y&YAkRcvawG#hmr|JOXqR^_V1Xxppr_NrHY^L0z`^oFpxm76Dj zCtu*h$~p;+wsH|J8#MM8st~Waml-4l0SSb(wlOB)yM4ruwYVxs!1y|-kcpWk7!j(f%3_jQ0$EX# ziUMg8_}VYLSeu9xofum>*@z=LSr9il5GxYa0@B2pJ|qBz5U=u-zm&7l8?N+PGJIbj(E0ThBeQD)_$SFbc zf6}j<)B3f|iKV${iLCwG@A*2TASBAtl-{_c@qL{?kj?HbUzqTil+wJ9KO#cnN6<{1 zPHe5exVZlzJaWDWZok*_M1Hql#9m$7@_ip8e5Eh@8#TDNfv#mR_cJ$t%~&3Makh7s z;^Q3(Hj~(zLy{SpeY9@@N4^DJ>OjW)*&{CUGYh}r2FKAY%nyZ4V3~rARX})tWF-O5 z{$ngdKX?;AVCX;b$X|jYw?BeTKfK~Uo8;d=-uXY?7BHB&xDce9ePDOD_@Ynl6Ikmg z|F&5HPJkae9L&w1^ytLe(%7+|^dF?az~8~u&9;)?!0$hFIKjJ7FV%QrpT>3O!9$Mu^=7qg#x?XVMv8l<7H zCQb;4)c8|Tscrp$o<9o{lHOS375Y&Lesw6vuDw+4V1+XSC4L>8r8PzR4~U_H+Y=Yi z&i??{@)ufr@nSC)@n_aa8_3Z+p+N8;C3O!sxkQhLCkbvg0UnkuZ@Bdz+;k2~jI^9p z=q1kg7_N!+q4|6H;t9&5YT9!Ch>ecu-nQv1D$yQGXYsHe&1Z~QeTqXO+g6I99VOeD z!`@n-Ca(g$l!$BN$c!fG>j|IU5-`B!{5-0Fgs~2!Bll6Ymd>uSOEW9r>}`Q`i;fbF z*BHM9-da@`SGB{F(CUpEnx7buS;MQn)$t#}!uvr+QK+|(v3syPz;V=&tl(4rhngy0 z0{WFaL@n&}LbiX+-MHe}Xa-gwLwnHTzHIh4W{rM|U!f&8pOfd-<$oIfP21vkaeKBieL%$;G{7Uny@4uoWgSY#s()Xs2WKAS6_q@{11H_6=y~4g&>b7rf(b zA~Q~$uf~XWhDQN6no8(#Wo5^@Wo5ajbSzKB(j4<#eG|>pS`5Wxr}*|?&`;0~`*T;L zxN0#Dqx7yBxx02sE+GSRQ5{@OW@iV#tsYPA&`5rkR8048gEsI%ma>0;A13{hcec~Q zBh6E@(EBq!r4*(5gR16F%P?d1Vl5{>S?pSILusG0JXjo3iG^s-CR*Cn5?FZC6RhnL~iA1GPBquqkhrYqoCybL&+GwT^b9wC9Z{^2*;}_CLt(Z9cGapXMUp|3~Rg zi#-w*27${WZ%;~Z5riNx<28nLtz1oE!z%U7CP2lxYp2^dUwyzQ>!JX%yCzfB>xdZ? zv5HU_gPXWzvE9M`0Lf&&z`NBqc3Oi7i94c*dr+>E*4Ra^vHt+K2;>&1JxqXUeU7TA zW6k3^UQ7RYMiz{4^2TZq2&x!-yB#bG0=;f)0&Oj!33AmCbkW1@Pe&8{iwN1^^~~%R zCF6T=j&NK4{sdIc?C(>e&oM2NMhd(;2KAk<{^q<%;7=^4LMk*Jwf2zeyUgab-X<>> z-Y7oul$e>(wpcj-pvT!fBoc}vj;up=&iQ)Pglu~|`hCqPOMxxZu<~_kNAkDfE1@>m zL=`8$71fWl+o!J1Apy|yNn-LREjq&uD84))-|s?$Fo1k^lwPD8Eaq-lZ(JZ4CgXMW zc7wy50NK}Au;)uilNe*-qgxYr*b{3zT!kHI($PH&iG6#iRCv;Ar&hMTMu1!1(*AXkQJC+GWVGrXK@PS*u{x|IxOxrV%81=b*BkK8_s%(*(M- z&cvcCKdS|iXM9xk-#Jk!aek}gnR%_kPEmw19W})K=_3}jXHUAY^(?qg4uhqU212d8 za|JnnXaKPs^HJ!(2>D+fPX$OoE%@1C8siH8H5`J7Y_>K*>#l2!Xd!Ili!%S-wX@lC z{0*jqD0x0J3`=FeWsk2Lps-vbJbHRaOPNNmQ?mg__Aww2q>GnwnpC%U*&`uMu^6q3@U=+h#?y=tPrdV=- z5Tccp2R!Jc0Xr^h&!s!EeGX*izb)_2uQ0!Oj1ehdCvdQ{gF5pb<-!t0LmFbNwNL-+ z_*ga(RDLx zqh~oRGAwrr*rg@ZSRq;{0Mi+F{|{sL5GxE1a0&R@wr%^~_u95?+qP}nwr$(CZF9aq zlUYnMi%C~ansn1eoAfyc#LV7sm0Ps*pmLPJ;4|QSrx=A9*K$3H&RQD&g!{5frvI_= zxjQ4UTaR7Jz<&2W>kIXei`~&s>|UktTZiMf&3Gg0yNh`rC*~TL<8j~djp!F`AbqGx zktz!e#s)`d;ah~_V>drH-T1}gUr#&&YrnWooom%!uqlRv$!zQdtP$~CW(Ah9s-!sF zwy-32gPBtG#$8Nmj!suqKHw_a--NR|(8njZy?v!1i}((gGmLka+CpJY_CcY0pwg;y zu)u4@${;+kKAg9S83gWfmVnZ~xlZD6XCzFW5J>DJAf;eoNxqaeu#rxNsX1;}S`J`(*wMU8dcvANo zZI01@4X2#P9`lXb-2qXty>2bKIDK(j{aF%{-a5Dse8l&$MMKQ_~YI{}ueC zYv0x<&>;zhn}XjSUvjS-(02)FD3U{BeShw#ab;R`ZDki90GettpZB(KEzz6 ziI=QtHVh^dxb=RnV3-&&BLw5HeoSmrqbSZ1#LuJ-NXnxAUdFX`3MWMdsKTUf^L`mh z5pM#}Yf->3L8en1*iBUSdESJjuSzx!V@Uh0axZMVAv5H?;(EfVw*_C!~Ukgfj`sWVWh zOTcRP?V%)=MCw6^8+hR8kLMnBvC@f;CH88(A#5B6syHug8{XtOg#SvLy)a!wN(z!C z+_602cs#!uaaaDALftC!U7Hgi;xHZ0wT}V>Jk$yXr6Zc{N_d#oB!f^aS=Py;3iPwo zGwoCRETDV}OLzNj*PdG);WfNa?LeaJM8z&DsJ?1b#5I*-Zk%sRM*&W8CM(%&wQ?o+ zR_u>2JT#^Ruo%2gho;rL8LtaZ@)gg}-Qu7s~0ofV5wJSdnx)M$6G@!^@+2mRgd@$)e5KCSl5EHm{dlV+l?$y%SJVjV7eBy$XESu-r16dldZg@9auT2iT5e!BqL!-utERPjp?sl9 z&{ZklRf>$QrGH$dO<)r(=y|syK$P2eW-6aP=#I~ z={Xr@?2qKPC<%x!of$SZ)ZG%@7tyiYj-&l?npw9NVUK@JRV7{@?@y1N)~S=BGc2w% zl>FV!d@>EKg;mMPWFlYtM8se?Y~t2C3^$j76Pl@uDQu8(!~(s?(TSyCpF8r^N$sL0 zdPJBN#=yLc>D6T;u}MtuFC4z^$A@<6Rl=&=cXzawtn@19zrsUaN9?E6(m~~$q1NDi zmKGd2Z1jaQgVG#iz59U15L`;|i2^#~Yud*+;&^ur<(V=BvBM#MsAWfb;Ao>Z2ZFA# zltQxIX4*rn$_2DZsGs_D>b zakvg*OjIY6e@ef^O|bL?(UUE^7tAA%x?QcZWIfHs=5`o7O{6yyL%aP+~;U2E0# zX-Txzzz&h$RrR39in%rKZUcD+RBRnMV>eeFSs)8qF@~JA@$0!SWX(1lJeay}=z+JK zZlsoo4+%jNrG@PdL?o-eJ9omwuUR*-jMF!8>v0OMUWQnmgRUIT@g@R%7{NqF5JIcM zZNTGN0bNobJ9-`o@PkSU*c6o$2)uVfpv`R(IL?I5;z7(n(fEXAVHZd z7nidMXGmnNVwAABh!K=^N{21X`lyiIt^$ebTXBSG`sBdY)WL8yyXX7G@5i%2X``UeguW;!45)caE(Awsj zG?I!nyivURwQXj+%A7dJ@>}*$`io>U;$e^>e9SP7u*nF@`e>=;i>)V(;-Ex;hngg) z_TopoPDm-)D%vajIeH)DXDc#Mu^qp5?obCCnJn29ts| z_9N{(rJm>O!dVol)b-J6a|QkzDj5dMdQ8o-!5)B#g5z&CBn7Kw9g|n2MXVMbn;MC1Igi5Gd6uQ>Imm z01|!R%qf&9LX|Xa+-U2*0Sr7V(GwG2w+FprIk0o>6kI804TmrVaxc}(l93{S8={kR zr0J2w=Qt0)-K~AagHV_BRJ%LXJX!~#yC}vJa1;=6jWMn-RZP{@Z0B2ww*N@0kArT7 z*aXL2yH&L$MkpK$J$4rQPh)?x*J%dz1X*DBb+Y{-&S78Xw>{=Zt2-onRz(?Yk#8h$Q|MvmBn-4Ia? z{I7Z{wrV-iZ01}&%K<(nkfhu{?=S;Iqog}sD`Vjye4R6iu7IYbeq#6Qdz+R3{T}B5 z-(%B_RU=P=%_9YY?n>5?!0Lix$Z%(R4mC@MDp(z8rlV<}_47Xc(}WkA&!z!-weaL% zNPT^!t1!HS2ntJF&d>jKxNL0f;-morh9;?gCnSY*5JZ1K}+#@xSk?Fqo1$|ImBX z$jGBaZ{+gSx)4#_Uh~&&_rI~ME4}nRejyLHBEciDs2`dbuIAei1(m;M=8zD{w3Yu{ zb&pV{^rmttm-QWDKf_-~#Id|J(ReG0%o*@O8n(nBBTU9p%)o+p3um_R(~Dzh16^jv z!o>$cdvOuc5x8kUT{Z|L!mkpdw8HlJBxA2nuTvPNxceuN54KsNpHcXIx#d%T16UXt zp{qE)ta}hze{d*wZVxDuAm2B#yTntQS@w4QF#E^ZeFC=590og(dd9}|ie*$^x|}Zw zLbE0!A3(l!P+h*mst|1eFEhUaE%Jx?rws_EC)!q!y|ec`$K~DPx*2%9bkR6KLsb|m znW7cH62aI3FIgUc!&xvC$yy21(l2kj+$uBqmfajtTL?3tk0LWczup34Yz?0xg$`Rg^cRs%mW_S`F6Ca>^2(XEr2GUHIN}B?p z8dlJ!qjztb?D6XceZ$mx94Ua&C)Arq$8Of;z?|t#+^hVc`3l8vZfG4xh_p!Rk}L#B4t~1iXqLMs#DEg5Kp- zOu~GUGQpnLZ>V_F+qXU`ppF4!cdTsD7}Ec2%1DXC6gme9Yc4g(*g0#9?&mLrWWAn1 zedqWLPOoTU5=$nC4d6~kMwH}fbLL;F1k(f(9*ZbKI4DITeaCu>O6VAb8lXCz<%yOQ zQ8SX{nz6Q<cqP5{=N@Y3@w zVZt=nOR4xd)2!+Cg1TV~h_P&O)_zv6swqg3nVhQ{folCY2>+uVJkx&T1*%I3j)vAc( zqG*ciRhLJg2?3wLn`X;*uT3k8 zyOFB0he0ZV1a>|~b31iur&-jq)2Uw zr-B#SRpKo|TN-C&JXeZ*W>IhQ9{2`q_WAY6)TR4PVb$g;GRv0vpHl>W)o2%&=|b_! z>e|Z{vi~hrOW4C-TeD7_V^~UMkKbaL@s#BV(kbm>tv$ZsnTmv}fC~obJ?CxC8&1Tc zs^`cNKL*@Nb%iW;BWI<5UOV2)H8!Wi?aMz?*S>U&$taRQ(JV|ho%q1f#`Aazr_FQe zoV0a~h-?6!GMIHEQUw$XYS?c#-1`1HSq2B2FKWyqA>i6x^7%db0R1SRu^U=$A8j$K z3u1W4dRfpCqx5l+w5NN)54dP6E27Zx!hPuJ9Iy*Vz2REiKdpB2k06jz8wal!+eeQ@XO z`}JtI$W>h1dkA#<$HWCArW*OQ9_p&f_@>qBaOJ(D$goWr;EoINr`bsEFRh|dYJ|gv zYTgNyPFXY+wO3z}KbnnrVHcyn^OU$<(R|B8LwxCK?S_XGdYVGW)((>T-NWcMK}vh7dKNzzyet<`!D$d_tJjan0iW6fO}-^lOjcE+$YMY#8Epb zRRIY^X;gj1({lyG)cA0Nm9VC$wWl%K++wX#{!SXg0W&R{8}in{pgO$FcRyN8t%AlC z%6Am5FZU>tYcz_wxB8F84l_Z_j{r$beOZT;Hkd(Ij%4=CAz~#A|9$0dB`OP+UR5iJ zyba7Pl?DOUJu56Cvu8tVcxdfA!mFud&qeDvCO}kSkYZEj{y;4YQmrKxQoc~57+aef4xPZuIY_fLJTC|~~ zv81y%1sk{1VSw8HGqP@TV(p#X#}^^2keOUU=Cv$9TbUD<-pL`nL@^=9 zwwwq?5t{q9D}W2?VA%B0(Y+Gu*?@diK|Sn)Sn#Fm>@jGc9!7FEq+SCH1F51LGx|$> zd#L$wir=cElBd|ACmv{)6+^hg#P(F;McUFi80Y}C$9?&6!LrU%5 z=8G~&wJ<7J=OG5Mf82n(h{MrQC3`A@V-Ol*^k!hY-PxEBN5Pf-Mauq2w$FvfcML1p zaR18hsN~kvek15N&8nGe?+cLO2l=wTXkvp$smT;MTTHk0y;=ic7YQ%(!+TXiJNZ!e zn(~4uC6gDl#VWAki8=SK5@9^X0h7#>0>S@M2%L2rAAqN3eYz9#NW805 zR+>W-aCDu!Mk^xa4=vihK2DZfr4yxR$_vgiYXY+41O6sgW;hir%dKH?f|;9<_ULO@ z*wf7K6Xm-CTSkZZS0-Sw#44c@xZccy$$e=SSrMaYw5b^MU}Wg;19YeCX|C8vKgraI z2}0YV_ZqvXIpl~2rE4rj=CbM$feEcOpR;U5ncRm6o*D}@%#UrR);aWAzq3}{ad7m8 z+oI0P1^nDM=vd#f*nz&*pehk9mQ6x{;Lk$3kPmaFSUUTGvN|;oF!49Befq>f ztA6BYPvaOat zz{R6rJ!AI8SdwIT_2sW8s=DqW0{sF5<9IdG9NKxLY z`AKjqK>npJ2;XWb>jx-LnogC-KAwk5%oAJ>M5cD6p4*xa!ctR86f*)NSK<%B9W%NN$7;1xJdt|Tm2Beq=`M+)Vn0n?LE~163BdkVrfj1zSuc>sQF^L7Yjx|u+(|=Zm|*F% zRAymDtEw&Z;;|m4BVPqK=_XReliQr{Xc}}dk+jF1k?ucov2a=BM4f#_=~()W)4uZ$7GN4 z@f_f|0G5;xxjgJiF7~t3NgP|`@2^A%eM~?gX$mbi8Q-*gNdHG-?3Tv0bLi%bB%UVs z7A>3e=UYd?FlF?#F6j8Y7S50GpxCH=yt#J=gArPE#M=jZCA$npi~cc;j>@&Z0?;GH z>+!RZNm}$Zi?Cz08p>V_E0k+lLqcz`l$OB&+cFwC=?MS)Euv)CY_-cu0G~bNy^X5v zgwsF&mv+nzupZMPiv`GsfM5CG>~K68^!K`eV7dU7<#wl3GvzzE3AcI|rg>m21;3PtRB=ir5O8`ZnDGc*i1<1< z$V7s7ZFkC$44mIM+YBE)!)jfr>}00=RwSTgoAZMA=7 zE~)9aj23sJyd(}C5kPV1;i=rF75GKec^V9E$Q z%9fo;eo>fxnG-}tij!h=44Vpw^taE%CdDNC;?jgP1Q>L@v&VD&8+HGuSK}khj}F`K z40tK}z!b*2GDEn97GrV&7e^oe-CX(KPf~tUr@G_usZFc^27<*iq38}5v+Tm?WY&#M zGd;ekjcvdu@8h_jIfr%B;B$w3n{{Yx<)wg(P=Y7`Z@jNS;#-BbJS89~>*UePgAa%s5?HQ< z!>d02ly)6)RgMe_yu(l81nn|0qwdFMU__?6mFKENMhzH$Fjj4I{f;07#OjBL=YC18 z8etSP{ZdF~mR9{I1-tPTeJ_a6}8F54pdA>h`PVzaS*XsgMk3c5umBVa(V4#jcHSvmuNZ|MWLNOf$AnG;GK7?MzC|}{C`1GKDXy0y zXZ^7gWF? z2HRpyetP?1-+QUklfAJL?OCn$5En9-D|3?f%5qNN`51H%*RIGK9vXXlZ@=REQYa8$ znKJ0&1sb51d`XJ7P&Hygg(%^(U-H)pYTMUzF4OIx2fLB0U;%z0fK_7*I`co8M}HyXh); zwL5)#ae@urRJu;20DV7qe_O@xR;LXE4I2!d(OgSmaxsjnO%sYK4*JTzn{))5eg<$| zz9e?BjHZu1<-1T;Q&MW>bGP&|Gq!DP{X|OA!90g@8cT85?DcG}23VQR*u;pUx2@gN zIr+MgtObgXUGt9Q6YU@$xFTDyaVx!y`rQ14Db(^~(|SuoP3EaXu- ze#uF=J!Z16dN?_L+u;8Zhp16=OM#s=apUpCA93H_J_%W~ar2(MsW2e#<=VczCx4hCLP z=~h`Ls=0QN0_lk7>>&oCo-s|fa+u3H96QKCPdp+VKqi>A^+sQgFM`L+UqO4z=@3!@ z%F{2Ule3i$p_C+O?-8>4iCU=N>iz-@qa&7ORAx>PG^`4AEuGLFG%?W#{iy3T?~j z>By2DDaT0z)L^!TtI+015kK3df4&KB46|p`sfGOzK~>k(L9?wbN+gzE;j%Uw`WDjE zZT&%0D`>Mp1ta^2b%SX`VKbDcl>f+Q%rgxcZ&o!P#lcdHGqIM&nf(eyLTJzli7~bXqlE?WwC% zBEpNC5hmSP+C05jClsKO8*R1q4@9RyxP*qPVA*mx z?-)uaeP$kRcO=0n*0oOo3Ypt$R&ZHYqQc~M@jl(IThVzbSn#%wy~l=Y(iFnLcXR1f z*N=vuKktzTIYZ%Uo-zL==j5>J)1Q zX#1}k-K4W)GKlQIy5P=f4|oQ3lI*A#r$$|ji>3;*gxD=q9U%p-Rc^_4w; znylUJo0j|3_#!PA!=vt!Ea(%wgjYkw#}gt#Lsd}T(>mjByKGjXvQLO10_vr@WqqyR zW`c%^$9;KeFC_TnYvET82TW^msO`6fG$kjAdJD>+WhIWxOOT9#b(IfTC95&E5{PG+v zs*lSe)z&&3$~~h26&IvJX^UlWHH(0+rYMw`JMy%SnAzD@m7O-nyW=0AyoSJ**u(l@ zW$BUdHcfA(ft`UG6R;AB5WUCuvyRUH)?-w^Jv~XOTodzk0+8CeWb`y}#Nh3qn zD43Eb;wviX>#}{94tJ!+kN6MtH=Wq{QD(`em*bhscGF=A=G}%dUeUgIaY?%&O^o9z z(MA%F=E{<;#T8jTVK7dEkJHabW#vtR-5}4^4;)Q6lwu;BXjBO6<1E3#^&?q=Mf+)q znVw9U(OP)@J+EeS`7@{0+mwAfDUo2L)(CfY`@ISr=~9=)Ch_zyc2;=8g-7N#RWY0i ze_f-#zzn~dmL}UIh>k6AE5UjG%a`FodC`q8Om42g9A0WjEdfdK15=QB^A#-adDLZl z7^&azh>15L3hk!aB`3_m_>lh{HUnzt3?vkoT}UcWKdzM=fvAdFmf%L?f1tI_-Z@GO z^>v_6olvCDvMx(h-b96D-9v~SXIhRo4*Fx)-%LV!!zJwspi13+^0&p|11(5J{@zM% zMydlBfApfRv+_YVD!T(`>@Z(<6u5@iC-EUs_IIiMy_Im`+5)Y5;8m!Mj3;v`fez#=QyDZC1GFrJl+fK)Gr-nH!zI6hiZFUIr8F5y8Veo< zA4A}+`nj&RD+rHzcK3;WA)G~wRe+n{w>e(x5PL-GD8HZ{o+of0e1Ao zlHx@meyVe8Bg>6DM6}kXyRZUg*3cN6cWE&rbFFa2`@HV@n)=^?e0f_ zc7-pnjgk{(Uoi7_JY@l)okI6@;Wk6nPRFf2GlR6BZl}j|29gfM9Zv2-uRhJi966*6|1-*7M6tp>Ue;`c9 zo72T>Wk=d9PjC@In%q{_&1u`X!hXLazYEF4*@lrv%iJtX|sleISxvzimZy%;svs(!G>vs@C(^ z7MQH5;p-n#2$?5~VrF+>N>1~63L^Ya-}nx7#rG(h6%Na<@Kq7z*(sme^13E$_e?(9 z+Ubtn$pGYwJ)2|3q8C9JJ*bVr3UME#p#qI{fCQz_Fc63DDeful{3m8eF|?!^T|#ZL zsqw`(7@3+W9loS_{+?Wa>zjM1MGo2A@W`*CiFD3u$8SkNdk>E)B$$ zT;R$B0_IEg^xZ1|aLll3jhqMOR&knT*ke@c6#{+(An$?X45(haPha!PeDa%R{7o6D zEPg{q?~iEv%MR@ZLr{IA5UtQ}-kSHu(YO95wno_j%EkIj67JIV`sNE6uh%&mi98PM zh$iwGFgwLJ4<-2PwLP=-_Tx6l-FNQZ>M;5nDJE2=#U%M%0e@_t$S^j^P-;TD6dDCA zHY6x=)=W*0YeYg$Rl{H|s3EnsGG>Zz98?^l%8Ke+8*g@!g2NR9C6Ud;b3#<|SNNc! zSh0R$M#g)vN>^;ETIVF-q9Yh#fc0tmX?4H}!a9jCsp6n>U6GyHb;vGmS;Kn6CRl`9 zD3m9{Biv7@W~_W#c@~3wBb~tu)!|3FTm@y?uxp#{A>U{xE<@$&;YdvptfbTX#`{uKXzx7-_F*K}GP3lYPiP-AbxPH0Kf>iMoWr6IEC>m1)Vd>AOct zsb*Z&yk!7o8Hpr{XU#{~G?0&84a9?03$xF`xFb<4WVx%@8kaE2B)xfoFyCxlm~{jo zEa2feYBl7=2}EL61zJ>y_-Ygp!qa@h$&7NXYjt)9j`k!vd9??TRZRDhXVoy)_+Hn- z;kT&iNslL1)BvomPmxB&c@pe*3=V$upJm|DEH1qIlZuh@P1ejQtSSd$`jHkU4Lgr1ORspSc<`WYJAZd(R=Jp*!LCoL()k3%Wy zTUwfnM`Tb*63iA^1zkgTTH0y-iA)S-6(ka}$X;S#QXkgwHO#}A8?7)Dsa-d|Fv!Lm zofp-v-Q_FY0sbWKkOwEUY>JDrw|zPg`P*9Mo5V(R_#4OVtjsP3OyIk9nFVBW*O)sK zl%^D}ot+a(TZ`^l(83-5FCW(0He$q7%_kcnIcnYg>2fN|cp9nVIE{If>7pkJ1t>*s z40Kf-J)I~0k6$&o+VhIWjkI&dEE8U%POuvJtC!y?|5=)?jVk7&j6;E;HL`;YV^|^2 zgg+D#i=0^Q^U0SL<8-aO^Cr&kmQG2*Xk9C%V{SpA0!D#az=^f^vvV_6UlR8ZctUMtUOs$R84K$*{Ss@Eu zkRPG)Ijf~YbE~>v>TP$T9-0&^hHX{E6NUn_%>i2L69sf{{L zuj$&st6KftH1KPv{0GV3-dbmBp)JdzfaFUX zDZsj3FQUbm#r`CRhq+8Hk9a^EbBbXFhSW~-3TJd%NUsu_WRtS?+TK^H7I+DaPdtPO zOzrMl!pM$@U@m2P`U-qnXq2)QCI6hAGbo^-1V&33J-{X`vhvW!yLCb)q_f>fSFxdS zQQaxU@#b~34BXer6~%VPq~jJBo#Q&xH&@n=c#=2ax3&8PoG|N?0j?O-$7DSsB||)1 zkd7#eE5n6_I!BJEh6FOI&3&{qX?>ILOVp@5vD1NzL8yjaN&Jq>X=rU$F|3i|ut6vl ze!6L=VbiIkVRJIYVBSC>D73vn^C8L#jej_Y?^OwoT+qWmZUgeA#>Cu60_PC(s`f@7 zjEw;G%|>h+1Cm)abU&r?Oi?du*>#D$=~b6W#!|V5FFWL{dB9=Fhuaf-8a--;Ev6M` zaf>jaCe|{3y9WJUG1?OscYUGyp%#q#+Khn=W%_^fx~V2_(iyk;m8IM4v7pPXURj|} z1@d2x(t5r^*>NC6x+HEC{Vix-L&MErQSTDA;<1AAzIXrN$a`}(=ngsSIe5B{q);U` z=FpVK>#a%-kSS@c?El?QtHzidtmACZOCUV95*A7S%;cUGHfL_$gK{@0?i78D;C|Bu z%CLfDkp&zrYGwh+VehSV8;syf8bjUSK%J_Fb+(n@Fic<(wRn7NF*Hk)%cdTtt%c`nzJ6JI;`chM9c7- zL|LHE0=m|_jFl^JLd}YB{C4Y>&*J&1_&~xd%DK$cet+XR>JLz?|&%A0fXt1-8HuZB#|!k`k1rU5KH7dYeqaId;_E z&R9qkU))JTL=UJ9qAN&2)`)W)9gNX7@-W?wn={E&1swC9pJ^xl`KpCjSMb|DfpV|x zNe=7p;8J7Yq64*m{u-jQGJ&U4(E{u2!bn2sBZj#~52Y#H0e%J>0E3OF!SEx4LQJ*X zigVT@42;;cQ8TT|jg#YsS+5GbP+A>@Nz`ofo32G{fKkyoY(+}bd)A&_PWE3NM`3q- z3*${5rtvHeaWqD^EV-i6EQNiSwK*O^trtAf2sC?Yk16bpDOqLS7qTDs;$tbciM&N> zCV`^2#zT~P-1`*xFG?(tHj0(okq{S?Lwz-a@xCPf+Q}(EBRgKQLG^sRa)Q^pOjbX{i^Jvq&ThBqTsg~YHdDWc$$>XR=gv) zS`LAmbT|M0zEtq{6xEz>I5fkdze2_M<>h;EZOgqq{?$=k5isZQZT$BtBAV$Zb8br{ zrhqMs)j{uN`yZLJpDXbTZR_^5%|J2oah-#Dk!lxh?czJgzH z_Z^OUZW|nVSsFk1mmyu(bK4Q1}t1Q2ze?<;)|K}dKe?v}9#0X!>KgRD7Bu5|&pzP~_Q8d3D|JzaiFF$2x z0I&R_n2@BUJvaXl!{;{$!G`oJ3llWWw3HhjUVQa2;0pbAO z`EP{@2uQj*$A%WR=XcBx`tr-^898pU~I;TowU(eU&9QI^#R6T1}deN5*GmTQr`&~ z-Rob06Da3zm4Nc!G|bB$35?9Obqx;y8NU*Ts0Y_sA0eRfpBoMH_gljE9{+4(o>;ve>}O;mi%hMr|QM*1&pvprIqJ$NRCCI@yFurzGV-|O{% za9#^Jzo;dI_MX1&&yw0dHzVSr?_7C?HoC_8k1*h8k1D@r!mnnZUgvKzPeD>jTTm+T z)vrnaKREyHhLEkobNzSv%2%1t#Qc#L=BFPVaUC>k%!o~k(wFn!FJj_EKa9nQhZRM_h^vv(};XW2cmI?uWF*C5o0zSNXgDcwSd(k}I!gW5a_UrC*4??&-Fo5UYjWvs&nu7xZC z`75Zoxe6q>d_0P9u`w|4FWdaDH%CjS!vl#=ScYGv*+}GEUKkv^>{xz+y`7GnDzv68 zmdp8M6&)UjeY7122|UBLMa*W}^+=gMkO8-hkaU=5_GS|+vjW19W=Y$CK0#Yt!lc0PrbN|2IpbjH6BG7JgIW`}|k@{5Xb zhk2*QRbyYWbY%W0r0QpUstMi1>NrJf2iHOnLwm4_HJQBfc|N7$eA9M-viL*Z=V%^x z{bM8)3?qfMn($ro8O>tO+QWAPO@HcMgWJ`xPs^c_U0xqKV%lCbBA?DQ{v z^(Rtnu|4{(izvo#-t>EPbePePo*b(fCEhwA(D?#&JhOTf`5RhHqg<}BnXlPPbqX3+ zm5yejqN_z?tRPqv3HcXP$U!@kGfN((cARu}RBBrBOq!C(uKgR2u@<_ScAI%tkjRQt zGKG8-VMiJ_3RkY#DA)iCOg;&3Ut}*S;%aXNUNNTOK_jaL2_pT`ZoOns6ppzHqKIP7 zERmeY#Z{r@kxg)Z_Oo?J1t=JjxIb9+!do|^#)LsXyD!lfex%s6RLOm`+@NV%bIb|j zw%T2o19+u0)dQSLh=fo|>vBSRy&1IvEXBR&89jEgkv9->xV~F~7l!J$b{@A==JBB) z`^rV)PyJp?uOzPQ8TD1>x8Uv_w{p@Ml5EUBZ3brR(sQ(JBwoO6B7N&uCs1-^bwOD0 zX82xAtNs`Ssti5jV9(*m>A=Snmd8P|K3SF{UdR|}UR*r)4d<%|fDkEnJ?T^UsS0BD zO8INuDc+owYoziA9; zE>(Ihepr?d*CEjP2anocA$nZ!H*PK-qCXDzzw$_(q)(uV;$DWIuh}srirTj_79JyTVX4E{ zu%DCJ*OH(G-2dI9QcYnGEN>9znpf+CU%GDlHL>`$i? z(ga%1xbc#DJg5bW?q`lM-_A7AdPU7=q_=$z=s@eR^$R&}Q@HVcCMc4J4WA<-*1A@q z2h{>=rp~$CPfV1T;trUreJcuAmeb1zv9NRg!H-f3M&c=%L*_=EqT(&=VI4{ktS{dR zg4!pv+c6jmJz$Gcr}Ks8sd16Xc>m9kf-w2<9h z1UZXh))GVkke9blOH{6j z-Ihk#n+6@oz-}>%*}(BN5uxma!*CTiDi-+A_0*98b53)Gh-5fwgI63?yfnvaZ&39E zT7xU{9lQ!$_*&F#Jo=6UFiLNN7-YKlaGaFsU!kCF-(NRRUz0PuX4rbjbuB6hwLY<% z&aEopOHuf<(lOR#XDY_ET6VY=%nBp=E#hwXiTcE3ikLK!siaoRCKi z7$rV&`!39=XR?hDpdlq$SK0a-jO(DB(=h!B*ZxMAaN}3mR~DL*qw;v3tZ$+s^;h^qvFnpqd$8z#6uRX9#Hx*%PU)dkHMMDOUOrdO!oUGeXtF zvjJfUv8wCJt7v4c_hZdJ7a>IbjdcTp&v)S|n%d6kF>^WZ=%)}wac#p5zg>rJzxsx) zmBZ(A{GQ%P@nRqXrYt0anQriLh$V8&m-KO&fW-!2ikVXPeV#gFskOCU9k$gKr5SyzieGWABiw|hu%?_Dd?9ilzC_wEy+?qaqu2K3((vhsEr%iwuAO5fWo zkU1`u;wEV5;3PtP`JOJw{&3ITGj%#2YoNwpDG?{g-tB%1Qa}7Fl@5kCe8w*|-ON?V zNxuSKEZ@b6D8VV-nNumXA zlk;YoWwRWw#I6R@XJOxf1a(4v~X?Mn!-X|j2WQ#0Ri2i18=sG~t`4!0?_Ih>8C z%T;Ku*F4E*Gw#mn;`k|PAkExiVz_Hjb7bMs&m9x8D0%OE$a(SwUr}k2pz76sJ-d+fJI9Q0+N>Gh->CYRV*J#=Df%bqx zY_L?LWq=+8{(f zO26P9c;>l$akVnW{i`;uoq2OA0sU8I_~b4{#qZaAoDG`HzFStbD0)n(uWe342T#=? zWOeie5rG%qjagJ({Al7exej+D4p5q{Ouc+Mtf<0{#5|N`Go|b9Id%~K!2cxg`iD7K zQome*NJ5Z3Uzh+FIQhYYECK^cl&(%+J;AJ@uqT#qdibUHN~yJEm(OdqQs-%keyCg{ z(UCSI4lgnktrd!Zy?VL8{|@1aN4IOV_|o!vI$p_0ntC|4?0HVYw-pxNj(o+e@3iwo z=~#omy`+@UJP#SUE@a7#$zd>?!}?_NgQA2p@#H9d(^L{oWVRpoiF2zF=7P?AKU7(R zGd^crOcHbw7c#9otg(;p8z=mcKB=CSnF~ zWE^6i{>e>GWNidRB;`{cauiAZEsbuU3RTp@UxL-O?oxe?q9WBD;X1T{%f0R>&$B`! zZKmR>DFjz%b@t5#IJXRNW%JF%jP)|Nzu&byvktS49?QMge<$t{ZZ5Ju>`}2WEAYt$3DjemCE2fp zIV>*Nc3Y1c4exc`ao{gM%%Xm<^hf$-A!KOIDdoG1yv)M?Q!zjxaUns_&r={?9PM;UkvCig^n|N_G-wkq#cWIZz-iO-8zO8@ae<*eu ztT@I1pZ%CG;ytq9Ro?#iW~rc6A{$r&e@+>EIq@vG>X_=#H*XmH*9$N09w+e`zAaP% z(sE~T@3Q&O5K<@HzahcnN+t2EUv+Re(;@p(0GxZ!N`!c}DwbMS<%H`aPrlIH$cY z3SU>)b%}#Gd-)F8=bIzjt^OD%#;r9+6}*`)G-DOZ-%)?g7eCB;_MCeJd7AxQ4>Lfca}&YrEb7#A1b$3jb7dtvvvGJUeNDs)e( z=|Q-MX8Wsy#*?db5LkREN`DQxz*wA!g@a$Z6;P3`RZ=+)ascoKC#>o4=)x0bA^HXj0uadBbr_R#;pKSk-!}cn)WK+k)xjrU`Md zMn@UdLzcEY-_=S@Q!@U*a2o?Je{L_3F!Kn59Z%>jdYlr=D>2vYh@u4nRn$fD5{{J- zIXEv(L|MprewF+$9`%XRt_&475L}1Ft2}}cPmA@T^iOc+{i7N5lmd>+ZYjvqIRPY8 zszo|6yD>C$XE@Omt`RdsE-+il?3YpVCOE5LyB0jh3LAL|u}4ZaKLEU4t*eDs87E?C+`=O}lBn=V*{Re?3Wlu*(#&0u>U4mA<+g z-g^ouKjhb-c3@5={YTU!BQ1;$)pL}rl?m4u%iNJ>ej>OU5fP;hSLA%xryK`+ufA&D z2uL0H^~ya<)&gjRwm@v_nSNe#7p4gIyL?CYL(MZ+*u`oAOQf-B%&j=0hk)?+lHt)Y zY#2`=90?@}w6ud)7UFle{DKlDlAw8RQ!1@EaH6~Wt)Nx6?v>N!AgTeBEQrty8?2sG zcco@%u*i(E0{nGN+{KP87{ZISDhixSI3XnU@d{*U1gVswL^ma+h@8W_$|LEXghuf- zx+O(2ULh9uS{V93b)nKWI9v4uU@>@7hwRpkjo> z&gF08OG>|-ivoYBb77H(7O5ezY`iRWF6-9#{g=rIxP#riwU37<*7Bb)>H?pB`;HIi zQqC%NRHf(&O&kxvG|}lZMWMs5lV2Vis~UAs;-Og+kpaak99J||6v!i2slS)9Lr;0s z-X!Qp8HJ`s?bDCHwA64u+^2E9dO6g$w<}52}EDWW;gk!F2^B;2qKXDV2 z7`O*3z&1XV5?5sG@ivgC^;qBXl@o#->-z~S#p1br3?^JCDlALBLGE^mu-zjzKTB8d zAzPKj0Zp9etX`~Gaojs~OCEFFBz0|Jjo|9DZ&^clw&2j=_s<@lS!E=BLXUElIb@oo zw?$u2E_ny|i#d@rk+|lbX< zgldC{JWS<0!39z_Bni(E$e{+wW45<<>)MTTxVLwtrv zaaPsf=I6DmTE@-}+lC&)5np}#8;+d(Y+175MBJhTo7sp`=^HswVpxy|4@Gt;`4muI zJS74Cq@^N`>CQMDuGrxeAiK*gyo-MGlJg9t!xjdtZWK5(>WeatCEc2mOriIqE>*x? zl|clr#uqo^Huox(_Zrqzc0ZHj!U}7W%w?}s{u$awvw9ntg6X*0k7MN_0D=m4)2Cs; z4Ep3bmP+9CK&+Bbex4W^!Z;2a`ylkjB}mT?_sXXZI+?e4u^lHy_5339hk?c#MpwAI zacZ6EukgCElwV_sc=BnxslTYl@$jgq~fIfT5lB?z8BvsIan%9-@JVvlaCy6V@a z{@vK;X=k{n47R3(2tU0r3_+8q8WqsPDUo{rad>DQ+ul(z%z>^L@S9ZsEc!_3@Gt+Z zl{AP7M^A4z&X}4e#^YMn9rB}O!GDk(atI+5${aerJaO$#Ix#63%t;AE$FQ^=)jkGWhl}do5=p6Fg{c1v6qhP-kT8987Yvf0 zN=bonn!uv|`5@1h-3>|!35x<5K5+{L?<><6Yk`DT!gSuDj*4{M0CP?3zLoFH$1xPv zsr?LtaLP6INgV@U9*ry=&~>Hwq7_S_!hE~RPq)qVs4%B^QP5jvisp)}u{tCf{PekG zwU|=;*UETRN-?c=t0_^UBcfhc`gFNEYxd%-3E~#!tPQ^HY4n7r7KwQwKup9&ih{d7 z?he86Af{44=2$F-Dzi|#naPIRJ(gN$Y+#VtvC~^Bzko4i28kKwwrt#ME;&=&t{S=4 zS`{qUGVS349spddj!2dJ=oeXPA(_wPih*px`O7BunqLs6oxee7M23r!Nf(jV@yCTe zB9(=8wL+D5RJ^vk5r>}7b=Rt!Kua}JB8a?TkziMkLd2}c-#~L>f0fPO2=kKmb{?Z- zbE7qrH|3D2AIwK7;pA5&8zXER`e4+n{h(=Vg?=0;p1G`sT#Oy!V;Y1ZdRYK;l&4`* zmCy@6b-RfeY4^)|g>hNL?qjPrx`>iqkzqGLK0!Xh7*C1(cqn&QFVq-hV*&uMc|LL) zzVNEqJuf2Au_c{H=S<|A2b9G~iAV^Fwe7isE7&-`=wHL#L3F!?;j=PyozYwIalR&X z|6(evLt07A2S)2l#f{;wy4zs0xdhW14$1P!N3R_qSN)_A|5G?FbY3RCWj4?z^l63? z?k_BSS)0U6?&i@W0ac~6MiVpb;;7$M^3l!XI0OAyM52`MSmwLzh`wW_b z-&^;i-fAfx8oIrg?SafX%riFI_mMqoary_kNl3)Xm?AwG z*WsNCdl2oc6skt4k%6)aDR|*jB=t+lSOmd9bk-fL7JSy%x0`12qfG zF<*usbL>i1@-nZ-h*l3KRKBhEu7vlG8)rVj=_jCC9XKL+H_jz9(YE*T_-#HFG1j+4 z8xS$pVh78~9P36tB={!)6nneyztG^Iwp9LC-__+9O&A#~BS;mRtmHfI^yhrJ{#A8$ zLU_R_c*0h_TIhjs0NyY#dVU;xcNB=lsl-?+Xe}p7Us^N|r^JP9{h+_~dkT38gl1m( z+b4J3<*pC`w9xP!4sW1`U{0FR5RnIrjh+<#Mf=HoQ|1;n8J9DwQDDZt{WBF?OPxy- z4XMy4meQ!+vG~ET{V5e9PG~fWA-@!6RP(Cb!PnbfeCkh3vziH&9;q@-JvAoVkf`;O z^sWF|tZcHp|4 zCT4&)DcmB}@tVXCg^ZiHnaN=?^!C;u6|Z8TfK15K+JgxhJ?+(PWgTsABcoy43kgIo zo8Mw@RKhw}v{w&YB@HQU2NH=$g9E9Q##MGo#`~PoqV@~J3jvtf1ghQN-7+6b3`^81 z14J@UEywl&SUw!ANH4Jnx0*kzUa&|TO4=L`ImkoYA&K9kMVcouEtV73S=c%m!jl{D z2m=lLo^bxKdTl?}bW|?y^>7vuHw4T(S~7m#R#|!&SngkcfEAR@ps~KxU}{ciZ8Y3` z48vTiwMomW2_L{w2c#-^L*~4W|HJ^9q>oZ;Wcpcjx#8zwfXJbIop)t4i!5c4W%Om# zMB+sGq=NE_e}tQ(pzYp>_7y`4VkKe0FZ=<=6UN%+$3FS#;OCfUAf-?>iM#cXXI znvC80y_iyZgZIvj;cv1Ifp#Ei8q>V=EBBxO+?CN?Ot(AD&8>(-vXCdCn}0D#2 za&mL?&9zKCM|8<8B=D z`cs=Zn3;hW6I3@mn2T9UwF5MFtMekCAy4W%^5dqn5xT5AUn4s#$m+f@)b{d+@0FV_F^fVYh5@bcA~pONjveg0$WqAI);uCrnl(#DS_N9rIS9 zRZ{Q2-U>x}YjH18rtPk@vf`DRROA!IY)_xhMg^+#XOd<#z+>QXf*?sDVELJQEdEoj z;#)YmAd84a-=MJ@v{wXI&Z$@+6b)r8k=MKI`|Dr23THzb9QGNM8PO%4&3B@j=^6n> zP;BiQSFai65CQM^t!_+iukl@lr#HBIc#jRa_B)J=KB=*t_=T(`sexaajZHE``M74bxW6H=6OpU`daGoI!oM4KPg2;nEqGDF%;? zogj8wl6e)SR~oFNk%pO~Eh7%>hta0QdCj>E?L1tw!yGc3TORq0GP>EI^mMu^)F%@H zY%vEFX1JeLNA7|GHCsyuW??E)Q`Id|XCZGidCfxcUZ%!XDMZa}E_2hSX6*-4c5wkq zDBn!tU-iGF)Nb&9Igd5lQbZ`_etE4duq(MYinMnkZt85B}6hR6K+w`~XELGg~;=`5qb4yI=C6HT?lq@y}aFF;}hvnmqY#74O`c||| z=(B#y4OQM;t@tvO7kH0XtQ7KwgFTBC`So@qOeO92zq|pD;no`VSzUn};YL;CFC>#I zaks6wpFy4|@0id2Rdu#9YRT!O(l3bzi8Jm1|KQ(QA^^9Yly_kRE$NS=Bsw6z$(+DY zR`!jwXwfo_W1J)PLg2-U?3n#6*ng*$GR$B91SX7~6`bo;nwXVz85#}HDATGan8COD zvQa`2EW+$S!?Zg2z#`qcA8kdG;*7ULj-ghf=cuT=@4n&T!mq~DSKdqu7pU~2U$dk@ zWl*J`SB@_91i`Bvfwnt3Y-*;6>beq*^+DZ~6HT6Mz}c?kl6t-2F;|#3C{nzLHNhn_iKxIayVm!t zqBNT3W&LZZ*`MUAX9?1K69(hRblSmX9RZxdG_drcOW_nn7_tirvyUmqPab{Of2|>VvGz?jxAfbOR+-k+nXdl9@8f&brVFI zc&`cMrpj{QRVmMz6BjAx$SgSDOB2fII7s^ETU*~>(7fPd0%tne3984?)1nNPOQunw zh%02rPS&w`AiI-@qH0y3@Oa^H+Fl(H~F&cOO;K)l~&Z_+K{q8o&toVLShpOG%(oGFtf%bwA_w zc!<|~L-Gv+9z*JwSRgHHL7A`uqF=3GjRzHPlAislCL-S@IWXh`f8dxe#+SAkZHR|T z2YeORYmPg}BHa9ebQ*`Gq<;M20 z)d4AuJP4_!ihvFO-gOuiTd!>DiKsm&+slxA~+!kqMFf$?$&x-F3`dje|_BG(wOw zQT83FSSSd?zy}a^MZ<|=WZ8k< zVJon<5iOOpJzFv#wkoFXxe~=g+j5pi~lXa3sa@E@3y4Y+Wr^#mx`aAYp~iz zwqolfL|}=ldh-~to;^Dpr1l2!gQZd{67mA)ze8j)oIN?Agyh8VPNq zJlW)~oU}ueA?%*BWr2j>@4`z+4R2aN3_5Hb{z=idr%lpGo?#flKe=%MzKo-xhfgx% z)a9b7@A%XgwF4`iT1YdVI32G(Y2$NXmZZbM3h&0nm1W1@5M?djc|^%!qy20LBTd0( z6~_gW)ElDPsr8DK^APfp)GWxbZYCcO_oi1Z720~7=5vC;Su#-^V@(YYGuIp3SS6(u zGX~$f4wDy)IIy&|^_;VzJ4Cmlup~l`fq;W*KODSN9CX zm~fD(DejkX>$Ik`QQMa0l@$~Bz@7CuD66Y?Q$vtU)B3Cp6G9FGS`LAUIsO-W?<0EW*~kc+Qsza2WL<`%;U zWS=<}=|xuooQ-PPpG1|K$fudZ`Pdp$og3c2%CWU66=LKdQ2_Mv%-pS9n=st1v>d^V;?;ztslAv1AFwH*NaP z1Kj4Cc=@{4)$@c*b}GxME1#n_SkVHa?d?Vjb2nMBFhulFor#|bIWMoFj=RqfU^cg` zHwwza%kT{bv0Sy17~cluQ5_GF8He~%K~T$5SeY}hIV4&ytq;XX@VlO__mk8`kMs@k z*&w0QJS}eL>s)j2bzXyJ*gHukSiZiv6lLS)mZFEwWBS5pItE`ivqo2_I3}fWwR8Q< z@oFN1ReSD;ZJL2nd05u%@=@sp2%cJGTNbVpt-=V75q87Al7cN|qtv$L+eoh&AL|h@ zI<>y|{3rCEKvhcNp?Fg9t|Ri~CY*}No){p)6?8i~iao?UF>e4D&U^54QoMze61Jsu zZ}Pb*?+l);cm?P|tHUPoG2o7{D)cU8hJuEz3xLk}UMDq7#KYHU9SWaVZp^y@zY|C% zD8*<)0PM6~0j(^{v3*x9BBaW+=&O%swyjfgBRR8Np{T$_i z%d#y$-q;i$Q#L5EU2AUF`Z(;QV3K^yt~k>Fmg8Da!k~b7I=%;lB29 zb?zA4m7BhqWG*u|2~L;y5*oIuIGdI~20A^!!*!eY@9X^{wmOzH@QQnlR`?`9lcLs` zRWCOze)E!E8pNHG=cbHm73s8UTrXNBcY8jxxAT(zKXEN%z2-#`8A==Gai-fw+qW8cF_JrjoarA9E#`@w zRyIES7^`X3AhYF6iyo(@ESKH$pMyFyo`1(yg2&TdYMh{>s+-%%^RwEmyickjjZ-o)XuMKT6glJT#1^h|E+`N^VtMuTJEB!z^x-K_@%1FK zOFLV5B|mKpB>9`ABOJT$d}>3pysz>g6!iI47qG2tApOr0>3j1`LZh|O>lYcpD>x*( z&Bq*tg@;IP%rG`RT(eG6XaiVoGv=Qk^0pORh&zeOE>(k)&d*X*sgIR*obC@WT2)~c zfK=U+(-!JM1JQ0Lv?aM|FcXPTt?RbWG^Rb4vD1DrJ>SV&Y(SX@=%W4oK0noufq7BA zKDs;=5h;S?5t##G?`f|m{n%x-yG5!|qnXzu<%o=hnV{GbGCnJa$oXxh5(XYIgSKU3 z3$97tOE=}f>bQXOPv#Y3uHShp7Iv=AZUQ)n0~FFV!S%rfLo7Y1|I9#F zizI5_;rQcQbM$%rLzn0I1{+!SKnIVHhv+6ZraX+KlvIo6f+&4A1VF~6Ov%j0asZ;r z{0bJ(bZd+(h)tR?mWpS7gQX$B}iL`)qfyEN{MuC(cZZmJ4$`X0^J-1Lu<(YP!7lPsc|o1eNXSg z?#84#jn5;UB`k8i)f{W?IfDAn&sglZqKaG=!5T`= zG!J^r8=TG_=LHAB4Iz-jI0W4Cd5qi=^VsE}etY+d-E-JGb9RuZBdzEmmdRVPrq!Rj z&+o`q^v04TrW#v4GpgS?1MO2WL8e{2V#ar&p~<=`ulH)k^a1(lY^&_Z7q0-hNev&r zCoO2taF|_zPgFn^^1ls5hW3HSGM@38n@1-|v_fm5saEo)#T-$AKvmhn&=!}G{I9U= z2fB5W-{?4K)*KV&;Y6nvAL7@+!H^RHO}l4_#z^4uIMEn=8*p^!78S{|N4%`maFAWnicsGdk4V?aXzH+?xr~CtOQ+ORt z>(&51(ty)hW?BVT@47nJ-6ottnq^XwBrXi|346gi^T&t2fcdN@zPNUl8qD3qnZ zrEV*Zu-a-y?fP?u`*-zCv*Olu*NDIeLi)om)Fm=ZtgtQg>hLgtM>5P`q}O*N9x9XW!(Xa9YM`F z`dF6v5v}sz!)m1aO^sp)gu%gA@|hRK+hSnD^Hi9OR=^=fAPuz;chqG+m`nSPzG#MZ zd4#HJVa~DPo2p69rn*q>*{Y?FvPs4d1KM42nN~YiM}6rAseedvuEV5s}0q zPKlmMuJ4tHbN`-+k*|BlBLj#;S08IT4m(2hj8@loOZe?wuF~&-^>9)uYvH?9u*?Kz zd}#92wb6ZEjYc;zN(}np0cm2wccm30=n_I)kmlVX!qkRZk@p4=U$#Kyf->MgaBloRcO`c`P|oclT41R!PYJ*^a`CxoXP^okrgykRj58LY{+191oo{%zOVO zVoiY)>HNL9lmM8-8mqZtb0qiMZP!hPfyG-pOj!8$3(;cU#gwaJhO8xa>(7V(EL~Sk zwC>P{aDX=GC%kzs-3^0W%y>K+XQ*J`xd`s*dK1jVU&W0?!rN3!Y0S4KuM^5C1Mw=V z*#fZ-s6SRY{^thZWr&U_*!nU;8|;Swr*WV==BMn+qxAQ4BH$K)<&ChIyWn)y4UMqL zf;v3 z>h9?TSNK!O(;`Sz?2Ba$*LAbymG&OK+4tLzJODeb*%W3K_$R`He<=i`<=J^jyqQ8F7%V;LPh?l1#l9A|ijcMIj`B2Ds~ zIwEXuCoG*4oC=zWCi?N=W3MeD1=TAF7UHsO*z*WC1fk{1_FI1ltcOIUX~f!$hQfQ< zas;m9_AZz{*MFoe1aL&q*|s|jpn(m>jH5luweq=l%_x=x5tOym>H%XmlHQjQrHx8x zXAgU$oPMNFMpmYg$KQ1pRPrJZ;h*l~w&rjmJXBa!@x@F-g{vpVPPJGDCsp%3r_bC~ z*!F;9m&Oa#WUZ1LJ!5@MB)Pi!;ia(mhwIboM)2=J8|K}$PSA{!(6(*FBuaqESq_0W z9C#PMV5+sH#icGuo=?(%BBY}G6sSNGSgG1cc@C5VADX>(lUjj>DJgVNCc4*^zb3-) zf#-St#d#W3{tUazk+i?VF}uqe@IAXW#+6$>y=?{@QV+a@lIV~yyw#_elknCkD)xD0 zD}Kz7jwqg11cv+yf-cb!TzK;)!^0!f%V_YK@TEIkQNlC0-)=$zk24Oy$h$e~W$Y|6 z8+zaSN2;lV=dljGZ@OIZH^Dd`sFfM`3Qdiye`wlF1X!xlM+|EIBe`&(%ZC^57GXhGCF%HX?>D5~M%2TStUM^!j2SC&7Vmqsw;BhW zKQxzA&R`g)Bh>?c8IEEk;QefjY5hi)Kq=gX8CX0y7nQe@2U>8e0Y)~B*Xl~{fj+A2 z$>LrNriT=2<&hCS;b;KSkqt7opBKt{?qKb=NW#?;Mpf_Ksrpy`+dYDRA6IFQ{l$Pg z*+9)gpGit zQ(RugPg)V7@45H%FpahqtyU)X#=<@ANUys|W^}L&+1XN@hx1)t;Y8E(Db4vRN~S(6 zmgI-=0?=FLc|4ei?Tk^eQ|)j(qS1MIiLTK`qkYUDl@LsuS_35xc8$=dY#jHI`mL%X zE^DjE0YuZ#Kb0J3R^}IvCP%rdGml7KQZqcpT+u z=iu-;#r!gFv#85=E~>S!rWf?y%aBA-M#pvko&ao227WKQ_Vgu_sPt6)blJ|@wx-`} zn9it#c{MozCDA*p>Eq_r)w@#niEQfK++JE@a^g)+J@v6q!sBzZpuLMJmo4NBSYto{ zcNrhkQ>8IgVav(x$)>#IAll+XczzX`+2ldpb#2cFu*26M+_+MBMDec(P#UZI=KAMHlefR-B(LEBo-lG5MP^7=%NeWritN(uNqnA4`LpdS~N->3(x+w>hg?aT#o2@vyl;a zJC#uZ&Qg7~{Q^3a)xLy7_=_(;-DE2Sh9muR5|}Wx-<_^!GDT@;frDK@S!Cq z8WxuAY4$lHw~qg?&zmX3&p}ZO4)YS+T|ZtDi+95nh(TnjEdG3cQ58AON1a0FeEcR- zN~Ra0n26wsb&X&XWzvr)&UDBs084<&}-H}M1F9;wz6X3fYnx0x$!d!`8|JIR(KDxaLM z3JI;MQ)stLkszP zfTx^jJ2;S{#GmdhCxC61o4NFtV6U=gJmxvb$!0;zzZ%V{cs|uqRo55Uao@rtPb@}U z4$hkWUT8pdZl`-lxqW-ubiW|Z}2hB$b0;uw_HOiVm`ImP|5Z@%ggz$2;Vk+ zi5Zcvq$(~juMvuErVMKX*sUquOh-z}M8K_;amR`gKY3@i$p5&jyu)L>o}=vAN~dJ>{NqkkfX6R zndCTIPIA8Fb(e=&^)Z>Cb`;nPZ6tYN37Mi3tgTs`hu-ekq{XFYV2blYUp(mlb1PPc zlT$pn^gtx4Cg5d{-^G{8Y4WAD#68(t{OtqS03rM8U{u^*-NZ^0SWF7;5H_EP#33fz zIPK&7az5ptkDxWECIvkf@ZC|e61%@ta%#=~uincYeX51v4=%^B5OBIY?EBB(3E~50 zdv+JfEfg+xxb(}I5M%eF*iacoUnAScq+bi&3{d#u$UrEiOO?0zJMEkG8mvNc7Z#ht zTo9>(-Z44}`Q1XBG*axvcs_M@n!MsGq}-=5@2E)}h2YPZ$TqZSS-f~d%xci@xOWCZ zh7P^RbMLjD3U#^ZtP}KuEvECMb7~42``!L~#-@{89$(Jhmzh?(YR*frgLgBe^S$a0aQe&a{Ja)JCzoup@P1bt5;gB2U-qnrU9npu@ z5IMPX$w~*Ts_ZiNCw2r575CR1)qRV>Cjw97NT|4NaB4juKAQ=7$w^;Jpu?L#POw&i z_`~+J))*S_LQ)QktEcnnv3pE{L`lQpcXMRw2+iPT)zdKN!*)UxhoN{^ZHq%cB2!D>Fq(_C<4|(XTQM| zKN^3iHLi>B>M@HqWrel(=Wsd5VR)joTJu91*QJ;2DSZ|$7e6)*d2AbDwDiEpxYa&}xMw{y- zPUN2m{OW<&7Jpk-08QPG?$0y{n9%6xI278;>v$mmorsrp4Al-AHl0b;Z= z`&wVDcK2vrHieX*n|uLgX{!Ye zx|8>%QzPY*Iodx#>*}6ljmA7(pQ)!=W-`xoCW?zFM_4>)-vicM&o&dELX=1z<{ATb zs}pE6@qCjxw`HW93s*c9MTZs@oKY1|hSs0gEh1*Wo}lGA4;J|M#YqUoKc=X@4w(t! z(tCRC&w7s9cN{(cEf2?=LFyQ&CRp=di>D=1u%w#Q?)6o%Q8BVTdpv_~Yu+PwbI*(s z8Uh@Wc1B)+mHQvo7hx76T(J9dAN1`uq|a zkVk)rLq-M)k3eg#0fx%LDl!Qi0~jX&ir_1NpC3S8Mg|5PvH;*|*gXI@r#FxW>`TnX ze~_F%(~lldgYb9o$9+g}Zb86lc>G-gi0K(rkQbl)cYf~6U;zMmbA*0G7(hUjW>=X& zEh+#tR9fKxC(w?C~K~m~eg{;C_dIg^6|ANcN%Vlen1%a;B_KABmRUA&w#(;15j|`oZnPH@_yiBldA&&z<~pJ z7WnNx`7{0h$THF|t#)<@!}#{=dAfhofY*@Vf;b(H@9+3Vo8ElGZa~709)54o2$vAR z_Yc3O?)Oe#;HR*U@6H0%ecoX=gpk_c7$`vi9053v9?b^1@PvTXf9$Cp|LNBsHpy=r z#J7Fo+aLMu9_uH4`um@E-k)5}HE5v4MkgOjzrHirJ%fc!K|r`B@I1gb9vgx-eE(e_ zaO9G8K-w|PJj z?eW3=?>cM&905E8#(((9kGT&%j)%uzSY`*XE&kwNHQ{r52oTqIZ&>)wpNatST@n3} z`IIC7%vOK4D;}57GQdGtkoP%>(SHo#{&arI6H`MzfWJCEgGK;!eu%r_Q|}JABk!QV zf8q815%0e(tIaRZ0AE1Uo*kZ^9{})wfA2rmrXTEBq~*NR2k!V6-kUEUC+hyJAl!Y6+ke;ptM3H0N5=4MD{^oR#Zxv2-5(z)CW)fT&JL*ZQa+cnJt`Q-$~ zSgW|%cr7$)md?sg*GH_q{j1sn?fu(ygAItI z#;Q?y4aPWEef$LtA!cOL*3At})m7%IPQec*&AR=-)_>WwAp>0mAt4XbvH$r}HGH|v zM~=iuina%@aL$jXADGgAWdnimJK^U&SIan@59=~Wt;d3OZ5K*Bh-`S|u&?gt>bpdG z?R@XQ!(D&%BK@%&n}5E`H<% zJX4kIZzRy_e=@t$ZJx{-Q6!Z7-jmKA1peLJajm6#J#7UTmBUHxo;e|k_m+{<=E^N3 z0?zXWAkqN{NCP6r=^5TFqW-T_!g_UDdx_#+U3RqrZN-bGWUu3QrMsFUtQIQq#nBvj z@7DRM{P(m@{riM-AKbmCmq4OjN4I%U(K#q5oK1sAb5$XVuSw1%8>V&oSGhJe1(Kg)by9{iozbpHoX=0$Uz+Glora@2A zy59s@@wV-iHOLgtdpZdfQG7|mDB#JNeMJPQI)jWa_?}Lf{1qP5v~juuy3z}__$J~2 z%bSr2ENpr1;;qD*6Qk)uBeAm;bkT)-(ph$0cgG7yNO#;|jm3N=D6LlM!cm({ z%zshO!AIUprA}v(^w3WKog&laSNTT&9iH%N`;l8HZA`KdhYn2{5Cs>(^kSh*171%Z zLS6nUUj8xVlK!8g%OqrxkSdz<(dBb^xU^=A*-418ma5QHTp9kg-^&+T{m>^530LVHHCejPT;t%EQK|gQMP}!F zJg9z$R(oH-!C4g?&sMkQmOVgL!um$wPE5>-=@({yt^d>5R{+(~b=e}pA-Ma+or^oc z-95N-ak;o_aCZ&v9^8U^a0_n1-7O5?$g98JOw~+PSJ#of`<#|j-Mee;wc2Hk-MD=C z@6KrlaJ!&3SrYyn4dO_^cb|=53wR~x07StnG&}CMbf4HVbdfOBo39Cs4@~M?Z z<}RTn#>=hZ{Qh2RMvi@V&{Z-hL`>Ic0KZ!oylqY5CPf0Fyy-p3)>7(02!$B)7HpV; zwHRkUI!%g%*j#>D#0f39*Aj5|5B=QCQbWrKSOl#a0S;LOoNKu2qbgHd{ z?lV*x17l5q$Pm}y!e)}PYPZ*kexqc@GEtE#p3|?;l`g?$Pv3K;pi&9M#c@qEG`}}9 zUzVKTM#q&ei>O?EQlFe_>A{)83$3D+`}I0(MY*!P(Uq}?1lw*D534mFECQ5zyXQ%H z4?9_pUSudxtCzJ_3Mm%QOt`_e#kf^AzwR4Q-v zfq8_#e$-`WpUGh@JX*Qw4ArzV3N5shfVh3&8fmrks|h3q*=Y*~a_x)ZzhNhhQW%2n zSLCiX8hF$zV+Or+Byn(C4>B&j1EyN;Jz*{i2CxbznsVt890bxH2U;`7%k(Rg^~m|z zDEOJg=oOMv48HpHdnA0TibJU1KTe(NvG={F;Id{ja7X%F0 zybIHpS!%6Wov(0&83{9A(YcMP;#36*%WJCan@)eCmK4eV(q6yu&Dbl_=3y`o=w7Zf zWMN-1sa=zY+pvbq93M%|YFC!^L}->;Ro*GuVzxAT*rug`e&)qnIroN>FjG9Vh3vq?wwpJovWKn6 z4}EEQPy4O7VXo1D$&7tuwOv{w;a8ug*1WTZJ-T~8EMbM~8=POO7Lef*g(LV-L zLC;U5^le(d08wk0vo_72{((BP!(;knr^lGL#QrltG{6bQ)?TGJu8(-N;2oX08@Wg}fU%CYF@kf>CJa_OJJsT){166j?Xj?Tf2d zmy>Zi%P_m8Cfk0D713RW2%|zu@lKjmrN1aF=q<8usSBx}{s<0lDHtQ2X^8fZ!H=pZ zi;M1pOY}Qz4M*h6X7~edebBY(X(M8H6FBMNk+9NJ>5ox&(28E1NM$Y%v|t3|bAAuEUA=>v$Y z?(20OV2iIfM_NrXcpo8Zd;-4#$;bMrpq_j1%F_hR#t$P28*8oZmTk`I8` z%nUsrHmE_c+B%;fZ@8HoCPsImpLa)IQNC%AywwM~Xsf)JAJ1O){@@@8C-5G@u4|=l zH$$TU-a&Q6nGP~XiBxUO&ik~00(CSKzkUiZh5oS67kxU?XbQvm&3YpcTVFi;d`#R`dmRZh`25+-BRI~aClX=Jib+%c z#)0~wGh&{&ggp!UXzeDnE|&Hq5xlvHFvo*;U1Vgi9Jk&RKMu37>XvJPB$_sB*1w)q z==|^BZzzxa$RQANTqlR_gvNEAjF~4?-_nauEu}0L92ncACgGStupzzp%pR7Wxpbk% zuIq~C3J<8SXlgH`=nq4;klLGc*-J_yE*9rc7f^WN@F>!!Mtx6qxFD7p$Asc9s4?BunSE=4mWI5NCAbk3%hroj=l5>V?8H;*LOSjBvPY5uReAFX zcC*w8DiE546pGIe>ij~=Gis{k2@3JtyscEV;YO_h#qkf;o_&?mgxDH~Ve(8*nw4aK zT!E)hYh#QMqF;ApX5p7su?vuiXp2F8T}X%9wZgd7@pU^Xyzli~*S4QPxjv_k$a`b( zAOcgtouq8u!?2wu5KSsD`KHUz*qm|t5ayQ)0fkDG zgi=(v?-u&pgDD|Zt`C70oDDj&?~P4*f$*Jv^*5lpNP z?&{;FvskGPWD0Egn{%0&rF%t@M9@z#1<}~RXz$>~n#+GDJC>bvtlzVBon;*}Pd*Vj z{ZgyLVZ5!y!`>L5h~|j#LPN0Kw7EWFlz=J*E0D&N)=ccnX@? zv9$aGYkxMta7!tH0I$`vN!Yo6&#BrSDSZA3)5z^%xmZmoP2^mr;r^{i>P>a0%fwoi zZ7Ryu+<-x0NLNGWgdjdGP79$`=MYa&j47W?l^EQE%fzOt!+`@@eQSbH)YWkLOiM?vcH@l5q!O#k}rX!SOG~dr~V?*A{@>p+yEfh{-*7pZF!G zOeQN%o8C;B$F@J;qmE?hYPRn}g<)*1gdb~2gBU3rD#rH?L@{!lV<{=vFmzX^I|C4w z-LX4B=0AYQnmBADr3JZBNV?=&XUblj;ujioqQj{5XE;w|anFdJ&2TP>J!8#{I<1D0 zVh4`?p;02Wwjg^r=u|daq46$gdS2i6p=c`qw8EAHk3UxPgx^1%#wvl2C?leazpKXG z+6}g|+W1bxv&5^n7#j68xASl19ddu9vDZHM)nh$6p#+lF>s##*d;#*{tA9PWYOvZ2=^*E8<1f{ z>N9JGJDo(L`*x+QZMZqj()b}fh6dK8SW`1WZdXJbPTDZ=e@=AmPeKSR%u!Odk+W-> zFx-k3YWn(;@`of)Hg-{%(@l+!<_l$SZ)HksfAb^bmDat>Jns{W$Xtu!KKSnVCZN1h zeSg~u`fgo_?pFsmo}l~}@|oN|DlGE@q&P@aRv53p5${Wunp7RCRT2WA#52y|=KFST zV?^3*Q%!j%js6dOjhUN-okqWw)vSg}XZ;V~AXhI^K?d{5wm{QAk9 z`c49o@=)g{hk&Y$QhvS0MT9fa9r@Em6R`G6nW8;fXcIQc52x9C*WaDG`RD{u)!Yle zowwj+@buJ|Ly+)==}k4u%Mvn6%UNE&m(@GaEW`RHC05^fE!JZo1#)`EeEEWMX)gg2 zoI5C($=UY8724j1iH9-qs7Cbu=9{81gOxV>R@GhD~?in@K< zO|b}jW=goC*qXefxFq~8*(F{rAEakCq=!v_9+4QZTwK2HgSK!EH3q7H)uFun`5VIv zkwLLIt{#T`AC(R*m_?rYV~I6avh4YkY8*-0T^3^W;ot0z=gWx+cp2`0uktt|@_*2n z?&d}w(iu)rQHQNToStUrJdy0+M9bLWam@DxsfvR>NKnU9g5XWl$V@5m zyV~sAj^pTG(sjw{T;gAaRJVn#rXAsTQ}Z%9(MyX1d%W-KL_ zf|6iNqW>f>UZIok8#Z9U_Qww2B6;ucdgq&odM`x|@h+aIc(Fntd-Tx%ynYhgIp63&!|- zQ>((T(5=?H*}7?8wL3n#4zdH?Q+u>&uMnDHq^T6<=E~~)tS{8 z*}HHQq|2yjhY9xu17~!^O!gAHI4OoV@jZMni)pibpXD3r(?wp^m#nczY+|&sNe7L3 zy)L?Slisax=pbObr7H*PpIzgmSkbt2!JeGhgOFA|Tv)DuJeFCZZW8pKZrXVA56<_vh5;O)e;-r9LqRVM8uyE)&8~IGqtAUE8EuN?TcKpCd zElEA-;fmd$x&zl)4B}eNra4h3!}C^L2Jjd!Sc^q+<#sd8Olw_D<@y{;bH)W1`hZ;` zS64ct=~a%g>PRsBXS&eW0EFL44BwL10upYjF%V)`AWmnMp8$Kn6bQUPIoduuh>!f!1DbQgUI zxAyMI{8O;P!#8@G-?dnjj27RO+j>GjuJ?yw*V4~%< z4x^$y_E^G}FCplaih(x1nz=ca1F_{x`F-5)Ywgy%-B`WN0*_e22cFr*yacdvE&@L_ zVfEfQY7G|hmXTr;572p$IW7X5E#4TW$HUlN_d`ZT)PnAMTDqJ}Of5sv>K4Y6X9 zl{PC@2YNKe{2Qxr{qvyLn1dy4ZUZHaC6 zmRM|eV%5Bm()7yLRw(5xFmTZ96dXF*Ley2LMmn1@Kw@+gHCuR2YxFmU;h?T~0t%FZS@n63Tq+vw+9! z$E;Xfk0CRouuSRB)S(GgDzI6mg#n$s7K@Xw5u<7R;;wFkaoZnm_J&#$1wY} zI{Z_j$nKTX6Ecjn_9;7CI6F?|J?;2Rj(aZ8myso#Xt%MG)R5Pou3S z+DJ{$+Tnob?@$_^6GPtqBRTee~=JXCn2| zlQ}Ep4E=B0lFIK`SS=MlX!o(tLWXQEnsTyrn?6XZuWoWP?a{Gv&k65AgKFR@fwJo# zIehMkoDyQ<}B&6u3!jo6dwT^nRDO;urJe zNj88<4XzEIJ29bKDP(=I+H2w@d30h^O=pJ+!Kj~E+lyf69O&w&@!ssQJZSvdiT{J| zz?)RU{`hD^kVUOt?`Ny5kJi;Q=hCGO%P)$j<`d26g`c6tA;jnWf~z8I90n(u+D`Us z?h&PlF_W?6en#Qq85F@G<`vGSulz(Qk!b*^jQl{;=r1)+InN=?eIoXe$~^$0p{2g+ z1ST1lh;A>Nu@RJ=yRvev*u8Y)PH~z^%VB^IoDG*Bg1epNp8+E;8$C`1#Ep(HBtS`=BVR0BM3WaG869gDqQ@9>W44k3E-0l1 z@wrBh+8G%~bPwn3a6c#_foKAGh$SH!_YX1`Yi|v|f*iWnqr?Wj4qCLG?}*;|68C#0 zjbvg|N7q+`3Vb`))9J;6a1oG#hMbWfcyruj1~KtLb%B$$Viv#D!7@(z-6H|(S7|`I zLtP|kG_^Fjlw6q};GEb(mWX~1vi4}0PkiP6S%N$lG`ct6%FmlCzYA&I@Upd9n+e5o zy_!HSrZiWxfxe-A2mkr)JK&Dk^$i5Jx9Ge-Lq)k$lKj(c=dgKecz5ov`;f$Nw;D-c zsy?y4h+Q+x)3Eg%q^kWha~c)i@giJL?^CSvT)|Uot1k1yASt2WNX(*SUwiQ|B(tvp z^3Tlvm3*XXbc~tf2N%LV#+t<#V+pB-H~1e3hA$H#mZ%BvI1H#&(W~lOBk6csUW)4m zcMO9P&W;VDE0^-(Jm&y8C0mKZSO|{qGD&-_r^L-fj?i&t#hDc-RL}V#{qJ!-X&2Pc0Wf5Wf`{vOckqnv53l+Yt*{XT3?b#nag< zRvDzD`AX8$@YxzjD)MmP%$3ImuekC?w?)MdG+iYyNeAPb1CRdx>GYdbD?DEk{S8a9 zvxL~?4S?)VmhRYeGX+Q0U8#wU<(c9UtwQZAjf%+7680O4Cm3<{C8p1QRVKuLb;jHa zlG?3z+gU*qfttsI$(uj-GRU?+F`WsCnFU( z!TH$rMEHzo983Yh75UbZvw1PhFp>eaRw1j76by4b9KkwGAmB<4G>}4FN0h#v2slBK zUYEL1(Iz{Cm%HV=P9_)JlMXj3V{mU;SsmGVCi5Nk*1)rDmlQysxCiNM+MKy;EFuOC zWz39}Z(?gR&FnpQaz_hxgv9vy$>?`j$?&KQy#Q&6rc`QjcSQ z#rAGg_r{w@@$-A*d0OneKSV^yyygFdnBe#q#Du!1qd6Iil8Ln%*bb3JkqpTC0hN#h zIlF+#c)0(c8V?y8FAwj(EAaeZpb}qKoe8-yd=Ip?W_~B*1oJDW$flSNe@G-^Fw|GO zJ_Qy?VsK;8-R$tZ+`H;F9}XiNhRVuW#Qa6P1zxlw?d4XplPihP={aBeC=*$+yLDxZ%Ok(U7RpBU`Z7 zn5K5@B78##(gD6Tb0OM)*x^2fwMq{@?&3v z!>n*hD->1{rTGn_(LnYkoh4s^d3U0xG&lx$536Cq#f5)zk_B-K*r?;C<5*muwO~G< zzF)QSg%a+c6x5;$~2ub z@oFSzI~C&B^`*X0@-5FsJSr3=EX_j2e0F5FNz;X&mOm^!dTVs^b0H-4m483S8syKP zYMC4Kxp(wzv_de*by)4-?)IX-)#pge>>WM>`)=5eLO;jn&Pd$?-*ScWm5$h-v%9~u z95Fm&zGZZm9NcO>6Z(p6&LHs>r-3CcD+jG3{5RJXj6ExJH zi32NegXjE$f+t_u*BO1{nbtRIR#WZYwP%Rm#NWT?9p&BnpLw}rc=)hMT@$#@#xEsZ zbia5L=nHsyT~$pVx_UPf&Ww-}i%>Ab5#VQmik6irO5&`{7QO%$qUCO(-|Fe-Ru#+M zUx~|qPc;tSo?G7yU)xl=^(@{iq+a$i zaHgLi$KGVItgL*xhW+_xX^AO0qlxf3S4>}iq0AF)_t;q^t)pYytt(@b@o2%iKD`FW z_DxkoBiH`*Wb#7fKv^H%jWOVR`BF_K4vTes3qx(qG~ZDN0A6ARTdQnI!J8Y^J<6>y z|7>_2EaI?uhGjgX;J<)^_c3wKP`^pUJg?~6 zcS!Yw_wi=ge|-;|=8j|jm6zjtbGSc#P?dot7=TX{87!1h%dKl@|7evyjXU@FGd*Lv z<)-rN43-qVW<$+%JFn;IF72R)?Da{4vy-9!#eVtQ!K6^T{bQPx|I7L7WK`qw5{uUO zn~eTXqpFa=xMfHrQB=q9x)z80bKR$LPkj74Djt=fT`^nhk%U+JWl2fB2!%Kk7ux^@ zUldz^SJkvf+X$tKs?IYAvKM{`|J;oqgxM37Il@OY9tQ4~LQyHNyRT!UMa@X3{$U}N zGuze@otciV>v#Ra5#-QDKBRD)iJVvTy9=QVTJHj3;Xv`948`F~@oDN;ynDPjVni|d zg{Z_n&v{Y)+ekgs1@(tXwkERxgQgmuCs2#NQGl(9Nc=K$H%Yr;-ntrm@7e}9)+u1A zex4M=-c;)T>5^Kgc2#NJVbXX(+@`yQi@EV$SQl<_NWCgXVbOY?58%Dvx8WvS$k1(e zJvih8;=a`wUO4pyu^-EscZ(0EDZW|*kE2k0L0UH{%bHTlv5TD5>L$9_wsM@}1z|KU zP&nfeDC0-!X(EZpkufj{8ORmX!Ln@9Y7f}eHUs10okUEw3Akxvi5JFUd)}$0*9FKK zx9FilzVUbssWsBi@ER?j(afv=N&pP%>cKjibZko8P*F!?dNu}O^3Ru|q^T)fwJ8)z z&yGOr98TC;PFSS@cCCL7F0Bp7Ee9TFRvn9PPz!ue>D_1-*A?L~{4N^(T~uB?j&T)J zt_v4lwTPzx5c2a`oHJjv=$22lPvVq(2f7!jK0CyJOBd!sYD2{k<@1G4=S`~GFXJSI zVis~KU`g=dbT!OzC5~|QKJl|(EKkCBRai9hP7iE{zmYDk`zvrw?$UHGA}ZZ)6M%VD zLbh=^(Vki(GeD@*^4V;KV1Zi2E)%%dKI$_XT?Nk=zW~RlYAH|S3$B?Gl18Ru2yiX< zdeiP2fY*H}dm`S{V0uI^c)Ng!Key2D&>}Ql57wBK8l8#H_}X5QDr;R%VGU!WQHhli zo>mw`-mq6anW!Z&_tj#wlFdw24#)aV#DryWHbsWX_+$~Xph_cBdH{(xl{qb=R$v{T zv4mm2Y!Prof#~~81~jYY@tpm3@-Z~6bt$}(`pry4Zv!7DpWHteedx>Z?7j@C=3#$B zaMZ$B0+nxi)yEa=)Ffn7naoT8>ub^q2)Agv*g2q$+)!R&3RUE;(??)>SOEh;ZsTd6c*89hzX-X@whH)7TfeXCFBMZmut?;I5o4_ zAXZ!#Ub%WiqbX-#l1l|RjO>JpKN}-9?kd^B1K4+WIbY^0Q1ql9eKDbm`c3SN0Wi5| zLTUN508!*wHLRFpD{!|5mwS6Ta@0e4EKq!Or$fSerXIk>|aNuS0qK zO)MoGg+nD`_j%OUsJo}!bJ~7KAN+qD4Kw;jLxLOaNsi0NXRmpB+rJzE^qZIQ|)5G4kr96hEr@CEi(V z>}MFfDF-uIY@Jy47)vWXtzW~Y+P6;xA%v>?I#yu-FN{oMpDB?t+H0e^U$2|o@7O=M z2LTUl>GZ4vA7L*9?xw3Bd#%0-a41sZ)U61q0aErq~4_oy1I)_X0W||lmw+4Q57G)y#V6kjdC5WV42V8l4kGsi|im_ zvqB`XJ(D$H^p08U6|H#D`SVuCxH^OZ+E9f<=iZf)+zR31%I$&t-x3B)x5qGdt{p3! z^F7CRW9AiDQrXCUqtz9bj`K8tyv z&g$p>ke_V6A6gB$STc<`f*!POx@klq>E`={&rsj6f#6xUk?{4XQt?q%%XLT7t71U& zceMFjibQdBdqEk8#;{g#F`ohh$^u=5g84e>fGs7i2ED15@n2LAtYZ8BAv)mr*XTgR z6>R0;OiRb24g%Yn)2dsUlgU{*JJ>t8kZCK(lZhzHkg1wmf<92vo^&i~t|lM~t)0=AP~j&SoyObcp|PB#?u>_y;PRj8>eFjTOiaWMyM#1%B+gm{_@KSXpU4 z>=Yc#{x=hKXJbc4bF&YKx3R5@IU_9GLAKQP-hmlOv z+}Y)0Xfk$YAP10>_hUFVW{&@w=7;&msmX)f%*j6H#Kt0SZUQp4rz5j*GzMF_m>ZM1 z{iinpE8?@G8F*DP$pl9SrMeq<|XReeQRg)#-u{g7Vfx3 z9H6;KW0gN4Kb7&R!AvdMe`My;g&0{8h|NhuPL2>zzV}cfPnud8M9qxjHR+jAF}z*` zGbs+nZHmEO`F<^4HNhOLJql}yGb6?wWEr;3y6}~VD4DG)eSes*{rjp`|7&N8ji1~idywg}l5ufx=_9hJfxOKBDI&6H zk?8`-*vWt&jj9d~;E%?S#04_de>^N4K5G9g(tm2=WV!;}JYu3iUM@CXR$ic_xEMPt zrz9_rxESzbjfk>}aq$X~{qH6pIzn-@LJt=}JmDg5Z11)UIGh&zNmz?de zQ|EbK0T=8l zpfhIv=a6w$hm(dZ^bY=qSo zlS_&xD7vrNs4?Ur0l190jJ(am2I-CHEzJ`l-+ON~7lIlOT4qld_4RHXN*j z;SWW@tcXVx<}86%J5~?juS2$tSBB|?>wr@Gt?@c#tYr)x!WP>bX~fq6y@#d=dqN=~ z8f(1IO8kJdM|H|q_3aYd8LBd%TwO7NU7M;Z>XN7}K%-aPq84cfrqR+J=w0zg5)QeM z-$Kb6V!qteZTPhO^P*(<3UOnp7ar$%`a00tI-m*7m-98o$ zWFUxSxz?l#SNxiDLZB)czK}h1h&KT$j;+rAbCNy^T8a(LhP}WW#z%|sn|qH5BNfjM#2TjL4Gs>WN=&y%xWW_iE+tIrge=X&lLaw{P4G-Q1g z@r|*HH9{bh7tyY>xzJ`axX>l#y@IUj;_r)`8ltSi1;jY`?$J?@V*w!f_|u~8OQ;!X zk5DVLY=HIqL3pO$wldqi;Siqb&>97Q3om#O58y^vE^ zEGZnc=e(J_Xqd_6k!b9R<+f<5@x=s`Jz!s=xvjjk*5MIx_rq)*{o*N>|+}%*;PLXr?8MYGc>Gt9`S)>%MGWI>9 zwlB1OKHL7CFX1!?\index{<#1>}}} +\def\attr#1{{\tt #1\index{#1}}} + +\begin{document} + +\title{The Khronos XML API Registry} +\author{Jon Leech} +\date{Last updated 2014/06/16} +\maketitle + +\begin{abstract} + +This document describes the Khronos XML API Registry schema, and +provides some additional information about using the registry and +scripts to generate C header files. The underlying XML files and scripts +can be obtained starting on the OpenGL.org registry pages at URL + +\begin{center} +{\bf \href{http://www.opengl.org/registry/} + {http://www.opengl.org/registry/}} +\end{center} + +\end{abstract} + +\tableofcontents + +\section{Introduction} + +The Registry is the successor to the ancient \code{.spec} files used for +many years to describe the GL, WGL, and GLX APIs. The \code{.spec} files +had a number of issues including: + +\begin{itemize} +\item Almost completely undocumented +\item Used ancient Perl scripts to read and process the registry. +\item Hard to extend and did not semantically capture a variety of + things we would like to know about an API. +\item Attempted to represent data types using a syntax that bore no + description to any actual programming language. Generating this + syntax from OpenGL extensions, which describe C bindings, was + error-prone and painful for the registry maintainer. +\item Could not easily represent related APIs such as OpenGL ES. +\item There was an annoying inconsistency about presence of + function/token prefixes and vendor suffixes depending on which of + the GL, WGL, and GLX \code{.spec} files was being used. +\end{itemize} + +The new registry uses an XML representation of the API and a set of +Python 3 scripts to manipulate the XML, based on the lxml Python +bindings. It comes with an XML schema and validator, is somewhat better +documented, and we will be much more responsive about updating it. + +Some groups outside Khronos have their own XML based API descriptions, +often used for additional purposes such as library code generators or +extension loaders, and it may be desirable to construct XSLT or other +translators between the schema. + + +\section{Downloading the Registry} + +You can get the processed C header files from the registry pages on the +OpenGL.org webserver at URL + +\begin{center} +{\bf \href{http://www.opengl.org/registry/} + {http://www.opengl.org/registry/}} +\end{center} + +However, to modify the XML database or the generator scripts for other +purposes, you'll need to install a Subversion client and download +the registry subrepository at + +\begin{center} +\end{center} +\begin{center} +{\bf \href{https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/} + {https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/}} +\end{center} + + +\section{Getting Started} + +Once the registry has been obtained from Subversion, if you're running +in a Linux command-line environment and have Python 3, the lxml Python +bindings, and libxml installed, you should just be able to invoke +\code{make} and generate C/C++ header files for all the following +targets: + +\begin{itemize} +\item \code{GL/glext.h} - OpenGL 1.2 (and later) compatibility profile + API + extensions +\item \code{GL/glcorearb.h} - OpenGL core profile API + extensions +\item \code{GLES/gl.h} - OpenGL compatibility profile API +\item \code{GLES/glext.h} - OpenGL ES 1.x extensions +\item \code{GLES2/gl2.h} - OpenGL ES 2.x API +\item \code{GLES2/gl2ext.h} - OpenGL ES 2.x extensions +\item \code{GLES3/gl3.h} - OpenGL ES 3.x API +\item \code{GL/glx.h} - GLX API +\item \code{GL/glxext.h} - GLX 1.3 (and later) API + extensions +\item \code{GL/wgl.h} - WGL API +\item \code{GL/wglext.h} - WGL extensions +\item \code{EGL/egl.h} - EGL (still being worked on) +\end{itemize} + +Starting with the Makefile rules and inspecting the files \code{gl.xml}, +\code{genheaders.py}, and \code{reg.py} will be necessary if you want to +repurpose the registry for reasons other than header file generation, or +to generate headers for languages other than C. + +If you're running in a Windows, MaxOS X, or other environment, there are +equivalent versions of Python and GNU Make, although we haven't tested +this ourselves. Feedback would be helpful. + +\subsection{Header Generation Script - \code{genheaders.py}} + +When generating header files using the \code{genheaders.py} script, an +API name and profile name are required, as shown in the Makefile +examples. Additionally, specific versions and extensions can be required +or excluded. Based on this information, the generator script extracts +the relevant interfaces and creates a C-language header file for them. +\code{genheaders.py} contains predefined generator options for OpenGL, +OpenGL core profile, OpenGL ES 1 / 2 / 3, GLX, and WGL headers. + +The generator script is intended to be generalizable to other languages +by writing new generator classes. Such generators would have to rewrite +the C types and definitions in the XML to something appropriate to their +language. + +\subsection{Registry Processing Script - \code{reg.py}} + +Actual XML registry processing is done in \code{reg.py}, which contains +several objects and methods for loading registries and extracting +interfaces and extensions for use in header generation. There is some +internal documentation in the form of comments although nothing more +extensive exists yet, and it's possible the Python scripts will evolve +significantly based on public feedback. + + +\section{XML Registry Schema} +\label{schema} + +The format of an XML registry is a top level \tag{registry} tag +containing \tag{types}, \tag{enums}, \tag{commands}, \tag{feature}, and +\tag{extension} tags describing the different elements of an API, as +explained below. This description corresponds to a formal Relax NG +schema file, \code{registry.rnc}, against which the XML registry files +can be validated. + +At present there are separate registries for: + +\begin{itemize} +\item OpenGL and OpenGL ES - \code{gl.xml} +\item GLX - \code{glx.xml} +\item WGL - \code{wgl.xml} +\item EGL - \code{egl.xml} (still in development) +\end{itemize} + +\subsection{Profiles} +\label{schema:profile} + +Types and enumerants can have different definitions depending on the API +profile requested, which allows us to accomodate minor incompatibilities +in the OpenGL and OpenGL ES APIs, for example. Features and extensions +can include some elements conditionally depending on the API profile +requested. + +\subsection{API Names} +\label{schema:apiname} + +Several tags use a \attr{api} attribute. This is an arbitrary string, +specified at header generation time, for labelling properties of a +specific API. The string can be, but is not necessarily, an actual API +name. As used in \code{genheaders.py} and \code{gl.xml}, the API names +are \code{gl}, \code{gles1}, and \code{gles2}, corresponding to OpenGL, +OpenGL ES 1, and OpenGL ES 2/3, respectively. + + +\section{Registry Root (\tag{registry} tag)} +\label{schema:root} + +A \tag{registry} contains the entire definition of one or more related +APIs. + +\subsection{Attributes of \tag{registry} tags} + +None. + +\subsection{Contents of \tag{registry} tags} + +Zero or more of each of the following tags, normally in this order +(although order shouldn't be important): + +\begin{itemize} +\item \tag{comment} - Contains arbitrary text, such as a copyright + statement. Unused. +\item \tag{types} (see section~\ref{tag:types}) - defines API types. + Usually only one tag is used. +\item \tag{groups} (see section~\ref{tag:groups}) - defines named groups + of tokens for possible parameter validation in API bindings for + languages other than C. Usually only one tag is used. +\item \tag{enums} (see section~\ref{tag:enums}) - defines API enumerants + (tokens). Usually multiple tags are used. +\item \tag{commands} (see section~\ref{tag:commands}) - defines API + commands (functions). Usually only one tag is used. +\item \tag{feature} (see section~\ref{tag:feature}) - defines API + feature interfaces (API versions, more or less). One tag per + feature set. +\item \tag{extensions} (see section~\ref{tag:extensions}) - defines API + extension interfaces. Usually only one tag is used, wrapping many + extensions. +\end{itemize} + + +\section{API types (\tag{types} tag)} +\label{tag:types} + +The \tag{types} tag contains individual \tag{type} tags describing each +of the derived types used in the API. + +Each \tag{type} tag contains legal C code, with attributes or embedded +tags denoting the type name. + +\subsection{Attributes of \tag{type} tags} + +\begin{itemize} +\item \attr{requires} - another type name this type requires to complete + its definition. +\item \attr{name} - name of this type (if not defined in the tag body). +\item \attr{api} - an API name (see \tag{feature} below) which + specializes this definition of the named type, so that the same + API types may have different definitions for e.g. GL ES and GL. +\item \attr{comment} - arbitrary string (unused). +\end{itemize} + +\subsection{Contents of \tag{type} tags} + +\tag{type} contains text which is legal C code for a type declaration. +It may also contain embedded tags: + +\begin{itemize} +\item \tag{apientry/} - insert a platform calling convention macro here + during header generation, used mostly for function pointer types. +\item \tag{name} - contains the name of this type (if not defined in the + tag attributes). +\end{itemize} + +\subsection{Example of a \tag{types} tag} + +\begin{verbatim} + + ]]> + typedef ptrdiff_t GLintptr; + +\end{verbatim} + +If the {\tt GLint64} type is required by a command, this will result in +the following declarations: + +\begin{verbatim} +#include +typedef ptrdiff_t GLintptr; +\end{verbatim} + + +\section{Enumerant Groups (\tag{groups} tag)} +\label{tag:groups} + +The \tag{groups} tags contain individual \tag{group} tags describing +some of the group annotations used for return and parameter types. + +\subsection{Attributes of \tag{groups} tags} + +None. + +\subsection{Contents of \tag{groups} tags} + +Each \tag{groups} block contains zero or more \tag{group} tags, in +arbitrary order (although they are typically ordered by group name, to +improve human readability). + +\subsection{Example of \tag{groups} tags} + +\begin{verbatim} + + + + + + + + + + +\end{verbatim} + + +\section{Enumerant Group (\tag{group} tag)} +\label{tag:group} + +Each \tag{group} tag defines a single group annotation. + +\subsection{Attributes of \tag{group} tags} + +\begin{itemize} +\item \attr{name} - group name, an arbitrary string for grouping a set + of enums together within a broader namespace. +\end{itemize} + +\subsection{Contents of \tag{group} tags} + +\tag{group} tags may contain zero or more \tag{enum} tags. Each +\tag{enum} tag may contain only a \attr{name} attribute, which should +correspond to a \tag{enum} definition in an \tag{enums} block. + +\subsection{Meaning of \tag{group} tags} +\label{tag:group:meaning} + +If a \tag{proto} or \tag{param} tag of a \tag{command} has a +\attr{group} attribute defined, and that attribute matches a \tag{group} +name, then the return type or parameter type is considered to be +constrained to values defined by the corresponding \tag{group}. C +language bindings do not attempt to enforce this constraint in any way, +but other language bindings may try to do so. + + +\section{Enumerant Blocks (\tag{enums} tag)} +\label{tag:enums} + +The \tag{enums} tags contain individual \tag{enum} tags describing each of the +token (enumerant) names used in the API. + +\subsection{Attributes of \tag{enums} tags} + +\begin{itemize} +\item \attr{namespace} - a string for grouping many different enums + together, currently unused but typically something like \code{GL} + for all enums in the OpenGL / OpenGL ES shared namespace. Multiple + \tag{enums} tags can share the same namespace. +\item \attr{type} - a string describing the data type of the values of + this group of enums, currently unused. The only string used at + present in the is \code{bitmask}. +\item \attr{start}, \attr{end} - integers defining the start and end of + a reserved range of enumerants for a particular vendor or purpose. + \attr{start} must be $\leq$ \attr{end}. These fields define formal + enumerant allocations within a namespace, and are made by the + Khronos Registrar on request from implementers following the enum + allocation policy. +\item \attr{vendor} - string describing the vendor or purposes to whom a + reserved range of enumerants is allocated. +\item \attr{comment} - arbitrary string (unused) +\end{itemize} + +\subsection{Contents of \tag{enums} tags} + +Each \tag{enums} block contains zero or more \tag{enum} and \tag{unused} +tags, in arbitrary order (although they are typically ordered by sorting +on enumerant values, to improve human readability). + +\subsection{Example of \tag{enums} tags} + +\begin{verbatim} + + + + + + + + +\end{verbatim} + +When processed into a C header, and assuming all these tokens were +required, this results in + +\begin{verbatim} +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000001 +#define GL_BGR 0x80E0 +\end{verbatim} + + +\section{Enumerants (\tag{enum} tag)} +\label{tag:enum} + +Each \tag{enum} tag defines a single GL (or other API) token. + +\subsection{Attributes of \tag{enum} tags} + +\begin{itemize} +\item \attr{value} - enumerant value, a legal C constant (usually a + hexadecimal integer). +\item \attr{name} - enumerant name, a legal C preprocessor token name. +\item \attr{api} - an API name which specializes this definition of the + named enum, so that different APIs may have different values for + the same token (used to address a few accidental incompatibilities + between GL and GL ES). +\item \attr{type} - legal C suffix for the value to force it to a + specific type. Currently only \code{u} and \code{ull} are used, + for \code{unsigned} 32- and 64-bit integer values, respectively. + Separated from the \attr{value} field since this eases parsing and + sorting of values, and is rarely used. +\item \attr{alias} - name of another enumerant this is an alias of, used + where token names have been changed as a result of profile changes + or for consistency purposes. An enumerant alias is simply a + different \attr{name} for the exact same \attr{value}. At present, + enumerants which are promoted from extension to core API status + are not tagged as aliases - just enumerants tagged as aliases in + the {\em Changed Tokens} sections of appendices to the OpenGL + Specification. This might change in the future. +\end{itemize} + +\subsection{Contents of \tag{enum} tags} + +\tag{enum} tags have no allowed contents. All information is contained +in the attributes. + + +\section{Unused Enumerants (\tag{unused} tag)} +\label{tag:unused} + +Each \tag{unused} tag defines a range of enumerants which is allocated, +but not yet assigned to specific enums. This just tracks the unused +values and is not needed for header generation. + +\subsection{Attributes of \tag{unused} tags} + +\begin{itemize} +\item \attr{start}, \attr{end} - integers defining the start and end of + an unused range of enumerants. \attr{start} must be $\leq$ + \attr{end}. This range should not exceed the range reserved by the + surrounding \tag{enums} tag. +\item \attr{vendor} - string describing the vendor or purposes to whom a + reserved range of enumerants is allocated. Usually identical to + the \attr{vendor} attribute of the surrounding \attr{enums} block. +\item \attr{comment} - arbitrary string (unused) +\end{itemize} + +\subsection{Contents of \tag{unused} tags} + +None. + + +\section{Command Blocks (\tag{commands} tag)} +\label{tag:commands} + +The \tag{commands} tag contains definitions of each of the functions +(commands) used in the API. + +\subsection{Attributes of \tag{commands} tags} + +\begin{itemize} +\item \attr{namespace} - a string defining the namespace in which + commands live, currently unused but typically something like + \code{GL}. +\end{itemize} + +\subsection{Contents of \tag{commands} tags} + +Each \tag{commands} block contains zero or more \tag{command} tags, in +arbitrary order (although they are typically ordered by sorting on the +command name, to improve human readability). + + +\section{Commands (\tag{command} tag)} +\label{tag:command} + +The \tag{command} tag contains a structured definition of a single API +command (function). + +\subsection{Attributes of \tag{command} tags} + +\begin{itemize} +\item \attr{comment} - arbitrary string (unused). +\end{itemize} + +\subsection{Contents of \tag{command} tags} + +\begin{itemize} +\item \tag{proto} must be the first element, and is a tag defining the C + function prototype of a command as described below, up to the + function name but not including function parameters. +\item \tag{param} elements for each command parameter follow, defining + its name and type, as described below. If a command takes no + arguments, it has no \tag{param} tags. +\end{itemize} + +Following these elements, the remaining elements in a \tag{command} +tag are optional and may be in any order: + +\begin{itemize} +\item \tag{alias} has no attributes and contains a string which is the + name of another command this command is an alias of, used when + promoting a function from extension to ARB or ARB to API status. A + command alias describes the case where there are two function + names which resolve to the {\bf same} client library code, so (for + example) the case where a command is promoted but is also given + different GLX protocol would {\bf not} be an alias in this sense. +\item \tag{vecequiv} has no attributes and contains a string which is + the name of another command which is the {\em vector equivalent} + of this command. For example, the vector equivalent of + \code{glVertex3f} is \code{glVertex3fv}. +\item \tag{glx} defines GLX protocol information for this command, as + described below. Many GL commands don't have GLX protocol defined, + and other APIs such as EGL and WGL don't use GLX at all. +\end{itemize} + + +\subsection{Command prototype (\tag{proto} tags)} +\label{tag:command:proto} + +The \tag{proto} tag defines the return type and name of a command. + +\subsubsection{Attributes of \tag{proto} tags} + +\begin{itemize} +\item \attr{group} - group name, an arbitrary string. +\end{itemize} + +If the group name is defined, it may be interpreted as described in +section~\ref{tag:group:meaning}. + +\subsubsection{Contents of \tag{proto} tags} + +The text elements of a \tag{proto} tag, with all other tags removed, is +legal C code describing the return type and name of a command. In addition +it may contain two semantic tags: + +\begin{itemize} +\item The \tag{ptype} tag is optional, and contains text which is a + valid type name found in \tag{type} tag, and indicates that this + type must be previously defined for the definition of the command + to succeed. Builtin C types, and any derived types which are + expected to be found in other header files, should not be wrapped + in \tag{ptype} tags. +\item The \tag{name} tag is required, and contains the command name + being described. +\end{itemize} + +\subsection{Command parameter (\tag{param} tags)} +\label{tag:command:param} + +The \tag{param} tag defines the type and name of a parameter. + +\subsubsection{Attributes of \tag{param} tags} + +\begin{itemize} +\item \attr{group} - group name, an arbitrary string. +\item \attr{len} - parameter length, either an integer specifying the + number of elements of the parameter \tag{ptype}, or a complex + string expression with poorly defined syntax, usually representing + a length that is computed as a combination of other command + parameter values, and possibly current GL state as well. +\end{itemize} + +If the group name is defined, it may be interpreted as described in +section~\ref{tag:group:meaning}. + +\subsubsection{Contents of \tag{param} tags} + +The text elements of a \tag{param} tag, with all other tags removed, is +legal C code describing the type and name of a function parameter. In +addition it may contain two semantic tags: + +\begin{itemize} +\item The \tag{ptype} tag is optional, and contains text which is a + valid type name found in \tag{type} tag, and indicates that this + type must be previously defined for the definition of the command + to succeed. Builtin C types, and any derived types which are + expected to be found in other header files, should not be wrapped + in \tag{ptype} tags. +\item The \tag{name} tag is required, and contains the command name + being described. +\end{itemize} + +\subsection{Example of a \tag{commands} tag} + +\begin{verbatim} + + + void glBeginConditionalRenderNV + GLuint id + GLenum mode + + + + +\end{verbatim} + +When processed into a C header, this results in + +\begin{verbatim} +void glBeginConditionalRenderNV(GLuint id, GLenum mode); +\end{verbatim} + + +\section{API Features / Versions (\tag{feature} tag)} +\label{tag:feature} + +API features are described in individual \tag{feature} tags. A feature +is the set of interfaces (enumerants and commands) defined by a +particular API and version, such as OpenGL 4.0 or OpenGL ES 3.0, and +includes all API profiles of that version. + +\subsection{Attributes of \tag{feature} tags} + +\begin{itemize} +\item \attr{api} - API name this feature is for (see + section~\ref{schema:apiname}), such as \code{gl} or \code{gles2}. +\item \attr{name} - version name, used as the C preprocessor token under + which the version's interfaces are protected against multiple + inclusion. Example: \code{GL\_VERSION\_4\_2}. +\item \attr{protect} - an additional preprocessor token used to protect + a feature definition. Usually another feature or extension + \attr{name}. Rarely used, for odd circumstances where the + definition of a feature or extension requires another to be + defined first. +\item \attr{number} - feature version number, usually a string + interpreted as $majorNumber.minorNumber$. Example: \code{4.2}. +\item \attr{comment} - arbitrary string (unused) +\end{itemize} + +\subsection{Contents of \tag{feature} tags} + +Zero or more \tag{require} and \tag{remove} tags (see +section~\ref{tag:required}), in arbitrary order. Each tag describes a +set of interfaces that is respectively required for, or removed from, +this feature, as described below. + +\subsection{Example of a \tag{feature} tag} + +\begin{verbatim} + + + + + + + + + + +\end{verbatim} + +When processed into a C header for the \code{compatibility} profile of +OpenGL, this results in (assuming the usual definitions of these GL +interfaces): + +\begin{verbatim} +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_INDEX 0x8222 +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glEndTransformFeedback (void); +#endif +#endif /* GL_VERSION_3_0 */ +\end{verbatim} + +If processed into a header for the \code{core} profile, the definition of +\code{GL\_INDEX} would not appear. + + +\section{Extension Blocks (\tag{extensions} tag)} +\label{tag:extensions} + +The \tag{extensions} tag contains definitions of each of the extenions +which are defined for the API. + +\subsection{Attributes of \tag{extensions} tags} + +None. + +\subsection{Contents of \tag{extensions} tags} + +Each \tag{extensions} block contains zero or more \tag{extension} tags, +each describing an API extension, in arbitrary order (although they are +typically ordered by sorting on the extension name, to improve human +readability). + + +\section{API Extensions (\tag{extension} tag)} +\label{tag:extension} + +API extensions are described in individual \tag{extension} tags. An +extension is the set of interfaces defined by a particular API extension +specification, such as \code{ARB\_multitexture}. \tag{extension} is +similar to \tag{feature}, but instead of having \attr{version} and +\attr{profile} attributes, instead has a \attr{supported} attribute, +which describes the set of API names which the extension can potentially +be implemented against. + +\subsection{Attributes of \tag{extension} tags} + +\begin{itemize} +\item \attr{supported} - a regular expression, with an implicit + \code{\^{}} and \code{\$} bracketing it, which should match the + \attr{api} tag of a set of \tag{feature} tags. +\item \attr{protect} - an additional preprocessor token used to protect + an extension definition. Usually another feature or extension + \attr{name}. Rarely used, for odd circumstances where the + definition of an extension requires another to be defined first. +\item \attr{comment} - arbitrary string (unused) +\end{itemize} + +\subsection{Contents of \tag{extension} tags} + +Zero or more \tag{require} and \tag{remove} tags (see +section~\ref{tag:required}), in arbitrary order. Each tag describes a +set of interfaces that is respectively required for, or removed from, +this extension, as described below. + +\subsection{Example of an \tag{extensions} tag} + +\begin{verbatim} + + + + + + + + + + + +\end{verbatim} + +The \attr{supported} attribute says that the extension can be supported for +either the GL compatibility (\code{gl}) or GL core (\code{glcore}) API +profiles, but not for other APIs. When processed into a C header for the +\code{core} profile of OpenGL, this results in (assuming the usual +definitions of these GL interfaces): + +\begin{verbatim} +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#define GL_NO_ERROR 0 +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); +#endif +#endif /* GL_ARB_robustness */ +\end{verbatim} + + +\section{Required and Removed Interfaces (\tag{require} and \tag{remove} tags)} +\label{tag:required} + +A \tag{require} block defines a set of interfaces (types, enumerants and +commands) {\em required} by a \tag{feature} or \tag{extension}. A +\tag{remove} block defines a set of interfaces {\em removed} by a +\tag{feature} (this is primarily useful for the OpenGL core profile, +which removed many interfaces - extensions should never remove +interfaces, although this usage is allowed by the schema). Except for +the tag name and behavior, the contents of \tag{require} and +\tag{remove} tags are identical. + +\subsection{Attributes of \tag{require} and \tag{remove} tags} + +\begin{itemize} +\item \attr{profile} - string name of an API profile. Interfaces in the + tag are only required (or removed) if the specified profile is + being generated. If not specified, interfaces are required (or + removed) for all API profiles. +\item \attr{comment} - arbitrary string (unused) +\item \attr{api} - an API name (see section~\ref{schema:apiname}). Interfaces + in the tag are only required (or removed) if the specified API is + being generated. If not specified, interfaces are required (or + removed) for all APIs. + + {\bf The \attr{api} attribute is only supported inside + \tag{extension} tags,} since \tag{feature} tags already define a + specific API. +\end{itemize} + +\subsection{Contents of \tag{require} and \tag{remove} tags} + +Zero or more of the following tags, in any order: + +\begin{itemize} +\item \tag{command} specifies an required (or removed) command defined + in a \tag{commands} block. The tag has no content, but contains + elements: + + \begin{itemize} + \item \attr{name} - name of the command (required). + \item \attr{comment} - arbitrary string (optional and unused). + \end{itemize} +\item \tag{enum} specifies an required (or removed) enumerant defined in + a \tag{enums} block. The tag has no content, but contains + elements: + + \begin{itemize} + \item \attr{name} - name of the enumerant (required). + \item \attr{comment} - arbitrary string (optional and unused). + \end{itemize} +\item \tag{type} specifies a required (or removed) type defined in a + \tag{types} block. Most types are picked up implicitly by using + the \tag{ptype} tags of commands, but in a few cases, additional + types need to be specified explicitly (it is unlikely that a type + would ever be removed, although this usage is allowed by the + schema). The tag has no content, but contains elements: + + \begin{itemize} + \item \attr{name} - name of the type (required). + \item \attr{comment} - arbitrary string (optional and unused). + \end{itemize} +\end{itemize} + + +\section{General Discussion} +\label{general} + + +\subsection{Stability of the XML Database and Schema} +\label{general:stability} + +The new registry schema, scripts, and databases are evolving in response +to feedback and to Khronos' own wishlist. This means the XML schema is +subject to change, although most such change will probably be confined +to adding attributes to existing tags. The XML databases such as +\code{gl.xml} will evolve in response to schema changes, to new +extensions and API versions, and to general cleanup, such as +canonicalization of the XML or sorting of \tag{command} and +\tag{extension} tags by name. Changes to the schema will be described in +the change log of this document (see section~\ref{changelog}). Changes +to the \code{.xml} files will be described in Subversion revision +history. + + +\subsection{Feature Enhancements to the Registry} +\label{general:enhancements} + +There are lots of tools and additional tags that would make the XML +format more expressive and the tools more capable. Khronos is open to +hosting additional processing scripts for other purposes. We're hoping +to be much more responsive to bugs filed in the Khronos public bugzilla +now that there's a more modern and maintainable framework to build on. + +A partial wishlist follows: + +\begin{itemize} +\item Enhance \tag{command} \tag{alias} tags to describe more relaxed + sorts of aliases, such as commands equivalent in behavior and + interface, but using different GLX protocol (this might be called + a {\em client-side alias} or something of the sort). +\end{itemize} + +\subsection{Type Annotations and Relationship to \code{.spec} Files} +\label{general:annotations} + +The initial releases of the XML Registry did not include type annotation +and array length information from the old \code{.spec} files, which +generated a number of complaints from people writing bindings of OpenGL +to languages other than C. The majority of these annotations have now +been added to the XML, in the form of \tag{group} tags (see +section~\ref{tag:group}) defining groups of related enumerants, +\attr{group} attributes on \tag{proto} and \tag{param} tags specifying +that the corresponding return type belongs to a group, and \attr{len} +attributes on \tag{param} tags specifying the array length of the +corresponding parameter. + +There are many caveats regarding these annotations. For the most part +they date from SGI's OpenGL 1.1 implementation, and have not been +updated. The defined \tag{group}s therefore do not cover many API +parameters which {\bf could} be given a group, and in many cases, the +defined \tag{group}s have not been updated to add new enumerants from +later versions of OpenGL and OpenGL extensions. The group names are +often somewhat misleading (with imbedded vendor extension tags, while +the corresponding features have been promoted). + +The \tag{group}s added to \code{gl.xml} are the enumerant groups defined +in \code{enum.spec}, and \code{enumext.spec}. Many additional group +names were used in the annotations in \code{gl.spec}, and they +fall in several categories discussed below. + + +\subsubsection{Simple API Type Aliases} + +Group names that were simply an alias for a GL type have been left +entirely out of \code{gl.xml}, since they offer no useful additional +information. + +For example, a parameter described as \code{UInt32} in \code{gl.spec} is +not annotated with \code{group="UInt32"} in \code{gl.xml}, because this +offers no information about the parameter not already present in its +declaration as \code{GLuint}. + +A few examples of such groups are \code{cl\_context}, +\code{handleARB}, \code{Int32}, and \code{sync}. + + +\subsubsection{Numeric Constraints} + +Group names representing some type of numerical constraint on a value +are retained in \tag{proto} and \tag{param} \attr{group} attributes, but +no definition exists. This is because the existing \tag{group} mechanism +can only describe constraints to specific enumerant names. + +This is not a regression relative to the \code{.spec} files, which also +did not describe the meaning of these groups. + +A few examples of such groups are \code{CheckedFloat32}, +\code{ClampedFixed}, and \code{CoordD}. + + +\subsubsection{GL Object Names} + +Group names representing an object name obtained from e.g. a +\code{glGen*} command, such as a display list name, are retained in in +\tag{proto} and \tag{param} \attr{group} attributes, but no definition +exists. This is because the existing \tag{group} mechanism can only +describe constraints to specific enumerant names. + +This is not a regression relative to the \code{.spec} files, which also +did not describe the meaning of these groups. + +A few examples of such groups are \code{List} and \code{Path}. + + +\subsubsection{Groups Not Defined Yet} + +Group names representing enumerant groups which were not defined in +\code{enum.spec} and \code{enumext.spec} are retained in \tag{proto} and +\tag{param} \attr{group} attributes, but no definition exists. Such +groups usually are a result of vendors contributing \code{gl.spec} +entries for an extension without contributing corresponding +\code{enum.spec} entries. + +This is not a regression relative to the \code{.spec} files, which also +did not describe the meaning of these groups. + +A few examples of such groups are \code{ArrayObjectPNameATI}, +\code{BinormalPointerTypeEXT}, and \code{SpriteParameterNameSGIX}. + + +\subsubsection{Other Groups} + +There are probably a few groups which are present in \code{gl.xml} but +should not be. These can be gradually cleaned up over time. + + +\subsubsection{Validating Groups} + +The \code{genheaders.py} script has been enhanced to allow validating +groups during header generation. Invoking it with the +\code{-validate} option, for example via: + +\code{\$ genheaders.py -validate -registry gl.xml} + +\noindent will generate a text dump on standard output showing all +parameter type \attr{group} attributes which do {\bf not} have +corresponding \tag{group} tags. + + +\section{Change Log} +\label{changelog} + +\begin{itemize} +\item 2014/06/16 - Add \tag{vendor} attribute to \tag{unused} tags. +\item 2013/09/17 - Add \tag{comment} attribute to \tag{command} tags + within \tag{commands}. +\item 2013/06/24 - Add \tag{groups} and \tag{group} tags, renamed + \tag{enums} attribute \attr{class} to \attr{group}, and add + parameter type annotation attributes \attr{group} and \attr{len} + to both \tag{proto} and \tag{param}. Add + section~\ref{general:annotations} discussing limitations of these + annotations. Still need to add examples of the annotation + attributes. +\item 2013/06/19 - Added \tag{extensions} tag block as a wrapper around + groups of \tag{extension} tags, to ease XML transformations such + as sorting extensions by name. +\item 2013/06/14 - Expanded description of tags, better formatting +\item 2013/06/12 - First release, text file format +\end{itemize} + +\input{readme.ind} + +% \printindex + +\end{document} diff --git a/third_party/rust/khronos_api/api/reg.py b/third_party/rust/khronos_api/api/reg.py new file mode 100755 index 000000000000..9248b6624b2a --- /dev/null +++ b/third_party/rust/khronos_api/api/reg.py @@ -0,0 +1,1162 @@ +#!/usr/bin/python3 -i +# +# Copyright (c) 2013-2014 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and/or associated documentation files (the +# "Materials"), to deal in the Materials without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Materials, and to +# permit persons to whom the Materials are 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 Materials. +# +# THE MATERIALS ARE 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 +# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +import io,os,re,string,sys +from lxml import etree + +def write( *args, **kwargs ): + file = kwargs.pop('file',sys.stdout) + end = kwargs.pop( 'end','\n') + file.write( ' '.join([str(arg) for arg in args]) ) + file.write( end ) + +# noneStr - returns string argument, or "" if argument is None. +# Used in converting lxml Elements into text. +# str - string to convert +def noneStr(str): + if (str): + return str + else: + return "" + +# matchAPIProfile - returns whether an API and profile +# being generated matches an element's profile +# api - string naming the API to match +# profile - string naming the profile to match +# elem - Element which (may) have 'api' and 'profile' +# attributes to match to. +# If a tag is not present in the Element, the corresponding API +# or profile always matches. +# Otherwise, the tag must exactly match the API or profile. +# Thus, if 'profile' = core: +# with no attribute will match +# will match +# will not match +# Possible match conditions: +# Requested Element +# Profile Profile +# --------- -------- +# None None Always matches +# 'string' None Always matches +# None 'string' Does not match. Can't generate multiple APIs +# or profiles, so if an API/profile constraint +# is present, it must be asked for explicitly. +# 'string' 'string' Strings must match +# +# ** In the future, we will allow regexes for the attributes, +# not just strings, so that api="^(gl|gles2)" will match. Even +# this isn't really quite enough, we might prefer something +# like "gl(core)|gles1(common-lite)". +def matchAPIProfile(api, profile, elem): + """Match a requested API & profile name to a api & profile attributes of an Element""" + match = True + # Match 'api', if present + if ('api' in elem.attrib): + if (api == None): + raise UserWarning("No API requested, but 'api' attribute is present with value '" + + elem.get('api') + "'") + elif (api != elem.get('api')): + # Requested API doesn't match attribute + return False + if ('profile' in elem.attrib): + if (profile == None): + raise UserWarning("No profile requested, but 'profile' attribute is present with value '" + + elem.get('profile') + "'") + elif (profile != elem.get('profile')): + # Requested profile doesn't match attribute + return False + return True + +# BaseInfo - base class for information about a registry feature +# (type/group/enum/command/API/extension). +# required - should this feature be defined during header generation +# (has it been removed by a profile or version)? +# declared - has this feature been defined already? +# elem - lxml.etree Element for this feature +# resetState() - reset required/declared to initial values. Used +# prior to generating a new API interface. +class BaseInfo: + """Represents the state of a registry feature, used during API generation""" + def __init__(self, elem): + self.required = False + self.declared = False + self.elem = elem + def resetState(self): + self.required = False + self.declared = False + +# TypeInfo - registry information about a type. No additional state +# beyond BaseInfo is required. +class TypeInfo(BaseInfo): + """Represents the state of a registry type""" + def __init__(self, elem): + BaseInfo.__init__(self, elem) + +# GroupInfo - registry information about a group of related enums. +# enums - dictionary of enum names which are in the group +class GroupInfo(BaseInfo): + """Represents the state of a registry enumerant group""" + def __init__(self, elem): + BaseInfo.__init__(self, elem) + self.enums = {} + +# EnumInfo - registry information about an enum +# type - numeric type of the value of the tag +# ( '' for GLint, 'u' for GLuint, 'ull' for GLuint64 ) +class EnumInfo(BaseInfo): + """Represents the state of a registry enum""" + def __init__(self, elem): + BaseInfo.__init__(self, elem) + self.type = elem.get('type') + if (self.type == None): + self.type = '' + +# CmdInfo - registry information about a command +# glxtype - type of GLX protocol { None, 'render', 'single', 'vendor' } +# glxopcode - GLX protocol opcode { None, number } +# glxequiv - equivalent command at GLX dispatch level { None, string } +# vecequiv - equivalent vector form of a command taking multiple scalar args +# { None, string } +class CmdInfo(BaseInfo): + """Represents the state of a registry command""" + def __init__(self, elem): + BaseInfo.__init__(self, elem) + self.glxtype = None + self.glxopcode = None + self.glxequiv = None + self.vecequiv = None + +# FeatureInfo - registry information about an API +# or +# name - feature name string (e.g. 'GL_ARB_multitexture') +# number - feature version number (e.g. 1.2). +# features are unversioned and assigned version number 0. +# category - category, e.g. VERSION or ARB/KHR/OES/ETC/vendor +# emit - has this feature been defined already? +class FeatureInfo(BaseInfo): + """Represents the state of an API feature (version/extension)""" + def __init__(self, elem): + BaseInfo.__init__(self, elem) + self.name = elem.get('name') + # Determine element category (vendor). Only works + # for elements. + if (elem.tag == 'feature'): + self.category = 'VERSION' + self.number = elem.get('number') + else: + self.category = self.name.split('_', 2)[1] + self.number = "0" + self.emit = False + +# Primary sort key for regSortFeatures. +# Sorts by category of the feature name string: +# Core API features (those defined with a tag) +# ARB/KHR/OES (Khronos extensions) +# other (EXT/vendor extensions) +def regSortCategoryKey(feature): + if (feature.elem.tag == 'feature'): + return 0 + elif (feature.category == 'ARB' or + feature.category == 'KHR' or + feature.category == 'OES'): + return 1 + else: + return 2 + +# Secondary sort key for regSortFeatures. +# Sorts by extension name. +def regSortNameKey(feature): + return feature.name + +# Tertiary sort key for regSortFeatures. +# Sorts by feature version number. +# elements all have version number "0" +def regSortNumberKey(feature): + return feature.number + +# regSortFeatures - default sort procedure for features. +# Sorts by primary key of feature category, +# then by feature name within the category, +# then by version number +def regSortFeatures(featureList): + featureList.sort(key = regSortNumberKey) + featureList.sort(key = regSortNameKey) + featureList.sort(key = regSortCategoryKey) + +# GeneratorOptions - base class for options used during header production +# These options are target language independent, and used by +# Registry.apiGen() and by base OutputGenerator objects. +# +# Members +# filename - name of file to generate, or None to write to stdout. +# apiname - string matching 'apiname' attribute, e.g. 'gl'. +# profile - string specifying API profile , e.g. 'core', or None. +# versions - regex matching API versions to process interfaces for. +# Normally '.*' or '[0-9]\.[0-9]' to match all defined versions. +# emitversions - regex matching API versions to actually emit +# interfaces for (though all requested versions are considered +# when deciding which interfaces to generate). For GL 4.3 glext.h, +# this might be '1\.[2-5]|[2-4]\.[0-9]'. +# defaultExtensions - If not None, a string which must in its +# entirety match the pattern in the "supported" attribute of +# the . Defaults to None. Usually the same as apiname. +# addExtensions - regex matching names of additional extensions +# to include. Defaults to None. +# removeExtensions - regex matching names of extensions to +# remove (after defaultExtensions and addExtensions). Defaults +# to None. +# sortProcedure - takes a list of FeatureInfo objects and sorts +# them in place to a preferred order in the generated output. +# Default is core API versions, ARB/KHR/OES extensions, all +# other extensions, alphabetically within each group. +# The regex patterns can be None or empty, in which case they match +# nothing. +class GeneratorOptions: + """Represents options during header production from an API registry""" + def __init__(self, + filename = None, + apiname = None, + profile = None, + versions = '.*', + emitversions = '.*', + defaultExtensions = None, + addExtensions = None, + removeExtensions = None, + sortProcedure = regSortFeatures): + self.filename = filename + self.apiname = apiname + self.profile = profile + self.versions = self.emptyRegex(versions) + self.emitversions = self.emptyRegex(emitversions) + self.defaultExtensions = defaultExtensions + self.addExtensions = self.emptyRegex(addExtensions) + self.removeExtensions = self.emptyRegex(removeExtensions) + self.sortProcedure = sortProcedure + # + # Substitute a regular expression which matches no version + # or extension names for None or the empty string. + def emptyRegex(self,pat): + if (pat == None or pat == ''): + return '_nomatch_^' + else: + return pat + +# CGeneratorOptions - subclass of GeneratorOptions. +# +# Adds options used by COutputGenerator objects during C language header +# generation. +# +# Additional members +# prefixText - list of strings to prefix generated header with +# (usually a copyright statement + calling convention macros). +# protectFile - True if multiple inclusion protection should be +# generated (based on the filename) around the entire header. +# protectFeature - True if #ifndef..#endif protection should be +# generated around a feature interface in the header file. +# genFuncPointers - True if function pointer typedefs should be +# generated +# protectProto - True if #ifdef..#endif protection should be +# generated around prototype declarations +# protectProtoStr - #ifdef symbol to use around prototype +# declarations, if protected +# apicall - string to use for the function declaration prefix, +# such as APICALL on Windows. +# apientry - string to use for the calling convention macro, +# in typedefs, such as APIENTRY. +# apientryp - string to use for the calling convention macro +# in function pointer typedefs, such as APIENTRYP. +class CGeneratorOptions(GeneratorOptions): + """Represents options during C header production from an API registry""" + def __init__(self, + filename = None, + apiname = None, + profile = None, + versions = '.*', + emitversions = '.*', + defaultExtensions = None, + addExtensions = None, + removeExtensions = None, + sortProcedure = regSortFeatures, + prefixText = "", + genFuncPointers = True, + protectFile = True, + protectFeature = True, + protectProto = True, + protectProtoStr = True, + apicall = '', + apientry = '', + apientryp = ''): + GeneratorOptions.__init__(self, filename, apiname, profile, + versions, emitversions, defaultExtensions, + addExtensions, removeExtensions, sortProcedure) + self.prefixText = prefixText + self.genFuncPointers = genFuncPointers + self.protectFile = protectFile + self.protectFeature = protectFeature + self.protectProto = protectProto + self.protectProtoStr = protectProtoStr + self.apicall = apicall + self.apientry = apientry + self.apientryp = apientryp + +# OutputGenerator - base class for generating API interfaces. +# Manages basic logic, logging, and output file control +# Derived classes actually generate formatted output. +# +# ---- methods ---- +# OutputGenerator(errFile, warnFile, diagFile) +# errFile, warnFile, diagFile - file handles to write errors, +# warnings, diagnostics to. May be None to not write. +# logMsg(level, *args) - log messages of different categories +# level - 'error', 'warn', or 'diag'. 'error' will also +# raise a UserWarning exception +# *args - print()-style arguments +# beginFile(genOpts) - start a new interface file +# genOpts - GeneratorOptions controlling what's generated and how +# endFile() - finish an interface file, closing it when done +# beginFeature(interface, emit) - write interface for a feature +# and tag generated features as having been done. +# interface - element for the / to generate +# emit - actually write to the header only when True +# endFeature() - finish an interface. +# genType(typeinfo,name) - generate interface for a type +# typeinfo - TypeInfo for a type +# genEnum(enuminfo, name) - generate interface for an enum +# enuminfo - EnumInfo for an enum +# name - enum name +# genCmd(cmdinfo) - generate interface for a command +# cmdinfo - CmdInfo for a command +class OutputGenerator: + """Generate specified API interfaces in a specific style, such as a C header""" + def __init__(self, + errFile = sys.stderr, + warnFile = sys.stderr, + diagFile = sys.stdout): + self.outFile = None + self.errFile = errFile + self.warnFile = warnFile + self.diagFile = diagFile + # Internal state + self.featureName = None + self.genOpts = None + # + # logMsg - write a message of different categories to different + # destinations. + # level - + # 'diag' (diagnostic, voluminous) + # 'warn' (warning) + # 'error' (fatal error - raises exception after logging) + # *args - print()-style arguments to direct to corresponding log + def logMsg(self, level, *args): + """Log a message at the given level. Can be ignored or log to a file""" + if (level == 'error'): + strfile = io.StringIO() + write('ERROR:', *args, file=strfile) + if (self.errFile != None): + write(strfile.getvalue(), file=self.errFile) + raise UserWarning(strfile.getvalue()) + elif (level == 'warn'): + if (self.warnFile != None): + write('WARNING:', *args, file=self.warnFile) + elif (level == 'diag'): + if (self.diagFile != None): + write('DIAG:', *args, file=self.diagFile) + else: + raise UserWarning( + '*** FATAL ERROR in Generator.logMsg: unknown level:' + level) + # + def beginFile(self, genOpts): + self.genOpts = genOpts + # + # Open specified output file. Not done in constructor since a + # Generator can be used without writing to a file. + if (self.genOpts.filename != None): + self.outFile = open(self.genOpts.filename, 'w') + else: + self.outFile = sys.stdout + def endFile(self): + self.errFile and self.errFile.flush() + self.warnFile and self.warnFile.flush() + self.diagFile and self.diagFile.flush() + self.outFile.flush() + if (self.outFile != sys.stdout and self.outFile != sys.stderr): + self.outFile.close() + self.genOpts = None + # + def beginFeature(self, interface, emit): + self.emit = emit + self.featureName = interface.get('name') + # If there's an additional 'protect' attribute in the feature, save it + self.featureExtraProtect = interface.get('protect') + def endFeature(self): + # Derived classes responsible for emitting feature + self.featureName = None + self.featureExtraProtect = None + # + # Type generation + def genType(self, typeinfo, name): + if (self.featureName == None): + raise UserWarning('Attempt to generate type', name, + 'when not in feature') + # + # Enumerant generation + def genEnum(self, enuminfo, name): + if (self.featureName == None): + raise UserWarning('Attempt to generate enum', name, + 'when not in feature') + # + # Command generation + def genCmd(self, cmd, name): + if (self.featureName == None): + raise UserWarning('Attempt to generate command', name, + 'when not in feature') + +# COutputGenerator - subclass of OutputGenerator. +# Generates C-language API interfaces. +# +# ---- methods ---- +# COutputGenerator(errFile, warnFile, diagFile) - args as for +# OutputGenerator. Defines additional internal state. +# makeCDecls(cmd) - return C prototype and function pointer typedef for a +# Element, as a list of two strings +# cmd - Element for the +# newline() - print a newline to the output file (utility function) +# ---- methods overriding base class ---- +# beginFile(genOpts) +# endFile() +# beginFeature(interface, emit) +# endFeature() +# genType(typeinfo,name) - generate interface for a type +# genEnum(enuminfo, name) +# genCmd(cmdinfo) +class COutputGenerator(OutputGenerator): + """Generate specified API interfaces in a specific style, such as a C header""" + def __init__(self, + errFile = sys.stderr, + warnFile = sys.stderr, + diagFile = sys.stdout): + OutputGenerator.__init__(self, errFile, warnFile, diagFile) + # Internal state - accumulators for different inner block text + self.typeBody = '' + self.enumBody = '' + self.cmdBody = '' + # + # makeCDecls - return C prototype and function pointer typedef for a + # command, as a two-element list of strings. + # cmd - Element containing a tag + def makeCDecls(self, cmd): + """Generate C function pointer typedef for Element""" + proto = cmd.find('proto') + params = cmd.findall('param') + # Begin accumulating prototype and typedef strings + pdecl = self.genOpts.apicall + tdecl = 'typedef ' + # + # Insert the function return type/name. + # For prototypes, add APIENTRY macro before the name + # For typedefs, add (APIENTRYP ) around the name and + # use the PFNGLCMDNAMEPROC nameng convention. + # Done by walking the tree for element by element. + # lxml.etree has elem.text followed by (elem[i], elem[i].tail) + # for each child element and any following text + # Leading text + pdecl += noneStr(proto.text) + tdecl += noneStr(proto.text) + # For each child element, if it's a wrap in appropriate + # declaration. Otherwise append its contents and tail contents. + for elem in proto: + text = noneStr(elem.text) + tail = noneStr(elem.tail) + if (elem.tag == 'name'): + pdecl += self.genOpts.apientry + text + tail + tdecl += '(' + self.genOpts.apientryp + 'PFN' + text.upper() + 'PROC' + tail + ')' + else: + pdecl += text + tail + tdecl += text + tail + # Now add the parameter declaration list, which is identical + # for prototypes and typedefs. Concatenate all the text from + # a node without the tags. No tree walking required + # since all tags are ignored. + n = len(params) + paramdecl = ' (' + if n > 0: + for i in range(0,n): + paramdecl += ''.join([t for t in params[i].itertext()]) + if (i < n - 1): + paramdecl += ', ' + else: + paramdecl += 'void' + paramdecl += ");\n"; + return [ pdecl + paramdecl, tdecl + paramdecl ] + # + def newline(self): + write('', file=self.outFile) + # + def beginFile(self, genOpts): + OutputGenerator.beginFile(self, genOpts) + # C-specific + # + # Multiple inclusion protection & C++ wrappers. + if (genOpts.protectFile and self.genOpts.filename): + headerSym = '__' + re.sub('\.h', '_h_', os.path.basename(self.genOpts.filename)) + write('#ifndef', headerSym, file=self.outFile) + write('#define', headerSym, '1', file=self.outFile) + self.newline() + write('#ifdef __cplusplus', file=self.outFile) + write('extern "C" {', file=self.outFile) + write('#endif', file=self.outFile) + self.newline() + # + # User-supplied prefix text, if any (list of strings) + if (genOpts.prefixText): + for s in genOpts.prefixText: + write(s, file=self.outFile) + # + # Some boilerplate describing what was generated - this + # will probably be removed later since the extensions + # pattern may be very long. + write('/* Generated C header for:', file=self.outFile) + write(' * API:', genOpts.apiname, file=self.outFile) + if (genOpts.profile): + write(' * Profile:', genOpts.profile, file=self.outFile) + write(' * Versions considered:', genOpts.versions, file=self.outFile) + write(' * Versions emitted:', genOpts.emitversions, file=self.outFile) + write(' * Default extensions included:', genOpts.defaultExtensions, file=self.outFile) + write(' * Additional extensions included:', genOpts.addExtensions, file=self.outFile) + write(' * Extensions removed:', genOpts.removeExtensions, file=self.outFile) + write(' */', file=self.outFile) + def endFile(self): + # C-specific + # Finish C++ wrapper and multiple inclusion protection + self.newline() + write('#ifdef __cplusplus', file=self.outFile) + write('}', file=self.outFile) + write('#endif', file=self.outFile) + if (self.genOpts.protectFile and self.genOpts.filename): + self.newline() + write('#endif', file=self.outFile) + # Finish processing in superclass + OutputGenerator.endFile(self) + def beginFeature(self, interface, emit): + # Start processing in superclass + OutputGenerator.beginFeature(self, interface, emit) + # C-specific + # Accumulate types, enums, function pointer typedefs, end function + # prototypes separately for this feature. They're only printed in + # endFeature(). + self.typeBody = '' + self.enumBody = '' + self.cmdPointerBody = '' + self.cmdBody = '' + def endFeature(self): + # C-specific + # Actually write the interface to the output file. + if (self.emit): + self.newline() + if (self.genOpts.protectFeature): + write('#ifndef', self.featureName, file=self.outFile) + write('#define', self.featureName, '1', file=self.outFile) + if (self.typeBody != ''): + write(self.typeBody, end='', file=self.outFile) + # + # Don't add additional protection for derived type declarations, + # which may be needed by other features later on. + if (self.featureExtraProtect != None): + write('#ifdef', self.featureExtraProtect, file=self.outFile) + if (self.enumBody != ''): + write(self.enumBody, end='', file=self.outFile) + if (self.genOpts.genFuncPointers and self.cmdPointerBody != ''): + write(self.cmdPointerBody, end='', file=self.outFile) + if (self.cmdBody != ''): + if (self.genOpts.protectProto): + write('#ifdef', self.genOpts.protectProtoStr, file=self.outFile) + write(self.cmdBody, end='', file=self.outFile) + if (self.genOpts.protectProto): + write('#endif', file=self.outFile) + if (self.featureExtraProtect != None): + write('#endif /*', self.featureExtraProtect, '*/', file=self.outFile) + if (self.genOpts.protectFeature): + write('#endif /*', self.featureName, '*/', file=self.outFile) + # Finish processing in superclass + OutputGenerator.endFeature(self) + # + # Type generation + def genType(self, typeinfo, name): + OutputGenerator.genType(self, typeinfo, name) + # + # Replace tags with an APIENTRY-style string + # (from self.genOpts). Copy other text through unchanged. + # If the resulting text is an empty string, don't emit it. + typeElem = typeinfo.elem + s = noneStr(typeElem.text) + for elem in typeElem: + if (elem.tag == 'apientry'): + s += self.genOpts.apientry + noneStr(elem.tail) + else: + s += noneStr(elem.text) + noneStr(elem.tail) + if (len(s) > 0): + self.typeBody += s + "\n" + # + # Enumerant generation + def genEnum(self, enuminfo, name): + OutputGenerator.genEnum(self, enuminfo, name) + # + # EnumInfo.type is a C value suffix (e.g. u, ull) + self.enumBody += '#define ' + name.ljust(33) + ' ' + enuminfo.elem.get('value') + # + # Handle non-integer 'type' fields by using it as the C value suffix + t = enuminfo.elem.get('type') + if (t != '' and t != 'i'): + self.enumBody += enuminfo.type + self.enumBody += "\n" + # + # Command generation + def genCmd(self, cmdinfo, name): + OutputGenerator.genCmd(self, cmdinfo, name) + # + decls = self.makeCDecls(cmdinfo.elem) + self.cmdBody += decls[0] + if (self.genOpts.genFuncPointers): + self.cmdPointerBody += decls[1] + +# Registry - object representing an API registry, loaded from an XML file +# Members +# tree - ElementTree containing the root +# typedict - dictionary of TypeInfo objects keyed by type name +# groupdict - dictionary of GroupInfo objects keyed by group name +# enumdict - dictionary of EnumInfo objects keyed by enum name +# cmddict - dictionary of CmdInfo objects keyed by command name +# apidict - dictionary of Elements keyed by API name +# extensions - list of Elements +# extdict - dictionary of Elements keyed by extension name +# gen - OutputGenerator object used to write headers / messages +# genOpts - GeneratorOptions object used to control which +# fetures to write and how to format them +# emitFeatures - True to actually emit features for a version / extension, +# or False to just treat them as emitted +# Public methods +# loadElementTree(etree) - load registry from specified ElementTree +# loadFile(filename) - load registry from XML file +# setGenerator(gen) - OutputGenerator to use +# parseTree() - parse the registry once loaded & create dictionaries +# dumpReg(maxlen, filehandle) - diagnostic to dump the dictionaries +# to specified file handle (default stdout). Truncates type / +# enum / command elements to maxlen characters (default 80) +# generator(g) - specify the output generator object +# apiGen(apiname, genOpts) - generate API headers for the API type +# and profile specified in genOpts, but only for the versions and +# extensions specified there. +# apiReset() - call between calls to apiGen() to reset internal state +# validateGroups() - call to verify that each or +# with a 'group' attribute matches an actual existing group. +# Private methods +# addElementInfo(elem,info,infoName,dictionary) - add feature info to dict +# lookupElementInfo(fname,dictionary) - lookup feature info in dict +class Registry: + """Represents an API registry loaded from XML""" + def __init__(self): + self.tree = None + self.typedict = {} + self.groupdict = {} + self.enumdict = {} + self.cmddict = {} + self.apidict = {} + self.extensions = [] + self.extdict = {} + # A default output generator, so commands prior to apiGen can report + # errors via the generator object. + self.gen = OutputGenerator() + self.genOpts = None + self.emitFeatures = False + def loadElementTree(self, tree): + """Load ElementTree into a Registry object and parse it""" + self.tree = tree + self.parseTree() + def loadFile(self, file): + """Load an API registry XML file into a Registry object and parse it""" + self.tree = etree.parse(file) + self.parseTree() + def setGenerator(self, gen): + """Specify output generator object. None restores the default generator""" + self.gen = gen + # addElementInfo - add information about an element to the + # corresponding dictionary + # elem - ///// Element + # info - corresponding {Type|Group|Enum|Cmd|Feature}Info object + # infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' + # dictionary - self.{type|group|enum|cmd|api|ext}dict + # If the Element has an 'api' attribute, the dictionary key is the + # tuple (name,api). If not, the key is the name. 'name' is an + # attribute of the Element + def addElementInfo(self, elem, info, infoName, dictionary): + if ('api' in elem.attrib): + key = (elem.get('name'),elem.get('api')) + else: + key = elem.get('name') + if key in dictionary: + self.gen.logMsg('warn', '*** Attempt to redefine', + infoName, 'with key:', key) + else: + dictionary[key] = info + # + # lookupElementInfo - find a {Type|Enum|Cmd}Info object by name. + # If an object qualified by API name exists, use that. + # fname - name of type / enum / command + # dictionary - self.{type|enum|cmd}dict + def lookupElementInfo(self, fname, dictionary): + key = (fname, self.genOpts.apiname) + if (key in dictionary): + # self.gen.logMsg('diag', 'Found API-specific element for feature', fname) + return dictionary[key] + elif (fname in dictionary): + # self.gen.logMsg('diag', 'Found generic element for feature', fname) + return dictionary[fname] + else: + return None + def parseTree(self): + """Parse the registry Element, once created""" + # This must be the Element for the root + self.reg = self.tree.getroot() + # + # Create dictionary of registry types from toplevel tags + # and add 'name' attribute to each tag (where missing) + # based on its element. + # + # There's usually one block; more are OK + # Required attributes: 'name' or nested tag contents + self.typedict = {} + for type in self.reg.findall('types/type'): + # If the doesn't already have a 'name' attribute, set + # it from contents of its tag. + if (type.get('name') == None): + type.attrib['name'] = type.find('name').text + self.addElementInfo(type, TypeInfo(type), 'type', self.typedict) + # + # Create dictionary of registry groups from toplevel tags. + # + # There's usually one block; more are OK. + # Required attributes: 'name' + self.groupdict = {} + for group in self.reg.findall('groups/group'): + self.addElementInfo(group, GroupInfo(group), 'group', self.groupdict) + # + # Create dictionary of registry enums from toplevel tags + # + # There are usually many tags in different namespaces, but + # these are functional namespaces of the values, while the actual + # enum names all share the dictionary. + # Required attributes: 'name', 'value' + self.enumdict = {} + for enum in self.reg.findall('enums/enum'): + self.addElementInfo(enum, EnumInfo(enum), 'enum', self.enumdict) + # + # Create dictionary of registry commands from tags + # and add 'name' attribute to each tag (where missing) + # based on its element. + # + # There's usually only one block; more are OK. + # Required attributes: 'name' or tag contents + self.cmddict = {} + for cmd in self.reg.findall('commands/command'): + # If the doesn't already have a 'name' attribute, set + # it from contents of its tag. + if (cmd.get('name') == None): + cmd.attrib['name'] = cmd.find('proto/name').text + ci = CmdInfo(cmd) + self.addElementInfo(cmd, ci, 'command', self.cmddict) + # + # Create dictionaries of API and extension interfaces + # from toplevel and tags. + # + self.apidict = {} + for feature in self.reg.findall('feature'): + ai = FeatureInfo(feature) + self.addElementInfo(feature, ai, 'feature', self.apidict) + self.extensions = self.reg.findall('extensions/extension') + self.extdict = {} + for feature in self.extensions: + ei = FeatureInfo(feature) + self.addElementInfo(feature, ei, 'extension', self.extdict) + def dumpReg(self, maxlen = 40, filehandle = sys.stdout): + """Dump all the dictionaries constructed from the Registry object""" + write('***************************************', file=filehandle) + write(' ** Dumping Registry contents **', file=filehandle) + write('***************************************', file=filehandle) + write('// Types', file=filehandle) + for name in self.typedict: + tobj = self.typedict[name] + write(' Type', name, '->', etree.tostring(tobj.elem)[0:maxlen], file=filehandle) + write('// Groups', file=filehandle) + for name in self.groupdict: + gobj = self.groupdict[name] + write(' Group', name, '->', etree.tostring(gobj.elem)[0:maxlen], file=filehandle) + write('// Enums', file=filehandle) + for name in self.enumdict: + eobj = self.enumdict[name] + write(' Enum', name, '->', etree.tostring(eobj.elem)[0:maxlen], file=filehandle) + write('// Commands', file=filehandle) + for name in self.cmddict: + cobj = self.cmddict[name] + write(' Command', name, '->', etree.tostring(cobj.elem)[0:maxlen], file=filehandle) + write('// APIs', file=filehandle) + for key in self.apidict: + write(' API Version ', key, '->', + etree.tostring(self.apidict[key].elem)[0:maxlen], file=filehandle) + write('// Extensions', file=filehandle) + for key in self.extdict: + write(' Extension', key, '->', + etree.tostring(self.extdict[key].elem)[0:maxlen], file=filehandle) + # write('***************************************', file=filehandle) + # write(' ** Dumping XML ElementTree **', file=filehandle) + # write('***************************************', file=filehandle) + # write(etree.tostring(self.tree.getroot(),pretty_print=True), file=filehandle) + # + # typename - name of type + # required - boolean (to tag features as required or not) + def markTypeRequired(self, typename, required): + """Require (along with its dependencies) or remove (but not its dependencies) a type""" + self.gen.logMsg('diag', '*** tagging type:', typename, '-> required =', required) + # Get TypeInfo object for tag corresponding to typename + type = self.lookupElementInfo(typename, self.typedict) + if (type != None): + # Tag required type dependencies as required. + # This DOES NOT un-tag dependencies in a tag. + # See comments in markRequired() below for the reason. + if (required and ('requires' in type.elem.attrib)): + depType = type.elem.get('requires') + self.gen.logMsg('diag', '*** Generating dependent type', + depType, 'for type', typename) + self.markTypeRequired(depType, required) + type.required = required + else: + self.gen.logMsg('warn', '*** type:', typename , 'IS NOT DEFINED') + # + # features - Element for or tag + # required - boolean (to tag features as required or not) + def markRequired(self, features, required): + """Require or remove features specified in the Element""" + self.gen.logMsg('diag', '*** markRequired (features = , required =', required, ')') + # Loop over types, enums, and commands in the tag + # @@ It would be possible to respect 'api' and 'profile' attributes + # in individual features, but that's not done yet. + for typeElem in features.findall('type'): + self.markTypeRequired(typeElem.get('name'), required) + for enumElem in features.findall('enum'): + name = enumElem.get('name') + self.gen.logMsg('diag', '*** tagging enum:', name, '-> required =', required) + enum = self.lookupElementInfo(name, self.enumdict) + if (enum != None): + enum.required = required + else: + self.gen.logMsg('warn', '*** enum:', name , 'IS NOT DEFINED') + for cmdElem in features.findall('command'): + name = cmdElem.get('name') + self.gen.logMsg('diag', '*** tagging command:', name, '-> required =', required) + cmd = self.lookupElementInfo(name, self.cmddict) + if (cmd != None): + cmd.required = required + # Tag all parameter types of this command as required. + # This DOES NOT remove types of commands in a + # tag, because many other commands may use the same type. + # We could be more clever and reference count types, + # instead of using a boolean. + if (required): + # Look for in entire tree, + # not just immediate children + for ptype in cmd.elem.findall('.//ptype'): + self.gen.logMsg('diag', '*** markRequired: command implicitly requires dependent type', ptype.text) + self.markTypeRequired(ptype.text, required) + else: + self.gen.logMsg('warn', '*** command:', name, 'IS NOT DEFINED') + # + # interface - Element for or , containing + # and tags + # api - string specifying API name being generated + # profile - string specifying API profile being generated + def requireAndRemoveFeatures(self, interface, api, profile): + """Process and tags for a or """ + # marks things that are required by this version/profile + for feature in interface.findall('require'): + if (matchAPIProfile(api, profile, feature)): + self.markRequired(feature,True) + # marks things that are removed by this version/profile + for feature in interface.findall('remove'): + if (matchAPIProfile(api, profile, feature)): + self.markRequired(feature,False) + # + # generateFeature - generate a single type / enum / command, + # and all its dependencies as needed. + # fname - name of feature (// + # ftype - type of feature, 'type' | 'enum' | 'command' + # dictionary - of *Info objects - self.{type|enum|cmd}dict + # genProc - bound function pointer for self.gen.gen{Type|Enum|Cmd} + def generateFeature(self, fname, ftype, dictionary, genProc): + f = self.lookupElementInfo(fname, dictionary) + if (f == None): + # No such feature. This is an error, but reported earlier + self.gen.logMsg('diag', '*** No entry found for feature', fname, + 'returning!') + return + # + # If feature isn't required, or has already been declared, return + if (not f.required): + self.gen.logMsg('diag', '*** Skipping', ftype, fname, '(not required)') + return + if (f.declared): + self.gen.logMsg('diag', '*** Skipping', ftype, fname, '(already declared)') + return + # + # Pull in dependent type declaration(s) of the feature. + # For types, there may be one in the 'required' attribute of the element + # For commands, there may be many in tags within the element + # For enums, no dependencies are allowed (though perhasps if you + # have a uint64 enum, it should require GLuint64) + if (ftype == 'type'): + if ('requires' in f.elem.attrib): + depname = f.elem.get('requires') + self.gen.logMsg('diag', '*** Generating required dependent type', + depname) + self.generateFeature(depname, 'type', self.typedict, + self.gen.genType) + elif (ftype == 'command'): + for ptype in f.elem.findall('.//ptype'): + depname = ptype.text + self.gen.logMsg('diag', '*** Generating required parameter type', + depname) + self.generateFeature(depname, 'type', self.typedict, + self.gen.genType) + # + # Actually generate the type only if emitting declarations + if self.emitFeatures: + self.gen.logMsg('diag', '*** Emitting', ftype, 'decl for', fname) + genProc(f, fname) + else: + self.gen.logMsg('diag', '*** Skipping', ftype, fname, + '(not emitting this feature)') + # Always mark feature declared, as though actually emitted + f.declared = True + # + # generateRequiredInterface - generate all interfaces required + # by an API version or extension + # interface - Element for or + def generateRequiredInterface(self, interface): + """Generate required C interface for specified API version/extension""" + # + # Loop over all features inside all tags. + # tags are ignored (handled in pass 1). + for features in interface.findall('require'): + for t in features.findall('type'): + self.generateFeature(t.get('name'), 'type', self.typedict, + self.gen.genType) + for e in features.findall('enum'): + self.generateFeature(e.get('name'), 'enum', self.enumdict, + self.gen.genEnum) + for c in features.findall('command'): + self.generateFeature(c.get('name'), 'command', self.cmddict, + self.gen.genCmd) + # + # apiGen(genOpts) - generate interface for specified versions + # genOpts - GeneratorOptions object with parameters used + # by the Generator object. + def apiGen(self, genOpts): + """Generate interfaces for the specified API type and range of versions""" + # + self.gen.logMsg('diag', '*******************************************') + self.gen.logMsg('diag', ' Registry.apiGen file:', genOpts.filename, + 'api:', genOpts.apiname, + 'profile:', genOpts.profile) + self.gen.logMsg('diag', '*******************************************') + # + self.genOpts = genOpts + # Reset required/declared flags for all features + self.apiReset() + # + # Compile regexps used to select versions & extensions + regVersions = re.compile(self.genOpts.versions) + regEmitVersions = re.compile(self.genOpts.emitversions) + regAddExtensions = re.compile(self.genOpts.addExtensions) + regRemoveExtensions = re.compile(self.genOpts.removeExtensions) + # + # Get all matching API versions & add to list of FeatureInfo + features = [] + apiMatch = False + for key in self.apidict: + fi = self.apidict[key] + api = fi.elem.get('api') + if (api == self.genOpts.apiname): + apiMatch = True + if (regVersions.match(fi.number)): + # Matches API & version #s being generated. Mark for + # emission and add to the features[] list . + # @@ Could use 'declared' instead of 'emit'? + fi.emit = (regEmitVersions.match(fi.number) != None) + features.append(fi) + if (not fi.emit): + self.gen.logMsg('diag', '*** NOT tagging feature api =', api, + 'name =', fi.name, 'number =', fi.number, + 'for emission (does not match emitversions pattern)') + else: + self.gen.logMsg('diag', '*** NOT including feature api =', api, + 'name =', fi.name, 'number =', fi.number, + '(does not match requested versions)') + else: + self.gen.logMsg('diag', '*** NOT including feature api =', api, + 'name =', fi.name, + '(does not match requested API)') + if (not apiMatch): + self.gen.logMsg('warn', '*** No matching API versions found!') + # + # Get all matching extensions & add to the list. + # Start with extensions tagged with 'api' pattern matching the API + # being generated. Add extensions matching the pattern specified in + # regExtensions, then remove extensions matching the pattern + # specified in regRemoveExtensions + for key in self.extdict: + ei = self.extdict[key] + extName = ei.name + include = False + # + # Include extension if defaultExtensions is not None and if the + # 'supported' attribute matches defaultExtensions. The regexp in + # 'supported' must exactly match defaultExtensions, so bracket + # it with ^(pat)$. + pat = '^(' + ei.elem.get('supported') + ')$' + if (self.genOpts.defaultExtensions and + re.match(pat, self.genOpts.defaultExtensions)): + self.gen.logMsg('diag', '*** Including extension', + extName, "(defaultExtensions matches the 'supported' attribute)") + include = True + # + # Include additional extensions if the extension name matches + # the regexp specified in the generator options. This allows + # forcing extensions into an interface even if they're not + # tagged appropriately in the registry. + if (regAddExtensions.match(extName) != None): + self.gen.logMsg('diag', '*** Including extension', + extName, '(matches explicitly requested extensions to add)') + include = True + # Remove extensions if the name matches the regexp specified + # in generator options. This allows forcing removal of + # extensions from an interface even if they're tagged that + # way in the registry. + if (regRemoveExtensions.match(extName) != None): + self.gen.logMsg('diag', '*** Removing extension', + extName, '(matches explicitly requested extensions to remove)') + include = False + # + # If the extension is to be included, add it to the + # extension features list. + if (include): + ei.emit = True + features.append(ei) + else: + self.gen.logMsg('diag', '*** NOT including extension', + extName, '(does not match api attribute or explicitly requested extensions)') + # + # Sort the extension features list, if a sort procedure is defined + if (self.genOpts.sortProcedure): + self.genOpts.sortProcedure(features) + # + # Pass 1: loop over requested API versions and extensions tagging + # types/commands/features as required (in an block) or no + # longer required (in an block). It is possible to remove + # a feature in one version and restore it later by requiring it in + # a later version. + # If a profile other than 'None' is being generated, it must + # match the profile attribute (if any) of the and + # tags. + self.gen.logMsg('diag', '*** PASS 1: TAG FEATURES ********************************************') + for f in features: + self.gen.logMsg('diag', '*** PASS 1: Tagging required and removed features for', + f.name) + self.requireAndRemoveFeatures(f.elem, self.genOpts.apiname, self.genOpts.profile) + # + # Pass 2: loop over specified API versions and extensions printing + # declarations for required things which haven't already been + # generated. + self.gen.logMsg('diag', '*** PASS 2: GENERATE INTERFACES FOR FEATURES ************************') + self.gen.beginFile(self.genOpts) + for f in features: + self.gen.logMsg('diag', '*** PASS 2: Generating interface for', + f.name) + emit = self.emitFeatures = f.emit + if (not emit): + self.gen.logMsg('diag', '*** PASS 2: NOT declaring feature', + f.elem.get('name'), 'because it is not tagged for emission') + # Generate the interface (or just tag its elements as having been + # emitted, if they haven't been). + self.gen.beginFeature(f.elem, emit) + self.generateRequiredInterface(f.elem) + self.gen.endFeature() + self.gen.endFile() + # + # apiReset - use between apiGen() calls to reset internal state + # + def apiReset(self): + """Reset type/enum/command dictionaries before generating another API""" + for type in self.typedict: + self.typedict[type].resetState() + for enum in self.enumdict: + self.enumdict[enum].resetState() + for cmd in self.cmddict: + self.cmddict[cmd].resetState() + for cmd in self.apidict: + self.apidict[cmd].resetState() + # + # validateGroups - check that group= attributes match actual groups + # + def validateGroups(self): + """Validate group= attributes on and tags""" + # Keep track of group names not in tags + badGroup = {} + self.gen.logMsg('diag', '*** VALIDATING GROUP ATTRIBUTES ***') + for cmd in self.reg.findall('commands/command'): + proto = cmd.find('proto') + funcname = cmd.find('proto/name').text + if ('group' in proto.attrib.keys()): + group = proto.get('group') + # self.gen.logMsg('diag', '*** Command ', funcname, ' has return group ', group) + if (group not in self.groupdict.keys()): + # self.gen.logMsg('diag', '*** Command ', funcname, ' has UNKNOWN return group ', group) + if (group not in badGroup.keys()): + badGroup[group] = 1 + else: + badGroup[group] = badGroup[group] + 1 + for param in cmd.findall('param'): + pname = param.find('name') + if (pname != None): + pname = pname.text + else: + pname = type.get('name') + if ('group' in param.attrib.keys()): + group = param.get('group') + if (group not in self.groupdict.keys()): + # self.gen.logMsg('diag', '*** Command ', funcname, ' param ', pname, ' has UNKNOWN group ', group) + if (group not in badGroup.keys()): + badGroup[group] = 1 + else: + badGroup[group] = badGroup[group] + 1 + if (len(badGroup.keys()) > 0): + self.gen.logMsg('diag', '*** SUMMARY OF UNRECOGNIZED GROUPS ***') + for key in sorted(badGroup.keys()): + self.gen.logMsg('diag', ' ', key, ' occurred ', badGroup[key], ' times') diff --git a/third_party/rust/khronos_api/api/registry.rnc b/third_party/rust/khronos_api/api/registry.rnc new file mode 100755 index 000000000000..248f50030285 --- /dev/null +++ b/third_party/rust/khronos_api/api/registry.rnc @@ -0,0 +1,288 @@ +# Copyright (c) 2013 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and/or associated documentation files (the +# "Materials"), to deal in the Materials without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Materials, and to +# permit persons to whom the Materials are 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 Materials. +# +# THE MATERIALS ARE 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 +# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +# Relax NG schema for Khronos Registry XML +# See http://www.opengl.org/registry/ +# +# Last modified 2013/06/14 +# This definition is subject to change (mostly in the form of additions) + +namespace xsd = "http://www.w3.org/2001/XMLSchema-datatypes" + +# Toplevel is a tag. +# May be led by an optional tag containing e.g. copyrights. +start = element registry { + ( + element comment { text } ? | + Types * | + Groups * | + Enums * | + Commands * | + Feature * | + Extensions * + ) * +} + +# defines a group of types +Types = element types { + Type * +} + +# defines a single type. It is usually a C typedef but +# may contain arbitrary C code. +# name - name of this type, if not present in the tag +# api - matches a api attribute, if present +# requires - name of another type definition required by this one +# type - "group", if present, indicating a group of values in the +# corresponding definition. +# comment - unused +# - substitutes for an APIENTRY-style macro on output +# - contains typename +Type = element type { + attribute api { text } ? , + attribute requires { text } ? , + attribute name { TypeName } ? , + attribute type { text } ? , + Comment ? , + text , + element apientry { text } ? , + text , + element name { TypeName } ? , + text +} + +# defines a group of enum groups +Groups = element groups { + Group * +} + +# defines a single enum group. Enums may +# be in multiple groups. +# name - group name +# comment - unused +# - members of the group + +Group = element group { + Name , + Comment ? , + element enum { Name } * +} + +# defines a group of enumerants +# namespace - identifies a numeric namespace +# group - identifies a functional subset of the namespace - same as +# start, end - beginning and end of a numeric range in the namespace +# vendor - owner of the numeric range +# type - "bitmask", if present +# comment - unused +Enums = element enums { + attribute namespace { text } ? , + attribute group { text } ? , + attribute type { text } ? , + attribute start { Integer } ? , + attribute end { Integer } ? , + Vendor ? , + Comment ? , + (Enum | Unused) * +} +# defines a single enumerant +# value - integer (including hex) value of the enumerant +# api - matches a api attribute, if present +# type - "u" (unsigned), "ull" (uint64), or integer if not present +# name - enumerant name +# alias - another enumerant this is semantically identical to +# comment - unused +Enum = element enum { + ( + attribute value { Integer } & + attribute api { text } ? & + attribute type { TypeSuffix } ? & + attribute name { text } & + attribute alias { text } ? & + Comment ? + ) +} +# defines a range of enumerants not currently being used +# start, end - beginning and end of an unused numeric range +# vendor - unused +# comment - unused +Unused = element unused { + attribute start { Integer } , + attribute end { Integer } ? , + Vendor ? , + Comment ? +} +# defines a group of commands +# namespace - identifies a function namespace +Commands = element commands { + attribute namespace { text } ? , + Command * +} +# defines a single command +# is the C function prototype, including the return type +# are function parameters, in order +# is a name, if present +# is the function / parameter name +# The textual contents of and should be legal C +# for those parts of a function declaration. +# - denotes function aliasing +# name - name of aliased function +# - denotes scalar / vector function equivalence +# name - name of corresponding vector form, e.g. (glColor3f -> glColor3fv) +# - information about GLX protocol +# type - "render", "single", or "vendor" for GLXRender, GLXSingle, GLXVendorPrivate{WithReply} +# opcode - numeric opcode of specified type for this function +# name - if present, protocol name (defaults to command name) +# comment - unused +Command = element command { + Comment ? , + element proto { + attribute group { text } ? , + text , + element ptype { TypeName } ? , + text , + element name { text } , + text + } , + element param { + attribute group { text } ? , + attribute len { text } ? , + text , + element ptype { TypeName } ? , + text , + element name { text } , + text + } * , + ( + element alias { + Name + } ? & + element vecequiv { + Name + } ? & + element glx { + attribute type { text } , + attribute opcode { xsd:integer } , + Name ? , + Comment ? + } * + ) +} +# Each defines the interface of an API version (e.g. OpenGL 1.2) +# api - API tag (e.g. 'gl', 'gles2', etc. - used internally, not +# neccessarily an actual API name +# name - version name (C preprocessor name, e.g. GL_VERSION_4_2) +# number - version number, e.g. 4.2 +# protect - additional #ifdef symbol to place around the feature +# / contains features to require or remove in +# this version +# profile - only require/remove when generated profile matches +# comment - unused +Feature = element feature { + attribute api { text } , + Name , + attribute number { xsd:float } , + attribute protect { text } ?, + Comment ? , + ( + element require { + ProfileName ? , + Comment ? , + InterfaceElement * + } | + element remove { + ProfileName ? , + Comment ? , + InterfaceElement * + } + ) * +} +Extensions = element extensions { + Extension * +} +# Defines the interface of an API . Like a +# tag, but with a slightly different api attribute. +# api - regexp pattern matching one or more API tags, indicating +# which APIs the extension is known to work with. The only +# syntax supported is {|}* and each name must +# exactly match an API being generated (implicit ^$ surrounding). +# In addition, / tags also support an +# api attribute: +# api - only require/remove these features for the matching API. +# Not a regular expression. +Extension = element extension { + Name , + attribute protect { text } ?, + attribute supported { StringGroup } ? , + Comment ? , + ( + element require { + attribute api { text } ? , + ProfileName ? , + Comment ? , + InterfaceElement * + } | + element remove { + attribute api { text } ? , + ProfileName ? , + Comment ? , + InterfaceElement * + } + ) * +} +# Contents of a / tag, defining a group +# of features to require or remove. +# / / all have attributes +# name - feature name which must match +InterfaceElement = + element type { + Name , + Comment ? + } | + element enum { + Name , + Comment ? + } | + element command { + Name , + Comment ? + } + +# Integers are allowed to be either decimal or C-hex (0x[0-9A-F]+), but +# XML Schema types don't seem to support hex notation, so we use this +# as a placeholder. +Integer = text + +# TypeName is an argument/return value C type name +TypeName = text + +# TypeSuffix is a C numeric type suffix, e.g. 'u' or 'ull' +TypeSuffix = text + +# StringGroup is a regular expression with an implicit +# '^(' and ')$' bracketing it. +StringGroup = text + +# Repeatedly used attributes +ProfileName = attribute profile { text } +Vendor = attribute vendor { text } +Comment = attribute comment { text } +Name = attribute name { text } diff --git a/third_party/rust/khronos_api/api/wgl.xml b/third_party/rust/khronos_api/api/wgl.xml new file mode 100755 index 000000000000..20ecd593d6a9 --- /dev/null +++ b/third_party/rust/khronos_api/api/wgl.xml @@ -0,0 +1,1967 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + struct _GPU_DEVICE { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; +}; + + DECLARE_HANDLE(HPBUFFERARB); + DECLARE_HANDLE(HPBUFFEREXT); + DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); + DECLARE_HANDLE(HPVIDEODEV); + DECLARE_HANDLE(HPGPUNV); + DECLARE_HANDLE(HGPUNV); + DECLARE_HANDLE(HVIDEOINPUTDEVICENV); + typedef struct _GPU_DEVICE GPU_DEVICE; + typedef struct _GPU_DEVICE *PGPU_DEVICE; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + int ChoosePixelFormat + HDC hDc + const PIXELFORMATDESCRIPTOR *pPfd + + + int DescribePixelFormat + HDC hdc + int ipfd + UINT cjpfd + const PIXELFORMATDESCRIPTOR *ppfd + + + int GetPixelFormat + HDC hdc + + + BOOL SetPixelFormat + HDC hdc + int ipfd + const PIXELFORMATDESCRIPTOR *ppfd + + + BOOL SwapBuffers + HDC hdc + + + void *wglAllocateMemoryNV + GLsizei size + GLfloat readfreq + GLfloat writefreq + GLfloat priority + + + BOOL wglAssociateImageBufferEventsI3D + HDC hDC + const HANDLE *pEvent + const LPVOID *pAddress + const DWORD *pSize + UINT count + + + BOOL wglBeginFrameTrackingI3D + + + GLboolean wglBindDisplayColorTableEXT + GLushort id + + + BOOL wglBindSwapBarrierNV + GLuint group + GLuint barrier + + + BOOL wglBindTexImageARB + HPBUFFERARB hPbuffer + int iBuffer + + + BOOL wglBindVideoCaptureDeviceNV + UINT uVideoSlot + HVIDEOINPUTDEVICENV hDevice + + + BOOL wglBindVideoDeviceNV + HDC hDC + unsigned int uVideoSlot + HVIDEOOUTPUTDEVICENV hVideoDevice + const int *piAttribList + + + BOOL wglBindVideoImageNV + HPVIDEODEV hVideoDevice + HPBUFFERARB hPbuffer + int iVideoBuffer + + + VOID wglBlitContextFramebufferAMD + HGLRC dstCtx + GLint srcX0 + GLint srcY0 + GLint srcX1 + GLint srcY1 + GLint dstX0 + GLint dstY0 + GLint dstX1 + GLint dstY1 + GLbitfield mask + GLenum filter + + + BOOL wglChoosePixelFormatARB + HDC hdc + const int *piAttribIList + const FLOAT *pfAttribFList + UINT nMaxFormats + int *piFormats + UINT *nNumFormats + + + BOOL wglChoosePixelFormatEXT + HDC hdc + const int *piAttribIList + const FLOAT *pfAttribFList + UINT nMaxFormats + int *piFormats + UINT *nNumFormats + + + BOOL wglCopyContext + HGLRC hglrcSrc + HGLRC hglrcDst + UINT mask + + + BOOL wglCopyImageSubDataNV + HGLRC hSrcRC + GLuint srcName + GLenum srcTarget + GLint srcLevel + GLint srcX + GLint srcY + GLint srcZ + HGLRC hDstRC + GLuint dstName + GLenum dstTarget + GLint dstLevel + GLint dstX + GLint dstY + GLint dstZ + GLsizei width + GLsizei height + GLsizei depth + + + HDC wglCreateAffinityDCNV + const HGPUNV *phGpuList + + + HGLRC wglCreateAssociatedContextAMD + UINT id + + + HGLRC wglCreateAssociatedContextAttribsAMD + UINT id + HGLRC hShareContext + const int *attribList + + + HANDLE wglCreateBufferRegionARB + HDC hDC + int iLayerPlane + UINT uType + + + HGLRC wglCreateContext + HDC hDc + + + HGLRC wglCreateContextAttribsARB + HDC hDC + HGLRC hShareContext + const int *attribList + + + GLboolean wglCreateDisplayColorTableEXT + GLushort id + + + LPVOID wglCreateImageBufferI3D + HDC hDC + DWORD dwSize + UINT uFlags + + + HGLRC wglCreateLayerContext + HDC hDc + int level + + + HPBUFFERARB wglCreatePbufferARB + HDC hDC + int iPixelFormat + int iWidth + int iHeight + const int *piAttribList + + + HPBUFFEREXT wglCreatePbufferEXT + HDC hDC + int iPixelFormat + int iWidth + int iHeight + const int *piAttribList + + + BOOL wglDelayBeforeSwapNV + HDC hDC + GLfloat seconds + + + BOOL wglDeleteAssociatedContextAMD + HGLRC hglrc + + + VOID wglDeleteBufferRegionARB + HANDLE hRegion + + + BOOL wglDeleteContext + HGLRC oldContext + + + BOOL wglDeleteDCNV + HDC hdc + + + BOOL wglDescribeLayerPlane + HDC hDc + int pixelFormat + int layerPlane + UINT nBytes + const LAYERPLANEDESCRIPTOR *plpd + + + VOID wglDestroyDisplayColorTableEXT + GLushort id + + + BOOL wglDestroyImageBufferI3D + HDC hDC + LPVOID pAddress + + + BOOL wglDestroyPbufferARB + HPBUFFERARB hPbuffer + + + BOOL wglDestroyPbufferEXT + HPBUFFEREXT hPbuffer + + + BOOL wglDisableFrameLockI3D + + + BOOL wglDisableGenlockI3D + HDC hDC + + + BOOL wglDXCloseDeviceNV + HANDLE hDevice + + + BOOL wglDXLockObjectsNV + HANDLE hDevice + GLint count + HANDLE *hObjects + + + BOOL wglDXObjectAccessNV + HANDLE hObject + GLenum access + + + HANDLE wglDXOpenDeviceNV + void *dxDevice + + + HANDLE wglDXRegisterObjectNV + HANDLE hDevice + void *dxObject + GLuint name + GLenum type + GLenum access + + + BOOL wglDXSetResourceShareHandleNV + void *dxObject + HANDLE shareHandle + + + BOOL wglDXUnlockObjectsNV + HANDLE hDevice + GLint count + HANDLE *hObjects + + + BOOL wglDXUnregisterObjectNV + HANDLE hDevice + HANDLE hObject + + + BOOL wglEnableFrameLockI3D + + + BOOL wglEnableGenlockI3D + HDC hDC + + + BOOL wglEndFrameTrackingI3D + + + UINT wglEnumerateVideoCaptureDevicesNV + HDC hDc + HVIDEOINPUTDEVICENV *phDeviceList + + + int wglEnumerateVideoDevicesNV + HDC hDC + HVIDEOOUTPUTDEVICENV *phDeviceList + + + BOOL wglEnumGpuDevicesNV + HGPUNV hGpu + UINT iDeviceIndex + PGPU_DEVICE lpGpuDevice + + + BOOL wglEnumGpusFromAffinityDCNV + HDC hAffinityDC + UINT iGpuIndex + HGPUNV *hGpu + + + BOOL wglEnumGpusNV + UINT iGpuIndex + HGPUNV *phGpu + + + void wglFreeMemoryNV + void *pointer + + + BOOL wglGenlockSampleRateI3D + HDC hDC + UINT uRate + + + BOOL wglGenlockSourceDelayI3D + HDC hDC + UINT uDelay + + + BOOL wglGenlockSourceEdgeI3D + HDC hDC + UINT uEdge + + + BOOL wglGenlockSourceI3D + HDC hDC + UINT uSource + + + UINT wglGetContextGPUIDAMD + HGLRC hglrc + + + HGLRC wglGetCurrentAssociatedContextAMD + + + HGLRC wglGetCurrentContext + + + HDC wglGetCurrentDC + + + HDC wglGetCurrentReadDCARB + + + HDC wglGetCurrentReadDCEXT + + + PROC wglGetDefaultProcAddress + LPCSTR lpszProc + + + BOOL wglGetDigitalVideoParametersI3D + HDC hDC + int iAttribute + int *piValue + + + UINT GetEnhMetaFilePixelFormat + HENHMETAFILE hemf + const PIXELFORMATDESCRIPTOR *ppfd + + + const char *wglGetExtensionsStringARB + HDC hdc + + + const char *wglGetExtensionsStringEXT + + + BOOL wglGetFrameUsageI3D + float *pUsage + + + BOOL wglGetGammaTableI3D + HDC hDC + int iEntries + USHORT *puRed + USHORT *puGreen + USHORT *puBlue + + + BOOL wglGetGammaTableParametersI3D + HDC hDC + int iAttribute + int *piValue + + + BOOL wglGetGenlockSampleRateI3D + HDC hDC + UINT *uRate + + + BOOL wglGetGenlockSourceDelayI3D + HDC hDC + UINT *uDelay + + + BOOL wglGetGenlockSourceEdgeI3D + HDC hDC + UINT *uEdge + + + BOOL wglGetGenlockSourceI3D + HDC hDC + UINT *uSource + + + UINT wglGetGPUIDsAMD + UINT maxCount + UINT *ids + + + INT wglGetGPUInfoAMD + UINT id + int property + GLenum dataType + UINT size + void *data + + + int wglGetLayerPaletteEntries + HDC hdc + int iLayerPlane + int iStart + int cEntries + const COLORREF *pcr + + + BOOL wglGetMscRateOML + HDC hdc + INT32 *numerator + INT32 *denominator + + + HDC wglGetPbufferDCARB + HPBUFFERARB hPbuffer + + + HDC wglGetPbufferDCEXT + HPBUFFEREXT hPbuffer + + + BOOL wglGetPixelFormatAttribfvARB + HDC hdc + int iPixelFormat + int iLayerPlane + UINT nAttributes + const int *piAttributes + FLOAT *pfValues + + + BOOL wglGetPixelFormatAttribfvEXT + HDC hdc + int iPixelFormat + int iLayerPlane + UINT nAttributes + int *piAttributes + FLOAT *pfValues + + + BOOL wglGetPixelFormatAttribivARB + HDC hdc + int iPixelFormat + int iLayerPlane + UINT nAttributes + const int *piAttributes + int *piValues + + + BOOL wglGetPixelFormatAttribivEXT + HDC hdc + int iPixelFormat + int iLayerPlane + UINT nAttributes + int *piAttributes + int *piValues + + + PROC wglGetProcAddress + LPCSTR lpszProc + + + int wglGetSwapIntervalEXT + + + BOOL wglGetSyncValuesOML + HDC hdc + INT64 *ust + INT64 *msc + INT64 *sbc + + + BOOL wglGetVideoDeviceNV + HDC hDC + int numDevices + HPVIDEODEV *hVideoDevice + + + BOOL wglGetVideoInfoNV + HPVIDEODEV hpVideoDevice + unsigned long *pulCounterOutputPbuffer + unsigned long *pulCounterOutputVideo + + + BOOL wglIsEnabledFrameLockI3D + BOOL *pFlag + + + BOOL wglIsEnabledGenlockI3D + HDC hDC + BOOL *pFlag + + + BOOL wglJoinSwapGroupNV + HDC hDC + GLuint group + + + GLboolean wglLoadDisplayColorTableEXT + const GLushort *table + GLuint length + + + BOOL wglLockVideoCaptureDeviceNV + HDC hDc + HVIDEOINPUTDEVICENV hDevice + + + BOOL wglMakeAssociatedContextCurrentAMD + HGLRC hglrc + + + BOOL wglMakeContextCurrentARB + HDC hDrawDC + HDC hReadDC + HGLRC hglrc + + + BOOL wglMakeContextCurrentEXT + HDC hDrawDC + HDC hReadDC + HGLRC hglrc + + + BOOL wglMakeCurrent + HDC hDc + HGLRC newContext + + + BOOL wglQueryCurrentContextNV + int iAttribute + int *piValue + + + BOOL wglQueryFrameCountNV + HDC hDC + GLuint *count + + + BOOL wglQueryFrameLockMasterI3D + BOOL *pFlag + + + BOOL wglQueryFrameTrackingI3D + DWORD *pFrameCount + DWORD *pMissedFrames + float *pLastMissedUsage + + + BOOL wglQueryGenlockMaxSourceDelayI3D + HDC hDC + UINT *uMaxLineDelay + UINT *uMaxPixelDelay + + + BOOL wglQueryMaxSwapGroupsNV + HDC hDC + GLuint *maxGroups + GLuint *maxBarriers + + + BOOL wglQueryPbufferARB + HPBUFFERARB hPbuffer + int iAttribute + int *piValue + + + BOOL wglQueryPbufferEXT + HPBUFFEREXT hPbuffer + int iAttribute + int *piValue + + + BOOL wglQuerySwapGroupNV + HDC hDC + GLuint *group + GLuint *barrier + + + BOOL wglQueryVideoCaptureDeviceNV + HDC hDc + HVIDEOINPUTDEVICENV hDevice + int iAttribute + int *piValue + + + BOOL wglRealizeLayerPalette + HDC hdc + int iLayerPlane + BOOL bRealize + + + BOOL wglReleaseImageBufferEventsI3D + HDC hDC + const LPVOID *pAddress + UINT count + + + int wglReleasePbufferDCARB + HPBUFFERARB hPbuffer + HDC hDC + + + int wglReleasePbufferDCEXT + HPBUFFEREXT hPbuffer + HDC hDC + + + BOOL wglReleaseTexImageARB + HPBUFFERARB hPbuffer + int iBuffer + + + BOOL wglReleaseVideoCaptureDeviceNV + HDC hDc + HVIDEOINPUTDEVICENV hDevice + + + BOOL wglReleaseVideoDeviceNV + HPVIDEODEV hVideoDevice + + + BOOL wglReleaseVideoImageNV + HPBUFFERARB hPbuffer + int iVideoBuffer + + + BOOL wglResetFrameCountNV + HDC hDC + + + BOOL wglRestoreBufferRegionARB + HANDLE hRegion + int x + int y + int width + int height + int xSrc + int ySrc + + + BOOL wglSaveBufferRegionARB + HANDLE hRegion + int x + int y + int width + int height + + + BOOL wglSendPbufferToVideoNV + HPBUFFERARB hPbuffer + int iBufferType + unsigned long *pulCounterPbuffer + BOOL bBlock + + + BOOL wglSetDigitalVideoParametersI3D + HDC hDC + int iAttribute + const int *piValue + + + BOOL wglSetGammaTableI3D + HDC hDC + int iEntries + const USHORT *puRed + const USHORT *puGreen + const USHORT *puBlue + + + BOOL wglSetGammaTableParametersI3D + HDC hDC + int iAttribute + const int *piValue + + + int wglSetLayerPaletteEntries + HDC hdc + int iLayerPlane + int iStart + int cEntries + const COLORREF *pcr + + + BOOL wglSetPbufferAttribARB + HPBUFFERARB hPbuffer + const int *piAttribList + + + BOOL wglSetStereoEmitterState3DL + HDC hDC + UINT uState + + + BOOL wglShareLists + HGLRC hrcSrvShare + HGLRC hrcSrvSource + + + INT64 wglSwapBuffersMscOML + HDC hdc + INT64 target_msc + INT64 divisor + INT64 remainder + + + BOOL wglSwapLayerBuffers + HDC hdc + UINT fuFlags + + + BOOL wglSwapIntervalEXT + int interval + + + INT64 wglSwapLayerBuffersMscOML + HDC hdc + int fuPlanes + INT64 target_msc + INT64 divisor + INT64 remainder + + + BOOL wglUseFontBitmaps + HDC hDC + DWORD first + DWORD count + DWORD listBase + + + BOOL wglUseFontBitmapsA + HDC hDC + DWORD first + DWORD count + DWORD listBase + + + BOOL wglUseFontBitmapsW + HDC hDC + DWORD first + DWORD count + DWORD listBase + + + BOOL wglUseFontOutlines + HDC hDC + DWORD first + DWORD count + DWORD listBase + FLOAT deviation + FLOAT extrusion + int format + LPGLYPHMETRICSFLOAT lpgmf + + + BOOL wglUseFontOutlinesA + HDC hDC + DWORD first + DWORD count + DWORD listBase + FLOAT deviation + FLOAT extrusion + int format + LPGLYPHMETRICSFLOAT lpgmf + + + BOOL wglUseFontOutlinesW + HDC hDC + DWORD first + DWORD count + DWORD listBase + FLOAT deviation + FLOAT extrusion + int format + LPGLYPHMETRICSFLOAT lpgmf + + + BOOL wglWaitForMscOML + HDC hdc + INT64 target_msc + INT64 divisor + INT64 remainder + INT64 *ust + INT64 *msc + INT64 *sbc + + + BOOL wglWaitForSbcOML + HDC hdc + INT64 target_sbc + INT64 *ust + INT64 *msc + INT64 *sbc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/rust/khronos_api/src/lib.rs b/third_party/rust/khronos_api/src/lib.rs new file mode 100644 index 000000000000..06442225f98a --- /dev/null +++ b/third_party/rust/khronos_api/src/lib.rs @@ -0,0 +1,27 @@ +// Copyright 2015 Brendan Zabarauskas +// +// 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. + +//! This crates contains the sources of the official OpenGL repository. + +/// The contents of [`gl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml) +pub const GL_XML: &'static [u8] = include_bytes!("../api/gl.xml"); + +/// The contents of [`egl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/egl.xml) +pub const EGL_XML: &'static [u8] = include_bytes!("../api/egl.xml"); + +/// The contents of [`wgl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml) +pub const WGL_XML: &'static [u8] = include_bytes!("../api/wgl.xml"); + +/// The contents of [`glx.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/glx.xml) +pub const GLX_XML: &'static [u8] = include_bytes!("../api/glx.xml"); diff --git a/third_party/rust/lazy_static/.cargo-checksum.json b/third_party/rust/lazy_static/.cargo-checksum.json new file mode 100644 index 000000000000..9950899f435f --- /dev/null +++ b/third_party/rust/lazy_static/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"ee9afa8d5e10d088632b66c622d4451a826a4066e0e84052f40b9b3e82c6bec7",".travis.yml":"b6983ce563e5ec756033bfef06e2f2b5f0ac2c1e8eb15803051c1929a328ce30","Cargo.toml":"01ccfeb6f1bfb8320bec14aa4681e4573b35ff0b7514dece1934924ff89bbeac","LICENSE":"79d26c3d855d83d92837c49a868339ec7c2ef7d2a19d7a779ebb4c30d160d90a","README.md":"932d081be16cf7b787400973604712c80b2bc119764c7b742c53cf093cd056fa","src/core_lazy.rs":"fb3e56b2480d2a970e3ac4e3104119b9b22c58b05b6f63dc5b6fd39082faa635","src/lazy.rs":"fcc9cf369e72d52da24307a98317e7001b339948e6063baa449e10294e80e94d","src/lib.rs":"92c3974a0a1c92e75cca75a287ad9241b436b807929854385435d1f4b80931f3","src/nightly_lazy.rs":"31619f7467766127ca049df5d14f82384f6f756db52fc388421ef8a39ba5465f","tests/no_std.rs":"2a5236bd3892a253855b4dc192f63138239165fa23b9c3421a9faa5482c780aa","tests/test.rs":"3133070a63f278c2204dbafa67734453ed003971947521c412b9d366daf62b73"},"package":"6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b"} \ No newline at end of file diff --git a/third_party/rust/lazy_static/.cargo-ok b/third_party/rust/lazy_static/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/lazy_static/.gitignore b/third_party/rust/lazy_static/.gitignore new file mode 100644 index 000000000000..bde55ce91365 --- /dev/null +++ b/third_party/rust/lazy_static/.gitignore @@ -0,0 +1,4 @@ +target +doc +Cargo.lock +.cargo diff --git a/third_party/rust/lazy_static/.travis.yml b/third_party/rust/lazy_static/.travis.yml new file mode 100644 index 000000000000..22802637703d --- /dev/null +++ b/third_party/rust/lazy_static/.travis.yml @@ -0,0 +1,24 @@ +language: rust +rust: +- nightly +- beta +- stable +before_script: +- | + pip install 'travis-cargo<0.2' --user && + export PATH=$HOME/.local/bin:$PATH +script: +- | + travis-cargo build && + travis-cargo test && + travis-cargo bench && + travis-cargo --only nightly build -- --features spin_no_std && + travis-cargo --only nightly test -- --features spin_no_std && + travis-cargo --only nightly bench -- --features spin_no_std && + travis-cargo --only stable doc +after_success: +- travis-cargo --only stable doc-upload +env: + global: + - TRAVIS_CARGO_NIGHTLY_FEATURE=nightly + - secure: YXu24LptjeYirjWYjWGsMT2m3mB7LvQATE6TVo7VEUXv8GYoy2ORIHD83PeImxC93MmZ01QeUezRzuCW51ZcK92VnNSBttlF60SvIX18VsJrV92tsAhievFstqYQ+fB8DIuQ8noU0jPz7GpI+R9dlTRSImAqWOnVIghA+Wzz7Js= diff --git a/third_party/rust/lazy_static/Cargo.toml b/third_party/rust/lazy_static/Cargo.toml new file mode 100644 index 000000000000..303fb6bc6123 --- /dev/null +++ b/third_party/rust/lazy_static/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "lazy_static" +version = "0.2.2" +authors = ["Marvin Löbel "] +license = "MIT" + +description = "A macro for declaring lazily evaluated statics in Rust." +readme = "README.md" +documentation = "http://rust-lang-nursery.github.io/lazy-static.rs/lazy_static/index.html" + +repository = "https://github.com/rust-lang-nursery/lazy-static.rs" +keywords = ["macro", "lazy", "static"] + +[dependencies.spin] +version = "0.4" +optional = true + +[features] +nightly = [] +spin_no_std = ["nightly", "spin"] diff --git a/third_party/rust/lazy_static/LICENSE b/third_party/rust/lazy_static/LICENSE new file mode 100644 index 000000000000..d44255890591 --- /dev/null +++ b/third_party/rust/lazy_static/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Marvin Löbel + +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. \ No newline at end of file diff --git a/third_party/rust/lazy_static/README.md b/third_party/rust/lazy_static/README.md new file mode 100644 index 000000000000..434589ca9818 --- /dev/null +++ b/third_party/rust/lazy_static/README.md @@ -0,0 +1,81 @@ +lazy-static.rs +============== + +[![Travis-CI Status](https://travis-ci.org/rust-lang-nursery/lazy-static.rs.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/lazy-static.rs) + +A macro for declaring lazily evaluated statics in Rust. + +Using this macro, it is possible to have `static`s that require code to be +executed at runtime in order to be initialized. +This includes anything requiring heap allocations, like vectors or hash maps, +as well as anything that requires function calls to be computed. + +# Syntax + +```rust +lazy_static! { + [pub] static ref NAME_1: TYPE_1 = EXPR_1; + [pub] static ref NAME_2: TYPE_2 = EXPR_2; + ... + [pub] static ref NAME_N: TYPE_N = EXPR_N; +} +``` + +# Semantic + +For a given `static ref NAME: TYPE = EXPR;`, the macro generates a +unique type that implements `Deref` and stores it in a static with name `NAME`. + +On first deref, `EXPR` gets evaluated and stored internally, such that all further derefs +can return a reference to the same object. + +Like regular `static mut`s, this macro only works for types that fulfill the `Sync` +trait. + +# Getting Started + +[lazy-static.rs is available on crates.io](https://crates.io/crates/lazy_static). +Add the following dependency to your Cargo manifest to get the latest version of the 0.1 branch: + +```toml +[dependencies] +lazy_static = "0.1.*" +``` + +To always get the latest version, add this git repository to your +Cargo manifest: + +```toml +[dependencies.lazy_static] +git = "https://github.com/rust-lang-nursery/lazy-static.rs" +``` +# Example + +Using the macro: + +```rust +#[macro_use] +extern crate lazy_static; + +use std::collections::HashMap; + +lazy_static! { + static ref HASHMAP: HashMap = { + let mut m = HashMap::new(); + m.insert(0, "foo"); + m.insert(1, "bar"); + m.insert(2, "baz"); + m + }; + static ref COUNT: usize = HASHMAP.len(); + static ref NUMBER: u32 = times_two(21); +} + +fn times_two(n: u32) -> u32 { n * 2 } + +fn main() { + println!("The map has {} entries.", *COUNT); + println!("The entry for `0` is \"{}\".", HASHMAP.get(&0).unwrap()); + println!("An expensive calculation on a static results in: {}.", *NUMBER); +} +``` diff --git a/third_party/rust/lazy_static/src/core_lazy.rs b/third_party/rust/lazy_static/src/core_lazy.rs new file mode 100644 index 000000000000..20290d91fa9b --- /dev/null +++ b/third_party/rust/lazy_static/src/core_lazy.rs @@ -0,0 +1,27 @@ +extern crate spin; + +use self::spin::Once; + +pub struct Lazy(Once); + +impl Lazy { + #[inline(always)] + pub const fn new() -> Self { + Lazy(Once::new()) + } + + #[inline(always)] + pub fn get(&'static self, builder: F) -> &T + where F: FnOnce() -> T + { + self.0.call_once(builder) + } +} + +#[macro_export] +#[allow_internal_unstable] +macro_rules! __lazy_static_create { + ($NAME:ident, $T:ty) => { + static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::new(); + } +} diff --git a/third_party/rust/lazy_static/src/lazy.rs b/third_party/rust/lazy_static/src/lazy.rs new file mode 100644 index 000000000000..c7e6cefce7fb --- /dev/null +++ b/third_party/rust/lazy_static/src/lazy.rs @@ -0,0 +1,32 @@ +extern crate std; + +use self::std::prelude::v1::*; +use self::std::sync::Once; + +pub struct Lazy(pub *const T, pub Once); + +impl Lazy { + #[inline(always)] + pub fn get(&'static mut self, f: F) -> &T + where F: FnOnce() -> T + { + unsafe { + let r = &mut self.0; + self.1.call_once(|| { + *r = Box::into_raw(Box::new(f())); + }); + + &*self.0 + } + } +} + +unsafe impl Sync for Lazy {} + +#[macro_export] +macro_rules! __lazy_static_create { + ($NAME:ident, $T:ty) => { + use std::sync::ONCE_INIT; + static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(0 as *const $T, ONCE_INIT); + } +} diff --git a/third_party/rust/lazy_static/src/lib.rs b/third_party/rust/lazy_static/src/lib.rs new file mode 100644 index 000000000000..48370665038f --- /dev/null +++ b/third_party/rust/lazy_static/src/lib.rs @@ -0,0 +1,137 @@ +/*! +A macro for declaring lazily evaluated statics. + +Using this macro, it is possible to have `static`s that require code to be +executed at runtime in order to be initialized. +This includes anything requiring heap allocations, like vectors or hash maps, +as well as anything that requires function calls to be computed. + +# Syntax + +```ignore +lazy_static! { + [pub] static ref NAME_1: TYPE_1 = EXPR_1; + [pub] static ref NAME_2: TYPE_2 = EXPR_2; + ... + [pub] static ref NAME_N: TYPE_N = EXPR_N; +} +``` + +Metadata (such as doc comments) is allowed on each ref. + +# Semantic + +For a given `static ref NAME: TYPE = EXPR;`, the macro generates a unique type that +implements `Deref` and stores it in a static with name `NAME`. (Metadata ends up +attaching to this type.) + +On first deref, `EXPR` gets evaluated and stored internally, such that all further derefs +can return a reference to the same object. + +Like regular `static mut`s, this macro only works for types that fulfill the `Sync` +trait. + +# Example + +Using the macro: + +```rust +#[macro_use] +extern crate lazy_static; + +use std::collections::HashMap; + +lazy_static! { + static ref HASHMAP: HashMap = { + let mut m = HashMap::new(); + m.insert(0, "foo"); + m.insert(1, "bar"); + m.insert(2, "baz"); + m + }; + static ref COUNT: usize = HASHMAP.len(); + static ref NUMBER: u32 = times_two(21); +} + +fn times_two(n: u32) -> u32 { n * 2 } + +fn main() { + println!("The map has {} entries.", *COUNT); + println!("The entry for `0` is \"{}\".", HASHMAP.get(&0).unwrap()); + println!("A expensive calculation on a static results in: {}.", *NUMBER); +} +``` + +# Implementation details + +The `Deref` implementation uses a hidden static variable that is guarded by a atomic check on each access. On stable Rust, the macro may need to allocate each static on the heap. + +*/ + +#![cfg_attr(feature="nightly", feature(const_fn, allow_internal_unstable, core_intrinsics))] + +#![no_std] + +#[cfg(not(feature="nightly"))] +pub mod lazy; + +#[cfg(all(feature="nightly", not(feature="spin_no_std")))] +#[path="nightly_lazy.rs"] +pub mod lazy; + +#[cfg(all(feature="nightly", feature="spin_no_std"))] +#[path="core_lazy.rs"] +pub mod lazy; + +pub use core::ops::Deref as __Deref; + +#[macro_export] +#[cfg_attr(feature="nightly", allow_internal_unstable)] +macro_rules! lazy_static { + ($(#[$attr:meta])* static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { + lazy_static!(@PRIV, $(#[$attr])* static ref $N : $T = $e; $($t)*); + }; + ($(#[$attr:meta])* pub static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { + lazy_static!(@PUB, $(#[$attr])* static ref $N : $T = $e; $($t)*); + }; + (@$VIS:ident, $(#[$attr:meta])* static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { + lazy_static!(@MAKE TY, $VIS, $(#[$attr])*, $N); + impl $crate::__Deref for $N { + type Target = $T; + #[allow(unsafe_code)] + fn deref<'a>(&'a self) -> &'a $T { + unsafe { + #[inline(always)] + fn __static_ref_initialize() -> $T { $e } + + #[inline(always)] + unsafe fn __stability() -> &'static $T { + __lazy_static_create!(LAZY, $T); + LAZY.get(__static_ref_initialize) + } + __stability() + } + } + } + lazy_static!($($t)*); + }; + (@MAKE TY, PUB, $(#[$attr:meta])*, $N:ident) => { + #[allow(missing_copy_implementations)] + #[allow(non_camel_case_types)] + #[allow(dead_code)] + $(#[$attr])* + pub struct $N {__private_field: ()} + #[doc(hidden)] + pub static $N: $N = $N {__private_field: ()}; + }; + (@MAKE TY, PRIV, $(#[$attr:meta])*, $N:ident) => { + #[allow(missing_copy_implementations)] + #[allow(non_camel_case_types)] + #[allow(dead_code)] + $(#[$attr])* + struct $N {__private_field: ()} + #[doc(hidden)] + static $N: $N = $N {__private_field: ()}; + }; + () => () +} diff --git a/third_party/rust/lazy_static/src/nightly_lazy.rs b/third_party/rust/lazy_static/src/nightly_lazy.rs new file mode 100644 index 000000000000..5f7a110b2656 --- /dev/null +++ b/third_party/rust/lazy_static/src/nightly_lazy.rs @@ -0,0 +1,40 @@ +extern crate std; + +use self::std::prelude::v1::*; +use self::std::cell::UnsafeCell; +use self::std::sync::{Once, ONCE_INIT}; + +pub struct Lazy(UnsafeCell>, Once); + +impl Lazy { + #[inline(always)] + pub const fn new() -> Self { + Lazy(UnsafeCell::new(None), ONCE_INIT) + } + + #[inline(always)] + pub fn get(&'static self, f: F) -> &T + where F: FnOnce() -> T + { + unsafe { + self.1.call_once(|| { + *self.0.get() = Some(f()); + }); + + match *self.0.get() { + Some(ref x) => x, + None => std::intrinsics::unreachable(), + } + } + } +} + +unsafe impl Sync for Lazy {} + +#[macro_export] +#[allow_internal_unstable] +macro_rules! __lazy_static_create { + ($NAME:ident, $T:ty) => { + static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::new(); + } +} diff --git a/third_party/rust/lazy_static/tests/no_std.rs b/third_party/rust/lazy_static/tests/no_std.rs new file mode 100644 index 000000000000..b460e7932802 --- /dev/null +++ b/third_party/rust/lazy_static/tests/no_std.rs @@ -0,0 +1,21 @@ +#![cfg(feature="spin_no_std")] +#![feature(const_fn)] + +#![no_std] + +#[macro_use] +extern crate lazy_static; + +lazy_static! { + /// Documentation! + pub static ref NUMBER: u32 = times_two(3); +} + +fn times_two(n: u32) -> u32 { + n * 2 +} + +#[test] +fn test_basic() { + assert_eq!(*NUMBER, 6); +} diff --git a/third_party/rust/lazy_static/tests/test.rs b/third_party/rust/lazy_static/tests/test.rs new file mode 100644 index 000000000000..203ac97ffb66 --- /dev/null +++ b/third_party/rust/lazy_static/tests/test.rs @@ -0,0 +1,129 @@ +#![cfg_attr(feature="nightly", feature(const_fn))] + +#[macro_use] +extern crate lazy_static; +use std::collections::HashMap; + +lazy_static! { + /// Documentation! + pub static ref NUMBER: u32 = times_two(3); + + static ref ARRAY_BOXES: [Box; 3] = [Box::new(1), Box::new(2), Box::new(3)]; + + /// More documentation! + #[allow(unused_variables)] + #[derive(Copy, Clone, Debug)] + pub static ref STRING: String = "hello".to_string(); + + static ref HASHMAP: HashMap = { + let mut m = HashMap::new(); + m.insert(0, "abc"); + m.insert(1, "def"); + m.insert(2, "ghi"); + m + }; + + // This should not compile if the unsafe is removed. + static ref UNSAFE: u32 = unsafe { + std::mem::transmute::(-1) + }; + + // This *should* triggger warn(dead_code) by design. + static ref UNUSED: () = (); + +} + +lazy_static! { + static ref S1: &'static str = "a"; + static ref S2: &'static str = "b"; +} +lazy_static! { + static ref S3: String = [*S1, *S2].join(""); +} + +#[test] +fn s3() { + assert_eq!(&*S3, "ab"); +} + +fn times_two(n: u32) -> u32 { + n * 2 +} + +#[test] +fn test_basic() { + assert_eq!(&**STRING, "hello"); + assert_eq!(*NUMBER, 6); + assert!(HASHMAP.get(&1).is_some()); + assert!(HASHMAP.get(&3).is_none()); + assert_eq!(&*ARRAY_BOXES, &[Box::new(1), Box::new(2), Box::new(3)]); + assert_eq!(*UNSAFE, std::u32::MAX); +} + +#[test] +fn test_repeat() { + assert_eq!(*NUMBER, 6); + assert_eq!(*NUMBER, 6); + assert_eq!(*NUMBER, 6); +} + +#[test] +fn test_meta() { + // this would not compile if STRING were not marked #[derive(Copy, Clone)] + let copy_of_string = STRING; + // just to make sure it was copied + assert!(&STRING as *const _ != ©_of_string as *const _); + + // this would not compile if STRING were not marked #[derive(Debug)] + assert_eq!(format!("{:?}", STRING), "STRING { __private_field: () }".to_string()); +} + +mod visibility { + lazy_static! { + pub static ref FOO: Box = Box::new(0); + static ref BAR: Box = Box::new(98); + } + + #[test] + fn sub_test() { + assert_eq!(**FOO, 0); + assert_eq!(**BAR, 98); + } +} + +#[test] +fn test_visibility() { + assert_eq!(*visibility::FOO, Box::new(0)); +} + +// This should not cause a warning about a missing Copy implementation +lazy_static! { + pub static ref VAR: i32 = { 0 }; +} + +#[derive(Copy, Clone, Debug, PartialEq)] +struct X; +struct Once(X); +const ONCE_INIT: Once = Once(X); +static DATA: X = X; +static ONCE: X = X; +fn require_sync() -> X { X } +fn transmute() -> X { X } +fn __static_ref_initialize() -> X { X } +fn test(_: Vec) -> X { X } + +// All these names should not be shadowed +lazy_static! { + static ref ITEM_NAME_TEST: X = { + test(vec![X, Once(X).0, ONCE_INIT.0, DATA, ONCE, + require_sync(), transmute(), + // Except this, which will sadly be shadowed by internals: + // __static_ref_initialize() + ]) + }; +} + +#[test] +fn item_name_shadowing() { + assert_eq!(*ITEM_NAME_TEST, X); +} diff --git a/third_party/rust/log/.cargo-checksum.json b/third_party/rust/log/.cargo-checksum.json new file mode 100644 index 000000000000..2255dcb7c7b7 --- /dev/null +++ b/third_party/rust/log/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"12cc0f91b51fedf41ae1670d1624ee1d78a284bdb101645b60a06a12de16c069",".travis.yml":"7e59fac4ef16079658aa829fc2f0bce2de96225ba72f1ef8fea6d55d5be37fe2","Cargo.toml":"021b91ff433a559e29fabddbe01c1e4cdba33317c0b8f399c61b4335771cbca4","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7c831cff45cfd33333cc246815dccb25bfa0b981053656e707828fe3f25151da","appveyor.yml":"c61473b8c780ad2626282ce2b2ba0ef278082b6afe151a62ff419f33eaf90221","src/lib.rs":"0c05947b6f133fa9818f3a71f8f98549cf4c8f8840559fce6d0e33998af449d4","src/macros.rs":"9068d69d32e989ac273ce73659125d31cf4a166076eefdad74dfbdf9506cf9c4","tests/filters.rs":"cc61ed41a6cd77e5aef91cc8c76216b492d8de34f00635254f3835a3d964ce22"},"package":"ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"} \ No newline at end of file diff --git a/third_party/rust/log/.cargo-ok b/third_party/rust/log/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/log/.gitignore b/third_party/rust/log/.gitignore new file mode 100644 index 000000000000..2c96eb1b6517 --- /dev/null +++ b/third_party/rust/log/.gitignore @@ -0,0 +1,2 @@ +target/ +Cargo.lock diff --git a/third_party/rust/log/.travis.yml b/third_party/rust/log/.travis.yml new file mode 100644 index 000000000000..89e7ae02ab59 --- /dev/null +++ b/third_party/rust/log/.travis.yml @@ -0,0 +1,31 @@ +language: rust +sudo: false +rust: + - stable + - beta + - nightly +script: + - cargo build --verbose + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo build --verbose --no-default-features) + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo build --verbose --features nightly) + - cargo test --verbose + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --no-default-features) + - cargo test --verbose --manifest-path env/Cargo.toml + - cargo run --verbose --manifest-path tests/max_level_features/Cargo.toml + - cargo run --verbose --manifest-path tests/max_level_features/Cargo.toml --release + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo doc --no-deps --features nightly) + - CARGO_TARGET_DIR=target cargo doc --no-deps --manifest-path env/Cargo.toml +after_success: | + [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + [ $TRAVIS_RUST_VERSION = nightly ] && + echo '' > target/doc/index.html && + pip install ghp-import --user $USER && + $HOME/.local/bin/ghp-import -n target/doc && + git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages +env: + global: + secure: bNUxFmA5uEdKKdVDtgb+5WQuMRDZ6QxK5152sIZWSimxyr/x5erNZ1uacPh02Ng92dbUQ66wz90WPmqTwoL0EeJ/FmZDd29hRHXe82MNpz47QX3cGMgFNldQ2GmJmCHBXKu373B80o/ZB+BTVcYcl1ksTXuIhQg2wZtXh8bZ9F4= +notifications: + email: + on_success: never diff --git a/third_party/rust/log/Cargo.toml b/third_party/rust/log/Cargo.toml new file mode 100644 index 000000000000..f2081ecffcc2 --- /dev/null +++ b/third_party/rust/log/Cargo.toml @@ -0,0 +1,36 @@ +[package] + +name = "log" +version = "0.3.6" +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/rust-lang/log" +documentation = "https://doc.rust-lang.org/log" +homepage = "https://github.com/rust-lang/log" +description = """ +A lightweight logging facade for Rust +""" + +[[test]] +name = "filters" +harness = false + +[features] +max_level_off = [] +max_level_error = [] +max_level_warn = [] +max_level_info = [] +max_level_debug = [] +max_level_trace = [] + +release_max_level_off = [] +release_max_level_error = [] +release_max_level_warn = [] +release_max_level_info = [] +release_max_level_debug = [] +release_max_level_trace = [] + +nightly = [] +use_std = [] +default = ["use_std"] diff --git a/third_party/rust/log/LICENSE-APACHE b/third_party/rust/log/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/log/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/log/LICENSE-MIT b/third_party/rust/log/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/log/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +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. diff --git a/third_party/rust/log/README.md b/third_party/rust/log/README.md new file mode 100644 index 000000000000..0e9dc58ae7b3 --- /dev/null +++ b/third_party/rust/log/README.md @@ -0,0 +1,160 @@ +log +=== + +A Rust library providing a lightweight logging *facade*. + +[![Build Status](https://travis-ci.org/rust-lang-nursery/log.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/log) +[![Build status](https://ci.appveyor.com/api/projects/status/nopdjmmjt45xcrki?svg=true)](https://ci.appveyor.com/project/alexcrichton/log) + +* [`log` documentation](https://doc.rust-lang.org/log) +* [`env_logger` documentation](https://doc.rust-lang.org/log/env_logger) + +A logging facade provides a single logging API that abstracts over the actual +logging implementation. Libraries can use the logging API provided by this +crate, and the consumer of those libraries can choose the logging +implementation that is most suitable for its use case. + +## Usage + +## In libraries + +Libraries should link only to the `log` crate, and use the provided macros to +log whatever information will be useful to downstream consumers: + +```toml +[dependencies] +log = "0.3" +``` + +```rust +#[macro_use] +extern crate log; + +pub fn shave_the_yak(yak: &Yak) { + trace!("Commencing yak shaving"); + + loop { + match find_a_razor() { + Ok(razor) => { + info!("Razor located: {}", razor); + yak.shave(razor); + break; + } + Err(err) => { + warn!("Unable to locate a razor: {}, retrying", err); + } + } + } +} +``` + +## In executables + +Executables should choose a logger implementation and initialize it early in the +runtime of the program. Logger implementations will typically include a +function to do this. Any log messages generated before the logger is +initialized will be ignored. + +The executable itself may use the `log` crate to log as well. + +The `env_logger` crate provides a logger implementation that mirrors the +functionality of the old revision of the `log` crate. + +```toml +[dependencies] +log = "0.3" +env_logger = "0.3" +``` + +```rust +#[macro_use] +extern crate log; +extern crate env_logger; + +fn main() { + env_logger::init().unwrap(); + + info!("starting up"); + + // ... +} +``` + +## In tests + +Tests can use the `env_logger` crate to see log messages generated during that test: + +```toml +[dependencies] +log = "0.3" + +[dev-dependencies] +env_logger = "0.3" +``` + +```rust +#[macro_use] +extern crate log; + +fn add_one(num: i32) -> i32 { + info!("add_one called with {}", num); + num + 1 +} + +#[cfg(test)] +mod tests { + use super::*; + extern crate env_logger; + + #[test] + fn it_adds_one() { + let _ = env_logger::init(); + info!("can log from the test too"); + assert_eq!(3, add_one(2)); + } + + #[test] + fn it_handles_negative_numbers() { + let _ = env_logger::init(); + info!("logging from another test"); + assert_eq!(-7, add_one(-8)); + } +} +``` + +Assuming the module under test is called `my_lib`, running the tests with the +`RUST_LOG` filtering to info messages from this module looks like: + +```bash +$ RUST_LOG=my_lib=info cargo test + Running target/debug/my_lib-... + +running 2 tests +INFO:my_lib::tests: logging from another test +INFO:my_lib: add_one called with -8 +test tests::it_handles_negative_numbers ... ok +INFO:my_lib::tests: can log from the test too +INFO:my_lib: add_one called with 2 +test tests::it_adds_one ... ok + +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +``` + +Note that `env_logger::init()` needs to be called in each test in which you +want to enable logging. Additionally, the default behavior of tests to +run in parallel means that logging output may be interleaved with test output. +Either run tests in a single thread by specifying `RUST_TEST_THREADS=1` or by +running one test by specifying its name as an argument to the test binaries as +directed by the `cargo test` help docs: + +```bash +$ RUST_LOG=my_lib=info cargo test it_adds_one + Running target/debug/my_lib-... + +running 1 test +INFO:my_lib::tests: can log from the test too +INFO:my_lib: add_one called with 2 +test tests::it_adds_one ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +``` diff --git a/third_party/rust/log/appveyor.yml b/third_party/rust/log/appveyor.yml new file mode 100644 index 000000000000..841011deb237 --- /dev/null +++ b/third_party/rust/log/appveyor.yml @@ -0,0 +1,18 @@ +environment: + matrix: + - TARGET: x86_64-pc-windows-msvc + - TARGET: i686-pc-windows-msvc + - TARGET: i686-pc-windows-gnu +install: + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" + - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" + - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin + - SET PATH=%PATH%;C:\MinGW\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo test --verbose + - cargo test --manifest-path env/Cargo.toml diff --git a/third_party/rust/log/src/lib.rs b/third_party/rust/log/src/lib.rs new file mode 100644 index 000000000000..da2fc1596331 --- /dev/null +++ b/third_party/rust/log/src/lib.rs @@ -0,0 +1,1013 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A lightweight logging facade. +//! +//! A logging facade provides a single logging API that abstracts over the +//! actual logging implementation. Libraries can use the logging API provided +//! by this crate, and the consumer of those libraries can choose the logging +//! framework that is most suitable for its use case. +//! +//! If no logging implementation is selected, the facade falls back to a "noop" +//! implementation that ignores all log messages. The overhead in this case +//! is very small - just an integer load, comparison and jump. +//! +//! A log request consists of a target, a level, and a body. A target is a +//! string which defaults to the module path of the location of the log +//! request, though that default may be overridden. Logger implementations +//! typically use the target to filter requests based on some user +//! configuration. +//! +//! # Use +//! +//! ## In libraries +//! +//! Libraries should link only to the `log` crate, and use the provided +//! macros to log whatever information will be useful to downstream consumers. +//! +//! ### Examples +//! +//! ```rust +//! # #![allow(unstable)] +//! #[macro_use] +//! extern crate log; +//! +//! # #[derive(Debug)] pub struct Yak(String); +//! # impl Yak { fn shave(&self, _: u32) {} } +//! # fn find_a_razor() -> Result { Ok(1) } +//! pub fn shave_the_yak(yak: &Yak) { +//! info!(target: "yak_events", "Commencing yak shaving for {:?}", yak); +//! +//! loop { +//! match find_a_razor() { +//! Ok(razor) => { +//! info!("Razor located: {}", razor); +//! yak.shave(razor); +//! break; +//! } +//! Err(err) => { +//! warn!("Unable to locate a razor: {}, retrying", err); +//! } +//! } +//! } +//! } +//! # fn main() {} +//! ``` +//! +//! ## In executables +//! +//! Executables should choose a logging framework and initialize it early in the +//! runtime of the program. Logging frameworks will typically include a +//! function to do this. Any log messages generated before the framework is +//! initialized will be ignored. +//! +//! The executable itself may use the `log` crate to log as well. +//! +//! ### Warning +//! +//! The logging system may only be initialized once. +//! +//! ### Examples +//! +//! ```rust,ignore +//! #[macro_use] +//! extern crate log; +//! extern crate my_logger; +//! +//! fn main() { +//! my_logger::init(); +//! +//! info!("starting up"); +//! +//! // ... +//! } +//! ``` +//! +//! # Logger implementations +//! +//! Loggers implement the `Log` trait. Here's a very basic example that simply +//! logs all messages at the `Error`, `Warn` or `Info` levels to stdout: +//! +//! ```rust +//! extern crate log; +//! +//! use log::{LogRecord, LogLevel, LogMetadata}; +//! +//! struct SimpleLogger; +//! +//! impl log::Log for SimpleLogger { +//! fn enabled(&self, metadata: &LogMetadata) -> bool { +//! metadata.level() <= LogLevel::Info +//! } +//! +//! fn log(&self, record: &LogRecord) { +//! if self.enabled(record.metadata()) { +//! println!("{} - {}", record.level(), record.args()); +//! } +//! } +//! } +//! +//! # fn main() {} +//! ``` +//! +//! Loggers are installed by calling the `set_logger` function. It takes a +//! closure which is provided a `MaxLogLevel` token and returns a `Log` trait +//! object. The `MaxLogLevel` token controls the global maximum log level. The +//! logging facade uses this as an optimization to improve performance of log +//! messages at levels that are disabled. In the case of our example logger, +//! we'll want to set the maximum log level to `Info`, since we ignore any +//! `Debug` or `Trace` level log messages. A logging framework should provide a +//! function that wraps a call to `set_logger`, handling initialization of the +//! logger: +//! +//! ```rust +//! # extern crate log; +//! # use log::{LogLevel, LogLevelFilter, SetLoggerError, LogMetadata}; +//! # struct SimpleLogger; +//! # impl log::Log for SimpleLogger { +//! # fn enabled(&self, _: &LogMetadata) -> bool { false } +//! # fn log(&self, _: &log::LogRecord) {} +//! # } +//! # fn main() {} +//! # #[cfg(feature = "use_std")] +//! pub fn init() -> Result<(), SetLoggerError> { +//! log::set_logger(|max_log_level| { +//! max_log_level.set(LogLevelFilter::Info); +//! Box::new(SimpleLogger) +//! }) +//! } +//! ``` +//! +//! # Use with `no_std` +//! +//! To use the `log` crate without depending on `libstd`, you need to specify +//! `default-features = false` when specifying the dependency in `Cargo.toml`. +//! This makes no difference to libraries using `log` since the logging API +//! remains the same. However executables will need to use the `set_logger_raw` +//! function to initialize a logger and the `shutdown_logger_raw` function to +//! shut down the global logger before exiting: +//! +//! ```rust +//! # extern crate log; +//! # use log::{LogLevel, LogLevelFilter, SetLoggerError, ShutdownLoggerError, +//! # LogMetadata}; +//! # struct SimpleLogger; +//! # impl log::Log for SimpleLogger { +//! # fn enabled(&self, _: &LogMetadata) -> bool { false } +//! # fn log(&self, _: &log::LogRecord) {} +//! # } +//! # impl SimpleLogger { +//! # fn flush(&self) {} +//! # } +//! # fn main() {} +//! pub fn init() -> Result<(), SetLoggerError> { +//! unsafe { +//! log::set_logger_raw(|max_log_level| { +//! static LOGGER: SimpleLogger = SimpleLogger; +//! max_log_level.set(LogLevelFilter::Info); +//! &SimpleLogger +//! }) +//! } +//! } +//! pub fn shutdown() -> Result<(), ShutdownLoggerError> { +//! log::shutdown_logger_raw().map(|logger| { +//! let logger = unsafe { &*(logger as *const SimpleLogger) }; +//! logger.flush(); +//! }) +//! } +//! ``` + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/log/")] +#![warn(missing_docs)] +#![cfg_attr(feature = "nightly", feature(panic_handler))] + +#![cfg_attr(not(feature = "use_std"), no_std)] + +#[cfg(not(feature = "use_std"))] +extern crate core as std; + +use std::cmp; +#[cfg(feature = "use_std")] +use std::error; +use std::fmt; +use std::mem; +use std::ops::Deref; +use std::str::FromStr; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +#[macro_use] +mod macros; + +// The setup here is a bit weird to make shutdown_logger_raw work. +// +// There are four different states that we care about: the logger's +// uninitialized, the logger's initializing (set_logger's been called but +// LOGGER hasn't actually been set yet), the logger's active, or the logger is +// shut down after calling shutdown_logger_raw. +// +// The LOGGER static holds a pointer to the global logger. It is protected by +// the STATE static which determines whether LOGGER has been initialized yet. +// +// The shutdown_logger_raw routine needs to make sure that no threads are +// actively logging before it returns. The number of actively logging threads is +// tracked in the REFCOUNT static. The routine first sets STATE back to +// INITIALIZING. All logging calls past that point will immediately return +// without accessing the logger. At that point, the at_exit routine just waits +// for the refcount to reach 0 before deallocating the logger. Note that the +// refcount does not necessarily monotonically decrease at this point, as new +// log calls still increment and decrement it, but the interval in between is +// small enough that the wait is really just for the active log calls to finish. + +static mut LOGGER: *const Log = &NopLogger; +static STATE: AtomicUsize = ATOMIC_USIZE_INIT; +static REFCOUNT: AtomicUsize = ATOMIC_USIZE_INIT; + +const UNINITIALIZED: usize = 0; +const INITIALIZING: usize = 1; +const INITIALIZED: usize = 2; + +static MAX_LOG_LEVEL_FILTER: AtomicUsize = ATOMIC_USIZE_INIT; + +static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", + "DEBUG", "TRACE"]; + +/// An enum representing the available verbosity levels of the logging framework +/// +/// A `LogLevel` may be compared directly to a `LogLevelFilter`. +#[repr(usize)] +#[derive(Copy, Eq, Debug)] +pub enum LogLevel { + /// The "error" level. + /// + /// Designates very serious errors. + Error = 1, // This way these line up with the discriminants for LogLevelFilter below + /// The "warn" level. + /// + /// Designates hazardous situations. + Warn, + /// The "info" level. + /// + /// Designates useful information. + Info, + /// The "debug" level. + /// + /// Designates lower priority information. + Debug, + /// The "trace" level. + /// + /// Designates very low priority, often extremely verbose, information. + Trace, +} + +impl Clone for LogLevel { + #[inline] + fn clone(&self) -> LogLevel { + *self + } +} + +impl PartialEq for LogLevel { + #[inline] + fn eq(&self, other: &LogLevel) -> bool { + *self as usize == *other as usize + } +} + +impl PartialEq for LogLevel { + #[inline] + fn eq(&self, other: &LogLevelFilter) -> bool { + *self as usize == *other as usize + } +} + +impl PartialOrd for LogLevel { + #[inline] + fn partial_cmp(&self, other: &LogLevel) -> Option { + Some(self.cmp(other)) + } +} + +impl PartialOrd for LogLevel { + #[inline] + fn partial_cmp(&self, other: &LogLevelFilter) -> Option { + Some((*self as usize).cmp(&(*other as usize))) + } +} + +impl Ord for LogLevel { + #[inline] + fn cmp(&self, other: &LogLevel) -> cmp::Ordering { + (*self as usize).cmp(&(*other as usize)) + } +} + +fn ok_or(t: Option, e: E) -> Result { + match t { + Some(t) => Ok(t), + None => Err(e), + } +} + +// Reimplemented here because std::ascii is not available in libcore +fn eq_ignore_ascii_case(a: &str, b: &str) -> bool { + fn to_ascii_uppercase(c: u8) -> u8 { + if c >= b'a' && c <= b'z' { + c - b'a' + b'A' + } else { + c + } + } + + if a.len() == b.len() { + a.bytes() + .zip(b.bytes()) + .all(|(a, b)| to_ascii_uppercase(a) == to_ascii_uppercase(b)) + } else { + false + } +} + +impl FromStr for LogLevel { + type Err = (); + fn from_str(level: &str) -> Result { + ok_or(LOG_LEVEL_NAMES.iter() + .position(|&name| eq_ignore_ascii_case(name, level)) + .into_iter() + .filter(|&idx| idx != 0) + .map(|idx| LogLevel::from_usize(idx).unwrap()) + .next(), ()) + } +} + +impl fmt::Display for LogLevel { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.pad(LOG_LEVEL_NAMES[*self as usize]) + } +} + +impl LogLevel { + fn from_usize(u: usize) -> Option { + match u { + 1 => Some(LogLevel::Error), + 2 => Some(LogLevel::Warn), + 3 => Some(LogLevel::Info), + 4 => Some(LogLevel::Debug), + 5 => Some(LogLevel::Trace), + _ => None + } + } + + /// Returns the most verbose logging level. + #[inline] + pub fn max() -> LogLevel { + LogLevel::Trace + } + + /// Converts the `LogLevel` to the equivalent `LogLevelFilter`. + #[inline] + pub fn to_log_level_filter(&self) -> LogLevelFilter { + LogLevelFilter::from_usize(*self as usize).unwrap() + } +} + +/// An enum representing the available verbosity level filters of the logging +/// framework. +/// +/// A `LogLevelFilter` may be compared directly to a `LogLevel`. +#[repr(usize)] +#[derive(Copy, Eq, Debug)] +pub enum LogLevelFilter { + /// A level lower than all log levels. + Off, + /// Corresponds to the `Error` log level. + Error, + /// Corresponds to the `Warn` log level. + Warn, + /// Corresponds to the `Info` log level. + Info, + /// Corresponds to the `Debug` log level. + Debug, + /// Corresponds to the `Trace` log level. + Trace, +} + +// Deriving generates terrible impls of these traits + +impl Clone for LogLevelFilter { + #[inline] + fn clone(&self) -> LogLevelFilter { + *self + } +} + +impl PartialEq for LogLevelFilter { + #[inline] + fn eq(&self, other: &LogLevelFilter) -> bool { + *self as usize == *other as usize + } +} + +impl PartialEq for LogLevelFilter { + #[inline] + fn eq(&self, other: &LogLevel) -> bool { + other.eq(self) + } +} + +impl PartialOrd for LogLevelFilter { + #[inline] + fn partial_cmp(&self, other: &LogLevelFilter) -> Option { + Some(self.cmp(other)) + } +} + +impl PartialOrd for LogLevelFilter { + #[inline] + fn partial_cmp(&self, other: &LogLevel) -> Option { + other.partial_cmp(self).map(|x| x.reverse()) + } +} + +impl Ord for LogLevelFilter { + #[inline] + fn cmp(&self, other: &LogLevelFilter) -> cmp::Ordering { + (*self as usize).cmp(&(*other as usize)) + } +} + +impl FromStr for LogLevelFilter { + type Err = (); + fn from_str(level: &str) -> Result { + ok_or(LOG_LEVEL_NAMES.iter() + .position(|&name| eq_ignore_ascii_case(name, level)) + .map(|p| LogLevelFilter::from_usize(p).unwrap()), ()) + } +} + +impl fmt::Display for LogLevelFilter { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "{}", LOG_LEVEL_NAMES[*self as usize]) + } +} + +impl LogLevelFilter { + fn from_usize(u: usize) -> Option { + match u { + 0 => Some(LogLevelFilter::Off), + 1 => Some(LogLevelFilter::Error), + 2 => Some(LogLevelFilter::Warn), + 3 => Some(LogLevelFilter::Info), + 4 => Some(LogLevelFilter::Debug), + 5 => Some(LogLevelFilter::Trace), + _ => None + } + } + /// Returns the most verbose logging level filter. + #[inline] + pub fn max() -> LogLevelFilter { + LogLevelFilter::Trace + } + + /// Converts `self` to the equivalent `LogLevel`. + /// + /// Returns `None` if `self` is `LogLevelFilter::Off`. + #[inline] + pub fn to_log_level(&self) -> Option { + LogLevel::from_usize(*self as usize) + } +} + +/// The "payload" of a log message. +pub struct LogRecord<'a> { + metadata: LogMetadata<'a>, + location: &'a LogLocation, + args: fmt::Arguments<'a>, +} + +impl<'a> LogRecord<'a> { + /// The message body. + pub fn args(&self) -> &fmt::Arguments<'a> { + &self.args + } + + /// Metadata about the log directive. + pub fn metadata(&self) -> &LogMetadata { + &self.metadata + } + + /// The location of the log directive. + pub fn location(&self) -> &LogLocation { + self.location + } + + /// The verbosity level of the message. + pub fn level(&self) -> LogLevel { + self.metadata.level() + } + + /// The name of the target of the directive. + pub fn target(&self) -> &str { + self.metadata.target() + } +} + +/// Metadata about a log message. +pub struct LogMetadata<'a> { + level: LogLevel, + target: &'a str, +} + +impl<'a> LogMetadata<'a> { + /// The verbosity level of the message. + pub fn level(&self) -> LogLevel { + self.level + } + + /// The name of the target of the directive. + pub fn target(&self) -> &str { + self.target + } +} + +/// A trait encapsulating the operations required of a logger +pub trait Log: Sync+Send { + /// Determines if a log message with the specified metadata would be + /// logged. + /// + /// This is used by the `log_enabled!` macro to allow callers to avoid + /// expensive computation of log message arguments if the message would be + /// discarded anyway. + fn enabled(&self, metadata: &LogMetadata) -> bool; + + /// Logs the `LogRecord`. + /// + /// Note that `enabled` is *not* necessarily called before this method. + /// Implementations of `log` should perform all necessary filtering + /// internally. + fn log(&self, record: &LogRecord); +} + +// Just used as a dummy initial value for LOGGER +struct NopLogger; + +impl Log for NopLogger { + fn enabled(&self, _: &LogMetadata) -> bool { false } + + fn log(&self, _: &LogRecord) {} +} + +/// The location of a log message. +/// +/// # Warning +/// +/// The fields of this struct are public so that they may be initialized by the +/// `log!` macro. They are subject to change at any time and should never be +/// accessed directly. +#[derive(Copy, Clone, Debug)] +pub struct LogLocation { + #[doc(hidden)] + pub __module_path: &'static str, + #[doc(hidden)] + pub __file: &'static str, + #[doc(hidden)] + pub __line: u32, +} + +impl LogLocation { + /// The module path of the message. + pub fn module_path(&self) -> &str { + self.__module_path + } + + /// The source file containing the message. + pub fn file(&self) -> &str { + self.__file + } + + /// The line containing the message. + pub fn line(&self) -> u32 { + self.__line + } +} + +/// A token providing read and write access to the global maximum log level +/// filter. +/// +/// The maximum log level is used as an optimization to avoid evaluating log +/// messages that will be ignored by the logger. Any message with a level +/// higher than the maximum log level filter will be ignored. A logger should +/// make sure to keep the maximum log level filter in sync with its current +/// configuration. +#[allow(missing_copy_implementations)] +pub struct MaxLogLevelFilter(()); + +impl fmt::Debug for MaxLogLevelFilter { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "MaxLogLevelFilter") + } +} + +impl MaxLogLevelFilter { + /// Gets the current maximum log level filter. + pub fn get(&self) -> LogLevelFilter { + max_log_level() + } + + /// Sets the maximum log level. + pub fn set(&self, level: LogLevelFilter) { + MAX_LOG_LEVEL_FILTER.store(level as usize, Ordering::SeqCst) + } +} + +/// Returns the current maximum log level. +/// +/// The `log!`, `error!`, `warn!`, `info!`, `debug!`, and `trace!` macros check +/// this value and discard any message logged at a higher level. The maximum +/// log level is set by the `MaxLogLevel` token passed to loggers. +#[inline(always)] +pub fn max_log_level() -> LogLevelFilter { + unsafe { mem::transmute(MAX_LOG_LEVEL_FILTER.load(Ordering::Relaxed)) } +} + +/// Sets the global logger. +/// +/// The `make_logger` closure is passed a `MaxLogLevel` object, which the +/// logger should use to keep the global maximum log level in sync with the +/// highest log level that the logger will not ignore. +/// +/// This function may only be called once in the lifetime of a program. Any log +/// events that occur before the call to `set_logger` completes will be +/// ignored. +/// +/// This function does not typically need to be called manually. Logger +/// implementations should provide an initialization method that calls +/// `set_logger` internally. +/// +/// Requires the `use_std` feature (enabled by default). +#[cfg(feature = "use_std")] +pub fn set_logger(make_logger: M) -> Result<(), SetLoggerError> + where M: FnOnce(MaxLogLevelFilter) -> Box { + unsafe { set_logger_raw(|max_level| mem::transmute(make_logger(max_level))) } +} + +/// Sets the global logger from a raw pointer. +/// +/// This function is similar to `set_logger` except that it is usable in +/// `no_std` code. +/// +/// The `make_logger` closure is passed a `MaxLogLevel` object, which the +/// logger should use to keep the global maximum log level in sync with the +/// highest log level that the logger will not ignore. +/// +/// This function may only be called once in the lifetime of a program. Any log +/// events that occur before the call to `set_logger_raw` completes will be +/// ignored. +/// +/// This function does not typically need to be called manually. Logger +/// implementations should provide an initialization method that calls +/// `set_logger_raw` internally. +/// +/// # Safety +/// +/// The pointer returned by `make_logger` must remain valid for the entire +/// duration of the program or until `shutdown_logger_raw` is called. In +/// addition, `shutdown_logger` *must not* be called after this function. +pub unsafe fn set_logger_raw(make_logger: M) -> Result<(), SetLoggerError> + where M: FnOnce(MaxLogLevelFilter) -> *const Log { + if STATE.compare_and_swap(UNINITIALIZED, INITIALIZING, + Ordering::SeqCst) != UNINITIALIZED { + return Err(SetLoggerError(())); + } + + LOGGER = make_logger(MaxLogLevelFilter(())); + STATE.store(INITIALIZED, Ordering::SeqCst); + Ok(()) +} + +/// Shuts down the global logger. +/// +/// This function may only be called once in the lifetime of a program, and may +/// not be called before `set_logger`. Once the global logger has been shut +/// down, it can no longer be re-initialized by `set_logger`. Any log events +/// that occur after the call to `shutdown_logger` completes will be ignored. +/// +/// The logger that was originally created by the call to to `set_logger` is +/// returned on success. At that point it is guaranteed that no other threads +/// are concurrently accessing the logger object. +#[cfg(feature = "use_std")] +pub fn shutdown_logger() -> Result, ShutdownLoggerError> { + shutdown_logger_raw().map(|l| unsafe { mem::transmute(l) }) +} + +/// Shuts down the global logger. +/// +/// This function is similar to `shutdown_logger` except that it is usable in +/// `no_std` code. +/// +/// This function may only be called once in the lifetime of a program, and may +/// not be called before `set_logger_raw`. Once the global logger has been shut +/// down, it can no longer be re-initialized by `set_logger_raw`. Any log +/// events that occur after the call to `shutdown_logger_raw` completes will be +/// ignored. +/// +/// The pointer that was originally passed to `set_logger_raw` is returned on +/// success. At that point it is guaranteed that no other threads are +/// concurrently accessing the logger object. +pub fn shutdown_logger_raw() -> Result<*const Log, ShutdownLoggerError> { + // Set the global log level to stop other thread from logging + MAX_LOG_LEVEL_FILTER.store(0, Ordering::SeqCst); + + // Set to INITIALIZING to prevent re-initialization after + if STATE.compare_and_swap(INITIALIZED, INITIALIZING, + Ordering::SeqCst) != INITIALIZED { + return Err(ShutdownLoggerError(())); + } + + while REFCOUNT.load(Ordering::SeqCst) != 0 { + // FIXME add a sleep here when it doesn't involve timers + } + + unsafe { + let logger = LOGGER; + LOGGER = &NopLogger; + Ok(logger) + } +} + +/// The type returned by `set_logger` if `set_logger` has already been called. +#[allow(missing_copy_implementations)] +#[derive(Debug)] +pub struct SetLoggerError(()); + +impl fmt::Display for SetLoggerError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "attempted to set a logger after the logging system \ + was already initialized") + } +} + +// The Error trait is not available in libcore +#[cfg(feature = "use_std")] +impl error::Error for SetLoggerError { + fn description(&self) -> &str { "set_logger() called multiple times" } +} + +/// The type returned by `shutdown_logger_raw` if `shutdown_logger_raw` has +/// already been called or if `set_logger_raw` has not been called yet. +#[allow(missing_copy_implementations)] +#[derive(Debug)] +pub struct ShutdownLoggerError(()); + +impl fmt::Display for ShutdownLoggerError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "attempted to shut down the logger without an active logger") + } +} + +// The Error trait is not available in libcore +#[cfg(feature = "use_std")] +impl error::Error for ShutdownLoggerError { + fn description(&self) -> &str { "shutdown_logger() called without an active logger" } +} + +/// Registers a panic hook which logs at the error level. +/// +/// The format is the same as the default panic hook . The reporting module is +/// `log::panic`. +/// +/// Requires the `use_std` (enabled by default) and `nightly` features. +#[cfg(all(feature = "nightly", feature = "use_std"))] +pub fn log_panics() { + std::panic::set_hook(Box::new(panic::log)); +} + +// inner module so that the reporting module is log::panic instead of log +#[cfg(all(feature = "nightly", feature = "use_std"))] +mod panic { + use std::panic::PanicInfo; + use std::thread; + + pub fn log(info: &PanicInfo) { + let thread = thread::current(); + let thread = thread.name().unwrap_or(""); + + let msg = match info.payload().downcast_ref::<&'static str>() { + Some(s) => *s, + None => match info.payload().downcast_ref::() { + Some(s) => &s[..], + None => "Box", + } + }; + + match info.location() { + Some(location) => { + error!("thread '{}' panicked at '{}': {}:{}", + thread, + msg, + location.file(), + location.line()) + } + None => error!("thread '{}' panicked at '{}'", thread, msg), + } + } +} + +struct LoggerGuard(&'static Log); + +impl Drop for LoggerGuard { + fn drop(&mut self) { + REFCOUNT.fetch_sub(1, Ordering::SeqCst); + } +} + +impl Deref for LoggerGuard { + type Target = Log; + + fn deref(&self) -> &(Log + 'static) { + self.0 + } +} + +fn logger() -> Option { + REFCOUNT.fetch_add(1, Ordering::SeqCst); + if STATE.load(Ordering::SeqCst) != INITIALIZED { + REFCOUNT.fetch_sub(1, Ordering::SeqCst); + None + } else { + Some(LoggerGuard(unsafe { &*LOGGER })) + } +} + +// WARNING +// This is not considered part of the crate's public API. It is subject to +// change at any time. +#[doc(hidden)] +pub fn __enabled(level: LogLevel, target: &str) -> bool { + if let Some(logger) = logger() { + logger.enabled(&LogMetadata { level: level, target: target }) + } else { + false + } +} + +// WARNING +// This is not considered part of the crate's public API. It is subject to +// change at any time. +#[doc(hidden)] +pub fn __log(level: LogLevel, target: &str, loc: &LogLocation, + args: fmt::Arguments) { + if let Some(logger) = logger() { + let record = LogRecord { + metadata: LogMetadata { + level: level, + target: target, + }, + location: loc, + args: args + }; + logger.log(&record) + } +} + +// WARNING +// This is not considered part of the crate's public API. It is subject to +// change at any time. +#[inline(always)] +#[doc(hidden)] +pub fn __static_max_level() -> LogLevelFilter { + if !cfg!(debug_assertions) { + // This is a release build. Check `release_max_level_*` first. + if cfg!(feature = "release_max_level_off") { + return LogLevelFilter::Off + } else if cfg!(feature = "release_max_level_error") { + return LogLevelFilter::Error + } else if cfg!(feature = "release_max_level_warn") { + return LogLevelFilter::Warn + } else if cfg!(feature = "release_max_level_info") { + return LogLevelFilter::Info + } else if cfg!(feature = "release_max_level_debug") { + return LogLevelFilter::Debug + } else if cfg!(feature = "release_max_level_trace") { + return LogLevelFilter::Trace + } + } + if cfg!(feature = "max_level_off") { + LogLevelFilter::Off + } else if cfg!(feature = "max_level_error") { + LogLevelFilter::Error + } else if cfg!(feature = "max_level_warn") { + LogLevelFilter::Warn + } else if cfg!(feature = "max_level_info") { + LogLevelFilter::Info + } else if cfg!(feature = "max_level_debug") { + LogLevelFilter::Debug + } else { + LogLevelFilter::Trace + } +} + +#[cfg(test)] +mod tests { + extern crate std; + use tests::std::string::ToString; + use super::{LogLevel, LogLevelFilter}; + + #[test] + fn test_loglevelfilter_from_str() { + let tests = [ + ("off", Ok(LogLevelFilter::Off)), + ("error", Ok(LogLevelFilter::Error)), + ("warn", Ok(LogLevelFilter::Warn)), + ("info", Ok(LogLevelFilter::Info)), + ("debug", Ok(LogLevelFilter::Debug)), + ("trace", Ok(LogLevelFilter::Trace)), + ("OFF", Ok(LogLevelFilter::Off)), + ("ERROR", Ok(LogLevelFilter::Error)), + ("WARN", Ok(LogLevelFilter::Warn)), + ("INFO", Ok(LogLevelFilter::Info)), + ("DEBUG", Ok(LogLevelFilter::Debug)), + ("TRACE", Ok(LogLevelFilter::Trace)), + ("asdf", Err(())), + ]; + for &(s, ref expected) in &tests { + assert_eq!(expected, &s.parse()); + } + } + + #[test] + fn test_loglevel_from_str() { + let tests = [ + ("OFF", Err(())), + ("error", Ok(LogLevel::Error)), + ("warn", Ok(LogLevel::Warn)), + ("info", Ok(LogLevel::Info)), + ("debug", Ok(LogLevel::Debug)), + ("trace", Ok(LogLevel::Trace)), + ("ERROR", Ok(LogLevel::Error)), + ("WARN", Ok(LogLevel::Warn)), + ("INFO", Ok(LogLevel::Info)), + ("DEBUG", Ok(LogLevel::Debug)), + ("TRACE", Ok(LogLevel::Trace)), + ("asdf", Err(())), + ]; + for &(s, ref expected) in &tests { + assert_eq!(expected, &s.parse()); + } + } + + #[test] + fn test_loglevel_show() { + assert_eq!("INFO", LogLevel::Info.to_string()); + assert_eq!("ERROR", LogLevel::Error.to_string()); + } + + #[test] + fn test_loglevelfilter_show() { + assert_eq!("OFF", LogLevelFilter::Off.to_string()); + assert_eq!("ERROR", LogLevelFilter::Error.to_string()); + } + + #[test] + fn test_cross_cmp() { + assert!(LogLevel::Debug > LogLevelFilter::Error); + assert!(LogLevelFilter::Warn < LogLevel::Trace); + assert!(LogLevelFilter::Off < LogLevel::Error); + } + + #[test] + fn test_cross_eq() { + assert!(LogLevel::Error == LogLevelFilter::Error); + assert!(LogLevelFilter::Off != LogLevel::Error); + assert!(LogLevel::Trace == LogLevelFilter::Trace); + } + + #[test] + fn test_to_log_level() { + assert_eq!(Some(LogLevel::Error), LogLevelFilter::Error.to_log_level()); + assert_eq!(None, LogLevelFilter::Off.to_log_level()); + assert_eq!(Some(LogLevel::Debug), LogLevelFilter::Debug.to_log_level()); + } + + #[test] + fn test_to_log_level_filter() { + assert_eq!(LogLevelFilter::Error, LogLevel::Error.to_log_level_filter()); + assert_eq!(LogLevelFilter::Trace, LogLevel::Trace.to_log_level_filter()); + } + + #[test] + #[cfg(feature = "use_std")] + fn test_error_trait() { + use std::error::Error; + use super::SetLoggerError; + let e = SetLoggerError(()); + assert_eq!(e.description(), "set_logger() called multiple times"); + } +} diff --git a/third_party/rust/log/src/macros.rs b/third_party/rust/log/src/macros.rs new file mode 100644 index 000000000000..7037f9ac0deb --- /dev/null +++ b/third_party/rust/log/src/macros.rs @@ -0,0 +1,155 @@ +// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +/// The standard logging macro. +/// +/// This macro will generically log with the specified `LogLevel` and `format!` +/// based argument list. +/// +/// The `max_level_*` features can be used to statically disable logging at +/// various levels. +#[macro_export] +macro_rules! log { + (target: $target:expr, $lvl:expr, $($arg:tt)+) => ({ + static _LOC: $crate::LogLocation = $crate::LogLocation { + __line: line!(), + __file: file!(), + __module_path: module_path!(), + }; + let lvl = $lvl; + if lvl <= $crate::__static_max_level() && lvl <= $crate::max_log_level() { + $crate::__log(lvl, $target, &_LOC, format_args!($($arg)+)) + } + }); + ($lvl:expr, $($arg:tt)+) => (log!(target: module_path!(), $lvl, $($arg)+)) +} + +/// Logs a message at the error level. +/// +/// Logging at this level is disabled if the `max_level_off` feature is present. +#[macro_export] +macro_rules! error { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Error, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Error, $($arg)*); + ) +} + +/// Logs a message at the warn level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off` or `max_level_error`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off` or `max_level_error`. +#[macro_export] +macro_rules! warn { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Warn, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Warn, $($arg)*); + ) +} + +/// Logs a message at the info level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off`, `max_level_error`, or `max_level_warn`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off`, `release_max_level_error`, or +/// `release_max_level_warn`. +#[macro_export] +macro_rules! info { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Info, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Info, $($arg)*); + ) +} + +/// Logs a message at the debug level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off`, `max_level_error`, `max_level_warn`, or +/// `max_level_info`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off`, `release_max_level_error`, +/// `release_max_level_warn`, or `release_max_level_info`. +#[macro_export] +macro_rules! debug { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Debug, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Debug, $($arg)*); + ) +} + +/// Logs a message at the trace level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off`, `max_level_error`, `max_level_warn`, +/// `max_level_info`, or `max_level_debug`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off`, `release_max_level_error`, +/// `release_max_level_warn`, `release_max_level_info`, or +/// `release_max_level_debug`. +#[macro_export] +macro_rules! trace { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Trace, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Trace, $($arg)*); + ) +} + +/// Determines if a message logged at the specified level in that module will +/// be logged. +/// +/// This can be used to avoid expensive computation of log message arguments if +/// the message would be ignored anyway. +/// +/// # Examples +/// +/// ```rust +/// # #[macro_use] +/// # extern crate log; +/// use log::LogLevel::Debug; +/// +/// # fn foo() { +/// if log_enabled!(Debug) { +/// let data = expensive_call(); +/// debug!("expensive debug data: {} {}", data.x, data.y); +/// } +/// # } +/// # struct Data { x: u32, y: u32 } +/// # fn expensive_call() -> Data { Data { x: 0, y: 0 } } +/// # fn main() {} +/// ``` +#[macro_export] +macro_rules! log_enabled { + (target: $target:expr, $lvl:expr) => ({ + let lvl = $lvl; + lvl <= $crate::__static_max_level() && lvl <= $crate::max_log_level() && + $crate::__enabled(lvl, $target) + }); + ($lvl:expr) => (log_enabled!(target: module_path!(), $lvl)) +} diff --git a/third_party/rust/log/tests/filters.rs b/third_party/rust/log/tests/filters.rs new file mode 100644 index 000000000000..e08d46db1951 --- /dev/null +++ b/third_party/rust/log/tests/filters.rs @@ -0,0 +1,76 @@ +#[macro_use] extern crate log; + +use std::sync::{Arc, Mutex}; +use log::{LogLevel, LogLevelFilter, Log, LogRecord, LogMetadata}; +use log::MaxLogLevelFilter; + +#[cfg(feature = "use_std")] +use log::set_logger; +#[cfg(not(feature = "use_std"))] +fn set_logger(make_logger: M) -> Result<(), log::SetLoggerError> + where M: FnOnce(MaxLogLevelFilter) -> Box { + unsafe { + log::set_logger_raw(|x| std::mem::transmute(make_logger(x))) + } +} + +struct State { + last_log: Mutex>, + filter: MaxLogLevelFilter, +} + +struct Logger(Arc); + +impl Log for Logger { + fn enabled(&self, _: &LogMetadata) -> bool { + true + } + + fn log(&self, record: &LogRecord) { + *self.0.last_log.lock().unwrap() = Some(record.level()); + } +} + +fn main() { + let mut a = None; + set_logger(|max| { + let me = Arc::new(State { + last_log: Mutex::new(None), + filter: max, + }); + a = Some(me.clone()); + Box::new(Logger(me)) + }).unwrap(); + let a = a.unwrap(); + + test(&a, LogLevelFilter::Off); + test(&a, LogLevelFilter::Error); + test(&a, LogLevelFilter::Warn); + test(&a, LogLevelFilter::Info); + test(&a, LogLevelFilter::Debug); + test(&a, LogLevelFilter::Trace); +} + +fn test(a: &State, filter: LogLevelFilter) { + a.filter.set(filter); + error!(""); + last(&a, t(LogLevel::Error, filter)); + warn!(""); + last(&a, t(LogLevel::Warn, filter)); + info!(""); + last(&a, t(LogLevel::Info, filter)); + debug!(""); + last(&a, t(LogLevel::Debug, filter)); + trace!(""); + last(&a, t(LogLevel::Trace, filter)); + + fn t(lvl: LogLevel, filter: LogLevelFilter) -> Option { + if lvl <= filter {Some(lvl)} else {None} + } +} + +fn last(state: &State, expected: Option) { + let mut lvl = state.last_log.lock().unwrap(); + assert_eq!(*lvl, expected); + *lvl = None; +} diff --git a/third_party/rust/matches/.cargo-checksum.json b/third_party/rust/matches/.cargo-checksum.json index 4f1624f6efa4..42b442fd94d5 100644 --- a/third_party/rust/matches/.cargo-checksum.json +++ b/third_party/rust/matches/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"a55cb9efcb3820aa9fcdff157bffaa287988ea9d4cec33e638fa7fdd978c7742","lib.rs":"d927e99fc4fd88b0e30b44580384b411e63bc504e9953ac7cc85029437372266"},"package":"bcc3ad8109fa4b522f9b0cd81440422781f564aaf8c195de6b9d6642177ad0dd"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"8bbbe858562332a57f5f5551b427e79874ae3c3df52766df61860871288e827a","LICENSE":"d7b49708075b5f43f8e108464f1970c8c66fa8b6afce4f9c944da3af77cc1460","lib.rs":"d927e99fc4fd88b0e30b44580384b411e63bc504e9953ac7cc85029437372266"},"package":"efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"} \ No newline at end of file diff --git a/third_party/rust/matches/Cargo.toml b/third_party/rust/matches/Cargo.toml index 042e1cc9abb0..f3977a514602 100644 --- a/third_party/rust/matches/Cargo.toml +++ b/third_party/rust/matches/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "matches" -version = "0.1.3" +version = "0.1.4" authors = ["Simon Sapin "] license = "MIT" repository = "https://github.com/SimonSapin/rust-std-candidates" diff --git a/third_party/rust/matches/LICENSE b/third_party/rust/matches/LICENSE new file mode 100644 index 000000000000..a7b759a49c05 --- /dev/null +++ b/third_party/rust/matches/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2014-2016 Simon Sapin + +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. diff --git a/third_party/rust/metadeps/.cargo-checksum.json b/third_party/rust/metadeps/.cargo-checksum.json new file mode 100644 index 000000000000..0a0abb59f496 --- /dev/null +++ b/third_party/rust/metadeps/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7fddeb99c2f6a8bf0c57f8ec992f4f3dd643174aaf358faaa704d9ae103eddda","Cargo.toml":"92121442fa4299ae532a607fa048008cabb3ff28434f89014be0763b971fe27c","README.md":"d9b95a8e3c7b120af66d04a2390e06cf784e5e29ad05e65877fa932602387fb5","src/lib.rs":"d03ec98e8c9aea41fecccc684564434e589200adad1363067a8f4297e0fa6531","tests/test.rs":"d7475de77f692d838605f9b9645993dbb8a7f8c4dc5fdfd41b8fa52d47f6352c","tests/testdata.pc":"43f481e989c03674fed5ef78c6420b3f8d36a2ce001928d86c418d1844acd5e7","tests/testlib.pc":"a6e8f05cbef472d36ebb4cbf00bd95410189ba8d41e5b2e974f53da4c62e2b60","tests/toml-missing-file/no-cargo-toml-here":"6ab4da4b56f15315df6538610cfcd2ba3d0f9a7a8414678ff00ab5a78f7d41fa"},"package":"829fffe7ea1d747e23f64be972991bc516b2f1ac2ae4a3b33d8bea150c410151"} \ No newline at end of file diff --git a/third_party/rust/metadeps/.cargo-ok b/third_party/rust/metadeps/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/metadeps/.gitignore b/third_party/rust/metadeps/.gitignore new file mode 100644 index 000000000000..1b72444aefcf --- /dev/null +++ b/third_party/rust/metadeps/.gitignore @@ -0,0 +1,2 @@ +/Cargo.lock +/target diff --git a/third_party/rust/metadeps/Cargo.toml b/third_party/rust/metadeps/Cargo.toml new file mode 100644 index 000000000000..f01f7dbce9c1 --- /dev/null +++ b/third_party/rust/metadeps/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "metadeps" +version = "1.1.1" +authors = ["Josh Triplett "] +license = "MIT/Apache-2.0" +repository = "https://github.com/joshtriplett/metadeps" +documentation = "http://docs.rs/metadeps" +description = "Run pkg-config from declarative dependencies in Cargo.toml" +keywords = ["pkg-config", "build-dependencies", "build-depends", "manifest", "metadata"] + +[dependencies] +error-chain = { version = "0.7.1", default-features = false } +pkg-config = "0.3.8" +toml = { version = "0.2", default-features = false } + +[dev-dependencies] +lazy_static = "0.2" diff --git a/third_party/rust/metadeps/README.md b/third_party/rust/metadeps/README.md new file mode 100644 index 000000000000..26db2d60f678 --- /dev/null +++ b/third_party/rust/metadeps/README.md @@ -0,0 +1,30 @@ +metadeps lets you write `pkg-config` dependencies in `Cargo.toml` metadata, +rather than programmatically in `build.rs`. This makes those dependencies +declarative, so other tools can read them as well. + +# Usage + +In your `Cargo.toml`, add the following to your `[build-dependencies]`: + +```toml +metadeps = "1.1" +``` + +Then, to declare a dependency on `testlib >= 1.2`, and a conditional dependency +on `testdata >= 4.5`, add the following section: + +```toml +[package.metadata.pkg-config] +testlib = "1.2" +testdata = { version = "4.5", feature = "use-testdata" } +``` + +In your `build.rs`, add: + +```rust +extern crate metadeps; + +fn main() { + metadeps::probe().unwrap(); +} +``` diff --git a/third_party/rust/metadeps/src/lib.rs b/third_party/rust/metadeps/src/lib.rs new file mode 100644 index 000000000000..699afce53068 --- /dev/null +++ b/third_party/rust/metadeps/src/lib.rs @@ -0,0 +1,84 @@ +//! metadeps lets you write `pkg-config` dependencies in `Cargo.toml` metadata, +//! rather than programmatically in `build.rs`. This makes those dependencies +//! declarative, so other tools can read them as well. +//! +//! metadeps parses metadata like this in `Cargo.toml`: +//! +//! ```toml +//! [package.metadata.pkg-config] +//! testlib = "1.2" +//! testdata = { version = "4.5", feature = "some-feature" } +//! ``` + +#![deny(missing_docs, warnings)] + +#[macro_use] +extern crate error_chain; +extern crate pkg_config; +extern crate toml; + +use std::collections::HashMap; +use std::env; +use std::fs; +use std::io::Read; +use std::path::PathBuf; +use pkg_config::{Config, Library}; + +error_chain! { + foreign_links { + PkgConfig(pkg_config::Error) #[doc="pkg-config error"]; + } +} + +/// Probe all libraries configured in the Cargo.toml +/// `[package.metadata.pkg-config]` section. +pub fn probe() -> Result> { + let dir = try!(env::var_os("CARGO_MANIFEST_DIR").ok_or("$CARGO_MANIFEST_DIR not set")); + let mut path = PathBuf::from(dir); + path.push("Cargo.toml"); + let mut manifest = try!(fs::File::open(&path).chain_err(|| + format!("Error opening {}", path.display()) + )); + let mut manifest_str = String::new(); + try!(manifest.read_to_string(&mut manifest_str).chain_err(|| + format!("Error reading {}", path.display()) + )); + let toml = try!(manifest_str.parse::().map_err(|e| + format!("Error parsing TOML from {}: {:?}", path.display(), e) + )); + let key = "package.metadata.pkg-config"; + let meta = try!(toml.lookup(key).ok_or( + format!("No {} in {}", key, path.display()) + )); + let table = try!(meta.as_table().ok_or( + format!("{} not a table in {}", key, path.display()) + )); + let mut libraries = HashMap::new(); + for (name, value) in table { + let ref version = match value { + &toml::Value::String(ref s) => s, + &toml::Value::Table(ref t) => { + let mut feature = None; + let mut version = None; + for (tname, tvalue) in t { + match (tname.as_str(), tvalue) { + ("feature", &toml::Value::String(ref s)) => { feature = Some(s); } + ("version", &toml::Value::String(ref s)) => { version = Some(s); } + _ => bail!("Unexpected key {}.{}.{} type {}", key, name, tname, tvalue.type_str()), + } + } + if let Some(feature) = feature { + let var = format!("CARGO_FEATURE_{}", feature.to_uppercase().replace('-', "_")); + if env::var_os(var).is_none() { + continue; + } + } + try!(version.ok_or(format!("No version in {}.{}", key, name))) + } + _ => bail!("{}.{} not a string or table", key, name), + }; + let library = try!(Config::new().atleast_version(&version).probe(name)); + libraries.insert(name.clone(), library); + } + Ok(libraries) +} diff --git a/third_party/rust/metadeps/tests/test.rs b/third_party/rust/metadeps/tests/test.rs new file mode 100644 index 000000000000..b31c4f5badc0 --- /dev/null +++ b/third_party/rust/metadeps/tests/test.rs @@ -0,0 +1,76 @@ +#[macro_use] +extern crate lazy_static; +extern crate metadeps; +extern crate pkg_config; + +use std::env; +use std::sync::Mutex; + +lazy_static! { + static ref LOCK: Mutex<()> = Mutex::new(()); +} + +fn toml(path: &str) -> metadeps::Result> { + let _l = LOCK.lock(); + env::set_var("PKG_CONFIG_PATH", &env::current_dir().unwrap().join("tests")); + env::set_var("CARGO_MANIFEST_DIR", &env::current_dir().unwrap().join("tests").join(path)); + env::set_var("CARGO_FEATURE_TEST_FEATURE", ""); + metadeps::probe() +} + +#[test] +fn good() { + let libraries = toml("toml-good").unwrap(); + let testlib = libraries.get("testlib").unwrap(); + assert_eq!(testlib.version, "1.2.3"); + let testdata = libraries.get("testdata").unwrap(); + assert_eq!(testdata.version, "4.5.6"); + assert!(libraries.get("testmore").is_none()); +} + +fn toml_err(path: &str, err_starts_with: &str) { + let err = toml(path).unwrap_err(); + if !err.description().starts_with(err_starts_with) { + panic!("Expected error to start with: {:?}\nGot error: {:?}", err_starts_with, err); + } +} + +#[test] +fn missing_file() { + toml_err("toml-missing-file", "Error opening"); +} + +#[test] +fn missing_key() { + toml_err("toml-missing-key", "No package.metadata.pkg-config in"); +} + +#[test] +fn not_table() { + toml_err("toml-not-table", "package.metadata.pkg-config not a table in"); +} + +#[test] +fn version_missing() { + toml_err("toml-version-missing", "No version in package.metadata.pkg-config.testlib"); +} + +#[test] +fn version_not_string() { + toml_err("toml-version-not-string", "package.metadata.pkg-config.testlib not a string or table"); +} + +#[test] +fn version_in_table_not_string() { + toml_err("toml-version-in-table-not-string", "Unexpected key package.metadata.pkg-config.testlib.version type integer"); +} + +#[test] +fn feature_not_string() { + toml_err("toml-feature-not-string", "Unexpected key package.metadata.pkg-config.testlib.feature type integer"); +} + +#[test] +fn unexpected_key() { + toml_err("toml-unexpected-key", "Unexpected key package.metadata.pkg-config.testlib.color type string"); +} diff --git a/third_party/rust/metadeps/tests/testdata.pc b/third_party/rust/metadeps/tests/testdata.pc new file mode 100644 index 000000000000..24156b7c409d --- /dev/null +++ b/third_party/rust/metadeps/tests/testdata.pc @@ -0,0 +1,8 @@ +Name: Test Data +Description: Fake data to test pkg-config. +Version: 4.5.6 + +prefix=/usr +datarootdir=${prefix}/share +datadir=${datarootdir} +testdata=${datadir}/testdata/test.dat diff --git a/third_party/rust/metadeps/tests/testlib.pc b/third_party/rust/metadeps/tests/testlib.pc new file mode 100644 index 000000000000..d330eefa747f --- /dev/null +++ b/third_party/rust/metadeps/tests/testlib.pc @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib/x86_64-linux-gnu +includedir=${prefix}/include/testlib + +Name: Test Library +Description: A fake library to test pkg-config. +Version: 1.2.3 +Libs: L${libdir} -ltest +Cflags: -I${includedir} diff --git a/third_party/rust/metadeps/tests/toml-missing-file/no-cargo-toml-here b/third_party/rust/metadeps/tests/toml-missing-file/no-cargo-toml-here new file mode 100644 index 000000000000..fc36b52523fd --- /dev/null +++ b/third_party/rust/metadeps/tests/toml-missing-file/no-cargo-toml-here @@ -0,0 +1 @@ +No Cargo.toml here diff --git a/third_party/rust/num-traits/.cargo-checksum.json b/third_party/rust/num-traits/.cargo-checksum.json new file mode 100644 index 000000000000..1386668bf166 --- /dev/null +++ b/third_party/rust/num-traits/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"3befa332314f31a68e226930e393fd79b0215fab661519f3163b04ef6fbccaac","src/bounds.rs":"32f69f86640520478eff7978951a6d2dc0d51fe263782970185fb31ffcc4a9e1","src/cast.rs":"d76053ff336eadb80a18725c174226b4be147b876c6aa70d7aa81a16d85e9f25","src/float.rs":"1f9d571bd3946d1d93dc7f4f4ae344bfabf5fd871243145aad120e242599c2e4","src/identities.rs":"188c63de57997fb8468732251a3a8d7f665b8f61d512222c2553baefe1c827bb","src/int.rs":"8ef622da766cb69586981e5eb5bd6c608ce9db0e345aeb34347023730561cb87","src/lib.rs":"3e56bafef9c32e10ff8d70241f64a0d811cd6dfc8f57924c094d1735f32fc3b2","src/ops/checked.rs":"f02fd815b99edf079043d3621c1566e0ab3e755fe284d0b8fdf5d7ca56d546e7","src/ops/mod.rs":"2ed0ec81f58958665f251348fa670375ab863a628182a2dec20308b249a8087a","src/ops/saturating.rs":"46821d815c90c16b2f6bec0b94b4d7ebdbddf3ea42edc0467de738c56abf6436","src/pow.rs":"73b611ad8d595ef917871ba859ff0c25efc2382220d30568e5fbb930bf6b4daa","src/sign.rs":"c08ad1647d393571cc73344b174b1764d7d7d5fb57170cc8f1d26e7ab9527e7c"},"package":"a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c"} \ No newline at end of file diff --git a/third_party/rust/num-traits/.cargo-ok b/third_party/rust/num-traits/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/num-traits/Cargo.toml b/third_party/rust/num-traits/Cargo.toml new file mode 100644 index 000000000000..65f9366bd171 --- /dev/null +++ b/third_party/rust/num-traits/Cargo.toml @@ -0,0 +1,12 @@ +[package] +authors = ["The Rust Project Developers"] +description = "Numeric traits for generic mathematics" +documentation = "http://rust-num.github.io/num" +homepage = "https://github.com/rust-num/num" +keywords = ["mathematics", "numerics"] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-num/num" +name = "num-traits" +version = "0.1.36" + +[dependencies] diff --git a/third_party/rust/num-traits/src/bounds.rs b/third_party/rust/num-traits/src/bounds.rs new file mode 100644 index 000000000000..966296c4ca6e --- /dev/null +++ b/third_party/rust/num-traits/src/bounds.rs @@ -0,0 +1,71 @@ +use std::{usize, u8, u16, u32, u64}; +use std::{isize, i8, i16, i32, i64}; +use std::{f32, f64}; + +/// Numbers which have upper and lower bounds +pub trait Bounded { + // FIXME (#5527): These should be associated constants + /// returns the smallest finite number this type can represent + fn min_value() -> Self; + /// returns the largest finite number this type can represent + fn max_value() -> Self; +} + +macro_rules! bounded_impl { + ($t:ty, $min:expr, $max:expr) => { + impl Bounded for $t { + #[inline] + fn min_value() -> $t { $min } + + #[inline] + fn max_value() -> $t { $max } + } + } +} + +bounded_impl!(usize, usize::MIN, usize::MAX); +bounded_impl!(u8, u8::MIN, u8::MAX); +bounded_impl!(u16, u16::MIN, u16::MAX); +bounded_impl!(u32, u32::MIN, u32::MAX); +bounded_impl!(u64, u64::MIN, u64::MAX); + +bounded_impl!(isize, isize::MIN, isize::MAX); +bounded_impl!(i8, i8::MIN, i8::MAX); +bounded_impl!(i16, i16::MIN, i16::MAX); +bounded_impl!(i32, i32::MIN, i32::MAX); +bounded_impl!(i64, i64::MIN, i64::MAX); + +bounded_impl!(f32, f32::MIN, f32::MAX); + +macro_rules! for_each_tuple_ { + ( $m:ident !! ) => ( + $m! { } + ); + ( $m:ident !! $h:ident, $($t:ident,)* ) => ( + $m! { $h $($t)* } + for_each_tuple_! { $m !! $($t,)* } + ); +} +macro_rules! for_each_tuple { + ( $m:ident ) => ( + for_each_tuple_! { $m !! A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, } + ); +} + +macro_rules! bounded_tuple { + ( $($name:ident)* ) => ( + impl<$($name: Bounded,)*> Bounded for ($($name,)*) { + #[inline] + fn min_value() -> Self { + ($($name::min_value(),)*) + } + #[inline] + fn max_value() -> Self { + ($($name::max_value(),)*) + } + } + ); +} + +for_each_tuple!(bounded_tuple); +bounded_impl!(f64, f64::MIN, f64::MAX); diff --git a/third_party/rust/num-traits/src/cast.rs b/third_party/rust/num-traits/src/cast.rs new file mode 100644 index 000000000000..8ff03fd7607c --- /dev/null +++ b/third_party/rust/num-traits/src/cast.rs @@ -0,0 +1,450 @@ +use std::mem::size_of; + +use identities::Zero; +use bounds::Bounded; + +/// A generic trait for converting a value to a number. +pub trait ToPrimitive { + /// Converts the value of `self` to an `isize`. + #[inline] + fn to_isize(&self) -> Option { + self.to_i64().and_then(|x| x.to_isize()) + } + + /// Converts the value of `self` to an `i8`. + #[inline] + fn to_i8(&self) -> Option { + self.to_i64().and_then(|x| x.to_i8()) + } + + /// Converts the value of `self` to an `i16`. + #[inline] + fn to_i16(&self) -> Option { + self.to_i64().and_then(|x| x.to_i16()) + } + + /// Converts the value of `self` to an `i32`. + #[inline] + fn to_i32(&self) -> Option { + self.to_i64().and_then(|x| x.to_i32()) + } + + /// Converts the value of `self` to an `i64`. + fn to_i64(&self) -> Option; + + /// Converts the value of `self` to a `usize`. + #[inline] + fn to_usize(&self) -> Option { + self.to_u64().and_then(|x| x.to_usize()) + } + + /// Converts the value of `self` to an `u8`. + #[inline] + fn to_u8(&self) -> Option { + self.to_u64().and_then(|x| x.to_u8()) + } + + /// Converts the value of `self` to an `u16`. + #[inline] + fn to_u16(&self) -> Option { + self.to_u64().and_then(|x| x.to_u16()) + } + + /// Converts the value of `self` to an `u32`. + #[inline] + fn to_u32(&self) -> Option { + self.to_u64().and_then(|x| x.to_u32()) + } + + /// Converts the value of `self` to an `u64`. + #[inline] + fn to_u64(&self) -> Option; + + /// Converts the value of `self` to an `f32`. + #[inline] + fn to_f32(&self) -> Option { + self.to_f64().and_then(|x| x.to_f32()) + } + + /// Converts the value of `self` to an `f64`. + #[inline] + fn to_f64(&self) -> Option { + self.to_i64().and_then(|x| x.to_f64()) + } +} + +macro_rules! impl_to_primitive_int_to_int { + ($SrcT:ty, $DstT:ty, $slf:expr) => ( + { + if size_of::<$SrcT>() <= size_of::<$DstT>() { + Some($slf as $DstT) + } else { + let n = $slf as i64; + let min_value: $DstT = Bounded::min_value(); + let max_value: $DstT = Bounded::max_value(); + if min_value as i64 <= n && n <= max_value as i64 { + Some($slf as $DstT) + } else { + None + } + } + } + ) +} + +macro_rules! impl_to_primitive_int_to_uint { + ($SrcT:ty, $DstT:ty, $slf:expr) => ( + { + let zero: $SrcT = Zero::zero(); + let max_value: $DstT = Bounded::max_value(); + if zero <= $slf && $slf as u64 <= max_value as u64 { + Some($slf as $DstT) + } else { + None + } + } + ) +} + +macro_rules! impl_to_primitive_int { + ($T:ty) => ( + impl ToPrimitive for $T { + #[inline] + fn to_isize(&self) -> Option { impl_to_primitive_int_to_int!($T, isize, *self) } + #[inline] + fn to_i8(&self) -> Option { impl_to_primitive_int_to_int!($T, i8, *self) } + #[inline] + fn to_i16(&self) -> Option { impl_to_primitive_int_to_int!($T, i16, *self) } + #[inline] + fn to_i32(&self) -> Option { impl_to_primitive_int_to_int!($T, i32, *self) } + #[inline] + fn to_i64(&self) -> Option { impl_to_primitive_int_to_int!($T, i64, *self) } + + #[inline] + fn to_usize(&self) -> Option { impl_to_primitive_int_to_uint!($T, usize, *self) } + #[inline] + fn to_u8(&self) -> Option { impl_to_primitive_int_to_uint!($T, u8, *self) } + #[inline] + fn to_u16(&self) -> Option { impl_to_primitive_int_to_uint!($T, u16, *self) } + #[inline] + fn to_u32(&self) -> Option { impl_to_primitive_int_to_uint!($T, u32, *self) } + #[inline] + fn to_u64(&self) -> Option { impl_to_primitive_int_to_uint!($T, u64, *self) } + + #[inline] + fn to_f32(&self) -> Option { Some(*self as f32) } + #[inline] + fn to_f64(&self) -> Option { Some(*self as f64) } + } + ) +} + +impl_to_primitive_int!(isize); +impl_to_primitive_int!(i8); +impl_to_primitive_int!(i16); +impl_to_primitive_int!(i32); +impl_to_primitive_int!(i64); + +macro_rules! impl_to_primitive_uint_to_int { + ($DstT:ty, $slf:expr) => ( + { + let max_value: $DstT = Bounded::max_value(); + if $slf as u64 <= max_value as u64 { + Some($slf as $DstT) + } else { + None + } + } + ) +} + +macro_rules! impl_to_primitive_uint_to_uint { + ($SrcT:ty, $DstT:ty, $slf:expr) => ( + { + if size_of::<$SrcT>() <= size_of::<$DstT>() { + Some($slf as $DstT) + } else { + let zero: $SrcT = Zero::zero(); + let max_value: $DstT = Bounded::max_value(); + if zero <= $slf && $slf as u64 <= max_value as u64 { + Some($slf as $DstT) + } else { + None + } + } + } + ) +} + +macro_rules! impl_to_primitive_uint { + ($T:ty) => ( + impl ToPrimitive for $T { + #[inline] + fn to_isize(&self) -> Option { impl_to_primitive_uint_to_int!(isize, *self) } + #[inline] + fn to_i8(&self) -> Option { impl_to_primitive_uint_to_int!(i8, *self) } + #[inline] + fn to_i16(&self) -> Option { impl_to_primitive_uint_to_int!(i16, *self) } + #[inline] + fn to_i32(&self) -> Option { impl_to_primitive_uint_to_int!(i32, *self) } + #[inline] + fn to_i64(&self) -> Option { impl_to_primitive_uint_to_int!(i64, *self) } + + #[inline] + fn to_usize(&self) -> Option { + impl_to_primitive_uint_to_uint!($T, usize, *self) + } + #[inline] + fn to_u8(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u8, *self) } + #[inline] + fn to_u16(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u16, *self) } + #[inline] + fn to_u32(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u32, *self) } + #[inline] + fn to_u64(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u64, *self) } + + #[inline] + fn to_f32(&self) -> Option { Some(*self as f32) } + #[inline] + fn to_f64(&self) -> Option { Some(*self as f64) } + } + ) +} + +impl_to_primitive_uint!(usize); +impl_to_primitive_uint!(u8); +impl_to_primitive_uint!(u16); +impl_to_primitive_uint!(u32); +impl_to_primitive_uint!(u64); + +macro_rules! impl_to_primitive_float_to_float { + ($SrcT:ident, $DstT:ident, $slf:expr) => ( + if size_of::<$SrcT>() <= size_of::<$DstT>() { + Some($slf as $DstT) + } else { + // Make sure the value is in range for the cast. + // NaN and +-inf are cast as they are. + let n = $slf as f64; + let max_value: $DstT = ::std::$DstT::MAX; + if !n.is_finite() || (-max_value as f64 <= n && n <= max_value as f64) { + Some($slf as $DstT) + } else { + None + } + } + ) +} + +macro_rules! impl_to_primitive_float { + ($T:ident) => ( + impl ToPrimitive for $T { + #[inline] + fn to_isize(&self) -> Option { Some(*self as isize) } + #[inline] + fn to_i8(&self) -> Option { Some(*self as i8) } + #[inline] + fn to_i16(&self) -> Option { Some(*self as i16) } + #[inline] + fn to_i32(&self) -> Option { Some(*self as i32) } + #[inline] + fn to_i64(&self) -> Option { Some(*self as i64) } + + #[inline] + fn to_usize(&self) -> Option { Some(*self as usize) } + #[inline] + fn to_u8(&self) -> Option { Some(*self as u8) } + #[inline] + fn to_u16(&self) -> Option { Some(*self as u16) } + #[inline] + fn to_u32(&self) -> Option { Some(*self as u32) } + #[inline] + fn to_u64(&self) -> Option { Some(*self as u64) } + + #[inline] + fn to_f32(&self) -> Option { impl_to_primitive_float_to_float!($T, f32, *self) } + #[inline] + fn to_f64(&self) -> Option { impl_to_primitive_float_to_float!($T, f64, *self) } + } + ) +} + +impl_to_primitive_float!(f32); +impl_to_primitive_float!(f64); + +/// A generic trait for converting a number to a value. +pub trait FromPrimitive: Sized { + /// Convert an `isize` to return an optional value of this type. If the + /// value cannot be represented by this value, the `None` is returned. + #[inline] + fn from_isize(n: isize) -> Option { + FromPrimitive::from_i64(n as i64) + } + + /// Convert an `i8` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_i8(n: i8) -> Option { + FromPrimitive::from_i64(n as i64) + } + + /// Convert an `i16` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_i16(n: i16) -> Option { + FromPrimitive::from_i64(n as i64) + } + + /// Convert an `i32` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_i32(n: i32) -> Option { + FromPrimitive::from_i64(n as i64) + } + + /// Convert an `i64` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + fn from_i64(n: i64) -> Option; + + /// Convert a `usize` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_usize(n: usize) -> Option { + FromPrimitive::from_u64(n as u64) + } + + /// Convert an `u8` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_u8(n: u8) -> Option { + FromPrimitive::from_u64(n as u64) + } + + /// Convert an `u16` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_u16(n: u16) -> Option { + FromPrimitive::from_u64(n as u64) + } + + /// Convert an `u32` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_u32(n: u32) -> Option { + FromPrimitive::from_u64(n as u64) + } + + /// Convert an `u64` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + fn from_u64(n: u64) -> Option; + + /// Convert a `f32` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_f32(n: f32) -> Option { + FromPrimitive::from_f64(n as f64) + } + + /// Convert a `f64` to return an optional value of this type. If the + /// type cannot be represented by this value, the `None` is returned. + #[inline] + fn from_f64(n: f64) -> Option { + FromPrimitive::from_i64(n as i64) + } +} + +macro_rules! impl_from_primitive { + ($T:ty, $to_ty:ident) => ( + #[allow(deprecated)] + impl FromPrimitive for $T { + #[inline] fn from_i8(n: i8) -> Option<$T> { n.$to_ty() } + #[inline] fn from_i16(n: i16) -> Option<$T> { n.$to_ty() } + #[inline] fn from_i32(n: i32) -> Option<$T> { n.$to_ty() } + #[inline] fn from_i64(n: i64) -> Option<$T> { n.$to_ty() } + + #[inline] fn from_u8(n: u8) -> Option<$T> { n.$to_ty() } + #[inline] fn from_u16(n: u16) -> Option<$T> { n.$to_ty() } + #[inline] fn from_u32(n: u32) -> Option<$T> { n.$to_ty() } + #[inline] fn from_u64(n: u64) -> Option<$T> { n.$to_ty() } + + #[inline] fn from_f32(n: f32) -> Option<$T> { n.$to_ty() } + #[inline] fn from_f64(n: f64) -> Option<$T> { n.$to_ty() } + } + ) +} + +impl_from_primitive!(isize, to_isize); +impl_from_primitive!(i8, to_i8); +impl_from_primitive!(i16, to_i16); +impl_from_primitive!(i32, to_i32); +impl_from_primitive!(i64, to_i64); +impl_from_primitive!(usize, to_usize); +impl_from_primitive!(u8, to_u8); +impl_from_primitive!(u16, to_u16); +impl_from_primitive!(u32, to_u32); +impl_from_primitive!(u64, to_u64); +impl_from_primitive!(f32, to_f32); +impl_from_primitive!(f64, to_f64); + +/// Cast from one machine scalar to another. +/// +/// # Examples +/// +/// ``` +/// # use num_traits as num; +/// let twenty: f32 = num::cast(0x14).unwrap(); +/// assert_eq!(twenty, 20f32); +/// ``` +/// +#[inline] +pub fn cast(n: T) -> Option { + NumCast::from(n) +} + +/// An interface for casting between machine scalars. +pub trait NumCast: Sized + ToPrimitive { + /// Creates a number from another value that can be converted into + /// a primitive via the `ToPrimitive` trait. + fn from(n: T) -> Option; +} + +macro_rules! impl_num_cast { + ($T:ty, $conv:ident) => ( + impl NumCast for $T { + #[inline] + #[allow(deprecated)] + fn from(n: N) -> Option<$T> { + // `$conv` could be generated using `concat_idents!`, but that + // macro seems to be broken at the moment + n.$conv() + } + } + ) +} + +impl_num_cast!(u8, to_u8); +impl_num_cast!(u16, to_u16); +impl_num_cast!(u32, to_u32); +impl_num_cast!(u64, to_u64); +impl_num_cast!(usize, to_usize); +impl_num_cast!(i8, to_i8); +impl_num_cast!(i16, to_i16); +impl_num_cast!(i32, to_i32); +impl_num_cast!(i64, to_i64); +impl_num_cast!(isize, to_isize); +impl_num_cast!(f32, to_f32); +impl_num_cast!(f64, to_f64); + + +#[test] +fn to_primitive_float() { + use std::f32; + use std::f64; + + let f32_toolarge = 1e39f64; + assert_eq!(f32_toolarge.to_f32(), None); + assert_eq!((f32::MAX as f64).to_f32(), Some(f32::MAX)); + assert_eq!((-f32::MAX as f64).to_f32(), Some(-f32::MAX)); + assert_eq!(f64::INFINITY.to_f32(), Some(f32::INFINITY)); + assert_eq!((f64::NEG_INFINITY).to_f32(), Some(f32::NEG_INFINITY)); + assert!((f64::NAN).to_f32().map_or(false, |f| f.is_nan())); +} diff --git a/third_party/rust/num-traits/src/float.rs b/third_party/rust/num-traits/src/float.rs new file mode 100644 index 000000000000..757be876e52b --- /dev/null +++ b/third_party/rust/num-traits/src/float.rs @@ -0,0 +1,1346 @@ +use std::mem; +use std::ops::Neg; +use std::num::FpCategory; + +// Used for default implementation of `epsilon` +use std::f32; + +use {Num, NumCast}; + +// FIXME: these doctests aren't actually helpful, because they're using and +// testing the inherent methods directly, not going through `Float`. + +pub trait Float + : Num + + Copy + + NumCast + + PartialOrd + + Neg +{ + /// Returns the `NaN` value. + /// + /// ``` + /// use num_traits::Float; + /// + /// let nan: f32 = Float::nan(); + /// + /// assert!(nan.is_nan()); + /// ``` + fn nan() -> Self; + /// Returns the infinite value. + /// + /// ``` + /// use num_traits::Float; + /// use std::f32; + /// + /// let infinity: f32 = Float::infinity(); + /// + /// assert!(infinity.is_infinite()); + /// assert!(!infinity.is_finite()); + /// assert!(infinity > f32::MAX); + /// ``` + fn infinity() -> Self; + /// Returns the negative infinite value. + /// + /// ``` + /// use num_traits::Float; + /// use std::f32; + /// + /// let neg_infinity: f32 = Float::neg_infinity(); + /// + /// assert!(neg_infinity.is_infinite()); + /// assert!(!neg_infinity.is_finite()); + /// assert!(neg_infinity < f32::MIN); + /// ``` + fn neg_infinity() -> Self; + /// Returns `-0.0`. + /// + /// ``` + /// use num_traits::{Zero, Float}; + /// + /// let inf: f32 = Float::infinity(); + /// let zero: f32 = Zero::zero(); + /// let neg_zero: f32 = Float::neg_zero(); + /// + /// assert_eq!(zero, neg_zero); + /// assert_eq!(7.0f32/inf, zero); + /// assert_eq!(zero * 10.0, zero); + /// ``` + fn neg_zero() -> Self; + + /// Returns the smallest finite value that this type can represent. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x: f64 = Float::min_value(); + /// + /// assert_eq!(x, f64::MIN); + /// ``` + fn min_value() -> Self; + + /// Returns the smallest positive, normalized value that this type can represent. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x: f64 = Float::min_positive_value(); + /// + /// assert_eq!(x, f64::MIN_POSITIVE); + /// ``` + fn min_positive_value() -> Self; + + /// Returns epsilon, a small positive value. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x: f64 = Float::epsilon(); + /// + /// assert_eq!(x, f64::EPSILON); + /// ``` + /// + /// # Panics + /// + /// The default implementation will panic if `f32::EPSILON` cannot + /// be cast to `Self`. + fn epsilon() -> Self { + Self::from(f32::EPSILON).expect("Unable to cast from f32::EPSILON") + } + + /// Returns the largest finite value that this type can represent. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x: f64 = Float::max_value(); + /// assert_eq!(x, f64::MAX); + /// ``` + fn max_value() -> Self; + + /// Returns `true` if this value is `NaN` and false otherwise. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let nan = f64::NAN; + /// let f = 7.0; + /// + /// assert!(nan.is_nan()); + /// assert!(!f.is_nan()); + /// ``` + fn is_nan(self) -> bool; + + /// Returns `true` if this value is positive infinity or negative infinity and + /// false otherwise. + /// + /// ``` + /// use num_traits::Float; + /// use std::f32; + /// + /// let f = 7.0f32; + /// let inf: f32 = Float::infinity(); + /// let neg_inf: f32 = Float::neg_infinity(); + /// let nan: f32 = f32::NAN; + /// + /// assert!(!f.is_infinite()); + /// assert!(!nan.is_infinite()); + /// + /// assert!(inf.is_infinite()); + /// assert!(neg_inf.is_infinite()); + /// ``` + fn is_infinite(self) -> bool; + + /// Returns `true` if this number is neither infinite nor `NaN`. + /// + /// ``` + /// use num_traits::Float; + /// use std::f32; + /// + /// let f = 7.0f32; + /// let inf: f32 = Float::infinity(); + /// let neg_inf: f32 = Float::neg_infinity(); + /// let nan: f32 = f32::NAN; + /// + /// assert!(f.is_finite()); + /// + /// assert!(!nan.is_finite()); + /// assert!(!inf.is_finite()); + /// assert!(!neg_inf.is_finite()); + /// ``` + fn is_finite(self) -> bool; + + /// Returns `true` if the number is neither zero, infinite, + /// [subnormal][subnormal], or `NaN`. + /// + /// ``` + /// use num_traits::Float; + /// use std::f32; + /// + /// let min = f32::MIN_POSITIVE; // 1.17549435e-38f32 + /// let max = f32::MAX; + /// let lower_than_min = 1.0e-40_f32; + /// let zero = 0.0f32; + /// + /// assert!(min.is_normal()); + /// assert!(max.is_normal()); + /// + /// assert!(!zero.is_normal()); + /// assert!(!f32::NAN.is_normal()); + /// assert!(!f32::INFINITY.is_normal()); + /// // Values between `0` and `min` are Subnormal. + /// assert!(!lower_than_min.is_normal()); + /// ``` + /// [subnormal]: http://en.wikipedia.org/wiki/Denormal_number + fn is_normal(self) -> bool; + + /// Returns the floating point category of the number. If only one property + /// is going to be tested, it is generally faster to use the specific + /// predicate instead. + /// + /// ``` + /// use num_traits::Float; + /// use std::num::FpCategory; + /// use std::f32; + /// + /// let num = 12.4f32; + /// let inf = f32::INFINITY; + /// + /// assert_eq!(num.classify(), FpCategory::Normal); + /// assert_eq!(inf.classify(), FpCategory::Infinite); + /// ``` + fn classify(self) -> FpCategory; + + /// Returns the largest integer less than or equal to a number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let f = 3.99; + /// let g = 3.0; + /// + /// assert_eq!(f.floor(), 3.0); + /// assert_eq!(g.floor(), 3.0); + /// ``` + fn floor(self) -> Self; + + /// Returns the smallest integer greater than or equal to a number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let f = 3.01; + /// let g = 4.0; + /// + /// assert_eq!(f.ceil(), 4.0); + /// assert_eq!(g.ceil(), 4.0); + /// ``` + fn ceil(self) -> Self; + + /// Returns the nearest integer to a number. Round half-way cases away from + /// `0.0`. + /// + /// ``` + /// use num_traits::Float; + /// + /// let f = 3.3; + /// let g = -3.3; + /// + /// assert_eq!(f.round(), 3.0); + /// assert_eq!(g.round(), -3.0); + /// ``` + fn round(self) -> Self; + + /// Return the integer part of a number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let f = 3.3; + /// let g = -3.7; + /// + /// assert_eq!(f.trunc(), 3.0); + /// assert_eq!(g.trunc(), -3.0); + /// ``` + fn trunc(self) -> Self; + + /// Returns the fractional part of a number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 3.5; + /// let y = -3.5; + /// let abs_difference_x = (x.fract() - 0.5).abs(); + /// let abs_difference_y = (y.fract() - (-0.5)).abs(); + /// + /// assert!(abs_difference_x < 1e-10); + /// assert!(abs_difference_y < 1e-10); + /// ``` + fn fract(self) -> Self; + + /// Computes the absolute value of `self`. Returns `Float::nan()` if the + /// number is `Float::nan()`. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x = 3.5; + /// let y = -3.5; + /// + /// let abs_difference_x = (x.abs() - x).abs(); + /// let abs_difference_y = (y.abs() - (-y)).abs(); + /// + /// assert!(abs_difference_x < 1e-10); + /// assert!(abs_difference_y < 1e-10); + /// + /// assert!(f64::NAN.abs().is_nan()); + /// ``` + fn abs(self) -> Self; + + /// Returns a number that represents the sign of `self`. + /// + /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()` + /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()` + /// - `Float::nan()` if the number is `Float::nan()` + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let f = 3.5; + /// + /// assert_eq!(f.signum(), 1.0); + /// assert_eq!(f64::NEG_INFINITY.signum(), -1.0); + /// + /// assert!(f64::NAN.signum().is_nan()); + /// ``` + fn signum(self) -> Self; + + /// Returns `true` if `self` is positive, including `+0.0` and + /// `Float::infinity()`. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let nan: f64 = f64::NAN; + /// + /// let f = 7.0; + /// let g = -7.0; + /// + /// assert!(f.is_sign_positive()); + /// assert!(!g.is_sign_positive()); + /// // Requires both tests to determine if is `NaN` + /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative()); + /// ``` + fn is_sign_positive(self) -> bool; + + /// Returns `true` if `self` is negative, including `-0.0` and + /// `Float::neg_infinity()`. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let nan = f64::NAN; + /// + /// let f = 7.0; + /// let g = -7.0; + /// + /// assert!(!f.is_sign_negative()); + /// assert!(g.is_sign_negative()); + /// // Requires both tests to determine if is `NaN`. + /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative()); + /// ``` + fn is_sign_negative(self) -> bool; + + /// Fused multiply-add. Computes `(self * a) + b` with only one rounding + /// error. This produces a more accurate result with better performance than + /// a separate multiplication operation followed by an add. + /// + /// ``` + /// use num_traits::Float; + /// + /// let m = 10.0; + /// let x = 4.0; + /// let b = 60.0; + /// + /// // 100.0 + /// let abs_difference = (m.mul_add(x, b) - (m*x + b)).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn mul_add(self, a: Self, b: Self) -> Self; + /// Take the reciprocal (inverse) of a number, `1/x`. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 2.0; + /// let abs_difference = (x.recip() - (1.0/x)).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn recip(self) -> Self; + + /// Raise a number to an integer power. + /// + /// Using this function is generally faster than using `powf` + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 2.0; + /// let abs_difference = (x.powi(2) - x*x).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn powi(self, n: i32) -> Self; + + /// Raise a number to a floating point power. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 2.0; + /// let abs_difference = (x.powf(2.0) - x*x).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn powf(self, n: Self) -> Self; + + /// Take the square root of a number. + /// + /// Returns NaN if `self` is a negative number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let positive = 4.0; + /// let negative = -4.0; + /// + /// let abs_difference = (positive.sqrt() - 2.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// assert!(negative.sqrt().is_nan()); + /// ``` + fn sqrt(self) -> Self; + + /// Returns `e^(self)`, (the exponential function). + /// + /// ``` + /// use num_traits::Float; + /// + /// let one = 1.0; + /// // e^1 + /// let e = one.exp(); + /// + /// // ln(e) - 1 == 0 + /// let abs_difference = (e.ln() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn exp(self) -> Self; + + /// Returns `2^(self)`. + /// + /// ``` + /// use num_traits::Float; + /// + /// let f = 2.0; + /// + /// // 2^2 - 4 == 0 + /// let abs_difference = (f.exp2() - 4.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn exp2(self) -> Self; + + /// Returns the natural logarithm of the number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let one = 1.0; + /// // e^1 + /// let e = one.exp(); + /// + /// // ln(e) - 1 == 0 + /// let abs_difference = (e.ln() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn ln(self) -> Self; + + /// Returns the logarithm of the number with respect to an arbitrary base. + /// + /// ``` + /// use num_traits::Float; + /// + /// let ten = 10.0; + /// let two = 2.0; + /// + /// // log10(10) - 1 == 0 + /// let abs_difference_10 = (ten.log(10.0) - 1.0).abs(); + /// + /// // log2(2) - 1 == 0 + /// let abs_difference_2 = (two.log(2.0) - 1.0).abs(); + /// + /// assert!(abs_difference_10 < 1e-10); + /// assert!(abs_difference_2 < 1e-10); + /// ``` + fn log(self, base: Self) -> Self; + + /// Returns the base 2 logarithm of the number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let two = 2.0; + /// + /// // log2(2) - 1 == 0 + /// let abs_difference = (two.log2() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn log2(self) -> Self; + + /// Returns the base 10 logarithm of the number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let ten = 10.0; + /// + /// // log10(10) - 1 == 0 + /// let abs_difference = (ten.log10() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn log10(self) -> Self; + + /// Converts radians to degrees. + /// + /// ``` + /// use std::f64::consts; + /// + /// let angle = consts::PI; + /// + /// let abs_difference = (angle.to_degrees() - 180.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + #[inline] + fn to_degrees(self) -> Self { + let halfpi = Self::zero().acos(); + let ninety = Self::from(90u8).unwrap(); + self * ninety / halfpi + } + + /// Converts degrees to radians. + /// + /// ``` + /// use std::f64::consts; + /// + /// let angle = 180.0_f64; + /// + /// let abs_difference = (angle.to_radians() - consts::PI).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + #[inline] + fn to_radians(self) -> Self { + let halfpi = Self::zero().acos(); + let ninety = Self::from(90u8).unwrap(); + self * halfpi / ninety + } + + /// Returns the maximum of the two numbers. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 1.0; + /// let y = 2.0; + /// + /// assert_eq!(x.max(y), y); + /// ``` + fn max(self, other: Self) -> Self; + + /// Returns the minimum of the two numbers. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 1.0; + /// let y = 2.0; + /// + /// assert_eq!(x.min(y), x); + /// ``` + fn min(self, other: Self) -> Self; + + /// The positive difference of two numbers. + /// + /// * If `self <= other`: `0:0` + /// * Else: `self - other` + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 3.0; + /// let y = -3.0; + /// + /// let abs_difference_x = (x.abs_sub(1.0) - 2.0).abs(); + /// let abs_difference_y = (y.abs_sub(1.0) - 0.0).abs(); + /// + /// assert!(abs_difference_x < 1e-10); + /// assert!(abs_difference_y < 1e-10); + /// ``` + fn abs_sub(self, other: Self) -> Self; + + /// Take the cubic root of a number. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 8.0; + /// + /// // x^(1/3) - 2 == 0 + /// let abs_difference = (x.cbrt() - 2.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn cbrt(self) -> Self; + + /// Calculate the length of the hypotenuse of a right-angle triangle given + /// legs of length `x` and `y`. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 2.0; + /// let y = 3.0; + /// + /// // sqrt(x^2 + y^2) + /// let abs_difference = (x.hypot(y) - (x.powi(2) + y.powi(2)).sqrt()).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn hypot(self, other: Self) -> Self; + + /// Computes the sine of a number (in radians). + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x = f64::consts::PI/2.0; + /// + /// let abs_difference = (x.sin() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn sin(self) -> Self; + + /// Computes the cosine of a number (in radians). + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x = 2.0*f64::consts::PI; + /// + /// let abs_difference = (x.cos() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn cos(self) -> Self; + + /// Computes the tangent of a number (in radians). + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x = f64::consts::PI/4.0; + /// let abs_difference = (x.tan() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-14); + /// ``` + fn tan(self) -> Self; + + /// Computes the arcsine of a number. Return value is in radians in + /// the range [-pi/2, pi/2] or NaN if the number is outside the range + /// [-1, 1]. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let f = f64::consts::PI / 2.0; + /// + /// // asin(sin(pi/2)) + /// let abs_difference = (f.sin().asin() - f64::consts::PI / 2.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn asin(self) -> Self; + + /// Computes the arccosine of a number. Return value is in radians in + /// the range [0, pi] or NaN if the number is outside the range + /// [-1, 1]. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let f = f64::consts::PI / 4.0; + /// + /// // acos(cos(pi/4)) + /// let abs_difference = (f.cos().acos() - f64::consts::PI / 4.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn acos(self) -> Self; + + /// Computes the arctangent of a number. Return value is in radians in the + /// range [-pi/2, pi/2]; + /// + /// ``` + /// use num_traits::Float; + /// + /// let f = 1.0; + /// + /// // atan(tan(1)) + /// let abs_difference = (f.tan().atan() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn atan(self) -> Self; + + /// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`). + /// + /// * `x = 0`, `y = 0`: `0` + /// * `x >= 0`: `arctan(y/x)` -> `[-pi/2, pi/2]` + /// * `y >= 0`: `arctan(y/x) + pi` -> `(pi/2, pi]` + /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)` + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let pi = f64::consts::PI; + /// // All angles from horizontal right (+x) + /// // 45 deg counter-clockwise + /// let x1 = 3.0; + /// let y1 = -3.0; + /// + /// // 135 deg clockwise + /// let x2 = -3.0; + /// let y2 = 3.0; + /// + /// let abs_difference_1 = (y1.atan2(x1) - (-pi/4.0)).abs(); + /// let abs_difference_2 = (y2.atan2(x2) - 3.0*pi/4.0).abs(); + /// + /// assert!(abs_difference_1 < 1e-10); + /// assert!(abs_difference_2 < 1e-10); + /// ``` + fn atan2(self, other: Self) -> Self; + + /// Simultaneously computes the sine and cosine of the number, `x`. Returns + /// `(sin(x), cos(x))`. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x = f64::consts::PI/4.0; + /// let f = x.sin_cos(); + /// + /// let abs_difference_0 = (f.0 - x.sin()).abs(); + /// let abs_difference_1 = (f.1 - x.cos()).abs(); + /// + /// assert!(abs_difference_0 < 1e-10); + /// assert!(abs_difference_0 < 1e-10); + /// ``` + fn sin_cos(self) -> (Self, Self); + + /// Returns `e^(self) - 1` in a way that is accurate even if the + /// number is close to zero. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 7.0; + /// + /// // e^(ln(7)) - 1 + /// let abs_difference = (x.ln().exp_m1() - 6.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn exp_m1(self) -> Self; + + /// Returns `ln(1+n)` (natural logarithm) more accurately than if + /// the operations were performed separately. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let x = f64::consts::E - 1.0; + /// + /// // ln(1 + (e - 1)) == ln(e) == 1 + /// let abs_difference = (x.ln_1p() - 1.0).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn ln_1p(self) -> Self; + + /// Hyperbolic sine function. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let e = f64::consts::E; + /// let x = 1.0; + /// + /// let f = x.sinh(); + /// // Solving sinh() at 1 gives `(e^2-1)/(2e)` + /// let g = (e*e - 1.0)/(2.0*e); + /// let abs_difference = (f - g).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + fn sinh(self) -> Self; + + /// Hyperbolic cosine function. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let e = f64::consts::E; + /// let x = 1.0; + /// let f = x.cosh(); + /// // Solving cosh() at 1 gives this result + /// let g = (e*e + 1.0)/(2.0*e); + /// let abs_difference = (f - g).abs(); + /// + /// // Same result + /// assert!(abs_difference < 1.0e-10); + /// ``` + fn cosh(self) -> Self; + + /// Hyperbolic tangent function. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let e = f64::consts::E; + /// let x = 1.0; + /// + /// let f = x.tanh(); + /// // Solving tanh() at 1 gives `(1 - e^(-2))/(1 + e^(-2))` + /// let g = (1.0 - e.powi(-2))/(1.0 + e.powi(-2)); + /// let abs_difference = (f - g).abs(); + /// + /// assert!(abs_difference < 1.0e-10); + /// ``` + fn tanh(self) -> Self; + + /// Inverse hyperbolic sine function. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 1.0; + /// let f = x.sinh().asinh(); + /// + /// let abs_difference = (f - x).abs(); + /// + /// assert!(abs_difference < 1.0e-10); + /// ``` + fn asinh(self) -> Self; + + /// Inverse hyperbolic cosine function. + /// + /// ``` + /// use num_traits::Float; + /// + /// let x = 1.0; + /// let f = x.cosh().acosh(); + /// + /// let abs_difference = (f - x).abs(); + /// + /// assert!(abs_difference < 1.0e-10); + /// ``` + fn acosh(self) -> Self; + + /// Inverse hyperbolic tangent function. + /// + /// ``` + /// use num_traits::Float; + /// use std::f64; + /// + /// let e = f64::consts::E; + /// let f = e.tanh().atanh(); + /// + /// let abs_difference = (f - e).abs(); + /// + /// assert!(abs_difference < 1.0e-10); + /// ``` + fn atanh(self) -> Self; + + + /// Returns the mantissa, base 2 exponent, and sign as integers, respectively. + /// The original number can be recovered by `sign * mantissa * 2 ^ exponent`. + /// The floating point encoding is documented in the [Reference][floating-point]. + /// + /// ``` + /// use num_traits::Float; + /// + /// let num = 2.0f32; + /// + /// // (8388608, -22, 1) + /// let (mantissa, exponent, sign) = Float::integer_decode(num); + /// let sign_f = sign as f32; + /// let mantissa_f = mantissa as f32; + /// let exponent_f = num.powf(exponent as f32); + /// + /// // 1 * 8388608 * 2^(-22) == 2 + /// let abs_difference = (sign_f * mantissa_f * exponent_f - num).abs(); + /// + /// assert!(abs_difference < 1e-10); + /// ``` + /// [floating-point]: ../../../../../reference.html#machine-types + fn integer_decode(self) -> (u64, i16, i8); +} + +macro_rules! float_impl { + ($T:ident $decode:ident) => ( + impl Float for $T { + #[inline] + fn nan() -> Self { + ::std::$T::NAN + } + + #[inline] + fn infinity() -> Self { + ::std::$T::INFINITY + } + + #[inline] + fn neg_infinity() -> Self { + ::std::$T::NEG_INFINITY + } + + #[inline] + fn neg_zero() -> Self { + -0.0 + } + + #[inline] + fn min_value() -> Self { + ::std::$T::MIN + } + + #[inline] + fn min_positive_value() -> Self { + ::std::$T::MIN_POSITIVE + } + + #[inline] + fn epsilon() -> Self { + ::std::$T::EPSILON + } + + #[inline] + fn max_value() -> Self { + ::std::$T::MAX + } + + #[inline] + fn is_nan(self) -> bool { + <$T>::is_nan(self) + } + + #[inline] + fn is_infinite(self) -> bool { + <$T>::is_infinite(self) + } + + #[inline] + fn is_finite(self) -> bool { + <$T>::is_finite(self) + } + + #[inline] + fn is_normal(self) -> bool { + <$T>::is_normal(self) + } + + #[inline] + fn classify(self) -> FpCategory { + <$T>::classify(self) + } + + #[inline] + fn floor(self) -> Self { + <$T>::floor(self) + } + + #[inline] + fn ceil(self) -> Self { + <$T>::ceil(self) + } + + #[inline] + fn round(self) -> Self { + <$T>::round(self) + } + + #[inline] + fn trunc(self) -> Self { + <$T>::trunc(self) + } + + #[inline] + fn fract(self) -> Self { + <$T>::fract(self) + } + + #[inline] + fn abs(self) -> Self { + <$T>::abs(self) + } + + #[inline] + fn signum(self) -> Self { + <$T>::signum(self) + } + + #[inline] + fn is_sign_positive(self) -> bool { + <$T>::is_sign_positive(self) + } + + #[inline] + fn is_sign_negative(self) -> bool { + <$T>::is_sign_negative(self) + } + + #[inline] + fn mul_add(self, a: Self, b: Self) -> Self { + <$T>::mul_add(self, a, b) + } + + #[inline] + fn recip(self) -> Self { + <$T>::recip(self) + } + + #[inline] + fn powi(self, n: i32) -> Self { + <$T>::powi(self, n) + } + + #[inline] + fn powf(self, n: Self) -> Self { + <$T>::powf(self, n) + } + + #[inline] + fn sqrt(self) -> Self { + <$T>::sqrt(self) + } + + #[inline] + fn exp(self) -> Self { + <$T>::exp(self) + } + + #[inline] + fn exp2(self) -> Self { + <$T>::exp2(self) + } + + #[inline] + fn ln(self) -> Self { + <$T>::ln(self) + } + + #[inline] + fn log(self, base: Self) -> Self { + <$T>::log(self, base) + } + + #[inline] + fn log2(self) -> Self { + <$T>::log2(self) + } + + #[inline] + fn log10(self) -> Self { + <$T>::log10(self) + } + + #[inline] + fn to_degrees(self) -> Self { + // NB: `f32` didn't stabilize this until 1.7 + // <$T>::to_degrees(self) + self * (180. / ::std::$T::consts::PI) + } + + #[inline] + fn to_radians(self) -> Self { + // NB: `f32` didn't stabilize this until 1.7 + // <$T>::to_radians(self) + self * (::std::$T::consts::PI / 180.) + } + + #[inline] + fn max(self, other: Self) -> Self { + <$T>::max(self, other) + } + + #[inline] + fn min(self, other: Self) -> Self { + <$T>::min(self, other) + } + + #[inline] + #[allow(deprecated)] + fn abs_sub(self, other: Self) -> Self { + <$T>::abs_sub(self, other) + } + + #[inline] + fn cbrt(self) -> Self { + <$T>::cbrt(self) + } + + #[inline] + fn hypot(self, other: Self) -> Self { + <$T>::hypot(self, other) + } + + #[inline] + fn sin(self) -> Self { + <$T>::sin(self) + } + + #[inline] + fn cos(self) -> Self { + <$T>::cos(self) + } + + #[inline] + fn tan(self) -> Self { + <$T>::tan(self) + } + + #[inline] + fn asin(self) -> Self { + <$T>::asin(self) + } + + #[inline] + fn acos(self) -> Self { + <$T>::acos(self) + } + + #[inline] + fn atan(self) -> Self { + <$T>::atan(self) + } + + #[inline] + fn atan2(self, other: Self) -> Self { + <$T>::atan2(self, other) + } + + #[inline] + fn sin_cos(self) -> (Self, Self) { + <$T>::sin_cos(self) + } + + #[inline] + fn exp_m1(self) -> Self { + <$T>::exp_m1(self) + } + + #[inline] + fn ln_1p(self) -> Self { + <$T>::ln_1p(self) + } + + #[inline] + fn sinh(self) -> Self { + <$T>::sinh(self) + } + + #[inline] + fn cosh(self) -> Self { + <$T>::cosh(self) + } + + #[inline] + fn tanh(self) -> Self { + <$T>::tanh(self) + } + + #[inline] + fn asinh(self) -> Self { + <$T>::asinh(self) + } + + #[inline] + fn acosh(self) -> Self { + <$T>::acosh(self) + } + + #[inline] + fn atanh(self) -> Self { + <$T>::atanh(self) + } + + #[inline] + fn integer_decode(self) -> (u64, i16, i8) { + $decode(self) + } + } + ) +} + +fn integer_decode_f32(f: f32) -> (u64, i16, i8) { + let bits: u32 = unsafe { mem::transmute(f) }; + let sign: i8 = if bits >> 31 == 0 { + 1 + } else { + -1 + }; + let mut exponent: i16 = ((bits >> 23) & 0xff) as i16; + let mantissa = if exponent == 0 { + (bits & 0x7fffff) << 1 + } else { + (bits & 0x7fffff) | 0x800000 + }; + // Exponent bias + mantissa shift + exponent -= 127 + 23; + (mantissa as u64, exponent, sign) +} + +fn integer_decode_f64(f: f64) -> (u64, i16, i8) { + let bits: u64 = unsafe { mem::transmute(f) }; + let sign: i8 = if bits >> 63 == 0 { + 1 + } else { + -1 + }; + let mut exponent: i16 = ((bits >> 52) & 0x7ff) as i16; + let mantissa = if exponent == 0 { + (bits & 0xfffffffffffff) << 1 + } else { + (bits & 0xfffffffffffff) | 0x10000000000000 + }; + // Exponent bias + mantissa shift + exponent -= 1023 + 52; + (mantissa, exponent, sign) +} + +float_impl!(f32 integer_decode_f32); +float_impl!(f64 integer_decode_f64); + +macro_rules! float_const_impl { + ($(#[$doc:meta] $constant:ident,)+) => ( + #[allow(non_snake_case)] + pub trait FloatConst { + $(#[$doc] fn $constant() -> Self;)+ + } + float_const_impl! { @float f32, $($constant,)+ } + float_const_impl! { @float f64, $($constant,)+ } + ); + (@float $T:ident, $($constant:ident,)+) => ( + impl FloatConst for $T { + $( + #[inline] + fn $constant() -> Self { + ::std::$T::consts::$constant + } + )+ + } + ); +} + +float_const_impl! { + #[doc = "Return Euler’s number."] + E, + #[doc = "Return `1.0 / π`."] + FRAC_1_PI, + #[doc = "Return `1.0 / sqrt(2.0)`."] + FRAC_1_SQRT_2, + #[doc = "Return `2.0 / π`."] + FRAC_2_PI, + #[doc = "Return `2.0 / sqrt(π)`."] + FRAC_2_SQRT_PI, + #[doc = "Return `π / 2.0`."] + FRAC_PI_2, + #[doc = "Return `π / 3.0`."] + FRAC_PI_3, + #[doc = "Return `π / 4.0`."] + FRAC_PI_4, + #[doc = "Return `π / 6.0`."] + FRAC_PI_6, + #[doc = "Return `π / 8.0`."] + FRAC_PI_8, + #[doc = "Return `ln(10.0)`."] + LN_10, + #[doc = "Return `ln(2.0)`."] + LN_2, + #[doc = "Return `log10(e)`."] + LOG10_E, + #[doc = "Return `log2(e)`."] + LOG2_E, + #[doc = "Return Archimedes’ constant."] + PI, + #[doc = "Return `sqrt(2.0)`."] + SQRT_2, +} + +#[cfg(test)] +mod tests { + use Float; + + #[test] + fn convert_deg_rad() { + use std::f64::consts; + + const DEG_RAD_PAIRS: [(f64, f64); 7] = [ + (0.0, 0.), + (22.5, consts::FRAC_PI_8), + (30.0, consts::FRAC_PI_6), + (45.0, consts::FRAC_PI_4), + (60.0, consts::FRAC_PI_3), + (90.0, consts::FRAC_PI_2), + (180.0, consts::PI), + ]; + + for &(deg, rad) in &DEG_RAD_PAIRS { + assert!((Float::to_degrees(rad) - deg).abs() < 1e-6); + assert!((Float::to_radians(deg) - rad).abs() < 1e-6); + + let (deg, rad) = (deg as f32, rad as f32); + assert!((Float::to_degrees(rad) - deg).abs() < 1e-6); + assert!((Float::to_radians(deg) - rad).abs() < 1e-6); + } + } +} diff --git a/third_party/rust/num-traits/src/identities.rs b/third_party/rust/num-traits/src/identities.rs new file mode 100644 index 000000000000..15f0c90c94a5 --- /dev/null +++ b/third_party/rust/num-traits/src/identities.rs @@ -0,0 +1,104 @@ +use std::ops::{Add, Mul}; + +/// Defines an additive identity element for `Self`. +pub trait Zero: Sized + Add { + /// Returns the additive identity element of `Self`, `0`. + /// + /// # Laws + /// + /// ```{.text} + /// a + 0 = a ∀ a ∈ Self + /// 0 + a = a ∀ a ∈ Self + /// ``` + /// + /// # Purity + /// + /// This function should return the same result at all times regardless of + /// external mutable state, for example values stored in TLS or in + /// `static mut`s. + // FIXME (#5527): This should be an associated constant + fn zero() -> Self; + + /// Returns `true` if `self` is equal to the additive identity. + #[inline] + fn is_zero(&self) -> bool; +} + +macro_rules! zero_impl { + ($t:ty, $v:expr) => { + impl Zero for $t { + #[inline] + fn zero() -> $t { $v } + #[inline] + fn is_zero(&self) -> bool { *self == $v } + } + } +} + +zero_impl!(usize, 0usize); +zero_impl!(u8, 0u8); +zero_impl!(u16, 0u16); +zero_impl!(u32, 0u32); +zero_impl!(u64, 0u64); + +zero_impl!(isize, 0isize); +zero_impl!(i8, 0i8); +zero_impl!(i16, 0i16); +zero_impl!(i32, 0i32); +zero_impl!(i64, 0i64); + +zero_impl!(f32, 0.0f32); +zero_impl!(f64, 0.0f64); + +/// Defines a multiplicative identity element for `Self`. +pub trait One: Sized + Mul { + /// Returns the multiplicative identity element of `Self`, `1`. + /// + /// # Laws + /// + /// ```{.text} + /// a * 1 = a ∀ a ∈ Self + /// 1 * a = a ∀ a ∈ Self + /// ``` + /// + /// # Purity + /// + /// This function should return the same result at all times regardless of + /// external mutable state, for example values stored in TLS or in + /// `static mut`s. + // FIXME (#5527): This should be an associated constant + fn one() -> Self; +} + +macro_rules! one_impl { + ($t:ty, $v:expr) => { + impl One for $t { + #[inline] + fn one() -> $t { $v } + } + } +} + +one_impl!(usize, 1usize); +one_impl!(u8, 1u8); +one_impl!(u16, 1u16); +one_impl!(u32, 1u32); +one_impl!(u64, 1u64); + +one_impl!(isize, 1isize); +one_impl!(i8, 1i8); +one_impl!(i16, 1i16); +one_impl!(i32, 1i32); +one_impl!(i64, 1i64); + +one_impl!(f32, 1.0f32); +one_impl!(f64, 1.0f64); + + +// Some helper functions provided for backwards compatibility. + +/// Returns the additive identity, `0`. +#[inline(always)] pub fn zero() -> T { Zero::zero() } + +/// Returns the multiplicative identity, `1`. +#[inline(always)] pub fn one() -> T { One::one() } diff --git a/third_party/rust/num-traits/src/int.rs b/third_party/rust/num-traits/src/int.rs new file mode 100644 index 000000000000..0cf9e13c1afc --- /dev/null +++ b/third_party/rust/num-traits/src/int.rs @@ -0,0 +1,376 @@ +use std::ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr}; + +use {Num, NumCast}; +use bounds::Bounded; +use ops::checked::*; +use ops::saturating::Saturating; + +pub trait PrimInt + : Sized + + Copy + + Num + NumCast + + Bounded + + PartialOrd + Ord + Eq + + Not + + BitAnd + + BitOr + + BitXor + + Shl + + Shr + + CheckedAdd + + CheckedSub + + CheckedMul + + CheckedDiv + + Saturating +{ + /// Returns the number of ones in the binary representation of `self`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0b01001100u8; + /// + /// assert_eq!(n.count_ones(), 3); + /// ``` + fn count_ones(self) -> u32; + + /// Returns the number of zeros in the binary representation of `self`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0b01001100u8; + /// + /// assert_eq!(n.count_zeros(), 5); + /// ``` + fn count_zeros(self) -> u32; + + /// Returns the number of leading zeros in the binary representation + /// of `self`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0b0101000u16; + /// + /// assert_eq!(n.leading_zeros(), 10); + /// ``` + fn leading_zeros(self) -> u32; + + /// Returns the number of trailing zeros in the binary representation + /// of `self`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0b0101000u16; + /// + /// assert_eq!(n.trailing_zeros(), 3); + /// ``` + fn trailing_zeros(self) -> u32; + + /// Shifts the bits to the left by a specified amount amount, `n`, wrapping + /// the truncated bits to the end of the resulting integer. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// let m = 0x3456789ABCDEF012u64; + /// + /// assert_eq!(n.rotate_left(12), m); + /// ``` + fn rotate_left(self, n: u32) -> Self; + + /// Shifts the bits to the right by a specified amount amount, `n`, wrapping + /// the truncated bits to the beginning of the resulting integer. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// let m = 0xDEF0123456789ABCu64; + /// + /// assert_eq!(n.rotate_right(12), m); + /// ``` + fn rotate_right(self, n: u32) -> Self; + + /// Shifts the bits to the left by a specified amount amount, `n`, filling + /// zeros in the least significant bits. + /// + /// This is bitwise equivalent to signed `Shl`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// let m = 0x3456789ABCDEF000u64; + /// + /// assert_eq!(n.signed_shl(12), m); + /// ``` + fn signed_shl(self, n: u32) -> Self; + + /// Shifts the bits to the right by a specified amount amount, `n`, copying + /// the "sign bit" in the most significant bits even for unsigned types. + /// + /// This is bitwise equivalent to signed `Shr`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0xFEDCBA9876543210u64; + /// let m = 0xFFFFEDCBA9876543u64; + /// + /// assert_eq!(n.signed_shr(12), m); + /// ``` + fn signed_shr(self, n: u32) -> Self; + + /// Shifts the bits to the left by a specified amount amount, `n`, filling + /// zeros in the least significant bits. + /// + /// This is bitwise equivalent to unsigned `Shl`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFi64; + /// let m = 0x3456789ABCDEF000i64; + /// + /// assert_eq!(n.unsigned_shl(12), m); + /// ``` + fn unsigned_shl(self, n: u32) -> Self; + + /// Shifts the bits to the right by a specified amount amount, `n`, filling + /// zeros in the most significant bits. + /// + /// This is bitwise equivalent to unsigned `Shr`. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0xFEDCBA9876543210i64; + /// let m = 0x000FEDCBA9876543i64; + /// + /// assert_eq!(n.unsigned_shr(12), m); + /// ``` + fn unsigned_shr(self, n: u32) -> Self; + + /// Reverses the byte order of the integer. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// let m = 0xEFCDAB8967452301u64; + /// + /// assert_eq!(n.swap_bytes(), m); + /// ``` + fn swap_bytes(self) -> Self; + + /// Convert an integer from big endian to the target's endianness. + /// + /// On big endian this is a no-op. On little endian the bytes are swapped. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// + /// if cfg!(target_endian = "big") { + /// assert_eq!(u64::from_be(n), n) + /// } else { + /// assert_eq!(u64::from_be(n), n.swap_bytes()) + /// } + /// ``` + fn from_be(x: Self) -> Self; + + /// Convert an integer from little endian to the target's endianness. + /// + /// On little endian this is a no-op. On big endian the bytes are swapped. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// + /// if cfg!(target_endian = "little") { + /// assert_eq!(u64::from_le(n), n) + /// } else { + /// assert_eq!(u64::from_le(n), n.swap_bytes()) + /// } + /// ``` + fn from_le(x: Self) -> Self; + + /// Convert `self` to big endian from the target's endianness. + /// + /// On big endian this is a no-op. On little endian the bytes are swapped. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// + /// if cfg!(target_endian = "big") { + /// assert_eq!(n.to_be(), n) + /// } else { + /// assert_eq!(n.to_be(), n.swap_bytes()) + /// } + /// ``` + fn to_be(self) -> Self; + + /// Convert `self` to little endian from the target's endianness. + /// + /// On little endian this is a no-op. On big endian the bytes are swapped. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// let n = 0x0123456789ABCDEFu64; + /// + /// if cfg!(target_endian = "little") { + /// assert_eq!(n.to_le(), n) + /// } else { + /// assert_eq!(n.to_le(), n.swap_bytes()) + /// } + /// ``` + fn to_le(self) -> Self; + + /// Raises self to the power of `exp`, using exponentiation by squaring. + /// + /// # Examples + /// + /// ``` + /// use num_traits::PrimInt; + /// + /// assert_eq!(2i32.pow(4), 16); + /// ``` + fn pow(self, mut exp: u32) -> Self; +} + +macro_rules! prim_int_impl { + ($T:ty, $S:ty, $U:ty) => ( + impl PrimInt for $T { + #[inline] + fn count_ones(self) -> u32 { + <$T>::count_ones(self) + } + + #[inline] + fn count_zeros(self) -> u32 { + <$T>::count_zeros(self) + } + + #[inline] + fn leading_zeros(self) -> u32 { + <$T>::leading_zeros(self) + } + + #[inline] + fn trailing_zeros(self) -> u32 { + <$T>::trailing_zeros(self) + } + + #[inline] + fn rotate_left(self, n: u32) -> Self { + <$T>::rotate_left(self, n) + } + + #[inline] + fn rotate_right(self, n: u32) -> Self { + <$T>::rotate_right(self, n) + } + + #[inline] + fn signed_shl(self, n: u32) -> Self { + ((self as $S) << n) as $T + } + + #[inline] + fn signed_shr(self, n: u32) -> Self { + ((self as $S) >> n) as $T + } + + #[inline] + fn unsigned_shl(self, n: u32) -> Self { + ((self as $U) << n) as $T + } + + #[inline] + fn unsigned_shr(self, n: u32) -> Self { + ((self as $U) >> n) as $T + } + + #[inline] + fn swap_bytes(self) -> Self { + <$T>::swap_bytes(self) + } + + #[inline] + fn from_be(x: Self) -> Self { + <$T>::from_be(x) + } + + #[inline] + fn from_le(x: Self) -> Self { + <$T>::from_le(x) + } + + #[inline] + fn to_be(self) -> Self { + <$T>::to_be(self) + } + + #[inline] + fn to_le(self) -> Self { + <$T>::to_le(self) + } + + #[inline] + fn pow(self, exp: u32) -> Self { + <$T>::pow(self, exp) + } + } + ) +} + +// prim_int_impl!(type, signed, unsigned); +prim_int_impl!(u8, i8, u8); +prim_int_impl!(u16, i16, u16); +prim_int_impl!(u32, i32, u32); +prim_int_impl!(u64, i64, u64); +prim_int_impl!(usize, isize, usize); +prim_int_impl!(i8, i8, u8); +prim_int_impl!(i16, i16, u16); +prim_int_impl!(i32, i32, u32); +prim_int_impl!(i64, i64, u64); +prim_int_impl!(isize, isize, usize); diff --git a/third_party/rust/num-traits/src/lib.rs b/third_party/rust/num-traits/src/lib.rs new file mode 100644 index 000000000000..cc79d300caa3 --- /dev/null +++ b/third_party/rust/num-traits/src/lib.rs @@ -0,0 +1,236 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Numeric traits for generic mathematics + +use std::ops::{Add, Sub, Mul, Div, Rem}; + +pub use bounds::Bounded; +pub use float::{Float, FloatConst}; +pub use identities::{Zero, One, zero, one}; +pub use ops::checked::*; +pub use ops::saturating::Saturating; +pub use sign::{Signed, Unsigned, abs, abs_sub, signum}; +pub use cast::*; +pub use int::PrimInt; +pub use pow::{pow, checked_pow}; + +pub mod identities; +pub mod sign; +pub mod ops; +pub mod bounds; +pub mod float; +pub mod cast; +pub mod int; +pub mod pow; + +/// The base trait for numeric types +pub trait Num: PartialEq + Zero + One + + Add + Sub + + Mul + Div + Rem +{ + type FromStrRadixErr; + + /// Convert from a string and radix <= 36. + fn from_str_radix(str: &str, radix: u32) -> Result; +} + +macro_rules! int_trait_impl { + ($name:ident for $($t:ty)*) => ($( + impl $name for $t { + type FromStrRadixErr = ::std::num::ParseIntError; + #[inline] + fn from_str_radix(s: &str, radix: u32) + -> Result + { + <$t>::from_str_radix(s, radix) + } + } + )*) +} +int_trait_impl!(Num for usize u8 u16 u32 u64 isize i8 i16 i32 i64); + +#[derive(Debug)] +pub enum FloatErrorKind { + Empty, + Invalid, +} +// FIXME: std::num::ParseFloatError is stable in 1.0, but opaque to us, +// so there's not really any way for us to reuse it. +#[derive(Debug)] +pub struct ParseFloatError { + pub kind: FloatErrorKind, +} + +// FIXME: The standard library from_str_radix on floats was deprecated, so we're stuck +// with this implementation ourselves until we want to make a breaking change. +// (would have to drop it from `Num` though) +macro_rules! float_trait_impl { + ($name:ident for $($t:ty)*) => ($( + impl $name for $t { + type FromStrRadixErr = ParseFloatError; + + fn from_str_radix(src: &str, radix: u32) + -> Result + { + use self::FloatErrorKind::*; + use self::ParseFloatError as PFE; + + // Special values + match src { + "inf" => return Ok(Float::infinity()), + "-inf" => return Ok(Float::neg_infinity()), + "NaN" => return Ok(Float::nan()), + _ => {}, + } + + fn slice_shift_char(src: &str) -> Option<(char, &str)> { + src.chars().nth(0).map(|ch| (ch, &src[1..])) + } + + let (is_positive, src) = match slice_shift_char(src) { + None => return Err(PFE { kind: Empty }), + Some(('-', "")) => return Err(PFE { kind: Empty }), + Some(('-', src)) => (false, src), + Some((_, _)) => (true, src), + }; + + // The significand to accumulate + let mut sig = if is_positive { 0.0 } else { -0.0 }; + // Necessary to detect overflow + let mut prev_sig = sig; + let mut cs = src.chars().enumerate(); + // Exponent prefix and exponent index offset + let mut exp_info = None::<(char, usize)>; + + // Parse the integer part of the significand + for (i, c) in cs.by_ref() { + match c.to_digit(radix) { + Some(digit) => { + // shift significand one digit left + sig = sig * (radix as $t); + + // add/subtract current digit depending on sign + if is_positive { + sig = sig + ((digit as isize) as $t); + } else { + sig = sig - ((digit as isize) as $t); + } + + // Detect overflow by comparing to last value, except + // if we've not seen any non-zero digits. + if prev_sig != 0.0 { + if is_positive && sig <= prev_sig + { return Ok(Float::infinity()); } + if !is_positive && sig >= prev_sig + { return Ok(Float::neg_infinity()); } + + // Detect overflow by reversing the shift-and-add process + if is_positive && (prev_sig != (sig - digit as $t) / radix as $t) + { return Ok(Float::infinity()); } + if !is_positive && (prev_sig != (sig + digit as $t) / radix as $t) + { return Ok(Float::neg_infinity()); } + } + prev_sig = sig; + }, + None => match c { + 'e' | 'E' | 'p' | 'P' => { + exp_info = Some((c, i + 1)); + break; // start of exponent + }, + '.' => { + break; // start of fractional part + }, + _ => { + return Err(PFE { kind: Invalid }); + }, + }, + } + } + + // If we are not yet at the exponent parse the fractional + // part of the significand + if exp_info.is_none() { + let mut power = 1.0; + for (i, c) in cs.by_ref() { + match c.to_digit(radix) { + Some(digit) => { + // Decrease power one order of magnitude + power = power / (radix as $t); + // add/subtract current digit depending on sign + sig = if is_positive { + sig + (digit as $t) * power + } else { + sig - (digit as $t) * power + }; + // Detect overflow by comparing to last value + if is_positive && sig < prev_sig + { return Ok(Float::infinity()); } + if !is_positive && sig > prev_sig + { return Ok(Float::neg_infinity()); } + prev_sig = sig; + }, + None => match c { + 'e' | 'E' | 'p' | 'P' => { + exp_info = Some((c, i + 1)); + break; // start of exponent + }, + _ => { + return Err(PFE { kind: Invalid }); + }, + }, + } + } + } + + // Parse and calculate the exponent + let exp = match exp_info { + Some((c, offset)) => { + let base = match c { + 'E' | 'e' if radix == 10 => 10.0, + 'P' | 'p' if radix == 16 => 2.0, + _ => return Err(PFE { kind: Invalid }), + }; + + // Parse the exponent as decimal integer + let src = &src[offset..]; + let (is_positive, exp) = match slice_shift_char(src) { + Some(('-', src)) => (false, src.parse::()), + Some(('+', src)) => (true, src.parse::()), + Some((_, _)) => (true, src.parse::()), + None => return Err(PFE { kind: Invalid }), + }; + + match (is_positive, exp) { + (true, Ok(exp)) => base.powi(exp as i32), + (false, Ok(exp)) => 1.0 / base.powi(exp as i32), + (_, Err(_)) => return Err(PFE { kind: Invalid }), + } + }, + None => 1.0, // no exponent + }; + + Ok(sig * exp) + } + } + )*) +} +float_trait_impl!(Num for f32 f64); + +#[test] +fn from_str_radix_unwrap() { + // The Result error must impl Debug to allow unwrap() + + let i: i32 = Num::from_str_radix("0", 10).unwrap(); + assert_eq!(i, 0); + + let f: f32 = Num::from_str_radix("0.0", 10).unwrap(); + assert_eq!(f, 0.0); +} diff --git a/third_party/rust/num-traits/src/ops/checked.rs b/third_party/rust/num-traits/src/ops/checked.rs new file mode 100644 index 000000000000..b6bf0d6b0afd --- /dev/null +++ b/third_party/rust/num-traits/src/ops/checked.rs @@ -0,0 +1,91 @@ +use std::ops::{Add, Sub, Mul, Div}; + +/// Performs addition that returns `None` instead of wrapping around on +/// overflow. +pub trait CheckedAdd: Sized + Add { + /// Adds two numbers, checking for overflow. If overflow happens, `None` is + /// returned. + fn checked_add(&self, v: &Self) -> Option; +} + +macro_rules! checked_impl { + ($trait_name:ident, $method:ident, $t:ty) => { + impl $trait_name for $t { + #[inline] + fn $method(&self, v: &$t) -> Option<$t> { + <$t>::$method(*self, *v) + } + } + } +} + +checked_impl!(CheckedAdd, checked_add, u8); +checked_impl!(CheckedAdd, checked_add, u16); +checked_impl!(CheckedAdd, checked_add, u32); +checked_impl!(CheckedAdd, checked_add, u64); +checked_impl!(CheckedAdd, checked_add, usize); + +checked_impl!(CheckedAdd, checked_add, i8); +checked_impl!(CheckedAdd, checked_add, i16); +checked_impl!(CheckedAdd, checked_add, i32); +checked_impl!(CheckedAdd, checked_add, i64); +checked_impl!(CheckedAdd, checked_add, isize); + +/// Performs subtraction that returns `None` instead of wrapping around on underflow. +pub trait CheckedSub: Sized + Sub { + /// Subtracts two numbers, checking for underflow. If underflow happens, + /// `None` is returned. + fn checked_sub(&self, v: &Self) -> Option; +} + +checked_impl!(CheckedSub, checked_sub, u8); +checked_impl!(CheckedSub, checked_sub, u16); +checked_impl!(CheckedSub, checked_sub, u32); +checked_impl!(CheckedSub, checked_sub, u64); +checked_impl!(CheckedSub, checked_sub, usize); + +checked_impl!(CheckedSub, checked_sub, i8); +checked_impl!(CheckedSub, checked_sub, i16); +checked_impl!(CheckedSub, checked_sub, i32); +checked_impl!(CheckedSub, checked_sub, i64); +checked_impl!(CheckedSub, checked_sub, isize); + +/// Performs multiplication that returns `None` instead of wrapping around on underflow or +/// overflow. +pub trait CheckedMul: Sized + Mul { + /// Multiplies two numbers, checking for underflow or overflow. If underflow + /// or overflow happens, `None` is returned. + fn checked_mul(&self, v: &Self) -> Option; +} + +checked_impl!(CheckedMul, checked_mul, u8); +checked_impl!(CheckedMul, checked_mul, u16); +checked_impl!(CheckedMul, checked_mul, u32); +checked_impl!(CheckedMul, checked_mul, u64); +checked_impl!(CheckedMul, checked_mul, usize); + +checked_impl!(CheckedMul, checked_mul, i8); +checked_impl!(CheckedMul, checked_mul, i16); +checked_impl!(CheckedMul, checked_mul, i32); +checked_impl!(CheckedMul, checked_mul, i64); +checked_impl!(CheckedMul, checked_mul, isize); + +/// Performs division that returns `None` instead of panicking on division by zero and instead of +/// wrapping around on underflow and overflow. +pub trait CheckedDiv: Sized + Div { + /// Divides two numbers, checking for underflow, overflow and division by + /// zero. If any of that happens, `None` is returned. + fn checked_div(&self, v: &Self) -> Option; +} + +checked_impl!(CheckedDiv, checked_div, u8); +checked_impl!(CheckedDiv, checked_div, u16); +checked_impl!(CheckedDiv, checked_div, u32); +checked_impl!(CheckedDiv, checked_div, u64); +checked_impl!(CheckedDiv, checked_div, usize); + +checked_impl!(CheckedDiv, checked_div, i8); +checked_impl!(CheckedDiv, checked_div, i16); +checked_impl!(CheckedDiv, checked_div, i32); +checked_impl!(CheckedDiv, checked_div, i64); +checked_impl!(CheckedDiv, checked_div, isize); diff --git a/third_party/rust/num-traits/src/ops/mod.rs b/third_party/rust/num-traits/src/ops/mod.rs new file mode 100644 index 000000000000..2632a0f0150b --- /dev/null +++ b/third_party/rust/num-traits/src/ops/mod.rs @@ -0,0 +1,2 @@ +pub mod saturating; +pub mod checked; diff --git a/third_party/rust/num-traits/src/ops/saturating.rs b/third_party/rust/num-traits/src/ops/saturating.rs new file mode 100644 index 000000000000..e9db7493fbdc --- /dev/null +++ b/third_party/rust/num-traits/src/ops/saturating.rs @@ -0,0 +1,28 @@ +/// Saturating math operations +pub trait Saturating { + /// Saturating addition operator. + /// Returns a+b, saturating at the numeric bounds instead of overflowing. + fn saturating_add(self, v: Self) -> Self; + + /// Saturating subtraction operator. + /// Returns a-b, saturating at the numeric bounds instead of overflowing. + fn saturating_sub(self, v: Self) -> Self; +} + +macro_rules! saturating_impl { + ($trait_name:ident for $($t:ty)*) => {$( + impl $trait_name for $t { + #[inline] + fn saturating_add(self, v: Self) -> Self { + Self::saturating_add(self, v) + } + + #[inline] + fn saturating_sub(self, v: Self) -> Self { + Self::saturating_sub(self, v) + } + } + )*} +} + +saturating_impl!(Saturating for isize usize i8 u8 i16 u16 i32 u32 i64 u64); diff --git a/third_party/rust/num-traits/src/pow.rs b/third_party/rust/num-traits/src/pow.rs new file mode 100644 index 000000000000..b250ad4cf237 --- /dev/null +++ b/third_party/rust/num-traits/src/pow.rs @@ -0,0 +1,73 @@ +use std::ops::Mul; +use {One, CheckedMul}; + +/// Raises a value to the power of exp, using exponentiation by squaring. +/// +/// # Example +/// +/// ```rust +/// use num_traits::pow; +/// +/// assert_eq!(pow(2i8, 4), 16); +/// assert_eq!(pow(6u8, 3), 216); +/// ``` +#[inline] +pub fn pow>(mut base: T, mut exp: usize) -> T { + if exp == 0 { return T::one() } + + while exp & 1 == 0 { + base = base.clone() * base; + exp >>= 1; + } + if exp == 1 { return base } + + let mut acc = base.clone(); + while exp > 1 { + exp >>= 1; + base = base.clone() * base; + if exp & 1 == 1 { + acc = acc * base.clone(); + } + } + acc +} + +/// Raises a value to the power of exp, returning `None` if an overflow occurred. +/// +/// Otherwise same as the `pow` function. +/// +/// # Example +/// +/// ```rust +/// use num_traits::checked_pow; +/// +/// assert_eq!(checked_pow(2i8, 4), Some(16)); +/// assert_eq!(checked_pow(7i8, 8), None); +/// assert_eq!(checked_pow(7u32, 8), Some(5_764_801)); +/// ``` +#[inline] +pub fn checked_pow(mut base: T, mut exp: usize) -> Option { + if exp == 0 { return Some(T::one()) } + + macro_rules! optry { + ( $ expr : expr ) => { + if let Some(val) = $expr { val } else { return None } + } + } + + while exp & 1 == 0 { + base = optry!(base.checked_mul(&base)); + exp >>= 1; + } + if exp == 1 { return Some(base) } + + let mut acc = base.clone(); + while exp > 1 { + exp >>= 1; + base = optry!(base.checked_mul(&base)); + if exp & 1 == 1 { + acc = optry!(acc.checked_mul(&base)); + } + } + Some(acc) +} diff --git a/third_party/rust/num-traits/src/sign.rs b/third_party/rust/num-traits/src/sign.rs new file mode 100644 index 000000000000..c56ad2585470 --- /dev/null +++ b/third_party/rust/num-traits/src/sign.rs @@ -0,0 +1,161 @@ +use std::ops::Neg; +use std::{f32, f64}; + +use Num; + +/// Useful functions for signed numbers (i.e. numbers that can be negative). +pub trait Signed: Sized + Num + Neg { + /// Computes the absolute value. + /// + /// For `f32` and `f64`, `NaN` will be returned if the number is `NaN`. + /// + /// For signed integers, `::MIN` will be returned if the number is `::MIN`. + fn abs(&self) -> Self; + + /// The positive difference of two numbers. + /// + /// Returns `zero` if the number is less than or equal to `other`, otherwise the difference + /// between `self` and `other` is returned. + fn abs_sub(&self, other: &Self) -> Self; + + /// Returns the sign of the number. + /// + /// For `f32` and `f64`: + /// + /// * `1.0` if the number is positive, `+0.0` or `INFINITY` + /// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` + /// * `NaN` if the number is `NaN` + /// + /// For signed integers: + /// + /// * `0` if the number is zero + /// * `1` if the number is positive + /// * `-1` if the number is negative + fn signum(&self) -> Self; + + /// Returns true if the number is positive and false if the number is zero or negative. + fn is_positive(&self) -> bool; + + /// Returns true if the number is negative and false if the number is zero or positive. + fn is_negative(&self) -> bool; +} + +macro_rules! signed_impl { + ($($t:ty)*) => ($( + impl Signed for $t { + #[inline] + fn abs(&self) -> $t { + if self.is_negative() { -*self } else { *self } + } + + #[inline] + fn abs_sub(&self, other: &$t) -> $t { + if *self <= *other { 0 } else { *self - *other } + } + + #[inline] + fn signum(&self) -> $t { + match *self { + n if n > 0 => 1, + 0 => 0, + _ => -1, + } + } + + #[inline] + fn is_positive(&self) -> bool { *self > 0 } + + #[inline] + fn is_negative(&self) -> bool { *self < 0 } + } + )*) +} + +signed_impl!(isize i8 i16 i32 i64); + +macro_rules! signed_float_impl { + ($t:ty, $nan:expr, $inf:expr, $neg_inf:expr) => { + impl Signed for $t { + /// Computes the absolute value. Returns `NAN` if the number is `NAN`. + #[inline] + fn abs(&self) -> $t { + <$t>::abs(*self) + } + + /// The positive difference of two numbers. Returns `0.0` if the number is + /// less than or equal to `other`, otherwise the difference between`self` + /// and `other` is returned. + #[inline] + #[allow(deprecated)] + fn abs_sub(&self, other: &$t) -> $t { + <$t>::abs_sub(*self, *other) + } + + /// # Returns + /// + /// - `1.0` if the number is positive, `+0.0` or `INFINITY` + /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` + /// - `NAN` if the number is NaN + #[inline] + fn signum(&self) -> $t { + <$t>::signum(*self) + } + + /// Returns `true` if the number is positive, including `+0.0` and `INFINITY` + #[inline] + fn is_positive(&self) -> bool { *self > 0.0 || (1.0 / *self) == $inf } + + /// Returns `true` if the number is negative, including `-0.0` and `NEG_INFINITY` + #[inline] + fn is_negative(&self) -> bool { *self < 0.0 || (1.0 / *self) == $neg_inf } + } + } +} + +signed_float_impl!(f32, f32::NAN, f32::INFINITY, f32::NEG_INFINITY); +signed_float_impl!(f64, f64::NAN, f64::INFINITY, f64::NEG_INFINITY); + +/// Computes the absolute value. +/// +/// For `f32` and `f64`, `NaN` will be returned if the number is `NaN` +/// +/// For signed integers, `::MIN` will be returned if the number is `::MIN`. +#[inline(always)] +pub fn abs(value: T) -> T { + value.abs() +} + +/// The positive difference of two numbers. +/// +/// Returns zero if `x` is less than or equal to `y`, otherwise the difference +/// between `x` and `y` is returned. +#[inline(always)] +pub fn abs_sub(x: T, y: T) -> T { + x.abs_sub(&y) +} + +/// Returns the sign of the number. +/// +/// For `f32` and `f64`: +/// +/// * `1.0` if the number is positive, `+0.0` or `INFINITY` +/// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// * `NaN` if the number is `NaN` +/// +/// For signed integers: +/// +/// * `0` if the number is zero +/// * `1` if the number is positive +/// * `-1` if the number is negative +#[inline(always)] pub fn signum(value: T) -> T { value.signum() } + +/// A trait for values which cannot be negative +pub trait Unsigned: Num {} + +macro_rules! empty_trait_impl { + ($name:ident for $($t:ty)*) => ($( + impl $name for $t {} + )*) +} + +empty_trait_impl!(Unsigned for usize u8 u16 u32 u64); diff --git a/third_party/rust/offscreen_gl_context/.cargo-checksum.json b/third_party/rust/offscreen_gl_context/.cargo-checksum.json new file mode 100644 index 000000000000..18f869960677 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7150ee9391a955b2ef7e0762fc61c0c1aab167620ca36d88d78062d93b8334ba",".travis.yml":"9b8376fc479996f32f8a690e6009fc2f7e9f6dc1b1224e0180a92ad65b0b2183","Cargo.toml":"a2aacf8d637addcb13f6f04e21c65ae4bde00bb589de00b8c97746224a97499c","Makefile":"85b6d903eecac170ac97f10d9d89b8366cd91f5ea2f7c6212704bc590b64cf50","README.md":"614cf0c6242be3e62e45a3d60ce9a2a1581bdc46b28b25d5f40caba558e4d615","build.rs":"86776b47fac1d9368e3c3c5d57c62731729ed859bb1c4e4db0fe219251812cab","src/draw_buffer.rs":"52bef86972f40e0dd13a6e81f3aa76d4d0c28ea0b63f5f9da9650a34d75488c0","src/gl_context.rs":"28953e3752ea7fd2b19327f98c06fe53f7618efc4d3f0cb2262eba403756df2a","src/gl_context_attributes.rs":"c76ef02996d0daac313b666d1991878bbf7812932a0f9feac9e62c89ba7bf669","src/gl_context_capabilities.rs":"9f665ad04d42d47d15ecbd430639d95da526ec5951f0b7abe2434adc1415c85d","src/gl_feature.rs":"b826884900c0e8d6317a41ebb6c30bdb468601bf1c030c376749bdb2ecd2f15a","src/gl_formats.rs":"99087345b4e9a12c86605c0d091bfaf1b4ed4b2475a3b6f91d2127a2bb85fe1b","src/gl_limits.rs":"02e41619518daae5895929db00d073b5ad0d9daf9319a61abb7012c2e59fb6c7","src/lib.rs":"daaf4e26504dbb97f3803de4337f601d616adf0633e5c4415c2c172fb257ebd6","src/platform/mod.rs":"f6ec310e5b8fb519607b8e4d5ca71a0c07c83737a83c3785b5b44e7902498c8a","src/platform/not_implemented/mod.rs":"d576e9fc3164f9e2a8ff9460a60eaa8ecada44c600de1a4d1bb5513ab93569af","src/platform/not_implemented/native_gl_context.rs":"fe018722b8bebbd59b6fae759dd78b0175d10bf110205b113ff155fd06d0f75d","src/platform/with_cgl/mod.rs":"b05dc146c9ba82d62410d9b0566a8aa70c77e7ec583ad4881c531d7118454543","src/platform/with_cgl/native_gl_context.rs":"c6271cfa96836d8f833f5efbc90352852557d582db41d2c513cc36c3f966ae88","src/platform/with_egl/mod.rs":"c52ac147eb051733070c36b2c62be8c57427f80999507f62a9ce801f4aac284c","src/platform/with_egl/native_gl_context.rs":"3a8342d53de9525a5478cc96b323dbad2b3628aa6655fe5f092834cc72256116","src/platform/with_egl/utils.rs":"508521e2bf3809ffe0dfea4fa4a358903f49c77a33aa42cc6c0e7458d992a2a7","src/platform/with_glx/mod.rs":"0e497f38b2071ed189995c91b27b0b199d31bfcc10836e2d26b55023d7aff503","src/platform/with_glx/native_gl_context.rs":"2c648ae18baac14290b2eca3581d474adfea00a29a7ad47a1100e564e74b9152","src/platform/with_glx/utils.rs":"eb81e0a4c62947fa5099c241cfe2e4dd075376d30b22864e042c0f536ac6be58","src/platform/with_osmesa/mod.rs":"9f6d69878125185f16740f52ba5cdd8a45e8812af1a3561482c9b43edaf4514a","src/platform/with_wgl/mod.rs":"38f9b44b54c8a1bd4d25ae77a4ea6a2e5454a00b816764d7d74152c1f3c1b126","src/platform/with_wgl/native_gl_context.rs":"4aecd40a811cf38607b17db9724f79bb934e056f85c90c987b2aa82d637b7bb4","src/platform/with_wgl/utils.rs":"d9640c000dcb513cf0a13c4a0d35c423366b7d0894deff299affe0202bdeb770","src/platform/with_wgl/wgl_attributes.rs":"73b75da18519e048011e9c303e402cf7961e3652aa8f4d4ebf507b4ab83d06a3","src/tests.rs":"780d4211a02c09abebb2b8be85a87ed98bee374999bd333c29efb3a8c7d2b281"},"package":"2092c6bb5550536a097c5b413a2c36e141bc63c85c0a40944a182c1912d69397"} \ No newline at end of file diff --git a/third_party/rust/offscreen_gl_context/.cargo-ok b/third_party/rust/offscreen_gl_context/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/offscreen_gl_context/.gitignore b/third_party/rust/offscreen_gl_context/.gitignore new file mode 100644 index 000000000000..f0ff2599d09b --- /dev/null +++ b/third_party/rust/offscreen_gl_context/.gitignore @@ -0,0 +1,3 @@ +target +Cargo.lock +*~ diff --git a/third_party/rust/offscreen_gl_context/.travis.yml b/third_party/rust/offscreen_gl_context/.travis.yml new file mode 100644 index 000000000000..b88967cee8e1 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/.travis.yml @@ -0,0 +1,28 @@ +language: rust +rust: nightly +sudo: false + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-4.8 + - g++-4.8 + - libxxf86vm-dev + - libosmesa6-dev + - libgles2-mesa-dev + +before_install: + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX=g++-4.8; fi + +os: + - linux + - osx + +script: + - cargo build --verbose + # We cannot test egl nor glx in Travis' linux + # - cargo test --verbose + # - cargo test --verbose --features test_egl_in_linux + - if [ "$TRAVIS_OS_NAME" != "linux" ]; then cargo test --verbose; fi diff --git a/third_party/rust/offscreen_gl_context/Cargo.toml b/third_party/rust/offscreen_gl_context/Cargo.toml new file mode 100644 index 000000000000..fd8fe0a0475a --- /dev/null +++ b/third_party/rust/offscreen_gl_context/Cargo.toml @@ -0,0 +1,43 @@ +[package] +name = "offscreen_gl_context" +license = "MIT / Apache-2.0" +version = "0.5.3" +authors = ["Emilio Cobos Álvarez ", "The Servo Project Developers"] +description = "Creation and manipulation of HW accelerated offscreen rendering contexts in multiple platforms. Originally intended for the Servo project's WebGL implementation." +repository = "https://github.com/emilio/rust-offscreen-rendering-context" +build = "build.rs" + +[build-dependencies] +gl_generator = "0.5" + +[features] +default = [] +osmesa = ["osmesa-sys"] +serde_serialization = ["serde"] +# NOTE: Just for testing use, there are no other changes +test_egl_in_linux = [] +test_osmesa = [] + +[dependencies] +log = "0.3" +gleam = "0.2" +euclid = "0.10" +serde = { version = "0.8", optional = true } +osmesa-sys = { version = "0.1", optional = true } + +[target.x86_64-apple-darwin.dependencies] +core-foundation = "0.2.0" +cgl = "0.1" + +[target.'cfg(target_os = "linux")'.dependencies.x11] +version = "2.3.0" +features = ["xlib"] + +[target.'cfg(target_os = "windows")'.dependencies] +winapi = "0.2" +gdi32-sys = "0.2" +user32-sys = "0.2" +kernel32-sys = "0.2" + +[target.'cfg(any(target_os="macos", target_os="windows"))'.dependencies] +lazy_static = "0.2" diff --git a/third_party/rust/offscreen_gl_context/Makefile b/third_party/rust/offscreen_gl_context/Makefile new file mode 100644 index 000000000000..fbc80bb83fb8 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/Makefile @@ -0,0 +1,8 @@ +.PHONY: all tests +all: + @echo > /dev/null + +tests: + cargo test --verbose + cargo test --features texture_surface --verbose + cargo test --features "test_osmesa" --verbose diff --git a/third_party/rust/offscreen_gl_context/README.md b/third_party/rust/offscreen_gl_context/README.md new file mode 100644 index 000000000000..dc2111571be0 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/README.md @@ -0,0 +1,3 @@ +# Offscreen graphics library for Servo +[![Build +Status](https://travis-ci.org/emilio/rust-offscreen-rendering-context.svg?branch=master)](https://travis-ci.org/emilio/rust-offscreen-rendering-context) diff --git a/third_party/rust/offscreen_gl_context/build.rs b/third_party/rust/offscreen_gl_context/build.rs new file mode 100644 index 000000000000..6d7faa438d0d --- /dev/null +++ b/third_party/rust/offscreen_gl_context/build.rs @@ -0,0 +1,51 @@ +extern crate gl_generator; + +use std::env; +use std::fs::File; +use std::path::PathBuf; +use gl_generator::{Registry, Api, Profile, Fallbacks}; + +fn main() { + let target = env::var("TARGET").unwrap(); + let dest = PathBuf::from(&env::var("OUT_DIR").unwrap()); + + if target.contains("linux") { + let mut file = File::create(&dest.join("glx_bindings.rs")).unwrap(); + Registry::new(Api::Glx, (1, 4), Profile::Core, Fallbacks::All, []) + .write_bindings(gl_generator::StaticGenerator, &mut file).unwrap(); + } + + if target.contains("android") || (target.contains("linux") && cfg!(feature = "test_egl_in_linux")) { + let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap(); + Registry::new(Api::Egl, (1, 4), Profile::Core, Fallbacks::All, []) + .write_bindings(gl_generator::StaticGenerator, &mut file).unwrap(); + println!("cargo:rustc-link-lib=EGL"); + } + + if target.contains("windows") { + let mut file = File::create(&dest.join("wgl_bindings.rs")).unwrap(); + Registry::new(Api::Wgl, (1, 0), Profile::Core, Fallbacks::All, []) + .write_bindings(gl_generator::StaticGenerator, &mut file) + .unwrap(); + + let mut file = File::create(&dest.join("wgl_extra_bindings.rs")).unwrap(); + Registry::new(Api::Wgl, (1, 0), Profile::Core, Fallbacks::All, [ + "WGL_ARB_create_context", + "WGL_ARB_create_context_profile", + "WGL_ARB_create_context_robustness", + "WGL_ARB_context_flush_control", + "WGL_ARB_extensions_string", + "WGL_ARB_framebuffer_sRGB", + "WGL_ARB_multisample", + "WGL_ARB_pixel_format", + "WGL_ARB_pixel_format_float", + "WGL_EXT_create_context_es2_profile", + "WGL_EXT_extensions_string", + "WGL_EXT_framebuffer_sRGB", + "WGL_EXT_swap_control", + ]) + .write_bindings(gl_generator::StructGenerator, &mut file).unwrap(); + + + } +} diff --git a/third_party/rust/offscreen_gl_context/src/draw_buffer.rs b/third_party/rust/offscreen_gl_context/src/draw_buffer.rs new file mode 100644 index 000000000000..60dfc27d8267 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/draw_buffer.rs @@ -0,0 +1,275 @@ +use euclid::Size2D; +use gleam::gl; +use gleam::gl::types::{GLuint, GLenum, GLint}; + +use GLContext; +use NativeGLContextMethods; + +#[derive(Debug)] +pub enum ColorAttachmentType { + Texture, + Renderbuffer, +} + +impl Default for ColorAttachmentType { + fn default() -> ColorAttachmentType { + ColorAttachmentType::Renderbuffer + } +} + + +/// We either have a color renderbuffer +/// Or a surface bound to a texture +/// bound to a framebuffer as a color +/// attachment +#[derive(Debug)] +pub enum ColorAttachment { + Renderbuffer(GLuint), + Texture(GLuint), +} + +impl ColorAttachment { + pub fn color_attachment_type(&self) -> ColorAttachmentType { + match *self { + ColorAttachment::Renderbuffer(_) => ColorAttachmentType::Renderbuffer, + ColorAttachment::Texture(_) => ColorAttachmentType::Texture, + } + } +} + +impl Drop for ColorAttachment { + fn drop(&mut self) { + match *self { + ColorAttachment::Renderbuffer(id) => gl::delete_renderbuffers(&[id]), + ColorAttachment::Texture(tex_id) => gl::delete_textures(&[tex_id]), + } + } +} + +/// This structure represents an offscreen context +/// draw buffer. It has a framebuffer, with at least +/// color renderbuffer (alpha or not). It may also have +/// a depth or stencil buffer, depending on context +/// requirements. +pub struct DrawBuffer { + size: Size2D, + framebuffer: GLuint, + stencil_renderbuffer: GLuint, + depth_renderbuffer: GLuint, + color_attachment: Option + // samples: GLsizei, +} + +/// Helper function to create a render buffer +/// TODO(ecoal95): We'll need to switch between `glRenderbufferStorage` and +/// `glRenderbufferStorageMultisample` when we support antialising +fn create_renderbuffer(format: GLenum, + size: &Size2D) -> GLuint { + let ret = gl::gen_renderbuffers(1)[0]; + gl::bind_renderbuffer(gl::RENDERBUFFER, ret); + gl::renderbuffer_storage(gl::RENDERBUFFER, format, size.width, size.height); + gl::bind_renderbuffer(gl::RENDERBUFFER, 0); + + ret +} + +impl DrawBuffer { + pub fn new(context: &GLContext, + mut size: Size2D, + color_attachment_type: ColorAttachmentType) + -> Result + { + const MIN_DRAWING_BUFFER_SIZE: i32 = 16; + use std::cmp; + + let attrs = context.borrow_attributes(); + let capabilities = context.borrow_capabilities(); + + debug!("Creating draw buffer {:?}, {:?}, attrs: {:?}, caps: {:?}", + size, color_attachment_type, attrs, capabilities); + + if attrs.antialias && capabilities.max_samples == 0 { + return Err("The given GLContext doesn't support requested antialising"); + } + + if attrs.preserve_drawing_buffer { + return Err("preserveDrawingBuffer is not supported yet"); + } + + // See https://github.com/servo/servo/issues/12320 + size.width = cmp::max(MIN_DRAWING_BUFFER_SIZE, size.width); + size.height = cmp::max(MIN_DRAWING_BUFFER_SIZE, size.height); + + let mut draw_buffer = DrawBuffer { + size: size, + framebuffer: 0, + color_attachment: None, + stencil_renderbuffer: 0, + depth_renderbuffer: 0, + // samples: 0, + }; + + try!(context.make_current()); + + try!(draw_buffer.init(context, color_attachment_type)); + + debug_assert!(gl::check_frame_buffer_status(gl::FRAMEBUFFER) == gl::FRAMEBUFFER_COMPLETE); + debug_assert!(gl::get_error() == gl::NO_ERROR); + + Ok(draw_buffer) + } + + #[inline(always)] + pub fn get_framebuffer(&self) -> GLuint { + self.framebuffer + } + + #[inline(always)] + pub fn size(&self) -> Size2D { + self.size + } + + #[inline(always)] + // NOTE: We unwrap here because after creation the draw buffer + // always have a color attachment + pub fn color_attachment_type(&self) -> ColorAttachmentType { + self.color_attachment.as_ref().unwrap().color_attachment_type() + } + + pub fn get_bound_color_renderbuffer_id(&self) -> Option { + match self.color_attachment.as_ref().unwrap() { + &ColorAttachment::Renderbuffer(id) => Some(id), + _ => None, + } + } + + pub fn get_bound_texture_id(&self) -> Option { + match self.color_attachment.as_ref().unwrap() { + &ColorAttachment::Renderbuffer(_) => None, + &ColorAttachment::Texture(id) => Some(id), + } + } +} + +// NOTE: The initially associated GLContext MUST be the current gl context +// when drop is called. I know this is an important constraint. +// Right now there are no problems, if not, consider using a pointer to a +// parent with Rc and call make_current() +impl Drop for DrawBuffer { + fn drop(&mut self) { + gl::delete_framebuffers(&[self.framebuffer]); + + // NOTE: Color renderbuffer is destroyed on drop of + // ColorAttachment + gl::delete_renderbuffers(&[self.stencil_renderbuffer, self.depth_renderbuffer]); + } +} + +trait DrawBufferHelpers { + fn init(&mut self, + &GLContext, + color_attachment_type: ColorAttachmentType) + -> Result<(), &'static str>; + fn attach_to_framebuffer(&mut self) + -> Result<(), &'static str>; +} + +impl DrawBufferHelpers for DrawBuffer { + fn init(&mut self, + context: &GLContext, + color_attachment_type: ColorAttachmentType) + -> Result<(), &'static str> { + let attrs = context.borrow_attributes(); + let formats = context.borrow_formats(); + + self.color_attachment = match color_attachment_type { + ColorAttachmentType::Renderbuffer => { + let color_renderbuffer = create_renderbuffer(formats.color_renderbuffer, &self.size); + debug_assert!(color_renderbuffer != 0); + + Some(ColorAttachment::Renderbuffer(color_renderbuffer)) + }, + + // TODO(ecoal95): Allow more customization of textures + ColorAttachmentType::Texture => { + let texture = gl::gen_textures(1)[0]; + debug_assert!(texture != 0); + + gl::bind_texture(gl::TEXTURE_2D, texture); + gl::tex_image_2d(gl::TEXTURE_2D, 0, + formats.texture_internal as GLint, self.size.width, self.size.height, 0, formats.texture, formats.texture_type, None); + + // Low filtering to allow rendering + gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST as GLint); + gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST as GLint); + + // TODO(ecoal95): Check if these two are neccessary, probably not + gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_WRAP_S, gl::CLAMP_TO_EDGE as GLint); + gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_WRAP_T, gl::CLAMP_TO_EDGE as GLint); + + gl::bind_texture(gl::TEXTURE_2D, 0); + + debug_assert!(gl::get_error() == gl::NO_ERROR); + + Some(ColorAttachment::Texture(texture)) + }, + }; + + // After this we check if we need stencil and depth buffers + if attrs.depth { + self.depth_renderbuffer = create_renderbuffer(formats.depth, &self.size); + debug_assert!(self.depth_renderbuffer != 0); + } + + if attrs.stencil { + self.stencil_renderbuffer = create_renderbuffer(formats.stencil, &self.size); + debug_assert!(self.stencil_renderbuffer != 0); + } + + self.framebuffer = gl::gen_framebuffers(1)[0]; + debug_assert!(self.framebuffer != 0); + + // Finally we attach them to the framebuffer + self.attach_to_framebuffer() + } + + fn attach_to_framebuffer(&mut self) -> Result<(), &'static str> { + gl::bind_framebuffer(gl::FRAMEBUFFER, self.framebuffer); + // NOTE: The assertion fails if the framebuffer is not bound + debug_assert!(gl::is_framebuffer(self.framebuffer) == gl::TRUE); + + match *self.color_attachment.as_ref().unwrap() { + ColorAttachment::Renderbuffer(color_renderbuffer) => { + gl::framebuffer_renderbuffer(gl::FRAMEBUFFER, + gl::COLOR_ATTACHMENT0, + gl::RENDERBUFFER, + color_renderbuffer); + debug_assert!(gl::is_renderbuffer(color_renderbuffer) == gl::TRUE); + }, + ColorAttachment::Texture(texture_id) => { + gl::framebuffer_texture_2d(gl::FRAMEBUFFER, + gl::COLOR_ATTACHMENT0, + gl::TEXTURE_2D, + texture_id, 0); + }, + } + + if self.depth_renderbuffer != 0 { + gl::framebuffer_renderbuffer(gl::FRAMEBUFFER, + gl::DEPTH_ATTACHMENT, + gl::RENDERBUFFER, + self.depth_renderbuffer); + debug_assert!(gl::is_renderbuffer(self.depth_renderbuffer) == gl::TRUE); + } + + if self.stencil_renderbuffer != 0 { + gl::framebuffer_renderbuffer(gl::FRAMEBUFFER, + gl::STENCIL_ATTACHMENT, + gl::RENDERBUFFER, + self.stencil_renderbuffer); + debug_assert!(gl::is_renderbuffer(self.stencil_renderbuffer) == gl::TRUE); + } + + Ok(()) + } +} diff --git a/third_party/rust/offscreen_gl_context/src/gl_context.rs b/third_party/rust/offscreen_gl_context/src/gl_context.rs new file mode 100644 index 000000000000..5195268bec4b --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/gl_context.rs @@ -0,0 +1,195 @@ +use euclid::Size2D; +use gleam::gl; +use gleam::gl::types::{GLuint}; + +use NativeGLContextMethods; +use GLContextAttributes; +use GLContextCapabilities; +use GLFormats; +use GLLimits; +use DrawBuffer; +use ColorAttachmentType; + +/// This is a wrapper over a native headless GL context +pub struct GLContext { + native_context: Native, + /// This an abstraction over a custom framebuffer + /// with attachments according to WebGLContextAttributes + // TODO(ecoal95): Ideally we may want a read and a draw + // framebuffer, but this is not supported in GLES2, review + // when we have better support + draw_buffer: Option, + attributes: GLContextAttributes, + capabilities: GLContextCapabilities, + formats: GLFormats, + limits: GLLimits, +} + +impl GLContext + where Native: NativeGLContextMethods +{ + pub fn create(shared_with: Option<&Native::Handle>) -> Result, &'static str> { + Self::create_shared_with_dispatcher(shared_with, None) + } + + pub fn create_shared_with_dispatcher(shared_with: Option<&Native::Handle>, + dispatcher: Option>) + -> Result, &'static str> { + let native_context = try!(Native::create_shared_with_dispatcher(shared_with, dispatcher)); + try!(native_context.make_current()); + let attributes = GLContextAttributes::any(); + let formats = GLFormats::detect(&attributes); + let limits = GLLimits::detect(); + + Ok(GLContext { + native_context: native_context, + draw_buffer: None, + attributes: attributes, + capabilities: GLContextCapabilities::detect(), + formats: formats, + limits: limits, + }) + } + + #[inline(always)] + pub fn get_proc_address(addr: &str) -> *const () { + Native::get_proc_address(addr) + } + + #[inline(always)] + pub fn current_handle() -> Option { + Native::current_handle() + } + + pub fn new(size: Size2D, + attributes: GLContextAttributes, + color_attachment_type: ColorAttachmentType, + shared_with: Option<&Native::Handle>) + -> Result, &'static str> { + Self::new_shared_with_dispatcher(size, attributes, color_attachment_type, shared_with, None) + } + + pub fn new_shared_with_dispatcher(size: Size2D, + attributes: GLContextAttributes, + color_attachment_type: ColorAttachmentType, + shared_with: Option<&Native::Handle>, + dispatcher: Option>) + -> Result, &'static str> { + // We create a headless context with a dummy size, we're painting to the + // draw_buffer's framebuffer anyways. + let mut context = try!(Self::create_shared_with_dispatcher(shared_with, dispatcher)); + + context.formats = GLFormats::detect(&attributes); + context.attributes = attributes; + + try!(context.init_offscreen(size, color_attachment_type)); + + Ok(context) + } + + #[inline(always)] + pub fn with_default_color_attachment(size: Size2D, + attributes: GLContextAttributes, + shared_with: Option<&Native::Handle>) + -> Result, &'static str> { + GLContext::new(size, attributes, ColorAttachmentType::default(), shared_with) + } + + #[inline(always)] + pub fn make_current(&self) -> Result<(), &'static str> { + self.native_context.make_current() + } + + #[inline(always)] + pub fn unbind(&self) -> Result<(), &'static str> { + self.native_context.unbind() + } + + #[inline(always)] + pub fn is_current(&self) -> bool { + self.native_context.is_current() + } + + #[inline(always)] + pub fn handle(&self) -> Native::Handle { + self.native_context.handle() + } + + // Allow borrowing these unmutably + pub fn borrow_attributes(&self) -> &GLContextAttributes { + &self.attributes + } + + pub fn borrow_capabilities(&self) -> &GLContextCapabilities { + &self.capabilities + } + + pub fn borrow_formats(&self) -> &GLFormats { + &self.formats + } + + pub fn borrow_limits(&self) -> &GLLimits { + &self.limits + } + + pub fn borrow_draw_buffer(&self) -> Option<&DrawBuffer> { + self.draw_buffer.as_ref() + } + + pub fn get_framebuffer(&self) -> GLuint { + if let Some(ref db) = self.draw_buffer { + return db.get_framebuffer(); + } + + let ret = gl::get_integer_v(gl::FRAMEBUFFER_BINDING); + ret as GLuint + } + + pub fn draw_buffer_size(&self) -> Option> { + self.draw_buffer.as_ref().map( |db| db.size() ) + } + + // We resize just replacing the draw buffer, we don't perform size optimizations + // in order to keep this generic + pub fn resize(&mut self, size: Size2D) -> Result<(), &'static str> { + if self.draw_buffer.is_some() { + let color_attachment_type = + self.borrow_draw_buffer().unwrap().color_attachment_type(); + self.init_offscreen(size, color_attachment_type) + } else { + Err("No DrawBuffer found") + } + } +} + +// Dispatches functions to the thread where a NativeGLContext is bound. +// Right now it's used in the WGL implementation to dispatch functions to the thread +// where the context we share from is bound. See the WGL implementation for more details. +pub trait GLContextDispatcher { + fn dispatch(&self, Box); +} + +trait GLContextPrivateMethods { + fn init_offscreen(&mut self, Size2D, ColorAttachmentType) -> Result<(), &'static str>; + fn create_draw_buffer(&mut self, Size2D, ColorAttachmentType) -> Result<(), &'static str>; +} + +impl GLContextPrivateMethods for GLContext { + fn init_offscreen(&mut self, size: Size2D, color_attachment_type: ColorAttachmentType) -> Result<(), &'static str> { + try!(self.create_draw_buffer(size, color_attachment_type)); + + debug_assert!(self.is_current()); + + gl::clear_color(0.0, 0.0, 0.0, 0.0); + gl::clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT | gl::STENCIL_BUFFER_BIT); + gl::scissor(0, 0, size.width, size.height); + gl::viewport(0, 0, size.width, size.height); + + Ok(()) + } + + fn create_draw_buffer(&mut self, size: Size2D, color_attachment_type: ColorAttachmentType) -> Result<(), &'static str> { + self.draw_buffer = Some(try!(DrawBuffer::new(&self, size, color_attachment_type))); + Ok(()) + } +} diff --git a/third_party/rust/offscreen_gl_context/src/gl_context_attributes.rs b/third_party/rust/offscreen_gl_context/src/gl_context_attributes.rs new file mode 100644 index 000000000000..4b351bcef977 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/gl_context_attributes.rs @@ -0,0 +1,73 @@ +#[cfg(feature = "serde")] +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +/// This structure represents the attributes the context must support +/// It's almost (if not) identical to WebGLGLContextAttributes +#[derive(Clone, Debug, Copy)] +pub struct GLContextAttributes { + pub alpha: bool, + pub depth: bool, + pub stencil: bool, + pub antialias: bool, + pub premultiplied_alpha: bool, + pub preserve_drawing_buffer: bool, +} + +#[cfg(feature = "serde")] +impl Deserialize for GLContextAttributes { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer + { + let values = try!(<[_; 6]>::deserialize(deserializer)); + Ok(GLContextAttributes { + alpha: values[0], + depth: values[1], + stencil: values[2], + antialias: values[3], + premultiplied_alpha: values[4], + preserve_drawing_buffer: values[5], + }) + } +} + +#[cfg(feature = "serde")] +impl Serialize for GLContextAttributes { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer + { + let values = [ + self.alpha, self.depth, self.stencil, + self.antialias, self.premultiplied_alpha, self.preserve_drawing_buffer, + ]; + values.serialize(serializer) + } +} + +impl GLContextAttributes { + pub fn any() -> GLContextAttributes { + GLContextAttributes { + alpha: false, + depth: false, + stencil: false, + antialias: false, + premultiplied_alpha: false, + preserve_drawing_buffer: false, + } + } +} + +impl Default for GLContextAttributes { + // FIXME(ecoal95): `antialias` should be true by default + // but we do not support antialising so... We must change it + // when we do. See GLFeature. + fn default() -> GLContextAttributes { + GLContextAttributes { + alpha: true, + depth: true, + stencil: false, + antialias: false, + premultiplied_alpha: true, + preserve_drawing_buffer: false + } + } +} diff --git a/third_party/rust/offscreen_gl_context/src/gl_context_capabilities.rs b/third_party/rust/offscreen_gl_context/src/gl_context_capabilities.rs new file mode 100644 index 000000000000..2604371e35ab --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/gl_context_capabilities.rs @@ -0,0 +1,32 @@ +// use gleam::gl; +use gleam::gl::{GLint}; + +#[allow(unused_imports)] +use GLFeature; + +/// This is a cross-platform struct, that every GLContext implementation +/// should have under the field `capabilities`, as a public field +/// This should allow us to know the capabilities of a given +/// GLContext without repeating the same code over and over +#[derive(Copy, Clone, Debug)] +pub struct GLContextCapabilities { + // max antialising samples, 0 if no antialising supported + pub max_samples: GLint, +} + +impl GLContextCapabilities { + #[allow(unused_mut)] + pub fn detect() -> GLContextCapabilities { + let mut capabilities = GLContextCapabilities { + max_samples: 0, + }; + + + // FIXME(ecoal95): uncomment me when we have cross-system constants + // if GLFeature::is_supported(GLFeature::FramebufferMultisample) { + // unsafe { gl::GetIntegerv(gl::MAX_SAMPLES, &mut capabilities.max_samples as *mut GLint); }; + // } + + capabilities + } +} diff --git a/third_party/rust/offscreen_gl_context/src/gl_feature.rs b/third_party/rust/offscreen_gl_context/src/gl_feature.rs new file mode 100644 index 000000000000..78912872e865 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/gl_feature.rs @@ -0,0 +1,36 @@ + +pub enum GLFeature { + FramebufferMultisample, // Framebuffer multisample, for antialising +} + +/// Possible feature requirements: +/// * OpenGL version +/// * GLES version +/// * Extensions +#[allow(dead_code)] +pub struct GLFeatureRequirements { + opengl_version: u32, // OpenGL version: 1.0 => 10, etc... + gles_version: u32, + // Better not check for extensions unless necessary + // They use different symbols, and that adds a lot of complexity + // extensions: Vec<&'static str> +} + +// TODO: optimize (maybe use `rust-phf`)? +fn get_feature_requirements(feature: GLFeature) -> GLFeatureRequirements { + match feature { + GLFeature::FramebufferMultisample => GLFeatureRequirements { + opengl_version: 30, + gles_version: 30, + // extensions: vec!["GL_EXT_framebuffer_multisample"] + } + } +} + +impl GLFeature { + pub fn is_supported(feature: GLFeature) -> bool { + let _ = get_feature_requirements(feature); + // TODO + false + } +} diff --git a/third_party/rust/offscreen_gl_context/src/gl_formats.rs b/third_party/rust/offscreen_gl_context/src/gl_formats.rs new file mode 100644 index 000000000000..87d19b0274d2 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/gl_formats.rs @@ -0,0 +1,68 @@ +use gleam::gl::types::GLenum; +use gleam::gl; +use GLContextAttributes; + +/// This structure is here to allow +/// cross-platform formatting +pub struct GLFormats { + pub color_renderbuffer: GLenum, + pub texture_internal: GLenum, + pub texture: GLenum, + pub texture_type: GLenum, + pub depth: GLenum, + pub stencil: GLenum +} + +impl GLFormats { + // In the future we may use extension detection et-al to improve this, for now + // platform dependent. + // + // FIXME: In linux with GLES2 texture attachments create INVALID_ENUM errors. + // I suspect that it's because of texture formats, but I need time to debugit. + #[cfg(not(target_os="android"))] + pub fn detect(attrs: &GLContextAttributes) -> GLFormats { + if attrs.alpha { + GLFormats { + color_renderbuffer: gl::RGBA8, + texture_internal: gl::RGBA, + texture: gl::RGBA, + texture_type: gl::UNSIGNED_BYTE, + depth: gl::DEPTH_COMPONENT24, + stencil: gl::STENCIL_INDEX8, + } + } else { + GLFormats { + color_renderbuffer: gl::RGB8, + texture_internal: gl::RGB8, + texture: gl::RGB, + texture_type: gl::UNSIGNED_BYTE, + depth: gl::DEPTH_COMPONENT24, + stencil: gl::STENCIL_INDEX8, + } + } + } + + #[cfg(target_os="android")] + pub fn detect(attrs: &GLContextAttributes) -> GLFormats { + if attrs.alpha { + GLFormats { + color_renderbuffer: gl::RGBA4, + texture_internal: gl::RGBA, + texture: gl::RGBA, + texture_type: gl::UNSIGNED_SHORT_4_4_4_4, + depth: gl::DEPTH_COMPONENT16, + stencil: gl::STENCIL_INDEX8, + } + } else { + GLFormats { + color_renderbuffer: gl::RGB565, + texture_internal: gl::RGB, + texture: gl::RGB, + texture_type: gl::UNSIGNED_SHORT_4_4_4_4, + depth: gl::DEPTH_COMPONENT16, + stencil: gl::STENCIL_INDEX8, + } + } + } +} + diff --git a/third_party/rust/offscreen_gl_context/src/gl_limits.rs b/third_party/rust/offscreen_gl_context/src/gl_limits.rs new file mode 100644 index 000000000000..6c23f7a92d45 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/gl_limits.rs @@ -0,0 +1,44 @@ +use gleam::gl; +#[cfg(feature = "serde")] +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[derive(Debug, Clone)] +pub struct GLLimits { + pub max_vertex_attribs: u32, + pub max_tex_size: u32, + pub max_cube_map_tex_size: u32 +} + +#[cfg(feature = "serde")] +impl Deserialize for GLLimits { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer + { + let values = try!(<[_; 3]>::deserialize(deserializer)); + Ok(GLLimits { + max_vertex_attribs: values[0], + max_tex_size: values[1], + max_cube_map_tex_size: values[2], + }) + } +} + +#[cfg(feature = "serde")] +impl Serialize for GLLimits { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer + { + [self.max_vertex_attribs, self.max_tex_size, self.max_cube_map_tex_size] + .serialize(serializer) + } +} + +impl GLLimits { + pub fn detect() -> GLLimits { + GLLimits { + max_vertex_attribs: gl::get_integer_v(gl::MAX_VERTEX_ATTRIBS) as u32, + max_tex_size: gl::get_integer_v(gl::MAX_TEXTURE_SIZE) as u32, + max_cube_map_tex_size: gl::get_integer_v(gl::MAX_CUBE_MAP_TEXTURE_SIZE) as u32 + } + } +} diff --git a/third_party/rust/offscreen_gl_context/src/lib.rs b/third_party/rust/offscreen_gl_context/src/lib.rs new file mode 100644 index 000000000000..4f257f8a2438 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/lib.rs @@ -0,0 +1,80 @@ +extern crate gleam; +extern crate euclid; + +#[macro_use] +extern crate log; + +#[cfg(feature="serde")] +extern crate serde; + +#[cfg(target_os="linux")] +extern crate x11; +#[cfg(target_os="macos")] +extern crate cgl; +#[cfg(target_os="macos")] +extern crate core_foundation; +#[cfg(feature="osmesa")] +extern crate osmesa_sys; +#[cfg(target_os = "windows")] +extern crate winapi; +#[cfg(target_os = "windows")] +extern crate kernel32; +#[cfg(target_os = "windows")] +extern crate gdi32; +#[cfg(target_os = "windows")] +extern crate user32; +#[cfg(any(target_os="macos", target_os="windows"))] +#[macro_use] +extern crate lazy_static; + +mod platform; +pub use platform::{NativeGLContext, NativeGLContextMethods, NativeGLContextHandle}; +#[cfg(feature="osmesa")] +pub use platform::{OSMesaContext, OSMesaContextHandle}; + +mod gl_context; +pub use gl_context::{GLContext, GLContextDispatcher}; + +mod draw_buffer; +pub use draw_buffer::{DrawBuffer, ColorAttachmentType}; + +mod gl_context_attributes; +pub use gl_context_attributes::GLContextAttributes; + +mod gl_context_capabilities; +pub use gl_context_capabilities::GLContextCapabilities; + +mod gl_feature; +pub use gl_feature::GLFeature; + +mod gl_formats; +pub use gl_formats::GLFormats; + +mod gl_limits; +pub use gl_limits::GLLimits; + +#[cfg(target_os="linux")] +#[allow(improper_ctypes)] +mod glx { + include!(concat!(env!("OUT_DIR"), "/glx_bindings.rs")); +} + +#[cfg(any(target_os="android", all(target_os="linux", feature = "test_egl_in_linux")))] +#[allow(non_camel_case_types)] +mod egl { + use std::os::raw::{c_long, c_void}; + pub type khronos_utime_nanoseconds_t = khronos_uint64_t; + pub type khronos_uint64_t = u64; + pub type khronos_ssize_t = c_long; + pub type EGLint = i32; + pub type EGLNativeDisplayType = *const c_void; + pub type EGLNativePixmapType = *const c_void; + pub type EGLNativeWindowType = *const c_void; + pub type NativeDisplayType = EGLNativeDisplayType; + pub type NativePixmapType = EGLNativePixmapType; + pub type NativeWindowType = EGLNativeWindowType; + include!(concat!(env!("OUT_DIR"), "/egl_bindings.rs")); +} + +#[cfg(test)] +mod tests; diff --git a/third_party/rust/offscreen_gl_context/src/platform/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/mod.rs new file mode 100644 index 000000000000..a0f6c149bbc0 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/mod.rs @@ -0,0 +1,57 @@ +use gl_context::GLContextDispatcher; + +pub trait NativeGLContextMethods: Sized { + type Handle; + + fn get_proc_address(&str) -> *const (); + + // These are convenient methods to manage handles + fn current() -> Option; + fn current_handle() -> Option; + + fn create_shared(with: Option<&Self::Handle>) -> Result; + + fn create_shared_with_dispatcher(with: Option<&Self::Handle>, _dispatcher: Option>) + -> Result { + Self::create_shared(with) + } + + fn create_headless() -> Result { + Self::create_shared(None) + } + + fn handle(&self) -> Self::Handle; + fn is_current(&self) -> bool; + fn make_current(&self) -> Result<(), &'static str>; + fn unbind(&self) -> Result<(), &'static str>; +} + +#[cfg(target_os="linux")] +pub mod with_glx; +#[cfg(target_os="linux")] +pub use self::with_glx::{NativeGLContext, NativeGLContextHandle}; + +#[cfg(feature="osmesa")] +pub mod with_osmesa; +#[cfg(feature="osmesa")] +pub use self::with_osmesa::{OSMesaContext, OSMesaContextHandle}; + +#[cfg(any(target_os="android", all(target_os="linux", feature = "test_egl_in_linux")))] +pub mod with_egl; +#[cfg(target_os="android")] +pub use self::with_egl::{NativeGLContext, NativeGLContextHandle}; + +#[cfg(target_os="macos")] +pub mod with_cgl; +#[cfg(target_os="macos")] +pub use self::with_cgl::{NativeGLContext, NativeGLContextHandle}; + +#[cfg(target_os="windows")] +pub mod with_wgl; +#[cfg(target_os="windows")] +pub use self::with_wgl::{NativeGLContext, NativeGLContextHandle}; + +#[cfg(not(any(target_os="linux", target_os="android", target_os="macos", target_os="windows")))] +pub mod not_implemented; +#[cfg(not(any(target_os="linux", target_os="android", target_os="macos", target_os="windows")))] +pub use self::not_implemented::{NativeGLContext, NativeGLContextHandle}; diff --git a/third_party/rust/offscreen_gl_context/src/platform/not_implemented/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/not_implemented/mod.rs new file mode 100644 index 000000000000..fe3ce9af1ed4 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/not_implemented/mod.rs @@ -0,0 +1,2 @@ +mod native_gl_context; +pub use self::native_gl_context::{NativeGLContext, NativeGLContextHandle}; diff --git a/third_party/rust/offscreen_gl_context/src/platform/not_implemented/native_gl_context.rs b/third_party/rust/offscreen_gl_context/src/platform/not_implemented/native_gl_context.rs new file mode 100644 index 000000000000..e82dc7f66f4d --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/not_implemented/native_gl_context.rs @@ -0,0 +1,40 @@ +use NativeGLContextMethods; + +pub struct NativeGLContext; +pub struct NativeGLContextHandle; + +impl NativeGLContextMethods for NativeGLContext { + type Handle = NativeGLContextHandle; + + fn get_proc_address(_addr: &str) -> *const () { + 0 as *const () + } + + fn create_shared(_with: Option<&Self::Handle>) -> Result { + Err("Not implemented (yet)") + } + + fn is_current(&self) -> bool { + false + } + + fn current() -> Option { + None + } + + fn current_handle() -> Option { + None + } + + fn make_current(&self) -> Result<(), &'static str> { + Err("Not implemented (yet)") + } + + fn unbind(&self) -> Result<(), &'static str> { + unimplemented!() + } + + fn handle(&self) -> Self::Handle { + unimplemented!() + } +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_cgl/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/with_cgl/mod.rs new file mode 100644 index 000000000000..86ac835955fe --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_cgl/mod.rs @@ -0,0 +1,3 @@ +mod native_gl_context; +pub use self::native_gl_context::NativeGLContext; +pub use self::native_gl_context::NativeGLContextHandle; diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_cgl/native_gl_context.rs b/third_party/rust/offscreen_gl_context/src/platform/with_cgl/native_gl_context.rs new file mode 100644 index 000000000000..f364e7bce450 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_cgl/native_gl_context.rs @@ -0,0 +1,168 @@ +use cgl::*; +use std::mem; + +use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName}; +use core_foundation::base::TCFType; +use core_foundation::string::CFString; +use std::str::FromStr; +use std::sync::Mutex; + +use platform::NativeGLContextMethods; + +lazy_static! { + static ref CHOOSE_PIXEL_FORMAT_MUTEX: Mutex<()> = Mutex::new(()); +} + +pub struct NativeGLContextHandle(CGLContextObj); + +unsafe impl Send for NativeGLContextHandle {} + +pub struct NativeGLContext { + native_context: CGLContextObj, + weak: bool, +} + +impl NativeGLContext { + pub fn new(share_context: Option<&CGLContextObj>, + pixel_format: &CGLPixelFormatObj) + -> Result { + + let shared = match share_context { + Some(ctx) => *ctx, + None => 0 as CGLContextObj + }; + + let mut native: CGLContextObj = unsafe { mem::uninitialized() }; + + unsafe { + if CGLCreateContext(*pixel_format, shared, &mut native) != 0 { + return Err("CGLCreateContext"); + } + } + + debug_assert!(native != 0 as CGLContextObj); + + Ok(NativeGLContext { + native_context: native, + weak: false, + }) + } +} + +impl Drop for NativeGLContext { + fn drop(&mut self) { + let _ = self.unbind(); + if !self.weak { + unsafe { + if CGLDestroyContext(self.native_context) != 0 { + debug!("CGLDestroyContext returned an error"); + } + } + } + } +} + +impl NativeGLContextMethods for NativeGLContext { + type Handle = NativeGLContextHandle; + + fn get_proc_address(addr: &str) -> *const () { + let symbol_name: CFString = FromStr::from_str(addr).unwrap(); + let framework_name: CFString = FromStr::from_str("com.apple.opengl").unwrap(); + let framework = unsafe { + CFBundleGetBundleWithIdentifier(framework_name.as_concrete_TypeRef()) + }; + let symbol = unsafe { + CFBundleGetFunctionPointerForName(framework, symbol_name.as_concrete_TypeRef()) + }; + symbol as *const () + } + + fn current() -> Option { + if let Some(handle) = Self::current_handle() { + Some(NativeGLContext { + native_context: handle.0, + weak: true, + }) + } else { + None + } + + } + + fn current_handle() -> Option { + let current = unsafe { CGLGetCurrentContext() }; + if current != 0 as CGLContextObj { + Some(NativeGLContextHandle(current)) + } else { + None + } + } + + fn create_shared(with: Option<&Self::Handle>) -> Result { + // CGLChoosePixelFormat fails if multiple threads try to open a display connection + // simultaneously. The following error is returned by CGLChoosePixelFormat: + // kCGLBadConnection - Invalid connection to Core Graphics. + // We use a static mutex guard to fix this issue + let _guard = CHOOSE_PIXEL_FORMAT_MUTEX.lock().unwrap(); + + let mut attributes = [ + 0 + ]; + + let mut pixel_format : CGLPixelFormatObj = unsafe { mem::uninitialized() }; + let mut pix_count = 0; + + unsafe { + if CGLChoosePixelFormat(attributes.as_mut_ptr(), &mut pixel_format, &mut pix_count) != 0 { + return Err("CGLChoosePixelFormat"); + } + + if pix_count == 0 { + return Err("No pixel formats available"); + } + } + + let result = NativeGLContext::new(with.map(|handle| &handle.0), &pixel_format); + + unsafe { + if CGLDestroyPixelFormat(pixel_format) != 0 { + debug!("CGLDestroyPixelformat errored"); + } + } + + result + } + + fn handle(&self) -> Self::Handle { + NativeGLContextHandle(self.native_context) + } + + #[inline(always)] + fn is_current(&self) -> bool { + unsafe { + CGLGetCurrentContext() == self.native_context + } + } + + fn make_current(&self) -> Result<(), &'static str> { + unsafe { + if !self.is_current() && + CGLSetCurrentContext(self.native_context) != 0 { + Err("CGLSetCurrentContext") + } else { + Ok(()) + } + } + } + + fn unbind(&self) -> Result<(), &'static str> { + unsafe { + if self.is_current() && + CGLSetCurrentContext(0 as CGLContextObj) != 0 { + Err("CGLSetCurrentContext (on unbind)") + } else { + Ok(()) + } + } + } +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_egl/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/with_egl/mod.rs new file mode 100644 index 000000000000..4fcaa6418601 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_egl/mod.rs @@ -0,0 +1,9 @@ +mod native_gl_context; +mod utils; +pub use self::native_gl_context::NativeGLContext; +pub use self::native_gl_context::NativeGLContextHandle; + +// NB: The last three zeros in egl attributes after the egl::EGL_NONE +// are a workaround for workaround buggy implementations. +// Also, when we compare a createxx call with zero, it's equivalent to +// compare it with egl::EGL_NO_XX diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_egl/native_gl_context.rs b/third_party/rust/offscreen_gl_context/src/platform/with_egl/native_gl_context.rs new file mode 100644 index 000000000000..698ed5c9e220 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_egl/native_gl_context.rs @@ -0,0 +1,156 @@ +use euclid::Size2D; +use platform::NativeGLContextMethods; +use platform::with_egl::utils::{create_pixel_buffer_backed_offscreen_context}; +use std::ffi::CString; +use egl; +use egl::types::{EGLint, EGLBoolean, EGLDisplay, EGLSurface, EGLConfig, EGLContext}; + +pub struct NativeGLContextHandle(pub EGLDisplay, pub EGLSurface); +unsafe impl Send for NativeGLContextHandle {} + +pub struct NativeGLContext { + native_display: EGLDisplay, + native_surface: EGLSurface, + native_context: EGLContext, + weak: bool, +} + +impl NativeGLContext { + pub fn new(share_context: Option<&EGLContext>, + display: EGLDisplay, + surface: EGLSurface, + config: EGLConfig) + -> Result { + + let shared = match share_context { + Some(ctx) => *ctx, + None => egl::NO_CONTEXT as EGLContext, + }; + + let attributes = [ + egl::CONTEXT_CLIENT_VERSION as EGLint, 2, + egl::NONE as EGLint, 0, 0, 0, // see mod.rs + ]; + + let ctx = unsafe { egl::CreateContext(display, config, shared, attributes.as_ptr()) }; + + // TODO: Check for every type of error possible, not just client error? + // Note if we do it we must do it too on egl::CreatePBufferSurface, etc... + if ctx == (egl::NO_CONTEXT as EGLContext) { + unsafe { egl::DestroySurface(display, surface) }; + return Err("Error creating an EGL context"); + } + + Ok(NativeGLContext { + native_display: display, + native_surface: surface, + native_context: ctx, + weak: false, + }) + } +} + +impl Drop for NativeGLContext { + fn drop(&mut self) { + let _ = self.unbind(); + if !self.weak { + unsafe { + if egl::DestroySurface(self.native_display, self.native_surface) == 0 { + debug!("egl::DestroySurface failed"); + } + if egl::DestroyContext(self.native_display, self.native_context) == 0 { + debug!("egl::DestroyContext failed"); + } + } + } + } +} + +impl NativeGLContextMethods for NativeGLContext { + type Handle = NativeGLContextHandle; + + fn get_proc_address(addr: &str) -> *const () { + unsafe { + let addr = CString::new(addr.as_bytes()).unwrap().as_ptr(); + egl::GetProcAddress(addr as *const _) as *const () + } + } + + fn create_headless() -> Result { + // We create a context with a dummy size, we can't rely on a + // default framebuffer + create_pixel_buffer_backed_offscreen_context(Size2D::new(16, 16), None) + } + + fn create_shared(with: Option<&Self::Handle>) -> Result { + create_pixel_buffer_backed_offscreen_context(Size2D::new(16, 16), with) + } + + fn current_handle() -> Option { + let native_context = unsafe { egl::GetCurrentContext() }; + let native_display = unsafe { egl::GetCurrentDisplay() }; + + if native_context != egl::NO_CONTEXT && native_display != egl::NO_DISPLAY { + Some(NativeGLContextHandle(native_context, native_display)) + } else { + None + } + } + + + fn current() -> Option { + if let Some(handle) = Self::current_handle() { + let surface = unsafe { egl::GetCurrentSurface(egl::DRAW as EGLint) }; + + debug_assert!(surface != egl::NO_SURFACE); + + Some(NativeGLContext { + native_context: handle.0, + native_display: handle.1, + native_surface: surface, + weak: true, + }) + } else { + None + } + } + + #[inline(always)] + fn is_current(&self) -> bool { + unsafe { + egl::GetCurrentContext() == self.native_context + } + } + + fn make_current(&self) -> Result<(), &'static str> { + unsafe { + if !self.is_current() && + egl::MakeCurrent(self.native_display, + self.native_surface, + self.native_surface, + self.native_context) == (egl::FALSE as EGLBoolean) { + Err("egl::MakeCurrent") + } else { + Ok(()) + } + } + } + + fn handle(&self) -> Self::Handle { + NativeGLContextHandle(self.native_context, self.native_display) + } + + fn unbind(&self) -> Result<(), &'static str> { + unsafe { + if self.is_current() && + egl::MakeCurrent(self.native_display, + egl::NO_SURFACE as EGLSurface, + egl::NO_SURFACE as EGLSurface, + egl::NO_CONTEXT as EGLContext) == (egl::FALSE as EGLBoolean) { + Err("egl::MakeCurrent (on unbind)") + } else { + Ok(()) + } + } + } +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_egl/utils.rs b/third_party/rust/offscreen_gl_context/src/platform/with_egl/utils.rs new file mode 100644 index 000000000000..851ce35f5b0c --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_egl/utils.rs @@ -0,0 +1,85 @@ +use std::mem; +use euclid::Size2D; +use super::{NativeGLContext, NativeGLContextHandle}; + +use egl; +use egl::types::{EGLNativeDisplayType, EGLDisplay, EGLConfig, EGLSurface, EGLint}; + +fn create_pbuffer_surface(display: EGLDisplay, config: EGLConfig, size: Size2D) -> Result { + let mut attrs = [ + egl::WIDTH as EGLint, size.width as EGLint, + egl::HEIGHT as EGLint, size.height as EGLint, + egl::NONE as EGLint, 0, 0, 0, // see mod.rs + ]; + + let surface = unsafe { egl::CreatePbufferSurface(display, config, &mut *attrs.as_mut_ptr()) }; + + if surface == (egl::NO_SURFACE as EGLSurface) { + return Err("egl::CreatePBufferSurface"); + } + + Ok(surface) +} + +pub fn create_pixel_buffer_backed_offscreen_context(size: Size2D, + shared_with: Option<&NativeGLContextHandle>) + -> Result { + let attributes = [ + egl::SURFACE_TYPE as EGLint, egl::PBUFFER_BIT as EGLint, + egl::RENDERABLE_TYPE as EGLint, egl::OPENGL_ES2_BIT as EGLint, + egl::RED_SIZE as EGLint, 8, + egl::GREEN_SIZE as EGLint, 8, + egl::BLUE_SIZE as EGLint, 8, + egl::ALPHA_SIZE as EGLint, 0, + egl::NONE as EGLint, 0, 0, 0, // see mod.rs + ]; + + let (shared_with, display) = match shared_with { + Some(handle) => (Some(&handle.0), handle.1), + None => { + unsafe { + let display = egl::GetDisplay(egl::DEFAULT_DISPLAY as EGLNativeDisplayType); + + if display == (egl::NO_DISPLAY as EGLDisplay) { + return Err("egl::GetDisplay"); + } + + // TODO: Ensure this is correct. It seems it's refcounted, but not atomically, so + // we can't `Terminate` it on drop. + // + // It's the default display anyways so it is not a big problem. + if egl::Initialize(display, 0 as *mut _, 0 as *mut _) == 0 { + return Err("egl::Initialize"); + } + + (None, display) + } + } + }; + + + if display == (egl::NO_DISPLAY as EGLDisplay) { + return Err("egl::GetDisplay"); + } + + let mut config : EGLConfig = unsafe { mem::uninitialized() }; + let mut found_configs : EGLint = 0; + + unsafe { + if egl::ChooseConfig(display, + attributes.as_ptr(), + &mut config, + 1, + &mut found_configs) == egl::FALSE as u32 { + return Err("egl::ChooseConfig"); + } + } + + if found_configs == 0 { + return Err("No EGL config for pBuffer"); + } + + let surface = try!(create_pbuffer_surface(display, config, size)); + + NativeGLContext::new(shared_with, display, surface, config) +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_glx/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/with_glx/mod.rs new file mode 100644 index 000000000000..a7d0673174d3 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_glx/mod.rs @@ -0,0 +1,3 @@ +mod utils; +mod native_gl_context; +pub use self::native_gl_context::{NativeGLContext, NativeGLContextHandle}; diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_glx/native_gl_context.rs b/third_party/rust/offscreen_gl_context/src/platform/with_glx/native_gl_context.rs new file mode 100644 index 000000000000..6a50cef1c414 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_glx/native_gl_context.rs @@ -0,0 +1,145 @@ +use std::ffi::CString; + +use glx; +use std::os::raw::*; +use glx::types::{GLXContext, GLXDrawable, GLXFBConfig, GLXPixmap}; +use euclid::Size2D; +use super::utils::{create_offscreen_pixmap_backed_context}; + +use platform::NativeGLContextMethods; + +pub struct NativeGLContextHandle(pub GLXContext, pub *mut glx::types::Display); + +unsafe impl Send for NativeGLContextHandle {} + +pub struct NativeGLContext { + native_context: GLXContext, + native_display: *mut glx::types::Display, + native_drawable: GLXDrawable, + weak: bool, +} + +impl NativeGLContext { + pub fn new(share_context: Option<&GLXContext>, + display: *mut glx::types::Display, + drawable: GLXDrawable, + framebuffer_config: GLXFBConfig) + -> Result { + + let shared = match share_context { + Some(ctx) => *ctx, + None => 0 as GLXContext, + }; + + let native = unsafe { glx::CreateNewContext(display, framebuffer_config, glx::RGBA_TYPE as c_int, shared, 1 as glx::types::Bool) }; + + if native.is_null() { + unsafe { glx::DestroyPixmap(display, drawable as GLXPixmap) }; + return Err("Error creating native glx context"); + } + + Ok(NativeGLContext { + native_context: native, + native_display: display, + native_drawable: drawable, + weak: false, + }) + } + + pub fn as_native_glx_context(&self) -> GLXContext { + self.native_context + } +} + +impl Drop for NativeGLContext { + fn drop(&mut self) { + // Unbind the current context to free the resources + // inmediately + if !self.weak { + let _ = self.unbind(); // We don't want to panic + unsafe { + glx::DestroyContext(self.native_display, self.native_context); + glx::DestroyPixmap(self.native_display, self.native_drawable as GLXPixmap); + } + } + } +} + +impl NativeGLContextMethods for NativeGLContext { + type Handle = NativeGLContextHandle; + + fn get_proc_address(addr: &str) -> *const () { + let addr = CString::new(addr.as_bytes()).unwrap(); + let addr = addr.as_ptr(); + unsafe { + glx::GetProcAddress(addr as *const _) as *const () + } + } + + fn current_handle() -> Option { + let current = unsafe { glx::GetCurrentContext() }; + let dpy = unsafe { glx::GetCurrentDisplay() }; + + if current.is_null() || dpy.is_null() { + None + } else { + Some(NativeGLContextHandle(current, dpy)) + } + } + + fn current() -> Option { + if let Some(handle) = Self::current_handle() { + unsafe { + Some(NativeGLContext { + native_context: handle.0, + native_display: handle.1, + native_drawable: glx::GetCurrentDrawable(), + weak: true, + }) + } + } else { + None + } + } + + fn create_shared(with: Option<&Self::Handle>) -> Result { + create_offscreen_pixmap_backed_context(Size2D::new(16, 16), with) + } + + #[inline(always)] + fn is_current(&self) -> bool { + unsafe { + glx::GetCurrentContext() == self.native_context + } + } + + fn handle(&self) -> NativeGLContextHandle { + NativeGLContextHandle(self.native_context, self.native_display) + } + + fn make_current(&self) -> Result<(), &'static str> { + unsafe { + if !self.is_current() && + glx::MakeCurrent(self.native_display, + self.native_drawable, + self.native_context) == 0 { + Err("glx::MakeCurrent") + } else { + Ok(()) + } + } + } + + fn unbind(&self) -> Result<(), &'static str> { + unsafe { + if self.is_current() && + glx::MakeCurrent(self.native_display, + 0 as GLXDrawable, + 0 as GLXContext) == 0 { + Err("glx::MakeCurrent (on unbind)") + } else { + Ok(()) + } + } + } +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_glx/utils.rs b/third_party/rust/offscreen_gl_context/src/platform/with_glx/utils.rs new file mode 100644 index 000000000000..8f32a8e19227 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_glx/utils.rs @@ -0,0 +1,153 @@ +use glx; +use x11::xlib::*; +use glx::types::GLXDrawable; +use std::os::raw::*; +use euclid::Size2D; + +use NativeGLContext; +use NativeGLContextHandle; + +pub struct ScopedXFree { + ptr: *mut T +} + +impl ScopedXFree { + #[inline(always)] + pub fn new(ptr: *mut T) -> ScopedXFree { + ScopedXFree { + ptr: ptr + } + } + + #[inline(always)] + pub fn as_ptr(&self) -> *mut T { + self.ptr + } +} + +impl Drop for ScopedXFree { + fn drop(&mut self) { + if !self.ptr.is_null() { + unsafe { XFree(self.ptr as *mut _); }; + } + } +} + +unsafe fn get_visual_and_depth(s: *mut Screen, id: VisualID) -> Result<(*mut Visual, c_int), &'static str> { + for d in 0..((*s).ndepths as isize) { + let depth_info : *mut Depth = (*s).depths.offset(d); + for v in 0..((*depth_info).nvisuals as isize) { + let visual : *mut Visual = (*depth_info).visuals.offset(v); + if (*visual).visualid == id { + return Ok((visual, (*depth_info).depth)); + } + } + } + + Err("Visual not on screen") +} + +// Almost directly ported from +// https://dxr.mozilla.org/mozilla-central/source/gfx/gl/GLContextProviderGLX.cpp +pub fn create_offscreen_pixmap_backed_context(size: Size2D, shared_with: Option<&NativeGLContextHandle>) -> Result { + let (shared_with, dpy) = match shared_with { + Some(handle) => (Some(&handle.0), handle.1), + None => { + let dpy = unsafe { XOpenDisplay(0 as *mut c_char) as *mut glx::types::Display }; + + if dpy.is_null() { + return Err("glx::XOpenDisplay"); + } + + (None, dpy) + } + }; + + + // We try to get possible framebuffer configurations which + // can be pixmap-backed and renderable + let mut attributes = [ + glx::DRAWABLE_TYPE as c_int, glx::PIXMAP_BIT as c_int, + glx::X_RENDERABLE as c_int, 1, + 0 as c_int + ]; + + let mut config_count : c_int = 0; + + let configs = ScopedXFree::new(unsafe { + glx::ChooseFBConfig(dpy, + XDefaultScreen(dpy as *mut Display), + attributes.as_mut_ptr(), + &mut config_count) + }); + + if configs.as_ptr().is_null() { + return Err("glx::ChooseFBConfig"); + } + + debug_assert!(config_count > 0); + + let mut config_index = 0; + let mut visual_id = glx::NONE as c_int; + for i in 0..(config_count as isize) { + unsafe { + let config = *configs.as_ptr().offset(i); + let mut drawable_type : c_int = 0; + + // NOTE: glx's `Success` is unreachable from bindings, but it's defined to 0 + // TODO: Check if this conditional is neccesary: + // Actually this gets the drawable type and checks if + // contains PIXMAP_BIT, which should be true due to the attributes + // in glx::ChooseFBConfig + // + // It's in Gecko's code, so may there be an implementation which returns bad + // configurations? + if glx::GetFBConfigAttrib(dpy, config, glx::DRAWABLE_TYPE as c_int, &mut drawable_type) != 0 + || (drawable_type & (glx::PIXMAP_BIT as c_int) == 0) { + continue; + } + + if glx::GetFBConfigAttrib(dpy, config, glx::VISUAL_ID as c_int, &mut visual_id) != 0 + || visual_id == 0 { + continue; + } + } + + config_index = i; + break; + } + + if visual_id == 0 { + return Err("We don't have any config with visuals"); + } + + unsafe { + let screen = XDefaultScreenOfDisplay(dpy as *mut _); + + let (_, depth) = try!(get_visual_and_depth(screen, visual_id as VisualID)); + + let pixmap = XCreatePixmap(dpy as *mut _, + XRootWindowOfScreen(screen), + size.width as c_uint, + size.height as c_uint, + depth as c_uint); + + if pixmap == 0 { + return Err("XCreatePixMap"); + } + + let glx_pixmap = glx::CreatePixmap(dpy, + *configs.as_ptr().offset(config_index), + pixmap, + 0 as *const c_int); + + if glx_pixmap == 0 { + XFreePixmap(dpy as *mut _, pixmap); + return Err("glx::createPixmap"); + } + + let chosen_config = *configs.as_ptr().offset(config_index); + + NativeGLContext::new(shared_with, dpy, glx_pixmap as GLXDrawable, chosen_config) + } +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_osmesa/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/with_osmesa/mod.rs new file mode 100644 index 000000000000..bf8bc2b98ffe --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_osmesa/mod.rs @@ -0,0 +1,125 @@ +use std::ffi::CString; +use std::ptr; + +use osmesa_sys; +use gleam::gl; + +use platform::NativeGLContextMethods; + +const DUMMY_BUFFER_WIDTH: usize = 16; +const DUMMY_BUFFER_HEIGHT: usize = 16; + +pub struct OSMesaContext { + buffer: Vec, + context: osmesa_sys::OSMesaContext, +} + +pub struct OSMesaContextHandle(osmesa_sys::OSMesaContext); + +unsafe impl Send for OSMesaContextHandle {} + +impl OSMesaContext { + pub fn new(share_with: Option) + -> Result { + let shared = match share_with { + Some(ctx) => ctx, + _ => ptr::null_mut(), + }; + + let context = unsafe { + osmesa_sys::OSMesaCreateContext(osmesa_sys::OSMESA_RGBA, shared) + }; + + if context.is_null() { + return Err("OSMesaCreateContext"); + } + + let buffer = vec![0u8; DUMMY_BUFFER_WIDTH * DUMMY_BUFFER_HEIGHT * 4]; + Ok(OSMesaContext { + buffer: buffer, + context: context, + }) + } +} + +impl NativeGLContextMethods for OSMesaContext { + type Handle = OSMesaContextHandle; + + fn get_proc_address(addr: &str) -> *const () { + let addr = CString::new(addr.as_bytes()).unwrap(); + let addr = addr.as_ptr(); + unsafe { + ::std::mem::transmute( + osmesa_sys::OSMesaGetProcAddress(addr as *const _)) + } + } + + fn current_handle() -> Option { + let current = unsafe { osmesa_sys::OSMesaGetCurrentContext() }; + if current.is_null() { + None + } else { + Some(OSMesaContextHandle(current)) + } + } + + fn current() -> Option { + /* We can't access to the OSMesa buffer from here. */ + None + } + + fn create_shared(with: Option<&Self::Handle>) -> Result { + Self::new(with.map(|w| w.0)) + } + + fn is_current(&self) -> bool { + unsafe { + osmesa_sys::OSMesaGetCurrentContext() == self.context + } + } + + fn handle(&self) -> Self::Handle { + OSMesaContextHandle(self.context) + } + + fn make_current(&self) -> Result<(), &'static str> { + unsafe { + if !self.is_current() && + osmesa_sys::OSMesaMakeCurrent(self.context, + self.buffer.as_ptr() as *const _ as *mut _, + gl::UNSIGNED_BYTE, + DUMMY_BUFFER_WIDTH as i32, + DUMMY_BUFFER_HEIGHT as i32) == 0 { + Err("OSMesaMakeCurrent") + } else { + Ok(()) + } + } + } + + fn unbind(&self) -> Result<(), &'static str> { + // OSMesa doesn't allow any API to unbind a context before [1], and just + // bails out on null context, buffer, or whatever, so not much we can do + // here. Thus, ignore the failure and just flush the context if we're + // using an old OSMesa version. + // + // [1]: https://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg128408.html + if self.is_current() { + let ret = unsafe { + osmesa_sys::OSMesaMakeCurrent(ptr::null_mut(), + ptr::null_mut(), 0, 0, 0) + }; + if ret == gl::FALSE { + gl::flush(); + } + } + + Ok(()) + } +} + +impl Drop for OSMesaContext { + fn drop(&mut self) { + unsafe { osmesa_sys::OSMesaDestroyContext(self.context) } + } +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_wgl/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/mod.rs new file mode 100644 index 000000000000..fb8b1f7ed250 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/mod.rs @@ -0,0 +1,15 @@ +/// WGL bindings +pub mod wgl { + include!(concat!(env!("OUT_DIR"), "/wgl_bindings.rs")); +} + +/// Functions that are not necessarly always available +pub mod wgl_ext { + include!(concat!(env!("OUT_DIR"), "/wgl_extra_bindings.rs")); +} + +mod wgl_attributes; +mod native_gl_context; +mod utils; +pub use self::native_gl_context::NativeGLContext; +pub use self::native_gl_context::NativeGLContextHandle; diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs new file mode 100644 index 000000000000..204322d92f14 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs @@ -0,0 +1,228 @@ +use platform::NativeGLContextMethods; +use gl_context::GLContextDispatcher; +use std::ffi::CString; +use std::os::raw::c_void; +use std::ptr; +use std::sync::mpsc; + +use winapi; +use user32; +use kernel32; +use super::wgl; +use super::wgl_attributes::*; +use super::utils; + +// Wrappers to satisfy `Sync`. +struct HMODULEWrapper(winapi::HMODULE); +unsafe impl Sync for HMODULEWrapper {} + +lazy_static! { + static ref GL_LIB: Option = { + let p = unsafe { kernel32::LoadLibraryA(b"opengl32.dll\0".as_ptr() as *const _) }; + if p.is_null() { + error!("WGL: opengl32.dll not found!"); + None + } else { + debug!("WGL: opengl32.dll loaded!"); + Some(HMODULEWrapper(p)) + } + }; + + static ref PROC_ADDR_CTX: Option = { + match unsafe { utils::create_offscreen(ptr::null_mut(), &WGLAttributes::default()) } { + Ok(ref res) => { + let ctx = NativeGLContext { + render_ctx: res.0, + device_ctx: res.1, + weak: false, + }; + Some(ctx) + } + Err(s) => { + error!("Error creating GetProcAddress helper context: {}", s); + None + } + } + }; +} + +pub struct NativeGLContext { + render_ctx: winapi::HGLRC, + device_ctx: winapi::HDC, + weak: bool, +} + +impl Drop for NativeGLContext { + fn drop(&mut self) { + unsafe { + if !self.weak { + // the context to be deleted needs to be unbound + self.unbind().unwrap(); + wgl::DeleteContext(self.render_ctx as *const _); + let window = user32::WindowFromDC(self.device_ctx); + debug_assert!(!window.is_null()); + user32::ReleaseDC(window, self.device_ctx); + user32::DestroyWindow(window); + } + } + } +} + +unsafe impl Send for NativeGLContext {} +unsafe impl Sync for NativeGLContext {} + +pub struct NativeGLContextHandle(winapi::HGLRC, winapi::HDC); +unsafe impl Send for NativeGLContextHandle {} +unsafe impl Sync for NativeGLContextHandle {} + +impl NativeGLContextMethods for NativeGLContext { + type Handle = NativeGLContextHandle; + + fn get_proc_address(addr: &str) -> *const () { + let addr = CString::new(addr.as_bytes()).unwrap(); + let addr = addr.as_ptr(); + unsafe { + if wgl::GetCurrentContext().is_null() { + // wglGetProcAddress only works in the presence of a valid GL context + // We use a dummy ctx when the caller calls this function without a valid GL context + if let Some(ref ctx) = *PROC_ADDR_CTX { + if ctx.make_current().is_err() { + return ptr::null_mut(); + } + } else { + return ptr::null_mut(); + } + } + + let p = wgl::GetProcAddress(addr) as *const _; + if !p.is_null() { + return p; + } + // wglGetProcAddress​ doesn't return function pointers for some legacy functions, + // (the ones coming from OpenGL 1.1) + // These functions are exported by the opengl32.dll itself, + // so we have to fallback to kernel32 getProcAddress if wglGetProcAddress​ return null + match *GL_LIB { + Some(ref lib) => kernel32::GetProcAddress(lib.0, addr) as *const _, + None => ptr::null_mut(), + } + } + } + + fn create_shared(with: Option<&Self::Handle>) -> Result { + Self::create_shared_with_dispatcher(with, None) + } + + fn create_shared_with_dispatcher(with: Option<&Self::Handle>, dispatcher: Option>) + -> Result { + let (render_ctx, device_ctx) = match with { + Some(ref handle) => (handle.0, handle.1), + None => (ptr::null_mut(), ptr::null_mut()) + }; + + if let Some(ref dispatcher) = dispatcher { + // wglShareLists fails if the context to share is current in a different thread. + // Additionally wglMakeCurrent cannot 'steal' a context that is current in other thread, so + // we have to unbind the shared context in its own thread, call wglShareLists in this thread + // and bind the original share context again when the wglShareList is completed. + let (tx, rx) = mpsc::channel(); + dispatcher.dispatch(Box::new(move || { + let result = unsafe { + if wgl::MakeCurrent(ptr::null_mut(), ptr::null_mut()) == 0 { + Err(()) + } else { + Ok(()) + } + }; + tx.send(result).unwrap(); + })); + // Wait until wglMakeCurrent operation is completed in the thread of the shared context + if rx.recv().unwrap().is_err() { + return Err("Error creating WGL context: WGL::MakeCurrent failed in shared context") + } + } + + let result = match unsafe { utils::create_offscreen(render_ctx, &WGLAttributes::default()) } { + Ok(ref res) => { + let ctx = NativeGLContext { + render_ctx: res.0, + device_ctx: res.1, + weak: false, + }; + Ok(ctx) + } + Err(s) => { + error!("WGL: {}", s); + Err("Error creating WGL context") + } + }; + + // Restore shared context + if let Some(ref dispatcher) = dispatcher { + let (tx, rx) = mpsc::channel(); + let handle = NativeGLContextHandle(render_ctx, device_ctx); + dispatcher.dispatch(Box::new(move || { + unsafe { + if wgl::MakeCurrent(handle.1 as *const _, handle.0 as *const _) == 0 { + error!("Error restoring WGL shared context: WGL MakeCurrent failed"); + } + }; + tx.send(()).unwrap(); + })); + // Wait until wglMakeCurrent operation is completed in the thread of the shared context + rx.recv().unwrap(); + } + + result + } + + fn is_current(&self) -> bool { + unsafe { wgl::GetCurrentContext() == self.render_ctx as *const c_void } + } + + fn current() -> Option { + if let Some(handle) = Self::current_handle() { + Some(NativeGLContext { + render_ctx: handle.0, + device_ctx: handle.1, + weak: true, + }) + } else { + None + } + } + + fn current_handle() -> Option { + let ctx = unsafe { wgl::GetCurrentContext() }; + let hdc = unsafe { wgl::GetCurrentDC() }; + if ctx.is_null() || hdc.is_null() { + None + } else { + Some(NativeGLContextHandle(ctx as winapi::HGLRC, hdc as winapi::HDC)) + } + } + + fn make_current(&self) -> Result<(), &'static str> { + unsafe { + if wgl::MakeCurrent(self.device_ctx as *const _, self.render_ctx as *const _) != 0 { + Ok(()) + } else { + Err("WGL::makeCurrent failed") + } + } + } + + fn unbind(&self) -> Result<(), &'static str> { + unsafe { + if self.is_current() && wgl::MakeCurrent(ptr::null_mut(), ptr::null_mut()) == 0 { + Err("WGL::MakeCurrent (on unbind)") + } else { + Ok(()) + } + } + } + + fn handle(&self) -> Self::Handle { + NativeGLContextHandle(self.render_ctx, self.device_ctx) + } +} diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_wgl/utils.rs b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/utils.rs new file mode 100644 index 000000000000..81fbe20e8262 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/utils.rs @@ -0,0 +1,712 @@ +use std::mem; +use super::wgl_attributes::*; + +use std::ffi::{CStr, CString, OsStr}; +use std::os::raw::{c_void, c_int}; +use std::os::windows::ffi::OsStrExt; +use std::io; +use std::ptr; + +use winapi; +use kernel32; +use user32; +use gdi32; +use super::wgl; +use super::wgl_ext; + + +// #Attributions +// This WGL implementation has been inspired by the code originating in Glutin. +// We have used slightly modified version util functions to manage WGL contexts. +// We simplified the win32 window creation because we don't need the event handler thread +// We'd like to credit and thank all of the Glutin contributors for their work. +// (https://github.com/tomaka/glutin) + +pub unsafe fn create_offscreen(shared_with: winapi::HGLRC, + settings: &WGLAttributes) + -> Result<(winapi::HGLRC, winapi::HDC), String> { + let mut ctx = WGLScopedContext::default(); + ctx.window = try!(create_hidden_window()); + ctx.device_ctx = user32::GetDC(ctx.window); + if ctx.device_ctx.is_null() { + return Err("GetDC function failed".to_owned()); + } + + let extra = try!(load_extra_functions(ctx.window)); + + let extensions = if extra.GetExtensionsStringARB.is_loaded() { + let data = extra.GetExtensionsStringARB(ctx.device_ctx as *const _); + let data = CStr::from_ptr(data).to_bytes().to_vec(); + String::from_utf8(data).unwrap() + } else if extra.GetExtensionsStringEXT.is_loaded() { + let data = extra.GetExtensionsStringEXT(); + let data = CStr::from_ptr(data).to_bytes().to_vec(); + String::from_utf8(data).unwrap() + } else { + String::new() + }; + + let (id, _) = if extensions.split(' ').find(|&i| i == "WGL_ARB_pixel_format").is_some() { + try!(choose_arb_pixel_format(&extra, &extensions, ctx.device_ctx, &settings.pixel_format) + .map_err(|_| "ARB pixel format not available".to_owned())) + } else { + try!(choose_native_pixel_format(ctx.device_ctx, &settings.pixel_format) + .map_err(|_| "Native pixel format not available".to_owned())) + }; + + try!(set_pixel_format(ctx.device_ctx, id)); + + let result = create_full_context(settings, &extra, &extensions, ctx.device_ctx, shared_with); + if result.is_ok() { + mem::forget(ctx); // Everything is ok, don't dispose the scoped ctx + } + result +} + +// creates a basic context +unsafe fn create_basic_context(hdc: winapi::HDC, + share: winapi::HGLRC) + -> Result<(winapi::HGLRC, winapi::HDC), String> { + let mut ctx = WGLScopedContext::default(); + ctx.render_ctx = wgl::CreateContext(hdc as *const _) as winapi::HGLRC; + if ctx.render_ctx.is_null() { + return Err(format!("wglCreateContext failed: {}", io::Error::last_os_error())); + } + + if !share.is_null() { + if wgl::ShareLists(share as *const _, ctx.render_ctx as *const _) == 0 { + return Err(format!("wglShareLists failed: {}", io::Error::last_os_error())); + } + }; + + let result = (ctx.render_ctx, hdc); + mem::forget(ctx); // Everything is ok, don't dispose the scoped ctx + Ok(result) +} + +// creates a full context: attempts to use optional ext WGL functions +unsafe fn create_full_context(settings: &WGLAttributes, + extra: &wgl_ext::Wgl, + extensions: &str, + hdc: winapi::HDC, + share: winapi::HGLRC) + -> Result<(winapi::HGLRC, winapi::HDC), String> { + let mut extensions = extensions.split(' '); + if extensions.find(|&i| i == "WGL_ARB_create_context").is_none() { + let ctx = create_basic_context(hdc, share); + if let Ok(ctx) = ctx { + if wgl::MakeCurrent(ctx.1 as *const _, ctx.0 as *const _) == 0 { + return Err("wglMakeCurrent failed creating a basic context".to_owned()); + } + } + return ctx; + } + + let mut attributes = Vec::new(); + if settings.opengl_es { + if extensions.find(|&i| i == "WGL_EXT_create_context_es2_profile").is_some() { + attributes.push(wgl_ext::CONTEXT_PROFILE_MASK_ARB as c_int); + attributes.push(wgl_ext::CONTEXT_ES2_PROFILE_BIT_EXT as c_int); + } else { + return Err("OpenGl Version Not Supported".to_owned()); + } + } + + if settings.major_version > 0 { + attributes.push(wgl_ext::CONTEXT_MAJOR_VERSION_ARB as c_int); + attributes.push(settings.major_version as c_int); + attributes.push(wgl_ext::CONTEXT_MINOR_VERSION_ARB as c_int); + attributes.push(settings.minor_version as c_int); + } + + attributes.push(wgl_ext::CONTEXT_FLAGS_ARB as c_int); + attributes.push((if settings.debug { + wgl_ext::CONTEXT_FLAGS_ARB + } else { + 0 + }) as c_int); + + attributes.push(0); + + let mut ctx = WGLScopedContext::default(); + ctx.render_ctx = extra.CreateContextAttribsARB(hdc as *const _, + share as *const _, + attributes.as_ptr()) as winapi::HGLRC; + + if ctx.render_ctx.is_null() { + return Err(format!("wglCreateContextAttribsARB failed: {}", + io::Error::last_os_error())); + } + + if wgl::MakeCurrent(hdc as *const _, ctx.render_ctx as *const _) == 0 { + return Err("wglMakeCurrent failed creating full context".to_owned()); + } + // Disable or enable vsync + if extensions.find(|&i| i == "WGL_EXT_swap_control").is_some() { + if extra.SwapIntervalEXT(if settings.vsync { 1 } else { 0 }) == 0 { + return Err("wglSwapIntervalEXT failed".to_owned()); + } + } + let result = (ctx.render_ctx as winapi::HGLRC, hdc); + mem::forget(ctx); + Ok(result) +} + +unsafe fn create_hidden_window() -> Result { + let class_name = register_window_class(); + let mut rect = winapi::RECT { + left: 0, + right: 1024 as winapi::LONG, + top: 0, + bottom: 768 as winapi::LONG, + }; + let ex_style = winapi::WS_EX_APPWINDOW | winapi::WS_EX_WINDOWEDGE; + let style = winapi::WS_OVERLAPPEDWINDOW | winapi::WS_CLIPSIBLINGS | winapi::WS_CLIPCHILDREN; + + user32::AdjustWindowRectEx(&mut rect, style, 0, ex_style); + let title = OsStr::new("WGLwindow") + .encode_wide() + .chain(Some(0).into_iter()) + .collect::>(); + + let win = user32::CreateWindowExW(ex_style, + class_name.as_ptr(), + title.as_ptr(), + style, + winapi::CW_USEDEFAULT, + winapi::CW_USEDEFAULT, + rect.right - rect.left, + rect.bottom - rect.top, + ptr::null_mut(), + ptr::null_mut(), + kernel32::GetModuleHandleW(ptr::null()), + ptr::null_mut()); + if win.is_null() { + return Err("CreateWindowEx function failed"); + } + + Ok(win) +} + +// Helper struct used to dispose resources in error paths +struct WGLScopedContext { + pub window: winapi::HWND, + pub device_ctx: winapi::HDC, + pub render_ctx: winapi::HGLRC, +} + +impl Drop for WGLScopedContext { + fn drop(&mut self) { + unsafe { + if !self.render_ctx.is_null() { + wgl::DeleteContext(self.render_ctx as *const _); + } + if !self.device_ctx.is_null() && !self.window.is_null() { + user32::ReleaseDC(self.window, self.device_ctx); + } + if !self.window.is_null() { + user32::DestroyWindow(self.window); + } + } + } +} + +impl Default for WGLScopedContext { + #[inline] + fn default() -> WGLScopedContext { + WGLScopedContext { + window: ptr::null_mut(), + device_ctx: ptr::null_mut(), + render_ctx: ptr::null_mut(), + } + } +} + +impl WGLScopedContext { + fn new(window: winapi::HWND, device_ctx: winapi::HDC, render_ctx: winapi::HGLRC) -> WGLScopedContext { + WGLScopedContext { + window: window, + device_ctx: device_ctx, + render_ctx: render_ctx, + } + } +} + +// *********** +// Utilities to ease WGL context creation +// Slightly modified versions of util functions taken from Glutin +// (https://github.com/tomaka/glutin) +// *********** + +unsafe fn register_window_class() -> Vec { + let class_name = OsStr::new("Window Class") + .encode_wide() + .chain(Some(0).into_iter()) + .collect::>(); + + let class = winapi::WNDCLASSEXW { + cbSize: mem::size_of::() as winapi::UINT, + style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC, + lpfnWndProc: Some(proc_callback), + cbClsExtra: 0, + cbWndExtra: 0, + hInstance: kernel32::GetModuleHandleW(ptr::null()), + hIcon: ptr::null_mut(), + hCursor: ptr::null_mut(), // must be null in order for cursor state to work properly + hbrBackground: ptr::null_mut(), + lpszMenuName: ptr::null(), + lpszClassName: class_name.as_ptr(), + hIconSm: ptr::null_mut(), + }; + + // We ignore errors because registering the same window class twice would trigger + // an error, and because errors here are detected during CreateWindowEx anyway. + // Also since there is no weird element in the struct, there is no reason for this + // call to fail. + user32::RegisterClassExW(&class); + + class_name +} + +pub unsafe extern "system" fn proc_callback(window: winapi::HWND, + msg: winapi::UINT, + wparam: winapi::WPARAM, + lparam: winapi::LPARAM) + -> winapi::LRESULT { + match msg { + winapi::WM_PAINT => 0, + winapi::WM_ERASEBKGND => 0, + _ => user32::DefWindowProcW(window, msg, wparam, lparam), + } +} + +#[derive(Debug, Clone)] +pub struct PixelFormat { + pub hardware_accelerated: bool, + pub color_bits: u8, + pub alpha_bits: u8, + pub depth_bits: u8, + pub stencil_bits: u8, + pub stereoscopy: bool, + pub double_buffer: bool, + pub multisampling: Option, + pub srgb: bool, +} + +unsafe fn choose_arb_pixel_format(extra: &wgl_ext::Wgl, + extensions: &str, + hdc: winapi::HDC, + reqs: &WGLPixelFormat) + -> Result<(c_int, PixelFormat), ()> { + let descriptor = { + let mut out: Vec = Vec::with_capacity(37); + + out.push(wgl_ext::DRAW_TO_WINDOW_ARB as c_int); + out.push(1); + + out.push(wgl_ext::SUPPORT_OPENGL_ARB as c_int); + out.push(1); + + out.push(wgl_ext::PIXEL_TYPE_ARB as c_int); + if reqs.float_color_buffer { + if extensions.split(' ').find(|&i| i == "WGL_ARB_pixel_format_float").is_some() { + out.push(wgl_ext::TYPE_RGBA_FLOAT_ARB as c_int); + } else { + return Err(()); + } + } else { + out.push(wgl_ext::TYPE_RGBA_ARB as c_int); + } + + // Force hardware aceleration + out.push(wgl_ext::ACCELERATION_ARB as c_int); + out.push(wgl_ext::FULL_ACCELERATION_ARB as c_int); + + if let Some(color) = reqs.color_bits { + out.push(wgl_ext::COLOR_BITS_ARB as c_int); + out.push(color as c_int); + } + + if let Some(alpha) = reqs.alpha_bits { + out.push(wgl_ext::ALPHA_BITS_ARB as c_int); + out.push(alpha as c_int); + } + + if let Some(depth) = reqs.depth_bits { + out.push(wgl_ext::DEPTH_BITS_ARB as c_int); + out.push(depth as c_int); + } + + if let Some(stencil) = reqs.stencil_bits { + out.push(wgl_ext::STENCIL_BITS_ARB as c_int); + out.push(stencil as c_int); + } + + // Prefer double buffering if unspecified (probably shouldn't once you can choose) + let double_buffer = reqs.double_buffer.unwrap_or(true); + out.push(wgl_ext::DOUBLE_BUFFER_ARB as c_int); + out.push(if double_buffer { 1 } else { 0 }); + + if let Some(multisampling) = reqs.multisampling { + if extensions.split(' ').find(|&i| i == "WGL_ARB_multisample").is_some() { + out.push(wgl_ext::SAMPLE_BUFFERS_ARB as c_int); + out.push(if multisampling == 0 { 0 } else { 1 }); + out.push(wgl_ext::SAMPLES_ARB as c_int); + out.push(multisampling as c_int); + } else { + return Err(()); + } + } + + out.push(wgl_ext::STEREO_ARB as c_int); + out.push(if reqs.stereoscopy { 1 } else { 0 }); + + if reqs.srgb { + if extensions.split(' ').find(|&i| i == "WGL_ARB_framebuffer_sRGB").is_some() { + out.push(wgl_ext::FRAMEBUFFER_SRGB_CAPABLE_ARB as c_int); + out.push(1); + } else if extensions.split(' ').find(|&i| i == "WGL_EXT_framebuffer_sRGB").is_some() { + out.push(wgl_ext::FRAMEBUFFER_SRGB_CAPABLE_EXT as c_int); + out.push(1); + } else { + return Err(()); + } + } + + out.push(0); + out + }; + + let mut format_id = mem::uninitialized(); + let mut num_formats = mem::uninitialized(); + if extra.ChoosePixelFormatARB(hdc as *const _, + descriptor.as_ptr(), + ptr::null(), + 1, + &mut format_id, + &mut num_formats) == 0 { + return Err(()); + } + + if num_formats == 0 { + return Err(()); + } + + let get_info = |attrib: u32| { + let mut value = mem::uninitialized(); + extra.GetPixelFormatAttribivARB(hdc as *const _, + format_id as c_int, + 0, + 1, + [attrib as c_int].as_ptr(), + &mut value); + value as u32 + }; + + let pf_desc = PixelFormat { + hardware_accelerated: get_info(wgl_ext::ACCELERATION_ARB) != wgl_ext::NO_ACCELERATION_ARB, + color_bits: get_info(wgl_ext::RED_BITS_ARB) as u8 + + get_info(wgl_ext::GREEN_BITS_ARB) as u8 + + get_info(wgl_ext::BLUE_BITS_ARB) as u8, + alpha_bits: get_info(wgl_ext::ALPHA_BITS_ARB) as u8, + depth_bits: get_info(wgl_ext::DEPTH_BITS_ARB) as u8, + stencil_bits: get_info(wgl_ext::STENCIL_BITS_ARB) as u8, + stereoscopy: get_info(wgl_ext::STEREO_ARB) != 0, + double_buffer: get_info(wgl_ext::DOUBLE_BUFFER_ARB) != 0, + multisampling: { + if extensions.split(' ').find(|&i| i == "WGL_ARB_multisample").is_some() { + match get_info(wgl_ext::SAMPLES_ARB) { + 0 => None, + a => Some(a as u16), + } + } else { + None + } + }, + srgb: if extensions.split(' ').find(|&i| i == "WGL_ARB_framebuffer_sRGB").is_some() { + get_info(wgl_ext::FRAMEBUFFER_SRGB_CAPABLE_ARB) != 0 + } else if extensions.split(' ') + .find(|&i| i == "WGL_EXT_framebuffer_sRGB") + .is_some() { + get_info(wgl_ext::FRAMEBUFFER_SRGB_CAPABLE_EXT) != 0 + } else { + false + }, + }; + + Ok((format_id, pf_desc)) +} + +// Chooses a pixel formats without using WGL. +// Gives less precise results than `enumerate_arb_pixel_formats`. +unsafe fn choose_native_pixel_format(hdc: winapi::HDC, + reqs: &WGLPixelFormat) + -> Result<(c_int, PixelFormat), ()> { + // handling non-supported stuff + if reqs.float_color_buffer { + return Err(()); + } + + match reqs.multisampling { + Some(0) | None => (), + Some(_) => return Err(()), + }; + + if reqs.stereoscopy { + return Err(()); + } + + if reqs.srgb { + return Err(()); + } + + // building the descriptor to pass to ChoosePixelFormat + let descriptor = winapi::PIXELFORMATDESCRIPTOR { + nSize: mem::size_of::() as u16, + nVersion: 1, + dwFlags: { + let f1 = match reqs.double_buffer { + // Should be PFD_DOUBLEBUFFER_DONTCARE after you can choose + None => winapi::PFD_DOUBLEBUFFER, + Some(true) => winapi::PFD_DOUBLEBUFFER, + Some(false) => 0, + }; + + let f2 = if reqs.stereoscopy { + winapi::PFD_STEREO + } else { + 0 + }; + + winapi::PFD_DRAW_TO_WINDOW | winapi::PFD_SUPPORT_OPENGL | f1 | f2 + }, + iPixelType: winapi::PFD_TYPE_RGBA, + cColorBits: reqs.color_bits.unwrap_or(0), + cRedBits: 0, + cRedShift: 0, + cGreenBits: 0, + cGreenShift: 0, + cBlueBits: 0, + cBlueShift: 0, + cAlphaBits: reqs.alpha_bits.unwrap_or(0), + cAlphaShift: 0, + cAccumBits: 0, + cAccumRedBits: 0, + cAccumGreenBits: 0, + cAccumBlueBits: 0, + cAccumAlphaBits: 0, + cDepthBits: reqs.depth_bits.unwrap_or(0), + cStencilBits: reqs.stencil_bits.unwrap_or(0), + cAuxBuffers: 0, + iLayerType: winapi::PFD_MAIN_PLANE, + bReserved: 0, + dwLayerMask: 0, + dwVisibleMask: 0, + dwDamageMask: 0, + }; + + // now querying + let pf_id = gdi32::ChoosePixelFormat(hdc, &descriptor); + if pf_id == 0 { + return Err(()); + } + + // querying back the capabilities of what windows told us + let mut output: winapi::PIXELFORMATDESCRIPTOR = mem::zeroed(); + if gdi32::DescribePixelFormat(hdc, + pf_id, + mem::size_of::() as u32, + &mut output) == 0 { + return Err(()); + } + + // windows may return us a non-conforming pixel format if none are supported, so we have to + // check this + if (output.dwFlags & winapi::PFD_DRAW_TO_WINDOW) == 0 { + return Err(()); + } + if (output.dwFlags & winapi::PFD_SUPPORT_OPENGL) == 0 { + return Err(()); + } + if output.iPixelType != winapi::PFD_TYPE_RGBA { + return Err(()); + } + + let pf_desc = PixelFormat { + hardware_accelerated: (output.dwFlags & winapi::PFD_GENERIC_FORMAT) == 0, + color_bits: output.cRedBits + output.cGreenBits + output.cBlueBits, + alpha_bits: output.cAlphaBits, + depth_bits: output.cDepthBits, + stencil_bits: output.cStencilBits, + stereoscopy: (output.dwFlags & winapi::PFD_STEREO) != 0, + double_buffer: (output.dwFlags & winapi::PFD_DOUBLEBUFFER) != 0, + multisampling: None, + srgb: false, + }; + + if pf_desc.alpha_bits < reqs.alpha_bits.unwrap_or(0) { + return Err(()); + } + if pf_desc.depth_bits < reqs.depth_bits.unwrap_or(0) { + return Err(()); + } + if pf_desc.stencil_bits < reqs.stencil_bits.unwrap_or(0) { + return Err(()); + } + if pf_desc.color_bits < reqs.color_bits.unwrap_or(0) { + return Err(()); + } + if !pf_desc.hardware_accelerated { + return Err(()); + } + if let Some(req) = reqs.double_buffer { + if pf_desc.double_buffer != req { + return Err(()); + } + } + + Ok((pf_id, pf_desc)) +} + +// Calls `SetPixelFormat` on a window. +unsafe fn set_pixel_format(hdc: winapi::HDC, id: c_int) -> Result<(), String> { + let mut output: winapi::PIXELFORMATDESCRIPTOR = mem::zeroed(); + + if gdi32::DescribePixelFormat(hdc, id, mem::size_of::() + as winapi::UINT, &mut output) == 0 { + return Err(format!("DescribePixelFormat function failed: {}",io::Error::last_os_error())); + } + + if gdi32::SetPixelFormat(hdc, id, &output) == 0 { + return Err(format!("SetPixelFormat function failed: {}", + io::Error::last_os_error())); + } + + Ok(()) +} + +// Loads the WGL functions that are not guaranteed to be supported. +// +// The `window` must be passed because the driver can vary depending on the window's +// characteristics. +unsafe fn load_extra_functions(window: winapi::HWND) -> Result { + let (ex_style, style) = (winapi::WS_EX_APPWINDOW, + winapi::WS_POPUP | winapi::WS_CLIPSIBLINGS | winapi::WS_CLIPCHILDREN); + // creating a dummy invisible window + let mut dummy_window = { + // getting the rect of the real window + let rect = { + let mut placement: winapi::WINDOWPLACEMENT = mem::zeroed(); + placement.length = mem::size_of::() as winapi::UINT; + if user32::GetWindowPlacement(window, &mut placement) == 0 { + return Err("user32::GetWindowPlacement failed".to_owned()); + } + placement.rcNormalPosition + }; + + // getting the class name of the real window + let mut class_name = [0u16; 128]; + if user32::GetClassNameW(window, class_name.as_mut_ptr(), 128) == 0 { + return Err(format!("GetClassNameW function failed: {}", + io::Error::last_os_error())); + } + + // this dummy window should match the real one enough to get the same OpenGL driver + let title = OsStr::new("Dummy") + .encode_wide() + .chain(Some(0).into_iter()) + .collect::>(); + let win = user32::CreateWindowExW(ex_style, + class_name.as_ptr(), + title.as_ptr(), + style, + winapi::CW_USEDEFAULT, + winapi::CW_USEDEFAULT, + rect.right - rect.left, + rect.bottom - rect.top, + ptr::null_mut(), + ptr::null_mut(), + kernel32::GetModuleHandleW(ptr::null()), + ptr::null_mut()); + + if win.is_null() { + return Err(format!("CreateWindowEx function failed: {}", io::Error::last_os_error())); + } + + let hdc = user32::GetDC(win); + let ctx = WGLScopedContext::new(win, hdc, ptr::null_mut()); + + if hdc.is_null() { + return Err(format!("GetDC function failed: {}", io::Error::last_os_error())); + } + + ctx + }; + + // getting the pixel format that we will use and setting it + { + let id = try!(choose_dummy_pixel_format(dummy_window.device_ctx)); + try!(set_pixel_format(dummy_window.device_ctx, id)); + } + + // creating the dummy OpenGL context and making it current + dummy_window.render_ctx = try!(create_basic_context(dummy_window.device_ctx, ptr::null_mut())).0; + if wgl::MakeCurrent(dummy_window.device_ctx as *const _, dummy_window.render_ctx as *const _) == 0 { + return Err("WGL::MakeCurrent failed before loading extra WGL functions".to_owned()); + } + + // loading the extra WGL functions + let result = wgl_ext::Wgl::load_with(|addr| { + let addr = CString::new(addr.as_bytes()).unwrap(); + let addr = addr.as_ptr(); + wgl::GetProcAddress(addr) as *const c_void + }); + + // Unbind the current context so WGLScopedContext can release resources properly + // the context to be deleted needs to be unbound. + wgl::MakeCurrent(ptr::null_mut(), ptr::null_mut()); + + Ok(result) +} + +// This function chooses a pixel format that is likely to be provided by +// the main video driver of the system. +fn choose_dummy_pixel_format(hdc: winapi::HDC) -> Result { + // building the descriptor to pass to ChoosePixelFormat + let descriptor = winapi::PIXELFORMATDESCRIPTOR { + nSize: mem::size_of::() as u16, + nVersion: 1, + dwFlags: winapi::PFD_DRAW_TO_WINDOW | winapi::PFD_SUPPORT_OPENGL | winapi::PFD_DOUBLEBUFFER, + iPixelType: winapi::PFD_TYPE_RGBA, + cColorBits: 24, + cRedBits: 0, + cRedShift: 0, + cGreenBits: 0, + cGreenShift: 0, + cBlueBits: 0, + cBlueShift: 0, + cAlphaBits: 8, + cAlphaShift: 0, + cAccumBits: 0, + cAccumRedBits: 0, + cAccumGreenBits: 0, + cAccumBlueBits: 0, + cAccumAlphaBits: 0, + cDepthBits: 24, + cStencilBits: 8, + cAuxBuffers: 0, + iLayerType: winapi::PFD_MAIN_PLANE, + bReserved: 0, + dwLayerMask: 0, + dwVisibleMask: 0, + dwDamageMask: 0, + }; + + // now querying + let pf_id = unsafe { gdi32::ChoosePixelFormat(hdc, &descriptor) }; + if pf_id == 0 { + return Err("No available pixel format"); + } + + Ok(pf_id) +} \ No newline at end of file diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_wgl/wgl_attributes.rs b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/wgl_attributes.rs new file mode 100644 index 000000000000..19834e27c317 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/wgl_attributes.rs @@ -0,0 +1,82 @@ +// Attributes to use when creating an OpenGL context. +#[derive(Clone, Debug)] +pub struct WGLAttributes { + pub opengl_es: bool, // enable or disable OpenGL ES contest + pub major_version: u32, // OpenGL major version. Set 0 to select the latest + pub minor_version: u32, // OpenGL minor version. + pub debug: bool, // Debug mode improves error information. Disabled by default. + pub vsync: bool, // Enable or disable vsync for swap_buffers. Disabled by default. + pub pixel_format: WGLPixelFormat, // Pixel format requirements +} + +impl Default for WGLAttributes { + #[inline] + fn default() -> WGLAttributes { + WGLAttributes { + opengl_es: false, + major_version: 2, + minor_version: 1, + debug: false, + vsync: false, + pixel_format: WGLPixelFormat::default(), + } + } +} + +#[derive(Clone, Debug)] +pub struct WGLPixelFormat { + // Minimum number of bits for the color buffer, excluding alpha. `None` means "don't care". + // The default is `Some(24)`. + pub color_bits: Option, + + // If true, the color buffer must be in a floating point format. Default is `false`. + // + // Using floating points allows you to write values outside of the `[0.0, 1.0]` range. + pub float_color_buffer: bool, + + // Minimum number of bits for the alpha in the color buffer. `None` means "don't care". + // The default is `Some(8)`. + pub alpha_bits: Option, + + // Minimum number of bits for the depth buffer. `None` means "don't care". + // The default value is `Some(24)`. + pub depth_bits: Option, + + // Minimum number of bits for the depth buffer. `None` means "don't care". + // The default value is `Some(8)`. + pub stencil_bits: Option, + + // If true, only double-buffered formats will be considered. If false, only single-buffer + // formats. `None` means "don't care". The default is `Some(true)`. + pub double_buffer: Option, + + // Contains the minimum number of samples per pixel in the color, depth and stencil buffers. + // `None` means "don't care". Default is `None`. + // A value of `Some(0)` indicates that multisampling must not be enabled. + pub multisampling: Option, + + // If true, only stereoscopic formats will be considered. If false, only non-stereoscopic + // formats. The default is `false`. + pub stereoscopy: bool, + + // If true, only sRGB-capable formats will be considered. If false, don't care. + // The default is `false`. + pub srgb: bool, +} + +impl Default for WGLPixelFormat { + #[inline] + fn default() -> WGLPixelFormat { + WGLPixelFormat { + color_bits: Some(24), + float_color_buffer: false, + alpha_bits: Some(8), + depth_bits: Some(24), + stencil_bits: Some(8), + double_buffer: None, + multisampling: None, + stereoscopy: false, + srgb: false, + } + } +} \ No newline at end of file diff --git a/third_party/rust/offscreen_gl_context/src/tests.rs b/third_party/rust/offscreen_gl_context/src/tests.rs new file mode 100644 index 000000000000..b6732589fa51 --- /dev/null +++ b/third_party/rust/offscreen_gl_context/src/tests.rs @@ -0,0 +1,382 @@ +use gleam::gl; +use euclid::Size2D; +use std::sync::{Once, ONCE_INIT}; + +use GLContext; +#[cfg(all(target_os = "linux", feature = "test_egl_in_linux"))] +use platform::with_egl::NativeGLContext; +#[cfg(feature="test_osmesa")] +use platform::OSMesaContext as NativeGLContext; +#[cfg(not(any(feature = "test_egl_in_linux", feature = "test_osmesa")))] +use NativeGLContext; +use NativeGLContextMethods; +use GLContextAttributes; +use ColorAttachmentType; +use std::thread; +use std::sync::mpsc; + +#[cfg(target_os="macos")] +#[link(name="OpenGL", kind="framework")] +extern {} + +#[cfg(target_os="linux")] +#[link(name="GL")] +extern {} + +static LOAD_GL: Once = ONCE_INIT; + +fn load_gl() { + LOAD_GL.call_once(|| { + gl::load_with(|s| GLContext::::get_proc_address(s) as *const _); + }); +} + +fn test_gl_context(context: &GLContext) { + context.make_current().unwrap(); + + gl::clear_color(1.0, 0.0, 0.0, 1.0); + gl::clear(gl::COLOR_BUFFER_BIT); + + let size = context.draw_buffer_size().unwrap(); + + let pixels = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + + assert!(pixels.len() == (size.width * size.height * 4) as usize); + test_pixels(&pixels); +} + +fn test_pixels_eq(pixels: &[u8], to: &[u8]) { + assert!(to.len() == 4); + for pixel in pixels.chunks(4) { + assert_eq!(pixel, to); + } + +} + +fn test_pixels(pixels: &[u8]) { + test_pixels_eq(pixels, &[255, 0, 0, 255]); +} + +#[test] +#[cfg(not(feature = "test_osmesa"))] +fn test_unbinding() { + load_gl(); + let ctx = GLContext::::new(Size2D::new(256, 256), + GLContextAttributes::default(), + ColorAttachmentType::Renderbuffer, + None).unwrap(); + + assert!(NativeGLContext::current_handle().is_some()); + + ctx.unbind().unwrap(); + assert!(NativeGLContext::current_handle().is_none()); +} + +#[test] +fn test_renderbuffer_color_attachment() { + load_gl(); + test_gl_context(&GLContext::::new(Size2D::new(256, 256), + GLContextAttributes::default(), + ColorAttachmentType::Renderbuffer, + None).unwrap()); +} + +#[test] +fn test_texture_color_attachment() { + load_gl(); + let size = Size2D::new(256, 256); + let context = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + None).unwrap(); + test_gl_context(&context); + + // Get the bound texture and check we're painting on it + let texture_id = context.borrow_draw_buffer().unwrap().get_bound_texture_id().unwrap(); + assert!(texture_id != 0); + + assert!(gl::get_error() == gl::NO_ERROR); + + // Actually we just check that writing to the framebuffer works, and that there's a texture + // attached to it. Doing a getTexImage should be a good idea, but it's not available on gles, + // so what we should do is rebinding to another FBO. + // + // This is done in the `test_sharing` test though, so if that passes we know everything + // works and we're just happy. + let vec = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + test_pixels(&vec); +} + +#[test] +fn test_sharing() { + load_gl(); + + let size = Size2D::new(256, 256); + let primary = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + None).unwrap(); + + let primary_texture_id = primary.borrow_draw_buffer().unwrap().get_bound_texture_id().unwrap(); + assert!(primary_texture_id != 0); + + let secondary = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + Some(&primary.handle())).unwrap(); + + // Paint the second context red + test_gl_context(&secondary); + + // Now the secondary context is bound, get the texture id, switch contexts, and check the + // texture is there. + let secondary_texture_id = secondary.borrow_draw_buffer().unwrap().get_bound_texture_id().unwrap(); + assert!(secondary_texture_id != 0); + + primary.make_current().unwrap(); + assert!(unsafe { gl::IsTexture(secondary_texture_id) != 0 }); + + // Clearing and re-binding to a framebuffer instead of using getTexImage since it's not + // available in GLES2 + gl::clear_color(0.0, 0.0, 0.0, 1.0); + gl::clear(gl::COLOR_BUFFER_BIT); + + let vec = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + test_pixels_eq(&vec, &[0, 0, 0, 255]); + + gl::bind_texture(gl::TEXTURE_2D, secondary_texture_id); + + unsafe { + gl::FramebufferTexture2D(gl::FRAMEBUFFER, + gl::COLOR_ATTACHMENT0, + gl::TEXTURE_2D, + secondary_texture_id, 0); + } + + let vec = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + assert!(gl::get_error() == gl::NO_ERROR); + + test_pixels(&vec); +} + +#[test] +fn test_multithread_render() { + load_gl(); + + let size = Size2D::new(256, 256); + let primary = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + None).unwrap(); + test_gl_context(&primary); + let (tx, rx) = mpsc::channel(); + let (end_tx, end_rx) = mpsc::channel(); + thread::spawn(move ||{ + //create the context in a different thread + let secondary = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + None).unwrap(); + secondary.make_current().unwrap(); + assert!(secondary.is_current()); + //render green adn test pixels + gl::clear_color(0.0, 1.0, 0.0, 1.0); + gl::clear(gl::COLOR_BUFFER_BIT); + + let vec = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + test_pixels_eq(&vec, &[0, 255, 0, 255]); + + tx.send(()).unwrap(); + + // Avoid drop until test ends + end_rx.recv().unwrap(); + }); + // Wait until thread has drawn the texture + rx.recv().unwrap(); + // This context must remain to be current in this thread + assert!(primary.is_current()); + + // The colors must remain unchanged + let vec = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + test_pixels_eq(&vec, &[255, 0, 0, 255]); + + end_tx.send(()).unwrap(); +} + +struct SGLUint(gl::GLuint); +unsafe impl Sync for SGLUint {} +unsafe impl Send for SGLUint {} + +#[test] +fn test_multithread_sharing() { + load_gl(); + + let size = Size2D::new(256, 256); + let primary = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + None).unwrap(); + primary.make_current().unwrap(); + + let primary_texture_id = primary.borrow_draw_buffer().unwrap().get_bound_texture_id().unwrap(); + assert!(primary_texture_id != 0); + + let (tx, rx) = mpsc::channel(); + let (end_tx, end_rx) = mpsc::channel(); + let primary_handle = primary.handle(); + + // Unbind required by some APIs as WGL + primary.unbind().unwrap(); + + thread::spawn(move || { + // Create the context in a different thread + let secondary = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + Some(&primary_handle)).unwrap(); + // Make the context current on this thread only + secondary.make_current().unwrap(); + // Paint the second context red + test_gl_context(&secondary); + // Send texture_id to main thread + let texture_id = secondary.borrow_draw_buffer().unwrap().get_bound_texture_id().unwrap(); + assert!(texture_id != 0); + tx.send(SGLUint(texture_id)).unwrap(); + // Avoid drop until test ends + end_rx.recv().unwrap(); + }); + // Wait until thread has drawn the texture + let secondary_texture_id = rx.recv().unwrap().0; + + primary.make_current().unwrap(); + + // Clearing and re-binding to a framebuffer instead of using getTexImage since it's not + // available in GLES2 + gl::clear_color(0.0, 0.0, 0.0, 1.0); + gl::clear(gl::COLOR_BUFFER_BIT); + + let vec = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + test_pixels_eq(&vec, &[0, 0, 0, 255]); + + + unsafe { + gl::FramebufferTexture2D(gl::FRAMEBUFFER, + gl::COLOR_ATTACHMENT0, + gl::TEXTURE_2D, + secondary_texture_id, 0); + } + + let vec = gl::read_pixels(0, 0, size.width, size.height, gl::RGBA, gl::UNSIGNED_BYTE); + assert!(gl::get_error() == gl::NO_ERROR); + + test_pixels(&vec); + end_tx.send(()).unwrap(); +} + +#[test] +fn test_limits() { + load_gl(); + + let size = Size2D::new(256, 256); + let context = GLContext::::new(size, + GLContextAttributes::default(), + ColorAttachmentType::Texture, + None).unwrap(); + assert!(context.borrow_limits().max_vertex_attribs != 0); +} + +#[test] +fn test_no_alpha() { + load_gl(); + let mut attributes = GLContextAttributes::default(); + attributes.alpha = false; + + let size = Size2D::new(256, 256); + let context = GLContext::::new(size, + attributes, + ColorAttachmentType::Texture, + None).unwrap(); + assert!(context.borrow_limits().max_vertex_attribs != 0); +} + +#[test] +fn test_no_depth() { + load_gl(); + let mut attributes = GLContextAttributes::default(); + attributes.depth = false; + + let size = Size2D::new(256, 256); + let context = GLContext::::new(size, + attributes, + ColorAttachmentType::Texture, + None).unwrap(); + assert!(context.borrow_limits().max_vertex_attribs != 0); +} + +#[test] +fn test_no_depth_no_alpha() { + load_gl(); + let mut attributes = GLContextAttributes::default(); + attributes.depth = false; + attributes.alpha = false; + + let size = Size2D::new(256, 256); + let context = GLContext::::new(size, + attributes, + ColorAttachmentType::Texture, + None).unwrap(); + assert!(context.borrow_limits().max_vertex_attribs != 0); +} + +#[test] +fn test_no_premul_alpha() { + load_gl(); + let mut attributes = GLContextAttributes::default(); + attributes.depth = false; + attributes.alpha = false; + attributes.premultiplied_alpha = false; + + let size = Size2D::new(256, 256); + let context = GLContext::::new(size, + attributes, + ColorAttachmentType::Texture, + None).unwrap(); + assert!(context.borrow_limits().max_vertex_attribs != 0); +} + +#[test] +fn test_in_a_row() { + load_gl(); + let mut attributes = GLContextAttributes::default(); + attributes.depth = false; + attributes.alpha = false; + attributes.premultiplied_alpha = false; + + let size = Size2D::new(256, 256); + let context = GLContext::::new(size, + attributes.clone(), + ColorAttachmentType::Texture, + None).unwrap(); + + let handle = context.handle(); + + GLContext::::new(size, + attributes.clone(), + ColorAttachmentType::Texture, + Some(&handle)).unwrap(); + + GLContext::::new(size, + attributes.clone(), + ColorAttachmentType::Texture, + Some(&handle)).unwrap(); +} + +#[test] +fn test_zero_size() { + load_gl(); + + GLContext::::new(Size2D::new(0, 320), + GLContextAttributes::default(), + ColorAttachmentType::Texture, + None).unwrap(); +} diff --git a/third_party/rust/osmesa-sys/.cargo-checksum.json b/third_party/rust/osmesa-sys/.cargo-checksum.json new file mode 100644 index 000000000000..5ec1e0ca5d14 --- /dev/null +++ b/third_party/rust/osmesa-sys/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"944bf600c6230664922a011cbca026699969f2f89f6c7ff689835836ccd7b1de","Cargo.toml":"fac0f95ff5391a09743ec544dc6771d85769b8a6a45fbdea6227e8b3df1978fd","README.txt":"1367c50c9a6709e7131bbea78f6ac734abb889ccf4e8c607ab20c7c3cf4a1723","lib.rs":"9e3af6d2aec558af37e73ccb36270961c85907c9b5e6460e5a1ff1c7acc7c0bd"},"package":"88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"} \ No newline at end of file diff --git a/third_party/rust/osmesa-sys/.cargo-ok b/third_party/rust/osmesa-sys/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/osmesa-sys/.gitignore b/third_party/rust/osmesa-sys/.gitignore new file mode 100644 index 000000000000..fa8d85ac52f1 --- /dev/null +++ b/third_party/rust/osmesa-sys/.gitignore @@ -0,0 +1,2 @@ +Cargo.lock +target diff --git a/third_party/rust/osmesa-sys/Cargo.toml b/third_party/rust/osmesa-sys/Cargo.toml new file mode 100644 index 000000000000..9a8706cb9d3c --- /dev/null +++ b/third_party/rust/osmesa-sys/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "osmesa-sys" +version = "0.1.2" +authors = ["Daggerbot "] +description = "OSMesa library bindings for Rust" +license = "CC0-1.0" +repository = "https://github.com/Daggerbot/osmesa-rs.git" + +[lib] +name = "osmesa_sys" +path = "lib.rs" + +[dependencies] +shared_library = "0.1" diff --git a/third_party/rust/osmesa-sys/README.txt b/third_party/rust/osmesa-sys/README.txt new file mode 100644 index 000000000000..e4038498242b --- /dev/null +++ b/third_party/rust/osmesa-sys/README.txt @@ -0,0 +1,3 @@ +osmesa-rs: Off-Screen Mesa bindings for Rust. +The OSMesa library is available under the MIT license. +These bindings are public domain. diff --git a/third_party/rust/osmesa-sys/lib.rs b/third_party/rust/osmesa-sys/lib.rs new file mode 100644 index 000000000000..c44dbf87ede7 --- /dev/null +++ b/third_party/rust/osmesa-sys/lib.rs @@ -0,0 +1,92 @@ +// osmesa-rs: Off-Screen Mesa bindings for Rust. +// The OSMesa library is available under the MIT license. +// These bindings are public domain. + +#![allow(non_snake_case)] + +#[macro_use] +extern crate shared_library; + +use std::os::raw::{ + c_char, + c_int, + c_uchar, + c_uint, + c_void, +}; + + +// +// functions +// + +#[cfg(target_os="macos")] +const LIB_NAME: &'static str = "libOSMesa.dylib"; + +#[cfg(not(target_os="macos"))] +const LIB_NAME: &'static str = "libOSMesa.so"; + +shared_library!(OsMesa, LIB_NAME, + pub fn OSMesaColorClamp (enable: c_uchar), + pub fn OSMesaCreateContext (format: c_uint, sharelist: OSMesaContext) -> OSMesaContext, + pub fn OSMesaCreateContextExt (format: c_uint, depthBits: c_int, stencilBits: c_int, accumBits: c_int, sharelist: OSMesaContext) -> OSMesaContext, + pub fn OSMesaCreateContextAttribs(attribList: *const c_int, sharelist: OSMesaContext) -> OSMesaContext, + pub fn OSMesaDestroyContext (ctx: OSMesaContext), + pub fn OSMesaGetColorBuffer (c: OSMesaContext, width: *mut c_int, height: *mut c_int, format: *mut c_int, buffer: *mut *mut c_void) -> c_uchar, + pub fn OSMesaGetCurrentContext () -> OSMesaContext, + pub fn OSMesaGetDepthBuffer (c: OSMesaContext, width: *mut c_int, height: *mut c_int, bytesPerValue: *mut c_int, buffer: *mut *mut c_void) -> c_uchar, + pub fn OSMesaGetIntegerv (pname: c_int, value: *mut c_int), + pub fn OSMesaGetProcAddress (funcName: *const c_char) -> OSMESAproc, + pub fn OSMesaMakeCurrent (ctx: OSMesaContext, buffer: *mut c_void, _type: c_uint, width: c_int, height: c_int) -> c_uchar, + pub fn OSMesaPixelStore (pname: c_int, value: c_int), +); + + +// +// types +// + + +// opaque structs +#[repr(C)] pub struct osmesa_context; + +// types +pub type OSMesaContext = *mut osmesa_context; +pub type OSMESAproc = Option; + + +// +// constants +// + + +// context formats +pub const OSMESA_BGRA: c_uint = 0x0001; +pub const OSMESA_ARGB: c_uint = 0x0002; +pub const OSMESA_BGR: c_uint = 0x0004; +pub const OSMESA_RGB_565: c_uint = 0x0005; +pub const OSMESA_COLOR_INDEX: c_uint = 0x1900; +pub const OSMESA_RGB: c_uint = 0x1907; +pub const OSMESA_RGBA: c_uint = 0x1908; + +// OSMesaGetIntegerv +pub const OSMESA_WIDTH: c_int = 0x0020; +pub const OSMESA_HEIGHT: c_int = 0x0021; +pub const OSMESA_FORMAT: c_int = 0x0022; +pub const OSMESA_TYPE: c_int = 0x0023; +pub const OSMESA_MAX_WIDTH: c_int = 0x0024; +pub const OSMESA_MAX_HEIGHT: c_int = 0x0025; + +// OSMesaPixelStore +pub const OSMESA_ROW_LENGTH: c_int = 0x0010; +pub const OSMESA_Y_UP: c_int = 0x0011; + +// OSMesaCreateContextAttribs +pub const OSMESA_DEPTH_BITS: c_int = 0x30; +pub const OSMESA_STENCIL_BITS: c_int = 0x31; +pub const OSMESA_ACCUM_BITS: c_int = 0x32; +pub const OSMESA_PROFILE: c_int = 0x33; +pub const OSMESA_CORE_PROFILE: c_int = 0x34; +pub const OSMESA_COMPAT_PROFILE: c_int = 0x35; +pub const OSMESA_CONTEXT_MAJOR_VERSION: c_int = 0x36; +pub const OSMESA_CONTEXT_MINOR_VERSION: c_int = 0x37; diff --git a/third_party/rust/quote/.cargo-checksum.json b/third_party/rust/quote/.cargo-checksum.json new file mode 100644 index 000000000000..0b9925ac587e --- /dev/null +++ b/third_party/rust/quote/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"a5da41e07bf2d8af3fda684c7adb912e98047e9fe12a8288be3d9e3a494388ca","src/ident.rs":"830077b64dce8c8ede1fb6ab664cae72f5496f4ab6be21a5b4e3b5e4e57ec425","src/lib.rs":"f799c898057a4e8e1620b32c70e13d3fee7af3a0352a5a4a1da6393942d21cc7","src/to_tokens.rs":"a871cb84506fa9e0783ac29617d686327ce5d05a9711a3a10833430b00345ccc","src/tokens.rs":"a559a56905debae32a0e7852114812cca7173341a62b277894517264a759dfa6"},"package":"e7b44fd83db28b83c1c58187159934906e5e955c812e211df413b76b03c909a5"} \ No newline at end of file diff --git a/third_party/rust/quote/.cargo-ok b/third_party/rust/quote/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/quote/Cargo.toml b/third_party/rust/quote/Cargo.toml new file mode 100644 index 000000000000..4087fbe2a679 --- /dev/null +++ b/third_party/rust/quote/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "quote" +version = "0.3.12" # don't forget to update version in readme for breaking changes +authors = ["David Tolnay "] +license = "MIT/Apache-2.0" +description = "Quasi-quoting macro quote!(...)" +repository = "https://github.com/dtolnay/quote" +documentation = "https://docs.rs/quote/" +keywords = ["syn"] +include = ["Cargo.toml", "src/**/*.rs"] diff --git a/third_party/rust/quote/src/ident.rs b/third_party/rust/quote/src/ident.rs new file mode 100644 index 000000000000..6f282116a571 --- /dev/null +++ b/third_party/rust/quote/src/ident.rs @@ -0,0 +1,57 @@ +use {Tokens, ToTokens}; +use std::borrow::Cow; +use std::fmt; + +/// An identifier that should be interpolated without quotes. +#[derive(Debug, Clone, Eq, Hash)] +pub struct Ident(String); + +impl Ident { + pub fn new>(t: T) -> Self { + t.into() + } +} + +impl<'a> From<&'a str> for Ident { + fn from(s: &str) -> Self { + Ident(s.to_owned()) + } +} + +impl<'a> From> for Ident { + fn from(s: Cow<'a, str>) -> Self { + Ident(s.into_owned()) + } +} + +impl From for Ident { + fn from(s: String) -> Self { + Ident(s) + } +} + +impl AsRef for Ident { + fn as_ref(&self) -> &str { + &self.0 + } +} + +impl fmt::Display for Ident { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + self.0.fmt(formatter) + } +} + +impl PartialEq for Ident + where T: AsRef +{ + fn eq(&self, other: &T) -> bool { + self.0 == other.as_ref() + } +} + +impl ToTokens for Ident { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(self.as_ref()) + } +} diff --git a/third_party/rust/quote/src/lib.rs b/third_party/rust/quote/src/lib.rs new file mode 100644 index 000000000000..4bc41883018d --- /dev/null +++ b/third_party/rust/quote/src/lib.rs @@ -0,0 +1,252 @@ +//! Quasi-quoting without a Syntex dependency, intended for use with [Macros +//! 1.1](https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md). +//! +//! ```toml +//! [dependencies] +//! quote = "0.3" +//! ``` +//! +//! ```rust,ignore +//! #[macro_use] +//! extern crate quote; +//! ``` +//! +//! Interpolation is done with `#var`: +//! +//! ```text +//! let tokens = quote! { +//! struct SerializeWith #generics #where_clause { +//! value: &'a #field_ty, +//! phantom: ::std::marker::PhantomData<#item_ty>, +//! } +//! +//! impl #generics serde::Serialize for SerializeWith #generics #where_clause { +//! fn serialize(&self, s: &mut S) -> Result<(), S::Error> +//! where S: serde::Serializer +//! { +//! #path(self.value, s) +//! } +//! } +//! +//! SerializeWith { +//! value: #value, +//! phantom: ::std::marker::PhantomData::<#item_ty>, +//! } +//! }; +//! ``` +//! +//! Repetition is done using `#(...)*` or `#(...),*` very similar to `macro_rules!`: +//! +//! - `#(#var)*` - no separators +//! - `#(#var),*` - the character before the asterisk is used as a separator +//! - `#( struct #var; )*` - the repetition can contain other things +//! - `#( #k => println!("{}", #v), )*` - even multiple interpolations +//! +//! The return type of `quote!` is `quote::Tokens`. Tokens can be interpolated into +//! other quotes: +//! +//! ```text +//! let t = quote! { /* ... */ }; +//! return quote! { /* ... */ #t /* ... */ }; +//! ``` +//! +//! Call `to_string()` or `as_str()` on a Tokens to get a `String` or `&str` of Rust +//! code. +//! +//! The `quote!` macro relies on deep recursion so some large invocations may fail +//! with "recursion limit reached" when you compile. If it fails, bump up the +//! recursion limit by adding `#![recursion_limit = "128"]` to your crate. An even +//! higher limit may be necessary for especially large invocations. + +mod tokens; +pub use tokens::Tokens; + +mod to_tokens; +pub use to_tokens::{ToTokens, ByteStr, Hex}; + +mod ident; +pub use ident::Ident; + +/// The whole point. +#[macro_export] +macro_rules! quote { + () => { + $crate::Tokens::new() + }; + + ($($tt:tt)+) => { + { + let mut _s = $crate::Tokens::new(); + quote_each_token!(_s $($tt)*); + _s + } + }; +} + +// Extract the names of all #metavariables and pass them to the $finish macro. +// +// in: pounded_var_names!(then () a #b c #( #d )* #e) +// out: then!(() b d e) +#[macro_export] +#[doc(hidden)] +macro_rules! pounded_var_names { + ($finish:ident ($($found:ident)*) # ( $($inner:tt)* ) $($rest:tt)*) => { + pounded_var_names!($finish ($($found)*) $($inner)* $($rest)*) + }; + + ($finish:ident ($($found:ident)*) # [ $($inner:tt)* ] $($rest:tt)*) => { + pounded_var_names!($finish ($($found)*) $($inner)* $($rest)*) + }; + + ($finish:ident ($($found:ident)*) # { $($inner:tt)* } $($rest:tt)*) => { + pounded_var_names!($finish ($($found)*) $($inner)* $($rest)*) + }; + + ($finish:ident ($($found:ident)*) # $first:ident $($rest:tt)*) => { + pounded_var_names!($finish ($($found)* $first) $($rest)*) + }; + + ($finish:ident ($($found:ident)*) ( $($inner:tt)* ) $($rest:tt)*) => { + pounded_var_names!($finish ($($found)*) $($inner)* $($rest)*) + }; + + ($finish:ident ($($found:ident)*) [ $($inner:tt)* ] $($rest:tt)*) => { + pounded_var_names!($finish ($($found)*) $($inner)* $($rest)*) + }; + + ($finish:ident ($($found:ident)*) { $($inner:tt)* } $($rest:tt)*) => { + pounded_var_names!($finish ($($found)*) $($inner)* $($rest)*) + }; + + ($finish:ident ($($found:ident)*) $ignore:tt $($rest:tt)*) => { + pounded_var_names!($finish ($($found)*) $($rest)*) + }; + + ($finish:ident ($($found:ident)*)) => { + $finish!(() $($found)*) + }; +} + +// in: nested_tuples_pat!(() a b c d e) +// out: ((((a b) c) d) e) +// +// in: nested_tuples_pat!(() a) +// out: a +#[macro_export] +#[doc(hidden)] +macro_rules! nested_tuples_pat { + (()) => { + &() + }; + + (() $first:ident $($rest:ident)*) => { + nested_tuples_pat!(($first) $($rest)*) + }; + + (($pat:pat) $first:ident $($rest:ident)*) => { + nested_tuples_pat!((($pat, $first)) $($rest)*) + }; + + (($done:pat)) => { + $done + }; +} + +// in: multi_zip_expr!(() a b c d e) +// out: a.into_iter().zip(b).zip(c).zip(d).zip(e) +// +// in: multi_zip_iter!(() a) +// out: a +#[macro_export] +#[doc(hidden)] +macro_rules! multi_zip_expr { + (()) => { + &[] + }; + + (() $single:ident) => { + $single + }; + + (() $first:ident $($rest:ident)*) => { + multi_zip_expr!(($first.into_iter()) $($rest)*) + }; + + (($zips:expr) $first:ident $($rest:ident)*) => { + multi_zip_expr!(($zips.zip($first)) $($rest)*) + }; + + (($done:expr)) => { + $done + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! quote_each_token { + ($tokens:ident) => {}; + + ($tokens:ident # ! $($rest:tt)*) => { + $tokens.append("#"); + $tokens.append("!"); + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident # ( $($inner:tt)* ) * $($rest:tt)*) => { + for pounded_var_names!(nested_tuples_pat () $($inner)*) + in pounded_var_names!(multi_zip_expr () $($inner)*) { + quote_each_token!($tokens $($inner)*); + } + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident # ( $($inner:tt)* ) $sep:tt * $($rest:tt)*) => { + for (_i, pounded_var_names!(nested_tuples_pat () $($inner)*)) + in pounded_var_names!(multi_zip_expr () $($inner)*).into_iter().enumerate() { + if _i > 0 { + $tokens.append(stringify!($sep)); + } + quote_each_token!($tokens $($inner)*); + } + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident # [ $($inner:tt)* ] $($rest:tt)*) => { + $tokens.append("#"); + $tokens.append("["); + quote_each_token!($tokens $($inner)*); + $tokens.append("]"); + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident # $first:ident $($rest:tt)*) => { + $crate::ToTokens::to_tokens(&$first, &mut $tokens); + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident ( $($first:tt)* ) $($rest:tt)*) => { + $tokens.append("("); + quote_each_token!($tokens $($first)*); + $tokens.append(")"); + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident [ $($first:tt)* ] $($rest:tt)*) => { + $tokens.append("["); + quote_each_token!($tokens $($first)*); + $tokens.append("]"); + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident { $($first:tt)* } $($rest:tt)*) => { + $tokens.append("{"); + quote_each_token!($tokens $($first)*); + $tokens.append("}"); + quote_each_token!($tokens $($rest)*); + }; + + ($tokens:ident $first:tt $($rest:tt)*) => { + $tokens.append(stringify!($first)); + quote_each_token!($tokens $($rest)*); + }; +} diff --git a/third_party/rust/quote/src/to_tokens.rs b/third_party/rust/quote/src/to_tokens.rs new file mode 100644 index 000000000000..099f0f9b60da --- /dev/null +++ b/third_party/rust/quote/src/to_tokens.rs @@ -0,0 +1,357 @@ +use super::Tokens; + +use std::borrow::Cow; + +/// Types that can be interpolated inside a `quote!(...)` invocation. +pub trait ToTokens { + /// Write `self` to the given `Tokens`. + /// + /// Example implementation for a struct representing Rust paths like + /// `std::cmp::PartialEq`: + /// + /// ```ignore + /// pub struct Path { + /// pub global: bool, + /// pub segments: Vec, + /// } + /// + /// impl ToTokens for Path { + /// fn to_tokens(&self, tokens: &mut Tokens) { + /// for (i, segment) in self.segments.iter().enumerate() { + /// if i > 0 || self.global { + /// tokens.append("::"); + /// } + /// segment.to_tokens(tokens); + /// } + /// } + /// } + /// ``` + fn to_tokens(&self, &mut Tokens); +} + +impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T { + fn to_tokens(&self, tokens: &mut Tokens) { + (**self).to_tokens(tokens); + } +} + +impl<'a, T: ?Sized + ToOwned + ToTokens> ToTokens for Cow<'a, T> { + fn to_tokens(&self, tokens: &mut Tokens) { + (**self).to_tokens(tokens); + } +} + +impl ToTokens for Box { + fn to_tokens(&self, tokens: &mut Tokens) { + (**self).to_tokens(tokens); + } +} + +impl ToTokens for Option { + fn to_tokens(&self, tokens: &mut Tokens) { + if let Some(ref t) = *self { + t.to_tokens(tokens); + } + } +} + +impl ToTokens for str { + fn to_tokens(&self, tokens: &mut Tokens) { + let mut escaped = "\"".to_string(); + for ch in self.chars() { + match ch { + '\0' => escaped.push_str(r"\0"), + '\'' => escaped.push_str("'"), + _ => escaped.extend(ch.escape_default().map(|c| c as char)), + } + } + escaped.push('"'); + + tokens.append(&escaped); + } +} + +impl ToTokens for String { + fn to_tokens(&self, tokens: &mut Tokens) { + self.as_str().to_tokens(tokens); + } +} + +impl ToTokens for char { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + '\0' => tokens.append(r"'\0'"), + '"' => tokens.append("'\"'"), + _ => tokens.append(&format!("{:?}", self)), + } + } +} + +/// Wrap a `&str` so it interpolates as a byte-string: `b"abc"`. +#[derive(Debug)] +pub struct ByteStr<'a>(pub &'a str); + +impl<'a> ToTokens for ByteStr<'a> { + fn to_tokens(&self, tokens: &mut Tokens) { + let mut escaped = "b\"".to_string(); + for b in self.0.bytes() { + match b { + b'\0' => escaped.push_str(r"\0"), + b'\t' => escaped.push_str(r"\t"), + b'\n' => escaped.push_str(r"\n"), + b'\r' => escaped.push_str(r"\r"), + b'"' => escaped.push_str("\\\""), + b'\\' => escaped.push_str("\\\\"), + b'\x20' ... b'\x7E' => escaped.push(b as char), + _ => escaped.push_str(&format!("\\x{:02X}", b)), + } + } + escaped.push('"'); + + tokens.append(&escaped); + } +} + +macro_rules! impl_to_tokens_display { + ($ty:ty) => { + impl ToTokens for $ty { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(&self.to_string()); + } + } + }; +} + +impl_to_tokens_display!(Tokens); +impl_to_tokens_display!(bool); + +/// Wrap an integer so it interpolates as a hexadecimal. +#[derive(Debug)] +pub struct Hex(pub T); + +macro_rules! impl_to_tokens_integer { + ($ty:ty) => { + impl ToTokens for $ty { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(&format!(concat!("{}", stringify!($ty)), self)); + } + } + + impl ToTokens for Hex<$ty> { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(&format!(concat!("0x{:X}", stringify!($ty)), self.0)); + } + } + }; +} + +impl_to_tokens_integer!(i8); +impl_to_tokens_integer!(i16); +impl_to_tokens_integer!(i32); +impl_to_tokens_integer!(i64); +impl_to_tokens_integer!(isize); +impl_to_tokens_integer!(u8); +impl_to_tokens_integer!(u16); +impl_to_tokens_integer!(u32); +impl_to_tokens_integer!(u64); +impl_to_tokens_integer!(usize); + +macro_rules! impl_to_tokens_floating { + ($ty:ty) => { + impl ToTokens for $ty { + fn to_tokens(&self, tokens: &mut Tokens) { + use std::num::FpCategory::*; + match self.classify() { + Zero | Subnormal | Normal => { + tokens.append(&format!(concat!("{}", stringify!($ty)), self)); + } + Nan => { + tokens.append("::"); + tokens.append("std"); + tokens.append("::"); + tokens.append(stringify!($ty)); + tokens.append("::"); + tokens.append("NAN"); + } + Infinite => { + tokens.append("::"); + tokens.append("std"); + tokens.append("::"); + tokens.append(stringify!($ty)); + tokens.append("::"); + if self.is_sign_positive() { + tokens.append("INFINITY"); + } else { + tokens.append("NEG_INFINITY"); + } + } + } + } + } + }; +} +impl_to_tokens_floating!(f32); +impl_to_tokens_floating!(f64); + +impl ToTokens for [T] { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append("["); + for item in self { + item.to_tokens(tokens); + tokens.append(","); + } + tokens.append("]"); + } +} + +impl ToTokens for Vec { + fn to_tokens(&self, tokens: &mut Tokens) { + self[..].to_tokens(tokens) + } +} + +macro_rules! array_impls { + ($($N:expr)+) => { + $( + impl ToTokens for [T; $N] { + fn to_tokens(&self, tokens: &mut Tokens) { + self[..].to_tokens(tokens) + } + } + )+ + } +} + +array_impls! { + 0 1 2 3 4 5 6 7 8 9 + 10 11 12 13 14 15 16 17 18 19 + 20 21 22 23 24 25 26 27 28 29 + 30 31 32 +} + +macro_rules! tuple_impls { + ($( + $Tuple:ident { + $(($idx:tt) -> $T:ident)* + } + )+) => { + $( + impl<$($T: ToTokens),*> ToTokens for ($($T,)*) { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append("("); + $( + self.$idx.to_tokens(tokens); + tokens.append(","); + )* + tokens.append(")"); + } + } + )+ + } +} + +tuple_impls! { + Tuple0 {} + Tuple1 { + (0) -> A + } + Tuple2 { + (0) -> A + (1) -> B + } + Tuple3 { + (0) -> A + (1) -> B + (2) -> C + } + Tuple4 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + } + Tuple5 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + } + Tuple6 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + (5) -> F + } + Tuple7 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + (5) -> F + (6) -> G + } + Tuple8 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + (5) -> F + (6) -> G + (7) -> H + } + Tuple9 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + (5) -> F + (6) -> G + (7) -> H + (8) -> I + } + Tuple10 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + (5) -> F + (6) -> G + (7) -> H + (8) -> I + (9) -> J + } + Tuple11 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + (5) -> F + (6) -> G + (7) -> H + (8) -> I + (9) -> J + (10) -> K + } + Tuple12 { + (0) -> A + (1) -> B + (2) -> C + (3) -> D + (4) -> E + (5) -> F + (6) -> G + (7) -> H + (8) -> I + (9) -> J + (10) -> K + (11) -> L + } +} diff --git a/third_party/rust/quote/src/tokens.rs b/third_party/rust/quote/src/tokens.rs new file mode 100644 index 000000000000..414183807975 --- /dev/null +++ b/third_party/rust/quote/src/tokens.rs @@ -0,0 +1,150 @@ +use super::ToTokens; +use std::fmt::{self, Display}; +use std::str::FromStr; + +/// Tokens produced by a `quote!(...)` invocation. +#[derive(Debug, Clone, Eq, PartialEq)] +pub struct Tokens(String); + +impl Tokens { + /// Empty tokens. + pub fn new() -> Self { + Tokens(String::new()) + } + + /// For use by `ToTokens` implementations. + /// + /// ``` + /// # #[macro_use] extern crate quote; + /// # use quote::{Tokens, ToTokens}; + /// # fn main() { + /// struct X; + /// + /// impl ToTokens for X { + /// fn to_tokens(&self, tokens: &mut Tokens) { + /// tokens.append("a"); + /// tokens.append("b"); + /// tokens.append("c"); + /// } + /// } + /// + /// let x = X; + /// let tokens = quote!(#x); + /// assert_eq!(tokens.as_str(), "a b c"); + /// # } + /// ``` + pub fn append(&mut self, token: &str) { + if !self.0.is_empty() && !token.is_empty() { + self.0.push(' '); + } + self.0.push_str(token); + } + + /// For use by `ToTokens` implementations. + /// + /// ``` + /// # #[macro_use] extern crate quote; + /// # use quote::{Tokens, ToTokens}; + /// # fn main() { + /// struct X; + /// + /// impl ToTokens for X { + /// fn to_tokens(&self, tokens: &mut Tokens) { + /// tokens.append_all(&[true, false]); + /// } + /// } + /// + /// let x = X; + /// let tokens = quote!(#x); + /// assert_eq!(tokens.as_str(), "true false"); + /// # } + /// ``` + pub fn append_all(&mut self, iter: I) + where T: ToTokens, + I: IntoIterator + { + for token in iter { + token.to_tokens(self); + } + } + + /// For use by `ToTokens` implementations. + /// + /// ``` + /// # #[macro_use] extern crate quote; + /// # use quote::{Tokens, ToTokens}; + /// # fn main() { + /// struct X; + /// + /// impl ToTokens for X { + /// fn to_tokens(&self, tokens: &mut Tokens) { + /// tokens.append_separated(&[true, false], ","); + /// } + /// } + /// + /// let x = X; + /// let tokens = quote!(#x); + /// assert_eq!(tokens.as_str(), "true , false"); + /// # } + /// ``` + pub fn append_separated(&mut self, iter: I, sep: &str) + where T: ToTokens, + I: IntoIterator + { + for (i, token) in iter.into_iter().enumerate() { + if i > 0 { + self.append(sep); + } + token.to_tokens(self); + } + } + + /// For use by `ToTokens` implementations. + /// + /// ``` + /// # #[macro_use] extern crate quote; + /// # use quote::{Tokens, ToTokens}; + /// # fn main() { + /// struct X; + /// + /// impl ToTokens for X { + /// fn to_tokens(&self, tokens: &mut Tokens) { + /// tokens.append_terminated(&[true, false], ","); + /// } + /// } + /// + /// let x = X; + /// let tokens = quote!(#x); + /// assert_eq!(tokens.as_str(), "true , false ,"); + /// # } + /// ``` + pub fn append_terminated(&mut self, iter: I, term: &str) + where T: ToTokens, + I: IntoIterator + { + for token in iter { + token.to_tokens(self); + self.append(term); + } + } + + pub fn as_str(&self) -> &str { + &self.0 + } + + pub fn parse(&self) -> Result { + FromStr::from_str(&self.0) + } +} + +impl Default for Tokens { + fn default() -> Self { + Tokens::new() + } +} + +impl Display for Tokens { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + self.0.fmt(formatter) + } +} diff --git a/third_party/rust/redox_syscall/.cargo-checksum.json b/third_party/rust/redox_syscall/.cargo-checksum.json new file mode 100644 index 000000000000..bec9f6188d3c --- /dev/null +++ b/third_party/rust/redox_syscall/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"944bf600c6230664922a011cbca026699969f2f89f6c7ff689835836ccd7b1de","Cargo.toml":"e1423d4f80dd1b358812a9993312cf6338df844c2b15e423ab779bf914cead14","src/arch/arm.rs":"0cd845b3790f7358b5290b58163ae2663b46b7ecf64eb8c6b0a29b33da6f143c","src/arch/x86.rs":"3fc9757cbb775bd08da9999ab39d95b62b3cb509e0ab309dd26c11c3fbdbc778","src/arch/x86_64.rs":"37bc2c6e74c009ff5f2896b249fac7ddf9f5e30e223a5122a28a93cef5ba33b1","src/call.rs":"7913da5b7d8b11e290d863d6cbca17be20c98bef420ddb964519a9c9cfeff366","src/data.rs":"c3406d581387828b6fb246bea2b57582cef890cedeb2c0e632e472cd3776d884","src/error.rs":"b23c12db8cafb64f3b909a95bdd47cf03f62f6fa1201b40892febf46ec56bcb4","src/flag.rs":"400c91c57b1ab1afd6ab06c0582b1b0817590688900882de31fc3a4aab27da49","src/io/dma.rs":"4ab65016b3bc9121f0844dc4b8de77608eba327c0e0d930900254242b2c204b0","src/io/io.rs":"1bcb36d1867e9bab6a8186cd6928efe70ae2655e9f9d0dd3def20bc0fb6a82f6","src/io/mmio.rs":"bd475c815d483cc2b187348c32e10f94df0ca756ee8d14260b6ca3c660b2a73a","src/io/mod.rs":"4df12af3e82e6b5fe22112c9f51552112ee4811b7d1131d2a43d608d8d1cac09","src/io/pio.rs":"219fcd317d6c490a14794ec4db9de3e305c722dda720043c67076bda60632bb8","src/lib.rs":"988fb0b0bd3b396345f11ef46617072aeaf9307d3fa05a4d2a2ee9d590598bba","src/number.rs":"9043372ef517ecbbca776536efa3d7a822ba6f49d29c20d4c3648f0e3c85fe35","src/scheme.rs":"3281173d9a5d7d420f5dbdaed7562ba5adc1ce5753843a3bf3eecf4060eb09c2"},"package":"8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753"} \ No newline at end of file diff --git a/third_party/rust/redox_syscall/.cargo-ok b/third_party/rust/redox_syscall/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/redox_syscall/.gitignore b/third_party/rust/redox_syscall/.gitignore new file mode 100644 index 000000000000..fa8d85ac52f1 --- /dev/null +++ b/third_party/rust/redox_syscall/.gitignore @@ -0,0 +1,2 @@ +Cargo.lock +target diff --git a/third_party/rust/redox_syscall/Cargo.toml b/third_party/rust/redox_syscall/Cargo.toml new file mode 100644 index 000000000000..5d90df493130 --- /dev/null +++ b/third_party/rust/redox_syscall/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "redox_syscall" +version = "0.1.16" +description = "A Rust library to access raw Redox system calls" +license = "MIT" +authors = ["Jeremy Soller "] + +[lib] +name = "syscall" diff --git a/third_party/rust/redox_syscall/src/arch/arm.rs b/third_party/rust/redox_syscall/src/arch/arm.rs new file mode 100644 index 000000000000..9e4dd082bdf5 --- /dev/null +++ b/third_party/rust/redox_syscall/src/arch/arm.rs @@ -0,0 +1,72 @@ +use error::{Error, Result}; + +pub unsafe fn syscall0(mut a: usize) -> Result { + asm!("swi $$0" + : "={r0}"(a) + : "{r7}"(a) + : "memory" + : "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall1(mut a: usize, b: usize) -> Result { + asm!("swi $$0" + : "={r0}"(a) + : "{r7}"(a), "{r0}"(b) + : "memory" + : "volatile"); + + Error::demux(a) +} + +// Clobbers all registers - special for clone +pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result { + asm!("swi $$0" + : "={r0}"(a) + : "{r7}"(a), "{r0}"(b) + : "memory", "r0", "r1", "r2", "r3", "r4" + : "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result { + asm!("swi $$0" + : "={r0}"(a) + : "{r7}"(a), "{r0}"(b), "{r1}"(c) + : "memory" + : "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result { + asm!("swi $$0" + : "={r0}"(a) + : "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d) + : "memory" + : "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) -> Result { + asm!("swi $$0" + : "={r0}"(a) + : "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d), "{r3}"(e) + : "memory" + : "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result { + asm!("swi $$0" + : "={r0}"(a) + : "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d), "{r3}"(e), "{r4}"(f) + : "memory" + : "volatile"); + + Error::demux(a) +} diff --git a/third_party/rust/redox_syscall/src/arch/x86.rs b/third_party/rust/redox_syscall/src/arch/x86.rs new file mode 100644 index 000000000000..3196189cf24e --- /dev/null +++ b/third_party/rust/redox_syscall/src/arch/x86.rs @@ -0,0 +1,72 @@ +use error::{Error, Result}; + +pub unsafe fn syscall0(mut a: usize) -> Result { + asm!("int 0x80" + : "={eax}"(a) + : "{eax}"(a) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall1(mut a: usize, b: usize) -> Result { + asm!("int 0x80" + : "={eax}"(a) + : "{eax}"(a), "{ebx}"(b) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +// Clobbers all registers - special for clone +pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result { + asm!("int 0x80" + : "={eax}"(a) + : "{eax}"(a), "{ebx}"(b) + : "memory", "ebx", "ecx", "edx", "esi", "edi" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result { + asm!("int 0x80" + : "={eax}"(a) + : "{eax}"(a), "{ebx}"(b), "{ecx}"(c) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result { + asm!("int 0x80" + : "={eax}"(a) + : "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) -> Result { + asm!("int 0x80" + : "={eax}"(a) + : "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d), "{esi}"(e) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result { + asm!("int 0x80" + : "={eax}"(a) + : "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d), "{esi}"(e), "{edi}"(f) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} diff --git a/third_party/rust/redox_syscall/src/arch/x86_64.rs b/third_party/rust/redox_syscall/src/arch/x86_64.rs new file mode 100644 index 000000000000..84d576917670 --- /dev/null +++ b/third_party/rust/redox_syscall/src/arch/x86_64.rs @@ -0,0 +1,72 @@ +use error::{Error, Result}; + +pub unsafe fn syscall0(mut a: usize) -> Result { + asm!("int 0x80" + : "={rax}"(a) + : "{rax}"(a) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall1(mut a: usize, b: usize) -> Result { + asm!("int 0x80" + : "={rax}"(a) + : "{rax}"(a), "{rbx}"(b) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +// Clobbers all registers - special for clone +pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result { + asm!("int 0x80" + : "={rax}"(a) + : "{rax}"(a), "{rbx}"(b) + : "memory", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result { + asm!("int 0x80" + : "={rax}"(a) + : "{rax}"(a), "{rbx}"(b), "{rcx}"(c) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result { + asm!("int 0x80" + : "={rax}"(a) + : "{rax}"(a), "{rbx}"(b), "{rcx}"(c), "{rdx}"(d) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) -> Result { + asm!("int 0x80" + : "={rax}"(a) + : "{rax}"(a), "{rbx}"(b), "{rcx}"(c), "{rdx}"(d), "{rsi}"(e) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} + +pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result { + asm!("int 0x80" + : "={rax}"(a) + : "{rax}"(a), "{rbx}"(b), "{rcx}"(c), "{rdx}"(d), "{rsi}"(e), "{rdi}"(f) + : "memory" + : "intel", "volatile"); + + Error::demux(a) +} diff --git a/third_party/rust/redox_syscall/src/call.rs b/third_party/rust/redox_syscall/src/call.rs new file mode 100644 index 000000000000..80c3529bb9db --- /dev/null +++ b/third_party/rust/redox_syscall/src/call.rs @@ -0,0 +1,292 @@ +use super::arch::*; +use super::data::{Stat, StatVfs, TimeSpec}; +use super::error::Result; +use super::number::*; + +use core::mem; + +/// Set the end of the process's heap +/// +/// When `addr` is `0`, this function will return the current break. +/// +/// When `addr` is nonzero, this function will attempt to set the end of the process's +/// heap to `addr` and return the new program break. The new program break should be +/// checked by the allocator, it may not be exactly `addr`, as it may be aligned to a page +/// boundary. +/// +/// On error, `Err(ENOMEM)` will be returned indicating that no memory is available +pub unsafe fn brk(addr: usize) -> Result { + syscall1(SYS_BRK, addr) +} + +/// Change the process's working directory +/// +/// This function will attempt to set the process's working directory to `path`, which can be +/// either a relative, scheme relative, or absolute path. +/// +/// On success, `Ok(0)` will be returned. On error, one of the following errors will be returned. +/// +/// # Errors +/// +/// * `EACCES` - permission is denied for one of the components of `path`, or `path` +/// * `EFAULT` - `path` does not point to the process's addressible memory +/// * `EIO` - an I/O error occured +/// * `ENOENT` - `path` does not exit +/// * `ENOTDIR` - `path` is not a directory +pub fn chdir(path: &str) -> Result { + unsafe { syscall2(SYS_CHDIR, path.as_ptr() as usize, path.len()) } +} + +pub fn chmod(path: &str, mode: usize) -> Result { + unsafe { syscall3(SYS_CHMOD, path.as_ptr() as usize, path.len(), mode) } +} + +/// Produce a fork of the current process, or a new process thread +pub unsafe fn clone(flags: usize) -> Result { + syscall1_clobber(SYS_CLONE, flags) +} + +/// Close a file +pub fn close(fd: usize) -> Result { + unsafe { syscall1(SYS_CLOSE, fd) } +} + +/// Get the current system time +pub fn clock_gettime(clock: usize, tp: &mut TimeSpec) -> Result { + unsafe { syscall2(SYS_CLOCK_GETTIME, clock, tp as *mut TimeSpec as usize) } +} + +/// Copy and transform a file descriptor +pub fn dup(fd: usize, buf: &[u8]) -> Result { + unsafe { syscall3(SYS_DUP, fd, buf.as_ptr() as usize, buf.len()) } +} + +/// Copy and transform a file descriptor +pub fn dup2(fd: usize, newfd: usize, buf: &[u8]) -> Result { + unsafe { syscall4(SYS_DUP2, fd, newfd, buf.as_ptr() as usize, buf.len()) } +} + +/// Replace the current process with a new executable +pub fn execve(path: &str, args: &[[usize; 2]]) -> Result { + unsafe { syscall4(SYS_EXECVE, path.as_ptr() as usize, path.len(), args.as_ptr() as usize, args.len()) } +} + +/// Exit the current process +pub fn exit(status: usize) -> Result { + unsafe { syscall1(SYS_EXIT, status) } +} + +/// Register a file for event-based I/O +pub fn fcntl(fd: usize, cmd: usize, arg: usize) -> Result { + unsafe { syscall3(SYS_FCNTL, fd, cmd, arg) } +} + +/// Register a file for event-based I/O +pub fn fevent(fd: usize, flags: usize) -> Result { + unsafe { syscall2(SYS_FEVENT, fd, flags) } +} + +/// Map a file into memory +pub unsafe fn fmap(fd: usize, offset: usize, size: usize) -> Result { + syscall3(SYS_FMAP, fd, offset, size) +} + +/// Unmap a memory-mapped file +pub unsafe fn funmap(addr: usize) -> Result { + syscall1(SYS_FUNMAP, addr) +} + +/// Retrieve the canonical path of a file +pub fn fpath(fd: usize, buf: &mut [u8]) -> Result { + unsafe { syscall3(SYS_FPATH, fd, buf.as_mut_ptr() as usize, buf.len()) } +} + +/// Get metadata about a file +pub fn fstat(fd: usize, stat: &mut Stat) -> Result { + unsafe { syscall3(SYS_FSTAT, fd, stat as *mut Stat as usize, mem::size_of::()) } +} + +/// Get metadata about a filesystem +pub fn fstatvfs(fd: usize, stat: &mut StatVfs) -> Result { + unsafe { syscall3(SYS_FSTATVFS, fd, stat as *mut StatVfs as usize, mem::size_of::()) } +} + +/// Sync a file descriptor to its underlying medium +pub fn fsync(fd: usize) -> Result { + unsafe { syscall1(SYS_FSYNC, fd) } +} + +/// Truncate or extend a file to a specified length +pub fn ftruncate(fd: usize, len: usize) -> Result { + unsafe { syscall2(SYS_FTRUNCATE, fd, len) } +} + +/// Fast userspace mutex - TODO: Document +pub unsafe fn futex(addr: *mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32) -> Result { + syscall5(SYS_FUTEX, addr as usize, op, (val as isize) as usize, val2, addr2 as usize) +} + +/// Get the current working directory +pub fn getcwd(buf: &mut [u8]) -> Result { + unsafe { syscall2(SYS_GETCWD, buf.as_mut_ptr() as usize, buf.len()) } +} + +/// Get the effective group ID +pub fn getegid() -> Result { + unsafe { syscall0(SYS_GETEGID) } +} + +/// Get the effective namespace +pub fn getens() -> Result { + unsafe { syscall0(SYS_GETENS) } +} + +/// Get the effective user ID +pub fn geteuid() -> Result { + unsafe { syscall0(SYS_GETEUID) } +} + +/// Get the current group ID +pub fn getgid() -> Result { + unsafe { syscall0(SYS_GETGID) } +} + +/// Get the current namespace +pub fn getns() -> Result { + unsafe { syscall0(SYS_GETNS) } +} + +/// Get the current process ID +pub fn getpid() -> Result { + unsafe { syscall0(SYS_GETPID) } +} + +/// Get the current user ID +pub fn getuid() -> Result { + unsafe { syscall0(SYS_GETUID) } +} + +/// Set the I/O privilege level +pub unsafe fn iopl(level: usize) -> Result { + syscall1(SYS_IOPL, level) +} + +/// Send a signal `sig` to the process identified by `pid` +pub fn kill(pid: usize, sig: usize) -> Result { + unsafe { syscall2(SYS_KILL, pid, sig) } +} + +/// Create a link to a file +pub unsafe fn link(old: *const u8, new: *const u8) -> Result { + syscall2(SYS_LINK, old as usize, new as usize) +} + +/// Seek to `offset` bytes in a file descriptor +pub fn lseek(fd: usize, offset: isize, whence: usize) -> Result { + unsafe { syscall3(SYS_LSEEK, fd, offset as usize, whence) } +} + +/// Make a new scheme namespace +pub fn mkns(schemes: &[[usize; 2]]) -> Result { + unsafe { syscall2(SYS_MKNS, schemes.as_ptr() as usize, schemes.len()) } +} + +/// Sleep for the time specified in `req` +pub fn nanosleep(req: &TimeSpec, rem: &mut TimeSpec) -> Result { + unsafe { syscall2(SYS_NANOSLEEP, req as *const TimeSpec as usize, rem as *mut TimeSpec as usize) } +} + +/// Open a file +pub fn open(path: &str, flags: usize) -> Result { + unsafe { syscall3(SYS_OPEN, path.as_ptr() as usize, path.len(), flags) } +} + +/// Allocate pages, linearly in physical memory +pub unsafe fn physalloc(size: usize) -> Result { + syscall1(SYS_PHYSALLOC, size) +} + +/// Free physically allocated pages +pub unsafe fn physfree(physical_address: usize, size: usize) -> Result { + syscall2(SYS_PHYSFREE, physical_address, size) +} + +/// Map physical memory to virtual memory +pub unsafe fn physmap(physical_address: usize, size: usize, flags: usize) -> Result { + syscall3(SYS_PHYSMAP, physical_address, size, flags) +} + +/// Unmap previously mapped physical memory +pub unsafe fn physunmap(virtual_address: usize) -> Result { + syscall1(SYS_PHYSUNMAP, virtual_address) +} + +/// Create a pair of file descriptors referencing the read and write ends of a pipe +pub fn pipe2(fds: &mut [usize; 2], flags: usize) -> Result { + unsafe { syscall2(SYS_PIPE2, fds.as_ptr() as usize, flags) } +} + +/// Read from a file descriptor into a buffer +pub fn read(fd: usize, buf: &mut [u8]) -> Result { + unsafe { syscall3(SYS_READ, fd, buf.as_mut_ptr() as usize, buf.len()) } +} + +/// Remove a directory +pub fn rmdir(path: &str) -> Result { + unsafe { syscall2(SYS_RMDIR, path.as_ptr() as usize, path.len()) } +} + +/// Set the current process group IDs +pub fn setregid(rgid: usize, egid: usize) -> Result { + unsafe { syscall2(SYS_SETREGID, rgid, egid) } +} + +/// Make a new scheme namespace +pub fn setrens(rns: usize, ens: usize) -> Result { + unsafe { syscall2(SYS_SETRENS, rns, ens) } +} + +/// Set the current process user IDs +pub fn setreuid(ruid: usize, euid: usize) -> Result { + unsafe { syscall2(SYS_SETREUID, ruid, euid) } +} + +/// Remove a file +pub fn unlink(path: &str) -> Result { + unsafe { syscall2(SYS_UNLINK, path.as_ptr() as usize, path.len()) } +} + +/// Convert a virtual address to a physical one +pub unsafe fn virttophys(virtual_address: usize) -> Result { + syscall1(SYS_VIRTTOPHYS, virtual_address) +} + +/// Check if a child process has exited or received a signal +pub fn waitpid(pid: usize, status: &mut usize, options: usize) -> Result { + unsafe { syscall3(SYS_WAITPID, pid, status as *mut usize as usize, options) } +} + +/// Write a buffer to a file descriptor +/// +/// The kernel will attempt to write the bytes in `buf` to the file descriptor `fd`, returning +/// either an `Err`, explained below, or `Ok(count)` where `count` is the number of bytes which +/// were written. +/// +/// # Errors +/// +/// * `EAGAIN` - the file descriptor was opened with `O_NONBLOCK` and writing would block +/// * `EBADF` - the file descriptor is not valid or is not open for writing +/// * `EFAULT` - `buf` does not point to the process's addressible memory +/// * `EIO` - an I/O error occured +/// * `ENOSPC` - the device containing the file descriptor has no room for data +/// * `EPIPE` - the file descriptor refers to a pipe or socket whose reading end is closed +pub fn write(fd: usize, buf: &[u8]) -> Result { + unsafe { syscall3(SYS_WRITE, fd, buf.as_ptr() as usize, buf.len()) } +} + +/// Yield the process's time slice to the kernel +/// +/// This function will return Ok(0) on success +pub fn sched_yield() -> Result { + unsafe { syscall0(SYS_YIELD) } +} diff --git a/third_party/rust/redox_syscall/src/data.rs b/third_party/rust/redox_syscall/src/data.rs new file mode 100644 index 000000000000..21d8532645d3 --- /dev/null +++ b/third_party/rust/redox_syscall/src/data.rs @@ -0,0 +1,146 @@ +use core::ops::{Deref, DerefMut}; +use core::{mem, slice}; + +#[derive(Copy, Clone, Debug, Default)] +pub struct Event { + pub id: usize, + pub flags: usize, + pub data: usize +} + +impl Deref for Event { + type Target = [u8]; + fn deref(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self as *const Event as *const u8, mem::size_of::()) as &[u8] + } + } +} + +impl DerefMut for Event { + fn deref_mut(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self as *mut Event as *mut u8, mem::size_of::()) as &mut [u8] + } + } +} + +#[derive(Copy, Clone, Debug, Default)] +#[repr(packed)] +pub struct Packet { + pub id: u64, + pub pid: usize, + pub uid: u32, + pub gid: u32, + pub a: usize, + pub b: usize, + pub c: usize, + pub d: usize +} + +impl Deref for Packet { + type Target = [u8]; + fn deref(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self as *const Packet as *const u8, mem::size_of::()) as &[u8] + } + } +} + +impl DerefMut for Packet { + fn deref_mut(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self as *mut Packet as *mut u8, mem::size_of::()) as &mut [u8] + } + } +} + +#[derive(Copy, Clone, Debug, Default)] +#[repr(packed)] +pub struct Stat { + pub st_dev: u64, + pub st_ino: u64, + pub st_mode: u16, + pub st_nlink: u32, + pub st_uid: u32, + pub st_gid: u32, + pub st_size: u64, + pub st_blksize: u32, + pub st_blocks: u64, + pub st_mtime: u64, + pub st_mtime_nsec: u32, + pub st_atime: u64, + pub st_atime_nsec: u32, + pub st_ctime: u64, + pub st_ctime_nsec: u32, +} + +impl Deref for Stat { + type Target = [u8]; + fn deref(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self as *const Stat as *const u8, mem::size_of::()) as &[u8] + } + } +} + +impl DerefMut for Stat { + fn deref_mut(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self as *mut Stat as *mut u8, mem::size_of::()) as &mut [u8] + } + } +} + +#[derive(Copy, Clone, Debug, Default)] +#[repr(packed)] +pub struct StatVfs { + pub f_bsize: u32, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + //TODO: More fields https://linux.die.net/man/2/statvfs +} + +impl Deref for StatVfs { + type Target = [u8]; + fn deref(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self as *const StatVfs as *const u8, mem::size_of::()) as &[u8] + } + } +} + +impl DerefMut for StatVfs { + fn deref_mut(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self as *mut StatVfs as *mut u8, mem::size_of::()) as &mut [u8] + } + } +} + +#[derive(Copy, Clone, Debug, Default)] +#[repr(packed)] +pub struct TimeSpec { + pub tv_sec: i64, + pub tv_nsec: i32, +} + +impl Deref for TimeSpec { + type Target = [u8]; + fn deref(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self as *const TimeSpec as *const u8, + mem::size_of::()) as &[u8] + } + } +} + +impl DerefMut for TimeSpec { + fn deref_mut(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self as *mut TimeSpec as *mut u8, + mem::size_of::()) as &mut [u8] + } + } +} diff --git a/third_party/rust/redox_syscall/src/error.rs b/third_party/rust/redox_syscall/src/error.rs new file mode 100644 index 000000000000..7cbcbe98765e --- /dev/null +++ b/third_party/rust/redox_syscall/src/error.rs @@ -0,0 +1,315 @@ +use core::{fmt, result}; + +#[derive(Eq, PartialEq)] +pub struct Error { + pub errno: i32, +} + +pub type Result = result::Result; + +impl Error { + pub fn new(errno: i32) -> Error { + Error { errno: errno } + } + + pub fn mux(result: Result) -> usize { + match result { + Ok(value) => value, + Err(error) => -error.errno as usize, + } + } + + pub fn demux(value: usize) -> Result { + let errno = -(value as i32); + if errno >= 1 && errno < STR_ERROR.len() as i32 { + Err(Error::new(errno)) + } else { + Ok(value) + } + } + + pub fn text(&self) -> &str { + if let Some(description) = STR_ERROR.get(self.errno as usize) { + description + } else { + "Unknown Error" + } + } +} + +impl fmt::Debug for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> { + f.write_str(self.text()) + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> { + f.write_str(self.text()) + } +} + +pub const EPERM: i32 = 1; /* Operation not permitted */ +pub const ENOENT: i32 = 2; /* No such file or directory */ +pub const ESRCH: i32 = 3; /* No such process */ +pub const EINTR: i32 = 4; /* Interrupted system call */ +pub const EIO: i32 = 5; /* I/O error */ +pub const ENXIO: i32 = 6; /* No such device or address */ +pub const E2BIG: i32 = 7; /* Argument list too long */ +pub const ENOEXEC: i32 = 8; /* Exec format error */ +pub const EBADF: i32 = 9; /* Bad file number */ +pub const ECHILD: i32 = 10; /* No child processes */ +pub const EAGAIN: i32 = 11; /* Try again */ +pub const ENOMEM: i32 = 12; /* Out of memory */ +pub const EACCES: i32 = 13; /* Permission denied */ +pub const EFAULT: i32 = 14; /* Bad address */ +pub const ENOTBLK: i32 = 15; /* Block device required */ +pub const EBUSY: i32 = 16; /* Device or resource busy */ +pub const EEXIST: i32 = 17; /* File exists */ +pub const EXDEV: i32 = 18; /* Cross-device link */ +pub const ENODEV: i32 = 19; /* No such device */ +pub const ENOTDIR: i32 = 20; /* Not a directory */ +pub const EISDIR: i32 = 21; /* Is a directory */ +pub const EINVAL: i32 = 22; /* Invalid argument */ +pub const ENFILE: i32 = 23; /* File table overflow */ +pub const EMFILE: i32 = 24; /* Too many open files */ +pub const ENOTTY: i32 = 25; /* Not a typewriter */ +pub const ETXTBSY: i32 = 26; /* Text file busy */ +pub const EFBIG: i32 = 27; /* File too large */ +pub const ENOSPC: i32 = 28; /* No space left on device */ +pub const ESPIPE: i32 = 29; /* Illegal seek */ +pub const EROFS: i32 = 30; /* Read-only file system */ +pub const EMLINK: i32 = 31; /* Too many links */ +pub const EPIPE: i32 = 32; /* Broken pipe */ +pub const EDOM: i32 = 33; /* Math argument out of domain of func */ +pub const ERANGE: i32 = 34; /* Math result not representable */ +pub const EDEADLK: i32 = 35; /* Resource deadlock would occur */ +pub const ENAMETOOLONG: i32 = 36; /* File name too long */ +pub const ENOLCK: i32 = 37; /* No record locks available */ +pub const ENOSYS: i32 = 38; /* Function not implemented */ +pub const ENOTEMPTY: i32 = 39; /* Directory not empty */ +pub const ELOOP: i32 = 40; /* Too many symbolic links encountered */ +pub const EWOULDBLOCK: i32 = 41; /* Operation would block */ +pub const ENOMSG: i32 = 42; /* No message of desired type */ +pub const EIDRM: i32 = 43; /* Identifier removed */ +pub const ECHRNG: i32 = 44; /* Channel number out of range */ +pub const EL2NSYNC: i32 = 45; /* Level 2 not synchronized */ +pub const EL3HLT: i32 = 46; /* Level 3 halted */ +pub const EL3RST: i32 = 47; /* Level 3 reset */ +pub const ELNRNG: i32 = 48; /* Link number out of range */ +pub const EUNATCH: i32 = 49; /* Protocol driver not attached */ +pub const ENOCSI: i32 = 50; /* No CSI structure available */ +pub const EL2HLT: i32 = 51; /* Level 2 halted */ +pub const EBADE: i32 = 52; /* Invalid exchange */ +pub const EBADR: i32 = 53; /* Invalid request descriptor */ +pub const EXFULL: i32 = 54; /* Exchange full */ +pub const ENOANO: i32 = 55; /* No anode */ +pub const EBADRQC: i32 = 56; /* Invalid request code */ +pub const EBADSLT: i32 = 57; /* Invalid slot */ +pub const EDEADLOCK: i32 = 58; /* Resource deadlock would occur */ +pub const EBFONT: i32 = 59; /* Bad font file format */ +pub const ENOSTR: i32 = 60; /* Device not a stream */ +pub const ENODATA: i32 = 61; /* No data available */ +pub const ETIME: i32 = 62; /* Timer expired */ +pub const ENOSR: i32 = 63; /* Out of streams resources */ +pub const ENONET: i32 = 64; /* Machine is not on the network */ +pub const ENOPKG: i32 = 65; /* Package not installed */ +pub const EREMOTE: i32 = 66; /* Object is remote */ +pub const ENOLINK: i32 = 67; /* Link has been severed */ +pub const EADV: i32 = 68; /* Advertise error */ +pub const ESRMNT: i32 = 69; /* Srmount error */ +pub const ECOMM: i32 = 70; /* Communication error on send */ +pub const EPROTO: i32 = 71; /* Protocol error */ +pub const EMULTIHOP: i32 = 72; /* Multihop attempted */ +pub const EDOTDOT: i32 = 73; /* RFS specific error */ +pub const EBADMSG: i32 = 74; /* Not a data message */ +pub const EOVERFLOW: i32 = 75; /* Value too large for defined data type */ +pub const ENOTUNIQ: i32 = 76; /* Name not unique on network */ +pub const EBADFD: i32 = 77; /* File descriptor in bad state */ +pub const EREMCHG: i32 = 78; /* Remote address changed */ +pub const ELIBACC: i32 = 79; /* Can not access a needed shared library */ +pub const ELIBBAD: i32 = 80; /* Accessing a corrupted shared library */ +pub const ELIBSCN: i32 = 81; /* .lib section in a.out corrupted */ +pub const ELIBMAX: i32 = 82; /* Attempting to link in too many shared libraries */ +pub const ELIBEXEC: i32 = 83; /* Cannot exec a shared library directly */ +pub const EILSEQ: i32 = 84; /* Illegal byte sequence */ +pub const ERESTART: i32 = 85; /* Interrupted system call should be restarted */ +pub const ESTRPIPE: i32 = 86; /* Streams pipe error */ +pub const EUSERS: i32 = 87; /* Too many users */ +pub const ENOTSOCK: i32 = 88; /* Socket operation on non-socket */ +pub const EDESTADDRREQ: i32 = 89; /* Destination address required */ +pub const EMSGSIZE: i32 = 90; /* Message too long */ +pub const EPROTOTYPE: i32 = 91; /* Protocol wrong type for socket */ +pub const ENOPROTOOPT: i32 = 92; /* Protocol not available */ +pub const EPROTONOSUPPORT: i32 = 93; /* Protocol not supported */ +pub const ESOCKTNOSUPPORT: i32 = 94; /* Socket type not supported */ +pub const EOPNOTSUPP: i32 = 95; /* Operation not supported on transport endpoint */ +pub const EPFNOSUPPORT: i32 = 96; /* Protocol family not supported */ +pub const EAFNOSUPPORT: i32 = 97; /* Address family not supported by protocol */ +pub const EADDRINUSE: i32 = 98; /* Address already in use */ +pub const EADDRNOTAVAIL: i32 = 99; /* Cannot assign requested address */ +pub const ENETDOWN: i32 = 100; /* Network is down */ +pub const ENETUNREACH: i32 = 101; /* Network is unreachable */ +pub const ENETRESET: i32 = 102; /* Network dropped connection because of reset */ +pub const ECONNABORTED: i32 = 103; /* Software caused connection abort */ +pub const ECONNRESET: i32 = 104; /* Connection reset by peer */ +pub const ENOBUFS: i32 = 105; /* No buffer space available */ +pub const EISCONN: i32 = 106; /* Transport endpoint is already connected */ +pub const ENOTCONN: i32 = 107; /* Transport endpoint is not connected */ +pub const ESHUTDOWN: i32 = 108; /* Cannot send after transport endpoint shutdown */ +pub const ETOOMANYREFS: i32 = 109; /* Too many references: cannot splice */ +pub const ETIMEDOUT: i32 = 110; /* Connection timed out */ +pub const ECONNREFUSED: i32 = 111; /* Connection refused */ +pub const EHOSTDOWN: i32 = 112; /* Host is down */ +pub const EHOSTUNREACH: i32 = 113; /* No route to host */ +pub const EALREADY: i32 = 114; /* Operation already in progress */ +pub const EINPROGRESS: i32 = 115; /* Operation now in progress */ +pub const ESTALE: i32 = 116; /* Stale NFS file handle */ +pub const EUCLEAN: i32 = 117; /* Structure needs cleaning */ +pub const ENOTNAM: i32 = 118; /* Not a XENIX named type file */ +pub const ENAVAIL: i32 = 119; /* No XENIX semaphores available */ +pub const EISNAM: i32 = 120; /* Is a named type file */ +pub const EREMOTEIO: i32 = 121; /* Remote I/O error */ +pub const EDQUOT: i32 = 122; /* Quota exceeded */ +pub const ENOMEDIUM: i32 = 123; /* No medium found */ +pub const EMEDIUMTYPE: i32 = 124; /* Wrong medium type */ +pub const ECANCELED: i32 = 125; /* Operation Canceled */ +pub const ENOKEY: i32 = 126; /* Required key not available */ +pub const EKEYEXPIRED: i32 = 127; /* Key has expired */ +pub const EKEYREVOKED: i32 = 128; /* Key has been revoked */ +pub const EKEYREJECTED: i32 = 129; /* Key was rejected by service */ +pub const EOWNERDEAD: i32 = 130; /* Owner died */ +pub const ENOTRECOVERABLE: i32 = 131; /* State not recoverable */ + +pub static STR_ERROR: [&'static str; 132] = ["Success", + "Operation not permitted", + "No such file or directory", + "No such process", + "Interrupted system call", + "I/O error", + "No such device or address", + "Argument list too long", + "Exec format error", + "Bad file number", + "No child processes", + "Try again", + "Out of memory", + "Permission denied", + "Bad address", + "Block device required", + "Device or resource busy", + "File exists", + "Cross-device link", + "No such device", + "Not a directory", + "Is a directory", + "Invalid argument", + "File table overflow", + "Too many open files", + "Not a typewriter", + "Text file busy", + "File too large", + "No space left on device", + "Illegal seek", + "Read-only file system", + "Too many links", + "Broken pipe", + "Math argument out of domain of func", + "Math result not representable", + "Resource deadlock would occur", + "File name too long", + "No record locks available", + "Function not implemented", + "Directory not empty", + "Too many symbolic links encountered", + "Operation would block", + "No message of desired type", + "Identifier removed", + "Channel number out of range", + "Level 2 not synchronized", + "Level 3 halted", + "Level 3 reset", + "Link number out of range", + "Protocol driver not attached", + "No CSI structure available", + "Level 2 halted", + "Invalid exchange", + "Invalid request descriptor", + "Exchange full", + "No anode", + "Invalid request code", + "Invalid slot", + "Resource deadlock would occur", + "Bad font file format", + "Device not a stream", + "No data available", + "Timer expired", + "Out of streams resources", + "Machine is not on the network", + "Package not installed", + "Object is remote", + "Link has been severed", + "Advertise error", + "Srmount error", + "Communication error on send", + "Protocol error", + "Multihop attempted", + "RFS specific error", + "Not a data message", + "Value too large for defined data type", + "Name not unique on network", + "File descriptor in bad state", + "Remote address changed", + "Can not access a needed shared library", + "Accessing a corrupted shared library", + ".lib section in a.out corrupted", + "Attempting to link in too many shared libraries", + "Cannot exec a shared library directly", + "Illegal byte sequence", + "Interrupted system call should be restarted", + "Streams pipe error", + "Too many users", + "Socket operation on non-socket", + "Destination address required", + "Message too long", + "Protocol wrong type for socket", + "Protocol not available", + "Protocol not supported", + "Socket type not supported", + "Operation not supported on transport endpoint", + "Protocol family not supported", + "Address family not supported by protocol", + "Address already in use", + "Cannot assign requested address", + "Network is down", + "Network is unreachable", + "Network dropped connection because of reset", + "Software caused connection abort", + "Connection reset by peer", + "No buffer space available", + "Transport endpoint is already connected", + "Transport endpoint is not connected", + "Cannot send after transport endpoint shutdown", + "Too many references: cannot splice", + "Connection timed out", + "Connection refused", + "Host is down", + "No route to host", + "Operation already in progress", + "Operation now in progress", + "Stale NFS file handle", + "Structure needs cleaning", + "Not a XENIX named type file", + "No XENIX semaphores available", + "Is a named type file", + "Remote I/O error", + "Quota exceeded", + "No medium found", + "Wrong medium type", + "Operation Canceled", + "Required key not available", + "Key has expired", + "Key has been revoked", + "Key was rejected by service", + "Owner died", + "State not recoverable"]; diff --git a/third_party/rust/redox_syscall/src/flag.rs b/third_party/rust/redox_syscall/src/flag.rs new file mode 100644 index 000000000000..97ff8e2d79ae --- /dev/null +++ b/third_party/rust/redox_syscall/src/flag.rs @@ -0,0 +1,84 @@ +pub const CLONE_VM: usize = 0x100; +pub const CLONE_FS: usize = 0x200; +pub const CLONE_FILES: usize = 0x400; +pub const CLONE_VFORK: usize = 0x4000; + +pub const CLOCK_REALTIME: usize = 1; +pub const CLOCK_MONOTONIC: usize = 4; + +pub const EVENT_NONE: usize = 0; +pub const EVENT_READ: usize = 1; +pub const EVENT_WRITE: usize = 2; + +pub const F_GETFL: usize = 1; +pub const F_SETFL: usize = 2; + +pub const FUTEX_WAIT: usize = 0; +pub const FUTEX_WAKE: usize = 1; +pub const FUTEX_REQUEUE: usize = 2; + +pub const MAP_WRITE: usize = 1; +pub const MAP_WRITE_COMBINE: usize = 2; + +pub const MODE_TYPE: u16 = 0xF000; +pub const MODE_DIR: u16 = 0x4000; +pub const MODE_FILE: u16 = 0x8000; + +pub const MODE_PERM: u16 = 0x0FFF; +pub const MODE_SETUID: u16 = 0o4000; +pub const MODE_SETGID: u16 = 0o2000; + +pub const O_RDONLY: usize = 0x0001_0000; +pub const O_WRONLY: usize = 0x0002_0000; +pub const O_RDWR: usize = 0x0003_0000; +pub const O_NONBLOCK: usize = 0x0004_0000; +pub const O_APPEND: usize = 0x0008_0000; +pub const O_SHLOCK: usize = 0x0010_0000; +pub const O_EXLOCK: usize = 0x0020_0000; +pub const O_ASYNC: usize = 0x0040_0000; +pub const O_FSYNC: usize = 0x0080_0000; +pub const O_CLOEXEC: usize = 0x0100_0000; +pub const O_CREAT: usize = 0x0200_0000; +pub const O_TRUNC: usize = 0x0400_0000; +pub const O_EXCL: usize = 0x0800_0000; +pub const O_DIRECTORY: usize = 0x1000_0000; +pub const O_STAT: usize = 0x2000_0000; +pub const O_ACCMODE: usize = O_RDONLY | O_WRONLY | O_RDWR; + +pub const SEEK_SET: usize = 0; +pub const SEEK_CUR: usize = 1; +pub const SEEK_END: usize = 2; + +pub const SIGHUP: usize = 1; +pub const SIGINT: usize = 2; +pub const SIGQUIT: usize = 3; +pub const SIGILL: usize = 4; +pub const SIGTRAP: usize = 5; +pub const SIGABRT: usize = 6; +pub const SIGBUS: usize = 7; +pub const SIGFPE: usize = 8; +pub const SIGKILL: usize = 9; +pub const SIGUSR1: usize = 10; +pub const SIGSEGV: usize = 11; +pub const SIGUSR2: usize = 12; +pub const SIGPIPE: usize = 13; +pub const SIGALRM: usize = 14; +pub const SIGTERM: usize = 15; +pub const SIGSTKFLT: usize= 16; +pub const SIGCHLD: usize = 17; +pub const SIGCONT: usize = 18; +pub const SIGSTOP: usize = 19; +pub const SIGTSTP: usize = 20; +pub const SIGTTIN: usize = 21; +pub const SIGTTOU: usize = 22; +pub const SIGURG: usize = 23; +pub const SIGXCPU: usize = 24; +pub const SIGXFSZ: usize = 25; +pub const SIGVTALRM: usize= 26; +pub const SIGPROF: usize = 27; +pub const SIGWINCH: usize = 28; +pub const SIGIO: usize = 29; +pub const SIGPWR: usize = 30; +pub const SIGSYS: usize = 31; + +pub const WNOHANG: usize = 1; diff --git a/third_party/rust/redox_syscall/src/io/dma.rs b/third_party/rust/redox_syscall/src/io/dma.rs new file mode 100644 index 000000000000..200beae74e5e --- /dev/null +++ b/third_party/rust/redox_syscall/src/io/dma.rs @@ -0,0 +1,76 @@ +use core::{mem, ptr}; +use core::ops::{Deref, DerefMut}; + +use Result; + +struct PhysBox { + address: usize, + size: usize +} + +impl PhysBox { + fn new(size: usize) -> Result { + let address = unsafe { ::physalloc(size)? }; + Ok(PhysBox { + address: address, + size: size + }) + } +} + +impl Drop for PhysBox { + fn drop(&mut self) { + let _ = unsafe { ::physfree(self.address, self.size) }; + } +} + +pub struct Dma { + phys: PhysBox, + virt: *mut T +} + +impl Dma { + pub fn new(value: T) -> Result> { + let phys = PhysBox::new(mem::size_of::())?; + let virt = unsafe { ::physmap(phys.address, phys.size, ::MAP_WRITE)? } as *mut T; + unsafe { ptr::write(virt, value); } + Ok(Dma { + phys: phys, + virt: virt + }) + } + + pub fn zeroed() -> Result> { + let phys = PhysBox::new(mem::size_of::())?; + let virt = unsafe { ::physmap(phys.address, phys.size, ::MAP_WRITE)? } as *mut T; + unsafe { ptr::write_bytes(virt as *mut u8, 0, phys.size); } + Ok(Dma { + phys: phys, + virt: virt + }) + } + + pub fn physical(&self) -> usize { + self.phys.address + } +} + +impl Deref for Dma { + type Target = T; + fn deref(&self) -> &T { + unsafe { &*self.virt } + } +} + +impl DerefMut for Dma { + fn deref_mut(&mut self) -> &mut T { + unsafe { &mut *self.virt } + } +} + +impl Drop for Dma { + fn drop(&mut self) { + unsafe { drop(ptr::read(self.virt)); } + let _ = unsafe { ::physunmap(self.virt as usize) }; + } +} diff --git a/third_party/rust/redox_syscall/src/io/io.rs b/third_party/rust/redox_syscall/src/io/io.rs new file mode 100644 index 000000000000..fb866b581b1b --- /dev/null +++ b/third_party/rust/redox_syscall/src/io/io.rs @@ -0,0 +1,67 @@ +use core::cmp::PartialEq; +use core::ops::{BitAnd, BitOr, Not}; + +pub trait Io { + type Value: Copy + PartialEq + BitAnd + BitOr + Not; + + fn read(&self) -> Self::Value; + fn write(&mut self, value: Self::Value); + + #[inline(always)] + fn readf(&self, flags: Self::Value) -> bool { + (self.read() & flags) as Self::Value == flags + } + + #[inline(always)] + fn writef(&mut self, flags: Self::Value, value: bool) { + let tmp: Self::Value = match value { + true => self.read() | flags, + false => self.read() & !flags, + }; + self.write(tmp); + } +} + +pub struct ReadOnly { + inner: I +} + +impl ReadOnly { + pub const fn new(inner: I) -> ReadOnly { + ReadOnly { + inner: inner + } + } + + #[inline(always)] + pub fn read(&self) -> I::Value { + self.inner.read() + } + + #[inline(always)] + pub fn readf(&self, flags: I::Value) -> bool { + self.inner.readf(flags) + } +} + +pub struct WriteOnly { + inner: I +} + +impl WriteOnly { + pub const fn new(inner: I) -> WriteOnly { + WriteOnly { + inner: inner + } + } + + #[inline(always)] + pub fn write(&mut self, value: I::Value) { + self.inner.write(value) + } + + #[inline(always)] + pub fn writef(&mut self, flags: I::Value, value: bool) { + self.inner.writef(flags, value) + } +} diff --git a/third_party/rust/redox_syscall/src/io/mmio.rs b/third_party/rust/redox_syscall/src/io/mmio.rs new file mode 100644 index 000000000000..1a1d1996d1d4 --- /dev/null +++ b/third_party/rust/redox_syscall/src/io/mmio.rs @@ -0,0 +1,31 @@ +use core::intrinsics::{volatile_load, volatile_store}; +use core::mem::uninitialized; +use core::ops::{BitAnd, BitOr, Not}; + +use super::io::Io; + +#[repr(packed)] +pub struct Mmio { + value: T, +} + +impl Mmio { + /// Create a new Mmio without initializing + pub fn new() -> Self { + Mmio { + value: unsafe { uninitialized() } + } + } +} + +impl Io for Mmio where T: Copy + PartialEq + BitAnd + BitOr + Not { + type Value = T; + + fn read(&self) -> T { + unsafe { volatile_load(&self.value) } + } + + fn write(&mut self, value: T) { + unsafe { volatile_store(&mut self.value, value) }; + } +} diff --git a/third_party/rust/redox_syscall/src/io/mod.rs b/third_party/rust/redox_syscall/src/io/mod.rs new file mode 100644 index 000000000000..a35456e30acb --- /dev/null +++ b/third_party/rust/redox_syscall/src/io/mod.rs @@ -0,0 +1,11 @@ +//! I/O functions + +pub use self::dma::*; +pub use self::io::*; +pub use self::mmio::*; +pub use self::pio::*; + +mod dma; +mod io; +mod mmio; +mod pio; diff --git a/third_party/rust/redox_syscall/src/io/pio.rs b/third_party/rust/redox_syscall/src/io/pio.rs new file mode 100644 index 000000000000..91ae310b624a --- /dev/null +++ b/third_party/rust/redox_syscall/src/io/pio.rs @@ -0,0 +1,89 @@ +use core::marker::PhantomData; + +use super::io::Io; + +/// Generic PIO +#[derive(Copy, Clone)] +pub struct Pio { + port: u16, + value: PhantomData, +} + +impl Pio { + /// Create a PIO from a given port + pub const fn new(port: u16) -> Self { + Pio:: { + port: port, + value: PhantomData, + } + } +} + +/// Read/Write for byte PIO +impl Io for Pio { + type Value = u8; + + /// Read + #[inline(always)] + fn read(&self) -> u8 { + let value: u8; + unsafe { + asm!("in $0, $1" : "={al}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile"); + } + value + } + + /// Write + #[inline(always)] + fn write(&mut self, value: u8) { + unsafe { + asm!("out $1, $0" : : "{al}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile"); + } + } +} + +/// Read/Write for word PIO +impl Io for Pio { + type Value = u16; + + /// Read + #[inline(always)] + fn read(&self) -> u16 { + let value: u16; + unsafe { + asm!("in $0, $1" : "={ax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile"); + } + value + } + + /// Write + #[inline(always)] + fn write(&mut self, value: u16) { + unsafe { + asm!("out $1, $0" : : "{ax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile"); + } + } +} + +/// Read/Write for doubleword PIO +impl Io for Pio { + type Value = u32; + + /// Read + #[inline(always)] + fn read(&self) -> u32 { + let value: u32; + unsafe { + asm!("in $0, $1" : "={eax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile"); + } + value + } + + /// Write + #[inline(always)] + fn write(&mut self, value: u32) { + unsafe { + asm!("out $1, $0" : : "{eax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile"); + } + } +} diff --git a/third_party/rust/redox_syscall/src/lib.rs b/third_party/rust/redox_syscall/src/lib.rs new file mode 100644 index 000000000000..d7b96ed1a8b2 --- /dev/null +++ b/third_party/rust/redox_syscall/src/lib.rs @@ -0,0 +1,47 @@ +#![deny(warnings)] +#![feature(asm)] +#![feature(const_fn)] +#![feature(core_intrinsics)] +#![no_std] + +pub use self::arch::*; +pub use self::call::*; +pub use self::data::*; +pub use self::error::*; +pub use self::flag::*; +pub use self::io::*; +pub use self::number::*; +pub use self::scheme::*; + +#[cfg(target_arch = "arm")] +#[path="arch/arm.rs"] +mod arch; + +#[cfg(target_arch = "x86")] +#[path="arch/x86.rs"] +mod arch; + +#[cfg(target_arch = "x86_64")] +#[path="arch/x86_64.rs"] +mod arch; + +/// Function definitions +pub mod call; + +/// Complex structures that are used for some system calls +pub mod data; + +/// All errors that can be generated by a system call +pub mod error; + +/// Flags used as an argument to many system calls +pub mod flag; + +/// Functions for low level hardware control +pub mod io; + +/// Call numbers used by each system call +pub mod number; + +/// A trait useful for scheme handlers +pub mod scheme; diff --git a/third_party/rust/redox_syscall/src/number.rs b/third_party/rust/redox_syscall/src/number.rs new file mode 100644 index 000000000000..ef3dbd761a5a --- /dev/null +++ b/third_party/rust/redox_syscall/src/number.rs @@ -0,0 +1,64 @@ +pub const SYS_CLASS: usize = 0xF000_0000; +pub const SYS_CLASS_PATH: usize=0x1000_0000; +pub const SYS_CLASS_FILE: usize=0x2000_0000; + +pub const SYS_ARG: usize = 0x0F00_0000; +pub const SYS_ARG_SLICE: usize =0x0100_0000; +pub const SYS_ARG_MSLICE: usize=0x0200_0000; +pub const SYS_ARG_PATH: usize = 0x0300_0000; + +pub const SYS_RET: usize = 0x00F0_0000; +pub const SYS_RET_FILE: usize = 0x0010_0000; + +pub const SYS_LINK: usize = SYS_CLASS_PATH | SYS_ARG_PATH | 9; +pub const SYS_OPEN: usize = SYS_CLASS_PATH | SYS_RET_FILE | 5; +pub const SYS_CHMOD: usize = SYS_CLASS_PATH | 15; +pub const SYS_RMDIR: usize = SYS_CLASS_PATH | 84; +pub const SYS_UNLINK: usize = SYS_CLASS_PATH | 10; + +pub const SYS_CLOSE: usize = SYS_CLASS_FILE | 6; +pub const SYS_DUP: usize = SYS_CLASS_FILE | SYS_RET_FILE | 41; +pub const SYS_DUP2: usize = SYS_CLASS_FILE | SYS_RET_FILE | 63; +pub const SYS_READ: usize = SYS_CLASS_FILE | SYS_ARG_MSLICE | 3; +pub const SYS_WRITE: usize = SYS_CLASS_FILE | SYS_ARG_SLICE | 4; +pub const SYS_LSEEK: usize = SYS_CLASS_FILE | 19; +pub const SYS_FCNTL: usize = SYS_CLASS_FILE | 55; +pub const SYS_FEVENT: usize = SYS_CLASS_FILE | 927; +pub const SYS_FMAP: usize = SYS_CLASS_FILE | 90; +pub const SYS_FUNMAP: usize = SYS_CLASS_FILE | 91; +pub const SYS_FPATH: usize = SYS_CLASS_FILE | SYS_ARG_MSLICE | 928; +pub const SYS_FSTAT: usize = SYS_CLASS_FILE | SYS_ARG_MSLICE | 28; +pub const SYS_FSTATVFS: usize = SYS_CLASS_FILE | SYS_ARG_MSLICE | 100; +pub const SYS_FSYNC: usize = SYS_CLASS_FILE | 118; +pub const SYS_FTRUNCATE: usize =SYS_CLASS_FILE | 93; + +pub const SYS_BRK: usize = 45; +pub const SYS_CHDIR: usize = 12; +pub const SYS_CLOCK_GETTIME: usize = 265; +pub const SYS_CLONE: usize = 120; +pub const SYS_EXECVE: usize = 11; +pub const SYS_EXIT: usize = 1; +pub const SYS_FUTEX: usize = 240; +pub const SYS_GETCWD: usize = 183; +pub const SYS_GETEGID: usize = 202; +pub const SYS_GETENS: usize = 951; +pub const SYS_GETEUID: usize = 201; +pub const SYS_GETGID: usize = 200; +pub const SYS_GETNS: usize = 950; +pub const SYS_GETPID: usize = 20; +pub const SYS_GETUID: usize = 199; +pub const SYS_IOPL: usize = 110; +pub const SYS_KILL: usize = 37; +pub const SYS_MKNS: usize = 984; +pub const SYS_NANOSLEEP: usize =162; +pub const SYS_PHYSALLOC: usize =945; +pub const SYS_PHYSFREE: usize = 946; +pub const SYS_PHYSMAP: usize = 947; +pub const SYS_PHYSUNMAP: usize =948; +pub const SYS_VIRTTOPHYS: usize=949; +pub const SYS_PIPE2: usize = 331; +pub const SYS_SETREGID: usize = 204; +pub const SYS_SETRENS: usize = 952; +pub const SYS_SETREUID: usize = 203; +pub const SYS_WAITPID: usize = 7; +pub const SYS_YIELD: usize = 158; diff --git a/third_party/rust/redox_syscall/src/scheme.rs b/third_party/rust/redox_syscall/src/scheme.rs new file mode 100644 index 000000000000..d322f0b5a9c8 --- /dev/null +++ b/third_party/rust/redox_syscall/src/scheme.rs @@ -0,0 +1,232 @@ +use core::{mem, slice}; + +use super::*; + +pub trait Scheme { + fn handle(&self, packet: &mut Packet) { + packet.a = Error::mux(match packet.a { + SYS_OPEN => self.open(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d, packet.uid, packet.gid), + SYS_CHMOD => self.chmod(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d as u16, packet.uid, packet.gid), + SYS_RMDIR => self.rmdir(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid), + SYS_UNLINK => self.unlink(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid), + + SYS_DUP => self.dup(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }), + SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }), + SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }), + SYS_LSEEK => self.seek(packet.b, packet.c, packet.d), + SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d), + SYS_FEVENT => self.fevent(packet.b, packet.c), + SYS_FMAP => self.fmap(packet.b, packet.c, packet.d), + SYS_FPATH => self.fpath(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }), + SYS_FSTAT => if packet.d >= mem::size_of::() { self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) }) } else { Err(Error::new(EFAULT)) }, + SYS_FSTATVFS => if packet.d >= mem::size_of::() { self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) }) } else { Err(Error::new(EFAULT)) }, + SYS_FSYNC => self.fsync(packet.b), + SYS_FTRUNCATE => self.ftruncate(packet.b, packet.c), + SYS_CLOSE => self.close(packet.b), + + _ => Err(Error::new(ENOSYS)) + }); + } + + /* Scheme operations */ + + #[allow(unused_variables)] + fn open(&self, path: &[u8], flags: usize, uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + #[allow(unused_variables)] + fn chmod(&self, path: &[u8], mode: u16, uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + #[allow(unused_variables)] + fn rmdir(&self, path: &[u8], uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + #[allow(unused_variables)] + fn unlink(&self, path: &[u8], uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + /* Resource operations */ + #[allow(unused_variables)] + fn dup(&self, old_id: usize, buf: &[u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn read(&self, id: usize, buf: &mut [u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn write(&self, id: usize, buf: &[u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn seek(&self, id: usize, pos: usize, whence: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fcntl(&self, id: usize, cmd: usize, arg: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fevent(&self, id: usize, flags: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fmap(&self, id: usize, offset: usize, size: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fpath(&self, id: usize, buf: &mut [u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fstat(&self, id: usize, stat: &mut Stat) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fstatvfs(&self, id: usize, stat: &mut StatVfs) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fsync(&self, id: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn ftruncate(&self, id: usize, len: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn close(&self, id: usize) -> Result { + Err(Error::new(EBADF)) + } +} + +pub trait SchemeMut { + fn handle(&mut self, packet: &mut Packet) { + packet.a = Error::mux(match packet.a { + SYS_OPEN => self.open(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d, packet.uid, packet.gid), + SYS_CHMOD => self.chmod(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d as u16, packet.uid, packet.gid), + SYS_RMDIR => self.rmdir(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid), + SYS_UNLINK => self.unlink(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid), + + SYS_DUP => self.dup(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }), + SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }), + SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }), + SYS_LSEEK => self.seek(packet.b, packet.c, packet.d), + SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d), + SYS_FEVENT => self.fevent(packet.b, packet.c), + SYS_FMAP => self.fmap(packet.b, packet.c, packet.d), + SYS_FPATH => self.fpath(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }), + SYS_FSTAT => if packet.d >= mem::size_of::() { self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) }) } else { Err(Error::new(EFAULT)) }, + SYS_FSTATVFS => if packet.d >= mem::size_of::() { self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) }) } else { Err(Error::new(EFAULT)) }, + SYS_FSYNC => self.fsync(packet.b), + SYS_FTRUNCATE => self.ftruncate(packet.b, packet.c), + SYS_CLOSE => self.close(packet.b), + + _ => Err(Error::new(ENOSYS)) + }); + } + + /* Scheme operations */ + #[allow(unused_variables)] + fn open(&mut self, path: &[u8], flags: usize, uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + #[allow(unused_variables)] + fn chmod(&self, path: &[u8], mode: u16, uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + #[allow(unused_variables)] + fn rmdir(&mut self, path: &[u8], uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + #[allow(unused_variables)] + fn unlink(&mut self, path: &[u8], uid: u32, gid: u32) -> Result { + Err(Error::new(ENOENT)) + } + + /* Resource operations */ + #[allow(unused_variables)] + fn dup(&mut self, old_id: usize, buf: &[u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn read(&mut self, id: usize, buf: &mut [u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn write(&mut self, id: usize, buf: &[u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn seek(&mut self, id: usize, pos: usize, whence: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fcntl(&mut self, id: usize, cmd: usize, arg: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fevent(&mut self, id: usize, flags: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fmap(&mut self, id: usize, offset: usize, size: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fpath(&mut self, id: usize, buf: &mut [u8]) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fstat(&mut self, id: usize, stat: &mut Stat) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fstatvfs(&self, id: usize, stat: &mut StatVfs) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fsync(&mut self, id: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn ftruncate(&mut self, id: usize, len: usize) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn close(&mut self, id: usize) -> Result { + Err(Error::new(EBADF)) + } +} diff --git a/third_party/rust/rustc-serialize/.cargo-checksum.json b/third_party/rust/rustc-serialize/.cargo-checksum.json new file mode 100644 index 000000000000..2ac931f0ba00 --- /dev/null +++ b/third_party/rust/rustc-serialize/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"03dcea6dcd54625b42d91176e86718626dfd911744a343dee3edefa001e87dc5","Cargo.toml":"d2a79a65f523c621e0755c45c7992177fbdec9b6216910f1ec8d983682f7d710","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"11c5bfb489de42f984b1380f8100edb794fb88f750c03e9c62aff0f53860e4d5","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","benches/base64.rs":"96f7d0c7d260362e41b8cefb4839f1e1b3c18c2f10344f6ccafac7c434f99ca9","benches/hex.rs":"057821307b4b7de02f2c267f9248457386035382916c5afe4b72d6f2e905062c","benches/json.rs":"659f2ae2e1ad5ed022fafce6418d17dfe09c3dcb3f054857dce0effc907da850","src/base64.rs":"e83a8b3b30180ba0e74e1caca1c04a4e960acb72960fe149aef9ab8dcfb50053","src/collection_impls.rs":"8ae6bc0d61a4777d834c2b24fa987550cb13c570e1564f87ee32eceff3cb2d5b","src/hex.rs":"706f925e8abd8de250d9bbbc4877be726cbbeb5b612ff8f283bd4fee98d7a454","src/json.rs":"6b9541ff2a650d90e290fed24b59fc2fd9410aabc4654f9d8d1f77296e3ab3cf","src/lib.rs":"6e7beb6b5c4ebcaadedb8a82e1cc17249f9a8da2a59d19e1af9dd9a75e8ddf6b","src/serialize.rs":"7ddcc3c32843850e30d05b82a8cda8ae63ec0016e2b0bfbcc46a03ea3ea986e8"},"package":"237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b"} \ No newline at end of file diff --git a/third_party/rust/rustc-serialize/.cargo-ok b/third_party/rust/rustc-serialize/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/rustc-serialize/.gitignore b/third_party/rust/rustc-serialize/.gitignore new file mode 100644 index 000000000000..4fffb2f89cbd --- /dev/null +++ b/third_party/rust/rustc-serialize/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/third_party/rust/rustc-serialize/.travis.yml b/third_party/rust/rustc-serialize/.travis.yml new file mode 100644 index 000000000000..62bd8391dca9 --- /dev/null +++ b/third_party/rust/rustc-serialize/.travis.yml @@ -0,0 +1,24 @@ +language: rust +rust: + - 1.0.0 + - stable + - beta + - nightly +sudo: false +before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH +script: + - cargo build --verbose + - cargo test --verbose + - cargo doc --no-deps +after_success: + - travis-cargo --only nightly doc-upload +env: + global: + secure: "kJnqqAXRl0C7Afx0c8Y3vA6TAEZsxlasu7eIZMdCbNS4N1+Rwh0jNTa2jy2D3CQCrzW5OCefnkpkPTu8mADrAjedM4p/9X5UXZi0sgg2lzCgfGwrRzitTnyPDkdYidiu4QeC/r0WPC8lYZKHkJXYhF8bZgchB9ypnZ6LAHCcDkA=" + + + +notifications: + email: + on_success: never diff --git a/third_party/rust/rustc-serialize/Cargo.toml b/third_party/rust/rustc-serialize/Cargo.toml new file mode 100644 index 000000000000..5a33f9ab2537 --- /dev/null +++ b/third_party/rust/rustc-serialize/Cargo.toml @@ -0,0 +1,18 @@ +[package] + +name = "rustc-serialize" +version = "0.3.22" +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/rust-lang/rustc-serialize" +homepage = "https://github.com/rust-lang/rustc-serialize" +documentation = "https://doc.rust-lang.org/rustc-serialize" +description = """ +Generic serialization/deserialization support corresponding to the +`derive(RustcEncodable, RustcDecodable)` mode in the compiler. Also includes +support for hex, base64, and json encoding and decoding. +""" + +[dev-dependencies] +rand = "0.3" diff --git a/third_party/rust/rustc-serialize/LICENSE-APACHE b/third_party/rust/rustc-serialize/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/rustc-serialize/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/rustc-serialize/LICENSE-MIT b/third_party/rust/rustc-serialize/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/rustc-serialize/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +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. diff --git a/third_party/rust/rustc-serialize/README.md b/third_party/rust/rustc-serialize/README.md new file mode 100644 index 000000000000..db2f5693aeb7 --- /dev/null +++ b/third_party/rust/rustc-serialize/README.md @@ -0,0 +1,24 @@ +# rustc-serialize + +Serialization and deserialization support provided by the compiler in the form +of `derive(RustcEncodable, RustcDecodable)`. + +[![Linux Build Status](https://travis-ci.org/rust-lang-nursery/rustc-serialize.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/rustc-serialize) +[![Windows Build Status](https://ci.appveyor.com/api/projects/status/ka194de75aapwpft?svg=true)](https://ci.appveyor.com/project/alexcrichton/rustc-serialize) + +[Documentation](https://doc.rust-lang.org/rustc-serialize) + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +rustc-serialize = "0.3" +``` + +and this to your crate root: + +```rust +extern crate rustc_serialize; +``` diff --git a/third_party/rust/rustc-serialize/appveyor.yml b/third_party/rust/rustc-serialize/appveyor.yml new file mode 100644 index 000000000000..6a1b8dc19c03 --- /dev/null +++ b/third_party/rust/rustc-serialize/appveyor.yml @@ -0,0 +1,17 @@ +environment: + matrix: + - TARGET: x86_64-pc-windows-msvc + - TARGET: i686-pc-windows-msvc + - TARGET: i686-pc-windows-gnu +install: + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" + - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" + - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin + - SET PATH=%PATH%;C:\MinGW\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo test --verbose diff --git a/third_party/rust/rustc-serialize/benches/base64.rs b/third_party/rust/rustc-serialize/benches/base64.rs new file mode 100644 index 000000000000..6a6565bc1482 --- /dev/null +++ b/third_party/rust/rustc-serialize/benches/base64.rs @@ -0,0 +1,48 @@ +#![feature(test)] + +extern crate test; +extern crate rustc_serialize; + +use rustc_serialize::base64::{FromBase64, ToBase64, STANDARD}; +use test::Bencher; + +#[bench] +fn bench_to_base64(b: &mut Bencher) { + let s = "イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム \ + ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン"; + b.iter(|| { + s.as_bytes().to_base64(STANDARD); + }); + b.bytes = s.len() as u64; +} + +#[bench] +fn bench_from_base64(b: &mut Bencher) { + let s = "イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム \ + ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン"; + let sb = s.as_bytes().to_base64(STANDARD); + b.iter(|| { + sb.from_base64().unwrap(); + }); + b.bytes = sb.len() as u64; +} + + +#[bench] +fn bench_to_base64_large(b: &mut Bencher) { + let s: Vec<_> = (0..10000).map(|i| ((i as u32 * 12345) % 256) as u8).collect(); + b.iter(|| { + s.to_base64(STANDARD); + }); + b.bytes = s.len() as u64; +} + +#[bench] +fn bench_from_base64_large(b: &mut Bencher) { + let s: Vec<_> = (0..10000).map(|i| ((i as u32 * 12345) % 256) as u8).collect(); + let sb = s.to_base64(STANDARD); + b.iter(|| { + sb.from_base64().unwrap(); + }); + b.bytes = sb.len() as u64; +} diff --git a/third_party/rust/rustc-serialize/benches/hex.rs b/third_party/rust/rustc-serialize/benches/hex.rs new file mode 100644 index 000000000000..97a7735e8175 --- /dev/null +++ b/third_party/rust/rustc-serialize/benches/hex.rs @@ -0,0 +1,28 @@ +#![feature(test)] + +extern crate test; +extern crate rustc_serialize; + +use test::Bencher; +use rustc_serialize::hex::{FromHex, ToHex}; + +#[bench] +fn bench_to_hex(b: &mut Bencher) { + let s = "イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム \ + ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン"; + b.iter(|| { + s.as_bytes().to_hex(); + }); + b.bytes = s.len() as u64; +} + +#[bench] +fn bench_from_hex(b: &mut Bencher) { + let s = "イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム \ + ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン"; + let sb = s.as_bytes().to_hex(); + b.iter(|| { + sb.from_hex().unwrap(); + }); + b.bytes = sb.len() as u64; +} diff --git a/third_party/rust/rustc-serialize/benches/json.rs b/third_party/rust/rustc-serialize/benches/json.rs new file mode 100644 index 000000000000..20768e116a7c --- /dev/null +++ b/third_party/rust/rustc-serialize/benches/json.rs @@ -0,0 +1,84 @@ +#![feature(test)] + +extern crate test; +extern crate rustc_serialize; + +use std::string; +use rustc_serialize::json::{Json, Parser}; +use test::Bencher; + +#[bench] +fn bench_streaming_small(b: &mut Bencher) { + b.iter( || { + let mut parser = Parser::new( + r#"{ + "a": 1.0, + "b": [ + true, + "foo\nbar", + { "c": {"d": null} } + ] + }"#.chars() + ); + loop { + match parser.next() { + None => return, + _ => {} + } + } + }); +} +#[bench] +fn bench_small(b: &mut Bencher) { + b.iter( || { + let _ = Json::from_str(r#"{ + "a": 1.0, + "b": [ + true, + "foo\nbar", + { "c": {"d": null} } + ] + }"#); + }); +} + +#[bench] +fn bench_decode_hex_escape(b: &mut Bencher) { + let mut src = "\"".to_string(); + for _ in 0..10 { + src.push_str("\\uF975\\uf9bc\\uF9A0\\uF9C4\\uF975\\uf9bc\\uF9A0\\uF9C4"); + } + src.push_str("\""); + b.iter( || { + let _ = Json::from_str(&src); + }); +} + +fn big_json() -> string::String { + let mut src = "[\n".to_string(); + for _ in 0..500 { + src.push_str(r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": \ + [1,2,3]},"#); + } + src.push_str("{}]"); + return src; +} + +#[bench] +fn bench_streaming_large(b: &mut Bencher) { + let src = big_json(); + b.iter( || { + let mut parser = Parser::new(src.chars()); + loop { + match parser.next() { + None => return, + _ => {} + } + } + }); +} +#[bench] +fn bench_large(b: &mut Bencher) { + let src = big_json(); + b.iter( || { let _ = Json::from_str(&src); }); +} diff --git a/third_party/rust/rustc-serialize/src/base64.rs b/third_party/rust/rustc-serialize/src/base64.rs new file mode 100644 index 000000000000..86abea154b7b --- /dev/null +++ b/third_party/rust/rustc-serialize/src/base64.rs @@ -0,0 +1,488 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// ignore-lexer-test FIXME #15679 + +//! Base64 binary-to-text encoding + +pub use self::FromBase64Error::*; +pub use self::CharacterSet::*; + +use std::fmt; +use std::error; + +/// Available encoding character sets +#[derive(Clone, Copy, Debug)] +pub enum CharacterSet { + /// The standard character set (uses `+` and `/`) + Standard, + /// The URL safe character set (uses `-` and `_`) + UrlSafe +} + +/// Available newline types +#[derive(Clone, Copy, Debug)] +pub enum Newline { + /// A linefeed (i.e. Unix-style newline) + LF, + /// A carriage return and a linefeed (i.e. Windows-style newline) + CRLF +} + +/// Contains configuration parameters for `to_base64`. +#[derive(Clone, Copy, Debug)] +pub struct Config { + /// Character set to use + pub char_set: CharacterSet, + /// Newline to use + pub newline: Newline, + /// True to pad output with `=` characters + pub pad: bool, + /// `Some(len)` to wrap lines at `len`, `None` to disable line wrapping + pub line_length: Option +} + +/// Configuration for RFC 4648 standard base64 encoding +pub static STANDARD: Config = + Config {char_set: Standard, newline: Newline::CRLF, pad: true, line_length: None}; + +/// Configuration for RFC 4648 base64url encoding +pub static URL_SAFE: Config = + Config {char_set: UrlSafe, newline: Newline::CRLF, pad: false, line_length: None}; + +/// Configuration for RFC 2045 MIME base64 encoding +pub static MIME: Config = + Config {char_set: Standard, newline: Newline::CRLF, pad: true, line_length: Some(76)}; + +static STANDARD_CHARS: &'static[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ + abcdefghijklmnopqrstuvwxyz\ + 0123456789+/"; + +static URLSAFE_CHARS: &'static[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ + abcdefghijklmnopqrstuvwxyz\ + 0123456789-_"; + +/// A trait for converting a value to base64 encoding. +pub trait ToBase64 { + /// Converts the value of `self` to a base64 value following the specified + /// format configuration, returning the owned string. + fn to_base64(&self, config: Config) -> String; +} + +impl ToBase64 for [u8] { + /// Turn a vector of `u8` bytes into a base64 string. + /// + /// # Example + /// + /// ```rust + /// extern crate rustc_serialize; + /// use rustc_serialize::base64::{ToBase64, STANDARD}; + /// + /// fn main () { + /// let str = [52,32].to_base64(STANDARD); + /// println!("base 64 output: {:?}", str); + /// } + /// ``` + fn to_base64(&self, config: Config) -> String { + let bytes = match config.char_set { + Standard => STANDARD_CHARS, + UrlSafe => URLSAFE_CHARS + }; + + let len = self.len(); + let newline = match config.newline { + Newline::LF => "\n", + Newline::CRLF => "\r\n", + }; + + // Preallocate memory. + let mut prealloc_len = (len + 2) / 3 * 4; + if let Some(line_length) = config.line_length { + let num_lines = match prealloc_len { + 0 => 0, + n => (n - 1) / line_length + }; + prealloc_len += num_lines * newline.bytes().count(); + } + + let mut out_bytes = vec![b'='; prealloc_len]; + + // Deal with padding bytes + let mod_len = len % 3; + + // Use iterators to reduce branching + { + let mut cur_length = 0; + + let mut s_in = self[..len - mod_len].iter().map(|&x| x as u32); + let mut s_out = out_bytes.iter_mut(); + + // Convenient shorthand + let enc = |val| bytes[val as usize]; + let mut write = |val| *s_out.next().unwrap() = val; + + // Iterate though blocks of 4 + while let (Some(first), Some(second), Some(third)) = + (s_in.next(), s_in.next(), s_in.next()) { + + // Line break if needed + if let Some(line_length) = config.line_length { + if cur_length >= line_length { + for b in newline.bytes() { write(b) }; + cur_length = 0; + } + } + + let n = first << 16 | second << 8 | third; + + // This 24-bit number gets separated into four 6-bit numbers. + write(enc((n >> 18) & 63)); + write(enc((n >> 12) & 63)); + write(enc((n >> 6 ) & 63)); + write(enc((n >> 0 ) & 63)); + + cur_length += 4; + } + + // Line break only needed if padding is required + if mod_len != 0 { + if let Some(line_length) = config.line_length { + if cur_length >= line_length { + for b in newline.bytes() { write(b) }; + } + } + } + + // Heh, would be cool if we knew this was exhaustive + // (the dream of bounded integer types) + match mod_len { + 0 => (), + 1 => { + let n = (self[len-1] as u32) << 16; + write(enc((n >> 18) & 63)); + write(enc((n >> 12) & 63)); + } + 2 => { + let n = (self[len-2] as u32) << 16 | + (self[len-1] as u32) << 8; + write(enc((n >> 18) & 63)); + write(enc((n >> 12) & 63)); + write(enc((n >> 6 ) & 63)); + } + _ => panic!("Algebra is broken, please alert the math police") + } + } + + // We get padding for "free", so only have to drop it if unwanted. + if !config.pad { + while let Some(&b'=') = out_bytes.last() { + out_bytes.pop(); + } + } + + unsafe { String::from_utf8_unchecked(out_bytes) } + } +} + +impl<'a, T: ?Sized + ToBase64> ToBase64 for &'a T { + fn to_base64(&self, config: Config) -> String { + (**self).to_base64(config) + } +} + +/// A trait for converting from base64 encoded values. +pub trait FromBase64 { + /// Converts the value of `self`, interpreted as base64 encoded data, into + /// an owned vector of bytes, returning the vector. + fn from_base64(&self) -> Result, FromBase64Error>; +} + +/// Errors that can occur when decoding a base64 encoded string +#[derive(Clone, Copy)] +pub enum FromBase64Error { + /// The input contained a character not part of the base64 format + InvalidBase64Byte(u8, usize), + /// The input had an invalid length + InvalidBase64Length, +} + +impl fmt::Debug for FromBase64Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + InvalidBase64Byte(ch, idx) => + write!(f, "Invalid character '{}' at position {}", ch, idx), + InvalidBase64Length => write!(f, "Invalid length"), + } + } +} + +impl error::Error for FromBase64Error { + fn description(&self) -> &str { + match *self { + InvalidBase64Byte(_, _) => "invalid character", + InvalidBase64Length => "invalid length", + } + } +} + +impl fmt::Display for FromBase64Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self, f) + } +} + +impl FromBase64 for str { + /// Convert any base64 encoded string (literal, `@`, `&`, or `~`) + /// to the byte values it encodes. + /// + /// You can use the `String::from_utf8` function to turn a `Vec` into a + /// string with characters corresponding to those values. + /// + /// # Example + /// + /// This converts a string literal to base64 and back. + /// + /// ```rust + /// extern crate rustc_serialize; + /// use rustc_serialize::base64::{ToBase64, FromBase64, STANDARD}; + /// + /// fn main () { + /// let hello_str = b"Hello, World".to_base64(STANDARD); + /// println!("base64 output: {}", hello_str); + /// let res = hello_str.from_base64(); + /// if res.is_ok() { + /// let opt_bytes = String::from_utf8(res.unwrap()); + /// if opt_bytes.is_ok() { + /// println!("decoded from base64: {:?}", opt_bytes.unwrap()); + /// } + /// } + /// } + /// ``` + #[inline] + fn from_base64(&self) -> Result, FromBase64Error> { + self.as_bytes().from_base64() + } +} + +impl FromBase64 for [u8] { + fn from_base64(&self) -> Result, FromBase64Error> { + let mut r = Vec::with_capacity(self.len()); + let mut buf: u32 = 0; + let mut modulus = 0; + + let mut it = self.iter(); + for byte in it.by_ref() { + let code = DECODE_TABLE[*byte as usize]; + if code >= SPECIAL_CODES_START { + match code { + NEWLINE_CODE => continue, + EQUALS_CODE => break, + INVALID_CODE => return Err(InvalidBase64Byte( + *byte, (byte as *const _ as usize) - self.as_ptr() as usize)), + _ => unreachable!(), + } + } + buf = (buf | code as u32) << 6; + modulus += 1; + if modulus == 4 { + modulus = 0; + r.push((buf >> 22) as u8); + r.push((buf >> 14) as u8); + r.push((buf >> 6 ) as u8); + } + } + + for byte in it { + match *byte { + b'=' | b'\r' | b'\n' => continue, + _ => return Err(InvalidBase64Byte( + *byte, (byte as *const _ as usize) - self.as_ptr() as usize)), + } + } + + match modulus { + 2 => { + r.push((buf >> 10) as u8); + } + 3 => { + r.push((buf >> 16) as u8); + r.push((buf >> 8 ) as u8); + } + 0 => (), + _ => return Err(InvalidBase64Length), + } + + Ok(r) + } +} + +impl<'a, T: ?Sized + FromBase64> FromBase64 for &'a T { + fn from_base64(&self) -> Result, FromBase64Error> { + (**self).from_base64() + } +} + +/// Base64 decoding lookup table, generated using: +/// ```rust +/// let mut ch = 0u8; +/// loop { +/// let code = match ch { +/// b'A'...b'Z' => ch - 0x41, +/// b'a'...b'z' => ch - 0x47, +/// b'0'...b'9' => ch + 0x04, +/// b'+' | b'-' => 0x3E, +/// b'/' | b'_' => 0x3F, +/// b'=' => 0xFE, +/// b'\r' | b'\n' => 0xFD, +/// _ => 0xFF, +/// }; +/// print!("0x{:02X}, ", code); +/// if ch % 16 == 15 { println!(""); } +/// else if ch == 0xFF { break; } +/// ch += 1; +/// } +/// println!(""); +/// } +/// ``` +const DECODE_TABLE: [u8; 256] = [ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0x3E, 0xFF, 0x3F, + 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, + 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, + 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, + 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +]; +const INVALID_CODE: u8 = 0xFF; +const EQUALS_CODE: u8 = 0xFE; +const NEWLINE_CODE: u8 = 0xFD; +const SPECIAL_CODES_START: u8 = NEWLINE_CODE; + +#[cfg(test)] +mod tests { + use base64::{Config, Newline, FromBase64, ToBase64, STANDARD, URL_SAFE}; + + #[test] + fn test_to_base64_basic() { + assert_eq!("".as_bytes().to_base64(STANDARD), ""); + assert_eq!("f".as_bytes().to_base64(STANDARD), "Zg=="); + assert_eq!("fo".as_bytes().to_base64(STANDARD), "Zm8="); + assert_eq!("foo".as_bytes().to_base64(STANDARD), "Zm9v"); + assert_eq!("foob".as_bytes().to_base64(STANDARD), "Zm9vYg=="); + assert_eq!("fooba".as_bytes().to_base64(STANDARD), "Zm9vYmE="); + assert_eq!("foobar".as_bytes().to_base64(STANDARD), "Zm9vYmFy"); + } + + #[test] + fn test_to_base64_crlf_line_break() { + assert!(![08; 1000].to_base64(Config {line_length: None, ..STANDARD}) + .contains("\r\n")); + assert_eq!(b"foobar".to_base64(Config {line_length: Some(4), + ..STANDARD}), + "Zm9v\r\nYmFy"); + } + + #[test] + fn test_to_base64_lf_line_break() { + assert!(![08; 1000].to_base64(Config {line_length: None, + newline: Newline::LF, + ..STANDARD}) + .contains("\n")); + assert_eq!(b"foobar".to_base64(Config {line_length: Some(4), + newline: Newline::LF, + ..STANDARD}), + "Zm9v\nYmFy"); + } + + #[test] + fn test_to_base64_padding() { + assert_eq!("f".as_bytes().to_base64(Config {pad: false, ..STANDARD}), "Zg"); + assert_eq!("fo".as_bytes().to_base64(Config {pad: false, ..STANDARD}), "Zm8"); + } + + #[test] + fn test_to_base64_url_safe() { + assert_eq!([251, 255].to_base64(URL_SAFE), "-_8"); + assert_eq!([251, 255].to_base64(STANDARD), "+/8="); + } + + #[test] + fn test_to_base64_empty_line_length() { + [].to_base64(Config {line_length: Some(72), ..STANDARD}); + } + + #[test] + fn test_from_base64_basic() { + assert_eq!("".from_base64().unwrap(), b""); + assert_eq!("Zg==".from_base64().unwrap(), b"f"); + assert_eq!("Zm8=".from_base64().unwrap(), b"fo"); + assert_eq!("Zm9v".from_base64().unwrap(), b"foo"); + assert_eq!("Zm9vYg==".from_base64().unwrap(), b"foob"); + assert_eq!("Zm9vYmE=".from_base64().unwrap(), b"fooba"); + assert_eq!("Zm9vYmFy".from_base64().unwrap(), b"foobar"); + } + + #[test] + fn test_from_base64_bytes() { + assert_eq!(b"Zm9vYmFy".from_base64().unwrap(), b"foobar"); + } + + #[test] + fn test_from_base64_newlines() { + assert_eq!("Zm9v\r\nYmFy".from_base64().unwrap(), + b"foobar"); + assert_eq!("Zm9vYg==\r\n".from_base64().unwrap(), + b"foob"); + assert_eq!("Zm9v\nYmFy".from_base64().unwrap(), + b"foobar"); + assert_eq!("Zm9vYg==\n".from_base64().unwrap(), + b"foob"); + } + + #[test] + fn test_from_base64_urlsafe() { + assert_eq!("-_8".from_base64().unwrap(), "+/8=".from_base64().unwrap()); + } + + #[test] + fn test_from_base64_invalid_char() { + assert!("Zm$=".from_base64().is_err()); + assert!("Zg==$".from_base64().is_err()); + } + + #[test] + fn test_from_base64_invalid_padding() { + assert!("Z===".from_base64().is_err()); + } + + #[test] + fn test_base64_random() { + use rand::{thread_rng, Rng}; + + for _ in 0..1000 { + let times = thread_rng().gen_range(1, 100); + let v = thread_rng().gen_iter::().take(times) + .collect::>(); + assert_eq!(v.to_base64(STANDARD) + .from_base64() + .unwrap(), + v); + } + } +} diff --git a/third_party/rust/rustc-serialize/src/collection_impls.rs b/third_party/rust/rustc-serialize/src/collection_impls.rs new file mode 100644 index 000000000000..f8074c911be7 --- /dev/null +++ b/third_party/rust/rustc-serialize/src/collection_impls.rs @@ -0,0 +1,186 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementations of serialization for structures found in libcollections + +use std::hash::Hash; + +use {Decodable, Encodable, Decoder, Encoder, cap_capacity}; +use std::collections::{LinkedList, VecDeque, BTreeMap, BTreeSet, HashMap, HashSet}; + +impl< + T: Encodable +> Encodable for LinkedList { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_seq(self.len(), |s| { + for (i, e) in self.iter().enumerate() { + try!(s.emit_seq_elt(i, |s| e.encode(s))); + } + Ok(()) + }) + } +} + +impl Decodable for LinkedList { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_seq(|d, len| { + let mut list = LinkedList::new(); + for i in 0..len { + list.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); + } + Ok(list) + }) + } +} + +impl Encodable for VecDeque { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_seq(self.len(), |s| { + for (i, e) in self.iter().enumerate() { + try!(s.emit_seq_elt(i, |s| e.encode(s))); + } + Ok(()) + }) + } +} + +impl Decodable for VecDeque { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_seq(|d, len| { + let mut deque: VecDeque = VecDeque::new(); + for i in 0..len { + deque.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); + } + Ok(deque) + }) + } +} + +impl< + K: Encodable + Ord, + V: Encodable +> Encodable for BTreeMap { + fn encode(&self, e: &mut S) -> Result<(), S::Error> { + e.emit_map(self.len(), |e| { + let mut i = 0; + for (key, val) in self.iter() { + try!(e.emit_map_elt_key(i, |e| key.encode(e))); + try!(e.emit_map_elt_val(i, |e| val.encode(e))); + i += 1; + } + Ok(()) + }) + } +} + +impl< + K: Decodable + Ord, + V: Decodable +> Decodable for BTreeMap { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_map(|d, len| { + let mut map = BTreeMap::new(); + for i in 0..len { + let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d))); + let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d))); + map.insert(key, val); + } + Ok(map) + }) + } +} + +impl< + T: Encodable + Ord +> Encodable for BTreeSet { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_seq(self.len(), |s| { + let mut i = 0; + for e in self.iter() { + try!(s.emit_seq_elt(i, |s| e.encode(s))); + i += 1; + } + Ok(()) + }) + } +} + +impl< + T: Decodable + Ord +> Decodable for BTreeSet { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_seq(|d, len| { + let mut set = BTreeSet::new(); + for i in 0..len { + set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); + } + Ok(set) + }) + } +} + +impl Encodable for HashMap + where K: Encodable + Hash + Eq, + V: Encodable, +{ + fn encode(&self, e: &mut E) -> Result<(), E::Error> { + e.emit_map(self.len(), |e| { + let mut i = 0; + for (key, val) in self.iter() { + try!(e.emit_map_elt_key(i, |e| key.encode(e))); + try!(e.emit_map_elt_val(i, |e| val.encode(e))); + i += 1; + } + Ok(()) + }) + } +} + +impl Decodable for HashMap + where K: Decodable + Hash + Eq, + V: Decodable, +{ + fn decode(d: &mut D) -> Result, D::Error> { + d.read_map(|d, len| { + let mut map = HashMap::with_capacity(cap_capacity::<(K, V)>(len)); + for i in 0..len { + let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d))); + let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d))); + map.insert(key, val); + } + Ok(map) + }) + } +} + +impl Encodable for HashSet where T: Encodable + Hash + Eq { + fn encode(&self, s: &mut E) -> Result<(), E::Error> { + s.emit_seq(self.len(), |s| { + let mut i = 0; + for e in self.iter() { + try!(s.emit_seq_elt(i, |s| e.encode(s))); + i += 1; + } + Ok(()) + }) + } +} + +impl Decodable for HashSet where T: Decodable + Hash + Eq, { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_seq(|d, len| { + let mut set = HashSet::with_capacity(cap_capacity::(len)); + for i in 0..len { + set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); + } + Ok(set) + }) + } +} diff --git a/third_party/rust/rustc-serialize/src/hex.rs b/third_party/rust/rustc-serialize/src/hex.rs new file mode 100644 index 000000000000..22d2e5da8d20 --- /dev/null +++ b/third_party/rust/rustc-serialize/src/hex.rs @@ -0,0 +1,221 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// ignore-lexer-test FIXME #15679 + +//! Hex binary-to-text encoding + +pub use self::FromHexError::*; + +use std::fmt; +use std::error; + +/// A trait for converting a value to hexadecimal encoding +pub trait ToHex { + /// Converts the value of `self` to a hex value, returning the owned + /// string. + fn to_hex(&self) -> String; +} + +static CHARS: &'static[u8] = b"0123456789abcdef"; + +impl ToHex for [u8] { + /// Turn a vector of `u8` bytes into a hexadecimal string. + /// + /// # Example + /// + /// ```rust + /// extern crate rustc_serialize; + /// use rustc_serialize::hex::ToHex; + /// + /// fn main () { + /// let str = [52,32].to_hex(); + /// println!("{}", str); + /// } + /// ``` + fn to_hex(&self) -> String { + let mut v = Vec::with_capacity(self.len() * 2); + for &byte in self.iter() { + v.push(CHARS[(byte >> 4) as usize]); + v.push(CHARS[(byte & 0xf) as usize]); + } + + unsafe { + String::from_utf8_unchecked(v) + } + } +} + +impl<'a, T: ?Sized + ToHex> ToHex for &'a T { + fn to_hex(&self) -> String { + (**self).to_hex() + } +} + +/// A trait for converting hexadecimal encoded values +pub trait FromHex { + /// Converts the value of `self`, interpreted as hexadecimal encoded data, + /// into an owned vector of bytes, returning the vector. + fn from_hex(&self) -> Result, FromHexError>; +} + +/// Errors that can occur when decoding a hex encoded string +#[derive(Clone, Copy)] +pub enum FromHexError { + /// The input contained a character not part of the hex format + InvalidHexCharacter(char, usize), + /// The input had an invalid length + InvalidHexLength, +} + +impl fmt::Debug for FromHexError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + InvalidHexCharacter(ch, idx) => + write!(f, "Invalid character '{}' at position {}", ch, idx), + InvalidHexLength => write!(f, "Invalid input length"), + } + } +} + +impl error::Error for FromHexError { + fn description(&self) -> &str { + match *self { + InvalidHexCharacter(_, _) => "invalid character", + InvalidHexLength => "invalid length", + } + } +} + +impl fmt::Display for FromHexError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self, f) + } +} + +impl FromHex for str { + /// Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`) + /// to the byte values it encodes. + /// + /// You can use the `String::from_utf8` function to turn a + /// `Vec` into a string with characters corresponding to those values. + /// + /// # Example + /// + /// This converts a string literal to hexadecimal and back. + /// + /// ```rust + /// extern crate rustc_serialize; + /// use rustc_serialize::hex::{FromHex, ToHex}; + /// + /// fn main () { + /// let hello_str = "Hello, World".as_bytes().to_hex(); + /// println!("{}", hello_str); + /// let bytes = hello_str.from_hex().unwrap(); + /// println!("{:?}", bytes); + /// let result_str = String::from_utf8(bytes).unwrap(); + /// println!("{}", result_str); + /// } + /// ``` + fn from_hex(&self) -> Result, FromHexError> { + // This may be an overestimate if there is any whitespace + let mut b = Vec::with_capacity(self.len() / 2); + let mut modulus = 0; + let mut buf = 08; + + for (idx, byte) in self.bytes().enumerate() { + buf <<= 4; + + match byte { + b'A'...b'F' => buf |= byte - b'A' + 10, + b'a'...b'f' => buf |= byte - b'a' + 10, + b'0'...b'9' => buf |= byte - b'0', + b' '|b'\r'|b'\n'|b'\t' => { + buf >>= 4; + continue + } + _ => { + let ch = self[idx..].chars().next().unwrap(); + return Err(InvalidHexCharacter(ch, idx)) + } + } + + modulus += 1; + if modulus == 2 { + modulus = 0; + b.push(buf); + } + } + + match modulus { + 0 => Ok(b.into_iter().collect()), + _ => Err(InvalidHexLength), + } + } +} + +impl<'a, T: ?Sized + FromHex> FromHex for &'a T { + fn from_hex(&self) -> Result, FromHexError> { + (**self).from_hex() + } +} + +#[cfg(test)] +mod tests { + use hex::{FromHex, ToHex}; + + #[test] + pub fn test_to_hex() { + assert_eq!("foobar".as_bytes().to_hex(), "666f6f626172"); + } + + #[test] + pub fn test_from_hex_okay() { + assert_eq!("666f6f626172".from_hex().unwrap(), + b"foobar"); + assert_eq!("666F6F626172".from_hex().unwrap(), + b"foobar"); + } + + #[test] + pub fn test_from_hex_odd_len() { + assert!("666".from_hex().is_err()); + assert!("66 6".from_hex().is_err()); + } + + #[test] + pub fn test_from_hex_invalid_char() { + assert!("66y6".from_hex().is_err()); + } + + #[test] + pub fn test_from_hex_ignores_whitespace() { + assert_eq!("666f 6f6\r\n26172 ".from_hex().unwrap(), + b"foobar"); + } + + #[test] + pub fn test_to_hex_all_bytes() { + for i in 0..256 { + assert_eq!([i as u8].to_hex(), format!("{:02x}", i)); + } + } + + #[test] + pub fn test_from_hex_all_bytes() { + for i in 0..256 { + let ii: &[u8] = &[i as u8]; + assert_eq!(format!("{:02x}", i).from_hex().unwrap(), + ii); + assert_eq!(format!("{:02X}", i).from_hex().unwrap(), + ii); + } + } +} diff --git a/third_party/rust/rustc-serialize/src/json.rs b/third_party/rust/rustc-serialize/src/json.rs new file mode 100644 index 000000000000..ba5651b6484a --- /dev/null +++ b/third_party/rust/rustc-serialize/src/json.rs @@ -0,0 +1,3992 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Rust JSON serialization library +// Copyright (c) 2011 Google Inc. + +//! JSON parsing and serialization +//! +//! # What is JSON? +//! +//! JSON (JavaScript Object Notation) is a way to write data in Javascript. +//! Like XML, it allows encoding structured data in a text format that can be +//! easily read by humans. Its simple syntax and native compatibility with +//! JavaScript have made it a widely used format. +//! +//! Data types that can be encoded are JavaScript types (see the `Json` enum +//! for more details): +//! +//! * `I64`: equivalent to rust's `i64` +//! * `U64`: equivalent to rust's `u64` +//! * `F64`: equivalent to rust's `f64` +//! * `Boolean`: equivalent to rust's `bool` +//! * `String`: equivalent to rust's `String` +//! * `Array`: equivalent to rust's `Vec`, but also allowing objects of +//! different types in the +//! same array +//! * `Object`: equivalent to rust's `BTreeMap` +//! * `Null` +//! +//! An object is a series of string keys mapping to values, in `"key": value` +//! format. Arrays are enclosed in square brackets ([ ... ]) and objects in +//! curly brackets ({ ... }). A simple JSON document encoding a person, +//! their age, address and phone numbers could look like +//! +//! ```ignore +//! { +//! "FirstName": "John", +//! "LastName": "Doe", +//! "Age": 43, +//! "Address": { +//! "Street": "Downing Street 10", +//! "City": "London", +//! "Country": "Great Britain" +//! }, +//! "PhoneNumbers": [ +//! "+44 1234567", +//! "+44 2345678" +//! ] +//! } +//! ``` +//! +//! # Rust Type-based Encoding and Decoding +//! +//! Rust provides a mechanism for low boilerplate encoding & decoding of values +//! to and from JSON via the serialization API. To be able to encode a piece +//! of data, it must implement the `rustc_serialize::Encodable` trait. To be +//! able to decode a piece of data, it must implement the +//! `rustc_serialize::Decodable` trait. The Rust compiler provides an +//! annotation to automatically generate the code for these traits: +//! `#[derive(RustcDecodable, RustcEncodable)]` +//! +//! The JSON API provides an enum `json::Json` and a trait `ToJson` to encode +//! objects. The `ToJson` trait provides a `to_json` method to convert an +//! object into a `json::Json` value. A `json::Json` value can be encoded as a +//! string or buffer using the functions described above. You can also use the +//! `json::Encoder` object, which implements the `Encoder` trait. +//! +//! When using `ToJson`, the `Encodable` trait implementation is not +//! mandatory. +//! +//! # Examples of use +//! +//! ## Using Autoserialization +//! +//! Create a struct called `TestStruct` and serialize and deserialize it to and +//! from JSON using the serialization API, using the derived serialization code. +//! +//! ```rust +//! extern crate rustc_serialize; +//! use rustc_serialize::json; +//! +//! // Automatically generate `RustcDecodable` and `RustcEncodable` trait +//! // implementations +//! #[derive(RustcDecodable, RustcEncodable)] +//! pub struct TestStruct { +//! data_int: u8, +//! data_str: String, +//! data_vector: Vec, +//! } +//! +//! fn main() { +//! let object = TestStruct { +//! data_int: 1, +//! data_str: "homura".to_string(), +//! data_vector: vec![2,3,4,5], +//! }; +//! +//! // Serialize using `json::encode` +//! let encoded = json::encode(&object).unwrap(); +//! +//! // Deserialize using `json::decode` +//! let decoded: TestStruct = json::decode(&encoded).unwrap(); +//! } +//! ``` +//! +//! ## Using the `ToJson` trait +//! +//! The examples below use the `ToJson` trait to generate the JSON string, +//! which is required for custom mappings. +//! +//! ### Simple example of `ToJson` usage +//! +//! ```rust +//! extern crate rustc_serialize; +//! use rustc_serialize::json::{self, ToJson, Json}; +//! +//! // A custom data structure +//! struct ComplexNum { +//! a: f64, +//! b: f64, +//! } +//! +//! // JSON value representation +//! impl ToJson for ComplexNum { +//! fn to_json(&self) -> Json { +//! Json::String(format!("{}+{}i", self.a, self.b)) +//! } +//! } +//! +//! // Only generate `RustcEncodable` trait implementation +//! #[derive(RustcEncodable)] +//! pub struct ComplexNumRecord { +//! uid: u8, +//! dsc: String, +//! val: Json, +//! } +//! +//! fn main() { +//! let num = ComplexNum { a: 0.0001, b: 12.539 }; +//! let data: String = json::encode(&ComplexNumRecord{ +//! uid: 1, +//! dsc: "test".to_string(), +//! val: num.to_json(), +//! }).unwrap(); +//! println!("data: {}", data); +//! // data: {"uid":1,"dsc":"test","val":"0.0001+12.539i"}; +//! } +//! ``` +//! +//! ### Verbose example of `ToJson` usage +//! +//! ```rust +//! extern crate rustc_serialize; +//! use std::collections::BTreeMap; +//! use rustc_serialize::json::{self, Json, ToJson}; +//! +//! // Only generate `Decodable` trait implementation +//! #[derive(RustcDecodable)] +//! pub struct TestStruct { +//! data_int: u8, +//! data_str: String, +//! data_vector: Vec, +//! } +//! +//! // Specify encoding method manually +//! impl ToJson for TestStruct { +//! fn to_json(&self) -> Json { +//! let mut d = BTreeMap::new(); +//! // All standard types implement `to_json()`, so use it +//! d.insert("data_int".to_string(), self.data_int.to_json()); +//! d.insert("data_str".to_string(), self.data_str.to_json()); +//! d.insert("data_vector".to_string(), self.data_vector.to_json()); +//! Json::Object(d) +//! } +//! } +//! +//! fn main() { +//! // Serialize using `ToJson` +//! let input_data = TestStruct { +//! data_int: 1, +//! data_str: "madoka".to_string(), +//! data_vector: vec![2,3,4,5], +//! }; +//! let json_obj: Json = input_data.to_json(); +//! let json_str: String = json_obj.to_string(); +//! +//! // Deserialize like before +//! let decoded: TestStruct = json::decode(&json_str).unwrap(); +//! } +//! ``` +//! +//! ## Parsing a `str` to `Json` and reading the result +//! +//! ```rust +//! extern crate rustc_serialize; +//! use rustc_serialize::json::Json; +//! +//! fn main() { +//! let data = Json::from_str("{\"foo\": 13, \"bar\": \"baz\"}").unwrap(); +//! println!("data: {}", data); +//! // data: {"bar":"baz","foo":13} +//! println!("object? {}", data.is_object()); +//! // object? true +//! +//! let obj = data.as_object().unwrap(); +//! let foo = obj.get("foo").unwrap(); +//! +//! println!("array? {:?}", foo.as_array()); +//! // array? None +//! println!("u64? {:?}", foo.as_u64()); +//! // u64? Some(13u64) +//! +//! for (key, value) in obj.iter() { +//! println!("{}: {}", key, match *value { +//! Json::U64(v) => format!("{} (u64)", v), +//! Json::String(ref v) => format!("{} (string)", v), +//! _ => format!("other") +//! }); +//! } +//! // bar: baz (string) +//! // foo: 13 (u64) +//! } +//! ``` +//! +//! # The status of this library +//! +//! While this library is the standard way of working with JSON in Rust, +//! there is a next-generation library called Serde that's in the works (it's +//! faster, overcomes some design limitations of rustc-serialize and has more +//! features). You might consider using it when starting a new project or +//! evaluating Rust JSON performance. + +use self::JsonEvent::*; +use self::ErrorCode::*; +use self::ParserError::*; +use self::DecoderError::*; +use self::ParserState::*; +use self::InternalStackElement::*; + +use std::collections::{HashMap, BTreeMap}; +use std::error::Error as StdError; +use std::i64; +use std::io::prelude::*; +use std::mem::swap; +use std::ops::Index; +use std::str::FromStr; +use std::string; +use std::{char, f64, fmt, io, str}; + +use Encodable; + +/// Represents a json value +#[derive(Clone, PartialEq, PartialOrd, Debug)] +pub enum Json { + I64(i64), + U64(u64), + F64(f64), + String(string::String), + Boolean(bool), + Array(self::Array), + Object(self::Object), + Null, +} + +pub type Array = Vec; +pub type Object = BTreeMap; + +pub struct PrettyJson<'a> { inner: &'a Json } + +pub struct AsJson<'a, T: 'a> { inner: &'a T } +pub struct AsPrettyJson<'a, T: 'a> { inner: &'a T, indent: Option } + +/// The errors that can arise while parsing a JSON stream. +#[derive(Clone, Copy, PartialEq)] +pub enum ErrorCode { + InvalidSyntax, + InvalidNumber, + EOFWhileParsingObject, + EOFWhileParsingArray, + EOFWhileParsingValue, + EOFWhileParsingString, + KeyMustBeAString, + ExpectedColon, + TrailingCharacters, + TrailingComma, + InvalidEscape, + InvalidUnicodeCodePoint, + LoneLeadingSurrogateInHexEscape, + UnexpectedEndOfHexEscape, + UnrecognizedHex, + NotFourDigit, + ControlCharacterInString, + NotUtf8, +} + +#[derive(Debug)] +pub enum ParserError { + /// msg, line, col + SyntaxError(ErrorCode, usize, usize), + IoError(io::Error), +} + +impl PartialEq for ParserError { + fn eq(&self, other: &ParserError) -> bool { + match (self, other) { + (&SyntaxError(msg0, line0, col0), &SyntaxError(msg1, line1, col1)) => + msg0 == msg1 && line0 == line1 && col0 == col1, + (&IoError(_), _) => false, + (_, &IoError(_)) => false, + } + } +} + +// Builder and Parser have the same errors. +pub type BuilderError = ParserError; + +#[derive(PartialEq, Debug)] +pub enum DecoderError { + ParseError(ParserError), + ExpectedError(string::String, string::String), + MissingFieldError(string::String), + UnknownVariantError(string::String), + ApplicationError(string::String), + EOF, +} + +#[derive(Copy, Debug)] +pub enum EncoderError { + FmtError(fmt::Error), + BadHashmapKey, +} + +impl PartialEq for EncoderError { + fn eq(&self, other: &EncoderError) -> bool { + match (*self, *other) { + (EncoderError::FmtError(_), EncoderError::FmtError(_)) => true, + (EncoderError::BadHashmapKey, EncoderError::BadHashmapKey) => true, + _ => false, + } + } +} + +impl Clone for EncoderError { + fn clone(&self) -> Self { *self } +} + +/// Returns a readable error string for a given error code. +pub fn error_str(error: ErrorCode) -> &'static str { + match error { + InvalidSyntax => "invalid syntax", + InvalidNumber => "invalid number", + EOFWhileParsingObject => "EOF While parsing object", + EOFWhileParsingArray => "EOF While parsing array", + EOFWhileParsingValue => "EOF While parsing value", + EOFWhileParsingString => "EOF While parsing string", + KeyMustBeAString => "key must be a string", + ExpectedColon => "expected `:`", + TrailingCharacters => "trailing characters", + TrailingComma => "trailing comma", + InvalidEscape => "invalid escape", + UnrecognizedHex => "invalid \\u{ esc}ape (unrecognized hex)", + NotFourDigit => "invalid \\u{ esc}ape (not four digits)", + ControlCharacterInString => "unescaped control character in string", + NotUtf8 => "contents not utf-8", + InvalidUnicodeCodePoint => "invalid Unicode code point", + LoneLeadingSurrogateInHexEscape => "lone leading surrogate in hex escape", + UnexpectedEndOfHexEscape => "unexpected end of hex escape", + } +} + +/// Shortcut function to decode a JSON `&str` into an object +pub fn decode(s: &str) -> DecodeResult { + let json = match Json::from_str(s) { + Ok(x) => x, + Err(e) => return Err(ParseError(e)) + }; + + let mut decoder = Decoder::new(json); + ::Decodable::decode(&mut decoder) +} + +/// Shortcut function to encode a `T` into a JSON `String` +pub fn encode(object: &T) -> EncodeResult { + let mut s = String::new(); + { + let mut encoder = Encoder::new(&mut s); + try!(object.encode(&mut encoder)); + } + Ok(s) +} + +impl fmt::Debug for ErrorCode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + error_str(*self).fmt(f) + } +} + +impl StdError for DecoderError { + fn description(&self) -> &str { "decoder error" } + fn cause(&self) -> Option<&StdError> { + match *self { + DecoderError::ParseError(ref e) => Some(e), + _ => None, + } + } +} + +impl fmt::Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self, f) + } +} + +impl From for DecoderError { + fn from(err: ParserError) -> DecoderError { + ParseError(From::from(err)) + } +} + +impl StdError for ParserError { + fn description(&self) -> &str { "failed to parse json" } +} + +impl fmt::Display for ParserError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self, f) + } +} + +impl From for ParserError { + fn from(err: io::Error) -> ParserError { + IoError(err) + } +} + +impl StdError for EncoderError { + fn description(&self) -> &str { "encoder error" } +} + +impl fmt::Display for EncoderError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self, f) + } +} + +impl From for EncoderError { + fn from(err: fmt::Error) -> EncoderError { EncoderError::FmtError(err) } +} + +pub type EncodeResult = Result; +pub type DecodeResult = Result; + +fn escape_str(wr: &mut fmt::Write, v: &str) -> EncodeResult<()> { + try!(wr.write_str("\"")); + + let mut start = 0; + + for (i, byte) in v.bytes().enumerate() { + let escaped = match byte { + b'"' => "\\\"", + b'\\' => "\\\\", + b'\x00' => "\\u0000", + b'\x01' => "\\u0001", + b'\x02' => "\\u0002", + b'\x03' => "\\u0003", + b'\x04' => "\\u0004", + b'\x05' => "\\u0005", + b'\x06' => "\\u0006", + b'\x07' => "\\u0007", + b'\x08' => "\\b", + b'\t' => "\\t", + b'\n' => "\\n", + b'\x0b' => "\\u000b", + b'\x0c' => "\\f", + b'\r' => "\\r", + b'\x0e' => "\\u000e", + b'\x0f' => "\\u000f", + b'\x10' => "\\u0010", + b'\x11' => "\\u0011", + b'\x12' => "\\u0012", + b'\x13' => "\\u0013", + b'\x14' => "\\u0014", + b'\x15' => "\\u0015", + b'\x16' => "\\u0016", + b'\x17' => "\\u0017", + b'\x18' => "\\u0018", + b'\x19' => "\\u0019", + b'\x1a' => "\\u001a", + b'\x1b' => "\\u001b", + b'\x1c' => "\\u001c", + b'\x1d' => "\\u001d", + b'\x1e' => "\\u001e", + b'\x1f' => "\\u001f", + b'\x7f' => "\\u007f", + _ => { continue; } + }; + + if start < i { + try!(wr.write_str(&v[start..i])); + } + + try!(wr.write_str(escaped)); + + start = i + 1; + } + + if start != v.len() { + try!(wr.write_str(&v[start..])); + } + + try!(wr.write_str("\"")); + Ok(()) +} + +fn escape_char(writer: &mut fmt::Write, v: char) -> EncodeResult<()> { + let mut buf = [0; 4]; + let _ = write!(&mut &mut buf[..], "{}", v); + let buf = unsafe { str::from_utf8_unchecked(&buf[..v.len_utf8()]) }; + escape_str(writer, buf) +} + +fn spaces(wr: &mut fmt::Write, n: u32) -> EncodeResult<()> { + let mut n = n as usize; + const BUF: &'static str = " "; + + while n >= BUF.len() { + try!(wr.write_str(BUF)); + n -= BUF.len(); + } + + if n > 0 { + try!(wr.write_str(&BUF[..n])); + } + Ok(()) +} + +fn fmt_number_or_null(v: f64) -> string::String { + use std::num::FpCategory::{Nan, Infinite}; + + match v.classify() { + Nan | Infinite => "null".to_string(), + _ => { + let s = v.to_string(); + if s.contains(".") {s} else {s + ".0"} + } + } +} + +macro_rules! emit_enquoted_if_mapkey { + ($enc:ident,$e:expr) => { + if $enc.is_emitting_map_key { + try!(write!($enc.writer, "\"{}\"", $e)); + Ok(()) + } else { + try!(write!($enc.writer, "{}", $e)); + Ok(()) + } + } +} + +enum EncodingFormat { + Compact, + Pretty { + curr_indent: u32, + indent: u32 + } +} + +/// A structure for implementing serialization to JSON. +pub struct Encoder<'a> { + writer: &'a mut (fmt::Write+'a), + format : EncodingFormat, + is_emitting_map_key: bool, +} + +impl<'a> Encoder<'a> { + /// Creates a new encoder whose output will be written in human-readable + /// JSON to the specified writer + pub fn new_pretty(writer: &'a mut fmt::Write) -> Encoder<'a> { + Encoder { + writer: writer, + format: EncodingFormat::Pretty { + curr_indent: 0, + indent: 2, + }, + is_emitting_map_key: false, + } + } + + /// Creates a new encoder whose output will be written in compact + /// JSON to the specified writer + pub fn new(writer: &'a mut fmt::Write) -> Encoder<'a> { + Encoder { + writer: writer, + format: EncodingFormat::Compact, + is_emitting_map_key: false, + } + } + + /// Set the number of spaces to indent for each level. + /// This is safe to set during encoding. + pub fn set_indent(&mut self, new_indent: u32) -> Result<(), ()> { + if let EncodingFormat::Pretty{ref mut curr_indent, ref mut indent} = self.format { + // self.indent very well could be 0 so we need to use checked division. + let level = curr_indent.checked_div(*indent).unwrap_or(0); + *indent = new_indent; + *curr_indent = level * *indent; + Ok(()) + } else { + Err(()) + } + } +} + +impl<'a> ::Encoder for Encoder<'a> { + type Error = EncoderError; + + fn emit_nil(&mut self) -> EncodeResult<()> { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + try!(write!(self.writer, "null")); + Ok(()) + } + + fn emit_usize(&mut self, v: usize) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_u64(&mut self, v: u64) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_u32(&mut self, v: u32) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_u16(&mut self, v: u16) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_u8(&mut self, v: u8) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + + fn emit_isize(&mut self, v: isize) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_i64(&mut self, v: i64) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_i32(&mut self, v: i32) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_i16(&mut self, v: i16) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + fn emit_i8(&mut self, v: i8) -> EncodeResult<()> { emit_enquoted_if_mapkey!(self, v) } + + fn emit_bool(&mut self, v: bool) -> EncodeResult<()> { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if v { + try!(write!(self.writer, "true")); + } else { + try!(write!(self.writer, "false")); + } + Ok(()) + } + + fn emit_f64(&mut self, v: f64) -> EncodeResult<()> { + emit_enquoted_if_mapkey!(self, fmt_number_or_null(v)) + } + fn emit_f32(&mut self, v: f32) -> EncodeResult<()> { + self.emit_f64(v as f64) + } + + fn emit_char(&mut self, v: char) -> EncodeResult<()> { + escape_char(self.writer, v) + } + fn emit_str(&mut self, v: &str) -> EncodeResult<()> { + escape_str(self.writer, v) + } + + fn emit_enum(&mut self, _name: &str, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + f(self) + } + + fn emit_enum_variant(&mut self, + name: &str, + _id: usize, + cnt: usize, + f: F) + -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + // enums are encoded as strings or objects + // Bunny => "Bunny" + // Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]} + if cnt == 0 { + escape_str(self.writer, name) + } else { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + try!(write!(self.writer, "{{\n")); + *curr_indent += indent; + try!(spaces(self.writer, *curr_indent)); + try!(write!(self.writer, "\"variant\": ")); + try!(escape_str(self.writer, name)); + try!(write!(self.writer, ",\n")); + try!(spaces(self.writer, *curr_indent)); + try!(write!(self.writer, "\"fields\": [\n")); + *curr_indent += indent; + } else { + try!(write!(self.writer, "{{\"variant\":")); + try!(escape_str(self.writer, name)); + try!(write!(self.writer, ",\"fields\":[")); + } + try!(f(self)); + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + *curr_indent -= indent; + try!(write!(self.writer, "\n")); + try!(spaces(self.writer, *curr_indent)); + *curr_indent -= indent; + try!(write!(self.writer, "]\n")); + try!(spaces(self.writer, *curr_indent)); + try!(write!(self.writer, "}}")); + } else { + try!(write!(self.writer, "]}}")); + } + Ok(()) + } + } + + fn emit_enum_variant_arg(&mut self, idx: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if idx != 0 { + try!(write!(self.writer, ",")); + if let EncodingFormat::Pretty{..} = self.format { + try!(write!(self.writer, "\n")); + } + } + if let EncodingFormat::Pretty{curr_indent, ..} = self.format { + try!(spaces(self.writer, curr_indent)); + } + f(self) + } + + fn emit_enum_struct_variant(&mut self, + name: &str, + id: usize, + cnt: usize, + f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + self.emit_enum_variant(name, id, cnt, f) + } + + fn emit_enum_struct_variant_field(&mut self, + _: &str, + idx: usize, + f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + self.emit_enum_variant_arg(idx, f) + } + + + fn emit_struct(&mut self, _: &str, len: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if len == 0 { + try!(write!(self.writer, "{{}}")); + } else { + try!(write!(self.writer, "{{")); + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + *curr_indent += indent; + } + try!(f(self)); + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + *curr_indent -= indent; + try!(write!(self.writer, "\n")); + try!(spaces(self.writer, *curr_indent)); + } + try!(write!(self.writer, "}}")); + } + Ok(()) + } + + fn emit_struct_field(&mut self, name: &str, idx: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if idx != 0 { + try!(write!(self.writer, ",")); + } + if let EncodingFormat::Pretty{curr_indent, ..} = self.format { + try!(write!(self.writer, "\n")); + try!(spaces(self.writer, curr_indent)); + } + try!(escape_str(self.writer, name)); + if let EncodingFormat::Pretty{..} = self.format { + try!(write!(self.writer, ": ")); + } else { + try!(write!(self.writer, ":")); + } + f(self) + } + + fn emit_tuple(&mut self, len: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + self.emit_seq(len, f) + } + fn emit_tuple_arg(&mut self, idx: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + self.emit_seq_elt(idx, f) + } + + fn emit_tuple_struct(&mut self, _: &str, len: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + self.emit_seq(len, f) + } + fn emit_tuple_struct_arg(&mut self, idx: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + self.emit_seq_elt(idx, f) + } + + fn emit_option(&mut self, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + f(self) + } + fn emit_option_none(&mut self) -> EncodeResult<()> { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + self.emit_nil() + } + fn emit_option_some(&mut self, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + f(self) + } + + fn emit_seq(&mut self, len: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if len == 0 { + try!(write!(self.writer, "[]")); + } else { + try!(write!(self.writer, "[")); + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + *curr_indent += indent; + } + try!(f(self)); + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + *curr_indent -= indent; + try!(write!(self.writer, "\n")); + try!(spaces(self.writer, *curr_indent)); + } + try!(write!(self.writer, "]")); + } + Ok(()) + } + + fn emit_seq_elt(&mut self, idx: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if idx != 0 { + try!(write!(self.writer, ",")); + } + if let EncodingFormat::Pretty{ref mut curr_indent, ..} = self.format { + try!(write!(self.writer, "\n")); + try!(spaces(self.writer, *curr_indent)); + } + f(self) + } + + fn emit_map(&mut self, len: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if len == 0 { + try!(write!(self.writer, "{{}}")); + } else { + try!(write!(self.writer, "{{")); + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + *curr_indent += indent; + } + try!(f(self)); + if let EncodingFormat::Pretty{ref mut curr_indent, indent} = self.format { + *curr_indent -= indent; + try!(write!(self.writer, "\n")); + try!(spaces(self.writer, *curr_indent)); + } + try!(write!(self.writer, "}}")); + } + Ok(()) + } + + fn emit_map_elt_key(&mut self, idx: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if idx != 0 { + try!(write!(self.writer, ",")); + } + if let EncodingFormat::Pretty{curr_indent, ..} = self.format { + try!(write!(self.writer, "\n")); + try!(spaces(self.writer, curr_indent)); + } + self.is_emitting_map_key = true; + try!(f(self)); + self.is_emitting_map_key = false; + Ok(()) + } + + fn emit_map_elt_val(&mut self, _idx: usize, f: F) -> EncodeResult<()> where + F: FnOnce(&mut Encoder<'a>) -> EncodeResult<()>, + { + if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } + if let EncodingFormat::Pretty{..} = self.format { + try!(write!(self.writer, ": ")); + } else { + try!(write!(self.writer, ":")); + } + f(self) + } +} + +impl Encodable for Json { + fn encode(&self, e: &mut S) -> Result<(), S::Error> { + match *self { + Json::I64(v) => v.encode(e), + Json::U64(v) => v.encode(e), + Json::F64(v) => v.encode(e), + Json::String(ref v) => v.encode(e), + Json::Boolean(v) => v.encode(e), + Json::Array(ref v) => v.encode(e), + Json::Object(ref v) => v.encode(e), + Json::Null => e.emit_nil(), + } + } +} + +/// Create an `AsJson` wrapper which can be used to print a value as JSON +/// on-the-fly via `write!` +pub fn as_json(t: &T) -> AsJson { + AsJson { inner: t } +} + +/// Create an `AsPrettyJson` wrapper which can be used to print a value as JSON +/// on-the-fly via `write!` +pub fn as_pretty_json(t: &T) -> AsPrettyJson { + AsPrettyJson { inner: t, indent: None } +} + +impl Json { + /// Decodes a json value from an `&mut io::Read` + pub fn from_reader(rdr: &mut io::Read) -> Result { + let contents = { + let mut c = Vec::new(); + try!(rdr.read_to_end(&mut c)); + c + }; + let s = match str::from_utf8(&contents).ok() { + Some(s) => s, + _ => return Err(SyntaxError(NotUtf8, 0, 0)) + }; + let mut builder = Builder::new(s.chars()); + builder.build() + } + + /// Decodes a json value from a string + pub fn from_str(s: &str) -> Result { + let mut builder = Builder::new(s.chars()); + builder.build() + } + + /// Borrow this json object as a pretty object to generate a pretty + /// representation for it via `Display`. + pub fn pretty(&self) -> PrettyJson { + PrettyJson { inner: self } + } + + /// If the Json value is an Object, returns the value associated with the provided key. + /// Otherwise, returns None. + pub fn find<'a>(&'a self, key: &str) -> Option<&'a Json>{ + match self { + &Json::Object(ref map) => map.get(key), + _ => None + } + } + + /// Attempts to get a nested Json Object for each key in `keys`. + /// If any key is found not to exist, find_path will return None. + /// Otherwise, it will return the Json value associated with the final key. + pub fn find_path<'a>(&'a self, keys: &[&str]) -> Option<&'a Json>{ + let mut target = self; + for key in keys.iter() { + match target.find(*key) { + Some(t) => { target = t; }, + None => return None + } + } + Some(target) + } + + /// If the Json value is an Object, performs a depth-first search until + /// a value associated with the provided key is found. If no value is found + /// or the Json value is not an Object, returns None. + pub fn search<'a>(&'a self, key: &str) -> Option<&'a Json> { + match self { + &Json::Object(ref map) => { + match map.get(key) { + Some(json_value) => Some(json_value), + None => { + for (_, v) in map.iter() { + match v.search(key) { + x if x.is_some() => return x, + _ => () + } + } + None + } + } + }, + _ => None + } + } + + /// Returns true if the Json value is an Object. Returns false otherwise. + pub fn is_object<'a>(&'a self) -> bool { + self.as_object().is_some() + } + + /// If the Json value is an Object, returns a reference to the associated BTreeMap. + /// Returns None otherwise. + pub fn as_object<'a>(&'a self) -> Option<&'a Object> { + match self { + &Json::Object(ref map) => Some(map), + _ => None + } + } + + /// If the Json value is an Object, returns a mutable reference to the associated BTreeMap. + /// Returns None otherwise. + pub fn as_object_mut<'a>(&'a mut self) -> Option<&'a mut Object> { + match self { + &mut Json::Object(ref mut map) => Some(map), + _ => None + } + } + + /// If the Json value is an Object, returns the associated BTreeMap. + /// Returns None otherwise. + pub fn into_object(self) -> Option { + match self { + Json::Object(map) => Some(map), + _ => None + } + } + + /// Returns true if the Json value is an Array. Returns false otherwise. + pub fn is_array<'a>(&'a self) -> bool { + self.as_array().is_some() + } + + /// If the Json value is an Array, returns a reference to the associated vector. + /// Returns None otherwise. + pub fn as_array<'a>(&'a self) -> Option<&'a Array> { + match self { + &Json::Array(ref array) => Some(&*array), + _ => None + } + } + + /// If the Json value is an Array, returns a mutable reference to the associated vector. + /// Returns None otherwise. + pub fn as_array_mut<'a>(&'a mut self) -> Option<&'a mut Array> { + match self { + &mut Json::Array(ref mut list) => Some(list), + _ => None + } + } + + /// If the Json value is an Array, returns the associated vector. + /// Returns None otherwise. + pub fn into_array(self) -> Option { + match self { + Json::Array(array) => Some(array), + _ => None + } + } + + /// Returns true if the Json value is a String. Returns false otherwise. + pub fn is_string<'a>(&'a self) -> bool { + self.as_string().is_some() + } + + /// If the Json value is a String, returns the associated str. + /// Returns None otherwise. + pub fn as_string<'a>(&'a self) -> Option<&'a str> { + match *self { + Json::String(ref s) => Some(&s), + _ => None + } + } + + /// Returns true if the Json value is a Number. Returns false otherwise. + pub fn is_number(&self) -> bool { + match *self { + Json::I64(_) | Json::U64(_) | Json::F64(_) => true, + _ => false, + } + } + + /// Returns true if the Json value is a i64. Returns false otherwise. + pub fn is_i64(&self) -> bool { + match *self { + Json::I64(_) => true, + _ => false, + } + } + + /// Returns true if the Json value is a u64. Returns false otherwise. + pub fn is_u64(&self) -> bool { + match *self { + Json::U64(_) => true, + _ => false, + } + } + + /// Returns true if the Json value is a f64. Returns false otherwise. + pub fn is_f64(&self) -> bool { + match *self { + Json::F64(_) => true, + _ => false, + } + } + + /// If the Json value is a number, return or cast it to a i64. + /// Returns None otherwise. + pub fn as_i64(&self) -> Option { + match *self { + Json::I64(n) => Some(n), + Json::U64(n) if n >= i64::MAX as u64 => None, + Json::U64(n) => Some(n as i64), + _ => None + } + } + + /// If the Json value is a number, return or cast it to a u64. + /// Returns None otherwise. + pub fn as_u64(&self) -> Option { + match *self { + Json::I64(n) if n >= 0 => Some(n as u64), + Json::U64(n) => Some(n), + _ => None + } + } + + /// If the Json value is a number, return or cast it to a f64. + /// Returns None otherwise. + pub fn as_f64(&self) -> Option { + match *self { + Json::I64(n) => Some(n as f64), + Json::U64(n) => Some(n as f64), + Json::F64(n) => Some(n), + _ => None + } + } + + /// Returns true if the Json value is a Boolean. Returns false otherwise. + pub fn is_boolean(&self) -> bool { + self.as_boolean().is_some() + } + + /// If the Json value is a Boolean, returns the associated bool. + /// Returns None otherwise. + pub fn as_boolean(&self) -> Option { + match self { + &Json::Boolean(b) => Some(b), + _ => None + } + } + + /// Returns true if the Json value is a Null. Returns false otherwise. + pub fn is_null(&self) -> bool { + self.as_null().is_some() + } + + /// If the Json value is a Null, returns (). + /// Returns None otherwise. + pub fn as_null(&self) -> Option<()> { + match self { + &Json::Null => Some(()), + _ => None + } + } +} + +impl<'a> Index<&'a str> for Json { + type Output = Json; + + fn index(&self, idx: &str) -> &Json { + self.find(idx).unwrap() + } +} + +impl Index for Json { + type Output = Json; + + fn index<'a>(&'a self, idx: usize) -> &'a Json { + match self { + &Json::Array(ref v) => &v[idx], + _ => panic!("can only index Json with usize if it is an array") + } + } +} + +/// The output of the streaming parser. +#[derive(PartialEq, Debug)] +pub enum JsonEvent { + ObjectStart, + ObjectEnd, + ArrayStart, + ArrayEnd, + BooleanValue(bool), + I64Value(i64), + U64Value(u64), + F64Value(f64), + StringValue(string::String), + NullValue, + Error(ParserError), +} + +#[derive(PartialEq, Debug)] +enum ParserState { + // Parse a value in an array, true means first element. + ParseArray(bool), + // Parse ',' or ']' after an element in an array. + ParseArrayComma, + // Parse a key:value in an object, true means first element. + ParseObject(bool), + // Parse ',' or ']' after an element in an object. + ParseObjectComma, + // Initial state. + ParseStart, + // Expecting the stream to end. + ParseBeforeFinish, + // Parsing can't continue. + ParseFinished, +} + +/// A Stack represents the current position of the parser in the logical +/// structure of the JSON stream. +/// For example foo.bar[3].x +pub struct Stack { + stack: Vec, + str_buffer: Vec, +} + +/// StackElements compose a Stack. +/// For example, Key("foo"), Key("bar"), Index(3) and Key("x") are the +/// StackElements compositing the stack that represents foo.bar[3].x +#[derive(PartialEq, Clone, Debug)] +pub enum StackElement<'l> { + Index(u32), + Key(&'l str), +} + +// Internally, Key elements are stored as indices in a buffer to avoid +// allocating a string for every member of an object. +#[derive(PartialEq, Clone, Debug)] +enum InternalStackElement { + InternalIndex(u32), + InternalKey(u16, u16), // start, size +} + +impl Stack { + pub fn new() -> Stack { + Stack { stack: Vec::new(), str_buffer: Vec::new() } + } + + /// Returns The number of elements in the Stack. + pub fn len(&self) -> usize { self.stack.len() } + + /// Returns true if the stack is empty. + pub fn is_empty(&self) -> bool { self.stack.is_empty() } + + /// Provides access to the StackElement at a given index. + /// lower indices are at the bottom of the stack while higher indices are + /// at the top. + pub fn get<'l>(&'l self, idx: usize) -> StackElement<'l> { + match self.stack[idx] { + InternalIndex(i) => StackElement::Index(i), + InternalKey(start, size) => { + StackElement::Key(str::from_utf8( + &self.str_buffer[start as usize .. start as usize + size as usize]).unwrap()) + } + } + } + + /// Compares this stack with an array of StackElements. + pub fn is_equal_to(&self, rhs: &[StackElement]) -> bool { + if self.stack.len() != rhs.len() { return false; } + for i in 0..rhs.len() { + if self.get(i) != rhs[i] { return false; } + } + return true; + } + + /// Returns true if the bottom-most elements of this stack are the same as + /// the ones passed as parameter. + pub fn starts_with(&self, rhs: &[StackElement]) -> bool { + if self.stack.len() < rhs.len() { return false; } + for i in 0..rhs.len() { + if self.get(i) != rhs[i] { return false; } + } + return true; + } + + /// Returns true if the top-most elements of this stack are the same as + /// the ones passed as parameter. + pub fn ends_with(&self, rhs: &[StackElement]) -> bool { + if self.stack.len() < rhs.len() { return false; } + let offset = self.stack.len() - rhs.len(); + for i in 0..rhs.len() { + if self.get(i + offset) != rhs[i] { return false; } + } + return true; + } + + /// Returns the top-most element (if any). + pub fn top<'l>(&'l self) -> Option> { + return match self.stack.last() { + None => None, + Some(&InternalIndex(i)) => Some(StackElement::Index(i)), + Some(&InternalKey(start, size)) => { + Some(StackElement::Key(str::from_utf8( + &self.str_buffer[start as usize .. (start+size) as usize] + ).unwrap())) + } + } + } + + // Used by Parser to insert Key elements at the top of the stack. + fn push_key(&mut self, key: string::String) { + self.stack.push(InternalKey(self.str_buffer.len() as u16, key.len() as u16)); + for c in key.as_bytes().iter() { + self.str_buffer.push(*c); + } + } + + // Used by Parser to insert Index elements at the top of the stack. + fn push_index(&mut self, index: u32) { + self.stack.push(InternalIndex(index)); + } + + // Used by Parser to remove the top-most element of the stack. + fn pop(&mut self) { + assert!(!self.is_empty()); + match *self.stack.last().unwrap() { + InternalKey(_, sz) => { + let new_size = self.str_buffer.len() - sz as usize; + self.str_buffer.truncate(new_size); + } + InternalIndex(_) => {} + } + self.stack.pop(); + } + + // Used by Parser to test whether the top-most element is an index. + fn last_is_index(&self) -> bool { + if self.is_empty() { return false; } + return match *self.stack.last().unwrap() { + InternalIndex(_) => true, + _ => false, + } + } + + // Used by Parser to increment the index of the top-most element. + fn bump_index(&mut self) { + let len = self.stack.len(); + let idx = match *self.stack.last().unwrap() { + InternalIndex(i) => { i + 1 } + _ => { panic!(); } + }; + self.stack[len - 1] = InternalIndex(idx); + } +} + +/// A streaming JSON parser implemented as an iterator of JsonEvent, consuming +/// an iterator of char. +pub struct Parser { + rdr: T, + ch: Option, + line: usize, + col: usize, + // We maintain a stack representing where we are in the logical structure + // of the JSON stream. + stack: Stack, + // A state machine is kept to make it possible to interrupt and resume parsing. + state: ParserState, +} + +impl> Iterator for Parser { + type Item = JsonEvent; + + fn next(&mut self) -> Option { + if self.state == ParseFinished { + return None; + } + + if self.state == ParseBeforeFinish { + self.parse_whitespace(); + // Make sure there is no trailing characters. + if self.eof() { + self.state = ParseFinished; + return None; + } else { + return Some(self.error_event(TrailingCharacters)); + } + } + + return Some(self.parse()); + } +} + +impl> Parser { + /// Creates the JSON parser. + pub fn new(rdr: T) -> Parser { + let mut p = Parser { + rdr: rdr, + ch: Some('\x00'), + line: 1, + col: 0, + stack: Stack::new(), + state: ParseStart, + }; + p.bump(); + return p; + } + + /// Provides access to the current position in the logical structure of the + /// JSON stream. + pub fn stack<'l>(&'l self) -> &'l Stack { + return &self.stack; + } + + fn eof(&self) -> bool { self.ch.is_none() } + fn ch_or_null(&self) -> char { self.ch.unwrap_or('\x00') } + fn bump(&mut self) { + self.ch = self.rdr.next(); + + if self.ch_is('\n') { + self.line += 1; + self.col = 1; + } else { + self.col += 1; + } + } + + fn next_char(&mut self) -> Option { + self.bump(); + self.ch + } + fn ch_is(&self, c: char) -> bool { + self.ch == Some(c) + } + + fn error(&self, reason: ErrorCode) -> Result { + Err(SyntaxError(reason, self.line, self.col)) + } + + fn parse_whitespace(&mut self) { + while self.ch_is(' ') || + self.ch_is('\n') || + self.ch_is('\t') || + self.ch_is('\r') { self.bump(); } + } + + fn parse_number(&mut self) -> JsonEvent { + let mut neg = false; + + if self.ch_is('-') { + self.bump(); + neg = true; + } + + let res = match self.parse_u64() { + Ok(res) => res, + Err(e) => { return Error(e); } + }; + + if self.ch_is('.') || self.ch_is('e') || self.ch_is('E') { + let mut res = res as f64; + + if self.ch_is('.') { + res = match self.parse_decimal(res) { + Ok(res) => res, + Err(e) => { return Error(e); } + }; + } + + if self.ch_is('e') || self.ch_is('E') { + res = match self.parse_exponent(res) { + Ok(res) => res, + Err(e) => { return Error(e); } + }; + } + + if neg { + res *= -1.0; + } + + F64Value(res) + } else { + if neg { + // Make sure we don't underflow. + if res > (i64::MAX as u64) + 1 { + Error(SyntaxError(InvalidNumber, self.line, self.col)) + } else if res == 0 { + I64Value(res as i64) + } else { + I64Value((!res + 1) as i64) + } + } else { + U64Value(res) + } + } + } + + fn parse_u64(&mut self) -> Result { + let mut accum: u64 = 0; + + match self.ch_or_null() { + '0' => { + self.bump(); + + // A leading '0' must be the only digit before the decimal point. + match self.ch_or_null() { + '0' ... '9' => return self.error(InvalidNumber), + _ => () + } + }, + '1' ... '9' => { + while !self.eof() { + match self.ch_or_null() { + c @ '0' ... '9' => { + macro_rules! try_or_invalid { + ($e: expr) => { + match $e { + Some(v) => v, + None => return self.error(InvalidNumber) + } + } + } + accum = try_or_invalid!(accum.checked_mul(10)); + accum = try_or_invalid!(accum.checked_add((c as u64) - ('0' as u64))); + + self.bump(); + } + _ => break, + } + } + } + _ => return self.error(InvalidNumber), + } + + Ok(accum) + } + + fn parse_decimal(&mut self, mut res: f64) -> Result { + self.bump(); + + // Make sure a digit follows the decimal place. + match self.ch_or_null() { + '0' ... '9' => (), + _ => return self.error(InvalidNumber) + } + + let mut dec = 1.0; + while !self.eof() { + match self.ch_or_null() { + c @ '0' ... '9' => { + dec /= 10.0; + res += (((c as isize) - ('0' as isize)) as f64) * dec; + self.bump(); + } + _ => break, + } + } + + Ok(res) + } + + fn parse_exponent(&mut self, mut res: f64) -> Result { + self.bump(); + + let mut exp = 0; + let mut neg_exp = false; + + if self.ch_is('+') { + self.bump(); + } else if self.ch_is('-') { + self.bump(); + neg_exp = true; + } + + // Make sure a digit follows the exponent place. + match self.ch_or_null() { + '0' ... '9' => (), + _ => return self.error(InvalidNumber) + } + while !self.eof() { + match self.ch_or_null() { + c @ '0' ... '9' => { + exp *= 10; + exp += (c as usize) - ('0' as usize); + + self.bump(); + } + _ => break + } + } + + let exp = 10_f64.powi(exp as i32); + if neg_exp { + res /= exp; + } else { + res *= exp; + } + + Ok(res) + } + + fn decode_hex_escape(&mut self) -> Result { + let mut i = 0; + let mut n = 0; + while i < 4 { + self.bump(); + n = match self.ch_or_null() { + c @ '0' ... '9' => n * 16 + ((c as u16) - ('0' as u16)), + c @ 'a' ... 'f' => n * 16 + (10 + (c as u16) - ('a' as u16)), + c @ 'A' ... 'F' => n * 16 + (10 + (c as u16) - ('A' as u16)), + _ => return self.error(InvalidEscape) + }; + + i += 1; + } + + Ok(n) + } + + fn parse_str(&mut self) -> Result { + let mut escape = false; + let mut res = string::String::new(); + + loop { + self.bump(); + if self.eof() { + return self.error(EOFWhileParsingString); + } + + if escape { + match self.ch_or_null() { + '"' => res.push('"'), + '\\' => res.push('\\'), + '/' => res.push('/'), + 'b' => res.push('\x08'), + 'f' => res.push('\x0c'), + 'n' => res.push('\n'), + 'r' => res.push('\r'), + 't' => res.push('\t'), + 'u' => match try!(self.decode_hex_escape()) { + 0xDC00 ... 0xDFFF => { + return self.error(LoneLeadingSurrogateInHexEscape) + } + + // Non-BMP characters are encoded as a sequence of + // two hex escapes, representing UTF-16 surrogates. + n1 @ 0xD800 ... 0xDBFF => { + match (self.next_char(), self.next_char()) { + (Some('\\'), Some('u')) => (), + _ => return self.error(UnexpectedEndOfHexEscape), + } + + let n2 = try!(self.decode_hex_escape()); + if n2 < 0xDC00 || n2 > 0xDFFF { + return self.error(LoneLeadingSurrogateInHexEscape) + } + let c = (((n1 - 0xD800) as u32) << 10 | + (n2 - 0xDC00) as u32) + 0x1_0000; + res.push(char::from_u32(c).unwrap()); + } + + n => match char::from_u32(n as u32) { + Some(c) => res.push(c), + None => return self.error(InvalidUnicodeCodePoint), + }, + }, + _ => return self.error(InvalidEscape), + } + escape = false; + } else if self.ch_is('\\') { + escape = true; + } else { + match self.ch { + Some('"') => { + self.bump(); + return Ok(res); + }, + Some(c) if c <= '\u{1F}' => + return self.error(ControlCharacterInString), + Some(c) => res.push(c), + None => unreachable!() + } + } + } + } + + // Invoked at each iteration, consumes the stream until it has enough + // information to return a JsonEvent. + // Manages an internal state so that parsing can be interrupted and resumed. + // Also keeps track of the position in the logical structure of the json + // stream int the form of a stack that can be queried by the user using the + // stack() method. + fn parse(&mut self) -> JsonEvent { + loop { + // The only paths where the loop can spin a new iteration + // are in the cases ParseArrayComma and ParseObjectComma if ',' + // is parsed. In these cases the state is set to (respectively) + // ParseArray(false) and ParseObject(false), which always return, + // so there is no risk of getting stuck in an infinite loop. + // All other paths return before the end of the loop's iteration. + self.parse_whitespace(); + + match self.state { + ParseStart => { + return self.parse_start(); + } + ParseArray(first) => { + return self.parse_array(first); + } + ParseArrayComma => { + match self.parse_array_comma_or_end() { + Some(evt) => { return evt; } + None => {} + } + } + ParseObject(first) => { + return self.parse_object(first); + } + ParseObjectComma => { + self.stack.pop(); + if self.ch_is(',') { + self.state = ParseObject(false); + self.bump(); + } else { + return self.parse_object_end(); + } + } + _ => { + return self.error_event(InvalidSyntax); + } + } + } + } + + fn parse_start(&mut self) -> JsonEvent { + let val = self.parse_value(); + self.state = match val { + Error(_) => ParseFinished, + ArrayStart => ParseArray(true), + ObjectStart => ParseObject(true), + _ => ParseBeforeFinish, + }; + return val; + } + + fn parse_array(&mut self, first: bool) -> JsonEvent { + if self.ch_is(']') { + if !first { + self.error_event(InvalidSyntax) + } else { + self.state = if self.stack.is_empty() { + ParseBeforeFinish + } else if self.stack.last_is_index() { + ParseArrayComma + } else { + ParseObjectComma + }; + self.bump(); + ArrayEnd + } + } else { + if first { + self.stack.push_index(0); + } + let val = self.parse_value(); + self.state = match val { + Error(_) => ParseFinished, + ArrayStart => ParseArray(true), + ObjectStart => ParseObject(true), + _ => ParseArrayComma, + }; + val + } + } + + fn parse_array_comma_or_end(&mut self) -> Option { + if self.ch_is(',') { + self.stack.bump_index(); + self.state = ParseArray(false); + self.bump(); + None + } else if self.ch_is(']') { + self.stack.pop(); + self.state = if self.stack.is_empty() { + ParseBeforeFinish + } else if self.stack.last_is_index() { + ParseArrayComma + } else { + ParseObjectComma + }; + self.bump(); + Some(ArrayEnd) + } else if self.eof() { + Some(self.error_event(EOFWhileParsingArray)) + } else { + Some(self.error_event(InvalidSyntax)) + } + } + + fn parse_object(&mut self, first: bool) -> JsonEvent { + if self.ch_is('}') { + if !first { + if self.stack.is_empty() { + return self.error_event(TrailingComma); + } else { + self.stack.pop(); + } + } + self.state = if self.stack.is_empty() { + ParseBeforeFinish + } else if self.stack.last_is_index() { + ParseArrayComma + } else { + ParseObjectComma + }; + self.bump(); + return ObjectEnd; + } + if self.eof() { + return self.error_event(EOFWhileParsingObject); + } + if !self.ch_is('"') { + return self.error_event(KeyMustBeAString); + } + let s = match self.parse_str() { + Ok(s) => s, + Err(e) => { + self.state = ParseFinished; + return Error(e); + } + }; + self.parse_whitespace(); + if self.eof() { + return self.error_event(EOFWhileParsingObject); + } else if self.ch_or_null() != ':' { + return self.error_event(ExpectedColon); + } + self.stack.push_key(s); + self.bump(); + self.parse_whitespace(); + + let val = self.parse_value(); + + self.state = match val { + Error(_) => ParseFinished, + ArrayStart => ParseArray(true), + ObjectStart => ParseObject(true), + _ => ParseObjectComma, + }; + return val; + } + + fn parse_object_end(&mut self) -> JsonEvent { + if self.ch_is('}') { + self.state = if self.stack.is_empty() { + ParseBeforeFinish + } else if self.stack.last_is_index() { + ParseArrayComma + } else { + ParseObjectComma + }; + self.bump(); + ObjectEnd + } else if self.eof() { + self.error_event(EOFWhileParsingObject) + } else { + self.error_event(InvalidSyntax) + } + } + + fn parse_value(&mut self) -> JsonEvent { + if self.eof() { return self.error_event(EOFWhileParsingValue); } + match self.ch_or_null() { + 'n' => { self.parse_ident("ull", NullValue) } + 't' => { self.parse_ident("rue", BooleanValue(true)) } + 'f' => { self.parse_ident("alse", BooleanValue(false)) } + '0' ... '9' | '-' => self.parse_number(), + '"' => match self.parse_str() { + Ok(s) => StringValue(s), + Err(e) => Error(e), + }, + '[' => { + self.bump(); + ArrayStart + } + '{' => { + self.bump(); + ObjectStart + } + _ => { self.error_event(InvalidSyntax) } + } + } + + fn parse_ident(&mut self, ident: &str, value: JsonEvent) -> JsonEvent { + if ident.chars().all(|c| Some(c) == self.next_char()) { + self.bump(); + value + } else { + Error(SyntaxError(InvalidSyntax, self.line, self.col)) + } + } + + fn error_event(&mut self, reason: ErrorCode) -> JsonEvent { + self.state = ParseFinished; + Error(SyntaxError(reason, self.line, self.col)) + } +} + +/// A Builder consumes a json::Parser to create a generic Json structure. +pub struct Builder { + parser: Parser, + token: Option, +} + +impl> Builder { + /// Create a JSON Builder. + pub fn new(src: T) -> Builder { + Builder { parser: Parser::new(src), token: None, } + } + + // Decode a Json value from a Parser. + pub fn build(&mut self) -> Result { + self.bump(); + let result = self.build_value(); + self.bump(); + match self.token.take() { + None => {} + Some(Error(e)) => { return Err(e); } + _ => { return Err(SyntaxError(InvalidSyntax, self.parser.line, self.parser.col)); } + } + result + } + + fn bump(&mut self) { + self.token = self.parser.next(); + } + + fn build_value(&mut self) -> Result { + return match self.token.take() { + Some(NullValue) => Ok(Json::Null), + Some(I64Value(n)) => Ok(Json::I64(n)), + Some(U64Value(n)) => Ok(Json::U64(n)), + Some(F64Value(n)) => Ok(Json::F64(n)), + Some(BooleanValue(b)) => Ok(Json::Boolean(b)), + Some(StringValue(ref mut s)) => { + let mut temp = string::String::new(); + swap(s, &mut temp); + Ok(Json::String(temp)) + } + Some(Error(e)) => Err(e), + Some(ArrayStart) => self.build_array(), + Some(ObjectStart) => self.build_object(), + Some(ObjectEnd) => self.parser.error(InvalidSyntax), + Some(ArrayEnd) => self.parser.error(InvalidSyntax), + None => self.parser.error(EOFWhileParsingValue), + } + } + + fn build_array(&mut self) -> Result { + self.bump(); + let mut values = Vec::new(); + + loop { + if let Some(ArrayEnd) = self.token { + return Ok(Json::Array(values.into_iter().collect())); + } + match self.build_value() { + Ok(v) => values.push(v), + Err(e) => { return Err(e) } + } + self.bump(); + } + } + + fn build_object(&mut self) -> Result { + self.bump(); + + let mut values = BTreeMap::new(); + + loop { + match self.token.take() { + Some(ObjectEnd) => { return Ok(Json::Object(values)); } + Some(Error(e)) => { return Err(e); } + None => { break; } + token => { self.token = token; } + } + let key = match self.parser.stack().top() { + Some(StackElement::Key(k)) => { k.to_string() } + _ => { panic!("invalid state"); } + }; + match self.build_value() { + Ok(value) => { values.insert(key, value); } + Err(e) => { return Err(e); } + } + self.bump(); + } + return self.parser.error(EOFWhileParsingObject); + } +} + +/// A structure to decode JSON to values in rust. +pub struct Decoder { + stack: Vec, +} + +impl Decoder { + /// Creates a new decoder instance for decoding the specified JSON value. + pub fn new(json: Json) -> Decoder { + Decoder { stack: vec![json] } + } +} + +impl Decoder { + fn pop(&mut self) -> DecodeResult { + match self.stack.pop() { + Some(s) => Ok(s), + None => Err(EOF), + } + } +} + +macro_rules! expect { + ($e:expr, Null) => ({ + match try!($e) { + Json::Null => Ok(()), + other => Err(ExpectedError("Null".to_string(), + format!("{}", other))) + } + }); + ($e:expr, $t:ident) => ({ + match try!($e) { + Json::$t(v) => Ok(v), + other => { + Err(ExpectedError(stringify!($t).to_string(), + format!("{}", other))) + } + } + }) +} + +macro_rules! read_primitive { + ($name:ident, $ty:ident) => { + #[allow(unused_comparisons)] + fn $name(&mut self) -> DecodeResult<$ty> { + match try!(self.pop()) { + Json::I64(i) => { + let other = i as $ty; + if i == other as i64 && (other > 0) == (i > 0) { + Ok(other) + } else { + Err(ExpectedError("Number".to_string(), i.to_string())) + } + } + Json::U64(u) => { + let other = u as $ty; + if u == other as u64 && other >= 0 { + Ok(other) + } else { + Err(ExpectedError("Number".to_string(), u.to_string())) + } + } + Json::F64(f) => { + Err(ExpectedError("Integer".to_string(), f.to_string())) + } + // re: #12967.. a type w/ numeric keys (ie HashMap etc) + // is going to have a string here, as per JSON spec. + Json::String(s) => match s.parse() { + Ok(f) => Ok(f), + Err(_) => Err(ExpectedError("Number".to_string(), s)), + }, + value => { + Err(ExpectedError("Number".to_string(), value.to_string())) + } + } + } + } +} + +impl ::Decoder for Decoder { + type Error = DecoderError; + + fn read_nil(&mut self) -> DecodeResult<()> { + expect!(self.pop(), Null) + } + + read_primitive! { read_usize, usize } + read_primitive! { read_u8, u8 } + read_primitive! { read_u16, u16 } + read_primitive! { read_u32, u32 } + read_primitive! { read_u64, u64 } + read_primitive! { read_isize, isize } + read_primitive! { read_i8, i8 } + read_primitive! { read_i16, i16 } + read_primitive! { read_i32, i32 } + read_primitive! { read_i64, i64 } + + fn read_f32(&mut self) -> DecodeResult { + self.read_f64().map(|x| x as f32) + } + + fn read_f64(&mut self) -> DecodeResult { + match try!(self.pop()) { + Json::I64(f) => Ok(f as f64), + Json::U64(f) => Ok(f as f64), + Json::F64(f) => Ok(f), + Json::String(s) => { + // re: #12967.. a type w/ numeric keys (ie HashMap etc) + // is going to have a string here, as per JSON spec. + match s.parse() { + Ok(f) => Ok(f), + Err(_) => Err(ExpectedError("Number".to_string(), s)), + } + }, + Json::Null => Ok(f64::NAN), + value => Err(ExpectedError("Number".to_string(), format!("{}", value))) + } + } + + fn read_bool(&mut self) -> DecodeResult { + expect!(self.pop(), Boolean) + } + + fn read_char(&mut self) -> DecodeResult { + let s = try!(self.read_str()); + { + let mut it = s.chars(); + match (it.next(), it.next()) { + // exactly one character + (Some(c), None) => return Ok(c), + _ => () + } + } + Err(ExpectedError("single character string".to_string(), format!("{}", s))) + } + + fn read_str(&mut self) -> DecodeResult { + expect!(self.pop(), String) + } + + fn read_enum(&mut self, _name: &str, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + f(self) + } + + fn read_enum_variant(&mut self, names: &[&str], + mut f: F) -> DecodeResult + where F: FnMut(&mut Decoder, usize) -> DecodeResult, + { + let name = match try!(self.pop()) { + Json::String(s) => s, + Json::Object(mut o) => { + let n = match o.remove(&"variant".to_string()) { + Some(Json::String(s)) => s, + Some(val) => { + return Err(ExpectedError("String".to_string(), format!("{}", val))) + } + None => { + return Err(MissingFieldError("variant".to_string())) + } + }; + match o.remove(&"fields".to_string()) { + Some(Json::Array(l)) => { + for field in l.into_iter().rev() { + self.stack.push(field); + } + }, + Some(val) => { + return Err(ExpectedError("Array".to_string(), format!("{}", val))) + } + None => { + return Err(MissingFieldError("fields".to_string())) + } + } + n + } + json => { + return Err(ExpectedError("String or Object".to_string(), format!("{}", json))) + } + }; + let idx = match names.iter().position(|n| *n == name) { + Some(idx) => idx, + None => return Err(UnknownVariantError(name)) + }; + f(self, idx) + } + + fn read_enum_variant_arg(&mut self, _idx: usize, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + f(self) + } + + fn read_enum_struct_variant(&mut self, names: &[&str], f: F) -> DecodeResult where + F: FnMut(&mut Decoder, usize) -> DecodeResult, + { + self.read_enum_variant(names, f) + } + + + fn read_enum_struct_variant_field(&mut self, + _name: &str, + idx: usize, + f: F) + -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + self.read_enum_variant_arg(idx, f) + } + + fn read_struct(&mut self, _name: &str, _len: usize, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + let value = try!(f(self)); + try!(self.pop()); + Ok(value) + } + + fn read_struct_field(&mut self, + name: &str, + _idx: usize, + f: F) + -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + let mut obj = try!(expect!(self.pop(), Object)); + + let value = match obj.remove(&name.to_string()) { + None => { + // Add a Null and try to parse it as an Option<_> + // to get None as a default value. + self.stack.push(Json::Null); + match f(self) { + Ok(x) => x, + Err(_) => return Err(MissingFieldError(name.to_string())), + } + }, + Some(json) => { + self.stack.push(json); + try!(f(self)) + } + }; + self.stack.push(Json::Object(obj)); + Ok(value) + } + + fn read_tuple(&mut self, tuple_len: usize, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + self.read_seq(move |d, len| { + if len == tuple_len { + f(d) + } else { + Err(ExpectedError(format!("Tuple{}", tuple_len), format!("Tuple{}", len))) + } + }) + } + + fn read_tuple_arg(&mut self, idx: usize, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + self.read_seq_elt(idx, f) + } + + fn read_tuple_struct(&mut self, + _name: &str, + len: usize, + f: F) + -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + self.read_tuple(len, f) + } + + fn read_tuple_struct_arg(&mut self, + idx: usize, + f: F) + -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + self.read_tuple_arg(idx, f) + } + + fn read_option(&mut self, mut f: F) -> DecodeResult where + F: FnMut(&mut Decoder, bool) -> DecodeResult, + { + match try!(self.pop()) { + Json::Null => f(self, false), + value => { self.stack.push(value); f(self, true) } + } + } + + fn read_seq(&mut self, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder, usize) -> DecodeResult, + { + let array = try!(expect!(self.pop(), Array)); + let len = array.len(); + for v in array.into_iter().rev() { + self.stack.push(v); + } + f(self, len) + } + + fn read_seq_elt(&mut self, _idx: usize, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + f(self) + } + + fn read_map(&mut self, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder, usize) -> DecodeResult, + { + let obj = try!(expect!(self.pop(), Object)); + let len = obj.len(); + for (key, value) in obj.into_iter() { + self.stack.push(value); + self.stack.push(Json::String(key)); + } + f(self, len) + } + + fn read_map_elt_key(&mut self, _idx: usize, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + f(self) + } + + fn read_map_elt_val(&mut self, _idx: usize, f: F) -> DecodeResult where + F: FnOnce(&mut Decoder) -> DecodeResult, + { + f(self) + } + + fn error(&mut self, err: &str) -> DecoderError { + ApplicationError(err.to_string()) + } +} + +/// A trait for converting values to JSON +pub trait ToJson { + /// Converts the value of `self` to an instance of JSON + fn to_json(&self) -> Json; +} + +macro_rules! to_json_impl_i64 { + ($($t:ty), +) => ( + $(impl ToJson for $t { + fn to_json(&self) -> Json { Json::I64(*self as i64) } + })+ + ) +} + +to_json_impl_i64! { isize, i8, i16, i32, i64 } + +macro_rules! to_json_impl_u64 { + ($($t:ty), +) => ( + $(impl ToJson for $t { + fn to_json(&self) -> Json { Json::U64(*self as u64) } + })+ + ) +} + +to_json_impl_u64! { usize, u8, u16, u32, u64 } + +impl ToJson for Json { + fn to_json(&self) -> Json { self.clone() } +} + +impl ToJson for f32 { + fn to_json(&self) -> Json { (*self as f64).to_json() } +} + +impl ToJson for f64 { + fn to_json(&self) -> Json { + use std::num::FpCategory::{Nan, Infinite}; + + match self.classify() { + Nan | Infinite => Json::Null, + _ => Json::F64(*self) + } + } +} + +impl ToJson for () { + fn to_json(&self) -> Json { Json::Null } +} + +impl ToJson for bool { + fn to_json(&self) -> Json { Json::Boolean(*self) } +} + +impl ToJson for str { + fn to_json(&self) -> Json { Json::String(self.to_string()) } +} + +impl ToJson for string::String { + fn to_json(&self) -> Json { Json::String((*self).clone()) } +} + +macro_rules! tuple_impl { + // use variables to indicate the arity of the tuple + ($($tyvar:ident),* ) => { + // the trailing commas are for the 1 tuple + impl< + $( $tyvar : ToJson ),* + > ToJson for ( $( $tyvar ),* , ) { + + #[inline] + #[allow(non_snake_case)] + fn to_json(&self) -> Json { + match *self { + ($(ref $tyvar),*,) => Json::Array(vec![$($tyvar.to_json()),*]) + } + } + } + } +} + +tuple_impl!{A} +tuple_impl!{A, B} +tuple_impl!{A, B, C} +tuple_impl!{A, B, C, D} +tuple_impl!{A, B, C, D, E} +tuple_impl!{A, B, C, D, E, F} +tuple_impl!{A, B, C, D, E, F, G} +tuple_impl!{A, B, C, D, E, F, G, H} +tuple_impl!{A, B, C, D, E, F, G, H, I} +tuple_impl!{A, B, C, D, E, F, G, H, I, J} +tuple_impl!{A, B, C, D, E, F, G, H, I, J, K} +tuple_impl!{A, B, C, D, E, F, G, H, I, J, K, L} + +impl ToJson for [A] { + fn to_json(&self) -> Json { Json::Array(self.iter().map(|elt| elt.to_json()).collect()) } +} + +impl ToJson for Vec { + fn to_json(&self) -> Json { Json::Array(self.iter().map(|elt| elt.to_json()).collect()) } +} + +impl ToJson for BTreeMap { + fn to_json(&self) -> Json { + let mut d = BTreeMap::new(); + for (key, value) in self.iter() { + d.insert((*key).clone(), value.to_json()); + } + Json::Object(d) + } +} + +impl ToJson for HashMap { + fn to_json(&self) -> Json { + let mut d = BTreeMap::new(); + for (key, value) in self.iter() { + d.insert((*key).clone(), value.to_json()); + } + Json::Object(d) + } +} + +impl ToJson for Option { + fn to_json(&self) -> Json { + match *self { + None => Json::Null, + Some(ref value) => value.to_json() + } + } +} + +struct FormatShim<'a, 'b: 'a> { + inner: &'a mut fmt::Formatter<'b>, +} + +impl<'a, 'b> fmt::Write for FormatShim<'a, 'b> { + fn write_str(&mut self, s: &str) -> fmt::Result { + match self.inner.write_str(s) { + Ok(_) => Ok(()), + Err(_) => Err(fmt::Error) + } + } +} + +impl fmt::Display for Json { + /// Encodes a json value into a string + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut shim = FormatShim { inner: f }; + let mut encoder = Encoder::new(&mut shim); + match self.encode(&mut encoder) { + Ok(_) => Ok(()), + Err(_) => Err(fmt::Error) + } + } +} + +impl<'a> fmt::Display for PrettyJson<'a> { + /// Encodes a json value into a string + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut shim = FormatShim { inner: f }; + let mut encoder = Encoder::new_pretty(&mut shim); + match self.inner.encode(&mut encoder) { + Ok(_) => Ok(()), + Err(_) => Err(fmt::Error) + } + } +} + +impl<'a, T: Encodable> fmt::Display for AsJson<'a, T> { + /// Encodes a json value into a string + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut shim = FormatShim { inner: f }; + let mut encoder = Encoder::new(&mut shim); + match self.inner.encode(&mut encoder) { + Ok(_) => Ok(()), + Err(_) => Err(fmt::Error) + } + } +} + +impl<'a, T> AsPrettyJson<'a, T> { + /// Set the indentation level for the emitted JSON + pub fn indent(mut self, indent: u32) -> AsPrettyJson<'a, T> { + self.indent = Some(indent); + self + } +} + +impl<'a, T: Encodable> fmt::Display for AsPrettyJson<'a, T> { + /// Encodes a json value into a string + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut shim = FormatShim { inner: f }; + let mut encoder = Encoder::new_pretty(&mut shim); + if let Some(n) = self.indent { + // unwrap cannot panic for pretty encoders + let _ = encoder.set_indent(n); + } + match self.inner.encode(&mut encoder) { + Ok(_) => Ok(()), + Err(_) => Err(fmt::Error) + } + } +} + +impl FromStr for Json { + type Err = ParserError; + fn from_str(s: &str) -> Result { + Json::from_str(s) + } +} + +#[cfg(test)] +mod tests { + use self::Animal::*; + use {Encodable, Decodable}; + use super::Json::*; + use super::ErrorCode::*; + use super::ParserError::*; + use super::DecoderError::*; + use super::JsonEvent::*; + use super::StackElement::*; + use super::{Json, DecodeResult, DecoderError, JsonEvent, Parser, + StackElement, Stack, Decoder, Encoder, EncoderError}; + use std::{i64, u64, f32, f64}; + use std::collections::BTreeMap; + use std::string; + + #[derive(RustcDecodable, Eq, PartialEq, Debug)] + struct OptionData { + opt: Option, + } + + #[test] + fn test_decode_option_none() { + let s ="{}"; + let obj: OptionData = super::decode(s).unwrap(); + assert_eq!(obj, OptionData { opt: None }); + } + + #[test] + fn test_decode_option_some() { + let s = "{ \"opt\": 10 }"; + let obj: OptionData = super::decode(s).unwrap(); + assert_eq!(obj, OptionData { opt: Some(10) }); + } + + #[test] + fn test_decode_option_malformed() { + check_err::("{ \"opt\": [] }", + ExpectedError("Number".to_string(), "[]".to_string())); + check_err::("{ \"opt\": false }", + ExpectedError("Number".to_string(), "false".to_string())); + } + + #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] + enum Animal { + Dog, + Frog(string::String, isize) + } + + #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] + struct Inner { + a: (), + b: usize, + c: Vec, + } + + #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] + struct Outer { + inner: Vec, + } + + fn mk_object(items: &[(string::String, Json)]) -> Json { + let mut d = BTreeMap::new(); + + for item in items.iter() { + match *item { + (ref key, ref value) => { d.insert((*key).clone(), (*value).clone()); }, + } + }; + + Object(d) + } + + #[test] + fn test_from_str_trait() { + let s = "null"; + assert!(s.parse::().unwrap() == s.parse().unwrap()); + } + + #[test] + fn test_write_null() { + assert_eq!(Null.to_string(), "null"); + assert_eq!(Null.pretty().to_string(), "null"); + } + + #[test] + fn test_write_i64() { + assert_eq!(U64(0).to_string(), "0"); + assert_eq!(U64(0).pretty().to_string(), "0"); + + assert_eq!(U64(1234).to_string(), "1234"); + assert_eq!(U64(1234).pretty().to_string(), "1234"); + + assert_eq!(I64(-5678).to_string(), "-5678"); + assert_eq!(I64(-5678).pretty().to_string(), "-5678"); + + assert_eq!(U64(7650007200025252000).to_string(), "7650007200025252000"); + assert_eq!(U64(7650007200025252000).pretty().to_string(), "7650007200025252000"); + } + + #[test] + fn test_write_f64() { + assert_eq!(F64(3.0).to_string(), "3.0"); + assert_eq!(F64(3.0).pretty().to_string(), "3.0"); + + assert_eq!(F64(3.1).to_string(), "3.1"); + assert_eq!(F64(3.1).pretty().to_string(), "3.1"); + + assert_eq!(F64(-1.5).to_string(), "-1.5"); + assert_eq!(F64(-1.5).pretty().to_string(), "-1.5"); + + assert_eq!(F64(0.5).to_string(), "0.5"); + assert_eq!(F64(0.5).pretty().to_string(), "0.5"); + + assert_eq!(F64(f64::NAN).to_string(), "null"); + assert_eq!(F64(f64::NAN).pretty().to_string(), "null"); + + assert_eq!(F64(f64::INFINITY).to_string(), "null"); + assert_eq!(F64(f64::INFINITY).pretty().to_string(), "null"); + + assert_eq!(F64(f64::NEG_INFINITY).to_string(), "null"); + assert_eq!(F64(f64::NEG_INFINITY).pretty().to_string(), "null"); + } + + #[test] + fn test_write_str() { + assert_eq!(String("".to_string()).to_string(), "\"\""); + assert_eq!(String("".to_string()).pretty().to_string(), "\"\""); + + assert_eq!(String("homura".to_string()).to_string(), "\"homura\""); + assert_eq!(String("madoka".to_string()).pretty().to_string(), "\"madoka\""); + } + + #[test] + fn test_write_bool() { + assert_eq!(Boolean(true).to_string(), "true"); + assert_eq!(Boolean(true).pretty().to_string(), "true"); + + assert_eq!(Boolean(false).to_string(), "false"); + assert_eq!(Boolean(false).pretty().to_string(), "false"); + } + + #[test] + fn test_write_array() { + assert_eq!(Array(vec![]).to_string(), "[]"); + assert_eq!(Array(vec![]).pretty().to_string(), "[]"); + + assert_eq!(Array(vec![Boolean(true)]).to_string(), "[true]"); + assert_eq!( + Array(vec![Boolean(true)]).pretty().to_string(), + "\ + [\n \ + true\n\ + ]" + ); + + let long_test_array = Array(vec![ + Boolean(false), + Null, + Array(vec![String("foo\nbar".to_string()), F64(3.5)])]); + + assert_eq!(long_test_array.to_string(), + "[false,null,[\"foo\\nbar\",3.5]]"); + assert_eq!( + long_test_array.pretty().to_string(), + "\ + [\n \ + false,\n \ + null,\n \ + [\n \ + \"foo\\nbar\",\n \ + 3.5\n \ + ]\n\ + ]" + ); + } + + #[test] + fn test_write_object() { + assert_eq!(mk_object(&[]).to_string(), "{}"); + assert_eq!(mk_object(&[]).pretty().to_string(), "{}"); + + assert_eq!( + mk_object(&[ + ("a".to_string(), Boolean(true)) + ]).to_string(), + "{\"a\":true}" + ); + assert_eq!( + mk_object(&[("a".to_string(), Boolean(true))]).pretty().to_string(), + "\ + {\n \ + \"a\": true\n\ + }" + ); + + let complex_obj = mk_object(&[ + ("b".to_string(), Array(vec![ + mk_object(&[("c".to_string(), String("\x0c\r".to_string()))]), + mk_object(&[("d".to_string(), String("".to_string()))]) + ])) + ]); + + assert_eq!( + complex_obj.to_string(), + "{\ + \"b\":[\ + {\"c\":\"\\f\\r\"},\ + {\"d\":\"\"}\ + ]\ + }" + ); + assert_eq!( + complex_obj.pretty().to_string(), + "\ + {\n \ + \"b\": [\n \ + {\n \ + \"c\": \"\\f\\r\"\n \ + },\n \ + {\n \ + \"d\": \"\"\n \ + }\n \ + ]\n\ + }" + ); + + let a = mk_object(&[ + ("a".to_string(), Boolean(true)), + ("b".to_string(), Array(vec![ + mk_object(&[("c".to_string(), String("\x0c\r".to_string()))]), + mk_object(&[("d".to_string(), String("".to_string()))]) + ])) + ]); + + // We can't compare the strings directly because the object fields be + // printed in a different order. + assert_eq!(a.clone(), a.to_string().parse().unwrap()); + assert_eq!(a.clone(), a.pretty().to_string().parse().unwrap()); + } + + #[test] + fn test_write_enum() { + let animal = Dog; + assert_eq!( + format!("{}", super::as_json(&animal)), + "\"Dog\"" + ); + assert_eq!( + format!("{}", super::as_pretty_json(&animal)), + "\"Dog\"" + ); + + let animal = Frog("Henry".to_string(), 349); + assert_eq!( + format!("{}", super::as_json(&animal)), + "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}" + ); + assert_eq!( + format!("{}", super::as_pretty_json(&animal)), + "{\n \ + \"variant\": \"Frog\",\n \ + \"fields\": [\n \ + \"Henry\",\n \ + 349\n \ + ]\n\ + }" + ); + } + + macro_rules! check_encoder_for_simple { + ($value:expr, $expected:expr) => ({ + let s = format!("{}", super::as_json(&$value)); + assert_eq!(s, $expected); + + let s = format!("{}", super::as_pretty_json(&$value)); + assert_eq!(s, $expected); + }) + } + + #[test] + fn test_write_some() { + check_encoder_for_simple!(Some("jodhpurs".to_string()), "\"jodhpurs\""); + } + + #[test] + fn test_write_none() { + check_encoder_for_simple!(None::, "null"); + } + + #[test] + fn test_write_char() { + check_encoder_for_simple!('a', "\"a\""); + check_encoder_for_simple!('\t', "\"\\t\""); + check_encoder_for_simple!('\u{0000}', "\"\\u0000\""); + check_encoder_for_simple!('\u{001b}', "\"\\u001b\""); + check_encoder_for_simple!('\u{007f}', "\"\\u007f\""); + check_encoder_for_simple!('\u{00a0}', "\"\u{00a0}\""); + check_encoder_for_simple!('\u{abcd}', "\"\u{abcd}\""); + check_encoder_for_simple!('\u{10ffff}', "\"\u{10ffff}\""); + } + + #[test] + fn test_trailing_characters() { + assert_eq!(Json::from_str("nulla"), Err(SyntaxError(TrailingCharacters, 1, 5))); + assert_eq!(Json::from_str("truea"), Err(SyntaxError(TrailingCharacters, 1, 5))); + assert_eq!(Json::from_str("falsea"), Err(SyntaxError(TrailingCharacters, 1, 6))); + assert_eq!(Json::from_str("1a"), Err(SyntaxError(TrailingCharacters, 1, 2))); + assert_eq!(Json::from_str("[]a"), Err(SyntaxError(TrailingCharacters, 1, 3))); + assert_eq!(Json::from_str("{}a"), Err(SyntaxError(TrailingCharacters, 1, 3))); + } + + #[test] + fn test_read_identifiers() { + assert_eq!(Json::from_str("n"), Err(SyntaxError(InvalidSyntax, 1, 2))); + assert_eq!(Json::from_str("nul"), Err(SyntaxError(InvalidSyntax, 1, 4))); + assert_eq!(Json::from_str("t"), Err(SyntaxError(InvalidSyntax, 1, 2))); + assert_eq!(Json::from_str("truz"), Err(SyntaxError(InvalidSyntax, 1, 4))); + assert_eq!(Json::from_str("f"), Err(SyntaxError(InvalidSyntax, 1, 2))); + assert_eq!(Json::from_str("faz"), Err(SyntaxError(InvalidSyntax, 1, 3))); + + assert_eq!(Json::from_str("null"), Ok(Null)); + assert_eq!(Json::from_str("true"), Ok(Boolean(true))); + assert_eq!(Json::from_str("false"), Ok(Boolean(false))); + assert_eq!(Json::from_str(" null "), Ok(Null)); + assert_eq!(Json::from_str(" true "), Ok(Boolean(true))); + assert_eq!(Json::from_str(" false "), Ok(Boolean(false))); + } + + #[test] + fn test_decode_identifiers() { + let v: () = super::decode("null").unwrap(); + assert_eq!(v, ()); + + let v: bool = super::decode("true").unwrap(); + assert_eq!(v, true); + + let v: bool = super::decode("false").unwrap(); + assert_eq!(v, false); + } + + #[test] + fn test_read_number() { + assert_eq!(Json::from_str("+"), Err(SyntaxError(InvalidSyntax, 1, 1))); + assert_eq!(Json::from_str("."), Err(SyntaxError(InvalidSyntax, 1, 1))); + assert_eq!(Json::from_str("NaN"), Err(SyntaxError(InvalidSyntax, 1, 1))); + assert_eq!(Json::from_str("-"), Err(SyntaxError(InvalidNumber, 1, 2))); + assert_eq!(Json::from_str("00"), Err(SyntaxError(InvalidNumber, 1, 2))); + assert_eq!(Json::from_str("1."), Err(SyntaxError(InvalidNumber, 1, 3))); + assert_eq!(Json::from_str("1e"), Err(SyntaxError(InvalidNumber, 1, 3))); + assert_eq!(Json::from_str("1e+"), Err(SyntaxError(InvalidNumber, 1, 4))); + + assert_eq!(Json::from_str("18446744073709551616"), Err(SyntaxError(InvalidNumber, 1, 20))); + assert_eq!(Json::from_str("18446744073709551617"), Err(SyntaxError(InvalidNumber, 1, 20))); + assert_eq!(Json::from_str("-9223372036854775809"), Err(SyntaxError(InvalidNumber, 1, 21))); + + assert_eq!(Json::from_str("3"), Ok(U64(3))); + assert_eq!(Json::from_str("3.1"), Ok(F64(3.1))); + assert_eq!(Json::from_str("-1.2"), Ok(F64(-1.2))); + assert_eq!(Json::from_str("0.4"), Ok(F64(0.4))); + assert_eq!(Json::from_str("0.4e5"), Ok(F64(0.4e5))); + assert_eq!(Json::from_str("0.4e+15"), Ok(F64(0.4e15))); + assert_eq!(Json::from_str("0.4e-01"), Ok(F64(0.4e-01))); + assert_eq!(Json::from_str(" 3 "), Ok(U64(3))); + + assert_eq!(Json::from_str("-9223372036854775808"), Ok(I64(i64::MIN))); + assert_eq!(Json::from_str("9223372036854775807"), Ok(U64(i64::MAX as u64))); + assert_eq!(Json::from_str("18446744073709551615"), Ok(U64(u64::MAX))); + } + + #[test] + fn test_decode_numbers() { + let v: f64 = super::decode("3").unwrap(); + assert_eq!(v, 3.0); + + let v: f64 = super::decode("3.1").unwrap(); + assert_eq!(v, 3.1); + + let v: f64 = super::decode("-1.2").unwrap(); + assert_eq!(v, -1.2); + + let v: f64 = super::decode("0.4").unwrap(); + assert_eq!(v, 0.4); + + let v: f64 = super::decode("0.4e5").unwrap(); + assert_eq!(v, 0.4e5); + + let v: f64 = super::decode("0.4e15").unwrap(); + assert_eq!(v, 0.4e15); + + let v: f64 = super::decode("0.4e-01").unwrap(); + assert_eq!(v, 0.4e-01); + + let v: u64 = super::decode("0").unwrap(); + assert_eq!(v, 0); + + let v: u64 = super::decode("18446744073709551615").unwrap(); + assert_eq!(v, u64::MAX); + + let v: i64 = super::decode("-9223372036854775808").unwrap(); + assert_eq!(v, i64::MIN); + + let v: i64 = super::decode("9223372036854775807").unwrap(); + assert_eq!(v, i64::MAX); + + let res: DecodeResult = super::decode("765.25252"); + match res { + Ok(..) => panic!("expected an error"), + Err(ExpectedError(ref s, _)) => assert_eq!(s, "Integer"), + Err(..) => panic!("expected an 'expected integer' error"), + } + } + + #[test] + fn test_read_str() { + assert_eq!(Json::from_str("\""), Err(SyntaxError(EOFWhileParsingString, 1, 2))); + assert_eq!(Json::from_str("\"lol"), Err(SyntaxError(EOFWhileParsingString, 1, 5))); + assert_eq!(Json::from_str("\"\n\""), Err(SyntaxError(ControlCharacterInString, 2, 1))); + assert_eq!(Json::from_str("\"\0\""), Err(SyntaxError(ControlCharacterInString, 1, 2))); + assert_eq!(Json::from_str("\"\u{1}\""), Err(SyntaxError(ControlCharacterInString, 1, 2))); + assert_eq!(Json::from_str("\"\u{1F}\""), Err(SyntaxError(ControlCharacterInString, 1, 2))); + + // Only C0 control characters are excluded. + assert!('\u{7F}'.is_control()); + assert!('\u{80}'.is_control()); + assert!('\u{9F}'.is_control()); + let c1_controls = "\u{7F}\u{80}\u{9F}".to_string(); + assert_eq!(Json::from_str(&format!("\"{}\"", c1_controls)), Ok(String(c1_controls))); + + assert_eq!(Json::from_str("\"\""), Ok(String("".to_string()))); + assert_eq!(Json::from_str("\"foo\""), Ok(String("foo".to_string()))); + assert_eq!(Json::from_str("\"\\\"\""), Ok(String("\"".to_string()))); + assert_eq!(Json::from_str("\"\\b\""), Ok(String("\x08".to_string()))); + assert_eq!(Json::from_str("\"\\n\""), Ok(String("\n".to_string()))); + assert_eq!(Json::from_str("\"\\r\""), Ok(String("\r".to_string()))); + assert_eq!(Json::from_str("\"\\t\""), Ok(String("\t".to_string()))); + assert_eq!(Json::from_str(" \"foo\" "), Ok(String("foo".to_string()))); + assert_eq!(Json::from_str("\"\\u12ab\""), Ok(String("\u{12ab}".to_string()))); + assert_eq!(Json::from_str("\"\\uAB12\""), Ok(String("\u{AB12}".to_string()))); + } + + #[test] + fn test_decode_str() { + let s = [("\"\"", ""), + ("\"foo\"", "foo"), + ("\"\\\"\"", "\""), + ("\"\\b\"", "\x08"), + ("\"\\n\"", "\n"), + ("\"\\r\"", "\r"), + ("\"\\t\"", "\t"), + ("\"\\u12ab\"", "\u{12ab}"), + ("\"\\uAB12\"", "\u{AB12}")]; + + for &(i, o) in s.iter() { + let v: string::String = super::decode(i).unwrap(); + assert_eq!(v, o); + } + } + + #[test] + fn test_read_array() { + assert_eq!(Json::from_str("["), Err(SyntaxError(EOFWhileParsingValue, 1, 2))); + assert_eq!(Json::from_str("[1"), Err(SyntaxError(EOFWhileParsingArray, 1, 3))); + assert_eq!(Json::from_str("[1,"), Err(SyntaxError(EOFWhileParsingValue, 1, 4))); + assert_eq!(Json::from_str("[1,]"), Err(SyntaxError(InvalidSyntax, 1, 4))); + assert_eq!(Json::from_str("[6 7]"), Err(SyntaxError(InvalidSyntax, 1, 4))); + + assert_eq!(Json::from_str("[]"), Ok(Array(vec![]))); + assert_eq!(Json::from_str("[ ]"), Ok(Array(vec![]))); + assert_eq!(Json::from_str("[true]"), Ok(Array(vec![Boolean(true)]))); + assert_eq!(Json::from_str("[ false ]"), Ok(Array(vec![Boolean(false)]))); + assert_eq!(Json::from_str("[null]"), Ok(Array(vec![Null]))); + assert_eq!(Json::from_str("[3, 1]"), + Ok(Array(vec![U64(3), U64(1)]))); + assert_eq!(Json::from_str("\n[3, 2]\n"), + Ok(Array(vec![U64(3), U64(2)]))); + assert_eq!(Json::from_str("[2, [4, 1]]"), + Ok(Array(vec![U64(2), Array(vec![U64(4), U64(1)])]))); + } + + #[test] + fn test_decode_array() { + let v: Vec<()> = super::decode("[]").unwrap(); + assert_eq!(v, vec![]); + + let v: Vec<()> = super::decode("[null]").unwrap(); + assert_eq!(v, vec![()]); + + let v: Vec = super::decode("[true]").unwrap(); + assert_eq!(v, vec![true]); + + let v: Vec = super::decode("[3, 1]").unwrap(); + assert_eq!(v, vec![3, 1]); + + let v: Vec> = super::decode("[[3], [1, 2]]").unwrap(); + assert_eq!(v, vec![vec![3], vec![1, 2]]); + } + + #[test] + fn test_decode_tuple() { + let t: (usize, usize, usize) = super::decode("[1, 2, 3]").unwrap(); + assert_eq!(t, (1, 2, 3)); + + let t: (usize, string::String) = super::decode("[1, \"two\"]").unwrap(); + assert_eq!(t, (1, "two".to_string())); + } + + #[test] + fn test_decode_tuple_malformed_types() { + assert!(super::decode::<(usize, string::String)>("[1, 2]").is_err()); + } + + #[test] + fn test_decode_tuple_malformed_length() { + assert!(super::decode::<(usize, usize)>("[1, 2, 3]").is_err()); + } + + #[test] + fn test_read_object() { + assert_eq!(Json::from_str("{"), Err(SyntaxError(EOFWhileParsingObject, 1, 2))); + assert_eq!(Json::from_str("{ "), Err(SyntaxError(EOFWhileParsingObject, 1, 3))); + assert_eq!(Json::from_str("{1"), Err(SyntaxError(KeyMustBeAString, 1, 2))); + assert_eq!(Json::from_str("{ \"a\""), Err(SyntaxError(EOFWhileParsingObject, 1, 6))); + assert_eq!(Json::from_str("{\"a\""), Err(SyntaxError(EOFWhileParsingObject, 1, 5))); + assert_eq!(Json::from_str("{\"a\" "), Err(SyntaxError(EOFWhileParsingObject, 1, 6))); + + assert_eq!(Json::from_str("{\"a\" 1"), Err(SyntaxError(ExpectedColon, 1, 6))); + assert_eq!(Json::from_str("{\"a\":"), Err(SyntaxError(EOFWhileParsingValue, 1, 6))); + assert_eq!(Json::from_str("{\"a\":1"), Err(SyntaxError(EOFWhileParsingObject, 1, 7))); + assert_eq!(Json::from_str("{\"a\":1 1"), Err(SyntaxError(InvalidSyntax, 1, 8))); + assert_eq!(Json::from_str("{\"a\":1,"), Err(SyntaxError(EOFWhileParsingObject, 1, 8))); + + assert_eq!(Json::from_str("{}").unwrap(), mk_object(&[])); + assert_eq!(Json::from_str("{\"a\": 3}").unwrap(), + mk_object(&[("a".to_string(), U64(3))])); + + assert_eq!(Json::from_str( + "{ \"a\": null, \"b\" : true }").unwrap(), + mk_object(&[ + ("a".to_string(), Null), + ("b".to_string(), Boolean(true))])); + assert_eq!(Json::from_str("\n{ \"a\": null, \"b\" : true }\n").unwrap(), + mk_object(&[ + ("a".to_string(), Null), + ("b".to_string(), Boolean(true))])); + assert_eq!(Json::from_str( + "{\"a\" : 1.0 ,\"b\": [ true ]}").unwrap(), + mk_object(&[ + ("a".to_string(), F64(1.0)), + ("b".to_string(), Array(vec![Boolean(true)])) + ])); + assert_eq!(Json::from_str( + "{\ + \"a\": 1.0, \ + \"b\": [\ + true,\ + \"foo\\nbar\", \ + { \"c\": {\"d\": null} } \ + ]\ + }").unwrap(), + mk_object(&[ + ("a".to_string(), F64(1.0)), + ("b".to_string(), Array(vec![ + Boolean(true), + String("foo\nbar".to_string()), + mk_object(&[ + ("c".to_string(), mk_object(&[("d".to_string(), Null)])) + ]) + ])) + ])); + } + + #[test] + fn test_decode_struct() { + let s = "{ + \"inner\": [ + { \"a\": null, \"b\": 2, \"c\": [\"abc\", \"xyz\"] } + ] + }"; + + let v: Outer = super::decode(s).unwrap(); + assert_eq!( + v, + Outer { + inner: vec![ + Inner { a: (), b: 2, c: vec!["abc".to_string(), "xyz".to_string()] } + ] + } + ); + } + + #[derive(RustcDecodable)] + struct FloatStruct { + f: f64, + a: Vec + } + #[test] + fn test_decode_struct_with_nan() { + let s = "{\"f\":null,\"a\":[null,123]}"; + let obj: FloatStruct = super::decode(s).unwrap(); + assert!(obj.f.is_nan()); + assert!(obj.a[0].is_nan()); + assert_eq!(obj.a[1], 123f64); + } + + #[test] + fn test_decode_option() { + let value: Option = super::decode("null").unwrap(); + assert_eq!(value, None); + + let value: Option = super::decode("\"jodhpurs\"").unwrap(); + assert_eq!(value, Some("jodhpurs".to_string())); + } + + #[test] + fn test_decode_enum() { + let value: Animal = super::decode("\"Dog\"").unwrap(); + assert_eq!(value, Dog); + + let s = "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"; + let value: Animal = super::decode(s).unwrap(); + assert_eq!(value, Frog("Henry".to_string(), 349)); + } + + #[test] + fn test_decode_result() { + let value: Result = Ok(4); + let json_value = super::encode(&value).unwrap(); + assert_eq!(json_value, "{\"variant\":\"Ok\",\"fields\":[4]}"); + let decoded_value: Result = super::decode(&json_value).unwrap(); + assert_eq!(decoded_value, Ok(4)); + } + + #[test] + fn test_decode_map() { + let s = "{\"a\": \"Dog\", \"b\": {\"variant\":\"Frog\",\ + \"fields\":[\"Henry\", 349]}}"; + let mut map: BTreeMap = super::decode(s).unwrap(); + + assert_eq!(map.remove(&"a".to_string()), Some(Dog)); + assert_eq!(map.remove(&"b".to_string()), Some(Frog("Henry".to_string(), 349))); + } + + #[test] + fn test_multiline_errors() { + assert_eq!(Json::from_str("{\n \"foo\":\n \"bar\""), + Err(SyntaxError(EOFWhileParsingObject, 3, 8))); + } + + #[derive(RustcDecodable)] + #[allow(dead_code)] + struct DecodeStruct { + x: f64, + y: bool, + z: string::String, + w: Vec + } + #[derive(RustcDecodable)] + enum DecodeEnum { + A(f64), + B(string::String) + } + fn check_err(to_parse: &'static str, expected: DecoderError) { + let res: DecodeResult = match Json::from_str(to_parse) { + Err(e) => Err(ParseError(e)), + Ok(json) => Decodable::decode(&mut Decoder::new(json)) + }; + match res { + Ok(_) => panic!("`{:?}` parsed & decoded ok, expecting error `{:?}`", + to_parse, expected), + Err(ParseError(e)) => panic!("`{}` is not valid json: {:?}", + to_parse, e), + Err(e) => { + assert_eq!(e, expected); + } + } + } + #[test] + fn test_decode_errors_struct() { + check_err::("[]", ExpectedError("Object".to_string(), "[]".to_string())); + check_err::("{\"x\": true, \"y\": true, \"z\": \"\", \"w\": []}", + ExpectedError("Number".to_string(), "true".to_string())); + check_err::("{\"x\": 1, \"y\": [], \"z\": \"\", \"w\": []}", + ExpectedError("Boolean".to_string(), "[]".to_string())); + check_err::("{\"x\": 1, \"y\": true, \"z\": {}, \"w\": []}", + ExpectedError("String".to_string(), "{}".to_string())); + check_err::("{\"x\": 1, \"y\": true, \"z\": \"\", \"w\": null}", + ExpectedError("Array".to_string(), "null".to_string())); + check_err::("{\"x\": 1, \"y\": true, \"z\": \"\"}", + MissingFieldError("w".to_string())); + } + #[test] + fn test_decode_errors_enum() { + check_err::("{}", + MissingFieldError("variant".to_string())); + check_err::("{\"variant\": 1}", + ExpectedError("String".to_string(), "1".to_string())); + check_err::("{\"variant\": \"A\"}", + MissingFieldError("fields".to_string())); + check_err::("{\"variant\": \"A\", \"fields\": null}", + ExpectedError("Array".to_string(), "null".to_string())); + check_err::("{\"variant\": \"C\", \"fields\": []}", + UnknownVariantError("C".to_string())); + } + + #[test] + fn test_find(){ + let json_value = Json::from_str("{\"dog\" : \"cat\"}").unwrap(); + let found_str = json_value.find("dog"); + assert!(found_str.unwrap().as_string().unwrap() == "cat"); + } + + #[test] + fn test_find_path(){ + let json_value = Json::from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap(); + let found_str = json_value.find_path(&["dog", "cat", "mouse"]); + assert!(found_str.unwrap().as_string().unwrap() == "cheese"); + } + + #[test] + fn test_search(){ + let json_value = Json::from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap(); + let found_str = json_value.search("mouse").and_then(|j| j.as_string()); + assert!(found_str.unwrap() == "cheese"); + } + + #[test] + fn test_index(){ + let json_value = Json::from_str("{\"animals\":[\"dog\",\"cat\",\"mouse\"]}").unwrap(); + let ref array = json_value["animals"]; + assert_eq!(array[0].as_string().unwrap(), "dog"); + assert_eq!(array[1].as_string().unwrap(), "cat"); + assert_eq!(array[2].as_string().unwrap(), "mouse"); + } + + #[test] + fn test_is_object(){ + let json_value = Json::from_str("{}").unwrap(); + assert!(json_value.is_object()); + } + + #[test] + fn test_as_object(){ + let json_value = Json::from_str("{}").unwrap(); + let json_object = json_value.as_object(); + assert!(json_object.is_some()); + } + + #[test] + fn test_is_array(){ + let json_value = Json::from_str("[1, 2, 3]").unwrap(); + assert!(json_value.is_array()); + } + + #[test] + fn test_as_array(){ + let json_value = Json::from_str("[1, 2, 3]").unwrap(); + let json_array = json_value.as_array(); + let expected_length = 3; + assert!(json_array.is_some() && json_array.unwrap().len() == expected_length); + } + + #[test] + fn test_is_string(){ + let json_value = Json::from_str("\"dog\"").unwrap(); + assert!(json_value.is_string()); + } + + #[test] + fn test_as_string(){ + let json_value = Json::from_str("\"dog\"").unwrap(); + let json_str = json_value.as_string(); + let expected_str = "dog"; + assert_eq!(json_str, Some(expected_str)); + } + + #[test] + fn test_is_number(){ + let json_value = Json::from_str("12").unwrap(); + assert!(json_value.is_number()); + } + + #[test] + fn test_is_i64(){ + let json_value = Json::from_str("-12").unwrap(); + assert!(json_value.is_i64()); + + let json_value = Json::from_str("12").unwrap(); + assert!(!json_value.is_i64()); + + let json_value = Json::from_str("12.0").unwrap(); + assert!(!json_value.is_i64()); + } + + #[test] + fn test_is_u64(){ + let json_value = Json::from_str("12").unwrap(); + assert!(json_value.is_u64()); + + let json_value = Json::from_str("-12").unwrap(); + assert!(!json_value.is_u64()); + + let json_value = Json::from_str("12.0").unwrap(); + assert!(!json_value.is_u64()); + } + + #[test] + fn test_is_f64(){ + let json_value = Json::from_str("12").unwrap(); + assert!(!json_value.is_f64()); + + let json_value = Json::from_str("-12").unwrap(); + assert!(!json_value.is_f64()); + + let json_value = Json::from_str("12.0").unwrap(); + assert!(json_value.is_f64()); + + let json_value = Json::from_str("-12.0").unwrap(); + assert!(json_value.is_f64()); + } + + #[test] + fn test_as_i64(){ + let json_value = Json::from_str("-12").unwrap(); + let json_num = json_value.as_i64(); + assert_eq!(json_num, Some(-12)); + } + + #[test] + fn test_as_u64(){ + let json_value = Json::from_str("12").unwrap(); + let json_num = json_value.as_u64(); + assert_eq!(json_num, Some(12)); + } + + #[test] + fn test_as_f64(){ + let json_value = Json::from_str("12.0").unwrap(); + let json_num = json_value.as_f64(); + assert_eq!(json_num, Some(12f64)); + } + + #[test] + fn test_is_boolean(){ + let json_value = Json::from_str("false").unwrap(); + assert!(json_value.is_boolean()); + } + + #[test] + fn test_as_boolean(){ + let json_value = Json::from_str("false").unwrap(); + let json_bool = json_value.as_boolean(); + let expected_bool = false; + assert!(json_bool.is_some() && json_bool.unwrap() == expected_bool); + } + + #[test] + fn test_is_null(){ + let json_value = Json::from_str("null").unwrap(); + assert!(json_value.is_null()); + } + + #[test] + fn test_as_null(){ + let json_value = Json::from_str("null").unwrap(); + let json_null = json_value.as_null(); + let expected_null = (); + assert!(json_null.is_some() && json_null.unwrap() == expected_null); + } + + #[test] + fn test_encode_hashmap_with_numeric_key() { + use std::collections::HashMap; + let mut hm: HashMap = HashMap::new(); + hm.insert(1, true); + let json_str = super::as_pretty_json(&hm).to_string(); + match Json::from_str(&json_str) { + Err(_) => panic!("Unable to parse json_str: {}", json_str), + _ => {} // it parsed and we are good to go + } + } + + #[test] + fn test_negative_zero() { + Json::from_str("{\"test\":-0}").unwrap(); + } + + #[test] + fn test_prettyencode_hashmap_with_numeric_key() { + use std::collections::HashMap; + let mut hm: HashMap = HashMap::new(); + hm.insert(1, true); + let json_str = super::as_pretty_json(&hm).to_string(); + match Json::from_str(&json_str) { + Err(_) => panic!("Unable to parse json_str: {}", json_str), + _ => {} // it parsed and we are good to go + } + } + + #[test] + fn test_prettyencoder_indent_level_param() { + use std::collections::BTreeMap; + + let mut tree = BTreeMap::new(); + + tree.insert("hello".to_string(), String("guten tag".to_string())); + tree.insert("goodbye".to_string(), String("sayonara".to_string())); + + let json = Array( + // The following layout below should look a lot like + // the pretty-printed JSON (indent * x) + vec! + ( // 0x + String("greetings".to_string()), // 1x + Object(tree), // 1x + 2x + 2x + 1x + ) // 0x + // End JSON array (7 lines) + ); + + // Helper function for counting indents + fn indents(source: &str) -> usize { + let trimmed = source.trim_left_matches(' '); + source.len() - trimmed.len() + } + + // Test up to 4 spaces of indents (more?) + for i in 0..4 { + let printed = super::as_pretty_json(&json).indent(i as u32) + .to_string(); + + // Check for indents at each line + let lines: Vec<&str> = printed.lines().collect(); + assert_eq!(lines.len(), 7); // JSON should be 7 lines + + assert_eq!(indents(lines[0]), 0 * i); // [ + assert_eq!(indents(lines[1]), 1 * i); // "greetings", + assert_eq!(indents(lines[2]), 1 * i); // { + assert_eq!(indents(lines[3]), 2 * i); // "hello": "guten tag", + assert_eq!(indents(lines[4]), 2 * i); // "goodbye": "sayonara" + assert_eq!(indents(lines[5]), 1 * i); // }, + assert_eq!(indents(lines[6]), 0 * i); // ] + + // Finally, test that the pretty-printed JSON is valid + Json::from_str(&printed).ok() + .expect("Pretty-printed JSON is invalid!"); + } + } + + #[test] + fn test_hashmap_with_numeric_key_can_handle_double_quote_delimited_key() { + use std::collections::HashMap; + use Decodable; + let json_str = "{\"1\":true}"; + let json_obj = match Json::from_str(json_str) { + Err(_) => panic!("Unable to parse json_str: {}", json_str), + Ok(o) => o + }; + let mut decoder = Decoder::new(json_obj); + let _hm: HashMap = Decodable::decode(&mut decoder).unwrap(); + } + + #[test] + fn test_hashmap_with_enum_key() { + use std::collections::HashMap; + use json; + #[derive(RustcEncodable, Eq, Hash, PartialEq, RustcDecodable, Debug)] + enum Enum { + Foo, + #[allow(dead_code)] + Bar, + } + let mut map = HashMap::new(); + map.insert(Enum::Foo, 0); + let result = json::encode(&map).unwrap(); + assert_eq!(result, r#"{"Foo":0}"#); + let decoded: HashMap = json::decode(&result).unwrap(); + assert_eq!(map, decoded); + } + + #[test] + fn test_hashmap_with_numeric_key_will_error_with_string_keys() { + use std::collections::HashMap; + use Decodable; + let json_str = "{\"a\":true}"; + let json_obj = match Json::from_str(json_str) { + Err(_) => panic!("Unable to parse json_str: {}", json_str), + Ok(o) => o + }; + let mut decoder = Decoder::new(json_obj); + let result: Result, DecoderError> = Decodable::decode(&mut decoder); + assert_eq!(result, Err(ExpectedError("Number".to_string(), "a".to_string()))); + } + + fn assert_stream_equal(src: &str, + expected: Vec<(JsonEvent, Vec)>) { + let mut parser = Parser::new(src.chars()); + let mut i = 0; + loop { + let evt = match parser.next() { + Some(e) => e, + None => { break; } + }; + let (ref expected_evt, ref expected_stack) = expected[i]; + if !parser.stack().is_equal_to(&expected_stack) { + panic!("Parser stack is not equal to {:?}", expected_stack); + } + assert_eq!(&evt, expected_evt); + i+=1; + } + } + #[test] + #[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064) + fn test_streaming_parser() { + assert_stream_equal( + r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#, + vec![ + (ObjectStart, vec![]), + (StringValue("bar".to_string()), vec![Key("foo")]), + (ArrayStart, vec![Key("array")]), + (U64Value(0), vec![Key("array"), Index(0)]), + (U64Value(1), vec![Key("array"), Index(1)]), + (U64Value(2), vec![Key("array"), Index(2)]), + (U64Value(3), vec![Key("array"), Index(3)]), + (U64Value(4), vec![Key("array"), Index(4)]), + (U64Value(5), vec![Key("array"), Index(5)]), + (ArrayEnd, vec![Key("array")]), + (ArrayStart, vec![Key("idents")]), + (NullValue, vec![Key("idents"), Index(0)]), + (BooleanValue(true), vec![Key("idents"), Index(1)]), + (BooleanValue(false), vec![Key("idents"), Index(2)]), + (ArrayEnd, vec![Key("idents")]), + (ObjectEnd, vec![]), + ] + ); + } + fn last_event(src: &str) -> JsonEvent { + let mut parser = Parser::new(src.chars()); + let mut evt = NullValue; + loop { + evt = match parser.next() { + Some(e) => e, + None => return evt, + } + } + } + + #[test] + #[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064) + fn test_read_object_streaming() { + assert_eq!(last_event("{ "), Error(SyntaxError(EOFWhileParsingObject, 1, 3))); + assert_eq!(last_event("{1"), Error(SyntaxError(KeyMustBeAString, 1, 2))); + assert_eq!(last_event("{ \"a\""), Error(SyntaxError(EOFWhileParsingObject, 1, 6))); + assert_eq!(last_event("{\"a\""), Error(SyntaxError(EOFWhileParsingObject, 1, 5))); + assert_eq!(last_event("{\"a\" "), Error(SyntaxError(EOFWhileParsingObject, 1, 6))); + + assert_eq!(last_event("{\"a\" 1"), Error(SyntaxError(ExpectedColon, 1, 6))); + assert_eq!(last_event("{\"a\":"), Error(SyntaxError(EOFWhileParsingValue, 1, 6))); + assert_eq!(last_event("{\"a\":1"), Error(SyntaxError(EOFWhileParsingObject, 1, 7))); + assert_eq!(last_event("{\"a\":1 1"), Error(SyntaxError(InvalidSyntax, 1, 8))); + assert_eq!(last_event("{\"a\":1,"), Error(SyntaxError(EOFWhileParsingObject, 1, 8))); + assert_eq!(last_event("{\"a\":1,}"), Error(SyntaxError(TrailingComma, 1, 8))); + + assert_stream_equal( + "{}", + vec![(ObjectStart, vec![]), (ObjectEnd, vec![])] + ); + assert_stream_equal( + "{\"a\": 3}", + vec![ + (ObjectStart, vec![]), + (U64Value(3), vec![Key("a")]), + (ObjectEnd, vec![]), + ] + ); + assert_stream_equal( + "{ \"a\": null, \"b\" : true }", + vec![ + (ObjectStart, vec![]), + (NullValue, vec![Key("a")]), + (BooleanValue(true), vec![Key("b")]), + (ObjectEnd, vec![]), + ] + ); + assert_stream_equal( + "{\"a\" : 1.0 ,\"b\": [ true ]}", + vec![ + (ObjectStart, vec![]), + (F64Value(1.0), vec![Key("a")]), + (ArrayStart, vec![Key("b")]), + (BooleanValue(true),vec![Key("b"), Index(0)]), + (ArrayEnd, vec![Key("b")]), + (ObjectEnd, vec![]), + ] + ); + assert_stream_equal( + r#"{ + "a": 1.0, + "b": [ + true, + "foo\nbar", + { "c": {"d": null} }, + "\uD834\uDF06" + ] + }"#, + vec![ + (ObjectStart, vec![]), + (F64Value(1.0), vec![Key("a")]), + (ArrayStart, vec![Key("b")]), + (BooleanValue(true), vec![Key("b"), Index(0)]), + (StringValue("foo\nbar".to_string()), vec![Key("b"), Index(1)]), + (ObjectStart, vec![Key("b"), Index(2)]), + (ObjectStart, vec![Key("b"), Index(2), Key("c")]), + (NullValue, vec![Key("b"), Index(2), Key("c"), Key("d")]), + (ObjectEnd, vec![Key("b"), Index(2), Key("c")]), + (ObjectEnd, vec![Key("b"), Index(2)]), + (StringValue("\u{1D306}".to_string()), vec![Key("b"), Index(3)]), + (ArrayEnd, vec![Key("b")]), + (ObjectEnd, vec![]), + ] + ); + } + #[test] + #[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064) + fn test_read_array_streaming() { + assert_stream_equal( + "[]", + vec![ + (ArrayStart, vec![]), + (ArrayEnd, vec![]), + ] + ); + assert_stream_equal( + "[ ]", + vec![ + (ArrayStart, vec![]), + (ArrayEnd, vec![]), + ] + ); + assert_stream_equal( + "[true]", + vec![ + (ArrayStart, vec![]), + (BooleanValue(true), vec![Index(0)]), + (ArrayEnd, vec![]), + ] + ); + assert_stream_equal( + "[ false ]", + vec![ + (ArrayStart, vec![]), + (BooleanValue(false), vec![Index(0)]), + (ArrayEnd, vec![]), + ] + ); + assert_stream_equal( + "[null]", + vec![ + (ArrayStart, vec![]), + (NullValue, vec![Index(0)]), + (ArrayEnd, vec![]), + ] + ); + assert_stream_equal( + "[3, 1]", + vec![ + (ArrayStart, vec![]), + (U64Value(3), vec![Index(0)]), + (U64Value(1), vec![Index(1)]), + (ArrayEnd, vec![]), + ] + ); + assert_stream_equal( + "\n[3, 2]\n", + vec![ + (ArrayStart, vec![]), + (U64Value(3), vec![Index(0)]), + (U64Value(2), vec![Index(1)]), + (ArrayEnd, vec![]), + ] + ); + assert_stream_equal( + "[2, [4, 1]]", + vec![ + (ArrayStart, vec![]), + (U64Value(2), vec![Index(0)]), + (ArrayStart, vec![Index(1)]), + (U64Value(4), vec![Index(1), Index(0)]), + (U64Value(1), vec![Index(1), Index(1)]), + (ArrayEnd, vec![Index(1)]), + (ArrayEnd, vec![]), + ] + ); + + assert_eq!(last_event("["), Error(SyntaxError(EOFWhileParsingValue, 1, 2))); + + assert_eq!(Json::from_str("["), Err(SyntaxError(EOFWhileParsingValue, 1, 2))); + assert_eq!(Json::from_str("[1"), Err(SyntaxError(EOFWhileParsingArray, 1, 3))); + assert_eq!(Json::from_str("[1,"), Err(SyntaxError(EOFWhileParsingValue, 1, 4))); + assert_eq!(Json::from_str("[1,]"), Err(SyntaxError(InvalidSyntax, 1, 4))); + assert_eq!(Json::from_str("[6 7]"), Err(SyntaxError(InvalidSyntax, 1, 4))); + + } + #[test] + fn test_trailing_characters_streaming() { + assert_eq!(last_event("nulla"), Error(SyntaxError(TrailingCharacters, 1, 5))); + assert_eq!(last_event("truea"), Error(SyntaxError(TrailingCharacters, 1, 5))); + assert_eq!(last_event("falsea"), Error(SyntaxError(TrailingCharacters, 1, 6))); + assert_eq!(last_event("1a"), Error(SyntaxError(TrailingCharacters, 1, 2))); + assert_eq!(last_event("[]a"), Error(SyntaxError(TrailingCharacters, 1, 3))); + assert_eq!(last_event("{}a"), Error(SyntaxError(TrailingCharacters, 1, 3))); + } + #[test] + fn test_read_identifiers_streaming() { + assert_eq!(Parser::new("null".chars()).next(), Some(NullValue)); + assert_eq!(Parser::new("true".chars()).next(), Some(BooleanValue(true))); + assert_eq!(Parser::new("false".chars()).next(), Some(BooleanValue(false))); + + assert_eq!(last_event("n"), Error(SyntaxError(InvalidSyntax, 1, 2))); + assert_eq!(last_event("nul"), Error(SyntaxError(InvalidSyntax, 1, 4))); + assert_eq!(last_event("t"), Error(SyntaxError(InvalidSyntax, 1, 2))); + assert_eq!(last_event("truz"), Error(SyntaxError(InvalidSyntax, 1, 4))); + assert_eq!(last_event("f"), Error(SyntaxError(InvalidSyntax, 1, 2))); + assert_eq!(last_event("faz"), Error(SyntaxError(InvalidSyntax, 1, 3))); + } + + #[test] + fn test_stack() { + let mut stack = Stack::new(); + + assert!(stack.is_empty()); + assert!(stack.len() == 0); + assert!(!stack.last_is_index()); + + stack.push_index(0); + stack.bump_index(); + + assert!(stack.len() == 1); + assert!(stack.is_equal_to(&[Index(1)])); + assert!(stack.starts_with(&[Index(1)])); + assert!(stack.ends_with(&[Index(1)])); + assert!(stack.last_is_index()); + assert!(stack.get(0) == Index(1)); + + stack.push_key("foo".to_string()); + + assert!(stack.len() == 2); + assert!(stack.is_equal_to(&[Index(1), Key("foo")])); + assert!(stack.starts_with(&[Index(1), Key("foo")])); + assert!(stack.starts_with(&[Index(1)])); + assert!(stack.ends_with(&[Index(1), Key("foo")])); + assert!(stack.ends_with(&[Key("foo")])); + assert!(!stack.last_is_index()); + assert!(stack.get(0) == Index(1)); + assert!(stack.get(1) == Key("foo")); + + stack.push_key("bar".to_string()); + + assert!(stack.len() == 3); + assert!(stack.is_equal_to(&[Index(1), Key("foo"), Key("bar")])); + assert!(stack.starts_with(&[Index(1)])); + assert!(stack.starts_with(&[Index(1), Key("foo")])); + assert!(stack.starts_with(&[Index(1), Key("foo"), Key("bar")])); + assert!(stack.ends_with(&[Key("bar")])); + assert!(stack.ends_with(&[Key("foo"), Key("bar")])); + assert!(stack.ends_with(&[Index(1), Key("foo"), Key("bar")])); + assert!(!stack.last_is_index()); + assert!(stack.get(0) == Index(1)); + assert!(stack.get(1) == Key("foo")); + assert!(stack.get(2) == Key("bar")); + + stack.pop(); + + assert!(stack.len() == 2); + assert!(stack.is_equal_to(&[Index(1), Key("foo")])); + assert!(stack.starts_with(&[Index(1), Key("foo")])); + assert!(stack.starts_with(&[Index(1)])); + assert!(stack.ends_with(&[Index(1), Key("foo")])); + assert!(stack.ends_with(&[Key("foo")])); + assert!(!stack.last_is_index()); + assert!(stack.get(0) == Index(1)); + assert!(stack.get(1) == Key("foo")); + } + + #[test] + fn test_to_json() { + use std::collections::{HashMap,BTreeMap}; + use super::ToJson; + + let array2 = Array(vec!(I64(1), I64(2))); + let array3 = Array(vec!(I64(1), I64(2), I64(3))); + let object = { + let mut tree_map = BTreeMap::new(); + tree_map.insert("a".to_string(), U64(1)); + tree_map.insert("b".to_string(), U64(2)); + Object(tree_map) + }; + + assert_eq!(array2.to_json(), array2); + assert_eq!(object.to_json(), object); + assert_eq!(3_isize.to_json(), I64(3)); + assert_eq!(4_i8.to_json(), I64(4)); + assert_eq!(5_i16.to_json(), I64(5)); + assert_eq!(6_i32.to_json(), I64(6)); + assert_eq!(7_i64.to_json(), I64(7)); + assert_eq!(8_usize.to_json(), U64(8)); + assert_eq!(9_u8.to_json(), U64(9)); + assert_eq!(10_u16.to_json(), U64(10)); + assert_eq!(11_u32.to_json(), U64(11)); + assert_eq!(12_u64.to_json(), U64(12)); + assert_eq!(13.0_f32.to_json(), F64(13.0_f64)); + assert_eq!(14.0_f64.to_json(), F64(14.0_f64)); + assert_eq!(().to_json(), Null); + assert_eq!(f32::INFINITY.to_json(), Null); + assert_eq!(f64::NAN.to_json(), Null); + assert_eq!(true.to_json(), Boolean(true)); + assert_eq!(false.to_json(), Boolean(false)); + assert_eq!("abc".to_json(), String("abc".to_string())); + assert_eq!("abc".to_string().to_json(), String("abc".to_string())); + assert_eq!((1, 2).to_json(), array2); + assert_eq!((1, 2, 3).to_json(), array3); + assert_eq!([1, 2].to_json(), array2); + assert_eq!((&[1, 2, 3]).to_json(), array3); + assert_eq!((vec![1, 2]).to_json(), array2); + assert_eq!(vec!(1, 2, 3).to_json(), array3); + let mut tree_map = BTreeMap::new(); + tree_map.insert("a".to_string(), 1 as u32); + tree_map.insert("b".to_string(), 2); + assert_eq!(tree_map.to_json(), object); + let mut hash_map = HashMap::new(); + hash_map.insert("a".to_string(), 1 as u32); + hash_map.insert("b".to_string(), 2); + assert_eq!(hash_map.to_json(), object); + assert_eq!(Some(15).to_json(), I64(15)); + assert_eq!(Some(15 as u32).to_json(), U64(15)); + assert_eq!(None::.to_json(), Null); + } + + #[test] + fn test_encode_hashmap_with_arbitrary_key() { + use std::collections::HashMap; + #[derive(PartialEq, Eq, Hash, RustcEncodable)] + struct ArbitraryType(u32); + let mut hm: HashMap = HashMap::new(); + hm.insert(ArbitraryType(1), true); + let mut mem_buf = string::String::new(); + let mut encoder = Encoder::new(&mut mem_buf); + let result = hm.encode(&mut encoder); + match result.err().unwrap() { + EncoderError::BadHashmapKey => (), + _ => panic!("expected bad hash map key") + } + } + + #[test] + fn test_encode_decode_phantom_data() { + use std::marker::PhantomData; + + #[derive(Debug, RustcDecodable, RustcEncodable, Eq, PartialEq)] + struct Foo

{ + phantom_data: PhantomData

+ } + + let f: Foo = Foo { + phantom_data: PhantomData + }; + let s = super::encode(&f).unwrap(); + let d: Foo = super::decode(&s).unwrap(); + assert_eq!(f, d); + } + + #[test] + fn test_bad_json_stack_depleted() { + use json; + #[derive(Debug, RustcDecodable)] + enum ChatEvent { + Variant(i32) + } + let serialized = "{\"variant\": \"Variant\", \"fields\": []}"; + let r: Result = json::decode(serialized); + assert!(r.unwrap_err() == EOF); + } + + #[test] + fn fixed_length_array() { + #[derive(Debug, RustcDecodable, RustcEncodable, Eq, PartialEq)] + struct Foo { + a: [u8; 1], + b: [i32; 2], + c: [u64; 3], + } + let f = Foo { + a: [0], + b: [1, 2], + c: [3, 4, 5], + }; + let s = super::encode(&f).unwrap(); + let d = super::decode(&s).unwrap(); + assert_eq!(f, d); + } + + #[test] + fn test_unexpected_token() { + match Json::from_str("{\"\":\"\",\"\":{\"\":\"\",\"\":[{\"\":\"\",}}}") { + Err(e) => assert_eq!(e, SyntaxError(InvalidSyntax, 1, 32)), + _ => () + }; + } +} diff --git a/third_party/rust/rustc-serialize/src/lib.rs b/third_party/rust/rustc-serialize/src/lib.rs new file mode 100644 index 000000000000..8a4acf2d5028 --- /dev/null +++ b/third_party/rust/rustc-serialize/src/lib.rs @@ -0,0 +1,69 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Support code for encoding and decoding types. +//! +//! # Usage +//! +//! This crate is [on crates.io](https://crates.io/crates/rustc-serialize) and +//! can be used by adding `rustc-serialize` to the dependencies in your +//! project's `Cargo.toml`. +//! +//! ```toml +//! [dependencies] +//! rustc-serialize = "0.3" +//! ``` +//! +//! and this to your crate root: +//! +//! ```rust +//! extern crate rustc_serialize; +//! ``` + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/rustc-serialize/")] +#![cfg_attr(test, deny(warnings))] +#![allow(trivial_numeric_casts)] +#![cfg_attr(rust_build, feature(staged_api))] +#![cfg_attr(rust_build, staged_api)] +#![cfg_attr(rust_build, + unstable(feature = "rustc_private", + reason = "use the crates.io `rustc-serialize` library instead"))] + +#[cfg(test)] extern crate rand; + +pub use self::serialize::{Decoder, Encoder, Decodable, Encodable, + DecoderHelpers, EncoderHelpers}; + + +// Limit collections from allocating more than +// 1 MB for calls to `with_capacity`. +fn cap_capacity(given_len: usize) -> usize { + use std::cmp::min; + use std::mem::size_of; + const PRE_ALLOCATE_CAP: usize = 0x100000; + + match size_of::() { + 0 => min(given_len, PRE_ALLOCATE_CAP), + n => min(given_len, PRE_ALLOCATE_CAP / n) + } +} + +mod serialize; +mod collection_impls; + +pub mod base64; +pub mod hex; +pub mod json; + +mod rustc_serialize { + pub use serialize::*; +} diff --git a/third_party/rust/rustc-serialize/src/serialize.rs b/third_party/rust/rustc-serialize/src/serialize.rs new file mode 100644 index 000000000000..296f3d48e004 --- /dev/null +++ b/third_party/rust/rustc-serialize/src/serialize.rs @@ -0,0 +1,1671 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Support code for encoding and decoding types. +//! +//! In order to allow extensibility in both what types can be encoded and how +//! they are encoded, encoding and decoding are split into two part each. An +//! implementation of the Encodable trait knows how to turn a specific type into +//! a generic form, and then uses an implementation of the Encoder trait to turn +//! this into concrete output (such as a JSON string). Decoder and Decodable do +//! the same for decoding. + +/* +Core encoding and decoding interfaces. +*/ + +use std::cell::{Cell, RefCell}; +use std::ffi::OsString; +use std::path; +use std::rc::Rc; +use std::sync::Arc; +use std::marker::PhantomData; +use std::borrow::Cow; + +use cap_capacity; + +/// Trait for writing out an encoding when serializing. +/// +/// This trait provides methods to encode basic types and generic forms of +/// collections. Implementations of `Encodable` use it to perform the actual +/// encoding of a type. +/// +/// It is unspecified what is done with the encoding - it could be stored in a +/// variable, or written directly to a file, for example. +/// +/// Encoders can expect to only have a single "root" method call made on this +/// trait. Non-trivial types will call one of the collection-emitting methods, +/// passing a function that may call other methods on the trait, but once the +/// collection-emitting method has returned, encoding should be complete. +pub trait Encoder { + /// The error type for method results. + type Error; + + // Primitive types: + /// Emit a nil value. + /// + /// For example, this might be stored as the null keyword in JSON. + fn emit_nil(&mut self) -> Result<(), Self::Error>; + + /// Emit a usize value. + fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>; + + /// Emit a u64 value. + fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>; + + /// Emit a u32 value. + fn emit_u32(&mut self, v: u32) -> Result<(), Self::Error>; + + /// Emit a u16 value. + fn emit_u16(&mut self, v: u16) -> Result<(), Self::Error>; + + /// Emit a u8 value. + fn emit_u8(&mut self, v: u8) -> Result<(), Self::Error>; + + /// Emit a isize value. + fn emit_isize(&mut self, v: isize) -> Result<(), Self::Error>; + + /// Emit a i64 value. + fn emit_i64(&mut self, v: i64) -> Result<(), Self::Error>; + + /// Emit a i32 value. + fn emit_i32(&mut self, v: i32) -> Result<(), Self::Error>; + + /// Emit a i16 value. + fn emit_i16(&mut self, v: i16) -> Result<(), Self::Error>; + + /// Emit a i8 value. + fn emit_i8(&mut self, v: i8) -> Result<(), Self::Error>; + + /// Emit a bool value. + /// + /// For example, this might be stored as the true and false keywords in + /// JSON. + fn emit_bool(&mut self, v: bool) -> Result<(), Self::Error>; + + /// Emit a f64 value. + fn emit_f64(&mut self, v: f64) -> Result<(), Self::Error>; + + /// Emit a f32 value. + fn emit_f32(&mut self, v: f32) -> Result<(), Self::Error>; + + /// Emit a char value. + /// + /// Note that strings should be emitted using `emit_str`, not as a sequence + /// of `emit_char` calls. + fn emit_char(&mut self, v: char) -> Result<(), Self::Error>; + + /// Emit a string value. + fn emit_str(&mut self, v: &str) -> Result<(), Self::Error>; + + // Compound types: + /// Emit an enumeration value. + /// + /// * `name` indicates the enumeration type name. + /// * `f` is a function that will call `emit_enum_variant` or + /// `emit_enum_struct_variant` as appropriate to write the actual value. + fn emit_enum(&mut self, name: &str, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a enumeration variant value with no or unnamed data. + /// + /// This should only be called from a function passed to `emit_enum`. + /// Variants with named data should use `emit_enum_struct_variant`. + /// + /// * `v_name` is the variant name + /// * `v_id` is the numeric identifier for the variant. + /// * `len` is the number of data items associated with the variant. + /// * `f` is a function that will call `emit_enum_variant_arg` for each data + /// item. It may not be called if len is 0. + /// + /// # Examples + /// + /// ``` + /// use rustc_serialize::Encodable; + /// use rustc_serialize::Encoder; + /// + /// enum Message { + /// Quit, + /// ChangeColor(i32, i32, i32), + /// } + /// + /// impl Encodable for Message { + /// fn encode(&self, s: &mut S) -> Result<(), S::Error> { + /// s.emit_enum("Message", |s| { + /// match *self { + /// Message::Quit => { + /// s.emit_enum_variant("Quit", 0, 0, |s| Ok(())) + /// } + /// Message::ChangeColor(r, g, b) => { + /// s.emit_enum_variant("ChangeColor", 1, 3, |s| { + /// try!(s.emit_enum_variant_arg(0, |s| { + /// s.emit_i32(r) + /// })); + /// try!(s.emit_enum_variant_arg(1, |s| { + /// s.emit_i32(g) + /// })); + /// try!(s.emit_enum_variant_arg(2, |s| { + /// s.emit_i32(b) + /// })); + /// Ok(()) + /// }) + /// } + /// } + /// }) + /// } + /// } + /// ``` + fn emit_enum_variant(&mut self, v_name: &str, + v_id: usize, + len: usize, + f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit an unnamed data item for an enumeration variant. + /// + /// This should only be called from a function passed to + /// `emit_enum_variant`. + /// + /// * `a_idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate emit method to encode + /// the data object. + /// + /// Note that variant data items must be emitted in order - starting with + /// index `0` and finishing with index `len-1`. + fn emit_enum_variant_arg(&mut self, a_idx: usize, f: F) + -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a enumeration variant value with no or named data. + /// + /// This should only be called from a function passed to `emit_enum`. + /// Variants with unnamed data should use `emit_enum_variant`. + /// + /// * `v_name` is the variant name. + /// * `v_id` is the numeric identifier for the variant. + /// * `len` is the number of data items associated with the variant. + /// * `f` is a function that will call `emit_enum_struct_variant_field` for + /// each data item. It may not be called if `len` is `0`. + /// + /// # Examples + /// + /// ``` + /// use rustc_serialize::Encodable; + /// use rustc_serialize::Encoder; + /// + /// enum Message { + /// Quit, + /// Move { x: i32, y: i32 }, + /// } + /// + /// impl Encodable for Message { + /// fn encode(&self, s: &mut S) -> Result<(), S::Error> { + /// s.emit_enum("Message", |s| { + /// match *self { + /// Message::Quit => { + /// s.emit_enum_struct_variant("Quit", 0, 0, |s| Ok(())) + /// } + /// Message::Move { x: x, y: y } => { + /// s.emit_enum_struct_variant("Move", 1, 2, |s| { + /// try!(s.emit_enum_struct_variant_field("x", 0, |s| { + /// s.emit_i32(x) + /// })); + /// try!(s.emit_enum_struct_variant_field("y", 1, |s| { + /// s.emit_i32(y) + /// })); + /// Ok(()) + /// }) + /// } + /// } + /// }) + /// } + /// } + /// ``` + fn emit_enum_struct_variant(&mut self, v_name: &str, + v_id: usize, + len: usize, + f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a named data item for an enumeration variant. + /// + /// This should only be called from a function passed to + /// `emit_enum_struct_variant`. + /// + /// * `f_name` is the name of the data item field. + /// * `f_idx` is its (zero-based) index. + /// * `f` is a function that will call the appropriate emit method to encode + /// the data object. + /// + /// Note that fields must be emitted in order - starting with index `0` and + /// finishing with index `len-1`. + fn emit_enum_struct_variant_field(&mut self, + f_name: &str, + f_idx: usize, + f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a struct value. + /// + /// * `name` is the name of the struct. + /// * `len` is the number of members. + /// * `f` is a function that calls `emit_struct_field` for each member. + /// + /// # Examples + /// + /// ``` + /// use rustc_serialize::Encodable; + /// use rustc_serialize::Encoder; + /// + /// struct Point { + /// x: i32, + /// y: i32, + /// } + /// + /// impl Encodable for Point { + /// fn encode(&self, s: &mut S) -> Result<(), S::Error> { + /// s.emit_struct("Point", 2, |s| { + /// try!(s.emit_struct_field("x", 0, |s| { + /// s.emit_i32(self.x) + /// })); + /// try!(s.emit_struct_field("y", 1, |s| { + /// s.emit_i32(self.y) + /// })); + /// Ok(()) + /// }) + /// } + /// } + /// ``` + fn emit_struct(&mut self, name: &str, len: usize, f: F) + -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + /// Emit a field item for a struct. + /// + /// This should only be called from a function passed to `emit_struct`. + /// + /// * `f_name` is the name of the data item field. + /// * `f_idx` is its (zero-based) index. + /// * `f` is a function that will call the appropriate emit method to encode + /// the data object. + /// + /// Note that fields must be emitted in order - starting with index `0` and + /// finishing with index `len-1`. + fn emit_struct_field(&mut self, f_name: &str, f_idx: usize, f: F) + -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a tuple value. + /// + /// * `len` is the number of items in the tuple. + /// * `f` is a function that calls `emit_tuple_arg` for each member. + /// + /// Note that external `Encodable` implementations should not normally need + /// to use this method directly; it is meant for the use of this module's + /// own implementation of `Encodable` for tuples. + fn emit_tuple(&mut self, len: usize, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a data item for a tuple. + /// + /// This should only be called from a function passed to `emit_tuple`. + /// + /// * `idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate emit method to encode + /// the data object. + /// + /// Note that tuple items must be emitted in order - starting with index `0` + /// and finishing with index `len-1`. + fn emit_tuple_arg(&mut self, idx: usize, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a tuple struct value. + /// + /// * `name` is the name of the tuple struct. + /// * `len` is the number of items in the tuple struct. + /// * `f` is a function that calls `emit_tuple_struct_arg` for each member. + /// + /// # Examples + /// + /// ``` + /// use rustc_serialize::Encodable; + /// use rustc_serialize::Encoder; + /// + /// struct Pair(i32,i32); + /// + /// impl Encodable for Pair { + /// fn encode(&self, s: &mut S) -> Result<(), S::Error> { + /// let Pair(first,second) = *self; + /// s.emit_tuple_struct("Pair", 2, |s| { + /// try!(s.emit_tuple_arg(0, |s| { + /// s.emit_i32(first) + /// })); + /// try!(s.emit_tuple_arg(1, |s| { + /// s.emit_i32(second) + /// })); + /// Ok(()) + /// }) + /// } + /// } + /// ``` + fn emit_tuple_struct(&mut self, name: &str, len: usize, f: F) + -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a data item for a tuple struct. + /// + /// This should only be called from a function passed to + /// `emit_tuple_struct`. + /// + /// * `f_idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate emit method to encode + /// the data object. + /// + /// Note that tuple items must be emitted in order - starting with index `0` + /// and finishing with index `len-1`. + fn emit_tuple_struct_arg(&mut self, f_idx: usize, f: F) + -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + // Specialized types: + /// Emit an optional value. + /// + /// `f` is a function that will call either `emit_option_none` or + /// `emit_option_some` as appropriate. + /// + /// This method allows encoders to handle `Option` values specially, + /// rather than using the generic enum methods, because many encoding + /// formats have a built-in "optional" concept. + /// + /// Note that external `Encodable` implementations should not normally need + /// to use this method directly; it is meant for the use of this module's + /// own implementation of `Encodable` for `Option`. + fn emit_option(&mut self, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit the `None` optional value. + /// + /// This should only be called from a function passed to `emit_option`. + fn emit_option_none(&mut self) -> Result<(), Self::Error>; + + /// Emit the `Some(x)` optional value. + /// + /// `f` is a function that will call the appropriate emit method to encode + /// the data object. + /// + /// This should only be called from a function passed to `emit_option`. + fn emit_option_some(&mut self, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit a sequence of values. + /// + /// This should be used for both array-like ordered sequences and set-like + /// unordered ones. + /// + /// * `len` is the number of values in the sequence. + /// * `f` is a function that will call `emit_seq_elt` for each value in the + /// sequence. + fn emit_seq(&mut self, len: usize, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit an element in a sequence. + /// + /// This should only be called from a function passed to `emit_seq`. + /// + /// * `idx` is the (zero-based) index of the value in the sequence. + /// * `f` is a function that will call the appropriate emit method to encode + /// the data object. + /// + /// Note that sequence elements must be emitted in order - starting with + /// index `0` and finishing with index `len-1`. + fn emit_seq_elt(&mut self, idx: usize, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit an associative container (map). + /// + /// * `len` is the number of entries in the map. + /// * `f` is a function that will call `emit_map_elt_key` and + /// `emit_map_elt_val` for each entry in the map. + /// + /// # Examples + /// + /// ``` + /// use rustc_serialize::Encodable; + /// use rustc_serialize::Encoder; + /// + /// struct SimpleMap { + /// entries: Vec<(K,V)>, + /// } + /// + /// impl Encodable for SimpleMap { + /// fn encode(&self, s: &mut S) -> Result<(), S::Error> { + /// s.emit_map(self.entries.len(), |s| { + /// for (i, e) in self.entries.iter().enumerate() { + /// let (ref k, ref v) = *e; + /// try!(s.emit_map_elt_key(i, |s| k.encode(s))); + /// try!(s.emit_map_elt_val(i, |s| v.encode(s))); + /// } + /// Ok(()) + /// }) + /// } + /// } + /// ``` + fn emit_map(&mut self, len: usize, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit the key for an entry in a map. + /// + /// This should only be called from a function passed to `emit_map`. + /// + /// * `idx` is the (zero-based) index of the entry in the map + /// * `f` is a function that will call the appropriate emit method to encode + /// the key. + /// + /// Note that map entries must be emitted in order - starting with index `0` + /// and finishing with index `len-1` - and for each entry, the key should be + /// emitted followed immediately by the value. + fn emit_map_elt_key(&mut self, idx: usize, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; + + /// Emit the value for an entry in a map. + /// + /// This should only be called from a function passed to `emit_map`. + /// + /// * `idx` is the (zero-based) index of the entry in the map + /// * `f` is a function that will call the appropriate emit method to encode + /// the value. + /// + /// Note that map entries must be emitted in order - starting with index `0` + /// and finishing with index `len-1` - and for each entry, the key should be + /// emitted followed immediately by the value. + fn emit_map_elt_val(&mut self, idx: usize, f: F) -> Result<(), Self::Error> + where F: FnOnce(&mut Self) -> Result<(), Self::Error>; +} + +/// Trait for reading in an encoding for deserialization. +/// +/// This trait provides methods to decode basic types and generic forms of +/// collections. Implementations of `Decodable` use it to perform the actual +/// decoding of a type. +/// +/// Note that, as is typical with deserialization, the design of this API +/// assumes you know in advance the form of the data you are decoding (ie: what +/// type is encoded). +/// +/// Decoders can expect to only have a single "root" method call made on this +/// trait. Non-trivial types will call one of the collection-reading methods, +/// passing a function that may call other methods on the trait, but once the +/// collection-reading method has returned, decoding should be complete. +pub trait Decoder { + /// The error type for method results. + type Error; + + // Primitive types: + /// Read a nil value. + fn read_nil(&mut self) -> Result<(), Self::Error>; + + /// Read a usize value. + fn read_usize(&mut self) -> Result; + + /// Read a u64 value. + fn read_u64(&mut self) -> Result; + + /// Read a u32 value. + fn read_u32(&mut self) -> Result; + + /// Read a u16 value. + fn read_u16(&mut self) -> Result; + + /// Read a u8 value. + fn read_u8(&mut self) -> Result; + + /// Read a isize value. + fn read_isize(&mut self) -> Result; + + /// Read a i64 value. + fn read_i64(&mut self) -> Result; + + /// Read a i32 value. + fn read_i32(&mut self) -> Result; + + /// Read a i16 value. + fn read_i16(&mut self) -> Result; + + /// Read a i8 value. + fn read_i8(&mut self) -> Result; + + /// Read a bool value. + fn read_bool(&mut self) -> Result; + + /// Read a f64 value. + fn read_f64(&mut self) -> Result; + + /// Read a f32 value. + fn read_f32(&mut self) -> Result; + + /// Read a char value. + fn read_char(&mut self) -> Result; + + /// Read a string value. + fn read_str(&mut self) -> Result; + + // Compound types: + /// Read an enumeration value. + /// + /// * `name` indicates the enumeration type name. It may be used to + /// sanity-check the data being read. + /// * `f` is a function that will call `read_enum_variant` (or + /// `read_enum_struct_variant`) to read the actual value. + fn read_enum(&mut self, name: &str, f: F) -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read an enumeration value. + /// + /// * `names` is a list of the enumeration variant names. + /// * `f` is a function that will call `read_enum_variant_arg` or + /// `read_enum_struct_variant_field` as appropriate to read the + /// associated values. It will be passed the index into `names` for the + /// variant that is encoded. + fn read_enum_variant(&mut self, names: &[&str], f: F) + -> Result + where F: FnMut(&mut Self, usize) -> Result; + + /// Read an unnamed data item for an enumeration variant. + /// + /// This should only be called from a function passed to `read_enum_variant` + /// or `read_enum_struct_variant`, and only when the index provided to that + /// function indicates that the variant has associated unnamed data. It + /// should be called once for each associated data item. + /// + /// * `a_idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate read method to deocde + /// the data object. + /// + /// Note that variant data items must be read in order - starting with index + /// `0` and finishing with index `len-1`. Implementations may use `a_idx`, + /// the call order or both to select the correct data to decode. + fn read_enum_variant_arg(&mut self, a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read an enumeration value. + /// + /// This is identical to `read_enum_variant`, and is only provided for + /// symmetry with the `Encoder` API. + fn read_enum_struct_variant(&mut self, names: &[&str], f: F) + -> Result + where F: FnMut(&mut Self, usize) -> Result; + + /// Read a named data item for an enumeration variant. + /// + /// This should only be called from a function passed to `read_enum_variant` + /// or `read_enum_struct_variant`, and only when the index provided to that + /// function indicates that the variant has associated named data. It should + /// be called once for each associated field. + /// + /// * `f_name` is the name of the field. + /// * `f_idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate read method to deocde + /// the data object. + /// + /// Note that fields must be read in order - starting with index `0` and + /// finishing with index `len-1`. Implementations may use `f_idx`, `f_name`, + /// the call order or any combination to choose the correct data to decode, + /// and may (but are not required to) return an error if these are + /// inconsistent. + fn read_enum_struct_variant_field(&mut self, + f_name: &str, + f_idx: usize, + f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read an struct value. + /// + /// * `s_name` indicates the struct type name. It may be used to + /// sanity-check the data being read. + /// * `len` indicates the number of fields in the struct. + /// * `f` is a function that will call `read_struct_field` for each field in + /// the struct. + fn read_struct(&mut self, s_name: &str, len: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read a field for a struct value. + /// + /// This should only be called from a function passed to `read_struct`. It + /// should be called once for each associated field. + /// + /// * `f_name` is the name of the field. + /// * `f_idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate read method to deocde + /// the data object. + /// + /// Note that fields must be read in order - starting with index `0` and + /// finishing with index `len-1`. Implementations may use `f_idx`, `f_name`, + /// the call order or any combination to choose the correct data to decode, + /// and may (but are not required to) return an error if these are + /// inconsistent. + fn read_struct_field(&mut self, + f_name: &str, + f_idx: usize, + f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read a tuple value. + /// + /// * `len` is the number of items in the tuple. + /// * `f` is a function that will call `read_tuple_arg` for each item in the + /// tuple. + /// + /// Note that external `Decodable` implementations should not normally need + /// to use this method directly; it is meant for the use of this module's + /// own implementation of `Decodable` for tuples. + fn read_tuple(&mut self, len: usize, f: F) -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read a data item for a tuple. + /// + /// This should only be called from a function passed to `read_tuple`. + /// + /// * `a_idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate read method to encode + /// the data object. + /// + /// Note that tuple items must be read in order - starting with index `0` + /// and finishing with index `len-1`. + fn read_tuple_arg(&mut self, a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read a tuple struct value. + /// + /// * `s_name` is the name of the tuple struct. + /// * `len` is the number of items in the tuple struct. + /// * `f` is a function that calls `read_tuple_struct_arg` for each member. + fn read_tuple_struct(&mut self, s_name: &str, len: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read a data item for a tuple struct. + /// + /// This should only be called from a function passed to + /// `read_tuple_struct`. + /// + /// * `a_idx` is the (zero-based) index of the data item. + /// * `f` is a function that will call the appropriate read method to encode + /// the data object. + /// + /// Note that tuple struct items must be read in order - starting with index + /// `0` and finishing with index `len-1`. + fn read_tuple_struct_arg(&mut self, a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + // Specialized types: + /// Read an optional value. + /// + /// `f` is a function that will will be passed be passed `false` if the + /// value is unset, and `true` if it is set. If the function is passed + /// `true`, it will call the appropriate read methods to read the associated + /// data type. + /// + /// This method allows decoders to handle `Option` values specially, + /// rather than using the generic enum methods, because many encoding + /// formats have a built-in "optional" concept. + /// + /// Note that external `Decodable` implementations should not normally need + /// to use this method directly; it is meant for the use of this module's + /// own implementation of `Decodable` for `Option`. + fn read_option(&mut self, f: F) -> Result + where F: FnMut(&mut Self, bool) -> Result; + + /// Read a sequence of values. + /// + /// This should be used for both array-like ordered sequences and set-like + /// unordered ones. + /// + /// * `f` is a function that will be passed the length of the sequence, and + /// will call `read_seq_elt` for each value in the sequence. + fn read_seq(&mut self, f: F) -> Result + where F: FnOnce(&mut Self, usize) -> Result; + + /// Read an element in the sequence. + /// + /// This should only be called from a function passed to `read_seq`. + /// + /// * `idx` is the (zero-based) index of the value in the sequence. + /// * `f` is a function that will call the appropriate read method to decode + /// the data object. + /// + /// Note that sequence elements must be read in order - starting with index + /// `0` and finishing with index `len-1`. + fn read_seq_elt(&mut self, idx: usize, f: F) -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read an associative container (map). + /// + /// * `f` is a function that will be passed the number of entries in the + /// map, and will call `read_map_elt_key` and `read_map_elt_val` to decode + /// each entry. + fn read_map(&mut self, f: F) -> Result + where F: FnOnce(&mut Self, usize) -> Result; + + /// Read the key for an entry in a map. + /// + /// This should only be called from a function passed to `read_map`. + /// + /// * `idx` is the (zero-based) index of the entry in the map + /// * `f` is a function that will call the appropriate read method to decode + /// the key. + /// + /// Note that map entries must be read in order - starting with index `0` + /// and finishing with index `len-1` - and for each entry, the key should be + /// read followed immediately by the value. + fn read_map_elt_key(&mut self, idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + /// Read the value for an entry in a map. + /// + /// This should only be called from a function passed to `read_map`. + /// + /// * `idx` is the (zero-based) index of the entry in the map + /// * `f` is a function that will call the appropriate read method to decode + /// the value. + /// + /// Note that map entries must be read in order - starting with index `0` + /// and finishing with index `len-1` - and for each entry, the key should be + /// read followed immediately by the value. + fn read_map_elt_val(&mut self, idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result; + + // Failure + /// Record a decoding error. + /// + /// This allows `Decodable` implementations to report an error using a + /// `Decoder` implementation's error type when inconsistent data is read. + /// For example, when reading a fixed-length array and the wrong length is + /// given by `read_seq`. + fn error(&mut self, err: &str) -> Self::Error; +} + +/// Trait for serializing a type. +/// +/// This can be implemented for custom data types to allow them to be encoded +/// with `Encoder` implementations. Most of Rust's built-in or standard data +/// types (like `i32` and `Vec`) have `Encodable` implementations provided by +/// this module. +/// +/// Note that, in general, you should let the compiler implement this for you by +/// using the `derive(RustcEncodable)` attribute. +/// +/// # Examples +/// +/// ```rust +/// extern crate rustc_serialize; +/// +/// #[derive(RustcEncodable)] +/// struct Point { +/// x: i32, +/// y: i32, +/// } +/// # fn main() {} +/// ``` +/// +/// This generates code equivalent to: +/// +/// ```rust +/// extern crate rustc_serialize; +/// use rustc_serialize::Encodable; +/// use rustc_serialize::Encoder; +/// +/// struct Point { +/// x: i32, +/// y: i32, +/// } +/// +/// impl Encodable for Point { +/// fn encode(&self, s: &mut S) -> Result<(), S::Error> { +/// s.emit_struct("Point", 2, |s| { +/// try!(s.emit_struct_field("x", 0, |s| { +/// s.emit_i32(self.x) +/// })); +/// try!(s.emit_struct_field("y", 1, |s| { +/// s.emit_i32(self.y) +/// })); +/// Ok(()) +/// }) +/// } +/// } +/// # fn main() {} +/// ``` +pub trait Encodable { + /// Serialize a value using an `Encoder`. + fn encode(&self, s: &mut S) -> Result<(), S::Error>; +} + +/// Trait for deserializing a type. +/// +/// This can be implemented for custom data types to allow them to be decoded +/// with `Decoder` implementations. Most of Rust's built-in or standard data +/// types (like `i32` and `Vec`) have `Decodable` implementations provided by +/// this module. +/// +/// Note that, in general, you should let the compiler implement this for you by +/// using the `derive(RustcDecodable)` attribute. +/// +/// # Examples +/// +/// ```rust +/// extern crate rustc_serialize; +/// +/// #[derive(RustcDecodable)] +/// struct Point { +/// x: i32, +/// y: i32, +/// } +/// # fn main() {} +/// ``` +/// +/// This generates code equivalent to: +/// +/// ```rust +/// extern crate rustc_serialize; +/// use rustc_serialize::Decodable; +/// use rustc_serialize::Decoder; +/// +/// struct Point { +/// x: i32, +/// y: i32, +/// } +/// +/// impl Decodable for Point { +/// fn decode(d: &mut D) -> Result { +/// d.read_struct("Point", 2, |d| { +/// let x = try!(d.read_struct_field("x", 0, |d| { d.read_i32() })); +/// let y = try!(d.read_struct_field("y", 1, |d| { d.read_i32() })); +/// Ok(Point{ x: x, y: y }) +/// }) +/// } +/// } +/// # fn main() {} +/// ``` +pub trait Decodable: Sized { + /// Deserialize a value using a `Decoder`. + fn decode(d: &mut D) -> Result; +} + +impl Encodable for usize { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_usize(*self) + } +} + +impl Decodable for usize { + fn decode(d: &mut D) -> Result { + d.read_usize() + } +} + +impl Encodable for u8 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_u8(*self) + } +} + +impl Decodable for u8 { + fn decode(d: &mut D) -> Result { + d.read_u8() + } +} + +impl Encodable for u16 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_u16(*self) + } +} + +impl Decodable for u16 { + fn decode(d: &mut D) -> Result { + d.read_u16() + } +} + +impl Encodable for u32 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_u32(*self) + } +} + +impl Decodable for u32 { + fn decode(d: &mut D) -> Result { + d.read_u32() + } +} + +impl Encodable for u64 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_u64(*self) + } +} + +impl Decodable for u64 { + fn decode(d: &mut D) -> Result { + d.read_u64() + } +} + +impl Encodable for isize { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_isize(*self) + } +} + +impl Decodable for isize { + fn decode(d: &mut D) -> Result { + d.read_isize() + } +} + +impl Encodable for i8 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_i8(*self) + } +} + +impl Decodable for i8 { + fn decode(d: &mut D) -> Result { + d.read_i8() + } +} + +impl Encodable for i16 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_i16(*self) + } +} + +impl Decodable for i16 { + fn decode(d: &mut D) -> Result { + d.read_i16() + } +} + +impl Encodable for i32 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_i32(*self) + } +} + +impl Decodable for i32 { + fn decode(d: &mut D) -> Result { + d.read_i32() + } +} + +impl Encodable for i64 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_i64(*self) + } +} + +impl Decodable for i64 { + fn decode(d: &mut D) -> Result { + d.read_i64() + } +} + +impl Encodable for str { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_str(self) + } +} + +impl Encodable for String { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_str(self) + } +} + +impl Decodable for String { + fn decode(d: &mut D) -> Result { + d.read_str() + } +} + +impl Encodable for f32 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_f32(*self) + } +} + +impl Decodable for f32 { + fn decode(d: &mut D) -> Result { + d.read_f32() + } +} + +impl Encodable for f64 { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_f64(*self) + } +} + +impl Decodable for f64 { + fn decode(d: &mut D) -> Result { + d.read_f64() + } +} + +impl Encodable for bool { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_bool(*self) + } +} + +impl Decodable for bool { + fn decode(d: &mut D) -> Result { + d.read_bool() + } +} + +impl Encodable for char { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_char(*self) + } +} + +impl Decodable for char { + fn decode(d: &mut D) -> Result { + d.read_char() + } +} + +impl Encodable for () { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_nil() + } +} + +impl Decodable for () { + fn decode(d: &mut D) -> Result<(), D::Error> { + d.read_nil() + } +} + +impl<'a, T: ?Sized + Encodable> Encodable for &'a T { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + (**self).encode(s) + } +} + +impl Encodable for Box { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + (**self).encode(s) + } +} + +impl< T: Decodable> Decodable for Box { + fn decode(d: &mut D) -> Result, D::Error> { + Ok(Box::new(try!(Decodable::decode(d)))) + } +} + +impl< T: Decodable> Decodable for Box<[T]> { + fn decode(d: &mut D) -> Result, D::Error> { + let v: Vec = try!(Decodable::decode(d)); + Ok(v.into_boxed_slice()) + } +} + +impl Encodable for Rc { + #[inline] + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + (**self).encode(s) + } +} + +impl Decodable for Rc { + #[inline] + fn decode(d: &mut D) -> Result, D::Error> { + Ok(Rc::new(try!(Decodable::decode(d)))) + } +} + +impl<'a, T:Encodable + ToOwned + ?Sized> Encodable for Cow<'a, T> { + #[inline] + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + (**self).encode(s) + } +} + +impl<'a, T: ?Sized> Decodable for Cow<'a, T> + where T: ToOwned, T::Owned: Decodable +{ + #[inline] + fn decode(d: &mut D) -> Result, D::Error> { + Ok(Cow::Owned(try!(Decodable::decode(d)))) + } +} + +impl Encodable for [T] { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_seq(self.len(), |s| { + for (i, e) in self.iter().enumerate() { + try!(s.emit_seq_elt(i, |s| e.encode(s))) + } + Ok(()) + }) + } +} + +impl Encodable for Vec { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_seq(self.len(), |s| { + for (i, e) in self.iter().enumerate() { + try!(s.emit_seq_elt(i, |s| e.encode(s))) + } + Ok(()) + }) + } +} + +impl Decodable for Vec { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_seq(|d, len| { + let mut v = Vec::with_capacity(cap_capacity::(len)); + for i in 0..len { + v.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); + } + Ok(v) + }) + } +} + +impl Encodable for Option { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_option(|s| { + match *self { + None => s.emit_option_none(), + Some(ref v) => s.emit_option_some(|s| v.encode(s)), + } + }) + } +} + +impl Decodable for Option { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_option(|d, b| { + if b { + Ok(Some(try!(Decodable::decode(d)))) + } else { + Ok(None) + } + }) + } +} + +impl Encodable for Result { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_enum("Result", |s| { + match *self { + Ok(ref v) => { + s.emit_enum_variant("Ok", 0, 1, |s| { + try!(s.emit_enum_variant_arg(0, |s| { + v.encode(s) + })); + Ok(()) + }) + } + Err(ref v) => { + s.emit_enum_variant("Err", 1, 1, |s| { + try!(s.emit_enum_variant_arg(0, |s| { + v.encode(s) + })); + Ok(()) + }) + } + } + }) + } +} + +impl Decodable for Result { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_enum("Result", |d| { + d.read_enum_variant(&["Ok", "Err"], |d, idx| { + match idx { + 0 => { + d.read_enum_variant_arg(0, |d| { + T::decode(d) + }).map(|v| Ok(v)) + } + 1 => { + d.read_enum_variant_arg(0, |d| { + E::decode(d) + }).map(|v| Err(v)) + } + _ => panic!("Internal error"), + } + }) + }) + } +} + +impl Encodable for PhantomData { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_nil() + } +} + +impl Decodable for PhantomData { + fn decode(_d: &mut D) -> Result, D::Error> { + Ok(PhantomData) + } +} + +macro_rules! peel { + ($name:ident, $($other:ident,)*) => (tuple! { $($other,)* }) +} + +/// Evaluates to the number of identifiers passed to it, for example: +/// `count_idents!(a, b, c) == 3 +macro_rules! count_idents { + () => { 0 }; + ($_i:ident, $($rest:ident,)*) => { 1 + count_idents!($($rest,)*) } +} + +macro_rules! tuple { + () => (); + ( $($name:ident,)+ ) => ( + impl<$($name:Decodable),*> Decodable for ($($name,)*) { + fn decode(d: &mut D) -> Result<($($name,)*), D::Error> { + let len: usize = count_idents!($($name,)*); + d.read_tuple(len, |d| { + let mut i = 0; + let ret = ($(try!(d.read_tuple_arg({ i+=1; i-1 }, + |d| -> Result<$name,D::Error> { + Decodable::decode(d) + })),)*); + return Ok(ret); + }) + } + } + impl<$($name:Encodable),*> Encodable for ($($name,)*) { + #[allow(non_snake_case)] + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + let ($(ref $name,)*) = *self; + let mut n = 0; + $(let $name = $name; n += 1;)* + s.emit_tuple(n, |s| { + let mut i = 0; + $(try!(s.emit_tuple_arg({ i+=1; i-1 }, |s| $name.encode(s)));)* + Ok(()) + }) + } + } + peel! { $($name,)* } + ) +} + +tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, } + +macro_rules! array { + () => (); + ($len:expr, $($idx:expr,)*) => { + impl Decodable for [T; $len] { + fn decode(d: &mut D) -> Result<[T; $len], D::Error> { + d.read_seq(|d, len| { + if len != $len { + return Err(d.error("wrong array length")); + } + Ok([$( + try!(d.read_seq_elt($len - $idx - 1, + |d| Decodable::decode(d))) + ),*]) + }) + } + } + + impl Encodable for [T; $len] { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_seq($len, |s| { + for i in 0..$len { + try!(s.emit_seq_elt(i, |s| self[i].encode(s))); + } + Ok(()) + }) + } + } + array! { $($idx,)* } + } +} + +array! { + 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, + 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, +} + +impl Encodable for path::Path { + #[cfg(target_os = "redox")] + fn encode(&self, e: &mut S) -> Result<(), S::Error> { + self.as_os_str().to_str().unwrap().encode(e) + } + #[cfg(unix)] + fn encode(&self, e: &mut S) -> Result<(), S::Error> { + use std::os::unix::prelude::*; + self.as_os_str().as_bytes().encode(e) + } + #[cfg(windows)] + fn encode(&self, e: &mut S) -> Result<(), S::Error> { + use std::os::windows::prelude::*; + let v = self.as_os_str().encode_wide().collect::>(); + v.encode(e) + } +} + +impl Encodable for path::PathBuf { + fn encode(&self, e: &mut S) -> Result<(), S::Error> { + (**self).encode(e) + } +} + +impl Decodable for path::PathBuf { + #[cfg(target_os = "redox")] + fn decode(d: &mut D) -> Result { + let string: String = try!(Decodable::decode(d)); + let s: OsString = OsString::from(string); + let mut p = path::PathBuf::new(); + p.push(s); + Ok(p) + } + #[cfg(unix)] + fn decode(d: &mut D) -> Result { + use std::os::unix::prelude::*; + let bytes: Vec = try!(Decodable::decode(d)); + let s: OsString = OsStringExt::from_vec(bytes); + let mut p = path::PathBuf::new(); + p.push(s); + Ok(p) + } + #[cfg(windows)] + fn decode(d: &mut D) -> Result { + use std::os::windows::prelude::*; + let bytes: Vec = try!(Decodable::decode(d)); + let s: OsString = OsStringExt::from_wide(&bytes); + let mut p = path::PathBuf::new(); + p.push(s); + Ok(p) + } +} + +impl Encodable for Cell { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + self.get().encode(s) + } +} + +impl Decodable for Cell { + fn decode(d: &mut D) -> Result, D::Error> { + Ok(Cell::new(try!(Decodable::decode(d)))) + } +} + +// FIXME: #15036 +// Should use `try_borrow`, returning a +// `encoder.error("attempting to Encode borrowed RefCell")` +// from `encode` when `try_borrow` returns `None`. + +impl Encodable for RefCell { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + self.borrow().encode(s) + } +} + +impl Decodable for RefCell { + fn decode(d: &mut D) -> Result, D::Error> { + Ok(RefCell::new(try!(Decodable::decode(d)))) + } +} + +impl Encodable for Arc { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + (**self).encode(s) + } +} + +impl Decodable for Arc { + fn decode(d: &mut D) -> Result, D::Error> { + Ok(Arc::new(try!(Decodable::decode(d)))) + } +} + +// ___________________________________________________________________________ +// Helper routines + +/// Trait with helper functions for implementing `Encodable`. +/// +/// This trait is implemented for everything that implements `Encoder`. +/// `Encodable` implementations can make use of it to make their implementations +/// easier. +pub trait EncoderHelpers: Encoder { + /// Emit a vector as a sequence. + /// + /// Storing sequences as vectors is a common pattern. This method makes + /// encoding such sequences easier by wrapping the calls to + /// `Encoder::emit_seq` and `Encoder::emit_seq_elt`. + /// + /// # Examples + /// + /// ``` + /// use rustc_serialize::Encodable; + /// use rustc_serialize::Encoder; + /// use rustc_serialize::EncoderHelpers; + /// + /// struct NumberSequence { + /// elements: Vec, + /// } + /// + /// impl Encodable for NumberSequence { + /// fn encode(&self, s: &mut S) -> Result<(), S::Error> { + /// s.emit_struct("NumberSequence", 1, |s| { + /// s.emit_struct_field("elements", 0, |s| { + /// s.emit_from_vec(&self.elements, |s,e| { + /// s.emit_i32(*e) + /// }) + /// }) + /// }) + /// } + /// } + /// ``` + fn emit_from_vec(&mut self, v: &[T], f: F) + -> Result<(), ::Error> + where F: FnMut(&mut Self, &T) -> Result<(), ::Error>; +} + +impl EncoderHelpers for S { + fn emit_from_vec(&mut self, v: &[T], mut f: F) -> Result<(), S::Error> where + F: FnMut(&mut S, &T) -> Result<(), S::Error>, + { + self.emit_seq(v.len(), |this| { + for (i, e) in v.iter().enumerate() { + try!(this.emit_seq_elt(i, |this| { + f(this, e) + })); + } + Ok(()) + }) + } +} + +/// Trait with helper functions for implementing `Decodable`. +/// +/// This trait is implemented for everything that implements `Decoder`. +/// `Decodable` implementations can make use of it to make their implementations +/// easier. +pub trait DecoderHelpers: Decoder { + /// Read a sequence into a vector. + /// + /// Storing sequences as vectors is a common pattern. This method makes + /// deserializing such sequences easier by wrapping the calls to + /// `Decoder::read_seq` and `Decoder::read_seq_elt`. + /// + /// # Examples + /// + /// ``` + /// use rustc_serialize::Decodable; + /// use rustc_serialize::Decoder; + /// use rustc_serialize::DecoderHelpers; + /// + /// struct NumberSequence { + /// elements: Vec, + /// } + /// + /// impl Decodable for NumberSequence { + /// fn decode(d: &mut D) -> Result { + /// d.read_struct("NumberSequence", 2, |d| { + /// Ok(NumberSequence{ + /// elements: try!(d.read_struct_field("elements", 0, |d| { + /// d.read_to_vec(|d| { d.read_i32() }) + /// })) + /// }) + /// }) + /// } + /// } + /// ``` + fn read_to_vec(&mut self, f: F) + -> Result, ::Error> where + F: FnMut(&mut Self) -> Result::Error>; +} + +impl DecoderHelpers for D { + fn read_to_vec(&mut self, mut f: F) -> Result, D::Error> where F: + FnMut(&mut D) -> Result, + { + self.read_seq(|this, len| { + let mut v = Vec::with_capacity(cap_capacity::(len)); + for i in 0..len { + v.push(try!(this.read_seq_elt(i, |this| f(this)))); + } + Ok(v) + }) + } +} + +#[test] +#[allow(unused_variables)] +fn capacity_rules() { + use std::usize::MAX; + use std::collections::{HashMap, HashSet}; + + struct MyDecoder; + impl Decoder for MyDecoder { + type Error = (); + + // Primitive types: + fn read_nil(&mut self) -> Result<(), Self::Error> { Err(()) } + fn read_usize(&mut self) -> Result { Err(()) } + fn read_u64(&mut self) -> Result { Err(()) } + fn read_u32(&mut self) -> Result { Err(()) } + fn read_u16(&mut self) -> Result { Err(()) } + fn read_u8(&mut self) -> Result { Err(()) } + fn read_isize(&mut self) -> Result { Err(()) } + fn read_i64(&mut self) -> Result { Err(()) } + fn read_i32(&mut self) -> Result { Err(()) } + fn read_i16(&mut self) -> Result { Err(()) } + fn read_i8(&mut self) -> Result { Err(()) } + fn read_bool(&mut self) -> Result { Err(()) } + fn read_f64(&mut self) -> Result { Err(()) } + fn read_f32(&mut self) -> Result { Err(()) } + fn read_char(&mut self) -> Result { Err(()) } + fn read_str(&mut self) -> Result { Err(()) } + + // Compound types: + fn read_enum(&mut self, name: &str, f: F) -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + fn read_enum_variant(&mut self, names: &[&str], f: F) + -> Result + where F: FnMut(&mut Self, usize) -> Result { Err(()) } + fn read_enum_variant_arg(&mut self, a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + fn read_enum_struct_variant(&mut self, names: &[&str], f: F) + -> Result + where F: FnMut(&mut Self, usize) -> Result { Err(()) } + fn read_enum_struct_variant_field(&mut self, + f_name: &str, + f_idx: usize, + f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + fn read_struct(&mut self, s_name: &str, len: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + fn read_struct_field(&mut self, + f_name: &str, + f_idx: usize, + f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + fn read_tuple(&mut self, len: usize, f: F) -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + fn read_tuple_arg(&mut self, a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + fn read_tuple_struct(&mut self, s_name: &str, len: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + fn read_tuple_struct_arg(&mut self, a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + // Specialized types: + fn read_option(&mut self, f: F) -> Result + where F: FnMut(&mut Self, bool) -> Result { Err(()) } + + fn read_seq(&mut self, f: F) -> Result + where F: FnOnce(&mut Self, usize) -> Result { + f(self, MAX) + } + fn read_seq_elt(&mut self, idx: usize, f: F) -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + fn read_map(&mut self, f: F) -> Result + where F: FnOnce(&mut Self, usize) -> Result { + f(self, MAX) + } + fn read_map_elt_key(&mut self, idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + fn read_map_elt_val(&mut self, idx: usize, f: F) + -> Result + where F: FnOnce(&mut Self) -> Result { Err(()) } + + // Failure + fn error(&mut self, err: &str) -> Self::Error { () } + } + + let mut dummy = MyDecoder; + let vec_result: Result, ()> = Decodable::decode(&mut dummy); + assert!(vec_result.is_err()); + + let map_result: Result, ()> = Decodable::decode(&mut dummy); + assert!(map_result.is_err()); + + let set_result: Result, ()> = Decodable::decode(&mut dummy); + assert!(set_result.is_err()); +} diff --git a/third_party/rust/serde/.cargo-checksum.json b/third_party/rust/serde/.cargo-checksum.json new file mode 100644 index 000000000000..9d24effb39d4 --- /dev/null +++ b/third_party/rust/serde/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"37cf6256c6eb377c59bac3c48ca9ac70b100173c1114de357084edf2a5381044","src/bytes.rs":"ec2fb40df6a1e1233462d85145a57eb33a1df0140ed921e9fe0a0ca35c7c1064","src/de/from_primitive.rs":"b1bd165e343a4380965551709119ef9ed895e4b025045a810dabd671511ba3ab","src/de/impls.rs":"3e27049398fc000ae0ec89f0358e5cd8fe55d6ddf0bc5a0a9ae9de936ce0935b","src/de/mod.rs":"62291b6b7c29d411b9ff212cab480982e535e7aee21c1729b4bb592d681ab807","src/de/value.rs":"6dd878ce762799048c0ebc8f834932871e1bdf24953ea69415a2b2148e0d3dbc","src/error.rs":"da31d3881930f0e787d75191984f71fe2e1419d9331c68baa0fc0ce2d561766b","src/iter.rs":"30090fe6ab49bb1d8c7fec362cace52981b2c4e1a1a8e3fad4117eab558cdde6","src/lib.rs":"67f62df097e3b55a90a566af56d6e3c641f719300db8bfd5603ed5a2bff1aa8e","src/macros.rs":"e81e421815fac10d6a7bfb727bbe7b4f24e99b03cd8739efc806e4b704ac7b4e","src/ser/impls.rs":"36d372af1dae11444f85e497eefb98449bae70260348cdfb098c508439be7952","src/ser/mod.rs":"626e8ef5b1ddaf00fe84905e936046c40217e31609d5a56ca658f4eb23983fd5","src/utils.rs":"b0d1a54af90e3620abd66479d757a2eb442449788c4ece93161916da0838affa"},"package":"9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"} \ No newline at end of file diff --git a/third_party/rust/serde/.cargo-ok b/third_party/rust/serde/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/serde/Cargo.toml b/third_party/rust/serde/Cargo.toml new file mode 100644 index 000000000000..91e37251b74a --- /dev/null +++ b/third_party/rust/serde/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "serde" +version = "0.8.23" +authors = ["Erick Tryzelaar "] +license = "MIT/Apache-2.0" +description = "A generic serialization/deserialization framework" +homepage = "https://serde.rs" +repository = "https://github.com/serde-rs/serde" +documentation = "https://docs.serde.rs/serde/" +readme = "../README.md" +keywords = ["serde", "serialization"] +categories = ["encoding"] +include = ["Cargo.toml", "src/**/*.rs"] + +[features] +default = ["std"] + +std = [] +unstable = [] +alloc = ["unstable"] +collections = ["alloc"] +unstable-testing = ["clippy", "unstable", "std"] + +[dependencies] +clippy = { version = "^0.*", optional = true } diff --git a/third_party/rust/serde/src/bytes.rs b/third_party/rust/serde/src/bytes.rs new file mode 100644 index 000000000000..988c24a557d1 --- /dev/null +++ b/third_party/rust/serde/src/bytes.rs @@ -0,0 +1,252 @@ +//! Helper module to enable serializing bytes more efficiently + +use core::{ops, fmt, char, iter, slice}; +use core::fmt::Write; + +use ser; + +#[cfg(any(feature = "std", feature = "collections"))] +pub use self::bytebuf::{ByteBuf, ByteBufVisitor}; + +#[cfg(feature = "collections")] +use collections::Vec; + +/////////////////////////////////////////////////////////////////////////////// + +/// `Bytes` wraps a `&[u8]` in order to serialize into a byte array. +#[derive(Clone, Copy, Eq, Hash, PartialEq, PartialOrd, Ord)] +pub struct Bytes<'a> { + bytes: &'a [u8], +} + +impl<'a> Bytes<'a> { + /// Wrap an existing `&[u8]`. + pub fn new(bytes: &'a [u8]) -> Self { + Bytes { + bytes: bytes, + } + } +} + +impl<'a> fmt::Debug for Bytes<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + try!(f.write_str("b\"")); + for c in escape_bytestring(self.bytes) { + try!(f.write_char(c)); + } + f.write_char('"') + } +} + +impl<'a> From<&'a [u8]> for Bytes<'a> { + fn from(bytes: &'a [u8]) -> Self { + Bytes::new(bytes) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl<'a> From<&'a Vec> for Bytes<'a> { + fn from(bytes: &'a Vec) -> Self { + Bytes::new(bytes) + } +} + +impl<'a> Into<&'a [u8]> for Bytes<'a> { + fn into(self) -> &'a [u8] { + self.bytes + } +} + +impl<'a> ops::Deref for Bytes<'a> { + type Target = [u8]; + + fn deref(&self) -> &[u8] { self.bytes } +} + +impl<'a> ser::Serialize for Bytes<'a> { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: ser::Serializer + { + serializer.serialize_bytes(self.bytes) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "collections"))] +mod bytebuf { + use core::ops; + use core::fmt; + use core::fmt::Write; + + use ser; + use de; + + #[cfg(feature = "collections")] + use collections::{String, Vec}; + + /// `ByteBuf` wraps a `Vec` and serializes as a byte array. + #[derive(Clone, Default, Eq, Hash, PartialEq, PartialOrd, Ord)] + pub struct ByteBuf { + bytes: Vec, + } + + impl ByteBuf { + /// Construct a new, empty `ByteBuf`. + pub fn new() -> Self { + ByteBuf::from(Vec::new()) + } + + /// Construct a new, empty `ByteBuf` with the specified capacity. + pub fn with_capacity(cap: usize) -> Self { + ByteBuf::from(Vec::with_capacity(cap)) + } + + /// Wrap existing bytes in a `ByteBuf`. + pub fn from>>(bytes: T) -> Self { + ByteBuf { + bytes: bytes.into(), + } + } + } + + impl fmt::Debug for ByteBuf { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + try!(f.write_str("b\"")); + for c in super::escape_bytestring(self.bytes.as_ref()) { + try!(f.write_char(c)); + } + f.write_char('"') + } + } + + impl Into> for ByteBuf { + fn into(self) -> Vec { + self.bytes + } + } + + impl From> for ByteBuf { + fn from(bytes: Vec) -> Self { + ByteBuf::from(bytes) + } + } + + impl AsRef> for ByteBuf { + fn as_ref(&self) -> &Vec { + &self.bytes + } + } + + impl AsRef<[u8]> for ByteBuf { + fn as_ref(&self) -> &[u8] { + &self.bytes + } + } + + impl AsMut> for ByteBuf { + fn as_mut(&mut self) -> &mut Vec { + &mut self.bytes + } + } + + impl AsMut<[u8]> for ByteBuf { + fn as_mut(&mut self) -> &mut [u8] { + &mut self.bytes + } + } + + impl ops::Deref for ByteBuf { + type Target = [u8]; + + fn deref(&self) -> &[u8] { &self.bytes[..] } + } + + impl ops::DerefMut for ByteBuf { + fn deref_mut(&mut self) -> &mut [u8] { &mut self.bytes[..] } + } + + impl ser::Serialize for ByteBuf { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: ser::Serializer + { + serializer.serialize_bytes(self) + } + } + + /// This type implements the `serde::de::Visitor` trait for a `ByteBuf`. + pub struct ByteBufVisitor; + + impl de::Visitor for ByteBufVisitor { + type Value = ByteBuf; + + #[inline] + fn visit_unit(&mut self) -> Result + where E: de::Error, + { + Ok(ByteBuf::new()) + } + + #[inline] + fn visit_seq(&mut self, mut visitor: V) -> Result + where V: de::SeqVisitor, + { + let (len, _) = visitor.size_hint(); + let mut values = Vec::with_capacity(len); + + while let Some(value) = try!(visitor.visit()) { + values.push(value); + } + + try!(visitor.end()); + + Ok(ByteBuf::from(values)) + } + + #[inline] + fn visit_bytes(&mut self, v: &[u8]) -> Result + where E: de::Error, + { + Ok(ByteBuf::from(v)) + } + + #[inline] + fn visit_byte_buf(&mut self, v: Vec) -> Result + where E: de::Error, + { + Ok(ByteBuf::from(v)) + } + + fn visit_str(&mut self, v: &str) -> Result + where E: de::Error, + { + Ok(ByteBuf::from(v)) + } + + fn visit_string(&mut self, v: String) -> Result + where E: de::Error, + { + Ok(ByteBuf::from(v)) + } + } + + impl de::Deserialize for ByteBuf { + #[inline] + fn deserialize(deserializer: &mut D) -> Result + where D: de::Deserializer + { + deserializer.deserialize_bytes(ByteBufVisitor) + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[inline] +fn escape_bytestring<'a>(bytes: &'a [u8]) -> iter::FlatMap, char::EscapeDefault, fn(&u8) -> char::EscapeDefault> { + fn f(b: &u8) -> char::EscapeDefault { + char::from_u32(*b as u32).unwrap().escape_default() + } + bytes.iter().flat_map(f as fn(&u8) -> char::EscapeDefault) +} diff --git a/third_party/rust/serde/src/de/from_primitive.rs b/third_party/rust/serde/src/de/from_primitive.rs new file mode 100644 index 000000000000..14e518605a13 --- /dev/null +++ b/third_party/rust/serde/src/de/from_primitive.rs @@ -0,0 +1,409 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Extracted from https://github.com/rust-num/num. + +// Rust 1.5 is unhappy that this private module is undocumented. +#![allow(missing_docs)] + +use core::{usize, u8, u16, u32, u64}; +use core::{isize, i8, i16, i32, i64}; +use core::{f32, f64}; +use core::mem::size_of; + +/// Numbers which have upper and lower bounds +pub trait Bounded { + // FIXME (#5527): These should be associated constants + /// returns the smallest finite number this type can represent + fn min_value() -> Self; + /// returns the largest finite number this type can represent + fn max_value() -> Self; +} + +macro_rules! bounded_impl { + ($t:ty, $min:expr, $max:expr) => { + impl Bounded for $t { + #[inline] + fn min_value() -> $t { $min } + + #[inline] + fn max_value() -> $t { $max } + } + } +} + +bounded_impl!(usize, usize::MIN, usize::MAX); +bounded_impl!(u8, u8::MIN, u8::MAX); +bounded_impl!(u16, u16::MIN, u16::MAX); +bounded_impl!(u32, u32::MIN, u32::MAX); +bounded_impl!(u64, u64::MIN, u64::MAX); + +bounded_impl!(isize, isize::MIN, isize::MAX); +bounded_impl!(i8, i8::MIN, i8::MAX); +bounded_impl!(i16, i16::MIN, i16::MAX); +bounded_impl!(i32, i32::MIN, i32::MAX); +bounded_impl!(i64, i64::MIN, i64::MAX); + +bounded_impl!(f32, f32::MIN, f32::MAX); +bounded_impl!(f64, f64::MIN, f64::MAX); + +/// A generic trait for converting a value to a number. +pub trait ToPrimitive { + /// Converts the value of `self` to an `isize`. + #[inline] + fn to_isize(&self) -> Option { + self.to_i64().and_then(|x| x.to_isize()) + } + + /// Converts the value of `self` to an `i8`. + #[inline] + fn to_i8(&self) -> Option { + self.to_i64().and_then(|x| x.to_i8()) + } + + /// Converts the value of `self` to an `i16`. + #[inline] + fn to_i16(&self) -> Option { + self.to_i64().and_then(|x| x.to_i16()) + } + + /// Converts the value of `self` to an `i32`. + #[inline] + fn to_i32(&self) -> Option { + self.to_i64().and_then(|x| x.to_i32()) + } + + /// Converts the value of `self` to an `i64`. + fn to_i64(&self) -> Option; + + /// Converts the value of `self` to a `usize`. + #[inline] + fn to_usize(&self) -> Option { + self.to_u64().and_then(|x| x.to_usize()) + } + + /// Converts the value of `self` to an `u8`. + #[inline] + fn to_u8(&self) -> Option { + self.to_u64().and_then(|x| x.to_u8()) + } + + /// Converts the value of `self` to an `u16`. + #[inline] + fn to_u16(&self) -> Option { + self.to_u64().and_then(|x| x.to_u16()) + } + + /// Converts the value of `self` to an `u32`. + #[inline] + fn to_u32(&self) -> Option { + self.to_u64().and_then(|x| x.to_u32()) + } + + /// Converts the value of `self` to an `u64`. + #[inline] + fn to_u64(&self) -> Option; + + /// Converts the value of `self` to an `f32`. + #[inline] + fn to_f32(&self) -> Option { + self.to_f64().and_then(|x| x.to_f32()) + } + + /// Converts the value of `self` to an `f64`. + #[inline] + fn to_f64(&self) -> Option { + self.to_i64().and_then(|x| x.to_f64()) + } +} + +macro_rules! impl_to_primitive_int_to_int { + ($SrcT:ty, $DstT:ty, $slf:expr) => ( + { + if size_of::<$SrcT>() <= size_of::<$DstT>() { + Some($slf as $DstT) + } else { + let n = $slf as i64; + let min_value: $DstT = Bounded::min_value(); + let max_value: $DstT = Bounded::max_value(); + if min_value as i64 <= n && n <= max_value as i64 { + Some($slf as $DstT) + } else { + None + } + } + } + ) +} + +macro_rules! impl_to_primitive_int_to_uint { + ($SrcT:ty, $DstT:ty, $slf:expr) => ( + { + let zero: $SrcT = 0; + let max_value: $DstT = Bounded::max_value(); + if zero <= $slf && $slf as u64 <= max_value as u64 { + Some($slf as $DstT) + } else { + None + } + } + ) +} + +macro_rules! impl_to_primitive_int { + ($T:ty) => ( + impl ToPrimitive for $T { + #[inline] + fn to_isize(&self) -> Option { impl_to_primitive_int_to_int!($T, isize, *self) } + #[inline] + fn to_i8(&self) -> Option { impl_to_primitive_int_to_int!($T, i8, *self) } + #[inline] + fn to_i16(&self) -> Option { impl_to_primitive_int_to_int!($T, i16, *self) } + #[inline] + fn to_i32(&self) -> Option { impl_to_primitive_int_to_int!($T, i32, *self) } + #[inline] + fn to_i64(&self) -> Option { impl_to_primitive_int_to_int!($T, i64, *self) } + + #[inline] + fn to_usize(&self) -> Option { impl_to_primitive_int_to_uint!($T, usize, *self) } + #[inline] + fn to_u8(&self) -> Option { impl_to_primitive_int_to_uint!($T, u8, *self) } + #[inline] + fn to_u16(&self) -> Option { impl_to_primitive_int_to_uint!($T, u16, *self) } + #[inline] + fn to_u32(&self) -> Option { impl_to_primitive_int_to_uint!($T, u32, *self) } + #[inline] + fn to_u64(&self) -> Option { impl_to_primitive_int_to_uint!($T, u64, *self) } + + #[inline] + fn to_f32(&self) -> Option { Some(*self as f32) } + #[inline] + fn to_f64(&self) -> Option { Some(*self as f64) } + } + ) +} + +impl_to_primitive_int! { isize } +impl_to_primitive_int! { i8 } +impl_to_primitive_int! { i16 } +impl_to_primitive_int! { i32 } +impl_to_primitive_int! { i64 } + +macro_rules! impl_to_primitive_uint_to_int { + ($DstT:ty, $slf:expr) => ( + { + let max_value: $DstT = Bounded::max_value(); + if $slf as u64 <= max_value as u64 { + Some($slf as $DstT) + } else { + None + } + } + ) +} + +macro_rules! impl_to_primitive_uint_to_uint { + ($SrcT:ty, $DstT:ty, $slf:expr) => ( + { + if size_of::<$SrcT>() <= size_of::<$DstT>() { + Some($slf as $DstT) + } else { + let zero: $SrcT = 0; + let max_value: $DstT = Bounded::max_value(); + if zero <= $slf && $slf as u64 <= max_value as u64 { + Some($slf as $DstT) + } else { + None + } + } + } + ) +} + +macro_rules! impl_to_primitive_uint { + ($T:ty) => ( + impl ToPrimitive for $T { + #[inline] + fn to_isize(&self) -> Option { impl_to_primitive_uint_to_int!(isize, *self) } + #[inline] + fn to_i8(&self) -> Option { impl_to_primitive_uint_to_int!(i8, *self) } + #[inline] + fn to_i16(&self) -> Option { impl_to_primitive_uint_to_int!(i16, *self) } + #[inline] + fn to_i32(&self) -> Option { impl_to_primitive_uint_to_int!(i32, *self) } + #[inline] + fn to_i64(&self) -> Option { impl_to_primitive_uint_to_int!(i64, *self) } + + #[inline] + fn to_usize(&self) -> Option { + impl_to_primitive_uint_to_uint!($T, usize, *self) + } + #[inline] + fn to_u8(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u8, *self) } + #[inline] + fn to_u16(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u16, *self) } + #[inline] + fn to_u32(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u32, *self) } + #[inline] + fn to_u64(&self) -> Option { impl_to_primitive_uint_to_uint!($T, u64, *self) } + + #[inline] + fn to_f32(&self) -> Option { Some(*self as f32) } + #[inline] + fn to_f64(&self) -> Option { Some(*self as f64) } + } + ) +} + +impl_to_primitive_uint! { usize } +impl_to_primitive_uint! { u8 } +impl_to_primitive_uint! { u16 } +impl_to_primitive_uint! { u32 } +impl_to_primitive_uint! { u64 } + +macro_rules! impl_to_primitive_float_to_float { + ($SrcT:ident, $DstT:ident, $slf:expr) => ( + if size_of::<$SrcT>() <= size_of::<$DstT>() { + Some($slf as $DstT) + } else { + let n = $slf as f64; + let max_value: $SrcT = ::core::$SrcT::MAX; + if -max_value as f64 <= n && n <= max_value as f64 { + Some($slf as $DstT) + } else { + None + } + } + ) +} + +macro_rules! impl_to_primitive_float { + ($T:ident) => ( + impl ToPrimitive for $T { + #[inline] + fn to_isize(&self) -> Option { Some(*self as isize) } + #[inline] + fn to_i8(&self) -> Option { Some(*self as i8) } + #[inline] + fn to_i16(&self) -> Option { Some(*self as i16) } + #[inline] + fn to_i32(&self) -> Option { Some(*self as i32) } + #[inline] + fn to_i64(&self) -> Option { Some(*self as i64) } + + #[inline] + fn to_usize(&self) -> Option { Some(*self as usize) } + #[inline] + fn to_u8(&self) -> Option { Some(*self as u8) } + #[inline] + fn to_u16(&self) -> Option { Some(*self as u16) } + #[inline] + fn to_u32(&self) -> Option { Some(*self as u32) } + #[inline] + fn to_u64(&self) -> Option { Some(*self as u64) } + + #[inline] + fn to_f32(&self) -> Option { impl_to_primitive_float_to_float!($T, f32, *self) } + #[inline] + fn to_f64(&self) -> Option { impl_to_primitive_float_to_float!($T, f64, *self) } + } + ) +} + +impl_to_primitive_float! { f32 } +impl_to_primitive_float! { f64 } + +pub trait FromPrimitive: Sized { + #[inline] + fn from_isize(n: isize) -> Option { + FromPrimitive::from_i64(n as i64) + } + + #[inline] + fn from_i8(n: i8) -> Option { + FromPrimitive::from_i64(n as i64) + } + + #[inline] + fn from_i16(n: i16) -> Option { + FromPrimitive::from_i64(n as i64) + } + + #[inline] + fn from_i32(n: i32) -> Option { + FromPrimitive::from_i64(n as i64) + } + + fn from_i64(n: i64) -> Option; + + #[inline] + fn from_usize(n: usize) -> Option { + FromPrimitive::from_u64(n as u64) + } + + #[inline] + fn from_u8(n: u8) -> Option { + FromPrimitive::from_u64(n as u64) + } + + #[inline] + fn from_u16(n: u16) -> Option { + FromPrimitive::from_u64(n as u64) + } + + #[inline] + fn from_u32(n: u32) -> Option { + FromPrimitive::from_u64(n as u64) + } + + fn from_u64(n: u64) -> Option; + + #[inline] + fn from_f32(n: f32) -> Option { + FromPrimitive::from_f64(n as f64) + } + + #[inline] + fn from_f64(n: f64) -> Option { + FromPrimitive::from_i64(n as i64) + } +} + +macro_rules! impl_from_primitive { + ($T:ty, $to_ty:ident) => ( + impl FromPrimitive for $T { + #[inline] fn from_i8(n: i8) -> Option<$T> { n.$to_ty() } + #[inline] fn from_i16(n: i16) -> Option<$T> { n.$to_ty() } + #[inline] fn from_i32(n: i32) -> Option<$T> { n.$to_ty() } + #[inline] fn from_i64(n: i64) -> Option<$T> { n.$to_ty() } + + #[inline] fn from_u8(n: u8) -> Option<$T> { n.$to_ty() } + #[inline] fn from_u16(n: u16) -> Option<$T> { n.$to_ty() } + #[inline] fn from_u32(n: u32) -> Option<$T> { n.$to_ty() } + #[inline] fn from_u64(n: u64) -> Option<$T> { n.$to_ty() } + + #[inline] fn from_f32(n: f32) -> Option<$T> { n.$to_ty() } + #[inline] fn from_f64(n: f64) -> Option<$T> { n.$to_ty() } + } + ) +} + +impl_from_primitive! { isize, to_isize } +impl_from_primitive! { i8, to_i8 } +impl_from_primitive! { i16, to_i16 } +impl_from_primitive! { i32, to_i32 } +impl_from_primitive! { i64, to_i64 } +impl_from_primitive! { usize, to_usize } +impl_from_primitive! { u8, to_u8 } +impl_from_primitive! { u16, to_u16 } +impl_from_primitive! { u32, to_u32 } +impl_from_primitive! { u64, to_u64 } +impl_from_primitive! { f32, to_f32 } +impl_from_primitive! { f64, to_f64 } diff --git a/third_party/rust/serde/src/de/impls.rs b/third_party/rust/serde/src/de/impls.rs new file mode 100644 index 000000000000..8cad930a3cd5 --- /dev/null +++ b/third_party/rust/serde/src/de/impls.rs @@ -0,0 +1,1306 @@ +//! This module contains `Deserialize` and `Visitor` implementations. + +#[cfg(feature = "std")] +use std::borrow::Cow; +#[cfg(all(feature = "unstable", feature = "collections", not(feature = "std")))] +use collections::borrow::Cow; + +#[cfg(all(feature = "collections", not(feature = "std")))] +use collections::{ + BinaryHeap, + BTreeMap, + BTreeSet, + LinkedList, + VecDeque, + Vec, + String, +}; + +#[cfg(feature = "std")] +use std::collections::{ + HashMap, + HashSet, + BinaryHeap, + BTreeMap, + BTreeSet, + LinkedList, + VecDeque, +}; + +#[cfg(all(feature = "unstable", feature = "collections"))] +use collections::enum_set::{CLike, EnumSet}; +#[cfg(all(feature = "unstable", feature = "collections"))] +use collections::borrow::ToOwned; + +use core::hash::{Hash, BuildHasher}; +use core::marker::PhantomData; +#[cfg(feature = "std")] +use std::net; +#[cfg(feature = "std")] +use std::path; +use core::str; + +#[cfg(feature = "std")] +use std::rc::Rc; +#[cfg(all(feature = "unstable", feature = "alloc", not(feature = "std")))] +use alloc::rc::Rc; + +#[cfg(feature = "std")] +use std::sync::Arc; +#[cfg(all(feature = "unstable", feature = "alloc", not(feature = "std")))] +use alloc::arc::Arc; + +#[cfg(all(feature = "unstable", feature = "alloc", not(feature = "std")))] +use alloc::boxed::Box; + +#[cfg(feature = "std")] +use std::time::Duration; + +#[cfg(feature = "unstable")] +use core::nonzero::{NonZero, Zeroable}; + +#[cfg(feature = "unstable")] +use core::num::Zero; + +use de::{ + Deserialize, + Deserializer, + EnumVisitor, + Error, + MapVisitor, + SeqVisitor, + Type, + VariantVisitor, + Visitor, +}; +use de::from_primitive::FromPrimitive; + +/////////////////////////////////////////////////////////////////////////////// + +/// A visitor that produces a `()`. +pub struct UnitVisitor; + +impl Visitor for UnitVisitor { + type Value = (); + + fn visit_unit(&mut self) -> Result<(), E> + where E: Error, + { + Ok(()) + } + + fn visit_seq(&mut self, mut visitor: V) -> Result<(), V::Error> + where V: SeqVisitor, + { + visitor.end() + } +} + +impl Deserialize for () { + fn deserialize(deserializer: &mut D) -> Result<(), D::Error> + where D: Deserializer, + { + deserializer.deserialize_unit(UnitVisitor) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A visitor that produces a `bool`. +pub struct BoolVisitor; + +impl Visitor for BoolVisitor { + type Value = bool; + + fn visit_bool(&mut self, v: bool) -> Result + where E: Error, + { + Ok(v) + } + + fn visit_str(&mut self, s: &str) -> Result + where E: Error, + { + match s.trim_matches(::utils::Pattern_White_Space) { + "true" => Ok(true), + "false" => Ok(false), + _ => Err(Error::invalid_type(Type::Bool)), + } + } +} + +impl Deserialize for bool { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + deserializer.deserialize_bool(BoolVisitor) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! impl_deserialize_num_method { + ($src_ty:ty, $method:ident, $from_method:ident, $ty:expr) => { + #[inline] + fn $method(&mut self, v: $src_ty) -> Result + where E: Error, + { + match FromPrimitive::$from_method(v) { + Some(v) => Ok(v), + None => Err(Error::invalid_type($ty)), + } + } + } +} + +/// A visitor that produces a primitive type. +struct PrimitiveVisitor { + marker: PhantomData, +} + +impl PrimitiveVisitor { + /// Construct a new `PrimitiveVisitor`. + #[inline] + fn new() -> Self { + PrimitiveVisitor { + marker: PhantomData, + } + } +} + +impl Visitor for PrimitiveVisitor + where T: Deserialize + FromPrimitive + str::FromStr +{ + type Value = T; + + impl_deserialize_num_method!(isize, visit_isize, from_isize, Type::Isize); + impl_deserialize_num_method!(i8, visit_i8, from_i8, Type::I8); + impl_deserialize_num_method!(i16, visit_i16, from_i16, Type::I16); + impl_deserialize_num_method!(i32, visit_i32, from_i32, Type::I32); + impl_deserialize_num_method!(i64, visit_i64, from_i64, Type::I64); + impl_deserialize_num_method!(usize, visit_usize, from_usize, Type::Usize); + impl_deserialize_num_method!(u8, visit_u8, from_u8, Type::U8); + impl_deserialize_num_method!(u16, visit_u16, from_u16, Type::U16); + impl_deserialize_num_method!(u32, visit_u32, from_u32, Type::U32); + impl_deserialize_num_method!(u64, visit_u64, from_u64, Type::U64); + impl_deserialize_num_method!(f32, visit_f32, from_f32, Type::F32); + impl_deserialize_num_method!(f64, visit_f64, from_f64, Type::F64); + + #[inline] + fn visit_str(&mut self, s: &str) -> Result + where E: Error, + { + str::FromStr::from_str(s.trim_matches(::utils::Pattern_White_Space)).or_else(|_| { + Err(Error::invalid_type(Type::Str)) + }) + } +} + +macro_rules! impl_deserialize_num { + ($ty:ty, $method:ident) => { + impl Deserialize for $ty { + #[inline] + fn deserialize(deserializer: &mut D) -> Result<$ty, D::Error> + where D: Deserializer, + { + deserializer.$method(PrimitiveVisitor::new()) + } + } + } +} + +impl_deserialize_num!(isize, deserialize_isize); +impl_deserialize_num!(i8, deserialize_i8); +impl_deserialize_num!(i16, deserialize_i16); +impl_deserialize_num!(i32, deserialize_i32); +impl_deserialize_num!(i64, deserialize_i64); +impl_deserialize_num!(usize, deserialize_usize); +impl_deserialize_num!(u8, deserialize_u8); +impl_deserialize_num!(u16, deserialize_u16); +impl_deserialize_num!(u32, deserialize_u32); +impl_deserialize_num!(u64, deserialize_u64); +impl_deserialize_num!(f32, deserialize_f32); +impl_deserialize_num!(f64, deserialize_f64); + +/////////////////////////////////////////////////////////////////////////////// + +struct CharVisitor; + +impl Visitor for CharVisitor { + type Value = char; + + #[inline] + fn visit_char(&mut self, v: char) -> Result + where E: Error, + { + Ok(v) + } + + #[inline] + fn visit_str(&mut self, v: &str) -> Result + where E: Error, + { + let mut iter = v.chars(); + if let Some(v) = iter.next() { + if iter.next().is_some() { + Err(Error::invalid_type(Type::Char)) + } else { + Ok(v) + } + } else { + Err(Error::end_of_stream()) + } + } +} + +impl Deserialize for char { + #[inline] + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + deserializer.deserialize_char(CharVisitor) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "collections"))] +struct StringVisitor; + +#[cfg(any(feature = "std", feature = "collections"))] +impl Visitor for StringVisitor { + type Value = String; + + fn visit_str(&mut self, v: &str) -> Result + where E: Error, + { + Ok(v.to_owned()) + } + + fn visit_string(&mut self, v: String) -> Result + where E: Error, + { + Ok(v) + } + + fn visit_unit(&mut self) -> Result + where E: Error, + { + Ok(String::new()) + } + + fn visit_bytes(&mut self, v: &[u8]) -> Result + where E: Error, + { + match str::from_utf8(v) { + Ok(s) => Ok(s.to_owned()), + Err(_) => Err(Error::invalid_type(Type::String)), + } + } + + fn visit_byte_buf(&mut self, v: Vec) -> Result + where E: Error, + { + match String::from_utf8(v) { + Ok(s) => Ok(s), + Err(_) => Err(Error::invalid_type(Type::String)), + } + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Deserialize for String { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + deserializer.deserialize_string(StringVisitor) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +struct OptionVisitor { + marker: PhantomData, +} + +impl< + T: Deserialize, +> Visitor for OptionVisitor { + type Value = Option; + + #[inline] + fn visit_unit(&mut self) -> Result, E> + where E: Error, + { + Ok(None) + } + + #[inline] + fn visit_none(&mut self) -> Result, E> + where E: Error, + { + Ok(None) + } + + #[inline] + fn visit_some(&mut self, deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + Ok(Some(try!(Deserialize::deserialize(deserializer)))) + } +} + +impl Deserialize for Option where T: Deserialize { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + deserializer.deserialize_option(OptionVisitor { marker: PhantomData }) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A visitor that produces a `PhantomData`. +pub struct PhantomDataVisitor { + marker: PhantomData, +} + +impl Visitor for PhantomDataVisitor { + type Value = PhantomData; + + #[inline] + fn visit_unit(&mut self) -> Result, E> + where E: Error, + { + Ok(PhantomData) + } +} + +impl Deserialize for PhantomData { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + let visitor = PhantomDataVisitor { marker: PhantomData }; + deserializer.deserialize_unit_struct("PhantomData", visitor) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! seq_impl { + ( + $ty:ty, + $visitor_ty:ident < $($typaram:ident : $bound1:ident $(+ $bound2:ident)*),* >, + $visitor:ident, + $ctor:expr, + $with_capacity:expr, + $insert:expr + ) => { + /// A visitor that produces a sequence. + pub struct $visitor_ty<$($typaram),*> { + marker: PhantomData<$ty>, + } + + impl<$($typaram),*> $visitor_ty<$($typaram),*> + where $($typaram: $bound1 $(+ $bound2)*),* + { + /// Construct a new sequence visitor. + pub fn new() -> Self { + $visitor_ty { + marker: PhantomData, + } + } + } + + impl<$($typaram),*> Visitor for $visitor_ty<$($typaram),*> + where $($typaram: $bound1 $(+ $bound2)*),* + { + type Value = $ty; + + #[inline] + fn visit_unit(&mut self) -> Result<$ty, E> + where E: Error, + { + Ok($ctor) + } + + #[inline] + fn visit_seq(&mut self, mut $visitor: V) -> Result<$ty, V::Error> + where V: SeqVisitor, + { + let mut values = $with_capacity; + + while let Some(value) = try!($visitor.visit()) { + $insert(&mut values, value); + } + + try!($visitor.end()); + + Ok(values) + } + } + + impl<$($typaram),*> Deserialize for $ty + where $($typaram: $bound1 $(+ $bound2)*),* + { + fn deserialize(deserializer: &mut D) -> Result<$ty, D::Error> + where D: Deserializer, + { + deserializer.deserialize_seq($visitor_ty::new()) + } + } + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +seq_impl!( + BinaryHeap, + BinaryHeapVisitor, + visitor, + BinaryHeap::new(), + BinaryHeap::with_capacity(visitor.size_hint().0), + BinaryHeap::push); + +#[cfg(any(feature = "std", feature = "collections"))] +seq_impl!( + BTreeSet, + BTreeSetVisitor, + visitor, + BTreeSet::new(), + BTreeSet::new(), + BTreeSet::insert); + +#[cfg(all(feature = "unstable", feature = "collections"))] +seq_impl!( + EnumSet, + EnumSetVisitor, + visitor, + EnumSet::new(), + EnumSet::new(), + EnumSet::insert); + +#[cfg(any(feature = "std", feature = "collections"))] +seq_impl!( + LinkedList, + LinkedListVisitor, + visitor, + LinkedList::new(), + LinkedList::new(), + LinkedList::push_back); + +#[cfg(feature = "std")] +seq_impl!( + HashSet, + HashSetVisitor, + visitor, + HashSet::with_hasher(S::default()), + HashSet::with_capacity_and_hasher(visitor.size_hint().0, S::default()), + HashSet::insert); + +#[cfg(any(feature = "std", feature = "collections"))] +seq_impl!( + Vec, + VecVisitor, + visitor, + Vec::new(), + Vec::with_capacity(visitor.size_hint().0), + Vec::push); + +#[cfg(any(feature = "std", feature = "collections"))] +seq_impl!( + VecDeque, + VecDequeVisitor, + visitor, + VecDeque::new(), + VecDeque::with_capacity(visitor.size_hint().0), + VecDeque::push_back); + +/////////////////////////////////////////////////////////////////////////////// + +struct ArrayVisitor { + marker: PhantomData, +} + +impl ArrayVisitor { + pub fn new() -> Self { + ArrayVisitor { + marker: PhantomData, + } + } +} + +impl Visitor for ArrayVisitor<[T; 0]> where T: Deserialize { + type Value = [T; 0]; + + #[inline] + fn visit_unit(&mut self) -> Result<[T; 0], E> + where E: Error, + { + Ok([]) + } + + #[inline] + fn visit_seq(&mut self, mut visitor: V) -> Result<[T; 0], V::Error> + where V: SeqVisitor, + { + try!(visitor.end()); + Ok([]) + } +} + +impl Deserialize for [T; 0] + where T: Deserialize +{ + fn deserialize(deserializer: &mut D) -> Result<[T; 0], D::Error> + where D: Deserializer, + { + deserializer.deserialize_seq_fixed_size(0, ArrayVisitor::<[T; 0]>::new()) + } +} + +macro_rules! array_impls { + ($($len:expr => ($($name:ident)+))+) => { + $( + impl Visitor for ArrayVisitor<[T; $len]> where T: Deserialize { + type Value = [T; $len]; + + #[inline] + fn visit_seq(&mut self, mut visitor: V) -> Result<[T; $len], V::Error> + where V: SeqVisitor, + { + $( + let $name = match try!(visitor.visit()) { + Some(val) => val, + None => return Err(Error::end_of_stream()), + }; + )+ + + try!(visitor.end()); + + Ok([$($name),+]) + } + } + + impl Deserialize for [T; $len] + where T: Deserialize, + { + fn deserialize(deserializer: &mut D) -> Result<[T; $len], D::Error> + where D: Deserializer, + { + deserializer.deserialize_seq_fixed_size($len, ArrayVisitor::<[T; $len]>::new()) + } + } + )+ + } +} + +array_impls! { + 1 => (a) + 2 => (a b) + 3 => (a b c) + 4 => (a b c d) + 5 => (a b c d e) + 6 => (a b c d e f) + 7 => (a b c d e f g) + 8 => (a b c d e f g h) + 9 => (a b c d e f g h i) + 10 => (a b c d e f g h i j) + 11 => (a b c d e f g h i j k) + 12 => (a b c d e f g h i j k l) + 13 => (a b c d e f g h i j k l m) + 14 => (a b c d e f g h i j k l m n) + 15 => (a b c d e f g h i j k l m n o) + 16 => (a b c d e f g h i j k l m n o p) + 17 => (a b c d e f g h i j k l m n o p q) + 18 => (a b c d e f g h i j k l m n o p q r) + 19 => (a b c d e f g h i j k l m n o p q r s) + 20 => (a b c d e f g h i j k l m n o p q r s t) + 21 => (a b c d e f g h i j k l m n o p q r s t u) + 22 => (a b c d e f g h i j k l m n o p q r s t u v) + 23 => (a b c d e f g h i j k l m n o p q r s t u v w) + 24 => (a b c d e f g h i j k l m n o p q r s t u v w x) + 25 => (a b c d e f g h i j k l m n o p q r s t u v w x y) + 26 => (a b c d e f g h i j k l m n o p q r s t u v w x y z) + 27 => (a b c d e f g h i j k l m n o p q r s t u v w x y z aa) + 28 => (a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab) + 29 => (a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac) + 30 => (a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad) + 31 => (a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae) + 32 => (a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af) +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! tuple_impls { + ($($len:expr => $visitor:ident => ($($name:ident)+))+) => { + $( + /// Construct a tuple visitor. + pub struct $visitor<$($name,)+> { + marker: PhantomData<($($name,)+)>, + } + + impl<$($name: Deserialize,)+> $visitor<$($name,)+> { + /// Construct a `TupleVisitor*`. + pub fn new() -> Self { + $visitor { marker: PhantomData } + } + } + + impl<$($name: Deserialize),+> Visitor for $visitor<$($name,)+> { + type Value = ($($name,)+); + + #[inline] + #[allow(non_snake_case)] + fn visit_seq(&mut self, mut visitor: V) -> Result<($($name,)+), V::Error> + where V: SeqVisitor, + { + $( + let $name = match try!(visitor.visit()) { + Some(value) => value, + None => return Err(Error::end_of_stream()), + }; + )+ + + try!(visitor.end()); + + Ok(($($name,)+)) + } + } + + impl<$($name: Deserialize),+> Deserialize for ($($name,)+) { + #[inline] + fn deserialize(deserializer: &mut D) -> Result<($($name,)+), D::Error> + where D: Deserializer, + { + deserializer.deserialize_tuple($len, $visitor::new()) + } + } + )+ + } +} + +tuple_impls! { + 1 => TupleVisitor1 => (T0) + 2 => TupleVisitor2 => (T0 T1) + 3 => TupleVisitor3 => (T0 T1 T2) + 4 => TupleVisitor4 => (T0 T1 T2 T3) + 5 => TupleVisitor5 => (T0 T1 T2 T3 T4) + 6 => TupleVisitor6 => (T0 T1 T2 T3 T4 T5) + 7 => TupleVisitor7 => (T0 T1 T2 T3 T4 T5 T6) + 8 => TupleVisitor8 => (T0 T1 T2 T3 T4 T5 T6 T7) + 9 => TupleVisitor9 => (T0 T1 T2 T3 T4 T5 T6 T7 T8) + 10 => TupleVisitor10 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9) + 11 => TupleVisitor11 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10) + 12 => TupleVisitor12 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11) + 13 => TupleVisitor13 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12) + 14 => TupleVisitor14 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13) + 15 => TupleVisitor15 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14) + 16 => TupleVisitor16 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15) +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! map_impl { + ( + $ty:ty, + $visitor_ty:ident < $($typaram:ident : $bound1:ident $(+ $bound2:ident)*),* >, + $visitor:ident, + $ctor:expr, + $with_capacity:expr + ) => { + /// A visitor that produces a map. + pub struct $visitor_ty<$($typaram),*> { + marker: PhantomData<$ty>, + } + + impl<$($typaram),*> $visitor_ty<$($typaram),*> + where $($typaram: $bound1 $(+ $bound2)*),* + { + /// Construct a `MapVisitor*`. + pub fn new() -> Self { + $visitor_ty { + marker: PhantomData, + } + } + } + + impl<$($typaram),*> Visitor for $visitor_ty<$($typaram),*> + where $($typaram: $bound1 $(+ $bound2)*),* + { + type Value = $ty; + + #[inline] + fn visit_unit(&mut self) -> Result<$ty, E> + where E: Error, + { + Ok($ctor) + } + + #[inline] + fn visit_map(&mut self, mut $visitor: Visitor) -> Result<$ty, Visitor::Error> + where Visitor: MapVisitor, + { + let mut values = $with_capacity; + + while let Some((key, value)) = try!($visitor.visit()) { + values.insert(key, value); + } + + try!($visitor.end()); + + Ok(values) + } + } + + impl<$($typaram),*> Deserialize for $ty + where $($typaram: $bound1 $(+ $bound2)*),* + { + fn deserialize(deserializer: &mut D) -> Result<$ty, D::Error> + where D: Deserializer, + { + deserializer.deserialize_map($visitor_ty::new()) + } + } + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +map_impl!( + BTreeMap, + BTreeMapVisitor, + visitor, + BTreeMap::new(), + BTreeMap::new()); + +#[cfg(feature = "std")] +map_impl!( + HashMap, + HashMapVisitor, + visitor, + HashMap::with_hasher(S::default()), + HashMap::with_capacity_and_hasher(visitor.size_hint().0, S::default())); + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Deserialize for net::IpAddr { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + let s = try!(String::deserialize(deserializer)); + match s.parse() { + Ok(s) => Ok(s), + Err(err) => Err(D::Error::invalid_value(&err.to_string())), + } + } +} + +#[cfg(feature = "std")] +impl Deserialize for net::Ipv4Addr { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + let s = try!(String::deserialize(deserializer)); + match s.parse() { + Ok(s) => Ok(s), + Err(err) => Err(D::Error::invalid_value(&err.to_string())), + } + } +} + +#[cfg(feature = "std")] +impl Deserialize for net::Ipv6Addr { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + let s = try!(String::deserialize(deserializer)); + match s.parse() { + Ok(s) => Ok(s), + Err(err) => Err(D::Error::invalid_value(&err.to_string())), + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Deserialize for net::SocketAddr { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + let s = try!(String::deserialize(deserializer)); + match s.parse() { + Ok(s) => Ok(s), + Err(err) => Err(D::Error::invalid_value(&err.to_string())), + } + } +} + +#[cfg(feature = "std")] +impl Deserialize for net::SocketAddrV4 { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + let s = try!(String::deserialize(deserializer)); + match s.parse() { + Ok(s) => Ok(s), + Err(err) => Err(D::Error::invalid_value(&err.to_string())), + } + } +} + +#[cfg(feature = "std")] +impl Deserialize for net::SocketAddrV6 { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + let s = try!(String::deserialize(deserializer)); + match s.parse() { + Ok(s) => Ok(s), + Err(err) => Err(D::Error::invalid_value(&err.to_string())), + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +struct PathBufVisitor; + +#[cfg(feature = "std")] +impl Visitor for PathBufVisitor { + type Value = path::PathBuf; + + fn visit_str(&mut self, v: &str) -> Result + where E: Error, + { + Ok(From::from(v)) + } + + fn visit_string(&mut self, v: String) -> Result + where E: Error, + { + self.visit_str(&v) + } +} + +#[cfg(feature = "std")] +impl Deserialize for path::PathBuf { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + deserializer.deserialize_string(PathBufVisitor) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Deserialize for Box { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(Box::new(val)) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Deserialize for Box<[T]> { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + let v: Vec = try!(Deserialize::deserialize(deserializer)); + Ok(v.into_boxed_slice()) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Deserialize for Box { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer + { + let s = try!(String::deserialize(deserializer)); + Ok(s.into_boxed_str()) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Deserialize for Arc { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(Arc::new(val)) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Deserialize for Rc { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(Rc::new(val)) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl<'a, T: ?Sized> Deserialize for Cow<'a, T> where T: ToOwned, T::Owned: Deserialize, { + #[inline] + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer, + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(Cow::Owned(val)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +// This is a cleaned-up version of the impl generated by: +// +// #[derive(Deserialize)] +// #[serde(deny_unknown_fields)] +// struct Duration { +// secs: u64, +// nanos: u32, +// } +#[cfg(feature = "std")] +impl Deserialize for Duration { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + enum Field { Secs, Nanos }; + + impl Deserialize for Field { + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + struct FieldVisitor; + + impl Visitor for FieldVisitor { + type Value = Field; + + fn visit_usize(&mut self, value: usize) -> Result + where E: Error, + { + match value { + 0usize => Ok(Field::Secs), + 1usize => Ok(Field::Nanos), + _ => Err(Error::invalid_value("expected a field")), + } + } + + fn visit_str(&mut self, value: &str) -> Result + where E: Error, + { + match value { + "secs" => Ok(Field::Secs), + "nanos" => Ok(Field::Nanos), + _ => Err(Error::unknown_field(value)), + } + } + + fn visit_bytes(&mut self, value: &[u8]) -> Result + where E: Error, + { + match value { + b"secs" => Ok(Field::Secs), + b"nanos" => Ok(Field::Nanos), + _ => { + let value = String::from_utf8_lossy(value); + Err(Error::unknown_field(&value)) + } + } + } + } + + deserializer.deserialize_struct_field(FieldVisitor) + } + } + + struct DurationVisitor; + + impl Visitor for DurationVisitor { + type Value = Duration; + + fn visit_seq(&mut self, mut visitor: V) -> Result + where V: SeqVisitor, + { + let secs: u64 = match try!(visitor.visit()) { + Some(value) => value, + None => { + try!(visitor.end()); + return Err(Error::invalid_length(0)); + } + }; + let nanos: u32 = match try!(visitor.visit()) { + Some(value) => value, + None => { + try!(visitor.end()); + return Err(Error::invalid_length(1)); + } + }; + try!(visitor.end()); + Ok(Duration::new(secs, nanos)) + } + + fn visit_map(&mut self, mut visitor: V) -> Result + where V: MapVisitor, + { + let mut secs: Option = None; + let mut nanos: Option = None; + while let Some(key) = try!(visitor.visit_key::()) { + match key { + Field::Secs => { + if secs.is_some() { + return Err(::duplicate_field("secs")); + } + secs = Some(try!(visitor.visit_value())); + } + Field::Nanos => { + if nanos.is_some() { + return Err(::duplicate_field("nanos")); + } + nanos = Some(try!(visitor.visit_value())); + } + } + } + try!(visitor.end()); + let secs = match secs { + Some(secs) => secs, + None => try!(visitor.missing_field("secs")), + }; + let nanos = match nanos { + Some(nanos) => nanos, + None => try!(visitor.missing_field("nanos")), + }; + Ok(Duration::new(secs, nanos)) + } + } + + const FIELDS: &'static [&'static str] = &["secs", "nanos"]; + deserializer.deserialize_struct("Duration", FIELDS, DurationVisitor) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "unstable")] +impl Deserialize for NonZero where T: Deserialize + PartialEq + Zeroable + Zero { + fn deserialize(deserializer: &mut D) -> Result, D::Error> where D: Deserializer { + let value = try!(Deserialize::deserialize(deserializer)); + if value == Zero::zero() { + return Err(Error::invalid_value("expected a non-zero value")) + } + unsafe { + Ok(NonZero::new(value)) + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + + +impl Deserialize for Result where T: Deserialize, E: Deserialize { + fn deserialize(deserializer: &mut D) -> Result, D::Error> + where D: Deserializer { + enum Field { + Ok, + Err, + } + + impl Deserialize for Field { + #[inline] + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer + { + struct FieldVisitor; + + impl ::de::Visitor for FieldVisitor { + type Value = Field; + + #[cfg(any(feature = "std", feature = "collections"))] + fn visit_usize(&mut self, value: usize) -> Result where E: Error { + #[cfg(feature = "collections")] + use collections::string::ToString; + match value { + 0 => Ok(Field::Ok), + 1 => Ok(Field::Err), + _ => Err(Error::unknown_field(&value.to_string())), + } + } + + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + fn visit_usize(&mut self, value: usize) -> Result where E: Error { + match value { + 0 => Ok(Field::Ok), + 1 => Ok(Field::Err), + _ => Err(Error::unknown_field("some number")), + } + } + + fn visit_str(&mut self, value: &str) -> Result where E: Error { + match value { + "Ok" => Ok(Field::Ok), + "Err" => Ok(Field::Err), + _ => Err(Error::unknown_field(value)), + } + } + + fn visit_bytes(&mut self, value: &[u8]) -> Result where E: Error { + match value { + b"Ok" => Ok(Field::Ok), + b"Err" => Ok(Field::Err), + _ => { + match str::from_utf8(value) { + Ok(value) => Err(Error::unknown_field(value)), + Err(_) => Err(Error::invalid_type(Type::String)), + } + } + } + } + } + + deserializer.deserialize(FieldVisitor) + } + } + + struct Visitor(PhantomData>); + + impl EnumVisitor for Visitor + where T: Deserialize, + E: Deserialize + { + type Value = Result; + + fn visit(&mut self, mut visitor: V) -> Result, V::Error> + where V: VariantVisitor + { + match try!(visitor.visit_variant()) { + Field::Ok => { + let value = try!(visitor.visit_newtype()); + Ok(Ok(value)) + } + Field::Err => { + let value = try!(visitor.visit_newtype()); + Ok(Err(value)) + } + } + } + } + + const VARIANTS: &'static [&'static str] = &["Ok", "Err"]; + + deserializer.deserialize_enum("Result", VARIANTS, Visitor(PhantomData)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A target for deserializers that want to ignore data. Implements +/// Deserialize and silently eats data given to it. +pub struct IgnoredAny; + +impl Deserialize for IgnoredAny { + #[inline] + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer, + { + struct IgnoredAnyVisitor; + + impl Visitor for IgnoredAnyVisitor { + type Value = IgnoredAny; + + #[inline] + fn visit_bool(&mut self, _: bool) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_i64(&mut self, _: i64) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_u64(&mut self, _: u64) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_f64(&mut self, _: f64) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_str(&mut self, _: &str) -> Result + where E: Error, + { + Ok(IgnoredAny) + } + + #[inline] + fn visit_none(&mut self) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_some(&mut self, _: &mut D) -> Result + where D: Deserializer, + { + Ok(IgnoredAny) + } + + #[inline] + fn visit_newtype_struct(&mut self, _: &mut D) -> Result + where D: Deserializer, + { + Ok(IgnoredAny) + } + + #[inline] + fn visit_unit(&mut self) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_seq(&mut self, mut visitor: V) -> Result + where V: SeqVisitor, + { + while let Some(_) = try!(visitor.visit::()) { + // Gobble + } + + try!(visitor.end()); + Ok(IgnoredAny) + } + + #[inline] + fn visit_map(&mut self, mut visitor: V) -> Result + where V: MapVisitor, + { + while let Some((_, _)) = try!(visitor.visit::()) { + // Gobble + } + + try!(visitor.end()); + Ok(IgnoredAny) + } + + #[inline] + fn visit_bytes(&mut self, _: &[u8]) -> Result + where E: Error, + { + Ok(IgnoredAny) + } + } + + // TODO maybe not necessary with impl specialization + deserializer.deserialize_ignored_any(IgnoredAnyVisitor) + } +} diff --git a/third_party/rust/serde/src/de/mod.rs b/third_party/rust/serde/src/de/mod.rs new file mode 100644 index 000000000000..210b36b03b45 --- /dev/null +++ b/third_party/rust/serde/src/de/mod.rs @@ -0,0 +1,830 @@ +//! Generic deserialization framework. + +#[cfg(feature = "std")] +use std::error; +#[cfg(not(feature = "std"))] +use error; + +#[cfg(all(not(feature = "std"), feature = "collections"))] +use collections::{String, Vec}; + +use core::fmt; + +/////////////////////////////////////////////////////////////////////////////// + +pub mod impls; +pub mod value; +mod from_primitive; + +/////////////////////////////////////////////////////////////////////////////// + +/// `Error` is a trait that allows a `Deserialize` to generically create a +/// `Deserializer` error. +pub trait Error: Sized + error::Error { + /// Raised when there is general error when deserializing a type. + #[cfg(any(feature = "std", feature = "collections"))] + fn custom>(msg: T) -> Self; + + /// Raised when there is general error when deserializing a type. + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + fn custom>(msg: T) -> Self; + + /// Raised when a `Deserialize` type unexpectedly hit the end of the stream. + fn end_of_stream() -> Self; + + /// Raised when a `Deserialize` was passed an incorrect type. + fn invalid_type(ty: Type) -> Self { + Error::custom(format!("Invalid type. Expected `{:?}`", ty)) + } + + /// Raised when a `Deserialize` was passed an incorrect value. + fn invalid_value(msg: &str) -> Self { + Error::custom(format!("Invalid value: {}", msg)) + } + + /// Raised when a fixed sized sequence or map was passed in the wrong amount of arguments. + /// + /// The parameter `len` is the number of arguments found in the serialization. The sequence + /// may either expect more arguments or less arguments. + fn invalid_length(len: usize) -> Self { + Error::custom(format!("Invalid length: {}", len)) + } + + /// Raised when a `Deserialize` enum type received an unexpected variant. + fn unknown_variant(field: &str) -> Self { + Error::custom(format!("Unknown variant `{}`", field)) + } + + /// Raised when a `Deserialize` struct type received an unexpected struct field. + fn unknown_field(field: &str) -> Self { + Error::custom(format!("Unknown field `{}`", field)) + } + + /// raised when a `deserialize` struct type did not receive a field. + fn missing_field(field: &'static str) -> Self { + Error::custom(format!("Missing field `{}`", field)) + } + + /// Raised when a `Deserialize` struct type received more than one of the + /// same struct field. + fn duplicate_field(field: &'static str) -> Self { + Error::custom(format!("Duplicate field `{}`", field)) + } +} + +/// `Type` represents all the primitive types that can be deserialized. This is used by +/// `Error::invalid_type`. +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +pub enum Type { + /// Represents a `bool` type. + Bool, + + /// Represents a `usize` type. + Usize, + + /// Represents a `u8` type. + U8, + + /// Represents a `u16` type. + U16, + + /// Represents a `u32` type. + U32, + + /// Represents a `u64` type. + U64, + + /// Represents a `isize` type. + Isize, + + /// Represents a `i8` type. + I8, + + /// Represents a `i16` type. + I16, + + /// Represents a `i32` type. + I32, + + /// Represents a `i64` type. + I64, + + /// Represents a `f32` type. + F32, + + /// Represents a `f64` type. + F64, + + /// Represents a `char` type. + Char, + + /// Represents a `&str` type. + Str, + + /// Represents a `String` type. + String, + + /// Represents a `()` type. + Unit, + + /// Represents an `Option` type. + Option, + + /// Represents a sequence type. + Seq, + + /// Represents a map type. + Map, + + /// Represents a unit struct type. + UnitStruct, + + /// Represents a newtype type. + NewtypeStruct, + + /// Represents a tuple struct type. + TupleStruct, + + /// Represents a struct type. + Struct, + + /// Represents a struct field name. + FieldName, + + /// Represents a tuple type. + Tuple, + + /// Represents an `enum` type. + Enum, + + /// Represents an enum variant name. + VariantName, + + /// Represents a struct variant. + StructVariant, + + /// Represents a tuple variant. + TupleVariant, + + /// Represents a unit variant. + UnitVariant, + + /// Represents a `&[u8]` type. + Bytes, +} + +impl fmt::Display for Type { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + let display = match *self { + Type::Bool => "bool", + Type::Usize => "usize", + Type::U8 => "u8", + Type::U16 => "u16", + Type::U32 => "u32", + Type::U64 => "u64", + Type::Isize => "isize", + Type::I8 => "i8", + Type::I16 => "i16", + Type::I32 => "i32", + Type::I64 => "i64", + Type::F32 => "f32", + Type::F64 => "f64", + Type::Char => "char", + Type::Str => "str", + Type::String => "string", + Type::Unit => "unit", + Type::Option => "option", + Type::Seq => "seq", + Type::Map => "map", + Type::UnitStruct => "unit struct", + Type::NewtypeStruct => "newtype struct", + Type::TupleStruct => "tuple struct", + Type::Struct => "struct", + Type::FieldName => "field name", + Type::Tuple => "tuple", + Type::Enum => "enum", + Type::VariantName => "variant name", + Type::StructVariant => "struct variant", + Type::TupleVariant => "tuple variant", + Type::UnitVariant => "unit variant", + Type::Bytes => "bytes", + }; + display.fmt(formatter) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// `Deserialize` represents a type that can be deserialized. +pub trait Deserialize: Sized { + /// Deserialize this value given this `Deserializer`. + fn deserialize(deserializer: &mut D) -> Result + where D: Deserializer; +} + +/////////////////////////////////////////////////////////////////////////////// + +/// `Deserializer` is a trait that can deserialize values by threading a `Visitor` trait through a +/// value. It supports two entry point styles which enables different kinds of deserialization. +/// +/// 1) The `deserialize` method. File formats like JSON embed the type of its construct in its file +/// format. This allows the `Deserializer` to deserialize into a generic type like +/// `json::Value`, which can represent all JSON types. +/// +/// 2) The `deserialize_*` methods. File formats like bincode do not embed in its format how to +/// decode its values. It relies instead on the `Deserialize` type to hint to the `Deserializer` +/// with the `deserialize_*` methods how it should parse the next value. One downside though to +/// only supporting the `deserialize_*` types is that it does not allow for deserializing into a +/// generic `json::Value`-esque type. +pub trait Deserializer { + /// The error type that can be returned if some error occurs during deserialization. + type Error: Error; + + /// This method walks a visitor through a value as it is being deserialized. + fn deserialize(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a `bool` value. + fn deserialize_bool(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `usize` value. + /// A reasonable default is to forward to `deserialize_u64`. + fn deserialize_usize(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `u8` value. + /// A reasonable default is to forward to `deserialize_u64`. + fn deserialize_u8(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `u16` value. + /// A reasonable default is to forward to `deserialize_u64`. + fn deserialize_u16(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `u32` value. + /// A reasonable default is to forward to `deserialize_u64`. + fn deserialize_u32(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `u64` value. + fn deserialize_u64(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `isize` value. + /// A reasonable default is to forward to `deserialize_i64`. + fn deserialize_isize(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `i8` value. + /// A reasonable default is to forward to `deserialize_i64`. + fn deserialize_i8(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `i16` value. + /// A reasonable default is to forward to `deserialize_i64`. + fn deserialize_i16(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `i32` value. + /// A reasonable default is to forward to `deserialize_i64`. + fn deserialize_i32(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `i64` value. + fn deserialize_i64(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a `f32` value. + /// A reasonable default is to forward to `deserialize_f64`. + fn deserialize_f32(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a `f64` value. + fn deserialize_f64(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a `char` value. + fn deserialize_char(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a `&str` value. + fn deserialize_str(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a `String` value. + fn deserialize_string(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `unit` value. + fn deserialize_unit(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an `Option` value. This allows + /// deserializers that encode an optional value as a nullable value to convert the null value + /// into a `None`, and a regular value as `Some(value)`. + fn deserialize_option(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a sequence value. This allows + /// deserializers to parse sequences that aren't tagged as sequences. + fn deserialize_seq(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a fixed size array. This allows + /// deserializers to parse arrays that aren't tagged as arrays. + fn deserialize_seq_fixed_size(&mut self, + len: usize, + visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a `Vec`. This allows + /// deserializers that provide a custom byte vector serialization to properly deserialize the + /// type. + fn deserialize_bytes(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a map of values. This allows + /// deserializers to parse sequences that aren't tagged as maps. + fn deserialize_map(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a unit struct. This allows + /// deserializers to a unit struct that aren't tagged as a unit struct. + fn deserialize_unit_struct(&mut self, + name: &'static str, + visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a newtype struct. This allows + /// deserializers to a newtype struct that aren't tagged as a newtype struct. + /// A reasonable default is to simply deserialize the expected value directly. + fn deserialize_newtype_struct(&mut self, + name: &'static str, + visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a tuple struct. This allows + /// deserializers to parse sequences that aren't tagged as sequences. + fn deserialize_tuple_struct(&mut self, + name: &'static str, + len: usize, + visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a struct. This allows + /// deserializers to parse sequences that aren't tagged as maps. + fn deserialize_struct(&mut self, + name: &'static str, + fields: &'static [&'static str], + visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting some sort of struct field + /// name. This allows deserializers to choose between &str, usize, or &[u8] to properly + /// deserialize a struct field. + fn deserialize_struct_field(&mut self, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting a tuple value. This allows + /// deserializers that provide a custom tuple serialization to properly deserialize the type. + fn deserialize_tuple(&mut self, len: usize, visitor: V) -> Result + where V: Visitor; + + /// This method hints that the `Deserialize` type is expecting an enum value. This allows + /// deserializers that provide a custom enumeration serialization to properly deserialize the + /// type. + fn deserialize_enum(&mut self, + name: &'static str, + variants: &'static [&'static str], + visitor: V) -> Result + where V: EnumVisitor; + + /// This method hints that the `Deserialize` type needs to deserialize a value whose type + /// doesn't matter because it is ignored. + fn deserialize_ignored_any(&mut self, visitor: V) -> Result + where V: Visitor; +} + +/////////////////////////////////////////////////////////////////////////////// + +/// This trait represents a visitor that walks through a deserializer. +pub trait Visitor { + /// The value produced by this visitor. + type Value: Deserialize; + + /// `visit_bool` deserializes a `bool` into a `Value`. + fn visit_bool(&mut self, v: bool) -> Result + where E: Error, + { + let _ = v; + Err(Error::invalid_type(Type::Bool)) + } + + /// `visit_isize` deserializes a `isize` into a `Value`. + fn visit_isize(&mut self, v: isize) -> Result + where E: Error, + { + self.visit_i64(v as i64) + } + + /// `visit_i8` deserializes a `i8` into a `Value`. + fn visit_i8(&mut self, v: i8) -> Result + where E: Error, + { + self.visit_i64(v as i64) + } + + /// `visit_i16` deserializes a `i16` into a `Value`. + fn visit_i16(&mut self, v: i16) -> Result + where E: Error, + { + self.visit_i64(v as i64) + } + + /// `visit_i32` deserializes a `i32` into a `Value`. + fn visit_i32(&mut self, v: i32) -> Result + where E: Error, + { + self.visit_i64(v as i64) + } + + /// `visit_i64` deserializes a `i64` into a `Value`. + fn visit_i64(&mut self, v: i64) -> Result + where E: Error, + { + let _ = v; + Err(Error::invalid_type(Type::I64)) + } + + /// `visit_usize` deserializes a `usize` into a `Value`. + fn visit_usize(&mut self, v: usize) -> Result + where E: Error, + { + self.visit_u64(v as u64) + } + + /// `visit_u8` deserializes a `u8` into a `Value`. + fn visit_u8(&mut self, v: u8) -> Result + where E: Error, + { + self.visit_u64(v as u64) + } + + /// `visit_u16` deserializes a `u16` into a `Value`. + fn visit_u16(&mut self, v: u16) -> Result + where E: Error, + { + self.visit_u64(v as u64) + } + + /// `visit_u32` deserializes a `u32` into a `Value`. + fn visit_u32(&mut self, v: u32) -> Result + where E: Error, + { + self.visit_u64(v as u64) + } + + /// `visit_u64` deserializes a `u64` into a `Value`. + fn visit_u64(&mut self, v: u64) -> Result + where E: Error, + { + let _ = v; + Err(Error::invalid_type(Type::U64)) + } + + /// `visit_f32` deserializes a `f32` into a `Value`. + fn visit_f32(&mut self, v: f32) -> Result + where E: Error, + { + self.visit_f64(v as f64) + } + + /// `visit_f64` deserializes a `f64` into a `Value`. + fn visit_f64(&mut self, v: f64) -> Result + where E: Error, + { + let _ = v; + Err(Error::invalid_type(Type::F64)) + } + + /// `visit_char` deserializes a `char` into a `Value`. + #[inline] + fn visit_char(&mut self, v: char) -> Result + where E: Error, + { + self.visit_str(::utils::encode_utf8(v).as_str()) + } + + /// `visit_str` deserializes a `&str` into a `Value`. + fn visit_str(&mut self, v: &str) -> Result + where E: Error, + { + let _ = v; + Err(Error::invalid_type(Type::Str)) + } + + /// `visit_string` deserializes a `String` into a `Value`. This allows a deserializer to avoid + /// a copy if it is deserializing a string from a `String` type. By default it passes a `&str` + /// to the `visit_str` method. + #[inline] + #[cfg(any(feature = "std", feature = "collections"))] + fn visit_string(&mut self, v: String) -> Result + where E: Error, + { + self.visit_str(&v) + } + + /// `visit_unit` deserializes a `()` into a `Value`. + fn visit_unit(&mut self) -> Result + where E: Error, + { + Err(Error::invalid_type(Type::Unit)) + } + + /// `visit_unit_struct` deserializes a unit struct into a `Value`. + #[inline] + fn visit_unit_struct(&mut self, name: &'static str) -> Result + where E: Error, + { + let _ = name; + self.visit_unit() + } + + /// `visit_none` deserializes a none value into a `Value`. + fn visit_none(&mut self) -> Result + where E: Error, + { + Err(Error::invalid_type(Type::Option)) + } + + /// `visit_some` deserializes a value into a `Value`. + fn visit_some(&mut self, deserializer: &mut D) -> Result + where D: Deserializer, + { + let _ = deserializer; + Err(Error::invalid_type(Type::Option)) + } + + /// `visit_newtype_struct` deserializes a value into a `Value`. + fn visit_newtype_struct(&mut self, deserializer: &mut D) -> Result + where D: Deserializer, + { + let _ = deserializer; + Err(Error::invalid_type(Type::NewtypeStruct)) + } + + /// `visit_seq` deserializes a `SeqVisitor` into a `Value`. + fn visit_seq(&mut self, visitor: V) -> Result + where V: SeqVisitor, + { + let _ = visitor; + Err(Error::invalid_type(Type::Seq)) + } + + /// `visit_map` deserializes a `MapVisitor` into a `Value`. + fn visit_map(&mut self, visitor: V) -> Result + where V: MapVisitor, + { + let _ = visitor; + Err(Error::invalid_type(Type::Map)) + } + + /// `visit_bytes` deserializes a `&[u8]` into a `Value`. + fn visit_bytes(&mut self, v: &[u8]) -> Result + where E: Error, + { + let _ = v; + Err(Error::invalid_type(Type::Bytes)) + } + + /// `visit_byte_buf` deserializes a `Vec` into a `Value`. + #[cfg(any(feature = "std", feature = "collections"))] + fn visit_byte_buf(&mut self, v: Vec) -> Result + where E: Error, + { + self.visit_bytes(&v) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// `SeqVisitor` visits each item in a sequence. +/// +/// This is a trait that a `Deserializer` passes to a `Visitor` implementation, which deserializes +/// each item in a sequence. +pub trait SeqVisitor { + /// The error type that can be returned if some error occurs during deserialization. + type Error: Error; + + /// This returns a `Ok(Some(value))` for the next value in the sequence, or `Ok(None)` if there + /// are no more remaining items. + fn visit(&mut self) -> Result, Self::Error> + where T: Deserialize; + + /// This signals to the `SeqVisitor` that the `Visitor` does not expect any more items. + fn end(&mut self) -> Result<(), Self::Error>; + + /// Return the lower and upper bound of items remaining in the sequence. + #[inline] + fn size_hint(&self) -> (usize, Option) { + (0, None) + } +} + +impl<'a, V> SeqVisitor for &'a mut V where V: SeqVisitor { + type Error = V::Error; + + #[inline] + fn visit(&mut self) -> Result, V::Error> + where T: Deserialize + { + (**self).visit() + } + + #[inline] + fn end(&mut self) -> Result<(), V::Error> { + (**self).end() + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + (**self).size_hint() + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// `MapVisitor` visits each item in a sequence. +/// +/// This is a trait that a `Deserializer` passes to a `Visitor` implementation. +pub trait MapVisitor { + /// The error type that can be returned if some error occurs during deserialization. + type Error: Error; + + /// This returns a `Ok(Some((key, value)))` for the next (key-value) pair in the map, or + /// `Ok(None)` if there are no more remaining items. + #[inline] + fn visit(&mut self) -> Result, Self::Error> + where K: Deserialize, + V: Deserialize, + { + match try!(self.visit_key()) { + Some(key) => { + let value = try!(self.visit_value()); + Ok(Some((key, value))) + } + None => Ok(None) + } + } + + /// This returns a `Ok(Some(key))` for the next key in the map, or `Ok(None)` if there are no + /// more remaining items. + fn visit_key(&mut self) -> Result, Self::Error> + where K: Deserialize; + + /// This returns a `Ok(value)` for the next value in the map. + fn visit_value(&mut self) -> Result + where V: Deserialize; + + /// This signals to the `MapVisitor` that the `Visitor` does not expect any more items. + fn end(&mut self) -> Result<(), Self::Error>; + + /// Return the lower and upper bound of items remaining in the sequence. + #[inline] + fn size_hint(&self) -> (usize, Option) { + (0, None) + } + + /// Report that the struct has a field that wasn't deserialized + fn missing_field(&mut self, field: &'static str) -> Result + where V: Deserialize, + { + Err(Error::missing_field(field)) + } +} + +impl<'a, V_> MapVisitor for &'a mut V_ where V_: MapVisitor { + type Error = V_::Error; + + #[inline] + fn visit(&mut self) -> Result, V_::Error> + where K: Deserialize, + V: Deserialize, + { + (**self).visit() + } + + #[inline] + fn visit_key(&mut self) -> Result, V_::Error> + where K: Deserialize + { + (**self).visit_key() + } + + #[inline] + fn visit_value(&mut self) -> Result + where V: Deserialize + { + (**self).visit_value() + } + + #[inline] + fn end(&mut self) -> Result<(), V_::Error> { + (**self).end() + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + (**self).size_hint() + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// `EnumVisitor` is a visitor that is created by the `Deserialize` and passed to the +/// `Deserializer` in order to deserialize enums. +pub trait EnumVisitor { + /// The value produced by this visitor. + type Value; + + /// Visit the specific variant with the `VariantVisitor`. + fn visit(&mut self, visitor: V) -> Result + where V: VariantVisitor; +} + +/////////////////////////////////////////////////////////////////////////////// + +/// `VariantVisitor` is a visitor that is created by the `Deserializer` and passed to the +/// `Deserialize` in order to deserialize a specific enum variant. +pub trait VariantVisitor { + /// The error type that can be returned if some error occurs during deserialization. + type Error: Error; + + /// `visit_variant` is called to identify which variant to deserialize. + fn visit_variant(&mut self) -> Result + where V: Deserialize; + + /// `visit_unit` is called when deserializing a variant with no values. + fn visit_unit(&mut self) -> Result<(), Self::Error> { + Err(Error::invalid_type(Type::UnitVariant)) + } + + /// `visit_newtype` is called when deserializing a variant with a single value. + /// A good default is often to use the `visit_tuple` method to deserialize a `(value,)`. + fn visit_newtype(&mut self) -> Result + where T: Deserialize; + + /// `visit_tuple` is called when deserializing a tuple-like variant. + /// If no tuple variants are expected, yield a + /// `Err(serde::de::Error::invalid_type(serde::de::Type::TupleVariant))` + fn visit_tuple(&mut self, + len: usize, + visitor: V) -> Result + where V: Visitor; + + /// `visit_struct` is called when deserializing a struct-like variant. + /// If no struct variants are expected, yield a + /// `Err(serde::de::Error::invalid_type(serde::de::Type::StructVariant))` + fn visit_struct(&mut self, + fields: &'static [&'static str], + visitor: V) -> Result + where V: Visitor; +} + +impl<'a, T> VariantVisitor for &'a mut T where T: VariantVisitor { + type Error = T::Error; + + fn visit_variant(&mut self) -> Result + where V: Deserialize + { + (**self).visit_variant() + } + + fn visit_unit(&mut self) -> Result<(), T::Error> { + (**self).visit_unit() + } + + fn visit_newtype(&mut self) -> Result + where D: Deserialize, + { + (**self).visit_newtype() + } + + fn visit_tuple(&mut self, + len: usize, + visitor: V) -> Result + where V: Visitor, + { + (**self).visit_tuple(len, visitor) + } + + fn visit_struct(&mut self, + fields: &'static [&'static str], + visitor: V) -> Result + where V: Visitor, + { + (**self).visit_struct(fields, visitor) + } +} diff --git a/third_party/rust/serde/src/de/value.rs b/third_party/rust/serde/src/de/value.rs new file mode 100644 index 000000000000..00b07107e0da --- /dev/null +++ b/third_party/rust/serde/src/de/value.rs @@ -0,0 +1,1067 @@ +//! This module supports deserializing from primitives with the `ValueDeserializer` trait. + +#[cfg(feature = "std")] +use std::collections::{ + BTreeMap, + BTreeSet, + HashMap, + HashSet, + btree_map, + btree_set, + hash_map, + hash_set, +}; +#[cfg(feature = "std")] +use std::borrow::Cow; +#[cfg(feature = "std")] +use std::vec; + +#[cfg(all(feature = "collections", not(feature = "std")))] +use collections::{ + BTreeMap, + BTreeSet, + Vec, + String, + btree_map, + btree_set, + vec, +}; +#[cfg(all(feature = "collections", not(feature = "std")))] +use collections::borrow::Cow; + +#[cfg(all(feature = "unstable", feature = "collections"))] +use collections::borrow::ToOwned; + +use core::hash::Hash; +#[cfg(feature = "std")] +use std::error; +#[cfg(not(feature = "std"))] +use error; + +use core::fmt; +use core::marker::PhantomData; + +use de; +use bytes; + +/////////////////////////////////////////////////////////////////////////////// + +/// This represents all the possible errors that can occur using the `ValueDeserializer`. +#[derive(Clone, Debug, PartialEq)] +pub enum Error { + /// The value had some custom error. + #[cfg(any(feature = "std", feature = "collections"))] + Custom(String), + /// The value had some custom error. + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + Custom(&'static str), + + /// The value had an incorrect type. + InvalidType(de::Type), + + /// The value had an invalid length. + InvalidLength(usize), + + /// The value is invalid and cannot be deserialized. + #[cfg(any(feature = "std", feature = "collections"))] + InvalidValue(String), + /// The value is invalid and cannot be deserialized. + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + InvalidValue(&'static str), + + /// EOF while deserializing a value. + EndOfStream, + + /// Unknown variant in enum. + #[cfg(any(feature = "std", feature = "collections"))] + UnknownVariant(String), + /// Unknown variant in enum. + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + UnknownVariant(&'static str), + + /// Unknown field in struct. + #[cfg(any(feature = "std", feature = "collections"))] + UnknownField(String), + /// Unknown field in struct. + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + UnknownField(&'static str), + + /// Struct is missing a field. + MissingField(&'static str), +} + +impl de::Error for Error { + #[cfg(any(feature = "std", feature = "collections"))] + fn custom>(msg: T) -> Self { Error::Custom(msg.into()) } + + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + fn custom>(msg: T) -> Self { Error::Custom(msg.into()) } + + fn end_of_stream() -> Self { Error::EndOfStream } + fn invalid_type(ty: de::Type) -> Self { Error::InvalidType(ty) } + + #[cfg(any(feature = "std", feature = "collections"))] + fn invalid_value(msg: &str) -> Self { Error::InvalidValue(msg.to_owned()) } + + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + fn invalid_value(msg: &str) -> Self { Error::InvalidValue("invalid value") } + + fn invalid_length(len: usize) -> Self { Error::InvalidLength(len) } + + #[cfg(any(feature = "std", feature = "collections"))] + fn unknown_variant(variant: &str) -> Self { Error::UnknownVariant(String::from(variant)) } + #[cfg(any(feature = "std", feature = "collections"))] + fn unknown_field(field: &str) -> Self { Error::UnknownField(String::from(field)) } + + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + fn unknown_variant(variant: &str) -> Self { Error::UnknownVariant("unknown variant") } + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + fn unknown_field(field: &str) -> Self { Error::UnknownField("unknown field") } + fn missing_field(field: &'static str) -> Self { Error::MissingField(field) } +} + +impl fmt::Display for Error { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + Error::Custom(ref s) => write!(formatter, "{}", s), + Error::EndOfStream => formatter.write_str("End of stream"), + Error::InvalidType(ty) => write!(formatter, "Invalid type, expected `{:?}`", ty), + Error::InvalidValue(ref value) => write!(formatter, "Invalid value: {}", value), + Error::InvalidLength(len) => write!(formatter, "Invalid length: {}", len), + Error::UnknownVariant(ref variant) => { + write!(formatter, "Unknown variant: {}", variant) + } + Error::UnknownField(ref field) => write!(formatter, "Unknown field: {}", field), + Error::MissingField(field) => write!(formatter, "Missing field: {}", field), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + "Serde Deserialization Error" + } + + fn cause(&self) -> Option<&error::Error> { + None + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// This trait converts primitive types into a deserializer. +pub trait ValueDeserializer { + /// The actual deserializer type. + type Deserializer: de::Deserializer; + + /// Convert this value into a deserializer. + fn into_deserializer(self) -> Self::Deserializer; +} + +/////////////////////////////////////////////////////////////////////////////// + +impl ValueDeserializer for () + where E: de::Error, +{ + type Deserializer = UnitDeserializer; + + fn into_deserializer(self) -> UnitDeserializer { + UnitDeserializer(PhantomData) + } +} + +/// A helper deserializer that deserializes a `()`. +pub struct UnitDeserializer(PhantomData); + +impl de::Deserializer for UnitDeserializer + where E: de::Error +{ + type Error = E; + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple enum ignored_any + } + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + visitor.visit_unit() + } + + fn deserialize_option(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + visitor.visit_none() + } +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! primitive_deserializer { + ($ty:ty, $name:ident, $method:ident) => { + /// A helper deserializer that deserializes a number. + pub struct $name(Option<$ty>, PhantomData); + + impl ValueDeserializer for $ty + where E: de::Error, + { + type Deserializer = $name; + + fn into_deserializer(self) -> $name { + $name(Some(self), PhantomData) + } + } + + impl de::Deserializer for $name + where E: de::Error, + { + type Error = E; + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str + string unit option seq seq_fixed_size bytes map unit_struct + newtype_struct tuple_struct struct struct_field tuple enum + ignored_any + } + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + match self.0.take() { + Some(v) => visitor.$method(v), + None => Err(de::Error::end_of_stream()), + } + } + } + } +} + +primitive_deserializer!(bool, BoolDeserializer, visit_bool); +primitive_deserializer!(i8, I8Deserializer, visit_i8); +primitive_deserializer!(i16, I16Deserializer, visit_i16); +primitive_deserializer!(i32, I32Deserializer, visit_i32); +primitive_deserializer!(i64, I64Deserializer, visit_i64); +primitive_deserializer!(isize, IsizeDeserializer, visit_isize); +primitive_deserializer!(u8, U8Deserializer, visit_u8); +primitive_deserializer!(u16, U16Deserializer, visit_u16); +primitive_deserializer!(u32, U32Deserializer, visit_u32); +primitive_deserializer!(u64, U64Deserializer, visit_u64); +primitive_deserializer!(usize, UsizeDeserializer, visit_usize); +primitive_deserializer!(f32, F32Deserializer, visit_f32); +primitive_deserializer!(f64, F64Deserializer, visit_f64); +primitive_deserializer!(char, CharDeserializer, visit_char); + +/////////////////////////////////////////////////////////////////////////////// + +/// A helper deserializer that deserializes a `&str`. +pub struct StrDeserializer<'a, E>(Option<&'a str>, PhantomData); + +impl<'a, E> ValueDeserializer for &'a str + where E: de::Error, +{ + type Deserializer = StrDeserializer<'a, E>; + + fn into_deserializer(self) -> StrDeserializer<'a, E> { + StrDeserializer(Some(self), PhantomData) + } +} + +impl<'a, E> de::Deserializer for StrDeserializer<'a, E> + where E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + match self.0.take() { + Some(v) => visitor.visit_str(v), + None => Err(de::Error::end_of_stream()), + } + } + + fn deserialize_enum(&mut self, + _name: &str, + _variants: &'static [&'static str], + mut visitor: V) -> Result + where V: de::EnumVisitor, + { + visitor.visit(self) + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple ignored_any + } +} + +impl<'a, E> de::VariantVisitor for StrDeserializer<'a, E> + where E: de::Error, +{ + type Error = E; + + fn visit_variant(&mut self) -> Result + where T: de::Deserialize, + { + de::Deserialize::deserialize(self) + } + + fn visit_unit(&mut self) -> Result<(), Self::Error> { + Ok(()) + } + + fn visit_newtype(&mut self) -> Result + where T: super::Deserialize, + { + let (value,) = try!(self.visit_tuple(1, super::impls::TupleVisitor1::new())); + Ok(value) + } + + fn visit_tuple(&mut self, + _len: usize, + _visitor: V) -> Result + where V: super::Visitor + { + Err(super::Error::invalid_type(super::Type::TupleVariant)) + } + + fn visit_struct(&mut self, + _fields: &'static [&'static str], + _visitor: V) -> Result + where V: super::Visitor + { + Err(super::Error::invalid_type(super::Type::StructVariant)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A helper deserializer that deserializes a `String`. +#[cfg(any(feature = "std", feature = "collections"))] +pub struct StringDeserializer(Option, PhantomData); + +#[cfg(any(feature = "std", feature = "collections"))] +impl ValueDeserializer for String + where E: de::Error, +{ + type Deserializer = StringDeserializer; + + fn into_deserializer(self) -> StringDeserializer { + StringDeserializer(Some(self), PhantomData) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl de::Deserializer for StringDeserializer + where E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + match self.0.take() { + Some(string) => visitor.visit_string(string), + None => Err(de::Error::end_of_stream()), + } + } + + fn deserialize_enum(&mut self, + _name: &str, + _variants: &'static [&'static str], + mut visitor: V) -> Result + where V: de::EnumVisitor, + { + visitor.visit(self) + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple ignored_any + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl<'a, E> de::VariantVisitor for StringDeserializer + where E: de::Error, +{ + type Error = E; + + fn visit_variant(&mut self) -> Result + where T: de::Deserialize, + { + de::Deserialize::deserialize(self) + } + + fn visit_unit(&mut self) -> Result<(), Self::Error> { + Ok(()) + } + + fn visit_newtype(&mut self) -> Result + where T: super::Deserialize, + { + let (value,) = try!(self.visit_tuple(1, super::impls::TupleVisitor1::new())); + Ok(value) + } + + fn visit_tuple(&mut self, + _len: usize, + _visitor: V) -> Result + where V: super::Visitor + { + Err(super::Error::invalid_type(super::Type::TupleVariant)) + } + + fn visit_struct(&mut self, + _fields: &'static [&'static str], + _visitor: V) -> Result + where V: super::Visitor + { + Err(super::Error::invalid_type(super::Type::StructVariant)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A helper deserializer that deserializes a `String`. +#[cfg(any(feature = "std", feature = "collections"))] +pub struct CowStrDeserializer<'a, E>(Option>, PhantomData); + +#[cfg(any(feature = "std", feature = "collections"))] +impl<'a, E> ValueDeserializer for Cow<'a, str> + where E: de::Error, +{ + type Deserializer = CowStrDeserializer<'a, E>; + + fn into_deserializer(self) -> CowStrDeserializer<'a, E> { + CowStrDeserializer(Some(self), PhantomData) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl<'a, E> de::Deserializer for CowStrDeserializer<'a, E> + where E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + match self.0.take() { + Some(Cow::Borrowed(string)) => visitor.visit_str(string), + Some(Cow::Owned(string)) => visitor.visit_string(string), + None => Err(de::Error::end_of_stream()), + } + } + + fn deserialize_enum(&mut self, + _name: &str, + _variants: &'static [&'static str], + mut visitor: V) -> Result + where V: de::EnumVisitor, + { + visitor.visit(self) + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple ignored_any + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl<'a, E> de::VariantVisitor for CowStrDeserializer<'a, E> + where E: de::Error, +{ + type Error = E; + + fn visit_variant(&mut self) -> Result + where T: de::Deserialize, + { + de::Deserialize::deserialize(self) + } + + fn visit_unit(&mut self) -> Result<(), Self::Error> { + Ok(()) + } + + fn visit_newtype(&mut self) -> Result + where T: super::Deserialize, + { + let (value,) = try!(self.visit_tuple(1, super::impls::TupleVisitor1::new())); + Ok(value) + } + + fn visit_tuple(&mut self, + _len: usize, + _visitor: V) -> Result + where V: super::Visitor + { + Err(super::Error::invalid_type(super::Type::TupleVariant)) + } + + fn visit_struct(&mut self, + _fields: &'static [&'static str], + _visitor: V) -> Result + where V: super::Visitor + { + Err(super::Error::invalid_type(super::Type::StructVariant)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A helper deserializer that deserializes a sequence. +pub struct SeqDeserializer { + iter: I, + len: usize, + marker: PhantomData, +} + +impl SeqDeserializer + where E: de::Error, +{ + /// Construct a new `SeqDeserializer`. + pub fn new(iter: I, len: usize) -> Self { + SeqDeserializer { + iter: iter, + len: len, + marker: PhantomData, + } + } +} + +impl de::Deserializer for SeqDeserializer + where I: Iterator, + T: ValueDeserializer, + E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + visitor.visit_seq(self) + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple enum ignored_any + } +} + +impl de::SeqVisitor for SeqDeserializer + where I: Iterator, + T: ValueDeserializer, + E: de::Error, +{ + type Error = E; + + fn visit(&mut self) -> Result, Self::Error> + where V: de::Deserialize + { + match self.iter.next() { + Some(value) => { + self.len -= 1; + let mut de = value.into_deserializer(); + Ok(Some(try!(de::Deserialize::deserialize(&mut de)))) + } + None => Ok(None), + } + } + + fn end(&mut self) -> Result<(), Self::Error> { + if self.len == 0 { + Ok(()) + } else { + Err(de::Error::invalid_length(self.len)) + } + } + + fn size_hint(&self) -> (usize, Option) { + (self.len, Some(self.len)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "collections"))] +impl ValueDeserializer for Vec + where T: ValueDeserializer, + E: de::Error, +{ + type Deserializer = SeqDeserializer, E>; + + fn into_deserializer(self) -> Self::Deserializer { + let len = self.len(); + SeqDeserializer::new(self.into_iter(), len) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl ValueDeserializer for BTreeSet + where T: ValueDeserializer + Eq + Ord, + E: de::Error, +{ + type Deserializer = SeqDeserializer, E>; + + fn into_deserializer(self) -> Self::Deserializer { + let len = self.len(); + SeqDeserializer::new(self.into_iter(), len) + } +} + +#[cfg(feature = "std")] +impl ValueDeserializer for HashSet + where T: ValueDeserializer + Eq + Hash, + E: de::Error, +{ + type Deserializer = SeqDeserializer, E>; + + fn into_deserializer(self) -> Self::Deserializer { + let len = self.len(); + SeqDeserializer::new(self.into_iter(), len) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A helper deserializer that deserializes a sequence using a `SeqVisitor`. +pub struct SeqVisitorDeserializer { + visitor: V_, + marker: PhantomData, +} + +impl SeqVisitorDeserializer + where V_: de::SeqVisitor, + E: de::Error, +{ + /// Construct a new `SeqVisitorDeserializer`. + pub fn new(visitor: V_) -> Self { + SeqVisitorDeserializer{ + visitor: visitor, + marker: PhantomData + } + } +} + +impl de::Deserializer for SeqVisitorDeserializer + where V_: de::SeqVisitor, + E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result { + visitor.visit_seq(&mut self.visitor) + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple enum ignored_any + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A helper deserializer that deserializes a map. +pub struct MapDeserializer + where I: Iterator, + K: ValueDeserializer, + V: ValueDeserializer, + E: de::Error, +{ + iter: I, + value: Option, + len: Option, + marker: PhantomData, +} + +impl MapDeserializer + where I: Iterator, + K: ValueDeserializer, + V: ValueDeserializer, + E: de::Error, +{ + /// Construct a new `MapDeserializer` with a specific length. + pub fn new(iter: I, len: usize) -> Self { + MapDeserializer { + iter: iter, + value: None, + len: Some(len), + marker: PhantomData, + } + } + + /// Construct a new `MapDeserializer` that is not bounded + /// by a specific length and that delegates to `iter` for its size hint. + pub fn unbounded(iter: I) -> Self { + MapDeserializer { + iter: iter, + value: None, + len: None, + marker: PhantomData, + } + } + + fn next(&mut self) -> Option<(K, V)> { + self.iter.next().map(|(k, v)| { + if let Some(len) = self.len.as_mut() { + *len -= 1; + } + (k, v) + }) + } +} + +impl de::Deserializer for MapDeserializer + where I: Iterator, + K: ValueDeserializer, + V: ValueDeserializer, + E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V_) -> Result + where V_: de::Visitor, + { + visitor.visit_map(self) + } + + fn deserialize_seq(&mut self, mut visitor: V_) -> Result + where V_: de::Visitor, + { + visitor.visit_seq(self) + } + + fn deserialize_seq_fixed_size(&mut self, len: usize, mut visitor: V_) -> Result + where V_: de::Visitor, + { + match self.len { + Some(map_len) if map_len == len => visitor.visit_seq(self), + Some(_) => Err(de::Error::invalid_length(len)), + None => visitor.visit_seq(self), + } + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option bytes map unit_struct newtype_struct tuple_struct struct + struct_field tuple enum ignored_any + } +} + +impl de::MapVisitor for MapDeserializer + where I: Iterator, + K: ValueDeserializer, + V: ValueDeserializer, + E: de::Error, +{ + type Error = E; + + fn visit_key(&mut self) -> Result, Self::Error> + where T: de::Deserialize, + { + match self.next() { + Some((key, value)) => { + self.value = Some(value); + let mut de = key.into_deserializer(); + de::Deserialize::deserialize(&mut de).map(Some) + } + None => Ok(None), + } + } + + fn visit_value(&mut self) -> Result + where T: de::Deserialize, + { + match self.value.take() { + Some(value) => { + let mut de = value.into_deserializer(); + de::Deserialize::deserialize(&mut de) + } + None => { + Err(de::Error::end_of_stream()) + } + } + } + + fn end(&mut self) -> Result<(), Self::Error> { + match self.len { + Some(len) if len > 0 => Err(de::Error::invalid_length(len)), + _ => Ok(()) + } + } + + fn size_hint(&self) -> (usize, Option) { + self.len.map_or_else( + || self.iter.size_hint(), + |len| (len, Some(len))) + } +} + +impl de::SeqVisitor for MapDeserializer + where I: Iterator, + K: ValueDeserializer, + V: ValueDeserializer, + E: de::Error, +{ + type Error = E; + + fn visit(&mut self) -> Result, Self::Error> + where T: de::Deserialize, + { + match self.next() { + Some(kv) => { + let mut de = PairDeserializer(Some(kv), PhantomData); + de::Deserialize::deserialize(&mut de).map(Some) + } + None => Ok(None), + } + } + + fn end(&mut self) -> Result<(), Self::Error> { + de::MapVisitor::end(self) + } + + fn size_hint(&self) -> (usize, Option) { + de::MapVisitor::size_hint(self) + } +} + +// Used in the `impl SeqVisitor for MapDeserializer` to visit the map as a +// sequence of pairs. +struct PairDeserializer(Option<(A, B)>, PhantomData); + +impl de::Deserializer for PairDeserializer + where A: ValueDeserializer, + B: ValueDeserializer, + E: de::Error +{ + type Error = E; + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option bytes map unit_struct newtype_struct tuple_struct struct + struct_field tuple enum ignored_any + } + + fn deserialize(&mut self, visitor: V) -> Result + where V: de::Visitor, + { + self.deserialize_seq(visitor) + } + + fn deserialize_seq(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + match self.0.take() { + Some((k, v)) => { + visitor.visit_seq(PairVisitor(Some(k), Some(v), PhantomData)) + } + None => Err(de::Error::end_of_stream()), + } + } + + fn deserialize_seq_fixed_size(&mut self, len: usize, visitor: V) -> Result + where V: de::Visitor, + { + if len == 2 { + self.deserialize_seq(visitor) + } else { + Err(de::Error::invalid_length(len)) + } + } +} + +struct PairVisitor(Option, Option, PhantomData); + +impl de::SeqVisitor for PairVisitor + where A: ValueDeserializer, + B: ValueDeserializer, + E: de::Error, +{ + type Error = E; + + fn visit(&mut self) -> Result, Self::Error> + where T: de::Deserialize, + { + if let Some(k) = self.0.take() { + let mut de = k.into_deserializer(); + de::Deserialize::deserialize(&mut de).map(Some) + } else if let Some(v) = self.1.take() { + let mut de = v.into_deserializer(); + de::Deserialize::deserialize(&mut de).map(Some) + } else { + Ok(None) + } + } + + fn end(&mut self) -> Result<(), Self::Error> { + if self.1.is_none() { + Ok(()) + } else { + Err(de::Error::invalid_length(self.size_hint().0)) + } + } + + fn size_hint(&self) -> (usize, Option) { + let len = if self.0.is_some() { + 2 + } else if self.1.is_some() { + 1 + } else { + 0 + }; + (len, Some(len)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "collections"))] +impl ValueDeserializer for BTreeMap + where K: ValueDeserializer + Eq + Ord, + V: ValueDeserializer, + E: de::Error, +{ + type Deserializer = MapDeserializer, K, V, E>; + + fn into_deserializer(self) -> Self::Deserializer { + let len = self.len(); + MapDeserializer::new(self.into_iter(), len) + } +} + +#[cfg(feature = "std")] +impl ValueDeserializer for HashMap + where K: ValueDeserializer + Eq + Hash, + V: ValueDeserializer, + E: de::Error, +{ + type Deserializer = MapDeserializer, K, V, E>; + + fn into_deserializer(self) -> Self::Deserializer { + let len = self.len(); + MapDeserializer::new(self.into_iter(), len) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A helper deserializer that deserializes a map using a `MapVisitor`. +pub struct MapVisitorDeserializer { + visitor: V_, + marker: PhantomData, +} + +impl MapVisitorDeserializer + where V_: de::MapVisitor, + E: de::Error, +{ + /// Construct a new `MapVisitorDeserializer`. + pub fn new(visitor: V_) -> Self { + MapVisitorDeserializer{ + visitor: visitor, + marker: PhantomData + } + } +} + +impl de::Deserializer for MapVisitorDeserializer + where V_: de::MapVisitor, + E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result { + visitor.visit_map(&mut self.visitor) + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple enum ignored_any + } +} + +/////////////////////////////////////////////////////////////////////////////// + +impl<'a, E> ValueDeserializer for bytes::Bytes<'a> + where E: de::Error, +{ + type Deserializer = BytesDeserializer<'a, E>; + + fn into_deserializer(self) -> BytesDeserializer<'a, E> { + BytesDeserializer(Some(self.into()), PhantomData) + } +} + +/// A helper deserializer that deserializes a `&[u8]`. +pub struct BytesDeserializer<'a, E> (Option<&'a [u8]>, PhantomData); + +impl<'a, E> de::Deserializer for BytesDeserializer<'a, E> + where E: de::Error +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + match self.0.take() { + Some(bytes) => visitor.visit_bytes(bytes), + None => Err(de::Error::end_of_stream()), + } + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple enum ignored_any + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "collections"))] +impl ValueDeserializer for bytes::ByteBuf + where E: de::Error, +{ + type Deserializer = ByteBufDeserializer; + + fn into_deserializer(self) -> Self::Deserializer { + ByteBufDeserializer(Some(self.into()), PhantomData) + } +} + +/// A helper deserializer that deserializes a `Vec`. +#[cfg(any(feature = "std", feature = "collections"))] +pub struct ByteBufDeserializer(Option>, PhantomData); + +#[cfg(any(feature = "std", feature = "collections"))] +impl de::Deserializer for ByteBufDeserializer + where E: de::Error, +{ + type Error = E; + + fn deserialize(&mut self, mut visitor: V) -> Result + where V: de::Visitor, + { + match self.0.take() { + Some(bytes) => visitor.visit_byte_buf(bytes), + None => Err(de::Error::end_of_stream()), + } + } + + forward_to_deserialize! { + bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string + unit option seq seq_fixed_size bytes map unit_struct newtype_struct + tuple_struct struct struct_field tuple enum ignored_any + } +} diff --git a/third_party/rust/serde/src/error.rs b/third_party/rust/serde/src/error.rs new file mode 100644 index 000000000000..7e5fef72f2e7 --- /dev/null +++ b/third_party/rust/serde/src/error.rs @@ -0,0 +1,44 @@ +//! A stand-in for `std::error` +use core::any::TypeId; +use core::fmt::{Debug, Display}; + + +/// A stand-in for `std::error::Error`, which requires no allocation. +#[cfg(feature = "unstable")] +pub trait Error: Debug + Display + ::core::marker::Reflect { + /// A short description of the error. + /// + /// The description should not contain newlines or sentence-ending + /// punctuation, to facilitate embedding in larger user-facing + /// strings. + fn description(&self) -> &str; + + /// The lower-level cause of this error, if any. + fn cause(&self) -> Option<&Error> { None } + + /// Get the `TypeId` of `self` + #[doc(hidden)] + fn type_id(&self) -> TypeId where Self: 'static { + TypeId::of::() + } +} + +/// A stand-in for `std::error::Error`, which requires no allocation. +#[cfg(not(feature = "unstable"))] +pub trait Error: Debug + Display { + /// A short description of the error. + /// + /// The description should not contain newlines or sentence-ending + /// punctuation, to facilitate embedding in larger user-facing + /// strings. + fn description(&self) -> &str; + + /// The lower-level cause of this error, if any. + fn cause(&self) -> Option<&Error> { None } + + /// Stubbed! Returns type_id of `()` + #[doc(hidden)] + fn type_id(&self) -> TypeId where Self: 'static { + TypeId::of::<()>() + } +} diff --git a/third_party/rust/serde/src/iter.rs b/third_party/rust/serde/src/iter.rs new file mode 100644 index 000000000000..24a6bf307724 --- /dev/null +++ b/third_party/rust/serde/src/iter.rs @@ -0,0 +1,61 @@ +//! Module that contains helper iterators. + +use std::io; +use std::iter::Peekable; + +/// Iterator over a byte stream that tracks the current position's line and column. +pub struct LineColIterator>> { + iter: Iter, + line: usize, + col: usize, +} + +impl>> LineColIterator { + /// Construct a new `LineColIterator`. + pub fn new(iter: Iter) -> LineColIterator { + LineColIterator { + iter: iter, + line: 1, + col: 0, + } + } + + /// Report the current line inside the iterator. + pub fn line(&self) -> usize { self.line } + + /// Report the current column inside the iterator. + pub fn col(&self) -> usize { self.col } + + /// Gets a reference to the underlying iterator. + pub fn get_ref(&self) -> &Iter { &self.iter } + + /// Gets a mutable reference to the underlying iterator. + pub fn get_mut(&mut self) -> &mut Iter { &mut self.iter } + + /// Unwraps this `LineColIterator`, returning the underlying iterator. + pub fn into_inner(self) -> Iter { self.iter } +} + +impl>> LineColIterator> { + /// peeks at the next value + pub fn peek(&mut self) -> Option<&io::Result> { self.iter.peek() } +} + +impl>> Iterator for LineColIterator { + type Item = io::Result; + fn next(&mut self) -> Option> { + match self.iter.next() { + None => None, + Some(Ok(b'\n')) => { + self.line += 1; + self.col = 0; + Some(Ok(b'\n')) + }, + Some(Ok(c)) => { + self.col += 1; + Some(Ok(c)) + }, + Some(Err(e)) => Some(Err(e)), + } + } +} diff --git a/third_party/rust/serde/src/lib.rs b/third_party/rust/serde/src/lib.rs new file mode 100644 index 000000000000..78a0531e7299 --- /dev/null +++ b/third_party/rust/serde/src/lib.rs @@ -0,0 +1,58 @@ +//! Serde Serialization Framework +//! +//! Serde is a powerful framework that enables serialization libraries to generically serialize +//! Rust data structures without the overhead of runtime type information. In many situations, the +//! handshake protocol between serializers and serializees can be completely optimized away, +//! leaving serde to perform roughly the same speed as a hand written serializer for a specific +//! type. +//! +//! For a detailed tutorial on the different ways to use serde please check out the +//! [github repository](https://github.com/serde-rs/serde) + +#![doc(html_root_url="https://docs.serde.rs")] +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(feature = "unstable", feature(reflect_marker, unicode, nonzero, plugin, step_trait, zero_one))] +#![cfg_attr(feature = "alloc", feature(alloc))] +#![cfg_attr(feature = "collections", feature(collections, enumset))] +#![cfg_attr(feature = "clippy", plugin(clippy))] +#![cfg_attr(feature = "clippy", allow(linkedlist))] + +#![cfg_attr(any(not(feature = "std"), feature = "unstable"), allow(unused_variables, unused_imports, unused_features, dead_code))] + +#![deny(missing_docs)] + +#[cfg(all(feature = "unstable", feature = "collections"))] +extern crate collections; + +#[cfg(all(feature = "unstable", feature = "alloc"))] +extern crate alloc; + +#[cfg(feature = "std")] +mod core { + pub use std::{ops, hash, fmt, cmp, marker, mem, i8, i16, i32, i64, u8, u16, u32, u64, isize, + usize, f32, f64, char, str, num, slice, iter}; + #[cfg(feature = "unstable")] + extern crate core; + #[cfg(feature = "unstable")] + pub use self::core::nonzero; +} + +pub use ser::{Serialize, Serializer}; +pub use de::{Deserialize, Deserializer, Error}; + +#[cfg(not(feature = "std"))] +macro_rules! format { + ($s:expr, $($rest:tt)*) => ($s) +} + +#[macro_use] +mod macros; + +pub mod bytes; +pub mod de; +#[cfg(feature = "std")] +pub mod iter; +pub mod ser; +#[cfg(not(feature = "std"))] +pub mod error; +mod utils; diff --git a/third_party/rust/serde/src/macros.rs b/third_party/rust/serde/src/macros.rs new file mode 100644 index 000000000000..6064c87ee5d8 --- /dev/null +++ b/third_party/rust/serde/src/macros.rs @@ -0,0 +1,179 @@ +#[cfg(feature = "std")] +#[doc(hidden)] +#[macro_export] +macro_rules! forward_to_deserialize_method { + ($func:ident($($arg:ty),*)) => { + #[inline] + fn $func<__V>(&mut self, $(_: $arg,)* visitor: __V) -> ::std::result::Result<__V::Value, Self::Error> + where __V: $crate::de::Visitor + { + self.deserialize(visitor) + } + }; +} + +#[cfg(not(feature = "std"))] +#[doc(hidden)] +#[macro_export] +macro_rules! forward_to_deserialize_method { + ($func:ident($($arg:ty),*)) => { + #[inline] + fn $func<__V>(&mut self, $(_: $arg,)* visitor: __V) -> ::core::result::Result<__V::Value, Self::Error> + where __V: $crate::de::Visitor + { + self.deserialize(visitor) + } + }; +} + +#[cfg(feature = "std")] +#[doc(hidden)] +#[macro_export] +macro_rules! forward_to_deserialize_enum { + () => { + #[inline] + fn deserialize_enum<__V>(&mut self, _: &str, _: &[&str], _: __V) -> ::std::result::Result<__V::Value, Self::Error> + where __V: $crate::de::EnumVisitor + { + Err($crate::de::Error::invalid_type($crate::de::Type::Enum)) + } + }; +} + +#[cfg(not(feature = "std"))] +#[doc(hidden)] +#[macro_export] +macro_rules! forward_to_deserialize_enum { + () => { + #[inline] + fn deserialize_enum<__V>(&mut self, _: &str, _: &[&str], _: __V) -> ::core::result::Result<__V::Value, Self::Error> + where __V: $crate::de::EnumVisitor + { + Err($crate::de::Error::invalid_type($crate::de::Type::Enum)) + } + }; +} + +#[doc(hidden)] +#[macro_export] +macro_rules! forward_to_deserialize_helper { + (bool) => { + forward_to_deserialize_method!{deserialize_bool()} + }; + (usize) => { + forward_to_deserialize_method!{deserialize_usize()} + }; + (u8) => { + forward_to_deserialize_method!{deserialize_u8()} + }; + (u16) => { + forward_to_deserialize_method!{deserialize_u16()} + }; + (u32) => { + forward_to_deserialize_method!{deserialize_u32()} + }; + (u64) => { + forward_to_deserialize_method!{deserialize_u64()} + }; + (isize) => { + forward_to_deserialize_method!{deserialize_isize()} + }; + (i8) => { + forward_to_deserialize_method!{deserialize_i8()} + }; + (i16) => { + forward_to_deserialize_method!{deserialize_i16()} + }; + (i32) => { + forward_to_deserialize_method!{deserialize_i32()} + }; + (i64) => { + forward_to_deserialize_method!{deserialize_i64()} + }; + (f32) => { + forward_to_deserialize_method!{deserialize_f32()} + }; + (f64) => { + forward_to_deserialize_method!{deserialize_f64()} + }; + (char) => { + forward_to_deserialize_method!{deserialize_char()} + }; + (str) => { + forward_to_deserialize_method!{deserialize_str()} + }; + (string) => { + forward_to_deserialize_method!{deserialize_string()} + }; + (unit) => { + forward_to_deserialize_method!{deserialize_unit()} + }; + (option) => { + forward_to_deserialize_method!{deserialize_option()} + }; + (seq) => { + forward_to_deserialize_method!{deserialize_seq()} + }; + (seq_fixed_size) => { + forward_to_deserialize_method!{deserialize_seq_fixed_size(usize)} + }; + (bytes) => { + forward_to_deserialize_method!{deserialize_bytes()} + }; + (map) => { + forward_to_deserialize_method!{deserialize_map()} + }; + (unit_struct) => { + forward_to_deserialize_method!{deserialize_unit_struct(&'static str)} + }; + (newtype_struct) => { + forward_to_deserialize_method!{deserialize_newtype_struct(&'static str)} + }; + (tuple_struct) => { + forward_to_deserialize_method!{deserialize_tuple_struct(&'static str, usize)} + }; + (struct) => { + forward_to_deserialize_method!{deserialize_struct(&'static str, &'static [&'static str])} + }; + (struct_field) => { + forward_to_deserialize_method!{deserialize_struct_field()} + }; + (tuple) => { + forward_to_deserialize_method!{deserialize_tuple(usize)} + }; + (ignored_any) => { + forward_to_deserialize_method!{deserialize_ignored_any()} + }; + (enum) => { + forward_to_deserialize_enum!(); + }; +} + +/// Helper to forward `Deserializer` methods to `Deserializer::deserialize`. +/// Every given method ignores all arguments and forwards to `deserialize`. +/// Note that `deserialize_enum` simply returns an `Error::invalid_type`; a +/// better approach is tracked in [serde-rs/serde#521][1]. +/// +/// ```rust,ignore +/// impl Deserializer for MyDeserializer { +/// fn deserialize(&mut self, visitor: V) -> Result +/// where V: Visitor +/// { +/// /* ... */ +/// } +/// +/// forward_to_deserialize! { +/// bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string +/// unit option seq seq_fixed_size bytes map unit_struct newtype_struct +/// tuple_struct struct struct_field tuple enum ignored_any +/// } +/// } +/// ``` +/// +/// [1]: https://github.com/serde-rs/serde/issues/521 +#[macro_export] +macro_rules! forward_to_deserialize { + ($($func:ident)*) => { + $(forward_to_deserialize_helper!{$func})* + }; +} diff --git a/third_party/rust/serde/src/ser/impls.rs b/third_party/rust/serde/src/ser/impls.rs new file mode 100644 index 000000000000..5653a717bb06 --- /dev/null +++ b/third_party/rust/serde/src/ser/impls.rs @@ -0,0 +1,725 @@ +//! Implementations for all of Rust's builtin types. Tuples implement the `Serialize` trait if they +//! have at most 16 fields. Arrays implement the `Serialize` trait if their length is 32 or less. +//! You can always forward array serialization to slice serialization, which works for any length. +//! Long tuples are best replaced by tuple structs, for which you can use `derive(Serialize)`. In +//! that case the number of fields is irrelevant. + +#[cfg(feature = "std")] +use std::borrow::Cow; +#[cfg(all(feature = "collections", not(feature = "std")))] +use collections::borrow::Cow; + +#[cfg(feature = "std")] +use std::collections::{ + BinaryHeap, + BTreeMap, + BTreeSet, + LinkedList, + HashMap, + HashSet, + VecDeque, +}; +#[cfg(all(feature = "collections", not(feature = "std")))] +use collections::{ + BinaryHeap, + BTreeMap, + BTreeSet, + LinkedList, + VecDeque, + String, + Vec, +}; + +#[cfg(all(feature = "unstable", feature = "collections"))] +use collections::enum_set::{CLike, EnumSet}; +#[cfg(all(feature = "unstable", feature = "collections"))] +use collections::borrow::ToOwned; + +use core::hash::{Hash, BuildHasher}; +#[cfg(feature = "unstable")] +use core::iter; +#[cfg(feature = "std")] +use std::net; +#[cfg(feature = "unstable")] +use core::num; +#[cfg(feature = "unstable")] +use core::ops; +#[cfg(feature = "std")] +use std::path; +#[cfg(feature = "std")] +use std::rc::Rc; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::rc::Rc; +#[cfg(feature = "std")] +use std::time::Duration; + +#[cfg(feature = "std")] +use std::sync::Arc; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::arc::Arc; + +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::boxed::Box; + +use core::marker::PhantomData; + +#[cfg(feature = "unstable")] +use core::nonzero::{NonZero, Zeroable}; + +use super::{ + Error, + Serialize, + Serializer, +}; + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! impl_visit { + ($ty:ty, $method:ident) => { + impl Serialize for $ty { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + serializer.$method(*self) + } + } + } +} + +impl_visit!(bool, serialize_bool); +impl_visit!(isize, serialize_isize); +impl_visit!(i8, serialize_i8); +impl_visit!(i16, serialize_i16); +impl_visit!(i32, serialize_i32); +impl_visit!(i64, serialize_i64); +impl_visit!(usize, serialize_usize); +impl_visit!(u8, serialize_u8); +impl_visit!(u16, serialize_u16); +impl_visit!(u32, serialize_u32); +impl_visit!(u64, serialize_u64); +impl_visit!(f32, serialize_f32); +impl_visit!(f64, serialize_f64); +impl_visit!(char, serialize_char); + +/////////////////////////////////////////////////////////////////////////////// + +impl Serialize for str { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + serializer.serialize_str(self) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Serialize for String { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + (&self[..]).serialize(serializer) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +impl Serialize for Option where T: Serialize { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + match *self { + Some(ref value) => serializer.serialize_some(value), + None => serializer.serialize_none(), + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +impl Serialize for PhantomData { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + serializer.serialize_unit_struct("PhantomData") + } +} + + +/////////////////////////////////////////////////////////////////////////////// + +impl Serialize for [T] + where T: Serialize, +{ + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + let mut state = try!(serializer.serialize_seq(Some(self.len()))); + for e in self { + try!(serializer.serialize_seq_elt(&mut state, e)); + } + serializer.serialize_seq_end(state) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! array_impls { + ($len:expr) => { + impl Serialize for [T; $len] where T: Serialize { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + let mut state = try!(serializer.serialize_seq_fixed_size($len)); + for e in self { + try!(serializer.serialize_seq_elt(&mut state, e)); + } + serializer.serialize_seq_end(state) + } + } + } +} + +array_impls!(0); +array_impls!(1); +array_impls!(2); +array_impls!(3); +array_impls!(4); +array_impls!(5); +array_impls!(6); +array_impls!(7); +array_impls!(8); +array_impls!(9); +array_impls!(10); +array_impls!(11); +array_impls!(12); +array_impls!(13); +array_impls!(14); +array_impls!(15); +array_impls!(16); +array_impls!(17); +array_impls!(18); +array_impls!(19); +array_impls!(20); +array_impls!(21); +array_impls!(22); +array_impls!(23); +array_impls!(24); +array_impls!(25); +array_impls!(26); +array_impls!(27); +array_impls!(28); +array_impls!(29); +array_impls!(30); +array_impls!(31); +array_impls!(32); + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! serialize_seq { + () => { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + let mut state = try!(serializer.serialize_seq(Some(self.len()))); + for e in self { + try!(serializer.serialize_seq_elt(&mut state, e)); + } + serializer.serialize_seq_end(state) + } + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Serialize for BinaryHeap + where T: Serialize + Ord +{ + serialize_seq!(); +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Serialize for BTreeSet + where T: Serialize + Ord, +{ + serialize_seq!(); +} + +#[cfg(all(feature = "unstable", feature = "collections"))] +impl Serialize for EnumSet + where T: Serialize + CLike +{ + serialize_seq!(); +} + +#[cfg(feature = "std")] +impl Serialize for HashSet + where T: Serialize + Eq + Hash, + H: BuildHasher, +{ + serialize_seq!(); +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Serialize for LinkedList + where T: Serialize, +{ + serialize_seq!(); +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Serialize for Vec where T: Serialize { + serialize_seq!(); +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Serialize for VecDeque where T: Serialize { + serialize_seq!(); +} + +#[cfg(feature = "unstable")] +impl Serialize for ops::Range + where A: Serialize + Clone + iter::Step + num::One, + for<'a> &'a A: ops::Add<&'a A, Output = A>, +{ + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + let len = iter::Step::steps_between(&self.start, &self.end, &A::one()); + let mut state = try!(serializer.serialize_seq(len)); + for e in self.clone() { + try!(serializer.serialize_seq_elt(&mut state, e)); + } + serializer.serialize_seq_end(state) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +impl Serialize for () { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + serializer.serialize_unit() + } +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! tuple_impls { + ($( + $TupleVisitor:ident ($len:expr, $($T:ident),+) { + $($state:pat => $idx:tt,)+ + } + )+) => { + $( + impl<$($T),+> Serialize for ($($T,)+) + where $($T: Serialize),+ + { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + let mut state = try!(serializer.serialize_tuple($len)); + $( + try!(serializer.serialize_tuple_elt(&mut state, &self.$idx)); + )+ + serializer.serialize_tuple_end(state) + } + } + )+ + } +} + +tuple_impls! { + TupleVisitor1 (1, T0) { + 0 => 0, + } + TupleVisitor2 (2, T0, T1) { + 0 => 0, + 1 => 1, + } + TupleVisitor3 (3, T0, T1, T2) { + 0 => 0, + 1 => 1, + 2 => 2, + } + TupleVisitor4 (4, T0, T1, T2, T3) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + } + TupleVisitor5 (5, T0, T1, T2, T3, T4) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + } + TupleVisitor6 (6, T0, T1, T2, T3, T4, T5) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + } + TupleVisitor7 (7, T0, T1, T2, T3, T4, T5, T6) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + } + TupleVisitor8 (8, T0, T1, T2, T3, T4, T5, T6, T7) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + } + TupleVisitor9 (9, T0, T1, T2, T3, T4, T5, T6, T7, T8) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + } + TupleVisitor10 (10, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + } + TupleVisitor11 (11, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + } + TupleVisitor12 (12, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + } + TupleVisitor13 (13, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + } + TupleVisitor14 (14, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + 13 => 13, + } + TupleVisitor15 (15, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + 13 => 13, + 14 => 14, + } + TupleVisitor16 (16, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) { + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + 13 => 13, + 14 => 14, + 15 => 15, + } +} + +/////////////////////////////////////////////////////////////////////////////// + +macro_rules! serialize_map { + () => { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + let mut state = try!(serializer.serialize_map(Some(self.len()))); + for (k, v) in self { + try!(serializer.serialize_map_key(&mut state, k)); + try!(serializer.serialize_map_value(&mut state, v)); + } + serializer.serialize_map_end(state) + } + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl Serialize for BTreeMap + where K: Serialize + Ord, + V: Serialize, +{ + serialize_map!(); +} + +#[cfg(feature = "std")] +impl Serialize for HashMap + where K: Serialize + Eq + Hash, + V: Serialize, + H: BuildHasher, +{ + serialize_map!(); +} + +/////////////////////////////////////////////////////////////////////////////// + +impl<'a, T: ?Sized> Serialize for &'a T where T: Serialize { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + (**self).serialize(serializer) + } +} + +impl<'a, T: ?Sized> Serialize for &'a mut T where T: Serialize { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + (**self).serialize(serializer) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Serialize for Box where T: Serialize { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + (**self).serialize(serializer) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Serialize for Rc where T: Serialize, { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + (**self).serialize(serializer) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Serialize for Arc where T: Serialize, { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + (**self).serialize(serializer) + } +} + +#[cfg(any(feature = "std", feature = "collections"))] +impl<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwned, { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + (**self).serialize(serializer) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +impl Serialize for Result where T: Serialize, E: Serialize { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer { + match *self { + Result::Ok(ref value) => { + serializer.serialize_newtype_variant("Result", 0, "Ok", value) + } + Result::Err(ref value) => { + serializer.serialize_newtype_variant("Result", 1, "Err", value) + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for Duration { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + let mut state = try!(serializer.serialize_struct("Duration", 2)); + try!(serializer.serialize_struct_elt(&mut state, "secs", self.as_secs())); + try!(serializer.serialize_struct_elt(&mut state, "nanos", self.subsec_nanos())); + serializer.serialize_struct_end(state) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for net::IpAddr { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + self.to_string().serialize(serializer) + } +} + +#[cfg(feature = "std")] +impl Serialize for net::Ipv4Addr { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + self.to_string().serialize(serializer) + } +} + +#[cfg(feature = "std")] +impl Serialize for net::Ipv6Addr { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + self.to_string().serialize(serializer) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for net::SocketAddr { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + match *self { + net::SocketAddr::V4(ref addr) => addr.serialize(serializer), + net::SocketAddr::V6(ref addr) => addr.serialize(serializer), + } + } +} + +#[cfg(feature = "std")] +impl Serialize for net::SocketAddrV4 { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + self.to_string().serialize(serializer) + } +} + +#[cfg(feature = "std")] +impl Serialize for net::SocketAddrV6 { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + self.to_string().serialize(serializer) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for path::Path { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + match self.to_str() { + Some(s) => s.serialize(serializer), + None => Err(Error::invalid_value("Path contains invalid UTF-8 characters")), + } + } +} + +#[cfg(feature = "std")] +impl Serialize for path::PathBuf { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer, + { + self.as_path().serialize(serializer) + } +} + +#[cfg(feature = "unstable")] +impl Serialize for NonZero where T: Serialize + Zeroable { + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer { + (**self).serialize(serializer) + } +} diff --git a/third_party/rust/serde/src/ser/mod.rs b/third_party/rust/serde/src/ser/mod.rs new file mode 100644 index 000000000000..ab903b2fd59a --- /dev/null +++ b/third_party/rust/serde/src/ser/mod.rs @@ -0,0 +1,412 @@ +//! Generic serialization framework. +//! # For Developers who want to serialize objects +//! Implement the `Serialize` trait for the type of objects you want to serialize. Call methods of +//! the `serializer` object. For which methods to call and how to do so, look at the documentation +//! of the `Serializer` trait. +//! +//! # For Serialization Format Developers +//! Implement the `Serializer` trait for a structure that contains fields that enable it to write +//! the serialization result to your target. When a method's argument is an object of type +//! `Serialize`, you can either forward the serializer object (`self`) or create a new one, +//! depending on the quirks of your format. + +#[cfg(feature = "std")] +use std::error; +#[cfg(not(feature = "std"))] +use error; + +#[cfg(all(feature = "collections", not(feature = "std")))] +use collections::String; + +pub mod impls; + +/////////////////////////////////////////////////////////////////////////////// + +/// `Error` is a trait that allows a `Serialize` to generically create a +/// `Serializer` error. +pub trait Error: Sized + error::Error { + /// Raised when there is a general error when serializing a type. + #[cfg(any(feature = "std", feature = "collections"))] + fn custom>(msg: T) -> Self; + + /// Raised when there is a general error when serializing a type. + #[cfg(all(not(feature = "std"), not(feature = "collections")))] + fn custom>(msg: T) -> Self; + + /// Raised when a `Serialize` was passed an incorrect value. + fn invalid_value(msg: &str) -> Self { + Error::custom(format!("invalid value: {}", msg)) + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A trait that describes a type that can be serialized by a `Serializer`. +pub trait Serialize { + /// Serializes this value into this serializer. + fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> + where S: Serializer; +} + +/////////////////////////////////////////////////////////////////////////////// + +/// A trait that describes a type that can serialize a stream of values into the underlying format. +/// +/// # For `Serialize` Developers +/// Non-aggrergate types like integers and strings can be serialized directly by calling the +/// appropriate function. For Aggregate types there's an initial `serialize_T` method that yields +/// a State object that you should not interact with. For each part of the aggregate there's a +/// `serialize_T_elt` method that allows you to pass values or key/value pairs. The types of the +/// values or the keys may change between calls, but the serialization format may not necessarily +/// accept it. The `serialize_T_elt` method also takes a mutable reference to the state object. +/// Make sure that you always use the same state object and only the state object that was returned +/// by the `serialize_T` method. Finally, when your object is done, call the `serialize_T_end` +/// method and pass the state object by value +/// +/// # For Serialization Format Developers +/// If your format has different situations where it accepts different types, create a +/// `Serializer` for each situation. You can create the sub-`Serializer` in one of the aggregate +/// `serialize_T` methods and return it as a state object. Remember to also set the corresponding +/// associated type `TState`. In the `serialize_T_elt` methods you will be given a mutable +/// reference to that state. You do not need to do any additional checks for the correctness of the +/// state object, as it is expected that the user will not modify it. Due to the generic nature +/// of the `Serialize` impls, modifying the object is impossible on stable Rust. +pub trait Serializer { + /// The error type that can be returned if some error occurs during serialization. + type Error: Error; + + /// A state object that is initialized by `serialize_seq`, passed to + /// `serialize_seq_elt`, and consumed by `serialize_seq_end`. Use `()` if no + /// state is required. + type SeqState; + /// A state object that is initialized by `serialize_tuple`, passed to + /// `serialize_tuple_elt`, and consumed by `serialize_tuple_end`. Use `()` + /// if no state is required. + type TupleState; + /// A state object that is initialized by `serialize_tuple_struct`, passed + /// to `serialize_tuple_struct_elt`, and consumed by + /// `serialize_tuple_struct_end`. Use `()` if no state is required. + type TupleStructState; + /// A state object that is initialized by `serialize_tuple_variant`, passed + /// to `serialize_tuple_variant_elt`, and consumed by + /// `serialize_tuple_variant_end`. Use `()` if no state is required. + type TupleVariantState; + /// A state object that is initialized by `serialize_map`, passed to + /// `serialize_map_elt`, and consumed by `serialize_map_end`. Use `()` if no + /// state is required. + type MapState; + /// A state object that is initialized by `serialize_struct`, passed to + /// `serialize_struct_elt`, and consumed by `serialize_struct_end`. Use `()` + /// if no state is required. + type StructState; + /// A state object that is initialized by `serialize_struct_variant`, passed + /// to `serialize_struct_variant_elt`, and consumed by + /// `serialize_struct_variant_end`. Use `()` if no state is required. + type StructVariantState; + + /// Serializes a `bool` value. + fn serialize_bool(&mut self, v: bool) -> Result<(), Self::Error>; + + /// Serializes an `isize` value. If the format does not differentiate + /// between `isize` and `i64`, a reasonable implementation would be to cast + /// the value to `i64` and forward to `serialize_i64`. + fn serialize_isize(&mut self, v: isize) -> Result<(), Self::Error>; + + /// Serializes an `i8` value. If the format does not differentiate between + /// `i8` and `i64`, a reasonable implementation would be to cast the value + /// to `i64` and forward to `serialize_i64`. + fn serialize_i8(&mut self, v: i8) -> Result<(), Self::Error>; + + /// Serializes an `i16` value. If the format does not differentiate between + /// `i16` and `i64`, a reasonable implementation would be to cast the value + /// to `i64` and forward to `serialize_i64`. + fn serialize_i16(&mut self, v: i16) -> Result<(), Self::Error>; + + /// Serializes an `i32` value. If the format does not differentiate between + /// `i32` and `i64`, a reasonable implementation would be to cast the value + /// to `i64` and forward to `serialize_i64`. + fn serialize_i32(&mut self, v: i32) -> Result<(), Self::Error>; + + /// Serializes an `i64` value. + fn serialize_i64(&mut self, v: i64) -> Result<(), Self::Error>; + + /// Serializes a `usize` value. If the format does not differentiate between + /// `usize` and `u64`, a reasonable implementation would be to cast the + /// value to `u64` and forward to `serialize_u64`. + fn serialize_usize(&mut self, v: usize) -> Result<(), Self::Error>; + + /// Serializes a `u8` value. If the format does not differentiate between + /// `u8` and `u64`, a reasonable implementation would be to cast the value + /// to `u64` and forward to `serialize_u64`. + fn serialize_u8(&mut self, v: u8) -> Result<(), Self::Error>; + + /// Serializes a `u16` value. If the format does not differentiate between + /// `u16` and `u64`, a reasonable implementation would be to cast the value + /// to `u64` and forward to `serialize_u64`. + fn serialize_u16(&mut self, v: u16) -> Result<(), Self::Error>; + + /// Serializes a `u32` value. If the format does not differentiate between + /// `u32` and `u64`, a reasonable implementation would be to cast the value + /// to `u64` and forward to `serialize_u64`. + fn serialize_u32(&mut self, v: u32) -> Result<(), Self::Error>; + + /// `Serializes a `u64` value. + fn serialize_u64(&mut self, v: u64) -> Result<(), Self::Error>; + + /// Serializes an `f32` value. If the format does not differentiate between + /// `f32` and `f64`, a reasonable implementation would be to cast the value + /// to `f64` and forward to `serialize_f64`. + fn serialize_f32(&mut self, v: f32) -> Result<(), Self::Error>; + + /// Serializes an `f64` value. + fn serialize_f64(&mut self, v: f64) -> Result<(), Self::Error>; + + /// Serializes a character. If the format does not support characters, + /// it is reasonable to serialize it as a single element `str` or a `u32`. + fn serialize_char(&mut self, v: char) -> Result<(), Self::Error>; + + /// Serializes a `&str`. + fn serialize_str(&mut self, value: &str) -> Result<(), Self::Error>; + + /// Enables serializers to serialize byte slices more compactly or more + /// efficiently than other types of slices. If no efficient implementation + /// is available, a reasonable implementation would be to forward to + /// `serialize_seq`. If forwarded, the implementation looks usually just like this: + /// ```rust + /// let mut state = try!(self.serialize_seq(value)); + /// for b in value { + /// try!(self.serialize_seq_elt(&mut state, b)); + /// } + /// self.serialize_seq_end(state) + /// ``` + fn serialize_bytes(&mut self, value: &[u8]) -> Result<(), Self::Error>; + + /// Serializes a `()` value. It's reasonable to just not serialize anything. + fn serialize_unit(&mut self) -> Result<(), Self::Error>; + + /// Serializes a unit struct value. A reasonable implementation would be to + /// forward to `serialize_unit`. + fn serialize_unit_struct( + &mut self, + name: &'static str, + ) -> Result<(), Self::Error>; + + /// Serializes a unit variant, otherwise known as a variant with no + /// arguments. A reasonable implementation would be to forward to + /// `serialize_unit`. + fn serialize_unit_variant( + &mut self, + name: &'static str, + variant_index: usize, + variant: &'static str, + ) -> Result<(), Self::Error>; + + /// Allows a tuple struct with a single element, also known as a newtype + /// struct, to be more efficiently serialized than a tuple struct with + /// multiple items. A reasonable implementation would be to forward to + /// `serialize_tuple_struct` or to just serialize the inner value without wrapping. + fn serialize_newtype_struct( + &mut self, + name: &'static str, + value: T, + ) -> Result<(), Self::Error>; + + /// Allows a variant with a single item to be more efficiently serialized + /// than a variant with multiple items. A reasonable implementation would be + /// to forward to `serialize_tuple_variant`. + fn serialize_newtype_variant( + &mut self, + name: &'static str, + variant_index: usize, + variant: &'static str, + value: T, + ) -> Result<(), Self::Error>; + + /// Serializes a `None` value. + fn serialize_none(&mut self) -> Result<(), Self::Error>; + + /// Serializes a `Some(...)` value. + fn serialize_some( + &mut self, + value: T, + ) -> Result<(), Self::Error>; + + /// Begins to serialize a sequence. This call must be followed by zero or + /// more calls to `serialize_seq_elt`, then a call to `serialize_seq_end`. + fn serialize_seq( + &mut self, + len: Option, + ) -> Result; + + /// Serializes a sequence element. Must have previously called + /// `serialize_seq`. + fn serialize_seq_elt( + &mut self, + state: &mut Self::SeqState, + value: T, + ) -> Result<(), Self::Error>; + + /// Finishes serializing a sequence. + fn serialize_seq_end( + &mut self, + state: Self::SeqState, + ) -> Result<(), Self::Error>; + + /// Begins to serialize a sequence whose length will be known at + /// deserialization time. This call must be followed by zero or more calls + /// to `serialize_seq_elt`, then a call to `serialize_seq_end`. A reasonable + /// implementation would be to forward to `serialize_seq`. + fn serialize_seq_fixed_size( + &mut self, + size: usize, + ) -> Result; + + /// Begins to serialize a tuple. This call must be followed by zero or more + /// calls to `serialize_tuple_elt`, then a call to `serialize_tuple_end`. A + /// reasonable implementation would be to forward to `serialize_seq`. + fn serialize_tuple( + &mut self, + len: usize, + ) -> Result; + + /// Serializes a tuple element. Must have previously called + /// `serialize_tuple`. + fn serialize_tuple_elt( + &mut self, + state: &mut Self::TupleState, + value: T, + ) -> Result<(), Self::Error>; + + /// Finishes serializing a tuple. + fn serialize_tuple_end( + &mut self, + state: Self::TupleState, + ) -> Result<(), Self::Error>; + + /// Begins to serialize a tuple struct. This call must be followed by zero + /// or more calls to `serialize_tuple_struct_elt`, then a call to + /// `serialize_tuple_struct_end`. A reasonable implementation would be to + /// forward to `serialize_tuple`. + fn serialize_tuple_struct( + &mut self, + name: &'static str, + len: usize, + ) -> Result; + + /// Serializes a tuple struct element. Must have previously called + /// `serialize_tuple_struct`. + fn serialize_tuple_struct_elt( + &mut self, + state: &mut Self::TupleStructState, + value: T, + ) -> Result<(), Self::Error>; + + /// Finishes serializing a tuple struct. + fn serialize_tuple_struct_end( + &mut self, + state: Self::TupleStructState, + ) -> Result<(), Self::Error>; + + /// Begins to serialize a tuple variant. This call must be followed by zero + /// or more calls to `serialize_tuple_variant_elt`, then a call to + /// `serialize_tuple_variant_end`. A reasonable implementation would be to + /// forward to `serialize_tuple_struct`. + fn serialize_tuple_variant( + &mut self, + name: &'static str, + variant_index: usize, + variant: &'static str, + len: usize, + ) -> Result; + + /// Serializes a tuple variant element. Must have previously called + /// `serialize_tuple_variant`. + fn serialize_tuple_variant_elt( + &mut self, + state: &mut Self::TupleVariantState, + value: T, + ) -> Result<(), Self::Error>; + + /// Finishes serializing a tuple variant. + fn serialize_tuple_variant_end( + &mut self, + state: Self::TupleVariantState, + ) -> Result<(), Self::Error>; + + /// Begins to serialize a map. This call must be followed by zero or more + /// calls to `serialize_map_key` and `serialize_map_value`, then a call to + /// `serialize_map_end`. + fn serialize_map( + &mut self, + len: Option, + ) -> Result; + + /// Serialize a map key. Must have previously called `serialize_map`. + fn serialize_map_key( + &mut self, + state: &mut Self::MapState, + key: T + ) -> Result<(), Self::Error>; + + /// Serialize a map value. Must have previously called `serialize_map`. + fn serialize_map_value( + &mut self, + state: &mut Self::MapState, + value: T + ) -> Result<(), Self::Error>; + + /// Finishes serializing a map. + fn serialize_map_end( + &mut self, + state: Self::MapState, + ) -> Result<(), Self::Error>; + + /// Begins to serialize a struct. This call must be followed by zero or more + /// calls to `serialize_struct_elt`, then a call to `serialize_struct_end`. + fn serialize_struct( + &mut self, + name: &'static str, + len: usize, + ) -> Result; + + /// Serializes a struct field. Must have previously called + /// `serialize_struct`. + fn serialize_struct_elt( + &mut self, + state: &mut Self::StructState, + key: &'static str, + value: V, + ) -> Result<(), Self::Error>; + + /// Finishes serializing a struct. + fn serialize_struct_end( + &mut self, + state: Self::StructState, + ) -> Result<(), Self::Error>; + + /// Begins to serialize a struct variant. This call must be followed by zero + /// or more calls to `serialize_struct_variant_elt`, then a call to + /// `serialize_struct_variant_end`. + fn serialize_struct_variant( + &mut self, + name: &'static str, + variant_index: usize, + variant: &'static str, + len: usize, + ) -> Result; + + /// Serialize a struct variant element. Must have previously called + /// `serialize_struct_variant`. + fn serialize_struct_variant_elt( + &mut self, + state: &mut Self::StructVariantState, + key: &'static str, + value: V, + ) -> Result<(), Self::Error>; + + /// Finishes serializing a struct variant. + fn serialize_struct_variant_end( + &mut self, + state: Self::StructVariantState, + ) -> Result<(), Self::Error>; +} diff --git a/third_party/rust/serde/src/utils.rs b/third_party/rust/serde/src/utils.rs new file mode 100644 index 000000000000..708eb42744d2 --- /dev/null +++ b/third_party/rust/serde/src/utils.rs @@ -0,0 +1,72 @@ +//! Private utility functions + +const TAG_CONT: u8 = 0b1000_0000; +const TAG_TWO_B: u8 = 0b1100_0000; +const TAG_THREE_B: u8 = 0b1110_0000; +const TAG_FOUR_B: u8 = 0b1111_0000; +const MAX_ONE_B: u32 = 0x80; +const MAX_TWO_B: u32 = 0x800; +const MAX_THREE_B: u32 = 0x10000; + +#[inline] +pub fn encode_utf8(c: char) -> EncodeUtf8 { + let code = c as u32; + let mut buf = [0; 4]; + let pos = if code < MAX_ONE_B { + buf[3] = code as u8; + 3 + } else if code < MAX_TWO_B { + buf[2] = (code >> 6 & 0x1F) as u8 | TAG_TWO_B; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 2 + } else if code < MAX_THREE_B { + buf[1] = (code >> 12 & 0x0F) as u8 | TAG_THREE_B; + buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 1 + } else { + buf[0] = (code >> 18 & 0x07) as u8 | TAG_FOUR_B; + buf[1] = (code >> 12 & 0x3F) as u8 | TAG_CONT; + buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 0 + }; + EncodeUtf8 { buf: buf, pos: pos } +} + +pub struct EncodeUtf8 { + buf: [u8; 4], + pos: usize, +} + +impl EncodeUtf8 { + // FIXME: use this from_utf8_unchecked, since we know it can never fail + pub fn as_str(&self) -> &str { + ::core::str::from_utf8(&self.buf[self.pos..]).unwrap() + } +} + +#[allow(non_upper_case_globals)] +const Pattern_White_Space_table: &'static [(char, char)] = &[ + ('\u{9}', '\u{d}'), ('\u{20}', '\u{20}'), ('\u{85}', '\u{85}'), ('\u{200e}', '\u{200f}'), + ('\u{2028}', '\u{2029}') +]; + +fn bsearch_range_table(c: char, r: &'static [(char, char)]) -> bool { + use core::cmp::Ordering::{Equal, Less, Greater}; + r.binary_search_by(|&(lo, hi)| { + if c < lo { + Greater + } else if hi < c { + Less + } else { + Equal + } + }) + .is_ok() +} + +#[allow(non_snake_case)] +pub fn Pattern_White_Space(c: char) -> bool { + bsearch_range_table(c, Pattern_White_Space_table) +} diff --git a/third_party/rust/serde_codegen/.cargo-checksum.json b/third_party/rust/serde_codegen/.cargo-checksum.json new file mode 100644 index 000000000000..66719cae68f6 --- /dev/null +++ b/third_party/rust/serde_codegen/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"b16e3c93d139c09eb72a661a4201661c3c57ccca250a928a2ebc29f587d92540","src/bound.rs":"d1f94299052acaeeae0c011c2304b072dec76c7c32469d2b8881c2e380346496","src/de.rs":"a16c27918c973463427faaa98a7e7bd156c828bac4b96d605c30f82dad347476","src/lib.rs":"3ce6c8c8445b9f0987472477586c26281dd129f7dd9af4fd0a99d51bdfb65782","src/ser.rs":"5b86cf6b0b7941d3d82f3ed32cd26b845c821558f086fe9d7237f0ff1e066e61"},"package":"a4c5d8a33087d8984f9535daa62a6498a08f6476050b00ab9339dd847e4c25cc"} \ No newline at end of file diff --git a/third_party/rust/serde_codegen/.cargo-ok b/third_party/rust/serde_codegen/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/serde_codegen/Cargo.toml b/third_party/rust/serde_codegen/Cargo.toml new file mode 100644 index 000000000000..525698131158 --- /dev/null +++ b/third_party/rust/serde_codegen/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "serde_codegen" +version = "0.8.23" +authors = ["Erick Tryzelaar "] +license = "MIT/Apache-2.0" +description = "Macros to auto-generate implementations for the serde framework" +homepage = "https://serde.rs" +repository = "https://github.com/serde-rs/serde" +documentation = "https://serde.rs/codegen.html" +keywords = ["serde", "serialization"] +include = ["Cargo.toml", "src/**/*.rs"] + +[features] +default = ["with-syntex"] +unstable = [] +unstable-testing = ["clippy"] +with-syntex = [ + "syntex", + "syntex_syntax", +] +with-syn = [] + +[dependencies] +clippy = { version = "^0.*", optional = true } +quote = "0.3.8" +serde_codegen_internals = { version = "=0.11.3", default-features = false, path = "../serde_codegen_internals" } +syn = { version = "0.10", features = ["aster", "visit"] } +syntex = { version = "^0.54.0", optional = true } +syntex_syntax = { version = "^0.54.0", optional = true } diff --git a/third_party/rust/serde_codegen/src/bound.rs b/third_party/rust/serde_codegen/src/bound.rs new file mode 100644 index 000000000000..fef77ba382d2 --- /dev/null +++ b/third_party/rust/serde_codegen/src/bound.rs @@ -0,0 +1,121 @@ +use std::collections::HashSet; + +use syn::{self, aster, visit}; + +use internals::ast::Item; +use internals::attr; + +// Remove the default from every type parameter because in the generated impls +// they look like associated types: "error: associated type bindings are not +// allowed here". +pub fn without_defaults(generics: &syn::Generics) -> syn::Generics { + syn::Generics { + ty_params: generics.ty_params.iter().map(|ty_param| { + syn::TyParam { + default: None, + .. ty_param.clone() + }}).collect(), + .. generics.clone() + } +} + +pub fn with_where_predicates( + generics: &syn::Generics, + predicates: &[syn::WherePredicate], +) -> syn::Generics { + aster::from_generics(generics.clone()) + .with_predicates(predicates.to_vec()) + .build() +} + +pub fn with_where_predicates_from_fields( + item: &Item, + generics: &syn::Generics, + from_field: F, +) -> syn::Generics + where F: Fn(&attr::Field) -> Option<&[syn::WherePredicate]>, +{ + aster::from_generics(generics.clone()) + .with_predicates( + item.body.all_fields() + .flat_map(|field| from_field(&field.attrs)) + .flat_map(|predicates| predicates.to_vec())) + .build() +} + +// Puts the given bound on any generic type parameters that are used in fields +// for which filter returns true. +// +// For example, the following struct needs the bound `A: Serialize, B: Serialize`. +// +// struct S<'b, A, B: 'b, C> { +// a: A, +// b: Option<&'b B> +// #[serde(skip_serializing)] +// c: C, +// } +pub fn with_bound( + item: &Item, + generics: &syn::Generics, + filter: F, + bound: &syn::Path, +) -> syn::Generics + where F: Fn(&attr::Field) -> bool, +{ + struct FindTyParams { + // Set of all generic type parameters on the current struct (A, B, C in + // the example). Initialized up front. + all_ty_params: HashSet, + // Set of generic type parameters used in fields for which filter + // returns true (A and B in the example). Filled in as the visitor sees + // them. + relevant_ty_params: HashSet, + } + impl visit::Visitor for FindTyParams { + fn visit_path(&mut self, path: &syn::Path) { + if let Some(seg) = path.segments.last() { + if seg.ident == "PhantomData" { + // Hardcoded exception, because PhantomData implements + // Serialize and Deserialize whether or not T implements it. + return; + } + } + if !path.global && path.segments.len() == 1 { + let id = path.segments[0].ident.clone(); + if self.all_ty_params.contains(&id) { + self.relevant_ty_params.insert(id); + } + } + visit::walk_path(self, path); + } + } + + let all_ty_params: HashSet<_> = generics.ty_params.iter() + .map(|ty_param| ty_param.ident.clone()) + .collect(); + + let relevant_tys = item.body.all_fields() + .filter(|&field| filter(&field.attrs)) + .map(|field| &field.ty); + + let mut visitor = FindTyParams { + all_ty_params: all_ty_params, + relevant_ty_params: HashSet::new(), + }; + for ty in relevant_tys { + visit::walk_ty(&mut visitor, ty); + } + + aster::from_generics(generics.clone()) + .with_predicates( + generics.ty_params.iter() + .map(|ty_param| ty_param.ident.clone()) + .filter(|id| visitor.relevant_ty_params.contains(id)) + .map(|id| aster::where_predicate() + // the type parameter that is being bounded e.g. T + .bound().build(aster::ty().id(id)) + // the bound e.g. Serialize + .bound().trait_(bound.clone()).build() + .build())) + .build() +} diff --git a/third_party/rust/serde_codegen/src/de.rs b/third_party/rust/serde_codegen/src/de.rs new file mode 100644 index 000000000000..877b6a05289d --- /dev/null +++ b/third_party/rust/serde_codegen/src/de.rs @@ -0,0 +1,1040 @@ +use syn::{self, aster}; +use quote::{self, Tokens}; + +use bound; +use internals::ast::{Body, Field, Item, Style, Variant}; +use internals::{self, attr}; + +use std::iter; + +pub fn expand_derive_deserialize(item: &syn::MacroInput) -> Result { + let item = { + let ctxt = internals::Ctxt::new(); + let item = Item::from_ast(&ctxt, item); + check_no_str(&ctxt, &item); + try!(ctxt.check()); + item + }; + + let impl_generics = build_impl_generics(&item); + + let ty = aster::ty().path() + .segment(item.ident.clone()).with_generics(impl_generics.clone()).build() + .build(); + + let body = deserialize_body(&item, + &impl_generics, + ty.clone()); + + let where_clause = &impl_generics.where_clause; + + let dummy_const = aster::id(format!("_IMPL_DESERIALIZE_FOR_{}", item.ident)); + + Ok(quote! { + #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] + const #dummy_const: () = { + extern crate serde as _serde; + #[automatically_derived] + impl #impl_generics _serde::de::Deserialize for #ty #where_clause { + fn deserialize<__D>(deserializer: &mut __D) -> ::std::result::Result<#ty, __D::Error> + where __D: _serde::de::Deserializer + #body + } + }; + }) +} + +// All the generics in the input, plus a bound `T: Deserialize` for each generic +// field type that will be deserialized by us, plus a bound `T: Default` for +// each generic field type that will be set to a default value. +fn build_impl_generics(item: &Item) -> syn::Generics { + let generics = bound::without_defaults(item.generics); + + let generics = bound::with_where_predicates_from_fields( + item, &generics, + |attrs| attrs.de_bound()); + + match item.attrs.de_bound() { + Some(predicates) => { + bound::with_where_predicates(&generics, predicates) + } + None => { + let generics = bound::with_bound(item, &generics, + needs_deserialize_bound, + &aster::path().ids(&["_serde", "de", "Deserialize"]).build()); + bound::with_bound(item, &generics, + requires_default, + &aster::path().global().ids(&["std", "default", "Default"]).build()) + } + } +} + +// Fields with a `skip_deserializing` or `deserialize_with` attribute are not +// deserialized by us so we do not generate a bound. Fields with a `bound` +// attribute specify their own bound so we do not generate one. All other fields +// may need a `T: Deserialize` bound where T is the type of the field. +fn needs_deserialize_bound(attrs: &attr::Field) -> bool { + !attrs.skip_deserializing() + && attrs.deserialize_with().is_none() + && attrs.de_bound().is_none() +} + +// Fields with a `default` attribute (not `default=...`), and fields with a +// `skip_deserializing` attribute that do not also have `default=...`. +fn requires_default(attrs: &attr::Field) -> bool { + attrs.default() == &attr::FieldDefault::Default +} + +fn deserialize_body( + item: &Item, + impl_generics: &syn::Generics, + ty: syn::Ty, +) -> Tokens { + match item.body { + Body::Enum(ref variants) => { + deserialize_item_enum( + &item.ident, + impl_generics, + ty, + variants, + &item.attrs) + } + Body::Struct(Style::Struct, ref fields) => { + if fields.iter().any(|field| field.ident.is_none()) { + panic!("struct has unnamed fields"); + } + + deserialize_struct( + &item.ident, + None, + impl_generics, + ty, + fields, + &item.attrs) + } + Body::Struct(Style::Tuple, ref fields) | + Body::Struct(Style::Newtype, ref fields) => { + if fields.iter().any(|field| field.ident.is_some()) { + panic!("tuple struct has named fields"); + } + + deserialize_tuple( + &item.ident, + None, + impl_generics, + ty, + fields, + &item.attrs) + } + Body::Struct(Style::Unit, _) => { + deserialize_unit_struct( + &item.ident, + &item.attrs) + } + } +} + +// Build `__Visitor(PhantomData, PhantomData, ...)` +// +// Returns: +// +// 1. the struct declaration +// 2. the visitor type, including generics +// 3. the expression for instantiating the visitor +fn deserialize_visitor(generics: &syn::Generics) -> (Tokens, Tokens, Tokens) { + if generics.lifetimes.is_empty() && generics.ty_params.is_empty() { + ( + quote! { + struct __Visitor; + }, + quote!(__Visitor), + quote!(__Visitor), + ) + } else { + let where_clause = &generics.where_clause; + + let num_phantoms = generics.lifetimes.len() + generics.ty_params.len(); + + let phantom_types = generics.lifetimes.iter() + .map(|lifetime_def| { + let lifetime = &lifetime_def.lifetime; + quote!(::std::marker::PhantomData<& #lifetime ()>) + }).chain(generics.ty_params.iter() + .map(|ty_param| { + let ident = &ty_param.ident; + quote!(::std::marker::PhantomData<#ident>) + })); + + let all_params = generics.lifetimes.iter() + .map(|lifetime_def| { + let lifetime = &lifetime_def.lifetime; + quote!(#lifetime) + }).chain(generics.ty_params.iter() + .map(|ty_param| { + let ident = &ty_param.ident; + quote!(#ident) + })); + + let ty_param_idents: Vec<_> = generics.ty_params.iter() + .map(|t| { + let ident = &t.ident; + quote!(#ident) + }) + .collect(); + + let ty_param_idents = if ty_param_idents.is_empty() { + None + } else { + Some(quote!(::<#(#ty_param_idents),*>)) + }; + + let phantom_exprs = iter::repeat(quote!(::std::marker::PhantomData)).take(num_phantoms); + + ( + quote! { + struct __Visitor #generics ( #(#phantom_types),* ) #where_clause; + }, + quote!(__Visitor <#(#all_params),*> ), + quote!(__Visitor #ty_param_idents ( #(#phantom_exprs),* )), + ) + } +} + +fn deserialize_unit_struct( + type_ident: &syn::Ident, + item_attrs: &attr::Item, +) -> Tokens { + let type_name = item_attrs.name().deserialize_name(); + + quote!({ + struct __Visitor; + + impl _serde::de::Visitor for __Visitor { + type Value = #type_ident; + + #[inline] + fn visit_unit<__E>(&mut self) -> ::std::result::Result<#type_ident, __E> + where __E: _serde::de::Error, + { + Ok(#type_ident) + } + + #[inline] + fn visit_seq<__V>(&mut self, mut visitor: __V) -> ::std::result::Result<#type_ident, __V::Error> + where __V: _serde::de::SeqVisitor, + { + try!(visitor.end()); + self.visit_unit() + } + } + + deserializer.deserialize_unit_struct(#type_name, __Visitor) + }) +} + +fn deserialize_tuple( + type_ident: &syn::Ident, + variant_ident: Option<&syn::Ident>, + impl_generics: &syn::Generics, + ty: syn::Ty, + fields: &[Field], + item_attrs: &attr::Item, +) -> Tokens { + let where_clause = &impl_generics.where_clause; + + let (visitor_item, visitor_ty, visitor_expr) = deserialize_visitor(impl_generics); + + let is_enum = variant_ident.is_some(); + let type_path = match variant_ident { + Some(variant_ident) => quote!(#type_ident::#variant_ident), + None => quote!(#type_ident), + }; + + let nfields = fields.len(); + + let visit_newtype_struct = if !is_enum && nfields == 1 { + Some(deserialize_newtype_struct( + type_ident, + &type_path, + impl_generics, + &fields[0], + )) + } else { + None + }; + + let visit_seq = deserialize_seq( + type_ident, + &type_path, + impl_generics, + fields, + false, + ); + + let dispatch = if is_enum { + quote!(visitor.visit_tuple(#nfields, #visitor_expr)) + } else if nfields == 1 { + let type_name = item_attrs.name().deserialize_name(); + quote!(deserializer.deserialize_newtype_struct(#type_name, #visitor_expr)) + } else { + let type_name = item_attrs.name().deserialize_name(); + quote!(deserializer.deserialize_tuple_struct(#type_name, #nfields, #visitor_expr)) + }; + + quote!({ + #visitor_item + + impl #impl_generics _serde::de::Visitor for #visitor_ty #where_clause { + type Value = #ty; + + #visit_newtype_struct + + #[inline] + fn visit_seq<__V>(&mut self, mut visitor: __V) -> ::std::result::Result<#ty, __V::Error> + where __V: _serde::de::SeqVisitor + { + #visit_seq + } + } + + #dispatch + }) +} + +fn deserialize_seq( + type_ident: &syn::Ident, + type_path: &Tokens, + impl_generics: &syn::Generics, + fields: &[Field], + is_struct: bool, +) -> Tokens { + let mut index_in_seq = 0usize; + let let_values: Vec<_> = fields.iter() + .enumerate() + .map(|(i, field)| { + let name = aster::id(format!("__field{}", i)); + if field.attrs.skip_deserializing() { + let default = expr_is_missing(&field.attrs); + quote! { + let #name = #default; + } + } else { + let visit = match field.attrs.deserialize_with() { + None => { + let field_ty = &field.ty; + quote!(try!(visitor.visit::<#field_ty>())) + } + Some(path) => { + let (wrapper, wrapper_impl, wrapper_ty) = wrap_deserialize_with( + type_ident, impl_generics, field.ty, path); + quote!({ + #wrapper + #wrapper_impl + try!(visitor.visit::<#wrapper_ty>()).map(|wrap| wrap.value) + }) + } + }; + let assign = quote! { + let #name = match #visit { + Some(value) => { value }, + None => { + try!(visitor.end()); + return Err(_serde::de::Error::invalid_length(#index_in_seq)); + } + }; + }; + index_in_seq += 1; + assign + } + }) + .collect(); + + let result = if is_struct { + let args = fields.iter() + .enumerate() + .map(|(i, field)| { + let ident = field.ident.clone().expect("struct contains unnamed fields"); + let value = aster::id(format!("__field{}", i)); + quote!(#ident: #value) + }); + quote! { + #type_path { #(#args),* } + } + } else { + let args = (0..fields.len()).map(|i| aster::id(format!("__field{}", i))); + quote! { + #type_path ( #(#args),* ) + } + }; + + quote! { + #(#let_values)* + + try!(visitor.end()); + + Ok(#result) + } +} + +fn deserialize_newtype_struct( + type_ident: &syn::Ident, + type_path: &Tokens, + impl_generics: &syn::Generics, + field: &Field, +) -> Tokens { + let value = match field.attrs.deserialize_with() { + None => { + let field_ty = &field.ty; + quote! { + try!(<#field_ty as _serde::Deserialize>::deserialize(__e)) + } + } + Some(path) => { + let (wrapper, wrapper_impl, wrapper_ty) = wrap_deserialize_with( + type_ident, impl_generics, field.ty, path); + quote!({ + #wrapper + #wrapper_impl + try!(<#wrapper_ty as _serde::Deserialize>::deserialize(__e)).value + }) + } + }; + quote! { + #[inline] + fn visit_newtype_struct<__E>(&mut self, __e: &mut __E) -> ::std::result::Result + where __E: _serde::de::Deserializer, + { + Ok(#type_path(#value)) + } + } +} + +fn deserialize_struct( + type_ident: &syn::Ident, + variant_ident: Option<&syn::Ident>, + impl_generics: &syn::Generics, + ty: syn::Ty, + fields: &[Field], + item_attrs: &attr::Item, +) -> Tokens { + let where_clause = &impl_generics.where_clause; + + let (visitor_item, visitor_ty, visitor_expr) = deserialize_visitor(impl_generics); + + let type_path = match variant_ident { + Some(variant_ident) => quote!(#type_ident::#variant_ident), + None => quote!(#type_ident), + }; + + let visit_seq = deserialize_seq( + type_ident, + &type_path, + impl_generics, + fields, + true, + ); + + let (field_visitor, fields_stmt, visit_map) = deserialize_struct_visitor( + type_ident, + type_path, + impl_generics, + fields, + item_attrs, + ); + + let is_enum = variant_ident.is_some(); + let dispatch = if is_enum { + quote! { + visitor.visit_struct(FIELDS, #visitor_expr) + } + } else { + let type_name = item_attrs.name().deserialize_name(); + quote! { + deserializer.deserialize_struct(#type_name, FIELDS, #visitor_expr) + } + }; + + quote!({ + #field_visitor + + #visitor_item + + impl #impl_generics _serde::de::Visitor for #visitor_ty #where_clause { + type Value = #ty; + + #[inline] + fn visit_seq<__V>(&mut self, mut visitor: __V) -> ::std::result::Result<#ty, __V::Error> + where __V: _serde::de::SeqVisitor + { + #visit_seq + } + + #[inline] + fn visit_map<__V>(&mut self, mut visitor: __V) -> ::std::result::Result<#ty, __V::Error> + where __V: _serde::de::MapVisitor + { + #visit_map + } + } + + #fields_stmt + + #dispatch + }) +} + +fn deserialize_item_enum( + type_ident: &syn::Ident, + impl_generics: &syn::Generics, + ty: syn::Ty, + variants: &[Variant], + item_attrs: &attr::Item +) -> Tokens { + let where_clause = &impl_generics.where_clause; + + let type_name = item_attrs.name().deserialize_name(); + + let variant_visitor = deserialize_field_visitor( + variants.iter() + .filter(|variant| !variant.attrs.skip_deserializing()) + .map(|variant| variant.attrs.name().deserialize_name()) + .collect(), + item_attrs, + true, + ); + + let variant_names = variants.iter().map(|variant| variant.ident.to_string()); + + let variants_stmt = quote! { + const VARIANTS: &'static [&'static str] = &[ #(#variant_names),* ]; + }; + + let ignored_arm = if item_attrs.deny_unknown_fields() { + None + } else { + Some(quote! { + __Field::__ignore => { Err(_serde::de::Error::end_of_stream()) } + }) + }; + + // Match arms to extract a variant from a string + let mut variant_arms = vec![]; + for (i, variant) in variants.iter().filter(|variant| !variant.attrs.skip_deserializing()).enumerate() { + let variant_name = aster::id(format!("__field{}", i)); + let variant_name = quote!(__Field::#variant_name); + + let block = deserialize_variant( + type_ident, + impl_generics, + ty.clone(), + variant, + item_attrs, + ); + + let arm = quote! { + #variant_name => #block + }; + variant_arms.push(arm); + } + variant_arms.extend(ignored_arm.into_iter()); + + let (visitor_item, visitor_ty, visitor_expr) = deserialize_visitor(impl_generics); + + quote!({ + #variant_visitor + + #visitor_item + + impl #impl_generics _serde::de::EnumVisitor for #visitor_ty #where_clause { + type Value = #ty; + + fn visit<__V>(&mut self, mut visitor: __V) -> ::std::result::Result<#ty, __V::Error> + where __V: _serde::de::VariantVisitor, + { + match try!(visitor.visit_variant()) { + #(#variant_arms)* + } + } + } + + #variants_stmt + + deserializer.deserialize_enum(#type_name, VARIANTS, #visitor_expr) + }) +} + +fn deserialize_variant( + type_ident: &syn::Ident, + generics: &syn::Generics, + ty: syn::Ty, + variant: &Variant, + item_attrs: &attr::Item, +) -> Tokens { + let variant_ident = &variant.ident; + + match variant.style { + Style::Unit => { + quote!({ + try!(visitor.visit_unit()); + Ok(#type_ident::#variant_ident) + }) + } + Style::Newtype => { + deserialize_newtype_variant( + type_ident, + variant_ident, + generics, + &variant.fields[0], + ) + } + Style::Tuple => { + deserialize_tuple( + type_ident, + Some(variant_ident), + generics, + ty, + &variant.fields, + item_attrs, + ) + } + Style::Struct => { + deserialize_struct( + type_ident, + Some(variant_ident), + generics, + ty, + &variant.fields, + item_attrs, + ) + } + } +} + +fn deserialize_newtype_variant( + type_ident: &syn::Ident, + variant_ident: &syn::Ident, + impl_generics: &syn::Generics, + field: &Field, +) -> Tokens { + let visit = match field.attrs.deserialize_with() { + None => { + let field_ty = &field.ty; + quote!(try!(visitor.visit_newtype::<#field_ty>())) + } + Some(path) => { + let (wrapper, wrapper_impl, wrapper_ty) = wrap_deserialize_with( + type_ident, impl_generics, field.ty, path); + quote!({ + #wrapper + #wrapper_impl + try!(visitor.visit_newtype::<#wrapper_ty>()).value + }) + } + }; + quote! { + Ok(#type_ident::#variant_ident(#visit)), + } +} + +fn deserialize_field_visitor( + field_names: Vec, + item_attrs: &attr::Item, + is_variant: bool, +) -> Tokens { + // Create the field names for the fields. + let field_idents: Vec<_> = (0 .. field_names.len()) + .map(|i| aster::id(format!("__field{}", i))) + .collect(); + + let ignore_variant = if item_attrs.deny_unknown_fields() { + None + } else { + Some(quote!(__ignore,)) + }; + + let index_field_arms: Vec<_> = field_idents.iter() + .enumerate() + .map(|(field_index, field_ident)| { + quote! { + #field_index => { Ok(__Field::#field_ident) } + } + }) + .collect(); + + let (index_error_msg, unknown_ident) = if is_variant { + ("expected a variant", aster::id("unknown_variant")) + } else { + ("expected a field", aster::id("unknown_field")) + }; + + let fallthrough_index_arm_expr = if !is_variant && !item_attrs.deny_unknown_fields() { + quote! { + Ok(__Field::__ignore) + } + } else { + quote! { + Err(_serde::de::Error::invalid_value(#index_error_msg)) + } + }; + + let index_body = quote! { + match value { + #(#index_field_arms)* + _ => #fallthrough_index_arm_expr + } + }; + + // Match arms to extract a field from a string + let str_field_arms: Vec<_> = field_idents.iter().zip(field_names.iter()) + .map(|(field_ident, field_name)| { + quote! { + #field_name => { Ok(__Field::#field_ident) } + } + }) + .collect(); + + let fallthrough_str_arm_expr = if !is_variant && !item_attrs.deny_unknown_fields() { + quote! { + Ok(__Field::__ignore) + } + } else { + quote! { + Err(_serde::de::Error::#unknown_ident(value)) + } + }; + + let str_body = quote! { + match value { + #(#str_field_arms)* + _ => #fallthrough_str_arm_expr + } + }; + + // Match arms to extract a field from a string + let bytes_field_arms: Vec<_> = field_idents.iter().zip(field_names.iter()) + .map(|(field_ident, field_name)| { + let bytes_field_name = quote::ByteStr(field_name); + quote! { + #bytes_field_name => { Ok(__Field::#field_ident) } + } + }) + .collect(); + + let fallthrough_bytes_arm_expr = if !is_variant && !item_attrs.deny_unknown_fields() { + quote! { + Ok(__Field::__ignore) + } + } else { + quote!({ + let value = ::std::string::String::from_utf8_lossy(value); + Err(_serde::de::Error::#unknown_ident(&value)) + }) + }; + + let bytes_body = quote! { + match value { + #(#bytes_field_arms)* + _ => #fallthrough_bytes_arm_expr + } + }; + + quote! { + #[allow(non_camel_case_types)] + enum __Field { + #(#field_idents,)* + #ignore_variant + } + + impl _serde::de::Deserialize for __Field { + #[inline] + fn deserialize<__D>(deserializer: &mut __D) -> ::std::result::Result<__Field, __D::Error> + where __D: _serde::de::Deserializer, + { + struct __FieldVisitor; + + impl _serde::de::Visitor for __FieldVisitor { + type Value = __Field; + + fn visit_usize<__E>(&mut self, value: usize) -> ::std::result::Result<__Field, __E> + where __E: _serde::de::Error + { + #index_body + } + + fn visit_str<__E>(&mut self, value: &str) -> ::std::result::Result<__Field, __E> + where __E: _serde::de::Error + { + #str_body + } + + fn visit_bytes<__E>(&mut self, value: &[u8]) -> ::std::result::Result<__Field, __E> + where __E: _serde::de::Error + { + #bytes_body + } + } + + deserializer.deserialize_struct_field(__FieldVisitor) + } + } + } +} + +fn deserialize_struct_visitor( + type_ident: &syn::Ident, + struct_path: Tokens, + impl_generics: &syn::Generics, + fields: &[Field], + item_attrs: &attr::Item, +) -> (Tokens, Tokens, Tokens) { + let field_exprs = fields.iter() + .map(|field| field.attrs.name().deserialize_name()) + .collect(); + + let field_visitor = deserialize_field_visitor( + field_exprs, + item_attrs, + false, + ); + + let visit_map = deserialize_map( + type_ident, + struct_path, + impl_generics, + fields, + item_attrs, + ); + + let field_names = fields.iter().map(|field| { + field.ident.clone().expect("struct contains unnamed field").to_string() + }); + + let fields_stmt = quote! { + const FIELDS: &'static [&'static str] = &[ #(#field_names),* ]; + }; + + (field_visitor, fields_stmt, visit_map) +} + +fn deserialize_map( + type_ident: &syn::Ident, + struct_path: Tokens, + impl_generics: &syn::Generics, + fields: &[Field], + item_attrs: &attr::Item, +) -> Tokens { + // Create the field names for the fields. + let fields_names = fields.iter() + .enumerate() + .map(|(i, field)| + (field, aster::id(format!("__field{}", i)))) + .collect::>(); + + // Declare each field that will be deserialized. + let let_values: Vec<_> = fields_names.iter() + .filter(|&&(field, _)| !field.attrs.skip_deserializing()) + .map(|&(field, ref name)| { + let field_ty = &field.ty; + quote! { + let mut #name: Option<#field_ty> = None; + } + }) + .collect(); + + // Match arms to extract a value for a field. + let value_arms = fields_names.iter() + .filter(|&&(field, _)| !field.attrs.skip_deserializing()) + .map(|&(field, ref name)| { + let deser_name = field.attrs.name().deserialize_name(); + + let visit = match field.attrs.deserialize_with() { + None => { + let field_ty = &field.ty; + quote! { + try!(visitor.visit_value::<#field_ty>()) + } + } + Some(path) => { + let (wrapper, wrapper_impl, wrapper_ty) = wrap_deserialize_with( + type_ident, impl_generics, field.ty, path); + quote!({ + #wrapper + #wrapper_impl + try!(visitor.visit_value::<#wrapper_ty>()).value + }) + } + }; + quote! { + __Field::#name => { + if #name.is_some() { + return Err(<__V::Error as _serde::de::Error>::duplicate_field(#deser_name)); + } + #name = Some(#visit); + } + } + }) + .collect::>(); + + // Match arms to ignore value for fields that have `skip_deserializing`. + // Ignored even if `deny_unknown_fields` is set. + let skipped_arms = fields_names.iter() + .filter(|&&(field, _)| field.attrs.skip_deserializing()) + .map(|&(_, ref name)| { + quote! { + __Field::#name => { + let _ = try!(visitor.visit_value::<_serde::de::impls::IgnoredAny>()); + } + } + }) + .collect::>(); + + // Visit ignored values to consume them + let ignored_arm = if item_attrs.deny_unknown_fields() { + None + } else { + Some(quote! { + _ => { let _ = try!(visitor.visit_value::<_serde::de::impls::IgnoredAny>()); } + }) + }; + + let extract_values = fields_names.iter() + .filter(|&&(field, _)| !field.attrs.skip_deserializing()) + .map(|&(field, ref name)| { + let missing_expr = expr_is_missing(&field.attrs); + + quote! { + let #name = match #name { + Some(#name) => #name, + None => #missing_expr + }; + } + }) + .collect::>(); + + let result = fields_names.iter() + .map(|&(field, ref name)| { + let ident = field.ident.clone().expect("struct contains unnamed fields"); + let value = if field.attrs.skip_deserializing() { + expr_is_missing(&field.attrs) + } else { + quote!(#name) + }; + quote!(#ident: #value) + }); + + quote! { + #(#let_values)* + + while let Some(key) = try!(visitor.visit_key::<__Field>()) { + match key { + #(#value_arms)* + #(#skipped_arms)* + #ignored_arm + } + } + + try!(visitor.end()); + + #(#extract_values)* + + Ok(#struct_path { #(#result),* }) + } +} + +/// This function wraps the expression in `#[serde(deserialize_with="...")]` in +/// a trait to prevent it from accessing the internal `Deserialize` state. +fn wrap_deserialize_with( + type_ident: &syn::Ident, + impl_generics: &syn::Generics, + field_ty: &syn::Ty, + deserialize_with: &syn::Path, +) -> (Tokens, Tokens, syn::Path) { + // Quasi-quoting doesn't do a great job of expanding generics into paths, + // so manually build it. + let wrapper_ty = aster::path() + .segment("__SerdeDeserializeWithStruct") + .with_generics(impl_generics.clone()) + .build() + .build(); + + let where_clause = &impl_generics.where_clause; + + let phantom_ty = aster::path() + .segment(type_ident) + .with_generics(aster::from_generics(impl_generics.clone()) + .strip_ty_params() + .build()) + .build() + .build(); + + ( + quote! { + struct __SerdeDeserializeWithStruct #impl_generics #where_clause { + value: #field_ty, + phantom: ::std::marker::PhantomData<#phantom_ty>, + } + }, + quote! { + impl #impl_generics _serde::de::Deserialize for #wrapper_ty #where_clause { + fn deserialize<__D>(__d: &mut __D) -> ::std::result::Result + where __D: _serde::de::Deserializer + { + let value = try!(#deserialize_with(__d)); + Ok(__SerdeDeserializeWithStruct { + value: value, + phantom: ::std::marker::PhantomData, + }) + } + } + }, + wrapper_ty, + ) +} + +fn expr_is_missing(attrs: &attr::Field) -> Tokens { + match *attrs.default() { + attr::FieldDefault::Default => { + return quote!(::std::default::Default::default()); + } + attr::FieldDefault::Path(ref path) => { + return quote!(#path()); + } + attr::FieldDefault::None => { /* below */ } + } + + let name = attrs.name().deserialize_name(); + match attrs.deserialize_with() { + None => { + quote! { + try!(visitor.missing_field(#name)) + } + } + Some(_) => { + quote! { + return Err(<__V::Error as _serde::de::Error>::missing_field(#name)) + } + } + } +} + +fn check_no_str(cx: &internals::Ctxt, item: &Item) { + let fail = || { + cx.error( + "Serde does not support deserializing fields of type &str; \ + consider using String instead"); + }; + + for field in item.body.all_fields() { + if field.attrs.skip_deserializing() + || field.attrs.deserialize_with().is_some() { continue } + + if let syn::Ty::Rptr(_, ref inner) = *field.ty { + if let syn::Ty::Path(_, ref path) = inner.ty { + if path.segments.len() == 1 && path.segments[0].ident == "str" { + fail(); + return; + } + } + } + } +} diff --git a/third_party/rust/serde_codegen/src/lib.rs b/third_party/rust/serde_codegen/src/lib.rs new file mode 100644 index 000000000000..f920dda5c46c --- /dev/null +++ b/third_party/rust/serde_codegen/src/lib.rs @@ -0,0 +1,172 @@ +#![cfg_attr(feature = "clippy", plugin(clippy))] +#![cfg_attr(feature = "clippy", feature(plugin))] +#![cfg_attr(feature = "clippy", allow(too_many_arguments))] +#![cfg_attr(feature = "clippy", allow(used_underscore_binding))] + +// The `quote!` macro requires deep recursion. +#![recursion_limit = "192"] + +extern crate serde_codegen_internals as internals; + +#[cfg(feature = "with-syntex")] +extern crate syntex; + +#[cfg(feature = "with-syntex")] +#[macro_use] +extern crate syntex_syntax as syntax; + +extern crate syn; +#[macro_use] +extern crate quote; + +#[cfg(feature = "with-syntex")] +use std::path::Path; + +mod bound; +mod de; +mod ser; + +#[cfg(feature = "with-syntex")] +fn syntex_registry() -> syntex::Registry { + use syntax::{ast, fold}; + + /// Strip the serde attributes from the crate. + #[cfg(feature = "with-syntex")] + fn strip_attributes(krate: ast::Crate) -> ast::Crate { + /// Helper folder that strips the serde attributes after the extensions have been expanded. + struct StripAttributeFolder; + + impl fold::Folder for StripAttributeFolder { + fn fold_attribute(&mut self, attr: ast::Attribute) -> Option { + if attr.value.name == "serde" { + if let ast::MetaItemKind::List(..) = attr.value.node { + return None; + } + } + Some(attr) + } + + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { + fold::noop_fold_mac(mac, self) + } + } + + fold::Folder::fold_crate(&mut StripAttributeFolder, krate) + } + + let mut reg = syntex::Registry::new(); + + reg.add_attr("feature(custom_derive)"); + reg.add_attr("feature(custom_attribute)"); + + reg.add_decorator("derive_Serialize", shim::expand_derive_serialize); + reg.add_decorator("derive_Deserialize", shim::expand_derive_deserialize); + + reg.add_post_expansion_pass(strip_attributes); + + reg +} + +#[cfg(feature = "with-syntex")] +pub fn expand_str(src: &str) -> Result { + let src = src.to_owned(); + + let expand_thread = move || { + syntex_registry().expand_str("", "", &src) + }; + + syntex::with_extra_stack(expand_thread) +} + +#[cfg(feature = "with-syntex")] +pub fn expand(src: S, dst: D) -> Result<(), syntex::Error> + where S: AsRef, + D: AsRef, +{ + let src = src.as_ref().to_owned(); + let dst = dst.as_ref().to_owned(); + + let expand_thread = move || { + syntex_registry().expand("", src, dst) + }; + + syntex::with_extra_stack(expand_thread) +} + +macro_rules! shim { + ($name:ident $pkg:ident :: $func:ident) => { + pub fn $func( + cx: &mut ::syntax::ext::base::ExtCtxt, + span: ::syntax::codemap::Span, + meta_item: &::syntax::ast::MetaItem, + annotatable: &::syntax::ext::base::Annotatable, + push: &mut FnMut(::syntax::ext::base::Annotatable) + ) { + let item = match *annotatable { + ::syntax::ext::base::Annotatable::Item(ref item) => item, + _ => { + cx.span_err( + meta_item.span, + concat!("`#[derive(", + stringify!($name), + ")]` may only be applied to structs and enums")); + return; + } + }; + + use syntax::{attr, ast, visit}; + struct MarkSerdeAttributesUsed; + impl<'a> visit::Visitor<'a> for MarkSerdeAttributesUsed { + fn visit_attribute(&mut self, attr: &ast::Attribute) { + if attr.value.name == "serde" { + if let ast::MetaItemKind::List(..) = attr.value.node { + attr::mark_used(attr); + } + } + } + } + visit::walk_item(&mut MarkSerdeAttributesUsed, item); + + use syntax::print::pprust; + let s = pprust::item_to_string(item); + + use {syn, $pkg}; + let syn_item = syn::parse_macro_input(&s).unwrap(); + let expanded = match $pkg::$func(&syn_item) { + Ok(expanded) => expanded.to_string(), + Err(msg) => { + cx.span_err(span, &msg); + return; + } + }; + + use syntax::parse; + let name = stringify!($name).to_string(); + let sess = cx.parse_sess; + let impl_item = parse::parse_item_from_source_str(name, expanded, sess); + push(::syntax::ext::base::Annotatable::Item(impl_item.unwrap().unwrap())); + } + }; +} + +#[cfg(feature = "with-syntex")] +mod shim { + shim!(Serialize ser::expand_derive_serialize); + shim!(Deserialize de::expand_derive_deserialize); +} + +#[cfg(feature = "with-syn")] +#[doc(hidden)] +/// Not public API. Use the serde_derive crate. +pub fn expand_derive_serialize(item: &str) -> Result { + let syn_item = syn::parse_macro_input(item).unwrap(); + ser::expand_derive_serialize(&syn_item) +} + +#[cfg(feature = "with-syn")] +#[doc(hidden)] +/// Not public API. Use the serde_derive crate. +pub fn expand_derive_deserialize(item: &str) -> Result { + let syn_item = syn::parse_macro_input(item).unwrap(); + de::expand_derive_deserialize(&syn_item) +} diff --git a/third_party/rust/serde_codegen/src/ser.rs b/third_party/rust/serde_codegen/src/ser.rs new file mode 100644 index 000000000000..65459abc2b73 --- /dev/null +++ b/third_party/rust/serde_codegen/src/ser.rs @@ -0,0 +1,570 @@ +use syn::{self, aster}; +use quote::Tokens; + +use bound; +use internals::ast::{Body, Field, Item, Style, Variant}; +use internals::{self, attr}; + +pub fn expand_derive_serialize(item: &syn::MacroInput) -> Result { + let ctxt = internals::Ctxt::new(); + let item = Item::from_ast(&ctxt, item); + try!(ctxt.check()); + + let impl_generics = build_impl_generics(&item); + + let ty = aster::ty().path() + .segment(item.ident.clone()).with_generics(impl_generics.clone()).build() + .build(); + + let body = serialize_body(&item, + &impl_generics, + ty.clone()); + + let where_clause = &impl_generics.where_clause; + + let dummy_const = aster::id(format!("_IMPL_SERIALIZE_FOR_{}", item.ident)); + + Ok(quote! { + #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] + const #dummy_const: () = { + extern crate serde as _serde; + #[automatically_derived] + impl #impl_generics _serde::ser::Serialize for #ty #where_clause { + fn serialize<__S>(&self, _serializer: &mut __S) -> ::std::result::Result<(), __S::Error> + where __S: _serde::ser::Serializer + { + #body + } + } + }; + }) +} + +// All the generics in the input, plus a bound `T: Serialize` for each generic +// field type that will be serialized by us. +fn build_impl_generics(item: &Item) -> syn::Generics { + let generics = bound::without_defaults(item.generics); + + let generics = bound::with_where_predicates_from_fields( + item, &generics, + |attrs| attrs.ser_bound()); + + match item.attrs.ser_bound() { + Some(predicates) => { + bound::with_where_predicates(&generics, predicates) + } + None => { + bound::with_bound(item, &generics, + needs_serialize_bound, + &aster::path().ids(&["_serde", "ser", "Serialize"]).build()) + } + } +} + +// Fields with a `skip_serializing` or `serialize_with` attribute are not +// serialized by us so we do not generate a bound. Fields with a `bound` +// attribute specify their own bound so we do not generate one. All other fields +// may need a `T: Serialize` bound where T is the type of the field. +fn needs_serialize_bound(attrs: &attr::Field) -> bool { + !attrs.skip_serializing() + && attrs.serialize_with().is_none() + && attrs.ser_bound().is_none() +} + +fn serialize_body( + item: &Item, + impl_generics: &syn::Generics, + ty: syn::Ty, +) -> Tokens { + match item.body { + Body::Enum(ref variants) => { + serialize_item_enum( + &item.ident, + impl_generics, + ty, + variants, + &item.attrs) + } + Body::Struct(Style::Struct, ref fields) => { + if fields.iter().any(|field| field.ident.is_none()) { + panic!("struct has unnamed fields"); + } + + serialize_struct( + impl_generics, + ty, + fields, + &item.attrs) + } + Body::Struct(Style::Tuple, ref fields) => { + if fields.iter().any(|field| field.ident.is_some()) { + panic!("tuple struct has named fields"); + } + + serialize_tuple_struct( + impl_generics, + ty, + fields, + &item.attrs) + } + Body::Struct(Style::Newtype, ref fields) => { + serialize_newtype_struct( + impl_generics, + ty, + &fields[0], + &item.attrs) + } + Body::Struct(Style::Unit, _) => { + serialize_unit_struct( + &item.attrs) + } + } +} + +fn serialize_unit_struct(item_attrs: &attr::Item) -> Tokens { + let type_name = item_attrs.name().serialize_name(); + + quote! { + _serializer.serialize_unit_struct(#type_name) + } +} + +fn serialize_newtype_struct( + impl_generics: &syn::Generics, + item_ty: syn::Ty, + field: &Field, + item_attrs: &attr::Item, +) -> Tokens { + let type_name = item_attrs.name().serialize_name(); + + let mut field_expr = quote!(&self.0); + if let Some(path) = field.attrs.serialize_with() { + field_expr = wrap_serialize_with( + &item_ty, impl_generics, field.ty, path, field_expr); + } + + quote! { + _serializer.serialize_newtype_struct(#type_name, #field_expr) + } +} + +fn serialize_tuple_struct( + impl_generics: &syn::Generics, + ty: syn::Ty, + fields: &[Field], + item_attrs: &attr::Item, +) -> Tokens { + let serialize_stmts = serialize_tuple_struct_visitor( + ty.clone(), + fields, + impl_generics, + false, + aster::id("serialize_tuple_struct_elt"), + ); + + let type_name = item_attrs.name().serialize_name(); + let len = serialize_stmts.len(); + let let_mut = mut_if(len > 0); + + quote! { + let #let_mut __serde_state = try!(_serializer.serialize_tuple_struct(#type_name, #len)); + #(#serialize_stmts)* + _serializer.serialize_tuple_struct_end(__serde_state) + } +} + +fn serialize_struct( + impl_generics: &syn::Generics, + ty: syn::Ty, + fields: &[Field], + item_attrs: &attr::Item, +) -> Tokens { + let serialize_fields = serialize_struct_visitor( + ty.clone(), + fields, + impl_generics, + false, + aster::id("serialize_struct_elt"), + ); + + let type_name = item_attrs.name().serialize_name(); + + let mut serialized_fields = fields.iter() + .filter(|&field| !field.attrs.skip_serializing()) + .peekable(); + + let let_mut = mut_if(serialized_fields.peek().is_some()); + + let len = serialized_fields + .map(|field| { + let ident = field.ident.clone().expect("struct has unnamed fields"); + let field_expr = quote!(&self.#ident); + + match field.attrs.skip_serializing_if() { + Some(path) => quote!(if #path(#field_expr) { 0 } else { 1 }), + None => quote!(1), + } + }) + .fold(quote!(0), |sum, expr| quote!(#sum + #expr)); + + quote! { + let #let_mut __serde_state = try!(_serializer.serialize_struct(#type_name, #len)); + #(#serialize_fields)* + _serializer.serialize_struct_end(__serde_state) + } +} + +fn serialize_item_enum( + type_ident: &syn::Ident, + impl_generics: &syn::Generics, + ty: syn::Ty, + variants: &[Variant], + item_attrs: &attr::Item, +) -> Tokens { + let arms: Vec<_> = + variants.iter() + .enumerate() + .map(|(variant_index, variant)| { + serialize_variant( + type_ident, + impl_generics, + ty.clone(), + variant, + variant_index, + item_attrs, + ) + }) + .collect(); + + quote! { + match *self { + #(#arms)* + } + } +} + +fn serialize_variant( + type_ident: &syn::Ident, + generics: &syn::Generics, + ty: syn::Ty, + variant: &Variant, + variant_index: usize, + item_attrs: &attr::Item, +) -> Tokens { + let type_name = item_attrs.name().serialize_name(); + + let variant_ident = variant.ident.clone(); + let variant_name = variant.attrs.name().serialize_name(); + + if variant.attrs.skip_serializing() { + let skipped_msg = format!("The enum variant {}::{} cannot be serialized", + type_ident, variant_ident); + let skipped_err = quote! { + Err(_serde::ser::Error::invalid_value(#skipped_msg)) + }; + let fields_pat = match variant.style { + Style::Unit => quote!(), + Style::Newtype | Style::Tuple => quote!( (..) ), + Style::Struct => quote!( {..} ), + }; + quote! { + #type_ident::#variant_ident #fields_pat => #skipped_err, + } + } else { // variant wasn't skipped + match variant.style { + Style::Unit => { + quote! { + #type_ident::#variant_ident => + _serde::ser::Serializer::serialize_unit_variant( + _serializer, + #type_name, + #variant_index, + #variant_name, + ), + } + }, + Style::Newtype => { + let block = serialize_newtype_variant( + type_name, + variant_index, + variant_name, + ty, + generics, + &variant.fields[0], + ); + + quote! { + #type_ident::#variant_ident(ref __simple_value) => #block, + } + }, + Style::Tuple => { + let field_names = (0 .. variant.fields.len()) + .map(|i| aster::id(format!("__field{}", i))); + + let block = serialize_tuple_variant( + type_name, + variant_index, + variant_name, + generics, + ty, + &variant.fields, + ); + + quote! { + #type_ident::#variant_ident(#(ref #field_names),*) => { #block } + } + } + Style::Struct => { + let fields = variant.fields.iter() + .map(|f| f.ident.clone().expect("struct variant has unnamed fields")); + + let block = serialize_struct_variant( + variant_index, + variant_name, + generics, + ty, + &variant.fields, + item_attrs, + ); + + quote! { + #type_ident::#variant_ident { #(ref #fields),* } => { #block } + } + } + } + } +} + +fn serialize_newtype_variant( + type_name: String, + variant_index: usize, + variant_name: String, + item_ty: syn::Ty, + generics: &syn::Generics, + field: &Field, +) -> Tokens { + let mut field_expr = quote!(__simple_value); + if let Some(path) = field.attrs.serialize_with() { + field_expr = wrap_serialize_with( + &item_ty, generics, field.ty, path, field_expr); + } + + quote! { + _serde::ser::Serializer::serialize_newtype_variant( + _serializer, + #type_name, + #variant_index, + #variant_name, + #field_expr, + ) + } +} + +fn serialize_tuple_variant( + type_name: String, + variant_index: usize, + variant_name: String, + generics: &syn::Generics, + structure_ty: syn::Ty, + fields: &[Field], +) -> Tokens { + let serialize_stmts = serialize_tuple_struct_visitor( + structure_ty, + fields, + generics, + true, + aster::id("serialize_tuple_variant_elt"), + ); + + let len = serialize_stmts.len(); + let let_mut = mut_if(len > 0); + + quote! { + let #let_mut __serde_state = try!(_serializer.serialize_tuple_variant( + #type_name, + #variant_index, + #variant_name, + #len)); + #(#serialize_stmts)* + _serializer.serialize_tuple_variant_end(__serde_state) + } +} + +fn serialize_struct_variant( + variant_index: usize, + variant_name: String, + generics: &syn::Generics, + ty: syn::Ty, + fields: &[Field], + item_attrs: &attr::Item, +) -> Tokens { + let serialize_fields = serialize_struct_visitor( + ty.clone(), + fields, + generics, + true, + aster::id("serialize_struct_variant_elt"), + ); + + let item_name = item_attrs.name().serialize_name(); + + let mut serialized_fields = fields.iter() + .filter(|&field| !field.attrs.skip_serializing()) + .peekable(); + + let let_mut = mut_if(serialized_fields.peek().is_some()); + + let len = serialized_fields + .map(|field| { + let ident = field.ident.clone().expect("struct has unnamed fields"); + + match field.attrs.skip_serializing_if() { + Some(path) => quote!(if #path(#ident) { 0 } else { 1 }), + None => quote!(1), + } + }) + .fold(quote!(0), |sum, expr| quote!(#sum + #expr)); + + quote! { + let #let_mut __serde_state = try!(_serializer.serialize_struct_variant( + #item_name, + #variant_index, + #variant_name, + #len, + )); + #(#serialize_fields)* + _serializer.serialize_struct_variant_end(__serde_state) + } +} + +fn serialize_tuple_struct_visitor( + structure_ty: syn::Ty, + fields: &[Field], + generics: &syn::Generics, + is_enum: bool, + func: syn::Ident, +) -> Vec { + fields.iter() + .enumerate() + .map(|(i, field)| { + let mut field_expr = if is_enum { + let id = aster::id(format!("__field{}", i)); + quote!(#id) + } else { + let i = aster::id(i); + quote!(&self.#i) + }; + + let skip = field.attrs.skip_serializing_if() + .map(|path| quote!(#path(#field_expr))); + + if let Some(path) = field.attrs.serialize_with() { + field_expr = wrap_serialize_with( + &structure_ty, generics, field.ty, path, field_expr); + } + + let ser = quote! { + try!(_serializer.#func(&mut __serde_state, #field_expr)); + }; + + match skip { + None => ser, + Some(skip) => quote!(if !#skip { #ser }), + } + }) + .collect() +} + +fn serialize_struct_visitor( + structure_ty: syn::Ty, + fields: &[Field], + generics: &syn::Generics, + is_enum: bool, + func: syn::Ident, +) -> Vec { + fields.iter() + .filter(|&field| !field.attrs.skip_serializing()) + .map(|field| { + let ident = field.ident.clone().expect("struct has unnamed field"); + let mut field_expr = if is_enum { + quote!(#ident) + } else { + quote!(&self.#ident) + }; + + let key_expr = field.attrs.name().serialize_name(); + + let skip = field.attrs.skip_serializing_if() + .map(|path| quote!(#path(#field_expr))); + + if let Some(path) = field.attrs.serialize_with() { + field_expr = wrap_serialize_with( + &structure_ty, generics, field.ty, path, field_expr) + } + + let ser = quote! { + try!(_serializer.#func(&mut __serde_state, #key_expr, #field_expr)); + }; + + match skip { + None => ser, + Some(skip) => quote!(if !#skip { #ser }), + } + }) + .collect() +} + +fn wrap_serialize_with( + item_ty: &syn::Ty, + generics: &syn::Generics, + field_ty: &syn::Ty, + path: &syn::Path, + value: Tokens, +) -> Tokens { + let where_clause = &generics.where_clause; + + let wrapper_generics = aster::from_generics(generics.clone()) + .add_lifetime_bound("'__a") + .lifetime_name("'__a") + .build(); + + let wrapper_ty = aster::path() + .segment("__SerializeWith") + .with_generics(wrapper_generics.clone()) + .build() + .build(); + + quote!({ + struct __SerializeWith #wrapper_generics #where_clause { + value: &'__a #field_ty, + phantom: ::std::marker::PhantomData<#item_ty>, + } + + impl #wrapper_generics _serde::ser::Serialize for #wrapper_ty #where_clause { + fn serialize<__S>(&self, __s: &mut __S) -> ::std::result::Result<(), __S::Error> + where __S: _serde::ser::Serializer + { + #path(self.value, __s) + } + } + + __SerializeWith { + value: #value, + phantom: ::std::marker::PhantomData::<#item_ty>, + } + }) +} + +// Serialization of an empty struct results in code like: +// +// let mut __serde_state = try!(serializer.serialize_struct("S", 0)); +// serializer.serialize_struct_end(__serde_state) +// +// where we want to omit the `mut` to avoid a warning. +fn mut_if(is_mut: bool) -> Option { + if is_mut { + Some(quote!(mut)) + } else { + None + } +} diff --git a/third_party/rust/serde_codegen_internals/.cargo-checksum.json b/third_party/rust/serde_codegen_internals/.cargo-checksum.json new file mode 100644 index 000000000000..036d08d69c6e --- /dev/null +++ b/third_party/rust/serde_codegen_internals/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"d95e5e29244853cb6c744f76f8829d6404fb517b69ea79c9b9f807ae0845c6c5","src/ast.rs":"0b96616b2becc71ac85ffb0efcf6c6d0b451c7e2e4934df19193962e7fc9316a","src/attr.rs":"f248f768cde166c5c9e2bb03335fc70148a0460e3434d3cb470ebb9ac41b3948","src/ctxt.rs":"80795ca96772fdef304584795966bbf28c24b788590c83e44efca3bb45a7d06a","src/lib.rs":"a5b9dae1488c7c50f5ed630bf473f5ca13d44f795faf380152fef10bfc7b9eee"},"package":"afad7924a009f859f380e4a2e3a509a845c2ac66435fcead74a4d983b21ae806"} \ No newline at end of file diff --git a/third_party/rust/serde_codegen_internals/.cargo-ok b/third_party/rust/serde_codegen_internals/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/serde_codegen_internals/Cargo.toml b/third_party/rust/serde_codegen_internals/Cargo.toml new file mode 100644 index 000000000000..f03cacd86fb1 --- /dev/null +++ b/third_party/rust/serde_codegen_internals/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "serde_codegen_internals" +version = "0.11.3" +authors = ["Erick Tryzelaar "] +license = "MIT/Apache-2.0" +description = "AST representation used by Serde codegen. Unstable." +homepage = "https://serde.rs" +repository = "https://github.com/serde-rs/serde" +documentation = "https://docs.serde.rs/serde_codegen_internals/" +keywords = ["serde", "serialization"] +include = ["Cargo.toml", "src/**/*.rs"] + +[features] +unstable-testing = ["clippy"] + +[dependencies] +clippy = { version = "^0.*", optional = true } +syn = "0.10" diff --git a/third_party/rust/serde_codegen_internals/src/ast.rs b/third_party/rust/serde_codegen_internals/src/ast.rs new file mode 100644 index 000000000000..2941c1641944 --- /dev/null +++ b/third_party/rust/serde_codegen_internals/src/ast.rs @@ -0,0 +1,116 @@ +use syn; +use attr; +use Ctxt; + +pub struct Item<'a> { + pub ident: syn::Ident, + pub attrs: attr::Item, + pub body: Body<'a>, + pub generics: &'a syn::Generics, +} + +pub enum Body<'a> { + Enum(Vec>), + Struct(Style, Vec>), +} + +pub struct Variant<'a> { + pub ident: syn::Ident, + pub attrs: attr::Variant, + pub style: Style, + pub fields: Vec>, +} + +pub struct Field<'a> { + pub ident: Option, + pub attrs: attr::Field, + pub ty: &'a syn::Ty, +} + +pub enum Style { + Struct, + Tuple, + Newtype, + Unit, +} + +impl<'a> Item<'a> { + pub fn from_ast(cx: &Ctxt, item: &'a syn::MacroInput) -> Item<'a> { + let attrs = attr::Item::from_ast(cx, item); + + let body = match item.body { + syn::Body::Enum(ref variants) => { + Body::Enum(enum_from_ast(cx, variants)) + } + syn::Body::Struct(ref variant_data) => { + let (style, fields) = struct_from_ast(cx, variant_data); + Body::Struct(style, fields) + } + }; + + Item { + ident: item.ident.clone(), + attrs: attrs, + body: body, + generics: &item.generics, + } + } +} + +impl<'a> Body<'a> { + pub fn all_fields(&'a self) -> Box> + 'a> { + match *self { + Body::Enum(ref variants) => { + Box::new(variants.iter() + .flat_map(|variant| variant.fields.iter())) + } + Body::Struct(_, ref fields) => { + Box::new(fields.iter()) + } + } + } +} + +fn enum_from_ast<'a>(cx: &Ctxt, variants: &'a [syn::Variant]) -> Vec> { + variants.iter() + .map(|variant| { + let (style, fields) = struct_from_ast(cx, &variant.data); + Variant { + ident: variant.ident.clone(), + attrs: attr::Variant::from_ast(cx, variant), + style: style, + fields: fields, + } + }) + .collect() +} + +fn struct_from_ast<'a>(cx: &Ctxt, data: &'a syn::VariantData) -> (Style, Vec>) { + match *data { + syn::VariantData::Struct(ref fields) => { + (Style::Struct, fields_from_ast(cx, fields)) + } + syn::VariantData::Tuple(ref fields) if fields.len() == 1 => { + (Style::Newtype, fields_from_ast(cx, fields)) + } + syn::VariantData::Tuple(ref fields) => { + (Style::Tuple, fields_from_ast(cx, fields)) + } + syn::VariantData::Unit => { + (Style::Unit, Vec::new()) + } + } +} + +fn fields_from_ast<'a>(cx: &Ctxt, fields: &'a [syn::Field]) -> Vec> { + fields.iter() + .enumerate() + .map(|(i, field)| { + Field { + ident: field.ident.clone(), + attrs: attr::Field::from_ast(cx, i, field), + ty: &field.ty, + } + }) + .collect() +} diff --git a/third_party/rust/serde_codegen_internals/src/attr.rs b/third_party/rust/serde_codegen_internals/src/attr.rs new file mode 100644 index 000000000000..632dd508db3c --- /dev/null +++ b/third_party/rust/serde_codegen_internals/src/attr.rs @@ -0,0 +1,543 @@ +use Ctxt; +use syn; +use syn::MetaItem::{List, NameValue, Word}; +use syn::NestedMetaItem::{Literal, MetaItem}; + +// This module handles parsing of `#[serde(...)]` attributes. The entrypoints +// are `attr::Item::from_ast`, `attr::Variant::from_ast`, and +// `attr::Field::from_ast`. Each returns an instance of the corresponding +// struct. Note that none of them return a Result. Unrecognized, malformed, or +// duplicated attributes result in a span_err but otherwise are ignored. The +// user will see errors simultaneously for all bad attributes in the crate +// rather than just the first. + +struct Attr<'c, T> { + cx: &'c Ctxt, + name: &'static str, + value: Option, +} + +impl<'c, T> Attr<'c, T> { + fn none(cx: &'c Ctxt, name: &'static str) -> Self { + Attr { + cx: cx, + name: name, + value: None, + } + } + + fn set(&mut self, value: T) { + if self.value.is_some() { + self.cx.error(format!("duplicate serde attribute `{}`", self.name)); + } else { + self.value = Some(value); + } + } + + fn set_opt(&mut self, value: Option) { + if let Some(value) = value { + self.set(value); + } + } + + fn set_if_none(&mut self, value: T) { + if self.value.is_none() { + self.value = Some(value); + } + } + + fn get(self) -> Option { + self.value + } +} + +struct BoolAttr<'c>(Attr<'c, ()>); + +impl<'c> BoolAttr<'c> { + fn none(cx: &'c Ctxt, name: &'static str) -> Self { + BoolAttr(Attr::none(cx, name)) + } + + fn set_true(&mut self) { + self.0.set(()); + } + + fn get(&self) -> bool { + self.0.value.is_some() + } +} + +#[derive(Debug)] +pub struct Name { + serialize: String, + deserialize: String, +} + +impl Name { + /// Return the container name for the container when serializing. + pub fn serialize_name(&self) -> String { + self.serialize.clone() + } + + /// Return the container name for the container when deserializing. + pub fn deserialize_name(&self) -> String { + self.deserialize.clone() + } +} + +/// Represents container (e.g. struct) attribute information +#[derive(Debug)] +pub struct Item { + name: Name, + deny_unknown_fields: bool, + ser_bound: Option>, + de_bound: Option>, +} + +impl Item { + /// Extract out the `#[serde(...)]` attributes from an item. + pub fn from_ast(cx: &Ctxt, item: &syn::MacroInput) -> Self { + let mut ser_name = Attr::none(cx, "rename"); + let mut de_name = Attr::none(cx, "rename"); + let mut deny_unknown_fields = BoolAttr::none(cx, "deny_unknown_fields"); + let mut ser_bound = Attr::none(cx, "bound"); + let mut de_bound = Attr::none(cx, "bound"); + + for meta_items in item.attrs.iter().filter_map(get_serde_meta_items) { + for meta_item in meta_items { + match meta_item { + // Parse `#[serde(rename="foo")]` + MetaItem(NameValue(ref name, ref lit)) if name == "rename" => { + if let Ok(s) = get_string_from_lit(cx, name.as_ref(), name.as_ref(), lit) { + ser_name.set(s.clone()); + de_name.set(s); + } + } + + // Parse `#[serde(rename(serialize="foo", deserialize="bar"))]` + MetaItem(List(ref name, ref meta_items)) if name == "rename" => { + if let Ok((ser, de)) = get_renames(cx, meta_items) { + ser_name.set_opt(ser); + de_name.set_opt(de); + } + } + + // Parse `#[serde(deny_unknown_fields)]` + MetaItem(Word(ref name)) if name == "deny_unknown_fields" => { + deny_unknown_fields.set_true(); + } + + // Parse `#[serde(bound="D: Serialize")]` + MetaItem(NameValue(ref name, ref lit)) if name == "bound" => { + if let Ok(where_predicates) = parse_lit_into_where(cx, name.as_ref(), name.as_ref(), lit) { + ser_bound.set(where_predicates.clone()); + de_bound.set(where_predicates); + } + } + + // Parse `#[serde(bound(serialize="D: Serialize", deserialize="D: Deserialize"))]` + MetaItem(List(ref name, ref meta_items)) if name == "bound" => { + if let Ok((ser, de)) = get_where_predicates(cx, meta_items) { + ser_bound.set_opt(ser); + de_bound.set_opt(de); + } + } + + MetaItem(ref meta_item) => { + cx.error(format!("unknown serde container attribute `{}`", + meta_item.name())); + } + + Literal(_) => { + cx.error(format!("unexpected literal in serde container attribute")); + } + } + } + } + + Item { + name: Name { + serialize: ser_name.get().unwrap_or_else(|| item.ident.to_string()), + deserialize: de_name.get().unwrap_or_else(|| item.ident.to_string()), + }, + deny_unknown_fields: deny_unknown_fields.get(), + ser_bound: ser_bound.get(), + de_bound: de_bound.get(), + } + } + + pub fn name(&self) -> &Name { + &self.name + } + + pub fn deny_unknown_fields(&self) -> bool { + self.deny_unknown_fields + } + + pub fn ser_bound(&self) -> Option<&[syn::WherePredicate]> { + self.ser_bound.as_ref().map(|vec| &vec[..]) + } + + pub fn de_bound(&self) -> Option<&[syn::WherePredicate]> { + self.de_bound.as_ref().map(|vec| &vec[..]) + } +} + +/// Represents variant attribute information +#[derive(Debug)] +pub struct Variant { + name: Name, + skip_deserializing: bool, + skip_serializing: bool, +} + +impl Variant { + pub fn from_ast(cx: &Ctxt, variant: &syn::Variant) -> Self { + let mut ser_name = Attr::none(cx, "rename"); + let mut de_name = Attr::none(cx, "rename"); + let mut skip_deserializing = BoolAttr::none(cx, "skip_deserializing"); + let mut skip_serializing = BoolAttr::none(cx, "skip_serializing"); + + for meta_items in variant.attrs.iter().filter_map(get_serde_meta_items) { + for meta_item in meta_items { + match meta_item { + // Parse `#[serde(rename="foo")]` + MetaItem(NameValue(ref name, ref lit)) if name == "rename" => { + if let Ok(s) = get_string_from_lit(cx, name.as_ref(), name.as_ref(), lit) { + ser_name.set(s.clone()); + de_name.set(s); + } + } + + // Parse `#[serde(rename(serialize="foo", deserialize="bar"))]` + MetaItem(List(ref name, ref meta_items)) if name == "rename" => { + if let Ok((ser, de)) = get_renames(cx, meta_items) { + ser_name.set_opt(ser); + de_name.set_opt(de); + } + } + // Parse `#[serde(skip_deserializing)]` + MetaItem(Word(ref name)) if name == "skip_deserializing" => { + skip_deserializing.set_true(); + } + // Parse `#[serde(skip_serializing)]` + MetaItem(Word(ref name)) if name == "skip_serializing" => { + skip_serializing.set_true(); + } + + MetaItem(ref meta_item) => { + cx.error(format!("unknown serde variant attribute `{}`", + meta_item.name())); + } + + Literal(_) => { + cx.error(format!("unexpected literal in serde variant attribute")); + } + } + } + } + + Variant { + name: Name { + serialize: ser_name.get().unwrap_or_else(|| variant.ident.to_string()), + deserialize: de_name.get().unwrap_or_else(|| variant.ident.to_string()), + }, + skip_deserializing: skip_deserializing.get(), + skip_serializing: skip_serializing.get(), + } + } + + pub fn name(&self) -> &Name { + &self.name + } + + pub fn skip_deserializing(&self) -> bool { + self.skip_deserializing + } + + pub fn skip_serializing(&self) -> bool { + self.skip_serializing + } +} + +/// Represents field attribute information +#[derive(Debug)] +pub struct Field { + name: Name, + skip_serializing: bool, + skip_deserializing: bool, + skip_serializing_if: Option, + default: FieldDefault, + serialize_with: Option, + deserialize_with: Option, + ser_bound: Option>, + de_bound: Option>, +} + +/// Represents the default to use for a field when deserializing. +#[derive(Debug, PartialEq)] +pub enum FieldDefault { + /// Field must always be specified because it does not have a default. + None, + /// The default is given by `std::default::Default::default()`. + Default, + /// The default is given by this function. + Path(syn::Path), +} + +impl Field { + /// Extract out the `#[serde(...)]` attributes from a struct field. + pub fn from_ast(cx: &Ctxt, + index: usize, + field: &syn::Field) -> Self { + let mut ser_name = Attr::none(cx, "rename"); + let mut de_name = Attr::none(cx, "rename"); + let mut skip_serializing = BoolAttr::none(cx, "skip_serializing"); + let mut skip_deserializing = BoolAttr::none(cx, "skip_deserializing"); + let mut skip_serializing_if = Attr::none(cx, "skip_serializing_if"); + let mut default = Attr::none(cx, "default"); + let mut serialize_with = Attr::none(cx, "serialize_with"); + let mut deserialize_with = Attr::none(cx, "deserialize_with"); + let mut ser_bound = Attr::none(cx, "bound"); + let mut de_bound = Attr::none(cx, "bound"); + + let ident = match field.ident { + Some(ref ident) => ident.to_string(), + None => index.to_string(), + }; + + for meta_items in field.attrs.iter().filter_map(get_serde_meta_items) { + for meta_item in meta_items { + match meta_item { + // Parse `#[serde(rename="foo")]` + MetaItem(NameValue(ref name, ref lit)) if name == "rename" => { + if let Ok(s) = get_string_from_lit(cx, name.as_ref(), name.as_ref(), lit) { + ser_name.set(s.clone()); + de_name.set(s); + } + } + + // Parse `#[serde(rename(serialize="foo", deserialize="bar"))]` + MetaItem(List(ref name, ref meta_items)) if name == "rename" => { + if let Ok((ser, de)) = get_renames(cx, meta_items) { + ser_name.set_opt(ser); + de_name.set_opt(de); + } + } + + // Parse `#[serde(default)]` + MetaItem(Word(ref name)) if name == "default" => { + default.set(FieldDefault::Default); + } + + // Parse `#[serde(default="...")]` + MetaItem(NameValue(ref name, ref lit)) if name == "default" => { + if let Ok(path) = parse_lit_into_path(cx, name.as_ref(), lit) { + default.set(FieldDefault::Path(path)); + } + } + + // Parse `#[serde(skip_serializing)]` + MetaItem(Word(ref name)) if name == "skip_serializing" => { + skip_serializing.set_true(); + } + + // Parse `#[serde(skip_deserializing)]` + MetaItem(Word(ref name)) if name == "skip_deserializing" => { + skip_deserializing.set_true(); + } + + // Parse `#[serde(skip_serializing_if="...")]` + MetaItem(NameValue(ref name, ref lit)) if name == "skip_serializing_if" => { + if let Ok(path) = parse_lit_into_path(cx, name.as_ref(), lit) { + skip_serializing_if.set(path); + } + } + + // Parse `#[serde(serialize_with="...")]` + MetaItem(NameValue(ref name, ref lit)) if name == "serialize_with" => { + if let Ok(path) = parse_lit_into_path(cx, name.as_ref(), lit) { + serialize_with.set(path); + } + } + + // Parse `#[serde(deserialize_with="...")]` + MetaItem(NameValue(ref name, ref lit)) if name == "deserialize_with" => { + if let Ok(path) = parse_lit_into_path(cx, name.as_ref(), lit) { + deserialize_with.set(path); + } + } + + // Parse `#[serde(bound="D: Serialize")]` + MetaItem(NameValue(ref name, ref lit)) if name == "bound" => { + if let Ok(where_predicates) = parse_lit_into_where(cx, name.as_ref(), name.as_ref(), lit) { + ser_bound.set(where_predicates.clone()); + de_bound.set(where_predicates); + } + } + + // Parse `#[serde(bound(serialize="D: Serialize", deserialize="D: Deserialize"))]` + MetaItem(List(ref name, ref meta_items)) if name == "bound" => { + if let Ok((ser, de)) = get_where_predicates(cx, meta_items) { + ser_bound.set_opt(ser); + de_bound.set_opt(de); + } + } + + MetaItem(ref meta_item) => { + cx.error(format!("unknown serde field attribute `{}`", + meta_item.name())); + } + + Literal(_) => { + cx.error(format!("unexpected literal in serde field attribute")); + } + } + } + } + + // Is skip_deserializing, initialize the field to Default::default() + // unless a different default is specified by `#[serde(default="...")]` + if skip_deserializing.0.value.is_some() { + default.set_if_none(FieldDefault::Default); + } + + Field { + name: Name { + serialize: ser_name.get().unwrap_or(ident.clone()), + deserialize: de_name.get().unwrap_or(ident), + }, + skip_serializing: skip_serializing.get(), + skip_deserializing: skip_deserializing.get(), + skip_serializing_if: skip_serializing_if.get(), + default: default.get().unwrap_or(FieldDefault::None), + serialize_with: serialize_with.get(), + deserialize_with: deserialize_with.get(), + ser_bound: ser_bound.get(), + de_bound: de_bound.get(), + } + } + + pub fn name(&self) -> &Name { + &self.name + } + + pub fn skip_serializing(&self) -> bool { + self.skip_serializing + } + + pub fn skip_deserializing(&self) -> bool { + self.skip_deserializing + } + + pub fn skip_serializing_if(&self) -> Option<&syn::Path> { + self.skip_serializing_if.as_ref() + } + + pub fn default(&self) -> &FieldDefault { + &self.default + } + + pub fn serialize_with(&self) -> Option<&syn::Path> { + self.serialize_with.as_ref() + } + + pub fn deserialize_with(&self) -> Option<&syn::Path> { + self.deserialize_with.as_ref() + } + + pub fn ser_bound(&self) -> Option<&[syn::WherePredicate]> { + self.ser_bound.as_ref().map(|vec| &vec[..]) + } + + pub fn de_bound(&self) -> Option<&[syn::WherePredicate]> { + self.de_bound.as_ref().map(|vec| &vec[..]) + } +} + +type SerAndDe = (Option, Option); + +fn get_ser_and_de( + cx: &Ctxt, + attr_name: &'static str, + items: &[syn::NestedMetaItem], + f: F +) -> Result, ()> + where F: Fn(&Ctxt, &str, &str, &syn::Lit) -> Result, +{ + let mut ser_item = Attr::none(cx, attr_name); + let mut de_item = Attr::none(cx, attr_name); + + for item in items { + match *item { + MetaItem(NameValue(ref name, ref lit)) if name == "serialize" => { + if let Ok(v) = f(cx, attr_name, name.as_ref(), lit) { + ser_item.set(v); + } + } + + MetaItem(NameValue(ref name, ref lit)) if name == "deserialize" => { + if let Ok(v) = f(cx, attr_name, name.as_ref(), lit) { + de_item.set(v); + } + } + + _ => { + cx.error(format!("malformed {0} attribute, expected `{0}(serialize = ..., deserialize = ...)`", + attr_name)); + return Err(()); + } + } + } + + Ok((ser_item.get(), de_item.get())) +} + +fn get_renames( + cx: &Ctxt, + items: &[syn::NestedMetaItem], +) -> Result, ()> { + get_ser_and_de(cx, "rename", items, get_string_from_lit) +} + +fn get_where_predicates( + cx: &Ctxt, + items: &[syn::NestedMetaItem], +) -> Result>, ()> { + get_ser_and_de(cx, "bound", items, parse_lit_into_where) +} + +pub fn get_serde_meta_items(attr: &syn::Attribute) -> Option> { + match attr.value { + List(ref name, ref items) if name == "serde" => { + Some(items.iter().cloned().collect()) + } + _ => None + } +} + +fn get_string_from_lit(cx: &Ctxt, attr_name: &str, meta_item_name: &str, lit: &syn::Lit) -> Result { + if let syn::Lit::Str(ref s, _) = *lit { + Ok(s.clone()) + } else { + cx.error(format!("expected serde {} attribute to be a string: `{} = \"...\"`", + attr_name, meta_item_name)); + Err(()) + } +} + +fn parse_lit_into_path(cx: &Ctxt, attr_name: &str, lit: &syn::Lit) -> Result { + let string = try!(get_string_from_lit(cx, attr_name, attr_name, lit)); + syn::parse_path(&string).map_err(|err| cx.error(err)) +} + +fn parse_lit_into_where(cx: &Ctxt, attr_name: &str, meta_item_name: &str, lit: &syn::Lit) -> Result, ()> { + let string = try!(get_string_from_lit(cx, attr_name, meta_item_name, lit)); + if string.is_empty() { + return Ok(Vec::new()); + } + + let where_string = format!("where {}", string); + + syn::parse_where_clause(&where_string).map(|wh| wh.predicates).map_err(|err| cx.error(err)) +} diff --git a/third_party/rust/serde_codegen_internals/src/ctxt.rs b/third_party/rust/serde_codegen_internals/src/ctxt.rs new file mode 100644 index 000000000000..a1455332cae2 --- /dev/null +++ b/third_party/rust/serde_codegen_internals/src/ctxt.rs @@ -0,0 +1,43 @@ +use std::fmt::Display; +use std::cell::RefCell; + +#[derive(Default)] +pub struct Ctxt { + errors: RefCell>>, +} + +impl Ctxt { + pub fn new() -> Self { + Ctxt { + errors: RefCell::new(Some(Vec::new())), + } + } + + pub fn error(&self, msg: T) { + self.errors.borrow_mut().as_mut().unwrap().push(msg.to_string()); + } + + pub fn check(self) -> Result<(), String> { + let mut errors = self.errors.borrow_mut().take().unwrap(); + match errors.len() { + 0 => Ok(()), + 1 => Err(errors.pop().unwrap()), + n => { + let mut msg = format!("{} errors:", n); + for err in errors { + msg.push_str("\n\t# "); + msg.push_str(&err); + } + Err(msg) + } + } + } +} + +impl Drop for Ctxt { + fn drop(&mut self) { + if self.errors.borrow().is_some() { + panic!("forgot to check for errors"); + } + } +} diff --git a/third_party/rust/serde_codegen_internals/src/lib.rs b/third_party/rust/serde_codegen_internals/src/lib.rs new file mode 100644 index 000000000000..0f37f5fa2df2 --- /dev/null +++ b/third_party/rust/serde_codegen_internals/src/lib.rs @@ -0,0 +1,10 @@ +#![cfg_attr(feature = "clippy", plugin(clippy))] +#![cfg_attr(feature = "clippy", feature(plugin))] + +extern crate syn; + +pub mod ast; +pub mod attr; + +mod ctxt; +pub use ctxt::Ctxt; diff --git a/third_party/rust/shared_library/.cargo-checksum.json b/third_party/rust/shared_library/.cargo-checksum.json new file mode 100644 index 000000000000..194870d0fd72 --- /dev/null +++ b/third_party/rust/shared_library/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"b9076e5a6d8b1a00602d4ebdfa145067428c1932032e0a86deecb0a1ffbcd5dc","Cargo.toml":"9a0d07a96946be5809263a7cd860c6a2bcb4b6c59ab867f374b6fded5b4003ef","src/dynamic_library.rs":"49bf9a598bf3b2df675d84a854b150638beddea11fdd1a2a8a9a3b42d012df76","src/lib.rs":"29f1aef9437d1ab891d17d6a6b86c6e1176813d372333cfdfc063b97586deb02"},"package":"fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a"} \ No newline at end of file diff --git a/third_party/rust/shared_library/.cargo-ok b/third_party/rust/shared_library/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/shared_library/.gitignore b/third_party/rust/shared_library/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/third_party/rust/shared_library/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/third_party/rust/shared_library/.travis.yml b/third_party/rust/shared_library/.travis.yml new file mode 100644 index 000000000000..9a8175dc30bf --- /dev/null +++ b/third_party/rust/shared_library/.travis.yml @@ -0,0 +1,15 @@ +language: rust + +after_success: + - | + [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + cargo publish --token ${CRATESIO_TOKEN} + - | + [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + cargo doc && + echo '' > target/doc/index.html && + git clone https://github.com/davisp/ghp-import && + ./ghp-import/ghp-import -n target/doc && + git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages diff --git a/third_party/rust/shared_library/Cargo.toml b/third_party/rust/shared_library/Cargo.toml new file mode 100644 index 000000000000..d75e00386e36 --- /dev/null +++ b/third_party/rust/shared_library/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "shared_library" +version = "0.1.5" +authors = ["Pierre Krieger "] +description = "Easily bind to and load shared libraries" +license = "Apache-2.0/MIT" +repository = "https://github.com/tomaka/shared_library/" + +[dependencies] +libc = "0.2" +lazy_static = "0.2" diff --git a/third_party/rust/shared_library/src/dynamic_library.rs b/third_party/rust/shared_library/src/dynamic_library.rs new file mode 100644 index 000000000000..e986edfab633 --- /dev/null +++ b/third_party/rust/shared_library/src/dynamic_library.rs @@ -0,0 +1,359 @@ +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Dynamic library facilities. +//! +//! A simple wrapper over the platform's dynamic library facilities + +#![allow(missing_docs)] + +use std::env; +use std::ffi::{CString, OsString}; +use std::mem; +use std::path::{Path, PathBuf}; + +pub struct DynamicLibrary { + handle: *mut u8 +} + +unsafe impl Send for DynamicLibrary {} +unsafe impl Sync for DynamicLibrary {} + +impl Drop for DynamicLibrary { + fn drop(&mut self) { + match dl::check_for_errors_in(|| { + unsafe { + dl::close(self.handle) + } + }) { + Ok(()) => {}, + Err(str) => panic!("{}", str) + } + } +} + +impl DynamicLibrary { + // FIXME (#12938): Until DST lands, we cannot decompose &str into + // & and str, so we cannot usefully take ToCStr arguments by + // reference (without forcing an additional & around &str). So we + // are instead temporarily adding an instance for &Path, so that + // we can take ToCStr as owned. When DST lands, the &Path instance + // should be removed, and arguments bound by ToCStr should be + // passed by reference. (Here: in the `open` method.) + + /// Lazily open a dynamic library. When passed None it gives a + /// handle to the calling process + pub fn open(filename: Option<&Path>) -> Result { + let maybe_library = dl::open(filename.map(|path| path.as_os_str())); + + // The dynamic library must not be constructed if there is + // an error opening the library so the destructor does not + // run. + match maybe_library { + Err(err) => Err(err), + Ok(handle) => Ok(DynamicLibrary { handle: handle }) + } + } + + /// Prepends a path to this process's search path for dynamic libraries + pub fn prepend_search_path(path: &Path) { + let mut search_path = DynamicLibrary::search_path(); + search_path.insert(0, path.to_path_buf()); + env::set_var(DynamicLibrary::envvar(), &DynamicLibrary::create_path(&search_path)); + } + + /// From a slice of paths, create a new vector which is suitable to be an + /// environment variable for this platforms dylib search path. + pub fn create_path(path: &[PathBuf]) -> OsString { + let mut newvar = OsString::new(); + for (i, path) in path.iter().enumerate() { + if i > 0 { newvar.push(DynamicLibrary::separator()); } + newvar.push(path); + } + return newvar; + } + + /// Returns the environment variable for this process's dynamic library + /// search path + pub fn envvar() -> &'static str { + if cfg!(windows) { + "PATH" + } else if cfg!(target_os = "macos") { + "DYLD_LIBRARY_PATH" + } else { + "LD_LIBRARY_PATH" + } + } + + fn separator() -> &'static str { + if cfg!(windows) { ";" } else { ":" } + } + + /// Returns the current search path for dynamic libraries being used by this + /// process + pub fn search_path() -> Vec { + match env::var_os(DynamicLibrary::envvar()) { + Some(var) => env::split_paths(&var).collect(), + None => Vec::new(), + } + } + + /// Access the value at the symbol of the dynamic library + pub unsafe fn symbol(&self, symbol: &str) -> Result<*mut T, String> { + // This function should have a lifetime constraint of 'a on + // T but that feature is still unimplemented + + let raw_string = CString::new(symbol).unwrap(); + let maybe_symbol_value = dl::check_for_errors_in(|| { + dl::symbol(self.handle, raw_string.as_ptr() as *const _) + }); + + // The value must not be constructed if there is an error so + // the destructor does not run. + match maybe_symbol_value { + Err(err) => Err(err), + Ok(symbol_value) => Ok(mem::transmute(symbol_value)) + } + } +} + +#[cfg(all(test, not(target_os = "ios")))] +mod test { + use super::*; + use libc; + use std::mem; + use std::path::Path; + + #[test] + #[cfg_attr(any(windows, target_os = "android"), ignore)] // FIXME #8818, #10379 + fn test_loading_cosine() { + // The math library does not need to be loaded since it is already + // statically linked in + let libm = match DynamicLibrary::open(None) { + Err(error) => panic!("Could not load self as module: {}", error), + Ok(libm) => libm + }; + + let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe { + match libm.symbol("cos") { + Err(error) => panic!("Could not load function cos: {}", error), + Ok(cosine) => mem::transmute::<*mut u8, _>(cosine) + } + }; + + let argument = 0.0; + let expected_result = 1.0; + let result = cosine(argument); + if result != expected_result { + panic!("cos({}) != {} but equaled {} instead", argument, + expected_result, result) + } + } + + #[test] + #[cfg(any(target_os = "linux", + target_os = "macos", + target_os = "freebsd", + target_os = "dragonfly", + target_os = "bitrig", + target_os = "openbsd"))] + fn test_errors_do_not_crash() { + // Open /dev/null as a library to get an error, and make sure + // that only causes an error, and not a crash. + let path = Path::new("/dev/null"); + match DynamicLibrary::open(Some(&path)) { + Err(_) => {} + Ok(_) => panic!("Successfully opened the empty library.") + } + } +} + +#[cfg(any(target_os = "linux", + target_os = "android", + target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "dragonfly", + target_os = "bitrig", + target_os = "openbsd", + target_os = "emscripten"))] +mod dl { + use std::ffi::{CString, CStr, OsStr}; + use std::os::unix::ffi::OsStrExt; + use std::str; + use libc; + use std::ptr; + use std::sync::Mutex; + + lazy_static! { + static ref LOCK: Mutex<()> = Mutex::new(()); + } + + pub fn open(filename: Option<&OsStr>) -> Result<*mut u8, String> { + check_for_errors_in(|| { + unsafe { + match filename { + Some(filename) => open_external(filename), + None => open_internal(), + } + } + }) + } + + const LAZY: libc::c_int = 1; + + unsafe fn open_external(filename: &OsStr) -> *mut u8 { + let s = CString::new(filename.as_bytes().to_vec()).unwrap(); + dlopen(s.as_ptr() as *const _, LAZY) as *mut u8 + } + + unsafe fn open_internal() -> *mut u8 { + dlopen(ptr::null(), LAZY) as *mut u8 + } + + pub fn check_for_errors_in(f: F) -> Result where + F: FnOnce() -> T, + { + unsafe { + // dlerror isn't thread safe, so we need to lock around this entire + // sequence + let _guard = LOCK.lock(); + let _old_error = dlerror(); + + let result = f(); + + let last_error = dlerror() as *const _; + let ret = if ptr::null() == last_error { + Ok(result) + } else { + let s = CStr::from_ptr(last_error).to_bytes(); + Err(str::from_utf8(s).unwrap().to_string()) + }; + + ret + } + } + + pub unsafe fn symbol(handle: *mut u8, + symbol: *const libc::c_char) -> *mut u8 { + dlsym(handle as *mut libc::c_void, symbol) as *mut u8 + } + pub unsafe fn close(handle: *mut u8) { + dlclose(handle as *mut libc::c_void); () + } + + extern { + fn dlopen(filename: *const libc::c_char, + flag: libc::c_int) -> *mut libc::c_void; + fn dlerror() -> *mut libc::c_char; + fn dlsym(handle: *mut libc::c_void, + symbol: *const libc::c_char) -> *mut libc::c_void; + fn dlclose(handle: *mut libc::c_void) -> libc::c_int; + } +} + +#[cfg(target_os = "windows")] +mod dl { + use std::ffi::OsStr; + use std::iter::Iterator; + use libc; + use std::ops::FnOnce; + use std::io::Error as IoError; + use std::os::windows::prelude::*; + use std::option::Option::{self, Some, None}; + use std::ptr; + use std::result::Result; + use std::result::Result::{Ok, Err}; + use std::string::String; + use std::vec::Vec; + + pub fn open(filename: Option<&OsStr>) -> Result<*mut u8, String> { + // disable "dll load failed" error dialog. + let prev_error_mode = unsafe { + // SEM_FAILCRITICALERRORS 0x01 + let new_error_mode = 1; + SetErrorMode(new_error_mode) + }; + + unsafe { + SetLastError(0); + } + + let result = match filename { + Some(filename) => { + let filename_str: Vec<_> = + filename.encode_wide().chain(Some(0).into_iter()).collect(); + let result = unsafe { + LoadLibraryW(filename_str.as_ptr() as *const libc::c_void) + }; + // beware: Vec/String may change errno during drop! + // so we get error here. + if result == ptr::null_mut() { + Err(format!("{}", IoError::last_os_error())) + } else { + Ok(result as *mut u8) + } + } + None => { + let mut handle = ptr::null_mut(); + let succeeded = unsafe { + GetModuleHandleExW(0, ptr::null(), &mut handle) + }; + if succeeded == 0 { + Err(format!("{}", IoError::last_os_error())) + } else { + Ok(handle as *mut u8) + } + } + }; + + unsafe { + SetErrorMode(prev_error_mode); + } + + result + } + + pub fn check_for_errors_in(f: F) -> Result where + F: FnOnce() -> T, + { + unsafe { + SetLastError(0); + + let result = f(); + + let error = IoError::last_os_error(); + if 0 == error.raw_os_error().unwrap() { + Ok(result) + } else { + Err(format!("{}", error)) + } + } + } + + pub unsafe fn symbol(handle: *mut u8, symbol: *const libc::c_char) -> *mut u8 { + GetProcAddress(handle as *mut libc::c_void, symbol) as *mut u8 + } + pub unsafe fn close(handle: *mut u8) { + FreeLibrary(handle as *mut libc::c_void); () + } + + #[allow(non_snake_case)] + extern "system" { + fn SetLastError(error: libc::size_t); + fn LoadLibraryW(name: *const libc::c_void) -> *mut libc::c_void; + fn GetModuleHandleExW(dwFlags: u32, name: *const u16, + handle: *mut *mut libc::c_void) -> i32; + fn GetProcAddress(handle: *mut libc::c_void, + name: *const libc::c_char) -> *mut libc::c_void; + fn FreeLibrary(handle: *mut libc::c_void); + fn SetErrorMode(uMode: libc::c_uint) -> libc::c_uint; + } +} diff --git a/third_party/rust/shared_library/src/lib.rs b/third_party/rust/shared_library/src/lib.rs new file mode 100644 index 000000000000..e698a47a968a --- /dev/null +++ b/third_party/rust/shared_library/src/lib.rs @@ -0,0 +1,175 @@ +extern crate libc; + +#[macro_use] +extern crate lazy_static; + +pub mod dynamic_library; + +/// Error that can happen while loading the shared library. +#[derive(Debug, Clone)] +pub enum LoadingError { + /// + LibraryNotFound { + descr: String, + }, + + /// One of the symbols could not be found in the library. + SymbolNotFound { + /// The symbol. + symbol: &'static str, + } +} + +#[macro_export] +macro_rules! shared_library { + ($struct_name:ident, pub $($rest:tt)+) => { + shared_library!(__impl $struct_name [] [] [] pub $($rest)+); + }; + + ($struct_name:ident, fn $($rest:tt)+) => { + shared_library!(__impl $struct_name [] [] [] fn $($rest)+); + }; + + ($struct_name:ident, static $($rest:tt)+) => { + shared_library!(__impl $struct_name [] [] [] static $($rest)+); + }; + + ($struct_name:ident, $def_path:expr, $($rest:tt)+) => { + shared_library!(__impl $struct_name [] [$def_path] [] $($rest)+); + }; + + (__impl $struct_name:ident + [$($p1:tt)*] [$($p2:tt)*] [$($p3:tt)*] + , $($rest:tt)* + ) => { + shared_library!(__impl $struct_name [$($p1)*] [$($p2)*] [$($p3)*] $($rest)*); + }; + + (__impl $struct_name:ident + [$($p1:tt)*] [$($p2:tt)*] [$($p3:tt)*] + pub $($rest:tt)* + ) => { + shared_library!(__impl $struct_name + [$($p1)*] [$($p2)*] [$($p3)* pub] $($rest)*); + }; + + (__impl $struct_name:ident + [$($p1:tt)*] [$($p2:tt)*] [$($p3:tt)*] + fn $name:ident($($p:ident:$ty:ty),*) -> $ret:ty, $($rest:tt)* + ) => { + shared_library!(__impl $struct_name + [$($p1)*, $name:unsafe extern fn($($p:$ty),*) -> $ret] + [$($p2)*] + [$($p3)* + unsafe fn $name($($p:$ty),*) -> $ret { + #![allow(dead_code)] + ($struct_name::get_static_ref().$name)($($p),*) + } + ] $($rest)*); + }; + + (__impl $struct_name:ident + [$($p1:tt)*] [$($p2:tt)*] [$($p3:tt)*] + static $name:ident:$ty:ty, $($rest:tt)* + ) => { + shared_library!(__impl $struct_name + [$($p1)*, $name: $ty] + [$($p2)*] + [$($p3)*] $($rest)*); + }; + + (__impl $struct_name:ident + [$($p1:tt)*] [$($p2:tt)*] [$($p3:tt)*] + fn $name:ident($($p:ident:$ty:ty),*), $($rest:tt)* + ) => { + shared_library!(__impl $struct_name + [$($p1)*] [$($p2)*] [$($p3)*] + fn $name($($p:$ty),*) -> (), $($rest)*); + }; + + (__impl $struct_name:ident [$(,$mem_n:ident:$mem_t:ty)+] [$($p2:tt)*] [$($p3:tt)*]) => { + /// Symbols loaded from a shared library. + #[allow(non_snake_case)] + pub struct $struct_name { + _library_guard: $crate::dynamic_library::DynamicLibrary, + $( + pub $mem_n: $mem_t, + )+ + } + + impl $struct_name { + /// Tries to open the dynamic library. + #[allow(non_snake_case)] + pub fn open(path: &::std::path::Path) -> Result<$struct_name, $crate::LoadingError> { + use std::mem; + + let dylib = match $crate::dynamic_library::DynamicLibrary::open(Some(path)) { + Ok(l) => l, + Err(reason) => return Err($crate::LoadingError::LibraryNotFound { descr: reason }) + }; + + $( + let $mem_n: *mut () = match unsafe { dylib.symbol(stringify!($mem_n)) } { + Ok(s) => s, + Err(_) => return Err($crate::LoadingError::SymbolNotFound { symbol: stringify!($mem_n) }), + }; + )+ + + Ok($struct_name { + _library_guard: dylib, + $( + $mem_n: unsafe { mem::transmute($mem_n) }, + )+ + }) + } + } + + shared_library!(__write_static_fns $struct_name [] [$($p2)*] [$($p3)*]); + }; + + (__write_static_fns $struct_name:ident [$($p1:tt)*] [] [$($p3:tt)*]) => { + }; + + (__write_static_fns $struct_name:ident [$($p1:tt)*] [$defpath:expr] [$($standalones:item)+]) => { + impl $struct_name { + /// This function is used by the regular functions. + fn get_static_ref() -> &'static $struct_name { + $struct_name::try_loading().ok() + .expect(concat!("Could not open dynamic \ + library `", stringify!($struct_name), + "`")) + } + + /// Try loading the static symbols linked to this library. + pub fn try_loading() -> Result<&'static $struct_name, $crate::LoadingError> { + use std::sync::{Mutex, Once, ONCE_INIT}; + use std::mem; + + unsafe { + static mut DATA: *const Mutex> = 0 as *const _; + + static mut INIT: Once = ONCE_INIT; + INIT.call_once(|| { + let data = Box::new(Mutex::new(None)); + DATA = &*data; + mem::forget(data); + }); + + let data: &Mutex> = &*DATA; + let mut data = data.lock().unwrap(); + + if let Some(ref data) = *data { + return Ok(mem::transmute(data)); + } + + let path = ::std::path::Path::new($defpath); + let result = try!($struct_name::open(path)); + *data = Some(result); + Ok(mem::transmute(data.as_ref().unwrap())) + } + } + } + + $($standalones)+ + }; +} diff --git a/third_party/rust/syn/.cargo-checksum.json b/third_party/rust/syn/.cargo-checksum.json new file mode 100644 index 000000000000..52af60b710d4 --- /dev/null +++ b/third_party/rust/syn/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"c1650ed29ad7cb01e5da2e0efd299062cd38272d0dc971f8f8f5979a0aaadd4c","src/aster/generics.rs":"77eb19443af0dff5debb18d064733cc8721a42ad7e993a33352cdeff2b5f9f85","src/aster/ident.rs":"e9d082664f008a56bd854011310b4258ab072740ba82e57495b6e8a868a5f36b","src/aster/invoke.rs":"2b1b993973ab4f5c8fa6d6a286576b2542edce21fe9904f5133c470c072e6d3f","src/aster/lifetime.rs":"d83f4c1a48e3580caa028cfabde6ace232efc95d70af6dc9cfcca48317db9ad7","src/aster/mod.rs":"12220f73b0021e72b4c50f6a513cff174b9c7267209aa23f183043d96ccc9ab7","src/aster/path.rs":"60865b0f952077307c1a66810a4b6dafde43e76a417a433a8343960e7de474e4","src/aster/qpath.rs":"885c94b29ab8ee45c72a682221e241d1f0dd09c659809fe77279b5dd8a4bc645","src/aster/ty.rs":"90649aad98617c09ffc43a38aeb823a3298c41bf5e10f0ef3500b71c81021c2f","src/aster/ty_param.rs":"7ced1e6ca0c98ef468d507d3f07bfcb1171395cd66ff5c3e1b091fe7e8b9a562","src/aster/where_predicate.rs":"5fb8ec3fcb67bcc1d9bb7b64cf2f5beb601aac6502d6db30c0cdf8641fa248d1","src/attr.rs":"2ba436bdd439511be10baf9ad45226ade678176a7fd45a087367e1ad2b43e07a","src/constant.rs":"90535a2320e0dc8ab623a9bffa770bdf697baef2884a7d9224b31daf422ea5a0","src/data.rs":"0119c67821f846e67d792bea638ae7f7f5d7e2f5e5a0c145d8ba8766d6ddb0f9","src/escape.rs":"e035b1f6ce3255e868fddb62ee90a95a2f3caf2db73786a2b179b92e9e337539","src/expr.rs":"1e8b194f213e3279c0cb414f450ebab78c657951b8c2abf97378e745467ca8f5","src/generics.rs":"a300acff4c6e61d2fe9344db23f5e176e7abb02529bc348d9180f41ad0a4caf6","src/helper.rs":"9693d5c78f2d627a90d689a5d4bee1061eddcb646ae6dff3b2e4fd7cfbb33845","src/ident.rs":"83142b0107baba3137aad3b7d5c7b468ab53bf837bd9544d117d6644080d2705","src/item.rs":"5f7ba91d7642612ddaba9e862695234f4fdda88009f83ad5dee8ac6180a4f08d","src/krate.rs":"324073a42389eb1c26a9d0f325b4f1cdd37d00a9bcaf07fdee77af54909a452d","src/lib.rs":"2e1c12a937ed5c0f80620f4166463fed8119f0620c2b984ccd484b30ed3ee71c","src/lit.rs":"2615fc6041f11b67a7cd62012f36eb215fd1fdf6649b6b64d728625148f53c7b","src/mac.rs":"b7f7f67f6e7830b9dc2fd7fb4996c6821937687c44d2fbdc34ecc89e43815eff","src/macro_input.rs":"93b999877879076e1f47502d96aa18aad82117d072044ca9de825c8a9bfa60b8","src/nom.rs":"e877f3492633186e6499775c9bfa58c2554c25d8a6467ee1567d13706386b4c3","src/op.rs":"232f84ba605ed50e70ee02169dd551548872135cf56f155637917ec3bf810ce1","src/registry.rs":"b709f2a0f372efd8dec8fd46d6d71fb3b56a0261789e6de048a41a5e70144421","src/space.rs":"de9cb71e831c1d66f0bf2f3f219c3455d1979ca89f89b198d3b324e0cd50faf8","src/ty.rs":"d5562321530c739d7b25324463a94f685837824333ec7d604aefbd782f9ec2fb","src/visit.rs":"d3133ff25aa9cc8e6ec15f579bfa753a264518b0a7de2f2be4586d49632a9aac"},"package":"e5aaf7e4a0f90d7285445c881dcc28f1a510e4962b4ffcdde17f5775b2960df6"} \ No newline at end of file diff --git a/third_party/rust/syn/.cargo-ok b/third_party/rust/syn/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/syn/Cargo.toml b/third_party/rust/syn/Cargo.toml new file mode 100644 index 000000000000..9e90ba1e7723 --- /dev/null +++ b/third_party/rust/syn/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "syn" +version = "0.10.7" # don't forget to update version in readme for breaking changes +authors = ["David Tolnay "] +license = "MIT/Apache-2.0" +description = "Nom parser for Rust source code" +repository = "https://github.com/dtolnay/syn" +documentation = "https://dtolnay.github.io/syn/syn/" +include = ["Cargo.toml", "src/**/*.rs"] + +[features] +default = ["parsing", "printing"] +aster = [] +expand = ["full", "parsing", "printing"] +full = ["type-macros"] +parsing = ["unicode-xid"] +pretty = ["syntex_syntax"] +printing = ["quote"] +type-macros = [] +visit = [] + +[dependencies] +clippy = { version = "0.*", optional = true } +quote = { version = "0.3.0", optional = true } +syntex_syntax = { version = "0.52.0", optional = true } +unicode-xid = { version = "0.0.4", optional = true } + +[dev-dependencies] +syntex_pos = "0.52.0" +syntex_syntax = "0.52.0" +tempdir = "0.3.5" +time = "0.1.35" +walkdir = "1.0.1" diff --git a/third_party/rust/syn/src/aster/generics.rs b/third_party/rust/syn/src/aster/generics.rs new file mode 100644 index 000000000000..8feb87cf013f --- /dev/null +++ b/third_party/rust/syn/src/aster/generics.rs @@ -0,0 +1,233 @@ +use {Generics, Ident, LifetimeDef, TyParam, WhereClause, WherePredicate}; +use aster::invoke::{Identity, Invoke}; +use aster::lifetime::{IntoLifetime, LifetimeDefBuilder, IntoLifetimeDef}; +use aster::path::IntoPath; +use aster::ty_param::TyParamBuilder; +use aster::where_predicate::WherePredicateBuilder; + +pub struct GenericsBuilder { + callback: F, + lifetimes: Vec, + ty_params: Vec, + predicates: Vec, +} + +impl GenericsBuilder { + pub fn new() -> Self { + GenericsBuilder::with_callback(Identity) + } + + pub fn from_generics(generics: Generics) -> Self { + GenericsBuilder::from_generics_with_callback(generics, Identity) + } +} + +impl GenericsBuilder + where F: Invoke +{ + pub fn with_callback(callback: F) -> Self { + GenericsBuilder { + callback: callback, + lifetimes: Vec::new(), + ty_params: Vec::new(), + predicates: Vec::new(), + } + } + + pub fn from_generics_with_callback(generics: Generics, callback: F) -> Self { + GenericsBuilder { + callback: callback, + lifetimes: generics.lifetimes, + ty_params: generics.ty_params, + predicates: generics.where_clause.predicates, + } + } + + pub fn with(self, generics: Generics) -> Self { + self.with_lifetimes(generics.lifetimes.into_iter()) + .with_ty_params(generics.ty_params.into_iter()) + .with_predicates(generics.where_clause.predicates.into_iter()) + } + + pub fn with_lifetimes(mut self, iter: I) -> Self + where I: IntoIterator, + L: IntoLifetimeDef + { + let iter = iter.into_iter().map(|lifetime_def| lifetime_def.into_lifetime_def()); + self.lifetimes.extend(iter); + self + } + + pub fn with_lifetime_names(mut self, iter: I) -> Self + where I: IntoIterator, + N: Into + { + for name in iter { + self = self.lifetime_name(name); + } + self + } + + pub fn with_lifetime(mut self, lifetime: LifetimeDef) -> Self { + self.lifetimes.push(lifetime); + self + } + + pub fn lifetime_name(self, name: N) -> Self + where N: Into + { + self.lifetime(name).build() + } + + pub fn lifetime(self, name: N) -> LifetimeDefBuilder + where N: Into + { + LifetimeDefBuilder::with_callback(name, self) + } + + pub fn with_ty_params(mut self, iter: I) -> Self + where I: IntoIterator + { + self.ty_params.extend(iter); + self + } + + pub fn with_ty_param_ids(mut self, iter: I) -> Self + where I: IntoIterator, + T: Into + { + for id in iter { + self = self.ty_param_id(id); + } + self + } + + pub fn with_ty_param(mut self, ty_param: TyParam) -> Self { + self.ty_params.push(ty_param); + self + } + + pub fn ty_param_id(self, id: I) -> Self + where I: Into + { + self.ty_param(id).build() + } + + pub fn ty_param(self, id: I) -> TyParamBuilder + where I: Into + { + TyParamBuilder::with_callback(id, self) + } + + pub fn with_predicates(mut self, iter: I) -> Self + where I: IntoIterator + { + self.predicates.extend(iter); + self + } + + pub fn with_predicate(mut self, predicate: WherePredicate) -> Self { + self.predicates.push(predicate); + self + } + + pub fn predicate(self) -> WherePredicateBuilder { + WherePredicateBuilder::with_callback(self) + } + + pub fn add_lifetime_bound(mut self, lifetime: L) -> Self + where L: IntoLifetime + { + let lifetime = lifetime.into_lifetime(); + + for lifetime_def in &mut self.lifetimes { + lifetime_def.bounds.push(lifetime.clone()); + } + + for ty_param in &mut self.ty_params { + *ty_param = TyParamBuilder::from_ty_param(ty_param.clone()) + .lifetime_bound(lifetime.clone()) + .build(); + } + + self + } + + pub fn add_ty_param_bound

(mut self, path: P) -> Self + where P: IntoPath + { + let path = path.into_path(); + + for ty_param in &mut self.ty_params { + *ty_param = TyParamBuilder::from_ty_param(ty_param.clone()) + .trait_bound(path.clone()) + .build() + .build(); + } + + self + } + + pub fn strip_bounds(self) -> Self { + self.strip_lifetimes() + .strip_ty_params() + .strip_predicates() + } + + pub fn strip_lifetimes(mut self) -> Self { + for lifetime in &mut self.lifetimes { + lifetime.bounds = vec![]; + } + self + } + + pub fn strip_ty_params(mut self) -> Self { + for ty_param in &mut self.ty_params { + ty_param.bounds = vec![]; + } + self + } + + pub fn strip_predicates(mut self) -> Self { + self.predicates = vec![]; + self + } + + pub fn build(self) -> F::Result { + self.callback.invoke(Generics { + lifetimes: self.lifetimes, + ty_params: self.ty_params, + where_clause: WhereClause { predicates: self.predicates }, + }) + } +} + +impl Invoke for GenericsBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, lifetime: LifetimeDef) -> Self { + self.with_lifetime(lifetime) + } +} + +impl Invoke for GenericsBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, ty_param: TyParam) -> Self { + self.with_ty_param(ty_param) + } +} + +impl Invoke for GenericsBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, predicate: WherePredicate) -> Self { + self.with_predicate(predicate) + } +} diff --git a/third_party/rust/syn/src/aster/ident.rs b/third_party/rust/syn/src/aster/ident.rs new file mode 100644 index 000000000000..0c2473fae5dc --- /dev/null +++ b/third_party/rust/syn/src/aster/ident.rs @@ -0,0 +1,39 @@ +use Ident; + +pub trait ToIdent { + fn to_ident(&self) -> Ident; +} + +impl ToIdent for Ident { + fn to_ident(&self) -> Ident { + self.clone() + } +} + +impl<'a> ToIdent for &'a str { + fn to_ident(&self) -> Ident { + (**self).into() + } +} + +impl ToIdent for String { + fn to_ident(&self) -> Ident { + self.clone().into() + } +} + +impl<'a, T> ToIdent for &'a T + where T: ToIdent +{ + fn to_ident(&self) -> Ident { + (**self).to_ident() + } +} + +impl<'a, T> ToIdent for &'a mut T + where T: ToIdent +{ + fn to_ident(&self) -> Ident { + (**self).to_ident() + } +} diff --git a/third_party/rust/syn/src/aster/invoke.rs b/third_party/rust/syn/src/aster/invoke.rs new file mode 100644 index 000000000000..76ae96757c52 --- /dev/null +++ b/third_party/rust/syn/src/aster/invoke.rs @@ -0,0 +1,16 @@ +pub trait Invoke { + type Result; + + fn invoke(self, arg: A) -> Self::Result; +} + +#[derive(Copy, Clone)] +pub struct Identity; + +impl Invoke for Identity { + type Result = A; + + fn invoke(self, arg: A) -> A { + arg + } +} diff --git a/third_party/rust/syn/src/aster/lifetime.rs b/third_party/rust/syn/src/aster/lifetime.rs new file mode 100644 index 000000000000..49df4a0d4835 --- /dev/null +++ b/third_party/rust/syn/src/aster/lifetime.rs @@ -0,0 +1,103 @@ +use {Ident, Lifetime, LifetimeDef}; +use aster::invoke::{Invoke, Identity}; + +// //////////////////////////////////////////////////////////////////////////// + +pub trait IntoLifetime { + fn into_lifetime(self) -> Lifetime; +} + +impl IntoLifetime for Lifetime { + fn into_lifetime(self) -> Lifetime { + self + } +} + +impl<'a> IntoLifetime for &'a str { + fn into_lifetime(self) -> Lifetime { + Lifetime { ident: self.into() } + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub trait IntoLifetimeDef { + fn into_lifetime_def(self) -> LifetimeDef; +} + +impl IntoLifetimeDef for LifetimeDef { + fn into_lifetime_def(self) -> LifetimeDef { + self + } +} + +impl IntoLifetimeDef for Lifetime { + fn into_lifetime_def(self) -> LifetimeDef { + LifetimeDef { + attrs: vec![], + lifetime: self, + bounds: vec![], + } + } +} + +impl<'a> IntoLifetimeDef for &'a str { + fn into_lifetime_def(self) -> LifetimeDef { + self.into_lifetime().into_lifetime_def() + } +} + +impl IntoLifetimeDef for String { + fn into_lifetime_def(self) -> LifetimeDef { + (*self).into_lifetime().into_lifetime_def() + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct LifetimeDefBuilder { + callback: F, + lifetime: Lifetime, + bounds: Vec, +} + +impl LifetimeDefBuilder { + pub fn new(name: N) -> Self + where N: Into + { + LifetimeDefBuilder::with_callback(name, Identity) + } +} + +impl LifetimeDefBuilder + where F: Invoke +{ + pub fn with_callback(name: N, callback: F) -> Self + where N: Into + { + let lifetime = Lifetime { ident: name.into() }; + + LifetimeDefBuilder { + callback: callback, + lifetime: lifetime, + bounds: Vec::new(), + } + } + + pub fn bound(mut self, name: N) -> Self + where N: Into + { + let lifetime = Lifetime { ident: name.into() }; + + self.bounds.push(lifetime); + self + } + + pub fn build(self) -> F::Result { + self.callback.invoke(LifetimeDef { + attrs: vec![], + lifetime: self.lifetime, + bounds: self.bounds, + }) + } +} diff --git a/third_party/rust/syn/src/aster/mod.rs b/third_party/rust/syn/src/aster/mod.rs new file mode 100644 index 000000000000..9e30e2289c6b --- /dev/null +++ b/third_party/rust/syn/src/aster/mod.rs @@ -0,0 +1,33 @@ +use super::*; + +pub mod generics; +pub mod ident; +pub mod invoke; +pub mod lifetime; +pub mod path; +pub mod qpath; +pub mod ty; +pub mod ty_param; +pub mod where_predicate; + +pub fn id(id: I) -> Ident + where I: Into +{ + id.into() +} + +pub fn from_generics(generics: Generics) -> generics::GenericsBuilder { + generics::GenericsBuilder::from_generics(generics) +} + +pub fn where_predicate() -> where_predicate::WherePredicateBuilder { + where_predicate::WherePredicateBuilder::new() +} + +pub fn ty() -> ty::TyBuilder { + ty::TyBuilder::new() +} + +pub fn path() -> path::PathBuilder { + path::PathBuilder::new() +} diff --git a/third_party/rust/syn/src/aster/path.rs b/third_party/rust/syn/src/aster/path.rs new file mode 100644 index 000000000000..a0fb314384ec --- /dev/null +++ b/third_party/rust/syn/src/aster/path.rs @@ -0,0 +1,331 @@ +use {AngleBracketedParameterData, Generics, Ident, Lifetime, ParenthesizedParameterData, Path, + PathParameters, PathSegment, Ty, TypeBinding}; +use aster::ident::ToIdent; +use aster::invoke::{Invoke, Identity}; +use aster::lifetime::IntoLifetime; +use aster::ty::TyBuilder; + +// //////////////////////////////////////////////////////////////////////////// + +pub trait IntoPath { + fn into_path(self) -> Path; +} + +impl IntoPath for Path { + fn into_path(self) -> Path { + self + } +} + +impl IntoPath for Ident { + fn into_path(self) -> Path { + PathBuilder::new().id(self).build() + } +} + +impl<'a> IntoPath for &'a str { + fn into_path(self) -> Path { + PathBuilder::new().id(self).build() + } +} + +impl IntoPath for String { + fn into_path(self) -> Path { + (&*self).into_path() + } +} + +impl<'a, T> IntoPath for &'a [T] + where T: ToIdent +{ + fn into_path(self) -> Path { + PathBuilder::new().ids(self).build() + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct PathBuilder { + callback: F, + global: bool, +} + +impl PathBuilder { + pub fn new() -> Self { + PathBuilder::with_callback(Identity) + } +} + +impl PathBuilder + where F: Invoke +{ + pub fn with_callback(callback: F) -> Self { + PathBuilder { + callback: callback, + global: false, + } + } + + pub fn build(self, path: Path) -> F::Result { + self.callback.invoke(path) + } + + pub fn global(mut self) -> Self { + self.global = true; + self + } + + pub fn ids(self, ids: I) -> PathSegmentsBuilder + where I: IntoIterator, + T: ToIdent + { + let mut ids = ids.into_iter(); + let id = ids.next().expect("passed path with no id"); + + self.id(id).ids(ids) + } + + pub fn id(self, id: I) -> PathSegmentsBuilder + where I: ToIdent + { + self.segment(id).build() + } + + pub fn segment(self, id: I) -> PathSegmentBuilder> + where I: ToIdent + { + PathSegmentBuilder::with_callback(id, + PathSegmentsBuilder { + callback: self.callback, + global: self.global, + segments: Vec::new(), + }) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct PathSegmentsBuilder { + callback: F, + global: bool, + segments: Vec, +} + +impl PathSegmentsBuilder + where F: Invoke +{ + pub fn ids(mut self, ids: I) -> PathSegmentsBuilder + where I: IntoIterator, + T: ToIdent + { + for id in ids { + self = self.id(id); + } + + self + } + + pub fn id(self, id: T) -> PathSegmentsBuilder + where T: ToIdent + { + self.segment(id).build() + } + + pub fn segment(self, id: T) -> PathSegmentBuilder + where T: ToIdent + { + PathSegmentBuilder::with_callback(id, self) + } + + pub fn build(self) -> F::Result { + self.callback.invoke(Path { + global: self.global, + segments: self.segments, + }) + } +} + +impl Invoke for PathSegmentsBuilder { + type Result = Self; + + fn invoke(mut self, segment: PathSegment) -> Self { + self.segments.push(segment); + self + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct PathSegmentBuilder { + callback: F, + id: Ident, + lifetimes: Vec, + tys: Vec, + bindings: Vec, +} + +impl PathSegmentBuilder + where F: Invoke +{ + pub fn with_callback(id: I, callback: F) -> Self + where I: ToIdent + { + PathSegmentBuilder { + callback: callback, + id: id.to_ident(), + lifetimes: Vec::new(), + tys: Vec::new(), + bindings: Vec::new(), + } + } + + pub fn with_generics(self, generics: Generics) -> Self { + // Strip off the bounds. + let lifetimes = generics.lifetimes + .iter() + .map(|lifetime_def| lifetime_def.lifetime.clone()); + + let tys = generics.ty_params + .iter() + .map(|ty_param| TyBuilder::new().id(ty_param.ident.clone())); + + self.with_lifetimes(lifetimes) + .with_tys(tys) + } + + pub fn with_lifetimes(mut self, iter: I) -> Self + where I: IntoIterator, + L: IntoLifetime + { + let iter = iter.into_iter().map(|lifetime| lifetime.into_lifetime()); + self.lifetimes.extend(iter); + self + } + + pub fn with_lifetime(mut self, lifetime: L) -> Self + where L: IntoLifetime + { + self.lifetimes.push(lifetime.into_lifetime()); + self + } + + pub fn lifetime(self, name: N) -> Self + where N: ToIdent + { + let lifetime = Lifetime { ident: name.to_ident() }; + self.with_lifetime(lifetime) + } + + pub fn with_tys(mut self, iter: I) -> Self + where I: IntoIterator + { + self.tys.extend(iter); + self + } + + pub fn with_ty(mut self, ty: Ty) -> Self { + self.tys.push(ty); + self + } + + pub fn ty(self) -> TyBuilder { + TyBuilder::with_callback(self) + } + + pub fn with_binding(mut self, binding: TypeBinding) -> Self { + self.bindings.push(binding); + self + } + + pub fn binding(self, id: T) -> TyBuilder> + where T: ToIdent + { + TyBuilder::with_callback(TypeBindingBuilder { + id: id.to_ident(), + builder: self, + }) + } + + pub fn no_return(self) -> F::Result { + self.build_return(None) + } + + pub fn return_(self) -> TyBuilder> { + TyBuilder::with_callback(PathSegmentReturnBuilder(self)) + } + + pub fn build_return(self, output: Option) -> F::Result { + let data = ParenthesizedParameterData { + inputs: self.tys, + output: output, + }; + + let parameters = PathParameters::Parenthesized(data); + + self.callback.invoke(PathSegment { + ident: self.id, + parameters: parameters, + }) + } + + pub fn build(self) -> F::Result { + let data = AngleBracketedParameterData { + lifetimes: self.lifetimes, + types: self.tys, + bindings: self.bindings, + }; + + let parameters = PathParameters::AngleBracketed(data); + + self.callback.invoke(PathSegment { + ident: self.id, + parameters: parameters, + }) + } +} + +impl Invoke for PathSegmentBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, ty: Ty) -> Self { + self.with_ty(ty) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TypeBindingBuilder { + id: Ident, + builder: PathSegmentBuilder, +} + +impl Invoke for TypeBindingBuilder + where F: Invoke +{ + type Result = PathSegmentBuilder; + + fn invoke(self, ty: Ty) -> Self::Result { + let id = self.id; + + self.builder.with_binding(TypeBinding { + ident: id, + ty: ty, + }) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct PathSegmentReturnBuilder(PathSegmentBuilder); + +impl Invoke for PathSegmentReturnBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> Self::Result { + self.0.build_return(Some(ty)) + } +} diff --git a/third_party/rust/syn/src/aster/qpath.rs b/third_party/rust/syn/src/aster/qpath.rs new file mode 100644 index 000000000000..6ecde8609b62 --- /dev/null +++ b/third_party/rust/syn/src/aster/qpath.rs @@ -0,0 +1,146 @@ +use {Path, PathSegment, QSelf, Ty}; +use aster::ident::ToIdent; +use aster::invoke::{Invoke, Identity}; +use aster::path::{PathBuilder, PathSegmentBuilder}; +use aster::ty::TyBuilder; + +// //////////////////////////////////////////////////////////////////////////// + +pub struct QPathBuilder { + callback: F, +} + +impl QPathBuilder { + pub fn new() -> Self { + QPathBuilder::with_callback(Identity) + } +} + +impl QPathBuilder + where F: Invoke<(QSelf, Path)> +{ + /// Construct a `QPathBuilder` that will call the `callback` with a constructed `QSelf` + /// and `Path`. + pub fn with_callback(callback: F) -> Self { + QPathBuilder { callback: callback } + } + + /// Build a qualified path first by starting with a type builder. + pub fn with_ty(self, ty: Ty) -> QPathTyBuilder { + QPathTyBuilder { + builder: self, + ty: ty, + } + } + + /// Build a qualified path first by starting with a type builder. + pub fn ty(self) -> TyBuilder { + TyBuilder::with_callback(self) + } + + /// Build a qualified path with a concrete type and path. + pub fn build(self, qself: QSelf, path: Path) -> F::Result { + self.callback.invoke((qself, path)) + } +} + +impl Invoke for QPathBuilder + where F: Invoke<(QSelf, Path)> +{ + type Result = QPathTyBuilder; + + fn invoke(self, ty: Ty) -> QPathTyBuilder { + self.with_ty(ty) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct QPathTyBuilder { + builder: QPathBuilder, + ty: Ty, +} + +impl QPathTyBuilder + where F: Invoke<(QSelf, Path)> +{ + /// Build a qualified path with a path builder. + // Clippy false positive + // https://github.com/Manishearth/rust-clippy/issues/1285 + #[cfg_attr(feature = "clippy", allow(wrong_self_convention))] + pub fn as_(self) -> PathBuilder { + PathBuilder::with_callback(self) + } + + pub fn id(self, id: T) -> F::Result + where T: ToIdent + { + let path = Path { + global: false, + segments: vec![], + }; + self.as_().build(path).id(id) + } + + pub fn segment(self, id: T) -> PathSegmentBuilder> + where T: ToIdent + { + let path = Path { + global: false, + segments: vec![], + }; + self.as_().build(path).segment(id) + } +} + +impl Invoke for QPathTyBuilder + where F: Invoke<(QSelf, Path)> +{ + type Result = QPathQSelfBuilder; + + fn invoke(self, path: Path) -> QPathQSelfBuilder { + QPathQSelfBuilder { + builder: self.builder, + qself: QSelf { + ty: Box::new(self.ty), + position: path.segments.len(), + }, + path: path, + } + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct QPathQSelfBuilder { + builder: QPathBuilder, + qself: QSelf, + path: Path, +} + +impl QPathQSelfBuilder + where F: Invoke<(QSelf, Path)> +{ + pub fn id(self, id: T) -> F::Result + where T: ToIdent + { + self.segment(id).build() + } + + pub fn segment(self, id: T) -> PathSegmentBuilder> + where T: ToIdent + { + PathSegmentBuilder::with_callback(id, self) + } +} + +impl Invoke for QPathQSelfBuilder + where F: Invoke<(QSelf, Path)> +{ + type Result = F::Result; + + fn invoke(mut self, segment: PathSegment) -> F::Result { + self.path.segments.push(segment); + self.builder.build(self.qself, self.path) + } +} diff --git a/third_party/rust/syn/src/aster/ty.rs b/third_party/rust/syn/src/aster/ty.rs new file mode 100644 index 000000000000..96b6554d20c1 --- /dev/null +++ b/third_party/rust/syn/src/aster/ty.rs @@ -0,0 +1,578 @@ +use {Generics, Lifetime, MutTy, Mutability, Path, QSelf, Ty, TyParamBound}; +use aster::ident::ToIdent; +use aster::invoke::{Invoke, Identity}; +use aster::lifetime::IntoLifetime; +use aster::path::PathBuilder; +use aster::qpath::QPathBuilder; +use aster::ty_param::TyParamBoundBuilder; + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyBuilder { + callback: F, +} + +impl TyBuilder { + pub fn new() -> Self { + TyBuilder::with_callback(Identity) + } +} + +impl TyBuilder + where F: Invoke +{ + pub fn with_callback(callback: F) -> Self { + TyBuilder { callback: callback } + } + + pub fn build(self, ty: Ty) -> F::Result { + self.callback.invoke(ty) + } + + pub fn id(self, id: I) -> F::Result + where I: ToIdent + { + self.path().id(id).build() + } + + pub fn build_path(self, path: Path) -> F::Result { + self.build(Ty::Path(None, path)) + } + + pub fn build_qpath(self, qself: QSelf, path: Path) -> F::Result { + self.build(Ty::Path(Some(qself), path)) + } + + pub fn path(self) -> PathBuilder> { + PathBuilder::with_callback(TyPathBuilder(self)) + } + + pub fn qpath(self) -> QPathBuilder> { + QPathBuilder::with_callback(TyQPathBuilder(self)) + } + + pub fn isize(self) -> F::Result { + self.id("isize") + } + + pub fn i8(self) -> F::Result { + self.id("i8") + } + + pub fn i16(self) -> F::Result { + self.id("i16") + } + + pub fn i32(self) -> F::Result { + self.id("i32") + } + + pub fn i64(self) -> F::Result { + self.id("i64") + } + + pub fn usize(self) -> F::Result { + self.id("usize") + } + + pub fn u8(self) -> F::Result { + self.id("u8") + } + + pub fn u16(self) -> F::Result { + self.id("u16") + } + + pub fn u32(self) -> F::Result { + self.id("u32") + } + + pub fn u64(self) -> F::Result { + self.id("u64") + } + + pub fn f32(self) -> F::Result { + self.id("f32") + } + + pub fn f64(self) -> F::Result { + self.id("f64") + } + + pub fn bool(self) -> F::Result { + self.id("bool") + } + + pub fn unit(self) -> F::Result { + self.tuple().build() + } + + pub fn tuple(self) -> TyTupleBuilder { + TyTupleBuilder { + builder: self, + tys: vec![], + } + } + + pub fn build_slice(self, ty: Ty) -> F::Result { + self.build(Ty::Slice(Box::new(ty))) + } + + pub fn slice(self) -> TyBuilder> { + TyBuilder::with_callback(TySliceBuilder(self)) + } + + pub fn ref_(self) -> TyRefBuilder { + TyRefBuilder { + builder: self, + lifetime: None, + mutability: Mutability::Immutable, + } + } + + pub fn never(self) -> F::Result { + self.build(Ty::Never) + } + + pub fn infer(self) -> F::Result { + self.build(Ty::Infer) + } + + pub fn option(self) -> TyBuilder> { + TyBuilder::with_callback(TyOptionBuilder(self)) + } + + pub fn result(self) -> TyBuilder> { + TyBuilder::with_callback(TyResultOkBuilder(self)) + } + + pub fn phantom_data(self) -> TyBuilder> { + TyBuilder::with_callback(TyPhantomDataBuilder(self)) + } + + pub fn box_(self) -> TyBuilder> { + TyBuilder::with_callback(TyBoxBuilder(self)) + } + + pub fn iterator(self) -> TyBuilder> { + TyBuilder::with_callback(TyIteratorBuilder(self)) + } + + pub fn object_sum(self) -> TyBuilder> { + TyBuilder::with_callback(TyObjectSumBuilder { builder: self }) + } + + pub fn impl_trait(self) -> TyImplTraitTyBuilder { + TyImplTraitTyBuilder { + builder: self, + bounds: Vec::new(), + } + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyPathBuilder(TyBuilder); + +impl Invoke for TyPathBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, path: Path) -> F::Result { + self.0.build_path(path) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyQPathBuilder(TyBuilder); + +impl Invoke<(QSelf, Path)> for TyQPathBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, (qself, path): (QSelf, Path)) -> F::Result { + self.0.build_qpath(qself, path) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TySliceBuilder(TyBuilder); + +impl Invoke for TySliceBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> F::Result { + self.0.build_slice(ty) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyRefBuilder { + builder: TyBuilder, + lifetime: Option, + mutability: Mutability, +} + +impl TyRefBuilder + where F: Invoke +{ + pub fn mut_(mut self) -> Self { + self.mutability = Mutability::Mutable; + self + } + + pub fn lifetime(mut self, name: N) -> Self + where N: ToIdent + { + self.lifetime = Some(Lifetime { ident: name.to_ident() }); + self + } + + pub fn build_ty(self, ty: Ty) -> F::Result { + let ty = MutTy { + ty: ty, + mutability: self.mutability, + }; + self.builder.build(Ty::Rptr(self.lifetime, Box::new(ty))) + } + + pub fn ty(self) -> TyBuilder { + TyBuilder::with_callback(self) + } +} + +impl Invoke for TyRefBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> F::Result { + self.build_ty(ty) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyOptionBuilder(TyBuilder); + +impl Invoke for TyOptionBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> F::Result { + let path = PathBuilder::new() + .global() + .id("std") + .id("option") + .segment("Option") + .with_ty(ty) + .build() + .build(); + + self.0.build_path(path) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyResultOkBuilder(TyBuilder); + +impl Invoke for TyResultOkBuilder + where F: Invoke +{ + type Result = TyBuilder>; + + fn invoke(self, ty: Ty) -> TyBuilder> { + TyBuilder::with_callback(TyResultErrBuilder(self.0, ty)) + } +} + +pub struct TyResultErrBuilder(TyBuilder, Ty); + +impl Invoke for TyResultErrBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> F::Result { + let path = PathBuilder::new() + .global() + .id("std") + .id("result") + .segment("Result") + .with_ty(self.1) + .with_ty(ty) + .build() + .build(); + + self.0.build_path(path) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyPhantomDataBuilder(TyBuilder); + +impl Invoke for TyPhantomDataBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> F::Result { + let path = PathBuilder::new() + .global() + .id("std") + .id("marker") + .segment("PhantomData") + .with_ty(ty) + .build() + .build(); + + self.0.build_path(path) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyBoxBuilder(TyBuilder); + +impl Invoke for TyBoxBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> F::Result { + let path = PathBuilder::new() + .global() + .id("std") + .id("boxed") + .segment("Box") + .with_ty(ty) + .build() + .build(); + + self.0.build_path(path) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyIteratorBuilder(TyBuilder); + +impl Invoke for TyIteratorBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, ty: Ty) -> F::Result { + let path = PathBuilder::new() + .global() + .id("std") + .id("iter") + .segment("Iterator") + .binding("Item") + .build(ty.clone()) + .build() + .build(); + + self.0.build_path(path) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyObjectSumBuilder { + builder: TyBuilder, +} + +impl Invoke for TyObjectSumBuilder + where F: Invoke +{ + type Result = TyObjectSumTyBuilder; + + fn invoke(self, ty: Ty) -> Self::Result { + TyObjectSumTyBuilder { + builder: self.builder, + ty: ty, + bounds: Vec::new(), + } + } +} + +pub struct TyObjectSumTyBuilder { + builder: TyBuilder, + ty: Ty, + bounds: Vec, +} + +impl TyObjectSumTyBuilder + where F: Invoke +{ + pub fn with_bounds(mut self, iter: I) -> Self + where I: Iterator + { + self.bounds.extend(iter); + self + } + + pub fn with_bound(mut self, bound: TyParamBound) -> Self { + self.bounds.push(bound); + self + } + + pub fn bound(self) -> TyParamBoundBuilder { + TyParamBoundBuilder::with_callback(self) + } + + pub fn with_generics(self, generics: Generics) -> Self { + self.with_lifetimes(generics.lifetimes + .into_iter() + .map(|def| def.lifetime)) + } + + pub fn with_lifetimes(mut self, lifetimes: I) -> Self + where I: Iterator, + L: IntoLifetime + { + for lifetime in lifetimes { + self = self.lifetime(lifetime); + } + + self + } + + pub fn lifetime(self, lifetime: L) -> Self + where L: IntoLifetime + { + self.bound().lifetime(lifetime) + } + + pub fn build(self) -> F::Result { + let bounds = self.bounds; + self.builder.build(Ty::ObjectSum(Box::new(self.ty), bounds)) + } +} + +impl Invoke for TyObjectSumTyBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, bound: TyParamBound) -> Self { + self.with_bound(bound) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyImplTraitTyBuilder { + builder: TyBuilder, + bounds: Vec, +} + +impl TyImplTraitTyBuilder + where F: Invoke +{ + pub fn with_bounds(mut self, iter: I) -> Self + where I: Iterator + { + self.bounds.extend(iter); + self + } + + pub fn with_bound(mut self, bound: TyParamBound) -> Self { + self.bounds.push(bound); + self + } + + pub fn bound(self) -> TyParamBoundBuilder { + TyParamBoundBuilder::with_callback(self) + } + + pub fn with_generics(self, generics: Generics) -> Self { + self.with_lifetimes(generics.lifetimes + .into_iter() + .map(|def| def.lifetime)) + } + + pub fn with_lifetimes(mut self, lifetimes: I) -> Self + where I: Iterator, + L: IntoLifetime + { + for lifetime in lifetimes { + self = self.lifetime(lifetime); + } + + self + } + + pub fn lifetime(self, lifetime: L) -> Self + where L: IntoLifetime + { + self.bound().lifetime(lifetime) + } + + pub fn build(self) -> F::Result { + let bounds = self.bounds; + self.builder.build(Ty::ImplTrait(bounds)) + } +} + +impl Invoke for TyImplTraitTyBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, bound: TyParamBound) -> Self { + self.with_bound(bound) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyTupleBuilder { + builder: TyBuilder, + tys: Vec, +} + +impl TyTupleBuilder + where F: Invoke +{ + pub fn with_tys(mut self, iter: I) -> Self + where I: IntoIterator + { + self.tys.extend(iter); + self + } + + pub fn with_ty(mut self, ty: Ty) -> Self { + self.tys.push(ty); + self + } + + pub fn ty(self) -> TyBuilder { + TyBuilder::with_callback(self) + } + + pub fn build(self) -> F::Result { + self.builder.build(Ty::Tup(self.tys)) + } +} + +impl Invoke for TyTupleBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, ty: Ty) -> Self { + self.with_ty(ty) + } +} diff --git a/third_party/rust/syn/src/aster/ty_param.rs b/third_party/rust/syn/src/aster/ty_param.rs new file mode 100644 index 000000000000..2836203bec78 --- /dev/null +++ b/third_party/rust/syn/src/aster/ty_param.rs @@ -0,0 +1,262 @@ +use {Ident, LifetimeDef, Path, PolyTraitRef, TraitBoundModifier, Ty, TyParam, TyParamBound}; +use aster::invoke::{Invoke, Identity}; +use aster::lifetime::{IntoLifetime, IntoLifetimeDef, LifetimeDefBuilder}; +use aster::path::{IntoPath, PathBuilder}; +use aster::ty::TyBuilder; + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyParamBuilder { + callback: F, + id: Ident, + bounds: Vec, + default: Option, +} + +impl TyParamBuilder { + pub fn new(id: I) -> Self + where I: Into + { + TyParamBuilder::with_callback(id, Identity) + } + + pub fn from_ty_param(ty_param: TyParam) -> Self { + TyParamBuilder::from_ty_param_with_callback(Identity, ty_param) + } +} + +impl TyParamBuilder + where F: Invoke +{ + pub fn with_callback(id: I, callback: F) -> Self + where I: Into + { + TyParamBuilder { + callback: callback, + id: id.into(), + bounds: Vec::new(), + default: None, + } + } + + pub fn from_ty_param_with_callback(callback: F, ty_param: TyParam) -> Self { + TyParamBuilder { + callback: callback, + id: ty_param.ident, + bounds: ty_param.bounds, + default: ty_param.default, + } + } + + pub fn with_default(mut self, ty: Ty) -> Self { + self.default = Some(ty); + self + } + + pub fn default(self) -> TyBuilder { + TyBuilder::with_callback(self) + } + + pub fn with_bound(mut self, bound: TyParamBound) -> Self { + self.bounds.push(bound); + self + } + + pub fn bound(self) -> TyParamBoundBuilder { + TyParamBoundBuilder::with_callback(self) + } + + pub fn with_trait_bound(self, trait_ref: PolyTraitRef) -> Self { + self.bound().build_trait(trait_ref, TraitBoundModifier::None) + } + + pub fn trait_bound

(self, path: P) -> PolyTraitRefBuilder + where P: IntoPath + { + PolyTraitRefBuilder::with_callback(path, self) + } + + pub fn lifetime_bound(mut self, lifetime: L) -> Self + where L: IntoLifetime + { + let lifetime = lifetime.into_lifetime(); + + self.bounds.push(TyParamBound::Region(lifetime)); + self + } + + pub fn build(self) -> F::Result { + self.callback.invoke(TyParam { + attrs: vec![], + ident: self.id, + bounds: self.bounds, + default: self.default, + }) + } +} + +impl Invoke for TyParamBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, ty: Ty) -> Self { + self.with_default(ty) + } +} + +impl Invoke for TyParamBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, bound: TyParamBound) -> Self { + self.with_bound(bound) + } +} + +impl Invoke for TyParamBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, trait_ref: PolyTraitRef) -> Self { + self.with_trait_bound(trait_ref) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TyParamBoundBuilder { + callback: F, +} + +impl TyParamBoundBuilder { + pub fn new() -> Self { + TyParamBoundBuilder::with_callback(Identity) + } +} + +impl TyParamBoundBuilder + where F: Invoke +{ + pub fn with_callback(callback: F) -> Self { + TyParamBoundBuilder { callback: callback } + } + + pub fn build_trait(self, poly_trait: PolyTraitRef, modifier: TraitBoundModifier) -> F::Result { + let bound = TyParamBound::Trait(poly_trait, modifier); + self.callback.invoke(bound) + } + + pub fn trait_

(self, path: P) -> PolyTraitRefBuilder> + where P: IntoPath + { + let builder = TraitTyParamBoundBuilder { + builder: self, + modifier: TraitBoundModifier::None, + }; + + PolyTraitRefBuilder::with_callback(path, builder) + } + + pub fn maybe_trait

(self, path: P) -> PolyTraitRefBuilder> + where P: IntoPath + { + let builder = TraitTyParamBoundBuilder { + builder: self, + modifier: TraitBoundModifier::Maybe, + }; + + PolyTraitRefBuilder::with_callback(path, builder) + } + + pub fn iterator(self, ty: Ty) -> PolyTraitRefBuilder> { + let path = PathBuilder::new() + .global() + .id("std") + .id("iter") + .segment("Iterator") + .binding("Item") + .build(ty) + .build() + .build(); + self.trait_(path) + } + + pub fn lifetime(self, lifetime: L) -> F::Result + where L: IntoLifetime + { + let lifetime = lifetime.into_lifetime(); + self.callback.invoke(TyParamBound::Region(lifetime)) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct TraitTyParamBoundBuilder { + builder: TyParamBoundBuilder, + modifier: TraitBoundModifier, +} + +impl Invoke for TraitTyParamBoundBuilder + where F: Invoke +{ + type Result = F::Result; + + fn invoke(self, poly_trait: PolyTraitRef) -> Self::Result { + self.builder.build_trait(poly_trait, self.modifier) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct PolyTraitRefBuilder { + callback: F, + trait_ref: Path, + lifetimes: Vec, +} + +impl PolyTraitRefBuilder + where F: Invoke +{ + pub fn with_callback

(path: P, callback: F) -> Self + where P: IntoPath + { + PolyTraitRefBuilder { + callback: callback, + trait_ref: path.into_path(), + lifetimes: Vec::new(), + } + } + + pub fn with_lifetime(mut self, lifetime: L) -> Self + where L: IntoLifetimeDef + { + self.lifetimes.push(lifetime.into_lifetime_def()); + self + } + + pub fn lifetime(self, name: N) -> LifetimeDefBuilder + where N: Into + { + LifetimeDefBuilder::with_callback(name, self) + } + + pub fn build(self) -> F::Result { + self.callback.invoke(PolyTraitRef { + bound_lifetimes: self.lifetimes, + trait_ref: self.trait_ref, + }) + } +} + +impl Invoke for PolyTraitRefBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, lifetime: LifetimeDef) -> Self { + self.with_lifetime(lifetime) + } +} diff --git a/third_party/rust/syn/src/aster/where_predicate.rs b/third_party/rust/syn/src/aster/where_predicate.rs new file mode 100644 index 000000000000..611d058f6718 --- /dev/null +++ b/third_party/rust/syn/src/aster/where_predicate.rs @@ -0,0 +1,259 @@ +use {Ident, Lifetime, LifetimeDef, Ty, TyParamBound, WhereBoundPredicate, WherePredicate, + WhereRegionPredicate}; +use aster::invoke::{Invoke, Identity}; +use aster::lifetime::{IntoLifetime, IntoLifetimeDef, LifetimeDefBuilder}; +use aster::path::IntoPath; +use aster::ty::TyBuilder; +use aster::ty_param::{TyParamBoundBuilder, PolyTraitRefBuilder, TraitTyParamBoundBuilder}; + +// //////////////////////////////////////////////////////////////////////////// + +pub struct WherePredicateBuilder { + callback: F, +} + +impl WherePredicateBuilder { + pub fn new() -> Self { + WherePredicateBuilder::with_callback(Identity) + } +} + +impl WherePredicateBuilder + where F: Invoke +{ + pub fn with_callback(callback: F) -> Self { + WherePredicateBuilder { callback: callback } + } + + pub fn bound(self) -> TyBuilder { + TyBuilder::with_callback(self) + } + + pub fn lifetime(self, lifetime: L) -> WhereRegionPredicateBuilder + where L: IntoLifetime + { + WhereRegionPredicateBuilder { + callback: self.callback, + lifetime: lifetime.into_lifetime(), + bounds: Vec::new(), + } + } +} + +impl Invoke for WherePredicateBuilder + where F: Invoke +{ + type Result = WhereBoundPredicateTyBuilder; + + fn invoke(self, ty: Ty) -> Self::Result { + WhereBoundPredicateTyBuilder { + callback: self.callback, + ty: ty, + bound_lifetimes: Vec::new(), + } + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct WhereBoundPredicateBuilder { + callback: F, +} + +impl Invoke for WhereBoundPredicateBuilder + where F: Invoke +{ + type Result = WhereBoundPredicateTyBuilder; + + fn invoke(self, ty: Ty) -> Self::Result { + WhereBoundPredicateTyBuilder { + callback: self.callback, + ty: ty, + bound_lifetimes: Vec::new(), + } + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct WhereBoundPredicateTyBuilder { + callback: F, + ty: Ty, + bound_lifetimes: Vec, +} + +impl WhereBoundPredicateTyBuilder + where F: Invoke +{ + pub fn with_for_lifetime(mut self, lifetime: L) -> Self + where L: IntoLifetimeDef + { + self.bound_lifetimes.push(lifetime.into_lifetime_def()); + self + } + + pub fn for_lifetime(self, name: N) -> LifetimeDefBuilder + where N: Into + { + LifetimeDefBuilder::with_callback(name, self) + } + + pub fn with_bound(self, bound: TyParamBound) -> WhereBoundPredicateTyBoundsBuilder { + WhereBoundPredicateTyBoundsBuilder { + callback: self.callback, + ty: self.ty, + bound_lifetimes: self.bound_lifetimes, + bounds: vec![bound], + } + } + + pub fn bound(self) -> TyParamBoundBuilder> { + let builder = WhereBoundPredicateTyBoundsBuilder { + callback: self.callback, + ty: self.ty, + bound_lifetimes: self.bound_lifetimes, + bounds: vec![], + }; + TyParamBoundBuilder::with_callback(builder) + } + + pub fn trait_

+ (self, + path: P) + -> PolyTraitRefBuilder>> + where P: IntoPath + { + self.bound().trait_(path) + } + + pub fn lifetime(self, lifetime: L) -> WhereBoundPredicateTyBoundsBuilder + where L: IntoLifetime + { + self.bound().lifetime(lifetime) + } +} + +impl Invoke for WhereBoundPredicateTyBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, lifetime: LifetimeDef) -> Self { + self.with_for_lifetime(lifetime) + } +} + +impl Invoke for WhereBoundPredicateTyBuilder + where F: Invoke +{ + type Result = WhereBoundPredicateTyBoundsBuilder; + + fn invoke(self, bound: TyParamBound) -> Self::Result { + self.with_bound(bound) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct WhereBoundPredicateTyBoundsBuilder { + callback: F, + ty: Ty, + bound_lifetimes: Vec, + bounds: Vec, +} + +impl WhereBoundPredicateTyBoundsBuilder + where F: Invoke +{ + pub fn with_for_lifetime(mut self, lifetime: L) -> Self + where L: IntoLifetimeDef + { + self.bound_lifetimes.push(lifetime.into_lifetime_def()); + self + } + + pub fn for_lifetime(self, name: N) -> LifetimeDefBuilder + where N: Into + { + LifetimeDefBuilder::with_callback(name, self) + } + + pub fn with_bound(mut self, bound: TyParamBound) -> Self { + self.bounds.push(bound); + self + } + + pub fn bound(self) -> TyParamBoundBuilder { + TyParamBoundBuilder::with_callback(self) + } + + pub fn trait_

(self, path: P) -> PolyTraitRefBuilder> + where P: IntoPath + { + self.bound().trait_(path) + } + + pub fn lifetime(self, lifetime: L) -> Self + where L: IntoLifetime + { + self.bound().lifetime(lifetime) + } + + pub fn build(self) -> F::Result { + let predicate = WhereBoundPredicate { + bound_lifetimes: self.bound_lifetimes, + bounded_ty: self.ty, + bounds: self.bounds, + }; + + self.callback.invoke(WherePredicate::BoundPredicate(predicate)) + } +} + +impl Invoke for WhereBoundPredicateTyBoundsBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, lifetime: LifetimeDef) -> Self { + self.with_for_lifetime(lifetime) + } +} + +impl Invoke for WhereBoundPredicateTyBoundsBuilder + where F: Invoke +{ + type Result = Self; + + fn invoke(self, bound: TyParamBound) -> Self { + self.with_bound(bound) + } +} + +// //////////////////////////////////////////////////////////////////////////// + +pub struct WhereRegionPredicateBuilder { + callback: F, + lifetime: Lifetime, + bounds: Vec, +} + +impl WhereRegionPredicateBuilder + where F: Invoke +{ + pub fn bound(mut self, lifetime: L) -> Self + where L: IntoLifetime + { + self.bounds.push(lifetime.into_lifetime()); + self + } + + pub fn build(self) -> F::Result { + let predicate = WhereRegionPredicate { + lifetime: self.lifetime, + bounds: self.bounds, + }; + + self.callback.invoke(WherePredicate::RegionPredicate(predicate)) + } +} diff --git a/third_party/rust/syn/src/attr.rs b/third_party/rust/syn/src/attr.rs new file mode 100644 index 000000000000..146427a8fd8a --- /dev/null +++ b/third_party/rust/syn/src/attr.rs @@ -0,0 +1,293 @@ +use super::*; + +use std::iter; + +/// Doc-comments are promoted to attributes that have `is_sugared_doc` = true +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Attribute { + pub style: AttrStyle, + pub value: MetaItem, + pub is_sugared_doc: bool, +} + +impl Attribute { + pub fn name(&self) -> &str { + self.value.name() + } +} + +/// Distinguishes between Attributes that decorate items and Attributes that +/// are contained as statements within items. These two cases need to be +/// distinguished for pretty-printing. +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum AttrStyle { + Outer, + Inner, +} + +/// A compile-time attribute item. +/// +/// E.g. `#[test]`, `#[derive(..)]` or `#[feature = "foo"]` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum MetaItem { + /// Word meta item. + /// + /// E.g. `test` as in `#[test]` + Word(Ident), + /// List meta item. + /// + /// E.g. `derive(..)` as in `#[derive(..)]` + List(Ident, Vec), + /// Name value meta item. + /// + /// E.g. `feature = "foo"` as in `#[feature = "foo"]` + NameValue(Ident, Lit), +} + +impl MetaItem { + pub fn name(&self) -> &str { + match *self { + MetaItem::Word(ref name) | + MetaItem::List(ref name, _) | + MetaItem::NameValue(ref name, _) => name.as_ref(), + } + } +} + +/// Possible values inside of compile-time attribute lists. +/// +/// E.g. the '..' in `#[name(..)]`. +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum NestedMetaItem { + /// A full MetaItem, for recursive meta items. + MetaItem(MetaItem), + /// A literal. + /// + /// E.g. "foo", 64, true + Literal(Lit), +} + +pub trait FilterAttrs<'a> { + type Ret: Iterator; + + fn outer(self) -> Self::Ret; + fn inner(self) -> Self::Ret; +} + +impl<'a, T> FilterAttrs<'a> for T + where T: IntoIterator +{ + type Ret = iter::Filter bool>; + + fn outer(self) -> Self::Ret { + fn is_outer(attr: &&Attribute) -> bool { + attr.style == AttrStyle::Outer + } + self.into_iter().filter(is_outer) + } + + fn inner(self) -> Self::Ret { + fn is_inner(attr: &&Attribute) -> bool { + attr.style == AttrStyle::Inner + } + self.into_iter().filter(is_inner) + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use ident::parsing::ident; + use lit::parsing::lit; + use space::{block_comment, whitespace}; + + #[cfg(feature = "full")] + named!(pub inner_attr -> Attribute, alt!( + do_parse!( + punct!("#") >> + punct!("!") >> + punct!("[") >> + meta_item: meta_item >> + punct!("]") >> + (Attribute { + style: AttrStyle::Inner, + value: meta_item, + is_sugared_doc: false, + }) + ) + | + do_parse!( + punct!("//!") >> + content: take_until!("\n") >> + (Attribute { + style: AttrStyle::Inner, + value: MetaItem::NameValue( + "doc".into(), + format!("//!{}", content).into(), + ), + is_sugared_doc: true, + }) + ) + | + do_parse!( + option!(whitespace) >> + peek!(tag!("/*!")) >> + com: block_comment >> + (Attribute { + style: AttrStyle::Inner, + value: MetaItem::NameValue( + "doc".into(), + com.into(), + ), + is_sugared_doc: true, + }) + ) + )); + + named!(pub outer_attr -> Attribute, alt!( + do_parse!( + punct!("#") >> + punct!("[") >> + meta_item: meta_item >> + punct!("]") >> + (Attribute { + style: AttrStyle::Outer, + value: meta_item, + is_sugared_doc: false, + }) + ) + | + do_parse!( + punct!("///") >> + not!(peek!(tag!("/"))) >> + content: take_until!("\n") >> + (Attribute { + style: AttrStyle::Outer, + value: MetaItem::NameValue( + "doc".into(), + format!("///{}", content).into(), + ), + is_sugared_doc: true, + }) + ) + | + do_parse!( + option!(whitespace) >> + peek!(tuple!(tag!("/**"), not!(tag!("*")))) >> + com: block_comment >> + (Attribute { + style: AttrStyle::Outer, + value: MetaItem::NameValue( + "doc".into(), + com.into(), + ), + is_sugared_doc: true, + }) + ) + )); + + named!(meta_item -> MetaItem, alt!( + do_parse!( + id: ident >> + punct!("(") >> + inner: terminated_list!(punct!(","), nested_meta_item) >> + punct!(")") >> + (MetaItem::List(id, inner)) + ) + | + do_parse!( + name: ident >> + punct!("=") >> + value: lit >> + (MetaItem::NameValue(name, value)) + ) + | + map!(ident, MetaItem::Word) + )); + + named!(nested_meta_item -> NestedMetaItem, alt!( + meta_item => { NestedMetaItem::MetaItem } + | + lit => { NestedMetaItem::Literal } + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use lit::{Lit, StrStyle}; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Attribute { + fn to_tokens(&self, tokens: &mut Tokens) { + if let Attribute { style, + value: MetaItem::NameValue(ref name, + Lit::Str(ref value, StrStyle::Cooked)), + is_sugared_doc: true } = *self { + if name == "doc" { + match style { + AttrStyle::Inner if value.starts_with("//!") => { + tokens.append(&format!("{}\n", value)); + return; + } + AttrStyle::Inner if value.starts_with("/*!") => { + tokens.append(value); + return; + } + AttrStyle::Outer if value.starts_with("///") => { + tokens.append(&format!("{}\n", value)); + return; + } + AttrStyle::Outer if value.starts_with("/**") => { + tokens.append(value); + return; + } + _ => {} + } + } + } + + tokens.append("#"); + if let AttrStyle::Inner = self.style { + tokens.append("!"); + } + tokens.append("["); + self.value.to_tokens(tokens); + tokens.append("]"); + } + } + + impl ToTokens for MetaItem { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + MetaItem::Word(ref ident) => { + ident.to_tokens(tokens); + } + MetaItem::List(ref ident, ref inner) => { + ident.to_tokens(tokens); + tokens.append("("); + tokens.append_separated(inner, ","); + tokens.append(")"); + } + MetaItem::NameValue(ref name, ref value) => { + name.to_tokens(tokens); + tokens.append("="); + value.to_tokens(tokens); + } + } + } + } + + impl ToTokens for NestedMetaItem { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + NestedMetaItem::MetaItem(ref nested) => { + nested.to_tokens(tokens); + } + NestedMetaItem::Literal(ref lit) => { + lit.to_tokens(tokens); + } + } + } + } +} diff --git a/third_party/rust/syn/src/constant.rs b/third_party/rust/syn/src/constant.rs new file mode 100644 index 000000000000..c7d0e32e0816 --- /dev/null +++ b/third_party/rust/syn/src/constant.rs @@ -0,0 +1,167 @@ +use super::*; + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum ConstExpr { + /// A function call + /// + /// The first field resolves to the function itself, + /// and the second field is the list of arguments + Call(Box, Vec), + /// A binary operation (For example: `a + b`, `a * b`) + Binary(BinOp, Box, Box), + /// A unary operation (For example: `!x`, `*x`) + Unary(UnOp, Box), + /// A literal (For example: `1`, `"foo"`) + Lit(Lit), + /// A cast (`foo as f64`) + Cast(Box, Box), + /// Variable reference, possibly containing `::` and/or type + /// parameters, e.g. foo::bar::. + Path(Path), + /// An indexing operation (`foo[2]`) + Index(Box, Box), + /// No-op: used solely so we can pretty-print faithfully + Paren(Box), + /// If compiling with full support for expression syntax, any expression is + /// allowed + Other(Other), +} + +#[cfg(not(feature = "full"))] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Other { + _private: (), +} + +#[cfg(feature = "full")] +pub type Other = Expr; + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use {BinOp, Ty}; + use lit::parsing::lit; + use op::parsing::{binop, unop}; + use ty::parsing::{path, ty}; + + named!(pub const_expr -> ConstExpr, do_parse!( + mut e: alt!( + expr_unary + | + expr_lit + | + expr_path + | + expr_paren + ) >> + many0!(alt!( + tap!(args: and_call => { + e = ConstExpr::Call(Box::new(e), args); + }) + | + tap!(more: and_binary => { + let (op, other) = more; + e = ConstExpr::Binary(op, Box::new(e), Box::new(other)); + }) + | + tap!(ty: and_cast => { + e = ConstExpr::Cast(Box::new(e), Box::new(ty)); + }) + | + tap!(i: and_index => { + e = ConstExpr::Index(Box::new(e), Box::new(i)); + }) + )) >> + (e) + )); + + named!(and_call -> Vec, do_parse!( + punct!("(") >> + args: terminated_list!(punct!(","), const_expr) >> + punct!(")") >> + (args) + )); + + named!(and_binary -> (BinOp, ConstExpr), tuple!(binop, const_expr)); + + named!(expr_unary -> ConstExpr, do_parse!( + operator: unop >> + operand: const_expr >> + (ConstExpr::Unary(operator, Box::new(operand))) + )); + + named!(expr_lit -> ConstExpr, map!(lit, ConstExpr::Lit)); + + named!(expr_path -> ConstExpr, map!(path, ConstExpr::Path)); + + named!(and_index -> ConstExpr, delimited!(punct!("["), const_expr, punct!("]"))); + + named!(expr_paren -> ConstExpr, do_parse!( + punct!("(") >> + e: const_expr >> + punct!(")") >> + (ConstExpr::Paren(Box::new(e))) + )); + + named!(and_cast -> Ty, do_parse!( + keyword!("as") >> + ty: ty >> + (ty) + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use quote::{Tokens, ToTokens}; + + impl ToTokens for ConstExpr { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + ConstExpr::Call(ref func, ref args) => { + func.to_tokens(tokens); + tokens.append("("); + tokens.append_separated(args, ","); + tokens.append(")"); + } + ConstExpr::Binary(op, ref left, ref right) => { + left.to_tokens(tokens); + op.to_tokens(tokens); + right.to_tokens(tokens); + } + ConstExpr::Unary(op, ref expr) => { + op.to_tokens(tokens); + expr.to_tokens(tokens); + } + ConstExpr::Lit(ref lit) => lit.to_tokens(tokens), + ConstExpr::Cast(ref expr, ref ty) => { + expr.to_tokens(tokens); + tokens.append("as"); + ty.to_tokens(tokens); + } + ConstExpr::Path(ref path) => path.to_tokens(tokens), + ConstExpr::Index(ref expr, ref index) => { + expr.to_tokens(tokens); + tokens.append("["); + index.to_tokens(tokens); + tokens.append("]"); + } + ConstExpr::Paren(ref expr) => { + tokens.append("("); + expr.to_tokens(tokens); + tokens.append(")"); + } + ConstExpr::Other(ref other) => { + other.to_tokens(tokens); + } + } + } + } + + #[cfg(not(feature = "full"))] + impl ToTokens for Other { + fn to_tokens(&self, _tokens: &mut Tokens) { + unreachable!() + } + } +} diff --git a/third_party/rust/syn/src/data.rs b/third_party/rust/syn/src/data.rs new file mode 100644 index 000000000000..7ccfd7a6885f --- /dev/null +++ b/third_party/rust/syn/src/data.rs @@ -0,0 +1,245 @@ +use super::*; + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Variant { + pub ident: Ident, + pub attrs: Vec, + pub data: VariantData, + /// Explicit discriminant, e.g. `Foo = 1` + pub discriminant: Option, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum VariantData { + Struct(Vec), + Tuple(Vec), + Unit, +} + +impl VariantData { + pub fn fields(&self) -> &[Field] { + match *self { + VariantData::Struct(ref fields) | + VariantData::Tuple(ref fields) => fields, + VariantData::Unit => &[], + } + } + + pub fn fields_mut(&mut self) -> &mut [Field] { + match *self { + VariantData::Struct(ref mut fields) | + VariantData::Tuple(ref mut fields) => fields, + VariantData::Unit => &mut [], + } + } +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Field { + pub ident: Option, + pub vis: Visibility, + pub attrs: Vec, + pub ty: Ty, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum Visibility { + Public, + Crate, + Restricted(Box), + Inherited, +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use WhereClause; + use attr::parsing::outer_attr; + use constant::parsing::const_expr; + use generics::parsing::where_clause; + use ident::parsing::ident; + use ty::parsing::{path, ty}; + + named!(pub struct_body -> (WhereClause, VariantData), alt!( + do_parse!( + wh: where_clause >> + body: struct_like_body >> + (wh, VariantData::Struct(body)) + ) + | + do_parse!( + body: tuple_like_body >> + wh: where_clause >> + punct!(";") >> + (wh, VariantData::Tuple(body)) + ) + | + do_parse!( + wh: where_clause >> + punct!(";") >> + (wh, VariantData::Unit) + ) + )); + + named!(pub enum_body -> (WhereClause, Vec), do_parse!( + wh: where_clause >> + punct!("{") >> + variants: terminated_list!(punct!(","), variant) >> + punct!("}") >> + (wh, variants) + )); + + named!(variant -> Variant, do_parse!( + attrs: many0!(outer_attr) >> + id: ident >> + data: alt!( + struct_like_body => { VariantData::Struct } + | + tuple_like_body => { VariantData::Tuple } + | + epsilon!() => { |_| VariantData::Unit } + ) >> + disr: option!(preceded!(punct!("="), const_expr)) >> + (Variant { + ident: id, + attrs: attrs, + data: data, + discriminant: disr, + }) + )); + + named!(pub struct_like_body -> Vec, do_parse!( + punct!("{") >> + fields: terminated_list!(punct!(","), struct_field) >> + punct!("}") >> + (fields) + )); + + named!(tuple_like_body -> Vec, do_parse!( + punct!("(") >> + fields: terminated_list!(punct!(","), tuple_field) >> + punct!(")") >> + (fields) + )); + + named!(struct_field -> Field, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + id: ident >> + punct!(":") >> + ty: ty >> + (Field { + ident: Some(id), + vis: vis, + attrs: attrs, + ty: ty, + }) + )); + + named!(tuple_field -> Field, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + ty: ty >> + (Field { + ident: None, + vis: vis, + attrs: attrs, + ty: ty, + }) + )); + + named!(pub visibility -> Visibility, alt!( + do_parse!( + keyword!("pub") >> + punct!("(") >> + keyword!("crate") >> + punct!(")") >> + (Visibility::Crate) + ) + | + do_parse!( + keyword!("pub") >> + punct!("(") >> + restricted: path >> + punct!(")") >> + (Visibility::Restricted(Box::new(restricted))) + ) + | + keyword!("pub") => { |_| Visibility::Public } + | + epsilon!() => { |_| Visibility::Inherited } + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Variant { + fn to_tokens(&self, tokens: &mut Tokens) { + for attr in &self.attrs { + attr.to_tokens(tokens); + } + self.ident.to_tokens(tokens); + self.data.to_tokens(tokens); + if let Some(ref disr) = self.discriminant { + tokens.append("="); + disr.to_tokens(tokens); + } + } + } + + impl ToTokens for VariantData { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + VariantData::Struct(ref fields) => { + tokens.append("{"); + tokens.append_separated(fields, ","); + tokens.append("}"); + } + VariantData::Tuple(ref fields) => { + tokens.append("("); + tokens.append_separated(fields, ","); + tokens.append(")"); + } + VariantData::Unit => {} + } + } + } + + impl ToTokens for Field { + fn to_tokens(&self, tokens: &mut Tokens) { + for attr in &self.attrs { + attr.to_tokens(tokens); + } + self.vis.to_tokens(tokens); + if let Some(ref ident) = self.ident { + ident.to_tokens(tokens); + tokens.append(":"); + } + self.ty.to_tokens(tokens); + } + } + + impl ToTokens for Visibility { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Visibility::Public => tokens.append("pub"), + Visibility::Crate => { + tokens.append("pub"); + tokens.append("("); + tokens.append("crate"); + tokens.append(")"); + } + Visibility::Restricted(ref path) => { + tokens.append("pub"); + tokens.append("("); + path.to_tokens(tokens); + tokens.append(")"); + } + Visibility::Inherited => {} + } + } + } +} diff --git a/third_party/rust/syn/src/escape.rs b/third_party/rust/syn/src/escape.rs new file mode 100644 index 000000000000..d8831ebdb620 --- /dev/null +++ b/third_party/rust/syn/src/escape.rs @@ -0,0 +1,292 @@ +use std::{char, str}; +use std::num::ParseIntError; +use nom::IResult; + +pub fn cooked_string(input: &str) -> IResult<&str, String> { + let mut s = String::new(); + let mut chars = input.char_indices().peekable(); + while let Some((byte_offset, ch)) = chars.next() { + match ch { + '"' => { + return IResult::Done(&input[byte_offset..], s); + } + '\r' => { + if let Some((_, '\n')) = chars.next() { + s.push('\n'); + } else { + break; + } + } + '\\' => { + match chars.next() { + Some((_, 'x')) => { + match backslash_x_char(&mut chars) { + Some(ch) => s.push(ch), + None => break, + } + } + Some((_, 'n')) => s.push('\n'), + Some((_, 'r')) => s.push('\r'), + Some((_, 't')) => s.push('\t'), + Some((_, '\\')) => s.push('\\'), + Some((_, '0')) => s.push('\0'), + Some((_, 'u')) => { + match backslash_u(&mut chars) { + Some(ch) => s.push(ch), + None => break, + } + } + Some((_, '\'')) => s.push('\''), + Some((_, '"')) => s.push('"'), + Some((_, '\n')) | Some((_, '\r')) => { + while let Some(&(_, ch)) = chars.peek() { + if ch.is_whitespace() { + chars.next(); + } else { + break; + } + } + } + _ => break, + } + } + ch => { + s.push(ch); + } + } + } + IResult::Error +} + +pub fn cooked_byte_string(mut input: &str) -> IResult<&str, Vec> { + let mut vec = Vec::new(); + let mut bytes = input.bytes().enumerate(); + 'outer: while let Some((offset, b)) = bytes.next() { + match b { + b'"' => { + return IResult::Done(&input[offset..], vec); + } + b'\r' => { + if let Some((_, b'\n')) = bytes.next() { + vec.push(b'\n'); + } else { + break; + } + } + b'\\' => { + match bytes.next() { + Some((_, b'x')) => { + match backslash_x_byte(&mut bytes) { + Some(b) => vec.push(b), + None => break, + } + } + Some((_, b'n')) => vec.push(b'\n'), + Some((_, b'r')) => vec.push(b'\r'), + Some((_, b't')) => vec.push(b'\t'), + Some((_, b'\\')) => vec.push(b'\\'), + Some((_, b'0')) => vec.push(b'\0'), + Some((_, b'\'')) => vec.push(b'\''), + Some((_, b'"')) => vec.push(b'"'), + Some((newline, b'\n')) | + Some((newline, b'\r')) => { + let rest = &input[newline + 1..]; + for (offset, ch) in rest.char_indices() { + if !ch.is_whitespace() { + input = &rest[offset..]; + bytes = input.bytes().enumerate(); + continue 'outer; + } + } + break; + } + _ => break, + } + } + b if b < 0x80 => { + vec.push(b); + } + _ => break, + } + } + IResult::Error +} + +pub fn cooked_char(input: &str) -> IResult<&str, char> { + let mut chars = input.char_indices(); + let ch = match chars.next().map(|(_, ch)| ch) { + Some('\\') => { + match chars.next().map(|(_, ch)| ch) { + Some('x') => backslash_x_char(&mut chars), + Some('n') => Some('\n'), + Some('r') => Some('\r'), + Some('t') => Some('\t'), + Some('\\') => Some('\\'), + Some('0') => Some('\0'), + Some('u') => backslash_u(&mut chars), + Some('\'') => Some('\''), + Some('"') => Some('"'), + _ => None, + } + } + ch => ch, + }; + match ch { + Some(ch) => IResult::Done(chars.as_str(), ch), + None => IResult::Error, + } +} + +pub fn cooked_byte(input: &str) -> IResult<&str, u8> { + let mut bytes = input.bytes().enumerate(); + let b = match bytes.next().map(|(_, b)| b) { + Some(b'\\') => { + match bytes.next().map(|(_, b)| b) { + Some(b'x') => backslash_x_byte(&mut bytes), + Some(b'n') => Some(b'\n'), + Some(b'r') => Some(b'\r'), + Some(b't') => Some(b'\t'), + Some(b'\\') => Some(b'\\'), + Some(b'0') => Some(b'\0'), + Some(b'\'') => Some(b'\''), + Some(b'"') => Some(b'"'), + _ => None, + } + } + b => b, + }; + match b { + Some(b) => { + match bytes.next() { + Some((offset, _)) => IResult::Done(&input[offset..], b), + None => IResult::Done("", b), + } + } + None => IResult::Error, + } +} + +pub fn raw_string(input: &str) -> IResult<&str, (String, usize)> { + let mut chars = input.char_indices(); + let mut n = 0; + while let Some((byte_offset, ch)) = chars.next() { + match ch { + '"' => { + n = byte_offset; + break; + } + '#' => {} + _ => return IResult::Error, + } + } + let mut s = String::new(); + for (byte_offset, ch) in chars { + match ch { + '"' if input[byte_offset + 1..].starts_with(&input[..n]) => { + let rest = &input[byte_offset + 1 + n..]; + return IResult::Done(rest, (s, n)); + } + '\r' => {} + _ => s.push(ch), + } + } + IResult::Error +} + +macro_rules! next_ch { + ($chars:ident @ $pat:pat $(| $rest:pat)*) => { + match $chars.next() { + Some((_, ch)) => match ch { + $pat $(| $rest)* => ch, + _ => return None, + }, + None => return None, + } + }; +} + +trait FromStrRadix: Sized { + fn from_str_radix(src: &str, radix: u32) -> Result; +} + +impl FromStrRadix for u8 { + fn from_str_radix(src: &str, radix: u32) -> Result { + u8::from_str_radix(src, radix) + } +} + +impl FromStrRadix for u32 { + fn from_str_radix(src: &str, radix: u32) -> Result { + u32::from_str_radix(src, radix) + } +} + +macro_rules! from_hex { + ($($ch:ident)+) => {{ + let hex_bytes = &[$($ch as u8),*]; + let hex_str = str::from_utf8(hex_bytes).unwrap(); + FromStrRadix::from_str_radix(hex_str, 16).unwrap() + }}; +} + +#[cfg_attr(feature = "clippy", allow(diverging_sub_expression))] +fn backslash_x_char(chars: &mut I) -> Option + where I: Iterator +{ + let a = next_ch!(chars @ '0'...'7'); + let b = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F'); + char::from_u32(from_hex!(a b)) +} + +#[cfg_attr(feature = "clippy", allow(diverging_sub_expression))] +fn backslash_x_byte(chars: &mut I) -> Option + where I: Iterator +{ + let a = next_ch!(chars @ b'0'...b'9' | b'a'...b'f' | b'A'...b'F'); + let b = next_ch!(chars @ b'0'...b'9' | b'a'...b'f' | b'A'...b'F'); + Some(from_hex!(a b)) +} + +#[cfg_attr(feature = "clippy", allow(diverging_sub_expression, many_single_char_names))] +fn backslash_u(chars: &mut I) -> Option + where I: Iterator +{ + next_ch!(chars @ '{'); + let a = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F'); + let b = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}'); + if b == '}' { + return char::from_u32(from_hex!(a)); + } + let c = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}'); + if c == '}' { + return char::from_u32(from_hex!(a b)); + } + let d = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}'); + if d == '}' { + return char::from_u32(from_hex!(a b c)); + } + let e = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}'); + if e == '}' { + return char::from_u32(from_hex!(a b c d)); + } + let f = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}'); + if f == '}' { + return char::from_u32(from_hex!(a b c d e)); + } + next_ch!(chars @ '}'); + char::from_u32(from_hex!(a b c d e f)) +} + +#[test] +fn test_cooked_string() { + let input = "\\x62 \\\n \\u{7} \\u{64} \\u{bf5} \\u{12ba} \\u{1F395} \\u{102345}\""; + let expected = "\x62 \u{7} \u{64} \u{bf5} \u{12ba} \u{1F395} \u{102345}"; + assert_eq!(cooked_string(input), IResult::Done("\"", expected.to_string())); +} + +#[test] +fn test_cooked_byte_string() { + let input = "\\x62 \\\n \\xEF\""; + let expected = b"\x62 \xEF"; + assert_eq!(cooked_byte_string(input), IResult::Done("\"", expected.to_vec())); +} diff --git a/third_party/rust/syn/src/expr.rs b/third_party/rust/syn/src/expr.rs new file mode 100644 index 000000000000..69bef2c625d3 --- /dev/null +++ b/third_party/rust/syn/src/expr.rs @@ -0,0 +1,1665 @@ +use super::*; + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Expr { + pub node: ExprKind, + pub attrs: Vec, +} + +impl From for Expr { + fn from(node: ExprKind) -> Expr { + Expr { + node: node, + attrs: Vec::new(), + } + } +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum ExprKind { + /// A `box x` expression. + Box(Box), + /// First expr is the place; second expr is the value. + InPlace(Box, Box), + /// An array (`[a, b, c, d]`) + Vec(Vec), + /// A function call + /// + /// The first field resolves to the function itself, + /// and the second field is the list of arguments + Call(Box, Vec), + /// A method call (`x.foo::(a, b, c, d)`) + /// + /// The `Ident` is the identifier for the method name. + /// The vector of `Ty`s are the ascripted type parameters for the method + /// (within the angle brackets). + /// + /// The first element of the vector of `Expr`s is the expression that evaluates + /// to the object on which the method is being called on (the receiver), + /// and the remaining elements are the rest of the arguments. + /// + /// Thus, `x.foo::(a, b, c, d)` is represented as + /// `ExprKind::MethodCall(foo, [Bar, Baz], [x, a, b, c, d])`. + MethodCall(Ident, Vec, Vec), + /// A tuple (`(a, b, c, d)`) + Tup(Vec), + /// A binary operation (For example: `a + b`, `a * b`) + Binary(BinOp, Box, Box), + /// A unary operation (For example: `!x`, `*x`) + Unary(UnOp, Box), + /// A literal (For example: `1`, `"foo"`) + Lit(Lit), + /// A cast (`foo as f64`) + Cast(Box, Box), + /// Type ascription (`foo: f64`) + Type(Box, Box), + /// An `if` block, with an optional else block + /// + /// `if expr { block } else { expr }` + If(Box, Block, Option>), + /// An `if let` expression with an optional else block + /// + /// `if let pat = expr { block } else { expr }` + /// + /// This is desugared to a `match` expression. + IfLet(Box, Box, Block, Option>), + /// A while loop, with an optional label + /// + /// `'label: while expr { block }` + While(Box, Block, Option), + /// A while-let loop, with an optional label + /// + /// `'label: while let pat = expr { block }` + /// + /// This is desugared to a combination of `loop` and `match` expressions. + WhileLet(Box, Box, Block, Option), + /// A for loop, with an optional label + /// + /// `'label: for pat in expr { block }` + /// + /// This is desugared to a combination of `loop` and `match` expressions. + ForLoop(Box, Box, Block, Option), + /// Conditionless loop (can be exited with break, continue, or return) + /// + /// `'label: loop { block }` + Loop(Block, Option), + /// A `match` block. + Match(Box, Vec), + /// A closure (for example, `move |a, b, c| a + b + c`) + Closure(CaptureBy, Box, Box), + /// A block (`{ ... }` or `unsafe { ... }`) + Block(Unsafety, Block), + + /// An assignment (`a = foo()`) + Assign(Box, Box), + /// An assignment with an operator + /// + /// For example, `a += 1`. + AssignOp(BinOp, Box, Box), + /// Access of a named struct field (`obj.foo`) + Field(Box, Ident), + /// Access of an unnamed field of a struct or tuple-struct + /// + /// For example, `foo.0`. + TupField(Box, usize), + /// An indexing operation (`foo[2]`) + Index(Box, Box), + /// A range (`1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`) + Range(Option>, Option>, RangeLimits), + + /// Variable reference, possibly containing `::` and/or type + /// parameters, e.g. foo::bar::. + /// + /// Optionally "qualified", + /// E.g. ` as SomeTrait>::SomeType`. + Path(Option, Path), + + /// A referencing operation (`&a` or `&mut a`) + AddrOf(Mutability, Box), + /// A `break`, with an optional label to break, and an optional expression + Break(Option, Option>), + /// A `continue`, with an optional label + Continue(Option), + /// A `return`, with an optional value to be returned + Ret(Option>), + + /// A macro invocation; pre-expansion + Mac(Mac), + + /// A struct literal expression. + /// + /// For example, `Foo {x: 1, y: 2}`, or + /// `Foo {x: 1, .. base}`, where `base` is the `Option`. + Struct(Path, Vec, Option>), + + /// An array literal constructed from one repeated element. + /// + /// For example, `[1; 5]`. The first expression is the element + /// to be repeated; the second is the number of times to repeat it. + Repeat(Box, Box), + + /// No-op: used solely so we can pretty-print faithfully + Paren(Box), + + /// `expr?` + Try(Box), +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct FieldValue { + pub ident: Ident, + pub expr: Expr, + pub is_shorthand: bool, +} + +/// A Block (`{ .. }`). +/// +/// E.g. `{ .. }` as in `fn foo() { .. }` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Block { + /// Statements in a block + pub stmts: Vec, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum Stmt { + /// A local (let) binding. + Local(Box), + + /// An item definition. + Item(Box), + + /// Expr without trailing semi-colon. + Expr(Box), + + Semi(Box), + + Mac(Box<(Mac, MacStmtStyle, Vec)>), +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum MacStmtStyle { + /// The macro statement had a trailing semicolon, e.g. `foo! { ... };` + /// `foo!(...);`, `foo![...];` + Semicolon, + /// The macro statement had braces; e.g. foo! { ... } + Braces, + /// The macro statement had parentheses or brackets and no semicolon; e.g. + /// `foo!(...)`. All of these will end up being converted into macro + /// expressions. + NoBraces, +} + +/// Local represents a `let` statement, e.g., `let : = ;` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Local { + pub pat: Box, + pub ty: Option>, + /// Initializer expression to set the value, if any + pub init: Option>, + pub attrs: Vec, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +// Clippy false positive +// https://github.com/Manishearth/rust-clippy/issues/1241 +#[cfg_attr(feature = "clippy", allow(enum_variant_names))] +pub enum Pat { + /// Represents a wildcard pattern (`_`) + Wild, + + /// A `Pat::Ident` may either be a new bound variable (`ref mut binding @ OPT_SUBPATTERN`), + /// or a unit struct/variant pattern, or a const pattern (in the last two cases the third + /// field must be `None`). Disambiguation cannot be done with parser alone, so it happens + /// during name resolution. + Ident(BindingMode, Ident, Option>), + + /// A struct or struct variant pattern, e.g. `Variant {x, y, ..}`. + /// The `bool` is `true` in the presence of a `..`. + Struct(Path, Vec, bool), + + /// A tuple struct/variant pattern `Variant(x, y, .., z)`. + /// If the `..` pattern fragment is present, then `Option` denotes its position. + /// 0 <= position <= subpats.len() + TupleStruct(Path, Vec, Option), + + /// A possibly qualified path pattern. + /// Unquailfied path patterns `A::B::C` can legally refer to variants, structs, constants + /// or associated constants. Quailfied path patterns `::B::C`/`::B::C` can + /// only legally refer to associated constants. + Path(Option, Path), + + /// A tuple pattern `(a, b)`. + /// If the `..` pattern fragment is present, then `Option` denotes its position. + /// 0 <= position <= subpats.len() + Tuple(Vec, Option), + /// A `box` pattern + Box(Box), + /// A reference pattern, e.g. `&mut (a, b)` + Ref(Box, Mutability), + /// A literal + Lit(Box), + /// A range pattern, e.g. `1...2` + Range(Box, Box), + /// `[a, b, ..i, y, z]` is represented as: + /// `Pat::Slice(box [a, b], Some(i), box [y, z])` + Slice(Vec, Option>, Vec), + /// A macro pattern; pre-expansion + Mac(Mac), +} + +/// An arm of a 'match'. +/// +/// E.g. `0...10 => { println!("match!") }` as in +/// +/// ```rust,ignore +/// match n { +/// 0...10 => { println!("match!") }, +/// // .. +/// } +/// ``` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Arm { + pub attrs: Vec, + pub pats: Vec, + pub guard: Option>, + pub body: Box, +} + +/// A capture clause +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum CaptureBy { + Value, + Ref, +} + +/// Limit types of a range (inclusive or exclusive) +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum RangeLimits { + /// Inclusive at the beginning, exclusive at the end + HalfOpen, + /// Inclusive at the beginning and end + Closed, +} + +/// A single field in a struct pattern +/// +/// Patterns like the fields of Foo `{ x, ref y, ref mut z }` +/// are treated the same as `x: x, y: ref y, z: ref mut z`, +/// except `is_shorthand` is true +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct FieldPat { + /// The identifier for the field + pub ident: Ident, + /// The pattern the field is destructured to + pub pat: Box, + pub is_shorthand: bool, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum BindingMode { + ByRef(Mutability), + ByValue(Mutability), +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use {BinOp, Delimited, DelimToken, FnArg, FnDecl, FunctionRetTy, Ident, Lifetime, Mac, + TokenTree, Ty, UnOp, Unsafety}; + use attr::parsing::outer_attr; + use generics::parsing::lifetime; + use ident::parsing::{ident, wordlike}; + use item::parsing::item; + use lit::parsing::{digits, lit}; + use mac::parsing::{mac, token_trees}; + use nom::IResult::{self, Error}; + use op::parsing::{assign_op, binop, unop}; + use ty::parsing::{mutability, path, qpath, ty, unsafety}; + + // Struct literals are ambiguous in certain positions + // https://github.com/rust-lang/rfcs/pull/92 + macro_rules! named_ambiguous_expr { + ($name:ident -> $o:ty, $allow_struct:ident, $submac:ident!( $($args:tt)* )) => { + fn $name(i: &str, $allow_struct: bool) -> $crate::nom::IResult<&str, $o> { + $submac!(i, $($args)*) + } + }; + } + + macro_rules! ambiguous_expr { + ($i:expr, $allow_struct:ident) => { + ambiguous_expr($i, $allow_struct, true) + }; + } + + named!(pub expr -> Expr, ambiguous_expr!(true)); + + named!(expr_no_struct -> Expr, ambiguous_expr!(false)); + + fn ambiguous_expr(i: &str, allow_struct: bool, allow_block: bool) -> IResult<&str, Expr> { + do_parse!( + i, + mut e: alt!( + expr_lit // must be before expr_struct + | + cond_reduce!(allow_struct, expr_struct) // must be before expr_path + | + expr_paren // must be before expr_tup + | + expr_mac // must be before expr_path + | + call!(expr_break, allow_struct) // must be before expr_path + | + expr_continue // must be before expr_path + | + call!(expr_ret, allow_struct) // must be before expr_path + | + call!(expr_box, allow_struct) + | + expr_in_place + | + expr_vec + | + expr_tup + | + call!(expr_unary, allow_struct) + | + expr_if + | + expr_while + | + expr_for_loop + | + expr_loop + | + expr_match + | + call!(expr_closure, allow_struct) + | + cond_reduce!(allow_block, expr_block) + | + call!(expr_range, allow_struct) + | + expr_path + | + call!(expr_addr_of, allow_struct) + | + expr_repeat + ) >> + many0!(alt!( + tap!(args: and_call => { + e = ExprKind::Call(Box::new(e.into()), args); + }) + | + tap!(more: and_method_call => { + let (method, ascript, mut args) = more; + args.insert(0, e.into()); + e = ExprKind::MethodCall(method, ascript, args); + }) + | + tap!(more: call!(and_binary, allow_struct) => { + let (op, other) = more; + e = ExprKind::Binary(op, Box::new(e.into()), Box::new(other)); + }) + | + tap!(ty: and_cast => { + e = ExprKind::Cast(Box::new(e.into()), Box::new(ty)); + }) + | + tap!(ty: and_ascription => { + e = ExprKind::Type(Box::new(e.into()), Box::new(ty)); + }) + | + tap!(v: call!(and_assign, allow_struct) => { + e = ExprKind::Assign(Box::new(e.into()), Box::new(v)); + }) + | + tap!(more: call!(and_assign_op, allow_struct) => { + let (op, v) = more; + e = ExprKind::AssignOp(op, Box::new(e.into()), Box::new(v)); + }) + | + tap!(field: and_field => { + e = ExprKind::Field(Box::new(e.into()), field); + }) + | + tap!(field: and_tup_field => { + e = ExprKind::TupField(Box::new(e.into()), field as usize); + }) + | + tap!(i: and_index => { + e = ExprKind::Index(Box::new(e.into()), Box::new(i)); + }) + | + tap!(more: call!(and_range, allow_struct) => { + let (limits, hi) = more; + e = ExprKind::Range(Some(Box::new(e.into())), hi.map(Box::new), limits); + }) + | + tap!(_try: punct!("?") => { + e = ExprKind::Try(Box::new(e.into())); + }) + )) >> + (e.into()) + ) + } + + named!(expr_mac -> ExprKind, map!(mac, ExprKind::Mac)); + + named!(expr_paren -> ExprKind, do_parse!( + punct!("(") >> + e: expr >> + punct!(")") >> + (ExprKind::Paren(Box::new(e))) + )); + + named_ambiguous_expr!(expr_box -> ExprKind, allow_struct, do_parse!( + keyword!("box") >> + inner: ambiguous_expr!(allow_struct) >> + (ExprKind::Box(Box::new(inner))) + )); + + named!(expr_in_place -> ExprKind, do_parse!( + keyword!("in") >> + place: expr_no_struct >> + punct!("{") >> + value: within_block >> + punct!("}") >> + (ExprKind::InPlace( + Box::new(place), + Box::new(ExprKind::Block(Unsafety::Normal, Block { + stmts: value, + }).into()), + )) + )); + + named!(expr_vec -> ExprKind, do_parse!( + punct!("[") >> + elems: terminated_list!(punct!(","), expr) >> + punct!("]") >> + (ExprKind::Vec(elems)) + )); + + named!(and_call -> Vec, do_parse!( + punct!("(") >> + args: terminated_list!(punct!(","), expr) >> + punct!(")") >> + (args) + )); + + named!(and_method_call -> (Ident, Vec, Vec), do_parse!( + punct!(".") >> + method: ident >> + ascript: opt_vec!(preceded!( + punct!("::"), + delimited!( + punct!("<"), + terminated_list!(punct!(","), ty), + punct!(">") + ) + )) >> + punct!("(") >> + args: terminated_list!(punct!(","), expr) >> + punct!(")") >> + (method, ascript, args) + )); + + named!(expr_tup -> ExprKind, do_parse!( + punct!("(") >> + elems: terminated_list!(punct!(","), expr) >> + punct!(")") >> + (ExprKind::Tup(elems)) + )); + + named_ambiguous_expr!(and_binary -> (BinOp, Expr), allow_struct, tuple!( + binop, + ambiguous_expr!(allow_struct) + )); + + named_ambiguous_expr!(expr_unary -> ExprKind, allow_struct, do_parse!( + operator: unop >> + operand: ambiguous_expr!(allow_struct) >> + (ExprKind::Unary(operator, Box::new(operand))) + )); + + named!(expr_lit -> ExprKind, map!(lit, ExprKind::Lit)); + + named!(and_cast -> Ty, do_parse!( + keyword!("as") >> + ty: ty >> + (ty) + )); + + named!(and_ascription -> Ty, preceded!(punct!(":"), ty)); + + enum Cond { + Let(Pat, Expr), + Expr(Expr), + } + + named!(cond -> Cond, alt!( + do_parse!( + keyword!("let") >> + pat: pat >> + punct!("=") >> + value: expr_no_struct >> + (Cond::Let(pat, value)) + ) + | + map!(expr_no_struct, Cond::Expr) + )); + + named!(expr_if -> ExprKind, do_parse!( + keyword!("if") >> + cond: cond >> + punct!("{") >> + then_block: within_block >> + punct!("}") >> + else_block: option!(preceded!( + keyword!("else"), + alt!( + expr_if + | + do_parse!( + punct!("{") >> + else_block: within_block >> + punct!("}") >> + (ExprKind::Block(Unsafety::Normal, Block { + stmts: else_block, + }).into()) + ) + ) + )) >> + (match cond { + Cond::Let(pat, expr) => ExprKind::IfLet( + Box::new(pat), + Box::new(expr), + Block { + stmts: then_block, + }, + else_block.map(|els| Box::new(els.into())), + ), + Cond::Expr(cond) => ExprKind::If( + Box::new(cond), + Block { + stmts: then_block, + }, + else_block.map(|els| Box::new(els.into())), + ), + }) + )); + + named!(expr_for_loop -> ExprKind, do_parse!( + lbl: option!(terminated!(label, punct!(":"))) >> + keyword!("for") >> + pat: pat >> + keyword!("in") >> + expr: expr_no_struct >> + loop_block: block >> + (ExprKind::ForLoop(Box::new(pat), Box::new(expr), loop_block, lbl)) + )); + + named!(expr_loop -> ExprKind, do_parse!( + lbl: option!(terminated!(label, punct!(":"))) >> + keyword!("loop") >> + loop_block: block >> + (ExprKind::Loop(loop_block, lbl)) + )); + + named!(expr_match -> ExprKind, do_parse!( + keyword!("match") >> + obj: expr_no_struct >> + punct!("{") >> + mut arms: many0!(do_parse!( + arm: match_arm >> + cond!(arm_requires_comma(&arm), punct!(",")) >> + cond!(!arm_requires_comma(&arm), option!(punct!(","))) >> + (arm) + )) >> + last_arm: option!(match_arm) >> + punct!("}") >> + (ExprKind::Match(Box::new(obj), { + arms.extend(last_arm); + arms + })) + )); + + fn arm_requires_comma(arm: &Arm) -> bool { + if let ExprKind::Block(Unsafety::Normal, _) = arm.body.node { + false + } else { + true + } + } + + named!(match_arm -> Arm, do_parse!( + attrs: many0!(outer_attr) >> + pats: separated_nonempty_list!(punct!("|"), pat) >> + guard: option!(preceded!(keyword!("if"), expr)) >> + punct!("=>") >> + body: alt!( + map!(block, |blk| ExprKind::Block(Unsafety::Normal, blk).into()) + | + expr + ) >> + (Arm { + attrs: attrs, + pats: pats, + guard: guard.map(Box::new), + body: Box::new(body), + }) + )); + + named_ambiguous_expr!(expr_closure -> ExprKind, allow_struct, do_parse!( + capture: capture_by >> + punct!("|") >> + inputs: terminated_list!(punct!(","), closure_arg) >> + punct!("|") >> + ret_and_body: alt!( + do_parse!( + punct!("->") >> + ty: ty >> + body: block >> + (FunctionRetTy::Ty(ty), ExprKind::Block(Unsafety::Normal, body).into()) + ) + | + map!(ambiguous_expr!(allow_struct), |e| (FunctionRetTy::Default, e)) + ) >> + (ExprKind::Closure( + capture, + Box::new(FnDecl { + inputs: inputs, + output: ret_and_body.0, + variadic: false, + }), + Box::new(ret_and_body.1), + )) + )); + + named!(closure_arg -> FnArg, do_parse!( + pat: pat >> + ty: option!(preceded!(punct!(":"), ty)) >> + (FnArg::Captured(pat, ty.unwrap_or(Ty::Infer))) + )); + + named!(expr_while -> ExprKind, do_parse!( + lbl: option!(terminated!(label, punct!(":"))) >> + keyword!("while") >> + cond: cond >> + while_block: block >> + (match cond { + Cond::Let(pat, expr) => ExprKind::WhileLet( + Box::new(pat), + Box::new(expr), + while_block, + lbl, + ), + Cond::Expr(cond) => ExprKind::While( + Box::new(cond), + while_block, + lbl, + ), + }) + )); + + named!(expr_continue -> ExprKind, do_parse!( + keyword!("continue") >> + lbl: option!(label) >> + (ExprKind::Continue(lbl)) + )); + + named_ambiguous_expr!(expr_break -> ExprKind, allow_struct, do_parse!( + keyword!("break") >> + lbl: option!(label) >> + val: option!(call!(ambiguous_expr, allow_struct, false)) >> + (ExprKind::Break(lbl, val.map(Box::new))) + )); + + named_ambiguous_expr!(expr_ret -> ExprKind, allow_struct, do_parse!( + keyword!("return") >> + ret_value: option!(ambiguous_expr!(allow_struct)) >> + (ExprKind::Ret(ret_value.map(Box::new))) + )); + + named!(expr_struct -> ExprKind, do_parse!( + path: path >> + punct!("{") >> + fields: separated_list!(punct!(","), field_value) >> + base: option!(do_parse!( + cond!(!fields.is_empty(), punct!(",")) >> + punct!("..") >> + base: expr >> + (base) + )) >> + cond!(!fields.is_empty() && base.is_none(), option!(punct!(","))) >> + punct!("}") >> + (ExprKind::Struct(path, fields, base.map(Box::new))) + )); + + named!(field_value -> FieldValue, alt!( + do_parse!( + name: wordlike >> + punct!(":") >> + value: expr >> + (FieldValue { + ident: name, + expr: value, + is_shorthand: false, + }) + ) + | + map!(ident, |name: Ident| FieldValue { + ident: name.clone(), + expr: ExprKind::Path(None, name.into()).into(), + is_shorthand: true, + }) + )); + + named!(expr_repeat -> ExprKind, do_parse!( + punct!("[") >> + value: expr >> + punct!(";") >> + times: expr >> + punct!("]") >> + (ExprKind::Repeat(Box::new(value), Box::new(times))) + )); + + named!(expr_block -> ExprKind, do_parse!( + rules: unsafety >> + b: block >> + (ExprKind::Block(rules, Block { + stmts: b.stmts, + })) + )); + + named_ambiguous_expr!(expr_range -> ExprKind, allow_struct, do_parse!( + limits: range_limits >> + hi: option!(ambiguous_expr!(allow_struct)) >> + (ExprKind::Range(None, hi.map(Box::new), limits)) + )); + + named!(range_limits -> RangeLimits, alt!( + punct!("...") => { |_| RangeLimits::Closed } + | + punct!("..") => { |_| RangeLimits::HalfOpen } + )); + + named!(expr_path -> ExprKind, map!(qpath, |(qself, path)| ExprKind::Path(qself, path))); + + named_ambiguous_expr!(expr_addr_of -> ExprKind, allow_struct, do_parse!( + punct!("&") >> + mutability: mutability >> + expr: ambiguous_expr!(allow_struct) >> + (ExprKind::AddrOf(mutability, Box::new(expr))) + )); + + named_ambiguous_expr!(and_assign -> Expr, allow_struct, preceded!( + punct!("="), + ambiguous_expr!(allow_struct) + )); + + named_ambiguous_expr!(and_assign_op -> (BinOp, Expr), allow_struct, tuple!( + assign_op, + ambiguous_expr!(allow_struct) + )); + + named!(and_field -> Ident, preceded!(punct!("."), ident)); + + named!(and_tup_field -> u64, preceded!(punct!("."), digits)); + + named!(and_index -> Expr, delimited!(punct!("["), expr, punct!("]"))); + + named_ambiguous_expr!(and_range -> (RangeLimits, Option), allow_struct, tuple!( + range_limits, + option!(call!(ambiguous_expr, allow_struct, false)) + )); + + named!(pub block -> Block, do_parse!( + punct!("{") >> + stmts: within_block >> + punct!("}") >> + (Block { + stmts: stmts, + }) + )); + + named!(pub within_block -> Vec, do_parse!( + many0!(punct!(";")) >> + mut standalone: many0!(terminated!(standalone_stmt, many0!(punct!(";")))) >> + last: option!(expr) >> + (match last { + None => standalone, + Some(last) => { + standalone.push(Stmt::Expr(Box::new(last))); + standalone + } + }) + )); + + named!(standalone_stmt -> Stmt, alt!( + stmt_mac + | + stmt_local + | + stmt_item + | + stmt_expr + )); + + named!(stmt_mac -> Stmt, do_parse!( + attrs: many0!(outer_attr) >> + what: path >> + punct!("!") >> + // Only parse braces here; paren and bracket will get parsed as + // expression statements + punct!("{") >> + tts: token_trees >> + punct!("}") >> + semi: option!(punct!(";")) >> + (Stmt::Mac(Box::new(( + Mac { + path: what, + tts: vec![TokenTree::Delimited(Delimited { + delim: DelimToken::Brace, + tts: tts, + })], + }, + if semi.is_some() { + MacStmtStyle::Semicolon + } else { + MacStmtStyle::Braces + }, + attrs, + )))) + )); + + named!(stmt_local -> Stmt, do_parse!( + attrs: many0!(outer_attr) >> + keyword!("let") >> + pat: pat >> + ty: option!(preceded!(punct!(":"), ty)) >> + init: option!(preceded!(punct!("="), expr)) >> + punct!(";") >> + (Stmt::Local(Box::new(Local { + pat: Box::new(pat), + ty: ty.map(Box::new), + init: init.map(Box::new), + attrs: attrs, + }))) + )); + + named!(stmt_item -> Stmt, map!(item, |i| Stmt::Item(Box::new(i)))); + + fn requires_semi(e: &Expr) -> bool { + match e.node { + ExprKind::If(_, _, _) | + ExprKind::IfLet(_, _, _, _) | + ExprKind::While(_, _, _) | + ExprKind::WhileLet(_, _, _, _) | + ExprKind::ForLoop(_, _, _, _) | + ExprKind::Loop(_, _) | + ExprKind::Match(_, _) | + ExprKind::Block(_, _) => false, + + _ => true, + } + } + + named!(stmt_expr -> Stmt, do_parse!( + attrs: many0!(outer_attr) >> + mut e: expr >> + semi: option!(punct!(";")) >> + ({ + e.attrs = attrs; + if semi.is_some() { + Stmt::Semi(Box::new(e)) + } else if requires_semi(&e) { + return Error; + } else { + Stmt::Expr(Box::new(e)) + } + }) + )); + + named!(pub pat -> Pat, alt!( + pat_wild // must be before pat_ident + | + pat_box // must be before pat_ident + | + pat_range // must be before pat_lit + | + pat_tuple_struct // must be before pat_ident + | + pat_struct // must be before pat_ident + | + pat_mac // must be before pat_ident + | + pat_lit // must be before pat_ident + | + pat_ident // must be before pat_path + | + pat_path + | + pat_tuple + | + pat_ref + | + pat_slice + )); + + named!(pat_mac -> Pat, map!(mac, Pat::Mac)); + + named!(pat_wild -> Pat, map!(keyword!("_"), |_| Pat::Wild)); + + named!(pat_box -> Pat, do_parse!( + keyword!("box") >> + pat: pat >> + (Pat::Box(Box::new(pat))) + )); + + named!(pat_ident -> Pat, do_parse!( + mode: option!(keyword!("ref")) >> + mutability: mutability >> + name: alt!( + ident + | + keyword!("self") => { Into::into } + ) >> + not!(peek!(punct!("<"))) >> + not!(peek!(punct!("::"))) >> + subpat: option!(preceded!(punct!("@"), pat)) >> + (Pat::Ident( + if mode.is_some() { + BindingMode::ByRef(mutability) + } else { + BindingMode::ByValue(mutability) + }, + name, + subpat.map(Box::new), + )) + )); + + named!(pat_tuple_struct -> Pat, do_parse!( + path: path >> + tuple: pat_tuple_helper >> + (Pat::TupleStruct(path, tuple.0, tuple.1)) + )); + + named!(pat_struct -> Pat, do_parse!( + path: path >> + punct!("{") >> + fields: separated_list!(punct!(","), field_pat) >> + more: option!(preceded!( + cond!(!fields.is_empty(), punct!(",")), + punct!("..") + )) >> + cond!(!fields.is_empty() && more.is_none(), option!(punct!(","))) >> + punct!("}") >> + (Pat::Struct(path, fields, more.is_some())) + )); + + named!(field_pat -> FieldPat, alt!( + do_parse!( + ident: wordlike >> + punct!(":") >> + pat: pat >> + (FieldPat { + ident: ident, + pat: Box::new(pat), + is_shorthand: false, + }) + ) + | + do_parse!( + boxed: option!(keyword!("box")) >> + mode: option!(keyword!("ref")) >> + mutability: mutability >> + ident: ident >> + ({ + let mut pat = Pat::Ident( + if mode.is_some() { + BindingMode::ByRef(mutability) + } else { + BindingMode::ByValue(mutability) + }, + ident.clone(), + None, + ); + if boxed.is_some() { + pat = Pat::Box(Box::new(pat)); + } + FieldPat { + ident: ident, + pat: Box::new(pat), + is_shorthand: true, + } + }) + ) + )); + + named!(pat_path -> Pat, map!(qpath, |(qself, path)| Pat::Path(qself, path))); + + named!(pat_tuple -> Pat, map!( + pat_tuple_helper, + |(pats, dotdot)| Pat::Tuple(pats, dotdot) + )); + + named!(pat_tuple_helper -> (Vec, Option), do_parse!( + punct!("(") >> + mut elems: separated_list!(punct!(","), pat) >> + dotdot: option!(do_parse!( + cond!(!elems.is_empty(), punct!(",")) >> + punct!("..") >> + rest: many0!(preceded!(punct!(","), pat)) >> + cond!(!rest.is_empty(), option!(punct!(","))) >> + (rest) + )) >> + cond!(!elems.is_empty() && dotdot.is_none(), option!(punct!(","))) >> + punct!(")") >> + (match dotdot { + Some(rest) => { + let pos = elems.len(); + elems.extend(rest); + (elems, Some(pos)) + } + None => (elems, None), + }) + )); + + named!(pat_ref -> Pat, do_parse!( + punct!("&") >> + mutability: mutability >> + pat: pat >> + (Pat::Ref(Box::new(pat), mutability)) + )); + + named!(pat_lit -> Pat, do_parse!( + lit: pat_lit_expr >> + (if let ExprKind::Path(_, _) = lit.node { + return IResult::Error; // these need to be parsed by pat_path + } else { + Pat::Lit(Box::new(lit)) + }) + )); + + named!(pat_range -> Pat, do_parse!( + lo: pat_lit_expr >> + punct!("...") >> + hi: pat_lit_expr >> + (Pat::Range(Box::new(lo), Box::new(hi))) + )); + + named!(pat_lit_expr -> Expr, do_parse!( + neg: option!(punct!("-")) >> + v: alt!( + lit => { ExprKind::Lit } + | + path => { |p| ExprKind::Path(None, p) } + ) >> + (if neg.is_some() { + ExprKind::Unary(UnOp::Neg, Box::new(v.into())).into() + } else { + v.into() + }) + )); + + named!(pat_slice -> Pat, do_parse!( + punct!("[") >> + mut before: separated_list!(punct!(","), pat) >> + after: option!(do_parse!( + comma_before_dots: option!(cond_reduce!(!before.is_empty(), punct!(","))) >> + punct!("..") >> + after: many0!(preceded!(punct!(","), pat)) >> + cond!(!after.is_empty(), option!(punct!(","))) >> + (comma_before_dots.is_some(), after) + )) >> + cond!(after.is_none(), option!(punct!(","))) >> + punct!("]") >> + (match after { + None => Pat::Slice(before, None, Vec::new()), + Some((true, after)) => { + if before.is_empty() { + return IResult::Error; + } + Pat::Slice(before, Some(Box::new(Pat::Wild)), after) + } + Some((false, after)) => { + let rest = before.pop().unwrap_or(Pat::Wild); + Pat::Slice(before, Some(Box::new(rest)), after) + } + }) + )); + + named!(capture_by -> CaptureBy, alt!( + keyword!("move") => { |_| CaptureBy::Value } + | + epsilon!() => { |_| CaptureBy::Ref } + )); + + named!(label -> Ident, map!(lifetime, |lt: Lifetime| lt.ident)); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use {FnArg, FunctionRetTy, Mutability, Ty, Unsafety}; + use attr::FilterAttrs; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Expr { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + match self.node { + ExprKind::Box(ref inner) => { + tokens.append("box"); + inner.to_tokens(tokens); + } + ExprKind::InPlace(ref place, ref value) => { + tokens.append("in"); + place.to_tokens(tokens); + value.to_tokens(tokens); + } + ExprKind::Vec(ref tys) => { + tokens.append("["); + tokens.append_separated(tys, ","); + tokens.append("]"); + } + ExprKind::Call(ref func, ref args) => { + func.to_tokens(tokens); + tokens.append("("); + tokens.append_separated(args, ","); + tokens.append(")"); + } + ExprKind::MethodCall(ref ident, ref ascript, ref args) => { + args[0].to_tokens(tokens); + tokens.append("."); + ident.to_tokens(tokens); + if !ascript.is_empty() { + tokens.append("::"); + tokens.append("<"); + tokens.append_separated(ascript, ","); + tokens.append(">"); + } + tokens.append("("); + tokens.append_separated(&args[1..], ","); + tokens.append(")"); + } + ExprKind::Tup(ref fields) => { + tokens.append("("); + tokens.append_separated(fields, ","); + if fields.len() == 1 { + tokens.append(","); + } + tokens.append(")"); + } + ExprKind::Binary(op, ref left, ref right) => { + left.to_tokens(tokens); + op.to_tokens(tokens); + right.to_tokens(tokens); + } + ExprKind::Unary(op, ref expr) => { + op.to_tokens(tokens); + expr.to_tokens(tokens); + } + ExprKind::Lit(ref lit) => lit.to_tokens(tokens), + ExprKind::Cast(ref expr, ref ty) => { + expr.to_tokens(tokens); + tokens.append("as"); + ty.to_tokens(tokens); + } + ExprKind::Type(ref expr, ref ty) => { + expr.to_tokens(tokens); + tokens.append(":"); + ty.to_tokens(tokens); + } + ExprKind::If(ref cond, ref then_block, ref else_block) => { + tokens.append("if"); + cond.to_tokens(tokens); + then_block.to_tokens(tokens); + if let Some(ref else_block) = *else_block { + tokens.append("else"); + else_block.to_tokens(tokens); + } + } + ExprKind::IfLet(ref pat, ref expr, ref then_block, ref else_block) => { + tokens.append("if"); + tokens.append("let"); + pat.to_tokens(tokens); + tokens.append("="); + expr.to_tokens(tokens); + then_block.to_tokens(tokens); + if let Some(ref else_block) = *else_block { + tokens.append("else"); + else_block.to_tokens(tokens); + } + } + ExprKind::While(ref cond, ref body, ref label) => { + if let Some(ref label) = *label { + label.to_tokens(tokens); + tokens.append(":"); + } + tokens.append("while"); + cond.to_tokens(tokens); + body.to_tokens(tokens); + } + ExprKind::WhileLet(ref pat, ref expr, ref body, ref label) => { + if let Some(ref label) = *label { + label.to_tokens(tokens); + tokens.append(":"); + } + tokens.append("while"); + tokens.append("let"); + pat.to_tokens(tokens); + tokens.append("="); + expr.to_tokens(tokens); + body.to_tokens(tokens); + } + ExprKind::ForLoop(ref pat, ref expr, ref body, ref label) => { + if let Some(ref label) = *label { + label.to_tokens(tokens); + tokens.append(":"); + } + tokens.append("for"); + pat.to_tokens(tokens); + tokens.append("in"); + expr.to_tokens(tokens); + body.to_tokens(tokens); + } + ExprKind::Loop(ref body, ref label) => { + if let Some(ref label) = *label { + label.to_tokens(tokens); + tokens.append(":"); + } + tokens.append("loop"); + body.to_tokens(tokens); + } + ExprKind::Match(ref expr, ref arms) => { + tokens.append("match"); + expr.to_tokens(tokens); + tokens.append("{"); + tokens.append_all(arms); + tokens.append("}"); + } + ExprKind::Closure(capture, ref decl, ref expr) => { + capture.to_tokens(tokens); + tokens.append("|"); + for (i, input) in decl.inputs.iter().enumerate() { + if i > 0 { + tokens.append(","); + } + match *input { + FnArg::Captured(ref pat, Ty::Infer) => { + pat.to_tokens(tokens); + } + _ => input.to_tokens(tokens), + } + } + tokens.append("|"); + match decl.output { + FunctionRetTy::Default => { /* nothing */ } + FunctionRetTy::Ty(ref ty) => { + tokens.append("->"); + ty.to_tokens(tokens); + } + } + expr.to_tokens(tokens); + } + ExprKind::Block(rules, ref block) => { + rules.to_tokens(tokens); + block.to_tokens(tokens); + } + ExprKind::Assign(ref var, ref expr) => { + var.to_tokens(tokens); + tokens.append("="); + expr.to_tokens(tokens); + } + ExprKind::AssignOp(op, ref var, ref expr) => { + var.to_tokens(tokens); + tokens.append(op.assign_op().unwrap()); + expr.to_tokens(tokens); + } + ExprKind::Field(ref expr, ref field) => { + expr.to_tokens(tokens); + tokens.append("."); + field.to_tokens(tokens); + } + ExprKind::TupField(ref expr, field) => { + expr.to_tokens(tokens); + tokens.append("."); + tokens.append(&field.to_string()); + } + ExprKind::Index(ref expr, ref index) => { + expr.to_tokens(tokens); + tokens.append("["); + index.to_tokens(tokens); + tokens.append("]"); + } + ExprKind::Range(ref from, ref to, limits) => { + from.to_tokens(tokens); + match limits { + RangeLimits::HalfOpen => tokens.append(".."), + RangeLimits::Closed => tokens.append("..."), + } + to.to_tokens(tokens); + } + ExprKind::Path(None, ref path) => path.to_tokens(tokens), + ExprKind::Path(Some(ref qself), ref path) => { + tokens.append("<"); + qself.ty.to_tokens(tokens); + if qself.position > 0 { + tokens.append("as"); + for (i, segment) in path.segments + .iter() + .take(qself.position) + .enumerate() { + if i > 0 || path.global { + tokens.append("::"); + } + segment.to_tokens(tokens); + } + } + tokens.append(">"); + for segment in path.segments.iter().skip(qself.position) { + tokens.append("::"); + segment.to_tokens(tokens); + } + } + ExprKind::AddrOf(mutability, ref expr) => { + tokens.append("&"); + mutability.to_tokens(tokens); + expr.to_tokens(tokens); + } + ExprKind::Break(ref opt_label, ref opt_val) => { + tokens.append("break"); + opt_label.to_tokens(tokens); + opt_val.to_tokens(tokens); + } + ExprKind::Continue(ref opt_label) => { + tokens.append("continue"); + opt_label.to_tokens(tokens); + } + ExprKind::Ret(ref opt_expr) => { + tokens.append("return"); + opt_expr.to_tokens(tokens); + } + ExprKind::Mac(ref mac) => mac.to_tokens(tokens), + ExprKind::Struct(ref path, ref fields, ref base) => { + path.to_tokens(tokens); + tokens.append("{"); + tokens.append_separated(fields, ","); + if let Some(ref base) = *base { + if !fields.is_empty() { + tokens.append(","); + } + tokens.append(".."); + base.to_tokens(tokens); + } + tokens.append("}"); + } + ExprKind::Repeat(ref expr, ref times) => { + tokens.append("["); + expr.to_tokens(tokens); + tokens.append(";"); + times.to_tokens(tokens); + tokens.append("]"); + } + ExprKind::Paren(ref expr) => { + tokens.append("("); + expr.to_tokens(tokens); + tokens.append(")"); + } + ExprKind::Try(ref expr) => { + expr.to_tokens(tokens); + tokens.append("?"); + } + } + } + } + + impl ToTokens for FieldValue { + fn to_tokens(&self, tokens: &mut Tokens) { + self.ident.to_tokens(tokens); + if !self.is_shorthand { + tokens.append(":"); + self.expr.to_tokens(tokens); + } + } + } + + impl ToTokens for Arm { + fn to_tokens(&self, tokens: &mut Tokens) { + for attr in &self.attrs { + attr.to_tokens(tokens); + } + tokens.append_separated(&self.pats, "|"); + if let Some(ref guard) = self.guard { + tokens.append("if"); + guard.to_tokens(tokens); + } + tokens.append("=>"); + self.body.to_tokens(tokens); + match self.body.node { + ExprKind::Block(Unsafety::Normal, _) => { + // no comma + } + _ => tokens.append(","), + } + } + } + + impl ToTokens for Pat { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Pat::Wild => tokens.append("_"), + Pat::Ident(mode, ref ident, ref subpat) => { + mode.to_tokens(tokens); + ident.to_tokens(tokens); + if let Some(ref subpat) = *subpat { + tokens.append("@"); + subpat.to_tokens(tokens); + } + } + Pat::Struct(ref path, ref fields, dots) => { + path.to_tokens(tokens); + tokens.append("{"); + tokens.append_separated(fields, ","); + if dots { + if !fields.is_empty() { + tokens.append(","); + } + tokens.append(".."); + } + tokens.append("}"); + } + Pat::TupleStruct(ref path, ref pats, dotpos) => { + path.to_tokens(tokens); + tokens.append("("); + match dotpos { + Some(pos) => { + if pos > 0 { + tokens.append_separated(&pats[..pos], ","); + tokens.append(","); + } + tokens.append(".."); + if pos < pats.len() { + tokens.append(","); + tokens.append_separated(&pats[pos..], ","); + } + } + None => tokens.append_separated(pats, ","), + } + tokens.append(")"); + } + Pat::Path(None, ref path) => path.to_tokens(tokens), + Pat::Path(Some(ref qself), ref path) => { + tokens.append("<"); + qself.ty.to_tokens(tokens); + if qself.position > 0 { + tokens.append("as"); + for (i, segment) in path.segments + .iter() + .take(qself.position) + .enumerate() { + if i > 0 || path.global { + tokens.append("::"); + } + segment.to_tokens(tokens); + } + } + tokens.append(">"); + for segment in path.segments.iter().skip(qself.position) { + tokens.append("::"); + segment.to_tokens(tokens); + } + } + Pat::Tuple(ref pats, dotpos) => { + tokens.append("("); + match dotpos { + Some(pos) => { + if pos > 0 { + tokens.append_separated(&pats[..pos], ","); + tokens.append(","); + } + tokens.append(".."); + if pos < pats.len() { + tokens.append(","); + tokens.append_separated(&pats[pos..], ","); + } + } + None => { + tokens.append_separated(pats, ","); + if pats.len() == 1 { + tokens.append(","); + } + } + } + tokens.append(")"); + } + Pat::Box(ref inner) => { + tokens.append("box"); + inner.to_tokens(tokens); + } + Pat::Ref(ref target, mutability) => { + tokens.append("&"); + mutability.to_tokens(tokens); + target.to_tokens(tokens); + } + Pat::Lit(ref lit) => lit.to_tokens(tokens), + Pat::Range(ref lo, ref hi) => { + lo.to_tokens(tokens); + tokens.append("..."); + hi.to_tokens(tokens); + } + Pat::Slice(ref before, ref rest, ref after) => { + tokens.append("["); + tokens.append_separated(before, ","); + if let Some(ref rest) = *rest { + if !before.is_empty() { + tokens.append(","); + } + if **rest != Pat::Wild { + rest.to_tokens(tokens); + } + tokens.append(".."); + if !after.is_empty() { + tokens.append(","); + } + tokens.append_separated(after, ","); + } + tokens.append("]"); + } + Pat::Mac(ref mac) => mac.to_tokens(tokens), + } + } + } + + impl ToTokens for FieldPat { + fn to_tokens(&self, tokens: &mut Tokens) { + if !self.is_shorthand { + self.ident.to_tokens(tokens); + tokens.append(":"); + } + self.pat.to_tokens(tokens); + } + } + + impl ToTokens for BindingMode { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + BindingMode::ByRef(Mutability::Immutable) => { + tokens.append("ref"); + } + BindingMode::ByRef(Mutability::Mutable) => { + tokens.append("ref"); + tokens.append("mut"); + } + BindingMode::ByValue(Mutability::Immutable) => {} + BindingMode::ByValue(Mutability::Mutable) => { + tokens.append("mut"); + } + } + } + } + + impl ToTokens for CaptureBy { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + CaptureBy::Value => tokens.append("move"), + CaptureBy::Ref => { + // nothing + } + } + } + } + + impl ToTokens for Block { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append("{"); + tokens.append_all(&self.stmts); + tokens.append("}"); + } + } + + impl ToTokens for Stmt { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Stmt::Local(ref local) => local.to_tokens(tokens), + Stmt::Item(ref item) => item.to_tokens(tokens), + Stmt::Expr(ref expr) => expr.to_tokens(tokens), + Stmt::Semi(ref expr) => { + expr.to_tokens(tokens); + tokens.append(";"); + } + Stmt::Mac(ref mac) => { + let (ref mac, style, ref attrs) = **mac; + tokens.append_all(attrs.outer()); + mac.to_tokens(tokens); + match style { + MacStmtStyle::Semicolon => tokens.append(";"), + MacStmtStyle::Braces | MacStmtStyle::NoBraces => { + // no semicolon + } + } + } + } + } + } + + impl ToTokens for Local { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + tokens.append("let"); + self.pat.to_tokens(tokens); + if let Some(ref ty) = self.ty { + tokens.append(":"); + ty.to_tokens(tokens); + } + if let Some(ref init) = self.init { + tokens.append("="); + init.to_tokens(tokens); + } + tokens.append(";"); + } + } +} diff --git a/third_party/rust/syn/src/generics.rs b/third_party/rust/syn/src/generics.rs new file mode 100644 index 000000000000..d76051f4089b --- /dev/null +++ b/third_party/rust/syn/src/generics.rs @@ -0,0 +1,446 @@ +use super::*; + +/// Represents lifetimes and type parameters attached to a declaration +/// of a function, enum, trait, etc. +#[derive(Debug, Clone, Eq, PartialEq, Default, Hash)] +pub struct Generics { + pub lifetimes: Vec, + pub ty_params: Vec, + pub where_clause: WhereClause, +} + +#[cfg(feature = "printing")] +/// Returned by `Generics::split_for_impl`. +#[derive(Debug)] +pub struct ImplGenerics<'a>(&'a Generics); + +#[cfg(feature = "printing")] +/// Returned by `Generics::split_for_impl`. +#[derive(Debug)] +pub struct TyGenerics<'a>(&'a Generics); + +impl Generics { + #[cfg(feature = "printing")] + /// Split a type's generics into the pieces required for impl'ing a trait + /// for that type. + /// + /// ``` + /// # extern crate syn; + /// # #[macro_use] + /// # extern crate quote; + /// # fn main() { + /// # let generics: syn::Generics = Default::default(); + /// # let name = syn::Ident::new("MyType"); + /// let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + /// quote! { + /// impl #impl_generics MyTrait for #name #ty_generics #where_clause { + /// // ... + /// } + /// } + /// # ; + /// # } + /// ``` + pub fn split_for_impl(&self) -> (ImplGenerics, TyGenerics, &WhereClause) { + (ImplGenerics(self), TyGenerics(self), &self.where_clause) + } +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Lifetime { + pub ident: Ident, +} + +impl Lifetime { + pub fn new>(t: T) -> Self { + let id = Ident::new(t); + if !id.as_ref().starts_with('\'') { + panic!("lifetime name must start with apostrophe as in \"'a\", \ + got {:?}", + id.as_ref()); + } + Lifetime { ident: id } + } +} + +/// A lifetime definition, e.g. `'a: 'b+'c+'d` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct LifetimeDef { + pub attrs: Vec, + pub lifetime: Lifetime, + pub bounds: Vec, +} + +impl LifetimeDef { + pub fn new>(t: T) -> Self { + LifetimeDef { + attrs: Vec::new(), + lifetime: Lifetime::new(t), + bounds: Vec::new(), + } + } +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct TyParam { + pub attrs: Vec, + pub ident: Ident, + pub bounds: Vec, + pub default: Option, +} + +/// The AST represents all type param bounds as types. +/// `typeck::collect::compute_bounds` matches these against +/// the "special" built-in traits (see `middle::lang_items`) and +/// detects Copy, Send and Sync. +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum TyParamBound { + Trait(PolyTraitRef, TraitBoundModifier), + Region(Lifetime), +} + +/// A modifier on a bound, currently this is only used for `?Sized`, where the +/// modifier is `Maybe`. Negative bounds should also be handled here. +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum TraitBoundModifier { + None, + Maybe, +} + +/// A `where` clause in a definition +#[derive(Debug, Clone, Eq, PartialEq, Default, Hash)] +pub struct WhereClause { + pub predicates: Vec, +} + +impl WhereClause { + pub fn none() -> Self { + WhereClause { predicates: Vec::new() } + } +} + +/// A single predicate in a `where` clause +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum WherePredicate { + /// A type binding, e.g. `for<'c> Foo: Send+Clone+'c` + BoundPredicate(WhereBoundPredicate), + /// A lifetime predicate, e.g. `'a: 'b+'c` + RegionPredicate(WhereRegionPredicate), +} + +/// A type bound. +/// +/// E.g. `for<'c> Foo: Send+Clone+'c` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct WhereBoundPredicate { + /// Any lifetimes from a `for` binding + pub bound_lifetimes: Vec, + /// The type being bounded + pub bounded_ty: Ty, + /// Trait and lifetime bounds (`Clone+Send+'static`) + pub bounds: Vec, +} + +/// A lifetime predicate. +/// +/// E.g. `'a: 'b+'c` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct WhereRegionPredicate { + pub lifetime: Lifetime, + pub bounds: Vec, +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use attr::parsing::outer_attr; + use ident::parsing::ident; + use ty::parsing::{ty, poly_trait_ref}; + + named!(pub generics -> Generics, map!( + alt!( + do_parse!( + punct!("<") >> + lifetimes: separated_list!(punct!(","), lifetime_def) >> + ty_params: opt_vec!(preceded!( + cond!(!lifetimes.is_empty(), punct!(",")), + separated_nonempty_list!(punct!(","), ty_param) + )) >> + cond!(!lifetimes.is_empty() || !ty_params.is_empty(), option!(punct!(","))) >> + punct!(">") >> + (lifetimes, ty_params) + ) + | + epsilon!() => { |_| (Vec::new(), Vec::new()) } + ), + |(lifetimes, ty_params)| Generics { + lifetimes: lifetimes, + ty_params: ty_params, + where_clause: Default::default(), + } + )); + + named!(pub lifetime -> Lifetime, preceded!( + punct!("'"), + alt!( + map!(ident, |id| Lifetime { + ident: format!("'{}", id).into(), + }) + | + map!(keyword!("static"), |_| Lifetime { + ident: "'static".into(), + }) + ) + )); + + named!(pub lifetime_def -> LifetimeDef, do_parse!( + attrs: many0!(outer_attr) >> + life: lifetime >> + bounds: opt_vec!(preceded!( + punct!(":"), + separated_list!(punct!("+"), lifetime) + )) >> + (LifetimeDef { + attrs: attrs, + lifetime: life, + bounds: bounds, + }) + )); + + named!(pub bound_lifetimes -> Vec, opt_vec!(do_parse!( + keyword!("for") >> + punct!("<") >> + lifetimes: terminated_list!(punct!(","), lifetime_def) >> + punct!(">") >> + (lifetimes) + ))); + + named!(ty_param -> TyParam, do_parse!( + attrs: many0!(outer_attr) >> + id: ident >> + bounds: opt_vec!(preceded!( + punct!(":"), + separated_nonempty_list!(punct!("+"), ty_param_bound) + )) >> + default: option!(preceded!( + punct!("="), + ty + )) >> + (TyParam { + attrs: attrs, + ident: id, + bounds: bounds, + default: default, + }) + )); + + named!(pub ty_param_bound -> TyParamBound, alt!( + preceded!(punct!("?"), poly_trait_ref) => { + |poly| TyParamBound::Trait(poly, TraitBoundModifier::Maybe) + } + | + lifetime => { TyParamBound::Region } + | + poly_trait_ref => { + |poly| TyParamBound::Trait(poly, TraitBoundModifier::None) + } + )); + + named!(pub where_clause -> WhereClause, alt!( + do_parse!( + keyword!("where") >> + predicates: separated_nonempty_list!(punct!(","), where_predicate) >> + option!(punct!(",")) >> + (WhereClause { predicates: predicates }) + ) + | + epsilon!() => { |_| Default::default() } + )); + + named!(where_predicate -> WherePredicate, alt!( + do_parse!( + ident: lifetime >> + bounds: opt_vec!(preceded!( + punct!(":"), + separated_list!(punct!("+"), lifetime) + )) >> + (WherePredicate::RegionPredicate(WhereRegionPredicate { + lifetime: ident, + bounds: bounds, + })) + ) + | + do_parse!( + bound_lifetimes: bound_lifetimes >> + bounded_ty: ty >> + punct!(":") >> + bounds: separated_nonempty_list!(punct!("+"), ty_param_bound) >> + (WherePredicate::BoundPredicate(WhereBoundPredicate { + bound_lifetimes: bound_lifetimes, + bounded_ty: bounded_ty, + bounds: bounds, + })) + ) + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use attr::FilterAttrs; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Generics { + fn to_tokens(&self, tokens: &mut Tokens) { + let has_lifetimes = !self.lifetimes.is_empty(); + let has_ty_params = !self.ty_params.is_empty(); + if has_lifetimes || has_ty_params { + tokens.append("<"); + tokens.append_separated(&self.lifetimes, ","); + if has_lifetimes && has_ty_params { + tokens.append(","); + } + tokens.append_separated(&self.ty_params, ","); + tokens.append(">"); + } + } + } + + impl<'a> ToTokens for ImplGenerics<'a> { + fn to_tokens(&self, tokens: &mut Tokens) { + let has_lifetimes = !self.0.lifetimes.is_empty(); + let has_ty_params = !self.0.ty_params.is_empty(); + if has_lifetimes || has_ty_params { + tokens.append("<"); + tokens.append_separated(&self.0.lifetimes, ","); + // Leave off the type parameter defaults + for (i, ty_param) in self.0.ty_params.iter().enumerate() { + if i > 0 || has_lifetimes { + tokens.append(","); + } + tokens.append_all(ty_param.attrs.outer()); + ty_param.ident.to_tokens(tokens); + if !ty_param.bounds.is_empty() { + tokens.append(":"); + tokens.append_separated(&ty_param.bounds, "+"); + } + } + tokens.append(">"); + } + } + } + + impl<'a> ToTokens for TyGenerics<'a> { + fn to_tokens(&self, tokens: &mut Tokens) { + let has_lifetimes = !self.0.lifetimes.is_empty(); + let has_ty_params = !self.0.ty_params.is_empty(); + if has_lifetimes || has_ty_params { + tokens.append("<"); + // Leave off the lifetime bounds and attributes + let lifetimes = self.0.lifetimes.iter().map(|ld| &ld.lifetime); + tokens.append_separated(lifetimes, ","); + if has_lifetimes && has_ty_params { + tokens.append(","); + } + // Leave off the type parameter bounds, defaults, and attributes + let ty_params = self.0.ty_params.iter().map(|tp| &tp.ident); + tokens.append_separated(ty_params, ","); + tokens.append(">"); + } + } + } + + impl ToTokens for Lifetime { + fn to_tokens(&self, tokens: &mut Tokens) { + self.ident.to_tokens(tokens); + } + } + + impl ToTokens for LifetimeDef { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + self.lifetime.to_tokens(tokens); + if !self.bounds.is_empty() { + tokens.append(":"); + tokens.append_separated(&self.bounds, "+"); + } + } + } + + impl ToTokens for TyParam { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + self.ident.to_tokens(tokens); + if !self.bounds.is_empty() { + tokens.append(":"); + tokens.append_separated(&self.bounds, "+"); + } + if let Some(ref default) = self.default { + tokens.append("="); + default.to_tokens(tokens); + } + } + } + + impl ToTokens for TyParamBound { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + TyParamBound::Region(ref lifetime) => lifetime.to_tokens(tokens), + TyParamBound::Trait(ref trait_ref, modifier) => { + match modifier { + TraitBoundModifier::None => {} + TraitBoundModifier::Maybe => tokens.append("?"), + } + trait_ref.to_tokens(tokens); + } + } + } + } + + impl ToTokens for WhereClause { + fn to_tokens(&self, tokens: &mut Tokens) { + if !self.predicates.is_empty() { + tokens.append("where"); + tokens.append_separated(&self.predicates, ","); + } + } + } + + impl ToTokens for WherePredicate { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + WherePredicate::BoundPredicate(ref predicate) => { + predicate.to_tokens(tokens); + } + WherePredicate::RegionPredicate(ref predicate) => { + predicate.to_tokens(tokens); + } + } + } + } + + impl ToTokens for WhereBoundPredicate { + fn to_tokens(&self, tokens: &mut Tokens) { + if !self.bound_lifetimes.is_empty() { + tokens.append("for"); + tokens.append("<"); + tokens.append_separated(&self.bound_lifetimes, ","); + tokens.append(">"); + } + self.bounded_ty.to_tokens(tokens); + if !self.bounds.is_empty() { + tokens.append(":"); + tokens.append_separated(&self.bounds, "+"); + } + } + } + + impl ToTokens for WhereRegionPredicate { + fn to_tokens(&self, tokens: &mut Tokens) { + self.lifetime.to_tokens(tokens); + if !self.bounds.is_empty() { + tokens.append(":"); + tokens.append_separated(&self.bounds, "+"); + } + } + } +} diff --git a/third_party/rust/syn/src/helper.rs b/third_party/rust/syn/src/helper.rs new file mode 100644 index 000000000000..bf199713a4dd --- /dev/null +++ b/third_party/rust/syn/src/helper.rs @@ -0,0 +1,137 @@ +use nom::IResult; +use space::{skip_whitespace, word_break}; + +macro_rules! punct { + ($i:expr, $punct:expr) => { + $crate::helper::punct($i, $punct) + }; +} + +pub fn punct<'a>(input: &'a str, token: &'static str) -> IResult<&'a str, &'a str> { + let input = skip_whitespace(input); + if input.starts_with(token) { + IResult::Done(&input[token.len()..], token) + } else { + IResult::Error + } +} + +macro_rules! keyword { + ($i:expr, $keyword:expr) => { + $crate::helper::keyword($i, $keyword) + }; +} + +pub fn keyword<'a>(input: &'a str, token: &'static str) -> IResult<&'a str, &'a str> { + match punct(input, token) { + IResult::Done(rest, _) => { + match word_break(rest) { + IResult::Done(_, _) => IResult::Done(rest, token), + IResult::Error => IResult::Error, + } + } + IResult::Error => IResult::Error, + } +} + +macro_rules! option { + ($i:expr, $submac:ident!( $($args:tt)* )) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Done(i, o) => $crate::nom::IResult::Done(i, Some(o)), + $crate::nom::IResult::Error => $crate::nom::IResult::Done($i, None), + } + }; + + ($i:expr, $f:expr) => { + option!($i, call!($f)); + }; +} + +macro_rules! opt_vec { + ($i:expr, $submac:ident!( $($args:tt)* )) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Done(i, o) => $crate::nom::IResult::Done(i, o), + $crate::nom::IResult::Error => $crate::nom::IResult::Done($i, Vec::new()), + } + }; +} + +macro_rules! epsilon { + ($i:expr,) => { + $crate::nom::IResult::Done($i, ()) + }; +} + +macro_rules! tap { + ($i:expr, $name:ident : $submac:ident!( $($args:tt)* ) => $e:expr) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Done(i, o) => { + let $name = o; + $e; + $crate::nom::IResult::Done(i, ()) + } + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + } + }; + + ($i:expr, $name:ident : $f:expr => $e:expr) => { + tap!($i, $name: call!($f) => $e); + }; +} + +macro_rules! separated_list { + ($i:expr, punct!($sep:expr), $f:expr) => { + $crate::helper::separated_list($i, $sep, $f, false) + }; +} + +macro_rules! terminated_list { + ($i:expr, punct!($sep:expr), $f:expr) => { + $crate::helper::separated_list($i, $sep, $f, true) + }; +} + +pub fn separated_list<'a, T>(mut input: &'a str, + sep: &'static str, + f: fn(&'a str) -> IResult<&'a str, T>, + terminated: bool) + -> IResult<&'a str, Vec> { + let mut res = Vec::new(); + + // get the first element + match f(input) { + IResult::Error => IResult::Done(input, Vec::new()), + IResult::Done(i, o) => { + if i.len() == input.len() { + IResult::Error + } else { + res.push(o); + input = i; + + // get the separator first + while let IResult::Done(i2, _) = punct(input, sep) { + if i2.len() == input.len() { + break; + } + + // get the element next + if let IResult::Done(i3, o3) = f(i2) { + if i3.len() == i2.len() { + break; + } + res.push(o3); + input = i3; + } else { + break; + } + } + if terminated { + if let IResult::Done(after, _) = punct(input, sep) { + input = after; + } + } + IResult::Done(input, res) + } + } + } +} diff --git a/third_party/rust/syn/src/ident.rs b/third_party/rust/syn/src/ident.rs new file mode 100644 index 000000000000..3657add365e3 --- /dev/null +++ b/third_party/rust/syn/src/ident.rs @@ -0,0 +1,129 @@ +use std::borrow::Cow; +use std::fmt::{self, Display}; + +#[derive(Debug, Clone, Eq, Hash)] +pub struct Ident(String); + +impl Ident { + pub fn new>(t: T) -> Self { + t.into() + } +} + +impl<'a> From<&'a str> for Ident { + fn from(s: &str) -> Self { + Ident(s.to_owned()) + } +} + +impl<'a> From> for Ident { + fn from(s: Cow<'a, str>) -> Self { + Ident(s.into_owned()) + } +} + +impl From for Ident { + fn from(s: String) -> Self { + Ident(s) + } +} + +impl From for Ident { + fn from(u: usize) -> Self { + Ident(u.to_string()) + } +} + +impl AsRef for Ident { + fn as_ref(&self) -> &str { + &self.0 + } +} + +impl Display for Ident { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + self.0.fmt(formatter) + } +} + +impl PartialEq for Ident + where T: AsRef +{ + fn eq(&self, other: &T) -> bool { + self.0 == other.as_ref() + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use nom::IResult; + use space::skip_whitespace; + use unicode_xid::UnicodeXID; + + pub fn ident(input: &str) -> IResult<&str, Ident> { + let (rest, id) = match word(input) { + IResult::Done(rest, id) => (rest, id), + IResult::Error => return IResult::Error, + }; + + match id.as_ref() { + // From https://doc.rust-lang.org/grammar.html#keywords + "abstract" | "alignof" | "as" | "become" | "box" | "break" | "const" | "continue" | + "crate" | "do" | "else" | "enum" | "extern" | "false" | "final" | "fn" | "for" | + "if" | "impl" | "in" | "let" | "loop" | "macro" | "match" | "mod" | "move" | + "mut" | "offsetof" | "override" | "priv" | "proc" | "pub" | "pure" | "ref" | + "return" | "Self" | "self" | "sizeof" | "static" | "struct" | "super" | "trait" | + "true" | "type" | "typeof" | "unsafe" | "unsized" | "use" | "virtual" | "where" | + "while" | "yield" => IResult::Error, + _ => IResult::Done(rest, id), + } + } + + pub fn word(mut input: &str) -> IResult<&str, Ident> { + input = skip_whitespace(input); + + let mut chars = input.char_indices(); + match chars.next() { + Some((_, ch)) if UnicodeXID::is_xid_start(ch) || ch == '_' => {} + _ => return IResult::Error, + } + + while let Some((i, ch)) = chars.next() { + if !UnicodeXID::is_xid_continue(ch) { + return IResult::Done(&input[i..], input[..i].into()); + } + } + + IResult::Done("", input.into()) + } + + #[cfg(feature = "full")] + pub fn wordlike(mut input: &str) -> IResult<&str, Ident> { + input = skip_whitespace(input); + + for (i, ch) in input.char_indices() { + if !UnicodeXID::is_xid_start(ch) && !UnicodeXID::is_xid_continue(ch) { + return if i == 0 { + IResult::Error + } else { + IResult::Done(&input[i..], input[..i].into()) + }; + } + } + + IResult::Done("", input.into()) + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Ident { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(self.as_ref()) + } + } +} diff --git a/third_party/rust/syn/src/item.rs b/third_party/rust/syn/src/item.rs new file mode 100644 index 000000000000..654964f614cd --- /dev/null +++ b/third_party/rust/syn/src/item.rs @@ -0,0 +1,1477 @@ +use super::*; + +/// An item +/// +/// The name might be a dummy name in case of anonymous items +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Item { + pub ident: Ident, + pub vis: Visibility, + pub attrs: Vec, + pub node: ItemKind, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum ItemKind { + /// An`extern crate` item, with optional original crate name. + /// + /// E.g. `extern crate foo` or `extern crate foo_bar as foo` + ExternCrate(Option), + /// A use declaration (`use` or `pub use`) item. + /// + /// E.g. `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;` + Use(Box), + /// A static item (`static` or `pub static`). + /// + /// E.g. `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";` + Static(Box, Mutability, Box), + /// A constant item (`const` or `pub const`). + /// + /// E.g. `const FOO: i32 = 42;` + Const(Box, Box), + /// A function declaration (`fn` or `pub fn`). + /// + /// E.g. `fn foo(bar: usize) -> usize { .. }` + Fn(Box, Unsafety, Constness, Option, Generics, Box), + /// A module declaration (`mod` or `pub mod`). + /// + /// E.g. `mod foo;` or `mod foo { .. }` + Mod(Option>), + /// An external module (`extern` or `pub extern`). + /// + /// E.g. `extern {}` or `extern "C" {}` + ForeignMod(ForeignMod), + /// A type alias (`type` or `pub type`). + /// + /// E.g. `type Foo = Bar;` + Ty(Box, Generics), + /// An enum definition (`enum` or `pub enum`). + /// + /// E.g. `enum Foo { C, D }` + Enum(Vec, Generics), + /// A struct definition (`struct` or `pub struct`). + /// + /// E.g. `struct Foo { x: A }` + Struct(VariantData, Generics), + /// A union definition (`union` or `pub union`). + /// + /// E.g. `union Foo { x: A, y: B }` + Union(VariantData, Generics), + /// A Trait declaration (`trait` or `pub trait`). + /// + /// E.g. `trait Foo { .. }` or `trait Foo { .. }` + Trait(Unsafety, Generics, Vec, Vec), + /// Default trait implementation. + /// + /// E.g. `impl Trait for .. {}` or `impl Trait for .. {}` + DefaultImpl(Unsafety, Path), + /// An implementation. + /// + /// E.g. `impl Foo { .. }` or `impl Trait for Foo { .. }` + Impl(Unsafety, + ImplPolarity, + Generics, + Option, // (optional) trait this impl implements + Box, // self + Vec), + /// A macro invocation (which includes macro definition). + /// + /// E.g. `macro_rules! foo { .. }` or `foo!(..)` + Mac(Mac), +} + +impl From for Item { + fn from(input: MacroInput) -> Item { + Item { + ident: input.ident, + vis: input.vis, + attrs: input.attrs, + node: match input.body { + Body::Enum(variants) => ItemKind::Enum(variants, input.generics), + Body::Struct(variant_data) => ItemKind::Struct(variant_data, input.generics), + }, + } + } +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum ViewPath { + /// `foo::bar::baz as quux` + /// + /// or just + /// + /// `foo::bar::baz` (with `as baz` implicitly on the right) + Simple(Path, Option), + + /// `foo::bar::*` + Glob(Path), + + /// `foo::bar::{a, b, c}` + List(Path, Vec), +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct PathListItem { + pub name: Ident, + /// renamed in list, e.g. `use foo::{bar as baz};` + pub rename: Option, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum Constness { + Const, + NotConst, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum Defaultness { + Default, + Final, +} + +/// Foreign module declaration. +/// +/// E.g. `extern { .. }` or `extern "C" { .. }` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct ForeignMod { + pub abi: Abi, + pub items: Vec, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct ForeignItem { + pub ident: Ident, + pub attrs: Vec, + pub node: ForeignItemKind, + pub vis: Visibility, +} + +/// An item within an `extern` block +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum ForeignItemKind { + /// A foreign function + Fn(Box, Generics), + /// A foreign static item (`static ext: u8`) + Static(Box, Mutability), +} + +/// Represents an item declaration within a trait declaration, +/// possibly including a default implementation. A trait item is +/// either required (meaning it doesn't have an implementation, just a +/// signature) or provided (meaning it has a default implementation). +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct TraitItem { + pub ident: Ident, + pub attrs: Vec, + pub node: TraitItemKind, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum TraitItemKind { + Const(Ty, Option), + Method(MethodSig, Option), + Type(Vec, Option), + Macro(Mac), +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum ImplPolarity { + /// `impl Trait for Type` + Positive, + /// `impl !Trait for Type` + Negative, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct ImplItem { + pub ident: Ident, + pub vis: Visibility, + pub defaultness: Defaultness, + pub attrs: Vec, + pub node: ImplItemKind, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum ImplItemKind { + Const(Ty, Expr), + Method(MethodSig, Block), + Type(Ty), + Macro(Mac), +} + +/// Represents a method's signature in a trait declaration, +/// or in an implementation. +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct MethodSig { + pub unsafety: Unsafety, + pub constness: Constness, + pub abi: Option, + pub decl: FnDecl, + pub generics: Generics, +} + +/// Header (not the body) of a function declaration. +/// +/// E.g. `fn foo(bar: baz)` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct FnDecl { + pub inputs: Vec, + pub output: FunctionRetTy, + pub variadic: bool, +} + +/// An argument in a function header. +/// +/// E.g. `bar: usize` as in `fn foo(bar: usize)` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum FnArg { + SelfRef(Option, Mutability), + SelfValue(Mutability), + Captured(Pat, Ty), + Ignored(Ty), +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use {Block, DelimToken, FunctionRetTy, Generics, Ident, Mac, Path, TokenTree, VariantData, + Visibility}; + use attr::parsing::{inner_attr, outer_attr}; + use data::parsing::{struct_like_body, visibility}; + use expr::parsing::{expr, pat, within_block}; + use generics::parsing::{generics, lifetime, ty_param_bound, where_clause}; + use ident::parsing::ident; + use mac::parsing::delimited; + use macro_input::{Body, MacroInput}; + use macro_input::parsing::macro_input; + use ty::parsing::{abi, mutability, path, ty, unsafety}; + + named!(pub item -> Item, alt!( + item_extern_crate + | + item_use + | + item_static + | + item_const + | + item_fn + | + item_mod + | + item_foreign_mod + | + item_ty + | + item_struct_or_enum + | + item_union + | + item_trait + | + item_default_impl + | + item_impl + | + item_mac + )); + + named!(pub items -> Vec, many0!(item)); + + named!(item_mac -> Item, do_parse!( + attrs: many0!(outer_attr) >> + what: path >> + punct!("!") >> + name: option!(ident) >> + body: delimited >> + cond!(match body.delim { + DelimToken::Paren | DelimToken::Bracket => true, + DelimToken::Brace => false, + }, punct!(";")) >> + (Item { + ident: name.unwrap_or_else(|| Ident::new("")), + vis: Visibility::Inherited, + attrs: attrs, + node: ItemKind::Mac(Mac { + path: what, + tts: vec![TokenTree::Delimited(body)], + }), + }) + )); + + named!(item_extern_crate -> Item, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("extern") >> + keyword!("crate") >> + id: ident >> + rename: option!(preceded!( + keyword!("as"), + ident + )) >> + punct!(";") >> + ({ + let (name, original_name) = match rename { + Some(rename) => (rename, Some(id)), + None => (id, None), + }; + Item { + ident: name, + vis: vis, + attrs: attrs, + node: ItemKind::ExternCrate(original_name), + } + }) + )); + + named!(item_use -> Item, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("use") >> + what: view_path >> + punct!(";") >> + (Item { + ident: "".into(), + vis: vis, + attrs: attrs, + node: ItemKind::Use(Box::new(what)), + }) + )); + + named!(view_path -> ViewPath, alt!( + view_path_glob + | + view_path_list + | + view_path_list_root + | + view_path_simple // must be last + )); + + + named!(view_path_simple -> ViewPath, do_parse!( + path: path >> + rename: option!(preceded!(keyword!("as"), ident)) >> + (ViewPath::Simple(path, rename)) + )); + + named!(view_path_glob -> ViewPath, do_parse!( + path: path >> + punct!("::") >> + punct!("*") >> + (ViewPath::Glob(path)) + )); + + named!(view_path_list -> ViewPath, do_parse!( + path: path >> + punct!("::") >> + punct!("{") >> + items: terminated_list!(punct!(","), path_list_item) >> + punct!("}") >> + (ViewPath::List(path, items)) + )); + + named!(view_path_list_root -> ViewPath, do_parse!( + global: option!(punct!("::")) >> + punct!("{") >> + items: terminated_list!(punct!(","), path_list_item) >> + punct!("}") >> + (ViewPath::List(Path { + global: global.is_some(), + segments: Vec::new(), + }, items)) + )); + + named!(path_list_item -> PathListItem, do_parse!( + name: alt!( + ident + | + map!(keyword!("self"), Into::into) + ) >> + rename: option!(preceded!(keyword!("as"), ident)) >> + (PathListItem { + name: name, + rename: rename, + }) + )); + + named!(item_static -> Item, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("static") >> + mutability: mutability >> + id: ident >> + punct!(":") >> + ty: ty >> + punct!("=") >> + value: expr >> + punct!(";") >> + (Item { + ident: id, + vis: vis, + attrs: attrs, + node: ItemKind::Static(Box::new(ty), mutability, Box::new(value)), + }) + )); + + named!(item_const -> Item, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("const") >> + id: ident >> + punct!(":") >> + ty: ty >> + punct!("=") >> + value: expr >> + punct!(";") >> + (Item { + ident: id, + vis: vis, + attrs: attrs, + node: ItemKind::Const(Box::new(ty), Box::new(value)), + }) + )); + + named!(item_fn -> Item, do_parse!( + outer_attrs: many0!(outer_attr) >> + vis: visibility >> + constness: constness >> + unsafety: unsafety >> + abi: option!(abi) >> + keyword!("fn") >> + name: ident >> + generics: generics >> + punct!("(") >> + inputs: terminated_list!(punct!(","), fn_arg) >> + punct!(")") >> + ret: option!(preceded!(punct!("->"), ty)) >> + where_clause: where_clause >> + punct!("{") >> + inner_attrs: many0!(inner_attr) >> + stmts: within_block >> + punct!("}") >> + (Item { + ident: name, + vis: vis, + attrs: { + let mut attrs = outer_attrs; + attrs.extend(inner_attrs); + attrs + }, + node: ItemKind::Fn( + Box::new(FnDecl { + inputs: inputs, + output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), + variadic: false, + }), + unsafety, + constness, + abi, + Generics { + where_clause: where_clause, + .. generics + }, + Box::new(Block { + stmts: stmts, + }), + ), + }) + )); + + named!(fn_arg -> FnArg, alt!( + do_parse!( + punct!("&") >> + lt: option!(lifetime) >> + mutability: mutability >> + keyword!("self") >> + not!(peek!(punct!(":"))) >> + (FnArg::SelfRef(lt, mutability)) + ) + | + do_parse!( + mutability: mutability >> + keyword!("self") >> + not!(peek!(punct!(":"))) >> + (FnArg::SelfValue(mutability)) + ) + | + do_parse!( + pat: pat >> + punct!(":") >> + ty: ty >> + (FnArg::Captured(pat, ty)) + ) + | + ty => { FnArg::Ignored } + )); + + named!(item_mod -> Item, do_parse!( + outer_attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("mod") >> + id: ident >> + content: alt!( + punct!(";") => { |_| None } + | + delimited!( + punct!("{"), + tuple!( + many0!(inner_attr), + items + ), + punct!("}") + ) => { Some } + ) >> + (match content { + Some((inner_attrs, items)) => Item { + ident: id, + vis: vis, + attrs: { + let mut attrs = outer_attrs; + attrs.extend(inner_attrs); + attrs + }, + node: ItemKind::Mod(Some(items)), + }, + None => Item { + ident: id, + vis: vis, + attrs: outer_attrs, + node: ItemKind::Mod(None), + }, + }) + )); + + named!(item_foreign_mod -> Item, do_parse!( + attrs: many0!(outer_attr) >> + abi: abi >> + punct!("{") >> + items: many0!(foreign_item) >> + punct!("}") >> + (Item { + ident: "".into(), + vis: Visibility::Inherited, + attrs: attrs, + node: ItemKind::ForeignMod(ForeignMod { + abi: abi, + items: items, + }), + }) + )); + + named!(foreign_item -> ForeignItem, alt!( + foreign_fn + | + foreign_static + )); + + named!(foreign_fn -> ForeignItem, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("fn") >> + name: ident >> + generics: generics >> + punct!("(") >> + inputs: separated_list!(punct!(","), fn_arg) >> + trailing_comma: option!(punct!(",")) >> + variadic: option!(cond_reduce!(trailing_comma.is_some(), punct!("..."))) >> + punct!(")") >> + ret: option!(preceded!(punct!("->"), ty)) >> + where_clause: where_clause >> + punct!(";") >> + (ForeignItem { + ident: name, + attrs: attrs, + node: ForeignItemKind::Fn( + Box::new(FnDecl { + inputs: inputs, + output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), + variadic: variadic.is_some(), + }), + Generics { + where_clause: where_clause, + .. generics + }, + ), + vis: vis, + }) + )); + + named!(foreign_static -> ForeignItem, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("static") >> + mutability: mutability >> + id: ident >> + punct!(":") >> + ty: ty >> + punct!(";") >> + (ForeignItem { + ident: id, + attrs: attrs, + node: ForeignItemKind::Static(Box::new(ty), mutability), + vis: vis, + }) + )); + + named!(item_ty -> Item, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("type") >> + id: ident >> + generics: generics >> + where_clause: where_clause >> + punct!("=") >> + ty: ty >> + punct!(";") >> + (Item { + ident: id, + vis: vis, + attrs: attrs, + node: ItemKind::Ty( + Box::new(ty), + Generics { + where_clause: where_clause, + ..generics + }, + ), + }) + )); + + named!(item_struct_or_enum -> Item, map!( + macro_input, + |def: MacroInput| Item { + ident: def.ident, + vis: def.vis, + attrs: def.attrs, + node: match def.body { + Body::Enum(variants) => { + ItemKind::Enum(variants, def.generics) + } + Body::Struct(variant_data) => { + ItemKind::Struct(variant_data, def.generics) + } + } + } + )); + + named!(item_union -> Item, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + keyword!("union") >> + id: ident >> + generics: generics >> + where_clause: where_clause >> + fields: struct_like_body >> + (Item { + ident: id, + vis: vis, + attrs: attrs, + node: ItemKind::Union( + VariantData::Struct(fields), + Generics { + where_clause: where_clause, + .. generics + }, + ), + }) + )); + + named!(item_trait -> Item, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + unsafety: unsafety >> + keyword!("trait") >> + id: ident >> + generics: generics >> + bounds: opt_vec!(preceded!( + punct!(":"), + separated_nonempty_list!(punct!("+"), ty_param_bound) + )) >> + where_clause: where_clause >> + punct!("{") >> + body: many0!(trait_item) >> + punct!("}") >> + (Item { + ident: id, + vis: vis, + attrs: attrs, + node: ItemKind::Trait( + unsafety, + Generics { + where_clause: where_clause, + .. generics + }, + bounds, + body, + ), + }) + )); + + named!(item_default_impl -> Item, do_parse!( + attrs: many0!(outer_attr) >> + unsafety: unsafety >> + keyword!("impl") >> + path: path >> + keyword!("for") >> + punct!("..") >> + punct!("{") >> + punct!("}") >> + (Item { + ident: "".into(), + vis: Visibility::Inherited, + attrs: attrs, + node: ItemKind::DefaultImpl(unsafety, path), + }) + )); + + named!(trait_item -> TraitItem, alt!( + trait_item_const + | + trait_item_method + | + trait_item_type + | + trait_item_mac + )); + + named!(trait_item_const -> TraitItem, do_parse!( + attrs: many0!(outer_attr) >> + keyword!("const") >> + id: ident >> + punct!(":") >> + ty: ty >> + value: option!(preceded!(punct!("="), expr)) >> + punct!(";") >> + (TraitItem { + ident: id, + attrs: attrs, + node: TraitItemKind::Const(ty, value), + }) + )); + + named!(trait_item_method -> TraitItem, do_parse!( + outer_attrs: many0!(outer_attr) >> + constness: constness >> + unsafety: unsafety >> + abi: option!(abi) >> + keyword!("fn") >> + name: ident >> + generics: generics >> + punct!("(") >> + inputs: terminated_list!(punct!(","), fn_arg) >> + punct!(")") >> + ret: option!(preceded!(punct!("->"), ty)) >> + where_clause: where_clause >> + body: option!(delimited!( + punct!("{"), + tuple!(many0!(inner_attr), within_block), + punct!("}") + )) >> + cond!(body.is_none(), punct!(";")) >> + ({ + let (inner_attrs, stmts) = match body { + Some((inner_attrs, stmts)) => (inner_attrs, Some(stmts)), + None => (Vec::new(), None), + }; + TraitItem { + ident: name, + attrs: { + let mut attrs = outer_attrs; + attrs.extend(inner_attrs); + attrs + }, + node: TraitItemKind::Method( + MethodSig { + unsafety: unsafety, + constness: constness, + abi: abi, + decl: FnDecl { + inputs: inputs, + output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), + variadic: false, + }, + generics: Generics { + where_clause: where_clause, + .. generics + }, + }, + stmts.map(|stmts| Block { stmts: stmts }), + ), + } + }) + )); + + named!(trait_item_type -> TraitItem, do_parse!( + attrs: many0!(outer_attr) >> + keyword!("type") >> + id: ident >> + bounds: opt_vec!(preceded!( + punct!(":"), + separated_nonempty_list!(punct!("+"), ty_param_bound) + )) >> + default: option!(preceded!(punct!("="), ty)) >> + punct!(";") >> + (TraitItem { + ident: id, + attrs: attrs, + node: TraitItemKind::Type(bounds, default), + }) + )); + + named!(trait_item_mac -> TraitItem, do_parse!( + attrs: many0!(outer_attr) >> + what: path >> + punct!("!") >> + body: delimited >> + cond!(match body.delim { + DelimToken::Paren | DelimToken::Bracket => true, + DelimToken::Brace => false, + }, punct!(";")) >> + (TraitItem { + ident: Ident::new(""), + attrs: attrs, + node: TraitItemKind::Macro(Mac { + path: what, + tts: vec![TokenTree::Delimited(body)], + }), + }) + )); + + named!(item_impl -> Item, do_parse!( + attrs: many0!(outer_attr) >> + unsafety: unsafety >> + keyword!("impl") >> + generics: generics >> + polarity_path: alt!( + do_parse!( + polarity: impl_polarity >> + path: path >> + keyword!("for") >> + ((polarity, Some(path))) + ) + | + epsilon!() => { |_| (ImplPolarity::Positive, None) } + ) >> + self_ty: ty >> + where_clause: where_clause >> + punct!("{") >> + body: many0!(impl_item) >> + punct!("}") >> + (Item { + ident: "".into(), + vis: Visibility::Inherited, + attrs: attrs, + node: ItemKind::Impl( + unsafety, + polarity_path.0, + Generics { + where_clause: where_clause, + .. generics + }, + polarity_path.1, + Box::new(self_ty), + body, + ), + }) + )); + + named!(impl_item -> ImplItem, alt!( + impl_item_const + | + impl_item_method + | + impl_item_type + | + impl_item_macro + )); + + named!(impl_item_const -> ImplItem, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + defaultness: defaultness >> + keyword!("const") >> + id: ident >> + punct!(":") >> + ty: ty >> + punct!("=") >> + value: expr >> + punct!(";") >> + (ImplItem { + ident: id, + vis: vis, + defaultness: defaultness, + attrs: attrs, + node: ImplItemKind::Const(ty, value), + }) + )); + + named!(impl_item_method -> ImplItem, do_parse!( + outer_attrs: many0!(outer_attr) >> + vis: visibility >> + defaultness: defaultness >> + constness: constness >> + unsafety: unsafety >> + abi: option!(abi) >> + keyword!("fn") >> + name: ident >> + generics: generics >> + punct!("(") >> + inputs: terminated_list!(punct!(","), fn_arg) >> + punct!(")") >> + ret: option!(preceded!(punct!("->"), ty)) >> + where_clause: where_clause >> + punct!("{") >> + inner_attrs: many0!(inner_attr) >> + stmts: within_block >> + punct!("}") >> + (ImplItem { + ident: name, + vis: vis, + defaultness: defaultness, + attrs: { + let mut attrs = outer_attrs; + attrs.extend(inner_attrs); + attrs + }, + node: ImplItemKind::Method( + MethodSig { + unsafety: unsafety, + constness: constness, + abi: abi, + decl: FnDecl { + inputs: inputs, + output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), + variadic: false, + }, + generics: Generics { + where_clause: where_clause, + .. generics + }, + }, + Block { + stmts: stmts, + }, + ), + }) + )); + + named!(impl_item_type -> ImplItem, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + defaultness: defaultness >> + keyword!("type") >> + id: ident >> + punct!("=") >> + ty: ty >> + punct!(";") >> + (ImplItem { + ident: id, + vis: vis, + defaultness: defaultness, + attrs: attrs, + node: ImplItemKind::Type(ty), + }) + )); + + named!(impl_item_macro -> ImplItem, do_parse!( + attrs: many0!(outer_attr) >> + what: path >> + punct!("!") >> + body: delimited >> + cond!(match body.delim { + DelimToken::Paren | DelimToken::Bracket => true, + DelimToken::Brace => false, + }, punct!(";")) >> + (ImplItem { + ident: Ident::new(""), + vis: Visibility::Inherited, + defaultness: Defaultness::Final, + attrs: attrs, + node: ImplItemKind::Macro(Mac { + path: what, + tts: vec![TokenTree::Delimited(body)], + }), + }) + )); + + named!(impl_polarity -> ImplPolarity, alt!( + punct!("!") => { |_| ImplPolarity::Negative } + | + epsilon!() => { |_| ImplPolarity::Positive } + )); + + named!(constness -> Constness, alt!( + keyword!("const") => { |_| Constness::Const } + | + epsilon!() => { |_| Constness::NotConst } + )); + + named!(defaultness -> Defaultness, alt!( + keyword!("default") => { |_| Defaultness::Default } + | + epsilon!() => { |_| Defaultness::Final } + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use {Delimited, DelimToken, FunctionRetTy, TokenTree}; + use attr::FilterAttrs; + use data::VariantData; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Item { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + match self.node { + ItemKind::ExternCrate(ref original) => { + self.vis.to_tokens(tokens); + tokens.append("extern"); + tokens.append("crate"); + if let Some(ref original) = *original { + original.to_tokens(tokens); + tokens.append("as"); + } + self.ident.to_tokens(tokens); + tokens.append(";"); + } + ItemKind::Use(ref view_path) => { + self.vis.to_tokens(tokens); + tokens.append("use"); + view_path.to_tokens(tokens); + tokens.append(";"); + } + ItemKind::Static(ref ty, ref mutability, ref expr) => { + self.vis.to_tokens(tokens); + tokens.append("static"); + mutability.to_tokens(tokens); + self.ident.to_tokens(tokens); + tokens.append(":"); + ty.to_tokens(tokens); + tokens.append("="); + expr.to_tokens(tokens); + tokens.append(";"); + } + ItemKind::Const(ref ty, ref expr) => { + self.vis.to_tokens(tokens); + tokens.append("const"); + self.ident.to_tokens(tokens); + tokens.append(":"); + ty.to_tokens(tokens); + tokens.append("="); + expr.to_tokens(tokens); + tokens.append(";"); + } + ItemKind::Fn(ref decl, unsafety, constness, ref abi, ref generics, ref block) => { + self.vis.to_tokens(tokens); + constness.to_tokens(tokens); + unsafety.to_tokens(tokens); + abi.to_tokens(tokens); + tokens.append("fn"); + self.ident.to_tokens(tokens); + generics.to_tokens(tokens); + tokens.append("("); + tokens.append_separated(&decl.inputs, ","); + tokens.append(")"); + if let FunctionRetTy::Ty(ref ty) = decl.output { + tokens.append("->"); + ty.to_tokens(tokens); + } + generics.where_clause.to_tokens(tokens); + tokens.append("{"); + tokens.append_all(self.attrs.inner()); + tokens.append_all(&block.stmts); + tokens.append("}"); + } + ItemKind::Mod(ref items) => { + self.vis.to_tokens(tokens); + tokens.append("mod"); + self.ident.to_tokens(tokens); + match *items { + Some(ref items) => { + tokens.append("{"); + tokens.append_all(self.attrs.inner()); + tokens.append_all(items); + tokens.append("}"); + } + None => tokens.append(";"), + } + } + ItemKind::ForeignMod(ref foreign_mod) => { + self.vis.to_tokens(tokens); + foreign_mod.abi.to_tokens(tokens); + tokens.append("{"); + tokens.append_all(&foreign_mod.items); + tokens.append("}"); + } + ItemKind::Ty(ref ty, ref generics) => { + self.vis.to_tokens(tokens); + tokens.append("type"); + self.ident.to_tokens(tokens); + generics.to_tokens(tokens); + generics.where_clause.to_tokens(tokens); + tokens.append("="); + ty.to_tokens(tokens); + tokens.append(";"); + } + ItemKind::Enum(ref variants, ref generics) => { + self.vis.to_tokens(tokens); + tokens.append("enum"); + self.ident.to_tokens(tokens); + generics.to_tokens(tokens); + generics.where_clause.to_tokens(tokens); + tokens.append("{"); + for variant in variants { + variant.to_tokens(tokens); + tokens.append(","); + } + tokens.append("}"); + } + ItemKind::Struct(ref variant_data, ref generics) => { + self.vis.to_tokens(tokens); + tokens.append("struct"); + self.ident.to_tokens(tokens); + generics.to_tokens(tokens); + match *variant_data { + VariantData::Struct(_) => { + generics.where_clause.to_tokens(tokens); + variant_data.to_tokens(tokens); + // no semicolon + } + VariantData::Tuple(_) => { + variant_data.to_tokens(tokens); + generics.where_clause.to_tokens(tokens); + tokens.append(";"); + } + VariantData::Unit => { + generics.where_clause.to_tokens(tokens); + tokens.append(";"); + } + } + } + ItemKind::Union(ref variant_data, ref generics) => { + self.vis.to_tokens(tokens); + tokens.append("union"); + self.ident.to_tokens(tokens); + generics.to_tokens(tokens); + generics.where_clause.to_tokens(tokens); + variant_data.to_tokens(tokens); + } + ItemKind::Trait(unsafety, ref generics, ref bound, ref items) => { + self.vis.to_tokens(tokens); + unsafety.to_tokens(tokens); + tokens.append("trait"); + self.ident.to_tokens(tokens); + generics.to_tokens(tokens); + if !bound.is_empty() { + tokens.append(":"); + tokens.append_separated(bound, "+"); + } + generics.where_clause.to_tokens(tokens); + tokens.append("{"); + tokens.append_all(items); + tokens.append("}"); + } + ItemKind::DefaultImpl(unsafety, ref path) => { + unsafety.to_tokens(tokens); + tokens.append("impl"); + path.to_tokens(tokens); + tokens.append("for"); + tokens.append(".."); + tokens.append("{"); + tokens.append("}"); + } + ItemKind::Impl(unsafety, polarity, ref generics, ref path, ref ty, ref items) => { + unsafety.to_tokens(tokens); + tokens.append("impl"); + generics.to_tokens(tokens); + if let Some(ref path) = *path { + polarity.to_tokens(tokens); + path.to_tokens(tokens); + tokens.append("for"); + } + ty.to_tokens(tokens); + generics.where_clause.to_tokens(tokens); + tokens.append("{"); + tokens.append_all(items); + tokens.append("}"); + } + ItemKind::Mac(ref mac) => { + mac.path.to_tokens(tokens); + tokens.append("!"); + self.ident.to_tokens(tokens); + for tt in &mac.tts { + tt.to_tokens(tokens); + } + match mac.tts.last() { + Some(&TokenTree::Delimited(Delimited { delim: DelimToken::Brace, .. })) => { + // no semicolon + } + _ => tokens.append(";"), + } + } + } + } + } + + impl ToTokens for ViewPath { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + ViewPath::Simple(ref path, ref rename) => { + path.to_tokens(tokens); + if let Some(ref rename) = *rename { + tokens.append("as"); + rename.to_tokens(tokens); + } + } + ViewPath::Glob(ref path) => { + path.to_tokens(tokens); + tokens.append("::"); + tokens.append("*"); + } + ViewPath::List(ref path, ref items) => { + path.to_tokens(tokens); + if path.global || !path.segments.is_empty() { + tokens.append("::"); + } + tokens.append("{"); + tokens.append_separated(items, ","); + tokens.append("}"); + } + } + } + } + + impl ToTokens for PathListItem { + fn to_tokens(&self, tokens: &mut Tokens) { + self.name.to_tokens(tokens); + if let Some(ref rename) = self.rename { + tokens.append("as"); + rename.to_tokens(tokens); + } + } + } + + impl ToTokens for TraitItem { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + match self.node { + TraitItemKind::Const(ref ty, ref expr) => { + tokens.append("const"); + self.ident.to_tokens(tokens); + tokens.append(":"); + ty.to_tokens(tokens); + if let Some(ref expr) = *expr { + tokens.append("="); + expr.to_tokens(tokens); + } + tokens.append(";"); + } + TraitItemKind::Method(ref sig, ref block) => { + sig.constness.to_tokens(tokens); + sig.unsafety.to_tokens(tokens); + sig.abi.to_tokens(tokens); + tokens.append("fn"); + self.ident.to_tokens(tokens); + sig.generics.to_tokens(tokens); + tokens.append("("); + tokens.append_separated(&sig.decl.inputs, ","); + tokens.append(")"); + if let FunctionRetTy::Ty(ref ty) = sig.decl.output { + tokens.append("->"); + ty.to_tokens(tokens); + } + sig.generics.where_clause.to_tokens(tokens); + match *block { + Some(ref block) => { + tokens.append("{"); + tokens.append_all(self.attrs.inner()); + tokens.append_all(&block.stmts); + tokens.append("}"); + } + None => tokens.append(";"), + } + } + TraitItemKind::Type(ref bound, ref default) => { + tokens.append("type"); + self.ident.to_tokens(tokens); + if !bound.is_empty() { + tokens.append(":"); + tokens.append_separated(bound, "+"); + } + if let Some(ref default) = *default { + tokens.append("="); + default.to_tokens(tokens); + } + tokens.append(";"); + } + TraitItemKind::Macro(ref mac) => { + mac.to_tokens(tokens); + match mac.tts.last() { + Some(&TokenTree::Delimited(Delimited { delim: DelimToken::Brace, .. })) => { + // no semicolon + } + _ => tokens.append(";"), + } + } + } + } + } + + impl ToTokens for ImplItem { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + match self.node { + ImplItemKind::Const(ref ty, ref expr) => { + self.vis.to_tokens(tokens); + self.defaultness.to_tokens(tokens); + tokens.append("const"); + self.ident.to_tokens(tokens); + tokens.append(":"); + ty.to_tokens(tokens); + tokens.append("="); + expr.to_tokens(tokens); + tokens.append(";"); + } + ImplItemKind::Method(ref sig, ref block) => { + self.vis.to_tokens(tokens); + self.defaultness.to_tokens(tokens); + sig.constness.to_tokens(tokens); + sig.unsafety.to_tokens(tokens); + sig.abi.to_tokens(tokens); + tokens.append("fn"); + self.ident.to_tokens(tokens); + sig.generics.to_tokens(tokens); + tokens.append("("); + tokens.append_separated(&sig.decl.inputs, ","); + tokens.append(")"); + if let FunctionRetTy::Ty(ref ty) = sig.decl.output { + tokens.append("->"); + ty.to_tokens(tokens); + } + sig.generics.where_clause.to_tokens(tokens); + tokens.append("{"); + tokens.append_all(self.attrs.inner()); + tokens.append_all(&block.stmts); + tokens.append("}"); + } + ImplItemKind::Type(ref ty) => { + self.vis.to_tokens(tokens); + self.defaultness.to_tokens(tokens); + tokens.append("type"); + self.ident.to_tokens(tokens); + tokens.append("="); + ty.to_tokens(tokens); + tokens.append(";"); + } + ImplItemKind::Macro(ref mac) => { + mac.to_tokens(tokens); + match mac.tts.last() { + Some(&TokenTree::Delimited(Delimited { delim: DelimToken::Brace, .. })) => { + // no semicolon + } + _ => tokens.append(";"), + } + } + } + } + } + + impl ToTokens for ForeignItem { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append_all(self.attrs.outer()); + match self.node { + ForeignItemKind::Fn(ref decl, ref generics) => { + self.vis.to_tokens(tokens); + tokens.append("fn"); + self.ident.to_tokens(tokens); + generics.to_tokens(tokens); + tokens.append("("); + tokens.append_separated(&decl.inputs, ","); + if decl.variadic { + if !decl.inputs.is_empty() { + tokens.append(","); + } + tokens.append("..."); + } + tokens.append(")"); + if let FunctionRetTy::Ty(ref ty) = decl.output { + tokens.append("->"); + ty.to_tokens(tokens); + } + generics.where_clause.to_tokens(tokens); + tokens.append(";"); + } + ForeignItemKind::Static(ref ty, mutability) => { + self.vis.to_tokens(tokens); + tokens.append("static"); + mutability.to_tokens(tokens); + self.ident.to_tokens(tokens); + tokens.append(":"); + ty.to_tokens(tokens); + tokens.append(";"); + } + } + } + } + + impl ToTokens for FnArg { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + FnArg::SelfRef(ref lifetime, mutability) => { + tokens.append("&"); + lifetime.to_tokens(tokens); + mutability.to_tokens(tokens); + tokens.append("self"); + } + FnArg::SelfValue(mutability) => { + mutability.to_tokens(tokens); + tokens.append("self"); + } + FnArg::Captured(ref pat, ref ty) => { + pat.to_tokens(tokens); + tokens.append(":"); + ty.to_tokens(tokens); + } + FnArg::Ignored(ref ty) => { + ty.to_tokens(tokens); + } + } + } + } + + impl ToTokens for Constness { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Constness::Const => tokens.append("const"), + Constness::NotConst => { + // nothing + } + } + } + } + + impl ToTokens for Defaultness { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Defaultness::Default => tokens.append("default"), + Defaultness::Final => { + // nothing + } + } + } + } + + impl ToTokens for ImplPolarity { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + ImplPolarity::Negative => tokens.append("!"), + ImplPolarity::Positive => { + // nothing + } + } + } + } +} diff --git a/third_party/rust/syn/src/krate.rs b/third_party/rust/syn/src/krate.rs new file mode 100644 index 000000000000..7ed16b521d6a --- /dev/null +++ b/third_party/rust/syn/src/krate.rs @@ -0,0 +1,57 @@ +use super::*; + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Crate { + pub shebang: Option, + pub attrs: Vec, + pub items: Vec, +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use attr::parsing::inner_attr; + use item::parsing::items; + + named!(pub krate -> Crate, do_parse!( + option!(byte_order_mark) >> + shebang: option!(shebang) >> + attrs: many0!(inner_attr) >> + items: items >> + (Crate { + shebang: shebang, + attrs: attrs, + items: items, + }) + )); + + named!(byte_order_mark -> &str, tag!("\u{feff}")); + + named!(shebang -> String, do_parse!( + tag!("#!") >> + not!(peek!(tag!("["))) >> + content: take_until!("\n") >> + (format!("#!{}", content)) + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use attr::FilterAttrs; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Crate { + fn to_tokens(&self, tokens: &mut Tokens) { + if let Some(ref shebang) = self.shebang { + tokens.append(&format!("{}\n", shebang)); + } + for attr in self.attrs.inner() { + attr.to_tokens(tokens); + } + for item in &self.items { + item.to_tokens(tokens); + } + } + } +} diff --git a/third_party/rust/syn/src/lib.rs b/third_party/rust/syn/src/lib.rs new file mode 100644 index 000000000000..0264bb236beb --- /dev/null +++ b/third_party/rust/syn/src/lib.rs @@ -0,0 +1,170 @@ +#![cfg_attr(feature = "clippy", feature(plugin))] +#![cfg_attr(feature = "clippy", plugin(clippy))] + +#[cfg(feature = "printing")] +#[macro_use] +extern crate quote; + +#[cfg(feature = "pretty")] +extern crate syntex_syntax as syntax; + +#[cfg(feature = "parsing")] +extern crate unicode_xid; + +#[cfg(feature = "parsing")] +#[macro_use] +mod nom; + +#[cfg(feature = "parsing")] +#[macro_use] +mod helper; + +#[cfg(feature = "aster")] +pub mod aster; + +mod attr; +pub use attr::{Attribute, AttrStyle, MetaItem, NestedMetaItem}; + +mod constant; +pub use constant::ConstExpr; + +mod data; +pub use data::{Field, Variant, VariantData, Visibility}; + +#[cfg(feature = "parsing")] +mod escape; + +#[cfg(feature = "full")] +mod expr; +#[cfg(feature = "full")] +pub use expr::{Arm, BindingMode, Block, CaptureBy, Expr, ExprKind, FieldPat, FieldValue, + Local, MacStmtStyle, Pat, RangeLimits, Stmt}; + +mod generics; +pub use generics::{Generics, Lifetime, LifetimeDef, TraitBoundModifier, TyParam, TyParamBound, + WhereBoundPredicate, WhereClause, WherePredicate, WhereRegionPredicate}; +#[cfg(feature = "printing")] +pub use generics::{ImplGenerics, TyGenerics}; + +mod ident; +pub use ident::Ident; + +#[cfg(feature = "full")] +mod item; +#[cfg(feature = "full")] +pub use item::{Constness, Defaultness, FnArg, FnDecl, ForeignItemKind, ForeignItem, ForeignMod, + ImplItem, ImplItemKind, ImplPolarity, Item, ItemKind, MethodSig, PathListItem, + TraitItem, TraitItemKind, ViewPath}; + +#[cfg(feature = "full")] +mod krate; +#[cfg(feature = "full")] +pub use krate::Crate; + +mod lit; +pub use lit::{FloatTy, IntTy, Lit, StrStyle}; + +#[cfg(feature = "type-macros")] +mod mac; +#[cfg(feature = "type-macros")] +pub use mac::{BinOpToken, DelimToken, Delimited, Mac, Token, TokenTree}; + +mod macro_input; +pub use macro_input::{Body, MacroInput}; + +mod op; +pub use op::{BinOp, UnOp}; + +#[cfg(feature = "expand")] +mod registry; +#[cfg(feature = "expand")] +pub use registry::{CustomDerive, Expanded, Registry}; + +#[cfg(feature = "parsing")] +mod space; + +mod ty; +pub use ty::{Abi, AngleBracketedParameterData, BareFnArg, BareFnTy, FunctionRetTy, MutTy, + Mutability, ParenthesizedParameterData, Path, PathParameters, PathSegment, + PolyTraitRef, QSelf, Ty, TypeBinding, Unsafety}; + +#[cfg(feature = "visit")] +pub mod visit; + +#[cfg(feature = "parsing")] +pub use parsing::*; + +#[cfg(feature = "parsing")] +mod parsing { + use super::*; + use {generics, ident, macro_input, space, ty}; + use nom::IResult; + + #[cfg(feature = "full")] + use {expr, item, krate, mac}; + + pub fn parse_macro_input(input: &str) -> Result { + unwrap("macro input", macro_input::parsing::macro_input, input) + } + + #[cfg(feature = "full")] + pub fn parse_crate(input: &str) -> Result { + unwrap("crate", krate::parsing::krate, input) + } + + #[cfg(feature = "full")] + pub fn parse_item(input: &str) -> Result { + unwrap("item", item::parsing::item, input) + } + + #[cfg(feature = "full")] + pub fn parse_items(input: &str) -> Result, String> { + unwrap("items", item::parsing::items, input) + } + + #[cfg(feature = "full")] + pub fn parse_expr(input: &str) -> Result { + unwrap("expression", expr::parsing::expr, input) + } + + pub fn parse_type(input: &str) -> Result { + unwrap("type", ty::parsing::ty, input) + } + + pub fn parse_path(input: &str) -> Result { + unwrap("path", ty::parsing::path, input) + } + + pub fn parse_where_clause(input: &str) -> Result { + unwrap("where clause", generics::parsing::where_clause, input) + } + + #[cfg(feature = "full")] + pub fn parse_token_trees(input: &str) -> Result, String> { + unwrap("token trees", mac::parsing::token_trees, input) + } + + pub fn parse_ident(input: &str) -> Result { + unwrap("identifier", ident::parsing::ident, input) + } + + fn unwrap(name: &'static str, + f: fn(&str) -> IResult<&str, T>, + input: &str) + -> Result { + match f(input) { + IResult::Done(mut rest, t) => { + rest = space::skip_whitespace(rest); + if rest.is_empty() { + Ok(t) + } else if rest.len() == input.len() { + // parsed nothing + Err(format!("failed to parse {}: {:?}", name, rest)) + } else { + Err(format!("failed to parse tokens after {}: {:?}", name, rest)) + } + } + IResult::Error => Err(format!("failed to parse {}: {:?}", name, input)), + } + } +} diff --git a/third_party/rust/syn/src/lit.rs b/third_party/rust/syn/src/lit.rs new file mode 100644 index 000000000000..66174105e676 --- /dev/null +++ b/third_party/rust/syn/src/lit.rs @@ -0,0 +1,455 @@ +/// Literal kind. +/// +/// E.g. `"foo"`, `42`, `12.34` or `bool` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum Lit { + /// A string literal (`"foo"`) + Str(String, StrStyle), + /// A byte string (`b"foo"`) + ByteStr(Vec, StrStyle), + /// A byte char (`b'f'`) + Byte(u8), + /// A character literal (`'a'`) + Char(char), + /// An integer literal (`1`) + Int(u64, IntTy), + /// A float literal (`1f64` or `1E10f64` or `1.0E10`) + Float(String, FloatTy), + /// A boolean literal + Bool(bool), +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum StrStyle { + /// A regular string, like `"foo"` + Cooked, + /// A raw string, like `r##"foo"##` + /// + /// The uint is the number of `#` symbols used + Raw(usize), +} + +impl From for Lit { + fn from(input: String) -> Lit { + Lit::Str(input, StrStyle::Cooked) + } +} + +impl<'a> From<&'a str> for Lit { + fn from(input: &str) -> Lit { + Lit::Str(input.into(), StrStyle::Cooked) + } +} + +impl From> for Lit { + fn from(input: Vec) -> Lit { + Lit::ByteStr(input, StrStyle::Cooked) + } +} + +impl<'a> From<&'a [u8]> for Lit { + fn from(input: &[u8]) -> Lit { + Lit::ByteStr(input.into(), StrStyle::Cooked) + } +} + +impl From for Lit { + fn from(input: char) -> Lit { + Lit::Char(input) + } +} + +impl From for Lit { + fn from(input: bool) -> Lit { + Lit::Bool(input) + } +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum IntTy { + Isize, + I8, + I16, + I32, + I64, + Usize, + U8, + U16, + U32, + U64, + Unsuffixed, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum FloatTy { + F32, + F64, + Unsuffixed, +} + +macro_rules! impl_from_for_lit { + (Int, [$($rust_type:ty => $syn_type:expr),+]) => { + $( + impl From<$rust_type> for Lit { + fn from(input: $rust_type) -> Lit { + Lit::Int(input as u64, $syn_type) + } + } + )+ + }; + (Float, [$($rust_type:ty => $syn_type:expr),+]) => { + $( + impl From<$rust_type> for Lit { + fn from(input: $rust_type) -> Lit { + Lit::Float(format!("{}", input), $syn_type) + } + } + )+ + }; +} + +impl_from_for_lit! {Int, [ + isize => IntTy::Isize, + i8 => IntTy::I8, + i16 => IntTy::I16, + i32 => IntTy::I32, + i64 => IntTy::I64, + usize => IntTy::Usize, + u8 => IntTy::U8, + u16 => IntTy::U16, + u32 => IntTy::U32, + u64 => IntTy::U64 +]} + +impl_from_for_lit! {Float, [ + f32 => FloatTy::F32, + f64 => FloatTy::F64 +]} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use escape::{cooked_byte, cooked_byte_string, cooked_char, cooked_string, raw_string}; + use space::skip_whitespace; + use nom::IResult; + use unicode_xid::UnicodeXID; + + named!(pub lit -> Lit, alt!( + string + | + byte_string + | + byte + | + character + | + float // must be before int + | + int => { |(value, ty)| Lit::Int(value, ty) } + | + boolean + )); + + named!(string -> Lit, alt!( + quoted_string => { |s| Lit::Str(s, StrStyle::Cooked) } + | + preceded!( + punct!("r"), + raw_string + ) => { |(s, n)| Lit::Str(s, StrStyle::Raw(n)) } + )); + + named!(pub quoted_string -> String, delimited!( + punct!("\""), + cooked_string, + tag!("\"") + )); + + named!(byte_string -> Lit, alt!( + delimited!( + punct!("b\""), + cooked_byte_string, + tag!("\"") + ) => { |vec| Lit::ByteStr(vec, StrStyle::Cooked) } + | + preceded!( + punct!("br"), + raw_string + ) => { |(s, n): (String, _)| Lit::ByteStr(s.into_bytes(), StrStyle::Raw(n)) } + )); + + named!(byte -> Lit, do_parse!( + punct!("b") >> + tag!("'") >> + b: cooked_byte >> + tag!("'") >> + (Lit::Byte(b)) + )); + + named!(character -> Lit, do_parse!( + punct!("'") >> + ch: cooked_char >> + tag!("'") >> + (Lit::Char(ch)) + )); + + named!(float -> Lit, do_parse!( + value: float_string >> + suffix: alt!( + tag!("f32") => { |_| FloatTy::F32 } + | + tag!("f64") => { |_| FloatTy::F64 } + | + epsilon!() => { |_| FloatTy::Unsuffixed } + ) >> + (Lit::Float(value, suffix)) + )); + + named!(pub int -> (u64, IntTy), tuple!( + digits, + alt!( + tag!("isize") => { |_| IntTy::Isize } + | + tag!("i8") => { |_| IntTy::I8 } + | + tag!("i16") => { |_| IntTy::I16 } + | + tag!("i32") => { |_| IntTy::I32 } + | + tag!("i64") => { |_| IntTy::I64 } + | + tag!("usize") => { |_| IntTy::Usize } + | + tag!("u8") => { |_| IntTy::U8 } + | + tag!("u16") => { |_| IntTy::U16 } + | + tag!("u32") => { |_| IntTy::U32 } + | + tag!("u64") => { |_| IntTy::U64 } + | + epsilon!() => { |_| IntTy::Unsuffixed } + ) + )); + + named!(boolean -> Lit, alt!( + keyword!("true") => { |_| Lit::Bool(true) } + | + keyword!("false") => { |_| Lit::Bool(false) } + )); + + fn float_string(mut input: &str) -> IResult<&str, String> { + input = skip_whitespace(input); + + let mut chars = input.chars().peekable(); + match chars.next() { + Some(ch) if ch >= '0' && ch <= '9' => {} + _ => return IResult::Error, + } + + let mut len = 1; + let mut has_dot = false; + let mut has_exp = false; + while let Some(&ch) = chars.peek() { + match ch { + '0'...'9' | '_' => { + chars.next(); + len += 1; + } + '.' => { + if has_dot { + break; + } + chars.next(); + if chars.peek() + .map(|&ch| ch == '.' || UnicodeXID::is_xid_start(ch)) + .unwrap_or(false) { + return IResult::Error; + } + len += 1; + has_dot = true; + } + 'e' | 'E' => { + chars.next(); + len += 1; + has_exp = true; + break; + } + _ => break, + } + } + + let rest = &input[len..]; + if !(has_dot || has_exp || rest.starts_with("f32") || rest.starts_with("f64")) { + return IResult::Error; + } + + if has_exp { + let mut has_exp_value = false; + while let Some(&ch) = chars.peek() { + match ch { + '+' | '-' => { + if has_exp_value { + break; + } + chars.next(); + len += 1; + } + '0'...'9' => { + chars.next(); + len += 1; + has_exp_value = true; + } + '_' => { + chars.next(); + len += 1; + } + _ => break, + } + } + if !has_exp_value { + return IResult::Error; + } + } + + IResult::Done(&input[len..], input[..len].replace("_", "")) + } + + pub fn digits(mut input: &str) -> IResult<&str, u64> { + input = skip_whitespace(input); + + let base = if input.starts_with("0x") { + input = &input[2..]; + 16 + } else if input.starts_with("0o") { + input = &input[2..]; + 8 + } else if input.starts_with("0b") { + input = &input[2..]; + 2 + } else { + 10 + }; + + let mut value = 0u64; + let mut len = 0; + let mut empty = true; + for b in input.bytes() { + let digit = match b { + b'0'...b'9' => (b - b'0') as u64, + b'a'...b'f' => 10 + (b - b'a') as u64, + b'A'...b'F' => 10 + (b - b'A') as u64, + b'_' => { + if empty && base == 10 { + return IResult::Error; + } + len += 1; + continue; + } + _ => break, + }; + if digit >= base { + return IResult::Error; + } + value = match value.checked_mul(base) { + Some(value) => value, + None => return IResult::Error, + }; + value = match value.checked_add(digit) { + Some(value) => value, + None => return IResult::Error, + }; + len += 1; + empty = false; + } + if empty { + IResult::Error + } else { + IResult::Done(&input[len..], value) + } + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use quote::{Tokens, ToTokens}; + use std::{ascii, iter}; + use std::fmt::{self, Display}; + use std::str; + + impl ToTokens for Lit { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Lit::Str(ref s, StrStyle::Cooked) => s.to_tokens(tokens), + Lit::Str(ref s, StrStyle::Raw(n)) => { + tokens.append(&format!("r{delim}\"{string}\"{delim}", + delim = iter::repeat("#").take(n).collect::(), + string = s)); + } + Lit::ByteStr(ref v, StrStyle::Cooked) => { + let mut escaped = "b\"".to_string(); + for &ch in v.iter() { + match ch { + 0 => escaped.push_str(r"\0"), + b'\'' => escaped.push('\''), + _ => escaped.extend(ascii::escape_default(ch).map(|c| c as char)), + } + } + escaped.push('"'); + tokens.append(&escaped); + } + Lit::ByteStr(ref vec, StrStyle::Raw(n)) => { + tokens.append(&format!("br{delim}\"{string}\"{delim}", + delim = iter::repeat("#").take(n).collect::(), + string = str::from_utf8(vec).unwrap())); + } + Lit::Byte(b) => { + match b { + 0 => tokens.append(r"b'\0'"), + b'\"' => tokens.append("b'\"'"), + _ => { + let mut escaped = "b'".to_string(); + escaped.extend(ascii::escape_default(b).map(|c| c as char)); + escaped.push('\''); + tokens.append(&escaped); + } + } + } + Lit::Char(ch) => ch.to_tokens(tokens), + Lit::Int(value, ty) => tokens.append(&format!("{}{}", value, ty)), + Lit::Float(ref value, ty) => tokens.append(&format!("{}{}", value, ty)), + Lit::Bool(true) => tokens.append("true"), + Lit::Bool(false) => tokens.append("false"), + } + } + } + + impl Display for IntTy { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + IntTy::Isize => formatter.write_str("isize"), + IntTy::I8 => formatter.write_str("i8"), + IntTy::I16 => formatter.write_str("i16"), + IntTy::I32 => formatter.write_str("i32"), + IntTy::I64 => formatter.write_str("i64"), + IntTy::Usize => formatter.write_str("usize"), + IntTy::U8 => formatter.write_str("u8"), + IntTy::U16 => formatter.write_str("u16"), + IntTy::U32 => formatter.write_str("u32"), + IntTy::U64 => formatter.write_str("u64"), + IntTy::Unsuffixed => Ok(()), + } + } + } + + impl Display for FloatTy { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FloatTy::F32 => formatter.write_str("f32"), + FloatTy::F64 => formatter.write_str("f64"), + FloatTy::Unsuffixed => Ok(()), + } + } + } +} diff --git a/third_party/rust/syn/src/mac.rs b/third_party/rust/syn/src/mac.rs new file mode 100644 index 000000000000..dd1447abe739 --- /dev/null +++ b/third_party/rust/syn/src/mac.rs @@ -0,0 +1,430 @@ +use super::*; + +/// Represents a macro invocation. The Path indicates which macro +/// is being invoked, and the vector of token-trees contains the source +/// of the macro invocation. +/// +/// NB: the additional ident for a `macro_rules`-style macro is actually +/// stored in the enclosing item. Oog. +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Mac { + pub path: Path, + pub tts: Vec, +} + +/// When the main rust parser encounters a syntax-extension invocation, it +/// parses the arguments to the invocation as a token-tree. This is a very +/// loose structure, such that all sorts of different AST-fragments can +/// be passed to syntax extensions using a uniform type. +/// +/// If the syntax extension is an MBE macro, it will attempt to match its +/// LHS token tree against the provided token tree, and if it finds a +/// match, will transcribe the RHS token tree, splicing in any captured +/// `macro_parser::matched_nonterminals` into the `SubstNt`s it finds. +/// +/// The RHS of an MBE macro is the only place `SubstNt`s are substituted. +/// Nothing special happens to misnamed or misplaced `SubstNt`s. +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum TokenTree { + /// A single token + Token(Token), + /// A delimited sequence of token trees + Delimited(Delimited), +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Delimited { + /// The type of delimiter + pub delim: DelimToken, + /// The delimited sequence of token trees + pub tts: Vec, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum Token { + // Expression-operator symbols. + Eq, + Lt, + Le, + EqEq, + Ne, + Ge, + Gt, + AndAnd, + OrOr, + Not, + Tilde, + BinOp(BinOpToken), + BinOpEq(BinOpToken), + + // Structural symbols + At, + Dot, + DotDot, + DotDotDot, + Comma, + Semi, + Colon, + ModSep, + RArrow, + LArrow, + FatArrow, + Pound, + Dollar, + Question, + + // Literals + Literal(Lit), + + // Name components + Ident(Ident), + Underscore, + Lifetime(Ident), + + DocComment(String), +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum BinOpToken { + Plus, + Minus, + Star, + Slash, + Percent, + Caret, + And, + Or, + Shl, + Shr, +} + +/// A delimiter token +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum DelimToken { + /// A round parenthesis: `(` or `)` + Paren, + /// A square bracket: `[` or `]` + Bracket, + /// A curly brace: `{` or `}` + Brace, +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use Lifetime; + use generics::parsing::lifetime; + use ident::parsing::word; + use lit::parsing::lit; + use space::{block_comment, whitespace}; + use ty::parsing::path; + + named!(pub mac -> Mac, do_parse!( + what: path >> + punct!("!") >> + body: delimited >> + (Mac { + path: what, + tts: vec![TokenTree::Delimited(body)], + }) + )); + + named!(pub token_trees -> Vec, many0!(token_tree)); + + named!(pub delimited -> Delimited, alt!( + delimited!( + punct!("("), + token_trees, + punct!(")") + ) => { |tts| Delimited { delim: DelimToken::Paren, tts: tts } } + | + delimited!( + punct!("["), + token_trees, + punct!("]") + ) => { |tts| Delimited { delim: DelimToken::Bracket, tts: tts } } + | + delimited!( + punct!("{"), + token_trees, + punct!("}") + ) => { |tts| Delimited { delim: DelimToken::Brace, tts: tts } } + )); + + named!(token_tree -> TokenTree, alt!( + map!(token, TokenTree::Token) + | + map!(delimited, TokenTree::Delimited) + )); + + named!(token -> Token, alt!( + keyword!("_") => { |_| Token::Underscore } + | + punct!("&&") => { |_| Token::AndAnd } // must be before BinOp + | + punct!("||") => { |_| Token::OrOr } // must be before BinOp + | + punct!("->") => { |_| Token::RArrow } // must be before BinOp + | + punct!("<-") => { |_| Token::LArrow } // must be before Lt + | + punct!("=>") => { |_| Token::FatArrow } // must be before Eq + | + punct!("...") => { |_| Token::DotDotDot } // must be before DotDot + | + punct!("..") => { |_| Token::DotDot } // must be before Dot + | + punct!(".") => { |_| Token::Dot } + | + map!(doc_comment, Token::DocComment) // must be before bin_op + | + map!(bin_op_eq, Token::BinOpEq) // must be before bin_op + | + map!(bin_op, Token::BinOp) + | + map!(lit, Token::Literal) + | + map!(word, Token::Ident) + | + map!(lifetime, |lt: Lifetime| Token::Lifetime(lt.ident)) + | + punct!("<=") => { |_| Token::Le } + | + punct!("==") => { |_| Token::EqEq } + | + punct!("!=") => { |_| Token::Ne } + | + punct!(">=") => { |_| Token::Ge } + | + punct!("::") => { |_| Token::ModSep } + | + punct!("=") => { |_| Token::Eq } + | + punct!("<") => { |_| Token::Lt } + | + punct!(">") => { |_| Token::Gt } + | + punct!("!") => { |_| Token::Not } + | + punct!("~") => { |_| Token::Tilde } + | + punct!("@") => { |_| Token::At } + | + punct!(",") => { |_| Token::Comma } + | + punct!(";") => { |_| Token::Semi } + | + punct!(":") => { |_| Token::Colon } + | + punct!("#") => { |_| Token::Pound } + | + punct!("$") => { |_| Token::Dollar } + | + punct!("?") => { |_| Token::Question } + )); + + named!(bin_op -> BinOpToken, alt!( + punct!("+") => { |_| BinOpToken::Plus } + | + punct!("-") => { |_| BinOpToken::Minus } + | + punct!("*") => { |_| BinOpToken::Star } + | + punct!("/") => { |_| BinOpToken::Slash } + | + punct!("%") => { |_| BinOpToken::Percent } + | + punct!("^") => { |_| BinOpToken::Caret } + | + punct!("&") => { |_| BinOpToken::And } + | + punct!("|") => { |_| BinOpToken::Or } + | + punct!("<<") => { |_| BinOpToken::Shl } + | + punct!(">>") => { |_| BinOpToken::Shr } + )); + + named!(bin_op_eq -> BinOpToken, alt!( + punct!("+=") => { |_| BinOpToken::Plus } + | + punct!("-=") => { |_| BinOpToken::Minus } + | + punct!("*=") => { |_| BinOpToken::Star } + | + punct!("/=") => { |_| BinOpToken::Slash } + | + punct!("%=") => { |_| BinOpToken::Percent } + | + punct!("^=") => { |_| BinOpToken::Caret } + | + punct!("&=") => { |_| BinOpToken::And } + | + punct!("|=") => { |_| BinOpToken::Or } + | + punct!("<<=") => { |_| BinOpToken::Shl } + | + punct!(">>=") => { |_| BinOpToken::Shr } + )); + + named!(doc_comment -> String, alt!( + do_parse!( + punct!("//!") >> + content: take_until!("\n") >> + (format!("//!{}", content)) + ) + | + do_parse!( + option!(whitespace) >> + peek!(tag!("/*!")) >> + com: block_comment >> + (com.to_owned()) + ) + | + do_parse!( + punct!("///") >> + not!(peek!(tag!("/"))) >> + content: take_until!("\n") >> + (format!("///{}", content)) + ) + | + do_parse!( + option!(whitespace) >> + peek!(tuple!(tag!("/**"), not!(tag!("*")))) >> + com: block_comment >> + (com.to_owned()) + ) + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Mac { + fn to_tokens(&self, tokens: &mut Tokens) { + self.path.to_tokens(tokens); + tokens.append("!"); + for tt in &self.tts { + tt.to_tokens(tokens); + } + } + } + + impl ToTokens for TokenTree { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + TokenTree::Token(ref token) => token.to_tokens(tokens), + TokenTree::Delimited(ref delimited) => delimited.to_tokens(tokens), + } + } + } + + impl DelimToken { + fn open(&self) -> &'static str { + match *self { + DelimToken::Paren => "(", + DelimToken::Bracket => "[", + DelimToken::Brace => "{", + } + } + + fn close(&self) -> &'static str { + match *self { + DelimToken::Paren => ")", + DelimToken::Bracket => "]", + DelimToken::Brace => "}", + } + } + } + + impl ToTokens for Delimited { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(self.delim.open()); + for tt in &self.tts { + tt.to_tokens(tokens); + } + tokens.append(self.delim.close()); + } + } + + impl ToTokens for Token { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Token::Eq => tokens.append("="), + Token::Lt => tokens.append("<"), + Token::Le => tokens.append("<="), + Token::EqEq => tokens.append("=="), + Token::Ne => tokens.append("!="), + Token::Ge => tokens.append(">="), + Token::Gt => tokens.append(">"), + Token::AndAnd => tokens.append("&&"), + Token::OrOr => tokens.append("||"), + Token::Not => tokens.append("!"), + Token::Tilde => tokens.append("~"), + Token::BinOp(binop) => tokens.append(binop.op()), + Token::BinOpEq(binop) => tokens.append(binop.assign_op()), + Token::At => tokens.append("@"), + Token::Dot => tokens.append("."), + Token::DotDot => tokens.append(".."), + Token::DotDotDot => tokens.append("..."), + Token::Comma => tokens.append(","), + Token::Semi => tokens.append(";"), + Token::Colon => tokens.append(":"), + Token::ModSep => tokens.append("::"), + Token::RArrow => tokens.append("->"), + Token::LArrow => tokens.append("<-"), + Token::FatArrow => tokens.append("=>"), + Token::Pound => tokens.append("#"), + Token::Dollar => tokens.append("$"), + Token::Question => tokens.append("?"), + Token::Literal(ref lit) => lit.to_tokens(tokens), + Token::Ident(ref ident) | + Token::Lifetime(ref ident) => ident.to_tokens(tokens), + Token::Underscore => tokens.append("_"), + Token::DocComment(ref com) => { + tokens.append(&format!("{}\n", com)); + } + } + } + } + + impl BinOpToken { + fn op(&self) -> &'static str { + match *self { + BinOpToken::Plus => "+", + BinOpToken::Minus => "-", + BinOpToken::Star => "*", + BinOpToken::Slash => "/", + BinOpToken::Percent => "%", + BinOpToken::Caret => "^", + BinOpToken::And => "&", + BinOpToken::Or => "|", + BinOpToken::Shl => "<<", + BinOpToken::Shr => ">>", + } + } + + fn assign_op(&self) -> &'static str { + match *self { + BinOpToken::Plus => "+=", + BinOpToken::Minus => "-=", + BinOpToken::Star => "*=", + BinOpToken::Slash => "/=", + BinOpToken::Percent => "%=", + BinOpToken::Caret => "^=", + BinOpToken::And => "&=", + BinOpToken::Or => "|=", + BinOpToken::Shl => "<<=", + BinOpToken::Shr => ">>=", + } + } + } + + impl ToTokens for BinOpToken { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(self.op()); + } + } +} diff --git a/third_party/rust/syn/src/macro_input.rs b/third_party/rust/syn/src/macro_input.rs new file mode 100644 index 000000000000..de99f27067db --- /dev/null +++ b/third_party/rust/syn/src/macro_input.rs @@ -0,0 +1,110 @@ +use super::*; + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct MacroInput { + pub ident: Ident, + pub vis: Visibility, + pub attrs: Vec, + pub generics: Generics, + pub body: Body, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum Body { + Enum(Vec), + Struct(VariantData), +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use Generics; + use attr::parsing::outer_attr; + use data::parsing::{visibility, struct_body, enum_body}; + use generics::parsing::generics; + use ident::parsing::ident; + + named!(pub macro_input -> MacroInput, do_parse!( + attrs: many0!(outer_attr) >> + vis: visibility >> + which: alt!(keyword!("struct") | keyword!("enum")) >> + id: ident >> + generics: generics >> + item: switch!(value!(which), + "struct" => map!(struct_body, move |(wh, body)| MacroInput { + ident: id, + vis: vis, + attrs: attrs, + generics: Generics { + where_clause: wh, + .. generics + }, + body: Body::Struct(body), + }) + | + "enum" => map!(enum_body, move |(wh, body)| MacroInput { + ident: id, + vis: vis, + attrs: attrs, + generics: Generics { + where_clause: wh, + .. generics + }, + body: Body::Enum(body), + }) + ) >> + (item) + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use attr::FilterAttrs; + use data::VariantData; + use quote::{Tokens, ToTokens}; + + impl ToTokens for MacroInput { + fn to_tokens(&self, tokens: &mut Tokens) { + for attr in self.attrs.outer() { + attr.to_tokens(tokens); + } + self.vis.to_tokens(tokens); + match self.body { + Body::Enum(_) => tokens.append("enum"), + Body::Struct(_) => tokens.append("struct"), + } + self.ident.to_tokens(tokens); + self.generics.to_tokens(tokens); + match self.body { + Body::Enum(ref variants) => { + self.generics.where_clause.to_tokens(tokens); + tokens.append("{"); + for variant in variants { + variant.to_tokens(tokens); + tokens.append(","); + } + tokens.append("}"); + } + Body::Struct(ref variant_data) => { + match *variant_data { + VariantData::Struct(_) => { + self.generics.where_clause.to_tokens(tokens); + variant_data.to_tokens(tokens); + // no semicolon + } + VariantData::Tuple(_) => { + variant_data.to_tokens(tokens); + self.generics.where_clause.to_tokens(tokens); + tokens.append(";"); + } + VariantData::Unit => { + self.generics.where_clause.to_tokens(tokens); + tokens.append(";"); + } + } + } + } + } + } +} diff --git a/third_party/rust/syn/src/nom.rs b/third_party/rust/syn/src/nom.rs new file mode 100644 index 000000000000..d987173319a5 --- /dev/null +++ b/third_party/rust/syn/src/nom.rs @@ -0,0 +1,495 @@ +// Adapted from nom by removing the +// IResult::Incomplete variant, which we don't use and which unfortunately more +// than doubles the compilation time. + +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum IResult { + /// indicates a correct parsing, the first field containing the rest of the + /// unparsed data, the second field contains the parsed data + Done(I, O), + Error, +} + +macro_rules! named { + ($name:ident -> $o:ty, $submac:ident!( $($args:tt)* )) => { + fn $name(i: &str) -> $crate::nom::IResult<&str, $o> { + $submac!(i, $($args)*) + } + }; + + (pub $name:ident -> $o:ty, $submac:ident!( $($args:tt)* )) => { + pub fn $name(i: &str) -> $crate::nom::IResult<&str, $o> { + $submac!(i, $($args)*) + } + }; +} + +macro_rules! call { + ($i:expr, $fun:expr $(, $args:expr)*) => { + $fun($i $(, $args)*) + }; +} + +macro_rules! map { + ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => { + map_impl!($i, $submac!($($args)*), call!($g)) + }; + + ($i:expr, $f:expr, $g:expr) => { + map_impl!($i, call!($f), call!($g)) + }; +} + +/// Internal parser, do not use directly +macro_rules! map_impl { + ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => { + $crate::nom::IResult::Done(i, $submac2!(o, $($args2)*)) + } + } + }; +} + +macro_rules! not { + ($i:expr, $submac:ident!( $($args:tt)* )) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Done(_, _) => $crate::nom::IResult::Error, + $crate::nom::IResult::Error => $crate::nom::IResult::Done($i, ""), + } + }; +} + +// This is actually nom's cond_with_error. +macro_rules! cond { + ($i:expr, $cond:expr, $submac:ident!( $($args:tt)* )) => { + if $cond { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Done(i, o) => $crate::nom::IResult::Done(i, ::std::option::Option::Some(o)), + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + } + } else { + $crate::nom::IResult::Done($i, ::std::option::Option::None) + } + }; + + ($i:expr, $cond:expr, $f:expr) => { + cond!($i, $cond, call!($f)) + }; +} + +macro_rules! cond_reduce { + ($i:expr, $cond:expr, $submac:ident!( $($args:tt)* )) => { + if $cond { + $submac!($i, $($args)*) + } else { + $crate::nom::IResult::Error + } + }; + + ($i:expr, $cond:expr, $f:expr) => { + cond_reduce!($i, $cond, call!($f)) + }; +} + +macro_rules! preceded { + ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => { + match tuple!($i, $submac!($($args)*), $submac2!($($args2)*)) { + $crate::nom::IResult::Done(remaining, (_, o)) => $crate::nom::IResult::Done(remaining, o), + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + } + }; + + ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => { + preceded!($i, $submac!($($args)*), call!($g)) + }; + + ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => { + preceded!($i, call!($f), $submac!($($args)*)) + }; + + ($i:expr, $f:expr, $g:expr) => { + preceded!($i, call!($f), call!($g)) + }; +} + +macro_rules! terminated { + ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => { + match tuple!($i, $submac!($($args)*), $submac2!($($args2)*)) { + $crate::nom::IResult::Done(remaining, (o, _)) => $crate::nom::IResult::Done(remaining, o), + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + } + }; + + ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => { + terminated!($i, $submac!($($args)*), call!($g)) + }; + + ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => { + terminated!($i, call!($f), $submac!($($args)*)) + }; + + ($i:expr, $f:expr, $g:expr) => { + terminated!($i, call!($f), call!($g)) + }; +} + +macro_rules! many0 { + ($i:expr, $submac:ident!( $($args:tt)* )) => {{ + let ret; + let mut res = ::std::vec::Vec::new(); + let mut input = $i; + + loop { + if input.is_empty() { + ret = $crate::nom::IResult::Done(input, res); + break; + } + + match $submac!(input, $($args)*) { + $crate::nom::IResult::Error => { + ret = $crate::nom::IResult::Done(input, res); + break; + } + $crate::nom::IResult::Done(i, o) => { + // loop trip must always consume (otherwise infinite loops) + if i.len() == input.len() { + ret = $crate::nom::IResult::Error; + break; + } + + res.push(o); + input = i; + } + } + } + + ret + }}; + + ($i:expr, $f:expr) => { + $crate::nom::many0($i, $f) + }; +} + +pub fn many0<'a, T>(mut input: &'a str, + f: fn(&'a str) -> IResult<&'a str, T>) + -> IResult<&'a str, Vec> { + let mut res = Vec::new(); + + loop { + if input.is_empty() { + return IResult::Done(input, res); + } + + match f(input) { + IResult::Error => { + return IResult::Done(input, res); + } + IResult::Done(i, o) => { + // loop trip must always consume (otherwise infinite loops) + if i.len() == input.len() { + return IResult::Error; + } + + res.push(o); + input = i; + } + } + } +} + +macro_rules! peek { + ($i:expr, $submac:ident!( $($args:tt)* )) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Done(_, o) => $crate::nom::IResult::Done($i, o), + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + } + }; +} + +macro_rules! take_while1 { + ($input:expr, $submac:ident!( $($args:tt)* )) => {{ + let mut offset = $input.len(); + for (o, c) in $input.char_indices() { + if !$submac!(c, $($args)*) { + offset = o; + break; + } + } + if offset == 0 { + $crate::nom::IResult::Error + } else if offset < $input.len() { + $crate::nom::IResult::Done(&$input[offset..], &$input[..offset]) + } else { + $crate::nom::IResult::Done("", $input) + } + }}; + + ($input:expr, $f:expr) => { + take_while1!($input, call!($f)); + }; +} + +macro_rules! take_until { + ($input:expr, $substr:expr) => {{ + if $substr.len() > $input.len() { + $crate::nom::IResult::Error + } else { + let substr_vec: Vec = $substr.chars().collect(); + let mut window: Vec = vec![]; + let mut offset = $input.len(); + let mut parsed = false; + for (o, c) in $input.char_indices() { + window.push(c); + if window.len() > substr_vec.len() { + window.remove(0); + } + if window == substr_vec { + parsed = true; + window.pop(); + let window_len: usize = window.iter() + .map(|x| x.len_utf8()) + .fold(0, |x, y| x + y); + offset = o - window_len; + break; + } + } + if parsed { + $crate::nom::IResult::Done(&$input[offset..], &$input[..offset]) + } else { + $crate::nom::IResult::Error + } + } + }}; +} + +macro_rules! tag { + ($i:expr, $tag: expr) => { + if $i.starts_with($tag) { + $crate::nom::IResult::Done(&$i[$tag.len()..], &$i[0..$tag.len()]) + } else { + $crate::nom::IResult::Error + } + }; +} + +macro_rules! switch { + ($i:expr, $submac:ident!( $($args:tt)* ), $($p:pat => $subrule:ident!( $($args2:tt)* ))|* ) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => match o { + $( + $p => $subrule!(i, $($args2)*), + )* + _ => $crate::nom::IResult::Error, + } + } + }; +} + +macro_rules! value { + ($i:expr, $res:expr) => { + $crate::nom::IResult::Done($i, $res) + }; +} + +macro_rules! delimited { + ($i:expr, $submac:ident!( $($args:tt)* ), $($rest:tt)+) => { + match tuple_parser!($i, (), $submac!($($args)*), $($rest)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i1, (_, o, _)) => $crate::nom::IResult::Done(i1, o) + } + }; + + ($i:expr, $f:expr, $($rest:tt)+) => { + delimited!($i, call!($f), $($rest)*) + }; +} + +macro_rules! separated_nonempty_list { + ($i:expr, $sep:ident!( $($args:tt)* ), $submac:ident!( $($args2:tt)* )) => {{ + let mut res = ::std::vec::Vec::new(); + let mut input = $i; + + // get the first element + match $submac!(input, $($args2)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => { + if i.len() == input.len() { + $crate::nom::IResult::Error + } else { + res.push(o); + input = i; + + while let $crate::nom::IResult::Done(i2, _) = $sep!(input, $($args)*) { + if i2.len() == input.len() { + break; + } + + if let $crate::nom::IResult::Done(i3, o3) = $submac!(i2, $($args2)*) { + if i3.len() == i2.len() { + break; + } + res.push(o3); + input = i3; + } else { + break; + } + } + $crate::nom::IResult::Done(input, res) + } + } + } + }}; + + ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => { + separated_nonempty_list!($i, $submac!($($args)*), call!($g)) + }; + + ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => { + separated_nonempty_list!($i, call!($f), $submac!($($args)*)) + }; + + ($i:expr, $f:expr, $g:expr) => { + separated_nonempty_list!($i, call!($f), call!($g)) + }; +} + +macro_rules! tuple { + ($i:expr, $($rest:tt)*) => { + tuple_parser!($i, (), $($rest)*) + }; +} + +/// Internal parser, do not use directly +macro_rules! tuple_parser { + ($i:expr, ($($parsed:tt),*), $e:ident, $($rest:tt)*) => { + tuple_parser!($i, ($($parsed),*), call!($e), $($rest)*) + }; + + ($i:expr, (), $submac:ident!( $($args:tt)* ), $($rest:tt)*) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => + tuple_parser!(i, (o), $($rest)*), + } + }; + + ($i:expr, ($($parsed:tt)*), $submac:ident!( $($args:tt)* ), $($rest:tt)*) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => + tuple_parser!(i, ($($parsed)* , o), $($rest)*), + } + }; + + ($i:expr, ($($parsed:tt),*), $e:ident) => { + tuple_parser!($i, ($($parsed),*), call!($e)) + }; + + ($i:expr, (), $submac:ident!( $($args:tt)* )) => { + $submac!($i, $($args)*) + }; + + ($i:expr, ($($parsed:expr),*), $submac:ident!( $($args:tt)* )) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => $crate::nom::IResult::Done(i, ($($parsed),*, o)) + } + }; + + ($i:expr, ($($parsed:expr),*)) => { + $crate::nom::IResult::Done($i, ($($parsed),*)) + }; +} + +macro_rules! alt { + ($i:expr, $e:ident | $($rest:tt)*) => { + alt!($i, call!($e) | $($rest)*) + }; + + ($i:expr, $subrule:ident!( $($args:tt)*) | $($rest:tt)*) => { + match $subrule!($i, $($args)*) { + res @ $crate::nom::IResult::Done(_, _) => res, + _ => alt!($i, $($rest)*) + } + }; + + ($i:expr, $subrule:ident!( $($args:tt)* ) => { $gen:expr } | $($rest:tt)+) => { + match $subrule!($i, $($args)*) { + $crate::nom::IResult::Done(i, o) => $crate::nom::IResult::Done(i, $gen(o)), + $crate::nom::IResult::Error => alt!($i, $($rest)*) + } + }; + + ($i:expr, $e:ident => { $gen:expr } | $($rest:tt)*) => { + alt!($i, call!($e) => { $gen } | $($rest)*) + }; + + ($i:expr, $e:ident => { $gen:expr }) => { + alt!($i, call!($e) => { $gen }) + }; + + ($i:expr, $subrule:ident!( $($args:tt)* ) => { $gen:expr }) => { + match $subrule!($i, $($args)*) { + $crate::nom::IResult::Done(i, o) => $crate::nom::IResult::Done(i, $gen(o)), + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + } + }; + + ($i:expr, $e:ident) => { + alt!($i, call!($e)) + }; + + ($i:expr, $subrule:ident!( $($args:tt)*)) => { + $subrule!($i, $($args)*) + }; +} + +macro_rules! do_parse { + ($i:expr, ( $($rest:expr),* )) => { + $crate::nom::IResult::Done($i, ( $($rest),* )) + }; + + ($i:expr, $e:ident >> $($rest:tt)*) => { + do_parse!($i, call!($e) >> $($rest)*) + }; + + ($i:expr, $submac:ident!( $($args:tt)* ) >> $($rest:tt)*) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, _) => + do_parse!(i, $($rest)*), + } + }; + + ($i:expr, $field:ident : $e:ident >> $($rest:tt)*) => { + do_parse!($i, $field: call!($e) >> $($rest)*) + }; + + ($i:expr, $field:ident : $submac:ident!( $($args:tt)* ) >> $($rest:tt)*) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => { + let $field = o; + do_parse!(i, $($rest)*) + }, + } + }; + + ($i:expr, mut $field:ident : $e:ident >> $($rest:tt)*) => { + do_parse!($i, mut $field: call!($e) >> $($rest)*) + }; + + ($i:expr, mut $field:ident : $submac:ident!( $($args:tt)* ) >> $($rest:tt)*) => { + match $submac!($i, $($args)*) { + $crate::nom::IResult::Error => $crate::nom::IResult::Error, + $crate::nom::IResult::Done(i, o) => { + let mut $field = o; + do_parse!(i, $($rest)*) + }, + } + }; +} diff --git a/third_party/rust/syn/src/op.rs b/third_party/rust/syn/src/op.rs new file mode 100644 index 000000000000..d4b0bc7f2a3d --- /dev/null +++ b/third_party/rust/syn/src/op.rs @@ -0,0 +1,192 @@ +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum BinOp { + /// The `+` operator (addition) + Add, + /// The `-` operator (subtraction) + Sub, + /// The `*` operator (multiplication) + Mul, + /// The `/` operator (division) + Div, + /// The `%` operator (modulus) + Rem, + /// The `&&` operator (logical and) + And, + /// The `||` operator (logical or) + Or, + /// The `^` operator (bitwise xor) + BitXor, + /// The `&` operator (bitwise and) + BitAnd, + /// The `|` operator (bitwise or) + BitOr, + /// The `<<` operator (shift left) + Shl, + /// The `>>` operator (shift right) + Shr, + /// The `==` operator (equality) + Eq, + /// The `<` operator (less than) + Lt, + /// The `<=` operator (less than or equal to) + Le, + /// The `!=` operator (not equal to) + Ne, + /// The `>=` operator (greater than or equal to) + Ge, + /// The `>` operator (greater than) + Gt, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum UnOp { + /// The `*` operator for dereferencing + Deref, + /// The `!` operator for logical inversion + Not, + /// The `-` operator for negation + Neg, +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + + named!(pub binop -> BinOp, alt!( + punct!("&&") => { |_| BinOp::And } + | + punct!("||") => { |_| BinOp::Or } + | + punct!("<<") => { |_| BinOp::Shl } + | + punct!(">>") => { |_| BinOp::Shr } + | + punct!("==") => { |_| BinOp::Eq } + | + punct!("<=") => { |_| BinOp::Le } + | + punct!("!=") => { |_| BinOp::Ne } + | + punct!(">=") => { |_| BinOp::Ge } + | + punct!("+") => { |_| BinOp::Add } + | + punct!("-") => { |_| BinOp::Sub } + | + punct!("*") => { |_| BinOp::Mul } + | + punct!("/") => { |_| BinOp::Div } + | + punct!("%") => { |_| BinOp::Rem } + | + punct!("^") => { |_| BinOp::BitXor } + | + punct!("&") => { |_| BinOp::BitAnd } + | + punct!("|") => { |_| BinOp::BitOr } + | + punct!("<") => { |_| BinOp::Lt } + | + punct!(">") => { |_| BinOp::Gt } + )); + + #[cfg(feature = "full")] + named!(pub assign_op -> BinOp, alt!( + punct!("+=") => { |_| BinOp::Add } + | + punct!("-=") => { |_| BinOp::Sub } + | + punct!("*=") => { |_| BinOp::Mul } + | + punct!("/=") => { |_| BinOp::Div } + | + punct!("%=") => { |_| BinOp::Rem } + | + punct!("^=") => { |_| BinOp::BitXor } + | + punct!("&=") => { |_| BinOp::BitAnd } + | + punct!("|=") => { |_| BinOp::BitOr } + | + punct!("<<=") => { |_| BinOp::Shl } + | + punct!(">>=") => { |_| BinOp::Shr } + )); + + named!(pub unop -> UnOp, alt!( + punct!("*") => { |_| UnOp::Deref } + | + punct!("!") => { |_| UnOp::Not } + | + punct!("-") => { |_| UnOp::Neg } + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use quote::{Tokens, ToTokens}; + + impl BinOp { + pub fn op(&self) -> &'static str { + match *self { + BinOp::Add => "+", + BinOp::Sub => "-", + BinOp::Mul => "*", + BinOp::Div => "/", + BinOp::Rem => "%", + BinOp::And => "&&", + BinOp::Or => "||", + BinOp::BitXor => "^", + BinOp::BitAnd => "&", + BinOp::BitOr => "|", + BinOp::Shl => "<<", + BinOp::Shr => ">>", + BinOp::Eq => "==", + BinOp::Lt => "<", + BinOp::Le => "<=", + BinOp::Ne => "!=", + BinOp::Ge => ">=", + BinOp::Gt => ">", + } + } + + pub fn assign_op(&self) -> Option<&'static str> { + match *self { + BinOp::Add => Some("+="), + BinOp::Sub => Some("-="), + BinOp::Mul => Some("*="), + BinOp::Div => Some("/="), + BinOp::Rem => Some("%="), + BinOp::BitXor => Some("^="), + BinOp::BitAnd => Some("&="), + BinOp::BitOr => Some("|="), + BinOp::Shl => Some("<<="), + BinOp::Shr => Some(">>="), + _ => None, + } + } + } + + impl ToTokens for BinOp { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(self.op()); + } + } + + impl UnOp { + pub fn op(&self) -> &'static str { + match *self { + UnOp::Deref => "*", + UnOp::Not => "!", + UnOp::Neg => "-", + } + } + } + + impl ToTokens for UnOp { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append(self.op()); + } + } +} diff --git a/third_party/rust/syn/src/registry.rs b/third_party/rust/syn/src/registry.rs new file mode 100644 index 000000000000..24e1c6b1c087 --- /dev/null +++ b/third_party/rust/syn/src/registry.rs @@ -0,0 +1,392 @@ +use super::{Attribute, AttrStyle, Body, Crate, Ident, Item, ItemKind, MacroInput, MetaItem, + NestedMetaItem}; +use quote::Tokens; + +use std::collections::BTreeMap as Map; +use std::fs::File; +use std::io::{Read, Write}; +use std::path::Path; + +/// Implementation of a custom derive. Custom derives take a struct or enum and +/// expand it into zero or more items, typically `impl` items. +pub trait CustomDerive { + /// Expand the given struct or enum. If this custom derive modifies the + /// input item or preserves it unmodified, it must be returned back in the + /// `original` field of Expanded. The custom derive may discard the input + /// item by setting `original` to None. + fn expand(&self, input: MacroInput) -> Result; +} + +/// Produced by expanding a custom derive. +pub struct Expanded { + /// The items (typically `impl` items) constructed by the custom derive. + pub new_items: Vec, + /// The input to the custom derive, whether modified or unmodified. If the + /// custom derive discards the input item it may do so by setting `original` + /// to None. + pub original: Option, +} + +/// Registry of custom derives. Callers add custom derives to a registry, then +/// use the registry to expand those derives in a source file. +#[derive(Default)] +pub struct Registry<'a> { + derives: Map>, +} + +impl CustomDerive for T + where T: Fn(MacroInput) -> Result +{ + fn expand(&self, input: MacroInput) -> Result { + self(input) + } +} + +impl<'a> Registry<'a> { + pub fn new() -> Self { + Default::default() + } + + /// Register a custom derive. A `fn(MacroInput) -> Result` + /// may be used as a custom derive. + /// + /// ```ignore + /// registry.add_derive("Serialize", expand_serialize); + /// ``` + pub fn add_derive(&mut self, name: &str, derive: T) + where T: CustomDerive + 'a + { + self.derives.insert(name.into(), Box::new(derive)); + } + + /// Read Rust source code from the `src` file, expand the custom derives + /// that have been registered, and write the result to the `dst` file. + pub fn expand_file(&self, src: S, dst: D) -> Result<(), String> + where S: AsRef, + D: AsRef + { + // Open the src file + let mut src = match File::open(src) { + Ok(open) => open, + Err(err) => return Err(err.to_string()), + }; + + // Read the contents of the src file to a String + let mut content = String::new(); + if let Err(err) = src.read_to_string(&mut content) { + return Err(err.to_string()); + } + + // Parse the contents + let krate = try!(super::parse_crate(&content)); + + // Expand + let expanded = try!(expand_crate(self, krate)); + + // Print the expanded code to a String + let out = try!(pretty(quote!(#expanded))); + + // Create or truncate the dst file, opening in write-only mode + let mut dst = match File::create(dst) { + Ok(create) => create, + Err(err) => return Err(err.to_string()), + }; + + // Write expanded code to the dst file + if let Err(err) = dst.write_all(out.as_bytes()) { + return Err(err.to_string()); + } + + Ok(()) + } +} + +fn expand_crate(reg: &Registry, krate: Crate) -> Result { + let mut items = Vec::new(); + for item in krate.items { + try!(expand_item(reg, item, Vec::new(), &mut items)); + } + Ok(Crate { items: items, ..krate }) +} + +fn expand_item(reg: &Registry, + mut item: Item, + cfg: Vec, + out: &mut Vec) + -> Result<(), String> { + let (body, generics) = match item.node { + ItemKind::Enum(variants, generics) => (Body::Enum(variants), generics), + ItemKind::Struct(variant_data, generics) => (Body::Struct(variant_data), generics), + _ => { + // Custom derives cannot apply to this item, preserve it unmodified + item.attrs.extend(combine_cfgs(cfg)); + out.push(item); + return Ok(()); + } + }; + let macro_input = MacroInput { + ident: item.ident, + vis: item.vis, + attrs: item.attrs, + generics: generics, + body: body, + }; + expand_macro_input(reg, macro_input, cfg, out) +} + +fn expand_macro_input(reg: &Registry, + mut input: MacroInput, + inherited_cfg: Vec, + out: &mut Vec) + -> Result<(), String> { + let mut derives = Vec::new(); + let mut all_cfg = inherited_cfg; + + // Find custom derives on this item, removing them from the input + input.attrs = input.attrs + .into_iter() + .flat_map(|attr| { + let (new_derives, cfg, attr) = parse_attr(reg, attr); + derives.extend(new_derives); + all_cfg.extend(cfg); + attr + }) + .collect(); + + // Expand each custom derive + for derive in derives { + let expanded = try!(reg.derives[derive.name.as_ref()].expand(input)); + + for new_item in expanded.new_items { + let mut extended_cfg = all_cfg.clone(); + extended_cfg.extend(derive.cfg.clone()); + try!(expand_item(reg, new_item, extended_cfg, out)); + } + + input = match expanded.original { + Some(input) => input, + None => return Ok(()), + }; + } + + input.attrs.extend(combine_cfgs(all_cfg)); + out.push(input.into()); + Ok(()) +} + +struct Derive { + name: Ident, + /// If the custom derive was behind a cfg_attr + cfg: Option, +} + +/// Pull custom derives and cfgs out of the given Attribute. +fn parse_attr(reg: &Registry, + attr: Attribute) + -> (Vec, Vec, Option) { + if attr.style != AttrStyle::Outer || attr.is_sugared_doc { + return (Vec::new(), Vec::new(), Some(attr)); + } + + let (name, nested) = match attr.value { + MetaItem::List(name, nested) => (name, nested), + _ => return (Vec::new(), Vec::new(), Some(attr)), + }; + + match name.as_ref() { + "derive" => { + let (derives, attr) = parse_derive_attr(reg, nested); + let derives = derives.into_iter() + .map(|d| { + Derive { + name: d, + cfg: None, + } + }) + .collect(); + (derives, Vec::new(), attr) + } + "cfg_attr" => { + let (derives, attr) = parse_cfg_attr(reg, nested); + (derives, Vec::new(), attr) + } + "cfg" => (Vec::new(), nested, None), + _ => { + // Rebuild the original attribute because it was destructured above + let attr = Attribute { + style: AttrStyle::Outer, + value: MetaItem::List(name, nested), + is_sugared_doc: false, + }; + (Vec::new(), Vec::new(), Some(attr)) + } + } +} + +/// Assuming the given nested meta-items came from a #[derive(...)] attribute, +/// pull out the ones that are custom derives. +fn parse_derive_attr(reg: &Registry, + nested: Vec) + -> (Vec, Option) { + let mut derives = Vec::new(); + + let remaining: Vec<_> = nested.into_iter() + .flat_map(|meta| { + let word = match meta { + NestedMetaItem::MetaItem(MetaItem::Word(word)) => word, + _ => return Some(meta), + }; + if reg.derives.contains_key(word.as_ref()) { + derives.push(word); + None + } else { + Some(NestedMetaItem::MetaItem(MetaItem::Word(word))) + } + }) + .collect(); + + let attr = if remaining.is_empty() { + // Elide an empty #[derive()] + None + } else { + Some(Attribute { + style: AttrStyle::Outer, + value: MetaItem::List("derive".into(), remaining), + is_sugared_doc: false, + }) + }; + + (derives, attr) +} + +/// Assuming the given nested meta-items came from a #[cfg_attr(...)] attribute, +/// pull out any custom derives contained within. +fn parse_cfg_attr(reg: &Registry, nested: Vec) -> (Vec, Option) { + if nested.len() != 2 { + let attr = Attribute { + style: AttrStyle::Outer, + value: MetaItem::List("cfg_attr".into(), nested), + is_sugared_doc: false, + }; + return (Vec::new(), Some(attr)); + } + + let mut iter = nested.into_iter(); + let cfg = iter.next().unwrap(); + let arg = iter.next().unwrap(); + + let (name, nested) = match arg { + NestedMetaItem::MetaItem(MetaItem::List(name, nested)) => (name, nested), + _ => { + let attr = Attribute { + style: AttrStyle::Outer, + value: MetaItem::List("cfg_attr".into(), vec![cfg, arg]), + is_sugared_doc: false, + }; + return (Vec::new(), Some(attr)); + } + }; + + if name == "derive" { + let (derives, attr) = parse_derive_attr(reg, nested); + let derives = derives.into_iter() + .map(|d| { + Derive { + name: d, + cfg: Some(cfg.clone()), + } + }) + .collect(); + let attr = attr.map(|attr| { + Attribute { + style: AttrStyle::Outer, + value: MetaItem::List("cfg_attr".into(), + vec![cfg, NestedMetaItem::MetaItem(attr.value)]), + is_sugared_doc: false, + } + }); + (derives, attr) + } else { + let attr = Attribute { + style: AttrStyle::Outer, + value: + MetaItem::List("cfg_attr".into(), + vec![cfg, NestedMetaItem::MetaItem(MetaItem::List(name, nested))]), + is_sugared_doc: false, + }; + (Vec::new(), Some(attr)) + } +} + +/// Combine a list of cfg expressions into an attribute like `#[cfg(a)]` or +/// `#[cfg(all(a, b, c))]`, or nothing if there are no cfg expressions. +fn combine_cfgs(cfg: Vec) -> Option { + // Flatten `all` cfgs so we don't nest `all` inside of `all`. + let cfg: Vec<_> = cfg.into_iter() + .flat_map(|cfg| { + let (name, nested) = match cfg { + NestedMetaItem::MetaItem(MetaItem::List(name, nested)) => (name, nested), + _ => return vec![cfg], + }; + if name == "all" { + nested + } else { + vec![NestedMetaItem::MetaItem(MetaItem::List(name, nested))] + } + }) + .collect(); + + let value = match cfg.len() { + 0 => return None, + 1 => cfg, + _ => vec![NestedMetaItem::MetaItem(MetaItem::List("all".into(), cfg))], + }; + + Some(Attribute { + style: AttrStyle::Outer, + value: MetaItem::List("cfg".into(), value), + is_sugared_doc: false, + }) +} + +#[cfg(not(feature = "pretty"))] +fn pretty(tokens: Tokens) -> Result { + Ok(tokens.to_string()) +} + +#[cfg(feature = "pretty")] +fn pretty(tokens: Tokens) -> Result { + use syntax::parse::{self, ParseSess}; + use syntax::print::pprust; + + let name = "syn".to_string(); + let source = tokens.to_string(); + let sess = ParseSess::new(); + let krate = match parse::parse_crate_from_source_str(name, source, &sess) { + Ok(krate) => krate, + Err(mut err) => { + err.emit(); + return Err("pretty printer failed to parse expanded code".into()); + } + }; + + if sess.span_diagnostic.has_errors() { + return Err("pretty printer failed to parse expanded code".into()); + } + + let mut reader = &tokens.to_string().into_bytes()[..]; + let mut writer = Vec::new(); + let ann = pprust::NoAnn; + + try!(pprust::print_crate( + sess.codemap(), + &sess.span_diagnostic, + &krate, + "".to_string(), + &mut reader, + Box::new(&mut writer), + &ann, + false).map_err(|err| err.to_string())); + + String::from_utf8(writer).map_err(|err| err.to_string()) +} diff --git a/third_party/rust/syn/src/space.rs b/third_party/rust/syn/src/space.rs new file mode 100644 index 000000000000..d168e135d3a3 --- /dev/null +++ b/third_party/rust/syn/src/space.rs @@ -0,0 +1,99 @@ +use nom::IResult; +use unicode_xid::UnicodeXID; + +pub fn whitespace(input: &str) -> IResult<&str, ()> { + if input.is_empty() { + return IResult::Error; + } + + let bytes = input.as_bytes(); + let mut i = 0; + while i < bytes.len() { + let s = &input[i..]; + if bytes[i] == b'/' { + if s.starts_with("//") && (!s.starts_with("///") || s.starts_with("////")) && + !s.starts_with("//!") { + if let Some(len) = s.find('\n') { + i += len + 1; + continue; + } + break; + } else if s.starts_with("/*") && (!s.starts_with("/**") || s.starts_with("/***")) && + !s.starts_with("/*!") { + match block_comment(s) { + IResult::Done(_, com) => { + i += com.len(); + continue; + } + IResult::Error => { + return IResult::Error; + } + } + } + } + match bytes[i] { + b' ' | 0x09...0x0d => { + i += 1; + continue; + } + b if b <= 0x7f => {} + _ => { + let ch = s.chars().next().unwrap(); + if is_whitespace(ch) { + i += ch.len_utf8(); + continue; + } + } + } + return if i > 0 { + IResult::Done(s, ()) + } else { + IResult::Error + }; + } + IResult::Done("", ()) +} + +pub fn block_comment(input: &str) -> IResult<&str, &str> { + if !input.starts_with("/*") { + return IResult::Error; + } + + let mut depth = 0; + let bytes = input.as_bytes(); + let mut i = 0; + let upper = bytes.len() - 1; + while i < upper { + if bytes[i] == b'/' && bytes[i + 1] == b'*' { + depth += 1; + i += 1; // eat '*' + } else if bytes[i] == b'*' && bytes[i + 1] == b'/' { + depth -= 1; + if depth == 0 { + return IResult::Done(&input[i + 2..], &input[..i + 2]); + } + i += 1; // eat '/' + } + i += 1; + } + IResult::Error +} + +pub fn word_break(input: &str) -> IResult<&str, ()> { + match input.chars().next() { + Some(ch) if UnicodeXID::is_xid_continue(ch) => IResult::Error, + Some(_) | None => IResult::Done(input, ()), + } +} + +pub fn skip_whitespace(input: &str) -> &str { + match whitespace(input) { + IResult::Done(rest, _) => rest, + IResult::Error => input, + } +} + +fn is_whitespace(ch: char) -> bool { + // Rust treats left-to-right mark and right-to-left mark as whitespace + ch.is_whitespace() || ch == '\u{200e}' || ch == '\u{200f}' +} diff --git a/third_party/rust/syn/src/ty.rs b/third_party/rust/syn/src/ty.rs new file mode 100644 index 000000000000..dfd2a06e608d --- /dev/null +++ b/third_party/rust/syn/src/ty.rs @@ -0,0 +1,865 @@ +use super::*; + +/// The different kinds of types recognized by the compiler +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum Ty { + /// A variable-length array (`[T]`) + Slice(Box), + /// A fixed length array (`[T; n]`) + Array(Box, ConstExpr), + /// A raw pointer (`*const T` or `*mut T`) + Ptr(Box), + /// A reference (`&'a T` or `&'a mut T`) + Rptr(Option, Box), + /// A bare function (e.g. `fn(usize) -> bool`) + BareFn(Box), + /// The never type (`!`) + Never, + /// A tuple (`(A, B, C, D, ...)`) + Tup(Vec), + /// A path (`module::module::...::Type`), optionally + /// "qualified", e.g. ` as SomeTrait>::SomeType`. + /// + /// Type parameters are stored in the Path itself + Path(Option, Path), + /// Something like `A+B`. Note that `B` must always be a path. + ObjectSum(Box, Vec), + /// A type like `for<'a> Foo<&'a Bar>` + PolyTraitRef(Vec), + /// An `impl TraitA+TraitB` type. + ImplTrait(Vec), + /// No-op; kept solely so that we can pretty-print faithfully + Paren(Box), + /// TyKind::Infer means the type should be inferred instead of it having been + /// specified. This can appear anywhere in a type. + Infer, + /// A macro in the type position. + Mac(Mac), +} + +#[cfg(not(feature = "type-macros"))] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Mac { + _private: (), +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct MutTy { + pub ty: Ty, + pub mutability: Mutability, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum Mutability { + Mutable, + Immutable, +} + +/// A "Path" is essentially Rust's notion of a name. +/// +/// It's represented as a sequence of identifiers, +/// along with a bunch of supporting information. +/// +/// E.g. `std::cmp::PartialEq` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct Path { + /// A `::foo` path, is relative to the crate root rather than current + /// module (like paths in an import). + pub global: bool, + /// The segments in the path: the things separated by `::`. + pub segments: Vec, +} + +impl From for Path + where T: Into +{ + fn from(segment: T) -> Self { + Path { + global: false, + segments: vec![segment.into()], + } + } +} + +/// A segment of a path: an identifier, an optional lifetime, and a set of types. +/// +/// E.g. `std`, `String` or `Box` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct PathSegment { + /// The identifier portion of this path segment. + pub ident: Ident, + /// Type/lifetime parameters attached to this path. They come in + /// two flavors: `Path` and `Path(A,B) -> C`. Note that + /// this is more than just simple syntactic sugar; the use of + /// parens affects the region binding rules, so we preserve the + /// distinction. + pub parameters: PathParameters, +} + +impl From for PathSegment + where T: Into +{ + fn from(ident: T) -> Self { + PathSegment { + ident: ident.into(), + parameters: PathParameters::none(), + } + } +} + +/// Parameters of a path segment. +/// +/// E.g. `` as in `Foo` or `(A, B)` as in `Foo(A, B)` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum PathParameters { + /// The `<'a, A, B, C>` in `foo::bar::baz::<'a, A, B, C>` + AngleBracketed(AngleBracketedParameterData), + /// The `(A, B)` and `C` in `Foo(A, B) -> C` + Parenthesized(ParenthesizedParameterData), +} + +impl PathParameters { + pub fn none() -> Self { + PathParameters::AngleBracketed(AngleBracketedParameterData::default()) + } + + pub fn is_empty(&self) -> bool { + match *self { + PathParameters::AngleBracketed(ref bracketed) => { + bracketed.lifetimes.is_empty() && bracketed.types.is_empty() && + bracketed.bindings.is_empty() + } + PathParameters::Parenthesized(_) => false, + } + } +} + +/// A path like `Foo<'a, T>` +#[derive(Debug, Clone, Eq, PartialEq, Default, Hash)] +pub struct AngleBracketedParameterData { + /// The lifetime parameters for this path segment. + pub lifetimes: Vec, + /// The type parameters for this path segment, if present. + pub types: Vec, + /// Bindings (equality constraints) on associated types, if present. + /// + /// E.g., `Foo`. + pub bindings: Vec, +} + +/// Bind a type to an associated type: `A=Foo`. +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct TypeBinding { + pub ident: Ident, + pub ty: Ty, +} + +/// A path like `Foo(A,B) -> C` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct ParenthesizedParameterData { + /// `(A, B)` + pub inputs: Vec, + /// `C` + pub output: Option, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct PolyTraitRef { + /// The `'a` in `<'a> Foo<&'a T>` + pub bound_lifetimes: Vec, + /// The `Foo<&'a T>` in `<'a> Foo<&'a T>` + pub trait_ref: Path, +} + +/// The explicit Self type in a "qualified path". The actual +/// path, including the trait and the associated item, is stored +/// separately. `position` represents the index of the associated +/// item qualified with this Self type. +/// +/// ```rust,ignore +/// as a::b::Trait>::AssociatedItem +/// ^~~~~ ~~~~~~~~~~~~~~^ +/// ty position = 3 +/// +/// >::AssociatedItem +/// ^~~~~ ^ +/// ty position = 0 +/// ``` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct QSelf { + pub ty: Box, + pub position: usize, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct BareFnTy { + pub unsafety: Unsafety, + pub abi: Option, + pub lifetimes: Vec, + pub inputs: Vec, + pub output: FunctionRetTy, + pub variadic: bool, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum Unsafety { + Unsafe, + Normal, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum Abi { + Named(String), + Rust, +} + +/// An argument in a function type. +/// +/// E.g. `bar: usize` as in `fn foo(bar: usize)` +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct BareFnArg { + pub name: Option, + pub ty: Ty, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub enum FunctionRetTy { + /// Return type is not specified. + /// + /// Functions default to `()` and + /// closures default to inference. Span points to where return + /// type would be inserted. + Default, + /// Everything else + Ty(Ty), +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + #[cfg(feature = "full")] + use ConstExpr; + use constant::parsing::const_expr; + #[cfg(feature = "full")] + use expr::parsing::expr; + use generics::parsing::{lifetime, lifetime_def, ty_param_bound, bound_lifetimes}; + use ident::parsing::ident; + use lit::parsing::quoted_string; + #[cfg(feature = "type-macros")] + use mac::parsing::mac; + #[cfg(not(feature = "type-macros"))] + use nom::IResult; + use std::str; + + named!(pub ty -> Ty, alt!( + ty_paren // must be before ty_tup + | + ty_mac // must be before ty_path + | + ty_path // must be before ty_poly_trait_ref + | + ty_vec + | + ty_array + | + ty_ptr + | + ty_rptr + | + ty_bare_fn + | + ty_never + | + ty_tup + | + ty_poly_trait_ref + | + ty_impl_trait + )); + + #[cfg(feature = "type-macros")] + named!(ty_mac -> Ty, map!(mac, Ty::Mac)); + + #[cfg(not(feature = "type-macros"))] + fn ty_mac(_: &str) -> IResult<&str, Ty> { + IResult::Error + } + + named!(ty_vec -> Ty, do_parse!( + punct!("[") >> + elem: ty >> + punct!("]") >> + (Ty::Slice(Box::new(elem))) + )); + + #[cfg(not(feature = "full"))] + named!(ty_array -> Ty, do_parse!( + punct!("[") >> + elem: ty >> + punct!(";") >> + len: const_expr >> + punct!("]") >> + (Ty::Array(Box::new(elem), len)) + )); + + #[cfg(feature = "full")] + named!(ty_array -> Ty, do_parse!( + punct!("[") >> + elem: ty >> + punct!(";") >> + len: alt!( + terminated!(const_expr, punct!("]")) + | + terminated!(expr, punct!("]")) => { ConstExpr::Other } + ) >> + (Ty::Array(Box::new(elem), len)) + )); + + named!(ty_ptr -> Ty, do_parse!( + punct!("*") >> + mutability: alt!( + keyword!("const") => { |_| Mutability::Immutable } + | + keyword!("mut") => { |_| Mutability::Mutable } + ) >> + target: ty >> + (Ty::Ptr(Box::new(MutTy { + ty: target, + mutability: mutability, + }))) + )); + + named!(ty_rptr -> Ty, do_parse!( + punct!("&") >> + life: option!(lifetime) >> + mutability: mutability >> + target: ty >> + (Ty::Rptr(life, Box::new(MutTy { + ty: target, + mutability: mutability, + }))) + )); + + named!(ty_bare_fn -> Ty, do_parse!( + lifetimes: opt_vec!(do_parse!( + keyword!("for") >> + punct!("<") >> + lifetimes: terminated_list!(punct!(","), lifetime_def) >> + punct!(">") >> + (lifetimes) + )) >> + unsafety: unsafety >> + abi: option!(abi) >> + keyword!("fn") >> + punct!("(") >> + inputs: separated_list!(punct!(","), fn_arg) >> + trailing_comma: option!(punct!(",")) >> + variadic: option!(cond_reduce!(trailing_comma.is_some(), punct!("..."))) >> + punct!(")") >> + output: option!(preceded!( + punct!("->"), + ty + )) >> + (Ty::BareFn(Box::new(BareFnTy { + unsafety: unsafety, + abi: abi, + lifetimes: lifetimes, + inputs: inputs, + output: match output { + Some(ty) => FunctionRetTy::Ty(ty), + None => FunctionRetTy::Default, + }, + variadic: variadic.is_some(), + }))) + )); + + named!(ty_never -> Ty, map!(punct!("!"), |_| Ty::Never)); + + named!(ty_tup -> Ty, do_parse!( + punct!("(") >> + elems: terminated_list!(punct!(","), ty) >> + punct!(")") >> + (Ty::Tup(elems)) + )); + + named!(ty_path -> Ty, do_parse!( + qpath: qpath >> + parenthesized: cond!( + qpath.1.segments.last().unwrap().parameters == PathParameters::none(), + option!(parenthesized_parameter_data) + ) >> + bounds: many0!(preceded!(punct!("+"), ty_param_bound)) >> + ({ + let (qself, mut path) = qpath; + if let Some(Some(parenthesized)) = parenthesized { + path.segments.last_mut().unwrap().parameters = parenthesized; + } + let path = Ty::Path(qself, path); + if bounds.is_empty() { + path + } else { + Ty::ObjectSum(Box::new(path), bounds) + } + }) + )); + + named!(parenthesized_parameter_data -> PathParameters, do_parse!( + punct!("(") >> + inputs: terminated_list!(punct!(","), ty) >> + punct!(")") >> + output: option!(preceded!( + punct!("->"), + ty + )) >> + (PathParameters::Parenthesized( + ParenthesizedParameterData { + inputs: inputs, + output: output, + }, + )) + )); + + named!(pub qpath -> (Option, Path), alt!( + map!(path, |p| (None, p)) + | + do_parse!( + punct!("<") >> + this: map!(ty, Box::new) >> + path: option!(preceded!( + keyword!("as"), + path + )) >> + punct!(">") >> + punct!("::") >> + rest: separated_nonempty_list!(punct!("::"), path_segment) >> + ({ + match path { + Some(mut path) => { + let pos = path.segments.len(); + path.segments.extend(rest); + (Some(QSelf { ty: this, position: pos }), path) + } + None => { + (Some(QSelf { ty: this, position: 0 }), Path { + global: false, + segments: rest, + }) + } + } + }) + ) + | + map!(keyword!("self"), |_| (None, "self".into())) + )); + + named!(ty_poly_trait_ref -> Ty, map!( + separated_nonempty_list!(punct!("+"), ty_param_bound), + Ty::PolyTraitRef + )); + + named!(ty_impl_trait -> Ty, do_parse!( + keyword!("impl") >> + elem: separated_nonempty_list!(punct!("+"), ty_param_bound) >> + (Ty::ImplTrait(elem)) + )); + + named!(ty_paren -> Ty, do_parse!( + punct!("(") >> + elem: ty >> + punct!(")") >> + (Ty::Paren(Box::new(elem))) + )); + + named!(pub mutability -> Mutability, alt!( + keyword!("mut") => { |_| Mutability::Mutable } + | + epsilon!() => { |_| Mutability::Immutable } + )); + + named!(pub path -> Path, do_parse!( + global: option!(punct!("::")) >> + segments: separated_nonempty_list!(punct!("::"), path_segment) >> + (Path { + global: global.is_some(), + segments: segments, + }) + )); + + named!(path_segment -> PathSegment, alt!( + do_parse!( + id: option!(ident) >> + punct!("<") >> + lifetimes: separated_list!(punct!(","), lifetime) >> + types: opt_vec!(preceded!( + cond!(!lifetimes.is_empty(), punct!(",")), + separated_nonempty_list!( + punct!(","), + terminated!(ty, not!(peek!(punct!("=")))) + ) + )) >> + bindings: opt_vec!(preceded!( + cond!(!lifetimes.is_empty() || !types.is_empty(), punct!(",")), + separated_nonempty_list!(punct!(","), type_binding) + )) >> + cond!(!lifetimes.is_empty() || !types.is_empty() || !bindings.is_empty(), option!(punct!(","))) >> + punct!(">") >> + (PathSegment { + ident: id.unwrap_or_else(|| "".into()), + parameters: PathParameters::AngleBracketed( + AngleBracketedParameterData { + lifetimes: lifetimes, + types: types, + bindings: bindings, + } + ), + }) + ) + | + map!(ident, Into::into) + | + map!(alt!( + keyword!("super") + | + keyword!("self") + | + keyword!("Self") + ), Into::into) + )); + + named!(type_binding -> TypeBinding, do_parse!( + id: ident >> + punct!("=") >> + ty: ty >> + (TypeBinding { + ident: id, + ty: ty, + }) + )); + + named!(pub poly_trait_ref -> PolyTraitRef, do_parse!( + bound_lifetimes: bound_lifetimes >> + trait_ref: path >> + parenthesized: option!(cond_reduce!( + trait_ref.segments.last().unwrap().parameters == PathParameters::none(), + parenthesized_parameter_data + )) >> + ({ + let mut trait_ref = trait_ref; + if let Some(parenthesized) = parenthesized { + trait_ref.segments.last_mut().unwrap().parameters = parenthesized; + } + PolyTraitRef { + bound_lifetimes: bound_lifetimes, + trait_ref: trait_ref, + } + }) + )); + + named!(pub fn_arg -> BareFnArg, do_parse!( + name: option!(do_parse!( + name: ident >> + punct!(":") >> + not!(peek!(tag!(":"))) >> // not :: + (name) + )) >> + ty: ty >> + (BareFnArg { + name: name, + ty: ty, + }) + )); + + named!(pub unsafety -> Unsafety, alt!( + keyword!("unsafe") => { |_| Unsafety::Unsafe } + | + epsilon!() => { |_| Unsafety::Normal } + )); + + named!(pub abi -> Abi, do_parse!( + keyword!("extern") >> + name: option!(quoted_string) >> + (match name { + Some(name) => Abi::Named(name), + None => Abi::Rust, + }) + )); +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use quote::{Tokens, ToTokens}; + + impl ToTokens for Ty { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Ty::Slice(ref inner) => { + tokens.append("["); + inner.to_tokens(tokens); + tokens.append("]"); + } + Ty::Array(ref inner, ref len) => { + tokens.append("["); + inner.to_tokens(tokens); + tokens.append(";"); + len.to_tokens(tokens); + tokens.append("]"); + } + Ty::Ptr(ref target) => { + tokens.append("*"); + match target.mutability { + Mutability::Mutable => tokens.append("mut"), + Mutability::Immutable => tokens.append("const"), + } + target.ty.to_tokens(tokens); + } + Ty::Rptr(ref lifetime, ref target) => { + tokens.append("&"); + lifetime.to_tokens(tokens); + target.mutability.to_tokens(tokens); + target.ty.to_tokens(tokens); + } + Ty::BareFn(ref func) => { + func.to_tokens(tokens); + } + Ty::Never => { + tokens.append("!"); + } + Ty::Tup(ref elems) => { + tokens.append("("); + tokens.append_separated(elems, ","); + if elems.len() == 1 { + tokens.append(","); + } + tokens.append(")"); + } + Ty::Path(None, ref path) => { + path.to_tokens(tokens); + } + Ty::Path(Some(ref qself), ref path) => { + tokens.append("<"); + qself.ty.to_tokens(tokens); + if qself.position > 0 { + tokens.append("as"); + for (i, segment) in path.segments + .iter() + .take(qself.position) + .enumerate() { + if i > 0 || path.global { + tokens.append("::"); + } + segment.to_tokens(tokens); + } + } + tokens.append(">"); + for segment in path.segments.iter().skip(qself.position) { + tokens.append("::"); + segment.to_tokens(tokens); + } + } + Ty::ObjectSum(ref ty, ref bounds) => { + ty.to_tokens(tokens); + for bound in bounds { + tokens.append("+"); + bound.to_tokens(tokens); + } + } + Ty::PolyTraitRef(ref bounds) => { + tokens.append_separated(bounds, "+"); + } + Ty::ImplTrait(ref bounds) => { + tokens.append("impl"); + tokens.append_separated(bounds, "+"); + } + Ty::Paren(ref inner) => { + tokens.append("("); + inner.to_tokens(tokens); + tokens.append(")"); + } + Ty::Infer => { + tokens.append("_"); + } + Ty::Mac(ref mac) => mac.to_tokens(tokens), + } + } + } + + impl ToTokens for Mutability { + fn to_tokens(&self, tokens: &mut Tokens) { + if let Mutability::Mutable = *self { + tokens.append("mut"); + } + } + } + + impl ToTokens for Path { + fn to_tokens(&self, tokens: &mut Tokens) { + for (i, segment) in self.segments.iter().enumerate() { + if i > 0 || self.global { + tokens.append("::"); + } + segment.to_tokens(tokens); + } + } + } + + impl ToTokens for PathSegment { + fn to_tokens(&self, tokens: &mut Tokens) { + self.ident.to_tokens(tokens); + if self.ident.as_ref().is_empty() && self.parameters.is_empty() { + tokens.append("<"); + tokens.append(">"); + } else { + self.parameters.to_tokens(tokens); + } + } + } + + impl ToTokens for PathParameters { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + PathParameters::AngleBracketed(ref parameters) => { + parameters.to_tokens(tokens); + } + PathParameters::Parenthesized(ref parameters) => { + parameters.to_tokens(tokens); + } + } + } + } + + impl ToTokens for AngleBracketedParameterData { + fn to_tokens(&self, tokens: &mut Tokens) { + let has_lifetimes = !self.lifetimes.is_empty(); + let has_types = !self.types.is_empty(); + let has_bindings = !self.bindings.is_empty(); + if !has_lifetimes && !has_types && !has_bindings { + return; + } + + tokens.append("<"); + + let mut first = true; + for lifetime in &self.lifetimes { + if !first { + tokens.append(","); + } + lifetime.to_tokens(tokens); + first = false; + } + for ty in &self.types { + if !first { + tokens.append(","); + } + ty.to_tokens(tokens); + first = false; + } + for binding in &self.bindings { + if !first { + tokens.append(","); + } + binding.to_tokens(tokens); + first = false; + } + + tokens.append(">"); + } + } + + impl ToTokens for TypeBinding { + fn to_tokens(&self, tokens: &mut Tokens) { + self.ident.to_tokens(tokens); + tokens.append("="); + self.ty.to_tokens(tokens); + } + } + + impl ToTokens for ParenthesizedParameterData { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append("("); + tokens.append_separated(&self.inputs, ","); + tokens.append(")"); + if let Some(ref output) = self.output { + tokens.append("->"); + output.to_tokens(tokens); + } + } + } + + impl ToTokens for PolyTraitRef { + fn to_tokens(&self, tokens: &mut Tokens) { + if !self.bound_lifetimes.is_empty() { + tokens.append("for"); + tokens.append("<"); + tokens.append_separated(&self.bound_lifetimes, ","); + tokens.append(">"); + } + self.trait_ref.to_tokens(tokens); + } + } + + impl ToTokens for BareFnTy { + fn to_tokens(&self, tokens: &mut Tokens) { + if !self.lifetimes.is_empty() { + tokens.append("for"); + tokens.append("<"); + tokens.append_separated(&self.lifetimes, ","); + tokens.append(">"); + } + self.unsafety.to_tokens(tokens); + self.abi.to_tokens(tokens); + tokens.append("fn"); + tokens.append("("); + tokens.append_separated(&self.inputs, ","); + if self.variadic { + if !self.inputs.is_empty() { + tokens.append(","); + } + tokens.append("..."); + } + tokens.append(")"); + if let FunctionRetTy::Ty(ref ty) = self.output { + tokens.append("->"); + ty.to_tokens(tokens); + } + } + } + + impl ToTokens for BareFnArg { + fn to_tokens(&self, tokens: &mut Tokens) { + if let Some(ref name) = self.name { + name.to_tokens(tokens); + tokens.append(":"); + } + self.ty.to_tokens(tokens); + } + } + + impl ToTokens for Unsafety { + fn to_tokens(&self, tokens: &mut Tokens) { + match *self { + Unsafety::Unsafe => tokens.append("unsafe"), + Unsafety::Normal => { + // nothing + } + } + } + } + + impl ToTokens for Abi { + fn to_tokens(&self, tokens: &mut Tokens) { + tokens.append("extern"); + match *self { + Abi::Named(ref named) => named.to_tokens(tokens), + Abi::Rust => {} + } + } + } + + #[cfg(not(feature = "type-macros"))] + impl ToTokens for Mac { + fn to_tokens(&self, _tokens: &mut Tokens) { + unreachable!() + } + } +} diff --git a/third_party/rust/syn/src/visit.rs b/third_party/rust/syn/src/visit.rs new file mode 100644 index 000000000000..c073b60ed5ab --- /dev/null +++ b/third_party/rust/syn/src/visit.rs @@ -0,0 +1,296 @@ +// Adapted from libsyntax. + +//! AST walker. Each overridden visit method has full control over what +//! happens with its node, it can do its own traversal of the node's children, +//! call `visit::walk_*` to apply the default traversal algorithm, or prevent +//! deeper traversal by doing nothing. +//! +//! Note: it is an important invariant that the default visitor walks the body +//! of a function in "execution order" (more concretely, reverse post-order +//! with respect to the CFG implied by the AST), meaning that if AST node A may +//! execute before AST node B, then A is visited first. The borrow checker in +//! particular relies on this property. +//! +//! Note: walking an AST before macro expansion is probably a bad idea. For +//! instance, a walker looking for item names in a module will miss all of +//! those that are created by the expansion of a macro. + +use super::*; + +/// Each method of the Visitor trait is a hook to be potentially +/// overridden. Each method's default implementation recursively visits +/// the substructure of the input via the corresponding `walk` method; +/// e.g. the `visit_mod` method by default calls `visit::walk_mod`. +/// +/// If you want to ensure that your code handles every variant +/// explicitly, you need to override each method. (And you also need +/// to monitor future changes to `Visitor` in case a new method with a +/// new default implementation gets introduced.) +pub trait Visitor: Sized { + fn visit_ident(&mut self, _ident: &Ident) {} + fn visit_macro_input(&mut self, macro_input: &MacroInput) { + walk_macro_input(self, macro_input) + } + fn visit_ty(&mut self, ty: &Ty) { + walk_ty(self, ty) + } + fn visit_generics(&mut self, generics: &Generics) { + walk_generics(self, generics) + } + fn visit_ty_param_bound(&mut self, bound: &TyParamBound) { + walk_ty_param_bound(self, bound) + } + fn visit_poly_trait_ref(&mut self, trait_ref: &PolyTraitRef, modifier: &TraitBoundModifier) { + walk_poly_trait_ref(self, trait_ref, modifier) + } + fn visit_variant_data(&mut self, data: &VariantData, _ident: &Ident, _generics: &Generics) { + walk_variant_data(self, data) + } + fn visit_field(&mut self, field: &Field) { + walk_field(self, field) + } + fn visit_variant(&mut self, variant: &Variant, generics: &Generics) { + walk_variant(self, variant, generics) + } + fn visit_lifetime(&mut self, _lifetime: &Lifetime) {} + fn visit_lifetime_def(&mut self, lifetime: &LifetimeDef) { + walk_lifetime_def(self, lifetime) + } + fn visit_path(&mut self, path: &Path) { + walk_path(self, path) + } + fn visit_path_segment(&mut self, path_segment: &PathSegment) { + walk_path_segment(self, path_segment) + } + fn visit_path_parameters(&mut self, path_parameters: &PathParameters) { + walk_path_parameters(self, path_parameters) + } + fn visit_assoc_type_binding(&mut self, type_binding: &TypeBinding) { + walk_assoc_type_binding(self, type_binding) + } + fn visit_attribute(&mut self, _attr: &Attribute) {} + fn visit_fn_ret_ty(&mut self, ret_ty: &FunctionRetTy) { + walk_fn_ret_ty(self, ret_ty) + } + fn visit_const_expr(&mut self, expr: &ConstExpr) { + walk_const_expr(self, expr) + } + fn visit_lit(&mut self, _lit: &Lit) {} +} + +#[macro_export] +macro_rules! walk_list { + ($visitor: expr, $method: ident, $list: expr) => { + for elem in $list { + $visitor.$method(elem) + } + }; + ($visitor: expr, $method: ident, $list: expr, $($extra_args: expr),*) => { + for elem in $list { + $visitor.$method(elem, $($extra_args,)*) + } + } +} + +pub fn walk_opt_ident(visitor: &mut V, opt_ident: &Option) { + if let Some(ref ident) = *opt_ident { + visitor.visit_ident(ident); + } +} + +pub fn walk_lifetime_def(visitor: &mut V, lifetime_def: &LifetimeDef) { + visitor.visit_lifetime(&lifetime_def.lifetime); + walk_list!(visitor, visit_lifetime, &lifetime_def.bounds); +} + +pub fn walk_poly_trait_ref(visitor: &mut V, trait_ref: &PolyTraitRef, _: &TraitBoundModifier) + where V: Visitor +{ + walk_list!(visitor, visit_lifetime_def, &trait_ref.bound_lifetimes); + visitor.visit_path(&trait_ref.trait_ref); +} + +pub fn walk_macro_input(visitor: &mut V, macro_input: &MacroInput) { + visitor.visit_ident(¯o_input.ident); + visitor.visit_generics(¯o_input.generics); + match macro_input.body { + Body::Enum(ref variants) => { + walk_list!(visitor, visit_variant, variants, ¯o_input.generics); + } + Body::Struct(ref variant_data) => { + visitor.visit_variant_data(variant_data, ¯o_input.ident, ¯o_input.generics); + } + } + walk_list!(visitor, visit_attribute, ¯o_input.attrs); +} + +pub fn walk_variant(visitor: &mut V, variant: &Variant, generics: &Generics) + where V: Visitor +{ + visitor.visit_ident(&variant.ident); + visitor.visit_variant_data(&variant.data, &variant.ident, generics); + walk_list!(visitor, visit_attribute, &variant.attrs); +} + +pub fn walk_ty(visitor: &mut V, ty: &Ty) { + match *ty { + Ty::Slice(ref inner) | + Ty::Paren(ref inner) => visitor.visit_ty(inner), + Ty::Ptr(ref mutable_type) => visitor.visit_ty(&mutable_type.ty), + Ty::Rptr(ref opt_lifetime, ref mutable_type) => { + walk_list!(visitor, visit_lifetime, opt_lifetime); + visitor.visit_ty(&mutable_type.ty) + } + Ty::Never | Ty::Infer => {} + Ty::Tup(ref tuple_element_types) => { + walk_list!(visitor, visit_ty, tuple_element_types); + } + Ty::BareFn(ref bare_fn) => { + walk_list!(visitor, visit_lifetime_def, &bare_fn.lifetimes); + for argument in &bare_fn.inputs { + walk_opt_ident(visitor, &argument.name); + visitor.visit_ty(&argument.ty) + } + visitor.visit_fn_ret_ty(&bare_fn.output) + } + Ty::Path(ref maybe_qself, ref path) => { + if let Some(ref qself) = *maybe_qself { + visitor.visit_ty(&qself.ty); + } + visitor.visit_path(path); + } + Ty::ObjectSum(ref inner, ref bounds) => { + visitor.visit_ty(inner); + walk_list!(visitor, visit_ty_param_bound, bounds); + } + Ty::Array(ref inner, ref len) => { + visitor.visit_ty(inner); + visitor.visit_const_expr(len); + } + Ty::PolyTraitRef(ref bounds) | + Ty::ImplTrait(ref bounds) => { + walk_list!(visitor, visit_ty_param_bound, bounds); + } + Ty::Mac(_) => {} + } +} + +pub fn walk_path(visitor: &mut V, path: &Path) { + for segment in &path.segments { + visitor.visit_path_segment(segment); + } +} + +pub fn walk_path_segment(visitor: &mut V, segment: &PathSegment) { + visitor.visit_ident(&segment.ident); + visitor.visit_path_parameters(&segment.parameters); +} + +pub fn walk_path_parameters(visitor: &mut V, path_parameters: &PathParameters) + where V: Visitor +{ + match *path_parameters { + PathParameters::AngleBracketed(ref data) => { + walk_list!(visitor, visit_ty, &data.types); + walk_list!(visitor, visit_lifetime, &data.lifetimes); + walk_list!(visitor, visit_assoc_type_binding, &data.bindings); + } + PathParameters::Parenthesized(ref data) => { + walk_list!(visitor, visit_ty, &data.inputs); + walk_list!(visitor, visit_ty, &data.output); + } + } +} + +pub fn walk_assoc_type_binding(visitor: &mut V, type_binding: &TypeBinding) { + visitor.visit_ident(&type_binding.ident); + visitor.visit_ty(&type_binding.ty); +} + +pub fn walk_ty_param_bound(visitor: &mut V, bound: &TyParamBound) { + match *bound { + TyParamBound::Trait(ref ty, ref modifier) => { + visitor.visit_poly_trait_ref(ty, modifier); + } + TyParamBound::Region(ref lifetime) => { + visitor.visit_lifetime(lifetime); + } + } +} + +pub fn walk_generics(visitor: &mut V, generics: &Generics) { + for param in &generics.ty_params { + visitor.visit_ident(¶m.ident); + walk_list!(visitor, visit_ty_param_bound, ¶m.bounds); + walk_list!(visitor, visit_ty, ¶m.default); + } + walk_list!(visitor, visit_lifetime_def, &generics.lifetimes); + for predicate in &generics.where_clause.predicates { + match *predicate { + WherePredicate::BoundPredicate(WhereBoundPredicate { ref bounded_ty, + ref bounds, + ref bound_lifetimes, + .. }) => { + visitor.visit_ty(bounded_ty); + walk_list!(visitor, visit_ty_param_bound, bounds); + walk_list!(visitor, visit_lifetime_def, bound_lifetimes); + } + WherePredicate::RegionPredicate(WhereRegionPredicate { ref lifetime, + ref bounds, + .. }) => { + visitor.visit_lifetime(lifetime); + walk_list!(visitor, visit_lifetime, bounds); + } + } + } +} + +pub fn walk_fn_ret_ty(visitor: &mut V, ret_ty: &FunctionRetTy) { + if let FunctionRetTy::Ty(ref output_ty) = *ret_ty { + visitor.visit_ty(output_ty) + } +} + +pub fn walk_variant_data(visitor: &mut V, data: &VariantData) { + walk_list!(visitor, visit_field, data.fields()); +} + +pub fn walk_field(visitor: &mut V, field: &Field) { + walk_opt_ident(visitor, &field.ident); + visitor.visit_ty(&field.ty); + walk_list!(visitor, visit_attribute, &field.attrs); +} + +pub fn walk_const_expr(visitor: &mut V, len: &ConstExpr) { + match *len { + ConstExpr::Call(ref function, ref args) => { + visitor.visit_const_expr(function); + walk_list!(visitor, visit_const_expr, args); + } + ConstExpr::Binary(_op, ref left, ref right) => { + visitor.visit_const_expr(left); + visitor.visit_const_expr(right); + } + ConstExpr::Unary(_op, ref v) => { + visitor.visit_const_expr(v); + } + ConstExpr::Lit(ref lit) => { + visitor.visit_lit(lit); + } + ConstExpr::Cast(ref expr, ref ty) => { + visitor.visit_const_expr(expr); + visitor.visit_ty(ty); + } + ConstExpr::Path(ref path) => { + visitor.visit_path(path); + } + ConstExpr::Index(ref expr, ref index) => { + visitor.visit_const_expr(expr); + visitor.visit_const_expr(index); + } + ConstExpr::Paren(ref expr) => { + visitor.visit_const_expr(expr); + } + ConstExpr::Other(_) => {} + } +} diff --git a/third_party/rust/syntex/.cargo-checksum.json b/third_party/rust/syntex/.cargo-checksum.json new file mode 100644 index 000000000000..013e66d8430b --- /dev/null +++ b/third_party/rust/syntex/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"cfa0e51c2177698edca724439fda05af5bbf0013d26b805d22c5b26f8b61348a","src/error.rs":"c99d5582e76ca9f9b06989517e866d0078834b3db3d4e51b3b193cae06b55526","src/lib.rs":"1679bbd38be948783e508648cf075fe27174ed2e717efa80609befcf6d772f55","src/registry.rs":"6d8a40c82f274a2d4fb413ef1f29b2c540c436051933e5b81cb488c34623d4b9","src/resolver.rs":"c01be55f360ee1d55f5ff001f05623a318175a7b8cf2c21a2eab9610c2f5f61e","src/stack.rs":"130dc7ff3851288a0e8e701f69af99f8f52f203a1419976d09ebc0075abe97e7"},"package":"bb3f52553a966675982404dc34028291b347e0c9a9c0b0b34f2da6be8a0443f8"} \ No newline at end of file diff --git a/third_party/rust/syntex/.cargo-ok b/third_party/rust/syntex/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/syntex/Cargo.toml b/third_party/rust/syntex/Cargo.toml new file mode 100644 index 000000000000..15a92196a1fe --- /dev/null +++ b/third_party/rust/syntex/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "syntex" +version = "0.54.0" +authors = [ "erick.tryzelaar@gmail.com" ] +license = "MIT/Apache-2.0" +description = "A library that enables compile time syntax extension expansion" +repository = "https://github.com/erickt/rust-syntex" +readme = "../README.md" +include = ["Cargo.toml", "src/**/*.rs"] + +[dependencies] +syntex_errors = { version = "^0.54.0", path = "../syntex_errors" } +syntex_syntax = { version = "^0.54.0", path = "../syntex_syntax" } diff --git a/third_party/rust/syntex/src/error.rs b/third_party/rust/syntex/src/error.rs new file mode 100644 index 000000000000..9d9292fe247d --- /dev/null +++ b/third_party/rust/syntex/src/error.rs @@ -0,0 +1,46 @@ +use std::error; +use std::fmt; +use std::io; + +use errors::DiagnosticBuilder; + +#[derive(Debug)] +pub enum Error { + Parse, + Expand, + Io(io::Error), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::Parse | Error::Expand => { + write!(f, "{}", error::Error::description(self)) + } + Error::Io(ref err) => err.fmt(f), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::Parse => "failed to parse input", + Error::Expand => "failed to expand input", + Error::Io(ref err) => err.description(), + } + } +} + +impl From for Error { + fn from(err: io::Error) -> Self { + Error::Io(err) + } +} + +impl<'a> From> for Error { + fn from(mut diagnostic: DiagnosticBuilder<'a>) -> Self { + diagnostic.emit(); + Error::Parse + } +} diff --git a/third_party/rust/syntex/src/lib.rs b/third_party/rust/syntex/src/lib.rs new file mode 100644 index 000000000000..18f4ff659891 --- /dev/null +++ b/third_party/rust/syntex/src/lib.rs @@ -0,0 +1,11 @@ +extern crate syntex_syntax; +extern crate syntex_errors as errors; + +mod error; +mod registry; +mod resolver; +mod stack; + +pub use error::Error; +pub use registry::{Registry, Pass}; +pub use stack::with_extra_stack; diff --git a/third_party/rust/syntex/src/registry.rs b/third_party/rust/syntex/src/registry.rs new file mode 100644 index 000000000000..a33f19cb8aa4 --- /dev/null +++ b/third_party/rust/syntex/src/registry.rs @@ -0,0 +1,234 @@ +use std::fs::File; +use std::io::Write; +use std::path::Path; +use std::rc::Rc; + +use syntex_syntax::ast; +use syntex_syntax::attr; +use syntex_syntax::codemap::DUMMY_SP; +use syntex_syntax::ext::base::{ + ExtCtxt, + IdentMacroExpander, + MultiItemDecorator, + MultiItemModifier, + NamedSyntaxExtension, + Resolver, + SyntaxExtension, + TTMacroExpander, +}; +use syntex_syntax::ext::expand; +use syntex_syntax::feature_gate; +use syntex_syntax::parse; +use syntex_syntax::print::pprust; +use syntex_syntax::symbol::Symbol; + +use super::resolver; +use super::error::Error; + +pub type Pass = fn(ast::Crate) -> ast::Crate; + +pub struct Registry { + syntax_exts: Vec, + pre_expansion_passes: Vec>, + post_expansion_passes: Vec>, + cfg: Vec, + attrs: Vec, +} + +impl Registry { + pub fn new() -> Registry { + Registry { + syntax_exts: Vec::new(), + pre_expansion_passes: Vec::new(), + post_expansion_passes: Vec::new(), + cfg: Vec::new(), + attrs: Vec::new(), + } + } + + pub fn add_cfg(&mut self, cfg: &str) { + let parse_sess = parse::ParseSess::new(); + let meta_item = parse::parse_meta_from_source_str( + "cfgspec".to_string(), + cfg.to_string(), + &parse_sess).unwrap(); + + self.cfg.push(meta_item); + } + + pub fn add_attr(&mut self, attr: &str) { + let parse_sess = parse::ParseSess::new(); + let meta_item = parse::parse_meta_from_source_str( + "attrspec".to_string(), + attr.to_string(), + &parse_sess).unwrap(); + + self.attrs.push(ast::Attribute { + id: attr::mk_attr_id(), + style: ast::AttrStyle::Outer, + value: meta_item, + is_sugared_doc: false, + span: DUMMY_SP, + }); + } + + pub fn add_macro(&mut self, name: &str, extension: F) + where F: TTMacroExpander + 'static + { + let name = Symbol::intern(name); + let syntax_extension = SyntaxExtension::NormalTT( + Box::new(extension), + None, + false + ); + self.syntax_exts.push((name, syntax_extension)); + } + + pub fn add_ident_macro(&mut self, name: &str, extension: F) + where F: IdentMacroExpander + 'static + { + let name = Symbol::intern(name); + let syntax_extension = SyntaxExtension::IdentTT( + Box::new(extension), + None, + false + ); + self.syntax_exts.push((name, syntax_extension)); + } + + pub fn add_decorator(&mut self, name: &str, extension: F) + where F: MultiItemDecorator + 'static + { + let name = Symbol::intern(name); + let syntax_extension = SyntaxExtension::MultiDecorator(Box::new(extension)); + self.syntax_exts.push((name, syntax_extension)); + } + + pub fn add_modifier(&mut self, name: &str, extension: F) + where F: MultiItemModifier + 'static + { + let name = Symbol::intern(name); + let syntax_extension = SyntaxExtension::MultiModifier(Box::new(extension)); + self.syntax_exts.push((name, syntax_extension)); + } + + pub fn add_pre_expansion_pass(&mut self, pass: Pass) { + self.pre_expansion_passes.push(Box::new(pass)) + } + + pub fn add_post_expansion_pass(&mut self, pass: Pass) { + self.post_expansion_passes.push(Box::new(pass)) + } + + pub fn expand(self, crate_name: &str, src: S, dst: D) -> Result<(), Error> + where S: AsRef, + D: AsRef, + { + let src = src.as_ref(); + let dst = dst.as_ref(); + + let sess = parse::ParseSess::new(); + + let krate = try!(parse::parse_crate_from_file( + src, + &sess)); + + if sess.span_diagnostic.has_errors() { + return Err(Error::Parse); + } + + let src_name = src.to_str().unwrap().to_string(); + + let out = try!(self.expand_crate( + crate_name, + &sess, + src_name, + krate)); + + if sess.span_diagnostic.has_errors() { + return Err(Error::Expand); + } + + let mut dst = try!(File::create(dst)); + try!(dst.write_all(&out)); + Ok(()) + } + + /// This method will expand all macros in the source string `src`, and return the results in a + /// string. + pub fn expand_str(self, + crate_name: &str, + src_name: &str, + src: &str) -> Result { + let sess = parse::ParseSess::new(); + + let src_name = src_name.to_owned(); + + let krate = try!(parse::parse_crate_from_source_str( + src_name.clone(), + src.to_owned(), + &sess)); + + let out = try!(self.expand_crate(crate_name, &sess, src_name, krate)); + + Ok(String::from_utf8(out).unwrap()) + } + + fn expand_crate(self, + crate_name: &str, + sess: &parse::ParseSess, + src_name: String, + mut krate: ast::Crate) -> Result, Error> { + krate.attrs.extend(self.attrs.iter().cloned()); + + let features = feature_gate::get_features( + &sess.span_diagnostic, + &krate.attrs); + + let krate = self.pre_expansion_passes.iter() + .fold(krate, |krate, f| (f)(krate)); + + let mut ecfg = expand::ExpansionConfig::default(crate_name.to_owned()); + ecfg.features = Some(&features); + ecfg.keep_macs = true; + + let mut resolver = resolver::Resolver::new(sess); + + for (name, ext) in self.syntax_exts { + let ident = ast::Ident::with_empty_ctxt(name); + resolver.add_ext(ident, Rc::new(ext)); + } + + let mut ecx = ExtCtxt::new(&sess, ecfg, &mut resolver); + let krate = ecx.monotonic_expander().expand_crate(krate); + + let krate = self.post_expansion_passes.iter() + .fold(krate, |krate, f| (f)(krate)); + + let src = sess.codemap() + .get_filemap(&src_name) + .unwrap() + .src + .as_ref() + .unwrap() + .as_bytes() + .to_vec(); + + let mut rdr = &src[..]; + + let mut out = Vec::new(); + let annotation = pprust::NoAnn; + + try!(pprust::print_crate( + sess.codemap(), + &sess.span_diagnostic, + &krate, + src_name, + &mut rdr, + Box::new(&mut out), + &annotation, + false)); + + Ok(out) + } +} diff --git a/third_party/rust/syntex/src/resolver.rs b/third_party/rust/syntex/src/resolver.rs new file mode 100644 index 000000000000..e246a3bc0bd0 --- /dev/null +++ b/third_party/rust/syntex/src/resolver.rs @@ -0,0 +1,92 @@ +use std::collections::HashMap; +use std::rc::Rc; + +use syntex_syntax::ast::{self, Attribute, Name}; +use syntex_syntax::ext::base::{ + self, + Determinacy, + MultiDecorator, + MultiModifier, + SyntaxExtension, +}; +use syntex_syntax::ext::expand::Expansion; +use syntex_syntax::ext::hygiene::Mark; +use syntex_syntax::parse::ParseSess; +use syntex_syntax::ptr::P; + +pub struct Resolver<'a> { + session: &'a ParseSess, + extensions: HashMap>, +} + +impl<'a> Resolver<'a> { + pub fn new(session: &'a ParseSess) -> Self { + Resolver { + session: session, + extensions: HashMap::new(), + } + } +} + +impl<'a> base::Resolver for Resolver<'a> { + fn next_node_id(&mut self) -> ast::NodeId { + ast::DUMMY_NODE_ID + } + fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() } + fn eliminate_crate_var(&mut self, item: P) -> P { item } + fn is_whitelisted_legacy_custom_derive(&self, _name: Name) -> bool { false } + + fn visit_expansion(&mut self, _invoc: Mark, _expansion: &Expansion) {} + fn add_ext(&mut self, ident: ast::Ident, ext: Rc) { + self.extensions.insert(ident.name, ext); + } + fn add_expansions_at_stmt(&mut self, _id: ast::NodeId, _macros: Vec) {} + + fn resolve_imports(&mut self) {} + fn find_attr_invoc(&mut self, attrs: &mut Vec) -> Option { + for i in 0..attrs.len() { + if let Some(ext) = self.extensions.get(&attrs[i].value.name) { + match **ext { + MultiModifier(..) | MultiDecorator(..) => return Some(attrs.remove(i)), + _ => {} + } + } + } + None + } + fn find_extension(&mut self, _scope: Mark, name: ast::Name) -> Option> { + self.extensions.get(&name).map(|ext| ext.clone()) + } + fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, force: bool) + -> Result, Determinacy> { + let ast::Path { ref segments, span } = *path; + if segments.iter().any(|segment| segment.parameters.is_some()) { + let kind = + if segments.last().unwrap().parameters.is_some() { "macro" } else { "module" }; + let msg = format!("type parameters are not allowed on {}s", kind); + self.session.span_diagnostic.span_err(path.span, &msg); + return Err(Determinacy::Determined); + } + + let path: Vec<_> = segments.iter().map(|seg| seg.identifier).collect(); + + if path.len() > 1 { + // FIXME(syntex): Pass macros with module separators through to the generated source. + self.session.span_diagnostic.span_err(span, "expected macro name without module separators"); + return Err(Determinacy::Determined); + } + + let name = path[0].name; + + self.find_extension(scope, name).ok_or_else(|| { + if force { + let mut err = + self.session.span_diagnostic.struct_span_err(span, &format!("macro undefined: '{}!'", name)); + err.emit(); + Determinacy::Determined + } else { + Determinacy::Undetermined + } + }) + } +} diff --git a/third_party/rust/syntex/src/stack.rs b/third_party/rust/syntex/src/stack.rs new file mode 100644 index 000000000000..2d96a6aec333 --- /dev/null +++ b/third_party/rust/syntex/src/stack.rs @@ -0,0 +1,63 @@ +use std::env; +use std::ffi::OsStr; +use std::ops::Drop; +use std::thread; + +const STACK_ENV_VAR: &'static str = "RUST_MIN_STACK"; +const EXTRA_STACK: &'static str = "16777216"; // 16 MB + +/// Runs a function in a thread with extra stack space (16 MB or +/// `$RUST_MIN_STACK` if set). +/// +/// The Rust parser uses a lot of stack space so codegen sometimes requires more +/// than is available by default. +/// +/// ```rust,ignore +/// syntex::with_extra_stack(move || { +/// let mut reg = syntex::Registry::new(); +/// reg.add_decorator(/* ... */); +/// reg.expand("", src, dst) +/// }) +/// ``` +/// +/// This function runs with a 16 MB stack by default but a different value can +/// be set by the RUST_MIN_STACK environment variable. +pub fn with_extra_stack(f: F) -> T + where F: Send + 'static + FnOnce() -> T, + T: Send + 'static +{ + let _tmp_env = set_if_unset(STACK_ENV_VAR, EXTRA_STACK); + + thread::spawn(f).join().unwrap() +} + +fn set_if_unset(k: K, v: V) -> TmpEnv + where K: AsRef, + V: AsRef, +{ + match env::var(&k) { + Ok(_) => TmpEnv::WasAlreadySet, + Err(_) => { + env::set_var(&k, v); + TmpEnv::WasNotSet(k) + } + } +} + +#[must_use] +enum TmpEnv + where K: AsRef, +{ + WasAlreadySet, + WasNotSet(K), +} + +impl Drop for TmpEnv + where K: AsRef, +{ + fn drop(&mut self) { + if let TmpEnv::WasNotSet(ref k) = *self { + env::remove_var(k); + } + } +} diff --git a/third_party/rust/syntex_errors/.cargo-checksum.json b/third_party/rust/syntex_errors/.cargo-checksum.json new file mode 100644 index 000000000000..ec90a6606be5 --- /dev/null +++ b/third_party/rust/syntex_errors/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"3442bb8acc6f060590055401c2ed655933cf3006df7a7a7c4ce04bd4034ca4cf","src/diagnostic.rs":"c469bbeb9bc0bff1dc7da90f12fbf686de53b7920e8a8ec509171d7ee7939f9e","src/diagnostic_builder.rs":"535a903c0961e85d8ad9eb88a08e3095fbc251c6f032f84cb48a1f1d36c1b716","src/emitter.rs":"393b6dec613e03a9e248c0245248a17f3836750d6ef4591334fd4474b94416eb","src/lib.rs":"33d43a964af5efd3ec43bd44a8fe07db70db349f7247baf966cf7e46c95695e5","src/lock.rs":"77e185b48b20509596d9778d7dcca02b92e09be061ed57a9ef37ccfb9fa781ae","src/registry.rs":"ab229b7c6d3016917638d15e754df421be8f4b88b95518773c5c33a07a005274","src/snippet.rs":"436f7a9d20d39de14ae84c3d368d23a59c3436b63b6298578728a16b20143190","src/styled_buffer.rs":"a00d37a0c57b0c16cafa28dff936c1689e0d64a0002570b731f9f34a8ecdc61c"},"package":"dee2f6e49c075f71332bb775219d5982bee6732d26227fa1ae1b53cdb12f5cc5"} \ No newline at end of file diff --git a/third_party/rust/syntex_errors/.cargo-ok b/third_party/rust/syntex_errors/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/syntex_errors/Cargo.toml b/third_party/rust/syntex_errors/Cargo.toml new file mode 100644 index 000000000000..76eb75bdad03 --- /dev/null +++ b/third_party/rust/syntex_errors/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "syntex_errors" +version = "0.54.0" +authors = [ "erick.tryzelaar@gmail.com" ] +license = "MIT/Apache-2.0" +description = "Export of librustc_errors for code generation" +repository = "https://github.com/serde-rs/syntex" +include = ["Cargo.toml", "src/**/*.rs"] + +[dependencies] +libc = "^0.2.13" +log = "^0.3.3" +rustc-serialize = "^0.3.16" +syntex_pos = { version = "^0.54.0", path = "../syntex_pos" } +term = "^0.4.4" +unicode-xid = "^0.0.4" diff --git a/third_party/rust/syntex_errors/src/diagnostic.rs b/third_party/rust/syntex_errors/src/diagnostic.rs new file mode 100644 index 000000000000..730ca8f9e2e4 --- /dev/null +++ b/third_party/rust/syntex_errors/src/diagnostic.rs @@ -0,0 +1,202 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use CodeSuggestion; +use Level; +use RenderSpan; +use RenderSpan::Suggestion; +use std::fmt; +use syntax_pos::{MultiSpan, Span}; + +#[must_use] +#[derive(Clone, Debug, PartialEq)] +pub struct Diagnostic { + pub level: Level, + pub message: String, + pub code: Option, + pub span: MultiSpan, + pub children: Vec, +} + +/// For example a note attached to an error. +#[derive(Clone, Debug, PartialEq)] +pub struct SubDiagnostic { + pub level: Level, + pub message: String, + pub span: MultiSpan, + pub render_span: Option, +} + +impl Diagnostic { + pub fn new(level: Level, message: &str) -> Self { + Diagnostic::new_with_code(level, None, message) + } + + pub fn new_with_code(level: Level, code: Option, message: &str) -> Self { + Diagnostic { + level: level, + message: message.to_owned(), + code: code, + span: MultiSpan::new(), + children: vec![], + } + } + + /// Cancel the diagnostic (a structured diagnostic must either be emitted or + /// cancelled or it will panic when dropped). + /// BEWARE: if this DiagnosticBuilder is an error, then creating it will + /// bump the error count on the Handler and cancelling it won't undo that. + /// If you want to decrement the error count you should use `Handler::cancel`. + pub fn cancel(&mut self) { + self.level = Level::Cancelled; + } + + pub fn cancelled(&self) -> bool { + self.level == Level::Cancelled + } + + pub fn is_fatal(&self) -> bool { + self.level == Level::Fatal + } + + /// Add a span/label to be included in the resulting snippet. + /// This is pushed onto the `MultiSpan` that was created when the + /// diagnostic was first built. If you don't call this function at + /// all, and you just supplied a `Span` to create the diagnostic, + /// then the snippet will just include that `Span`, which is + /// called the primary span. + pub fn span_label(&mut self, span: Span, label: &fmt::Display) + -> &mut Self { + self.span.push_span_label(span, format!("{}", label)); + self + } + + pub fn note_expected_found(&mut self, + label: &fmt::Display, + expected: &fmt::Display, + found: &fmt::Display) + -> &mut Self + { + self.note_expected_found_extra(label, expected, found, &"", &"") + } + + pub fn note_expected_found_extra(&mut self, + label: &fmt::Display, + expected: &fmt::Display, + found: &fmt::Display, + expected_extra: &fmt::Display, + found_extra: &fmt::Display) + -> &mut Self + { + // For now, just attach these as notes + self.note(&format!("expected {} `{}`{}", label, expected, expected_extra)); + self.note(&format!(" found {} `{}`{}", label, found, found_extra)); + self + } + + pub fn note(&mut self, msg: &str) -> &mut Self { + self.sub(Level::Note, msg, MultiSpan::new(), None); + self + } + + pub fn span_note>(&mut self, + sp: S, + msg: &str) + -> &mut Self { + self.sub(Level::Note, msg, sp.into(), None); + self + } + + pub fn warn(&mut self, msg: &str) -> &mut Self { + self.sub(Level::Warning, msg, MultiSpan::new(), None); + self + } + + pub fn span_warn>(&mut self, + sp: S, + msg: &str) + -> &mut Self { + self.sub(Level::Warning, msg, sp.into(), None); + self + } + + pub fn help(&mut self , msg: &str) -> &mut Self { + self.sub(Level::Help, msg, MultiSpan::new(), None); + self + } + + pub fn span_help>(&mut self, + sp: S, + msg: &str) + -> &mut Self { + self.sub(Level::Help, msg, sp.into(), None); + self + } + + /// Prints out a message with a suggested edit of the code. + /// + /// See `diagnostic::RenderSpan::Suggestion` for more information. + pub fn span_suggestion>(&mut self, + sp: S, + msg: &str, + suggestion: String) + -> &mut Self { + self.sub(Level::Help, + msg, + MultiSpan::new(), + Some(Suggestion(CodeSuggestion { + msp: sp.into(), + substitutes: vec![suggestion], + }))); + self + } + + pub fn set_span>(&mut self, sp: S) -> &mut Self { + self.span = sp.into(); + self + } + + pub fn code(&mut self, s: String) -> &mut Self { + self.code = Some(s); + self + } + + pub fn message(&self) -> &str { + &self.message + } + + pub fn level(&self) -> Level { + self.level + } + + /// Used by a lint. Copies over all details *but* the "main + /// message". + pub fn copy_details_not_message(&mut self, from: &Diagnostic) { + self.span = from.span.clone(); + self.code = from.code.clone(); + self.children.extend(from.children.iter().cloned()) + } + + /// Convenience function for internal use, clients should use one of the + /// public methods above. + fn sub(&mut self, + level: Level, + message: &str, + span: MultiSpan, + render_span: Option) { + let sub = SubDiagnostic { + level: level, + message: message.to_owned(), + span: span, + render_span: render_span, + }; + self.children.push(sub); + } +} diff --git a/third_party/rust/syntex_errors/src/diagnostic_builder.rs b/third_party/rust/syntex_errors/src/diagnostic_builder.rs new file mode 100644 index 000000000000..7dfea6b8951b --- /dev/null +++ b/third_party/rust/syntex_errors/src/diagnostic_builder.rs @@ -0,0 +1,196 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use Diagnostic; +use Level; +use Handler; +use std::fmt::{self, Debug}; +use std::ops::{Deref, DerefMut}; +use std::thread::panicking; +use syntax_pos::{MultiSpan, Span}; + +/// Used for emitting structured error messages and other diagnostic information. +#[must_use] +#[derive(Clone)] +pub struct DiagnosticBuilder<'a> { + handler: &'a Handler, + diagnostic: Diagnostic, +} + +/// In general, the `DiagnosticBuilder` uses deref to allow access to +/// the fields and methods of the embedded `diagnostic` in a +/// transparent way. *However,* many of the methods are intended to +/// be used in a chained way, and hence ought to return `self`. In +/// that case, we can't just naively forward to the method on the +/// `diagnostic`, because the return type would be a `&Diagnostic` +/// instead of a `&DiagnosticBuilder<'a>`. This `forward!` macro makes +/// it easy to declare such methods on the builder. +macro_rules! forward { + // Forward pattern for &self -> &Self + (pub fn $n:ident(&self, $($name:ident: $ty:ty),*) -> &Self) => { + pub fn $n(&self, $($name: $ty),*) -> &Self { + self.diagnostic.$n($($name),*); + self + } + }; + + // Forward pattern for &mut self -> &mut Self + (pub fn $n:ident(&mut self, $($name:ident: $ty:ty),*) -> &mut Self) => { + pub fn $n(&mut self, $($name: $ty),*) -> &mut Self { + self.diagnostic.$n($($name),*); + self + } + }; + + // Forward pattern for &mut self -> &mut Self, with S: Into + // type parameter. No obvious way to make this more generic. + (pub fn $n:ident>(&mut self, $($name:ident: $ty:ty),*) -> &mut Self) => { + pub fn $n>(&mut self, $($name: $ty),*) -> &mut Self { + self.diagnostic.$n($($name),*); + self + } + }; +} + +impl<'a> Deref for DiagnosticBuilder<'a> { + type Target = Diagnostic; + + fn deref(&self) -> &Diagnostic { + &self.diagnostic + } +} + +impl<'a> DerefMut for DiagnosticBuilder<'a> { + fn deref_mut(&mut self) -> &mut Diagnostic { + &mut self.diagnostic + } +} + +impl<'a> DiagnosticBuilder<'a> { + /// Emit the diagnostic. + pub fn emit(&mut self) { + if self.cancelled() { + return; + } + + match self.level { + Level::Bug | + Level::Fatal | + Level::PhaseFatal | + Level::Error => { + self.handler.bump_err_count(); + } + + Level::Warning | + Level::Note | + Level::Help | + Level::Cancelled => { + } + } + + self.handler.emitter.borrow_mut().emit(&self); + self.cancel(); + self.handler.panic_if_treat_err_as_bug(); + + // if self.is_fatal() { + // panic!(FatalError); + // } + } + + /// Add a span/label to be included in the resulting snippet. + /// This is pushed onto the `MultiSpan` that was created when the + /// diagnostic was first built. If you don't call this function at + /// all, and you just supplied a `Span` to create the diagnostic, + /// then the snippet will just include that `Span`, which is + /// called the primary span. + forward!(pub fn span_label(&mut self, span: Span, label: &fmt::Display) + -> &mut Self); + + forward!(pub fn note_expected_found(&mut self, + label: &fmt::Display, + expected: &fmt::Display, + found: &fmt::Display) + -> &mut Self); + + forward!(pub fn note_expected_found_extra(&mut self, + label: &fmt::Display, + expected: &fmt::Display, + found: &fmt::Display, + expected_extra: &fmt::Display, + found_extra: &fmt::Display) + -> &mut Self); + + forward!(pub fn note(&mut self, msg: &str) -> &mut Self); + forward!(pub fn span_note>(&mut self, + sp: S, + msg: &str) + -> &mut Self); + forward!(pub fn warn(&mut self, msg: &str) -> &mut Self); + forward!(pub fn span_warn>(&mut self, sp: S, msg: &str) -> &mut Self); + forward!(pub fn help(&mut self , msg: &str) -> &mut Self); + forward!(pub fn span_help>(&mut self, + sp: S, + msg: &str) + -> &mut Self); + forward!(pub fn span_suggestion>(&mut self, + sp: S, + msg: &str, + suggestion: String) + -> &mut Self); + forward!(pub fn set_span>(&mut self, sp: S) -> &mut Self); + forward!(pub fn code(&mut self, s: String) -> &mut Self); + + /// Convenience function for internal use, clients should use one of the + /// struct_* methods on Handler. + pub fn new(handler: &'a Handler, level: Level, message: &str) -> DiagnosticBuilder<'a> { + DiagnosticBuilder::new_with_code(handler, level, None, message) + } + + /// Convenience function for internal use, clients should use one of the + /// struct_* methods on Handler. + pub fn new_with_code(handler: &'a Handler, + level: Level, + code: Option, + message: &str) + -> DiagnosticBuilder<'a> { + DiagnosticBuilder { + handler: handler, + diagnostic: Diagnostic::new_with_code(level, code, message) + } + } + + pub fn into_diagnostic(mut self) -> Diagnostic { + // annoyingly, the Drop impl means we can't actually move + let result = self.diagnostic.clone(); + self.cancel(); + result + } +} + +impl<'a> Debug for DiagnosticBuilder<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.diagnostic.fmt(f) + } +} + +/// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or +/// we emit a bug. +impl<'a> Drop for DiagnosticBuilder<'a> { + fn drop(&mut self) { + if !panicking() && !self.cancelled() { + let mut db = DiagnosticBuilder::new(self.handler, + Level::Bug, + "Error constructed but not emitted"); + db.emit(); + panic!(); + } + } +} + diff --git a/third_party/rust/syntex_errors/src/emitter.rs b/third_party/rust/syntex_errors/src/emitter.rs new file mode 100644 index 000000000000..b9996010025b --- /dev/null +++ b/third_party/rust/syntex_errors/src/emitter.rs @@ -0,0 +1,1219 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use self::Destination::*; + +use syntax_pos::{COMMAND_LINE_SP, DUMMY_SP, FileMap, Span, MultiSpan, CharPos}; + +use {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, CodeMapper}; +use RenderSpan::*; +use snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, StyledString, Style}; +use styled_buffer::StyledBuffer; + +use std::io::prelude::*; +use std::io; +use std::ops; +use std::rc::Rc; +use term; + +/// Emitter trait for emitting errors. +pub trait Emitter { + /// Emit a structured diagnostic. + fn emit(&mut self, db: &DiagnosticBuilder); +} + +impl Emitter for EmitterWriter { + fn emit(&mut self, db: &DiagnosticBuilder) { + let mut primary_span = db.span.clone(); + let mut children = db.children.clone(); + self.fix_multispans_in_std_macros(&mut primary_span, &mut children); + self.emit_messages_default(&db.level, &db.message, &db.code, &primary_span, &children); + } +} + +/// maximum number of lines we will print for each error; arbitrary. +pub const MAX_HIGHLIGHT_LINES: usize = 6; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ColorConfig { + Auto, + Always, + Never, +} + +impl ColorConfig { + fn use_color(&self) -> bool { + match *self { + ColorConfig::Always => true, + ColorConfig::Never => false, + ColorConfig::Auto => stderr_isatty(), + } + } +} + +pub struct EmitterWriter { + dst: Destination, + cm: Option>, +} + +struct FileWithAnnotatedLines { + file: Rc, + lines: Vec, + multiline_depth: usize, +} + + +/// Do not use this for messages that end in `\n` – use `println_maybe_styled` instead. See +/// `EmitterWriter::print_maybe_styled` for details. +macro_rules! print_maybe_styled { + ($dst: expr, $style: expr, $($arg: tt)*) => { + $dst.print_maybe_styled(format_args!($($arg)*), $style, false) + } +} + +macro_rules! println_maybe_styled { + ($dst: expr, $style: expr, $($arg: tt)*) => { + $dst.print_maybe_styled(format_args!($($arg)*), $style, true) + } +} + +impl EmitterWriter { + pub fn stderr(color_config: ColorConfig, code_map: Option>) -> EmitterWriter { + if color_config.use_color() { + let dst = Destination::from_stderr(); + EmitterWriter { + dst: dst, + cm: code_map, + } + } else { + EmitterWriter { + dst: Raw(Box::new(io::stderr())), + cm: code_map, + } + } + } + + pub fn new(dst: Box, code_map: Option>) -> EmitterWriter { + EmitterWriter { + dst: Raw(dst), + cm: code_map, + } + } + + fn preprocess_annotations(&self, msp: &MultiSpan) -> Vec { + fn add_annotation_to_file(file_vec: &mut Vec, + file: Rc, + line_index: usize, + ann: Annotation) { + + for slot in file_vec.iter_mut() { + // Look through each of our files for the one we're adding to + if slot.file.name == file.name { + // See if we already have a line for it + for line_slot in &mut slot.lines { + if line_slot.line_index == line_index { + line_slot.annotations.push(ann); + return; + } + } + // We don't have a line yet, create one + slot.lines.push(Line { + line_index: line_index, + annotations: vec![ann], + }); + slot.lines.sort(); + return; + } + } + // This is the first time we're seeing the file + file_vec.push(FileWithAnnotatedLines { + file: file, + lines: vec![Line { + line_index: line_index, + annotations: vec![ann], + }], + multiline_depth: 0, + }); + } + + let mut output = vec![]; + let mut multiline_annotations = vec![]; + + if let Some(ref cm) = self.cm { + for span_label in msp.span_labels() { + if span_label.span == DUMMY_SP || span_label.span == COMMAND_LINE_SP { + continue; + } + let lo = cm.lookup_char_pos(span_label.span.lo); + let mut hi = cm.lookup_char_pos(span_label.span.hi); + let mut is_minimized = false; + + // If the span is long multi-line, simplify down to the span of one character + let max_multiline_span_length = 8; + if lo.line != hi.line && (hi.line - lo.line) > max_multiline_span_length { + hi.line = lo.line; + hi.col = CharPos(lo.col.0 + 1); + is_minimized = true; + } + + // Watch out for "empty spans". If we get a span like 6..6, we + // want to just display a `^` at 6, so convert that to + // 6..7. This is degenerate input, but it's best to degrade + // gracefully -- and the parser likes to supply a span like + // that for EOF, in particular. + if lo.col == hi.col && lo.line == hi.line { + hi.col = CharPos(lo.col.0 + 1); + } + + let mut ann = Annotation { + start_col: lo.col.0, + end_col: hi.col.0, + is_primary: span_label.is_primary, + label: span_label.label.clone(), + annotation_type: AnnotationType::Singleline, + }; + if is_minimized { + ann.annotation_type = AnnotationType::Minimized; + } else if lo.line != hi.line { + let ml = MultilineAnnotation { + depth: 1, + line_start: lo.line, + line_end: hi.line, + start_col: lo.col.0, + end_col: hi.col.0, + is_primary: span_label.is_primary, + label: span_label.label.clone(), + }; + ann.annotation_type = AnnotationType::Multiline(ml.clone()); + multiline_annotations.push((lo.file.clone(), ml)); + }; + + if !ann.is_multiline() { + add_annotation_to_file(&mut output, + lo.file, + lo.line, + ann); + } + } + } + + // Find overlapping multiline annotations, put them at different depths + multiline_annotations.sort_by(|a, b| { + (a.1.line_start, a.1.line_end).cmp(&(b.1.line_start, b.1.line_end)) + }); + for item in multiline_annotations.clone() { + let ann = item.1; + for item in multiline_annotations.iter_mut() { + let ref mut a = item.1; + // Move all other multiline annotations overlapping with this one + // one level to the right. + if &ann != a && + num_overlap(ann.line_start, ann.line_end, a.line_start, a.line_end, true) + { + a.increase_depth(); + } else { + break; + } + } + } + + let mut max_depth = 0; // max overlapping multiline spans + for (file, ann) in multiline_annotations { + if ann.depth > max_depth { + max_depth = ann.depth; + } + add_annotation_to_file(&mut output, file.clone(), ann.line_start, ann.as_start()); + for line in ann.line_start + 1..ann.line_end { + add_annotation_to_file(&mut output, file.clone(), line, ann.as_line()); + } + add_annotation_to_file(&mut output, file, ann.line_end, ann.as_end()); + } + for file_vec in output.iter_mut() { + file_vec.multiline_depth = max_depth; + } + output + } + + fn render_source_line(&self, + buffer: &mut StyledBuffer, + file: Rc, + line: &Line, + width_offset: usize, + multiline_depth: usize) { + let source_string = file.get_line(line.line_index - 1) + .unwrap_or(""); + + let line_offset = buffer.num_lines(); + let code_offset = if multiline_depth == 0 { + width_offset + } else { + width_offset + multiline_depth + 1 + }; + + // First create the source line we will highlight. + buffer.puts(line_offset, code_offset, &source_string, Style::Quotation); + buffer.puts(line_offset, + 0, + &(line.line_index.to_string()), + Style::LineNumber); + + draw_col_separator(buffer, line_offset, width_offset - 2); + + // We want to display like this: + // + // vec.push(vec.pop().unwrap()); + // --- ^^^ - previous borrow ends here + // | | + // | error occurs here + // previous borrow of `vec` occurs here + // + // But there are some weird edge cases to be aware of: + // + // vec.push(vec.pop().unwrap()); + // -------- - previous borrow ends here + // || + // |this makes no sense + // previous borrow of `vec` occurs here + // + // For this reason, we group the lines into "highlight lines" + // and "annotations lines", where the highlight lines have the `~`. + + // Sort the annotations by (start, end col) + let mut annotations = line.annotations.clone(); + annotations.sort(); + annotations.reverse(); + + // First, figure out where each label will be positioned. + // + // In the case where you have the following annotations: + // + // vec.push(vec.pop().unwrap()); + // -------- - previous borrow ends here [C] + // || + // |this makes no sense [B] + // previous borrow of `vec` occurs here [A] + // + // `annotations_position` will hold [(2, A), (1, B), (0, C)]. + // + // We try, when possible, to stick the rightmost annotation at the end + // of the highlight line: + // + // vec.push(vec.pop().unwrap()); + // --- --- - previous borrow ends here + // + // But sometimes that's not possible because one of the other + // annotations overlaps it. For example, from the test + // `span_overlap_label`, we have the following annotations + // (written on distinct lines for clarity): + // + // fn foo(x: u32) { + // -------------- + // - + // + // In this case, we can't stick the rightmost-most label on + // the highlight line, or we would get: + // + // fn foo(x: u32) { + // -------- x_span + // | + // fn_span + // + // which is totally weird. Instead we want: + // + // fn foo(x: u32) { + // -------------- + // | | + // | x_span + // fn_span + // + // which is...less weird, at least. In fact, in general, if + // the rightmost span overlaps with any other span, we should + // use the "hang below" version, so we can at least make it + // clear where the span *starts*. + let mut annotations_position = vec![]; + let mut line_len = 0; + let mut p = 0; + let mut ann_iter = annotations.iter().peekable(); + while let Some(annotation) = ann_iter.next() { + let is_line = if let AnnotationType::MultilineLine(_) = annotation.annotation_type { + true + } else { + false + }; + let peek = ann_iter.peek(); + if let Some(next) = peek { + let next_is_line = if let AnnotationType::MultilineLine(_) = next.annotation_type { + true + } else { + false + }; + + if overlaps(next, annotation) && !is_line && !next_is_line { + p += 1; + } + } + annotations_position.push((p, annotation)); + if let Some(next) = peek { + let next_is_line = if let AnnotationType::MultilineLine(_) = next.annotation_type { + true + } else { + false + }; + let l = if let Some(ref label) = next.label { + label.len() + 2 + } else { + 0 + }; + if (overlaps(next, annotation) || next.end_col + l > annotation.start_col) + && !is_line && !next_is_line + { + p += 1; + } + } + if line_len < p { + line_len = p; + } + } + if line_len != 0 { + line_len += 1; + } + + // If there are no annotations or the only annotations on this line are + // MultilineLine, then there's only code being shown, stop processing. + if line.annotations.is_empty() || line.annotations.iter() + .filter(|a| { + // Set the multiline annotation vertical lines to the left of + // the code in this line. + if let AnnotationType::MultilineLine(depth) = a.annotation_type { + buffer.putc(line_offset, + width_offset + depth - 1, + '|', + if a.is_primary { + Style::UnderlinePrimary + } else { + Style::UnderlineSecondary + }); + false + } else { + true + } + }).collect::>().len() == 0 + { + return; + } + + for pos in 0..line_len + 1 { + draw_col_separator(buffer, line_offset + pos + 1, width_offset - 2); + buffer.putc(line_offset + pos + 1, + width_offset - 2, + '|', + Style::LineNumber); + } + + // Write the horizontal lines for multiline annotations + // (only the first and last lines need this). + // + // After this we will have: + // + // 2 | fn foo() { + // | __________ + // | + // | + // 3 | + // 4 | } + // | _ + for &(pos, annotation) in &annotations_position { + let style = if annotation.is_primary { + Style::UnderlinePrimary + } else { + Style::UnderlineSecondary + }; + let pos = pos + 1; + match annotation.annotation_type { + AnnotationType::MultilineStart(depth) | + AnnotationType::MultilineEnd(depth) => { + draw_range(buffer, + '_', + line_offset + pos, + width_offset + depth, + code_offset + annotation.start_col, + style); + } + _ => (), + } + } + + // Write the vertical lines for multiline spans and for labels that are + // on a different line as the underline. + // + // After this we will have: + // + // 2 | fn foo() { + // | __________ + // | | | + // | | + // 3 | | + // 4 | | } + // | |_ + for &(pos, annotation) in &annotations_position { + let style = if annotation.is_primary { + Style::UnderlinePrimary + } else { + Style::UnderlineSecondary + }; + let pos = pos + 1; + if pos > 1 { + for p in line_offset + 1..line_offset + pos + 1 { + buffer.putc(p, + code_offset + annotation.start_col, + '|', + style); + } + } + match annotation.annotation_type { + AnnotationType::MultilineStart(depth) => { + for p in line_offset + pos + 1..line_offset + line_len + 2 { + buffer.putc(p, + width_offset + depth - 1, + '|', + style); + } + } + AnnotationType::MultilineEnd(depth) => { + for p in line_offset..line_offset + pos + 1 { + buffer.putc(p, + width_offset + depth - 1, + '|', + style); + } + } + AnnotationType::MultilineLine(depth) => { + // the first line will have already be filled when we checked + // wether there were any annotations for this line. + for p in line_offset + 1..line_offset + line_len + 2 { + buffer.putc(p, + width_offset + depth - 1, + '|', + style); + } + } + _ => (), + } + } + + // Write the labels on the annotations that actually have a label. + // + // After this we will have: + // + // 2 | fn foo() { + // | __________ starting here... + // | | | + // | | something about `foo` + // 3 | | + // 4 | | } + // | |_ ...ending here: test + for &(pos, annotation) in &annotations_position { + let style = if annotation.is_primary { + Style::LabelPrimary + } else { + Style::LabelSecondary + }; + let (pos, col) = if pos == 0 { + (pos + 1, annotation.end_col + 1) + } else { + (pos + 2, annotation.start_col) + }; + if let Some(ref label) = annotation.label { + buffer.puts(line_offset + pos, + code_offset + col, + &label, + style); + } + } + + // Sort from biggest span to smallest span so that smaller spans are + // represented in the output: + // + // x | fn foo() + // | ^^^---^^ + // | | | + // | | something about `foo` + // | something about `fn foo()` + annotations_position.sort_by(|a, b| { + fn len(a: &Annotation) -> usize { + // Account for usize underflows + if a.end_col > a.start_col { + a.end_col - a.start_col + } else { + a.start_col - a.end_col + } + } + // Decreasing order + len(a.1).cmp(&len(b.1)).reverse() + }); + + // Write the underlines. + // + // After this we will have: + // + // 2 | fn foo() { + // | ____-_____^ starting here... + // | | | + // | | something about `foo` + // 3 | | + // 4 | | } + // | |_^ ...ending here: test + for &(_, annotation) in &annotations_position { + let (underline, style) = if annotation.is_primary { + ('^', Style::UnderlinePrimary) + } else { + ('-', Style::UnderlineSecondary) + }; + for p in annotation.start_col..annotation.end_col { + buffer.putc(line_offset + 1, + code_offset + p, + underline, + style); + } + } + } + + fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize { + let mut max = 0; + if let Some(ref cm) = self.cm { + for primary_span in msp.primary_spans() { + if primary_span != &DUMMY_SP && primary_span != &COMMAND_LINE_SP { + let hi = cm.lookup_char_pos(primary_span.hi); + if hi.line > max { + max = hi.line; + } + } + } + for span_label in msp.span_labels() { + if span_label.span != DUMMY_SP && span_label.span != COMMAND_LINE_SP { + let hi = cm.lookup_char_pos(span_label.span.hi); + if hi.line > max { + max = hi.line; + } + } + } + } + max + } + + fn get_max_line_num(&mut self, span: &MultiSpan, children: &Vec) -> usize { + let mut max = 0; + + let primary = self.get_multispan_max_line_num(span); + max = if primary > max { primary } else { max }; + + for sub in children { + let sub_result = self.get_multispan_max_line_num(&sub.span); + max = if sub_result > max { primary } else { max }; + } + max + } + + // This "fixes" MultiSpans that contain Spans that are pointing to locations inside of + // <*macros>. Since these locations are often difficult to read, we move these Spans from + // <*macros> to their corresponding use site. + fn fix_multispan_in_std_macros(&mut self, span: &mut MultiSpan) -> bool { + let mut spans_updated = false; + + if let Some(ref cm) = self.cm { + let mut before_after: Vec<(Span, Span)> = vec![]; + let mut new_labels: Vec<(Span, String)> = vec![]; + + // First, find all the spans in <*macros> and point instead at their use site + for sp in span.primary_spans() { + if (*sp == COMMAND_LINE_SP) || (*sp == DUMMY_SP) { + continue; + } + if cm.span_to_filename(sp.clone()).contains("macros>") { + let v = cm.macro_backtrace(sp.clone()); + if let Some(use_site) = v.last() { + before_after.push((sp.clone(), use_site.call_site.clone())); + } + } + for trace in cm.macro_backtrace(sp.clone()).iter().rev() { + // Only show macro locations that are local + // and display them like a span_note + if let Some(def_site) = trace.def_site_span { + if (def_site == COMMAND_LINE_SP) || (def_site == DUMMY_SP) { + continue; + } + // Check to make sure we're not in any <*macros> + if !cm.span_to_filename(def_site).contains("macros>") && + !trace.macro_decl_name.starts_with("#[") { + new_labels.push((trace.call_site, + "in this macro invocation".to_string())); + break; + } + } + } + } + for (label_span, label_text) in new_labels { + span.push_span_label(label_span, label_text); + } + for sp_label in span.span_labels() { + if (sp_label.span == COMMAND_LINE_SP) || (sp_label.span == DUMMY_SP) { + continue; + } + if cm.span_to_filename(sp_label.span.clone()).contains("macros>") { + let v = cm.macro_backtrace(sp_label.span.clone()); + if let Some(use_site) = v.last() { + before_after.push((sp_label.span.clone(), use_site.call_site.clone())); + } + } + } + // After we have them, make sure we replace these 'bad' def sites with their use sites + for (before, after) in before_after { + span.replace(before, after); + spans_updated = true; + } + } + + spans_updated + } + + // This does a small "fix" for multispans by looking to see if it can find any that + // point directly at <*macros>. Since these are often difficult to read, this + // will change the span to point at the use site. + fn fix_multispans_in_std_macros(&mut self, + span: &mut MultiSpan, + children: &mut Vec) { + let mut spans_updated = self.fix_multispan_in_std_macros(span); + for child in children.iter_mut() { + spans_updated |= self.fix_multispan_in_std_macros(&mut child.span); + } + if spans_updated { + children.push(SubDiagnostic { + level: Level::Note, + message: "this error originates in a macro outside of the current crate" + .to_string(), + span: MultiSpan::new(), + render_span: None, + }); + } + } + + fn emit_message_default(&mut self, + msp: &MultiSpan, + msg: &str, + code: &Option, + level: &Level, + max_line_num_len: usize, + is_secondary: bool) + -> io::Result<()> { + let mut buffer = StyledBuffer::new(); + + if msp.primary_spans().is_empty() && msp.span_labels().is_empty() && is_secondary { + // This is a secondary message with no span info + for _ in 0..max_line_num_len { + buffer.prepend(0, " ", Style::NoStyle); + } + draw_note_separator(&mut buffer, 0, max_line_num_len + 1); + buffer.append(0, &level.to_string(), Style::HeaderMsg); + buffer.append(0, ": ", Style::NoStyle); + buffer.append(0, msg, Style::NoStyle); + } else { + buffer.append(0, &level.to_string(), Style::Level(level.clone())); + match code { + &Some(ref code) => { + buffer.append(0, "[", Style::Level(level.clone())); + buffer.append(0, &code, Style::Level(level.clone())); + buffer.append(0, "]", Style::Level(level.clone())); + } + _ => {} + } + buffer.append(0, ": ", Style::HeaderMsg); + buffer.append(0, msg, Style::HeaderMsg); + } + + // Preprocess all the annotations so that they are grouped by file and by line number + // This helps us quickly iterate over the whole message (including secondary file spans) + let mut annotated_files = self.preprocess_annotations(msp); + + // Make sure our primary file comes first + let primary_lo = if let (Some(ref cm), Some(ref primary_span)) = + (self.cm.as_ref(), msp.primary_span().as_ref()) { + if primary_span != &&DUMMY_SP && primary_span != &&COMMAND_LINE_SP { + cm.lookup_char_pos(primary_span.lo) + } else { + try!(emit_to_destination(&buffer.render(), level, &mut self.dst)); + return Ok(()); + } + } else { + // If we don't have span information, emit and exit + try!(emit_to_destination(&buffer.render(), level, &mut self.dst)); + return Ok(()); + }; + if let Ok(pos) = + annotated_files.binary_search_by(|x| x.file.name.cmp(&primary_lo.file.name)) { + annotated_files.swap(0, pos); + } + + // Print out the annotate source lines that correspond with the error + for annotated_file in annotated_files { + // print out the span location and spacer before we print the annotated source + // to do this, we need to know if this span will be primary + let is_primary = primary_lo.file.name == annotated_file.file.name; + if is_primary { + // remember where we are in the output buffer for easy reference + let buffer_msg_line_offset = buffer.num_lines(); + + buffer.prepend(buffer_msg_line_offset, "--> ", Style::LineNumber); + let loc = primary_lo.clone(); + buffer.append(buffer_msg_line_offset, + &format!("{}:{}:{}", loc.file.name, loc.line, loc.col.0 + 1), + Style::LineAndColumn); + for _ in 0..max_line_num_len { + buffer.prepend(buffer_msg_line_offset, " ", Style::NoStyle); + } + } else { + // remember where we are in the output buffer for easy reference + let buffer_msg_line_offset = buffer.num_lines(); + + // Add spacing line + draw_col_separator(&mut buffer, buffer_msg_line_offset, max_line_num_len + 1); + + // Then, the secondary file indicator + buffer.prepend(buffer_msg_line_offset + 1, "::: ", Style::LineNumber); + buffer.append(buffer_msg_line_offset + 1, + &annotated_file.file.name, + Style::LineAndColumn); + for _ in 0..max_line_num_len { + buffer.prepend(buffer_msg_line_offset + 1, " ", Style::NoStyle); + } + } + + // Put in the spacer between the location and annotated source + let buffer_msg_line_offset = buffer.num_lines(); + draw_col_separator_no_space(&mut buffer, buffer_msg_line_offset, max_line_num_len + 1); + + // Next, output the annotate source for this file + for line_idx in 0..annotated_file.lines.len() { + self.render_source_line(&mut buffer, + annotated_file.file.clone(), + &annotated_file.lines[line_idx], + 3 + max_line_num_len, + annotated_file.multiline_depth); + + // check to see if we need to print out or elide lines that come between + // this annotated line and the next one + if line_idx < (annotated_file.lines.len() - 1) { + let line_idx_delta = annotated_file.lines[line_idx + 1].line_index - + annotated_file.lines[line_idx].line_index; + if line_idx_delta > 2 { + let last_buffer_line_num = buffer.num_lines(); + buffer.puts(last_buffer_line_num, 0, "...", Style::LineNumber); + } else if line_idx_delta == 2 { + let unannotated_line = annotated_file.file + .get_line(annotated_file.lines[line_idx].line_index) + .unwrap_or(""); + + let last_buffer_line_num = buffer.num_lines(); + + buffer.puts(last_buffer_line_num, + 0, + &(annotated_file.lines[line_idx + 1].line_index - 1) + .to_string(), + Style::LineNumber); + draw_col_separator(&mut buffer, last_buffer_line_num, 1 + max_line_num_len); + buffer.puts(last_buffer_line_num, + 3 + max_line_num_len, + &unannotated_line, + Style::Quotation); + } + } + } + } + + // final step: take our styled buffer, render it, then output it + try!(emit_to_destination(&buffer.render(), level, &mut self.dst)); + + Ok(()) + } + fn emit_suggestion_default(&mut self, + suggestion: &CodeSuggestion, + level: &Level, + msg: &str, + max_line_num_len: usize) + -> io::Result<()> { + use std::borrow::Borrow; + + let primary_span = suggestion.msp.primary_span().unwrap(); + if let Some(ref cm) = self.cm { + let mut buffer = StyledBuffer::new(); + + buffer.append(0, &level.to_string(), Style::Level(level.clone())); + buffer.append(0, ": ", Style::HeaderMsg); + buffer.append(0, msg, Style::HeaderMsg); + + let lines = cm.span_to_lines(primary_span).unwrap(); + + assert!(!lines.lines.is_empty()); + + let complete = suggestion.splice_lines(cm.borrow()); + + // print the suggestion without any line numbers, but leave + // space for them. This helps with lining up with previous + // snippets from the actual error being reported. + let mut lines = complete.lines(); + let mut row_num = 1; + for line in lines.by_ref().take(MAX_HIGHLIGHT_LINES) { + draw_col_separator(&mut buffer, row_num, max_line_num_len + 1); + buffer.append(row_num, line, Style::NoStyle); + row_num += 1; + } + + // if we elided some lines, add an ellipsis + if let Some(_) = lines.next() { + buffer.append(row_num, "...", Style::NoStyle); + } + try!(emit_to_destination(&buffer.render(), level, &mut self.dst)); + } + Ok(()) + } + fn emit_messages_default(&mut self, + level: &Level, + message: &String, + code: &Option, + span: &MultiSpan, + children: &Vec) { + let max_line_num = self.get_max_line_num(span, children); + let max_line_num_len = max_line_num.to_string().len(); + + match self.emit_message_default(span, message, code, level, max_line_num_len, false) { + Ok(()) => { + if !children.is_empty() { + let mut buffer = StyledBuffer::new(); + draw_col_separator_no_space(&mut buffer, 0, max_line_num_len + 1); + match emit_to_destination(&buffer.render(), level, &mut self.dst) { + Ok(()) => (), + Err(e) => panic!("failed to emit error: {}", e) + } + } + for child in children { + match child.render_span { + Some(FullSpan(ref msp)) => { + match self.emit_message_default(msp, + &child.message, + &None, + &child.level, + max_line_num_len, + true) { + Err(e) => panic!("failed to emit error: {}", e), + _ => () + } + }, + Some(Suggestion(ref cs)) => { + match self.emit_suggestion_default(cs, + &child.level, + &child.message, + max_line_num_len) { + Err(e) => panic!("failed to emit error: {}", e), + _ => () + } + }, + None => { + match self.emit_message_default(&child.span, + &child.message, + &None, + &child.level, + max_line_num_len, + true) { + Err(e) => panic!("failed to emit error: {}", e), + _ => () + } + } + } + } + } + Err(e) => panic!("failed to emit error: {}", e), + } + match write!(&mut self.dst, "\n") { + Err(e) => panic!("failed to emit error: {}", e), + _ => { + match self.dst.flush() { + Err(e) => panic!("failed to emit error: {}", e), + _ => (), + } + } + } + } +} + +fn draw_col_separator(buffer: &mut StyledBuffer, line: usize, col: usize) { + buffer.puts(line, col, "| ", Style::LineNumber); +} + +fn draw_col_separator_no_space(buffer: &mut StyledBuffer, line: usize, col: usize) { + draw_col_separator_no_space_with_style(buffer, line, col, Style::LineNumber); +} + +fn draw_col_separator_no_space_with_style(buffer: &mut StyledBuffer, + line: usize, + col: usize, + style: Style) { + buffer.putc(line, col, '|', style); +} + +fn draw_range(buffer: &mut StyledBuffer, symbol: char, line: usize, + col_from: usize, col_to: usize, style: Style) { + for col in col_from..col_to { + buffer.putc(line, col, symbol, style); + } +} + +fn draw_note_separator(buffer: &mut StyledBuffer, line: usize, col: usize) { + buffer.puts(line, col, "= ", Style::LineNumber); +} + +trait SyntexContains { + fn syntex_contains(&self, item: Idx) -> bool; +} + +impl SyntexContains for ops::Range where Idx: PartialOrd { + fn syntex_contains(&self, item: Idx) -> bool { + (self.start <= item) && (item < self.end) + } +} + +fn num_overlap(a_start: usize, a_end: usize, b_start: usize, b_end:usize, inclusive: bool) -> bool { + let extra = if inclusive { + 1 + } else { + 0 + }; + (b_start..b_end + extra).syntex_contains(a_start) || + (a_start..a_end + extra).syntex_contains(b_start) +} +fn overlaps(a1: &Annotation, a2: &Annotation) -> bool { + num_overlap(a1.start_col, a1.end_col, a2.start_col, a2.end_col, false) +} + +fn emit_to_destination(rendered_buffer: &Vec>, + lvl: &Level, + dst: &mut Destination) + -> io::Result<()> { + use lock; + + // In order to prevent error message interleaving, where multiple error lines get intermixed + // when multiple compiler processes error simultaneously, we emit errors with additional + // steps. + // + // On Unix systems, we write into a buffered terminal rather than directly to a terminal. When + // the .flush() is called we take the buffer created from the buffered writes and write it at + // one shot. Because the Unix systems use ANSI for the colors, which is a text-based styling + // scheme, this buffered approach works and maintains the styling. + // + // On Windows, styling happens through calls to a terminal API. This prevents us from using the + // same buffering approach. Instead, we use a global Windows mutex, which we acquire long + // enough to output the full error message, then we release. + let _buffer_lock = lock::acquire_global_lock("rustc_errors"); + for line in rendered_buffer { + for part in line { + try!(dst.apply_style(lvl.clone(), part.style)); + try!(write!(dst, "{}", part.text)); + try!(dst.reset_attrs()); + } + try!(write!(dst, "\n")); + } + try!(dst.flush()); + Ok(()) +} + +#[cfg(unix)] +fn stderr_isatty() -> bool { + use libc; + unsafe { libc::isatty(libc::STDERR_FILENO) != 0 } +} +#[cfg(windows)] +fn stderr_isatty() -> bool { + type DWORD = u32; + type BOOL = i32; + type HANDLE = *mut u8; + const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD; + extern "system" { + fn GetStdHandle(which: DWORD) -> HANDLE; + fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL; + } + unsafe { + let handle = GetStdHandle(STD_ERROR_HANDLE); + let mut out = 0; + GetConsoleMode(handle, &mut out) != 0 + } +} + +pub type BufferedStderr = term::Terminal + Send; + +pub enum Destination { + Terminal(Box), + BufferedTerminal(Box), + Raw(Box), +} + +/// Buffered writer gives us a way on Unix to buffer up an entire error message before we output +/// it. This helps to prevent interleaving of multiple error messages when multiple compiler +/// processes error simultaneously +pub struct BufferedWriter { + buffer: Vec, +} + +impl BufferedWriter { + // note: we use _new because the conditional compilation at its use site may make this + // this function unused on some platforms + fn _new() -> BufferedWriter { + BufferedWriter { buffer: vec![] } + } +} + +impl Write for BufferedWriter { + fn write(&mut self, buf: &[u8]) -> io::Result { + for b in buf { + self.buffer.push(*b); + } + Ok(buf.len()) + } + fn flush(&mut self) -> io::Result<()> { + let mut stderr = io::stderr(); + let result = (|| { + try!(stderr.write_all(&self.buffer)); + stderr.flush() + })(); + self.buffer.clear(); + result + } +} + +impl Destination { + #[cfg(not(windows))] + /// When not on Windows, prefer the buffered terminal so that we can buffer an entire error + /// to be emitted at one time. + fn from_stderr() -> Destination { + let stderr: Option> = + term::TerminfoTerminal::new(BufferedWriter::_new()) + .map(|t| Box::new(t) as Box); + + match stderr { + Some(t) => BufferedTerminal(t), + None => Raw(Box::new(io::stderr())), + } + } + + #[cfg(windows)] + /// Return a normal, unbuffered terminal when on Windows. + fn from_stderr() -> Destination { + let stderr: Option> = term::TerminfoTerminal::new(io::stderr()) + .map(|t| Box::new(t) as Box) + .or_else(|| { + term::WinConsole::new(io::stderr()) + .ok() + .map(|t| Box::new(t) as Box) + }); + + match stderr { + Some(t) => Terminal(t), + None => Raw(Box::new(io::stderr())), + } + } + + fn apply_style(&mut self, lvl: Level, style: Style) -> io::Result<()> { + match style { + Style::FileNameStyle | Style::LineAndColumn => {} + Style::LineNumber => { + try!(self.start_attr(term::Attr::Bold)); + if cfg!(windows) { + try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN))); + } else { + try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE))); + } + } + Style::ErrorCode => { + try!(self.start_attr(term::Attr::Bold)); + try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_MAGENTA))); + } + Style::Quotation => {} + Style::OldSchoolNote => { + try!(self.start_attr(term::Attr::Bold)); + try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_GREEN))); + } + Style::OldSchoolNoteText | Style::HeaderMsg => { + try!(self.start_attr(term::Attr::Bold)); + if cfg!(windows) { + try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_WHITE))); + } + } + Style::UnderlinePrimary | Style::LabelPrimary => { + try!(self.start_attr(term::Attr::Bold)); + try!(self.start_attr(term::Attr::ForegroundColor(lvl.color()))); + } + Style::UnderlineSecondary | + Style::LabelSecondary => { + try!(self.start_attr(term::Attr::Bold)); + if cfg!(windows) { + try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN))); + } else { + try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE))); + } + } + Style::NoStyle => {} + Style::Level(l) => { + try!(self.start_attr(term::Attr::Bold)); + try!(self.start_attr(term::Attr::ForegroundColor(l.color()))); + } + } + Ok(()) + } + + fn start_attr(&mut self, attr: term::Attr) -> io::Result<()> { + match *self { + Terminal(ref mut t) => { + try!(t.attr(attr)); + } + BufferedTerminal(ref mut t) => { + try!(t.attr(attr)); + } + Raw(_) => {} + } + Ok(()) + } + + fn reset_attrs(&mut self) -> io::Result<()> { + match *self { + Terminal(ref mut t) => { + try!(t.reset()); + } + BufferedTerminal(ref mut t) => { + try!(t.reset()); + } + Raw(_) => {} + } + Ok(()) + } +} + +impl Write for Destination { + fn write(&mut self, bytes: &[u8]) -> io::Result { + match *self { + Terminal(ref mut t) => t.write(bytes), + BufferedTerminal(ref mut t) => t.write(bytes), + Raw(ref mut w) => w.write(bytes), + } + } + fn flush(&mut self) -> io::Result<()> { + match *self { + Terminal(ref mut t) => t.flush(), + BufferedTerminal(ref mut t) => t.flush(), + Raw(ref mut w) => w.flush(), + } + } +} diff --git a/third_party/rust/syntex_errors/src/lib.rs b/third_party/rust/syntex_errors/src/lib.rs new file mode 100644 index 000000000000..a5754e262d93 --- /dev/null +++ b/third_party/rust/syntex_errors/src/lib.rs @@ -0,0 +1,533 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "dylib"] +#![crate_type = "rlib"] +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://doc.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/nightly/")] +#![cfg_attr(not(stage0), deny(warnings))] + +extern crate rustc_serialize as serialize; +extern crate term; +#[macro_use] +extern crate log; +#[macro_use] +extern crate libc; +extern crate unicode_xid as std_unicode; +extern crate rustc_serialize; // used by deriving +extern crate syntex_pos as syntax_pos; + +pub use emitter::ColorConfig; + +use self::Level::*; + +use emitter::{Emitter, EmitterWriter}; + +use std::cell::{RefCell, Cell}; +use std::{error, fmt}; +use std::rc::Rc; + +pub mod diagnostic; +pub mod diagnostic_builder; +pub mod emitter; +pub mod snippet; +pub mod registry; +pub mod styled_buffer; +mod lock; + +use syntax_pos::{BytePos, Loc, FileLinesResult, FileName, MultiSpan, Span, NO_EXPANSION}; +use syntax_pos::MacroBacktrace; + +#[derive(Clone, Debug, PartialEq)] +pub enum RenderSpan { + /// A FullSpan renders with both with an initial line for the + /// message, prefixed by file:linenum, followed by a summary of + /// the source code covered by the span. + FullSpan(MultiSpan), + + /// A suggestion renders with both with an initial line for the + /// message, prefixed by file:linenum, followed by a summary + /// of hypothetical source code, where each `String` is spliced + /// into the lines in place of the code covered by each span. + Suggestion(CodeSuggestion), +} + +#[derive(Clone, Debug, PartialEq)] +pub struct CodeSuggestion { + pub msp: MultiSpan, + pub substitutes: Vec, +} + +pub trait CodeMapper { + fn lookup_char_pos(&self, pos: BytePos) -> Loc; + fn span_to_lines(&self, sp: Span) -> FileLinesResult; + fn span_to_string(&self, sp: Span) -> String; + fn span_to_filename(&self, sp: Span) -> FileName; + fn macro_backtrace(&self, span: Span) -> Vec; + fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option; +} + +impl CodeSuggestion { + /// Returns the assembled code suggestion. + pub fn splice_lines(&self, cm: &CodeMapper) -> String { + use syntax_pos::{CharPos, Loc, Pos}; + + fn push_trailing(buf: &mut String, + line_opt: Option<&str>, + lo: &Loc, + hi_opt: Option<&Loc>) { + let (lo, hi_opt) = (lo.col.to_usize(), hi_opt.map(|hi| hi.col.to_usize())); + if let Some(line) = line_opt { + if line.len() > lo { + buf.push_str(match hi_opt { + Some(hi) => &line[lo..hi], + None => &line[lo..], + }); + } + if let None = hi_opt { + buf.push('\n'); + } + } + } + + let mut primary_spans = self.msp.primary_spans().to_owned(); + + assert_eq!(primary_spans.len(), self.substitutes.len()); + if primary_spans.is_empty() { + return format!(""); + } + + // Assumption: all spans are in the same file, and all spans + // are disjoint. Sort in ascending order. + primary_spans.sort_by_key(|sp| sp.lo); + + // Find the bounding span. + let lo = primary_spans.iter().map(|sp| sp.lo).min().unwrap(); + let hi = primary_spans.iter().map(|sp| sp.hi).min().unwrap(); + let bounding_span = Span { + lo: lo, + hi: hi, + expn_id: NO_EXPANSION, + }; + let lines = cm.span_to_lines(bounding_span).unwrap(); + assert!(!lines.lines.is_empty()); + + // To build up the result, we do this for each span: + // - push the line segment trailing the previous span + // (at the beginning a "phantom" span pointing at the start of the line) + // - push lines between the previous and current span (if any) + // - if the previous and current span are not on the same line + // push the line segment leading up to the current span + // - splice in the span substitution + // + // Finally push the trailing line segment of the last span + let fm = &lines.file; + let mut prev_hi = cm.lookup_char_pos(bounding_span.lo); + prev_hi.col = CharPos::from_usize(0); + + let mut prev_line = fm.get_line(lines.lines[0].line_index); + let mut buf = String::new(); + + for (sp, substitute) in primary_spans.iter().zip(self.substitutes.iter()) { + let cur_lo = cm.lookup_char_pos(sp.lo); + if prev_hi.line == cur_lo.line { + push_trailing(&mut buf, prev_line, &prev_hi, Some(&cur_lo)); + } else { + push_trailing(&mut buf, prev_line, &prev_hi, None); + // push lines between the previous and current span (if any) + for idx in prev_hi.line..(cur_lo.line - 1) { + if let Some(line) = fm.get_line(idx) { + buf.push_str(line); + buf.push('\n'); + } + } + if let Some(cur_line) = fm.get_line(cur_lo.line - 1) { + buf.push_str(&cur_line[..cur_lo.col.to_usize()]); + } + } + buf.push_str(substitute); + prev_hi = cm.lookup_char_pos(sp.hi); + prev_line = fm.get_line(prev_hi.line - 1); + } + push_trailing(&mut buf, prev_line, &prev_hi, None); + // remove trailing newline + buf.pop(); + buf + } +} + +/// Used as a return value to signify a fatal error occurred. (It is also +/// used as the argument to panic at the moment, but that will eventually +/// not be true.) +#[derive(Copy, Clone, Debug)] +#[must_use] +pub struct FatalError; + +impl fmt::Display for FatalError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + write!(f, "parser fatal error") + } +} + +impl error::Error for FatalError { + fn description(&self) -> &str { + "The parser has encountered a fatal error" + } +} + +/// Signifies that the compiler died with an explicit call to `.bug` +/// or `.span_bug` rather than a failed assertion, etc. +#[derive(Copy, Clone, Debug)] +pub struct ExplicitBug; + +impl fmt::Display for ExplicitBug { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + write!(f, "parser internal bug") + } +} + +impl error::Error for ExplicitBug { + fn description(&self) -> &str { + "The parser has encountered an internal bug" + } +} + +pub use diagnostic::{Diagnostic, SubDiagnostic}; +pub use diagnostic_builder::DiagnosticBuilder; + +/// A handler deals with errors; certain errors +/// (fatal, bug, unimpl) may cause immediate exit, +/// others log errors for later reporting. +pub struct Handler { + err_count: Cell, + emitter: RefCell>, + pub can_emit_warnings: bool, + treat_err_as_bug: bool, + continue_after_error: Cell, + delayed_span_bug: RefCell>, +} + +impl Handler { + pub fn with_tty_emitter(color_config: ColorConfig, + can_emit_warnings: bool, + treat_err_as_bug: bool, + cm: Option>) + -> Handler { + let emitter = Box::new(EmitterWriter::stderr(color_config, cm)); + Handler::with_emitter(can_emit_warnings, treat_err_as_bug, emitter) + } + + pub fn with_emitter(can_emit_warnings: bool, + treat_err_as_bug: bool, + e: Box) + -> Handler { + Handler { + err_count: Cell::new(0), + emitter: RefCell::new(e), + can_emit_warnings: can_emit_warnings, + treat_err_as_bug: treat_err_as_bug, + continue_after_error: Cell::new(true), + delayed_span_bug: RefCell::new(None), + } + } + + pub fn set_continue_after_error(&self, continue_after_error: bool) { + self.continue_after_error.set(continue_after_error); + } + + pub fn struct_dummy<'a>(&'a self) -> DiagnosticBuilder<'a> { + DiagnosticBuilder::new(self, Level::Cancelled, "") + } + + pub fn struct_span_warn<'a, S: Into>(&'a self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Warning, msg); + result.set_span(sp); + if !self.can_emit_warnings { + result.cancel(); + } + result + } + pub fn struct_span_warn_with_code<'a, S: Into>(&'a self, + sp: S, + msg: &str, + code: &str) + -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Warning, msg); + result.set_span(sp); + result.code(code.to_owned()); + if !self.can_emit_warnings { + result.cancel(); + } + result + } + pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Warning, msg); + if !self.can_emit_warnings { + result.cancel(); + } + result + } + pub fn struct_span_err<'a, S: Into>(&'a self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Error, msg); + result.set_span(sp); + result + } + pub fn struct_span_err_with_code<'a, S: Into>(&'a self, + sp: S, + msg: &str, + code: &str) + -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Error, msg); + result.set_span(sp); + result.code(code.to_owned()); + result + } + pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { + DiagnosticBuilder::new(self, Level::Error, msg) + } + pub fn struct_span_fatal<'a, S: Into>(&'a self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Fatal, msg); + result.set_span(sp); + result + } + pub fn struct_span_fatal_with_code<'a, S: Into>(&'a self, + sp: S, + msg: &str, + code: &str) + -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Fatal, msg); + result.set_span(sp); + result.code(code.to_owned()); + result + } + pub fn struct_fatal<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { + DiagnosticBuilder::new(self, Level::Fatal, msg) + } + + pub fn cancel(&self, err: &mut DiagnosticBuilder) { + err.cancel(); + } + + fn panic_if_treat_err_as_bug(&self) { + if self.treat_err_as_bug { + panic!("encountered error with `-Z treat_err_as_bug"); + } + } + + pub fn span_fatal>(&self, sp: S, msg: &str) -> FatalError { + self.emit(&sp.into(), msg, Fatal); + self.panic_if_treat_err_as_bug(); + return FatalError; + } + pub fn span_fatal_with_code>(&self, + sp: S, + msg: &str, + code: &str) + -> FatalError { + self.emit_with_code(&sp.into(), msg, code, Fatal); + self.panic_if_treat_err_as_bug(); + return FatalError; + } + pub fn span_err>(&self, sp: S, msg: &str) { + self.emit(&sp.into(), msg, Error); + self.panic_if_treat_err_as_bug(); + } + pub fn mut_span_err<'a, S: Into>(&'a self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'a> { + let mut result = DiagnosticBuilder::new(self, Level::Error, msg); + result.set_span(sp); + result + } + pub fn span_err_with_code>(&self, sp: S, msg: &str, code: &str) { + self.emit_with_code(&sp.into(), msg, code, Error); + self.panic_if_treat_err_as_bug(); + } + pub fn span_warn>(&self, sp: S, msg: &str) { + self.emit(&sp.into(), msg, Warning); + } + pub fn span_warn_with_code>(&self, sp: S, msg: &str, code: &str) { + self.emit_with_code(&sp.into(), msg, code, Warning); + } + pub fn span_bug>(&self, sp: S, msg: &str) -> ! { + self.emit(&sp.into(), msg, Bug); + panic!(ExplicitBug); + } + pub fn delay_span_bug>(&self, sp: S, msg: &str) { + let mut delayed = self.delayed_span_bug.borrow_mut(); + *delayed = Some((sp.into(), msg.to_string())); + } + pub fn span_bug_no_panic>(&self, sp: S, msg: &str) { + self.emit(&sp.into(), msg, Bug); + } + pub fn span_note_without_error>(&self, sp: S, msg: &str) { + self.emit(&sp.into(), msg, Note); + } + pub fn span_unimpl>(&self, sp: S, msg: &str) -> ! { + self.span_bug(sp, &format!("unimplemented {}", msg)); + } + pub fn fatal(&self, msg: &str) -> FatalError { + if self.treat_err_as_bug { + self.bug(msg); + } + let mut db = DiagnosticBuilder::new(self, Fatal, msg); + db.emit(); + FatalError + } + pub fn err(&self, msg: &str) { + if self.treat_err_as_bug { + self.bug(msg); + } + let mut db = DiagnosticBuilder::new(self, Error, msg); + db.emit(); + } + pub fn warn(&self, msg: &str) { + let mut db = DiagnosticBuilder::new(self, Warning, msg); + db.emit(); + } + pub fn note_without_error(&self, msg: &str) { + let mut db = DiagnosticBuilder::new(self, Note, msg); + db.emit(); + } + pub fn bug(&self, msg: &str) -> ! { + let mut db = DiagnosticBuilder::new(self, Bug, msg); + db.emit(); + panic!(ExplicitBug); + } + pub fn unimpl(&self, msg: &str) -> ! { + self.bug(&format!("unimplemented {}", msg)); + } + + pub fn bump_err_count(&self) { + self.err_count.set(self.err_count.get() + 1); + } + + pub fn err_count(&self) -> usize { + self.err_count.get() + } + + pub fn has_errors(&self) -> bool { + self.err_count.get() > 0 + } + pub fn abort_if_errors(&self) { + let s; + match self.err_count.get() { + 0 => { + let delayed_bug = self.delayed_span_bug.borrow(); + match *delayed_bug { + Some((ref span, ref errmsg)) => { + self.span_bug(span.clone(), errmsg); + } + _ => {} + } + + return; + } + 1 => s = "aborting due to previous error".to_string(), + _ => { + s = format!("aborting due to {} previous errors", self.err_count.get()); + } + } + + panic!(self.fatal(&s)); + } + pub fn emit(&self, msp: &MultiSpan, msg: &str, lvl: Level) { + if lvl == Warning && !self.can_emit_warnings { + return; + } + let mut db = DiagnosticBuilder::new(self, lvl, msg); + db.set_span(msp.clone()); + db.emit(); + if !self.continue_after_error.get() { + self.abort_if_errors(); + } + } + pub fn emit_with_code(&self, msp: &MultiSpan, msg: &str, code: &str, lvl: Level) { + if lvl == Warning && !self.can_emit_warnings { + return; + } + let mut db = DiagnosticBuilder::new_with_code(self, lvl, Some(code.to_owned()), msg); + db.set_span(msp.clone()); + db.emit(); + if !self.continue_after_error.get() { + self.abort_if_errors(); + } + } +} + + +#[derive(Copy, PartialEq, Clone, Debug)] +pub enum Level { + Bug, + Fatal, + // An error which while not immediately fatal, should stop the compiler + // progressing beyond the current phase. + PhaseFatal, + Error, + Warning, + Note, + Help, + Cancelled, +} + +impl fmt::Display for Level { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.to_str().fmt(f) + } +} + +impl Level { + pub fn color(self) -> term::color::Color { + match self { + Bug | Fatal | PhaseFatal | Error => term::color::BRIGHT_RED, + Warning => { + if cfg!(windows) { + term::color::BRIGHT_YELLOW + } else { + term::color::YELLOW + } + } + Note => term::color::BRIGHT_GREEN, + Help => term::color::BRIGHT_CYAN, + Cancelled => unreachable!(), + } + } + + pub fn to_str(self) -> &'static str { + match self { + Bug => "error: internal compiler error", + Fatal | PhaseFatal | Error => "error", + Warning => "warning", + Note => "note", + Help => "help", + Cancelled => panic!("Shouldn't call on cancelled error"), + } + } +} + +pub fn expect(diag: &Handler, opt: Option, msg: M) -> T + where M: FnOnce() -> String +{ + match opt { + Some(t) => t, + None => diag.bug(&msg()), + } +} diff --git a/third_party/rust/syntex_errors/src/lock.rs b/third_party/rust/syntex_errors/src/lock.rs new file mode 100644 index 000000000000..4c298228c37c --- /dev/null +++ b/third_party/rust/syntex_errors/src/lock.rs @@ -0,0 +1,115 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Bindings to acquire a global named lock. +//! +//! This is intended to be used to synchronize multiple compiler processes to +//! ensure that we can output complete errors without interleaving on Windows. +//! Note that this is currently only needed for allowing only one 32-bit MSVC +//! linker to execute at once on MSVC hosts, so this is only implemented for +//! `cfg(windows)`. Also note that this may not always be used on Windows, +//! only when targeting 32-bit MSVC. +//! +//! For more information about why this is necessary, see where this is called. + +use std::any::Any; + +#[cfg(windows)] +#[allow(bad_style)] +pub fn acquire_global_lock(name: &str) -> Box { + use std::ffi::CString; + use std::io; + + type LPSECURITY_ATTRIBUTES = *mut u8; + type BOOL = i32; + type LPCSTR = *const u8; + type HANDLE = *mut u8; + type DWORD = u32; + + const INFINITE: DWORD = !0; + const WAIT_OBJECT_0: DWORD = 0; + const WAIT_ABANDONED: DWORD = 0x00000080; + + extern "system" { + fn CreateMutexA(lpMutexAttributes: LPSECURITY_ATTRIBUTES, + bInitialOwner: BOOL, + lpName: LPCSTR) + -> HANDLE; + fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD; + fn ReleaseMutex(hMutex: HANDLE) -> BOOL; + fn CloseHandle(hObject: HANDLE) -> BOOL; + } + + struct Handle(HANDLE); + + impl Drop for Handle { + fn drop(&mut self) { + unsafe { + CloseHandle(self.0); + } + } + } + + struct Guard(Handle); + + impl Drop for Guard { + fn drop(&mut self) { + unsafe { + ReleaseMutex((self.0).0); + } + } + } + + let cname = CString::new(name).unwrap(); + unsafe { + // Create a named mutex, with no security attributes and also not + // acquired when we create it. + // + // This will silently create one if it doesn't already exist, or it'll + // open up a handle to one if it already exists. + let mutex = CreateMutexA(0 as *mut _, 0, cname.as_ptr() as *const u8); + if mutex.is_null() { + panic!("failed to create global mutex named `{}`: {}", + name, + io::Error::last_os_error()); + } + let mutex = Handle(mutex); + + // Acquire the lock through `WaitForSingleObject`. + // + // A return value of `WAIT_OBJECT_0` means we successfully acquired it. + // + // A return value of `WAIT_ABANDONED` means that the previous holder of + // the thread exited without calling `ReleaseMutex`. This can happen, + // for example, when the compiler crashes or is interrupted via ctrl-c + // or the like. In this case, however, we are still transferred + // ownership of the lock so we continue. + // + // If an error happens.. well... that's surprising! + match WaitForSingleObject(mutex.0, INFINITE) { + WAIT_OBJECT_0 | WAIT_ABANDONED => {} + code => { + panic!("WaitForSingleObject failed on global mutex named \ + `{}`: {} (ret={:x})", + name, + io::Error::last_os_error(), + code); + } + } + + // Return a guard which will call `ReleaseMutex` when dropped. + Box::new(Guard(mutex)) + } +} + +#[cfg(unix)] +pub fn acquire_global_lock(_name: &str) -> Box { + Box::new(()) +} diff --git a/third_party/rust/syntex_errors/src/registry.rs b/third_party/rust/syntex_errors/src/registry.rs new file mode 100644 index 000000000000..83737681471e --- /dev/null +++ b/third_party/rust/syntex_errors/src/registry.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::collections::HashMap; + +#[derive(Clone)] +pub struct Registry { + descriptions: HashMap<&'static str, &'static str>, +} + +impl Registry { + pub fn new(descriptions: &[(&'static str, &'static str)]) -> Registry { + Registry { descriptions: descriptions.iter().cloned().collect() } + } + + pub fn find_description(&self, code: &str) -> Option<&'static str> { + self.descriptions.get(code).cloned() + } +} diff --git a/third_party/rust/syntex_errors/src/snippet.rs b/third_party/rust/syntex_errors/src/snippet.rs new file mode 100644 index 000000000000..b8c1726443db --- /dev/null +++ b/third_party/rust/syntex_errors/src/snippet.rs @@ -0,0 +1,188 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Code for annotating snippets. + +use syntax_pos::{Span, FileMap}; +use CodeMapper; +use std::rc::Rc; +use Level; + +#[derive(Clone)] +pub struct SnippetData { + codemap: Rc, + files: Vec, +} + +#[derive(Clone)] +pub struct FileInfo { + file: Rc, + + /// The "primary file", if any, gets a `-->` marker instead of + /// `>>>`, and has a line-number/column printed and not just a + /// filename. It appears first in the listing. It is known to + /// contain at least one primary span, though primary spans (which + /// are designated with `^^^`) may also occur in other files. + primary_span: Option, + + lines: Vec, +} + +#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)] +pub struct Line { + pub line_index: usize, + pub annotations: Vec, +} + + +#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)] +pub struct MultilineAnnotation { + pub depth: usize, + pub line_start: usize, + pub line_end: usize, + pub start_col: usize, + pub end_col: usize, + pub is_primary: bool, + pub label: Option, +} + +impl MultilineAnnotation { + pub fn increase_depth(&mut self) { + self.depth += 1; + } + + pub fn as_start(&self) -> Annotation { + Annotation { + start_col: self.start_col, + end_col: self.start_col + 1, + is_primary: self.is_primary, + label: Some("starting here...".to_owned()), + annotation_type: AnnotationType::MultilineStart(self.depth) + } + } + + pub fn as_end(&self) -> Annotation { + Annotation { + start_col: self.end_col - 1, + end_col: self.end_col, + is_primary: self.is_primary, + label: match self.label { + Some(ref label) => Some(format!("...ending here: {}", label)), + None => Some("...ending here".to_owned()), + }, + annotation_type: AnnotationType::MultilineEnd(self.depth) + } + } + + pub fn as_line(&self) -> Annotation { + Annotation { + start_col: 0, + end_col: 0, + is_primary: self.is_primary, + label: None, + annotation_type: AnnotationType::MultilineLine(self.depth) + } + } +} + +#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)] +pub enum AnnotationType { + /// Annotation under a single line of code + Singleline, + + /// Annotation under the first character of a multiline span + Minimized, + + /// Annotation enclosing the first and last character of a multiline span + Multiline(MultilineAnnotation), + + // The Multiline type above is replaced with the following three in order + // to reuse the current label drawing code. + // + // Each of these corresponds to one part of the following diagram: + // + // x | foo(1 + bar(x, + // | _________^ starting here... < MultilineStart + // x | | y), < MultilineLine + // | |______________^ ...ending here: label < MultilineEnd + // x | z); + /// Annotation marking the first character of a fully shown multiline span + MultilineStart(usize), + /// Annotation marking the last character of a fully shown multiline span + MultilineEnd(usize), + /// Line at the left enclosing the lines of a fully shown multiline span + MultilineLine(usize), +} + +#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)] +pub struct Annotation { + /// Start column, 0-based indexing -- counting *characters*, not + /// utf-8 bytes. Note that it is important that this field goes + /// first, so that when we sort, we sort orderings by start + /// column. + pub start_col: usize, + + /// End column within the line (exclusive) + pub end_col: usize, + + /// Is this annotation derived from primary span + pub is_primary: bool, + + /// Optional label to display adjacent to the annotation. + pub label: Option, + + /// Is this a single line, multiline or multiline span minimized down to a + /// smaller span. + pub annotation_type: AnnotationType, +} + +impl Annotation { + pub fn is_minimized(&self) -> bool { + match self.annotation_type { + AnnotationType::Minimized => true, + _ => false, + } + } + + pub fn is_multiline(&self) -> bool { + match self.annotation_type { + AnnotationType::Multiline(_) | + AnnotationType::MultilineStart(_) | + AnnotationType::MultilineLine(_) | + AnnotationType::MultilineEnd(_) => true, + _ => false, + } + } + +} + +#[derive(Debug)] +pub struct StyledString { + pub text: String, + pub style: Style, +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum Style { + HeaderMsg, + FileNameStyle, + LineAndColumn, + LineNumber, + Quotation, + UnderlinePrimary, + UnderlineSecondary, + LabelPrimary, + LabelSecondary, + OldSchoolNoteText, + OldSchoolNote, + NoStyle, + ErrorCode, + Level(Level), +} diff --git a/third_party/rust/syntex_errors/src/styled_buffer.rs b/third_party/rust/syntex_errors/src/styled_buffer.rs new file mode 100644 index 000000000000..dfc7c64de019 --- /dev/null +++ b/third_party/rust/syntex_errors/src/styled_buffer.rs @@ -0,0 +1,145 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Code for creating styled buffers + +use snippet::{Style, StyledString}; + +#[derive(Debug)] +pub struct StyledBuffer { + text: Vec>, + styles: Vec>, +} + +impl StyledBuffer { + pub fn new() -> StyledBuffer { + StyledBuffer { + text: vec![], + styles: vec![], + } + } + + pub fn copy_tabs(&mut self, row: usize) { + if row < self.text.len() { + for i in row + 1..self.text.len() { + for j in 0..self.text[i].len() { + if self.text[row].len() > j && self.text[row][j] == '\t' && + self.text[i][j] == ' ' { + self.text[i][j] = '\t'; + } + } + } + } + } + + pub fn render(&mut self) -> Vec> { + let mut output: Vec> = vec![]; + let mut styled_vec: Vec = vec![]; + + // before we render, do a little patch-up work to support tabs + self.copy_tabs(3); + + for (row, row_style) in self.text.iter().zip(&self.styles) { + let mut current_style = Style::NoStyle; + let mut current_text = String::new(); + + for (&c, &s) in row.iter().zip(row_style) { + if s != current_style { + if !current_text.is_empty() { + styled_vec.push(StyledString { + text: current_text, + style: current_style, + }); + } + current_style = s; + current_text = String::new(); + } + current_text.push(c); + } + if !current_text.is_empty() { + styled_vec.push(StyledString { + text: current_text, + style: current_style, + }); + } + + // We're done with the row, push and keep going + output.push(styled_vec); + + styled_vec = vec![]; + } + + output + } + + fn ensure_lines(&mut self, line: usize) { + while line >= self.text.len() { + self.text.push(vec![]); + self.styles.push(vec![]); + } + } + + pub fn putc(&mut self, line: usize, col: usize, chr: char, style: Style) { + self.ensure_lines(line); + if col < self.text[line].len() { + self.text[line][col] = chr; + self.styles[line][col] = style; + } else { + let mut i = self.text[line].len(); + while i < col { + self.text[line].push(' '); + self.styles[line].push(Style::NoStyle); + i += 1; + } + self.text[line].push(chr); + self.styles[line].push(style); + } + } + + pub fn puts(&mut self, line: usize, col: usize, string: &str, style: Style) { + let mut n = col; + for c in string.chars() { + self.putc(line, n, c, style); + n += 1; + } + } + + pub fn set_style(&mut self, line: usize, col: usize, style: Style) { + if self.styles.len() > line && self.styles[line].len() > col { + self.styles[line][col] = style; + } + } + + pub fn prepend(&mut self, line: usize, string: &str, style: Style) { + self.ensure_lines(line); + let string_len = string.len(); + + // Push the old content over to make room for new content + for _ in 0..string_len { + self.styles[line].insert(0, Style::NoStyle); + self.text[line].insert(0, ' '); + } + + self.puts(line, 0, string, style); + } + + pub fn append(&mut self, line: usize, string: &str, style: Style) { + if line >= self.text.len() { + self.puts(line, 0, string, style); + } else { + let col = self.text[line].len(); + self.puts(line, col, string, style); + } + } + + pub fn num_lines(&self) -> usize { + self.text.len() + } +} diff --git a/third_party/rust/syntex_pos/.cargo-checksum.json b/third_party/rust/syntex_pos/.cargo-checksum.json new file mode 100644 index 000000000000..20a3efe0e83a --- /dev/null +++ b/third_party/rust/syntex_pos/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"7391dd7ba851027f98067fef453fe0b71252ddf89f914257f9c2bb0874256f1c","src/lib.rs":"5bcf6170629a9afb40f06028d4708bb2cd9d278988e57f7269abcefc437f4616"},"package":"8df3921c7945dfb9ffc53aa35adb2cf4313b5ab5f079c3619b3d4eb82a0efc2b"} \ No newline at end of file diff --git a/third_party/rust/syntex_pos/.cargo-ok b/third_party/rust/syntex_pos/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/syntex_pos/Cargo.toml b/third_party/rust/syntex_pos/Cargo.toml new file mode 100644 index 000000000000..db05408cf429 --- /dev/null +++ b/third_party/rust/syntex_pos/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "syntex_pos" +version = "0.54.0" +authors = [ "erick.tryzelaar@gmail.com" ] +license = "MIT/Apache-2.0" +description = "Export of libsyntax_pos for code generation" +repository = "https://github.com/serde-rs/syntex" +include = ["Cargo.toml", "src/**/*.rs"] + +[dependencies] +rustc-serialize = "^0.3.16" diff --git a/third_party/rust/syntex_pos/src/lib.rs b/third_party/rust/syntex_pos/src/lib.rs new file mode 100644 index 000000000000..e727076632cb --- /dev/null +++ b/third_party/rust/syntex_pos/src/lib.rs @@ -0,0 +1,725 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The source positions and related helper functions +//! +//! # Note +//! +//! This API is completely unstable and subject to change. + +#![crate_type = "dylib"] +#![crate_type = "rlib"] +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://doc.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/nightly/")] +#![cfg_attr(not(stage0), deny(warnings))] + +use std::cell::{Cell, RefCell}; +use std::ops::{Add, Sub}; +use std::rc::Rc; +use std::cmp; + +use std::fmt; + +use serialize::{Encodable, Decodable, Encoder, Decoder}; + +extern crate rustc_serialize; +extern crate rustc_serialize as serialize; + +pub type FileName = String; + +/// Spans represent a region of code, used for error reporting. Positions in spans +/// are *absolute* positions from the beginning of the codemap, not positions +/// relative to FileMaps. Methods on the CodeMap can be used to relate spans back +/// to the original source. +/// You must be careful if the span crosses more than one file - you will not be +/// able to use many of the functions on spans in codemap and you cannot assume +/// that the length of the span = hi - lo; there may be space in the BytePos +/// range between files. +#[derive(Clone, Copy, Hash, PartialEq, Eq, Ord, PartialOrd)] +pub struct Span { + pub lo: BytePos, + pub hi: BytePos, + /// Information about where the macro came from, if this piece of + /// code was created by a macro expansion. + pub expn_id: ExpnId +} + +/// A collection of spans. Spans have two orthogonal attributes: +/// +/// - they can be *primary spans*. In this case they are the locus of +/// the error, and would be rendered with `^^^`. +/// - they can have a *label*. In this case, the label is written next +/// to the mark in the snippet when we render. +#[derive(Clone, Debug, Hash, PartialEq, Eq)] +pub struct MultiSpan { + primary_spans: Vec, + span_labels: Vec<(Span, String)>, +} + +impl Span { + /// Returns a new span representing just the end-point of this span + pub fn end_point(self) -> Span { + let lo = cmp::max(self.hi.0 - 1, self.lo.0); + Span { lo: BytePos(lo), hi: self.hi, expn_id: self.expn_id} + } + + /// Returns `self` if `self` is not the dummy span, and `other` otherwise. + pub fn substitute_dummy(self, other: Span) -> Span { + if self.source_equal(&DUMMY_SP) { other } else { self } + } + + pub fn contains(self, other: Span) -> bool { + self.lo <= other.lo && other.hi <= self.hi + } + + /// Return true if the spans are equal with regards to the source text. + /// + /// Use this instead of `==` when either span could be generated code, + /// and you only care that they point to the same bytes of source text. + pub fn source_equal(&self, other: &Span) -> bool { + self.lo == other.lo && self.hi == other.hi + } + + /// Returns `Some(span)`, where the start is trimmed by the end of `other` + pub fn trim_start(self, other: Span) -> Option { + if self.hi > other.hi { + Some(Span { lo: cmp::max(self.lo, other.hi), .. self }) + } else { + None + } + } +} + +#[derive(Clone, Debug)] +pub struct SpanLabel { + /// The span we are going to include in the final snippet. + pub span: Span, + + /// Is this a primary span? This is the "locus" of the message, + /// and is indicated with a `^^^^` underline, versus `----`. + pub is_primary: bool, + + /// What label should we attach to this span (if any)? + pub label: Option, +} + +impl Encodable for Span { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_struct("Span", 2, |s| { + try!(s.emit_struct_field("lo", 0, |s| { + self.lo.encode(s) + })); + + s.emit_struct_field("hi", 1, |s| { + self.hi.encode(s) + }) + }) + } +} + +impl Decodable for Span { + fn decode(d: &mut D) -> Result { + d.read_struct("Span", 2, |d| { + let lo = try!(d.read_struct_field("lo", 0, Decodable::decode)); + let hi = try!(d.read_struct_field("hi", 1, Decodable::decode)); + Ok(mk_sp(lo, hi)) + }) + } +} + +fn default_span_debug(span: Span, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Span {{ lo: {:?}, hi: {:?}, expn_id: {:?} }}", + span.lo, span.hi, span.expn_id) +} + +impl fmt::Debug for Span { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + SPAN_DEBUG.with(|span_debug| span_debug.get()(*self, f)) + } +} + +pub const DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: NO_EXPANSION }; + +// Generic span to be used for code originating from the command line +pub const COMMAND_LINE_SP: Span = Span { lo: BytePos(0), + hi: BytePos(0), + expn_id: COMMAND_LINE_EXPN }; + +impl MultiSpan { + pub fn new() -> MultiSpan { + MultiSpan { + primary_spans: vec![], + span_labels: vec![] + } + } + + pub fn from_span(primary_span: Span) -> MultiSpan { + MultiSpan { + primary_spans: vec![primary_span], + span_labels: vec![] + } + } + + pub fn from_spans(vec: Vec) -> MultiSpan { + MultiSpan { + primary_spans: vec, + span_labels: vec![] + } + } + + pub fn push_span_label(&mut self, span: Span, label: String) { + self.span_labels.push((span, label)); + } + + /// Selects the first primary span (if any) + pub fn primary_span(&self) -> Option { + self.primary_spans.first().cloned() + } + + /// Returns all primary spans. + pub fn primary_spans(&self) -> &[Span] { + &self.primary_spans + } + + /// Replaces all occurances of one Span with another. Used to move Spans in areas that don't + /// display well (like std macros). Returns true if replacements occurred. + pub fn replace(&mut self, before: Span, after: Span) -> bool { + let mut replacements_occurred = false; + for primary_span in &mut self.primary_spans { + if *primary_span == before { + *primary_span = after; + replacements_occurred = true; + } + } + for span_label in &mut self.span_labels { + if span_label.0 == before { + span_label.0 = after; + replacements_occurred = true; + } + } + replacements_occurred + } + + /// Returns the strings to highlight. We always ensure that there + /// is an entry for each of the primary spans -- for each primary + /// span P, if there is at least one label with span P, we return + /// those labels (marked as primary). But otherwise we return + /// `SpanLabel` instances with empty labels. + pub fn span_labels(&self) -> Vec { + let is_primary = |span| self.primary_spans.contains(&span); + let mut span_labels = vec![]; + + for &(span, ref label) in &self.span_labels { + span_labels.push(SpanLabel { + span: span, + is_primary: is_primary(span), + label: Some(label.clone()) + }); + } + + for &span in &self.primary_spans { + if !span_labels.iter().any(|sl| sl.span == span) { + span_labels.push(SpanLabel { + span: span, + is_primary: true, + label: None + }); + } + } + + span_labels + } +} + +impl From for MultiSpan { + fn from(span: Span) -> MultiSpan { + MultiSpan::from_span(span) + } +} + +#[derive(PartialEq, Eq, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Copy, Ord, PartialOrd)] +pub struct ExpnId(pub u32); + +pub const NO_EXPANSION: ExpnId = ExpnId(!0); +// For code appearing from the command line +pub const COMMAND_LINE_EXPN: ExpnId = ExpnId(!1); + +// For code generated by a procedural macro, without knowing which +// Used in `qquote!` +pub const PROC_EXPN: ExpnId = ExpnId(!2); + +impl ExpnId { + pub fn from_u32(id: u32) -> ExpnId { + ExpnId(id) + } + + pub fn into_u32(self) -> u32 { + self.0 + } +} + +/// Identifies an offset of a multi-byte character in a FileMap +#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq)] +pub struct MultiByteChar { + /// The absolute offset of the character in the CodeMap + pub pos: BytePos, + /// The number of bytes, >=2 + pub bytes: usize, +} + +/// A single source in the CodeMap. +pub struct FileMap { + /// The name of the file that the source came from, source that doesn't + /// originate from files has names between angle brackets by convention, + /// e.g. `` + pub name: FileName, + /// The absolute path of the file that the source came from. + pub abs_path: Option, + /// The complete source code + pub src: Option>, + /// The start position of this source in the CodeMap + pub start_pos: BytePos, + /// The end position of this source in the CodeMap + pub end_pos: BytePos, + /// Locations of lines beginnings in the source code + pub lines: RefCell>, + /// Locations of multi-byte characters in the source code + pub multibyte_chars: RefCell>, +} + +impl Encodable for FileMap { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_struct("FileMap", 6, |s| { + try!(s.emit_struct_field("name", 0, |s| self.name.encode(s))); + try!(s.emit_struct_field("abs_path", 1, |s| self.abs_path.encode(s))); + try!(s.emit_struct_field("start_pos", 2, |s| self.start_pos.encode(s))); + try!(s.emit_struct_field("end_pos", 3, |s| self.end_pos.encode(s))); + try!(s.emit_struct_field("lines", 4, |s| { + let lines = self.lines.borrow(); + // store the length + try!(s.emit_u32(lines.len() as u32)); + + if !lines.is_empty() { + // In order to preserve some space, we exploit the fact that + // the lines list is sorted and individual lines are + // probably not that long. Because of that we can store lines + // as a difference list, using as little space as possible + // for the differences. + let max_line_length = if lines.len() == 1 { + 0 + } else { + lines.windows(2) + .map(|w| w[1] - w[0]) + .map(|bp| bp.to_usize()) + .max() + .unwrap() + }; + + let bytes_per_diff: u8 = match max_line_length { + 0 ... 0xFF => 1, + 0x100 ... 0xFFFF => 2, + _ => 4 + }; + + // Encode the number of bytes used per diff. + try!(bytes_per_diff.encode(s)); + + // Encode the first element. + try!(lines[0].encode(s)); + + let diff_iter = (&lines[..]).windows(2) + .map(|w| (w[1] - w[0])); + + match bytes_per_diff { + 1 => for diff in diff_iter { try!((diff.0 as u8).encode(s)) }, + 2 => for diff in diff_iter { try!((diff.0 as u16).encode(s)) }, + 4 => for diff in diff_iter { try!(diff.0.encode(s)) }, + _ => unreachable!() + } + } + + Ok(()) + })); + s.emit_struct_field("multibyte_chars", 5, |s| { + (*self.multibyte_chars.borrow()).encode(s) + }) + }) + } +} + +impl Decodable for FileMap { + fn decode(d: &mut D) -> Result { + + d.read_struct("FileMap", 6, |d| { + let name: String = try!(d.read_struct_field("name", 0, |d| Decodable::decode(d))); + let abs_path: Option = + try!(d.read_struct_field("abs_path", 1, |d| Decodable::decode(d))); + let start_pos: BytePos = try!(d.read_struct_field("start_pos", 2, |d| Decodable::decode(d))); + let end_pos: BytePos = try!(d.read_struct_field("end_pos", 3, |d| Decodable::decode(d))); + let lines: Vec = try!(d.read_struct_field("lines", 4, |d| { + let num_lines: u32 = try!(Decodable::decode(d)); + let mut lines = Vec::with_capacity(num_lines as usize); + + if num_lines > 0 { + // Read the number of bytes used per diff. + let bytes_per_diff: u8 = try!(Decodable::decode(d)); + + // Read the first element. + let mut line_start: BytePos = try!(Decodable::decode(d)); + lines.push(line_start); + + for _ in 1..num_lines { + let diff = match bytes_per_diff { + 1 => try!(d.read_u8()) as u32, + 2 => try!(d.read_u16()) as u32, + 4 => try!(d.read_u32()), + _ => unreachable!() + }; + + line_start = line_start + BytePos(diff); + + lines.push(line_start); + } + } + + Ok(lines) + })); + let multibyte_chars: Vec = + try!(d.read_struct_field("multibyte_chars", 5, |d| Decodable::decode(d))); + Ok(FileMap { + name: name, + abs_path: abs_path, + start_pos: start_pos, + end_pos: end_pos, + src: None, + lines: RefCell::new(lines), + multibyte_chars: RefCell::new(multibyte_chars) + }) + }) + } +} + +impl fmt::Debug for FileMap { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "FileMap({})", self.name) + } +} + +impl FileMap { + /// EFFECT: register a start-of-line offset in the + /// table of line-beginnings. + /// UNCHECKED INVARIANT: these offsets must be added in the right + /// order and must be in the right places; there is shared knowledge + /// about what ends a line between this file and parse.rs + /// WARNING: pos param here is the offset relative to start of CodeMap, + /// and CodeMap will append a newline when adding a filemap without a newline at the end, + /// so the safe way to call this is with value calculated as + /// filemap.start_pos + newline_offset_relative_to_the_start_of_filemap. + pub fn next_line(&self, pos: BytePos) { + // the new charpos must be > the last one (or it's the first one). + let mut lines = self.lines.borrow_mut(); + let line_len = lines.len(); + assert!(line_len == 0 || ((*lines)[line_len - 1] < pos)); + lines.push(pos); + } + + /// get a line from the list of pre-computed line-beginnings. + /// line-number here is 0-based. + pub fn get_line(&self, line_number: usize) -> Option<&str> { + match self.src { + Some(ref src) => { + let lines = self.lines.borrow(); + lines.get(line_number).map(|&line| { + let begin: BytePos = line - self.start_pos; + let begin = begin.to_usize(); + // We can't use `lines.get(line_number+1)` because we might + // be parsing when we call this function and thus the current + // line is the last one we have line info for. + let slice = &src[begin..]; + match slice.find('\n') { + Some(e) => &slice[..e], + None => slice + } + }) + } + None => None + } + } + + pub fn record_multibyte_char(&self, pos: BytePos, bytes: usize) { + assert!(bytes >=2 && bytes <= 4); + let mbc = MultiByteChar { + pos: pos, + bytes: bytes, + }; + self.multibyte_chars.borrow_mut().push(mbc); + } + + pub fn is_real_file(&self) -> bool { + !(self.name.starts_with("<") && + self.name.ends_with(">")) + } + + pub fn is_imported(&self) -> bool { + self.src.is_none() + } + + pub fn byte_length(&self) -> u32 { + self.end_pos.0 - self.start_pos.0 + } + pub fn count_lines(&self) -> usize { + self.lines.borrow().len() + } + + /// Find the line containing the given position. The return value is the + /// index into the `lines` array of this FileMap, not the 1-based line + /// number. If the filemap is empty or the position is located before the + /// first line, None is returned. + pub fn lookup_line(&self, pos: BytePos) -> Option { + let lines = self.lines.borrow(); + if lines.len() == 0 { + return None; + } + + let line_index = lookup_line(&lines[..], pos); + assert!(line_index < lines.len() as isize); + if line_index >= 0 { + Some(line_index as usize) + } else { + None + } + } + + pub fn line_bounds(&self, line_index: usize) -> (BytePos, BytePos) { + if self.start_pos == self.end_pos { + return (self.start_pos, self.end_pos); + } + + let lines = self.lines.borrow(); + assert!(line_index < lines.len()); + if line_index == (lines.len() - 1) { + (lines[line_index], self.end_pos) + } else { + (lines[line_index], lines[line_index + 1]) + } + } +} + +// _____________________________________________________________________________ +// Pos, BytePos, CharPos +// + +pub trait Pos { + fn from_usize(n: usize) -> Self; + fn to_usize(&self) -> usize; +} + +/// A byte offset. Keep this small (currently 32-bits), as AST contains +/// a lot of them. +#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] +pub struct BytePos(pub u32); + +/// A character offset. Because of multibyte utf8 characters, a byte offset +/// is not equivalent to a character offset. The CodeMap will convert BytePos +/// values to CharPos values as necessary. +#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] +pub struct CharPos(pub usize); + +// FIXME: Lots of boilerplate in these impls, but so far my attempts to fix +// have been unsuccessful + +impl Pos for BytePos { + fn from_usize(n: usize) -> BytePos { BytePos(n as u32) } + fn to_usize(&self) -> usize { let BytePos(n) = *self; n as usize } +} + +impl Add for BytePos { + type Output = BytePos; + + fn add(self, rhs: BytePos) -> BytePos { + BytePos((self.to_usize() + rhs.to_usize()) as u32) + } +} + +impl Sub for BytePos { + type Output = BytePos; + + fn sub(self, rhs: BytePos) -> BytePos { + BytePos((self.to_usize() - rhs.to_usize()) as u32) + } +} + +impl Encodable for BytePos { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_u32(self.0) + } +} + +impl Decodable for BytePos { + fn decode(d: &mut D) -> Result { + Ok(BytePos(try!(d.read_u32()))) + } +} + +impl Pos for CharPos { + fn from_usize(n: usize) -> CharPos { CharPos(n) } + fn to_usize(&self) -> usize { let CharPos(n) = *self; n } +} + +impl Add for CharPos { + type Output = CharPos; + + fn add(self, rhs: CharPos) -> CharPos { + CharPos(self.to_usize() + rhs.to_usize()) + } +} + +impl Sub for CharPos { + type Output = CharPos; + + fn sub(self, rhs: CharPos) -> CharPos { + CharPos(self.to_usize() - rhs.to_usize()) + } +} + +// _____________________________________________________________________________ +// Loc, LocWithOpt, FileMapAndLine, FileMapAndBytePos +// + +/// A source code location used for error reporting +#[derive(Debug, Clone)] +pub struct Loc { + /// Information about the original source + pub file: Rc, + /// The (1-based) line number + pub line: usize, + /// The (0-based) column offset + pub col: CharPos +} + +/// A source code location used as the result of lookup_char_pos_adj +// Actually, *none* of the clients use the filename *or* file field; +// perhaps they should just be removed. +#[derive(Debug)] +pub struct LocWithOpt { + pub filename: FileName, + pub line: usize, + pub col: CharPos, + pub file: Option>, +} + +// used to be structural records. Better names, anyone? +#[derive(Debug)] +pub struct FileMapAndLine { pub fm: Rc, pub line: usize } +#[derive(Debug)] +pub struct FileMapAndBytePos { pub fm: Rc, pub pos: BytePos } + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct LineInfo { + /// Index of line, starting from 0. + pub line_index: usize, + + /// Column in line where span begins, starting from 0. + pub start_col: CharPos, + + /// Column in line where span ends, starting from 0, exclusive. + pub end_col: CharPos, +} + +pub struct FileLines { + pub file: Rc, + pub lines: Vec +} + +thread_local!(pub static SPAN_DEBUG: Cell fmt::Result> = + Cell::new(default_span_debug)); + +/* assuming that we're not in macro expansion */ +pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span { + Span {lo: lo, hi: hi, expn_id: NO_EXPANSION} +} + +pub struct MacroBacktrace { + /// span where macro was applied to generate this code + pub call_site: Span, + + /// name of macro that was applied (e.g., "foo!" or "#[derive(Eq)]") + pub macro_decl_name: String, + + /// span where macro was defined (if known) + pub def_site_span: Option, +} + +// _____________________________________________________________________________ +// SpanLinesError, SpanSnippetError, DistinctSources, MalformedCodemapPositions +// + +pub type FileLinesResult = Result; + +#[derive(Clone, PartialEq, Eq, Debug)] +pub enum SpanLinesError { + IllFormedSpan(Span), + DistinctSources(DistinctSources), +} + +#[derive(Clone, PartialEq, Eq, Debug)] +pub enum SpanSnippetError { + IllFormedSpan(Span), + DistinctSources(DistinctSources), + MalformedForCodemap(MalformedCodemapPositions), + SourceNotAvailable { filename: String } +} + +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct DistinctSources { + pub begin: (String, BytePos), + pub end: (String, BytePos) +} + +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct MalformedCodemapPositions { + pub name: String, + pub source_len: usize, + pub begin_pos: BytePos, + pub end_pos: BytePos +} + +// Given a slice of line start positions and a position, returns the index of +// the line the position is on. Returns -1 if the position is located before +// the first line. +fn lookup_line(lines: &[BytePos], pos: BytePos) -> isize { + match lines.binary_search(&pos) { + Ok(line) => line as isize, + Err(line) => line as isize - 1 + } +} + +#[cfg(test)] +mod tests { + use super::{lookup_line, BytePos}; + + #[test] + fn test_lookup_line() { + + let lines = &[BytePos(3), BytePos(17), BytePos(28)]; + + assert_eq!(lookup_line(lines, BytePos(0)), -1); + assert_eq!(lookup_line(lines, BytePos(3)), 0); + assert_eq!(lookup_line(lines, BytePos(4)), 0); + + assert_eq!(lookup_line(lines, BytePos(16)), 0); + assert_eq!(lookup_line(lines, BytePos(17)), 1); + assert_eq!(lookup_line(lines, BytePos(18)), 1); + + assert_eq!(lookup_line(lines, BytePos(28)), 2); + assert_eq!(lookup_line(lines, BytePos(29)), 2); + } +} diff --git a/third_party/rust/syntex_syntax/.cargo-checksum.json b/third_party/rust/syntex_syntax/.cargo-checksum.json new file mode 100644 index 000000000000..3e51c0513d41 --- /dev/null +++ b/third_party/rust/syntex_syntax/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"ed5a74058ed7922d5c0cd841003054b358dd1c1e16bd1854503a91b2af446317","src/abi.rs":"f2d06309ef3cfa116dccf961ca7caa4fecfa573825deca5e50c410fb986d50d5","src/ast.rs":"a45698b20d4ba82c34047fb8e68018830c0c1669e8a8ce86f9f6c68cdbdf17a1","src/attr.rs":"d481cd2b400992d6b07c7ea070a3629442051e8d8541d61a90feaa8c0de3f289","src/codemap.rs":"a2d47cb66467d3febb2c8842e7ae9a7934351b7bd9eeb21762e4f3f7db2b624e","src/config.rs":"6088f23b4ec32a9e1de38e3ffcacfa0c806cde94f1729b21f20b2b9983d83287","src/diagnostic_list.rs":"69240654107a937e38d030907323cfd7fa9542f5af5e1a77af03c47022ceb3ac","src/diagnostics/macros.rs":"81c36c9164ef238407540f7b026ae12117eb551630ae522c55a90ff9d01fff62","src/diagnostics/metadata.rs":"55570cb118892c25d98f1c120903caa88b212d83eee846594bf32d30245a00aa","src/diagnostics/plugin.rs":"920fbb6404b714318eb83f875fa1cd8cde765607c818116d3beeddc397d7ee97","src/entry.rs":"a75ebd163348ea408d4888677a9298e369b8b91a7a377a9eab5eae045128a035","src/ext/base.rs":"2bc79c0a30549d9ec2dd336023994ce5861bd5c3fdccf2ce38f4f0afaf694b8f","src/ext/build.rs":"ee1cc3ce999eae3767ad46b9207f21c6a5ac1ccc8fa172424347bebc7b012fd7","src/ext/decorator.rs":"d7cb4b233eb77988664cb80202aa2d3abab05b155da125b0f06449df996030af","src/ext/env.rs":"ecb9803589052bb4c7be18f813fdb934094ee939f07b608f880eb0ae6e160b2e","src/ext/expand.rs":"156860e7f79d37537f303caa1f52bca82118a53b5e728824c9f26057ef79b319","src/ext/hygiene.rs":"8766603dabbc52b3d5c8cffbf7781c1e365f7d5769faba307c759b296bfb82d8","src/ext/placeholders.rs":"50369498e363dd7fdf27cf2ca7def4d83dddd069a885de7fad875b10b880b096","src/ext/proc_macro_shim.rs":"263e9d6ea32041765e6de84c9b1e7d9cc62b634421935aa7b143ab8e4a53d9f1","src/ext/quote.rs":"c6a4a781cb1a9e2c3799c8a9ef32e2200ea9f6a1d4fd9270964c5f0aaedf7f34","src/ext/source_util.rs":"a3e85ed7af1d8b5e51d64aa3d97ca399787301aba8565ddb2aed3f8a8029896a","src/ext/tt/macro_parser.rs":"f63abcdabb24c948a37ec1b28d1b99f5f476b0a81f1b182a92851c1805fbf953","src/ext/tt/macro_rules.rs":"d9b54e9180f150356db296c2e7b999c06e456b36a300b77478bc0441277eadfa","src/ext/tt/transcribe.rs":"9b1a3248b38b205661502bb93397dfe2f15b1620d865fc4d5720dae6e5a1e7e3","src/feature_gate.rs":"b5ac00d9559b9c167325a8b9f3c3762aca4d7563c101fe774177eeca263aa38e","src/fold.rs":"e0ebe13db46836f5ea2fd07c7f5cc2c2ae2fe22798247e4ae2f0156acf3329a1","src/json.rs":"8c93c81515a127c8f780d27bded4968ed17f5b6fcc909319cac8d6b098e24bd9","src/lib.rs":"ae244be362e1c2990f1c7a925d72ad9f22f7c6e9a98f8aa1395132df6182932f","src/parse/attr.rs":"d7003d982c33480f966b4a567c0575add01577268774d250f74a369af2c94021","src/parse/classify.rs":"4e859c566e98bc11e7cc05f3b5f7f7a67caa6c53b8b10366eaf32e58bcfdc7ca","src/parse/common.rs":"f231aece27f62694d1146c5b40b24daf8e0e2e0152b159ca6693a8f583679f43","src/parse/lexer/comments.rs":"d6b1b4a723032a27d65128df823d8e97d1512dbbdb363dc7556c1abe01cce0fc","src/parse/lexer/mod.rs":"5db51fa14517a04aa5aa808fab94f2039c10fa7d8225ada85fd478db792c2124","src/parse/lexer/unicode_chars.rs":"92bdf17f281215b5b98e5d7ec8528142e7c04eaa7dba87c3b87b189a39161c63","src/parse/mod.rs":"107f49adb8ceafec6dc38feae4be083f0642fb7752b6bcd7d08f1034365a9604","src/parse/obsolete.rs":"cd83ee6f4a01086b736594638492969c6cec9522527fc576886186b9ad6cff03","src/parse/parser.rs":"beae4fbb842248e14798afc3b1d4f7a3eb632ff47c48505a77725036dfd8c2da","src/parse/token.rs":"9a9736da506848753ec755f40b1340ebd7114862d90518dc9f43c1c831f29987","src/print/pp.rs":"ef6752db3a36c7a614d43d767c788985a78f33e120b39a85e2156a576630afd4","src/print/pprust.rs":"fec3f7fa9f0bd24d466397952016fc70f70f1787c25a4a68509abe405ffa0c2b","src/ptr.rs":"2f0ecadd1d19b1e11bb067cee99ac6fff7c48dd33222ed67fb61f240e1ca820e","src/show_span.rs":"b55effca7a512b9705e793f092ca1b5af5842f5484ab61660a546b04dd10eb4f","src/std_inject.rs":"5a4b0f451f3dc23c2d6021b435f801bb2b95a485f0b53acb446535b4d4497034","src/str.rs":"023289c93979354cf6074e94327e5c71b5144e0d12042304c0c91b9dd974b26f","src/symbol.rs":"fdc04df4a729a17bc07860635e0d2c0206dc5c6eed19cad587bc6d1a0d74c69a","src/test.rs":"a8eef2643a2b30204240606d4c1673478c38407b1111a5794cce4e9b7954cd84","src/test_snippet.rs":"893a02a5e725286750bf1d0851cbe38edf746fecf18dbfe5e3dd95e939f50bfd","src/tokenstream.rs":"abc6d96fb98b2577780b9d1290ab830a36a52f8f3196736f32e39036745c030e","src/util/lev_distance.rs":"323704c761cd216568f70b2131c6010a5a68dc978a24dc3b2dcf17a4361599c0","src/util/move_map.rs":"8bf1a3546325872892ca5d4f04771af01566913d84fa678df7c862fda75fa16c","src/util/node_count.rs":"54268f87eb4d692b11362f1ef2021e8c7c63aa14f383711780d76216eeb5ee0f","src/util/parser.rs":"0aeb1cc7cbec319a8955e696cf46820ab9af7c89691dea2e2285ebb8a299a67d","src/util/parser_testing.rs":"cc500701e79628503dce4af4e792407460247e5caf5f781b83a74b157c1c79fa","src/util/small_vector.rs":"5f3de1a28196c60ff2efdbf0f61056de30aafc64b827531c3bb735b0bebed52f","src/util/thin_vec.rs":"eda6e0ab93dce5e45bb7a2ddeae9120fdb0df3c1d6a5d4e0c8ca3648d404177e","src/visit.rs":"c9061c24cf819373d0c3fac0671159ef3272054d2d1dd0ae2378eb915eb6d456"},"package":"dc960085bae44591e22d01f6c0e82a8aec832f8659aca556cdf8ecbdac2bb47b"} \ No newline at end of file diff --git a/third_party/rust/syntex_syntax/.cargo-ok b/third_party/rust/syntex_syntax/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/syntex_syntax/Cargo.toml b/third_party/rust/syntex_syntax/Cargo.toml new file mode 100644 index 000000000000..0ea6d8674cb5 --- /dev/null +++ b/third_party/rust/syntex_syntax/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "syntex_syntax" +version = "0.54.0" +authors = [ "erick.tryzelaar@gmail.com" ] +license = "MIT/Apache-2.0" +description = "Export of libsyntax for code generation" +repository = "https://github.com/serde-rs/syntex" +include = ["Cargo.toml", "src/**/*.rs"] + +[dependencies] +bitflags = "^0.7.0" +libc = "^0.2.13" +log = "^0.3.6" +rustc-serialize = "^0.3.16" +syntex_errors = { version = "^0.54.0", path = "../syntex_errors" } +syntex_pos = { version = "^0.54.0", path = "../syntex_pos" } +term = "^0.4.4" +unicode-xid = "^0.0.4" diff --git a/third_party/rust/syntex_syntax/src/abi.rs b/third_party/rust/syntex_syntax/src/abi.rs new file mode 100644 index 000000000000..75554f20effe --- /dev/null +++ b/third_party/rust/syntex_syntax/src/abi.rs @@ -0,0 +1,178 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::fmt; + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +#[allow(non_camel_case_types)] +pub enum Os { + Windows, + Macos, + Linux, + Android, + Freebsd, + iOS, + Dragonfly, + Bitrig, + Netbsd, + Openbsd, + NaCl, + Haiku, + Solaris, +} + +#[derive(PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)] +pub enum Abi { + // NB: This ordering MUST match the AbiDatas array below. + // (This is ensured by the test indices_are_correct().) + + // Single platform ABIs + Cdecl, + Stdcall, + Fastcall, + Vectorcall, + Aapcs, + Win64, + SysV64, + PtxKernel, + + // Multiplatform / generic ABIs + Rust, + C, + System, + RustIntrinsic, + RustCall, + PlatformIntrinsic, + Unadjusted +} + +#[allow(non_camel_case_types)] +#[derive(Copy, Clone, PartialEq, Debug)] +pub enum Architecture { + X86, + X86_64, + Arm, + Mips, + Mipsel +} + +#[derive(Copy, Clone)] +pub struct AbiData { + abi: Abi, + + /// Name of this ABI as we like it called. + name: &'static str, + + /// A generic ABI is supported on all platforms. + generic: bool, +} + +#[allow(non_upper_case_globals)] +const AbiDatas: &'static [AbiData] = &[ + // Platform-specific ABIs + AbiData {abi: Abi::Cdecl, name: "cdecl", generic: false }, + AbiData {abi: Abi::Stdcall, name: "stdcall", generic: false }, + AbiData {abi: Abi::Fastcall, name: "fastcall", generic: false }, + AbiData {abi: Abi::Vectorcall, name: "vectorcall", generic: false}, + AbiData {abi: Abi::Aapcs, name: "aapcs", generic: false }, + AbiData {abi: Abi::Win64, name: "win64", generic: false }, + AbiData {abi: Abi::SysV64, name: "sysv64", generic: false }, + AbiData {abi: Abi::PtxKernel, name: "ptx-kernel", generic: false }, + + // Cross-platform ABIs + AbiData {abi: Abi::Rust, name: "Rust", generic: true }, + AbiData {abi: Abi::C, name: "C", generic: true }, + AbiData {abi: Abi::System, name: "system", generic: true }, + AbiData {abi: Abi::RustIntrinsic, name: "rust-intrinsic", generic: true }, + AbiData {abi: Abi::RustCall, name: "rust-call", generic: true }, + AbiData {abi: Abi::PlatformIntrinsic, name: "platform-intrinsic", generic: true }, + AbiData {abi: Abi::Unadjusted, name: "unadjusted", generic: true }, +]; + +/// Returns the ABI with the given name (if any). +pub fn lookup(name: &str) -> Option { + AbiDatas.iter().find(|abi_data| name == abi_data.name).map(|&x| x.abi) +} + +pub fn all_names() -> Vec<&'static str> { + AbiDatas.iter().map(|d| d.name).collect() +} + +impl Abi { + #[inline] + pub fn index(&self) -> usize { + *self as usize + } + + #[inline] + pub fn data(&self) -> &'static AbiData { + &AbiDatas[self.index()] + } + + pub fn name(&self) -> &'static str { + self.data().name + } + + pub fn generic(&self) -> bool { + self.data().generic + } +} + +impl fmt::Display for Abi { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "\"{}\"", self.name()) + } +} + +impl fmt::Display for Os { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Os::Linux => "linux".fmt(f), + Os::Windows => "windows".fmt(f), + Os::Macos => "macos".fmt(f), + Os::iOS => "ios".fmt(f), + Os::Android => "android".fmt(f), + Os::Freebsd => "freebsd".fmt(f), + Os::Dragonfly => "dragonfly".fmt(f), + Os::Bitrig => "bitrig".fmt(f), + Os::Netbsd => "netbsd".fmt(f), + Os::Openbsd => "openbsd".fmt(f), + Os::NaCl => "nacl".fmt(f), + Os::Haiku => "haiku".fmt(f), + Os::Solaris => "solaris".fmt(f), + } + } +} + +#[allow(non_snake_case)] +#[test] +fn lookup_Rust() { + let abi = lookup("Rust"); + assert!(abi.is_some() && abi.unwrap().data().name == "Rust"); +} + +#[test] +fn lookup_cdecl() { + let abi = lookup("cdecl"); + assert!(abi.is_some() && abi.unwrap().data().name == "cdecl"); +} + +#[test] +fn lookup_baz() { + let abi = lookup("baz"); + assert!(abi.is_none()); +} + +#[test] +fn indices_are_correct() { + for (i, abi_data) in AbiDatas.iter().enumerate() { + assert_eq!(i, abi_data.abi.index()); + } +} diff --git a/third_party/rust/syntex_syntax/src/ast.rs b/third_party/rust/syntex_syntax/src/ast.rs new file mode 100644 index 000000000000..c5f1f45e6075 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ast.rs @@ -0,0 +1,1924 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// The Rust abstract syntax tree. + +pub use self::TyParamBound::*; +pub use self::UnsafeSource::*; +pub use self::ViewPath_::*; +pub use self::PathParameters::*; +pub use symbol::Symbol as Name; +pub use util::ThinVec; + +use syntax_pos::{mk_sp, Span, DUMMY_SP, ExpnId}; +use codemap::{respan, Spanned}; +use abi::Abi; +use ext::hygiene::SyntaxContext; +use print::pprust; +use ptr::P; +use symbol::{Symbol, keywords}; +use tokenstream::{TokenTree}; + +use std::collections::HashSet; +use std::fmt; +use std::rc::Rc; +use std::u32; + +use serialize::{self, Encodable, Decodable, Encoder, Decoder}; + +/// An identifier contains a Name (index into the interner +/// table) and a SyntaxContext to track renaming and +/// macro expansion per Flatt et al., "Macros That Work Together" +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub struct Ident { + pub name: Symbol, + pub ctxt: SyntaxContext +} + +impl Ident { + pub fn with_empty_ctxt(name: Name) -> Ident { + Ident { name: name, ctxt: SyntaxContext::empty() } + } + + /// Maps a string to an identifier with an empty syntax context. + pub fn from_str(s: &str) -> Ident { + Ident::with_empty_ctxt(Symbol::intern(s)) + } + + pub fn unhygienize(&self) -> Ident { + Ident { name: self.name, ctxt: SyntaxContext::empty() } + } +} + +impl fmt::Debug for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}{:?}", self.name, self.ctxt) + } +} + +impl fmt::Display for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.name, f) + } +} + +impl Encodable for Ident { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + self.name.encode(s) + } +} + +impl Decodable for Ident { + fn decode(d: &mut D) -> Result { + Ok(Ident::with_empty_ctxt(try!(Name::decode(d)))) + } +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +pub struct Lifetime { + pub id: NodeId, + pub span: Span, + pub name: Name +} + +impl fmt::Debug for Lifetime { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "lifetime({}: {})", self.id, pprust::lifetime_to_string(self)) + } +} + +/// A lifetime definition, e.g. `'a: 'b+'c+'d` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct LifetimeDef { + pub attrs: ThinVec, + pub lifetime: Lifetime, + pub bounds: Vec +} + +/// A "Path" is essentially Rust's notion of a name. +/// +/// It's represented as a sequence of identifiers, +/// along with a bunch of supporting information. +/// +/// E.g. `std::cmp::PartialEq` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +pub struct Path { + pub span: Span, + /// The segments in the path: the things separated by `::`. + /// Global paths begin with `keywords::CrateRoot`. + pub segments: Vec, +} + +impl fmt::Debug for Path { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "path({})", pprust::path_to_string(self)) + } +} + +impl fmt::Display for Path { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", pprust::path_to_string(self)) + } +} + +impl Path { + // convert a span and an identifier to the corresponding + // 1-segment path + pub fn from_ident(s: Span, identifier: Ident) -> Path { + Path { + span: s, + segments: vec![identifier.into()], + } + } + + pub fn default_to_global(mut self) -> Path { + let name = self.segments[0].identifier.name; + if !self.is_global() && name != "$crate" && + name != keywords::SelfValue.name() && name != keywords::Super.name() { + self.segments.insert(0, PathSegment::crate_root()); + } + self + } + + pub fn is_global(&self) -> bool { + !self.segments.is_empty() && self.segments[0].identifier.name == keywords::CrateRoot.name() + } +} + +/// A segment of a path: an identifier, an optional lifetime, and a set of types. +/// +/// E.g. `std`, `String` or `Box` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct PathSegment { + /// The identifier portion of this path segment. + pub identifier: Ident, + + /// Type/lifetime parameters attached to this path. They come in + /// two flavors: `Path` and `Path(A,B) -> C`. Note that + /// this is more than just simple syntactic sugar; the use of + /// parens affects the region binding rules, so we preserve the + /// distinction. + /// The `Option>` wrapper is purely a size optimization; + /// `None` is used to represent both `Path` and `Path<>`. + pub parameters: Option>, +} + +impl From for PathSegment { + fn from(id: Ident) -> Self { + PathSegment { identifier: id, parameters: None } + } +} + +impl PathSegment { + pub fn crate_root() -> Self { + PathSegment { + identifier: keywords::CrateRoot.ident(), + parameters: None, + } + } +} + +/// Parameters of a path segment. +/// +/// E.g. `` as in `Foo` or `(A, B)` as in `Foo(A, B)` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum PathParameters { + /// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>` + AngleBracketed(AngleBracketedParameterData), + /// The `(A,B)` and `C` in `Foo(A,B) -> C` + Parenthesized(ParenthesizedParameterData), +} + +/// A path like `Foo<'a, T>` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Default)] +pub struct AngleBracketedParameterData { + /// The lifetime parameters for this path segment. + pub lifetimes: Vec, + /// The type parameters for this path segment, if present. + pub types: P<[P]>, + /// Bindings (equality constraints) on associated types, if present. + /// + /// E.g., `Foo`. + pub bindings: P<[TypeBinding]>, +} + +impl Into>> for AngleBracketedParameterData { + fn into(self) -> Option> { + let empty = self.lifetimes.is_empty() && self.types.is_empty() && self.bindings.is_empty(); + if empty { None } else { Some(P(PathParameters::AngleBracketed(self))) } + } +} + +/// A path like `Foo(A,B) -> C` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct ParenthesizedParameterData { + /// Overall span + pub span: Span, + + /// `(A,B)` + pub inputs: Vec>, + + /// `C` + pub output: Option>, +} + +#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Debug)] +pub struct NodeId(u32); + +impl NodeId { + pub fn new(x: usize) -> NodeId { + assert!(x < (u32::MAX as usize)); + NodeId(x as u32) + } + + pub fn from_u32(x: u32) -> NodeId { + NodeId(x) + } + + pub fn as_usize(&self) -> usize { + self.0 as usize + } + + pub fn as_u32(&self) -> u32 { + self.0 + } +} + +impl fmt::Display for NodeId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.0, f) + } +} + +impl serialize::Encodable for NodeId { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_u32(self.0) + } +} + +impl serialize::Decodable for NodeId { + fn decode(d: &mut D) -> Result { + d.read_u32().map(NodeId) + } +} + +/// Node id used to represent the root of the crate. +pub const CRATE_NODE_ID: NodeId = NodeId(0); + +/// When parsing and doing expansions, we initially give all AST nodes this AST +/// node value. Then later, in the renumber pass, we renumber them to have +/// small, positive ids. +pub const DUMMY_NODE_ID: NodeId = NodeId(!0); + +/// The AST represents all type param bounds as types. +/// typeck::collect::compute_bounds matches these against +/// the "special" built-in traits (see middle::lang_items) and +/// detects Copy, Send and Sync. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum TyParamBound { + TraitTyParamBound(PolyTraitRef, TraitBoundModifier), + RegionTyParamBound(Lifetime) +} + +/// A modifier on a bound, currently this is only used for `?Sized`, where the +/// modifier is `Maybe`. Negative bounds should also be handled here. +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum TraitBoundModifier { + None, + Maybe, +} + +pub type TyParamBounds = P<[TyParamBound]>; + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct TyParam { + pub attrs: ThinVec, + pub ident: Ident, + pub id: NodeId, + pub bounds: TyParamBounds, + pub default: Option>, + pub span: Span, +} + +/// Represents lifetimes and type parameters attached to a declaration +/// of a function, enum, trait, etc. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Generics { + pub lifetimes: Vec, + pub ty_params: P<[TyParam]>, + pub where_clause: WhereClause, + pub span: Span, +} + +impl Generics { + pub fn is_lt_parameterized(&self) -> bool { + !self.lifetimes.is_empty() + } + pub fn is_type_parameterized(&self) -> bool { + !self.ty_params.is_empty() + } + pub fn is_parameterized(&self) -> bool { + self.is_lt_parameterized() || self.is_type_parameterized() + } + pub fn span_for_name(&self, name: &str) -> Option { + for t in &self.ty_params { + if t.ident.name == name { + return Some(t.span); + } + } + None + } +} + +impl Default for Generics { + /// Creates an instance of `Generics`. + fn default() -> Generics { + Generics { + lifetimes: Vec::new(), + ty_params: P::new(), + where_clause: WhereClause { + id: DUMMY_NODE_ID, + predicates: Vec::new(), + }, + span: DUMMY_SP, + } + } +} + +/// A `where` clause in a definition +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct WhereClause { + pub id: NodeId, + pub predicates: Vec, +} + +/// A single predicate in a `where` clause +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum WherePredicate { + /// A type binding, e.g. `for<'c> Foo: Send+Clone+'c` + BoundPredicate(WhereBoundPredicate), + /// A lifetime predicate, e.g. `'a: 'b+'c` + RegionPredicate(WhereRegionPredicate), + /// An equality predicate (unsupported) + EqPredicate(WhereEqPredicate), +} + +/// A type bound. +/// +/// E.g. `for<'c> Foo: Send+Clone+'c` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct WhereBoundPredicate { + pub span: Span, + /// Any lifetimes from a `for` binding + pub bound_lifetimes: Vec, + /// The type being bounded + pub bounded_ty: P, + /// Trait and lifetime bounds (`Clone+Send+'static`) + pub bounds: TyParamBounds, +} + +/// A lifetime predicate. +/// +/// E.g. `'a: 'b+'c` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct WhereRegionPredicate { + pub span: Span, + pub lifetime: Lifetime, + pub bounds: Vec, +} + +/// An equality predicate (unsupported). +/// +/// E.g. `T=int` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct WhereEqPredicate { + pub id: NodeId, + pub span: Span, + pub path: Path, + pub ty: P, +} + +/// The set of MetaItems that define the compilation environment of the crate, +/// used to drive conditional compilation +pub type CrateConfig = HashSet<(Name, Option)>; + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Crate { + pub module: Mod, + pub attrs: Vec, + pub span: Span, + pub exported_macros: Vec, +} + +/// A spanned compile-time attribute list item. +pub type NestedMetaItem = Spanned; + +/// Possible values inside of compile-time attribute lists. +/// +/// E.g. the '..' in `#[name(..)]`. +#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Debug, PartialEq)] +pub enum NestedMetaItemKind { + /// A full MetaItem, for recursive meta items. + MetaItem(MetaItem), + /// A literal. + /// + /// E.g. "foo", 64, true + Literal(Lit), +} + +/// A spanned compile-time attribute item. +/// +/// E.g. `#[test]`, `#[derive(..)]` or `#[feature = "foo"]` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct MetaItem { + pub name: Name, + pub node: MetaItemKind, + pub span: Span, +} + +/// A compile-time attribute item. +/// +/// E.g. `#[test]`, `#[derive(..)]` or `#[feature = "foo"]` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum MetaItemKind { + /// Word meta item. + /// + /// E.g. `test` as in `#[test]` + Word, + /// List meta item. + /// + /// E.g. `derive(..)` as in `#[derive(..)]` + List(Vec), + /// Name value meta item. + /// + /// E.g. `feature = "foo"` as in `#[feature = "foo"]` + NameValue(Lit) +} + +/// A Block (`{ .. }`). +/// +/// E.g. `{ .. }` as in `fn foo() { .. }` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Block { + /// Statements in a block + pub stmts: Vec, + pub id: NodeId, + /// Distinguishes between `unsafe { ... }` and `{ ... }` + pub rules: BlockCheckMode, + pub span: Span, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +pub struct Pat { + pub id: NodeId, + pub node: PatKind, + pub span: Span, +} + +impl fmt::Debug for Pat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "pat({}: {})", self.id, pprust::pat_to_string(self)) + } +} + +impl Pat { + pub fn walk(&self, it: &mut F) -> bool + where F: FnMut(&Pat) -> bool + { + if !it(self) { + return false; + } + + match self.node { + PatKind::Ident(_, _, Some(ref p)) => p.walk(it), + PatKind::Struct(_, ref fields, _) => { + fields.iter().all(|field| field.node.pat.walk(it)) + } + PatKind::TupleStruct(_, ref s, _) | PatKind::Tuple(ref s, _) => { + s.iter().all(|p| p.walk(it)) + } + PatKind::Box(ref s) | PatKind::Ref(ref s, _) => { + s.walk(it) + } + PatKind::Slice(ref before, ref slice, ref after) => { + before.iter().all(|p| p.walk(it)) && + slice.iter().all(|p| p.walk(it)) && + after.iter().all(|p| p.walk(it)) + } + PatKind::Wild | + PatKind::Lit(_) | + PatKind::Range(..) | + PatKind::Ident(..) | + PatKind::Path(..) | + PatKind::Mac(_) => { + true + } + } + } +} + +/// A single field in a struct pattern +/// +/// Patterns like the fields of Foo `{ x, ref y, ref mut z }` +/// are treated the same as` x: x, y: ref y, z: ref mut z`, +/// except is_shorthand is true +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct FieldPat { + /// The identifier for the field + pub ident: Ident, + /// The pattern the field is destructured to + pub pat: P, + pub is_shorthand: bool, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum BindingMode { + ByRef(Mutability), + ByValue(Mutability), +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum PatKind { + /// Represents a wildcard pattern (`_`) + Wild, + + /// A `PatKind::Ident` may either be a new bound variable (`ref mut binding @ OPT_SUBPATTERN`), + /// or a unit struct/variant pattern, or a const pattern (in the last two cases the third + /// field must be `None`). Disambiguation cannot be done with parser alone, so it happens + /// during name resolution. + Ident(BindingMode, SpannedIdent, Option>), + + /// A struct or struct variant pattern, e.g. `Variant {x, y, ..}`. + /// The `bool` is `true` in the presence of a `..`. + Struct(Path, Vec>, bool), + + /// A tuple struct/variant pattern `Variant(x, y, .., z)`. + /// If the `..` pattern fragment is present, then `Option` denotes its position. + /// 0 <= position <= subpats.len() + TupleStruct(Path, Vec>, Option), + + /// A possibly qualified path pattern. + /// Unquailfied path patterns `A::B::C` can legally refer to variants, structs, constants + /// or associated constants. Quailfied path patterns `::B::C`/`::B::C` can + /// only legally refer to associated constants. + Path(Option, Path), + + /// A tuple pattern `(a, b)`. + /// If the `..` pattern fragment is present, then `Option` denotes its position. + /// 0 <= position <= subpats.len() + Tuple(Vec>, Option), + /// A `box` pattern + Box(P), + /// A reference pattern, e.g. `&mut (a, b)` + Ref(P, Mutability), + /// A literal + Lit(P), + /// A range pattern, e.g. `1...2` + Range(P, P), + /// `[a, b, ..i, y, z]` is represented as: + /// `PatKind::Slice(box [a, b], Some(i), box [y, z])` + Slice(Vec>, Option>, Vec>), + /// A macro pattern; pre-expansion + Mac(Mac), +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum Mutability { + Mutable, + Immutable, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum BinOpKind { + /// The `+` operator (addition) + Add, + /// The `-` operator (subtraction) + Sub, + /// The `*` operator (multiplication) + Mul, + /// The `/` operator (division) + Div, + /// The `%` operator (modulus) + Rem, + /// The `&&` operator (logical and) + And, + /// The `||` operator (logical or) + Or, + /// The `^` operator (bitwise xor) + BitXor, + /// The `&` operator (bitwise and) + BitAnd, + /// The `|` operator (bitwise or) + BitOr, + /// The `<<` operator (shift left) + Shl, + /// The `>>` operator (shift right) + Shr, + /// The `==` operator (equality) + Eq, + /// The `<` operator (less than) + Lt, + /// The `<=` operator (less than or equal to) + Le, + /// The `!=` operator (not equal to) + Ne, + /// The `>=` operator (greater than or equal to) + Ge, + /// The `>` operator (greater than) + Gt, +} + +impl BinOpKind { + pub fn to_string(&self) -> &'static str { + use self::BinOpKind::*; + match *self { + Add => "+", + Sub => "-", + Mul => "*", + Div => "/", + Rem => "%", + And => "&&", + Or => "||", + BitXor => "^", + BitAnd => "&", + BitOr => "|", + Shl => "<<", + Shr => ">>", + Eq => "==", + Lt => "<", + Le => "<=", + Ne => "!=", + Ge => ">=", + Gt => ">", + } + } + pub fn lazy(&self) -> bool { + match *self { + BinOpKind::And | BinOpKind::Or => true, + _ => false + } + } + + pub fn is_shift(&self) -> bool { + match *self { + BinOpKind::Shl | BinOpKind::Shr => true, + _ => false + } + } + pub fn is_comparison(&self) -> bool { + use self::BinOpKind::*; + match *self { + Eq | Lt | Le | Ne | Gt | Ge => + true, + And | Or | Add | Sub | Mul | Div | Rem | + BitXor | BitAnd | BitOr | Shl | Shr => + false, + } + } + /// Returns `true` if the binary operator takes its arguments by value + pub fn is_by_value(&self) -> bool { + !self.is_comparison() + } +} + +pub type BinOp = Spanned; + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum UnOp { + /// The `*` operator for dereferencing + Deref, + /// The `!` operator for logical inversion + Not, + /// The `-` operator for negation + Neg, +} + +impl UnOp { + /// Returns `true` if the unary operator takes its argument by value + pub fn is_by_value(u: UnOp) -> bool { + match u { + UnOp::Neg | UnOp::Not => true, + _ => false, + } + } + + pub fn to_string(op: UnOp) -> &'static str { + match op { + UnOp::Deref => "*", + UnOp::Not => "!", + UnOp::Neg => "-", + } + } +} + +/// A statement +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +pub struct Stmt { + pub id: NodeId, + pub node: StmtKind, + pub span: Span, +} + +impl Stmt { + pub fn add_trailing_semicolon(mut self) -> Self { + self.node = match self.node { + StmtKind::Expr(expr) => StmtKind::Semi(expr), + StmtKind::Mac(mac) => StmtKind::Mac(mac.map(|(mac, _style, attrs)| { + (mac, MacStmtStyle::Semicolon, attrs) + })), + node @ _ => node, + }; + self + } +} + +impl fmt::Debug for Stmt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "stmt({}: {})", self.id.to_string(), pprust::stmt_to_string(self)) + } +} + + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +pub enum StmtKind { + /// A local (let) binding. + Local(P), + + /// An item definition. + Item(P), + + /// Expr without trailing semi-colon. + Expr(P), + + Semi(P), + + Mac(P<(Mac, MacStmtStyle, ThinVec)>), +} + +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum MacStmtStyle { + /// The macro statement had a trailing semicolon, e.g. `foo! { ... };` + /// `foo!(...);`, `foo![...];` + Semicolon, + /// The macro statement had braces; e.g. foo! { ... } + Braces, + /// The macro statement had parentheses or brackets and no semicolon; e.g. + /// `foo!(...)`. All of these will end up being converted into macro + /// expressions. + NoBraces, +} + +// FIXME (pending discussion of #1697, #2178...): local should really be +// a refinement on pat. +/// Local represents a `let` statement, e.g., `let : = ;` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Local { + pub pat: P, + pub ty: Option>, + /// Initializer expression to set the value, if any + pub init: Option>, + pub id: NodeId, + pub span: Span, + pub attrs: ThinVec, +} + +/// An arm of a 'match'. +/// +/// E.g. `0...10 => { println!("match!") }` as in +/// +/// ```rust,ignore +/// match n { +/// 0...10 => { println!("match!") }, +/// // .. +/// } +/// ``` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Arm { + pub attrs: Vec, + pub pats: Vec>, + pub guard: Option>, + pub body: P, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Field { + pub ident: SpannedIdent, + pub expr: P, + pub span: Span, + pub is_shorthand: bool, +} + +pub type SpannedIdent = Spanned; + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum BlockCheckMode { + Default, + Unsafe(UnsafeSource), +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum UnsafeSource { + CompilerGenerated, + UserProvided, +} + +/// An expression +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash,)] +pub struct Expr { + pub id: NodeId, + pub node: ExprKind, + pub span: Span, + pub attrs: ThinVec +} + +impl fmt::Debug for Expr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "expr({}: {})", self.id, pprust::expr_to_string(self)) + } +} + +/// Limit types of a range (inclusive or exclusive) +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum RangeLimits { + /// Inclusive at the beginning, exclusive at the end + HalfOpen, + /// Inclusive at the beginning and end + Closed, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum ExprKind { + /// A `box x` expression. + Box(P), + /// First expr is the place; second expr is the value. + InPlace(P, P), + /// An array (`[a, b, c, d]`) + Vec(Vec>), + /// A function call + /// + /// The first field resolves to the function itself, + /// and the second field is the list of arguments + Call(P, Vec>), + /// A method call (`x.foo::(a, b, c, d)`) + /// + /// The `SpannedIdent` is the identifier for the method name. + /// The vector of `Ty`s are the ascripted type parameters for the method + /// (within the angle brackets). + /// + /// The first element of the vector of `Expr`s is the expression that evaluates + /// to the object on which the method is being called on (the receiver), + /// and the remaining elements are the rest of the arguments. + /// + /// Thus, `x.foo::(a, b, c, d)` is represented as + /// `ExprKind::MethodCall(foo, [Bar, Baz], [x, a, b, c, d])`. + MethodCall(SpannedIdent, Vec>, Vec>), + /// A tuple (`(a, b, c ,d)`) + Tup(Vec>), + /// A binary operation (For example: `a + b`, `a * b`) + Binary(BinOp, P, P), + /// A unary operation (For example: `!x`, `*x`) + Unary(UnOp, P), + /// A literal (For example: `1`, `"foo"`) + Lit(P), + /// A cast (`foo as f64`) + Cast(P, P), + Type(P, P), + /// An `if` block, with an optional else block + /// + /// `if expr { block } else { expr }` + If(P, P, Option>), + /// An `if let` expression with an optional else block + /// + /// `if let pat = expr { block } else { expr }` + /// + /// This is desugared to a `match` expression. + IfLet(P, P, P, Option>), + /// A while loop, with an optional label + /// + /// `'label: while expr { block }` + While(P, P, Option), + /// A while-let loop, with an optional label + /// + /// `'label: while let pat = expr { block }` + /// + /// This is desugared to a combination of `loop` and `match` expressions. + WhileLet(P, P, P, Option), + /// A for loop, with an optional label + /// + /// `'label: for pat in expr { block }` + /// + /// This is desugared to a combination of `loop` and `match` expressions. + ForLoop(P, P, P, Option), + /// Conditionless loop (can be exited with break, continue, or return) + /// + /// `'label: loop { block }` + Loop(P, Option), + /// A `match` block. + Match(P, Vec), + /// A closure (for example, `move |a, b, c| a + b + c`) + /// + /// The final span is the span of the argument block `|...|` + Closure(CaptureBy, P, P, Span), + /// A block (`{ ... }`) + Block(P), + + /// An assignment (`a = foo()`) + Assign(P, P), + /// An assignment with an operator + /// + /// For example, `a += 1`. + AssignOp(BinOp, P, P), + /// Access of a named struct field (`obj.foo`) + Field(P, SpannedIdent), + /// Access of an unnamed field of a struct or tuple-struct + /// + /// For example, `foo.0`. + TupField(P, Spanned), + /// An indexing operation (`foo[2]`) + Index(P, P), + /// A range (`1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`) + Range(Option>, Option>, RangeLimits), + + /// Variable reference, possibly containing `::` and/or type + /// parameters, e.g. foo::bar::. + /// + /// Optionally "qualified", + /// E.g. ` as SomeTrait>::SomeType`. + Path(Option, Path), + + /// A referencing operation (`&a` or `&mut a`) + AddrOf(Mutability, P), + /// A `break`, with an optional label to break, and an optional expression + Break(Option, Option>), + /// A `continue`, with an optional label + Continue(Option), + /// A `return`, with an optional value to be returned + Ret(Option>), + + /// Output of the `asm!()` macro + InlineAsm(P), + + /// A macro invocation; pre-expansion + Mac(Mac), + + /// A struct literal expression. + /// + /// For example, `Foo {x: 1, y: 2}`, or + /// `Foo {x: 1, .. base}`, where `base` is the `Option`. + Struct(Path, Vec, Option>), + + /// An array literal constructed from one repeated element. + /// + /// For example, `[1; 5]`. The first expression is the element + /// to be repeated; the second is the number of times to repeat it. + Repeat(P, P), + + /// No-op: used solely so we can pretty-print faithfully + Paren(P), + + /// `expr?` + Try(P), +} + +/// The explicit Self type in a "qualified path". The actual +/// path, including the trait and the associated item, is stored +/// separately. `position` represents the index of the associated +/// item qualified with this Self type. +/// +/// ```rust,ignore +/// as a::b::Trait>::AssociatedItem +/// ^~~~~ ~~~~~~~~~~~~~~^ +/// ty position = 3 +/// +/// >::AssociatedItem +/// ^~~~~ ^ +/// ty position = 0 +/// ``` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct QSelf { + pub ty: P, + pub position: usize +} + +/// A capture clause +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum CaptureBy { + Value, + Ref, +} + +pub type Mac = Spanned; + +/// Represents a macro invocation. The Path indicates which macro +/// is being invoked, and the vector of token-trees contains the source +/// of the macro invocation. +/// +/// NB: the additional ident for a macro_rules-style macro is actually +/// stored in the enclosing item. Oog. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Mac_ { + pub path: Path, + pub tts: Vec, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum StrStyle { + /// A regular string, like `"foo"` + Cooked, + /// A raw string, like `r##"foo"##` + /// + /// The uint is the number of `#` symbols used + Raw(usize) +} + +/// A literal +pub type Lit = Spanned; + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum LitIntType { + Signed(IntTy), + Unsigned(UintTy), + Unsuffixed, +} + +/// Literal kind. +/// +/// E.g. `"foo"`, `42`, `12.34` or `bool` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum LitKind { + /// A string literal (`"foo"`) + Str(Symbol, StrStyle), + /// A byte string (`b"foo"`) + ByteStr(Rc>), + /// A byte char (`b'f'`) + Byte(u8), + /// A character literal (`'a'`) + Char(char), + /// An integer literal (`1`) + Int(u64, LitIntType), + /// A float literal (`1f64` or `1E10f64`) + Float(Symbol, FloatTy), + /// A float literal without a suffix (`1.0 or 1.0E10`) + FloatUnsuffixed(Symbol), + /// A boolean literal + Bool(bool), +} + +impl LitKind { + /// Returns true if this literal is a string and false otherwise. + pub fn is_str(&self) -> bool { + match *self { + LitKind::Str(..) => true, + _ => false, + } + } + + /// Returns true if this literal has no suffix. Note: this will return true + /// for literals with prefixes such as raw strings and byte strings. + pub fn is_unsuffixed(&self) -> bool { + match *self { + // unsuffixed variants + LitKind::Str(..) => true, + LitKind::ByteStr(..) => true, + LitKind::Byte(..) => true, + LitKind::Char(..) => true, + LitKind::Int(_, LitIntType::Unsuffixed) => true, + LitKind::FloatUnsuffixed(..) => true, + LitKind::Bool(..) => true, + // suffixed variants + LitKind::Int(_, LitIntType::Signed(..)) => false, + LitKind::Int(_, LitIntType::Unsigned(..)) => false, + LitKind::Float(..) => false, + } + } + + /// Returns true if this literal has a suffix. + pub fn is_suffixed(&self) -> bool { + !self.is_unsuffixed() + } +} + +// NB: If you change this, you'll probably want to change the corresponding +// type structure in middle/ty.rs as well. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct MutTy { + pub ty: P, + pub mutbl: Mutability, +} + +/// Represents a method's signature in a trait declaration, +/// or in an implementation. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct MethodSig { + pub unsafety: Unsafety, + pub constness: Spanned, + pub abi: Abi, + pub decl: P, + pub generics: Generics, +} + +/// Represents an item declaration within a trait declaration, +/// possibly including a default implementation. A trait item is +/// either required (meaning it doesn't have an implementation, just a +/// signature) or provided (meaning it has a default implementation). +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct TraitItem { + pub id: NodeId, + pub ident: Ident, + pub attrs: Vec, + pub node: TraitItemKind, + pub span: Span, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum TraitItemKind { + Const(P, Option>), + Method(MethodSig, Option>), + Type(TyParamBounds, Option>), + Macro(Mac), +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct ImplItem { + pub id: NodeId, + pub ident: Ident, + pub vis: Visibility, + pub defaultness: Defaultness, + pub attrs: Vec, + pub node: ImplItemKind, + pub span: Span, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum ImplItemKind { + Const(P, P), + Method(MethodSig, P), + Type(P), + Macro(Mac), +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +pub enum IntTy { + Is, + I8, + I16, + I32, + I64, + I128, +} + +impl fmt::Debug for IntTy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self, f) + } +} + +impl fmt::Display for IntTy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.ty_to_string()) + } +} + +impl IntTy { + pub fn ty_to_string(&self) -> &'static str { + match *self { + IntTy::Is => "isize", + IntTy::I8 => "i8", + IntTy::I16 => "i16", + IntTy::I32 => "i32", + IntTy::I64 => "i64", + IntTy::I128 => "i128", + } + } + + pub fn val_to_string(&self, val: i64) -> String { + // cast to a u64 so we can correctly print INT64_MIN. All integral types + // are parsed as u64, so we wouldn't want to print an extra negative + // sign. + format!("{}{}", val as u64, self.ty_to_string()) + } + + pub fn bit_width(&self) -> Option { + Some(match *self { + IntTy::Is => return None, + IntTy::I8 => 8, + IntTy::I16 => 16, + IntTy::I32 => 32, + IntTy::I64 => 64, + IntTy::I128 => 128, + }) + } +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +pub enum UintTy { + Us, + U8, + U16, + U32, + U64, + U128, +} + +impl UintTy { + pub fn ty_to_string(&self) -> &'static str { + match *self { + UintTy::Us => "usize", + UintTy::U8 => "u8", + UintTy::U16 => "u16", + UintTy::U32 => "u32", + UintTy::U64 => "u64", + UintTy::U128 => "u128", + } + } + + pub fn val_to_string(&self, val: u64) -> String { + format!("{}{}", val, self.ty_to_string()) + } + + pub fn bit_width(&self) -> Option { + Some(match *self { + UintTy::Us => return None, + UintTy::U8 => 8, + UintTy::U16 => 16, + UintTy::U32 => 32, + UintTy::U64 => 64, + UintTy::U128 => 128, + }) + } +} + +impl fmt::Debug for UintTy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self, f) + } +} + +impl fmt::Display for UintTy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.ty_to_string()) + } +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +pub enum FloatTy { + F32, + F64, +} + +impl fmt::Debug for FloatTy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self, f) + } +} + +impl fmt::Display for FloatTy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.ty_to_string()) + } +} + +impl FloatTy { + pub fn ty_to_string(&self) -> &'static str { + match *self { + FloatTy::F32 => "f32", + FloatTy::F64 => "f64", + } + } + + pub fn bit_width(&self) -> usize { + match *self { + FloatTy::F32 => 32, + FloatTy::F64 => 64, + } + } +} + +// Bind a type to an associated type: `A=Foo`. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct TypeBinding { + pub id: NodeId, + pub ident: Ident, + pub ty: P, + pub span: Span, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +pub struct Ty { + pub id: NodeId, + pub node: TyKind, + pub span: Span, +} + +impl fmt::Debug for Ty { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "type({})", pprust::ty_to_string(self)) + } +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct BareFnTy { + pub unsafety: Unsafety, + pub abi: Abi, + pub lifetimes: Vec, + pub decl: P +} + +/// The different kinds of types recognized by the compiler +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum TyKind { + /// A variable-length slice (`[T]`) + Slice(P), + /// A fixed length array (`[T; n]`) + Array(P, P), + /// A raw pointer (`*const T` or `*mut T`) + Ptr(MutTy), + /// A reference (`&'a T` or `&'a mut T`) + Rptr(Option, MutTy), + /// A bare function (e.g. `fn(usize) -> bool`) + BareFn(P), + /// The never type (`!`) + Never, + /// A tuple (`(A, B, C, D,...)`) + Tup(Vec> ), + /// A path (`module::module::...::Type`), optionally + /// "qualified", e.g. ` as SomeTrait>::SomeType`. + /// + /// Type parameters are stored in the Path itself + Path(Option, Path), + /// Something like `A+B`. Note that `B` must always be a path. + ObjectSum(P, TyParamBounds), + /// A type like `for<'a> Foo<&'a Bar>` + PolyTraitRef(TyParamBounds), + /// An `impl TraitA+TraitB` type. + ImplTrait(TyParamBounds), + /// No-op; kept solely so that we can pretty-print faithfully + Paren(P), + /// Unused for now + Typeof(P), + /// TyKind::Infer means the type should be inferred instead of it having been + /// specified. This can appear anywhere in a type. + Infer, + /// Inferred type of a `self` or `&self` argument in a method. + ImplicitSelf, + // A macro in the type position. + Mac(Mac), +} + +/// Inline assembly dialect. +/// +/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum AsmDialect { + Att, + Intel, +} + +/// Inline assembly. +/// +/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct InlineAsmOutput { + pub constraint: Symbol, + pub expr: P, + pub is_rw: bool, + pub is_indirect: bool, +} + +/// Inline assembly. +/// +/// E.g. `asm!("NOP");` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct InlineAsm { + pub asm: Symbol, + pub asm_str_style: StrStyle, + pub outputs: Vec, + pub inputs: Vec<(Symbol, P)>, + pub clobbers: Vec, + pub volatile: bool, + pub alignstack: bool, + pub dialect: AsmDialect, + pub expn_id: ExpnId, +} + +/// An argument in a function header. +/// +/// E.g. `bar: usize` as in `fn foo(bar: usize)` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Arg { + pub ty: P, + pub pat: P, + pub id: NodeId, +} + +/// Alternative representation for `Arg`s describing `self` parameter of methods. +/// +/// E.g. `&mut self` as in `fn foo(&mut self)` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum SelfKind { + /// `self`, `mut self` + Value(Mutability), + /// `&'lt self`, `&'lt mut self` + Region(Option, Mutability), + /// `self: TYPE`, `mut self: TYPE` + Explicit(P, Mutability), +} + +pub type ExplicitSelf = Spanned; + +impl Arg { + pub fn to_self(&self) -> Option { + if let PatKind::Ident(BindingMode::ByValue(mutbl), ident, _) = self.pat.node { + if ident.node.name == keywords::SelfValue.name() { + return match self.ty.node { + TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))), + TyKind::Rptr(lt, MutTy{ref ty, mutbl}) if ty.node == TyKind::ImplicitSelf => { + Some(respan(self.pat.span, SelfKind::Region(lt, mutbl))) + } + _ => Some(respan(mk_sp(self.pat.span.lo, self.ty.span.hi), + SelfKind::Explicit(self.ty.clone(), mutbl))), + } + } + } + None + } + + pub fn is_self(&self) -> bool { + if let PatKind::Ident(_, ident, _) = self.pat.node { + ident.node.name == keywords::SelfValue.name() + } else { + false + } + } + + pub fn from_self(eself: ExplicitSelf, eself_ident: SpannedIdent) -> Arg { + let span = mk_sp(eself.span.lo, eself_ident.span.hi); + let infer_ty = P(Ty { + id: DUMMY_NODE_ID, + node: TyKind::ImplicitSelf, + span: span, + }); + let arg = |mutbl, ty| Arg { + pat: P(Pat { + id: DUMMY_NODE_ID, + node: PatKind::Ident(BindingMode::ByValue(mutbl), eself_ident, None), + span: span, + }), + ty: ty, + id: DUMMY_NODE_ID, + }; + match eself.node { + SelfKind::Explicit(ty, mutbl) => arg(mutbl, ty), + SelfKind::Value(mutbl) => arg(mutbl, infer_ty), + SelfKind::Region(lt, mutbl) => arg(Mutability::Immutable, P(Ty { + id: DUMMY_NODE_ID, + node: TyKind::Rptr(lt, MutTy { ty: infer_ty, mutbl: mutbl }), + span: span, + })), + } + } +} + +/// Header (not the body) of a function declaration. +/// +/// E.g. `fn foo(bar: baz)` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct FnDecl { + pub inputs: Vec, + pub output: FunctionRetTy, + pub variadic: bool +} + +impl FnDecl { + pub fn get_self(&self) -> Option { + self.inputs.get(0).and_then(Arg::to_self) + } + pub fn has_self(&self) -> bool { + self.inputs.get(0).map(Arg::is_self).unwrap_or(false) + } +} + +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum Unsafety { + Unsafe, + Normal, +} + +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum Constness { + Const, + NotConst, +} + +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum Defaultness { + Default, + Final, +} + +impl fmt::Display for Unsafety { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(match *self { + Unsafety::Normal => "normal", + Unsafety::Unsafe => "unsafe", + }, f) + } +} + +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +pub enum ImplPolarity { + /// `impl Trait for Type` + Positive, + /// `impl !Trait for Type` + Negative, +} + +impl fmt::Debug for ImplPolarity { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + ImplPolarity::Positive => "positive".fmt(f), + ImplPolarity::Negative => "negative".fmt(f), + } + } +} + + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum FunctionRetTy { + /// Return type is not specified. + /// + /// Functions default to `()` and + /// closures default to inference. Span points to where return + /// type would be inserted. + Default(Span), + /// Everything else + Ty(P), +} + +impl FunctionRetTy { + pub fn span(&self) -> Span { + match *self { + FunctionRetTy::Default(span) => span, + FunctionRetTy::Ty(ref ty) => ty.span, + } + } +} + +/// Module declaration. +/// +/// E.g. `mod foo;` or `mod foo { .. }` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Mod { + /// A span from the first token past `{` to the last token until `}`. + /// For `mod foo;`, the inner span ranges from the first token + /// to the last token in the external file. + pub inner: Span, + pub items: Vec>, +} + +/// Foreign module declaration. +/// +/// E.g. `extern { .. }` or `extern C { .. }` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct ForeignMod { + pub abi: Abi, + pub items: Vec, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct EnumDef { + pub variants: Vec, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Variant_ { + pub name: Ident, + pub attrs: Vec, + pub data: VariantData, + /// Explicit discriminant, e.g. `Foo = 1` + pub disr_expr: Option>, +} + +pub type Variant = Spanned; + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub struct PathListItem_ { + pub name: Ident, + /// renamed in list, e.g. `use foo::{bar as baz};` + pub rename: Option, + pub id: NodeId, +} + +pub type PathListItem = Spanned; + +pub type ViewPath = Spanned; + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum ViewPath_ { + + /// `foo::bar::baz as quux` + /// + /// or just + /// + /// `foo::bar::baz` (with `as baz` implicitly on the right) + ViewPathSimple(Ident, Path), + + /// `foo::bar::*` + ViewPathGlob(Path), + + /// `foo::bar::{a,b,c}` + ViewPathList(Path, Vec) +} + +impl ViewPath_ { + pub fn path(&self) -> &Path { + match *self { + ViewPathSimple(_, ref path) | + ViewPathGlob (ref path) | + ViewPathList(ref path, _) => path + } + } +} + + +/// Distinguishes between Attributes that decorate items and Attributes that +/// are contained as statements within items. These two cases need to be +/// distinguished for pretty-printing. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum AttrStyle { + Outer, + Inner, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub struct AttrId(pub usize); + +/// Meta-data associated with an item +/// Doc-comments are promoted to attributes that have is_sugared_doc = true +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Attribute { + pub id: AttrId, + pub style: AttrStyle, + pub value: MetaItem, + pub is_sugared_doc: bool, + pub span: Span, +} + +/// TraitRef's appear in impls. +/// +/// resolve maps each TraitRef's ref_id to its defining trait; that's all +/// that the ref_id is for. The impl_id maps to the "self type" of this impl. +/// If this impl is an ItemKind::Impl, the impl_id is redundant (it could be the +/// same as the impl's node id). +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct TraitRef { + pub path: Path, + pub ref_id: NodeId, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct PolyTraitRef { + /// The `'a` in `<'a> Foo<&'a T>` + pub bound_lifetimes: Vec, + + /// The `Foo<&'a T>` in `<'a> Foo<&'a T>` + pub trait_ref: TraitRef, + + pub span: Span, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum Visibility { + Public, + Crate(Span), + Restricted { path: P, id: NodeId }, + Inherited, +} + +/// Field of a struct. +/// +/// E.g. `bar: usize` as in `struct Foo { bar: usize }` +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct StructField { + pub span: Span, + pub ident: Option, + pub vis: Visibility, + pub id: NodeId, + pub ty: P, + pub attrs: Vec, +} + +/// Fields and Ids of enum variants and structs +/// +/// For enum variants: `NodeId` represents both an Id of the variant itself (relevant for all +/// variant kinds) and an Id of the variant's constructor (not relevant for `Struct`-variants). +/// One shared Id can be successfully used for these two purposes. +/// Id of the whole enum lives in `Item`. +/// +/// For structs: `NodeId` represents an Id of the structure's constructor, so it is not actually +/// used for `Struct`-structs (but still presents). Structures don't have an analogue of "Id of +/// the variant itself" from enum variants. +/// Id of the whole struct lives in `Item`. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum VariantData { + /// Struct variant. + /// + /// E.g. `Bar { .. }` as in `enum Foo { Bar { .. } }` + Struct(Vec, NodeId), + /// Tuple variant. + /// + /// E.g. `Bar(..)` as in `enum Foo { Bar(..) }` + Tuple(Vec, NodeId), + /// Unit variant. + /// + /// E.g. `Bar = ..` as in `enum Foo { Bar = .. }` + Unit(NodeId), +} + +impl VariantData { + pub fn fields(&self) -> &[StructField] { + match *self { + VariantData::Struct(ref fields, _) | VariantData::Tuple(ref fields, _) => fields, + _ => &[], + } + } + pub fn id(&self) -> NodeId { + match *self { + VariantData::Struct(_, id) | VariantData::Tuple(_, id) | VariantData::Unit(id) => id + } + } + pub fn is_struct(&self) -> bool { + if let VariantData::Struct(..) = *self { true } else { false } + } + pub fn is_tuple(&self) -> bool { + if let VariantData::Tuple(..) = *self { true } else { false } + } + pub fn is_unit(&self) -> bool { + if let VariantData::Unit(..) = *self { true } else { false } + } +} + +/// An item +/// +/// The name might be a dummy name in case of anonymous items +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Item { + pub ident: Ident, + pub attrs: Vec, + pub id: NodeId, + pub node: ItemKind, + pub vis: Visibility, + pub span: Span, +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum ItemKind { + /// An`extern crate` item, with optional original crate name. + /// + /// E.g. `extern crate foo` or `extern crate foo_bar as foo` + ExternCrate(Option), + /// A use declaration (`use` or `pub use`) item. + /// + /// E.g. `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;` + Use(P), + /// A static item (`static` or `pub static`). + /// + /// E.g. `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";` + Static(P, Mutability, P), + /// A constant item (`const` or `pub const`). + /// + /// E.g. `const FOO: i32 = 42;` + Const(P, P), + /// A function declaration (`fn` or `pub fn`). + /// + /// E.g. `fn foo(bar: usize) -> usize { .. }` + Fn(P, Unsafety, Spanned, Abi, Generics, P), + /// A module declaration (`mod` or `pub mod`). + /// + /// E.g. `mod foo;` or `mod foo { .. }` + Mod(Mod), + /// An external module (`extern` or `pub extern`). + /// + /// E.g. `extern {}` or `extern "C" {}` + ForeignMod(ForeignMod), + /// A type alias (`type` or `pub type`). + /// + /// E.g. `type Foo = Bar;` + Ty(P, Generics), + /// An enum definition (`enum` or `pub enum`). + /// + /// E.g. `enum Foo { C, D }` + Enum(EnumDef, Generics), + /// A struct definition (`struct` or `pub struct`). + /// + /// E.g. `struct Foo { x: A }` + Struct(VariantData, Generics), + /// A union definition (`union` or `pub union`). + /// + /// E.g. `union Foo { x: A, y: B }` + Union(VariantData, Generics), + /// A Trait declaration (`trait` or `pub trait`). + /// + /// E.g. `trait Foo { .. }` or `trait Foo { .. }` + Trait(Unsafety, Generics, TyParamBounds, Vec), + // Default trait implementation. + /// + /// E.g. `impl Trait for .. {}` or `impl Trait for .. {}` + DefaultImpl(Unsafety, TraitRef), + /// An implementation. + /// + /// E.g. `impl Foo { .. }` or `impl Trait for Foo { .. }` + Impl(Unsafety, + ImplPolarity, + Generics, + Option, // (optional) trait this impl implements + P, // self + Vec), + /// A macro invocation (which includes macro definition). + /// + /// E.g. `macro_rules! foo { .. }` or `foo!(..)` + Mac(Mac), +} + +impl ItemKind { + pub fn descriptive_variant(&self) -> &str { + match *self { + ItemKind::ExternCrate(..) => "extern crate", + ItemKind::Use(..) => "use", + ItemKind::Static(..) => "static item", + ItemKind::Const(..) => "constant item", + ItemKind::Fn(..) => "function", + ItemKind::Mod(..) => "module", + ItemKind::ForeignMod(..) => "foreign module", + ItemKind::Ty(..) => "type alias", + ItemKind::Enum(..) => "enum", + ItemKind::Struct(..) => "struct", + ItemKind::Union(..) => "union", + ItemKind::Trait(..) => "trait", + ItemKind::Mac(..) | + ItemKind::Impl(..) | + ItemKind::DefaultImpl(..) => "item" + } + } +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct ForeignItem { + pub ident: Ident, + pub attrs: Vec, + pub node: ForeignItemKind, + pub id: NodeId, + pub span: Span, + pub vis: Visibility, +} + +/// An item within an `extern` block +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum ForeignItemKind { + /// A foreign function + Fn(P, Generics), + /// A foreign static item (`static ext: u8`), with optional mutability + /// (the boolean is true when mutable) + Static(P, bool), +} + +impl ForeignItemKind { + pub fn descriptive_variant(&self) -> &str { + match *self { + ForeignItemKind::Fn(..) => "foreign function", + ForeignItemKind::Static(..) => "foreign static item" + } + } +} + +/// A macro definition, in this crate or imported from another. +/// +/// Not parsed directly, but created on macro import or `macro_rules!` expansion. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct MacroDef { + pub ident: Ident, + pub attrs: Vec, + pub id: NodeId, + pub span: Span, + pub body: Vec, +} + +#[cfg(test)] +mod tests { + use serialize; + use super::*; + + // are ASTs encodable? + #[test] + fn check_asts_encodable() { + fn assert_encodable() {} + assert_encodable::(); + } +} diff --git a/third_party/rust/syntex_syntax/src/attr.rs b/third_party/rust/syntex_syntax/src/attr.rs new file mode 100644 index 000000000000..ab8a49b41f25 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/attr.rs @@ -0,0 +1,1037 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Functions dealing with attributes and meta items + +pub use self::StabilityLevel::*; +pub use self::ReprAttr::*; +pub use self::IntType::*; + +use ast; +use ast::{AttrId, Attribute, Name}; +use ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind}; +use ast::{Lit, Expr, Item, Local, Stmt, StmtKind}; +use codemap::{spanned, dummy_spanned, mk_sp}; +use syntax_pos::{Span, BytePos, DUMMY_SP}; +use errors::Handler; +use feature_gate::{Features, GatedCfg}; +use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration}; +use parse::ParseSess; +use ptr::P; +use symbol::Symbol; +use util::ThinVec; + +use std::cell::{RefCell, Cell}; + +thread_local! { + static USED_ATTRS: RefCell> = RefCell::new(Vec::new()); + static KNOWN_ATTRS: RefCell> = RefCell::new(Vec::new()); +} + +enum AttrError { + MultipleItem(Name), + UnknownMetaItem(Name), + MissingSince, + MissingFeature, + MultipleStabilityLevels, + UnsupportedLiteral +} + +fn handle_errors(diag: &Handler, span: Span, error: AttrError) { + match error { + AttrError::MultipleItem(item) => span_err!(diag, span, E0538, + "multiple '{}' items", item), + AttrError::UnknownMetaItem(item) => span_err!(diag, span, E0541, + "unknown meta item '{}'", item), + AttrError::MissingSince => span_err!(diag, span, E0542, "missing 'since'"), + AttrError::MissingFeature => span_err!(diag, span, E0546, "missing 'feature'"), + AttrError::MultipleStabilityLevels => span_err!(diag, span, E0544, + "multiple stability levels"), + AttrError::UnsupportedLiteral => span_err!(diag, span, E0565, "unsupported literal"), + } +} + +pub fn mark_used(attr: &Attribute) { + debug!("Marking {:?} as used.", attr); + let AttrId(id) = attr.id; + USED_ATTRS.with(|slot| { + let idx = (id / 64) as usize; + let shift = id % 64; + if slot.borrow().len() <= idx { + slot.borrow_mut().resize(idx + 1, 0); + } + slot.borrow_mut()[idx] |= 1 << shift; + }); +} + +pub fn is_used(attr: &Attribute) -> bool { + let AttrId(id) = attr.id; + USED_ATTRS.with(|slot| { + let idx = (id / 64) as usize; + let shift = id % 64; + slot.borrow().get(idx).map(|bits| bits & (1 << shift) != 0) + .unwrap_or(false) + }) +} + +pub fn mark_known(attr: &Attribute) { + debug!("Marking {:?} as known.", attr); + let AttrId(id) = attr.id; + KNOWN_ATTRS.with(|slot| { + let idx = (id / 64) as usize; + let shift = id % 64; + if slot.borrow().len() <= idx { + slot.borrow_mut().resize(idx + 1, 0); + } + slot.borrow_mut()[idx] |= 1 << shift; + }); +} + +pub fn is_known(attr: &Attribute) -> bool { + let AttrId(id) = attr.id; + KNOWN_ATTRS.with(|slot| { + let idx = (id / 64) as usize; + let shift = id % 64; + slot.borrow().get(idx).map(|bits| bits & (1 << shift) != 0) + .unwrap_or(false) + }) +} + +impl NestedMetaItem { + /// Returns the MetaItem if self is a NestedMetaItemKind::MetaItem. + pub fn meta_item(&self) -> Option<&MetaItem> { + match self.node { + NestedMetaItemKind::MetaItem(ref item) => Some(&item), + _ => None + } + } + + /// Returns the Lit if self is a NestedMetaItemKind::Literal. + pub fn literal(&self) -> Option<&Lit> { + match self.node { + NestedMetaItemKind::Literal(ref lit) => Some(&lit), + _ => None + } + } + + /// Returns the Span for `self`. + pub fn span(&self) -> Span { + self.span + } + + /// Returns true if this list item is a MetaItem with a name of `name`. + pub fn check_name(&self, name: &str) -> bool { + self.meta_item().map_or(false, |meta_item| meta_item.check_name(name)) + } + + /// Returns the name of the meta item, e.g. `foo` in `#[foo]`, + /// `#[foo="bar"]` and `#[foo(bar)]`, if self is a MetaItem + pub fn name(&self) -> Option { + self.meta_item().and_then(|meta_item| Some(meta_item.name())) + } + + /// Gets the string value if self is a MetaItem and the MetaItem is a + /// MetaItemKind::NameValue variant containing a string, otherwise None. + pub fn value_str(&self) -> Option { + self.meta_item().and_then(|meta_item| meta_item.value_str()) + } + + /// Returns a MetaItem if self is a MetaItem with Kind Word. + pub fn word(&self) -> Option<&MetaItem> { + self.meta_item().and_then(|meta_item| if meta_item.is_word() { + Some(meta_item) + } else { + None + }) + } + + /// Gets a list of inner meta items from a list MetaItem type. + pub fn meta_item_list(&self) -> Option<&[NestedMetaItem]> { + self.meta_item().and_then(|meta_item| meta_item.meta_item_list()) + } + + /// Returns `true` if the variant is MetaItem. + pub fn is_meta_item(&self) -> bool { + self.meta_item().is_some() + } + + /// Returns `true` if the variant is Literal. + pub fn is_literal(&self) -> bool { + self.literal().is_some() + } + + /// Returns `true` if self is a MetaItem and the meta item is a word. + pub fn is_word(&self) -> bool { + self.word().is_some() + } + + /// Returns `true` if self is a MetaItem and the meta item is a ValueString. + pub fn is_value_str(&self) -> bool { + self.value_str().is_some() + } + + /// Returns `true` if self is a MetaItem and the meta item is a list. + pub fn is_meta_item_list(&self) -> bool { + self.meta_item_list().is_some() + } +} + +impl Attribute { + pub fn check_name(&self, name: &str) -> bool { + let matches = self.name() == name; + if matches { + mark_used(self); + } + matches + } + + pub fn name(&self) -> Name { self.meta().name() } + + pub fn value_str(&self) -> Option { + self.meta().value_str() + } + + pub fn meta_item_list(&self) -> Option<&[NestedMetaItem]> { + self.meta().meta_item_list() + } + + pub fn is_word(&self) -> bool { self.meta().is_word() } + + pub fn span(&self) -> Span { self.meta().span } + + pub fn is_meta_item_list(&self) -> bool { + self.meta_item_list().is_some() + } + + /// Indicates if the attribute is a Value String. + pub fn is_value_str(&self) -> bool { + self.value_str().is_some() + } +} + +impl MetaItem { + pub fn name(&self) -> Name { + self.name + } + + pub fn value_str(&self) -> Option { + match self.node { + MetaItemKind::NameValue(ref v) => { + match v.node { + ast::LitKind::Str(ref s, _) => Some((*s).clone()), + _ => None, + } + }, + _ => None + } + } + + pub fn meta_item_list(&self) -> Option<&[NestedMetaItem]> { + match self.node { + MetaItemKind::List(ref l) => Some(&l[..]), + _ => None + } + } + + pub fn is_word(&self) -> bool { + match self.node { + MetaItemKind::Word => true, + _ => false, + } + } + + pub fn span(&self) -> Span { self.span } + + pub fn check_name(&self, name: &str) -> bool { + self.name() == name + } + + pub fn is_value_str(&self) -> bool { + self.value_str().is_some() + } + + pub fn is_meta_item_list(&self) -> bool { + self.meta_item_list().is_some() + } +} + +impl Attribute { + /// Extract the MetaItem from inside this Attribute. + pub fn meta(&self) -> &MetaItem { + &self.value + } + + /// Convert self to a normal #[doc="foo"] comment, if it is a + /// comment like `///` or `/** */`. (Returns self unchanged for + /// non-sugared doc attributes.) + pub fn with_desugared_doc(&self, f: F) -> T where + F: FnOnce(&Attribute) -> T, + { + if self.is_sugared_doc { + let comment = self.value_str().unwrap(); + let meta = mk_name_value_item_str( + Symbol::intern("doc"), + Symbol::intern(&strip_doc_comment_decoration(&comment.as_str()))); + if self.style == ast::AttrStyle::Outer { + f(&mk_attr_outer(self.id, meta)) + } else { + f(&mk_attr_inner(self.id, meta)) + } + } else { + f(self) + } + } +} + +/* Constructors */ + +pub fn mk_name_value_item_str(name: Name, value: Symbol) -> MetaItem { + let value_lit = dummy_spanned(ast::LitKind::Str(value, ast::StrStyle::Cooked)); + mk_spanned_name_value_item(DUMMY_SP, name, value_lit) +} + +pub fn mk_name_value_item(name: Name, value: ast::Lit) -> MetaItem { + mk_spanned_name_value_item(DUMMY_SP, name, value) +} + +pub fn mk_list_item(name: Name, items: Vec) -> MetaItem { + mk_spanned_list_item(DUMMY_SP, name, items) +} + +pub fn mk_list_word_item(name: Name) -> ast::NestedMetaItem { + dummy_spanned(NestedMetaItemKind::MetaItem(mk_spanned_word_item(DUMMY_SP, name))) +} + +pub fn mk_word_item(name: Name) -> MetaItem { + mk_spanned_word_item(DUMMY_SP, name) +} + +pub fn mk_spanned_name_value_item(sp: Span, name: Name, value: ast::Lit) -> MetaItem { + MetaItem { span: sp, name: name, node: MetaItemKind::NameValue(value) } +} + +pub fn mk_spanned_list_item(sp: Span, name: Name, items: Vec) -> MetaItem { + MetaItem { span: sp, name: name, node: MetaItemKind::List(items) } +} + +pub fn mk_spanned_word_item(sp: Span, name: Name) -> MetaItem { + MetaItem { span: sp, name: name, node: MetaItemKind::Word } +} + + + +thread_local! { static NEXT_ATTR_ID: Cell = Cell::new(0) } + +pub fn mk_attr_id() -> AttrId { + let id = NEXT_ATTR_ID.with(|slot| { + let r = slot.get(); + slot.set(r + 1); + r + }); + AttrId(id) +} + +/// Returns an inner attribute with the given value. +pub fn mk_attr_inner(id: AttrId, item: MetaItem) -> Attribute { + mk_spanned_attr_inner(DUMMY_SP, id, item) +} + +/// Returns an innter attribute with the given value and span. +pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute { + Attribute { + id: id, + style: ast::AttrStyle::Inner, + value: item, + is_sugared_doc: false, + span: sp, + } +} + + +/// Returns an outer attribute with the given value. +pub fn mk_attr_outer(id: AttrId, item: MetaItem) -> Attribute { + mk_spanned_attr_outer(DUMMY_SP, id, item) +} + +/// Returns an outer attribute with the given value and span. +pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute { + Attribute { + id: id, + style: ast::AttrStyle::Outer, + value: item, + is_sugared_doc: false, + span: sp, + } +} + +pub fn mk_sugared_doc_attr(id: AttrId, text: Symbol, lo: BytePos, hi: BytePos) + -> Attribute { + let style = doc_comment_style(&text.as_str()); + let lit = spanned(lo, hi, ast::LitKind::Str(text, ast::StrStyle::Cooked)); + Attribute { + id: id, + style: style, + value: MetaItem { + span: mk_sp(lo, hi), + name: Symbol::intern("doc"), + node: MetaItemKind::NameValue(lit), + }, + is_sugared_doc: true, + span: mk_sp(lo, hi), + } +} + +pub fn list_contains_name(items: &[NestedMetaItem], name: &str) -> bool { + debug!("attr::list_contains_name (name={})", name); + items.iter().any(|item| { + debug!(" testing: {:?}", item.name()); + item.check_name(name) + }) +} + +pub fn contains_name(attrs: &[Attribute], name: &str) -> bool { + debug!("attr::contains_name (name={})", name); + attrs.iter().any(|item| { + debug!(" testing: {}", item.name()); + item.check_name(name) + }) +} + +pub fn first_attr_value_str_by_name(attrs: &[Attribute], name: &str) -> Option { + attrs.iter() + .find(|at| at.check_name(name)) + .and_then(|at| at.value_str()) +} + +/* Higher-level applications */ + +pub fn find_crate_name(attrs: &[Attribute]) -> Option { + first_attr_value_str_by_name(attrs, "crate_name") +} + +/// Find the value of #[export_name=*] attribute and check its validity. +pub fn find_export_name_attr(diag: &Handler, attrs: &[Attribute]) -> Option { + attrs.iter().fold(None, |ia,attr| { + if attr.check_name("export_name") { + if let s@Some(_) = attr.value_str() { + s + } else { + struct_span_err!(diag, attr.span, E0558, + "export_name attribute has invalid format") + .span_label(attr.span, + &format!("did you mean #[export_name=\"*\"]?")) + .emit(); + None + } + } else { + ia + } + }) +} + +pub fn contains_extern_indicator(diag: &Handler, attrs: &[Attribute]) -> bool { + contains_name(attrs, "no_mangle") || + find_export_name_attr(diag, attrs).is_some() +} + +#[derive(Copy, Clone, PartialEq)] +pub enum InlineAttr { + None, + Hint, + Always, + Never, +} + +/// Determine what `#[inline]` attribute is present in `attrs`, if any. +pub fn find_inline_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> InlineAttr { + attrs.iter().fold(InlineAttr::None, |ia, attr| { + match attr.value.node { + _ if attr.value.name != "inline" => ia, + MetaItemKind::Word => { + mark_used(attr); + InlineAttr::Hint + } + MetaItemKind::List(ref items) => { + mark_used(attr); + if items.len() != 1 { + diagnostic.map(|d|{ span_err!(d, attr.span, E0534, "expected one argument"); }); + InlineAttr::None + } else if list_contains_name(&items[..], "always") { + InlineAttr::Always + } else if list_contains_name(&items[..], "never") { + InlineAttr::Never + } else { + diagnostic.map(|d| { + span_err!(d, items[0].span, E0535, "invalid argument"); + }); + + InlineAttr::None + } + } + _ => ia, + } + }) +} + +/// True if `#[inline]` or `#[inline(always)]` is present in `attrs`. +pub fn requests_inline(attrs: &[Attribute]) -> bool { + match find_inline_attr(None, attrs) { + InlineAttr::Hint | InlineAttr::Always => true, + InlineAttr::None | InlineAttr::Never => false, + } +} + +/// Tests if a cfg-pattern matches the cfg set +pub fn cfg_matches(cfg: &ast::MetaItem, sess: &ParseSess, features: Option<&Features>) -> bool { + match cfg.node { + ast::MetaItemKind::List(ref mis) => { + for mi in mis.iter() { + if !mi.is_meta_item() { + handle_errors(&sess.span_diagnostic, mi.span, AttrError::UnsupportedLiteral); + return false; + } + } + + // The unwraps below may look dangerous, but we've already asserted + // that they won't fail with the loop above. + match &*cfg.name.as_str() { + "any" => mis.iter().any(|mi| { + cfg_matches(mi.meta_item().unwrap(), sess, features) + }), + "all" => mis.iter().all(|mi| { + cfg_matches(mi.meta_item().unwrap(), sess, features) + }), + "not" => { + if mis.len() != 1 { + span_err!(sess.span_diagnostic, cfg.span, E0536, "expected 1 cfg-pattern"); + return false; + } + + !cfg_matches(mis[0].meta_item().unwrap(), sess, features) + }, + p => { + span_err!(sess.span_diagnostic, cfg.span, E0537, "invalid predicate `{}`", p); + false + } + } + }, + ast::MetaItemKind::Word | ast::MetaItemKind::NameValue(..) => { + if let (Some(feats), Some(gated_cfg)) = (features, GatedCfg::gate(cfg)) { + gated_cfg.check_and_emit(sess, feats); + } + sess.config.contains(&(cfg.name(), cfg.value_str())) + } + } +} + +/// Represents the #[stable], #[unstable] and #[rustc_deprecated] attributes. +#[derive(RustcEncodable, RustcDecodable, Clone, Debug, PartialEq, Eq, Hash)] +pub struct Stability { + pub level: StabilityLevel, + pub feature: Symbol, + pub rustc_depr: Option, +} + +/// The available stability levels. +#[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Clone, Debug, Eq, Hash)] +pub enum StabilityLevel { + // Reason for the current stability level and the relevant rust-lang issue + Unstable { reason: Option, issue: u32 }, + Stable { since: Symbol }, +} + +#[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Clone, Debug, Eq, Hash)] +pub struct RustcDeprecation { + pub since: Symbol, + pub reason: Symbol, +} + +#[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Clone, Debug, Eq, Hash)] +pub struct Deprecation { + pub since: Option, + pub note: Option, +} + +impl StabilityLevel { + pub fn is_unstable(&self) -> bool { if let Unstable {..} = *self { true } else { false }} + pub fn is_stable(&self) -> bool { if let Stable {..} = *self { true } else { false }} +} + +fn find_stability_generic<'a, I>(diagnostic: &Handler, + attrs_iter: I, + item_sp: Span) + -> Option + where I: Iterator +{ + let mut stab: Option = None; + let mut rustc_depr: Option = None; + + 'outer: for attr in attrs_iter { + let tag = attr.name(); + if tag != "rustc_deprecated" && tag != "unstable" && tag != "stable" { + continue // not a stability level + } + + mark_used(attr); + + if let Some(metas) = attr.meta_item_list() { + let get = |meta: &MetaItem, item: &mut Option| { + if item.is_some() { + handle_errors(diagnostic, meta.span, AttrError::MultipleItem(meta.name())); + return false + } + if let Some(v) = meta.value_str() { + *item = Some(v); + true + } else { + span_err!(diagnostic, meta.span, E0539, "incorrect meta item"); + false + } + }; + + match &*tag.as_str() { + "rustc_deprecated" => { + if rustc_depr.is_some() { + span_err!(diagnostic, item_sp, E0540, + "multiple rustc_deprecated attributes"); + break + } + + let mut since = None; + let mut reason = None; + for meta in metas { + if let Some(mi) = meta.meta_item() { + match &*mi.name().as_str() { + "since" => if !get(mi, &mut since) { continue 'outer }, + "reason" => if !get(mi, &mut reason) { continue 'outer }, + _ => { + handle_errors(diagnostic, mi.span, + AttrError::UnknownMetaItem(mi.name())); + continue 'outer + } + } + } else { + handle_errors(diagnostic, meta.span, AttrError::UnsupportedLiteral); + continue 'outer + } + } + + match (since, reason) { + (Some(since), Some(reason)) => { + rustc_depr = Some(RustcDeprecation { + since: since, + reason: reason, + }) + } + (None, _) => { + handle_errors(diagnostic, attr.span(), AttrError::MissingSince); + continue + } + _ => { + span_err!(diagnostic, attr.span(), E0543, "missing 'reason'"); + continue + } + } + } + "unstable" => { + if stab.is_some() { + handle_errors(diagnostic, attr.span(), AttrError::MultipleStabilityLevels); + break + } + + let mut feature = None; + let mut reason = None; + let mut issue = None; + for meta in metas { + if let Some(mi) = meta.meta_item() { + match &*mi.name().as_str() { + "feature" => if !get(mi, &mut feature) { continue 'outer }, + "reason" => if !get(mi, &mut reason) { continue 'outer }, + "issue" => if !get(mi, &mut issue) { continue 'outer }, + _ => { + handle_errors(diagnostic, meta.span, + AttrError::UnknownMetaItem(mi.name())); + continue 'outer + } + } + } else { + handle_errors(diagnostic, meta.span, AttrError::UnsupportedLiteral); + continue 'outer + } + } + + match (feature, reason, issue) { + (Some(feature), reason, Some(issue)) => { + stab = Some(Stability { + level: Unstable { + reason: reason, + issue: { + if let Ok(issue) = issue.as_str().parse() { + issue + } else { + span_err!(diagnostic, attr.span(), E0545, + "incorrect 'issue'"); + continue + } + } + }, + feature: feature, + rustc_depr: None, + }) + } + (None, _, _) => { + handle_errors(diagnostic, attr.span(), AttrError::MissingFeature); + continue + } + _ => { + span_err!(diagnostic, attr.span(), E0547, "missing 'issue'"); + continue + } + } + } + "stable" => { + if stab.is_some() { + handle_errors(diagnostic, attr.span(), AttrError::MultipleStabilityLevels); + break + } + + let mut feature = None; + let mut since = None; + for meta in metas { + if let NestedMetaItemKind::MetaItem(ref mi) = meta.node { + match &*mi.name().as_str() { + "feature" => if !get(mi, &mut feature) { continue 'outer }, + "since" => if !get(mi, &mut since) { continue 'outer }, + _ => { + handle_errors(diagnostic, meta.span, + AttrError::UnknownMetaItem(mi.name())); + continue 'outer + } + } + } else { + handle_errors(diagnostic, meta.span, AttrError::UnsupportedLiteral); + continue 'outer + } + } + + match (feature, since) { + (Some(feature), Some(since)) => { + stab = Some(Stability { + level: Stable { + since: since, + }, + feature: feature, + rustc_depr: None, + }) + } + (None, _) => { + handle_errors(diagnostic, attr.span(), AttrError::MissingFeature); + continue + } + _ => { + handle_errors(diagnostic, attr.span(), AttrError::MissingSince); + continue + } + } + } + _ => unreachable!() + } + } else { + span_err!(diagnostic, attr.span(), E0548, "incorrect stability attribute type"); + continue + } + } + + // Merge the deprecation info into the stability info + if let Some(rustc_depr) = rustc_depr { + if let Some(ref mut stab) = stab { + stab.rustc_depr = Some(rustc_depr); + } else { + span_err!(diagnostic, item_sp, E0549, + "rustc_deprecated attribute must be paired with \ + either stable or unstable attribute"); + } + } + + stab +} + +fn find_deprecation_generic<'a, I>(diagnostic: &Handler, + attrs_iter: I, + item_sp: Span) + -> Option + where I: Iterator +{ + let mut depr: Option = None; + + 'outer: for attr in attrs_iter { + if attr.name() != "deprecated" { + continue + } + + mark_used(attr); + + if depr.is_some() { + span_err!(diagnostic, item_sp, E0550, "multiple deprecated attributes"); + break + } + + depr = if let Some(metas) = attr.meta_item_list() { + let get = |meta: &MetaItem, item: &mut Option| { + if item.is_some() { + handle_errors(diagnostic, meta.span, AttrError::MultipleItem(meta.name())); + return false + } + if let Some(v) = meta.value_str() { + *item = Some(v); + true + } else { + span_err!(diagnostic, meta.span, E0551, "incorrect meta item"); + false + } + }; + + let mut since = None; + let mut note = None; + for meta in metas { + if let NestedMetaItemKind::MetaItem(ref mi) = meta.node { + match &*mi.name().as_str() { + "since" => if !get(mi, &mut since) { continue 'outer }, + "note" => if !get(mi, &mut note) { continue 'outer }, + _ => { + handle_errors(diagnostic, meta.span, + AttrError::UnknownMetaItem(mi.name())); + continue 'outer + } + } + } else { + handle_errors(diagnostic, meta.span, AttrError::UnsupportedLiteral); + continue 'outer + } + } + + Some(Deprecation {since: since, note: note}) + } else { + Some(Deprecation{since: None, note: None}) + } + } + + depr +} + +/// Find the first stability attribute. `None` if none exists. +pub fn find_stability(diagnostic: &Handler, attrs: &[Attribute], + item_sp: Span) -> Option { + find_stability_generic(diagnostic, attrs.iter(), item_sp) +} + +/// Find the deprecation attribute. `None` if none exists. +pub fn find_deprecation(diagnostic: &Handler, attrs: &[Attribute], + item_sp: Span) -> Option { + find_deprecation_generic(diagnostic, attrs.iter(), item_sp) +} + + +/// Parse #[repr(...)] forms. +/// +/// Valid repr contents: any of the primitive integral type names (see +/// `int_type_of_word`, below) to specify enum discriminant type; `C`, to use +/// the same discriminant size that the corresponding C enum would or C +/// structure layout, and `packed` to remove padding. +pub fn find_repr_attrs(diagnostic: &Handler, attr: &Attribute) -> Vec { + let mut acc = Vec::new(); + match attr.value.node { + ast::MetaItemKind::List(ref items) if attr.value.name == "repr" => { + mark_used(attr); + for item in items { + if !item.is_meta_item() { + handle_errors(diagnostic, item.span, AttrError::UnsupportedLiteral); + continue + } + + if let Some(mi) = item.word() { + let word = &*mi.name().as_str(); + let hint = match word { + // Can't use "extern" because it's not a lexical identifier. + "C" => Some(ReprExtern), + "packed" => Some(ReprPacked), + "simd" => Some(ReprSimd), + _ => match int_type_of_word(word) { + Some(ity) => Some(ReprInt(ity)), + None => { + // Not a word we recognize + span_err!(diagnostic, item.span, E0552, + "unrecognized representation hint"); + None + } + } + }; + + if let Some(h) = hint { + acc.push(h); + } + } else { + span_err!(diagnostic, item.span, E0553, + "unrecognized enum representation hint"); + } + } + } + // Not a "repr" hint: ignore. + _ => { } + } + acc +} + +fn int_type_of_word(s: &str) -> Option { + match s { + "i8" => Some(SignedInt(ast::IntTy::I8)), + "u8" => Some(UnsignedInt(ast::UintTy::U8)), + "i16" => Some(SignedInt(ast::IntTy::I16)), + "u16" => Some(UnsignedInt(ast::UintTy::U16)), + "i32" => Some(SignedInt(ast::IntTy::I32)), + "u32" => Some(UnsignedInt(ast::UintTy::U32)), + "i64" => Some(SignedInt(ast::IntTy::I64)), + "u64" => Some(UnsignedInt(ast::UintTy::U64)), + "i128" => Some(SignedInt(ast::IntTy::I128)), + "u128" => Some(UnsignedInt(ast::UintTy::U128)), + "isize" => Some(SignedInt(ast::IntTy::Is)), + "usize" => Some(UnsignedInt(ast::UintTy::Us)), + _ => None + } +} + +#[derive(PartialEq, Debug, RustcEncodable, RustcDecodable, Copy, Clone)] +pub enum ReprAttr { + ReprAny, + ReprInt(IntType), + ReprExtern, + ReprPacked, + ReprSimd, +} + +impl ReprAttr { + pub fn is_ffi_safe(&self) -> bool { + match *self { + ReprAny => false, + ReprInt(ity) => ity.is_ffi_safe(), + ReprExtern => true, + ReprPacked => false, + ReprSimd => true, + } + } +} + +#[derive(Eq, Hash, PartialEq, Debug, RustcEncodable, RustcDecodable, Copy, Clone)] +pub enum IntType { + SignedInt(ast::IntTy), + UnsignedInt(ast::UintTy) +} + +impl IntType { + #[inline] + pub fn is_signed(self) -> bool { + match self { + SignedInt(..) => true, + UnsignedInt(..) => false + } + } + fn is_ffi_safe(self) -> bool { + match self { + SignedInt(ast::IntTy::I8) | UnsignedInt(ast::UintTy::U8) | + SignedInt(ast::IntTy::I16) | UnsignedInt(ast::UintTy::U16) | + SignedInt(ast::IntTy::I32) | UnsignedInt(ast::UintTy::U32) | + SignedInt(ast::IntTy::I64) | UnsignedInt(ast::UintTy::U64) | + SignedInt(ast::IntTy::I128) | UnsignedInt(ast::UintTy::U128) => true, + SignedInt(ast::IntTy::Is) | UnsignedInt(ast::UintTy::Us) => false + } + } +} + +pub trait HasAttrs: Sized { + fn attrs(&self) -> &[ast::Attribute]; + fn map_attrs) -> Vec>(self, f: F) -> Self; +} + +impl HasAttrs for Vec { + fn attrs(&self) -> &[Attribute] { + &self + } + fn map_attrs) -> Vec>(self, f: F) -> Self { + f(self) + } +} + +impl HasAttrs for ThinVec { + fn attrs(&self) -> &[Attribute] { + &self + } + fn map_attrs) -> Vec>(self, f: F) -> Self { + f(self.into()).into() + } +} + +impl HasAttrs for P { + fn attrs(&self) -> &[Attribute] { + (**self).attrs() + } + fn map_attrs) -> Vec>(self, f: F) -> Self { + self.map(|t| t.map_attrs(f)) + } +} + +impl HasAttrs for StmtKind { + fn attrs(&self) -> &[Attribute] { + match *self { + StmtKind::Local(ref local) => local.attrs(), + StmtKind::Item(..) => &[], + StmtKind::Expr(ref expr) | StmtKind::Semi(ref expr) => expr.attrs(), + StmtKind::Mac(ref mac) => { + let (_, _, ref attrs) = **mac; + attrs.attrs() + } + } + } + + fn map_attrs) -> Vec>(self, f: F) -> Self { + match self { + StmtKind::Local(local) => StmtKind::Local(local.map_attrs(f)), + StmtKind::Item(..) => self, + StmtKind::Expr(expr) => StmtKind::Expr(expr.map_attrs(f)), + StmtKind::Semi(expr) => StmtKind::Semi(expr.map_attrs(f)), + StmtKind::Mac(mac) => StmtKind::Mac(mac.map(|(mac, style, attrs)| { + (mac, style, attrs.map_attrs(f)) + })), + } + } +} + +macro_rules! derive_has_attrs_from_field { + ($($ty:path),*) => { derive_has_attrs_from_field!($($ty: .attrs),*); }; + ($($ty:path : $(.$field:ident)*),*) => { $( + impl HasAttrs for $ty { + fn attrs(&self) -> &[Attribute] { + self $(.$field)* .attrs() + } + + fn map_attrs(mut self, f: F) -> Self + where F: FnOnce(Vec) -> Vec, + { + self $(.$field)* = self $(.$field)* .map_attrs(f); + self + } + } + )* } +} + +derive_has_attrs_from_field! { + Item, Expr, Local, ast::ForeignItem, ast::StructField, ast::ImplItem, ast::TraitItem, ast::Arm +} + +derive_has_attrs_from_field! { Stmt: .node, ast::Variant: .node.attrs } diff --git a/third_party/rust/syntex_syntax/src/codemap.rs b/third_party/rust/syntex_syntax/src/codemap.rs new file mode 100644 index 000000000000..0c5a841e59fc --- /dev/null +++ b/third_party/rust/syntex_syntax/src/codemap.rs @@ -0,0 +1,1278 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The CodeMap tracks all the source code used within a single crate, mapping +//! from integer byte positions to the original source code location. Each bit +//! of source parsed during crate parsing (typically files, in-memory strings, +//! or various bits of macro expansion) cover a continuous range of bytes in the +//! CodeMap and are represented by FileMaps. Byte positions are stored in +//! `spans` and used pervasively in the compiler. They are absolute positions +//! within the CodeMap, which upon request can be converted to line and column +//! information, source code snippets, etc. + +pub use self::ExpnFormat::*; + +use std::cell::RefCell; +use std::path::{Path,PathBuf}; +use std::rc::Rc; + +use std::env; +use std::fs; +use std::io::{self, Read}; +pub use syntax_pos::*; +use errors::CodeMapper; + +use ast::Name; + +/// Return the span itself if it doesn't come from a macro expansion, +/// otherwise return the call site span up to the `enclosing_sp` by +/// following the `expn_info` chain. +pub fn original_sp(cm: &CodeMap, sp: Span, enclosing_sp: Span) -> Span { + let call_site1 = cm.with_expn_info(sp.expn_id, |ei| ei.map(|ei| ei.call_site)); + let call_site2 = cm.with_expn_info(enclosing_sp.expn_id, |ei| ei.map(|ei| ei.call_site)); + match (call_site1, call_site2) { + (None, _) => sp, + (Some(call_site1), Some(call_site2)) if call_site1 == call_site2 => sp, + (Some(call_site1), _) => original_sp(cm, call_site1, enclosing_sp), + } +} + +/// The source of expansion. +#[derive(Clone, Hash, Debug, PartialEq, Eq)] +pub enum ExpnFormat { + /// e.g. #[derive(...)] + MacroAttribute(Name), + /// e.g. `format!()` + MacroBang(Name), + /// Desugaring done by the compiler during HIR lowering. + CompilerDesugaring(Name) +} + +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub struct Spanned { + pub node: T, + pub span: Span, +} + +pub fn spanned(lo: BytePos, hi: BytePos, t: T) -> Spanned { + respan(mk_sp(lo, hi), t) +} + +pub fn respan(sp: Span, t: T) -> Spanned { + Spanned {node: t, span: sp} +} + +pub fn dummy_spanned(t: T) -> Spanned { + respan(DUMMY_SP, t) +} + +/// Build a span that covers the two provided spans. +pub fn combine_spans(sp1: Span, sp2: Span) -> Span { + if sp1 == DUMMY_SP && sp2 == DUMMY_SP { + DUMMY_SP + } else if sp1 == DUMMY_SP { + sp2 + } else if sp2 == DUMMY_SP { + sp1 + } else { + Span { + lo: if sp1.lo < sp2.lo { sp1.lo } else { sp2.lo }, + hi: if sp1.hi > sp2.hi { sp1.hi } else { sp2.hi }, + expn_id: if sp1.expn_id == sp2.expn_id { sp1.expn_id } else { NO_EXPANSION }, + } + } +} + +#[derive(Clone, Hash, Debug)] +pub struct NameAndSpan { + /// The format with which the macro was invoked. + pub format: ExpnFormat, + /// Whether the macro is allowed to use #[unstable]/feature-gated + /// features internally without forcing the whole crate to opt-in + /// to them. + pub allow_internal_unstable: bool, + /// The span of the macro definition itself. The macro may not + /// have a sensible definition span (e.g. something defined + /// completely inside libsyntax) in which case this is None. + pub span: Option +} + +impl NameAndSpan { + pub fn name(&self) -> Name { + match self.format { + ExpnFormat::MacroAttribute(s) | + ExpnFormat::MacroBang(s) | + ExpnFormat::CompilerDesugaring(s) => s, + } + } +} + +/// Extra information for tracking spans of macro and syntax sugar expansion +#[derive(Hash, Debug)] +pub struct ExpnInfo { + /// The location of the actual macro invocation or syntax sugar , e.g. + /// `let x = foo!();` or `if let Some(y) = x {}` + /// + /// This may recursively refer to other macro invocations, e.g. if + /// `foo!()` invoked `bar!()` internally, and there was an + /// expression inside `bar!`; the call_site of the expression in + /// the expansion would point to the `bar!` invocation; that + /// call_site span would have its own ExpnInfo, with the call_site + /// pointing to the `foo!` invocation. + pub call_site: Span, + /// Information about the expansion. + pub callee: NameAndSpan +} + +// _____________________________________________________________________________ +// FileMap, MultiByteChar, FileName, FileLines +// + +/// An abstraction over the fs operations used by the Parser. +pub trait FileLoader { + /// Query the existence of a file. + fn file_exists(&self, path: &Path) -> bool; + + /// Return an absolute path to a file, if possible. + fn abs_path(&self, path: &Path) -> Option; + + /// Read the contents of an UTF-8 file into memory. + fn read_file(&self, path: &Path) -> io::Result; +} + +/// A FileLoader that uses std::fs to load real files. +pub struct RealFileLoader; + +impl FileLoader for RealFileLoader { + fn file_exists(&self, path: &Path) -> bool { + fs::metadata(path).is_ok() + } + + fn abs_path(&self, path: &Path) -> Option { + if path.is_absolute() { + Some(path.to_path_buf()) + } else { + env::current_dir() + .ok() + .map(|cwd| cwd.join(path)) + } + } + + fn read_file(&self, path: &Path) -> io::Result { + let mut src = String::new(); + try!(try!(fs::File::open(path)).read_to_string(&mut src)); + Ok(src) + } +} + +// _____________________________________________________________________________ +// CodeMap +// + +pub struct CodeMap { + pub files: RefCell>>, + expansions: RefCell>, + file_loader: Box +} + +impl CodeMap { + pub fn new() -> CodeMap { + CodeMap { + files: RefCell::new(Vec::new()), + expansions: RefCell::new(Vec::new()), + file_loader: Box::new(RealFileLoader) + } + } + + pub fn with_file_loader(file_loader: Box) -> CodeMap { + CodeMap { + files: RefCell::new(Vec::new()), + expansions: RefCell::new(Vec::new()), + file_loader: file_loader + } + } + + pub fn file_exists(&self, path: &Path) -> bool { + self.file_loader.file_exists(path) + } + + pub fn load_file(&self, path: &Path) -> io::Result> { + let src = try!(self.file_loader.read_file(path)); + let abs_path = self.file_loader.abs_path(path).map(|p| p.to_str().unwrap().to_string()); + Ok(self.new_filemap(path.to_str().unwrap().to_string(), abs_path, src)) + } + + fn next_start_pos(&self) -> usize { + let files = self.files.borrow(); + match files.last() { + None => 0, + // Add one so there is some space between files. This lets us distinguish + // positions in the codemap, even in the presence of zero-length files. + Some(last) => last.end_pos.to_usize() + 1, + } + } + + /// Creates a new filemap without setting its line information. If you don't + /// intend to set the line information yourself, you should use new_filemap_and_lines. + pub fn new_filemap(&self, filename: FileName, abs_path: Option, + mut src: String) -> Rc { + let start_pos = self.next_start_pos(); + let mut files = self.files.borrow_mut(); + + // Remove utf-8 BOM if any. + if src.starts_with("\u{feff}") { + src.drain(..3); + } + + let end_pos = start_pos + src.len(); + + let filemap = Rc::new(FileMap { + name: filename, + abs_path: abs_path, + src: Some(Rc::new(src)), + start_pos: Pos::from_usize(start_pos), + end_pos: Pos::from_usize(end_pos), + lines: RefCell::new(Vec::new()), + multibyte_chars: RefCell::new(Vec::new()), + }); + + files.push(filemap.clone()); + + filemap + } + + /// Creates a new filemap and sets its line information. + pub fn new_filemap_and_lines(&self, filename: &str, abs_path: Option<&str>, + src: &str) -> Rc { + let fm = self.new_filemap(filename.to_string(), + abs_path.map(|s| s.to_owned()), + src.to_owned()); + let mut byte_pos: u32 = fm.start_pos.0; + for line in src.lines() { + // register the start of this line + fm.next_line(BytePos(byte_pos)); + + // update byte_pos to include this line and the \n at the end + byte_pos += line.len() as u32 + 1; + } + fm + } + + + /// Allocates a new FileMap representing a source file from an external + /// crate. The source code of such an "imported filemap" is not available, + /// but we still know enough to generate accurate debuginfo location + /// information for things inlined from other crates. + pub fn new_imported_filemap(&self, + filename: FileName, + abs_path: Option, + source_len: usize, + mut file_local_lines: Vec, + mut file_local_multibyte_chars: Vec) + -> Rc { + let start_pos = self.next_start_pos(); + let mut files = self.files.borrow_mut(); + + let end_pos = Pos::from_usize(start_pos + source_len); + let start_pos = Pos::from_usize(start_pos); + + for pos in &mut file_local_lines { + *pos = *pos + start_pos; + } + + for mbc in &mut file_local_multibyte_chars { + mbc.pos = mbc.pos + start_pos; + } + + let filemap = Rc::new(FileMap { + name: filename, + abs_path: abs_path, + src: None, + start_pos: start_pos, + end_pos: end_pos, + lines: RefCell::new(file_local_lines), + multibyte_chars: RefCell::new(file_local_multibyte_chars), + }); + + files.push(filemap.clone()); + + filemap + } + + pub fn mk_substr_filename(&self, sp: Span) -> String { + let pos = self.lookup_char_pos(sp.lo); + (format!("<{}:{}:{}>", + pos.file.name, + pos.line, + pos.col.to_usize() + 1)).to_string() + } + + /// Lookup source information about a BytePos + pub fn lookup_char_pos(&self, pos: BytePos) -> Loc { + let chpos = self.bytepos_to_file_charpos(pos); + match self.lookup_line(pos) { + Ok(FileMapAndLine { fm: f, line: a }) => { + let line = a + 1; // Line numbers start at 1 + let linebpos = (*f.lines.borrow())[a]; + let linechpos = self.bytepos_to_file_charpos(linebpos); + debug!("byte pos {:?} is on the line at byte pos {:?}", + pos, linebpos); + debug!("char pos {:?} is on the line at char pos {:?}", + chpos, linechpos); + debug!("byte is on line: {}", line); + assert!(chpos >= linechpos); + Loc { + file: f, + line: line, + col: chpos - linechpos, + } + } + Err(f) => { + Loc { + file: f, + line: 0, + col: chpos, + } + } + } + } + + // If the relevant filemap is empty, we don't return a line number. + fn lookup_line(&self, pos: BytePos) -> Result> { + let idx = self.lookup_filemap_idx(pos); + + let files = self.files.borrow(); + let f = (*files)[idx].clone(); + + match f.lookup_line(pos) { + Some(line) => Ok(FileMapAndLine { fm: f, line: line }), + None => Err(f) + } + } + + pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt { + let loc = self.lookup_char_pos(pos); + LocWithOpt { + filename: loc.file.name.to_string(), + line: loc.line, + col: loc.col, + file: Some(loc.file) + } + } + + /// Returns `Some(span)`, a union of the lhs and rhs span. The lhs must precede the rhs. If + /// there are gaps between lhs and rhs, the resulting union will cross these gaps. + /// For this to work, the spans have to be: + /// * the expn_id of both spans much match + /// * the lhs span needs to end on the same line the rhs span begins + /// * the lhs span must start at or before the rhs span + pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option { + use std::cmp; + + // make sure we're at the same expansion id + if sp_lhs.expn_id != sp_rhs.expn_id { + return None; + } + + let lhs_end = match self.lookup_line(sp_lhs.hi) { + Ok(x) => x, + Err(_) => return None + }; + let rhs_begin = match self.lookup_line(sp_rhs.lo) { + Ok(x) => x, + Err(_) => return None + }; + + // if we must cross lines to merge, don't merge + if lhs_end.line != rhs_begin.line { + return None; + } + + // ensure these follow the expected order and we don't overlap + if (sp_lhs.lo <= sp_rhs.lo) && (sp_lhs.hi <= sp_rhs.lo) { + Some(Span { + lo: cmp::min(sp_lhs.lo, sp_rhs.lo), + hi: cmp::max(sp_lhs.hi, sp_rhs.hi), + expn_id: sp_lhs.expn_id, + }) + } else { + None + } + } + + pub fn span_to_string(&self, sp: Span) -> String { + if sp == COMMAND_LINE_SP { + return "".to_string(); + } + + if self.files.borrow().is_empty() && sp.source_equal(&DUMMY_SP) { + return "no-location".to_string(); + } + + let lo = self.lookup_char_pos_adj(sp.lo); + let hi = self.lookup_char_pos_adj(sp.hi); + return (format!("{}:{}:{}: {}:{}", + lo.filename, + lo.line, + lo.col.to_usize() + 1, + hi.line, + hi.col.to_usize() + 1)).to_string() + } + + // Returns true if two spans have the same callee + // (Assumes the same ExpnFormat implies same callee) + fn match_callees(&self, sp_a: &Span, sp_b: &Span) -> bool { + let fmt_a = self + .with_expn_info(sp_a.expn_id, + |ei| ei.map(|ei| ei.callee.format.clone())); + + let fmt_b = self + .with_expn_info(sp_b.expn_id, + |ei| ei.map(|ei| ei.callee.format.clone())); + fmt_a == fmt_b + } + + /// Returns a formatted string showing the expansion chain of a span + /// + /// Spans are printed in the following format: + /// + /// filename:start_line:col: end_line:col + /// snippet + /// Callee: + /// Callee span + /// Callsite: + /// Callsite span + /// + /// Callees and callsites are printed recursively (if available, otherwise header + /// and span is omitted), expanding into their own callee/callsite spans. + /// Each layer of recursion has an increased indent, and snippets are truncated + /// to at most 50 characters. Finally, recursive calls to the same macro are squashed, + /// with '...' used to represent any number of recursive calls. + pub fn span_to_expanded_string(&self, sp: Span) -> String { + self.span_to_expanded_string_internal(sp, "") + } + + fn span_to_expanded_string_internal(&self, sp:Span, indent: &str) -> String { + let mut indent = indent.to_owned(); + let mut output = "".to_owned(); + let span_str = self.span_to_string(sp); + let mut span_snip = self.span_to_snippet(sp) + .unwrap_or("Snippet unavailable".to_owned()); + + // Truncate by code points - in worst case this will be more than 50 characters, + // but ensures at least 50 characters and respects byte boundaries. + let char_vec: Vec<(usize, char)> = span_snip.char_indices().collect(); + if char_vec.len() > 50 { + span_snip.truncate(char_vec[49].0); + span_snip.push_str("..."); + } + + output.push_str(&format!("{}{}\n{}`{}`\n", indent, span_str, indent, span_snip)); + + if sp.expn_id == NO_EXPANSION || sp.expn_id == COMMAND_LINE_EXPN { + return output; + } + + let mut callee = self.with_expn_info(sp.expn_id, + |ei| ei.and_then(|ei| ei.callee.span.clone())); + let mut callsite = self.with_expn_info(sp.expn_id, + |ei| ei.map(|ei| ei.call_site.clone())); + + indent.push_str(" "); + let mut is_recursive = false; + + while callee.is_some() && self.match_callees(&sp, &callee.unwrap()) { + callee = self.with_expn_info(callee.unwrap().expn_id, + |ei| ei.and_then(|ei| ei.callee.span.clone())); + is_recursive = true; + } + if let Some(span) = callee { + output.push_str(&indent); + output.push_str("Callee:\n"); + if is_recursive { + output.push_str(&indent); + output.push_str("...\n"); + } + output.push_str(&(self.span_to_expanded_string_internal(span, &indent))); + } + + is_recursive = false; + while callsite.is_some() && self.match_callees(&sp, &callsite.unwrap()) { + callsite = self.with_expn_info(callsite.unwrap().expn_id, + |ei| ei.map(|ei| ei.call_site.clone())); + is_recursive = true; + } + if let Some(span) = callsite { + output.push_str(&indent); + output.push_str("Callsite:\n"); + if is_recursive { + output.push_str(&indent); + output.push_str("...\n"); + } + output.push_str(&(self.span_to_expanded_string_internal(span, &indent))); + } + output + } + + /// Return the source span - this is either the supplied span, or the span for + /// the macro callsite that expanded to it. + pub fn source_callsite(&self, sp: Span) -> Span { + let mut span = sp; + // Special case - if a macro is parsed as an argument to another macro, the source + // callsite is the first callsite, which is also source-equivalent to the span. + let mut first = true; + while span.expn_id != NO_EXPANSION && span.expn_id != COMMAND_LINE_EXPN { + if let Some(callsite) = self.with_expn_info(span.expn_id, + |ei| ei.map(|ei| ei.call_site.clone())) { + if first && span.source_equal(&callsite) { + if self.lookup_char_pos(span.lo).file.is_real_file() { + return Span { expn_id: NO_EXPANSION, .. span }; + } + } + first = false; + span = callsite; + } + else { + break; + } + } + span + } + + /// Return the source callee. + /// + /// Returns None if the supplied span has no expansion trace, + /// else returns the NameAndSpan for the macro definition + /// corresponding to the source callsite. + pub fn source_callee(&self, sp: Span) -> Option { + let mut span = sp; + // Special case - if a macro is parsed as an argument to another macro, the source + // callsite is source-equivalent to the span, and the source callee is the first callee. + let mut first = true; + while let Some(callsite) = self.with_expn_info(span.expn_id, + |ei| ei.map(|ei| ei.call_site.clone())) { + if first && span.source_equal(&callsite) { + if self.lookup_char_pos(span.lo).file.is_real_file() { + return self.with_expn_info(span.expn_id, + |ei| ei.map(|ei| ei.callee.clone())); + } + } + first = false; + if let Some(_) = self.with_expn_info(callsite.expn_id, + |ei| ei.map(|ei| ei.call_site.clone())) { + span = callsite; + } + else { + return self.with_expn_info(span.expn_id, + |ei| ei.map(|ei| ei.callee.clone())); + } + } + None + } + + pub fn span_to_filename(&self, sp: Span) -> FileName { + self.lookup_char_pos(sp.lo).file.name.to_string() + } + + pub fn span_to_lines(&self, sp: Span) -> FileLinesResult { + debug!("span_to_lines(sp={:?})", sp); + + if sp.lo > sp.hi { + return Err(SpanLinesError::IllFormedSpan(sp)); + } + + let lo = self.lookup_char_pos(sp.lo); + debug!("span_to_lines: lo={:?}", lo); + let hi = self.lookup_char_pos(sp.hi); + debug!("span_to_lines: hi={:?}", hi); + + if lo.file.start_pos != hi.file.start_pos { + return Err(SpanLinesError::DistinctSources(DistinctSources { + begin: (lo.file.name.clone(), lo.file.start_pos), + end: (hi.file.name.clone(), hi.file.start_pos), + })); + } + assert!(hi.line >= lo.line); + + let mut lines = Vec::with_capacity(hi.line - lo.line + 1); + + // The span starts partway through the first line, + // but after that it starts from offset 0. + let mut start_col = lo.col; + + // For every line but the last, it extends from `start_col` + // and to the end of the line. Be careful because the line + // numbers in Loc are 1-based, so we subtract 1 to get 0-based + // lines. + for line_index in lo.line-1 .. hi.line-1 { + let line_len = lo.file.get_line(line_index) + .map(|s| s.chars().count()) + .unwrap_or(0); + lines.push(LineInfo { line_index: line_index, + start_col: start_col, + end_col: CharPos::from_usize(line_len) }); + start_col = CharPos::from_usize(0); + } + + // For the last line, it extends from `start_col` to `hi.col`: + lines.push(LineInfo { line_index: hi.line - 1, + start_col: start_col, + end_col: hi.col }); + + Ok(FileLines {file: lo.file, lines: lines}) + } + + pub fn span_to_snippet(&self, sp: Span) -> Result { + if sp.lo > sp.hi { + return Err(SpanSnippetError::IllFormedSpan(sp)); + } + + let local_begin = self.lookup_byte_offset(sp.lo); + let local_end = self.lookup_byte_offset(sp.hi); + + if local_begin.fm.start_pos != local_end.fm.start_pos { + return Err(SpanSnippetError::DistinctSources(DistinctSources { + begin: (local_begin.fm.name.clone(), + local_begin.fm.start_pos), + end: (local_end.fm.name.clone(), + local_end.fm.start_pos) + })); + } else { + match local_begin.fm.src { + Some(ref src) => { + let start_index = local_begin.pos.to_usize(); + let end_index = local_end.pos.to_usize(); + let source_len = (local_begin.fm.end_pos - + local_begin.fm.start_pos).to_usize(); + + if start_index > end_index || end_index > source_len { + return Err(SpanSnippetError::MalformedForCodemap( + MalformedCodemapPositions { + name: local_begin.fm.name.clone(), + source_len: source_len, + begin_pos: local_begin.pos, + end_pos: local_end.pos, + })); + } + + return Ok((&src[start_index..end_index]).to_string()) + } + None => { + return Err(SpanSnippetError::SourceNotAvailable { + filename: local_begin.fm.name.clone() + }); + } + } + } + } + + pub fn get_filemap(&self, filename: &str) -> Option> { + for fm in self.files.borrow().iter() { + if filename == fm.name { + return Some(fm.clone()); + } + } + None + } + + /// For a global BytePos compute the local offset within the containing FileMap + pub fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos { + let idx = self.lookup_filemap_idx(bpos); + let fm = (*self.files.borrow())[idx].clone(); + let offset = bpos - fm.start_pos; + FileMapAndBytePos {fm: fm, pos: offset} + } + + /// Converts an absolute BytePos to a CharPos relative to the filemap. + pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos { + let idx = self.lookup_filemap_idx(bpos); + let files = self.files.borrow(); + let map = &(*files)[idx]; + + // The number of extra bytes due to multibyte chars in the FileMap + let mut total_extra_bytes = 0; + + for mbc in map.multibyte_chars.borrow().iter() { + debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos); + if mbc.pos < bpos { + // every character is at least one byte, so we only + // count the actual extra bytes. + total_extra_bytes += mbc.bytes - 1; + // We should never see a byte position in the middle of a + // character + assert!(bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes); + } else { + break; + } + } + + assert!(map.start_pos.to_usize() + total_extra_bytes <= bpos.to_usize()); + CharPos(bpos.to_usize() - map.start_pos.to_usize() - total_extra_bytes) + } + + // Return the index of the filemap (in self.files) which contains pos. + pub fn lookup_filemap_idx(&self, pos: BytePos) -> usize { + let files = self.files.borrow(); + let files = &*files; + let count = files.len(); + + // Binary search for the filemap. + let mut a = 0; + let mut b = count; + while b - a > 1 { + let m = (a + b) / 2; + if files[m].start_pos > pos { + b = m; + } else { + a = m; + } + } + + assert!(a < count, "position {} does not resolve to a source location", pos.to_usize()); + + return a; + } + + pub fn record_expansion(&self, expn_info: ExpnInfo) -> ExpnId { + let mut expansions = self.expansions.borrow_mut(); + expansions.push(expn_info); + let len = expansions.len(); + if len > u32::max_value() as usize { + panic!("too many ExpnInfo's!"); + } + ExpnId(len as u32 - 1) + } + + pub fn with_expn_info(&self, id: ExpnId, f: F) -> T where + F: FnOnce(Option<&ExpnInfo>) -> T, + { + match id { + NO_EXPANSION | COMMAND_LINE_EXPN => f(None), + ExpnId(i) => f(Some(&(*self.expansions.borrow())[i as usize])) + } + } + + /// Check if a span is "internal" to a macro in which #[unstable] + /// items can be used (that is, a macro marked with + /// `#[allow_internal_unstable]`). + pub fn span_allows_unstable(&self, span: Span) -> bool { + debug!("span_allows_unstable(span = {:?})", span); + let mut allows_unstable = false; + let mut expn_id = span.expn_id; + loop { + let quit = self.with_expn_info(expn_id, |expninfo| { + debug!("span_allows_unstable: expninfo = {:?}", expninfo); + expninfo.map_or(/* hit the top level */ true, |info| { + + let span_comes_from_this_expansion = + info.callee.span.map_or(span.source_equal(&info.call_site), |mac_span| { + mac_span.contains(span) + }); + + debug!("span_allows_unstable: span: {:?} call_site: {:?} callee: {:?}", + (span.lo, span.hi), + (info.call_site.lo, info.call_site.hi), + info.callee.span.map(|x| (x.lo, x.hi))); + debug!("span_allows_unstable: from this expansion? {}, allows unstable? {}", + span_comes_from_this_expansion, + info.callee.allow_internal_unstable); + if span_comes_from_this_expansion { + allows_unstable = info.callee.allow_internal_unstable; + // we've found the right place, stop looking + true + } else { + // not the right place, keep looking + expn_id = info.call_site.expn_id; + false + } + }) + }); + if quit { + break + } + } + debug!("span_allows_unstable? {}", allows_unstable); + allows_unstable + } + + pub fn count_lines(&self) -> usize { + self.files.borrow().iter().fold(0, |a, f| a + f.count_lines()) + } + + pub fn macro_backtrace(&self, span: Span) -> Vec { + let mut prev_span = DUMMY_SP; + let mut span = span; + let mut result = vec![]; + loop { + let span_name_span = self.with_expn_info(span.expn_id, |expn_info| { + expn_info.map(|ei| { + let (pre, post) = match ei.callee.format { + MacroAttribute(..) => ("#[", "]"), + MacroBang(..) => ("", "!"), + CompilerDesugaring(..) => ("desugaring of `", "`"), + }; + let macro_decl_name = format!("{}{}{}", + pre, + ei.callee.name(), + post); + let def_site_span = ei.callee.span; + (ei.call_site, macro_decl_name, def_site_span) + }) + }); + + match span_name_span { + None => break, + Some((call_site, macro_decl_name, def_site_span)) => { + // Don't print recursive invocations + if !call_site.source_equal(&prev_span) { + result.push(MacroBacktrace { + call_site: call_site, + macro_decl_name: macro_decl_name, + def_site_span: def_site_span, + }); + } + prev_span = span; + span = call_site; + } + } + } + result + } +} + +impl CodeMapper for CodeMap { + fn lookup_char_pos(&self, pos: BytePos) -> Loc { + self.lookup_char_pos(pos) + } + fn span_to_lines(&self, sp: Span) -> FileLinesResult { + self.span_to_lines(sp) + } + fn span_to_string(&self, sp: Span) -> String { + self.span_to_string(sp) + } + fn span_to_filename(&self, sp: Span) -> FileName { + self.span_to_filename(sp) + } + fn macro_backtrace(&self, span: Span) -> Vec { + self.macro_backtrace(span) + } + fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option { + self.merge_spans(sp_lhs, sp_rhs) + } +} + +// _____________________________________________________________________________ +// Tests +// + +#[cfg(test)] +mod tests { + use super::*; + use symbol::keywords; + use std::rc::Rc; + + #[test] + fn t1 () { + let cm = CodeMap::new(); + let fm = cm.new_filemap("blork.rs".to_string(), + None, + "first line.\nsecond line".to_string()); + fm.next_line(BytePos(0)); + // Test we can get lines with partial line info. + assert_eq!(fm.get_line(0), Some("first line.")); + // TESTING BROKEN BEHAVIOR: line break declared before actual line break. + fm.next_line(BytePos(10)); + assert_eq!(fm.get_line(1), Some(".")); + fm.next_line(BytePos(12)); + assert_eq!(fm.get_line(2), Some("second line")); + } + + #[test] + #[should_panic] + fn t2 () { + let cm = CodeMap::new(); + let fm = cm.new_filemap("blork.rs".to_string(), + None, + "first line.\nsecond line".to_string()); + // TESTING *REALLY* BROKEN BEHAVIOR: + fm.next_line(BytePos(0)); + fm.next_line(BytePos(10)); + fm.next_line(BytePos(2)); + } + + fn init_code_map() -> CodeMap { + let cm = CodeMap::new(); + let fm1 = cm.new_filemap("blork.rs".to_string(), + None, + "first line.\nsecond line".to_string()); + let fm2 = cm.new_filemap("empty.rs".to_string(), + None, + "".to_string()); + let fm3 = cm.new_filemap("blork2.rs".to_string(), + None, + "first line.\nsecond line".to_string()); + + fm1.next_line(BytePos(0)); + fm1.next_line(BytePos(12)); + fm2.next_line(fm2.start_pos); + fm3.next_line(fm3.start_pos); + fm3.next_line(fm3.start_pos + BytePos(12)); + + cm + } + + #[test] + fn t3() { + // Test lookup_byte_offset + let cm = init_code_map(); + + let fmabp1 = cm.lookup_byte_offset(BytePos(23)); + assert_eq!(fmabp1.fm.name, "blork.rs"); + assert_eq!(fmabp1.pos, BytePos(23)); + + let fmabp1 = cm.lookup_byte_offset(BytePos(24)); + assert_eq!(fmabp1.fm.name, "empty.rs"); + assert_eq!(fmabp1.pos, BytePos(0)); + + let fmabp2 = cm.lookup_byte_offset(BytePos(25)); + assert_eq!(fmabp2.fm.name, "blork2.rs"); + assert_eq!(fmabp2.pos, BytePos(0)); + } + + #[test] + fn t4() { + // Test bytepos_to_file_charpos + let cm = init_code_map(); + + let cp1 = cm.bytepos_to_file_charpos(BytePos(22)); + assert_eq!(cp1, CharPos(22)); + + let cp2 = cm.bytepos_to_file_charpos(BytePos(25)); + assert_eq!(cp2, CharPos(0)); + } + + #[test] + fn t5() { + // Test zero-length filemaps. + let cm = init_code_map(); + + let loc1 = cm.lookup_char_pos(BytePos(22)); + assert_eq!(loc1.file.name, "blork.rs"); + assert_eq!(loc1.line, 2); + assert_eq!(loc1.col, CharPos(10)); + + let loc2 = cm.lookup_char_pos(BytePos(25)); + assert_eq!(loc2.file.name, "blork2.rs"); + assert_eq!(loc2.line, 1); + assert_eq!(loc2.col, CharPos(0)); + } + + fn init_code_map_mbc() -> CodeMap { + let cm = CodeMap::new(); + // € is a three byte utf8 char. + let fm1 = + cm.new_filemap("blork.rs".to_string(), + None, + "fir€st €€€€ line.\nsecond line".to_string()); + let fm2 = cm.new_filemap("blork2.rs".to_string(), + None, + "first line€€.\n€ second line".to_string()); + + fm1.next_line(BytePos(0)); + fm1.next_line(BytePos(28)); + fm2.next_line(fm2.start_pos); + fm2.next_line(fm2.start_pos + BytePos(20)); + + fm1.record_multibyte_char(BytePos(3), 3); + fm1.record_multibyte_char(BytePos(9), 3); + fm1.record_multibyte_char(BytePos(12), 3); + fm1.record_multibyte_char(BytePos(15), 3); + fm1.record_multibyte_char(BytePos(18), 3); + fm2.record_multibyte_char(fm2.start_pos + BytePos(10), 3); + fm2.record_multibyte_char(fm2.start_pos + BytePos(13), 3); + fm2.record_multibyte_char(fm2.start_pos + BytePos(18), 3); + + cm + } + + #[test] + fn t6() { + // Test bytepos_to_file_charpos in the presence of multi-byte chars + let cm = init_code_map_mbc(); + + let cp1 = cm.bytepos_to_file_charpos(BytePos(3)); + assert_eq!(cp1, CharPos(3)); + + let cp2 = cm.bytepos_to_file_charpos(BytePos(6)); + assert_eq!(cp2, CharPos(4)); + + let cp3 = cm.bytepos_to_file_charpos(BytePos(56)); + assert_eq!(cp3, CharPos(12)); + + let cp4 = cm.bytepos_to_file_charpos(BytePos(61)); + assert_eq!(cp4, CharPos(15)); + } + + #[test] + fn t7() { + // Test span_to_lines for a span ending at the end of filemap + let cm = init_code_map(); + let span = Span {lo: BytePos(12), hi: BytePos(23), expn_id: NO_EXPANSION}; + let file_lines = cm.span_to_lines(span).unwrap(); + + assert_eq!(file_lines.file.name, "blork.rs"); + assert_eq!(file_lines.lines.len(), 1); + assert_eq!(file_lines.lines[0].line_index, 1); + } + + /// Given a string like " ~~~~~~~~~~~~ ", produces a span + /// coverting that range. The idea is that the string has the same + /// length as the input, and we uncover the byte positions. Note + /// that this can span lines and so on. + fn span_from_selection(input: &str, selection: &str) -> Span { + assert_eq!(input.len(), selection.len()); + let left_index = selection.find('~').unwrap() as u32; + let right_index = selection.rfind('~').map(|x|x as u32).unwrap_or(left_index); + Span { lo: BytePos(left_index), hi: BytePos(right_index + 1), expn_id: NO_EXPANSION } + } + + /// Test span_to_snippet and span_to_lines for a span coverting 3 + /// lines in the middle of a file. + #[test] + fn span_to_snippet_and_lines_spanning_multiple_lines() { + let cm = CodeMap::new(); + let inputtext = "aaaaa\nbbbbBB\nCCC\nDDDDDddddd\neee\n"; + let selection = " \n ~~\n~~~\n~~~~~ \n \n"; + cm.new_filemap_and_lines("blork.rs", None, inputtext); + let span = span_from_selection(inputtext, selection); + + // check that we are extracting the text we thought we were extracting + assert_eq!(&cm.span_to_snippet(span).unwrap(), "BB\nCCC\nDDDDD"); + + // check that span_to_lines gives us the complete result with the lines/cols we expected + let lines = cm.span_to_lines(span).unwrap(); + let expected = vec![ + LineInfo { line_index: 1, start_col: CharPos(4), end_col: CharPos(6) }, + LineInfo { line_index: 2, start_col: CharPos(0), end_col: CharPos(3) }, + LineInfo { line_index: 3, start_col: CharPos(0), end_col: CharPos(5) } + ]; + assert_eq!(lines.lines, expected); + } + + #[test] + fn t8() { + // Test span_to_snippet for a span ending at the end of filemap + let cm = init_code_map(); + let span = Span {lo: BytePos(12), hi: BytePos(23), expn_id: NO_EXPANSION}; + let snippet = cm.span_to_snippet(span); + + assert_eq!(snippet, Ok("second line".to_string())); + } + + #[test] + fn t9() { + // Test span_to_str for a span ending at the end of filemap + let cm = init_code_map(); + let span = Span {lo: BytePos(12), hi: BytePos(23), expn_id: NO_EXPANSION}; + let sstr = cm.span_to_string(span); + + assert_eq!(sstr, "blork.rs:2:1: 2:12"); + } + + #[test] + fn t10() { + // Test span_to_expanded_string works in base case (no expansion) + let cm = init_code_map(); + let span = Span { lo: BytePos(0), hi: BytePos(11), expn_id: NO_EXPANSION }; + let sstr = cm.span_to_expanded_string(span); + assert_eq!(sstr, "blork.rs:1:1: 1:12\n`first line.`\n"); + + let span = Span { lo: BytePos(12), hi: BytePos(23), expn_id: NO_EXPANSION }; + let sstr = cm.span_to_expanded_string(span); + assert_eq!(sstr, "blork.rs:2:1: 2:12\n`second line`\n"); + } + + #[test] + fn t11() { + // Test span_to_expanded_string works with expansion + let cm = init_code_map(); + let root = Span { lo: BytePos(0), hi: BytePos(11), expn_id: NO_EXPANSION }; + let format = ExpnFormat::MacroBang(keywords::Invalid.name()); + let callee = NameAndSpan { format: format, + allow_internal_unstable: false, + span: None }; + + let info = ExpnInfo { call_site: root, callee: callee }; + let id = cm.record_expansion(info); + let sp = Span { lo: BytePos(12), hi: BytePos(23), expn_id: id }; + + let sstr = cm.span_to_expanded_string(sp); + assert_eq!(sstr, + "blork.rs:2:1: 2:12\n`second line`\n Callsite:\n \ + blork.rs:1:1: 1:12\n `first line.`\n"); + } + + /// Test merging two spans on the same line + #[test] + fn span_merging() { + let cm = CodeMap::new(); + let inputtext = "bbbb BB bb CCC\n"; + let selection1 = " ~~ \n"; + let selection2 = " ~~~\n"; + cm.new_filemap_and_lines("blork.rs", None, inputtext); + let span1 = span_from_selection(inputtext, selection1); + let span2 = span_from_selection(inputtext, selection2); + + if let Some(sp) = cm.merge_spans(span1, span2) { + let sstr = cm.span_to_expanded_string(sp); + assert_eq!(sstr, "blork.rs:1:6: 1:15\n`BB bb CCC`\n"); + } + else { + assert!(false); + } + } + + /// Test failing to merge two spans on different lines + #[test] + fn span_merging_fail() { + let cm = CodeMap::new(); + let inputtext = "bbbb BB\ncc CCC\n"; + let selection1 = " ~~\n \n"; + let selection2 = " \n ~~~\n"; + cm.new_filemap_and_lines("blork.rs", None, inputtext); + let span1 = span_from_selection(inputtext, selection1); + let span2 = span_from_selection(inputtext, selection2); + + assert!(cm.merge_spans(span1, span2).is_none()); + } + + /// Returns the span corresponding to the `n`th occurrence of + /// `substring` in `source_text`. + trait CodeMapExtension { + fn span_substr(&self, + file: &Rc, + source_text: &str, + substring: &str, + n: usize) + -> Span; + } + + impl CodeMapExtension for CodeMap { + fn span_substr(&self, + file: &Rc, + source_text: &str, + substring: &str, + n: usize) + -> Span + { + println!("span_substr(file={:?}/{:?}, substring={:?}, n={})", + file.name, file.start_pos, substring, n); + let mut i = 0; + let mut hi = 0; + loop { + let offset = source_text[hi..].find(substring).unwrap_or_else(|| { + panic!("source_text `{}` does not have {} occurrences of `{}`, only {}", + source_text, n, substring, i); + }); + let lo = hi + offset; + hi = lo + substring.len(); + if i == n { + let span = Span { + lo: BytePos(lo as u32 + file.start_pos.0), + hi: BytePos(hi as u32 + file.start_pos.0), + expn_id: NO_EXPANSION, + }; + assert_eq!(&self.span_to_snippet(span).unwrap()[..], + substring); + return span; + } + i += 1; + } + } + } + + fn init_expansion_chain(cm: &CodeMap) -> Span { + // Creates an expansion chain containing two recursive calls + // root -> expA -> expA -> expB -> expB -> end + let root = Span { lo: BytePos(0), hi: BytePos(11), expn_id: NO_EXPANSION }; + + let format_root = ExpnFormat::MacroBang(keywords::Invalid.name()); + let callee_root = NameAndSpan { format: format_root, + allow_internal_unstable: false, + span: Some(root) }; + + let info_a1 = ExpnInfo { call_site: root, callee: callee_root }; + let id_a1 = cm.record_expansion(info_a1); + let span_a1 = Span { lo: BytePos(12), hi: BytePos(23), expn_id: id_a1 }; + + let format_a = ExpnFormat::MacroBang(keywords::As.name()); + let callee_a = NameAndSpan { format: format_a, + allow_internal_unstable: false, + span: Some(span_a1) }; + + let info_a2 = ExpnInfo { call_site: span_a1, callee: callee_a.clone() }; + let id_a2 = cm.record_expansion(info_a2); + let span_a2 = Span { lo: BytePos(12), hi: BytePos(23), expn_id: id_a2 }; + + let info_b1 = ExpnInfo { call_site: span_a2, callee: callee_a }; + let id_b1 = cm.record_expansion(info_b1); + let span_b1 = Span { lo: BytePos(25), hi: BytePos(36), expn_id: id_b1 }; + + let format_b = ExpnFormat::MacroBang(keywords::Box.name()); + let callee_b = NameAndSpan { format: format_b, + allow_internal_unstable: false, + span: None }; + + let info_b2 = ExpnInfo { call_site: span_b1, callee: callee_b.clone() }; + let id_b2 = cm.record_expansion(info_b2); + let span_b2 = Span { lo: BytePos(25), hi: BytePos(36), expn_id: id_b2 }; + + let info_end = ExpnInfo { call_site: span_b2, callee: callee_b }; + let id_end = cm.record_expansion(info_end); + Span { lo: BytePos(37), hi: BytePos(48), expn_id: id_end } + } + + #[test] + fn t12() { + // Test span_to_expanded_string collapses recursive macros and handles + // recursive callsite and callee expansions + let cm = init_code_map(); + let end = init_expansion_chain(&cm); + let sstr = cm.span_to_expanded_string(end); + let res_str = +r"blork2.rs:2:1: 2:12 +`second line` + Callsite: + ... + blork2.rs:1:1: 1:12 + `first line.` + Callee: + blork.rs:2:1: 2:12 + `second line` + Callee: + blork.rs:1:1: 1:12 + `first line.` + Callsite: + blork.rs:1:1: 1:12 + `first line.` + Callsite: + ... + blork.rs:2:1: 2:12 + `second line` + Callee: + blork.rs:1:1: 1:12 + `first line.` + Callsite: + blork.rs:1:1: 1:12 + `first line.` +"; + assert_eq!(sstr, res_str); + } +} diff --git a/third_party/rust/syntex_syntax/src/config.rs b/third_party/rust/syntex_syntax/src/config.rs new file mode 100644 index 000000000000..d08f9d9032ea --- /dev/null +++ b/third_party/rust/syntex_syntax/src/config.rs @@ -0,0 +1,312 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use attr::HasAttrs; +use feature_gate::{feature_err, EXPLAIN_STMT_ATTR_SYNTAX, Features, get_features, GateIssue}; +use {fold, attr}; +use ast; +use codemap::Spanned; +use parse::ParseSess; +use ptr::P; + +use util::small_vector::SmallVector; + +/// A folder that strips out items that do not belong in the current configuration. +pub struct StripUnconfigured<'a> { + pub should_test: bool, + pub sess: &'a ParseSess, + pub features: Option<&'a Features>, +} + +// `cfg_attr`-process the crate's attributes and compute the crate's features. +pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool) + -> (ast::Crate, Features) { + let features; + { + let mut strip_unconfigured = StripUnconfigured { + should_test: should_test, + sess: sess, + features: None, + }; + + let unconfigured_attrs = krate.attrs.clone(); + let err_count = sess.span_diagnostic.err_count(); + if let Some(attrs) = strip_unconfigured.configure(krate.attrs) { + krate.attrs = attrs; + } else { // the entire crate is unconfigured + krate.attrs = Vec::new(); + krate.module.items = Vec::new(); + return (krate, Features::new()); + } + + features = get_features(&sess.span_diagnostic, &krate.attrs); + + // Avoid reconfiguring malformed `cfg_attr`s + if err_count == sess.span_diagnostic.err_count() { + strip_unconfigured.features = Some(&features); + strip_unconfigured.configure(unconfigured_attrs); + } + } + + (krate, features) +} + +macro_rules! configure { + ($this:ident, $node:ident) => { + match $this.configure($node) { + Some(node) => node, + None => return Default::default(), + } + } +} + +impl<'a> StripUnconfigured<'a> { + pub fn configure(&mut self, node: T) -> Option { + let node = self.process_cfg_attrs(node); + // FIXME(syntex): ignore unknown attributes + //if self.in_cfg(node.attrs()) { Some(node) } else { None } + Some(node) + } + + pub fn process_cfg_attrs(&mut self, node: T) -> T { + node.map_attrs(|attrs| { + attrs.into_iter().filter_map(|attr| self.process_cfg_attr(attr)).collect() + }) + } + + fn process_cfg_attr(&mut self, attr: ast::Attribute) -> Option { + if !attr.check_name("cfg_attr") { + return Some(attr); + } + + let attr_list = match attr.meta_item_list() { + Some(attr_list) => attr_list, + None => { + let msg = "expected `#[cfg_attr(, )]`"; + self.sess.span_diagnostic.span_err(attr.span, msg); + return None; + } + }; + + let (cfg, mi) = match (attr_list.len(), attr_list.get(0), attr_list.get(1)) { + (2, Some(cfg), Some(mi)) => (cfg, mi), + _ => { + let msg = "expected `#[cfg_attr(, )]`"; + self.sess.span_diagnostic.span_err(attr.span, msg); + return None; + } + }; + + use attr::cfg_matches; + match (cfg.meta_item(), mi.meta_item()) { + (Some(cfg), Some(mi)) => + if cfg_matches(&cfg, self.sess, self.features) { + self.process_cfg_attr(ast::Attribute { + id: attr::mk_attr_id(), + style: attr.style, + value: mi.clone(), + is_sugared_doc: false, + span: mi.span, + }) + } else { + None + }, + _ => { + let msg = "unexpected literal(s) in `#[cfg_attr(, )]`"; + self.sess.span_diagnostic.span_err(attr.span, msg); + None + } + } + } + + // Determine if a node with the given attributes should be included in this configuation. + pub fn in_cfg(&mut self, attrs: &[ast::Attribute]) -> bool { + attrs.iter().all(|attr| { + // When not compiling with --test we should not compile the #[test] functions + if !self.should_test && is_test_or_bench(attr) { + return false; + } + + let mis = match attr.value.node { + ast::MetaItemKind::List(ref mis) if is_cfg(&attr) => mis, + _ => return true + }; + + if mis.len() != 1 { + self.sess.span_diagnostic.span_err(attr.span, "expected 1 cfg-pattern"); + return true; + } + + if !mis[0].is_meta_item() { + self.sess.span_diagnostic.span_err(mis[0].span, "unexpected literal"); + return true; + } + + attr::cfg_matches(mis[0].meta_item().unwrap(), self.sess, self.features) + }) + } + + // Visit attributes on expression and statements (but not attributes on items in blocks). + fn visit_expr_attrs(&mut self, attrs: &[ast::Attribute]) { + // flag the offending attributes + for attr in attrs.iter() { + if !self.features.map(|features| features.stmt_expr_attributes).unwrap_or(true) { + let mut err = feature_err(&self.sess, + "stmt_expr_attributes", + attr.span, + GateIssue::Language, + EXPLAIN_STMT_ATTR_SYNTAX); + if attr.is_sugared_doc { + err.help("`///` is for documentation comments. For a plain comment, use `//`."); + } + err.emit(); + } + } + } + + pub fn configure_foreign_mod(&mut self, foreign_mod: ast::ForeignMod) -> ast::ForeignMod { + ast::ForeignMod { + abi: foreign_mod.abi, + items: foreign_mod.items.into_iter().filter_map(|item| self.configure(item)).collect(), + } + } + + fn configure_variant_data(&mut self, vdata: ast::VariantData) -> ast::VariantData { + match vdata { + ast::VariantData::Struct(fields, id) => { + let fields = fields.into_iter().filter_map(|field| self.configure(field)); + ast::VariantData::Struct(fields.collect(), id) + } + ast::VariantData::Tuple(fields, id) => { + let fields = fields.into_iter().filter_map(|field| self.configure(field)); + ast::VariantData::Tuple(fields.collect(), id) + } + ast::VariantData::Unit(id) => ast::VariantData::Unit(id) + } + } + + pub fn configure_item_kind(&mut self, item: ast::ItemKind) -> ast::ItemKind { + match item { + ast::ItemKind::Struct(def, generics) => { + ast::ItemKind::Struct(self.configure_variant_data(def), generics) + } + ast::ItemKind::Union(def, generics) => { + ast::ItemKind::Union(self.configure_variant_data(def), generics) + } + ast::ItemKind::Enum(def, generics) => { + let variants = def.variants.into_iter().filter_map(|v| { + self.configure(v).map(|v| { + Spanned { + node: ast::Variant_ { + name: v.node.name, + attrs: v.node.attrs, + data: self.configure_variant_data(v.node.data), + disr_expr: v.node.disr_expr, + }, + span: v.span + } + }) + }); + ast::ItemKind::Enum(ast::EnumDef { + variants: variants.collect(), + }, generics) + } + item => item, + } + } + + pub fn configure_expr_kind(&mut self, expr_kind: ast::ExprKind) -> ast::ExprKind { + if let ast::ExprKind::Match(m, arms) = expr_kind { + let arms = arms.into_iter().filter_map(|a| self.configure(a)).collect(); + ast::ExprKind::Match(m, arms) + } else { + expr_kind + } + } + + pub fn configure_expr(&mut self, expr: P) -> P { + self.visit_expr_attrs(expr.attrs()); + + // If an expr is valid to cfg away it will have been removed by the + // outer stmt or expression folder before descending in here. + // Anything else is always required, and thus has to error out + // in case of a cfg attr. + // + // NB: This is intentionally not part of the fold_expr() function + // in order for fold_opt_expr() to be able to avoid this check + if let Some(attr) = expr.attrs().iter().find(|a| is_cfg(a) || is_test_or_bench(a)) { + let msg = "removing an expression is not supported in this position"; + self.sess.span_diagnostic.span_err(attr.span, msg); + } + + self.process_cfg_attrs(expr) + } + + pub fn configure_stmt(&mut self, stmt: ast::Stmt) -> Option { + self.configure(stmt) + } +} + +impl<'a> fold::Folder for StripUnconfigured<'a> { + fn fold_foreign_mod(&mut self, foreign_mod: ast::ForeignMod) -> ast::ForeignMod { + let foreign_mod = self.configure_foreign_mod(foreign_mod); + fold::noop_fold_foreign_mod(foreign_mod, self) + } + + fn fold_item_kind(&mut self, item: ast::ItemKind) -> ast::ItemKind { + let item = self.configure_item_kind(item); + fold::noop_fold_item_kind(item, self) + } + + fn fold_expr(&mut self, expr: P) -> P { + let mut expr = self.configure_expr(expr).unwrap(); + expr.node = self.configure_expr_kind(expr.node); + P(fold::noop_fold_expr(expr, self)) + } + + fn fold_opt_expr(&mut self, expr: P) -> Option> { + let mut expr = configure!(self, expr).unwrap(); + expr.node = self.configure_expr_kind(expr.node); + Some(P(fold::noop_fold_expr(expr, self))) + } + + fn fold_stmt(&mut self, stmt: ast::Stmt) -> SmallVector { + match self.configure_stmt(stmt) { + Some(stmt) => fold::noop_fold_stmt(stmt, self), + None => return SmallVector::new(), + } + } + + fn fold_item(&mut self, item: P) -> SmallVector> { + fold::noop_fold_item(configure!(self, item), self) + } + + fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector { + fold::noop_fold_impl_item(configure!(self, item), self) + } + + fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector { + fold::noop_fold_trait_item(configure!(self, item), self) + } + + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { + // Don't configure interpolated AST (c.f. #34171). + // Interpolated AST will get configured once the surrounding tokens are parsed. + mac + } +} + +fn is_cfg(attr: &ast::Attribute) -> bool { + attr.check_name("cfg") +} + +pub fn is_test_or_bench(attr: &ast::Attribute) -> bool { + attr.check_name("test") || attr.check_name("bench") +} diff --git a/third_party/rust/syntex_syntax/src/diagnostic_list.rs b/third_party/rust/syntex_syntax/src/diagnostic_list.rs new file mode 100644 index 000000000000..9110e989a8a1 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/diagnostic_list.rs @@ -0,0 +1,205 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_snake_case)] + +// Error messages for EXXXX errors. +// Each message should start and end with a new line, and be wrapped to 80 characters. +// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable. +register_long_diagnostics! { + +E0534: r##" +The `inline` attribute was malformed. + +Erroneous code example: + +```compile_fail,E0534 +#[inline()] // error: expected one argument +pub fn something() {} + +fn main() {} +``` + +The parenthesized `inline` attribute requires the parameter to be specified: + +```ignore +#[inline(always)] +fn something() {} + +// or: + +#[inline(never)] +fn something() {} +``` + +Alternatively, a paren-less version of the attribute may be used to hint the +compiler about inlining opportunity: + +``` +#[inline] +fn something() {} +``` + +For more information about the inline attribute, read: +https://doc.rust-lang.org/reference.html#inline-attributes +"##, + +E0535: r##" +An unknown argument was given to the `inline` attribute. + +Erroneous code example: + +```compile_fail,E0535 +#[inline(unknown)] // error: invalid argument +pub fn something() {} + +fn main() {} +``` + +The `inline` attribute only supports two arguments: + + * always + * never + +All other arguments given to the `inline` attribute will return this error. +Example: + +``` +#[inline(never)] // ok! +pub fn something() {} + +fn main() {} +``` + +For more information about the inline attribute, https: +read://doc.rust-lang.org/reference.html#inline-attributes +"##, + +E0536: r##" +The `not` cfg-predicate was malformed. + +Erroneous code example: + +```compile_fail,E0536 +#[cfg(not())] // error: expected 1 cfg-pattern +pub fn something() {} + +pub fn main() {} +``` + +The `not` predicate expects one cfg-pattern. Example: + +``` +#[cfg(not(target_os = "linux"))] // ok! +pub fn something() {} + +pub fn main() {} +``` + +For more information about the cfg attribute, read: +https://doc.rust-lang.org/reference.html#conditional-compilation +"##, + +E0537: r##" +An unknown predicate was used inside the `cfg` attribute. + +Erroneous code example: + +```compile_fail,E0537 +#[cfg(unknown())] // error: invalid predicate `unknown` +pub fn something() {} + +pub fn main() {} +``` + +The `cfg` attribute supports only three kinds of predicates: + + * any + * all + * not + +Example: + +``` +#[cfg(not(target_os = "linux"))] // ok! +pub fn something() {} + +pub fn main() {} +``` + +For more information about the cfg attribute, read: +https://doc.rust-lang.org/reference.html#conditional-compilation +"##, + +E0558: r##" +The `export_name` attribute was malformed. + +Erroneous code example: + +```compile_fail,E0558 +#[export_name] // error: export_name attribute has invalid format +pub fn something() {} + +fn main() {} +``` + +The `export_name` attribute expects a string in order to determine the name of +the exported symbol. Example: + +``` +#[export_name = "some_function"] // ok! +pub fn something() {} + +fn main() {} +``` +"##, + +E0565: r##" +A literal was used in an attribute that doesn't support literals. + +Erroneous code example: + +```compile_fail,E0565 +#[inline("always")] // error: unsupported literal +pub fn something() {} +``` + +Literals in attributes are new and largely unsupported. Work to support literals +where appropriate is ongoing. Try using an unquoted name instead: + +``` +#[inline(always)] +pub fn something() {} +``` +"##, +} + +register_diagnostics! { + E0538, // multiple [same] items + E0539, // incorrect meta item + E0540, // multiple rustc_deprecated attributes + E0541, // unknown meta item + E0542, // missing 'since' + E0543, // missing 'reason' + E0544, // multiple stability levels + E0545, // incorrect 'issue' + E0546, // missing 'feature' + E0547, // missing 'issue' + E0548, // incorrect stability attribute type + E0549, // rustc_deprecated attribute must be paired with either stable or unstable attribute + E0550, // multiple deprecated attributes + E0551, // incorrect meta item + E0552, // unrecognized representation hint + E0553, // unrecognized enum representation hint + E0554, // #[feature] may not be used on the [] release channel + E0555, // malformed feature attribute, expected #![feature(...)] + E0556, // malformed feature, expected just one word + E0557, // feature has been removed +} diff --git a/third_party/rust/syntex_syntax/src/diagnostics/macros.rs b/third_party/rust/syntex_syntax/src/diagnostics/macros.rs new file mode 100644 index 000000000000..53ab9a91bdaf --- /dev/null +++ b/third_party/rust/syntex_syntax/src/diagnostics/macros.rs @@ -0,0 +1,138 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ==== SYNTEX ==== +macro_rules! __register_diagnostic { + ($code:tt, $description:tt) => (); + ($code:tt) => (); +} +macro_rules! __diagnostic_used { + ($code:tt) => (); +} +// ==== SYNTEX ==== + +#[macro_export] +macro_rules! register_diagnostic { + ($code:tt, $description:tt) => (__register_diagnostic! { $code, $description }); + ($code:tt) => (__register_diagnostic! { $code }) +} + +#[macro_export] +macro_rules! span_fatal { + ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + $session.span_fatal_with_code($span, &format!($($message)*), stringify!($code)) + }) +} + +#[macro_export] +macro_rules! span_err { + ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + $session.span_err_with_code($span, &format!($($message)*), stringify!($code)) + }) +} + +#[macro_export] +macro_rules! span_warn { + ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + $session.span_warn_with_code($span, &format!($($message)*), stringify!($code)) + }) +} + +#[macro_export] +macro_rules! span_err_or_warn { + ($is_warning:expr, $session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + if $is_warning { + $session.span_warn_with_code($span, &format!($($message)*), stringify!($code)) + } else { + $session.span_err_with_code($span, &format!($($message)*), stringify!($code)) + } + }) +} + +#[macro_export] +macro_rules! struct_span_fatal { + ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + $session.struct_span_fatal_with_code($span, &format!($($message)*), stringify!($code)) + }) +} + +#[macro_export] +macro_rules! struct_span_err { + ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + $session.struct_span_err_with_code($span, &format!($($message)*), stringify!($code)) + }) +} + +#[macro_export] +macro_rules! struct_span_warn { + ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + $session.struct_span_warn_with_code($span, &format!($($message)*), stringify!($code)) + }) +} + +#[macro_export] +macro_rules! struct_span_err_or_warn { + ($is_warning:expr, $session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + if $is_warning { + $session.struct_span_warn_with_code($span, &format!($($message)*), stringify!($code)) + } else { + $session.struct_span_err_with_code($span, &format!($($message)*), stringify!($code)) + } + }) +} + +#[macro_export] +macro_rules! span_note { + ($err:expr, $span:expr, $($message:tt)*) => ({ + ($err).span_note($span, &format!($($message)*)); + }) +} + +#[macro_export] +macro_rules! span_help { + ($err:expr, $span:expr, $($message:tt)*) => ({ + ($err).span_help($span, &format!($($message)*)); + }) +} + +#[macro_export] +macro_rules! help { + ($err:expr, $($message:tt)*) => ({ + ($err).help(&format!($($message)*)); + }) +} + +#[macro_export] +macro_rules! register_diagnostics { + ($($code:tt),*) => ( + $(register_diagnostic! { $code })* + ); + ($($code:tt),*,) => ( + $(register_diagnostic! { $code })* + ) +} + +#[macro_export] +macro_rules! register_long_diagnostics { + ($($code:tt: $description:tt),*) => ( + $(register_diagnostic! { $code, $description })* + ); + ($($code:tt: $description:tt),*,) => ( + $(register_diagnostic! { $code, $description })* + ) +} diff --git a/third_party/rust/syntex_syntax/src/diagnostics/metadata.rs b/third_party/rust/syntex_syntax/src/diagnostics/metadata.rs new file mode 100644 index 000000000000..ee826b6f85dc --- /dev/null +++ b/third_party/rust/syntex_syntax/src/diagnostics/metadata.rs @@ -0,0 +1,101 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! This module contains utilities for outputting metadata for diagnostic errors. +//! +//! Each set of errors is mapped to a metadata file by a name, which is +//! currently always a crate name. + +use std::collections::BTreeMap; +use std::path::PathBuf; +use std::fs::{remove_file, create_dir_all, File}; +use std::io::Write; +use std::error::Error; +use rustc_serialize::json::as_json; + +use syntax_pos::Span; +use ext::base::ExtCtxt; +use diagnostics::plugin::{ErrorMap, ErrorInfo}; + +// Default metadata directory to use for extended error JSON. +const ERROR_METADATA_PREFIX: &'static str = "tmp/extended-errors"; + +/// JSON encodable/decodable version of `ErrorInfo`. +#[derive(PartialEq, RustcDecodable, RustcEncodable)] +pub struct ErrorMetadata { + pub description: Option, + pub use_site: Option +} + +/// Mapping from error codes to metadata that can be (de)serialized. +pub type ErrorMetadataMap = BTreeMap; + +/// JSON encodable error location type with filename and line number. +#[derive(PartialEq, RustcDecodable, RustcEncodable)] +pub struct ErrorLocation { + pub filename: String, + pub line: usize +} + +impl ErrorLocation { + /// Create an error location from a span. + pub fn from_span(ecx: &ExtCtxt, sp: Span) -> ErrorLocation { + let loc = ecx.codemap().lookup_char_pos_adj(sp.lo); + ErrorLocation { + filename: loc.filename, + line: loc.line + } + } +} + +/// Get the directory where metadata for a given `prefix` should be stored. +/// +/// See `output_metadata`. +pub fn get_metadata_dir(prefix: &str) -> PathBuf { + PathBuf::from(ERROR_METADATA_PREFIX).join(prefix) +} + +/// Map `name` to a path in the given directory: /.json +fn get_metadata_path(directory: PathBuf, name: &str) -> PathBuf { + directory.join(format!("{}.json", name)) +} + +/// Write metadata for the errors in `err_map` to disk, to a file corresponding to `prefix/name`. +/// +/// For our current purposes the prefix is the target architecture and the name is a crate name. +/// If an error occurs steps will be taken to ensure that no file is created. +pub fn output_metadata(ecx: &ExtCtxt, prefix: &str, name: &str, err_map: &ErrorMap) + -> Result<(), Box> +{ + // Create the directory to place the file in. + let metadata_dir = get_metadata_dir(prefix); + try!(create_dir_all(&metadata_dir)); + + // Open the metadata file. + let metadata_path = get_metadata_path(metadata_dir, name); + let mut metadata_file = try!(File::create(&metadata_path)); + + // Construct a serializable map. + let json_map = err_map.iter().map(|(k, &ErrorInfo { description, use_site })| { + let key = k.as_str().to_string(); + let value = ErrorMetadata { + description: description.map(|n| n.as_str().to_string()), + use_site: use_site.map(|sp| ErrorLocation::from_span(ecx, sp)) + }; + (key, value) + }).collect::(); + + // Write the data to the file, deleting it if the write fails. + let result = write!(&mut metadata_file, "{}", as_json(&json_map)); + if result.is_err() { + try!(remove_file(&metadata_path)); + } + result.map_err(|e| e.into()) +} diff --git a/third_party/rust/syntex_syntax/src/diagnostics/plugin.rs b/third_party/rust/syntex_syntax/src/diagnostics/plugin.rs new file mode 100644 index 000000000000..fe5cb87ad59b --- /dev/null +++ b/third_party/rust/syntex_syntax/src/diagnostics/plugin.rs @@ -0,0 +1,241 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cell::RefCell; +use std::collections::BTreeMap; +use std::env; + +use ast; +use ast::{Ident, Name}; +use syntax_pos::Span; +use ext::base::{ExtCtxt, MacEager, MacResult}; +use ext::build::AstBuilder; +use parse::token; +use ptr::P; +use symbol::Symbol; +use tokenstream::{TokenTree}; +use util::small_vector::SmallVector; + +use diagnostics::metadata::output_metadata; + +pub use errors::*; + +// Maximum width of any line in an extended error description (inclusive). +const MAX_DESCRIPTION_WIDTH: usize = 80; + +thread_local! { + static REGISTERED_DIAGNOSTICS: RefCell = { + RefCell::new(BTreeMap::new()) + } +} + +/// Error information type. +pub struct ErrorInfo { + pub description: Option, + pub use_site: Option +} + +/// Mapping from error codes to metadata. +pub type ErrorMap = BTreeMap; + +fn with_registered_diagnostics(f: F) -> T where + F: FnOnce(&mut ErrorMap) -> T, +{ + REGISTERED_DIAGNOSTICS.with(move |slot| { + f(&mut *slot.borrow_mut()) + }) +} + +pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt, + span: Span, + token_tree: &[TokenTree]) + -> Box { + let code = match (token_tree.len(), token_tree.get(0)) { + (1, Some(&TokenTree::Token(_, token::Ident(code)))) => code, + _ => unreachable!() + }; + + with_registered_diagnostics(|diagnostics| { + match diagnostics.get_mut(&code.name) { + // Previously used errors. + Some(&mut ErrorInfo { description: _, use_site: Some(previous_span) }) => { + ecx.struct_span_warn(span, &format!( + "diagnostic code {} already used", code + )).span_note(previous_span, "previous invocation") + .emit(); + } + // Newly used errors. + Some(ref mut info) => { + info.use_site = Some(span); + } + // Unregistered errors. + None => { + ecx.span_err(span, &format!( + "used diagnostic code {} not registered", code + )); + } + } + }); + MacEager::expr(ecx.expr_tuple(span, Vec::new())) +} + +pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, + span: Span, + token_tree: &[TokenTree]) + -> Box { + let (code, description) = match ( + token_tree.len(), + token_tree.get(0), + token_tree.get(1), + token_tree.get(2) + ) { + (1, Some(&TokenTree::Token(_, token::Ident(ref code))), None, None) => { + (code, None) + }, + (3, Some(&TokenTree::Token(_, token::Ident(ref code))), + Some(&TokenTree::Token(_, token::Comma)), + Some(&TokenTree::Token(_, token::Literal(token::StrRaw(description, _), None)))) => { + (code, Some(description)) + } + _ => unreachable!() + }; + + // Check that the description starts and ends with a newline and doesn't + // overflow the maximum line width. + description.map(|raw_msg| { + let msg = raw_msg.as_str(); + if !msg.starts_with("\n") || !msg.ends_with("\n") { + ecx.span_err(span, &format!( + "description for error code {} doesn't start and end with a newline", + code + )); + } + + // URLs can be unavoidably longer than the line limit, so we allow them. + // Allowed format is: `[name]: https://www.rust-lang.org/` + let is_url = |l: &str| l.starts_with('[') && l.contains("]:") && l.contains("http"); + + if msg.lines().any(|line| line.len() > MAX_DESCRIPTION_WIDTH && !is_url(line)) { + ecx.span_err(span, &format!( + "description for error code {} contains a line longer than {} characters.\n\ + if you're inserting a long URL use the footnote style to bypass this check.", + code, MAX_DESCRIPTION_WIDTH + )); + } + }); + // Add the error to the map. + with_registered_diagnostics(|diagnostics| { + let info = ErrorInfo { + description: description, + use_site: None + }; + if diagnostics.insert(code.name, info).is_some() { + ecx.span_err(span, &format!( + "diagnostic code {} already registered", code + )); + } + }); + let sym = Ident::with_empty_ctxt(Symbol::gensym(&format!( + "__register_diagnostic_{}", code + ))); + MacEager::items(SmallVector::many(vec![ + ecx.item_mod( + span, + span, + sym, + Vec::new(), + Vec::new() + ) + ])) +} + +pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, + span: Span, + token_tree: &[TokenTree]) + -> Box { + assert_eq!(token_tree.len(), 3); + let (crate_name, name) = match (&token_tree[0], &token_tree[2]) { + ( + // Crate name. + &TokenTree::Token(_, token::Ident(ref crate_name)), + // DIAGNOSTICS ident. + &TokenTree::Token(_, token::Ident(ref name)) + ) => (*&crate_name, name), + _ => unreachable!() + }; + + // Output error metadata to `tmp/extended-errors//.json` + if let Ok(target_triple) = env::var("CFG_COMPILER_HOST_TRIPLE") { + with_registered_diagnostics(|diagnostics| { + if let Err(e) = output_metadata(ecx, + &target_triple, + &crate_name.name.as_str(), + &diagnostics) { + ecx.span_bug(span, &format!( + "error writing metadata for triple `{}` and crate `{}`, error: {}, \ + cause: {:?}", + target_triple, crate_name, e.description(), e.cause() + )); + } + }); + } else { + ecx.span_err(span, &format!( + "failed to write metadata for crate `{}` because $CFG_COMPILER_HOST_TRIPLE is not set", + crate_name)); + } + + // Construct the output expression. + let (count, expr) = + with_registered_diagnostics(|diagnostics| { + let descriptions: Vec> = + diagnostics.iter().filter_map(|(&code, info)| { + info.description.map(|description| { + ecx.expr_tuple(span, vec![ + ecx.expr_str(span, code), + ecx.expr_str(span, description) + ]) + }) + }).collect(); + (descriptions.len(), ecx.expr_vec(span, descriptions)) + }); + + let static_ = ecx.lifetime(span, ecx.name_of("'static")); + let ty_str = ecx.ty_rptr( + span, + ecx.ty_ident(span, ecx.ident_of("str")), + Some(static_), + ast::Mutability::Immutable, + ); + + let ty = ecx.ty( + span, + ast::TyKind::Array( + ecx.ty( + span, + ast::TyKind::Tup(vec![ty_str.clone(), ty_str]) + ), + ecx.expr_usize(span, count), + ), + ); + + MacEager::items(SmallVector::many(vec![ + P(ast::Item { + ident: name.clone(), + attrs: Vec::new(), + id: ast::DUMMY_NODE_ID, + node: ast::ItemKind::Const( + ty, + expr, + ), + vis: ast::Visibility::Public, + span: span, + }) + ])) +} diff --git a/third_party/rust/syntex_syntax/src/entry.rs b/third_party/rust/syntex_syntax/src/entry.rs new file mode 100644 index 000000000000..93ca1948ed84 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/entry.rs @@ -0,0 +1,44 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use attr; +use ast::{Item, ItemKind}; + +pub enum EntryPointType { + None, + MainNamed, + MainAttr, + Start, + OtherMain, // Not an entry point, but some other function named main +} + +// Beware, this is duplicated in librustc/middle/entry.rs, make sure to keep +// them in sync. +pub fn entry_point_type(item: &Item, depth: usize) -> EntryPointType { + match item.node { + ItemKind::Fn(..) => { + if attr::contains_name(&item.attrs, "start") { + EntryPointType::Start + } else if attr::contains_name(&item.attrs, "main") { + EntryPointType::MainAttr + } else if item.ident.name == "main" { + if depth == 1 { + // This is a top-level function so can be 'main' + EntryPointType::MainNamed + } else { + EntryPointType::OtherMain + } + } else { + EntryPointType::None + } + } + _ => EntryPointType::None, + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/base.rs b/third_party/rust/syntex_syntax/src/ext/base.rs new file mode 100644 index 000000000000..a476a8fde8a6 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/base.rs @@ -0,0 +1,849 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use self::SyntaxExtension::{MultiDecorator, MultiModifier, NormalTT, IdentTT}; + +use ast::{self, Attribute, Name, PatKind}; +use attr::HasAttrs; +use codemap::{self, CodeMap, ExpnInfo, Spanned, respan}; +use syntax_pos::{Span, ExpnId, NO_EXPANSION}; +use errors::DiagnosticBuilder; +use ext::expand::{self, Expansion}; +use ext::hygiene::Mark; +use fold::{self, Folder}; +use parse::{self, parser, DirectoryOwnership}; +use parse::token; +use ptr::P; +use symbol::Symbol; +use util::small_vector::SmallVector; + +use std::path::PathBuf; +use std::rc::Rc; +use std::default::Default; +use tokenstream::{self, TokenStream}; + + +#[derive(Debug,Clone)] +pub enum Annotatable { + Item(P), + TraitItem(P), + ImplItem(P), +} + +impl HasAttrs for Annotatable { + fn attrs(&self) -> &[Attribute] { + match *self { + Annotatable::Item(ref item) => &item.attrs, + Annotatable::TraitItem(ref trait_item) => &trait_item.attrs, + Annotatable::ImplItem(ref impl_item) => &impl_item.attrs, + } + } + + fn map_attrs) -> Vec>(self, f: F) -> Self { + match self { + Annotatable::Item(item) => Annotatable::Item(item.map_attrs(f)), + Annotatable::TraitItem(trait_item) => Annotatable::TraitItem(trait_item.map_attrs(f)), + Annotatable::ImplItem(impl_item) => Annotatable::ImplItem(impl_item.map_attrs(f)), + } + } +} + +impl Annotatable { + pub fn expect_item(self) -> P { + match self { + Annotatable::Item(i) => i, + _ => panic!("expected Item") + } + } + + pub fn map_item_or(self, mut f: F, mut or: G) -> Annotatable + where F: FnMut(P) -> P, + G: FnMut(Annotatable) -> Annotatable + { + match self { + Annotatable::Item(i) => Annotatable::Item(f(i)), + _ => or(self) + } + } + + pub fn expect_trait_item(self) -> ast::TraitItem { + match self { + Annotatable::TraitItem(i) => i.unwrap(), + _ => panic!("expected Item") + } + } + + pub fn expect_impl_item(self) -> ast::ImplItem { + match self { + Annotatable::ImplItem(i) => i.unwrap(), + _ => panic!("expected Item") + } + } +} + +// A more flexible ItemDecorator. +pub trait MultiItemDecorator { + fn expand(&self, + ecx: &mut ExtCtxt, + sp: Span, + meta_item: &ast::MetaItem, + item: &Annotatable, + push: &mut FnMut(Annotatable)); +} + +impl MultiItemDecorator for F + where F : Fn(&mut ExtCtxt, Span, &ast::MetaItem, &Annotatable, &mut FnMut(Annotatable)) +{ + fn expand(&self, + ecx: &mut ExtCtxt, + sp: Span, + meta_item: &ast::MetaItem, + item: &Annotatable, + push: &mut FnMut(Annotatable)) { + (*self)(ecx, sp, meta_item, item, push) + } +} + +// `meta_item` is the annotation, and `item` is the item being modified. +// FIXME Decorators should follow the same pattern too. +pub trait MultiItemModifier { + fn expand(&self, + ecx: &mut ExtCtxt, + span: Span, + meta_item: &ast::MetaItem, + item: Annotatable) + -> Vec; +} + +impl MultiItemModifier for F + where F: Fn(&mut ExtCtxt, Span, &ast::MetaItem, Annotatable) -> T, + T: Into>, +{ + fn expand(&self, + ecx: &mut ExtCtxt, + span: Span, + meta_item: &ast::MetaItem, + item: Annotatable) + -> Vec { + (*self)(ecx, span, meta_item, item).into() + } +} + +impl Into> for Annotatable { + fn into(self) -> Vec { + vec![self] + } +} + +pub trait ProcMacro { + fn expand<'cx>(&self, + ecx: &'cx mut ExtCtxt, + span: Span, + ts: TokenStream) + -> TokenStream; +} + +impl ProcMacro for F + where F: Fn(TokenStream) -> TokenStream +{ + fn expand<'cx>(&self, + _ecx: &'cx mut ExtCtxt, + _span: Span, + ts: TokenStream) + -> TokenStream { + // FIXME setup implicit context in TLS before calling self. + (*self)(ts) + } +} + +pub trait AttrProcMacro { + fn expand<'cx>(&self, + ecx: &'cx mut ExtCtxt, + span: Span, + annotation: TokenStream, + annotated: TokenStream) + -> TokenStream; +} + +impl AttrProcMacro for F + where F: Fn(TokenStream, TokenStream) -> TokenStream +{ + fn expand<'cx>(&self, + _ecx: &'cx mut ExtCtxt, + _span: Span, + annotation: TokenStream, + annotated: TokenStream) + -> TokenStream { + // FIXME setup implicit context in TLS before calling self. + (*self)(annotation, annotated) + } +} + +/// Represents a thing that maps token trees to Macro Results +pub trait TTMacroExpander { + fn expand<'cx>(&self, + ecx: &'cx mut ExtCtxt, + span: Span, + token_tree: &[tokenstream::TokenTree]) + -> Box; +} + +pub type MacroExpanderFn = + for<'cx> fn(&'cx mut ExtCtxt, Span, &[tokenstream::TokenTree]) + -> Box; + +impl TTMacroExpander for F + where F : for<'cx> Fn(&'cx mut ExtCtxt, Span, &[tokenstream::TokenTree]) + -> Box +{ + fn expand<'cx>(&self, + ecx: &'cx mut ExtCtxt, + span: Span, + token_tree: &[tokenstream::TokenTree]) + -> Box { + (*self)(ecx, span, token_tree) + } +} + +pub trait IdentMacroExpander { + fn expand<'cx>(&self, + cx: &'cx mut ExtCtxt, + sp: Span, + ident: ast::Ident, + token_tree: Vec) + -> Box; +} + +pub type IdentMacroExpanderFn = + for<'cx> fn(&'cx mut ExtCtxt, Span, ast::Ident, Vec) + -> Box; + +impl IdentMacroExpander for F + where F : for<'cx> Fn(&'cx mut ExtCtxt, Span, ast::Ident, + Vec) -> Box +{ + fn expand<'cx>(&self, + cx: &'cx mut ExtCtxt, + sp: Span, + ident: ast::Ident, + token_tree: Vec) + -> Box + { + (*self)(cx, sp, ident, token_tree) + } +} + +// Use a macro because forwarding to a simple function has type system issues +macro_rules! make_stmts_default { + ($me:expr) => { + $me.make_expr().map(|e| SmallVector::one(ast::Stmt { + id: ast::DUMMY_NODE_ID, + span: e.span, + node: ast::StmtKind::Expr(e), + })) + } +} + +/// The result of a macro expansion. The return values of the various +/// methods are spliced into the AST at the callsite of the macro. +pub trait MacResult { + /// Create an expression. + fn make_expr(self: Box) -> Option> { + None + } + /// Create zero or more items. + fn make_items(self: Box) -> Option>> { + None + } + + /// Create zero or more impl items. + fn make_impl_items(self: Box) -> Option> { + None + } + + /// Create zero or more trait items. + fn make_trait_items(self: Box) -> Option> { + None + } + + /// Create a pattern. + fn make_pat(self: Box) -> Option> { + None + } + + /// Create zero or more statements. + /// + /// By default this attempts to create an expression statement, + /// returning None if that fails. + fn make_stmts(self: Box) -> Option> { + make_stmts_default!(self) + } + + fn make_ty(self: Box) -> Option> { + None + } +} + +macro_rules! make_MacEager { + ( $( $fld:ident: $t:ty, )* ) => { + /// `MacResult` implementation for the common case where you've already + /// built each form of AST that you might return. + #[derive(Default)] + pub struct MacEager { + $( + pub $fld: Option<$t>, + )* + } + + impl MacEager { + $( + pub fn $fld(v: $t) -> Box { + Box::new(MacEager { + $fld: Some(v), + ..Default::default() + }) + } + )* + } + } +} + +make_MacEager! { + expr: P, + pat: P, + items: SmallVector>, + impl_items: SmallVector, + trait_items: SmallVector, + stmts: SmallVector, + ty: P, +} + +impl MacResult for MacEager { + fn make_expr(self: Box) -> Option> { + self.expr + } + + fn make_items(self: Box) -> Option>> { + self.items + } + + fn make_impl_items(self: Box) -> Option> { + self.impl_items + } + + fn make_trait_items(self: Box) -> Option> { + self.trait_items + } + + fn make_stmts(self: Box) -> Option> { + match self.stmts.as_ref().map_or(0, |s| s.len()) { + 0 => make_stmts_default!(self), + _ => self.stmts, + } + } + + fn make_pat(self: Box) -> Option> { + if let Some(p) = self.pat { + return Some(p); + } + if let Some(e) = self.expr { + if let ast::ExprKind::Lit(_) = e.node { + return Some(P(ast::Pat { + id: ast::DUMMY_NODE_ID, + span: e.span, + node: PatKind::Lit(e), + })); + } + } + None + } + + fn make_ty(self: Box) -> Option> { + self.ty + } +} + +/// Fill-in macro expansion result, to allow compilation to continue +/// after hitting errors. +#[derive(Copy, Clone)] +pub struct DummyResult { + expr_only: bool, + span: Span +} + +impl DummyResult { + /// Create a default MacResult that can be anything. + /// + /// Use this as a return value after hitting any errors and + /// calling `span_err`. + pub fn any(sp: Span) -> Box { + Box::new(DummyResult { expr_only: false, span: sp }) + } + + /// Create a default MacResult that can only be an expression. + /// + /// Use this for macros that must expand to an expression, so even + /// if an error is encountered internally, the user will receive + /// an error that they also used it in the wrong place. + pub fn expr(sp: Span) -> Box { + Box::new(DummyResult { expr_only: true, span: sp }) + } + + /// A plain dummy expression. + pub fn raw_expr(sp: Span) -> P { + P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Lit(P(codemap::respan(sp, ast::LitKind::Bool(false)))), + span: sp, + attrs: ast::ThinVec::new(), + }) + } + + /// A plain dummy pattern. + pub fn raw_pat(sp: Span) -> ast::Pat { + ast::Pat { + id: ast::DUMMY_NODE_ID, + node: PatKind::Wild, + span: sp, + } + } + + pub fn raw_ty(sp: Span) -> P { + P(ast::Ty { + id: ast::DUMMY_NODE_ID, + node: ast::TyKind::Infer, + span: sp + }) + } +} + +impl MacResult for DummyResult { + fn make_expr(self: Box) -> Option> { + Some(DummyResult::raw_expr(self.span)) + } + + fn make_pat(self: Box) -> Option> { + Some(P(DummyResult::raw_pat(self.span))) + } + + fn make_items(self: Box) -> Option>> { + // this code needs a comment... why not always just return the Some() ? + if self.expr_only { + None + } else { + Some(SmallVector::new()) + } + } + + fn make_impl_items(self: Box) -> Option> { + if self.expr_only { + None + } else { + Some(SmallVector::new()) + } + } + + fn make_trait_items(self: Box) -> Option> { + if self.expr_only { + None + } else { + Some(SmallVector::new()) + } + } + + fn make_stmts(self: Box) -> Option> { + Some(SmallVector::one(ast::Stmt { + id: ast::DUMMY_NODE_ID, + node: ast::StmtKind::Expr(DummyResult::raw_expr(self.span)), + span: self.span, + })) + } + + fn make_ty(self: Box) -> Option> { + Some(DummyResult::raw_ty(self.span)) + } +} + +/// An enum representing the different kinds of syntax extensions. +pub enum SyntaxExtension { + /// A syntax extension that is attached to an item and creates new items + /// based upon it. + /// + /// `#[derive(...)]` is a `MultiItemDecorator`. + /// + /// Prefer ProcMacro or MultiModifier since they are more flexible. + MultiDecorator(Box), + + /// A syntax extension that is attached to an item and modifies it + /// in-place. Also allows decoration, i.e., creating new items. + MultiModifier(Box), + + /// A function-like procedural macro. TokenStream -> TokenStream. + ProcMacro(Box), + + /// An attribute-like procedural macro. TokenStream, TokenStream -> TokenStream. + /// The first TokenSteam is the attribute, the second is the annotated item. + /// Allows modification of the input items and adding new items, similar to + /// MultiModifier, but uses TokenStreams, rather than AST nodes. + AttrProcMacro(Box), + + /// A normal, function-like syntax extension. + /// + /// `bytes!` is a `NormalTT`. + /// + /// The `bool` dictates whether the contents of the macro can + /// directly use `#[unstable]` things (true == yes). + NormalTT(Box, Option, bool), + + /// A function-like syntax extension that has an extra ident before + /// the block. + /// + IdentTT(Box, Option, bool), + + CustomDerive(Box), +} + +pub type NamedSyntaxExtension = (Name, SyntaxExtension); + +pub trait Resolver { + fn next_node_id(&mut self) -> ast::NodeId; + fn get_module_scope(&mut self, id: ast::NodeId) -> Mark; + fn eliminate_crate_var(&mut self, item: P) -> P; + fn is_whitelisted_legacy_custom_derive(&self, name: Name) -> bool; + + fn visit_expansion(&mut self, mark: Mark, expansion: &Expansion); + fn add_ext(&mut self, ident: ast::Ident, ext: Rc); + fn add_expansions_at_stmt(&mut self, id: ast::NodeId, macros: Vec); + + fn resolve_imports(&mut self); + fn find_attr_invoc(&mut self, attrs: &mut Vec) -> Option; + // FIXME(syntax): ignore unknown macros + fn find_extension(&mut self, scope: Mark, name: ast::Name) -> Option>; + fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, force: bool) + -> Result, Determinacy>; +} + +#[derive(Copy, Clone, Debug)] +pub enum Determinacy { + Determined, + Undetermined, +} + +pub struct DummyResolver; + +impl Resolver for DummyResolver { + fn next_node_id(&mut self) -> ast::NodeId { ast::DUMMY_NODE_ID } + fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() } + fn eliminate_crate_var(&mut self, item: P) -> P { item } + fn is_whitelisted_legacy_custom_derive(&self, _name: Name) -> bool { false } + + fn visit_expansion(&mut self, _invoc: Mark, _expansion: &Expansion) {} + fn add_ext(&mut self, _ident: ast::Ident, _ext: Rc) {} + fn add_expansions_at_stmt(&mut self, _id: ast::NodeId, _macros: Vec) {} + + fn resolve_imports(&mut self) {} + fn find_attr_invoc(&mut self, _attrs: &mut Vec) -> Option { None } + fn find_extension(&mut self, _scope: Mark, _name: ast::Name) -> Option> { + None + } + fn resolve_macro(&mut self, _scope: Mark, _path: &ast::Path, _force: bool) + -> Result, Determinacy> { + Err(Determinacy::Determined) + } +} + +#[derive(Clone)] +pub struct ModuleData { + pub mod_path: Vec, + pub directory: PathBuf, +} + +#[derive(Clone)] +pub struct ExpansionData { + pub mark: Mark, + pub depth: usize, + pub backtrace: ExpnId, + pub module: Rc, + pub directory_ownership: DirectoryOwnership, +} + +/// One of these is made during expansion and incrementally updated as we go; +/// when a macro expansion occurs, the resulting nodes have the backtrace() +/// -> expn_info of their expansion context stored into their span. +pub struct ExtCtxt<'a> { + pub parse_sess: &'a parse::ParseSess, + pub ecfg: expand::ExpansionConfig<'a>, + pub crate_root: Option<&'static str>, + pub resolver: &'a mut Resolver, + pub resolve_err_count: usize, + pub current_expansion: ExpansionData, +} + +impl<'a> ExtCtxt<'a> { + pub fn new(parse_sess: &'a parse::ParseSess, + ecfg: expand::ExpansionConfig<'a>, + resolver: &'a mut Resolver) + -> ExtCtxt<'a> { + ExtCtxt { + parse_sess: parse_sess, + ecfg: ecfg, + crate_root: None, + resolver: resolver, + resolve_err_count: 0, + current_expansion: ExpansionData { + mark: Mark::root(), + depth: 0, + backtrace: NO_EXPANSION, + module: Rc::new(ModuleData { mod_path: Vec::new(), directory: PathBuf::new() }), + directory_ownership: DirectoryOwnership::Owned, + }, + } + } + + /// Returns a `Folder` for deeply expanding all macros in an AST node. + pub fn expander<'b>(&'b mut self) -> expand::MacroExpander<'b, 'a> { + expand::MacroExpander::new(self, false) + } + + /// Returns a `Folder` that deeply expands all macros and assigns all node ids in an AST node. + /// Once node ids are assigned, the node may not be expanded, removed, or otherwise modified. + pub fn monotonic_expander<'b>(&'b mut self) -> expand::MacroExpander<'b, 'a> { + expand::MacroExpander::new(self, true) + } + + pub fn new_parser_from_tts(&self, tts: &[tokenstream::TokenTree]) + -> parser::Parser<'a> { + let mut parser = parse::tts_to_parser(self.parse_sess, tts.to_vec()); + parser.allow_interpolated_tts = false; // FIXME(jseyfried) `quote!` can't handle these yet + parser + } + pub fn codemap(&self) -> &'a CodeMap { self.parse_sess.codemap() } + pub fn parse_sess(&self) -> &'a parse::ParseSess { self.parse_sess } + pub fn cfg(&self) -> &ast::CrateConfig { &self.parse_sess.config } + pub fn call_site(&self) -> Span { + self.codemap().with_expn_info(self.backtrace(), |ei| match ei { + Some(expn_info) => expn_info.call_site, + None => self.bug("missing top span") + }) + } + pub fn backtrace(&self) -> ExpnId { self.current_expansion.backtrace } + + /// Returns span for the macro which originally caused the current expansion to happen. + /// + /// Stops backtracing at include! boundary. + pub fn expansion_cause(&self) -> Span { + let mut expn_id = self.backtrace(); + let mut last_macro = None; + loop { + if self.codemap().with_expn_info(expn_id, |info| { + info.map_or(None, |i| { + if i.callee.name() == "include" { + // Stop going up the backtrace once include! is encountered + return None; + } + expn_id = i.call_site.expn_id; + last_macro = Some(i.call_site); + return Some(()); + }) + }).is_none() { + break + } + } + last_macro.expect("missing expansion backtrace") + } + + pub fn bt_push(&mut self, ei: ExpnInfo) { + if self.current_expansion.depth > self.ecfg.recursion_limit { + self.span_fatal(ei.call_site, + &format!("recursion limit reached while expanding the macro `{}`", + ei.callee.name())); + } + + let mut call_site = ei.call_site; + call_site.expn_id = self.backtrace(); + self.current_expansion.backtrace = self.codemap().record_expansion(ExpnInfo { + call_site: call_site, + callee: ei.callee + }); + } + pub fn bt_pop(&mut self) {} + + pub fn struct_span_warn(&self, + sp: Span, + msg: &str) + -> DiagnosticBuilder<'a> { + self.parse_sess.span_diagnostic.struct_span_warn(sp, msg) + } + pub fn struct_span_err(&self, + sp: Span, + msg: &str) + -> DiagnosticBuilder<'a> { + self.parse_sess.span_diagnostic.struct_span_err(sp, msg) + } + pub fn struct_span_fatal(&self, + sp: Span, + msg: &str) + -> DiagnosticBuilder<'a> { + self.parse_sess.span_diagnostic.struct_span_fatal(sp, msg) + } + + /// Emit `msg` attached to `sp`, and stop compilation immediately. + /// + /// `span_err` should be strongly preferred where-ever possible: + /// this should *only* be used when + /// - continuing has a high risk of flow-on errors (e.g. errors in + /// declaring a macro would cause all uses of that macro to + /// complain about "undefined macro"), or + /// - there is literally nothing else that can be done (however, + /// in most cases one can construct a dummy expression/item to + /// substitute; we never hit resolve/type-checking so the dummy + /// value doesn't have to match anything) + pub fn span_fatal(&self, sp: Span, msg: &str) -> ! { + panic!(self.parse_sess.span_diagnostic.span_fatal(sp, msg)); + } + + /// Emit `msg` attached to `sp`, without immediately stopping + /// compilation. + /// + /// Compilation will be stopped in the near future (at the end of + /// the macro expansion phase). + pub fn span_err(&self, sp: Span, msg: &str) { + self.parse_sess.span_diagnostic.span_err(sp, msg); + } + pub fn span_warn(&self, sp: Span, msg: &str) { + self.parse_sess.span_diagnostic.span_warn(sp, msg); + } + pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! { + self.parse_sess.span_diagnostic.span_unimpl(sp, msg); + } + pub fn span_bug(&self, sp: Span, msg: &str) -> ! { + self.parse_sess.span_diagnostic.span_bug(sp, msg); + } + pub fn bug(&self, msg: &str) -> ! { + self.parse_sess.span_diagnostic.bug(msg); + } + pub fn trace_macros(&self) -> bool { + self.ecfg.trace_mac + } + pub fn set_trace_macros(&mut self, x: bool) { + self.ecfg.trace_mac = x + } + pub fn ident_of(&self, st: &str) -> ast::Ident { + ast::Ident::from_str(st) + } + pub fn std_path(&self, components: &[&str]) -> Vec { + let mut v = Vec::new(); + if let Some(s) = self.crate_root { + v.push(self.ident_of(s)); + } + v.extend(components.iter().map(|s| self.ident_of(s))); + return v + } + pub fn name_of(&self, st: &str) -> ast::Name { + Symbol::intern(st) + } +} + +/// Extract a string literal from the macro expanded version of `expr`, +/// emitting `err_msg` if `expr` is not a string literal. This does not stop +/// compilation on error, merely emits a non-fatal error and returns None. +pub fn expr_to_spanned_string(cx: &mut ExtCtxt, expr: P, err_msg: &str) + -> Option> { + // Update `expr.span`'s expn_id now in case expr is an `include!` macro invocation. + let expr = expr.map(|mut expr| { + expr.span.expn_id = cx.backtrace(); + expr + }); + + // we want to be able to handle e.g. concat("foo", "bar") + let expr = cx.expander().fold_expr(expr); + match expr.node { + ast::ExprKind::Lit(ref l) => match l.node { + ast::LitKind::Str(s, style) => return Some(respan(expr.span, (s, style))), + _ => cx.span_err(l.span, err_msg) + }, + _ => cx.span_err(expr.span, err_msg) + } + None +} + +pub fn expr_to_string(cx: &mut ExtCtxt, expr: P, err_msg: &str) + -> Option<(Symbol, ast::StrStyle)> { + expr_to_spanned_string(cx, expr, err_msg).map(|s| s.node) +} + +/// Non-fatally assert that `tts` is empty. Note that this function +/// returns even when `tts` is non-empty, macros that *need* to stop +/// compilation should call +/// `cx.parse_sess.span_diagnostic.abort_if_errors()` (this should be +/// done as rarely as possible). +pub fn check_zero_tts(cx: &ExtCtxt, + sp: Span, + tts: &[tokenstream::TokenTree], + name: &str) { + if !tts.is_empty() { + cx.span_err(sp, &format!("{} takes no arguments", name)); + } +} + +/// Extract the string literal from the first token of `tts`. If this +/// is not a string literal, emit an error and return None. +pub fn get_single_str_from_tts(cx: &mut ExtCtxt, + sp: Span, + tts: &[tokenstream::TokenTree], + name: &str) + -> Option { + let mut p = cx.new_parser_from_tts(tts); + if p.token == token::Eof { + cx.span_err(sp, &format!("{} takes 1 argument", name)); + return None + } + let ret = panictry!(p.parse_expr()); + if p.token != token::Eof { + cx.span_err(sp, &format!("{} takes 1 argument", name)); + } + expr_to_string(cx, ret, "argument must be a string literal").map(|(s, _)| { + s.to_string() + }) +} + +/// Extract comma-separated expressions from `tts`. If there is a +/// parsing error, emit a non-fatal error and return None. +pub fn get_exprs_from_tts(cx: &mut ExtCtxt, + sp: Span, + tts: &[tokenstream::TokenTree]) -> Option>> { + let mut p = cx.new_parser_from_tts(tts); + let mut es = Vec::new(); + while p.token != token::Eof { + es.push(cx.expander().fold_expr(panictry!(p.parse_expr()))); + if p.eat(&token::Comma) { + continue; + } + if p.token != token::Eof { + cx.span_err(sp, "expected token: `,`"); + return None; + } + } + Some(es) +} + +pub struct ChangeSpan { + pub span: Span +} + +impl Folder for ChangeSpan { + fn new_span(&mut self, _sp: Span) -> Span { + self.span + } + + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { + fold::noop_fold_mac(mac, self) + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/build.rs b/third_party/rust/syntex_syntax/src/ext/build.rs new file mode 100644 index 000000000000..b1011486e406 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/build.rs @@ -0,0 +1,1208 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use abi::Abi; +use ast::{self, Ident, Generics, Expr, BlockCheckMode, UnOp, PatKind}; +use attr; +use syntax_pos::{Span, DUMMY_SP}; +use codemap::{dummy_spanned, respan, Spanned}; +use ext::base::ExtCtxt; +use ptr::P; +use symbol::{Symbol, keywords}; + +// Transitional reexports so qquote can find the paths it is looking for +mod syntax { + pub use ext; + pub use parse; +} + +pub trait AstBuilder { + // paths + fn path(&self, span: Span, strs: Vec ) -> ast::Path; + fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path; + fn path_global(&self, span: Span, strs: Vec ) -> ast::Path; + fn path_all(&self, sp: Span, + global: bool, + idents: Vec , + lifetimes: Vec, + types: Vec>, + bindings: Vec ) + -> ast::Path; + + fn qpath(&self, self_type: P, + trait_path: ast::Path, + ident: ast::Ident) + -> (ast::QSelf, ast::Path); + fn qpath_all(&self, self_type: P, + trait_path: ast::Path, + ident: ast::Ident, + lifetimes: Vec, + types: Vec>, + bindings: Vec) + -> (ast::QSelf, ast::Path); + + // types + fn ty_mt(&self, ty: P, mutbl: ast::Mutability) -> ast::MutTy; + + fn ty(&self, span: Span, ty: ast::TyKind) -> P; + fn ty_path(&self, ast::Path) -> P; + fn ty_sum(&self, ast::Path, ast::TyParamBounds) -> P; + fn ty_ident(&self, span: Span, idents: ast::Ident) -> P; + + fn ty_rptr(&self, span: Span, + ty: P, + lifetime: Option, + mutbl: ast::Mutability) -> P; + fn ty_ptr(&self, span: Span, + ty: P, + mutbl: ast::Mutability) -> P; + + fn ty_option(&self, ty: P) -> P; + fn ty_infer(&self, sp: Span) -> P; + + fn ty_vars(&self, ty_params: &P<[ast::TyParam]>) -> Vec> ; + fn ty_vars_global(&self, ty_params: &P<[ast::TyParam]>) -> Vec> ; + + fn typaram(&self, + span: Span, + id: ast::Ident, + attrs: Vec, + bounds: ast::TyParamBounds, + default: Option>) -> ast::TyParam; + + fn trait_ref(&self, path: ast::Path) -> ast::TraitRef; + fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef; + fn typarambound(&self, path: ast::Path) -> ast::TyParamBound; + fn lifetime(&self, span: Span, ident: ast::Name) -> ast::Lifetime; + fn lifetime_def(&self, + span: Span, + name: ast::Name, + attrs: Vec, + bounds: Vec) + -> ast::LifetimeDef; + + // statements + fn stmt_expr(&self, expr: P) -> ast::Stmt; + fn stmt_semi(&self, expr: P) -> ast::Stmt; + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: P) -> ast::Stmt; + fn stmt_let_typed(&self, + sp: Span, + mutbl: bool, + ident: ast::Ident, + typ: P, + ex: P) + -> ast::Stmt; + fn stmt_let_type_only(&self, span: Span, ty: P) -> ast::Stmt; + fn stmt_item(&self, sp: Span, item: P) -> ast::Stmt; + + // blocks + fn block(&self, span: Span, stmts: Vec) -> P; + fn block_expr(&self, expr: P) -> P; + + // expressions + fn expr(&self, span: Span, node: ast::ExprKind) -> P; + fn expr_path(&self, path: ast::Path) -> P; + fn expr_qpath(&self, span: Span, qself: ast::QSelf, path: ast::Path) -> P; + fn expr_ident(&self, span: Span, id: ast::Ident) -> P; + + fn expr_self(&self, span: Span) -> P; + fn expr_binary(&self, sp: Span, op: ast::BinOpKind, + lhs: P, rhs: P) -> P; + fn expr_deref(&self, sp: Span, e: P) -> P; + fn expr_unary(&self, sp: Span, op: ast::UnOp, e: P) -> P; + + fn expr_addr_of(&self, sp: Span, e: P) -> P; + fn expr_mut_addr_of(&self, sp: Span, e: P) -> P; + fn expr_field_access(&self, span: Span, expr: P, ident: ast::Ident) -> P; + fn expr_tup_field_access(&self, sp: Span, expr: P, + idx: usize) -> P; + fn expr_call(&self, span: Span, expr: P, args: Vec>) -> P; + fn expr_call_ident(&self, span: Span, id: ast::Ident, args: Vec>) -> P; + fn expr_call_global(&self, sp: Span, fn_path: Vec, + args: Vec> ) -> P; + fn expr_method_call(&self, span: Span, + expr: P, ident: ast::Ident, + args: Vec> ) -> P; + fn expr_block(&self, b: P) -> P; + fn expr_cast(&self, sp: Span, expr: P, ty: P) -> P; + + fn field_imm(&self, span: Span, name: Ident, e: P) -> ast::Field; + fn expr_struct(&self, span: Span, path: ast::Path, fields: Vec) -> P; + fn expr_struct_ident(&self, span: Span, id: ast::Ident, + fields: Vec) -> P; + + fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P; + + fn expr_usize(&self, span: Span, i: usize) -> P; + fn expr_isize(&self, sp: Span, i: isize) -> P; + fn expr_u8(&self, sp: Span, u: u8) -> P; + fn expr_u32(&self, sp: Span, u: u32) -> P; + fn expr_bool(&self, sp: Span, value: bool) -> P; + + fn expr_vec(&self, sp: Span, exprs: Vec>) -> P; + fn expr_vec_ng(&self, sp: Span) -> P; + fn expr_vec_slice(&self, sp: Span, exprs: Vec>) -> P; + fn expr_str(&self, sp: Span, s: Symbol) -> P; + + fn expr_some(&self, sp: Span, expr: P) -> P; + fn expr_none(&self, sp: Span) -> P; + + fn expr_break(&self, sp: Span) -> P; + + fn expr_tuple(&self, sp: Span, exprs: Vec>) -> P; + + fn expr_fail(&self, span: Span, msg: Symbol) -> P; + fn expr_unreachable(&self, span: Span) -> P; + + fn expr_ok(&self, span: Span, expr: P) -> P; + fn expr_err(&self, span: Span, expr: P) -> P; + fn expr_try(&self, span: Span, head: P) -> P; + + fn pat(&self, span: Span, pat: PatKind) -> P; + fn pat_wild(&self, span: Span) -> P; + fn pat_lit(&self, span: Span, expr: P) -> P; + fn pat_ident(&self, span: Span, ident: ast::Ident) -> P; + + fn pat_ident_binding_mode(&self, + span: Span, + ident: ast::Ident, + bm: ast::BindingMode) -> P; + fn pat_path(&self, span: Span, path: ast::Path) -> P; + fn pat_tuple_struct(&self, span: Span, path: ast::Path, + subpats: Vec>) -> P; + fn pat_struct(&self, span: Span, path: ast::Path, + field_pats: Vec>) -> P; + fn pat_tuple(&self, span: Span, pats: Vec>) -> P; + + fn pat_some(&self, span: Span, pat: P) -> P; + fn pat_none(&self, span: Span) -> P; + + fn pat_ok(&self, span: Span, pat: P) -> P; + fn pat_err(&self, span: Span, pat: P) -> P; + + fn arm(&self, span: Span, pats: Vec>, expr: P) -> ast::Arm; + fn arm_unreachable(&self, span: Span) -> ast::Arm; + + fn expr_match(&self, span: Span, arg: P, arms: Vec ) -> P; + fn expr_if(&self, span: Span, + cond: P, then: P, els: Option>) -> P; + fn expr_loop(&self, span: Span, block: P) -> P; + + fn lambda_fn_decl(&self, + span: Span, + fn_decl: P, + body: P, + fn_decl_span: Span) + -> P; + + fn lambda(&self, span: Span, ids: Vec, body: P) -> P; + fn lambda0(&self, span: Span, body: P) -> P; + fn lambda1(&self, span: Span, body: P, ident: ast::Ident) -> P; + + fn lambda_stmts(&self, span: Span, ids: Vec, + blk: Vec) -> P; + fn lambda_stmts_0(&self, span: Span, stmts: Vec) -> P; + fn lambda_stmts_1(&self, span: Span, stmts: Vec, + ident: ast::Ident) -> P; + + // items + fn item(&self, span: Span, + name: Ident, attrs: Vec , node: ast::ItemKind) -> P; + + fn arg(&self, span: Span, name: Ident, ty: P) -> ast::Arg; + // FIXME unused self + fn fn_decl(&self, inputs: Vec , output: P) -> P; + + fn item_fn_poly(&self, + span: Span, + name: Ident, + inputs: Vec , + output: P, + generics: Generics, + body: P) -> P; + fn item_fn(&self, + span: Span, + name: Ident, + inputs: Vec , + output: P, + body: P) -> P; + + fn variant(&self, span: Span, name: Ident, tys: Vec> ) -> ast::Variant; + fn item_enum_poly(&self, + span: Span, + name: Ident, + enum_definition: ast::EnumDef, + generics: Generics) -> P; + fn item_enum(&self, span: Span, name: Ident, enum_def: ast::EnumDef) -> P; + + fn item_struct_poly(&self, + span: Span, + name: Ident, + struct_def: ast::VariantData, + generics: Generics) -> P; + fn item_struct(&self, span: Span, name: Ident, struct_def: ast::VariantData) -> P; + + fn item_mod(&self, span: Span, inner_span: Span, + name: Ident, attrs: Vec, + items: Vec>) -> P; + + fn item_static(&self, + span: Span, + name: Ident, + ty: P, + mutbl: ast::Mutability, + expr: P) + -> P; + + fn item_const(&self, + span: Span, + name: Ident, + ty: P, + expr: P) + -> P; + + fn item_ty_poly(&self, + span: Span, + name: Ident, + ty: P, + generics: Generics) -> P; + fn item_ty(&self, span: Span, name: Ident, ty: P) -> P; + + fn attribute(&self, sp: Span, mi: ast::MetaItem) -> ast::Attribute; + + fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem; + + fn meta_list_item_word(&self, sp: Span, w: ast::Name) -> ast::NestedMetaItem; + + fn meta_list(&self, + sp: Span, + name: ast::Name, + mis: Vec ) + -> ast::MetaItem; + fn meta_name_value(&self, + sp: Span, + name: ast::Name, + value: ast::LitKind) + -> ast::MetaItem; + + fn item_use(&self, sp: Span, + vis: ast::Visibility, vp: P) -> P; + fn item_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> P; + fn item_use_simple_(&self, sp: Span, vis: ast::Visibility, + ident: ast::Ident, path: ast::Path) -> P; + fn item_use_list(&self, sp: Span, vis: ast::Visibility, + path: Vec, imports: &[ast::Ident]) -> P; + fn item_use_glob(&self, sp: Span, + vis: ast::Visibility, path: Vec) -> P; +} + +impl<'a> AstBuilder for ExtCtxt<'a> { + fn path(&self, span: Span, strs: Vec ) -> ast::Path { + self.path_all(span, false, strs, Vec::new(), Vec::new(), Vec::new()) + } + fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path { + self.path(span, vec![id]) + } + fn path_global(&self, span: Span, strs: Vec ) -> ast::Path { + self.path_all(span, true, strs, Vec::new(), Vec::new(), Vec::new()) + } + fn path_all(&self, + sp: Span, + global: bool, + mut idents: Vec , + lifetimes: Vec, + types: Vec>, + bindings: Vec ) + -> ast::Path { + let last_identifier = idents.pop().unwrap(); + let mut segments: Vec = Vec::new(); + if global { + segments.push(ast::PathSegment::crate_root()); + } + + segments.extend(idents.into_iter().map(Into::into)); + let parameters = if lifetimes.is_empty() && types.is_empty() && bindings.is_empty() { + None + } else { + Some(P(ast::PathParameters::AngleBracketed(ast::AngleBracketedParameterData { + lifetimes: lifetimes, + types: P::from_vec(types), + bindings: P::from_vec(bindings), + }))) + }; + segments.push(ast::PathSegment { identifier: last_identifier, parameters: parameters }); + ast::Path { + span: sp, + segments: segments, + } + } + + /// Constructs a qualified path. + /// + /// Constructs a path like `::ident`. + fn qpath(&self, + self_type: P, + trait_path: ast::Path, + ident: ast::Ident) + -> (ast::QSelf, ast::Path) { + self.qpath_all(self_type, trait_path, ident, vec![], vec![], vec![]) + } + + /// Constructs a qualified path. + /// + /// Constructs a path like `::ident<'a, T, A=Bar>`. + fn qpath_all(&self, + self_type: P, + trait_path: ast::Path, + ident: ast::Ident, + lifetimes: Vec, + types: Vec>, + bindings: Vec) + -> (ast::QSelf, ast::Path) { + let mut path = trait_path; + let parameters = ast::AngleBracketedParameterData { + lifetimes: lifetimes, + types: P::from_vec(types), + bindings: P::from_vec(bindings), + }; + path.segments.push(ast::PathSegment { + identifier: ident, + parameters: Some(P(ast::PathParameters::AngleBracketed(parameters))), + }); + + (ast::QSelf { + ty: self_type, + position: path.segments.len() - 1 + }, path) + } + + fn ty_mt(&self, ty: P, mutbl: ast::Mutability) -> ast::MutTy { + ast::MutTy { + ty: ty, + mutbl: mutbl + } + } + + fn ty(&self, span: Span, ty: ast::TyKind) -> P { + P(ast::Ty { + id: ast::DUMMY_NODE_ID, + span: span, + node: ty + }) + } + + fn ty_path(&self, path: ast::Path) -> P { + self.ty(path.span, ast::TyKind::Path(None, path)) + } + + fn ty_sum(&self, path: ast::Path, bounds: ast::TyParamBounds) -> P { + self.ty(path.span, + ast::TyKind::ObjectSum(self.ty_path(path), + bounds)) + } + + // Might need to take bounds as an argument in the future, if you ever want + // to generate a bounded existential trait type. + fn ty_ident(&self, span: Span, ident: ast::Ident) + -> P { + self.ty_path(self.path_ident(span, ident)) + } + + fn ty_rptr(&self, + span: Span, + ty: P, + lifetime: Option, + mutbl: ast::Mutability) + -> P { + self.ty(span, + ast::TyKind::Rptr(lifetime, self.ty_mt(ty, mutbl))) + } + + fn ty_ptr(&self, + span: Span, + ty: P, + mutbl: ast::Mutability) + -> P { + self.ty(span, + ast::TyKind::Ptr(self.ty_mt(ty, mutbl))) + } + + fn ty_option(&self, ty: P) -> P { + self.ty_path( + self.path_all(DUMMY_SP, + true, + self.std_path(&["option", "Option"]), + Vec::new(), + vec![ ty ], + Vec::new())) + } + + fn ty_infer(&self, span: Span) -> P { + self.ty(span, ast::TyKind::Infer) + } + + fn typaram(&self, + span: Span, + id: ast::Ident, + attrs: Vec, + bounds: ast::TyParamBounds, + default: Option>) -> ast::TyParam { + ast::TyParam { + ident: id, + id: ast::DUMMY_NODE_ID, + attrs: attrs.into(), + bounds: bounds, + default: default, + span: span + } + } + + // these are strange, and probably shouldn't be used outside of + // pipes. Specifically, the global version possible generates + // incorrect code. + fn ty_vars(&self, ty_params: &P<[ast::TyParam]>) -> Vec> { + ty_params.iter().map(|p| self.ty_ident(DUMMY_SP, p.ident)).collect() + } + + fn ty_vars_global(&self, ty_params: &P<[ast::TyParam]>) -> Vec> { + ty_params + .iter() + .map(|p| self.ty_path(self.path_global(DUMMY_SP, vec![p.ident]))) + .collect() + } + + fn trait_ref(&self, path: ast::Path) -> ast::TraitRef { + ast::TraitRef { + path: path, + ref_id: ast::DUMMY_NODE_ID, + } + } + + fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef { + ast::PolyTraitRef { + bound_lifetimes: Vec::new(), + trait_ref: self.trait_ref(path), + span: span, + } + } + + fn typarambound(&self, path: ast::Path) -> ast::TyParamBound { + ast::TraitTyParamBound(self.poly_trait_ref(path.span, path), ast::TraitBoundModifier::None) + } + + fn lifetime(&self, span: Span, name: ast::Name) -> ast::Lifetime { + ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, name: name } + } + + fn lifetime_def(&self, + span: Span, + name: ast::Name, + attrs: Vec, + bounds: Vec) + -> ast::LifetimeDef { + ast::LifetimeDef { + attrs: attrs.into(), + lifetime: self.lifetime(span, name), + bounds: bounds + } + } + + fn stmt_expr(&self, expr: P) -> ast::Stmt { + ast::Stmt { + id: ast::DUMMY_NODE_ID, + span: expr.span, + node: ast::StmtKind::Expr(expr), + } + } + + fn stmt_semi(&self, expr: P) -> ast::Stmt { + ast::Stmt { + id: ast::DUMMY_NODE_ID, + span: expr.span, + node: ast::StmtKind::Semi(expr), + } + } + + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, + ex: P) -> ast::Stmt { + let pat = if mutbl { + let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Mutable); + self.pat_ident_binding_mode(sp, ident, binding_mode) + } else { + self.pat_ident(sp, ident) + }; + let local = P(ast::Local { + pat: pat, + ty: None, + init: Some(ex), + id: ast::DUMMY_NODE_ID, + span: sp, + attrs: ast::ThinVec::new(), + }); + ast::Stmt { + id: ast::DUMMY_NODE_ID, + node: ast::StmtKind::Local(local), + span: sp, + } + } + + fn stmt_let_typed(&self, + sp: Span, + mutbl: bool, + ident: ast::Ident, + typ: P, + ex: P) + -> ast::Stmt { + let pat = if mutbl { + let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Mutable); + self.pat_ident_binding_mode(sp, ident, binding_mode) + } else { + self.pat_ident(sp, ident) + }; + let local = P(ast::Local { + pat: pat, + ty: Some(typ), + init: Some(ex), + id: ast::DUMMY_NODE_ID, + span: sp, + attrs: ast::ThinVec::new(), + }); + ast::Stmt { + id: ast::DUMMY_NODE_ID, + node: ast::StmtKind::Local(local), + span: sp, + } + } + + // Generate `let _: Type;`, usually used for type assertions. + fn stmt_let_type_only(&self, span: Span, ty: P) -> ast::Stmt { + let local = P(ast::Local { + pat: self.pat_wild(span), + ty: Some(ty), + init: None, + id: ast::DUMMY_NODE_ID, + span: span, + attrs: ast::ThinVec::new(), + }); + ast::Stmt { + id: ast::DUMMY_NODE_ID, + node: ast::StmtKind::Local(local), + span: span, + } + } + + fn stmt_item(&self, sp: Span, item: P) -> ast::Stmt { + ast::Stmt { + id: ast::DUMMY_NODE_ID, + node: ast::StmtKind::Item(item), + span: sp, + } + } + + fn block_expr(&self, expr: P) -> P { + self.block(expr.span, vec![ast::Stmt { + id: ast::DUMMY_NODE_ID, + span: expr.span, + node: ast::StmtKind::Expr(expr), + }]) + } + fn block(&self, span: Span, stmts: Vec) -> P { + P(ast::Block { + stmts: stmts, + id: ast::DUMMY_NODE_ID, + rules: BlockCheckMode::Default, + span: span, + }) + } + + fn expr(&self, span: Span, node: ast::ExprKind) -> P { + P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: node, + span: span, + attrs: ast::ThinVec::new(), + }) + } + + fn expr_path(&self, path: ast::Path) -> P { + self.expr(path.span, ast::ExprKind::Path(None, path)) + } + + /// Constructs a QPath expression. + fn expr_qpath(&self, span: Span, qself: ast::QSelf, path: ast::Path) -> P { + self.expr(span, ast::ExprKind::Path(Some(qself), path)) + } + + fn expr_ident(&self, span: Span, id: ast::Ident) -> P { + self.expr_path(self.path_ident(span, id)) + } + fn expr_self(&self, span: Span) -> P { + self.expr_ident(span, keywords::SelfValue.ident()) + } + + fn expr_binary(&self, sp: Span, op: ast::BinOpKind, + lhs: P, rhs: P) -> P { + self.expr(sp, ast::ExprKind::Binary(Spanned { node: op, span: sp }, lhs, rhs)) + } + + fn expr_deref(&self, sp: Span, e: P) -> P { + self.expr_unary(sp, UnOp::Deref, e) + } + fn expr_unary(&self, sp: Span, op: ast::UnOp, e: P) -> P { + self.expr(sp, ast::ExprKind::Unary(op, e)) + } + + fn expr_field_access(&self, sp: Span, expr: P, ident: ast::Ident) -> P { + let id = Spanned { node: ident, span: sp }; + self.expr(sp, ast::ExprKind::Field(expr, id)) + } + fn expr_tup_field_access(&self, sp: Span, expr: P, idx: usize) -> P { + let id = Spanned { node: idx, span: sp }; + self.expr(sp, ast::ExprKind::TupField(expr, id)) + } + fn expr_addr_of(&self, sp: Span, e: P) -> P { + self.expr(sp, ast::ExprKind::AddrOf(ast::Mutability::Immutable, e)) + } + fn expr_mut_addr_of(&self, sp: Span, e: P) -> P { + self.expr(sp, ast::ExprKind::AddrOf(ast::Mutability::Mutable, e)) + } + + fn expr_call(&self, span: Span, expr: P, args: Vec>) -> P { + self.expr(span, ast::ExprKind::Call(expr, args)) + } + fn expr_call_ident(&self, span: Span, id: ast::Ident, + args: Vec>) -> P { + self.expr(span, ast::ExprKind::Call(self.expr_ident(span, id), args)) + } + fn expr_call_global(&self, sp: Span, fn_path: Vec , + args: Vec> ) -> P { + let pathexpr = self.expr_path(self.path_global(sp, fn_path)); + self.expr_call(sp, pathexpr, args) + } + fn expr_method_call(&self, span: Span, + expr: P, + ident: ast::Ident, + mut args: Vec> ) -> P { + let id = Spanned { node: ident, span: span }; + args.insert(0, expr); + self.expr(span, ast::ExprKind::MethodCall(id, Vec::new(), args)) + } + fn expr_block(&self, b: P) -> P { + self.expr(b.span, ast::ExprKind::Block(b)) + } + fn field_imm(&self, span: Span, name: Ident, e: P) -> ast::Field { + ast::Field { ident: respan(span, name), expr: e, span: span, is_shorthand: false } + } + fn expr_struct(&self, span: Span, path: ast::Path, fields: Vec) -> P { + self.expr(span, ast::ExprKind::Struct(path, fields, None)) + } + fn expr_struct_ident(&self, span: Span, + id: ast::Ident, fields: Vec) -> P { + self.expr_struct(span, self.path_ident(span, id), fields) + } + + fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P { + self.expr(sp, ast::ExprKind::Lit(P(respan(sp, lit)))) + } + fn expr_usize(&self, span: Span, i: usize) -> P { + self.expr_lit(span, ast::LitKind::Int(i as u64, + ast::LitIntType::Unsigned(ast::UintTy::Us))) + } + fn expr_isize(&self, sp: Span, i: isize) -> P { + if i < 0 { + let i = (-i) as u64; + let lit_ty = ast::LitIntType::Signed(ast::IntTy::Is); + let lit = self.expr_lit(sp, ast::LitKind::Int(i, lit_ty)); + self.expr_unary(sp, ast::UnOp::Neg, lit) + } else { + self.expr_lit(sp, ast::LitKind::Int(i as u64, + ast::LitIntType::Signed(ast::IntTy::Is))) + } + } + fn expr_u32(&self, sp: Span, u: u32) -> P { + self.expr_lit(sp, ast::LitKind::Int(u as u64, + ast::LitIntType::Unsigned(ast::UintTy::U32))) + } + fn expr_u8(&self, sp: Span, u: u8) -> P { + self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::LitIntType::Unsigned(ast::UintTy::U8))) + } + fn expr_bool(&self, sp: Span, value: bool) -> P { + self.expr_lit(sp, ast::LitKind::Bool(value)) + } + + fn expr_vec(&self, sp: Span, exprs: Vec>) -> P { + self.expr(sp, ast::ExprKind::Vec(exprs)) + } + fn expr_vec_ng(&self, sp: Span) -> P { + self.expr_call_global(sp, self.std_path(&["vec", "Vec", "new"]), + Vec::new()) + } + fn expr_vec_slice(&self, sp: Span, exprs: Vec>) -> P { + self.expr_addr_of(sp, self.expr_vec(sp, exprs)) + } + fn expr_str(&self, sp: Span, s: Symbol) -> P { + self.expr_lit(sp, ast::LitKind::Str(s, ast::StrStyle::Cooked)) + } + + fn expr_cast(&self, sp: Span, expr: P, ty: P) -> P { + self.expr(sp, ast::ExprKind::Cast(expr, ty)) + } + + + fn expr_some(&self, sp: Span, expr: P) -> P { + let some = self.std_path(&["option", "Option", "Some"]); + self.expr_call_global(sp, some, vec![expr]) + } + + fn expr_none(&self, sp: Span) -> P { + let none = self.std_path(&["option", "Option", "None"]); + let none = self.path_global(sp, none); + self.expr_path(none) + } + + + fn expr_break(&self, sp: Span) -> P { + self.expr(sp, ast::ExprKind::Break(None, None)) + } + + + fn expr_tuple(&self, sp: Span, exprs: Vec>) -> P { + self.expr(sp, ast::ExprKind::Tup(exprs)) + } + + fn expr_fail(&self, span: Span, msg: Symbol) -> P { + let loc = self.codemap().lookup_char_pos(span.lo); + let expr_file = self.expr_str(span, Symbol::intern(&loc.file.name)); + let expr_line = self.expr_u32(span, loc.line as u32); + let expr_file_line_tuple = self.expr_tuple(span, vec![expr_file, expr_line]); + let expr_file_line_ptr = self.expr_addr_of(span, expr_file_line_tuple); + self.expr_call_global( + span, + self.std_path(&["rt", "begin_panic"]), + vec![ + self.expr_str(span, msg), + expr_file_line_ptr]) + } + + fn expr_unreachable(&self, span: Span) -> P { + self.expr_fail(span, Symbol::intern("internal error: entered unreachable code")) + } + + fn expr_ok(&self, sp: Span, expr: P) -> P { + let ok = self.std_path(&["result", "Result", "Ok"]); + self.expr_call_global(sp, ok, vec![expr]) + } + + fn expr_err(&self, sp: Span, expr: P) -> P { + let err = self.std_path(&["result", "Result", "Err"]); + self.expr_call_global(sp, err, vec![expr]) + } + + fn expr_try(&self, sp: Span, head: P) -> P { + let ok = self.std_path(&["result", "Result", "Ok"]); + let ok_path = self.path_global(sp, ok); + let err = self.std_path(&["result", "Result", "Err"]); + let err_path = self.path_global(sp, err); + + let binding_variable = self.ident_of("__try_var"); + let binding_pat = self.pat_ident(sp, binding_variable); + let binding_expr = self.expr_ident(sp, binding_variable); + + // Ok(__try_var) pattern + let ok_pat = self.pat_tuple_struct(sp, ok_path, vec![binding_pat.clone()]); + + // Err(__try_var) (pattern and expression resp.) + let err_pat = self.pat_tuple_struct(sp, err_path.clone(), vec![binding_pat]); + let err_inner_expr = self.expr_call(sp, self.expr_path(err_path), + vec![binding_expr.clone()]); + // return Err(__try_var) + let err_expr = self.expr(sp, ast::ExprKind::Ret(Some(err_inner_expr))); + + // Ok(__try_var) => __try_var + let ok_arm = self.arm(sp, vec![ok_pat], binding_expr); + // Err(__try_var) => return Err(__try_var) + let err_arm = self.arm(sp, vec![err_pat], err_expr); + + // match head { Ok() => ..., Err() => ... } + self.expr_match(sp, head, vec![ok_arm, err_arm]) + } + + + fn pat(&self, span: Span, pat: PatKind) -> P { + P(ast::Pat { id: ast::DUMMY_NODE_ID, node: pat, span: span }) + } + fn pat_wild(&self, span: Span) -> P { + self.pat(span, PatKind::Wild) + } + fn pat_lit(&self, span: Span, expr: P) -> P { + self.pat(span, PatKind::Lit(expr)) + } + fn pat_ident(&self, span: Span, ident: ast::Ident) -> P { + let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Immutable); + self.pat_ident_binding_mode(span, ident, binding_mode) + } + + fn pat_ident_binding_mode(&self, + span: Span, + ident: ast::Ident, + bm: ast::BindingMode) -> P { + let pat = PatKind::Ident(bm, Spanned{span: span, node: ident}, None); + self.pat(span, pat) + } + fn pat_path(&self, span: Span, path: ast::Path) -> P { + self.pat(span, PatKind::Path(None, path)) + } + fn pat_tuple_struct(&self, span: Span, path: ast::Path, + subpats: Vec>) -> P { + self.pat(span, PatKind::TupleStruct(path, subpats, None)) + } + fn pat_struct(&self, span: Span, path: ast::Path, + field_pats: Vec>) -> P { + self.pat(span, PatKind::Struct(path, field_pats, false)) + } + fn pat_tuple(&self, span: Span, pats: Vec>) -> P { + self.pat(span, PatKind::Tuple(pats, None)) + } + + fn pat_some(&self, span: Span, pat: P) -> P { + let some = self.std_path(&["option", "Option", "Some"]); + let path = self.path_global(span, some); + self.pat_tuple_struct(span, path, vec![pat]) + } + + fn pat_none(&self, span: Span) -> P { + let some = self.std_path(&["option", "Option", "None"]); + let path = self.path_global(span, some); + self.pat_path(span, path) + } + + fn pat_ok(&self, span: Span, pat: P) -> P { + let some = self.std_path(&["result", "Result", "Ok"]); + let path = self.path_global(span, some); + self.pat_tuple_struct(span, path, vec![pat]) + } + + fn pat_err(&self, span: Span, pat: P) -> P { + let some = self.std_path(&["result", "Result", "Err"]); + let path = self.path_global(span, some); + self.pat_tuple_struct(span, path, vec![pat]) + } + + fn arm(&self, _span: Span, pats: Vec>, expr: P) -> ast::Arm { + ast::Arm { + attrs: vec![], + pats: pats, + guard: None, + body: expr + } + } + + fn arm_unreachable(&self, span: Span) -> ast::Arm { + self.arm(span, vec![self.pat_wild(span)], self.expr_unreachable(span)) + } + + fn expr_match(&self, span: Span, arg: P, arms: Vec) -> P { + self.expr(span, ast::ExprKind::Match(arg, arms)) + } + + fn expr_if(&self, span: Span, cond: P, + then: P, els: Option>) -> P { + let els = els.map(|x| self.expr_block(self.block_expr(x))); + self.expr(span, ast::ExprKind::If(cond, self.block_expr(then), els)) + } + + fn expr_loop(&self, span: Span, block: P) -> P { + self.expr(span, ast::ExprKind::Loop(block, None)) + } + + fn lambda_fn_decl(&self, + span: Span, + fn_decl: P, + body: P, + fn_decl_span: Span) // span of the `|...|` part + -> P { + self.expr(span, ast::ExprKind::Closure(ast::CaptureBy::Ref, + fn_decl, + body, + fn_decl_span)) + } + + fn lambda(&self, + span: Span, + ids: Vec, + body: P) + -> P { + let fn_decl = self.fn_decl( + ids.iter().map(|id| self.arg(span, *id, self.ty_infer(span))).collect(), + self.ty_infer(span)); + + // FIXME -- We are using `span` as the span of the `|...|` + // part of the lambda, but it probably (maybe?) corresponds to + // the entire lambda body. Probably we should extend the API + // here, but that's not entirely clear. + self.expr(span, ast::ExprKind::Closure(ast::CaptureBy::Ref, fn_decl, body, span)) + } + + fn lambda0(&self, span: Span, body: P) -> P { + self.lambda(span, Vec::new(), body) + } + + fn lambda1(&self, span: Span, body: P, ident: ast::Ident) -> P { + self.lambda(span, vec![ident], body) + } + + fn lambda_stmts(&self, + span: Span, + ids: Vec, + stmts: Vec) + -> P { + self.lambda(span, ids, self.expr_block(self.block(span, stmts))) + } + fn lambda_stmts_0(&self, span: Span, stmts: Vec) -> P { + self.lambda0(span, self.expr_block(self.block(span, stmts))) + } + fn lambda_stmts_1(&self, span: Span, stmts: Vec, + ident: ast::Ident) -> P { + self.lambda1(span, self.expr_block(self.block(span, stmts)), ident) + } + + fn arg(&self, span: Span, ident: ast::Ident, ty: P) -> ast::Arg { + let arg_pat = self.pat_ident(span, ident); + ast::Arg { + ty: ty, + pat: arg_pat, + id: ast::DUMMY_NODE_ID + } + } + + // FIXME unused self + fn fn_decl(&self, inputs: Vec, output: P) -> P { + P(ast::FnDecl { + inputs: inputs, + output: ast::FunctionRetTy::Ty(output), + variadic: false + }) + } + + fn item(&self, span: Span, name: Ident, + attrs: Vec, node: ast::ItemKind) -> P { + // FIXME: Would be nice if our generated code didn't violate + // Rust coding conventions + P(ast::Item { + ident: name, + attrs: attrs, + id: ast::DUMMY_NODE_ID, + node: node, + vis: ast::Visibility::Inherited, + span: span + }) + } + + fn item_fn_poly(&self, + span: Span, + name: Ident, + inputs: Vec , + output: P, + generics: Generics, + body: P) -> P { + self.item(span, + name, + Vec::new(), + ast::ItemKind::Fn(self.fn_decl(inputs, output), + ast::Unsafety::Normal, + dummy_spanned(ast::Constness::NotConst), + Abi::Rust, + generics, + body)) + } + + fn item_fn(&self, + span: Span, + name: Ident, + inputs: Vec , + output: P, + body: P + ) -> P { + self.item_fn_poly( + span, + name, + inputs, + output, + Generics::default(), + body) + } + + fn variant(&self, span: Span, name: Ident, tys: Vec> ) -> ast::Variant { + let fields: Vec<_> = tys.into_iter().map(|ty| { + ast::StructField { + span: ty.span, + ty: ty, + ident: None, + vis: ast::Visibility::Inherited, + attrs: Vec::new(), + id: ast::DUMMY_NODE_ID, + } + }).collect(); + + let vdata = if fields.is_empty() { + ast::VariantData::Unit(ast::DUMMY_NODE_ID) + } else { + ast::VariantData::Tuple(fields, ast::DUMMY_NODE_ID) + }; + + respan(span, + ast::Variant_ { + name: name, + attrs: Vec::new(), + data: vdata, + disr_expr: None, + }) + } + + fn item_enum_poly(&self, span: Span, name: Ident, + enum_definition: ast::EnumDef, + generics: Generics) -> P { + self.item(span, name, Vec::new(), ast::ItemKind::Enum(enum_definition, generics)) + } + + fn item_enum(&self, span: Span, name: Ident, + enum_definition: ast::EnumDef) -> P { + self.item_enum_poly(span, name, enum_definition, + Generics::default()) + } + + fn item_struct(&self, span: Span, name: Ident, + struct_def: ast::VariantData) -> P { + self.item_struct_poly( + span, + name, + struct_def, + Generics::default() + ) + } + + fn item_struct_poly(&self, span: Span, name: Ident, + struct_def: ast::VariantData, generics: Generics) -> P { + self.item(span, name, Vec::new(), ast::ItemKind::Struct(struct_def, generics)) + } + + fn item_mod(&self, span: Span, inner_span: Span, name: Ident, + attrs: Vec, + items: Vec>) -> P { + self.item( + span, + name, + attrs, + ast::ItemKind::Mod(ast::Mod { + inner: inner_span, + items: items, + }) + ) + } + + fn item_static(&self, + span: Span, + name: Ident, + ty: P, + mutbl: ast::Mutability, + expr: P) + -> P { + self.item(span, name, Vec::new(), ast::ItemKind::Static(ty, mutbl, expr)) + } + + fn item_const(&self, + span: Span, + name: Ident, + ty: P, + expr: P) + -> P { + self.item(span, name, Vec::new(), ast::ItemKind::Const(ty, expr)) + } + + fn item_ty_poly(&self, span: Span, name: Ident, ty: P, + generics: Generics) -> P { + self.item(span, name, Vec::new(), ast::ItemKind::Ty(ty, generics)) + } + + fn item_ty(&self, span: Span, name: Ident, ty: P) -> P { + self.item_ty_poly(span, name, ty, Generics::default()) + } + + fn attribute(&self, sp: Span, mi: ast::MetaItem) -> ast::Attribute { + attr::mk_spanned_attr_outer(sp, attr::mk_attr_id(), mi) + } + + fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem { + attr::mk_spanned_word_item(sp, w) + } + + fn meta_list_item_word(&self, sp: Span, w: ast::Name) -> ast::NestedMetaItem { + respan(sp, ast::NestedMetaItemKind::MetaItem(attr::mk_spanned_word_item(sp, w))) + } + + fn meta_list(&self, sp: Span, name: ast::Name, mis: Vec) + -> ast::MetaItem { + attr::mk_spanned_list_item(sp, name, mis) + } + + fn meta_name_value(&self, sp: Span, name: ast::Name, value: ast::LitKind) + -> ast::MetaItem { + attr::mk_spanned_name_value_item(sp, name, respan(sp, value)) + } + + fn item_use(&self, sp: Span, + vis: ast::Visibility, vp: P) -> P { + P(ast::Item { + id: ast::DUMMY_NODE_ID, + ident: keywords::Invalid.ident(), + attrs: vec![], + node: ast::ItemKind::Use(vp), + vis: vis, + span: sp + }) + } + + fn item_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> P { + let last = path.segments.last().unwrap().identifier; + self.item_use_simple_(sp, vis, last, path) + } + + fn item_use_simple_(&self, sp: Span, vis: ast::Visibility, + ident: ast::Ident, path: ast::Path) -> P { + self.item_use(sp, vis, + P(respan(sp, + ast::ViewPathSimple(ident, + path)))) + } + + fn item_use_list(&self, sp: Span, vis: ast::Visibility, + path: Vec, imports: &[ast::Ident]) -> P { + let imports = imports.iter().map(|id| { + let item = ast::PathListItem_ { + name: *id, + rename: None, + id: ast::DUMMY_NODE_ID, + }; + respan(sp, item) + }).collect(); + + self.item_use(sp, vis, + P(respan(sp, + ast::ViewPathList(self.path(sp, path), + imports)))) + } + + fn item_use_glob(&self, sp: Span, + vis: ast::Visibility, path: Vec) -> P { + self.item_use(sp, vis, + P(respan(sp, + ast::ViewPathGlob(self.path(sp, path))))) + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/decorator.rs b/third_party/rust/syntex_syntax/src/ext/decorator.rs new file mode 100644 index 000000000000..4451b31168e2 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/decorator.rs @@ -0,0 +1,316 @@ +use ast::{self, Name}; +use attr::{self, HasAttrs}; +use fold::*; +use codemap::{ExpnInfo, MacroAttribute, NameAndSpan, respan}; +use ext::base::*; +use ext::build::AstBuilder; +use ptr::P; +use symbol::Symbol; +use util::small_vector::SmallVector; + +pub fn expand_attributes(cx: &mut ExtCtxt, krate: ast::Crate) -> ast::Crate { + MacroExpander { cx: cx }.fold_crate(krate) +} + +struct MacroExpander<'a, 'b: 'a> { + cx: &'a mut ExtCtxt<'b>, +} + +impl<'a, 'b: 'a> Folder for MacroExpander<'a, 'b> { + fn fold_item(&mut self, item: P) -> SmallVector> { + let annotatable = Annotatable::Item(item); + expand_annotatable(annotatable, self).into_iter().flat_map(|annotatable| { + match annotatable { + Annotatable::Item(item) => noop_fold_item(item, self), + _ => panic!() + } + }).collect() + } + + fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector { + let annotatable = Annotatable::TraitItem(P(item)); + expand_annotatable(annotatable, self).into_iter().flat_map(|annotatable| { + match annotatable { + Annotatable::TraitItem(item) => noop_fold_trait_item(item.unwrap(), self), + _ => panic!() + } + }).collect() + } + + fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector { + let annotatable = Annotatable::ImplItem(P(item)); + expand_annotatable(annotatable, self).into_iter().flat_map(|annotatable| { + match annotatable { + Annotatable::ImplItem(item) => noop_fold_impl_item(item.unwrap(), self), + _ => panic!() + } + }).collect() + } + + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { + noop_fold_mac(mac, self) + } +} + +fn expand_annotatable( + mut item: Annotatable, + fld: &mut MacroExpander, +) -> SmallVector { + let mut out_items = SmallVector::zero(); + let mut new_attrs = Vec::new(); + + item = expand_1(item, fld, &mut out_items, &mut new_attrs); + + item = item.map_attrs(|_| new_attrs); + out_items.push(item); + + out_items +} + +// Responsible for expanding `cfg_attr` and delegating to expand_2. +// +// The expansion turns this: +// +// #[cfg_attr(COND1, SPEC1)] +// #[cfg_attr(COND2, SPEC2)] +// struct Item { ... } +// +// into this: +// +// #[cfg(COND1)] +// impl Trait for Item { ... } +// #[cfg_attr(COND2, SPEC3)] +// struct Item { ... } +// +// In the example, SPEC1 was handled by expand_2 to create the impl, and the +// handling of SPEC2 resulted in a new attribute SPEC3 which remains +// conditional. +fn expand_1( + mut item: Annotatable, + fld: &mut MacroExpander, + out_items: &mut SmallVector, + new_attrs: &mut Vec, +) -> Annotatable { + while !item.attrs().is_empty() { + // Pop the first attribute. + let mut attr = None; + item = item.map_attrs(|mut attrs| { + attr = Some(attrs.remove(0)); + attrs + }); + let attr = attr.unwrap(); + + if let ast::MetaItemKind::List(ref vec) = attr.value.node { + // #[cfg_attr(COND, SPEC)] + if attr.value.name == "cfg_attr" && vec.len() == 2 { + if let ast::NestedMetaItemKind::MetaItem(ref spec) = vec[1].node { + // #[cfg(COND)] + let cond = fld.cx.attribute( + attr.span, + fld.cx.meta_list( + attr.value.span, + Symbol::intern("cfg"), + vec[..1].to_vec())); + // #[SPEC] + let spec = fld.cx.attribute( + attr.span, + spec.clone()); + let mut items = SmallVector::zero(); + let mut attrs = Vec::new(); + item = expand_2(item, &spec, fld, &mut items, &mut attrs); + for new_item in items { + let new_item = new_item.map_attrs(|mut attrs| { + attrs.push(cond.clone()); + attrs + }); + out_items.push(new_item); + } + for new_attr in attrs { + let new_spec = respan(attr.span, + ast::NestedMetaItemKind::MetaItem(new_attr.value)); + // #[cfg_attr(COND, NEW_SPEC)] + let new_attr = fld.cx.attribute( + attr.span, + fld.cx.meta_list( + attr.value.span, + attr.value.name.clone(), + vec![vec[0].clone(), new_spec])); + new_attrs.push(new_attr); + } + continue; + } + } + } + item = expand_2(item, &attr, fld, out_items, new_attrs); + } + item +} + +// Responsible for expanding `derive` and delegating to expand_3. +// +// The expansion turns this: +// +// #[derive(Serialize, Clone)] +// #[other_attr] +// struct Item { ... } +// +// into this: +// +// impl Serialize for Item { ... } +// #[derive(Clone)] +// #[other_attr] +// struct Item { ... } +// +// In the example, `derive_Serialize` was handled by expand_3 to create the impl +// but `derive_Clone` and `other_attr` were not handled. Attributes that are not +// handled by expand_3 are preserved. +fn expand_2( + mut item: Annotatable, + attr: &ast::Attribute, + fld: &mut MacroExpander, + out_items: &mut SmallVector, + new_attrs: &mut Vec, +) -> Annotatable { + let mname = attr.value.name; + let mitem = &attr.value; + if mname == "derive" { + let traits = mitem.meta_item_list().unwrap_or(&[]); + if traits.is_empty() { + fld.cx.span_warn(mitem.span, "empty trait list in `derive`"); + } + let mut not_handled = Vec::new(); + for titem in traits.iter().rev() { + let tname = match titem.node { + ast::NestedMetaItemKind::MetaItem(ref inner) => { + match inner.node { + ast::MetaItemKind::Word => inner.name, + _ => { + fld.cx.span_err(titem.span, "malformed `derive` entry"); + continue; + } + } + } + _ => { + fld.cx.span_err(titem.span, "malformed `derive` entry"); + continue; + } + }; + let tname = Symbol::intern(&format!("derive_{}", tname)); + // #[derive_Trait] + let derive = fld.cx.attribute( + attr.span, + fld.cx.meta_word(titem.span, tname)); + item = match expand_3(item, &derive, fld, out_items, tname) { + Expansion::Handled(item) => item, + Expansion::NotHandled(item) => { + not_handled.push((*titem).clone()); + item + } + }; + } + if !not_handled.is_empty() { + // #[derive(Trait, ...)] + let derive = fld.cx.attribute( + attr.span, + fld.cx.meta_list(mitem.span, mname, not_handled)); + new_attrs.push(derive); + } + item + } else { + match expand_3(item, attr, fld, out_items, mname) { + Expansion::Handled(item) => item, + Expansion::NotHandled(item) => { + new_attrs.push((*attr).clone()); + item + } + } + } +} + +enum Expansion { + Handled(Annotatable), + /// Here is your `Annotatable` back. + NotHandled(Annotatable), +} + +// Responsible for expanding attributes that match a MultiDecorator or +// MultiModifier registered in the syntax_env. Returns the item to continue +// processing. +// +// Syntex supports only a special case of MultiModifier - those that produce +// exactly one output. If a MultiModifier produces zero or more than one output +// this function panics. The problematic case we cannot support is: +// +// #[decorator] // not registered with Syntex +// #[modifier] // registered +// struct A; +fn expand_3( + item: Annotatable, + attr: &ast::Attribute, + fld: &mut MacroExpander, + out_items: &mut SmallVector, + mname: Name, +) -> Expansion { + let scope = fld.cx.current_expansion.mark; + match fld.cx.resolver.find_extension(scope, mname) { + Some(rc) => match *rc { + MultiDecorator(ref mac) => { + attr::mark_used(&attr); + fld.cx.bt_push(ExpnInfo { + call_site: attr.span, + callee: NameAndSpan { + format: MacroAttribute(mname), + span: Some(attr.span), + // attributes can do whatever they like, for now. + allow_internal_unstable: true, + } + }); + + let mut modified = Vec::new(); + mac.expand(fld.cx, attr.span, &attr.value, &item, + &mut |item| modified.push(item)); + + fld.cx.bt_pop(); + out_items.extend(modified.into_iter() + .flat_map(|ann| expand_annotatable(ann, fld).into_iter())); + Expansion::Handled(item) + } + MultiModifier(ref mac) => { + attr::mark_used(&attr); + fld.cx.bt_push(ExpnInfo { + call_site: attr.span, + callee: NameAndSpan { + format: MacroAttribute(mname), + span: Some(attr.span), + // attributes can do whatever they like, for now. + allow_internal_unstable: true, + } + }); + + let mut modified = mac.expand(fld.cx, + attr.span, + &attr.value, + item); + if modified.len() != 1 { + panic!("syntex limitation: expected 1 output from `#[{}]` but got {}", + mname, modified.len()); + } + let modified = modified.pop().unwrap(); + + fld.cx.bt_pop(); + + let mut expanded = expand_annotatable(modified, fld); + if expanded.is_empty() { + panic!("syntex limitation: output of `#[{}]` must not expand further", + mname); + } + let last = expanded.pop().unwrap(); + + out_items.extend(expanded); + Expansion::Handled(last) + } + _ => Expansion::NotHandled(item), + }, + _ => Expansion::NotHandled(item), + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/env.rs b/third_party/rust/syntex_syntax/src/ext/env.rs new file mode 100644 index 000000000000..dae8d4fc9384 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/env.rs @@ -0,0 +1,99 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/* + * The compiler code necessary to support the env! extension. Eventually this + * should all get sucked into either the compiler syntax extension plugin + * interface. + */ + +use ast; +use ext::base::*; +use ext::base; +use ext::build::AstBuilder; +use symbol::Symbol; +use syntax_pos::Span; +use tokenstream; + +use std::env; + +pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, + sp: Span, + tts: &[tokenstream::TokenTree]) + -> Box { + let var = match get_single_str_from_tts(cx, sp, tts, "option_env!") { + None => return DummyResult::expr(sp), + Some(v) => v, + }; + + let e = match env::var(&*var.as_str()) { + Err(..) => { + cx.expr_path(cx.path_all(sp, + true, + cx.std_path(&["option", "Option", "None"]), + Vec::new(), + vec![cx.ty_rptr(sp, + cx.ty_ident(sp, cx.ident_of("str")), + Some(cx.lifetime(sp, + cx.ident_of("'static") + .name)), + ast::Mutability::Immutable)], + Vec::new())) + } + Ok(s) => { + cx.expr_call_global(sp, + cx.std_path(&["option", "Option", "Some"]), + vec![cx.expr_str(sp, Symbol::intern(&s))]) + } + }; + MacEager::expr(e) +} + +pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, + sp: Span, + tts: &[tokenstream::TokenTree]) + -> Box { + let mut exprs = match get_exprs_from_tts(cx, sp, tts) { + Some(ref exprs) if exprs.is_empty() => { + cx.span_err(sp, "env! takes 1 or 2 arguments"); + return DummyResult::expr(sp); + } + None => return DummyResult::expr(sp), + Some(exprs) => exprs.into_iter(), + }; + + let var = match expr_to_string(cx, exprs.next().unwrap(), "expected string literal") { + None => return DummyResult::expr(sp), + Some((v, _style)) => v, + }; + let msg = match exprs.next() { + None => Symbol::intern(&format!("environment variable `{}` not defined", var)), + Some(second) => { + match expr_to_string(cx, second, "expected string literal") { + None => return DummyResult::expr(sp), + Some((s, _style)) => s, + } + } + }; + + if let Some(_) = exprs.next() { + cx.span_err(sp, "env! takes 1 or 2 arguments"); + return DummyResult::expr(sp); + } + + let e = match env::var(&*var.as_str()) { + Err(_) => { + cx.span_err(sp, &msg.as_str()); + cx.expr_usize(sp, 0) + } + Ok(s) => cx.expr_str(sp, Symbol::intern(&s)), + }; + MacEager::expr(e) +} diff --git a/third_party/rust/syntex_syntax/src/ext/expand.rs b/third_party/rust/syntex_syntax/src/ext/expand.rs new file mode 100644 index 000000000000..4043b6d3224c --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/expand.rs @@ -0,0 +1,1008 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ast::{Block, Ident, Mac_, PatKind}; +use ast::{Name, MacStmtStyle, StmtKind, ItemKind}; +use ast; +use ext::hygiene::Mark; +use ext::placeholders::{placeholder, PlaceholderExpander}; +use attr::{self, HasAttrs}; +use codemap::{ExpnInfo, NameAndSpan, MacroBang, MacroAttribute}; +use syntax_pos::{self, Span, ExpnId}; +use config::{is_test_or_bench, StripUnconfigured}; +use ext::base::*; +use ext::decorator::expand_attributes; +use feature_gate::{self, Features}; +use fold; +use fold::*; +use parse::{ParseSess, DirectoryOwnership, PResult, lexer}; +use parse::parser::Parser; +use parse::token; +use print::pprust; +use ptr::P; +use std_inject; +use symbol::keywords; +use tokenstream::{TokenTree, TokenStream}; +use util::small_vector::SmallVector; +use visit::Visitor; + +use std::mem; +use std::path::PathBuf; +use std::rc::Rc; + +macro_rules! expansions { + ($($kind:ident: $ty:ty [$($vec:ident, $ty_elt:ty)*], $kind_name:expr, .$make:ident, + $(.$fold:ident)* $(lift .$fold_elt:ident)*, + $(.$visit:ident)* $(lift .$visit_elt:ident)*;)*) => { + #[derive(Copy, Clone, PartialEq, Eq)] + pub enum ExpansionKind { OptExpr, $( $kind, )* } + pub enum Expansion { OptExpr(Option>), $( $kind($ty), )* } + + impl ExpansionKind { + pub fn name(self) -> &'static str { + match self { + ExpansionKind::OptExpr => "expression", + $( ExpansionKind::$kind => $kind_name, )* + } + } + + fn make_from<'a>(self, result: Box) -> Option { + match self { + ExpansionKind::OptExpr => result.make_expr().map(Some).map(Expansion::OptExpr), + $( ExpansionKind::$kind => result.$make().map(Expansion::$kind), )* + } + } + } + + impl Expansion { + pub fn make_opt_expr(self) -> Option> { + match self { + Expansion::OptExpr(expr) => expr, + _ => panic!("Expansion::make_* called on the wrong kind of expansion"), + } + } + $( pub fn $make(self) -> $ty { + match self { + Expansion::$kind(ast) => ast, + _ => panic!("Expansion::make_* called on the wrong kind of expansion"), + } + } )* + + pub fn fold_with(self, folder: &mut F) -> Self { + use self::Expansion::*; + match self { + OptExpr(expr) => OptExpr(expr.and_then(|expr| folder.fold_opt_expr(expr))), + $($( $kind(ast) => $kind(folder.$fold(ast)), )*)* + $($( $kind(ast) => { + $kind(ast.into_iter().flat_map(|ast| folder.$fold_elt(ast)).collect()) + }, )*)* + } + } + + pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) { + match *self { + Expansion::OptExpr(Some(ref expr)) => visitor.visit_expr(expr), + Expansion::OptExpr(None) => {} + $($( Expansion::$kind(ref ast) => visitor.$visit(ast), )*)* + $($( Expansion::$kind(ref ast) => for ast in &ast[..] { + visitor.$visit_elt(ast); + }, )*)* + } + } + } + + impl<'a, 'b> Folder for MacroExpander<'a, 'b> { + fn fold_opt_expr(&mut self, expr: P) -> Option> { + self.expand(Expansion::OptExpr(Some(expr))).make_opt_expr() + } + $($(fn $fold(&mut self, node: $ty) -> $ty { + self.expand(Expansion::$kind(node)).$make() + })*)* + $($(fn $fold_elt(&mut self, node: $ty_elt) -> $ty { + self.expand(Expansion::$kind(SmallVector::one(node))).$make() + })*)* + } + + impl<'a> MacResult for ::ext::tt::macro_rules::ParserAnyMacro<'a> { + $(fn $make(self: Box<::ext::tt::macro_rules::ParserAnyMacro<'a>>) -> Option<$ty> { + Some(self.make(ExpansionKind::$kind).$make()) + })* + } + } +} + +expansions! { + Expr: P [], "expression", .make_expr, .fold_expr, .visit_expr; + Pat: P [], "pattern", .make_pat, .fold_pat, .visit_pat; + Ty: P [], "type", .make_ty, .fold_ty, .visit_ty; + Stmts: SmallVector [SmallVector, ast::Stmt], + "statement", .make_stmts, lift .fold_stmt, lift .visit_stmt; + Items: SmallVector> [SmallVector, P], + "item", .make_items, lift .fold_item, lift .visit_item; + TraitItems: SmallVector [SmallVector, ast::TraitItem], + "trait item", .make_trait_items, lift .fold_trait_item, lift .visit_trait_item; + ImplItems: SmallVector [SmallVector, ast::ImplItem], + "impl item", .make_impl_items, lift .fold_impl_item, lift .visit_impl_item; +} + +impl ExpansionKind { + fn dummy(self, span: Span) -> Expansion { + self.make_from(DummyResult::any(span)).unwrap() + } + + fn expect_from_annotatables>(self, items: I) -> Expansion { + let items = items.into_iter(); + match self { + ExpansionKind::Items => + Expansion::Items(items.map(Annotatable::expect_item).collect()), + ExpansionKind::ImplItems => + Expansion::ImplItems(items.map(Annotatable::expect_impl_item).collect()), + ExpansionKind::TraitItems => + Expansion::TraitItems(items.map(Annotatable::expect_trait_item).collect()), + _ => unreachable!(), + } + } +} + +pub struct Invocation { + pub kind: InvocationKind, + expansion_kind: ExpansionKind, + expansion_data: ExpansionData, +} + +pub enum InvocationKind { + Bang { + mac: ast::Mac, + ident: Option, + span: Span, + }, + Attr { + attr: ast::Attribute, + item: Annotatable, + }, +} + +impl Invocation { + fn span(&self) -> Span { + match self.kind { + InvocationKind::Bang { span, .. } => span, + InvocationKind::Attr { ref attr, .. } => attr.span, + } + } +} + +pub struct MacroExpander<'a, 'b:'a> { + pub cx: &'a mut ExtCtxt<'b>, + monotonic: bool, // c.f. `cx.monotonic_expander()` +} + +impl<'a, 'b> MacroExpander<'a, 'b> { + pub fn new(cx: &'a mut ExtCtxt<'b>, monotonic: bool) -> Self { + MacroExpander { cx: cx, monotonic: monotonic } + } + + pub fn expand_crate(&mut self, krate: ast::Crate) -> ast::Crate { + self.cx.crate_root = std_inject::injected_crate_name(&krate); + let mut module = ModuleData { + mod_path: vec![Ident::from_str(&self.cx.ecfg.crate_name)], + directory: PathBuf::from(self.cx.codemap().span_to_filename(krate.span)), + }; + module.directory.pop(); + self.cx.current_expansion.module = Rc::new(module); + + // FIXME(syntex): Expand attributes + let mut krate = expand_attributes(self.cx, krate); + + let krate_item = Expansion::Items(SmallVector::one(P(ast::Item { + attrs: krate.attrs, + span: krate.span, + node: ast::ItemKind::Mod(krate.module), + ident: keywords::Invalid.ident(), + id: ast::DUMMY_NODE_ID, + vis: ast::Visibility::Public, + }))); + + match self.expand(krate_item).make_items().pop().unwrap().unwrap() { + ast::Item { attrs, node: ast::ItemKind::Mod(module), .. } => { + krate.attrs = attrs; + krate.module = module; + }, + _ => unreachable!(), + }; + + krate + } + + // Fully expand all the invocations in `expansion`. + fn expand(&mut self, expansion: Expansion) -> Expansion { + let orig_expansion_data = self.cx.current_expansion.clone(); + self.cx.current_expansion.depth = 0; + + let (expansion, mut invocations) = self.collect_invocations(expansion); + self.resolve_imports(); + invocations.reverse(); + + let mut expansions = Vec::new(); + let mut undetermined_invocations = Vec::new(); + let (mut progress, mut force) = (false, !self.monotonic); + loop { + let invoc = if let Some(invoc) = invocations.pop() { + invoc + } else { + self.resolve_imports(); + if undetermined_invocations.is_empty() { break } + invocations = mem::replace(&mut undetermined_invocations, Vec::new()); + force = !mem::replace(&mut progress, false); + continue + }; + + let scope = + if self.monotonic { invoc.expansion_data.mark } else { orig_expansion_data.mark }; + let resolution = match invoc.kind { + InvocationKind::Bang { ref mac, .. } => { + self.cx.resolver.resolve_macro(scope, &mac.node.path, force) + } + InvocationKind::Attr { ref attr, .. } => { + let ident = Ident::with_empty_ctxt(attr.name()); + let path = ast::Path::from_ident(attr.span, ident); + self.cx.resolver.resolve_macro(scope, &path, force) + } + }; + let ext = match resolution { + Ok(ext) => Some(ext), + Err(Determinacy::Determined) => None, + Err(Determinacy::Undetermined) => { + undetermined_invocations.push(invoc); + continue + } + }; + + progress = true; + let ExpansionData { depth, mark, .. } = invoc.expansion_data; + self.cx.current_expansion = invoc.expansion_data.clone(); + + self.cx.current_expansion.mark = scope; + let expansion = match ext { + Some(ext) => self.expand_invoc(invoc, ext), + None => invoc.expansion_kind.dummy(invoc.span()), + }; + + let (expansion, new_invocations) = self.collect_invocations(expansion); + + if expansions.len() < depth { + expansions.push(Vec::new()); + } + expansions[depth - 1].push((mark, expansion)); + if !self.cx.ecfg.single_step { + invocations.extend(new_invocations.into_iter().rev()); + } + } + + self.cx.current_expansion = orig_expansion_data; + + let mut placeholder_expander = PlaceholderExpander::new(self.cx, self.monotonic); + while let Some(expansions) = expansions.pop() { + for (mark, expansion) in expansions.into_iter().rev() { + placeholder_expander.add(mark.as_placeholder_id(), expansion); + } + } + + expansion.fold_with(&mut placeholder_expander) + } + + fn resolve_imports(&mut self) { + if self.monotonic { + let err_count = self.cx.parse_sess.span_diagnostic.err_count(); + self.cx.resolver.resolve_imports(); + self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count; + } + } + + fn collect_invocations(&mut self, expansion: Expansion) -> (Expansion, Vec) { + let result = { + let mut collector = InvocationCollector { + cfg: StripUnconfigured { + should_test: self.cx.ecfg.should_test, + sess: self.cx.parse_sess, + features: self.cx.ecfg.features, + }, + cx: self.cx, + invocations: Vec::new(), + monotonic: self.monotonic, + }; + (expansion.fold_with(&mut collector), collector.invocations) + }; + + if self.monotonic { + let err_count = self.cx.parse_sess.span_diagnostic.err_count(); + let mark = self.cx.current_expansion.mark; + self.cx.resolver.visit_expansion(mark, &result.0); + self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count; + } + + result + } + + fn expand_invoc(&mut self, invoc: Invocation, ext: Rc) -> Expansion { + match invoc.kind { + InvocationKind::Bang { .. } => self.expand_bang_invoc(invoc, ext), + InvocationKind::Attr { .. } => self.expand_attr_invoc(invoc, ext), + } + } + + fn expand_attr_invoc(&mut self, invoc: Invocation, ext: Rc) -> Expansion { + let Invocation { expansion_kind: kind, .. } = invoc; + let (attr, item) = match invoc.kind { + InvocationKind::Attr { attr, item } => (attr, item), + _ => unreachable!(), + }; + + attr::mark_used(&attr); + let name = attr.name(); + self.cx.bt_push(ExpnInfo { + call_site: attr.span, + callee: NameAndSpan { + format: MacroAttribute(name), + span: Some(attr.span), + allow_internal_unstable: false, + } + }); + + match *ext { + MultiModifier(ref mac) => { + let items = mac.expand(self.cx, attr.span, &attr.value, item); + kind.expect_from_annotatables(items) + } + MultiDecorator(ref mac) => { + let mut items = Vec::new(); + mac.expand(self.cx, attr.span, &attr.value, &item, + &mut |item| items.push(item)); + items.push(item); + kind.expect_from_annotatables(items) + } + SyntaxExtension::AttrProcMacro(ref mac) => { + let attr_toks = TokenStream::from_tts(tts_for_attr(&attr, &self.cx.parse_sess)); + let item_toks = TokenStream::from_tts(tts_for_item(&item, &self.cx.parse_sess)); + + let tok_result = mac.expand(self.cx, attr.span, attr_toks, item_toks); + self.parse_expansion(tok_result, kind, name, attr.span) + } + SyntaxExtension::CustomDerive(_) => { + self.cx.span_err(attr.span, &format!("`{}` is a derive mode", name)); + kind.dummy(attr.span) + } + _ => { + let msg = &format!("macro `{}` may not be used in attributes", name); + self.cx.span_err(attr.span, &msg); + kind.dummy(attr.span) + } + } + } + + /// Expand a macro invocation. Returns the result of expansion. + fn expand_bang_invoc(&mut self, invoc: Invocation, ext: Rc) -> Expansion { + let (mark, kind) = (invoc.expansion_data.mark, invoc.expansion_kind); + let (mac, ident, span) = match invoc.kind { + InvocationKind::Bang { mac, ident, span } => (mac, ident, span), + _ => unreachable!(), + }; + let Mac_ { path, tts, .. } = mac.node; + + let extname = path.segments.last().unwrap().identifier.name; + let ident = ident.unwrap_or(keywords::Invalid.ident()); + let marked_tts = mark_tts(&tts, mark); + let opt_expanded = match *ext { + NormalTT(ref expandfun, exp_span, allow_internal_unstable) => { + if ident.name != keywords::Invalid.name() { + let msg = + format!("macro {}! expects no ident argument, given '{}'", extname, ident); + self.cx.span_err(path.span, &msg); + return kind.dummy(span); + } + + self.cx.bt_push(ExpnInfo { + call_site: span, + callee: NameAndSpan { + format: MacroBang(extname), + span: exp_span, + allow_internal_unstable: allow_internal_unstable, + }, + }); + + kind.make_from(expandfun.expand(self.cx, span, &marked_tts)) + } + + IdentTT(ref expander, tt_span, allow_internal_unstable) => { + if ident.name == keywords::Invalid.name() { + self.cx.span_err(path.span, + &format!("macro {}! expects an ident argument", extname)); + return kind.dummy(span); + }; + + self.cx.bt_push(ExpnInfo { + call_site: span, + callee: NameAndSpan { + format: MacroBang(extname), + span: tt_span, + allow_internal_unstable: allow_internal_unstable, + } + }); + + kind.make_from(expander.expand(self.cx, span, ident, marked_tts)) + } + + MultiDecorator(..) | MultiModifier(..) | SyntaxExtension::AttrProcMacro(..) => { + self.cx.span_err(path.span, + &format!("`{}` can only be used in attributes", extname)); + return kind.dummy(span); + } + + SyntaxExtension::CustomDerive(..) => { + self.cx.span_err(path.span, &format!("`{}` is a derive mode", extname)); + return kind.dummy(span); + } + + SyntaxExtension::ProcMacro(ref expandfun) => { + if ident.name != keywords::Invalid.name() { + let msg = + format!("macro {}! expects no ident argument, given '{}'", extname, ident); + self.cx.span_err(path.span, &msg); + return kind.dummy(span); + } + + self.cx.bt_push(ExpnInfo { + call_site: span, + callee: NameAndSpan { + format: MacroBang(extname), + // FIXME procedural macros do not have proper span info + // yet, when they do, we should use it here. + span: None, + // FIXME probably want to follow macro_rules macros here. + allow_internal_unstable: false, + }, + }); + + let toks = TokenStream::from_tts(marked_tts); + let tok_result = expandfun.expand(self.cx, span, toks); + Some(self.parse_expansion(tok_result, kind, extname, span)) + } + }; + + let expanded = if let Some(expanded) = opt_expanded { + expanded + } else { + let msg = format!("non-{kind} macro in {kind} position: {name}", + name = path.segments[0].identifier.name, kind = kind.name()); + self.cx.span_err(path.span, &msg); + return kind.dummy(span); + }; + + expanded.fold_with(&mut Marker { + mark: mark, + expn_id: Some(self.cx.backtrace()), + }) + } + + fn parse_expansion(&mut self, toks: TokenStream, kind: ExpansionKind, name: Name, span: Span) + -> Expansion { + let mut parser = self.cx.new_parser_from_tts(&toks.to_tts()); + let expansion = match parser.parse_expansion(kind, false) { + Ok(expansion) => expansion, + Err(mut err) => { + err.emit(); + return kind.dummy(span); + } + }; + parser.ensure_complete_parse(name, kind.name(), span); + // FIXME better span info + expansion.fold_with(&mut ChangeSpan { span: span }) + } +} + +impl<'a> Parser<'a> { + pub fn parse_expansion(&mut self, kind: ExpansionKind, macro_legacy_warnings: bool) + -> PResult<'a, Expansion> { + Ok(match kind { + ExpansionKind::Items => { + let mut items = SmallVector::new(); + while let Some(item) = try!(self.parse_item()) { + items.push(item); + } + Expansion::Items(items) + } + ExpansionKind::TraitItems => { + let mut items = SmallVector::new(); + while self.token != token::Eof { + items.push(try!(self.parse_trait_item())); + } + Expansion::TraitItems(items) + } + ExpansionKind::ImplItems => { + let mut items = SmallVector::new(); + while self.token != token::Eof { + items.push(try!(self.parse_impl_item())); + } + Expansion::ImplItems(items) + } + ExpansionKind::Stmts => { + let mut stmts = SmallVector::new(); + while self.token != token::Eof && + // won't make progress on a `}` + self.token != token::CloseDelim(token::Brace) { + if let Some(stmt) = try!(self.parse_full_stmt(macro_legacy_warnings)) { + stmts.push(stmt); + } + } + Expansion::Stmts(stmts) + } + ExpansionKind::Expr => Expansion::Expr(try!(self.parse_expr())), + ExpansionKind::OptExpr => Expansion::OptExpr(Some(try!(self.parse_expr()))), + ExpansionKind::Ty => Expansion::Ty(try!(self.parse_ty())), + ExpansionKind::Pat => Expansion::Pat(try!(self.parse_pat())), + }) + } + + pub fn ensure_complete_parse(&mut self, macro_name: ast::Name, kind_name: &str, span: Span) { + if self.token != token::Eof { + let msg = format!("macro expansion ignores token `{}` and any following", + self.this_token_to_string()); + let mut err = self.diagnostic().struct_span_err(self.span, &msg); + let msg = format!("caused by the macro expansion here; the usage \ + of `{}!` is likely invalid in {} context", + macro_name, kind_name); + err.span_note(span, &msg).emit(); + } + } +} + +struct InvocationCollector<'a, 'b: 'a> { + cx: &'a mut ExtCtxt<'b>, + cfg: StripUnconfigured<'a>, + invocations: Vec, + monotonic: bool, +} + +macro_rules! fully_configure { + ($this:ident, $node:ident, $noop_fold:ident) => { + match $noop_fold($node, &mut $this.cfg).pop() { + Some(node) => node, + None => return SmallVector::new(), + } + } +} + +impl<'a, 'b> InvocationCollector<'a, 'b> { + fn collect(&mut self, expansion_kind: ExpansionKind, kind: InvocationKind) -> Expansion { + let mark = Mark::fresh(); + self.invocations.push(Invocation { + kind: kind, + expansion_kind: expansion_kind, + expansion_data: ExpansionData { + mark: mark, + depth: self.cx.current_expansion.depth + 1, + ..self.cx.current_expansion.clone() + }, + }); + placeholder(expansion_kind, mark.as_placeholder_id()) + } + + fn collect_bang(&mut self, mac: ast::Mac, span: Span, kind: ExpansionKind) -> Expansion { + self.collect(kind, InvocationKind::Bang { mac: mac, ident: None, span: span }) + } + + fn collect_attr(&mut self, attr: ast::Attribute, item: Annotatable, kind: ExpansionKind) + -> Expansion { + self.collect(kind, InvocationKind::Attr { attr: attr, item: item }) + } + + // If `item` is an attr invocation, remove and return the macro attribute. + fn classify_item(&mut self, mut item: T) -> (T, Option) { + let mut attr = None; + item = item.map_attrs(|mut attrs| { + attr = self.cx.resolver.find_attr_invoc(&mut attrs); + attrs + }); + (item, attr) + } + + fn configure(&mut self, node: T) -> Option { + self.cfg.configure(node) + } + + // Detect use of feature-gated or invalid attributes on macro invocations + // since they will not be detected after macro expansion. + fn check_attributes(&mut self, attrs: &[ast::Attribute]) { + let codemap = &self.cx.parse_sess.codemap(); + let features = self.cx.ecfg.features.unwrap(); + for attr in attrs.iter() { + feature_gate::check_attribute(&attr, &self.cx.parse_sess, codemap, features); + } + } +} + +// These are pretty nasty. Ideally, we would keep the tokens around, linked from +// the AST. However, we don't so we need to create new ones. Since the item might +// have come from a macro expansion (possibly only in part), we can't use the +// existing codemap. +// +// Therefore, we must use the pretty printer (yuck) to turn the AST node into a +// string, which we then re-tokenise (double yuck), but first we have to patch +// the pretty-printed string on to the end of the existing codemap (infinity-yuck). +fn tts_for_item(item: &Annotatable, parse_sess: &ParseSess) -> Vec { + let text = match *item { + Annotatable::Item(ref i) => pprust::item_to_string(i), + Annotatable::TraitItem(ref ti) => pprust::trait_item_to_string(ti), + Annotatable::ImplItem(ref ii) => pprust::impl_item_to_string(ii), + }; + string_to_tts(text, parse_sess) +} + +fn tts_for_attr(attr: &ast::Attribute, parse_sess: &ParseSess) -> Vec { + string_to_tts(pprust::attr_to_string(attr), parse_sess) +} + +fn string_to_tts(text: String, parse_sess: &ParseSess) -> Vec { + let filemap = parse_sess.codemap() + .new_filemap(String::from(""), None, text); + + let lexer = lexer::StringReader::new(&parse_sess.span_diagnostic, filemap); + let mut parser = Parser::new(parse_sess, Box::new(lexer), None, false); + panictry!(parser.parse_all_token_trees()) +} + +impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { + fn fold_expr(&mut self, expr: P) -> P { + let mut expr = self.cfg.configure_expr(expr).unwrap(); + expr.node = self.cfg.configure_expr_kind(expr.node); + + if let ast::ExprKind::Mac(mac) = expr.node { + // FIXME(syntex): ignore unknown macros + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.node.path, false).is_err() { + return P(ast::Expr { node: ast::ExprKind::Mac(mac), .. expr }); + } + + self.check_attributes(&expr.attrs); + self.collect_bang(mac, expr.span, ExpansionKind::Expr).make_expr() + } else { + P(noop_fold_expr(expr, self)) + } + } + + fn fold_opt_expr(&mut self, expr: P) -> Option> { + let mut expr = configure!(self, expr).unwrap(); + expr.node = self.cfg.configure_expr_kind(expr.node); + + if let ast::ExprKind::Mac(mac) = expr.node { + // FIXME(syntex): ignore unknown macros + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.node.path, false).is_err() { + return Some(P(ast::Expr { node: ast::ExprKind::Mac(mac), .. expr })); + } + + self.check_attributes(&expr.attrs); + self.collect_bang(mac, expr.span, ExpansionKind::OptExpr).make_opt_expr() + } else { + Some(P(noop_fold_expr(expr, self))) + } + } + + fn fold_pat(&mut self, pat: P) -> P { + match pat.node { + PatKind::Mac(_) => {} + _ => return noop_fold_pat(pat, self), + } + + pat.and_then(|pat| match pat.node { + PatKind::Mac(mac) => { + // FIXME(syntex): ignore unknown macros + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.node.path, false).is_err() { + return P(ast::Pat { node: PatKind::Mac(mac), .. pat }); + } + + self.collect_bang(mac, pat.span, ExpansionKind::Pat).make_pat() + } + _ => unreachable!(), + }) + } + + fn fold_stmt(&mut self, stmt: ast::Stmt) -> SmallVector { + let stmt = match self.cfg.configure_stmt(stmt) { + Some(stmt) => stmt, + None => return SmallVector::new(), + }; + + let (mac, style, attrs) = if let StmtKind::Mac(mac) = stmt.node { + // FIXME(syntex): ignore unknown macros. + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.0.node.path, false).is_err() { + let stmt = ast::Stmt { node: StmtKind::Mac(mac), .. stmt }; + return SmallVector::one(stmt); + } + + mac.unwrap() + } else { + // The placeholder expander gives ids to statements, so we avoid folding the id here. + let ast::Stmt { id, node, span } = stmt; + return noop_fold_stmt_kind(node, self).into_iter().map(|node| { + ast::Stmt { id: id, node: node, span: span } + }).collect() + }; + + self.check_attributes(&attrs); + let mut placeholder = self.collect_bang(mac, stmt.span, ExpansionKind::Stmts).make_stmts(); + + // If this is a macro invocation with a semicolon, then apply that + // semicolon to the final statement produced by expansion. + if style == MacStmtStyle::Semicolon { + if let Some(stmt) = placeholder.pop() { + placeholder.push(stmt.add_trailing_semicolon()); + } + } + + placeholder + } + + fn fold_block(&mut self, block: P) -> P { + let old_directory_ownership = self.cx.current_expansion.directory_ownership; + self.cx.current_expansion.directory_ownership = DirectoryOwnership::UnownedViaBlock; + let result = noop_fold_block(block, self); + self.cx.current_expansion.directory_ownership = old_directory_ownership; + result + } + + fn fold_item(&mut self, item: P) -> SmallVector> { + let item = configure!(self, item); + + let (mut item, attr) = self.classify_item(item); + if let Some(attr) = attr { + let item = Annotatable::Item(fully_configure!(self, item, noop_fold_item)); + return self.collect_attr(attr, item, ExpansionKind::Items).make_items(); + } + + match item.node { + ast::ItemKind::Mac(..) => { + self.check_attributes(&item.attrs); + let is_macro_def = if let ItemKind::Mac(ref mac) = item.node { + mac.node.path.segments[0].identifier.name == "macro_rules" + } else { + unreachable!() + }; + + item.and_then(|mut item| match item.node { + ItemKind::Mac(_) if is_macro_def => { + item.id = Mark::fresh().as_placeholder_id(); + SmallVector::one(P(item)) + } + ItemKind::Mac(mac) => { + // FIXME(syntex): ignore unknown macros + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.node.path, false).is_err() { + let item = ast::Item { node: ItemKind::Mac(mac), .. item }; + return SmallVector::one(P(item)); + } + + self.collect(ExpansionKind::Items, InvocationKind::Bang { + mac: mac, + ident: Some(item.ident), + span: item.span, + }).make_items() + } + _ => unreachable!(), + }) + } + ast::ItemKind::Mod(ast::Mod { inner, .. }) => { + if item.ident == keywords::Invalid.ident() { + return noop_fold_item(item, self); + } + + let orig_directory_ownership = self.cx.current_expansion.directory_ownership; + let mut module = (*self.cx.current_expansion.module).clone(); + module.mod_path.push(item.ident); + + // Detect if this is an inline module (`mod m { ... }` as opposed to `mod m;`). + // In the non-inline case, `inner` is never the dummy span (c.f. `parse_item_mod`). + // Thus, if `inner` is the dummy span, we know the module is inline. + let inline_module = item.span.contains(inner) || inner == syntax_pos::DUMMY_SP; + + if inline_module { + if let Some(path) = attr::first_attr_value_str_by_name(&item.attrs, "path") { + self.cx.current_expansion.directory_ownership = DirectoryOwnership::Owned; + module.directory.push(&*path.as_str()); + } else { + module.directory.push(&*item.ident.name.as_str()); + } + } else { + let mut path = + PathBuf::from(self.cx.parse_sess.codemap().span_to_filename(inner)); + let directory_ownership = match path.file_name().unwrap().to_str() { + Some("mod.rs") => DirectoryOwnership::Owned, + _ => DirectoryOwnership::UnownedViaMod(false), + }; + path.pop(); + module.directory = path; + self.cx.current_expansion.directory_ownership = directory_ownership; + } + + let orig_module = + mem::replace(&mut self.cx.current_expansion.module, Rc::new(module)); + let result = noop_fold_item(item, self); + self.cx.current_expansion.module = orig_module; + self.cx.current_expansion.directory_ownership = orig_directory_ownership; + return result; + } + // Ensure that test functions are accessible from the test harness. + ast::ItemKind::Fn(..) if self.cx.ecfg.should_test => { + if item.attrs.iter().any(|attr| is_test_or_bench(attr)) { + item = item.map(|mut item| { item.vis = ast::Visibility::Public; item }); + } + noop_fold_item(item, self) + } + _ => noop_fold_item(item, self), + } + } + + fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector { + let item = configure!(self, item); + + let (item, attr) = self.classify_item(item); + if let Some(attr) = attr { + let item = + Annotatable::TraitItem(P(fully_configure!(self, item, noop_fold_trait_item))); + return self.collect_attr(attr, item, ExpansionKind::TraitItems).make_trait_items() + } + + match item.node { + ast::TraitItemKind::Macro(mac) => { + // FIXME(syntex): ignore unknown macros + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.node.path, false).is_err() { + let item = ast::TraitItem { node: ast::TraitItemKind::Macro(mac), .. item }; + return SmallVector::one(item); + } + + let ast::TraitItem { attrs, span, .. } = item; + self.check_attributes(&attrs); + self.collect_bang(mac, span, ExpansionKind::TraitItems).make_trait_items() + } + _ => fold::noop_fold_trait_item(item, self), + } + } + + fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector { + let item = configure!(self, item); + + let (item, attr) = self.classify_item(item); + if let Some(attr) = attr { + let item = Annotatable::ImplItem(P(fully_configure!(self, item, noop_fold_impl_item))); + return self.collect_attr(attr, item, ExpansionKind::ImplItems).make_impl_items(); + } + + match item.node { + ast::ImplItemKind::Macro(mac) => { + // FIXME(syntex): ignore unknown macros + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.node.path, false).is_err() { + let item = ast::ImplItem { node: ast::ImplItemKind::Macro(mac), .. item }; + return SmallVector::one(item); + } + + let ast::ImplItem { attrs, span, .. } = item; + self.check_attributes(&attrs); + self.collect_bang(mac, span, ExpansionKind::ImplItems).make_impl_items() + } + _ => fold::noop_fold_impl_item(item, self), + } + } + + fn fold_ty(&mut self, ty: P) -> P { + let ty = match ty.node { + ast::TyKind::Mac(_) => ty.unwrap(), + _ => return fold::noop_fold_ty(ty, self), + }; + + match ty.node { + ast::TyKind::Mac(mac) => { + // FIXME(syntex): ignore unknown macros + if self.cx.resolver.resolve_macro(self.cx.current_expansion.mark, &mac.node.path, false).is_err() { + return P(ast::Ty { node: ast::TyKind::Mac(mac), .. ty }); + } + + self.collect_bang(mac, ty.span, ExpansionKind::Ty).make_ty() + } + _ => unreachable!(), + } + } + + fn fold_foreign_mod(&mut self, foreign_mod: ast::ForeignMod) -> ast::ForeignMod { + noop_fold_foreign_mod(self.cfg.configure_foreign_mod(foreign_mod), self) + } + + fn fold_item_kind(&mut self, item: ast::ItemKind) -> ast::ItemKind { + noop_fold_item_kind(self.cfg.configure_item_kind(item), self) + } + + fn new_id(&mut self, id: ast::NodeId) -> ast::NodeId { + if self.monotonic { + assert_eq!(id, ast::DUMMY_NODE_ID); + self.cx.resolver.next_node_id() + } else { + id + } + } +} + +pub struct ExpansionConfig<'feat> { + pub crate_name: String, + pub features: Option<&'feat Features>, + pub recursion_limit: usize, + pub trace_mac: bool, + pub should_test: bool, // If false, strip `#[test]` nodes + pub single_step: bool, + pub keep_macs: bool, +} + +macro_rules! feature_tests { + ($( fn $getter:ident = $field:ident, )*) => { + $( + pub fn $getter(&self) -> bool { + match self.features { + Some(&Features { $field: true, .. }) => true, + _ => false, + } + } + )* + } +} + +impl<'feat> ExpansionConfig<'feat> { + pub fn default(crate_name: String) -> ExpansionConfig<'static> { + ExpansionConfig { + crate_name: crate_name, + features: None, + recursion_limit: 64, + trace_mac: false, + should_test: false, + single_step: false, + keep_macs: false, + } + } + + feature_tests! { + fn enable_quotes = quote, + fn enable_asm = asm, + fn enable_log_syntax = log_syntax, + fn enable_concat_idents = concat_idents, + fn enable_trace_macros = trace_macros, + fn enable_allow_internal_unstable = allow_internal_unstable, + fn enable_custom_derive = custom_derive, + fn enable_pushpop_unsafe = pushpop_unsafe, + } +} + +// A Marker adds the given mark to the syntax context and +// sets spans' `expn_id` to the given expn_id (unless it is `None`). +struct Marker { mark: Mark, expn_id: Option } + +impl Folder for Marker { + fn fold_ident(&mut self, mut ident: Ident) -> Ident { + ident.ctxt = ident.ctxt.apply_mark(self.mark); + ident + } + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { + noop_fold_mac(mac, self) + } + + fn new_span(&mut self, mut span: Span) -> Span { + if let Some(expn_id) = self.expn_id { + span.expn_id = expn_id; + } + span + } +} + +// apply a given mark to the given token trees. Used prior to expansion of a macro. +pub fn mark_tts(tts: &[TokenTree], m: Mark) -> Vec { + noop_fold_tts(tts, &mut Marker{mark:m, expn_id: None}) +} diff --git a/third_party/rust/syntex_syntax/src/ext/hygiene.rs b/third_party/rust/syntex_syntax/src/ext/hygiene.rs new file mode 100644 index 000000000000..468479e63837 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/hygiene.rs @@ -0,0 +1,134 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Machinery for hygienic macros, inspired by the MTWT[1] paper. +//! +//! [1] Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. +//! 2012. *Macros that work together: Compile-time bindings, partial expansion, +//! and definition contexts*. J. Funct. Program. 22, 2 (March 2012), 181-216. +//! DOI=10.1017/S0956796812000093 http://dx.doi.org/10.1017/S0956796812000093 + +use ast::NodeId; +use std::cell::RefCell; +use std::collections::HashMap; +use std::fmt; + +/// A SyntaxContext represents a chain of macro expansions (represented by marks). +#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Default)] +pub struct SyntaxContext(pub u32); + +#[derive(Copy, Clone)] +pub struct SyntaxContextData { + pub outer_mark: Mark, + pub prev_ctxt: SyntaxContext, +} + +/// A mark is a unique id associated with a macro expansion. +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Default)] +pub struct Mark(u32); + +impl Mark { + pub fn fresh() -> Self { + HygieneData::with(|data| { + let next_mark = Mark(data.next_mark.0 + 1); + ::std::mem::replace(&mut data.next_mark, next_mark) + }) + } + + /// The mark of the theoretical expansion that generates freshly parsed, unexpanded AST. + pub fn root() -> Self { + Mark(0) + } + + pub fn from_placeholder_id(id: NodeId) -> Self { + Mark(id.as_u32()) + } + + pub fn as_placeholder_id(self) -> NodeId { + NodeId::from_u32(self.0) + } + + pub fn as_u32(self) -> u32 { + self.0 + } +} + +struct HygieneData { + syntax_contexts: Vec, + markings: HashMap<(SyntaxContext, Mark), SyntaxContext>, + next_mark: Mark, +} + +impl HygieneData { + fn new() -> Self { + HygieneData { + syntax_contexts: vec![SyntaxContextData { + outer_mark: Mark::root(), + prev_ctxt: SyntaxContext::empty(), + }], + markings: HashMap::new(), + next_mark: Mark(1), + } + } + + fn with T>(f: F) -> T { + thread_local! { + static HYGIENE_DATA: RefCell = RefCell::new(HygieneData::new()) + } + HYGIENE_DATA.with(|data| f(&mut *data.borrow_mut())) + } +} + +pub fn reset_hygiene_data() { + HygieneData::with(|data| *data = HygieneData::new()) +} + +impl SyntaxContext { + pub fn empty() -> Self { + SyntaxContext(0) + } + + pub fn data(self) -> SyntaxContextData { + HygieneData::with(|data| data.syntax_contexts[self.0 as usize]) + } + + /// Extend a syntax context with a given mark + pub fn apply_mark(self, mark: Mark) -> SyntaxContext { + // Applying the same mark twice is a no-op + let ctxt_data = self.data(); + if mark == ctxt_data.outer_mark { + return ctxt_data.prev_ctxt; + } + + HygieneData::with(|data| { + let syntax_contexts = &mut data.syntax_contexts; + *data.markings.entry((self, mark)).or_insert_with(|| { + syntax_contexts.push(SyntaxContextData { + outer_mark: mark, + prev_ctxt: self, + }); + SyntaxContext(syntax_contexts.len() as u32 - 1) + }) + }) + } + + /// If `ident` is macro expanded, return the source ident from the macro definition + /// and the mark of the expansion that created the macro definition. + pub fn source(self) -> (Self /* source context */, Mark /* source macro */) { + let macro_def_ctxt = self.data().prev_ctxt.data(); + (macro_def_ctxt.prev_ctxt, macro_def_ctxt.outer_mark) + } +} + +impl fmt::Debug for SyntaxContext { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "#{}", self.0) + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/placeholders.rs b/third_party/rust/syntex_syntax/src/ext/placeholders.rs new file mode 100644 index 000000000000..e832285c8bcc --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/placeholders.rs @@ -0,0 +1,236 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ast; +use codemap::{DUMMY_SP, dummy_spanned}; +use ext::base::ExtCtxt; +use ext::expand::{Expansion, ExpansionKind}; +use ext::hygiene::Mark; +use fold::*; +use ptr::P; +use symbol::keywords; +use util::move_map::MoveMap; +use util::small_vector::SmallVector; + +use std::collections::HashMap; +use std::mem; + +pub fn placeholder(kind: ExpansionKind, id: ast::NodeId) -> Expansion { + fn mac_placeholder() -> ast::Mac { + dummy_spanned(ast::Mac_ { + path: ast::Path { span: DUMMY_SP, segments: Vec::new() }, + tts: Vec::new(), + }) + } + + let ident = keywords::Invalid.ident(); + let attrs = Vec::new(); + let vis = ast::Visibility::Inherited; + let span = DUMMY_SP; + let expr_placeholder = || P(ast::Expr { + id: id, span: span, + attrs: ast::ThinVec::new(), + node: ast::ExprKind::Mac(mac_placeholder()), + }); + + match kind { + ExpansionKind::Expr => Expansion::Expr(expr_placeholder()), + ExpansionKind::OptExpr => Expansion::OptExpr(Some(expr_placeholder())), + ExpansionKind::Items => Expansion::Items(SmallVector::one(P(ast::Item { + id: id, span: span, ident: ident, vis: vis, attrs: attrs, + node: ast::ItemKind::Mac(mac_placeholder()), + }))), + ExpansionKind::TraitItems => Expansion::TraitItems(SmallVector::one(ast::TraitItem { + id: id, span: span, ident: ident, attrs: attrs, + node: ast::TraitItemKind::Macro(mac_placeholder()), + })), + ExpansionKind::ImplItems => Expansion::ImplItems(SmallVector::one(ast::ImplItem { + id: id, span: span, ident: ident, vis: vis, attrs: attrs, + node: ast::ImplItemKind::Macro(mac_placeholder()), + defaultness: ast::Defaultness::Final, + })), + ExpansionKind::Pat => Expansion::Pat(P(ast::Pat { + id: id, span: span, node: ast::PatKind::Mac(mac_placeholder()), + })), + ExpansionKind::Ty => Expansion::Ty(P(ast::Ty { + id: id, span: span, node: ast::TyKind::Mac(mac_placeholder()), + })), + ExpansionKind::Stmts => Expansion::Stmts(SmallVector::one({ + let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ast::ThinVec::new())); + ast::Stmt { id: id, span: span, node: ast::StmtKind::Mac(mac) } + })), + } +} + +pub struct PlaceholderExpander<'a, 'b: 'a> { + expansions: HashMap, + cx: &'a mut ExtCtxt<'b>, + monotonic: bool, +} + +impl<'a, 'b> PlaceholderExpander<'a, 'b> { + pub fn new(cx: &'a mut ExtCtxt<'b>, monotonic: bool) -> Self { + PlaceholderExpander { + cx: cx, + expansions: HashMap::new(), + monotonic: monotonic, + } + } + + pub fn add(&mut self, id: ast::NodeId, expansion: Expansion) { + let expansion = expansion.fold_with(self); + self.expansions.insert(id, expansion); + } + + fn remove(&mut self, id: ast::NodeId) -> Expansion { + self.expansions.remove(&id).unwrap() + } +} + +impl<'a, 'b> Folder for PlaceholderExpander<'a, 'b> { + fn fold_item(&mut self, item: P) -> SmallVector> { + match item.node { + ast::ItemKind::Mac(ref mac) if !mac.node.path.segments.is_empty() => {} + // FIXME(syntex): ignore unknown macros + ast::ItemKind::Mac(_) if self.expansions.contains_key(&item.id) => return self.remove(item.id).make_items(), + _ => {} + } + + noop_fold_item(item, self) + } + + fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector { + match item.node { + // FIXME(syntex): ignore unknown macros + ast::TraitItemKind::Macro(_) if self.expansions.contains_key(&item.id) => self.remove(item.id).make_trait_items(), + _ => noop_fold_trait_item(item, self), + } + } + + fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector { + match item.node { + // FIXME(syntex): ignore unknown macros + ast::ImplItemKind::Macro(_) if self.expansions.contains_key(&item.id) => self.remove(item.id).make_impl_items(), + _ => noop_fold_impl_item(item, self), + } + } + + fn fold_expr(&mut self, expr: P) -> P { + match expr.node { + // FIXME(syntex): ignore unknown macros + ast::ExprKind::Mac(_) if self.expansions.contains_key(&expr.id) => self.remove(expr.id).make_expr(), + _ => expr.map(|expr| noop_fold_expr(expr, self)), + } + } + + fn fold_opt_expr(&mut self, expr: P) -> Option> { + match expr.node { + // FIXME(syntex): ignore unknown macros + ast::ExprKind::Mac(_) if self.expansions.contains_key(&expr.id) => self.remove(expr.id).make_opt_expr(), + _ => noop_fold_opt_expr(expr, self), + } + } + + fn fold_stmt(&mut self, mut stmt: ast::Stmt) -> SmallVector { + let (style, mut expansion) = match stmt.node { + // FIXME(syntex): ignore unknown macros + ast::StmtKind::Mac(mac) => { + if self.expansions.contains_key(&stmt.id) { + (mac.1, self.remove(stmt.id).make_stmts()) + } else { + stmt.node = ast::StmtKind::Mac(mac); + return noop_fold_stmt(stmt, self); + } + } + _ => return noop_fold_stmt(stmt, self), + }; + + if style == ast::MacStmtStyle::Semicolon { + if let Some(stmt) = expansion.pop() { + expansion.push(stmt.add_trailing_semicolon()); + } + } + + expansion + } + + fn fold_pat(&mut self, pat: P) -> P { + match pat.node { + // FIXME(syntex): ignore unknown macros + ast::PatKind::Mac(_) if self.expansions.contains_key(&pat.id) => self.remove(pat.id).make_pat(), + _ => noop_fold_pat(pat, self), + } + } + + fn fold_ty(&mut self, ty: P) -> P { + match ty.node { + // FIXME(syntex): ignore unknown macros + ast::TyKind::Mac(_) if self.expansions.contains_key(&ty.id) => self.remove(ty.id).make_ty(), + _ => noop_fold_ty(ty, self), + } + } + + fn fold_block(&mut self, block: P) -> P { + noop_fold_block(block, self).map(|mut block| { + let mut macros = Vec::new(); + let mut remaining_stmts = block.stmts.len(); + + block.stmts = block.stmts.move_flat_map(|mut stmt| { + remaining_stmts -= 1; + + // `macro_rules!` macro definition + if let ast::StmtKind::Item(ref item) = stmt.node { + if let ast::ItemKind::Mac(_) = item.node { + macros.push(Mark::from_placeholder_id(item.id)); + return None; + } + } + + match stmt.node { + // Avoid wasting a node id on a trailing expression statement, + // which shares a HIR node with the expression itself. + ast::StmtKind::Expr(ref expr) if remaining_stmts == 0 => stmt.id = expr.id, + + _ if self.monotonic => { + assert_eq!(stmt.id, ast::DUMMY_NODE_ID); + stmt.id = self.cx.resolver.next_node_id(); + } + + _ => {} + } + + if self.monotonic && !macros.is_empty() { + let macros = mem::replace(&mut macros, Vec::new()); + self.cx.resolver.add_expansions_at_stmt(stmt.id, macros); + } + + Some(stmt) + }); + + block + }) + } + + fn fold_mod(&mut self, module: ast::Mod) -> ast::Mod { + let mut module = noop_fold_mod(module, self); + module.items = module.items.move_flat_map(|item| match item.node { + ast::ItemKind::Mac(_) if !self.cx.ecfg.keep_macs => None, // remove macro definitions + // FIXME(syntex): ignore unknown macros + ast::ItemKind::Mac(_) if self.expansions.contains_key(&item.id) => None, + _ => Some(item), + }); + module + } + + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { + // FIXME(syntex): ignore unknown macros + noop_fold_mac(mac, self) + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/proc_macro_shim.rs b/third_party/rust/syntex_syntax/src/ext/proc_macro_shim.rs new file mode 100644 index 000000000000..21ce89a6dd5b --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/proc_macro_shim.rs @@ -0,0 +1,72 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! This is a shim file to ease the transition to the final procedural macro interface for +//! Macros 2.0. It currently exposes the `libsyntax` operations that the quasiquoter's +//! output needs to compile correctly, along with the following operators: +//! +//! - `build_block_emitter`, which produces a `block` output macro result from the +//! provided TokenStream. + +use ast; +use codemap::Span; +use parse::parser::Parser; +use ptr::P; +use tokenstream::TokenStream; +use ext::base::*; + +/// Take a `ExtCtxt`, `Span`, and `TokenStream`, and produce a Macro Result that parses +/// the TokenStream as a block and returns it as an `Expr`. +pub fn build_block_emitter<'cx>(cx: &'cx mut ExtCtxt, + sp: Span, + output: TokenStream) + -> Box { + let parser = cx.new_parser_from_tts(&output.to_tts()); + + struct Result<'a> { + prsr: Parser<'a>, + span: Span, + }; //FIXME is this the right lifetime + + impl<'a> Result<'a> { + fn block(&mut self) -> P { + let res = self.prsr.parse_block().unwrap(); + res + } + } + + impl<'a> MacResult for Result<'a> { + fn make_expr(self: Box) -> Option> { + let mut me = *self; + Some(P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Block(me.block()), + span: me.span, + attrs: ast::ThinVec::new(), + })) + + } + } + + Box::new(Result { + prsr: parser, + span: sp, + }) +} + +pub mod prelude { + pub use super::build_block_emitter; + pub use ast::Ident; + pub use codemap::{DUMMY_SP, Span}; + pub use ext::base::{ExtCtxt, MacResult}; + pub use parse::token::{self, Token, DelimToken}; + pub use symbol::keywords; + pub use tokenstream::{TokenTree, TokenStream}; +} diff --git a/third_party/rust/syntex_syntax/src/ext/quote.rs b/third_party/rust/syntex_syntax/src/ext/quote.rs new file mode 100644 index 000000000000..de64163e0959 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/quote.rs @@ -0,0 +1,950 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Stmt, Ty}; +use syntax_pos::Span; +use ext::base::ExtCtxt; +use ext::base; +use ext::build::AstBuilder; +use parse::parser::{Parser, PathStyle}; +use parse::token::*; +use parse::token; +use ptr::P; +use tokenstream::{self, TokenTree}; + + +/// Quasiquoting works via token trees. +/// +/// This is registered as a set of expression syntax extension called quote! +/// that lifts its argument token-tree to an AST representing the +/// construction of the same token tree, with token::SubstNt interpreted +/// as antiquotes (splices). + +pub mod rt { + use ast; + use codemap::Spanned; + use ext::base::ExtCtxt; + use parse::{self, token, classify}; + use ptr::P; + use std::rc::Rc; + use symbol::Symbol; + + use tokenstream::{self, TokenTree}; + + pub use parse::new_parser_from_tts; + pub use syntax_pos::{BytePos, Span, DUMMY_SP}; + pub use codemap::{dummy_spanned}; + + pub trait ToTokens { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec; + } + + impl ToTokens for TokenTree { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + vec![self.clone()] + } + } + + impl ToTokens for Vec { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + self.iter().flat_map(|t| t.to_tokens(cx)).collect() + } + } + + impl ToTokens for Spanned { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + // FIXME: use the span? + self.node.to_tokens(cx) + } + } + + impl ToTokens for Option { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + match *self { + Some(ref t) => t.to_tokens(cx), + None => Vec::new(), + } + } + } + + impl ToTokens for ast::Ident { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + vec![TokenTree::Token(DUMMY_SP, token::Ident(*self))] + } + } + + impl ToTokens for ast::Path { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtPath(self.clone()); + vec![TokenTree::Token(DUMMY_SP, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::Ty { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtTy(P(self.clone())); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::Block { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtBlock(P(self.clone())); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::Generics { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtGenerics(self.clone()); + vec![TokenTree::Token(DUMMY_SP, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::WhereClause { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtWhereClause(self.clone()); + vec![TokenTree::Token(DUMMY_SP, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for P { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtItem(self.clone()); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::ImplItem { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtImplItem(self.clone()); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for P { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtImplItem((**self).clone()); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::TraitItem { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtTraitItem(self.clone()); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::Stmt { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtStmt(self.clone()); + let mut tts = vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))]; + + // Some statements require a trailing semicolon. + if classify::stmt_ends_with_semi(&self.node) { + tts.push(TokenTree::Token(self.span, token::Semi)); + } + + tts + } + } + + impl ToTokens for P { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtExpr(self.clone()); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for P { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtPat(self.clone()); + vec![TokenTree::Token(self.span, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::Arm { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtArm(self.clone()); + vec![TokenTree::Token(DUMMY_SP, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::Arg { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtArg(self.clone()); + vec![TokenTree::Token(DUMMY_SP, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for P { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtBlock(self.clone()); + vec![TokenTree::Token(DUMMY_SP, token::Interpolated(Rc::new(nt)))] + } + } + + macro_rules! impl_to_tokens_slice { + ($t: ty, $sep: expr) => { + impl ToTokens for [$t] { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + let mut v = vec![]; + for (i, x) in self.iter().enumerate() { + if i > 0 { + v.extend_from_slice(&$sep); + } + v.extend(x.to_tokens(cx)); + } + v + } + } + }; + } + + impl_to_tokens_slice! { ast::Ty, [TokenTree::Token(DUMMY_SP, token::Comma)] } + impl_to_tokens_slice! { P, [] } + impl_to_tokens_slice! { ast::Arg, [TokenTree::Token(DUMMY_SP, token::Comma)] } + + impl ToTokens for ast::MetaItem { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + let nt = token::NtMeta(self.clone()); + vec![TokenTree::Token(DUMMY_SP, token::Interpolated(Rc::new(nt)))] + } + } + + impl ToTokens for ast::Attribute { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + let mut r = vec![]; + // FIXME: The spans could be better + r.push(TokenTree::Token(self.span, token::Pound)); + if self.style == ast::AttrStyle::Inner { + r.push(TokenTree::Token(self.span, token::Not)); + } + r.push(TokenTree::Delimited(self.span, Rc::new(tokenstream::Delimited { + delim: token::Bracket, + open_span: self.span, + tts: self.value.to_tokens(cx), + close_span: self.span, + }))); + r + } + } + + impl ToTokens for str { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + let lit = ast::LitKind::Str(Symbol::intern(self), ast::StrStyle::Cooked); + dummy_spanned(lit).to_tokens(cx) + } + } + + impl ToTokens for () { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + vec![TokenTree::Delimited(DUMMY_SP, Rc::new(tokenstream::Delimited { + delim: token::Paren, + open_span: DUMMY_SP, + tts: vec![], + close_span: DUMMY_SP, + }))] + } + } + + impl ToTokens for ast::Lit { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + // FIXME: This is wrong + P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Lit(P(self.clone())), + span: DUMMY_SP, + attrs: ast::ThinVec::new(), + }).to_tokens(cx) + } + } + + impl ToTokens for bool { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + dummy_spanned(ast::LitKind::Bool(*self)).to_tokens(cx) + } + } + + impl ToTokens for char { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + dummy_spanned(ast::LitKind::Char(*self)).to_tokens(cx) + } + } + + macro_rules! impl_to_tokens_int { + (signed, $t:ty, $tag:expr) => ( + impl ToTokens for $t { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + let val = if *self < 0 { + -self + } else { + *self + }; + let lit = ast::LitKind::Int(val as u64, ast::LitIntType::Signed($tag)); + let lit = P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Lit(P(dummy_spanned(lit))), + span: DUMMY_SP, + attrs: ast::ThinVec::new(), + }); + if *self >= 0 { + return lit.to_tokens(cx); + } + P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Unary(ast::UnOp::Neg, lit), + span: DUMMY_SP, + attrs: ast::ThinVec::new(), + }).to_tokens(cx) + } + } + ); + (unsigned, $t:ty, $tag:expr) => ( + impl ToTokens for $t { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + let lit = ast::LitKind::Int(*self as u64, ast::LitIntType::Unsigned($tag)); + dummy_spanned(lit).to_tokens(cx) + } + } + ); + } + + impl_to_tokens_int! { signed, isize, ast::IntTy::Is } + impl_to_tokens_int! { signed, i8, ast::IntTy::I8 } + impl_to_tokens_int! { signed, i16, ast::IntTy::I16 } + impl_to_tokens_int! { signed, i32, ast::IntTy::I32 } + impl_to_tokens_int! { signed, i64, ast::IntTy::I64 } + + impl_to_tokens_int! { unsigned, usize, ast::UintTy::Us } + impl_to_tokens_int! { unsigned, u8, ast::UintTy::U8 } + impl_to_tokens_int! { unsigned, u16, ast::UintTy::U16 } + impl_to_tokens_int! { unsigned, u32, ast::UintTy::U32 } + impl_to_tokens_int! { unsigned, u64, ast::UintTy::U64 } + + pub trait ExtParseUtils { + fn parse_item(&self, s: String) -> P; + fn parse_expr(&self, s: String) -> P; + fn parse_stmt(&self, s: String) -> ast::Stmt; + fn parse_tts(&self, s: String) -> Vec; + } + + impl<'a> ExtParseUtils for ExtCtxt<'a> { + fn parse_item(&self, s: String) -> P { + panictry!(parse::parse_item_from_source_str( + "".to_string(), + s, + self.parse_sess())).expect("parse error") + } + + fn parse_stmt(&self, s: String) -> ast::Stmt { + panictry!(parse::parse_stmt_from_source_str( + "".to_string(), + s, + self.parse_sess())).expect("parse error") + } + + fn parse_expr(&self, s: String) -> P { + panictry!(parse::parse_expr_from_source_str( + "".to_string(), + s, + self.parse_sess())) + } + + fn parse_tts(&self, s: String) -> Vec { + panictry!(parse::parse_tts_from_source_str( + "".to_string(), + s, + self.parse_sess())) + } + } +} + +// These panicking parsing functions are used by the quote_*!() syntax extensions, +// but shouldn't be used otherwise. +pub fn parse_expr_panic(parser: &mut Parser) -> P { + panictry!(parser.parse_expr()) +} + +pub fn parse_item_panic(parser: &mut Parser) -> Option> { + panictry!(parser.parse_item()) +} + +pub fn parse_pat_panic(parser: &mut Parser) -> P { + panictry!(parser.parse_pat()) +} + +pub fn parse_arm_panic(parser: &mut Parser) -> Arm { + panictry!(parser.parse_arm()) +} + +pub fn parse_ty_panic(parser: &mut Parser) -> P { + panictry!(parser.parse_ty()) +} + +pub fn parse_stmt_panic(parser: &mut Parser) -> Option { + panictry!(parser.parse_stmt()) +} + +pub fn parse_attribute_panic(parser: &mut Parser, permit_inner: bool) -> ast::Attribute { + panictry!(parser.parse_attribute(permit_inner)) +} + +pub fn parse_arg_panic(parser: &mut Parser) -> Arg { + panictry!(parser.parse_arg()) +} + +pub fn parse_block_panic(parser: &mut Parser) -> P { + panictry!(parser.parse_block()) +} + +pub fn parse_meta_item_panic(parser: &mut Parser) -> ast::MetaItem { + panictry!(parser.parse_meta_item()) +} + +pub fn parse_path_panic(parser: &mut Parser, mode: PathStyle) -> ast::Path { + panictry!(parser.parse_path(mode)) +} + +pub fn expand_quote_tokens<'cx>(cx: &'cx mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let (cx_expr, expr) = expand_tts(cx, sp, tts); + let expanded = expand_wrapper(cx, sp, cx_expr, expr, &[&["syntax", "ext", "quote", "rt"]]); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_expr<'cx>(cx: &'cx mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_expr_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_item<'cx>(cx: &'cx mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_item_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_pat<'cx>(cx: &'cx mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_pat_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_arm(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_arm_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_ty(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_ty_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_stmt(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_stmt_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_attr(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_attribute_panic", + vec![cx.expr_bool(sp, true)], tts); + + base::MacEager::expr(expanded) +} + +pub fn expand_quote_arg(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_arg_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_block(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_block_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_meta_item(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let expanded = expand_parse_call(cx, sp, "parse_meta_item_panic", vec![], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_path(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let mode = mk_parser_path(cx, sp, &["PathStyle", "Type"]); + let expanded = expand_parse_call(cx, sp, "parse_path_panic", vec![mode], tts); + base::MacEager::expr(expanded) +} + +pub fn expand_quote_matcher(cx: &mut ExtCtxt, + sp: Span, + tts: &[TokenTree]) + -> Box { + let (cx_expr, tts) = parse_arguments_to_quote(cx, tts); + let mut vector = mk_stmts_let(cx, sp); + vector.extend(statements_mk_tts(cx, &tts[..], true)); + vector.push(cx.stmt_expr(cx.expr_ident(sp, id_ext("tt")))); + let block = cx.expr_block(cx.block(sp, vector)); + + let expanded = expand_wrapper(cx, sp, cx_expr, block, &[&["syntax", "ext", "quote", "rt"]]); + base::MacEager::expr(expanded) +} + +fn ids_ext(strs: Vec) -> Vec { + strs.iter().map(|s| ast::Ident::from_str(s)).collect() +} + +fn id_ext(s: &str) -> ast::Ident { + ast::Ident::from_str(s) +} + +// Lift an ident to the expr that evaluates to that ident. +fn mk_ident(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> P { + let e_str = cx.expr_str(sp, ident.name); + cx.expr_method_call(sp, + cx.expr_ident(sp, id_ext("ext_cx")), + id_ext("ident_of"), + vec![e_str]) +} + +// Lift a name to the expr that evaluates to that name +fn mk_name(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> P { + let e_str = cx.expr_str(sp, ident.name); + cx.expr_method_call(sp, + cx.expr_ident(sp, id_ext("ext_cx")), + id_ext("name_of"), + vec![e_str]) +} + +fn mk_tt_path(cx: &ExtCtxt, sp: Span, name: &str) -> P { + let idents = vec![id_ext("syntax"), id_ext("tokenstream"), id_ext("TokenTree"), id_ext(name)]; + cx.expr_path(cx.path_global(sp, idents)) +} + +fn mk_token_path(cx: &ExtCtxt, sp: Span, name: &str) -> P { + let idents = vec![id_ext("syntax"), id_ext("parse"), id_ext("token"), id_ext(name)]; + cx.expr_path(cx.path_global(sp, idents)) +} + +fn mk_parser_path(cx: &ExtCtxt, sp: Span, names: &[&str]) -> P { + let mut idents = vec![id_ext("syntax"), id_ext("parse"), id_ext("parser")]; + idents.extend(names.iter().cloned().map(id_ext)); + cx.expr_path(cx.path_global(sp, idents)) +} + +fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::BinOpToken) -> P { + let name = match bop { + token::Plus => "Plus", + token::Minus => "Minus", + token::Star => "Star", + token::Slash => "Slash", + token::Percent => "Percent", + token::Caret => "Caret", + token::And => "And", + token::Or => "Or", + token::Shl => "Shl", + token::Shr => "Shr" + }; + mk_token_path(cx, sp, name) +} + +fn mk_delim(cx: &ExtCtxt, sp: Span, delim: token::DelimToken) -> P { + let name = match delim { + token::Paren => "Paren", + token::Bracket => "Bracket", + token::Brace => "Brace", + token::NoDelim => "NoDelim", + }; + mk_token_path(cx, sp, name) +} + +#[allow(non_upper_case_globals)] +fn expr_mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P { + macro_rules! mk_lit { + ($name: expr, $suffix: expr, $($args: expr),*) => {{ + let inner = cx.expr_call(sp, mk_token_path(cx, sp, $name), vec![$($args),*]); + let suffix = match $suffix { + Some(name) => cx.expr_some(sp, mk_name(cx, sp, ast::Ident::with_empty_ctxt(name))), + None => cx.expr_none(sp) + }; + cx.expr_call(sp, mk_token_path(cx, sp, "Literal"), vec![inner, suffix]) + }} + } + match *tok { + token::BinOp(binop) => { + return cx.expr_call(sp, mk_token_path(cx, sp, "BinOp"), vec![mk_binop(cx, sp, binop)]); + } + token::BinOpEq(binop) => { + return cx.expr_call(sp, mk_token_path(cx, sp, "BinOpEq"), + vec![mk_binop(cx, sp, binop)]); + } + + token::OpenDelim(delim) => { + return cx.expr_call(sp, mk_token_path(cx, sp, "OpenDelim"), + vec![mk_delim(cx, sp, delim)]); + } + token::CloseDelim(delim) => { + return cx.expr_call(sp, mk_token_path(cx, sp, "CloseDelim"), + vec![mk_delim(cx, sp, delim)]); + } + + token::Literal(token::Byte(i), suf) => { + let e_byte = mk_name(cx, sp, ast::Ident::with_empty_ctxt(i)); + return mk_lit!("Byte", suf, e_byte); + } + + token::Literal(token::Char(i), suf) => { + let e_char = mk_name(cx, sp, ast::Ident::with_empty_ctxt(i)); + return mk_lit!("Char", suf, e_char); + } + + token::Literal(token::Integer(i), suf) => { + let e_int = mk_name(cx, sp, ast::Ident::with_empty_ctxt(i)); + return mk_lit!("Integer", suf, e_int); + } + + token::Literal(token::Float(fident), suf) => { + let e_fident = mk_name(cx, sp, ast::Ident::with_empty_ctxt(fident)); + return mk_lit!("Float", suf, e_fident); + } + + token::Literal(token::Str_(ident), suf) => { + return mk_lit!("Str_", suf, mk_name(cx, sp, ast::Ident::with_empty_ctxt(ident))) + } + + token::Literal(token::StrRaw(ident, n), suf) => { + return mk_lit!("StrRaw", suf, mk_name(cx, sp, ast::Ident::with_empty_ctxt(ident)), + cx.expr_usize(sp, n)) + } + + token::Ident(ident) => { + return cx.expr_call(sp, + mk_token_path(cx, sp, "Ident"), + vec![mk_ident(cx, sp, ident)]); + } + + token::Lifetime(ident) => { + return cx.expr_call(sp, + mk_token_path(cx, sp, "Lifetime"), + vec![mk_ident(cx, sp, ident)]); + } + + token::DocComment(ident) => { + return cx.expr_call(sp, + mk_token_path(cx, sp, "DocComment"), + vec![mk_name(cx, sp, ast::Ident::with_empty_ctxt(ident))]); + } + + token::MatchNt(name, kind) => { + return cx.expr_call(sp, + mk_token_path(cx, sp, "MatchNt"), + vec![mk_ident(cx, sp, name), mk_ident(cx, sp, kind)]); + } + + token::Interpolated(_) => panic!("quote! with interpolated token"), + + _ => () + } + + let name = match *tok { + token::Eq => "Eq", + token::Lt => "Lt", + token::Le => "Le", + token::EqEq => "EqEq", + token::Ne => "Ne", + token::Ge => "Ge", + token::Gt => "Gt", + token::AndAnd => "AndAnd", + token::OrOr => "OrOr", + token::Not => "Not", + token::Tilde => "Tilde", + token::At => "At", + token::Dot => "Dot", + token::DotDot => "DotDot", + token::Comma => "Comma", + token::Semi => "Semi", + token::Colon => "Colon", + token::ModSep => "ModSep", + token::RArrow => "RArrow", + token::LArrow => "LArrow", + token::FatArrow => "FatArrow", + token::Pound => "Pound", + token::Dollar => "Dollar", + token::Question => "Question", + token::Underscore => "Underscore", + token::Eof => "Eof", + _ => panic!("unhandled token in quote!"), + }; + mk_token_path(cx, sp, name) +} + +fn statements_mk_tt(cx: &ExtCtxt, tt: &TokenTree, matcher: bool) -> Vec { + match *tt { + TokenTree::Token(sp, SubstNt(ident)) => { + // tt.extend($ident.to_tokens(ext_cx)) + + let e_to_toks = + cx.expr_method_call(sp, + cx.expr_ident(sp, ident), + id_ext("to_tokens"), + vec![cx.expr_ident(sp, id_ext("ext_cx"))]); + let e_to_toks = + cx.expr_method_call(sp, e_to_toks, id_ext("into_iter"), vec![]); + + let e_push = + cx.expr_method_call(sp, + cx.expr_ident(sp, id_ext("tt")), + id_ext("extend"), + vec![e_to_toks]); + + vec![cx.stmt_expr(e_push)] + } + ref tt @ TokenTree::Token(_, MatchNt(..)) if !matcher => { + let mut seq = vec![]; + for i in 0..tt.len() { + seq.push(tt.get_tt(i)); + } + statements_mk_tts(cx, &seq[..], matcher) + } + TokenTree::Token(sp, ref tok) => { + let e_sp = cx.expr_ident(sp, id_ext("_sp")); + let e_tok = cx.expr_call(sp, + mk_tt_path(cx, sp, "Token"), + vec![e_sp, expr_mk_token(cx, sp, tok)]); + let e_push = + cx.expr_method_call(sp, + cx.expr_ident(sp, id_ext("tt")), + id_ext("push"), + vec![e_tok]); + vec![cx.stmt_expr(e_push)] + }, + TokenTree::Delimited(_, ref delimed) => { + statements_mk_tt(cx, &delimed.open_tt(), matcher).into_iter() + .chain(delimed.tts.iter() + .flat_map(|tt| statements_mk_tt(cx, tt, matcher))) + .chain(statements_mk_tt(cx, &delimed.close_tt(), matcher)) + .collect() + }, + TokenTree::Sequence(sp, ref seq) => { + if !matcher { + panic!("TokenTree::Sequence in quote!"); + } + + let e_sp = cx.expr_ident(sp, id_ext("_sp")); + + let stmt_let_tt = cx.stmt_let(sp, true, id_ext("tt"), cx.expr_vec_ng(sp)); + let mut tts_stmts = vec![stmt_let_tt]; + tts_stmts.extend(statements_mk_tts(cx, &seq.tts[..], matcher)); + tts_stmts.push(cx.stmt_expr(cx.expr_ident(sp, id_ext("tt")))); + let e_tts = cx.expr_block(cx.block(sp, tts_stmts)); + + let e_separator = match seq.separator { + Some(ref sep) => cx.expr_some(sp, expr_mk_token(cx, sp, sep)), + None => cx.expr_none(sp), + }; + let e_op = match seq.op { + tokenstream::KleeneOp::ZeroOrMore => "ZeroOrMore", + tokenstream::KleeneOp::OneOrMore => "OneOrMore", + }; + let e_op_idents = vec![ + id_ext("syntax"), + id_ext("tokenstream"), + id_ext("KleeneOp"), + id_ext(e_op), + ]; + let e_op = cx.expr_path(cx.path_global(sp, e_op_idents)); + let fields = vec![cx.field_imm(sp, id_ext("tts"), e_tts), + cx.field_imm(sp, id_ext("separator"), e_separator), + cx.field_imm(sp, id_ext("op"), e_op), + cx.field_imm(sp, id_ext("num_captures"), + cx.expr_usize(sp, seq.num_captures))]; + let seq_path = vec![id_ext("syntax"), + id_ext("tokenstream"), + id_ext("SequenceRepetition")]; + let e_seq_struct = cx.expr_struct(sp, cx.path_global(sp, seq_path), fields); + let e_rc_new = cx.expr_call_global(sp, vec![id_ext("std"), + id_ext("rc"), + id_ext("Rc"), + id_ext("new")], + vec![e_seq_struct]); + let e_tok = cx.expr_call(sp, + mk_tt_path(cx, sp, "Sequence"), + vec![e_sp, e_rc_new]); + let e_push = + cx.expr_method_call(sp, + cx.expr_ident(sp, id_ext("tt")), + id_ext("push"), + vec![e_tok]); + vec![cx.stmt_expr(e_push)] + } + } +} + +fn parse_arguments_to_quote(cx: &ExtCtxt, tts: &[TokenTree]) + -> (P, Vec) { + // NB: It appears that the main parser loses its mind if we consider + // $foo as a SubstNt during the main parse, so we have to re-parse + // under quote_depth > 0. This is silly and should go away; the _guess_ is + // it has to do with transition away from supporting old-style macros, so + // try removing it when enough of them are gone. + + let mut p = cx.new_parser_from_tts(tts); + p.quote_depth += 1; + + let cx_expr = panictry!(p.parse_expr()); + if !p.eat(&token::Comma) { + let _ = p.diagnostic().fatal("expected token `,`"); + } + + let tts = panictry!(p.parse_all_token_trees()); + p.abort_if_errors(); + + (cx_expr, tts) +} + +fn mk_stmts_let(cx: &ExtCtxt, sp: Span) -> Vec { + // We also bind a single value, sp, to ext_cx.call_site() + // + // This causes every span in a token-tree quote to be attributed to the + // call site of the extension using the quote. We can't really do much + // better since the source of the quote may well be in a library that + // was not even parsed by this compilation run, that the user has no + // source code for (eg. in libsyntax, which they're just _using_). + // + // The old quasiquoter had an elaborate mechanism for denoting input + // file locations from which quotes originated; unfortunately this + // relied on feeding the source string of the quote back into the + // compiler (which we don't really want to do) and, in any case, only + // pushed the problem a very small step further back: an error + // resulting from a parse of the resulting quote is still attributed to + // the site the string literal occurred, which was in a source file + // _other_ than the one the user has control over. For example, an + // error in a quote from the protocol compiler, invoked in user code + // using macro_rules! for example, will be attributed to the macro_rules.rs + // file in libsyntax, which the user might not even have source to (unless + // they happen to have a compiler on hand). Over all, the phase distinction + // just makes quotes "hard to attribute". Possibly this could be fixed + // by recreating some of the original qq machinery in the tt regime + // (pushing fake FileMaps onto the parser to account for original sites + // of quotes, for example) but at this point it seems not likely to be + // worth the hassle. + + let e_sp = cx.expr_method_call(sp, + cx.expr_ident(sp, id_ext("ext_cx")), + id_ext("call_site"), + Vec::new()); + + let stmt_let_sp = cx.stmt_let(sp, false, + id_ext("_sp"), + e_sp); + + let stmt_let_tt = cx.stmt_let(sp, true, id_ext("tt"), cx.expr_vec_ng(sp)); + + vec![stmt_let_sp, stmt_let_tt] +} + +fn statements_mk_tts(cx: &ExtCtxt, tts: &[TokenTree], matcher: bool) -> Vec { + let mut ss = Vec::new(); + for tt in tts { + ss.extend(statements_mk_tt(cx, tt, matcher)); + } + ss +} + +fn expand_tts(cx: &ExtCtxt, sp: Span, tts: &[TokenTree]) + -> (P, P) { + let (cx_expr, tts) = parse_arguments_to_quote(cx, tts); + + let mut vector = mk_stmts_let(cx, sp); + vector.extend(statements_mk_tts(cx, &tts[..], false)); + vector.push(cx.stmt_expr(cx.expr_ident(sp, id_ext("tt")))); + let block = cx.expr_block(cx.block(sp, vector)); + + (cx_expr, block) +} + +fn expand_wrapper(cx: &ExtCtxt, + sp: Span, + cx_expr: P, + expr: P, + imports: &[&[&str]]) -> P { + // Explicitly borrow to avoid moving from the invoker (#16992) + let cx_expr_borrow = cx.expr_addr_of(sp, cx.expr_deref(sp, cx_expr)); + let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr_borrow); + + let mut stmts = imports.iter().map(|path| { + // make item: `use ...;` + let path = path.iter().map(|s| s.to_string()).collect(); + cx.stmt_item(sp, cx.item_use_glob(sp, ast::Visibility::Inherited, ids_ext(path))) + }).chain(Some(stmt_let_ext_cx)).collect::>(); + stmts.push(cx.stmt_expr(expr)); + + cx.expr_block(cx.block(sp, stmts)) +} + +fn expand_parse_call(cx: &ExtCtxt, + sp: Span, + parse_method: &str, + arg_exprs: Vec> , + tts: &[TokenTree]) -> P { + let (cx_expr, tts_expr) = expand_tts(cx, sp, tts); + + let parse_sess_call = || cx.expr_method_call( + sp, cx.expr_ident(sp, id_ext("ext_cx")), + id_ext("parse_sess"), Vec::new()); + + let new_parser_call = + cx.expr_call(sp, + cx.expr_ident(sp, id_ext("new_parser_from_tts")), + vec![parse_sess_call(), tts_expr]); + + let path = vec![id_ext("syntax"), id_ext("ext"), id_ext("quote"), id_ext(parse_method)]; + let mut args = vec![cx.expr_mut_addr_of(sp, new_parser_call)]; + args.extend(arg_exprs); + let expr = cx.expr_call_global(sp, path, args); + + if parse_method == "parse_attribute" { + expand_wrapper(cx, sp, cx_expr, expr, &[&["syntax", "ext", "quote", "rt"], + &["syntax", "parse", "attr"]]) + } else { + expand_wrapper(cx, sp, cx_expr, expr, &[&["syntax", "ext", "quote", "rt"]]) + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/source_util.rs b/third_party/rust/syntex_syntax/src/ext/source_util.rs new file mode 100644 index 000000000000..39b92c7d007d --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/source_util.rs @@ -0,0 +1,196 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ast; +use syntax_pos::{self, Pos, Span}; +use ext::base::*; +use ext::base; +use ext::build::AstBuilder; +use parse::{token, DirectoryOwnership}; +use parse; +use print::pprust; +use ptr::P; +use symbol::Symbol; +use tokenstream; +use util::small_vector::SmallVector; + +use std::fs::File; +use std::io::prelude::*; +use std::path::{Path, PathBuf}; +use std::rc::Rc; + +// These macros all relate to the file system; they either return +// the column/row/filename of the expression, or they include +// a given file into the current one. + +/// line!(): expands to the current line number +pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + base::check_zero_tts(cx, sp, tts, "line!"); + + let topmost = cx.expansion_cause(); + let loc = cx.codemap().lookup_char_pos(topmost.lo); + + base::MacEager::expr(cx.expr_u32(topmost, loc.line as u32)) +} + +/* column!(): expands to the current column number */ +pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + base::check_zero_tts(cx, sp, tts, "column!"); + + let topmost = cx.expansion_cause(); + let loc = cx.codemap().lookup_char_pos(topmost.lo); + + base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32)) +} + +/// file!(): expands to the current filename */ +/// The filemap (`loc.file`) contains a bunch more information we could spit +/// out if we wanted. +pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + base::check_zero_tts(cx, sp, tts, "file!"); + + let topmost = cx.expansion_cause(); + let loc = cx.codemap().lookup_char_pos(topmost.lo); + base::MacEager::expr(cx.expr_str(topmost, Symbol::intern(&loc.file.name))) +} + +pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + let s = pprust::tts_to_string(tts); + base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&s))) +} + +pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + base::check_zero_tts(cx, sp, tts, "module_path!"); + let mod_path = &cx.current_expansion.module.mod_path; + let string = mod_path.iter().map(|x| x.to_string()).collect::>().join("::"); + + base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&string))) +} + +/// include! : parse the given file as an expr +/// This is generally a bad idea because it's going to behave +/// unhygienically. +pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + let file = match get_single_str_from_tts(cx, sp, tts, "include!") { + Some(f) => f, + None => return DummyResult::expr(sp), + }; + // The file will be added to the code map by the parser + let path = res_rel_file(cx, sp, Path::new(&file)); + let directory_ownership = DirectoryOwnership::Owned; + let p = parse::new_sub_parser_from_file(cx.parse_sess(), &path, directory_ownership, None, sp); + + struct ExpandResult<'a> { + p: parse::parser::Parser<'a>, + } + impl<'a> base::MacResult for ExpandResult<'a> { + fn make_expr(mut self: Box>) -> Option> { + Some(panictry!(self.p.parse_expr())) + } + fn make_items(mut self: Box>) + -> Option>> { + let mut ret = SmallVector::new(); + while self.p.token != token::Eof { + match panictry!(self.p.parse_item()) { + Some(item) => ret.push(item), + None => panic!(self.p.diagnostic().span_fatal(self.p.span, + &format!("expected item, found `{}`", + self.p.this_token_to_string()))) + } + } + Some(ret) + } + } + + Box::new(ExpandResult { p: p }) +} + +// include_str! : read the given file, insert it as a literal string expr +pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + let file = match get_single_str_from_tts(cx, sp, tts, "include_str!") { + Some(f) => f, + None => return DummyResult::expr(sp) + }; + let file = res_rel_file(cx, sp, Path::new(&file)); + let mut bytes = Vec::new(); + match File::open(&file).and_then(|mut f| f.read_to_end(&mut bytes)) { + Ok(..) => {} + Err(e) => { + cx.span_err(sp, + &format!("couldn't read {}: {}", + file.display(), + e)); + return DummyResult::expr(sp); + } + }; + match String::from_utf8(bytes) { + Ok(src) => { + // Add this input file to the code map to make it available as + // dependency information + let filename = format!("{}", file.display()); + cx.codemap().new_filemap_and_lines(&filename, None, &src); + + base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&src))) + } + Err(_) => { + cx.span_err(sp, + &format!("{} wasn't a utf-8 file", + file.display())); + return DummyResult::expr(sp); + } + } +} + +pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + let file = match get_single_str_from_tts(cx, sp, tts, "include_bytes!") { + Some(f) => f, + None => return DummyResult::expr(sp) + }; + let file = res_rel_file(cx, sp, Path::new(&file)); + let mut bytes = Vec::new(); + match File::open(&file).and_then(|mut f| f.read_to_end(&mut bytes)) { + Err(e) => { + cx.span_err(sp, + &format!("couldn't read {}: {}", file.display(), e)); + return DummyResult::expr(sp); + } + Ok(..) => { + // Add this input file to the code map to make it available as + // dependency information, but don't enter it's contents + let filename = format!("{}", file.display()); + cx.codemap().new_filemap_and_lines(&filename, None, ""); + + base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Rc::new(bytes)))) + } + } +} + +// resolve a file-system path to an absolute file-system path (if it +// isn't already) +fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: &Path) -> PathBuf { + // NB: relative paths are resolved relative to the compilation unit + if !arg.is_absolute() { + let callsite = cx.codemap().source_callsite(sp); + let mut cu = PathBuf::from(&cx.codemap().span_to_filename(callsite)); + cu.pop(); + cu.push(arg); + cu + } else { + arg.to_path_buf() + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/tt/macro_parser.rs b/third_party/rust/syntex_syntax/src/ext/tt/macro_parser.rs new file mode 100644 index 000000000000..ff732bb2111e --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/tt/macro_parser.rs @@ -0,0 +1,547 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! This is an Earley-like parser, without support for in-grammar nonterminals, +//! only by calling out to the main rust parser for named nonterminals (which it +//! commits to fully when it hits one in a grammar). This means that there are no +//! completer or predictor rules, and therefore no need to store one column per +//! token: instead, there's a set of current Earley items and a set of next +//! ones. Instead of NTs, we have a special case for Kleene star. The big-O, in +//! pathological cases, is worse than traditional Earley parsing, but it's an +//! easier fit for Macro-by-Example-style rules, and I think the overhead is +//! lower. (In order to prevent the pathological case, we'd need to lazily +//! construct the resulting `NamedMatch`es at the very end. It'd be a pain, +//! and require more memory to keep around old items, but it would also save +//! overhead) +//! +//! Quick intro to how the parser works: +//! +//! A 'position' is a dot in the middle of a matcher, usually represented as a +//! dot. For example `· a $( a )* a b` is a position, as is `a $( · a )* a b`. +//! +//! The parser walks through the input a character at a time, maintaining a list +//! of items consistent with the current position in the input string: `cur_eis`. +//! +//! As it processes them, it fills up `eof_eis` with items that would be valid if +//! the macro invocation is now over, `bb_eis` with items that are waiting on +//! a Rust nonterminal like `$e:expr`, and `next_eis` with items that are waiting +//! on a particular token. Most of the logic concerns moving the · through the +//! repetitions indicated by Kleene stars. It only advances or calls out to the +//! real Rust parser when no `cur_eis` items remain +//! +//! Example: Start parsing `a a a a b` against [· a $( a )* a b]. +//! +//! Remaining input: `a a a a b` +//! next_eis: [· a $( a )* a b] +//! +//! - - - Advance over an `a`. - - - +//! +//! Remaining input: `a a a b` +//! cur: [a · $( a )* a b] +//! Descend/Skip (first item). +//! next: [a $( · a )* a b] [a $( a )* · a b]. +//! +//! - - - Advance over an `a`. - - - +//! +//! Remaining input: `a a b` +//! cur: [a $( a · )* a b] next: [a $( a )* a · b] +//! Finish/Repeat (first item) +//! next: [a $( a )* · a b] [a $( · a )* a b] [a $( a )* a · b] +//! +//! - - - Advance over an `a`. - - - (this looks exactly like the last step) +//! +//! Remaining input: `a b` +//! cur: [a $( a · )* a b] next: [a $( a )* a · b] +//! Finish/Repeat (first item) +//! next: [a $( a )* · a b] [a $( · a )* a b] [a $( a )* a · b] +//! +//! - - - Advance over an `a`. - - - (this looks exactly like the last step) +//! +//! Remaining input: `b` +//! cur: [a $( a · )* a b] next: [a $( a )* a · b] +//! Finish/Repeat (first item) +//! next: [a $( a )* · a b] [a $( · a )* a b] +//! +//! - - - Advance over a `b`. - - - +//! +//! Remaining input: `` +//! eof: [a $( a )* a b ·] + +pub use self::NamedMatch::*; +pub use self::ParseResult::*; +use self::TokenTreeOrTokenTreeVec::*; + +use ast::Ident; +use syntax_pos::{self, BytePos, mk_sp, Span}; +use codemap::Spanned; +use errors::FatalError; +use parse::lexer::*; //resolve bug? +use parse::{Directory, ParseSess}; +use parse::parser::{PathStyle, Parser}; +use parse::token::{DocComment, MatchNt, SubstNt}; +use parse::token::{Token, Nonterminal}; +use parse::token; +use print::pprust; +use tokenstream::{self, TokenTree}; +use util::small_vector::SmallVector; + +use std::mem; +use std::rc::Rc; +use std::collections::HashMap; +use std::collections::hash_map::Entry::{Vacant, Occupied}; + +// To avoid costly uniqueness checks, we require that `MatchSeq` always has +// a nonempty body. + +#[derive(Clone)] +enum TokenTreeOrTokenTreeVec { + Tt(tokenstream::TokenTree), + TtSeq(Vec), +} + +impl TokenTreeOrTokenTreeVec { + fn len(&self) -> usize { + match *self { + TtSeq(ref v) => v.len(), + Tt(ref tt) => tt.len(), + } + } + + fn get_tt(&self, index: usize) -> TokenTree { + match *self { + TtSeq(ref v) => v[index].clone(), + Tt(ref tt) => tt.get_tt(index), + } + } +} + +/// an unzipping of `TokenTree`s +#[derive(Clone)] +struct MatcherTtFrame { + elts: TokenTreeOrTokenTreeVec, + idx: usize, +} + +#[derive(Clone)] +struct MatcherPos { + stack: Vec, + top_elts: TokenTreeOrTokenTreeVec, + sep: Option, + idx: usize, + up: Option>, + matches: Vec>>, + match_lo: usize, + match_cur: usize, + match_hi: usize, + sp_lo: BytePos, +} + +pub type NamedParseResult = ParseResult>>; + +pub fn count_names(ms: &[TokenTree]) -> usize { + ms.iter().fold(0, |count, elt| { + count + match *elt { + TokenTree::Sequence(_, ref seq) => { + seq.num_captures + } + TokenTree::Delimited(_, ref delim) => { + count_names(&delim.tts) + } + TokenTree::Token(_, MatchNt(..)) => { + 1 + } + TokenTree::Token(..) => 0, + } + }) +} + +fn initial_matcher_pos(ms: Vec, lo: BytePos) -> Box { + let match_idx_hi = count_names(&ms[..]); + let matches = create_matches(match_idx_hi); + Box::new(MatcherPos { + stack: vec![], + top_elts: TtSeq(ms), + sep: None, + idx: 0, + up: None, + matches: matches, + match_lo: 0, + match_cur: 0, + match_hi: match_idx_hi, + sp_lo: lo + }) +} + +/// NamedMatch is a pattern-match result for a single token::MATCH_NONTERMINAL: +/// so it is associated with a single ident in a parse, and all +/// `MatchedNonterminal`s in the NamedMatch have the same nonterminal type +/// (expr, item, etc). Each leaf in a single NamedMatch corresponds to a +/// single token::MATCH_NONTERMINAL in the TokenTree that produced it. +/// +/// The in-memory structure of a particular NamedMatch represents the match +/// that occurred when a particular subset of a matcher was applied to a +/// particular token tree. +/// +/// The width of each MatchedSeq in the NamedMatch, and the identity of the +/// `MatchedNonterminal`s, will depend on the token tree it was applied to: +/// each MatchedSeq corresponds to a single TTSeq in the originating +/// token tree. The depth of the NamedMatch structure will therefore depend +/// only on the nesting depth of `ast::TTSeq`s in the originating +/// token tree it was derived from. + +pub enum NamedMatch { + MatchedSeq(Vec>, syntax_pos::Span), + MatchedNonterminal(Rc) +} + +fn nameize>>(ms: &[TokenTree], mut res: I) -> NamedParseResult { + fn n_rec>>(m: &TokenTree, mut res: &mut I, + ret_val: &mut HashMap>) + -> Result<(), (syntax_pos::Span, String)> { + match *m { + TokenTree::Sequence(_, ref seq) => { + for next_m in &seq.tts { + try!(n_rec(next_m, res.by_ref(), ret_val)) + } + } + TokenTree::Delimited(_, ref delim) => { + for next_m in &delim.tts { + try!(n_rec(next_m, res.by_ref(), ret_val)); + } + } + TokenTree::Token(sp, MatchNt(bind_name, _)) => { + match ret_val.entry(bind_name) { + Vacant(spot) => { + spot.insert(res.next().unwrap()); + } + Occupied(..) => { + return Err((sp, format!("duplicated bind name: {}", bind_name))) + } + } + } + TokenTree::Token(sp, SubstNt(..)) => { + return Err((sp, "missing fragment specifier".to_string())) + } + TokenTree::Token(..) => (), + } + + Ok(()) + } + + let mut ret_val = HashMap::new(); + for m in ms { + match n_rec(m, res.by_ref(), &mut ret_val) { + Ok(_) => {}, + Err((sp, msg)) => return Error(sp, msg), + } + } + + Success(ret_val) +} + +pub enum ParseResult { + Success(T), + /// Arm failed to match. If the second parameter is `token::Eof`, it + /// indicates an unexpected end of macro invocation. Otherwise, it + /// indicates that no rules expected the given token. + Failure(syntax_pos::Span, Token), + /// Fatal error (malformed macro?). Abort compilation. + Error(syntax_pos::Span, String) +} + +pub fn parse_failure_msg(tok: Token) -> String { + match tok { + token::Eof => "unexpected end of macro invocation".to_string(), + _ => format!("no rules expected the token `{}`", pprust::token_to_string(&tok)), + } +} + +/// Perform a token equality check, ignoring syntax context (that is, an unhygienic comparison) +fn token_name_eq(t1 : &Token, t2 : &Token) -> bool { + match (t1,t2) { + (&token::Ident(id1),&token::Ident(id2)) + | (&token::Lifetime(id1),&token::Lifetime(id2)) => + id1.name == id2.name, + _ => *t1 == *t2 + } +} + +fn create_matches(len: usize) -> Vec>> { + (0..len).into_iter().map(|_| Vec::new()).collect() +} + +fn inner_parse_loop(cur_eis: &mut SmallVector>, + next_eis: &mut Vec>, + eof_eis: &mut SmallVector>, + bb_eis: &mut SmallVector>, + token: &Token, span: &syntax_pos::Span) -> ParseResult<()> { + while let Some(mut ei) = cur_eis.pop() { + // When unzipped trees end, remove them + while ei.idx >= ei.top_elts.len() { + match ei.stack.pop() { + Some(MatcherTtFrame { elts, idx }) => { + ei.top_elts = elts; + ei.idx = idx + 1; + } + None => break + } + } + + let idx = ei.idx; + let len = ei.top_elts.len(); + + // at end of sequence + if idx >= len { + // We are repeating iff there is a parent + if ei.up.is_some() { + // Disregarding the separator, add the "up" case to the tokens that should be + // examined. + // (remove this condition to make trailing seps ok) + if idx == len { + let mut new_pos = ei.up.clone().unwrap(); + + // update matches (the MBE "parse tree") by appending + // each tree as a subtree. + + // I bet this is a perf problem: we're preemptively + // doing a lot of array work that will get thrown away + // most of the time. + + // Only touch the binders we have actually bound + for idx in ei.match_lo..ei.match_hi { + let sub = ei.matches[idx].clone(); + new_pos.matches[idx] + .push(Rc::new(MatchedSeq(sub, mk_sp(ei.sp_lo, + span.hi)))); + } + + new_pos.match_cur = ei.match_hi; + new_pos.idx += 1; + cur_eis.push(new_pos); + } + + // Check if we need a separator + if idx == len && ei.sep.is_some() { + // We have a separator, and it is the current token. + if ei.sep.as_ref().map(|ref sep| token_name_eq(&token, sep)).unwrap_or(false) { + ei.idx += 1; + next_eis.push(ei); + } + } else { // we don't need a separator + ei.match_cur = ei.match_lo; + ei.idx = 0; + cur_eis.push(ei); + } + } else { + // We aren't repeating, so we must be potentially at the end of the input. + eof_eis.push(ei); + } + } else { + match ei.top_elts.get_tt(idx) { + /* need to descend into sequence */ + TokenTree::Sequence(sp, seq) => { + if seq.op == tokenstream::KleeneOp::ZeroOrMore { + // Examine the case where there are 0 matches of this sequence + let mut new_ei = ei.clone(); + new_ei.match_cur += seq.num_captures; + new_ei.idx += 1; + for idx in ei.match_cur..ei.match_cur + seq.num_captures { + new_ei.matches[idx].push(Rc::new(MatchedSeq(vec![], sp))); + } + cur_eis.push(new_ei); + } + + // Examine the case where there is at least one match of this sequence + let matches = create_matches(ei.matches.len()); + cur_eis.push(Box::new(MatcherPos { + stack: vec![], + sep: seq.separator.clone(), + idx: 0, + matches: matches, + match_lo: ei.match_cur, + match_cur: ei.match_cur, + match_hi: ei.match_cur + seq.num_captures, + up: Some(ei), + sp_lo: sp.lo, + top_elts: Tt(TokenTree::Sequence(sp, seq)), + })); + } + TokenTree::Token(_, MatchNt(..)) => { + // Built-in nonterminals never start with these tokens, + // so we can eliminate them from consideration. + match *token { + token::CloseDelim(_) => {}, + _ => bb_eis.push(ei), + } + } + TokenTree::Token(sp, SubstNt(..)) => { + return Error(sp, "missing fragment specifier".to_string()) + } + seq @ TokenTree::Delimited(..) | seq @ TokenTree::Token(_, DocComment(..)) => { + let lower_elts = mem::replace(&mut ei.top_elts, Tt(seq)); + let idx = ei.idx; + ei.stack.push(MatcherTtFrame { + elts: lower_elts, + idx: idx, + }); + ei.idx = 0; + cur_eis.push(ei); + } + TokenTree::Token(_, ref t) => { + if token_name_eq(t, &token) { + ei.idx += 1; + next_eis.push(ei); + } + } + } + } + } + + Success(()) +} + +pub fn parse(sess: &ParseSess, rdr: TtReader, ms: &[TokenTree], directory: Option) + -> NamedParseResult { + let mut parser = Parser::new(sess, Box::new(rdr), directory, true); + let mut cur_eis = SmallVector::one(initial_matcher_pos(ms.to_owned(), parser.span.lo)); + let mut next_eis = Vec::new(); // or proceed normally + + loop { + let mut bb_eis = SmallVector::new(); // black-box parsed by parser.rs + let mut eof_eis = SmallVector::new(); + assert!(next_eis.is_empty()); + + match inner_parse_loop(&mut cur_eis, &mut next_eis, &mut eof_eis, &mut bb_eis, + &parser.token, &parser.span) { + Success(_) => {}, + Failure(sp, tok) => return Failure(sp, tok), + Error(sp, msg) => return Error(sp, msg), + } + + // inner parse loop handled all cur_eis, so it's empty + assert!(cur_eis.is_empty()); + + /* error messages here could be improved with links to orig. rules */ + if token_name_eq(&parser.token, &token::Eof) { + if eof_eis.len() == 1 { + return nameize(ms, eof_eis[0].matches.iter_mut().map(|mut dv| dv.pop().unwrap())); + } else if eof_eis.len() > 1 { + return Error(parser.span, "ambiguity: multiple successful parses".to_string()); + } else { + return Failure(parser.span, token::Eof); + } + } else if (!bb_eis.is_empty() && !next_eis.is_empty()) || bb_eis.len() > 1 { + let nts = bb_eis.iter().map(|ei| match ei.top_elts.get_tt(ei.idx) { + TokenTree::Token(_, MatchNt(bind, name)) => { + format!("{} ('{}')", name, bind) + } + _ => panic!() + }).collect::>().join(" or "); + + return Error(parser.span, format!( + "local ambiguity: multiple parsing options: {}", + match next_eis.len() { + 0 => format!("built-in NTs {}.", nts), + 1 => format!("built-in NTs {} or 1 other option.", nts), + n => format!("built-in NTs {} or {} other options.", nts, n), + } + )); + } else if bb_eis.is_empty() && next_eis.is_empty() { + return Failure(parser.span, parser.token); + } else if !next_eis.is_empty() { + /* Now process the next token */ + cur_eis.extend(next_eis.drain(..)); + parser.bump(); + } else /* bb_eis.len() == 1 */ { + let mut ei = bb_eis.pop().unwrap(); + if let TokenTree::Token(span, MatchNt(_, ident)) = ei.top_elts.get_tt(ei.idx) { + let match_cur = ei.match_cur; + ei.matches[match_cur].push(Rc::new(MatchedNonterminal( + Rc::new(parse_nt(&mut parser, span, &ident.name.as_str()))))); + ei.idx += 1; + ei.match_cur += 1; + } else { + unreachable!() + } + cur_eis.push(ei); + } + + assert!(!cur_eis.is_empty()); + } +} + +fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal { + match name { + "tt" => { + p.quote_depth += 1; //but in theory, non-quoted tts might be useful + let mut tt = panictry!(p.parse_token_tree()); + p.quote_depth -= 1; + while let TokenTree::Token(sp, token::Interpolated(nt)) = tt { + if let token::NtTT(..) = *nt { + match Rc::try_unwrap(nt) { + Ok(token::NtTT(sub_tt)) => tt = sub_tt, + Ok(_) => unreachable!(), + Err(nt_rc) => match *nt_rc { + token::NtTT(ref sub_tt) => tt = sub_tt.clone(), + _ => unreachable!(), + }, + } + } else { + tt = TokenTree::Token(sp, token::Interpolated(nt.clone())); + break + } + } + return token::NtTT(tt); + } + _ => {} + } + // check at the beginning and the parser checks after each bump + p.check_unknown_macro_variable(); + match name { + "item" => match panictry!(p.parse_item()) { + Some(i) => token::NtItem(i), + None => { + p.fatal("expected an item keyword").emit(); + panic!(FatalError); + } + }, + "block" => token::NtBlock(panictry!(p.parse_block())), + "stmt" => match panictry!(p.parse_stmt()) { + Some(s) => token::NtStmt(s), + None => { + p.fatal("expected a statement").emit(); + panic!(FatalError); + } + }, + "pat" => token::NtPat(panictry!(p.parse_pat())), + "expr" => token::NtExpr(panictry!(p.parse_expr())), + "ty" => token::NtTy(panictry!(p.parse_ty())), + // this could be handled like a token, since it is one + "ident" => match p.token { + token::Ident(sn) => { + p.bump(); + token::NtIdent(Spanned::{node: sn, span: p.span}) + } + _ => { + let token_str = pprust::token_to_string(&p.token); + p.fatal(&format!("expected ident, found {}", + &token_str[..])).emit(); + panic!(FatalError) + } + }, + "path" => { + token::NtPath(panictry!(p.parse_path(PathStyle::Type))) + }, + "meta" => token::NtMeta(panictry!(p.parse_meta_item())), + // this is not supposed to happen, since it has been checked + // when compiling the macro. + _ => p.span_bug(sp, "invalid fragment specifier") + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/tt/macro_rules.rs b/third_party/rust/syntex_syntax/src/ext/tt/macro_rules.rs new file mode 100644 index 000000000000..3abd24b50ba9 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/tt/macro_rules.rs @@ -0,0 +1,810 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use {ast, attr}; +use syntax_pos::{Span, DUMMY_SP}; +use ext::base::{DummyResult, ExtCtxt, MacResult, SyntaxExtension}; +use ext::base::{NormalTT, TTMacroExpander}; +use ext::expand::{Expansion, ExpansionKind}; +use ext::tt::macro_parser::{Success, Error, Failure}; +use ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal}; +use ext::tt::macro_parser::{parse, parse_failure_msg}; +use parse::{Directory, ParseSess}; +use parse::lexer::new_tt_reader; +use parse::parser::Parser; +use parse::token::{self, NtTT, Token}; +use parse::token::Token::*; +use print; +use symbol::Symbol; +use tokenstream::{self, TokenTree}; + +use std::collections::{HashMap}; +use std::collections::hash_map::{Entry}; +use std::rc::Rc; + +pub struct ParserAnyMacro<'a> { + parser: Parser<'a>, + + /// Span of the expansion site of the macro this parser is for + site_span: Span, + /// The ident of the macro we're parsing + macro_ident: ast::Ident +} + +impl<'a> ParserAnyMacro<'a> { + pub fn make(mut self: Box>, kind: ExpansionKind) -> Expansion { + let ParserAnyMacro { site_span, macro_ident, ref mut parser } = *self; + let expansion = panictry!(parser.parse_expansion(kind, true)); + + // We allow semicolons at the end of expressions -- e.g. the semicolon in + // `macro_rules! m { () => { panic!(); } }` isn't parsed by `.parse_expr()`, + // but `m!()` is allowed in expression positions (c.f. issue #34706). + if kind == ExpansionKind::Expr && parser.token == token::Semi { + parser.bump(); + } + + // Make sure we don't have any tokens left to parse so we don't silently drop anything. + parser.ensure_complete_parse(macro_ident.name, kind.name(), site_span); + expansion + } +} + +struct MacroRulesMacroExpander { + name: ast::Ident, + lhses: Vec, + rhses: Vec, + valid: bool, +} + +impl TTMacroExpander for MacroRulesMacroExpander { + fn expand<'cx>(&self, + cx: &'cx mut ExtCtxt, + sp: Span, + arg: &[TokenTree]) + -> Box { + if !self.valid { + return DummyResult::any(sp); + } + generic_extension(cx, + sp, + self.name, + arg, + &self.lhses, + &self.rhses) + } +} + +/// Given `lhses` and `rhses`, this is the new macro we create +fn generic_extension<'cx>(cx: &'cx ExtCtxt, + sp: Span, + name: ast::Ident, + arg: &[TokenTree], + lhses: &[TokenTree], + rhses: &[TokenTree]) + -> Box { + if cx.trace_macros() { + println!("{}! {{ {} }}", + name, + print::pprust::tts_to_string(arg)); + } + + // Which arm's failure should we report? (the one furthest along) + let mut best_fail_spot = DUMMY_SP; + let mut best_fail_tok = None; + + for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers + let lhs_tt = match *lhs { + TokenTree::Delimited(_, ref delim) => &delim.tts[..], + _ => cx.span_bug(sp, "malformed macro lhs") + }; + + match TokenTree::parse(cx, lhs_tt, arg) { + Success(named_matches) => { + let rhs = match rhses[i] { + // ignore delimiters + TokenTree::Delimited(_, ref delimed) => delimed.tts.clone(), + _ => cx.span_bug(sp, "malformed macro rhs"), + }; + // rhs has holes ( `$id` and `$(...)` that need filled) + let trncbr = + new_tt_reader(&cx.parse_sess.span_diagnostic, Some(named_matches), rhs); + let directory = Directory { + path: cx.current_expansion.module.directory.clone(), + ownership: cx.current_expansion.directory_ownership, + }; + let mut p = Parser::new(cx.parse_sess(), Box::new(trncbr), Some(directory), false); + p.root_module_name = cx.current_expansion.module.mod_path.last() + .map(|id| (*id.name.as_str()).to_owned()); + + p.check_unknown_macro_variable(); + // Let the context choose how to interpret the result. + // Weird, but useful for X-macros. + return Box::new(ParserAnyMacro { + parser: p, + + // Pass along the original expansion site and the name of the macro + // so we can print a useful error message if the parse of the expanded + // macro leaves unparsed tokens. + site_span: sp, + macro_ident: name + }) + } + Failure(sp, tok) => if sp.lo >= best_fail_spot.lo { + best_fail_spot = sp; + best_fail_tok = Some(tok); + }, + Error(err_sp, ref msg) => { + cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..]) + } + } + } + + let best_fail_msg = parse_failure_msg(best_fail_tok.expect("ran no matchers")); + cx.span_fatal(best_fail_spot.substitute_dummy(sp), &best_fail_msg); +} + +// Note that macro-by-example's input is also matched against a token tree: +// $( $lhs:tt => $rhs:tt );+ +// +// Holy self-referential! + +/// Converts a `macro_rules!` invocation into a syntax extension. +pub fn compile(sess: &ParseSess, def: &ast::MacroDef) -> SyntaxExtension { + let lhs_nm = ast::Ident::with_empty_ctxt(Symbol::gensym("lhs")); + let rhs_nm = ast::Ident::with_empty_ctxt(Symbol::gensym("rhs")); + + // The pattern that macro_rules matches. + // The grammar for macro_rules! is: + // $( $lhs:tt => $rhs:tt );+ + // ...quasiquoting this would be nice. + // These spans won't matter, anyways + let match_lhs_tok = MatchNt(lhs_nm, ast::Ident::from_str("tt")); + let match_rhs_tok = MatchNt(rhs_nm, ast::Ident::from_str("tt")); + let argument_gram = vec![ + TokenTree::Sequence(DUMMY_SP, Rc::new(tokenstream::SequenceRepetition { + tts: vec![ + TokenTree::Token(DUMMY_SP, match_lhs_tok), + TokenTree::Token(DUMMY_SP, token::FatArrow), + TokenTree::Token(DUMMY_SP, match_rhs_tok), + ], + separator: Some(token::Semi), + op: tokenstream::KleeneOp::OneOrMore, + num_captures: 2, + })), + // to phase into semicolon-termination instead of semicolon-separation + TokenTree::Sequence(DUMMY_SP, Rc::new(tokenstream::SequenceRepetition { + tts: vec![TokenTree::Token(DUMMY_SP, token::Semi)], + separator: None, + op: tokenstream::KleeneOp::ZeroOrMore, + num_captures: 0 + })), + ]; + + // Parse the macro_rules! invocation (`none` is for no interpolations): + let arg_reader = new_tt_reader(&sess.span_diagnostic, None, def.body.clone()); + + let argument_map = match parse(sess, arg_reader, &argument_gram, None) { + Success(m) => m, + Failure(sp, tok) => { + let s = parse_failure_msg(tok); + panic!(sess.span_diagnostic.span_fatal(sp.substitute_dummy(def.span), &s)); + } + Error(sp, s) => { + panic!(sess.span_diagnostic.span_fatal(sp.substitute_dummy(def.span), &s)); + } + }; + + let mut valid = true; + + // Extract the arguments: + let lhses = match **argument_map.get(&lhs_nm).unwrap() { + MatchedSeq(ref s, _) => { + s.iter().map(|m| { + if let MatchedNonterminal(ref nt) = **m { + if let NtTT(ref tt) = **nt { + valid &= check_lhs_nt_follows(sess, tt); + return (*tt).clone(); + } + } + sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs") + }).collect::>() + } + _ => sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs") + }; + + let rhses = match **argument_map.get(&rhs_nm).unwrap() { + MatchedSeq(ref s, _) => { + s.iter().map(|m| { + if let MatchedNonterminal(ref nt) = **m { + if let NtTT(ref tt) = **nt { + return (*tt).clone(); + } + } + sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs") + }).collect() + } + _ => sess.span_diagnostic.span_bug(def.span, "wrong-structured rhs") + }; + + for rhs in &rhses { + valid &= check_rhs(sess, rhs); + } + + // don't abort iteration early, so that errors for multiple lhses can be reported + for lhs in &lhses { + valid &= check_lhs_no_empty_seq(sess, &[lhs.clone()]) + } + + let exp: Box<_> = Box::new(MacroRulesMacroExpander { + name: def.ident, + lhses: lhses, + rhses: rhses, + valid: valid, + }); + + NormalTT(exp, Some(def.span), attr::contains_name(&def.attrs, "allow_internal_unstable")) +} + +fn check_lhs_nt_follows(sess: &ParseSess, lhs: &TokenTree) -> bool { + // lhs is going to be like TokenTree::Delimited(...), where the + // entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens. + match lhs { + &TokenTree::Delimited(_, ref tts) => check_matcher(sess, &tts.tts), + _ => { + let msg = "invalid macro matcher; matchers must be contained in balanced delimiters"; + sess.span_diagnostic.span_err(lhs.get_span(), msg); + false + } + } + // we don't abort on errors on rejection, the driver will do that for us + // after parsing/expansion. we can report every error in every macro this way. +} + +/// Check that the lhs contains no repetition which could match an empty token +/// tree, because then the matcher would hang indefinitely. +fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[TokenTree]) -> bool { + for tt in tts { + match *tt { + TokenTree::Token(_, _) => (), + TokenTree::Delimited(_, ref del) => if !check_lhs_no_empty_seq(sess, &del.tts) { + return false; + }, + TokenTree::Sequence(span, ref seq) => { + if seq.separator.is_none() { + if seq.tts.iter().all(|seq_tt| { + match *seq_tt { + TokenTree::Sequence(_, ref sub_seq) => + sub_seq.op == tokenstream::KleeneOp::ZeroOrMore, + _ => false, + } + }) { + sess.span_diagnostic.span_err(span, "repetition matches empty token tree"); + return false; + } + } + if !check_lhs_no_empty_seq(sess, &seq.tts) { + return false; + } + } + } + } + + true +} + +fn check_rhs(sess: &ParseSess, rhs: &TokenTree) -> bool { + match *rhs { + TokenTree::Delimited(..) => return true, + _ => sess.span_diagnostic.span_err(rhs.get_span(), "macro rhs must be delimited") + } + false +} + +fn check_matcher(sess: &ParseSess, matcher: &[TokenTree]) -> bool { + let first_sets = FirstSets::new(matcher); + let empty_suffix = TokenSet::empty(); + let err = sess.span_diagnostic.err_count(); + check_matcher_core(sess, &first_sets, matcher, &empty_suffix); + err == sess.span_diagnostic.err_count() +} + +// The FirstSets for a matcher is a mapping from subsequences in the +// matcher to the FIRST set for that subsequence. +// +// This mapping is partially precomputed via a backwards scan over the +// token trees of the matcher, which provides a mapping from each +// repetition sequence to its FIRST set. +// +// (Hypothetically sequences should be uniquely identifiable via their +// spans, though perhaps that is false e.g. for macro-generated macros +// that do not try to inject artificial span information. My plan is +// to try to catch such cases ahead of time and not include them in +// the precomputed mapping.) +struct FirstSets { + // this maps each TokenTree::Sequence `$(tt ...) SEP OP` that is uniquely identified by its + // span in the original matcher to the First set for the inner sequence `tt ...`. + // + // If two sequences have the same span in a matcher, then map that + // span to None (invalidating the mapping here and forcing the code to + // use a slow path). + first: HashMap>, +} + +impl FirstSets { + fn new(tts: &[TokenTree]) -> FirstSets { + let mut sets = FirstSets { first: HashMap::new() }; + build_recur(&mut sets, tts); + return sets; + + // walks backward over `tts`, returning the FIRST for `tts` + // and updating `sets` at the same time for all sequence + // substructure we find within `tts`. + fn build_recur(sets: &mut FirstSets, tts: &[TokenTree]) -> TokenSet { + let mut first = TokenSet::empty(); + for tt in tts.iter().rev() { + match *tt { + TokenTree::Token(sp, ref tok) => { + first.replace_with((sp, tok.clone())); + } + TokenTree::Delimited(_, ref delimited) => { + build_recur(sets, &delimited.tts[..]); + first.replace_with((delimited.open_span, + Token::OpenDelim(delimited.delim))); + } + TokenTree::Sequence(sp, ref seq_rep) => { + let subfirst = build_recur(sets, &seq_rep.tts[..]); + + match sets.first.entry(sp) { + Entry::Vacant(vac) => { + vac.insert(Some(subfirst.clone())); + } + Entry::Occupied(mut occ) => { + // if there is already an entry, then a span must have collided. + // This should not happen with typical macro_rules macros, + // but syntax extensions need not maintain distinct spans, + // so distinct syntax trees can be assigned the same span. + // In such a case, the map cannot be trusted; so mark this + // entry as unusable. + occ.insert(None); + } + } + + // If the sequence contents can be empty, then the first + // token could be the separator token itself. + + if let (Some(ref sep), true) = (seq_rep.separator.clone(), + subfirst.maybe_empty) { + first.add_one_maybe((sp, sep.clone())); + } + + // Reverse scan: Sequence comes before `first`. + if subfirst.maybe_empty || seq_rep.op == tokenstream::KleeneOp::ZeroOrMore { + // If sequence is potentially empty, then + // union them (preserving first emptiness). + first.add_all(&TokenSet { maybe_empty: true, ..subfirst }); + } else { + // Otherwise, sequence guaranteed + // non-empty; replace first. + first = subfirst; + } + } + } + } + + return first; + } + } + + // walks forward over `tts` until all potential FIRST tokens are + // identified. + fn first(&self, tts: &[TokenTree]) -> TokenSet { + let mut first = TokenSet::empty(); + for tt in tts.iter() { + assert!(first.maybe_empty); + match *tt { + TokenTree::Token(sp, ref tok) => { + first.add_one((sp, tok.clone())); + return first; + } + TokenTree::Delimited(_, ref delimited) => { + first.add_one((delimited.open_span, + Token::OpenDelim(delimited.delim))); + return first; + } + TokenTree::Sequence(sp, ref seq_rep) => { + match self.first.get(&sp) { + Some(&Some(ref subfirst)) => { + + // If the sequence contents can be empty, then the first + // token could be the separator token itself. + + if let (Some(ref sep), true) = (seq_rep.separator.clone(), + subfirst.maybe_empty) { + first.add_one_maybe((sp, sep.clone())); + } + + assert!(first.maybe_empty); + first.add_all(subfirst); + if subfirst.maybe_empty || + seq_rep.op == tokenstream::KleeneOp::ZeroOrMore { + // continue scanning for more first + // tokens, but also make sure we + // restore empty-tracking state + first.maybe_empty = true; + continue; + } else { + return first; + } + } + + Some(&None) => { + panic!("assume all sequences have (unique) spans for now"); + } + + None => { + panic!("We missed a sequence during FirstSets construction"); + } + } + } + } + } + + // we only exit the loop if `tts` was empty or if every + // element of `tts` matches the empty sequence. + assert!(first.maybe_empty); + return first; + } +} + +// A set of Tokens, which may include MatchNt tokens (for +// macro-by-example syntactic variables). It also carries the +// `maybe_empty` flag; that is true if and only if the matcher can +// match an empty token sequence. +// +// The First set is computed on submatchers like `$($a:expr b),* $(c)* d`, +// which has corresponding FIRST = {$a:expr, c, d}. +// Likewise, `$($a:expr b),* $(c)+ d` has FIRST = {$a:expr, c}. +// +// (Notably, we must allow for *-op to occur zero times.) +#[derive(Clone, Debug)] +struct TokenSet { + tokens: Vec<(Span, Token)>, + maybe_empty: bool, +} + +impl TokenSet { + // Returns a set for the empty sequence. + fn empty() -> Self { TokenSet { tokens: Vec::new(), maybe_empty: true } } + + // Returns the set `{ tok }` for the single-token (and thus + // non-empty) sequence [tok]. + fn singleton(tok: (Span, Token)) -> Self { + TokenSet { tokens: vec![tok], maybe_empty: false } + } + + // Changes self to be the set `{ tok }`. + // Since `tok` is always present, marks self as non-empty. + fn replace_with(&mut self, tok: (Span, Token)) { + self.tokens.clear(); + self.tokens.push(tok); + self.maybe_empty = false; + } + + // Changes self to be the empty set `{}`; meant for use when + // the particular token does not matter, but we want to + // record that it occurs. + fn replace_with_irrelevant(&mut self) { + self.tokens.clear(); + self.maybe_empty = false; + } + + // Adds `tok` to the set for `self`, marking sequence as non-empy. + fn add_one(&mut self, tok: (Span, Token)) { + if !self.tokens.contains(&tok) { + self.tokens.push(tok); + } + self.maybe_empty = false; + } + + // Adds `tok` to the set for `self`. (Leaves `maybe_empty` flag alone.) + fn add_one_maybe(&mut self, tok: (Span, Token)) { + if !self.tokens.contains(&tok) { + self.tokens.push(tok); + } + } + + // Adds all elements of `other` to this. + // + // (Since this is a set, we filter out duplicates.) + // + // If `other` is potentially empty, then preserves the previous + // setting of the empty flag of `self`. If `other` is guaranteed + // non-empty, then `self` is marked non-empty. + fn add_all(&mut self, other: &Self) { + for tok in &other.tokens { + if !self.tokens.contains(tok) { + self.tokens.push(tok.clone()); + } + } + if !other.maybe_empty { + self.maybe_empty = false; + } + } +} + +// Checks that `matcher` is internally consistent and that it +// can legally by followed by a token N, for all N in `follow`. +// (If `follow` is empty, then it imposes no constraint on +// the `matcher`.) +// +// Returns the set of NT tokens that could possibly come last in +// `matcher`. (If `matcher` matches the empty sequence, then +// `maybe_empty` will be set to true.) +// +// Requires that `first_sets` is pre-computed for `matcher`; +// see `FirstSets::new`. +fn check_matcher_core(sess: &ParseSess, + first_sets: &FirstSets, + matcher: &[TokenTree], + follow: &TokenSet) -> TokenSet { + use print::pprust::token_to_string; + + let mut last = TokenSet::empty(); + + // 2. For each token and suffix [T, SUFFIX] in M: + // ensure that T can be followed by SUFFIX, and if SUFFIX may be empty, + // then ensure T can also be followed by any element of FOLLOW. + 'each_token: for i in 0..matcher.len() { + let token = &matcher[i]; + let suffix = &matcher[i+1..]; + + let build_suffix_first = || { + let mut s = first_sets.first(suffix); + if s.maybe_empty { s.add_all(follow); } + return s; + }; + + // (we build `suffix_first` on demand below; you can tell + // which cases are supposed to fall through by looking for the + // initialization of this variable.) + let suffix_first; + + // First, update `last` so that it corresponds to the set + // of NT tokens that might end the sequence `... token`. + match *token { + TokenTree::Token(sp, ref tok) => { + let can_be_followed_by_any; + if let Err(bad_frag) = has_legal_fragment_specifier(tok) { + let msg = format!("invalid fragment specifier `{}`", bad_frag); + sess.span_diagnostic.struct_span_err(sp, &msg) + .help("valid fragment specifiers are `ident`, `block`, \ + `stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt` \ + and `item`") + .emit(); + // (This eliminates false positives and duplicates + // from error messages.) + can_be_followed_by_any = true; + } else { + can_be_followed_by_any = token_can_be_followed_by_any(tok); + } + + if can_be_followed_by_any { + // don't need to track tokens that work with any, + last.replace_with_irrelevant(); + // ... and don't need to check tokens that can be + // followed by anything against SUFFIX. + continue 'each_token; + } else { + last.replace_with((sp, tok.clone())); + suffix_first = build_suffix_first(); + } + } + TokenTree::Delimited(_, ref d) => { + let my_suffix = TokenSet::singleton((d.close_span, Token::CloseDelim(d.delim))); + check_matcher_core(sess, first_sets, &d.tts, &my_suffix); + // don't track non NT tokens + last.replace_with_irrelevant(); + + // also, we don't need to check delimited sequences + // against SUFFIX + continue 'each_token; + } + TokenTree::Sequence(sp, ref seq_rep) => { + suffix_first = build_suffix_first(); + // The trick here: when we check the interior, we want + // to include the separator (if any) as a potential + // (but not guaranteed) element of FOLLOW. So in that + // case, we make a temp copy of suffix and stuff + // delimiter in there. + // + // FIXME: Should I first scan suffix_first to see if + // delimiter is already in it before I go through the + // work of cloning it? But then again, this way I may + // get a "tighter" span? + let mut new; + let my_suffix = if let Some(ref u) = seq_rep.separator { + new = suffix_first.clone(); + new.add_one_maybe((sp, u.clone())); + &new + } else { + &suffix_first + }; + + // At this point, `suffix_first` is built, and + // `my_suffix` is some TokenSet that we can use + // for checking the interior of `seq_rep`. + let next = check_matcher_core(sess, first_sets, &seq_rep.tts, my_suffix); + if next.maybe_empty { + last.add_all(&next); + } else { + last = next; + } + + // the recursive call to check_matcher_core already ran the 'each_last + // check below, so we can just keep going forward here. + continue 'each_token; + } + } + + // (`suffix_first` guaranteed initialized once reaching here.) + + // Now `last` holds the complete set of NT tokens that could + // end the sequence before SUFFIX. Check that every one works with `suffix`. + 'each_last: for &(_sp, ref t) in &last.tokens { + if let MatchNt(ref name, ref frag_spec) = *t { + for &(sp, ref next_token) in &suffix_first.tokens { + match is_in_follow(next_token, &frag_spec.name.as_str()) { + Err((msg, help)) => { + sess.span_diagnostic.struct_span_err(sp, &msg).help(help).emit(); + // don't bother reporting every source of + // conflict for a particular element of `last`. + continue 'each_last; + } + Ok(true) => {} + Ok(false) => { + let may_be = if last.tokens.len() == 1 && + suffix_first.tokens.len() == 1 + { + "is" + } else { + "may be" + }; + + sess.span_diagnostic.span_err( + sp, + &format!("`${name}:{frag}` {may_be} followed by `{next}`, which \ + is not allowed for `{frag}` fragments", + name=name, + frag=frag_spec, + next=token_to_string(next_token), + may_be=may_be) + ); + } + } + } + } + } + } + last +} + +fn token_can_be_followed_by_any(tok: &Token) -> bool { + if let &MatchNt(_, ref frag_spec) = tok { + frag_can_be_followed_by_any(&frag_spec.name.as_str()) + } else { + // (Non NT's can always be followed by anthing in matchers.) + true + } +} + +/// True if a fragment of type `frag` can be followed by any sort of +/// token. We use this (among other things) as a useful approximation +/// for when `frag` can be followed by a repetition like `$(...)*` or +/// `$(...)+`. In general, these can be a bit tricky to reason about, +/// so we adopt a conservative position that says that any fragment +/// specifier which consumes at most one token tree can be followed by +/// a fragment specifier (indeed, these fragments can be followed by +/// ANYTHING without fear of future compatibility hazards). +fn frag_can_be_followed_by_any(frag: &str) -> bool { + match frag { + "item" | // always terminated by `}` or `;` + "block" | // exactly one token tree + "ident" | // exactly one token tree + "meta" | // exactly one token tree + "tt" => // exactly one token tree + true, + + _ => + false, + } +} + +/// True if `frag` can legally be followed by the token `tok`. For +/// fragments that can consume an unbounded number of tokens, `tok` +/// must be within a well-defined follow set. This is intended to +/// guarantee future compatibility: for example, without this rule, if +/// we expanded `expr` to include a new binary operator, we might +/// break macros that were relying on that binary operator as a +/// separator. +// when changing this do not forget to update doc/book/macros.md! +fn is_in_follow(tok: &Token, frag: &str) -> Result { + if let &CloseDelim(_) = tok { + // closing a token tree can never be matched by any fragment; + // iow, we always require that `(` and `)` match, etc. + Ok(true) + } else { + match frag { + "item" => { + // since items *must* be followed by either a `;` or a `}`, we can + // accept anything after them + Ok(true) + }, + "block" => { + // anything can follow block, the braces provide an easy boundary to + // maintain + Ok(true) + }, + "stmt" | "expr" => { + match *tok { + FatArrow | Comma | Semi => Ok(true), + _ => Ok(false) + } + }, + "pat" => { + match *tok { + FatArrow | Comma | Eq | BinOp(token::Or) => Ok(true), + Ident(i) if i.name == "if" || i.name == "in" => Ok(true), + _ => Ok(false) + } + }, + "path" | "ty" => { + match *tok { + OpenDelim(token::DelimToken::Brace) | OpenDelim(token::DelimToken::Bracket) | + Comma | FatArrow | Colon | Eq | Gt | Semi | BinOp(token::Or) => Ok(true), + MatchNt(_, ref frag) if frag.name == "block" => Ok(true), + Ident(i) if i.name == "as" || i.name == "where" => Ok(true), + _ => Ok(false) + } + }, + "ident" => { + // being a single token, idents are harmless + Ok(true) + }, + "meta" | "tt" => { + // being either a single token or a delimited sequence, tt is + // harmless + Ok(true) + }, + _ => Err((format!("invalid fragment specifier `{}`", frag), + "valid fragment specifiers are `ident`, `block`, \ + `stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt` \ + and `item`")) + } + } +} + +fn has_legal_fragment_specifier(tok: &Token) -> Result<(), String> { + debug!("has_legal_fragment_specifier({:?})", tok); + if let &MatchNt(_, ref frag_spec) = tok { + let s = &frag_spec.name.as_str(); + if !is_legal_fragment_specifier(s) { + return Err(s.to_string()); + } + } + Ok(()) +} + +fn is_legal_fragment_specifier(frag: &str) -> bool { + match frag { + "item" | "block" | "stmt" | "expr" | "pat" | + "path" | "ty" | "ident" | "meta" | "tt" => true, + _ => false, + } +} diff --git a/third_party/rust/syntex_syntax/src/ext/tt/transcribe.rs b/third_party/rust/syntex_syntax/src/ext/tt/transcribe.rs new file mode 100644 index 000000000000..37e329e5d3b2 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ext/tt/transcribe.rs @@ -0,0 +1,300 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +use self::LockstepIterSize::*; + +use ast::Ident; +use errors::{Handler, DiagnosticBuilder}; +use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal}; +use parse::token::{self, MatchNt, SubstNt, Token, NtIdent}; +use parse::lexer::TokenAndSpan; +use syntax_pos::{Span, DUMMY_SP}; +use tokenstream::{self, TokenTree}; +use util::small_vector::SmallVector; + +use std::rc::Rc; +use std::ops::Add; +use std::collections::HashMap; + +///an unzipping of `TokenTree`s +#[derive(Clone)] +struct TtFrame { + forest: TokenTree, + idx: usize, + dotdotdoted: bool, + sep: Option, +} + +#[derive(Clone)] +pub struct TtReader<'a> { + pub sp_diag: &'a Handler, + /// the unzipped tree: + stack: SmallVector, + /* for MBE-style macro transcription */ + interpolations: HashMap>, + + repeat_idx: Vec, + repeat_len: Vec, + /* cached: */ + pub cur_tok: Token, + pub cur_span: Span, + /// Transform doc comments. Only useful in macro invocations + pub fatal_errs: Vec>, +} + +/// This can do Macro-By-Example transcription. On the other hand, if +/// `src` contains no `TokenTree::Sequence`s, `MatchNt`s or `SubstNt`s, `interp` can +/// (and should) be None. +pub fn new_tt_reader(sp_diag: &Handler, + interp: Option>>, + src: Vec) + -> TtReader { + let mut r = TtReader { + sp_diag: sp_diag, + stack: SmallVector::one(TtFrame { + forest: TokenTree::Sequence(DUMMY_SP, Rc::new(tokenstream::SequenceRepetition { + tts: src, + // doesn't matter. This merely holds the root unzipping. + separator: None, op: tokenstream::KleeneOp::ZeroOrMore, num_captures: 0 + })), + idx: 0, + dotdotdoted: false, + sep: None, + }), + interpolations: match interp { /* just a convenience */ + None => HashMap::new(), + Some(x) => x, + }, + repeat_idx: Vec::new(), + repeat_len: Vec::new(), + /* dummy values, never read: */ + cur_tok: token::Eof, + cur_span: DUMMY_SP, + fatal_errs: Vec::new(), + }; + tt_next_token(&mut r); /* get cur_tok and cur_span set up */ + r +} + +fn lookup_cur_matched_by_matched(r: &TtReader, start: Rc) -> Rc { + r.repeat_idx.iter().fold(start, |ad, idx| { + match *ad { + MatchedNonterminal(_) => { + // end of the line; duplicate henceforth + ad.clone() + } + MatchedSeq(ref ads, _) => ads[*idx].clone() + } + }) +} + +fn lookup_cur_matched(r: &TtReader, name: Ident) -> Option> { + let matched_opt = r.interpolations.get(&name).cloned(); + matched_opt.map(|s| lookup_cur_matched_by_matched(r, s)) +} + +#[derive(Clone)] +enum LockstepIterSize { + LisUnconstrained, + LisConstraint(usize, Ident), + LisContradiction(String), +} + +impl Add for LockstepIterSize { + type Output = LockstepIterSize; + + fn add(self, other: LockstepIterSize) -> LockstepIterSize { + match self { + LisUnconstrained => other, + LisContradiction(_) => self, + LisConstraint(l_len, ref l_id) => match other { + LisUnconstrained => self.clone(), + LisContradiction(_) => other, + LisConstraint(r_len, _) if l_len == r_len => self.clone(), + LisConstraint(r_len, r_id) => { + LisContradiction(format!("inconsistent lockstep iteration: \ + '{}' has {} items, but '{}' has {}", + l_id, l_len, r_id, r_len)) + } + }, + } + } +} + +fn lockstep_iter_size(t: &TokenTree, r: &TtReader) -> LockstepIterSize { + match *t { + TokenTree::Delimited(_, ref delimed) => { + delimed.tts.iter().fold(LisUnconstrained, |size, tt| { + size + lockstep_iter_size(tt, r) + }) + }, + TokenTree::Sequence(_, ref seq) => { + seq.tts.iter().fold(LisUnconstrained, |size, tt| { + size + lockstep_iter_size(tt, r) + }) + }, + TokenTree::Token(_, SubstNt(name)) | TokenTree::Token(_, MatchNt(name, _)) => + match lookup_cur_matched(r, name) { + Some(matched) => match *matched { + MatchedNonterminal(_) => LisUnconstrained, + MatchedSeq(ref ads, _) => LisConstraint(ads.len(), name), + }, + _ => LisUnconstrained + }, + TokenTree::Token(..) => LisUnconstrained, + } +} + +/// Return the next token from the TtReader. +/// EFFECT: advances the reader's token field +pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { + // FIXME(pcwalton): Bad copy? + let ret_val = TokenAndSpan { + tok: r.cur_tok.clone(), + sp: r.cur_span.clone(), + }; + loop { + let should_pop = match r.stack.last() { + None => { + assert_eq!(ret_val.tok, token::Eof); + return ret_val; + } + Some(frame) => { + if frame.idx < frame.forest.len() { + break; + } + !frame.dotdotdoted || + *r.repeat_idx.last().unwrap() == *r.repeat_len.last().unwrap() - 1 + } + }; + + /* done with this set; pop or repeat? */ + if should_pop { + let prev = r.stack.pop().unwrap(); + match r.stack.last_mut() { + None => { + r.cur_tok = token::Eof; + return ret_val; + } + Some(frame) => { + frame.idx += 1; + } + } + if prev.dotdotdoted { + r.repeat_idx.pop(); + r.repeat_len.pop(); + } + } else { /* repeat */ + *r.repeat_idx.last_mut().unwrap() += 1; + r.stack.last_mut().unwrap().idx = 0; + if let Some(tk) = r.stack.last().unwrap().sep.clone() { + r.cur_tok = tk; // repeat same span, I guess + return ret_val; + } + } + } + loop { /* because it's easiest, this handles `TokenTree::Delimited` not starting + with a `TokenTree::Token`, even though it won't happen */ + let t = { + let frame = r.stack.last().unwrap(); + // FIXME(pcwalton): Bad copy. + frame.forest.get_tt(frame.idx) + }; + match t { + TokenTree::Sequence(sp, seq) => { + // FIXME(pcwalton): Bad copy. + match lockstep_iter_size(&TokenTree::Sequence(sp, seq.clone()), + r) { + LisUnconstrained => { + panic!(r.sp_diag.span_fatal( + sp.clone(), /* blame macro writer */ + "attempted to repeat an expression \ + containing no syntax \ + variables matched as repeating at this depth")); + } + LisContradiction(ref msg) => { + // FIXME #2887 blame macro invoker instead + panic!(r.sp_diag.span_fatal(sp.clone(), &msg[..])); + } + LisConstraint(len, _) => { + if len == 0 { + if seq.op == tokenstream::KleeneOp::OneOrMore { + // FIXME #2887 blame invoker + panic!(r.sp_diag.span_fatal(sp.clone(), + "this must repeat at least once")); + } + + r.stack.last_mut().unwrap().idx += 1; + return tt_next_token(r); + } + r.repeat_len.push(len); + r.repeat_idx.push(0); + r.stack.push(TtFrame { + idx: 0, + dotdotdoted: true, + sep: seq.separator.clone(), + forest: TokenTree::Sequence(sp, seq), + }); + } + } + } + // FIXME #2887: think about span stuff here + TokenTree::Token(sp, SubstNt(ident)) => { + r.stack.last_mut().unwrap().idx += 1; + match lookup_cur_matched(r, ident) { + None => { + r.cur_span = sp; + r.cur_tok = SubstNt(ident); + return ret_val; + // this can't be 0 length, just like TokenTree::Delimited + } + Some(cur_matched) => if let MatchedNonterminal(ref nt) = *cur_matched { + match **nt { + // sidestep the interpolation tricks for ident because + // (a) idents can be in lots of places, so it'd be a pain + // (b) we actually can, since it's a token. + NtIdent(ref sn) => { + r.cur_span = sn.span; + r.cur_tok = token::Ident(sn.node); + return ret_val; + } + _ => { + // FIXME(pcwalton): Bad copy. + r.cur_span = sp; + r.cur_tok = token::Interpolated(nt.clone()); + return ret_val; + } + } + } else { + panic!(r.sp_diag.span_fatal( + sp, /* blame the macro writer */ + &format!("variable '{}' is still repeating at this depth", ident))); + } + } + } + // TokenTree::Delimited or any token that can be unzipped + seq @ TokenTree::Delimited(..) | seq @ TokenTree::Token(_, MatchNt(..)) => { + // do not advance the idx yet + r.stack.push(TtFrame { + forest: seq, + idx: 0, + dotdotdoted: false, + sep: None + }); + // if this could be 0-length, we'd need to potentially recur here + } + TokenTree::Token(sp, tok) => { + r.cur_span = sp; + r.cur_tok = tok; + r.stack.last_mut().unwrap().idx += 1; + return ret_val; + } + } + } +} diff --git a/third_party/rust/syntex_syntax/src/feature_gate.rs b/third_party/rust/syntex_syntax/src/feature_gate.rs new file mode 100644 index 000000000000..cbc0142b7d5b --- /dev/null +++ b/third_party/rust/syntex_syntax/src/feature_gate.rs @@ -0,0 +1,1489 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Feature gating +//! +//! This module implements the gating necessary for preventing certain compiler +//! features from being used by default. This module will crawl a pre-expanded +//! AST to ensure that there are no features which are used that are not +//! enabled. +//! +//! Features are enabled in programs via the crate-level attributes of +//! `#![feature(...)]` with a comma-separated list of features. +//! +//! For the purpose of future feature-tracking, once code for detection of feature +//! gate usage is added, *do not remove it again* even once the feature +//! becomes stable. + +use self::AttributeType::*; +use self::AttributeGate::*; + +use abi::Abi; +use ast::{self, NodeId, PatKind}; +use attr; +use codemap::{CodeMap, Spanned}; +use syntax_pos::Span; +use errors::{DiagnosticBuilder, Handler}; +use visit::{self, FnKind, Visitor}; +use parse::ParseSess; +use symbol::Symbol; + +use std::ascii::AsciiExt; +use std::env; + +macro_rules! setter { + ($field: ident) => {{ + fn f(features: &mut Features) -> &mut bool { + &mut features.$field + } + f as fn(&mut Features) -> &mut bool + }} +} + +macro_rules! declare_features { + ($((active, $feature: ident, $ver: expr, $issue: expr),)+) => { + /// Represents active features that are currently being implemented or + /// currently being considered for addition/removal. + const ACTIVE_FEATURES: &'static [(&'static str, &'static str, + Option, fn(&mut Features) -> &mut bool)] = &[ + $((stringify!($feature), $ver, $issue, setter!($feature))),+ + ]; + + /// A set of features to be used by later passes. + pub struct Features { + /// #![feature] attrs for stable language features, for error reporting + pub declared_stable_lang_features: Vec<(Symbol, Span)>, + /// #![feature] attrs for non-language (library) features + pub declared_lib_features: Vec<(Symbol, Span)>, + $(pub $feature: bool),+ + } + + impl Features { + pub fn new() -> Features { + Features { + declared_stable_lang_features: Vec::new(), + declared_lib_features: Vec::new(), + $($feature: false),+ + } + } + } + }; + + ($((removed, $feature: ident, $ver: expr, $issue: expr),)+) => { + /// Represents features which has since been removed (it was once Active) + const REMOVED_FEATURES: &'static [(&'static str, &'static str, Option)] = &[ + $((stringify!($feature), $ver, $issue)),+ + ]; + }; + + ($((accepted, $feature: ident, $ver: expr, $issue: expr),)+) => { + /// Those language feature has since been Accepted (it was once Active) + const ACCEPTED_FEATURES: &'static [(&'static str, &'static str, Option)] = &[ + $((stringify!($feature), $ver, $issue)),+ + ]; + } +} + +// If you change this list without updating src/doc/reference.md, @cmr will be sad +// Don't ever remove anything from this list; set them to 'Removed'. +// The version numbers here correspond to the version in which the current status +// was set. This is most important for knowing when a particular feature became +// stable (active). +// NB: The featureck.py script parses this information directly out of the source +// so take care when modifying it. + +declare_features! ( + (active, asm, "1.0.0", Some(29722)), + (active, concat_idents, "1.0.0", Some(29599)), + (active, link_args, "1.0.0", Some(29596)), + (active, log_syntax, "1.0.0", Some(29598)), + (active, non_ascii_idents, "1.0.0", Some(28979)), + (active, plugin_registrar, "1.0.0", Some(29597)), + (active, thread_local, "1.0.0", Some(29594)), + (active, trace_macros, "1.0.0", Some(29598)), + + // rustc internal, for now: + (active, intrinsics, "1.0.0", None), + (active, lang_items, "1.0.0", None), + + (active, link_llvm_intrinsics, "1.0.0", Some(29602)), + (active, linkage, "1.0.0", Some(29603)), + (active, quote, "1.0.0", Some(29601)), + (active, simd, "1.0.0", Some(27731)), + + + // rustc internal + (active, rustc_diagnostic_macros, "1.0.0", None), + (active, advanced_slice_patterns, "1.0.0", Some(23121)), + (active, box_syntax, "1.0.0", Some(27779)), + (active, placement_in_syntax, "1.0.0", Some(27779)), + (active, reflect, "1.0.0", Some(27749)), + (active, unboxed_closures, "1.0.0", Some(29625)), + + // rustc internal. + (active, pushpop_unsafe, "1.2.0", None), + + (active, allocator, "1.0.0", Some(27389)), + (active, fundamental, "1.0.0", Some(29635)), + (active, main, "1.0.0", Some(29634)), + (active, needs_allocator, "1.4.0", Some(27389)), + (active, on_unimplemented, "1.0.0", Some(29628)), + (active, plugin, "1.0.0", Some(29597)), + (active, simd_ffi, "1.0.0", Some(27731)), + (active, start, "1.0.0", Some(29633)), + (active, structural_match, "1.8.0", Some(31434)), + (active, panic_runtime, "1.10.0", Some(32837)), + (active, needs_panic_runtime, "1.10.0", Some(32837)), + + // OIBIT specific features + (active, optin_builtin_traits, "1.0.0", Some(13231)), + + // macro reexport needs more discussion and stabilization + (active, macro_reexport, "1.0.0", Some(29638)), + + // Allows use of #[staged_api] + // rustc internal + (active, staged_api, "1.0.0", None), + + // Allows using #![no_core] + (active, no_core, "1.3.0", Some(29639)), + + // Allows using `box` in patterns; RFC 469 + (active, box_patterns, "1.0.0", Some(29641)), + + // Allows using the unsafe_destructor_blind_to_params attribute; + // RFC 1238 + (active, dropck_parametricity, "1.3.0", Some(28498)), + + // Allows using the may_dangle attribute; RFC 1327 + (active, dropck_eyepatch, "1.10.0", Some(34761)), + + // Allows the use of custom attributes; RFC 572 + (active, custom_attribute, "1.0.0", Some(29642)), + + // Allows the use of #[derive(Anything)] as sugar for + // #[derive_Anything]. + (active, custom_derive, "1.0.0", Some(29644)), + + // Allows the use of rustc_* attributes; RFC 572 + (active, rustc_attrs, "1.0.0", Some(29642)), + + // Allows the use of #[allow_internal_unstable]. This is an + // attribute on macro_rules! and can't use the attribute handling + // below (it has to be checked before expansion possibly makes + // macros disappear). + // + // rustc internal + (active, allow_internal_unstable, "1.0.0", None), + + // #23121. Array patterns have some hazards yet. + (active, slice_patterns, "1.0.0", Some(23121)), + + // Allows the definition of associated constants in `trait` or `impl` + // blocks. + (active, associated_consts, "1.0.0", Some(29646)), + + // Allows the definition of `const fn` functions. + (active, const_fn, "1.2.0", Some(24111)), + + // Allows indexing into constant arrays. + (active, const_indexing, "1.4.0", Some(29947)), + + // Allows using #[prelude_import] on glob `use` items. + // + // rustc internal + (active, prelude_import, "1.2.0", None), + + // Allows the definition recursive static items. + (active, static_recursion, "1.3.0", Some(29719)), + + // Allows default type parameters to influence type inference. + (active, default_type_parameter_fallback, "1.3.0", Some(27336)), + + // Allows associated type defaults + (active, associated_type_defaults, "1.2.0", Some(29661)), + + // allow `repr(simd)`, and importing the various simd intrinsics + (active, repr_simd, "1.4.0", Some(27731)), + + // Allows cfg(target_feature = "..."). + (active, cfg_target_feature, "1.4.0", Some(29717)), + + // allow `extern "platform-intrinsic" { ... }` + (active, platform_intrinsics, "1.4.0", Some(27731)), + + // allow `#[unwind]` + // rust runtime internal + (active, unwind_attributes, "1.4.0", None), + + // allow the use of `#[naked]` on functions. + (active, naked_functions, "1.9.0", Some(32408)), + + // allow `#[no_debug]` + (active, no_debug, "1.5.0", Some(29721)), + + // allow `#[omit_gdb_pretty_printer_section]` + // rustc internal. + (active, omit_gdb_pretty_printer_section, "1.5.0", None), + + // Allows cfg(target_vendor = "..."). + (active, cfg_target_vendor, "1.5.0", Some(29718)), + + // Allow attributes on expressions and non-item statements + (active, stmt_expr_attributes, "1.6.0", Some(15701)), + + // allow using type ascription in expressions + (active, type_ascription, "1.6.0", Some(23416)), + + // Allows cfg(target_thread_local) + (active, cfg_target_thread_local, "1.7.0", Some(29594)), + + // rustc internal + (active, abi_vectorcall, "1.7.0", None), + + // a...b and ...b + (active, inclusive_range_syntax, "1.7.0", Some(28237)), + + // impl specialization (RFC 1210) + (active, specialization, "1.7.0", Some(31844)), + + // pub(restricted) visibilities (RFC 1422) + (active, pub_restricted, "1.9.0", Some(32409)), + + // Allow Drop types in statics/const functions (RFC 1440) + (active, drop_types_in_const, "1.9.0", Some(33156)), + + // Allows cfg(target_has_atomic = "..."). + (active, cfg_target_has_atomic, "1.9.0", Some(32976)), + + // Allows `impl Trait` in function return types. + (active, conservative_impl_trait, "1.12.0", Some(34511)), + + // Permits numeric fields in struct expressions and patterns. + (active, relaxed_adts, "1.12.0", Some(35626)), + + // The `!` type + (active, never_type, "1.13.0", Some(35121)), + + // Allows all literals in attribute lists and values of key-value pairs. + (active, attr_literals, "1.13.0", Some(34981)), + + // Allows the sysV64 ABI to be specified on all platforms + // instead of just the platforms on which it is the C ABI + (active, abi_sysv64, "1.13.0", Some(36167)), + + // Allows untagged unions `union U { ... }` + (active, untagged_unions, "1.13.0", Some(32836)), + + // elide `'static` lifetimes in `static`s and `const`s + (active, static_in_const, "1.13.0", Some(35897)), + + // Used to identify the `compiler_builtins` crate + // rustc internal + (active, compiler_builtins, "1.13.0", None), + + // Allows attributes on lifetime/type formal parameters in generics (RFC 1327) + (active, generic_param_attrs, "1.11.0", Some(34761)), + + // Allows field shorthands (`x` meaning `x: x`) in struct literal expressions. + (active, field_init_shorthand, "1.14.0", Some(37340)), + + // The #![windows_subsystem] attribute + (active, windows_subsystem, "1.14.0", Some(37499)), + + // Allows using `Self` and associated types in struct expressions and patterns. + (active, more_struct_aliases, "1.14.0", Some(37544)), + + + // Allows #[link(..., cfg(..))] + (active, link_cfg, "1.14.0", Some(37406)), + + (active, use_extern_macros, "1.15.0", Some(35896)), + + // Allows `break {expr}` with a value inside `loop`s. + (active, loop_break_value, "1.14.0", Some(37339)), + + // Allows #[target_feature(...)] + (active, target_feature, "1.15.0", None), + + // Allow safe suggestions for potential type conversions. + (active, safe_suggestion, "1.0.0", Some(37384)), + + // `extern "ptx-*" fn()` + (active, abi_ptx, "1.15.0", None), + + // The `i128` type + (active, i128_type, "1.16.0", Some(35118)), + + // The `unadjusted` ABI. Perma unstable. + (active, abi_unadjusted, "1.16.0", None), +); + +declare_features! ( + (removed, import_shadowing, "1.0.0", None), + (removed, managed_boxes, "1.0.0", None), + // Allows use of unary negate on unsigned integers, e.g. -e for e: u8 + (removed, negate_unsigned, "1.0.0", Some(29645)), + // A way to temporarily opt out of opt in copy. This will *never* be accepted. + (removed, opt_out_copy, "1.0.0", None), + (removed, quad_precision_float, "1.0.0", None), + (removed, struct_inherit, "1.0.0", None), + (removed, test_removed_feature, "1.0.0", None), + (removed, visible_private_types, "1.0.0", None), + (removed, unsafe_no_drop_flag, "1.0.0", None), + // Allows using items which are missing stability attributes + // rustc internal + (removed, unmarked_api, "1.0.0", None), +); + +declare_features! ( + (accepted, associated_types, "1.0.0", None), + // allow overloading augmented assignment operations like `a += b` + (accepted, augmented_assignments, "1.8.0", Some(28235)), + // allow empty structs and enum variants with braces + (accepted, braced_empty_structs, "1.8.0", Some(29720)), + (accepted, default_type_params, "1.0.0", None), + (accepted, globs, "1.0.0", None), + (accepted, if_let, "1.0.0", None), + // A temporary feature gate used to enable parser extensions needed + // to bootstrap fix for #5723. + (accepted, issue_5723_bootstrap, "1.0.0", None), + (accepted, macro_rules, "1.0.0", None), + // Allows using #![no_std] + (accepted, no_std, "1.6.0", None), + (accepted, slicing_syntax, "1.0.0", None), + (accepted, struct_variant, "1.0.0", None), + // These are used to test this portion of the compiler, they don't actually + // mean anything + (accepted, test_accepted_feature, "1.0.0", None), + (accepted, tuple_indexing, "1.0.0", None), + // Allows macros to appear in the type position. + (accepted, type_macros, "1.13.0", Some(27245)), + (accepted, while_let, "1.0.0", None), + // Allows `#[deprecated]` attribute + (accepted, deprecated, "1.9.0", Some(29935)), + // `expr?` + (accepted, question_mark, "1.13.0", Some(31436)), + // Allows `..` in tuple (struct) patterns + (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)), + (accepted, item_like_imports, "1.14.0", Some(35120)), + // Macros 1.1 + (accepted, proc_macro, "1.15.0", Some(35900)), +); +// (changing above list without updating src/doc/reference.md makes @cmr sad) + +#[derive(PartialEq, Copy, Clone, Debug)] +pub enum AttributeType { + /// Normal, builtin attribute that is consumed + /// by the compiler before the unused_attribute check + Normal, + + /// Builtin attribute that may not be consumed by the compiler + /// before the unused_attribute check. These attributes + /// will be ignored by the unused_attribute lint + Whitelisted, + + /// Builtin attribute that is only allowed at the crate level + CrateLevel, +} + +pub enum AttributeGate { + /// Is gated by a given feature gate, reason + /// and function to check if enabled + Gated(Stability, &'static str, &'static str, fn(&Features) -> bool), + + /// Ungated attribute, can be used on all release channels + Ungated, +} + +impl AttributeGate { + fn is_deprecated(&self) -> bool { + match *self { + Gated(Stability::Deprecated(_), _, _, _) => true, + _ => false, + } + } +} + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +pub enum Stability { + Unstable, + // Argument is tracking issue link. + Deprecated(&'static str), +} + +// fn() is not Debug +impl ::std::fmt::Debug for AttributeGate { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match *self { + Gated(ref stab, ref name, ref expl, _) => + write!(fmt, "Gated({:?}, {}, {})", stab, name, expl), + Ungated => write!(fmt, "Ungated") + } + } +} + +macro_rules! cfg_fn { + ($field: ident) => {{ + fn f(features: &Features) -> bool { + features.$field + } + f as fn(&Features) -> bool + }} +} + +pub fn deprecated_attributes() -> Vec<&'static (&'static str, AttributeType, AttributeGate)> { + BUILTIN_ATTRIBUTES.iter().filter(|a| a.2.is_deprecated()).collect() +} + +// Attributes that have a special meaning to rustc or rustdoc +pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGate)] = &[ + // Normal attributes + + ("warn", Normal, Ungated), + ("allow", Normal, Ungated), + ("forbid", Normal, Ungated), + ("deny", Normal, Ungated), + + ("macro_reexport", Normal, Ungated), + ("macro_use", Normal, Ungated), + ("macro_export", Normal, Ungated), + ("plugin_registrar", Normal, Ungated), + + ("cfg", Normal, Ungated), + ("cfg_attr", Normal, Ungated), + ("main", Normal, Ungated), + ("start", Normal, Ungated), + ("test", Normal, Ungated), + ("bench", Normal, Ungated), + ("simd", Normal, Ungated), + ("repr", Normal, Ungated), + ("path", Normal, Ungated), + ("abi", Normal, Ungated), + ("automatically_derived", Normal, Ungated), + ("no_mangle", Normal, Ungated), + ("no_link", Normal, Ungated), + ("derive", Normal, Ungated), + ("should_panic", Normal, Ungated), + ("ignore", Normal, Ungated), + ("no_implicit_prelude", Normal, Ungated), + ("reexport_test_harness_main", Normal, Ungated), + ("link_args", Normal, Ungated), + ("macro_escape", Normal, Ungated), + + // RFC #1445. + ("structural_match", Whitelisted, Gated(Stability::Unstable, + "structural_match", + "the semantics of constant patterns is \ + not yet settled", + cfg_fn!(structural_match))), + + // Not used any more, but we can't feature gate it + ("no_stack_check", Normal, Ungated), + + ("plugin", CrateLevel, Gated(Stability::Unstable, + "plugin", + "compiler plugins are experimental \ + and possibly buggy", + cfg_fn!(plugin))), + + ("no_std", CrateLevel, Ungated), + ("no_core", CrateLevel, Gated(Stability::Unstable, + "no_core", + "no_core is experimental", + cfg_fn!(no_core))), + ("lang", Normal, Gated(Stability::Unstable, + "lang_items", + "language items are subject to change", + cfg_fn!(lang_items))), + ("linkage", Whitelisted, Gated(Stability::Unstable, + "linkage", + "the `linkage` attribute is experimental \ + and not portable across platforms", + cfg_fn!(linkage))), + ("thread_local", Whitelisted, Gated(Stability::Unstable, + "thread_local", + "`#[thread_local]` is an experimental feature, and does \ + not currently handle destructors. There is no \ + corresponding `#[task_local]` mapping to the task \ + model", + cfg_fn!(thread_local))), + + ("rustc_on_unimplemented", Normal, Gated(Stability::Unstable, + "on_unimplemented", + "the `#[rustc_on_unimplemented]` attribute \ + is an experimental feature", + cfg_fn!(on_unimplemented))), + ("allocator", Whitelisted, Gated(Stability::Unstable, + "allocator", + "the `#[allocator]` attribute is an experimental feature", + cfg_fn!(allocator))), + ("needs_allocator", Normal, Gated(Stability::Unstable, + "needs_allocator", + "the `#[needs_allocator]` \ + attribute is an experimental \ + feature", + cfg_fn!(needs_allocator))), + ("panic_runtime", Whitelisted, Gated(Stability::Unstable, + "panic_runtime", + "the `#[panic_runtime]` attribute is \ + an experimental feature", + cfg_fn!(panic_runtime))), + ("needs_panic_runtime", Whitelisted, Gated(Stability::Unstable, + "needs_panic_runtime", + "the `#[needs_panic_runtime]` \ + attribute is an experimental \ + feature", + cfg_fn!(needs_panic_runtime))), + ("rustc_variance", Normal, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_variance]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_error", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_error]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_if_this_changed", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_if_this_changed]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_then_this_would_need", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_if_this_changed]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_dirty", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_dirty]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_clean", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_clean]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_metadata_dirty", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_metadata_dirty]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_metadata_clean", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_metadata_clean]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_partition_reused", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "this attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_partition_translated", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "this attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_symbol_name", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "internal rustc attributes will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_item_path", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "internal rustc attributes will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_move_fragments", Normal, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_move_fragments]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_mir", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_mir]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_inherit_overflow_checks", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_inherit_overflow_checks]` \ + attribute is just used to control \ + overflow checking behavior of several \ + libcore functions that are inlined \ + across crates and will never be stable", + cfg_fn!(rustc_attrs))), + ("compiler_builtins", Whitelisted, Gated(Stability::Unstable, + "compiler_builtins", + "the `#[compiler_builtins]` attribute is used to \ + identify the `compiler_builtins` crate which \ + contains compiler-rt intrinsics and will never be \ + stable", + cfg_fn!(compiler_builtins))), + + ("allow_internal_unstable", Normal, Gated(Stability::Unstable, + "allow_internal_unstable", + EXPLAIN_ALLOW_INTERNAL_UNSTABLE, + cfg_fn!(allow_internal_unstable))), + + ("fundamental", Whitelisted, Gated(Stability::Unstable, + "fundamental", + "the `#[fundamental]` attribute \ + is an experimental feature", + cfg_fn!(fundamental))), + + ("proc_macro_derive", Normal, Ungated), + + ("rustc_copy_clone_marker", Whitelisted, Gated(Stability::Unstable, + "rustc_attrs", + "internal implementation detail", + cfg_fn!(rustc_attrs))), + + // FIXME: #14408 whitelist docs since rustdoc looks at them + ("doc", Whitelisted, Ungated), + + // FIXME: #14406 these are processed in trans, which happens after the + // lint pass + ("cold", Whitelisted, Ungated), + ("naked", Whitelisted, Gated(Stability::Unstable, + "naked_functions", + "the `#[naked]` attribute \ + is an experimental feature", + cfg_fn!(naked_functions))), + ("target_feature", Whitelisted, Gated( + Stability::Unstable, "target_feature", + "the `#[target_feature]` attribute is an experimental feature", + cfg_fn!(target_feature))), + ("export_name", Whitelisted, Ungated), + ("inline", Whitelisted, Ungated), + ("link", Whitelisted, Ungated), + ("link_name", Whitelisted, Ungated), + ("link_section", Whitelisted, Ungated), + ("no_builtins", Whitelisted, Ungated), + ("no_mangle", Whitelisted, Ungated), + ("no_debug", Whitelisted, Gated( + Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721"), + "no_debug", + "the `#[no_debug]` attribute is an experimental feature", + cfg_fn!(no_debug))), + ("omit_gdb_pretty_printer_section", Whitelisted, Gated(Stability::Unstable, + "omit_gdb_pretty_printer_section", + "the `#[omit_gdb_pretty_printer_section]` \ + attribute is just used for the Rust test \ + suite", + cfg_fn!(omit_gdb_pretty_printer_section))), + ("unsafe_destructor_blind_to_params", + Normal, + Gated(Stability::Unstable, + "dropck_parametricity", + "unsafe_destructor_blind_to_params has unstable semantics \ + and may be removed in the future", + cfg_fn!(dropck_parametricity))), + ("may_dangle", + Normal, + Gated(Stability::Unstable, + "dropck_eyepatch", + "may_dangle has unstable semantics and may be removed in the future", + cfg_fn!(dropck_eyepatch))), + ("unwind", Whitelisted, Gated(Stability::Unstable, + "unwind_attributes", + "#[unwind] is experimental", + cfg_fn!(unwind_attributes))), + + // used in resolve + ("prelude_import", Whitelisted, Gated(Stability::Unstable, + "prelude_import", + "`#[prelude_import]` is for use by rustc only", + cfg_fn!(prelude_import))), + + // FIXME: #14407 these are only looked at on-demand so we can't + // guarantee they'll have already been checked + ("rustc_deprecated", Whitelisted, Ungated), + ("must_use", Whitelisted, Ungated), + ("stable", Whitelisted, Ungated), + ("unstable", Whitelisted, Ungated), + ("deprecated", Normal, Ungated), + + ("rustc_paren_sugar", Normal, Gated(Stability::Unstable, + "unboxed_closures", + "unboxed_closures are still evolving", + cfg_fn!(unboxed_closures))), + ("rustc_reflect_like", Whitelisted, Gated(Stability::Unstable, + "reflect", + "defining reflective traits is still evolving", + cfg_fn!(reflect))), + + ("windows_subsystem", Whitelisted, Gated(Stability::Unstable, + "windows_subsystem", + "the windows subsystem attribute \ + is currently unstable", + cfg_fn!(windows_subsystem))), + + // Crate level attributes + ("crate_name", CrateLevel, Ungated), + ("crate_type", CrateLevel, Ungated), + ("crate_id", CrateLevel, Ungated), + ("feature", CrateLevel, Ungated), + ("no_start", CrateLevel, Ungated), + ("no_main", CrateLevel, Ungated), + ("no_builtins", CrateLevel, Ungated), + ("recursion_limit", CrateLevel, Ungated), + ("type_length_limit", CrateLevel, Ungated), +]; + +// cfg(...)'s that are feature gated +const GATED_CFGS: &'static [(&'static str, &'static str, fn(&Features) -> bool)] = &[ + // (name in cfg, feature, function to check if the feature is enabled) + ("target_feature", "cfg_target_feature", cfg_fn!(cfg_target_feature)), + ("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)), + ("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)), + ("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)), +]; + +#[derive(Debug, Eq, PartialEq)] +pub struct GatedCfg { + span: Span, + index: usize, +} + +impl GatedCfg { + pub fn gate(cfg: &ast::MetaItem) -> Option { + let name = &*cfg.name().as_str(); + GATED_CFGS.iter() + .position(|info| info.0 == name) + .map(|idx| { + GatedCfg { + span: cfg.span, + index: idx + } + }) + } + + pub fn check_and_emit(&self, sess: &ParseSess, features: &Features) { + let (cfg, feature, has_feature) = GATED_CFGS[self.index]; + if !has_feature(features) && !sess.codemap().span_allows_unstable(self.span) { + let explain = format!("`cfg({})` is experimental and subject to change", cfg); + emit_feature_err(sess, feature, self.span, GateIssue::Language, &explain); + } + } +} + +struct Context<'a> { + features: &'a Features, + parse_sess: &'a ParseSess, + cm: &'a CodeMap, + plugin_attributes: &'a [(String, AttributeType)], +} + +macro_rules! gate_feature_fn { + ($cx: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => {{ + let (cx, has_feature, span, name, explain) = ($cx, $has_feature, $span, $name, $explain); + let has_feature: bool = has_feature(&$cx.features); + debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", name, span, has_feature); + if !has_feature && !cx.cm.span_allows_unstable(span) { + emit_feature_err(cx.parse_sess, name, span, GateIssue::Language, explain); + } + }} +} + +macro_rules! gate_feature { + ($cx: expr, $feature: ident, $span: expr, $explain: expr) => { + gate_feature_fn!($cx, |x:&Features| x.$feature, $span, stringify!($feature), $explain) + } +} + +impl<'a> Context<'a> { + fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) { + debug!("check_attribute(attr = {:?})", attr); + let name = &*attr.name().as_str(); + for &(n, ty, ref gateage) in BUILTIN_ATTRIBUTES { + if n == name { + if let &Gated(_, ref name, ref desc, ref has_feature) = gateage { + gate_feature_fn!(self, has_feature, attr.span, name, desc); + } + debug!("check_attribute: {:?} is builtin, {:?}, {:?}", name, ty, gateage); + return; + } + } + for &(ref n, ref ty) in self.plugin_attributes { + if n == name { + // Plugins can't gate attributes, so we don't check for it + // unlike the code above; we only use this loop to + // short-circuit to avoid the checks below + debug!("check_attribute: {:?} is registered by a plugin, {:?}", name, ty); + return; + } + } + if name.starts_with("rustc_") { + gate_feature!(self, rustc_attrs, attr.span, + "unless otherwise specified, attributes \ + with the prefix `rustc_` \ + are reserved for internal compiler diagnostics"); + } else if name.starts_with("derive_") { + gate_feature!(self, custom_derive, attr.span, EXPLAIN_DERIVE_UNDERSCORE); + } else if attr::is_known(attr) { + debug!("check_attribute: {:?} is known", name); + } else { + // Only run the custom attribute lint during regular + // feature gate checking. Macro gating runs + // before the plugin attributes are registered + // so we skip this then + if !is_macro { + gate_feature!(self, custom_attribute, attr.span, + &format!("The attribute `{}` is currently \ + unknown to the compiler and \ + may have meaning \ + added to it in the future", + name)); + } + } + } +} + +pub fn check_attribute(attr: &ast::Attribute, parse_sess: &ParseSess, + cm: &CodeMap, features: &Features) { + let cx = Context { + features: features, parse_sess: parse_sess, + cm: cm, plugin_attributes: &[] + }; + cx.check_attribute(attr, true); +} + +pub fn find_lang_feature_accepted_version(feature: &str) -> Option<&'static str> { + ACCEPTED_FEATURES.iter().find(|t| t.0 == feature).map(|t| t.1) +} + +fn find_lang_feature_issue(feature: &str) -> Option { + if let Some(info) = ACTIVE_FEATURES.iter().find(|t| t.0 == feature) { + let issue = info.2; + // FIXME (#28244): enforce that active features have issue numbers + // assert!(issue.is_some()) + issue + } else { + // search in Accepted or Removed features + ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES.iter()) + .find(|t| t.0 == feature) + .unwrap().2 + } +} + +pub enum GateIssue { + Language, + Library(Option) +} + +pub fn emit_feature_err(sess: &ParseSess, feature: &str, span: Span, issue: GateIssue, + explain: &str) { + feature_err(sess, feature, span, issue, explain).emit(); +} + +pub fn feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue: GateIssue, + explain: &str) -> DiagnosticBuilder<'a> { + let diag = &sess.span_diagnostic; + + let issue = match issue { + GateIssue::Language => find_lang_feature_issue(feature), + GateIssue::Library(lib) => lib, + }; + + let mut err = if let Some(n) = issue { + diag.struct_span_err(span, &format!("{} (see issue #{})", explain, n)) + } else { + diag.struct_span_err(span, explain) + }; + + // #23973: do not suggest `#![feature(...)]` if we are in beta/stable + if sess.unstable_features.is_nightly_build() { + err.help(&format!("add #![feature({})] to the \ + crate attributes to enable", + feature)); + } + + err +} + +const EXPLAIN_BOX_SYNTAX: &'static str = + "box expression syntax is experimental; you can call `Box::new` instead."; + +pub const EXPLAIN_STMT_ATTR_SYNTAX: &'static str = + "attributes on non-item statements and expressions are experimental."; + +pub const EXPLAIN_ASM: &'static str = + "inline assembly is not stable enough for use and is subject to change"; + +pub const EXPLAIN_LOG_SYNTAX: &'static str = + "`log_syntax!` is not stable enough for use and is subject to change"; + +pub const EXPLAIN_CONCAT_IDENTS: &'static str = + "`concat_idents` is not stable enough for use and is subject to change"; + +pub const EXPLAIN_TRACE_MACROS: &'static str = + "`trace_macros` is not stable enough for use and is subject to change"; +pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str = + "allow_internal_unstable side-steps feature gating and stability checks"; + +pub const EXPLAIN_CUSTOM_DERIVE: &'static str = + "`#[derive]` for custom traits is not stable enough for use. It is deprecated and will \ + be removed in v1.15"; + +pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str = + "`#[derive]` for custom traits is deprecated and will be removed in v1.15. Prefer using \ + procedural macro custom derive"; + +pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str = + "attributes of the form `#[derive_*]` are reserved for the compiler"; + +pub const EXPLAIN_PLACEMENT_IN: &'static str = + "placement-in expression syntax is experimental and subject to change."; + +struct PostExpansionVisitor<'a> { + context: &'a Context<'a>, +} + +macro_rules! gate_feature_post { + ($cx: expr, $feature: ident, $span: expr, $explain: expr) => {{ + let (cx, span) = ($cx, $span); + if !cx.context.cm.span_allows_unstable(span) { + gate_feature!(cx.context, $feature, span, $explain) + } + }} +} + +impl<'a> PostExpansionVisitor<'a> { + fn check_abi(&self, abi: Abi, span: Span) { + match abi { + Abi::RustIntrinsic => { + gate_feature_post!(&self, intrinsics, span, + "intrinsics are subject to change"); + }, + Abi::PlatformIntrinsic => { + gate_feature_post!(&self, platform_intrinsics, span, + "platform intrinsics are experimental and possibly buggy"); + }, + Abi::Vectorcall => { + gate_feature_post!(&self, abi_vectorcall, span, + "vectorcall is experimental and subject to change"); + }, + Abi::RustCall => { + gate_feature_post!(&self, unboxed_closures, span, + "rust-call ABI is subject to change"); + }, + Abi::SysV64 => { + gate_feature_post!(&self, abi_sysv64, span, + "sysv64 ABI is experimental and subject to change"); + }, + Abi::PtxKernel => { + gate_feature_post!(&self, abi_ptx, span, + "PTX ABIs are experimental and subject to change"); + }, + Abi::Unadjusted => { + gate_feature_post!(&self, abi_unadjusted, span, + "unadjusted ABI is an implementation detail and perma-unstable"); + }, + // Stable + Abi::Cdecl | + Abi::Stdcall | + Abi::Fastcall | + Abi::Aapcs | + Abi::Win64 | + Abi::Rust | + Abi::C | + Abi::System => {} + } + } +} + +fn contains_novel_literal(item: &ast::MetaItem) -> bool { + use ast::MetaItemKind::*; + use ast::NestedMetaItemKind::*; + + match item.node { + Word => false, + NameValue(ref lit) => !lit.node.is_str(), + List(ref list) => list.iter().any(|li| { + match li.node { + MetaItem(ref mi) => contains_novel_literal(&mi), + Literal(_) => true, + } + }), + } +} + +fn starts_with_digit(s: &str) -> bool { + s.as_bytes().first().cloned().map_or(false, |b| b >= b'0' && b <= b'9') +} + +impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { + fn visit_attribute(&mut self, attr: &ast::Attribute) { + if !self.context.cm.span_allows_unstable(attr.span) { + // check for gated attributes + self.context.check_attribute(attr, false); + } + + if contains_novel_literal(&attr.value) { + gate_feature_post!(&self, attr_literals, attr.span, + "non-string literals in attributes, or string \ + literals in top-level positions, are experimental"); + } + } + + fn visit_name(&mut self, sp: Span, name: ast::Name) { + if !name.as_str().is_ascii() { + gate_feature_post!(&self, non_ascii_idents, sp, + "non-ascii idents are not fully supported."); + } + } + + fn visit_item(&mut self, i: &'a ast::Item) { + match i.node { + ast::ItemKind::ExternCrate(_) => { + if attr::contains_name(&i.attrs[..], "macro_reexport") { + gate_feature_post!(&self, macro_reexport, i.span, + "macros reexports are experimental \ + and possibly buggy"); + } + } + + ast::ItemKind::ForeignMod(ref foreign_module) => { + if attr::contains_name(&i.attrs[..], "link_args") { + gate_feature_post!(&self, link_args, i.span, + "the `link_args` attribute is not portable \ + across platforms, it is recommended to \ + use `#[link(name = \"foo\")]` instead") + } + self.check_abi(foreign_module.abi, i.span); + } + + ast::ItemKind::Fn(..) => { + if attr::contains_name(&i.attrs[..], "plugin_registrar") { + gate_feature_post!(&self, plugin_registrar, i.span, + "compiler plugins are experimental and possibly buggy"); + } + if attr::contains_name(&i.attrs[..], "start") { + gate_feature_post!(&self, start, i.span, + "a #[start] function is an experimental \ + feature whose signature may change \ + over time"); + } + if attr::contains_name(&i.attrs[..], "main") { + gate_feature_post!(&self, main, i.span, + "declaration of a nonstandard #[main] \ + function may change over time, for now \ + a top-level `fn main()` is required"); + } + } + + ast::ItemKind::Struct(..) => { + if attr::contains_name(&i.attrs[..], "simd") { + gate_feature_post!(&self, simd, i.span, + "SIMD types are experimental and possibly buggy"); + self.context.parse_sess.span_diagnostic.span_warn(i.span, + "the `#[simd]` attribute \ + is deprecated, use \ + `#[repr(simd)]` instead"); + } + for attr in &i.attrs { + if attr.name() == "repr" { + for item in attr.meta_item_list().unwrap_or(&[]) { + if item.check_name("simd") { + gate_feature_post!(&self, repr_simd, i.span, + "SIMD types are experimental \ + and possibly buggy"); + + } + } + } + } + } + + ast::ItemKind::Union(..) => { + gate_feature_post!(&self, untagged_unions, + i.span, + "unions are unstable and possibly buggy"); + } + + ast::ItemKind::DefaultImpl(..) => { + gate_feature_post!(&self, optin_builtin_traits, + i.span, + "default trait implementations are experimental \ + and possibly buggy"); + } + + ast::ItemKind::Impl(_, polarity, _, _, _, _) => { + match polarity { + ast::ImplPolarity::Negative => { + gate_feature_post!(&self, optin_builtin_traits, + i.span, + "negative trait bounds are not yet fully implemented; \ + use marker types for now"); + }, + _ => {} + } + } + + _ => {} + } + + visit::walk_item(self, i); + } + + fn visit_foreign_item(&mut self, i: &'a ast::ForeignItem) { + let links_to_llvm = match attr::first_attr_value_str_by_name(&i.attrs, "link_name") { + Some(val) => val.as_str().starts_with("llvm."), + _ => false + }; + if links_to_llvm { + gate_feature_post!(&self, link_llvm_intrinsics, i.span, + "linking to LLVM intrinsics is experimental"); + } + + visit::walk_foreign_item(self, i) + } + + fn visit_ty(&mut self, ty: &'a ast::Ty) { + match ty.node { + ast::TyKind::BareFn(ref bare_fn_ty) => { + self.check_abi(bare_fn_ty.abi, ty.span); + } + ast::TyKind::ImplTrait(..) => { + gate_feature_post!(&self, conservative_impl_trait, ty.span, + "`impl Trait` is experimental"); + } + ast::TyKind::Never => { + gate_feature_post!(&self, never_type, ty.span, + "The `!` type is experimental"); + }, + _ => {} + } + visit::walk_ty(self, ty) + } + + fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) { + if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty { + match output_ty.node { + ast::TyKind::Never => return, + _ => (), + }; + self.visit_ty(output_ty) + } + } + + fn visit_expr(&mut self, e: &'a ast::Expr) { + match e.node { + ast::ExprKind::Box(_) => { + gate_feature_post!(&self, box_syntax, e.span, EXPLAIN_BOX_SYNTAX); + } + ast::ExprKind::Type(..) => { + gate_feature_post!(&self, type_ascription, e.span, + "type ascription is experimental"); + } + ast::ExprKind::Range(_, _, ast::RangeLimits::Closed) => { + gate_feature_post!(&self, inclusive_range_syntax, + e.span, + "inclusive range syntax is experimental"); + } + ast::ExprKind::InPlace(..) => { + gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN); + } + ast::ExprKind::Struct(_, ref fields, _) => { + for field in fields { + if field.is_shorthand { + gate_feature_post!(&self, field_init_shorthand, field.span, + "struct field shorthands are unstable"); + } + if starts_with_digit(&field.ident.node.name.as_str()) { + gate_feature_post!(&self, relaxed_adts, + field.span, + "numeric fields in struct expressions are unstable"); + } + } + } + ast::ExprKind::Break(_, Some(_)) => { + gate_feature_post!(&self, loop_break_value, e.span, + "`break` with a value is experimental"); + } + ast::ExprKind::Lit(ref lit) => { + if let ast::LitKind::Int(_, ref ty) = lit.node { + match *ty { + ast::LitIntType::Signed(ast::IntTy::I128) | + ast::LitIntType::Unsigned(ast::UintTy::U128) => { + gate_feature_post!(&self, i128_type, e.span, + "128-bit integers are not stable"); + } + _ => {} + } + } + } + _ => {} + } + visit::walk_expr(self, e); + } + + fn visit_pat(&mut self, pattern: &'a ast::Pat) { + match pattern.node { + PatKind::Slice(_, Some(_), ref last) if !last.is_empty() => { + gate_feature_post!(&self, advanced_slice_patterns, + pattern.span, + "multiple-element slice matches anywhere \ + but at the end of a slice (e.g. \ + `[0, ..xs, 0]`) are experimental") + } + PatKind::Slice(..) => { + gate_feature_post!(&self, slice_patterns, + pattern.span, + "slice pattern syntax is experimental"); + } + PatKind::Box(..) => { + gate_feature_post!(&self, box_patterns, + pattern.span, + "box pattern syntax is experimental"); + } + PatKind::Struct(_, ref fields, _) => { + for field in fields { + if starts_with_digit(&field.node.ident.name.as_str()) { + gate_feature_post!(&self, relaxed_adts, + field.span, + "numeric fields in struct patterns are unstable"); + } + } + } + _ => {} + } + visit::walk_pat(self, pattern) + } + + fn visit_fn(&mut self, + fn_kind: FnKind<'a>, + fn_decl: &'a ast::FnDecl, + span: Span, + _node_id: NodeId) { + // check for const fn declarations + match fn_kind { + FnKind::ItemFn(_, _, _, Spanned { node: ast::Constness::Const, .. }, _, _, _) => { + gate_feature_post!(&self, const_fn, span, "const fn is unstable"); + } + _ => { + // stability of const fn methods are covered in + // visit_trait_item and visit_impl_item below; this is + // because default methods don't pass through this + // point. + } + } + + match fn_kind { + FnKind::ItemFn(_, _, _, _, abi, _, _) | + FnKind::Method(_, &ast::MethodSig { abi, .. }, _, _) => { + self.check_abi(abi, span); + } + _ => {} + } + visit::walk_fn(self, fn_kind, fn_decl, span); + } + + fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) { + match ti.node { + ast::TraitItemKind::Const(..) => { + gate_feature_post!(&self, associated_consts, + ti.span, + "associated constants are experimental") + } + ast::TraitItemKind::Method(ref sig, ref block) => { + if block.is_none() { + self.check_abi(sig.abi, ti.span); + } + if sig.constness.node == ast::Constness::Const { + gate_feature_post!(&self, const_fn, ti.span, "const fn is unstable"); + } + } + ast::TraitItemKind::Type(_, Some(_)) => { + gate_feature_post!(&self, associated_type_defaults, ti.span, + "associated type defaults are unstable"); + } + _ => {} + } + visit::walk_trait_item(self, ti); + } + + fn visit_impl_item(&mut self, ii: &'a ast::ImplItem) { + if ii.defaultness == ast::Defaultness::Default { + gate_feature_post!(&self, specialization, + ii.span, + "specialization is unstable"); + } + + match ii.node { + ast::ImplItemKind::Const(..) => { + gate_feature_post!(&self, associated_consts, + ii.span, + "associated constants are experimental") + } + ast::ImplItemKind::Method(ref sig, _) => { + if sig.constness.node == ast::Constness::Const { + gate_feature_post!(&self, const_fn, ii.span, "const fn is unstable"); + } + } + _ => {} + } + visit::walk_impl_item(self, ii); + } + + fn visit_vis(&mut self, vis: &'a ast::Visibility) { + let span = match *vis { + ast::Visibility::Crate(span) => span, + ast::Visibility::Restricted { ref path, .. } => path.span, + _ => return, + }; + gate_feature_post!(&self, pub_restricted, span, "`pub(restricted)` syntax is experimental"); + + visit::walk_vis(self, vis) + } + + fn visit_generics(&mut self, g: &'a ast::Generics) { + for t in &g.ty_params { + if !t.attrs.is_empty() { + gate_feature_post!(&self, generic_param_attrs, t.attrs[0].span, + "attributes on type parameter bindings are experimental"); + } + } + visit::walk_generics(self, g) + } + + fn visit_lifetime_def(&mut self, lifetime_def: &'a ast::LifetimeDef) { + if !lifetime_def.attrs.is_empty() { + gate_feature_post!(&self, generic_param_attrs, lifetime_def.attrs[0].span, + "attributes on lifetime bindings are experimental"); + } + visit::walk_lifetime_def(self, lifetime_def) + } +} + +pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute]) -> Features { + let mut features = Features::new(); + + for attr in krate_attrs { + if !attr.check_name("feature") { + continue + } + + match attr.meta_item_list() { + None => { + span_err!(span_handler, attr.span, E0555, + "malformed feature attribute, expected #![feature(...)]"); + } + Some(list) => { + for mi in list { + let name = if let Some(word) = mi.word() { + word.name() + } else { + span_err!(span_handler, mi.span, E0556, + "malformed feature, expected just one word"); + continue + }; + + if let Some(&(_, _, _, setter)) = ACTIVE_FEATURES.iter() + .find(|& &(n, _, _, _)| name == n) { + *(setter(&mut features)) = true; + } + else if let Some(&(_, _, _)) = REMOVED_FEATURES.iter() + .find(|& &(n, _, _)| name == n) { + span_err!(span_handler, mi.span, E0557, "feature has been removed"); + } + else if let Some(&(_, _, _)) = ACCEPTED_FEATURES.iter() + .find(|& &(n, _, _)| name == n) { + features.declared_stable_lang_features.push((name, mi.span)); + } else { + features.declared_lib_features.push((name, mi.span)); + } + } + } + } + } + + features +} + +pub fn check_crate(krate: &ast::Crate, + sess: &ParseSess, + features: &Features, + plugin_attributes: &[(String, AttributeType)], + unstable: UnstableFeatures) { + maybe_stage_features(&sess.span_diagnostic, krate, unstable); + let ctx = Context { + features: features, + parse_sess: sess, + cm: sess.codemap(), + plugin_attributes: plugin_attributes, + }; + visit::walk_crate(&mut PostExpansionVisitor { context: &ctx }, krate); +} + +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub enum UnstableFeatures { + /// Hard errors for unstable features are active, as on + /// beta/stable channels. + Disallow, + /// Allow features to be activated, as on nightly. + Allow, + /// Errors are bypassed for bootstrapping. This is required any time + /// during the build that feature-related lints are set to warn or above + /// because the build turns on warnings-as-errors and uses lots of unstable + /// features. As a result, this is always required for building Rust itself. + Cheat +} + +impl UnstableFeatures { + pub fn from_environment() -> UnstableFeatures { + // Whether this is a feature-staged build, i.e. on the beta or stable channel + let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some(); + // Whether we should enable unstable features for bootstrapping + let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok(); + match (disable_unstable_features, bootstrap) { + (_, true) => UnstableFeatures::Cheat, + (true, _) => UnstableFeatures::Disallow, + (false, _) => UnstableFeatures::Allow + } + } + + pub fn is_nightly_build(&self) -> bool { + match *self { + UnstableFeatures::Allow | UnstableFeatures::Cheat => true, + _ => false, + } + } +} + +fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate, + unstable: UnstableFeatures) { + let allow_features = match unstable { + UnstableFeatures::Allow => true, + UnstableFeatures::Disallow => false, + UnstableFeatures::Cheat => true + }; + if !allow_features { + for attr in &krate.attrs { + if attr.check_name("feature") { + let release_channel = option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)"); + span_err!(span_handler, attr.span, E0554, + "#[feature] may not be used on the {} release channel", + release_channel); + } + } + } +} diff --git a/third_party/rust/syntex_syntax/src/fold.rs b/third_party/rust/syntex_syntax/src/fold.rs new file mode 100644 index 000000000000..9797e0003fc5 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/fold.rs @@ -0,0 +1,1399 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A Folder represents an AST->AST fold; it accepts an AST piece, +//! and returns a piece of the same type. So, for instance, macro +//! expansion is a Folder that walks over an AST and produces another +//! AST. +//! +//! Note: using a Folder (other than the MacroExpander Folder) on +//! an AST before macro expansion is probably a bad idea. For instance, +//! a folder renaming item names in a module will miss all of those +//! that are created by the expansion of a macro. + +use ast::*; +use ast; +use syntax_pos::Span; +use codemap::{Spanned, respan}; +use parse::token; +use ptr::P; +use symbol::keywords; +use tokenstream::*; +use util::small_vector::SmallVector; +use util::move_map::MoveMap; + +use std::rc::Rc; + +pub trait Folder : Sized { + // Any additions to this trait should happen in form + // of a call to a public `noop_*` function that only calls + // out to the folder again, not other `noop_*` functions. + // + // This is a necessary API workaround to the problem of not + // being able to call out to the super default method + // in an overridden default method. + + fn fold_crate(&mut self, c: Crate) -> Crate { + noop_fold_crate(c, self) + } + + fn fold_meta_items(&mut self, meta_items: Vec) -> Vec { + noop_fold_meta_items(meta_items, self) + } + + fn fold_meta_list_item(&mut self, list_item: NestedMetaItem) -> NestedMetaItem { + noop_fold_meta_list_item(list_item, self) + } + + fn fold_meta_item(&mut self, meta_item: MetaItem) -> MetaItem { + noop_fold_meta_item(meta_item, self) + } + + fn fold_view_path(&mut self, view_path: P) -> P { + noop_fold_view_path(view_path, self) + } + + fn fold_foreign_item(&mut self, ni: ForeignItem) -> ForeignItem { + noop_fold_foreign_item(ni, self) + } + + fn fold_item(&mut self, i: P) -> SmallVector> { + noop_fold_item(i, self) + } + + fn fold_item_simple(&mut self, i: Item) -> Item { + noop_fold_item_simple(i, self) + } + + fn fold_struct_field(&mut self, sf: StructField) -> StructField { + noop_fold_struct_field(sf, self) + } + + fn fold_item_kind(&mut self, i: ItemKind) -> ItemKind { + noop_fold_item_kind(i, self) + } + + fn fold_trait_item(&mut self, i: TraitItem) -> SmallVector { + noop_fold_trait_item(i, self) + } + + fn fold_impl_item(&mut self, i: ImplItem) -> SmallVector { + noop_fold_impl_item(i, self) + } + + fn fold_fn_decl(&mut self, d: P) -> P { + noop_fold_fn_decl(d, self) + } + + fn fold_block(&mut self, b: P) -> P { + noop_fold_block(b, self) + } + + fn fold_stmt(&mut self, s: Stmt) -> SmallVector { + noop_fold_stmt(s, self) + } + + fn fold_arm(&mut self, a: Arm) -> Arm { + noop_fold_arm(a, self) + } + + fn fold_pat(&mut self, p: P) -> P { + noop_fold_pat(p, self) + } + + fn fold_expr(&mut self, e: P) -> P { + e.map(|e| noop_fold_expr(e, self)) + } + + fn fold_opt_expr(&mut self, e: P) -> Option> { + noop_fold_opt_expr(e, self) + } + + fn fold_exprs(&mut self, es: Vec>) -> Vec> { + noop_fold_exprs(es, self) + } + + fn fold_ty(&mut self, t: P) -> P { + noop_fold_ty(t, self) + } + + fn fold_ty_binding(&mut self, t: TypeBinding) -> TypeBinding { + noop_fold_ty_binding(t, self) + } + + fn fold_mod(&mut self, m: Mod) -> Mod { + noop_fold_mod(m, self) + } + + fn fold_foreign_mod(&mut self, nm: ForeignMod) -> ForeignMod { + noop_fold_foreign_mod(nm, self) + } + + fn fold_variant(&mut self, v: Variant) -> Variant { + noop_fold_variant(v, self) + } + + fn fold_ident(&mut self, i: Ident) -> Ident { + noop_fold_ident(i, self) + } + + fn fold_usize(&mut self, i: usize) -> usize { + noop_fold_usize(i, self) + } + + fn fold_path(&mut self, p: Path) -> Path { + noop_fold_path(p, self) + } + + fn fold_path_parameters(&mut self, p: PathParameters) -> PathParameters { + noop_fold_path_parameters(p, self) + } + + fn fold_angle_bracketed_parameter_data(&mut self, p: AngleBracketedParameterData) + -> AngleBracketedParameterData + { + noop_fold_angle_bracketed_parameter_data(p, self) + } + + fn fold_parenthesized_parameter_data(&mut self, p: ParenthesizedParameterData) + -> ParenthesizedParameterData + { + noop_fold_parenthesized_parameter_data(p, self) + } + + fn fold_local(&mut self, l: P) -> P { + noop_fold_local(l, self) + } + + fn fold_mac(&mut self, _mac: Mac) -> Mac { + panic!("fold_mac disabled by default"); + // NB: see note about macros above. + // if you really want a folder that + // works on macros, use this + // definition in your trait impl: + // fold::noop_fold_mac(_mac, self) + } + + fn fold_lifetime(&mut self, l: Lifetime) -> Lifetime { + noop_fold_lifetime(l, self) + } + + fn fold_lifetime_def(&mut self, l: LifetimeDef) -> LifetimeDef { + noop_fold_lifetime_def(l, self) + } + + fn fold_attribute(&mut self, at: Attribute) -> Option { + noop_fold_attribute(at, self) + } + + fn fold_arg(&mut self, a: Arg) -> Arg { + noop_fold_arg(a, self) + } + + fn fold_generics(&mut self, generics: Generics) -> Generics { + noop_fold_generics(generics, self) + } + + fn fold_trait_ref(&mut self, p: TraitRef) -> TraitRef { + noop_fold_trait_ref(p, self) + } + + fn fold_poly_trait_ref(&mut self, p: PolyTraitRef) -> PolyTraitRef { + noop_fold_poly_trait_ref(p, self) + } + + fn fold_variant_data(&mut self, vdata: VariantData) -> VariantData { + noop_fold_variant_data(vdata, self) + } + + fn fold_lifetimes(&mut self, lts: Vec) -> Vec { + noop_fold_lifetimes(lts, self) + } + + fn fold_lifetime_defs(&mut self, lts: Vec) -> Vec { + noop_fold_lifetime_defs(lts, self) + } + + fn fold_ty_param(&mut self, tp: TyParam) -> TyParam { + noop_fold_ty_param(tp, self) + } + + fn fold_ty_params(&mut self, tps: P<[TyParam]>) -> P<[TyParam]> { + noop_fold_ty_params(tps, self) + } + + fn fold_tt(&mut self, tt: &TokenTree) -> TokenTree { + noop_fold_tt(tt, self) + } + + fn fold_tts(&mut self, tts: &[TokenTree]) -> Vec { + noop_fold_tts(tts, self) + } + + fn fold_token(&mut self, t: token::Token) -> token::Token { + noop_fold_token(t, self) + } + + fn fold_interpolated(&mut self, nt: token::Nonterminal) -> token::Nonterminal { + noop_fold_interpolated(nt, self) + } + + fn fold_opt_lifetime(&mut self, o_lt: Option) -> Option { + noop_fold_opt_lifetime(o_lt, self) + } + + fn fold_opt_bounds(&mut self, b: Option) + -> Option { + noop_fold_opt_bounds(b, self) + } + + fn fold_bounds(&mut self, b: TyParamBounds) + -> TyParamBounds { + noop_fold_bounds(b, self) + } + + fn fold_ty_param_bound(&mut self, tpb: TyParamBound) -> TyParamBound { + noop_fold_ty_param_bound(tpb, self) + } + + fn fold_mt(&mut self, mt: MutTy) -> MutTy { + noop_fold_mt(mt, self) + } + + fn fold_field(&mut self, field: Field) -> Field { + noop_fold_field(field, self) + } + + fn fold_where_clause(&mut self, where_clause: WhereClause) + -> WhereClause { + noop_fold_where_clause(where_clause, self) + } + + fn fold_where_predicate(&mut self, where_predicate: WherePredicate) + -> WherePredicate { + noop_fold_where_predicate(where_predicate, self) + } + + fn fold_vis(&mut self, vis: Visibility) -> Visibility { + noop_fold_vis(vis, self) + } + + fn new_id(&mut self, i: NodeId) -> NodeId { + i + } + + fn new_span(&mut self, sp: Span) -> Span { + sp + } +} + +pub fn noop_fold_meta_items(meta_items: Vec, fld: &mut T) -> Vec { + meta_items.move_map(|x| fld.fold_meta_item(x)) +} + +pub fn noop_fold_view_path(view_path: P, fld: &mut T) -> P { + view_path.map(|Spanned {node, span}| Spanned { + node: match node { + ViewPathSimple(ident, path) => { + ViewPathSimple(fld.fold_ident(ident), fld.fold_path(path)) + } + ViewPathGlob(path) => { + ViewPathGlob(fld.fold_path(path)) + } + ViewPathList(path, path_list_idents) => { + let path = fld.fold_path(path); + let path_list_idents = path_list_idents.move_map(|path_list_ident| Spanned { + node: PathListItem_ { + id: fld.new_id(path_list_ident.node.id), + rename: path_list_ident.node.rename.map(|ident| fld.fold_ident(ident)), + name: fld.fold_ident(path_list_ident.node.name), + }, + span: fld.new_span(path_list_ident.span) + }); + ViewPathList(path, path_list_idents) + } + }, + span: fld.new_span(span) + }) +} + +pub fn fold_attrs(attrs: Vec, fld: &mut T) -> Vec { + attrs.move_flat_map(|x| fld.fold_attribute(x)) +} + +pub fn fold_thin_attrs(attrs: ThinVec, fld: &mut T) -> ThinVec { + fold_attrs(attrs.into(), fld).into() +} + +pub fn noop_fold_arm(Arm {attrs, pats, guard, body}: Arm, fld: &mut T) -> Arm { + Arm { + attrs: fold_attrs(attrs, fld), + pats: pats.move_map(|x| fld.fold_pat(x)), + guard: guard.map(|x| fld.fold_expr(x)), + body: fld.fold_expr(body), + } +} + +pub fn noop_fold_ty_binding(b: TypeBinding, fld: &mut T) -> TypeBinding { + TypeBinding { + id: fld.new_id(b.id), + ident: fld.fold_ident(b.ident), + ty: fld.fold_ty(b.ty), + span: fld.new_span(b.span), + } +} + +pub fn noop_fold_ty(t: P, fld: &mut T) -> P { + t.map(|Ty {id, node, span}| Ty { + id: fld.new_id(id), + node: match node { + TyKind::Infer | TyKind::ImplicitSelf => node, + TyKind::Slice(ty) => TyKind::Slice(fld.fold_ty(ty)), + TyKind::Ptr(mt) => TyKind::Ptr(fld.fold_mt(mt)), + TyKind::Rptr(region, mt) => { + TyKind::Rptr(fld.fold_opt_lifetime(region), fld.fold_mt(mt)) + } + TyKind::BareFn(f) => { + TyKind::BareFn(f.map(|BareFnTy {lifetimes, unsafety, abi, decl}| BareFnTy { + lifetimes: fld.fold_lifetime_defs(lifetimes), + unsafety: unsafety, + abi: abi, + decl: fld.fold_fn_decl(decl) + })) + } + TyKind::Never => node, + TyKind::Tup(tys) => TyKind::Tup(tys.move_map(|ty| fld.fold_ty(ty))), + TyKind::Paren(ty) => TyKind::Paren(fld.fold_ty(ty)), + TyKind::Path(qself, path) => { + let qself = qself.map(|QSelf { ty, position }| { + QSelf { + ty: fld.fold_ty(ty), + position: position + } + }); + TyKind::Path(qself, fld.fold_path(path)) + } + TyKind::ObjectSum(ty, bounds) => { + TyKind::ObjectSum(fld.fold_ty(ty), + fld.fold_bounds(bounds)) + } + TyKind::Array(ty, e) => { + TyKind::Array(fld.fold_ty(ty), fld.fold_expr(e)) + } + TyKind::Typeof(expr) => { + TyKind::Typeof(fld.fold_expr(expr)) + } + TyKind::PolyTraitRef(bounds) => { + TyKind::PolyTraitRef(bounds.move_map(|b| fld.fold_ty_param_bound(b))) + } + TyKind::ImplTrait(bounds) => { + TyKind::ImplTrait(bounds.move_map(|b| fld.fold_ty_param_bound(b))) + } + TyKind::Mac(mac) => { + TyKind::Mac(fld.fold_mac(mac)) + } + }, + span: fld.new_span(span) + }) +} + +pub fn noop_fold_foreign_mod(ForeignMod {abi, items}: ForeignMod, + fld: &mut T) -> ForeignMod { + ForeignMod { + abi: abi, + items: items.move_map(|x| fld.fold_foreign_item(x)), + } +} + +pub fn noop_fold_variant(v: Variant, fld: &mut T) -> Variant { + Spanned { + node: Variant_ { + name: v.node.name, + attrs: fold_attrs(v.node.attrs, fld), + data: fld.fold_variant_data(v.node.data), + disr_expr: v.node.disr_expr.map(|e| fld.fold_expr(e)), + }, + span: fld.new_span(v.span), + } +} + +pub fn noop_fold_ident(i: Ident, _: &mut T) -> Ident { + i +} + +pub fn noop_fold_usize(i: usize, _: &mut T) -> usize { + i +} + +pub fn noop_fold_path(Path { segments, span }: Path, fld: &mut T) -> Path { + Path { + segments: segments.move_map(|PathSegment {identifier, parameters}| PathSegment { + identifier: fld.fold_ident(identifier), + parameters: parameters.map(|ps| ps.map(|ps| fld.fold_path_parameters(ps))), + }), + span: fld.new_span(span) + } +} + +pub fn noop_fold_path_parameters(path_parameters: PathParameters, fld: &mut T) + -> PathParameters +{ + match path_parameters { + PathParameters::AngleBracketed(data) => + PathParameters::AngleBracketed(fld.fold_angle_bracketed_parameter_data(data)), + PathParameters::Parenthesized(data) => + PathParameters::Parenthesized(fld.fold_parenthesized_parameter_data(data)), + } +} + +pub fn noop_fold_angle_bracketed_parameter_data(data: AngleBracketedParameterData, + fld: &mut T) + -> AngleBracketedParameterData +{ + let AngleBracketedParameterData { lifetimes, types, bindings } = data; + AngleBracketedParameterData { lifetimes: fld.fold_lifetimes(lifetimes), + types: types.move_map(|ty| fld.fold_ty(ty)), + bindings: bindings.move_map(|b| fld.fold_ty_binding(b)) } +} + +pub fn noop_fold_parenthesized_parameter_data(data: ParenthesizedParameterData, + fld: &mut T) + -> ParenthesizedParameterData +{ + let ParenthesizedParameterData { inputs, output, span } = data; + ParenthesizedParameterData { inputs: inputs.move_map(|ty| fld.fold_ty(ty)), + output: output.map(|ty| fld.fold_ty(ty)), + span: fld.new_span(span) } +} + +pub fn noop_fold_local(l: P, fld: &mut T) -> P { + l.map(|Local {id, pat, ty, init, span, attrs}| Local { + id: fld.new_id(id), + pat: fld.fold_pat(pat), + ty: ty.map(|t| fld.fold_ty(t)), + init: init.map(|e| fld.fold_expr(e)), + span: fld.new_span(span), + attrs: fold_attrs(attrs.into(), fld).into(), + }) +} + +pub fn noop_fold_attribute(attr: Attribute, fld: &mut T) -> Option { + Some(Attribute { + id: attr.id, + style: attr.style, + value: fld.fold_meta_item(attr.value), + is_sugared_doc: attr.is_sugared_doc, + span: fld.new_span(attr.span), + }) +} + +pub fn noop_fold_mac(Spanned {node, span}: Mac, fld: &mut T) -> Mac { + Spanned { + node: Mac_ { + path: fld.fold_path(node.path), + tts: fld.fold_tts(&node.tts), + }, + span: fld.new_span(span) + } +} + +pub fn noop_fold_meta_list_item(li: NestedMetaItem, fld: &mut T) + -> NestedMetaItem { + Spanned { + node: match li.node { + NestedMetaItemKind::MetaItem(mi) => { + NestedMetaItemKind::MetaItem(fld.fold_meta_item(mi)) + }, + NestedMetaItemKind::Literal(lit) => NestedMetaItemKind::Literal(lit) + }, + span: fld.new_span(li.span) + } +} + +pub fn noop_fold_meta_item(mi: MetaItem, fld: &mut T) -> MetaItem { + MetaItem { + name: mi.name, + node: match mi.node { + MetaItemKind::Word => MetaItemKind::Word, + MetaItemKind::List(mis) => { + MetaItemKind::List(mis.move_map(|e| fld.fold_meta_list_item(e))) + }, + MetaItemKind::NameValue(s) => MetaItemKind::NameValue(s), + }, + span: fld.new_span(mi.span) + } +} + +pub fn noop_fold_arg(Arg {id, pat, ty}: Arg, fld: &mut T) -> Arg { + Arg { + id: fld.new_id(id), + pat: fld.fold_pat(pat), + ty: fld.fold_ty(ty) + } +} + +pub fn noop_fold_tt(tt: &TokenTree, fld: &mut T) -> TokenTree { + match *tt { + TokenTree::Token(span, ref tok) => + TokenTree::Token(span, fld.fold_token(tok.clone())), + TokenTree::Delimited(span, ref delimed) => { + TokenTree::Delimited(span, Rc::new( + Delimited { + delim: delimed.delim, + open_span: delimed.open_span, + tts: fld.fold_tts(&delimed.tts), + close_span: delimed.close_span, + } + )) + }, + TokenTree::Sequence(span, ref seq) => + TokenTree::Sequence(span, + Rc::new(SequenceRepetition { + tts: fld.fold_tts(&seq.tts), + separator: seq.separator.clone().map(|tok| fld.fold_token(tok)), + ..**seq + })), + } +} + +pub fn noop_fold_tts(tts: &[TokenTree], fld: &mut T) -> Vec { + tts.iter().map(|tt| fld.fold_tt(tt)).collect() +} + +// apply ident folder if it's an ident, apply other folds to interpolated nodes +pub fn noop_fold_token(t: token::Token, fld: &mut T) -> token::Token { + match t { + token::Ident(id) => token::Ident(fld.fold_ident(id)), + token::Lifetime(id) => token::Lifetime(fld.fold_ident(id)), + token::Interpolated(nt) => { + let nt = match Rc::try_unwrap(nt) { + Ok(nt) => nt, + Err(nt) => (*nt).clone(), + }; + token::Interpolated(Rc::new(fld.fold_interpolated(nt))) + } + token::SubstNt(ident) => token::SubstNt(fld.fold_ident(ident)), + token::MatchNt(name, kind) => token::MatchNt(fld.fold_ident(name), fld.fold_ident(kind)), + _ => t + } +} + +/// apply folder to elements of interpolated nodes +// +// NB: this can occur only when applying a fold to partially expanded code, where +// parsed pieces have gotten implanted ito *other* macro invocations. This is relevant +// for macro hygiene, but possibly not elsewhere. +// +// One problem here occurs because the types for fold_item, fold_stmt, etc. allow the +// folder to return *multiple* items; this is a problem for the nodes here, because +// they insist on having exactly one piece. One solution would be to mangle the fold +// trait to include one-to-many and one-to-one versions of these entry points, but that +// would probably confuse a lot of people and help very few. Instead, I'm just going +// to put in dynamic checks. I think the performance impact of this will be pretty much +// nonexistent. The danger is that someone will apply a fold to a partially expanded +// node, and will be confused by the fact that their "fold_item" or "fold_stmt" isn't +// getting called on NtItem or NtStmt nodes. Hopefully they'll wind up reading this +// comment, and doing something appropriate. +// +// BTW, design choice: I considered just changing the type of, e.g., NtItem to contain +// multiple items, but decided against it when I looked at parse_item_or_view_item and +// tried to figure out what I would do with multiple items there.... +pub fn noop_fold_interpolated(nt: token::Nonterminal, fld: &mut T) + -> token::Nonterminal { + match nt { + token::NtItem(item) => + token::NtItem(fld.fold_item(item) + // this is probably okay, because the only folds likely + // to peek inside interpolated nodes will be renamings/markings, + // which map single items to single items + .expect_one("expected fold to produce exactly one item")), + token::NtBlock(block) => token::NtBlock(fld.fold_block(block)), + token::NtStmt(stmt) => + token::NtStmt(fld.fold_stmt(stmt) + // this is probably okay, because the only folds likely + // to peek inside interpolated nodes will be renamings/markings, + // which map single items to single items + .expect_one("expected fold to produce exactly one statement")), + token::NtPat(pat) => token::NtPat(fld.fold_pat(pat)), + token::NtExpr(expr) => token::NtExpr(fld.fold_expr(expr)), + token::NtTy(ty) => token::NtTy(fld.fold_ty(ty)), + token::NtIdent(id) => token::NtIdent(Spanned::{node: fld.fold_ident(id.node), ..id}), + token::NtMeta(meta_item) => token::NtMeta(fld.fold_meta_item(meta_item)), + token::NtPath(path) => token::NtPath(fld.fold_path(path)), + token::NtTT(tt) => token::NtTT(fld.fold_tt(&tt)), + token::NtArm(arm) => token::NtArm(fld.fold_arm(arm)), + token::NtImplItem(item) => + token::NtImplItem(fld.fold_impl_item(item) + .expect_one("expected fold to produce exactly one item")), + token::NtTraitItem(item) => + token::NtTraitItem(fld.fold_trait_item(item) + .expect_one("expected fold to produce exactly one item")), + token::NtGenerics(generics) => token::NtGenerics(fld.fold_generics(generics)), + token::NtWhereClause(where_clause) => + token::NtWhereClause(fld.fold_where_clause(where_clause)), + token::NtArg(arg) => token::NtArg(fld.fold_arg(arg)), + } +} + +pub fn noop_fold_fn_decl(decl: P, fld: &mut T) -> P { + decl.map(|FnDecl {inputs, output, variadic}| FnDecl { + inputs: inputs.move_map(|x| fld.fold_arg(x)), + output: match output { + FunctionRetTy::Ty(ty) => FunctionRetTy::Ty(fld.fold_ty(ty)), + FunctionRetTy::Default(span) => FunctionRetTy::Default(span), + }, + variadic: variadic + }) +} + +pub fn noop_fold_ty_param_bound(tpb: TyParamBound, fld: &mut T) + -> TyParamBound + where T: Folder { + match tpb { + TraitTyParamBound(ty, modifier) => TraitTyParamBound(fld.fold_poly_trait_ref(ty), modifier), + RegionTyParamBound(lifetime) => RegionTyParamBound(fld.fold_lifetime(lifetime)), + } +} + +pub fn noop_fold_ty_param(tp: TyParam, fld: &mut T) -> TyParam { + let TyParam {attrs, id, ident, bounds, default, span} = tp; + let attrs: Vec<_> = attrs.into(); + TyParam { + attrs: attrs.into_iter() + .flat_map(|x| fld.fold_attribute(x).into_iter()) + .collect::>() + .into(), + id: fld.new_id(id), + ident: fld.fold_ident(ident), + bounds: fld.fold_bounds(bounds), + default: default.map(|x| fld.fold_ty(x)), + span: span + } +} + +pub fn noop_fold_ty_params(tps: P<[TyParam]>, fld: &mut T) + -> P<[TyParam]> { + tps.move_map(|tp| fld.fold_ty_param(tp)) +} + +pub fn noop_fold_lifetime(l: Lifetime, fld: &mut T) -> Lifetime { + Lifetime { + id: fld.new_id(l.id), + name: l.name, + span: fld.new_span(l.span) + } +} + +pub fn noop_fold_lifetime_def(l: LifetimeDef, fld: &mut T) + -> LifetimeDef { + let attrs: Vec<_> = l.attrs.into(); + LifetimeDef { + attrs: attrs.into_iter() + .flat_map(|x| fld.fold_attribute(x).into_iter()) + .collect::>() + .into(), + lifetime: fld.fold_lifetime(l.lifetime), + bounds: fld.fold_lifetimes(l.bounds), + } +} + +pub fn noop_fold_lifetimes(lts: Vec, fld: &mut T) -> Vec { + lts.move_map(|l| fld.fold_lifetime(l)) +} + +pub fn noop_fold_lifetime_defs(lts: Vec, fld: &mut T) + -> Vec { + lts.move_map(|l| fld.fold_lifetime_def(l)) +} + +pub fn noop_fold_opt_lifetime(o_lt: Option, fld: &mut T) + -> Option { + o_lt.map(|lt| fld.fold_lifetime(lt)) +} + +pub fn noop_fold_generics(Generics {ty_params, lifetimes, where_clause, span}: Generics, + fld: &mut T) -> Generics { + Generics { + ty_params: fld.fold_ty_params(ty_params), + lifetimes: fld.fold_lifetime_defs(lifetimes), + where_clause: fld.fold_where_clause(where_clause), + span: fld.new_span(span), + } +} + +pub fn noop_fold_where_clause( + WhereClause {id, predicates}: WhereClause, + fld: &mut T) + -> WhereClause { + WhereClause { + id: fld.new_id(id), + predicates: predicates.move_map(|predicate| { + fld.fold_where_predicate(predicate) + }) + } +} + +pub fn noop_fold_where_predicate( + pred: WherePredicate, + fld: &mut T) + -> WherePredicate { + match pred { + ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{bound_lifetimes, + bounded_ty, + bounds, + span}) => { + ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate { + bound_lifetimes: fld.fold_lifetime_defs(bound_lifetimes), + bounded_ty: fld.fold_ty(bounded_ty), + bounds: bounds.move_map(|x| fld.fold_ty_param_bound(x)), + span: fld.new_span(span) + }) + } + ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{lifetime, + bounds, + span}) => { + ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate { + span: fld.new_span(span), + lifetime: fld.fold_lifetime(lifetime), + bounds: bounds.move_map(|bound| fld.fold_lifetime(bound)) + }) + } + ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{id, + path, + ty, + span}) => { + ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ + id: fld.new_id(id), + path: fld.fold_path(path), + ty:fld.fold_ty(ty), + span: fld.new_span(span) + }) + } + } +} + +pub fn noop_fold_variant_data(vdata: VariantData, fld: &mut T) -> VariantData { + match vdata { + ast::VariantData::Struct(fields, id) => { + ast::VariantData::Struct(fields.move_map(|f| fld.fold_struct_field(f)), + fld.new_id(id)) + } + ast::VariantData::Tuple(fields, id) => { + ast::VariantData::Tuple(fields.move_map(|f| fld.fold_struct_field(f)), + fld.new_id(id)) + } + ast::VariantData::Unit(id) => ast::VariantData::Unit(fld.new_id(id)) + } +} + +pub fn noop_fold_trait_ref(p: TraitRef, fld: &mut T) -> TraitRef { + let id = fld.new_id(p.ref_id); + let TraitRef { + path, + ref_id: _, + } = p; + ast::TraitRef { + path: fld.fold_path(path), + ref_id: id, + } +} + +pub fn noop_fold_poly_trait_ref(p: PolyTraitRef, fld: &mut T) -> PolyTraitRef { + ast::PolyTraitRef { + bound_lifetimes: fld.fold_lifetime_defs(p.bound_lifetimes), + trait_ref: fld.fold_trait_ref(p.trait_ref), + span: fld.new_span(p.span), + } +} + +pub fn noop_fold_struct_field(f: StructField, fld: &mut T) -> StructField { + StructField { + span: fld.new_span(f.span), + id: fld.new_id(f.id), + ident: f.ident.map(|ident| fld.fold_ident(ident)), + vis: fld.fold_vis(f.vis), + ty: fld.fold_ty(f.ty), + attrs: fold_attrs(f.attrs, fld), + } +} + +pub fn noop_fold_field(f: Field, folder: &mut T) -> Field { + Field { + ident: respan(f.ident.span, folder.fold_ident(f.ident.node)), + expr: folder.fold_expr(f.expr), + span: folder.new_span(f.span), + is_shorthand: f.is_shorthand, + } +} + +pub fn noop_fold_mt(MutTy {ty, mutbl}: MutTy, folder: &mut T) -> MutTy { + MutTy { + ty: folder.fold_ty(ty), + mutbl: mutbl, + } +} + +pub fn noop_fold_opt_bounds(b: Option, folder: &mut T) + -> Option { + b.map(|bounds| folder.fold_bounds(bounds)) +} + +fn noop_fold_bounds(bounds: TyParamBounds, folder: &mut T) + -> TyParamBounds { + bounds.move_map(|bound| folder.fold_ty_param_bound(bound)) +} + +pub fn noop_fold_block(b: P, folder: &mut T) -> P { + b.map(|Block {id, stmts, rules, span}| Block { + id: folder.new_id(id), + stmts: stmts.move_flat_map(|s| folder.fold_stmt(s).into_iter()), + rules: rules, + span: folder.new_span(span), + }) +} + +pub fn noop_fold_item_kind(i: ItemKind, folder: &mut T) -> ItemKind { + match i { + ItemKind::ExternCrate(string) => ItemKind::ExternCrate(string), + ItemKind::Use(view_path) => { + ItemKind::Use(folder.fold_view_path(view_path)) + } + ItemKind::Static(t, m, e) => { + ItemKind::Static(folder.fold_ty(t), m, folder.fold_expr(e)) + } + ItemKind::Const(t, e) => { + ItemKind::Const(folder.fold_ty(t), folder.fold_expr(e)) + } + ItemKind::Fn(decl, unsafety, constness, abi, generics, body) => { + let generics = folder.fold_generics(generics); + let decl = folder.fold_fn_decl(decl); + let body = folder.fold_block(body); + ItemKind::Fn(decl, unsafety, constness, abi, generics, body) + } + ItemKind::Mod(m) => ItemKind::Mod(folder.fold_mod(m)), + ItemKind::ForeignMod(nm) => ItemKind::ForeignMod(folder.fold_foreign_mod(nm)), + ItemKind::Ty(t, generics) => { + ItemKind::Ty(folder.fold_ty(t), folder.fold_generics(generics)) + } + ItemKind::Enum(enum_definition, generics) => { + let generics = folder.fold_generics(generics); + let variants = enum_definition.variants.move_map(|x| folder.fold_variant(x)); + ItemKind::Enum(ast::EnumDef { variants: variants }, generics) + } + ItemKind::Struct(struct_def, generics) => { + let generics = folder.fold_generics(generics); + ItemKind::Struct(folder.fold_variant_data(struct_def), generics) + } + ItemKind::Union(struct_def, generics) => { + let generics = folder.fold_generics(generics); + ItemKind::Union(folder.fold_variant_data(struct_def), generics) + } + ItemKind::DefaultImpl(unsafety, ref trait_ref) => { + ItemKind::DefaultImpl(unsafety, folder.fold_trait_ref((*trait_ref).clone())) + } + ItemKind::Impl(unsafety, polarity, generics, ifce, ty, impl_items) => ItemKind::Impl( + unsafety, + polarity, + folder.fold_generics(generics), + ifce.map(|trait_ref| folder.fold_trait_ref(trait_ref.clone())), + folder.fold_ty(ty), + impl_items.move_flat_map(|item| folder.fold_impl_item(item)), + ), + ItemKind::Trait(unsafety, generics, bounds, items) => ItemKind::Trait( + unsafety, + folder.fold_generics(generics), + folder.fold_bounds(bounds), + items.move_flat_map(|item| folder.fold_trait_item(item)), + ), + ItemKind::Mac(m) => ItemKind::Mac(folder.fold_mac(m)), + } +} + +pub fn noop_fold_trait_item(i: TraitItem, folder: &mut T) + -> SmallVector { + SmallVector::one(TraitItem { + id: folder.new_id(i.id), + ident: folder.fold_ident(i.ident), + attrs: fold_attrs(i.attrs, folder), + node: match i.node { + TraitItemKind::Const(ty, default) => { + TraitItemKind::Const(folder.fold_ty(ty), + default.map(|x| folder.fold_expr(x))) + } + TraitItemKind::Method(sig, body) => { + TraitItemKind::Method(noop_fold_method_sig(sig, folder), + body.map(|x| folder.fold_block(x))) + } + TraitItemKind::Type(bounds, default) => { + TraitItemKind::Type(folder.fold_bounds(bounds), + default.map(|x| folder.fold_ty(x))) + } + ast::TraitItemKind::Macro(mac) => { + TraitItemKind::Macro(folder.fold_mac(mac)) + } + }, + span: folder.new_span(i.span) + }) +} + +pub fn noop_fold_impl_item(i: ImplItem, folder: &mut T) + -> SmallVector { + SmallVector::one(ImplItem { + id: folder.new_id(i.id), + vis: folder.fold_vis(i.vis), + ident: folder.fold_ident(i.ident), + attrs: fold_attrs(i.attrs, folder), + defaultness: i.defaultness, + node: match i.node { + ast::ImplItemKind::Const(ty, expr) => { + ast::ImplItemKind::Const(folder.fold_ty(ty), folder.fold_expr(expr)) + } + ast::ImplItemKind::Method(sig, body) => { + ast::ImplItemKind::Method(noop_fold_method_sig(sig, folder), + folder.fold_block(body)) + } + ast::ImplItemKind::Type(ty) => ast::ImplItemKind::Type(folder.fold_ty(ty)), + ast::ImplItemKind::Macro(mac) => ast::ImplItemKind::Macro(folder.fold_mac(mac)) + }, + span: folder.new_span(i.span) + }) +} + +pub fn noop_fold_mod(Mod {inner, items}: Mod, folder: &mut T) -> Mod { + Mod { + inner: folder.new_span(inner), + items: items.move_flat_map(|x| folder.fold_item(x)), + } +} + +pub fn noop_fold_crate(Crate {module, attrs, mut exported_macros, span}: Crate, + folder: &mut T) -> Crate { + let mut items = folder.fold_item(P(ast::Item { + ident: keywords::Invalid.ident(), + attrs: attrs, + id: ast::DUMMY_NODE_ID, + vis: ast::Visibility::Public, + span: span, + node: ast::ItemKind::Mod(module), + })).into_iter(); + + let (module, attrs, span) = match items.next() { + Some(item) => { + assert!(items.next().is_none(), + "a crate cannot expand to more than one item"); + item.and_then(|ast::Item { attrs, span, node, .. }| { + match node { + ast::ItemKind::Mod(m) => (m, attrs, span), + _ => panic!("fold converted a module to not a module"), + } + }) + } + None => (ast::Mod { + inner: span, + items: vec![], + }, vec![], span) + }; + + for def in &mut exported_macros { + def.id = folder.new_id(def.id); + } + + Crate { + module: module, + attrs: attrs, + exported_macros: exported_macros, + span: span, + } +} + +// fold one item into possibly many items +pub fn noop_fold_item(i: P, folder: &mut T) -> SmallVector> { + SmallVector::one(i.map(|i| folder.fold_item_simple(i))) +} + +// fold one item into exactly one item +pub fn noop_fold_item_simple(Item {id, ident, attrs, node, vis, span}: Item, + folder: &mut T) -> Item { + Item { + id: folder.new_id(id), + vis: folder.fold_vis(vis), + ident: folder.fold_ident(ident), + attrs: fold_attrs(attrs, folder), + node: folder.fold_item_kind(node), + span: folder.new_span(span) + } +} + +pub fn noop_fold_foreign_item(ni: ForeignItem, folder: &mut T) -> ForeignItem { + ForeignItem { + id: folder.new_id(ni.id), + vis: folder.fold_vis(ni.vis), + ident: folder.fold_ident(ni.ident), + attrs: fold_attrs(ni.attrs, folder), + node: match ni.node { + ForeignItemKind::Fn(fdec, generics) => { + ForeignItemKind::Fn(folder.fold_fn_decl(fdec), folder.fold_generics(generics)) + } + ForeignItemKind::Static(t, m) => { + ForeignItemKind::Static(folder.fold_ty(t), m) + } + }, + span: folder.new_span(ni.span) + } +} + +pub fn noop_fold_method_sig(sig: MethodSig, folder: &mut T) -> MethodSig { + MethodSig { + generics: folder.fold_generics(sig.generics), + abi: sig.abi, + unsafety: sig.unsafety, + constness: sig.constness, + decl: folder.fold_fn_decl(sig.decl) + } +} + +pub fn noop_fold_pat(p: P, folder: &mut T) -> P { + p.map(|Pat {id, node, span}| Pat { + id: folder.new_id(id), + node: match node { + PatKind::Wild => PatKind::Wild, + PatKind::Ident(binding_mode, pth1, sub) => { + PatKind::Ident(binding_mode, + Spanned{span: folder.new_span(pth1.span), + node: folder.fold_ident(pth1.node)}, + sub.map(|x| folder.fold_pat(x))) + } + PatKind::Lit(e) => PatKind::Lit(folder.fold_expr(e)), + PatKind::TupleStruct(pth, pats, ddpos) => { + PatKind::TupleStruct(folder.fold_path(pth), + pats.move_map(|x| folder.fold_pat(x)), ddpos) + } + PatKind::Path(opt_qself, pth) => { + let opt_qself = opt_qself.map(|qself| { + QSelf { ty: folder.fold_ty(qself.ty), position: qself.position } + }); + PatKind::Path(opt_qself, folder.fold_path(pth)) + } + PatKind::Struct(pth, fields, etc) => { + let pth = folder.fold_path(pth); + let fs = fields.move_map(|f| { + Spanned { span: folder.new_span(f.span), + node: ast::FieldPat { + ident: folder.fold_ident(f.node.ident), + pat: folder.fold_pat(f.node.pat), + is_shorthand: f.node.is_shorthand, + }} + }); + PatKind::Struct(pth, fs, etc) + } + PatKind::Tuple(elts, ddpos) => { + PatKind::Tuple(elts.move_map(|x| folder.fold_pat(x)), ddpos) + } + PatKind::Box(inner) => PatKind::Box(folder.fold_pat(inner)), + PatKind::Ref(inner, mutbl) => PatKind::Ref(folder.fold_pat(inner), mutbl), + PatKind::Range(e1, e2) => { + PatKind::Range(folder.fold_expr(e1), folder.fold_expr(e2)) + }, + PatKind::Slice(before, slice, after) => { + PatKind::Slice(before.move_map(|x| folder.fold_pat(x)), + slice.map(|x| folder.fold_pat(x)), + after.move_map(|x| folder.fold_pat(x))) + } + PatKind::Mac(mac) => PatKind::Mac(folder.fold_mac(mac)) + }, + span: folder.new_span(span) + }) +} + +pub fn noop_fold_expr(Expr {id, node, span, attrs}: Expr, folder: &mut T) -> Expr { + Expr { + node: match node { + ExprKind::Box(e) => { + ExprKind::Box(folder.fold_expr(e)) + } + ExprKind::InPlace(p, e) => { + ExprKind::InPlace(folder.fold_expr(p), folder.fold_expr(e)) + } + ExprKind::Vec(exprs) => { + ExprKind::Vec(folder.fold_exprs(exprs)) + } + ExprKind::Repeat(expr, count) => { + ExprKind::Repeat(folder.fold_expr(expr), folder.fold_expr(count)) + } + ExprKind::Tup(exprs) => ExprKind::Tup(folder.fold_exprs(exprs)), + ExprKind::Call(f, args) => { + ExprKind::Call(folder.fold_expr(f), + folder.fold_exprs(args)) + } + ExprKind::MethodCall(i, tps, args) => { + ExprKind::MethodCall( + respan(folder.new_span(i.span), folder.fold_ident(i.node)), + tps.move_map(|x| folder.fold_ty(x)), + folder.fold_exprs(args)) + } + ExprKind::Binary(binop, lhs, rhs) => { + ExprKind::Binary(binop, + folder.fold_expr(lhs), + folder.fold_expr(rhs)) + } + ExprKind::Unary(binop, ohs) => { + ExprKind::Unary(binop, folder.fold_expr(ohs)) + } + ExprKind::Lit(l) => ExprKind::Lit(l), + ExprKind::Cast(expr, ty) => { + ExprKind::Cast(folder.fold_expr(expr), folder.fold_ty(ty)) + } + ExprKind::Type(expr, ty) => { + ExprKind::Type(folder.fold_expr(expr), folder.fold_ty(ty)) + } + ExprKind::AddrOf(m, ohs) => ExprKind::AddrOf(m, folder.fold_expr(ohs)), + ExprKind::If(cond, tr, fl) => { + ExprKind::If(folder.fold_expr(cond), + folder.fold_block(tr), + fl.map(|x| folder.fold_expr(x))) + } + ExprKind::IfLet(pat, expr, tr, fl) => { + ExprKind::IfLet(folder.fold_pat(pat), + folder.fold_expr(expr), + folder.fold_block(tr), + fl.map(|x| folder.fold_expr(x))) + } + ExprKind::While(cond, body, opt_ident) => { + ExprKind::While(folder.fold_expr(cond), + folder.fold_block(body), + opt_ident.map(|label| respan(folder.new_span(label.span), + folder.fold_ident(label.node)))) + } + ExprKind::WhileLet(pat, expr, body, opt_ident) => { + ExprKind::WhileLet(folder.fold_pat(pat), + folder.fold_expr(expr), + folder.fold_block(body), + opt_ident.map(|label| respan(folder.new_span(label.span), + folder.fold_ident(label.node)))) + } + ExprKind::ForLoop(pat, iter, body, opt_ident) => { + ExprKind::ForLoop(folder.fold_pat(pat), + folder.fold_expr(iter), + folder.fold_block(body), + opt_ident.map(|label| respan(folder.new_span(label.span), + folder.fold_ident(label.node)))) + } + ExprKind::Loop(body, opt_ident) => { + ExprKind::Loop(folder.fold_block(body), + opt_ident.map(|label| respan(folder.new_span(label.span), + folder.fold_ident(label.node)))) + } + ExprKind::Match(expr, arms) => { + ExprKind::Match(folder.fold_expr(expr), + arms.move_map(|x| folder.fold_arm(x))) + } + ExprKind::Closure(capture_clause, decl, body, span) => { + ExprKind::Closure(capture_clause, + folder.fold_fn_decl(decl), + folder.fold_expr(body), + folder.new_span(span)) + } + ExprKind::Block(blk) => ExprKind::Block(folder.fold_block(blk)), + ExprKind::Assign(el, er) => { + ExprKind::Assign(folder.fold_expr(el), folder.fold_expr(er)) + } + ExprKind::AssignOp(op, el, er) => { + ExprKind::AssignOp(op, + folder.fold_expr(el), + folder.fold_expr(er)) + } + ExprKind::Field(el, ident) => { + ExprKind::Field(folder.fold_expr(el), + respan(folder.new_span(ident.span), + folder.fold_ident(ident.node))) + } + ExprKind::TupField(el, ident) => { + ExprKind::TupField(folder.fold_expr(el), + respan(folder.new_span(ident.span), + folder.fold_usize(ident.node))) + } + ExprKind::Index(el, er) => { + ExprKind::Index(folder.fold_expr(el), folder.fold_expr(er)) + } + ExprKind::Range(e1, e2, lim) => { + ExprKind::Range(e1.map(|x| folder.fold_expr(x)), + e2.map(|x| folder.fold_expr(x)), + lim) + } + ExprKind::Path(qself, path) => { + let qself = qself.map(|QSelf { ty, position }| { + QSelf { + ty: folder.fold_ty(ty), + position: position + } + }); + ExprKind::Path(qself, folder.fold_path(path)) + } + ExprKind::Break(opt_ident, opt_expr) => { + ExprKind::Break(opt_ident.map(|label| respan(folder.new_span(label.span), + folder.fold_ident(label.node))), + opt_expr.map(|e| folder.fold_expr(e))) + } + ExprKind::Continue(opt_ident) => ExprKind::Continue(opt_ident.map(|label| + respan(folder.new_span(label.span), + folder.fold_ident(label.node))) + ), + ExprKind::Ret(e) => ExprKind::Ret(e.map(|x| folder.fold_expr(x))), + ExprKind::InlineAsm(asm) => ExprKind::InlineAsm(asm.map(|asm| { + InlineAsm { + inputs: asm.inputs.move_map(|(c, input)| { + (c, folder.fold_expr(input)) + }), + outputs: asm.outputs.move_map(|out| { + InlineAsmOutput { + constraint: out.constraint, + expr: folder.fold_expr(out.expr), + is_rw: out.is_rw, + is_indirect: out.is_indirect, + } + }), + ..asm + } + })), + ExprKind::Mac(mac) => ExprKind::Mac(folder.fold_mac(mac)), + ExprKind::Struct(path, fields, maybe_expr) => { + ExprKind::Struct(folder.fold_path(path), + fields.move_map(|x| folder.fold_field(x)), + maybe_expr.map(|x| folder.fold_expr(x))) + }, + ExprKind::Paren(ex) => { + let sub_expr = folder.fold_expr(ex); + return Expr { + // Nodes that are equal modulo `Paren` sugar no-ops should have the same ids. + id: sub_expr.id, + node: ExprKind::Paren(sub_expr), + span: folder.new_span(span), + attrs: fold_attrs(attrs.into(), folder).into(), + }; + } + ExprKind::Try(ex) => ExprKind::Try(folder.fold_expr(ex)), + }, + id: folder.new_id(id), + span: folder.new_span(span), + attrs: fold_attrs(attrs.into(), folder).into(), + } +} + +pub fn noop_fold_opt_expr(e: P, folder: &mut T) -> Option> { + Some(folder.fold_expr(e)) +} + +pub fn noop_fold_exprs(es: Vec>, folder: &mut T) -> Vec> { + es.move_flat_map(|e| folder.fold_opt_expr(e)) +} + +pub fn noop_fold_stmt(Stmt {node, span, id}: Stmt, folder: &mut T) -> SmallVector { + let id = folder.new_id(id); + let span = folder.new_span(span); + noop_fold_stmt_kind(node, folder).into_iter().map(|node| { + Stmt { id: id, node: node, span: span } + }).collect() +} + +pub fn noop_fold_stmt_kind(node: StmtKind, folder: &mut T) -> SmallVector { + match node { + StmtKind::Local(local) => SmallVector::one(StmtKind::Local(folder.fold_local(local))), + StmtKind::Item(item) => folder.fold_item(item).into_iter().map(StmtKind::Item).collect(), + StmtKind::Expr(expr) => { + folder.fold_opt_expr(expr).into_iter().map(StmtKind::Expr).collect() + } + StmtKind::Semi(expr) => { + folder.fold_opt_expr(expr).into_iter().map(StmtKind::Semi).collect() + } + StmtKind::Mac(mac) => SmallVector::one(StmtKind::Mac(mac.map(|(mac, semi, attrs)| { + (folder.fold_mac(mac), semi, fold_attrs(attrs.into(), folder).into()) + }))), + } +} + +pub fn noop_fold_vis(vis: Visibility, folder: &mut T) -> Visibility { + match vis { + Visibility::Restricted { path, id } => Visibility::Restricted { + path: path.map(|path| folder.fold_path(path)), + id: folder.new_id(id) + }, + _ => vis, + } +} + +#[cfg(test)] +mod tests { + use std::io; + use ast::{self, Ident}; + use util::parser_testing::{string_to_crate, matches_codepattern}; + use print::pprust; + use fold; + use super::*; + + // this version doesn't care about getting comments or docstrings in. + fn fake_print_crate(s: &mut pprust::State, + krate: &ast::Crate) -> io::Result<()> { + s.print_mod(&krate.module, &krate.attrs) + } + + // change every identifier to "zz" + struct ToZzIdentFolder; + + impl Folder for ToZzIdentFolder { + fn fold_ident(&mut self, _: ast::Ident) -> ast::Ident { + Ident::from_str("zz") + } + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { + fold::noop_fold_mac(mac, self) + } + } + + // maybe add to expand.rs... + macro_rules! assert_pred { + ($pred:expr, $predname:expr, $a:expr , $b:expr) => ( + { + let pred_val = $pred; + let a_val = $a; + let b_val = $b; + if !(pred_val(&a_val, &b_val)) { + panic!("expected args satisfying {}, got {} and {}", + $predname, a_val, b_val); + } + } + ) + } + + // make sure idents get transformed everywhere + #[test] fn ident_transformation () { + let mut zz_fold = ToZzIdentFolder; + let ast = string_to_crate( + "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_string()); + let folded_crate = zz_fold.fold_crate(ast); + assert_pred!( + matches_codepattern, + "matches_codepattern", + pprust::to_string(|s| fake_print_crate(s, &folded_crate)), + "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_string()); + } + + // even inside macro defs.... + #[test] fn ident_transformation_in_defs () { + let mut zz_fold = ToZzIdentFolder; + let ast = string_to_crate( + "macro_rules! a {(b $c:expr $(d $e:token)f+ => \ + (g $(d $d $e)+))} ".to_string()); + let folded_crate = zz_fold.fold_crate(ast); + assert_pred!( + matches_codepattern, + "matches_codepattern", + pprust::to_string(|s| fake_print_crate(s, &folded_crate)), + "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)));".to_string()); + } +} diff --git a/third_party/rust/syntex_syntax/src/json.rs b/third_party/rust/syntex_syntax/src/json.rs new file mode 100644 index 000000000000..a1c273baeea4 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/json.rs @@ -0,0 +1,356 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A JSON emitter for errors. +//! +//! This works by converting errors to a simplified structural format (see the +//! structs at the start of the file) and then serialising them. These should +//! contain as much information about the error as possible. +//! +//! The format of the JSON output should be considered *unstable*. For now the +//! structs at the end of this file (Diagnostic*) specify the error format. + +// FIXME spec the JSON output properly. + +use codemap::CodeMap; +use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan}; +use errors::registry::Registry; +use errors::{DiagnosticBuilder, SubDiagnostic, RenderSpan, CodeSuggestion, CodeMapper}; +use errors::emitter::Emitter; + +use std::rc::Rc; +use std::io::{self, Write}; +use std::vec; + +use rustc_serialize::json::as_json; + +pub struct JsonEmitter { + dst: Box, + registry: Option, + cm: Rc, +} + +impl JsonEmitter { + pub fn stderr(registry: Option, + code_map: Rc) -> JsonEmitter { + JsonEmitter { + dst: Box::new(io::stderr()), + registry: registry, + cm: code_map, + } + } + + pub fn basic() -> JsonEmitter { + JsonEmitter::stderr(None, Rc::new(CodeMap::new())) + } + + pub fn new(dst: Box, + registry: Option, + code_map: Rc) -> JsonEmitter { + JsonEmitter { + dst: dst, + registry: registry, + cm: code_map, + } + } +} + +impl Emitter for JsonEmitter { + fn emit(&mut self, db: &DiagnosticBuilder) { + let data = Diagnostic::from_diagnostic_builder(db, self); + if let Err(e) = writeln!(&mut self.dst, "{}", as_json(&data)) { + panic!("failed to print diagnostics: {:?}", e); + } + } +} + +// The following data types are provided just for serialisation. + +#[derive(RustcEncodable)] +struct Diagnostic<'a> { + /// The primary error message. + message: &'a str, + code: Option, + /// "error: internal compiler error", "error", "warning", "note", "help". + level: &'static str, + spans: Vec, + /// Associated diagnostic messages. + children: Vec>, + /// The message as rustc would render it. Currently this is only + /// `Some` for "suggestions", but eventually it will include all + /// snippets. + rendered: Option, +} + +#[derive(RustcEncodable)] +struct DiagnosticSpan { + file_name: String, + byte_start: u32, + byte_end: u32, + /// 1-based. + line_start: usize, + line_end: usize, + /// 1-based, character offset. + column_start: usize, + column_end: usize, + /// Is this a "primary" span -- meaning the point, or one of the points, + /// where the error occurred? + is_primary: bool, + /// Source text from the start of line_start to the end of line_end. + text: Vec, + /// Label that should be placed at this location (if any) + label: Option, + /// If we are suggesting a replacement, this will contain text + /// that should be sliced in atop this span. You may prefer to + /// load the fully rendered version from the parent `Diagnostic`, + /// however. + suggested_replacement: Option, + /// Macro invocations that created the code at this span, if any. + expansion: Option>, +} + +#[derive(RustcEncodable)] +struct DiagnosticSpanLine { + text: String, + + /// 1-based, character offset in self.text. + highlight_start: usize, + + highlight_end: usize, +} + +#[derive(RustcEncodable)] +struct DiagnosticSpanMacroExpansion { + /// span where macro was applied to generate this code; note that + /// this may itself derive from a macro (if + /// `span.expansion.is_some()`) + span: DiagnosticSpan, + + /// name of macro that was applied (e.g., "foo!" or "#[derive(Eq)]") + macro_decl_name: String, + + /// span where macro was defined (if known) + def_site_span: Option, +} + +#[derive(RustcEncodable)] +struct DiagnosticCode { + /// The code itself. + code: String, + /// An explanation for the code. + explanation: Option<&'static str>, +} + +impl<'a> Diagnostic<'a> { + fn from_diagnostic_builder<'c>(db: &'c DiagnosticBuilder, + je: &JsonEmitter) + -> Diagnostic<'c> { + Diagnostic { + message: &db.message, + code: DiagnosticCode::map_opt_string(db.code.clone(), je), + level: db.level.to_str(), + spans: DiagnosticSpan::from_multispan(&db.span, je), + children: db.children.iter().map(|c| { + Diagnostic::from_sub_diagnostic(c, je) + }).collect(), + rendered: None, + } + } + + fn from_sub_diagnostic<'c>(db: &'c SubDiagnostic, je: &JsonEmitter) -> Diagnostic<'c> { + Diagnostic { + message: &db.message, + code: None, + level: db.level.to_str(), + spans: db.render_span.as_ref() + .map(|sp| DiagnosticSpan::from_render_span(sp, je)) + .unwrap_or_else(|| DiagnosticSpan::from_multispan(&db.span, je)), + children: vec![], + rendered: db.render_span.as_ref() + .and_then(|rsp| je.render(rsp)), + } + } +} + +impl DiagnosticSpan { + fn from_span_label(span: SpanLabel, + suggestion: Option<&String>, + je: &JsonEmitter) + -> DiagnosticSpan { + Self::from_span_etc(span.span, + span.is_primary, + span.label, + suggestion, + je) + } + + fn from_span_etc(span: Span, + is_primary: bool, + label: Option, + suggestion: Option<&String>, + je: &JsonEmitter) + -> DiagnosticSpan { + // obtain the full backtrace from the `macro_backtrace` + // helper; in some ways, it'd be better to expand the + // backtrace ourselves, but the `macro_backtrace` helper makes + // some decision, such as dropping some frames, and I don't + // want to duplicate that logic here. + let backtrace = je.cm.macro_backtrace(span).into_iter(); + DiagnosticSpan::from_span_full(span, + is_primary, + label, + suggestion, + backtrace, + je) + } + + fn from_span_full(span: Span, + is_primary: bool, + label: Option, + suggestion: Option<&String>, + mut backtrace: vec::IntoIter, + je: &JsonEmitter) + -> DiagnosticSpan { + let start = je.cm.lookup_char_pos(span.lo); + let end = je.cm.lookup_char_pos(span.hi); + let backtrace_step = backtrace.next().map(|bt| { + let call_site = + Self::from_span_full(bt.call_site, + false, + None, + None, + backtrace, + je); + let def_site_span = bt.def_site_span.map(|sp| { + Self::from_span_full(sp, + false, + None, + None, + vec![].into_iter(), + je) + }); + Box::new(DiagnosticSpanMacroExpansion { + span: call_site, + macro_decl_name: bt.macro_decl_name, + def_site_span: def_site_span, + }) + }); + DiagnosticSpan { + file_name: start.file.name.clone(), + byte_start: span.lo.0, + byte_end: span.hi.0, + line_start: start.line, + line_end: end.line, + column_start: start.col.0 + 1, + column_end: end.col.0 + 1, + is_primary: is_primary, + text: DiagnosticSpanLine::from_span(span, je), + suggested_replacement: suggestion.cloned(), + expansion: backtrace_step, + label: label, + } + } + + fn from_multispan(msp: &MultiSpan, je: &JsonEmitter) -> Vec { + msp.span_labels() + .into_iter() + .map(|span_str| Self::from_span_label(span_str, None, je)) + .collect() + } + + fn from_suggestion(suggestion: &CodeSuggestion, je: &JsonEmitter) + -> Vec { + assert_eq!(suggestion.msp.span_labels().len(), suggestion.substitutes.len()); + suggestion.msp.span_labels() + .into_iter() + .zip(&suggestion.substitutes) + .map(|(span_label, suggestion)| { + DiagnosticSpan::from_span_label(span_label, + Some(suggestion), + je) + }) + .collect() + } + + fn from_render_span(rsp: &RenderSpan, je: &JsonEmitter) -> Vec { + match *rsp { + RenderSpan::FullSpan(ref msp) => + DiagnosticSpan::from_multispan(msp, je), + RenderSpan::Suggestion(ref suggestion) => + DiagnosticSpan::from_suggestion(suggestion, je), + } + } +} + +impl DiagnosticSpanLine { + fn line_from_filemap(fm: &syntax_pos::FileMap, + index: usize, + h_start: usize, + h_end: usize) + -> DiagnosticSpanLine { + DiagnosticSpanLine { + text: fm.get_line(index).unwrap().to_owned(), + highlight_start: h_start, + highlight_end: h_end, + } + } + + /// Create a list of DiagnosticSpanLines from span - each line with any part + /// of `span` gets a DiagnosticSpanLine, with the highlight indicating the + /// `span` within the line. + fn from_span(span: Span, je: &JsonEmitter) -> Vec { + je.cm.span_to_lines(span) + .map(|lines| { + let fm = &*lines.file; + lines.lines + .iter() + .map(|line| { + DiagnosticSpanLine::line_from_filemap(fm, + line.line_index, + line.start_col.0 + 1, + line.end_col.0 + 1) + }) + .collect() + }) + .unwrap_or(vec![]) + } +} + +impl DiagnosticCode { + fn map_opt_string(s: Option, je: &JsonEmitter) -> Option { + s.map(|s| { + + let explanation = je.registry + .as_ref() + .and_then(|registry| registry.find_description(&s)); + + DiagnosticCode { + code: s, + explanation: explanation, + } + }) + } +} + +impl JsonEmitter { + fn render(&self, render_span: &RenderSpan) -> Option { + use std::borrow::Borrow; + + match *render_span { + RenderSpan::FullSpan(_) => { + None + } + RenderSpan::Suggestion(ref suggestion) => { + Some(suggestion.splice_lines(self.cm.borrow())) + } + } + } +} + diff --git a/third_party/rust/syntex_syntax/src/lib.rs b/third_party/rust/syntex_syntax/src/lib.rs new file mode 100644 index 000000000000..d0f7bbee8645 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/lib.rs @@ -0,0 +1,135 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The Rust parser and macro expander. +//! +//! # Note +//! +//! This API is completely unstable and subject to change. + +#![crate_type = "dylib"] +#![crate_type = "rlib"] +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://doc.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/nightly/", + test(attr(deny(warnings))))] +#![cfg_attr(not(stage0), deny(warnings))] + +extern crate rustc_serialize; +extern crate term; +extern crate libc; +#[macro_use] extern crate log; +#[macro_use] extern crate bitflags; +extern crate syntex_errors as errors; +extern crate syntex_pos as syntax_pos; + +extern crate rustc_serialize as serialize; +extern crate unicode_xid; + +// A variant of 'try!' that panics on an Err. This is used as a crutch on the +// way towards a non-panic!-prone parser. It should be used for fatal parsing +// errors; eventually we plan to convert all code using panictry to just use +// normal try. +// Exported for syntax_ext, not meant for general use. +#[macro_export] +macro_rules! panictry { + ($e:expr) => ({ + use std::result::Result::{Ok, Err}; + use errors::FatalError; + match $e { + Ok(e) => e, + Err(mut e) => { + e.emit(); + panic!(FatalError); + } + } + }) +} + +#[macro_use] +pub mod diagnostics { + #[macro_use] + pub mod macros; + pub mod plugin; + pub mod metadata; +} + +// NB: This module needs to be declared first so diagnostics are +// registered before they are used. +pub mod diagnostic_list; + +pub mod util { + pub mod lev_distance; + pub mod node_count; + pub mod parser; + #[cfg(test)] + pub mod parser_testing; + pub mod small_vector; + pub mod move_map; + + mod thin_vec; + pub use self::thin_vec::ThinVec; +} + +pub mod json; + +pub mod syntax { + pub use ext; + pub use parse; + pub use ast; +} + +pub mod abi; +pub mod ast; +pub mod attr; +pub mod codemap; +#[macro_use] +pub mod config; +pub mod entry; +pub mod feature_gate; +pub mod fold; +pub mod parse; +pub mod ptr; +pub mod show_span; +pub mod std_inject; +pub mod str; +pub mod symbol; +pub mod test; +pub mod tokenstream; +pub mod visit; + +pub mod print { + pub mod pp; + pub mod pprust; +} + +pub mod ext { + pub mod base; + pub mod build; + pub mod decorator; + pub mod env; + pub mod expand; + pub mod placeholders; + pub mod hygiene; + pub mod proc_macro_shim; + pub mod quote; + pub mod source_util; + + pub mod tt { + pub mod transcribe; + pub mod macro_parser; + pub mod macro_rules; + } +} + +#[cfg(test)] +mod test_snippet; + +// __build_diagnostic_array! { libsyntax, DIAGNOSTICS } diff --git a/third_party/rust/syntex_syntax/src/parse/attr.rs b/third_party/rust/syntex_syntax/src/parse/attr.rs new file mode 100644 index 000000000000..3009bf0b101b --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/attr.rs @@ -0,0 +1,266 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use attr; +use ast; +use syntax_pos::{mk_sp, Span}; +use codemap::spanned; +use parse::common::SeqSep; +use parse::PResult; +use parse::token; +use parse::parser::{Parser, TokenType}; + +#[derive(PartialEq, Eq, Debug)] +enum InnerAttributeParsePolicy<'a> { + Permitted, + NotPermitted { reason: &'a str }, +} + +const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &'static str = "an inner attribute is not \ + permitted in this context"; + +impl<'a> Parser<'a> { + /// Parse attributes that appear before an item + pub fn parse_outer_attributes(&mut self) -> PResult<'a, Vec> { + let mut attrs: Vec = Vec::new(); + let mut just_parsed_doc_comment = false; + loop { + debug!("parse_outer_attributes: self.token={:?}", self.token); + match self.token { + token::Pound => { + let inner_error_reason = if just_parsed_doc_comment { + "an inner attribute is not permitted following an outer doc comment" + } else if !attrs.is_empty() { + "an inner attribute is not permitted following an outer attribute" + } else { + DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG + }; + let inner_parse_policy = + InnerAttributeParsePolicy::NotPermitted { reason: inner_error_reason }; + attrs.push(try!(self.parse_attribute_with_inner_parse_policy(inner_parse_policy))); + just_parsed_doc_comment = false; + } + token::DocComment(s) => { + let Span { lo, hi, .. } = self.span; + let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), s, lo, hi); + if attr.style != ast::AttrStyle::Outer { + let mut err = self.fatal("expected outer doc comment"); + err.note("inner doc comments like this (starting with \ + `//!` or `/*!`) can only appear before items"); + return Err(err); + } + attrs.push(attr); + self.bump(); + just_parsed_doc_comment = true; + } + _ => break, + } + } + return Ok(attrs); + } + + /// Matches `attribute = # ! [ meta_item ]` + /// + /// If permit_inner is true, then a leading `!` indicates an inner + /// attribute + pub fn parse_attribute(&mut self, permit_inner: bool) -> PResult<'a, ast::Attribute> { + debug!("parse_attribute: permit_inner={:?} self.token={:?}", + permit_inner, + self.token); + let inner_parse_policy = if permit_inner { + InnerAttributeParsePolicy::Permitted + } else { + InnerAttributeParsePolicy::NotPermitted + { reason: DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG } + }; + self.parse_attribute_with_inner_parse_policy(inner_parse_policy) + } + + /// The same as `parse_attribute`, except it takes in an `InnerAttributeParsePolicy` + /// that prescribes how to handle inner attributes. + fn parse_attribute_with_inner_parse_policy(&mut self, + inner_parse_policy: InnerAttributeParsePolicy) + -> PResult<'a, ast::Attribute> { + debug!("parse_attribute_with_inner_parse_policy: inner_parse_policy={:?} self.token={:?}", + inner_parse_policy, + self.token); + let (span, value, mut style) = match self.token { + token::Pound => { + let lo = self.span.lo; + self.bump(); + + if inner_parse_policy == InnerAttributeParsePolicy::Permitted { + self.expected_tokens.push(TokenType::Token(token::Not)); + } + let style = if self.token == token::Not { + self.bump(); + if let InnerAttributeParsePolicy::NotPermitted { reason } = inner_parse_policy + { + let span = self.span; + self.diagnostic() + .struct_span_err(span, reason) + .note("inner attributes and doc comments, like `#![no_std]` or \ + `//! My crate`, annotate the item enclosing them, and are \ + usually found at the beginning of source files. Outer \ + attributes and doc comments, like `#[test]` and + `/// My function`, annotate the item following them.") + .emit() + } + ast::AttrStyle::Inner + } else { + ast::AttrStyle::Outer + }; + + try!(self.expect(&token::OpenDelim(token::Bracket))); + let meta_item = try!(self.parse_meta_item()); + try!(self.expect(&token::CloseDelim(token::Bracket))); + let hi = self.prev_span.hi; + + (mk_sp(lo, hi), meta_item, style) + } + _ => { + let token_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected `#`, found `{}`", token_str))); + } + }; + + if inner_parse_policy == InnerAttributeParsePolicy::Permitted && + self.token == token::Semi { + self.bump(); + self.span_warn(span, + "this inner attribute syntax is deprecated. The new syntax is \ + `#![foo]`, with a bang and no semicolon"); + style = ast::AttrStyle::Inner; + } + + Ok(ast::Attribute { + id: attr::mk_attr_id(), + style: style, + value: value, + is_sugared_doc: false, + span: span, + }) + } + + /// Parse attributes that appear after the opening of an item. These should + /// be preceded by an exclamation mark, but we accept and warn about one + /// terminated by a semicolon. + + /// matches inner_attrs* + pub fn parse_inner_attributes(&mut self) -> PResult<'a, Vec> { + let mut attrs: Vec = vec![]; + loop { + match self.token { + token::Pound => { + // Don't even try to parse if it's not an inner attribute. + if !self.look_ahead(1, |t| t == &token::Not) { + break; + } + + let attr = try!(self.parse_attribute(true)); + assert!(attr.style == ast::AttrStyle::Inner); + attrs.push(attr); + } + token::DocComment(s) => { + // we need to get the position of this token before we bump. + let Span { lo, hi, .. } = self.span; + let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), s, lo, hi); + if attr.style == ast::AttrStyle::Inner { + attrs.push(attr); + self.bump(); + } else { + break; + } + } + _ => break, + } + } + Ok(attrs) + } + + fn parse_unsuffixed_lit(&mut self) -> PResult<'a, ast::Lit> { + let lit = try!(self.parse_lit()); + debug!("Checking if {:?} is unusuffixed.", lit); + + if !lit.node.is_unsuffixed() { + let msg = "suffixed literals are not allowed in attributes"; + self.diagnostic().struct_span_err(lit.span, msg) + .help("instead of using a suffixed literal \ + (1u8, 1.0f32, etc.), use an unsuffixed version \ + (1, 1.0, etc.).") + .emit() + } + + Ok(lit) + } + + /// Per RFC#1559, matches the following grammar: + /// + /// meta_item : IDENT ( '=' UNSUFFIXED_LIT | '(' meta_item_inner? ')' )? ; + /// meta_item_inner : (meta_item | UNSUFFIXED_LIT) (',' meta_item_inner)? ; + pub fn parse_meta_item(&mut self) -> PResult<'a, ast::MetaItem> { + let nt_meta = match self.token { + token::Interpolated(ref nt) => match **nt { + token::NtMeta(ref e) => Some(e.clone()), + _ => None, + }, + _ => None, + }; + + if let Some(meta) = nt_meta { + self.bump(); + return Ok(meta); + } + + let lo = self.span.lo; + let ident = try!(self.parse_ident()); + let node = if self.eat(&token::Eq) { + ast::MetaItemKind::NameValue(try!(self.parse_unsuffixed_lit())) + } else if self.token == token::OpenDelim(token::Paren) { + ast::MetaItemKind::List(try!(self.parse_meta_seq())) + } else { + ast::MetaItemKind::Word + }; + let hi = self.prev_span.hi; + Ok(ast::MetaItem { name: ident.name, node: node, span: mk_sp(lo, hi) }) + } + + /// matches meta_item_inner : (meta_item | UNSUFFIXED_LIT) ; + fn parse_meta_item_inner(&mut self) -> PResult<'a, ast::NestedMetaItem> { + let sp = self.span; + let lo = self.span.lo; + + match self.parse_unsuffixed_lit() { + Ok(lit) => { + return Ok(spanned(lo, self.prev_span.hi, ast::NestedMetaItemKind::Literal(lit))) + } + Err(ref mut err) => self.diagnostic().cancel(err) + } + + match self.parse_meta_item() { + Ok(mi) => { + return Ok(spanned(lo, self.prev_span.hi, ast::NestedMetaItemKind::MetaItem(mi))) + } + Err(ref mut err) => self.diagnostic().cancel(err) + } + + let found = self.this_token_to_string(); + let msg = format!("expected unsuffixed literal or identifier, found {}", found); + Err(self.diagnostic().struct_span_err(sp, &msg)) + } + + /// matches meta_seq = ( COMMASEP(meta_item_inner) ) + fn parse_meta_seq(&mut self) -> PResult<'a, Vec> { + self.parse_unspanned_seq(&token::OpenDelim(token::Paren), + &token::CloseDelim(token::Paren), + SeqSep::trailing_allowed(token::Comma), + |p: &mut Parser<'a>| p.parse_meta_item_inner()) + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/classify.rs b/third_party/rust/syntex_syntax/src/parse/classify.rs new file mode 100644 index 000000000000..4fe4ec7e4c0e --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/classify.rs @@ -0,0 +1,56 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Routines the parser uses to classify AST nodes + +// Predicates on exprs and stmts that the pretty-printer and parser use + +use ast::{self, BlockCheckMode}; + +/// Does this expression require a semicolon to be treated +/// as a statement? The negation of this: 'can this expression +/// be used as a statement without a semicolon' -- is used +/// as an early-bail-out in the parser so that, for instance, +/// if true {...} else {...} +/// |x| 5 +/// isn't parsed as (if true {...} else {...} | x) | 5 +pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool { + match e.node { + ast::ExprKind::If(..) | + ast::ExprKind::IfLet(..) | + ast::ExprKind::Match(..) | + ast::ExprKind::Block(_) | + ast::ExprKind::While(..) | + ast::ExprKind::WhileLet(..) | + ast::ExprKind::Loop(..) | + ast::ExprKind::ForLoop(..) => false, + _ => true, + } +} + +pub fn expr_is_simple_block(e: &ast::Expr) -> bool { + match e.node { + ast::ExprKind::Block(ref block) => block.rules == BlockCheckMode::Default, + _ => false, + } +} + +/// this statement requires a semicolon after it. +/// note that in one case (stmt_semi), we've already +/// seen the semicolon, and thus don't need another. +pub fn stmt_ends_with_semi(stmt: &ast::StmtKind) -> bool { + match *stmt { + ast::StmtKind::Local(_) => true, + ast::StmtKind::Item(_) => false, + ast::StmtKind::Expr(ref e) => expr_requires_semi_to_be_stmt(e), + ast::StmtKind::Semi(..) => false, + ast::StmtKind::Mac(..) => false, + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/common.rs b/third_party/rust/syntex_syntax/src/parse/common.rs new file mode 100644 index 000000000000..b57708f9193a --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/common.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Common routines shared by parser mods + +use parse::token; + +/// SeqSep : a sequence separator (token) +/// and whether a trailing separator is allowed. +pub struct SeqSep { + pub sep: Option, + pub trailing_sep_allowed: bool, +} + +impl SeqSep { + pub fn trailing_allowed(t: token::Token) -> SeqSep { + SeqSep { + sep: Some(t), + trailing_sep_allowed: true, + } + } + + pub fn none() -> SeqSep { + SeqSep { + sep: None, + trailing_sep_allowed: false, + } + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/lexer/comments.rs b/third_party/rust/syntex_syntax/src/parse/lexer/comments.rs new file mode 100644 index 000000000000..ba83a55ea793 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/lexer/comments.rs @@ -0,0 +1,456 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use self::CommentStyle::*; + +use ast; +use codemap::CodeMap; +use syntax_pos::{BytePos, CharPos, Pos}; +use errors; +use parse::lexer::is_block_doc_comment; +use parse::lexer::{StringReader, TokenAndSpan}; +use parse::lexer::{is_pattern_whitespace, Reader}; +use parse::lexer; +use print::pprust; +use str::char_at; + +use std::io::Read; +use std::usize; + +#[derive(Clone, Copy, PartialEq, Debug)] +pub enum CommentStyle { + /// No code on either side of each line of the comment + Isolated, + /// Code exists to the left of the comment + Trailing, + /// Code before /* foo */ and after the comment + Mixed, + /// Just a manual blank line "\n\n", for layout + BlankLine, +} + +#[derive(Clone)] +pub struct Comment { + pub style: CommentStyle, + pub lines: Vec, + pub pos: BytePos, +} + +pub fn is_doc_comment(s: &str) -> bool { + (s.starts_with("///") && super::is_doc_comment(s)) || s.starts_with("//!") || + (s.starts_with("/**") && is_block_doc_comment(s)) || s.starts_with("/*!") +} + +pub fn doc_comment_style(comment: &str) -> ast::AttrStyle { + assert!(is_doc_comment(comment)); + if comment.starts_with("//!") || comment.starts_with("/*!") { + ast::AttrStyle::Inner + } else { + ast::AttrStyle::Outer + } +} + +pub fn strip_doc_comment_decoration(comment: &str) -> String { + /// remove whitespace-only lines from the start/end of lines + fn vertical_trim(lines: Vec) -> Vec { + let mut i = 0; + let mut j = lines.len(); + // first line of all-stars should be omitted + if !lines.is_empty() && lines[0].chars().all(|c| c == '*') { + i += 1; + } + while i < j && lines[i].trim().is_empty() { + i += 1; + } + // like the first, a last line of all stars should be omitted + if j > i && + lines[j - 1] + .chars() + .skip(1) + .all(|c| c == '*') { + j -= 1; + } + while j > i && lines[j - 1].trim().is_empty() { + j -= 1; + } + lines[i..j].iter().cloned().collect() + } + + /// remove a "[ \t]*\*" block from each line, if possible + fn horizontal_trim(lines: Vec) -> Vec { + let mut i = usize::MAX; + let mut can_trim = true; + let mut first = true; + for line in &lines { + for (j, c) in line.chars().enumerate() { + if j > i || !"* \t".contains(c) { + can_trim = false; + break; + } + if c == '*' { + if first { + i = j; + first = false; + } else if i != j { + can_trim = false; + } + break; + } + } + if i > line.len() { + can_trim = false; + } + if !can_trim { + break; + } + } + + if can_trim { + lines.iter() + .map(|line| (&line[i + 1..line.len()]).to_string()) + .collect() + } else { + lines + } + } + + // one-line comments lose their prefix + const ONELINERS: &'static [&'static str] = &["///!", "///", "//!", "//"]; + for prefix in ONELINERS { + if comment.starts_with(*prefix) { + return (&comment[prefix.len()..]).to_string(); + } + } + + if comment.starts_with("/*") { + let lines = comment[3..comment.len() - 2] + .lines() + .map(|s| s.to_string()) + .collect::>(); + + let lines = vertical_trim(lines); + let lines = horizontal_trim(lines); + + return lines.join("\n"); + } + + panic!("not a doc-comment: {}", comment); +} + +fn push_blank_line_comment(rdr: &StringReader, comments: &mut Vec) { + debug!(">>> blank-line comment"); + comments.push(Comment { + style: BlankLine, + lines: Vec::new(), + pos: rdr.pos, + }); +} + +fn consume_whitespace_counting_blank_lines(rdr: &mut StringReader, comments: &mut Vec) { + while is_pattern_whitespace(rdr.ch) && !rdr.is_eof() { + if rdr.ch_is('\n') { + push_blank_line_comment(rdr, &mut *comments); + } + rdr.bump(); + } +} + +fn read_shebang_comment(rdr: &mut StringReader, + code_to_the_left: bool, + comments: &mut Vec) { + debug!(">>> shebang comment"); + let p = rdr.pos; + debug!("<<< shebang comment"); + comments.push(Comment { + style: if code_to_the_left { Trailing } else { Isolated }, + lines: vec![rdr.read_one_line_comment()], + pos: p, + }); +} + +fn read_line_comments(rdr: &mut StringReader, + code_to_the_left: bool, + comments: &mut Vec) { + debug!(">>> line comments"); + let p = rdr.pos; + let mut lines: Vec = Vec::new(); + while rdr.ch_is('/') && rdr.nextch_is('/') { + let line = rdr.read_one_line_comment(); + debug!("{}", line); + // Doc comments are not put in comments. + if is_doc_comment(&line[..]) { + break; + } + lines.push(line); + rdr.consume_non_eol_whitespace(); + } + debug!("<<< line comments"); + if !lines.is_empty() { + comments.push(Comment { + style: if code_to_the_left { Trailing } else { Isolated }, + lines: lines, + pos: p, + }); + } +} + +/// Returns None if the first col chars of s contain a non-whitespace char. +/// Otherwise returns Some(k) where k is first char offset after that leading +/// whitespace. Note k may be outside bounds of s. +fn all_whitespace(s: &str, col: CharPos) -> Option { + let len = s.len(); + let mut col = col.to_usize(); + let mut cursor: usize = 0; + while col > 0 && cursor < len { + let ch = char_at(s, cursor); + if !ch.is_whitespace() { + return None; + } + cursor += ch.len_utf8(); + col -= 1; + } + return Some(cursor); +} + +fn trim_whitespace_prefix_and_push_line(lines: &mut Vec, s: String, col: CharPos) { + let len = s.len(); + let s1 = match all_whitespace(&s[..], col) { + Some(col) => { + if col < len { + (&s[col..len]).to_string() + } else { + "".to_string() + } + } + None => s, + }; + debug!("pushing line: {}", s1); + lines.push(s1); +} + +fn read_block_comment(rdr: &mut StringReader, + code_to_the_left: bool, + comments: &mut Vec) { + debug!(">>> block comment"); + let p = rdr.pos; + let mut lines: Vec = Vec::new(); + let col = rdr.col; + rdr.bump(); + rdr.bump(); + + let mut curr_line = String::from("/*"); + + // doc-comments are not really comments, they are attributes + if (rdr.ch_is('*') && !rdr.nextch_is('*')) || rdr.ch_is('!') { + while !(rdr.ch_is('*') && rdr.nextch_is('/')) && !rdr.is_eof() { + curr_line.push(rdr.ch.unwrap()); + rdr.bump(); + } + if !rdr.is_eof() { + curr_line.push_str("*/"); + rdr.bump(); + rdr.bump(); + } + if is_block_doc_comment(&curr_line[..]) { + return; + } + assert!(!curr_line.contains('\n')); + lines.push(curr_line); + } else { + let mut level: isize = 1; + while level > 0 { + debug!("=== block comment level {}", level); + if rdr.is_eof() { + panic!(rdr.fatal("unterminated block comment")); + } + if rdr.ch_is('\n') { + trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col); + curr_line = String::new(); + rdr.bump(); + } else { + curr_line.push(rdr.ch.unwrap()); + if rdr.ch_is('/') && rdr.nextch_is('*') { + rdr.bump(); + rdr.bump(); + curr_line.push('*'); + level += 1; + } else { + if rdr.ch_is('*') && rdr.nextch_is('/') { + rdr.bump(); + rdr.bump(); + curr_line.push('/'); + level -= 1; + } else { + rdr.bump(); + } + } + } + } + if !curr_line.is_empty() { + trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col); + } + } + + let mut style = if code_to_the_left { + Trailing + } else { + Isolated + }; + rdr.consume_non_eol_whitespace(); + if !rdr.is_eof() && !rdr.ch_is('\n') && lines.len() == 1 { + style = Mixed; + } + debug!("<<< block comment"); + comments.push(Comment { + style: style, + lines: lines, + pos: p, + }); +} + + +fn consume_comment(rdr: &mut StringReader, + comments: &mut Vec, + code_to_the_left: &mut bool, + anything_to_the_left: &mut bool) { + debug!(">>> consume comment"); + if rdr.ch_is('/') && rdr.nextch_is('/') { + read_line_comments(rdr, *code_to_the_left, comments); + *code_to_the_left = false; + *anything_to_the_left = false; + } else if rdr.ch_is('/') && rdr.nextch_is('*') { + read_block_comment(rdr, *code_to_the_left, comments); + *anything_to_the_left = true; + } else if rdr.ch_is('#') && rdr.nextch_is('!') { + read_shebang_comment(rdr, *code_to_the_left, comments); + *code_to_the_left = false; + *anything_to_the_left = false; + } else { + panic!(); + } + debug!("<<< consume comment"); +} + +#[derive(Clone)] +pub struct Literal { + pub lit: String, + pub pos: BytePos, +} + +// it appears this function is called only from pprust... that's +// probably not a good thing. +pub fn gather_comments_and_literals(span_diagnostic: &errors::Handler, + path: String, + srdr: &mut Read) + -> (Vec, Vec) { + let mut src = Vec::new(); + srdr.read_to_end(&mut src).unwrap(); + let src = String::from_utf8(src).unwrap(); + let cm = CodeMap::new(); + let filemap = cm.new_filemap(path, None, src); + let mut rdr = lexer::StringReader::new_raw(span_diagnostic, filemap); + + let mut comments: Vec = Vec::new(); + let mut literals: Vec = Vec::new(); + let mut code_to_the_left = false; // Only code + let mut anything_to_the_left = false; // Code or comments + while !rdr.is_eof() { + loop { + // Eat all the whitespace and count blank lines. + rdr.consume_non_eol_whitespace(); + if rdr.ch_is('\n') { + if anything_to_the_left { + rdr.bump(); // The line is not blank, do not count. + } + consume_whitespace_counting_blank_lines(&mut rdr, &mut comments); + code_to_the_left = false; + anything_to_the_left = false; + } + // Eat one comment group + if rdr.peeking_at_comment() { + consume_comment(&mut rdr, &mut comments, + &mut code_to_the_left, &mut anything_to_the_left); + } else { + break + } + } + + let bstart = rdr.pos; + rdr.next_token(); + // discard, and look ahead; we're working with internal state + let TokenAndSpan { tok, sp } = rdr.peek(); + if tok.is_lit() { + rdr.with_str_from(bstart, |s| { + debug!("tok lit: {}", s); + literals.push(Literal { + lit: s.to_string(), + pos: sp.lo, + }); + }) + } else { + debug!("tok: {}", pprust::token_to_string(&tok)); + } + code_to_the_left = true; + anything_to_the_left = true; + } + + (comments, literals) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_block_doc_comment_1() { + let comment = "/**\n * Test \n ** Test\n * Test\n*/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " Test \n* Test\n Test"); + } + + #[test] + fn test_block_doc_comment_2() { + let comment = "/**\n * Test\n * Test\n*/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " Test\n Test"); + } + + #[test] + fn test_block_doc_comment_3() { + let comment = "/**\n let a: *i32;\n *a = 5;\n*/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " let a: *i32;\n *a = 5;"); + } + + #[test] + fn test_block_doc_comment_4() { + let comment = "/*******************\n test\n *********************/"; + let stripped = strip_doc_comment_decoration(comment); + assert_eq!(stripped, " test"); + } + + #[test] + fn test_line_doc_comment() { + let stripped = strip_doc_comment_decoration("/// test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("///! test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("// test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("// test"); + assert_eq!(stripped, " test"); + let stripped = strip_doc_comment_decoration("///test"); + assert_eq!(stripped, "test"); + let stripped = strip_doc_comment_decoration("///!test"); + assert_eq!(stripped, "test"); + let stripped = strip_doc_comment_decoration("//test"); + assert_eq!(stripped, "test"); + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/lexer/mod.rs b/third_party/rust/syntex_syntax/src/parse/lexer/mod.rs new file mode 100644 index 000000000000..2c281d9abf99 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/lexer/mod.rs @@ -0,0 +1,1929 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ast::{self, Ident}; +use syntax_pos::{self, BytePos, CharPos, Pos, Span}; +use codemap::CodeMap; +use errors::{FatalError, Handler, DiagnosticBuilder}; +use ext::tt::transcribe::tt_next_token; +use parse::token; +use str::char_at; +use symbol::{Symbol, keywords}; + +use std::borrow::Cow; +use std::char; +use std::mem::replace; +use std::rc::Rc; + +use unicode_xid::UnicodeXID; + +pub use ext::tt::transcribe::{TtReader, new_tt_reader}; + +pub mod comments; +mod unicode_chars; + +pub trait Reader { + fn is_eof(&self) -> bool; + fn try_next_token(&mut self) -> Result; + fn next_token(&mut self) -> TokenAndSpan where Self: Sized { + let res = self.try_next_token(); + self.unwrap_or_abort(res) + } + /// Report a fatal error with the current span. + fn fatal(&self, &str) -> FatalError; + /// Report a non-fatal error with the current span. + fn err(&self, &str); + fn emit_fatal_errors(&mut self); + fn unwrap_or_abort(&mut self, res: Result) -> TokenAndSpan { + match res { + Ok(tok) => tok, + Err(_) => { + self.emit_fatal_errors(); + panic!(FatalError); + } + } + } + fn peek(&self) -> TokenAndSpan; + /// Get a token the parser cares about. + fn try_real_token(&mut self) -> Result { + let mut t = try!(self.try_next_token()); + loop { + match t.tok { + token::Whitespace | token::Comment | token::Shebang(_) => { + t = try!(self.try_next_token()); + } + _ => break, + } + } + Ok(t) + } + fn real_token(&mut self) -> TokenAndSpan { + let res = self.try_real_token(); + self.unwrap_or_abort(res) + } +} + +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct TokenAndSpan { + pub tok: token::Token, + pub sp: Span, +} + +impl Default for TokenAndSpan { + fn default() -> Self { + TokenAndSpan { tok: token::Underscore, sp: syntax_pos::DUMMY_SP } + } +} + +pub struct StringReader<'a> { + pub span_diagnostic: &'a Handler, + /// The absolute offset within the codemap of the next character to read + pub next_pos: BytePos, + /// The absolute offset within the codemap of the current character + pub pos: BytePos, + /// The column of the next character to read + pub col: CharPos, + /// The current character (which has been read from self.pos) + pub ch: Option, + pub filemap: Rc, + /// If Some, stop reading the source at this position (inclusive). + pub terminator: Option, + /// Whether to record new-lines in filemap. This is only necessary the first + /// time a filemap is lexed. If part of a filemap is being re-lexed, this + /// should be set to false. + pub save_new_lines: bool, + // cached: + pub peek_tok: token::Token, + pub peek_span: Span, + pub fatal_errs: Vec>, + // cache a direct reference to the source text, so that we don't have to + // retrieve it via `self.filemap.src.as_ref().unwrap()` all the time. + source_text: Rc, +} + +impl<'a> Reader for StringReader<'a> { + fn is_eof(&self) -> bool { + if self.ch.is_none() { + return true; + } + + match self.terminator { + Some(t) => self.next_pos > t, + None => false, + } + } + /// Return the next token. EFFECT: advances the string_reader. + fn try_next_token(&mut self) -> Result { + assert!(self.fatal_errs.is_empty()); + let ret_val = TokenAndSpan { + tok: replace(&mut self.peek_tok, token::Underscore), + sp: self.peek_span, + }; + try!(self.advance_token()); + Ok(ret_val) + } + fn fatal(&self, m: &str) -> FatalError { + self.fatal_span(self.peek_span, m) + } + fn err(&self, m: &str) { + self.err_span(self.peek_span, m) + } + fn emit_fatal_errors(&mut self) { + for err in &mut self.fatal_errs { + err.emit(); + } + self.fatal_errs.clear(); + } + fn peek(&self) -> TokenAndSpan { + // FIXME(pcwalton): Bad copy! + TokenAndSpan { + tok: self.peek_tok.clone(), + sp: self.peek_span, + } + } +} + +impl<'a> Reader for TtReader<'a> { + fn is_eof(&self) -> bool { + self.peek().tok == token::Eof + } + fn try_next_token(&mut self) -> Result { + assert!(self.fatal_errs.is_empty()); + let r = tt_next_token(self); + debug!("TtReader: r={:?}", r); + Ok(r) + } + fn fatal(&self, m: &str) -> FatalError { + self.sp_diag.span_fatal(self.cur_span, m) + } + fn err(&self, m: &str) { + self.sp_diag.span_err(self.cur_span, m); + } + fn emit_fatal_errors(&mut self) { + for err in &mut self.fatal_errs { + err.emit(); + } + self.fatal_errs.clear(); + } + fn peek(&self) -> TokenAndSpan { + TokenAndSpan { + tok: self.cur_tok.clone(), + sp: self.cur_span, + } + } +} + +impl<'a> StringReader<'a> { + /// For comments.rs, which hackily pokes into next_pos and ch + pub fn new_raw<'b>(span_diagnostic: &'b Handler, + filemap: Rc) + -> StringReader<'b> { + let mut sr = StringReader::new_raw_internal(span_diagnostic, filemap); + sr.bump(); + sr + } + + fn new_raw_internal<'b>(span_diagnostic: &'b Handler, + filemap: Rc) + -> StringReader<'b> { + if filemap.src.is_none() { + span_diagnostic.bug(&format!("Cannot lex filemap \ + without source: {}", + filemap.name)[..]); + } + + let source_text = (*filemap.src.as_ref().unwrap()).clone(); + + StringReader { + span_diagnostic: span_diagnostic, + next_pos: filemap.start_pos, + pos: filemap.start_pos, + col: CharPos(0), + ch: Some('\n'), + filemap: filemap, + terminator: None, + save_new_lines: true, + // dummy values; not read + peek_tok: token::Eof, + peek_span: syntax_pos::DUMMY_SP, + source_text: source_text, + fatal_errs: Vec::new(), + } + } + + pub fn new<'b>(span_diagnostic: &'b Handler, + filemap: Rc) + -> StringReader<'b> { + let mut sr = StringReader::new_raw(span_diagnostic, filemap); + if let Err(_) = sr.advance_token() { + sr.emit_fatal_errors(); + panic!(FatalError); + } + sr + } + + pub fn ch_is(&self, c: char) -> bool { + self.ch == Some(c) + } + + /// Report a fatal lexical error with a given span. + pub fn fatal_span(&self, sp: Span, m: &str) -> FatalError { + self.span_diagnostic.span_fatal(sp, m) + } + + /// Report a lexical error with a given span. + pub fn err_span(&self, sp: Span, m: &str) { + self.span_diagnostic.span_err(sp, m) + } + + + /// Report a fatal error spanning [`from_pos`, `to_pos`). + fn fatal_span_(&self, from_pos: BytePos, to_pos: BytePos, m: &str) -> FatalError { + self.fatal_span(syntax_pos::mk_sp(from_pos, to_pos), m) + } + + /// Report a lexical error spanning [`from_pos`, `to_pos`). + fn err_span_(&self, from_pos: BytePos, to_pos: BytePos, m: &str) { + self.err_span(syntax_pos::mk_sp(from_pos, to_pos), m) + } + + /// Report a lexical error spanning [`from_pos`, `to_pos`), appending an + /// escaped character to the error message + fn fatal_span_char(&self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) -> FatalError { + let mut m = m.to_string(); + m.push_str(": "); + for c in c.escape_default() { + m.push(c) + } + self.fatal_span_(from_pos, to_pos, &m[..]) + } + fn struct_fatal_span_char(&self, + from_pos: BytePos, + to_pos: BytePos, + m: &str, + c: char) + -> DiagnosticBuilder<'a> { + let mut m = m.to_string(); + m.push_str(": "); + for c in c.escape_default() { + m.push(c) + } + self.span_diagnostic.struct_span_fatal(syntax_pos::mk_sp(from_pos, to_pos), &m[..]) + } + + /// Report a lexical error spanning [`from_pos`, `to_pos`), appending an + /// escaped character to the error message + fn err_span_char(&self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) { + let mut m = m.to_string(); + m.push_str(": "); + for c in c.escape_default() { + m.push(c) + } + self.err_span_(from_pos, to_pos, &m[..]); + } + fn struct_err_span_char(&self, + from_pos: BytePos, + to_pos: BytePos, + m: &str, + c: char) + -> DiagnosticBuilder<'a> { + let mut m = m.to_string(); + m.push_str(": "); + for c in c.escape_default() { + m.push(c) + } + self.span_diagnostic.struct_span_err(syntax_pos::mk_sp(from_pos, to_pos), &m[..]) + } + + /// Report a lexical error spanning [`from_pos`, `to_pos`), appending the + /// offending string to the error message + fn fatal_span_verbose(&self, from_pos: BytePos, to_pos: BytePos, mut m: String) -> FatalError { + m.push_str(": "); + let from = self.byte_offset(from_pos).to_usize(); + let to = self.byte_offset(to_pos).to_usize(); + m.push_str(&self.source_text[from..to]); + self.fatal_span_(from_pos, to_pos, &m[..]) + } + + /// Advance peek_tok and peek_span to refer to the next token, and + /// possibly update the interner. + fn advance_token(&mut self) -> Result<(), ()> { + match self.scan_whitespace_or_comment() { + Some(comment) => { + self.peek_span = comment.sp; + self.peek_tok = comment.tok; + } + None => { + if self.is_eof() { + self.peek_tok = token::Eof; + self.peek_span = syntax_pos::mk_sp(self.filemap.end_pos, self.filemap.end_pos); + } else { + let start_bytepos = self.pos; + self.peek_tok = try!(self.next_token_inner()); + self.peek_span = syntax_pos::mk_sp(start_bytepos, self.pos); + }; + } + } + Ok(()) + } + + fn byte_offset(&self, pos: BytePos) -> BytePos { + (pos - self.filemap.start_pos) + } + + /// Calls `f` with a string slice of the source text spanning from `start` + /// up to but excluding `self.pos`, meaning the slice does not include + /// the character `self.ch`. + pub fn with_str_from(&self, start: BytePos, f: F) -> T + where F: FnOnce(&str) -> T + { + self.with_str_from_to(start, self.pos, f) + } + + /// Create a Name from a given offset to the current offset, each + /// adjusted 1 towards each other (assumes that on either side there is a + /// single-byte delimiter). + pub fn name_from(&self, start: BytePos) -> ast::Name { + debug!("taking an ident from {:?} to {:?}", start, self.pos); + self.with_str_from(start, Symbol::intern) + } + + /// As name_from, with an explicit endpoint. + pub fn name_from_to(&self, start: BytePos, end: BytePos) -> ast::Name { + debug!("taking an ident from {:?} to {:?}", start, end); + self.with_str_from_to(start, end, Symbol::intern) + } + + /// Calls `f` with a string slice of the source text spanning from `start` + /// up to but excluding `end`. + fn with_str_from_to(&self, start: BytePos, end: BytePos, f: F) -> T + where F: FnOnce(&str) -> T + { + f(&self.source_text[self.byte_offset(start).to_usize()..self.byte_offset(end).to_usize()]) + } + + /// Converts CRLF to LF in the given string, raising an error on bare CR. + fn translate_crlf<'b>(&self, start: BytePos, s: &'b str, errmsg: &'b str) -> Cow<'b, str> { + let mut i = 0; + while i < s.len() { + let ch = char_at(s, i); + let next = i + ch.len_utf8(); + if ch == '\r' { + if next < s.len() && char_at(s, next) == '\n' { + return translate_crlf_(self, start, s, errmsg, i).into(); + } + let pos = start + BytePos(i as u32); + let end_pos = start + BytePos(next as u32); + self.err_span_(pos, end_pos, errmsg); + } + i = next; + } + return s.into(); + + fn translate_crlf_(rdr: &StringReader, + start: BytePos, + s: &str, + errmsg: &str, + mut i: usize) + -> String { + let mut buf = String::with_capacity(s.len()); + let mut j = 0; + while i < s.len() { + let ch = char_at(s, i); + let next = i + ch.len_utf8(); + if ch == '\r' { + if j < i { + buf.push_str(&s[j..i]); + } + j = next; + if next >= s.len() || char_at(s, next) != '\n' { + let pos = start + BytePos(i as u32); + let end_pos = start + BytePos(next as u32); + rdr.err_span_(pos, end_pos, errmsg); + } + } + i = next; + } + if j < s.len() { + buf.push_str(&s[j..]); + } + buf + } + } + + + /// Advance the StringReader by one character. If a newline is + /// discovered, add it to the FileMap's list of line start offsets. + pub fn bump(&mut self) { + let new_pos = self.next_pos; + let new_byte_offset = self.byte_offset(new_pos).to_usize(); + if new_byte_offset < self.source_text.len() { + let old_ch_is_newline = self.ch.unwrap() == '\n'; + let new_ch = char_at(&self.source_text, new_byte_offset); + let new_ch_len = new_ch.len_utf8(); + + self.ch = Some(new_ch); + self.pos = new_pos; + self.next_pos = new_pos + Pos::from_usize(new_ch_len); + if old_ch_is_newline { + if self.save_new_lines { + self.filemap.next_line(self.pos); + } + self.col = CharPos(0); + } else { + self.col = self.col + CharPos(1); + } + if new_ch_len > 1 { + self.filemap.record_multibyte_char(self.pos, new_ch_len); + } + } else { + self.ch = None; + self.pos = new_pos; + } + } + + pub fn nextch(&self) -> Option { + let offset = self.byte_offset(self.next_pos).to_usize(); + if offset < self.source_text.len() { + Some(char_at(&self.source_text, offset)) + } else { + None + } + } + + pub fn nextch_is(&self, c: char) -> bool { + self.nextch() == Some(c) + } + + pub fn nextnextch(&self) -> Option { + let offset = self.byte_offset(self.next_pos).to_usize(); + let s = &self.source_text[..]; + if offset >= s.len() { + return None; + } + let next = offset + char_at(s, offset).len_utf8(); + if next < s.len() { + Some(char_at(s, next)) + } else { + None + } + } + + pub fn nextnextch_is(&self, c: char) -> bool { + self.nextnextch() == Some(c) + } + + /// Eats *, if possible. + fn scan_optional_raw_name(&mut self) -> Option { + if !ident_start(self.ch) { + return None; + } + let start = self.pos; + while ident_continue(self.ch) { + self.bump(); + } + + self.with_str_from(start, |string| { + if string == "_" { + None + } else { + Some(Symbol::intern(string)) + } + }) + } + + /// PRECONDITION: self.ch is not whitespace + /// Eats any kind of comment. + fn scan_comment(&mut self) -> Option { + if let Some(c) = self.ch { + if c.is_whitespace() { + self.span_diagnostic.span_err(syntax_pos::mk_sp(self.pos, self.pos), + "called consume_any_line_comment, but there \ + was whitespace"); + } + } + + if self.ch_is('/') { + match self.nextch() { + Some('/') => { + self.bump(); + self.bump(); + + // line comments starting with "///" or "//!" are doc-comments + let doc_comment = self.ch_is('/') || self.ch_is('!'); + let start_bpos = self.pos - BytePos(2); + + while !self.is_eof() { + match self.ch.unwrap() { + '\n' => break, + '\r' => { + if self.nextch_is('\n') { + // CRLF + break; + } else if doc_comment { + self.err_span_(self.pos, + self.next_pos, + "bare CR not allowed in doc-comment"); + } + } + _ => (), + } + self.bump(); + } + + return if doc_comment { + self.with_str_from(start_bpos, |string| { + // comments with only more "/"s are not doc comments + let tok = if is_doc_comment(string) { + token::DocComment(Symbol::intern(string)) + } else { + token::Comment + }; + + Some(TokenAndSpan { + tok: tok, + sp: syntax_pos::mk_sp(start_bpos, self.pos), + }) + }) + } else { + Some(TokenAndSpan { + tok: token::Comment, + sp: syntax_pos::mk_sp(start_bpos, self.pos), + }) + }; + } + Some('*') => { + self.bump(); + self.bump(); + self.scan_block_comment() + } + _ => None, + } + } else if self.ch_is('#') { + if self.nextch_is('!') { + + // Parse an inner attribute. + if self.nextnextch_is('[') { + return None; + } + + // I guess this is the only way to figure out if + // we're at the beginning of the file... + let cmap = CodeMap::new(); + cmap.files.borrow_mut().push(self.filemap.clone()); + let loc = cmap.lookup_char_pos_adj(self.pos); + debug!("Skipping a shebang"); + if loc.line == 1 && loc.col == CharPos(0) { + // FIXME: Add shebang "token", return it + let start = self.pos; + while !self.ch_is('\n') && !self.is_eof() { + self.bump(); + } + return Some(TokenAndSpan { + tok: token::Shebang(self.name_from(start)), + sp: syntax_pos::mk_sp(start, self.pos), + }); + } + } + None + } else { + None + } + } + + /// If there is whitespace, shebang, or a comment, scan it. Otherwise, + /// return None. + fn scan_whitespace_or_comment(&mut self) -> Option { + match self.ch.unwrap_or('\0') { + // # to handle shebang at start of file -- this is the entry point + // for skipping over all "junk" + '/' | '#' => { + let c = self.scan_comment(); + debug!("scanning a comment {:?}", c); + c + }, + c if is_pattern_whitespace(Some(c)) => { + let start_bpos = self.pos; + while is_pattern_whitespace(self.ch) { + self.bump(); + } + let c = Some(TokenAndSpan { + tok: token::Whitespace, + sp: syntax_pos::mk_sp(start_bpos, self.pos), + }); + debug!("scanning whitespace: {:?}", c); + c + } + _ => None, + } + } + + /// Might return a sugared-doc-attr + fn scan_block_comment(&mut self) -> Option { + // block comments starting with "/**" or "/*!" are doc-comments + let is_doc_comment = self.ch_is('*') || self.ch_is('!'); + let start_bpos = self.pos - BytePos(2); + + let mut level: isize = 1; + let mut has_cr = false; + while level > 0 { + if self.is_eof() { + let msg = if is_doc_comment { + "unterminated block doc-comment" + } else { + "unterminated block comment" + }; + let last_bpos = self.pos; + panic!(self.fatal_span_(start_bpos, last_bpos, msg)); + } + let n = self.ch.unwrap(); + match n { + '/' if self.nextch_is('*') => { + level += 1; + self.bump(); + } + '*' if self.nextch_is('/') => { + level -= 1; + self.bump(); + } + '\r' => { + has_cr = true; + } + _ => (), + } + self.bump(); + } + + self.with_str_from(start_bpos, |string| { + // but comments with only "*"s between two "/"s are not + let tok = if is_block_doc_comment(string) { + let string = if has_cr { + self.translate_crlf(start_bpos, + string, + "bare CR not allowed in block doc-comment") + } else { + string.into() + }; + token::DocComment(Symbol::intern(&string[..])) + } else { + token::Comment + }; + + Some(TokenAndSpan { + tok: tok, + sp: syntax_pos::mk_sp(start_bpos, self.pos), + }) + }) + } + + /// Scan through any digits (base `scan_radix`) or underscores, + /// and return how many digits there were. + /// + /// `real_radix` represents the true radix of the number we're + /// interested in, and errors will be emitted for any digits + /// between `real_radix` and `scan_radix`. + fn scan_digits(&mut self, real_radix: u32, scan_radix: u32) -> usize { + assert!(real_radix <= scan_radix); + let mut len = 0; + loop { + let c = self.ch; + if c == Some('_') { + debug!("skipping a _"); + self.bump(); + continue; + } + match c.and_then(|cc| cc.to_digit(scan_radix)) { + Some(_) => { + debug!("{:?} in scan_digits", c); + // check that the hypothetical digit is actually + // in range for the true radix + if c.unwrap().to_digit(real_radix).is_none() { + self.err_span_(self.pos, + self.next_pos, + &format!("invalid digit for a base {} literal", real_radix)); + } + len += 1; + self.bump(); + } + _ => return len, + } + } + } + + /// Lex a LIT_INTEGER or a LIT_FLOAT + fn scan_number(&mut self, c: char) -> token::Lit { + let num_digits; + let mut base = 10; + let start_bpos = self.pos; + + self.bump(); + + if c == '0' { + match self.ch.unwrap_or('\0') { + 'b' => { + self.bump(); + base = 2; + num_digits = self.scan_digits(2, 10); + } + 'o' => { + self.bump(); + base = 8; + num_digits = self.scan_digits(8, 10); + } + 'x' => { + self.bump(); + base = 16; + num_digits = self.scan_digits(16, 16); + } + '0'...'9' | '_' | '.' => { + num_digits = self.scan_digits(10, 10) + 1; + } + _ => { + // just a 0 + return token::Integer(self.name_from(start_bpos)); + } + } + } else if c.is_digit(10) { + num_digits = self.scan_digits(10, 10) + 1; + } else { + num_digits = 0; + } + + if num_digits == 0 { + self.err_span_(start_bpos, + self.pos, + "no valid digits found for number"); + return token::Integer(Symbol::intern("0")); + } + + // might be a float, but don't be greedy if this is actually an + // integer literal followed by field/method access or a range pattern + // (`0..2` and `12.foo()`) + if self.ch_is('.') && !self.nextch_is('.') && + !UnicodeXID::is_xid_start(self.nextch().unwrap_or('\0')) + { + // might have stuff after the ., and if it does, it needs to start + // with a number + self.bump(); + if self.ch.unwrap_or('\0').is_digit(10) { + self.scan_digits(10, 10); + self.scan_float_exponent(); + } + let pos = self.pos; + self.check_float_base(start_bpos, pos, base); + return token::Float(self.name_from(start_bpos)); + } else { + // it might be a float if it has an exponent + if self.ch_is('e') || self.ch_is('E') { + self.scan_float_exponent(); + let pos = self.pos; + self.check_float_base(start_bpos, pos, base); + return token::Float(self.name_from(start_bpos)); + } + // but we certainly have an integer! + return token::Integer(self.name_from(start_bpos)); + } + } + + /// Scan over `n_digits` hex digits, stopping at `delim`, reporting an + /// error if too many or too few digits are encountered. + fn scan_hex_digits(&mut self, n_digits: usize, delim: char, below_0x7f_only: bool) -> bool { + debug!("scanning {} digits until {:?}", n_digits, delim); + let start_bpos = self.pos; + let mut accum_int = 0; + + let mut valid = true; + for _ in 0..n_digits { + if self.is_eof() { + let last_bpos = self.pos; + panic!(self.fatal_span_(start_bpos, + last_bpos, + "unterminated numeric character escape")); + } + if self.ch_is(delim) { + let last_bpos = self.pos; + self.err_span_(start_bpos, + last_bpos, + "numeric character escape is too short"); + valid = false; + break; + } + let c = self.ch.unwrap_or('\x00'); + accum_int *= 16; + accum_int += c.to_digit(16).unwrap_or_else(|| { + self.err_span_char(self.pos, + self.next_pos, + "invalid character in numeric character escape", + c); + + valid = false; + 0 + }); + self.bump(); + } + + if below_0x7f_only && accum_int >= 0x80 { + self.err_span_(start_bpos, + self.pos, + "this form of character escape may only be used with characters in \ + the range [\\x00-\\x7f]"); + valid = false; + } + + match char::from_u32(accum_int) { + Some(_) => valid, + None => { + let last_bpos = self.pos; + self.err_span_(start_bpos, last_bpos, "invalid numeric character escape"); + false + } + } + } + + /// Scan for a single (possibly escaped) byte or char + /// in a byte, (non-raw) byte string, char, or (non-raw) string literal. + /// `start` is the position of `first_source_char`, which is already consumed. + /// + /// Returns true if there was a valid char/byte, false otherwise. + fn scan_char_or_byte(&mut self, + start: BytePos, + first_source_char: char, + ascii_only: bool, + delim: char) + -> bool { + match first_source_char { + '\\' => { + // '\X' for some X must be a character constant: + let escaped = self.ch; + let escaped_pos = self.pos; + self.bump(); + match escaped { + None => {} // EOF here is an error that will be checked later. + Some(e) => { + return match e { + 'n' | 'r' | 't' | '\\' | '\'' | '"' | '0' => true, + 'x' => self.scan_byte_escape(delim, !ascii_only), + 'u' => { + let valid = if self.ch_is('{') { + self.scan_unicode_escape(delim) && !ascii_only + } else { + let span = syntax_pos::mk_sp(start, self.pos); + self.span_diagnostic + .struct_span_err(span, "incorrect unicode escape sequence") + .span_help(span, + "format of unicode escape sequences is \ + `\\u{…}`") + .emit(); + false + }; + if ascii_only { + self.err_span_(start, + self.pos, + "unicode escape sequences cannot be used as a \ + byte or in a byte string"); + } + valid + + } + '\n' if delim == '"' => { + self.consume_whitespace(); + true + } + '\r' if delim == '"' && self.ch_is('\n') => { + self.consume_whitespace(); + true + } + c => { + let pos = self.pos; + let mut err = self.struct_err_span_char(escaped_pos, + pos, + if ascii_only { + "unknown byte escape" + } else { + "unknown character \ + escape" + }, + c); + if e == '\r' { + err.span_help(syntax_pos::mk_sp(escaped_pos, pos), + "this is an isolated carriage return; consider \ + checking your editor and version control \ + settings"); + } + if (e == '{' || e == '}') && !ascii_only { + err.span_help(syntax_pos::mk_sp(escaped_pos, pos), + "if used in a formatting string, curly braces \ + are escaped with `{{` and `}}`"); + } + err.emit(); + false + } + } + } + } + } + '\t' | '\n' | '\r' | '\'' if delim == '\'' => { + let pos = self.pos; + self.err_span_char(start, + pos, + if ascii_only { + "byte constant must be escaped" + } else { + "character constant must be escaped" + }, + first_source_char); + return false; + } + '\r' => { + if self.ch_is('\n') { + self.bump(); + return true; + } else { + self.err_span_(start, + self.pos, + "bare CR not allowed in string, use \\r instead"); + return false; + } + } + _ => { + if ascii_only && first_source_char > '\x7F' { + let pos = self.pos; + self.err_span_(start, + pos, + "byte constant must be ASCII. Use a \\xHH escape for a \ + non-ASCII byte"); + return false; + } + } + } + true + } + + /// Scan over a \u{...} escape + /// + /// At this point, we have already seen the \ and the u, the { is the current character. We + /// will read at least one digit, and up to 6, and pass over the }. + fn scan_unicode_escape(&mut self, delim: char) -> bool { + self.bump(); // past the { + let start_bpos = self.pos; + let mut count = 0; + let mut accum_int = 0; + let mut valid = true; + + while !self.ch_is('}') && count <= 6 { + let c = match self.ch { + Some(c) => c, + None => { + panic!(self.fatal_span_(start_bpos, + self.pos, + "unterminated unicode escape (found EOF)")); + } + }; + accum_int *= 16; + accum_int += c.to_digit(16).unwrap_or_else(|| { + if c == delim { + panic!(self.fatal_span_(self.pos, + self.next_pos, + "unterminated unicode escape (needed a `}`)")); + } else { + self.err_span_char(self.pos, + self.next_pos, + "invalid character in unicode escape", + c); + } + valid = false; + 0 + }); + self.bump(); + count += 1; + } + + if count > 6 { + self.err_span_(start_bpos, + self.pos, + "overlong unicode escape (can have at most 6 hex digits)"); + valid = false; + } + + if valid && (char::from_u32(accum_int).is_none() || count == 0) { + self.err_span_(start_bpos, + self.pos, + "invalid unicode character escape"); + valid = false; + } + + self.bump(); // past the ending } + valid + } + + /// Scan over a float exponent. + fn scan_float_exponent(&mut self) { + if self.ch_is('e') || self.ch_is('E') { + self.bump(); + if self.ch_is('-') || self.ch_is('+') { + self.bump(); + } + if self.scan_digits(10, 10) == 0 { + self.err_span_(self.pos, + self.next_pos, + "expected at least one digit in exponent") + } + } + } + + /// Check that a base is valid for a floating literal, emitting a nice + /// error if it isn't. + fn check_float_base(&mut self, start_bpos: BytePos, last_bpos: BytePos, base: usize) { + match base { + 16 => { + self.err_span_(start_bpos, + last_bpos, + "hexadecimal float literal is not supported") + } + 8 => { + self.err_span_(start_bpos, + last_bpos, + "octal float literal is not supported") + } + 2 => { + self.err_span_(start_bpos, + last_bpos, + "binary float literal is not supported") + } + _ => (), + } + } + + fn binop(&mut self, op: token::BinOpToken) -> token::Token { + self.bump(); + if self.ch_is('=') { + self.bump(); + return token::BinOpEq(op); + } else { + return token::BinOp(op); + } + } + + /// Return the next token from the string, advances the input past that + /// token, and updates the interner + fn next_token_inner(&mut self) -> Result { + let c = self.ch; + if ident_start(c) && + match (c.unwrap(), self.nextch(), self.nextnextch()) { + // Note: r as in r" or r#" is part of a raw string literal, + // b as in b' is part of a byte literal. + // They are not identifiers, and are handled further down. + ('r', Some('"'), _) | + ('r', Some('#'), _) | + ('b', Some('"'), _) | + ('b', Some('\''), _) | + ('b', Some('r'), Some('"')) | + ('b', Some('r'), Some('#')) => false, + _ => true, + } { + let start = self.pos; + while ident_continue(self.ch) { + self.bump(); + } + + return Ok(self.with_str_from(start, |string| { + if string == "_" { + token::Underscore + } else { + // FIXME: perform NFKC normalization here. (Issue #2253) + token::Ident(Ident::from_str(string)) + } + })); + } + + if is_dec_digit(c) { + let num = self.scan_number(c.unwrap()); + let suffix = self.scan_optional_raw_name(); + debug!("next_token_inner: scanned number {:?}, {:?}", num, suffix); + return Ok(token::Literal(num, suffix)); + } + + match c.expect("next_token_inner called at EOF") { + // One-byte tokens. + ';' => { + self.bump(); + return Ok(token::Semi); + } + ',' => { + self.bump(); + return Ok(token::Comma); + } + '.' => { + self.bump(); + return if self.ch_is('.') { + self.bump(); + if self.ch_is('.') { + self.bump(); + Ok(token::DotDotDot) + } else { + Ok(token::DotDot) + } + } else { + Ok(token::Dot) + }; + } + '(' => { + self.bump(); + return Ok(token::OpenDelim(token::Paren)); + } + ')' => { + self.bump(); + return Ok(token::CloseDelim(token::Paren)); + } + '{' => { + self.bump(); + return Ok(token::OpenDelim(token::Brace)); + } + '}' => { + self.bump(); + return Ok(token::CloseDelim(token::Brace)); + } + '[' => { + self.bump(); + return Ok(token::OpenDelim(token::Bracket)); + } + ']' => { + self.bump(); + return Ok(token::CloseDelim(token::Bracket)); + } + '@' => { + self.bump(); + return Ok(token::At); + } + '#' => { + self.bump(); + return Ok(token::Pound); + } + '~' => { + self.bump(); + return Ok(token::Tilde); + } + '?' => { + self.bump(); + return Ok(token::Question); + } + ':' => { + self.bump(); + if self.ch_is(':') { + self.bump(); + return Ok(token::ModSep); + } else { + return Ok(token::Colon); + } + } + + '$' => { + self.bump(); + return Ok(token::Dollar); + } + + // Multi-byte tokens. + '=' => { + self.bump(); + if self.ch_is('=') { + self.bump(); + return Ok(token::EqEq); + } else if self.ch_is('>') { + self.bump(); + return Ok(token::FatArrow); + } else { + return Ok(token::Eq); + } + } + '!' => { + self.bump(); + if self.ch_is('=') { + self.bump(); + return Ok(token::Ne); + } else { + return Ok(token::Not); + } + } + '<' => { + self.bump(); + match self.ch.unwrap_or('\x00') { + '=' => { + self.bump(); + return Ok(token::Le); + } + '<' => { + return Ok(self.binop(token::Shl)); + } + '-' => { + self.bump(); + match self.ch.unwrap_or('\x00') { + _ => { + return Ok(token::LArrow); + } + } + } + _ => { + return Ok(token::Lt); + } + } + } + '>' => { + self.bump(); + match self.ch.unwrap_or('\x00') { + '=' => { + self.bump(); + return Ok(token::Ge); + } + '>' => { + return Ok(self.binop(token::Shr)); + } + _ => { + return Ok(token::Gt); + } + } + } + '\'' => { + // Either a character constant 'a' OR a lifetime name 'abc + let start_with_quote = self.pos; + self.bump(); + let start = self.pos; + + // the eof will be picked up by the final `'` check below + let c2 = self.ch.unwrap_or('\x00'); + self.bump(); + + // If the character is an ident start not followed by another single + // quote, then this is a lifetime name: + if ident_start(Some(c2)) && !self.ch_is('\'') { + while ident_continue(self.ch) { + self.bump(); + } + // lifetimes shouldn't end with a single quote + // if we find one, then this is an invalid character literal + if self.ch_is('\'') { + panic!(self.fatal_span_verbose( + start_with_quote, self.next_pos, + String::from("character literal may only contain one codepoint"))); + + } + + // Include the leading `'` in the real identifier, for macro + // expansion purposes. See #12512 for the gory details of why + // this is necessary. + let ident = self.with_str_from(start, |lifetime_name| { + Ident::from_str(&format!("'{}", lifetime_name)) + }); + + // Conjure up a "keyword checking ident" to make sure that + // the lifetime name is not a keyword. + let keyword_checking_ident = self.with_str_from(start, |lifetime_name| { + Ident::from_str(lifetime_name) + }); + let keyword_checking_token = &token::Ident(keyword_checking_ident); + let last_bpos = self.pos; + if keyword_checking_token.is_any_keyword() && + !keyword_checking_token.is_keyword(keywords::Static) { + self.err_span_(start, last_bpos, "lifetimes cannot use keyword names"); + } + + return Ok(token::Lifetime(ident)); + } + + let valid = self.scan_char_or_byte(start, + c2, + // ascii_only = + false, + '\''); + + if !self.ch_is('\'') { + panic!(self.fatal_span_verbose( + start_with_quote, self.pos, + String::from("character literal may only contain one codepoint"))); + } + + let id = if valid { + self.name_from(start) + } else { + Symbol::intern("0") + }; + self.bump(); // advance ch past token + let suffix = self.scan_optional_raw_name(); + return Ok(token::Literal(token::Char(id), suffix)); + } + 'b' => { + self.bump(); + let lit = match self.ch { + Some('\'') => self.scan_byte(), + Some('"') => self.scan_byte_string(), + Some('r') => self.scan_raw_byte_string(), + _ => unreachable!(), // Should have been a token::Ident above. + }; + let suffix = self.scan_optional_raw_name(); + return Ok(token::Literal(lit, suffix)); + } + '"' => { + let start_bpos = self.pos; + let mut valid = true; + self.bump(); + while !self.ch_is('"') { + if self.is_eof() { + let last_bpos = self.pos; + panic!(self.fatal_span_(start_bpos, + last_bpos, + "unterminated double quote string")); + } + + let ch_start = self.pos; + let ch = self.ch.unwrap(); + self.bump(); + valid &= self.scan_char_or_byte(ch_start, + ch, + // ascii_only = + false, + '"'); + } + // adjust for the ASCII " at the start of the literal + let id = if valid { + self.name_from(start_bpos + BytePos(1)) + } else { + Symbol::intern("??") + }; + self.bump(); + let suffix = self.scan_optional_raw_name(); + return Ok(token::Literal(token::Str_(id), suffix)); + } + 'r' => { + let start_bpos = self.pos; + self.bump(); + let mut hash_count = 0; + while self.ch_is('#') { + self.bump(); + hash_count += 1; + } + + if self.is_eof() { + let last_bpos = self.pos; + panic!(self.fatal_span_(start_bpos, last_bpos, "unterminated raw string")); + } else if !self.ch_is('"') { + let last_bpos = self.pos; + let curr_char = self.ch.unwrap(); + panic!(self.fatal_span_char(start_bpos, + last_bpos, + "found invalid character; only `#` is allowed \ + in raw string delimitation", + curr_char)); + } + self.bump(); + let content_start_bpos = self.pos; + let mut content_end_bpos; + let mut valid = true; + 'outer: loop { + if self.is_eof() { + let last_bpos = self.pos; + panic!(self.fatal_span_(start_bpos, last_bpos, "unterminated raw string")); + } + // if self.ch_is('"') { + // content_end_bpos = self.pos; + // for _ in 0..hash_count { + // self.bump(); + // if !self.ch_is('#') { + // continue 'outer; + let c = self.ch.unwrap(); + match c { + '"' => { + content_end_bpos = self.pos; + for _ in 0..hash_count { + self.bump(); + if !self.ch_is('#') { + continue 'outer; + } + } + break; + } + '\r' => { + if !self.nextch_is('\n') { + let last_bpos = self.pos; + self.err_span_(start_bpos, + last_bpos, + "bare CR not allowed in raw string, use \\r \ + instead"); + valid = false; + } + } + _ => (), + } + self.bump(); + } + self.bump(); + let id = if valid { + self.name_from_to(content_start_bpos, content_end_bpos) + } else { + Symbol::intern("??") + }; + let suffix = self.scan_optional_raw_name(); + return Ok(token::Literal(token::StrRaw(id, hash_count), suffix)); + } + '-' => { + if self.nextch_is('>') { + self.bump(); + self.bump(); + return Ok(token::RArrow); + } else { + return Ok(self.binop(token::Minus)); + } + } + '&' => { + if self.nextch_is('&') { + self.bump(); + self.bump(); + return Ok(token::AndAnd); + } else { + return Ok(self.binop(token::And)); + } + } + '|' => { + match self.nextch() { + Some('|') => { + self.bump(); + self.bump(); + return Ok(token::OrOr); + } + _ => { + return Ok(self.binop(token::Or)); + } + } + } + '+' => { + return Ok(self.binop(token::Plus)); + } + '*' => { + return Ok(self.binop(token::Star)); + } + '/' => { + return Ok(self.binop(token::Slash)); + } + '^' => { + return Ok(self.binop(token::Caret)); + } + '%' => { + return Ok(self.binop(token::Percent)); + } + c => { + let last_bpos = self.pos; + let bpos = self.next_pos; + let mut err = self.struct_fatal_span_char(last_bpos, + bpos, + "unknown start of token", + c); + unicode_chars::check_for_substitution(&self, c, &mut err); + self.fatal_errs.push(err); + Err(()) + } + } + } + + fn consume_whitespace(&mut self) { + while is_pattern_whitespace(self.ch) && !self.is_eof() { + self.bump(); + } + } + + fn read_to_eol(&mut self) -> String { + let mut val = String::new(); + while !self.ch_is('\n') && !self.is_eof() { + val.push(self.ch.unwrap()); + self.bump(); + } + if self.ch_is('\n') { + self.bump(); + } + return val; + } + + fn read_one_line_comment(&mut self) -> String { + let val = self.read_to_eol(); + assert!((val.as_bytes()[0] == b'/' && val.as_bytes()[1] == b'/') || + (val.as_bytes()[0] == b'#' && val.as_bytes()[1] == b'!')); + return val; + } + + fn consume_non_eol_whitespace(&mut self) { + while is_pattern_whitespace(self.ch) && !self.ch_is('\n') && !self.is_eof() { + self.bump(); + } + } + + fn peeking_at_comment(&self) -> bool { + (self.ch_is('/') && self.nextch_is('/')) || (self.ch_is('/') && self.nextch_is('*')) || + // consider shebangs comments, but not inner attributes + (self.ch_is('#') && self.nextch_is('!') && !self.nextnextch_is('[')) + } + + fn scan_byte(&mut self) -> token::Lit { + self.bump(); + let start = self.pos; + + // the eof will be picked up by the final `'` check below + let c2 = self.ch.unwrap_or('\x00'); + self.bump(); + + let valid = self.scan_char_or_byte(start, + c2, + // ascii_only = + true, + '\''); + if !self.ch_is('\'') { + // Byte offsetting here is okay because the + // character before position `start` are an + // ascii single quote and ascii 'b'. + let pos = self.pos; + panic!(self.fatal_span_verbose(start - BytePos(2), + pos, + "unterminated byte constant".to_string())); + } + + let id = if valid { + self.name_from(start) + } else { + Symbol::intern("?") + }; + self.bump(); // advance ch past token + return token::Byte(id); + } + + fn scan_byte_escape(&mut self, delim: char, below_0x7f_only: bool) -> bool { + self.scan_hex_digits(2, delim, below_0x7f_only) + } + + fn scan_byte_string(&mut self) -> token::Lit { + self.bump(); + let start = self.pos; + let mut valid = true; + + while !self.ch_is('"') { + if self.is_eof() { + let pos = self.pos; + panic!(self.fatal_span_(start, pos, "unterminated double quote byte string")); + } + + let ch_start = self.pos; + let ch = self.ch.unwrap(); + self.bump(); + valid &= self.scan_char_or_byte(ch_start, + ch, + // ascii_only = + true, + '"'); + } + let id = if valid { + self.name_from(start) + } else { + Symbol::intern("??") + }; + self.bump(); + return token::ByteStr(id); + } + + fn scan_raw_byte_string(&mut self) -> token::Lit { + let start_bpos = self.pos; + self.bump(); + let mut hash_count = 0; + while self.ch_is('#') { + self.bump(); + hash_count += 1; + } + + if self.is_eof() { + let pos = self.pos; + panic!(self.fatal_span_(start_bpos, pos, "unterminated raw string")); + } else if !self.ch_is('"') { + let pos = self.pos; + let ch = self.ch.unwrap(); + panic!(self.fatal_span_char(start_bpos, + pos, + "found invalid character; only `#` is allowed in raw \ + string delimitation", + ch)); + } + self.bump(); + let content_start_bpos = self.pos; + let mut content_end_bpos; + 'outer: loop { + match self.ch { + None => { + let pos = self.pos; + panic!(self.fatal_span_(start_bpos, pos, "unterminated raw string")) + } + Some('"') => { + content_end_bpos = self.pos; + for _ in 0..hash_count { + self.bump(); + if !self.ch_is('#') { + continue 'outer; + } + } + break; + } + Some(c) => { + if c > '\x7F' { + let pos = self.pos; + self.err_span_char(pos, pos, "raw byte string must be ASCII", c); + } + } + } + self.bump(); + } + self.bump(); + return token::ByteStrRaw(self.name_from_to(content_start_bpos, content_end_bpos), + hash_count); + } +} + +// This tests the character for the unicode property 'PATTERN_WHITE_SPACE' which +// is guaranteed to be forward compatible. http://unicode.org/reports/tr31/#R3 +pub fn is_pattern_whitespace(c: Option) -> bool { + // Please note, the function signature is the one which uses rustc_unicode + // but the function body is from the prior version. + match c.unwrap_or('\x00') { + ' ' | '\n' | '\t' | '\r' => true, + _ => false + } +} + +fn in_range(c: Option, lo: char, hi: char) -> bool { + match c { + Some(c) => lo <= c && c <= hi, + _ => false, + } +} + +fn is_dec_digit(c: Option) -> bool { + return in_range(c, '0', '9'); +} + +pub fn is_doc_comment(s: &str) -> bool { + let res = (s.starts_with("///") && *s.as_bytes().get(3).unwrap_or(&b' ') != b'/') || + s.starts_with("//!"); + debug!("is {:?} a doc comment? {}", s, res); + res +} + +pub fn is_block_doc_comment(s: &str) -> bool { + // Prevent `/**/` from being parsed as a doc comment + let res = ((s.starts_with("/**") && *s.as_bytes().get(3).unwrap_or(&b' ') != b'*') || + s.starts_with("/*!")) && s.len() >= 5; + debug!("is {:?} a doc comment? {}", s, res); + res +} + +fn ident_start(c: Option) -> bool { + let c = match c { + Some(c) => c, + None => return false, + }; + + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c > '\x7f' && UnicodeXID::is_xid_start(c)) +} + +fn ident_continue(c: Option) -> bool { + let c = match c { + Some(c) => c, + None => return false, + }; + + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || + (c > '\x7f' && UnicodeXID::is_xid_continue(c)) +} + +#[cfg(test)] +mod tests { + use super::*; + + use ast::Ident; + use symbol::Symbol; + use syntax_pos::{BytePos, Span, NO_EXPANSION}; + use codemap::CodeMap; + use errors; + use parse::token; + use std::io; + use std::rc::Rc; + + fn mk_sh(cm: Rc) -> errors::Handler { + // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. + let emitter = errors::emitter::EmitterWriter::new(Box::new(io::sink()), + Some(cm)); + errors::Handler::with_emitter(true, false, Box::new(emitter)) + } + + // open a string reader for the given string + fn setup<'a>(cm: &CodeMap, + span_handler: &'a errors::Handler, + teststr: String) + -> StringReader<'a> { + let fm = cm.new_filemap("zebra.rs".to_string(), None, teststr); + StringReader::new(span_handler, fm) + } + + #[test] + fn t1() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + let mut string_reader = setup(&cm, + &sh, + "/* my source file */ fn main() { println!(\"zebra\"); }\n" + .to_string()); + let id = Ident::from_str("fn"); + assert_eq!(string_reader.next_token().tok, token::Comment); + assert_eq!(string_reader.next_token().tok, token::Whitespace); + let tok1 = string_reader.next_token(); + let tok2 = TokenAndSpan { + tok: token::Ident(id), + sp: Span { + lo: BytePos(21), + hi: BytePos(23), + expn_id: NO_EXPANSION, + }, + }; + assert_eq!(tok1, tok2); + assert_eq!(string_reader.next_token().tok, token::Whitespace); + // the 'main' id is already read: + assert_eq!(string_reader.pos.clone(), BytePos(28)); + // read another token: + let tok3 = string_reader.next_token(); + let tok4 = TokenAndSpan { + tok: token::Ident(Ident::from_str("main")), + sp: Span { + lo: BytePos(24), + hi: BytePos(28), + expn_id: NO_EXPANSION, + }, + }; + assert_eq!(tok3, tok4); + // the lparen is already read: + assert_eq!(string_reader.pos.clone(), BytePos(29)) + } + + // check that the given reader produces the desired stream + // of tokens (stop checking after exhausting the expected vec) + fn check_tokenization(mut string_reader: StringReader, expected: Vec) { + for expected_tok in &expected { + assert_eq!(&string_reader.next_token().tok, expected_tok); + } + } + + // make the identifier by looking up the string in the interner + fn mk_ident(id: &str) -> token::Token { + token::Ident(Ident::from_str(id)) + } + + #[test] + fn doublecolonparsing() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + check_tokenization(setup(&cm, &sh, "a b".to_string()), + vec![mk_ident("a"), token::Whitespace, mk_ident("b")]); + } + + #[test] + fn dcparsing_2() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + check_tokenization(setup(&cm, &sh, "a::b".to_string()), + vec![mk_ident("a"), token::ModSep, mk_ident("b")]); + } + + #[test] + fn dcparsing_3() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + check_tokenization(setup(&cm, &sh, "a ::b".to_string()), + vec![mk_ident("a"), token::Whitespace, token::ModSep, mk_ident("b")]); + } + + #[test] + fn dcparsing_4() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + check_tokenization(setup(&cm, &sh, "a:: b".to_string()), + vec![mk_ident("a"), token::ModSep, token::Whitespace, mk_ident("b")]); + } + + #[test] + fn character_a() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + assert_eq!(setup(&cm, &sh, "'a'".to_string()).next_token().tok, + token::Literal(token::Char(Symbol::intern("a")), None)); + } + + #[test] + fn character_space() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + assert_eq!(setup(&cm, &sh, "' '".to_string()).next_token().tok, + token::Literal(token::Char(Symbol::intern(" ")), None)); + } + + #[test] + fn character_escaped() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + assert_eq!(setup(&cm, &sh, "'\\n'".to_string()).next_token().tok, + token::Literal(token::Char(Symbol::intern("\\n")), None)); + } + + #[test] + fn lifetime_name() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + assert_eq!(setup(&cm, &sh, "'abc".to_string()).next_token().tok, + token::Lifetime(Ident::from_str("'abc"))); + } + + #[test] + fn raw_string() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + assert_eq!(setup(&cm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string()) + .next_token() + .tok, + token::Literal(token::StrRaw(Symbol::intern("\"#a\\b\x00c\""), 3), None)); + } + + #[test] + fn literal_suffixes() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + macro_rules! test { + ($input: expr, $tok_type: ident, $tok_contents: expr) => {{ + assert_eq!(setup(&cm, &sh, format!("{}suffix", $input)).next_token().tok, + token::Literal(token::$tok_type(Symbol::intern($tok_contents)), + Some(Symbol::intern("suffix")))); + // with a whitespace separator: + assert_eq!(setup(&cm, &sh, format!("{} suffix", $input)).next_token().tok, + token::Literal(token::$tok_type(Symbol::intern($tok_contents)), + None)); + }} + } + + test!("'a'", Char, "a"); + test!("b'a'", Byte, "a"); + test!("\"a\"", Str_, "a"); + test!("b\"a\"", ByteStr, "a"); + test!("1234", Integer, "1234"); + test!("0b101", Integer, "0b101"); + test!("0xABC", Integer, "0xABC"); + test!("1.0", Float, "1.0"); + test!("1.0e10", Float, "1.0e10"); + + assert_eq!(setup(&cm, &sh, "2us".to_string()).next_token().tok, + token::Literal(token::Integer(Symbol::intern("2")), + Some(Symbol::intern("us")))); + assert_eq!(setup(&cm, &sh, "r###\"raw\"###suffix".to_string()).next_token().tok, + token::Literal(token::StrRaw(Symbol::intern("raw"), 3), + Some(Symbol::intern("suffix")))); + assert_eq!(setup(&cm, &sh, "br###\"raw\"###suffix".to_string()).next_token().tok, + token::Literal(token::ByteStrRaw(Symbol::intern("raw"), 3), + Some(Symbol::intern("suffix")))); + } + + #[test] + fn line_doc_comments() { + assert!(is_doc_comment("///")); + assert!(is_doc_comment("/// blah")); + assert!(!is_doc_comment("////")); + } + + #[test] + fn nested_block_comments() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + let mut lexer = setup(&cm, &sh, "/* /* */ */'a'".to_string()); + match lexer.next_token().tok { + token::Comment => {} + _ => panic!("expected a comment!"), + } + assert_eq!(lexer.next_token().tok, + token::Literal(token::Char(Symbol::intern("a")), None)); + } + + #[test] + fn crlf_comments() { + let cm = Rc::new(CodeMap::new()); + let sh = mk_sh(cm.clone()); + let mut lexer = setup(&cm, &sh, "// test\r\n/// test\r\n".to_string()); + let comment = lexer.next_token(); + assert_eq!(comment.tok, token::Comment); + assert_eq!(comment.sp, ::syntax_pos::mk_sp(BytePos(0), BytePos(7))); + assert_eq!(lexer.next_token().tok, token::Whitespace); + assert_eq!(lexer.next_token().tok, + token::DocComment(Symbol::intern("/// test"))); + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/lexer/unicode_chars.rs b/third_party/rust/syntex_syntax/src/parse/lexer/unicode_chars.rs new file mode 100644 index 000000000000..1e08b20b7e1f --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/lexer/unicode_chars.rs @@ -0,0 +1,253 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Characters and their corresponding confusables were collected from +// http://www.unicode.org/Public/security/revision-06/confusables.txt + +use syntax_pos::mk_sp as make_span; +use errors::DiagnosticBuilder; +use super::StringReader; + +const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[ + (' ', "No-Break Space", ' '), + (' ', "Ogham Space Mark", ' '), + (' ', "En Quad", ' '), + (' ', "Em Quad", ' '), + (' ', "En Space", ' '), + (' ', "Em Space", ' '), + (' ', "Three-Per-Em Space", ' '), + (' ', "Four-Per-Em Space", ' '), + (' ', "Six-Per-Em Space", ' '), + (' ', "Figure Space", ' '), + (' ', "Punctuation Space", ' '), + (' ', "Thin Space", ' '), + (' ', "Hair Space", ' '), + (' ', "Narrow No-Break Space", ' '), + (' ', "Medium Mathematical Space", ' '), + (' ', "Ideographic Space", ' '), + ('ߺ', "Nko Lajanyalan", '_'), + ('﹍', "Dashed Low Line", '_'), + ('﹎', "Centreline Low Line", '_'), + ('﹏', "Wavy Low Line", '_'), + ('‐', "Hyphen", '-'), + ('‑', "Non-Breaking Hyphen", '-'), + ('‒', "Figure Dash", '-'), + ('–', "En Dash", '-'), + ('—', "Em Dash", '-'), + ('﹘', "Small Em Dash", '-'), + ('⁃', "Hyphen Bullet", '-'), + ('˗', "Modifier Letter Minus Sign", '-'), + ('−', "Minus Sign", '-'), + ('ー', "Katakana-Hiragana Prolonged Sound Mark", '-'), + ('٫', "Arabic Decimal Separator", ','), + ('‚', "Single Low-9 Quotation Mark", ','), + ('ꓹ', "Lisu Letter Tone Na Po", ','), + (',', "Fullwidth Comma", ','), + (';', "Greek Question Mark", ';'), + (';', "Fullwidth Semicolon", ';'), + ('ः', "Devanagari Sign Visarga", ':'), + ('ઃ', "Gujarati Sign Visarga", ':'), + (':', "Fullwidth Colon", ':'), + ('։', "Armenian Full Stop", ':'), + ('܃', "Syriac Supralinear Colon", ':'), + ('܄', "Syriac Sublinear Colon", ':'), + ('︰', "Presentation Form For Vertical Two Dot Leader", ':'), + ('᠃', "Mongolian Full Stop", ':'), + ('᠉', "Mongolian Manchu Full Stop", ':'), + ('⁚', "Two Dot Punctuation", ':'), + ('׃', "Hebrew Punctuation Sof Pasuq", ':'), + ('˸', "Modifier Letter Raised Colon", ':'), + ('꞉', "Modifier Letter Colon", ':'), + ('∶', "Ratio", ':'), + ('ː', "Modifier Letter Triangular Colon", ':'), + ('ꓽ', "Lisu Letter Tone Mya Jeu", ':'), + ('!', "Fullwidth Exclamation Mark", '!'), + ('ǃ', "Latin Letter Retroflex Click", '!'), + ('ʔ', "Latin Letter Glottal Stop", '?'), + ('ॽ', "Devanagari Letter Glottal Stop", '?'), + ('Ꭾ', "Cherokee Letter He", '?'), + ('?', "Fullwidth Question Mark", '?'), + ('𝅭', "Musical Symbol Combining Augmentation Dot", '.'), + ('․', "One Dot Leader", '.'), + ('۔', "Arabic Full Stop", '.'), + ('܁', "Syriac Supralinear Full Stop", '.'), + ('܂', "Syriac Sublinear Full Stop", '.'), + ('꘎', "Vai Full Stop", '.'), + ('𐩐', "Kharoshthi Punctuation Dot", '.'), + ('·', "Middle Dot", '.'), + ('٠', "Arabic-Indic Digit Zero", '.'), + ('۰', "Extended Arabic-Indic Digit Zero", '.'), + ('ꓸ', "Lisu Letter Tone Mya Ti", '.'), + ('。', "Ideographic Full Stop", '.'), + ('・', "Katakana Middle Dot", '.'), + ('՝', "Armenian Comma", '\''), + (''', "Fullwidth Apostrophe", '\''), + ('‘', "Left Single Quotation Mark", '\''), + ('’', "Right Single Quotation Mark", '\''), + ('‛', "Single High-Reversed-9 Quotation Mark", '\''), + ('′', "Prime", '\''), + ('‵', "Reversed Prime", '\''), + ('՚', "Armenian Apostrophe", '\''), + ('׳', "Hebrew Punctuation Geresh", '\''), + ('`', "Greek Varia", '\''), + ('`', "Fullwidth Grave Accent", '\''), + ('΄', "Greek Tonos", '\''), + ('´', "Greek Oxia", '\''), + ('᾽', "Greek Koronis", '\''), + ('᾿', "Greek Psili", '\''), + ('῾', "Greek Dasia", '\''), + ('ʹ', "Modifier Letter Prime", '\''), + ('ʹ', "Greek Numeral Sign", '\''), + ('ˊ', "Modifier Letter Acute Accent", '\''), + ('ˋ', "Modifier Letter Grave Accent", '\''), + ('˴', "Modifier Letter Middle Grave Accent", '\''), + ('ʻ', "Modifier Letter Turned Comma", '\''), + ('ʽ', "Modifier Letter Reversed Comma", '\''), + ('ʼ', "Modifier Letter Apostrophe", '\''), + ('ʾ', "Modifier Letter Right Half Ring", '\''), + ('ꞌ', "Latin Small Letter Saltillo", '\''), + ('י', "Hebrew Letter Yod", '\''), + ('ߴ', "Nko High Tone Apostrophe", '\''), + ('ߵ', "Nko Low Tone Apostrophe", '\''), + ('"', "Fullwidth Quotation Mark", '"'), + ('“', "Left Double Quotation Mark", '"'), + ('”', "Right Double Quotation Mark", '"'), + ('‟', "Double High-Reversed-9 Quotation Mark", '"'), + ('″', "Double Prime", '"'), + ('‶', "Reversed Double Prime", '"'), + ('〃', "Ditto Mark", '"'), + ('״', "Hebrew Punctuation Gershayim", '"'), + ('˝', "Double Acute Accent", '"'), + ('ʺ', "Modifier Letter Double Prime", '"'), + ('˶', "Modifier Letter Middle Double Acute Accent", '"'), + ('˵', "Modifier Letter Middle Double Grave Accent", '"'), + ('ˮ', "Modifier Letter Double Apostrophe", '"'), + ('ײ', "Hebrew Ligature Yiddish Double Yod", '"'), + ('❞', "Heavy Double Comma Quotation Mark Ornament", '"'), + ('❝', "Heavy Double Turned Comma Quotation Mark Ornament", '"'), + ('❨', "Medium Left Parenthesis Ornament", '('), + ('﴾', "Ornate Left Parenthesis", '('), + ('(', "Fullwidth Left Parenthesis", '('), + ('❩', "Medium Right Parenthesis Ornament", ')'), + ('﴿', "Ornate Right Parenthesis", ')'), + (')', "Fullwidth Right Parenthesis", ')'), + ('[', "Fullwidth Left Square Bracket", '['), + ('❲', "Light Left Tortoise Shell Bracket Ornament", '['), + ('「', "Left Corner Bracket", '['), + ('『', "Left White Corner Bracket", '['), + ('【', "Left Black Lenticular Bracket", '['), + ('〔', "Left Tortoise Shell Bracket", '['), + ('〖', "Left White Lenticular Bracket", '['), + ('〘', "Left White Tortoise Shell Bracket", '['), + ('〚', "Left White Square Bracket", '['), + (']', "Fullwidth Right Square Bracket", ']'), + ('❳', "Light Right Tortoise Shell Bracket Ornament", ']'), + ('」', "Right Corner Bracket", ']'), + ('』', "Right White Corner Bracket", ']'), + ('】', "Right Black Lenticular Bracket", ']'), + ('〕', "Right Tortoise Shell Bracket", ']'), + ('〗', "Right White Lenticular Bracket", ']'), + ('〙', "Right White Tortoise Shell Bracket", ']'), + ('〛', "Right White Square Bracket", ']'), + ('❴', "Medium Left Curly Bracket Ornament", '{'), + ('❵', "Medium Right Curly Bracket Ornament", '}'), + ('⁎', "Low Asterisk", '*'), + ('٭', "Arabic Five Pointed Star", '*'), + ('∗', "Asterisk Operator", '*'), + ('᜵', "Philippine Single Punctuation", '/'), + ('⁁', "Caret Insertion Point", '/'), + ('∕', "Division Slash", '/'), + ('⁄', "Fraction Slash", '/'), + ('╱', "Box Drawings Light Diagonal Upper Right To Lower Left", '/'), + ('⟋', "Mathematical Rising Diagonal", '/'), + ('⧸', "Big Solidus", '/'), + ('㇓', "Cjk Stroke Sp", '/'), + ('〳', "Vertical Kana Repeat Mark Upper Half", '/'), + ('丿', "Cjk Unified Ideograph-4E3F", '/'), + ('⼃', "Kangxi Radical Slash", '/'), + ('\', "Fullwidth Reverse Solidus", '\\'), + ('﹨', "Small Reverse Solidus", '\\'), + ('∖', "Set Minus", '\\'), + ('⟍', "Mathematical Falling Diagonal", '\\'), + ('⧵', "Reverse Solidus Operator", '\\'), + ('⧹', "Big Reverse Solidus", '\\'), + ('、', "Ideographic Comma", '\\'), + ('ヽ', "Katakana Iteration Mark", '\\'), + ('㇔', "Cjk Stroke D", '\\'), + ('丶', "Cjk Unified Ideograph-4E36", '\\'), + ('⼂', "Kangxi Radical Dot", '\\'), + ('ꝸ', "Latin Small Letter Um", '&'), + ('﬩', "Hebrew Letter Alternative Plus Sign", '+'), + ('‹', "Single Left-Pointing Angle Quotation Mark", '<'), + ('❮', "Heavy Left-Pointing Angle Quotation Mark Ornament", '<'), + ('˂', "Modifier Letter Left Arrowhead", '<'), + ('〈', "Left Angle Bracket", '<'), + ('《', "Left Double Angle Bracket", '<'), + ('꓿', "Lisu Punctuation Full Stop", '='), + ('›', "Single Right-Pointing Angle Quotation Mark", '>'), + ('❯', "Heavy Right-Pointing Angle Quotation Mark Ornament", '>'), + ('˃', "Modifier Letter Right Arrowhead", '>'), + ('〉', "Right Angle Bracket", '>'), + ('》', "Right Double Angle Bracket", '>'), + ('Ⲻ', "Coptic Capital Letter Dialect-P Ni", '-'), + ('Ɂ', "Latin Capital Letter Glottal Stop", '?'), + ('Ⳇ', "Coptic Capital Letter Old Coptic Esh", '/'), ]; + +const ASCII_ARRAY: &'static [(char, &'static str)] = &[ + (' ', "Space"), + ('_', "Underscore"), + ('-', "Minus/Hyphen"), + (',', "Comma"), + (';', "Semicolon"), + (':', "Colon"), + ('!', "Exclamation Mark"), + ('?', "Question Mark"), + ('.', "Period"), + ('\'', "Single Quote"), + ('"', "Quotation Mark"), + ('(', "Left Parenthesis"), + (')', "Right Parenthesis"), + ('[', "Left Square Bracket"), + (']', "Right Square Bracket"), + ('{', "Left Curly Brace"), + ('}', "Right Curly Brace"), + ('*', "Asterisk"), + ('/', "Slash"), + ('\\', "Backslash"), + ('&', "Ampersand"), + ('+', "Plus Sign"), + ('<', "Less-Than Sign"), + ('=', "Equals Sign"), + ('>', "Greater-Than Sign"), ]; + +pub fn check_for_substitution<'a>(reader: &StringReader<'a>, + ch: char, + err: &mut DiagnosticBuilder<'a>) { + UNICODE_ARRAY + .iter() + .find(|&&(c, _, _)| c == ch) + .map(|&(_, u_name, ascii_char)| { + let span = make_span(reader.pos, reader.next_pos); + match ASCII_ARRAY.iter().find(|&&(c, _)| c == ascii_char) { + Some(&(ascii_char, ascii_name)) => { + let msg = + format!("unicode character '{}' ({}) looks much like '{}' ({}), but it's not", + ch, u_name, ascii_char, ascii_name); + err.span_help(span, &msg); + }, + None => { + reader + .span_diagnostic + .span_bug_no_panic(span, + &format!("substitution character not found for '{}'", ch)); + } + } + }); +} diff --git a/third_party/rust/syntex_syntax/src/parse/mod.rs b/third_party/rust/syntex_syntax/src/parse/mod.rs new file mode 100644 index 000000000000..dc71550bea19 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/mod.rs @@ -0,0 +1,1006 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The main parser interface + +use ast::{self, CrateConfig}; +use codemap::CodeMap; +use syntax_pos::{self, Span, FileMap}; +use errors::{Handler, ColorConfig, DiagnosticBuilder}; +use feature_gate::UnstableFeatures; +use parse::parser::Parser; +use ptr::P; +use str::char_at; +use symbol::Symbol; +use tokenstream; + +use std::cell::RefCell; +use std::collections::HashSet; +use std::iter; +use std::path::{Path, PathBuf}; +use std::rc::Rc; +use std::str; + +pub type PResult<'a, T> = Result>; + +#[macro_use] +pub mod parser; + +pub mod lexer; +pub mod token; +pub mod attr; + +pub mod common; +pub mod classify; +pub mod obsolete; + +/// Info about a parsing session. +pub struct ParseSess { + pub span_diagnostic: Handler, // better be the same as the one in the reader! + pub unstable_features: UnstableFeatures, + pub config: CrateConfig, + /// Used to determine and report recursive mod inclusions + included_mod_stack: RefCell>, + code_map: Rc, +} + +impl ParseSess { + pub fn new() -> Self { + let cm = Rc::new(CodeMap::new()); + let handler = Handler::with_tty_emitter(ColorConfig::Auto, + true, + false, + Some(cm.clone())); + ParseSess::with_span_handler(handler, cm) + } + + pub fn with_span_handler(handler: Handler, code_map: Rc) -> ParseSess { + ParseSess { + span_diagnostic: handler, + unstable_features: UnstableFeatures::from_environment(), + config: HashSet::new(), + included_mod_stack: RefCell::new(vec![]), + code_map: code_map + } + } + + pub fn codemap(&self) -> &CodeMap { + &self.code_map + } +} + +#[derive(Clone)] +pub struct Directory { + pub path: PathBuf, + pub ownership: DirectoryOwnership, +} + +#[derive(Copy, Clone)] +pub enum DirectoryOwnership { + Owned, + UnownedViaBlock, + UnownedViaMod(bool /* legacy warnings? */), +} + +// a bunch of utility functions of the form parse__from_ +// where includes crate, expr, item, stmt, tts, and one that +// uses a HOF to parse anything, and includes file and +// source_str. + +pub fn parse_crate_from_file<'a>(input: &Path, sess: &'a ParseSess) -> PResult<'a, ast::Crate> { + let mut parser = new_parser_from_file(sess, input); + parser.parse_crate_mod() +} + +pub fn parse_crate_attrs_from_file<'a>(input: &Path, sess: &'a ParseSess) + -> PResult<'a, Vec> { + let mut parser = new_parser_from_file(sess, input); + parser.parse_inner_attributes() +} + +pub fn parse_crate_from_source_str<'a>(name: String, source: String, sess: &'a ParseSess) + -> PResult<'a, ast::Crate> { + new_parser_from_source_str(sess, name, source).parse_crate_mod() +} + +pub fn parse_crate_attrs_from_source_str<'a>(name: String, source: String, sess: &'a ParseSess) + -> PResult<'a, Vec> { + new_parser_from_source_str(sess, name, source).parse_inner_attributes() +} + +pub fn parse_expr_from_source_str<'a>(name: String, source: String, sess: &'a ParseSess) + -> PResult<'a, P> { + new_parser_from_source_str(sess, name, source).parse_expr() +} + +/// Parses an item. +/// +/// Returns `Ok(Some(item))` when successful, `Ok(None)` when no item was found, and`Err` +/// when a syntax error occurred. +pub fn parse_item_from_source_str<'a>(name: String, source: String, sess: &'a ParseSess) + -> PResult<'a, Option>> { + new_parser_from_source_str(sess, name, source).parse_item() +} + +pub fn parse_meta_from_source_str<'a>(name: String, source: String, sess: &'a ParseSess) + -> PResult<'a, ast::MetaItem> { + new_parser_from_source_str(sess, name, source).parse_meta_item() +} + +pub fn parse_stmt_from_source_str<'a>(name: String, source: String, sess: &'a ParseSess) + -> PResult<'a, Option> { + new_parser_from_source_str(sess, name, source).parse_stmt() +} + +// Warning: This parses with quote_depth > 0, which is not the default. +pub fn parse_tts_from_source_str<'a>(name: String, source: String, sess: &'a ParseSess) + -> PResult<'a, Vec> { + let mut p = new_parser_from_source_str(sess, name, source); + p.quote_depth += 1; + // right now this is re-creating the token trees from ... token trees. + p.parse_all_token_trees() +} + +// Create a new parser from a source string +pub fn new_parser_from_source_str<'a>(sess: &'a ParseSess, name: String, source: String) + -> Parser<'a> { + filemap_to_parser(sess, sess.codemap().new_filemap(name, None, source)) +} + +/// Create a new parser, handling errors as appropriate +/// if the file doesn't exist +pub fn new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) -> Parser<'a> { + filemap_to_parser(sess, file_to_filemap(sess, path, None)) +} + +/// Given a session, a crate config, a path, and a span, add +/// the file at the given path to the codemap, and return a parser. +/// On an error, use the given span as the source of the problem. +pub fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, + path: &Path, + directory_ownership: DirectoryOwnership, + module_name: Option, + sp: Span) -> Parser<'a> { + let mut p = filemap_to_parser(sess, file_to_filemap(sess, path, Some(sp))); + p.directory.ownership = directory_ownership; + p.root_module_name = module_name; + p +} + +/// Given a filemap and config, return a parser +pub fn filemap_to_parser<'a>(sess: &'a ParseSess, filemap: Rc, ) -> Parser<'a> { + let end_pos = filemap.end_pos; + let mut parser = tts_to_parser(sess, filemap_to_tts(sess, filemap)); + + if parser.token == token::Eof && parser.span == syntax_pos::DUMMY_SP { + parser.span = syntax_pos::mk_sp(end_pos, end_pos); + } + + parser +} + +// must preserve old name for now, because quote! from the *existing* +// compiler expands into it +pub fn new_parser_from_tts<'a>(sess: &'a ParseSess, tts: Vec) + -> Parser<'a> { + tts_to_parser(sess, tts) +} + +pub fn new_parser_from_ts<'a>(sess: &'a ParseSess, ts: tokenstream::TokenStream) -> Parser<'a> { + tts_to_parser(sess, ts.to_tts()) +} + + +// base abstractions + +/// Given a session and a path and an optional span (for error reporting), +/// add the path to the session's codemap and return the new filemap. +fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) + -> Rc { + match sess.codemap().load_file(path) { + Ok(filemap) => filemap, + Err(e) => { + let msg = format!("couldn't read {:?}: {}", path.display(), e); + match spanopt { + Some(sp) => panic!(sess.span_diagnostic.span_fatal(sp, &msg)), + None => panic!(sess.span_diagnostic.fatal(&msg)) + } + } + } +} + +/// Given a filemap, produce a sequence of token-trees +pub fn filemap_to_tts(sess: &ParseSess, filemap: Rc) + -> Vec { + // it appears to me that the cfg doesn't matter here... indeed, + // parsing tt's probably shouldn't require a parser at all. + let srdr = lexer::StringReader::new(&sess.span_diagnostic, filemap); + let mut p1 = Parser::new(sess, Box::new(srdr), None, false); + panictry!(p1.parse_all_token_trees()) +} + +/// Given tts and the ParseSess, produce a parser +pub fn tts_to_parser<'a>(sess: &'a ParseSess, tts: Vec) -> Parser<'a> { + let trdr = lexer::new_tt_reader(&sess.span_diagnostic, None, tts); + let mut p = Parser::new(sess, Box::new(trdr), None, false); + p.check_unknown_macro_variable(); + p +} + +/// Parse a string representing a character literal into its final form. +/// Rather than just accepting/rejecting a given literal, unescapes it as +/// well. Can take any slice prefixed by a character escape. Returns the +/// character and the number of characters consumed. +pub fn char_lit(lit: &str) -> (char, isize) { + use std::char; + + // Handle non-escaped chars first. + if lit.as_bytes()[0] != b'\\' { + // If the first byte isn't '\\' it might part of a multi-byte char, so + // get the char with chars(). + let c = lit.chars().next().unwrap(); + return (c, 1); + } + + // Handle escaped chars. + match lit.as_bytes()[1] as char { + '"' => ('"', 2), + 'n' => ('\n', 2), + 'r' => ('\r', 2), + 't' => ('\t', 2), + '\\' => ('\\', 2), + '\'' => ('\'', 2), + '0' => ('\0', 2), + 'x' => { + let v = u32::from_str_radix(&lit[2..4], 16).unwrap(); + let c = char::from_u32(v).unwrap(); + (c, 4) + } + 'u' => { + assert!(lit.as_bytes()[2] == b'{'); + let idx = lit.find('}').unwrap(); + let v = u32::from_str_radix(&lit[3..idx], 16).unwrap(); + let c = char::from_u32(v).unwrap(); + (c, (idx + 1) as isize) + } + _ => panic!("lexer should have rejected a bad character escape {}", lit) + } +} + +/// Parse a string representing a string literal into its final form. Does +/// unescaping. +pub fn str_lit(lit: &str) -> String { + debug!("parse_str_lit: given {}", + lit.chars().flat_map(char::escape_default).collect::()); + let mut res = String::with_capacity(lit.len()); + + // FIXME #8372: This could be a for-loop if it didn't borrow the iterator + let error = |i| format!("lexer should have rejected {} at {}", lit, i); + + /// Eat everything up to a non-whitespace + fn eat<'a>(it: &mut iter::Peekable>) { + loop { + match it.peek().map(|x| x.1) { + Some(' ') | Some('\n') | Some('\r') | Some('\t') => { + it.next(); + }, + _ => { break; } + } + } + } + + let mut chars = lit.char_indices().peekable(); + loop { + match chars.next() { + Some((i, c)) => { + match c { + '\\' => { + let ch = chars.peek().unwrap_or_else(|| { + panic!("{}", error(i)) + }).1; + + if ch == '\n' { + eat(&mut chars); + } else if ch == '\r' { + chars.next(); + let ch = chars.peek().unwrap_or_else(|| { + panic!("{}", error(i)) + }).1; + + if ch != '\n' { + panic!("lexer accepted bare CR"); + } + eat(&mut chars); + } else { + // otherwise, a normal escape + let (c, n) = char_lit(&lit[i..]); + for _ in 0..n - 1 { // we don't need to move past the first \ + chars.next(); + } + res.push(c); + } + }, + '\r' => { + let ch = chars.peek().unwrap_or_else(|| { + panic!("{}", error(i)) + }).1; + + if ch != '\n' { + panic!("lexer accepted bare CR"); + } + chars.next(); + res.push('\n'); + } + c => res.push(c), + } + }, + None => break + } + } + + res.shrink_to_fit(); // probably not going to do anything, unless there was an escape. + debug!("parse_str_lit: returning {}", res); + res +} + +/// Parse a string representing a raw string literal into its final form. The +/// only operation this does is convert embedded CRLF into a single LF. +pub fn raw_str_lit(lit: &str) -> String { + debug!("raw_str_lit: given {}", + lit.chars().flat_map(char::escape_default).collect::()); + let mut res = String::with_capacity(lit.len()); + + // FIXME #8372: This could be a for-loop if it didn't borrow the iterator + let mut chars = lit.chars().peekable(); + loop { + match chars.next() { + Some(c) => { + if c == '\r' { + if *chars.peek().unwrap() != '\n' { + panic!("lexer accepted bare CR"); + } + chars.next(); + res.push('\n'); + } else { + res.push(c); + } + }, + None => break + } + } + + res.shrink_to_fit(); + res +} + +// check if `s` looks like i32 or u1234 etc. +fn looks_like_width_suffix(first_chars: &[char], s: &str) -> bool { + s.len() > 1 && + first_chars.contains(&char_at(s, 0)) && + s[1..].chars().all(|c| '0' <= c && c <= '9') +} + +fn filtered_float_lit(data: Symbol, suffix: Option, sd: &Handler, sp: Span) + -> ast::LitKind { + debug!("filtered_float_lit: {}, {:?}", data, suffix); + let suffix = match suffix { + Some(suffix) => suffix, + None => return ast::LitKind::FloatUnsuffixed(data), + }; + + match &*suffix.as_str() { + "f32" => ast::LitKind::Float(data, ast::FloatTy::F32), + "f64" => ast::LitKind::Float(data, ast::FloatTy::F64), + suf => { + if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) { + // if it looks like a width, lets try to be helpful. + sd.struct_span_err(sp, &format!("invalid width `{}` for float literal", &suf[1..])) + .help("valid widths are 32 and 64") + .emit(); + } else { + sd.struct_span_err(sp, &format!("invalid suffix `{}` for float literal", suf)) + .help("valid suffixes are `f32` and `f64`") + .emit(); + } + + ast::LitKind::FloatUnsuffixed(data) + } + } +} +pub fn float_lit(s: &str, suffix: Option, sd: &Handler, sp: Span) -> ast::LitKind { + debug!("float_lit: {:?}, {:?}", s, suffix); + // FIXME #2252: bounds checking float literals is deferred until trans + let s = s.chars().filter(|&c| c != '_').collect::(); + filtered_float_lit(Symbol::intern(&s), suffix, sd, sp) +} + +/// Parse a string representing a byte literal into its final form. Similar to `char_lit` +pub fn byte_lit(lit: &str) -> (u8, usize) { + let err = |i| format!("lexer accepted invalid byte literal {} step {}", lit, i); + + if lit.len() == 1 { + (lit.as_bytes()[0], 1) + } else { + assert!(lit.as_bytes()[0] == b'\\', err(0)); + let b = match lit.as_bytes()[1] { + b'"' => b'"', + b'n' => b'\n', + b'r' => b'\r', + b't' => b'\t', + b'\\' => b'\\', + b'\'' => b'\'', + b'0' => b'\0', + _ => { + match u64::from_str_radix(&lit[2..4], 16).ok() { + Some(c) => + if c > 0xFF { + panic!(err(2)) + } else { + return (c as u8, 4) + }, + None => panic!(err(3)) + } + } + }; + return (b, 2); + } +} + +pub fn byte_str_lit(lit: &str) -> Rc> { + let mut res = Vec::with_capacity(lit.len()); + + // FIXME #8372: This could be a for-loop if it didn't borrow the iterator + let error = |i| format!("lexer should have rejected {} at {}", lit, i); + + /// Eat everything up to a non-whitespace + fn eat<'a, I: Iterator>(it: &mut iter::Peekable) { + loop { + match it.peek().map(|x| x.1) { + Some(b' ') | Some(b'\n') | Some(b'\r') | Some(b'\t') => { + it.next(); + }, + _ => { break; } + } + } + } + + // byte string literals *must* be ASCII, but the escapes don't have to be + let mut chars = lit.bytes().enumerate().peekable(); + loop { + match chars.next() { + Some((i, b'\\')) => { + let em = error(i); + match chars.peek().expect(&em).1 { + b'\n' => eat(&mut chars), + b'\r' => { + chars.next(); + if chars.peek().expect(&em).1 != b'\n' { + panic!("lexer accepted bare CR"); + } + eat(&mut chars); + } + _ => { + // otherwise, a normal escape + let (c, n) = byte_lit(&lit[i..]); + // we don't need to move past the first \ + for _ in 0..n - 1 { + chars.next(); + } + res.push(c); + } + } + }, + Some((i, b'\r')) => { + let em = error(i); + if chars.peek().expect(&em).1 != b'\n' { + panic!("lexer accepted bare CR"); + } + chars.next(); + res.push(b'\n'); + } + Some((_, c)) => res.push(c), + None => break, + } + } + + Rc::new(res) +} + +pub fn integer_lit(s: &str, suffix: Option, sd: &Handler, sp: Span) -> ast::LitKind { + // s can only be ascii, byte indexing is fine + + let s2 = s.chars().filter(|&c| c != '_').collect::(); + let mut s = &s2[..]; + + debug!("integer_lit: {}, {:?}", s, suffix); + + let mut base = 10; + let orig = s; + let mut ty = ast::LitIntType::Unsuffixed; + + if char_at(s, 0) == '0' && s.len() > 1 { + match char_at(s, 1) { + 'x' => base = 16, + 'o' => base = 8, + 'b' => base = 2, + _ => { } + } + } + + // 1f64 and 2f32 etc. are valid float literals. + if let Some(suf) = suffix { + if looks_like_width_suffix(&['f'], &suf.as_str()) { + match base { + 16 => sd.span_err(sp, "hexadecimal float literal is not supported"), + 8 => sd.span_err(sp, "octal float literal is not supported"), + 2 => sd.span_err(sp, "binary float literal is not supported"), + _ => () + } + return filtered_float_lit(Symbol::intern(&s), Some(suf), sd, sp) + } + } + + if base != 10 { + s = &s[2..]; + } + + if let Some(suf) = suffix { + if suf.as_str().is_empty() { sd.span_bug(sp, "found empty literal suffix in Some")} + ty = match &*suf.as_str() { + "isize" => ast::LitIntType::Signed(ast::IntTy::Is), + "i8" => ast::LitIntType::Signed(ast::IntTy::I8), + "i16" => ast::LitIntType::Signed(ast::IntTy::I16), + "i32" => ast::LitIntType::Signed(ast::IntTy::I32), + "i64" => ast::LitIntType::Signed(ast::IntTy::I64), + "i128" => ast::LitIntType::Signed(ast::IntTy::I128), + "usize" => ast::LitIntType::Unsigned(ast::UintTy::Us), + "u8" => ast::LitIntType::Unsigned(ast::UintTy::U8), + "u16" => ast::LitIntType::Unsigned(ast::UintTy::U16), + "u32" => ast::LitIntType::Unsigned(ast::UintTy::U32), + "u64" => ast::LitIntType::Unsigned(ast::UintTy::U64), + "u128" => ast::LitIntType::Unsigned(ast::UintTy::U128), + suf => { + // i and u look like widths, so lets + // give an error message along those lines + if looks_like_width_suffix(&['i', 'u'], suf) { + sd.struct_span_err(sp, &format!("invalid width `{}` for integer literal", + &suf[1..])) + .help("valid widths are 8, 16, 32, 64 and 128") + .emit(); + } else { + sd.struct_span_err(sp, &format!("invalid suffix `{}` for numeric literal", suf)) + .help("the suffix must be one of the integral types \ + (`u32`, `isize`, etc)") + .emit(); + } + + ty + } + } + } + + debug!("integer_lit: the type is {:?}, base {:?}, the new string is {:?}, the original \ + string was {:?}, the original suffix was {:?}", ty, base, s, orig, suffix); + + match u64::from_str_radix(s, base) { + Ok(r) => ast::LitKind::Int(r, ty), + Err(_) => { + // small bases are lexed as if they were base 10, e.g, the string + // might be `0b10201`. This will cause the conversion above to fail, + // but these cases have errors in the lexer: we don't want to emit + // two errors, and we especially don't want to emit this error since + // it isn't necessarily true. + let already_errored = base < 10 && + s.chars().any(|c| c.to_digit(10).map_or(false, |d| d >= base)); + + if !already_errored { + sd.span_err(sp, "int literal is too large"); + } + ast::LitKind::Int(0, ty) + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::rc::Rc; + use syntax_pos::{self, Span, BytePos, Pos, NO_EXPANSION}; + use codemap::Spanned; + use ast::{self, Ident, PatKind}; + use abi::Abi; + use attr::first_attr_value_str_by_name; + use parse; + use parse::parser::Parser; + use print::pprust::item_to_string; + use ptr::P; + use tokenstream::{self, TokenTree}; + use util::parser_testing::{string_to_tts, string_to_parser}; + use util::parser_testing::{string_to_expr, string_to_item, string_to_stmt}; + use util::ThinVec; + + // produce a syntax_pos::span + fn sp(a: u32, b: u32) -> Span { + Span {lo: BytePos(a), hi: BytePos(b), expn_id: NO_EXPANSION} + } + + #[test] fn path_exprs_1() { + assert!(string_to_expr("a".to_string()) == + P(ast::Expr{ + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Path(None, ast::Path { + span: sp(0, 1), + segments: vec![Ident::from_str("a").into()], + }), + span: sp(0, 1), + attrs: ThinVec::new(), + })) + } + + #[test] fn path_exprs_2 () { + assert!(string_to_expr("::a::b".to_string()) == + P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Path(None, ast::Path { + span: sp(0, 6), + segments: vec![ast::PathSegment::crate_root(), + Ident::from_str("a").into(), + Ident::from_str("b").into()] + }), + span: sp(0, 6), + attrs: ThinVec::new(), + })) + } + + #[should_panic] + #[test] fn bad_path_expr_1() { + string_to_expr("::abc::def::return".to_string()); + } + + // check the token-tree-ization of macros + #[test] + fn string_to_tts_macro () { + let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_string()); + let tts: &[tokenstream::TokenTree] = &tts[..]; + + match (tts.len(), tts.get(0), tts.get(1), tts.get(2), tts.get(3)) { + ( + 4, + Some(&TokenTree::Token(_, token::Ident(name_macro_rules))), + Some(&TokenTree::Token(_, token::Not)), + Some(&TokenTree::Token(_, token::Ident(name_zip))), + Some(&TokenTree::Delimited(_, ref macro_delimed)), + ) + if name_macro_rules.name == "macro_rules" + && name_zip.name == "zip" => { + let tts = ¯o_delimed.tts[..]; + match (tts.len(), tts.get(0), tts.get(1), tts.get(2)) { + ( + 3, + Some(&TokenTree::Delimited(_, ref first_delimed)), + Some(&TokenTree::Token(_, token::FatArrow)), + Some(&TokenTree::Delimited(_, ref second_delimed)), + ) + if macro_delimed.delim == token::Paren => { + let tts = &first_delimed.tts[..]; + match (tts.len(), tts.get(0), tts.get(1)) { + ( + 2, + Some(&TokenTree::Token(_, token::Dollar)), + Some(&TokenTree::Token(_, token::Ident(ident))), + ) + if first_delimed.delim == token::Paren && ident.name == "a" => {}, + _ => panic!("value 3: {:?}", **first_delimed), + } + let tts = &second_delimed.tts[..]; + match (tts.len(), tts.get(0), tts.get(1)) { + ( + 2, + Some(&TokenTree::Token(_, token::Dollar)), + Some(&TokenTree::Token(_, token::Ident(ident))), + ) + if second_delimed.delim == token::Paren + && ident.name == "a" => {}, + _ => panic!("value 4: {:?}", **second_delimed), + } + }, + _ => panic!("value 2: {:?}", **macro_delimed), + } + }, + _ => panic!("value: {:?}",tts), + } + } + + #[test] + fn string_to_tts_1() { + let tts = string_to_tts("fn a (b : i32) { b; }".to_string()); + + let expected = vec![ + TokenTree::Token(sp(0, 2), token::Ident(Ident::from_str("fn"))), + TokenTree::Token(sp(3, 4), token::Ident(Ident::from_str("a"))), + TokenTree::Delimited( + sp(5, 14), + Rc::new(tokenstream::Delimited { + delim: token::DelimToken::Paren, + open_span: sp(5, 6), + tts: vec![ + TokenTree::Token(sp(6, 7), token::Ident(Ident::from_str("b"))), + TokenTree::Token(sp(8, 9), token::Colon), + TokenTree::Token(sp(10, 13), token::Ident(Ident::from_str("i32"))), + ], + close_span: sp(13, 14), + })), + TokenTree::Delimited( + sp(15, 21), + Rc::new(tokenstream::Delimited { + delim: token::DelimToken::Brace, + open_span: sp(15, 16), + tts: vec![ + TokenTree::Token(sp(17, 18), token::Ident(Ident::from_str("b"))), + TokenTree::Token(sp(18, 19), token::Semi), + ], + close_span: sp(20, 21), + })) + ]; + + assert_eq!(tts, expected); + } + + #[test] fn ret_expr() { + assert!(string_to_expr("return d".to_string()) == + P(ast::Expr{ + id: ast::DUMMY_NODE_ID, + node:ast::ExprKind::Ret(Some(P(ast::Expr{ + id: ast::DUMMY_NODE_ID, + node:ast::ExprKind::Path(None, ast::Path{ + span: sp(7, 8), + segments: vec![Ident::from_str("d").into()], + }), + span:sp(7,8), + attrs: ThinVec::new(), + }))), + span:sp(0,8), + attrs: ThinVec::new(), + })) + } + + #[test] fn parse_stmt_1 () { + assert!(string_to_stmt("b;".to_string()) == + Some(ast::Stmt { + node: ast::StmtKind::Expr(P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Path(None, ast::Path { + span:sp(0,1), + segments: vec![Ident::from_str("b").into()], + }), + span: sp(0,1), + attrs: ThinVec::new()})), + id: ast::DUMMY_NODE_ID, + span: sp(0,1)})) + + } + + fn parser_done(p: Parser){ + assert_eq!(p.token.clone(), token::Eof); + } + + #[test] fn parse_ident_pat () { + let sess = ParseSess::new(); + let mut parser = string_to_parser(&sess, "b".to_string()); + assert!(panictry!(parser.parse_pat()) + == P(ast::Pat{ + id: ast::DUMMY_NODE_ID, + node: PatKind::Ident(ast::BindingMode::ByValue(ast::Mutability::Immutable), + Spanned{ span:sp(0, 1), + node: Ident::from_str("b") + }, + None), + span: sp(0,1)})); + parser_done(parser); + } + + // check the contents of the tt manually: + #[test] fn parse_fundecl () { + // this test depends on the intern order of "fn" and "i32" + assert_eq!(string_to_item("fn a (b : i32) { b; }".to_string()), + Some( + P(ast::Item{ident:Ident::from_str("a"), + attrs:Vec::new(), + id: ast::DUMMY_NODE_ID, + node: ast::ItemKind::Fn(P(ast::FnDecl { + inputs: vec![ast::Arg{ + ty: P(ast::Ty{id: ast::DUMMY_NODE_ID, + node: ast::TyKind::Path(None, ast::Path{ + span:sp(10,13), + segments: vec![Ident::from_str("i32").into()], + }), + span:sp(10,13) + }), + pat: P(ast::Pat { + id: ast::DUMMY_NODE_ID, + node: PatKind::Ident( + ast::BindingMode::ByValue(ast::Mutability::Immutable), + Spanned{ + span: sp(6,7), + node: Ident::from_str("b")}, + None + ), + span: sp(6,7) + }), + id: ast::DUMMY_NODE_ID + }], + output: ast::FunctionRetTy::Default(sp(15, 15)), + variadic: false + }), + ast::Unsafety::Normal, + Spanned { + span: sp(0,2), + node: ast::Constness::NotConst, + }, + Abi::Rust, + ast::Generics{ // no idea on either of these: + lifetimes: Vec::new(), + ty_params: P::new(), + where_clause: ast::WhereClause { + id: ast::DUMMY_NODE_ID, + predicates: Vec::new(), + }, + span: syntax_pos::DUMMY_SP, + }, + P(ast::Block { + stmts: vec![ast::Stmt { + node: ast::StmtKind::Semi(P(ast::Expr{ + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Path(None, + ast::Path{ + span:sp(17,18), + segments: vec![Ident::from_str("b").into()], + }), + span: sp(17,18), + attrs: ThinVec::new()})), + id: ast::DUMMY_NODE_ID, + span: sp(17,19)}], + id: ast::DUMMY_NODE_ID, + rules: ast::BlockCheckMode::Default, // no idea + span: sp(15,21), + })), + vis: ast::Visibility::Inherited, + span: sp(0,21)}))); + } + + #[test] fn parse_use() { + let use_s = "use foo::bar::baz;"; + let vitem = string_to_item(use_s.to_string()).unwrap(); + let vitem_s = item_to_string(&vitem); + assert_eq!(&vitem_s[..], use_s); + + let use_s = "use foo::bar as baz;"; + let vitem = string_to_item(use_s.to_string()).unwrap(); + let vitem_s = item_to_string(&vitem); + assert_eq!(&vitem_s[..], use_s); + } + + #[test] fn parse_extern_crate() { + let ex_s = "extern crate foo;"; + let vitem = string_to_item(ex_s.to_string()).unwrap(); + let vitem_s = item_to_string(&vitem); + assert_eq!(&vitem_s[..], ex_s); + + let ex_s = "extern crate foo as bar;"; + let vitem = string_to_item(ex_s.to_string()).unwrap(); + let vitem_s = item_to_string(&vitem); + assert_eq!(&vitem_s[..], ex_s); + } + + fn get_spans_of_pat_idents(src: &str) -> Vec { + let item = string_to_item(src.to_string()).unwrap(); + + struct PatIdentVisitor { + spans: Vec + } + impl<'a> ::visit::Visitor<'a> for PatIdentVisitor { + fn visit_pat(&mut self, p: &'a ast::Pat) { + match p.node { + PatKind::Ident(_ , ref spannedident, _) => { + self.spans.push(spannedident.span.clone()); + } + _ => { + ::visit::walk_pat(self, p); + } + } + } + } + let mut v = PatIdentVisitor { spans: Vec::new() }; + ::visit::walk_item(&mut v, &item); + return v.spans; + } + + #[test] fn span_of_self_arg_pat_idents_are_correct() { + + let srcs = ["impl z { fn a (&self, &myarg: i32) {} }", + "impl z { fn a (&mut self, &myarg: i32) {} }", + "impl z { fn a (&'a self, &myarg: i32) {} }", + "impl z { fn a (self, &myarg: i32) {} }", + "impl z { fn a (self: Foo, &myarg: i32) {} }", + ]; + + for &src in &srcs { + let spans = get_spans_of_pat_idents(src); + let Span{ lo, hi, .. } = spans[0]; + assert!("self" == &src[lo.to_usize()..hi.to_usize()], + "\"{}\" != \"self\". src=\"{}\"", + &src[lo.to_usize()..hi.to_usize()], src) + } + } + + #[test] fn parse_exprs () { + // just make sure that they parse.... + string_to_expr("3 + 4".to_string()); + string_to_expr("a::z.froob(b,&(987+3))".to_string()); + } + + #[test] fn attrs_fix_bug () { + string_to_item("pub fn mk_file_writer(path: &Path, flags: &[FileFlag]) + -> Result, String> { + #[cfg(windows)] + fn wb() -> c_int { + (O_WRONLY | libc::consts::os::extra::O_BINARY) as c_int + } + + #[cfg(unix)] + fn wb() -> c_int { O_WRONLY as c_int } + + let mut fflags: c_int = wb(); +}".to_string()); + } + + #[test] fn crlf_doc_comments() { + let sess = ParseSess::new(); + + let name = "".to_string(); + let source = "/// doc comment\r\nfn foo() {}".to_string(); + let item = parse_item_from_source_str(name.clone(), source, &sess) + .unwrap().unwrap(); + let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap(); + assert_eq!(doc, "/// doc comment"); + + let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string(); + let item = parse_item_from_source_str(name.clone(), source, &sess) + .unwrap().unwrap(); + let docs = item.attrs.iter().filter(|a| a.name() == "doc") + .map(|a| a.value_str().unwrap().to_string()).collect::>(); + let b: &[_] = &["/// doc comment".to_string(), "/// line 2".to_string()]; + assert_eq!(&docs[..], b); + + let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_string(); + let item = parse_item_from_source_str(name, source, &sess).unwrap().unwrap(); + let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap(); + assert_eq!(doc, "/** doc comment\n * with CRLF */"); + } + + #[test] + fn ttdelim_span() { + let sess = ParseSess::new(); + let expr = parse::parse_expr_from_source_str("foo".to_string(), + "foo!( fn main() { body } )".to_string(), &sess).unwrap(); + + let tts = match expr.node { + ast::ExprKind::Mac(ref mac) => mac.node.tts.clone(), + _ => panic!("not a macro"), + }; + + let span = tts.iter().rev().next().unwrap().get_span(); + + match sess.codemap().span_to_snippet(span) { + Ok(s) => assert_eq!(&s[..], "{ body }"), + Err(_) => panic!("could not get snippet"), + } + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/obsolete.rs b/third_party/rust/syntex_syntax/src/parse/obsolete.rs new file mode 100644 index 000000000000..a46a788ca080 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/obsolete.rs @@ -0,0 +1,66 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Support for parsing unsupported, old syntaxes, for the purpose of reporting errors. Parsing of +//! these syntaxes is tested by compile-test/obsolete-syntax.rs. +//! +//! Obsolete syntax that becomes too hard to parse can be removed. + +use syntax_pos::Span; +use parse::parser; + +/// The specific types of unsupported syntax +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +pub enum ObsoleteSyntax { + // Nothing here at the moment +} + +pub trait ParserObsoleteMethods { + /// Reports an obsolete syntax non-fatal error. + fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax); + fn report(&mut self, + sp: Span, + kind: ObsoleteSyntax, + kind_str: &str, + desc: &str, + error: bool); +} + +impl<'a> ParserObsoleteMethods for parser::Parser<'a> { + /// Reports an obsolete syntax non-fatal error. + #[allow(unused_variables)] + fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax) { + let (kind_str, desc, error) = match kind { + // Nothing here at the moment + }; + + self.report(sp, kind, kind_str, desc, error); + } + + fn report(&mut self, + sp: Span, + kind: ObsoleteSyntax, + kind_str: &str, + desc: &str, + error: bool) { + let mut err = if error { + self.diagnostic().struct_span_err(sp, &format!("obsolete syntax: {}", kind_str)) + } else { + self.diagnostic().struct_span_warn(sp, &format!("obsolete syntax: {}", kind_str)) + }; + + if !self.obsolete_set.contains(&kind) && + (error || self.sess.span_diagnostic.can_emit_warnings) { + err.note(&format!("{}", desc)); + self.obsolete_set.insert(kind); + } + err.emit(); + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/parser.rs b/third_party/rust/syntex_syntax/src/parse/parser.rs new file mode 100644 index 000000000000..03950734a8c2 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/parser.rs @@ -0,0 +1,6172 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use abi::{self, Abi}; +use ast::BareFnTy; +use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier}; +use ast::Unsafety; +use ast::{Mod, Arg, Arm, Attribute, BindingMode, TraitItemKind}; +use ast::Block; +use ast::{BlockCheckMode, CaptureBy}; +use ast::{Constness, Crate}; +use ast::Defaultness; +use ast::EnumDef; +use ast::{Expr, ExprKind, RangeLimits}; +use ast::{Field, FnDecl}; +use ast::{ForeignItem, ForeignItemKind, FunctionRetTy}; +use ast::{Ident, ImplItem, Item, ItemKind}; +use ast::{Lit, LitKind, UintTy}; +use ast::Local; +use ast::MacStmtStyle; +use ast::Mac_; +use ast::{MutTy, Mutability}; +use ast::{Pat, PatKind}; +use ast::{PolyTraitRef, QSelf}; +use ast::{Stmt, StmtKind}; +use ast::{VariantData, StructField}; +use ast::StrStyle; +use ast::SelfKind; +use ast::{TraitItem, TraitRef}; +use ast::{Ty, TyKind, TypeBinding, TyParam, TyParamBounds}; +use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple}; +use ast::{Visibility, WhereClause}; +use ast::{BinOpKind, UnOp}; +use {ast, attr}; +use codemap::{self, CodeMap, Spanned, spanned, respan}; +use syntax_pos::{self, Span, BytePos, mk_sp}; +use errors::{self, DiagnosticBuilder}; +use ext::tt::macro_parser; +use parse; +use parse::classify; +use parse::common::SeqSep; +use parse::lexer::{Reader, TokenAndSpan}; +use parse::obsolete::ObsoleteSyntax; +use parse::token::{self, MatchNt, SubstNt}; +use parse::{new_sub_parser_from_file, ParseSess, Directory, DirectoryOwnership}; +use util::parser::{AssocOp, Fixity}; +use print::pprust; +use ptr::P; +use parse::PResult; +use tokenstream::{self, Delimited, SequenceRepetition, TokenTree}; +use symbol::{Symbol, keywords}; +use util::ThinVec; + +use std::collections::HashSet; +use std::mem; +use std::path::{Path, PathBuf}; +use std::rc::Rc; +use std::slice; + +bitflags! { + pub flags Restrictions: u8 { + const RESTRICTION_STMT_EXPR = 1 << 0, + const RESTRICTION_NO_STRUCT_LITERAL = 1 << 1, + } +} + +impl Restrictions { + // Hack to work around differences between bitflags built-in and the bitflags crate + pub fn restriction_stmt_expr() -> Self { + RESTRICTION_STMT_EXPR + } + pub fn restriction_no_struct_literal() -> Self { + RESTRICTION_NO_STRUCT_LITERAL + } +} + +type ItemInfo = (Ident, ItemKind, Option >); + +/// How to parse a path. There are three different kinds of paths, all of which +/// are parsed somewhat differently. +#[derive(Copy, Clone, PartialEq)] +pub enum PathStyle { + /// A path with no type parameters, e.g. `foo::bar::Baz`, used in imports or visibilities. + Mod, + /// A path with a lifetime and type parameters, with no double colons + /// before the type parameters; e.g. `foo::bar<'a>::Baz`, used in types. + /// Paths using this style can be passed into macros expecting `path` nonterminals. + Type, + /// A path with a lifetime and type parameters with double colons before + /// the type parameters; e.g. `foo::bar::<'a>::Baz::`, used in expressions or patterns. + Expr, +} + +#[derive(Clone, Copy, PartialEq)] +pub enum SemiColonMode { + Break, + Ignore, +} + +/// Possibly accept an `token::Interpolated` expression (a pre-parsed expression +/// dropped into the token stream, which happens while parsing the result of +/// macro expansion). Placement of these is not as complex as I feared it would +/// be. The important thing is to make sure that lookahead doesn't balk at +/// `token::Interpolated` tokens. +macro_rules! maybe_whole_expr { + ($p:expr) => { + if let token::Interpolated(nt) = $p.token.clone() { + match *nt { + token::NtExpr(ref e) => { + $p.bump(); + return Ok((*e).clone()); + } + token::NtPath(ref path) => { + $p.bump(); + let span = $p.span; + let kind = ExprKind::Path(None, (*path).clone()); + return Ok($p.mk_expr(span.lo, span.hi, kind, ThinVec::new())); + } + token::NtBlock(ref block) => { + $p.bump(); + let span = $p.span; + let kind = ExprKind::Block((*block).clone()); + return Ok($p.mk_expr(span.lo, span.hi, kind, ThinVec::new())); + } + _ => {}, + }; + } + } +} + +/// As maybe_whole_expr, but for things other than expressions +macro_rules! maybe_whole { + ($p:expr, $constructor:ident, |$x:ident| $e:expr) => { + if let token::Interpolated(nt) = $p.token.clone() { + if let token::$constructor($x) = (*nt).clone() { + $p.bump(); + return Ok($e); + } + } + }; +} + +fn maybe_append(mut lhs: Vec, rhs: Option>) + -> Vec { + if let Some(ref attrs) = rhs { + lhs.extend(attrs.iter().cloned()) + } + lhs +} + +#[derive(PartialEq)] +enum PrevTokenKind { + DocComment, + Comma, + Interpolated, + Eof, + Other, +} + +// Simple circular buffer used for keeping few next tokens. +#[derive(Default)] +struct LookaheadBuffer { + buffer: [TokenAndSpan; LOOKAHEAD_BUFFER_CAPACITY], + start: usize, + end: usize, +} + +const LOOKAHEAD_BUFFER_CAPACITY: usize = 8; + +impl LookaheadBuffer { + fn len(&self) -> usize { + (LOOKAHEAD_BUFFER_CAPACITY + self.end - self.start) % LOOKAHEAD_BUFFER_CAPACITY + } +} + +/* ident is handled by common.rs */ + +pub struct Parser<'a> { + pub sess: &'a ParseSess, + /// the current token: + pub token: token::Token, + /// the span of the current token: + pub span: Span, + /// the span of the previous token: + pub prev_span: Span, + /// the previous token kind + prev_token_kind: PrevTokenKind, + lookahead_buffer: LookaheadBuffer, + pub tokens_consumed: usize, + pub restrictions: Restrictions, + pub quote_depth: usize, // not (yet) related to the quasiquoter + parsing_token_tree: bool, + pub reader: Box, + /// The set of seen errors about obsolete syntax. Used to suppress + /// extra detail when the same error is seen twice + pub obsolete_set: HashSet, + /// Used to determine the path to externally loaded source files + pub directory: Directory, + /// Stack of open delimiters and their spans. Used for error message. + pub open_braces: Vec<(token::DelimToken, Span)>, + /// Name of the root module this parser originated from. If `None`, then the + /// name is not known. This does not change while the parser is descending + /// into modules, and sub-parsers have new values for this name. + pub root_module_name: Option, + pub expected_tokens: Vec, + pub tts: Vec<(TokenTree, usize)>, + pub desugar_doc_comments: bool, + pub allow_interpolated_tts: bool, +} + +#[derive(PartialEq, Eq, Clone)] +pub enum TokenType { + Token(token::Token), + Keyword(keywords::Keyword), + Operator, +} + +impl TokenType { + fn to_string(&self) -> String { + match *self { + TokenType::Token(ref t) => format!("`{}`", Parser::token_to_string(t)), + TokenType::Operator => "an operator".to_string(), + TokenType::Keyword(kw) => format!("`{}`", kw.name()), + } + } +} + +fn is_ident_or_underscore(t: &token::Token) -> bool { + t.is_ident() || *t == token::Underscore +} + +/// Information about the path to a module. +pub struct ModulePath { + pub name: String, + pub path_exists: bool, + pub result: Result, +} + +pub struct ModulePathSuccess { + pub path: PathBuf, + pub directory_ownership: DirectoryOwnership, + warn: bool, +} + +pub struct ModulePathError { + pub err_msg: String, + pub help_msg: String, +} + +pub enum LhsExpr { + NotYetParsed, + AttributesParsed(ThinVec), + AlreadyParsed(P), +} + +impl From>> for LhsExpr { + fn from(o: Option>) -> Self { + if let Some(attrs) = o { + LhsExpr::AttributesParsed(attrs) + } else { + LhsExpr::NotYetParsed + } + } +} + +impl From> for LhsExpr { + fn from(expr: P) -> Self { + LhsExpr::AlreadyParsed(expr) + } +} + +impl<'a> Parser<'a> { + pub fn new(sess: &'a ParseSess, + rdr: Box, + directory: Option, + desugar_doc_comments: bool) + -> Self { + let mut parser = Parser { + reader: rdr, + sess: sess, + token: token::Underscore, + span: syntax_pos::DUMMY_SP, + prev_span: syntax_pos::DUMMY_SP, + prev_token_kind: PrevTokenKind::Other, + lookahead_buffer: Default::default(), + tokens_consumed: 0, + restrictions: Restrictions::empty(), + quote_depth: 0, + parsing_token_tree: false, + obsolete_set: HashSet::new(), + directory: Directory { path: PathBuf::new(), ownership: DirectoryOwnership::Owned }, + open_braces: Vec::new(), + root_module_name: None, + expected_tokens: Vec::new(), + tts: Vec::new(), + desugar_doc_comments: desugar_doc_comments, + allow_interpolated_tts: true, + }; + + let tok = parser.next_tok(); + parser.token = tok.tok; + parser.span = tok.sp; + if let Some(directory) = directory { + parser.directory = directory; + } else if parser.span != syntax_pos::DUMMY_SP { + parser.directory.path = PathBuf::from(sess.codemap().span_to_filename(parser.span)); + parser.directory.path.pop(); + } + parser + } + + fn next_tok(&mut self) -> TokenAndSpan { + 'outer: loop { + let mut tok = if let Some((tts, i)) = self.tts.pop() { + let tt = tts.get_tt(i); + if i + 1 < tts.len() { + self.tts.push((tts, i + 1)); + } + if let TokenTree::Token(sp, tok) = tt { + TokenAndSpan { tok: tok, sp: sp } + } else { + self.tts.push((tt, 0)); + continue + } + } else { + self.reader.real_token() + }; + + loop { + let nt = match tok.tok { + token::Interpolated(ref nt) => nt.clone(), + token::DocComment(name) if self.desugar_doc_comments => { + self.tts.push((TokenTree::Token(tok.sp, token::DocComment(name)), 0)); + continue 'outer + } + _ => return tok, + }; + match *nt { + token::NtTT(TokenTree::Token(sp, ref t)) => { + tok = TokenAndSpan { tok: t.clone(), sp: sp }; + } + token::NtTT(ref tt) => { + self.tts.push((tt.clone(), 0)); + continue 'outer + } + _ => return tok, + } + } + } + } + + /// Convert a token to a string using self's reader + pub fn token_to_string(token: &token::Token) -> String { + pprust::token_to_string(token) + } + + /// Convert the current token to a string using self's reader + pub fn this_token_to_string(&self) -> String { + Parser::token_to_string(&self.token) + } + + pub fn this_token_descr(&self) -> String { + let s = self.this_token_to_string(); + if self.token.is_strict_keyword() { + format!("keyword `{}`", s) + } else if self.token.is_reserved_keyword() { + format!("reserved keyword `{}`", s) + } else { + format!("`{}`", s) + } + } + + pub fn unexpected_last(&self, t: &token::Token) -> PResult<'a, T> { + let token_str = Parser::token_to_string(t); + Err(self.span_fatal(self.prev_span, &format!("unexpected token: `{}`", token_str))) + } + + pub fn unexpected(&mut self) -> PResult<'a, T> { + match self.expect_one_of(&[], &[]) { + Err(e) => Err(e), + Ok(_) => unreachable!(), + } + } + + /// Expect and consume the token t. Signal an error if + /// the next token is not t. + pub fn expect(&mut self, t: &token::Token) -> PResult<'a, ()> { + if self.expected_tokens.is_empty() { + if self.token == *t { + self.bump(); + Ok(()) + } else { + let token_str = Parser::token_to_string(t); + let this_token_str = self.this_token_to_string(); + Err(self.fatal(&format!("expected `{}`, found `{}`", + token_str, + this_token_str))) + } + } else { + self.expect_one_of(unsafe { slice::from_raw_parts(t, 1) }, &[]) + } + } + + /// Expect next token to be edible or inedible token. If edible, + /// then consume it; if inedible, then return without consuming + /// anything. Signal a fatal error if next token is unexpected. + pub fn expect_one_of(&mut self, + edible: &[token::Token], + inedible: &[token::Token]) -> PResult<'a, ()>{ + fn tokens_to_string(tokens: &[TokenType]) -> String { + let mut i = tokens.iter(); + // This might be a sign we need a connect method on Iterator. + let b = i.next() + .map_or("".to_string(), |t| t.to_string()); + i.enumerate().fold(b, |mut b, (i, ref a)| { + if tokens.len() > 2 && i == tokens.len() - 2 { + b.push_str(", or "); + } else if tokens.len() == 2 && i == tokens.len() - 2 { + b.push_str(" or "); + } else { + b.push_str(", "); + } + b.push_str(&a.to_string()); + b + }) + } + if edible.contains(&self.token) { + self.bump(); + Ok(()) + } else if inedible.contains(&self.token) { + // leave it in the input + Ok(()) + } else { + let mut expected = edible.iter() + .map(|x| TokenType::Token(x.clone())) + .chain(inedible.iter().map(|x| TokenType::Token(x.clone()))) + .chain(self.expected_tokens.iter().cloned()) + .collect::>(); + expected.sort_by(|a, b| a.to_string().cmp(&b.to_string())); + expected.dedup(); + let expect = tokens_to_string(&expected[..]); + let actual = self.this_token_to_string(); + Err(self.fatal( + &(if expected.len() > 1 { + (format!("expected one of {}, found `{}`", + expect, + actual)) + } else if expected.is_empty() { + (format!("unexpected token: `{}`", + actual)) + } else { + (format!("expected {}, found `{}`", + expect, + actual)) + })[..] + )) + } + } + + /// returns the span of expr, if it was not interpolated or the span of the interpolated token + fn interpolated_or_expr_span(&self, + expr: PResult<'a, P>) + -> PResult<'a, (Span, P)> { + expr.map(|e| { + if self.prev_token_kind == PrevTokenKind::Interpolated { + (self.prev_span, e) + } else { + (e.span, e) + } + }) + } + + pub fn parse_ident(&mut self) -> PResult<'a, ast::Ident> { + self.check_strict_keywords(); + self.check_reserved_keywords(); + match self.token { + token::Ident(i) => { + self.bump(); + Ok(i) + } + _ => { + Err(if self.prev_token_kind == PrevTokenKind::DocComment { + self.span_fatal_help(self.prev_span, + "found a documentation comment that doesn't document anything", + "doc comments must come before what they document, maybe a comment was \ + intended with `//`?") + } else { + let mut err = self.fatal(&format!("expected identifier, found `{}`", + self.this_token_to_string())); + if self.token == token::Underscore { + err.note("`_` is a wildcard pattern, not an identifier"); + } + err + }) + } + } + } + + /// Check if the next token is `tok`, and return `true` if so. + /// + /// This method will automatically add `tok` to `expected_tokens` if `tok` is not + /// encountered. + pub fn check(&mut self, tok: &token::Token) -> bool { + let is_present = self.token == *tok; + if !is_present { self.expected_tokens.push(TokenType::Token(tok.clone())); } + is_present + } + + /// Consume token 'tok' if it exists. Returns true if the given + /// token was present, false otherwise. + pub fn eat(&mut self, tok: &token::Token) -> bool { + let is_present = self.check(tok); + if is_present { self.bump() } + is_present + } + + pub fn check_keyword(&mut self, kw: keywords::Keyword) -> bool { + self.expected_tokens.push(TokenType::Keyword(kw)); + self.token.is_keyword(kw) + } + + /// If the next token is the given keyword, eat it and return + /// true. Otherwise, return false. + pub fn eat_keyword(&mut self, kw: keywords::Keyword) -> bool { + if self.check_keyword(kw) { + self.bump(); + true + } else { + false + } + } + + pub fn eat_keyword_noexpect(&mut self, kw: keywords::Keyword) -> bool { + if self.token.is_keyword(kw) { + self.bump(); + true + } else { + false + } + } + + pub fn check_contextual_keyword(&mut self, ident: Ident) -> bool { + self.expected_tokens.push(TokenType::Token(token::Ident(ident))); + if let token::Ident(ref cur_ident) = self.token { + cur_ident.name == ident.name + } else { + false + } + } + + pub fn eat_contextual_keyword(&mut self, ident: Ident) -> bool { + if self.check_contextual_keyword(ident) { + self.bump(); + true + } else { + false + } + } + + /// If the given word is not a keyword, signal an error. + /// If the next token is not the given word, signal an error. + /// Otherwise, eat it. + pub fn expect_keyword(&mut self, kw: keywords::Keyword) -> PResult<'a, ()> { + if !self.eat_keyword(kw) { + self.unexpected() + } else { + Ok(()) + } + } + + /// Signal an error if the given string is a strict keyword + pub fn check_strict_keywords(&mut self) { + if self.token.is_strict_keyword() { + let token_str = self.this_token_to_string(); + let span = self.span; + self.span_err(span, + &format!("expected identifier, found keyword `{}`", + token_str)); + } + } + + /// Signal an error if the current token is a reserved keyword + pub fn check_reserved_keywords(&mut self) { + if self.token.is_reserved_keyword() { + let token_str = self.this_token_to_string(); + self.fatal(&format!("`{}` is a reserved keyword", token_str)).emit() + } + } + + /// Expect and consume an `&`. If `&&` is seen, replace it with a single + /// `&` and continue. If an `&` is not seen, signal an error. + fn expect_and(&mut self) -> PResult<'a, ()> { + self.expected_tokens.push(TokenType::Token(token::BinOp(token::And))); + match self.token { + token::BinOp(token::And) => { + self.bump(); + Ok(()) + } + token::AndAnd => { + let span = self.span; + let lo = span.lo + BytePos(1); + Ok(self.bump_with(token::BinOp(token::And), lo, span.hi)) + } + _ => self.unexpected() + } + } + + pub fn expect_no_suffix(&self, sp: Span, kind: &str, suffix: Option) { + match suffix { + None => {/* everything ok */} + Some(suf) => { + let text = suf.as_str(); + if text.is_empty() { + self.span_bug(sp, "found empty literal suffix in Some") + } + self.span_err(sp, &format!("{} with a suffix is invalid", kind)); + } + } + } + + /// Attempt to consume a `<`. If `<<` is seen, replace it with a single + /// `<` and continue. If a `<` is not seen, return false. + /// + /// This is meant to be used when parsing generics on a path to get the + /// starting token. + fn eat_lt(&mut self) -> bool { + self.expected_tokens.push(TokenType::Token(token::Lt)); + match self.token { + token::Lt => { + self.bump(); + true + } + token::BinOp(token::Shl) => { + let span = self.span; + let lo = span.lo + BytePos(1); + self.bump_with(token::Lt, lo, span.hi); + true + } + _ => false, + } + } + + fn expect_lt(&mut self) -> PResult<'a, ()> { + if !self.eat_lt() { + self.unexpected() + } else { + Ok(()) + } + } + + /// Expect and consume a GT. if a >> is seen, replace it + /// with a single > and continue. If a GT is not seen, + /// signal an error. + pub fn expect_gt(&mut self) -> PResult<'a, ()> { + self.expected_tokens.push(TokenType::Token(token::Gt)); + match self.token { + token::Gt => { + self.bump(); + Ok(()) + } + token::BinOp(token::Shr) => { + let span = self.span; + let lo = span.lo + BytePos(1); + Ok(self.bump_with(token::Gt, lo, span.hi)) + } + token::BinOpEq(token::Shr) => { + let span = self.span; + let lo = span.lo + BytePos(1); + Ok(self.bump_with(token::Ge, lo, span.hi)) + } + token::Ge => { + let span = self.span; + let lo = span.lo + BytePos(1); + Ok(self.bump_with(token::Eq, lo, span.hi)) + } + _ => { + let gt_str = Parser::token_to_string(&token::Gt); + let this_token_str = self.this_token_to_string(); + Err(self.fatal(&format!("expected `{}`, found `{}`", + gt_str, + this_token_str))) + } + } + } + + pub fn parse_seq_to_before_gt_or_return(&mut self, + sep: Option, + mut f: F) + -> PResult<'a, (P<[T]>, bool)> + where F: FnMut(&mut Parser<'a>) -> PResult<'a, Option>, + { + let mut v = Vec::new(); + // This loop works by alternating back and forth between parsing types + // and commas. For example, given a string `A, B,>`, the parser would + // first parse `A`, then a comma, then `B`, then a comma. After that it + // would encounter a `>` and stop. This lets the parser handle trailing + // commas in generic parameters, because it can stop either after + // parsing a type or after parsing a comma. + for i in 0.. { + if self.check(&token::Gt) + || self.token == token::BinOp(token::Shr) + || self.token == token::Ge + || self.token == token::BinOpEq(token::Shr) { + break; + } + + if i % 2 == 0 { + match try!(f(self)) { + Some(result) => v.push(result), + None => return Ok((P::from_vec(v), true)) + } + } else { + if let Some(t) = sep.as_ref() { + try!(self.expect(t)); + } + + } + } + return Ok((P::from_vec(v), false)); + } + + /// Parse a sequence bracketed by '<' and '>', stopping + /// before the '>'. + pub fn parse_seq_to_before_gt(&mut self, + sep: Option, + mut f: F) + -> PResult<'a, P<[T]>> where + F: FnMut(&mut Parser<'a>) -> PResult<'a, T>, + { + let (result, returned) = try!(self.parse_seq_to_before_gt_or_return(sep, + |p| Ok(Some(try!(f(p)))))); + assert!(!returned); + return Ok(result); + } + + pub fn parse_seq_to_gt(&mut self, + sep: Option, + f: F) + -> PResult<'a, P<[T]>> where + F: FnMut(&mut Parser<'a>) -> PResult<'a, T>, + { + let v = try!(self.parse_seq_to_before_gt(sep, f)); + try!(self.expect_gt()); + return Ok(v); + } + + pub fn parse_seq_to_gt_or_return(&mut self, + sep: Option, + f: F) + -> PResult<'a, (P<[T]>, bool)> where + F: FnMut(&mut Parser<'a>) -> PResult<'a, Option>, + { + let (v, returned) = try!(self.parse_seq_to_before_gt_or_return(sep, f)); + if !returned { + try!(self.expect_gt()); + } + return Ok((v, returned)); + } + + /// Eat and discard tokens until one of `kets` is encountered. Respects token trees, + /// passes through any errors encountered. Used for error recovery. + pub fn eat_to_tokens(&mut self, kets: &[&token::Token]) { + let handler = self.diagnostic(); + + self.parse_seq_to_before_tokens(kets, + SeqSep::none(), + |p| p.parse_token_tree(), + |mut e| handler.cancel(&mut e)); + } + + /// Parse a sequence, including the closing delimiter. The function + /// f must consume tokens until reaching the next separator or + /// closing bracket. + pub fn parse_seq_to_end(&mut self, + ket: &token::Token, + sep: SeqSep, + f: F) + -> PResult<'a, Vec> where + F: FnMut(&mut Parser<'a>) -> PResult<'a, T>, + { + let val = self.parse_seq_to_before_end(ket, sep, f); + self.bump(); + Ok(val) + } + + /// Parse a sequence, not including the closing delimiter. The function + /// f must consume tokens until reaching the next separator or + /// closing bracket. + pub fn parse_seq_to_before_end(&mut self, + ket: &token::Token, + sep: SeqSep, + f: F) + -> Vec + where F: FnMut(&mut Parser<'a>) -> PResult<'a, T> + { + self.parse_seq_to_before_tokens(&[ket], sep, f, |mut e| e.emit()) + } + + // `fe` is an error handler. + fn parse_seq_to_before_tokens(&mut self, + kets: &[&token::Token], + sep: SeqSep, + mut f: F, + mut fe: Fe) + -> Vec + where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>, + Fe: FnMut(DiagnosticBuilder) + { + let mut first: bool = true; + let mut v = vec![]; + while !kets.contains(&&self.token) { + match sep.sep { + Some(ref t) => { + if first { + first = false; + } else { + if let Err(e) = self.expect(t) { + fe(e); + break; + } + } + } + _ => () + } + if sep.trailing_sep_allowed && kets.iter().any(|k| self.check(k)) { + break; + } + + match f(self) { + Ok(t) => v.push(t), + Err(e) => { + fe(e); + break; + } + } + } + + v + } + + /// Parse a sequence, including the closing delimiter. The function + /// f must consume tokens until reaching the next separator or + /// closing bracket. + pub fn parse_unspanned_seq(&mut self, + bra: &token::Token, + ket: &token::Token, + sep: SeqSep, + f: F) + -> PResult<'a, Vec> where + F: FnMut(&mut Parser<'a>) -> PResult<'a, T>, + { + try!(self.expect(bra)); + let result = self.parse_seq_to_before_end(ket, sep, f); + if self.token == *ket { + self.bump(); + } + Ok(result) + } + + // NB: Do not use this function unless you actually plan to place the + // spanned list in the AST. + pub fn parse_seq(&mut self, + bra: &token::Token, + ket: &token::Token, + sep: SeqSep, + f: F) + -> PResult<'a, Spanned>> where + F: FnMut(&mut Parser<'a>) -> PResult<'a, T>, + { + let lo = self.span.lo; + try!(self.expect(bra)); + let result = self.parse_seq_to_before_end(ket, sep, f); + let hi = self.span.hi; + self.bump(); + Ok(spanned(lo, hi, result)) + } + + /// Advance the parser by one token + pub fn bump(&mut self) { + if self.prev_token_kind == PrevTokenKind::Eof { + // Bumping after EOF is a bad sign, usually an infinite loop. + self.bug("attempted to bump the parser past EOF (may be stuck in a loop)"); + } + + self.prev_span = self.span; + + // Record last token kind for possible error recovery. + self.prev_token_kind = match self.token { + token::DocComment(..) => PrevTokenKind::DocComment, + token::Comma => PrevTokenKind::Comma, + token::Interpolated(..) => PrevTokenKind::Interpolated, + token::Eof => PrevTokenKind::Eof, + _ => PrevTokenKind::Other, + }; + + let next = if self.lookahead_buffer.start == self.lookahead_buffer.end { + self.next_tok() + } else { + // Avoid token copies with `replace`. + let old_start = self.lookahead_buffer.start; + self.lookahead_buffer.start = (old_start + 1) % LOOKAHEAD_BUFFER_CAPACITY; + mem::replace(&mut self.lookahead_buffer.buffer[old_start], Default::default()) + }; + self.span = next.sp; + self.token = next.tok; + self.tokens_consumed += 1; + self.expected_tokens.clear(); + // check after each token + self.check_unknown_macro_variable(); + } + + /// Advance the parser by one token and return the bumped token. + pub fn bump_and_get(&mut self) -> token::Token { + let old_token = mem::replace(&mut self.token, token::Underscore); + self.bump(); + old_token + } + + /// Advance the parser using provided token as a next one. Use this when + /// consuming a part of a token. For example a single `<` from `<<`. + pub fn bump_with(&mut self, + next: token::Token, + lo: BytePos, + hi: BytePos) { + self.prev_span = mk_sp(self.span.lo, lo); + // It would be incorrect to record the kind of the current token, but + // fortunately for tokens currently using `bump_with`, the + // prev_token_kind will be of no use anyway. + self.prev_token_kind = PrevTokenKind::Other; + self.span = mk_sp(lo, hi); + self.token = next; + self.expected_tokens.clear(); + } + + pub fn look_ahead(&mut self, dist: usize, f: F) -> R where + F: FnOnce(&token::Token) -> R, + { + if dist == 0 { + f(&self.token) + } else if dist < LOOKAHEAD_BUFFER_CAPACITY { + while self.lookahead_buffer.len() < dist { + self.lookahead_buffer.buffer[self.lookahead_buffer.end] = self.next_tok(); + self.lookahead_buffer.end = + (self.lookahead_buffer.end + 1) % LOOKAHEAD_BUFFER_CAPACITY; + } + let index = (self.lookahead_buffer.start + dist - 1) % LOOKAHEAD_BUFFER_CAPACITY; + f(&self.lookahead_buffer.buffer[index].tok) + } else { + self.bug("lookahead distance is too large"); + } + } + pub fn fatal(&self, m: &str) -> DiagnosticBuilder<'a> { + self.sess.span_diagnostic.struct_span_fatal(self.span, m) + } + pub fn span_fatal(&self, sp: Span, m: &str) -> DiagnosticBuilder<'a> { + self.sess.span_diagnostic.struct_span_fatal(sp, m) + } + pub fn span_fatal_help(&self, sp: Span, m: &str, help: &str) -> DiagnosticBuilder<'a> { + let mut err = self.sess.span_diagnostic.struct_span_fatal(sp, m); + err.help(help); + err + } + pub fn bug(&self, m: &str) -> ! { + self.sess.span_diagnostic.span_bug(self.span, m) + } + pub fn warn(&self, m: &str) { + self.sess.span_diagnostic.span_warn(self.span, m) + } + pub fn span_warn(&self, sp: Span, m: &str) { + self.sess.span_diagnostic.span_warn(sp, m) + } + pub fn span_err(&self, sp: Span, m: &str) { + self.sess.span_diagnostic.span_err(sp, m) + } + pub fn span_err_help(&self, sp: Span, m: &str, h: &str) { + let mut err = self.sess.span_diagnostic.mut_span_err(sp, m); + err.help(h); + err.emit(); + } + pub fn span_bug(&self, sp: Span, m: &str) -> ! { + self.sess.span_diagnostic.span_bug(sp, m) + } + pub fn abort_if_errors(&self) { + self.sess.span_diagnostic.abort_if_errors(); + } + + fn cancel(&self, err: &mut DiagnosticBuilder) { + self.sess.span_diagnostic.cancel(err) + } + + pub fn diagnostic(&self) -> &'a errors::Handler { + &self.sess.span_diagnostic + } + + /// Is the current token one of the keywords that signals a bare function + /// type? + pub fn token_is_bare_fn_keyword(&mut self) -> bool { + self.check_keyword(keywords::Fn) || + self.check_keyword(keywords::Unsafe) || + self.check_keyword(keywords::Extern) + } + + pub fn get_lifetime(&mut self) -> ast::Ident { + match self.token { + token::Lifetime(ref ident) => *ident, + _ => self.bug("not a lifetime"), + } + } + + pub fn parse_for_in_type(&mut self) -> PResult<'a, TyKind> { + /* + Parses whatever can come after a `for` keyword in a type. + The `for` hasn't been consumed. + + Deprecated: + + - for <'lt> |S| -> T + + Eventually: + + - for <'lt> [unsafe] [extern "ABI"] fn (S) -> T + - for <'lt> path::foo(a, b) + + */ + + // parse <'lt> + let lo = self.span.lo; + + let lifetime_defs = try!(self.parse_late_bound_lifetime_defs()); + + // examine next token to decide to do + if self.token_is_bare_fn_keyword() { + self.parse_ty_bare_fn(lifetime_defs) + } else { + let hi = self.span.hi; + let trait_ref = try!(self.parse_trait_ref()); + let poly_trait_ref = ast::PolyTraitRef { bound_lifetimes: lifetime_defs, + trait_ref: trait_ref, + span: mk_sp(lo, hi)}; + let other_bounds = if self.eat(&token::BinOp(token::Plus)) { + try!(self.parse_ty_param_bounds()) + } else { + P::new() + }; + let all_bounds = + Some(TraitTyParamBound(poly_trait_ref, TraitBoundModifier::None)).into_iter() + .chain(other_bounds.into_vec()) + .collect(); + Ok(ast::TyKind::PolyTraitRef(all_bounds)) + } + } + + pub fn parse_impl_trait_type(&mut self) -> PResult<'a, TyKind> { + /* + Parses whatever can come after a `impl` keyword in a type. + The `impl` has already been consumed. + */ + + let bounds = try!(self.parse_ty_param_bounds()); + + if !bounds.iter().any(|b| if let TraitTyParamBound(..) = *b { true } else { false }) { + self.span_err(self.prev_span, "at least one trait must be specified"); + } + + Ok(ast::TyKind::ImplTrait(bounds)) + } + + pub fn parse_ty_path(&mut self) -> PResult<'a, TyKind> { + Ok(TyKind::Path(None, try!(self.parse_path(PathStyle::Type)))) + } + + /// parse a TyKind::BareFn type: + pub fn parse_ty_bare_fn(&mut self, lifetime_defs: Vec) + -> PResult<'a, TyKind> { + /* + + [unsafe] [extern "ABI"] fn (S) -> T + ^~~~^ ^~~~^ ^~^ ^ + | | | | + | | | Return type + | | Argument types + | | + | ABI + Function Style + */ + + let unsafety = try!(self.parse_unsafety()); + let abi = if self.eat_keyword(keywords::Extern) { + try!(self.parse_opt_abi()).unwrap_or(Abi::C) + } else { + Abi::Rust + }; + + try!(self.expect_keyword(keywords::Fn)); + let (inputs, variadic) = try!(self.parse_fn_args(false, true)); + let ret_ty = try!(self.parse_ret_ty()); + let decl = P(FnDecl { + inputs: inputs, + output: ret_ty, + variadic: variadic + }); + Ok(TyKind::BareFn(P(BareFnTy { + abi: abi, + unsafety: unsafety, + lifetimes: lifetime_defs, + decl: decl + }))) + } + + pub fn parse_unsafety(&mut self) -> PResult<'a, Unsafety> { + if self.eat_keyword(keywords::Unsafe) { + return Ok(Unsafety::Unsafe); + } else { + return Ok(Unsafety::Normal); + } + } + + /// Parse the items in a trait declaration + pub fn parse_trait_item(&mut self) -> PResult<'a, TraitItem> { + maybe_whole!(self, NtTraitItem, |x| x); + let mut attrs = try!(self.parse_outer_attributes()); + let lo = self.span.lo; + + let (name, node) = if self.eat_keyword(keywords::Type) { + let TyParam {ident, bounds, default, ..} = try!(self.parse_ty_param(vec![])); + try!(self.expect(&token::Semi)); + (ident, TraitItemKind::Type(bounds, default)) + } else if self.is_const_item() { + try!(self.expect_keyword(keywords::Const)); + let ident = try!(self.parse_ident()); + try!(self.expect(&token::Colon)); + let ty = try!(self.parse_ty_sum()); + let default = if self.check(&token::Eq) { + self.bump(); + let expr = try!(self.parse_expr()); + try!(self.expect(&token::Semi)); + Some(expr) + } else { + try!(self.expect(&token::Semi)); + None + }; + (ident, TraitItemKind::Const(ty, default)) + } else if self.token.is_path_start() { + // trait item macro. + // code copied from parse_macro_use_or_failure... abstraction! + let lo = self.span.lo; + let pth = try!(self.parse_path(PathStyle::Mod)); + try!(self.expect(&token::Not)); + + // eat a matched-delimiter token tree: + let delim = try!(self.expect_open_delim()); + let tts = try!(self.parse_seq_to_end(&token::CloseDelim(delim), + SeqSep::none(), + |pp| pp.parse_token_tree())); + if delim != token::Brace { + try!(self.expect(&token::Semi)) + } + + let mac = spanned(lo, self.prev_span.hi, Mac_ { path: pth, tts: tts }); + (keywords::Invalid.ident(), ast::TraitItemKind::Macro(mac)) + } else { + let (constness, unsafety, abi) = match self.parse_fn_front_matter() { + Ok(cua) => cua, + Err(e) => { + loop { + match self.token { + token::Eof => break, + token::CloseDelim(token::Brace) | + token::Semi => { + self.bump(); + break; + } + token::OpenDelim(token::Brace) => { + try!(self.parse_token_tree()); + break; + } + _ => self.bump(), + } + } + + return Err(e); + } + }; + + let ident = try!(self.parse_ident()); + let mut generics = try!(self.parse_generics()); + + let d = try!(self.parse_fn_decl_with_self(|p: &mut Parser<'a>|{ + // This is somewhat dubious; We don't want to allow + // argument names to be left off if there is a + // definition... + p.parse_arg_general(false) + })); + + generics.where_clause = try!(self.parse_where_clause()); + let sig = ast::MethodSig { + unsafety: unsafety, + constness: constness, + decl: d, + generics: generics, + abi: abi, + }; + + let body = match self.token { + token::Semi => { + self.bump(); + debug!("parse_trait_methods(): parsing required method"); + None + } + token::OpenDelim(token::Brace) => { + debug!("parse_trait_methods(): parsing provided method"); + let (inner_attrs, body) = try!(self.parse_inner_attrs_and_block()); + attrs.extend(inner_attrs.iter().cloned()); + Some(body) + } + _ => { + let token_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected `;` or `{{`, found `{}`", token_str))); + } + }; + (ident, ast::TraitItemKind::Method(sig, body)) + }; + + Ok(TraitItem { + id: ast::DUMMY_NODE_ID, + ident: name, + attrs: attrs, + node: node, + span: mk_sp(lo, self.prev_span.hi), + }) + } + + + /// Parse the items in a trait declaration + pub fn parse_trait_items(&mut self) -> PResult<'a, Vec> { + self.parse_unspanned_seq( + &token::OpenDelim(token::Brace), + &token::CloseDelim(token::Brace), + SeqSep::none(), + |p| -> PResult<'a, TraitItem> { + p.parse_trait_item() + }) + } + + /// Parse a possibly mutable type + pub fn parse_mt(&mut self) -> PResult<'a, MutTy> { + let mutbl = try!(self.parse_mutability()); + let t = try!(self.parse_ty()); + Ok(MutTy { ty: t, mutbl: mutbl }) + } + + /// Parse optional return type [ -> TY ] in function decl + pub fn parse_ret_ty(&mut self) -> PResult<'a, FunctionRetTy> { + if self.eat(&token::RArrow) { + Ok(FunctionRetTy::Ty(try!(self.parse_ty()))) + } else { + let pos = self.span.lo; + Ok(FunctionRetTy::Default(mk_sp(pos, pos))) + } + } + + /// Parse a type in a context where `T1+T2` is allowed. + pub fn parse_ty_sum(&mut self) -> PResult<'a, P> { + let lo = self.span.lo; + let lhs = try!(self.parse_ty()); + + if !self.eat(&token::BinOp(token::Plus)) { + return Ok(lhs); + } + + let bounds = try!(self.parse_ty_param_bounds()); + + // In type grammar, `+` is treated like a binary operator, + // and hence both L and R side are required. + if bounds.is_empty() { + let prev_span = self.prev_span; + self.span_err(prev_span, + "at least one type parameter bound \ + must be specified"); + } + + let sp = mk_sp(lo, self.prev_span.hi); + let sum = ast::TyKind::ObjectSum(lhs, bounds); + Ok(P(Ty {id: ast::DUMMY_NODE_ID, node: sum, span: sp})) + } + + /// Parse a type. + pub fn parse_ty(&mut self) -> PResult<'a, P> { + maybe_whole!(self, NtTy, |x| x); + + let lo = self.span.lo; + + let t = if self.check(&token::OpenDelim(token::Paren)) { + self.bump(); + + // (t) is a parenthesized ty + // (t,) is the type of a tuple with only one field, + // of type t + let mut ts = vec![]; + let mut last_comma = false; + while self.token != token::CloseDelim(token::Paren) { + ts.push(try!(self.parse_ty_sum())); + if self.check(&token::Comma) { + last_comma = true; + self.bump(); + } else { + last_comma = false; + break; + } + } + + try!(self.expect(&token::CloseDelim(token::Paren))); + if ts.len() == 1 && !last_comma { + TyKind::Paren(ts.into_iter().nth(0).unwrap()) + } else { + TyKind::Tup(ts) + } + } else if self.eat(&token::Not) { + TyKind::Never + } else if self.check(&token::BinOp(token::Star)) { + // STAR POINTER (bare pointer?) + self.bump(); + TyKind::Ptr(try!(self.parse_ptr())) + } else if self.check(&token::OpenDelim(token::Bracket)) { + // VECTOR + try!(self.expect(&token::OpenDelim(token::Bracket))); + let t = try!(self.parse_ty_sum()); + + // Parse the `; e` in `[ i32; e ]` + // where `e` is a const expression + let t = match try!(self.maybe_parse_fixed_length_of_vec()) { + None => TyKind::Slice(t), + Some(suffix) => TyKind::Array(t, suffix) + }; + try!(self.expect(&token::CloseDelim(token::Bracket))); + t + } else if self.check(&token::BinOp(token::And)) || + self.token == token::AndAnd { + // BORROWED POINTER + try!(self.expect_and()); + try!(self.parse_borrowed_pointee()) + } else if self.check_keyword(keywords::For) { + try!(self.parse_for_in_type()) + } else if self.eat_keyword(keywords::Impl) { + try!(self.parse_impl_trait_type()) + } else if self.token_is_bare_fn_keyword() { + // BARE FUNCTION + try!(self.parse_ty_bare_fn(Vec::new())) + } else if self.eat_keyword_noexpect(keywords::Typeof) { + // TYPEOF + // In order to not be ambiguous, the type must be surrounded by parens. + try!(self.expect(&token::OpenDelim(token::Paren))); + let e = try!(self.parse_expr()); + try!(self.expect(&token::CloseDelim(token::Paren))); + TyKind::Typeof(e) + } else if self.eat_lt() { + + let (qself, path) = + try!(self.parse_qualified_path(PathStyle::Type)); + + TyKind::Path(Some(qself), path) + } else if self.token.is_path_start() { + let path = try!(self.parse_path(PathStyle::Type)); + if self.eat(&token::Not) { + // MACRO INVOCATION + let delim = try!(self.expect_open_delim()); + let tts = try!(self.parse_seq_to_end(&token::CloseDelim(delim), + SeqSep::none(), + |p| p.parse_token_tree())); + let hi = self.span.hi; + TyKind::Mac(spanned(lo, hi, Mac_ { path: path, tts: tts })) + } else { + // NAMED TYPE + TyKind::Path(None, path) + } + } else if self.eat(&token::Underscore) { + // TYPE TO BE INFERRED + TyKind::Infer + } else { + let msg = format!("expected type, found {}", self.this_token_descr()); + return Err(self.fatal(&msg)); + }; + + let sp = mk_sp(lo, self.prev_span.hi); + Ok(P(Ty {id: ast::DUMMY_NODE_ID, node: t, span: sp})) + } + + pub fn parse_borrowed_pointee(&mut self) -> PResult<'a, TyKind> { + // look for `&'lt` or `&'foo ` and interpret `foo` as the region name: + let opt_lifetime = try!(self.parse_opt_lifetime()); + + let mt = try!(self.parse_mt()); + return Ok(TyKind::Rptr(opt_lifetime, mt)); + } + + pub fn parse_ptr(&mut self) -> PResult<'a, MutTy> { + let mutbl = if self.eat_keyword(keywords::Mut) { + Mutability::Mutable + } else if self.eat_keyword(keywords::Const) { + Mutability::Immutable + } else { + let span = self.prev_span; + self.span_err(span, + "expected mut or const in raw pointer type (use \ + `*mut T` or `*const T` as appropriate)"); + Mutability::Immutable + }; + let t = try!(self.parse_ty()); + Ok(MutTy { ty: t, mutbl: mutbl }) + } + + pub fn is_named_argument(&mut self) -> bool { + let offset = match self.token { + token::BinOp(token::And) => 1, + token::AndAnd => 1, + _ if self.token.is_keyword(keywords::Mut) => 1, + _ => 0 + }; + + debug!("parser is_named_argument offset:{}", offset); + + if offset == 0 { + is_ident_or_underscore(&self.token) + && self.look_ahead(1, |t| *t == token::Colon) + } else { + self.look_ahead(offset, |t| is_ident_or_underscore(t)) + && self.look_ahead(offset + 1, |t| *t == token::Colon) + } + } + + /// This version of parse arg doesn't necessarily require + /// identifier names. + pub fn parse_arg_general(&mut self, require_name: bool) -> PResult<'a, Arg> { + maybe_whole!(self, NtArg, |x| x); + + let pat = if require_name || self.is_named_argument() { + debug!("parse_arg_general parse_pat (require_name:{})", + require_name); + let pat = try!(self.parse_pat()); + + try!(self.expect(&token::Colon)); + pat + } else { + debug!("parse_arg_general ident_to_pat"); + let sp = self.prev_span; + let spanned = Spanned { span: sp, node: keywords::Invalid.ident() }; + P(Pat { + id: ast::DUMMY_NODE_ID, + node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), + spanned, None), + span: sp + }) + }; + + let t = try!(self.parse_ty_sum()); + + Ok(Arg { + ty: t, + pat: pat, + id: ast::DUMMY_NODE_ID, + }) + } + + /// Parse a single function argument + pub fn parse_arg(&mut self) -> PResult<'a, Arg> { + self.parse_arg_general(true) + } + + /// Parse an argument in a lambda header e.g. |arg, arg| + pub fn parse_fn_block_arg(&mut self) -> PResult<'a, Arg> { + let pat = try!(self.parse_pat()); + let t = if self.eat(&token::Colon) { + try!(self.parse_ty_sum()) + } else { + P(Ty { + id: ast::DUMMY_NODE_ID, + node: TyKind::Infer, + span: mk_sp(self.span.lo, self.span.hi), + }) + }; + Ok(Arg { + ty: t, + pat: pat, + id: ast::DUMMY_NODE_ID + }) + } + + pub fn maybe_parse_fixed_length_of_vec(&mut self) -> PResult<'a, Option>> { + if self.check(&token::Semi) { + self.bump(); + Ok(Some(try!(self.parse_expr()))) + } else { + Ok(None) + } + } + + /// Matches token_lit = LIT_INTEGER | ... + pub fn parse_lit_token(&mut self) -> PResult<'a, LitKind> { + let out = match self.token { + token::Interpolated(ref nt) => match **nt { + token::NtExpr(ref v) => match v.node { + ExprKind::Lit(ref lit) => { lit.node.clone() } + _ => { return self.unexpected_last(&self.token); } + }, + _ => { return self.unexpected_last(&self.token); } + }, + token::Literal(lit, suf) => { + let (suffix_illegal, out) = match lit { + token::Byte(i) => (true, LitKind::Byte(parse::byte_lit(&i.as_str()).0)), + token::Char(i) => (true, LitKind::Char(parse::char_lit(&i.as_str()).0)), + + // there are some valid suffixes for integer and + // float literals, so all the handling is done + // internally. + token::Integer(s) => { + let diag = &self.sess.span_diagnostic; + (false, parse::integer_lit(&s.as_str(), suf, diag, self.span)) + } + token::Float(s) => { + let diag = &self.sess.span_diagnostic; + (false, parse::float_lit(&s.as_str(), suf, diag, self.span)) + } + + token::Str_(s) => { + let s = Symbol::intern(&parse::str_lit(&s.as_str())); + (true, LitKind::Str(s, ast::StrStyle::Cooked)) + } + token::StrRaw(s, n) => { + let s = Symbol::intern(&parse::raw_str_lit(&s.as_str())); + (true, LitKind::Str(s, ast::StrStyle::Raw(n))) + } + token::ByteStr(i) => { + (true, LitKind::ByteStr(parse::byte_str_lit(&i.as_str()))) + } + token::ByteStrRaw(i, _) => { + (true, LitKind::ByteStr(Rc::new(i.to_string().into_bytes()))) + } + }; + + if suffix_illegal { + let sp = self.span; + self.expect_no_suffix(sp, &format!("{} literal", lit.short_name()), suf) + } + + out + } + _ => { return self.unexpected_last(&self.token); } + }; + + self.bump(); + Ok(out) + } + + /// Matches lit = true | false | token_lit + pub fn parse_lit(&mut self) -> PResult<'a, Lit> { + let lo = self.span.lo; + let lit = if self.eat_keyword(keywords::True) { + LitKind::Bool(true) + } else if self.eat_keyword(keywords::False) { + LitKind::Bool(false) + } else { + let lit = try!(self.parse_lit_token()); + lit + }; + Ok(codemap::Spanned { node: lit, span: mk_sp(lo, self.prev_span.hi) }) + } + + /// matches '-' lit | lit + pub fn parse_pat_literal_maybe_minus(&mut self) -> PResult<'a, P> { + let minus_lo = self.span.lo; + let minus_present = self.eat(&token::BinOp(token::Minus)); + let lo = self.span.lo; + let literal = P(try!(self.parse_lit())); + let hi = self.prev_span.hi; + let expr = self.mk_expr(lo, hi, ExprKind::Lit(literal), ThinVec::new()); + + if minus_present { + let minus_hi = self.prev_span.hi; + let unary = self.mk_unary(UnOp::Neg, expr); + Ok(self.mk_expr(minus_lo, minus_hi, unary, ThinVec::new())) + } else { + Ok(expr) + } + } + + pub fn parse_path_segment_ident(&mut self) -> PResult<'a, ast::Ident> { + match self.token { + token::Ident(sid) if self.token.is_path_segment_keyword() => { + self.bump(); + Ok(sid) + } + _ => self.parse_ident(), + } + } + + /// Parses qualified path. + /// + /// Assumes that the leading `<` has been parsed already. + /// + /// Qualifed paths are a part of the universal function call + /// syntax (UFCS). + /// + /// `qualified_path = ::path` + /// + /// See `parse_path` for `mode` meaning. + /// + /// # Examples: + /// + /// `::a` + /// `::F::a::` + pub fn parse_qualified_path(&mut self, mode: PathStyle) + -> PResult<'a, (QSelf, ast::Path)> { + let span = self.prev_span; + let self_type = try!(self.parse_ty_sum()); + let mut path = if self.eat_keyword(keywords::As) { + try!(self.parse_path(PathStyle::Type)) + } else { + ast::Path { + span: span, + segments: vec![] + } + }; + + let qself = QSelf { + ty: self_type, + position: path.segments.len() + }; + + try!(self.expect(&token::Gt)); + try!(self.expect(&token::ModSep)); + + let segments = match mode { + PathStyle::Type => { + try!(self.parse_path_segments_without_colons()) + } + PathStyle::Expr => { + try!(self.parse_path_segments_with_colons()) + } + PathStyle::Mod => { + try!(self.parse_path_segments_without_types()) + } + }; + path.segments.extend(segments); + + path.span.hi = self.prev_span.hi; + + Ok((qself, path)) + } + + /// Parses a path and optional type parameter bounds, depending on the + /// mode. The `mode` parameter determines whether lifetimes, types, and/or + /// bounds are permitted and whether `::` must precede type parameter + /// groups. + pub fn parse_path(&mut self, mode: PathStyle) -> PResult<'a, ast::Path> { + maybe_whole!(self, NtPath, |x| x); + + let lo = self.span.lo; + let is_global = self.eat(&token::ModSep); + + // Parse any number of segments and bound sets. A segment is an + // identifier followed by an optional lifetime and a set of types. + // A bound set is a set of type parameter bounds. + let mut segments = match mode { + PathStyle::Type => { + try!(self.parse_path_segments_without_colons()) + } + PathStyle::Expr => { + try!(self.parse_path_segments_with_colons()) + } + PathStyle::Mod => { + try!(self.parse_path_segments_without_types()) + } + }; + + if is_global { + segments.insert(0, ast::PathSegment::crate_root()); + } + + // Assemble the span. + let span = mk_sp(lo, self.prev_span.hi); + + // Assemble the result. + Ok(ast::Path { + span: span, + segments: segments, + }) + } + + /// Examples: + /// - `a::b::c` + /// - `a::b::c(V) -> W` + /// - `a::b::c(V)` + pub fn parse_path_segments_without_colons(&mut self) -> PResult<'a, Vec> { + let mut segments = Vec::new(); + loop { + // First, parse an identifier. + let identifier = try!(self.parse_path_segment_ident()); + + if self.check(&token::ModSep) && self.look_ahead(1, |t| *t == token::Lt) { + self.bump(); + let prev_span = self.prev_span; + + let mut err = self.diagnostic().struct_span_err(prev_span, + "unexpected token: `::`"); + err.help( + "use `<...>` instead of `::<...>` if you meant to specify type arguments"); + err.emit(); + } + + // Parse types, optionally. + let parameters = if self.eat_lt() { + let (lifetimes, types, bindings) = try!(self.parse_generic_values_after_lt()); + ast::AngleBracketedParameterData { + lifetimes: lifetimes, + types: P::from_vec(types), + bindings: P::from_vec(bindings), + }.into() + } else if self.eat(&token::OpenDelim(token::Paren)) { + let lo = self.prev_span.lo; + + let inputs = try!(self.parse_seq_to_end( + &token::CloseDelim(token::Paren), + SeqSep::trailing_allowed(token::Comma), + |p| p.parse_ty_sum())); + + let output_ty = if self.eat(&token::RArrow) { + Some(try!(self.parse_ty())) + } else { + None + }; + + let hi = self.prev_span.hi; + + Some(P(ast::PathParameters::Parenthesized(ast::ParenthesizedParameterData { + span: mk_sp(lo, hi), + inputs: inputs, + output: output_ty, + }))) + } else { + None + }; + + // Assemble and push the result. + segments.push(ast::PathSegment { identifier: identifier, parameters: parameters }); + + // Continue only if we see a `::` + if !self.eat(&token::ModSep) { + return Ok(segments); + } + } + } + + /// Examples: + /// - `a::b::::c` + pub fn parse_path_segments_with_colons(&mut self) -> PResult<'a, Vec> { + let mut segments = Vec::new(); + loop { + // First, parse an identifier. + let identifier = try!(self.parse_path_segment_ident()); + + // If we do not see a `::`, stop. + if !self.eat(&token::ModSep) { + segments.push(identifier.into()); + return Ok(segments); + } + + // Check for a type segment. + if self.eat_lt() { + // Consumed `a::b::<`, go look for types + let (lifetimes, types, bindings) = try!(self.parse_generic_values_after_lt()); + segments.push(ast::PathSegment { + identifier: identifier, + parameters: ast::AngleBracketedParameterData { + lifetimes: lifetimes, + types: P::from_vec(types), + bindings: P::from_vec(bindings), + }.into(), + }); + + // Consumed `a::b::`, check for `::` before proceeding + if !self.eat(&token::ModSep) { + return Ok(segments); + } + } else { + // Consumed `a::`, go look for `b` + segments.push(identifier.into()); + } + } + } + + /// Examples: + /// - `a::b::c` + pub fn parse_path_segments_without_types(&mut self) + -> PResult<'a, Vec> { + let mut segments = Vec::new(); + loop { + // First, parse an identifier. + let identifier = try!(self.parse_path_segment_ident()); + + // Assemble and push the result. + segments.push(identifier.into()); + + // If we do not see a `::` or see `::{`/`::*`, stop. + if !self.check(&token::ModSep) || self.is_import_coupler() { + return Ok(segments); + } else { + self.bump(); + } + } + } + + /// parses 0 or 1 lifetime + pub fn parse_opt_lifetime(&mut self) -> PResult<'a, Option> { + match self.token { + token::Lifetime(..) => { + Ok(Some(try!(self.parse_lifetime()))) + } + _ => { + Ok(None) + } + } + } + + /// Parses a single lifetime + /// Matches lifetime = LIFETIME + pub fn parse_lifetime(&mut self) -> PResult<'a, ast::Lifetime> { + match self.token { + token::Lifetime(i) => { + let span = self.span; + self.bump(); + return Ok(ast::Lifetime { + id: ast::DUMMY_NODE_ID, + span: span, + name: i.name + }); + } + _ => { + return Err(self.fatal("expected a lifetime name")); + } + } + } + + /// Parses `lifetime_defs = [ lifetime_defs { ',' lifetime_defs } ]` where `lifetime_def = + /// lifetime [':' lifetimes]` + /// + /// If `followed_by_ty_params` is None, then we are in a context + /// where only lifetime parameters are allowed, and thus we should + /// error if we encounter attributes after the bound lifetimes. + /// + /// If `followed_by_ty_params` is Some(r), then there may be type + /// parameter bindings after the lifetimes, so we should pass + /// along the parsed attributes to be attached to the first such + /// type parmeter. + pub fn parse_lifetime_defs(&mut self, + followed_by_ty_params: Option<&mut Vec>) + -> PResult<'a, Vec> + { + let mut res = Vec::new(); + loop { + let attrs = try!(self.parse_outer_attributes()); + match self.token { + token::Lifetime(_) => { + let lifetime = try!(self.parse_lifetime()); + let bounds = + if self.eat(&token::Colon) { + try!(self.parse_lifetimes(token::BinOp(token::Plus))) + } else { + Vec::new() + }; + res.push(ast::LifetimeDef { attrs: attrs.into(), + lifetime: lifetime, + bounds: bounds }); + } + + _ => { + if let Some(recv) = followed_by_ty_params { + assert!(recv.is_empty()); + *recv = attrs; + debug!("parse_lifetime_defs ret {:?}", res); + return Ok(res); + } else if !attrs.is_empty() { + let msg = "trailing attribute after lifetime parameters"; + return Err(self.fatal(msg)); + } + } + } + + match self.token { + token::Comma => { self.bump();} + token::Gt => { return Ok(res); } + token::BinOp(token::Shr) => { return Ok(res); } + _ => { + let this_token_str = self.this_token_to_string(); + let msg = format!("expected `,` or `>` after lifetime \ + name, found `{}`", + this_token_str); + return Err(self.fatal(&msg[..])); + } + } + } + } + + /// matches lifetimes = ( lifetime ) | ( lifetime , lifetimes ) actually, it matches the empty + /// one too, but putting that in there messes up the grammar.... + /// + /// Parses zero or more comma separated lifetimes. Expects each lifetime to be followed by + /// either a comma or `>`. Used when parsing type parameter lists, where we expect something + /// like `<'a, 'b, T>`. + pub fn parse_lifetimes(&mut self, sep: token::Token) -> PResult<'a, Vec> { + + let mut res = Vec::new(); + loop { + match self.token { + token::Lifetime(_) => { + res.push(try!(self.parse_lifetime())); + } + _ => { + return Ok(res); + } + } + + if self.token != sep { + return Ok(res); + } + + self.bump(); + } + } + + /// Parse mutability (`mut` or nothing). + pub fn parse_mutability(&mut self) -> PResult<'a, Mutability> { + if self.eat_keyword(keywords::Mut) { + Ok(Mutability::Mutable) + } else { + Ok(Mutability::Immutable) + } + } + + pub fn parse_field_name(&mut self) -> PResult<'a, Ident> { + if let token::Literal(token::Integer(name), None) = self.token { + self.bump(); + Ok(Ident::with_empty_ctxt(name)) + } else { + self.parse_ident() + } + } + + /// Parse ident (COLON expr)? + pub fn parse_field(&mut self) -> PResult<'a, Field> { + let lo = self.span.lo; + let hi; + + // Check if a colon exists one ahead. This means we're parsing a fieldname. + let (fieldname, expr, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) { + let fieldname = try!(self.parse_field_name()); + self.bump(); + hi = self.prev_span.hi; + (fieldname, try!(self.parse_expr()), false) + } else { + let fieldname = try!(self.parse_ident()); + hi = self.prev_span.hi; + + // Mimic `x: x` for the `x` field shorthand. + let path = ast::Path::from_ident(mk_sp(lo, hi), fieldname); + (fieldname, self.mk_expr(lo, hi, ExprKind::Path(None, path), ThinVec::new()), true) + }; + Ok(ast::Field { + ident: spanned(lo, hi, fieldname), + span: mk_sp(lo, expr.span.hi), + expr: expr, + is_shorthand: is_shorthand, + }) + } + + pub fn mk_expr(&mut self, lo: BytePos, hi: BytePos, node: ExprKind, attrs: ThinVec) + -> P { + P(Expr { + id: ast::DUMMY_NODE_ID, + node: node, + span: mk_sp(lo, hi), + attrs: attrs.into(), + }) + } + + pub fn mk_unary(&mut self, unop: ast::UnOp, expr: P) -> ast::ExprKind { + ExprKind::Unary(unop, expr) + } + + pub fn mk_binary(&mut self, binop: ast::BinOp, lhs: P, rhs: P) -> ast::ExprKind { + ExprKind::Binary(binop, lhs, rhs) + } + + pub fn mk_call(&mut self, f: P, args: Vec>) -> ast::ExprKind { + ExprKind::Call(f, args) + } + + fn mk_method_call(&mut self, + ident: ast::SpannedIdent, + tps: Vec>, + args: Vec>) + -> ast::ExprKind { + ExprKind::MethodCall(ident, tps, args) + } + + pub fn mk_index(&mut self, expr: P, idx: P) -> ast::ExprKind { + ExprKind::Index(expr, idx) + } + + pub fn mk_range(&mut self, + start: Option>, + end: Option>, + limits: RangeLimits) + -> PResult<'a, ast::ExprKind> { + if end.is_none() && limits == RangeLimits::Closed { + Err(self.span_fatal_help(self.span, + "inclusive range with no end", + "inclusive ranges must be bounded at the end \ + (`...b` or `a...b`)")) + } else { + Ok(ExprKind::Range(start, end, limits)) + } + } + + pub fn mk_field(&mut self, expr: P, ident: ast::SpannedIdent) -> ast::ExprKind { + ExprKind::Field(expr, ident) + } + + pub fn mk_tup_field(&mut self, expr: P, idx: codemap::Spanned) -> ast::ExprKind { + ExprKind::TupField(expr, idx) + } + + pub fn mk_assign_op(&mut self, binop: ast::BinOp, + lhs: P, rhs: P) -> ast::ExprKind { + ExprKind::AssignOp(binop, lhs, rhs) + } + + pub fn mk_mac_expr(&mut self, lo: BytePos, hi: BytePos, + m: Mac_, attrs: ThinVec) -> P { + P(Expr { + id: ast::DUMMY_NODE_ID, + node: ExprKind::Mac(codemap::Spanned {node: m, span: mk_sp(lo, hi)}), + span: mk_sp(lo, hi), + attrs: attrs, + }) + } + + pub fn mk_lit_u32(&mut self, i: u32, attrs: ThinVec) -> P { + let span = &self.span; + let lv_lit = P(codemap::Spanned { + node: LitKind::Int(i as u64, ast::LitIntType::Unsigned(UintTy::U32)), + span: *span + }); + + P(Expr { + id: ast::DUMMY_NODE_ID, + node: ExprKind::Lit(lv_lit), + span: *span, + attrs: attrs, + }) + } + + fn expect_open_delim(&mut self) -> PResult<'a, token::DelimToken> { + self.expected_tokens.push(TokenType::Token(token::Gt)); + match self.token { + token::OpenDelim(delim) => { + self.bump(); + Ok(delim) + }, + _ => Err(self.fatal("expected open delimiter")), + } + } + + /// At the bottom (top?) of the precedence hierarchy, + /// parse things like parenthesized exprs, + /// macros, return, etc. + /// + /// NB: This does not parse outer attributes, + /// and is private because it only works + /// correctly if called from parse_dot_or_call_expr(). + fn parse_bottom_expr(&mut self) -> PResult<'a, P> { + maybe_whole_expr!(self); + + // Outer attributes are already parsed and will be + // added to the return value after the fact. + // + // Therefore, prevent sub-parser from parsing + // attributes by giving them a empty "already parsed" list. + let mut attrs = ThinVec::new(); + + let lo = self.span.lo; + let mut hi = self.span.hi; + + let ex: ExprKind; + + // Note: when adding new syntax here, don't forget to adjust Token::can_begin_expr(). + match self.token { + token::OpenDelim(token::Paren) => { + self.bump(); + + attrs.extend(try!(self.parse_inner_attributes())); + + // (e) is parenthesized e + // (e,) is a tuple with only one field, e + let mut es = vec![]; + let mut trailing_comma = false; + while self.token != token::CloseDelim(token::Paren) { + es.push(try!(self.parse_expr())); + try!(self.expect_one_of(&[], &[token::Comma, token::CloseDelim(token::Paren)])); + if self.check(&token::Comma) { + trailing_comma = true; + + self.bump(); + } else { + trailing_comma = false; + break; + } + } + self.bump(); + + hi = self.prev_span.hi; + return if es.len() == 1 && !trailing_comma { + Ok(self.mk_expr(lo, hi, ExprKind::Paren(es.into_iter().nth(0).unwrap()), attrs)) + } else { + Ok(self.mk_expr(lo, hi, ExprKind::Tup(es), attrs)) + } + }, + token::OpenDelim(token::Brace) => { + return self.parse_block_expr(lo, BlockCheckMode::Default, attrs); + }, + token::BinOp(token::Or) | token::OrOr => { + let lo = self.span.lo; + return self.parse_lambda_expr(lo, CaptureBy::Ref, attrs); + }, + token::OpenDelim(token::Bracket) => { + self.bump(); + + attrs.extend(try!(self.parse_inner_attributes())); + + if self.check(&token::CloseDelim(token::Bracket)) { + // Empty vector. + self.bump(); + ex = ExprKind::Vec(Vec::new()); + } else { + // Nonempty vector. + let first_expr = try!(self.parse_expr()); + if self.check(&token::Semi) { + // Repeating array syntax: [ 0; 512 ] + self.bump(); + let count = try!(self.parse_expr()); + try!(self.expect(&token::CloseDelim(token::Bracket))); + ex = ExprKind::Repeat(first_expr, count); + } else if self.check(&token::Comma) { + // Vector with two or more elements. + self.bump(); + let remaining_exprs = try!(self.parse_seq_to_end( + &token::CloseDelim(token::Bracket), + SeqSep::trailing_allowed(token::Comma), + |p| Ok(try!(p.parse_expr())) + )); + let mut exprs = vec![first_expr]; + exprs.extend(remaining_exprs); + ex = ExprKind::Vec(exprs); + } else { + // Vector with one element. + try!(self.expect(&token::CloseDelim(token::Bracket))); + ex = ExprKind::Vec(vec![first_expr]); + } + } + hi = self.prev_span.hi; + } + _ => { + if self.eat_lt() { + let (qself, path) = + try!(self.parse_qualified_path(PathStyle::Expr)); + hi = path.span.hi; + return Ok(self.mk_expr(lo, hi, ExprKind::Path(Some(qself), path), attrs)); + } + if self.eat_keyword(keywords::Move) { + let lo = self.prev_span.lo; + return self.parse_lambda_expr(lo, CaptureBy::Value, attrs); + } + if self.eat_keyword(keywords::If) { + return self.parse_if_expr(attrs); + } + if self.eat_keyword(keywords::For) { + let lo = self.prev_span.lo; + return self.parse_for_expr(None, lo, attrs); + } + if self.eat_keyword(keywords::While) { + let lo = self.prev_span.lo; + return self.parse_while_expr(None, lo, attrs); + } + if self.token.is_lifetime() { + let label = Spanned { node: self.get_lifetime(), + span: self.span }; + let lo = self.span.lo; + self.bump(); + try!(self.expect(&token::Colon)); + if self.eat_keyword(keywords::While) { + return self.parse_while_expr(Some(label), lo, attrs) + } + if self.eat_keyword(keywords::For) { + return self.parse_for_expr(Some(label), lo, attrs) + } + if self.eat_keyword(keywords::Loop) { + return self.parse_loop_expr(Some(label), lo, attrs) + } + return Err(self.fatal("expected `while`, `for`, or `loop` after a label")) + } + if self.eat_keyword(keywords::Loop) { + let lo = self.prev_span.lo; + return self.parse_loop_expr(None, lo, attrs); + } + if self.eat_keyword(keywords::Continue) { + let ex = if self.token.is_lifetime() { + let ex = ExprKind::Continue(Some(Spanned{ + node: self.get_lifetime(), + span: self.span + })); + self.bump(); + ex + } else { + ExprKind::Continue(None) + }; + let hi = self.prev_span.hi; + return Ok(self.mk_expr(lo, hi, ex, attrs)); + } + if self.eat_keyword(keywords::Match) { + return self.parse_match_expr(attrs); + } + if self.eat_keyword(keywords::Unsafe) { + return self.parse_block_expr( + lo, + BlockCheckMode::Unsafe(ast::UserProvided), + attrs); + } + if self.eat_keyword(keywords::Return) { + if self.token.can_begin_expr() { + let e = try!(self.parse_expr()); + hi = e.span.hi; + ex = ExprKind::Ret(Some(e)); + } else { + ex = ExprKind::Ret(None); + } + } else if self.eat_keyword(keywords::Break) { + let lt = if self.token.is_lifetime() { + let spanned_lt = Spanned { + node: self.get_lifetime(), + span: self.span + }; + self.bump(); + Some(spanned_lt) + } else { + None + }; + let e = if self.token.can_begin_expr() + && !(self.token == token::OpenDelim(token::Brace) + && self.restrictions.contains( + Restrictions::restriction_no_struct_literal())) { + Some(try!(self.parse_expr())) + } else { + None + }; + ex = ExprKind::Break(lt, e); + hi = self.prev_span.hi; + } else if self.token.is_keyword(keywords::Let) { + // Catch this syntax error here, instead of in `check_strict_keywords`, so + // that we can explicitly mention that let is not to be used as an expression + let mut db = self.fatal("expected expression, found statement (`let`)"); + db.note("variable declaration using `let` is a statement"); + return Err(db); + } else if self.token.is_path_start() { + let pth = try!(self.parse_path(PathStyle::Expr)); + + // `!`, as an operator, is prefix, so we know this isn't that + if self.eat(&token::Not) { + // MACRO INVOCATION expression + let delim = try!(self.expect_open_delim()); + let tts = try!(self.parse_seq_to_end(&token::CloseDelim(delim), + SeqSep::none(), + |p| p.parse_token_tree())); + let hi = self.prev_span.hi; + return Ok(self.mk_mac_expr(lo, hi, Mac_ { path: pth, tts: tts }, attrs)); + } + if self.check(&token::OpenDelim(token::Brace)) { + // This is a struct literal, unless we're prohibited + // from parsing struct literals here. + let prohibited = self.restrictions.contains( + RESTRICTION_NO_STRUCT_LITERAL + ); + if !prohibited { + return self.parse_struct_expr(lo, pth, attrs); + } + } + + hi = pth.span.hi; + ex = ExprKind::Path(None, pth); + } else { + match self.parse_lit() { + Ok(lit) => { + hi = lit.span.hi; + ex = ExprKind::Lit(P(lit)); + } + Err(mut err) => { + self.cancel(&mut err); + let msg = format!("expected expression, found {}", + self.this_token_descr()); + return Err(self.fatal(&msg)); + } + } + } + } + } + + return Ok(self.mk_expr(lo, hi, ex, attrs)); + } + + fn parse_struct_expr(&mut self, lo: BytePos, pth: ast::Path, mut attrs: ThinVec) + -> PResult<'a, P> { + self.bump(); + let mut fields = Vec::new(); + let mut base = None; + + attrs.extend(try!(self.parse_inner_attributes())); + + while self.token != token::CloseDelim(token::Brace) { + if self.eat(&token::DotDot) { + match self.parse_expr() { + Ok(e) => { + base = Some(e); + } + Err(mut e) => { + e.emit(); + self.recover_stmt(); + } + } + break; + } + + match self.parse_field() { + Ok(f) => fields.push(f), + Err(mut e) => { + e.emit(); + self.recover_stmt(); + break; + } + } + + match self.expect_one_of(&[token::Comma], + &[token::CloseDelim(token::Brace)]) { + Ok(()) => {} + Err(mut e) => { + e.emit(); + self.recover_stmt(); + break; + } + } + } + + let hi = self.span.hi; + try!(self.expect(&token::CloseDelim(token::Brace))); + return Ok(self.mk_expr(lo, hi, ExprKind::Struct(pth, fields, base), attrs)); + } + + fn parse_or_use_outer_attributes(&mut self, + already_parsed_attrs: Option>) + -> PResult<'a, ThinVec> { + if let Some(attrs) = already_parsed_attrs { + Ok(attrs) + } else { + self.parse_outer_attributes().map(|a| a.into()) + } + } + + /// Parse a block or unsafe block + pub fn parse_block_expr(&mut self, lo: BytePos, blk_mode: BlockCheckMode, + outer_attrs: ThinVec) + -> PResult<'a, P> { + + try!(self.expect(&token::OpenDelim(token::Brace))); + + let mut attrs = outer_attrs; + attrs.extend(try!(self.parse_inner_attributes())); + + let blk = try!(self.parse_block_tail(lo, blk_mode)); + return Ok(self.mk_expr(blk.span.lo, blk.span.hi, ExprKind::Block(blk), attrs)); + } + + /// parse a.b or a(13) or a[4] or just a + pub fn parse_dot_or_call_expr(&mut self, + already_parsed_attrs: Option>) + -> PResult<'a, P> { + let attrs = try!(self.parse_or_use_outer_attributes(already_parsed_attrs)); + + let b = self.parse_bottom_expr(); + let (span, b) = try!(self.interpolated_or_expr_span(b)); + self.parse_dot_or_call_expr_with(b, span.lo, attrs) + } + + pub fn parse_dot_or_call_expr_with(&mut self, + e0: P, + lo: BytePos, + mut attrs: ThinVec) + -> PResult<'a, P> { + // Stitch the list of outer attributes onto the return value. + // A little bit ugly, but the best way given the current code + // structure + self.parse_dot_or_call_expr_with_(e0, lo) + .map(|expr| + expr.map(|mut expr| { + attrs.extend::>(expr.attrs.into()); + expr.attrs = attrs; + match expr.node { + ExprKind::If(..) | ExprKind::IfLet(..) => { + if !expr.attrs.is_empty() { + // Just point to the first attribute in there... + let span = expr.attrs[0].span; + + self.span_err(span, + "attributes are not yet allowed on `if` \ + expressions"); + } + } + _ => {} + } + expr + }) + ) + } + + // Assuming we have just parsed `.foo` (i.e., a dot and an ident), continue + // parsing into an expression. + fn parse_dot_suffix(&mut self, + ident: Ident, + ident_span: Span, + self_value: P, + lo: BytePos) + -> PResult<'a, P> { + let (_, tys, bindings) = if self.eat(&token::ModSep) { + try!(self.expect_lt()); + try!(self.parse_generic_values_after_lt()) + } else { + (Vec::new(), Vec::new(), Vec::new()) + }; + + if !bindings.is_empty() { + let prev_span = self.prev_span; + self.span_err(prev_span, "type bindings are only permitted on trait paths"); + } + + Ok(match self.token { + // expr.f() method call. + token::OpenDelim(token::Paren) => { + let mut es = try!(self.parse_unspanned_seq( + &token::OpenDelim(token::Paren), + &token::CloseDelim(token::Paren), + SeqSep::trailing_allowed(token::Comma), + |p| Ok(try!(p.parse_expr())) + )); + let hi = self.prev_span.hi; + + es.insert(0, self_value); + let id = spanned(ident_span.lo, ident_span.hi, ident); + let nd = self.mk_method_call(id, tys, es); + self.mk_expr(lo, hi, nd, ThinVec::new()) + } + // Field access. + _ => { + if !tys.is_empty() { + let prev_span = self.prev_span; + self.span_err(prev_span, + "field expressions may not \ + have type parameters"); + } + + let id = spanned(ident_span.lo, ident_span.hi, ident); + let field = self.mk_field(self_value, id); + self.mk_expr(lo, ident_span.hi, field, ThinVec::new()) + } + }) + } + + fn parse_dot_or_call_expr_with_(&mut self, e0: P, lo: BytePos) -> PResult<'a, P> { + let mut e = e0; + let mut hi; + loop { + // expr? + while self.eat(&token::Question) { + let hi = self.prev_span.hi; + e = self.mk_expr(lo, hi, ExprKind::Try(e), ThinVec::new()); + } + + // expr.f + if self.eat(&token::Dot) { + match self.token { + token::Ident(i) => { + let dot_pos = self.prev_span.hi; + hi = self.span.hi; + self.bump(); + + e = try!(self.parse_dot_suffix(i, mk_sp(dot_pos, hi), e, lo)); + } + token::Literal(token::Integer(n), suf) => { + let sp = self.span; + + // A tuple index may not have a suffix + self.expect_no_suffix(sp, "tuple index", suf); + + let dot = self.prev_span.hi; + hi = self.span.hi; + self.bump(); + + let index = n.as_str().parse::().ok(); + match index { + Some(n) => { + let id = spanned(dot, hi, n); + let field = self.mk_tup_field(e, id); + e = self.mk_expr(lo, hi, field, ThinVec::new()); + } + None => { + let prev_span = self.prev_span; + self.span_err(prev_span, "invalid tuple or tuple struct index"); + } + } + } + token::Literal(token::Float(n), _suf) => { + self.bump(); + let prev_span = self.prev_span; + let fstr = n.as_str(); + let mut err = self.diagnostic().struct_span_err(prev_span, + &format!("unexpected token: `{}`", n)); + if fstr.chars().all(|x| "0123456789.".contains(x)) { + let float = match fstr.parse::().ok() { + Some(f) => f, + None => continue, + }; + err.help(&format!("try parenthesizing the first index; e.g., `(foo.{}){}`", + float.trunc() as usize, + format!(".{}", fstr.splitn(2, ".").last().unwrap()))); + } + return Err(err); + + } + _ => { + // FIXME Could factor this out into non_fatal_unexpected or something. + let actual = self.this_token_to_string(); + self.span_err(self.span, &format!("unexpected token: `{}`", actual)); + + let dot_pos = self.prev_span.hi; + e = try!(self.parse_dot_suffix(keywords::Invalid.ident(), + mk_sp(dot_pos, dot_pos), + e, lo)); + } + } + continue; + } + if self.expr_is_complete(&e) { break; } + match self.token { + // expr(...) + token::OpenDelim(token::Paren) => { + let es = try!(self.parse_unspanned_seq( + &token::OpenDelim(token::Paren), + &token::CloseDelim(token::Paren), + SeqSep::trailing_allowed(token::Comma), + |p| Ok(try!(p.parse_expr())) + )); + hi = self.prev_span.hi; + + let nd = self.mk_call(e, es); + e = self.mk_expr(lo, hi, nd, ThinVec::new()); + } + + // expr[...] + // Could be either an index expression or a slicing expression. + token::OpenDelim(token::Bracket) => { + self.bump(); + let ix = try!(self.parse_expr()); + hi = self.span.hi; + try!(self.expect(&token::CloseDelim(token::Bracket))); + let index = self.mk_index(e, ix); + e = self.mk_expr(lo, hi, index, ThinVec::new()) + } + _ => return Ok(e) + } + } + return Ok(e); + } + + // Parse unquoted tokens after a `$` in a token tree + fn parse_unquoted(&mut self) -> PResult<'a, TokenTree> { + let mut sp = self.span; + let name = match self.token { + token::Dollar => { + self.bump(); + + if self.token == token::OpenDelim(token::Paren) { + let Spanned { node: seq, span: seq_span } = try!(self.parse_seq( + &token::OpenDelim(token::Paren), + &token::CloseDelim(token::Paren), + SeqSep::none(), + |p| p.parse_token_tree() + )); + let (sep, repeat) = try!(self.parse_sep_and_kleene_op()); + let name_num = macro_parser::count_names(&seq); + return Ok(TokenTree::Sequence(mk_sp(sp.lo, seq_span.hi), + Rc::new(SequenceRepetition { + tts: seq, + separator: sep, + op: repeat, + num_captures: name_num + }))); + } else if self.token.is_keyword(keywords::Crate) { + let ident = match self.token { + token::Ident(id) => ast::Ident { name: Symbol::intern("$crate"), ..id }, + _ => unreachable!(), + }; + self.bump(); + return Ok(TokenTree::Token(sp, token::Ident(ident))); + } else { + sp = mk_sp(sp.lo, self.span.hi); + self.parse_ident().unwrap_or_else(|mut e| { + e.emit(); + keywords::Invalid.ident() + }) + } + } + token::SubstNt(name) => { + self.bump(); + name + } + _ => unreachable!() + }; + // continue by trying to parse the `:ident` after `$name` + if self.token == token::Colon && + self.look_ahead(1, |t| t.is_ident() && !t.is_any_keyword()) { + self.bump(); + sp = mk_sp(sp.lo, self.span.hi); + let nt_kind = try!(self.parse_ident()); + Ok(TokenTree::Token(sp, MatchNt(name, nt_kind))) + } else { + Ok(TokenTree::Token(sp, SubstNt(name))) + } + } + + pub fn check_unknown_macro_variable(&mut self) { + if self.quote_depth == 0 && !self.parsing_token_tree { + match self.token { + token::SubstNt(name) => + self.fatal(&format!("unknown macro variable `{}`", name)).emit(), + _ => {} + } + } + } + + /// Parse an optional separator followed by a Kleene-style + /// repetition token (+ or *). + pub fn parse_sep_and_kleene_op(&mut self) + -> PResult<'a, (Option, tokenstream::KleeneOp)> { + fn parse_kleene_op<'a>(parser: &mut Parser<'a>) -> + PResult<'a, Option> { + match parser.token { + token::BinOp(token::Star) => { + parser.bump(); + Ok(Some(tokenstream::KleeneOp::ZeroOrMore)) + }, + token::BinOp(token::Plus) => { + parser.bump(); + Ok(Some(tokenstream::KleeneOp::OneOrMore)) + }, + _ => Ok(None) + } + }; + + if let Some(kleene_op) = try!(parse_kleene_op(self)) { + return Ok((None, kleene_op)); + } + + let separator = self.bump_and_get(); + match try!(parse_kleene_op(self)) { + Some(zerok) => Ok((Some(separator), zerok)), + None => return Err(self.fatal("expected `*` or `+`")) + } + } + + /// parse a single token tree from the input. + pub fn parse_token_tree(&mut self) -> PResult<'a, TokenTree> { + // FIXME #6994: currently, this is too eager. It + // parses token trees but also identifies TokenType::Sequence's + // and token::SubstNt's; it's too early to know yet + // whether something will be a nonterminal or a seq + // yet. + match self.token { + token::Eof => { + let mut err: DiagnosticBuilder<'a> = + self.diagnostic().struct_span_err(self.span, + "this file contains an un-closed delimiter"); + for &(_, sp) in &self.open_braces { + err.span_help(sp, "did you mean to close this delimiter?"); + } + + Err(err) + }, + token::OpenDelim(delim) => { + if self.tts.last().map(|&(_, i)| i == 1).unwrap_or(false) { + let tt = self.tts.pop().unwrap().0; + self.bump(); + return Ok(if self.allow_interpolated_tts { + // avoid needlessly reparsing token trees in recursive macro expansions + TokenTree::Token(tt.span(), token::Interpolated(Rc::new(token::NtTT(tt)))) + } else { + tt + }); + } + + let parsing_token_tree = ::std::mem::replace(&mut self.parsing_token_tree, true); + // The span for beginning of the delimited section + let pre_span = self.span; + + // Parse the open delimiter. + self.open_braces.push((delim, self.span)); + let open_span = self.span; + self.bump(); + + // Parse the token trees within the delimiters. + // We stop at any delimiter so we can try to recover if the user + // uses an incorrect delimiter. + let tts = self.parse_seq_to_before_tokens(&[&token::CloseDelim(token::Brace), + &token::CloseDelim(token::Paren), + &token::CloseDelim(token::Bracket)], + SeqSep::none(), + |p| p.parse_token_tree(), + |mut e| e.emit()); + + let close_span = self.span; + // Expand to cover the entire delimited token tree + let span = Span { hi: close_span.hi, ..pre_span }; + + match self.token { + // Correct delimiter. + token::CloseDelim(d) if d == delim => { + self.open_braces.pop().unwrap(); + + // Parse the close delimiter. + self.bump(); + } + // Incorrect delimiter. + token::CloseDelim(other) => { + let token_str = self.this_token_to_string(); + let mut err = self.diagnostic().struct_span_err(self.span, + &format!("incorrect close delimiter: `{}`", token_str)); + // This is a conservative error: only report the last unclosed delimiter. + // The previous unclosed delimiters could actually be closed! The parser + // just hasn't gotten to them yet. + if let Some(&(_, sp)) = self.open_braces.last() { + err.span_note(sp, "unclosed delimiter"); + }; + err.emit(); + + self.open_braces.pop().unwrap(); + + // If the incorrect delimiter matches an earlier opening + // delimiter, then don't consume it (it can be used to + // close the earlier one). Otherwise, consume it. + // E.g., we try to recover from: + // fn foo() { + // bar(baz( + // } // Incorrect delimiter but matches the earlier `{` + if !self.open_braces.iter().any(|&(b, _)| b == other) { + self.bump(); + } + } + token::Eof => { + // Silently recover, the EOF token will be seen again + // and an error emitted then. Thus we don't pop from + // self.open_braces here. + }, + _ => {} + } + + self.parsing_token_tree = parsing_token_tree; + Ok(TokenTree::Delimited(span, Rc::new(Delimited { + delim: delim, + open_span: open_span, + tts: tts, + close_span: close_span, + }))) + }, + token::CloseDelim(_) => { + // An unexpected closing delimiter (i.e., there is no + // matching opening delimiter). + let token_str = self.this_token_to_string(); + let err = self.diagnostic().struct_span_err(self.span, + &format!("unexpected close delimiter: `{}`", token_str)); + Err(err) + }, + /* we ought to allow different depths of unquotation */ + token::Dollar | token::SubstNt(..) if self.quote_depth > 0 => { + self.parse_unquoted() + } + _ => { + Ok(TokenTree::Token(self.span, self.bump_and_get())) + } + } + } + + // parse a stream of tokens into a list of TokenTree's, + // up to EOF. + pub fn parse_all_token_trees(&mut self) -> PResult<'a, Vec> { + let mut tts = Vec::new(); + while self.token != token::Eof { + tts.push(try!(self.parse_token_tree())); + } + Ok(tts) + } + + /// Parse a prefix-unary-operator expr + pub fn parse_prefix_expr(&mut self, + already_parsed_attrs: Option>) + -> PResult<'a, P> { + let attrs = try!(self.parse_or_use_outer_attributes(already_parsed_attrs)); + let lo = self.span.lo; + let hi; + // Note: when adding new unary operators, don't forget to adjust Token::can_begin_expr() + let ex = match self.token { + token::Not => { + self.bump(); + let e = self.parse_prefix_expr(None); + let (span, e) = try!(self.interpolated_or_expr_span(e)); + hi = span.hi; + self.mk_unary(UnOp::Not, e) + } + token::BinOp(token::Minus) => { + self.bump(); + let e = self.parse_prefix_expr(None); + let (span, e) = try!(self.interpolated_or_expr_span(e)); + hi = span.hi; + self.mk_unary(UnOp::Neg, e) + } + token::BinOp(token::Star) => { + self.bump(); + let e = self.parse_prefix_expr(None); + let (span, e) = try!(self.interpolated_or_expr_span(e)); + hi = span.hi; + self.mk_unary(UnOp::Deref, e) + } + token::BinOp(token::And) | token::AndAnd => { + try!(self.expect_and()); + let m = try!(self.parse_mutability()); + let e = self.parse_prefix_expr(None); + let (span, e) = try!(self.interpolated_or_expr_span(e)); + hi = span.hi; + ExprKind::AddrOf(m, e) + } + token::Ident(..) if self.token.is_keyword(keywords::In) => { + self.bump(); + let place = try!(self.parse_expr_res( + RESTRICTION_NO_STRUCT_LITERAL, + None, + )); + let blk = try!(self.parse_block()); + let span = blk.span; + hi = span.hi; + let blk_expr = self.mk_expr(span.lo, hi, ExprKind::Block(blk), ThinVec::new()); + ExprKind::InPlace(place, blk_expr) + } + token::Ident(..) if self.token.is_keyword(keywords::Box) => { + self.bump(); + let e = self.parse_prefix_expr(None); + let (span, e) = try!(self.interpolated_or_expr_span(e)); + hi = span.hi; + ExprKind::Box(e) + } + _ => return self.parse_dot_or_call_expr(Some(attrs)) + }; + return Ok(self.mk_expr(lo, hi, ex, attrs)); + } + + /// Parse an associative expression + /// + /// This parses an expression accounting for associativity and precedence of the operators in + /// the expression. + pub fn parse_assoc_expr(&mut self, + already_parsed_attrs: Option>) + -> PResult<'a, P> { + self.parse_assoc_expr_with(0, already_parsed_attrs.into()) + } + + /// Parse an associative expression with operators of at least `min_prec` precedence + pub fn parse_assoc_expr_with(&mut self, + min_prec: usize, + lhs: LhsExpr) + -> PResult<'a, P> { + let mut lhs = if let LhsExpr::AlreadyParsed(expr) = lhs { + expr + } else { + let attrs = match lhs { + LhsExpr::AttributesParsed(attrs) => Some(attrs), + _ => None, + }; + if self.token == token::DotDot || self.token == token::DotDotDot { + return self.parse_prefix_range_expr(attrs); + } else { + try!(self.parse_prefix_expr(attrs)) + } + }; + + if self.expr_is_complete(&lhs) { + // Semi-statement forms are odd. See https://github.com/rust-lang/rust/issues/29071 + return Ok(lhs); + } + self.expected_tokens.push(TokenType::Operator); + while let Some(op) = AssocOp::from_token(&self.token) { + + let lhs_span = if self.prev_token_kind == PrevTokenKind::Interpolated { + self.prev_span + } else { + lhs.span + }; + + let cur_op_span = self.span; + let restrictions = if op.is_assign_like() { + self.restrictions & RESTRICTION_NO_STRUCT_LITERAL + } else { + self.restrictions + }; + if op.precedence() < min_prec { + break; + } + self.bump(); + if op.is_comparison() { + self.check_no_chained_comparison(&lhs, &op); + } + // Special cases: + if op == AssocOp::As { + let rhs = try!(self.parse_ty()); + let (lo, hi) = (lhs_span.lo, rhs.span.hi); + lhs = self.mk_expr(lo, hi, ExprKind::Cast(lhs, rhs), ThinVec::new()); + continue + } else if op == AssocOp::Colon { + let rhs = try!(self.parse_ty()); + let (lo, hi) = (lhs_span.lo, rhs.span.hi); + lhs = self.mk_expr(lo, hi, ExprKind::Type(lhs, rhs), ThinVec::new()); + continue + } else if op == AssocOp::DotDot || op == AssocOp::DotDotDot { + // If we didn’t have to handle `x..`/`x...`, it would be pretty easy to + // generalise it to the Fixity::None code. + // + // We have 2 alternatives here: `x..y`/`x...y` and `x..`/`x...` The other + // two variants are handled with `parse_prefix_range_expr` call above. + let rhs = if self.is_at_start_of_range_notation_rhs() { + Some(try!(self.parse_assoc_expr_with(op.precedence() + 1, + LhsExpr::NotYetParsed))) + } else { + None + }; + let (lhs_span, rhs_span) = (lhs.span, if let Some(ref x) = rhs { + x.span + } else { + cur_op_span + }); + let limits = if op == AssocOp::DotDot { + RangeLimits::HalfOpen + } else { + RangeLimits::Closed + }; + + let r = try!(self.mk_range(Some(lhs), rhs, limits)); + lhs = self.mk_expr(lhs_span.lo, rhs_span.hi, r, ThinVec::new()); + break + } + + let rhs = try!(match op.fixity() { + Fixity::Right => self.with_res( + restrictions - RESTRICTION_STMT_EXPR, + |this| { + this.parse_assoc_expr_with(op.precedence(), + LhsExpr::NotYetParsed) + }), + Fixity::Left => self.with_res( + restrictions - RESTRICTION_STMT_EXPR, + |this| { + this.parse_assoc_expr_with(op.precedence() + 1, + LhsExpr::NotYetParsed) + }), + // We currently have no non-associative operators that are not handled above by + // the special cases. The code is here only for future convenience. + Fixity::None => self.with_res( + restrictions - RESTRICTION_STMT_EXPR, + |this| { + this.parse_assoc_expr_with(op.precedence() + 1, + LhsExpr::NotYetParsed) + }), + }); + + let (lo, hi) = (lhs_span.lo, rhs.span.hi); + lhs = match op { + AssocOp::Add | AssocOp::Subtract | AssocOp::Multiply | AssocOp::Divide | + AssocOp::Modulus | AssocOp::LAnd | AssocOp::LOr | AssocOp::BitXor | + AssocOp::BitAnd | AssocOp::BitOr | AssocOp::ShiftLeft | AssocOp::ShiftRight | + AssocOp::Equal | AssocOp::Less | AssocOp::LessEqual | AssocOp::NotEqual | + AssocOp::Greater | AssocOp::GreaterEqual => { + let ast_op = op.to_ast_binop().unwrap(); + let binary = self.mk_binary(codemap::respan(cur_op_span, ast_op), lhs, rhs); + self.mk_expr(lo, hi, binary, ThinVec::new()) + } + AssocOp::Assign => + self.mk_expr(lo, hi, ExprKind::Assign(lhs, rhs), ThinVec::new()), + AssocOp::Inplace => + self.mk_expr(lo, hi, ExprKind::InPlace(lhs, rhs), ThinVec::new()), + AssocOp::AssignOp(k) => { + let aop = match k { + token::Plus => BinOpKind::Add, + token::Minus => BinOpKind::Sub, + token::Star => BinOpKind::Mul, + token::Slash => BinOpKind::Div, + token::Percent => BinOpKind::Rem, + token::Caret => BinOpKind::BitXor, + token::And => BinOpKind::BitAnd, + token::Or => BinOpKind::BitOr, + token::Shl => BinOpKind::Shl, + token::Shr => BinOpKind::Shr, + }; + let aopexpr = self.mk_assign_op(codemap::respan(cur_op_span, aop), lhs, rhs); + self.mk_expr(lo, hi, aopexpr, ThinVec::new()) + } + AssocOp::As | AssocOp::Colon | AssocOp::DotDot | AssocOp::DotDotDot => { + self.bug("As, Colon, DotDot or DotDotDot branch reached") + } + }; + + if op.fixity() == Fixity::None { break } + } + Ok(lhs) + } + + /// Produce an error if comparison operators are chained (RFC #558). + /// We only need to check lhs, not rhs, because all comparison ops + /// have same precedence and are left-associative + fn check_no_chained_comparison(&mut self, lhs: &Expr, outer_op: &AssocOp) { + debug_assert!(outer_op.is_comparison()); + match lhs.node { + ExprKind::Binary(op, _, _) if op.node.is_comparison() => { + // respan to include both operators + let op_span = mk_sp(op.span.lo, self.span.hi); + let mut err = self.diagnostic().struct_span_err(op_span, + "chained comparison operators require parentheses"); + if op.node == BinOpKind::Lt && *outer_op == AssocOp::Greater { + err.help( + "use `::<...>` instead of `<...>` if you meant to specify type arguments"); + } + err.emit(); + } + _ => {} + } + } + + /// Parse prefix-forms of range notation: `..expr`, `..`, `...expr` + fn parse_prefix_range_expr(&mut self, + already_parsed_attrs: Option>) + -> PResult<'a, P> { + debug_assert!(self.token == token::DotDot || self.token == token::DotDotDot); + let tok = self.token.clone(); + let attrs = try!(self.parse_or_use_outer_attributes(already_parsed_attrs)); + let lo = self.span.lo; + let mut hi = self.span.hi; + self.bump(); + let opt_end = if self.is_at_start_of_range_notation_rhs() { + // RHS must be parsed with more associativity than the dots. + let next_prec = AssocOp::from_token(&tok).unwrap().precedence() + 1; + Some(try!(self.parse_assoc_expr_with(next_prec, + LhsExpr::NotYetParsed) + .map(|x|{ + hi = x.span.hi; + x + }))) + } else { + None + }; + let limits = if tok == token::DotDot { + RangeLimits::HalfOpen + } else { + RangeLimits::Closed + }; + + let r = try!(self.mk_range(None, + opt_end, + limits)); + Ok(self.mk_expr(lo, hi, r, attrs)) + } + + fn is_at_start_of_range_notation_rhs(&self) -> bool { + if self.token.can_begin_expr() { + // parse `for i in 1.. { }` as infinite loop, not as `for i in (1..{})`. + if self.token == token::OpenDelim(token::Brace) { + return !self.restrictions.contains(RESTRICTION_NO_STRUCT_LITERAL); + } + true + } else { + false + } + } + + /// Parse an 'if' or 'if let' expression ('if' token already eaten) + pub fn parse_if_expr(&mut self, attrs: ThinVec) -> PResult<'a, P> { + if self.check_keyword(keywords::Let) { + return self.parse_if_let_expr(attrs); + } + let lo = self.prev_span.lo; + let cond = try!(self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, None)); + let thn = try!(self.parse_block()); + let mut els: Option> = None; + let mut hi = thn.span.hi; + if self.eat_keyword(keywords::Else) { + let elexpr = try!(self.parse_else_expr()); + hi = elexpr.span.hi; + els = Some(elexpr); + } + Ok(self.mk_expr(lo, hi, ExprKind::If(cond, thn, els), attrs)) + } + + /// Parse an 'if let' expression ('if' token already eaten) + pub fn parse_if_let_expr(&mut self, attrs: ThinVec) + -> PResult<'a, P> { + let lo = self.prev_span.lo; + try!(self.expect_keyword(keywords::Let)); + let pat = try!(self.parse_pat()); + try!(self.expect(&token::Eq)); + let expr = try!(self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, None)); + let thn = try!(self.parse_block()); + let (hi, els) = if self.eat_keyword(keywords::Else) { + let expr = try!(self.parse_else_expr()); + (expr.span.hi, Some(expr)) + } else { + (thn.span.hi, None) + }; + Ok(self.mk_expr(lo, hi, ExprKind::IfLet(pat, expr, thn, els), attrs)) + } + + // `move |args| expr` + pub fn parse_lambda_expr(&mut self, + lo: BytePos, + capture_clause: CaptureBy, + attrs: ThinVec) + -> PResult<'a, P> + { + let decl = try!(self.parse_fn_block_decl()); + let decl_hi = self.prev_span.hi; + let body = match decl.output { + FunctionRetTy::Default(_) => try!(self.parse_expr()), + _ => { + // If an explicit return type is given, require a + // block to appear (RFC 968). + let body_lo = self.span.lo; + try!(self.parse_block_expr(body_lo, BlockCheckMode::Default, ThinVec::new())) + } + }; + + Ok(self.mk_expr( + lo, + body.span.hi, + ExprKind::Closure(capture_clause, decl, body, mk_sp(lo, decl_hi)), + attrs)) + } + + // `else` token already eaten + pub fn parse_else_expr(&mut self) -> PResult<'a, P> { + if self.eat_keyword(keywords::If) { + return self.parse_if_expr(ThinVec::new()); + } else { + let blk = try!(self.parse_block()); + return Ok(self.mk_expr(blk.span.lo, blk.span.hi, ExprKind::Block(blk), ThinVec::new())); + } + } + + /// Parse a 'for' .. 'in' expression ('for' token already eaten) + pub fn parse_for_expr(&mut self, opt_ident: Option, + span_lo: BytePos, + mut attrs: ThinVec) -> PResult<'a, P> { + // Parse: `for in ` + + let pat = try!(self.parse_pat()); + try!(self.expect_keyword(keywords::In)); + let expr = try!(self.parse_expr_res(Restrictions::restriction_no_struct_literal(), None)); + let (iattrs, loop_block) = try!(self.parse_inner_attrs_and_block()); + attrs.extend(iattrs); + + let hi = self.prev_span.hi; + + Ok(self.mk_expr(span_lo, hi, + ExprKind::ForLoop(pat, expr, loop_block, opt_ident), + attrs)) + } + + /// Parse a 'while' or 'while let' expression ('while' token already eaten) + pub fn parse_while_expr(&mut self, opt_ident: Option, + span_lo: BytePos, + mut attrs: ThinVec) -> PResult<'a, P> { + if self.token.is_keyword(keywords::Let) { + return self.parse_while_let_expr(opt_ident, span_lo, attrs); + } + let cond = try!(self.parse_expr_res(Restrictions::restriction_no_struct_literal(), None)); + let (iattrs, body) = try!(self.parse_inner_attrs_and_block()); + attrs.extend(iattrs); + let hi = body.span.hi; + return Ok(self.mk_expr(span_lo, hi, ExprKind::While(cond, body, opt_ident), + attrs)); + } + + /// Parse a 'while let' expression ('while' token already eaten) + pub fn parse_while_let_expr(&mut self, opt_ident: Option, + span_lo: BytePos, + mut attrs: ThinVec) -> PResult<'a, P> { + try!(self.expect_keyword(keywords::Let)); + let pat = try!(self.parse_pat()); + try!(self.expect(&token::Eq)); + let expr = try!(self.parse_expr_res(Restrictions::restriction_no_struct_literal(), None)); + let (iattrs, body) = try!(self.parse_inner_attrs_and_block()); + attrs.extend(iattrs); + let hi = body.span.hi; + return Ok(self.mk_expr(span_lo, hi, ExprKind::WhileLet(pat, expr, body, opt_ident), attrs)); + } + + // parse `loop {...}`, `loop` token already eaten + pub fn parse_loop_expr(&mut self, opt_ident: Option, + span_lo: BytePos, + mut attrs: ThinVec) -> PResult<'a, P> { + let (iattrs, body) = try!(self.parse_inner_attrs_and_block()); + attrs.extend(iattrs); + let hi = body.span.hi; + Ok(self.mk_expr(span_lo, hi, ExprKind::Loop(body, opt_ident), attrs)) + } + + // `match` token already eaten + fn parse_match_expr(&mut self, mut attrs: ThinVec) -> PResult<'a, P> { + let match_span = self.prev_span; + let lo = self.prev_span.lo; + let discriminant = try!(self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL, + None)); + if let Err(mut e) = self.expect(&token::OpenDelim(token::Brace)) { + if self.token == token::Token::Semi { + e.span_note(match_span, "did you mean to remove this `match` keyword?"); + } + return Err(e) + } + attrs.extend(try!(self.parse_inner_attributes())); + + let mut arms: Vec = Vec::new(); + while self.token != token::CloseDelim(token::Brace) { + match self.parse_arm() { + Ok(arm) => arms.push(arm), + Err(mut e) => { + // Recover by skipping to the end of the block. + e.emit(); + self.recover_stmt(); + let hi = self.span.hi; + if self.token == token::CloseDelim(token::Brace) { + self.bump(); + } + return Ok(self.mk_expr(lo, hi, ExprKind::Match(discriminant, arms), attrs)); + } + } + } + let hi = self.span.hi; + self.bump(); + return Ok(self.mk_expr(lo, hi, ExprKind::Match(discriminant, arms), attrs)); + } + + pub fn parse_arm(&mut self) -> PResult<'a, Arm> { + maybe_whole!(self, NtArm, |x| x); + + let attrs = try!(self.parse_outer_attributes()); + let pats = try!(self.parse_pats()); + let mut guard = None; + if self.eat_keyword(keywords::If) { + guard = Some(try!(self.parse_expr())); + } + try!(self.expect(&token::FatArrow)); + let expr = try!(self.parse_expr_res(RESTRICTION_STMT_EXPR, None)); + + let require_comma = + !classify::expr_is_simple_block(&expr) + && self.token != token::CloseDelim(token::Brace); + + if require_comma { + try!(self.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)])); + } else { + self.eat(&token::Comma); + } + + Ok(ast::Arm { + attrs: attrs, + pats: pats, + guard: guard, + body: expr, + }) + } + + /// Parse an expression + pub fn parse_expr(&mut self) -> PResult<'a, P> { + self.parse_expr_res(Restrictions::empty(), None) + } + + /// Evaluate the closure with restrictions in place. + /// + /// After the closure is evaluated, restrictions are reset. + pub fn with_res(&mut self, r: Restrictions, f: F) -> T + where F: FnOnce(&mut Self) -> T + { + let old = self.restrictions; + self.restrictions = r; + let r = f(self); + self.restrictions = old; + return r; + + } + + /// Parse an expression, subject to the given restrictions + pub fn parse_expr_res(&mut self, r: Restrictions, + already_parsed_attrs: Option>) + -> PResult<'a, P> { + self.with_res(r, |this| this.parse_assoc_expr(already_parsed_attrs)) + } + + /// Parse the RHS of a local variable declaration (e.g. '= 14;') + fn parse_initializer(&mut self) -> PResult<'a, Option>> { + if self.check(&token::Eq) { + self.bump(); + Ok(Some(try!(self.parse_expr()))) + } else { + Ok(None) + } + } + + /// Parse patterns, separated by '|' s + fn parse_pats(&mut self) -> PResult<'a, Vec>> { + let mut pats = Vec::new(); + loop { + pats.push(try!(self.parse_pat())); + if self.check(&token::BinOp(token::Or)) { self.bump();} + else { return Ok(pats); } + }; + } + + fn parse_pat_tuple_elements(&mut self, unary_needs_comma: bool) + -> PResult<'a, (Vec>, Option)> { + let mut fields = vec![]; + let mut ddpos = None; + + while !self.check(&token::CloseDelim(token::Paren)) { + if ddpos.is_none() && self.eat(&token::DotDot) { + ddpos = Some(fields.len()); + if self.eat(&token::Comma) { + // `..` needs to be followed by `)` or `, pat`, `..,)` is disallowed. + fields.push(try!(self.parse_pat())); + } + } else if ddpos.is_some() && self.eat(&token::DotDot) { + // Emit a friendly error, ignore `..` and continue parsing + self.span_err(self.prev_span, "`..` can only be used once per \ + tuple or tuple struct pattern"); + } else { + fields.push(try!(self.parse_pat())); + } + + if !self.check(&token::CloseDelim(token::Paren)) || + (unary_needs_comma && fields.len() == 1 && ddpos.is_none()) { + try!(self.expect(&token::Comma)); + } + } + + Ok((fields, ddpos)) + } + + fn parse_pat_vec_elements( + &mut self, + ) -> PResult<'a, (Vec>, Option>, Vec>)> { + let mut before = Vec::new(); + let mut slice = None; + let mut after = Vec::new(); + let mut first = true; + let mut before_slice = true; + + while self.token != token::CloseDelim(token::Bracket) { + if first { + first = false; + } else { + try!(self.expect(&token::Comma)); + + if self.token == token::CloseDelim(token::Bracket) + && (before_slice || !after.is_empty()) { + break + } + } + + if before_slice { + if self.check(&token::DotDot) { + self.bump(); + + if self.check(&token::Comma) || + self.check(&token::CloseDelim(token::Bracket)) { + slice = Some(P(ast::Pat { + id: ast::DUMMY_NODE_ID, + node: PatKind::Wild, + span: self.span, + })); + before_slice = false; + } + continue + } + } + + let subpat = try!(self.parse_pat()); + if before_slice && self.check(&token::DotDot) { + self.bump(); + slice = Some(subpat); + before_slice = false; + } else if before_slice { + before.push(subpat); + } else { + after.push(subpat); + } + } + + Ok((before, slice, after)) + } + + /// Parse the fields of a struct-like pattern + fn parse_pat_fields(&mut self) -> PResult<'a, (Vec>, bool)> { + let mut fields = Vec::new(); + let mut etc = false; + let mut first = true; + while self.token != token::CloseDelim(token::Brace) { + if first { + first = false; + } else { + try!(self.expect(&token::Comma)); + // accept trailing commas + if self.check(&token::CloseDelim(token::Brace)) { break } + } + + let lo = self.span.lo; + let hi; + + if self.check(&token::DotDot) { + self.bump(); + if self.token != token::CloseDelim(token::Brace) { + let token_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected `{}`, found `{}`", "}", + token_str))) + } + etc = true; + break; + } + + // Check if a colon exists one ahead. This means we're parsing a fieldname. + let (subpat, fieldname, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) { + // Parsing a pattern of the form "fieldname: pat" + let fieldname = try!(self.parse_field_name()); + self.bump(); + let pat = try!(self.parse_pat()); + hi = pat.span.hi; + (pat, fieldname, false) + } else { + // Parsing a pattern of the form "(box) (ref) (mut) fieldname" + let is_box = self.eat_keyword(keywords::Box); + let boxed_span_lo = self.span.lo; + let is_ref = self.eat_keyword(keywords::Ref); + let is_mut = self.eat_keyword(keywords::Mut); + let fieldname = try!(self.parse_ident()); + hi = self.prev_span.hi; + + let bind_type = match (is_ref, is_mut) { + (true, true) => BindingMode::ByRef(Mutability::Mutable), + (true, false) => BindingMode::ByRef(Mutability::Immutable), + (false, true) => BindingMode::ByValue(Mutability::Mutable), + (false, false) => BindingMode::ByValue(Mutability::Immutable), + }; + let fieldpath = codemap::Spanned{span:self.prev_span, node:fieldname}; + let fieldpat = P(ast::Pat{ + id: ast::DUMMY_NODE_ID, + node: PatKind::Ident(bind_type, fieldpath, None), + span: mk_sp(boxed_span_lo, hi), + }); + + let subpat = if is_box { + P(ast::Pat{ + id: ast::DUMMY_NODE_ID, + node: PatKind::Box(fieldpat), + span: mk_sp(lo, hi), + }) + } else { + fieldpat + }; + (subpat, fieldname, true) + }; + + fields.push(codemap::Spanned { span: mk_sp(lo, hi), + node: ast::FieldPat { ident: fieldname, + pat: subpat, + is_shorthand: is_shorthand }}); + } + return Ok((fields, etc)); + } + + fn parse_pat_range_end(&mut self) -> PResult<'a, P> { + if self.token.is_path_start() { + let lo = self.span.lo; + let (qself, path) = if self.eat_lt() { + // Parse a qualified path + let (qself, path) = + try!(self.parse_qualified_path(PathStyle::Expr)); + (Some(qself), path) + } else { + // Parse an unqualified path + (None, try!(self.parse_path(PathStyle::Expr))) + }; + let hi = self.prev_span.hi; + Ok(self.mk_expr(lo, hi, ExprKind::Path(qself, path), ThinVec::new())) + } else { + self.parse_pat_literal_maybe_minus() + } + } + + /// Parse a pattern. + pub fn parse_pat(&mut self) -> PResult<'a, P> { + maybe_whole!(self, NtPat, |x| x); + + let lo = self.span.lo; + let pat; + match self.token { + token::Underscore => { + // Parse _ + self.bump(); + pat = PatKind::Wild; + } + token::BinOp(token::And) | token::AndAnd => { + // Parse &pat / &mut pat + try!(self.expect_and()); + let mutbl = try!(self.parse_mutability()); + if let token::Lifetime(ident) = self.token { + return Err(self.fatal(&format!("unexpected lifetime `{}` in pattern", ident))); + } + let subpat = try!(self.parse_pat()); + pat = PatKind::Ref(subpat, mutbl); + } + token::OpenDelim(token::Paren) => { + // Parse (pat,pat,pat,...) as tuple pattern + self.bump(); + let (fields, ddpos) = try!(self.parse_pat_tuple_elements(true)); + try!(self.expect(&token::CloseDelim(token::Paren))); + pat = PatKind::Tuple(fields, ddpos); + } + token::OpenDelim(token::Bracket) => { + // Parse [pat,pat,...] as slice pattern + self.bump(); + let (before, slice, after) = try!(self.parse_pat_vec_elements()); + try!(self.expect(&token::CloseDelim(token::Bracket))); + pat = PatKind::Slice(before, slice, after); + } + // At this point, token != _, &, &&, (, [ + _ => if self.eat_keyword(keywords::Mut) { + // Parse mut ident @ pat + pat = try!(self.parse_pat_ident(BindingMode::ByValue(Mutability::Mutable))); + } else if self.eat_keyword(keywords::Ref) { + // Parse ref ident @ pat / ref mut ident @ pat + let mutbl = try!(self.parse_mutability()); + pat = try!(self.parse_pat_ident(BindingMode::ByRef(mutbl))); + } else if self.eat_keyword(keywords::Box) { + // Parse box pat + let subpat = try!(self.parse_pat()); + pat = PatKind::Box(subpat); + } else if self.token.is_ident() && !self.token.is_any_keyword() && + self.look_ahead(1, |t| match *t { + token::OpenDelim(token::Paren) | token::OpenDelim(token::Brace) | + token::DotDotDot | token::ModSep | token::Not => false, + _ => true, + }) { + // Parse ident @ pat + // This can give false positives and parse nullary enums, + // they are dealt with later in resolve + let binding_mode = BindingMode::ByValue(Mutability::Immutable); + pat = try!(self.parse_pat_ident(binding_mode)); + } else if self.token.is_path_start() { + // Parse pattern starting with a path + let (qself, path) = if self.eat_lt() { + // Parse a qualified path + let (qself, path) = try!(self.parse_qualified_path(PathStyle::Expr)); + (Some(qself), path) + } else { + // Parse an unqualified path + (None, try!(self.parse_path(PathStyle::Expr))) + }; + match self.token { + token::Not if qself.is_none() => { + // Parse macro invocation + self.bump(); + let delim = try!(self.expect_open_delim()); + let tts = try!(self.parse_seq_to_end(&token::CloseDelim(delim), + SeqSep::none(), + |p| p.parse_token_tree())); + let mac = spanned(lo, self.prev_span.hi, Mac_ { path: path, tts: tts }); + pat = PatKind::Mac(mac); + } + token::DotDotDot => { + // Parse range + let hi = self.prev_span.hi; + let begin = + self.mk_expr(lo, hi, ExprKind::Path(qself, path), ThinVec::new()); + self.bump(); + let end = try!(self.parse_pat_range_end()); + pat = PatKind::Range(begin, end); + } + token::OpenDelim(token::Brace) => { + if qself.is_some() { + return Err(self.fatal("unexpected `{` after qualified path")); + } + // Parse struct pattern + self.bump(); + let (fields, etc) = self.parse_pat_fields().unwrap_or_else(|mut e| { + e.emit(); + self.recover_stmt(); + (vec![], false) + }); + self.bump(); + pat = PatKind::Struct(path, fields, etc); + } + token::OpenDelim(token::Paren) => { + if qself.is_some() { + return Err(self.fatal("unexpected `(` after qualified path")); + } + // Parse tuple struct or enum pattern + self.bump(); + let (fields, ddpos) = try!(self.parse_pat_tuple_elements(false)); + try!(self.expect(&token::CloseDelim(token::Paren))); + pat = PatKind::TupleStruct(path, fields, ddpos) + } + _ => pat = PatKind::Path(qself, path), + } + } else { + // Try to parse everything else as literal with optional minus + match self.parse_pat_literal_maybe_minus() { + Ok(begin) => { + if self.eat(&token::DotDotDot) { + let end = try!(self.parse_pat_range_end()); + pat = PatKind::Range(begin, end); + } else { + pat = PatKind::Lit(begin); + } + } + Err(mut err) => { + self.cancel(&mut err); + let msg = format!("expected pattern, found {}", self.this_token_descr()); + return Err(self.fatal(&msg)); + } + } + } + } + + let hi = self.prev_span.hi; + Ok(P(ast::Pat { + id: ast::DUMMY_NODE_ID, + node: pat, + span: mk_sp(lo, hi), + })) + } + + /// Parse ident or ident @ pat + /// used by the copy foo and ref foo patterns to give a good + /// error message when parsing mistakes like ref foo(a,b) + fn parse_pat_ident(&mut self, + binding_mode: ast::BindingMode) + -> PResult<'a, PatKind> { + let ident = try!(self.parse_ident()); + let prev_span = self.prev_span; + let name = codemap::Spanned{span: prev_span, node: ident}; + let sub = if self.eat(&token::At) { + Some(try!(self.parse_pat())) + } else { + None + }; + + // just to be friendly, if they write something like + // ref Some(i) + // we end up here with ( as the current token. This shortly + // leads to a parse error. Note that if there is no explicit + // binding mode then we do not end up here, because the lookahead + // will direct us over to parse_enum_variant() + if self.token == token::OpenDelim(token::Paren) { + return Err(self.span_fatal( + self.prev_span, + "expected identifier, found enum pattern")) + } + + Ok(PatKind::Ident(binding_mode, name, sub)) + } + + /// Parse a local variable declaration + fn parse_local(&mut self, attrs: ThinVec) -> PResult<'a, P> { + let lo = self.span.lo; + let pat = try!(self.parse_pat()); + + let mut ty = None; + if self.eat(&token::Colon) { + ty = Some(try!(self.parse_ty_sum())); + } + let init = try!(self.parse_initializer()); + Ok(P(ast::Local { + ty: ty, + pat: pat, + init: init, + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, self.prev_span.hi), + attrs: attrs, + })) + } + + /// Parse a structure field + fn parse_name_and_ty(&mut self, + lo: BytePos, + vis: Visibility, + attrs: Vec) + -> PResult<'a, StructField> { + let name = try!(self.parse_ident()); + try!(self.expect(&token::Colon)); + let ty = try!(self.parse_ty_sum()); + Ok(StructField { + span: mk_sp(lo, self.prev_span.hi), + ident: Some(name), + vis: vis, + id: ast::DUMMY_NODE_ID, + ty: ty, + attrs: attrs, + }) + } + + /// Emit an expected item after attributes error. + fn expected_item_err(&self, attrs: &[Attribute]) { + let message = match attrs.last() { + Some(&Attribute { is_sugared_doc: true, .. }) => "expected item after doc comment", + _ => "expected item after attributes", + }; + + self.span_err(self.prev_span, message); + } + + /// Parse a statement. This stops just before trailing semicolons on everything but items. + /// e.g. a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed. + pub fn parse_stmt(&mut self) -> PResult<'a, Option> { + Ok(self.parse_stmt_(true)) + } + + // Eat tokens until we can be relatively sure we reached the end of the + // statement. This is something of a best-effort heuristic. + // + // We terminate when we find an unmatched `}` (without consuming it). + fn recover_stmt(&mut self) { + self.recover_stmt_(SemiColonMode::Ignore) + } + // If `break_on_semi` is `Break`, then we will stop consuming tokens after + // finding (and consuming) a `;` outside of `{}` or `[]` (note that this is + // approximate - it can mean we break too early due to macros, but that + // shoud only lead to sub-optimal recovery, not inaccurate parsing). + fn recover_stmt_(&mut self, break_on_semi: SemiColonMode) { + let mut brace_depth = 0; + let mut bracket_depth = 0; + debug!("recover_stmt_ enter loop"); + loop { + debug!("recover_stmt_ loop {:?}", self.token); + match self.token { + token::OpenDelim(token::DelimToken::Brace) => { + brace_depth += 1; + self.bump(); + } + token::OpenDelim(token::DelimToken::Bracket) => { + bracket_depth += 1; + self.bump(); + } + token::CloseDelim(token::DelimToken::Brace) => { + if brace_depth == 0 { + debug!("recover_stmt_ return - close delim {:?}", self.token); + return; + } + brace_depth -= 1; + self.bump(); + } + token::CloseDelim(token::DelimToken::Bracket) => { + bracket_depth -= 1; + if bracket_depth < 0 { + bracket_depth = 0; + } + self.bump(); + } + token::Eof => { + debug!("recover_stmt_ return - Eof"); + return; + } + token::Semi => { + self.bump(); + if break_on_semi == SemiColonMode::Break && + brace_depth == 0 && + bracket_depth == 0 { + debug!("recover_stmt_ return - Semi"); + return; + } + } + _ => { + self.bump() + } + } + } + } + + fn parse_stmt_(&mut self, macro_legacy_warnings: bool) -> Option { + self.parse_stmt_without_recovery(macro_legacy_warnings).unwrap_or_else(|mut e| { + e.emit(); + self.recover_stmt_(SemiColonMode::Break); + None + }) + } + + fn is_union_item(&mut self) -> bool { + self.token.is_keyword(keywords::Union) && + self.look_ahead(1, |t| t.is_ident() && !t.is_any_keyword()) + } + + fn parse_stmt_without_recovery(&mut self, + macro_legacy_warnings: bool) + -> PResult<'a, Option> { + maybe_whole!(self, NtStmt, |x| Some(x)); + + let attrs = try!(self.parse_outer_attributes()); + let lo = self.span.lo; + + Ok(Some(if self.eat_keyword(keywords::Let) { + Stmt { + id: ast::DUMMY_NODE_ID, + node: StmtKind::Local(try!(self.parse_local(attrs.into()))), + span: mk_sp(lo, self.prev_span.hi), + } + // Starts like a simple path, but not a union item. + } else if self.token.is_path_start() && + !self.token.is_qpath_start() && + !self.is_union_item() { + let pth = try!(self.parse_path(PathStyle::Expr)); + + if !self.eat(&token::Not) { + let expr = if self.check(&token::OpenDelim(token::Brace)) { + try!(self.parse_struct_expr(lo, pth, ThinVec::new())) + } else { + let hi = self.prev_span.hi; + self.mk_expr(lo, hi, ExprKind::Path(None, pth), ThinVec::new()) + }; + + let expr = try!(self.with_res(Restrictions::restriction_stmt_expr(), |this| { + let expr = try!(this.parse_dot_or_call_expr_with(expr, lo, attrs.into())); + this.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(expr)) + })); + + return Ok(Some(Stmt { + id: ast::DUMMY_NODE_ID, + node: StmtKind::Expr(expr), + span: mk_sp(lo, self.prev_span.hi), + })); + } + + // it's a macro invocation + let id = match self.token { + token::OpenDelim(_) => keywords::Invalid.ident(), // no special identifier + _ => try!(self.parse_ident()), + }; + + // check that we're pointing at delimiters (need to check + // again after the `if`, because of `parse_ident` + // consuming more tokens). + let delim = match self.token { + token::OpenDelim(delim) => delim, + _ => { + // we only expect an ident if we didn't parse one + // above. + let ident_str = if id.name == keywords::Invalid.name() { + "identifier, " + } else { + "" + }; + let tok_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected {}`(` or `{{`, found `{}`", + ident_str, + tok_str))) + }, + }; + + let tts = try!(self.parse_unspanned_seq( + &token::OpenDelim(delim), + &token::CloseDelim(delim), + SeqSep::none(), + |p| p.parse_token_tree() + )); + let hi = self.prev_span.hi; + + let style = if delim == token::Brace { + MacStmtStyle::Braces + } else { + MacStmtStyle::NoBraces + }; + + if id.name == keywords::Invalid.name() { + let mac = spanned(lo, hi, Mac_ { path: pth, tts: tts }); + let node = if delim == token::Brace || + self.token == token::Semi || self.token == token::Eof { + StmtKind::Mac(P((mac, style, attrs.into()))) + } + // We used to incorrectly stop parsing macro-expanded statements here. + // If the next token will be an error anyway but could have parsed with the + // earlier behavior, stop parsing here and emit a warning to avoid breakage. + else if macro_legacy_warnings && self.token.can_begin_expr() && match self.token { + // These can continue an expression, so we can't stop parsing and warn. + token::OpenDelim(token::Paren) | token::OpenDelim(token::Bracket) | + token::BinOp(token::Minus) | token::BinOp(token::Star) | + token::BinOp(token::And) | token::BinOp(token::Or) | + token::AndAnd | token::OrOr | + token::DotDot | token::DotDotDot => false, + _ => true, + } { + self.warn_missing_semicolon(); + StmtKind::Mac(P((mac, style, attrs.into()))) + } else { + let e = self.mk_mac_expr(lo, hi, mac.node, ThinVec::new()); + let e = try!(self.parse_dot_or_call_expr_with(e, lo, attrs.into())); + let e = try!(self.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(e))); + StmtKind::Expr(e) + }; + Stmt { + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, hi), + node: node, + } + } else { + // if it has a special ident, it's definitely an item + // + // Require a semicolon or braces. + if style != MacStmtStyle::Braces { + if !self.eat(&token::Semi) { + self.span_err(self.prev_span, + "macros that expand to items must \ + either be surrounded with braces or \ + followed by a semicolon"); + } + } + Stmt { + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, hi), + node: StmtKind::Item({ + self.mk_item( + lo, hi, id /*id is good here*/, + ItemKind::Mac(spanned(lo, hi, Mac_ { path: pth, tts: tts })), + Visibility::Inherited, + attrs) + }), + } + } + } else { + // FIXME: Bad copy of attrs + let old_directory_ownership = + mem::replace(&mut self.directory.ownership, DirectoryOwnership::UnownedViaBlock); + let item = try!(self.parse_item_(attrs.clone(), false, true)); + self.directory.ownership = old_directory_ownership; + match item { + Some(i) => Stmt { + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, i.span.hi), + node: StmtKind::Item(i), + }, + None => { + let unused_attrs = |attrs: &[_], s: &mut Self| { + if attrs.len() > 0 { + if s.prev_token_kind == PrevTokenKind::DocComment { + s.span_err_help(s.prev_span, + "found a documentation comment that doesn't document anything", + "doc comments must come before what they document, maybe a \ + comment was intended with `//`?"); + } else { + s.span_err(s.span, "expected statement after outer attribute"); + } + } + }; + + // Do not attempt to parse an expression if we're done here. + if self.token == token::Semi { + unused_attrs(&attrs, self); + self.bump(); + return Ok(None); + } + + if self.token == token::CloseDelim(token::Brace) { + unused_attrs(&attrs, self); + return Ok(None); + } + + // Remainder are line-expr stmts. + let e = try!(self.parse_expr_res( + Restrictions::restriction_stmt_expr(), Some(attrs.into()))); + Stmt { + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, e.span.hi), + node: StmtKind::Expr(e), + } + } + } + })) + } + + /// Is this expression a successfully-parsed statement? + fn expr_is_complete(&mut self, e: &Expr) -> bool { + self.restrictions.contains(RESTRICTION_STMT_EXPR) && + !classify::expr_requires_semi_to_be_stmt(e) + } + + /// Parse a block. No inner attrs are allowed. + pub fn parse_block(&mut self) -> PResult<'a, P> { + maybe_whole!(self, NtBlock, |x| x); + + let lo = self.span.lo; + + if !self.eat(&token::OpenDelim(token::Brace)) { + let sp = self.span; + let tok = self.this_token_to_string(); + let mut e = self.span_fatal(sp, &format!("expected `{{`, found `{}`", tok)); + + // Check to see if the user has written something like + // + // if (cond) + // bar; + // + // Which is valid in other languages, but not Rust. + match self.parse_stmt_without_recovery(false) { + Ok(Some(stmt)) => { + let mut stmt_span = stmt.span; + // expand the span to include the semicolon, if it exists + if self.eat(&token::Semi) { + stmt_span.hi = self.prev_span.hi; + } + e.span_help(stmt_span, "try placing this code inside a block"); + } + Err(mut e) => { + self.recover_stmt_(SemiColonMode::Break); + self.cancel(&mut e); + } + _ => () + } + return Err(e); + } + + self.parse_block_tail(lo, BlockCheckMode::Default) + } + + /// Parse a block. Inner attrs are allowed. + fn parse_inner_attrs_and_block(&mut self) -> PResult<'a, (Vec, P)> { + maybe_whole!(self, NtBlock, |x| (Vec::new(), x)); + + let lo = self.span.lo; + try!(self.expect(&token::OpenDelim(token::Brace))); + Ok((try!(self.parse_inner_attributes()), + try!(self.parse_block_tail(lo, BlockCheckMode::Default)))) + } + + /// Parse the rest of a block expression or function body + /// Precondition: already parsed the '{'. + fn parse_block_tail(&mut self, lo: BytePos, s: BlockCheckMode) -> PResult<'a, P> { + let mut stmts = vec![]; + + while !self.eat(&token::CloseDelim(token::Brace)) { + if let Some(stmt) = try!(self.parse_full_stmt(false)) { + stmts.push(stmt); + } else if self.token == token::Eof { + break; + } else { + // Found only `;` or `}`. + continue; + }; + } + + Ok(P(ast::Block { + stmts: stmts, + id: ast::DUMMY_NODE_ID, + rules: s, + span: mk_sp(lo, self.prev_span.hi), + })) + } + + /// Parse a statement, including the trailing semicolon. + pub fn parse_full_stmt(&mut self, macro_legacy_warnings: bool) -> PResult<'a, Option> { + let mut stmt = match self.parse_stmt_(macro_legacy_warnings) { + Some(stmt) => stmt, + None => return Ok(None), + }; + + match stmt.node { + StmtKind::Expr(ref expr) if self.token != token::Eof => { + // expression without semicolon + if classify::expr_requires_semi_to_be_stmt(expr) { + // Just check for errors and recover; do not eat semicolon yet. + if let Err(mut e) = + self.expect_one_of(&[], &[token::Semi, token::CloseDelim(token::Brace)]) + { + e.emit(); + self.recover_stmt(); + } + } + } + StmtKind::Local(..) => { + // We used to incorrectly allow a macro-expanded let statement to lack a semicolon. + if macro_legacy_warnings && self.token != token::Semi { + self.warn_missing_semicolon(); + } else { + try!(self.expect_one_of(&[token::Semi], &[])); + } + } + _ => {} + } + + if self.eat(&token::Semi) { + stmt = stmt.add_trailing_semicolon(); + } + + stmt.span.hi = self.prev_span.hi; + Ok(Some(stmt)) + } + + fn warn_missing_semicolon(&self) { + self.diagnostic().struct_span_warn(self.span, { + &format!("expected `;`, found `{}`", self.this_token_to_string()) + }).note({ + "This was erroneously allowed and will become a hard error in a future release" + }).emit(); + } + + // Parses a sequence of bounds if a `:` is found, + // otherwise returns empty list. + fn parse_colon_then_ty_param_bounds(&mut self) -> PResult<'a, TyParamBounds> + { + if !self.eat(&token::Colon) { + Ok(P::new()) + } else { + self.parse_ty_param_bounds() + } + } + + // matches bounds = ( boundseq )? + // where boundseq = ( polybound + boundseq ) | polybound + // and polybound = ( 'for' '<' 'region '>' )? bound + // and bound = 'region | trait_ref + fn parse_ty_param_bounds(&mut self) -> PResult<'a, TyParamBounds> + { + let mut result = vec![]; + loop { + let question_span = self.span; + let ate_question = self.eat(&token::Question); + match self.token { + token::Lifetime(lifetime) => { + if ate_question { + self.span_err(question_span, + "`?` may only modify trait bounds, not lifetime bounds"); + } + result.push(RegionTyParamBound(ast::Lifetime { + id: ast::DUMMY_NODE_ID, + span: self.span, + name: lifetime.name + })); + self.bump(); + } + _ if self.token.is_path_start() || self.token.is_keyword(keywords::For) => { + let poly_trait_ref = try!(self.parse_poly_trait_ref()); + let modifier = if ate_question { + TraitBoundModifier::Maybe + } else { + TraitBoundModifier::None + }; + result.push(TraitTyParamBound(poly_trait_ref, modifier)) + } + _ => break, + } + + if !self.eat(&token::BinOp(token::Plus)) { + break; + } + } + + return Ok(P::from_vec(result)); + } + + /// Matches typaram = IDENT (`?` unbound)? optbounds ( EQ ty )? + fn parse_ty_param(&mut self, preceding_attrs: Vec) -> PResult<'a, TyParam> { + let span = self.span; + let ident = try!(self.parse_ident()); + + let bounds = try!(self.parse_colon_then_ty_param_bounds()); + + let default = if self.check(&token::Eq) { + self.bump(); + Some(try!(self.parse_ty_sum())) + } else { + None + }; + + Ok(TyParam { + attrs: preceding_attrs.into(), + ident: ident, + id: ast::DUMMY_NODE_ID, + bounds: bounds, + default: default, + span: span, + }) + } + + /// Parse a set of optional generic type parameter declarations. Where + /// clauses are not parsed here, and must be added later via + /// `parse_where_clause()`. + /// + /// matches generics = ( ) | ( < > ) | ( < typaramseq ( , )? > ) | ( < lifetimes ( , )? > ) + /// | ( < lifetimes , typaramseq ( , )? > ) + /// where typaramseq = ( typaram ) | ( typaram , typaramseq ) + pub fn parse_generics(&mut self) -> PResult<'a, ast::Generics> { + maybe_whole!(self, NtGenerics, |x| x); + let span_lo = self.span.lo; + + if self.eat(&token::Lt) { + // Upon encountering attribute in generics list, we do not + // know if it is attached to lifetime or to type param. + // + // Solution: 1. eagerly parse attributes in tandem with + // lifetime defs, 2. store last set of parsed (and unused) + // attributes in `attrs`, and 3. pass in those attributes + // when parsing formal type param after lifetime defs. + let mut attrs = vec![]; + let lifetime_defs = try!(self.parse_lifetime_defs(Some(&mut attrs))); + let mut seen_default = false; + let mut post_lifetime_attrs = Some(attrs); + let ty_params = try!(self.parse_seq_to_gt(Some(token::Comma), |p| { + try!(p.forbid_lifetime()); + // Move out of `post_lifetime_attrs` if present. O/w + // not first type param: parse attributes anew. + let attrs = match post_lifetime_attrs.as_mut() { + None => try!(p.parse_outer_attributes()), + Some(attrs) => mem::replace(attrs, vec![]), + }; + post_lifetime_attrs = None; + let ty_param = try!(p.parse_ty_param(attrs)); + if ty_param.default.is_some() { + seen_default = true; + } else if seen_default { + let prev_span = p.prev_span; + p.span_err(prev_span, + "type parameters with a default must be trailing"); + } + Ok(ty_param) + })); + if let Some(attrs) = post_lifetime_attrs { + if !attrs.is_empty() { + self.span_err(attrs[0].span, + "trailing attribute after lifetime parameters"); + } + } + Ok(ast::Generics { + lifetimes: lifetime_defs, + ty_params: ty_params, + where_clause: WhereClause { + id: ast::DUMMY_NODE_ID, + predicates: Vec::new(), + }, + span: mk_sp(span_lo, self.prev_span.hi), + }) + } else { + Ok(ast::Generics::default()) + } + } + + fn parse_generic_values_after_lt(&mut self) -> PResult<'a, (Vec, + Vec>, + Vec)> { + let span_lo = self.span.lo; + let lifetimes = try!(self.parse_lifetimes(token::Comma)); + + let missing_comma = !lifetimes.is_empty() && + !self.token.is_like_gt() && + self.prev_token_kind != PrevTokenKind::Comma; + + if missing_comma { + + let msg = format!("expected `,` or `>` after lifetime \ + name, found `{}`", + self.this_token_to_string()); + let mut err = self.diagnostic().struct_span_err(self.span, &msg); + + let span_hi = self.span.hi; + let span_hi = match self.parse_ty() { + Ok(..) => self.span.hi, + Err(ref mut err) => { + self.cancel(err); + span_hi + } + }; + + let msg = format!("did you mean a single argument type &'a Type, \ + or did you mean the comma-separated arguments \ + 'a, Type?"); + err.span_note(mk_sp(span_lo, span_hi), &msg); + return Err(err); + } + + // First parse types. + let (types, returned) = try!(self.parse_seq_to_gt_or_return( + Some(token::Comma), + |p| { + try!(p.forbid_lifetime()); + if p.look_ahead(1, |t| t == &token::Eq) { + Ok(None) + } else { + Ok(Some(try!(p.parse_ty_sum()))) + } + } + )); + + // If we found the `>`, don't continue. + if !returned { + return Ok((lifetimes, types.into_vec(), Vec::new())); + } + + // Then parse type bindings. + let bindings = try!(self.parse_seq_to_gt( + Some(token::Comma), + |p| { + try!(p.forbid_lifetime()); + let lo = p.span.lo; + let ident = try!(p.parse_ident()); + try!(p.expect(&token::Eq)); + let ty = try!(p.parse_ty()); + let hi = ty.span.hi; + let span = mk_sp(lo, hi); + return Ok(TypeBinding{id: ast::DUMMY_NODE_ID, + ident: ident, + ty: ty, + span: span, + }); + } + )); + Ok((lifetimes, types.into_vec(), bindings.into_vec())) + } + + fn forbid_lifetime(&mut self) -> PResult<'a, ()> { + if self.token.is_lifetime() { + let span = self.span; + return Err(self.diagnostic().struct_span_err(span, "lifetime parameters must be \ + declared prior to type parameters")) + } + Ok(()) + } + + /// Parses an optional `where` clause and places it in `generics`. + /// + /// ```ignore + /// where T : Trait + 'b, 'a : 'b + /// ``` + pub fn parse_where_clause(&mut self) -> PResult<'a, ast::WhereClause> { + maybe_whole!(self, NtWhereClause, |x| x); + + let mut where_clause = WhereClause { + id: ast::DUMMY_NODE_ID, + predicates: Vec::new(), + }; + + if !self.eat_keyword(keywords::Where) { + return Ok(where_clause); + } + + // This is a temporary hack. + // + // We are considering adding generics to the `where` keyword as an alternative higher-rank + // parameter syntax (as in `where<'a>` or `where`. To avoid that being a breaking + // change, for now we refuse to parse `where < (ident | lifetime) (> | , | :)`. + if token::Lt == self.token { + let ident_or_lifetime = self.look_ahead(1, |t| t.is_ident() || t.is_lifetime()); + if ident_or_lifetime { + let gt_comma_or_colon = self.look_ahead(2, |t| { + *t == token::Gt || *t == token::Comma || *t == token::Colon + }); + if gt_comma_or_colon { + self.span_err(self.span, "syntax `where` is reserved for future use"); + } + } + } + + let mut parsed_something = false; + loop { + let lo = self.span.lo; + match self.token { + token::OpenDelim(token::Brace) => { + break + } + + token::Lifetime(..) => { + let bounded_lifetime = + try!(self.parse_lifetime()); + + try!(self.expect(&token::Colon)); + + let bounds = + try!(self.parse_lifetimes(token::BinOp(token::Plus))); + + let hi = self.prev_span.hi; + let span = mk_sp(lo, hi); + + where_clause.predicates.push(ast::WherePredicate::RegionPredicate( + ast::WhereRegionPredicate { + span: span, + lifetime: bounded_lifetime, + bounds: bounds + } + )); + + parsed_something = true; + } + + _ => { + let bound_lifetimes = if self.eat_keyword(keywords::For) { + // Higher ranked constraint. + try!(self.expect(&token::Lt)); + let lifetime_defs = try!(self.parse_lifetime_defs(None)); + try!(self.expect_gt()); + lifetime_defs + } else { + vec![] + }; + + let bounded_ty = try!(self.parse_ty()); + + if self.eat(&token::Colon) { + let bounds = try!(self.parse_ty_param_bounds()); + let hi = self.prev_span.hi; + let span = mk_sp(lo, hi); + + if bounds.is_empty() { + self.span_err(span, + "each predicate in a `where` clause must have \ + at least one bound in it"); + } + + where_clause.predicates.push(ast::WherePredicate::BoundPredicate( + ast::WhereBoundPredicate { + span: span, + bound_lifetimes: bound_lifetimes, + bounded_ty: bounded_ty, + bounds: bounds, + })); + + parsed_something = true; + } else if self.eat(&token::Eq) { + // let ty = try!(self.parse_ty()); + let hi = self.prev_span.hi; + let span = mk_sp(lo, hi); + // where_clause.predicates.push( + // ast::WherePredicate::EqPredicate(ast::WhereEqPredicate { + // id: ast::DUMMY_NODE_ID, + // span: span, + // path: panic!("NYI"), //bounded_ty, + // ty: ty, + // })); + // parsed_something = true; + // // FIXME(#18433) + self.span_err(span, + "equality constraints are not yet supported \ + in where clauses (#20041)"); + } else { + let prev_span = self.prev_span; + self.span_err(prev_span, + "unexpected token in `where` clause"); + } + } + }; + + if !self.eat(&token::Comma) { + break + } + } + + if !parsed_something { + let prev_span = self.prev_span; + self.span_err(prev_span, + "a `where` clause must have at least one predicate \ + in it"); + } + + Ok(where_clause) + } + + fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool) + -> PResult<'a, (Vec , bool)> { + let sp = self.span; + let mut variadic = false; + let args: Vec> = + try!(self.parse_unspanned_seq( + &token::OpenDelim(token::Paren), + &token::CloseDelim(token::Paren), + SeqSep::trailing_allowed(token::Comma), + |p| { + if p.token == token::DotDotDot { + p.bump(); + if allow_variadic { + if p.token != token::CloseDelim(token::Paren) { + let span = p.span; + p.span_err(span, + "`...` must be last in argument list for variadic function"); + } + } else { + let span = p.span; + p.span_err(span, + "only foreign functions are allowed to be variadic"); + } + variadic = true; + Ok(None) + } else { + match p.parse_arg_general(named_args) { + Ok(arg) => Ok(Some(arg)), + Err(mut e) => { + e.emit(); + p.eat_to_tokens(&[&token::Comma, &token::CloseDelim(token::Paren)]); + Ok(None) + } + } + } + } + )); + + let args: Vec<_> = args.into_iter().filter_map(|x| x).collect(); + + if variadic && args.is_empty() { + self.span_err(sp, + "variadic function must be declared with at least one named argument"); + } + + Ok((args, variadic)) + } + + /// Parse the argument list and result type of a function declaration + pub fn parse_fn_decl(&mut self, allow_variadic: bool) -> PResult<'a, P> { + + let (args, variadic) = try!(self.parse_fn_args(true, allow_variadic)); + let ret_ty = try!(self.parse_ret_ty()); + + Ok(P(FnDecl { + inputs: args, + output: ret_ty, + variadic: variadic + })) + } + + /// Returns the parsed optional self argument and whether a self shortcut was used. + fn parse_self_arg(&mut self) -> PResult<'a, Option> { + let expect_ident = |this: &mut Self| match this.token { + // Preserve hygienic context. + token::Ident(ident) => { this.bump(); codemap::respan(this.prev_span, ident) } + _ => unreachable!() + }; + let isolated_self = |this: &mut Self, n| { + this.look_ahead(n, |t| t.is_keyword(keywords::SelfValue)) && + this.look_ahead(n + 1, |t| t != &token::ModSep) + }; + + // Parse optional self parameter of a method. + // Only a limited set of initial token sequences is considered self parameters, anything + // else is parsed as a normal function parameter list, so some lookahead is required. + let eself_lo = self.span.lo; + let (eself, eself_ident) = match self.token { + token::BinOp(token::And) => { + // &self + // &mut self + // &'lt self + // &'lt mut self + // ¬_self + if isolated_self(self, 1) { + self.bump(); + (SelfKind::Region(None, Mutability::Immutable), expect_ident(self)) + } else if self.look_ahead(1, |t| t.is_keyword(keywords::Mut)) && + isolated_self(self, 2) { + self.bump(); + self.bump(); + (SelfKind::Region(None, Mutability::Mutable), expect_ident(self)) + } else if self.look_ahead(1, |t| t.is_lifetime()) && + isolated_self(self, 2) { + self.bump(); + let lt = try!(self.parse_lifetime()); + (SelfKind::Region(Some(lt), Mutability::Immutable), expect_ident(self)) + } else if self.look_ahead(1, |t| t.is_lifetime()) && + self.look_ahead(2, |t| t.is_keyword(keywords::Mut)) && + isolated_self(self, 3) { + self.bump(); + let lt = try!(self.parse_lifetime()); + self.bump(); + (SelfKind::Region(Some(lt), Mutability::Mutable), expect_ident(self)) + } else { + return Ok(None); + } + } + token::BinOp(token::Star) => { + // *self + // *const self + // *mut self + // *not_self + // Emit special error for `self` cases. + if isolated_self(self, 1) { + self.bump(); + self.span_err(self.span, "cannot pass `self` by raw pointer"); + (SelfKind::Value(Mutability::Immutable), expect_ident(self)) + } else if self.look_ahead(1, |t| t.is_mutability()) && + isolated_self(self, 2) { + self.bump(); + self.bump(); + self.span_err(self.span, "cannot pass `self` by raw pointer"); + (SelfKind::Value(Mutability::Immutable), expect_ident(self)) + } else { + return Ok(None); + } + } + token::Ident(..) => { + if isolated_self(self, 0) { + // self + // self: TYPE + let eself_ident = expect_ident(self); + if self.eat(&token::Colon) { + let ty = try!(self.parse_ty_sum()); + (SelfKind::Explicit(ty, Mutability::Immutable), eself_ident) + } else { + (SelfKind::Value(Mutability::Immutable), eself_ident) + } + } else if self.token.is_keyword(keywords::Mut) && + isolated_self(self, 1) { + // mut self + // mut self: TYPE + self.bump(); + let eself_ident = expect_ident(self); + if self.eat(&token::Colon) { + let ty = try!(self.parse_ty_sum()); + (SelfKind::Explicit(ty, Mutability::Mutable), eself_ident) + } else { + (SelfKind::Value(Mutability::Mutable), eself_ident) + } + } else { + return Ok(None); + } + } + _ => return Ok(None), + }; + + let eself = codemap::respan(mk_sp(eself_lo, self.prev_span.hi), eself); + Ok(Some(Arg::from_self(eself, eself_ident))) + } + + /// Parse the parameter list and result type of a function that may have a `self` parameter. + fn parse_fn_decl_with_self(&mut self, parse_arg_fn: F) -> PResult<'a, P> + where F: FnMut(&mut Parser<'a>) -> PResult<'a, Arg>, + { + try!(self.expect(&token::OpenDelim(token::Paren))); + + // Parse optional self argument + let self_arg = try!(self.parse_self_arg()); + + // Parse the rest of the function parameter list. + let sep = SeqSep::trailing_allowed(token::Comma); + let fn_inputs = if let Some(self_arg) = self_arg { + if self.check(&token::CloseDelim(token::Paren)) { + vec![self_arg] + } else if self.eat(&token::Comma) { + let mut fn_inputs = vec![self_arg]; + fn_inputs.append(&mut self.parse_seq_to_before_end( + &token::CloseDelim(token::Paren), sep, parse_arg_fn) + ); + fn_inputs + } else { + return self.unexpected(); + } + } else { + self.parse_seq_to_before_end(&token::CloseDelim(token::Paren), sep, parse_arg_fn) + }; + + // Parse closing paren and return type. + try!(self.expect(&token::CloseDelim(token::Paren))); + Ok(P(FnDecl { + inputs: fn_inputs, + output: try!(self.parse_ret_ty()), + variadic: false + })) + } + + // parse the |arg, arg| header on a lambda + fn parse_fn_block_decl(&mut self) -> PResult<'a, P> { + let inputs_captures = { + if self.eat(&token::OrOr) { + Vec::new() + } else { + try!(self.expect(&token::BinOp(token::Or))); + let args = self.parse_seq_to_before_end( + &token::BinOp(token::Or), + SeqSep::trailing_allowed(token::Comma), + |p| p.parse_fn_block_arg() + ); + self.bump(); + args + } + }; + let output = try!(self.parse_ret_ty()); + + Ok(P(FnDecl { + inputs: inputs_captures, + output: output, + variadic: false + })) + } + + /// Parse the name and optional generic types of a function header. + fn parse_fn_header(&mut self) -> PResult<'a, (Ident, ast::Generics)> { + let id = try!(self.parse_ident()); + let generics = try!(self.parse_generics()); + Ok((id, generics)) + } + + fn mk_item(&mut self, lo: BytePos, hi: BytePos, ident: Ident, + node: ItemKind, vis: Visibility, + attrs: Vec) -> P { + P(Item { + ident: ident, + attrs: attrs, + id: ast::DUMMY_NODE_ID, + node: node, + vis: vis, + span: mk_sp(lo, hi) + }) + } + + /// Parse an item-position function declaration. + fn parse_item_fn(&mut self, + unsafety: Unsafety, + constness: Spanned, + abi: abi::Abi) + -> PResult<'a, ItemInfo> { + let (ident, mut generics) = try!(self.parse_fn_header()); + let decl = try!(self.parse_fn_decl(false)); + generics.where_clause = try!(self.parse_where_clause()); + let (inner_attrs, body) = try!(self.parse_inner_attrs_and_block()); + Ok((ident, ItemKind::Fn(decl, unsafety, constness, abi, generics, body), Some(inner_attrs))) + } + + /// true if we are looking at `const ID`, false for things like `const fn` etc + pub fn is_const_item(&mut self) -> bool { + self.token.is_keyword(keywords::Const) && + !self.look_ahead(1, |t| t.is_keyword(keywords::Fn)) && + !self.look_ahead(1, |t| t.is_keyword(keywords::Unsafe)) + } + + /// parses all the "front matter" for a `fn` declaration, up to + /// and including the `fn` keyword: + /// + /// - `const fn` + /// - `unsafe fn` + /// - `const unsafe fn` + /// - `extern fn` + /// - etc + pub fn parse_fn_front_matter(&mut self) + -> PResult<'a, (Spanned, + ast::Unsafety, + abi::Abi)> { + let is_const_fn = self.eat_keyword(keywords::Const); + let const_span = self.prev_span; + let unsafety = try!(self.parse_unsafety()); + let (constness, unsafety, abi) = if is_const_fn { + (respan(const_span, Constness::Const), unsafety, Abi::Rust) + } else { + let abi = if self.eat_keyword(keywords::Extern) { + try!(self.parse_opt_abi()).unwrap_or(Abi::C) + } else { + Abi::Rust + }; + (respan(self.prev_span, Constness::NotConst), unsafety, abi) + }; + try!(self.expect_keyword(keywords::Fn)); + Ok((constness, unsafety, abi)) + } + + /// Parse an impl item. + pub fn parse_impl_item(&mut self) -> PResult<'a, ImplItem> { + maybe_whole!(self, NtImplItem, |x| x); + + let mut attrs = try!(self.parse_outer_attributes()); + let lo = self.span.lo; + let vis = try!(self.parse_visibility(true)); + let defaultness = try!(self.parse_defaultness()); + let (name, node) = if self.eat_keyword(keywords::Type) { + let name = try!(self.parse_ident()); + try!(self.expect(&token::Eq)); + let typ = try!(self.parse_ty_sum()); + try!(self.expect(&token::Semi)); + (name, ast::ImplItemKind::Type(typ)) + } else if self.is_const_item() { + try!(self.expect_keyword(keywords::Const)); + let name = try!(self.parse_ident()); + try!(self.expect(&token::Colon)); + let typ = try!(self.parse_ty_sum()); + try!(self.expect(&token::Eq)); + let expr = try!(self.parse_expr()); + try!(self.expect(&token::Semi)); + (name, ast::ImplItemKind::Const(typ, expr)) + } else { + let (name, inner_attrs, node) = try!(self.parse_impl_method(&vis)); + attrs.extend(inner_attrs); + (name, node) + }; + + Ok(ImplItem { + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, self.prev_span.hi), + ident: name, + vis: vis, + defaultness: defaultness, + attrs: attrs, + node: node + }) + } + + fn complain_if_pub_macro(&mut self, visa: &Visibility, span: Span) { + match *visa { + Visibility::Inherited => (), + _ => { + let is_macro_rules: bool = match self.token { + token::Ident(sid) => sid.name == Symbol::intern("macro_rules"), + _ => false, + }; + if is_macro_rules { + self.diagnostic().struct_span_err(span, "can't qualify macro_rules \ + invocation with `pub`") + .help("did you mean #[macro_export]?") + .emit(); + } else { + self.diagnostic().struct_span_err(span, "can't qualify macro \ + invocation with `pub`") + .help("try adjusting the macro to put `pub` \ + inside the invocation") + .emit(); + } + } + } + } + + /// Parse a method or a macro invocation in a trait impl. + fn parse_impl_method(&mut self, vis: &Visibility) + -> PResult<'a, (Ident, Vec, ast::ImplItemKind)> { + // code copied from parse_macro_use_or_failure... abstraction! + if self.token.is_path_start() { + // method macro. + + let prev_span = self.prev_span; + self.complain_if_pub_macro(&vis, prev_span); + + let lo = self.span.lo; + let pth = try!(self.parse_path(PathStyle::Mod)); + try!(self.expect(&token::Not)); + + // eat a matched-delimiter token tree: + let delim = try!(self.expect_open_delim()); + let tts = try!(self.parse_seq_to_end(&token::CloseDelim(delim), + SeqSep::none(), + |p| p.parse_token_tree())); + if delim != token::Brace { + try!(self.expect(&token::Semi)) + } + + let mac = spanned(lo, self.prev_span.hi, Mac_ { path: pth, tts: tts }); + Ok((keywords::Invalid.ident(), vec![], ast::ImplItemKind::Macro(mac))) + } else { + let (constness, unsafety, abi) = try!(self.parse_fn_front_matter()); + let ident = try!(self.parse_ident()); + let mut generics = try!(self.parse_generics()); + let decl = try!(self.parse_fn_decl_with_self(|p| p.parse_arg())); + generics.where_clause = try!(self.parse_where_clause()); + let (inner_attrs, body) = try!(self.parse_inner_attrs_and_block()); + Ok((ident, inner_attrs, ast::ImplItemKind::Method(ast::MethodSig { + generics: generics, + abi: abi, + unsafety: unsafety, + constness: constness, + decl: decl + }, body))) + } + } + + /// Parse trait Foo { ... } + fn parse_item_trait(&mut self, unsafety: Unsafety) -> PResult<'a, ItemInfo> { + let ident = try!(self.parse_ident()); + let mut tps = try!(self.parse_generics()); + + // Parse supertrait bounds. + let bounds = try!(self.parse_colon_then_ty_param_bounds()); + + tps.where_clause = try!(self.parse_where_clause()); + + let meths = try!(self.parse_trait_items()); + Ok((ident, ItemKind::Trait(unsafety, tps, bounds, meths), None)) + } + + /// Parses items implementations variants + /// impl Foo { ... } + /// impl ToString for &'static T { ... } + /// impl Send for .. {} + fn parse_item_impl(&mut self, unsafety: ast::Unsafety) -> PResult<'a, ItemInfo> { + let impl_span = self.span; + + // First, parse type parameters if necessary. + let mut generics = try!(self.parse_generics()); + + // Special case: if the next identifier that follows is '(', don't + // allow this to be parsed as a trait. + let could_be_trait = self.token != token::OpenDelim(token::Paren); + + let neg_span = self.span; + let polarity = if self.eat(&token::Not) { + ast::ImplPolarity::Negative + } else { + ast::ImplPolarity::Positive + }; + + // Parse the trait. + let mut ty = try!(self.parse_ty_sum()); + + // Parse traits, if necessary. + let opt_trait = if could_be_trait && self.eat_keyword(keywords::For) { + // New-style trait. Reinterpret the type as a trait. + match ty.node { + TyKind::Path(None, ref path) => { + Some(TraitRef { + path: (*path).clone(), + ref_id: ty.id, + }) + } + _ => { + self.span_err(ty.span, "not a trait"); + None + } + } + } else { + match polarity { + ast::ImplPolarity::Negative => { + // This is a negated type implementation + // `impl !MyType {}`, which is not allowed. + self.span_err(neg_span, "inherent implementation can't be negated"); + }, + _ => {} + } + None + }; + + if opt_trait.is_some() && self.eat(&token::DotDot) { + if generics.is_parameterized() { + self.span_err(impl_span, "default trait implementations are not \ + allowed to have generics"); + } + + try!(self.expect(&token::OpenDelim(token::Brace))); + try!(self.expect(&token::CloseDelim(token::Brace))); + Ok((keywords::Invalid.ident(), + ItemKind::DefaultImpl(unsafety, opt_trait.unwrap()), None)) + } else { + if opt_trait.is_some() { + ty = try!(self.parse_ty_sum()); + } + generics.where_clause = try!(self.parse_where_clause()); + + try!(self.expect(&token::OpenDelim(token::Brace))); + let attrs = try!(self.parse_inner_attributes()); + + let mut impl_items = vec![]; + while !self.eat(&token::CloseDelim(token::Brace)) { + impl_items.push(try!(self.parse_impl_item())); + } + + Ok((keywords::Invalid.ident(), + ItemKind::Impl(unsafety, polarity, generics, opt_trait, ty, impl_items), + Some(attrs))) + } + } + + /// Parse a::B + fn parse_trait_ref(&mut self) -> PResult<'a, TraitRef> { + Ok(ast::TraitRef { + path: try!(self.parse_path(PathStyle::Type)), + ref_id: ast::DUMMY_NODE_ID, + }) + } + + fn parse_late_bound_lifetime_defs(&mut self) -> PResult<'a, Vec> { + if self.eat_keyword(keywords::For) { + try!(self.expect(&token::Lt)); + let lifetime_defs = try!(self.parse_lifetime_defs(None)); + try!(self.expect_gt()); + Ok(lifetime_defs) + } else { + Ok(Vec::new()) + } + } + + /// Parse for<'l> a::B + fn parse_poly_trait_ref(&mut self) -> PResult<'a, PolyTraitRef> { + let lo = self.span.lo; + let lifetime_defs = try!(self.parse_late_bound_lifetime_defs()); + + Ok(ast::PolyTraitRef { + bound_lifetimes: lifetime_defs, + trait_ref: try!(self.parse_trait_ref()), + span: mk_sp(lo, self.prev_span.hi), + }) + } + + /// Parse struct Foo { ... } + fn parse_item_struct(&mut self) -> PResult<'a, ItemInfo> { + let class_name = try!(self.parse_ident()); + let mut generics = try!(self.parse_generics()); + + // There is a special case worth noting here, as reported in issue #17904. + // If we are parsing a tuple struct it is the case that the where clause + // should follow the field list. Like so: + // + // struct Foo(T) where T: Copy; + // + // If we are parsing a normal record-style struct it is the case + // that the where clause comes before the body, and after the generics. + // So if we look ahead and see a brace or a where-clause we begin + // parsing a record style struct. + // + // Otherwise if we look ahead and see a paren we parse a tuple-style + // struct. + + let vdata = if self.token.is_keyword(keywords::Where) { + generics.where_clause = try!(self.parse_where_clause()); + if self.eat(&token::Semi) { + // If we see a: `struct Foo where T: Copy;` style decl. + VariantData::Unit(ast::DUMMY_NODE_ID) + } else { + // If we see: `struct Foo where T: Copy { ... }` + VariantData::Struct(try!(self.parse_record_struct_body()), ast::DUMMY_NODE_ID) + } + // No `where` so: `struct Foo;` + } else if self.eat(&token::Semi) { + VariantData::Unit(ast::DUMMY_NODE_ID) + // Record-style struct definition + } else if self.token == token::OpenDelim(token::Brace) { + VariantData::Struct(try!(self.parse_record_struct_body()), ast::DUMMY_NODE_ID) + // Tuple-style struct definition with optional where-clause. + } else if self.token == token::OpenDelim(token::Paren) { + let body = VariantData::Tuple(try!(self.parse_tuple_struct_body()), ast::DUMMY_NODE_ID); + generics.where_clause = try!(self.parse_where_clause()); + try!(self.expect(&token::Semi)); + body + } else { + let token_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected `where`, `{{`, `(`, or `;` after struct \ + name, found `{}`", token_str))) + }; + + Ok((class_name, ItemKind::Struct(vdata, generics), None)) + } + + /// Parse union Foo { ... } + fn parse_item_union(&mut self) -> PResult<'a, ItemInfo> { + let class_name = try!(self.parse_ident()); + let mut generics = try!(self.parse_generics()); + + let vdata = if self.token.is_keyword(keywords::Where) { + generics.where_clause = try!(self.parse_where_clause()); + VariantData::Struct(try!(self.parse_record_struct_body()), ast::DUMMY_NODE_ID) + } else if self.token == token::OpenDelim(token::Brace) { + VariantData::Struct(try!(self.parse_record_struct_body()), ast::DUMMY_NODE_ID) + } else { + let token_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected `where` or `{{` after union \ + name, found `{}`", token_str))) + }; + + Ok((class_name, ItemKind::Union(vdata, generics), None)) + } + + pub fn parse_record_struct_body(&mut self) -> PResult<'a, Vec> { + let mut fields = Vec::new(); + if self.eat(&token::OpenDelim(token::Brace)) { + while self.token != token::CloseDelim(token::Brace) { + fields.push(try!(self.parse_struct_decl_field().map_err(|e| { + self.recover_stmt(); + self.eat(&token::CloseDelim(token::Brace)); + e + }))); + } + + self.bump(); + } else { + let token_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected `where`, or `{{` after struct \ + name, found `{}`", + token_str))); + } + + Ok(fields) + } + + pub fn parse_tuple_struct_body(&mut self) -> PResult<'a, Vec> { + // This is the case where we find `struct Foo(T) where T: Copy;` + // Unit like structs are handled in parse_item_struct function + let fields = try!(self.parse_unspanned_seq( + &token::OpenDelim(token::Paren), + &token::CloseDelim(token::Paren), + SeqSep::trailing_allowed(token::Comma), + |p| { + let attrs = try!(p.parse_outer_attributes()); + let lo = p.span.lo; + let mut vis = try!(p.parse_visibility(false)); + let ty_is_interpolated = + p.token.is_interpolated() || p.look_ahead(1, |t| t.is_interpolated()); + let mut ty = try!(p.parse_ty_sum()); + + // Handle `pub(path) type`, in which `vis` will be `pub` and `ty` will be `(path)`. + if vis == Visibility::Public && !ty_is_interpolated && + p.token != token::Comma && p.token != token::CloseDelim(token::Paren) { + ty = if let TyKind::Paren(ref path_ty) = ty.node { + if let TyKind::Path(None, ref path) = path_ty.node { + vis = Visibility::Restricted { path: P(path.clone()), id: path_ty.id }; + Some(try!(p.parse_ty_sum())) + } else { + None + } + } else { + None + }.unwrap_or(ty); + } + Ok(StructField { + span: mk_sp(lo, p.span.hi), + vis: vis, + ident: None, + id: ast::DUMMY_NODE_ID, + ty: ty, + attrs: attrs, + }) + })); + + Ok(fields) + } + + /// Parse a structure field declaration + pub fn parse_single_struct_field(&mut self, + lo: BytePos, + vis: Visibility, + attrs: Vec ) + -> PResult<'a, StructField> { + let a_var = try!(self.parse_name_and_ty(lo, vis, attrs)); + match self.token { + token::Comma => { + self.bump(); + } + token::CloseDelim(token::Brace) => {} + token::DocComment(_) => return Err(self.span_fatal_help(self.span, + "found a documentation comment that doesn't document anything", + "doc comments must come before what they document, maybe a comment was \ + intended with `//`?")), + _ => return Err(self.span_fatal_help(self.span, + &format!("expected `,`, or `}}`, found `{}`", self.this_token_to_string()), + "struct fields should be separated by commas")), + } + Ok(a_var) + } + + /// Parse an element of a struct definition + fn parse_struct_decl_field(&mut self) -> PResult<'a, StructField> { + let attrs = try!(self.parse_outer_attributes()); + let lo = self.span.lo; + let vis = try!(self.parse_visibility(true)); + self.parse_single_struct_field(lo, vis, attrs) + } + + // If `allow_path` is false, just parse the `pub` in `pub(path)` (but still parse `pub(crate)`) + fn parse_visibility(&mut self, allow_path: bool) -> PResult<'a, Visibility> { + let pub_crate = |this: &mut Self| { + let span = this.prev_span; + try!(this.expect(&token::CloseDelim(token::Paren))); + Ok(Visibility::Crate(span)) + }; + + if !self.eat_keyword(keywords::Pub) { + Ok(Visibility::Inherited) + } else if !allow_path { + // Look ahead to avoid eating the `(` in `pub(path)` while still parsing `pub(crate)` + if self.token == token::OpenDelim(token::Paren) && + self.look_ahead(1, |t| t.is_keyword(keywords::Crate)) { + self.bump(); self.bump(); + pub_crate(self) + } else { + Ok(Visibility::Public) + } + } else if !self.eat(&token::OpenDelim(token::Paren)) { + Ok(Visibility::Public) + } else if self.eat_keyword(keywords::Crate) { + pub_crate(self) + } else { + let path = try!(self.parse_path(PathStyle::Mod)).default_to_global(); + try!(self.expect(&token::CloseDelim(token::Paren))); + Ok(Visibility::Restricted { path: P(path), id: ast::DUMMY_NODE_ID }) + } + } + + /// Parse defaultness: DEFAULT or nothing + fn parse_defaultness(&mut self) -> PResult<'a, Defaultness> { + if self.eat_contextual_keyword(keywords::Default.ident()) { + Ok(Defaultness::Default) + } else { + Ok(Defaultness::Final) + } + } + + /// Given a termination token, parse all of the items in a module + fn parse_mod_items(&mut self, term: &token::Token, inner_lo: BytePos) -> PResult<'a, Mod> { + let mut items = vec![]; + while let Some(item) = try!(self.parse_item()) { + items.push(item); + } + + if !self.eat(term) { + let token_str = self.this_token_to_string(); + return Err(self.fatal(&format!("expected item, found `{}`", token_str))); + } + + let hi = if self.span == syntax_pos::DUMMY_SP { + inner_lo + } else { + self.prev_span.hi + }; + + Ok(ast::Mod { + inner: mk_sp(inner_lo, hi), + items: items + }) + } + + fn parse_item_const(&mut self, m: Option) -> PResult<'a, ItemInfo> { + let id = try!(self.parse_ident()); + try!(self.expect(&token::Colon)); + let ty = try!(self.parse_ty_sum()); + try!(self.expect(&token::Eq)); + let e = try!(self.parse_expr()); + try!(self.expect(&token::Semi)); + let item = match m { + Some(m) => ItemKind::Static(ty, m, e), + None => ItemKind::Const(ty, e), + }; + Ok((id, item, None)) + } + + /// Parse a `mod { ... }` or `mod ;` item + fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo> { + let (in_cfg, outer_attrs) = { + let mut strip_unconfigured = ::config::StripUnconfigured { + sess: self.sess, + should_test: false, // irrelevant + features: None, // don't perform gated feature checking + }; + let outer_attrs = strip_unconfigured.process_cfg_attrs(outer_attrs.to_owned()); + (strip_unconfigured.in_cfg(&outer_attrs), outer_attrs) + }; + + let id_span = self.span; + let id = try!(self.parse_ident()); + if self.check(&token::Semi) { + self.bump(); + if in_cfg { + // This mod is in an external file. Let's go get it! + let ModulePathSuccess { path, directory_ownership, warn } = + try!(self.submod_path(id, &outer_attrs, id_span)); + let (module, mut attrs) = + try!(self.eval_src_mod(path, directory_ownership, id.to_string(), id_span)); + if warn { + let attr = ast::Attribute { + id: attr::mk_attr_id(), + style: ast::AttrStyle::Outer, + value: ast::MetaItem { + name: Symbol::intern("warn_directory_ownership"), + node: ast::MetaItemKind::Word, + span: syntax_pos::DUMMY_SP, + }, + is_sugared_doc: false, + span: syntax_pos::DUMMY_SP, + }; + attr::mark_known(&attr); + attrs.push(attr); + } + Ok((id, module, Some(attrs))) + } else { + let placeholder = ast::Mod { inner: syntax_pos::DUMMY_SP, items: Vec::new() }; + Ok((id, ItemKind::Mod(placeholder), None)) + } + } else { + let old_directory = self.directory.clone(); + self.push_directory(id, &outer_attrs); + try!(self.expect(&token::OpenDelim(token::Brace))); + let mod_inner_lo = self.span.lo; + let attrs = try!(self.parse_inner_attributes()); + let module = try!(self.parse_mod_items(&token::CloseDelim(token::Brace), mod_inner_lo)); + self.directory = old_directory; + Ok((id, ItemKind::Mod(module), Some(attrs))) + } + } + + fn push_directory(&mut self, id: Ident, attrs: &[Attribute]) { + if let Some(path) = attr::first_attr_value_str_by_name(attrs, "path") { + self.directory.path.push(&*path.as_str()); + self.directory.ownership = DirectoryOwnership::Owned; + } else { + self.directory.path.push(&*id.name.as_str()); + } + } + + pub fn submod_path_from_attr(attrs: &[ast::Attribute], dir_path: &Path) -> Option { + attr::first_attr_value_str_by_name(attrs, "path").map(|d| dir_path.join(&*d.as_str())) + } + + /// Returns either a path to a module, or . + pub fn default_submod_path(id: ast::Ident, dir_path: &Path, codemap: &CodeMap) -> ModulePath + { + let mod_name = id.to_string(); + let default_path_str = format!("{}.rs", mod_name); + let secondary_path_str = format!("{}/mod.rs", mod_name); + let default_path = dir_path.join(&default_path_str); + let secondary_path = dir_path.join(&secondary_path_str); + let default_exists = codemap.file_exists(&default_path); + let secondary_exists = codemap.file_exists(&secondary_path); + + let result = match (default_exists, secondary_exists) { + (true, false) => Ok(ModulePathSuccess { + path: default_path, + directory_ownership: DirectoryOwnership::UnownedViaMod(false), + warn: false, + }), + (false, true) => Ok(ModulePathSuccess { + path: secondary_path, + directory_ownership: DirectoryOwnership::Owned, + warn: false, + }), + (false, false) => Err(ModulePathError { + err_msg: format!("file not found for module `{}`", mod_name), + help_msg: format!("name the file either {} or {} inside the directory {:?}", + default_path_str, + secondary_path_str, + dir_path.display()), + }), + (true, true) => Err(ModulePathError { + err_msg: format!("file for module `{}` found at both {} and {}", + mod_name, + default_path_str, + secondary_path_str), + help_msg: "delete or rename one of them to remove the ambiguity".to_owned(), + }), + }; + + ModulePath { + name: mod_name, + path_exists: default_exists || secondary_exists, + result: result, + } + } + + fn submod_path(&mut self, + id: ast::Ident, + outer_attrs: &[ast::Attribute], + id_sp: Span) -> PResult<'a, ModulePathSuccess> { + if let Some(path) = Parser::submod_path_from_attr(outer_attrs, &self.directory.path) { + return Ok(ModulePathSuccess { + directory_ownership: match path.file_name().and_then(|s| s.to_str()) { + Some("mod.rs") => DirectoryOwnership::Owned, + _ => DirectoryOwnership::UnownedViaMod(true), + }, + path: path, + warn: false, + }); + } + + let paths = Parser::default_submod_path(id, &self.directory.path, self.sess.codemap()); + + if let DirectoryOwnership::UnownedViaBlock = self.directory.ownership { + let msg = + "Cannot declare a non-inline module inside a block unless it has a path attribute"; + let mut err = self.diagnostic().struct_span_err(id_sp, msg); + if paths.path_exists { + let msg = format!("Maybe `use` the module `{}` instead of redeclaring it", + paths.name); + err.span_note(id_sp, &msg); + } + return Err(err); + } else if let DirectoryOwnership::UnownedViaMod(warn) = self.directory.ownership { + if warn { + if let Ok(result) = paths.result { + return Ok(ModulePathSuccess { warn: true, ..result }); + } + } + let mut err = self.diagnostic().struct_span_err(id_sp, + "cannot declare a new module at this location"); + let this_module = match self.directory.path.file_name() { + Some(file_name) => file_name.to_str().unwrap().to_owned(), + None => self.root_module_name.as_ref().unwrap().clone(), + }; + err.span_note(id_sp, + &format!("maybe move this module `{0}` to its own directory \ + via `{0}/mod.rs`", + this_module)); + if paths.path_exists { + err.span_note(id_sp, + &format!("... or maybe `use` the module `{}` instead \ + of possibly redeclaring it", + paths.name)); + return Err(err); + } else { + return Err(err); + }; + } + + match paths.result { + Ok(succ) => Ok(succ), + Err(err) => Err(self.span_fatal_help(id_sp, &err.err_msg, &err.help_msg)), + } + } + + /// Read a module from a source file. + fn eval_src_mod(&mut self, + path: PathBuf, + directory_ownership: DirectoryOwnership, + name: String, + id_sp: Span) + -> PResult<'a, (ast::ItemKind, Vec )> { + let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut(); + if let Some(i) = included_mod_stack.iter().position(|p| *p == path) { + let mut err = String::from("circular modules: "); + let len = included_mod_stack.len(); + for p in &included_mod_stack[i.. len] { + err.push_str(&p.to_string_lossy()); + err.push_str(" -> "); + } + err.push_str(&path.to_string_lossy()); + return Err(self.span_fatal(id_sp, &err[..])); + } + included_mod_stack.push(path.clone()); + drop(included_mod_stack); + + let mut p0 = + new_sub_parser_from_file(self.sess, &path, directory_ownership, Some(name), id_sp); + let mod_inner_lo = p0.span.lo; + let mod_attrs = try!(p0.parse_inner_attributes()); + let m0 = try!(p0.parse_mod_items(&token::Eof, mod_inner_lo)); + self.sess.included_mod_stack.borrow_mut().pop(); + Ok((ast::ItemKind::Mod(m0), mod_attrs)) + } + + /// Parse a function declaration from a foreign module + fn parse_item_foreign_fn(&mut self, vis: ast::Visibility, lo: BytePos, + attrs: Vec) -> PResult<'a, ForeignItem> { + try!(self.expect_keyword(keywords::Fn)); + + let (ident, mut generics) = try!(self.parse_fn_header()); + let decl = try!(self.parse_fn_decl(true)); + generics.where_clause = try!(self.parse_where_clause()); + let hi = self.span.hi; + try!(self.expect(&token::Semi)); + Ok(ast::ForeignItem { + ident: ident, + attrs: attrs, + node: ForeignItemKind::Fn(decl, generics), + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, hi), + vis: vis + }) + } + + /// Parse a static item from a foreign module + fn parse_item_foreign_static(&mut self, vis: ast::Visibility, lo: BytePos, + attrs: Vec) -> PResult<'a, ForeignItem> { + try!(self.expect_keyword(keywords::Static)); + let mutbl = self.eat_keyword(keywords::Mut); + + let ident = try!(self.parse_ident()); + try!(self.expect(&token::Colon)); + let ty = try!(self.parse_ty_sum()); + let hi = self.span.hi; + try!(self.expect(&token::Semi)); + Ok(ForeignItem { + ident: ident, + attrs: attrs, + node: ForeignItemKind::Static(ty, mutbl), + id: ast::DUMMY_NODE_ID, + span: mk_sp(lo, hi), + vis: vis + }) + } + + /// Parse extern crate links + /// + /// # Examples + /// + /// extern crate foo; + /// extern crate bar as foo; + fn parse_item_extern_crate(&mut self, + lo: BytePos, + visibility: Visibility, + attrs: Vec) + -> PResult<'a, P> { + + let crate_name = try!(self.parse_ident()); + let (maybe_path, ident) = if let Some(ident) = try!(self.parse_rename()) { + (Some(crate_name.name), ident) + } else { + (None, crate_name) + }; + try!(self.expect(&token::Semi)); + + let prev_span = self.prev_span; + Ok(self.mk_item(lo, + prev_span.hi, + ident, + ItemKind::ExternCrate(maybe_path), + visibility, + attrs)) + } + + /// Parse `extern` for foreign ABIs + /// modules. + /// + /// `extern` is expected to have been + /// consumed before calling this method + /// + /// # Examples: + /// + /// extern "C" {} + /// extern {} + fn parse_item_foreign_mod(&mut self, + lo: BytePos, + opt_abi: Option, + visibility: Visibility, + mut attrs: Vec) + -> PResult<'a, P> { + try!(self.expect(&token::OpenDelim(token::Brace))); + + let abi = opt_abi.unwrap_or(Abi::C); + + attrs.extend(try!(self.parse_inner_attributes())); + + let mut foreign_items = vec![]; + while let Some(item) = try!(self.parse_foreign_item()) { + foreign_items.push(item); + } + try!(self.expect(&token::CloseDelim(token::Brace))); + + let prev_span = self.prev_span; + let m = ast::ForeignMod { + abi: abi, + items: foreign_items + }; + Ok(self.mk_item(lo, + prev_span.hi, + keywords::Invalid.ident(), + ItemKind::ForeignMod(m), + visibility, + attrs)) + } + + /// Parse type Foo = Bar; + fn parse_item_type(&mut self) -> PResult<'a, ItemInfo> { + let ident = try!(self.parse_ident()); + let mut tps = try!(self.parse_generics()); + tps.where_clause = try!(self.parse_where_clause()); + try!(self.expect(&token::Eq)); + let ty = try!(self.parse_ty_sum()); + try!(self.expect(&token::Semi)); + Ok((ident, ItemKind::Ty(ty, tps), None)) + } + + /// Parse the part of an "enum" decl following the '{' + fn parse_enum_def(&mut self, _generics: &ast::Generics) -> PResult<'a, EnumDef> { + let mut variants = Vec::new(); + let mut all_nullary = true; + let mut any_disr = None; + while self.token != token::CloseDelim(token::Brace) { + let variant_attrs = try!(self.parse_outer_attributes()); + let vlo = self.span.lo; + + let struct_def; + let mut disr_expr = None; + let ident = try!(self.parse_ident()); + if self.check(&token::OpenDelim(token::Brace)) { + // Parse a struct variant. + all_nullary = false; + struct_def = VariantData::Struct(try!(self.parse_record_struct_body()), + ast::DUMMY_NODE_ID); + } else if self.check(&token::OpenDelim(token::Paren)) { + all_nullary = false; + struct_def = VariantData::Tuple(try!(self.parse_tuple_struct_body()), + ast::DUMMY_NODE_ID); + } else if self.eat(&token::Eq) { + disr_expr = Some(try!(self.parse_expr())); + any_disr = disr_expr.as_ref().map(|expr| expr.span); + struct_def = VariantData::Unit(ast::DUMMY_NODE_ID); + } else { + struct_def = VariantData::Unit(ast::DUMMY_NODE_ID); + } + + let vr = ast::Variant_ { + name: ident, + attrs: variant_attrs, + data: struct_def, + disr_expr: disr_expr, + }; + variants.push(spanned(vlo, self.prev_span.hi, vr)); + + if !self.eat(&token::Comma) { break; } + } + try!(self.expect(&token::CloseDelim(token::Brace))); + match any_disr { + Some(disr_span) if !all_nullary => + self.span_err(disr_span, + "discriminator values can only be used with a c-like enum"), + _ => () + } + + Ok(ast::EnumDef { variants: variants }) + } + + /// Parse an "enum" declaration + fn parse_item_enum(&mut self) -> PResult<'a, ItemInfo> { + let id = try!(self.parse_ident()); + let mut generics = try!(self.parse_generics()); + generics.where_clause = try!(self.parse_where_clause()); + try!(self.expect(&token::OpenDelim(token::Brace))); + + let enum_definition = try!(self.parse_enum_def(&generics).map_err(|e| { + self.recover_stmt(); + self.eat(&token::CloseDelim(token::Brace)); + e + })); + Ok((id, ItemKind::Enum(enum_definition, generics), None)) + } + + /// Parses a string as an ABI spec on an extern type or module. Consumes + /// the `extern` keyword, if one is found. + fn parse_opt_abi(&mut self) -> PResult<'a, Option> { + match self.token { + token::Literal(token::Str_(s), suf) | token::Literal(token::StrRaw(s, _), suf) => { + let sp = self.span; + self.expect_no_suffix(sp, "ABI spec", suf); + self.bump(); + match abi::lookup(&s.as_str()) { + Some(abi) => Ok(Some(abi)), + None => { + let prev_span = self.prev_span; + self.span_err( + prev_span, + &format!("invalid ABI: expected one of [{}], \ + found `{}`", + abi::all_names().join(", "), + s)); + Ok(None) + } + } + } + + _ => Ok(None), + } + } + + /// Parse one of the items allowed by the flags. + /// NB: this function no longer parses the items inside an + /// extern crate. + fn parse_item_(&mut self, attrs: Vec, + macros_allowed: bool, attributes_allowed: bool) -> PResult<'a, Option>> { + maybe_whole!(self, NtItem, |item| { + let mut item = item.unwrap(); + let mut attrs = attrs; + mem::swap(&mut item.attrs, &mut attrs); + item.attrs.extend(attrs); + Some(P(item)) + }); + + let lo = self.span.lo; + + let visibility = try!(self.parse_visibility(true)); + + if self.eat_keyword(keywords::Use) { + // USE ITEM + let item_ = ItemKind::Use(try!(self.parse_view_path())); + try!(self.expect(&token::Semi)); + + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + keywords::Invalid.ident(), + item_, + visibility, + attrs); + return Ok(Some(item)); + } + + if self.eat_keyword(keywords::Extern) { + if self.eat_keyword(keywords::Crate) { + return Ok(Some(try!(self.parse_item_extern_crate(lo, visibility, attrs)))); + } + + let opt_abi = try!(self.parse_opt_abi()); + + if self.eat_keyword(keywords::Fn) { + // EXTERN FUNCTION ITEM + let fn_span = self.prev_span; + let abi = opt_abi.unwrap_or(Abi::C); + let (ident, item_, extra_attrs) = + try!(self.parse_item_fn(Unsafety::Normal, + respan(fn_span, Constness::NotConst), + abi)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } else if self.check(&token::OpenDelim(token::Brace)) { + return Ok(Some(try!(self.parse_item_foreign_mod(lo, opt_abi, visibility, attrs)))); + } + + try!(self.unexpected()); + } + + if self.eat_keyword(keywords::Static) { + // STATIC ITEM + let m = if self.eat_keyword(keywords::Mut) { + Mutability::Mutable + } else { + Mutability::Immutable + }; + let (ident, item_, extra_attrs) = try!(self.parse_item_const(Some(m))); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.eat_keyword(keywords::Const) { + let const_span = self.prev_span; + if self.check_keyword(keywords::Fn) + || (self.check_keyword(keywords::Unsafe) + && self.look_ahead(1, |t| t.is_keyword(keywords::Fn))) { + // CONST FUNCTION ITEM + let unsafety = if self.eat_keyword(keywords::Unsafe) { + Unsafety::Unsafe + } else { + Unsafety::Normal + }; + self.bump(); + let (ident, item_, extra_attrs) = + try!(self.parse_item_fn(unsafety, + respan(const_span, Constness::Const), + Abi::Rust)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + + // CONST ITEM + if self.eat_keyword(keywords::Mut) { + let prev_span = self.prev_span; + self.diagnostic().struct_span_err(prev_span, "const globals cannot be mutable") + .help("did you mean to declare a static?") + .emit(); + } + let (ident, item_, extra_attrs) = try!(self.parse_item_const(None)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.check_keyword(keywords::Unsafe) && + self.look_ahead(1, |t| t.is_keyword(keywords::Trait)) + { + // UNSAFE TRAIT ITEM + try!(self.expect_keyword(keywords::Unsafe)); + try!(self.expect_keyword(keywords::Trait)); + let (ident, item_, extra_attrs) = + try!(self.parse_item_trait(ast::Unsafety::Unsafe)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.check_keyword(keywords::Unsafe) && + self.look_ahead(1, |t| t.is_keyword(keywords::Impl)) + { + // IMPL ITEM + try!(self.expect_keyword(keywords::Unsafe)); + try!(self.expect_keyword(keywords::Impl)); + let (ident, item_, extra_attrs) = try!(self.parse_item_impl(ast::Unsafety::Unsafe)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.check_keyword(keywords::Fn) { + // FUNCTION ITEM + self.bump(); + let fn_span = self.prev_span; + let (ident, item_, extra_attrs) = + try!(self.parse_item_fn(Unsafety::Normal, + respan(fn_span, Constness::NotConst), + Abi::Rust)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.check_keyword(keywords::Unsafe) + && self.look_ahead(1, |t| *t != token::OpenDelim(token::Brace)) { + // UNSAFE FUNCTION ITEM + self.bump(); + let abi = if self.eat_keyword(keywords::Extern) { + try!(self.parse_opt_abi()).unwrap_or(Abi::C) + } else { + Abi::Rust + }; + try!(self.expect_keyword(keywords::Fn)); + let fn_span = self.prev_span; + let (ident, item_, extra_attrs) = + try!(self.parse_item_fn(Unsafety::Unsafe, + respan(fn_span, Constness::NotConst), + abi)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.eat_keyword(keywords::Mod) { + // MODULE ITEM + let (ident, item_, extra_attrs) = + try!(self.parse_item_mod(&attrs[..])); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.eat_keyword(keywords::Type) { + // TYPE ITEM + let (ident, item_, extra_attrs) = try!(self.parse_item_type()); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.eat_keyword(keywords::Enum) { + // ENUM ITEM + let (ident, item_, extra_attrs) = try!(self.parse_item_enum()); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.eat_keyword(keywords::Trait) { + // TRAIT ITEM + let (ident, item_, extra_attrs) = + try!(self.parse_item_trait(ast::Unsafety::Normal)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.eat_keyword(keywords::Impl) { + // IMPL ITEM + let (ident, item_, extra_attrs) = try!(self.parse_item_impl(ast::Unsafety::Normal)); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.eat_keyword(keywords::Struct) { + // STRUCT ITEM + let (ident, item_, extra_attrs) = try!(self.parse_item_struct()); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + if self.is_union_item() { + // UNION ITEM + self.bump(); + let (ident, item_, extra_attrs) = try!(self.parse_item_union()); + let prev_span = self.prev_span; + let item = self.mk_item(lo, + prev_span.hi, + ident, + item_, + visibility, + maybe_append(attrs, extra_attrs)); + return Ok(Some(item)); + } + self.parse_macro_use_or_failure(attrs,macros_allowed,attributes_allowed,lo,visibility) + } + + /// Parse a foreign item. + fn parse_foreign_item(&mut self) -> PResult<'a, Option> { + let attrs = try!(self.parse_outer_attributes()); + let lo = self.span.lo; + let visibility = try!(self.parse_visibility(true)); + + if self.check_keyword(keywords::Static) { + // FOREIGN STATIC ITEM + return Ok(Some(try!(self.parse_item_foreign_static(visibility, lo, attrs)))); + } + if self.check_keyword(keywords::Fn) { + // FOREIGN FUNCTION ITEM + return Ok(Some(try!(self.parse_item_foreign_fn(visibility, lo, attrs)))); + } + + // FIXME #5668: this will occur for a macro invocation: + match try!(self.parse_macro_use_or_failure(attrs, true, false, lo, visibility)) { + Some(item) => { + return Err(self.span_fatal(item.span, "macros cannot expand to foreign items")); + } + None => Ok(None) + } + } + + /// This is the fall-through for parsing items. + fn parse_macro_use_or_failure( + &mut self, + attrs: Vec , + macros_allowed: bool, + attributes_allowed: bool, + lo: BytePos, + visibility: Visibility + ) -> PResult<'a, Option>> { + if macros_allowed && self.token.is_path_start() { + // MACRO INVOCATION ITEM + + let prev_span = self.prev_span; + self.complain_if_pub_macro(&visibility, prev_span); + + let mac_lo = self.span.lo; + + // item macro. + let pth = try!(self.parse_path(PathStyle::Mod)); + try!(self.expect(&token::Not)); + + // a 'special' identifier (like what `macro_rules!` uses) + // is optional. We should eventually unify invoc syntax + // and remove this. + let id = if self.token.is_ident() { + try!(self.parse_ident()) + } else { + keywords::Invalid.ident() // no special identifier + }; + // eat a matched-delimiter token tree: + let delim = try!(self.expect_open_delim()); + let tts = try!(self.parse_seq_to_end(&token::CloseDelim(delim), + SeqSep::none(), + |p| p.parse_token_tree())); + if delim != token::Brace { + if !self.eat(&token::Semi) { + let prev_span = self.prev_span; + self.span_err(prev_span, + "macros that expand to items must either \ + be surrounded with braces or followed by \ + a semicolon"); + } + } + + let hi = self.prev_span.hi; + let mac = spanned(mac_lo, hi, Mac_ { path: pth, tts: tts }); + let item = self.mk_item(lo, hi, id, ItemKind::Mac(mac), visibility, attrs); + return Ok(Some(item)); + } + + // FAILURE TO PARSE ITEM + match visibility { + Visibility::Inherited => {} + _ => { + let prev_span = self.prev_span; + return Err(self.span_fatal(prev_span, "unmatched visibility `pub`")); + } + } + + if !attributes_allowed && !attrs.is_empty() { + self.expected_item_err(&attrs); + } + Ok(None) + } + + pub fn parse_item(&mut self) -> PResult<'a, Option>> { + let attrs = try!(self.parse_outer_attributes()); + self.parse_item_(attrs, true, false) + } + + fn parse_path_list_items(&mut self) -> PResult<'a, Vec> { + self.parse_unspanned_seq(&token::OpenDelim(token::Brace), + &token::CloseDelim(token::Brace), + SeqSep::trailing_allowed(token::Comma), |this| { + let lo = this.span.lo; + let ident = if this.eat_keyword(keywords::SelfValue) { + keywords::SelfValue.ident() + } else { + try!(this.parse_ident()) + }; + let rename = try!(this.parse_rename()); + let node = ast::PathListItem_ { + name: ident, + rename: rename, + id: ast::DUMMY_NODE_ID + }; + let hi = this.prev_span.hi; + Ok(spanned(lo, hi, node)) + }) + } + + /// `::{` or `::*` + fn is_import_coupler(&mut self) -> bool { + self.check(&token::ModSep) && + self.look_ahead(1, |t| *t == token::OpenDelim(token::Brace) || + *t == token::BinOp(token::Star)) + } + + /// Matches ViewPath: + /// MOD_SEP? non_global_path + /// MOD_SEP? non_global_path as IDENT + /// MOD_SEP? non_global_path MOD_SEP STAR + /// MOD_SEP? non_global_path MOD_SEP LBRACE item_seq RBRACE + /// MOD_SEP? LBRACE item_seq RBRACE + fn parse_view_path(&mut self) -> PResult<'a, P> { + let lo = self.span.lo; + if self.check(&token::OpenDelim(token::Brace)) || self.check(&token::BinOp(token::Star)) || + self.is_import_coupler() { + // `{foo, bar}`, `::{foo, bar}`, `*`, or `::*`. + self.eat(&token::ModSep); + let prefix = ast::Path { + segments: vec![ast::PathSegment::crate_root()], + span: mk_sp(lo, self.span.hi), + }; + let view_path_kind = if self.eat(&token::BinOp(token::Star)) { + ViewPathGlob(prefix) + } else { + ViewPathList(prefix, try!(self.parse_path_list_items())) + }; + Ok(P(spanned(lo, self.span.hi, view_path_kind))) + } else { + let prefix = try!(self.parse_path(PathStyle::Mod)).default_to_global(); + if self.is_import_coupler() { + // `foo::bar::{a, b}` or `foo::bar::*` + self.bump(); + if self.check(&token::BinOp(token::Star)) { + self.bump(); + Ok(P(spanned(lo, self.span.hi, ViewPathGlob(prefix)))) + } else { + let items = try!(self.parse_path_list_items()); + Ok(P(spanned(lo, self.span.hi, ViewPathList(prefix, items)))) + } + } else { + // `foo::bar` or `foo::bar as baz` + let rename = try!(self.parse_rename()). + unwrap_or(prefix.segments.last().unwrap().identifier); + Ok(P(spanned(lo, self.prev_span.hi, ViewPathSimple(rename, prefix)))) + } + } + } + + fn parse_rename(&mut self) -> PResult<'a, Option> { + if self.eat_keyword(keywords::As) { + self.parse_ident().map(Some) + } else { + Ok(None) + } + } + + /// Parses a source module as a crate. This is the main + /// entry point for the parser. + pub fn parse_crate_mod(&mut self) -> PResult<'a, Crate> { + let lo = self.span.lo; + Ok(ast::Crate { + attrs: try!(self.parse_inner_attributes()), + module: try!(self.parse_mod_items(&token::Eof, lo)), + span: mk_sp(lo, self.span.lo), + exported_macros: Vec::new(), + }) + } + + pub fn parse_optional_str(&mut self) -> Option<(Symbol, ast::StrStyle, Option)> { + let ret = match self.token { + token::Literal(token::Str_(s), suf) => (s, ast::StrStyle::Cooked, suf), + token::Literal(token::StrRaw(s, n), suf) => (s, ast::StrStyle::Raw(n), suf), + _ => return None + }; + self.bump(); + Some(ret) + } + + pub fn parse_str(&mut self) -> PResult<'a, (Symbol, StrStyle)> { + match self.parse_optional_str() { + Some((s, style, suf)) => { + let sp = self.prev_span; + self.expect_no_suffix(sp, "string literal", suf); + Ok((s, style)) + } + _ => Err(self.fatal("expected string literal")) + } + } +} diff --git a/third_party/rust/syntex_syntax/src/parse/token.rs b/third_party/rust/syntex_syntax/src/parse/token.rs new file mode 100644 index 000000000000..8ac39dd462e7 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/parse/token.rs @@ -0,0 +1,334 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use self::BinOpToken::*; +pub use self::Nonterminal::*; +pub use self::DelimToken::*; +pub use self::Lit::*; +pub use self::Token::*; + +use ast::{self}; +use ptr::P; +use symbol::keywords; +use tokenstream; + +use std::fmt; +use std::rc::Rc; + +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] +pub enum BinOpToken { + Plus, + Minus, + Star, + Slash, + Percent, + Caret, + And, + Or, + Shl, + Shr, +} + +/// A delimiter token +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] +pub enum DelimToken { + /// A round parenthesis: `(` or `)` + Paren, + /// A square bracket: `[` or `]` + Bracket, + /// A curly brace: `{` or `}` + Brace, + /// An empty delimiter + NoDelim, +} + +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] +pub enum Lit { + Byte(ast::Name), + Char(ast::Name), + Integer(ast::Name), + Float(ast::Name), + Str_(ast::Name), + StrRaw(ast::Name, usize), /* raw str delimited by n hash symbols */ + ByteStr(ast::Name), + ByteStrRaw(ast::Name, usize), /* raw byte str delimited by n hash symbols */ +} + +impl Lit { + pub fn short_name(&self) -> &'static str { + match *self { + Byte(_) => "byte", + Char(_) => "char", + Integer(_) => "integer", + Float(_) => "float", + Str_(_) | StrRaw(..) => "string", + ByteStr(_) | ByteStrRaw(..) => "byte string" + } + } +} + +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug)] +pub enum Token { + /* Expression-operator symbols. */ + Eq, + Lt, + Le, + EqEq, + Ne, + Ge, + Gt, + AndAnd, + OrOr, + Not, + Tilde, + BinOp(BinOpToken), + BinOpEq(BinOpToken), + + /* Structural symbols */ + At, + Dot, + DotDot, + DotDotDot, + Comma, + Semi, + Colon, + ModSep, + RArrow, + LArrow, + FatArrow, + Pound, + Dollar, + Question, + /// An opening delimiter, eg. `{` + OpenDelim(DelimToken), + /// A closing delimiter, eg. `}` + CloseDelim(DelimToken), + + /* Literals */ + Literal(Lit, Option), + + /* Name components */ + Ident(ast::Ident), + Underscore, + Lifetime(ast::Ident), + + /* For interpolation */ + Interpolated(Rc), + // Can be expanded into several tokens. + /// Doc comment + DocComment(ast::Name), + // In left-hand-sides of MBE macros: + /// Parse a nonterminal (name to bind, name of NT) + MatchNt(ast::Ident, ast::Ident), + // In right-hand-sides of MBE macros: + /// A syntactic variable that will be filled in by macro expansion. + SubstNt(ast::Ident), + + // Junk. These carry no data because we don't really care about the data + // they *would* carry, and don't really want to allocate a new ident for + // them. Instead, users could extract that from the associated span. + + /// Whitespace + Whitespace, + /// Comment + Comment, + Shebang(ast::Name), + + Eof, +} + +impl Token { + /// Returns `true` if the token starts with '>'. + pub fn is_like_gt(&self) -> bool { + match *self { + BinOp(Shr) | BinOpEq(Shr) | Gt | Ge => true, + _ => false, + } + } + + /// Returns `true` if the token can appear at the start of an expression. + pub fn can_begin_expr(&self) -> bool { + match *self { + OpenDelim(..) => true, + Ident(..) => true, + Literal(..) => true, + Not => true, + BinOp(Minus) => true, + BinOp(Star) => true, + BinOp(And) => true, + BinOp(Or) => true, // in lambda syntax + OrOr => true, // in lambda syntax + AndAnd => true, // double borrow + DotDot | DotDotDot => true, // range notation + Lt | BinOp(Shl) => true, // associated path + ModSep => true, + Pound => true, // for expression attributes + Interpolated(ref nt) => match **nt { + NtExpr(..) => true, + NtIdent(..) => true, + NtBlock(..) => true, + NtPath(..) => true, + _ => false, + }, + _ => false, + } + } + + /// Returns `true` if the token is any literal + pub fn is_lit(&self) -> bool { + match *self { + Literal(..) => true, + _ => false, + } + } + + /// Returns `true` if the token is an identifier. + pub fn is_ident(&self) -> bool { + match *self { + Ident(..) => true, + _ => false, + } + } + + /// Returns `true` if the token is a documentation comment. + pub fn is_doc_comment(&self) -> bool { + match *self { + DocComment(..) => true, + _ => false, + } + } + + /// Returns `true` if the token is interpolated. + pub fn is_interpolated(&self) -> bool { + match *self { + Interpolated(..) => true, + _ => false, + } + } + + /// Returns `true` if the token is an interpolated path. + pub fn is_path(&self) -> bool { + if let Interpolated(ref nt) = *self { + if let NtPath(..) = **nt { + return true; + } + } + false + } + + /// Returns `true` if the token is a lifetime. + pub fn is_lifetime(&self) -> bool { + match *self { + Lifetime(..) => true, + _ => false, + } + } + + /// Returns `true` if the token is either the `mut` or `const` keyword. + pub fn is_mutability(&self) -> bool { + self.is_keyword(keywords::Mut) || + self.is_keyword(keywords::Const) + } + + pub fn is_qpath_start(&self) -> bool { + self == &Lt || self == &BinOp(Shl) + } + + pub fn is_path_start(&self) -> bool { + self == &ModSep || self.is_qpath_start() || self.is_path() || + self.is_path_segment_keyword() || self.is_ident() && !self.is_any_keyword() + } + + /// Returns `true` if the token is a given keyword, `kw`. + pub fn is_keyword(&self, kw: keywords::Keyword) -> bool { + match *self { + Ident(id) => id.name == kw.name(), + _ => false, + } + } + + pub fn is_path_segment_keyword(&self) -> bool { + match *self { + Ident(id) => id.name == keywords::Super.name() || + id.name == keywords::SelfValue.name() || + id.name == keywords::SelfType.name(), + _ => false, + } + } + + /// Returns `true` if the token is either a strict or reserved keyword. + pub fn is_any_keyword(&self) -> bool { + self.is_strict_keyword() || self.is_reserved_keyword() + } + + /// Returns `true` if the token is a strict keyword. + pub fn is_strict_keyword(&self) -> bool { + match *self { + Ident(id) => id.name >= keywords::As.name() && + id.name <= keywords::While.name(), + _ => false, + } + } + + /// Returns `true` if the token is a keyword reserved for possible future use. + pub fn is_reserved_keyword(&self) -> bool { + match *self { + Ident(id) => id.name >= keywords::Abstract.name() && + id.name <= keywords::Yield.name(), + _ => false, + } + } +} + +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash)] +/// For interpolation during macro expansion. +pub enum Nonterminal { + NtItem(P), + NtBlock(P), + NtStmt(ast::Stmt), + NtPat(P), + NtExpr(P), + NtTy(P), + NtIdent(ast::SpannedIdent), + /// Stuff inside brackets for attributes + NtMeta(ast::MetaItem), + NtPath(ast::Path), + NtTT(tokenstream::TokenTree), + // These are not exposed to macros, but are used by quasiquote. + NtArm(ast::Arm), + NtImplItem(ast::ImplItem), + NtTraitItem(ast::TraitItem), + NtGenerics(ast::Generics), + NtWhereClause(ast::WhereClause), + NtArg(ast::Arg), +} + +impl fmt::Debug for Nonterminal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + NtItem(..) => f.pad("NtItem(..)"), + NtBlock(..) => f.pad("NtBlock(..)"), + NtStmt(..) => f.pad("NtStmt(..)"), + NtPat(..) => f.pad("NtPat(..)"), + NtExpr(..) => f.pad("NtExpr(..)"), + NtTy(..) => f.pad("NtTy(..)"), + NtIdent(..) => f.pad("NtIdent(..)"), + NtMeta(..) => f.pad("NtMeta(..)"), + NtPath(..) => f.pad("NtPath(..)"), + NtTT(..) => f.pad("NtTT(..)"), + NtArm(..) => f.pad("NtArm(..)"), + NtImplItem(..) => f.pad("NtImplItem(..)"), + NtTraitItem(..) => f.pad("NtTraitItem(..)"), + NtGenerics(..) => f.pad("NtGenerics(..)"), + NtWhereClause(..) => f.pad("NtWhereClause(..)"), + NtArg(..) => f.pad("NtArg(..)"), + } + } +} diff --git a/third_party/rust/syntex_syntax/src/print/pp.rs b/third_party/rust/syntex_syntax/src/print/pp.rs new file mode 100644 index 000000000000..3f3f0934107c --- /dev/null +++ b/third_party/rust/syntex_syntax/src/print/pp.rs @@ -0,0 +1,640 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! This pretty-printer is a direct reimplementation of Philip Karlton's +//! Mesa pretty-printer, as described in appendix A of +//! +//! ````ignore +//! STAN-CS-79-770: "Pretty Printing", by Derek C. Oppen. +//! Stanford Department of Computer Science, 1979. +//! ```` +//! +//! The algorithm's aim is to break a stream into as few lines as possible +//! while respecting the indentation-consistency requirements of the enclosing +//! block, and avoiding breaking at silly places on block boundaries, for +//! example, between "x" and ")" in "x)". +//! +//! I am implementing this algorithm because it comes with 20 pages of +//! documentation explaining its theory, and because it addresses the set of +//! concerns I've seen other pretty-printers fall down on. Weirdly. Even though +//! it's 32 years old. What can I say? +//! +//! Despite some redundancies and quirks in the way it's implemented in that +//! paper, I've opted to keep the implementation here as similar as I can, +//! changing only what was blatantly wrong, a typo, or sufficiently +//! non-idiomatic rust that it really stuck out. +//! +//! In particular you'll see a certain amount of churn related to INTEGER vs. +//! CARDINAL in the Mesa implementation. Mesa apparently interconverts the two +//! somewhat readily? In any case, I've used usize for indices-in-buffers and +//! ints for character-sizes-and-indentation-offsets. This respects the need +//! for ints to "go negative" while carrying a pending-calculation balance, and +//! helps differentiate all the numbers flying around internally (slightly). +//! +//! I also inverted the indentation arithmetic used in the print stack, since +//! the Mesa implementation (somewhat randomly) stores the offset on the print +//! stack in terms of margin-col rather than col itself. I store col. +//! +//! I also implemented a small change in the String token, in that I store an +//! explicit length for the string. For most tokens this is just the length of +//! the accompanying string. But it's necessary to permit it to differ, for +//! encoding things that are supposed to "go on their own line" -- certain +//! classes of comment and blank-line -- where relying on adjacent +//! hardbreak-like Break tokens with long blankness indication doesn't actually +//! work. To see why, consider when there is a "thing that should be on its own +//! line" between two long blocks, say functions. If you put a hardbreak after +//! each function (or before each) and the breaking algorithm decides to break +//! there anyways (because the functions themselves are long) you wind up with +//! extra blank lines. If you don't put hardbreaks you can wind up with the +//! "thing which should be on its own line" not getting its own line in the +//! rare case of "really small functions" or such. This re-occurs with comments +//! and explicit blank lines. So in those cases we use a string with a payload +//! we want isolated to a line and an explicit length that's huge, surrounded +//! by two zero-length breaks. The algorithm will try its best to fit it on a +//! line (which it can't) and so naturally place the content on its own line to +//! avoid combining it with other lines and making matters even worse. + +use std::collections::VecDeque; +use std::fmt; +use std::io; + +#[derive(Clone, Copy, PartialEq)] +pub enum Breaks { + Consistent, + Inconsistent, +} + +#[derive(Clone, Copy)] +pub struct BreakToken { + offset: isize, + blank_space: isize +} + +#[derive(Clone, Copy)] +pub struct BeginToken { + offset: isize, + breaks: Breaks +} + +#[derive(Clone)] +pub enum Token { + String(String, isize), + Break(BreakToken), + Begin(BeginToken), + End, + Eof, +} + +impl Token { + pub fn is_eof(&self) -> bool { + match *self { + Token::Eof => true, + _ => false, + } + } + + pub fn is_hardbreak_tok(&self) -> bool { + match *self { + Token::Break(BreakToken { + offset: 0, + blank_space: bs + }) if bs == SIZE_INFINITY => + true, + _ => + false + } + } +} + +impl fmt::Display for Token { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Token::String(ref s, len) => write!(f, "STR({},{})", s, len), + Token::Break(_) => f.write_str("BREAK"), + Token::Begin(_) => f.write_str("BEGIN"), + Token::End => f.write_str("END"), + Token::Eof => f.write_str("EOF"), + } + } +} + +fn buf_str(buf: &[BufEntry], left: usize, right: usize, lim: usize) -> String { + let n = buf.len(); + let mut i = left; + let mut l = lim; + let mut s = String::from("["); + while i != right && l != 0 { + l -= 1; + if i != left { + s.push_str(", "); + } + s.push_str(&format!("{}={}", buf[i].size, &buf[i].token)); + i += 1; + i %= n; + } + s.push(']'); + s +} + +#[derive(Copy, Clone)] +pub enum PrintStackBreak { + Fits, + Broken(Breaks), +} + +#[derive(Copy, Clone)] +pub struct PrintStackElem { + offset: isize, + pbreak: PrintStackBreak +} + +const SIZE_INFINITY: isize = 0xffff; + +pub fn mk_printer<'a>(out: Box, linewidth: usize) -> Printer<'a> { + // Yes 55, it makes the ring buffers big enough to never fall behind. + let n: usize = 55 * linewidth; + debug!("mk_printer {}", linewidth); + Printer { + out: out, + buf_len: n, + margin: linewidth as isize, + space: linewidth as isize, + left: 0, + right: 0, + buf: vec![BufEntry { token: Token::Eof, size: 0 }; n], + left_total: 0, + right_total: 0, + scan_stack: VecDeque::new(), + print_stack: Vec::new(), + pending_indentation: 0 + } +} + + +/// In case you do not have the paper, here is an explanation of what's going +/// on. +/// +/// There is a stream of input tokens flowing through this printer. +/// +/// The printer buffers up to 3N tokens inside itself, where N is linewidth. +/// Yes, linewidth is chars and tokens are multi-char, but in the worst +/// case every token worth buffering is 1 char long, so it's ok. +/// +/// Tokens are String, Break, and Begin/End to delimit blocks. +/// +/// Begin tokens can carry an offset, saying "how far to indent when you break +/// inside here", as well as a flag indicating "consistent" or "inconsistent" +/// breaking. Consistent breaking means that after the first break, no attempt +/// will be made to flow subsequent breaks together onto lines. Inconsistent +/// is the opposite. Inconsistent breaking example would be, say: +/// +/// foo(hello, there, good, friends) +/// +/// breaking inconsistently to become +/// +/// foo(hello, there +/// good, friends); +/// +/// whereas a consistent breaking would yield: +/// +/// foo(hello, +/// there +/// good, +/// friends); +/// +/// That is, in the consistent-break blocks we value vertical alignment +/// more than the ability to cram stuff onto a line. But in all cases if it +/// can make a block a one-liner, it'll do so. +/// +/// Carrying on with high-level logic: +/// +/// The buffered tokens go through a ring-buffer, 'tokens'. The 'left' and +/// 'right' indices denote the active portion of the ring buffer as well as +/// describing hypothetical points-in-the-infinite-stream at most 3N tokens +/// apart (i.e. "not wrapped to ring-buffer boundaries"). The paper will switch +/// between using 'left' and 'right' terms to denote the wrapped-to-ring-buffer +/// and point-in-infinite-stream senses freely. +/// +/// There is a parallel ring buffer, 'size', that holds the calculated size of +/// each token. Why calculated? Because for Begin/End pairs, the "size" +/// includes everything between the pair. That is, the "size" of Begin is +/// actually the sum of the sizes of everything between Begin and the paired +/// End that follows. Since that is arbitrarily far in the future, 'size' is +/// being rewritten regularly while the printer runs; in fact most of the +/// machinery is here to work out 'size' entries on the fly (and give up when +/// they're so obviously over-long that "infinity" is a good enough +/// approximation for purposes of line breaking). +/// +/// The "input side" of the printer is managed as an abstract process called +/// SCAN, which uses 'scan_stack', to manage calculating 'size'. SCAN is, in +/// other words, the process of calculating 'size' entries. +/// +/// The "output side" of the printer is managed by an abstract process called +/// PRINT, which uses 'print_stack', 'margin' and 'space' to figure out what to +/// do with each token/size pair it consumes as it goes. It's trying to consume +/// the entire buffered window, but can't output anything until the size is >= +/// 0 (sizes are set to negative while they're pending calculation). +/// +/// So SCAN takes input and buffers tokens and pending calculations, while +/// PRINT gobbles up completed calculations and tokens from the buffer. The +/// theory is that the two can never get more than 3N tokens apart, because +/// once there's "obviously" too much data to fit on a line, in a size +/// calculation, SCAN will write "infinity" to the size and let PRINT consume +/// it. +/// +/// In this implementation (following the paper, again) the SCAN process is +/// the method called 'pretty_print', and the 'PRINT' process is the method +/// called 'print'. +pub struct Printer<'a> { + pub out: Box, + buf_len: usize, + /// Width of lines we're constrained to + margin: isize, + /// Number of spaces left on line + space: isize, + /// Index of left side of input stream + left: usize, + /// Index of right side of input stream + right: usize, + /// Ring-buffer of tokens and calculated sizes + buf: Vec, + /// Running size of stream "...left" + left_total: isize, + /// Running size of stream "...right" + right_total: isize, + /// Pseudo-stack, really a ring too. Holds the + /// primary-ring-buffers index of the Begin that started the + /// current block, possibly with the most recent Break after that + /// Begin (if there is any) on top of it. Stuff is flushed off the + /// bottom as it becomes irrelevant due to the primary ring-buffer + /// advancing. + scan_stack: VecDeque, + /// Stack of blocks-in-progress being flushed by print + print_stack: Vec , + /// Buffered indentation to avoid writing trailing whitespace + pending_indentation: isize, +} + +#[derive(Clone)] +struct BufEntry { + token: Token, + size: isize, +} + +impl<'a> Printer<'a> { + pub fn last_token(&mut self) -> Token { + self.buf[self.right].token.clone() + } + // be very careful with this! + pub fn replace_last_token(&mut self, t: Token) { + self.buf[self.right].token = t; + } + pub fn pretty_print(&mut self, token: Token) -> io::Result<()> { + debug!("pp Vec<{},{}>", self.left, self.right); + match token { + Token::Eof => { + if !self.scan_stack.is_empty() { + self.check_stack(0); + try!(self.advance_left()); + } + self.indent(0); + Ok(()) + } + Token::Begin(b) => { + if self.scan_stack.is_empty() { + self.left_total = 1; + self.right_total = 1; + self.left = 0; + self.right = 0; + } else { self.advance_right(); } + debug!("pp Begin({})/buffer Vec<{},{}>", + b.offset, self.left, self.right); + self.buf[self.right] = BufEntry { token: token, size: -self.right_total }; + let right = self.right; + self.scan_push(right); + Ok(()) + } + Token::End => { + if self.scan_stack.is_empty() { + debug!("pp End/print Vec<{},{}>", self.left, self.right); + self.print(token, 0) + } else { + debug!("pp End/buffer Vec<{},{}>", self.left, self.right); + self.advance_right(); + self.buf[self.right] = BufEntry { token: token, size: -1 }; + let right = self.right; + self.scan_push(right); + Ok(()) + } + } + Token::Break(b) => { + if self.scan_stack.is_empty() { + self.left_total = 1; + self.right_total = 1; + self.left = 0; + self.right = 0; + } else { self.advance_right(); } + debug!("pp Break({})/buffer Vec<{},{}>", + b.offset, self.left, self.right); + self.check_stack(0); + let right = self.right; + self.scan_push(right); + self.buf[self.right] = BufEntry { token: token, size: -self.right_total }; + self.right_total += b.blank_space; + Ok(()) + } + Token::String(s, len) => { + if self.scan_stack.is_empty() { + debug!("pp String('{}')/print Vec<{},{}>", + s, self.left, self.right); + self.print(Token::String(s, len), len) + } else { + debug!("pp String('{}')/buffer Vec<{},{}>", + s, self.left, self.right); + self.advance_right(); + self.buf[self.right] = BufEntry { token: Token::String(s, len), size: len }; + self.right_total += len; + self.check_stream() + } + } + } + } + pub fn check_stream(&mut self) -> io::Result<()> { + debug!("check_stream Vec<{}, {}> with left_total={}, right_total={}", + self.left, self.right, self.left_total, self.right_total); + if self.right_total - self.left_total > self.space { + debug!("scan window is {}, longer than space on line ({})", + self.right_total - self.left_total, self.space); + if Some(&self.left) == self.scan_stack.back() { + debug!("setting {} to infinity and popping", self.left); + let scanned = self.scan_pop_bottom(); + self.buf[scanned].size = SIZE_INFINITY; + } + try!(self.advance_left()); + if self.left != self.right { + try!(self.check_stream()); + } + } + Ok(()) + } + pub fn scan_push(&mut self, x: usize) { + debug!("scan_push {}", x); + self.scan_stack.push_front(x); + } + pub fn scan_pop(&mut self) -> usize { + self.scan_stack.pop_front().unwrap() + } + pub fn scan_top(&mut self) -> usize { + *self.scan_stack.front().unwrap() + } + pub fn scan_pop_bottom(&mut self) -> usize { + self.scan_stack.pop_back().unwrap() + } + pub fn advance_right(&mut self) { + self.right += 1; + self.right %= self.buf_len; + assert!(self.right != self.left); + } + pub fn advance_left(&mut self) -> io::Result<()> { + debug!("advance_left Vec<{},{}>, sizeof({})={}", self.left, self.right, + self.left, self.buf[self.left].size); + + let mut left_size = self.buf[self.left].size; + + while left_size >= 0 { + let left = self.buf[self.left].token.clone(); + + let len = match left { + Token::Break(b) => b.blank_space, + Token::String(_, len) => { + assert_eq!(len, left_size); + len + } + _ => 0 + }; + + try!(self.print(left, left_size)); + + self.left_total += len; + + if self.left == self.right { + break; + } + + self.left += 1; + self.left %= self.buf_len; + + left_size = self.buf[self.left].size; + } + + Ok(()) + } + pub fn check_stack(&mut self, k: isize) { + if !self.scan_stack.is_empty() { + let x = self.scan_top(); + match self.buf[x].token { + Token::Begin(_) => { + if k > 0 { + let popped = self.scan_pop(); + self.buf[popped].size = self.buf[x].size + self.right_total; + self.check_stack(k - 1); + } + } + Token::End => { + // paper says + not =, but that makes no sense. + let popped = self.scan_pop(); + self.buf[popped].size = 1; + self.check_stack(k + 1); + } + _ => { + let popped = self.scan_pop(); + self.buf[popped].size = self.buf[x].size + self.right_total; + if k > 0 { + self.check_stack(k); + } + } + } + } + } + pub fn print_newline(&mut self, amount: isize) -> io::Result<()> { + debug!("NEWLINE {}", amount); + let ret = write!(self.out, "\n"); + self.pending_indentation = 0; + self.indent(amount); + ret + } + pub fn indent(&mut self, amount: isize) { + debug!("INDENT {}", amount); + self.pending_indentation += amount; + } + pub fn get_top(&mut self) -> PrintStackElem { + match self.print_stack.last() { + Some(el) => *el, + None => PrintStackElem { + offset: 0, + pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) + } + } + } + pub fn print_str(&mut self, s: &str) -> io::Result<()> { + while self.pending_indentation > 0 { + try!(write!(self.out, " ")); + self.pending_indentation -= 1; + } + write!(self.out, "{}", s) + } + pub fn print(&mut self, token: Token, l: isize) -> io::Result<()> { + debug!("print {} {} (remaining line space={})", token, l, + self.space); + debug!("{}", buf_str(&self.buf, + self.left, + self.right, + 6)); + match token { + Token::Begin(b) => { + if l > self.space { + let col = self.margin - self.space + b.offset; + debug!("print Begin -> push broken block at col {}", col); + self.print_stack.push(PrintStackElem { + offset: col, + pbreak: PrintStackBreak::Broken(b.breaks) + }); + } else { + debug!("print Begin -> push fitting block"); + self.print_stack.push(PrintStackElem { + offset: 0, + pbreak: PrintStackBreak::Fits + }); + } + Ok(()) + } + Token::End => { + debug!("print End -> pop End"); + let print_stack = &mut self.print_stack; + assert!(!print_stack.is_empty()); + print_stack.pop().unwrap(); + Ok(()) + } + Token::Break(b) => { + let top = self.get_top(); + match top.pbreak { + PrintStackBreak::Fits => { + debug!("print Break({}) in fitting block", b.blank_space); + self.space -= b.blank_space; + self.indent(b.blank_space); + Ok(()) + } + PrintStackBreak::Broken(Breaks::Consistent) => { + debug!("print Break({}+{}) in consistent block", + top.offset, b.offset); + let ret = self.print_newline(top.offset + b.offset); + self.space = self.margin - (top.offset + b.offset); + ret + } + PrintStackBreak::Broken(Breaks::Inconsistent) => { + if l > self.space { + debug!("print Break({}+{}) w/ newline in inconsistent", + top.offset, b.offset); + let ret = self.print_newline(top.offset + b.offset); + self.space = self.margin - (top.offset + b.offset); + ret + } else { + debug!("print Break({}) w/o newline in inconsistent", + b.blank_space); + self.indent(b.blank_space); + self.space -= b.blank_space; + Ok(()) + } + } + } + } + Token::String(ref s, len) => { + debug!("print String({})", s); + assert_eq!(l, len); + // assert!(l <= space); + self.space -= len; + self.print_str(s) + } + Token::Eof => { + // Eof should never get here. + panic!(); + } + } + } +} + +// Convenience functions to talk to the printer. +// +// "raw box" +pub fn rbox(p: &mut Printer, indent: usize, b: Breaks) -> io::Result<()> { + p.pretty_print(Token::Begin(BeginToken { + offset: indent as isize, + breaks: b + })) +} + +pub fn ibox(p: &mut Printer, indent: usize) -> io::Result<()> { + rbox(p, indent, Breaks::Inconsistent) +} + +pub fn cbox(p: &mut Printer, indent: usize) -> io::Result<()> { + rbox(p, indent, Breaks::Consistent) +} + +pub fn break_offset(p: &mut Printer, n: usize, off: isize) -> io::Result<()> { + p.pretty_print(Token::Break(BreakToken { + offset: off, + blank_space: n as isize + })) +} + +pub fn end(p: &mut Printer) -> io::Result<()> { + p.pretty_print(Token::End) +} + +pub fn eof(p: &mut Printer) -> io::Result<()> { + p.pretty_print(Token::Eof) +} + +pub fn word(p: &mut Printer, wrd: &str) -> io::Result<()> { + p.pretty_print(Token::String(wrd.to_string(), wrd.len() as isize)) +} + +pub fn huge_word(p: &mut Printer, wrd: &str) -> io::Result<()> { + p.pretty_print(Token::String(wrd.to_string(), SIZE_INFINITY)) +} + +pub fn zero_word(p: &mut Printer, wrd: &str) -> io::Result<()> { + p.pretty_print(Token::String(wrd.to_string(), 0)) +} + +pub fn spaces(p: &mut Printer, n: usize) -> io::Result<()> { + break_offset(p, n, 0) +} + +pub fn zerobreak(p: &mut Printer) -> io::Result<()> { + spaces(p, 0) +} + +pub fn space(p: &mut Printer) -> io::Result<()> { + spaces(p, 1) +} + +pub fn hardbreak(p: &mut Printer) -> io::Result<()> { + spaces(p, SIZE_INFINITY as usize) +} + +pub fn hardbreak_tok_offset(off: isize) -> Token { + Token::Break(BreakToken {offset: off, blank_space: SIZE_INFINITY}) +} + +pub fn hardbreak_tok() -> Token { + hardbreak_tok_offset(0) +} diff --git a/third_party/rust/syntex_syntax/src/print/pprust.rs b/third_party/rust/syntex_syntax/src/print/pprust.rs new file mode 100644 index 000000000000..7e74b70e1f07 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/print/pprust.rs @@ -0,0 +1,3126 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use self::AnnNode::*; + +use abi::{self, Abi}; +use ast::{self, BlockCheckMode, PatKind}; +use ast::{SelfKind, RegionTyParamBound, TraitTyParamBound, TraitBoundModifier}; +use ast::Attribute; +use util::parser::AssocOp; +use attr; +use codemap::{self, CodeMap}; +use syntax_pos::{self, BytePos}; +use errors; +use parse::token::{self, BinOpToken, Token}; +use parse::lexer::comments; +use parse; +use print::pp::{self, break_offset, word, space, zerobreak, hardbreak}; +use print::pp::{Breaks, eof}; +use print::pp::Breaks::{Consistent, Inconsistent}; +use ptr::P; +use std_inject; +use symbol::{Symbol, keywords}; +use tokenstream::{self, TokenTree}; + +use std::ascii; +use std::io::{self, Write, Read}; +use std::iter; + +pub enum AnnNode<'a> { + NodeIdent(&'a ast::Ident), + NodeName(&'a ast::Name), + NodeBlock(&'a ast::Block), + NodeItem(&'a ast::Item), + NodeSubItem(ast::NodeId), + NodeExpr(&'a ast::Expr), + NodePat(&'a ast::Pat), +} + +pub trait PpAnn { + fn pre(&self, _state: &mut State, _node: AnnNode) -> io::Result<()> { Ok(()) } + fn post(&self, _state: &mut State, _node: AnnNode) -> io::Result<()> { Ok(()) } +} + +#[derive(Copy, Clone)] +pub struct NoAnn; + +impl PpAnn for NoAnn {} + +#[derive(Copy, Clone)] +pub struct CurrentCommentAndLiteral { + pub cur_cmnt: usize, + pub cur_lit: usize, +} + +pub struct State<'a> { + pub s: pp::Printer<'a>, + cm: Option<&'a CodeMap>, + comments: Option >, + literals: Option >, + cur_cmnt_and_lit: CurrentCommentAndLiteral, + boxes: Vec, + ann: &'a (PpAnn+'a), +} + +pub fn rust_printer<'a>(writer: Box) -> State<'a> { + static NO_ANN: NoAnn = NoAnn; + rust_printer_annotated(writer, &NO_ANN) +} + +pub fn rust_printer_annotated<'a>(writer: Box, + ann: &'a PpAnn) -> State<'a> { + State { + s: pp::mk_printer(writer, DEFAULT_COLUMNS), + cm: None, + comments: None, + literals: None, + cur_cmnt_and_lit: CurrentCommentAndLiteral { + cur_cmnt: 0, + cur_lit: 0 + }, + boxes: Vec::new(), + ann: ann, + } +} + +pub const INDENT_UNIT: usize = 4; + +pub const DEFAULT_COLUMNS: usize = 78; + +/// Requires you to pass an input filename and reader so that +/// it can scan the input text for comments and literals to +/// copy forward. +pub fn print_crate<'a>(cm: &'a CodeMap, + span_diagnostic: &errors::Handler, + krate: &ast::Crate, + filename: String, + input: &mut Read, + out: Box, + ann: &'a PpAnn, + is_expanded: bool) -> io::Result<()> { + let mut s = State::new_from_input(cm, + span_diagnostic, + filename, + input, + out, + ann, + is_expanded); + if is_expanded && !std_inject::injected_crate_name(krate).is_none() { + // We need to print `#![no_std]` (and its feature gate) so that + // compiling pretty-printed source won't inject libstd again. + // However we don't want these attributes in the AST because + // of the feature gate, so we fake them up here. + + // #![feature(prelude_import)] + let prelude_import_meta = attr::mk_list_word_item(Symbol::intern("prelude_import")); + let list = attr::mk_list_item(Symbol::intern("feature"), vec![prelude_import_meta]); + let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), list); + try!(s.print_attribute(&fake_attr)); + + // #![no_std] + let no_std_meta = attr::mk_word_item(Symbol::intern("no_std")); + let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), no_std_meta); + try!(s.print_attribute(&fake_attr)); + } + + try!(s.print_mod(&krate.module, &krate.attrs)); + try!(s.print_remaining_comments()); + eof(&mut s.s) +} + +impl<'a> State<'a> { + pub fn new_from_input(cm: &'a CodeMap, + span_diagnostic: &errors::Handler, + filename: String, + input: &mut Read, + out: Box, + ann: &'a PpAnn, + is_expanded: bool) -> State<'a> { + let (cmnts, lits) = comments::gather_comments_and_literals( + span_diagnostic, + filename, + input); + + State::new( + cm, + out, + ann, + Some(cmnts), + // If the code is post expansion, don't use the table of + // literals, since it doesn't correspond with the literals + // in the AST anymore. + if is_expanded { None } else { Some(lits) }) + } + + pub fn new(cm: &'a CodeMap, + out: Box, + ann: &'a PpAnn, + comments: Option>, + literals: Option>) -> State<'a> { + State { + s: pp::mk_printer(out, DEFAULT_COLUMNS), + cm: Some(cm), + comments: comments, + literals: literals, + cur_cmnt_and_lit: CurrentCommentAndLiteral { + cur_cmnt: 0, + cur_lit: 0 + }, + boxes: Vec::new(), + ann: ann, + } + } +} + +pub fn to_string(f: F) -> String where + F: FnOnce(&mut State) -> io::Result<()>, +{ + let mut wr = Vec::new(); + { + let mut printer = rust_printer(Box::new(&mut wr)); + f(&mut printer).unwrap(); + eof(&mut printer.s).unwrap(); + } + String::from_utf8(wr).unwrap() +} + +pub fn binop_to_string(op: BinOpToken) -> &'static str { + match op { + token::Plus => "+", + token::Minus => "-", + token::Star => "*", + token::Slash => "/", + token::Percent => "%", + token::Caret => "^", + token::And => "&", + token::Or => "|", + token::Shl => "<<", + token::Shr => ">>", + } +} + +pub fn token_to_string(tok: &Token) -> String { + match *tok { + token::Eq => "=".to_string(), + token::Lt => "<".to_string(), + token::Le => "<=".to_string(), + token::EqEq => "==".to_string(), + token::Ne => "!=".to_string(), + token::Ge => ">=".to_string(), + token::Gt => ">".to_string(), + token::Not => "!".to_string(), + token::Tilde => "~".to_string(), + token::OrOr => "||".to_string(), + token::AndAnd => "&&".to_string(), + token::BinOp(op) => binop_to_string(op).to_string(), + token::BinOpEq(op) => format!("{}=", binop_to_string(op)), + + /* Structural symbols */ + token::At => "@".to_string(), + token::Dot => ".".to_string(), + token::DotDot => "..".to_string(), + token::DotDotDot => "...".to_string(), + token::Comma => ",".to_string(), + token::Semi => ";".to_string(), + token::Colon => ":".to_string(), + token::ModSep => "::".to_string(), + token::RArrow => "->".to_string(), + token::LArrow => "<-".to_string(), + token::FatArrow => "=>".to_string(), + token::OpenDelim(token::Paren) => "(".to_string(), + token::CloseDelim(token::Paren) => ")".to_string(), + token::OpenDelim(token::Bracket) => "[".to_string(), + token::CloseDelim(token::Bracket) => "]".to_string(), + token::OpenDelim(token::Brace) => "{".to_string(), + token::CloseDelim(token::Brace) => "}".to_string(), + token::OpenDelim(token::NoDelim) => " ".to_string(), + token::CloseDelim(token::NoDelim) => " ".to_string(), + token::Pound => "#".to_string(), + token::Dollar => "$".to_string(), + token::Question => "?".to_string(), + + /* Literals */ + token::Literal(lit, suf) => { + let mut out = match lit { + token::Byte(b) => format!("b'{}'", b), + token::Char(c) => format!("'{}'", c), + token::Float(c) => c.to_string(), + token::Integer(c) => c.to_string(), + token::Str_(s) => format!("\"{}\"", s), + token::StrRaw(s, n) => format!("r{delim}\"{string}\"{delim}", + delim=repeat("#", n), + string=s), + token::ByteStr(v) => format!("b\"{}\"", v), + token::ByteStrRaw(s, n) => format!("br{delim}\"{string}\"{delim}", + delim=repeat("#", n), + string=s), + }; + + if let Some(s) = suf { + out.push_str(&s.as_str()) + } + + out + } + + /* Name components */ + token::Ident(s) => s.to_string(), + token::Lifetime(s) => s.to_string(), + token::Underscore => "_".to_string(), + + /* Other */ + token::DocComment(s) => s.to_string(), + token::SubstNt(s) => format!("${}", s), + token::MatchNt(s, t) => format!("${}:{}", s, t), + token::Eof => "".to_string(), + token::Whitespace => " ".to_string(), + token::Comment => "/* */".to_string(), + token::Shebang(s) => format!("/* shebang: {}*/", s), + + token::Interpolated(ref nt) => match **nt { + token::NtExpr(ref e) => expr_to_string(&e), + token::NtMeta(ref e) => meta_item_to_string(&e), + token::NtTy(ref e) => ty_to_string(&e), + token::NtPath(ref e) => path_to_string(&e), + token::NtItem(ref e) => item_to_string(&e), + token::NtBlock(ref e) => block_to_string(&e), + token::NtStmt(ref e) => stmt_to_string(&e), + token::NtPat(ref e) => pat_to_string(&e), + token::NtIdent(ref e) => ident_to_string(e.node), + token::NtTT(ref e) => tt_to_string(&e), + token::NtArm(ref e) => arm_to_string(&e), + token::NtImplItem(ref e) => impl_item_to_string(&e), + token::NtTraitItem(ref e) => trait_item_to_string(&e), + token::NtGenerics(ref e) => generics_to_string(&e), + token::NtWhereClause(ref e) => where_clause_to_string(&e), + token::NtArg(ref e) => arg_to_string(&e), + } + } +} + +pub fn ty_to_string(ty: &ast::Ty) -> String { + to_string(|s| s.print_type(ty)) +} + +pub fn bounds_to_string(bounds: &[ast::TyParamBound]) -> String { + to_string(|s| s.print_bounds("", bounds)) +} + +pub fn pat_to_string(pat: &ast::Pat) -> String { + to_string(|s| s.print_pat(pat)) +} + +pub fn arm_to_string(arm: &ast::Arm) -> String { + to_string(|s| s.print_arm(arm)) +} + +pub fn expr_to_string(e: &ast::Expr) -> String { + to_string(|s| s.print_expr(e)) +} + +pub fn lifetime_to_string(e: &ast::Lifetime) -> String { + to_string(|s| s.print_lifetime(e)) +} + +pub fn tt_to_string(tt: &tokenstream::TokenTree) -> String { + to_string(|s| s.print_tt(tt)) +} + +pub fn tts_to_string(tts: &[tokenstream::TokenTree]) -> String { + to_string(|s| s.print_tts(tts)) +} + +pub fn stmt_to_string(stmt: &ast::Stmt) -> String { + to_string(|s| s.print_stmt(stmt)) +} + +pub fn attr_to_string(attr: &ast::Attribute) -> String { + to_string(|s| s.print_attribute(attr)) +} + +pub fn item_to_string(i: &ast::Item) -> String { + to_string(|s| s.print_item(i)) +} + +pub fn impl_item_to_string(i: &ast::ImplItem) -> String { + to_string(|s| s.print_impl_item(i)) +} + +pub fn trait_item_to_string(i: &ast::TraitItem) -> String { + to_string(|s| s.print_trait_item(i)) +} + +pub fn generics_to_string(generics: &ast::Generics) -> String { + to_string(|s| s.print_generics(generics)) +} + +pub fn where_clause_to_string(i: &ast::WhereClause) -> String { + to_string(|s| s.print_where_clause(i)) +} + +pub fn fn_block_to_string(p: &ast::FnDecl) -> String { + to_string(|s| s.print_fn_block_args(p)) +} + +pub fn path_to_string(p: &ast::Path) -> String { + to_string(|s| s.print_path(p, false, 0, false)) +} + +pub fn ident_to_string(id: ast::Ident) -> String { + to_string(|s| s.print_ident(id)) +} + +pub fn fun_to_string(decl: &ast::FnDecl, + unsafety: ast::Unsafety, + constness: ast::Constness, + name: ast::Ident, + generics: &ast::Generics) + -> String { + to_string(|s| { + try!(s.head("")); + try!(s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name), + generics, &ast::Visibility::Inherited)); + try!(s.end()); // Close the head box + s.end() // Close the outer box + }) +} + +pub fn block_to_string(blk: &ast::Block) -> String { + to_string(|s| { + // containing cbox, will be closed by print-block at } + try!(s.cbox(INDENT_UNIT)); + // head-ibox, will be closed by print-block after { + try!(s.ibox(0)); + s.print_block(blk) + }) +} + +pub fn meta_list_item_to_string(li: &ast::NestedMetaItem) -> String { + to_string(|s| s.print_meta_list_item(li)) +} + +pub fn meta_item_to_string(mi: &ast::MetaItem) -> String { + to_string(|s| s.print_meta_item(mi)) +} + +pub fn attribute_to_string(attr: &ast::Attribute) -> String { + to_string(|s| s.print_attribute(attr)) +} + +pub fn lit_to_string(l: &ast::Lit) -> String { + to_string(|s| s.print_literal(l)) +} + +pub fn variant_to_string(var: &ast::Variant) -> String { + to_string(|s| s.print_variant(var)) +} + +pub fn arg_to_string(arg: &ast::Arg) -> String { + to_string(|s| s.print_arg(arg, false)) +} + +pub fn mac_to_string(arg: &ast::Mac) -> String { + to_string(|s| s.print_mac(arg, ::parse::token::Paren)) +} + +pub fn visibility_qualified(vis: &ast::Visibility, s: &str) -> String { + match *vis { + ast::Visibility::Public => format!("pub {}", s), + ast::Visibility::Crate(_) => format!("pub(crate) {}", s), + ast::Visibility::Restricted { ref path, .. } => + format!("pub({}) {}", to_string(|s| s.print_path(path, false, 0, true)), s), + ast::Visibility::Inherited => s.to_string() + } +} + +fn needs_parentheses(expr: &ast::Expr) -> bool { + match expr.node { + ast::ExprKind::Assign(..) | ast::ExprKind::Binary(..) | + ast::ExprKind::Closure(..) | + ast::ExprKind::AssignOp(..) | ast::ExprKind::Cast(..) | + ast::ExprKind::InPlace(..) | ast::ExprKind::Type(..) => true, + _ => false, + } +} + +pub trait PrintState<'a> { + fn writer(&mut self) -> &mut pp::Printer<'a>; + fn boxes(&mut self) -> &mut Vec; + fn comments(&mut self) -> &mut Option>; + fn cur_cmnt_and_lit(&mut self) -> &mut CurrentCommentAndLiteral; + fn literals(&self) -> &Option>; + + fn word_space(&mut self, w: &str) -> io::Result<()> { + try!(word(self.writer(), w)); + space(self.writer()) + } + + fn popen(&mut self) -> io::Result<()> { word(self.writer(), "(") } + + fn pclose(&mut self) -> io::Result<()> { word(self.writer(), ")") } + + fn is_begin(&mut self) -> bool { + match self.writer().last_token() { + pp::Token::Begin(_) => true, + _ => false, + } + } + + fn is_end(&mut self) -> bool { + match self.writer().last_token() { + pp::Token::End => true, + _ => false, + } + } + + // is this the beginning of a line? + fn is_bol(&mut self) -> bool { + self.writer().last_token().is_eof() || self.writer().last_token().is_hardbreak_tok() + } + + fn hardbreak_if_not_bol(&mut self) -> io::Result<()> { + if !self.is_bol() { + try!(hardbreak(self.writer())) + } + Ok(()) + } + + // "raw box" + fn rbox(&mut self, u: usize, b: pp::Breaks) -> io::Result<()> { + self.boxes().push(b); + pp::rbox(self.writer(), u, b) + } + + fn ibox(&mut self, u: usize) -> io::Result<()> { + self.boxes().push(pp::Breaks::Inconsistent); + pp::ibox(self.writer(), u) + } + + fn end(&mut self) -> io::Result<()> { + self.boxes().pop().unwrap(); + pp::end(self.writer()) + } + + fn commasep(&mut self, b: Breaks, elts: &[T], mut op: F) -> io::Result<()> + where F: FnMut(&mut Self, &T) -> io::Result<()>, + { + try!(self.rbox(0, b)); + let mut first = true; + for elt in elts { + if first { first = false; } else { try!(self.word_space(",")); } + try!(op(self, elt)); + } + self.end() + } + + fn next_lit(&mut self, pos: BytePos) -> Option { + let mut cur_lit = self.cur_cmnt_and_lit().cur_lit; + + let mut result = None; + + if let &Some(ref lits) = self.literals() + { + while cur_lit < lits.len() { + let ltrl = (*lits)[cur_lit].clone(); + if ltrl.pos > pos { break; } + cur_lit += 1; + if ltrl.pos == pos { + result = Some(ltrl); + break; + } + } + } + + self.cur_cmnt_and_lit().cur_lit = cur_lit; + result + } + + fn maybe_print_comment(&mut self, pos: BytePos) -> io::Result<()> { + while let Some(ref cmnt) = self.next_comment() { + if cmnt.pos < pos { + try!(self.print_comment(cmnt)); + self.cur_cmnt_and_lit().cur_cmnt += 1; + } else { + break + } + } + Ok(()) + } + + fn print_comment(&mut self, + cmnt: &comments::Comment) -> io::Result<()> { + match cmnt.style { + comments::Mixed => { + assert_eq!(cmnt.lines.len(), 1); + try!(zerobreak(self.writer())); + try!(word(self.writer(), &cmnt.lines[0])); + zerobreak(self.writer()) + } + comments::Isolated => { + try!(self.hardbreak_if_not_bol()); + for line in &cmnt.lines { + // Don't print empty lines because they will end up as trailing + // whitespace + if !line.is_empty() { + try!(word(self.writer(), &line[..])); + } + try!(hardbreak(self.writer())); + } + Ok(()) + } + comments::Trailing => { + if !self.is_bol() { + try!(word(self.writer(), " ")); + } + if cmnt.lines.len() == 1 { + try!(word(self.writer(), &cmnt.lines[0])); + hardbreak(self.writer()) + } else { + try!(self.ibox(0)); + for line in &cmnt.lines { + if !line.is_empty() { + try!(word(self.writer(), &line[..])); + } + try!(hardbreak(self.writer())); + } + self.end() + } + } + comments::BlankLine => { + // We need to do at least one, possibly two hardbreaks. + let is_semi = match self.writer().last_token() { + pp::Token::String(s, _) => ";" == s, + _ => false + }; + if is_semi || self.is_begin() || self.is_end() { + try!(hardbreak(self.writer())); + } + hardbreak(self.writer()) + } + } + } + + fn next_comment(&mut self) -> Option { + let cur_cmnt = self.cur_cmnt_and_lit().cur_cmnt; + match *self.comments() { + Some(ref cmnts) => { + if cur_cmnt < cmnts.len() { + Some(cmnts[cur_cmnt].clone()) + } else { + None + } + } + _ => None + } + } + + fn print_literal(&mut self, lit: &ast::Lit) -> io::Result<()> { + try!(self.maybe_print_comment(lit.span.lo)); + match self.next_lit(lit.span.lo) { + Some(ref ltrl) => { + return word(self.writer(), &(*ltrl).lit); + } + _ => () + } + match lit.node { + ast::LitKind::Str(st, style) => self.print_string(&st.as_str(), style), + ast::LitKind::Byte(byte) => { + let mut res = String::from("b'"); + res.extend(ascii::escape_default(byte).map(|c| c as char)); + res.push('\''); + word(self.writer(), &res[..]) + } + ast::LitKind::Char(ch) => { + let mut res = String::from("'"); + res.extend(ch.escape_default()); + res.push('\''); + word(self.writer(), &res[..]) + } + ast::LitKind::Int(i, t) => { + match t { + ast::LitIntType::Signed(st) => { + word(self.writer(), &st.val_to_string(i as i64)) + } + ast::LitIntType::Unsigned(ut) => { + word(self.writer(), &ut.val_to_string(i)) + } + ast::LitIntType::Unsuffixed => { + word(self.writer(), &format!("{}", i)) + } + } + } + ast::LitKind::Float(ref f, t) => { + word(self.writer(), + &format!( + "{}{}", + &f, + t.ty_to_string())) + } + ast::LitKind::FloatUnsuffixed(ref f) => word(self.writer(), &f.as_str()), + ast::LitKind::Bool(val) => { + if val { word(self.writer(), "true") } else { word(self.writer(), "false") } + } + ast::LitKind::ByteStr(ref v) => { + let mut escaped: String = String::new(); + for &ch in v.iter() { + escaped.extend(ascii::escape_default(ch) + .map(|c| c as char)); + } + word(self.writer(), &format!("b\"{}\"", escaped)) + } + } + } + + fn print_string(&mut self, st: &str, + style: ast::StrStyle) -> io::Result<()> { + let st = match style { + ast::StrStyle::Cooked => { + (format!("\"{}\"", st.chars().flat_map(char::escape_default).collect::())) + } + ast::StrStyle::Raw(n) => { + (format!("r{delim}\"{string}\"{delim}", + delim=repeat("#", n), + string=st)) + } + }; + word(self.writer(), &st[..]) + } + + fn print_inner_attributes(&mut self, + attrs: &[ast::Attribute]) -> io::Result<()> { + self.print_either_attributes(attrs, ast::AttrStyle::Inner, false, true) + } + + fn print_inner_attributes_no_trailing_hardbreak(&mut self, + attrs: &[ast::Attribute]) + -> io::Result<()> { + self.print_either_attributes(attrs, ast::AttrStyle::Inner, false, false) + } + + fn print_outer_attributes(&mut self, + attrs: &[ast::Attribute]) -> io::Result<()> { + self.print_either_attributes(attrs, ast::AttrStyle::Outer, false, true) + } + + fn print_inner_attributes_inline(&mut self, + attrs: &[ast::Attribute]) -> io::Result<()> { + self.print_either_attributes(attrs, ast::AttrStyle::Inner, true, true) + } + + fn print_outer_attributes_inline(&mut self, + attrs: &[ast::Attribute]) -> io::Result<()> { + self.print_either_attributes(attrs, ast::AttrStyle::Outer, true, true) + } + + fn print_either_attributes(&mut self, + attrs: &[ast::Attribute], + kind: ast::AttrStyle, + is_inline: bool, + trailing_hardbreak: bool) -> io::Result<()> { + let mut count = 0; + for attr in attrs { + if attr.style == kind { + try!(self.print_attribute_inline(attr, is_inline)); + if is_inline { + try!(self.nbsp()); + } + count += 1; + } + } + if count > 0 && trailing_hardbreak && !is_inline { + try!(self.hardbreak_if_not_bol()); + } + Ok(()) + } + + fn print_attribute(&mut self, attr: &ast::Attribute) -> io::Result<()> { + self.print_attribute_inline(attr, false) + } + + fn print_attribute_inline(&mut self, attr: &ast::Attribute, + is_inline: bool) -> io::Result<()> { + if !is_inline { + try!(self.hardbreak_if_not_bol()); + } + try!(self.maybe_print_comment(attr.span.lo)); + if attr.is_sugared_doc { + try!(word(self.writer(), &attr.value_str().unwrap().as_str())); + hardbreak(self.writer()) + } else { + match attr.style { + ast::AttrStyle::Inner => try!(word(self.writer(), "#![")), + ast::AttrStyle::Outer => try!(word(self.writer(), "#[")), + } + try!(self.print_meta_item(&attr.meta())); + word(self.writer(), "]") + } + } + + fn print_meta_list_item(&mut self, item: &ast::NestedMetaItem) -> io::Result<()> { + match item.node { + ast::NestedMetaItemKind::MetaItem(ref mi) => { + self.print_meta_item(mi) + }, + ast::NestedMetaItemKind::Literal(ref lit) => { + self.print_literal(lit) + } + } + } + + fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> { + try!(self.ibox(INDENT_UNIT)); + match item.node { + ast::MetaItemKind::Word => { + try!(word(self.writer(), &item.name.as_str())); + } + ast::MetaItemKind::NameValue(ref value) => { + try!(self.word_space(&item.name.as_str())); + try!(self.word_space("=")); + try!(self.print_literal(value)); + } + ast::MetaItemKind::List(ref items) => { + try!(word(self.writer(), &item.name.as_str())); + try!(self.popen()); + try!(self.commasep(Consistent, + &items[..], + |s, i| s.print_meta_list_item(&i))); + try!(self.pclose()); + } + } + self.end() + } + + fn space_if_not_bol(&mut self) -> io::Result<()> { + if !self.is_bol() { try!(space(self.writer())); } + Ok(()) + } + + fn nbsp(&mut self) -> io::Result<()> { word(self.writer(), " ") } +} + +impl<'a> PrintState<'a> for State<'a> { + fn writer(&mut self) -> &mut pp::Printer<'a> { + &mut self.s + } + + fn boxes(&mut self) -> &mut Vec { + &mut self.boxes + } + + fn comments(&mut self) -> &mut Option> { + &mut self.comments + } + + fn cur_cmnt_and_lit(&mut self) -> &mut CurrentCommentAndLiteral { + &mut self.cur_cmnt_and_lit + } + + fn literals(&self) -> &Option> { + &self.literals + } +} + +impl<'a> State<'a> { + pub fn cbox(&mut self, u: usize) -> io::Result<()> { + self.boxes.push(pp::Breaks::Consistent); + pp::cbox(&mut self.s, u) + } + + pub fn word_nbsp(&mut self, w: &str) -> io::Result<()> { + try!(word(&mut self.s, w)); + self.nbsp() + } + + pub fn head(&mut self, w: &str) -> io::Result<()> { + // outer-box is consistent + try!(self.cbox(INDENT_UNIT)); + // head-box is inconsistent + try!(self.ibox(w.len() + 1)); + // keyword that starts the head + if !w.is_empty() { + try!(self.word_nbsp(w)); + } + Ok(()) + } + + pub fn bopen(&mut self) -> io::Result<()> { + try!(word(&mut self.s, "{")); + self.end() // close the head-box + } + + pub fn bclose_(&mut self, span: syntax_pos::Span, + indented: usize) -> io::Result<()> { + self.bclose_maybe_open(span, indented, true) + } + pub fn bclose_maybe_open(&mut self, span: syntax_pos::Span, + indented: usize, close_box: bool) -> io::Result<()> { + try!(self.maybe_print_comment(span.hi)); + try!(self.break_offset_if_not_bol(1, -(indented as isize))); + try!(word(&mut self.s, "}")); + if close_box { + try!(self.end()); // close the outer-box + } + Ok(()) + } + pub fn bclose(&mut self, span: syntax_pos::Span) -> io::Result<()> { + self.bclose_(span, INDENT_UNIT) + } + + pub fn in_cbox(&self) -> bool { + match self.boxes.last() { + Some(&last_box) => last_box == pp::Breaks::Consistent, + None => false + } + } + + pub fn break_offset_if_not_bol(&mut self, n: usize, + off: isize) -> io::Result<()> { + if !self.is_bol() { + break_offset(&mut self.s, n, off) + } else { + if off != 0 && self.s.last_token().is_hardbreak_tok() { + // We do something pretty sketchy here: tuck the nonzero + // offset-adjustment we were going to deposit along with the + // break into the previous hardbreak. + self.s.replace_last_token(pp::hardbreak_tok_offset(off)); + } + Ok(()) + } + } + + // Synthesizes a comment that was not textually present in the original source + // file. + pub fn synth_comment(&mut self, text: String) -> io::Result<()> { + try!(word(&mut self.s, "/*")); + try!(space(&mut self.s)); + try!(word(&mut self.s, &text[..])); + try!(space(&mut self.s)); + word(&mut self.s, "*/") + } + + + + pub fn commasep_cmnt(&mut self, + b: Breaks, + elts: &[T], + mut op: F, + mut get_span: G) -> io::Result<()> where + F: FnMut(&mut State, &T) -> io::Result<()>, + G: FnMut(&T) -> syntax_pos::Span, + { + try!(self.rbox(0, b)); + let len = elts.len(); + let mut i = 0; + for elt in elts { + try!(self.maybe_print_comment(get_span(elt).hi)); + try!(op(self, elt)); + i += 1; + if i < len { + try!(word(&mut self.s, ",")); + try!(self.maybe_print_trailing_comment(get_span(elt), + Some(get_span(&elts[i]).hi))); + try!(self.space_if_not_bol()); + } + } + self.end() + } + + pub fn commasep_exprs(&mut self, b: Breaks, + exprs: &[P]) -> io::Result<()> { + self.commasep_cmnt(b, exprs, |s, e| s.print_expr(&e), |e| e.span) + } + + pub fn print_mod(&mut self, _mod: &ast::Mod, + attrs: &[ast::Attribute]) -> io::Result<()> { + try!(self.print_inner_attributes(attrs)); + for item in &_mod.items { + try!(self.print_item(&item)); + } + Ok(()) + } + + pub fn print_foreign_mod(&mut self, nmod: &ast::ForeignMod, + attrs: &[ast::Attribute]) -> io::Result<()> { + try!(self.print_inner_attributes(attrs)); + for item in &nmod.items { + try!(self.print_foreign_item(item)); + } + Ok(()) + } + + pub fn print_opt_lifetime(&mut self, + lifetime: &Option) -> io::Result<()> { + if let Some(l) = *lifetime { + try!(self.print_lifetime(&l)); + try!(self.nbsp()); + } + Ok(()) + } + + pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> { + try!(self.maybe_print_comment(ty.span.lo)); + try!(self.ibox(0)); + match ty.node { + ast::TyKind::Slice(ref ty) => { + try!(word(&mut self.s, "[")); + try!(self.print_type(&ty)); + try!(word(&mut self.s, "]")); + } + ast::TyKind::Ptr(ref mt) => { + try!(word(&mut self.s, "*")); + match mt.mutbl { + ast::Mutability::Mutable => try!(self.word_nbsp("mut")), + ast::Mutability::Immutable => try!(self.word_nbsp("const")), + } + try!(self.print_type(&mt.ty)); + } + ast::TyKind::Rptr(ref lifetime, ref mt) => { + try!(word(&mut self.s, "&")); + try!(self.print_opt_lifetime(lifetime)); + try!(self.print_mt(mt)); + } + ast::TyKind::Never => { + try!(word(&mut self.s, "!")); + }, + ast::TyKind::Tup(ref elts) => { + try!(self.popen()); + try!(self.commasep(Inconsistent, &elts[..], + |s, ty| s.print_type(&ty))); + if elts.len() == 1 { + try!(word(&mut self.s, ",")); + } + try!(self.pclose()); + } + ast::TyKind::Paren(ref typ) => { + try!(self.popen()); + try!(self.print_type(&typ)); + try!(self.pclose()); + } + ast::TyKind::BareFn(ref f) => { + let generics = ast::Generics { + lifetimes: f.lifetimes.clone(), + ty_params: P::new(), + where_clause: ast::WhereClause { + id: ast::DUMMY_NODE_ID, + predicates: Vec::new(), + }, + span: syntax_pos::DUMMY_SP, + }; + try!(self.print_ty_fn(f.abi, + f.unsafety, + &f.decl, + None, + &generics)); + } + ast::TyKind::Path(None, ref path) => { + try!(self.print_path(path, false, 0, false)); + } + ast::TyKind::Path(Some(ref qself), ref path) => { + try!(self.print_qpath(path, qself, false)) + } + ast::TyKind::ObjectSum(ref ty, ref bounds) => { + try!(self.print_type(&ty)); + try!(self.print_bounds("+", &bounds[..])); + } + ast::TyKind::PolyTraitRef(ref bounds) => { + try!(self.print_bounds("", &bounds[..])); + } + ast::TyKind::ImplTrait(ref bounds) => { + try!(self.print_bounds("impl ", &bounds[..])); + } + ast::TyKind::Array(ref ty, ref v) => { + try!(word(&mut self.s, "[")); + try!(self.print_type(&ty)); + try!(word(&mut self.s, "; ")); + try!(self.print_expr(&v)); + try!(word(&mut self.s, "]")); + } + ast::TyKind::Typeof(ref e) => { + try!(word(&mut self.s, "typeof(")); + try!(self.print_expr(&e)); + try!(word(&mut self.s, ")")); + } + ast::TyKind::Infer => { + try!(word(&mut self.s, "_")); + } + ast::TyKind::ImplicitSelf => { + try!(word(&mut self.s, "Self")); + } + ast::TyKind::Mac(ref m) => { + try!(self.print_mac(m, token::Paren)); + } + } + self.end() + } + + pub fn print_foreign_item(&mut self, + item: &ast::ForeignItem) -> io::Result<()> { + try!(self.hardbreak_if_not_bol()); + try!(self.maybe_print_comment(item.span.lo)); + try!(self.print_outer_attributes(&item.attrs)); + match item.node { + ast::ForeignItemKind::Fn(ref decl, ref generics) => { + try!(self.head("")); + try!(self.print_fn(decl, ast::Unsafety::Normal, + ast::Constness::NotConst, + Abi::Rust, Some(item.ident), + generics, &item.vis)); + try!(self.end()); // end head-ibox + try!(word(&mut self.s, ";")); + self.end() // end the outer fn box + } + ast::ForeignItemKind::Static(ref t, m) => { + try!(self.head(&visibility_qualified(&item.vis, "static"))); + if m { + try!(self.word_space("mut")); + } + try!(self.print_ident(item.ident)); + try!(self.word_space(":")); + try!(self.print_type(&t)); + try!(word(&mut self.s, ";")); + try!(self.end()); // end the head-ibox + self.end() // end the outer cbox + } + } + } + + fn print_associated_const(&mut self, + ident: ast::Ident, + ty: &ast::Ty, + default: Option<&ast::Expr>, + vis: &ast::Visibility) + -> io::Result<()> + { + try!(word(&mut self.s, &visibility_qualified(vis, ""))); + try!(self.word_space("const")); + try!(self.print_ident(ident)); + try!(self.word_space(":")); + try!(self.print_type(ty)); + if let Some(expr) = default { + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_expr(expr)); + } + word(&mut self.s, ";") + } + + fn print_associated_type(&mut self, + ident: ast::Ident, + bounds: Option<&ast::TyParamBounds>, + ty: Option<&ast::Ty>) + -> io::Result<()> { + try!(self.word_space("type")); + try!(self.print_ident(ident)); + if let Some(bounds) = bounds { + try!(self.print_bounds(":", bounds)); + } + if let Some(ty) = ty { + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_type(ty)); + } + word(&mut self.s, ";") + } + + /// Pretty-print an item + pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> { + try!(self.hardbreak_if_not_bol()); + try!(self.maybe_print_comment(item.span.lo)); + try!(self.print_outer_attributes(&item.attrs)); + try!(self.ann.pre(self, NodeItem(item))); + match item.node { + ast::ItemKind::ExternCrate(ref optional_path) => { + try!(self.head(&visibility_qualified(&item.vis, "extern crate"))); + if let Some(p) = *optional_path { + let val = p.as_str(); + if val.contains("-") { + try!(self.print_string(&val, ast::StrStyle::Cooked)); + } else { + try!(self.print_name(p)); + } + try!(space(&mut self.s)); + try!(word(&mut self.s, "as")); + try!(space(&mut self.s)); + } + try!(self.print_ident(item.ident)); + try!(word(&mut self.s, ";")); + try!(self.end()); // end inner head-block + try!(self.end()); // end outer head-block + } + ast::ItemKind::Use(ref vp) => { + try!(self.head(&visibility_qualified(&item.vis, "use"))); + try!(self.print_view_path(&vp)); + try!(word(&mut self.s, ";")); + try!(self.end()); // end inner head-block + try!(self.end()); // end outer head-block + } + ast::ItemKind::Static(ref ty, m, ref expr) => { + try!(self.head(&visibility_qualified(&item.vis, "static"))); + if m == ast::Mutability::Mutable { + try!(self.word_space("mut")); + } + try!(self.print_ident(item.ident)); + try!(self.word_space(":")); + try!(self.print_type(&ty)); + try!(space(&mut self.s)); + try!(self.end()); // end the head-ibox + + try!(self.word_space("=")); + try!(self.print_expr(&expr)); + try!(word(&mut self.s, ";")); + try!(self.end()); // end the outer cbox + } + ast::ItemKind::Const(ref ty, ref expr) => { + try!(self.head(&visibility_qualified(&item.vis, "const"))); + try!(self.print_ident(item.ident)); + try!(self.word_space(":")); + try!(self.print_type(&ty)); + try!(space(&mut self.s)); + try!(self.end()); // end the head-ibox + + try!(self.word_space("=")); + try!(self.print_expr(&expr)); + try!(word(&mut self.s, ";")); + try!(self.end()); // end the outer cbox + } + ast::ItemKind::Fn(ref decl, unsafety, constness, abi, ref typarams, ref body) => { + try!(self.head("")); + try!(self.print_fn( + decl, + unsafety, + constness.node, + abi, + Some(item.ident), + typarams, + &item.vis + )); + try!(word(&mut self.s, " ")); + try!(self.print_block_with_attrs(&body, &item.attrs)); + } + ast::ItemKind::Mod(ref _mod) => { + try!(self.head(&visibility_qualified(&item.vis, "mod"))); + try!(self.print_ident(item.ident)); + try!(self.nbsp()); + try!(self.bopen()); + try!(self.print_mod(_mod, &item.attrs)); + try!(self.bclose(item.span)); + } + ast::ItemKind::ForeignMod(ref nmod) => { + try!(self.head("extern")); + try!(self.word_nbsp(&nmod.abi.to_string())); + try!(self.bopen()); + try!(self.print_foreign_mod(nmod, &item.attrs)); + try!(self.bclose(item.span)); + } + ast::ItemKind::Ty(ref ty, ref params) => { + try!(self.ibox(INDENT_UNIT)); + try!(self.ibox(0)); + try!(self.word_nbsp(&visibility_qualified(&item.vis, "type"))); + try!(self.print_ident(item.ident)); + try!(self.print_generics(params)); + try!(self.end()); // end the inner ibox + + try!(self.print_where_clause(¶ms.where_clause)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_type(&ty)); + try!(word(&mut self.s, ";")); + try!(self.end()); // end the outer ibox + } + ast::ItemKind::Enum(ref enum_definition, ref params) => { + try!(self.print_enum_def( + enum_definition, + params, + item.ident, + item.span, + &item.vis + )); + } + ast::ItemKind::Struct(ref struct_def, ref generics) => { + try!(self.head(&visibility_qualified(&item.vis, "struct"))); + try!(self.print_struct(&struct_def, generics, item.ident, item.span, true)); + } + ast::ItemKind::Union(ref struct_def, ref generics) => { + try!(self.head(&visibility_qualified(&item.vis, "union"))); + try!(self.print_struct(&struct_def, generics, item.ident, item.span, true)); + } + ast::ItemKind::DefaultImpl(unsafety, ref trait_ref) => { + try!(self.head("")); + try!(self.print_visibility(&item.vis)); + try!(self.print_unsafety(unsafety)); + try!(self.word_nbsp("impl")); + try!(self.print_trait_ref(trait_ref)); + try!(space(&mut self.s)); + try!(self.word_space("for")); + try!(self.word_space("..")); + try!(self.bopen()); + try!(self.bclose(item.span)); + } + ast::ItemKind::Impl(unsafety, + polarity, + ref generics, + ref opt_trait, + ref ty, + ref impl_items) => { + try!(self.head("")); + try!(self.print_visibility(&item.vis)); + try!(self.print_unsafety(unsafety)); + try!(self.word_nbsp("impl")); + + if generics.is_parameterized() { + try!(self.print_generics(generics)); + try!(space(&mut self.s)); + } + + match polarity { + ast::ImplPolarity::Negative => { + try!(word(&mut self.s, "!")); + }, + _ => {} + } + + if let Some(ref t) = *opt_trait { + try!(self.print_trait_ref(t)); + try!(space(&mut self.s)); + try!(self.word_space("for")); + } + + try!(self.print_type(&ty)); + try!(self.print_where_clause(&generics.where_clause)); + + try!(space(&mut self.s)); + try!(self.bopen()); + try!(self.print_inner_attributes(&item.attrs)); + for impl_item in impl_items { + try!(self.print_impl_item(impl_item)); + } + try!(self.bclose(item.span)); + } + ast::ItemKind::Trait(unsafety, ref generics, ref bounds, ref trait_items) => { + try!(self.head("")); + try!(self.print_visibility(&item.vis)); + try!(self.print_unsafety(unsafety)); + try!(self.word_nbsp("trait")); + try!(self.print_ident(item.ident)); + try!(self.print_generics(generics)); + let mut real_bounds = Vec::with_capacity(bounds.len()); + for b in bounds.iter() { + if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = *b { + try!(space(&mut self.s)); + try!(self.word_space("for )")); + try!(self.print_trait_ref(&ptr.trait_ref)); + } else { + real_bounds.push(b.clone()); + } + } + try!(self.print_bounds(":", &real_bounds[..])); + try!(self.print_where_clause(&generics.where_clause)); + try!(word(&mut self.s, " ")); + try!(self.bopen()); + for trait_item in trait_items { + try!(self.print_trait_item(trait_item)); + } + try!(self.bclose(item.span)); + } + ast::ItemKind::Mac(codemap::Spanned { ref node, .. }) => { + try!(self.print_visibility(&item.vis)); + try!(self.print_path(&node.path, false, 0, false)); + try!(word(&mut self.s, "! ")); + try!(self.print_ident(item.ident)); + try!(self.cbox(INDENT_UNIT)); + try!(self.popen()); + try!(self.print_tts(&node.tts[..])); + try!(self.pclose()); + try!(word(&mut self.s, ";")); + try!(self.end()); + } + } + self.ann.post(self, NodeItem(item)) + } + + fn print_trait_ref(&mut self, t: &ast::TraitRef) -> io::Result<()> { + self.print_path(&t.path, false, 0, false) + } + + fn print_formal_lifetime_list(&mut self, lifetimes: &[ast::LifetimeDef]) -> io::Result<()> { + if !lifetimes.is_empty() { + try!(word(&mut self.s, "for<")); + let mut comma = false; + for lifetime_def in lifetimes { + if comma { + try!(self.word_space(",")) + } + try!(self.print_outer_attributes_inline(&lifetime_def.attrs)); + try!(self.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds)); + comma = true; + } + try!(word(&mut self.s, ">")); + } + Ok(()) + } + + fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) -> io::Result<()> { + try!(self.print_formal_lifetime_list(&t.bound_lifetimes)); + self.print_trait_ref(&t.trait_ref) + } + + pub fn print_enum_def(&mut self, enum_definition: &ast::EnumDef, + generics: &ast::Generics, ident: ast::Ident, + span: syntax_pos::Span, + visibility: &ast::Visibility) -> io::Result<()> { + try!(self.head(&visibility_qualified(visibility, "enum"))); + try!(self.print_ident(ident)); + try!(self.print_generics(generics)); + try!(self.print_where_clause(&generics.where_clause)); + try!(space(&mut self.s)); + self.print_variants(&enum_definition.variants, span) + } + + pub fn print_variants(&mut self, + variants: &[ast::Variant], + span: syntax_pos::Span) -> io::Result<()> { + try!(self.bopen()); + for v in variants { + try!(self.space_if_not_bol()); + try!(self.maybe_print_comment(v.span.lo)); + try!(self.print_outer_attributes(&v.node.attrs)); + try!(self.ibox(INDENT_UNIT)); + try!(self.print_variant(v)); + try!(word(&mut self.s, ",")); + try!(self.end()); + try!(self.maybe_print_trailing_comment(v.span, None)); + } + self.bclose(span) + } + + pub fn print_visibility(&mut self, vis: &ast::Visibility) -> io::Result<()> { + match *vis { + ast::Visibility::Public => self.word_nbsp("pub"), + ast::Visibility::Crate(_) => self.word_nbsp("pub(crate)"), + ast::Visibility::Restricted { ref path, .. } => { + let path = to_string(|s| s.print_path(path, false, 0, true)); + self.word_nbsp(&format!("pub({})", path)) + } + ast::Visibility::Inherited => Ok(()) + } + } + + pub fn print_struct(&mut self, + struct_def: &ast::VariantData, + generics: &ast::Generics, + ident: ast::Ident, + span: syntax_pos::Span, + print_finalizer: bool) -> io::Result<()> { + try!(self.print_ident(ident)); + try!(self.print_generics(generics)); + if !struct_def.is_struct() { + if struct_def.is_tuple() { + try!(self.popen()); + try!(self.commasep( + Inconsistent, struct_def.fields(), + |s, field| { + try!(s.maybe_print_comment(field.span.lo)); + try!(s.print_outer_attributes(&field.attrs)); + try!(s.print_visibility(&field.vis)); + s.print_type(&field.ty) + } + )); + try!(self.pclose()); + } + try!(self.print_where_clause(&generics.where_clause)); + if print_finalizer { + try!(word(&mut self.s, ";")); + } + try!(self.end()); + self.end() // close the outer-box + } else { + try!(self.print_where_clause(&generics.where_clause)); + try!(self.nbsp()); + try!(self.bopen()); + try!(self.hardbreak_if_not_bol()); + + for field in struct_def.fields() { + try!(self.hardbreak_if_not_bol()); + try!(self.maybe_print_comment(field.span.lo)); + try!(self.print_outer_attributes(&field.attrs)); + try!(self.print_visibility(&field.vis)); + try!(self.print_ident(field.ident.unwrap())); + try!(self.word_nbsp(":")); + try!(self.print_type(&field.ty)); + try!(word(&mut self.s, ",")); + } + + self.bclose(span) + } + } + + /// This doesn't deserve to be called "pretty" printing, but it should be + /// meaning-preserving. A quick hack that might help would be to look at the + /// spans embedded in the TTs to decide where to put spaces and newlines. + /// But it'd be better to parse these according to the grammar of the + /// appropriate macro, transcribe back into the grammar we just parsed from, + /// and then pretty-print the resulting AST nodes (so, e.g., we print + /// expression arguments as expressions). It can be done! I think. + pub fn print_tt(&mut self, tt: &tokenstream::TokenTree) -> io::Result<()> { + match *tt { + TokenTree::Token(_, ref tk) => { + try!(word(&mut self.s, &token_to_string(tk))); + match *tk { + parse::token::DocComment(..) => { + hardbreak(&mut self.s) + } + _ => Ok(()) + } + } + TokenTree::Delimited(_, ref delimed) => { + try!(word(&mut self.s, &token_to_string(&delimed.open_token()))); + try!(space(&mut self.s)); + try!(self.print_tts(&delimed.tts)); + try!(space(&mut self.s)); + word(&mut self.s, &token_to_string(&delimed.close_token())) + }, + TokenTree::Sequence(_, ref seq) => { + try!(word(&mut self.s, "$(")); + for tt_elt in &seq.tts { + try!(self.print_tt(tt_elt)); + } + try!(word(&mut self.s, ")")); + if let Some(ref tk) = seq.separator { + try!(word(&mut self.s, &token_to_string(tk))); + } + match seq.op { + tokenstream::KleeneOp::ZeroOrMore => word(&mut self.s, "*"), + tokenstream::KleeneOp::OneOrMore => word(&mut self.s, "+"), + } + } + } + } + + pub fn print_tts(&mut self, tts: &[tokenstream::TokenTree]) -> io::Result<()> { + try!(self.ibox(0)); + for (i, tt) in tts.iter().enumerate() { + if i != 0 { + try!(space(&mut self.s)); + } + try!(self.print_tt(tt)); + } + self.end() + } + + pub fn print_variant(&mut self, v: &ast::Variant) -> io::Result<()> { + try!(self.head("")); + let generics = ast::Generics::default(); + try!(self.print_struct(&v.node.data, &generics, v.node.name, v.span, false)); + match v.node.disr_expr { + Some(ref d) => { + try!(space(&mut self.s)); + try!(self.word_space("=")); + self.print_expr(&d) + } + _ => Ok(()) + } + } + + pub fn print_method_sig(&mut self, + ident: ast::Ident, + m: &ast::MethodSig, + vis: &ast::Visibility) + -> io::Result<()> { + self.print_fn(&m.decl, + m.unsafety, + m.constness.node, + m.abi, + Some(ident), + &m.generics, + vis) + } + + pub fn print_trait_item(&mut self, ti: &ast::TraitItem) + -> io::Result<()> { + try!(self.ann.pre(self, NodeSubItem(ti.id))); + try!(self.hardbreak_if_not_bol()); + try!(self.maybe_print_comment(ti.span.lo)); + try!(self.print_outer_attributes(&ti.attrs)); + match ti.node { + ast::TraitItemKind::Const(ref ty, ref default) => { + try!(self.print_associated_const(ti.ident, &ty, + default.as_ref().map(|expr| &**expr), + &ast::Visibility::Inherited)); + } + ast::TraitItemKind::Method(ref sig, ref body) => { + if body.is_some() { + try!(self.head("")); + } + try!(self.print_method_sig(ti.ident, sig, &ast::Visibility::Inherited)); + if let Some(ref body) = *body { + try!(self.nbsp()); + try!(self.print_block_with_attrs(body, &ti.attrs)); + } else { + try!(word(&mut self.s, ";")); + } + } + ast::TraitItemKind::Type(ref bounds, ref default) => { + try!(self.print_associated_type(ti.ident, Some(bounds), + default.as_ref().map(|ty| &**ty))); + } + ast::TraitItemKind::Macro(codemap::Spanned { ref node, .. }) => { + // code copied from ItemKind::Mac: + try!(self.print_path(&node.path, false, 0, false)); + try!(word(&mut self.s, "! ")); + try!(self.cbox(INDENT_UNIT)); + try!(self.popen()); + try!(self.print_tts(&node.tts[..])); + try!(self.pclose()); + try!(word(&mut self.s, ";")); + try!(self.end()) + } + } + self.ann.post(self, NodeSubItem(ti.id)) + } + + pub fn print_impl_item(&mut self, ii: &ast::ImplItem) -> io::Result<()> { + try!(self.ann.pre(self, NodeSubItem(ii.id))); + try!(self.hardbreak_if_not_bol()); + try!(self.maybe_print_comment(ii.span.lo)); + try!(self.print_outer_attributes(&ii.attrs)); + if let ast::Defaultness::Default = ii.defaultness { + try!(self.word_nbsp("default")); + } + match ii.node { + ast::ImplItemKind::Const(ref ty, ref expr) => { + try!(self.print_associated_const(ii.ident, &ty, Some(&expr), &ii.vis)); + } + ast::ImplItemKind::Method(ref sig, ref body) => { + try!(self.head("")); + try!(self.print_method_sig(ii.ident, sig, &ii.vis)); + try!(self.nbsp()); + try!(self.print_block_with_attrs(body, &ii.attrs)); + } + ast::ImplItemKind::Type(ref ty) => { + try!(self.print_associated_type(ii.ident, None, Some(ty))); + } + ast::ImplItemKind::Macro(codemap::Spanned { ref node, .. }) => { + // code copied from ItemKind::Mac: + try!(self.print_path(&node.path, false, 0, false)); + try!(word(&mut self.s, "! ")); + try!(self.cbox(INDENT_UNIT)); + try!(self.popen()); + try!(self.print_tts(&node.tts[..])); + try!(self.pclose()); + try!(word(&mut self.s, ";")); + try!(self.end()) + } + } + self.ann.post(self, NodeSubItem(ii.id)) + } + + pub fn print_stmt(&mut self, st: &ast::Stmt) -> io::Result<()> { + try!(self.maybe_print_comment(st.span.lo)); + match st.node { + ast::StmtKind::Local(ref loc) => { + try!(self.print_outer_attributes(&loc.attrs)); + try!(self.space_if_not_bol()); + try!(self.ibox(INDENT_UNIT)); + try!(self.word_nbsp("let")); + + try!(self.ibox(INDENT_UNIT)); + try!(self.print_local_decl(&loc)); + try!(self.end()); + if let Some(ref init) = loc.init { + try!(self.nbsp()); + try!(self.word_space("=")); + try!(self.print_expr(&init)); + } + try!(word(&mut self.s, ";")); + try!(self.end()); + } + ast::StmtKind::Item(ref item) => try!(self.print_item(&item)), + ast::StmtKind::Expr(ref expr) => { + try!(self.space_if_not_bol()); + try!(self.print_expr_outer_attr_style(&expr, false)); + if parse::classify::expr_requires_semi_to_be_stmt(expr) { + try!(word(&mut self.s, ";")); + } + } + ast::StmtKind::Semi(ref expr) => { + try!(self.space_if_not_bol()); + try!(self.print_expr_outer_attr_style(&expr, false)); + try!(word(&mut self.s, ";")); + } + ast::StmtKind::Mac(ref mac) => { + let (ref mac, style, ref attrs) = **mac; + try!(self.space_if_not_bol()); + try!(self.print_outer_attributes(&attrs)); + let delim = match style { + ast::MacStmtStyle::Braces => token::Brace, + _ => token::Paren + }; + try!(self.print_mac(&mac, delim)); + if style == ast::MacStmtStyle::Semicolon { + try!(word(&mut self.s, ";")); + } + } + } + self.maybe_print_trailing_comment(st.span, None) + } + + pub fn print_block(&mut self, blk: &ast::Block) -> io::Result<()> { + self.print_block_with_attrs(blk, &[]) + } + + pub fn print_block_unclosed(&mut self, blk: &ast::Block) -> io::Result<()> { + self.print_block_unclosed_indent(blk, INDENT_UNIT) + } + + pub fn print_block_unclosed_with_attrs(&mut self, blk: &ast::Block, + attrs: &[ast::Attribute]) + -> io::Result<()> { + self.print_block_maybe_unclosed(blk, INDENT_UNIT, attrs, false) + } + + pub fn print_block_unclosed_indent(&mut self, blk: &ast::Block, + indented: usize) -> io::Result<()> { + self.print_block_maybe_unclosed(blk, indented, &[], false) + } + + pub fn print_block_with_attrs(&mut self, + blk: &ast::Block, + attrs: &[ast::Attribute]) -> io::Result<()> { + self.print_block_maybe_unclosed(blk, INDENT_UNIT, attrs, true) + } + + pub fn print_block_maybe_unclosed(&mut self, + blk: &ast::Block, + indented: usize, + attrs: &[ast::Attribute], + close_box: bool) -> io::Result<()> { + match blk.rules { + BlockCheckMode::Unsafe(..) => try!(self.word_space("unsafe")), + BlockCheckMode::Default => () + } + try!(self.maybe_print_comment(blk.span.lo)); + try!(self.ann.pre(self, NodeBlock(blk))); + try!(self.bopen()); + + try!(self.print_inner_attributes(attrs)); + + for (i, st) in blk.stmts.iter().enumerate() { + match st.node { + ast::StmtKind::Expr(ref expr) if i == blk.stmts.len() - 1 => { + try!(self.maybe_print_comment(st.span.lo)); + try!(self.space_if_not_bol()); + try!(self.print_expr_outer_attr_style(&expr, false)); + try!(self.maybe_print_trailing_comment(expr.span, Some(blk.span.hi))); + } + _ => try!(self.print_stmt(st)), + } + } + + try!(self.bclose_maybe_open(blk.span, indented, close_box)); + self.ann.post(self, NodeBlock(blk)) + } + + fn print_else(&mut self, els: Option<&ast::Expr>) -> io::Result<()> { + match els { + Some(_else) => { + match _else.node { + // "another else-if" + ast::ExprKind::If(ref i, ref then, ref e) => { + try!(self.cbox(INDENT_UNIT - 1)); + try!(self.ibox(0)); + try!(word(&mut self.s, " else if ")); + try!(self.print_expr(&i)); + try!(space(&mut self.s)); + try!(self.print_block(&then)); + self.print_else(e.as_ref().map(|e| &**e)) + } + // "another else-if-let" + ast::ExprKind::IfLet(ref pat, ref expr, ref then, ref e) => { + try!(self.cbox(INDENT_UNIT - 1)); + try!(self.ibox(0)); + try!(word(&mut self.s, " else if let ")); + try!(self.print_pat(&pat)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_expr(&expr)); + try!(space(&mut self.s)); + try!(self.print_block(&then)); + self.print_else(e.as_ref().map(|e| &**e)) + } + // "final else" + ast::ExprKind::Block(ref b) => { + try!(self.cbox(INDENT_UNIT - 1)); + try!(self.ibox(0)); + try!(word(&mut self.s, " else ")); + self.print_block(&b) + } + // BLEAH, constraints would be great here + _ => { + panic!("print_if saw if with weird alternative"); + } + } + } + _ => Ok(()) + } + } + + pub fn print_if(&mut self, test: &ast::Expr, blk: &ast::Block, + elseopt: Option<&ast::Expr>) -> io::Result<()> { + try!(self.head("if")); + try!(self.print_expr(test)); + try!(space(&mut self.s)); + try!(self.print_block(blk)); + self.print_else(elseopt) + } + + pub fn print_if_let(&mut self, pat: &ast::Pat, expr: &ast::Expr, blk: &ast::Block, + elseopt: Option<&ast::Expr>) -> io::Result<()> { + try!(self.head("if let")); + try!(self.print_pat(pat)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_expr(expr)); + try!(space(&mut self.s)); + try!(self.print_block(blk)); + self.print_else(elseopt) + } + + pub fn print_mac(&mut self, m: &ast::Mac, delim: token::DelimToken) + -> io::Result<()> { + try!(self.print_path(&m.node.path, false, 0, false)); + try!(word(&mut self.s, "!")); + match delim { + token::Paren => try!(self.popen()), + token::Bracket => try!(word(&mut self.s, "[")), + token::Brace => { + try!(self.head("")); + try!(self.bopen()); + } + token::NoDelim => {} + } + try!(self.print_tts(&m.node.tts)); + match delim { + token::Paren => self.pclose(), + token::Bracket => word(&mut self.s, "]"), + token::Brace => self.bclose(m.span), + token::NoDelim => Ok(()), + } + } + + + fn print_call_post(&mut self, args: &[P]) -> io::Result<()> { + try!(self.popen()); + try!(self.commasep_exprs(Inconsistent, args)); + self.pclose() + } + + pub fn check_expr_bin_needs_paren(&mut self, sub_expr: &ast::Expr, + binop: ast::BinOp) -> bool { + match sub_expr.node { + ast::ExprKind::Binary(ref sub_op, _, _) => { + if AssocOp::from_ast_binop(sub_op.node).precedence() < + AssocOp::from_ast_binop(binop.node).precedence() { + true + } else { + false + } + } + _ => true + } + } + + pub fn print_expr_maybe_paren(&mut self, expr: &ast::Expr) -> io::Result<()> { + let needs_par = needs_parentheses(expr); + if needs_par { + try!(self.popen()); + } + try!(self.print_expr(expr)); + if needs_par { + try!(self.pclose()); + } + Ok(()) + } + + fn print_expr_in_place(&mut self, + place: &ast::Expr, + expr: &ast::Expr) -> io::Result<()> { + try!(self.print_expr_maybe_paren(place)); + try!(space(&mut self.s)); + try!(self.word_space("<-")); + self.print_expr_maybe_paren(expr) + } + + fn print_expr_vec(&mut self, exprs: &[P], + attrs: &[Attribute]) -> io::Result<()> { + try!(self.ibox(INDENT_UNIT)); + try!(word(&mut self.s, "[")); + try!(self.print_inner_attributes_inline(attrs)); + try!(self.commasep_exprs(Inconsistent, &exprs[..])); + try!(word(&mut self.s, "]")); + self.end() + } + + fn print_expr_repeat(&mut self, + element: &ast::Expr, + count: &ast::Expr, + attrs: &[Attribute]) -> io::Result<()> { + try!(self.ibox(INDENT_UNIT)); + try!(word(&mut self.s, "[")); + try!(self.print_inner_attributes_inline(attrs)); + try!(self.print_expr(element)); + try!(self.word_space(";")); + try!(self.print_expr(count)); + try!(word(&mut self.s, "]")); + self.end() + } + + fn print_expr_struct(&mut self, + path: &ast::Path, + fields: &[ast::Field], + wth: &Option>, + attrs: &[Attribute]) -> io::Result<()> { + try!(self.print_path(path, true, 0, false)); + try!(word(&mut self.s, "{")); + try!(self.print_inner_attributes_inline(attrs)); + try!(self.commasep_cmnt( + Consistent, + &fields[..], + |s, field| { + try!(s.ibox(INDENT_UNIT)); + if !field.is_shorthand { + try!(s.print_ident(field.ident.node)); + try!(s.word_space(":")); + } + try!(s.print_expr(&field.expr)); + s.end() + }, + |f| f.span)); + match *wth { + Some(ref expr) => { + try!(self.ibox(INDENT_UNIT)); + if !fields.is_empty() { + try!(word(&mut self.s, ",")); + try!(space(&mut self.s)); + } + try!(word(&mut self.s, "..")); + try!(self.print_expr(&expr)); + try!(self.end()); + } + _ => if !fields.is_empty() { + try!(word(&mut self.s, ",")) + } + } + try!(word(&mut self.s, "}")); + Ok(()) + } + + fn print_expr_tup(&mut self, exprs: &[P], + attrs: &[Attribute]) -> io::Result<()> { + try!(self.popen()); + try!(self.print_inner_attributes_inline(attrs)); + try!(self.commasep_exprs(Inconsistent, &exprs[..])); + if exprs.len() == 1 { + try!(word(&mut self.s, ",")); + } + self.pclose() + } + + fn print_expr_call(&mut self, + func: &ast::Expr, + args: &[P]) -> io::Result<()> { + try!(self.print_expr_maybe_paren(func)); + self.print_call_post(args) + } + + fn print_expr_method_call(&mut self, + ident: ast::SpannedIdent, + tys: &[P], + args: &[P]) -> io::Result<()> { + let base_args = &args[1..]; + try!(self.print_expr(&args[0])); + try!(word(&mut self.s, ".")); + try!(self.print_ident(ident.node)); + if !tys.is_empty() { + try!(word(&mut self.s, "::<")); + try!(self.commasep(Inconsistent, tys, + |s, ty| s.print_type(&ty))); + try!(word(&mut self.s, ">")); + } + self.print_call_post(base_args) + } + + fn print_expr_binary(&mut self, + op: ast::BinOp, + lhs: &ast::Expr, + rhs: &ast::Expr) -> io::Result<()> { + if self.check_expr_bin_needs_paren(lhs, op) { + try!(self.print_expr_maybe_paren(lhs)); + } else { + try!(self.print_expr(lhs)); + } + try!(space(&mut self.s)); + try!(self.word_space(op.node.to_string())); + if self.check_expr_bin_needs_paren(rhs, op) { + self.print_expr_maybe_paren(rhs) + } else { + self.print_expr(rhs) + } + } + + fn print_expr_unary(&mut self, + op: ast::UnOp, + expr: &ast::Expr) -> io::Result<()> { + try!(word(&mut self.s, ast::UnOp::to_string(op))); + self.print_expr_maybe_paren(expr) + } + + fn print_expr_addr_of(&mut self, + mutability: ast::Mutability, + expr: &ast::Expr) -> io::Result<()> { + try!(word(&mut self.s, "&")); + try!(self.print_mutability(mutability)); + self.print_expr_maybe_paren(expr) + } + + pub fn print_expr(&mut self, expr: &ast::Expr) -> io::Result<()> { + self.print_expr_outer_attr_style(expr, true) + } + + fn print_expr_outer_attr_style(&mut self, + expr: &ast::Expr, + is_inline: bool) -> io::Result<()> { + try!(self.maybe_print_comment(expr.span.lo)); + + let attrs = &expr.attrs; + if is_inline { + try!(self.print_outer_attributes_inline(attrs)); + } else { + try!(self.print_outer_attributes(attrs)); + } + + try!(self.ibox(INDENT_UNIT)); + try!(self.ann.pre(self, NodeExpr(expr))); + match expr.node { + ast::ExprKind::Box(ref expr) => { + try!(self.word_space("box")); + try!(self.print_expr(expr)); + } + ast::ExprKind::InPlace(ref place, ref expr) => { + try!(self.print_expr_in_place(place, expr)); + } + ast::ExprKind::Vec(ref exprs) => { + try!(self.print_expr_vec(&exprs[..], attrs)); + } + ast::ExprKind::Repeat(ref element, ref count) => { + try!(self.print_expr_repeat(&element, &count, attrs)); + } + ast::ExprKind::Struct(ref path, ref fields, ref wth) => { + try!(self.print_expr_struct(path, &fields[..], wth, attrs)); + } + ast::ExprKind::Tup(ref exprs) => { + try!(self.print_expr_tup(&exprs[..], attrs)); + } + ast::ExprKind::Call(ref func, ref args) => { + try!(self.print_expr_call(&func, &args[..])); + } + ast::ExprKind::MethodCall(ident, ref tys, ref args) => { + try!(self.print_expr_method_call(ident, &tys[..], &args[..])); + } + ast::ExprKind::Binary(op, ref lhs, ref rhs) => { + try!(self.print_expr_binary(op, &lhs, &rhs)); + } + ast::ExprKind::Unary(op, ref expr) => { + try!(self.print_expr_unary(op, &expr)); + } + ast::ExprKind::AddrOf(m, ref expr) => { + try!(self.print_expr_addr_of(m, &expr)); + } + ast::ExprKind::Lit(ref lit) => { + try!(self.print_literal(&lit)); + } + ast::ExprKind::Cast(ref expr, ref ty) => { + if let ast::ExprKind::Cast(..) = expr.node { + try!(self.print_expr(&expr)); + } else { + try!(self.print_expr_maybe_paren(&expr)); + } + try!(space(&mut self.s)); + try!(self.word_space("as")); + try!(self.print_type(&ty)); + } + ast::ExprKind::Type(ref expr, ref ty) => { + try!(self.print_expr(&expr)); + try!(self.word_space(":")); + try!(self.print_type(&ty)); + } + ast::ExprKind::If(ref test, ref blk, ref elseopt) => { + try!(self.print_if(&test, &blk, elseopt.as_ref().map(|e| &**e))); + } + ast::ExprKind::IfLet(ref pat, ref expr, ref blk, ref elseopt) => { + try!(self.print_if_let(&pat, &expr, &blk, elseopt.as_ref().map(|e| &**e))); + } + ast::ExprKind::While(ref test, ref blk, opt_ident) => { + if let Some(ident) = opt_ident { + try!(self.print_ident(ident.node)); + try!(self.word_space(":")); + } + try!(self.head("while")); + try!(self.print_expr(&test)); + try!(space(&mut self.s)); + try!(self.print_block_with_attrs(&blk, attrs)); + } + ast::ExprKind::WhileLet(ref pat, ref expr, ref blk, opt_ident) => { + if let Some(ident) = opt_ident { + try!(self.print_ident(ident.node)); + try!(self.word_space(":")); + } + try!(self.head("while let")); + try!(self.print_pat(&pat)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_expr(&expr)); + try!(space(&mut self.s)); + try!(self.print_block_with_attrs(&blk, attrs)); + } + ast::ExprKind::ForLoop(ref pat, ref iter, ref blk, opt_ident) => { + if let Some(ident) = opt_ident { + try!(self.print_ident(ident.node)); + try!(self.word_space(":")); + } + try!(self.head("for")); + try!(self.print_pat(&pat)); + try!(space(&mut self.s)); + try!(self.word_space("in")); + try!(self.print_expr(&iter)); + try!(space(&mut self.s)); + try!(self.print_block_with_attrs(&blk, attrs)); + } + ast::ExprKind::Loop(ref blk, opt_ident) => { + if let Some(ident) = opt_ident { + try!(self.print_ident(ident.node)); + try!(self.word_space(":")); + } + try!(self.head("loop")); + try!(space(&mut self.s)); + try!(self.print_block_with_attrs(&blk, attrs)); + } + ast::ExprKind::Match(ref expr, ref arms) => { + try!(self.cbox(INDENT_UNIT)); + try!(self.ibox(4)); + try!(self.word_nbsp("match")); + try!(self.print_expr(&expr)); + try!(space(&mut self.s)); + try!(self.bopen()); + try!(self.print_inner_attributes_no_trailing_hardbreak(attrs)); + for arm in arms { + try!(self.print_arm(arm)); + } + try!(self.bclose_(expr.span, INDENT_UNIT)); + } + ast::ExprKind::Closure(capture_clause, ref decl, ref body, _) => { + try!(self.print_capture_clause(capture_clause)); + + try!(self.print_fn_block_args(&decl)); + try!(space(&mut self.s)); + try!(self.print_expr(body)); + try!(self.end()); // need to close a box + + // a box will be closed by print_expr, but we didn't want an overall + // wrapper so we closed the corresponding opening. so create an + // empty box to satisfy the close. + try!(self.ibox(0)); + } + ast::ExprKind::Block(ref blk) => { + // containing cbox, will be closed by print-block at } + try!(self.cbox(INDENT_UNIT)); + // head-box, will be closed by print-block after { + try!(self.ibox(0)); + try!(self.print_block_with_attrs(&blk, attrs)); + } + ast::ExprKind::Assign(ref lhs, ref rhs) => { + try!(self.print_expr(&lhs)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_expr(&rhs)); + } + ast::ExprKind::AssignOp(op, ref lhs, ref rhs) => { + try!(self.print_expr(&lhs)); + try!(space(&mut self.s)); + try!(word(&mut self.s, op.node.to_string())); + try!(self.word_space("=")); + try!(self.print_expr(&rhs)); + } + ast::ExprKind::Field(ref expr, id) => { + try!(self.print_expr(&expr)); + try!(word(&mut self.s, ".")); + try!(self.print_ident(id.node)); + } + ast::ExprKind::TupField(ref expr, id) => { + try!(self.print_expr(&expr)); + try!(word(&mut self.s, ".")); + try!(self.print_usize(id.node)); + } + ast::ExprKind::Index(ref expr, ref index) => { + try!(self.print_expr(&expr)); + try!(word(&mut self.s, "[")); + try!(self.print_expr(&index)); + try!(word(&mut self.s, "]")); + } + ast::ExprKind::Range(ref start, ref end, limits) => { + if let &Some(ref e) = start { + try!(self.print_expr(&e)); + } + if limits == ast::RangeLimits::HalfOpen { + try!(word(&mut self.s, "..")); + } else { + try!(word(&mut self.s, "...")); + } + if let &Some(ref e) = end { + try!(self.print_expr(&e)); + } + } + ast::ExprKind::Path(None, ref path) => { + try!(self.print_path(path, true, 0, false)) + } + ast::ExprKind::Path(Some(ref qself), ref path) => { + try!(self.print_qpath(path, qself, true)) + } + ast::ExprKind::Break(opt_ident, ref opt_expr) => { + try!(word(&mut self.s, "break")); + try!(space(&mut self.s)); + if let Some(ident) = opt_ident { + try!(self.print_ident(ident.node)); + try!(space(&mut self.s)); + } + if let Some(ref expr) = *opt_expr { + try!(self.print_expr(expr)); + try!(space(&mut self.s)); + } + } + ast::ExprKind::Continue(opt_ident) => { + try!(word(&mut self.s, "continue")); + try!(space(&mut self.s)); + if let Some(ident) = opt_ident { + try!(self.print_ident(ident.node)); + try!(space(&mut self.s)) + } + } + ast::ExprKind::Ret(ref result) => { + try!(word(&mut self.s, "return")); + match *result { + Some(ref expr) => { + try!(word(&mut self.s, " ")); + try!(self.print_expr(&expr)); + } + _ => () + } + } + ast::ExprKind::InlineAsm(ref a) => { + try!(word(&mut self.s, "asm!")); + try!(self.popen()); + try!(self.print_string(&a.asm.as_str(), a.asm_str_style)); + try!(self.word_space(":")); + + try!(self.commasep(Inconsistent, &a.outputs, |s, out| { + let constraint = out.constraint.as_str(); + let mut ch = constraint.chars(); + match ch.next() { + Some('=') if out.is_rw => { + try!(s.print_string(&format!("+{}", ch.as_str()), + ast::StrStyle::Cooked)) + } + _ => try!(s.print_string(&constraint, ast::StrStyle::Cooked)) + } + try!(s.popen()); + try!(s.print_expr(&out.expr)); + try!(s.pclose()); + Ok(()) + })); + try!(space(&mut self.s)); + try!(self.word_space(":")); + + try!(self.commasep(Inconsistent, &a.inputs, |s, &(co, ref o)| { + try!(s.print_string(&co.as_str(), ast::StrStyle::Cooked)); + try!(s.popen()); + try!(s.print_expr(&o)); + try!(s.pclose()); + Ok(()) + })); + try!(space(&mut self.s)); + try!(self.word_space(":")); + + try!(self.commasep(Inconsistent, &a.clobbers, + |s, co| { + try!(s.print_string(&co.as_str(), ast::StrStyle::Cooked)); + Ok(()) + })); + + let mut options = vec![]; + if a.volatile { + options.push("volatile"); + } + if a.alignstack { + options.push("alignstack"); + } + if a.dialect == ast::AsmDialect::Intel { + options.push("intel"); + } + + if !options.is_empty() { + try!(space(&mut self.s)); + try!(self.word_space(":")); + try!(self.commasep(Inconsistent, &options, + |s, &co| { + try!(s.print_string(co, ast::StrStyle::Cooked)); + Ok(()) + })); + } + + try!(self.pclose()); + } + ast::ExprKind::Mac(ref m) => try!(self.print_mac(m, token::Paren)), + ast::ExprKind::Paren(ref e) => { + try!(self.popen()); + try!(self.print_inner_attributes_inline(attrs)); + try!(self.print_expr(&e)); + try!(self.pclose()); + }, + ast::ExprKind::Try(ref e) => { + try!(self.print_expr(e)); + try!(word(&mut self.s, "?")) + } + } + try!(self.ann.post(self, NodeExpr(expr))); + self.end() + } + + pub fn print_local_decl(&mut self, loc: &ast::Local) -> io::Result<()> { + try!(self.print_pat(&loc.pat)); + if let Some(ref ty) = loc.ty { + try!(self.word_space(":")); + try!(self.print_type(&ty)); + } + Ok(()) + } + + pub fn print_ident(&mut self, ident: ast::Ident) -> io::Result<()> { + try!(word(&mut self.s, &ident.name.as_str())); + self.ann.post(self, NodeIdent(&ident)) + } + + pub fn print_usize(&mut self, i: usize) -> io::Result<()> { + word(&mut self.s, &i.to_string()) + } + + pub fn print_name(&mut self, name: ast::Name) -> io::Result<()> { + try!(word(&mut self.s, &name.as_str())); + self.ann.post(self, NodeName(&name)) + } + + pub fn print_for_decl(&mut self, loc: &ast::Local, + coll: &ast::Expr) -> io::Result<()> { + try!(self.print_local_decl(loc)); + try!(space(&mut self.s)); + try!(self.word_space("in")); + self.print_expr(coll) + } + + fn print_path(&mut self, + path: &ast::Path, + colons_before_params: bool, + depth: usize, + defaults_to_global: bool) + -> io::Result<()> + { + try!(self.maybe_print_comment(path.span.lo)); + + let mut segments = path.segments[..path.segments.len()-depth].iter(); + if defaults_to_global && path.is_global() { + segments.next(); + } + for (i, segment) in segments.enumerate() { + if i > 0 { + try!(word(&mut self.s, "::")) + } + if segment.identifier.name != keywords::CrateRoot.name() && + segment.identifier.name != "$crate" { + try!(self.print_ident(segment.identifier)); + if let Some(ref parameters) = segment.parameters { + try!(self.print_path_parameters(parameters, colons_before_params)); + } + } + } + + Ok(()) + } + + fn print_qpath(&mut self, + path: &ast::Path, + qself: &ast::QSelf, + colons_before_params: bool) + -> io::Result<()> + { + try!(word(&mut self.s, "<")); + try!(self.print_type(&qself.ty)); + if qself.position > 0 { + try!(space(&mut self.s)); + try!(self.word_space("as")); + let depth = path.segments.len() - qself.position; + try!(self.print_path(&path, false, depth, false)); + } + try!(word(&mut self.s, ">")); + try!(word(&mut self.s, "::")); + let item_segment = path.segments.last().unwrap(); + try!(self.print_ident(item_segment.identifier)); + match item_segment.parameters { + Some(ref parameters) => self.print_path_parameters(parameters, colons_before_params), + None => Ok(()), + } + } + + fn print_path_parameters(&mut self, + parameters: &ast::PathParameters, + colons_before_params: bool) + -> io::Result<()> + { + if colons_before_params { + try!(word(&mut self.s, "::")) + } + + match *parameters { + ast::PathParameters::AngleBracketed(ref data) => { + try!(word(&mut self.s, "<")); + + let mut comma = false; + for lifetime in &data.lifetimes { + if comma { + try!(self.word_space(",")) + } + try!(self.print_lifetime(lifetime)); + comma = true; + } + + if !data.types.is_empty() { + if comma { + try!(self.word_space(",")) + } + try!(self.commasep( + Inconsistent, + &data.types, + |s, ty| s.print_type(&ty))); + comma = true; + } + + for binding in data.bindings.iter() { + if comma { + try!(self.word_space(",")) + } + try!(self.print_ident(binding.ident)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_type(&binding.ty)); + comma = true; + } + + try!(word(&mut self.s, ">")) + } + + ast::PathParameters::Parenthesized(ref data) => { + try!(word(&mut self.s, "(")); + try!(self.commasep( + Inconsistent, + &data.inputs, + |s, ty| s.print_type(&ty))); + try!(word(&mut self.s, ")")); + + if let Some(ref ty) = data.output { + try!(self.space_if_not_bol()); + try!(self.word_space("->")); + try!(self.print_type(&ty)); + } + } + } + + Ok(()) + } + + pub fn print_pat(&mut self, pat: &ast::Pat) -> io::Result<()> { + try!(self.maybe_print_comment(pat.span.lo)); + try!(self.ann.pre(self, NodePat(pat))); + /* Pat isn't normalized, but the beauty of it + is that it doesn't matter */ + match pat.node { + PatKind::Wild => try!(word(&mut self.s, "_")), + PatKind::Ident(binding_mode, ref path1, ref sub) => { + match binding_mode { + ast::BindingMode::ByRef(mutbl) => { + try!(self.word_nbsp("ref")); + try!(self.print_mutability(mutbl)); + } + ast::BindingMode::ByValue(ast::Mutability::Immutable) => {} + ast::BindingMode::ByValue(ast::Mutability::Mutable) => { + try!(self.word_nbsp("mut")); + } + } + try!(self.print_ident(path1.node)); + if let Some(ref p) = *sub { + try!(word(&mut self.s, "@")); + try!(self.print_pat(&p)); + } + } + PatKind::TupleStruct(ref path, ref elts, ddpos) => { + try!(self.print_path(path, true, 0, false)); + try!(self.popen()); + if let Some(ddpos) = ddpos { + try!(self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p))); + if ddpos != 0 { + try!(self.word_space(",")); + } + try!(word(&mut self.s, "..")); + if ddpos != elts.len() { + try!(word(&mut self.s, ",")); + try!(self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))); + } + } else { + try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))); + } + try!(self.pclose()); + } + PatKind::Path(None, ref path) => { + try!(self.print_path(path, true, 0, false)); + } + PatKind::Path(Some(ref qself), ref path) => { + try!(self.print_qpath(path, qself, false)); + } + PatKind::Struct(ref path, ref fields, etc) => { + try!(self.print_path(path, true, 0, false)); + try!(self.nbsp()); + try!(self.word_space("{")); + try!(self.commasep_cmnt( + Consistent, &fields[..], + |s, f| { + try!(s.cbox(INDENT_UNIT)); + if !f.node.is_shorthand { + try!(s.print_ident(f.node.ident)); + try!(s.word_nbsp(":")); + } + try!(s.print_pat(&f.node.pat)); + s.end() + }, + |f| f.node.pat.span)); + if etc { + if !fields.is_empty() { try!(self.word_space(",")); } + try!(word(&mut self.s, "..")); + } + try!(space(&mut self.s)); + try!(word(&mut self.s, "}")); + } + PatKind::Tuple(ref elts, ddpos) => { + try!(self.popen()); + if let Some(ddpos) = ddpos { + try!(self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p))); + if ddpos != 0 { + try!(self.word_space(",")); + } + try!(word(&mut self.s, "..")); + if ddpos != elts.len() { + try!(word(&mut self.s, ",")); + try!(self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))); + } + } else { + try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))); + if elts.len() == 1 { + try!(word(&mut self.s, ",")); + } + } + try!(self.pclose()); + } + PatKind::Box(ref inner) => { + try!(word(&mut self.s, "box ")); + try!(self.print_pat(&inner)); + } + PatKind::Ref(ref inner, mutbl) => { + try!(word(&mut self.s, "&")); + if mutbl == ast::Mutability::Mutable { + try!(word(&mut self.s, "mut ")); + } + try!(self.print_pat(&inner)); + } + PatKind::Lit(ref e) => try!(self.print_expr(&**e)), + PatKind::Range(ref begin, ref end) => { + try!(self.print_expr(&begin)); + try!(space(&mut self.s)); + try!(word(&mut self.s, "...")); + try!(self.print_expr(&end)); + } + PatKind::Slice(ref before, ref slice, ref after) => { + try!(word(&mut self.s, "[")); + try!(self.commasep(Inconsistent, + &before[..], + |s, p| s.print_pat(&p))); + if let Some(ref p) = *slice { + if !before.is_empty() { try!(self.word_space(",")); } + if p.node != PatKind::Wild { + try!(self.print_pat(&p)); + } + try!(word(&mut self.s, "..")); + if !after.is_empty() { try!(self.word_space(",")); } + } + try!(self.commasep(Inconsistent, + &after[..], + |s, p| s.print_pat(&p))); + try!(word(&mut self.s, "]")); + } + PatKind::Mac(ref m) => try!(self.print_mac(m, token::Paren)), + } + self.ann.post(self, NodePat(pat)) + } + + fn print_arm(&mut self, arm: &ast::Arm) -> io::Result<()> { + // I have no idea why this check is necessary, but here it + // is :( + if arm.attrs.is_empty() { + try!(space(&mut self.s)); + } + try!(self.cbox(INDENT_UNIT)); + try!(self.ibox(0)); + try!(self.maybe_print_comment(arm.pats[0].span.lo)); + try!(self.print_outer_attributes(&arm.attrs)); + let mut first = true; + for p in &arm.pats { + if first { + first = false; + } else { + try!(space(&mut self.s)); + try!(self.word_space("|")); + } + try!(self.print_pat(&p)); + } + try!(space(&mut self.s)); + if let Some(ref e) = arm.guard { + try!(self.word_space("if")); + try!(self.print_expr(&e)); + try!(space(&mut self.s)); + } + try!(self.word_space("=>")); + + match arm.body.node { + ast::ExprKind::Block(ref blk) => { + // the block will close the pattern's ibox + try!(self.print_block_unclosed_indent(&blk, INDENT_UNIT)); + + // If it is a user-provided unsafe block, print a comma after it + if let BlockCheckMode::Unsafe(ast::UserProvided) = blk.rules { + try!(word(&mut self.s, ",")); + } + } + _ => { + try!(self.end()); // close the ibox for the pattern + try!(self.print_expr(&arm.body)); + try!(word(&mut self.s, ",")); + } + } + self.end() // close enclosing cbox + } + + fn print_explicit_self(&mut self, explicit_self: &ast::ExplicitSelf) -> io::Result<()> { + match explicit_self.node { + SelfKind::Value(m) => { + try!(self.print_mutability(m)); + word(&mut self.s, "self") + } + SelfKind::Region(ref lt, m) => { + try!(word(&mut self.s, "&")); + try!(self.print_opt_lifetime(lt)); + try!(self.print_mutability(m)); + word(&mut self.s, "self") + } + SelfKind::Explicit(ref typ, m) => { + try!(self.print_mutability(m)); + try!(word(&mut self.s, "self")); + try!(self.word_space(":")); + self.print_type(&typ) + } + } + } + + pub fn print_fn(&mut self, + decl: &ast::FnDecl, + unsafety: ast::Unsafety, + constness: ast::Constness, + abi: abi::Abi, + name: Option, + generics: &ast::Generics, + vis: &ast::Visibility) -> io::Result<()> { + try!(self.print_fn_header_info(unsafety, constness, abi, vis)); + + if let Some(name) = name { + try!(self.nbsp()); + try!(self.print_ident(name)); + } + try!(self.print_generics(generics)); + try!(self.print_fn_args_and_ret(decl)); + self.print_where_clause(&generics.where_clause) + } + + pub fn print_fn_args_and_ret(&mut self, decl: &ast::FnDecl) + -> io::Result<()> { + try!(self.popen()); + try!(self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false))); + if decl.variadic { + try!(word(&mut self.s, ", ...")); + } + try!(self.pclose()); + + self.print_fn_output(decl) + } + + pub fn print_fn_block_args( + &mut self, + decl: &ast::FnDecl) + -> io::Result<()> { + try!(word(&mut self.s, "|")); + try!(self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, true))); + try!(word(&mut self.s, "|")); + + if let ast::FunctionRetTy::Default(..) = decl.output { + return Ok(()); + } + + try!(self.space_if_not_bol()); + try!(self.word_space("->")); + match decl.output { + ast::FunctionRetTy::Ty(ref ty) => { + try!(self.print_type(&ty)); + self.maybe_print_comment(ty.span.lo) + } + ast::FunctionRetTy::Default(..) => unreachable!(), + } + } + + pub fn print_capture_clause(&mut self, capture_clause: ast::CaptureBy) + -> io::Result<()> { + match capture_clause { + ast::CaptureBy::Value => self.word_space("move"), + ast::CaptureBy::Ref => Ok(()), + } + } + + pub fn print_bounds(&mut self, + prefix: &str, + bounds: &[ast::TyParamBound]) + -> io::Result<()> { + if !bounds.is_empty() { + try!(word(&mut self.s, prefix)); + let mut first = true; + for bound in bounds { + try!(self.nbsp()); + if first { + first = false; + } else { + try!(self.word_space("+")); + } + + try!(match *bound { + TraitTyParamBound(ref tref, TraitBoundModifier::None) => { + self.print_poly_trait_ref(tref) + } + TraitTyParamBound(ref tref, TraitBoundModifier::Maybe) => { + try!(word(&mut self.s, "?")); + self.print_poly_trait_ref(tref) + } + RegionTyParamBound(ref lt) => { + self.print_lifetime(lt) + } + }) + } + Ok(()) + } else { + Ok(()) + } + } + + pub fn print_lifetime(&mut self, + lifetime: &ast::Lifetime) + -> io::Result<()> + { + self.print_name(lifetime.name) + } + + pub fn print_lifetime_bounds(&mut self, + lifetime: &ast::Lifetime, + bounds: &[ast::Lifetime]) + -> io::Result<()> + { + try!(self.print_lifetime(lifetime)); + if !bounds.is_empty() { + try!(word(&mut self.s, ": ")); + for (i, bound) in bounds.iter().enumerate() { + if i != 0 { + try!(word(&mut self.s, " + ")); + } + try!(self.print_lifetime(bound)); + } + } + Ok(()) + } + + pub fn print_generics(&mut self, + generics: &ast::Generics) + -> io::Result<()> + { + let total = generics.lifetimes.len() + generics.ty_params.len(); + if total == 0 { + return Ok(()); + } + + try!(word(&mut self.s, "<")); + + let mut ints = Vec::new(); + for i in 0..total { + ints.push(i); + } + + try!(self.commasep(Inconsistent, &ints[..], |s, &idx| { + if idx < generics.lifetimes.len() { + let lifetime_def = &generics.lifetimes[idx]; + try!(s.print_outer_attributes_inline(&lifetime_def.attrs)); + s.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds) + } else { + let idx = idx - generics.lifetimes.len(); + let param = &generics.ty_params[idx]; + s.print_ty_param(param) + } + })); + + try!(word(&mut self.s, ">")); + Ok(()) + } + + pub fn print_ty_param(&mut self, param: &ast::TyParam) -> io::Result<()> { + try!(self.print_outer_attributes_inline(¶m.attrs)); + try!(self.print_ident(param.ident)); + try!(self.print_bounds(":", ¶m.bounds)); + match param.default { + Some(ref default) => { + try!(space(&mut self.s)); + try!(self.word_space("=")); + self.print_type(&default) + } + _ => Ok(()) + } + } + + pub fn print_where_clause(&mut self, where_clause: &ast::WhereClause) + -> io::Result<()> { + if where_clause.predicates.is_empty() { + return Ok(()) + } + + try!(space(&mut self.s)); + try!(self.word_space("where")); + + for (i, predicate) in where_clause.predicates.iter().enumerate() { + if i != 0 { + try!(self.word_space(",")); + } + + match *predicate { + ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{ref bound_lifetimes, + ref bounded_ty, + ref bounds, + ..}) => { + try!(self.print_formal_lifetime_list(bound_lifetimes)); + try!(self.print_type(&bounded_ty)); + try!(self.print_bounds(":", bounds)); + } + ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime, + ref bounds, + ..}) => { + try!(self.print_lifetime_bounds(lifetime, bounds)); + } + ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => { + try!(self.print_path(path, false, 0, false)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_type(&ty)); + } + } + } + + Ok(()) + } + + pub fn print_view_path(&mut self, vp: &ast::ViewPath) -> io::Result<()> { + match vp.node { + ast::ViewPathSimple(ident, ref path) => { + try!(self.print_path(path, false, 0, true)); + + if path.segments.last().unwrap().identifier.name != + ident.name { + try!(space(&mut self.s)); + try!(self.word_space("as")); + try!(self.print_ident(ident)); + } + + Ok(()) + } + + ast::ViewPathGlob(ref path) => { + try!(self.print_path(path, false, 0, true)); + word(&mut self.s, "::*") + } + + ast::ViewPathList(ref path, ref idents) => { + if path.segments.is_empty() { + try!(word(&mut self.s, "{")); + } else { + try!(self.print_path(path, false, 0, true)); + try!(word(&mut self.s, "::{")); + } + try!(self.commasep(Inconsistent, &idents[..], |s, w| { + try!(s.print_ident(w.node.name)); + if let Some(ident) = w.node.rename { + try!(space(&mut s.s)); + try!(s.word_space("as")); + try!(s.print_ident(ident)); + } + Ok(()) + })); + word(&mut self.s, "}") + } + } + } + + pub fn print_mutability(&mut self, + mutbl: ast::Mutability) -> io::Result<()> { + match mutbl { + ast::Mutability::Mutable => self.word_nbsp("mut"), + ast::Mutability::Immutable => Ok(()), + } + } + + pub fn print_mt(&mut self, mt: &ast::MutTy) -> io::Result<()> { + try!(self.print_mutability(mt.mutbl)); + self.print_type(&mt.ty) + } + + pub fn print_arg(&mut self, input: &ast::Arg, is_closure: bool) -> io::Result<()> { + try!(self.ibox(INDENT_UNIT)); + match input.ty.node { + ast::TyKind::Infer if is_closure => try!(self.print_pat(&input.pat)), + _ => { + if let Some(eself) = input.to_self() { + try!(self.print_explicit_self(&eself)); + } else { + let invalid = if let PatKind::Ident(_, ident, _) = input.pat.node { + ident.node.name == keywords::Invalid.name() + } else { + false + }; + if !invalid { + try!(self.print_pat(&input.pat)); + try!(word(&mut self.s, ":")); + try!(space(&mut self.s)); + } + try!(self.print_type(&input.ty)); + } + } + } + self.end() + } + + pub fn print_fn_output(&mut self, decl: &ast::FnDecl) -> io::Result<()> { + if let ast::FunctionRetTy::Default(..) = decl.output { + return Ok(()); + } + + try!(self.space_if_not_bol()); + try!(self.ibox(INDENT_UNIT)); + try!(self.word_space("->")); + match decl.output { + ast::FunctionRetTy::Default(..) => unreachable!(), + ast::FunctionRetTy::Ty(ref ty) => + try!(self.print_type(&ty)) + } + try!(self.end()); + + match decl.output { + ast::FunctionRetTy::Ty(ref output) => self.maybe_print_comment(output.span.lo), + _ => Ok(()) + } + } + + pub fn print_ty_fn(&mut self, + abi: abi::Abi, + unsafety: ast::Unsafety, + decl: &ast::FnDecl, + name: Option, + generics: &ast::Generics) + -> io::Result<()> { + try!(self.ibox(INDENT_UNIT)); + if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() { + try!(word(&mut self.s, "for")); + try!(self.print_generics(generics)); + } + let generics = ast::Generics { + lifetimes: Vec::new(), + ty_params: P::new(), + where_clause: ast::WhereClause { + id: ast::DUMMY_NODE_ID, + predicates: Vec::new(), + }, + span: syntax_pos::DUMMY_SP, + }; + try!(self.print_fn(decl, + unsafety, + ast::Constness::NotConst, + abi, + name, + &generics, + &ast::Visibility::Inherited)); + self.end() + } + + pub fn maybe_print_trailing_comment(&mut self, span: syntax_pos::Span, + next_pos: Option) + -> io::Result<()> { + let cm = match self.cm { + Some(cm) => cm, + _ => return Ok(()) + }; + if let Some(ref cmnt) = self.next_comment() { + if cmnt.style != comments::Trailing { return Ok(()) } + let span_line = cm.lookup_char_pos(span.hi); + let comment_line = cm.lookup_char_pos(cmnt.pos); + let next = next_pos.unwrap_or(cmnt.pos + BytePos(1)); + if span.hi < cmnt.pos && cmnt.pos < next && span_line.line == comment_line.line { + try!(self.print_comment(cmnt)); + self.cur_cmnt_and_lit.cur_cmnt += 1; + } + } + Ok(()) + } + + pub fn print_remaining_comments(&mut self) -> io::Result<()> { + // If there aren't any remaining comments, then we need to manually + // make sure there is a line break at the end. + if self.next_comment().is_none() { + try!(hardbreak(&mut self.s)); + } + loop { + match self.next_comment() { + Some(ref cmnt) => { + try!(self.print_comment(cmnt)); + self.cur_cmnt_and_lit.cur_cmnt += 1; + } + _ => break + } + } + Ok(()) + } + + pub fn print_opt_abi_and_extern_if_nondefault(&mut self, + opt_abi: Option) + -> io::Result<()> { + match opt_abi { + Some(Abi::Rust) => Ok(()), + Some(abi) => { + try!(self.word_nbsp("extern")); + self.word_nbsp(&abi.to_string()) + } + None => Ok(()) + } + } + + pub fn print_extern_opt_abi(&mut self, + opt_abi: Option) -> io::Result<()> { + match opt_abi { + Some(abi) => { + try!(self.word_nbsp("extern")); + self.word_nbsp(&abi.to_string()) + } + None => Ok(()) + } + } + + pub fn print_fn_header_info(&mut self, + unsafety: ast::Unsafety, + constness: ast::Constness, + abi: Abi, + vis: &ast::Visibility) -> io::Result<()> { + try!(word(&mut self.s, &visibility_qualified(vis, ""))); + + match constness { + ast::Constness::NotConst => {} + ast::Constness::Const => try!(self.word_nbsp("const")) + } + + try!(self.print_unsafety(unsafety)); + + if abi != Abi::Rust { + try!(self.word_nbsp("extern")); + try!(self.word_nbsp(&abi.to_string())); + } + + word(&mut self.s, "fn") + } + + pub fn print_unsafety(&mut self, s: ast::Unsafety) -> io::Result<()> { + match s { + ast::Unsafety::Normal => Ok(()), + ast::Unsafety::Unsafe => self.word_nbsp("unsafe"), + } + } +} + +fn repeat(s: &str, n: usize) -> String { iter::repeat(s).take(n).collect() } + +#[cfg(test)] +mod tests { + use super::*; + + use ast; + use codemap; + use syntax_pos; + + #[test] + fn test_fun_to_string() { + let abba_ident = ast::Ident::from_str("abba"); + + let decl = ast::FnDecl { + inputs: Vec::new(), + output: ast::FunctionRetTy::Default(syntax_pos::DUMMY_SP), + variadic: false + }; + let generics = ast::Generics::default(); + assert_eq!(fun_to_string(&decl, ast::Unsafety::Normal, + ast::Constness::NotConst, + abba_ident, &generics), + "fn abba()"); + } + + #[test] + fn test_variant_to_string() { + let ident = ast::Ident::from_str("principal_skinner"); + + let var = codemap::respan(syntax_pos::DUMMY_SP, ast::Variant_ { + name: ident, + attrs: Vec::new(), + // making this up as I go.... ? + data: ast::VariantData::Unit(ast::DUMMY_NODE_ID), + disr_expr: None, + }); + + let varstr = variant_to_string(&var); + assert_eq!(varstr, "principal_skinner"); + } +} diff --git a/third_party/rust/syntex_syntax/src/ptr.rs b/third_party/rust/syntex_syntax/src/ptr.rs new file mode 100644 index 000000000000..587501589314 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/ptr.rs @@ -0,0 +1,217 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The AST pointer +//! +//! Provides `P`, a frozen owned smart pointer, as a replacement for `@T` in +//! the AST. +//! +//! # Motivations and benefits +//! +//! * **Identity**: sharing AST nodes is problematic for the various analysis +//! passes (e.g. one may be able to bypass the borrow checker with a shared +//! `ExprKind::AddrOf` node taking a mutable borrow). The only reason `@T` in the +//! AST hasn't caused issues is because of inefficient folding passes which +//! would always deduplicate any such shared nodes. Even if the AST were to +//! switch to an arena, this would still hold, i.e. it couldn't use `&'a T`, +//! but rather a wrapper like `P<'a, T>`. +//! +//! * **Immutability**: `P` disallows mutating its inner `T`, unlike `Box` +//! (unless it contains an `Unsafe` interior, but that may be denied later). +//! This mainly prevents mistakes, but can also enforces a kind of "purity". +//! +//! * **Efficiency**: folding can reuse allocation space for `P` and `Vec`, +//! the latter even when the input and output types differ (as it would be the +//! case with arenas or a GADT AST using type parameters to toggle features). +//! +//! * **Maintainability**: `P` provides a fixed interface - `Deref`, +//! `and_then` and `map` - which can remain fully functional even if the +//! implementation changes (using a special thread-local heap, for example). +//! Moreover, a switch to, e.g. `P<'a, T>` would be easy and mostly automated. + +use std::fmt::{self, Display, Debug}; +use std::iter::FromIterator; +use std::ops::Deref; +use std::{mem, ptr, slice, vec}; + +use serialize::{Encodable, Decodable, Encoder, Decoder}; + +/// An owned smart pointer. +#[derive(Hash, PartialEq, Eq, PartialOrd, Ord)] +pub struct P { + ptr: Box +} + +#[allow(non_snake_case)] +/// Construct a `P` from a `T` value. +pub fn P(value: T) -> P { + P { + ptr: Box::new(value) + } +} + +impl P { + /// Move out of the pointer. + /// Intended for chaining transformations not covered by `map`. + pub fn and_then(self, f: F) -> U where + F: FnOnce(T) -> U, + { + f(*self.ptr) + } + /// Equivalent to and_then(|x| x) + pub fn unwrap(self) -> T { + *self.ptr + } + + /// Transform the inner value, consuming `self` and producing a new `P`. + pub fn map(mut self, f: F) -> P where + F: FnOnce(T) -> T, + { + let p: *mut T = &mut *self.ptr; + + // Leak self in case of panic. + // FIXME(eddyb) Use some sort of "free guard" that + // only deallocates, without dropping the pointee, + // in case the call the `f` below ends in a panic. + mem::forget(self); + + unsafe { + ptr::write(p, f(ptr::read(p))); + + // Recreate self from the raw pointer. + P { + ptr: Box::from_raw(p) + } + } + } +} + +impl Deref for P { + type Target = T; + + fn deref(&self) -> &T { + &self.ptr + } +} + +impl Clone for P { + fn clone(&self) -> P { + P((**self).clone()) + } +} + +impl Debug for P { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + Debug::fmt(&self.ptr, f) + } +} + +impl Display for P { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} + +impl fmt::Pointer for P { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Pointer::fmt(&self.ptr, f) + } +} + +impl Decodable for P { + fn decode(d: &mut D) -> Result, D::Error> { + Decodable::decode(d).map(P) + } +} + +impl Encodable for P { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + (**self).encode(s) + } +} + +impl P<[T]> { + pub fn new() -> P<[T]> { + P { ptr: Default::default() } + } + + #[inline(never)] + pub fn from_vec(v: Vec) -> P<[T]> { + P { ptr: v.into_boxed_slice() } + } + + #[inline(never)] + pub fn into_vec(self) -> Vec { + self.ptr.into_vec() + } +} + +impl Default for P<[T]> { + /// Creates an empty `P<[T]>`. + fn default() -> P<[T]> { + P::new() + } +} + +impl Clone for P<[T]> { + fn clone(&self) -> P<[T]> { + P::from_vec(self.to_vec()) + } +} + +impl From> for P<[T]> { + fn from(v: Vec) -> Self { + P::from_vec(v) + } +} + +impl Into> for P<[T]> { + fn into(self) -> Vec { + self.into_vec() + } +} + +impl FromIterator for P<[T]> { + fn from_iter>(iter: I) -> P<[T]> { + P::from_vec(iter.into_iter().collect()) + } +} + +impl IntoIterator for P<[T]> { + type Item = T; + type IntoIter = vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.into_vec().into_iter() + } +} + +impl<'a, T> IntoIterator for &'a P<[T]> { + type Item = &'a T; + type IntoIter = slice::Iter<'a, T>; + fn into_iter(self) -> Self::IntoIter { + self.ptr.into_iter() + } +} + +impl Encodable for P<[T]> { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + Encodable::encode(&**self, s) + } +} + +impl Decodable for P<[T]> { + fn decode(d: &mut D) -> Result, D::Error> { + Ok(P::from_vec(match Decodable::decode(d) { + Ok(t) => t, + Err(e) => return Err(e) + })) + } +} diff --git a/third_party/rust/syntex_syntax/src/show_span.rs b/third_party/rust/syntex_syntax/src/show_span.rs new file mode 100644 index 000000000000..263a4f13c1b2 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/show_span.rs @@ -0,0 +1,86 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Span debugger +//! +//! This module shows spans for all expressions in the crate +//! to help with compiler debugging. + +use std::str::FromStr; + +use ast; +use errors; +use visit; +use visit::Visitor; + +enum Mode { + Expression, + Pattern, + Type, +} + +impl FromStr for Mode { + type Err = (); + fn from_str(s: &str) -> Result { + let mode = match s { + "expr" => Mode::Expression, + "pat" => Mode::Pattern, + "ty" => Mode::Type, + _ => return Err(()) + }; + Ok(mode) + } +} + +struct ShowSpanVisitor<'a> { + span_diagnostic: &'a errors::Handler, + mode: Mode, +} + +impl<'a> Visitor<'a> for ShowSpanVisitor<'a> { + fn visit_expr(&mut self, e: &'a ast::Expr) { + if let Mode::Expression = self.mode { + self.span_diagnostic.span_warn(e.span, "expression"); + } + visit::walk_expr(self, e); + } + + fn visit_pat(&mut self, p: &'a ast::Pat) { + if let Mode::Pattern = self.mode { + self.span_diagnostic.span_warn(p.span, "pattern"); + } + visit::walk_pat(self, p); + } + + fn visit_ty(&mut self, t: &'a ast::Ty) { + if let Mode::Type = self.mode { + self.span_diagnostic.span_warn(t.span, "type"); + } + visit::walk_ty(self, t); + } + + fn visit_mac(&mut self, mac: &'a ast::Mac) { + visit::walk_mac(self, mac); + } +} + +pub fn run(span_diagnostic: &errors::Handler, + mode: &str, + krate: &ast::Crate) { + let mode = match mode.parse().ok() { + Some(mode) => mode, + None => return + }; + let mut v = ShowSpanVisitor { + span_diagnostic: span_diagnostic, + mode: mode, + }; + visit::walk_crate(&mut v, krate); +} diff --git a/third_party/rust/syntex_syntax/src/std_inject.rs b/third_party/rust/syntex_syntax/src/std_inject.rs new file mode 100644 index 000000000000..68d807b24a78 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/std_inject.rs @@ -0,0 +1,94 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ast; +use attr; +use symbol::{Symbol, keywords}; +use syntax_pos::{DUMMY_SP, Span}; +use codemap::{self, ExpnInfo, NameAndSpan, MacroAttribute}; +use parse::ParseSess; +use ptr::P; + +/// Craft a span that will be ignored by the stability lint's +/// call to codemap's is_internal check. +/// The expanded code uses the unstable `#[prelude_import]` attribute. +fn ignored_span(sess: &ParseSess, sp: Span) -> Span { + let info = ExpnInfo { + call_site: DUMMY_SP, + callee: NameAndSpan { + format: MacroAttribute(Symbol::intern("std_inject")), + span: None, + allow_internal_unstable: true, + } + }; + let expn_id = sess.codemap().record_expansion(info); + let mut sp = sp; + sp.expn_id = expn_id; + return sp; +} + +pub fn injected_crate_name(krate: &ast::Crate) -> Option<&'static str> { + if attr::contains_name(&krate.attrs, "no_core") { + None + } else if attr::contains_name(&krate.attrs, "no_std") { + Some("core") + } else { + Some("std") + } +} + +pub fn maybe_inject_crates_ref(sess: &ParseSess, + mut krate: ast::Crate, + alt_std_name: Option) + -> ast::Crate { + let name = match injected_crate_name(&krate) { + Some(name) => name, + None => return krate, + }; + + let crate_name = Symbol::intern(&alt_std_name.unwrap_or(name.to_string())); + + krate.module.items.insert(0, P(ast::Item { + attrs: vec![attr::mk_attr_outer(attr::mk_attr_id(), + attr::mk_word_item(Symbol::intern("macro_use")))], + vis: ast::Visibility::Inherited, + node: ast::ItemKind::ExternCrate(Some(crate_name)), + ident: ast::Ident::from_str(name), + id: ast::DUMMY_NODE_ID, + span: DUMMY_SP, + })); + + let span = ignored_span(sess, DUMMY_SP); + krate.module.items.insert(0, P(ast::Item { + attrs: vec![ast::Attribute { + style: ast::AttrStyle::Outer, + value: ast::MetaItem { + name: Symbol::intern("prelude_import"), + node: ast::MetaItemKind::Word, + span: span, + }, + id: attr::mk_attr_id(), + is_sugared_doc: false, + span: span, + }], + vis: ast::Visibility::Inherited, + node: ast::ItemKind::Use(P(codemap::dummy_spanned(ast::ViewPathGlob(ast::Path { + segments: ["{{root}}", name, "prelude", "v1"].into_iter().map(|name| { + ast::Ident::from_str(name).into() + }).collect(), + span: span, + })))), + id: ast::DUMMY_NODE_ID, + ident: keywords::Invalid.ident(), + span: span, + })); + + krate +} diff --git a/third_party/rust/syntex_syntax/src/str.rs b/third_party/rust/syntex_syntax/src/str.rs new file mode 100644 index 000000000000..09550653783a --- /dev/null +++ b/third_party/rust/syntex_syntax/src/str.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn char_at(s: &str, byte: usize) -> char { + s[byte..].chars().next().unwrap() +} + +// FIXME: This was copied from core/str/mod.rs because it is currently unstable. +#[inline] +pub fn slice_shift_char(s: &str) -> Option<(char, &str)> { + if s.is_empty() { + None + } else { + let ch = char_at(s, 0); + Some((ch, &s[ch.len_utf8()..])) + } +} diff --git a/third_party/rust/syntex_syntax/src/symbol.rs b/third_party/rust/syntex_syntax/src/symbol.rs new file mode 100644 index 000000000000..d37ca18a26af --- /dev/null +++ b/third_party/rust/syntex_syntax/src/symbol.rs @@ -0,0 +1,312 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! An "interner" is a data structure that associates values with usize tags and +//! allows bidirectional lookup; i.e. given a value, one can easily find the +//! type, and vice versa. + +use serialize::{Decodable, Decoder, Encodable, Encoder}; +use std::cell::RefCell; +use std::collections::HashMap; +use std::fmt; + +/// A symbol is an interned or gensymed string. +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct Symbol(u32); + +// FIXME syntex +// The interner in thread-local, so `Symbol` shouldn't move between threads. +// impl !Send for Symbol { } + +impl Symbol { + /// Maps a string to its interned representation. + pub fn intern(string: &str) -> Self { + with_interner(|interner| interner.intern(string)) + } + + /// gensym's a new usize, using the current interner. + pub fn gensym(string: &str) -> Self { + with_interner(|interner| interner.gensym(string)) + } + + pub fn as_str(self) -> InternedString { + with_interner(|interner| unsafe { + InternedString { + string: ::std::mem::transmute::<&str, &str>(interner.get(self)) + } + }) + } + + pub fn as_u32(self) -> u32 { + self.0 + } +} + +impl fmt::Debug for Symbol { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}({})", self, self.0) + } +} + +impl fmt::Display for Symbol { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.as_str(), f) + } +} + +impl Encodable for Symbol { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_str(&self.as_str()) + } +} + +impl Decodable for Symbol { + fn decode(d: &mut D) -> Result { + Ok(Symbol::intern(&try!(d.read_str()))) + } +} + +impl<'a> PartialEq<&'a str> for Symbol { + fn eq(&self, other: &&str) -> bool { + *self.as_str() == **other + } +} + +#[derive(Default)] +pub struct Interner { + names: HashMap, Symbol>, + strings: Vec>, +} + +impl Interner { + pub fn new() -> Self { + Interner::default() + } + + fn prefill(init: &[&str]) -> Self { + let mut this = Interner::new(); + for &string in init { + this.intern(string); + } + this + } + + pub fn intern(&mut self, string: &str) -> Symbol { + if let Some(&name) = self.names.get(string) { + return name; + } + + let name = Symbol(self.strings.len() as u32); + let string = string.to_string().into_boxed_str(); + self.strings.push(string.clone()); + self.names.insert(string, name); + name + } + + fn gensym(&mut self, string: &str) -> Symbol { + let gensym = Symbol(self.strings.len() as u32); + // leave out of `names` to avoid colliding + self.strings.push(string.to_string().into_boxed_str()); + gensym + } + + pub fn get(&self, name: Symbol) -> &str { + &self.strings[name.0 as usize] + } +} + +// In this macro, there is the requirement that the name (the number) must be monotonically +// increasing by one in the special identifiers, starting at 0; the same holds for the keywords, +// except starting from the next number instead of zero. +macro_rules! declare_keywords {( + $( ($index: expr, $konst: ident, $string: expr) )* +) => { + pub mod keywords { + use ast; + use ext; + #[derive(Clone, Copy, PartialEq, Eq)] + pub struct Keyword { + ident: ast::Ident, + } + impl Keyword { + #[inline] pub fn ident(self) -> ast::Ident { self.ident } + #[inline] pub fn name(self) -> ast::Name { self.ident.name } + } + $( + #[allow(non_upper_case_globals)] + pub const $konst: Keyword = Keyword { + ident: ast::Ident { + name: ast::Name($index), + ctxt: ext::hygiene::SyntaxContext(0), + } + }; + )* + } + + impl Interner { + fn fresh() -> Self { + Interner::prefill(&[$($string,)*]) + } + } +}} + +// NB: leaving holes in the ident table is bad! a different ident will get +// interned with the id from the hole, but it will be between the min and max +// of the reserved words, and thus tagged as "reserved". +// After modifying this list adjust `is_strict_keyword`/`is_reserved_keyword`, +// this should be rarely necessary though if the keywords are kept in alphabetic order. +declare_keywords! { + // Invalid identifier + (0, Invalid, "") + + // Strict keywords used in the language. + (1, As, "as") + (2, Box, "box") + (3, Break, "break") + (4, Const, "const") + (5, Continue, "continue") + (6, Crate, "crate") + (7, Else, "else") + (8, Enum, "enum") + (9, Extern, "extern") + (10, False, "false") + (11, Fn, "fn") + (12, For, "for") + (13, If, "if") + (14, Impl, "impl") + (15, In, "in") + (16, Let, "let") + (17, Loop, "loop") + (18, Match, "match") + (19, Mod, "mod") + (20, Move, "move") + (21, Mut, "mut") + (22, Pub, "pub") + (23, Ref, "ref") + (24, Return, "return") + (25, SelfValue, "self") + (26, SelfType, "Self") + (27, Static, "static") + (28, Struct, "struct") + (29, Super, "super") + (30, Trait, "trait") + (31, True, "true") + (32, Type, "type") + (33, Unsafe, "unsafe") + (34, Use, "use") + (35, Where, "where") + (36, While, "while") + + // Keywords reserved for future use. + (37, Abstract, "abstract") + (38, Alignof, "alignof") + (39, Become, "become") + (40, Do, "do") + (41, Final, "final") + (42, Macro, "macro") + (43, Offsetof, "offsetof") + (44, Override, "override") + (45, Priv, "priv") + (46, Proc, "proc") + (47, Pure, "pure") + (48, Sizeof, "sizeof") + (49, Typeof, "typeof") + (50, Unsized, "unsized") + (51, Virtual, "virtual") + (52, Yield, "yield") + + // Weak keywords, have special meaning only in specific contexts. + (53, Default, "default") + (54, StaticLifetime, "'static") + (55, Union, "union") + + // A virtual keyword that resolves to the crate root when used in a lexical scope. + (56, CrateRoot, "{{root}}") +} + +// If an interner exists in TLS, return it. Otherwise, prepare a fresh one. +fn with_interner T>(f: F) -> T { + thread_local!(static INTERNER: RefCell = { + RefCell::new(Interner::fresh()) + }); + INTERNER.with(|interner| f(&mut *interner.borrow_mut())) +} + +/// Represents a string stored in the thread-local interner. Because the +/// interner lives for the life of the thread, this can be safely treated as an +/// immortal string, as long as it never crosses between threads. +/// +/// FIXME(pcwalton): You must be careful about what you do in the destructors +/// of objects stored in TLS, because they may run after the interner is +/// destroyed. In particular, they must not access string contents. This can +/// be fixed in the future by just leaking all strings until thread death +/// somehow. +#[derive(Clone, PartialEq, Hash, PartialOrd, Eq, Ord)] +pub struct InternedString { + string: &'static str, +} + +// FIXME syntex +// impl !Send for InternedString { } + +impl ::std::ops::Deref for InternedString { + type Target = str; + fn deref(&self) -> &str { self.string } +} + +impl fmt::Debug for InternedString { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(self.string, f) + } +} + +impl fmt::Display for InternedString { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self.string, f) + } +} + +impl Decodable for InternedString { + fn decode(d: &mut D) -> Result { + Ok(Symbol::intern(&try!(d.read_str())).as_str()) + } +} + +impl Encodable for InternedString { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_str(self.string) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use ast::Name; + + #[test] + fn interner_tests() { + let mut i: Interner = Interner::new(); + // first one is zero: + assert_eq!(i.intern("dog"), Name(0)); + // re-use gets the same entry: + assert_eq!(i.intern ("dog"), Name(0)); + // different string gets a different #: + assert_eq!(i.intern("cat"), Name(1)); + assert_eq!(i.intern("cat"), Name(1)); + // dog is still at zero + assert_eq!(i.intern("dog"), Name(0)); + // gensym gets 3 + assert_eq!(i.gensym("zebra"), Name(2)); + // gensym of same string gets new number : + assert_eq!(i.gensym("zebra"), Name(3)); + // gensym of *existing* string gets new number: + assert_eq!(i.gensym("dog"), Name(4)); + } +} diff --git a/third_party/rust/syntex_syntax/src/test.rs b/third_party/rust/syntex_syntax/src/test.rs new file mode 100644 index 000000000000..b8e0b938814a --- /dev/null +++ b/third_party/rust/syntex_syntax/src/test.rs @@ -0,0 +1,718 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Code that generates a test runner to run all the tests in a crate + +#![allow(dead_code)] +#![allow(unused_imports)] + +use self::HasTestSignature::*; + +use std::iter; +use std::slice; +use std::mem; +use std::vec; +use attr::{self, HasAttrs}; +use syntax_pos::{self, DUMMY_SP, NO_EXPANSION, Span, FileMap, BytePos}; +use std::rc::Rc; + +use codemap::{self, CodeMap, ExpnInfo, NameAndSpan, MacroAttribute, dummy_spanned}; +use errors; +use errors::snippet::{SnippetData}; +use config; +use entry::{self, EntryPointType}; +use ext::base::{ExtCtxt, Resolver}; +use ext::build::AstBuilder; +use ext::expand::ExpansionConfig; +use fold::Folder; +use util::move_map::MoveMap; +use fold; +use parse::{token, ParseSess}; +use print::pprust; +use ast::{self, Ident}; +use ptr::P; +use symbol::{self, Symbol, keywords}; +use util::small_vector::SmallVector; + +enum ShouldPanic { + No, + Yes(Option), +} + +struct Test { + span: Span, + path: Vec , + bench: bool, + ignore: bool, + should_panic: ShouldPanic +} + +struct TestCtxt<'a> { + sess: &'a ParseSess, + span_diagnostic: &'a errors::Handler, + path: Vec, + ext_cx: ExtCtxt<'a>, + testfns: Vec, + reexport_test_harness_main: Option, + is_test_crate: bool, + + // top-level re-export submodule, filled out after folding is finished + toplevel_reexport: Option, +} + +// Traverse the crate, collecting all the test functions, eliding any +// existing main functions, and synthesizing a main test harness +pub fn modify_for_testing(sess: &ParseSess, + resolver: &mut Resolver, + should_test: bool, + krate: ast::Crate, + span_diagnostic: &errors::Handler) -> ast::Crate { + // Check for #[reexport_test_harness_main = "some_name"] which + // creates a `use some_name = __test::main;`. This needs to be + // unconditional, so that the attribute is still marked as used in + // non-test builds. + let reexport_test_harness_main = + attr::first_attr_value_str_by_name(&krate.attrs, + "reexport_test_harness_main"); + + if should_test { + generate_test_harness(sess, resolver, reexport_test_harness_main, krate, span_diagnostic) + } else { + krate + } +} + +struct TestHarnessGenerator<'a> { + cx: TestCtxt<'a>, + tests: Vec, + + // submodule name, gensym'd identifier for re-exports + tested_submods: Vec<(Ident, Ident)>, +} + +impl<'a> fold::Folder for TestHarnessGenerator<'a> { + fn fold_crate(&mut self, c: ast::Crate) -> ast::Crate { + let mut folded = fold::noop_fold_crate(c, self); + + // Add a special __test module to the crate that will contain code + // generated for the test harness + let (mod_, reexport) = mk_test_module(&mut self.cx); + match reexport { + Some(re) => folded.module.items.push(re), + None => {} + } + folded.module.items.push(mod_); + folded + } + + fn fold_item(&mut self, i: P) -> SmallVector> { + let ident = i.ident; + if ident.name != keywords::Invalid.name() { + self.cx.path.push(ident); + } + debug!("current path: {}", path_name_i(&self.cx.path)); + + if is_test_fn(&self.cx, &i) || is_bench_fn(&self.cx, &i) { + match i.node { + ast::ItemKind::Fn(_, ast::Unsafety::Unsafe, _, _, _, _) => { + let diag = self.cx.span_diagnostic; + panic!(diag.span_fatal(i.span, "unsafe functions cannot be used for tests")); + } + _ => { + debug!("this is a test function"); + let test = Test { + span: i.span, + path: self.cx.path.clone(), + bench: is_bench_fn(&self.cx, &i), + ignore: is_ignored(&i), + should_panic: should_panic(&i, &self.cx) + }; + self.cx.testfns.push(test); + self.tests.push(i.ident); + } + } + } + + let mut item = i.unwrap(); + // We don't want to recurse into anything other than mods, since + // mods or tests inside of functions will break things + if let ast::ItemKind::Mod(module) = item.node { + let tests = mem::replace(&mut self.tests, Vec::new()); + let tested_submods = mem::replace(&mut self.tested_submods, Vec::new()); + let mut mod_folded = fold::noop_fold_mod(module, self); + let tests = mem::replace(&mut self.tests, tests); + let tested_submods = mem::replace(&mut self.tested_submods, tested_submods); + + if !tests.is_empty() || !tested_submods.is_empty() { + let (it, sym) = mk_reexport_mod(&mut self.cx, item.id, tests, tested_submods); + mod_folded.items.push(it); + + if !self.cx.path.is_empty() { + self.tested_submods.push((self.cx.path[self.cx.path.len()-1], sym)); + } else { + debug!("pushing nothing, sym: {:?}", sym); + self.cx.toplevel_reexport = Some(sym); + } + } + item.node = ast::ItemKind::Mod(mod_folded); + } + if ident.name != keywords::Invalid.name() { + self.cx.path.pop(); + } + SmallVector::one(P(item)) + } + + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { mac } +} + +struct EntryPointCleaner { + // Current depth in the ast + depth: usize, +} + +impl fold::Folder for EntryPointCleaner { + fn fold_item(&mut self, i: P) -> SmallVector> { + self.depth += 1; + let folded = fold::noop_fold_item(i, self).expect_one("noop did something"); + self.depth -= 1; + + // Remove any #[main] or #[start] from the AST so it doesn't + // clash with the one we're going to add, but mark it as + // #[allow(dead_code)] to avoid printing warnings. + let folded = match entry::entry_point_type(&folded, self.depth) { + EntryPointType::MainNamed | + EntryPointType::MainAttr | + EntryPointType::Start => + folded.map(|ast::Item {id, ident, attrs, node, vis, span}| { + let allow_str = Symbol::intern("allow"); + let dead_code_str = Symbol::intern("dead_code"); + let word_vec = vec![attr::mk_list_word_item(dead_code_str)]; + let allow_dead_code_item = attr::mk_list_item(allow_str, word_vec); + let allow_dead_code = attr::mk_attr_outer(attr::mk_attr_id(), + allow_dead_code_item); + + ast::Item { + id: id, + ident: ident, + attrs: attrs.into_iter() + .filter(|attr| { + !attr.check_name("main") && !attr.check_name("start") + }) + .chain(iter::once(allow_dead_code)) + .collect(), + node: node, + vis: vis, + span: span + } + }), + EntryPointType::None | + EntryPointType::OtherMain => folded, + }; + + SmallVector::one(folded) + } + + fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { mac } +} + +fn mk_reexport_mod(cx: &mut TestCtxt, + parent: ast::NodeId, + tests: Vec, + tested_submods: Vec<(Ident, Ident)>) + -> (P, Ident) { + let super_ = Ident::from_str("super"); + + // Generate imports with `#[allow(private_in_public)]` to work around issue #36768. + let allow_private_in_public = cx.ext_cx.attribute(DUMMY_SP, cx.ext_cx.meta_list( + DUMMY_SP, + Symbol::intern("allow"), + vec![cx.ext_cx.meta_list_item_word(DUMMY_SP, Symbol::intern("private_in_public"))], + )); + let items = tests.into_iter().map(|r| { + cx.ext_cx.item_use_simple(DUMMY_SP, ast::Visibility::Public, + cx.ext_cx.path(DUMMY_SP, vec![super_, r])) + .map_attrs(|_| vec![allow_private_in_public.clone()]) + }).chain(tested_submods.into_iter().map(|(r, sym)| { + let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]); + cx.ext_cx.item_use_simple_(DUMMY_SP, ast::Visibility::Public, r, path) + .map_attrs(|_| vec![allow_private_in_public.clone()]) + })).collect(); + + let reexport_mod = ast::Mod { + inner: DUMMY_SP, + items: items, + }; + + let sym = Ident::with_empty_ctxt(Symbol::gensym("__test_reexports")); + let parent = if parent == ast::DUMMY_NODE_ID { ast::CRATE_NODE_ID } else { parent }; + cx.ext_cx.current_expansion.mark = cx.ext_cx.resolver.get_module_scope(parent); + let it = cx.ext_cx.monotonic_expander().fold_item(P(ast::Item { + ident: sym.clone(), + attrs: Vec::new(), + id: ast::DUMMY_NODE_ID, + node: ast::ItemKind::Mod(reexport_mod), + vis: ast::Visibility::Public, + span: DUMMY_SP, + })).pop().unwrap(); + + (it, sym) +} + +fn generate_test_harness(sess: &ParseSess, + resolver: &mut Resolver, + reexport_test_harness_main: Option, + krate: ast::Crate, + sd: &errors::Handler) -> ast::Crate { + // Remove the entry points + let mut cleaner = EntryPointCleaner { depth: 0 }; + let krate = cleaner.fold_crate(krate); + + let mut cx: TestCtxt = TestCtxt { + sess: sess, + span_diagnostic: sd, + ext_cx: ExtCtxt::new(sess, ExpansionConfig::default("test".to_string()), resolver), + path: Vec::new(), + testfns: Vec::new(), + reexport_test_harness_main: reexport_test_harness_main, + is_test_crate: is_test_crate(&krate), + toplevel_reexport: None, + }; + cx.ext_cx.crate_root = Some("std"); + + cx.ext_cx.bt_push(ExpnInfo { + call_site: DUMMY_SP, + callee: NameAndSpan { + format: MacroAttribute(Symbol::intern("test")), + span: None, + allow_internal_unstable: false, + } + }); + + TestHarnessGenerator { + cx: cx, + tests: Vec::new(), + tested_submods: Vec::new(), + }.fold_crate(krate) +} + +/// Craft a span that will be ignored by the stability lint's +/// call to codemap's is_internal check. +/// The expanded code calls some unstable functions in the test crate. +fn ignored_span(cx: &TestCtxt, sp: Span) -> Span { + let info = ExpnInfo { + call_site: sp, + callee: NameAndSpan { + format: MacroAttribute(Symbol::intern("test")), + span: None, + allow_internal_unstable: true, + } + }; + let expn_id = cx.sess.codemap().record_expansion(info); + let mut sp = sp; + sp.expn_id = expn_id; + return sp; +} + +#[derive(PartialEq)] +enum HasTestSignature { + Yes, + No, + NotEvenAFunction, +} + +fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool { + let has_test_attr = attr::contains_name(&i.attrs, "test"); + + fn has_test_signature(i: &ast::Item) -> HasTestSignature { + match i.node { + ast::ItemKind::Fn(ref decl, _, _, _, ref generics, _) => { + let no_output = match decl.output { + ast::FunctionRetTy::Default(..) => true, + ast::FunctionRetTy::Ty(ref t) if t.node == ast::TyKind::Tup(vec![]) => true, + _ => false + }; + if decl.inputs.is_empty() + && no_output + && !generics.is_parameterized() { + Yes + } else { + No + } + } + _ => NotEvenAFunction, + } + } + + if has_test_attr { + let diag = cx.span_diagnostic; + match has_test_signature(i) { + Yes => {}, + No => diag.span_err(i.span, "functions used as tests must have signature fn() -> ()"), + NotEvenAFunction => diag.span_err(i.span, + "only functions may be used as tests"), + } + } + + return has_test_attr && has_test_signature(i) == Yes; +} + +fn is_bench_fn(cx: &TestCtxt, i: &ast::Item) -> bool { + let has_bench_attr = attr::contains_name(&i.attrs, "bench"); + + fn has_test_signature(i: &ast::Item) -> bool { + match i.node { + ast::ItemKind::Fn(ref decl, _, _, _, ref generics, _) => { + let input_cnt = decl.inputs.len(); + let no_output = match decl.output { + ast::FunctionRetTy::Default(..) => true, + ast::FunctionRetTy::Ty(ref t) if t.node == ast::TyKind::Tup(vec![]) => true, + _ => false + }; + let tparm_cnt = generics.ty_params.len(); + // NB: inadequate check, but we're running + // well before resolve, can't get too deep. + input_cnt == 1 + && no_output && tparm_cnt == 0 + } + _ => false + } + } + + if has_bench_attr && !has_test_signature(i) { + let diag = cx.span_diagnostic; + diag.span_err(i.span, "functions used as benches must have signature \ + `fn(&mut Bencher) -> ()`"); + } + + return has_bench_attr && has_test_signature(i); +} + +fn is_ignored(i: &ast::Item) -> bool { + i.attrs.iter().any(|attr| attr.check_name("ignore")) +} + +fn should_panic(i: &ast::Item, cx: &TestCtxt) -> ShouldPanic { + match i.attrs.iter().find(|attr| attr.check_name("should_panic")) { + Some(attr) => { + let sd = cx.span_diagnostic; + if attr.is_value_str() { + sd.struct_span_warn( + attr.span(), + "attribute must be of the form: \ + `#[should_panic]` or \ + `#[should_panic(expected = \"error message\")]`" + ).note("Errors in this attribute were erroneously allowed \ + and will become a hard error in a future release.") + .emit(); + return ShouldPanic::Yes(None); + } + match attr.meta_item_list() { + // Handle #[should_panic] + None => ShouldPanic::Yes(None), + // Handle #[should_panic(expected = "foo")] + Some(list) => { + let msg = list.iter() + .find(|mi| mi.check_name("expected")) + .and_then(|mi| mi.meta_item()) + .and_then(|mi| mi.value_str()); + if list.len() != 1 || msg.is_none() { + sd.struct_span_warn( + attr.span(), + "argument must be of the form: \ + `expected = \"error message\"`" + ).note("Errors in this attribute were erroneously \ + allowed and will become a hard error in a \ + future release.").emit(); + ShouldPanic::Yes(None) + } else { + ShouldPanic::Yes(msg) + } + }, + } + } + None => ShouldPanic::No, + } +} + +/* + +We're going to be building a module that looks more or less like: + +mod __test { + extern crate test (name = "test", vers = "..."); + fn main() { + test::test_main_static(&::os::args()[], tests) + } + + static tests : &'static [test::TestDescAndFn] = &[ + ... the list of tests in the crate ... + ]; +} + +*/ + +fn mk_std(cx: &TestCtxt) -> P { + let id_test = Ident::from_str("test"); + let sp = ignored_span(cx, DUMMY_SP); + let (vi, vis, ident) = if cx.is_test_crate { + (ast::ItemKind::Use( + P(nospan(ast::ViewPathSimple(id_test, + path_node(vec![id_test]))))), + ast::Visibility::Public, keywords::Invalid.ident()) + } else { + (ast::ItemKind::ExternCrate(None), ast::Visibility::Inherited, id_test) + }; + P(ast::Item { + id: ast::DUMMY_NODE_ID, + ident: ident, + node: vi, + attrs: vec![], + vis: vis, + span: sp + }) +} + +fn mk_main(cx: &mut TestCtxt) -> P { + // Writing this out by hand with 'ignored_span': + // pub fn main() { + // #![main] + // use std::slice::AsSlice; + // test::test_main_static(::std::os::args().as_slice(), TESTS); + // } + + let sp = ignored_span(cx, DUMMY_SP); + let ecx = &cx.ext_cx; + + // test::test_main_static + let test_main_path = + ecx.path(sp, vec![Ident::from_str("test"), Ident::from_str("test_main_static")]); + + // test::test_main_static(...) + let test_main_path_expr = ecx.expr_path(test_main_path); + let tests_ident_expr = ecx.expr_ident(sp, Ident::from_str("TESTS")); + let call_test_main = ecx.expr_call(sp, test_main_path_expr, + vec![tests_ident_expr]); + let call_test_main = ecx.stmt_expr(call_test_main); + // #![main] + let main_meta = ecx.meta_word(sp, Symbol::intern("main")); + let main_attr = ecx.attribute(sp, main_meta); + // pub fn main() { ... } + let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(vec![])); + let main_body = ecx.block(sp, vec![call_test_main]); + let main = ast::ItemKind::Fn(ecx.fn_decl(vec![], main_ret_ty), + ast::Unsafety::Normal, + dummy_spanned(ast::Constness::NotConst), + ::abi::Abi::Rust, ast::Generics::default(), main_body); + let main = P(ast::Item { + ident: Ident::from_str("main"), + attrs: vec![main_attr], + id: ast::DUMMY_NODE_ID, + node: main, + vis: ast::Visibility::Public, + span: sp + }); + + return main; +} + +fn mk_test_module(cx: &mut TestCtxt) -> (P, Option>) { + // Link to test crate + let import = mk_std(cx); + + // A constant vector of test descriptors. + let tests = mk_tests(cx); + + // The synthesized main function which will call the console test runner + // with our list of tests + let mainfn = mk_main(cx); + + let testmod = ast::Mod { + inner: DUMMY_SP, + items: vec![import, mainfn, tests], + }; + let item_ = ast::ItemKind::Mod(testmod); + let mod_ident = Ident::with_empty_ctxt(Symbol::gensym("__test")); + + let mut expander = cx.ext_cx.monotonic_expander(); + let item = expander.fold_item(P(ast::Item { + id: ast::DUMMY_NODE_ID, + ident: mod_ident, + attrs: vec![], + node: item_, + vis: ast::Visibility::Public, + span: DUMMY_SP, + })).pop().unwrap(); + let reexport = cx.reexport_test_harness_main.map(|s| { + // building `use = __test::main` + let reexport_ident = Ident::with_empty_ctxt(s); + + let use_path = + nospan(ast::ViewPathSimple(reexport_ident, + path_node(vec![mod_ident, Ident::from_str("main")]))); + + expander.fold_item(P(ast::Item { + id: ast::DUMMY_NODE_ID, + ident: keywords::Invalid.ident(), + attrs: vec![], + node: ast::ItemKind::Use(P(use_path)), + vis: ast::Visibility::Inherited, + span: DUMMY_SP + })).pop().unwrap() + }); + + debug!("Synthetic test module:\n{}\n", pprust::item_to_string(&item)); + + (item, reexport) +} + +fn nospan(t: T) -> codemap::Spanned { + codemap::Spanned { node: t, span: DUMMY_SP } +} + +fn path_node(ids: Vec) -> ast::Path { + ast::Path { + span: DUMMY_SP, + segments: ids.into_iter().map(Into::into).collect(), + } +} + +fn path_name_i(idents: &[Ident]) -> String { + // FIXME: Bad copies (#2543 -- same for everything else that says "bad") + idents.iter().map(|i| i.to_string()).collect::>().join("::") +} + +fn mk_tests(cx: &TestCtxt) -> P { + // The vector of test_descs for this crate + let test_descs = mk_test_descs(cx); + + // FIXME #15962: should be using quote_item, but that stringifies + // __test_reexports, causing it to be reinterned, losing the + // gensym information. + let sp = ignored_span(cx, DUMMY_SP); + let ecx = &cx.ext_cx; + let struct_type = ecx.ty_path(ecx.path(sp, vec![ecx.ident_of("self"), + ecx.ident_of("test"), + ecx.ident_of("TestDescAndFn")])); + let static_lt = ecx.lifetime(sp, keywords::StaticLifetime.name()); + // &'static [self::test::TestDescAndFn] + let static_type = ecx.ty_rptr(sp, + ecx.ty(sp, ast::TyKind::Slice(struct_type)), + Some(static_lt), + ast::Mutability::Immutable); + // static TESTS: $static_type = &[...]; + ecx.item_const(sp, + ecx.ident_of("TESTS"), + static_type, + test_descs) +} + +fn is_test_crate(krate: &ast::Crate) -> bool { + match attr::find_crate_name(&krate.attrs) { + Some(s) if "test" == &*s.as_str() => true, + _ => false + } +} + +fn mk_test_descs(cx: &TestCtxt) -> P { + debug!("building test vector from {} tests", cx.testfns.len()); + + P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::AddrOf(ast::Mutability::Immutable, + P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::Vec(cx.testfns.iter().map(|test| { + mk_test_desc_and_fn_rec(cx, test) + }).collect()), + span: DUMMY_SP, + attrs: ast::ThinVec::new(), + })), + span: DUMMY_SP, + attrs: ast::ThinVec::new(), + }) +} + +fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P { + // FIXME #15962: should be using quote_expr, but that stringifies + // __test_reexports, causing it to be reinterned, losing the + // gensym information. + + let span = ignored_span(cx, test.span); + let path = test.path.clone(); + let ecx = &cx.ext_cx; + let self_id = ecx.ident_of("self"); + let test_id = ecx.ident_of("test"); + + // creates self::test::$name + let test_path = |name| { + ecx.path(span, vec![self_id, test_id, ecx.ident_of(name)]) + }; + // creates $name: $expr + let field = |name, expr| ecx.field_imm(span, ecx.ident_of(name), expr); + + debug!("encoding {}", path_name_i(&path[..])); + + // path to the #[test] function: "foo::bar::baz" + let path_string = path_name_i(&path[..]); + let name_expr = ecx.expr_str(span, Symbol::intern(&path_string)); + + // self::test::StaticTestName($name_expr) + let name_expr = ecx.expr_call(span, + ecx.expr_path(test_path("StaticTestName")), + vec![name_expr]); + + let ignore_expr = ecx.expr_bool(span, test.ignore); + let should_panic_path = |name| { + ecx.path(span, vec![self_id, test_id, ecx.ident_of("ShouldPanic"), ecx.ident_of(name)]) + }; + let fail_expr = match test.should_panic { + ShouldPanic::No => ecx.expr_path(should_panic_path("No")), + ShouldPanic::Yes(msg) => { + match msg { + Some(msg) => { + let msg = ecx.expr_str(span, msg); + let path = should_panic_path("YesWithMessage"); + ecx.expr_call(span, ecx.expr_path(path), vec![msg]) + } + None => ecx.expr_path(should_panic_path("Yes")), + } + } + }; + + // self::test::TestDesc { ... } + let desc_expr = ecx.expr_struct( + span, + test_path("TestDesc"), + vec![field("name", name_expr), + field("ignore", ignore_expr), + field("should_panic", fail_expr)]); + + + let mut visible_path = match cx.toplevel_reexport { + Some(id) => vec![id], + None => { + let diag = cx.span_diagnostic; + diag.bug("expected to find top-level re-export name, but found None"); + } + }; + visible_path.extend(path); + + let fn_expr = ecx.expr_path(ecx.path_global(span, visible_path)); + + let variant_name = if test.bench { "StaticBenchFn" } else { "StaticTestFn" }; + // self::test::$variant_name($fn_expr) + let testfn_expr = ecx.expr_call(span, ecx.expr_path(test_path(variant_name)), vec![fn_expr]); + + // self::test::TestDescAndFn { ... } + ecx.expr_struct(span, + test_path("TestDescAndFn"), + vec![field("desc", desc_expr), + field("testfn", testfn_expr)]) +} diff --git a/third_party/rust/syntex_syntax/src/test_snippet.rs b/third_party/rust/syntex_syntax/src/test_snippet.rs new file mode 100644 index 000000000000..98e574867b49 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/test_snippet.rs @@ -0,0 +1,546 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use codemap::CodeMap; +use errors::Handler; +use errors::emitter::EmitterWriter; +use std::io; +use std::io::prelude::*; +use std::rc::Rc; +use std::str; +use std::sync::{Arc, Mutex}; +use syntax_pos::{BytePos, NO_EXPANSION, Span, MultiSpan}; + +/// Identify a position in the text by the Nth occurrence of a string. +struct Position { + string: &'static str, + count: usize, +} + +struct SpanLabel { + start: Position, + end: Position, + label: &'static str, +} + +struct Shared { + data: Arc>, +} + +impl Write for Shared { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.data.lock().unwrap().write(buf) + } + + fn flush(&mut self) -> io::Result<()> { + self.data.lock().unwrap().flush() + } +} + +fn test_harness(file_text: &str, span_labels: Vec, expected_output: &str) { + let output = Arc::new(Mutex::new(Vec::new())); + + let code_map = Rc::new(CodeMap::new()); + code_map.new_filemap_and_lines("test.rs", None, &file_text); + + let primary_span = make_span(&file_text, &span_labels[0].start, &span_labels[0].end); + let mut msp = MultiSpan::from_span(primary_span); + for span_label in span_labels { + let span = make_span(&file_text, &span_label.start, &span_label.end); + msp.push_span_label(span, span_label.label.to_string()); + println!("span: {:?} label: {:?}", span, span_label.label); + println!("text: {:?}", code_map.span_to_snippet(span)); + } + + let emitter = EmitterWriter::new(Box::new(Shared { data: output.clone() }), + Some(code_map.clone())); + let handler = Handler::with_emitter(true, false, Box::new(emitter)); + handler.span_err(msp, "foo"); + + assert!(expected_output.chars().next() == Some('\n'), + "expected output should begin with newline"); + let expected_output = &expected_output[1..]; + + let bytes = output.lock().unwrap(); + let actual_output = str::from_utf8(&bytes).unwrap(); + println!("expected output:\n------\n{}------", expected_output); + println!("actual output:\n------\n{}------", actual_output); + + assert!(expected_output == actual_output) +} + +fn make_span(file_text: &str, start: &Position, end: &Position) -> Span { + let start = make_pos(file_text, start); + let end = make_pos(file_text, end) + end.string.len(); // just after matching thing ends + assert!(start <= end); + Span { + lo: BytePos(start as u32), + hi: BytePos(end as u32), + expn_id: NO_EXPANSION, + } +} + +fn make_pos(file_text: &str, pos: &Position) -> usize { + let mut remainder = file_text; + let mut offset = 0; + for _ in 0..pos.count { + if let Some(n) = remainder.find(&pos.string) { + offset += n; + remainder = &remainder[n + 1..]; + } else { + panic!("failed to find {} instances of {:?} in {:?}", + pos.count, + pos.string, + file_text); + } + } + offset +} + +#[test] +fn ends_on_col0() { + test_harness(r#" +fn foo() { +} +"#, + vec![ + SpanLabel { + start: Position { + string: "{", + count: 1, + }, + end: Position { + string: "}", + count: 1, + }, + label: "test", + }, + ], + r#" +error: foo + --> test.rs:2:10 + | +2 | fn foo() { + | __________^ starting here... +3 | | } + | |_^ ...ending here: test + +"#); +} + +#[test] +fn ends_on_col2() { + test_harness(r#" +fn foo() { + + + } +"#, + vec![ + SpanLabel { + start: Position { + string: "{", + count: 1, + }, + end: Position { + string: "}", + count: 1, + }, + label: "test", + }, + ], + r#" +error: foo + --> test.rs:2:10 + | +2 | fn foo() { + | __________^ starting here... +3 | | +4 | | +5 | | } + | |___^ ...ending here: test + +"#); +} +#[test] +fn non_nested() { + test_harness(r#" +fn foo() { + X0 Y0 + X1 Y1 + X2 Y2 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "X0", + count: 1, + }, + end: Position { + string: "X2", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "Y0", + count: 1, + }, + end: Position { + string: "Y2", + count: 1, + }, + label: "`Y` is a good letter too", + }, + ], + r#" +error: foo + --> test.rs:3:3 + | +3 | X0 Y0 + | ____^__- starting here... + | | ___| + | || starting here... +4 | || X1 Y1 +5 | || X2 Y2 + | ||____^__- ...ending here: `Y` is a good letter too + | |____| + | ...ending here: `X` is a good letter + +"#); +} + +#[test] +fn nested() { + test_harness(r#" +fn foo() { + X0 Y0 + Y1 X1 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "X0", + count: 1, + }, + end: Position { + string: "X1", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "Y0", + count: 1, + }, + end: Position { + string: "Y1", + count: 1, + }, + label: "`Y` is a good letter too", + }, + ], +r#" +error: foo + --> test.rs:3:3 + | +3 | X0 Y0 + | ____^__- starting here... + | | ___| + | || starting here... +4 | || Y1 X1 + | ||____-__^ ...ending here: `X` is a good letter + | |_____| + | ...ending here: `Y` is a good letter too + +"#); +} + +#[test] +fn different_overlap() { + test_harness(r#" +fn foo() { + X0 Y0 Z0 + X1 Y1 Z1 + X2 Y2 Z2 + X3 Y3 Z3 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "Y0", + count: 1, + }, + end: Position { + string: "X2", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "Z1", + count: 1, + }, + end: Position { + string: "X3", + count: 1, + }, + label: "`Y` is a good letter too", + }, + ], + r#" +error: foo + --> test.rs:3:6 + | +3 | X0 Y0 Z0 + | ______^ starting here... +4 | | X1 Y1 Z1 + | |_________- starting here... +5 | || X2 Y2 Z2 + | ||____^ ...ending here: `X` is a good letter +6 | | X3 Y3 Z3 + | |_____- ...ending here: `Y` is a good letter too + +"#); +} + +#[test] +fn triple_overlap() { + test_harness(r#" +fn foo() { + X0 Y0 Z0 + X1 Y1 Z1 + X2 Y2 Z2 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "X0", + count: 1, + }, + end: Position { + string: "X2", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "Y0", + count: 1, + }, + end: Position { + string: "Y2", + count: 1, + }, + label: "`Y` is a good letter too", + }, + SpanLabel { + start: Position { + string: "Z0", + count: 1, + }, + end: Position { + string: "Z2", + count: 1, + }, + label: "`Z` label", + }, + ], + r#" +error: foo + --> test.rs:3:3 + | +3 | X0 Y0 Z0 + | _____^__-__- starting here... + | | ____|__| + | || ___| starting here... + | ||| starting here... +4 | ||| X1 Y1 Z1 +5 | ||| X2 Y2 Z2 + | |||____^__-__- ...ending here: `Z` label + | ||____|__| + | |____| ...ending here: `Y` is a good letter too + | ...ending here: `X` is a good letter + +"#); +} + +#[test] +fn minimum_depth() { + test_harness(r#" +fn foo() { + X0 Y0 Z0 + X1 Y1 Z1 + X2 Y2 Z2 + X3 Y3 Z3 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "Y0", + count: 1, + }, + end: Position { + string: "X1", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "Y1", + count: 1, + }, + end: Position { + string: "Z2", + count: 1, + }, + label: "`Y` is a good letter too", + }, + SpanLabel { + start: Position { + string: "X2", + count: 1, + }, + end: Position { + string: "Y3", + count: 1, + }, + label: "`Z`", + }, + ], + r#" +error: foo + --> test.rs:3:6 + | +3 | X0 Y0 Z0 + | ______^ starting here... +4 | | X1 Y1 Z1 + | |____^_- starting here... + | ||____| + | | ...ending here: `X` is a good letter +5 | | X2 Y2 Z2 + | |____-______- ...ending here: `Y` is a good letter too + | ____| + | | starting here... +6 | | X3 Y3 Z3 + | |________- ...ending here: `Z` + +"#); +} + +#[test] +fn non_overlaping() { + test_harness(r#" +fn foo() { + X0 Y0 Z0 + X1 Y1 Z1 + X2 Y2 Z2 + X3 Y3 Z3 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "Y0", + count: 1, + }, + end: Position { + string: "X1", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "Y2", + count: 1, + }, + end: Position { + string: "Z3", + count: 1, + }, + label: "`Y` is a good letter too", + }, + ], + r#" +error: foo + --> test.rs:3:6 + | +3 | X0 Y0 Z0 + | ______^ starting here... +4 | | X1 Y1 Z1 + | |____^ ...ending here: `X` is a good letter +5 | X2 Y2 Z2 + | ______- starting here... +6 | | X3 Y3 Z3 + | |__________- ...ending here: `Y` is a good letter too + +"#); +} +#[test] +fn overlaping_start_and_end() { + test_harness(r#" +fn foo() { + X0 Y0 Z0 + X1 Y1 Z1 + X2 Y2 Z2 + X3 Y3 Z3 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "Y0", + count: 1, + }, + end: Position { + string: "X1", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "Z1", + count: 1, + }, + end: Position { + string: "Z3", + count: 1, + }, + label: "`Y` is a good letter too", + }, + ], + r#" +error: foo + --> test.rs:3:6 + | +3 | X0 Y0 Z0 + | ______^ starting here... +4 | | X1 Y1 Z1 + | |____^____- starting here... + | ||____| + | | ...ending here: `X` is a good letter +5 | | X2 Y2 Z2 +6 | | X3 Y3 Z3 + | |___________- ...ending here: `Y` is a good letter too + +"#); +} diff --git a/third_party/rust/syntex_syntax/src/tokenstream.rs b/third_party/rust/syntex_syntax/src/tokenstream.rs new file mode 100644 index 000000000000..e352e7853c71 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/tokenstream.rs @@ -0,0 +1,1128 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! # Token Streams +//! +//! TokenStreams represent syntactic objects before they are converted into ASTs. +//! A `TokenStream` is, roughly speaking, a sequence (eg stream) of `TokenTree`s, +//! which are themselves either a single Token, a Delimited subsequence of tokens, +//! or a SequenceRepetition specifier (for the purpose of sequence generation during macro +//! expansion). +//! +//! ## Ownership +//! TokenStreams are persistant data structures construced as ropes with reference +//! counted-children. In general, this means that calling an operation on a TokenStream +//! (such as `slice`) produces an entirely new TokenStream from the borrowed reference to +//! the original. This essentially coerces TokenStreams into 'views' of their subparts, +//! and a borrowed TokenStream is sufficient to build an owned TokenStream without taking +//! ownership of the original. + +use ast::{self, AttrStyle, LitKind}; +use syntax_pos::{Span, DUMMY_SP, NO_EXPANSION}; +use codemap::{Spanned, combine_spans}; +use ext::base; +use ext::tt::macro_parser; +use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration}; +use parse::lexer; +use parse::{self, Directory}; +use parse::token::{self, Token, Lit, Nonterminal}; +use print::pprust; +use symbol::Symbol; + +use std::fmt; +use std::iter::*; +use std::ops::{self, Index}; +use std::rc::Rc; + +/// A delimited sequence of token trees +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct Delimited { + /// The type of delimiter + pub delim: token::DelimToken, + /// The span covering the opening delimiter + pub open_span: Span, + /// The delimited sequence of token trees + pub tts: Vec, + /// The span covering the closing delimiter + pub close_span: Span, +} + +impl Delimited { + /// Returns the opening delimiter as a token. + pub fn open_token(&self) -> token::Token { + token::OpenDelim(self.delim) + } + + /// Returns the closing delimiter as a token. + pub fn close_token(&self) -> token::Token { + token::CloseDelim(self.delim) + } + + /// Returns the opening delimiter as a token tree. + pub fn open_tt(&self) -> TokenTree { + TokenTree::Token(self.open_span, self.open_token()) + } + + /// Returns the closing delimiter as a token tree. + pub fn close_tt(&self) -> TokenTree { + TokenTree::Token(self.close_span, self.close_token()) + } + + /// Returns the token trees inside the delimiters. + pub fn subtrees(&self) -> &[TokenTree] { + &self.tts + } +} + +/// A sequence of token trees +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct SequenceRepetition { + /// The sequence of token trees + pub tts: Vec, + /// The optional separator + pub separator: Option, + /// Whether the sequence can be repeated zero (*), or one or more times (+) + pub op: KleeneOp, + /// The number of `MatchNt`s that appear in the sequence (and subsequences) + pub num_captures: usize, +} + +/// A Kleene-style [repetition operator](http://en.wikipedia.org/wiki/Kleene_star) +/// for token sequences. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +pub enum KleeneOp { + ZeroOrMore, + OneOrMore, +} + +/// When the main rust parser encounters a syntax-extension invocation, it +/// parses the arguments to the invocation as a token-tree. This is a very +/// loose structure, such that all sorts of different AST-fragments can +/// be passed to syntax extensions using a uniform type. +/// +/// If the syntax extension is an MBE macro, it will attempt to match its +/// LHS token tree against the provided token tree, and if it finds a +/// match, will transcribe the RHS token tree, splicing in any captured +/// macro_parser::matched_nonterminals into the `SubstNt`s it finds. +/// +/// The RHS of an MBE macro is the only place `SubstNt`s are substituted. +/// Nothing special happens to misnamed or misplaced `SubstNt`s. +#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +pub enum TokenTree { + /// A single token + Token(Span, token::Token), + /// A delimited sequence of token trees + Delimited(Span, Rc), + + // This only makes sense in MBE macros. + /// A kleene-style repetition sequence with a span + Sequence(Span, Rc), +} + +impl TokenTree { + pub fn len(&self) -> usize { + match *self { + TokenTree::Token(_, token::DocComment(name)) => { + match doc_comment_style(&name.as_str()) { + AttrStyle::Outer => 2, + AttrStyle::Inner => 3, + } + } + TokenTree::Token(_, token::Interpolated(ref nt)) => { + if let Nonterminal::NtTT(..) = **nt { 1 } else { 0 } + }, + TokenTree::Token(_, token::MatchNt(..)) => 3, + TokenTree::Delimited(_, ref delimed) => delimed.tts.len() + 2, + TokenTree::Sequence(_, ref seq) => seq.tts.len(), + TokenTree::Token(..) => 0, + } + } + + pub fn get_tt(&self, index: usize) -> TokenTree { + match (self, index) { + (&TokenTree::Token(sp, token::DocComment(_)), 0) => TokenTree::Token(sp, token::Pound), + (&TokenTree::Token(sp, token::DocComment(name)), 1) + if doc_comment_style(&name.as_str()) == AttrStyle::Inner => { + TokenTree::Token(sp, token::Not) + } + (&TokenTree::Token(sp, token::DocComment(name)), _) => { + let stripped = strip_doc_comment_decoration(&name.as_str()); + + // Searches for the occurrences of `"#*` and returns the minimum number of `#`s + // required to wrap the text. + let num_of_hashes = stripped.chars() + .scan(0, |cnt, x| { + *cnt = if x == '"' { + 1 + } else if *cnt != 0 && x == '#' { + *cnt + 1 + } else { + 0 + }; + Some(*cnt) + }) + .max() + .unwrap_or(0); + + TokenTree::Delimited(sp, Rc::new(Delimited { + delim: token::Bracket, + open_span: sp, + tts: vec![TokenTree::Token(sp, token::Ident(ast::Ident::from_str("doc"))), + TokenTree::Token(sp, token::Eq), + TokenTree::Token(sp, token::Literal( + token::StrRaw(Symbol::intern(&stripped), num_of_hashes), None))], + close_span: sp, + })) + } + (&TokenTree::Delimited(_, ref delimed), _) => { + if index == 0 { + return delimed.open_tt(); + } + if index == delimed.tts.len() + 1 { + return delimed.close_tt(); + } + delimed.tts[index - 1].clone() + } + (&TokenTree::Token(sp, token::MatchNt(name, kind)), _) => { + let v = [TokenTree::Token(sp, token::SubstNt(name)), + TokenTree::Token(sp, token::Colon), + TokenTree::Token(sp, token::Ident(kind))]; + v[index].clone() + } + (&TokenTree::Sequence(_, ref seq), _) => seq.tts[index].clone(), + _ => panic!("Cannot expand a token tree"), + } + } + + /// Returns the `Span` corresponding to this token tree. + pub fn get_span(&self) -> Span { + match *self { + TokenTree::Token(span, _) => span, + TokenTree::Delimited(span, _) => span, + TokenTree::Sequence(span, _) => span, + } + } + + /// Use this token tree as a matcher to parse given tts. + pub fn parse(cx: &base::ExtCtxt, + mtch: &[TokenTree], + tts: &[TokenTree]) + -> macro_parser::NamedParseResult { + let diag = &cx.parse_sess().span_diagnostic; + // `None` is because we're not interpolating + let arg_rdr = lexer::new_tt_reader(diag, None, tts.iter().cloned().collect()); + let directory = Directory { + path: cx.current_expansion.module.directory.clone(), + ownership: cx.current_expansion.directory_ownership, + }; + macro_parser::parse(cx.parse_sess(), arg_rdr, mtch, Some(directory)) + } + + /// Check if this TokenTree is equal to the other, regardless of span information. + pub fn eq_unspanned(&self, other: &TokenTree) -> bool { + match (self, other) { + (&TokenTree::Token(_, ref tk), &TokenTree::Token(_, ref tk2)) => tk == tk2, + (&TokenTree::Delimited(_, ref dl), &TokenTree::Delimited(_, ref dl2)) => { + (*dl).delim == (*dl2).delim && dl.tts.len() == dl2.tts.len() && + { + for (tt1, tt2) in dl.tts.iter().zip(dl2.tts.iter()) { + if !tt1.eq_unspanned(tt2) { + return false; + } + } + true + } + } + (_, _) => false, + } + } + + /// Retrieve the TokenTree's span. + pub fn span(&self) -> Span { + match *self { + TokenTree::Token(sp, _) | + TokenTree::Delimited(sp, _) | + TokenTree::Sequence(sp, _) => sp, + } + } + + /// Indicates if the stream is a token that is equal to the provided token. + pub fn eq_token(&self, t: Token) -> bool { + match *self { + TokenTree::Token(_, ref tk) => *tk == t, + _ => false, + } + } + + /// Indicates if the token is an identifier. + pub fn is_ident(&self) -> bool { + self.maybe_ident().is_some() + } + + /// Returns an identifier. + pub fn maybe_ident(&self) -> Option { + match *self { + TokenTree::Token(_, Token::Ident(t)) => Some(t.clone()), + TokenTree::Delimited(_, ref dl) => { + let tts = dl.subtrees(); + if tts.len() != 1 { + return None; + } + tts[0].maybe_ident() + } + _ => None, + } + } + + /// Returns a Token literal. + pub fn maybe_lit(&self) -> Option { + match *self { + TokenTree::Token(_, Token::Literal(l, _)) => Some(l.clone()), + TokenTree::Delimited(_, ref dl) => { + let tts = dl.subtrees(); + if tts.len() != 1 { + return None; + } + tts[0].maybe_lit() + } + _ => None, + } + } + + /// Returns an AST string literal. + pub fn maybe_str(&self) -> Option { + match *self { + TokenTree::Token(sp, Token::Literal(Lit::Str_(s), _)) => { + let l = LitKind::Str(Symbol::intern(&parse::str_lit(&s.as_str())), + ast::StrStyle::Cooked); + Some(Spanned { + node: l, + span: sp, + }) + } + TokenTree::Token(sp, Token::Literal(Lit::StrRaw(s, n), _)) => { + let l = LitKind::Str(Symbol::intern(&parse::raw_str_lit(&s.as_str())), + ast::StrStyle::Raw(n)); + Some(Spanned { + node: l, + span: sp, + }) + } + _ => None, + } + } +} + +/// #Token Streams +/// +/// TokenStreams are a syntactic abstraction over TokenTrees. The goal is for procedural +/// macros to work over TokenStreams instead of arbitrary syntax. For now, however, we +/// are going to cut a few corners (i.e., use some of the AST structure) when we need to +/// for backwards compatibility. + +/// TokenStreams are collections of TokenTrees that represent a syntactic structure. The +/// struct itself shouldn't be directly manipulated; the internal structure is not stable, +/// and may be changed at any time in the future. The operators will not, however (except +/// for signatures, later on). +#[derive(Clone, Eq, Hash, RustcEncodable, RustcDecodable)] +pub struct TokenStream { + ts: InternalTS, +} + +// This indicates the maximum size for a leaf in the concatenation algorithm. +// If two leafs will be collectively smaller than this, they will be merged. +// If a leaf is larger than this, it will be concatenated at the top. +const LEAF_SIZE : usize = 32; + +// NB If Leaf access proves to be slow, inroducing a secondary Leaf without the bounds +// for unsliced Leafs may lead to some performance improvemenet. +#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +pub enum InternalTS { + Empty(Span), + Leaf { + tts: Rc>, + offset: usize, + len: usize, + sp: Span, + }, + Node { + left: Rc, + right: Rc, + len: usize, + sp: Span, + }, +} + +impl fmt::Debug for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.ts.fmt(f) + } +} + +impl fmt::Debug for InternalTS { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + InternalTS::Empty(..) => Ok(()), + InternalTS::Leaf { ref tts, offset, len, .. } => { + for t in tts.iter().skip(offset).take(len) { + try!(write!(f, "{:?}", t)); + } + Ok(()) + } + InternalTS::Node { ref left, ref right, .. } => { + try!(left.fmt(f)); + right.fmt(f) + } + } + } +} + +/// Checks if two TokenStreams are equivalent (including spans). For unspanned +/// equality, see `eq_unspanned`. +impl PartialEq for TokenStream { + fn eq(&self, other: &TokenStream) -> bool { + self.iter().eq(other.iter()) + } +} + +// NB this will disregard gaps. if we have [a|{2,5} , b|{11,13}], the resultant span +// will be at {2,13}. Without finer-grained span structures, however, this seems to be +// our only recourse. +// FIXME Do something smarter to compute the expansion id. +fn covering_span(trees: &[TokenTree]) -> Span { + // disregard any dummy spans we have + let trees = trees.iter().filter(|t| t.span() != DUMMY_SP).collect::>(); + + // if we're out of spans, stop + if trees.len() < 1 { + return DUMMY_SP; + } + + // set up the initial values + let fst_span = trees[0].span(); + + let mut lo_span = fst_span.lo; + let mut hi_span = fst_span.hi; + let mut expn_id = fst_span.expn_id; + + // compute the spans iteratively + for t in trees.iter().skip(1) { + let sp = t.span(); + if sp.lo < lo_span { + lo_span = sp.lo; + } + if hi_span < sp.hi { + hi_span = sp.hi; + } + if expn_id != sp.expn_id { + expn_id = NO_EXPANSION; + } + } + + Span { + lo: lo_span, + hi: hi_span, + expn_id: expn_id, + } +} + +impl InternalTS { + fn len(&self) -> usize { + match *self { + InternalTS::Empty(..) => 0, + InternalTS::Leaf { len, .. } => len, + InternalTS::Node { len, .. } => len, + } + } + + fn span(&self) -> Span { + match *self { + InternalTS::Empty(sp) | + InternalTS::Leaf { sp, .. } | + InternalTS::Node { sp, .. } => sp, + } + } + + fn slice(&self, range: ops::Range) -> TokenStream { + let from = range.start; + let to = range.end; + if from == to { + return TokenStream::mk_empty(); + } + if from > to { + panic!("Invalid range: {} to {}", from, to); + } + if from == 0 && to == self.len() { + return TokenStream { ts: self.clone() }; /* should be cheap */ + } + match *self { + InternalTS::Empty(..) => panic!("Invalid index"), + InternalTS::Leaf { ref tts, offset, .. } => { + let offset = offset + from; + let len = to - from; + TokenStream::mk_sub_leaf(tts.clone(), + offset, + len, + covering_span(&tts[offset..offset + len])) + } + InternalTS::Node { ref left, ref right, .. } => { + let left_len = left.len(); + if to <= left_len { + left.slice(range) + } else if from >= left_len { + right.slice(from - left_len..to - left_len) + } else { + TokenStream::concat(left.slice(from..left_len), right.slice(0..to - left_len)) + } + } + } + } + + fn to_vec(&self) -> Vec<&TokenTree> { + let mut res = Vec::with_capacity(self.len()); + fn traverse_and_append<'a>(res: &mut Vec<&'a TokenTree>, ts: &'a InternalTS) { + match *ts { + InternalTS::Empty(..) => {}, + InternalTS::Leaf { ref tts, offset, len, .. } => { + let mut to_app = tts[offset..offset + len].iter().collect(); + res.append(&mut to_app); + } + InternalTS::Node { ref left, ref right, .. } => { + traverse_and_append(res, left); + traverse_and_append(res, right); + } + } + } + traverse_and_append(&mut res, self); + res + } + + fn to_tts(&self) -> Vec { + self.to_vec().into_iter().cloned().collect::>() + } + + // Returns an internal node's children. + fn children(&self) -> Option<(Rc, Rc)> { + match *self { + InternalTS::Node { ref left, ref right, .. } => Some((left.clone(), right.clone())), + _ => None, + } + } +} + +/// TokenStream operators include basic destructuring, boolean operations, `maybe_...` +/// operations, and `maybe_..._prefix` operations. Boolean operations are straightforward, +/// indicating information about the structure of the stream. The `maybe_...` operations +/// return `Some<...>` if the tokenstream contains the appropriate item. +/// +/// Similarly, the `maybe_..._prefix` operations potentially return a +/// partially-destructured stream as a pair where the first element is the expected item +/// and the second is the remainder of the stream. As anb example, +/// +/// `maybe_path_prefix("a::b::c(a,b,c).foo()") -> (a::b::c, "(a,b,c).foo()")` +impl TokenStream { + // Construct an empty node with a dummy span. + pub fn mk_empty() -> TokenStream { + TokenStream { ts: InternalTS::Empty(DUMMY_SP) } + } + + // Construct an empty node with the provided span. + fn mk_spanned_empty(sp: Span) -> TokenStream { + TokenStream { ts: InternalTS::Empty(sp) } + } + + // Construct a leaf node with a 0 offset and length equivalent to the input. + fn mk_leaf(tts: Rc>, sp: Span) -> TokenStream { + let len = tts.len(); + TokenStream { + ts: InternalTS::Leaf { + tts: tts, + offset: 0, + len: len, + sp: sp, + }, + } + } + + // Construct a leaf node with the provided values. + fn mk_sub_leaf(tts: Rc>, offset: usize, len: usize, sp: Span) -> TokenStream { + TokenStream { + ts: InternalTS::Leaf { + tts: tts, + offset: offset, + len: len, + sp: sp, + }, + } + } + + // Construct an internal node with the provided values. + fn mk_int_node(left: Rc, + right: Rc, + len: usize, + sp: Span) + -> TokenStream { + TokenStream { + ts: InternalTS::Node { + left: left, + right: right, + len: len, + sp: sp, + }, + } + } + + /// Convert a vector of `TokenTree`s into a `TokenStream`. + pub fn from_tts(trees: Vec) -> TokenStream { + let span = covering_span(&trees[..]); + TokenStream::mk_leaf(Rc::new(trees), span) + } + + /// Convert a vector of Tokens into a TokenStream. + pub fn from_tokens(tokens: Vec) -> TokenStream { + // FIXME do something nicer with the spans + TokenStream::from_tts(tokens.into_iter().map(|t| TokenTree::Token(DUMMY_SP, t)).collect()) + } + + /// Manually change a TokenStream's span. + pub fn respan(self, span: Span) -> TokenStream { + match self.ts { + InternalTS::Empty(..) => TokenStream::mk_spanned_empty(span), + InternalTS::Leaf { tts, offset, len, .. } => { + TokenStream::mk_sub_leaf(tts, offset, len, span) + } + InternalTS::Node { left, right, len, .. } => { + TokenStream::mk_int_node(left, right, len, span) + } + } + } + + /// Concatenates two TokenStreams into a new TokenStream. + pub fn concat(left: TokenStream, right: TokenStream) -> TokenStream { + // This internal procedure performs 'aggressive compacting' during concatenation as + // follows: + // - If the nodes' combined total total length is less than 32, we copy both of + // them into a new vector and build a new leaf node. + // - If one node is an internal node and the other is a 'small' leaf (length<32), + // we recur down the internal node on the appropriate side. + // - Otherwise, we construct a new internal node that points to them as left and + // right. + fn concat_internal(left: Rc, right: Rc) -> TokenStream { + let llen = left.len(); + let rlen = right.len(); + let len = llen + rlen; + let span = combine_spans(left.span(), right.span()); + if len <= LEAF_SIZE { + let mut new_vec = left.to_tts(); + let mut rvec = right.to_tts(); + new_vec.append(&mut rvec); + return TokenStream::mk_leaf(Rc::new(new_vec), span); + } + + match (left.children(), right.children()) { + (Some((lleft, lright)), None) => { + if rlen <= LEAF_SIZE { + let new_right = concat_internal(lright, right); + TokenStream::mk_int_node(lleft, Rc::new(new_right.ts), len, span) + } else { + TokenStream::mk_int_node(left, right, len, span) + } + } + (None, Some((rleft, rright))) => { + if rlen <= LEAF_SIZE { + let new_left = concat_internal(left, rleft); + TokenStream::mk_int_node(Rc::new(new_left.ts), rright, len, span) + } else { + TokenStream::mk_int_node(left, right, len, span) + } + } + (_, _) => TokenStream::mk_int_node(left, right, len, span), + } + } + + if left.is_empty() { + right + } else if right.is_empty() { + left + } else { + concat_internal(Rc::new(left.ts), Rc::new(right.ts)) + } + } + + /// Indicate if the TokenStream is empty. + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + + /// Return a TokenStream's length. + pub fn len(&self) -> usize { + self.ts.len() + } + + /// Convert a TokenStream into a vector of borrowed TokenTrees. + pub fn to_vec(&self) -> Vec<&TokenTree> { + self.ts.to_vec() + } + + /// Convert a TokenStream into a vector of TokenTrees (by cloning the TokenTrees). + /// (This operation is an O(n) deep copy of the underlying structure.) + pub fn to_tts(&self) -> Vec { + self.ts.to_tts() + } + + /// Return the TokenStream's span. + pub fn span(&self) -> Span { + self.ts.span() + } + + /// Returns an iterator over a TokenStream (as a sequence of TokenTrees). + pub fn iter<'a>(&self) -> Iter { + Iter { vs: self, idx: 0 } + } + + /// Splits a TokenStream based on the provided `&TokenTree -> bool` predicate. + pub fn split

(&self, pred: P) -> Split

+ where P: FnMut(&TokenTree) -> bool + { + Split { + vs: self, + pred: pred, + finished: false, + idx: 0, + } + } + + /// Produce a slice of the input TokenStream from the `from` index, inclusive, to the + /// `to` index, non-inclusive. + pub fn slice(&self, range: ops::Range) -> TokenStream { + self.ts.slice(range) + } + + /// Slice starting at the provided index, inclusive. + pub fn slice_from(&self, from: ops::RangeFrom) -> TokenStream { + self.slice(from.start..self.len()) + } + + /// Slice up to the provided index, non-inclusive. + pub fn slice_to(&self, to: ops::RangeTo) -> TokenStream { + self.slice(0..to.end) + } + + /// Indicates where the stream is a single, delimited expression (e.g., `(a,b,c)` or + /// `{a,b,c}`). + pub fn is_delimited(&self) -> bool { + self.maybe_delimited().is_some() + } + + /// Returns the inside of the delimited term as a new TokenStream. + pub fn maybe_delimited(&self) -> Option { + if !(self.len() == 1) { + return None; + } + + // FIXME It would be nice to change Delimited to move the Rc around the TokenTree + // vector directly in order to avoid the clone here. + match self[0] { + TokenTree::Delimited(_, ref rc) => Some(TokenStream::from_tts(rc.tts.clone())), + _ => None, + } + } + + /// Indicates if the stream is exactly one identifier. + pub fn is_ident(&self) -> bool { + self.maybe_ident().is_some() + } + + /// Returns an identifier + pub fn maybe_ident(&self) -> Option { + if !(self.len() == 1) { + return None; + } + + match self[0] { + TokenTree::Token(_, Token::Ident(t)) => Some(t), + _ => None, + } + } + + /// Compares two TokenStreams, checking equality without regarding span information. + pub fn eq_unspanned(&self, other: &TokenStream) -> bool { + for (t1, t2) in self.iter().zip(other.iter()) { + if !t1.eq_unspanned(t2) { + return false; + } + } + true + } + + /// Convert a vector of TokenTrees into a parentheses-delimited TokenStream. + pub fn as_delimited_stream(tts: Vec, delim: token::DelimToken) -> TokenStream { + let new_sp = covering_span(&tts); + + let new_delim = Rc::new(Delimited { + delim: delim, + open_span: DUMMY_SP, + tts: tts, + close_span: DUMMY_SP, + }); + + TokenStream::from_tts(vec![TokenTree::Delimited(new_sp, new_delim)]) + } +} + +impl fmt::Display for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str(&pprust::tts_to_string(&self.to_tts())) + } +} + +// FIXME Reimplement this iterator to hold onto a slice iterator for a leaf, getting the +// next leaf's iterator when the current one is exhausted. +pub struct Iter<'a> { + vs: &'a TokenStream, + idx: usize, +} + +impl<'a> Iterator for Iter<'a> { + type Item = &'a TokenTree; + + fn next(&mut self) -> Option<&'a TokenTree> { + if self.vs.is_empty() || self.idx >= self.vs.len() { + return None; + } + + let ret = Some(&self.vs[self.idx]); + self.idx = self.idx + 1; + ret + } +} + +pub struct Split<'a, P> + where P: FnMut(&TokenTree) -> bool +{ + vs: &'a TokenStream, + pred: P, + finished: bool, + idx: usize, +} + +impl<'a, P> Iterator for Split<'a, P> + where P: FnMut(&TokenTree) -> bool +{ + type Item = TokenStream; + + fn next(&mut self) -> Option { + if self.finished { + return None; + } + if self.idx >= self.vs.len() { + self.finished = true; + return None; + } + + let mut lookup = self.vs.iter().skip(self.idx); + match lookup.position(|x| (self.pred)(&x)) { + None => { + self.finished = true; + Some(self.vs.slice_from(self.idx..)) + } + Some(edx) => { + let ret = Some(self.vs.slice(self.idx..self.idx + edx)); + self.idx += edx + 1; + ret + } + } + } +} + +impl Index for TokenStream { + type Output = TokenTree; + + fn index(&self, index: usize) -> &TokenTree { + &self.ts[index] + } +} + +impl Index for InternalTS { + type Output = TokenTree; + + fn index(&self, index: usize) -> &TokenTree { + if self.len() <= index { + panic!("Index {} too large for {:?}", index, self); + } + match *self { + InternalTS::Empty(..) => panic!("Invalid index"), + InternalTS::Leaf { ref tts, offset, .. } => tts.get(index + offset).unwrap(), + InternalTS::Node { ref left, ref right, .. } => { + let left_len = left.len(); + if index < left_len { + Index::index(&**left, index) + } else { + Index::index(&**right, index - left_len) + } + } + } + } +} + + +#[cfg(test)] +mod tests { + use super::*; + use syntax::ast::Ident; + use syntax_pos::{Span, BytePos, NO_EXPANSION, DUMMY_SP}; + use parse::token::{self, Token}; + use util::parser_testing::string_to_tts; + use std::rc::Rc; + + fn sp(a: u32, b: u32) -> Span { + Span { + lo: BytePos(a), + hi: BytePos(b), + expn_id: NO_EXPANSION, + } + } + + fn as_paren_delimited_stream(tts: Vec) -> TokenStream { + TokenStream::as_delimited_stream(tts, token::DelimToken::Paren) + } + + #[test] + fn test_concat() { + let test_res = TokenStream::from_tts(string_to_tts("foo::bar::baz".to_string())); + let test_fst = TokenStream::from_tts(string_to_tts("foo::bar".to_string())); + let test_snd = TokenStream::from_tts(string_to_tts("::baz".to_string())); + let eq_res = TokenStream::concat(test_fst, test_snd); + assert_eq!(test_res.len(), 5); + assert_eq!(eq_res.len(), 5); + assert_eq!(test_res.eq_unspanned(&eq_res), true); + } + + #[test] + fn test_from_to_bijection() { + let test_start = string_to_tts("foo::bar(baz)".to_string()); + let test_end = TokenStream::from_tts(string_to_tts("foo::bar(baz)".to_string())).to_tts(); + assert_eq!(test_start, test_end) + } + + #[test] + fn test_to_from_bijection() { + let test_start = TokenStream::from_tts(string_to_tts("foo::bar(baz)".to_string())); + let test_end = TokenStream::from_tts(test_start.clone().to_tts()); + assert_eq!(test_start, test_end) + } + + #[test] + fn test_eq_0() { + let test_res = TokenStream::from_tts(string_to_tts("foo".to_string())); + let test_eqs = TokenStream::from_tts(string_to_tts("foo".to_string())); + assert_eq!(test_res, test_eqs) + } + + #[test] + fn test_eq_1() { + let test_res = TokenStream::from_tts(string_to_tts("::bar::baz".to_string())); + let test_eqs = TokenStream::from_tts(string_to_tts("::bar::baz".to_string())); + assert_eq!(test_res, test_eqs) + } + + #[test] + fn test_eq_2() { + let test_res = TokenStream::from_tts(string_to_tts("foo::bar".to_string())); + let test_eqs = TokenStream::from_tts(string_to_tts("foo::bar::baz".to_string())); + assert_eq!(test_res, test_eqs.slice(0..3)) + } + + #[test] + fn test_eq_3() { + let test_res = TokenStream::from_tts(string_to_tts("".to_string())); + let test_eqs = TokenStream::from_tts(string_to_tts("".to_string())); + assert_eq!(test_res, test_eqs) + } + + #[test] + fn test_diseq_0() { + let test_res = TokenStream::from_tts(string_to_tts("::bar::baz".to_string())); + let test_eqs = TokenStream::from_tts(string_to_tts("bar::baz".to_string())); + assert_eq!(test_res == test_eqs, false) + } + + #[test] + fn test_diseq_1() { + let test_res = TokenStream::from_tts(string_to_tts("(bar,baz)".to_string())); + let test_eqs = TokenStream::from_tts(string_to_tts("bar,baz".to_string())); + assert_eq!(test_res == test_eqs, false) + } + + #[test] + fn test_slice_0() { + let test_res = TokenStream::from_tts(string_to_tts("foo::bar".to_string())); + let test_eqs = TokenStream::from_tts(string_to_tts("foo::bar::baz".to_string())); + assert_eq!(test_res, test_eqs.slice(0..3)) + } + + #[test] + fn test_slice_1() { + let test_res = TokenStream::from_tts(string_to_tts("foo::bar::baz".to_string())) + .slice(2..3); + let test_eqs = TokenStream::from_tts(vec![TokenTree::Token(sp(5,8), + token::Ident(Ident::from_str("bar")))]); + assert_eq!(test_res, test_eqs) + } + + #[test] + fn test_is_empty() { + let test0 = TokenStream::from_tts(Vec::new()); + let test1 = TokenStream::from_tts( + vec![TokenTree::Token(sp(0, 1), Token::Ident(Ident::from_str("a")))] + ); + + let test2 = TokenStream::from_tts(string_to_tts("foo(bar::baz)".to_string())); + + assert_eq!(test0.is_empty(), true); + assert_eq!(test1.is_empty(), false); + assert_eq!(test2.is_empty(), false); + } + + #[test] + fn test_is_delimited() { + let test0 = TokenStream::from_tts(string_to_tts("foo(bar::baz)".to_string())); + let test1 = TokenStream::from_tts(string_to_tts("(bar::baz)".to_string())); + let test2 = TokenStream::from_tts(string_to_tts("(foo,bar,baz)".to_string())); + let test3 = TokenStream::from_tts(string_to_tts("(foo,bar,baz)(zab,rab,oof)".to_string())); + let test4 = TokenStream::from_tts(string_to_tts("(foo,bar,baz)foo".to_string())); + let test5 = TokenStream::from_tts(string_to_tts("".to_string())); + + assert_eq!(test0.is_delimited(), false); + assert_eq!(test1.is_delimited(), true); + assert_eq!(test2.is_delimited(), true); + assert_eq!(test3.is_delimited(), false); + assert_eq!(test4.is_delimited(), false); + assert_eq!(test5.is_delimited(), false); + } + + #[test] + fn test_is_ident() { + let test0 = TokenStream::from_tts(string_to_tts("\"foo\"".to_string())); + let test1 = TokenStream::from_tts(string_to_tts("5".to_string())); + let test2 = TokenStream::from_tts(string_to_tts("foo".to_string())); + let test3 = TokenStream::from_tts(string_to_tts("foo::bar".to_string())); + let test4 = TokenStream::from_tts(string_to_tts("foo(bar)".to_string())); + + assert_eq!(test0.is_ident(), false); + assert_eq!(test1.is_ident(), false); + assert_eq!(test2.is_ident(), true); + assert_eq!(test3.is_ident(), false); + assert_eq!(test4.is_ident(), false); + } + + #[test] + fn test_maybe_delimited() { + let test0_input = TokenStream::from_tts(string_to_tts("foo(bar::baz)".to_string())); + let test1_input = TokenStream::from_tts(string_to_tts("(bar::baz)".to_string())); + let test2_input = TokenStream::from_tts(string_to_tts("(foo,bar,baz)".to_string())); + let test3_input = TokenStream::from_tts(string_to_tts("(foo,bar,baz)(zab,rab)" + .to_string())); + let test4_input = TokenStream::from_tts(string_to_tts("(foo,bar,baz)foo".to_string())); + let test5_input = TokenStream::from_tts(string_to_tts("".to_string())); + + let test0 = test0_input.maybe_delimited(); + let test1 = test1_input.maybe_delimited(); + let test2 = test2_input.maybe_delimited(); + let test3 = test3_input.maybe_delimited(); + let test4 = test4_input.maybe_delimited(); + let test5 = test5_input.maybe_delimited(); + + assert_eq!(test0, None); + + let test1_expected = TokenStream::from_tts(vec![TokenTree::Token(sp(1, 4), + token::Ident(Ident::from_str("bar"))), + TokenTree::Token(sp(4, 6), token::ModSep), + TokenTree::Token(sp(6, 9), + token::Ident(Ident::from_str("baz")))]); + assert_eq!(test1, Some(test1_expected)); + + let test2_expected = TokenStream::from_tts(vec![TokenTree::Token(sp(1, 4), + token::Ident(Ident::from_str("foo"))), + TokenTree::Token(sp(4, 5), token::Comma), + TokenTree::Token(sp(5, 8), + token::Ident(Ident::from_str("bar"))), + TokenTree::Token(sp(8, 9), token::Comma), + TokenTree::Token(sp(9, 12), + token::Ident(Ident::from_str("baz")))]); + assert_eq!(test2, Some(test2_expected)); + + assert_eq!(test3, None); + + assert_eq!(test4, None); + + assert_eq!(test5, None); + } + + // pub fn maybe_ident(&self) -> Option + #[test] + fn test_maybe_ident() { + let test0 = TokenStream::from_tts(string_to_tts("\"foo\"".to_string())).maybe_ident(); + let test1 = TokenStream::from_tts(string_to_tts("5".to_string())).maybe_ident(); + let test2 = TokenStream::from_tts(string_to_tts("foo".to_string())).maybe_ident(); + let test3 = TokenStream::from_tts(string_to_tts("foo::bar".to_string())).maybe_ident(); + let test4 = TokenStream::from_tts(string_to_tts("foo(bar)".to_string())).maybe_ident(); + + assert_eq!(test0, None); + assert_eq!(test1, None); + assert_eq!(test2, Some(Ident::from_str("foo"))); + assert_eq!(test3, None); + assert_eq!(test4, None); + } + + #[test] + fn test_as_delimited_stream() { + let test0 = as_paren_delimited_stream(string_to_tts("foo,bar,".to_string())); + let test1 = as_paren_delimited_stream(string_to_tts("baz(foo,bar)".to_string())); + + let test0_tts = vec![TokenTree::Token(sp(0, 3), token::Ident(Ident::from_str("foo"))), + TokenTree::Token(sp(3, 4), token::Comma), + TokenTree::Token(sp(4, 7), token::Ident(Ident::from_str("bar"))), + TokenTree::Token(sp(7, 8), token::Comma)]; + let test0_stream = TokenStream::from_tts(vec![TokenTree::Delimited(sp(0, 8), + Rc::new(Delimited { + delim: token::DelimToken::Paren, + open_span: DUMMY_SP, + tts: test0_tts, + close_span: DUMMY_SP, + }))]); + + assert_eq!(test0, test0_stream); + + + let test1_tts = vec![TokenTree::Token(sp(4, 7), token::Ident(Ident::from_str("foo"))), + TokenTree::Token(sp(7, 8), token::Comma), + TokenTree::Token(sp(8, 11), token::Ident(Ident::from_str("bar")))]; + + let test1_parse = vec![TokenTree::Token(sp(0, 3), token::Ident(Ident::from_str("baz"))), + TokenTree::Delimited(sp(3, 12), + Rc::new(Delimited { + delim: token::DelimToken::Paren, + open_span: sp(3, 4), + tts: test1_tts, + close_span: sp(11, 12), + }))]; + + let test1_stream = TokenStream::from_tts(vec![TokenTree::Delimited(sp(0, 12), + Rc::new(Delimited { + delim: token::DelimToken::Paren, + open_span: DUMMY_SP, + tts: test1_parse, + close_span: DUMMY_SP, + }))]); + + assert_eq!(test1, test1_stream); + } +} diff --git a/third_party/rust/syntex_syntax/src/util/lev_distance.rs b/third_party/rust/syntex_syntax/src/util/lev_distance.rs new file mode 100644 index 000000000000..a6fff2d70746 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/util/lev_distance.rs @@ -0,0 +1,84 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cmp; +use symbol::Symbol; + +/// To find the Levenshtein distance between two strings +pub fn lev_distance(a: &str, b: &str) -> usize { + // cases which don't require further computation + if a.is_empty() { + return b.chars().count(); + } else if b.is_empty() { + return a.chars().count(); + } + + let mut dcol: Vec<_> = (0..b.len() + 1).collect(); + let mut t_last = 0; + + for (i, sc) in a.chars().enumerate() { + let mut current = i; + dcol[0] = current + 1; + + for (j, tc) in b.chars().enumerate() { + let next = dcol[j + 1]; + if sc == tc { + dcol[j + 1] = current; + } else { + dcol[j + 1] = cmp::min(current, next); + dcol[j + 1] = cmp::min(dcol[j + 1], dcol[j]) + 1; + } + current = next; + t_last = j; + } + } dcol[t_last + 1] +} + +/// To find the best match for a given string from an iterator of names +/// As a loose rule to avoid the obviously incorrect suggestions, it takes +/// an optional limit for the maximum allowable edit distance, which defaults +/// to one-third of the given word +pub fn find_best_match_for_name<'a, T>(iter_names: T, + lookup: &str, + dist: Option) -> Option + where T: Iterator { + let max_dist = dist.map_or_else(|| cmp::max(lookup.len(), 3) / 3, |d| d); + iter_names + .filter_map(|&name| { + let dist = lev_distance(lookup, &name.as_str()); + match dist <= max_dist { // filter the unwanted cases + true => Some((name, dist)), + false => None, + } + }) + .min_by_key(|&(_, val)| val) // extract the tuple containing the minimum edit distance + .map(|(s, _)| s) // and return only the string +} + +#[test] +fn test_lev_distance() { + use std::char::{from_u32, MAX}; + // Test bytelength agnosticity + for c in (0..MAX as u32) + .filter_map(|i| from_u32(i)) + .map(|i| i.to_string()) { + assert_eq!(lev_distance(&c[..], &c[..]), 0); + } + + let a = "\nMäry häd ä little lämb\n\nLittle lämb\n"; + let b = "\nMary häd ä little lämb\n\nLittle lämb\n"; + let c = "Mary häd ä little lämb\n\nLittle lämb\n"; + assert_eq!(lev_distance(a, b), 1); + assert_eq!(lev_distance(b, a), 1); + assert_eq!(lev_distance(a, c), 2); + assert_eq!(lev_distance(c, a), 2); + assert_eq!(lev_distance(b, c), 1); + assert_eq!(lev_distance(c, b), 1); +} diff --git a/third_party/rust/syntex_syntax/src/util/move_map.rs b/third_party/rust/syntex_syntax/src/util/move_map.rs new file mode 100644 index 000000000000..e1078b719bf0 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/util/move_map.rs @@ -0,0 +1,77 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::ptr; + +pub trait MoveMap: Sized { + fn move_map(self, mut f: F) -> Self where F: FnMut(T) -> T { + self.move_flat_map(|e| Some(f(e))) + } + + fn move_flat_map(self, f: F) -> Self + where F: FnMut(T) -> I, + I: IntoIterator; +} + +impl MoveMap for Vec { + fn move_flat_map(mut self, mut f: F) -> Self + where F: FnMut(T) -> I, + I: IntoIterator + { + let mut read_i = 0; + let mut write_i = 0; + unsafe { + let mut old_len = self.len(); + self.set_len(0); // make sure we just leak elements in case of panic + + while read_i < old_len { + // move the read_i'th item out of the vector and map it + // to an iterator + let e = ptr::read(self.get_unchecked(read_i)); + let mut iter = f(e).into_iter(); + read_i += 1; + + while let Some(e) = iter.next() { + if write_i < read_i { + ptr::write(self.get_unchecked_mut(write_i), e); + write_i += 1; + } else { + // If this is reached we ran out of space + // in the middle of the vector. + // However, the vector is in a valid state here, + // so we just do a somewhat inefficient insert. + self.set_len(old_len); + self.insert(write_i, e); + + old_len = self.len(); + self.set_len(0); + + read_i += 1; + write_i += 1; + } + } + } + + // write_i tracks the number of actually written new items. + self.set_len(write_i); + } + + self + } +} + +impl MoveMap for ::ptr::P<[T]> { + fn move_flat_map(self, f: F) -> Self + where F: FnMut(T) -> I, + I: IntoIterator + { + ::ptr::P::from_vec(self.into_vec().move_flat_map(f)) + } +} diff --git a/third_party/rust/syntex_syntax/src/util/node_count.rs b/third_party/rust/syntex_syntax/src/util/node_count.rs new file mode 100644 index 000000000000..b90802d1e7eb --- /dev/null +++ b/third_party/rust/syntex_syntax/src/util/node_count.rs @@ -0,0 +1,156 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Simply gives a rought count of the number of nodes in an AST. + +use visit::*; +use ast::*; +use syntax_pos::Span; + +pub struct NodeCounter { + pub count: usize, +} + +impl NodeCounter { + pub fn new() -> NodeCounter { + NodeCounter { + count: 0, + } + } +} + +impl<'ast> Visitor<'ast> for NodeCounter { + fn visit_ident(&mut self, span: Span, ident: Ident) { + self.count += 1; + walk_ident(self, span, ident); + } + fn visit_mod(&mut self, m: &Mod, _s: Span, _n: NodeId) { + self.count += 1; + walk_mod(self, m) + } + fn visit_foreign_item(&mut self, i: &ForeignItem) { + self.count += 1; + walk_foreign_item(self, i) + } + fn visit_item(&mut self, i: &Item) { + self.count += 1; + walk_item(self, i) + } + fn visit_local(&mut self, l: &Local) { + self.count += 1; + walk_local(self, l) + } + fn visit_block(&mut self, b: &Block) { + self.count += 1; + walk_block(self, b) + } + fn visit_stmt(&mut self, s: &Stmt) { + self.count += 1; + walk_stmt(self, s) + } + fn visit_arm(&mut self, a: &Arm) { + self.count += 1; + walk_arm(self, a) + } + fn visit_pat(&mut self, p: &Pat) { + self.count += 1; + walk_pat(self, p) + } + fn visit_expr(&mut self, ex: &Expr) { + self.count += 1; + walk_expr(self, ex) + } + fn visit_ty(&mut self, t: &Ty) { + self.count += 1; + walk_ty(self, t) + } + fn visit_generics(&mut self, g: &Generics) { + self.count += 1; + walk_generics(self, g) + } + fn visit_fn(&mut self, fk: FnKind, fd: &FnDecl, s: Span, _: NodeId) { + self.count += 1; + walk_fn(self, fk, fd, s) + } + fn visit_trait_item(&mut self, ti: &TraitItem) { + self.count += 1; + walk_trait_item(self, ti) + } + fn visit_impl_item(&mut self, ii: &ImplItem) { + self.count += 1; + walk_impl_item(self, ii) + } + fn visit_trait_ref(&mut self, t: &TraitRef) { + self.count += 1; + walk_trait_ref(self, t) + } + fn visit_ty_param_bound(&mut self, bounds: &TyParamBound) { + self.count += 1; + walk_ty_param_bound(self, bounds) + } + fn visit_poly_trait_ref(&mut self, t: &PolyTraitRef, m: &TraitBoundModifier) { + self.count += 1; + walk_poly_trait_ref(self, t, m) + } + fn visit_variant_data(&mut self, s: &VariantData, _: Ident, + _: &Generics, _: NodeId, _: Span) { + self.count += 1; + walk_struct_def(self, s) + } + fn visit_struct_field(&mut self, s: &StructField) { + self.count += 1; + walk_struct_field(self, s) + } + fn visit_enum_def(&mut self, enum_definition: &EnumDef, + generics: &Generics, item_id: NodeId, _: Span) { + self.count += 1; + walk_enum_def(self, enum_definition, generics, item_id) + } + fn visit_variant(&mut self, v: &Variant, g: &Generics, item_id: NodeId) { + self.count += 1; + walk_variant(self, v, g, item_id) + } + fn visit_lifetime(&mut self, lifetime: &Lifetime) { + self.count += 1; + walk_lifetime(self, lifetime) + } + fn visit_lifetime_def(&mut self, lifetime: &LifetimeDef) { + self.count += 1; + walk_lifetime_def(self, lifetime) + } + fn visit_mac(&mut self, _mac: &Mac) { + self.count += 1; + walk_mac(self, _mac) + } + fn visit_path(&mut self, path: &Path, _id: NodeId) { + self.count += 1; + walk_path(self, path) + } + fn visit_path_list_item(&mut self, prefix: &Path, item: &PathListItem) { + self.count += 1; + walk_path_list_item(self, prefix, item) + } + fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &PathParameters) { + self.count += 1; + walk_path_parameters(self, path_span, path_parameters) + } + fn visit_assoc_type_binding(&mut self, type_binding: &TypeBinding) { + self.count += 1; + walk_assoc_type_binding(self, type_binding) + } + fn visit_attribute(&mut self, _attr: &Attribute) { + self.count += 1; + } + fn visit_macro_def(&mut self, macro_def: &MacroDef) { + self.count += 1; + walk_macro_def(self, macro_def) + } + +} diff --git a/third_party/rust/syntex_syntax/src/util/parser.rs b/third_party/rust/syntex_syntax/src/util/parser.rs new file mode 100644 index 000000000000..ce24fe1eb61e --- /dev/null +++ b/third_party/rust/syntex_syntax/src/util/parser.rs @@ -0,0 +1,217 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +use parse::token::{Token, BinOpToken}; +use symbol::keywords; +use ast::BinOpKind; + +/// Associative operator with precedence. +/// +/// This is the enum which specifies operator precedence and fixity to the parser. +#[derive(Debug, PartialEq, Eq)] +pub enum AssocOp { + /// `+` + Add, + /// `-` + Subtract, + /// `*` + Multiply, + /// `/` + Divide, + /// `%` + Modulus, + /// `&&` + LAnd, + /// `||` + LOr, + /// `^` + BitXor, + /// `&` + BitAnd, + /// `|` + BitOr, + /// `<<` + ShiftLeft, + /// `>>` + ShiftRight, + /// `==` + Equal, + /// `<` + Less, + /// `<=` + LessEqual, + /// `!=` + NotEqual, + /// `>` + Greater, + /// `>=` + GreaterEqual, + /// `=` + Assign, + /// `<-` + Inplace, + /// `?=` where ? is one of the BinOpToken + AssignOp(BinOpToken), + /// `as` + As, + /// `..` range + DotDot, + /// `...` range + DotDotDot, + /// `:` + Colon, +} + +#[derive(Debug, PartialEq, Eq)] +pub enum Fixity { + /// The operator is left-associative + Left, + /// The operator is right-associative + Right, + /// The operator is not associative + None +} + +impl AssocOp { + /// Create a new AssocOP from a token + pub fn from_token(t: &Token) -> Option { + use self::AssocOp::*; + match *t { + Token::BinOpEq(k) => Some(AssignOp(k)), + Token::LArrow => Some(Inplace), + Token::Eq => Some(Assign), + Token::BinOp(BinOpToken::Star) => Some(Multiply), + Token::BinOp(BinOpToken::Slash) => Some(Divide), + Token::BinOp(BinOpToken::Percent) => Some(Modulus), + Token::BinOp(BinOpToken::Plus) => Some(Add), + Token::BinOp(BinOpToken::Minus) => Some(Subtract), + Token::BinOp(BinOpToken::Shl) => Some(ShiftLeft), + Token::BinOp(BinOpToken::Shr) => Some(ShiftRight), + Token::BinOp(BinOpToken::And) => Some(BitAnd), + Token::BinOp(BinOpToken::Caret) => Some(BitXor), + Token::BinOp(BinOpToken::Or) => Some(BitOr), + Token::Lt => Some(Less), + Token::Le => Some(LessEqual), + Token::Ge => Some(GreaterEqual), + Token::Gt => Some(Greater), + Token::EqEq => Some(Equal), + Token::Ne => Some(NotEqual), + Token::AndAnd => Some(LAnd), + Token::OrOr => Some(LOr), + Token::DotDot => Some(DotDot), + Token::DotDotDot => Some(DotDotDot), + Token::Colon => Some(Colon), + _ if t.is_keyword(keywords::As) => Some(As), + _ => None + } + } + + /// Create a new AssocOp from ast::BinOpKind. + pub fn from_ast_binop(op: BinOpKind) -> Self { + use self::AssocOp::*; + match op { + BinOpKind::Lt => Less, + BinOpKind::Gt => Greater, + BinOpKind::Le => LessEqual, + BinOpKind::Ge => GreaterEqual, + BinOpKind::Eq => Equal, + BinOpKind::Ne => NotEqual, + BinOpKind::Mul => Multiply, + BinOpKind::Div => Divide, + BinOpKind::Rem => Modulus, + BinOpKind::Add => Add, + BinOpKind::Sub => Subtract, + BinOpKind::Shl => ShiftLeft, + BinOpKind::Shr => ShiftRight, + BinOpKind::BitAnd => BitAnd, + BinOpKind::BitXor => BitXor, + BinOpKind::BitOr => BitOr, + BinOpKind::And => LAnd, + BinOpKind::Or => LOr + } + } + + /// Gets the precedence of this operator + pub fn precedence(&self) -> usize { + use self::AssocOp::*; + match *self { + As | Colon => 14, + Multiply | Divide | Modulus => 13, + Add | Subtract => 12, + ShiftLeft | ShiftRight => 11, + BitAnd => 10, + BitXor => 9, + BitOr => 8, + Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => 7, + LAnd => 6, + LOr => 5, + DotDot | DotDotDot => 4, + Inplace => 3, + Assign | AssignOp(_) => 2, + } + } + + /// Gets the fixity of this operator + pub fn fixity(&self) -> Fixity { + use self::AssocOp::*; + // NOTE: it is a bug to have an operators that has same precedence but different fixities! + match *self { + Inplace | Assign | AssignOp(_) => Fixity::Right, + As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | + BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | + LAnd | LOr | Colon => Fixity::Left, + DotDot | DotDotDot => Fixity::None + } + } + + pub fn is_comparison(&self) -> bool { + use self::AssocOp::*; + match *self { + Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true, + Inplace | Assign | AssignOp(_) | As | Multiply | Divide | Modulus | Add | Subtract | + ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | + DotDot | DotDotDot | Colon => false + } + } + + pub fn is_assign_like(&self) -> bool { + use self::AssocOp::*; + match *self { + Assign | AssignOp(_) | Inplace => true, + Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | As | Multiply | Divide | + Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | + LOr | DotDot | DotDotDot | Colon => false + } + } + + pub fn to_ast_binop(&self) -> Option { + use self::AssocOp::*; + match *self { + Less => Some(BinOpKind::Lt), + Greater => Some(BinOpKind::Gt), + LessEqual => Some(BinOpKind::Le), + GreaterEqual => Some(BinOpKind::Ge), + Equal => Some(BinOpKind::Eq), + NotEqual => Some(BinOpKind::Ne), + Multiply => Some(BinOpKind::Mul), + Divide => Some(BinOpKind::Div), + Modulus => Some(BinOpKind::Rem), + Add => Some(BinOpKind::Add), + Subtract => Some(BinOpKind::Sub), + ShiftLeft => Some(BinOpKind::Shl), + ShiftRight => Some(BinOpKind::Shr), + BitAnd => Some(BinOpKind::BitAnd), + BitXor => Some(BinOpKind::BitXor), + BitOr => Some(BinOpKind::BitOr), + LAnd => Some(BinOpKind::And), + LOr => Some(BinOpKind::Or), + Inplace | Assign | AssignOp(_) | As | DotDot | DotDotDot | Colon => None + } + } +} diff --git a/third_party/rust/syntex_syntax/src/util/parser_testing.rs b/third_party/rust/syntex_syntax/src/util/parser_testing.rs new file mode 100644 index 000000000000..82459dc0121f --- /dev/null +++ b/third_party/rust/syntex_syntax/src/util/parser_testing.rs @@ -0,0 +1,172 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ast::{self, Ident}; +use parse::{ParseSess,PResult,filemap_to_tts}; +use parse::{lexer, new_parser_from_source_str}; +use parse::parser::Parser; +use ptr::P; +use tokenstream; +use std::iter::Peekable; + +/// Map a string to tts, using a made-up filename: +pub fn string_to_tts(source_str: String) -> Vec { + let ps = ParseSess::new(); + filemap_to_tts(&ps, ps.codemap().new_filemap("bogofile".to_string(), None, source_str)) +} + +/// Map string to parser (via tts) +pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { + new_parser_from_source_str(ps, "bogofile".to_string(), source_str) +} + +fn with_error_checking_parse<'a, T, F>(s: String, ps: &'a ParseSess, f: F) -> T where + F: FnOnce(&mut Parser<'a>) -> PResult<'a, T>, +{ + let mut p = string_to_parser(&ps, s); + let x = panictry!(f(&mut p)); + p.abort_if_errors(); + x +} + +/// Parse a string, return a crate. +pub fn string_to_crate (source_str : String) -> ast::Crate { + let ps = ParseSess::new(); + with_error_checking_parse(source_str, &ps, |p| { + p.parse_crate_mod() + }) +} + +/// Parse a string, return an expr +pub fn string_to_expr (source_str : String) -> P { + let ps = ParseSess::new(); + with_error_checking_parse(source_str, &ps, |p| { + p.parse_expr() + }) +} + +/// Parse a string, return an item +pub fn string_to_item (source_str : String) -> Option> { + let ps = ParseSess::new(); + with_error_checking_parse(source_str, &ps, |p| { + p.parse_item() + }) +} + +/// Parse a string, return a stmt +pub fn string_to_stmt(source_str : String) -> Option { + let ps = ParseSess::new(); + with_error_checking_parse(source_str, &ps, |p| { + p.parse_stmt() + }) +} + +/// Parse a string, return a pat. Uses "irrefutable"... which doesn't +/// (currently) affect parsing. +pub fn string_to_pat(source_str: String) -> P { + let ps = ParseSess::new(); + with_error_checking_parse(source_str, &ps, |p| { + p.parse_pat() + }) +} + +/// Convert a vector of strings to a vector of Ident's +pub fn strs_to_idents(ids: Vec<&str> ) -> Vec { + ids.iter().map(|u| Ident::from_str(*u)).collect() +} + +/// Does the given string match the pattern? whitespace in the first string +/// may be deleted or replaced with other whitespace to match the pattern. +/// This function is relatively Unicode-ignorant; fortunately, the careful design +/// of UTF-8 mitigates this ignorance. It doesn't do NKF-normalization(?). +pub fn matches_codepattern(a : &str, b : &str) -> bool { + let mut a_iter = a.chars().peekable(); + let mut b_iter = b.chars().peekable(); + + loop { + let (a, b) = match (a_iter.peek(), b_iter.peek()) { + (None, None) => return true, + (None, _) => return false, + (Some(&a), None) => { + if is_pattern_whitespace(a) { + break // trailing whitespace check is out of loop for borrowck + } else { + return false + } + } + (Some(&a), Some(&b)) => (a, b) + }; + + if is_pattern_whitespace(a) && is_pattern_whitespace(b) { + // skip whitespace for a and b + scan_for_non_ws_or_end(&mut a_iter); + scan_for_non_ws_or_end(&mut b_iter); + } else if is_pattern_whitespace(a) { + // skip whitespace for a + scan_for_non_ws_or_end(&mut a_iter); + } else if a == b { + a_iter.next(); + b_iter.next(); + } else { + return false + } + } + + // check if a has *only* trailing whitespace + a_iter.all(is_pattern_whitespace) +} + +/// Advances the given peekable `Iterator` until it reaches a non-whitespace character +fn scan_for_non_ws_or_end>(iter: &mut Peekable) { + while lexer::is_pattern_whitespace(iter.peek().cloned()) { + iter.next(); + } +} + +pub fn is_pattern_whitespace(c: char) -> bool { + lexer::is_pattern_whitespace(Some(c)) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn eqmodws() { + assert_eq!(matches_codepattern("",""),true); + assert_eq!(matches_codepattern("","a"),false); + assert_eq!(matches_codepattern("a",""),false); + assert_eq!(matches_codepattern("a","a"),true); + assert_eq!(matches_codepattern("a b","a \n\t\r b"),true); + assert_eq!(matches_codepattern("a b ","a \n\t\r b"),true); + assert_eq!(matches_codepattern("a b","a \n\t\r b "),false); + assert_eq!(matches_codepattern("a b","a b"),true); + assert_eq!(matches_codepattern("ab","a b"),false); + assert_eq!(matches_codepattern("a b","ab"),true); + assert_eq!(matches_codepattern(" a b","ab"),true); + } + + #[test] + fn pattern_whitespace() { + assert_eq!(matches_codepattern("","\x0C"), false); + // TODO - not yet enabled + //assert_eq!(matches_codepattern("a b ","a \u{0085}\n\t\r b"),true); + assert_eq!(matches_codepattern("a b","a \u{0085}\n\t\r b "),false); + } + + #[test] + fn non_pattern_whitespace() { + // These have the property 'White_Space' but not 'Pattern_White_Space' + assert_eq!(matches_codepattern("a b","a\u{2002}b"), false); + assert_eq!(matches_codepattern("a b","a\u{2002}b"), false); + assert_eq!(matches_codepattern("\u{205F}a b","ab"), false); + assert_eq!(matches_codepattern("a \u{3000}b","ab"), false); + } +} diff --git a/third_party/rust/syntex_syntax/src/util/small_vector.rs b/third_party/rust/syntex_syntax/src/util/small_vector.rs new file mode 100644 index 000000000000..ba139b53e01a --- /dev/null +++ b/third_party/rust/syntex_syntax/src/util/small_vector.rs @@ -0,0 +1,329 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use self::SmallVectorRepr::*; +use self::IntoIterRepr::*; + +use std::ops; +use std::iter::{IntoIterator, FromIterator}; +use std::mem; +use std::slice; +use std::vec; + +use util::move_map::MoveMap; + +/// A vector type optimized for cases where the size is almost always 0 or 1 +#[derive(Clone)] +pub struct SmallVector { + repr: SmallVectorRepr, +} + +#[derive(Clone)] +enum SmallVectorRepr { + Zero, + One(T), + Many(Vec), +} + +impl Default for SmallVector { + fn default() -> Self { + SmallVector { repr: Zero } + } +} + +impl Into> for SmallVector { + fn into(self) -> Vec { + match self.repr { + Zero => Vec::new(), + One(t) => vec![t], + Many(vec) => vec, + } + } +} + +impl FromIterator for SmallVector { + fn from_iter>(iter: I) -> SmallVector { + let mut v = SmallVector::zero(); + v.extend(iter); + v + } +} + +impl Extend for SmallVector { + fn extend>(&mut self, iter: I) { + for val in iter { + self.push(val); + } + } +} + +impl SmallVector { + pub fn new() -> SmallVector { + SmallVector::zero() + } + + pub fn zero() -> SmallVector { + SmallVector { repr: Zero } + } + + pub fn one(v: T) -> SmallVector { + SmallVector { repr: One(v) } + } + + pub fn many(vs: Vec) -> SmallVector { + SmallVector { repr: Many(vs) } + } + + pub fn as_slice(&self) -> &[T] { + self + } + + pub fn as_mut_slice(&mut self) -> &mut [T] { + self + } + + pub fn pop(&mut self) -> Option { + match self.repr { + Zero => None, + One(..) => { + let one = mem::replace(&mut self.repr, Zero); + match one { + One(v1) => Some(v1), + _ => unreachable!() + } + } + Many(ref mut vs) => vs.pop(), + } + } + + pub fn push(&mut self, v: T) { + match self.repr { + Zero => self.repr = One(v), + One(..) => { + let one = mem::replace(&mut self.repr, Zero); + match one { + One(v1) => mem::replace(&mut self.repr, Many(vec![v1, v])), + _ => unreachable!() + }; + } + Many(ref mut vs) => vs.push(v) + } + } + + pub fn push_all(&mut self, other: SmallVector) { + for v in other.into_iter() { + self.push(v); + } + } + + pub fn get(&self, idx: usize) -> &T { + match self.repr { + One(ref v) if idx == 0 => v, + Many(ref vs) => &vs[idx], + _ => panic!("out of bounds access") + } + } + + pub fn expect_one(self, err: &'static str) -> T { + match self.repr { + One(v) => v, + Many(v) => { + if v.len() == 1 { + v.into_iter().next().unwrap() + } else { + panic!(err) + } + } + _ => panic!(err) + } + } + + pub fn len(&self) -> usize { + match self.repr { + Zero => 0, + One(..) => 1, + Many(ref vals) => vals.len() + } + } + + pub fn is_empty(&self) -> bool { self.len() == 0 } + + pub fn map U>(self, mut f: F) -> SmallVector { + let repr = match self.repr { + Zero => Zero, + One(t) => One(f(t)), + Many(vec) => Many(vec.into_iter().map(f).collect()), + }; + SmallVector { repr: repr } + } +} + +impl ops::Deref for SmallVector { + type Target = [T]; + + fn deref(&self) -> &[T] { + match self.repr { + Zero => { + let result: &[T] = &[]; + result + } + One(ref v) => { + unsafe { slice::from_raw_parts(v, 1) } + } + Many(ref vs) => vs + } + } +} + +impl ops::DerefMut for SmallVector { + fn deref_mut(&mut self) -> &mut [T] { + match self.repr { + Zero => { + let result: &mut [T] = &mut []; + result + } + One(ref mut v) => { + unsafe { slice::from_raw_parts_mut(v, 1) } + } + Many(ref mut vs) => vs + } + } +} + +impl IntoIterator for SmallVector { + type Item = T; + type IntoIter = IntoIter; + fn into_iter(self) -> Self::IntoIter { + let repr = match self.repr { + Zero => ZeroIterator, + One(v) => OneIterator(v), + Many(vs) => ManyIterator(vs.into_iter()) + }; + IntoIter { repr: repr } + } +} + +pub struct IntoIter { + repr: IntoIterRepr, +} + +enum IntoIterRepr { + ZeroIterator, + OneIterator(T), + ManyIterator(vec::IntoIter), +} + +impl Iterator for IntoIter { + type Item = T; + + fn next(&mut self) -> Option { + match self.repr { + ZeroIterator => None, + OneIterator(..) => { + let mut replacement = ZeroIterator; + mem::swap(&mut self.repr, &mut replacement); + match replacement { + OneIterator(v) => Some(v), + _ => unreachable!() + } + } + ManyIterator(ref mut inner) => inner.next() + } + } + + fn size_hint(&self) -> (usize, Option) { + match self.repr { + ZeroIterator => (0, Some(0)), + OneIterator(..) => (1, Some(1)), + ManyIterator(ref inner) => inner.size_hint() + } + } +} + +impl MoveMap for SmallVector { + fn move_flat_map(self, mut f: F) -> Self + where F: FnMut(T) -> I, + I: IntoIterator + { + match self.repr { + Zero => Self::zero(), + One(v) => f(v).into_iter().collect(), + Many(vs) => SmallVector { repr: Many(vs.move_flat_map(f)) }, + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_len() { + let v: SmallVector = SmallVector::new(); + assert_eq!(0, v.len()); + + assert_eq!(1, SmallVector::one(1).len()); + assert_eq!(5, SmallVector::many(vec![1, 2, 3, 4, 5]).len()); + } + + #[test] + fn test_push_get() { + let mut v = SmallVector::new(); + v.push(1); + assert_eq!(1, v.len()); + assert_eq!(1, v[0]); + v.push(2); + assert_eq!(2, v.len()); + assert_eq!(2, v[1]); + v.push(3); + assert_eq!(3, v.len()); + assert_eq!(3, v[2]); + } + + #[test] + fn test_from_iter() { + let v: SmallVector = (vec![1, 2, 3]).into_iter().collect(); + assert_eq!(3, v.len()); + assert_eq!(1, v[0]); + assert_eq!(2, v[1]); + assert_eq!(3, v[2]); + } + + #[test] + fn test_move_iter() { + let v = SmallVector::new(); + let v: Vec = v.into_iter().collect(); + assert_eq!(v, Vec::new()); + + let v = SmallVector::one(1); + assert_eq!(v.into_iter().collect::>(), [1]); + + let v = SmallVector::many(vec![1, 2, 3]); + assert_eq!(v.into_iter().collect::>(), [1, 2, 3]); + } + + #[test] + #[should_panic] + fn test_expect_one_zero() { + let _: isize = SmallVector::new().expect_one(""); + } + + #[test] + #[should_panic] + fn test_expect_one_many() { + SmallVector::many(vec![1, 2]).expect_one(""); + } + + #[test] + fn test_expect_one_one() { + assert_eq!(1, SmallVector::one(1).expect_one("")); + assert_eq!(1, SmallVector::many(vec![1]).expect_one("")); + } +} diff --git a/third_party/rust/syntex_syntax/src/util/thin_vec.rs b/third_party/rust/syntex_syntax/src/util/thin_vec.rs new file mode 100644 index 000000000000..546686b46b8d --- /dev/null +++ b/third_party/rust/syntex_syntax/src/util/thin_vec.rs @@ -0,0 +1,59 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/// A vector type optimized for cases where this size is usually 0 (c.f. `SmallVector`). +/// The `Option>` wrapping allows us to represent a zero sized vector with `None`, +/// which uses only a single (null) pointer. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub struct ThinVec(Option>>); + +impl ThinVec { + pub fn new() -> Self { + ThinVec(None) + } +} + +impl From> for ThinVec { + fn from(vec: Vec) -> Self { + if vec.is_empty() { + ThinVec(None) + } else { + ThinVec(Some(Box::new(vec))) + } + } +} + +impl Into> for ThinVec { + fn into(self) -> Vec { + match self { + ThinVec(None) => Vec::new(), + ThinVec(Some(vec)) => *vec, + } + } +} + +impl ::std::ops::Deref for ThinVec { + type Target = [T]; + fn deref(&self) -> &[T] { + match *self { + ThinVec(None) => &[], + ThinVec(Some(ref vec)) => vec, + } + } +} + +impl Extend for ThinVec { + fn extend>(&mut self, iter: I) { + match *self { + ThinVec(Some(ref mut vec)) => vec.extend(iter), + ThinVec(None) => *self = iter.into_iter().collect::>().into(), + } + } +} diff --git a/third_party/rust/syntex_syntax/src/visit.rs b/third_party/rust/syntex_syntax/src/visit.rs new file mode 100644 index 000000000000..42fdc86d13e9 --- /dev/null +++ b/third_party/rust/syntex_syntax/src/visit.rs @@ -0,0 +1,812 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! AST walker. Each overridden visit method has full control over what +//! happens with its node, it can do its own traversal of the node's children, +//! call `visit::walk_*` to apply the default traversal algorithm, or prevent +//! deeper traversal by doing nothing. +//! +//! Note: it is an important invariant that the default visitor walks the body +//! of a function in "execution order" (more concretely, reverse post-order +//! with respect to the CFG implied by the AST), meaning that if AST node A may +//! execute before AST node B, then A is visited first. The borrow checker in +//! particular relies on this property. +//! +//! Note: walking an AST before macro expansion is probably a bad idea. For +//! instance, a walker looking for item names in a module will miss all of +//! those that are created by the expansion of a macro. + +use abi::Abi; +use ast::*; +use syntax_pos::Span; +use codemap::Spanned; + +#[derive(Copy, Clone, PartialEq, Eq)] +pub enum FnKind<'a> { + /// fn foo() or extern "Abi" fn foo() + ItemFn(Ident, &'a Generics, Unsafety, Spanned, Abi, &'a Visibility, &'a Block), + + /// fn foo(&self) + Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a Block), + + /// |x, y| body + Closure(&'a Expr), +} + +/// Each method of the Visitor trait is a hook to be potentially +/// overridden. Each method's default implementation recursively visits +/// the substructure of the input via the corresponding `walk` method; +/// e.g. the `visit_mod` method by default calls `visit::walk_mod`. +/// +/// If you want to ensure that your code handles every variant +/// explicitly, you need to override each method. (And you also need +/// to monitor future changes to `Visitor` in case a new method with a +/// new default implementation gets introduced.) +pub trait Visitor<'ast>: Sized { + fn visit_name(&mut self, _span: Span, _name: Name) { + // Nothing to do. + } + fn visit_ident(&mut self, span: Span, ident: Ident) { + walk_ident(self, span, ident); + } + fn visit_mod(&mut self, m: &'ast Mod, _s: Span, _n: NodeId) { walk_mod(self, m) } + fn visit_foreign_item(&mut self, i: &'ast ForeignItem) { walk_foreign_item(self, i) } + fn visit_item(&mut self, i: &'ast Item) { walk_item(self, i) } + fn visit_local(&mut self, l: &'ast Local) { walk_local(self, l) } + fn visit_block(&mut self, b: &'ast Block) { walk_block(self, b) } + fn visit_stmt(&mut self, s: &'ast Stmt) { walk_stmt(self, s) } + fn visit_arm(&mut self, a: &'ast Arm) { walk_arm(self, a) } + fn visit_pat(&mut self, p: &'ast Pat) { walk_pat(self, p) } + fn visit_expr(&mut self, ex: &'ast Expr) { walk_expr(self, ex) } + fn visit_expr_post(&mut self, _ex: &'ast Expr) { } + fn visit_ty(&mut self, t: &'ast Ty) { walk_ty(self, t) } + fn visit_generics(&mut self, g: &'ast Generics) { walk_generics(self, g) } + fn visit_fn(&mut self, fk: FnKind<'ast>, fd: &'ast FnDecl, s: Span, _: NodeId) { + walk_fn(self, fk, fd, s) + } + fn visit_trait_item(&mut self, ti: &'ast TraitItem) { walk_trait_item(self, ti) } + fn visit_impl_item(&mut self, ii: &'ast ImplItem) { walk_impl_item(self, ii) } + fn visit_trait_ref(&mut self, t: &'ast TraitRef) { walk_trait_ref(self, t) } + fn visit_ty_param_bound(&mut self, bounds: &'ast TyParamBound) { + walk_ty_param_bound(self, bounds) + } + fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef, m: &'ast TraitBoundModifier) { + walk_poly_trait_ref(self, t, m) + } + fn visit_variant_data(&mut self, s: &'ast VariantData, _: Ident, + _: &'ast Generics, _: NodeId, _: Span) { + walk_struct_def(self, s) + } + fn visit_struct_field(&mut self, s: &'ast StructField) { walk_struct_field(self, s) } + fn visit_enum_def(&mut self, enum_definition: &'ast EnumDef, + generics: &'ast Generics, item_id: NodeId, _: Span) { + walk_enum_def(self, enum_definition, generics, item_id) + } + fn visit_variant(&mut self, v: &'ast Variant, g: &'ast Generics, item_id: NodeId) { + walk_variant(self, v, g, item_id) + } + fn visit_lifetime(&mut self, lifetime: &'ast Lifetime) { + walk_lifetime(self, lifetime) + } + fn visit_lifetime_def(&mut self, lifetime: &'ast LifetimeDef) { + walk_lifetime_def(self, lifetime) + } + fn visit_mac(&mut self, _mac: &'ast Mac) { + panic!("visit_mac disabled by default"); + // NB: see note about macros above. + // if you really want a visitor that + // works on macros, use this + // definition in your trait impl: + // visit::walk_mac(self, _mac) + } + fn visit_path(&mut self, path: &'ast Path, _id: NodeId) { + walk_path(self, path) + } + fn visit_path_list_item(&mut self, prefix: &'ast Path, item: &'ast PathListItem) { + walk_path_list_item(self, prefix, item) + } + fn visit_path_segment(&mut self, path_span: Span, path_segment: &'ast PathSegment) { + walk_path_segment(self, path_span, path_segment) + } + fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &'ast PathParameters) { + walk_path_parameters(self, path_span, path_parameters) + } + fn visit_assoc_type_binding(&mut self, type_binding: &'ast TypeBinding) { + walk_assoc_type_binding(self, type_binding) + } + fn visit_attribute(&mut self, _attr: &'ast Attribute) {} + fn visit_macro_def(&mut self, macro_def: &'ast MacroDef) { + walk_macro_def(self, macro_def) + } + fn visit_vis(&mut self, vis: &'ast Visibility) { + walk_vis(self, vis) + } + fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FunctionRetTy) { + walk_fn_ret_ty(self, ret_ty) + } +} + +#[macro_export] +macro_rules! walk_list { + ($visitor: expr, $method: ident, $list: expr) => { + for elem in $list { + $visitor.$method(elem) + } + }; + ($visitor: expr, $method: ident, $list: expr, $($extra_args: expr),*) => { + for elem in $list { + $visitor.$method(elem, $($extra_args,)*) + } + } +} + +macro_rules! walk_opt { + ($visitor: expr, $method: ident, $opt: expr) => { + if let Some(ref elem) = *$opt { + $visitor.$method(elem) + } + } +} + +pub fn walk_opt_name<'a, V: Visitor<'a>>(visitor: &mut V, span: Span, opt_name: Option) { + if let Some(name) = opt_name { + visitor.visit_name(span, name); + } +} + +pub fn walk_opt_ident<'a, V: Visitor<'a>>(visitor: &mut V, span: Span, opt_ident: Option) { + if let Some(ident) = opt_ident { + visitor.visit_ident(span, ident); + } +} + +pub fn walk_opt_sp_ident<'a, V: Visitor<'a>>(visitor: &mut V, + opt_sp_ident: &Option>) { + if let Some(ref sp_ident) = *opt_sp_ident { + visitor.visit_ident(sp_ident.span, sp_ident.node); + } +} + +pub fn walk_ident<'a, V: Visitor<'a>>(visitor: &mut V, span: Span, ident: Ident) { + visitor.visit_name(span, ident.name); +} + +pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) { + visitor.visit_mod(&krate.module, krate.span, CRATE_NODE_ID); + walk_list!(visitor, visit_attribute, &krate.attrs); + walk_list!(visitor, visit_macro_def, &krate.exported_macros); +} + +pub fn walk_macro_def<'a, V: Visitor<'a>>(visitor: &mut V, macro_def: &'a MacroDef) { + visitor.visit_ident(macro_def.span, macro_def.ident); + walk_list!(visitor, visit_attribute, ¯o_def.attrs); +} + +pub fn walk_mod<'a, V: Visitor<'a>>(visitor: &mut V, module: &'a Mod) { + walk_list!(visitor, visit_item, &module.items); +} + +pub fn walk_local<'a, V: Visitor<'a>>(visitor: &mut V, local: &'a Local) { + for attr in local.attrs.iter() { + visitor.visit_attribute(attr); + } + visitor.visit_pat(&local.pat); + walk_opt!(visitor, visit_ty, &local.ty); + walk_opt!(visitor, visit_expr, &local.init); +} + +pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime) { + visitor.visit_name(lifetime.span, lifetime.name); +} + +pub fn walk_lifetime_def<'a, V: Visitor<'a>>(visitor: &mut V, lifetime_def: &'a LifetimeDef) { + visitor.visit_lifetime(&lifetime_def.lifetime); + walk_list!(visitor, visit_lifetime, &lifetime_def.bounds); + walk_list!(visitor, visit_attribute, &*lifetime_def.attrs); +} + +pub fn walk_poly_trait_ref<'a, V>(visitor: &mut V, + trait_ref: &'a PolyTraitRef, + _: &TraitBoundModifier) + where V: Visitor<'a>, +{ + walk_list!(visitor, visit_lifetime_def, &trait_ref.bound_lifetimes); + visitor.visit_trait_ref(&trait_ref.trait_ref); +} + +pub fn walk_trait_ref<'a, V: Visitor<'a>>(visitor: &mut V, trait_ref: &'a TraitRef) { + visitor.visit_path(&trait_ref.path, trait_ref.ref_id) +} + +pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { + visitor.visit_vis(&item.vis); + visitor.visit_ident(item.span, item.ident); + match item.node { + ItemKind::ExternCrate(opt_name) => { + walk_opt_name(visitor, item.span, opt_name) + } + ItemKind::Use(ref vp) => { + match vp.node { + ViewPathSimple(ident, ref path) => { + visitor.visit_ident(vp.span, ident); + visitor.visit_path(path, item.id); + } + ViewPathGlob(ref path) => { + visitor.visit_path(path, item.id); + } + ViewPathList(ref prefix, ref list) => { + visitor.visit_path(prefix, item.id); + for item in list { + visitor.visit_path_list_item(prefix, item) + } + } + } + } + ItemKind::Static(ref typ, _, ref expr) | + ItemKind::Const(ref typ, ref expr) => { + visitor.visit_ty(typ); + visitor.visit_expr(expr); + } + ItemKind::Fn(ref declaration, unsafety, constness, abi, ref generics, ref body) => { + visitor.visit_fn(FnKind::ItemFn(item.ident, generics, unsafety, + constness, abi, &item.vis, body), + declaration, + item.span, + item.id) + } + ItemKind::Mod(ref module) => { + visitor.visit_mod(module, item.span, item.id) + } + ItemKind::ForeignMod(ref foreign_module) => { + walk_list!(visitor, visit_foreign_item, &foreign_module.items); + } + ItemKind::Ty(ref typ, ref type_parameters) => { + visitor.visit_ty(typ); + visitor.visit_generics(type_parameters) + } + ItemKind::Enum(ref enum_definition, ref type_parameters) => { + visitor.visit_generics(type_parameters); + visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span) + } + ItemKind::DefaultImpl(_, ref trait_ref) => { + visitor.visit_trait_ref(trait_ref) + } + ItemKind::Impl(_, _, + ref type_parameters, + ref opt_trait_reference, + ref typ, + ref impl_items) => { + visitor.visit_generics(type_parameters); + walk_opt!(visitor, visit_trait_ref, opt_trait_reference); + visitor.visit_ty(typ); + walk_list!(visitor, visit_impl_item, impl_items); + } + ItemKind::Struct(ref struct_definition, ref generics) | + ItemKind::Union(ref struct_definition, ref generics) => { + visitor.visit_generics(generics); + visitor.visit_variant_data(struct_definition, item.ident, + generics, item.id, item.span); + } + ItemKind::Trait(_, ref generics, ref bounds, ref methods) => { + visitor.visit_generics(generics); + walk_list!(visitor, visit_ty_param_bound, bounds); + walk_list!(visitor, visit_trait_item, methods); + } + ItemKind::Mac(ref mac) => visitor.visit_mac(mac), + } + walk_list!(visitor, visit_attribute, &item.attrs); +} + +pub fn walk_enum_def<'a, V: Visitor<'a>>(visitor: &mut V, + enum_definition: &'a EnumDef, + generics: &'a Generics, + item_id: NodeId) { + walk_list!(visitor, visit_variant, &enum_definition.variants, generics, item_id); +} + +pub fn walk_variant<'a, V>(visitor: &mut V, + variant: &'a Variant, + generics: &'a Generics, + item_id: NodeId) + where V: Visitor<'a>, +{ + visitor.visit_ident(variant.span, variant.node.name); + visitor.visit_variant_data(&variant.node.data, variant.node.name, + generics, item_id, variant.span); + walk_opt!(visitor, visit_expr, &variant.node.disr_expr); + walk_list!(visitor, visit_attribute, &variant.node.attrs); +} + +pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) { + match typ.node { + TyKind::Slice(ref ty) | TyKind::Paren(ref ty) => { + visitor.visit_ty(ty) + } + TyKind::Ptr(ref mutable_type) => { + visitor.visit_ty(&mutable_type.ty) + } + TyKind::Rptr(ref opt_lifetime, ref mutable_type) => { + walk_list!(visitor, visit_lifetime, opt_lifetime); + visitor.visit_ty(&mutable_type.ty) + } + TyKind::Never => {}, + TyKind::Tup(ref tuple_element_types) => { + walk_list!(visitor, visit_ty, tuple_element_types); + } + TyKind::BareFn(ref function_declaration) => { + walk_fn_decl(visitor, &function_declaration.decl); + walk_list!(visitor, visit_lifetime_def, &function_declaration.lifetimes); + } + TyKind::Path(ref maybe_qself, ref path) => { + if let Some(ref qself) = *maybe_qself { + visitor.visit_ty(&qself.ty); + } + visitor.visit_path(path, typ.id); + } + TyKind::ObjectSum(ref ty, ref bounds) => { + visitor.visit_ty(ty); + walk_list!(visitor, visit_ty_param_bound, bounds); + } + TyKind::Array(ref ty, ref expression) => { + visitor.visit_ty(ty); + visitor.visit_expr(expression) + } + TyKind::PolyTraitRef(ref bounds) => { + walk_list!(visitor, visit_ty_param_bound, bounds); + } + TyKind::ImplTrait(ref bounds) => { + walk_list!(visitor, visit_ty_param_bound, bounds); + } + TyKind::Typeof(ref expression) => { + visitor.visit_expr(expression) + } + TyKind::Infer | TyKind::ImplicitSelf => {} + TyKind::Mac(ref mac) => { + visitor.visit_mac(mac) + } + } +} + +pub fn walk_path<'a, V: Visitor<'a>>(visitor: &mut V, path: &'a Path) { + for segment in &path.segments { + visitor.visit_path_segment(path.span, segment); + } +} + +pub fn walk_path_list_item<'a, V: Visitor<'a>>(visitor: &mut V, + _prefix: &Path, + item: &'a PathListItem) { + visitor.visit_ident(item.span, item.node.name); + walk_opt_ident(visitor, item.span, item.node.rename); +} + +pub fn walk_path_segment<'a, V: Visitor<'a>>(visitor: &mut V, + path_span: Span, + segment: &'a PathSegment) { + visitor.visit_ident(path_span, segment.identifier); + if let Some(ref parameters) = segment.parameters { + visitor.visit_path_parameters(path_span, parameters); + } +} + +pub fn walk_path_parameters<'a, V>(visitor: &mut V, + _path_span: Span, + path_parameters: &'a PathParameters) + where V: Visitor<'a>, +{ + match *path_parameters { + PathParameters::AngleBracketed(ref data) => { + walk_list!(visitor, visit_ty, &data.types); + walk_list!(visitor, visit_lifetime, &data.lifetimes); + walk_list!(visitor, visit_assoc_type_binding, &data.bindings); + } + PathParameters::Parenthesized(ref data) => { + walk_list!(visitor, visit_ty, &data.inputs); + walk_opt!(visitor, visit_ty, &data.output); + } + } +} + +pub fn walk_assoc_type_binding<'a, V: Visitor<'a>>(visitor: &mut V, + type_binding: &'a TypeBinding) { + visitor.visit_ident(type_binding.span, type_binding.ident); + visitor.visit_ty(&type_binding.ty); +} + +pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) { + match pattern.node { + PatKind::TupleStruct(ref path, ref children, _) => { + visitor.visit_path(path, pattern.id); + walk_list!(visitor, visit_pat, children); + } + PatKind::Path(ref opt_qself, ref path) => { + if let Some(ref qself) = *opt_qself { + visitor.visit_ty(&qself.ty); + } + visitor.visit_path(path, pattern.id) + } + PatKind::Struct(ref path, ref fields, _) => { + visitor.visit_path(path, pattern.id); + for field in fields { + visitor.visit_ident(field.span, field.node.ident); + visitor.visit_pat(&field.node.pat) + } + } + PatKind::Tuple(ref tuple_elements, _) => { + walk_list!(visitor, visit_pat, tuple_elements); + } + PatKind::Box(ref subpattern) | + PatKind::Ref(ref subpattern, _) => { + visitor.visit_pat(subpattern) + } + PatKind::Ident(_, ref pth1, ref optional_subpattern) => { + visitor.visit_ident(pth1.span, pth1.node); + walk_opt!(visitor, visit_pat, optional_subpattern); + } + PatKind::Lit(ref expression) => visitor.visit_expr(expression), + PatKind::Range(ref lower_bound, ref upper_bound) => { + visitor.visit_expr(lower_bound); + visitor.visit_expr(upper_bound) + } + PatKind::Wild => (), + PatKind::Slice(ref prepatterns, ref slice_pattern, ref postpatterns) => { + walk_list!(visitor, visit_pat, prepatterns); + walk_opt!(visitor, visit_pat, slice_pattern); + walk_list!(visitor, visit_pat, postpatterns); + } + PatKind::Mac(ref mac) => visitor.visit_mac(mac), + } +} + +pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, foreign_item: &'a ForeignItem) { + visitor.visit_vis(&foreign_item.vis); + visitor.visit_ident(foreign_item.span, foreign_item.ident); + + match foreign_item.node { + ForeignItemKind::Fn(ref function_declaration, ref generics) => { + walk_fn_decl(visitor, function_declaration); + visitor.visit_generics(generics) + } + ForeignItemKind::Static(ref typ, _) => visitor.visit_ty(typ), + } + + walk_list!(visitor, visit_attribute, &foreign_item.attrs); +} + +pub fn walk_ty_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a TyParamBound) { + match *bound { + TraitTyParamBound(ref typ, ref modifier) => { + visitor.visit_poly_trait_ref(typ, modifier); + } + RegionTyParamBound(ref lifetime) => { + visitor.visit_lifetime(lifetime); + } + } +} + +pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics) { + for param in &generics.ty_params { + visitor.visit_ident(param.span, param.ident); + walk_list!(visitor, visit_ty_param_bound, ¶m.bounds); + walk_list!(visitor, visit_ty, ¶m.default); + walk_list!(visitor, visit_attribute, &*param.attrs); + } + walk_list!(visitor, visit_lifetime_def, &generics.lifetimes); + for predicate in &generics.where_clause.predicates { + match *predicate { + WherePredicate::BoundPredicate(WhereBoundPredicate{ref bounded_ty, + ref bounds, + ref bound_lifetimes, + ..}) => { + visitor.visit_ty(bounded_ty); + walk_list!(visitor, visit_ty_param_bound, bounds); + walk_list!(visitor, visit_lifetime_def, bound_lifetimes); + } + WherePredicate::RegionPredicate(WhereRegionPredicate{ref lifetime, + ref bounds, + ..}) => { + visitor.visit_lifetime(lifetime); + walk_list!(visitor, visit_lifetime, bounds); + } + WherePredicate::EqPredicate(WhereEqPredicate{id, + ref path, + ref ty, + ..}) => { + visitor.visit_path(path, id); + visitor.visit_ty(ty); + } + } + } +} + +pub fn walk_fn_ret_ty<'a, V: Visitor<'a>>(visitor: &mut V, ret_ty: &'a FunctionRetTy) { + if let FunctionRetTy::Ty(ref output_ty) = *ret_ty { + visitor.visit_ty(output_ty) + } +} + +pub fn walk_fn_decl<'a, V: Visitor<'a>>(visitor: &mut V, function_declaration: &'a FnDecl) { + for argument in &function_declaration.inputs { + visitor.visit_pat(&argument.pat); + visitor.visit_ty(&argument.ty) + } + visitor.visit_fn_ret_ty(&function_declaration.output) +} + +pub fn walk_fn<'a, V>(visitor: &mut V, kind: FnKind<'a>, declaration: &'a FnDecl, _span: Span) + where V: Visitor<'a>, +{ + match kind { + FnKind::ItemFn(_, generics, _, _, _, _, body) => { + visitor.visit_generics(generics); + walk_fn_decl(visitor, declaration); + visitor.visit_block(body); + } + FnKind::Method(_, ref sig, _, body) => { + visitor.visit_generics(&sig.generics); + walk_fn_decl(visitor, declaration); + visitor.visit_block(body); + } + FnKind::Closure(body) => { + walk_fn_decl(visitor, declaration); + visitor.visit_expr(body); + } + } +} + +pub fn walk_trait_item<'a, V: Visitor<'a>>(visitor: &mut V, trait_item: &'a TraitItem) { + visitor.visit_ident(trait_item.span, trait_item.ident); + walk_list!(visitor, visit_attribute, &trait_item.attrs); + match trait_item.node { + TraitItemKind::Const(ref ty, ref default) => { + visitor.visit_ty(ty); + walk_opt!(visitor, visit_expr, default); + } + TraitItemKind::Method(ref sig, None) => { + visitor.visit_generics(&sig.generics); + walk_fn_decl(visitor, &sig.decl); + } + TraitItemKind::Method(ref sig, Some(ref body)) => { + visitor.visit_fn(FnKind::Method(trait_item.ident, sig, None, body), + &sig.decl, trait_item.span, trait_item.id); + } + TraitItemKind::Type(ref bounds, ref default) => { + walk_list!(visitor, visit_ty_param_bound, bounds); + walk_opt!(visitor, visit_ty, default); + } + TraitItemKind::Macro(ref mac) => { + visitor.visit_mac(mac); + } + } +} + +pub fn walk_impl_item<'a, V: Visitor<'a>>(visitor: &mut V, impl_item: &'a ImplItem) { + visitor.visit_vis(&impl_item.vis); + visitor.visit_ident(impl_item.span, impl_item.ident); + walk_list!(visitor, visit_attribute, &impl_item.attrs); + match impl_item.node { + ImplItemKind::Const(ref ty, ref expr) => { + visitor.visit_ty(ty); + visitor.visit_expr(expr); + } + ImplItemKind::Method(ref sig, ref body) => { + visitor.visit_fn(FnKind::Method(impl_item.ident, sig, Some(&impl_item.vis), body), + &sig.decl, impl_item.span, impl_item.id); + } + ImplItemKind::Type(ref ty) => { + visitor.visit_ty(ty); + } + ImplItemKind::Macro(ref mac) => { + visitor.visit_mac(mac); + } + } +} + +pub fn walk_struct_def<'a, V: Visitor<'a>>(visitor: &mut V, struct_definition: &'a VariantData) { + walk_list!(visitor, visit_struct_field, struct_definition.fields()); +} + +pub fn walk_struct_field<'a, V: Visitor<'a>>(visitor: &mut V, struct_field: &'a StructField) { + visitor.visit_vis(&struct_field.vis); + walk_opt_ident(visitor, struct_field.span, struct_field.ident); + visitor.visit_ty(&struct_field.ty); + walk_list!(visitor, visit_attribute, &struct_field.attrs); +} + +pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) { + walk_list!(visitor, visit_stmt, &block.stmts); +} + +pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) { + match statement.node { + StmtKind::Local(ref local) => visitor.visit_local(local), + StmtKind::Item(ref item) => visitor.visit_item(item), + StmtKind::Expr(ref expression) | StmtKind::Semi(ref expression) => { + visitor.visit_expr(expression) + } + StmtKind::Mac(ref mac) => { + let (ref mac, _, ref attrs) = **mac; + visitor.visit_mac(mac); + for attr in attrs.iter() { + visitor.visit_attribute(attr); + } + } + } +} + +pub fn walk_mac<'a, V: Visitor<'a>>(_: &mut V, _: &Mac) { + // Empty! +} + +pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) { + for attr in expression.attrs.iter() { + visitor.visit_attribute(attr); + } + match expression.node { + ExprKind::Box(ref subexpression) => { + visitor.visit_expr(subexpression) + } + ExprKind::InPlace(ref place, ref subexpression) => { + visitor.visit_expr(place); + visitor.visit_expr(subexpression) + } + ExprKind::Vec(ref subexpressions) => { + walk_list!(visitor, visit_expr, subexpressions); + } + ExprKind::Repeat(ref element, ref count) => { + visitor.visit_expr(element); + visitor.visit_expr(count) + } + ExprKind::Struct(ref path, ref fields, ref optional_base) => { + visitor.visit_path(path, expression.id); + for field in fields { + visitor.visit_ident(field.ident.span, field.ident.node); + visitor.visit_expr(&field.expr) + } + walk_opt!(visitor, visit_expr, optional_base); + } + ExprKind::Tup(ref subexpressions) => { + walk_list!(visitor, visit_expr, subexpressions); + } + ExprKind::Call(ref callee_expression, ref arguments) => { + visitor.visit_expr(callee_expression); + walk_list!(visitor, visit_expr, arguments); + } + ExprKind::MethodCall(ref ident, ref types, ref arguments) => { + visitor.visit_ident(ident.span, ident.node); + walk_list!(visitor, visit_ty, types); + walk_list!(visitor, visit_expr, arguments); + } + ExprKind::Binary(_, ref left_expression, ref right_expression) => { + visitor.visit_expr(left_expression); + visitor.visit_expr(right_expression) + } + ExprKind::AddrOf(_, ref subexpression) | ExprKind::Unary(_, ref subexpression) => { + visitor.visit_expr(subexpression) + } + ExprKind::Lit(_) => {} + ExprKind::Cast(ref subexpression, ref typ) | ExprKind::Type(ref subexpression, ref typ) => { + visitor.visit_expr(subexpression); + visitor.visit_ty(typ) + } + ExprKind::If(ref head_expression, ref if_block, ref optional_else) => { + visitor.visit_expr(head_expression); + visitor.visit_block(if_block); + walk_opt!(visitor, visit_expr, optional_else); + } + ExprKind::While(ref subexpression, ref block, ref opt_sp_ident) => { + visitor.visit_expr(subexpression); + visitor.visit_block(block); + walk_opt_sp_ident(visitor, opt_sp_ident); + } + ExprKind::IfLet(ref pattern, ref subexpression, ref if_block, ref optional_else) => { + visitor.visit_pat(pattern); + visitor.visit_expr(subexpression); + visitor.visit_block(if_block); + walk_opt!(visitor, visit_expr, optional_else); + } + ExprKind::WhileLet(ref pattern, ref subexpression, ref block, ref opt_sp_ident) => { + visitor.visit_pat(pattern); + visitor.visit_expr(subexpression); + visitor.visit_block(block); + walk_opt_sp_ident(visitor, opt_sp_ident); + } + ExprKind::ForLoop(ref pattern, ref subexpression, ref block, ref opt_sp_ident) => { + visitor.visit_pat(pattern); + visitor.visit_expr(subexpression); + visitor.visit_block(block); + walk_opt_sp_ident(visitor, opt_sp_ident); + } + ExprKind::Loop(ref block, ref opt_sp_ident) => { + visitor.visit_block(block); + walk_opt_sp_ident(visitor, opt_sp_ident); + } + ExprKind::Match(ref subexpression, ref arms) => { + visitor.visit_expr(subexpression); + walk_list!(visitor, visit_arm, arms); + } + ExprKind::Closure(_, ref function_declaration, ref body, _decl_span) => { + visitor.visit_fn(FnKind::Closure(body), + function_declaration, + expression.span, + expression.id) + } + ExprKind::Block(ref block) => visitor.visit_block(block), + ExprKind::Assign(ref left_hand_expression, ref right_hand_expression) => { + visitor.visit_expr(left_hand_expression); + visitor.visit_expr(right_hand_expression); + } + ExprKind::AssignOp(_, ref left_expression, ref right_expression) => { + visitor.visit_expr(left_expression); + visitor.visit_expr(right_expression); + } + ExprKind::Field(ref subexpression, ref ident) => { + visitor.visit_expr(subexpression); + visitor.visit_ident(ident.span, ident.node); + } + ExprKind::TupField(ref subexpression, _) => { + visitor.visit_expr(subexpression); + } + ExprKind::Index(ref main_expression, ref index_expression) => { + visitor.visit_expr(main_expression); + visitor.visit_expr(index_expression) + } + ExprKind::Range(ref start, ref end, _) => { + walk_list!(visitor, visit_expr, start); + walk_list!(visitor, visit_expr, end); + } + ExprKind::Path(ref maybe_qself, ref path) => { + if let Some(ref qself) = *maybe_qself { + visitor.visit_ty(&qself.ty); + } + visitor.visit_path(path, expression.id) + } + ExprKind::Break(ref opt_sp_ident, ref opt_expr) => { + walk_opt_sp_ident(visitor, opt_sp_ident); + walk_list!(visitor, visit_expr, opt_expr); + } + ExprKind::Continue(ref opt_sp_ident) => { + walk_opt_sp_ident(visitor, opt_sp_ident); + } + ExprKind::Ret(ref optional_expression) => { + walk_list!(visitor, visit_expr, optional_expression); + } + ExprKind::Mac(ref mac) => visitor.visit_mac(mac), + ExprKind::Paren(ref subexpression) => { + visitor.visit_expr(subexpression) + } + ExprKind::InlineAsm(ref ia) => { + for &(_, ref input) in &ia.inputs { + visitor.visit_expr(&input) + } + for output in &ia.outputs { + visitor.visit_expr(&output.expr) + } + } + ExprKind::Try(ref subexpression) => { + visitor.visit_expr(subexpression) + } + } + + visitor.visit_expr_post(expression) +} + +pub fn walk_arm<'a, V: Visitor<'a>>(visitor: &mut V, arm: &'a Arm) { + walk_list!(visitor, visit_pat, &arm.pats); + walk_opt!(visitor, visit_expr, &arm.guard); + visitor.visit_expr(&arm.body); + walk_list!(visitor, visit_attribute, &arm.attrs); +} + +pub fn walk_vis<'a, V: Visitor<'a>>(visitor: &mut V, vis: &'a Visibility) { + if let Visibility::Restricted { ref path, id } = *vis { + visitor.visit_path(path, id); + } +} diff --git a/third_party/rust/term/.cargo-checksum.json b/third_party/rust/term/.cargo-checksum.json new file mode 100644 index 000000000000..a1a293f1c419 --- /dev/null +++ b/third_party/rust/term/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"8a98e02ce273cefe3e6bdc92966575a9a71957ec49dba52301f5bdea8c194f9f","Cargo.toml":"ee592b74d4510eed169f70b240c05986baf8eab1653d837b35ff0284bd35a051","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"f5d6df44431e0814368b2890d954ae2253efb7765925582de8be11eb16a505a6","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","rustfmt.toml":"be851a0fa92766755e54e163ccceedee0b28ea6d527888c48f1cbc766f23733c","scripts/id_rsa.enc":"210d1476adba1c08d77329d9f71dba828c0516d8ae659c6317c9bee4683e5d50","scripts/travis-doc-upload.cfg":"2609cb89644596a2ede3cd63b7a5fb6e84ee56c2b880ff67584e9655f4a2e777","src/lib.rs":"176542e147d55ffc1f781dc6dfbe88999d26b72d1c753d9fc3f624b970ec8571","src/terminfo/mod.rs":"fb42450c2450b37989803c5cf9cd7c66d14d594f9b51df7fdee28ebbaafdf165","src/terminfo/parm.rs":"d04a4097095c40ff63ae5829b06fcf5eeec9596b0787f7b91f658a97caa74e43","src/terminfo/parser/compiled.rs":"2be2304f76b15f96f79913bb14bdcd828dde198c1bf0840f648c36e334799570","src/terminfo/parser/names.rs":"6c437ef97f96f68aba85d200c7919cfe53753e0b90ac51dcd8cc748890f82c34","src/terminfo/searcher.rs":"4aa507f1c87312ba2f7e00cd4268b1213d8f509aa6e14d69f1631c8b63ffa75e","src/win.rs":"9efbdc4bb18b317e3d98fa58e441cc8903710ac0e6f315899329660cf6d10277","tests/data/dumb":"123c85a2812a517d967db5f31660db0e6aded4a0b95ed943c5ab435368e7a25c","tests/data/linux":"9dcec472e8ec612e84b46c2b8ae17a4f47b2ccfe93bc7b16970bbaaa20fab1e9","tests/data/linux-16color":"eb0b5684a42db662ebaa0043cc4bb5e082b09a7312796ec669e0159fce6af499","tests/data/linux-basic":"1373c033c6a891911a0a478e5f9654600e84dbfe2d16f649ba2fc08802335a0c","tests/data/linux-c":"50807ab8371b45bd80ca9d563de882b733b5db88cff7646e40c344e98ef755ed","tests/data/linux-c-nc":"d88eb59f749d91be3148ce39dec7c050d95feb516702ed7f9f6cec7a58b424a7","tests/data/linux-koi8":"4b7d942f03ce95d45802029db0c87879eb93be50b43026c63c18a3552dd37c93","tests/data/linux-koi8r":"7267d93deec24396a9955e95da621c054d8d677634b465d798f792141b24e1de","tests/data/linux-lat":"b72b2ec68fa445e2e0ae96cc7bb2149a1527e11ae475d1957c8a22d9ec2c0905","tests/data/linux-m":"4a92f6fef1eeb679ec4511579d3004cfe6fc1d4dd73fed5299cde568f6cf3fbf","tests/data/linux-nic":"eac886df04c80e6ba02687087ddc93635c0f433f4f28195447499a8963989f21","tests/data/linux-vt":"2ebd4c761a492190609f6d8bcdd8f9c8c81e281b0d5e8a51b87f4ba126370bb4","tests/data/linux2.2":"c3d6e1466e9fb4111f4bf243b87a3de290d85224f1a4241947a3f51bdff08b82","tests/data/linux2.6":"52c2930ab1cad8271c280fefb1f581b12b7b3be445348d047a39f5e3448b3614","tests/data/linux2.6.26":"88f5a62b78956a21015ac887c5189a9f72900a842c2f844a1a5e197151a078d2","tests/data/linux3.0":"29b2aad27b5c291adab85e4150883fa6dc0034671c67e889d722168735ba2504","tests/data/rxvt":"9411be0058e147fc7a1962cd35145446d3d439ac3be9b6ca9d3aa2aa0c28ef5e","tests/data/rxvt-16color":"d41e75a0bad0e7c6d957c727f68dc507898685f3bbd71f0721a0a4beb14daf08","tests/data/rxvt-256color":"e6415e230d7962133d1da913cfcf23a0e2d3ed75379164a921feb9462c475a8e","tests/data/rxvt-88color":"958a81509d2b1e2cfe5a7bcf7a15e81d12575e4ccaa1dd308eda8edf7905a36a","tests/data/rxvt-basic":"3989e1c659121cb8fd8f67b8bff7f304e52c1f401cd1d09e906e11a58e0bc587","tests/data/rxvt-color":"3d2b49d48aca7fad7a3bf26d06592207b3c3cbf7afc3a5223fd0613f50a2739b","tests/data/rxvt-cygwin":"d50e434af6b3ab85b26e4f6af21c9c612d271efacaff3e64ef3da8c350a91809","tests/data/rxvt-cygwin-native":"34ee4ef070d9c366f5aba8f72a29a0e45ab552ba43b3e32265dfbe9eef157994","tests/data/rxvt-xpm":"4e8e40313ef00f0572456724249a625c36f2c5338b5014b87f236e29f612212e","tests/data/screen":"57c2888ffb9d7632381dc6191657abda998ca5f0958ad5787f848ff2206198f9","tests/data/screen-256color":"13fd658c693283ffb495d7f473bf525422e312e199bff6e64abdb70db5b22f46","tests/data/xterm":"67a59e4f0807759546dbf45c0bc2dddb30944ef553990345b1d08d7d19ddc13a","tests/data/xterm-256color":"e2525d133091a1ac38b2ad4eecd8df48eee31789c8fafac0ed99bcd6b746d8ce","tests/terminfo.rs":"5338fa4feae9e0d7d2c5f6ae3e911e6b88f668a23a4313e89b329d84464ef904"},"package":"3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a"} \ No newline at end of file diff --git a/third_party/rust/term/.cargo-ok b/third_party/rust/term/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/term/.gitignore b/third_party/rust/term/.gitignore new file mode 100644 index 000000000000..4fffb2f89cbd --- /dev/null +++ b/third_party/rust/term/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/third_party/rust/term/.travis.yml b/third_party/rust/term/.travis.yml new file mode 100644 index 000000000000..0fe3b4e9a055 --- /dev/null +++ b/third_party/rust/term/.travis.yml @@ -0,0 +1,11 @@ +language: rust +rust: + - stable + - beta + - nightly +sudo: false +script: + - cargo build --verbose + - cargo test --verbose + - cargo doc +after_success: curl https://raw.githubusercontent.com/Stebalien/doc/master/push_docs.sh | sh diff --git a/third_party/rust/term/Cargo.toml b/third_party/rust/term/Cargo.toml new file mode 100644 index 000000000000..b4b376c8c709 --- /dev/null +++ b/third_party/rust/term/Cargo.toml @@ -0,0 +1,17 @@ +[package] + +name = "term" +version = "0.4.4" +authors = ["The Rust Project Developers", "Steven Allen"] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/Stebalien/term" +homepage = "https://github.com/Stebalien/term" +documentation = "https://stebalien.github.io/doc/term/term/" +description = """ +A terminal formatting library +""" + +[dependencies] +winapi = "0.2" +kernel32-sys = "0.2" diff --git a/third_party/rust/term/LICENSE-APACHE b/third_party/rust/term/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/term/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/term/LICENSE-MIT b/third_party/rust/term/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/term/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +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. diff --git a/third_party/rust/term/README.md b/third_party/rust/term/README.md new file mode 100644 index 000000000000..e1b75ec5c199 --- /dev/null +++ b/third_party/rust/term/README.md @@ -0,0 +1,36 @@ +term +==== + +A Rust library for terminfo parsing and terminal colors. + +[![Build Status](https://travis-ci.org/Stebalien/term.svg?branch=master)](https://travis-ci.org/Stebalien/term) +[![Build status](https://ci.appveyor.com/api/projects/status/2duvop23k4n3owyt?svg=true)](https://ci.appveyor.com/project/Stebalien/term) + +[Documentation](https://stebalien.github.io/doc/term/term/) + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] + +term = "*" +``` + +and this to your crate root: + +```rust +extern crate term; +``` + +## Packaging and Distributing + +For all terminals but windows consoles, this library depends on a non-hashed +(for now) terminfo database being present. For example, on Debian derivitives, +you should depend on ncurses-term; on Arch Linux, you depend on ncurses; and on +MinGW, you should depend on mingw32-terminfo. + +Unfortunately, if you're using a non-windows console on Windows (e.g. MinGW, +Cygwin, Git Bash), you'll need to set the TERMINFO environment variable to +point to the directory containing the terminfo database. diff --git a/third_party/rust/term/appveyor.yml b/third_party/rust/term/appveyor.yml new file mode 100644 index 000000000000..6a1b8dc19c03 --- /dev/null +++ b/third_party/rust/term/appveyor.yml @@ -0,0 +1,17 @@ +environment: + matrix: + - TARGET: x86_64-pc-windows-msvc + - TARGET: i686-pc-windows-msvc + - TARGET: i686-pc-windows-gnu +install: + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" + - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" + - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin + - SET PATH=%PATH%;C:\MinGW\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo test --verbose diff --git a/third_party/rust/term/rustfmt.toml b/third_party/rust/term/rustfmt.toml new file mode 100644 index 000000000000..f86d8d12917d --- /dev/null +++ b/third_party/rust/term/rustfmt.toml @@ -0,0 +1,3 @@ +wrap_match_arms = true +struct_lit_multiline_style = "ForceMulti" +wrap_comments = false diff --git a/third_party/rust/term/scripts/id_rsa.enc b/third_party/rust/term/scripts/id_rsa.enc new file mode 100644 index 0000000000000000000000000000000000000000..8fb90fa04d3600d9b6d4b6ee538f570693af471a GIT binary patch literal 1680 zcmV;B25E^ogt80r( zzme&mJUFnLimQ`9-~q!oz>PC_hwmzWVTnmMmVY3jen0*RFe3xZYY1Q}dX#qK=qMh! zyROZHe*9tN*uNwn^i&+SN~}=;ri-2}QdP!s!x-L!+t>QMj%)%k$3fYyxuPS-b$0#h zG$v8hi6tou#CDp!I_7fi#(|YQH>$%2oofOYo(l%`828RQ!6zP@_C<{<|~VPr$Gse{+=I^+8*}-@AGnaj61T!4980SXzu8@cy%37 zm9*#M)o6fSQrdIBC2+Xs-bXRga6pL&rOT9a;!kb+vvtm*q$cf!fHT}A?HP%XX^2SE zfADZjEKXKHY-`$a0wHh^+X!X?`6~+<*ySigp!4pW?m`GQofK)~um1dIT{=j>k{Me60?cKbYjD4uo=2gZ(o0frzk*&_K26t!MauBFaJn23KRmDg>vLPs%eaT!9 z`cFH8cPQ0HLihtOlpnE z`y1Z{{K!qGQx~zR&S?CyX}MxXi^m(K#0%*(2&(7pQa~oax(9U!W{#$DHd1x~8!+!_ zCLo7a=-Iy!sulhZ?aMA;JaA+36W9_HI7sR}rz=4rS1TIRK}{cErSLIU1(Q=C){ z75Wr9^%zU zqO9804ip}nLfYm- zt0j3YS=rLYZs<9lKFw2r%g8FgVU>xIrdEJ)1VR0CC$ocDb>#-?sKH?$H;&R=xd-}? zX2_=MAZ+h=207wJoU730Gm%Hnrlf5bcUiSCWrXbCYm4lWJt81`G0+W<@%34v4d!@n zufn;(2N<>)SmzSm2+KZ~Ux6COao?D!oL0%y!O3vxxhVG^q-FwOAY((WZE(i0Ny7jY z?0j){v!RH6J!FT@hWmIBzFU=K{m-b~p95IJCersHlywxihTtJtsL(=_ilbkTUaQtw z@rb=;4(0tHv?9HcT5Ww?NtNgT4VGEj`3`c-zYA3&|xZ%$}|uKCmuRYn342x=)=$jr@Y0;JRakS z<647upq#(T;^2B-dY`Q7zrNUUX$?L=NPB1%Pvljm+sG%XgkX-cX#C;W#C#b=If{~N z2`DjfX9-0f$MA(pLy9My80Q!=N$;-ufPinG-B7*6%H4|Y3?pmT+dsI5z)Tw?lbt$y zQR$n|F`EK7Yc@-5`t%lLk(4;1L9njrA+adbf&J6&_o_>xH8d@VxCx_Tdrsf-~(ea6u==zRTk%K5;g+y)-FUc-Gj)0N0Va235-&$C z$bw2tCem-`6t3_0DQ&DR95nN3=yNT1rzMEgp5=EL)vTn3i!VY)^$urT&_QyTM&ftj z-pTcGL9!`%Zwk2ncex(H4I#U*B(T?#bY{Jo8#SU=D5JBvDKT;w)qjKyigthTPnN6_ aPb;Ec5;j_Ue-paC$w4z$ or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Terminal formatting library. +//! +//! This crate provides the `Terminal` trait, which abstracts over an [ANSI +//! Terminal][ansi] to provide color printing, among other things. There are two +//! implementations, the `TerminfoTerminal`, which uses control characters from +//! a [terminfo][ti] database, and `WinConsole`, which uses the [Win32 Console +//! API][win]. +//! +//! # Usage +//! +//! This crate is [on crates.io](https://crates.io/crates/term) and can be +//! used by adding `term` to the dependencies in your project's `Cargo.toml`. +//! +//! ```toml +//! [dependencies] +//! +//! term = "0.2" +//! ``` +//! +//! and this to your crate root: +//! +//! ```rust +//! extern crate term; +//! ``` +//! +//! # Examples +//! +//! ```no_run +//! extern crate term; +//! use std::io::prelude::*; +//! +//! fn main() { +//! let mut t = term::stdout().unwrap(); +//! +//! t.fg(term::color::GREEN).unwrap(); +//! write!(t, "hello, ").unwrap(); +//! +//! t.fg(term::color::RED).unwrap(); +//! writeln!(t, "world!").unwrap(); +//! +//! t.reset().unwrap(); +//! } +//! ``` +//! +//! [ansi]: https://en.wikipedia.org/wiki/ANSI_escape_code +//! [win]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010%28v=vs.85%29.aspx +//! [ti]: https://en.wikipedia.org/wiki/Terminfo + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://doc.rust-lang.org/favicon.ico", + html_root_url = "https://stebalien.github.io/doc/term/term/", + test(attr(deny(warnings))))] +#![deny(missing_docs)] +#![cfg_attr(test, deny(warnings))] + +use std::io::prelude::*; + +pub use terminfo::TerminfoTerminal; +#[cfg(windows)] +pub use win::WinConsole; + +use std::io::{self, Stdout, Stderr}; + +pub mod terminfo; + +#[cfg(windows)] +mod win; + +/// Alias for stdout terminals. +pub type StdoutTerminal = Terminal + Send; +/// Alias for stderr terminals. +pub type StderrTerminal = Terminal + Send; + +#[cfg(not(windows))] +/// Return a Terminal wrapping stdout, or None if a terminal couldn't be +/// opened. +pub fn stdout() -> Option> { + TerminfoTerminal::new(io::stdout()).map(|t| Box::new(t) as Box) +} + +#[cfg(windows)] +/// Return a Terminal wrapping stdout, or None if a terminal couldn't be +/// opened. +pub fn stdout() -> Option> { + TerminfoTerminal::new(io::stdout()) + .map(|t| Box::new(t) as Box) + .or_else(|| WinConsole::new(io::stdout()).ok().map(|t| Box::new(t) as Box)) +} + +#[cfg(not(windows))] +/// Return a Terminal wrapping stderr, or None if a terminal couldn't be +/// opened. +pub fn stderr() -> Option> { + TerminfoTerminal::new(io::stderr()).map(|t| Box::new(t) as Box) +} + +#[cfg(windows)] +/// Return a Terminal wrapping stderr, or None if a terminal couldn't be +/// opened. +pub fn stderr() -> Option> { + TerminfoTerminal::new(io::stderr()) + .map(|t| Box::new(t) as Box) + .or_else(|| WinConsole::new(io::stderr()).ok().map(|t| Box::new(t) as Box)) +} + + +/// Terminal color definitions +#[allow(missing_docs)] +pub mod color { + /// Number for a terminal color + pub type Color = u16; + + pub const BLACK: Color = 0; + pub const RED: Color = 1; + pub const GREEN: Color = 2; + pub const YELLOW: Color = 3; + pub const BLUE: Color = 4; + pub const MAGENTA: Color = 5; + pub const CYAN: Color = 6; + pub const WHITE: Color = 7; + + pub const BRIGHT_BLACK: Color = 8; + pub const BRIGHT_RED: Color = 9; + pub const BRIGHT_GREEN: Color = 10; + pub const BRIGHT_YELLOW: Color = 11; + pub const BRIGHT_BLUE: Color = 12; + pub const BRIGHT_MAGENTA: Color = 13; + pub const BRIGHT_CYAN: Color = 14; + pub const BRIGHT_WHITE: Color = 15; +} + +/// Terminal attributes for use with term.attr(). +/// +/// Most attributes can only be turned on and must be turned off with term.reset(). +/// The ones that can be turned off explicitly take a boolean value. +/// Color is also represented as an attribute for convenience. +#[derive(Debug, PartialEq, Eq, Copy, Clone)] +pub enum Attr { + /// Bold (or possibly bright) mode + Bold, + /// Dim mode, also called faint or half-bright. Often not supported + Dim, + /// Italics mode. Often not supported + Italic(bool), + /// Underline mode + Underline(bool), + /// Blink mode + Blink, + /// Standout mode. Often implemented as Reverse, sometimes coupled with Bold + Standout(bool), + /// Reverse mode, inverts the foreground and background colors + Reverse, + /// Secure mode, also called invis mode. Hides the printed text + Secure, + /// Convenience attribute to set the foreground color + ForegroundColor(color::Color), + /// Convenience attribute to set the background color + BackgroundColor(color::Color), +} + +/// An error arising from interacting with the terminal. +#[derive(Debug)] +pub enum Error { + /// Indicates an error from any underlying IO + Io(io::Error), + /// Indicates an error during terminfo parsing + TerminfoParsing(terminfo::Error), + /// Indicates an error expanding a parameterized string from the terminfo database + ParameterizedExpansion(terminfo::parm::Error), + /// Indicates that the terminal does not support the requested operation. + NotSupported, + /// Indicates that the `TERM` environment variable was unset, and thus we were unable to detect + /// which terminal we should be using. + TermUnset, + /// Indicates that we were unable to find a terminfo entry for the requested terminal. + TerminfoEntryNotFound, + /// Indicates that the cursor could not be moved to the requested position. + CursorDestinationInvalid, + /// Indicates that the terminal does not support displaying the requested color. + /// + /// This is like `NotSupported`, but more specific. + ColorOutOfRange, + #[doc(hidden)] + /// Please don't match against this - if you do, we can't promise we won't break your crate + /// with a semver-compliant version bump. + __Nonexhaustive, +} + +// manually implemented because std::io::Error does not implement Eq/PartialEq +impl std::cmp::PartialEq for Error { + fn eq(&self, other: &Error) -> bool { + use Error::*; + match self { + &Io(_) => false, + &TerminfoParsing(ref inner1) => { + match other { + &TerminfoParsing(ref inner2) => inner1 == inner2, + _ => false, + } + } + &ParameterizedExpansion(ref inner1) => { + match other { + &ParameterizedExpansion(ref inner2) => inner1 == inner2, + _ => false, + } + } + &NotSupported => { + match other { + &NotSupported => true, + _ => false, + } + } + &TermUnset => { + match other { + &TermUnset => true, + _ => false, + } + } + &TerminfoEntryNotFound => { + match other { + &TerminfoEntryNotFound => true, + _ => false, + } + } + &CursorDestinationInvalid => { + match other { + &CursorDestinationInvalid => true, + _ => false, + } + } + &ColorOutOfRange => { + match other { + &ColorOutOfRange => true, + _ => false, + } + } + &__Nonexhaustive => { + match other { + &__Nonexhaustive => true, + _ => false, + } + } + } + } +} + +/// The canonical `Result` type using this crate's Error type. +pub type Result = std::result::Result; + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + use std::error::Error; + if let &::Error::Io(ref e) = self { + write!(f, "{}", e) + } else { + f.write_str(self.description()) + } + } +} + +impl std::error::Error for Error { + fn description(&self) -> &str { + use Error::*; + use std::error::Error; + match self { + &Io(ref io) => io.description(), + &TerminfoParsing(ref e) => e.description(), + &ParameterizedExpansion(ref e) => e.description(), + &NotSupported => "operation not supported by the terminal", + &TermUnset => "TERM environment variable unset, unable to detect a terminal", + &TerminfoEntryNotFound => "could not find a terminfo entry for this terminal", + &CursorDestinationInvalid => "could not move cursor to requested position", + &ColorOutOfRange => "color not supported by the terminal", + &__Nonexhaustive => "placeholder variant that shouldn't be used", + } + } + + fn cause(&self) -> Option<&std::error::Error> { + match self { + &Error::Io(ref io) => Some(io), + &Error::TerminfoParsing(ref e) => Some(e), + &Error::ParameterizedExpansion(ref e) => Some(e), + _ => None, + } + } +} + +impl From for io::Error { + fn from(err: Error) -> io::Error { + let kind = match &err { + &Error::Io(ref e) => e.kind(), + _ => io::ErrorKind::Other, + }; + io::Error::new(kind, err) + } +} + +impl std::convert::From for Error { + fn from(val: io::Error) -> Self { + Error::Io(val) + } +} + +impl std::convert::From for Error { + fn from(val: terminfo::Error) -> Self { + Error::TerminfoParsing(val) + } +} + +impl std::convert::From for Error { + fn from(val: terminfo::parm::Error) -> Self { + Error::ParameterizedExpansion(val) + } +} + +/// A terminal with similar capabilities to an ANSI Terminal +/// (foreground/background colors etc). +pub trait Terminal: Write { + /// The terminal's output writer type. + type Output: Write; + + /// Sets the foreground color to the given color. + /// + /// If the color is a bright color, but the terminal only supports 8 colors, + /// the corresponding normal color will be used instead. + /// + /// Returns `Ok(())` if the color change code was sent to the terminal, or `Err(e)` if there + /// was an error. + fn fg(&mut self, color: color::Color) -> Result<()>; + + /// Sets the background color to the given color. + /// + /// If the color is a bright color, but the terminal only supports 8 colors, + /// the corresponding normal color will be used instead. + /// + /// Returns `Ok(())` if the color change code was sent to the terminal, or `Err(e)` if there + /// was an error. + fn bg(&mut self, color: color::Color) -> Result<()>; + + /// Sets the given terminal attribute, if supported. Returns `Ok(())` if the attribute is + /// supported and was sent to the terminal, or `Err(e)` if there was an error or the attribute + /// wasn't supported. + fn attr(&mut self, attr: Attr) -> Result<()>; + + /// Returns whether the given terminal attribute is supported. + fn supports_attr(&self, attr: Attr) -> bool; + + /// Resets all terminal attributes and colors to their defaults. + /// + /// Returns `Ok(())` if the reset code was printed, or `Err(e)` if there was an error. + /// + /// *Note: This does not flush.* + /// + /// That means the reset command may get buffered so, if you aren't planning on doing anything + /// else that might flush stdout's buffer (e.g. writing a line of text), you should flush after + /// calling reset. + fn reset(&mut self) -> Result<()>; + + /// Returns true if reset is supported. + fn supports_reset(&self) -> bool; + + /// Returns true if color is fully supported. + /// + /// If this function returns `true`, `bg`, `fg`, and `reset` will never + /// return `Err(Error::NotSupported)`. + fn supports_color(&self) -> bool; + + /// Moves the cursor up one line. + /// + /// Returns `Ok(())` if the cursor movement code was printed, or `Err(e)` if there was an + /// error. + fn cursor_up(&mut self) -> Result<()>; + + /// Deletes the text from the cursor location to the end of the line. + /// + /// Returns `Ok(())` if the deletion code was printed, or `Err(e)` if there was an error. + fn delete_line(&mut self) -> Result<()>; + + /// Moves the cursor to the left edge of the current line. + /// + /// Returns `Ok(true)` if the deletion code was printed, or `Err(e)` if there was an error. + fn carriage_return(&mut self) -> Result<()>; + + /// Gets an immutable reference to the stream inside + fn get_ref<'a>(&'a self) -> &'a Self::Output; + + /// Gets a mutable reference to the stream inside + fn get_mut<'a>(&'a mut self) -> &'a mut Self::Output; + + /// Returns the contained stream, destroying the `Terminal` + fn into_inner(self) -> Self::Output where Self: Sized; +} diff --git a/third_party/rust/term/src/terminfo/mod.rs b/third_party/rust/term/src/terminfo/mod.rs new file mode 100644 index 000000000000..fdc7f4ac6ed8 --- /dev/null +++ b/third_party/rust/term/src/terminfo/mod.rs @@ -0,0 +1,339 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Terminfo database interface. + +use std::collections::HashMap; +use std::env; +use std::fs::File; +use std::io::prelude::*; +use std::io; +use std::io::BufReader; +use std::path::Path; + +use Attr; +use color; +use Terminal; +use Result; +use self::searcher::get_dbpath_for_term; +use self::parser::compiled::{parse, msys_terminfo}; +use self::parm::{expand, Variables, Param}; +use self::Error::*; + + +/// A parsed terminfo database entry. +#[derive(Debug)] +pub struct TermInfo { + /// Names for the terminal + pub names: Vec, + /// Map of capability name to boolean value + pub bools: HashMap, + /// Map of capability name to numeric value + pub numbers: HashMap, + /// Map of capability name to raw (unexpanded) string + pub strings: HashMap>, +} + +impl TermInfo { + /// Create a TermInfo based on current environment. + pub fn from_env() -> Result { + let term = match env::var("TERM") { + Ok(name) => TermInfo::from_name(&name), + Err(..) => return Err(::Error::TermUnset), + }; + + if term.is_err() && env::var("MSYSCON").ok().map_or(false, |s| "mintty.exe" == s) { + // msys terminal + Ok(msys_terminfo()) + } else { + term + } + } + + /// Create a TermInfo for the named terminal. + pub fn from_name(name: &str) -> Result { + get_dbpath_for_term(name) + .ok_or_else(|| ::Error::TerminfoEntryNotFound) + .and_then(|p| TermInfo::from_path(&p)) + } + + /// Parse the given TermInfo. + pub fn from_path>(path: P) -> Result { + Self::_from_path(path.as_ref()) + } + // Keep the metadata small + // (That is, this uses a &Path so that this function need not be instantiated + // for every type + // which implements AsRef. One day, if/when rustc is a bit smarter, it + // might do this for + // us. Alas. ) + fn _from_path(path: &Path) -> Result { + let file = try!(File::open(path).map_err(|e| ::Error::Io(e))); + let mut reader = BufReader::new(file); + parse(&mut reader, false) + } +} + +#[derive(Debug, Eq, PartialEq)] +/// An error from parsing a terminfo entry +pub enum Error { + /// The "magic" number at the start of the file was wrong. + /// + /// It should be `0x11A` + BadMagic(u16), + /// The names in the file were not valid UTF-8. + /// + /// In theory these should only be ASCII, but to work with the Rust `str` type, we treat them + /// as UTF-8. This is valid, except when a terminfo file decides to be invalid. This hasn't + /// been encountered in the wild. + NotUtf8(::std::str::Utf8Error), + /// The names section of the file was empty + ShortNames, + /// More boolean parameters are present in the file than this crate knows how to interpret. + TooManyBools, + /// More number parameters are present in the file than this crate knows how to interpret. + TooManyNumbers, + /// More string parameters are present in the file than this crate knows how to interpret. + TooManyStrings, + /// The length of some field was not >= -1. + InvalidLength, + /// The names table was missing a trailing null terminator. + NamesMissingNull, + /// The strings table was missing a trailing null terminator. + StringsMissingNull, +} + +impl ::std::fmt::Display for Error { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + use std::error::Error; + match self { + &NotUtf8(e) => write!(f, "{}", e), + &BadMagic(v) => write!(f, "bad magic number {:x} in terminfo header", v), + _ => f.write_str(self.description()), + } + } +} + +impl ::std::convert::From<::std::string::FromUtf8Error> for Error { + fn from(v: ::std::string::FromUtf8Error) -> Self { + NotUtf8(v.utf8_error()) + } +} + +impl ::std::error::Error for Error { + fn description(&self) -> &str { + match self { + &BadMagic(..) => "incorrect magic number at start of file", + &ShortNames => "no names exposed, need at least one", + &TooManyBools => "more boolean properties than libterm knows about", + &TooManyNumbers => "more number properties than libterm knows about", + &TooManyStrings => "more string properties than libterm knows about", + &InvalidLength => "invalid length field value, must be >= -1", + &NotUtf8(ref e) => e.description(), + &NamesMissingNull => "names table missing NUL terminator", + &StringsMissingNull => "string table missing NUL terminator", + } + } + + fn cause(&self) -> Option<&::std::error::Error> { + match self { + &NotUtf8(ref e) => Some(e), + _ => None, + } + } +} + +pub mod searcher; + +/// TermInfo format parsing. +pub mod parser { + //! ncurses-compatible compiled terminfo format parsing (term(5)) + pub mod compiled; + mod names; +} +pub mod parm; + + +fn cap_for_attr(attr: Attr) -> &'static str { + match attr { + Attr::Bold => "bold", + Attr::Dim => "dim", + Attr::Italic(true) => "sitm", + Attr::Italic(false) => "ritm", + Attr::Underline(true) => "smul", + Attr::Underline(false) => "rmul", + Attr::Blink => "blink", + Attr::Standout(true) => "smso", + Attr::Standout(false) => "rmso", + Attr::Reverse => "rev", + Attr::Secure => "invis", + Attr::ForegroundColor(_) => "setaf", + Attr::BackgroundColor(_) => "setab", + } +} + +/// A Terminal that knows how many colors it supports, with a reference to its +/// parsed Terminfo database record. +pub struct TerminfoTerminal { + num_colors: u16, + out: T, + ti: TermInfo, +} + +impl Terminal for TerminfoTerminal { + type Output = T; + fn fg(&mut self, color: color::Color) -> Result<()> { + let color = self.dim_if_necessary(color); + if self.num_colors > color { + return self.apply_cap("setaf", &[Param::Number(color as i32)]); + } + Err(::Error::ColorOutOfRange) + } + + fn bg(&mut self, color: color::Color) -> Result<()> { + let color = self.dim_if_necessary(color); + if self.num_colors > color { + return self.apply_cap("setab", &[Param::Number(color as i32)]); + } + Err(::Error::ColorOutOfRange) + } + + fn attr(&mut self, attr: Attr) -> Result<()> { + match attr { + Attr::ForegroundColor(c) => self.fg(c), + Attr::BackgroundColor(c) => self.bg(c), + _ => self.apply_cap(cap_for_attr(attr), &[]), + } + } + + fn supports_attr(&self, attr: Attr) -> bool { + match attr { + Attr::ForegroundColor(_) | Attr::BackgroundColor(_) => self.num_colors > 0, + _ => { + let cap = cap_for_attr(attr); + self.ti.strings.get(cap).is_some() + } + } + } + + fn reset(&mut self) -> Result<()> { + // are there any terminals that have color/attrs and not sgr0? + // Try falling back to sgr, then op + let cmd = match [("sgr0", &[] as &[Param]), + ("sgr", &[Param::Number(0)]), + ("op", &[])] + .iter() + .filter_map(|&(cap, params)| self.ti.strings.get(cap).map(|c| (c, params))) + .next() { + Some((op, params)) => { + match expand(op, params, &mut Variables::new()) { + Ok(cmd) => cmd, + Err(e) => return Err(e.into()), + } + } + None => return Err(::Error::NotSupported), + }; + try!(self.out.write_all(&cmd)); + Ok(()) + } + + fn supports_reset(&self) -> bool { + ["sgr0", "sgr", "op"].iter().any(|&cap| self.ti.strings.get(cap).is_some()) + } + + fn supports_color(&self) -> bool { + self.num_colors > 0 && self.supports_reset() + } + + fn cursor_up(&mut self) -> Result<()> { + self.apply_cap("cuu1", &[]) + } + + fn delete_line(&mut self) -> Result<()> { + self.apply_cap("dl", &[]) + } + + fn carriage_return(&mut self) -> Result<()> { + self.apply_cap("cr", &[]) + } + + fn get_ref<'a>(&'a self) -> &'a T { + &self.out + } + + fn get_mut<'a>(&'a mut self) -> &'a mut T { + &mut self.out + } + + fn into_inner(self) -> T + where Self: Sized + { + self.out + } +} + +impl TerminfoTerminal { + /// Create a new TerminfoTerminal with the given TermInfo and Write. + pub fn new_with_terminfo(out: T, terminfo: TermInfo) -> TerminfoTerminal { + let nc = if terminfo.strings.contains_key("setaf") && + terminfo.strings.contains_key("setab") { + terminfo.numbers.get("colors").map_or(0, |&n| n) + } else { + 0 + }; + + TerminfoTerminal { + out: out, + ti: terminfo, + num_colors: nc, + } + } + + /// Create a new TerminfoTerminal for the current environment with the given Write. + /// + /// Returns `None` when the terminfo cannot be found or parsed. + pub fn new(out: T) -> Option> { + TermInfo::from_env().map(move |ti| TerminfoTerminal::new_with_terminfo(out, ti)).ok() + } + + fn dim_if_necessary(&self, color: color::Color) -> color::Color { + if color >= self.num_colors && color >= 8 && color < 16 { + color - 8 + } else { + color + } + } + + fn apply_cap(&mut self, cmd: &str, params: &[Param]) -> Result<()> { + match self.ti.strings.get(cmd) { + Some(cmd) => { + match expand(&cmd, params, &mut Variables::new()) { + Ok(s) => { + try!(self.out.write_all(&s)); + Ok(()) + } + Err(e) => Err(e.into()), + } + } + None => Err(::Error::NotSupported), + } + } +} + + +impl Write for TerminfoTerminal { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.out.write(buf) + } + + fn flush(&mut self) -> io::Result<()> { + self.out.flush() + } +} diff --git a/third_party/rust/term/src/terminfo/parm.rs b/third_party/rust/term/src/terminfo/parm.rs new file mode 100644 index 000000000000..86f1411f675e --- /dev/null +++ b/third_party/rust/term/src/terminfo/parm.rs @@ -0,0 +1,717 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Parameterized string expansion + +use self::Param::*; +use self::States::*; +use self::FormatState::*; +use self::FormatOp::*; + +use std::iter::repeat; + +#[derive(Clone, Copy, PartialEq)] +enum States { + Nothing, + Percent, + SetVar, + GetVar, + PushParam, + CharConstant, + CharClose, + IntConstant(i32), + FormatPattern(Flags, FormatState), + SeekIfElse(usize), + SeekIfElsePercent(usize), + SeekIfEnd(usize), + SeekIfEndPercent(usize), +} + +#[derive(Copy, PartialEq, Clone)] +enum FormatState { + FormatStateFlags, + FormatStateWidth, + FormatStatePrecision, +} + +/// Types of parameters a capability can use +#[allow(missing_docs)] +#[derive(Clone)] +pub enum Param { + Words(String), + Number(i32), +} + +/// An error from interpreting a parameterized string. +#[derive(Debug, Eq, PartialEq)] +pub enum Error { + /// Data was requested from the stack, but the stack didn't have enough elements. + StackUnderflow, + /// The type of the element(s) on top of the stack did not match the type that the operator + /// wanted. + TypeMismatch, + /// An unrecognized format option was used. + UnrecognizedFormatOption(char), + /// An invalid variable name was used. + InvalidVariableName(char), + /// An invalid parameter index was used. + InvalidParameterIndex(char), + /// A malformed character constant was used. + MalformedCharacterConstant, + /// An integer constant was too large (overflowed an i32) + IntegerConstantOverflow, + /// A malformed integer constant was used. + MalformedIntegerConstant, + /// A format width constant was too large (overflowed a usize) + FormatWidthOverflow, + /// A format precision constant was too large (overflowed a usize) + FormatPrecisionOverflow, +} + +impl ::std::fmt::Display for Error { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + use std::error::Error; + f.write_str(self.description()) + } +} + +impl ::std::error::Error for Error { + fn description(&self) -> &str { + use self::Error::*; + match self { + &StackUnderflow => "not enough elements on the stack", + &TypeMismatch => "type mismatch", + &UnrecognizedFormatOption(_) => "unrecognized format option", + &InvalidVariableName(_) => "invalid variable name", + &InvalidParameterIndex(_) => "invalid parameter index", + &MalformedCharacterConstant => "malformed character constant", + &IntegerConstantOverflow => "integer constant computation overflowed", + &MalformedIntegerConstant => "malformed integer constant", + &FormatWidthOverflow => "format width constant computation overflowed", + &FormatPrecisionOverflow => "format precision constant computation overflowed", + } + } + + fn cause(&self) -> Option<&::std::error::Error> { + None + } +} + +/// Container for static and dynamic variable arrays +pub struct Variables { + /// Static variables A-Z + sta: [Param; 26], + /// Dynamic variables a-z + dyn: [Param; 26], +} + +impl Variables { + /// Return a new zero-initialized Variables + pub fn new() -> Variables { + Variables { + sta: [Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), + Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), + Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), + Number(0), Number(0), Number(0), Number(0), Number(0)], + dyn: [Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), + Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), + Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), + Number(0), Number(0), Number(0), Number(0), Number(0)], + } + } +} + +/// Expand a parameterized capability +/// +/// # Arguments +/// * `cap` - string to expand +/// * `params` - vector of params for %p1 etc +/// * `vars` - Variables struct for %Pa etc +/// +/// To be compatible with ncurses, `vars` should be the same between calls to `expand` for +/// multiple capabilities for the same terminal. +pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) -> Result, Error> { + let mut state = Nothing; + + // expanded cap will only rarely be larger than the cap itself + let mut output = Vec::with_capacity(cap.len()); + + let mut stack: Vec = Vec::new(); + + // Copy parameters into a local vector for mutability + let mut mparams = [Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), + Number(0), Number(0), Number(0)]; + for (dst, src) in mparams.iter_mut().zip(params.iter()) { + *dst = (*src).clone(); + } + + for &c in cap.iter() { + let cur = c as char; + let mut old_state = state; + match state { + Nothing => { + if cur == '%' { + state = Percent; + } else { + output.push(c); + } + } + Percent => { + match cur { + '%' => { + output.push(c); + state = Nothing + } + 'c' => { + match stack.pop() { + // if c is 0, use 0200 (128) for ncurses compatibility + Some(Number(0)) => output.push(128u8), + // Don't check bounds. ncurses just casts and truncates. + Some(Number(c)) => output.push(c as u8), + Some(_) => return Err(Error::TypeMismatch), + None => return Err(Error::StackUnderflow), + } + } + 'p' => state = PushParam, + 'P' => state = SetVar, + 'g' => state = GetVar, + '\'' => state = CharConstant, + '{' => state = IntConstant(0), + 'l' => { + match stack.pop() { + Some(Words(s)) => stack.push(Number(s.len() as i32)), + Some(_) => return Err(Error::TypeMismatch), + None => return Err(Error::StackUnderflow), + } + } + '+' | '-' | '/' | '*' | '^' | '&' | '|' | 'm' => { + match (stack.pop(), stack.pop()) { + (Some(Number(y)), Some(Number(x))) => { + stack.push(Number(match cur { + '+' => x + y, + '-' => x - y, + '*' => x * y, + '/' => x / y, + '|' => x | y, + '&' => x & y, + '^' => x ^ y, + 'm' => x % y, + _ => unreachable!("logic error"), + })) + } + (Some(_), Some(_)) => return Err(Error::TypeMismatch), + _ => return Err(Error::StackUnderflow), + } + } + '=' | '>' | '<' | 'A' | 'O' => { + match (stack.pop(), stack.pop()) { + (Some(Number(y)), Some(Number(x))) => { + stack.push(Number(if match cur { + '=' => x == y, + '<' => x < y, + '>' => x > y, + 'A' => x > 0 && y > 0, + 'O' => x > 0 || y > 0, + _ => unreachable!("logic error"), + } { + 1 + } else { + 0 + })) + } + (Some(_), Some(_)) => return Err(Error::TypeMismatch), + _ => return Err(Error::StackUnderflow), + } + } + '!' | '~' => { + match stack.pop() { + Some(Number(x)) => { + stack.push(Number(match cur { + '!' if x > 0 => 0, + '!' => 1, + '~' => !x, + _ => unreachable!("logic error"), + })) + } + Some(_) => return Err(Error::TypeMismatch), + None => return Err(Error::StackUnderflow), + } + } + 'i' => { + match (&mparams[0], &mparams[1]) { + (&Number(x), &Number(y)) => { + mparams[0] = Number(x + 1); + mparams[1] = Number(y + 1); + } + (_, _) => return Err(Error::TypeMismatch), + } + } + + // printf-style support for %doxXs + 'd' | 'o' | 'x' | 'X' | 's' => { + if let Some(arg) = stack.pop() { + let flags = Flags::new(); + let res = try!(format(arg, FormatOp::from_char(cur), flags)); + output.extend(res.iter().map(|x| *x)); + } else { + return Err(Error::StackUnderflow); + } + } + ':' | '#' | ' ' | '.' | '0'...'9' => { + let mut flags = Flags::new(); + let mut fstate = FormatStateFlags; + match cur { + ':' => (), + '#' => flags.alternate = true, + ' ' => flags.space = true, + '.' => fstate = FormatStatePrecision, + '0'...'9' => { + flags.width = cur as usize - '0' as usize; + fstate = FormatStateWidth; + } + _ => unreachable!("logic error"), + } + state = FormatPattern(flags, fstate); + } + + // conditionals + '?' => (), + 't' => { + match stack.pop() { + Some(Number(0)) => state = SeekIfElse(0), + Some(Number(_)) => (), + Some(_) => return Err(Error::TypeMismatch), + None => return Err(Error::StackUnderflow), + } + } + 'e' => state = SeekIfEnd(0), + ';' => (), + c => return Err(Error::UnrecognizedFormatOption(c)), + } + } + PushParam => { + // params are 1-indexed + stack.push(mparams[match cur.to_digit(10) { + Some(d) => d as usize - 1, + None => return Err(Error::InvalidParameterIndex(cur)), + }] + .clone()); + } + SetVar => { + if cur >= 'A' && cur <= 'Z' { + if let Some(arg) = stack.pop() { + let idx = (cur as u8) - b'A'; + vars.sta[idx as usize] = arg; + } else { + return Err(Error::StackUnderflow); + } + } else if cur >= 'a' && cur <= 'z' { + if let Some(arg) = stack.pop() { + let idx = (cur as u8) - b'a'; + vars.dyn[idx as usize] = arg; + } else { + return Err(Error::StackUnderflow); + } + } else { + return Err(Error::InvalidVariableName(cur)); + } + } + GetVar => { + if cur >= 'A' && cur <= 'Z' { + let idx = (cur as u8) - b'A'; + stack.push(vars.sta[idx as usize].clone()); + } else if cur >= 'a' && cur <= 'z' { + let idx = (cur as u8) - b'a'; + stack.push(vars.dyn[idx as usize].clone()); + } else { + return Err(Error::InvalidVariableName(cur)); + } + } + CharConstant => { + stack.push(Number(c as i32)); + state = CharClose; + } + CharClose => { + if cur != '\'' { + return Err(Error::MalformedCharacterConstant); + } + } + IntConstant(i) => { + if cur == '}' { + stack.push(Number(i)); + state = Nothing; + } else if let Some(digit) = cur.to_digit(10) { + match i.checked_mul(10).and_then(|i_ten| i_ten.checked_add(digit as i32)) { + Some(i) => { + state = IntConstant(i); + old_state = Nothing; + } + None => return Err(Error::IntegerConstantOverflow), + } + } else { + return Err(Error::MalformedIntegerConstant); + } + } + FormatPattern(ref mut flags, ref mut fstate) => { + old_state = Nothing; + match (*fstate, cur) { + (_, 'd') | (_, 'o') | (_, 'x') | (_, 'X') | (_, 's') => { + if let Some(arg) = stack.pop() { + let res = try!(format(arg, FormatOp::from_char(cur), *flags)); + output.extend(res.iter().map(|x| *x)); + // will cause state to go to Nothing + old_state = FormatPattern(*flags, *fstate); + } else { + return Err(Error::StackUnderflow); + } + } + (FormatStateFlags, '#') => { + flags.alternate = true; + } + (FormatStateFlags, '-') => { + flags.left = true; + } + (FormatStateFlags, '+') => { + flags.sign = true; + } + (FormatStateFlags, ' ') => { + flags.space = true; + } + (FormatStateFlags, '0'...'9') => { + flags.width = cur as usize - '0' as usize; + *fstate = FormatStateWidth; + } + (FormatStateFlags, '.') => { + *fstate = FormatStatePrecision; + } + (FormatStateWidth, '0'...'9') => { + flags.width = match flags.width.checked_mul(10).and_then(|w| { + w.checked_add(cur as usize - '0' as usize) + }) { + Some(width) => width, + None => return Err(Error::FormatWidthOverflow), + } + } + (FormatStateWidth, '.') => { + *fstate = FormatStatePrecision; + } + (FormatStatePrecision, '0'...'9') => { + flags.precision = match flags.precision.checked_mul(10).and_then(|w| { + w.checked_add(cur as usize - '0' as usize) + }) { + Some(precision) => precision, + None => return Err(Error::FormatPrecisionOverflow), + } + } + _ => return Err(Error::UnrecognizedFormatOption(cur)), + } + } + SeekIfElse(level) => { + if cur == '%' { + state = SeekIfElsePercent(level); + } + old_state = Nothing; + } + SeekIfElsePercent(level) => { + if cur == ';' { + if level == 0 { + state = Nothing; + } else { + state = SeekIfElse(level - 1); + } + } else if cur == 'e' && level == 0 { + state = Nothing; + } else if cur == '?' { + state = SeekIfElse(level + 1); + } else { + state = SeekIfElse(level); + } + } + SeekIfEnd(level) => { + if cur == '%' { + state = SeekIfEndPercent(level); + } + old_state = Nothing; + } + SeekIfEndPercent(level) => { + if cur == ';' { + if level == 0 { + state = Nothing; + } else { + state = SeekIfEnd(level - 1); + } + } else if cur == '?' { + state = SeekIfEnd(level + 1); + } else { + state = SeekIfEnd(level); + } + } + } + if state == old_state { + state = Nothing; + } + } + Ok(output) +} + +#[derive(Copy, PartialEq, Clone)] +struct Flags { + width: usize, + precision: usize, + alternate: bool, + left: bool, + sign: bool, + space: bool, +} + +impl Flags { + fn new() -> Flags { + Flags { + width: 0, + precision: 0, + alternate: false, + left: false, + sign: false, + space: false, + } + } +} + +#[derive(Copy, Clone)] +enum FormatOp { + FormatDigit, + FormatOctal, + FormatHex, + FormatHEX, + FormatString, +} + +impl FormatOp { + fn from_char(c: char) -> FormatOp { + match c { + 'd' => FormatDigit, + 'o' => FormatOctal, + 'x' => FormatHex, + 'X' => FormatHEX, + 's' => FormatString, + _ => panic!("bad FormatOp char"), + } + } +} + +fn format(val: Param, op: FormatOp, flags: Flags) -> Result, Error> { + let mut s = match val { + Number(d) => { + match op { + FormatDigit => { + if flags.sign { + format!("{:+01$}", d, flags.precision) + } else if d < 0 { + // C doesn't take sign into account in precision calculation. + format!("{:01$}", d, flags.precision + 1) + } else if flags.space { + format!(" {:01$}", d, flags.precision) + } else { + format!("{:01$}", d, flags.precision) + } + } + FormatOctal => { + if flags.alternate { + // Leading octal zero counts against precision. + format!("0{:01$o}", d, flags.precision.saturating_sub(1)) + } else { + format!("{:01$o}", d, flags.precision) + } + } + FormatHex => { + if flags.alternate && d != 0 { + format!("0x{:01$x}", d, flags.precision) + } else { + format!("{:01$x}", d, flags.precision) + } + } + FormatHEX => { + if flags.alternate && d != 0 { + format!("0X{:01$X}", d, flags.precision) + } else { + format!("{:01$X}", d, flags.precision) + } + } + FormatString => return Err(Error::TypeMismatch), + } + .into_bytes() + } + Words(s) => { + match op { + FormatString => { + let mut s = s.into_bytes(); + if flags.precision > 0 && flags.precision < s.len() { + s.truncate(flags.precision); + } + s + } + _ => return Err(Error::TypeMismatch), + } + } + }; + if flags.width > s.len() { + let n = flags.width - s.len(); + if flags.left { + s.extend(repeat(b' ').take(n)); + } else { + let mut s_ = Vec::with_capacity(flags.width); + s_.extend(repeat(b' ').take(n)); + s_.extend(s.into_iter()); + s = s_; + } + } + Ok(s) +} + +#[cfg(test)] +mod test { + use super::{expand, Variables}; + use super::Param::{self, Words, Number}; + use std::result::Result::Ok; + + #[test] + fn test_basic_setabf() { + let s = b"\\E[48;5;%p1%dm"; + assert_eq!(expand(s, &[Number(1)], &mut Variables::new()).unwrap(), + "\\E[48;5;1m".bytes().collect::>()); + } + + #[test] + fn test_multiple_int_constants() { + assert_eq!(expand(b"%{1}%{2}%d%d", &[], &mut Variables::new()).unwrap(), + "21".bytes().collect::>()); + } + + #[test] + fn test_op_i() { + let mut vars = Variables::new(); + assert_eq!(expand(b"%p1%d%p2%d%p3%d%i%p1%d%p2%d%p3%d", + &[Number(1), Number(2), Number(3)], + &mut vars), + Ok("123233".bytes().collect::>())); + assert_eq!(expand(b"%p1%d%p2%d%i%p1%d%p2%d", &[], &mut vars), + Ok("0011".bytes().collect::>())); + } + + #[test] + fn test_param_stack_failure_conditions() { + let mut varstruct = Variables::new(); + let vars = &mut varstruct; + fn get_res(fmt: &str, + cap: &str, + params: &[Param], + vars: &mut Variables) + -> Result, super::Error> { + let mut u8v: Vec<_> = fmt.bytes().collect(); + u8v.extend(cap.as_bytes().iter().map(|&b| b)); + expand(&u8v, params, vars) + } + + let caps = ["%d", "%c", "%s", "%Pa", "%l", "%!", "%~"]; + for &cap in caps.iter() { + let res = get_res("", cap, &[], vars); + assert!(res.is_err(), + "Op {} succeeded incorrectly with 0 stack entries", + cap); + let p = if cap == "%s" || cap == "%l" { + Words("foo".to_string()) + } else { + Number(97) + }; + let res = get_res("%p1", cap, &[p], vars); + assert!(res.is_ok(), + "Op {} failed with 1 stack entry: {}", + cap, + res.err().unwrap()); + } + let caps = ["%+", "%-", "%*", "%/", "%m", "%&", "%|", "%A", "%O"]; + for &cap in caps.iter() { + let res = expand(cap.as_bytes(), &[], vars); + assert!(res.is_err(), + "Binop {} succeeded incorrectly with 0 stack entries", + cap); + let res = get_res("%{1}", cap, &[], vars); + assert!(res.is_err(), + "Binop {} succeeded incorrectly with 1 stack entry", + cap); + let res = get_res("%{1}%{2}", cap, &[], vars); + assert!(res.is_ok(), + "Binop {} failed with 2 stack entries: {}", + cap, + res.err().unwrap()); + } + } + + #[test] + fn test_push_bad_param() { + assert!(expand(b"%pa", &[], &mut Variables::new()).is_err()); + } + + #[test] + fn test_comparison_ops() { + let v = [('<', [1u8, 0u8, 0u8]), ('=', [0u8, 1u8, 0u8]), ('>', [0u8, 0u8, 1u8])]; + for &(op, bs) in v.iter() { + let s = format!("%{{1}}%{{2}}%{}%d", op); + let res = expand(s.as_bytes(), &[], &mut Variables::new()); + assert!(res.is_ok(), res.err().unwrap()); + assert_eq!(res.unwrap(), vec![b'0' + bs[0]]); + let s = format!("%{{1}}%{{1}}%{}%d", op); + let res = expand(s.as_bytes(), &[], &mut Variables::new()); + assert!(res.is_ok(), res.err().unwrap()); + assert_eq!(res.unwrap(), vec![b'0' + bs[1]]); + let s = format!("%{{2}}%{{1}}%{}%d", op); + let res = expand(s.as_bytes(), &[], &mut Variables::new()); + assert!(res.is_ok(), res.err().unwrap()); + assert_eq!(res.unwrap(), vec![b'0' + bs[2]]); + } + } + + #[test] + fn test_conditionals() { + let mut vars = Variables::new(); + let s = b"\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"; + let res = expand(s, &[Number(1)], &mut vars); + assert!(res.is_ok(), res.err().unwrap()); + assert_eq!(res.unwrap(), "\\E[31m".bytes().collect::>()); + let res = expand(s, &[Number(8)], &mut vars); + assert!(res.is_ok(), res.err().unwrap()); + assert_eq!(res.unwrap(), "\\E[90m".bytes().collect::>()); + let res = expand(s, &[Number(42)], &mut vars); + assert!(res.is_ok(), res.err().unwrap()); + assert_eq!(res.unwrap(), "\\E[38;5;42m".bytes().collect::>()); + } + + #[test] + fn test_format() { + let mut varstruct = Variables::new(); + let vars = &mut varstruct; + assert_eq!(expand(b"%p1%s%p2%2s%p3%2s%p4%.2s", + &[Words("foo".to_string()), + Words("foo".to_string()), + Words("f".to_string()), + Words("foo".to_string())], + vars), + Ok("foofoo ffo".bytes().collect::>())); + assert_eq!(expand(b"%p1%:-4.2s", &[Words("foo".to_string())], vars), + Ok("fo ".bytes().collect::>())); + + assert_eq!(expand(b"%p1%d%p1%.3d%p1%5d%p1%:+d", &[Number(1)], vars), + Ok("1001 1+1".bytes().collect::>())); + assert_eq!(expand(b"%p1%o%p1%#o%p2%6.4x%p2%#6.4X", + &[Number(15), Number(27)], + vars), + Ok("17017 001b0X001B".bytes().collect::>())); + } +} diff --git a/third_party/rust/term/src/terminfo/parser/compiled.rs b/third_party/rust/term/src/terminfo/parser/compiled.rs new file mode 100644 index 000000000000..9827ade3d0d5 --- /dev/null +++ b/third_party/rust/term/src/terminfo/parser/compiled.rs @@ -0,0 +1,218 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! ncurses-compatible compiled terminfo format parsing (term(5)) + +use std::collections::HashMap; +use std::io::prelude::*; +use std::io; + +use terminfo::Error::*; +use terminfo::TermInfo; +use Result; + +pub use terminfo::parser::names::*; + +// These are the orders ncurses uses in its compiled format (as of 5.9). Not +// sure if portable. + +fn read_le_u16(r: &mut io::Read) -> io::Result { + let mut b = [0; 2]; + let mut amt = 0; + while amt < b.len() { + match try!(r.read(&mut b[amt..])) { + 0 => return Err(io::Error::new(io::ErrorKind::Other, "end of file")), + n => amt += n, + } + } + Ok((b[0] as u16) | ((b[1] as u16) << 8)) +} + +fn read_byte(r: &mut io::Read) -> io::Result { + match r.bytes().next() { + Some(s) => s, + None => Err(io::Error::new(io::ErrorKind::Other, "end of file")), + } +} + +/// Parse a compiled terminfo entry, using long capability names if `longnames` +/// is true +pub fn parse(file: &mut io::Read, longnames: bool) -> Result { + let (bnames, snames, nnames) = if longnames { + (boolfnames, stringfnames, numfnames) + } else { + (boolnames, stringnames, numnames) + }; + + // Check magic number + let magic = try!(read_le_u16(file)); + if magic != 0x011A { + return Err(BadMagic(magic).into()); + } + + // According to the spec, these fields must be >= -1 where -1 means that the + // feature is not + // supported. Using 0 instead of -1 works because we skip sections with length + // 0. + macro_rules! read_nonneg { + () => {{ + match try!(read_le_u16(file)) as i16 { + n if n >= 0 => n as usize, + -1 => 0, + _ => return Err(InvalidLength.into()), + } + }} + } + + let names_bytes = read_nonneg!(); + let bools_bytes = read_nonneg!(); + let numbers_count = read_nonneg!(); + let string_offsets_count = read_nonneg!(); + let string_table_bytes = read_nonneg!(); + + if names_bytes == 0 { + return Err(ShortNames.into()); + } + + if bools_bytes > boolnames.len() { + return Err(TooManyBools.into()); + } + + if numbers_count > numnames.len() { + return Err(TooManyNumbers.into()); + } + + if string_offsets_count > stringnames.len() { + return Err(TooManyStrings.into()); + } + + // don't read NUL + let mut bytes = Vec::new(); + try!(file.take((names_bytes - 1) as u64).read_to_end(&mut bytes)); + let names_str = match String::from_utf8(bytes) { + Ok(s) => s, + Err(e) => return Err(NotUtf8(e.utf8_error()).into()), + }; + + let term_names: Vec = names_str.split('|') + .map(|s| s.to_string()) + .collect(); + // consume NUL + if try!(read_byte(file)) != b'\0' { + return Err(NamesMissingNull.into()); + } + + let bools_map: HashMap = try! { + (0..bools_bytes).filter_map(|i| match read_byte(file) { + Err(e) => Some(Err(e)), + Ok(1) => Some(Ok((bnames[i].to_string(), true))), + Ok(_) => None + }).collect() + }; + + if (bools_bytes + names_bytes) % 2 == 1 { + try!(read_byte(file)); // compensate for padding + } + + let numbers_map: HashMap = try! { + (0..numbers_count).filter_map(|i| match read_le_u16(file) { + Ok(0xFFFF) => None, + Ok(n) => Some(Ok((nnames[i].to_string(), n))), + Err(e) => Some(Err(e)) + }).collect() + }; + + let string_map: HashMap> = if string_offsets_count > 0 { + let string_offsets: Vec = try!((0..string_offsets_count) + .map(|_| read_le_u16(file)) + .collect()); + + let mut string_table = Vec::new(); + try!(file.take(string_table_bytes as u64).read_to_end(&mut string_table)); + + try!(string_offsets.into_iter() + .enumerate() + .filter(|&(_, offset)| { + // non-entry + offset != 0xFFFF + }) + .map(|(i, offset)| { + let offset = offset as usize; + + let name = if snames[i] == "_" { + stringfnames[i] + } else { + snames[i] + }; + + if offset == 0xFFFE { + // undocumented: FFFE indicates cap@, which means the capability + // is not present + // unsure if the handling for this is correct + return Ok((name.to_string(), Vec::new())); + } + + // Find the offset of the NUL we want to go to + let nulpos = string_table[offset..string_table_bytes] + .iter() + .position(|&b| b == 0); + match nulpos { + Some(len) => { + Ok((name.to_string(), + string_table[offset..offset + len].to_vec())) + } + None => return Err(::Error::TerminfoParsing(StringsMissingNull)), + } + }) + .collect()) + } else { + HashMap::new() + }; + + // And that's all there is to it + Ok(TermInfo { + names: term_names, + bools: bools_map, + numbers: numbers_map, + strings: string_map, + }) +} + +/// Create a dummy TermInfo struct for msys terminals +pub fn msys_terminfo() -> TermInfo { + let mut strings = HashMap::new(); + strings.insert("sgr0".to_string(), b"\x1B[0m".to_vec()); + strings.insert("bold".to_string(), b"\x1B[1m".to_vec()); + strings.insert("setaf".to_string(), b"\x1B[3%p1%dm".to_vec()); + strings.insert("setab".to_string(), b"\x1B[4%p1%dm".to_vec()); + + let mut numbers = HashMap::new(); + numbers.insert("colors".to_string(), 8u16); + + TermInfo { + names: vec!["cygwin".to_string()], // msys is a fork of an older cygwin version + bools: HashMap::new(), + numbers: numbers, + strings: strings, + } +} + +#[cfg(test)] +mod test { + + use super::{boolnames, boolfnames, numnames, numfnames, stringnames, stringfnames}; + + #[test] + fn test_veclens() { + assert_eq!(boolfnames.len(), boolnames.len()); + assert_eq!(numfnames.len(), numnames.len()); + assert_eq!(stringfnames.len(), stringnames.len()); + } +} diff --git a/third_party/rust/term/src/terminfo/parser/names.rs b/third_party/rust/term/src/terminfo/parser/names.rs new file mode 100644 index 000000000000..795ff84870c4 --- /dev/null +++ b/third_party/rust/term/src/terminfo/parser/names.rs @@ -0,0 +1,154 @@ +#![allow(non_upper_case_globals, missing_docs)] +#![cfg_attr(rustfmt, rustfmt_skip)] + +pub static boolfnames: &'static [&'static str] = &[ + "auto_left_margin", "auto_right_margin", "no_esc_ctlc", "ceol_standout_glitch", + "eat_newline_glitch", "erase_overstrike", "generic_type", "hard_copy", "has_meta_key", + "has_status_line", "insert_null_glitch", "memory_above", "memory_below", "move_insert_mode", + "move_standout_mode", "over_strike", "status_line_esc_ok", "dest_tabs_magic_smso", + "tilde_glitch", "transparent_underline", "xon_xoff", "needs_xon_xoff", "prtr_silent", + "hard_cursor", "non_rev_rmcup", "no_pad_char", "non_dest_scroll_region", "can_change", + "back_color_erase", "hue_lightness_saturation", "col_addr_glitch", "cr_cancels_micro_mode", + "has_print_wheel", "row_addr_glitch", "semi_auto_right_margin", "cpi_changes_res", + "lpi_changes_res", "backspaces_with_bs", "crt_no_scrolling", "no_correctly_working_cr", + "gnu_has_meta_key", "linefeed_is_newline", "has_hardware_tabs", "return_does_clr_eol" +]; + +pub static boolnames: &'static [&'static str] = &[ + "bw", "am", "xsb", "xhp", "xenl", "eo", "gn", + "hc", "km", "hs", "in", "db", "da", "mir", + "msgr", "os", "eslok", "xt", "hz", "ul", "xon", + "nxon", "mc5i", "chts", "nrrmc", "npc", "ndscr", + "ccc", "bce", "hls", "xhpa", "crxm", "daisy", + "xvpa", "sam", "cpix", "lpix", "OTbs", "OTns", + "OTnc", "OTMT", "OTNL", "OTpt", "OTxr" +]; + +pub static numfnames: &'static [&'static str] = &[ + "columns", "init_tabs", "lines", "lines_of_memory", "magic_cookie_glitch", "padding_baud_rate", + "virtual_terminal", "width_status_line", "num_labels", "label_height", "label_width", + "max_attributes", "maximum_windows", "max_colors", "max_pairs", "no_color_video", + "buffer_capacity", "dot_vert_spacing", "dot_horz_spacing", "max_micro_address", + "max_micro_jump", "micro_col_size", "micro_line_size", "number_of_pins", "output_res_char", + "output_res_line", "output_res_horz_inch", "output_res_vert_inch", "print_rate", + "wide_char_size", "buttons", "bit_image_entwining", "bit_image_type", "magic_cookie_glitch_ul", + "carriage_return_delay", "new_line_delay", "backspace_delay", "horizontal_tab_delay", + "number_of_function_keys" +]; + +pub static numnames: &'static [&'static str] = &[ + "cols", "it", "lines", "lm", "xmc", "pb", "vt", "wsl", "nlab", "lh", "lw", "ma", "wnum", + "colors", "pairs", "ncv", "bufsz", "spinv", "spinh", "maddr", "mjump", "mcs", "mls", "npins", + "orc", "orl", "orhi", "orvi", "cps", "widcs", "btns", "bitwin", "bitype", "UTug", "OTdC", + "OTdN", "OTdB", "OTdT", "OTkn" +]; + +pub static stringfnames: &'static [&'static str] = &[ + "back_tab", "bell", "carriage_return", "change_scroll_region", "clear_all_tabs", + "clear_screen", "clr_eol", "clr_eos", "column_address", "command_character", "cursor_address", + "cursor_down", "cursor_home", "cursor_invisible", "cursor_left", "cursor_mem_address", + "cursor_normal", "cursor_right", "cursor_to_ll", "cursor_up", "cursor_visible", + "delete_character", "delete_line", "dis_status_line", "down_half_line", + "enter_alt_charset_mode", "enter_blink_mode", "enter_bold_mode", "enter_ca_mode", + "enter_delete_mode", "enter_dim_mode", "enter_insert_mode", "enter_secure_mode", + "enter_protected_mode", "enter_reverse_mode", "enter_standout_mode", "enter_underline_mode", + "erase_chars", "exit_alt_charset_mode", "exit_attribute_mode", "exit_ca_mode", + "exit_delete_mode", "exit_insert_mode", "exit_standout_mode", "exit_underline_mode", + "flash_screen", "form_feed", "from_status_line", "init_1string", "init_2string", + "init_3string", "init_file", "insert_character", "insert_line", "insert_padding", + "key_backspace", "key_catab", "key_clear", "key_ctab", "key_dc", "key_dl", "key_down", + "key_eic", "key_eol", "key_eos", "key_f0", "key_f1", "key_f10", "key_f2", "key_f3", "key_f4", + "key_f5", "key_f6", "key_f7", "key_f8", "key_f9", "key_home", "key_ic", "key_il", "key_left", + "key_ll", "key_npage", "key_ppage", "key_right", "key_sf", "key_sr", "key_stab", "key_up", + "keypad_local", "keypad_xmit", "lab_f0", "lab_f1", "lab_f10", "lab_f2", "lab_f3", "lab_f4", + "lab_f5", "lab_f6", "lab_f7", "lab_f8", "lab_f9", "meta_off", "meta_on", "newline", "pad_char", + "parm_dch", "parm_delete_line", "parm_down_cursor", "parm_ich", "parm_index", + "parm_insert_line", "parm_left_cursor", "parm_right_cursor", "parm_rindex", "parm_up_cursor", + "pkey_key", "pkey_local", "pkey_xmit", "print_screen", "prtr_off", "prtr_on", "repeat_char", + "reset_1string", "reset_2string", "reset_3string", "reset_file", "restore_cursor", + "row_address", "save_cursor", "scroll_forward", "scroll_reverse", "set_attributes", "set_tab", + "set_window", "tab", "to_status_line", "underline_char", "up_half_line", "init_prog", "key_a1", + "key_a3", "key_b2", "key_c1", "key_c3", "prtr_non", "char_padding", "acs_chars", "plab_norm", + "key_btab", "enter_xon_mode", "exit_xon_mode", "enter_am_mode", "exit_am_mode", + "xon_character", "xoff_character", "ena_acs", "label_on", "label_off", "key_beg", "key_cancel", + "key_close", "key_command", "key_copy", "key_create", "key_end", "key_enter", "key_exit", + "key_find", "key_help", "key_mark", "key_message", "key_move", "key_next", "key_open", + "key_options", "key_previous", "key_print", "key_redo", "key_reference", "key_refresh", + "key_replace", "key_restart", "key_resume", "key_save", "key_suspend", "key_undo", "key_sbeg", + "key_scancel", "key_scommand", "key_scopy", "key_screate", "key_sdc", "key_sdl", "key_select", + "key_send", "key_seol", "key_sexit", "key_sfind", "key_shelp", "key_shome", "key_sic", + "key_sleft", "key_smessage", "key_smove", "key_snext", "key_soptions", "key_sprevious", + "key_sprint", "key_sredo", "key_sreplace", "key_sright", "key_srsume", "key_ssave", + "key_ssuspend", "key_sundo", "req_for_input", "key_f11", "key_f12", "key_f13", "key_f14", + "key_f15", "key_f16", "key_f17", "key_f18", "key_f19", "key_f20", "key_f21", "key_f22", + "key_f23", "key_f24", "key_f25", "key_f26", "key_f27", "key_f28", "key_f29", "key_f30", + "key_f31", "key_f32", "key_f33", "key_f34", "key_f35", "key_f36", "key_f37", "key_f38", + "key_f39", "key_f40", "key_f41", "key_f42", "key_f43", "key_f44", "key_f45", "key_f46", + "key_f47", "key_f48", "key_f49", "key_f50", "key_f51", "key_f52", "key_f53", "key_f54", + "key_f55", "key_f56", "key_f57", "key_f58", "key_f59", "key_f60", "key_f61", "key_f62", + "key_f63", "clr_bol", "clear_margins", "set_left_margin", "set_right_margin", "label_format", + "set_clock", "display_clock", "remove_clock", "create_window", "goto_window", "hangup", + "dial_phone", "quick_dial", "tone", "pulse", "flash_hook", "fixed_pause", "wait_tone", "user0", + "user1", "user2", "user3", "user4", "user5", "user6", "user7", "user8", "user9", "orig_pair", + "orig_colors", "initialize_color", "initialize_pair", "set_color_pair", "set_foreground", + "set_background", "change_char_pitch", "change_line_pitch", "change_res_horz", + "change_res_vert", "define_char", "enter_doublewide_mode", "enter_draft_quality", + "enter_italics_mode", "enter_leftward_mode", "enter_micro_mode", "enter_near_letter_quality", + "enter_normal_quality", "enter_shadow_mode", "enter_subscript_mode", "enter_superscript_mode", + "enter_upward_mode", "exit_doublewide_mode", "exit_italics_mode", "exit_leftward_mode", + "exit_micro_mode", "exit_shadow_mode", "exit_subscript_mode", "exit_superscript_mode", + "exit_upward_mode", "micro_column_address", "micro_down", "micro_left", "micro_right", + "micro_row_address", "micro_up", "order_of_pins", "parm_down_micro", "parm_left_micro", + "parm_right_micro", "parm_up_micro", "select_char_set", "set_bottom_margin", + "set_bottom_margin_parm", "set_left_margin_parm", "set_right_margin_parm", "set_top_margin", + "set_top_margin_parm", "start_bit_image", "start_char_set_def", "stop_bit_image", + "stop_char_set_def", "subscript_characters", "superscript_characters", "these_cause_cr", + "zero_motion", "char_set_names", "key_mouse", "mouse_info", "req_mouse_pos", "get_mouse", + "set_a_foreground", "set_a_background", "pkey_plab", "device_type", "code_set_init", + "set0_des_seq", "set1_des_seq", "set2_des_seq", "set3_des_seq", "set_lr_margin", + "set_tb_margin", "bit_image_repeat", "bit_image_newline", "bit_image_carriage_return", + "color_names", "define_bit_image_region", "end_bit_image_region", "set_color_band", + "set_page_length", "display_pc_char", "enter_pc_charset_mode", "exit_pc_charset_mode", + "enter_scancode_mode", "exit_scancode_mode", "pc_term_options", "scancode_escape", + "alt_scancode_esc", "enter_horizontal_hl_mode", "enter_left_hl_mode", "enter_low_hl_mode", + "enter_right_hl_mode", "enter_top_hl_mode", "enter_vertical_hl_mode", "set_a_attributes", + "set_pglen_inch", "termcap_init2", "termcap_reset", "linefeed_if_not_lf", + "backspace_if_not_bs", "other_non_function_keys", "arrow_key_map", "acs_ulcorner", + "acs_llcorner", "acs_urcorner", "acs_lrcorner", "acs_ltee", "acs_rtee", "acs_btee", "acs_ttee", + "acs_hline", "acs_vline", "acs_plus", "memory_lock", "memory_unlock", "box_chars_1" +]; + +pub static stringnames: &'static [&'static str] = &[ + "cbt", "_", "cr", "csr", "tbc", "clear", "_", "_", "hpa", "cmdch", "cup", "cud1", "home", + "civis", "cub1", "mrcup", "cnorm", "cuf1", "ll", "cuu1", "cvvis", "dch1", "dl1", "dsl", "hd", + "smacs", "blink", "bold", "smcup", "smdc", "dim", "smir", "invis", "prot", "rev", "smso", + "smul", "ech", "rmacs", "sgr0", "rmcup", "rmdc", "rmir", "rmso", "rmul", "flash", "ff", "fsl", + "is1", "is2", "is3", "if", "ich1", "il1", "ip", "kbs", "ktbc", "kclr", "kctab", "_", "_", + "kcud1", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "khome", "_", + "_", "kcub1", "_", "knp", "kpp", "kcuf1", "_", "_", "khts", "_", "rmkx", "smkx", "_", "_", "_", + "_", "_", "_", "_", "_", "_", "_", "_", "rmm", "_", "_", "pad", "dch", "dl", "cud", "ich", + "indn", "il", "cub", "cuf", "rin", "cuu", "pfkey", "pfloc", "pfx", "mc0", "mc4", "_", "rep", + "rs1", "rs2", "rs3", "rf", "rc", "vpa", "sc", "ind", "ri", "sgr", "_", "wind", "_", "tsl", + "uc", "hu", "iprog", "_", "_", "_", "_", "_", "mc5p", "rmp", "acsc", "pln", "kcbt", "smxon", + "rmxon", "smam", "rmam", "xonc", "xoffc", "_", "smln", "rmln", "_", "kcan", "kclo", "kcmd", + "kcpy", "kcrt", "_", "kent", "kext", "kfnd", "khlp", "kmrk", "kmsg", "kmov", "knxt", "kopn", + "kopt", "kprv", "kprt", "krdo", "kref", "krfr", "krpl", "krst", "kres", "ksav", "kspd", "kund", + "kBEG", "kCAN", "kCMD", "kCPY", "kCRT", "_", "_", "kslt", "kEND", "kEOL", "kEXT", "kFND", + "kHLP", "kHOM", "_", "kLFT", "kMSG", "kMOV", "kNXT", "kOPT", "kPRV", "kPRT", "kRDO", "kRPL", + "kRIT", "kRES", "kSAV", "kSPD", "kUND", "rfi", "_", "_", "_", "_", "_", "_", "_", "_", "_", + "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", + "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", + "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "dclk", "rmclk", "cwin", "wingo", + "_", "dial", "qdial", "_", "_", "hook", "pause", "wait", "_", "_", "_", "_", "_", "_", "_", + "_", "_", "_", "op", "oc", "initc", "initp", "scp", "setf", "setb", "cpi", "lpi", "chr", "cvr", + "defc", "swidm", "sdrfq", "sitm", "slm", "smicm", "snlq", "snrmq", "sshm", "ssubm", "ssupm", + "sum", "rwidm", "ritm", "rlm", "rmicm", "rshm", "rsubm", "rsupm", "rum", "mhpa", "mcud1", + "mcub1", "mcuf1", "mvpa", "mcuu1", "porder", "mcud", "mcub", "mcuf", "mcuu", "scs", "smgb", + "smgbp", "smglp", "smgrp", "smgt", "smgtp", "sbim", "scsd", "rbim", "rcsd", "subcs", "supcs", + "docr", "zerom", "csnm", "kmous", "minfo", "reqmp", "getm", "setaf", "setab", "pfxl", "devt", + "csin", "s0ds", "s1ds", "s2ds", "s3ds", "smglr", "smgtb", "birep", "binel", "bicr", "colornm", + "defbi", "endbi", "setcolor", "slines", "dispc", "smpch", "rmpch", "smsc", "rmsc", "pctrm", + "scesc", "scesa", "ehhlm", "elhlm", "elohlm", "erhlm", "ethlm", "evhlm", "sgr1", "slength", + "OTi2", "OTrs", "OTnl", "OTbs", "OTko", "OTma", "OTG2", "OTG3", "OTG1", "OTG4", "OTGR", "OTGL", + "OTGU", "OTGD", "OTGH", "OTGV", "OTGC", "meml", "memu", "box1" +]; diff --git a/third_party/rust/term/src/terminfo/searcher.rs b/third_party/rust/term/src/terminfo/searcher.rs new file mode 100644 index 000000000000..ccd152c66fd4 --- /dev/null +++ b/third_party/rust/term/src/terminfo/searcher.rs @@ -0,0 +1,80 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! ncurses-compatible database discovery +//! +//! Does not support hashed database, only filesystem! + +use std::env; +use std::fs; +use std::path::PathBuf; + +/// Return path to database entry for `term` +pub fn get_dbpath_for_term(term: &str) -> Option { + let mut dirs_to_search = Vec::new(); + let first_char = match term.chars().next() { + Some(c) => c, + None => return None, + }; + + // Find search directory + match env::var_os("TERMINFO") { + Some(dir) => dirs_to_search.push(PathBuf::from(dir)), + None => { + if let Some(mut homedir) = env::home_dir() { + // ncurses compatibility; + homedir.push(".terminfo"); + dirs_to_search.push(homedir) + } + match env::var("TERMINFO_DIRS") { + Ok(dirs) => { + for i in dirs.split(':') { + if i == "" { + dirs_to_search.push(PathBuf::from("/usr/share/terminfo")); + } else { + dirs_to_search.push(PathBuf::from(i)); + } + } + } + // Found nothing in TERMINFO_DIRS, use the default paths: + // According to /etc/terminfo/README, after looking at + // ~/.terminfo, ncurses will search /etc/terminfo, then + // /lib/terminfo, and eventually /usr/share/terminfo. + Err(..) => { + dirs_to_search.push(PathBuf::from("/etc/terminfo")); + dirs_to_search.push(PathBuf::from("/lib/terminfo")); + dirs_to_search.push(PathBuf::from("/usr/share/terminfo")); + } + } + } + }; + + // Look for the terminal in all of the search directories + for mut p in dirs_to_search { + if fs::metadata(&p).is_ok() { + p.push(&first_char.to_string()); + p.push(&term); + if fs::metadata(&p).is_ok() { + return Some(p); + } + p.pop(); + p.pop(); + + // on some installations the dir is named after the hex of the char + // (e.g. OS X) + p.push(&format!("{:x}", first_char as usize)); + p.push(term); + if fs::metadata(&p).is_ok() { + return Some(p); + } + } + } + None +} diff --git a/third_party/rust/term/src/win.rs b/third_party/rust/term/src/win.rs new file mode 100644 index 000000000000..3d571d507359 --- /dev/null +++ b/third_party/rust/term/src/win.rs @@ -0,0 +1,301 @@ +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Windows console handling + +// FIXME (#13400): this is only a tiny fraction of the Windows console api + +extern crate kernel32; +extern crate winapi; + +use std::io::prelude::*; +use std::io; +use std::ptr; + +use Attr; +use Error; +use Result; +use Terminal; +use color; + +/// A Terminal implementation which uses the Win32 Console API. +pub struct WinConsole { + buf: T, + def_foreground: color::Color, + def_background: color::Color, + foreground: color::Color, + background: color::Color, +} + +fn color_to_bits(color: color::Color) -> u16 { + // magic numbers from mingw-w64's wincon.h + + let bits = match color % 8 { + color::BLACK => 0, + color::BLUE => 0x1, + color::GREEN => 0x2, + color::RED => 0x4, + color::YELLOW => 0x2 | 0x4, + color::MAGENTA => 0x1 | 0x4, + color::CYAN => 0x1 | 0x2, + color::WHITE => 0x1 | 0x2 | 0x4, + _ => unreachable!(), + }; + + if color >= 8 { + bits | 0x8 + } else { + bits + } +} + +fn bits_to_color(bits: u16) -> color::Color { + let color = match bits & 0x7 { + 0 => color::BLACK, + 0x1 => color::BLUE, + 0x2 => color::GREEN, + 0x4 => color::RED, + 0x6 => color::YELLOW, + 0x5 => color::MAGENTA, + 0x3 => color::CYAN, + 0x7 => color::WHITE, + _ => unreachable!(), + }; + + color | (bits & 0x8) // copy the hi-intensity bit +} + +// Just get a handle to the current console buffer whatever it is +fn conout() -> io::Result { + let name = b"CONOUT$\0"; + let handle = unsafe { + kernel32::CreateFileA(name.as_ptr() as *const i8, + winapi::GENERIC_READ | winapi::GENERIC_WRITE, + winapi::FILE_SHARE_WRITE, + ptr::null_mut(), + winapi::OPEN_EXISTING, + 0, + ptr::null_mut()) + }; + if handle == winapi::INVALID_HANDLE_VALUE { + Err(io::Error::last_os_error()) + } else { + Ok(handle) + } +} + +// This test will only pass if it is running in an actual console, probably +#[test] +fn test_conout() { + assert!(conout().is_ok()) +} + +impl WinConsole { + fn apply(&mut self) -> io::Result<()> { + let out = try!(conout()); + let _unused = self.buf.flush(); + let mut accum: winapi::WORD = 0; + accum |= color_to_bits(self.foreground); + accum |= color_to_bits(self.background) << 4; + unsafe { + kernel32::SetConsoleTextAttribute(out, accum); + } + Ok(()) + } + + /// Returns `Err` whenever the terminal cannot be created for some + /// reason. + pub fn new(out: T) -> io::Result> { + let fg; + let bg; + let handle = try!(conout()); + unsafe { + let mut buffer_info = ::std::mem::uninitialized(); + if kernel32::GetConsoleScreenBufferInfo(handle, &mut buffer_info) != 0 { + fg = bits_to_color(buffer_info.wAttributes); + bg = bits_to_color(buffer_info.wAttributes >> 4); + } else { + return Err(io::Error::last_os_error()); + } + } + Ok(WinConsole { + buf: out, + def_foreground: fg, + def_background: bg, + foreground: fg, + background: bg, + }) + } +} + +impl Write for WinConsole { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.buf.write(buf) + } + + fn flush(&mut self) -> io::Result<()> { + self.buf.flush() + } +} + +impl Terminal for WinConsole { + type Output = T; + + fn fg(&mut self, color: color::Color) -> Result<()> { + self.foreground = color; + try!(self.apply()); + + Ok(()) + } + + fn bg(&mut self, color: color::Color) -> Result<()> { + self.background = color; + try!(self.apply()); + + Ok(()) + } + + fn attr(&mut self, attr: Attr) -> Result<()> { + match attr { + Attr::ForegroundColor(f) => { + self.foreground = f; + try!(self.apply()); + Ok(()) + } + Attr::BackgroundColor(b) => { + self.background = b; + try!(self.apply()); + Ok(()) + } + _ => Err(Error::NotSupported), + } + } + + fn supports_attr(&self, attr: Attr) -> bool { + // it claims support for underscore and reverse video, but I can't get + // it to do anything -cmr + match attr { + Attr::ForegroundColor(_) | Attr::BackgroundColor(_) => true, + _ => false, + } + } + + fn reset(&mut self) -> Result<()> { + self.foreground = self.def_foreground; + self.background = self.def_background; + try!(self.apply()); + + Ok(()) + } + + fn supports_reset(&self) -> bool { + true + } + + fn supports_color(&self) -> bool { + true + } + + fn cursor_up(&mut self) -> Result<()> { + let _unused = self.buf.flush(); + let handle = try!(conout()); + unsafe { + let mut buffer_info = ::std::mem::uninitialized(); + if kernel32::GetConsoleScreenBufferInfo(handle, &mut buffer_info) != 0 { + let (x, y) = (buffer_info.dwCursorPosition.X, + buffer_info.dwCursorPosition.Y); + if y == 0 { + // Even though this might want to be a CursorPositionInvalid, on Unix there + // is no checking to see if the cursor is already on the first line. + // I'm not sure what the ideal behavior is, but I think it'd be silly to have + // cursor_up fail in this case. + Ok(()) + } else { + let pos = winapi::COORD { + X: x, + Y: y - 1, + }; + if kernel32::SetConsoleCursorPosition(handle, pos) != 0 { + Ok(()) + } else { + Err(io::Error::last_os_error().into()) + } + } + } else { + Err(io::Error::last_os_error().into()) + } + } + } + + fn delete_line(&mut self) -> Result<()> { + let _unused = self.buf.flush(); + let handle = try!(conout()); + unsafe { + let mut buffer_info = ::std::mem::uninitialized(); + if kernel32::GetConsoleScreenBufferInfo(handle, &mut buffer_info) == 0 { + return Err(io::Error::last_os_error().into()); + } + let pos = buffer_info.dwCursorPosition; + let size = buffer_info.dwSize; + let num = (size.X - pos.X) as winapi::DWORD; + let mut written = 0; + if kernel32::FillConsoleOutputCharacterW(handle, 0, num, pos, &mut written) == 0 { + return Err(io::Error::last_os_error().into()); + } + if kernel32::FillConsoleOutputAttribute(handle, 0, num, pos, &mut written) == 0 { + return Err(io::Error::last_os_error().into()); + } + // Similar reasoning for not failing as in cursor_up -- it doesn't even make + // sense to + // me that these APIs could have written 0, unless the terminal is width zero. + Ok(()) + } + } + + fn carriage_return(&mut self) -> Result<()> { + let _unused = self.buf.flush(); + let handle = try!(conout()); + unsafe { + let mut buffer_info = ::std::mem::uninitialized(); + if kernel32::GetConsoleScreenBufferInfo(handle, &mut buffer_info) != 0 { + let winapi::COORD { X: x, Y: y } = buffer_info.dwCursorPosition; + if x == 0 { + Err(Error::CursorDestinationInvalid) + } else { + let pos = winapi::COORD { + X: 0, + Y: y, + }; + if kernel32::SetConsoleCursorPosition(handle, pos) != 0 { + Ok(()) + } else { + Err(io::Error::last_os_error().into()) + } + } + } else { + Err(io::Error::last_os_error().into()) + } + } + } + + fn get_ref<'a>(&'a self) -> &'a T { + &self.buf + } + + fn get_mut<'a>(&'a mut self) -> &'a mut T { + &mut self.buf + } + + fn into_inner(self) -> T + where Self: Sized + { + self.buf + } +} diff --git a/third_party/rust/term/tests/data/dumb b/third_party/rust/term/tests/data/dumb new file mode 100644 index 0000000000000000000000000000000000000000..fd4091a9946019db595d9b4ac2a6b935fe42dd20 GIT binary patch literal 308 zcmb1Qlwe?DU}R`w;9y88%}uJYFwjlT&neB#Qvh)lN=hmj7#IT>{{LqHs{4-ySTID; R6bvIS8v{E7F9R140szw?1nB?( literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux b/third_party/rust/term/tests/data/linux new file mode 100644 index 0000000000000000000000000000000000000000..b458ffaf9ee20fee8841b0a3aca29bbc46c77fa1 GIT binary patch literal 1780 zcmbtVTWm~G6y4`cL%mB7Itbz>-tIm3-p(|GQB+G?saKSVcuY$l(}z+@&4@%I5g+_W zgoH>WB9WjZd@yUk|k>G<5ajkvsOovj@xanSd?S1y$=iGJ9^yG`tG?DTs zDV7Hkbxm#U2Q*HOH#hBSPSg+y{K52-Cg~87=jFow^yJba8ig?;NjWrz@@WbgGy@rj zim8OkXg&A_ssYwfBkiLknCBg$BXmr&6LeDh({zq5&?V}mTRQHdhxC}9X`Y$+Exkkh zKArmj|G8)U3w%)bpB3lDWpPDZ6F0;V>3PFp*(a|j8V$BiM;qkko@};~Sxq1LU#mQ? z{vYdlzn6&Wmi4sE!yd%BXHd!rlQW4aQc$mBHAji%PQ8uP>#+ zNR`5(%1r>RIOY0LEg~}xz64g3&4oEv39EovRwK}5&`dFNY5^f;8XRVNja49)$)OqX zy^}zobeYn1QJ3d+6Vv7^)10>uql;kWbP#B#0E=OIIm+VDk9mo)r3}RYE5svKSYsih zGBwwfflCXRxD5UW4r3+sGWp{)smKtXRA+cGnv`b+w(%9}lM&bYbb z&DUFUwqD)-b;rlrD|JumUpCxHylTAL^q@J_(!I00wR_j*-S^wB@9Elmuf22M=l!2L z-W+(5Jd^s4CL3YV5bt3$#M|Sf@ShbLYWWo+aIKrt5-P2;(mLCEPi)0Cwyw8zy~XDc zQs9(ULzq}W6Chf^CyC82j5vk(2o`NqB`ed;nsg}FO&T+e4$Cynq%qGh74mi;dFPLL zbZ5Z64(GTBQScU)q literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux-16color b/third_party/rust/term/tests/data/linux-16color new file mode 100644 index 0000000000000000000000000000000000000000..8c2e4768b6983a96f617fbe1f63c17cb816bf124 GIT binary patch literal 1858 zcmbtVU1(HC6h1R6n%2KqtXQ{}C>^Nv@7}rh?rvCdO>Io@{}-c+Slx|g%}qAuM`PFB zA`}Gi!M+Hhpa?<{1T_lvq12yLUy6wMp!QK8d=SC<&^{DzzcY6?tEnjs4msz1--Oh*+v@BXIOckY1pZ)V zltGya5d<|9ymQoIRSI)NlE%=-G=pZ5qB+R8)JRRVf;Izhp;q`DbQ1&m|4sHqCW`eynNsb*M8dp^9Kp_-7jfms>grLcx-F2T9A zuvIYI?tu5$8KfDxZE$f$#<`5l9$Nrxi>Z|iqw9lcQ>IN_%H!vH{^yIdWi4Ec*(I=* z^c}oYg8K?)wxeyPA?Gcozh>76XUBQQP8eU$URwqm$c{^63_Nz>3r=Ju%r^Pu3|LhG z{7{qO%^0w<0=SjQa2ErhRVKP^Jw+3o2~Q_W(Kt)Z9r@i=ic5Qwag}7K0o@Qf)vOEX zg;@_!hcE_chp?U@FcfX3574@a=GM-eGJpDlPpsd+8MEWkuD^D_Y`d7dyXR5+FaG0> z>z%*mOI?F|2fGJ*w)fuZyRz@b{+s;+2VQ;qN8!oAhs9H+*J!d8mWuNkrs8}&ZVCTc zp`npqg8>`ew2@F7owd=~F=ygvu5nDgW9n_bhmZodGz($Uu}-*DjBgT~Q=fF}@e(ZB zwzaHGKWkFZo>x>~s)B7s1_S3Ta!A} zFzt?5Y5q!DE;(IrnzhJO8f3rM07N;_SCeueW4H|w%4K37UQOic! Wl%Ph7HdxfYLsR=s8|F}ZM$ZzBk7K9HK^kN0Q_)tVa*^5uEbIxy@H4C(Uc)sUz&ON_-@9+Gs`;~|i zD1{;z5wB$=6zv}@Z*S`j`G=X;`@5sP-H~Ge0{_tXN5w(KVNvbK#j3iWQC$N#24^==<$=jrdW2j35 zEy@|%3`1=iXe!RoEDYEmzoq36SSl!Ec0K?W2epxAq-VFfskG1Ku(}8}M8iaVE^8p# z%&ZMjGtrKyn&>1%#*TVn8BXnitwq~bloxMbtGsW`X}jMs)A>C(7J7O7ZTNBIUDtT@ zd3U@gaUu~*^d9Yd*8lM2lYys$4^I6!Jv}rvJUMbbK8uqyqq!aQ4&4rVJw_aVHL-`> zehnjJ?wiIf)VR+Y_gUw6qH9#6bG^>>DxEQG1)jhFHpXX2Q<}srqvjjf`x%jmxqYnbwum4AYqq*3J!7L$JPI^5Kw|||D{xqW PaGM64PE)T3`Cq_?Z9GXgBt4jM0vKdT+4;#{*PA|9im$?Mx-f0x6>}Vn+)wo#-~9Vf2tJ(_={HVOZcxh#=oKS^aEX>pXgV* zNSEj`CDc~69eckGwo~m^d*J!n+wyUAH6Fltk4me&Du5kRV=9C%cg$LD#dXzGr`1d9 zW%a815xJlLR`<(B^c$F~d9^_2#9zJgz`x`>D<8VXy3Tp+xS)^f<9bY=(o?#uBVE(Y z|JkwKxzoR}$-bxcYx)iSwmzfZ(`Pq1w{z{y#wQc;j4(0ZV*lM?CDBOSNZTk`G_z*G zHKm+cu%;9t;Y|Yy$>PIshhgknMMGC;TwkEANEN6H_yBAGHUb-lx$ZnLU=U`R`7?kF zGXbBOtUn6kIvhH=*!yJ!R?4i@<%5}IF&~ugxz9RI-$9HXf*qk}fnF1EKTNh@T@K@z zw^e+QVG!VEc*N}&%raU>xKIWzO*07?;+xvWcPZQCn-enJCcLO*cr!wdvO#p;83(c zH=*?qb?>%@!SWeC!+eI1$8X}T2@OSliwInFvm&7tovrBX z$(eYTYdopHq1e@#4^=gr(t@` zzKMON+k|FPRE7eOt!{&$VGeMKgQ7k&5}D};VOoM3dQI0%yBE{WUdWZuOD3V!UNds- zlNP+|y#fFFZUAS;PqZf|f&(o28!Ub^@V}gHz_)t~zWRIk8xH&HTZ>1x;Mu*Iw&Oc} j2cERMXke6v92z}NC;Dm7p+_B>o3J$ZxC`@WF0}L~cK*F1 literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux-c-nc b/third_party/rust/term/tests/data/linux-c-nc new file mode 100644 index 0000000000000000000000000000000000000000..da344e0deaad46bf6dc7d202e42f5579c3871263 GIT binary patch literal 1766 zcmbtVO=whC6h8M()F_pxsHlUjN}r%{^u7Dun@O0`F|BC^V~Rf!Vun!Ti)LablQduU>Aj!LfyC!vDCd*BZv!KxbX+vxKK(38#h@QzjNM9)bR&{kDTv(=iGD8 zz4yCs@>Z!@T1|^+Tv?G^Pkv}57R2(wn9wyrfBtBH?%9nm~NDl)DChV`ls&-J*MRpB~a9nxrXuN>yrs zs=?lu!d9r&Y8^a3>q|b2Ud4?VkEysysWjLw)vf~gT*a)RQaq}P>bUw*{iIH)2gv>V zQr&+u(PJ=2^J>0Mihp(GhBxFZE5CThy2^RwIIX|bt-4+B*N1dY7xaiOzGugB=Su(m zEc+hUC-txT4}D6X(dTA4w{q>-#wrrdm=mcfvA1_v8TlwOj}}riWA#`Aj@6a428`8J zK*H??q@$VbaLq9GrJ|Qa6-no0S&k3TWCz2#GkZiVfjV?ehE_zWgnFb;=d%-hOrV`v08 z2_A9k1nU`%EnFxAm&Td+4B?>`@+oDTd^jO3Wx|U}hBqT*N11Rd$#54T&?ks??51cP zXF}z>D4Jjyxg($5N^$96GGQf|8c;8!?(?h%>W5h$)Pyt+>V&kODL52O(|ojUqS{59 z7ROd>UTNRmU)A~7p{efwv*&uQAHLmtA$Os2!{9W zREw3OUaS=xM1$BOwh0?+k3e>a7V$nTKW!!Jd(Y~<82>q^PL zCT@st#T{{1d@o*-p0^58dFmFtS3n1}cUX2UL@Sw0>F31%ndNzz|CqP)w|4;PCMyJpn4P9BcZX-enCT%Om> zZ{DFybNfz=HbeH%X=u9$wF{z`qbzoPpO=_?k5wy_73L8uqIDB%Wop*Qic=dITvq-E z)^aEGGWp{)w3mS=)e&BdhCOBAQaZv_G@w`MVAp;MMmXZ{PB#U^+-k1K-)_V>wGa&( zQAP!He6%Z32k81y7pQz}1X?~eF@n+21igULaeBM%o%*fow!Laz`glcZ_S37q*D^EN zM@P=(&g3Wi&h}q8S{xYvYwoSa(h71}fcUrMqnF9kCVX*gD_V`4*o-Gy-R|8*NE8_Cv)Q`5dv> zO;M)_pTI5a+Q)qv=8lXg*Bvw7GDa-ZG{=nXhN%#@pA&bMjH5bt+}8VoDU!|t`6ri8 zAq8;%RN?k&;Cl%2_g@~5R-v~mX*KSewdlnrYU!Z3NgW62P=s1dI$%;Rr6~7_1+giY GR`eIR*<6eO literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux-koi8r b/third_party/rust/term/tests/data/linux-koi8r new file mode 100644 index 0000000000000000000000000000000000000000..e3cb2a18dac7dc657aa0206bc531291732ae12cc GIT binary patch literal 1814 zcmbuAe{54#6vxlKB`|fsMwBQOQV1^*W$@m8@AXFtmI0#`HUkQA&=9O$rKQ~%UFSMS zYfMN;h=1TeBt{a*5)wi}f=(0t!zeK2A7Tvg570mL5C1SE$RGNL@%cUXwJS~_EWGTT z^Ev09ckX@X-tI0FVOmZdR1>cRN`;}(YFF`aAzD7FIW$(NFh(S49z8?LXeAl61`&sPC`mi$4e(yd zK^JI{#;FGKy!YuieW2+>I;HK$be7K11)8ESwSSquqw91-b93fj={NYlH)6M8@6L?> zNq>_R3q-r<6idbPVwHG7tP{5IyeMRY=oZ^x`PtsEzW0CqD#mw-eIhGLpixm5$6-&- zdh4Txe@0A-i{g^_RD3R;lAgB+(t0{(yr)5Xw6|9tn2EMBnQ{+^|2NC?4n1Pt?Dv{} zNtR_**5xsILY|bTSQD@t z^zaHB16u+MXdwmDM!^`ijDff@tc-y&0`@_uR4~0AW(S0ABPrQJKR-oJB9ww8lv{$f zvef2#d3a_Pyam$TibXlL6VeB)Q)+xbJI!)=k zgv;}~rPUjhX|8`6qnjYT^d7WbhuRF$%TX4)zRyccZ)Md3WkqhQ227q&mWj(a_rjE~O(}MFV=34eo!9f>Dn6yE8z+2)CLm^0yla zPOZcvMx0Rr9Utvh)B(DF)CDRZ!$8Z&7$X=RP0J1yY4yj=QrnNK6(4E zgLm?m3f~{PRs6d2)8IEl-yW_HPal~sPmdg^Tpj)Foy%ias#D{4-~D6am!mgpr|bWq z$UaCS!h4vA@b)-${AWcEb^8@OuBe-e%cXDT{+>;6Ax;5iPW5O~`vu3O}Ooh1pfVgwtII45cZM`#? zBJIqOe|GsCQUF)beB5EH_$q?j``hEu`RHytEyiuL6unqM-Tjm_sed=^iBgYAubWiN OC@Q{XL2N2!75xi6bY$KD literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux-lat b/third_party/rust/term/tests/data/linux-lat new file mode 100644 index 0000000000000000000000000000000000000000..9a428f96e180cc75c0dca31e8b133771bb193031 GIT binary patch literal 1822 zcmbuAU1$_n6vxlK8#I1LQEA;Ot2m(bBQtkqvK!XAMvaMI#ZQbbLD$XJ-DI++>!!xW z-BSDrih{lbN(Ds_L=Z$Nv=2U5zg|R2@j>uWANo)P^`U)`PXFi5ZnjOeG<3*0_xC^d z%(*k?-p$MrD`_q@P)V#0dAWT5z%nmYJgO;jI9JR@Aai*uatc$8YHpU7>4qi+<4h4n3ep^t0yb$}i{_=wBPDj zNs94evY0Mri;u(tu}CZzw($KJY=vkM>oD@Qp)v;QpZ-(KZxwq)T6my-Q5HiO&yBk4 zn~J_DE{p5phPWxd6O*LxPleU4h7mOrv{S3ya_>mAmdTWPPyFv$zTf>H^G4rS)t)TK z0a=#Ex%!<@fToyel8dpX8G<-aC5jv1%g}+_5-hSLoj> zd=gp{8c$OwoHTMqpJjB#jXq^`6%eowz_o{y8!&8y@mNV}t6`AeP7@Johb5Hj!CPsn z4^$S)OoP|JT57Qv$F{&W!z`;8-esprF*#YdD3f*$lYYhyfMv2Y?K0eIn0_2(u?#dnVsb6JRyZrlGgeIdX7#S1qIf9Q@Vvp_gU#a+j>uI#W}Xlw{^b7=Mb&HDeXdIl1+KI zL=&GRHoH0QG~*?>X`NfRGXva{LFKw7<6~pcGEK8&G#aKt+ zMkqMDd=4puPtZ7g%NFpb2=>?C9?yOtM?H8DK|Sa}GXB-Go7JeG2sWvzuc~XRyK8zg_)G1f8a{be^uz4ej5d z2lR-ZYR)bFhTg(|myNxL{nRu6nZA+~{ls7~T#Odu#Z)m}%n>&B9)-*mrD8EGk0n_f zct7jqm|rPsL_&C=c99VWVUP5B>Uh>aCC-Qo;-a`Lu8Bd?_lH9AqoBtd30kYYYPr5A zn$Kiv_)YxBEZ^Vyhk3o9%lV#clN~Z656DCEh&(1w$}|61F;}^_J@=P&FUafiro1N~ z$|v%fewJ_8{~1OoSm#eyoDnJt^`jvat~HvBR?Dc58Li5wZ$rS|0#y;NT>`Td!Zw>! zp2r}+f(9Z~0f{TugSHaXKkypinF;VhNNGM6<=6_yGKgihK)b9oDJG{8D#E0d!=(3E z1+YwZ%~)U^5027lO6SF0Uf1=e%~hsZG!L`$A(gZb+Ri{NfavWgi`~HIE!Hk#RR(26 zc*crqUBX(Knl-ZG)M5sgRdB!|+zGu+KAeVSIp9Tggg2w1G6!5rN4Sax^ePdqTSeh0 zM}oIgPvHo+nk(|zjX0<7h((MTqXIes+WDvhbc3i1Q~?$PtpH0H!RTlO4M6E~npH4+ zc;T2iW6f6^`fR+k`OB6MjTf69Z++2x%X`^!J9$5qY3L>S9jjob+_Zn z?oWF@cD~;GJbg0LjUqLWc!b|!Ji@QX$>2XLdZ^p4;DL4Dly0HYeO9{9wtgqJ;v8G& z+dALkdx%!xme!*&wZ%!Ocro837P};{eFG{tUWfny literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux-nic b/third_party/rust/term/tests/data/linux-nic new file mode 100644 index 0000000000000000000000000000000000000000..84458a5f466e989000261aaa75b6582a945c20c5 GIT binary patch literal 1810 zcmbtVO>7fK6n-;CkRl>}B&vWZG8K!&PnzA?UE7fX6H15$iG-k(v{sY`+r+LN$FY+p z5FCU!ph`#;mFNWykt(DLE+DE(Z~;nyOU0q5{v6vw)k_6jIC=Trteu1aRim!*-hA(y zH*aRX8E4ju4tkGPQB~{=6mrF}iPmB+by}m)cy2Ts%B8YxFe_9UE0xNbN+pvHofs~M zio?a$)L6Nasf0@9;lc92P=!d~52n95sE0y$UK4q5{F-PFtwA4=q$RYL*3%|3Xe$_p zI;o2e(lOvqCl6?uou+hN+~s-Q!seaIG~0Hgx0}wu+f#6RVR|Xb;?R$IdC7h3I^nDc_gGQw+u18q zV-4AHYM6n`&fi=!tDu+28`Get0eDi)bT`QeTOL+WyU{{GzBB9E*IkM z8gWh?jYW(YLj~yg(4J!*K-XtoK;^?Qpyk7MhQJUpLGPe+7j0j)V|8oG2kXq=KU*?z z^Tdn6r`a31C!hbCzgzfi=w9*R@KkALWTre*=^uSC_Wc+4$A6r-b@KVCXOn-N{-t_l zs)iz;!r~D=ws?e3#F@fBQ%I*(SBQYMTuLjaw7g2oYwM%173bJG-`4pSUp+{HipR5COt2=C%5|&8He=Egc5|lX^d*qfzQK>4-`B O0Y&-a7R;u6O3_PhQ)r|B literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux-vt b/third_party/rust/term/tests/data/linux-vt new file mode 100644 index 0000000000000000000000000000000000000000..42df50d3b45aa49e8c5ca07306107085afb8d205 GIT binary patch literal 1702 zcmbtVOK4L;6umP_ZPltM3L3Oge4w_q@6Ah^mTIHcl4?H`t=bwYtx222e48}=SX&Wv zBZwOj1kr^X5kwS<3&D*b=*Ep}!G#NP<3a>o^m*s+K61}J_so4WckU#aO~R(l zw1#HI8<~iu@>BH_)1 zl42-?<5ZIK$ET9^(OQfVNm@$lX%lTFgLXpkP&);vlTLsS&rFm)TxAYG2`=a&%{^R%YPxOTxS}LlaeR1d6^8{f?a&?-3`&kcfe0#f-QJf2HiL>&5t{xGnC9`{IFEa2`RM z|0VD7_vi`OXB~YNB!6F(m5RUU<=HF#F|Yi+Qd}+9$&Io`8nRYe(kJ)Iw*Q>5G;_H> zw8(jTu>jgRN^6BCn@Q&ZE^XV1=Y$tPicAGg`>;}&}6@YjcZ>J}+P z;CgRLZ&T@BDBTNN_sv$EW9xid=UaR*C>LL&Fp3X0rU3p%K590*xy93rgXE13_VPxj z`0F;Kyxv)3moa0Rra5ag7^Z@5|3&xwQOE4uXO9VYdwgk6A1@4q>d^^B?{zVZj q!B`coq}8|qHemZ(Xn#KiOzQ8WV@=d<(ovJ*!;0dkEtpO5kfLvP8$<;F literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux2.2 b/third_party/rust/term/tests/data/linux2.2 new file mode 100644 index 0000000000000000000000000000000000000000..8656939f5efee9a7970f87f5092a1da1d84d4bb5 GIT binary patch literal 1788 zcmbuAU2F_d6vxlKE7W%hf<+LM_-tqH%yhR|Y>R49;xnon@v$wfZacXqqfM>Hlq=lssOXU@HI?%m$;Vj@kX zd`gKWfkb^%TT&IM4h@q*1v{q<%D- z#?ursXa*tALAGkql~28bbIgcu_xh^b<_C=fQ*9)`>nrD8EGKT9*#_kPtY zFuqDui?~RD+C*9$hCSBnt&#U*h?ToZ$(=M978p8Otf6lk6HHpopq(Of1| z?H}SlXL;U^f6VLsUe-^@R+*G(c}O0S$K(llT6X?t#cbu?_Iw}fUX<76O?gi~luzWd zKEB&~?!Nj)z<*;#z|PR$E6fWl3=E*56pR`5MvGg9`ce6({>2k81y7pQzJ0$M&6GlJ343L1#g6h1Rc0Bb3fq^a$O2x%t~6?*U7dw1Dv<3f=_1VW<{(M{9R1^L@uuu$c1 z(WYtB2iu3H2|f@LYt+Pt)~2ROV~nC`lRo&|pY*}-;)5^fLwzt_zcY82O|dl+C!BA- z^UawvbI;5&yG0GvP!;7wB9tDyf?dYB7>o@-h0uQNDllKgMmGSMZO?VVRXva#p@4&&c=X1^L1M%vi|0vHx(B zc|VqyCL<AQC3JNFHh?=m~KwM2|HE3FAH=)Lx`PdAm~4W$k+bqs_1`dKc&{01m*+9<?n`eO$K9(+A`cw1`drd@fd=ys^HHz`{OS%q`N?PQKRr?4CyKmPGuC% zVh9S93Lk!%!cD9MM>0U+DA$)WT5;P_2@ai#M^&7u26Y4K6jc}03setO2Q&g|t9XXz z#njX`HCU ziIuljj;~A}nfm_3mv1k>^WF5dncruBn_Hc~om*P?3rXI9C8B(Ki720syMX_vD59yq zh6ip6r%esDDYQ0)cFdtTnqwRj@0fU-Zy#!byE%Z$BqLcsBEt8F&56a`814sG?eHNk z%`_KfPJ3QXJ*(zy%d&E6pRzP`=P|nbNFCX^=#DuWERl5AnQiW>ZDoi;cz4S1f+&7} zU=RP|c)S$#-HMA_jn`!t-m*Gs>7#aw`d+2pCTg>&&7oH;8td0IcFcx3G?vozH+cqF Awg3PC literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux2.6.26 b/third_party/rust/term/tests/data/linux2.6.26 new file mode 100644 index 0000000000000000000000000000000000000000..7b9db46710a79b30d0ae3249bd6a58351a1a5bdd GIT binary patch literal 1789 zcmbtVU2IfE6h1TCl!6ut36XYftjZ*y(B3=u-ra7NxW!uASQ-dQENlq0+tRVduFy%CElP{se*DM5lZ)E4~^>DNUe@c7+#Ya%nlExyK9cr4c2s~x`_n-V5a3s z-W9%IM*f1Wj2dVS#)u@9&|0dZ*GbVvC@wWoGquvk;Jc|C*hd*UN;xp!|D3*{uMPW_ zj+uUnrs+reg-+6GX61++lb^}2P9MxK{{$baP3CC;6{_EPrg;qdnfhDw;2HGhq3%p)$hmjs(S~c4X|zWDbSe& zybCjX&^Eh)&-+Tg$It|@qda2Q8;mh(%Wy*(I5fho)D5UpR9#RnP(4r` z&uM{l8~aN-P9J#KbFcSQ-@pCW1}>(r zXD(&`9-JJS`DEtc%<#UEzYd)}eEGB+}PvImxk^64d_d_L|Z z{-2_Vrv4fpxG9`AHPoii+7#L`hvI0CaZJ2p;%&Zts0Hq37b=sCWC4i?-yb$77I$N~ zA6&J)JGeBXT$FL`c{%l#8n-RW%BebKY3R-(y1Sr`>|Aum91WI8y0gqSch$BsL?Jvo z%kY9Ietuwce{nosiu%5ci@OG|OC?p~ec9Sh%@(zPM7!##$)YBQKD20{L(@Q~4RdH9 GrRfQKSz2-c literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/linux3.0 b/third_party/rust/term/tests/data/linux3.0 new file mode 100644 index 0000000000000000000000000000000000000000..c61f69626120cfd1c7552c4b22c451369117bb85 GIT binary patch literal 1788 zcmbtVTWm~082)Frsk&bhaoGsMN!)wRoO5=&S+Q=_Mk@r3vT3NcwDzLfqO@B?hzC4~ zga?rzNIamaNJNBEBpy7w#DjS8-~|snh~xX`>~^Cr(U|oA=KH_-=bt(M%yuS=AWfk$ zlo7E&vMIg0-CkgJYBCLMTB4yP-H>c068MAZmL*wN2+u1b@3*ap7SlM45lJeb@idvH zlR>kgI8;hyR6!fSH&O$ziBhzWGGLx}hz`>+%}&rM-JhXzbb+qW4eHkZZMsXn^i=cQ z(l6-^{I^-{9s2kE;~(fFeW7poh(a-3j1?2a6fr~0!rte@ED;h>^xR_E-uHgRWf)%} zR*Py;3${bFica)L2FyB{^-qg4;-a`Lu8M0yNY5*P&od#hztznYI^7XO3( zbCl<8`Nz0{^K$-H*(lSpP41Tm-)T~_;Q9)fEDHut3+dj zQJI=+%D|x^CN6{jRU`TH_5S#aG+C7+yr@=qGn!Q92&d8tXVC-&steYvrCB9e06j9e-!2{QYQ@Vyq7h35;+xk#! z#WA*yw{^V5w-2?z-KWQfsw$yUlS*w`XHue8QDUnFvnf%h=m*c)R{sD1 literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/rxvt b/third_party/rust/term/tests/data/rxvt new file mode 100644 index 0000000000000000000000000000000000000000..4d54c32496bcca1fd0b4b63f16fac412b8e32ede GIT binary patch literal 2285 zcmbtVTWDNW6y4{Z7~86eREo6|OCr5Btyt!sduJx&v`w3rlQzkOG||{<$Rv~JJTsX* zCQX7AQK*6yMGMs*K@mT+A4NoeD(HtlDu|#T{m>6T6huM62RN?1=O#Yu125U@th4tz zd(PSW-ke?P0PUq4DW|s86qgrEs|<~$iDGspm&`OyWEV2YQoh*OJluHiOfHpQYCKV% zFHL0k5h?t^PKt{cApwi<7!H!!SiZfEn@upr>xGXN1=L3J*Qs8 z`05{4yskbG&vjOvb&J(t?Y5e%lvSxr!K%-Um9^%q1*d~7%MLQZpNNBt;_Je z{U<-iuKv6W{d?Ajo2x#yu2`SR>~r9kzW?jZc%|~K^`k|)R$s5T>z#VH-lO;HpbqPU zx=qJ*pB~gF^{AfI8C}%NdR;%H&+2pfY5lBzUcaPY(UM`u{V2;s54W`g@;QHMKR@(hU?iWzX0J$4Vr)_Y>VXY>V!N(+I8bdqmD6E(2fT1kF0Yo71A}sJ2BJ3CNvQ!VAWiZD? zl?k+9;$_$)8Uqm`p=kzoBUL7F2&2QZB9>PdWBaWURyi>@=EcGpKg|)SdSsXGI%pfL zWdvXxo;rd)H{ubQ;|UK5Mg&^~ql_lVC~jHPfmxVcqUSOsVPi0q<1hsdfl0}GHwbS- zJiI+2JsX6RiHGwD;Uw6qoGT|c zx<&~Awr&m|k*4DYA zCn?a}7T6aA6qHp)^hWeX^d>A((HqgbqI4y{D|)x8 zclj+b9;3sbC)$RuH#Gnn&H?bw8$KwT8;yBU{${vRuDm}y^EOyBUcKfZZaAV_=^$yP z@SmUP8uY(T?xO8kVm}`opIm}%8CHTV!iscsn1%BHGRAx;b4>*C1%$u#fQc58ML}5PYDU{X_k1AW1{%F$ad! H9(E6h8Oe7R8@JYEWbdDTHe)1e|x@n>U>dP=SI2^k-5FsbHE;JN;v3`ZJyW zF&!4f#6(?aG=_z4Of<%YvLMD_VldH#8#OT|x*$du#^^>9U8sxkJLkRDA3)vk((~Q# zob#Rg?z`u{>D!|A(gU=Srqq_k^3p2}&o^&4CpQQm?KkwXo%iMG%VtYjA=2|7v{>Y_)%PtxPS zAy~bh7o4E8G))!ZHNgw?Bs~N696e7LF}_M~&?S0Xa_`e8GX6xrVEk2hz5Y8!QuTTR zY`xl`HmR7}u3FU|<*AhFP)F1Wl|}9(>@hW{M%1_}fKRJAwSe*8uVr;XJq^_h>SgsB z#<%`a@s9dZB6m7X&i&3-XPdL#$vgG>I4ry-osu)_%sa~xsR1vo`z z!F6%Y-Te9p`j4H@)~dd6t~uX`_bu>;DE{MGzFz;?`OP7{PT!@Q^=7?I@6@|=TnBoe zKBP0cNB8T~dPtAyqAu$teO^DIpVH6j7xhc}75%z?Q(x9s^v&1v*UZ)bsavi2P=BgF z*VpvdYjxl2zJ}H8tsSpK_j#}3yNES6-rIN^-A%DGX41^KCZ9Gl*5u0wc;kRf?2J8* z@dS*=NcG5{G%U!_9SCJ$9X3(K%Oqq1!(rG#ST{8R6D5EPNJ8KzS>Q7yIWFLrXajhO z!5$Y?G1d;pFLFdQ79wO46AT>2RK?hSj4pd+l!wJwen*m3ZrV%x>7W=*^DtChvP$nf z=pk79Ai%opx`Gk65)ql}3r`3p1=|Hvj5f|FVX5ha7jQ`QybU?nFbvyqfMWZ>WXro( z2`@t;ygVUYtAr<$2+t#gC&5zXxf1eZ@}zihJU(w+2Fm}~37(P%bw%Ha>p#Y@tvrmP%7o)6+9Ev$N&$++3wHKfkcBxVW^mynOClwYsuW ztDWZ^Jx#H;L$L?rpxl67UZV8O+X*IJYG;;Yunc)vz$C#i0<+RmD`G1xveGRpEw$28 zFPv1`>51M8^>QEU^IWbw$Y=#UL0>Q-m=u)5<))b1xS&*7(Oc15(c3_>qPL>=MCr-= zp6I<$@9`rbtW;ZJH ztBI1y=FqtDoT<7sv)@#FGb$d0@Pf$m#d9MMQz7StULLK#{yr$U75Cv^6)YboEqtzh zrXtjf<9=8V!mWL+pxBqvjg+lzoE2d;Ww|I+w&7K5i{n2&(R~!BukZ!IUjU7GADXBc zv8}WnUje(3^C?9K=&*bVWT~G9@Fg&WI!)_v9(E6h8Oe5yhX9V2H>NQV3Tore)rJ@6C?`RG{Ec+D?OoREnfO(@tS#I@6iy zAMId5OiaXuMnhca#zbRWC<|hYZZOe>F%c7Dq6=bl;X*f>=t5nL-#If=MZv$9p6`D5 zobTLs-#z!v?IyL8?xS@yqppU^i}Te^8$>6H`C@s6d+oL>)|F^qI8~i)U#w1+3+)JZ zO1wg(@CTEpNt)eNH#CEE8*QZe4IWbUC+c+~heEW0HqkcBWCxT19i$ZX(WBr;=>%|8 z@-u?dbef7(6^dj0<=?%I_Z%gcbx+3il^b^{jh1cu9qQ%?mA=p~A zPHj+OwN>4(I+dpqs#_gUht(irM`4etlWIa`RSvwUDrz3>-#<(0oH`HH3+iR{8rrx1 zl<|)GLOgdkZO*;UW@n4D)yX*ZdKT7rPB{f<)|qpb#8U%aT#d2f(se!dyysko?}NYi zId=2sBj`VIuC8W%?p$-emfknO@0$MaSL5~ikIpX+={5RJyo@f!{jR?GeEt}@{4aH_oDcP<`ZIk^ ze}%kn|6^`zjQ`uFLXFJ6(D^3&ICLd+E8Rum5p&9vT$4$fk~Nt!99|ZX3Xj-cw1;8b zHdT-OP8$g+x*e_*tlI{893>&sX!gVQ!uqKV7!&|5AO?XSV}Z{QW50l3z%dVx6c}u; zsPf@BI)0u#qOlMm5==9&8$;#8yV1JbDEg$ zNL*E(Uc_{pQq)wFu1PYrpnik8rsSCw^ka>_4;q+cfn^C(Z8MYWOp?MWT1(;d0&EF3 z2b+aeXmoUJY-%c-J$*Wt%jXM)nVDj-RGOVFmn)TOb#88ceqmv8acSwyndRk`m0ImA zujp|KckBy45CP=^qzDK7rTBPDb5bvmCFPU8d^E+svf6+^F~xt$3%&m`N|53>tI7 zp1}~jZC2C$8>G9DmO%3T>+?HshB_jAR}v F`VHi8e6|1p literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/rxvt-88color b/third_party/rust/term/tests/data/rxvt-88color new file mode 100644 index 0000000000000000000000000000000000000000..91ae94737b89bcee33dc382ffb63606b5b5713c3 GIT binary patch literal 2425 zcmbVOOKe+36utAt6v`)+iYiK7RcY0MP?Xef-h2Mww&^D=ZkohVNh{NoDj(<5+Kv<3 zNt`C`qC!HVEI=UC1#FN&hy`>}Aq1Nu!2%&sqzVZZ6@mo|*nk8JU}4U^wgZKh-&5|H zGk4CNH*fA8Pd2GedVto^jJg&oRTnCq@%VT#Uo5R~r`>kNx)SY+rz_L#)yhPv&>oL> z%5a%T;SVNHlQg@lZfFMS4%$fdn>-oXyQN+yawtR_XcKM2I(9%A&>>1uA3X+sj7|ba zBt9!RO=qY`72!3(^Yj!w1NIy}PZ!a?N^j65dRxZcr>oNbKtG}VS$MtvD_Tb$xD)eGun^%~l@ z{uJ?!`a(Q+Ic?7U&Sqzev(?Eu_4*X7@tk%F&YUyvEQzNEytF#Tipw|j*z=xq1-=jd z;^(njKOaH=iF0i=>T~D1^R@K80e;u?f4@3jum9-$;*egW@7C+}M!iLE*E@7XNA)hf zU#Ikd9?~cDh@RAWUD8#3PCu!i*3aq}^-KB{{kncrU)JyHTd(JjBUk>Vt`+m4{#1Xa zuj{W6_w9d-ZO!q2+f=9#*%!LdWFLpFhHj^OC_HRVn_1UnlV;YMYzYo;3Xlp9+g`Ls zVB9uUkN!>@0V%o@t`w}>26-GMA=79M!1lrVsSOwu04^W~fgfXm&k$q3fM38N4-Xd@ zY_F*D;W#>eo;{+m5Md;kW?(m_%7=HOb-7nUcq16g?~bv`O?pW`8O=AR*$Y*ltkOFN zx*rxl1+Xr6UBM=|;t`qa3l9Wif^oqFqm3|%TVi_9i?U1fybYtUF&MUE4~2Jw$(HxG z2rolCygVU&Ey9zDhvyN(lVGXxU4eX=d?`L0pU)eYg7P1Bf@kPXI9XUHTphiV3GxvB}}EwOsq3W3a4l-h0}|$ zCD=S{4pyd-k7CUS3(L z)z0ybo}h5Y{_sN)P)&wu4EQ;>=Qsj0s9{xe4YrA}CQ-^j7p%^foG^qPL>=MCr-= zp6I=X-s38;8ni_kA)3|Jdpk{WM zWv+sn*=cN-&Ftiq-fG0Z`AGOAUL%!^yt`&OUNgH)#gn(0330hm@g-X0ohEB0ym&Hb ztO+%PDY$G_!~L6tyOEYa;{6-rJ8*_NB79d9-A57n5?4Rp-M68V+h{#}n`tZV?}stw zQ-b!;0lC8mX^1ko!$%OOX$^|CjqVloHtL|RrnZNA@qfZ`=*DQ0a=72igpwX^q=hqq zM-Q|A*dQCosHNPP3&Y#S GE&T>(p?i@4 literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/rxvt-basic b/third_party/rust/term/tests/data/rxvt-basic new file mode 100644 index 0000000000000000000000000000000000000000..05474636f9193deb9d38651e5a114bbf48f0b8fe GIT binary patch literal 2145 zcmbtVU1%It6h3#ZtyVEbrBpf!X>~MFsxxJJWkzWbf; ze)sOZ_uOIjD3=~1O(pe>uBkf%Y0jPN``DQcq*N+au~Bfw*#KPz~G zPEwBY!YhI+v_a>=UZ9ugWwfu;WqO0&k-iV;6KQ{->u7%z9z{3M{)G4?&S{&vN8P7( ztB2Jis#!g)LX}bnRTOn2deneAsz%i~_(?UbX3_rrlUEhB4%hSQf_e?@rN4}LQ++PV zufX4xvb43`>an7z4-r2D){r$~9k(V#nF7AL)yIyDH)X6`wyr>X>lU5+ZvVUs|9jSl zTcbXSNcx6m+WyT@02|!mvYL+$yFfubAYrxZhFxkMsRzRD@}K^1<`K80^SoLr_gjF zIuQNT01S%&50Hc*NU|YdNU|;v6lo{8TVyo7Vk_7!NP+?@Vlr@{Cp^W#GUh7SZD>8t zD)x9W9*jk|C)wqt{8W%i6zbC)gsV@M>7N5VglL%ncpj%l&@;?EF?fOSP%tUjBG}4k zTt<;)Oc$~QOXBAf$Ref?IEe#fw}HtK_iqwjfGE5$A$^;KCliI|5yF#TVX~u8_9T16 zma%a@vNW9ka0Wa>yXU$tP6Q=G4RFLst|G6=b=sYB!l|V^C&ko&1~K)VvhQplPsVuw z8ak;W+ghDkgEOC^M`g+j4dDlIIO%ZrPZ zO0`<6EiElCudJ-DuC1Lpv%bEuarW#vKE~r@HyyH@T~I#t3@=eila_JgAaQx-kh7vc>{m>qwz4&@PiN1hZ=>T=&>(xhtG)!ak98F@JrtPR= z13e(_ebhux)xBNR3+D)YQ#4ESv_Mrtt;gf_@)B{`GkoD?XDzJA$s}bHvS+Z2l!>zh z>vAF?>%0fNG8v9lL=CZws8GikjSW+`PxD=!AwvQ%z=5oLpesg*=}bR35WI)2J#6iJ jW*Br}td39yhen_P!H0TSKQ_n#k~K6xtZmfX|>tyK2RIlG%>ZPVsbH))bx(xk>lLN?i4_nO_! zW!oeVMG({nMG+tDi=c=P+J_>dFBSB`7ZpU%ha&pmgMuh1czHN}|G%4ftrtA(|IIhw zd^0;U{|vKV`E(bxP(kf(DzB|nk4+bI#qv7S*6K_-zfef$T4(ahxpcKyZfzfHePE%G zDXzAjtyQWs`6EOMKZJY@vR!S+q*An#_EGQ`-%dISoyejl+DrTC5N2}}N|;Vlf(Ga; z_$WODoJ0gcMsS`MsYq4f8-kbU5qcc#NqUN&Mfn1~OjqbNX?u&_m-1Ws9_5e1gWzYB zq=KLcu}ih6y~TY#Rc`BwlRj)duQfM1RJg6qrw3<^{@S>`y6_kJf)zl^R7+g=Q z%j!jxul}LO>*^CxZn2uJJFNrOL95NmSV1s{sDBGq-deJjt(qtsz$@Er?6~^78Y^#F z*Py-qC!O1F{JjhRd)9~By*{?CTc1nq3*c7`{hRIfAo$Mu$s)Z&->UcMefpq2tdHuD zj_CVzmrm#*J)+O+Nj~YhN z@(hB@hU@-cX}v>&c0)=aI!!o-t0ZI|MK|IUVvw4F;XJ?vL}BowZ15SPtPA*gTy=Xq z&tUq+m9slg@pG(*$H0V^@H_*{7%FEUN9l5{jPCW$n0{xJU2fcq`|(JwG0aK024t4r zCTJI;V*+4YuDXH^ZbT8A>kAJHMg=l8N9%PTH0;FlY>PS7W@o0wiIbh6U1TR$ z5jDgzVhK^9$;otjc6M%VaWR|CC?_DvQXRL%@=fL#{>$Lgcr1>dLN+2lY<1{~i636*L zl0`NkfshbgR0t$Cbb$~pAEAmxp^$F6pbIu_5vl}>E?_}{N(H2vbFZE7Eg$jZd*;lU zGvk@LGn(xxPWMweWz-$M+`?SGW_WRQemt|pJdhvBrN=XaslZ5jHZ_>f<^t8dfk($P z$?SaKz~W4PB)ub$%>;^Fh!lPZ`ATG?T9V=Eq)l`;75?JeM0L=KEb`Gd+D=uN*@I9* z)I+}X4r}w4p6rGjwGF?IW zqwqrEXOyH01s`IwDp%W-Usb9HRE=^~RK-=J+OIm%)`NIV^{ZhuswTm+YDUeW{QGZF zt*YnXI;>t*M^PU8Lyr^cyeKzYW!61bg>|o0X(g>fVH8pP#;vq9ZOvMXqAUYH*l1(N z$=}sjIc=SR_UWH=ZoB^X8T{w0FE)C8XjrKy}n&s15^j3YRuFzGw zTJO@HepuJ(Cf%yLbg%B$Nj;&b^qgMOtNK~}fmuRa?H|IJfw=`fj3I$=_#>+f$C6jM-DhPUaxE zqkx3J&$OW2kKnT8dgNDH?2w=>kP?Wv38iqAgp8r6N9;wkQ5i6l1~`BS3|@o{9z%q6 z0WXbf@9#@9m=2NKF?#0fSemuf1C+5bySU6Q0 zrVg%FnWeh|x(`v?4=@f_9l;VeqKM7$gogwpg0+HCMiXQdS^6}f7G_EOybXhhAq2K# z5BYb4$(FaR6P|`BJUt<;>x2grg~t)XgJ7z%u8^!uR*HpV`MhxnIR9ZMc!anU3C`IuwJm>N*8NF961wUmp$lYG@O zi!d05BqGct#4wC7l3XKZBgrz7HzUb4l3ceqs3g`EzgzUn{}_+Qa-4ofBj^fxf+4|( zpd2$N%G?A6rI!)E5x)_?2}`T^jrd)0x-z~iez)j%`Mem9(cz1V1mYeiyFkMk08YQ* zg>tyjm>1>S!#m~5N#dHf&Z=<;tAlv!i0+~wUBuJLZ{H0#31xH}vgcz&a#{Tnn=<+ZAG+7l=#N!LfkIBjyk}+S^OL-PGvPWJ7(3Aq;5e zK&`R8p@7Yq4?IYXhVVe5Kuvhi7+(xXj3$N$eJ}x{!Dw8+|3BM$#Y;Tt|IIhw zd^0;U|4e6{>ZOfTPervRP@bEqG>y!U&E|?t#i2@WW^{q2aAmYy$Q6h3;nBi$eyCC^ zha3IoaA$A$iCi&Tnhp2PPgO<>;mK0DvMF3DhW%lP6#fwM)yPVIhAdcpV7e&7K_wVD+ir$bbtitwX?$LV=G0rn!jOeayk zL8oYu&PdyN`dG^A^c~6{gjcISq9j$V1`w-My;`e6szE)Xnv|=Os#&$FJ*pdRdl65n zK{cYr)C71*O{p1_fB(&^}w60m-NbOtT&6<8| zrM+7H$+C2v4(j{#Ivv&<^%iY(LT}S8x?OkceR{th*5kUUEBc6jRzIgt=$G_K{hEGV zpVEu^j6SC?=-bcdw=I|crEj^ML7iWXV5NBP$E8t&2XrRDg+QpR*B~bD5tcb_JgqG+y1IrjHAKHr2;aVBp z{mz(vbDUjH%1wExSiUyQcDOoZmhLgooruIBz&KoW1Z&)gA~wep9u_=JPlEJdO|vu2@fU;k0XQ!!Bk~kQCXR+6br}l zdE?S>{=-i22+d9;62ZP8Z%71hbS=kOB#E=i(~H>6_GHYiq#QfN)PQ_`R(QYoLFw4!(&44@($v$Hi_`DUoS(fg_s;yyBR8J;YT@#+pE0ecDAc$!v?&70 ziOBF&C3o(_V3Mr_vp9oc$Rc7)q6{MlBdIlFHj*kMSu>JaBdK-$K_#uO_+8&GzhgWe z%W(!7ji4*&2}T9uf^x{5By$rHlwL;sM*K$nCMK=oH{y52>B{)7_+8)c@@X+1qr=w} z>BB9~_JGEU0Gxfp3*~T=DKE))hj+@AbHp`onKj}FHb(H$5#3J_`T`FpzkGM#90X|% zwDr`0*Kaf0JWA3w+9fYwH}z3JUcdwBr|C|lI!O15djmDnV>NFJwd0lD2j4IqqzSx^ zQ-lLC;4g;fkIRwa3nI%-up-+Qmleu}fMq0yT#KjBV8fD#hAUN>X|>tyK2RIlG%>ZPVsbH))bx(xk>lLN?i4_nO^J zvfCzkD1x9qD2n)CUj#*b&^{CqeW{=izNjFAJ`}MJeNYeu1uqZl_y4bvGTTc z723Oh(z)&C-}~@?V12yZ>r?BRbzN#VfL}HAZ?@ZOwePH-EYi*TcD-Bg)d%z;eMARz zNI#&vbxaTIQGHHN={cRzMP1RG`ceJ3eo8;5U(he=SM+Q8ihfJqd_KQzx%w}CTYcWs zAL&o@HT}hZ?6=kb|CC=g{_|`7LxWjO%}uw`9b`{9i%!9HQcht+5VZhBiV|SwBXIK%Bfe9_a1qPNeRK`Ar(&bta-Rqq({jM;(+^84zqoGV=m=kaf$}GK2 z&~8NMB*3^_bp;#Th$1%E7akN03w8=d7)^jtWa-n3T8Jg_^EM>{SE~gN3%2C&eGBu!now`oJbJkH0*XurL(1~W*7IDfg&TOj_B|Ant$&Rlf zs)!ZDGNMFNQ_1Aq-2D8~QaYWb7L>!~Mwpv`p!720H{v(qHz8>izY)JDPEW@7 z#P8Mp9-k89GrD{|kv81k)Cg!O2f&#(yig7=67?f|XLzSPIX_(Uw^#>`UPk~g9MN4A zpwIDM@{4y1^4~(cq3x%3yn6Sc&8G+*ryhCv5;RKVc=@K#Pg65e+(LJX`yh4D{S9v~ z4N!v4!Z%HGl*X%AA{>N?`eJzgxD;`|7_#h6R%F}4vO?Jqu(;%qYa!NUyMnCq0&%tC z92G)@$T(Bbh0LP?CA Zg#rX0>1TZ`!2yyql%94G__rBDzW~efOdw-)GBWx3Z*Ductk^a^g$n#w!F$?(8a|? z6OGZZxVktwnK(EY7Y7F?2L}fy6BFWK;^#T{D+YoS8o%`X&+nXj?mfM?UvHH-hguv) zRODQlsr1ZDa_#z1wXSK6?frw7t4GX+CaZcen$9i+x2P zxQB;CPq2xnUSQ_8HyhyuUf4$$Za{E9Fwg$54brP{!4$ zn$p#2pPDk%=`R(5=jDGlxyOM>jSilKsyDkdR%FdKB8QN(oHDOi+f4% zZv%Y;C)2hKecQlG%VJv90a|)WZcx+WP)%ngVKW%)YjJ3)z>#PXxhX?Fc=Dj!;wfdIy)PS z#p8)YGC4PwO3lxw)0s>*yRfjhxU{sqyt0zZt*)-Et*>wJ>5M@++u+~YXK9m#ls gDYTE^l7^8X3^$`&gFk~o4Y8ns*rZNoA~t2<7joni{r~^~ literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/screen-256color b/third_party/rust/term/tests/data/screen-256color new file mode 100644 index 0000000000000000000000000000000000000000..11fbb23a81590932243b2a18a47e1396772efae7 GIT binary patch literal 1912 zcmcgtOKcle6g|&WEuhj0Bm{I&2|^F3Qn&N-k10)CC)Ch*oHmKn#sVdEoY=9QxQ^5O zg9I!P5)uN$M^qJ3)g231u|i_O0_F(=zC`;3}@se}!-GExt2ar}KT+|3Lp^m;Xe6qsu#;o4AFa@e6L_SNw)M_>*_E zN9|Re&ZD%))dBSkyavukA1{MgWw1ZIJTdWN>?IZSW1{@!Uo@StJn}Qg))mT;2PcaS;ZY5vY8r=7TR%>iyT6XVZwX`>S$pFTX+ZW;RAe(&u|4_O6O>@;}TAu$7vhq$1tA8kd09rwZW_> z;0q)Kk^(70C?;YkVklxLVn}f)9Aum;IYDv|2= Q2x?Oq;*E0&l5@%m4rY literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/data/xterm b/third_party/rust/term/tests/data/xterm new file mode 100644 index 0000000000000000000000000000000000000000..12ad5b33aa7eac90e5ee16e01b7224d11f7569f3 GIT binary patch literal 3412 zcmb_edx)IX6+d_Gx5oG&qWB!D8_Z`O6*J#^#?NGuCY$UgyE|hxYu1cuvt~D&&CWiu zvvD_O6D^7%zVQ7PUnpWIt*9V~mbR#flu|9&5=2xiSP>MJfUoKA+;eA2s-k~5%>Dh& zIlp_)J#)YN-MMF}9Gyq==s|U$WoBw{a&*>UE1Sb({nggN(cRVlsqx9yMSZQChQ|iR zr(1jW)TRbU7ZWM-WrAUljmDRwu*-BTok8{Q`5a3t(7~Z&(Bn)x8+9z93(&Jb>!_2; zvmvU#%P9SO_r{K*Jx4FmpXoLDZ_r!xHob3p*Xv(c zo}=pZOXeGXX=Rh8n((f86I_7=FH53%)-p#%=wvv zh}>wRjeIvZz1v{DYP{Doe{V(`{e<7j9R302=zd3g@0clZ|cMP zJ^i8nL?6+0J;#~nobH_CEOeGSiL=~kb2^ZMD*Z=3Uy6t;nN00h(Z`kG-ZJGWVviH|}_G5B|z z-^g_sqpM+X9ury7Ft{=k>1-HWfQj(j#@N^}cc>->AC)25@Ba6G$d|E(@ak~mAPs>oz8d{GVRxfR)t+-)TQPm9X$FI1aZlSyA zetMW5M`gdqt?C8(6TOPs-lTugJM;m4M4zI%Z%C`TYMwe(Wl`Tk^-Gmgk-AV7QDeL6 zRArUj;(7iY0{JPgSPgb1z(3KJ$OaJhCG5BEf@s#&Sb^*&9P_-%?7LyNagfR(-Z+;7 zIi5qINGKLcgaSE0LZL_~7D|KyK3u#s6pDmmp@hk|8(vEC?dxjatVT%zA4BbD`2PxB0-;bS5{iYAm9(;t z*5;^hBlYHK)g-N|QCp7M0_v(!PmX#9si#IGt5*dKAw$FvGbDg+ZY*}Q*v(=$i`@|0 zx>rL1LIOeqLIgr>FLgl$LIpwvLIpzY;2Ar3#txpbgJrVqJkhQz7Y}e0V+jAML|VSR0_V<@65To655JCyzG46ne)w@IXg3V z?wq7-I-O?Ged_hP@zL&)fwSEp+&I)fG%{(b^<%xGo9p4LH_kGVGCw952HD_Wtp>YD zhtdgDIlx1zvXjW7L(t+xIt8Q8r*qIUM=PiW{no&~h&BPY&>)S|q=|9`T}8X-M%Z`K zz4RdXQQAXK(R1_?y-IJR{sDbVpV3#Qb*1ua!ZTE*aySY`LW0b&{%AbJRR_ zmU2~AEmBL>3e^U^9c7KWSZz?^b5z1?AFof=r|J3H(OI3>%XLAo(U<5R zJ*3CxcCo{fvG=zoy^OAL_mOOZ~0>QSZ|gJ;R!19dDg#&9xe=$XaAI zS}j()RkAi(eOB3;u&%VOvu?HSu^zM@vv|D!{ybqlZ@p-}VZDuh9~`7_rf&au!2x{x zxB7QaoW#i2?f4&}{rgy~zEt;0UAnZEX3&w8F4?{Iuw!?{_ONSrjlkjc0GiSzcLjJQ z3UktG`9G#~Xrja5YC_4oK|fwa7>?U-s+&<+g0fhgu^X_bh|)^wc^Pmp0B{)cPR7r% z>~hU#E6Y|?1D`FEYA1T1&m~=ApXu5U!)I_!57)HL2b<@d>tr$wi_i+$rAxDiVR^BS z1W^{j(_(V=c2K&2m<7(xb+~o`$|{t0c$@&9k`o!s8q6`e8DOD_EjE_I2-(lg3;fre z*hN$(OhQ2>LdMNIo6`#+A$!jxZVdk4=09>C#%Qe?9LIRhs~Vh{@w8M8PQZA0Y-6mh z8a#F{iq8-LHiGw?jx3zXQg=~0;>B$xJ8uu?>`^S4-Hlnd<8&#*zR(_x9Xn<-fa!|q z!t}*->|xKIL_Lza4>J%mf|<2rtX~t&#MCs>`t=(&Y}(Y*)7!gcOJ84q|G>cD;Ly!bDE`+T2OQHthu}uO0J)D=5;`4Yz8Lm2PWAPNw+BBY{EHVH_B1%N$h09#lqQybHa#i{H~L*m#{DF#G%9vC3YyW!z8xZqD~YGXA{l|BewA) zwy>A5FYLsg#P%e%C$YUGwwXP|7S1M|6Gm*AT?9$yMA%Q-#lFP$CAM#3^AUtSi4&@e z>){|Ek6Gmn%*D&aehwRHogbSmACL50x`0o!2{#C)?D_Ttj)2UR-C(=txSb8WCl99h z2UgM-^Dr0!yMvMU7w>w znQ8s~>HV?O2T0?7bROqE{-%nETRv%FqH@Oifgv3uzs7Q6G)acDjPD z!R_aE+0SDW_R^R1E&WLQ=r5{MN2p_PubGWoO@j*6LfmOqs#WSD zwO;k8LA6aysw>sC>SlG9y1#a#A!Kw2-sU544?LQVMILF~%VyIYIs-Q|kFvB787-rg zxSe&-T3V0WSwFHGryckg*V0XN2koW@=n-W0ByMCc&@1#7a{G`zrO)YW`ksD5c7Kvq zGu140tV$!lx#~=nQGr^Z^2o7CwWy*>uX7xC1~!D_nkg^CE_wKhtqT$d+^%ihZv9qX zO#T8I%afgmPXuq!0WX#hK=n-b1wx@vw3rrm(((*-uBMJGEg7LDWopb&qerb}YR^!6H?^0k zZ|M?`!Dk2bulIfxgkDzX5~Wl}G>p literal 0 HcmV?d00001 diff --git a/third_party/rust/term/tests/terminfo.rs b/third_party/rust/term/tests/terminfo.rs new file mode 100644 index 000000000000..6a82341d50dd --- /dev/null +++ b/third_party/rust/term/tests/terminfo.rs @@ -0,0 +1,25 @@ +extern crate term; + +use term::terminfo::TermInfo; +use term::terminfo::TerminfoTerminal; +use term::Terminal; +use std::fs; +use std::io; + +#[test] +fn test_parse() { + for f in fs::read_dir("tests/data/").unwrap() { + let _ = TermInfo::from_path(f.unwrap().path()).unwrap(); + } +} + +#[test] +fn test_supports_color() { + fn supports_color(term: &str) -> bool { + let terminfo = TermInfo::from_path(format!("tests/data/{}", term)).unwrap(); + let term = TerminfoTerminal::new_with_terminfo(io::stdout(), terminfo); + term.supports_color() + } + assert!(supports_color("linux")); + assert!(!supports_color("dumb")); +} diff --git a/third_party/rust/threadpool/.cargo-checksum.json b/third_party/rust/threadpool/.cargo-checksum.json new file mode 100644 index 000000000000..d136e5e731c4 --- /dev/null +++ b/third_party/rust/threadpool/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"756d519d94a7e5d43ef561988fee0c379ffa886a8f583be116cd494aa51aa4ef","CHANGES.md":"1536216b7036f7eea56e76f1c7e1eb5abc781ab958ebb4e1832fe3cd51e06e53","Cargo.toml":"221d91ce4e5478a63ef109f8ca8a671fba0100dd7b6b0cde602423841c170f65","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"0eef0e011513546062a7907bbbfe79ef4071562036175974c082a1f6d1c0b962","lib.rs":"6c09f54c161346f0b36220823eff6c58c07e9438afa06e90ffaae222168e1397"},"package":"59f6d3eff89920113dac9db44dde461d71d01e88a5b57b258a0466c32b5d7fe1"} \ No newline at end of file diff --git a/third_party/rust/threadpool/.cargo-ok b/third_party/rust/threadpool/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/threadpool/.gitignore b/third_party/rust/threadpool/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/third_party/rust/threadpool/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/third_party/rust/threadpool/.travis.yml b/third_party/rust/threadpool/.travis.yml new file mode 100644 index 000000000000..29a2cafebac3 --- /dev/null +++ b/third_party/rust/threadpool/.travis.yml @@ -0,0 +1,21 @@ +sudo: false +language: rust +cache: cargo +rust: + - 1.9.0 + - beta + - nightly +before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH +script: + - cargo build --verbose + - cargo test --verbose + - cargo doc +after_success: + - travis-cargo --only nightly doc-upload +notifications: + email: + on_success: never +env: + global: + secure: Zv3wjS0darxSMdEa3R0rHLgbUmHlfKFbdzNJ5BMni7NV9ZGmzZAzKRbRSPjNxmhaWBT0fWgRA/eSxIk1n3bHXs4XWaM0EJmC9Oo3boNUCi7AgmwzHdN0T1fct95p6AYfNe0LZh88mbM98LxPdRHc+hVIZ3ah2Fyb6kDH2YKmvDo= diff --git a/third_party/rust/threadpool/CHANGES.md b/third_party/rust/threadpool/CHANGES.md new file mode 100644 index 000000000000..469cb479f765 --- /dev/null +++ b/third_party/rust/threadpool/CHANGES.md @@ -0,0 +1,36 @@ +# Changes + +## 1.3.2 + +* [Enable `#[deprecated]` doc, requires Rust 1.9](https://github.com/frewsxcv/rust-threadpool/pull/38) + +## 1.3.1 + +* [Implement std::fmt::Debug for ThreadPool](https://github.com/frewsxcv/rust-threadpool/pull/50) + +## 1.3.0 + +* [Add barrier sync example](https://github.com/frewsxcv/rust-threadpool/pull/35) +* [Rename `threads` method/params to `num_threads`, deprecate old usage](https://github.com/frewsxcv/rust-threadpool/pull/34) +* [Stop using deprecated `sleep_ms` function in tests](https://github.com/frewsxcv/rust-threadpool/pull/33) + +## 1.2.0 + +* [New method to determine number of panicked threads](https://github.com/frewsxcv/rust-threadpool/pull/31) + +## 1.1.1 + +* [Silence warning related to unused result](https://github.com/frewsxcv/rust-threadpool/pull/30) +* [Minor doc improvements](https://github.com/frewsxcv/rust-threadpool/pull/30) + +## 1.1.0 + +* [New constructor for specifying thread names for a thread pool](https://github.com/frewsxcv/rust-threadpool/pull/28) + +## 1.0.2 + +* [Use atomic counters](https://github.com/frewsxcv/rust-threadpool/pull/25) + +## 1.0.1 + +* [Switch active_count from Mutex to RwLock for more performance](https://github.com/frewsxcv/rust-threadpool/pull/23) diff --git a/third_party/rust/threadpool/Cargo.toml b/third_party/rust/threadpool/Cargo.toml new file mode 100644 index 000000000000..ef226d18e538 --- /dev/null +++ b/third_party/rust/threadpool/Cargo.toml @@ -0,0 +1,16 @@ +[package] + +name = "threadpool" +version = "1.3.2" +authors = ["The Rust Project Developers", "Corey Farwell "] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/frewsxcv/rust-threadpool" +homepage = "https://github.com/frewsxcv/rust-threadpool" +documentation = "https://frewsxcv.github.io/rust-threadpool" +description = """ +A thread pool for running a number of jobs on a fixed set of worker threads. +""" + +[lib] +path = "lib.rs" diff --git a/third_party/rust/threadpool/LICENSE-APACHE b/third_party/rust/threadpool/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/threadpool/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/threadpool/LICENSE-MIT b/third_party/rust/threadpool/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/threadpool/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +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. diff --git a/third_party/rust/threadpool/README.md b/third_party/rust/threadpool/README.md new file mode 100644 index 000000000000..192e74f2d632 --- /dev/null +++ b/third_party/rust/threadpool/README.md @@ -0,0 +1,48 @@ +# threadpool + +A thread pool for running a number of jobs on a fixed set of worker threads. + +[![Build Status](https://travis-ci.org/frewsxcv/rust-threadpool.svg?branch=master)](https://travis-ci.org/frewsxcv/rust-threadpool) + +[Documentation](https://frewsxcv.github.io/rust-threadpool/threadpool/index.html) + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +threadpool = "1.0" +``` + +and this to your crate root: + +```rust +extern crate threadpool; +``` + +## Minimal requirements + +This crate requires Rust >= 1.9.0 + +## Similar libraries + +* [rust-scoped-pool](http://github.com/reem/rust-scoped-pool) +* [scoped-threadpool-rs](https://github.com/Kimundi/scoped-threadpool-rs) +* [crossbeam](https://github.com/aturon/crossbeam) + +## License + +Licensed under either of + + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the Apache-2.0 +license, shall be dual licensed as above, without any additional terms or +conditions. diff --git a/third_party/rust/threadpool/lib.rs b/third_party/rust/threadpool/lib.rs new file mode 100644 index 000000000000..f1fe483846b8 --- /dev/null +++ b/third_party/rust/threadpool/lib.rs @@ -0,0 +1,646 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A thread pool used to execute functions in parallel. +//! +//! Spawns a specified number of worker threads and replenishes the pool if any worker threads +//! panic. +//! +//! # Examples +//! +//! ## Syncronized with a channel +//! +//! Every thread sends one message over the channel, which then is collected with the `take()`. +//! +//! ``` +//! use threadpool::ThreadPool; +//! use std::sync::mpsc::channel; +//! +//! let n_workers = 4; +//! let n_jobs = 8; +//! let pool = ThreadPool::new(n_workers); +//! +//! let (tx, rx) = channel(); +//! for _ in 0..n_jobs { +//! let tx = tx.clone(); +//! pool.execute(move|| { +//! tx.send(1).unwrap(); +//! }); +//! } +//! +//! assert_eq!(rx.iter().take(n_jobs).fold(0, |a, b| a + b), 8); +//! ``` +//! +//! ## Syncronized with a barrier +//! +//! Keep in mind, if you put more jobs in the pool than you have workers, +//! you will end up with a [deadlock](https://en.wikipedia.org/wiki/Deadlock) +//! which is [not considered unsafe] +//! (http://doc.rust-lang.org/reference.html#behavior-not-considered-unsafe). +//! +//! ``` +//! use threadpool::ThreadPool; +//! use std::sync::{Arc, Barrier}; +//! use std::sync::atomic::{AtomicUsize, Ordering}; +//! +//! // create at least as many workers as jobs or you will deadlock yourself +//! let n_workers = 42; +//! let n_jobs = 23; +//! let pool = ThreadPool::new(n_workers); +//! let an_atomic = Arc::new(AtomicUsize::new(0)); +//! +//! // create a barrier that wait all jobs plus the starter thread +//! let barrier = Arc::new(Barrier::new(n_jobs + 1)); +//! for _ in 0..n_jobs { +//! let barrier = barrier.clone(); +//! let an_atomic = an_atomic.clone(); +//! +//! pool.execute(move|| { +//! // do the heavy work +//! an_atomic.fetch_add(1, Ordering::Relaxed); +//! +//! // then wait for the other threads +//! barrier.wait(); +//! }); +//! } +//! +//! // wait for the threads to finish the work +//! barrier.wait(); +//! assert_eq!(an_atomic.load(Ordering::SeqCst), 23); +//! ``` + +use std::fmt; +use std::sync::mpsc::{channel, Sender, Receiver}; +use std::sync::{Arc, Mutex}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::thread::{Builder, panicking}; + +trait FnBox { + fn call_box(self: Box); +} + +impl FnBox for F { + fn call_box(self: Box) { + (*self)() + } +} + +type Thunk<'a> = Box; + +struct Sentinel<'a> { + name: Option, + jobs: &'a Arc>>>, + thread_counter: &'a Arc, + thread_count_max: &'a Arc, + thread_count_panic: &'a Arc, + active: bool, +} + +impl<'a> Sentinel<'a> { + fn new(name: Option, + jobs: &'a Arc>>>, + thread_counter: &'a Arc, + thread_count_max: &'a Arc, + thread_count_panic: &'a Arc) + -> Sentinel<'a> { + Sentinel { + name: name, + jobs: jobs, + thread_counter: thread_counter, + thread_count_max: thread_count_max, + thread_count_panic: thread_count_panic, + active: true, + } + } + + // Cancel and destroy this sentinel. + fn cancel(mut self) { + self.active = false; + } +} + +impl<'a> Drop for Sentinel<'a> { + fn drop(&mut self) { + if self.active { + self.thread_counter.fetch_sub(1, Ordering::SeqCst); + if panicking() { + self.thread_count_panic.fetch_add(1, Ordering::SeqCst); + } + spawn_in_pool(self.name.clone(), + self.jobs.clone(), + self.thread_counter.clone(), + self.thread_count_max.clone(), + self.thread_count_panic.clone()) + } + } +} + +/// Abstraction of a thread pool for basic parallelism. +#[derive(Clone)] +pub struct ThreadPool { + // How the threadpool communicates with subthreads. + // + // This is the only such Sender, so when it is dropped all subthreads will + // quit. + name: Option, + jobs: Sender>, + job_receiver: Arc>>>, + active_count: Arc, + max_count: Arc, + panic_count: Arc, +} + +impl ThreadPool { + /// Spawns a new thread pool with `num_threads` threads. + /// + /// # Panics + /// + /// This function will panic if `num_threads` is 0. + pub fn new(num_threads: usize) -> ThreadPool { + ThreadPool::new_pool(None, num_threads) + } + + /// Spawns a new thread pool with `num_threads` threads. Each thread will have the + /// [name][thread name] `name`. + /// + /// # Panics + /// + /// This function will panic if `num_threads` is 0. + /// + /// # Examples + /// + /// ```rust + /// use std::sync::mpsc::sync_channel; + /// use std::thread; + /// use threadpool::ThreadPool; + /// + /// let (tx, rx) = sync_channel(0); + /// let mut pool = ThreadPool::new_with_name("worker".into(), 2); + /// for _ in 0..2 { + /// let tx = tx.clone(); + /// pool.execute(move || { + /// let name = thread::current().name().unwrap().to_owned(); + /// tx.send(name).unwrap(); + /// }); + /// } + /// + /// for thread_name in rx.iter().take(2) { + /// assert_eq!("worker", thread_name); + /// } + /// ``` + /// + /// [thread name]: https://doc.rust-lang.org/std/thread/struct.Thread.html#method.name + pub fn new_with_name(name: String, num_threads: usize) -> ThreadPool { + ThreadPool::new_pool(Some(name), num_threads) + } + + #[inline] + fn new_pool(name: Option, num_threads: usize) -> ThreadPool { + assert!(num_threads >= 1); + + let (tx, rx) = channel::>(); + let rx = Arc::new(Mutex::new(rx)); + let active_count = Arc::new(AtomicUsize::new(0)); + let max_count = Arc::new(AtomicUsize::new(num_threads)); + let panic_count = Arc::new(AtomicUsize::new(0)); + + // Threadpool threads + for _ in 0..num_threads { + spawn_in_pool(name.clone(), + rx.clone(), + active_count.clone(), + max_count.clone(), + panic_count.clone()); + } + + ThreadPool { + name: name, + jobs: tx, + job_receiver: rx.clone(), + active_count: active_count, + max_count: max_count, + panic_count: panic_count, + } + } + + /// Executes the function `job` on a thread in the pool. + pub fn execute(&self, job: F) + where F: FnOnce() + Send + 'static + { + self.jobs.send(Box::new(move || job())).unwrap(); + } + + /// Returns the number of currently active threads. + /// + /// # Examples + /// + /// ``` + /// use threadpool::ThreadPool; + /// use std::time::Duration; + /// use std::thread::sleep; + /// + /// let num_threads = 10; + /// let pool = ThreadPool::new(num_threads); + /// for _ in 0..num_threads { + /// pool.execute(move || { + /// sleep(Duration::from_secs(5)); + /// }); + /// } + /// sleep(Duration::from_secs(1)); + /// assert_eq!(pool.active_count(), num_threads); + /// ``` + pub fn active_count(&self) -> usize { + self.active_count.load(Ordering::Relaxed) + } + + /// Returns the number of created threads + pub fn max_count(&self) -> usize { + self.max_count.load(Ordering::Relaxed) + } + + /// Returns the number of panicked threads over the lifetime of the pool. + /// + /// # Examples + /// + /// ``` + /// use threadpool::ThreadPool; + /// use std::time::Duration; + /// use std::thread::sleep; + /// + /// let num_threads = 10; + /// let pool = ThreadPool::new(num_threads); + /// for _ in 0..num_threads { + /// pool.execute(move || { + /// panic!() + /// }); + /// } + /// sleep(Duration::from_secs(1)); + /// assert_eq!(pool.panic_count(), num_threads); + /// ``` + pub fn panic_count(&self) -> usize { + self.panic_count.load(Ordering::Relaxed) + } + + /// **Deprecated: Use `ThreadPool::set_num_threads`** + #[deprecated(since = "1.3.0", note = "use ThreadPool::set_num_threads")] + pub fn set_threads(&mut self, num_threads: usize) { + self.set_num_threads(num_threads) + } + + /// Sets the number of worker-threads to use as `num_threads`. + /// Can be used to change the threadpool size during runtime. + /// Will not abort already running or waiting threads. + /// + /// # Panics + /// + /// This function will panic if `num_threads` is 0. + pub fn set_num_threads(&mut self, num_threads: usize) { + assert!(num_threads >= 1); + let prev_num_threads = (*self.max_count).swap(num_threads, Ordering::Release); + if let Some(num_spawn) = num_threads.checked_sub(prev_num_threads) { + // Spawn new threads + for _ in 0..num_spawn { + spawn_in_pool(self.name.clone(), + self.job_receiver.clone(), + self.active_count.clone(), + self.max_count.clone(), + self.panic_count.clone()); + } + } + } +} + + +impl fmt::Debug for ThreadPool { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, + "ThreadPool {{ name: {:?}, active_count: {}, max_count: {} }}", + self.name, + self.active_count(), + self.max_count()) + } +} + + +fn spawn_in_pool(name: Option, + jobs: Arc>>>, + thread_counter: Arc, + thread_count_max: Arc, + thread_count_panic: Arc) { + let mut builder = Builder::new(); + if let Some(ref name) = name { + builder = builder.name(name.clone()); + } + builder.spawn(move || { + // Will spawn a new thread on panic unless it is cancelled. + let sentinel = Sentinel::new(name, + &jobs, + &thread_counter, + &thread_count_max, + &thread_count_panic); + + loop { + // Shutdown this thread if the pool has become smaller + let thread_counter_val = thread_counter.load(Ordering::Acquire); + let thread_count_max_val = thread_count_max.load(Ordering::Relaxed); + if thread_counter_val >= thread_count_max_val { + break; + } + let message = { + // Only lock jobs for the time it takes + // to get a job, not run it. + let lock = jobs.lock().unwrap(); + lock.recv() + }; + + let job = match message { + Ok(job) => job, + // The ThreadPool was dropped. + Err(..) => break, + }; + // Do not allow IR around the job execution + thread_counter.fetch_add(1, Ordering::SeqCst); + job.call_box(); + thread_counter.fetch_sub(1, Ordering::SeqCst); + } + + sentinel.cancel(); + }) + .unwrap(); +} + +#[cfg(test)] +mod test { + use super::ThreadPool; + use std::sync::mpsc::{sync_channel, channel}; + use std::sync::{Arc, Barrier}; + use std::thread::{self, sleep}; + use std::time::Duration; + + const TEST_TASKS: usize = 4; + + #[test] + fn test_set_num_threads_increasing() { + let new_thread_amount = TEST_TASKS + 8; + let mut pool = ThreadPool::new(TEST_TASKS); + for _ in 0..TEST_TASKS { + pool.execute(move || { + loop { + sleep(Duration::from_secs(10)) + } + }); + } + pool.set_num_threads(new_thread_amount); + for _ in 0..(new_thread_amount - TEST_TASKS) { + pool.execute(move || { + loop { + sleep(Duration::from_secs(10)) + } + }); + } + sleep(Duration::from_secs(1)); + assert_eq!(pool.active_count(), new_thread_amount); + } + + #[test] + fn test_set_num_threads_decreasing() { + let new_thread_amount = 2; + let mut pool = ThreadPool::new(TEST_TASKS); + for _ in 0..TEST_TASKS { + pool.execute(move || { + 1 + 1; + }); + } + pool.set_num_threads(new_thread_amount); + for _ in 0..new_thread_amount { + pool.execute(move || { + loop { + sleep(Duration::from_secs(10)) + } + }); + } + sleep(Duration::from_secs(1)); + assert_eq!(pool.active_count(), new_thread_amount); + } + + #[test] + fn test_active_count() { + let pool = ThreadPool::new(TEST_TASKS); + for _ in 0..TEST_TASKS { + pool.execute(move || { + loop { + sleep(Duration::from_secs(10)) + } + }); + } + sleep(Duration::from_secs(1)); + let active_count = pool.active_count(); + assert_eq!(active_count, TEST_TASKS); + let initialized_count = pool.max_count(); + assert_eq!(initialized_count, TEST_TASKS); + } + + #[test] + fn test_works() { + let pool = ThreadPool::new(TEST_TASKS); + + let (tx, rx) = channel(); + for _ in 0..TEST_TASKS { + let tx = tx.clone(); + pool.execute(move || { + tx.send(1).unwrap(); + }); + } + + assert_eq!(rx.iter().take(TEST_TASKS).fold(0, |a, b| a + b), TEST_TASKS); + } + + #[test] + #[should_panic] + fn test_zero_tasks_panic() { + ThreadPool::new(0); + } + + #[test] + fn test_recovery_from_subtask_panic() { + let pool = ThreadPool::new(TEST_TASKS); + + // Panic all the existing threads. + for _ in 0..TEST_TASKS { + pool.execute(move || { panic!() }); + } + sleep(Duration::from_secs(1)); + + assert_eq!(pool.panic_count(), TEST_TASKS); + + // Ensure new threads were spawned to compensate. + let (tx, rx) = channel(); + for _ in 0..TEST_TASKS { + let tx = tx.clone(); + pool.execute(move || { + tx.send(1).unwrap(); + }); + } + + assert_eq!(rx.iter().take(TEST_TASKS).fold(0, |a, b| a + b), TEST_TASKS); + } + + #[test] + fn test_should_not_panic_on_drop_if_subtasks_panic_after_drop() { + + let pool = ThreadPool::new(TEST_TASKS); + let waiter = Arc::new(Barrier::new(TEST_TASKS + 1)); + + // Panic all the existing threads in a bit. + for _ in 0..TEST_TASKS { + let waiter = waiter.clone(); + pool.execute(move || { + waiter.wait(); + panic!("Ignore this panic, it should!"); + }); + } + + drop(pool); + + // Kick off the failure. + waiter.wait(); + } + + #[test] + fn test_massive_task_creation() { + let test_tasks = 4_200_000; + + let pool = ThreadPool::new(TEST_TASKS); + let b0 = Arc::new(Barrier::new(TEST_TASKS + 1)); + let b1 = Arc::new(Barrier::new(TEST_TASKS + 1)); + + let (tx, rx) = channel(); + + for i in 0..test_tasks { + let tx = tx.clone(); + let (b0, b1) = (b0.clone(), b1.clone()); + + pool.execute(move || { + + // Wait until the pool has been filled once. + if i < TEST_TASKS { + b0.wait(); + // wait so the pool can be measured + b1.wait(); + } + + tx.send(1).is_ok(); + }); + } + + b0.wait(); + assert_eq!(pool.active_count(), TEST_TASKS); + b1.wait(); + + assert_eq!(rx.iter().take(test_tasks).fold(0, |a, b| a + b), test_tasks); + // `iter().take(test_tasks).fold` may be faster than the last thread finishing itself, so + // values of 0 or 1 are ok. + let atomic_active_count = pool.active_count(); + assert!(atomic_active_count <= 1, "atomic_active_count: {}", atomic_active_count); + } + + #[test] + fn test_shrink() { + let test_tasks_begin = TEST_TASKS + 2; + + let mut pool = ThreadPool::new(test_tasks_begin); + let b0 = Arc::new(Barrier::new(test_tasks_begin + 1)); + let b1 = Arc::new(Barrier::new(test_tasks_begin + 1)); + + for _ in 0..test_tasks_begin { + let (b0, b1) = (b0.clone(), b1.clone()); + pool.execute(move || { + b0.wait(); + b1.wait(); + }); + } + + let b2 = Arc::new(Barrier::new(TEST_TASKS + 1)); + let b3 = Arc::new(Barrier::new(TEST_TASKS + 1)); + + for _ in 0..TEST_TASKS { + let (b2, b3) = (b2.clone(), b3.clone()); + pool.execute(move || { + b2.wait(); + b3.wait(); + }); + } + + b0.wait(); + pool.set_num_threads(TEST_TASKS); + + assert_eq!(pool.active_count(), test_tasks_begin); + b1.wait(); + + + b2.wait(); + assert_eq!(pool.active_count(), TEST_TASKS); + b3.wait(); + } + + #[test] + fn test_name() { + let name = "test"; + let mut pool = ThreadPool::new_with_name(name.to_owned(), 2); + let (tx, rx) = sync_channel(0); + + // initial thread should share the name "test" + for _ in 0..2 { + let tx = tx.clone(); + pool.execute(move || { + let name = thread::current().name().unwrap().to_owned(); + tx.send(name).unwrap(); + }); + } + + // new spawn thread should share the name "test" too. + pool.set_num_threads(3); + let tx_clone = tx.clone(); + pool.execute(move || { + let name = thread::current().name().unwrap().to_owned(); + tx_clone.send(name).unwrap(); + panic!(); + }); + + // recover thread should share the name "test" too. + pool.execute(move || { + let name = thread::current().name().unwrap().to_owned(); + tx.send(name).unwrap(); + }); + + for thread_name in rx.iter().take(4) { + assert_eq!(name, thread_name); + } + } + + #[test] + fn test_debug() { + let pool = ThreadPool::new(4); + let debug = format!("{:?}", pool); + assert_eq!(debug, "ThreadPool { name: None, active_count: 0, max_count: 4 }"); + + let pool = ThreadPool::new_with_name("hello".into(), 4); + let debug = format!("{:?}", pool); + assert_eq!(debug, "ThreadPool { name: Some(\"hello\"), active_count: 0, max_count: 4 }"); + + let pool = ThreadPool::new(4); + pool.execute(move || { + sleep(Duration::from_secs(5)) + }); + sleep(Duration::from_secs(1)); + let debug = format!("{:?}", pool); + assert_eq!(debug, "ThreadPool { name: None, active_count: 1, max_count: 4 }"); + } +} diff --git a/third_party/rust/time/.cargo-checksum.json b/third_party/rust/time/.cargo-checksum.json new file mode 100644 index 000000000000..4682c63248a6 --- /dev/null +++ b/third_party/rust/time/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"9555a092ed1f87de52b07a90c614a30c6fa8f307eb4b05229253d06df363ce7a","Cargo.toml":"9369a5798a85c467578e9be04ffdb220d1d7457950373bd3b0662a62ca58520b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"2c17f942c4a797f6f491c6d40570f904f35047531884ded3244438832b3d6f0a","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","benches/precise_time_ns.rs":"f331c85489a05ea3bb83df9d57131a6e651ce852ca881417f328c4e8f53503c6","src/display.rs":"b79a81b4f068e44934ad3398ba0259120cc30cf0855ac5108c4569e320fd7f1d","src/duration.rs":"032f2ced8ea4dddaf6ed111f345e99217bad17edb7ed9fc4c511e405c8e02b87","src/lib.rs":"d01631b2340e30673e4c809678a5bdd3f8c18debb25ada21805a990254cb7caf","src/parse.rs":"717ae5735dfdaaba513f2a54a179e73bb2a48f8d4fb8787740d4662d6ff3389c","src/sys.rs":"a6bf379947da5ed16063a9bfcdf877c84e38e006a9cbc45ee0558cba4cf5c295"},"package":"211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade"} \ No newline at end of file diff --git a/third_party/rust/time/.cargo-ok b/third_party/rust/time/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/time/.gitignore b/third_party/rust/time/.gitignore new file mode 100644 index 000000000000..4fffb2f89cbd --- /dev/null +++ b/third_party/rust/time/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/third_party/rust/time/.travis.yml b/third_party/rust/time/.travis.yml new file mode 100644 index 000000000000..ef41a461e99b --- /dev/null +++ b/third_party/rust/time/.travis.yml @@ -0,0 +1,27 @@ +language: rust +rust: + - stable + - beta + - nightly +sudo: false +before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH +script: + - cargo build --verbose + - cargo test --verbose + - cargo test --verbose --features rustc-serialize + - cargo doc --no-deps +after_success: + - travis-cargo --only nightly doc-upload +env: + global: + secure: "NlXnNaUBf2MgV2gPJyIQU+JM814e29itvvb8o5BvN4YB60rseu16yLbzKpO4FzuOFBc/Uc+1veDcKyzZYsdV6FIwQk4jfdUkNZ3i56InVCzXcaaHCe78cpg/IxK+/48fGy/EIJkWYdtQsoVCGunaf5NdF360Lzb6G/B1vheC34E=" + + + +notifications: + email: + on_success: never +os: + - linux + - osx diff --git a/third_party/rust/time/Cargo.toml b/third_party/rust/time/Cargo.toml new file mode 100644 index 000000000000..0574278d5fee --- /dev/null +++ b/third_party/rust/time/Cargo.toml @@ -0,0 +1,27 @@ +[package] + +name = "time" +version = "0.1.36" +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +homepage = "https://github.com/rust-lang/time" +repository = "https://github.com/rust-lang/time" +documentation = "https://doc.rust-lang.org/time" +description = """ +Utilities for working with time-related functions in Rust. +""" + +[dependencies] +libc = "0.2.1" +rustc-serialize = { version = "0.3", optional = true } + +[target.'cfg(target_os = "redox")'.dependencies] +redox_syscall = "0.1" + +[target.'cfg(windows)'.dependencies] +winapi = "0.2.0" +kernel32-sys = "0.2.0" + +[dev-dependencies] +log = "0.3" +advapi32-sys = "0.1.2" diff --git a/third_party/rust/time/LICENSE-APACHE b/third_party/rust/time/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/time/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/time/LICENSE-MIT b/third_party/rust/time/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/time/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +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. diff --git a/third_party/rust/time/README.md b/third_party/rust/time/README.md new file mode 100644 index 000000000000..9762f5ed8ae8 --- /dev/null +++ b/third_party/rust/time/README.md @@ -0,0 +1,30 @@ +time +==== + +Utilities for working with time-related functions in Rust + +[![Build Status](https://travis-ci.org/rust-lang-deprecated/time.svg?branch=master)](https://travis-ci.org/rust-lang-deprecated/time) +[![Build status](https://ci.appveyor.com/api/projects/status/55m7rbaj9a5v3ad7?svg=true)](https://ci.appveyor.com/project/alexcrichton/time) + +[Documentation](https://doc.rust-lang.org/time) + +## Notes + +This library is no longer actively maintained, but bugfixes will be added ([details](https://github.com/rust-lang-deprecated/time/issues/136)). + +In case you're looking for something a little fresher and more actively maintained have a look at the [`chrono`](https://github.com/lifthrasiir/rust-chrono) crate. + +## Usage + +Put this in your `Cargo.toml`: + +```toml +[dependencies] +time = "0.1" +``` + +And this in your crate root: + +```rust +extern crate time; +``` diff --git a/third_party/rust/time/appveyor.yml b/third_party/rust/time/appveyor.yml new file mode 100644 index 000000000000..6a1b8dc19c03 --- /dev/null +++ b/third_party/rust/time/appveyor.yml @@ -0,0 +1,17 @@ +environment: + matrix: + - TARGET: x86_64-pc-windows-msvc + - TARGET: i686-pc-windows-msvc + - TARGET: i686-pc-windows-gnu +install: + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" + - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" + - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin + - SET PATH=%PATH%;C:\MinGW\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo test --verbose diff --git a/third_party/rust/time/benches/precise_time_ns.rs b/third_party/rust/time/benches/precise_time_ns.rs new file mode 100644 index 000000000000..d9170ea26b76 --- /dev/null +++ b/third_party/rust/time/benches/precise_time_ns.rs @@ -0,0 +1,11 @@ +#![feature(test)] + +extern crate test; +extern crate time; + +use test::Bencher; + +#[bench] +fn bench_precise_time_ns(b: &mut Bencher) { + b.iter(|| time::precise_time_ns()) +} diff --git a/third_party/rust/time/src/display.rs b/third_party/rust/time/src/display.rs new file mode 100644 index 000000000000..27372d22e789 --- /dev/null +++ b/third_party/rust/time/src/display.rs @@ -0,0 +1,260 @@ +use std::fmt::{self, Write}; + +use super::{TmFmt, Tm, Fmt}; + +impl<'a> fmt::Display for TmFmt<'a> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match self.format { + Fmt::Str(ref s) => { + let mut chars = s.chars(); + while let Some(ch) = chars.next() { + if ch == '%' { + // we've already validated that % always precedes + // another char + try!(parse_type(fmt, chars.next().unwrap(), self.tm)); + } else { + try!(fmt.write_char(ch)); + } + } + + Ok(()) + } + Fmt::Ctime => self.tm.to_local().asctime().fmt(fmt), + Fmt::Rfc3339 => { + if self.tm.tm_utcoff == 0 { + TmFmt { + tm: self.tm, + format: Fmt::Str("%Y-%m-%dT%H:%M:%SZ"), + }.fmt(fmt) + } else { + let s = TmFmt { + tm: self.tm, + format: Fmt::Str("%Y-%m-%dT%H:%M:%S"), + }; + let sign = if self.tm.tm_utcoff > 0 { '+' } else { '-' }; + let mut m = abs(self.tm.tm_utcoff) / 60; + let h = m / 60; + m -= h * 60; + write!(fmt, "{}{}{:02}:{:02}", s, sign, h, m) + } + } + } + } +} + +fn is_leap_year(year: i32) -> bool { + (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)) +} + +fn days_in_year(year: i32) -> i32 { + if is_leap_year(year) { 366 } + else { 365 } +} + +fn iso_week_days(yday: i32, wday: i32) -> i32 { + /* The number of days from the first day of the first ISO week of this + * year to the year day YDAY with week day WDAY. + * ISO weeks start on Monday. The first ISO week has the year's first + * Thursday. + * YDAY may be as small as yday_minimum. + */ + let iso_week_start_wday: i32 = 1; /* Monday */ + let iso_week1_wday: i32 = 4; /* Thursday */ + let yday_minimum: i32 = 366; + /* Add enough to the first operand of % to make it nonnegative. */ + let big_enough_multiple_of_7: i32 = (yday_minimum / 7 + 2) * 7; + + yday - (yday - wday + iso_week1_wday + big_enough_multiple_of_7) % 7 + + iso_week1_wday - iso_week_start_wday +} + +fn iso_week(fmt: &mut fmt::Formatter, ch:char, tm: &Tm) -> fmt::Result { + let mut year = tm.tm_year + 1900; + let mut days = iso_week_days(tm.tm_yday, tm.tm_wday); + + if days < 0 { + /* This ISO week belongs to the previous year. */ + year -= 1; + days = iso_week_days(tm.tm_yday + (days_in_year(year)), tm.tm_wday); + } else { + let d = iso_week_days(tm.tm_yday - (days_in_year(year)), + tm.tm_wday); + if 0 <= d { + /* This ISO week belongs to the next year. */ + year += 1; + days = d; + } + } + + match ch { + 'G' => write!(fmt, "{}", year), + 'g' => write!(fmt, "{:02}", (year % 100 + 100) % 100), + 'V' => write!(fmt, "{:02}", days / 7 + 1), + _ => Ok(()) + } +} + +fn parse_type(fmt: &mut fmt::Formatter, ch: char, tm: &Tm) -> fmt::Result { + match ch { + 'A' => fmt.write_str(match tm.tm_wday { + 0 => "Sunday", + 1 => "Monday", + 2 => "Tuesday", + 3 => "Wednesday", + 4 => "Thursday", + 5 => "Friday", + 6 => "Saturday", + _ => unreachable!(), + }), + 'a' => fmt.write_str(match tm.tm_wday { + 0 => "Sun", + 1 => "Mon", + 2 => "Tue", + 3 => "Wed", + 4 => "Thu", + 5 => "Fri", + 6 => "Sat", + _ => unreachable!(), + }), + 'B' => fmt.write_str(match tm.tm_mon { + 0 => "January", + 1 => "February", + 2 => "March", + 3 => "April", + 4 => "May", + 5 => "June", + 6 => "July", + 7 => "August", + 8 => "September", + 9 => "October", + 10 => "November", + 11 => "December", + _ => unreachable!(), + }), + 'b' | 'h' => fmt.write_str(match tm.tm_mon { + 0 => "Jan", + 1 => "Feb", + 2 => "Mar", + 3 => "Apr", + 4 => "May", + 5 => "Jun", + 6 => "Jul", + 7 => "Aug", + 8 => "Sep", + 9 => "Oct", + 10 => "Nov", + 11 => "Dec", + _ => unreachable!(), + }), + 'C' => write!(fmt, "{:02}", (tm.tm_year + 1900) / 100), + 'c' => { + try!(parse_type(fmt, 'a', tm)); + try!(fmt.write_str(" ")); + try!(parse_type(fmt, 'b', tm)); + try!(fmt.write_str(" ")); + try!(parse_type(fmt, 'e', tm)); + try!(fmt.write_str(" ")); + try!(parse_type(fmt, 'T', tm)); + try!(fmt.write_str(" ")); + parse_type(fmt, 'Y', tm) + } + 'D' | 'x' => { + try!(parse_type(fmt, 'm', tm)); + try!(fmt.write_str("/")); + try!(parse_type(fmt, 'd', tm)); + try!(fmt.write_str("/")); + parse_type(fmt, 'y', tm) + } + 'd' => write!(fmt, "{:02}", tm.tm_mday), + 'e' => write!(fmt, "{:2}", tm.tm_mday), + 'f' => write!(fmt, "{:09}", tm.tm_nsec), + 'F' => { + try!(parse_type(fmt, 'Y', tm)); + try!(fmt.write_str("-")); + try!(parse_type(fmt, 'm', tm)); + try!(fmt.write_str("-")); + parse_type(fmt, 'd', tm) + } + 'G' => iso_week(fmt, 'G', tm), + 'g' => iso_week(fmt, 'g', tm), + 'H' => write!(fmt, "{:02}", tm.tm_hour), + 'I' => { + let mut h = tm.tm_hour; + if h == 0 { h = 12 } + if h > 12 { h -= 12 } + write!(fmt, "{:02}", h) + } + 'j' => write!(fmt, "{:03}", tm.tm_yday + 1), + 'k' => write!(fmt, "{:2}", tm.tm_hour), + 'l' => { + let mut h = tm.tm_hour; + if h == 0 { h = 12 } + if h > 12 { h -= 12 } + write!(fmt, "{:2}", h) + } + 'M' => write!(fmt, "{:02}", tm.tm_min), + 'm' => write!(fmt, "{:02}", tm.tm_mon + 1), + 'n' => fmt.write_str("\n"), + 'P' => fmt.write_str(if tm.tm_hour < 12 { "am" } else { "pm" }), + 'p' => fmt.write_str(if (tm.tm_hour) < 12 { "AM" } else { "PM" }), + 'R' => { + try!(parse_type(fmt, 'H', tm)); + try!(fmt.write_str(":")); + parse_type(fmt, 'M', tm) + } + 'r' => { + try!(parse_type(fmt, 'I', tm)); + try!(fmt.write_str(":")); + try!(parse_type(fmt, 'M', tm)); + try!(fmt.write_str(":")); + try!(parse_type(fmt, 'S', tm)); + try!(fmt.write_str(" ")); + parse_type(fmt, 'p', tm) + } + 'S' => write!(fmt, "{:02}", tm.tm_sec), + 's' => write!(fmt, "{}", tm.to_timespec().sec), + 'T' | 'X' => { + try!(parse_type(fmt, 'H', tm)); + try!(fmt.write_str(":")); + try!(parse_type(fmt, 'M', tm)); + try!(fmt.write_str(":")); + parse_type(fmt, 'S', tm) + } + 't' => fmt.write_str("\t"), + 'U' => write!(fmt, "{:02}", (tm.tm_yday - tm.tm_wday + 7) / 7), + 'u' => { + let i = tm.tm_wday; + write!(fmt, "{}", (if i == 0 { 7 } else { i })) + } + 'V' => iso_week(fmt, 'V', tm), + 'v' => { + try!(parse_type(fmt, 'e', tm)); + try!(fmt.write_str("-")); + try!(parse_type(fmt, 'b', tm)); + try!(fmt.write_str("-")); + parse_type(fmt, 'Y', tm) + } + 'W' => { + write!(fmt, "{:02}", (tm.tm_yday - (tm.tm_wday - 1 + 7) % 7 + 7) / 7) + } + 'w' => write!(fmt, "{}", tm.tm_wday), + 'Y' => write!(fmt, "{}", tm.tm_year + 1900), + 'y' => write!(fmt, "{:02}", (tm.tm_year + 1900) % 100), + // FIXME (#2350): support locale + 'Z' => fmt.write_str(if tm.tm_utcoff == 0 { "UTC"} else { "" }), + 'z' => { + let sign = if tm.tm_utcoff > 0 { '+' } else { '-' }; + let mut m = abs(tm.tm_utcoff) / 60; + let h = m / 60; + m -= h * 60; + write!(fmt, "{}{:02}{:02}", sign, h, m) + } + '+' => write!(fmt, "{}", tm.rfc3339()), + '%' => fmt.write_str("%"), + _ => unreachable!(), + } +} + +fn abs(i: i32) -> i32 { + if i < 0 {-i} else {i} +} diff --git a/third_party/rust/time/src/duration.rs b/third_party/rust/time/src/duration.rs new file mode 100644 index 000000000000..33050aee494c --- /dev/null +++ b/third_party/rust/time/src/duration.rs @@ -0,0 +1,648 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Temporal quantification + +use std::{fmt, i64}; +use std::error::Error; +use std::ops::{Add, Sub, Mul, Div, Neg, FnOnce}; +use std::time::Duration as StdDuration; + +/// The number of nanoseconds in a microsecond. +const NANOS_PER_MICRO: i32 = 1000; +/// The number of nanoseconds in a millisecond. +const NANOS_PER_MILLI: i32 = 1000_000; +/// The number of nanoseconds in seconds. +const NANOS_PER_SEC: i32 = 1_000_000_000; +/// The number of microseconds per second. +const MICROS_PER_SEC: i64 = 1000_000; +/// The number of milliseconds per second. +const MILLIS_PER_SEC: i64 = 1000; +/// The number of seconds in a minute. +const SECS_PER_MINUTE: i64 = 60; +/// The number of seconds in an hour. +const SECS_PER_HOUR: i64 = 3600; +/// The number of (non-leap) seconds in days. +const SECS_PER_DAY: i64 = 86400; +/// The number of (non-leap) seconds in a week. +const SECS_PER_WEEK: i64 = 604800; + +macro_rules! try_opt { + ($e:expr) => (match $e { Some(v) => v, None => return None }) +} + + +/// ISO 8601 time duration with nanosecond precision. +/// This also allows for the negative duration; see individual methods for details. +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] +pub struct Duration { + secs: i64, + nanos: i32, // Always 0 <= nanos < NANOS_PER_SEC +} + +/// The minimum possible `Duration`: `i64::MIN` milliseconds. +pub const MIN: Duration = Duration { + secs: i64::MIN / MILLIS_PER_SEC - 1, + nanos: NANOS_PER_SEC + (i64::MIN % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI +}; + +/// The maximum possible `Duration`: `i64::MAX` milliseconds. +pub const MAX: Duration = Duration { + secs: i64::MAX / MILLIS_PER_SEC, + nanos: (i64::MAX % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI +}; + +impl Duration { + /// Makes a new `Duration` with given number of weeks. + /// Equivalent to `Duration::seconds(weeks * 7 * 24 * 60 * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn weeks(weeks: i64) -> Duration { + let secs = weeks.checked_mul(SECS_PER_WEEK).expect("Duration::weeks out of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of days. + /// Equivalent to `Duration::seconds(days * 24 * 60 * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn days(days: i64) -> Duration { + let secs = days.checked_mul(SECS_PER_DAY).expect("Duration::days out of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of hours. + /// Equivalent to `Duration::seconds(hours * 60 * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn hours(hours: i64) -> Duration { + let secs = hours.checked_mul(SECS_PER_HOUR).expect("Duration::hours ouf of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of minutes. + /// Equivalent to `Duration::seconds(minutes * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn minutes(minutes: i64) -> Duration { + let secs = minutes.checked_mul(SECS_PER_MINUTE).expect("Duration::minutes out of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of seconds. + /// Panics when the duration is more than `i64::MAX` milliseconds + /// or less than `i64::MIN` milliseconds. + #[inline] + pub fn seconds(seconds: i64) -> Duration { + let d = Duration { secs: seconds, nanos: 0 }; + if d < MIN || d > MAX { + panic!("Duration::seconds out of bounds"); + } + d + } + + /// Makes a new `Duration` with given number of milliseconds. + #[inline] + pub fn milliseconds(milliseconds: i64) -> Duration { + let (secs, millis) = div_mod_floor_64(milliseconds, MILLIS_PER_SEC); + let nanos = millis as i32 * NANOS_PER_MILLI; + Duration { secs: secs, nanos: nanos } + } + + /// Makes a new `Duration` with given number of microseconds. + #[inline] + pub fn microseconds(microseconds: i64) -> Duration { + let (secs, micros) = div_mod_floor_64(microseconds, MICROS_PER_SEC); + let nanos = micros as i32 * NANOS_PER_MICRO; + Duration { secs: secs, nanos: nanos } + } + + /// Makes a new `Duration` with given number of nanoseconds. + #[inline] + pub fn nanoseconds(nanos: i64) -> Duration { + let (secs, nanos) = div_mod_floor_64(nanos, NANOS_PER_SEC as i64); + Duration { secs: secs, nanos: nanos as i32 } + } + + /// Runs a closure, returning the duration of time it took to run the + /// closure. + pub fn span(f: F) -> Duration where F: FnOnce() { + let before = super::precise_time_ns(); + f(); + Duration::nanoseconds((super::precise_time_ns() - before) as i64) + } + + /// Returns the total number of whole weeks in the duration. + #[inline] + pub fn num_weeks(&self) -> i64 { + self.num_days() / 7 + } + + /// Returns the total number of whole days in the duration. + pub fn num_days(&self) -> i64 { + self.num_seconds() / SECS_PER_DAY + } + + /// Returns the total number of whole hours in the duration. + #[inline] + pub fn num_hours(&self) -> i64 { + self.num_seconds() / SECS_PER_HOUR + } + + /// Returns the total number of whole minutes in the duration. + #[inline] + pub fn num_minutes(&self) -> i64 { + self.num_seconds() / SECS_PER_MINUTE + } + + /// Returns the total number of whole seconds in the duration. + pub fn num_seconds(&self) -> i64 { + // If secs is negative, nanos should be subtracted from the duration. + if self.secs < 0 && self.nanos > 0 { + self.secs + 1 + } else { + self.secs + } + } + + /// Returns the number of nanoseconds such that + /// `nanos_mod_sec() + num_seconds() * NANOS_PER_SEC` is the total number of + /// nanoseconds in the duration. + fn nanos_mod_sec(&self) -> i32 { + if self.secs < 0 && self.nanos > 0 { + self.nanos - NANOS_PER_SEC + } else { + self.nanos + } + } + + /// Returns the total number of whole milliseconds in the duration, + pub fn num_milliseconds(&self) -> i64 { + // A proper Duration will not overflow, because MIN and MAX are defined + // such that the range is exactly i64 milliseconds. + let secs_part = self.num_seconds() * MILLIS_PER_SEC; + let nanos_part = self.nanos_mod_sec() / NANOS_PER_MILLI; + secs_part + nanos_part as i64 + } + + /// Returns the total number of whole microseconds in the duration, + /// or `None` on overflow (exceeding 2^63 microseconds in either direction). + pub fn num_microseconds(&self) -> Option { + let secs_part = try_opt!(self.num_seconds().checked_mul(MICROS_PER_SEC)); + let nanos_part = self.nanos_mod_sec() / NANOS_PER_MICRO; + secs_part.checked_add(nanos_part as i64) + } + + /// Returns the total number of whole nanoseconds in the duration, + /// or `None` on overflow (exceeding 2^63 nanoseconds in either direction). + pub fn num_nanoseconds(&self) -> Option { + let secs_part = try_opt!(self.num_seconds().checked_mul(NANOS_PER_SEC as i64)); + let nanos_part = self.nanos_mod_sec(); + secs_part.checked_add(nanos_part as i64) + } + + /// Add two durations, returning `None` if overflow occurred. + pub fn checked_add(&self, rhs: &Duration) -> Option { + let mut secs = try_opt!(self.secs.checked_add(rhs.secs)); + let mut nanos = self.nanos + rhs.nanos; + if nanos >= NANOS_PER_SEC { + nanos -= NANOS_PER_SEC; + secs = try_opt!(secs.checked_add(1)); + } + let d = Duration { secs: secs, nanos: nanos }; + // Even if d is within the bounds of i64 seconds, + // it might still overflow i64 milliseconds. + if d < MIN || d > MAX { None } else { Some(d) } + } + + /// Subtract two durations, returning `None` if overflow occurred. + pub fn checked_sub(&self, rhs: &Duration) -> Option { + let mut secs = try_opt!(self.secs.checked_sub(rhs.secs)); + let mut nanos = self.nanos - rhs.nanos; + if nanos < 0 { + nanos += NANOS_PER_SEC; + secs = try_opt!(secs.checked_sub(1)); + } + let d = Duration { secs: secs, nanos: nanos }; + // Even if d is within the bounds of i64 seconds, + // it might still overflow i64 milliseconds. + if d < MIN || d > MAX { None } else { Some(d) } + } + + /// The minimum possible `Duration`: `i64::MIN` milliseconds. + #[inline] + pub fn min_value() -> Duration { MIN } + + /// The maximum possible `Duration`: `i64::MAX` milliseconds. + #[inline] + pub fn max_value() -> Duration { MAX } + + /// A duration where the stored seconds and nanoseconds are equal to zero. + #[inline] + pub fn zero() -> Duration { + Duration { secs: 0, nanos: 0 } + } + + /// Returns `true` if the duration equals `Duration::zero()`. + #[inline] + pub fn is_zero(&self) -> bool { + self.secs == 0 && self.nanos == 0 + } + + /// Creates a `time::Duration` object from `std::time::Duration` + /// + /// This function errors when original duration is larger than the maximum + /// value supported for this type. + pub fn from_std(duration: StdDuration) -> Result { + // We need to check secs as u64 before coercing to i64 + if duration.as_secs() > MAX.secs as u64 { + return Err(OutOfRangeError(())); + } + let d = Duration { + secs: duration.as_secs() as i64, + nanos: duration.subsec_nanos() as i32, + }; + if d > MAX { + return Err(OutOfRangeError(())); + } + Ok(d) + } + + /// Creates a `std::time::Duration` object from `time::Duration` + /// + /// This function errors when duration is less than zero. As standard + /// library implementation is limited to non-negative values. + pub fn to_std(&self) -> Result { + if self.secs < 0 { + return Err(OutOfRangeError(())); + } + Ok(StdDuration::new(self.secs as u64, self.nanos as u32)) + } +} + +impl Neg for Duration { + type Output = Duration; + + #[inline] + fn neg(self) -> Duration { + if self.nanos == 0 { + Duration { secs: -self.secs, nanos: 0 } + } else { + Duration { secs: -self.secs - 1, nanos: NANOS_PER_SEC - self.nanos } + } + } +} + +impl Add for Duration { + type Output = Duration; + + fn add(self, rhs: Duration) -> Duration { + let mut secs = self.secs + rhs.secs; + let mut nanos = self.nanos + rhs.nanos; + if nanos >= NANOS_PER_SEC { + nanos -= NANOS_PER_SEC; + secs += 1; + } + Duration { secs: secs, nanos: nanos } + } +} + +impl Sub for Duration { + type Output = Duration; + + fn sub(self, rhs: Duration) -> Duration { + let mut secs = self.secs - rhs.secs; + let mut nanos = self.nanos - rhs.nanos; + if nanos < 0 { + nanos += NANOS_PER_SEC; + secs -= 1; + } + Duration { secs: secs, nanos: nanos } + } +} + +impl Mul for Duration { + type Output = Duration; + + fn mul(self, rhs: i32) -> Duration { + // Multiply nanoseconds as i64, because it cannot overflow that way. + let total_nanos = self.nanos as i64 * rhs as i64; + let (extra_secs, nanos) = div_mod_floor_64(total_nanos, NANOS_PER_SEC as i64); + let secs = self.secs * rhs as i64 + extra_secs; + Duration { secs: secs, nanos: nanos as i32 } + } +} + +impl Div for Duration { + type Output = Duration; + + fn div(self, rhs: i32) -> Duration { + let mut secs = self.secs / rhs as i64; + let carry = self.secs - secs * rhs as i64; + let extra_nanos = carry * NANOS_PER_SEC as i64 / rhs as i64; + let mut nanos = self.nanos / rhs + extra_nanos as i32; + if nanos >= NANOS_PER_SEC { + nanos -= NANOS_PER_SEC; + secs += 1; + } + if nanos < 0 { + nanos += NANOS_PER_SEC; + secs -= 1; + } + Duration { secs: secs, nanos: nanos } + } +} + +impl fmt::Display for Duration { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // technically speaking, negative duration is not valid ISO 8601, + // but we need to print it anyway. + let (abs, sign) = if self.secs < 0 { (-*self, "-") } else { (*self, "") }; + + let days = abs.secs / SECS_PER_DAY; + let secs = abs.secs - days * SECS_PER_DAY; + let hasdate = days != 0; + let hastime = (secs != 0 || abs.nanos != 0) || !hasdate; + + try!(write!(f, "{}P", sign)); + + if hasdate { + try!(write!(f, "{}D", days)); + } + if hastime { + if abs.nanos == 0 { + try!(write!(f, "T{}S", secs)); + } else if abs.nanos % NANOS_PER_MILLI == 0 { + try!(write!(f, "T{}.{:03}S", secs, abs.nanos / NANOS_PER_MILLI)); + } else if abs.nanos % NANOS_PER_MICRO == 0 { + try!(write!(f, "T{}.{:06}S", secs, abs.nanos / NANOS_PER_MICRO)); + } else { + try!(write!(f, "T{}.{:09}S", secs, abs.nanos)); + } + } + Ok(()) + } +} + +/// Represents error when converting `Duration` to/from a standard library +/// implementation +/// +/// The `std::time::Duration` supports a range from zero to `u64::MAX` +/// *seconds*, while this module supports signed range of up to +/// `i64::MAX` of *milliseconds*. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct OutOfRangeError(()); + +impl fmt::Display for OutOfRangeError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.description()) + } +} + +impl Error for OutOfRangeError { + fn description(&self) -> &str { + "Source duration value is out of range for the target type" + } +} + +// Copied from libnum +#[inline] +fn div_mod_floor_64(this: i64, other: i64) -> (i64, i64) { + (div_floor_64(this, other), mod_floor_64(this, other)) +} + +#[inline] +fn div_floor_64(this: i64, other: i64) -> i64 { + match div_rem_64(this, other) { + (d, r) if (r > 0 && other < 0) + || (r < 0 && other > 0) => d - 1, + (d, _) => d, + } +} + +#[inline] +fn mod_floor_64(this: i64, other: i64) -> i64 { + match this % other { + r if (r > 0 && other < 0) + || (r < 0 && other > 0) => r + other, + r => r, + } +} + +#[inline] +fn div_rem_64(this: i64, other: i64) -> (i64, i64) { + (this / other, this % other) +} + +#[cfg(test)] +mod tests { + use super::{Duration, MIN, MAX, OutOfRangeError}; + use std::{i32, i64}; + use std::time::Duration as StdDuration; + + #[test] + fn test_duration() { + assert!(Duration::seconds(1) != Duration::zero()); + assert_eq!(Duration::seconds(1) + Duration::seconds(2), Duration::seconds(3)); + assert_eq!(Duration::seconds(86399) + Duration::seconds(4), + Duration::days(1) + Duration::seconds(3)); + assert_eq!(Duration::days(10) - Duration::seconds(1000), Duration::seconds(863000)); + assert_eq!(Duration::days(10) - Duration::seconds(1000000), Duration::seconds(-136000)); + assert_eq!(Duration::days(2) + Duration::seconds(86399) + + Duration::nanoseconds(1234567890), + Duration::days(3) + Duration::nanoseconds(234567890)); + assert_eq!(-Duration::days(3), Duration::days(-3)); + assert_eq!(-(Duration::days(3) + Duration::seconds(70)), + Duration::days(-4) + Duration::seconds(86400-70)); + } + + #[test] + fn test_duration_num_days() { + assert_eq!(Duration::zero().num_days(), 0); + assert_eq!(Duration::days(1).num_days(), 1); + assert_eq!(Duration::days(-1).num_days(), -1); + assert_eq!(Duration::seconds(86399).num_days(), 0); + assert_eq!(Duration::seconds(86401).num_days(), 1); + assert_eq!(Duration::seconds(-86399).num_days(), 0); + assert_eq!(Duration::seconds(-86401).num_days(), -1); + assert_eq!(Duration::days(i32::MAX as i64).num_days(), i32::MAX as i64); + assert_eq!(Duration::days(i32::MIN as i64).num_days(), i32::MIN as i64); + } + + #[test] + fn test_duration_num_seconds() { + assert_eq!(Duration::zero().num_seconds(), 0); + assert_eq!(Duration::seconds(1).num_seconds(), 1); + assert_eq!(Duration::seconds(-1).num_seconds(), -1); + assert_eq!(Duration::milliseconds(999).num_seconds(), 0); + assert_eq!(Duration::milliseconds(1001).num_seconds(), 1); + assert_eq!(Duration::milliseconds(-999).num_seconds(), 0); + assert_eq!(Duration::milliseconds(-1001).num_seconds(), -1); + } + + #[test] + fn test_duration_num_milliseconds() { + assert_eq!(Duration::zero().num_milliseconds(), 0); + assert_eq!(Duration::milliseconds(1).num_milliseconds(), 1); + assert_eq!(Duration::milliseconds(-1).num_milliseconds(), -1); + assert_eq!(Duration::microseconds(999).num_milliseconds(), 0); + assert_eq!(Duration::microseconds(1001).num_milliseconds(), 1); + assert_eq!(Duration::microseconds(-999).num_milliseconds(), 0); + assert_eq!(Duration::microseconds(-1001).num_milliseconds(), -1); + assert_eq!(Duration::milliseconds(i64::MAX).num_milliseconds(), i64::MAX); + assert_eq!(Duration::milliseconds(i64::MIN).num_milliseconds(), i64::MIN); + assert_eq!(MAX.num_milliseconds(), i64::MAX); + assert_eq!(MIN.num_milliseconds(), i64::MIN); + } + + #[test] + fn test_duration_num_microseconds() { + assert_eq!(Duration::zero().num_microseconds(), Some(0)); + assert_eq!(Duration::microseconds(1).num_microseconds(), Some(1)); + assert_eq!(Duration::microseconds(-1).num_microseconds(), Some(-1)); + assert_eq!(Duration::nanoseconds(999).num_microseconds(), Some(0)); + assert_eq!(Duration::nanoseconds(1001).num_microseconds(), Some(1)); + assert_eq!(Duration::nanoseconds(-999).num_microseconds(), Some(0)); + assert_eq!(Duration::nanoseconds(-1001).num_microseconds(), Some(-1)); + assert_eq!(Duration::microseconds(i64::MAX).num_microseconds(), Some(i64::MAX)); + assert_eq!(Duration::microseconds(i64::MIN).num_microseconds(), Some(i64::MIN)); + assert_eq!(MAX.num_microseconds(), None); + assert_eq!(MIN.num_microseconds(), None); + + // overflow checks + const MICROS_PER_DAY: i64 = 86400_000_000; + assert_eq!(Duration::days(i64::MAX / MICROS_PER_DAY).num_microseconds(), + Some(i64::MAX / MICROS_PER_DAY * MICROS_PER_DAY)); + assert_eq!(Duration::days(i64::MIN / MICROS_PER_DAY).num_microseconds(), + Some(i64::MIN / MICROS_PER_DAY * MICROS_PER_DAY)); + assert_eq!(Duration::days(i64::MAX / MICROS_PER_DAY + 1).num_microseconds(), None); + assert_eq!(Duration::days(i64::MIN / MICROS_PER_DAY - 1).num_microseconds(), None); + } + + #[test] + fn test_duration_num_nanoseconds() { + assert_eq!(Duration::zero().num_nanoseconds(), Some(0)); + assert_eq!(Duration::nanoseconds(1).num_nanoseconds(), Some(1)); + assert_eq!(Duration::nanoseconds(-1).num_nanoseconds(), Some(-1)); + assert_eq!(Duration::nanoseconds(i64::MAX).num_nanoseconds(), Some(i64::MAX)); + assert_eq!(Duration::nanoseconds(i64::MIN).num_nanoseconds(), Some(i64::MIN)); + assert_eq!(MAX.num_nanoseconds(), None); + assert_eq!(MIN.num_nanoseconds(), None); + + // overflow checks + const NANOS_PER_DAY: i64 = 86400_000_000_000; + assert_eq!(Duration::days(i64::MAX / NANOS_PER_DAY).num_nanoseconds(), + Some(i64::MAX / NANOS_PER_DAY * NANOS_PER_DAY)); + assert_eq!(Duration::days(i64::MIN / NANOS_PER_DAY).num_nanoseconds(), + Some(i64::MIN / NANOS_PER_DAY * NANOS_PER_DAY)); + assert_eq!(Duration::days(i64::MAX / NANOS_PER_DAY + 1).num_nanoseconds(), None); + assert_eq!(Duration::days(i64::MIN / NANOS_PER_DAY - 1).num_nanoseconds(), None); + } + + #[test] + fn test_duration_checked_ops() { + assert_eq!(Duration::milliseconds(i64::MAX - 1).checked_add(&Duration::microseconds(999)), + Some(Duration::milliseconds(i64::MAX - 2) + Duration::microseconds(1999))); + assert!(Duration::milliseconds(i64::MAX).checked_add(&Duration::microseconds(1000)) + .is_none()); + + assert_eq!(Duration::milliseconds(i64::MIN).checked_sub(&Duration::milliseconds(0)), + Some(Duration::milliseconds(i64::MIN))); + assert!(Duration::milliseconds(i64::MIN).checked_sub(&Duration::milliseconds(1)) + .is_none()); + } + + #[test] + fn test_duration_mul() { + assert_eq!(Duration::zero() * i32::MAX, Duration::zero()); + assert_eq!(Duration::zero() * i32::MIN, Duration::zero()); + assert_eq!(Duration::nanoseconds(1) * 0, Duration::zero()); + assert_eq!(Duration::nanoseconds(1) * 1, Duration::nanoseconds(1)); + assert_eq!(Duration::nanoseconds(1) * 1_000_000_000, Duration::seconds(1)); + assert_eq!(Duration::nanoseconds(1) * -1_000_000_000, -Duration::seconds(1)); + assert_eq!(-Duration::nanoseconds(1) * 1_000_000_000, -Duration::seconds(1)); + assert_eq!(Duration::nanoseconds(30) * 333_333_333, + Duration::seconds(10) - Duration::nanoseconds(10)); + assert_eq!((Duration::nanoseconds(1) + Duration::seconds(1) + Duration::days(1)) * 3, + Duration::nanoseconds(3) + Duration::seconds(3) + Duration::days(3)); + assert_eq!(Duration::milliseconds(1500) * -2, Duration::seconds(-3)); + assert_eq!(Duration::milliseconds(-1500) * 2, Duration::seconds(-3)); + } + + #[test] + fn test_duration_div() { + assert_eq!(Duration::zero() / i32::MAX, Duration::zero()); + assert_eq!(Duration::zero() / i32::MIN, Duration::zero()); + assert_eq!(Duration::nanoseconds(123_456_789) / 1, Duration::nanoseconds(123_456_789)); + assert_eq!(Duration::nanoseconds(123_456_789) / -1, -Duration::nanoseconds(123_456_789)); + assert_eq!(-Duration::nanoseconds(123_456_789) / -1, Duration::nanoseconds(123_456_789)); + assert_eq!(-Duration::nanoseconds(123_456_789) / 1, -Duration::nanoseconds(123_456_789)); + assert_eq!(Duration::seconds(1) / 3, Duration::nanoseconds(333_333_333)); + assert_eq!(Duration::seconds(4) / 3, Duration::nanoseconds(1_333_333_333)); + assert_eq!(Duration::seconds(-1) / 2, Duration::milliseconds(-500)); + assert_eq!(Duration::seconds(1) / -2, Duration::milliseconds(-500)); + assert_eq!(Duration::seconds(-1) / -2, Duration::milliseconds(500)); + assert_eq!(Duration::seconds(-4) / 3, Duration::nanoseconds(-1_333_333_333)); + assert_eq!(Duration::seconds(-4) / -3, Duration::nanoseconds(1_333_333_333)); + } + + #[test] + fn test_duration_fmt() { + assert_eq!(Duration::zero().to_string(), "PT0S"); + assert_eq!(Duration::days(42).to_string(), "P42D"); + assert_eq!(Duration::days(-42).to_string(), "-P42D"); + assert_eq!(Duration::seconds(42).to_string(), "PT42S"); + assert_eq!(Duration::milliseconds(42).to_string(), "PT0.042S"); + assert_eq!(Duration::microseconds(42).to_string(), "PT0.000042S"); + assert_eq!(Duration::nanoseconds(42).to_string(), "PT0.000000042S"); + assert_eq!((Duration::days(7) + Duration::milliseconds(6543)).to_string(), + "P7DT6.543S"); + assert_eq!(Duration::seconds(-86401).to_string(), "-P1DT1S"); + assert_eq!(Duration::nanoseconds(-1).to_string(), "-PT0.000000001S"); + + // the format specifier should have no effect on `Duration` + assert_eq!(format!("{:30}", Duration::days(1) + Duration::milliseconds(2345)), + "P1DT2.345S"); + } + + #[test] + fn test_to_std() { + assert_eq!(Duration::seconds(1).to_std(), Ok(StdDuration::new(1, 0))); + assert_eq!(Duration::seconds(86401).to_std(), Ok(StdDuration::new(86401, 0))); + assert_eq!(Duration::milliseconds(123).to_std(), Ok(StdDuration::new(0, 123000000))); + assert_eq!(Duration::milliseconds(123765).to_std(), Ok(StdDuration::new(123, 765000000))); + assert_eq!(Duration::nanoseconds(777).to_std(), Ok(StdDuration::new(0, 777))); + assert_eq!(MAX.to_std(), Ok(StdDuration::new(9223372036854775, 807000000))); + assert_eq!(Duration::seconds(-1).to_std(), + Err(OutOfRangeError(()))); + assert_eq!(Duration::milliseconds(-1).to_std(), + Err(OutOfRangeError(()))); + } + + #[test] + fn test_from_std() { + assert_eq!(Ok(Duration::seconds(1)), + Duration::from_std(StdDuration::new(1, 0))); + assert_eq!(Ok(Duration::seconds(86401)), + Duration::from_std(StdDuration::new(86401, 0))); + assert_eq!(Ok(Duration::milliseconds(123)), + Duration::from_std(StdDuration::new(0, 123000000))); + assert_eq!(Ok(Duration::milliseconds(123765)), + Duration::from_std(StdDuration::new(123, 765000000))); + assert_eq!(Ok(Duration::nanoseconds(777)), + Duration::from_std(StdDuration::new(0, 777))); + assert_eq!(Ok(MAX), + Duration::from_std(StdDuration::new(9223372036854775, 807000000))); + assert_eq!(Duration::from_std(StdDuration::new(9223372036854776, 0)), + Err(OutOfRangeError(()))); + assert_eq!(Duration::from_std(StdDuration::new(9223372036854775, 807000001)), + Err(OutOfRangeError(()))); + } +} diff --git a/third_party/rust/time/src/lib.rs b/third_party/rust/time/src/lib.rs new file mode 100644 index 000000000000..60a7923c1b73 --- /dev/null +++ b/third_party/rust/time/src/lib.rs @@ -0,0 +1,1277 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Simple time handling. +//! +//! # Usage +//! +//! This crate is [on crates.io](https://crates.io/crates/time) and can be +//! used by adding `time` to the dependencies in your project's `Cargo.toml`. +//! +//! ```toml +//! [dependencies] +//! time = "0.1" +//! ``` +//! +//! And this in your crate root: +//! +//! ```rust +//! extern crate time; +//! ``` +//! +//! This crate uses the same syntax for format strings as the [strftime()] +//! (http://man7.org/linux/man-pages/man3/strftime.3.html) function from the C +//! standard library. + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/time/")] +#![allow(trivial_numeric_casts)] +#![cfg_attr(test, deny(warnings))] + +#[cfg(target_os = "redox")] extern crate syscall; +#[cfg(unix)] extern crate libc; +#[cfg(windows)] extern crate kernel32; +#[cfg(windows)] extern crate winapi; +#[cfg(feature = "rustc-serialize")] extern crate rustc_serialize; + +#[cfg(test)] #[macro_use] extern crate log; +#[cfg(all(windows, test))] extern crate advapi32; + +use std::cmp::Ordering; +use std::error::Error; +use std::fmt; +use std::ops::{Add, Sub}; + +pub use duration::{Duration, OutOfRangeError}; + +use self::ParseError::{InvalidDay, InvalidDayOfMonth, InvalidDayOfWeek, + InvalidDayOfYear, InvalidFormatSpecifier, InvalidHour, + InvalidMinute, InvalidMonth, InvalidSecond, InvalidTime, + InvalidYear, InvalidZoneOffset, InvalidSecondsSinceEpoch, + MissingFormatConverter, UnexpectedCharacter}; + +pub use parse::strptime; + +mod display; +mod duration; +mod parse; +mod sys; + +static NSEC_PER_SEC: i32 = 1_000_000_000; + +/// A record specifying a time value in seconds and nanoseconds, where +/// nanoseconds represent the offset from the given second. +/// +/// For example a timespec of 1.2 seconds after the beginning of the epoch would +/// be represented as {sec: 1, nsec: 200000000}. +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] +#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] +pub struct Timespec { pub sec: i64, pub nsec: i32 } +/* + * Timespec assumes that pre-epoch Timespecs have negative sec and positive + * nsec fields. Darwin's and Linux's struct timespec functions handle pre- + * epoch timestamps using a "two steps back, one step forward" representation, + * though the man pages do not actually document this. For example, the time + * -1.2 seconds before the epoch is represented by `Timespec { sec: -2_i64, + * nsec: 800_000_000 }`. + */ +impl Timespec { + pub fn new(sec: i64, nsec: i32) -> Timespec { + assert!(nsec >= 0 && nsec < NSEC_PER_SEC); + Timespec { sec: sec, nsec: nsec } + } +} + +impl Add for Timespec { + type Output = Timespec; + + fn add(self, other: Duration) -> Timespec { + let d_sec = other.num_seconds(); + // It is safe to unwrap the nanoseconds, because there cannot be + // more than one second left, which fits in i64 and in i32. + let d_nsec = (other - Duration::seconds(d_sec)) + .num_nanoseconds().unwrap() as i32; + let mut sec = self.sec + d_sec; + let mut nsec = self.nsec + d_nsec; + if nsec >= NSEC_PER_SEC { + nsec -= NSEC_PER_SEC; + sec += 1; + } else if nsec < 0 { + nsec += NSEC_PER_SEC; + sec -= 1; + } + Timespec::new(sec, nsec) + } +} + +impl Sub for Timespec { + type Output = Timespec; + + fn sub(self, other: Duration) -> Timespec { + let d_sec = other.num_seconds(); + // It is safe to unwrap the nanoseconds, because there cannot be + // more than one second left, which fits in i64 and in i32. + let d_nsec = (other - Duration::seconds(d_sec)) + .num_nanoseconds().unwrap() as i32; + let mut sec = self.sec - d_sec; + let mut nsec = self.nsec - d_nsec; + if nsec >= NSEC_PER_SEC { + nsec -= NSEC_PER_SEC; + sec += 1; + } else if nsec < 0 { + nsec += NSEC_PER_SEC; + sec -= 1; + } + Timespec::new(sec, nsec) + } +} + +impl Sub for Timespec { + type Output = Duration; + + fn sub(self, other: Timespec) -> Duration { + let sec = self.sec - other.sec; + let nsec = self.nsec - other.nsec; + Duration::seconds(sec) + Duration::nanoseconds(nsec as i64) + } +} + +/** + * Returns the current time as a `timespec` containing the seconds and + * nanoseconds since 1970-01-01T00:00:00Z. + */ +pub fn get_time() -> Timespec { + let (sec, nsec) = sys::get_time(); + Timespec::new(sec, nsec) +} + + +/** + * Returns the current value of a high-resolution performance counter + * in nanoseconds since an unspecified epoch. + */ +pub fn precise_time_ns() -> u64 { + sys::get_precise_ns() +} + + +/** + * Returns the current value of a high-resolution performance counter + * in seconds since an unspecified epoch. + */ +pub fn precise_time_s() -> f64 { + return (precise_time_ns() as f64) / 1000000000.; +} + +/// An opaque structure representing a moment in time. +/// +/// The only operation that can be performed on a `PreciseTime` is the +/// calculation of the `Duration` of time that lies between them. +/// +/// # Examples +/// +/// Repeatedly call a function for 1 second: +/// +/// ```rust +/// use time::{Duration, PreciseTime}; +/// # fn do_some_work() {} +/// +/// let start = PreciseTime::now(); +/// +/// while start.to(PreciseTime::now()) < Duration::seconds(1) { +/// do_some_work(); +/// } +/// ``` +#[derive(Copy, Clone)] +pub struct PreciseTime(u64); + +impl PreciseTime { + /// Returns a `PreciseTime` representing the current moment in time. + pub fn now() -> PreciseTime { + PreciseTime(precise_time_ns()) + } + + /// Returns a `Duration` representing the span of time from the value of + /// `self` to the value of `later`. + /// + /// # Notes + /// + /// If `later` represents a time before `self`, the result of this method + /// is unspecified. + /// + /// If `later` represents a time more than 293 years after `self`, the + /// result of this method is unspecified. + #[inline] + pub fn to(&self, later: PreciseTime) -> Duration { + // NB: even if later is less than self due to overflow, this will work + // since the subtraction will underflow properly as well. + // + // We could deal with the overflow when casting to an i64, but all that + // gets us is the ability to handle intervals of up to 584 years, which + // seems not very useful :) + Duration::nanoseconds((later.0 - self.0) as i64) + } +} + +/// A structure representing a moment in time. +/// +/// `SteadyTime`s are generated by a "steady" clock, that is, a clock which +/// never experiences discontinuous jumps and for which time always flows at +/// the same rate. +/// +/// # Examples +/// +/// Repeatedly call a function for 1 second: +/// +/// ```rust +/// # use time::{Duration, SteadyTime}; +/// # fn do_some_work() {} +/// let start = SteadyTime::now(); +/// +/// while SteadyTime::now() - start < Duration::seconds(1) { +/// do_some_work(); +/// } +/// ``` +#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug)] +pub struct SteadyTime(sys::SteadyTime); + +impl SteadyTime { + /// Returns a `SteadyTime` representing the current moment in time. + pub fn now() -> SteadyTime { + SteadyTime(sys::SteadyTime::now()) + } +} + +impl fmt::Display for SteadyTime { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + // TODO: needs a display customization + fmt::Debug::fmt(self, fmt) + } +} + +impl Sub for SteadyTime { + type Output = Duration; + + fn sub(self, other: SteadyTime) -> Duration { + self.0 - other.0 + } +} + +impl Sub for SteadyTime { + type Output = SteadyTime; + + fn sub(self, other: Duration) -> SteadyTime { + SteadyTime(self.0 - other) + } +} + +impl Add for SteadyTime { + type Output = SteadyTime; + + fn add(self, other: Duration) -> SteadyTime { + SteadyTime(self.0 + other) + } +} + +#[cfg(not(windows))] +pub fn tzset() { + extern { fn tzset(); } + unsafe { tzset() } +} + + +#[cfg(windows)] +pub fn tzset() {} + +/// Holds a calendar date and time broken down into its components (year, month, +/// day, and so on), also called a broken-down time value. +// FIXME: use c_int instead of i32? +#[repr(C)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] +#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] +pub struct Tm { + /// Seconds after the minute - [0, 60] + pub tm_sec: i32, + + /// Minutes after the hour - [0, 59] + pub tm_min: i32, + + /// Hours after midnight - [0, 23] + pub tm_hour: i32, + + /// Day of the month - [1, 31] + pub tm_mday: i32, + + /// Months since January - [0, 11] + pub tm_mon: i32, + + /// Years since 1900 + pub tm_year: i32, + + /// Days since Sunday - [0, 6]. 0 = Sunday, 1 = Monday, ..., 6 = Saturday. + pub tm_wday: i32, + + /// Days since January 1 - [0, 365] + pub tm_yday: i32, + + /// Daylight Saving Time flag. + /// + /// This value is positive if Daylight Saving Time is in effect, zero if + /// Daylight Saving Time is not in effect, and negative if this information + /// is not available. + pub tm_isdst: i32, + + /// Identifies the time zone that was used to compute this broken-down time + /// value, including any adjustment for Daylight Saving Time. This is the + /// number of seconds east of UTC. For example, for U.S. Pacific Daylight + /// Time, the value is -7*60*60 = -25200. + pub tm_utcoff: i32, + + /// Nanoseconds after the second - [0, 109 - 1] + pub tm_nsec: i32, +} + +impl Add for Tm { + type Output = Tm; + + /// The resulting Tm is in UTC. + // FIXME: The resulting Tm should have the same timezone as `self`; + // however, we need a function such as `at_tm(clock: Timespec, offset: i32)` + // for this. + fn add(self, other: Duration) -> Tm { + at_utc(self.to_timespec() + other) + } +} + +impl Sub for Tm { + type Output = Tm; + + /// The resulting Tm is in UTC. + // FIXME: The resulting Tm should have the same timezone as `self`; + // however, we need a function such as `at_tm(clock: Timespec, offset: i32)` + // for this. + fn sub(self, other: Duration) -> Tm { + at_utc(self.to_timespec() - other) + } +} + +impl Sub for Tm { + type Output = Duration; + + fn sub(self, other: Tm) -> Duration { + self.to_timespec() - other.to_timespec() + } +} + +impl PartialOrd for Tm { + fn partial_cmp(&self, other: &Tm) -> Option { + self.to_timespec().partial_cmp(&other.to_timespec()) + } +} + +impl Ord for Tm { + fn cmp(&self, other: &Tm) -> Ordering { + self.to_timespec().cmp(&other.to_timespec()) + } +} + +pub fn empty_tm() -> Tm { + Tm { + tm_sec: 0, + tm_min: 0, + tm_hour: 0, + tm_mday: 0, + tm_mon: 0, + tm_year: 0, + tm_wday: 0, + tm_yday: 0, + tm_isdst: 0, + tm_utcoff: 0, + tm_nsec: 0, + } +} + +/// Returns the specified time in UTC +pub fn at_utc(clock: Timespec) -> Tm { + let Timespec { sec, nsec } = clock; + let mut tm = empty_tm(); + sys::time_to_utc_tm(sec, &mut tm); + tm.tm_nsec = nsec; + tm +} + +/// Returns the current time in UTC +pub fn now_utc() -> Tm { + at_utc(get_time()) +} + +/// Returns the specified time in the local timezone +pub fn at(clock: Timespec) -> Tm { + let Timespec { sec, nsec } = clock; + let mut tm = empty_tm(); + sys::time_to_local_tm(sec, &mut tm); + tm.tm_nsec = nsec; + tm +} + +/// Returns the current time in the local timezone +pub fn now() -> Tm { + at(get_time()) +} + +impl Tm { + /// Convert time to the seconds from January 1, 1970 + pub fn to_timespec(&self) -> Timespec { + let sec = match self.tm_utcoff { + 0 => sys::utc_tm_to_time(self), + _ => sys::local_tm_to_time(self) + }; + + Timespec::new(sec, self.tm_nsec) + } + + /// Convert time to the local timezone + pub fn to_local(&self) -> Tm { + at(self.to_timespec()) + } + + /// Convert time to the UTC + pub fn to_utc(&self) -> Tm { + match self.tm_utcoff { + 0 => *self, + _ => at_utc(self.to_timespec()) + } + } + + /** + * Returns a TmFmt that outputs according to the `asctime` format in ISO + * C, in the local timezone. + * + * Example: "Thu Jan 1 00:00:00 1970" + */ + pub fn ctime(&self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Ctime, + } + } + + /** + * Returns a TmFmt that outputs according to the `asctime` format in ISO + * C. + * + * Example: "Thu Jan 1 00:00:00 1970" + */ + pub fn asctime(&self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Str("%c"), + } + } + + /// Formats the time according to the format string. + pub fn strftime<'a>(&'a self, format: &'a str) -> Result, ParseError> { + validate_format(TmFmt { + tm: self, + format: Fmt::Str(format), + }) + } + + /** + * Returns a TmFmt that outputs according to RFC 822. + * + * local: "Thu, 22 Mar 2012 07:53:18 PST" + * utc: "Thu, 22 Mar 2012 14:53:18 GMT" + */ + pub fn rfc822(&self) -> TmFmt { + let fmt = if self.tm_utcoff == 0 { + "%a, %d %b %Y %T GMT" + } else { + "%a, %d %b %Y %T %Z" + }; + TmFmt { + tm: self, + format: Fmt::Str(fmt), + } + } + + /** + * Returns a TmFmt that outputs according to RFC 822 with Zulu time. + * + * local: "Thu, 22 Mar 2012 07:53:18 -0700" + * utc: "Thu, 22 Mar 2012 14:53:18 -0000" + */ + pub fn rfc822z(&self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Str("%a, %d %b %Y %T %z"), + } + } + + /** + * Returns a TmFmt that outputs according to RFC 3339. RFC 3339 is + * compatible with ISO 8601. + * + * local: "2012-02-22T07:53:18-07:00" + * utc: "2012-02-22T14:53:18Z" + */ + pub fn rfc3339<'a>(&'a self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Rfc3339, + } + } +} + +#[derive(Copy, PartialEq, Debug, Clone)] +pub enum ParseError { + InvalidSecond, + InvalidMinute, + InvalidHour, + InvalidDay, + InvalidMonth, + InvalidYear, + InvalidDayOfWeek, + InvalidDayOfMonth, + InvalidDayOfYear, + InvalidZoneOffset, + InvalidTime, + InvalidSecondsSinceEpoch, + MissingFormatConverter, + InvalidFormatSpecifier(char), + UnexpectedCharacter(char, char), +} + +impl fmt::Display for ParseError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + InvalidFormatSpecifier(ch) => { + write!(f, "{}: %{}", self.description(), ch) + } + UnexpectedCharacter(a, b) => { + write!(f, "expected: `{}`, found: `{}`", a, b) + } + _ => write!(f, "{}", self.description()) + } + } +} + +impl Error for ParseError { + fn description(&self) -> &str { + match *self { + InvalidSecond => "Invalid second.", + InvalidMinute => "Invalid minute.", + InvalidHour => "Invalid hour.", + InvalidDay => "Invalid day.", + InvalidMonth => "Invalid month.", + InvalidYear => "Invalid year.", + InvalidDayOfWeek => "Invalid day of the week.", + InvalidDayOfMonth => "Invalid day of the month.", + InvalidDayOfYear => "Invalid day of the year.", + InvalidZoneOffset => "Invalid zone offset.", + InvalidTime => "Invalid time.", + InvalidSecondsSinceEpoch => "Invalid seconds since epoch.", + MissingFormatConverter => "missing format converter after `%`", + InvalidFormatSpecifier(..) => "invalid format specifier", + UnexpectedCharacter(..) => "Unexpected character.", + } + } +} + +/// A wrapper around a `Tm` and format string that implements Display. +#[derive(Debug)] +pub struct TmFmt<'a> { + tm: &'a Tm, + format: Fmt<'a> +} + +#[derive(Debug)] +enum Fmt<'a> { + Str(&'a str), + Rfc3339, + Ctime, +} + +fn validate_format<'a>(fmt: TmFmt<'a>) -> Result, ParseError> { + + match (fmt.tm.tm_wday, fmt.tm.tm_mon) { + (0...6, 0...11) => (), + (_wday, 0...11) => return Err(InvalidDayOfWeek), + (0...6, _mon) => return Err(InvalidMonth), + _ => return Err(InvalidDay) + } + match fmt.format { + Fmt::Str(ref s) => { + let mut chars = s.chars(); + loop { + match chars.next() { + Some('%') => { + match chars.next() { + Some('A') | Some('a') | Some('B') | Some('b') | + Some('C') | Some('c') | Some('D') | Some('d') | + Some('e') | Some('F') | Some('f') | Some('G') | + Some('g') | Some('H') | Some('h') | Some('I') | + Some('j') | Some('k') | Some('l') | Some('M') | + Some('m') | Some('n') | Some('P') | Some('p') | + Some('R') | Some('r') | Some('S') | Some('s') | + Some('T') | Some('t') | Some('U') | Some('u') | + Some('V') | Some('v') | Some('W') | Some('w') | + Some('X') | Some('x') | Some('Y') | Some('y') | + Some('Z') | Some('z') | Some('+') | Some('%') => (), + + Some(c) => return Err(InvalidFormatSpecifier(c)), + None => return Err(MissingFormatConverter), + } + }, + None => break, + _ => () + } + } + }, + _ => () + } + Ok(fmt) +} + +/// Formats the time according to the format string. +pub fn strftime(format: &str, tm: &Tm) -> Result { + tm.strftime(format).map(|fmt| fmt.to_string()) +} + +#[cfg(test)] +mod tests { + use super::{Timespec, get_time, precise_time_ns, precise_time_s, + at_utc, at, strptime, PreciseTime, SteadyTime, ParseError, Duration}; + use super::ParseError::{InvalidTime, InvalidYear, MissingFormatConverter, + InvalidFormatSpecifier}; + + use std::sync::{Once, ONCE_INIT, Mutex, MutexGuard, LockResult}; + use std::mem; + + struct TzReset { + _tzreset: ::sys::TzReset, + _lock: LockResult>, + } + + fn set_time_zone_la_or_london(london: bool) -> TzReset { + // Lock manages current timezone because some tests require LA some + // London + static mut LOCK: *mut Mutex<()> = 0 as *mut _; + static INIT: Once = ONCE_INIT; + + unsafe { + INIT.call_once(|| { + LOCK = mem::transmute(Box::new(Mutex::new(()))); + }); + + let timezone_lock = (*LOCK).lock(); + let reset_func = if london { + ::sys::set_london_with_dst_time_zone() + } else { + ::sys::set_los_angeles_time_zone() + }; + TzReset { + _lock: timezone_lock, + _tzreset: reset_func, + } + } + } + + fn set_time_zone() -> TzReset { + set_time_zone_la_or_london(false) + } + + fn set_time_zone_london_dst() -> TzReset { + set_time_zone_la_or_london(true) + } + + #[test] + fn test_get_time() { + static SOME_RECENT_DATE: i64 = 1325376000i64; // 2012-01-01T00:00:00Z + static SOME_FUTURE_DATE: i64 = 1577836800i64; // 2020-01-01T00:00:00Z + + let tv1 = get_time(); + debug!("tv1={} sec + {} nsec", tv1.sec, tv1.nsec); + + assert!(tv1.sec > SOME_RECENT_DATE); + assert!(tv1.nsec < 1000000000i32); + + let tv2 = get_time(); + debug!("tv2={} sec + {} nsec", tv2.sec, tv2.nsec); + + assert!(tv2.sec >= tv1.sec); + assert!(tv2.sec < SOME_FUTURE_DATE); + assert!(tv2.nsec < 1000000000i32); + if tv2.sec == tv1.sec { + assert!(tv2.nsec >= tv1.nsec); + } + } + + #[test] + fn test_precise_time() { + let s0 = precise_time_s(); + debug!("s0={} sec", s0); + assert!(s0 > 0.); + + let ns0 = precise_time_ns(); + let ns1 = precise_time_ns(); + debug!("ns0={} ns", ns0); + debug!("ns1={} ns", ns1); + assert!(ns1 >= ns0); + + let ns2 = precise_time_ns(); + debug!("ns2={} ns", ns2); + assert!(ns2 >= ns1); + } + + #[test] + fn test_precise_time_to() { + let t0 = PreciseTime(1000); + let t1 = PreciseTime(1023); + assert_eq!(Duration::nanoseconds(23), t0.to(t1)); + } + + #[test] + fn test_at_utc() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + + assert_eq!(utc.tm_sec, 30); + assert_eq!(utc.tm_min, 31); + assert_eq!(utc.tm_hour, 23); + assert_eq!(utc.tm_mday, 13); + assert_eq!(utc.tm_mon, 1); + assert_eq!(utc.tm_year, 109); + assert_eq!(utc.tm_wday, 5); + assert_eq!(utc.tm_yday, 43); + assert_eq!(utc.tm_isdst, 0); + assert_eq!(utc.tm_utcoff, 0); + assert_eq!(utc.tm_nsec, 54321); + } + + #[test] + fn test_at() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let local = at(time); + + debug!("time_at: {:?}", local); + + assert_eq!(local.tm_sec, 30); + assert_eq!(local.tm_min, 31); + assert_eq!(local.tm_hour, 15); + assert_eq!(local.tm_mday, 13); + assert_eq!(local.tm_mon, 1); + assert_eq!(local.tm_year, 109); + assert_eq!(local.tm_wday, 5); + assert_eq!(local.tm_yday, 43); + assert_eq!(local.tm_isdst, 0); + assert_eq!(local.tm_utcoff, -28800); + assert_eq!(local.tm_nsec, 54321); + } + + #[test] + fn test_to_timespec() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + + assert_eq!(utc.to_timespec(), time); + assert_eq!(utc.to_local().to_timespec(), time); + } + + #[test] + fn test_conversions() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + assert!(local.to_local() == local); + assert!(local.to_utc() == utc); + assert!(local.to_utc().to_local() == local); + assert!(utc.to_utc() == utc); + assert!(utc.to_local() == local); + assert!(utc.to_local().to_utc() == utc); + } + + #[test] + fn test_strptime() { + let _reset = set_time_zone(); + + match strptime("", "") { + Ok(ref tm) => { + assert!(tm.tm_sec == 0); + assert!(tm.tm_min == 0); + assert!(tm.tm_hour == 0); + assert!(tm.tm_mday == 0); + assert!(tm.tm_mon == 0); + assert!(tm.tm_year == 0); + assert!(tm.tm_wday == 0); + assert!(tm.tm_isdst == 0); + assert!(tm.tm_utcoff == 0); + assert!(tm.tm_nsec == 0); + } + Err(_) => () + } + + let format = "%a %b %e %T.%f %Y"; + assert_eq!(strptime("", format), Err(ParseError::InvalidDay)); + assert_eq!(strptime("Fri Feb 13 15:31:30", format), + Err(InvalidTime)); + + match strptime("Fri Feb 13 15:31:30.01234 2009", format) { + Err(e) => panic!("{}", e), + Ok(ref tm) => { + assert_eq!(tm.tm_sec, 30); + assert_eq!(tm.tm_min, 31); + assert_eq!(tm.tm_hour, 15); + assert_eq!(tm.tm_mday, 13); + assert_eq!(tm.tm_mon, 1); + assert_eq!(tm.tm_year, 109); + assert_eq!(tm.tm_wday, 5); + assert_eq!(tm.tm_yday, 0); + assert_eq!(tm.tm_isdst, 0); + assert_eq!(tm.tm_utcoff, 0); + assert_eq!(tm.tm_nsec, 12340000); + } + } + + fn test(s: &str, format: &str) -> bool { + match strptime(s, format) { + Ok(tm) => { + tm.strftime(format).unwrap().to_string() == s.to_string() + }, + Err(e) => panic!("{:?}, s={:?}, format={:?}", e, s, format) + } + } + + fn test_oneway(s : &str, format : &str) -> bool { + match strptime(s, format) { + Ok(_) => { + // oneway tests are used when reformatting the parsed Tm + // back into a string can generate a different string + // from the original (i.e. leading zeroes) + true + }, + Err(e) => panic!("{:?}, s={:?}, format={:?}", e, s, format) + } + } + + let days = [ + "Sunday".to_string(), + "Monday".to_string(), + "Tuesday".to_string(), + "Wednesday".to_string(), + "Thursday".to_string(), + "Friday".to_string(), + "Saturday".to_string() + ]; + for day in days.iter() { + assert!(test(&day, "%A")); + } + + let days = [ + "Sun".to_string(), + "Mon".to_string(), + "Tue".to_string(), + "Wed".to_string(), + "Thu".to_string(), + "Fri".to_string(), + "Sat".to_string() + ]; + for day in days.iter() { + assert!(test(&day, "%a")); + } + + let months = [ + "January".to_string(), + "February".to_string(), + "March".to_string(), + "April".to_string(), + "May".to_string(), + "June".to_string(), + "July".to_string(), + "August".to_string(), + "September".to_string(), + "October".to_string(), + "November".to_string(), + "December".to_string() + ]; + for day in months.iter() { + assert!(test(&day, "%B")); + } + + let months = [ + "Jan".to_string(), + "Feb".to_string(), + "Mar".to_string(), + "Apr".to_string(), + "May".to_string(), + "Jun".to_string(), + "Jul".to_string(), + "Aug".to_string(), + "Sep".to_string(), + "Oct".to_string(), + "Nov".to_string(), + "Dec".to_string() + ]; + for day in months.iter() { + assert!(test(&day, "%b")); + } + + assert!(test("19", "%C")); + assert!(test("Fri Feb 3 23:31:30 2009", "%c")); + assert!(test("Fri Feb 13 23:31:30 2009", "%c")); + assert!(test("02/13/09", "%D")); + assert!(test("03", "%d")); + assert!(test("13", "%d")); + assert!(test(" 3", "%e")); + assert!(test("13", "%e")); + assert!(test("2009-02-13", "%F")); + assert!(test("03", "%H")); + assert!(test("13", "%H")); + assert!(test("03", "%I")); // FIXME (#2350): flesh out + assert!(test("11", "%I")); // FIXME (#2350): flesh out + assert!(test("044", "%j")); + assert!(test(" 3", "%k")); + assert!(test("13", "%k")); + assert!(test(" 1", "%l")); + assert!(test("11", "%l")); + assert!(test("03", "%M")); + assert!(test("13", "%M")); + assert!(test("\n", "%n")); + assert!(test("am", "%P")); + assert!(test("pm", "%P")); + assert!(test("AM", "%p")); + assert!(test("PM", "%p")); + assert!(test("23:31", "%R")); + assert!(test("11:31:30 AM", "%r")); + assert!(test("11:31:30 PM", "%r")); + assert!(test("03", "%S")); + assert!(test("13", "%S")); + assert!(test("15:31:30", "%T")); + assert!(test("\t", "%t")); + assert!(test("1", "%u")); + assert!(test("7", "%u")); + assert!(test("13-Feb-2009", "%v")); + assert!(test("0", "%w")); + assert!(test("6", "%w")); + assert!(test("2009", "%Y")); + assert!(test("09", "%y")); + + assert!(test_oneway("3", "%d")); + assert!(test_oneway("3", "%H")); + assert!(test_oneway("3", "%e")); + assert!(test_oneway("3", "%M")); + assert!(test_oneway("3", "%S")); + + assert!(strptime("-0000", "%z").unwrap().tm_utcoff == 0); + assert!(strptime("-00:00", "%z").unwrap().tm_utcoff == 0); + assert!(strptime("Z", "%z").unwrap().tm_utcoff == 0); + assert_eq!(-28800, strptime("-0800", "%z").unwrap().tm_utcoff); + assert_eq!(-28800, strptime("-08:00", "%z").unwrap().tm_utcoff); + assert_eq!(28800, strptime("+0800", "%z").unwrap().tm_utcoff); + assert_eq!(28800, strptime("+08:00", "%z").unwrap().tm_utcoff); + assert_eq!(5400, strptime("+0130", "%z").unwrap().tm_utcoff); + assert_eq!(5400, strptime("+01:30", "%z").unwrap().tm_utcoff); + assert!(test("%", "%%")); + + // Test for #7256 + assert_eq!(strptime("360", "%Y-%m-%d"), Err(InvalidYear)); + + // Test for epoch seconds parsing + { + assert!(test("1428035610", "%s")); + let tm = strptime("1428035610", "%s").unwrap(); + assert_eq!(tm.tm_utcoff, 0); + assert_eq!(tm.tm_isdst, 0); + assert_eq!(tm.tm_yday, 92); + assert_eq!(tm.tm_wday, 5); + assert_eq!(tm.tm_year, 115); + assert_eq!(tm.tm_mon, 3); + assert_eq!(tm.tm_mday, 3); + assert_eq!(tm.tm_hour, 4); + } + } + + #[test] + fn test_asctime() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + debug!("test_ctime: {} {}", utc.asctime(), local.asctime()); + + assert_eq!(utc.asctime().to_string(), "Fri Feb 13 23:31:30 2009".to_string()); + assert_eq!(local.asctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + } + + #[test] + fn test_ctime() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + debug!("test_ctime: {} {}", utc.ctime(), local.ctime()); + + assert_eq!(utc.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + } + + #[test] + fn test_strftime() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + assert_eq!(local.strftime("").unwrap().to_string(), "".to_string()); + assert_eq!(local.strftime("%A").unwrap().to_string(), "Friday".to_string()); + assert_eq!(local.strftime("%a").unwrap().to_string(), "Fri".to_string()); + assert_eq!(local.strftime("%B").unwrap().to_string(), "February".to_string()); + assert_eq!(local.strftime("%b").unwrap().to_string(), "Feb".to_string()); + assert_eq!(local.strftime("%C").unwrap().to_string(), "20".to_string()); + assert_eq!(local.strftime("%c").unwrap().to_string(), + "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.strftime("%D").unwrap().to_string(), "02/13/09".to_string()); + assert_eq!(local.strftime("%d").unwrap().to_string(), "13".to_string()); + assert_eq!(local.strftime("%e").unwrap().to_string(), "13".to_string()); + assert_eq!(local.strftime("%F").unwrap().to_string(), "2009-02-13".to_string()); + assert_eq!(local.strftime("%f").unwrap().to_string(), "000054321".to_string()); + assert_eq!(local.strftime("%G").unwrap().to_string(), "2009".to_string()); + assert_eq!(local.strftime("%g").unwrap().to_string(), "09".to_string()); + assert_eq!(local.strftime("%H").unwrap().to_string(), "15".to_string()); + assert_eq!(local.strftime("%h").unwrap().to_string(), "Feb".to_string()); + assert_eq!(local.strftime("%I").unwrap().to_string(), "03".to_string()); + assert_eq!(local.strftime("%j").unwrap().to_string(), "044".to_string()); + assert_eq!(local.strftime("%k").unwrap().to_string(), "15".to_string()); + assert_eq!(local.strftime("%l").unwrap().to_string(), " 3".to_string()); + assert_eq!(local.strftime("%M").unwrap().to_string(), "31".to_string()); + assert_eq!(local.strftime("%m").unwrap().to_string(), "02".to_string()); + assert_eq!(local.strftime("%n").unwrap().to_string(), "\n".to_string()); + assert_eq!(local.strftime("%P").unwrap().to_string(), "pm".to_string()); + assert_eq!(local.strftime("%p").unwrap().to_string(), "PM".to_string()); + assert_eq!(local.strftime("%R").unwrap().to_string(), "15:31".to_string()); + assert_eq!(local.strftime("%r").unwrap().to_string(), "03:31:30 PM".to_string()); + assert_eq!(local.strftime("%S").unwrap().to_string(), "30".to_string()); + assert_eq!(local.strftime("%s").unwrap().to_string(), "1234567890".to_string()); + assert_eq!(local.strftime("%T").unwrap().to_string(), "15:31:30".to_string()); + assert_eq!(local.strftime("%t").unwrap().to_string(), "\t".to_string()); + assert_eq!(local.strftime("%U").unwrap().to_string(), "06".to_string()); + assert_eq!(local.strftime("%u").unwrap().to_string(), "5".to_string()); + assert_eq!(local.strftime("%V").unwrap().to_string(), "07".to_string()); + assert_eq!(local.strftime("%v").unwrap().to_string(), "13-Feb-2009".to_string()); + assert_eq!(local.strftime("%W").unwrap().to_string(), "06".to_string()); + assert_eq!(local.strftime("%w").unwrap().to_string(), "5".to_string()); + // FIXME (#2350): support locale + assert_eq!(local.strftime("%X").unwrap().to_string(), "15:31:30".to_string()); + // FIXME (#2350): support locale + assert_eq!(local.strftime("%x").unwrap().to_string(), "02/13/09".to_string()); + assert_eq!(local.strftime("%Y").unwrap().to_string(), "2009".to_string()); + assert_eq!(local.strftime("%y").unwrap().to_string(), "09".to_string()); + // FIXME (#2350): support locale + assert_eq!(local.strftime("%Z").unwrap().to_string(), "".to_string()); + assert_eq!(local.strftime("%z").unwrap().to_string(), "-0800".to_string()); + assert_eq!(local.strftime("%+").unwrap().to_string(), + "2009-02-13T15:31:30-08:00".to_string()); + assert_eq!(local.strftime("%%").unwrap().to_string(), "%".to_string()); + + let invalid_specifiers = ["%E", "%J", "%K", "%L", "%N", "%O", "%o", "%Q", "%q"]; + for &sp in invalid_specifiers.iter() { + assert_eq!(local.strftime(sp).unwrap_err(), + InvalidFormatSpecifier(sp[1..].chars().next().unwrap())); + } + assert_eq!(local.strftime("%").unwrap_err(), MissingFormatConverter); + assert_eq!(local.strftime("%A %").unwrap_err(), MissingFormatConverter); + + assert_eq!(local.asctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.rfc822z().to_string(), "Fri, 13 Feb 2009 15:31:30 -0800".to_string()); + assert_eq!(local.rfc3339().to_string(), "2009-02-13T15:31:30-08:00".to_string()); + + assert_eq!(utc.asctime().to_string(), "Fri Feb 13 23:31:30 2009".to_string()); + assert_eq!(utc.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(utc.rfc822().to_string(), "Fri, 13 Feb 2009 23:31:30 GMT".to_string()); + assert_eq!(utc.rfc822z().to_string(), "Fri, 13 Feb 2009 23:31:30 -0000".to_string()); + assert_eq!(utc.rfc3339().to_string(), "2009-02-13T23:31:30Z".to_string()); + } + + #[test] + fn test_timespec_eq_ord() { + let a = &Timespec::new(-2, 1); + let b = &Timespec::new(-1, 2); + let c = &Timespec::new(1, 2); + let d = &Timespec::new(2, 1); + let e = &Timespec::new(2, 1); + + assert!(d.eq(e)); + assert!(c.ne(e)); + + assert!(a.lt(b)); + assert!(b.lt(c)); + assert!(c.lt(d)); + + assert!(a.le(b)); + assert!(b.le(c)); + assert!(c.le(d)); + assert!(d.le(e)); + assert!(e.le(d)); + + assert!(b.ge(a)); + assert!(c.ge(b)); + assert!(d.ge(c)); + assert!(e.ge(d)); + assert!(d.ge(e)); + + assert!(b.gt(a)); + assert!(c.gt(b)); + assert!(d.gt(c)); + } + + #[test] + #[allow(deprecated)] + fn test_timespec_hash() { + use std::hash::{Hash, Hasher}; + + let c = &Timespec::new(3, 2); + let d = &Timespec::new(2, 1); + let e = &Timespec::new(2, 1); + + let mut hasher = ::std::hash::SipHasher::new(); + + let d_hash:u64 = { + d.hash(&mut hasher); + hasher.finish() + }; + + hasher = ::std::hash::SipHasher::new(); + + let e_hash:u64 = { + e.hash(&mut hasher); + hasher.finish() + }; + + hasher = ::std::hash::SipHasher::new(); + + let c_hash:u64 = { + c.hash(&mut hasher); + hasher.finish() + }; + + assert_eq!(d_hash, e_hash); + assert!(c_hash != e_hash); + } + + #[test] + fn test_timespec_add() { + let a = Timespec::new(1, 2); + let b = Duration::seconds(2) + Duration::nanoseconds(3); + let c = a + b; + assert_eq!(c.sec, 3); + assert_eq!(c.nsec, 5); + + let p = Timespec::new(1, super::NSEC_PER_SEC - 2); + let q = Duration::seconds(2) + Duration::nanoseconds(2); + let r = p + q; + assert_eq!(r.sec, 4); + assert_eq!(r.nsec, 0); + + let u = Timespec::new(1, super::NSEC_PER_SEC - 2); + let v = Duration::seconds(2) + Duration::nanoseconds(3); + let w = u + v; + assert_eq!(w.sec, 4); + assert_eq!(w.nsec, 1); + + let k = Timespec::new(1, 0); + let l = Duration::nanoseconds(-1); + let m = k + l; + assert_eq!(m.sec, 0); + assert_eq!(m.nsec, 999_999_999); + } + + #[test] + fn test_timespec_sub() { + let a = Timespec::new(2, 3); + let b = Timespec::new(1, 2); + let c = a - b; + assert_eq!(c.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 + 1)); + + let p = Timespec::new(2, 0); + let q = Timespec::new(1, 2); + let r = p - q; + assert_eq!(r.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 - 2)); + + let u = Timespec::new(1, 2); + let v = Timespec::new(2, 3); + let w = u - v; + assert_eq!(w.num_nanoseconds(), Some(-super::NSEC_PER_SEC as i64 - 1)); + } + + #[test] + fn test_time_sub() { + let a = ::now(); + let b = at(a.to_timespec() + Duration::seconds(5)); + let c = b - a; + assert_eq!(c.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 * 5)); + } + + #[test] + fn test_steadytime_sub() { + let a = SteadyTime::now(); + let b = a + Duration::seconds(1); + assert_eq!(b - a, Duration::seconds(1)); + assert_eq!(a - b, Duration::seconds(-1)); + } + + #[test] + fn test_date_before_1970() { + let early = strptime("1901-01-06", "%F").unwrap(); + let late = strptime("2000-01-01", "%F").unwrap(); + assert!(early < late); + } + + #[test] + fn test_dst() { + let _reset = set_time_zone_london_dst(); + let utc_in_feb = strptime("2015-02-01Z", "%F%z").unwrap(); + let utc_in_jun = strptime("2015-06-01Z", "%F%z").unwrap(); + let utc_in_nov = strptime("2015-11-01Z", "%F%z").unwrap(); + let local_in_feb = utc_in_feb.to_local(); + let local_in_jun = utc_in_jun.to_local(); + let local_in_nov = utc_in_nov.to_local(); + + assert_eq!(local_in_feb.tm_mon, 1); + assert_eq!(local_in_feb.tm_hour, 0); + assert_eq!(local_in_feb.tm_utcoff, 0); + assert_eq!(local_in_feb.tm_isdst, 0); + + assert_eq!(local_in_jun.tm_mon, 5); + assert_eq!(local_in_jun.tm_hour, 1); + assert_eq!(local_in_jun.tm_utcoff, 3600); + assert_eq!(local_in_jun.tm_isdst, 1); + + assert_eq!(local_in_nov.tm_mon, 10); + assert_eq!(local_in_nov.tm_hour, 0); + assert_eq!(local_in_nov.tm_utcoff, 0); + assert_eq!(local_in_nov.tm_isdst, 0) + } +} diff --git a/third_party/rust/time/src/parse.rs b/third_party/rust/time/src/parse.rs new file mode 100644 index 000000000000..467c9be22dcf --- /dev/null +++ b/third_party/rust/time/src/parse.rs @@ -0,0 +1,394 @@ +use super::{Timespec, Tm, at_utc, ParseError, NSEC_PER_SEC}; + +/// Parses the time from the string according to the format string. +pub fn strptime(mut s: &str, format: &str) -> Result { + let mut tm = Tm { + tm_sec: 0, + tm_min: 0, + tm_hour: 0, + tm_mday: 0, + tm_mon: 0, + tm_year: 0, + tm_wday: 0, + tm_yday: 0, + tm_isdst: 0, + tm_utcoff: 0, + tm_nsec: 0, + }; + let mut chars = format.chars(); + + while let Some(ch) = chars.next() { + if ch == '%' { + if let Some(ch) = chars.next() { + try!(parse_type(&mut s, ch, &mut tm)); + } + } else { + try!(parse_char(&mut s, ch)); + } + } + + Ok(tm) +} + +fn parse_type(s: &mut &str, ch: char, tm: &mut Tm) -> Result<(), ParseError> { + match ch { + 'A' => match match_strs(s, &[("Sunday", 0), + ("Monday", 1), + ("Tuesday", 2), + ("Wednesday", 3), + ("Thursday", 4), + ("Friday", 5), + ("Saturday", 6)]) { + Some(v) => { tm.tm_wday = v; Ok(()) } + None => Err(ParseError::InvalidDay) + }, + 'a' => match match_strs(s, &[("Sun", 0), + ("Mon", 1), + ("Tue", 2), + ("Wed", 3), + ("Thu", 4), + ("Fri", 5), + ("Sat", 6)]) { + Some(v) => { tm.tm_wday = v; Ok(()) } + None => Err(ParseError::InvalidDay) + }, + 'B' => match match_strs(s, &[("January", 0), + ("February", 1), + ("March", 2), + ("April", 3), + ("May", 4), + ("June", 5), + ("July", 6), + ("August", 7), + ("September", 8), + ("October", 9), + ("November", 10), + ("December", 11)]) { + Some(v) => { tm.tm_mon = v; Ok(()) } + None => Err(ParseError::InvalidMonth) + }, + 'b' | 'h' => match match_strs(s, &[("Jan", 0), + ("Feb", 1), + ("Mar", 2), + ("Apr", 3), + ("May", 4), + ("Jun", 5), + ("Jul", 6), + ("Aug", 7), + ("Sep", 8), + ("Oct", 9), + ("Nov", 10), + ("Dec", 11)]) { + Some(v) => { tm.tm_mon = v; Ok(()) } + None => Err(ParseError::InvalidMonth) + }, + 'C' => match match_digits_in_range(s, 1, 2, false, 0, 99) { + Some(v) => { tm.tm_year += (v * 100) - 1900; Ok(()) } + None => Err(ParseError::InvalidYear) + }, + 'c' => { + parse_type(s, 'a', tm) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'b', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'e', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'T', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'Y', tm)) + } + 'D' | 'x' => { + parse_type(s, 'm', tm) + .and_then(|()| parse_char(s, '/')) + .and_then(|()| parse_type(s, 'd', tm)) + .and_then(|()| parse_char(s, '/')) + .and_then(|()| parse_type(s, 'y', tm)) + } + 'd' => match match_digits_in_range(s, 1, 2, false, 1, 31) { + Some(v) => { tm.tm_mday = v; Ok(()) } + None => Err(ParseError::InvalidDayOfMonth) + }, + 'e' => match match_digits_in_range(s, 1, 2, true, 1, 31) { + Some(v) => { tm.tm_mday = v; Ok(()) } + None => Err(ParseError::InvalidDayOfMonth) + }, + 'f' => { + tm.tm_nsec = match_fractional_seconds(s); + Ok(()) + } + 'F' => { + parse_type(s, 'Y', tm) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'm', tm)) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'd', tm)) + } + 'H' => { + match match_digits_in_range(s, 1, 2, false, 0, 23) { + Some(v) => { tm.tm_hour = v; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'I' => { + match match_digits_in_range(s, 1, 2, false, 1, 12) { + Some(v) => { tm.tm_hour = if v == 12 { 0 } else { v }; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'j' => { + match match_digits_in_range(s, 1, 3, false, 1, 366) { + Some(v) => { tm.tm_yday = v - 1; Ok(()) } + None => Err(ParseError::InvalidDayOfYear) + } + } + 'k' => { + match match_digits_in_range(s, 1, 2, true, 0, 23) { + Some(v) => { tm.tm_hour = v; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'l' => { + match match_digits_in_range(s, 1, 2, true, 1, 12) { + Some(v) => { tm.tm_hour = if v == 12 { 0 } else { v }; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'M' => { + match match_digits_in_range(s, 1, 2, false, 0, 59) { + Some(v) => { tm.tm_min = v; Ok(()) } + None => Err(ParseError::InvalidMinute) + } + } + 'm' => { + match match_digits_in_range(s, 1, 2, false, 1, 12) { + Some(v) => { tm.tm_mon = v - 1; Ok(()) } + None => Err(ParseError::InvalidMonth) + } + } + 'n' => parse_char(s, '\n'), + 'P' => match match_strs(s, &[("am", 0), ("pm", 12)]) { + Some(v) => { tm.tm_hour += v; Ok(()) } + None => Err(ParseError::InvalidHour) + }, + 'p' => match match_strs(s, &[("AM", 0), ("PM", 12)]) { + Some(v) => { tm.tm_hour += v; Ok(()) } + None => Err(ParseError::InvalidHour) + }, + 'R' => { + parse_type(s, 'H', tm) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'M', tm)) + } + 'r' => { + parse_type(s, 'I', tm) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'M', tm)) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'S', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'p', tm)) + } + 's' => { + match match_digits_i64(s, 1, 18, false) { + Some(v) => { + *tm = at_utc(Timespec::new(v, 0)); + Ok(()) + }, + None => Err(ParseError::InvalidSecondsSinceEpoch) + } + } + 'S' => { + match match_digits_in_range(s, 1, 2, false, 0, 60) { + Some(v) => { tm.tm_sec = v; Ok(()) } + None => Err(ParseError::InvalidSecond) + } + } + //'s' {} + 'T' | 'X' => { + parse_type(s, 'H', tm) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'M', tm)) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'S', tm)) + } + 't' => parse_char(s, '\t'), + 'u' => { + match match_digits_in_range(s, 1, 1, false, 1, 7) { + Some(v) => { tm.tm_wday = if v == 7 { 0 } else { v }; Ok(()) } + None => Err(ParseError::InvalidDayOfWeek) + } + } + 'v' => { + parse_type(s, 'e', tm) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'b', tm)) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'Y', tm)) + } + //'W' {} + 'w' => { + match match_digits_in_range(s, 1, 1, false, 0, 6) { + Some(v) => { tm.tm_wday = v; Ok(()) } + None => Err(ParseError::InvalidDayOfWeek) + } + } + 'Y' => { + match match_digits(s, 4, 4, false) { + Some(v) => { tm.tm_year = v - 1900; Ok(()) } + None => Err(ParseError::InvalidYear) + } + } + 'y' => { + match match_digits_in_range(s, 1, 2, false, 0, 99) { + Some(v) => { tm.tm_year = v; Ok(()) } + None => Err(ParseError::InvalidYear) + } + } + 'Z' => { + if match_str(s, "UTC") || match_str(s, "GMT") { + tm.tm_utcoff = 0; + Ok(()) + } else { + // It's odd, but to maintain compatibility with c's + // strptime we ignore the timezone. + for (i, ch) in s.char_indices() { + if ch == ' ' { + *s = &s[i..]; + return Ok(()) + } + } + *s = ""; + Ok(()) + } + } + 'z' => { + if parse_char(s, 'Z').is_ok() { + tm.tm_utcoff = 0; + Ok(()) + } else { + let sign = if parse_char(s, '+').is_ok() {1} + else if parse_char(s, '-').is_ok() {-1} + else { return Err(ParseError::InvalidZoneOffset) }; + + let hours; + let minutes; + + match match_digits(s, 2, 2, false) { + Some(h) => hours = h, + None => return Err(ParseError::InvalidZoneOffset) + } + + // consume the colon if its present, + // just ignore it otherwise + let _ = parse_char(s, ':'); + + match match_digits(s, 2, 2, false) { + Some(m) => minutes = m, + None => return Err(ParseError::InvalidZoneOffset) + } + + tm.tm_utcoff = sign * (hours * 60 * 60 + minutes * 60); + Ok(()) + } + } + '%' => parse_char(s, '%'), + ch => Err(ParseError::InvalidFormatSpecifier(ch)) + } +} + + +fn match_str(s: &mut &str, needle: &str) -> bool { + if s.starts_with(needle) { + *s = &s[needle.len()..]; + true + } else { + false + } +} + +fn match_strs(ss: &mut &str, strs: &[(&str, i32)]) -> Option { + for &(needle, value) in strs.iter() { + if match_str(ss, needle) { + return Some(value) + } + } + None +} + +fn match_digits(ss: &mut &str, min_digits : usize, max_digits: usize, ws: bool) -> Option { + match match_digits_i64(ss, min_digits, max_digits, ws) { + Some(v) => Some(v as i32), + None => None + } +} + +fn match_digits_i64(ss: &mut &str, min_digits : usize, max_digits: usize, ws: bool) -> Option { + let mut value : i64 = 0; + let mut n = 0; + if ws { + let s2 = ss.trim_left_matches(" "); + n = ss.len() - s2.len(); + if n > max_digits { return None } + } + let chars = ss[n..].char_indices(); + for (_, ch) in chars.take(max_digits - n) { + match ch { + '0' ... '9' => value = value * 10 + (ch as i64 - '0' as i64), + _ => break, + } + n += 1; + } + + if n >= min_digits && n <= max_digits { + *ss = &ss[n..]; + Some(value) + } else { + None + } +} + +fn match_fractional_seconds(ss: &mut &str) -> i32 { + let mut value = 0; + let mut multiplier = NSEC_PER_SEC / 10; + + let mut chars = ss.char_indices(); + let orig = *ss; + for (i, ch) in &mut chars { + *ss = &orig[i..]; + match ch { + '0' ... '9' => { + // This will drop digits after the nanoseconds place + let digit = ch as i32 - '0' as i32; + value += digit * multiplier; + multiplier /= 10; + } + _ => break + } + } + + value +} + +fn match_digits_in_range(ss: &mut &str, + min_digits : usize, max_digits : usize, + ws: bool, min: i32, max: i32) -> Option { + let before = *ss; + match match_digits(ss, min_digits, max_digits, ws) { + Some(val) if val >= min && val <= max => Some(val), + _ => { *ss = before; None } + } +} + +fn parse_char(s: &mut &str, c: char) -> Result<(), ParseError> { + match s.char_indices().next() { + Some((i, c2)) => { + if c == c2 { + *s = &s[i + c2.len_utf8()..]; + Ok(()) + } else { + Err(ParseError::UnexpectedCharacter(c, c2)) + } + } + None => Err(ParseError::InvalidTime), + } +} diff --git a/third_party/rust/time/src/sys.rs b/third_party/rust/time/src/sys.rs new file mode 100644 index 000000000000..fd3feff746d2 --- /dev/null +++ b/third_party/rust/time/src/sys.rs @@ -0,0 +1,841 @@ +#![allow(bad_style)] + +pub use self::inner::*; + +#[cfg(target_os = "redox")] +mod inner { + use std::fmt; + use std::cmp::Ordering; + use std::ops::{Add, Sub}; + use syscall; + + use Duration; + use Tm; + + fn time_to_tm(ts: i64, tm: &mut Tm) { + let leapyear = |year| -> bool { + year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) + }; + + static _ytab: [[i64; 12]; 2] = [ + [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ], + [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ] + ]; + + let mut year = 1970; + + let dayclock = ts % 86400; + let mut dayno = ts / 86400; + + tm.tm_sec = (dayclock % 60) as i32; + tm.tm_min = ((dayclock % 3600) / 60) as i32; + tm.tm_hour = (dayclock / 3600) as i32; + tm.tm_wday = ((dayno + 4) % 7) as i32; + loop { + let yearsize = if leapyear(year) { + 366 + } else { + 365 + }; + if dayno >= yearsize { + dayno -= yearsize; + year += 1; + } else { + break; + } + } + tm.tm_year = (year - 1900) as i32; + tm.tm_yday = dayno as i32; + let mut mon = 0; + while dayno >= _ytab[if leapyear(year) { 1 } else { 0 }][mon] { + dayno -= _ytab[if leapyear(year) { 1 } else { 0 }][mon]; + mon += 1; + } + tm.tm_mon = mon as i32; + tm.tm_mday = dayno as i32 + 1; + tm.tm_isdst = 0; + } + + fn tm_to_time(tm: &Tm) -> i64 { + let mut y = tm.tm_year as i64 + 1900; + let mut m = tm.tm_mon as i64 + 1; + if m <= 2 { + y -= 1; + m += 12; + } + let d = tm.tm_mday as i64; + let h = tm.tm_hour as i64; + let mi = tm.tm_min as i64; + let s = tm.tm_sec as i64; + (365*y + y/4 - y/100 + y/400 + 3*(m+1)/5 + 30*m + d - 719561) + * 86400 + 3600 * h + 60 * mi + s + } + + pub fn time_to_utc_tm(sec: i64, tm: &mut Tm) { + time_to_tm(sec, tm); + } + + pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { + // FIXME: Add timezone logic + time_to_tm(sec, tm); + } + + pub fn utc_tm_to_time(tm: &Tm) -> i64 { + tm_to_time(tm) + } + + pub fn local_tm_to_time(tm: &Tm) -> i64 { + // FIXME: Add timezone logic + tm_to_time(tm) + } + + pub fn get_time() -> (i64, i32) { + let mut tv = syscall::TimeSpec { tv_sec: 0, tv_nsec: 0 }; + syscall::clock_gettime(syscall::CLOCK_REALTIME, &mut tv).unwrap(); + (tv.tv_sec as i64, tv.tv_nsec as i32) + } + + pub fn get_precise_ns() -> u64 { + let mut ts = syscall::TimeSpec { tv_sec: 0, tv_nsec: 0 }; + syscall::clock_gettime(syscall::CLOCK_MONOTONIC, &mut ts).unwrap(); + (ts.tv_sec as u64) * 1000000000 + (ts.tv_nsec as u64) + } + + #[derive(Copy)] + pub struct SteadyTime { + t: syscall::TimeSpec, + } + + impl fmt::Debug for SteadyTime { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "SteadyTime {{ tv_sec: {:?}, tv_nsec: {:?} }}", + self.t.tv_sec, self.t.tv_nsec) + } + } + + impl Clone for SteadyTime { + fn clone(&self) -> SteadyTime { + SteadyTime { t: self.t } + } + } + + impl SteadyTime { + pub fn now() -> SteadyTime { + let mut t = SteadyTime { + t: syscall::TimeSpec { + tv_sec: 0, + tv_nsec: 0, + } + }; + syscall::clock_gettime(syscall::CLOCK_MONOTONIC, &mut t.t).unwrap(); + t + } + } + + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + if self.t.tv_nsec >= other.t.tv_nsec { + Duration::seconds(self.t.tv_sec as i64 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 - other.t.tv_nsec as i64) + } else { + Duration::seconds(self.t.tv_sec as i64 - 1 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 + ::NSEC_PER_SEC as i64 - + other.t.tv_nsec as i64) + } + } + } + + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(mut self, other: Duration) -> SteadyTime { + let seconds = other.num_seconds(); + let nanoseconds = other - Duration::seconds(seconds); + let nanoseconds = nanoseconds.num_nanoseconds().unwrap(); + self.t.tv_sec += seconds; + self.t.tv_nsec += nanoseconds as i32; + if self.t.tv_nsec >= ::NSEC_PER_SEC { + self.t.tv_nsec -= ::NSEC_PER_SEC; + self.t.tv_sec += 1; + } else if self.t.tv_nsec < 0 { + self.t.tv_sec -= 1; + self.t.tv_nsec += ::NSEC_PER_SEC; + } + self + } + } + + impl PartialOrd for SteadyTime { + fn partial_cmp(&self, other: &SteadyTime) -> Option { + Some(self.cmp(other)) + } + } + + impl Ord for SteadyTime { + fn cmp(&self, other: &SteadyTime) -> Ordering { + match self.t.tv_sec.cmp(&other.t.tv_sec) { + Ordering::Equal => self.t.tv_nsec.cmp(&other.t.tv_nsec), + ord => ord + } + } + } + + impl PartialEq for SteadyTime { + fn eq(&self, other: &SteadyTime) -> bool { + self.t.tv_sec == other.t.tv_sec && + self.t.tv_nsec == other.t.tv_nsec + } + } + + impl Eq for SteadyTime {} +} + +#[cfg(unix)] +mod inner { + use libc::{self, time_t}; + use std::mem; + use std::io; + use Tm; + + #[cfg(any(target_os = "macos", target_os = "ios"))] + pub use self::mac::*; + #[cfg(all(not(target_os = "macos"), not(target_os = "ios")))] + pub use self::unix::*; + + fn rust_tm_to_tm(rust_tm: &Tm, tm: &mut libc::tm) { + tm.tm_sec = rust_tm.tm_sec; + tm.tm_min = rust_tm.tm_min; + tm.tm_hour = rust_tm.tm_hour; + tm.tm_mday = rust_tm.tm_mday; + tm.tm_mon = rust_tm.tm_mon; + tm.tm_year = rust_tm.tm_year; + tm.tm_wday = rust_tm.tm_wday; + tm.tm_yday = rust_tm.tm_yday; + tm.tm_isdst = rust_tm.tm_isdst; + } + + fn tm_to_rust_tm(tm: &libc::tm, utcoff: i32, rust_tm: &mut Tm) { + rust_tm.tm_sec = tm.tm_sec; + rust_tm.tm_min = tm.tm_min; + rust_tm.tm_hour = tm.tm_hour; + rust_tm.tm_mday = tm.tm_mday; + rust_tm.tm_mon = tm.tm_mon; + rust_tm.tm_year = tm.tm_year; + rust_tm.tm_wday = tm.tm_wday; + rust_tm.tm_yday = tm.tm_yday; + rust_tm.tm_isdst = tm.tm_isdst; + rust_tm.tm_utcoff = utcoff; + } + + #[cfg(target_os = "nacl")] + unsafe fn timegm(tm: *const libc::tm) -> time_t { + use std::env::{set_var, var_os, remove_var}; + extern { + fn tzset(); + } + + let ret; + + let current_tz = var_os("TZ"); + set_var("TZ", "UTC"); + tzset(); + + ret = libc::mktime(tm); + + if let Some(tz) = current_tz { + set_var("TZ", tz); + } else { + remove_var("TZ"); + } + tzset(); + + ret + } + + pub fn time_to_utc_tm(sec: i64, tm: &mut Tm) { + unsafe { + let sec = sec as time_t; + let mut out = mem::zeroed(); + if libc::gmtime_r(&sec, &mut out).is_null() { + panic!("gmtime_r failed: {}", io::Error::last_os_error()); + } + tm_to_rust_tm(&out, 0, tm); + } + } + + pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { + unsafe { + let sec = sec as time_t; + let mut out = mem::zeroed(); + if libc::localtime_r(&sec, &mut out).is_null() { + panic!("localtime_r failed: {}", io::Error::last_os_error()); + } + tm_to_rust_tm(&out, out.tm_gmtoff as i32, tm); + } + } + + pub fn utc_tm_to_time(rust_tm: &Tm) -> i64 { + #[cfg(all(target_os = "android", not(target_arch = "aarch64")))] + use libc::timegm64 as timegm; + #[cfg(not(all(target_os = "android", not(target_arch = "aarch64"))))] + use libc::timegm; + + let mut tm = unsafe { mem::zeroed() }; + rust_tm_to_tm(rust_tm, &mut tm); + unsafe { timegm(&mut tm) as i64 } + } + + pub fn local_tm_to_time(rust_tm: &Tm) -> i64 { + let mut tm = unsafe { mem::zeroed() }; + rust_tm_to_tm(rust_tm, &mut tm); + unsafe { libc::mktime(&mut tm) as i64 } + } + + #[cfg(any(target_os = "macos", target_os = "ios"))] + mod mac { + use libc::{self, timeval, mach_timebase_info}; + use std::sync::{Once, ONCE_INIT}; + use std::ops::{Add, Sub}; + use Duration; + + fn info() -> &'static mach_timebase_info { + static mut INFO: mach_timebase_info = mach_timebase_info { + numer: 0, + denom: 0, + }; + static ONCE: Once = ONCE_INIT; + + unsafe { + ONCE.call_once(|| { + mach_timebase_info(&mut INFO); + }); + &INFO + } + } + + pub fn get_time() -> (i64, i32) { + use std::ptr; + let mut tv = timeval { tv_sec: 0, tv_usec: 0 }; + unsafe { libc::gettimeofday(&mut tv, ptr::null_mut()); } + (tv.tv_sec as i64, tv.tv_usec * 1000) + } + + pub fn get_precise_ns() -> u64 { + unsafe { + let time = libc::mach_absolute_time(); + let info = info(); + time * info.numer as u64 / info.denom as u64 + } + } + + #[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug)] + pub struct SteadyTime { t: u64 } + + impl SteadyTime { + pub fn now() -> SteadyTime { + SteadyTime { t: get_precise_ns() } + } + } + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + Duration::nanoseconds(self.t as i64 - other.t as i64) + } + } + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(self, other: Duration) -> SteadyTime { + let delta = other.num_nanoseconds().unwrap(); + SteadyTime { + t: (self.t as i64 + delta) as u64 + } + } + } + } + + #[cfg(test)] + pub struct TzReset; + + #[cfg(test)] + pub fn set_los_angeles_time_zone() -> TzReset { + use std::env; + env::set_var("TZ", "America/Los_Angeles"); + ::tzset(); + TzReset + } + + #[cfg(test)] + pub fn set_london_with_dst_time_zone() -> TzReset { + use std::env; + env::set_var("TZ", "Europe/London"); + ::tzset(); + TzReset + } + + #[cfg(all(not(target_os = "macos"), not(target_os = "ios")))] + mod unix { + use std::fmt; + use std::cmp::Ordering; + use std::ops::{Add, Sub}; + use libc; + + use Duration; + + pub fn get_time() -> (i64, i32) { + let mut tv = libc::timespec { tv_sec: 0, tv_nsec: 0 }; + unsafe { libc::clock_gettime(libc::CLOCK_REALTIME, &mut tv); } + (tv.tv_sec as i64, tv.tv_nsec as i32) + } + + pub fn get_precise_ns() -> u64 { + let mut ts = libc::timespec { tv_sec: 0, tv_nsec: 0 }; + unsafe { + libc::clock_gettime(libc::CLOCK_MONOTONIC, &mut ts); + } + (ts.tv_sec as u64) * 1000000000 + (ts.tv_nsec as u64) + } + + #[derive(Copy)] + pub struct SteadyTime { + t: libc::timespec, + } + + impl fmt::Debug for SteadyTime { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "SteadyTime {{ tv_sec: {:?}, tv_nsec: {:?} }}", + self.t.tv_sec, self.t.tv_nsec) + } + } + + impl Clone for SteadyTime { + fn clone(&self) -> SteadyTime { + SteadyTime { t: self.t } + } + } + + impl SteadyTime { + pub fn now() -> SteadyTime { + let mut t = SteadyTime { + t: libc::timespec { + tv_sec: 0, + tv_nsec: 0, + } + }; + unsafe { + assert_eq!(0, libc::clock_gettime(libc::CLOCK_MONOTONIC, + &mut t.t)); + } + t + } + } + + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + if self.t.tv_nsec >= other.t.tv_nsec { + Duration::seconds(self.t.tv_sec as i64 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 - other.t.tv_nsec as i64) + } else { + Duration::seconds(self.t.tv_sec as i64 - 1 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 + ::NSEC_PER_SEC as i64 - + other.t.tv_nsec as i64) + } + } + } + + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(mut self, other: Duration) -> SteadyTime { + let seconds = other.num_seconds(); + let nanoseconds = other - Duration::seconds(seconds); + let nanoseconds = nanoseconds.num_nanoseconds().unwrap(); + self.t.tv_sec += seconds as libc::time_t; + self.t.tv_nsec += nanoseconds as libc::c_long; + if self.t.tv_nsec >= ::NSEC_PER_SEC as libc::c_long { + self.t.tv_nsec -= ::NSEC_PER_SEC as libc::c_long; + self.t.tv_sec += 1; + } else if self.t.tv_nsec < 0 { + self.t.tv_sec -= 1; + self.t.tv_nsec += ::NSEC_PER_SEC as libc::c_long; + } + self + } + } + + impl PartialOrd for SteadyTime { + fn partial_cmp(&self, other: &SteadyTime) -> Option { + Some(self.cmp(other)) + } + } + + impl Ord for SteadyTime { + fn cmp(&self, other: &SteadyTime) -> Ordering { + match self.t.tv_sec.cmp(&other.t.tv_sec) { + Ordering::Equal => self.t.tv_nsec.cmp(&other.t.tv_nsec), + ord => ord + } + } + } + + impl PartialEq for SteadyTime { + fn eq(&self, other: &SteadyTime) -> bool { + self.t.tv_sec == other.t.tv_sec && + self.t.tv_nsec == other.t.tv_nsec + } + } + + impl Eq for SteadyTime {} + + } +} + +#[cfg(windows)] +#[allow(non_snake_case)] +mod inner { + use std::io; + use std::mem; + use std::sync::{Once, ONCE_INIT}; + use std::ops::{Add, Sub}; + use {Tm, Duration}; + + use kernel32::*; + use winapi::*; + + fn frequency() -> LARGE_INTEGER { + static mut FREQUENCY: LARGE_INTEGER = 0; + static ONCE: Once = ONCE_INIT; + + unsafe { + ONCE.call_once(|| { + QueryPerformanceFrequency(&mut FREQUENCY); + }); + FREQUENCY + } + } + + const HECTONANOSECS_IN_SEC: i64 = 10_000_000; + const HECTONANOSEC_TO_UNIX_EPOCH: i64 = 11_644_473_600 * HECTONANOSECS_IN_SEC; + + fn time_to_file_time(sec: i64) -> FILETIME { + let t = (((sec * HECTONANOSECS_IN_SEC) + HECTONANOSEC_TO_UNIX_EPOCH)) as u64; + FILETIME { + dwLowDateTime: t as DWORD, + dwHighDateTime: (t >> 32) as DWORD + } + } + + fn file_time_as_u64(ft: &FILETIME) -> u64 { + ((ft.dwHighDateTime as u64) << 32) | (ft.dwLowDateTime as u64) + } + + fn file_time_to_nsec(ft: &FILETIME) -> i32 { + let t = file_time_as_u64(ft) as i64; + ((t % HECTONANOSECS_IN_SEC) * 100) as i32 + } + + fn file_time_to_unix_seconds(ft: &FILETIME) -> i64 { + let t = file_time_as_u64(ft) as i64; + ((t - HECTONANOSEC_TO_UNIX_EPOCH) / HECTONANOSECS_IN_SEC) as i64 + } + + fn system_time_to_file_time(sys: &SYSTEMTIME) -> FILETIME { + unsafe { + let mut ft = mem::zeroed(); + SystemTimeToFileTime(sys, &mut ft); + ft + } + } + + fn tm_to_system_time(tm: &Tm) -> SYSTEMTIME { + let mut sys: SYSTEMTIME = unsafe { mem::zeroed() }; + sys.wSecond = tm.tm_sec as WORD; + sys.wMinute = tm.tm_min as WORD; + sys.wHour = tm.tm_hour as WORD; + sys.wDay = tm.tm_mday as WORD; + sys.wDayOfWeek = tm.tm_wday as WORD; + sys.wMonth = (tm.tm_mon + 1) as WORD; + sys.wYear = (tm.tm_year + 1900) as WORD; + sys + } + + fn system_time_to_tm(sys: &SYSTEMTIME, tm: &mut Tm) { + tm.tm_sec = sys.wSecond as i32; + tm.tm_min = sys.wMinute as i32; + tm.tm_hour = sys.wHour as i32; + tm.tm_mday = sys.wDay as i32; + tm.tm_wday = sys.wDayOfWeek as i32; + tm.tm_mon = (sys.wMonth - 1) as i32; + tm.tm_year = (sys.wYear - 1900) as i32; + tm.tm_yday = yday(tm.tm_year, tm.tm_mon + 1, tm.tm_mday); + + fn yday(year: i32, month: i32, day: i32) -> i32 { + let leap = if month > 2 { + if year % 4 == 0 { 1 } else { 2 } + } else { + 0 + }; + let july = if month > 7 { 1 } else { 0 }; + + (month - 1) * 30 + month / 2 + (day - 1) - leap + july + } + } + + macro_rules! call { + ($name:ident($($arg:expr),*)) => { + if $name($($arg),*) == 0 { + panic!(concat!(stringify!($name), " failed with: {}"), + io::Error::last_os_error()); + } + } + } + + pub fn time_to_utc_tm(sec: i64, tm: &mut Tm) { + let mut out = unsafe { mem::zeroed() }; + let ft = time_to_file_time(sec); + unsafe { + call!(FileTimeToSystemTime(&ft, &mut out)); + } + system_time_to_tm(&out, tm); + tm.tm_utcoff = 0; + } + + pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { + let ft = time_to_file_time(sec); + unsafe { + let mut utc = mem::zeroed(); + let mut local = mem::zeroed(); + call!(FileTimeToSystemTime(&ft, &mut utc)); + call!(SystemTimeToTzSpecificLocalTime(0 as *const _, + &mut utc, &mut local)); + system_time_to_tm(&local, tm); + + let local = system_time_to_file_time(&local); + let local_sec = file_time_to_unix_seconds(&local); + + let mut tz = mem::zeroed(); + GetTimeZoneInformation(&mut tz); + + // SystemTimeToTzSpecificLocalTime already applied the biases so + // check if it non standard + tm.tm_utcoff = (local_sec - sec) as i32; + tm.tm_isdst = if tm.tm_utcoff == -60 * (tz.Bias + tz.StandardBias) { + 0 + } else { + 1 + }; + } + } + + pub fn utc_tm_to_time(tm: &Tm) -> i64 { + unsafe { + let mut ft = mem::zeroed(); + let sys_time = tm_to_system_time(tm); + call!(SystemTimeToFileTime(&sys_time, &mut ft)); + file_time_to_unix_seconds(&ft) + } + } + + pub fn local_tm_to_time(tm: &Tm) -> i64 { + unsafe { + let mut ft = mem::zeroed(); + let mut utc = mem::zeroed(); + let mut sys_time = tm_to_system_time(tm); + call!(TzSpecificLocalTimeToSystemTime(0 as *mut _, + &mut sys_time, &mut utc)); + call!(SystemTimeToFileTime(&utc, &mut ft)); + file_time_to_unix_seconds(&ft) + } + } + + pub fn get_time() -> (i64, i32) { + unsafe { + let mut ft = mem::zeroed(); + GetSystemTimeAsFileTime(&mut ft); + (file_time_to_unix_seconds(&ft), file_time_to_nsec(&ft)) + } + } + + pub fn get_precise_ns() -> u64 { + let mut ticks = 0; + unsafe { + assert!(QueryPerformanceCounter(&mut ticks) == 1); + } + mul_div_i64(ticks as i64, 1000000000, frequency() as i64) as u64 + + } + + #[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug)] + pub struct SteadyTime { + t: LARGE_INTEGER, + } + + impl SteadyTime { + pub fn now() -> SteadyTime { + let mut t = SteadyTime { t: 0 }; + unsafe { QueryPerformanceCounter(&mut t.t); } + t + } + } + + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + let diff = self.t as i64 - other.t as i64; + Duration::nanoseconds(mul_div_i64(diff, 1000000000, + frequency() as i64)) + } + } + + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(mut self, other: Duration) -> SteadyTime { + self.t += (other.num_microseconds().unwrap() * frequency() as i64 / + 1_000_000) as LARGE_INTEGER; + self + } + } + + #[cfg(test)] + pub struct TzReset { + old: TIME_ZONE_INFORMATION, + } + + #[cfg(test)] + impl Drop for TzReset { + fn drop(&mut self) { + unsafe { + call!(SetTimeZoneInformation(&self.old)); + } + } + } + + #[cfg(test)] + pub fn set_los_angeles_time_zone() -> TzReset { + acquire_privileges(); + + unsafe { + let mut tz = mem::zeroed::(); + GetTimeZoneInformation(&mut tz); + let ret = TzReset { old: tz }; + tz.Bias = 60 * 8; + call!(SetTimeZoneInformation(&tz)); + return ret + } + } + + #[cfg(test)] + pub fn set_london_with_dst_time_zone() -> TzReset { + acquire_privileges(); + + unsafe { + let mut tz = mem::zeroed::(); + GetTimeZoneInformation(&mut tz); + let ret = TzReset { old: tz }; + // Since date set precisely this is 2015's dates + tz.Bias = 0; + tz.DaylightBias = -60; + tz.DaylightDate.wYear = 0; + tz.DaylightDate.wMonth = 3; + tz.DaylightDate.wDayOfWeek = 0; + tz.DaylightDate.wDay = 5; + tz.DaylightDate.wHour = 2; + tz.StandardBias = 0; + tz.StandardDate.wYear = 0; + tz.StandardDate.wMonth = 10; + tz.StandardDate.wDayOfWeek = 0; + tz.StandardDate.wDay = 5; + tz.StandardDate.wHour = 2; + call!(SetTimeZoneInformation(&tz)); + return ret + } + } + + // Ensures that this process has the necessary privileges to set a new time + // zone, and this is all transcribed from: + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724944%28v=vs.85%29.aspx + #[cfg(test)] + fn acquire_privileges() { + use std::sync::{ONCE_INIT, Once}; + use advapi32::*; + const SE_PRIVILEGE_ENABLED: DWORD = 2; + static INIT: Once = ONCE_INIT; + + #[repr(C)] + struct TKP { + tkp: TOKEN_PRIVILEGES, + laa: LUID_AND_ATTRIBUTES, + } + + INIT.call_once(|| unsafe { + let mut hToken = 0 as *mut _; + call!(OpenProcessToken(GetCurrentProcess(), + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, + &mut hToken)); + + let mut tkp = mem::zeroed::(); + assert_eq!(tkp.tkp.Privileges.len(), 0); + let c = ::std::ffi::CString::new("SeTimeZonePrivilege").unwrap(); + call!(LookupPrivilegeValueA(0 as *const _, c.as_ptr(), + &mut tkp.laa.Luid)); + tkp.tkp.PrivilegeCount = 1; + tkp.laa.Attributes = SE_PRIVILEGE_ENABLED; + call!(AdjustTokenPrivileges(hToken, FALSE, &mut tkp.tkp, 0, + 0 as *mut _, 0 as *mut _)); + }); + } + + + + // Computes (value*numer)/denom without overflow, as long as both + // (numer*denom) and the overall result fit into i64 (which is the case + // for our time conversions). + fn mul_div_i64(value: i64, numer: i64, denom: i64) -> i64 { + let q = value / denom; + let r = value % denom; + // Decompose value as (value/denom*denom + value%denom), + // substitute into (value*numer)/denom and simplify. + // r < denom, so (denom*numer) is the upper bound of (r*numer) + q * numer + r * numer / denom + } + + #[test] + fn test_muldiv() { + assert_eq!(mul_div_i64( 1_000_000_000_001, 1_000_000_000, 1_000_000), + 1_000_000_000_001_000); + assert_eq!(mul_div_i64(-1_000_000_000_001, 1_000_000_000, 1_000_000), + -1_000_000_000_001_000); + assert_eq!(mul_div_i64(-1_000_000_000_001,-1_000_000_000, 1_000_000), + 1_000_000_000_001_000); + assert_eq!(mul_div_i64( 1_000_000_000_001, 1_000_000_000,-1_000_000), + -1_000_000_000_001_000); + assert_eq!(mul_div_i64( 1_000_000_000_001,-1_000_000_000,-1_000_000), + 1_000_000_000_001_000); + } +} diff --git a/third_party/rust/toml/.cargo-checksum.json b/third_party/rust/toml/.cargo-checksum.json new file mode 100644 index 000000000000..53cced7624fd --- /dev/null +++ b/third_party/rust/toml/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"7d917e42244b1d0d0304a11e8ef45bbc34e2a859bf35a752ed6069920a7cc8c5","Cargo.toml":"996f64a3b649cb71b337b03882f63e487de78fbddb97734c67c6fca015976f2c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"a3505a33e4973ac97b3c7189f7b56b3a5f483218f1a23da5f625a718ad9adc16","examples/toml2json.rs":"d1980e1d53e712ea6f9d6b3a36ce156b075bf8c1dd7660c2947e7b81106ea41c","src/decoder/mod.rs":"23c4045e9131b26ea772797f4dc65a57fab4e4a59b340dcceb094db9dd5cc02e","src/decoder/rustc_serialize.rs":"e5fc97516f38a5997c514318c857173cc7ebfc9b06b0b0517127bdc02c18c625","src/decoder/serde.rs":"7cae3e1d2795d53c351f98b7d010dc4d579ac93f9e3e44dc307b9eca2186f2cc","src/display.rs":"2a9fea5f27328412dd3168571a94645711714261fef1f9348e4cab56138a640e","src/encoder/mod.rs":"b7af37d6cab330bb749717274d821cf34599cf210f19daa431fb0fdb0ef3c2b8","src/encoder/rustc_serialize.rs":"d444ea1995d4cba19ab6e17eabc9246070787a58d2b430997b55d6e1a88a5c30","src/encoder/serde.rs":"eb1d0237fa5d1d4367bcf3cff287cb10b9467d05ab817a696d7a6316350cdd11","src/lib.rs":"6c7e98f283e3263587c628c216ea2274375ab81286070937cec7cc79d82eed01","src/parser.rs":"6bb7694a3ad138b1ffafa6d9fc1dec342ea34af0219b2f560f3777014a21481b","tests/README.md":"3e7d07d64c34e117c3d862ee12e4947af8c133fb0b53f6f0de43cc3bfa5057b8","tests/formatting.rs":"bc672504cedbf956de645073baab876baf06c7f2bc120db20d27b1446c8b5f4b","tests/invalid-encoder/array-mixed-types-ints-and-floats.json":"206d2a353153efbcee74e7ee7b0f852e7a948cfb88417f74607b3ad6f020e373","tests/invalid.rs":"ef9b613246634673e43f95b8688f275d22726f41fb9ecb824504217e6f5d5c58","tests/invalid/array-mixed-types-arrays-and-ints.toml":"c1547b686357c7a865e333a7ce7eed1e30743ebc4daac8ea6148bdd84b7e4dc7","tests/invalid/array-mixed-types-ints-and-floats.toml":"baa235fc168869716680955fd5bdafab30b6fa9b3d09185086261a56ef12960e","tests/invalid/array-mixed-types-strings-and-ints.toml":"4440057ed90d4461db0be55cfd71299cad96b601d5faec2140666242f6fde147","tests/invalid/datetime-malformed-no-leads.toml":"1fa6bf72ea0b96be835ac031408f7acfd0b8d18d5f54b4c0fce8136aad27d22e","tests/invalid/datetime-malformed-no-secs.toml":"b9c30b7fa1847c80e381d68cc79834eefbb8813cd0eff465fb7cbe0733df429b","tests/invalid/datetime-malformed-no-t.toml":"490a46d2e707ef4f87987ec12a22afa5a71c97c5eaa0f4201a174c47846c6a4a","tests/invalid/datetime-malformed-no-z.toml":"6ca48b84c444b3ca51a480aa9688dd1044861010aff674a67e5cec34fd2eb489","tests/invalid/datetime-malformed-with-milli.toml":"62bfd0a6645bcb3f78211523e5673a3d1fa726d9e942c1643df243d6fba474c8","tests/invalid/duplicate-key-table.toml":"a896ea2180d16fcdd4f6c30aa27529b5b29e7e195a4e7a9944343028783602e9","tests/invalid/duplicate-keys.toml":"4bb0a65c22e7704893a2a51334eb2518af702850ef59aeecd5226e7b26bc07ec","tests/invalid/duplicate-tables.toml":"23b16ce26e1155ee6bf1fff559701dce86475c6a2878536b61f6b7e68be340de","tests/invalid/empty-implicit-table.toml":"d6026110dc0dee7babd69592218819328caa425f48cc879e895b29e48550c06c","tests/invalid/empty-table.toml":"37517e5f3dc66819f61f5a7bb8ace1921282415f10551d2defa5c3eb0985b570","tests/invalid/float-no-leading-zero.toml":"159654461094c938574ba2d2d09baa3d3c387dd6ed024fd411530c0573a1ec42","tests/invalid/float-no-trailing-digits.toml":"64e4f336186cd096be2804532dbd694dd50ea551d292a9cdbf0bef2abf227101","tests/invalid/key-after-array.toml":"314af33770170b53bf2ec3be43ea1609d981c81d62c968052499b85ed54ccce8","tests/invalid/key-after-table.toml":"ed0dcf38f003d184dd18d1518702da0115cbfb05a5a28cbcf42de2f9bdee05fa","tests/invalid/key-empty.toml":"4303477abf4c0b920b42e96edd61caecf9c1f2d5d97f56af876854cd725aff3c","tests/invalid/key-hash.toml":"cd2a2eba6032d32c829633d3cd2778aeba81f5ff554e69f62af6557d1dc712f6","tests/invalid/key-newline.toml":"06a313a6bd70c2db6a1f5bda479d854d8f87e037e3cabf18fb5db822466ffcac","tests/invalid/key-open-bracket.toml":"52dea939022949290e3a19f1291d15605429344dce3cd1aa1f1568ecad8ca365","tests/invalid/key-single-open-bracket.toml":"245843abef9e72e7efac30138a994bf6301e7e1d7d7042a33d42e863d2638811","tests/invalid/key-space.toml":"b4e336d07c27fb3d0f0a6e50b733e1546202dfd58aaf2f7956f56fd6f075b0a1","tests/invalid/key-start-bracket.toml":"3bd3748a9df1d25ab2661330a3da187bd4da3958292bbf0e8b59d7963634dd87","tests/invalid/key-two-equals.toml":"3ac0c4e339d47c86e57564e43147b772ae83933b78083dc78d0ef77e231df3f1","tests/invalid/string-bad-byte-escape.toml":"c665dcec7c02f442c4fdc80423698eed2376ce65779cf855371772293bec2927","tests/invalid/string-bad-escape.toml":"eeca691fbba3d270f58ae2953d2d1369a773e619e39d8c11f38d6bf6f8472e82","tests/invalid/string-byte-escapes.toml":"4a4604b32971de3a252cd01d2997b450972c3ec9030cf22a070d49c57f050da4","tests/invalid/string-no-close.toml":"bb2eaf96eb9f83a52bd0772abb313060a06b94f650efeb45edce774622686882","tests/invalid/table-array-implicit.toml":"9b841ea64d68be4deb54f67fc807b05fd235452ee563ffa7de69dbca64b2f7dd","tests/invalid/table-array-malformed-bracket.toml":"164f641b2628bf04f8202d9746a360a4a243faca1408dc2ecd0c0fdd2d1c2c27","tests/invalid/table-array-malformed-empty.toml":"56ca2a15019cf5c3555041a191f983dc72b1678f0de0afd1a7b8f46ed7970420","tests/invalid/table-empty.toml":"37517e5f3dc66819f61f5a7bb8ace1921282415f10551d2defa5c3eb0985b570","tests/invalid/table-nested-brackets-close.toml":"991e1210f81e24abcd735988f0d960d4ee94d2ec3b133c6fea6e24932d91c507","tests/invalid/table-nested-brackets-open.toml":"8fb569fc90fa606ae94708ee2bf205bff8db8a023624b3e52ef6b2c1a98ba1c6","tests/invalid/table-whitespace.toml":"2c2db1259adc641df0459e896d349d3db60965d5368d5c8ed50aedd3bc88f040","tests/invalid/table-with-pound.toml":"d8070437f07bd115ac8006c61e286401bd3be88728a62264796e757121750ecd","tests/invalid/text-after-array-entries.toml":"2530cace13292313983b90b01d63e4b8ac484809e7ef0ac79904923573eda7ec","tests/invalid/text-after-integer.toml":"6168ed823a135b8914956b04307aeec2347b10eb1aa79008406d7b547cbde682","tests/invalid/text-after-string.toml":"1771987dd679e1cc181cf53406ba313fdc3413a081d17a93da6041bf6ccccf5e","tests/invalid/text-after-table.toml":"f27ae56bb0b42d3af4c813392857afdfeb4bf8ab77ff896cd93ba32cf1a21b26","tests/invalid/text-before-array-separator.toml":"192d28699573abbdc521797576d4885adf756336c3e76971f10270603c957464","tests/invalid/text-in-array.toml":"50d7b16d7a03d470f1a907eebfeb156d0c696e6f9a8c734a5e4caa2365f54654","tests/valid.rs":"d2199e449a1f6b5aab1914f7b739ae0f496657ca249aa3b9bcdd85b89075e4e4","tests/valid/array-empty.json":"4ed46e8aa3586a7ddd9097cda38919699860052f188880de18e12d4acbee5307","tests/valid/array-empty.toml":"769faa42a690b02ad1b573277f0d793a4a38a7ecf30b9db67bf9836fe2b7778c","tests/valid/array-nospaces.json":"7c82b474797871488c2b522e9b852772a78c681a86900f780f7a0be4f901e1ec","tests/valid/array-nospaces.toml":"01fba63551b1051f7e117c9551c488b293bd3cd4745cbeec6b3709c32f2a3a64","tests/valid/arrays-hetergeneous.json":"dac4702412c90d5ddd6b898c3657c71d782d0aca46e5b9ca19cc694d3e226c0f","tests/valid/arrays-hetergeneous.toml":"361ae2e8470b47b12b336eb61eedd09abb20e216fbeb582b46d16a2831adda4d","tests/valid/arrays-nested.json":"34d6f8fd770f0728f38dbf0d686bed2c218bc16da978290c0208d3bf3704bdec","tests/valid/arrays-nested.toml":"a5941a01a2ba2fa179a3885039a5f81ca6c9876b2e8bea7b880563238be9f004","tests/valid/arrays.json":"315fff195a7d4c80e867e1f14c12a23e36dcc666e8de36138249b15e99bdd4dd","tests/valid/arrays.toml":"2d3c91b77d4f6a65a6a5a2c5ad521dbe86cc2f0ff389dfe58e8c34275cdc35c7","tests/valid/bool.json":"bb608b912fe4d89cb2186da957c10951780575bb34b2f43305335c745eff049c","tests/valid/bool.toml":"3c06ad4dce7430326f5f867105b2e9382def90cccb3ecb69f657c0b88974ab04","tests/valid/comments-everywhere.json":"800f8efd86d1bab4f91f0e367da52a2465e1480387df892561ed8948fd1a38c3","tests/valid/comments-everywhere.toml":"8636108c34f50d45244b142d342234b7535e01fba2db2d2ffed3430223009cea","tests/valid/datetime.json":"94f130c3b2a5f30c625a3a3168b9dfe52aa109b470c4e077f352b3dd79382a69","tests/valid/datetime.toml":"4e1b71ba31a1feef80a1e436225aa9c5d291bf780f558e7cfa76998fe2a29e08","tests/valid/empty.json":"ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356","tests/valid/empty.toml":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","tests/valid/example-bom.toml":"50f3607be97de2f894ccd41a29d3a8a1b1f430982e5ab5bf43047874837f6a42","tests/valid/example-v0.3.0.json":"ec02332eb59dab93a50560771e4b01b972a29d93b6dca8954728c0631e1799a0","tests/valid/example-v0.3.0.toml":"aba9349588c1ba6af2a3ad0c1db2c3d311dca66b64f654480340a0823dfd4546","tests/valid/example-v0.4.0.json":"8b967b246ca2383172eaaecf790b2115a18020f63c70d0848d1dc25fc1fed5a9","tests/valid/example-v0.4.0.toml":"47ee4c4cd83637cd09aca6518f88c8ed56acc2b3022e5ea53d9121e5d35335ed","tests/valid/example.json":"c57fabb1be0ae7ed140fe7ae5082051571c85180204b8ae8d8da1e86133278c9","tests/valid/example.toml":"6f02b2a52ea63c70b629e41e06a8eb1eb4aab359ab966a7a397b248e13849c9c","tests/valid/example2.json":"de89432e78f0a074aae54650fedf151ceca3b0ccb148b8a66e18e2ed68024ba2","tests/valid/example2.toml":"c389eeb485fb7cb9445d617a9a0f8ba70049f08d66cf6b6f2a9a986574295de1","tests/valid/float.json":"9676c13fef00a01bc729456bfe27f1b24a1bd059c9a5913bb0b0401e976a0aab","tests/valid/float.toml":"b6784f554aa38bb210f0905c3bafdfae6db723a4f53288fb07febc66451bbc2d","tests/valid/hard_example.json":"8d170e73e156b8b6be559246880e9cb6a79b36f63d14bc97e3bdf2f2091e7a17","tests/valid/hard_example.toml":"cd3b89f8917a44f944b12fe47f69f86bb39f17db85d1a081bf0c134831eb90f9","tests/valid/implicit-and-explicit-after.json":"6dcaeaf8ee3479bf2cd5c14eb58970757175aaefab014bce9acb0b85e7bf9dd0","tests/valid/implicit-and-explicit-after.toml":"0599b16822764cdb1c3d3cf53f71186b97afc9f60f8d58358a4a89fe4d9477c3","tests/valid/implicit-and-explicit-before.json":"6dcaeaf8ee3479bf2cd5c14eb58970757175aaefab014bce9acb0b85e7bf9dd0","tests/valid/implicit-and-explicit-before.toml":"33435dddb68144b652ca5f5e0c4c53e4f7b3ca0166f9b944eda55f8d76ed2871","tests/valid/implicit-groups.json":"fc2bb43ec20c8c9148c8a70490b3a054506932c41687222ea11faae47eafb723","tests/valid/implicit-groups.toml":"248b3e8272ec43ce4af872981acde10628eeae73537ed6763a1f4245f5a9610c","tests/valid/integer.json":"0fc2d0cb1fb46d7805c1007b1fa4c46a65b273e56ae9d751df686e81d3a3354f","tests/valid/integer.toml":"74b964eb9561be6aa7266f6034cee1cd0657bdab8043a5ec9da33d9b184345da","tests/valid/key-equals-nospace.json":"b9878ee3585d1b48710a4bc09f2163b910ea71a2bfdaa8f1da68e599e8b30f47","tests/valid/key-equals-nospace.toml":"24cab0d01b67b184d0a737de3a5b5d47b8b69b36203273296d5ef763f7fdcf68","tests/valid/key-space.json":"30be539b01420be5cedc9078b88c3279bbef7c0bdde36ba8249ed8906112d5c7","tests/valid/key-space.toml":"9e9459b8cfebc404cf93d77c2d4082cadcd57165a2f9ce9cb35d1d12dc94a8c0","tests/valid/key-special-chars.json":"8bbebb20660d93efa73707bdb09e87a43c2b31c18f13df6388c701a1bc7cab8c","tests/valid/key-special-chars.toml":"c6cb0ba12d32f03cda4206097a1edb27cd154215d72e1c5791cc4f8dff2270b3","tests/valid/key-with-pound.json":"ea4dd79d0ad2a824bcce5c4c194d7fae82a7584a2ab7c0d83d6ddaae6130973e","tests/valid/key-with-pound.toml":"c334f676e19c01b96111277248654358cc8222fd0639aecaf429407e63b6a2dc","tests/valid/long-float.json":"7e103f56e490aa1b1fe5a762000ceb1f8c599f7d81aa215c90f5da41ab4ba6db","tests/valid/long-float.toml":"4d23f706f2a0d241840f6ea78657820c9c7b904c0c3c16828f8cc2574d7c8761","tests/valid/long-integer.json":"9ed7976639f0c2cd7f112584e2f5d272e92569be7135ea5bb9ba597abaff0767","tests/valid/long-integer.toml":"309f94be7ff5fd6f6dedbd257a1e6c171cb71aa74409ff3f8babda951f89d687","tests/valid/multiline-string.json":"3d67a8b992b85e9a2e58b77a1b76dc29745a9c2b4a362ad517786fed541948d7","tests/valid/multiline-string.toml":"7d6650009eb31a03d5b40b20712ef0157e9b787d9c966e66c38873a34e3b861c","tests/valid/raw-multiline-string.json":"4c95e34497433168cac25eb4132485c3bd13c35cad9d13d7becf7f90469dacca","tests/valid/raw-multiline-string.toml":"c724151024ccde432e0ec0d4ba60a5320d77841008116324c39516b8cbb94f4d","tests/valid/raw-string.json":"19268797aff8dfa28437d6ed8f9d813035f6eee50aade5fc774ba12b3290216b","tests/valid/raw-string.toml":"16510e05d477a0856ebaf38cacd0e9e18f02ab63ac7bd1a2eabbaa47a54d0e49","tests/valid/string-empty.json":"ece7d01326742a46e37d6404175118c0a91a2494f7ba2290bbc1d6f990ddb65b","tests/valid/string-empty.toml":"251e9e4052ede79f6b2462e71f73e0b7c9f5927484f6f77f0cd8b3c839b0c13b","tests/valid/string-escapes.json":"3d516f03cf94d5b5ee6b0887b8d37fdf21152752f049f5922a24adaacb5b8c35","tests/valid/string-escapes.toml":"86b1569e10fec91301709ad747012f0f42395050a2343b42aca450e001120f7a","tests/valid/string-simple.json":"622676e347676cce9f9733210acbd8056ce77a0588772ffd6efb05bb4e81b571","tests/valid/string-simple.toml":"ae74db09acea3be2ccae7f854f7b6f7c874ace9d4d87bf2f437b059a7d38a464","tests/valid/string-with-pound.json":"458a0add71536c1df5e1ed3ee5483c6eb48578abce0b0ebcdf75ea20d41ed6f4","tests/valid/string-with-pound.toml":"1aee397830d9ad2a93d41ee9c435acdbfef3758d1bb7c48bca7424fbbec89466","tests/valid/table-array-implicit.json":"3f7d3cdb468de67bc183162805d9c753ef5772f6f363ac2a26598387a5d991ea","tests/valid/table-array-implicit.toml":"66bcb030899a95e9a25ec44b7c9291b02f80ecbc324061cf1cd93223a2919f21","tests/valid/table-array-many.json":"3f21243eeb71ca3e5657a43559c806e12e3833e9f74c43c0c12aad9b0c853e4c","tests/valid/table-array-many.toml":"8d8ea546f954a81ca149a02147ae5f4bf075151cfcd530e62dcf05a04d843ffb","tests/valid/table-array-nest.json":"0a987d2bf1d5bc85f5c9433f23d389063600682a68538b6e57938a3c572959e4","tests/valid/table-array-nest.toml":"71b9c753bf773f232ac71cb2469a54ee0110ff137829045421edd7c5a64d6b6a","tests/valid/table-array-one.json":"7dc0ea3f7f843f7dc7443e68af43a1e5130a5fbae8a27fb02d8d92fa2487888e","tests/valid/table-array-one.toml":"4c478aea2dd7dfcfda682503b49e610f0fa4ce85a3b3cd0bc9041d4959e3626a","tests/valid/table-empty.json":"11e43e212d87b3b2547a5f2541f4091a3d2f6ba00b2a2004b07e02734e927ea7","tests/valid/table-empty.toml":"24d4941e67d5965d270eaebdb9816b994311e0f2f0e79ef6bb626f362c52842e","tests/valid/table-sub-empty.json":"85cca6d48a5993c4f207c21ed96652af4f50b6936b0807659c75317c1763b6db","tests/valid/table-sub-empty.toml":"ae92e90a806ffefcbf8cda83cb82acf7448f75efa50dcfb5e2384632d36471b3","tests/valid/table-whitespace.json":"ad84ac49a6d13f7c4a8af0e1e71fd7ff2a446aa16a34c21a809a0850dfa76e73","tests/valid/table-whitespace.toml":"2f15dafb263d2771671db299f6202b4b78d293aec1ded7641ec7eb1cb024b52c","tests/valid/table-with-pound.json":"151e76606efe77500cbb0aa8fcf8ccfadb124d533bb79a9caa62e937b826e676","tests/valid/table-with-pound.toml":"a1f86c2e3789cc89500ec1d5eac2ec0bdb94bf445fddc3cab558b5228f3aba56","tests/valid/unicode-escape.json":"ebbf81930fa92ea5822bb1ed808b798731abe5c97e64f6471e1e86878d79037c","tests/valid/unicode-escape.toml":"aa26e55e5526a0d00ad68eca774d5c43cbcdf24ae753e0219bf3ab31b9e628b8","tests/valid/unicode-literal.json":"1dd42756384b954955815dc3e906db64b4cd2c0c094f9b3c86633d1652d6d79d","tests/valid/unicode-literal.toml":"bffc6c3d4757de31d0cbfd7b8dc591edd2910fe8a4e1c46bbee422dddc841003"},"package":"736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4"} \ No newline at end of file diff --git a/third_party/rust/toml/.cargo-ok b/third_party/rust/toml/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/toml/.gitignore b/third_party/rust/toml/.gitignore new file mode 100644 index 000000000000..a9d37c560c6a --- /dev/null +++ b/third_party/rust/toml/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/third_party/rust/toml/.travis.yml b/third_party/rust/toml/.travis.yml new file mode 100644 index 000000000000..cf28e867d3e8 --- /dev/null +++ b/third_party/rust/toml/.travis.yml @@ -0,0 +1,31 @@ +language: rust +rust: + - stable + - beta + - nightly +sudo: false +before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH +script: + - cargo build --verbose + - cargo build --verbose --no-default-features + - cargo build --verbose --features serde --no-default-features + - cargo test --verbose --features serde + - cargo test --verbose --manifest-path serde-tests/Cargo.toml + - rustdoc --test README.md -L target + - cargo doc --no-deps +after_success: + - travis-cargo --only nightly doc-upload + - travis-cargo coveralls --no-sudo +env: + global: + secure: LZMkQQJT5LqLQQ8JyakjvHNqqMPy8lm/SyC+H5cKUVI/xk7xRuti4eKY937N8uSmbff2m9ZYlG6cNwIOfk/nWn8YsqxA8Wg/xugubWzqGuqu+NQ4IZVa7INT2Fiqyk5SPCh8B5fo2x7OBJ24SCkWb2p8bEWAuW8XdZZOdmi3H2I= +notifications: + email: + on_success: never +addons: + apt: + packages: + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev diff --git a/third_party/rust/toml/Cargo.toml b/third_party/rust/toml/Cargo.toml new file mode 100644 index 000000000000..0e4724216648 --- /dev/null +++ b/third_party/rust/toml/Cargo.toml @@ -0,0 +1,26 @@ +[package] + +name = "toml" +version = "0.2.1" +authors = ["Alex Crichton "] +license = "MIT/Apache-2.0" +readme = "README.md" +keywords = ["encoding"] +repository = "https://github.com/alexcrichton/toml-rs" +homepage = "https://github.com/alexcrichton/toml-rs" +documentation = "http://alexcrichton.com/toml-rs" +description = """ +A native Rust encoder and decoder of TOML-formatted files and streams. Provides +implementations of the standard Encodable/Decodable traits for TOML data to +facilitate deserializing and serializing Rust structures. +""" + +[dependencies] +rustc-serialize = { optional = true, version = "0.3.0" } +serde = { optional = true, version = "0.8" } + +[features] +default = ["rustc-serialize"] + +[dev-dependencies] +rustc-serialize = "0.3" diff --git a/third_party/rust/toml/LICENSE-APACHE b/third_party/rust/toml/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/toml/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/toml/LICENSE-MIT b/third_party/rust/toml/LICENSE-MIT new file mode 100644 index 000000000000..39e0ed660215 --- /dev/null +++ b/third_party/rust/toml/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 Alex Crichton + +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. diff --git a/third_party/rust/toml/README.md b/third_party/rust/toml/README.md new file mode 100644 index 000000000000..d8520bb3798d --- /dev/null +++ b/third_party/rust/toml/README.md @@ -0,0 +1,26 @@ +# toml-rs + +[![Build Status](https://travis-ci.org/alexcrichton/toml-rs.svg?branch=master)](https://travis-ci.org/alexcrichton/toml-rs) +[![Coverage Status](https://coveralls.io/repos/alexcrichton/toml-rs/badge.svg?branch=master&service=github)](https://coveralls.io/github/alexcrichton/toml-rs?branch=master) + +[Documentation](http://alexcrichton.com/toml-rs) + +A [TOML][toml] decoder and encoder for Rust. This library is currently compliant with +the v0.4.0 version of TOML. This library will also likely continue to stay up to +date with the TOML specification as changes happen. + +[toml]: https://github.com/toml-lang/toml + +```toml +# Cargo.toml +[dependencies] +toml = "0.2" +``` + +# License + +`toml-rs` is primarily distributed under the terms of both the MIT license and +the Apache License (Version 2.0), with portions covered by various BSD-like +licenses. + +See LICENSE-APACHE, and LICENSE-MIT for details. diff --git a/third_party/rust/toml/examples/toml2json.rs b/third_party/rust/toml/examples/toml2json.rs new file mode 100644 index 000000000000..0d406804a38b --- /dev/null +++ b/third_party/rust/toml/examples/toml2json.rs @@ -0,0 +1,57 @@ +#![deny(warnings)] + +extern crate toml; +extern crate rustc_serialize; + +use std::fs::File; +use std::env; +use std::io; +use std::io::prelude::*; + +use toml::Value; +use rustc_serialize::json::Json; + +fn main() { + let mut args = env::args(); + let mut input = String::new(); + let filename = if args.len() > 1 { + let name = args.nth(1).unwrap(); + File::open(&name).and_then(|mut f| { + f.read_to_string(&mut input) + }).unwrap(); + name + } else { + io::stdin().read_to_string(&mut input).unwrap(); + "".to_string() + }; + + let mut parser = toml::Parser::new(&input); + let toml = match parser.parse() { + Some(toml) => toml, + None => { + for err in &parser.errors { + let (loline, locol) = parser.to_linecol(err.lo); + let (hiline, hicol) = parser.to_linecol(err.hi); + println!("{}:{}:{}-{}:{} error: {}", + filename, loline, locol, hiline, hicol, err.desc); + } + return + } + }; + let json = convert(Value::Table(toml)); + println!("{}", json.pretty()); +} + +fn convert(toml: Value) -> Json { + match toml { + Value::String(s) => Json::String(s), + Value::Integer(i) => Json::I64(i), + Value::Float(f) => Json::F64(f), + Value::Boolean(b) => Json::Boolean(b), + Value::Array(arr) => Json::Array(arr.into_iter().map(convert).collect()), + Value::Table(table) => Json::Object(table.into_iter().map(|(k, v)| { + (k, convert(v)) + }).collect()), + Value::Datetime(dt) => Json::String(dt), + } +} diff --git a/third_party/rust/toml/src/decoder/mod.rs b/third_party/rust/toml/src/decoder/mod.rs new file mode 100644 index 000000000000..51a9ea214e4b --- /dev/null +++ b/third_party/rust/toml/src/decoder/mod.rs @@ -0,0 +1,240 @@ +use std::error; +use std::fmt; + +use std::collections::{btree_map, BTreeMap}; +use std::iter::Peekable; + +use Value; +use self::DecodeErrorKind::*; + +#[cfg(feature = "rustc-serialize")] mod rustc_serialize; +#[cfg(feature = "serde")] mod serde; + +/// A structure to transform TOML values into Rust values. +/// +/// This decoder implements the serialization `Decoder` interface, allowing +/// `Decodable` types to be generated by this decoder. The input is any +/// arbitrary TOML value. +pub struct Decoder { + /// The TOML value left over after decoding. This can be used to inspect + /// whether fields were decoded or not. + pub toml: Option, + cur_field: Option, + + // These aren't used if serde is in use + #[cfg_attr(feature = "serde", allow(dead_code))] + cur_map: Peekable>, + #[cfg_attr(feature = "serde", allow(dead_code))] + leftover_map: ::Table, +} + +/// Description for errors which can occur while decoding a type. +#[derive(PartialEq, Debug)] +pub struct DecodeError { + /// Field that this error applies to. + pub field: Option, + /// The type of error which occurred while decoding, + pub kind: DecodeErrorKind, +} + +/// Enumeration of possible errors which can occur while decoding a structure. +#[derive(PartialEq, Debug)] +pub enum DecodeErrorKind { + /// An error flagged by the application, e.g. value out of range + ApplicationError(String), + /// A field was expected, but none was found. + ExpectedField(/* type */ Option<&'static str>), + /// A field was found, but it was not an expected one. + UnknownField, + /// A field was found, but it had the wrong type. + ExpectedType(/* expected */ &'static str, /* found */ &'static str), + /// The nth map key was expected, but none was found. + ExpectedMapKey(usize), + /// The nth map element was expected, but none was found. + ExpectedMapElement(usize), + /// An enum decoding was requested, but no variants were supplied + NoEnumVariants, + /// The unit type was being decoded, but a non-zero length string was found + NilTooLong, + /// There was an error with the syntactical structure of the TOML. + SyntaxError, + /// A custom error was generated when decoding. + CustomError(String), + /// The end of the TOML input was reached too soon + EndOfStream, + /// Produced by serde ... + InvalidType(&'static str), +} + +/// Decodes a TOML value into a decodable type. +/// +/// This function will consume the given TOML value and attempt to decode it +/// into the type specified. If decoding fails, `None` will be returned. If a +/// finer-grained error is desired, then it is recommended to use `Decodable` +/// directly. +#[cfg(feature = "rustc-serialize")] +pub fn decode(toml: Value) -> Option { + ::rustc_serialize::Decodable::decode(&mut Decoder::new(toml)).ok() +} + +/// Decodes a TOML value into a decodable type. +/// +/// This function will consume the given TOML value and attempt to decode it +/// into the type specified. If decoding fails, `None` will be returned. If a +/// finer-grained error is desired, then it is recommended to use `Decodable` +/// directly. +#[cfg(all(not(feature = "rustc-serialize"), feature = "serde"))] +pub fn decode(toml: Value) -> Option { + ::serde::Deserialize::deserialize(&mut Decoder::new(toml)).ok() +} + +/// Decodes a string into a toml-encoded value. +/// +/// This function will parse the given string into a TOML value, and then parse +/// the TOML value into the desired type. If any error occurs, `None` is +/// returned. +/// +/// If more fine-grained errors are desired, these steps should be driven +/// manually. +#[cfg(feature = "rustc-serialize")] +pub fn decode_str(s: &str) -> Option { + ::Parser::new(s).parse().and_then(|t| decode(Value::Table(t))) +} + +/// Decodes a string into a toml-encoded value. +/// +/// This function will parse the given string into a TOML value, and then parse +/// the TOML value into the desired type. If any error occurs, `None` is +/// returned. +/// +/// If more fine-grained errors are desired, these steps should be driven +/// manually. +#[cfg(all(not(feature = "rustc-serialize"), feature = "serde"))] +pub fn decode_str(s: &str) -> Option { + ::Parser::new(s).parse().and_then(|t| decode(Value::Table(t))) +} + +impl Decoder { + /// Creates a new decoder, consuming the TOML value to decode. + /// + /// This decoder can be passed to the `Decodable` methods or driven + /// manually. + pub fn new(toml: Value) -> Decoder { + Decoder::new_empty(Some(toml), None) + } + + fn sub_decoder(&self, toml: Option, field: &str) -> Decoder { + let cur_field = if field.is_empty() { + self.cur_field.clone() + } else { + match self.cur_field { + None => Some(field.to_string()), + Some(ref s) => Some(format!("{}.{}", s, field)) + } + }; + Decoder::new_empty(toml, cur_field) + } + + fn new_empty(toml: Option, cur_field: Option) -> Decoder { + Decoder { + toml: toml, + cur_field: cur_field, + leftover_map: BTreeMap::new(), + cur_map: BTreeMap::new().into_iter().peekable(), + } + } + + fn err(&self, kind: DecodeErrorKind) -> DecodeError { + DecodeError { + field: self.cur_field.clone(), + kind: kind, + } + } + + fn mismatch(&self, expected: &'static str, + found: &Option) -> DecodeError{ + match *found { + Some(ref val) => self.err(ExpectedType(expected, val.type_str())), + None => self.err(ExpectedField(Some(expected))), + } + } +} + +impl fmt::Display for DecodeError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + try!(match self.kind { + ApplicationError(ref err) => { + write!(f, "{}", err) + } + ExpectedField(expected_type) => { + match expected_type { + Some("table") => write!(f, "expected a section"), + Some(e) => write!(f, "expected a value of type `{}`", e), + None => write!(f, "expected a value"), + } + } + UnknownField => write!(f, "unknown field"), + ExpectedType(expected, found) => { + fn humanize(s: &str) -> String { + if s == "section" { + "a section".to_string() + } else { + format!("a value of type `{}`", s) + } + } + write!(f, "expected {}, but found {}", + humanize(expected), + humanize(found)) + } + ExpectedMapKey(idx) => { + write!(f, "expected at least {} keys", idx + 1) + } + ExpectedMapElement(idx) => { + write!(f, "expected at least {} elements", idx + 1) + } + NoEnumVariants => { + write!(f, "expected an enum variant to decode to") + } + NilTooLong => { + write!(f, "expected 0-length string") + } + SyntaxError => { + write!(f, "syntax error") + } + EndOfStream => { + write!(f, "end of stream") + } + InvalidType(s) => { + write!(f, "invalid type: {}", s) + } + CustomError(ref s) => { + write!(f, "custom error: {}", s) + } + }); + match self.field { + Some(ref s) => { + write!(f, " for the key `{}`", s) + } + None => Ok(()) + } + } +} + +impl error::Error for DecodeError { + fn description(&self) -> &str { + match self.kind { + ApplicationError(ref s) => &**s, + ExpectedField(..) => "expected a field", + UnknownField => "found an unknown field", + ExpectedType(..) => "expected a type", + ExpectedMapKey(..) => "expected a map key", + ExpectedMapElement(..) => "expected a map element", + NoEnumVariants => "no enum variants to decode to", + NilTooLong => "nonzero length string representing nil", + SyntaxError => "syntax error", + EndOfStream => "end of stream", + InvalidType(..) => "invalid type", + CustomError(..) => "custom error", + } + } +} diff --git a/third_party/rust/toml/src/decoder/rustc_serialize.rs b/third_party/rust/toml/src/decoder/rustc_serialize.rs new file mode 100644 index 000000000000..f8506638fe9b --- /dev/null +++ b/third_party/rust/toml/src/decoder/rustc_serialize.rs @@ -0,0 +1,371 @@ +use rustc_serialize; +use std::mem; +use std::collections::BTreeMap; + +use super::{Decoder, DecodeError}; +use super::DecodeErrorKind::*; +use Value; + +impl rustc_serialize::Decoder for Decoder { + type Error = DecodeError; + fn read_nil(&mut self) -> Result<(), DecodeError> { + match self.toml { + Some(Value::String(ref s)) if s.is_empty() => {} + Some(Value::String(..)) => return Err(self.err(NilTooLong)), + ref found => return Err(self.mismatch("string", found)), + } + self.toml.take(); + Ok(()) + } + fn read_usize(&mut self) -> Result { + self.read_i64().map(|i| i as usize) + } + fn read_u64(&mut self) -> Result { + self.read_i64().map(|i| i as u64) + } + fn read_u32(&mut self) -> Result { + self.read_i64().map(|i| i as u32) + } + fn read_u16(&mut self) -> Result { + self.read_i64().map(|i| i as u16) + } + fn read_u8(&mut self) -> Result { + self.read_i64().map(|i| i as u8) + } + fn read_isize(&mut self) -> Result { + self.read_i64().map(|i| i as isize) + } + fn read_i64(&mut self) -> Result { + match self.toml { + Some(Value::Integer(i)) => { self.toml.take(); Ok(i) } + ref found => Err(self.mismatch("integer", found)), + } + } + fn read_i32(&mut self) -> Result { + self.read_i64().map(|i| i as i32) + } + fn read_i16(&mut self) -> Result { + self.read_i64().map(|i| i as i16) + } + fn read_i8(&mut self) -> Result { + self.read_i64().map(|i| i as i8) + } + fn read_bool(&mut self) -> Result { + match self.toml { + Some(Value::Boolean(b)) => { self.toml.take(); Ok(b) } + ref found => Err(self.mismatch("bool", found)), + } + } + fn read_f64(&mut self) -> Result { + match self.toml { + Some(Value::Float(f)) => { self.toml.take(); Ok(f) }, + ref found => Err(self.mismatch("float", found)), + } + } + fn read_f32(&mut self) -> Result { + self.read_f64().map(|f| f as f32) + } + fn read_char(&mut self) -> Result { + let ch = match self.toml { + Some(Value::String(ref s)) if s.chars().count() == 1 => + s.chars().next().unwrap(), + ref found => return Err(self.mismatch("string", found)), + }; + self.toml.take(); + Ok(ch) + } + fn read_str(&mut self) -> Result { + match self.toml.take() { + Some(Value::String(s)) => Ok(s), + found => { + let err = Err(self.mismatch("string", &found)); + self.toml = found; + err + } + } + } + + // Compound types: + fn read_enum(&mut self, _name: &str, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + f(self) + } + + fn read_enum_variant(&mut self, names: &[&str], mut f: F) + -> Result + where F: FnMut(&mut Decoder, usize) -> Result + { + // When decoding enums, this crate takes the strategy of trying to + // decode the current TOML as all of the possible variants, returning + // success on the first one that succeeds. + // + // Note that fidelity of the errors returned here is a little nebulous, + // but we try to return the error that had the relevant field as the + // longest field. This way we hopefully match an error against what was + // most likely being written down without losing too much info. + let mut first_error = None::; + for i in 0..names.len() { + let mut d = self.sub_decoder(self.toml.clone(), ""); + match f(&mut d, i) { + Ok(t) => { + self.toml = d.toml; + return Ok(t) + } + Err(e) => { + if let Some(ref first) = first_error { + let my_len = e.field.as_ref().map(|s| s.len()); + let first_len = first.field.as_ref().map(|s| s.len()); + if my_len <= first_len { + continue + } + } + first_error = Some(e); + } + } + } + Err(first_error.unwrap_or_else(|| self.err(NoEnumVariants))) + } + fn read_enum_variant_arg(&mut self, _a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + f(self) + } + + fn read_enum_struct_variant(&mut self, _names: &[&str], _f: F) + -> Result + where F: FnMut(&mut Decoder, usize) -> Result + { + panic!() + } + fn read_enum_struct_variant_field(&mut self, + _f_name: &str, + _f_idx: usize, + _f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + panic!() + } + + fn read_struct(&mut self, _s_name: &str, _len: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + match self.toml { + Some(Value::Table(..)) => { + let ret = try!(f(self)); + match self.toml { + Some(Value::Table(ref t)) if t.is_empty() => {} + _ => return Ok(ret) + } + self.toml.take(); + Ok(ret) + } + ref found => Err(self.mismatch("table", found)), + } + } + fn read_struct_field(&mut self, f_name: &str, _f_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + let field = f_name.to_string(); + let toml = match self.toml { + Some(Value::Table(ref mut table)) => { + table.remove(&field) + .or_else(|| table.remove(&f_name.replace("_", "-"))) + }, + ref found => return Err(self.mismatch("table", found)), + }; + let mut d = self.sub_decoder(toml, f_name); + let ret = try!(f(&mut d)); + if let Some(value) = d.toml { + if let Some(Value::Table(ref mut table)) = self.toml { + table.insert(field, value); + } + } + Ok(ret) + } + + fn read_tuple(&mut self, tuple_len: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + self.read_seq(move |d, len| { + assert!(len == tuple_len, + "expected tuple of length `{}`, found tuple \ + of length `{}`", tuple_len, len); + f(d) + }) + } + fn read_tuple_arg(&mut self, a_idx: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + self.read_seq_elt(a_idx, f) + } + + fn read_tuple_struct(&mut self, _s_name: &str, _len: usize, _f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + panic!() + } + fn read_tuple_struct_arg(&mut self, _a_idx: usize, _f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + panic!() + } + + // Specialized types: + fn read_option(&mut self, mut f: F) + -> Result + where F: FnMut(&mut Decoder, bool) -> Result + { + match self.toml { + Some(..) => f(self, true), + None => f(self, false), + } + } + + fn read_seq(&mut self, f: F) -> Result + where F: FnOnce(&mut Decoder, usize) -> Result + { + let len = match self.toml { + Some(Value::Array(ref arr)) => arr.len(), + None => 0, + ref found => return Err(self.mismatch("array", found)), + }; + let ret = try!(f(self, len)); + match self.toml { + Some(Value::Array(ref mut arr)) => { + arr.retain(|slot| slot.as_integer() != Some(0)); + if !arr.is_empty() { return Ok(ret) } + } + _ => return Ok(ret) + } + self.toml.take(); + Ok(ret) + } + fn read_seq_elt(&mut self, idx: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + let toml = match self.toml { + Some(Value::Array(ref mut arr)) => { + mem::replace(&mut arr[idx], Value::Integer(0)) + } + ref found => return Err(self.mismatch("array", found)), + }; + let mut d = self.sub_decoder(Some(toml), ""); + let ret = try!(f(&mut d)); + if let Some(toml) = d.toml { + if let Some(Value::Array(ref mut arr)) = self.toml { + arr[idx] = toml; + } + } + Ok(ret) + } + + fn read_map(&mut self, f: F) + -> Result + where F: FnOnce(&mut Decoder, usize) -> Result + { + let map = match self.toml.take() { + Some(Value::Table(table)) => table, + found => { + self.toml = found; + return Err(self.mismatch("table", &self.toml)) + } + }; + let amt = map.len(); + let prev_iter = mem::replace(&mut self.cur_map, + map.into_iter().peekable()); + let prev_map = mem::replace(&mut self.leftover_map, BTreeMap::new()); + let ret = try!(f(self, amt)); + let leftover = mem::replace(&mut self.leftover_map, prev_map); + self.cur_map = prev_iter; + if !leftover.is_empty() { + self.toml = Some(Value::Table(leftover)); + } + Ok(ret) + } + fn read_map_elt_key(&mut self, idx: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + let key = match self.cur_map.peek().map(|p| p.0.clone()) { + Some(k) => k, + None => return Err(self.err(ExpectedMapKey(idx))), + }; + let val = Value::String(key.clone()); + f(&mut self.sub_decoder(Some(val), &key)) + } + fn read_map_elt_val(&mut self, idx: usize, f: F) + -> Result + where F: FnOnce(&mut Decoder) -> Result + { + match self.cur_map.next() { + Some((key, value)) => { + let mut d = self.sub_decoder(Some(value), &key); + let ret = f(&mut d); + if let Some(toml) = d.toml.take() { + self.leftover_map.insert(key, toml); + } + ret + } + None => Err(self.err(ExpectedMapElement(idx))), + } + } + + fn error(&mut self, err: &str) -> DecodeError { + DecodeError { + field: self.cur_field.clone(), + kind: ApplicationError(err.to_string()) + } + } +} + +#[cfg(test)] +mod tests { + use rustc_serialize::Decodable; + use std::collections::HashMap; + + use {Parser, Decoder, Value}; + + #[test] + fn bad_enum_chooses_longest_error() { + #[derive(RustcDecodable)] + #[allow(dead_code)] + struct Foo { + wut: HashMap, + } + + #[derive(RustcDecodable)] + enum Bar { + Simple(String), + Detailed(Baz), + } + + #[derive(RustcDecodable, Debug)] + struct Baz { + features: Vec, + } + + let s = r#" + [wut] + a = { features = "" } + "#; + let v = Parser::new(s).parse().unwrap(); + let mut d = Decoder::new(Value::Table(v)); + let err = match Foo::decode(&mut d) { + Ok(_) => panic!("expected error"), + Err(e) => e, + }; + assert_eq!(err.field.as_ref().unwrap(), "wut.a.features"); + + } +} diff --git a/third_party/rust/toml/src/decoder/serde.rs b/third_party/rust/toml/src/decoder/serde.rs new file mode 100644 index 000000000000..81a2bae97e28 --- /dev/null +++ b/third_party/rust/toml/src/decoder/serde.rs @@ -0,0 +1,773 @@ +use serde::de; +use Value; +use super::{Decoder, DecodeError, DecodeErrorKind}; +use std::collections::BTreeMap; + +macro_rules! forward_to_deserialize { + ($( + $name:ident ( $( $arg:ident : $ty:ty ),* ); + )*) => { + $( + forward_to_deserialize!{ + func: $name ( $( $arg: $ty ),* ); + } + )* + }; + + (func: deserialize_enum ( $( $arg:ident : $ty:ty ),* );) => { + fn deserialize_enum( + &mut self, + $(_: $ty,)* + _visitor: V, + ) -> ::std::result::Result + where V: ::serde::de::EnumVisitor + { + Err(::serde::de::Error::invalid_type(::serde::de::Type::Enum)) + } + }; + + (func: $name:ident ( $( $arg:ident : $ty:ty ),* );) => { + #[inline] + fn $name( + &mut self, + $(_: $ty,)* + visitor: V, + ) -> ::std::result::Result + where V: ::serde::de::Visitor + { + self.deserialize(visitor) + } + }; +} + +impl de::Deserializer for Decoder { + type Error = DecodeError; + + fn deserialize(&mut self, mut visitor: V) + -> Result + where V: de::Visitor + { + match self.toml.take() { + Some(Value::String(s)) => visitor.visit_string(s), + Some(Value::Integer(i)) => visitor.visit_i64(i), + Some(Value::Float(f)) => visitor.visit_f64(f), + Some(Value::Boolean(b)) => visitor.visit_bool(b), + Some(Value::Datetime(s)) => visitor.visit_string(s), + Some(Value::Array(a)) => { + let len = a.len(); + let iter = a.into_iter(); + visitor.visit_seq(SeqDeserializer::new(iter, len, &mut self.toml)) + } + Some(Value::Table(t)) => { + visitor.visit_map(MapVisitor { + iter: t.into_iter(), + de: self, + key: None, + value: None, + }) + } + None => Err(self.err(DecodeErrorKind::EndOfStream)), + } + } + + fn deserialize_bool(&mut self, mut visitor: V) + -> Result + where V: de::Visitor + { + match self.toml.take() { + Some(Value::Boolean(b)) => visitor.visit_bool(b), + ref found => Err(self.mismatch("bool", found)), + } + } + + fn deserialize_i8(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_i16(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_i32(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_i64(&mut self, mut visitor: V) + -> Result + where V: de::Visitor + { + match self.toml.take() { + Some(Value::Integer(f)) => visitor.visit_i64(f), + ref found => Err(self.mismatch("integer", found)), + } + } + + fn deserialize_isize(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u8(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u16(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u32(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u64(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_usize(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_f32(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_f64(visitor) + } + + fn deserialize_f64(&mut self, mut visitor: V) + -> Result + where V: de::Visitor + { + match self.toml.take() { + Some(Value::Float(f)) => visitor.visit_f64(f), + ref found => Err(self.mismatch("float", found)), + } + } + + fn deserialize_str(&mut self, mut visitor: V) + -> Result + where V: de::Visitor, + { + match self.toml.take() { + Some(Value::String(s)) => visitor.visit_string(s), + ref found => Err(self.mismatch("string", found)), + } + } + + fn deserialize_string(&mut self, visitor: V) + -> Result + where V: de::Visitor, + { + self.deserialize_str(visitor) + } + + fn deserialize_char(&mut self, mut visitor: V) + -> Result + where V: de::Visitor + { + match self.toml.take() { + Some(Value::String(ref s)) if s.chars().count() == 1 => { + visitor.visit_char(s.chars().next().unwrap()) + } + ref found => return Err(self.mismatch("string", found)), + } + } + + fn deserialize_option(&mut self, mut visitor: V) + -> Result + where V: de::Visitor + { + if self.toml.is_none() { + visitor.visit_none() + } else { + visitor.visit_some(self) + } + } + + fn deserialize_seq(&mut self, mut visitor: V) + -> Result + where V: de::Visitor, + { + if self.toml.is_none() { + let iter = None::.into_iter(); + visitor.visit_seq(de::value::SeqDeserializer::new(iter, 0)) + } else { + self.deserialize(visitor) + } + } + + fn deserialize_map(&mut self, mut visitor: V) + -> Result + where V: de::Visitor, + { + match self.toml.take() { + Some(Value::Table(t)) => { + visitor.visit_map(MapVisitor { + iter: t.into_iter(), + de: self, + key: None, + value: None, + }) + } + ref found => Err(self.mismatch("table", found)), + } + } + + fn deserialize_enum(&mut self, + _enum: &str, + variants: &[&str], + mut visitor: V) -> Result + where V: de::EnumVisitor, + { + // When decoding enums, this crate takes the strategy of trying to + // decode the current TOML as all of the possible variants, returning + // success on the first one that succeeds. + // + // Note that fidelity of the errors returned here is a little nebulous, + // but we try to return the error that had the relevant field as the + // longest field. This way we hopefully match an error against what was + // most likely being written down without losing too much info. + let mut first_error = None::; + + for variant in 0..variants.len() { + let mut de = VariantVisitor { + de: self.sub_decoder(self.toml.clone(), ""), + variant: variant, + }; + + match visitor.visit(&mut de) { + Ok(value) => { + self.toml = de.de.toml; + return Ok(value); + } + Err(e) => { + if let Some(ref first) = first_error { + let my_len = e.field.as_ref().map(|s| s.len()); + let first_len = first.field.as_ref().map(|s| s.len()); + if my_len <= first_len { + continue + } + } + first_error = Some(e); + } + } + } + + Err(first_error.unwrap_or_else(|| self.err(DecodeErrorKind::NoEnumVariants))) + } + + // When #[derive(Deserialize)] encounters an unknown struct field it will + // call this method (somehow), and we want to preserve all unknown struct + // fields to return them upwards (to warn about unused keys), so we override + // that here to not tamper with our own internal state. + fn deserialize_ignored_any(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + use serde::de::value::ValueDeserializer; + let mut d = <() as ValueDeserializer>::into_deserializer(()); + d.deserialize(visitor) + } + + fn deserialize_bytes(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_seq_fixed_size(&mut self, _len: usize, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_newtype_struct(&mut self, _name: &'static str, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_tuple_struct(&mut self, + _name: &'static str, + _len: usize, + visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_struct(&mut self, + _name: &'static str, + _fields: &'static [&'static str], + visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_map(visitor) + } + + fn deserialize_tuple(&mut self, + _len: usize, + visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + forward_to_deserialize!{ + deserialize_unit(); + deserialize_unit_struct(name: &'static str); + deserialize_struct_field(); + } +} + +struct VariantVisitor { + de: Decoder, + variant: usize, +} + +impl de::VariantVisitor for VariantVisitor { + type Error = DecodeError; + + fn visit_variant(&mut self) -> Result + where V: de::Deserialize + { + use serde::de::value::ValueDeserializer; + + let mut de = self.variant.into_deserializer(); + + de::Deserialize::deserialize(&mut de) + } + + fn visit_unit(&mut self) -> Result<(), DecodeError> { + de::Deserialize::deserialize(&mut self.de) + } + + fn visit_newtype(&mut self) -> Result + where T: de::Deserialize, + { + de::Deserialize::deserialize(&mut self.de) + } + + fn visit_tuple(&mut self, + _len: usize, + visitor: V) -> Result + where V: de::Visitor, + { + de::Deserializer::deserialize(&mut self.de, visitor) + } + + fn visit_struct(&mut self, + _fields: &'static [&'static str], + visitor: V) -> Result + where V: de::Visitor, + { + de::Deserializer::deserialize(&mut self.de, visitor) + } +} + +struct SeqDeserializer<'a, I> { + iter: I, + len: usize, + toml: &'a mut Option, +} + +impl<'a, I> SeqDeserializer<'a, I> where I: Iterator { + fn new(iter: I, len: usize, toml: &'a mut Option) -> Self { + SeqDeserializer { + iter: iter, + len: len, + toml: toml, + } + } + + fn put_value_back(&mut self, v: Value) { + *self.toml = self.toml.take().or(Some(Value::Array(Vec::new()))); + match self.toml.as_mut().unwrap() { + &mut Value::Array(ref mut a) => { + a.push(v); + }, + _ => unreachable!(), + } + } +} + +impl<'a, I> de::Deserializer for SeqDeserializer<'a, I> + where I: Iterator, +{ + type Error = DecodeError; + + fn deserialize(&mut self, mut visitor: V) + -> Result + where V: de::Visitor, + { + visitor.visit_seq(self) + } + + forward_to_deserialize!{ + deserialize_bool(); + deserialize_usize(); + deserialize_u8(); + deserialize_u16(); + deserialize_u32(); + deserialize_u64(); + deserialize_isize(); + deserialize_i8(); + deserialize_i16(); + deserialize_i32(); + deserialize_i64(); + deserialize_f32(); + deserialize_f64(); + deserialize_char(); + deserialize_str(); + deserialize_string(); + deserialize_unit(); + deserialize_option(); + deserialize_seq(); + deserialize_seq_fixed_size(len: usize); + deserialize_bytes(); + deserialize_map(); + deserialize_unit_struct(name: &'static str); + deserialize_newtype_struct(name: &'static str); + deserialize_tuple_struct(name: &'static str, len: usize); + deserialize_struct(name: &'static str, fields: &'static [&'static str]); + deserialize_struct_field(); + deserialize_tuple(len: usize); + deserialize_enum(name: &'static str, variants: &'static [&'static str]); + deserialize_ignored_any(); + } +} + +impl<'a, I> de::SeqVisitor for SeqDeserializer<'a, I> + where I: Iterator +{ + type Error = DecodeError; + + fn visit(&mut self) -> Result, DecodeError> + where V: de::Deserialize + { + match self.iter.next() { + Some(value) => { + self.len -= 1; + let mut de = Decoder::new(value); + let v = try!(de::Deserialize::deserialize(&mut de)); + if let Some(t) = de.toml { + self.put_value_back(t); + } + Ok(Some(v)) + } + None => Ok(None), + } + } + + fn end(&mut self) -> Result<(), DecodeError> { + if self.len == 0 { + Ok(()) + } else { + Err(de::Error::end_of_stream()) + } + } + + fn size_hint(&self) -> (usize, Option) { + (self.len, Some(self.len)) + } +} + +impl de::Error for DecodeError { + fn custom>(msg: T) -> DecodeError { + DecodeError { + field: None, + kind: DecodeErrorKind::CustomError(msg.into()), + } + } + fn end_of_stream() -> DecodeError { + DecodeError { field: None, kind: DecodeErrorKind::EndOfStream } + } + fn missing_field(name: &'static str) -> DecodeError { + DecodeError { + field: Some(name.to_string()), + kind: DecodeErrorKind::ExpectedField(None), + } + } + fn unknown_field(name: &str) -> DecodeError { + DecodeError { + field: Some(name.to_string()), + kind: DecodeErrorKind::UnknownField, + } + } + fn invalid_type(ty: de::Type) -> Self { + DecodeError { + field: None, + kind: DecodeErrorKind::InvalidType(match ty { + de::Type::Bool => "bool", + de::Type::Usize | + de::Type::U8 | + de::Type::U16 | + de::Type::U32 | + de::Type::U64 | + de::Type::Isize | + de::Type::I8 | + de::Type::I16 | + de::Type::I32 | + de::Type::I64 => "integer", + de::Type::F32 | + de::Type::F64 => "float", + de::Type::Char | + de::Type::Str | + de::Type::String => "string", + de::Type::Seq => "array", + de::Type::Struct | + de::Type::Map => "table", + de::Type::Unit => "Unit", + de::Type::Option => "Option", + de::Type::UnitStruct => "UnitStruct", + de::Type::NewtypeStruct => "NewtypeStruct", + de::Type::TupleStruct => "TupleStruct", + de::Type::FieldName => "FieldName", + de::Type::Tuple => "Tuple", + de::Type::Enum => "Enum", + de::Type::VariantName => "VariantName", + de::Type::StructVariant => "StructVariant", + de::Type::TupleVariant => "TupleVariant", + de::Type::UnitVariant => "UnitVariant", + de::Type::Bytes => "Bytes", + }) + } + } +} + +struct MapVisitor<'a, I> { + iter: I, + de: &'a mut Decoder, + key: Option, + value: Option, +} + +impl<'a, I> MapVisitor<'a, I> { + fn put_value_back(&mut self, v: Value) { + self.de.toml = self.de.toml.take().or_else(|| { + Some(Value::Table(BTreeMap::new())) + }); + + match self.de.toml.as_mut().unwrap() { + &mut Value::Table(ref mut t) => { + t.insert(self.key.take().unwrap(), v); + }, + _ => unreachable!(), + } + } +} + +impl<'a, I> de::MapVisitor for MapVisitor<'a, I> + where I: Iterator +{ + type Error = DecodeError; + + fn visit_key(&mut self) -> Result, DecodeError> + where K: de::Deserialize + { + while let Some((k, v)) = self.iter.next() { + let mut dec = self.de.sub_decoder(Some(Value::String(k.clone())), &k); + self.key = Some(k); + + match de::Deserialize::deserialize(&mut dec) { + Ok(val) => { + self.value = Some(v); + return Ok(Some(val)) + } + + // If this was an unknown field, then we put the toml value + // back into the map and keep going. + Err(DecodeError {kind: DecodeErrorKind::UnknownField, ..}) => { + self.put_value_back(v); + } + + Err(e) => return Err(e), + } + } + Ok(None) + } + + fn visit_value(&mut self) -> Result + where V: de::Deserialize + { + match self.value.take() { + Some(t) => { + let mut dec = { + // Borrowing the key here because Rust doesn't have + // non-lexical borrows yet. + let key = match self.key { + Some(ref key) => &**key, + None => "" + }; + + self.de.sub_decoder(Some(t), key) + }; + let v = try!(de::Deserialize::deserialize(&mut dec)); + if let Some(t) = dec.toml { + self.put_value_back(t); + } + Ok(v) + }, + None => Err(de::Error::end_of_stream()) + } + } + + fn end(&mut self) -> Result<(), DecodeError> { + if let Some(v) = self.value.take() { + self.put_value_back(v); + } + while let Some((k, v)) = self.iter.next() { + self.key = Some(k); + self.put_value_back(v); + } + Ok(()) + } + + fn missing_field(&mut self, field_name: &'static str) + -> Result where V: de::Deserialize { + // See if the type can deserialize from a unit. + match de::Deserialize::deserialize(&mut UnitDeserializer) { + Err(DecodeError { + kind: DecodeErrorKind::InvalidType(..), + field, + }) => Err(DecodeError { + field: field.or(Some(field_name.to_string())), + kind: DecodeErrorKind::ExpectedField(None), + }), + v => v, + } + } +} + +struct UnitDeserializer; + +impl de::Deserializer for UnitDeserializer { + type Error = DecodeError; + + fn deserialize(&mut self, mut visitor: V) + -> Result + where V: de::Visitor, + { + visitor.visit_unit() + } + + fn deserialize_option(&mut self, mut visitor: V) + -> Result + where V: de::Visitor, + { + visitor.visit_none() + } + + forward_to_deserialize!{ + deserialize_bool(); + deserialize_usize(); + deserialize_u8(); + deserialize_u16(); + deserialize_u32(); + deserialize_u64(); + deserialize_isize(); + deserialize_i8(); + deserialize_i16(); + deserialize_i32(); + deserialize_i64(); + deserialize_f32(); + deserialize_f64(); + deserialize_char(); + deserialize_str(); + deserialize_string(); + deserialize_unit(); + deserialize_seq(); + deserialize_seq_fixed_size(len: usize); + deserialize_bytes(); + deserialize_map(); + deserialize_unit_struct(name: &'static str); + deserialize_newtype_struct(name: &'static str); + deserialize_tuple_struct(name: &'static str, len: usize); + deserialize_struct(name: &'static str, fields: &'static [&'static str]); + deserialize_struct_field(); + deserialize_tuple(len: usize); + deserialize_enum(name: &'static str, variants: &'static [&'static str]); + deserialize_ignored_any(); + } +} + +impl de::Deserialize for Value { + fn deserialize(deserializer: &mut D) -> Result + where D: de::Deserializer + { + struct ValueVisitor; + + impl de::Visitor for ValueVisitor { + type Value = Value; + + fn visit_bool(&mut self, value: bool) -> Result { + Ok(Value::Boolean(value)) + } + + fn visit_i64(&mut self, value: i64) -> Result { + Ok(Value::Integer(value)) + } + + fn visit_f64(&mut self, value: f64) -> Result { + Ok(Value::Float(value)) + } + + fn visit_str(&mut self, value: &str) -> Result { + Ok(Value::String(value.into())) + } + + fn visit_string(&mut self, value: String) -> Result { + Ok(Value::String(value)) + } + + fn visit_seq(&mut self, visitor: V) -> Result + where V: de::SeqVisitor + { + let values = try!(de::impls::VecVisitor::new().visit_seq(visitor)); + Ok(Value::Array(values)) + } + + fn visit_map(&mut self, visitor: V) -> Result + where V: de::MapVisitor + { + let mut v = de::impls::BTreeMapVisitor::new(); + let values = try!(v.visit_map(visitor)); + Ok(Value::Table(values)) + } + } + + deserializer.deserialize(ValueVisitor) + } +} diff --git a/third_party/rust/toml/src/display.rs b/third_party/rust/toml/src/display.rs new file mode 100644 index 000000000000..f563b7754cfc --- /dev/null +++ b/third_party/rust/toml/src/display.rs @@ -0,0 +1,209 @@ +use std::fmt; + +use Table as TomlTable; +use Value::{self, String, Integer, Float, Boolean, Datetime, Array, Table}; + +struct Printer<'a, 'b:'a> { + output: &'a mut fmt::Formatter<'b>, + stack: Vec<&'a str>, +} + +struct Key<'a>(&'a [&'a str]); + +impl fmt::Display for Value { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + String(ref s) => write_str(f, s), + Integer(i) => write!(f, "{}", i), + Float(fp) => { + try!(write!(f, "{}", fp)); + if fp % 1.0 == 0.0 { try!(write!(f, ".0")) } + Ok(()) + } + Boolean(b) => write!(f, "{}", b), + Datetime(ref s) => write!(f, "{}", s), + Table(ref t) => { + let mut p = Printer { output: f, stack: Vec::new() }; + p.print(t) + } + Array(ref a) => { + try!(write!(f, "[")); + for (i, v) in a.iter().enumerate() { + if i != 0 { try!(write!(f, ", ")); } + try!(write!(f, "{}", v)); + } + write!(f, "]") + } + } + } +} + +fn write_str(f: &mut fmt::Formatter, s: &str) -> fmt::Result { + try!(write!(f, "\"")); + for ch in s.chars() { + match ch { + '\u{8}' => try!(write!(f, "\\b")), + '\u{9}' => try!(write!(f, "\\t")), + '\u{a}' => try!(write!(f, "\\n")), + '\u{c}' => try!(write!(f, "\\f")), + '\u{d}' => try!(write!(f, "\\r")), + '\u{22}' => try!(write!(f, "\\\"")), + '\u{5c}' => try!(write!(f, "\\\\")), + ch => try!(write!(f, "{}", ch)), + } + } + write!(f, "\"") +} + +impl<'a, 'b> Printer<'a, 'b> { + fn print(&mut self, table: &'a TomlTable) -> fmt::Result { + let mut space_out_first = false; + for (k, v) in table.iter() { + match *v { + Table(..) => continue, + Array(ref a) => { + if let Some(&Table(..)) = a.first() { + continue; + } + } + _ => {} + } + space_out_first = true; + try!(writeln!(self.output, "{} = {}", Key(&[k]), v)); + } + for (i, (k, v)) in table.iter().enumerate() { + match *v { + Table(ref inner) => { + self.stack.push(k); + if space_out_first || i != 0 { + try!(write!(self.output, "\n")); + } + try!(writeln!(self.output, "[{}]", Key(&self.stack))); + try!(self.print(inner)); + self.stack.pop(); + } + Array(ref inner) => { + match inner.first() { + Some(&Table(..)) => {} + _ => continue + } + self.stack.push(k); + for (j, inner) in inner.iter().enumerate() { + if space_out_first || i != 0 || j != 0 { + try!(write!(self.output, "\n")); + } + try!(writeln!(self.output, "[[{}]]", Key(&self.stack))); + match *inner { + Table(ref inner) => try!(self.print(inner)), + _ => panic!("non-heterogeneous toml array"), + } + } + self.stack.pop(); + } + _ => {}, + } + } + Ok(()) + } +} + +impl<'a> fmt::Display for Key<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + for (i, part) in self.0.iter().enumerate() { + if i != 0 { try!(write!(f, ".")); } + let ok = part.chars().all(|c| { + match c { + 'a' ... 'z' | + 'A' ... 'Z' | + '0' ... '9' | + '-' | '_' => true, + _ => false, + } + }); + if ok { + try!(write!(f, "{}", part)); + } else { + try!(write_str(f, part)); + } + } + Ok(()) + } +} + +#[cfg(test)] +#[allow(warnings)] +mod tests { + use Value; + use Value::{String, Integer, Float, Boolean, Datetime, Array, Table}; + use std::collections::BTreeMap; + + macro_rules! map( ($($k:expr => $v:expr),*) => ({ + let mut _m = BTreeMap::new(); + $(_m.insert($k.to_string(), $v);)* + _m + }) ); + + #[test] + fn simple_show() { + assert_eq!(String("foo".to_string()).to_string(), + "\"foo\""); + assert_eq!(Integer(10).to_string(), + "10"); + assert_eq!(Float(10.0).to_string(), + "10.0"); + assert_eq!(Float(2.4).to_string(), + "2.4"); + assert_eq!(Boolean(true).to_string(), + "true"); + assert_eq!(Datetime("test".to_string()).to_string(), + "test"); + assert_eq!(Array(vec![]).to_string(), + "[]"); + assert_eq!(Array(vec![Integer(1), Integer(2)]).to_string(), + "[1, 2]"); + } + + #[test] + fn table() { + assert_eq!(Table(map! { }).to_string(), + ""); + assert_eq!(Table(map! { "test" => Integer(2) }).to_string(), + "test = 2\n"); + assert_eq!(Table(map! { + "test" => Integer(2), + "test2" => Table(map! { + "test" => String("wut".to_string()) + }) + }).to_string(), + "test = 2\n\ + \n\ + [test2]\n\ + test = \"wut\"\n"); + assert_eq!(Table(map! { + "test" => Integer(2), + "test2" => Table(map! { + "test" => String("wut".to_string()) + }) + }).to_string(), + "test = 2\n\ + \n\ + [test2]\n\ + test = \"wut\"\n"); + assert_eq!(Table(map! { + "test" => Integer(2), + "test2" => Array(vec![Table(map! { + "test" => String("wut".to_string()) + })]) + }).to_string(), + "test = 2\n\ + \n\ + [[test2]]\n\ + test = \"wut\"\n"); + assert_eq!(Table(map! { + "foo.bar" => Integer(2), + "foo\"bar" => Integer(2) + }).to_string(), + "\"foo\\\"bar\" = 2\n\ + \"foo.bar\" = 2\n"); + } +} diff --git a/third_party/rust/toml/src/encoder/mod.rs b/third_party/rust/toml/src/encoder/mod.rs new file mode 100644 index 000000000000..cd52b664cf8d --- /dev/null +++ b/third_party/rust/toml/src/encoder/mod.rs @@ -0,0 +1,203 @@ +use std::collections::BTreeMap; +use std::error; +use std::fmt; +use std::mem; + +use {Value, Table}; + +#[cfg(feature = "rustc-serialize")] mod rustc_serialize; +#[cfg(feature = "serde")] mod serde; + +/// A structure to transform Rust values into TOML values. +/// +/// This encoder implements the serialization `Encoder` interface, allowing +/// `Encodable` rust types to be fed into the encoder. The output of this +/// encoder is a TOML `Table` structure. The resulting TOML can be stringified +/// if necessary. +/// +/// # Example +/// +/// ``` +/// extern crate rustc_serialize; +/// extern crate toml; +/// +/// # fn main() { +/// use toml::{Encoder, Value}; +/// use rustc_serialize::Encodable; +/// +/// #[derive(RustcEncodable)] +/// struct MyStruct { foo: isize, bar: String } +/// let my_struct = MyStruct { foo: 4, bar: "hello!".to_string() }; +/// +/// let mut e = Encoder::new(); +/// my_struct.encode(&mut e).unwrap(); +/// +/// assert_eq!(e.toml.get(&"foo".to_string()), Some(&Value::Integer(4))) +/// # } +/// ``` +#[derive(Default, Debug)] +pub struct Encoder { + /// Output TOML that is emitted. The current version of this encoder forces + /// the top-level representation of a structure to be a table. + /// + /// This field can be used to extract the return value after feeding a value + /// into this `Encoder`. + pub toml: Table, + state: State, +} + +/// Enumeration of errors which can occur while encoding a rust value into a +/// TOML value. +#[allow(missing_copy_implementations)] +#[derive(Debug)] +pub enum Error { + /// Indication that a key was needed when a value was emitted, but no key + /// was previously emitted. + NeedsKey, + /// Indication that a key was emitted, but no value was emitted. + NoValue, + /// Indicates that a map key was attempted to be emitted at an invalid + /// location. + InvalidMapKeyLocation, + /// Indicates that a type other than a string was attempted to be used as a + /// map key type. + InvalidMapKeyType, + /// A custom error type was generated + Custom(String), +} + +/// Internal state of the encoder when encoding transitions +#[derive(Debug)] +pub struct EncoderState { + inner: State, +} + +#[derive(PartialEq, Debug)] +enum State { + Start, + NextKey(String), + NextArray(Vec), + NextMapKey, +} + +impl Default for State { + fn default() -> State { State::Start } +} + +impl Encoder { + /// Constructs a new encoder which will emit to the given output stream. + pub fn new() -> Encoder { + Encoder { state: State::Start, toml: BTreeMap::new() } + } + + fn emit_value(&mut self, v: Value) -> Result<(), Error> { + match mem::replace(&mut self.state, State::Start) { + State::NextKey(key) => { self.toml.insert(key, v); Ok(()) } + State::NextArray(mut vec) => { + // TODO: validate types + vec.push(v); + self.state = State::NextArray(vec); + Ok(()) + } + State::NextMapKey => { + match v { + Value::String(s) => { self.state = State::NextKey(s); Ok(()) } + _ => Err(Error::InvalidMapKeyType) + } + } + _ => Err(Error::NeedsKey) + } + } + + fn emit_none(&mut self) -> Result<(), Error> { + match mem::replace(&mut self.state, State::Start) { + State::Start => unreachable!(), + State::NextKey(_) => Ok(()), + State::NextArray(..) => panic!("how to encode None in an array?"), + State::NextMapKey => Err(Error::InvalidMapKeyLocation), + } + } + + fn seq_begin(&mut self) -> Result { + Ok(mem::replace(&mut self.state, State::NextArray(Vec::new()))) + } + + fn seq_end(&mut self, old: State) -> Result<(), Error> { + match mem::replace(&mut self.state, old) { + State::NextArray(v) => self.emit_value(Value::Array(v)), + _ => unreachable!(), + } + } + + fn table_key(&mut self, f: F) -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + match mem::replace(&mut self.state, State::NextMapKey) { + State::Start => {} + _ => return Err(Error::InvalidMapKeyLocation), + } + try!(f(self)); + match self.state { + State::NextKey(_) => Ok(()), + _ => Err(Error::InvalidMapKeyLocation), + } + } +} + +/// Encodes an encodable value into a TOML value. +/// +/// This function expects the type given to represent a TOML table in some form. +/// If encoding encounters an error, then this function will fail the task. +#[cfg(feature = "rustc-serialize")] +pub fn encode(t: &T) -> Value { + let mut e = Encoder::new(); + t.encode(&mut e).unwrap(); + Value::Table(e.toml) +} + +/// Encodes an encodable value into a TOML value. +/// +/// This function expects the type given to represent a TOML table in some form. +/// If encoding encounters an error, then this function will fail the task. +#[cfg(all(not(feature = "rustc-serialize"), feature = "serde"))] +pub fn encode(t: &T) -> Value { + let mut e = Encoder::new(); + t.serialize(&mut e).unwrap(); + Value::Table(e.toml) +} + +/// Encodes an encodable value into a TOML string. +/// +/// This function expects the type given to represent a TOML table in some form. +/// If encoding encounters an error, then this function will fail the task. +#[cfg(feature = "rustc-serialize")] +pub fn encode_str(t: &T) -> String { + encode(t).to_string() +} + +/// Encodes an encodable value into a TOML string. +/// +/// This function expects the type given to represent a TOML table in some form. +/// If encoding encounters an error, then this function will fail the task. +#[cfg(all(not(feature = "rustc-serialize"), feature = "serde"))] +pub fn encode_str(t: &T) -> String { + encode(t).to_string() +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::NeedsKey => write!(f, "need a key to encode"), + Error::NoValue => write!(f, "no value to emit for a previous key"), + Error::InvalidMapKeyLocation => write!(f, "a map cannot be emitted \ + at this location"), + Error::InvalidMapKeyType => write!(f, "only strings can be used as \ + key types"), + Error::Custom(ref s) => write!(f, "custom error: {}", s), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { "TOML encoding error" } +} diff --git a/third_party/rust/toml/src/encoder/rustc_serialize.rs b/third_party/rust/toml/src/encoder/rustc_serialize.rs new file mode 100644 index 000000000000..0eda74081e05 --- /dev/null +++ b/third_party/rust/toml/src/encoder/rustc_serialize.rs @@ -0,0 +1,748 @@ +use std::mem; + +use rustc_serialize; +use Value; +use super::{Encoder, Error, State}; +use super::Error::*; + +impl Encoder { + fn table(&mut self, f: F) -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + match mem::replace(&mut self.state, State::Start) { + State::NextKey(key) => { + let mut nested = Encoder::new(); + try!(f(&mut nested)); + self.toml.insert(key, Value::Table(nested.toml)); + Ok(()) + } + State::NextArray(mut arr) => { + let mut nested = Encoder::new(); + try!(f(&mut nested)); + arr.push(Value::Table(nested.toml)); + self.state = State::NextArray(arr); + Ok(()) + } + State::Start => f(self), + State::NextMapKey => Err(Error::InvalidMapKeyLocation), + } + } + + fn seq(&mut self, f: F) -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + let old = try!(self.seq_begin()); + try!(f(self)); + self.seq_end(old) + } +} + +impl rustc_serialize::Encoder for Encoder { + type Error = Error; + + fn emit_nil(&mut self) -> Result<(), Error> { Ok(()) } + fn emit_usize(&mut self, v: usize) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_u8(&mut self, v: u8) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_u16(&mut self, v: u16) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_u32(&mut self, v: u32) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_u64(&mut self, v: u64) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_isize(&mut self, v: isize) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_i8(&mut self, v: i8) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_i16(&mut self, v: i16) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_i32(&mut self, v: i32) -> Result<(), Error> { + self.emit_i64(v as i64) + } + fn emit_i64(&mut self, v: i64) -> Result<(), Error> { + self.emit_value(Value::Integer(v)) + } + fn emit_bool(&mut self, v: bool) -> Result<(), Error> { + self.emit_value(Value::Boolean(v)) + } + fn emit_f32(&mut self, v: f32) -> Result<(), Error> { self.emit_f64(v as f64) } + fn emit_f64(&mut self, v: f64) -> Result<(), Error> { + self.emit_value(Value::Float(v)) + } + fn emit_char(&mut self, v: char) -> Result<(), Error> { + self.emit_str(&v.to_string()) + } + fn emit_str(&mut self, v: &str) -> Result<(), Error> { + self.emit_value(Value::String(v.to_string())) + } + fn emit_enum(&mut self, _name: &str, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + f(self) + } + fn emit_enum_variant(&mut self, _v_name: &str, _v_id: usize, + _len: usize, f: F) -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + f(self) + } + fn emit_enum_variant_arg(&mut self, _a_idx: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + f(self) + } + fn emit_enum_struct_variant(&mut self, _v_name: &str, _v_id: usize, + _len: usize, + _f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + panic!() + } + fn emit_enum_struct_variant_field(&mut self, + _f_name: &str, + _f_idx: usize, + _f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + panic!() + } + fn emit_struct(&mut self, _name: &str, _len: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + self.table(f) + } + fn emit_struct_field(&mut self, f_name: &str, _f_idx: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + let old = mem::replace(&mut self.state, + State::NextKey(f_name.to_string())); + try!(f(self)); + if self.state != State::Start { + return Err(NoValue) + } + self.state = old; + Ok(()) + } + fn emit_tuple(&mut self, len: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + self.emit_seq(len, f) + } + fn emit_tuple_arg(&mut self, idx: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + self.emit_seq_elt(idx, f) + } + fn emit_tuple_struct(&mut self, _name: &str, _len: usize, _f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + unimplemented!() + } + fn emit_tuple_struct_arg(&mut self, _f_idx: usize, _f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + unimplemented!() + } + fn emit_option(&mut self, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + f(self) + } + fn emit_option_none(&mut self) -> Result<(), Error> { + self.emit_none() + } + fn emit_option_some(&mut self, f: F) -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + f(self) + } + fn emit_seq(&mut self, _len: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + self.seq(f) + } + fn emit_seq_elt(&mut self, _idx: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + f(self) + } + fn emit_map(&mut self, len: usize, f: F) + -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + self.emit_struct("foo", len, f) + } + fn emit_map_elt_key(&mut self, _idx: usize, f: F) -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + self.table_key(f) + } + fn emit_map_elt_val(&mut self, _idx: usize, f: F) -> Result<(), Error> + where F: FnOnce(&mut Encoder) -> Result<(), Error> + { + f(self) + } +} + +impl rustc_serialize::Encodable for Value { + fn encode(&self, e: &mut E) -> Result<(), E::Error> + where E: rustc_serialize::Encoder + { + match *self { + Value::String(ref s) => e.emit_str(s), + Value::Integer(i) => e.emit_i64(i), + Value::Float(f) => e.emit_f64(f), + Value::Boolean(b) => e.emit_bool(b), + Value::Datetime(ref s) => e.emit_str(s), + Value::Array(ref a) => { + e.emit_seq(a.len(), |e| { + for item in a { + try!(item.encode(e)); + } + Ok(()) + }) + } + Value::Table(ref t) => { + e.emit_map(t.len(), |e| { + for (i, (key, value)) in t.iter().enumerate() { + try!(e.emit_map_elt_key(i, |e| e.emit_str(key))); + try!(e.emit_map_elt_val(i, |e| value.encode(e))); + } + Ok(()) + }) + } + } + } +} + +#[cfg(test)] +mod tests { + use std::collections::{BTreeMap, HashSet}; + use rustc_serialize::{self, Encodable, Decodable}; + + use {Encoder, Decoder, DecodeError}; + use Value; + use Value::{Table, Integer, Array, Float}; + + macro_rules! encode( ($t:expr) => ({ + let mut e = Encoder::new(); + $t.encode(&mut e).unwrap(); + e.toml + }) ); + + macro_rules! decode( ($t:expr) => ({ + let mut d = Decoder::new($t); + Decodable::decode(&mut d).unwrap() + }) ); + + macro_rules! map( ($($k:ident, $v:expr),*) => ({ + let mut _m = BTreeMap::new(); + $(_m.insert(stringify!($k).to_string(), $v);)* + _m + }) ); + + #[test] + fn smoke() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: isize } + + let v = Foo { a: 2 }; + assert_eq!(encode!(v), map! { a, Integer(2) }); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn smoke_hyphen() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a_b: isize } + + let v = Foo { a_b: 2 }; + assert_eq!(encode!(v), map! { a_b, Integer(2) }); + assert_eq!(v, decode!(Table(encode!(v)))); + + let mut m = BTreeMap::new(); + m.insert("a-b".to_string(), Integer(2)); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn nested() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: isize, b: Bar } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar { a: String } + + let v = Foo { a: 2, b: Bar { a: "test".to_string() } }; + assert_eq!(encode!(v), + map! { + a, Integer(2), + b, Table(map! { + a, Value::String("test".to_string()) + }) + }); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn application_decode_error() { + #[derive(PartialEq, Debug)] + struct Range10(usize); + impl Decodable for Range10 { + fn decode(d: &mut D) -> Result { + let x: usize = try!(Decodable::decode(d)); + if x > 10 { + Err(d.error("Value out of range!")) + } else { + Ok(Range10(x)) + } + } + } + let mut d_good = Decoder::new(Integer(5)); + let mut d_bad1 = Decoder::new(Value::String("not an isize".to_string())); + let mut d_bad2 = Decoder::new(Integer(11)); + + assert_eq!(Ok(Range10(5)), Decodable::decode(&mut d_good)); + + let err1: Result = Decodable::decode(&mut d_bad1); + assert!(err1.is_err()); + let err2: Result = Decodable::decode(&mut d_bad2); + assert!(err2.is_err()); + } + + #[test] + fn array() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Vec } + + let v = Foo { a: vec![1, 2, 3, 4] }; + assert_eq!(encode!(v), + map! { + a, Array(vec![ + Integer(1), + Integer(2), + Integer(3), + Integer(4) + ]) + }); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn tuple() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: (isize, isize, isize, isize) } + + let v = Foo { a: (1, 2, 3, 4) }; + assert_eq!(encode!(v), + map! { + a, Array(vec![ + Integer(1), + Integer(2), + Integer(3), + Integer(4) + ]) + }); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn inner_structs_with_options() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { + a: Option>, + b: Bar, + } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar { + a: String, + b: f64, + } + + let v = Foo { + a: Some(Box::new(Foo { + a: None, + b: Bar { a: "foo".to_string(), b: 4.5 }, + })), + b: Bar { a: "bar".to_string(), b: 1.0 }, + }; + assert_eq!(encode!(v), + map! { + a, Table(map! { + b, Table(map! { + a, Value::String("foo".to_string()), + b, Float(4.5) + }) + }), + b, Table(map! { + a, Value::String("bar".to_string()), + b, Float(1.0) + }) + }); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn hashmap() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { + map: BTreeMap, + set: HashSet, + } + + let v = Foo { + map: { + let mut m = BTreeMap::new(); + m.insert("foo".to_string(), 10); + m.insert("bar".to_string(), 4); + m + }, + set: { + let mut s = HashSet::new(); + s.insert('a'); + s + }, + }; + assert_eq!(encode!(v), + map! { + map, Table(map! { + foo, Integer(10), + bar, Integer(4) + }), + set, Array(vec![Value::String("a".to_string())]) + } + ); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn tuple_struct() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo(isize, String, f64); + + let v = Foo(1, "foo".to_string(), 4.5); + assert_eq!( + encode!(v), + map! { + _field0, Integer(1), + _field1, Value::String("foo".to_string()), + _field2, Float(4.5) + } + ); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn table_array() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Vec, } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar { a: isize } + + let v = Foo { a: vec![Bar { a: 1 }, Bar { a: 2 }] }; + assert_eq!( + encode!(v), + map! { + a, Array(vec![ + Table(map!{ a, Integer(1) }), + Table(map!{ a, Integer(2) }), + ]) + } + ); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn type_errors() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { bar: isize } + + let mut d = Decoder::new(Table(map! { + bar, Float(1.0) + })); + let a: Result = Decodable::decode(&mut d); + match a { + Ok(..) => panic!("should not have decoded"), + Err(e) => { + assert_eq!(e.to_string(), + "expected a value of type `integer`, but \ + found a value of type `float` for the key `bar`"); + } + } + } + + #[test] + fn missing_errors() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { bar: isize } + + let mut d = Decoder::new(Table(map! { + })); + let a: Result = Decodable::decode(&mut d); + match a { + Ok(..) => panic!("should not have decoded"), + Err(e) => { + assert_eq!(e.to_string(), + "expected a value of type `integer` for the key `bar`"); + } + } + } + + #[test] + fn parse_enum() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: E } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + enum E { + Bar(isize), + Baz(f64), + Last(Foo2), + } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo2 { + test: String, + } + + let v = Foo { a: E::Bar(10) }; + assert_eq!( + encode!(v), + map! { a, Integer(10) } + ); + assert_eq!(v, decode!(Table(encode!(v)))); + + let v = Foo { a: E::Baz(10.2) }; + assert_eq!( + encode!(v), + map! { a, Float(10.2) } + ); + assert_eq!(v, decode!(Table(encode!(v)))); + + let v = Foo { a: E::Last(Foo2 { test: "test".to_string() }) }; + assert_eq!( + encode!(v), + map! { a, Table(map! { test, Value::String("test".to_string()) }) } + ); + assert_eq!(v, decode!(Table(encode!(v)))); + } + + #[test] + fn unused_fields() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: isize } + + let v = Foo { a: 2 }; + let mut d = Decoder::new(Table(map! { + a, Integer(2), + b, Integer(5) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, Some(Table(map! { + b, Integer(5) + }))); + } + + #[test] + fn unused_fields2() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Bar } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar { a: isize } + + let v = Foo { a: Bar { a: 2 } }; + let mut d = Decoder::new(Table(map! { + a, Table(map! { + a, Integer(2), + b, Integer(5) + }) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, Some(Table(map! { + a, Table(map! { + b, Integer(5) + }) + }))); + } + + #[test] + fn unused_fields3() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Bar } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar { a: isize } + + let v = Foo { a: Bar { a: 2 } }; + let mut d = Decoder::new(Table(map! { + a, Table(map! { + a, Integer(2) + }) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, None); + } + + #[test] + fn unused_fields4() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: BTreeMap } + + let v = Foo { a: map! { a, "foo".to_string() } }; + let mut d = Decoder::new(Table(map! { + a, Table(map! { + a, Value::String("foo".to_string()) + }) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, None); + } + + #[test] + fn unused_fields5() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Vec } + + let v = Foo { a: vec!["a".to_string()] }; + let mut d = Decoder::new(Table(map! { + a, Array(vec![Value::String("a".to_string())]) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, None); + } + + #[test] + fn unused_fields6() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Option> } + + let v = Foo { a: Some(vec![]) }; + let mut d = Decoder::new(Table(map! { + a, Array(vec![]) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, None); + } + + #[test] + fn unused_fields7() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Vec } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar { a: isize } + + let v = Foo { a: vec![Bar { a: 1 }] }; + let mut d = Decoder::new(Table(map! { + a, Array(vec![Table(map! { + a, Integer(1), + b, Integer(2) + })]) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, Some(Table(map! { + a, Array(vec![Table(map! { + b, Integer(2) + })]) + }))); + } + + #[test] + fn unused_fields8() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: BTreeMap } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar { a: isize } + + let v = Foo { a: map! { a, Bar { a: 2 } } }; + let mut d = Decoder::new(Table(map! { + a, Table(map! { + a, Table(map! { + a, Integer(2), + b, Integer(2) + }) + }) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + assert_eq!(d.toml, Some(Table(map! { + a, Table(map! { + a, Table(map! { + b, Integer(2) + }) + }) + }))); + } + + #[test] + fn empty_arrays() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Vec } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar; + + let v = Foo { a: vec![] }; + let mut d = Decoder::new(Table(map! {})); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + } + + #[test] + fn empty_arrays2() { + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Foo { a: Option> } + #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)] + struct Bar; + + let v = Foo { a: None }; + let mut d = Decoder::new(Table(map! {})); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + + let v = Foo { a: Some(vec![]) }; + let mut d = Decoder::new(Table(map! { + a, Array(vec![]) + })); + assert_eq!(v, Decodable::decode(&mut d).unwrap()); + } + + #[test] + fn round_trip() { + let toml = r#" + [test] + foo = "bar" + + [[values]] + foo = "baz" + + [[values]] + foo = "qux" + "#; + + let value: Value = toml.parse().unwrap(); + let val2 = ::encode_str(&value).parse().unwrap(); + assert_eq!(value, val2); + } +} diff --git a/third_party/rust/toml/src/encoder/serde.rs b/third_party/rust/toml/src/encoder/serde.rs new file mode 100644 index 000000000000..997bc378958f --- /dev/null +++ b/third_party/rust/toml/src/encoder/serde.rs @@ -0,0 +1,339 @@ +use std::mem; + +use serde::ser; +use Value; +use super::{Encoder, Error, EncoderState, State}; + +impl Encoder { + fn table_begin(&mut self) -> Result { + match self.state { + State::NextMapKey => Err(Error::InvalidMapKeyLocation), + _ => Ok(mem::replace(self, Encoder::new())) + } + } + + fn table_end(&mut self, mut state: Self) -> Result<(), Error> { + match state.state { + State::NextKey(key) => { + mem::swap(&mut self.toml, &mut state.toml); + self.toml.insert(key, Value::Table(state.toml)); + }, + State::NextArray(mut arr) => { + mem::swap(&mut self.toml, &mut state.toml); + arr.push(Value::Table(state.toml)); + self.state = State::NextArray(arr); + }, + State::Start => {}, + State::NextMapKey => unreachable!(), + } + Ok(()) + } +} + +impl ser::Serializer for Encoder { + type Error = Error; + type MapState = Self; + type StructState = Self; + type StructVariantState = Self; + type SeqState = EncoderState; + type TupleState = EncoderState; + type TupleStructState = EncoderState; + type TupleVariantState = EncoderState; + + fn serialize_bool(&mut self, v: bool) -> Result<(), Error> { + self.emit_value(Value::Boolean(v)) + } + + fn serialize_i64(&mut self, v: i64) -> Result<(), Error> { + self.emit_value(Value::Integer(v)) + } + + // TODO: checked casts + + fn serialize_u64(&mut self, v: u64) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_isize(&mut self, v: isize) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_usize(&mut self, v: usize) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_i8(&mut self, v: i8) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_u8(&mut self, v: u8) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_i16(&mut self, v: i16) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_u16(&mut self, v: u16) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_i32(&mut self, v: i32) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_u32(&mut self, v: u32) -> Result<(), Error> { + self.serialize_i64(v as i64) + } + + fn serialize_f32(&mut self, v: f32) -> Result<(), Error> { + self.serialize_f64(v as f64) + } + + fn serialize_f64(&mut self, v: f64) -> Result<(), Error> { + self.emit_value(Value::Float(v)) + } + + fn serialize_str(&mut self, value: &str) -> Result<(), Error> { + self.emit_value(Value::String(value.to_string())) + } + + fn serialize_unit_struct(&mut self, _name: &'static str) -> Result<(), Error> { + Ok(()) + } + + fn serialize_unit(&mut self) -> Result<(), Error> { + Ok(()) + } + + fn serialize_none(&mut self) -> Result<(), Error> { + self.emit_none() + } + + fn serialize_char(&mut self, c: char) -> Result<(), Error> { + self.serialize_str(&c.to_string()) + } + + fn serialize_some(&mut self, value: V) -> Result<(), Error> + where V: ser::Serialize + { + value.serialize(self) + } + + fn serialize_bytes(&mut self, v: &[u8]) -> Result<(), Error> { + let mut state = try!(self.serialize_seq(Some(v.len()))); + for c in v { + try!(self.serialize_seq_elt(&mut state, c)); + } + self.serialize_seq_end(state) + } + + fn serialize_seq_fixed_size(&mut self, len: usize) + -> Result { + self.serialize_seq(Some(len)) + } + + fn serialize_seq(&mut self, _len: Option) + -> Result { + self.seq_begin().map(|s| EncoderState { inner: s }) + } + + fn serialize_seq_elt(&mut self, + _state: &mut EncoderState, + value: T) -> Result<(), Error> + where T: ser::Serialize + { + value.serialize(self) + } + + fn serialize_seq_end(&mut self, state: EncoderState) -> Result<(), Error> { + self.seq_end(state.inner) + } + + fn serialize_tuple(&mut self, len: usize) + -> Result { + self.serialize_seq(Some(len)) + } + + fn serialize_tuple_elt(&mut self, + state: &mut EncoderState, + value: T) -> Result<(), Error> + where T: ser::Serialize + { + self.serialize_seq_elt(state, value) + } + + fn serialize_tuple_end(&mut self, state: EncoderState) -> Result<(), Error> { + self.serialize_seq_end(state) + } + + fn serialize_tuple_struct(&mut self, + _name: &'static str, + len: usize) -> Result { + self.serialize_seq(Some(len)) + } + + fn serialize_tuple_struct_elt(&mut self, + state: &mut EncoderState, + value: T) -> Result<(), Error> + where T: ser::Serialize + { + self.serialize_seq_elt(state, value) + } + + fn serialize_tuple_struct_end(&mut self, state: EncoderState) + -> Result<(), Error> { + self.serialize_seq_end(state) + } + + fn serialize_tuple_variant(&mut self, + _name: &'static str, + _id: usize, + _variant: &'static str, + len: usize) -> Result { + self.serialize_seq(Some(len)) + } + + fn serialize_tuple_variant_elt(&mut self, + state: &mut EncoderState, + value: T) -> Result<(), Error> + where T: ser::Serialize + { + self.serialize_seq_elt(state, value) + } + + fn serialize_tuple_variant_end(&mut self, state: EncoderState) + -> Result<(), Error> { + self.serialize_seq_end(state) + } + + fn serialize_map(&mut self, _len: Option) -> Result { + self.table_begin() + } + + fn serialize_map_key(&mut self, + _state: &mut Encoder, + key: K) -> Result<(), Error> + where K: ser::Serialize + { + self.table_key(|me| key.serialize(me)) + } + + fn serialize_map_value(&mut self, + _state: &mut Encoder, + value: V) -> Result<(), Error> + where V: ser::Serialize + { + value.serialize(self) + } + + fn serialize_map_end(&mut self, state: Self) -> Result<(), Error> { + self.table_end(state) + } + + fn serialize_struct(&mut self, + _name: &'static str, + len: usize) -> Result { + self.serialize_map(Some(len)) + } + + fn serialize_struct_elt(&mut self, + state: &mut Encoder, + key: &'static str, + value: V) -> Result<(), Error> + where V: ser::Serialize + { + try!(self.serialize_map_key(state, key)); + self.serialize_map_value(state, value) + } + + fn serialize_struct_end(&mut self, state: Self) -> Result<(), Error> { + self.serialize_map_end(state) + } + + fn serialize_struct_variant(&mut self, + _name: &'static str, + _id: usize, + _variant: &'static str, + len: usize) -> Result { + self.serialize_map(Some(len)) + } + + fn serialize_struct_variant_elt(&mut self, + state: &mut Encoder, + key: &'static str, + value: V) -> Result<(), Error> + where V: ser::Serialize + { + try!(self.serialize_map_key(state, key)); + self.serialize_map_value(state, value) + } + + fn serialize_struct_variant_end(&mut self, state: Self) -> Result<(), Error> { + self.serialize_map_end(state) + } + + fn serialize_newtype_struct(&mut self, + _name: &'static str, + value: T) -> Result<(), Self::Error> + where T: ser::Serialize, + { + // Don't serialize the newtype struct in a tuple. + value.serialize(self) + } + + fn serialize_newtype_variant(&mut self, + _name: &'static str, + _variant_index: usize, + _variant: &'static str, + value: T) -> Result<(), Self::Error> + where T: ser::Serialize, + { + // Don't serialize the newtype struct variant in a tuple. + value.serialize(self) + } + + fn serialize_unit_variant(&mut self, + _name: &'static str, + _variant_index: usize, + _variant: &'static str, + ) -> Result<(), Self::Error> + { + Ok(()) + } +} + +impl ser::Serialize for Value { + fn serialize(&self, e: &mut E) -> Result<(), E::Error> + where E: ser::Serializer + { + match *self { + Value::String(ref s) => e.serialize_str(s), + Value::Integer(i) => e.serialize_i64(i), + Value::Float(f) => e.serialize_f64(f), + Value::Boolean(b) => e.serialize_bool(b), + Value::Datetime(ref s) => e.serialize_str(s), + Value::Array(ref a) => { + let mut state = try!(e.serialize_seq(Some(a.len()))); + for el in a.iter() { + try!(e.serialize_seq_elt(&mut state, el)); + } + e.serialize_seq_end(state) + } + Value::Table(ref t) => { + let mut state = try!(e.serialize_map(Some(t.len()))); + for (k, v) in t.iter() { + try!(e.serialize_map_key(&mut state, k)); + try!(e.serialize_map_value(&mut state, v)); + } + e.serialize_map_end(state) + } + } + } +} + +impl ser::Error for Error { + fn custom>(msg: T) -> Error { + Error::Custom(msg.into()) + } +} diff --git a/third_party/rust/toml/src/lib.rs b/third_party/rust/toml/src/lib.rs new file mode 100644 index 000000000000..e8dcb924af5b --- /dev/null +++ b/third_party/rust/toml/src/lib.rs @@ -0,0 +1,492 @@ +//! A TOML-parsing library +//! +//! This library is an implementation in Rust of a parser for TOML configuration +//! files [1]. It is focused around high quality errors including specific spans +//! and detailed error messages when things go wrong. +//! +//! This implementation currently passes the language agnostic [test suite][2]. +//! +//! # Example +//! +//! ``` +//! let toml = r#" +//! [test] +//! foo = "bar" +//! "#; +//! +//! let value = toml::Parser::new(toml).parse().unwrap(); +//! println!("{:?}", value); +//! ``` +//! +//! # Conversions +//! +//! This library also supports using the standard `Encodable` and `Decodable` +//! traits with TOML values. This library provides the following conversion +//! capabilities: +//! +//! * `String` => `toml::Value` - via `Parser` +//! * `toml::Value` => `String` - via `Display` +//! * `toml::Value` => rust object - via `Decoder` +//! * rust object => `toml::Value` - via `Encoder` +//! +//! Convenience functions for performing multiple conversions at a time are also +//! provided. +//! +//! [1]: https://github.com/mojombo/toml +//! [2]: https://github.com/BurntSushi/toml-test + +#![doc(html_root_url = "http://alexcrichton.com/toml-rs")] +#![deny(missing_docs)] +#![cfg_attr(test, deny(warnings))] + +#[cfg(feature = "rustc-serialize")] extern crate rustc_serialize; +#[cfg(feature = "serde")] extern crate serde; + +use std::collections::BTreeMap; +use std::str::FromStr; + +pub use parser::{Parser, ParserError}; + +#[cfg(any(feature = "rustc-serialize", feature = "serde"))] +pub use self::encoder::{Encoder, Error, EncoderState, encode, encode_str}; +#[cfg(any(feature = "rustc-serialize", feature = "serde"))] +pub use self::decoder::{Decoder, DecodeError, DecodeErrorKind, decode, decode_str}; + +mod parser; +mod display; +#[cfg(any(feature = "rustc-serialize", feature = "serde"))] +mod encoder; +#[cfg(any(feature = "rustc-serialize", feature = "serde"))] +mod decoder; + +/// Representation of a TOML value. +#[derive(PartialEq, Clone, Debug)] +#[allow(missing_docs)] +pub enum Value { + String(String), + Integer(i64), + Float(f64), + Boolean(bool), + Datetime(String), + Array(Array), + Table(Table), +} + +/// Type representing a TOML array, payload of the `Value::Array` variant +pub type Array = Vec; + +/// Type representing a TOML table, payload of the `Value::Table` variant +pub type Table = BTreeMap; + +impl Value { + /// Tests whether this and another value have the same type. + pub fn same_type(&self, other: &Value) -> bool { + match (self, other) { + (&Value::String(..), &Value::String(..)) | + (&Value::Integer(..), &Value::Integer(..)) | + (&Value::Float(..), &Value::Float(..)) | + (&Value::Boolean(..), &Value::Boolean(..)) | + (&Value::Datetime(..), &Value::Datetime(..)) | + (&Value::Array(..), &Value::Array(..)) | + (&Value::Table(..), &Value::Table(..)) => true, + + _ => false, + } + } + + /// Returns a human-readable representation of the type of this value. + pub fn type_str(&self) -> &'static str { + match *self { + Value::String(..) => "string", + Value::Integer(..) => "integer", + Value::Float(..) => "float", + Value::Boolean(..) => "boolean", + Value::Datetime(..) => "datetime", + Value::Array(..) => "array", + Value::Table(..) => "table", + } + } + + /// Extracts the string of this value if it is a string. + pub fn as_str(&self) -> Option<&str> { + match *self { Value::String(ref s) => Some(&**s), _ => None } + } + + /// Extracts the integer value if it is an integer. + pub fn as_integer(&self) -> Option { + match *self { Value::Integer(i) => Some(i), _ => None } + } + + /// Extracts the float value if it is a float. + pub fn as_float(&self) -> Option { + match *self { Value::Float(f) => Some(f), _ => None } + } + + /// Extracts the boolean value if it is a boolean. + pub fn as_bool(&self) -> Option { + match *self { Value::Boolean(b) => Some(b), _ => None } + } + + /// Extracts the datetime value if it is a datetime. + /// + /// Note that a parsed TOML value will only contain ISO 8601 dates. An + /// example date is: + /// + /// ```notrust + /// 1979-05-27T07:32:00Z + /// ``` + pub fn as_datetime(&self) -> Option<&str> { + match *self { Value::Datetime(ref s) => Some(&**s), _ => None } + } + + /// Extracts the array value if it is an array. + pub fn as_slice(&self) -> Option<&[Value]> { + match *self { Value::Array(ref s) => Some(&**s), _ => None } + } + + /// Extracts the table value if it is a table. + pub fn as_table(&self) -> Option<&Table> { + match *self { Value::Table(ref s) => Some(s), _ => None } + } + + /// Lookups for value at specified path. + /// + /// Uses '.' as a path separator. + /// + /// Note: arrays have zero-based indexes. + /// + /// Note: empty path returns self. + /// + /// ``` + /// # #![allow(unstable)] + /// let toml = r#" + /// [test] + /// foo = "bar" + /// + /// [[values]] + /// foo = "baz" + /// + /// [[values]] + /// foo = "qux" + /// "#; + /// let value: toml::Value = toml.parse().unwrap(); + /// + /// let foo = value.lookup("test.foo").unwrap(); + /// assert_eq!(foo.as_str().unwrap(), "bar"); + /// + /// let foo = value.lookup("values.1.foo").unwrap(); + /// assert_eq!(foo.as_str().unwrap(), "qux"); + /// + /// let no_bar = value.lookup("test.bar"); + /// assert_eq!(no_bar.is_none(), true); + /// ``` + pub fn lookup(&self, path: &str) -> Option<&Value> { + let ref path = match Parser::new(path).lookup() { + Some(path) => path, + None => return None, + }; + let mut cur_value = self; + if path.is_empty() { + return Some(cur_value) + } + + for key in path { + match *cur_value { + Value::Table(ref hm) => { + match hm.get(key) { + Some(v) => cur_value = v, + None => return None + } + }, + Value::Array(ref v) => { + match key.parse::().ok() { + Some(idx) if idx < v.len() => cur_value = &v[idx], + _ => return None + } + }, + _ => return None + } + }; + + Some(cur_value) + + } + /// Lookups for mutable value at specified path. + /// + /// Uses '.' as a path separator. + /// + /// Note: arrays have zero-based indexes. + /// + /// Note: empty path returns self. + /// + /// ``` + /// # #![allow(unstable)] + /// let toml = r#" + /// [test] + /// foo = "bar" + /// + /// [[values]] + /// foo = "baz" + /// + /// [[values]] + /// foo = "qux" + /// "#; + /// let mut value: toml::Value = toml.parse().unwrap(); + /// { + /// let string = value.lookup_mut("test.foo").unwrap(); + /// assert_eq!(string, &mut toml::Value::String(String::from("bar"))); + /// *string = toml::Value::String(String::from("foo")); + /// } + /// let result = value.lookup_mut("test.foo").unwrap(); + /// assert_eq!(result.as_str().unwrap(), "foo"); + /// ``` + pub fn lookup_mut(&mut self, path: &str) -> Option<&mut Value> { + let ref path = match Parser::new(path).lookup() { + Some(path) => path, + None => return None, + }; + + let mut cur = self; + if path.is_empty() { + return Some(cur) + } + + for key in path { + let tmp = cur; + match *tmp { + Value::Table(ref mut hm) => { + match hm.get_mut(key) { + Some(v) => cur = v, + None => return None + } + } + Value::Array(ref mut v) => { + match key.parse::().ok() { + Some(idx) if idx < v.len() => cur = &mut v[idx], + _ => return None + } + } + _ => return None + } + } + Some(cur) + } +} + +impl FromStr for Value { + type Err = Vec; + fn from_str(s: &str) -> Result> { + let mut p = Parser::new(s); + match p.parse().map(Value::Table) { + Some(n) => Ok(n), + None => Err(p.errors), + } + } +} + +#[cfg(test)] +mod tests { + use super::Value; + + #[test] + fn lookup_mut_change() { + let toml = r#" + [test] + foo = "bar" + + [[values]] + foo = "baz" + + [[values]] + foo = "qux" + "#; + + let mut value: Value = toml.parse().unwrap(); + { + let foo = value.lookup_mut("values.0.foo").unwrap(); + *foo = Value::String(String::from("bar")); + } + let foo = value.lookup("values.0.foo").unwrap(); + assert_eq!(foo.as_str().unwrap(), "bar"); + } + + #[test] + fn lookup_mut_valid() { + let toml = r#" + [test] + foo = "bar" + + [[values]] + foo = "baz" + + [[values]] + foo = "qux" + "#; + + let mut value: Value = toml.parse().unwrap(); + + { + let test_foo = value.lookup_mut("test.foo").unwrap(); + assert_eq!(test_foo.as_str().unwrap(), "bar"); + } + + { + let foo1 = value.lookup_mut("values.1.foo").unwrap(); + assert_eq!(foo1.as_str().unwrap(), "qux"); + } + + assert!(value.lookup_mut("test.bar").is_none()); + assert!(value.lookup_mut("test.foo.bar").is_none()); + } + + #[test] + fn lookup_mut_invalid_index() { + let toml = r#" + [[values]] + foo = "baz" + "#; + + let mut value: Value = toml.parse().unwrap(); + + { + let foo = value.lookup_mut("test.foo"); + assert!(foo.is_none()); + } + + { + let foo = value.lookup_mut("values.100.foo"); + assert!(foo.is_none()); + } + + { + let foo = value.lookup_mut("values.str.foo"); + assert!(foo.is_none()); + } + } + + #[test] + fn lookup_mut_self() { + let mut value: Value = r#"foo = "bar""#.parse().unwrap(); + + { + let foo = value.lookup_mut("foo").unwrap(); + assert_eq!(foo.as_str().unwrap(), "bar"); + } + + let foo = value.lookup_mut("").unwrap(); + assert!(foo.as_table().is_some()); + + let baz = foo.lookup_mut("foo").unwrap(); + assert_eq!(baz.as_str().unwrap(), "bar"); + } + + #[test] + fn lookup_valid() { + let toml = r#" + [test] + foo = "bar" + + [[values]] + foo = "baz" + + [[values]] + foo = "qux" + "#; + + let value: Value = toml.parse().unwrap(); + + let test_foo = value.lookup("test.foo").unwrap(); + assert_eq!(test_foo.as_str().unwrap(), "bar"); + + let foo1 = value.lookup("values.1.foo").unwrap(); + assert_eq!(foo1.as_str().unwrap(), "qux"); + + assert!(value.lookup("test.bar").is_none()); + assert!(value.lookup("test.foo.bar").is_none()); + } + + #[test] + fn lookup_invalid_index() { + let toml = r#" + [[values]] + foo = "baz" + "#; + + let value: Value = toml.parse().unwrap(); + + let foo = value.lookup("test.foo"); + assert!(foo.is_none()); + + let foo = value.lookup("values.100.foo"); + assert!(foo.is_none()); + + let foo = value.lookup("values.str.foo"); + assert!(foo.is_none()); + } + + #[test] + fn lookup_self() { + let value: Value = r#"foo = "bar""#.parse().unwrap(); + + let foo = value.lookup("foo").unwrap(); + assert_eq!(foo.as_str().unwrap(), "bar"); + + let foo = value.lookup("").unwrap(); + assert!(foo.as_table().is_some()); + + let baz = foo.lookup("foo").unwrap(); + assert_eq!(baz.as_str().unwrap(), "bar"); + } + + #[test] + fn lookup_advanced() { + let value: Value = "[table]\n\"value\" = 0".parse().unwrap(); + let looked = value.lookup("table.\"value\"").unwrap(); + assert_eq!(*looked, Value::Integer(0)); + } + + #[test] + fn lookup_advanced_table() { + let value: Value = "[table.\"name.other\"]\nvalue = \"my value\"".parse().unwrap(); + let looked = value.lookup(r#"table."name.other".value"#).unwrap(); + assert_eq!(*looked, Value::String(String::from("my value"))); + } + + #[test] + fn lookup_mut_advanced() { + let mut value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); + let looked = value.lookup_mut("table.\"value\".1").unwrap(); + assert_eq!(*looked, Value::Integer(1)); + } + + #[test] + fn single_dot() { + let value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup(".")); + } + + #[test] + fn array_dot() { + let value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup("0.")); + } + + #[test] + fn dot_inside() { + let value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup("table.\"value.0\"")); + } + + #[test] + fn table_with_quotes() { + let value: Value = "[table.\"element\"]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup("\"table.element\".\"value\".0")); + } + + #[test] + fn table_with_quotes_2() { + let value: Value = "[table.\"element\"]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(Value::Integer(0), *value.lookup("table.\"element\".\"value\".0").unwrap()); + } + +} diff --git a/third_party/rust/toml/src/parser.rs b/third_party/rust/toml/src/parser.rs new file mode 100644 index 000000000000..eb86d62ab328 --- /dev/null +++ b/third_party/rust/toml/src/parser.rs @@ -0,0 +1,1627 @@ +use std::char; +use std::collections::btree_map::{BTreeMap, Entry}; +use std::error::Error; +use std::fmt; +use std::str; + +macro_rules! try { + ($e:expr) => (match $e { Some(s) => s, None => return None }) +} + +// We redefine Value because we need to keep track of encountered table +// definitions, eg when parsing: +// +// [a] +// [a.b] +// [a] +// +// we have to error out on redefinition of [a]. This bit of data is difficult to +// track in a side table so we just have a "stripped down" AST to work with +// which has the relevant metadata fields in it. +struct TomlTable { + values: BTreeMap, + defined: bool, +} + +impl TomlTable { + fn convert(self) -> super::Table { + self.values.into_iter().map(|(k,v)| (k, v.convert())).collect() + } +} + +enum Value { + String(String), + Integer(i64), + Float(f64), + Boolean(bool), + Datetime(String), + Array(Vec), + Table(TomlTable), +} + +impl Value { + fn type_str(&self) -> &'static str { + match *self { + Value::String(..) => "string", + Value::Integer(..) => "integer", + Value::Float(..) => "float", + Value::Boolean(..) => "boolean", + Value::Datetime(..) => "datetime", + Value::Array(..) => "array", + Value::Table(..) => "table", + } + } + + fn same_type(&self, other: &Value) -> bool { + match (self, other) { + (&Value::String(..), &Value::String(..)) | + (&Value::Integer(..), &Value::Integer(..)) | + (&Value::Float(..), &Value::Float(..)) | + (&Value::Boolean(..), &Value::Boolean(..)) | + (&Value::Datetime(..), &Value::Datetime(..)) | + (&Value::Array(..), &Value::Array(..)) | + (&Value::Table(..), &Value::Table(..)) => true, + + _ => false, + } + } + + fn convert(self) -> super::Value { + match self { + Value::String(x) => super::Value::String(x), + Value::Integer(x) => super::Value::Integer(x), + Value::Float(x) => super::Value::Float(x), + Value::Boolean(x) => super::Value::Boolean(x), + Value::Datetime(x) => super::Value::Datetime(x), + Value::Array(v) => + super::Value::Array( + v.into_iter().map(|x| x.convert()).collect() + ), + Value::Table(t) => super::Value::Table(t.convert()) + } + } +} + +/// Parser for converting a string to a TOML `Value` instance. +/// +/// This parser contains the string slice that is being parsed, and exports the +/// list of errors which have occurred during parsing. +pub struct Parser<'a> { + input: &'a str, + cur: str::CharIndices<'a>, + require_newline_after_table: bool, + + /// A list of all errors which have occurred during parsing. + /// + /// Not all parse errors are fatal, so this list is added to as much as + /// possible without aborting parsing. If `None` is returned by `parse`, it + /// is guaranteed that this list is not empty. + pub errors: Vec, +} + +/// A structure representing a parse error. +/// +/// The data in this structure can be used to trace back to the original cause +/// of the error in order to provide diagnostics about parse errors. +#[derive(Debug, Clone)] +pub struct ParserError { + /// The low byte at which this error is pointing at. + pub lo: usize, + /// One byte beyond the last character at which this error is pointing at. + pub hi: usize, + /// A human-readable description explaining what the error is. + pub desc: String, +} + +impl<'a> Parser<'a> { + /// Creates a new parser for a string. + /// + /// The parser can be executed by invoking the `parse` method. + /// + /// # Example + /// + /// ``` + /// let toml = r#" + /// [test] + /// foo = "bar" + /// "#; + /// + /// let mut parser = toml::Parser::new(toml); + /// match parser.parse() { + /// Some(value) => println!("found toml: {:?}", value), + /// None => { + /// println!("parse errors: {:?}", parser.errors); + /// } + /// } + /// ``` + pub fn new(s: &'a str) -> Parser<'a> { + Parser { + input: s, + cur: s.char_indices(), + errors: Vec::new(), + require_newline_after_table: true, + } + } + + /// Converts a byte offset from an error message to a (line, column) pair + /// + /// All indexes are 0-based. + pub fn to_linecol(&self, offset: usize) -> (usize, usize) { + let mut cur = 0; + for (i, line) in self.input.lines().enumerate() { + if cur + line.len() + 1 > offset { + return (i, offset - cur) + } + cur += line.len() + 1; + } + (self.input.lines().count(), 0) + } + + /// Historical versions of toml-rs accidentally allowed a newline after a + /// table definition, but the TOML spec requires a newline after a table + /// definition header. + /// + /// This option can be set to `false` (the default is `true`) to emulate + /// this behavior for backwards compatibility with older toml-rs versions. + pub fn set_require_newline_after_table(&mut self, require: bool) { + self.require_newline_after_table = require; + } + + fn next_pos(&self) -> usize { + self.cur.clone().next().map(|p| p.0).unwrap_or(self.input.len()) + } + + // Returns true and consumes the next character if it matches `ch`, + // otherwise do nothing and return false + fn eat(&mut self, ch: char) -> bool { + match self.peek(0) { + Some((_, c)) if c == ch => { self.cur.next(); true } + Some(_) | None => false, + } + } + + // Peeks ahead `n` characters + fn peek(&self, n: usize) -> Option<(usize, char)> { + self.cur.clone().skip(n).next() + } + + fn expect(&mut self, ch: char) -> bool { + if self.eat(ch) { return true } + let mut it = self.cur.clone(); + let lo = it.next().map(|p| p.0).unwrap_or(self.input.len()); + let hi = it.next().map(|p| p.0).unwrap_or(self.input.len()); + self.errors.push(ParserError { + lo: lo, + hi: hi, + desc: match self.cur.clone().next() { + Some((_, c)) => format!("expected `{}`, but found `{}`", ch, c), + None => format!("expected `{}`, but found eof", ch) + } + }); + false + } + + // Consumes a BOM (Byte Order Mark) if one is next + fn bom(&mut self) -> bool { + match self.peek(0) { + Some((_, '\u{feff}')) => { self.cur.next(); true } + _ => false + } + } + + // Consumes whitespace ('\t' and ' ') until another character (or EOF) is + // reached. Returns if any whitespace was consumed + fn ws(&mut self) -> bool { + let mut ret = false; + loop { + match self.peek(0) { + Some((_, '\t')) | + Some((_, ' ')) => { self.cur.next(); ret = true; } + _ => break, + } + } + ret + } + + // Consumes the rest of the line after a comment character + fn comment(&mut self) -> bool { + if !self.eat('#') { return false } + for (_, ch) in self.cur.by_ref() { + if ch == '\n' { break } + } + true + } + + // Consumes a newline if one is next + fn newline(&mut self) -> bool { + match self.peek(0) { + Some((_, '\n')) => { self.cur.next(); true } + Some((_, '\r')) if self.peek(1).map(|c| c.1) == Some('\n') => { + self.cur.next(); self.cur.next(); true + } + _ => false + } + } + + // Match EOF + fn eof(&self) -> bool { + self.peek(0).is_none() + } + + /// Executes the parser, parsing the string contained within. + /// + /// This function will return the `TomlTable` instance if parsing is + /// successful, or it will return `None` if any parse error or invalid TOML + /// error occurs. + /// + /// If an error occurs, the `errors` field of this parser can be consulted + /// to determine the cause of the parse failure. + pub fn parse(&mut self) -> Option { + let mut ret = TomlTable { values: BTreeMap::new(), defined: false }; + self.bom(); + while self.peek(0).is_some() { + self.ws(); + if self.newline() { continue } + if self.comment() { continue } + if self.eat('[') { + let array = self.eat('['); + let start = self.next_pos(); + + // Parse the name of the section + let mut keys = Vec::new(); + loop { + self.ws(); + if let Some(s) = self.key_name() { + keys.push(s); + } + self.ws(); + if self.eat(']') { + if array && !self.expect(']') { return None } + break + } + if !self.expect('.') { return None } + } + if keys.is_empty() { return None } + + // Build the section table + let mut table = TomlTable { + values: BTreeMap::new(), + defined: true, + }; + if self.require_newline_after_table { + self.ws(); + if !self.comment() && !self.newline() && !self.eof() { + self.errors.push(ParserError { + lo: start, + hi: start, + desc: "expected a newline after table definition".to_string(), + }); + return None + } + } + if !self.values(&mut table) { return None } + if array { + self.insert_array(&mut ret, &keys, Value::Table(table), + start) + } else { + self.insert_table(&mut ret, &keys, table, start) + } + } else if !self.values(&mut ret) { + return None + } + } + if !self.errors.is_empty() { + None + } else { + Some(ret.convert()) + } + } + + // Parse an array index as a natural number + fn array_index(&mut self) -> Option { + self.integer(0, false, false) + } + + /// Parse a path into a vector of paths + pub fn lookup(&mut self) -> Option> { + if self.input.is_empty() { + return Some(vec![]); + } + let mut keys = Vec::new(); + loop { + self.ws(); + if let Some(s) = self.key_name() { + keys.push(s); + } else if let Some(s) = self.array_index() { + keys.push(s); + } else { + return None + } + self.ws(); + if !self.expect('.') { return Some(keys) } + } + } + + // Parse a single key name starting at `start` + fn key_name(&mut self) -> Option { + let start = self.next_pos(); + let key = if self.eat('"') { + self.finish_basic_string(start, false) + } else if self.eat('\'') { + self.finish_literal_string(start, false) + } else { + let mut ret = String::new(); + while let Some((_, ch)) = self.cur.clone().next() { + match ch { + 'a' ... 'z' | + 'A' ... 'Z' | + '0' ... '9' | + '_' | '-' => { self.cur.next(); ret.push(ch) } + _ => break, + } + } + Some(ret) + }; + match key { + Some(ref name) if name.is_empty() => { + self.errors.push(ParserError { + lo: start, + hi: start, + desc: "expected a key but found an empty string".to_string(), + }); + None + } + Some(name) => Some(name), + None => None, + } + } + + // Parses the values into the given TomlTable. Returns true in case of success + // and false in case of error. + fn values(&mut self, into: &mut TomlTable) -> bool { + loop { + self.ws(); + if self.newline() { continue } + if self.comment() { continue } + match self.peek(0) { + Some((_, '[')) => break, + Some(..) => {} + None => break, + } + let key_lo = self.next_pos(); + let key = match self.key_name() { + Some(s) => s, + None => return false + }; + if !self.keyval_sep() { return false } + let value = match self.value() { + Some(value) => value, + None => return false, + }; + let end = self.next_pos(); + self.insert(into, key, value, key_lo); + self.ws(); + if !self.comment() && !self.newline() { + if self.peek(0).is_none() { + return true + } + self.errors.push(ParserError { + lo: key_lo, + hi: end, + desc: "expected a newline after a key".to_string(), + }); + return false + } + } + true + } + + fn keyval_sep(&mut self) -> bool { + self.ws(); + if !self.expect('=') { return false } + self.ws(); + true + } + + // Parses a value + fn value(&mut self) -> Option { + self.ws(); + match self.cur.clone().next() { + Some((pos, '"')) => self.basic_string(pos), + Some((pos, '\'')) => self.literal_string(pos), + Some((pos, 't')) | + Some((pos, 'f')) => self.boolean(pos), + Some((pos, '[')) => self.array(pos), + Some((pos, '{')) => self.inline_table(pos), + Some((pos, '-')) | + Some((pos, '+')) => self.number_or_datetime(pos), + Some((pos, ch)) if is_digit(ch) => self.number_or_datetime(pos), + _ => { + let mut it = self.cur.clone(); + let lo = it.next().map(|p| p.0).unwrap_or(self.input.len()); + let hi = it.next().map(|p| p.0).unwrap_or(self.input.len()); + self.errors.push(ParserError { + lo: lo, + hi: hi, + desc: "expected a value".to_string(), + }); + None + } + } + } + + // Parses a single or multi-line string + fn basic_string(&mut self, start: usize) -> Option { + if !self.expect('"') { return None } + let mut multiline = false; + + // detect multiline literals, but be careful about empty "" + // strings + if self.eat('"') { + if self.eat('"') { + multiline = true; + self.newline(); + } else { + // empty + return Some(Value::String(String::new())) + } + } + + self.finish_basic_string(start, multiline).map(Value::String) + } + + // Finish parsing a basic string after the opening quote has been seen + fn finish_basic_string(&mut self, + start: usize, + multiline: bool) -> Option { + let mut ret = String::new(); + loop { + while multiline && self.newline() { ret.push('\n') } + match self.cur.next() { + Some((_, '"')) => { + if multiline { + if !self.eat('"') { ret.push_str("\""); continue } + if !self.eat('"') { ret.push_str("\"\""); continue } + } + return Some(ret) + } + Some((pos, '\\')) => { + if let Some(c) = escape(self, pos, multiline) { + ret.push(c); + } + } + Some((pos, ch)) if ch < '\u{1f}' => { + self.errors.push(ParserError { + lo: pos, + hi: pos + 1, + desc: format!("control character `{}` must be escaped", + ch.escape_default().collect::()) + }); + } + Some((_, ch)) => ret.push(ch), + None => { + self.errors.push(ParserError { + lo: start, + hi: self.input.len(), + desc: "unterminated string literal".to_string(), + }); + return None + } + } + } + + fn escape(me: &mut Parser, pos: usize, multiline: bool) -> Option { + if multiline && me.newline() { + while me.ws() || me.newline() { /* ... */ } + return None + } + match me.cur.next() { + Some((_, 'b')) => Some('\u{8}'), + Some((_, 't')) => Some('\u{9}'), + Some((_, 'n')) => Some('\u{a}'), + Some((_, 'f')) => Some('\u{c}'), + Some((_, 'r')) => Some('\u{d}'), + Some((_, '"')) => Some('\u{22}'), + Some((_, '\\')) => Some('\u{5c}'), + Some((pos, c @ 'u')) | + Some((pos, c @ 'U')) => { + let len = if c == 'u' {4} else {8}; + let num = &me.input[pos+1..]; + let num = if num.char_indices().nth(len).map(|(i, _)| i).unwrap_or(0) == len { + &num[..len] + } else { + "invalid" + }; + if let Some(n) = u32::from_str_radix(num, 16).ok() { + if let Some(c) = char::from_u32(n) { + me.cur.by_ref().skip(len - 1).next(); + return Some(c) + } else { + me.errors.push(ParserError { + lo: pos + 1, + hi: pos + 5, + desc: format!("codepoint `{:x}` is \ + not a valid unicode \ + codepoint", n), + }) + } + } else { + me.errors.push(ParserError { + lo: pos, + hi: pos + 1, + desc: format!("expected {} hex digits \ + after a `{}` escape", len, c), + }) + } + None + } + Some((pos, ch)) => { + let next_pos = me.next_pos(); + me.errors.push(ParserError { + lo: pos, + hi: next_pos, + desc: format!("unknown string escape: `{}`", + ch.escape_default().collect::()), + }); + None + } + None => { + me.errors.push(ParserError { + lo: pos, + hi: pos + 1, + desc: "unterminated escape sequence".to_string(), + }); + None + } + } + } + } + + fn literal_string(&mut self, start: usize) -> Option { + if !self.expect('\'') { return None } + let mut multiline = false; + + // detect multiline literals + if self.eat('\'') { + if self.eat('\'') { + multiline = true; + self.newline(); + } else { + return Some(Value::String(String::new())) // empty + } + } + + self.finish_literal_string(start, multiline).map(Value::String) + } + + fn finish_literal_string(&mut self, start: usize, multiline: bool) + -> Option { + let mut ret = String::new(); + loop { + if !multiline && self.newline() { + let next = self.next_pos(); + self.errors.push(ParserError { + lo: start, + hi: next, + desc: "literal strings cannot contain newlines".to_string(), + }); + return None + } + match self.cur.next() { + Some((_, '\'')) => { + if multiline { + if !self.eat('\'') { ret.push_str("'"); continue } + if !self.eat('\'') { ret.push_str("''"); continue } + } + return Some(ret) + } + Some((_, ch)) => ret.push(ch), + None => { + self.errors.push(ParserError { + lo: start, + hi: self.input.len(), + desc: "unterminated string literal".to_string(), + }); + return None + } + } + } + } + + fn number_or_datetime(&mut self, start: usize) -> Option { + let mut is_float = false; + let prefix = try!(self.integer(start, false, true)); + let decimal = if self.eat('.') { + is_float = true; + Some(try!(self.integer(start, true, false))) + } else { + None + }; + let exponent = if self.eat('e') || self.eat('E') { + is_float = true; + Some(try!(self.integer(start, false, true))) + } else { + None + }; + let end = self.next_pos(); + let input = &self.input[start..end]; + let ret = if decimal.is_none() && + exponent.is_none() && + !input.starts_with('+') && + !input.starts_with('-') && + start + 4 == end && + self.eat('-') { + self.datetime(start) + } else { + let input = match (decimal, exponent) { + (None, None) => prefix, + (Some(ref d), None) => prefix + "." + d, + (None, Some(ref e)) => prefix + "E" + e, + (Some(ref d), Some(ref e)) => prefix + "." + d + "E" + e, + }; + let input = input.trim_left_matches('+'); + if is_float { + input.parse().ok().map(Value::Float) + } else { + input.parse().ok().map(Value::Integer) + } + }; + if ret.is_none() { + self.errors.push(ParserError { + lo: start, + hi: end, + desc: "invalid numeric literal".to_string(), + }); + } + ret + } + + fn integer(&mut self, + start: usize, + allow_leading_zeros: bool, + allow_sign: bool) -> Option { + let mut s = String::new(); + if allow_sign { + if self.eat('-') { s.push('-'); } + else if self.eat('+') { s.push('+'); } + } + match self.cur.next() { + Some((_, '0')) if !allow_leading_zeros => { + s.push('0'); + match self.peek(0) { + Some((pos, c)) if '0' <= c && c <= '9' => { + self.errors.push(ParserError { + lo: start, + hi: pos, + desc: "leading zeroes are not allowed".to_string(), + }); + return None + } + _ => {} + } + } + Some((_, ch)) if '0' <= ch && ch <= '9' => { + s.push(ch); + } + _ => { + let pos = self.next_pos(); + self.errors.push(ParserError { + lo: pos, + hi: pos, + desc: "expected start of a numeric literal".to_string(), + }); + return None; + } + } + let mut underscore = false; + loop { + match self.cur.clone().next() { + Some((_, ch)) if '0' <= ch && ch <= '9' => { + s.push(ch); + self.cur.next(); + underscore = false; + } + Some((_, '_')) if !underscore => { + self.cur.next(); + underscore = true; + } + Some(_) | None => break, + } + } + if underscore { + let pos = self.next_pos(); + self.errors.push(ParserError { + lo: pos, + hi: pos, + desc: "numeral cannot end with an underscore".to_string(), + }); + None + } else { + Some(s) + } + } + + fn boolean(&mut self, start: usize) -> Option { + let rest = &self.input[start..]; + if rest.starts_with("true") { + for _ in 0..4 { + self.cur.next(); + } + Some(Value::Boolean(true)) + } else if rest.starts_with("false") { + for _ in 0..5 { + self.cur.next(); + } + Some(Value::Boolean(false)) + } else { + let next = self.next_pos(); + self.errors.push(ParserError { + lo: start, + hi: next, + desc: format!("unexpected character: `{}`", + rest.chars().next().unwrap()), + }); + None + } + } + + fn datetime(&mut self, start: usize) -> Option { + // Up to `start` already contains the year, and we've eaten the next + // `-`, so we just resume parsing from there. + + let mut valid = true; + + // month + valid = valid && digit(self.cur.next()); + valid = valid && digit(self.cur.next()); + + // day + valid = valid && self.cur.next().map(|c| c.1) == Some('-'); + valid = valid && digit(self.cur.next()); + valid = valid && digit(self.cur.next()); + + valid = valid && self.cur.next().map(|c| c.1) == Some('T'); + + // hour + valid = valid && digit(self.cur.next()); + valid = valid && digit(self.cur.next()); + + // minute + valid = valid && self.cur.next().map(|c| c.1) == Some(':'); + valid = valid && digit(self.cur.next()); + valid = valid && digit(self.cur.next()); + + // second + valid = valid && self.cur.next().map(|c| c.1) == Some(':'); + valid = valid && digit(self.cur.next()); + valid = valid && digit(self.cur.next()); + + // fractional seconds + if self.eat('.') { + valid = valid && digit(self.cur.next()); + loop { + match self.cur.clone().next() { + Some((_, c)) if is_digit(c) => { + self.cur.next(); + } + _ => break, + } + } + } + + // time zone + if !self.eat('Z') { + valid = valid && (self.eat('+') || self.eat('-')); + + // hour + valid = valid && digit(self.cur.next()); + valid = valid && digit(self.cur.next()); + + // minute + valid = valid && self.cur.next().map(|c| c.1) == Some(':'); + valid = valid && digit(self.cur.next()); + valid = valid && digit(self.cur.next()); + } + + return if valid { + Some(Value::Datetime(self.input[start..self.next_pos()].to_string())) + } else { + let next = self.next_pos(); + self.errors.push(ParserError { + lo: start, + hi: start + next, + desc: "malformed date literal".to_string(), + }); + None + }; + + fn digit(val: Option<(usize, char)>) -> bool { + match val { + Some((_, c)) => is_digit(c), + None => false, + } + } + } + + fn array(&mut self, _start: usize) -> Option { + if !self.expect('[') { return None } + let mut ret = Vec::new(); + fn consume(me: &mut Parser) { + loop { + me.ws(); + if !me.newline() && !me.comment() { break } + } + } + let mut type_str = None; + loop { + // Break out early if we see the closing bracket + consume(self); + if self.eat(']') { return Some(Value::Array(ret)) } + + // Attempt to parse a value, triggering an error if it's the wrong + // type. + let start = self.next_pos(); + let value = try!(self.value()); + let end = self.next_pos(); + let expected = type_str.unwrap_or(value.type_str()); + if value.type_str() != expected { + self.errors.push(ParserError { + lo: start, + hi: end, + desc: format!("expected type `{}`, found type `{}`", + expected, value.type_str()), + }); + } else { + type_str = Some(expected); + ret.push(value); + } + + // Look for a comma. If we don't find one we're done + consume(self); + if !self.eat(',') { break } + } + consume(self); + if !self.expect(']') { return None } + Some(Value::Array(ret)) + } + + fn inline_table(&mut self, _start: usize) -> Option { + if !self.expect('{') { return None } + self.ws(); + let mut ret = TomlTable { values: BTreeMap::new(), defined: true }; + if self.eat('}') { return Some(Value::Table(ret)) } + loop { + let lo = self.next_pos(); + let key = try!(self.key_name()); + if !self.keyval_sep() { return None } + let value = try!(self.value()); + self.insert(&mut ret, key, value, lo); + + self.ws(); + if self.eat('}') { break } + if !self.expect(',') { return None } + self.ws(); + } + Some(Value::Table(ret)) + } + + fn insert(&mut self, into: &mut TomlTable, key: String, value: Value, + key_lo: usize) { + if let Entry::Vacant(entry) = into.values.entry(key.clone()) { + entry.insert(value); + } else { + self.errors.push(ParserError { + lo: key_lo, + hi: key_lo + key.len(), + desc: format!("duplicate key: `{}`", key), + }); + } + } + + fn recurse<'b>(&mut self, mut cur: &'b mut TomlTable, keys: &'b [String], + key_lo: usize) -> Option<(&'b mut TomlTable, &'b str)> { + let key_hi = keys.iter().fold(0, |a, b| a + b.len()); + for part in keys[..keys.len() - 1].iter() { + let tmp = cur; + + if tmp.values.contains_key(part) { + match *tmp.values.get_mut(part).unwrap() { + Value::Table(ref mut table) => cur = table, + Value::Array(ref mut array) => { + match array.last_mut() { + Some(&mut Value::Table(ref mut table)) => cur = table, + _ => { + self.errors.push(ParserError { + lo: key_lo, + hi: key_hi, + desc: format!("array `{}` does not contain \ + tables", part) + }); + return None + } + } + } + _ => { + self.errors.push(ParserError { + lo: key_lo, + hi: key_hi, + desc: format!("key `{}` was not previously a table", + part) + }); + return None + } + } + continue + } + + // Initialize an empty table as part of this sub-key + tmp.values.insert(part.clone(), Value::Table(TomlTable { + values: BTreeMap::new(), + defined: false, + })); + match *tmp.values.get_mut(part).unwrap() { + Value::Table(ref mut inner) => cur = inner, + _ => unreachable!(), + } + } + Some((cur, &**keys.last().unwrap())) + } + + fn insert_table(&mut self, into: &mut TomlTable, keys: &[String], + table: TomlTable, key_lo: usize) { + let (into, key) = match self.recurse(into, keys, key_lo) { + Some(pair) => pair, + None => return, + }; + if !into.values.contains_key(key) { + into.values.insert(key.to_owned(), Value::Table(table)); + return + } + if let Value::Table(ref mut into) = *into.values.get_mut(key).unwrap() { + if into.defined { + self.errors.push(ParserError { + lo: key_lo, + hi: key_lo + key.len(), + desc: format!("redefinition of table `{}`", key), + }); + } + for (k, v) in table.values { + if into.values.insert(k.clone(), v).is_some() { + self.errors.push(ParserError { + lo: key_lo, + hi: key_lo + key.len(), + desc: format!("duplicate key `{}` in table", k), + }); + } + } + } else { + self.errors.push(ParserError { + lo: key_lo, + hi: key_lo + key.len(), + desc: format!("duplicate key `{}` in table", key), + }); + } + } + + fn insert_array(&mut self, into: &mut TomlTable, + keys: &[String], value: Value, key_lo: usize) { + let (into, key) = match self.recurse(into, keys, key_lo) { + Some(pair) => pair, + None => return, + }; + if !into.values.contains_key(key) { + into.values.insert(key.to_owned(), Value::Array(Vec::new())); + } + match *into.values.get_mut(key).unwrap() { + Value::Array(ref mut vec) => { + match vec.first() { + Some(ref v) if !v.same_type(&value) => { + self.errors.push(ParserError { + lo: key_lo, + hi: key_lo + key.len(), + desc: format!("expected type `{}`, found type `{}`", + v.type_str(), value.type_str()), + }) + } + Some(..) | None => {} + } + vec.push(value); + } + _ => { + self.errors.push(ParserError { + lo: key_lo, + hi: key_lo + key.len(), + desc: format!("key `{}` was previously not an array", key), + }); + } + } + } +} + +impl Error for ParserError { + fn description(&self) -> &str { "TOML parse error" } +} + +impl fmt::Display for ParserError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.desc.fmt(f) + } +} + +fn is_digit(c: char) -> bool { + match c { '0' ... '9' => true, _ => false } +} + +#[cfg(test)] +mod tests { + use Value::Table; + use Parser; + + macro_rules! bad { + ($s:expr, $msg:expr) => ({ + let mut p = Parser::new($s); + assert!(p.parse().is_none()); + assert!(p.errors.iter().any(|e| e.desc.contains($msg)), + "errors: {:?}", p.errors); + }) + } + + #[test] + fn lookup_internal() { + let mut parser = Parser::new(r#"hello."world\t".a.0.'escaped'.value"#); + let result = vec![ + String::from("hello"), + String::from("world\t"), + String::from("a"), + String::from("0"), + String::from("escaped"), + String::from("value") + ]; + + assert_eq!(parser.lookup().unwrap(), result); + } + + #[test] + fn lookup_internal_void() { + let mut parser = Parser::new(""); + assert_eq!(parser.lookup().unwrap(), Vec::::new()); + } + + #[test] + fn lookup_internal_simple() { + let mut parser = Parser::new("value"); + assert_eq!(parser.lookup().unwrap(), vec![String::from("value")]); + } + + // This is due to key_name not parsing an empty "" correctly. Disabled for now. + #[test] + #[ignore] + fn lookup_internal_quoted_void() { + let mut parser = Parser::new("\"\""); + assert_eq!(parser.lookup().unwrap(), vec![String::from("")]); + } + + + #[test] + fn crlf() { + let mut p = Parser::new("\ +[project]\r\n\ +\r\n\ +name = \"splay\"\r\n\ +version = \"0.1.0\"\r\n\ +authors = [\"alex@crichton.co\"]\r\n\ +\r\n\ +[[lib]]\r\n\ +\r\n\ +path = \"lib.rs\"\r\n\ +name = \"splay\"\r\n\ +description = \"\"\"\ +A Rust implementation of a TAR file reader and writer. This library does not\r\n\ +currently handle compression, but it is abstract over all I/O readers and\r\n\ +writers. Additionally, great lengths are taken to ensure that the entire\r\n\ +contents are never required to be entirely resident in memory all at once.\r\n\ +\"\"\"\ +"); + assert!(p.parse().is_some()); + } + + #[test] + fn linecol() { + let p = Parser::new("ab\ncde\nf"); + assert_eq!(p.to_linecol(0), (0, 0)); + assert_eq!(p.to_linecol(1), (0, 1)); + assert_eq!(p.to_linecol(3), (1, 0)); + assert_eq!(p.to_linecol(4), (1, 1)); + assert_eq!(p.to_linecol(7), (2, 0)); + } + + #[test] + fn fun_with_strings() { + let mut p = Parser::new(r#" +bar = "\U00000000" +key1 = "One\nTwo" +key2 = """One\nTwo""" +key3 = """ +One +Two""" + +key4 = "The quick brown fox jumps over the lazy dog." +key5 = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" +key6 = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ +# What you see is what you get. +winpath = 'C:\Users\nodejs\templates' +winpath2 = '\\ServerX\admin$\system32\' +quoted = 'Tom "Dubs" Preston-Werner' +regex = '<\i\c*\s*>' + +regex2 = '''I [dw]on't need \d{2} apples''' +lines = ''' +The first newline is +trimmed in raw strings. + All other whitespace + is preserved. +''' +"#); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("bar").and_then(|k| k.as_str()), Some("\0")); + assert_eq!(table.lookup("key1").and_then(|k| k.as_str()), + Some("One\nTwo")); + assert_eq!(table.lookup("key2").and_then(|k| k.as_str()), + Some("One\nTwo")); + assert_eq!(table.lookup("key3").and_then(|k| k.as_str()), + Some("One\nTwo")); + + let msg = "The quick brown fox jumps over the lazy dog."; + assert_eq!(table.lookup("key4").and_then(|k| k.as_str()), Some(msg)); + assert_eq!(table.lookup("key5").and_then(|k| k.as_str()), Some(msg)); + assert_eq!(table.lookup("key6").and_then(|k| k.as_str()), Some(msg)); + + assert_eq!(table.lookup("winpath").and_then(|k| k.as_str()), + Some(r"C:\Users\nodejs\templates")); + assert_eq!(table.lookup("winpath2").and_then(|k| k.as_str()), + Some(r"\\ServerX\admin$\system32\")); + assert_eq!(table.lookup("quoted").and_then(|k| k.as_str()), + Some(r#"Tom "Dubs" Preston-Werner"#)); + assert_eq!(table.lookup("regex").and_then(|k| k.as_str()), + Some(r"<\i\c*\s*>")); + assert_eq!(table.lookup("regex2").and_then(|k| k.as_str()), + Some(r"I [dw]on't need \d{2} apples")); + assert_eq!(table.lookup("lines").and_then(|k| k.as_str()), + Some("The first newline is\n\ + trimmed in raw strings.\n \ + All other whitespace\n \ + is preserved.\n")); + } + + #[test] + fn tables_in_arrays() { + let mut p = Parser::new(r#" +[[foo]] + #… + [foo.bar] + #… + +[[foo]] # ... + #… + [foo.bar] + #... +"#); + let table = Table(p.parse().unwrap()); + table.lookup("foo.0.bar").unwrap().as_table().unwrap(); + table.lookup("foo.1.bar").unwrap().as_table().unwrap(); + } + + #[test] + fn empty_table() { + let mut p = Parser::new(r#" +[foo]"#); + let table = Table(p.parse().unwrap()); + table.lookup("foo").unwrap().as_table().unwrap(); + } + + #[test] + fn fruit() { + let mut p = Parser::new(r#" +[[fruit]] + name = "apple" + + [fruit.physical] + color = "red" + shape = "round" + + [[fruit.variety]] + name = "red delicious" + + [[fruit.variety]] + name = "granny smith" + +[[fruit]] + name = "banana" + + [[fruit.variety]] + name = "plantain" +"#); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("fruit.0.name").and_then(|k| k.as_str()), + Some("apple")); + assert_eq!(table.lookup("fruit.0.physical.color").and_then(|k| k.as_str()), + Some("red")); + assert_eq!(table.lookup("fruit.0.physical.shape").and_then(|k| k.as_str()), + Some("round")); + assert_eq!(table.lookup("fruit.0.variety.0.name").and_then(|k| k.as_str()), + Some("red delicious")); + assert_eq!(table.lookup("fruit.0.variety.1.name").and_then(|k| k.as_str()), + Some("granny smith")); + assert_eq!(table.lookup("fruit.1.name").and_then(|k| k.as_str()), + Some("banana")); + assert_eq!(table.lookup("fruit.1.variety.0.name").and_then(|k| k.as_str()), + Some("plantain")); + } + + #[test] + fn stray_cr() { + assert!(Parser::new("\r").parse().is_none()); + assert!(Parser::new("a = [ \r ]").parse().is_none()); + assert!(Parser::new("a = \"\"\"\r\"\"\"").parse().is_none()); + assert!(Parser::new("a = \"\"\"\\ \r \"\"\"").parse().is_none()); + + let mut p = Parser::new("foo = '''\r'''"); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_str()), Some("\r")); + + let mut p = Parser::new("foo = '\r'"); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_str()), Some("\r")); + } + + #[test] + fn blank_literal_string() { + let mut p = Parser::new("foo = ''"); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_str()), Some("")); + } + + #[test] + fn many_blank() { + let mut p = Parser::new("foo = \"\"\"\n\n\n\"\"\""); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_str()), Some("\n\n")); + } + + #[test] + fn literal_eats_crlf() { + let mut p = Parser::new(" + foo = \"\"\"\\\r\n\"\"\" + bar = \"\"\"\\\r\n \r\n \r\n a\"\"\" + "); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_str()), Some("")); + assert_eq!(table.lookup("bar").and_then(|k| k.as_str()), Some("a")); + } + + #[test] + fn string_no_newline() { + assert!(Parser::new("a = \"\n\"").parse().is_none()); + assert!(Parser::new("a = '\n'").parse().is_none()); + } + + #[test] + fn bad_leading_zeros() { + assert!(Parser::new("a = 00").parse().is_none()); + assert!(Parser::new("a = -00").parse().is_none()); + assert!(Parser::new("a = +00").parse().is_none()); + assert!(Parser::new("a = 00.0").parse().is_none()); + assert!(Parser::new("a = -00.0").parse().is_none()); + assert!(Parser::new("a = +00.0").parse().is_none()); + assert!(Parser::new("a = 9223372036854775808").parse().is_none()); + assert!(Parser::new("a = -9223372036854775809").parse().is_none()); + } + + #[test] + fn bad_floats() { + assert!(Parser::new("a = 0.").parse().is_none()); + assert!(Parser::new("a = 0.e").parse().is_none()); + assert!(Parser::new("a = 0.E").parse().is_none()); + assert!(Parser::new("a = 0.0E").parse().is_none()); + assert!(Parser::new("a = 0.0e").parse().is_none()); + assert!(Parser::new("a = 0.0e-").parse().is_none()); + assert!(Parser::new("a = 0.0e+").parse().is_none()); + assert!(Parser::new("a = 0.0e+00").parse().is_none()); + } + + #[test] + fn floats() { + macro_rules! t { + ($actual:expr, $expected:expr) => ({ + let f = format!("foo = {}", $actual); + let mut p = Parser::new(&f); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_float()), + Some($expected)); + }) + } + + t!("1.0", 1.0); + t!("1.0e0", 1.0); + t!("1.0e+0", 1.0); + t!("1.0e-0", 1.0); + t!("1.001e-0", 1.001); + t!("2e10", 2e10); + t!("2e+10", 2e10); + t!("2e-10", 2e-10); + t!("2_0.0", 20.0); + t!("2_0.0_0e0_0", 20.0); + t!("2_0.1_0e1_0", 20.1e10); + } + + #[test] + fn bare_key_names() { + let mut p = Parser::new(" + foo = 3 + foo_3 = 3 + foo_-2--3--r23f--4-f2-4 = 3 + _ = 3 + - = 3 + 8 = 8 + \"a\" = 3 + \"!\" = 3 + \"a^b\" = 3 + \"\\\"\" = 3 + \"character encoding\" = \"value\" + 'ʎǝʞ' = \"value\" + "); + let table = Table(p.parse().unwrap()); + assert!(table.lookup("foo").is_some()); + assert!(table.lookup("-").is_some()); + assert!(table.lookup("_").is_some()); + assert!(table.lookup("8").is_some()); + assert!(table.lookup("foo_3").is_some()); + assert!(table.lookup("foo_-2--3--r23f--4-f2-4").is_some()); + assert!(table.lookup("a").is_some()); + assert!(table.lookup("\"!\"").is_some()); + assert!(table.lookup("\"\\\"\"").is_some()); + assert!(table.lookup("\"character encoding\"").is_some()); + assert!(table.lookup("'ʎǝʞ'").is_some()); + } + + #[test] + fn bad_keys() { + assert!(Parser::new("key\n=3").parse().is_none()); + assert!(Parser::new("key=\n3").parse().is_none()); + assert!(Parser::new("key|=3").parse().is_none()); + assert!(Parser::new("\"\"=3").parse().is_none()); + assert!(Parser::new("=3").parse().is_none()); + assert!(Parser::new("\"\"|=3").parse().is_none()); + assert!(Parser::new("\"\n\"|=3").parse().is_none()); + assert!(Parser::new("\"\r\"|=3").parse().is_none()); + } + + #[test] + fn bad_table_names() { + assert!(Parser::new("[]").parse().is_none()); + assert!(Parser::new("[.]").parse().is_none()); + assert!(Parser::new("[\"\".\"\"]").parse().is_none()); + assert!(Parser::new("[a.]").parse().is_none()); + assert!(Parser::new("[\"\"]").parse().is_none()); + assert!(Parser::new("[!]").parse().is_none()); + assert!(Parser::new("[\"\n\"]").parse().is_none()); + assert!(Parser::new("[a.b]\n[a.\"b\"]").parse().is_none()); + assert!(Parser::new("[']").parse().is_none()); + assert!(Parser::new("[''']").parse().is_none()); + assert!(Parser::new("['''''']").parse().is_none()); + assert!(Parser::new("['\n']").parse().is_none()); + assert!(Parser::new("['\r\n']").parse().is_none()); + } + + #[test] + fn table_names() { + let mut p = Parser::new(" + [a.\"b\"] + [\"f f\"] + [\"f.f\"] + [\"\\\"\"] + ['a.a'] + ['\"\"'] + "); + let table = Table(p.parse().unwrap()); + assert!(table.lookup("a.b").is_some()); + assert!(table.lookup("\"f f\"").is_some()); + assert!(table.lookup("\"\\\"\"").is_some()); + assert!(table.lookup("'\"\"'").is_some()); + } + + #[test] + fn invalid_bare_numeral() { + assert!(Parser::new("4").parse().is_none()); + } + + #[test] + fn inline_tables() { + assert!(Parser::new("a = {}").parse().is_some()); + assert!(Parser::new("a = {b=1}").parse().is_some()); + assert!(Parser::new("a = { b = 1 }").parse().is_some()); + assert!(Parser::new("a = {a=1,b=2}").parse().is_some()); + assert!(Parser::new("a = {a=1,b=2,c={}}").parse().is_some()); + assert!(Parser::new("a = {a=1,}").parse().is_none()); + assert!(Parser::new("a = {,}").parse().is_none()); + assert!(Parser::new("a = {a=1,a=1}").parse().is_none()); + assert!(Parser::new("a = {\n}").parse().is_none()); + assert!(Parser::new("a = {").parse().is_none()); + assert!(Parser::new("a = {a=[\n]}").parse().is_some()); + assert!(Parser::new("a = {\"a\"=[\n]}").parse().is_some()); + assert!(Parser::new("a = [\n{},\n{},\n]").parse().is_some()); + } + + #[test] + fn number_underscores() { + macro_rules! t { + ($actual:expr, $expected:expr) => ({ + let f = format!("foo = {}", $actual); + let mut p = Parser::new(&f); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_integer()), + Some($expected)); + }) + } + + t!("1_0", 10); + t!("1_0_0", 100); + t!("1_000", 1000); + t!("+1_000", 1000); + t!("-1_000", -1000); + } + + #[test] + fn bad_underscores() { + assert!(Parser::new("foo = 0_").parse().is_none()); + assert!(Parser::new("foo = 0__0").parse().is_none()); + assert!(Parser::new("foo = __0").parse().is_none()); + assert!(Parser::new("foo = 1_0_").parse().is_none()); + } + + #[test] + fn bad_unicode_codepoint() { + bad!("foo = \"\\uD800\"", "not a valid unicode codepoint"); + } + + #[test] + fn bad_strings() { + bad!("foo = \"\\uxx\"", "expected 4 hex digits"); + bad!("foo = \"\\u\"", "expected 4 hex digits"); + bad!("foo = \"\\", "unterminated"); + bad!("foo = '", "unterminated"); + } + + #[test] + fn empty_string() { + let mut p = Parser::new("foo = \"\""); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").unwrap().as_str(), Some("")); + } + + #[test] + fn booleans() { + let mut p = Parser::new("foo = true"); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").unwrap().as_bool(), Some(true)); + + let mut p = Parser::new("foo = false"); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").unwrap().as_bool(), Some(false)); + + assert!(Parser::new("foo = true2").parse().is_none()); + assert!(Parser::new("foo = false2").parse().is_none()); + assert!(Parser::new("foo = t1").parse().is_none()); + assert!(Parser::new("foo = f2").parse().is_none()); + } + + #[test] + fn bad_nesting() { + bad!(" + a = [2] + [[a]] + b = 5 + ", "expected type `integer`, found type `table`"); + bad!(" + a = 1 + [a.b] + ", "key `a` was not previously a table"); + bad!(" + a = [] + [a.b] + ", "array `a` does not contain tables"); + bad!(" + a = [] + [[a.b]] + ", "array `a` does not contain tables"); + bad!(" + [a] + b = { c = 2, d = {} } + [a.b] + c = 2 + ", "duplicate key `c` in table"); + } + + #[test] + fn bad_table_redefine() { + bad!(" + [a] + foo=\"bar\" + [a.b] + foo=\"bar\" + [a] + ", "redefinition of table `a`"); + bad!(" + [a] + foo=\"bar\" + b = { foo = \"bar\" } + [a] + ", "redefinition of table `a`"); + bad!(" + [a] + b = {} + [a.b] + ", "redefinition of table `b`"); + + bad!(" + [a] + b = {} + [a] + ", "redefinition of table `a`"); + } + + #[test] + fn datetimes() { + macro_rules! t { + ($actual:expr) => ({ + let f = format!("foo = {}", $actual); + let mut p = Parser::new(&f); + let table = Table(p.parse().unwrap()); + assert_eq!(table.lookup("foo").and_then(|k| k.as_datetime()), + Some($actual)); + }) + } + + t!("2016-09-09T09:09:09Z"); + t!("2016-09-09T09:09:09.0Z"); + t!("2016-09-09T09:09:09.0+10:00"); + t!("2016-09-09T09:09:09.01234567890-02:00"); + bad!("foo = 2016-09-09T09:09:09.Z", "malformed date literal"); + bad!("foo = 2016-9-09T09:09:09Z", "malformed date literal"); + bad!("foo = 2016-09-09T09:09:09+2:00", "malformed date literal"); + bad!("foo = 2016-09-09T09:09:09-2:00", "malformed date literal"); + bad!("foo = 2016-09-09T09:09:09Z-2:00", "expected"); + } + + #[test] + fn require_newline_after_value() { + bad!("0=0r=false", "expected a newline"); + bad!(r#" +0=""o=""m=""r=""00="0"q="""0"""e="""0""" +"#, "expected a newline"); + bad!(r#" +[[0000l0]] +0="0"[[0000l0]] +0="0"[[0000l0]] +0="0"l="0" +"#, "expected a newline"); + bad!(r#" +0=[0]00=[0,0,0]t=["0","0","0"]s=[1000-00-00T00:00:00Z,2000-00-00T00:00:00Z] +"#, "expected a newline"); + bad!(r#" +0=0r0=0r=false +"#, "expected a newline"); + bad!(r#" +0=0r0=0r=falsefal=false +"#, "expected a newline"); + } +} diff --git a/third_party/rust/toml/tests/README.md b/third_party/rust/toml/tests/README.md new file mode 100644 index 000000000000..ebbc01ccf344 --- /dev/null +++ b/third_party/rust/toml/tests/README.md @@ -0,0 +1 @@ +Tests are from https://github.com/BurntSushi/toml-test diff --git a/third_party/rust/toml/tests/formatting.rs b/third_party/rust/toml/tests/formatting.rs new file mode 100644 index 000000000000..b8f4082e3f15 --- /dev/null +++ b/third_party/rust/toml/tests/formatting.rs @@ -0,0 +1,52 @@ +extern crate rustc_serialize; +extern crate toml; +use toml::encode_str; + +#[derive(Debug, Clone, Hash, PartialEq, Eq, RustcEncodable, RustcDecodable)] +struct User { + pub name: String, + pub surname: String, +} + +#[derive(Debug, Clone, Hash, PartialEq, Eq, RustcEncodable, RustcDecodable)] +struct Users { + pub user: Vec, +} + +#[derive(Debug, Clone, Hash, PartialEq, Eq, RustcEncodable, RustcDecodable)] +struct TwoUsers { + pub user0: User, + pub user1: User, +} + +#[test] +fn no_unnecessary_newlines_array() { + assert!(!encode_str(&Users { + user: vec![ + User { + name: "John".to_string(), + surname: "Doe".to_string(), + }, + User { + name: "Jane".to_string(), + surname: "Dough".to_string(), + }, + ], + }) + .starts_with("\n")); +} + +#[test] +fn no_unnecessary_newlines_table() { + assert!(!encode_str(&TwoUsers { + user0: User { + name: "John".to_string(), + surname: "Doe".to_string(), + }, + user1: User { + name: "Jane".to_string(), + surname: "Dough".to_string(), + }, + }) + .starts_with("\n")); +} diff --git a/third_party/rust/toml/tests/invalid-encoder/array-mixed-types-ints-and-floats.json b/third_party/rust/toml/tests/invalid-encoder/array-mixed-types-ints-and-floats.json new file mode 100644 index 000000000000..2d42ead67e62 --- /dev/null +++ b/third_party/rust/toml/tests/invalid-encoder/array-mixed-types-ints-and-floats.json @@ -0,0 +1,15 @@ +{ + "ints-and-floats": { + "type": "array", + "value": [ + { + "type": "integer", + "value": "1" + }, + { + "type": "float", + "value": "1.1" + } + ] + } +} diff --git a/third_party/rust/toml/tests/invalid.rs b/third_party/rust/toml/tests/invalid.rs new file mode 100644 index 000000000000..63e4de8e7130 --- /dev/null +++ b/third_party/rust/toml/tests/invalid.rs @@ -0,0 +1,108 @@ +extern crate toml; + +use toml::{Parser}; + +fn run(toml: &str) { + let mut p = Parser::new(toml); + let table = p.parse(); + assert!(table.is_none()); + assert!(p.errors.len() > 0); + + // test Parser::to_linecol with the generated error offsets + for error in &p.errors { + p.to_linecol(error.lo); + p.to_linecol(error.hi); + } +} + +macro_rules! test( ($name:ident, $toml:expr) => ( + #[test] + fn $name() { run($toml); } +) ); + +test!(array_mixed_types_arrays_and_ints, + include_str!("invalid/array-mixed-types-arrays-and-ints.toml")); +test!(array_mixed_types_ints_and_floats, + include_str!("invalid/array-mixed-types-ints-and-floats.toml")); +test!(array_mixed_types_strings_and_ints, + include_str!("invalid/array-mixed-types-strings-and-ints.toml")); +test!(datetime_malformed_no_leads, + include_str!("invalid/datetime-malformed-no-leads.toml")); +test!(datetime_malformed_no_secs, + include_str!("invalid/datetime-malformed-no-secs.toml")); +test!(datetime_malformed_no_t, + include_str!("invalid/datetime-malformed-no-t.toml")); +test!(datetime_malformed_no_z, + include_str!("invalid/datetime-malformed-no-z.toml")); +test!(datetime_malformed_with_milli, + include_str!("invalid/datetime-malformed-with-milli.toml")); +test!(duplicate_keys, + include_str!("invalid/duplicate-keys.toml")); +test!(duplicate_key_table, + include_str!("invalid/duplicate-key-table.toml")); +test!(duplicate_tables, + include_str!("invalid/duplicate-tables.toml")); +test!(empty_implicit_table, + include_str!("invalid/empty-implicit-table.toml")); +test!(empty_table, + include_str!("invalid/empty-table.toml")); +test!(float_no_leading_zero, + include_str!("invalid/float-no-leading-zero.toml")); +test!(float_no_trailing_digits, + include_str!("invalid/float-no-trailing-digits.toml")); +test!(key_after_array, + include_str!("invalid/key-after-array.toml")); +test!(key_after_table, + include_str!("invalid/key-after-table.toml")); +test!(key_empty, + include_str!("invalid/key-empty.toml")); +test!(key_hash, + include_str!("invalid/key-hash.toml")); +test!(key_newline, + include_str!("invalid/key-newline.toml")); +test!(key_open_bracket, + include_str!("invalid/key-open-bracket.toml")); +test!(key_single_open_bracket, + include_str!("invalid/key-single-open-bracket.toml")); +test!(key_space, + include_str!("invalid/key-space.toml")); +test!(key_start_bracket, + include_str!("invalid/key-start-bracket.toml")); +test!(key_two_equals, + include_str!("invalid/key-two-equals.toml")); +test!(string_bad_byte_escape, + include_str!("invalid/string-bad-byte-escape.toml")); +test!(string_bad_escape, + include_str!("invalid/string-bad-escape.toml")); +test!(string_byte_escapes, + include_str!("invalid/string-byte-escapes.toml")); +test!(string_no_close, + include_str!("invalid/string-no-close.toml")); +test!(table_array_implicit, + include_str!("invalid/table-array-implicit.toml")); +test!(table_array_malformed_bracket, + include_str!("invalid/table-array-malformed-bracket.toml")); +test!(table_array_malformed_empty, + include_str!("invalid/table-array-malformed-empty.toml")); +test!(table_empty, + include_str!("invalid/table-empty.toml")); +test!(table_nested_brackets_close, + include_str!("invalid/table-nested-brackets-close.toml")); +test!(table_nested_brackets_open, + include_str!("invalid/table-nested-brackets-open.toml")); +test!(table_whitespace, + include_str!("invalid/table-whitespace.toml")); +test!(table_with_pound, + include_str!("invalid/table-with-pound.toml")); +test!(text_after_array_entries, + include_str!("invalid/text-after-array-entries.toml")); +test!(text_after_integer, + include_str!("invalid/text-after-integer.toml")); +test!(text_after_string, + include_str!("invalid/text-after-string.toml")); +test!(text_after_table, + include_str!("invalid/text-after-table.toml")); +test!(text_before_array_separator, + include_str!("invalid/text-before-array-separator.toml")); +test!(text_in_array, + include_str!("invalid/text-in-array.toml")); diff --git a/third_party/rust/toml/tests/invalid/array-mixed-types-arrays-and-ints.toml b/third_party/rust/toml/tests/invalid/array-mixed-types-arrays-and-ints.toml new file mode 100644 index 000000000000..051ec73136b2 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/array-mixed-types-arrays-and-ints.toml @@ -0,0 +1 @@ +arrays-and-ints = [1, ["Arrays are not integers."]] diff --git a/third_party/rust/toml/tests/invalid/array-mixed-types-ints-and-floats.toml b/third_party/rust/toml/tests/invalid/array-mixed-types-ints-and-floats.toml new file mode 100644 index 000000000000..a5aa9b7a0337 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/array-mixed-types-ints-and-floats.toml @@ -0,0 +1 @@ +ints-and-floats = [1, 1.1] diff --git a/third_party/rust/toml/tests/invalid/array-mixed-types-strings-and-ints.toml b/third_party/rust/toml/tests/invalid/array-mixed-types-strings-and-ints.toml new file mode 100644 index 000000000000..f3483080532f --- /dev/null +++ b/third_party/rust/toml/tests/invalid/array-mixed-types-strings-and-ints.toml @@ -0,0 +1 @@ +strings-and-ints = ["hi", 42] diff --git a/third_party/rust/toml/tests/invalid/datetime-malformed-no-leads.toml b/third_party/rust/toml/tests/invalid/datetime-malformed-no-leads.toml new file mode 100644 index 000000000000..123f173beb3a --- /dev/null +++ b/third_party/rust/toml/tests/invalid/datetime-malformed-no-leads.toml @@ -0,0 +1 @@ +no-leads = 1987-7-05T17:45:00Z diff --git a/third_party/rust/toml/tests/invalid/datetime-malformed-no-secs.toml b/third_party/rust/toml/tests/invalid/datetime-malformed-no-secs.toml new file mode 100644 index 000000000000..ba9390076273 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/datetime-malformed-no-secs.toml @@ -0,0 +1 @@ +no-secs = 1987-07-05T17:45Z diff --git a/third_party/rust/toml/tests/invalid/datetime-malformed-no-t.toml b/third_party/rust/toml/tests/invalid/datetime-malformed-no-t.toml new file mode 100644 index 000000000000..617e3c56d400 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/datetime-malformed-no-t.toml @@ -0,0 +1 @@ +no-t = 1987-07-0517:45:00Z diff --git a/third_party/rust/toml/tests/invalid/datetime-malformed-no-z.toml b/third_party/rust/toml/tests/invalid/datetime-malformed-no-z.toml new file mode 100644 index 000000000000..cf66b1ea6b3e --- /dev/null +++ b/third_party/rust/toml/tests/invalid/datetime-malformed-no-z.toml @@ -0,0 +1 @@ +no-z = 1987-07-05T17:45:00 diff --git a/third_party/rust/toml/tests/invalid/datetime-malformed-with-milli.toml b/third_party/rust/toml/tests/invalid/datetime-malformed-with-milli.toml new file mode 100644 index 000000000000..eef792f34d6e --- /dev/null +++ b/third_party/rust/toml/tests/invalid/datetime-malformed-with-milli.toml @@ -0,0 +1 @@ +with-milli = 1987-07-5T17:45:00.12Z diff --git a/third_party/rust/toml/tests/invalid/duplicate-key-table.toml b/third_party/rust/toml/tests/invalid/duplicate-key-table.toml new file mode 100644 index 000000000000..cedf05fc53bf --- /dev/null +++ b/third_party/rust/toml/tests/invalid/duplicate-key-table.toml @@ -0,0 +1,5 @@ +[fruit] +type = "apple" + +[fruit.type] +apple = "yes" diff --git a/third_party/rust/toml/tests/invalid/duplicate-keys.toml b/third_party/rust/toml/tests/invalid/duplicate-keys.toml new file mode 100644 index 000000000000..9b5aee0e59b3 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/duplicate-keys.toml @@ -0,0 +1,2 @@ +dupe = false +dupe = true diff --git a/third_party/rust/toml/tests/invalid/duplicate-tables.toml b/third_party/rust/toml/tests/invalid/duplicate-tables.toml new file mode 100644 index 000000000000..8ddf49b4e893 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/duplicate-tables.toml @@ -0,0 +1,2 @@ +[a] +[a] diff --git a/third_party/rust/toml/tests/invalid/empty-implicit-table.toml b/third_party/rust/toml/tests/invalid/empty-implicit-table.toml new file mode 100644 index 000000000000..0cc36d0d2815 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/empty-implicit-table.toml @@ -0,0 +1 @@ +[naughty..naughty] diff --git a/third_party/rust/toml/tests/invalid/empty-table.toml b/third_party/rust/toml/tests/invalid/empty-table.toml new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/empty-table.toml @@ -0,0 +1 @@ +[] diff --git a/third_party/rust/toml/tests/invalid/float-no-leading-zero.toml b/third_party/rust/toml/tests/invalid/float-no-leading-zero.toml new file mode 100644 index 000000000000..cab76bfd1588 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/float-no-leading-zero.toml @@ -0,0 +1,2 @@ +answer = .12345 +neganswer = -.12345 diff --git a/third_party/rust/toml/tests/invalid/float-no-trailing-digits.toml b/third_party/rust/toml/tests/invalid/float-no-trailing-digits.toml new file mode 100644 index 000000000000..cbff2d06f05c --- /dev/null +++ b/third_party/rust/toml/tests/invalid/float-no-trailing-digits.toml @@ -0,0 +1,2 @@ +answer = 1. +neganswer = -1. diff --git a/third_party/rust/toml/tests/invalid/key-after-array.toml b/third_party/rust/toml/tests/invalid/key-after-array.toml new file mode 100644 index 000000000000..5c1a1b0a9bc5 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-after-array.toml @@ -0,0 +1 @@ +[[agencies]] owner = "S Cjelli" diff --git a/third_party/rust/toml/tests/invalid/key-after-table.toml b/third_party/rust/toml/tests/invalid/key-after-table.toml new file mode 100644 index 000000000000..4bc82136ce9d --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-after-table.toml @@ -0,0 +1 @@ +[history] guard = "sleeping" diff --git a/third_party/rust/toml/tests/invalid/key-empty.toml b/third_party/rust/toml/tests/invalid/key-empty.toml new file mode 100644 index 000000000000..09f998f4163e --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-empty.toml @@ -0,0 +1 @@ + = 1 diff --git a/third_party/rust/toml/tests/invalid/key-hash.toml b/third_party/rust/toml/tests/invalid/key-hash.toml new file mode 100644 index 000000000000..e321b1fbd0c9 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-hash.toml @@ -0,0 +1 @@ +a# = 1 diff --git a/third_party/rust/toml/tests/invalid/key-newline.toml b/third_party/rust/toml/tests/invalid/key-newline.toml new file mode 100644 index 000000000000..707aad54ec34 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-newline.toml @@ -0,0 +1,2 @@ +a += 1 diff --git a/third_party/rust/toml/tests/invalid/key-open-bracket.toml b/third_party/rust/toml/tests/invalid/key-open-bracket.toml new file mode 100644 index 000000000000..f0aeb16e5000 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-open-bracket.toml @@ -0,0 +1 @@ +[abc = 1 diff --git a/third_party/rust/toml/tests/invalid/key-single-open-bracket.toml b/third_party/rust/toml/tests/invalid/key-single-open-bracket.toml new file mode 100644 index 000000000000..8e2f0bef135b --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-single-open-bracket.toml @@ -0,0 +1 @@ +[ \ No newline at end of file diff --git a/third_party/rust/toml/tests/invalid/key-space.toml b/third_party/rust/toml/tests/invalid/key-space.toml new file mode 100644 index 000000000000..201806d28013 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-space.toml @@ -0,0 +1 @@ +a b = 1 \ No newline at end of file diff --git a/third_party/rust/toml/tests/invalid/key-start-bracket.toml b/third_party/rust/toml/tests/invalid/key-start-bracket.toml new file mode 100644 index 000000000000..e0597ae1c6f1 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-start-bracket.toml @@ -0,0 +1,3 @@ +[a] +[xyz = 5 +[b] diff --git a/third_party/rust/toml/tests/invalid/key-two-equals.toml b/third_party/rust/toml/tests/invalid/key-two-equals.toml new file mode 100644 index 000000000000..25a037894eb0 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/key-two-equals.toml @@ -0,0 +1 @@ +key= = 1 diff --git a/third_party/rust/toml/tests/invalid/string-bad-byte-escape.toml b/third_party/rust/toml/tests/invalid/string-bad-byte-escape.toml new file mode 100644 index 000000000000..4c7be59f4b16 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/string-bad-byte-escape.toml @@ -0,0 +1 @@ +naughty = "\xAg" diff --git a/third_party/rust/toml/tests/invalid/string-bad-escape.toml b/third_party/rust/toml/tests/invalid/string-bad-escape.toml new file mode 100644 index 000000000000..60acb0ccc507 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/string-bad-escape.toml @@ -0,0 +1 @@ +invalid-escape = "This string has a bad \a escape character." diff --git a/third_party/rust/toml/tests/invalid/string-byte-escapes.toml b/third_party/rust/toml/tests/invalid/string-byte-escapes.toml new file mode 100644 index 000000000000..e94452a8dfc8 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/string-byte-escapes.toml @@ -0,0 +1 @@ +answer = "\x33" diff --git a/third_party/rust/toml/tests/invalid/string-no-close.toml b/third_party/rust/toml/tests/invalid/string-no-close.toml new file mode 100644 index 000000000000..0c292fcab730 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/string-no-close.toml @@ -0,0 +1 @@ +no-ending-quote = "One time, at band camp diff --git a/third_party/rust/toml/tests/invalid/table-array-implicit.toml b/third_party/rust/toml/tests/invalid/table-array-implicit.toml new file mode 100644 index 000000000000..05f2507ecb68 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-array-implicit.toml @@ -0,0 +1,14 @@ +# This test is a bit tricky. It should fail because the first use of +# `[[albums.songs]]` without first declaring `albums` implies that `albums` +# must be a table. The alternative would be quite weird. Namely, it wouldn't +# comply with the TOML spec: "Each double-bracketed sub-table will belong to +# the most *recently* defined table element *above* it." +# +# This is in contrast to the *valid* test, table-array-implicit where +# `[[albums.songs]]` works by itself, so long as `[[albums]]` isn't declared +# later. (Although, `[albums]` could be.) +[[albums.songs]] +name = "Glory Days" + +[[albums]] +name = "Born in the USA" diff --git a/third_party/rust/toml/tests/invalid/table-array-malformed-bracket.toml b/third_party/rust/toml/tests/invalid/table-array-malformed-bracket.toml new file mode 100644 index 000000000000..39c73b05c44e --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-array-malformed-bracket.toml @@ -0,0 +1,2 @@ +[[albums] +name = "Born to Run" diff --git a/third_party/rust/toml/tests/invalid/table-array-malformed-empty.toml b/third_party/rust/toml/tests/invalid/table-array-malformed-empty.toml new file mode 100644 index 000000000000..a470ca332f31 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-array-malformed-empty.toml @@ -0,0 +1,2 @@ +[[]] +name = "Born to Run" diff --git a/third_party/rust/toml/tests/invalid/table-empty.toml b/third_party/rust/toml/tests/invalid/table-empty.toml new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-empty.toml @@ -0,0 +1 @@ +[] diff --git a/third_party/rust/toml/tests/invalid/table-nested-brackets-close.toml b/third_party/rust/toml/tests/invalid/table-nested-brackets-close.toml new file mode 100644 index 000000000000..c8b5a6785800 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-nested-brackets-close.toml @@ -0,0 +1,2 @@ +[a]b] +zyx = 42 diff --git a/third_party/rust/toml/tests/invalid/table-nested-brackets-open.toml b/third_party/rust/toml/tests/invalid/table-nested-brackets-open.toml new file mode 100644 index 000000000000..246d7e91fe4f --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-nested-brackets-open.toml @@ -0,0 +1,2 @@ +[a[b] +zyx = 42 diff --git a/third_party/rust/toml/tests/invalid/table-whitespace.toml b/third_party/rust/toml/tests/invalid/table-whitespace.toml new file mode 100644 index 000000000000..79bbcb1e2983 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-whitespace.toml @@ -0,0 +1 @@ +[invalid key] \ No newline at end of file diff --git a/third_party/rust/toml/tests/invalid/table-with-pound.toml b/third_party/rust/toml/tests/invalid/table-with-pound.toml new file mode 100644 index 000000000000..0d8edb524fe1 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/table-with-pound.toml @@ -0,0 +1,2 @@ +[key#group] +answer = 42 \ No newline at end of file diff --git a/third_party/rust/toml/tests/invalid/text-after-array-entries.toml b/third_party/rust/toml/tests/invalid/text-after-array-entries.toml new file mode 100644 index 000000000000..1a7289074ed1 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/text-after-array-entries.toml @@ -0,0 +1,4 @@ +array = [ + "Is there life after an array separator?", No + "Entry" +] diff --git a/third_party/rust/toml/tests/invalid/text-after-integer.toml b/third_party/rust/toml/tests/invalid/text-after-integer.toml new file mode 100644 index 000000000000..42de7aff4d85 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/text-after-integer.toml @@ -0,0 +1 @@ +answer = 42 the ultimate answer? diff --git a/third_party/rust/toml/tests/invalid/text-after-string.toml b/third_party/rust/toml/tests/invalid/text-after-string.toml new file mode 100644 index 000000000000..c92a6f11d85a --- /dev/null +++ b/third_party/rust/toml/tests/invalid/text-after-string.toml @@ -0,0 +1 @@ +string = "Is there life after strings?" No. diff --git a/third_party/rust/toml/tests/invalid/text-after-table.toml b/third_party/rust/toml/tests/invalid/text-after-table.toml new file mode 100644 index 000000000000..87da9db26dff --- /dev/null +++ b/third_party/rust/toml/tests/invalid/text-after-table.toml @@ -0,0 +1 @@ +[error] this shouldn't be here diff --git a/third_party/rust/toml/tests/invalid/text-before-array-separator.toml b/third_party/rust/toml/tests/invalid/text-before-array-separator.toml new file mode 100644 index 000000000000..9b06a3924106 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/text-before-array-separator.toml @@ -0,0 +1,4 @@ +array = [ + "Is there life before an array separator?" No, + "Entry" +] diff --git a/third_party/rust/toml/tests/invalid/text-in-array.toml b/third_party/rust/toml/tests/invalid/text-in-array.toml new file mode 100644 index 000000000000..a6a6c42075e2 --- /dev/null +++ b/third_party/rust/toml/tests/invalid/text-in-array.toml @@ -0,0 +1,5 @@ +array = [ + "Entry 1", + I don't belong, + "Entry 2", +] diff --git a/third_party/rust/toml/tests/valid.rs b/third_party/rust/toml/tests/valid.rs new file mode 100644 index 000000000000..09589c9e7a93 --- /dev/null +++ b/third_party/rust/toml/tests/valid.rs @@ -0,0 +1,195 @@ +extern crate rustc_serialize; +extern crate toml; + +use std::collections::BTreeMap; +use rustc_serialize::json::Json; + +use toml::{Parser, Value}; +use toml::Value::{Table, Integer, Float, Boolean, Datetime, Array}; + +fn to_json(toml: Value) -> Json { + fn doit(s: &str, json: Json) -> Json { + let mut map = BTreeMap::new(); + map.insert(format!("{}", "type"), Json::String(format!("{}", s))); + map.insert(format!("{}", "value"), json); + Json::Object(map) + } + match toml { + Value::String(s) => doit("string", Json::String(s)), + Integer(i) => doit("integer", Json::String(format!("{}", i))), + Float(f) => doit("float", Json::String({ + let s = format!("{:.15}", f); + let s = format!("{}", s.trim_right_matches('0')); + if s.ends_with(".") {format!("{}0", s)} else {s} + })), + Boolean(b) => doit("bool", Json::String(format!("{}", b))), + Datetime(s) => doit("datetime", Json::String(s)), + Array(arr) => { + let is_table = match arr.first() { + Some(&Table(..)) => true, + _ => false, + }; + let json = Json::Array(arr.into_iter().map(to_json).collect()); + if is_table {json} else {doit("array", json)} + } + Table(table) => Json::Object(table.into_iter().map(|(k, v)| { + (k, to_json(v)) + }).collect()), + } +} + +fn run(toml: &str, json: &str) { + let mut p = Parser::new(toml); + let table = p.parse(); + assert!(p.errors.len() == 0, "had_errors: {:?}", + p.errors.iter().map(|e| { + (e.desc.clone(), &toml[e.lo - 5..e.hi + 5]) + }).collect::>()); + assert!(table.is_some()); + let toml = Table(table.unwrap()); + let toml_string = format!("{}", toml); + + let json = Json::from_str(json).unwrap(); + let toml_json = to_json(toml.clone()); + assert!(json == toml_json, + "expected\n{}\ngot\n{}\n", + json.pretty(), + toml_json.pretty()); + + let table2 = Parser::new(&toml_string).parse().unwrap(); + // floats are a little lossy + if table2.values().any(|v| v.as_float().is_some()) { return } + assert_eq!(toml, Table(table2)); +} + +macro_rules! test( ($name:ident, $toml:expr, $json:expr) => ( + #[test] + fn $name() { run($toml, $json); } +) ); + +test!(array_empty, + include_str!("valid/array-empty.toml"), + include_str!("valid/array-empty.json")); +test!(array_nospaces, + include_str!("valid/array-nospaces.toml"), + include_str!("valid/array-nospaces.json")); +test!(arrays_hetergeneous, + include_str!("valid/arrays-hetergeneous.toml"), + include_str!("valid/arrays-hetergeneous.json")); +test!(arrays, + include_str!("valid/arrays.toml"), + include_str!("valid/arrays.json")); +test!(arrays_nested, + include_str!("valid/arrays-nested.toml"), + include_str!("valid/arrays-nested.json")); +test!(empty, + include_str!("valid/empty.toml"), + include_str!("valid/empty.json")); +test!(bool, + include_str!("valid/bool.toml"), + include_str!("valid/bool.json")); +test!(datetime, + include_str!("valid/datetime.toml"), + include_str!("valid/datetime.json")); +test!(example, + include_str!("valid/example.toml"), + include_str!("valid/example.json")); +test!(float, + include_str!("valid/float.toml"), + include_str!("valid/float.json")); +test!(implicit_and_explicit_after, + include_str!("valid/implicit-and-explicit-after.toml"), + include_str!("valid/implicit-and-explicit-after.json")); +test!(implicit_and_explicit_before, + include_str!("valid/implicit-and-explicit-before.toml"), + include_str!("valid/implicit-and-explicit-before.json")); +test!(implicit_groups, + include_str!("valid/implicit-groups.toml"), + include_str!("valid/implicit-groups.json")); +test!(integer, + include_str!("valid/integer.toml"), + include_str!("valid/integer.json")); +test!(key_equals_nospace, + include_str!("valid/key-equals-nospace.toml"), + include_str!("valid/key-equals-nospace.json")); +test!(key_space, + include_str!("valid/key-space.toml"), + include_str!("valid/key-space.json")); +test!(key_special_chars, + include_str!("valid/key-special-chars.toml"), + include_str!("valid/key-special-chars.json")); +test!(key_with_pound, + include_str!("valid/key-with-pound.toml"), + include_str!("valid/key-with-pound.json")); +test!(long_float, + include_str!("valid/long-float.toml"), + include_str!("valid/long-float.json")); +test!(long_integer, + include_str!("valid/long-integer.toml"), + include_str!("valid/long-integer.json")); +test!(multiline_string, + include_str!("valid/multiline-string.toml"), + include_str!("valid/multiline-string.json")); +test!(raw_multiline_string, + include_str!("valid/raw-multiline-string.toml"), + include_str!("valid/raw-multiline-string.json")); +test!(raw_string, + include_str!("valid/raw-string.toml"), + include_str!("valid/raw-string.json")); +test!(string_empty, + include_str!("valid/string-empty.toml"), + include_str!("valid/string-empty.json")); +test!(string_escapes, + include_str!("valid/string-escapes.toml"), + include_str!("valid/string-escapes.json")); +test!(string_simple, + include_str!("valid/string-simple.toml"), + include_str!("valid/string-simple.json")); +test!(string_with_pound, + include_str!("valid/string-with-pound.toml"), + include_str!("valid/string-with-pound.json")); +test!(table_array_implicit, + include_str!("valid/table-array-implicit.toml"), + include_str!("valid/table-array-implicit.json")); +test!(table_array_many, + include_str!("valid/table-array-many.toml"), + include_str!("valid/table-array-many.json")); +test!(table_array_nest, + include_str!("valid/table-array-nest.toml"), + include_str!("valid/table-array-nest.json")); +test!(table_array_one, + include_str!("valid/table-array-one.toml"), + include_str!("valid/table-array-one.json")); +test!(table_empty, + include_str!("valid/table-empty.toml"), + include_str!("valid/table-empty.json")); +test!(table_sub_empty, + include_str!("valid/table-sub-empty.toml"), + include_str!("valid/table-sub-empty.json")); +test!(table_whitespace, + include_str!("valid/table-whitespace.toml"), + include_str!("valid/table-whitespace.json")); +test!(table_with_pound, + include_str!("valid/table-with-pound.toml"), + include_str!("valid/table-with-pound.json")); +test!(unicode_escape, + include_str!("valid/unicode-escape.toml"), + include_str!("valid/unicode-escape.json")); +test!(unicode_literal, + include_str!("valid/unicode-literal.toml"), + include_str!("valid/unicode-literal.json")); +test!(hard_example, + include_str!("valid/hard_example.toml"), + include_str!("valid/hard_example.json")); +test!(example2, + include_str!("valid/example2.toml"), + include_str!("valid/example2.json")); +test!(example3, + include_str!("valid/example-v0.3.0.toml"), + include_str!("valid/example-v0.3.0.json")); +test!(example4, + include_str!("valid/example-v0.4.0.toml"), + include_str!("valid/example-v0.4.0.json")); +test!(example_bom, + include_str!("valid/example-bom.toml"), + include_str!("valid/example.json")); diff --git a/third_party/rust/toml/tests/valid/array-empty.json b/third_party/rust/toml/tests/valid/array-empty.json new file mode 100644 index 000000000000..2fbf2567f87b --- /dev/null +++ b/third_party/rust/toml/tests/valid/array-empty.json @@ -0,0 +1,11 @@ +{ + "thevoid": { "type": "array", "value": [ + {"type": "array", "value": [ + {"type": "array", "value": [ + {"type": "array", "value": [ + {"type": "array", "value": []} + ]} + ]} + ]} + ]} +} diff --git a/third_party/rust/toml/tests/valid/array-empty.toml b/third_party/rust/toml/tests/valid/array-empty.toml new file mode 100644 index 000000000000..fa58dc63d488 --- /dev/null +++ b/third_party/rust/toml/tests/valid/array-empty.toml @@ -0,0 +1 @@ +thevoid = [[[[[]]]]] diff --git a/third_party/rust/toml/tests/valid/array-nospaces.json b/third_party/rust/toml/tests/valid/array-nospaces.json new file mode 100644 index 000000000000..1833d61c5597 --- /dev/null +++ b/third_party/rust/toml/tests/valid/array-nospaces.json @@ -0,0 +1,10 @@ +{ + "ints": { + "type": "array", + "value": [ + {"type": "integer", "value": "1"}, + {"type": "integer", "value": "2"}, + {"type": "integer", "value": "3"} + ] + } +} diff --git a/third_party/rust/toml/tests/valid/array-nospaces.toml b/third_party/rust/toml/tests/valid/array-nospaces.toml new file mode 100644 index 000000000000..66189367fe9e --- /dev/null +++ b/third_party/rust/toml/tests/valid/array-nospaces.toml @@ -0,0 +1 @@ +ints = [1,2,3] diff --git a/third_party/rust/toml/tests/valid/arrays-hetergeneous.json b/third_party/rust/toml/tests/valid/arrays-hetergeneous.json new file mode 100644 index 000000000000..478fa5c706b2 --- /dev/null +++ b/third_party/rust/toml/tests/valid/arrays-hetergeneous.json @@ -0,0 +1,19 @@ +{ + "mixed": { + "type": "array", + "value": [ + {"type": "array", "value": [ + {"type": "integer", "value": "1"}, + {"type": "integer", "value": "2"} + ]}, + {"type": "array", "value": [ + {"type": "string", "value": "a"}, + {"type": "string", "value": "b"} + ]}, + {"type": "array", "value": [ + {"type": "float", "value": "1.1"}, + {"type": "float", "value": "2.1"} + ]} + ] + } +} diff --git a/third_party/rust/toml/tests/valid/arrays-hetergeneous.toml b/third_party/rust/toml/tests/valid/arrays-hetergeneous.toml new file mode 100644 index 000000000000..a246fcf1deb3 --- /dev/null +++ b/third_party/rust/toml/tests/valid/arrays-hetergeneous.toml @@ -0,0 +1 @@ +mixed = [[1, 2], ["a", "b"], [1.1, 2.1]] diff --git a/third_party/rust/toml/tests/valid/arrays-nested.json b/third_party/rust/toml/tests/valid/arrays-nested.json new file mode 100644 index 000000000000..d21920cc3eb4 --- /dev/null +++ b/third_party/rust/toml/tests/valid/arrays-nested.json @@ -0,0 +1,13 @@ +{ + "nest": { + "type": "array", + "value": [ + {"type": "array", "value": [ + {"type": "string", "value": "a"} + ]}, + {"type": "array", "value": [ + {"type": "string", "value": "b"} + ]} + ] + } +} diff --git a/third_party/rust/toml/tests/valid/arrays-nested.toml b/third_party/rust/toml/tests/valid/arrays-nested.toml new file mode 100644 index 000000000000..ce3302249b72 --- /dev/null +++ b/third_party/rust/toml/tests/valid/arrays-nested.toml @@ -0,0 +1 @@ +nest = [["a"], ["b"]] diff --git a/third_party/rust/toml/tests/valid/arrays.json b/third_party/rust/toml/tests/valid/arrays.json new file mode 100644 index 000000000000..58aedbccbef1 --- /dev/null +++ b/third_party/rust/toml/tests/valid/arrays.json @@ -0,0 +1,34 @@ +{ + "ints": { + "type": "array", + "value": [ + {"type": "integer", "value": "1"}, + {"type": "integer", "value": "2"}, + {"type": "integer", "value": "3"} + ] + }, + "floats": { + "type": "array", + "value": [ + {"type": "float", "value": "1.1"}, + {"type": "float", "value": "2.1"}, + {"type": "float", "value": "3.1"} + ] + }, + "strings": { + "type": "array", + "value": [ + {"type": "string", "value": "a"}, + {"type": "string", "value": "b"}, + {"type": "string", "value": "c"} + ] + }, + "dates": { + "type": "array", + "value": [ + {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, + {"type": "datetime", "value": "1979-05-27T07:32:00Z"}, + {"type": "datetime", "value": "2006-06-01T11:00:00Z"} + ] + } +} diff --git a/third_party/rust/toml/tests/valid/arrays.toml b/third_party/rust/toml/tests/valid/arrays.toml new file mode 100644 index 000000000000..c435f57b62c5 --- /dev/null +++ b/third_party/rust/toml/tests/valid/arrays.toml @@ -0,0 +1,8 @@ +ints = [1, 2, 3] +floats = [1.1, 2.1, 3.1] +strings = ["a", "b", "c"] +dates = [ + 1987-07-05T17:45:00Z, + 1979-05-27T07:32:00Z, + 2006-06-01T11:00:00Z, +] diff --git a/third_party/rust/toml/tests/valid/bool.json b/third_party/rust/toml/tests/valid/bool.json new file mode 100644 index 000000000000..ae368e9492e3 --- /dev/null +++ b/third_party/rust/toml/tests/valid/bool.json @@ -0,0 +1,4 @@ +{ + "f": {"type": "bool", "value": "false"}, + "t": {"type": "bool", "value": "true"} +} diff --git a/third_party/rust/toml/tests/valid/bool.toml b/third_party/rust/toml/tests/valid/bool.toml new file mode 100644 index 000000000000..a8a829b34de9 --- /dev/null +++ b/third_party/rust/toml/tests/valid/bool.toml @@ -0,0 +1,2 @@ +t = true +f = false diff --git a/third_party/rust/toml/tests/valid/comments-everywhere.json b/third_party/rust/toml/tests/valid/comments-everywhere.json new file mode 100644 index 000000000000..e69a2e958239 --- /dev/null +++ b/third_party/rust/toml/tests/valid/comments-everywhere.json @@ -0,0 +1,12 @@ +{ + "group": { + "answer": {"type": "integer", "value": "42"}, + "more": { + "type": "array", + "value": [ + {"type": "integer", "value": "42"}, + {"type": "integer", "value": "42"} + ] + } + } +} diff --git a/third_party/rust/toml/tests/valid/comments-everywhere.toml b/third_party/rust/toml/tests/valid/comments-everywhere.toml new file mode 100644 index 000000000000..3dca74cade51 --- /dev/null +++ b/third_party/rust/toml/tests/valid/comments-everywhere.toml @@ -0,0 +1,24 @@ +# Top comment. + # Top comment. +# Top comment. + +# [no-extraneous-groups-please] + +[group] # Comment +answer = 42 # Comment +# no-extraneous-keys-please = 999 +# Inbetween comment. +more = [ # Comment + # What about multiple # comments? + # Can you handle it? + # + # Evil. +# Evil. + 42, 42, # Comments within arrays are fun. + # What about multiple # comments? + # Can you handle it? + # + # Evil. +# Evil. +# ] Did I fool you? +] # Hopefully not. diff --git a/third_party/rust/toml/tests/valid/datetime.json b/third_party/rust/toml/tests/valid/datetime.json new file mode 100644 index 000000000000..2ca93ce966fa --- /dev/null +++ b/third_party/rust/toml/tests/valid/datetime.json @@ -0,0 +1,3 @@ +{ + "bestdayever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"} +} diff --git a/third_party/rust/toml/tests/valid/datetime.toml b/third_party/rust/toml/tests/valid/datetime.toml new file mode 100644 index 000000000000..2e993407d71c --- /dev/null +++ b/third_party/rust/toml/tests/valid/datetime.toml @@ -0,0 +1 @@ +bestdayever = 1987-07-05T17:45:00Z diff --git a/third_party/rust/toml/tests/valid/empty.json b/third_party/rust/toml/tests/valid/empty.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/third_party/rust/toml/tests/valid/empty.json @@ -0,0 +1 @@ +{} diff --git a/third_party/rust/toml/tests/valid/empty.toml b/third_party/rust/toml/tests/valid/empty.toml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/toml/tests/valid/example-bom.toml b/third_party/rust/toml/tests/valid/example-bom.toml new file mode 100644 index 000000000000..fb5ac815c9b1 --- /dev/null +++ b/third_party/rust/toml/tests/valid/example-bom.toml @@ -0,0 +1,5 @@ +best-day-ever = 1987-07-05T17:45:00Z + +[numtheory] +boring = false +perfection = [6, 28, 496] diff --git a/third_party/rust/toml/tests/valid/example-v0.3.0.json b/third_party/rust/toml/tests/valid/example-v0.3.0.json new file mode 100644 index 000000000000..1d9dcb581c22 --- /dev/null +++ b/third_party/rust/toml/tests/valid/example-v0.3.0.json @@ -0,0 +1 @@ +{"Array":{"key1":{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"},{"type":"integer","value":"3"}]},"key2":{"type":"array","value":[{"type":"string","value":"red"},{"type":"string","value":"yellow"},{"type":"string","value":"green"}]},"key3":{"type":"array","value":[{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]},{"type":"array","value":[{"type":"integer","value":"3"},{"type":"integer","value":"4"},{"type":"integer","value":"5"}]}]},"key4":{"type":"array","value":[{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]},{"type":"array","value":[{"type":"string","value":"a"},{"type":"string","value":"b"},{"type":"string","value":"c"}]}]},"key5":{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"},{"type":"integer","value":"3"}]},"key6":{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]}},"Booleans":{"False":{"type":"bool","value":"false"},"True":{"type":"bool","value":"true"}},"Datetime":{"key1":{"type":"datetime","value":"1979-05-27T07:32:00Z"}},"Float":{"both":{},"exponent":{},"fractional":{"key1":{"type":"float","value":"1.0"},"key2":{"type":"float","value":"3.1415"},"key3":{"type":"float","value":"-0.01"}}},"Integer":{"key1":{"type":"integer","value":"99"},"key2":{"type":"integer","value":"42"},"key3":{"type":"integer","value":"0"},"key4":{"type":"integer","value":"-17"}},"String":{"Literal":{"Multiline":{"lines":{"type":"string","value":"The first newline is\ntrimmed in raw strings.\n All other whitespace\n is preserved.\n"},"regex2":{"type":"string","value":"I [dw]on't need \\d{2} apples"}},"quoted":{"type":"string","value":"Tom \"Dubs\" Preston-Werner"},"regex":{"type":"string","value":"\u003c\\i\\c*\\s*\u003e"},"winpath":{"type":"string","value":"C:\\Users\\nodejs\\templates"},"winpath2":{"type":"string","value":"\\\\ServerX\\admin$\\system32\\"}},"Multiline":{"key1":{"type":"string","value":"One\nTwo"},"key2":{"type":"string","value":"One\nTwo"},"key3":{"type":"string","value":"One\nTwo"}},"Multilined":{"Singleline":{"key1":{"type":"string","value":"The quick brown fox jumps over the lazy dog."},"key2":{"type":"string","value":"The quick brown fox jumps over the lazy dog."},"key3":{"type":"string","value":"The quick brown fox jumps over the lazy dog."}}},"basic":{"type":"string","value":"I'm a string. \"You can quote me\". Name\u0009José\nLocation\u0009SF."}},"Table":{"key":{"type":"string","value":"value"}},"dog":{"tater":{"type":{"type":"string","value":"pug"}}},"fruit":[{"name":{"type":"string","value":"apple"},"physical":{"color":{"type":"string","value":"red"},"shape":{"type":"string","value":"round"}},"variety":[{"name":{"type":"string","value":"red delicious"}},{"name":{"type":"string","value":"granny smith"}}]},{"name":{"type":"string","value":"banana"},"variety":[{"name":{"type":"string","value":"plantain"}}]}],"products":[{"name":{"type":"string","value":"Hammer"},"sku":{"type":"integer","value":"738594937"}},{},{"color":{"type":"string","value":"gray"},"name":{"type":"string","value":"Nail"},"sku":{"type":"integer","value":"284758393"}}],"x":{"y":{"z":{"w":{}}}}} diff --git a/third_party/rust/toml/tests/valid/example-v0.3.0.toml b/third_party/rust/toml/tests/valid/example-v0.3.0.toml new file mode 100644 index 000000000000..76aacc31aac9 --- /dev/null +++ b/third_party/rust/toml/tests/valid/example-v0.3.0.toml @@ -0,0 +1,182 @@ +# Comment +# I am a comment. Hear me roar. Roar. + +# Table +# Tables (also known as hash tables or dictionaries) are collections of key/value pairs. +# They appear in square brackets on a line by themselves. + +[Table] + +key = "value" # Yeah, you can do this. + +# Nested tables are denoted by table names with dots in them. Name your tables whatever crap you please, just don't use #, ., [ or ]. + +[dog.tater] +type = "pug" + +# You don't need to specify all the super-tables if you don't want to. TOML knows how to do it for you. + +# [x] you +# [x.y] don't +# [x.y.z] need these +[x.y.z.w] # for this to work + +# String +# There are four ways to express strings: basic, multi-line basic, literal, and multi-line literal. +# All strings must contain only valid UTF-8 characters. + +[String] +basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." + +[String.Multiline] + +# The following strings are byte-for-byte equivalent: +key1 = "One\nTwo" +key2 = """One\nTwo""" +key3 = """ +One +Two""" + +[String.Multilined.Singleline] + +# The following strings are byte-for-byte equivalent: +key1 = "The quick brown fox jumps over the lazy dog." + +key2 = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + +key3 = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ + +[String.Literal] + +# What you see is what you get. +winpath = 'C:\Users\nodejs\templates' +winpath2 = '\\ServerX\admin$\system32\' +quoted = 'Tom "Dubs" Preston-Werner' +regex = '<\i\c*\s*>' + + +[String.Literal.Multiline] + +regex2 = '''I [dw]on't need \d{2} apples''' +lines = ''' +The first newline is +trimmed in raw strings. + All other whitespace + is preserved. +''' + +# Integer +# Integers are whole numbers. Positive numbers may be prefixed with a plus sign. +# Negative numbers are prefixed with a minus sign. + +[Integer] +key1 = +99 +key2 = 42 +key3 = 0 +key4 = -17 + +# Float +# A float consists of an integer part (which may be prefixed with a plus or minus sign) +# followed by a fractional part and/or an exponent part. + +[Float.fractional] + +# fractional +key1 = +1.0 +key2 = 3.1415 +key3 = -0.01 + +[Float.exponent] + +# exponent +#key1 = 5e+22 +#key2 = 1e6 +#key3 = -2E-2 + +[Float.both] + +# both +#key = 6.626e-34 + +# Boolean +# Booleans are just the tokens you're used to. Always lowercase. + +[Booleans] +True = true +False = false + +# Datetime +# Datetimes are RFC 3339 dates. + +[Datetime] +key1 = 1979-05-27T07:32:00Z +#key2 = 1979-05-27T00:32:00-07:00 +#key3 = 1979-05-27T00:32:00.999999-07:00 + +# Array +# Arrays are square brackets with other primitives inside. Whitespace is ignored. Elements are separated by commas. Data types may not be mixed. + +[Array] +key1 = [ 1, 2, 3 ] +key2 = [ "red", "yellow", "green" ] +key3 = [ [ 1, 2 ], [3, 4, 5] ] +key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok + +#Arrays can also be multiline. So in addition to ignoring whitespace, arrays also ignore newlines between the brackets. +# Terminating commas are ok before the closing bracket. + +key5 = [ + 1, 2, 3 +] +key6 = [ + 1, + 2, # this is ok +] + +# Array of Tables +# These can be expressed by using a table name in double brackets. +# Each table with the same double bracketed name will be an element in the array. +# The tables are inserted in the order encountered. + +[[products]] +name = "Hammer" +sku = 738594937 + +[[products]] + +[[products]] +name = "Nail" +sku = 284758393 +color = "gray" + + +# You can create nested arrays of tables as well. + +[[fruit]] + name = "apple" + + [fruit.physical] + color = "red" + shape = "round" + + [[fruit.variety]] + name = "red delicious" + + [[fruit.variety]] + name = "granny smith" + +[[fruit]] + name = "banana" + + [[fruit.variety]] + name = "plantain" + diff --git a/third_party/rust/toml/tests/valid/example-v0.4.0.json b/third_party/rust/toml/tests/valid/example-v0.4.0.json new file mode 100644 index 000000000000..d5cac343a818 --- /dev/null +++ b/third_party/rust/toml/tests/valid/example-v0.4.0.json @@ -0,0 +1 @@ +{"array":{"key1":{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"},{"type":"integer","value":"3"}]},"key2":{"type":"array","value":[{"type":"string","value":"red"},{"type":"string","value":"yellow"},{"type":"string","value":"green"}]},"key3":{"type":"array","value":[{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]},{"type":"array","value":[{"type":"integer","value":"3"},{"type":"integer","value":"4"},{"type":"integer","value":"5"}]}]},"key4":{"type":"array","value":[{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]},{"type":"array","value":[{"type":"string","value":"a"},{"type":"string","value":"b"},{"type":"string","value":"c"}]}]},"key5":{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"},{"type":"integer","value":"3"}]},"key6":{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]}},"boolean":{"False":{"type":"bool","value":"false"},"True":{"type":"bool","value":"true"}},"datetime":{},"float":{"both":{},"exponent":{},"fractional":{"key1":{"type":"float","value":"1.0"},"key2":{"type":"float","value":"3.1415"},"key3":{"type":"float","value":"-0.01"}},"underscores":{}},"fruit":[{"name":{"type":"string","value":"apple"},"physical":{"color":{"type":"string","value":"red"},"shape":{"type":"string","value":"round"}},"variety":[{"name":{"type":"string","value":"red delicious"}},{"name":{"type":"string","value":"granny smith"}}]},{"name":{"type":"string","value":"banana"},"variety":[{"name":{"type":"string","value":"plantain"}}]}],"integer":{"key1":{"type":"integer","value":"99"},"key2":{"type":"integer","value":"42"},"key3":{"type":"integer","value":"0"},"key4":{"type":"integer","value":"-17"},"underscores":{"key1":{"type":"integer","value":"1000"},"key2":{"type":"integer","value":"5349221"},"key3":{"type":"integer","value":"12345"}}},"products":[{"name":{"type":"string","value":"Hammer"},"sku":{"type":"integer","value":"738594937"}},{},{"color":{"type":"string","value":"gray"},"name":{"type":"string","value":"Nail"},"sku":{"type":"integer","value":"284758393"}}],"string":{"basic":{"basic":{"type":"string","value":"I'm a string. \"You can quote me\". Name\u0009José\nLocation\u0009SF."}},"literal":{"multiline":{"lines":{"type":"string","value":"The first newline is\ntrimmed in raw strings.\n All other whitespace\n is preserved.\n"},"regex2":{"type":"string","value":"I [dw]on't need \\d{2} apples"}},"quoted":{"type":"string","value":"Tom \"Dubs\" Preston-Werner"},"regex":{"type":"string","value":"\u003c\\i\\c*\\s*\u003e"},"winpath":{"type":"string","value":"C:\\Users\\nodejs\\templates"},"winpath2":{"type":"string","value":"\\\\ServerX\\admin$\\system32\\"}},"multiline":{"continued":{"key1":{"type":"string","value":"The quick brown fox jumps over the lazy dog."},"key2":{"type":"string","value":"The quick brown fox jumps over the lazy dog."},"key3":{"type":"string","value":"The quick brown fox jumps over the lazy dog."}},"key1":{"type":"string","value":"One\nTwo"},"key2":{"type":"string","value":"One\nTwo"},"key3":{"type":"string","value":"One\nTwo"}}},"table":{"inline":{"name":{"first":{"type":"string","value":"Tom"},"last":{"type":"string","value":"Preston-Werner"}},"point":{"x":{"type":"integer","value":"1"},"y":{"type":"integer","value":"2"}}},"key":{"type":"string","value":"value"},"subtable":{"key":{"type":"string","value":"another value"}}},"x":{"y":{"z":{"w":{}}}}} diff --git a/third_party/rust/toml/tests/valid/example-v0.4.0.toml b/third_party/rust/toml/tests/valid/example-v0.4.0.toml new file mode 100644 index 000000000000..ffbcce0d9dfb --- /dev/null +++ b/third_party/rust/toml/tests/valid/example-v0.4.0.toml @@ -0,0 +1,235 @@ +################################################################################ +## Comment + +# Speak your mind with the hash symbol. They go from the symbol to the end of +# the line. + + +################################################################################ +## Table + +# Tables (also known as hash tables or dictionaries) are collections of +# key/value pairs. They appear in square brackets on a line by themselves. + +[table] + +key = "value" # Yeah, you can do this. + +# Nested tables are denoted by table names with dots in them. Name your tables +# whatever crap you please, just don't use #, ., [ or ]. + +[table.subtable] + +key = "another value" + +# You don't need to specify all the super-tables if you don't want to. TOML +# knows how to do it for you. + +# [x] you +# [x.y] don't +# [x.y.z] need these +[x.y.z.w] # for this to work + + +################################################################################ +## Inline Table + +# Inline tables provide a more compact syntax for expressing tables. They are +# especially useful for grouped data that can otherwise quickly become verbose. +# Inline tables are enclosed in curly braces `{` and `}`. No newlines are +# allowed between the curly braces unless they are valid within a value. + +[table.inline] + +name = { first = "Tom", last = "Preston-Werner" } +point = { x = 1, y = 2 } + + +################################################################################ +## String + +# There are four ways to express strings: basic, multi-line basic, literal, and +# multi-line literal. All strings must contain only valid UTF-8 characters. + +[string.basic] + +basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." + +[string.multiline] + +# The following strings are byte-for-byte equivalent: +key1 = "One\nTwo" +key2 = """One\nTwo""" +key3 = """ +One +Two""" + +[string.multiline.continued] + +# The following strings are byte-for-byte equivalent: +key1 = "The quick brown fox jumps over the lazy dog." + +key2 = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + +key3 = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ + +[string.literal] + +# What you see is what you get. +winpath = 'C:\Users\nodejs\templates' +winpath2 = '\\ServerX\admin$\system32\' +quoted = 'Tom "Dubs" Preston-Werner' +regex = '<\i\c*\s*>' + + +[string.literal.multiline] + +regex2 = '''I [dw]on't need \d{2} apples''' +lines = ''' +The first newline is +trimmed in raw strings. + All other whitespace + is preserved. +''' + + +################################################################################ +## Integer + +# Integers are whole numbers. Positive numbers may be prefixed with a plus sign. +# Negative numbers are prefixed with a minus sign. + +[integer] + +key1 = +99 +key2 = 42 +key3 = 0 +key4 = -17 + +[integer.underscores] + +# For large numbers, you may use underscores to enhance readability. Each +# underscore must be surrounded by at least one digit. +key1 = 1_000 +key2 = 5_349_221 +key3 = 1_2_3_4_5 # valid but inadvisable + + +################################################################################ +## Float + +# A float consists of an integer part (which may be prefixed with a plus or +# minus sign) followed by a fractional part and/or an exponent part. + +[float.fractional] + +key1 = +1.0 +key2 = 3.1415 +key3 = -0.01 + +[float.exponent] + +[float.both] + +[float.underscores] + + +################################################################################ +## Boolean + +# Booleans are just the tokens you're used to. Always lowercase. + +[boolean] + +True = true +False = false + + +################################################################################ +## Datetime + +# Datetimes are RFC 3339 dates. + +[datetime] + +#key1 = 1979-05-27T07:32:00Z +#key2 = 1979-05-27T00:32:00-07:00 +#key3 = 1979-05-27T00:32:00.999999-07:00 + + +################################################################################ +## Array + +# Arrays are square brackets with other primitives inside. Whitespace is +# ignored. Elements are separated by commas. Data types may not be mixed. + +[array] + +key1 = [ 1, 2, 3 ] +key2 = [ "red", "yellow", "green" ] +key3 = [ [ 1, 2 ], [3, 4, 5] ] +key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok + +# Arrays can also be multiline. So in addition to ignoring whitespace, arrays +# also ignore newlines between the brackets. Terminating commas are ok before +# the closing bracket. + +key5 = [ + 1, 2, 3 +] +key6 = [ + 1, + 2, # this is ok +] + + +################################################################################ +## Array of Tables + +# These can be expressed by using a table name in double brackets. Each table +# with the same double bracketed name will be an element in the array. The +# tables are inserted in the order encountered. + +[[products]] + +name = "Hammer" +sku = 738594937 + +[[products]] + +[[products]] + +name = "Nail" +sku = 284758393 +color = "gray" + + +# You can create nested arrays of tables as well. + +[[fruit]] + name = "apple" + + [fruit.physical] + color = "red" + shape = "round" + + [[fruit.variety]] + name = "red delicious" + + [[fruit.variety]] + name = "granny smith" + +[[fruit]] + name = "banana" + + [[fruit.variety]] + name = "plantain" diff --git a/third_party/rust/toml/tests/valid/example.json b/third_party/rust/toml/tests/valid/example.json new file mode 100644 index 000000000000..48aa90784a4e --- /dev/null +++ b/third_party/rust/toml/tests/valid/example.json @@ -0,0 +1,14 @@ +{ + "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, + "numtheory": { + "boring": {"type": "bool", "value": "false"}, + "perfection": { + "type": "array", + "value": [ + {"type": "integer", "value": "6"}, + {"type": "integer", "value": "28"}, + {"type": "integer", "value": "496"} + ] + } + } +} diff --git a/third_party/rust/toml/tests/valid/example.toml b/third_party/rust/toml/tests/valid/example.toml new file mode 100644 index 000000000000..8cb02e01b034 --- /dev/null +++ b/third_party/rust/toml/tests/valid/example.toml @@ -0,0 +1,5 @@ +best-day-ever = 1987-07-05T17:45:00Z + +[numtheory] +boring = false +perfection = [6, 28, 496] diff --git a/third_party/rust/toml/tests/valid/example2.json b/third_party/rust/toml/tests/valid/example2.json new file mode 100644 index 000000000000..3249a974fba7 --- /dev/null +++ b/third_party/rust/toml/tests/valid/example2.json @@ -0,0 +1 @@ +{"clients":{"data":{"type":"array","value":[{"type":"array","value":[{"type":"string","value":"gamma"},{"type":"string","value":"delta"}]},{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]}]},"hosts":{"type":"array","value":[{"type":"string","value":"alpha"},{"type":"string","value":"omega"}]}},"database":{"connection_max":{"type":"integer","value":"5000"},"enabled":{"type":"bool","value":"true"},"ports":{"type":"array","value":[{"type":"integer","value":"8001"},{"type":"integer","value":"8001"},{"type":"integer","value":"8002"}]},"server":{"type":"string","value":"192.168.1.1"}},"owner":{"bio":{"type":"string","value":"GitHub Cofounder \u0026 CEO\nLikes tater tots and beer."},"dob":{"type":"datetime","value":"1979-05-27T07:32:00Z"},"name":{"type":"string","value":"Tom Preston-Werner"},"organization":{"type":"string","value":"GitHub"}},"products":[{"name":{"type":"string","value":"Hammer"},"sku":{"type":"integer","value":"738594937"}},{"color":{"type":"string","value":"gray"},"name":{"type":"string","value":"Nail"},"sku":{"type":"integer","value":"284758393"}}],"servers":{"alpha":{"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.1"}},"beta":{"country":{"type":"string","value":"中国"},"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.2"}}},"title":{"type":"string","value":"TOML Example"}} diff --git a/third_party/rust/toml/tests/valid/example2.toml b/third_party/rust/toml/tests/valid/example2.toml new file mode 100644 index 000000000000..bc12c9901604 --- /dev/null +++ b/third_party/rust/toml/tests/valid/example2.toml @@ -0,0 +1,47 @@ +# This is a TOML document. Boom. + +title = "TOML Example" + +[owner] +name = "Tom Preston-Werner" +organization = "GitHub" +bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." +dob = 1979-05-27T07:32:00Z # First class dates? Why not? + +[database] +server = "192.168.1.1" +ports = [ 8001, 8001, 8002 ] +connection_max = 5000 +enabled = true + +[servers] + + # You can indent as you please. Tabs or spaces. TOML don't care. + [servers.alpha] + ip = "10.0.0.1" + dc = "eqdc10" + + [servers.beta] + ip = "10.0.0.2" + dc = "eqdc10" + country = "中国" # This should be parsed as UTF-8 + +[clients] +data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it + +# Line breaks are OK when inside arrays +hosts = [ + "alpha", + "omega" +] + +# Products + + [[products]] + name = "Hammer" + sku = 738594937 + + [[products]] + name = "Nail" + sku = 284758393 + color = "gray" diff --git a/third_party/rust/toml/tests/valid/float.json b/third_party/rust/toml/tests/valid/float.json new file mode 100644 index 000000000000..b8a2e97581ff --- /dev/null +++ b/third_party/rust/toml/tests/valid/float.json @@ -0,0 +1,4 @@ +{ + "pi": {"type": "float", "value": "3.14"}, + "negpi": {"type": "float", "value": "-3.14"} +} diff --git a/third_party/rust/toml/tests/valid/float.toml b/third_party/rust/toml/tests/valid/float.toml new file mode 100644 index 000000000000..7c528d200c37 --- /dev/null +++ b/third_party/rust/toml/tests/valid/float.toml @@ -0,0 +1,2 @@ +pi = 3.14 +negpi = -3.14 diff --git a/third_party/rust/toml/tests/valid/hard_example.json b/third_party/rust/toml/tests/valid/hard_example.json new file mode 100644 index 000000000000..9762e58ef356 --- /dev/null +++ b/third_party/rust/toml/tests/valid/hard_example.json @@ -0,0 +1 @@ +{"the":{"hard":{"another_test_string":{"type":"string","value":" Same thing, but with a string #"},"bit#":{"multi_line_array":{"type":"array","value":[{"type":"string","value":"]"}]},"what?":{"type":"string","value":"You don't think some user won't do that?"}},"harder_test_string":{"type":"string","value":" And when \"'s are in the string, along with # \""},"test_array":{"type":"array","value":[{"type":"string","value":"] "},{"type":"string","value":" # "}]},"test_array2":{"type":"array","value":[{"type":"string","value":"Test #11 ]proved that"},{"type":"string","value":"Experiment #9 was a success"}]}},"test_string":{"type":"string","value":"You'll hate me after this - #"}}} diff --git a/third_party/rust/toml/tests/valid/hard_example.toml b/third_party/rust/toml/tests/valid/hard_example.toml new file mode 100644 index 000000000000..38856c8737a8 --- /dev/null +++ b/third_party/rust/toml/tests/valid/hard_example.toml @@ -0,0 +1,33 @@ +# Test file for TOML +# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate +# This part you'll really hate + +[the] +test_string = "You'll hate me after this - #" # " Annoying, isn't it? + + [the.hard] + test_array = [ "] ", " # "] # ] There you go, parse this! + test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ] + # You didn't think it'd as easy as chucking out the last #, did you? + another_test_string = " Same thing, but with a string #" + harder_test_string = " And when \"'s are in the string, along with # \"" # "and comments are there too" + # Things will get harder + + [the.hard."bit#"] + "what?" = "You don't think some user won't do that?" + multi_line_array = [ + "]", + # ] Oh yes I did + ] + +# Each of the following keygroups/key value pairs should produce an error. Uncomment to them to test + +#[error] if you didn't catch this, your parser is broken +#string = "Anything other than tabs, spaces and newline after a keygroup or key value pair has ended should produce an error unless it is a comment" like this +#array = [ +# "This might most likely happen in multiline arrays", +# Like here, +# "or here, +# and here" +# ] End of array comment, forgot the # +#number = 3.14 pi <--again forgot the # diff --git a/third_party/rust/toml/tests/valid/implicit-and-explicit-after.json b/third_party/rust/toml/tests/valid/implicit-and-explicit-after.json new file mode 100644 index 000000000000..374bd09343ef --- /dev/null +++ b/third_party/rust/toml/tests/valid/implicit-and-explicit-after.json @@ -0,0 +1,10 @@ +{ + "a": { + "better": {"type": "integer", "value": "43"}, + "b": { + "c": { + "answer": {"type": "integer", "value": "42"} + } + } + } +} diff --git a/third_party/rust/toml/tests/valid/implicit-and-explicit-after.toml b/third_party/rust/toml/tests/valid/implicit-and-explicit-after.toml new file mode 100644 index 000000000000..c0e8865b392c --- /dev/null +++ b/third_party/rust/toml/tests/valid/implicit-and-explicit-after.toml @@ -0,0 +1,5 @@ +[a.b.c] +answer = 42 + +[a] +better = 43 diff --git a/third_party/rust/toml/tests/valid/implicit-and-explicit-before.json b/third_party/rust/toml/tests/valid/implicit-and-explicit-before.json new file mode 100644 index 000000000000..374bd09343ef --- /dev/null +++ b/third_party/rust/toml/tests/valid/implicit-and-explicit-before.json @@ -0,0 +1,10 @@ +{ + "a": { + "better": {"type": "integer", "value": "43"}, + "b": { + "c": { + "answer": {"type": "integer", "value": "42"} + } + } + } +} diff --git a/third_party/rust/toml/tests/valid/implicit-and-explicit-before.toml b/third_party/rust/toml/tests/valid/implicit-and-explicit-before.toml new file mode 100644 index 000000000000..eee68ff5143a --- /dev/null +++ b/third_party/rust/toml/tests/valid/implicit-and-explicit-before.toml @@ -0,0 +1,5 @@ +[a] +better = 43 + +[a.b.c] +answer = 42 diff --git a/third_party/rust/toml/tests/valid/implicit-groups.json b/third_party/rust/toml/tests/valid/implicit-groups.json new file mode 100644 index 000000000000..fbae7fc71bef --- /dev/null +++ b/third_party/rust/toml/tests/valid/implicit-groups.json @@ -0,0 +1,9 @@ +{ + "a": { + "b": { + "c": { + "answer": {"type": "integer", "value": "42"} + } + } + } +} diff --git a/third_party/rust/toml/tests/valid/implicit-groups.toml b/third_party/rust/toml/tests/valid/implicit-groups.toml new file mode 100644 index 000000000000..b6333e49d577 --- /dev/null +++ b/third_party/rust/toml/tests/valid/implicit-groups.toml @@ -0,0 +1,2 @@ +[a.b.c] +answer = 42 diff --git a/third_party/rust/toml/tests/valid/integer.json b/third_party/rust/toml/tests/valid/integer.json new file mode 100644 index 000000000000..61985a1e97ce --- /dev/null +++ b/third_party/rust/toml/tests/valid/integer.json @@ -0,0 +1,4 @@ +{ + "answer": {"type": "integer", "value": "42"}, + "neganswer": {"type": "integer", "value": "-42"} +} diff --git a/third_party/rust/toml/tests/valid/integer.toml b/third_party/rust/toml/tests/valid/integer.toml new file mode 100644 index 000000000000..c4f62972cb2f --- /dev/null +++ b/third_party/rust/toml/tests/valid/integer.toml @@ -0,0 +1,2 @@ +answer = 42 +neganswer = -42 diff --git a/third_party/rust/toml/tests/valid/key-equals-nospace.json b/third_party/rust/toml/tests/valid/key-equals-nospace.json new file mode 100644 index 000000000000..1f8709ab9f46 --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-equals-nospace.json @@ -0,0 +1,3 @@ +{ + "answer": {"type": "integer", "value": "42"} +} diff --git a/third_party/rust/toml/tests/valid/key-equals-nospace.toml b/third_party/rust/toml/tests/valid/key-equals-nospace.toml new file mode 100644 index 000000000000..560901c5a43f --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-equals-nospace.toml @@ -0,0 +1 @@ +answer=42 diff --git a/third_party/rust/toml/tests/valid/key-space.json b/third_party/rust/toml/tests/valid/key-space.json new file mode 100644 index 000000000000..9d1f76911d52 --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-space.json @@ -0,0 +1,3 @@ +{ + "a b": {"type": "integer", "value": "1"} +} diff --git a/third_party/rust/toml/tests/valid/key-space.toml b/third_party/rust/toml/tests/valid/key-space.toml new file mode 100644 index 000000000000..f4f36c4f6df2 --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-space.toml @@ -0,0 +1 @@ +"a b" = 1 diff --git a/third_party/rust/toml/tests/valid/key-special-chars.json b/third_party/rust/toml/tests/valid/key-special-chars.json new file mode 100644 index 000000000000..6550ebda2326 --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-special-chars.json @@ -0,0 +1,5 @@ +{ + "~!@#$^&*()_+-`1234567890[]\\|/?><.,;:'": { + "type": "integer", "value": "1" + } +} diff --git a/third_party/rust/toml/tests/valid/key-special-chars.toml b/third_party/rust/toml/tests/valid/key-special-chars.toml new file mode 100644 index 000000000000..dc43625d232e --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-special-chars.toml @@ -0,0 +1 @@ +"~!@#$^&*()_+-`1234567890[]\\|/?><.,;:'" = 1 diff --git a/third_party/rust/toml/tests/valid/key-with-pound.json b/third_party/rust/toml/tests/valid/key-with-pound.json new file mode 100644 index 000000000000..ee39e1de4cb5 --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-with-pound.json @@ -0,0 +1,3 @@ +{ + "key#name": {"type": "integer", "value": "5"} +} diff --git a/third_party/rust/toml/tests/valid/key-with-pound.toml b/third_party/rust/toml/tests/valid/key-with-pound.toml new file mode 100644 index 000000000000..65b766fd1576 --- /dev/null +++ b/third_party/rust/toml/tests/valid/key-with-pound.toml @@ -0,0 +1 @@ +"key#name" = 5 diff --git a/third_party/rust/toml/tests/valid/long-float.json b/third_party/rust/toml/tests/valid/long-float.json new file mode 100644 index 000000000000..8ceed47971ef --- /dev/null +++ b/third_party/rust/toml/tests/valid/long-float.json @@ -0,0 +1,4 @@ +{ + "longpi": {"type": "float", "value": "3.141592653589793"}, + "neglongpi": {"type": "float", "value": "-3.141592653589793"} +} diff --git a/third_party/rust/toml/tests/valid/long-float.toml b/third_party/rust/toml/tests/valid/long-float.toml new file mode 100644 index 000000000000..9558ae47c023 --- /dev/null +++ b/third_party/rust/toml/tests/valid/long-float.toml @@ -0,0 +1,2 @@ +longpi = 3.141592653589793 +neglongpi = -3.141592653589793 diff --git a/third_party/rust/toml/tests/valid/long-integer.json b/third_party/rust/toml/tests/valid/long-integer.json new file mode 100644 index 000000000000..16c331ed3983 --- /dev/null +++ b/third_party/rust/toml/tests/valid/long-integer.json @@ -0,0 +1,4 @@ +{ + "answer": {"type": "integer", "value": "9223372036854775807"}, + "neganswer": {"type": "integer", "value": "-9223372036854775808"} +} diff --git a/third_party/rust/toml/tests/valid/long-integer.toml b/third_party/rust/toml/tests/valid/long-integer.toml new file mode 100644 index 000000000000..424a13ac2af1 --- /dev/null +++ b/third_party/rust/toml/tests/valid/long-integer.toml @@ -0,0 +1,2 @@ +answer = 9223372036854775807 +neganswer = -9223372036854775808 diff --git a/third_party/rust/toml/tests/valid/multiline-string.json b/third_party/rust/toml/tests/valid/multiline-string.json new file mode 100644 index 000000000000..075bf505464b --- /dev/null +++ b/third_party/rust/toml/tests/valid/multiline-string.json @@ -0,0 +1,30 @@ +{ + "multiline_empty_one": { + "type": "string", + "value": "" + }, + "multiline_empty_two": { + "type": "string", + "value": "" + }, + "multiline_empty_three": { + "type": "string", + "value": "" + }, + "multiline_empty_four": { + "type": "string", + "value": "" + }, + "equivalent_one": { + "type": "string", + "value": "The quick brown fox jumps over the lazy dog." + }, + "equivalent_two": { + "type": "string", + "value": "The quick brown fox jumps over the lazy dog." + }, + "equivalent_three": { + "type": "string", + "value": "The quick brown fox jumps over the lazy dog." + } +} diff --git a/third_party/rust/toml/tests/valid/multiline-string.toml b/third_party/rust/toml/tests/valid/multiline-string.toml new file mode 100644 index 000000000000..15b11434ff00 --- /dev/null +++ b/third_party/rust/toml/tests/valid/multiline-string.toml @@ -0,0 +1,23 @@ +multiline_empty_one = """""" +multiline_empty_two = """ +""" +multiline_empty_three = """\ + """ +multiline_empty_four = """\ + \ + \ + """ + +equivalent_one = "The quick brown fox jumps over the lazy dog." +equivalent_two = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + +equivalent_three = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ diff --git a/third_party/rust/toml/tests/valid/raw-multiline-string.json b/third_party/rust/toml/tests/valid/raw-multiline-string.json new file mode 100644 index 000000000000..b43cce5a2d17 --- /dev/null +++ b/third_party/rust/toml/tests/valid/raw-multiline-string.json @@ -0,0 +1,14 @@ +{ + "oneline": { + "type": "string", + "value": "This string has a ' quote character." + }, + "firstnl": { + "type": "string", + "value": "This string has a ' quote character." + }, + "multiline": { + "type": "string", + "value": "This string\nhas ' a quote character\nand more than\none newline\nin it." + } +} diff --git a/third_party/rust/toml/tests/valid/raw-multiline-string.toml b/third_party/rust/toml/tests/valid/raw-multiline-string.toml new file mode 100644 index 000000000000..8094c03e31a4 --- /dev/null +++ b/third_party/rust/toml/tests/valid/raw-multiline-string.toml @@ -0,0 +1,9 @@ +oneline = '''This string has a ' quote character.''' +firstnl = ''' +This string has a ' quote character.''' +multiline = ''' +This string +has ' a quote character +and more than +one newline +in it.''' diff --git a/third_party/rust/toml/tests/valid/raw-string.json b/third_party/rust/toml/tests/valid/raw-string.json new file mode 100644 index 000000000000..693ab9b54a49 --- /dev/null +++ b/third_party/rust/toml/tests/valid/raw-string.json @@ -0,0 +1,30 @@ +{ + "backspace": { + "type": "string", + "value": "This string has a \\b backspace character." + }, + "tab": { + "type": "string", + "value": "This string has a \\t tab character." + }, + "newline": { + "type": "string", + "value": "This string has a \\n new line character." + }, + "formfeed": { + "type": "string", + "value": "This string has a \\f form feed character." + }, + "carriage": { + "type": "string", + "value": "This string has a \\r carriage return character." + }, + "slash": { + "type": "string", + "value": "This string has a \\/ slash character." + }, + "backslash": { + "type": "string", + "value": "This string has a \\\\ backslash character." + } +} diff --git a/third_party/rust/toml/tests/valid/raw-string.toml b/third_party/rust/toml/tests/valid/raw-string.toml new file mode 100644 index 000000000000..92acd2557c4c --- /dev/null +++ b/third_party/rust/toml/tests/valid/raw-string.toml @@ -0,0 +1,7 @@ +backspace = 'This string has a \b backspace character.' +tab = 'This string has a \t tab character.' +newline = 'This string has a \n new line character.' +formfeed = 'This string has a \f form feed character.' +carriage = 'This string has a \r carriage return character.' +slash = 'This string has a \/ slash character.' +backslash = 'This string has a \\ backslash character.' diff --git a/third_party/rust/toml/tests/valid/string-empty.json b/third_party/rust/toml/tests/valid/string-empty.json new file mode 100644 index 000000000000..6c26d695b29a --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-empty.json @@ -0,0 +1,6 @@ +{ + "answer": { + "type": "string", + "value": "" + } +} diff --git a/third_party/rust/toml/tests/valid/string-empty.toml b/third_party/rust/toml/tests/valid/string-empty.toml new file mode 100644 index 000000000000..e37e6815bc73 --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-empty.toml @@ -0,0 +1 @@ +answer = "" diff --git a/third_party/rust/toml/tests/valid/string-escapes.json b/third_party/rust/toml/tests/valid/string-escapes.json new file mode 100644 index 000000000000..62dac5178fb3 --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-escapes.json @@ -0,0 +1,50 @@ +{ + "backspace": { + "type": "string", + "value": "This string has a \u0008 backspace character." + }, + "tab": { + "type": "string", + "value": "This string has a \u0009 tab character." + }, + "newline": { + "type": "string", + "value": "This string has a \u000A new line character." + }, + "formfeed": { + "type": "string", + "value": "This string has a \u000C form feed character." + }, + "carriage": { + "type": "string", + "value": "This string has a \u000D carriage return character." + }, + "quote": { + "type": "string", + "value": "This string has a \u0022 quote character." + }, + "slash": { + "type": "string", + "value": "This string has a \u002F slash character." + }, + "backslash": { + "type": "string", + "value": "This string has a \u005C backslash character." + }, + "notunicode1": { + "type": "string", + "value": "This string does not have a unicode \\u escape." + }, + "notunicode2": { + "type": "string", + "value": "This string does not have a unicode \u005Cu escape." + }, + "notunicode3": { + "type": "string", + "value": "This string does not have a unicode \\u0075 escape." + }, + "notunicode4": { + "type": "string", + "value": "This string does not have a unicode \\\u0075 escape." + } +} diff --git a/third_party/rust/toml/tests/valid/string-escapes.toml b/third_party/rust/toml/tests/valid/string-escapes.toml new file mode 100644 index 000000000000..c5d495428a12 --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-escapes.toml @@ -0,0 +1,12 @@ +backspace = "This string has a \b backspace character." +tab = "This string has a \t tab character." +newline = "This string has a \n new line character." +formfeed = "This string has a \f form feed character." +carriage = "This string has a \r carriage return character." +quote = "This string has a \" quote character." +slash = "This string has a / slash character." +backslash = "This string has a \\ backslash character." +notunicode1 = "This string does not have a unicode \\u escape." +notunicode2 = "This string does not have a unicode \u005Cu escape." +notunicode3 = "This string does not have a unicode \\u0075 escape." +notunicode4 = "This string does not have a unicode \\\u0075 escape." diff --git a/third_party/rust/toml/tests/valid/string-simple.json b/third_party/rust/toml/tests/valid/string-simple.json new file mode 100644 index 000000000000..2e05f99b4d18 --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-simple.json @@ -0,0 +1,6 @@ +{ + "answer": { + "type": "string", + "value": "You are not drinking enough whisky." + } +} diff --git a/third_party/rust/toml/tests/valid/string-simple.toml b/third_party/rust/toml/tests/valid/string-simple.toml new file mode 100644 index 000000000000..e17ade6237b7 --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-simple.toml @@ -0,0 +1 @@ +answer = "You are not drinking enough whisky." diff --git a/third_party/rust/toml/tests/valid/string-with-pound.json b/third_party/rust/toml/tests/valid/string-with-pound.json new file mode 100644 index 000000000000..33cdc9c4b58c --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-with-pound.json @@ -0,0 +1,7 @@ +{ + "pound": {"type": "string", "value": "We see no # comments here."}, + "poundcomment": { + "type": "string", + "value": "But there are # some comments here." + } +} diff --git a/third_party/rust/toml/tests/valid/string-with-pound.toml b/third_party/rust/toml/tests/valid/string-with-pound.toml new file mode 100644 index 000000000000..5fd87466dff0 --- /dev/null +++ b/third_party/rust/toml/tests/valid/string-with-pound.toml @@ -0,0 +1,2 @@ +pound = "We see no # comments here." +poundcomment = "But there are # some comments here." # Did I # mess you up? diff --git a/third_party/rust/toml/tests/valid/table-array-implicit.json b/third_party/rust/toml/tests/valid/table-array-implicit.json new file mode 100644 index 000000000000..32e464012d63 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-implicit.json @@ -0,0 +1,7 @@ +{ + "albums": { + "songs": [ + {"name": {"type": "string", "value": "Glory Days"}} + ] + } +} diff --git a/third_party/rust/toml/tests/valid/table-array-implicit.toml b/third_party/rust/toml/tests/valid/table-array-implicit.toml new file mode 100644 index 000000000000..3157ac981d37 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-implicit.toml @@ -0,0 +1,2 @@ +[[albums.songs]] +name = "Glory Days" diff --git a/third_party/rust/toml/tests/valid/table-array-many.json b/third_party/rust/toml/tests/valid/table-array-many.json new file mode 100644 index 000000000000..84df2dabb0d6 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-many.json @@ -0,0 +1,16 @@ +{ + "people": [ + { + "first_name": {"type": "string", "value": "Bruce"}, + "last_name": {"type": "string", "value": "Springsteen"} + }, + { + "first_name": {"type": "string", "value": "Eric"}, + "last_name": {"type": "string", "value": "Clapton"} + }, + { + "first_name": {"type": "string", "value": "Bob"}, + "last_name": {"type": "string", "value": "Seger"} + } + ] +} diff --git a/third_party/rust/toml/tests/valid/table-array-many.toml b/third_party/rust/toml/tests/valid/table-array-many.toml new file mode 100644 index 000000000000..46062beb8e74 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-many.toml @@ -0,0 +1,11 @@ +[[people]] +first_name = "Bruce" +last_name = "Springsteen" + +[[people]] +first_name = "Eric" +last_name = "Clapton" + +[[people]] +first_name = "Bob" +last_name = "Seger" diff --git a/third_party/rust/toml/tests/valid/table-array-nest.json b/third_party/rust/toml/tests/valid/table-array-nest.json new file mode 100644 index 000000000000..c117afa40d4d --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-nest.json @@ -0,0 +1,18 @@ +{ + "albums": [ + { + "name": {"type": "string", "value": "Born to Run"}, + "songs": [ + {"name": {"type": "string", "value": "Jungleland"}}, + {"name": {"type": "string", "value": "Meeting Across the River"}} + ] + }, + { + "name": {"type": "string", "value": "Born in the USA"}, + "songs": [ + {"name": {"type": "string", "value": "Glory Days"}}, + {"name": {"type": "string", "value": "Dancing in the Dark"}} + ] + } + ] +} diff --git a/third_party/rust/toml/tests/valid/table-array-nest.toml b/third_party/rust/toml/tests/valid/table-array-nest.toml new file mode 100644 index 000000000000..d659a3d9470c --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-nest.toml @@ -0,0 +1,17 @@ +[[albums]] +name = "Born to Run" + + [[albums.songs]] + name = "Jungleland" + + [[albums.songs]] + name = "Meeting Across the River" + +[[albums]] +name = "Born in the USA" + + [[albums.songs]] + name = "Glory Days" + + [[albums.songs]] + name = "Dancing in the Dark" diff --git a/third_party/rust/toml/tests/valid/table-array-one.json b/third_party/rust/toml/tests/valid/table-array-one.json new file mode 100644 index 000000000000..d75faaeb2390 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-one.json @@ -0,0 +1,8 @@ +{ + "people": [ + { + "first_name": {"type": "string", "value": "Bruce"}, + "last_name": {"type": "string", "value": "Springsteen"} + } + ] +} diff --git a/third_party/rust/toml/tests/valid/table-array-one.toml b/third_party/rust/toml/tests/valid/table-array-one.toml new file mode 100644 index 000000000000..cd7e1b690711 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-array-one.toml @@ -0,0 +1,3 @@ +[[people]] +first_name = "Bruce" +last_name = "Springsteen" diff --git a/third_party/rust/toml/tests/valid/table-empty.json b/third_party/rust/toml/tests/valid/table-empty.json new file mode 100644 index 000000000000..6f3873af6b2f --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-empty.json @@ -0,0 +1,3 @@ +{ + "a": {} +} diff --git a/third_party/rust/toml/tests/valid/table-empty.toml b/third_party/rust/toml/tests/valid/table-empty.toml new file mode 100644 index 000000000000..8bb6a0aa07ea --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-empty.toml @@ -0,0 +1 @@ +[a] diff --git a/third_party/rust/toml/tests/valid/table-sub-empty.json b/third_party/rust/toml/tests/valid/table-sub-empty.json new file mode 100644 index 000000000000..97877708e6d9 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-sub-empty.json @@ -0,0 +1,3 @@ +{ + "a": { "b": {} } +} diff --git a/third_party/rust/toml/tests/valid/table-sub-empty.toml b/third_party/rust/toml/tests/valid/table-sub-empty.toml new file mode 100644 index 000000000000..70b7fe11c3d1 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-sub-empty.toml @@ -0,0 +1,2 @@ +[a] +[a.b] diff --git a/third_party/rust/toml/tests/valid/table-whitespace.json b/third_party/rust/toml/tests/valid/table-whitespace.json new file mode 100644 index 000000000000..3a73ec864537 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-whitespace.json @@ -0,0 +1,3 @@ +{ + "valid key": {} +} diff --git a/third_party/rust/toml/tests/valid/table-whitespace.toml b/third_party/rust/toml/tests/valid/table-whitespace.toml new file mode 100644 index 000000000000..daf881d13a56 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-whitespace.toml @@ -0,0 +1 @@ +["valid key"] diff --git a/third_party/rust/toml/tests/valid/table-with-pound.json b/third_party/rust/toml/tests/valid/table-with-pound.json new file mode 100644 index 000000000000..5e594e419198 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-with-pound.json @@ -0,0 +1,5 @@ +{ + "key#group": { + "answer": {"type": "integer", "value": "42"} + } +} diff --git a/third_party/rust/toml/tests/valid/table-with-pound.toml b/third_party/rust/toml/tests/valid/table-with-pound.toml new file mode 100644 index 000000000000..33f2c4fd6cf0 --- /dev/null +++ b/third_party/rust/toml/tests/valid/table-with-pound.toml @@ -0,0 +1,2 @@ +["key#group"] +answer = 42 diff --git a/third_party/rust/toml/tests/valid/unicode-escape.json b/third_party/rust/toml/tests/valid/unicode-escape.json new file mode 100644 index 000000000000..8c09dc0aa934 --- /dev/null +++ b/third_party/rust/toml/tests/valid/unicode-escape.json @@ -0,0 +1,4 @@ +{ + "answer4": {"type": "string", "value": "\u03B4α"}, + "answer8": {"type": "string", "value": "\u03B4β"} +} diff --git a/third_party/rust/toml/tests/valid/unicode-escape.toml b/third_party/rust/toml/tests/valid/unicode-escape.toml new file mode 100644 index 000000000000..20198f4a9862 --- /dev/null +++ b/third_party/rust/toml/tests/valid/unicode-escape.toml @@ -0,0 +1,2 @@ +answer4 = "\u03B4α" +answer8 = "\U000003B4β" diff --git a/third_party/rust/toml/tests/valid/unicode-literal.json b/third_party/rust/toml/tests/valid/unicode-literal.json new file mode 100644 index 000000000000..00aa2f8325ec --- /dev/null +++ b/third_party/rust/toml/tests/valid/unicode-literal.json @@ -0,0 +1,3 @@ +{ + "answer": {"type": "string", "value": "δ"} +} diff --git a/third_party/rust/toml/tests/valid/unicode-literal.toml b/third_party/rust/toml/tests/valid/unicode-literal.toml new file mode 100644 index 000000000000..c65723ca1d27 --- /dev/null +++ b/third_party/rust/toml/tests/valid/unicode-literal.toml @@ -0,0 +1 @@ +answer = "δ" diff --git a/third_party/rust/unicode-xid/.cargo-checksum.json b/third_party/rust/unicode-xid/.cargo-checksum.json new file mode 100644 index 000000000000..c3a9f0a56b26 --- /dev/null +++ b/third_party/rust/unicode-xid/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"84fa18694c3dbe743dea94e2d82b8fcafe4bf2184fedac42ecef09959a4fa726",".travis.yml":"f3e106aaaa534eb9090f1213ff5d0c7f9861ede7f1c973d9e0e13b4a84cb7791","COPYRIGHT":"23860c2a7b5d96b21569afedf033469bab9fe14a1b24a35068b8641c578ce24d","Cargo.toml":"1be08526c07c40136071faf603a382456ad1a6bafbb45d9ace01c52b50a9a55c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7b63ecd5f1902af1b63729947373683c32745c16a10e8e6292e2e2dcd7e90ae0","README.md":"67998486b32f4fe46abbbaa411b92528750e7f0e22452dc8a5b95d87d80fde75","scripts/unicode.py":"762eea92dd51238c6bf877570bde1149932ba15cf87be1618fc21cd53e941733","src/lib.rs":"4a89fadf452ae7c53536eaa4496f951a3153f8189dd1cbc532648731d30f0b11","src/tables.rs":"0643459b6ebeeed83aecd7604f0ea29c06bea7ce6c1cd9acd4988d27ace1ec53","src/tests.rs":"35a459382e190197e7b9a78832ae79f310b48a02a5b4227bf9bbc89d46c8deac"},"package":"8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"} \ No newline at end of file diff --git a/third_party/rust/unicode-xid/.cargo-ok b/third_party/rust/unicode-xid/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/unicode-xid/.gitignore b/third_party/rust/unicode-xid/.gitignore new file mode 100644 index 000000000000..5cdcdba3ff80 --- /dev/null +++ b/third_party/rust/unicode-xid/.gitignore @@ -0,0 +1,3 @@ +target +Cargo.lock +scripts/tmp diff --git a/third_party/rust/unicode-xid/.travis.yml b/third_party/rust/unicode-xid/.travis.yml new file mode 100644 index 000000000000..d9c5c2aed893 --- /dev/null +++ b/third_party/rust/unicode-xid/.travis.yml @@ -0,0 +1,25 @@ +language: rust +rust: 'nightly' +sudo: false +script: + - cargo build --verbose --features bench + - cargo test --verbose --features bench + - cargo bench --verbose --features bench + - cargo clean + - cargo build --verbose + - cargo test --verbose + - rustdoc --test README.md -L target/debug -L target/debug/deps + - cargo doc +after_success: | + [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + echo '' > target/doc/index.html && + pip install ghp-import --user $USER && + $HOME/.local/bin/ghp-import -n target/doc && + git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages +env: + global: + secure: gTlge+/OQlVkV0R+RThWXeN0aknmS7iUTPBMYKJyRdLz7T2vubw3w80a2CVE87JlpV87A5cVGD+LgR+AhYrhKtvqHb1brMDd99gylBBi2DfV7YapDSwSCuFgVR+FjZfJRcXBtI8po5urUZ84V0WLzRX8SyWqWgoD3oCkSL3Wp3w= +notifications: + email: + on_success: never diff --git a/third_party/rust/unicode-xid/COPYRIGHT b/third_party/rust/unicode-xid/COPYRIGHT new file mode 100644 index 000000000000..b286ec16abbb --- /dev/null +++ b/third_party/rust/unicode-xid/COPYRIGHT @@ -0,0 +1,7 @@ +Licensed under the Apache License, Version 2.0 + or the MIT +license , +at your option. All files in the project carrying such +notice may not be copied, modified, or distributed except +according to those terms. diff --git a/third_party/rust/unicode-xid/Cargo.toml b/third_party/rust/unicode-xid/Cargo.toml new file mode 100644 index 000000000000..ac711a546b5a --- /dev/null +++ b/third_party/rust/unicode-xid/Cargo.toml @@ -0,0 +1,26 @@ +[package] + +name = "unicode-xid" +version = "0.0.4" +authors = ["erick.tryzelaar ", + "kwantam ", + ] + +homepage = "https://github.com/unicode-rs/unicode-xid" +repository = "https://github.com/unicode-rs/unicode-xid" +documentation = "https://unicode-rs.github.io/unicode-xid" +license = "MIT/Apache-2.0" +keywords = ["text", "unicode", "xid"] +readme = "README.md" +description = """ +Determine whether characters have the XID_Start +or XID_Continue properties according to +Unicode Standard Annex #31. +""" + +exclude = [ "target/*", "Cargo.lock" ] + +[features] +default = [] +no_std = [] +bench = [] diff --git a/third_party/rust/unicode-xid/LICENSE-APACHE b/third_party/rust/unicode-xid/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/unicode-xid/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/third_party/rust/unicode-xid/LICENSE-MIT b/third_party/rust/unicode-xid/LICENSE-MIT new file mode 100644 index 000000000000..e69282e381bc --- /dev/null +++ b/third_party/rust/unicode-xid/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2015 The Rust Project Developers + +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. diff --git a/third_party/rust/unicode-xid/README.md b/third_party/rust/unicode-xid/README.md new file mode 100644 index 000000000000..3a2be472d5f7 --- /dev/null +++ b/third_party/rust/unicode-xid/README.md @@ -0,0 +1,34 @@ +# unicode-xid + +Determine if a `char` is a valid identifier for a parser and/or lexer according to +[Unicode Standard Annex #31](http://www.unicode.org/reports/tr31/) rules. + +[![Build Status](https://travis-ci.org/unicode-rs/unicode-xid.svg)](https://travis-ci.org/unicode-rs/unicode-xid) + +[Documentation](https://unicode-rs.github.io/unicode-xid/unicode_xid/index.html) + +```rust +extern crate unicode_xid; + +use unicode_xid::UnicodeXID; + +fn main() { + let ch = 'a'; + println!("Is {} a valid start of an identifier? {}", ch, UnicodeXID::is_xid_start(ch)); +} +``` + +# features + +unicode-xid supports a `no_std` feature. This eliminates dependence +on std, and instead uses equivalent functions from core. + +# crates.io + +You can use this package in your project by adding the following +to your `Cargo.toml`: + +```toml +[dependencies] +unicode-xid = "0.0.4" +``` diff --git a/third_party/rust/unicode-xid/scripts/unicode.py b/third_party/rust/unicode-xid/scripts/unicode.py new file mode 100755 index 000000000000..a30d2f2a7a7b --- /dev/null +++ b/third_party/rust/unicode-xid/scripts/unicode.py @@ -0,0 +1,187 @@ +#!/usr/bin/env python +# +# Copyright 2011-2015 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# This script uses the following Unicode tables: +# - DerivedCoreProperties.txt +# - ReadMe.txt +# +# Since this should not require frequent updates, we just store this +# out-of-line and check the unicode.rs file into git. + +import fileinput, re, os, sys + +preamble = '''// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly + +#![allow(missing_docs, non_upper_case_globals, non_snake_case)] +''' + +def fetch(f): + if not os.path.exists(os.path.basename(f)): + os.system("curl -O http://www.unicode.org/Public/UNIDATA/%s" + % f) + + if not os.path.exists(os.path.basename(f)): + sys.stderr.write("cannot load %s" % f) + exit(1) + +def group_cat(cat): + cat_out = [] + letters = sorted(set(cat)) + cur_start = letters.pop(0) + cur_end = cur_start + for letter in letters: + assert letter > cur_end, \ + "cur_end: %s, letter: %s" % (hex(cur_end), hex(letter)) + if letter == cur_end + 1: + cur_end = letter + else: + cat_out.append((cur_start, cur_end)) + cur_start = cur_end = letter + cat_out.append((cur_start, cur_end)) + return cat_out + +def ungroup_cat(cat): + cat_out = [] + for (lo, hi) in cat: + while lo <= hi: + cat_out.append(lo) + lo += 1 + return cat_out + +def format_table_content(f, content, indent): + line = " "*indent + first = True + for chunk in content.split(","): + if len(line) + len(chunk) < 98: + if first: + line += chunk + else: + line += ", " + chunk + first = False + else: + f.write(line + ",\n") + line = " "*indent + chunk + f.write(line) + +def load_properties(f, interestingprops): + fetch(f) + props = {} + re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)") + re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)") + + for line in fileinput.input(os.path.basename(f)): + prop = None + d_lo = 0 + d_hi = 0 + m = re1.match(line) + if m: + d_lo = m.group(1) + d_hi = m.group(1) + prop = m.group(2) + else: + m = re2.match(line) + if m: + d_lo = m.group(1) + d_hi = m.group(2) + prop = m.group(3) + else: + continue + if interestingprops and prop not in interestingprops: + continue + d_lo = int(d_lo, 16) + d_hi = int(d_hi, 16) + if prop not in props: + props[prop] = [] + props[prop].append((d_lo, d_hi)) + + # optimize if possible + for prop in props: + props[prop] = group_cat(ungroup_cat(props[prop])) + + return props + +def escape_char(c): + return "'\\u{%x}'" % c + +def emit_bsearch_range_table(f): + f.write(""" +fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { + use core::cmp::Ordering::{Equal, Less, Greater}; + + r.binary_search_by(|&(lo,hi)| { + if lo <= c && c <= hi { Equal } + else if hi < c { Less } + else { Greater } + }).is_ok() +}\n +""") + +def emit_table(f, name, t_data, t_type = "&'static [(char, char)]", is_pub=True, + pfun=lambda x: "(%s,%s)" % (escape_char(x[0]), escape_char(x[1])), is_const=True): + pub_string = "const" + if not is_const: + pub_string = "let" + if is_pub: + pub_string = "pub " + pub_string + f.write(" %s %s: %s = &[\n" % (pub_string, name, t_type)) + data = "" + first = True + for dat in t_data: + if not first: + data += "," + first = False + data += pfun(dat) + format_table_content(f, data, 8) + f.write("\n ];\n\n") + +def emit_property_module(f, mod, tbl, emit): + f.write("pub mod %s {\n" % mod) + for cat in sorted(emit): + emit_table(f, "%s_table" % cat, tbl[cat]) + f.write(" pub fn %s(c: char) -> bool {\n" % cat) + f.write(" super::bsearch_range_table(c, %s_table)\n" % cat) + f.write(" }\n\n") + f.write("}\n\n") + +if __name__ == "__main__": + r = "tables.rs" + if os.path.exists(r): + os.remove(r) + with open(r, "w") as rf: + # write the file's preamble + rf.write(preamble) + + # download and parse all the data + fetch("ReadMe.txt") + with open("ReadMe.txt") as readme: + pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode" + unicode_version = re.search(pattern, readme.read()).groups() + rf.write(""" +/// The version of [Unicode](http://www.unicode.org/) +/// that this version of unicode-xid is based on. +pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s); +""" % unicode_version) + emit_bsearch_range_table(rf) + + want_derived = ["XID_Start", "XID_Continue"] + derived = load_properties("DerivedCoreProperties.txt", want_derived) + emit_property_module(rf, "derived_property", derived, want_derived) diff --git a/third_party/rust/unicode-xid/src/lib.rs b/third_party/rust/unicode-xid/src/lib.rs new file mode 100644 index 000000000000..09faf97267a7 --- /dev/null +++ b/third_party/rust/unicode-xid/src/lib.rs @@ -0,0 +1,87 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Determine if a `char` is a valid identifier for a parser and/or lexer according to +//! [Unicode Standard Annex #31](http://www.unicode.org/reports/tr31/) rules. +//! +//! ```rust +//! extern crate unicode_xid; +//! +//! use unicode_xid::UnicodeXID; +//! +//! fn main() { +//! let ch = 'a'; +//! println!("Is {} a valid start of an identifier? {}", ch, UnicodeXID::is_xid_start(ch)); +//! } +//! ``` +//! +//! # features +//! +//! unicode-xid supports a `no_std` feature. This eliminates dependence +//! on std, and instead uses equivalent functions from core. +//! +//! # crates.io +//! +//! You can use this package in your project by adding the following +//! to your `Cargo.toml`: +//! +//! ```toml +//! [dependencies] +//! unicode-xid = "0.0.4" +//! ``` + +#![deny(missing_docs, unsafe_code)] +#![doc(html_logo_url = "https://unicode-rs.github.io/unicode-rs_sm.png", + html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png")] + +#![no_std] +#![cfg_attr(feature = "bench", feature(test, unicode))] + +#[cfg(test)] +#[macro_use] +extern crate std; + +#[cfg(feature = "bench")] +extern crate test; + +use tables::derived_property; +pub use tables::UNICODE_VERSION; + +mod tables; + +#[cfg(test)] +mod tests; + +/// Methods for determining if a character is a valid identifier character. +pub trait UnicodeXID { + /// Returns whether the specified character satisfies the 'XID_Start' + /// Unicode property. + /// + /// 'XID_Start' is a Unicode Derived Property specified in + /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), + /// mostly similar to ID_Start but modified for closure under NFKx. + fn is_xid_start(self) -> bool; + + /// Returns whether the specified `char` satisfies the 'XID_Continue' + /// Unicode property. + /// + /// 'XID_Continue' is a Unicode Derived Property specified in + /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), + /// mostly similar to 'ID_Continue' but modified for closure under NFKx. + fn is_xid_continue(self) -> bool; +} + +impl UnicodeXID for char { + #[inline] + fn is_xid_start(self) -> bool { derived_property::XID_Start(self) } + + #[inline] + fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) } +} diff --git a/third_party/rust/unicode-xid/src/tables.rs b/third_party/rust/unicode-xid/src/tables.rs new file mode 100644 index 000000000000..3fe0d3d114b1 --- /dev/null +++ b/third_party/rust/unicode-xid/src/tables.rs @@ -0,0 +1,426 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly + +#![allow(missing_docs, non_upper_case_globals, non_snake_case)] + +/// The version of [Unicode](http://www.unicode.org/) +/// that this version of unicode-xid is based on. +pub const UNICODE_VERSION: (u64, u64, u64) = (9, 0, 0); + +fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { + use core::cmp::Ordering::{Equal, Less, Greater}; + + r.binary_search_by(|&(lo,hi)| { + if lo <= c && c <= hi { Equal } + else if hi < c { Less } + else { Greater } + }).is_ok() +} + +pub mod derived_property { + pub const XID_Continue_table: &'static [(char, char)] = &[ + ('\u{30}', '\u{39}'), ('\u{41}', '\u{5a}'), ('\u{5f}', '\u{5f}'), ('\u{61}', '\u{7a}'), + ('\u{aa}', '\u{aa}'), ('\u{b5}', '\u{b5}'), ('\u{b7}', '\u{b7}'), ('\u{ba}', '\u{ba}'), + ('\u{c0}', '\u{d6}'), ('\u{d8}', '\u{f6}'), ('\u{f8}', '\u{2c1}'), ('\u{2c6}', '\u{2d1}'), + ('\u{2e0}', '\u{2e4}'), ('\u{2ec}', '\u{2ec}'), ('\u{2ee}', '\u{2ee}'), ('\u{300}', + '\u{374}'), ('\u{376}', '\u{377}'), ('\u{37b}', '\u{37d}'), ('\u{37f}', '\u{37f}'), + ('\u{386}', '\u{38a}'), ('\u{38c}', '\u{38c}'), ('\u{38e}', '\u{3a1}'), ('\u{3a3}', + '\u{3f5}'), ('\u{3f7}', '\u{481}'), ('\u{483}', '\u{487}'), ('\u{48a}', '\u{52f}'), + ('\u{531}', '\u{556}'), ('\u{559}', '\u{559}'), ('\u{561}', '\u{587}'), ('\u{591}', + '\u{5bd}'), ('\u{5bf}', '\u{5bf}'), ('\u{5c1}', '\u{5c2}'), ('\u{5c4}', '\u{5c5}'), + ('\u{5c7}', '\u{5c7}'), ('\u{5d0}', '\u{5ea}'), ('\u{5f0}', '\u{5f2}'), ('\u{610}', + '\u{61a}'), ('\u{620}', '\u{669}'), ('\u{66e}', '\u{6d3}'), ('\u{6d5}', '\u{6dc}'), + ('\u{6df}', '\u{6e8}'), ('\u{6ea}', '\u{6fc}'), ('\u{6ff}', '\u{6ff}'), ('\u{710}', + '\u{74a}'), ('\u{74d}', '\u{7b1}'), ('\u{7c0}', '\u{7f5}'), ('\u{7fa}', '\u{7fa}'), + ('\u{800}', '\u{82d}'), ('\u{840}', '\u{85b}'), ('\u{8a0}', '\u{8b4}'), ('\u{8b6}', + '\u{8bd}'), ('\u{8d4}', '\u{8e1}'), ('\u{8e3}', '\u{963}'), ('\u{966}', '\u{96f}'), + ('\u{971}', '\u{983}'), ('\u{985}', '\u{98c}'), ('\u{98f}', '\u{990}'), ('\u{993}', + '\u{9a8}'), ('\u{9aa}', '\u{9b0}'), ('\u{9b2}', '\u{9b2}'), ('\u{9b6}', '\u{9b9}'), + ('\u{9bc}', '\u{9c4}'), ('\u{9c7}', '\u{9c8}'), ('\u{9cb}', '\u{9ce}'), ('\u{9d7}', + '\u{9d7}'), ('\u{9dc}', '\u{9dd}'), ('\u{9df}', '\u{9e3}'), ('\u{9e6}', '\u{9f1}'), + ('\u{a01}', '\u{a03}'), ('\u{a05}', '\u{a0a}'), ('\u{a0f}', '\u{a10}'), ('\u{a13}', + '\u{a28}'), ('\u{a2a}', '\u{a30}'), ('\u{a32}', '\u{a33}'), ('\u{a35}', '\u{a36}'), + ('\u{a38}', '\u{a39}'), ('\u{a3c}', '\u{a3c}'), ('\u{a3e}', '\u{a42}'), ('\u{a47}', + '\u{a48}'), ('\u{a4b}', '\u{a4d}'), ('\u{a51}', '\u{a51}'), ('\u{a59}', '\u{a5c}'), + ('\u{a5e}', '\u{a5e}'), ('\u{a66}', '\u{a75}'), ('\u{a81}', '\u{a83}'), ('\u{a85}', + '\u{a8d}'), ('\u{a8f}', '\u{a91}'), ('\u{a93}', '\u{aa8}'), ('\u{aaa}', '\u{ab0}'), + ('\u{ab2}', '\u{ab3}'), ('\u{ab5}', '\u{ab9}'), ('\u{abc}', '\u{ac5}'), ('\u{ac7}', + '\u{ac9}'), ('\u{acb}', '\u{acd}'), ('\u{ad0}', '\u{ad0}'), ('\u{ae0}', '\u{ae3}'), + ('\u{ae6}', '\u{aef}'), ('\u{af9}', '\u{af9}'), ('\u{b01}', '\u{b03}'), ('\u{b05}', + '\u{b0c}'), ('\u{b0f}', '\u{b10}'), ('\u{b13}', '\u{b28}'), ('\u{b2a}', '\u{b30}'), + ('\u{b32}', '\u{b33}'), ('\u{b35}', '\u{b39}'), ('\u{b3c}', '\u{b44}'), ('\u{b47}', + '\u{b48}'), ('\u{b4b}', '\u{b4d}'), ('\u{b56}', '\u{b57}'), ('\u{b5c}', '\u{b5d}'), + ('\u{b5f}', '\u{b63}'), ('\u{b66}', '\u{b6f}'), ('\u{b71}', '\u{b71}'), ('\u{b82}', + '\u{b83}'), ('\u{b85}', '\u{b8a}'), ('\u{b8e}', '\u{b90}'), ('\u{b92}', '\u{b95}'), + ('\u{b99}', '\u{b9a}'), ('\u{b9c}', '\u{b9c}'), ('\u{b9e}', '\u{b9f}'), ('\u{ba3}', + '\u{ba4}'), ('\u{ba8}', '\u{baa}'), ('\u{bae}', '\u{bb9}'), ('\u{bbe}', '\u{bc2}'), + ('\u{bc6}', '\u{bc8}'), ('\u{bca}', '\u{bcd}'), ('\u{bd0}', '\u{bd0}'), ('\u{bd7}', + '\u{bd7}'), ('\u{be6}', '\u{bef}'), ('\u{c00}', '\u{c03}'), ('\u{c05}', '\u{c0c}'), + ('\u{c0e}', '\u{c10}'), ('\u{c12}', '\u{c28}'), ('\u{c2a}', '\u{c39}'), ('\u{c3d}', + '\u{c44}'), ('\u{c46}', '\u{c48}'), ('\u{c4a}', '\u{c4d}'), ('\u{c55}', '\u{c56}'), + ('\u{c58}', '\u{c5a}'), ('\u{c60}', '\u{c63}'), ('\u{c66}', '\u{c6f}'), ('\u{c80}', + '\u{c83}'), ('\u{c85}', '\u{c8c}'), ('\u{c8e}', '\u{c90}'), ('\u{c92}', '\u{ca8}'), + ('\u{caa}', '\u{cb3}'), ('\u{cb5}', '\u{cb9}'), ('\u{cbc}', '\u{cc4}'), ('\u{cc6}', + '\u{cc8}'), ('\u{cca}', '\u{ccd}'), ('\u{cd5}', '\u{cd6}'), ('\u{cde}', '\u{cde}'), + ('\u{ce0}', '\u{ce3}'), ('\u{ce6}', '\u{cef}'), ('\u{cf1}', '\u{cf2}'), ('\u{d01}', + '\u{d03}'), ('\u{d05}', '\u{d0c}'), ('\u{d0e}', '\u{d10}'), ('\u{d12}', '\u{d3a}'), + ('\u{d3d}', '\u{d44}'), ('\u{d46}', '\u{d48}'), ('\u{d4a}', '\u{d4e}'), ('\u{d54}', + '\u{d57}'), ('\u{d5f}', '\u{d63}'), ('\u{d66}', '\u{d6f}'), ('\u{d7a}', '\u{d7f}'), + ('\u{d82}', '\u{d83}'), ('\u{d85}', '\u{d96}'), ('\u{d9a}', '\u{db1}'), ('\u{db3}', + '\u{dbb}'), ('\u{dbd}', '\u{dbd}'), ('\u{dc0}', '\u{dc6}'), ('\u{dca}', '\u{dca}'), + ('\u{dcf}', '\u{dd4}'), ('\u{dd6}', '\u{dd6}'), ('\u{dd8}', '\u{ddf}'), ('\u{de6}', + '\u{def}'), ('\u{df2}', '\u{df3}'), ('\u{e01}', '\u{e3a}'), ('\u{e40}', '\u{e4e}'), + ('\u{e50}', '\u{e59}'), ('\u{e81}', '\u{e82}'), ('\u{e84}', '\u{e84}'), ('\u{e87}', + '\u{e88}'), ('\u{e8a}', '\u{e8a}'), ('\u{e8d}', '\u{e8d}'), ('\u{e94}', '\u{e97}'), + ('\u{e99}', '\u{e9f}'), ('\u{ea1}', '\u{ea3}'), ('\u{ea5}', '\u{ea5}'), ('\u{ea7}', + '\u{ea7}'), ('\u{eaa}', '\u{eab}'), ('\u{ead}', '\u{eb9}'), ('\u{ebb}', '\u{ebd}'), + ('\u{ec0}', '\u{ec4}'), ('\u{ec6}', '\u{ec6}'), ('\u{ec8}', '\u{ecd}'), ('\u{ed0}', + '\u{ed9}'), ('\u{edc}', '\u{edf}'), ('\u{f00}', '\u{f00}'), ('\u{f18}', '\u{f19}'), + ('\u{f20}', '\u{f29}'), ('\u{f35}', '\u{f35}'), ('\u{f37}', '\u{f37}'), ('\u{f39}', + '\u{f39}'), ('\u{f3e}', '\u{f47}'), ('\u{f49}', '\u{f6c}'), ('\u{f71}', '\u{f84}'), + ('\u{f86}', '\u{f97}'), ('\u{f99}', '\u{fbc}'), ('\u{fc6}', '\u{fc6}'), ('\u{1000}', + '\u{1049}'), ('\u{1050}', '\u{109d}'), ('\u{10a0}', '\u{10c5}'), ('\u{10c7}', '\u{10c7}'), + ('\u{10cd}', '\u{10cd}'), ('\u{10d0}', '\u{10fa}'), ('\u{10fc}', '\u{1248}'), ('\u{124a}', + '\u{124d}'), ('\u{1250}', '\u{1256}'), ('\u{1258}', '\u{1258}'), ('\u{125a}', '\u{125d}'), + ('\u{1260}', '\u{1288}'), ('\u{128a}', '\u{128d}'), ('\u{1290}', '\u{12b0}'), ('\u{12b2}', + '\u{12b5}'), ('\u{12b8}', '\u{12be}'), ('\u{12c0}', '\u{12c0}'), ('\u{12c2}', '\u{12c5}'), + ('\u{12c8}', '\u{12d6}'), ('\u{12d8}', '\u{1310}'), ('\u{1312}', '\u{1315}'), ('\u{1318}', + '\u{135a}'), ('\u{135d}', '\u{135f}'), ('\u{1369}', '\u{1371}'), ('\u{1380}', '\u{138f}'), + ('\u{13a0}', '\u{13f5}'), ('\u{13f8}', '\u{13fd}'), ('\u{1401}', '\u{166c}'), ('\u{166f}', + '\u{167f}'), ('\u{1681}', '\u{169a}'), ('\u{16a0}', '\u{16ea}'), ('\u{16ee}', '\u{16f8}'), + ('\u{1700}', '\u{170c}'), ('\u{170e}', '\u{1714}'), ('\u{1720}', '\u{1734}'), ('\u{1740}', + '\u{1753}'), ('\u{1760}', '\u{176c}'), ('\u{176e}', '\u{1770}'), ('\u{1772}', '\u{1773}'), + ('\u{1780}', '\u{17d3}'), ('\u{17d7}', '\u{17d7}'), ('\u{17dc}', '\u{17dd}'), ('\u{17e0}', + '\u{17e9}'), ('\u{180b}', '\u{180d}'), ('\u{1810}', '\u{1819}'), ('\u{1820}', '\u{1877}'), + ('\u{1880}', '\u{18aa}'), ('\u{18b0}', '\u{18f5}'), ('\u{1900}', '\u{191e}'), ('\u{1920}', + '\u{192b}'), ('\u{1930}', '\u{193b}'), ('\u{1946}', '\u{196d}'), ('\u{1970}', '\u{1974}'), + ('\u{1980}', '\u{19ab}'), ('\u{19b0}', '\u{19c9}'), ('\u{19d0}', '\u{19da}'), ('\u{1a00}', + '\u{1a1b}'), ('\u{1a20}', '\u{1a5e}'), ('\u{1a60}', '\u{1a7c}'), ('\u{1a7f}', '\u{1a89}'), + ('\u{1a90}', '\u{1a99}'), ('\u{1aa7}', '\u{1aa7}'), ('\u{1ab0}', '\u{1abd}'), ('\u{1b00}', + '\u{1b4b}'), ('\u{1b50}', '\u{1b59}'), ('\u{1b6b}', '\u{1b73}'), ('\u{1b80}', '\u{1bf3}'), + ('\u{1c00}', '\u{1c37}'), ('\u{1c40}', '\u{1c49}'), ('\u{1c4d}', '\u{1c7d}'), ('\u{1c80}', + '\u{1c88}'), ('\u{1cd0}', '\u{1cd2}'), ('\u{1cd4}', '\u{1cf6}'), ('\u{1cf8}', '\u{1cf9}'), + ('\u{1d00}', '\u{1df5}'), ('\u{1dfb}', '\u{1f15}'), ('\u{1f18}', '\u{1f1d}'), ('\u{1f20}', + '\u{1f45}'), ('\u{1f48}', '\u{1f4d}'), ('\u{1f50}', '\u{1f57}'), ('\u{1f59}', '\u{1f59}'), + ('\u{1f5b}', '\u{1f5b}'), ('\u{1f5d}', '\u{1f5d}'), ('\u{1f5f}', '\u{1f7d}'), ('\u{1f80}', + '\u{1fb4}'), ('\u{1fb6}', '\u{1fbc}'), ('\u{1fbe}', '\u{1fbe}'), ('\u{1fc2}', '\u{1fc4}'), + ('\u{1fc6}', '\u{1fcc}'), ('\u{1fd0}', '\u{1fd3}'), ('\u{1fd6}', '\u{1fdb}'), ('\u{1fe0}', + '\u{1fec}'), ('\u{1ff2}', '\u{1ff4}'), ('\u{1ff6}', '\u{1ffc}'), ('\u{203f}', '\u{2040}'), + ('\u{2054}', '\u{2054}'), ('\u{2071}', '\u{2071}'), ('\u{207f}', '\u{207f}'), ('\u{2090}', + '\u{209c}'), ('\u{20d0}', '\u{20dc}'), ('\u{20e1}', '\u{20e1}'), ('\u{20e5}', '\u{20f0}'), + ('\u{2102}', '\u{2102}'), ('\u{2107}', '\u{2107}'), ('\u{210a}', '\u{2113}'), ('\u{2115}', + '\u{2115}'), ('\u{2118}', '\u{211d}'), ('\u{2124}', '\u{2124}'), ('\u{2126}', '\u{2126}'), + ('\u{2128}', '\u{2128}'), ('\u{212a}', '\u{2139}'), ('\u{213c}', '\u{213f}'), ('\u{2145}', + '\u{2149}'), ('\u{214e}', '\u{214e}'), ('\u{2160}', '\u{2188}'), ('\u{2c00}', '\u{2c2e}'), + ('\u{2c30}', '\u{2c5e}'), ('\u{2c60}', '\u{2ce4}'), ('\u{2ceb}', '\u{2cf3}'), ('\u{2d00}', + '\u{2d25}'), ('\u{2d27}', '\u{2d27}'), ('\u{2d2d}', '\u{2d2d}'), ('\u{2d30}', '\u{2d67}'), + ('\u{2d6f}', '\u{2d6f}'), ('\u{2d7f}', '\u{2d96}'), ('\u{2da0}', '\u{2da6}'), ('\u{2da8}', + '\u{2dae}'), ('\u{2db0}', '\u{2db6}'), ('\u{2db8}', '\u{2dbe}'), ('\u{2dc0}', '\u{2dc6}'), + ('\u{2dc8}', '\u{2dce}'), ('\u{2dd0}', '\u{2dd6}'), ('\u{2dd8}', '\u{2dde}'), ('\u{2de0}', + '\u{2dff}'), ('\u{3005}', '\u{3007}'), ('\u{3021}', '\u{302f}'), ('\u{3031}', '\u{3035}'), + ('\u{3038}', '\u{303c}'), ('\u{3041}', '\u{3096}'), ('\u{3099}', '\u{309a}'), ('\u{309d}', + '\u{309f}'), ('\u{30a1}', '\u{30fa}'), ('\u{30fc}', '\u{30ff}'), ('\u{3105}', '\u{312d}'), + ('\u{3131}', '\u{318e}'), ('\u{31a0}', '\u{31ba}'), ('\u{31f0}', '\u{31ff}'), ('\u{3400}', + '\u{4db5}'), ('\u{4e00}', '\u{9fd5}'), ('\u{a000}', '\u{a48c}'), ('\u{a4d0}', '\u{a4fd}'), + ('\u{a500}', '\u{a60c}'), ('\u{a610}', '\u{a62b}'), ('\u{a640}', '\u{a66f}'), ('\u{a674}', + '\u{a67d}'), ('\u{a67f}', '\u{a6f1}'), ('\u{a717}', '\u{a71f}'), ('\u{a722}', '\u{a788}'), + ('\u{a78b}', '\u{a7ae}'), ('\u{a7b0}', '\u{a7b7}'), ('\u{a7f7}', '\u{a827}'), ('\u{a840}', + '\u{a873}'), ('\u{a880}', '\u{a8c5}'), ('\u{a8d0}', '\u{a8d9}'), ('\u{a8e0}', '\u{a8f7}'), + ('\u{a8fb}', '\u{a8fb}'), ('\u{a8fd}', '\u{a8fd}'), ('\u{a900}', '\u{a92d}'), ('\u{a930}', + '\u{a953}'), ('\u{a960}', '\u{a97c}'), ('\u{a980}', '\u{a9c0}'), ('\u{a9cf}', '\u{a9d9}'), + ('\u{a9e0}', '\u{a9fe}'), ('\u{aa00}', '\u{aa36}'), ('\u{aa40}', '\u{aa4d}'), ('\u{aa50}', + '\u{aa59}'), ('\u{aa60}', '\u{aa76}'), ('\u{aa7a}', '\u{aac2}'), ('\u{aadb}', '\u{aadd}'), + ('\u{aae0}', '\u{aaef}'), ('\u{aaf2}', '\u{aaf6}'), ('\u{ab01}', '\u{ab06}'), ('\u{ab09}', + '\u{ab0e}'), ('\u{ab11}', '\u{ab16}'), ('\u{ab20}', '\u{ab26}'), ('\u{ab28}', '\u{ab2e}'), + ('\u{ab30}', '\u{ab5a}'), ('\u{ab5c}', '\u{ab65}'), ('\u{ab70}', '\u{abea}'), ('\u{abec}', + '\u{abed}'), ('\u{abf0}', '\u{abf9}'), ('\u{ac00}', '\u{d7a3}'), ('\u{d7b0}', '\u{d7c6}'), + ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}', '\u{fa6d}'), ('\u{fa70}', '\u{fad9}'), ('\u{fb00}', + '\u{fb06}'), ('\u{fb13}', '\u{fb17}'), ('\u{fb1d}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'), + ('\u{fb38}', '\u{fb3c}'), ('\u{fb3e}', '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}', + '\u{fb44}'), ('\u{fb46}', '\u{fbb1}'), ('\u{fbd3}', '\u{fc5d}'), ('\u{fc64}', '\u{fd3d}'), + ('\u{fd50}', '\u{fd8f}'), ('\u{fd92}', '\u{fdc7}'), ('\u{fdf0}', '\u{fdf9}'), ('\u{fe00}', + '\u{fe0f}'), ('\u{fe20}', '\u{fe2f}'), ('\u{fe33}', '\u{fe34}'), ('\u{fe4d}', '\u{fe4f}'), + ('\u{fe71}', '\u{fe71}'), ('\u{fe73}', '\u{fe73}'), ('\u{fe77}', '\u{fe77}'), ('\u{fe79}', + '\u{fe79}'), ('\u{fe7b}', '\u{fe7b}'), ('\u{fe7d}', '\u{fe7d}'), ('\u{fe7f}', '\u{fefc}'), + ('\u{ff10}', '\u{ff19}'), ('\u{ff21}', '\u{ff3a}'), ('\u{ff3f}', '\u{ff3f}'), ('\u{ff41}', + '\u{ff5a}'), ('\u{ff66}', '\u{ffbe}'), ('\u{ffc2}', '\u{ffc7}'), ('\u{ffca}', '\u{ffcf}'), + ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}', '\u{ffdc}'), ('\u{10000}', '\u{1000b}'), + ('\u{1000d}', '\u{10026}'), ('\u{10028}', '\u{1003a}'), ('\u{1003c}', '\u{1003d}'), + ('\u{1003f}', '\u{1004d}'), ('\u{10050}', '\u{1005d}'), ('\u{10080}', '\u{100fa}'), + ('\u{10140}', '\u{10174}'), ('\u{101fd}', '\u{101fd}'), ('\u{10280}', '\u{1029c}'), + ('\u{102a0}', '\u{102d0}'), ('\u{102e0}', '\u{102e0}'), ('\u{10300}', '\u{1031f}'), + ('\u{10330}', '\u{1034a}'), ('\u{10350}', '\u{1037a}'), ('\u{10380}', '\u{1039d}'), + ('\u{103a0}', '\u{103c3}'), ('\u{103c8}', '\u{103cf}'), ('\u{103d1}', '\u{103d5}'), + ('\u{10400}', '\u{1049d}'), ('\u{104a0}', '\u{104a9}'), ('\u{104b0}', '\u{104d3}'), + ('\u{104d8}', '\u{104fb}'), ('\u{10500}', '\u{10527}'), ('\u{10530}', '\u{10563}'), + ('\u{10600}', '\u{10736}'), ('\u{10740}', '\u{10755}'), ('\u{10760}', '\u{10767}'), + ('\u{10800}', '\u{10805}'), ('\u{10808}', '\u{10808}'), ('\u{1080a}', '\u{10835}'), + ('\u{10837}', '\u{10838}'), ('\u{1083c}', '\u{1083c}'), ('\u{1083f}', '\u{10855}'), + ('\u{10860}', '\u{10876}'), ('\u{10880}', '\u{1089e}'), ('\u{108e0}', '\u{108f2}'), + ('\u{108f4}', '\u{108f5}'), ('\u{10900}', '\u{10915}'), ('\u{10920}', '\u{10939}'), + ('\u{10980}', '\u{109b7}'), ('\u{109be}', '\u{109bf}'), ('\u{10a00}', '\u{10a03}'), + ('\u{10a05}', '\u{10a06}'), ('\u{10a0c}', '\u{10a13}'), ('\u{10a15}', '\u{10a17}'), + ('\u{10a19}', '\u{10a33}'), ('\u{10a38}', '\u{10a3a}'), ('\u{10a3f}', '\u{10a3f}'), + ('\u{10a60}', '\u{10a7c}'), ('\u{10a80}', '\u{10a9c}'), ('\u{10ac0}', '\u{10ac7}'), + ('\u{10ac9}', '\u{10ae6}'), ('\u{10b00}', '\u{10b35}'), ('\u{10b40}', '\u{10b55}'), + ('\u{10b60}', '\u{10b72}'), ('\u{10b80}', '\u{10b91}'), ('\u{10c00}', '\u{10c48}'), + ('\u{10c80}', '\u{10cb2}'), ('\u{10cc0}', '\u{10cf2}'), ('\u{11000}', '\u{11046}'), + ('\u{11066}', '\u{1106f}'), ('\u{1107f}', '\u{110ba}'), ('\u{110d0}', '\u{110e8}'), + ('\u{110f0}', '\u{110f9}'), ('\u{11100}', '\u{11134}'), ('\u{11136}', '\u{1113f}'), + ('\u{11150}', '\u{11173}'), ('\u{11176}', '\u{11176}'), ('\u{11180}', '\u{111c4}'), + ('\u{111ca}', '\u{111cc}'), ('\u{111d0}', '\u{111da}'), ('\u{111dc}', '\u{111dc}'), + ('\u{11200}', '\u{11211}'), ('\u{11213}', '\u{11237}'), ('\u{1123e}', '\u{1123e}'), + ('\u{11280}', '\u{11286}'), ('\u{11288}', '\u{11288}'), ('\u{1128a}', '\u{1128d}'), + ('\u{1128f}', '\u{1129d}'), ('\u{1129f}', '\u{112a8}'), ('\u{112b0}', '\u{112ea}'), + ('\u{112f0}', '\u{112f9}'), ('\u{11300}', '\u{11303}'), ('\u{11305}', '\u{1130c}'), + ('\u{1130f}', '\u{11310}'), ('\u{11313}', '\u{11328}'), ('\u{1132a}', '\u{11330}'), + ('\u{11332}', '\u{11333}'), ('\u{11335}', '\u{11339}'), ('\u{1133c}', '\u{11344}'), + ('\u{11347}', '\u{11348}'), ('\u{1134b}', '\u{1134d}'), ('\u{11350}', '\u{11350}'), + ('\u{11357}', '\u{11357}'), ('\u{1135d}', '\u{11363}'), ('\u{11366}', '\u{1136c}'), + ('\u{11370}', '\u{11374}'), ('\u{11400}', '\u{1144a}'), ('\u{11450}', '\u{11459}'), + ('\u{11480}', '\u{114c5}'), ('\u{114c7}', '\u{114c7}'), ('\u{114d0}', '\u{114d9}'), + ('\u{11580}', '\u{115b5}'), ('\u{115b8}', '\u{115c0}'), ('\u{115d8}', '\u{115dd}'), + ('\u{11600}', '\u{11640}'), ('\u{11644}', '\u{11644}'), ('\u{11650}', '\u{11659}'), + ('\u{11680}', '\u{116b7}'), ('\u{116c0}', '\u{116c9}'), ('\u{11700}', '\u{11719}'), + ('\u{1171d}', '\u{1172b}'), ('\u{11730}', '\u{11739}'), ('\u{118a0}', '\u{118e9}'), + ('\u{118ff}', '\u{118ff}'), ('\u{11ac0}', '\u{11af8}'), ('\u{11c00}', '\u{11c08}'), + ('\u{11c0a}', '\u{11c36}'), ('\u{11c38}', '\u{11c40}'), ('\u{11c50}', '\u{11c59}'), + ('\u{11c72}', '\u{11c8f}'), ('\u{11c92}', '\u{11ca7}'), ('\u{11ca9}', '\u{11cb6}'), + ('\u{12000}', '\u{12399}'), ('\u{12400}', '\u{1246e}'), ('\u{12480}', '\u{12543}'), + ('\u{13000}', '\u{1342e}'), ('\u{14400}', '\u{14646}'), ('\u{16800}', '\u{16a38}'), + ('\u{16a40}', '\u{16a5e}'), ('\u{16a60}', '\u{16a69}'), ('\u{16ad0}', '\u{16aed}'), + ('\u{16af0}', '\u{16af4}'), ('\u{16b00}', '\u{16b36}'), ('\u{16b40}', '\u{16b43}'), + ('\u{16b50}', '\u{16b59}'), ('\u{16b63}', '\u{16b77}'), ('\u{16b7d}', '\u{16b8f}'), + ('\u{16f00}', '\u{16f44}'), ('\u{16f50}', '\u{16f7e}'), ('\u{16f8f}', '\u{16f9f}'), + ('\u{16fe0}', '\u{16fe0}'), ('\u{17000}', '\u{187ec}'), ('\u{18800}', '\u{18af2}'), + ('\u{1b000}', '\u{1b001}'), ('\u{1bc00}', '\u{1bc6a}'), ('\u{1bc70}', '\u{1bc7c}'), + ('\u{1bc80}', '\u{1bc88}'), ('\u{1bc90}', '\u{1bc99}'), ('\u{1bc9d}', '\u{1bc9e}'), + ('\u{1d165}', '\u{1d169}'), ('\u{1d16d}', '\u{1d172}'), ('\u{1d17b}', '\u{1d182}'), + ('\u{1d185}', '\u{1d18b}'), ('\u{1d1aa}', '\u{1d1ad}'), ('\u{1d242}', '\u{1d244}'), + ('\u{1d400}', '\u{1d454}'), ('\u{1d456}', '\u{1d49c}'), ('\u{1d49e}', '\u{1d49f}'), + ('\u{1d4a2}', '\u{1d4a2}'), ('\u{1d4a5}', '\u{1d4a6}'), ('\u{1d4a9}', '\u{1d4ac}'), + ('\u{1d4ae}', '\u{1d4b9}'), ('\u{1d4bb}', '\u{1d4bb}'), ('\u{1d4bd}', '\u{1d4c3}'), + ('\u{1d4c5}', '\u{1d505}'), ('\u{1d507}', '\u{1d50a}'), ('\u{1d50d}', '\u{1d514}'), + ('\u{1d516}', '\u{1d51c}'), ('\u{1d51e}', '\u{1d539}'), ('\u{1d53b}', '\u{1d53e}'), + ('\u{1d540}', '\u{1d544}'), ('\u{1d546}', '\u{1d546}'), ('\u{1d54a}', '\u{1d550}'), + ('\u{1d552}', '\u{1d6a5}'), ('\u{1d6a8}', '\u{1d6c0}'), ('\u{1d6c2}', '\u{1d6da}'), + ('\u{1d6dc}', '\u{1d6fa}'), ('\u{1d6fc}', '\u{1d714}'), ('\u{1d716}', '\u{1d734}'), + ('\u{1d736}', '\u{1d74e}'), ('\u{1d750}', '\u{1d76e}'), ('\u{1d770}', '\u{1d788}'), + ('\u{1d78a}', '\u{1d7a8}'), ('\u{1d7aa}', '\u{1d7c2}'), ('\u{1d7c4}', '\u{1d7cb}'), + ('\u{1d7ce}', '\u{1d7ff}'), ('\u{1da00}', '\u{1da36}'), ('\u{1da3b}', '\u{1da6c}'), + ('\u{1da75}', '\u{1da75}'), ('\u{1da84}', '\u{1da84}'), ('\u{1da9b}', '\u{1da9f}'), + ('\u{1daa1}', '\u{1daaf}'), ('\u{1e000}', '\u{1e006}'), ('\u{1e008}', '\u{1e018}'), + ('\u{1e01b}', '\u{1e021}'), ('\u{1e023}', '\u{1e024}'), ('\u{1e026}', '\u{1e02a}'), + ('\u{1e800}', '\u{1e8c4}'), ('\u{1e8d0}', '\u{1e8d6}'), ('\u{1e900}', '\u{1e94a}'), + ('\u{1e950}', '\u{1e959}'), ('\u{1ee00}', '\u{1ee03}'), ('\u{1ee05}', '\u{1ee1f}'), + ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}', '\u{1ee24}'), ('\u{1ee27}', '\u{1ee27}'), + ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}', '\u{1ee37}'), ('\u{1ee39}', '\u{1ee39}'), + ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}', '\u{1ee42}'), ('\u{1ee47}', '\u{1ee47}'), + ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}', '\u{1ee4b}'), ('\u{1ee4d}', '\u{1ee4f}'), + ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}', '\u{1ee54}'), ('\u{1ee57}', '\u{1ee57}'), + ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}', '\u{1ee5b}'), ('\u{1ee5d}', '\u{1ee5d}'), + ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'), ('\u{1ee64}', '\u{1ee64}'), + ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'), ('\u{1ee74}', '\u{1ee77}'), + ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e}'), ('\u{1ee80}', '\u{1ee89}'), + ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}', '\u{1eea3}'), ('\u{1eea5}', '\u{1eea9}'), + ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}', '\u{2a6d6}'), ('\u{2a700}', '\u{2b734}'), + ('\u{2b740}', '\u{2b81d}'), ('\u{2b820}', '\u{2cea1}'), ('\u{2f800}', '\u{2fa1d}'), + ('\u{e0100}', '\u{e01ef}') + ]; + + pub fn XID_Continue(c: char) -> bool { + super::bsearch_range_table(c, XID_Continue_table) + } + + pub const XID_Start_table: &'static [(char, char)] = &[ + ('\u{41}', '\u{5a}'), ('\u{61}', '\u{7a}'), ('\u{aa}', '\u{aa}'), ('\u{b5}', '\u{b5}'), + ('\u{ba}', '\u{ba}'), ('\u{c0}', '\u{d6}'), ('\u{d8}', '\u{f6}'), ('\u{f8}', '\u{2c1}'), + ('\u{2c6}', '\u{2d1}'), ('\u{2e0}', '\u{2e4}'), ('\u{2ec}', '\u{2ec}'), ('\u{2ee}', + '\u{2ee}'), ('\u{370}', '\u{374}'), ('\u{376}', '\u{377}'), ('\u{37b}', '\u{37d}'), + ('\u{37f}', '\u{37f}'), ('\u{386}', '\u{386}'), ('\u{388}', '\u{38a}'), ('\u{38c}', + '\u{38c}'), ('\u{38e}', '\u{3a1}'), ('\u{3a3}', '\u{3f5}'), ('\u{3f7}', '\u{481}'), + ('\u{48a}', '\u{52f}'), ('\u{531}', '\u{556}'), ('\u{559}', '\u{559}'), ('\u{561}', + '\u{587}'), ('\u{5d0}', '\u{5ea}'), ('\u{5f0}', '\u{5f2}'), ('\u{620}', '\u{64a}'), + ('\u{66e}', '\u{66f}'), ('\u{671}', '\u{6d3}'), ('\u{6d5}', '\u{6d5}'), ('\u{6e5}', + '\u{6e6}'), ('\u{6ee}', '\u{6ef}'), ('\u{6fa}', '\u{6fc}'), ('\u{6ff}', '\u{6ff}'), + ('\u{710}', '\u{710}'), ('\u{712}', '\u{72f}'), ('\u{74d}', '\u{7a5}'), ('\u{7b1}', + '\u{7b1}'), ('\u{7ca}', '\u{7ea}'), ('\u{7f4}', '\u{7f5}'), ('\u{7fa}', '\u{7fa}'), + ('\u{800}', '\u{815}'), ('\u{81a}', '\u{81a}'), ('\u{824}', '\u{824}'), ('\u{828}', + '\u{828}'), ('\u{840}', '\u{858}'), ('\u{8a0}', '\u{8b4}'), ('\u{8b6}', '\u{8bd}'), + ('\u{904}', '\u{939}'), ('\u{93d}', '\u{93d}'), ('\u{950}', '\u{950}'), ('\u{958}', + '\u{961}'), ('\u{971}', '\u{980}'), ('\u{985}', '\u{98c}'), ('\u{98f}', '\u{990}'), + ('\u{993}', '\u{9a8}'), ('\u{9aa}', '\u{9b0}'), ('\u{9b2}', '\u{9b2}'), ('\u{9b6}', + '\u{9b9}'), ('\u{9bd}', '\u{9bd}'), ('\u{9ce}', '\u{9ce}'), ('\u{9dc}', '\u{9dd}'), + ('\u{9df}', '\u{9e1}'), ('\u{9f0}', '\u{9f1}'), ('\u{a05}', '\u{a0a}'), ('\u{a0f}', + '\u{a10}'), ('\u{a13}', '\u{a28}'), ('\u{a2a}', '\u{a30}'), ('\u{a32}', '\u{a33}'), + ('\u{a35}', '\u{a36}'), ('\u{a38}', '\u{a39}'), ('\u{a59}', '\u{a5c}'), ('\u{a5e}', + '\u{a5e}'), ('\u{a72}', '\u{a74}'), ('\u{a85}', '\u{a8d}'), ('\u{a8f}', '\u{a91}'), + ('\u{a93}', '\u{aa8}'), ('\u{aaa}', '\u{ab0}'), ('\u{ab2}', '\u{ab3}'), ('\u{ab5}', + '\u{ab9}'), ('\u{abd}', '\u{abd}'), ('\u{ad0}', '\u{ad0}'), ('\u{ae0}', '\u{ae1}'), + ('\u{af9}', '\u{af9}'), ('\u{b05}', '\u{b0c}'), ('\u{b0f}', '\u{b10}'), ('\u{b13}', + '\u{b28}'), ('\u{b2a}', '\u{b30}'), ('\u{b32}', '\u{b33}'), ('\u{b35}', '\u{b39}'), + ('\u{b3d}', '\u{b3d}'), ('\u{b5c}', '\u{b5d}'), ('\u{b5f}', '\u{b61}'), ('\u{b71}', + '\u{b71}'), ('\u{b83}', '\u{b83}'), ('\u{b85}', '\u{b8a}'), ('\u{b8e}', '\u{b90}'), + ('\u{b92}', '\u{b95}'), ('\u{b99}', '\u{b9a}'), ('\u{b9c}', '\u{b9c}'), ('\u{b9e}', + '\u{b9f}'), ('\u{ba3}', '\u{ba4}'), ('\u{ba8}', '\u{baa}'), ('\u{bae}', '\u{bb9}'), + ('\u{bd0}', '\u{bd0}'), ('\u{c05}', '\u{c0c}'), ('\u{c0e}', '\u{c10}'), ('\u{c12}', + '\u{c28}'), ('\u{c2a}', '\u{c39}'), ('\u{c3d}', '\u{c3d}'), ('\u{c58}', '\u{c5a}'), + ('\u{c60}', '\u{c61}'), ('\u{c80}', '\u{c80}'), ('\u{c85}', '\u{c8c}'), ('\u{c8e}', + '\u{c90}'), ('\u{c92}', '\u{ca8}'), ('\u{caa}', '\u{cb3}'), ('\u{cb5}', '\u{cb9}'), + ('\u{cbd}', '\u{cbd}'), ('\u{cde}', '\u{cde}'), ('\u{ce0}', '\u{ce1}'), ('\u{cf1}', + '\u{cf2}'), ('\u{d05}', '\u{d0c}'), ('\u{d0e}', '\u{d10}'), ('\u{d12}', '\u{d3a}'), + ('\u{d3d}', '\u{d3d}'), ('\u{d4e}', '\u{d4e}'), ('\u{d54}', '\u{d56}'), ('\u{d5f}', + '\u{d61}'), ('\u{d7a}', '\u{d7f}'), ('\u{d85}', '\u{d96}'), ('\u{d9a}', '\u{db1}'), + ('\u{db3}', '\u{dbb}'), ('\u{dbd}', '\u{dbd}'), ('\u{dc0}', '\u{dc6}'), ('\u{e01}', + '\u{e30}'), ('\u{e32}', '\u{e32}'), ('\u{e40}', '\u{e46}'), ('\u{e81}', '\u{e82}'), + ('\u{e84}', '\u{e84}'), ('\u{e87}', '\u{e88}'), ('\u{e8a}', '\u{e8a}'), ('\u{e8d}', + '\u{e8d}'), ('\u{e94}', '\u{e97}'), ('\u{e99}', '\u{e9f}'), ('\u{ea1}', '\u{ea3}'), + ('\u{ea5}', '\u{ea5}'), ('\u{ea7}', '\u{ea7}'), ('\u{eaa}', '\u{eab}'), ('\u{ead}', + '\u{eb0}'), ('\u{eb2}', '\u{eb2}'), ('\u{ebd}', '\u{ebd}'), ('\u{ec0}', '\u{ec4}'), + ('\u{ec6}', '\u{ec6}'), ('\u{edc}', '\u{edf}'), ('\u{f00}', '\u{f00}'), ('\u{f40}', + '\u{f47}'), ('\u{f49}', '\u{f6c}'), ('\u{f88}', '\u{f8c}'), ('\u{1000}', '\u{102a}'), + ('\u{103f}', '\u{103f}'), ('\u{1050}', '\u{1055}'), ('\u{105a}', '\u{105d}'), ('\u{1061}', + '\u{1061}'), ('\u{1065}', '\u{1066}'), ('\u{106e}', '\u{1070}'), ('\u{1075}', '\u{1081}'), + ('\u{108e}', '\u{108e}'), ('\u{10a0}', '\u{10c5}'), ('\u{10c7}', '\u{10c7}'), ('\u{10cd}', + '\u{10cd}'), ('\u{10d0}', '\u{10fa}'), ('\u{10fc}', '\u{1248}'), ('\u{124a}', '\u{124d}'), + ('\u{1250}', '\u{1256}'), ('\u{1258}', '\u{1258}'), ('\u{125a}', '\u{125d}'), ('\u{1260}', + '\u{1288}'), ('\u{128a}', '\u{128d}'), ('\u{1290}', '\u{12b0}'), ('\u{12b2}', '\u{12b5}'), + ('\u{12b8}', '\u{12be}'), ('\u{12c0}', '\u{12c0}'), ('\u{12c2}', '\u{12c5}'), ('\u{12c8}', + '\u{12d6}'), ('\u{12d8}', '\u{1310}'), ('\u{1312}', '\u{1315}'), ('\u{1318}', '\u{135a}'), + ('\u{1380}', '\u{138f}'), ('\u{13a0}', '\u{13f5}'), ('\u{13f8}', '\u{13fd}'), ('\u{1401}', + '\u{166c}'), ('\u{166f}', '\u{167f}'), ('\u{1681}', '\u{169a}'), ('\u{16a0}', '\u{16ea}'), + ('\u{16ee}', '\u{16f8}'), ('\u{1700}', '\u{170c}'), ('\u{170e}', '\u{1711}'), ('\u{1720}', + '\u{1731}'), ('\u{1740}', '\u{1751}'), ('\u{1760}', '\u{176c}'), ('\u{176e}', '\u{1770}'), + ('\u{1780}', '\u{17b3}'), ('\u{17d7}', '\u{17d7}'), ('\u{17dc}', '\u{17dc}'), ('\u{1820}', + '\u{1877}'), ('\u{1880}', '\u{18a8}'), ('\u{18aa}', '\u{18aa}'), ('\u{18b0}', '\u{18f5}'), + ('\u{1900}', '\u{191e}'), ('\u{1950}', '\u{196d}'), ('\u{1970}', '\u{1974}'), ('\u{1980}', + '\u{19ab}'), ('\u{19b0}', '\u{19c9}'), ('\u{1a00}', '\u{1a16}'), ('\u{1a20}', '\u{1a54}'), + ('\u{1aa7}', '\u{1aa7}'), ('\u{1b05}', '\u{1b33}'), ('\u{1b45}', '\u{1b4b}'), ('\u{1b83}', + '\u{1ba0}'), ('\u{1bae}', '\u{1baf}'), ('\u{1bba}', '\u{1be5}'), ('\u{1c00}', '\u{1c23}'), + ('\u{1c4d}', '\u{1c4f}'), ('\u{1c5a}', '\u{1c7d}'), ('\u{1c80}', '\u{1c88}'), ('\u{1ce9}', + '\u{1cec}'), ('\u{1cee}', '\u{1cf1}'), ('\u{1cf5}', '\u{1cf6}'), ('\u{1d00}', '\u{1dbf}'), + ('\u{1e00}', '\u{1f15}'), ('\u{1f18}', '\u{1f1d}'), ('\u{1f20}', '\u{1f45}'), ('\u{1f48}', + '\u{1f4d}'), ('\u{1f50}', '\u{1f57}'), ('\u{1f59}', '\u{1f59}'), ('\u{1f5b}', '\u{1f5b}'), + ('\u{1f5d}', '\u{1f5d}'), ('\u{1f5f}', '\u{1f7d}'), ('\u{1f80}', '\u{1fb4}'), ('\u{1fb6}', + '\u{1fbc}'), ('\u{1fbe}', '\u{1fbe}'), ('\u{1fc2}', '\u{1fc4}'), ('\u{1fc6}', '\u{1fcc}'), + ('\u{1fd0}', '\u{1fd3}'), ('\u{1fd6}', '\u{1fdb}'), ('\u{1fe0}', '\u{1fec}'), ('\u{1ff2}', + '\u{1ff4}'), ('\u{1ff6}', '\u{1ffc}'), ('\u{2071}', '\u{2071}'), ('\u{207f}', '\u{207f}'), + ('\u{2090}', '\u{209c}'), ('\u{2102}', '\u{2102}'), ('\u{2107}', '\u{2107}'), ('\u{210a}', + '\u{2113}'), ('\u{2115}', '\u{2115}'), ('\u{2118}', '\u{211d}'), ('\u{2124}', '\u{2124}'), + ('\u{2126}', '\u{2126}'), ('\u{2128}', '\u{2128}'), ('\u{212a}', '\u{2139}'), ('\u{213c}', + '\u{213f}'), ('\u{2145}', '\u{2149}'), ('\u{214e}', '\u{214e}'), ('\u{2160}', '\u{2188}'), + ('\u{2c00}', '\u{2c2e}'), ('\u{2c30}', '\u{2c5e}'), ('\u{2c60}', '\u{2ce4}'), ('\u{2ceb}', + '\u{2cee}'), ('\u{2cf2}', '\u{2cf3}'), ('\u{2d00}', '\u{2d25}'), ('\u{2d27}', '\u{2d27}'), + ('\u{2d2d}', '\u{2d2d}'), ('\u{2d30}', '\u{2d67}'), ('\u{2d6f}', '\u{2d6f}'), ('\u{2d80}', + '\u{2d96}'), ('\u{2da0}', '\u{2da6}'), ('\u{2da8}', '\u{2dae}'), ('\u{2db0}', '\u{2db6}'), + ('\u{2db8}', '\u{2dbe}'), ('\u{2dc0}', '\u{2dc6}'), ('\u{2dc8}', '\u{2dce}'), ('\u{2dd0}', + '\u{2dd6}'), ('\u{2dd8}', '\u{2dde}'), ('\u{3005}', '\u{3007}'), ('\u{3021}', '\u{3029}'), + ('\u{3031}', '\u{3035}'), ('\u{3038}', '\u{303c}'), ('\u{3041}', '\u{3096}'), ('\u{309d}', + '\u{309f}'), ('\u{30a1}', '\u{30fa}'), ('\u{30fc}', '\u{30ff}'), ('\u{3105}', '\u{312d}'), + ('\u{3131}', '\u{318e}'), ('\u{31a0}', '\u{31ba}'), ('\u{31f0}', '\u{31ff}'), ('\u{3400}', + '\u{4db5}'), ('\u{4e00}', '\u{9fd5}'), ('\u{a000}', '\u{a48c}'), ('\u{a4d0}', '\u{a4fd}'), + ('\u{a500}', '\u{a60c}'), ('\u{a610}', '\u{a61f}'), ('\u{a62a}', '\u{a62b}'), ('\u{a640}', + '\u{a66e}'), ('\u{a67f}', '\u{a69d}'), ('\u{a6a0}', '\u{a6ef}'), ('\u{a717}', '\u{a71f}'), + ('\u{a722}', '\u{a788}'), ('\u{a78b}', '\u{a7ae}'), ('\u{a7b0}', '\u{a7b7}'), ('\u{a7f7}', + '\u{a801}'), ('\u{a803}', '\u{a805}'), ('\u{a807}', '\u{a80a}'), ('\u{a80c}', '\u{a822}'), + ('\u{a840}', '\u{a873}'), ('\u{a882}', '\u{a8b3}'), ('\u{a8f2}', '\u{a8f7}'), ('\u{a8fb}', + '\u{a8fb}'), ('\u{a8fd}', '\u{a8fd}'), ('\u{a90a}', '\u{a925}'), ('\u{a930}', '\u{a946}'), + ('\u{a960}', '\u{a97c}'), ('\u{a984}', '\u{a9b2}'), ('\u{a9cf}', '\u{a9cf}'), ('\u{a9e0}', + '\u{a9e4}'), ('\u{a9e6}', '\u{a9ef}'), ('\u{a9fa}', '\u{a9fe}'), ('\u{aa00}', '\u{aa28}'), + ('\u{aa40}', '\u{aa42}'), ('\u{aa44}', '\u{aa4b}'), ('\u{aa60}', '\u{aa76}'), ('\u{aa7a}', + '\u{aa7a}'), ('\u{aa7e}', '\u{aaaf}'), ('\u{aab1}', '\u{aab1}'), ('\u{aab5}', '\u{aab6}'), + ('\u{aab9}', '\u{aabd}'), ('\u{aac0}', '\u{aac0}'), ('\u{aac2}', '\u{aac2}'), ('\u{aadb}', + '\u{aadd}'), ('\u{aae0}', '\u{aaea}'), ('\u{aaf2}', '\u{aaf4}'), ('\u{ab01}', '\u{ab06}'), + ('\u{ab09}', '\u{ab0e}'), ('\u{ab11}', '\u{ab16}'), ('\u{ab20}', '\u{ab26}'), ('\u{ab28}', + '\u{ab2e}'), ('\u{ab30}', '\u{ab5a}'), ('\u{ab5c}', '\u{ab65}'), ('\u{ab70}', '\u{abe2}'), + ('\u{ac00}', '\u{d7a3}'), ('\u{d7b0}', '\u{d7c6}'), ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}', + '\u{fa6d}'), ('\u{fa70}', '\u{fad9}'), ('\u{fb00}', '\u{fb06}'), ('\u{fb13}', '\u{fb17}'), + ('\u{fb1d}', '\u{fb1d}'), ('\u{fb1f}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'), ('\u{fb38}', + '\u{fb3c}'), ('\u{fb3e}', '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}', '\u{fb44}'), + ('\u{fb46}', '\u{fbb1}'), ('\u{fbd3}', '\u{fc5d}'), ('\u{fc64}', '\u{fd3d}'), ('\u{fd50}', + '\u{fd8f}'), ('\u{fd92}', '\u{fdc7}'), ('\u{fdf0}', '\u{fdf9}'), ('\u{fe71}', '\u{fe71}'), + ('\u{fe73}', '\u{fe73}'), ('\u{fe77}', '\u{fe77}'), ('\u{fe79}', '\u{fe79}'), ('\u{fe7b}', + '\u{fe7b}'), ('\u{fe7d}', '\u{fe7d}'), ('\u{fe7f}', '\u{fefc}'), ('\u{ff21}', '\u{ff3a}'), + ('\u{ff41}', '\u{ff5a}'), ('\u{ff66}', '\u{ff9d}'), ('\u{ffa0}', '\u{ffbe}'), ('\u{ffc2}', + '\u{ffc7}'), ('\u{ffca}', '\u{ffcf}'), ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}', '\u{ffdc}'), + ('\u{10000}', '\u{1000b}'), ('\u{1000d}', '\u{10026}'), ('\u{10028}', '\u{1003a}'), + ('\u{1003c}', '\u{1003d}'), ('\u{1003f}', '\u{1004d}'), ('\u{10050}', '\u{1005d}'), + ('\u{10080}', '\u{100fa}'), ('\u{10140}', '\u{10174}'), ('\u{10280}', '\u{1029c}'), + ('\u{102a0}', '\u{102d0}'), ('\u{10300}', '\u{1031f}'), ('\u{10330}', '\u{1034a}'), + ('\u{10350}', '\u{10375}'), ('\u{10380}', '\u{1039d}'), ('\u{103a0}', '\u{103c3}'), + ('\u{103c8}', '\u{103cf}'), ('\u{103d1}', '\u{103d5}'), ('\u{10400}', '\u{1049d}'), + ('\u{104b0}', '\u{104d3}'), ('\u{104d8}', '\u{104fb}'), ('\u{10500}', '\u{10527}'), + ('\u{10530}', '\u{10563}'), ('\u{10600}', '\u{10736}'), ('\u{10740}', '\u{10755}'), + ('\u{10760}', '\u{10767}'), ('\u{10800}', '\u{10805}'), ('\u{10808}', '\u{10808}'), + ('\u{1080a}', '\u{10835}'), ('\u{10837}', '\u{10838}'), ('\u{1083c}', '\u{1083c}'), + ('\u{1083f}', '\u{10855}'), ('\u{10860}', '\u{10876}'), ('\u{10880}', '\u{1089e}'), + ('\u{108e0}', '\u{108f2}'), ('\u{108f4}', '\u{108f5}'), ('\u{10900}', '\u{10915}'), + ('\u{10920}', '\u{10939}'), ('\u{10980}', '\u{109b7}'), ('\u{109be}', '\u{109bf}'), + ('\u{10a00}', '\u{10a00}'), ('\u{10a10}', '\u{10a13}'), ('\u{10a15}', '\u{10a17}'), + ('\u{10a19}', '\u{10a33}'), ('\u{10a60}', '\u{10a7c}'), ('\u{10a80}', '\u{10a9c}'), + ('\u{10ac0}', '\u{10ac7}'), ('\u{10ac9}', '\u{10ae4}'), ('\u{10b00}', '\u{10b35}'), + ('\u{10b40}', '\u{10b55}'), ('\u{10b60}', '\u{10b72}'), ('\u{10b80}', '\u{10b91}'), + ('\u{10c00}', '\u{10c48}'), ('\u{10c80}', '\u{10cb2}'), ('\u{10cc0}', '\u{10cf2}'), + ('\u{11003}', '\u{11037}'), ('\u{11083}', '\u{110af}'), ('\u{110d0}', '\u{110e8}'), + ('\u{11103}', '\u{11126}'), ('\u{11150}', '\u{11172}'), ('\u{11176}', '\u{11176}'), + ('\u{11183}', '\u{111b2}'), ('\u{111c1}', '\u{111c4}'), ('\u{111da}', '\u{111da}'), + ('\u{111dc}', '\u{111dc}'), ('\u{11200}', '\u{11211}'), ('\u{11213}', '\u{1122b}'), + ('\u{11280}', '\u{11286}'), ('\u{11288}', '\u{11288}'), ('\u{1128a}', '\u{1128d}'), + ('\u{1128f}', '\u{1129d}'), ('\u{1129f}', '\u{112a8}'), ('\u{112b0}', '\u{112de}'), + ('\u{11305}', '\u{1130c}'), ('\u{1130f}', '\u{11310}'), ('\u{11313}', '\u{11328}'), + ('\u{1132a}', '\u{11330}'), ('\u{11332}', '\u{11333}'), ('\u{11335}', '\u{11339}'), + ('\u{1133d}', '\u{1133d}'), ('\u{11350}', '\u{11350}'), ('\u{1135d}', '\u{11361}'), + ('\u{11400}', '\u{11434}'), ('\u{11447}', '\u{1144a}'), ('\u{11480}', '\u{114af}'), + ('\u{114c4}', '\u{114c5}'), ('\u{114c7}', '\u{114c7}'), ('\u{11580}', '\u{115ae}'), + ('\u{115d8}', '\u{115db}'), ('\u{11600}', '\u{1162f}'), ('\u{11644}', '\u{11644}'), + ('\u{11680}', '\u{116aa}'), ('\u{11700}', '\u{11719}'), ('\u{118a0}', '\u{118df}'), + ('\u{118ff}', '\u{118ff}'), ('\u{11ac0}', '\u{11af8}'), ('\u{11c00}', '\u{11c08}'), + ('\u{11c0a}', '\u{11c2e}'), ('\u{11c40}', '\u{11c40}'), ('\u{11c72}', '\u{11c8f}'), + ('\u{12000}', '\u{12399}'), ('\u{12400}', '\u{1246e}'), ('\u{12480}', '\u{12543}'), + ('\u{13000}', '\u{1342e}'), ('\u{14400}', '\u{14646}'), ('\u{16800}', '\u{16a38}'), + ('\u{16a40}', '\u{16a5e}'), ('\u{16ad0}', '\u{16aed}'), ('\u{16b00}', '\u{16b2f}'), + ('\u{16b40}', '\u{16b43}'), ('\u{16b63}', '\u{16b77}'), ('\u{16b7d}', '\u{16b8f}'), + ('\u{16f00}', '\u{16f44}'), ('\u{16f50}', '\u{16f50}'), ('\u{16f93}', '\u{16f9f}'), + ('\u{16fe0}', '\u{16fe0}'), ('\u{17000}', '\u{187ec}'), ('\u{18800}', '\u{18af2}'), + ('\u{1b000}', '\u{1b001}'), ('\u{1bc00}', '\u{1bc6a}'), ('\u{1bc70}', '\u{1bc7c}'), + ('\u{1bc80}', '\u{1bc88}'), ('\u{1bc90}', '\u{1bc99}'), ('\u{1d400}', '\u{1d454}'), + ('\u{1d456}', '\u{1d49c}'), ('\u{1d49e}', '\u{1d49f}'), ('\u{1d4a2}', '\u{1d4a2}'), + ('\u{1d4a5}', '\u{1d4a6}'), ('\u{1d4a9}', '\u{1d4ac}'), ('\u{1d4ae}', '\u{1d4b9}'), + ('\u{1d4bb}', '\u{1d4bb}'), ('\u{1d4bd}', '\u{1d4c3}'), ('\u{1d4c5}', '\u{1d505}'), + ('\u{1d507}', '\u{1d50a}'), ('\u{1d50d}', '\u{1d514}'), ('\u{1d516}', '\u{1d51c}'), + ('\u{1d51e}', '\u{1d539}'), ('\u{1d53b}', '\u{1d53e}'), ('\u{1d540}', '\u{1d544}'), + ('\u{1d546}', '\u{1d546}'), ('\u{1d54a}', '\u{1d550}'), ('\u{1d552}', '\u{1d6a5}'), + ('\u{1d6a8}', '\u{1d6c0}'), ('\u{1d6c2}', '\u{1d6da}'), ('\u{1d6dc}', '\u{1d6fa}'), + ('\u{1d6fc}', '\u{1d714}'), ('\u{1d716}', '\u{1d734}'), ('\u{1d736}', '\u{1d74e}'), + ('\u{1d750}', '\u{1d76e}'), ('\u{1d770}', '\u{1d788}'), ('\u{1d78a}', '\u{1d7a8}'), + ('\u{1d7aa}', '\u{1d7c2}'), ('\u{1d7c4}', '\u{1d7cb}'), ('\u{1e800}', '\u{1e8c4}'), + ('\u{1e900}', '\u{1e943}'), ('\u{1ee00}', '\u{1ee03}'), ('\u{1ee05}', '\u{1ee1f}'), + ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}', '\u{1ee24}'), ('\u{1ee27}', '\u{1ee27}'), + ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}', '\u{1ee37}'), ('\u{1ee39}', '\u{1ee39}'), + ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}', '\u{1ee42}'), ('\u{1ee47}', '\u{1ee47}'), + ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}', '\u{1ee4b}'), ('\u{1ee4d}', '\u{1ee4f}'), + ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}', '\u{1ee54}'), ('\u{1ee57}', '\u{1ee57}'), + ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}', '\u{1ee5b}'), ('\u{1ee5d}', '\u{1ee5d}'), + ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'), ('\u{1ee64}', '\u{1ee64}'), + ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'), ('\u{1ee74}', '\u{1ee77}'), + ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e}'), ('\u{1ee80}', '\u{1ee89}'), + ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}', '\u{1eea3}'), ('\u{1eea5}', '\u{1eea9}'), + ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}', '\u{2a6d6}'), ('\u{2a700}', '\u{2b734}'), + ('\u{2b740}', '\u{2b81d}'), ('\u{2b820}', '\u{2cea1}'), ('\u{2f800}', '\u{2fa1d}') + ]; + + pub fn XID_Start(c: char) -> bool { + super::bsearch_range_table(c, XID_Start_table) + } + +} + diff --git a/third_party/rust/unicode-xid/src/tests.rs b/third_party/rust/unicode-xid/src/tests.rs new file mode 100644 index 000000000000..f4333967f97a --- /dev/null +++ b/third_party/rust/unicode-xid/src/tests.rs @@ -0,0 +1,113 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "bench")] +use std::iter; +#[cfg(feature = "bench")] +use test::Bencher; +#[cfg(feature = "bench")] +use std::prelude::v1::*; + +use super::UnicodeXID; + +#[cfg(feature = "bench")] +#[bench] +fn cargo_is_xid_start(b: &mut Bencher) { + let string = iter::repeat('a').take(4096).collect::(); + + b.bytes = string.len() as u64; + b.iter(|| { + string.chars().all(UnicodeXID::is_xid_start) + }); +} + +#[cfg(feature = "bench")] +#[bench] +fn stdlib_is_xid_start(b: &mut Bencher) { + let string = iter::repeat('a').take(4096).collect::(); + + b.bytes = string.len() as u64; + b.iter(|| { + string.chars().all(char::is_xid_start) + }); +} + +#[cfg(feature = "bench")] +#[bench] +fn cargo_xid_continue(b: &mut Bencher) { + let string = iter::repeat('a').take(4096).collect::(); + + b.bytes = string.len() as u64; + b.iter(|| { + string.chars().all(UnicodeXID::is_xid_continue) + }); +} + +#[cfg(feature = "bench")] +#[bench] +fn stdlib_xid_continue(b: &mut Bencher) { + let string = iter::repeat('a').take(4096).collect::(); + + b.bytes = string.len() as u64; + b.iter(|| { + string.chars().all(char::is_xid_continue) + }); +} + +#[test] +fn test_is_xid_start() { + let chars = [ + 'A', 'Z', 'a', 'z', + '\u{1000d}', '\u{10026}', + ]; + + for ch in &chars { + assert!(UnicodeXID::is_xid_start(*ch), "{}", ch); + } +} + +#[test] +fn test_is_not_xid_start() { + let chars = [ + '\x00', '\x01', + '0', '9', + ' ', '[', '<', '{', '(', + '\u{02c2}', '\u{ffff}', + ]; + + for ch in &chars { + assert!(!UnicodeXID::is_xid_start(*ch), "{}", ch); + } +} + +#[test] +fn test_is_xid_continue() { + let chars = [ + '0', '9', 'A', 'Z', 'a', 'z', '_', + '\u{1000d}', '\u{10026}', + ]; + + for ch in &chars { + assert!(UnicodeXID::is_xid_continue(*ch), "{}", ch); + } +} + +#[test] +fn test_is_not_xid_continue() { + let chars = [ + '\x00', '\x01', + ' ', '[', '<', '{', '(', + '\u{02c2}', '\u{ffff}', + ]; + + for &ch in &chars { + assert!(!UnicodeXID::is_xid_continue(ch), "{}", ch); + } +} diff --git a/third_party/rust/user32-sys/.cargo-checksum.json b/third_party/rust/user32-sys/.cargo-checksum.json new file mode 100644 index 000000000000..c41a5e712c48 --- /dev/null +++ b/third_party/rust/user32-sys/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"56857d1d8a20ad92e2ba04c0a239b6c80e5de7e93a94da7fba78d84b80b0e6d4","README.md":"0f296ffa0eece6393079cb43dd94ecb064f9d6f8bcca2310ecac6c75b5b74be6","build.rs":"5880159389af1b9ab6d88e9f6206ab265dba0f4ded68b5689a0809c182d347f6","src/lib.rs":"e7f755ec0816d0142a4f25f6dc2f816aa452898709f6e5acc538529025127be9"},"package":"4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"} \ No newline at end of file diff --git a/third_party/rust/user32-sys/.cargo-ok b/third_party/rust/user32-sys/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/user32-sys/Cargo.toml b/third_party/rust/user32-sys/Cargo.toml new file mode 100644 index 000000000000..bc17a3eb48be --- /dev/null +++ b/third_party/rust/user32-sys/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "user32-sys" +version = "0.2.0" +authors = ["Peter Atashian "] +description = "Contains function definitions for the Windows API library user32. See winapi for types and constants." +documentation = "https://retep998.github.io/doc/user32/" +repository = "https://github.com/retep998/winapi-rs" +readme = "README.md" +keywords = ["windows", "ffi", "win32"] +license = "MIT" +build = "build.rs" +[lib] +name = "user32" +[dependencies] +winapi = { version = "0.2.5", path = "../.." } +[build-dependencies] +winapi-build = { version = "0.1.1", path = "../../build" } diff --git a/third_party/rust/user32-sys/README.md b/third_party/rust/user32-sys/README.md new file mode 100644 index 000000000000..4b6877aad393 --- /dev/null +++ b/third_party/rust/user32-sys/README.md @@ -0,0 +1,13 @@ +# user32 # +Contains function definitions for the Windows API library user32. See winapi for types and constants. + +```toml +[dependencies] +user32-sys = "0.1.2" +``` + +```rust +extern crate user32; +``` + +[Documentation](https://retep998.github.io/doc/user32/) diff --git a/third_party/rust/user32-sys/build.rs b/third_party/rust/user32-sys/build.rs new file mode 100644 index 000000000000..73f28c6440c1 --- /dev/null +++ b/third_party/rust/user32-sys/build.rs @@ -0,0 +1,6 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +extern crate build; +fn main() { + build::link("user32", false) +} diff --git a/third_party/rust/user32-sys/src/lib.rs b/third_party/rust/user32-sys/src/lib.rs new file mode 100644 index 000000000000..a2eb5c455c26 --- /dev/null +++ b/third_party/rust/user32-sys/src/lib.rs @@ -0,0 +1,1104 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! FFI bindings to user32. +#![cfg(windows)] +extern crate winapi; +use winapi::*; +extern "system" { + pub fn ActivateKeyboardLayout(hkl: HKL, flags: UINT) -> HKL; + pub fn AddClipboardFormatListener(hWnd: HWND) -> BOOL; + pub fn AdjustWindowRect(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL) -> BOOL; + pub fn AdjustWindowRectEx( + lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD, + ) -> BOOL; + pub fn AllowSetForegroundWindow(dwProcessId: DWORD) -> BOOL; + pub fn AnimateWindow(hWnd: HWND, dwTime: DWORD, dwFlags: DWORD) -> BOOL; + pub fn AnyPopup() -> BOOL; + pub fn AppendMenuA( + hMenu: HMENU, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCSTR, + ) -> BOOL; + pub fn AppendMenuW( + hMenu: HMENU, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCWSTR, + ) -> BOOL; + pub fn ArrangeIconicWindows(hWnd: HWND) -> UINT; + pub fn AttachThreadInput(idAttach: DWORD, idAttachTo: DWORD, fAttach: BOOL) -> BOOL; + // pub fn BeginDeferWindowPos(); + pub fn BeginPaint(hwnd: HWND, lpPaint: LPPAINTSTRUCT) -> HDC; + pub fn BlockInput(fBlockIt: BOOL) -> BOOL; + pub fn BringWindowToTop(hWnd: HWND) -> BOOL; + // pub fn BroadcastSystemMessage(); + pub fn BroadcastSystemMessageA( + flags: DWORD, lpInfo: LPDWORD, Msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LONG; + // pub fn BroadcastSystemMessageExA(); + // pub fn BroadcastSystemMessageExW(); + pub fn BroadcastSystemMessageW( + flags: DWORD, lpInfo: LPDWORD, Msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LONG; + pub fn CalculatePopupWindowPosition( + anchorPoint: *const POINT, windowSize: *const SIZE, flags: UINT, excludeRect: *mut RECT, + popupWindowPosition: *mut RECT, + ) -> BOOL; + pub fn CallMsgFilterA(lpMsg: LPMSG, nCode: c_int) -> BOOL; + pub fn CallMsgFilterW(lpMsg: LPMSG, nCode: c_int) -> BOOL; + pub fn CallNextHookEx(hhk: HHOOK, nCode: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT; + pub fn CallWindowProcA( + lpPrevWndFunc: WNDPROC, hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn CallWindowProcW( + lpPrevWndFunc: WNDPROC, hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn CancelShutdown() -> BOOL; + // pub fn CascadeChildWindows(); + pub fn CascadeWindows( + hwndParent: HWND, wHow: UINT, lpRect: *const RECT, cKids: UINT, lpKids: *const HWND, + ) -> WORD; + pub fn ChangeClipboardChain(hwndRemove: HWND, hwndNewNext: HWND) -> BOOL; + pub fn ChangeDisplaySettingsA(lpDevMode: *mut DEVMODEA, dwFlags: DWORD) -> LONG; + pub fn ChangeDisplaySettingsExA( + lpszDeviceName: LPCSTR, lpDevMode: *mut DEVMODEA, hwnd: HWND, dwFlags: DWORD, + lParam: LPVOID, + ) -> LONG; + pub fn ChangeDisplaySettingsExW( + lpszDeviceName: LPCWSTR, lpDevMode: *mut DEVMODEW, hwnd: HWND, dwFlags: DWORD, + lParam: LPVOID, + ) -> LONG; + pub fn ChangeDisplaySettingsW(lpDevMode: *mut DEVMODEW, dwFlags: DWORD) -> LONG; + pub fn ChangeMenuA( + hMenu: HMENU, cmd: UINT, lpszNewItem: LPCSTR, cmdInsert: UINT, flags: UINT, + ) -> BOOL; + pub fn ChangeMenuW( + hMenu: HMENU, cmd: UINT, lpszNewItem: LPCWSTR, cmdInsert: UINT, flags: UINT, + ) -> BOOL; + pub fn ChangeWindowMessageFilter(message: UINT, dwFlag: DWORD) -> BOOL; + pub fn ChangeWindowMessageFilterEx( + hwnd: HWND, message: UINT, action: DWORD, pChangeFilterStruct: PCHANGEFILTERSTRUCT, + ) -> BOOL; + pub fn CharLowerA(lpsz: LPSTR) -> LPSTR; + pub fn CharLowerBuffA(lpsz: LPSTR, cchLength: DWORD) -> DWORD; + pub fn CharLowerBuffW(lpsz: LPWSTR, cchLength: DWORD) -> DWORD; + pub fn CharLowerW(lpsz: LPWSTR) -> LPWSTR; + pub fn CharNextA(lpsz: LPCSTR) -> LPSTR; + pub fn CharNextExA(codePage: WORD, lpCurrentChar: LPSTR, dwFlags: DWORD) -> LPSTR; + pub fn CharNextW(lpsz: LPCWSTR) -> LPWSTR; + pub fn CharPrevA(lpszStart: LPCSTR, lpszCurrent: LPCSTR) -> LPSTR; + pub fn CharPrevExA( + codePage: WORD, lpStart: LPCSTR, lpCurrentChar: LPCSTR, dwFlags: DWORD, + ) -> LPSTR; + pub fn CharPrevW(lpszStart: LPCWSTR, lpszCurrent: LPCWSTR) -> LPWSTR; + // pub fn CharToOemA(); + // pub fn CharToOemBuffA(); + // pub fn CharToOemBuffW(); + // pub fn CharToOemW(); + pub fn CharUpperA(lpsz: LPSTR) -> LPSTR; + pub fn CharUpperBuffA(lpsz: LPSTR, cchLength: DWORD) -> DWORD; + pub fn CharUpperBuffW(lpsz: LPWSTR, cchLength: DWORD) -> DWORD; + pub fn CharUpperW(lpsz: LPWSTR) -> LPWSTR; + pub fn CheckDlgButton(hDlg: HWND, nIDButton: c_int, uCheck: UINT) -> BOOL; + pub fn CheckMenuItem(hMenu: HMENU, uIDCheckItem: UINT, uCheck: UINT) -> DWORD; + pub fn CheckMenuRadioItem( + hMenu: HMENU, first: UINT, last: UINT, check: UINT, flags: UINT, + ) -> BOOL; + pub fn CheckRadioButton( + hDlg: HWND, nIDFirstButton: c_int, nIDLasatButton: c_int, nIDCheckButton: c_int, + ) -> BOOL; + pub fn ChildWindowFromPoint(hWndParent: HWND, point: POINT) -> HWND; + pub fn ChildWindowFromPointEx(hwnd: HWND, pt: POINT, flags: UINT) -> HWND; + pub fn ClientToScreen(hWnd: HWND, lpPoint: LPPOINT) -> BOOL; + pub fn ClipCursor(lpRect: *const RECT) -> BOOL; + pub fn CloseClipboard() -> BOOL; + pub fn CloseDesktop(hDesktop: HDESK) -> BOOL; + // pub fn CloseGestureInfoHandle(); + pub fn CloseTouchInputHandle(hTouchInput: HTOUCHINPUT) -> BOOL; + pub fn CloseWindow(hWnd: HWND) -> BOOL; + pub fn CloseWindowStation(hWinSta: HWINSTA) -> BOOL; + pub fn CopyAcceleratorTableA( + hAccelSrc: HACCEL, lpAccelDst: LPACCEL, cAccelEntries: c_int, + ) -> c_int; + pub fn CopyAcceleratorTableW( + hAccelSrc: HACCEL, lpAccelDst: LPACCEL, cAccelEntries: c_int, + ) -> c_int; + pub fn CopyIcon(hIcon: HICON) -> HICON; + pub fn CopyImage(h: HANDLE, type_: UINT, cx: c_int, cy: c_int, flags: UINT) -> HANDLE; + pub fn CopyRect(lprcDst: LPRECT, lprcSrc: *const RECT) -> BOOL; + pub fn CountClipboardFormats() -> c_int; + pub fn CreateAcceleratorTableA(paccel: LPACCEL, cAccel: c_int) -> HACCEL; + pub fn CreateAcceleratorTableW(paccel: LPACCEL, cAccel: c_int) -> HACCEL; + pub fn CreateCaret(hWnd: HWND, hBitmap: HBITMAP, nWidth: c_int, nHeight: c_int) -> BOOL; + pub fn CreateCursor( + hInst: HINSTANCE, xHotSpot: c_int, yHotSpot: c_int, nWidth: c_int, nHeight: c_int, + pvAndPlane: *const VOID, pvXORPlane: *const VOID, + ) -> HCURSOR; + pub fn CreateDesktopA( + lpszDesktop: LPCSTR, lpszDevice: LPCSTR, pDevmode: *mut DEVMODEA, dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, lpsa: LPSECURITY_ATTRIBUTES, + ) -> HDESK; + // pub fn CreateDesktopExA(); + // pub fn CreateDesktopExW(); + pub fn CreateDesktopW( + lpszDesktop: LPCWSTR, lpszDevice: LPCWSTR, pDevmode: *mut DEVMODEW, dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, lpsa: LPSECURITY_ATTRIBUTES, + ) -> HDESK; + pub fn CreateDialogIndirectParamA( + hInstance: HINSTANCE, lpTemplate: LPCDLGTEMPLATEA, hWndParent: HWND, lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; + pub fn CreateDialogIndirectParamW( + hInstance: HINSTANCE, lpTemplate: LPCDLGTEMPLATEW, hWndParent: HWND, lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; + pub fn CreateDialogParamA( + hInstance: HINSTANCE, lpTemplateName: LPCSTR, hWndParent: HWND, lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; + pub fn CreateDialogParamW( + hInstance: HINSTANCE, lpTemplateName: LPCWSTR, hWndParent: HWND, lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; + pub fn CreateIcon( + hInstance: HINSTANCE, nWidth: c_int, nHeight: c_int, cPlanes: BYTE, cBitsPixel: BYTE, + lpbANDbits: *const BYTE, lpbXORbits: *const BYTE, + ) -> HICON; + pub fn CreateIconFromResource( + presbits: PBYTE, dwResSize: DWORD, fIcon: BOOL, dwVer: DWORD, + ) -> HICON; + pub fn CreateIconFromResourceEx( + presbits: PBYTE, dwResSize: DWORD, fIcon: BOOL, dwVer: DWORD, cxDesired: c_int, + cyDesired: c_int, Flags: UINT, + ) -> HICON; + pub fn CreateIconIndirect(piconinfo: PICONINFO) -> HICON; + pub fn CreateMDIWindowA( + lpClassName: LPCSTR, lpWindowName: LPCSTR, dwStyle: DWORD, X: c_int, Y: c_int, + nWidth: c_int, nHeight: c_int, hWndParent: HWND, hInstance: HINSTANCE, lParam: LPARAM, + ) -> HWND; + pub fn CreateMDIWindowW( + lpClassName: LPCWSTR, lpWindowName: LPCWSTR, dwStyle: DWORD, X: c_int, Y: c_int, + nWidth: c_int, nHeight: c_int, hWndParent: HWND, hInstance: HINSTANCE, lParam: LPARAM, + ) -> HWND; + pub fn CreateMenu() -> HMENU; + pub fn CreatePopupMenu() ->HMENU; + pub fn CreateWindowExA( + dwExStyle: DWORD, lpClassName: LPCSTR, lpWindowName: LPCSTR, dwStyle: DWORD, x: c_int, + y: c_int, nWidth: c_int, nHeight: c_int, hWndParent: HWND, hMenu: HMENU, + hInstance: HINSTANCE, lpParam: LPVOID, + ) -> HWND; + pub fn CreateWindowExW( + dwExStyle: DWORD, lpClassName: LPCWSTR, lpWindowName: LPCWSTR, dwStyle: DWORD, x: c_int, + y: c_int, nWidth: c_int, nHeight: c_int, hWndParent: HWND, hMenu: HMENU, + hInstance: HINSTANCE, lpParam: LPVOID, + ) -> HWND; + pub fn CreateWindowStationA( + lpwinsta: LPCSTR, dwFlags: DWORD, dwDesiredAccess: ACCESS_MASK, lpsa: LPSECURITY_ATTRIBUTES, + ) -> HWINSTA; + pub fn CreateWindowStationW( + lpwinsta: LPCWSTR, dwFlags: DWORD, dwDesiredAccess: ACCESS_MASK, + lpsa: LPSECURITY_ATTRIBUTES, + ) -> HWINSTA; + // pub fn DdeAbandonTransaction(); + // pub fn DdeAccessData(); + // pub fn DdeAddData(); + // pub fn DdeClientTransaction(); + // pub fn DdeCmpStringHandles(); + // pub fn DdeConnect(); + // pub fn DdeConnectList(); + // pub fn DdeCreateDataHandle(); + // pub fn DdeCreateStringHandleA(); + // pub fn DdeCreateStringHandleW(); + // pub fn DdeDisconnect(); + // pub fn DdeDisconnectList(); + // pub fn DdeEnableCallback(); + // pub fn DdeFreeDataHandle(); + // pub fn DdeFreeStringHandle(); + // pub fn DdeGetData(); + // pub fn DdeGetLastError(); + // pub fn DdeImpersonateClient(); + // pub fn DdeInitializeA(); + // pub fn DdeInitializeW(); + // pub fn DdeKeepStringHandle(); + // pub fn DdeNameService(); + // pub fn DdePostAdvise(); + // pub fn DdeQueryConvInfo(); + // pub fn DdeQueryNextServer(); + // pub fn DdeQueryStringA(); + // pub fn DdeQueryStringW(); + // pub fn DdeReconnect(); + // pub fn DdeSetQualityOfService(); + // pub fn DdeSetUserHandle(); + // pub fn DdeUnaccessData(); + // pub fn DdeUninitialize(); + pub fn DefDlgProcA( + hDlg: HWND, msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn DefDlgProcW( + hDlg: HWND, msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn DefFrameProcA( + hwnd: HWND, hwndMDIClient: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn DefFrameProcW( + hwnd: HWND, hwndMDIClient: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn DefMDIChildProcA( + hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn DefMDIChildProcW( + hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn DefRawInputProc(paRawInput: *mut PRAWINPUT, nInput: INT, cbSizeHeader: UINT) -> LRESULT; + pub fn DefWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT; + pub fn DefWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT; + pub fn DeferWindowPos( + hWinPosInfo: HDWP, hWnd: HWND, hWndInserAfter: HWND, x: c_int, y: c_int, cx: c_int, + cy: c_int, uFlags: UINT, + ) -> HDWP; + pub fn DeleteMenu(hMenu: HMENU, uPosition: UINT, uFlags: UINT) -> BOOL; + pub fn DeregisterShellHookWindow(hwnd: HWND) -> BOOL; + pub fn DestroyAcceleratorTable(hAccel: HACCEL) -> BOOL; + pub fn DestroyCaret() -> BOOL; + pub fn DestroyCursor(hCursor: HCURSOR) -> BOOL; + pub fn DestroyIcon(hIcon: HICON) -> BOOL; + pub fn DestroyMenu(hMenu: HMENU) -> BOOL; + pub fn DestroyWindow(hWnd: HWND) -> BOOL; + pub fn DialogBoxIndirectParamA( + hInstance: HINSTANCE, hDialogTemplate: LPCDLGTEMPLATEA, hWndParent: HWND, + lpDialogFunc: DLGPROC, dwInitParam: LPARAM, + ) -> INT_PTR; + pub fn DialogBoxIndirectParamW( + hInstance: HINSTANCE, hDialogTemplate: LPCDLGTEMPLATEW, hWndParent: HWND, + lpDialogFunc: DLGPROC, dwInitParam: LPARAM, + ) -> INT_PTR; + pub fn DialogBoxParamA( + hInstance: HINSTANCE, lpTemplateName: LPCSTR, hWndParent: HWND, lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> INT_PTR; + pub fn DialogBoxParamW( + hInstance: HINSTANCE, lpTemplateName: LPCWSTR, hWndParent: HWND, lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> INT_PTR; + // pub fn DisableProcessWindowsGhosting(); + pub fn DispatchMessageA(lpmsg: *const MSG) -> LRESULT; + pub fn DispatchMessageW(lpmsg: *const MSG) -> LRESULT; + // pub fn DisplayConfigGetDeviceInfo(); + // pub fn DisplayConfigSetDeviceInfo(); + pub fn DlgDirListA( + hDlg: HWND, lpPathSpec: LPSTR, nIDListBox: c_int, nIDStaticPath: c_int, uFileType: UINT + ) -> c_int; + pub fn DlgDirListComboBoxA( + hDlg: HWND, lpPathSpec: LPSTR, nIDComboBox: c_int, nIDStaticPath: c_int, uFiletype: UINT + ) -> c_int; + pub fn DlgDirListComboBoxW( + hDlg: HWND, lpPathSpec: LPWSTR, nIDComboBox: c_int, nIDStaticPath: c_int, uFiletype: UINT + ) -> c_int; + pub fn DlgDirListW( + hDlg: HWND, lpPathSpec: LPWSTR, nIDListBox: c_int, nIDStaticPath: c_int, uFileType: UINT + ) -> c_int; + pub fn DlgDirSelectComboBoxExA( + hwndDlg: HWND, lpString: LPSTR, cchOut: c_int, idComboBox: c_int + ) -> BOOL; + pub fn DlgDirSelectComboBoxExW( + hwndDlg: HWND, lpString: LPWSTR, cchOut: c_int, idComboBox: c_int + ) -> BOOL; + pub fn DlgDirSelectExA( + hwndDlg: HWND, lpString: LPSTR, chCount: c_int, idListBox: c_int + ) -> BOOL; + pub fn DlgDirSelectExW( + hwndDlg: HWND, lpString: LPWSTR, chCount: c_int, idListBox: c_int + ) -> BOOL; + pub fn DragDetect(hwnd: HWND, pt: POINT) -> BOOL; + pub fn DragObject( + hwndParent: HWND, hwndFrom: HWND, fmt: UINT, data: ULONG_PTR, hcur: HCURSOR, + ) -> DWORD; + pub fn DrawAnimatedRects( + hwnd: HWND, idAni: c_int, lprcFrom: *const RECT, lprcTo: *const RECT, + ) -> BOOL; + pub fn DrawCaption(hwnd: HWND, hdc: HDC, lprect: *const RECT, flags: UINT) -> BOOL; + pub fn DrawEdge(hdc: HDC, qrc: LPRECT, edge: UINT, grfFlags: UINT) -> BOOL; + pub fn DrawFocusRect(hDC: HDC, lprc: *const RECT) -> BOOL; + // pub fn DrawFrame(); + pub fn DrawFrameControl(hdc: HDC, lprc: LPRECT, uType: UINT, uState: UINT) -> BOOL; + pub fn DrawIcon(hDC: HDC, x: c_int, y: c_int, hIcon: HICON) -> BOOL; + pub fn DrawIconEx( + hdc: HDC, xLeft: c_int, yTop: c_int, hIcon: HICON, cxWidth: c_int, cyWidth: c_int, + istepIfAniCur: UINT, hbrFlickerFreeDraw: HBRUSH, diFlags: UINT, + ) -> BOOL; + pub fn DrawMenuBar(hwnd: HWND) -> BOOL; + pub fn DrawStateA( + hdc: HDC, hbrFore: HBRUSH, qfnCallBack: DRAWSTATEPROC, lData: LPARAM, wData: WPARAM, + x: c_int, y: c_int, cx: c_int, cy: c_int, uFlags: UINT, + ) -> BOOL; + pub fn DrawStateW( + hdc: HDC, hbrFore: HBRUSH, qfnCallBack: DRAWSTATEPROC, lData: LPARAM, wData: WPARAM, + x: c_int, y: c_int, cx: c_int, cy: c_int, uFlags: UINT, + ) -> BOOL; + pub fn DrawTextA( + hdc: HDC, lpchText: LPCSTR, cchText: c_int, lprc: LPRECT, format: UINT, + ) -> c_int; + pub fn DrawTextExA( + hdc: HDC, lpchText: LPCSTR, cchText: c_int, lprc: LPRECT, format: UINT, + lpdtp: LPDRAWTEXTPARAMS, + ) -> c_int; + pub fn DrawTextExW( + hdc: HDC, lpchText: LPCWSTR, cchText: c_int, lprc: LPRECT, format: UINT, + lpdtp: LPDRAWTEXTPARAMS, + ) -> c_int; + pub fn DrawTextW( + hdc: HDC, lpchText: LPCWSTR, cchText: c_int, lprc: LPRECT, format: UINT, + ) -> c_int; + // pub fn EditWndProc(); + pub fn EmptyClipboard() -> BOOL; + pub fn EnableMenuItem(hMenu: HMENU, uIDEnableItem: UINT, uEnable: UINT) -> BOOL; + pub fn EnableMouseInPointer(fEnable: BOOL) -> BOOL; + pub fn EnableScrollBar(hWnd: HWND, wSBflags: UINT, wArrows: UINT) -> BOOL; + // pub fn EnableSessionForMMCSS(); + pub fn EnableWindow(hWnd: HWND, bEnable: BOOL) -> BOOL; + pub fn EndDeferWindowPos(hWinPosInfo: HDWP) -> BOOL; + pub fn EndDialog(hDlg: HWND, nResult: INT_PTR) -> BOOL; + pub fn EndMenu(hMenu: HMENU, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCSTR) -> BOOL; + pub fn EndPaint(hWnd: HWND, lpPaint: *const PAINTSTRUCT) -> BOOL; + pub fn EndTask(hWnd: HWND, fShutDown: BOOL, fForce: BOOL) -> BOOL; + pub fn EnumChildWindows( + hwndParent: HWND, lpEnumFunc: WNDENUMPROC, lpParam: LPARAM, + ) -> BOOL; + pub fn EnumClipboardFormats(format: UINT) -> UINT; + pub fn EnumDesktopWindows(hDesktop: HDESK, lpfn: WNDENUMPROC, lParam: LPARAM) -> BOOL; + pub fn EnumDesktopsA( + hwinsta: HWINSTA, lpEnumFunc: DESKTOPENUMPROCA, lParam: LPARAM, + ) -> BOOL; + pub fn EnumDesktopsW( + hwinsta: HWINSTA, lpEnumFunc: DESKTOPENUMPROCW, lParam: LPARAM, + ) -> BOOL; + pub fn EnumDisplayDevicesA( + lpDevice: LPCSTR, iDevNum: DWORD, lpDisplayDevice: PDISPLAY_DEVICEA, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDisplayDevicesW( + lpDevice: LPCWSTR, iDevNum: DWORD, lpDisplayDevice: PDISPLAY_DEVICEW, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDisplayMonitors( + hdc: HDC, lprcClip: LPCRECT, lpfnEnum: MONITORENUMPROC, dwData: LPARAM, + ) -> BOOL; + pub fn EnumDisplaySettingsA( + lpszDeviceName: LPCSTR, iModeNum: DWORD, lpDevMode: *mut DEVMODEA, + ) -> BOOL; + pub fn EnumDisplaySettingsExA( + lpszDeviceName: LPCSTR, iModeNum: DWORD, lpDevMode: *mut DEVMODEA, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDisplaySettingsExW( + lpszDeviceName: LPCWSTR, iModeNum: DWORD, lpDevMode: *mut DEVMODEW, dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDisplaySettingsW( + lpszDeviceName: LPCWSTR, iModeNum: DWORD, lpDevMode: *mut DEVMODEW, + ) -> BOOL; + pub fn EnumPropsA(hWnd: HWND, lpEnumFunc: PROPENUMPROCA) -> c_int; + pub fn EnumPropsExA(hWnd: HWND, lpEnumFunc: PROPENUMPROCA, lParam: LPARAM) -> c_int; + pub fn EnumPropsExW(hWnd: HWND, lpEnumFunc: PROPENUMPROCW, lParam: LPARAM) -> c_int; + pub fn EnumPropsW(hWnd: HWND, lpEnumFunc: PROPENUMPROCW) -> c_int; + pub fn EnumThreadWindows(dwThreadId: DWORD, lpfn: WNDENUMPROC, lParam: LPARAM) -> BOOL; + pub fn EnumWindowStationsA(lpEnumFunc: WINSTAENUMPROCA, lParam: LPARAM) -> BOOL; + pub fn EnumWindowStationsW(lpEnumFunc: WINSTAENUMPROCW, lParam: LPARAM) -> BOOL; + pub fn EnumWindows(lpEnumFunc: WNDENUMPROC, lParam: LPARAM) -> BOOL; + // pub fn EqualRect(); + // pub fn EvaluateProximityToPolygon(); + // pub fn EvaluateProximityToRect(); + pub fn ExcludeUpdateRgn(hDC: HDC, hWnd: HWND) -> c_int; + pub fn ExitWindowsEx(uFlags: UINT, dwReason: DWORD) -> BOOL; + pub fn FillRect(hDC: HDC, lprc: *const RECT, hbr: HBRUSH) -> c_int; + pub fn FindWindowA (lpClassName: LPCSTR, lpWindowName: LPCSTR) -> HWND; + pub fn FindWindowExA( + hWndParent: HWND, hWndChildAfter: HWND, lpszClass: LPCSTR, lpszWindow: LPCSTR, + ) -> HWND; + pub fn FindWindowExW( + hWndParent: HWND, hWndChildAfter: HWND, lpszClass: LPCWSTR, lpszWindow: LPCWSTR, + ) -> HWND; + pub fn FindWindowW(lpClassName: LPCWSTR, lpWindowName: LPCWSTR) -> HWND; + pub fn FlashWindow(hwnd: HWND, bInvert: BOOL) -> BOOL; + pub fn FlashWindowEx(pfwi: PFLASHWINFO) -> BOOL; + pub fn FrameRect(hDC: HDC, lprc: *const RECT, hbr: HBRUSH) -> c_int; + // pub fn FreeDDElParam(); + pub fn GetActiveWindow() -> HWND; + // pub fn GetAltTabInfo(); + // pub fn GetAltTabInfoA(); + // pub fn GetAltTabInfoW(); + pub fn GetAncestor(hWnd: HWND, gaFlags: UINT) -> HWND; + pub fn GetAsyncKeyState(vKey: c_int) -> SHORT; + // pub fn GetAutoRotationState(); + // pub fn GetCIMSSM(); + pub fn GetCapture() -> HWND; + pub fn GetCaretBlinkTime() -> UINT; + pub fn GetCaretPos(lpPoint: LPPOINT) -> BOOL; + // pub fn GetClassInfoA(); + // pub fn GetClassInfoExA(); + pub fn GetClassInfoExW( + hinst: HINSTANCE, lpszClass: LPCWSTR, lpwcx: LPWNDCLASSEXW, + ) -> BOOL; + pub fn GetClassInfoW( + hInstance: HINSTANCE, lpClassName: LPCWSTR, lpWndClass: LPWNDCLASSW, + ) -> BOOL; + pub fn GetClassLongA(hWnd: HWND, nIndex: c_int) -> DWORD; + #[cfg(target_arch = "x86_64")] + pub fn GetClassLongPtrA(hWnd: HWND, nIndex: c_int) -> ULONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn GetClassLongPtrW(hWnd: HWND, nIndex: c_int) -> ULONG_PTR; + pub fn GetClassLongW(hWnd: HWND, nIndex: c_int) -> DWORD; + pub fn GetClassNameA(hWnd: HWND, lpClassName: LPCSTR, nMaxCount: c_int) -> c_int; + pub fn GetClassNameW(hWnd: HWND, lpClassName: LPCWSTR, nMaxCount: c_int) -> c_int; + pub fn GetClassWord(hWnd: HWND, nIndex: c_int) -> WORD; + pub fn GetClientRect(hWnd: HWND, lpRect: LPRECT) -> BOOL; + pub fn GetClipCursor(lpRect: LPRECT) -> BOOL; + pub fn GetClipboardData(uFormat: UINT) -> HANDLE; + pub fn GetClipboardFormatNameA( + format: UINT, lpszFormatName: LPSTR, cchMaxCount: c_int, + ) -> c_int; + pub fn GetClipboardFormatNameW( + format: UINT, lpszFormatName: LPWSTR, cchMaxCount: c_int, + ) -> c_int; + pub fn GetClipboardOwner() -> HWND; + pub fn GetClipboardSequenceNumber() -> DWORD; + pub fn GetClipboardViewer() -> HWND; + // pub fn GetComboBoxInfo(); + // pub fn GetCurrentInputMessageSource(); + pub fn GetCursor() -> HCURSOR; + // pub fn GetCursorInfo(); + pub fn GetCursorPos(lpPoint: LPPOINT) -> BOOL; + pub fn GetDC(hWnd: HWND) -> HDC; + pub fn GetDCEx(hWnd: HWND, hrgnClip: HRGN, flags: DWORD) -> HDC; + pub fn GetDesktopWindow() -> HWND; + pub fn GetDialogBaseUnits() -> LONG; + // pub fn GetDisplayAutoRotationPreferences(); + // pub fn GetDisplayConfigBufferSizes(); + pub fn GetDlgCtrlID(hwnd: HWND) -> c_int; + pub fn GetDlgItem(hDlg: HWND, nIDDlgItem: c_int) -> HWND; + pub fn GetDlgItemInt( + hDlg: HWND, nIDDlgItem: c_int, lpTranslated: *mut BOOL, bSigned: BOOL, + ) -> UINT; + pub fn GetDlgItemTextA( + hDlg: HWND, nIDDlgItem: c_int, lpString: LPSTR, nMaxCount: c_int, + ) -> UINT; + pub fn GetDlgItemTextW( + hDlg: HWND, nIDDlgItem: c_int, lpString: LPWSTR, nMaxCount: c_int, + ) -> UINT; + pub fn GetDoubleClickTime() -> UINT; + pub fn GetFocus() -> HWND; + pub fn GetForegroundWindow() -> HWND; + // pub fn GetGUIThreadInfo(); + // pub fn GetGestureConfig(); + // pub fn GetGestureExtraArgs(); + // pub fn GetGestureInfo(); + // pub fn GetGuiResources(); + pub fn GetIconInfo(hIcon: HICON, piconinfo: PICONINFO) -> BOOL; + // pub fn GetIconInfoExA(); + // pub fn GetIconInfoExW(); + // pub fn GetInputDesktop(); + // pub fn GetInputLocaleInfo(); + // pub fn GetInputState(); + pub fn GetKBCodePage() -> UINT; + pub fn GetKeyNameTextA(lparam: LONG, lpString: LPSTR, cchSize: c_int) -> c_int; + pub fn GetKeyNameTextW(lParam: LONG, lpString: LPWSTR, cchSize: c_int) -> c_int; + pub fn GetKeyState(nVirtKey: c_int) -> SHORT; + pub fn GetKeyboardLayout(idThread: DWORD) -> HKL; + pub fn GetKeyboardLayoutList(nBuff: c_int, lpList: *mut HKL) -> c_int; + pub fn GetKeyboardLayoutNameA(pwszKLID: LPSTR) -> BOOL; + pub fn GetKeyboardLayoutNameW(pwszKLID: LPWSTR) -> BOOL; + pub fn GetKeyboardState(lpKeyState: PBYTE) -> BOOL; + pub fn GetKeyboardType(nTypeFlag: c_int) -> c_int; + pub fn GetLastActivePopup(hWnd: HWND) -> HWND; + // pub fn GetLastInputInfo(); + // pub fn GetLayeredWindowAttributes(); + // pub fn GetListBoxInfo(); + pub fn GetMenu(hWnd: HWND) -> HMENU; + // pub fn GetMenuBarInfo(); + // pub fn GetMenuCheckMarkDimensions(); + // pub fn GetMenuContextHelpId(); + // pub fn GetMenuDefaultItem(); + // pub fn GetMenuInfo(); + // pub fn GetMenuItemCount(); + // pub fn GetMenuItemID(); + // pub fn GetMenuItemInfoA(); + // pub fn GetMenuItemInfoW(); + // pub fn GetMenuItemRect(); + // pub fn GetMenuState(); + // pub fn GetMenuStringA(); + // pub fn GetMenuStringW(); + // pub fn GetMessageA(); + // pub fn GetMessageExtraInfo(); + // pub fn GetMessagePos(); + pub fn GetMessageTime() -> LONG; + pub fn GetMessageW(lpMsg: LPMSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) -> BOOL; + pub fn GetMonitorInfoA(hMonitor: HMONITOR, lpmi: LPMONITORINFO) -> BOOL; + pub fn GetMonitorInfoW(hMonitor: HMONITOR, lpmi: LPMONITORINFO) -> BOOL; + // pub fn GetMouseMovePointsEx(); + pub fn GetNextDlgGroupItem(hDlg: HWND, hCtl: HWND, bPrevious: BOOL) -> HWND; + pub fn GetNextDlgTabItem(hDlg: HWND, hCtl: HWND, bPrevious: BOOL) -> HWND; + pub fn GetOpenClipboardWindow() -> HWND; + pub fn GetParent(hWnd: HWND) -> HWND; + pub fn GetPhysicalCursorPos(lpPoint: LPPOINT) -> BOOL; + // pub fn GetPointerCursorId(); + // pub fn GetPointerDevice(); + // pub fn GetPointerDeviceCursors(); + // pub fn GetPointerDeviceProperties(); + // pub fn GetPointerDeviceRects(); + // pub fn GetPointerDevices(); + // pub fn GetPointerFrameInfo(); + // pub fn GetPointerFrameInfoHistory(); + // pub fn GetPointerFramePenInfo(); + // pub fn GetPointerFramePenInfoHistory(); + // pub fn GetPointerFrameTouchInfo(); + // pub fn GetPointerFrameTouchInfoHistory(); + // pub fn GetPointerInfo(); + // pub fn GetPointerInfoHistory(); + // pub fn GetPointerInputTransform(); + // pub fn GetPointerPenInfo(); + // pub fn GetPointerPenInfoHistory(); + // pub fn GetPointerTouchInfo(); + // pub fn GetPointerTouchInfoHistory(); + pub fn GetPointerType(pointerId: UINT32, pointerType: *mut POINTER_INPUT_TYPE) -> BOOL; + // pub fn GetPriorityClipboardFormat(); + // pub fn GetProcessDefaultLayout(); + // pub fn GetProcessWindowStation(); + pub fn GetPropA(hwnd: HWND, lpString: LPCSTR) -> HANDLE; + pub fn GetPropW(hwnd: HWND, lpString: LPCWSTR) -> HANDLE; + pub fn GetQueueStatus(flags: UINT) -> DWORD; + pub fn GetRawInputBuffer(pData: PRAWINPUT, pcbSize: PUINT, cbSizeHeader: UINT) -> UINT; + pub fn GetRawInputData( + hRawInput: HRAWINPUT, uiCommand: UINT, pData: LPVOID, pcbSize: PUINT, cbSizeHeader: UINT, + ) -> UINT; + pub fn GetRawInputDeviceInfoA( + hDevice: HANDLE, uiCommand: UINT, pData: LPVOID, pcbSize: PUINT, + ) -> UINT; + pub fn GetRawInputDeviceInfoW( + hDevice: HANDLE, uiCommand: UINT, pData: LPVOID, pcbSize: PUINT, + ) -> UINT; + pub fn GetRawInputDeviceList( + pRawInputDeviceList: PRAWINPUTDEVICELIST, puiNumDevices: PUINT, cbSize: UINT, + ) -> UINT; + // pub fn GetRawPointerDeviceData(); + pub fn GetRegisteredRawInputDevices( + pRawInputDevices: PRAWINPUTDEVICE, puiNumDevices: PUINT, cbSize: UINT, + ) -> UINT; + // pub fn GetScrollBarInfo(); + pub fn GetScrollInfo(hwnd: HWND, nBar: c_int, lpsi: *mut SCROLLINFO) -> BOOL; + pub fn GetScrollPos(hWnd: HWND, nBar: c_int) -> c_int; + pub fn GetScrollRange(hWnd: HWND, nBar: c_int, lpMinPos: LPINT, lpMaxPos: LPINT) -> BOOL; + pub fn GetShellWindow() -> HWND; + // pub fn GetSubMenu(); + pub fn GetSysColor(nIndex: c_int) -> DWORD; + pub fn GetSysColorBrush(nIndex: c_int) -> HBRUSH; + pub fn GetSystemMenu(hWnd: HWND, bRevert: BOOL) -> HMENU; + pub fn GetSystemMetrics(nIndex: c_int) -> c_int; + pub fn GetTabbedTextExtentA(hdc: HDC, lpString: LPCSTR, chCount: c_int, nTabPositions: c_int, + lpnTabStopPositions: *const INT + ) -> DWORD; + pub fn GetTabbedTextExtentW(hdc: HDC, lpString: LPCWSTR, chCount: c_int, nTabPositions: c_int, + lpnTabStopPositions: *const INT + ) -> DWORD; + pub fn GetThreadDesktop(dwThreadId: DWORD) -> HDESK; + // pub fn GetTitleBarInfo(); + pub fn GetTopWindow(hWnd: HWND) -> HWND; + pub fn GetTouchInputInfo( + hTouchInput: HTOUCHINPUT, cInputs: c_uint, pInputs: PTOUCHINPUT, cbSize: c_int + ) -> BOOL; + // pub fn GetUnpredictedMessagePos(); + pub fn GetUpdateRect(hWnd: HWND, lpRect: LPRECT, bErase: BOOL) -> BOOL; + pub fn GetUpdateRgn(hWnd: HWND, hRgn: HRGN, bErase: BOOL) -> c_int; + pub fn GetUpdatedClipboardFormats( + lpuiFormats: PUINT, cFormats: UINT, pcFormatsOUT: PUINT, + ) -> BOOL; + // pub fn GetUserObjectInformationA(); + // pub fn GetUserObjectInformationW(); + // pub fn GetUserObjectSecurity(); + pub fn GetWindow(hWnd: HWND, uCmd: UINT) -> HWND; + pub fn GetWindowContextHelpId(h: HWND) -> DWORD; + pub fn GetWindowDC(hWnd: HWND) -> HDC; + // pub fn GetWindowDisplayAffinity(); + // pub fn GetWindowFeedbackSetting(); + // pub fn GetWindowInfo(); + pub fn GetWindowLongA(hWnd: HWND, nIndex: c_int) -> LONG; + #[cfg(target_arch = "x86_64")] + pub fn GetWindowLongPtrA(hWnd: HWND, nIndex: c_int) -> LONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn GetWindowLongPtrW(hWnd: HWND, nIndex: c_int) -> LONG_PTR; + pub fn GetWindowLongW(hWnd: HWND, nIndex: c_int) -> LONG; + // pub fn GetWindowModuleFileName(); + pub fn GetWindowModuleFileNameA( + hWnd: HWND, lpszFileName: LPCSTR, cchFileNameMax: UINT, + ) -> UINT; + pub fn GetWindowModuleFileNameW( + hWnd: HWND, lpszFileName: LPWSTR, cchFileNameMax: UINT, + ) -> UINT; + pub fn GetWindowPlacement(hWnd: HWND, lpwndpl: *mut WINDOWPLACEMENT) -> BOOL; + pub fn GetWindowRect(hWnd: HWND, lpRect: LPRECT) -> BOOL; + pub fn GetWindowRgn(hWnd: HWND, hRgn: HRGN) -> c_int; + pub fn GetWindowRgnBox(hWnd: HWND, lprc: LPRECT) -> c_int; + pub fn GetWindowTextA(hWnd: HWND, lpString: LPSTR, nMaxCount: c_int) -> c_int; + pub fn GetWindowTextLengthA(hWnd: HWND) -> c_int; + pub fn GetWindowTextLengthW(hWnd: HWND) -> c_int; + pub fn GetWindowTextW(hWnd: HWND, lpString: LPWSTR, nMaxCount: c_int) -> c_int; + pub fn GetWindowThreadProcessId(hWnd: HWND, lpdwProcessId: LPDWORD) -> DWORD; + pub fn GetWindowWord(hWnd: HWND,nIndex: c_int) -> WORD; + pub fn GrayStringA( + hDC: HDC, hBrush: HBRUSH, lpOutputFunc: GRAYSTRINGPROC, lpData: LPARAM, nCount: c_int, + X: c_int, Y: c_int, nWidth: c_int, nHeight: c_int, + ) -> BOOL; + pub fn GrayStringW( + hDC: HDC, hBrush: HBRUSH, lpOutputFunc: GRAYSTRINGPROC, lpData: LPARAM, nCount: c_int, + X: c_int, Y: c_int, nWidth: c_int, nHeight: c_int, + ) -> BOOL; + pub fn HideCaret(hWnd: HWND) -> BOOL; + pub fn HiliteMenuItem(hWnd: HWND, hMenu: HMENU, uIDHiliteItem: UINT, uHilite: UINT) -> BOOL; + // pub fn IMPGetIMEA(); + // pub fn IMPGetIMEW(); + // pub fn IMPQueryIMEA(); + // pub fn IMPQueryIMEW(); + // pub fn IMPSetIMEA(); + // pub fn IMPSetIMEW(); + // pub fn ImpersonateDdeClientWindow(); + // pub fn InSendMessage(); + // pub fn InSendMessageEx(); + pub fn InflateRect(lprc: LPRECT, dx: c_int, dy: c_int) -> BOOL; + // pub fn InitializeTouchInjection(); + // pub fn InjectTouchInput(); + pub fn InsertMenuA( + hMenu: HMENU, uPosition: UINT, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCSTR, + ) -> BOOL; + pub fn InsertMenuItemA( + hmenu: HMENU, item: UINT, fByPosition: BOOL, lpmi: LPCMENUITEMINFOA, + ) -> BOOL; + pub fn InsertMenuItemW( + hmenu: HMENU, item: UINT, fByPosition: BOOL, lpmi: LPCMENUITEMINFOW, + ) -> BOOL; + pub fn InsertMenuW( + hMenu: HMENU, uPosition: UINT, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCWSTR, + ) -> BOOL; + pub fn InternalGetWindowText(hWnd: HWND, pString: LPWSTR, cchMaxCount: c_int) -> c_int; + pub fn IntersectRect( + lprcDst: LPRECT, lprcSrc1: *const RECT, lprcSrc2: *const RECT, + ) -> BOOL; + pub fn InvalidateRect(hWnd: HWND, lpRect: *const RECT, bErase: BOOL) -> BOOL; + pub fn InvalidateRgn(hWnd: HWND, hRgn: HRGN, bErase: BOOL) -> BOOL; + pub fn InvertRect(hDC: HDC, lprc: *const RECT) -> BOOL; + pub fn IsCharAlphaA(ch: CHAR) -> BOOL; + pub fn IsCharAlphaNumericA(ch: CHAR) -> BOOL; + pub fn IsCharAlphaNumericW(ch: WCHAR) -> BOOL; + pub fn IsCharAlphaW(ch: WCHAR) -> BOOL; + pub fn IsCharLowerA(ch: CHAR) -> BOOL; + pub fn IsCharLowerW(ch: WCHAR) -> BOOL; + pub fn IsCharUpperA(ch: CHAR) -> BOOL; + pub fn IsCharUpperW(ch: WCHAR) -> BOOL; + pub fn IsChild(hWndParent: HWND, hWnd: HWND) -> BOOL; + pub fn IsClipboardFormatAvailable(format: UINT) -> BOOL; + pub fn IsDialogMessageA(hDlg: HWND, lpMsg: LPMSG) -> BOOL; + pub fn IsDialogMessageW(hDlg: HWND, lpMsg: LPMSG) -> BOOL; + pub fn IsDlgButtonChecked(hDlg: HWND, nIDButton: c_int) -> UINT; + pub fn IsGUIThread(bConvert: BOOL) -> BOOL; + pub fn IsHungAppWindow(hwnd: HWND) -> BOOL; + pub fn IsIconic(hWnd: HWND) -> BOOL; + pub fn IsImmersiveProcess(hProcess: HANDLE) -> BOOL; + // pub fn IsInDesktopWindowBand(); + pub fn IsMenu(hMenu: HMENU) -> BOOL; + pub fn IsMouseInPointerEnabled() -> BOOL; + pub fn IsProcessDPIAware() -> BOOL; + pub fn IsRectEmpty(lprc: *const RECT) -> BOOL; + pub fn IsTouchWindow(hwnd: HWND, pulFlags: PULONG) -> BOOL; + pub fn IsWinEventHookInstalled(event: DWORD) -> BOOL; + pub fn IsWindow(hWnd: HWND) -> BOOL; + pub fn IsWindowEnabled(hWnd: HWND) -> BOOL; + pub fn IsWindowUnicode(hWnd: HWND) -> BOOL; + pub fn IsWindowVisible(hWnd: HWND) -> BOOL; + pub fn IsWow64Message() -> BOOL; + pub fn IsZoomed(hwnd: HWND) -> BOOL; + pub fn KillTimer(hwnd: HWND, uIDEvent: UINT_PTR) -> BOOL; + pub fn LoadAcceleratorsA(hInstance: HINSTANCE, lpTableName: LPCSTR) -> HACCEL; + pub fn LoadAcceleratorsW(hInstance: HINSTANCE, lpTableName: LPCWSTR) -> HACCEL; + pub fn LoadBitmapA(hInstance: HINSTANCE, lpBitmapName: LPCSTR) -> HBITMAP; + pub fn LoadBitmapW(hInstance: HINSTANCE, lpBitmapName: LPCWSTR) -> HBITMAP; + pub fn LoadCursorA(hInstance: HINSTANCE, lpCursorName: LPCSTR) -> HCURSOR; + pub fn LoadCursorFromFileA(lpFileName: LPCSTR) -> HCURSOR; + pub fn LoadCursorFromFileW(lpFileName: LPCWSTR) -> HCURSOR; + pub fn LoadCursorW(hInstance: HINSTANCE, lpCursorName: LPCWSTR) -> HCURSOR; + pub fn LoadIconA(hInstance: HINSTANCE, lpIconName: LPCSTR) -> HICON; + pub fn LoadIconW(hInstance: HINSTANCE, lpIconName: LPCWSTR) -> HICON; + pub fn LoadImageA( + hInst: HINSTANCE, name: LPCSTR, type_: UINT, cx: c_int, cy: c_int, fuLoad: UINT, + ) -> HANDLE; + pub fn LoadImageW( + hInst: HINSTANCE, name: LPCWSTR, type_: UINT, cx: c_int, cy: c_int, fuLoad: UINT, + ) -> HANDLE; + pub fn LoadKeyboardLayoutA(pwszKLID: LPCSTR, Flags: DWORD) -> HKL; + pub fn LoadKeyboardLayoutW(pwszKLID: LPCWSTR, Flags: DWORD) -> HKL; + pub fn LoadMenuA(hInstance: HINSTANCE, lpMenuName: LPCSTR) -> HMENU; + pub fn LoadMenuIndirectA(lpMenuTemplate: *const MENUTEMPLATEA) -> HMENU; + pub fn LoadMenuIndirectW(lpMenuTemplate: *const MENUTEMPLATEW) -> HMENU; + pub fn LoadMenuW(hInstance: HINSTANCE, lpMenuName: LPCWSTR) -> HMENU; + pub fn LoadStringA( + hInstance: HINSTANCE, uID: UINT, lpBuffer: LPSTR, cchBufferMax: c_int, + ) -> c_int; + pub fn LoadStringW( + hInstance: HINSTANCE, uID: UINT, lpBuffer: LPWSTR, cchBufferMax: c_int, + ) -> c_int; + pub fn LockSetForegroundWindow(uLockCode: UINT) -> BOOL; + pub fn LockWindowUpdate(hWndLock: HWND) -> BOOL; + pub fn LockWorkStation() -> BOOL; + // pub fn LogicalToPhysicalPoint(); + // pub fn LogicalToPhysicalPointForPerMonitorDPI(); + pub fn LookupIconIdFromDirectory(presbits: PBYTE, fIcon: BOOL) -> c_int; + pub fn LookupIconIdFromDirectoryEx( + presbits: PBYTE, fIcon: BOOL, cxDesired: c_int, cyDesired: c_int, Flags: UINT, + ) -> c_int; + pub fn MapDialogRect(hDlg: HWND, lpRect: LPRECT) -> BOOL; + pub fn MapVirtualKeyA(nCode: UINT, uMapType: UINT) -> UINT; + pub fn MapVirtualKeyExA(nCode: UINT, uMapType: UINT, dwhkl: HKL) -> UINT; + pub fn MapVirtualKeyExW(nCode: UINT, uMapType: UINT, dwhkl: HKL) -> UINT; + pub fn MapVirtualKeyW(nCode: UINT, uMapType: UINT) -> UINT; + pub fn MapWindowPoints(hWndFrom: HWND, hWndTo: HWND, lpPoints: LPPOINT, cPoints: UINT) -> c_int; + pub fn MenuItemFromPoint(hWnd: HWND, hMenu: HMENU, ptScreen: POINT) -> c_int; + pub fn MessageBeep(uType: UINT) -> BOOL; + pub fn MessageBoxA(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT) -> c_int; + pub fn MessageBoxExA( + hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT, wLanguageId: WORD, + ) -> c_int; + pub fn MessageBoxExW( + hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT, wLanguageId: WORD, + ) -> c_int; + pub fn MessageBoxIndirectA(lpmbp: *const MSGBOXPARAMSA) -> c_int; + pub fn MessageBoxIndirectW(lpmbp: *const MSGBOXPARAMSW) -> c_int; + // pub fn MessageBoxTimeoutA(); + // pub fn MessageBoxTimeoutW(); + pub fn MessageBoxW(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT) -> c_int; + pub fn ModifyMenuA( + hMnu: HMENU, uPosition: UINT, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCSTR, + ) -> BOOL; + pub fn ModifyMenuW( + hMnu: HMENU, uPosition: UINT, uFlags: UINT, uIDNewItem: UINT_PTR, lpNewItem: LPCWSTR, + ) -> BOOL; + pub fn MonitorFromPoint(pt: POINT, dwFlags: DWORD) -> HMONITOR; + pub fn MonitorFromRect(lprc: LPCRECT, dwFlags: DWORD) -> HMONITOR; + pub fn MonitorFromWindow(hwnd: HWND, dwFlags: DWORD) -> HMONITOR; + pub fn MoveWindow( + hWnd: HWND, X: c_int, Y: c_int, nWidth: c_int, nHeight: c_int, bRepaint: BOOL, + ) -> BOOL; + // Use UINT instead of DWORD for dwWaitMask to be consistent with GetQueueStatus + pub fn MsgWaitForMultipleObjects( + nCount: DWORD, pHandles: *const HANDLE, fWaitAll: BOOL, dwMilliseconds: DWORD, + dwWakeMask: UINT, + ) -> DWORD; + pub fn MsgWaitForMultipleObjectsEx( + nCount: DWORD, pHandles: *const HANDLE, dwMilliseconds: DWORD, dwWakeMask: UINT, + dwFlags: DWORD, + ) -> DWORD; + pub fn NotifyWinEvent(event: DWORD, hwnd: HWND, idObject: LONG, idChild: LONG); + pub fn OemKeyScan(wOemChar: WORD) -> DWORD; + pub fn OemToCharA(pSrc: LPCSTR, pDst: LPSTR) -> BOOL; + pub fn OemToCharBuffA(lpszSrc: LPCSTR, lpszDst: LPSTR, cchDstLength: DWORD) -> BOOL; + pub fn OemToCharBuffW(lpszSrc: LPCSTR, lpszDst: LPWSTR, cchDstLength: DWORD) -> BOOL; + pub fn OemToCharW(pSrc: LPCSTR, pDst: LPWSTR) -> BOOL; + pub fn OffsetRect(lprc: LPRECT, dx: c_int, dy: c_int) -> BOOL; + pub fn OpenClipboard(hWnd: HWND) -> BOOL; + pub fn OpenDesktopA( + lpszDesktop: LPCSTR, dwFlags: DWORD, fInherit: BOOL, dwDesiredAccess: ACCESS_MASK, + ) -> HDESK; + pub fn OpenDesktopW( + lpszDesktop: LPCWSTR, dwFlags: DWORD, fInherit: BOOL, dwDesiredAccess: ACCESS_MASK, + ) -> HDESK; + pub fn OpenIcon(hWnd: HWND) -> BOOL; + pub fn OpenInputDesktop(dwFlags: DWORD, fInherit: BOOL, dwDesiredAccess: ACCESS_MASK) -> HDESK; + pub fn OpenWindowStationA( + lpszWinSta: LPCSTR, fInherit: BOOL, dwDesiredAccess: ACCESS_MASK, + ) -> HWINSTA; + pub fn OpenWindowStationW( + lpszWinSta: LPCWSTR, fInherit: BOOL, dwDesiredAccess: ACCESS_MASK, + ) -> HWINSTA; + pub fn PackDDElParam(msg: UINT, uiLo: UINT_PTR, uiHi: UINT_PTR) -> LPARAM; + // pub fn PackTouchHitTestingProximityEvaluation(); + pub fn PaintDesktop(hdc: HDC) -> BOOL; + pub fn PeekMessageA( + lpMsg: LPMSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT, + ) -> BOOL; + pub fn PeekMessageW( + lpMsg: LPMSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT, + ) -> BOOL; + // pub fn PhysicalToLogicalPoint(); + // pub fn PhysicalToLogicalPointForPerMonitorDPI(); + pub fn PostMessageA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL; + pub fn PostMessageW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL; + pub fn PostQuitMessage(nExitCode: c_int); + pub fn PostThreadMessageA( + idThread: DWORD, msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> BOOL; + pub fn PostThreadMessageW( + idThread: DWORD, msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> BOOL; + pub fn PrintWindow(hwnd: HWND, hdcBlt: HDC, nFlags: UINT) -> BOOL; + // pub fn PrivateExtractIconsA(); + // pub fn PrivateExtractIconsW(); + pub fn PtInRect(lprc: *const RECT, pt: POINT) -> BOOL; + // pub fn QueryDisplayConfig(); + pub fn RealChildWindowFromPoint( + hwndParent: HWND, ptParentClientCoords: POINT, + ) -> HWND; + pub fn RealGetWindowClass( + hwnd: HWND, ptszClassName: LPSTR, cchClassNameMax: UINT, + ) -> UINT; + pub fn RealGetWindowClassA( + hwnd: HWND, ptszClassName: LPSTR, cchClassNameMax: UINT, + ) -> UINT; + pub fn RealGetWindowClassW( + hwnd: HWND, ptszClassName: LPWSTR, cchClassNameMax: UINT, + ) -> UINT; + pub fn RedrawWindow( + hwnd: HWND, lprcUpdate: *const RECT, hrgnUpdate: HRGN, flags: UINT, + ) -> BOOL; + // pub fn RegisterClassA(); + // pub fn RegisterClassExA(); + pub fn RegisterClassExW(lpWndClass: *const WNDCLASSEXW) -> ATOM; + pub fn RegisterClassW(lpWndClass: *const WNDCLASSW) -> ATOM; + pub fn RegisterClipboardFormatA(lpszFormat: LPCSTR) -> UINT; + pub fn RegisterClipboardFormatW(lpszFormat: LPCWSTR) -> UINT; + pub fn RegisterDeviceNotificationA( + hRecipient: HANDLE, notificationFilter: LPVOID, flags: DWORD, + ) -> HDEVNOTIFY; + pub fn RegisterDeviceNotificationW( + hRecipient: HANDLE, notificationFilter: LPVOID, flags: DWORD, + ) -> HDEVNOTIFY; + pub fn RegisterHotKey(hwnd: HWND, id: c_int, fsModifiers: UINT, vk: UINT) -> BOOL; + // pub fn RegisterPointerDeviceNotifications(); + // pub fn RegisterPointerInputTarget(); + // pub fn RegisterPowerSettingNotification(); + pub fn RegisterRawInputDevices( + pRawInputDevices: PCRAWINPUTDEVICE, uiNumDevices: UINT, cbSize: UINT, + ) -> BOOL; + // pub fn RegisterShellHookWindow(); + // pub fn RegisterSuspendResumeNotification(); + // pub fn RegisterTouchHitTestingWindow(); + pub fn RegisterTouchWindow(hWnd: HWND, flags: ULONG) -> BOOL; + pub fn RegisterWindowMessageA(lpString: LPCSTR) -> UINT; + pub fn RegisterWindowMessageW(lpString: LPCWSTR) -> UINT; + pub fn ReleaseCapture() -> BOOL; + pub fn ReleaseDC(hWnd: HWND, hDC: HDC) -> c_int; + // pub fn RemoveClipboardFormatListener(); + // pub fn RemoveMenu(); + pub fn RemovePropA(hWnd: HWND, lpStr: LPCSTR) -> HANDLE; + pub fn RemovePropW(hWnd: HWND, lpStr: LPCWSTR) -> HANDLE; + // pub fn ReplyMessage(); + // pub fn ReuseDDElParam(); + pub fn ScreenToClient(hWnd: HWND, lpPoint: LPPOINT) -> BOOL; + pub fn ScrollDC( + hDC: HDC, dx: c_int, dy: c_int, lprcScroll: *const RECT, lprcClip: *const RECT, + hrgnUpdate: HRGN, lprcUpdate: LPRECT, + ) -> BOOL; + pub fn ScrollWindow( + hWnd: HWND, xAmount: c_int, yAmount: c_int, lpRect: *const RECT, lpClipRect: *const RECT, + ) -> BOOL; + pub fn ScrollWindowEx( + hWnd: HWND, dx: c_int, dy: c_int, prcScroll: *const RECT, prcClip: *const RECT, + hrgnUpdate: HRGN, prcUpdate: LPRECT, flags: UINT, + ) -> c_int; + pub fn SendDlgItemMessageA( + hDlg: HWND, nIDDlgItem: c_int, Msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + pub fn SendDlgItemMessageW( + hDlg: HWND, nIDDlgItem: c_int, Msg: UINT, wParam: WPARAM, lParam: LPARAM, + ) -> LRESULT; + // pub fn SendIMEMessageExA(); + // pub fn SendIMEMessageExW(); + pub fn SendInput(cInputs: UINT, pInputs: LPINPUT, cbSize: c_int) -> UINT; + pub fn SendMessageA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT; + // pub fn SendMessageCallbackA(); + // pub fn SendMessageCallbackW(); + pub fn SendMessageTimeoutA( + hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM, fuFlags: UINT, uTimeout: UINT, + lpdwResult: PDWORD_PTR, + ) -> LRESULT; + pub fn SendMessageTimeoutW( + hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM, fuFlags: UINT, uTimeout: UINT, + lpdwResult: PDWORD_PTR, + ) -> LRESULT; + pub fn SendMessageW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT; + pub fn SendNotifyMessageA(hWnd: HWND, msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL; + pub fn SendNotifyMessageW(hWnd: HWND, msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL; + pub fn SetActiveWindow(hWnd: HWND) -> HWND; + pub fn SetCapture(hWnd: HWND) -> HWND; + pub fn SetCaretBlinkTime(uMSeconds: UINT) -> BOOL; + pub fn SetCaretPos(x: c_int, y: c_int) -> BOOL; + pub fn SetClassLongA(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD; + #[cfg(target_arch = "x86_64")] + pub fn SetClassLongPtrA(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn SetClassLongPtrW(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR; + pub fn SetClassLongW(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD; + pub fn SetClassWord(hWnd: HWND, nIndex: c_int, wNewWord: WORD) -> WORD; + pub fn SetClipboardData(uFormat: UINT, hMem: HANDLE) -> HANDLE; + pub fn SetClipboardViewer(hWndNewViewer: HWND) -> HWND; + // pub fn SetCoalescableTimer(); + pub fn SetCursor(hCursor: HCURSOR) -> HCURSOR; + pub fn SetCursorPos(x: c_int, y: c_int) -> BOOL; + // pub fn SetDebugErrorLevel(); + // pub fn SetDeskWallpaper(); + // pub fn SetDisplayAutoRotationPreferences(); + // pub fn SetDisplayConfig(); + pub fn SetDlgItemInt(hDlg: HWND, nIDDlgItem: c_int, uValue: UINT, bSigned: BOOL) -> BOOL; + pub fn SetDlgItemTextA(hDlg: HWND, nIDDlgItem: c_int, lpString: LPCSTR) -> BOOL; + pub fn SetDlgItemTextW(hDlg: HWND, nIDDlgItem: c_int, lpString: LPCWSTR) -> BOOL; + pub fn SetDoubleClickTime(uInterval: UINT) -> BOOL; + pub fn SetFocus(hWnd: HWND) -> HWND; + pub fn SetForegroundWindow(hWnd: HWND) -> BOOL; + // pub fn SetGestureConfig(); + pub fn SetKeyboardState(lpKeyState: LPBYTE) -> BOOL; + pub fn SetLastErrorEx(dwErrCode: DWORD, dwType: DWORD); + pub fn SetLayeredWindowAttributes( + hwnd: HWND, crKey: COLORREF, bAlpha: BYTE, dwFlags: DWORD + ) -> BOOL; + pub fn SetMenu(hWnd: HWND, hMenu: HMENU) -> BOOL; + // pub fn SetMenuContextHelpId(); + // pub fn SetMenuDefaultItem(); + // pub fn SetMenuInfo(); + // pub fn SetMenuItemBitmaps(); + // pub fn SetMenuItemInfoA(); + // pub fn SetMenuItemInfoW(); + // pub fn SetMessageExtraInfo(); + // pub fn SetMessageQueue(); + pub fn SetParent(hWndChild: HWND, hWndNewParent: HWND) -> HWND; + pub fn SetPhysicalCursorPos(x: c_int, y: c_int) -> BOOL; + // pub fn SetProcessDPIAware(); + // pub fn SetProcessDefaultLayout(); + // pub fn SetProcessRestrictionExemption(); + // pub fn SetProcessWindowStation(); + pub fn SetPropA(hWnd: HWND, lpString: LPCSTR, hData: HANDLE) -> BOOL; + pub fn SetPropW(hWnd: HWND, lpString: LPCWSTR, hData: HANDLE) -> BOOL; + pub fn SetRect(lprc: LPRECT, xLeft: c_int, yTop: c_int, xRight: c_int, yBottom: c_int) -> BOOL; + pub fn SetRectEmpty(lprc: LPRECT) -> BOOL; + pub fn SetScrollInfo(hwnd: HWND, nBar: c_int, lpsi: *const SCROLLINFO, redraw: BOOL) -> c_int; + pub fn SetScrollPos(hWnd: HWND, nBar: c_int, nPos: c_int, bRedraw: BOOL) -> c_int; + pub fn SetScrollRange( + hWnd: HWND, nBar: c_int, nMinPos: c_int, nMaxPos: c_int, bRedraw: BOOL, + ) -> BOOL; + // pub fn SetShellWindow(); + pub fn SetSysColors( + cElements: c_int, lpaElements: *const INT, lpaRgbValues: *const COLORREF, + ) -> BOOL; + pub fn SetSystemCursor(hcur: HCURSOR, id: DWORD) -> BOOL; + pub fn SetThreadDesktop(hDesktop: HDESK) -> BOOL; + pub fn SetTimer( + hWnd: HWND, nIDEvent: UINT_PTR, uElapse: UINT, lpTimerFunc: TimerProc, + ) -> UINT_PTR; + // pub fn SetUserObjectInformationA(); + // pub fn SetUserObjectInformationW(); + // pub fn SetUserObjectSecurity(); + pub fn SetWinEventHook( + eventMin: DWORD, eventMax: DWORD, hmodWinEventProc: HMODULE, pfnWinEventProc: WINEVENTPROC, + idProcess: DWORD, idThread: DWORD, dwFlags: DWORD, + ) -> HWINEVENTHOOK; + pub fn SetWindowContextHelpId(h: HWND, d: DWORD) -> BOOL; + // pub fn SetWindowDisplayAffinity(); + // pub fn SetWindowFeedbackSetting(); + pub fn SetWindowLongA(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG; + #[cfg(target_arch = "x86_64")] + pub fn SetWindowLongPtrA(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn SetWindowLongPtrW(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR; + pub fn SetWindowLongW(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG; + pub fn SetWindowPlacement(hWnd: HWND, lpwndpl: *const WINDOWPLACEMENT) -> BOOL; + pub fn SetWindowPos( + hWnd: HWND, hWndInsertAfter: HWND, X: c_int, Y: c_int, cx: c_int, cy: c_int, uFlags: UINT, + ) -> BOOL; + pub fn SetWindowRgn(hWnd: HWND, hRgn: HRGN, bRedraw: BOOL) -> c_int; + pub fn SetWindowTextA(hWnd: HWND, lpString: LPCSTR) -> BOOL; + pub fn SetWindowTextW(hWnd: HWND, lpString: LPCWSTR) -> BOOL; + pub fn SetWindowWord(hwnd: HWND, nIndex: c_int, wNewWord: WORD) -> WORD; + // pub fn SetWindowsHookA(); + pub fn SetWindowsHookExA( + idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD, + ) -> HHOOK; + pub fn SetWindowsHookExW( + idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD, + ) -> HHOOK; + // pub fn SetWindowsHookW(); + pub fn ShowCaret(hWnd: HWND) -> BOOL; + pub fn ShowCursor(bShow: BOOL) -> c_int; + pub fn ShowOwnedPopups(hWnd: HWND, fShow: BOOL) -> BOOL; + pub fn ShowScrollBar(hWnd: HWND, wBar: c_int, bShow: BOOL) -> BOOL; + // pub fn ShowSystemCursor(); + pub fn ShowWindow(hWnd: HWND, nCmdShow: c_int) -> BOOL; + pub fn ShowWindowAsync(hWnd: HWND, nCmdShow: c_int) -> BOOL; + // pub fn ShutdownBlockReasonCreate(); + // pub fn ShutdownBlockReasonDestroy(); + // pub fn ShutdownBlockReasonQuery(); + // pub fn SkipPointerFrameMessages(); + // pub fn SoundSentry(); + // pub fn SubtractRect(); + pub fn SwapMouseButton(fSwap: BOOL) -> BOOL; + pub fn SwitchDesktop(hDesktop: HDESK) -> BOOL; + // pub fn SwitchToThisWindow(); + pub fn SystemParametersInfoA( + uiAction: UINT, uiParam: UINT, pvParam: PVOID, fWinIni: UINT + ) -> BOOL; + pub fn SystemParametersInfoW( + uiAction: UINT, uiParam: UINT, pvParam: PVOID, fWinIni: UINT + ) -> BOOL; + pub fn TabbedTextOutA( + hdc: HDC, x: c_int, y: c_int, lpString: LPCSTR, chCount: c_int, nTabPositions: c_int, + lpnTabStopPositions: *const INT, nTabOrigin: c_int, + ) -> LONG; + pub fn TabbedTextOutW( + hdc: HDC, x: c_int, y: c_int, lpString: LPCWSTR, chCount: c_int, nTabPositions: c_int, + lpnTabStopPositions: *const INT, nTabOrigin: c_int, + ) -> LONG; + // pub fn TileChildWindows(); + // pub fn TileWindows(); + // pub fn ToAscii(); + // pub fn ToAsciiEx(); + pub fn ToUnicode( + wVirtKey: UINT, wScanCode: UINT, lpKeyState: *const BYTE, lwszBuff: LPWSTR, cchBuff: c_int, + wFlags: UINT + ) -> c_int; + // pub fn ToUnicodeEx(); + pub fn TrackMouseEvent(lpEventTrack: LPTRACKMOUSEEVENT) -> BOOL; + // pub fn TrackPopupMenu(); + // pub fn TrackPopupMenuEx(); + // pub fn TranslateAccelerator(); + // pub fn TranslateAcceleratorA(); + // pub fn TranslateAcceleratorW(); + // pub fn TranslateMDISysAccel(); + pub fn TranslateMessage(lpmsg: *const MSG) -> BOOL; + pub fn UnhookWinEvent(hWinEventHook: HWINEVENTHOOK) -> BOOL; + // pub fn UnhookWindowsHook(); + pub fn UnhookWindowsHookEx(hhk: HHOOK) -> BOOL; + pub fn UnionRect(lprcDst: LPRECT, lprcSrc1: *const RECT, lprcSrc2: *const RECT) -> BOOL; + pub fn UnloadKeyboardLayout(hkl: HKL) -> BOOL; + pub fn UnpackDDElParam(msg: UINT, lParam: LPARAM, puiLo: PUINT_PTR, puiHi: PUINT_PTR) -> BOOL; + pub fn UnregisterClassA(lpClassName: LPCSTR, hInstance: HINSTANCE) -> BOOL; + pub fn UnregisterClassW(lpClassName: LPCWSTR, hInstance: HINSTANCE) -> BOOL; + pub fn UnregisterDeviceNotification(Handle: HDEVNOTIFY) -> BOOL; + pub fn UnregisterHotKey(hWnd: HWND, id: c_int) -> BOOL; + // pub fn UnregisterPointerInputTarget(); + // pub fn UnregisterPowerSettingNotification(); + // pub fn UnregisterSuspendResumeNotification(); + // pub fn UnregisterTouchWindow(); + pub fn UpdateLayeredWindow( + hWnd: HWND, hdcDst: HDC, pptDst: *mut POINT, psize: *mut SIZE, hdcSrc: HDC, + pptSrc: *mut POINT, crKey: COLORREF, pblend: *mut BLENDFUNCTION, dwFlags: DWORD, + ) -> BOOL; + // pub fn UpdateLayeredWindowIndirect(); + pub fn UpdateWindow(hWnd: HWND) -> BOOL; + pub fn UserHandleGrantAccess(hUserHandle: HANDLE, hJob: HANDLE, bGrant: BOOL) -> BOOL; + pub fn ValidateRect(hWnd: HWND, lpRect: *const RECT) -> BOOL; + pub fn ValidateRgn(hWnd: HWND, hRgn: HRGN) -> BOOL; + pub fn VkKeyScanA(ch: CHAR) -> SHORT; + pub fn VkKeyScanExA(ch: CHAR, dwhkl: HKL) -> SHORT; + pub fn VkKeyScanExW(ch: WCHAR, dwhkl: HKL) -> SHORT; + pub fn VkKeyScanW(ch: WCHAR) -> SHORT; + // pub fn WINNLSEnableIME(); + // pub fn WINNLSGetEnableStatus(); + // pub fn WINNLSGetIMEHotkey(); + pub fn WaitForInputIdle(hProcess: HANDLE, dwMilliseconds: DWORD) -> DWORD; + pub fn WaitMessage() -> BOOL; + pub fn WinHelpA(hWndMain: HWND, lpszHelp: LPCSTR, uCommand: UINT, dwData: ULONG_PTR) -> BOOL; + pub fn WinHelpW(hWndMain: HWND, lpszHelp: LPCWSTR, uCommand: UINT, dwData: ULONG_PTR) -> BOOL; + pub fn WindowFromDC(hDC: HDC) -> HWND; + // pub fn WindowFromPhysicalPoint(); + pub fn WindowFromPoint(Point: POINT) -> HWND; + pub fn keybd_event(bVk: BYTE, bScan: BYTE, dwFlags: DWORD, dwExtraInfo: ULONG_PTR); + pub fn mouse_event(dwFlags: DWORD, dx: DWORD, dy: DWORD, dwData: DWORD, dwExtraInfo: ULONG_PTR); + // pub fn wsprintfA(); + // pub fn wsprintfW(); + // pub fn wvsprintfA(); + // pub fn wvsprintfW(); +} diff --git a/third_party/rust/winapi-build/.cargo-checksum.json b/third_party/rust/winapi-build/.cargo-checksum.json new file mode 100644 index 000000000000..17c79f49bdbd --- /dev/null +++ b/third_party/rust/winapi-build/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"982633c62ba05c95429b1768896a54c9a032a40fbd1e11049a9b087e9fd89176","src/lib.rs":"1d88932534b784973d3d87ac18cd8f2a0294ce5166cf30488c68ca90443e1750"},"package":"2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"} \ No newline at end of file diff --git a/third_party/rust/winapi-build/.cargo-ok b/third_party/rust/winapi-build/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/winapi-build/Cargo.toml b/third_party/rust/winapi-build/Cargo.toml new file mode 100644 index 000000000000..e1be0b184d1f --- /dev/null +++ b/third_party/rust/winapi-build/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "winapi-build" +version = "0.1.1" +authors = ["Peter Atashian "] +description = "Common code for build.rs in WinAPI -sys crates." +repository = "https://github.com/retep998/winapi-rs" +keywords = ["Windows", "FFI", "WinSDK"] +license = "MIT" + +[lib] +name = "build" diff --git a/third_party/rust/winapi-build/src/lib.rs b/third_party/rust/winapi-build/src/lib.rs new file mode 100644 index 000000000000..fab0c6cdc52d --- /dev/null +++ b/third_party/rust/winapi-build/src/lib.rs @@ -0,0 +1,14 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub fn link(name: &str, bundled: bool) { + use std::env::var; + let target = var("TARGET").unwrap(); + let target: Vec<_> = target.split('-').collect(); + if target.get(2) == Some(&"windows") { + println!("cargo:rustc-link-lib=dylib={}", name); + if bundled && target.get(3) == Some(&"gnu") { + let dir = var("CARGO_MANIFEST_DIR").unwrap(); + println!("cargo:rustc-link-search=native={}/{}", dir, target[0]); + } + } +} diff --git a/third_party/rust/winapi/.cargo-checksum.json b/third_party/rust/winapi/.cargo-checksum.json new file mode 100644 index 000000000000..84d20af66b1f --- /dev/null +++ b/third_party/rust/winapi/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"d15a0464554e57323507a2ff34925a2c592f3dffec9beb092c7ce985440f5bda","LICENSE.md":"fd232cfaeeff018cd3b9f22e0279b1c2237742999277596638800e967f6e4a29","src/activation.rs":"0e25834dfecd59391e2ecfdaa2e01bb5ac4d181778b47d0b9f67c56a6b2bd75f","src/audioclient.rs":"8c645d4ddb171620a527bcc14fa2904ff9aeb529262e68a0a9957d2ed77118be","src/audiosessiontypes.rs":"ba8cd1950cdab112861208ac1ecc35e656cbbe36e60c31315e547cfe47707685","src/basetsd.rs":"7b879d3164d5e6ec1b94d18a6b58f74a7f4e62fc279df32126e76c4f3138239d","src/bcrypt.rs":"05fe44190a37dd744bff8fc682f25a47c5f4239d417b213d18542aaa19b08b06","src/cfg.rs":"057ace203f04f8c09b6f68fefba7d3eb6644c46f2e44ca8f1364a8bc3bdd4970","src/cfgmgr32.rs":"714289f058283fc89fc79bbd4932bdbc0e9a88edd62a1787aac82c338f2dfb45","src/combaseapi.rs":"45458b1e0d918b237afd7e9581e2714b58ee009a91bbec45827694d1159a2e8b","src/commctrl.rs":"c0173aabd50f34a85c2523876fa0191d052d1d0c157f95ed228d98508806cc7d","src/commdlg.rs":"e75f64491eea54f651884eb3cc5353588c7fe54b086b43557d6d4917abbf95cd","src/corsym.rs":"301f937c7cb394675b2127a24595beef261d269d8f7cb45d6b4ac21a063985e3","src/d2d1.rs":"e7aa08883d85e2631f5327541e644b650ad009095daadef606bb06d9ac99afd3","src/d2dbasetypes.rs":"5a26048c997a580d8bb2a3512f1cb20dba411da99ffd6b23f4b0615ab9378058","src/d3d10shader.rs":"d6edf923fa8442be35b7f4ebebcd2e4bec4c3842ed5aee4bfd05c2de11edc4e0","src/d3d11.rs":"3f2f681357730df7ea954fb78903f0f0ad0bb3b577727307e751fd9598a4e837","src/d3d11shader.rs":"29612cc75ba238e2cd691fdcc01be9c79ca12b046e207d3cbfc5af23f04c4cb9","src/d3d12.rs":"906e512385e78756fe84f9a9622c510ce5a6daeb121127cf93f11af0f2fa3763","src/d3d12sdklayers.rs":"b50edb48a1c51bc7e3bf7176733c3dad4eb45a4e9747096e3b5a723052e130c8","src/d3d12shader.rs":"ff58932ef32c108348e41864f09ac6f909d641cac4f94c3e4f6c3dc4e5916521","src/d3d9.rs":"e01614130a4d68bb6e2a23f62ffb4d5016381e9026f8477aaca64851c8dcad53","src/d3d9caps.rs":"d4bcf91b7ae307388c91c19eacdb808506faea184b03178feee5c47959211b7b","src/d3d9types.rs":"1e10aae6297bc8dc083b111da496313ff19dcb9b88450e2637f8e98c0401519c","src/d3dcommon.rs":"f841b2e4df6dfccb9eb1955add24689db7b173780ec25e99b89097140a012152","src/d3dcompiler.rs":"02269410bd7f83f49391f852320ca0d76fd8d907ed22c68a003af65b3f5ab54a","src/dbghelp.rs":"c0ea5bcd04f414a696cd876439a7c4d6ee63627f4662705d189fd6e0412622f8","src/dcommon.rs":"8889ca66e2f89f1c275e5d6b7d6b203e7f25b4e7a262689b2ec6f04b9d1b5ae8","src/devpropdef.rs":"74948513ed623d3bdf1ea3fbf1f540b3e9e46efb9c1674ecccfe7f2fae5792f2","src/docobj.rs":"43e214d9d0c436a88ed2c620b8386e58e4d549ba9c8be51bf52291caf95e225d","src/dpapi.rs":"d44a1a6c9e52b34e8e87df1079b97081c646f07d0eee51f0d0cf66ae1c6fd58a","src/dsgetdc.rs":"5911c35ef3d80a5162fdbea6902f9b07033b746ff91bff2657a0971edb07bff2","src/dsound.rs":"53a5532d645e1b7995f0b4a0f0711fc66da8a27b7f8c87ce3d9e0882cfdca07c","src/dsrole.rs":"50b27a8afb11188ce24ab49620fe69ea21658148d8fd6076b8927175db5c1a9e","src/dwmapi.rs":"e65ca961eec0db275e211e04c59a8995c8c13d36ab08dc36ce197d9a4856266f","src/dwrite.rs":"f138d36e8b93778a7866cc755893b4da19cfd6ce42427139589a0bbaa294eb44","src/dxgi.rs":"5b6fcc5c665df1c0c6ed3de5d678a7bade1bb8ab1acbe952b784ce99fc817e53","src/dxgi1_2.rs":"6ba44755d715f2493236103fc5c24d7d45dff2e1fc3690aefbd4eb6c859dbc07","src/dxgi1_3.rs":"1f86a9db5fd45199fcc3ce56423e5fcf0c58df4001e2b50c5586d38ab820b78f","src/dxgi1_4.rs":"c578e6fcb82d535b20fc10232b75a7b9512d068919cc1e3f1c7cf55f3eb46460","src/dxgiformat.rs":"2e73df34f480b6ef3b5e21de0a520dacec91b00772e42786568fd162ca5e9aa6","src/dxgitype.rs":"204b8dae38c13a1dd8cd2ce6ca68851f743b416213d6db1cd0d96808bcbf7058","src/errhandlingapi.rs":"a70f9db3dd8ab60aba0daf39f12b527e54e312ca640e0b80d80c93ffdb6913c6","src/excpt.rs":"b07cf9ff0d23dd50c0776d048d0c579e401b7d729635f78998f85d35f33f05a4","src/fileapi.rs":"d31814c612bbd9372abbf6f8455fc2af89ac236c6b1855da10d66545e485ec57","src/gl.rs":"9429708bb97aeecb2c40030460ed0c3415fc0f2335c9513c68afa6157bd9b465","src/guiddef.rs":"86618dcd39c77048c7e453e6e86dafe90358eb7f97144f9672ae09e7b9855729","src/heapapi.rs":"21e420ba7641e507e8f2801d2b0ed25dbcb98e967924d711beb5cbfa8a5785e4","src/hidclass.rs":"a93380d35dc4d45807b10bbd69ee63eb8517b75989b68391685070a2fcfbefa1","src/hidpi.rs":"0b641fc119ac35761fe8e5eaed9a0781e9018598ea269d6cd386dbf5563ab9a0","src/hidsdi.rs":"50abb938ea8d0af90ccdea7ac3de4bc10fe42e34bc6a6d6eb4da1b330727da34","src/hidusage.rs":"44adc029bc89f0d4977b1295b7e998ddabf5283de66e1e33146bda8968d1d98b","src/hstring.rs":"51b3e63e3f1ed48f54c63c3e820e0563fb857b2743529d5f947f718d43425b89","src/http.rs":"ebb8b8db9e786e2683ad8b9a9066ef418df773ae7ce4d75f166cb5321f85f5a0","src/imm.rs":"b9277502f17f4cc6bde4f80f722ec1b976913355edbf162814ccfec2b3b080fd","src/inaddr.rs":"938143669da02c83a31d207be11e2176ed5219edf0e6f8f7a5534a5c6c3ce8d1","src/inspectable.rs":"b01f1814a233a77bf9f25c264747252c0464388c7d9c7302e5bde57502b8139b","src/ksmedia.rs":"acb96b1ea0cf3b5397f9037958093c6b4dbb54c4246516e57b9fed055e8e69c1","src/lib.rs":"8a7840b030f56883f68bdf90a1a04df8be2a5e2698a9ea86c73fac59c9f09b6e","src/libloaderapi.rs":"21a5d17c9f8ac4c006b515979964a8870f30710be4482083f45c6a41a16a36ce","src/lmaccess.rs":"712661c871569513334152bdcdf56c07776c560a22cd5b892a0f38e1957e28db","src/lmcons.rs":"3449aab4399cc36e7d7db551e384d82dfa4204178c4cfb9642f90645687fbc81","src/lmdfs.rs":"c351cdb2d10bf3a7c5ce7400dcdca41a792554e21e75fa9e5378ac18d8d3e4e7","src/lmerrlog.rs":"7937928544d27575e302c5e9c5e6803e9033e1f4d715e7ca29be202276d7d7a6","src/lmjoin.rs":"362cdc71f3f50099b862eff0733b3a57dd0f95cac15943135f794424f651b916","src/lsalookup.rs":"4aef1a95033444181f2b2b9df364ea165b0fdedb396c63e5d12db6b7398a3d5f","src/macros.rs":"5dacc570f226b6f1ad31d76a03675f0d182a3d578846920000fabb7cd92fc7f8","src/memoryapi.rs":"2273b8bfd7fc36dcf654c320826952ad502e8922a84174f8c1f7ed08aa555a04","src/minschannel.rs":"139828de63a0a4476de2bee454f5bca5e8a46cc29f1680339bb2804ee2d17322","src/minwinbase.rs":"6cd387a7f79e1a708bc48b5b27eaeaa7aadf0fff7a5e0a76cda0bdf3fa871863","src/minwindef.rs":"47ba4f2ec7789109ae339170715ed76288ae60ee57a4f06d5cc50a0e6855699f","src/mmdeviceapi.rs":"c8b7f7b6b78488d23ccba2b34e8765eac60ec9f08e19c96b377d957f65b1b6d1","src/mmreg.rs":"1621fad6eaa16d1e5ca95055fd11bf066b777b1343625f9fdc74e4d313d60dea","src/mmsystem.rs":"f6a2bff3bf80af1468de2c2a5f7ff2ced2b625adaf24f08f9b303965ed5ee371","src/mscat.rs":"9226a8e30546c4142e4fcdc716f8a15cc7c8081c9e875ec72ff9e8551f86f9a1","src/mssip.rs":"d7e2b91e358ff4986e700396d04f92aa1671aafada0d4889914a413177c091e1","src/nb30.rs":"dd85d7849111f04d33895835269929dc219e04de4373e91468eb053e3e0a5c52","src/ncrypt.rs":"29f168dcddeaa2cb231a7174cec672be83cca192ffc4632cead4c4a25189fb49","src/ntdef.rs":"3be66042d16a862f0fed8f48406b08c3091fbf92885a44efb7747f4a764d7de7","src/ntsecapi.rs":"dfb2cc7e23e8b20fa5ffd30ccecdb81b62d8ffeb68fdf99f93fb141ff4155afd","src/ntstatus.rs":"de6208f4e119a6405c1726433ea5e47a8b5f46b345f5809e9f580cce88360a79","src/oaidl.rs":"640c911e39888928baf77145cca34c1a768bfd759ec9709f70649a2946cb3246","src/objbase.rs":"7c9edb6a9ea72baddb15a6aec3602b3f9e7b1ce969dd655f440eae0ede1372e2","src/objidl.rs":"2a623b989f2a216edca3bd118eceff41267632839a3fd4410df9a7c126a87b64","src/objidlbase.rs":"3415a0bcd1b5b63ff48e17138ff87dae7c31eaeb323ae81f34b6712efade1d04","src/olectl.rs":"da2014c3d5858c5abff1635e1b8c8223333e7d22d28cac614aac3305a7f04ee4","src/pdh.rs":"eb01459c2acc456ecd204c6716d26027a6c77c2b4a9b698d3c922254fe2cc319","src/playsoundapi.rs":"7efddfc8601de565946c8c93074211c83b20866a1588e36e0518bba9864d0cf0","src/processsnapshot.rs":"df99a56280e6e41c5896341ffa1abe734f6c8662f4d7ea960cb97fb34c5b85d9","src/processthreadsapi.rs":"bf8edf8984ee97bc5054e68d02ec4633b5f15720602ab19c95d78e7d420c9cc8","src/propidl.rs":"88b5f176e4624063cadd8db95db52bf07cff421d73a8cfe319f992a9c99cd315","src/propsys.rs":"05c411639479f88e77383c585117a886f48ea7453260210db9f283e2cafdffbf","src/prsht.rs":"f862538c0010a51a02e5f24b3a44b54ba5993c32400b98a3b0558741ae7473a3","src/psapi.rs":"512523c5f8334c9ad221a73776c0ed2da93d8e2353dc4d2cee951ffa6ea7c163","src/qos.rs":"9ef6183b7c03b5b412f81f38ebb06048ff6266032bc236964dd994f173b82ec4","src/reason.rs":"c92aded3bbea859f110eed73b9b0fb40df6ac4a6ed6431ca69882b46b5ad5229","src/restrictederrorinfo.rs":"b8c53f4ae149ea806028cdafe699390a20202d72028b5f62836bcbf97720d133","src/roapi.rs":"dbbefb19f402a2aece66b500739b0a9e2c4d0133a8bc94d076510d5a67def175","src/roerrorapi.rs":"84a0a71a3f9ce67a577954ee5761cbd97d892eb5e7eb2c381f6bd29d4e1d4af7","src/rpc.rs":"e2293651222edf37f3ad3076adaae9033b25b06bd7b88ed7372585a4ae46c7d9","src/rpcdce.rs":"de77ca3c9b689ffaaf395a6882d3dfc3a1cec181efa6cb6075e605e4462bc3f6","src/sapi.rs":"05dbc1166b836251538c9e52a772fa584a1d0a1ad823e4336ab5e6cfefb96d57","src/schannel.rs":"e48926896227ffae5033bd634a7c71f5359d7a08b7b8c6e94e03864d87a37f8b","src/servprov.rs":"f086b4330162c7da711ea59d7023304a8fa2a53470b54d846ea1c11567703693","src/setupapi.rs":"4959862dd39597cd711022fcefbaf5c75b61410d57d04e9dbec2ddf7a2fa6f31","src/shellapi.rs":"ce3e3e7cd8aefe8068d6c51256827c0c3d51a449e4ab73e7125ea28d44dd6b6d","src/shellscalingapi.rs":"59c162b0215ff4b71b3535b6e142cca8cd99028031f47f0a6efb960c160a8776","src/shlguid.rs":"dcb7a1ada1b1b90f405e6dea8bcf1fc6994725b49a3165b7908670b2c31490e5","src/shlobj.rs":"53ff059ec6123001bed8f007c36e40812f83e4e04bd50b371319d10b4e38c36f","src/shobjidl.rs":"953d6ef4dc2a0d175d7133dc2f41255123ab8f778b22feaebd8ca1fa77356aa7","src/shtypes.rs":"ff785004e819bcfc521ab79327e58f98debab4e40c20412bbecdcee1b2801371","src/spapidef.rs":"9abe751425b6aaac7e4a7ea49f6d8e859f8f73164abd4d69b48e3e224d7de829","src/sql.rs":"004ed353b40bb4bceab55d6e8c33063a8eac992b076e47e6ead8303dbbc5b67f","src/sqltypes.rs":"0c5fa183c9f5b9e16e292de6a9afdf73f554730e651250856148ac04718803b8","src/sspi.rs":"dbd9d544abea4396983867ef4f7fbe2588673cc953dbeb74e7edc46503b16fa0","src/strmif.rs":"168040999cf99843cc1447988e46c56481a7a343ae41ab854db40ef566fa1119","src/subauth.rs":"183dd0df6436e9f0e859d62ca78e8ed42d4c1a5dc0690dcf22d42467fd2e0700","src/synchapi.rs":"cfce677c85377a340cb9307d9ac9eb06ffe9fd5e2ce08ed4a0390729e3a7d717","src/sysinfoapi.rs":"9a5579143263ce20d8c365b9874a0ae90ef28bc3295eab26ba3782efa48b464a","src/threadpoolapi.rs":"57876ea70b86d08663f7916ce076547f17596c26b8bf4dfafbad60e78264ff95","src/timezoneapi.rs":"5ccd80e6d16a858c56e20a7f3c5570e29777dab0fdfc057b6d2fb06463d56eb3","src/tlhelp32.rs":"c96ef7416bceab473463cc4ad98f037aeaac87bb7adf45cc16c281308537e82f","src/unknwnbase.rs":"2708c19491deb7364100025f3bb88a791c219551a65af70a776f8f3c5bf18b05","src/urlhist.rs":"8c8c0d0a613e59f68bf0e8cec061ea2126baa98d1479df4d07c8df5e41b50bc1","src/urlmon.rs":"0652e602ef2f5826360e5eab68bdf4f9365827a012c2c89289c54016ea001b74","src/usb.rs":"7e682ee819b237eabe796e604cff2434c450f724f4c86d919683eb7a5167c343","src/usbspec.rs":"d19671960838eb592cda4cd7c84c6f66cd9484f0904b5a28e1d8fd91e9c2c6af","src/usp10.rs":"baa2c1ef6ca5f064bc55b24f39c0553ede45a87b9183318572916fd4f1c679c6","src/vadefs.rs":"0e2f12fd1c521a943908669b2d10fceea409bac45242ec6e87c0e69706c1b3d0","src/vsbackup.rs":"af71cb851bd7eacde9d3e46a112497baef3ecebb472aae3c76c7faff804d33f9","src/vss.rs":"a626613810a69309b8f50d0a3bd75928d9de771c2287b6242487cb8cd55394a0","src/vsserror.rs":"f06b108d66ea9f06ad15d83b981117ed6a2a9cd218bb3bf53f13b0055acd9b2e","src/vswriter.rs":"8c4f5d27fa0883d187506538136cc610074941bb952afbe0984f7cb7c3c656f7","src/werapi.rs":"a2d692514ff3a61126971c5c2c5a7298c0f822559550a7f14501f8c96d1d951a","src/winbase.rs":"e224c40d827b1f1a9c74643c000f71e87ad18f749810cc611425af325c9472b8","src/wincon.rs":"402c5ebf80aa6ab1002935b7ddca17e8a243d0c714982054395862fe0ae40a04","src/wincred.rs":"e5fa987622dd880151ae190bb45daa666ffae3ae8e2da97407210afe01dd93d6","src/wincrypt.rs":"f7f8743b6a89d3f5e8b07405e43010bb3729aa8a8cf4546cc02705f802947ebc","src/windef.rs":"89fa9f5ab2909a4840f16979ebbc0afa2134abcb1d47cb7435b581f31b227658","src/windowscodecs.rs":"7c63bc4e2d0e7ce60c7bb13b93ef5aa12213f71a46845b6e034a9c224ef3eb3c","src/windowsx.rs":"414a9a841590f88804da3eb9ba55d583372a467cc50ab1ebdd7cfc653ce5f627","src/winerror.rs":"f3882eba4e299acbdedd548feb1ff89de958fb72d665bd6ba013b6a1f7596b52","src/winevt.rs":"64ae96f475ed98da7a84704d53d16caccbac2dbd525de0ef0f65fc58a6775ed1","src/wingdi.rs":"35aa9dd14b4b4c5a227ac3df0d312c19cbaede2d1388c26ad8eb910e80efeafd","src/winhttp.rs":"37769be104a2eb9efa70ffd74c8f38a09d9639cf575a677ad75d941e8d87cd58","src/winioctl.rs":"0f0efe0a41894a325b70428d04aeddec8dd7a87a91489a4e564a248e8498861b","src/winnetwk.rs":"d492c3d14a422f611166d39b895ddc6dd749ebc64a020bf3125af452494f91dd","src/winnls.rs":"90904d6adad70081a620165223fb4a71b64d747596c64d0df7de9511cd0f75c6","src/winnt.rs":"2c51ad0a065006010f1cfe7a3335274304e4747adc63f9798e1ca1f7091154a5","src/winreg.rs":"c687a5c6433daa13793815ef9af8befaedc9635be14eea0c618ad5334952dc31","src/winscard.rs":"78ab1d3ae22e486726740c343a4cc6268ca318de43f4b7d7ba51acbdf1b93936","src/winsmcrd.rs":"62be129c3d4cdea9dd31e769b587f071a94c347c8df71a43bb1eea18d52a60cc","src/winsock2.rs":"21dc0393f37f56c15c59d49a32861fb24c8f28d43ce26b56d958a174a5040a76","src/winspool.rs":"a3bd8e04f2db6118fe529bf52cb856a773cd8b816d197fc8edc8ac942578fd74","src/winstring.rs":"dc535f972d93be2fe067a5ca64edb45b6ad8e4549ecc0ce24486bd94555d5707","src/winsvc.rs":"7999f00b341f3e0e8701ea89f71986a6600650ff8cffdb1292e9f55d47bd0a3e","src/winusb.rs":"0ac355aa879a4aae501db04f1e8859dbef5e33fda9d46a7a12ef25e5524ec396","src/winusbio.rs":"8e2d64832999b59b2ea900396184c36d34cf94c97f31e15916c299213748a3e1","src/winuser.rs":"791bd8625812feccc8ec421489194d635c94cb4c4d754287a0caa54fa8f71c19","src/ws2def.rs":"0a1c7a69e4da8edc0584b0e3fb4ad1fa4aed621510b1bc1b0d104990577c6a38","src/ws2ipdef.rs":"c6a898cf25d187ad83e110af1e2286824868691a60818ecc44e68fa0bbbd4ff6","src/ws2spi.rs":"e63da700de55a317769230319eb9e4ec85cc0ac80b2baa076399367338b7ca0f","src/ws2tcpip.rs":"698084fd5d631a2ef236fe76001e7c44afd9b8958243e4ad4c098ac4beb4b352","src/wtypes.rs":"2689e8f442ccdc0b0e1ec82160a5cc3e80abf95dca82855ec595314062774a14","src/wtypesbase.rs":"f6dc0a8b09f3f003339c5dd366bdddb9dd671894be9dcf4a42058b226d2917a8","src/xinput.rs":"e15cd46bf18977481e22d609f8e0bb5508776902d7fa64477bb5b78596c0f67d"},"package":"167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"} \ No newline at end of file diff --git a/third_party/rust/winapi/.cargo-ok b/third_party/rust/winapi/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/winapi/Cargo.toml b/third_party/rust/winapi/Cargo.toml new file mode 100644 index 000000000000..941a659b0fc3 --- /dev/null +++ b/third_party/rust/winapi/Cargo.toml @@ -0,0 +1,61 @@ +[package] +name = "winapi" +version = "0.2.8" +authors = ["Peter Atashian "] +description = "Types and constants for WinAPI bindings. See README for list of crates providing function bindings." +documentation = "https://retep998.github.io/doc/winapi/" +repository = "https://github.com/retep998/winapi-rs" +readme = "README.md" +keywords = ["windows", "ffi", "win32", "com", "directx"] +license = "MIT" +include = ["src/**/*", "Cargo.toml", "LICENSE.md"] + +[dev-dependencies] +advapi32-sys = { version = "0", path = "lib/advapi32" } +bcrypt-sys = { version = "0", path = "lib/bcrypt" } +comctl32-sys = { version = "0", path = "lib/comctl32" } +comdlg32-sys = { version = "0", path = "lib/comdlg32" } +credui-sys = { version = "0", path = "lib/credui" } +crypt32-sys = { version = "0", path = "lib/crypt32" } +d2d1-sys = { version = "0", path = "lib/d2d1" } +d3d11-sys = { version = "0", path = "lib/d3d11" } +d3d12-sys = { version = "0", path = "lib/d3d12" } +d3d9-sys = { version = "0", path = "lib/d3d9" } +d3dcompiler-sys = { version = "0", path = "lib/d3dcompiler" } +dbghelp-sys = { version = "0", path = "lib/dbghelp" } +dsound-sys = { version = "0", path = "lib/dsound" } +dwmapi-sys = { version = "0", path = "lib/dwmapi" } +dwrite-sys = { version = "0", path = "lib/dwrite" } +dxgi-sys = { version = "0", path = "lib/dxgi" } +dxguid-sys = { version = "0", path = "lib/dxguid" } +gdi32-sys = { version = "0", path = "lib/gdi32" } +hid-sys = { version = "0", path = "lib/hid" } +httpapi-sys = { version = "0", path = "lib/httpapi" } +kernel32-sys = { version = "0", path = "lib/kernel32" } +ktmw32-sys = { version = "0", path = "lib/ktmw32" } +mpr-sys = { version = "0", path = "lib/mpr" } +netapi32-sys = { version = "0", path = "lib/netapi32" } +odbc32-sys = { version = "0", path = "lib/odbc32" } +ole32-sys = { version = "0", path = "lib/ole32" } +oleaut32-sys = { version = "0", path = "lib/oleaut32" } +opengl32-sys = { version = "0", path = "lib/opengl32" } +pdh-sys = { version = "0", path = "lib/pdh" } +psapi-sys = { version = "0", path = "lib/psapi" } +runtimeobject-sys = { version = "0", path = "lib/runtimeobject" } +secur32-sys = { version = "0", path = "lib/secur32" } +setupapi-sys = { version = "0", path = "lib/setupapi" } +shell32-sys = { version = "0", path = "lib/shell32" } +shlwapi-sys = { version = "0", path = "lib/shlwapi" } +user32-sys = { version = "0", path = "lib/user32" } +userenv-sys = { version = "0", path = "lib/userenv" } +usp10-sys = { version = "0", path = "lib/usp10" } +uuid-sys = { version = "0", path = "lib/uuid" } +vssapi-sys = { version = "0", path = "lib/vssapi" } +wevtapi-sys = { version = "0", path = "lib/wevtapi" } +winhttp-sys = { version = "0", path = "lib/winhttp" } +winmm-sys = { version = "0", path = "lib/winmm" } +winscard-sys = { version = "0", path = "lib/winscard" } +winspool-sys = { version = "0", path = "lib/winspool" } +winusb-sys = { version = "0", path = "lib/winusb" } +ws2_32-sys = { version = "0", path = "lib/ws2_32" } +xinput-sys = { version = "0", path = "lib/xinput" } diff --git a/third_party/rust/winapi/LICENSE.md b/third_party/rust/winapi/LICENSE.md new file mode 100644 index 000000000000..60d12ac7b712 --- /dev/null +++ b/third_party/rust/winapi/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Peter Atashian + +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. diff --git a/third_party/rust/winapi/src/activation.rs b/third_party/rust/winapi/src/activation.rs new file mode 100644 index 000000000000..f94f81b4ea26 --- /dev/null +++ b/third_party/rust/winapi/src/activation.rs @@ -0,0 +1,5 @@ +RIDL!( +interface IActivationFactory(IActivationFactoryVtbl): IInspectable(IInspectableVtbl) { + fn ActivateInstance(&mut self, instance: *mut *mut ::IInspectable) -> ::HRESULT +} +); \ No newline at end of file diff --git a/third_party/rust/winapi/src/audioclient.rs b/third_party/rust/winapi/src/audioclient.rs new file mode 100644 index 000000000000..5a5ee6a84cec --- /dev/null +++ b/third_party/rust/winapi/src/audioclient.rs @@ -0,0 +1,71 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! this ALWAYS GENERATED file contains the definitions for the interfaces +//1627 +pub const AUDCLNT_E_NOT_INITIALIZED: ::HRESULT = AUDCLNT_ERR!(0x001); +pub const AUDCLNT_E_ALREADY_INITIALIZED: ::HRESULT = AUDCLNT_ERR!(0x002); +pub const AUDCLNT_E_WRONG_ENDPOINT_TYPE: ::HRESULT = AUDCLNT_ERR!(0x003); +pub const AUDCLNT_E_DEVICE_INVALIDATED: ::HRESULT = AUDCLNT_ERR!(0x004); +pub const AUDCLNT_E_NOT_STOPPED: ::HRESULT = AUDCLNT_ERR!(0x005); +pub const AUDCLNT_E_BUFFER_TOO_LARGE: ::HRESULT = AUDCLNT_ERR!(0x006); +pub const AUDCLNT_E_OUT_OF_ORDER: ::HRESULT = AUDCLNT_ERR!(0x007); +pub const AUDCLNT_E_UNSUPPORTED_FORMAT: ::HRESULT = AUDCLNT_ERR!(0x008); +pub const AUDCLNT_E_INVALID_SIZE: ::HRESULT = AUDCLNT_ERR!(0x009); +pub const AUDCLNT_E_DEVICE_IN_USE: ::HRESULT = AUDCLNT_ERR!(0x00a); +pub const AUDCLNT_E_BUFFER_OPERATION_PENDING: ::HRESULT = AUDCLNT_ERR!(0x00b); +pub const AUDCLNT_E_THREAD_NOT_REGISTERED: ::HRESULT = AUDCLNT_ERR!(0x00c); +pub const AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED: ::HRESULT = AUDCLNT_ERR!(0x00e); +pub const AUDCLNT_E_ENDPOINT_CREATE_FAILED: ::HRESULT = AUDCLNT_ERR!(0x00f); +pub const AUDCLNT_E_SERVICE_NOT_RUNNING: ::HRESULT = AUDCLNT_ERR!(0x010); +pub const AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED: ::HRESULT = AUDCLNT_ERR!(0x011); +pub const AUDCLNT_E_EXCLUSIVE_MODE_ONLY: ::HRESULT = AUDCLNT_ERR!(0x012); +pub const AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL: ::HRESULT = AUDCLNT_ERR!(0x013); +pub const AUDCLNT_E_EVENTHANDLE_NOT_SET: ::HRESULT = AUDCLNT_ERR!(0x014); +pub const AUDCLNT_E_INCORRECT_BUFFER_SIZE: ::HRESULT = AUDCLNT_ERR!(0x015); +pub const AUDCLNT_E_BUFFER_SIZE_ERROR: ::HRESULT = AUDCLNT_ERR!(0x016); +pub const AUDCLNT_E_CPUUSAGE_EXCEEDED: ::HRESULT = AUDCLNT_ERR!(0x017); +pub const AUDCLNT_E_BUFFER_ERROR: ::HRESULT = AUDCLNT_ERR!(0x018); +pub const AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED: ::HRESULT = AUDCLNT_ERR!(0x019); +pub const AUDCLNT_E_INVALID_DEVICE_PERIOD: ::HRESULT = AUDCLNT_ERR!(0x020); +pub const AUDCLNT_E_INVALID_STREAM_FLAG: ::HRESULT = AUDCLNT_ERR!(0x021); +pub const AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE: ::HRESULT = AUDCLNT_ERR!(0x022); +pub const AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES: ::HRESULT = AUDCLNT_ERR!(0x023); +pub const AUDCLNT_E_OFFLOAD_MODE_ONLY: ::HRESULT = AUDCLNT_ERR!(0x024); +pub const AUDCLNT_E_NONOFFLOAD_MODE_ONLY: ::HRESULT = AUDCLNT_ERR!(0x025); +pub const AUDCLNT_E_RESOURCES_INVALIDATED: ::HRESULT = AUDCLNT_ERR!(0x026); +pub const AUDCLNT_E_RAW_MODE_UNSUPPORTED: ::HRESULT = AUDCLNT_ERR!(0x027); +pub const AUDCLNT_S_BUFFER_EMPTY: ::SCODE = AUDCLNT_SUCCESS!(0x001); +pub const AUDCLNT_S_THREAD_ALREADY_REGISTERED: ::SCODE = AUDCLNT_SUCCESS!(0x002); +pub const AUDCLNT_S_POSITION_STALLED: ::SCODE = AUDCLNT_SUCCESS!(0x003); +DEFINE_GUID!(IID_IAudioClient, 0x1CB9AD4C, 0xDBFA, 0x4c32, + 0xB1, 0x78, 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2); +DEFINE_GUID!(IID_IAudioRenderClient, 0xF294ACFC, 0x3146, 0x4483, + 0xA7, 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2); +RIDL!{interface IAudioClient(IAudioClientVtbl): IUnknown(IUnknownVtbl) { + fn Initialize( + &mut self, ShareMode: ::AUDCLNT_SHAREMODE, StreamFlags: ::DWORD, + hnsBufferDuration: ::REFERENCE_TIME, hnsPeriodicity: ::REFERENCE_TIME, + pFormat: *const ::WAVEFORMATEX, AudioSessionGuid: ::LPCGUID + ) -> ::HRESULT, + fn GetBufferSize(&mut self, pNumBufferFrames: *mut ::UINT32) -> ::HRESULT, + fn GetStreamLatency(&mut self, phnsLatency: *mut ::REFERENCE_TIME) -> ::HRESULT, + fn GetCurrentPadding(&mut self, pNumPaddingFrames: *mut ::UINT32) -> ::HRESULT, + fn IsFormatSupported( + &mut self, ShareMode: ::AUDCLNT_SHAREMODE, pFormat: *const ::WAVEFORMATEX, + ppClosestMatch: *mut *mut ::WAVEFORMATEX + ) -> ::HRESULT, + fn GetMixFormat(&mut self, ppDeviceFormat: *mut *mut ::WAVEFORMATEX) -> ::HRESULT, + fn GetDevicePeriod( + &mut self, phnsDefaultDevicePeriod: *mut ::REFERENCE_TIME, + phnsMinimumDevicePeriod: *mut ::REFERENCE_TIME + ) -> ::HRESULT, + fn Start(&mut self) -> ::HRESULT, + fn Stop(&mut self) -> ::HRESULT, + fn Reset(&mut self) -> ::HRESULT, + fn SetEventHandle(&mut self, eventHandle: ::HANDLE) -> ::HRESULT, + fn GetService(&mut self, riid: ::REFIID, ppv: *mut ::LPVOID) -> ::HRESULT +}} +RIDL!{interface IAudioRenderClient(IAudioRenderClientVtbl): IUnknown(IUnknownVtbl) { + fn GetBuffer(&mut self, NumFramesRequested: ::UINT32, ppData: *mut *mut ::BYTE) -> ::HRESULT, + fn ReleaseBuffer(&mut self, NumFramesWritten: ::UINT32, dwFlags: ::DWORD) -> ::HRESULT +}} diff --git a/third_party/rust/winapi/src/audiosessiontypes.rs b/third_party/rust/winapi/src/audiosessiontypes.rs new file mode 100644 index 000000000000..796f17f28649 --- /dev/null +++ b/third_party/rust/winapi/src/audiosessiontypes.rs @@ -0,0 +1,11 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +ENUM!{enum AUDCLNT_SHAREMODE { + AUDCLNT_SHAREMODE_SHARED, + AUDCLNT_SHAREMODE_EXCLUSIVE, +}} +pub const AUDCLNT_STREAMFLAGS_CROSSPROCESS: ::DWORD = 0x00010000; +pub const AUDCLNT_STREAMFLAGS_LOOPBACK: ::DWORD = 0x00020000; +pub const AUDCLNT_STREAMFLAGS_EVENTCALLBACK: ::DWORD = 0x00040000; +pub const AUDCLNT_STREAMFLAGS_NOPERSIST: ::DWORD = 0x00080000; +pub const AUDCLNT_STREAMFLAGS_RATEADJUST: ::DWORD = 0x00100000; diff --git a/third_party/rust/winapi/src/basetsd.rs b/third_party/rust/winapi/src/basetsd.rs new file mode 100644 index 000000000000..6bf20fc96d61 --- /dev/null +++ b/third_party/rust/winapi/src/basetsd.rs @@ -0,0 +1,99 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Type definitions for the basic sized types. +#[cfg(target_arch = "x86")] +pub type POINTER_64_INT = ::c_ulong; +#[cfg(target_arch = "x86_64")] +pub type POINTER_64_INT = ::__uint64; +pub type INT8 = ::c_schar; +pub type PINT8 = *mut ::c_schar; +pub type INT16 = ::c_short; +pub type PINT16 = *mut ::c_short; +pub type INT32 = ::c_int; +pub type PINT32 = *mut ::c_int; +pub type INT64 = ::__int64; +pub type PINT64 = *mut ::__int64; +pub type UINT8 = ::c_uchar; +pub type PUINT8 = *mut ::c_uchar; +pub type UINT16 = ::c_ushort; +pub type PUINT16 = *mut ::c_ushort; +pub type UINT32 = ::c_uint; +pub type PUINT32 = *mut ::c_uint; +pub type UINT64 = ::__uint64; +pub type PUINT64 = *mut ::__uint64; +pub type LONG32 = ::c_int; +pub type PLONG32 = *mut ::c_int; +pub type ULONG32 = ::c_uint; +pub type PULONG32 = *mut ::c_uint; +pub type DWORD32 = ::c_uint; +pub type PDWORD32 = *mut ::c_uint; +#[cfg(target_arch = "x86")] +pub type INT_PTR = ::c_int; +#[cfg(target_arch = "x86_64")] +pub type INT_PTR = ::__int64; +#[cfg(target_arch = "x86")] +pub type PINT_PTR = *mut ::c_int; +#[cfg(target_arch = "x86_64")] +pub type PINT_PTR = *mut ::__int64; +#[cfg(target_arch = "x86")] +pub type UINT_PTR = ::c_uint; +#[cfg(target_arch = "x86_64")] +pub type UINT_PTR = ::__uint64; +#[cfg(target_arch = "x86")] +pub type PUINT_PTR = *mut ::c_uint; +#[cfg(target_arch = "x86_64")] +pub type PUINT_PTR = *mut ::__uint64; +#[cfg(target_arch = "x86")] +pub type LONG_PTR = ::c_long; +#[cfg(target_arch = "x86_64")] +pub type LONG_PTR = ::__int64; +#[cfg(target_arch = "x86")] +pub type PLONG_PTR = *mut ::c_long; +#[cfg(target_arch = "x86_64")] +pub type PLONG_PTR = *mut ::__int64; +#[cfg(target_arch = "x86")] +pub type ULONG_PTR = ::c_ulong; +#[cfg(target_arch = "x86_64")] +pub type ULONG_PTR = ::__uint64; +#[cfg(target_arch = "x86")] +pub type PULONG_PTR = *mut ::c_ulong; +#[cfg(target_arch = "x86_64")] +pub type PULONG_PTR = *mut ::__uint64; +#[cfg(target_arch = "x86_64")] +pub type SHANDLE_PTR = ::__int64; +#[cfg(target_arch = "x86_64")] +pub type HANDLE_PTR = ::__uint64; +#[cfg(target_arch = "x86_64")] +pub type UHALF_PTR = ::c_uint; +#[cfg(target_arch = "x86_64")] +pub type PUHALF_PTR = *mut ::c_uint; +#[cfg(target_arch = "x86_64")] +pub type HALF_PTR = ::c_int; +#[cfg(target_arch = "x86_64")] +pub type PHALF_PTR = *mut ::c_int; +#[cfg(target_arch = "x86")] +pub type SHANDLE_PTR = ::c_long; +#[cfg(target_arch = "x86")] +pub type HANDLE_PTR = ::c_ulong; +#[cfg(target_arch = "x86")] +pub type UHALF_PTR = ::c_ushort; +#[cfg(target_arch = "x86")] +pub type PUHALF_PTR = *mut ::c_ushort; +#[cfg(target_arch = "x86")] +pub type HALF_PTR = ::c_short; +#[cfg(target_arch = "x86")] +pub type PHALF_PTR = *mut ::c_short; +pub type SIZE_T = ULONG_PTR; +pub type PSIZE_T = *mut ULONG_PTR; +pub type SSIZE_T = LONG_PTR; +pub type PSSIZE_T = *mut LONG_PTR; +pub type DWORD_PTR = ULONG_PTR; +pub type PDWORD_PTR = *mut ULONG_PTR; +pub type LONG64 = ::__int64; +pub type PLONG64 = *mut ::__int64; +pub type ULONG64 = ::__uint64; +pub type PULONG64 = *mut ::__uint64; +pub type DWORD64 = ::__uint64; +pub type PDWORD64 = *mut ::__uint64; +pub type KAFFINITY = ULONG_PTR; +pub type PKAFFINITY = *mut KAFFINITY; diff --git a/third_party/rust/winapi/src/bcrypt.rs b/third_party/rust/winapi/src/bcrypt.rs new file mode 100644 index 000000000000..ee818a5bd062 --- /dev/null +++ b/third_party/rust/winapi/src/bcrypt.rs @@ -0,0 +1,356 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Cryptographic Primitive API Prototypes and Definitions +pub const KDF_HASH_ALGORITHM: ::ULONG = 0x0; +pub const KDF_SECRET_PREPEND: ::ULONG = 0x1; +pub const KDF_SECRET_APPEND: ::ULONG = 0x2; +pub const KDF_HMAC_KEY: ::ULONG = 0x3; +pub const KDF_TLS_PRF_LABEL: ::ULONG = 0x4; +pub const KDF_TLS_PRF_SEED: ::ULONG = 0x5; +pub const KDF_SECRET_HANDLE: ::ULONG = 0x6; +pub const KDF_TLS_PRF_PROTOCOL: ::ULONG = 0x7; +pub const KDF_ALGORITHMID: ::ULONG = 0x8; +pub const KDF_PARTYUINFO: ::ULONG = 0x9; +pub const KDF_PARTYVINFO: ::ULONG = 0xA; +pub const KDF_SUPPPUBINFO: ::ULONG = 0xB; +pub const KDF_SUPPPRIVINFO: ::ULONG = 0xC; +pub const KDF_LABEL: ::ULONG = 0xD; +pub const KDF_CONTEXT: ::ULONG = 0xE; +pub const KDF_SALT: ::ULONG = 0xF; +pub const KDF_ITERATION_COUNT: ::ULONG = 0x10; +pub const KDF_GENERIC_PARAMETER: ::ULONG = 0x11; +pub const KDF_KEYBITLENGTH: ::ULONG = 0x12; +pub const KDF_USE_SECRET_AS_HMAC_KEY_FLAG: ::ULONG = 0x1; +STRUCT!{struct BCRYPT_KEY_LENGTHS_STRUCT { + dwMinLength: ::ULONG, + dwMaxLength: ::ULONG, + dwIncrement: ::ULONG, +}} +pub type BCRYPT_AUTH_TAG_LENGTHS_STRUCT = BCRYPT_KEY_LENGTHS_STRUCT; +STRUCT!{struct BCRYPT_OID { + cbOID: ::ULONG, + pbOID: ::PUCHAR, +}} +STRUCT!{struct BCRYPT_OID_LIST { + dwOIDCount: ::ULONG, + pOIDs: *mut BCRYPT_OID, +}} +STRUCT!{struct BCRYPT_PKCS1_PADDING_INFO { + pszAlgId: ::LPCWSTR, +}} +STRUCT!{struct BCRYPT_PSS_PADDING_INFO { + pszAlgId: ::LPCWSTR, + cbSalt: ::ULONG, +}} +STRUCT!{struct BCRYPT_OAEP_PADDING_INFO { + pszAlgId: ::LPCWSTR, + pbLabel: ::PUCHAR, + cbLabel: ::ULONG, +}} +pub const BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION: ::ULONG = 1; +pub const BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG: ::ULONG = 0x00000001; +pub const BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG: ::ULONG = 0x00000002; +STRUCT!{struct BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO { + cbSize: ::ULONG, + dwInfoVersion: ::ULONG, + pbNonce: ::PUCHAR, + cbNonce: ::ULONG, + pbAuthData: ::PUCHAR, + cbAuthData: ::ULONG, + pbTag: ::PUCHAR, + cbTag: ::ULONG, + pbMacContext: ::PUCHAR, + cbMacContext: ::ULONG, + cbAAD: ::ULONG, + cbData: ::ULONGLONG, + dwFlags: ::ULONG, +}} +pub type PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO = *mut BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO; +pub const BCRYPT_PROV_DISPATCH: ::ULONG = 0x00000001; +pub const BCRYPT_BLOCK_PADDING: ::ULONG = 0x00000001; +pub const BCRYPT_PAD_NONE: ::ULONG = 0x00000001; +pub const BCRYPT_PAD_PKCS1: ::ULONG = 0x00000002; +pub const BCRYPT_PAD_OAEP: ::ULONG = 0x00000004; +pub const BCRYPT_PAD_PSS: ::ULONG = 0x00000008; +pub const BCRYPT_PAD_PKCS1_OPTIONAL_HASH_OID: ::ULONG = 0x00000010; +pub const BCRYPTBUFFER_VERSION: ::ULONG = 0; +STRUCT!{struct BCryptBuffer { + cbBuffer: ::ULONG, + BufferType: ::ULONG, + pvBuffer: ::PVOID, +}} +pub type PBCryptBuffer = *mut BCryptBuffer; +STRUCT!{struct BCryptBufferDesc { + ulVersion: ::ULONG, + cBuffers: ::ULONG, + pBuffers: PBCryptBuffer, +}} +pub type PBCryptBufferDesc = *mut BCryptBufferDesc; +//321 +pub type BCRYPT_HANDLE = ::PVOID; +pub type BCRYPT_ALG_HANDLE = ::PVOID; +pub type BCRYPT_KEY_HANDLE = ::PVOID; +pub type BCRYPT_HASH_HANDLE = ::PVOID; +pub type BCRYPT_SECRET_HANDLE = ::PVOID; +STRUCT!{struct BCRYPT_KEY_BLOB { + Magic: ::ULONG, +}} +pub const BCRYPT_RSAPUBLIC_MAGIC: ::ULONG = 0x31415352; +pub const BCRYPT_RSAPRIVATE_MAGIC: ::ULONG = 0x32415352; +STRUCT!{struct BCRYPT_RSAKEY_BLOB { + Magic: ::ULONG, + BitLength: ::ULONG, + cbPublicExp: ::ULONG, + cbModulus: ::ULONG, + cbPrime1: ::ULONG, + cbPrime2: ::ULONG, +}} +pub const BCRYPT_RSAFULLPRIVATE_MAGIC: ::ULONG = 0x33415352; +pub const BCRYPT_ECDH_PUBLIC_P256_MAGIC: ::ULONG = 0x314B4345; +pub const BCRYPT_ECDH_PRIVATE_P256_MAGIC: ::ULONG = 0x324B4345; +pub const BCRYPT_ECDH_PUBLIC_P384_MAGIC: ::ULONG = 0x334B4345; +pub const BCRYPT_ECDH_PRIVATE_P384_MAGIC: ::ULONG = 0x344B4345; +pub const BCRYPT_ECDH_PUBLIC_P521_MAGIC: ::ULONG = 0x354B4345; +pub const BCRYPT_ECDH_PRIVATE_P521_MAGIC: ::ULONG = 0x364B4345; +pub const BCRYPT_ECDSA_PUBLIC_P256_MAGIC: ::ULONG = 0x31534345; +pub const BCRYPT_ECDSA_PRIVATE_P256_MAGIC: ::ULONG = 0x32534345; +pub const BCRYPT_ECDSA_PUBLIC_P384_MAGIC: ::ULONG = 0x33534345; +pub const BCRYPT_ECDSA_PRIVATE_P384_MAGIC: ::ULONG = 0x34534345; +pub const BCRYPT_ECDSA_PUBLIC_P521_MAGIC: ::ULONG = 0x35534345; +pub const BCRYPT_ECDSA_PRIVATE_P521_MAGIC: ::ULONG = 0x36534345; +STRUCT!{struct BCRYPT_ECCKEY_BLOB { + dwMagic: ::ULONG, + cbKey: ::ULONG, +}} +pub type PBCRYPT_ECCKEY_BLOB = *mut BCRYPT_ECCKEY_BLOB; +pub const BCRYPT_DH_PUBLIC_MAGIC: ::ULONG = 0x42504844; +pub const BCRYPT_DH_PRIVATE_MAGIC: ::ULONG = 0x56504844; +STRUCT!{struct BCRYPT_DH_KEY_BLOB { + dwMagic: ::ULONG, + cbKey: ::ULONG, +}} +pub type PBCRYPT_DH_KEY_BLOB = *mut BCRYPT_DH_KEY_BLOB; +pub const BCRYPT_DH_PARAMETERS_MAGIC: ::ULONG = 0x4d504844; +STRUCT!{struct BCRYPT_DH_PARAMETER_HEADER { + cbLength: ::ULONG, + dwMagic: ::ULONG, + cbKeyLength: ::ULONG, +}} +pub const BCRYPT_DSA_PUBLIC_MAGIC: ::ULONG = 0x42505344; +pub const BCRYPT_DSA_PRIVATE_MAGIC: ::ULONG = 0x56505344; +pub const BCRYPT_DSA_PUBLIC_MAGIC_V2: ::ULONG = 0x32425044; +pub const BCRYPT_DSA_PRIVATE_MAGIC_V2: ::ULONG = 0x32565044; +STRUCT!{struct BCRYPT_DSA_KEY_BLOB { + dwMagic: ::ULONG, + cbKey: ::ULONG, + Count: [::UCHAR; 4], + Seed: [::UCHAR; 20], + q: [::UCHAR; 20], +}} +pub type PBCRYPT_DSA_KEY_BLOB = *mut BCRYPT_DSA_KEY_BLOB; +ENUM!{enum HASHALGORITHM_ENUM { + DSA_HASH_ALGORITHM_SHA1, + DSA_HASH_ALGORITHM_SHA256, + DSA_HASH_ALGORITHM_SHA512, +}} +ENUM!{enum DSAFIPSVERSION_ENUM { + DSA_FIPS186_2, + DSA_FIPS186_3, +}} +STRUCT!{struct BCRYPT_DSA_KEY_BLOB_V2 { + dwMagic: ::ULONG, + cbKey: ::ULONG, + hashAlgorithm: HASHALGORITHM_ENUM, + standardVersion: DSAFIPSVERSION_ENUM, + cbSeedLength: ::ULONG, + cbGroupSize: ::ULONG, + Count: [::UCHAR; 4], +}} +pub type PBCRYPT_DSA_KEY_BLOB_V2 = *mut BCRYPT_DSA_KEY_BLOB_V2; +STRUCT!{struct BCRYPT_KEY_DATA_BLOB_HEADER { + dwMagic: ::ULONG, + dwVersion: ::ULONG, + cbKeyData: ::ULONG, +}} +pub type PBCRYPT_KEY_DATA_BLOB_HEADER = *mut BCRYPT_KEY_DATA_BLOB_HEADER; +pub const BCRYPT_KEY_DATA_BLOB_MAGIC: ::ULONG = 0x4d42444b; +pub const BCRYPT_KEY_DATA_BLOB_VERSION1: ::ULONG = 0x1; +pub const BCRYPT_DSA_PARAMETERS_MAGIC: ::ULONG = 0x4d505344; +pub const BCRYPT_DSA_PARAMETERS_MAGIC_V2: ::ULONG = 0x324d5044; +STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER { + cbLength: ::ULONG, + dwMagic: ::ULONG, + cbKeyLength: ::ULONG, + Count: [::UCHAR; 4], + Seed: [::UCHAR; 20], + q: [::UCHAR; 20], +}} +STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER_V2 { + cbLength: ::ULONG, + dwMagic: ::ULONG, + cbKeyLength: ::ULONG, + hashAlgorithm: HASHALGORITHM_ENUM, + standardVersion: DSAFIPSVERSION_ENUM, + cbSeedLength: ::ULONG, + cbGroupSize: ::ULONG, + Count: [::UCHAR; 4], +}} +ENUM!{enum BCRYPT_HASH_OPERATION_TYPE { + BCRYPT_HASH_OPERATION_HASH_DATA = 1, + BCRYPT_HASH_OPERATION_FINISH_HASH = 2, +}} +STRUCT!{struct BCRYPT_MULTI_HASH_OPERATION { + iHash: ::ULONG, + hashOperation: BCRYPT_HASH_OPERATION_TYPE, + pbBuffer: ::PUCHAR, + cbBuffer: ::ULONG, +}} +ENUM!{enum BCRYPT_MULTI_OPERATION_TYPE { + BCRYPT_OPERATION_TYPE_HASH = 1, +}} +STRUCT!{struct BCRYPT_MULTI_OBJECT_LENGTH_STRUCT { + cbPerObject: ::ULONG, + cbPerElement: ::ULONG, +}} +pub const BCRYPT_CIPHER_INTERFACE: ::ULONG = 0x00000001; +pub const BCRYPT_HASH_INTERFACE: ::ULONG = 0x00000002; +pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE: ::ULONG = 0x00000003; +pub const BCRYPT_SECRET_AGREEMENT_INTERFACE: ::ULONG = 0x00000004; +pub const BCRYPT_SIGNATURE_INTERFACE: ::ULONG = 0x00000005; +pub const BCRYPT_RNG_INTERFACE: ::ULONG = 0x00000006; +pub const BCRYPT_KEY_DERIVATION_INTERFACE: ::ULONG = 0x00000007; +pub const BCRYPT_ALG_HANDLE_HMAC_FLAG: ::ULONG = 0x00000008; +pub const BCRYPT_CAPI_AES_FLAG: ::ULONG = 0x00000010; +pub const BCRYPT_HASH_REUSABLE_FLAG: ::ULONG = 0x00000020; +pub const BCRYPT_BUFFERS_LOCKED_FLAG: ::ULONG = 0x00000040; +pub const BCRYPT_EXTENDED_KEYSIZE: ::ULONG = 0x00000080; +pub const BCRYPT_CIPHER_OPERATION: ::ULONG = 0x00000001; +pub const BCRYPT_HASH_OPERATION: ::ULONG = 0x00000002; +pub const BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION: ::ULONG = 0x00000004; +pub const BCRYPT_SECRET_AGREEMENT_OPERATION: ::ULONG = 0x00000008; +pub const BCRYPT_SIGNATURE_OPERATION: ::ULONG = 0x00000010; +pub const BCRYPT_RNG_OPERATION: ::ULONG = 0x00000020; +pub const BCRYPT_KEY_DERIVATION_OPERATION: ::ULONG = 0x00000040; +STRUCT!{struct BCRYPT_ALGORITHM_IDENTIFIER { + pszName: ::LPWSTR, + dwClass: ::ULONG, + dwFlags: ::ULONG, +}} +STRUCT!{struct BCRYPT_PROVIDER_NAME { + pszProviderName: ::LPWSTR, +}} +pub const BCRYPT_PUBLIC_KEY_FLAG: ::ULONG = 0x00000001; +pub const BCRYPT_PRIVATE_KEY_FLAG: ::ULONG = 0x00000002; +pub const BCRYPT_RNG_USE_ENTROPY_IN_BUFFER: ::ULONG = 0x00000001; +pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: ::ULONG = 0x00000002; +STRUCT!{struct BCRYPT_INTERFACE_VERSION { + MajorVersion: ::USHORT, + MinorVersion: ::USHORT, +}} +pub type PBCRYPT_INTERFACE_VERSION = *mut BCRYPT_INTERFACE_VERSION; +pub const BCRYPT_CIPHER_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_HASH_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_HASH_INTERFACE_MAJORVERSION_2: ::USHORT = 2; +pub const BCRYPT_HASH_INTERFACE_VERSION_2: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(BCRYPT_HASH_INTERFACE_MAJORVERSION_2, 0); +pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_SECRET_AGREEMENT_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_SIGNATURE_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_RNG_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const CRYPT_MIN_DEPENDENCIES: ::ULONG = 0x00000001; +pub const CRYPT_PROCESS_ISOLATE: ::ULONG = 0x00010000; +pub const CRYPT_UM: ::ULONG = 0x00000001; +pub const CRYPT_KM: ::ULONG = 0x00000002; +pub const CRYPT_MM: ::ULONG = 0x00000003; +pub const CRYPT_ANY: ::ULONG = 0x00000004; +pub const CRYPT_OVERWRITE: ::ULONG = 0x00000001; +pub const CRYPT_LOCAL: ::ULONG = 0x00000001; +pub const CRYPT_DOMAIN: ::ULONG = 0x00000002; +pub const CRYPT_EXCLUSIVE: ::ULONG = 0x00000001; +pub const CRYPT_OVERRIDE: ::ULONG = 0x00010000; +pub const CRYPT_ALL_FUNCTIONS: ::ULONG = 0x00000001; +pub const CRYPT_ALL_PROVIDERS: ::ULONG = 0x00000002; +pub const CRYPT_PRIORITY_TOP: ::ULONG = 0x00000000; +pub const CRYPT_PRIORITY_BOTTOM: ::ULONG = 0xFFFFFFFF; +STRUCT!{struct CRYPT_INTERFACE_REG { + dwInterface: ::ULONG, + dwFlags: ::ULONG, + cFunctions: ::ULONG, + rgpszFunctions: *mut ::PWSTR, +}} +pub type PCRYPT_INTERFACE_REG = *mut CRYPT_INTERFACE_REG; +STRUCT!{struct CRYPT_IMAGE_REG { + pszImage: ::PWSTR, + cInterfaces: ::ULONG, + rgpInterfaces: *mut PCRYPT_INTERFACE_REG, +}} +pub type PCRYPT_IMAGE_REG = *mut CRYPT_IMAGE_REG; +STRUCT!{struct CRYPT_PROVIDER_REG { + cAliases: ::ULONG, + rgpszAliases: *mut ::PWSTR, + pUM: PCRYPT_IMAGE_REG, + pKM: PCRYPT_IMAGE_REG, +}} +pub type PCRYPT_PROVIDER_REG = *mut CRYPT_PROVIDER_REG; +STRUCT!{struct CRYPT_PROVIDERS { + cProviders: ::ULONG, + rgpszProviders: *mut ::PWSTR, +}} +pub type PCRYPT_PROVIDERS = *mut CRYPT_PROVIDERS; +STRUCT!{struct CRYPT_CONTEXT_CONFIG { + dwFlags: ::ULONG, + dwReserved: ::ULONG, +}} +pub type PCRYPT_CONTEXT_CONFIG = *mut CRYPT_CONTEXT_CONFIG; +STRUCT!{struct CRYPT_CONTEXT_FUNCTION_CONFIG { + dwFlags: ::ULONG, + dwReserved: ::ULONG, +}} +pub type PCRYPT_CONTEXT_FUNCTION_CONFIG = *mut CRYPT_CONTEXT_FUNCTION_CONFIG; +STRUCT!{struct CRYPT_CONTEXTS { + cContexts: ::ULONG, + rgpszContexts: *mut ::PWSTR, +}} +pub type PCRYPT_CONTEXTS = *mut CRYPT_CONTEXTS; +STRUCT!{struct CRYPT_CONTEXT_FUNCTIONS { + cFunctions: ::ULONG, + rgpszFunctions: *mut ::PWSTR, +}} +pub type PCRYPT_CONTEXT_FUNCTIONS = *mut CRYPT_CONTEXT_FUNCTIONS; +STRUCT!{struct CRYPT_CONTEXT_FUNCTION_PROVIDERS { + cProviders: ::ULONG, + rgpszProviders: *mut ::PWSTR, +}} +pub type PCRYPT_CONTEXT_FUNCTION_PROVIDERS = *mut CRYPT_CONTEXT_FUNCTION_PROVIDERS; +STRUCT!{struct CRYPT_PROPERTY_REF { + pszProperty: ::PWSTR, + cbValue: ::ULONG, + pbValue: ::PUCHAR, +}} +pub type PCRYPT_PROPERTY_REF = *mut CRYPT_PROPERTY_REF; +STRUCT!{struct CRYPT_IMAGE_REF { + pszImage: ::PWSTR, + dwFlags: ::ULONG, +}} +pub type PCRYPT_IMAGE_REF = *mut CRYPT_IMAGE_REF; +STRUCT!{struct CRYPT_PROVIDER_REF { + dwInterface: ::ULONG, + pszFunction: ::PWSTR, + pszProvider: ::PWSTR, + cProperties: ::ULONG, + rgpProperties: *mut PCRYPT_PROPERTY_REF, + pUM: PCRYPT_IMAGE_REF, + pKM: PCRYPT_IMAGE_REF, +}} +pub type PCRYPT_PROVIDER_REF = *mut CRYPT_PROVIDER_REF; +STRUCT!{struct CRYPT_PROVIDER_REFS { + cProviders: ::ULONG, + rgpProviders: *mut PCRYPT_PROVIDER_REF, +}} +pub type PCRYPT_PROVIDER_REFS = *mut CRYPT_PROVIDER_REFS; diff --git a/third_party/rust/winapi/src/cfg.rs b/third_party/rust/winapi/src/cfg.rs new file mode 100644 index 000000000000..0720d32472fa --- /dev/null +++ b/third_party/rust/winapi/src/cfg.rs @@ -0,0 +1,134 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! common Configuration Manager definitions for both user mode and kernel mode code +ENUM!{enum PNP_VETO_TYPE { + PNP_VetoTypeUnknown, + PNP_VetoLegacyDevice, + PNP_VetoPendingClose, + PNP_VetoWindowsApp, + PNP_VetoWindowsService, + PNP_VetoOutstandingOpen, + PNP_VetoDevice, + PNP_VetoDriver, + PNP_VetoIllegalDeviceRequest, + PNP_VetoInsufficientPower, + PNP_VetoNonDisableable, + PNP_VetoLegacyDriver, + PNP_VetoInsufficientRights, +}} +pub type PPNP_VETO_TYPE = *mut PNP_VETO_TYPE; +pub const CM_PROB_NOT_CONFIGURED: ::CONFIGRET = 0x00000001; +pub const CM_PROB_DEVLOADER_FAILED: ::CONFIGRET = 0x00000002; +pub const CM_PROB_OUT_OF_MEMORY: ::CONFIGRET = 0x00000003; +pub const CM_PROB_ENTRY_IS_WRONG_TYPE: ::CONFIGRET = 0x00000004; +pub const CM_PROB_LACKED_ARBITRATOR: ::CONFIGRET = 0x00000005; +pub const CM_PROB_BOOT_CONFIG_CONFLICT: ::CONFIGRET = 0x00000006; +pub const CM_PROB_FAILED_FILTER: ::CONFIGRET = 0x00000007; +pub const CM_PROB_DEVLOADER_NOT_FOUND: ::CONFIGRET = 0x00000008; +pub const CM_PROB_INVALID_DATA: ::CONFIGRET = 0x00000009; +pub const CM_PROB_FAILED_START: ::CONFIGRET = 0x0000000A; +pub const CM_PROB_LIAR: ::CONFIGRET = 0x0000000B; +pub const CM_PROB_NORMAL_CONFLICT: ::CONFIGRET = 0x0000000C; +pub const CM_PROB_NOT_VERIFIED: ::CONFIGRET = 0x0000000D; +pub const CM_PROB_NEED_RESTART: ::CONFIGRET = 0x0000000E; +pub const CM_PROB_REENUMERATION: ::CONFIGRET = 0x0000000F; +pub const CM_PROB_PARTIAL_LOG_CONF: ::CONFIGRET = 0x00000010; +pub const CM_PROB_UNKNOWN_RESOURCE: ::CONFIGRET = 0x00000011; +pub const CM_PROB_REINSTALL: ::CONFIGRET = 0x00000012; +pub const CM_PROB_REGISTRY: ::CONFIGRET = 0x00000013; +pub const CM_PROB_VXDLDR: ::CONFIGRET = 0x00000014; +pub const CM_PROB_WILL_BE_REMOVED: ::CONFIGRET = 0x00000015; +pub const CM_PROB_DISABLED: ::CONFIGRET = 0x00000016; +pub const CM_PROB_DEVLOADER_NOT_READY: ::CONFIGRET = 0x00000017; +pub const CM_PROB_DEVICE_NOT_THERE: ::CONFIGRET = 0x00000018; +pub const CM_PROB_MOVED: ::CONFIGRET = 0x00000019; +pub const CM_PROB_TOO_EARLY: ::CONFIGRET = 0x0000001A; +pub const CM_PROB_NO_VALID_LOG_CONF: ::CONFIGRET = 0x0000001B; +pub const CM_PROB_FAILED_INSTALL: ::CONFIGRET = 0x0000001C; +pub const CM_PROB_HARDWARE_DISABLED: ::CONFIGRET = 0x0000001D; +pub const CM_PROB_CANT_SHARE_IRQ: ::CONFIGRET = 0x0000001E; +pub const CM_PROB_FAILED_ADD: ::CONFIGRET = 0x0000001F; +pub const CM_PROB_DISABLED_SERVICE: ::CONFIGRET = 0x00000020; +pub const CM_PROB_TRANSLATION_FAILED: ::CONFIGRET = 0x00000021; +pub const CM_PROB_NO_SOFTCONFIG: ::CONFIGRET = 0x00000022; +pub const CM_PROB_BIOS_TABLE: ::CONFIGRET = 0x00000023; +pub const CM_PROB_IRQ_TRANSLATION_FAILED: ::CONFIGRET = 0x00000024; +pub const CM_PROB_FAILED_DRIVER_ENTRY: ::CONFIGRET = 0x00000025; +pub const CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD: ::CONFIGRET = 0x00000026; +pub const CM_PROB_DRIVER_FAILED_LOAD: ::CONFIGRET = 0x00000027; +pub const CM_PROB_DRIVER_SERVICE_KEY_INVALID: ::CONFIGRET = 0x00000028; +pub const CM_PROB_LEGACY_SERVICE_NO_DEVICES: ::CONFIGRET = 0x00000029; +pub const CM_PROB_DUPLICATE_DEVICE: ::CONFIGRET = 0x0000002A; +pub const CM_PROB_FAILED_POST_START: ::CONFIGRET = 0x0000002B; +pub const CM_PROB_HALTED: ::CONFIGRET = 0x0000002C; +pub const CM_PROB_PHANTOM: ::CONFIGRET = 0x0000002D; +pub const CM_PROB_SYSTEM_SHUTDOWN: ::CONFIGRET = 0x0000002E; +pub const CM_PROB_HELD_FOR_EJECT: ::CONFIGRET = 0x0000002F; +pub const CM_PROB_DRIVER_BLOCKED: ::CONFIGRET = 0x00000030; +pub const CM_PROB_REGISTRY_TOO_LARGE: ::CONFIGRET = 0x00000031; +pub const CM_PROB_SETPROPERTIES_FAILED: ::CONFIGRET = 0x00000032; +pub const CM_PROB_WAITING_ON_DEPENDENCY: ::CONFIGRET = 0x00000033; +pub const CM_PROB_UNSIGNED_DRIVER: ::CONFIGRET = 0x00000034; +pub const CM_PROB_USED_BY_DEBUGGER: ::CONFIGRET = 0x00000035; +pub const NUM_CM_PROB_V1: ::CONFIGRET = 0x00000025; +pub const NUM_CM_PROB_V2: ::CONFIGRET = 0x00000032; +pub const NUM_CM_PROB_V3: ::CONFIGRET = 0x00000033; +pub const NUM_CM_PROB_V4: ::CONFIGRET = 0x00000034; +pub const NUM_CM_PROB_V5: ::CONFIGRET = 0x00000035; +pub const NUM_CM_PROB_V6: ::CONFIGRET = 0x00000036; +pub const DN_ROOT_ENUMERATED: ::CONFIGRET = 0x00000001; +pub const DN_DRIVER_LOADED: ::CONFIGRET = 0x00000002; +pub const DN_ENUM_LOADED: ::CONFIGRET = 0x00000004; +pub const DN_STARTED: ::CONFIGRET = 0x00000008; +pub const DN_MANUAL: ::CONFIGRET = 0x00000010; +pub const DN_NEED_TO_ENUM: ::CONFIGRET = 0x00000020; +pub const DN_NOT_FIRST_TIME: ::CONFIGRET = 0x00000040; +pub const DN_HARDWARE_ENUM: ::CONFIGRET = 0x00000080; +pub const DN_LIAR: ::CONFIGRET = 0x00000100; +pub const DN_HAS_MARK: ::CONFIGRET = 0x00000200; +pub const DN_HAS_PROBLEM: ::CONFIGRET = 0x00000400; +pub const DN_FILTERED: ::CONFIGRET = 0x00000800; +pub const DN_MOVED: ::CONFIGRET = 0x00001000; +pub const DN_DISABLEABLE: ::CONFIGRET = 0x00002000; +pub const DN_REMOVABLE: ::CONFIGRET = 0x00004000; +pub const DN_PRIVATE_PROBLEM: ::CONFIGRET = 0x00008000; +pub const DN_MF_PARENT: ::CONFIGRET = 0x00010000; +pub const DN_MF_CHILD: ::CONFIGRET = 0x00020000; +pub const DN_WILL_BE_REMOVED: ::CONFIGRET = 0x00040000; +pub const DN_NOT_FIRST_TIMEE: ::CONFIGRET = 0x00080000; +pub const DN_STOP_FREE_RES: ::CONFIGRET = 0x00100000; +pub const DN_REBAL_CANDIDATE: ::CONFIGRET = 0x00200000; +pub const DN_BAD_PARTIAL: ::CONFIGRET = 0x00400000; +pub const DN_NT_ENUMERATOR: ::CONFIGRET = 0x00800000; +pub const DN_NT_DRIVER: ::CONFIGRET = 0x01000000; +pub const DN_NEEDS_LOCKING: ::CONFIGRET = 0x02000000; +pub const DN_ARM_WAKEUP: ::CONFIGRET = 0x04000000; +pub const DN_APM_ENUMERATOR: ::CONFIGRET = 0x08000000; +pub const DN_APM_DRIVER: ::CONFIGRET = 0x10000000; +pub const DN_SILENT_INSTALL: ::CONFIGRET = 0x20000000; +pub const DN_NO_SHOW_IN_DM: ::CONFIGRET = 0x40000000; +pub const DN_BOOT_LOG_PROB: ::CONFIGRET = 0x80000000; +pub const DN_NEED_RESTART: ::CONFIGRET = DN_LIAR; +pub const DN_DRIVER_BLOCKED: ::CONFIGRET = DN_NOT_FIRST_TIME; +pub const DN_LEGACY_DRIVER: ::CONFIGRET = DN_MOVED; +pub const DN_CHILD_WITH_INVALID_ID: ::CONFIGRET = DN_HAS_MARK; +pub const DN_DEVICE_DISCONNECTED: ::CONFIGRET = DN_NEEDS_LOCKING; +pub const DN_CHANGEABLE_FLAGS: ::CONFIGRET = DN_NOT_FIRST_TIME + DN_HARDWARE_ENUM + DN_HAS_MARK + + DN_DISABLEABLE + DN_REMOVABLE + DN_MF_CHILD + DN_MF_PARENT + DN_NOT_FIRST_TIMEE + + DN_STOP_FREE_RES + DN_REBAL_CANDIDATE + DN_NT_ENUMERATOR + DN_NT_DRIVER + DN_SILENT_INSTALL + + DN_NO_SHOW_IN_DM; +pub const LCPRI_FORCECONFIG: ::PRIORITY = 0x00000000; +pub const LCPRI_BOOTCONFIG: ::PRIORITY = 0x00000001; +pub const LCPRI_DESIRED: ::PRIORITY = 0x00002000; +pub const LCPRI_NORMAL: ::PRIORITY = 0x00003000; +pub const LCPRI_LASTBESTCONFIG: ::PRIORITY = 0x00003FFF; +pub const LCPRI_SUBOPTIMAL: ::PRIORITY = 0x00005000; +pub const LCPRI_LASTSOFTCONFIG: ::PRIORITY = 0x00007FFF; +pub const LCPRI_RESTART: ::PRIORITY = 0x00008000; +pub const LCPRI_REBOOT: ::PRIORITY = 0x00009000; +pub const LCPRI_POWEROFF: ::PRIORITY = 0x0000A000; +pub const LCPRI_HARDRECONFIG: ::PRIORITY = 0x0000C000; +pub const LCPRI_HARDWIRED: ::PRIORITY = 0x0000E000; +pub const LCPRI_IMPOSSIBLE: ::PRIORITY = 0x0000F000; +pub const LCPRI_DISABLED: ::PRIORITY = 0x0000FFFF; +pub const MAX_LCPRI: ::PRIORITY = 0x0000FFFF; diff --git a/third_party/rust/winapi/src/cfgmgr32.rs b/third_party/rust/winapi/src/cfgmgr32.rs new file mode 100644 index 000000000000..0305f1bd7fd1 --- /dev/null +++ b/third_party/rust/winapi/src/cfgmgr32.rs @@ -0,0 +1,758 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! user APIs for the Configuration Manager +pub type PCVOID = *const ::VOID; +pub const MAX_DEVICE_ID_LEN: usize = 200; +pub const MAX_DEVNODE_ID_LEN: usize = MAX_DEVICE_ID_LEN; +pub const MAX_GUID_STRING_LEN: usize = 39; +pub const MAX_CLASS_NAME_LEN: usize = 32; +pub const MAX_PROFILE_LEN: usize = 80; +pub const MAX_CONFIG_VALUE: ::DWORD = 9999; +pub const MAX_INSTANCE_VALUE: ::DWORD = 9999; +pub const MAX_MEM_REGISTERS: ::DWORD = 9; +pub const MAX_IO_PORTS: ::DWORD = 20; +pub const MAX_IRQS: ::DWORD = 7; +pub const MAX_DMA_CHANNELS: ::DWORD = 7; +pub const DWORD_MAX: ::DWORD = 0xffffffff; +pub const DWORDLONG_MAX: ::DWORDLONG = 0xffffffffffffffff; +pub const CONFIGMG_VERSION: ::DWORD = 0x0400; +pub type RETURN_TYPE = ::DWORD; +pub type CONFIGRET = RETURN_TYPE; +pub type DEVNODE = ::DWORD; +pub type DEVINST = ::DWORD; +pub type PDEVNODE = *mut DEVNODE; +pub type PDEVINST = *mut DEVNODE; +pub type DEVNODEID_A = *mut ::CHAR; +pub type DEVINSTID_A = *mut ::CHAR; +pub type DEVNODEID_W = *mut ::WCHAR; +pub type DEVINSTID_W = *mut ::WCHAR; +pub type LOG_CONF = ::DWORD_PTR; +pub type PLOG_CONF = *mut LOG_CONF; +pub type RES_DES = ::DWORD_PTR; +pub type PRES_DES = *mut RES_DES; +pub type RESOURCEID = ::ULONG; +pub type PRESOURCEID = *mut RESOURCEID; +pub type PRIORITY = ::ULONG; +pub type PPRIORITY = *mut PRIORITY; +pub type RANGE_LIST = ::DWORD_PTR; +pub type PRANGE_LIST = *mut RANGE_LIST; +pub type RANGE_ELEMENT = ::DWORD_PTR; +pub type PRANGE_ELEMENT = *mut RANGE_ELEMENT; +pub type HMACHINE = ::HANDLE; +pub type PHMACHINE = *mut HMACHINE; +pub type CONFLICT_LIST = ::ULONG_PTR; +pub type PCONFLICT_LIST = *mut CONFLICT_LIST; +STRUCT!{nodebug struct CONFLICT_DETAILS_A { + CD_ulSize: ::ULONG, + CD_ulMask: ::ULONG, + CD_dnDevInst: DEVINST, + CD_rdResDes: RES_DES, + CD_ulFlags: ::ULONG, + CD_szDescription: [::CHAR; ::MAX_PATH], +}} +pub type PCONFLICT_DETAILS_A = *mut CONFLICT_DETAILS_A; +STRUCT!{nodebug struct CONFLICT_DETAILS_W { + CD_ulSize: ::ULONG, + CD_ulMask: ::ULONG, + CD_dnDevInst: DEVINST, + CD_rdResDes: RES_DES, + CD_ulFlags: ::ULONG, + CD_szDescription: [::WCHAR; ::MAX_PATH], +}} +pub type PCONFLICT_DETAILS_W = *mut CONFLICT_DETAILS_W; +pub const CM_CDMASK_DEVINST: ::ULONG = 0x00000001; +pub const CM_CDMASK_RESDES: ::ULONG = 0x00000002; +pub const CM_CDMASK_FLAGS: ::ULONG = 0x00000004; +pub const CM_CDMASK_DESCRIPTION: ::ULONG = 0x00000008; +pub const CM_CDMASK_VALID: ::ULONG = 0x0000000F; +pub const CM_CDFLAGS_DRIVER: ::ULONG = 0x00000001; +pub const CM_CDFLAGS_ROOT_OWNED: ::ULONG = 0x00000002; +pub const CM_CDFLAGS_RESERVED: ::ULONG = 0x00000004; +pub type REGDISPOSITION = ::ULONG; +pub const mMD_MemoryType: ::DWORD = 0x1; +pub const fMD_MemoryType: ::DWORD = mMD_MemoryType; +pub const fMD_ROM: ::DWORD = 0x0; +pub const fMD_RAM: ::DWORD = 0x1; +pub const mMD_32_24: ::DWORD = 0x2; +pub const fMD_32_24: ::DWORD = mMD_32_24; +pub const fMD_24: ::DWORD = 0x0; +pub const fMD_32: ::DWORD = 0x2; +pub const mMD_Prefetchable: ::DWORD = 0x4; +pub const fMD_Prefetchable: ::DWORD = mMD_Prefetchable; +pub const fMD_Pref: ::DWORD = mMD_Prefetchable; +pub const fMD_PrefetchDisallowed: ::DWORD = 0x0; +pub const fMD_PrefetchAllowed: ::DWORD = 0x4; +pub const mMD_Readable: ::DWORD = 0x8; +pub const fMD_Readable: ::DWORD = mMD_Readable; +pub const fMD_ReadAllowed: ::DWORD = 0x0; +pub const fMD_ReadDisallowed: ::DWORD = 0x8; +pub const mMD_CombinedWrite: ::DWORD = 0x10; +pub const fMD_CombinedWrite: ::DWORD = mMD_CombinedWrite; +pub const fMD_CombinedWriteDisallowed: ::DWORD = 0x0; +pub const fMD_CombinedWriteAllowed: ::DWORD = 0x10; +pub const mMD_Cacheable: ::DWORD = 0x20; +pub const fMD_NonCacheable: ::DWORD = 0x0; +pub const fMD_Cacheable: ::DWORD = 0x20; +pub const fMD_WINDOW_DECODE: ::DWORD = 0x40; +pub const fMD_MEMORY_BAR: ::DWORD = 0x80; +STRUCT!{struct MEM_RANGE { + MR_Align: ::DWORDLONG, + MR_nBytes: ::ULONG, + MR_Min: ::DWORDLONG, + MR_Max: ::DWORDLONG, + MR_Flags: ::DWORD, + MR_Reserved: ::DWORD, +}} +pub type PMEM_RANGE = *mut MEM_RANGE; +STRUCT!{struct MEM_DES { + MD_Count: ::DWORD, + MD_Type: ::DWORD, + MD_Alloc_Base: ::DWORDLONG, + MD_Alloc_End: ::DWORDLONG, + MD_Flags: ::DWORD, + MD_Reserved: ::DWORD, +}} +pub type PMEM_DES = *mut MEM_DES; +STRUCT!{struct MEM_RESOURCE { + MEM_Header: MEM_DES, + MEM_Data: [MEM_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PMEM_RESOURCE = *mut MEM_RESOURCE; +STRUCT!{struct MEM_LARGE_RANGE { + MLR_Align: ::DWORDLONG, + MLR_nBytes: ::ULONGLONG, + MLR_Min: ::DWORDLONG, + MLR_Max: ::DWORDLONG, + MLR_Flags: ::DWORD, + MLR_Reserved: ::DWORD, +}} +pub type PMEM_LARGE_RANGE = *mut MEM_LARGE_RANGE; +STRUCT!{struct MEM_LARGE_DES { + MLD_Count: ::DWORD, + MLD_Type: ::DWORD, + MLD_Alloc_Base: ::DWORDLONG, + MLD_Alloc_End: ::DWORDLONG, + MLD_Flags: ::DWORD, + MLD_Reserved: ::DWORD, +}} +pub type PMEM_LARGE_DES = *mut MEM_LARGE_DES; +STRUCT!{struct MEM_LARGE_RESOURCE { + MEM_LARGE_Header: MEM_LARGE_DES, + MEM_LARGE_Data: [MEM_LARGE_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PMEM_LARGE_RESOURCE = *mut MEM_LARGE_RESOURCE; +pub const fIOD_PortType: ::DWORD = 0x1; +pub const fIOD_Memory: ::DWORD = 0x0; +pub const fIOD_IO: ::DWORD = 0x1; +pub const fIOD_DECODE: ::DWORD = 0x00fc; +pub const fIOD_10_BIT_DECODE: ::DWORD = 0x0004; +pub const fIOD_12_BIT_DECODE: ::DWORD = 0x0008; +pub const fIOD_16_BIT_DECODE: ::DWORD = 0x0010; +pub const fIOD_POSITIVE_DECODE: ::DWORD = 0x0020; +pub const fIOD_PASSIVE_DECODE: ::DWORD = 0x0040; +pub const fIOD_WINDOW_DECODE: ::DWORD = 0x0080; +pub const fIOD_PORT_BAR: ::DWORD = 0x0100; +pub const IO_ALIAS_10_BIT_DECODE: ::DWORDLONG = 0x00000004; +pub const IO_ALIAS_12_BIT_DECODE: ::DWORDLONG = 0x00000010; +pub const IO_ALIAS_16_BIT_DECODE: ::DWORDLONG = 0x00000000; +pub const IO_ALIAS_POSITIVE_DECODE: ::DWORDLONG = 0x000000FF; +STRUCT!{struct IO_RANGE { + IOR_Align: ::DWORDLONG, + IOR_nPorts: ::DWORD, + IOR_Min: ::DWORDLONG, + IOR_Max: ::DWORDLONG, + IOR_RangeFlags: ::DWORD, + IOR_Alias: ::DWORDLONG, +}} +pub type PIO_RANGE = *mut IO_RANGE; +STRUCT!{struct IO_DES { + IOD_Count: ::DWORD, + IOD_Type: ::DWORD, + IOD_Alloc_Base: ::DWORDLONG, + IOD_Alloc_End: ::DWORDLONG, + IOD_DesFlags: ::DWORD, +}} +pub type PIO_DES = *mut IO_DES; +STRUCT!{struct IO_RESOURCE { + IO_Header: IO_DES, + IO_Data: [IO_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PIO_RESOURCE = *mut IO_RESOURCE; +pub const mDD_Width: ::ULONG = 0x3; +pub const fDD_BYTE: ::ULONG = 0x0; +pub const fDD_WORD: ::ULONG = 0x1; +pub const fDD_DWORD: ::ULONG = 0x2; +pub const fDD_BYTE_AND_WORD: ::ULONG = 0x3; +pub const mDD_BusMaster: ::ULONG = 0x4; +pub const fDD_NoBusMaster: ::ULONG = 0x0; +pub const fDD_BusMaster: ::ULONG = 0x4; +pub const mDD_Type: ::ULONG = 0x18; +pub const fDD_TypeStandard: ::ULONG = 0x00; +pub const fDD_TypeA: ::ULONG = 0x08; +pub const fDD_TypeB: ::ULONG = 0x10; +pub const fDD_TypeF: ::ULONG = 0x18; +STRUCT!{struct DMA_RANGE { + DR_Min: ::ULONG, + DR_Max: ::ULONG, + DR_Flags: ::ULONG, +}} +pub type PDMA_RANGE = *mut DMA_RANGE; +STRUCT!{struct DMA_DES { + DD_Count: ::DWORD, + DD_Type: ::DWORD, + DD_Flags: ::DWORD, + DD_Alloc_Chan: ::ULONG, +}} +pub type PDMA_DES = *mut DMA_DES; +STRUCT!{struct DMA_RESOURCE { + DMA_Header: DMA_DES, + DMA_Data: [DMA_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PDMA_RESOURCE = *mut DMA_RESOURCE; +pub const mIRQD_Share: ::ULONG = 0x1; +pub const fIRQD_Exclusive: ::ULONG = 0x0; +pub const fIRQD_Share: ::ULONG = 0x1; +pub const fIRQD_Share_Bit: ::ULONG = 0; +pub const fIRQD_Level_Bit: ::ULONG = 1; +pub const mIRQD_Edge_Level: ::ULONG = 0x2; +pub const fIRQD_Level: ::ULONG = 0x0; +pub const fIRQD_Edge: ::ULONG = 0x2; +STRUCT!{struct IRQ_RANGE { + IRQR_Min: ::ULONG, + IRQR_Max: ::ULONG, + IRQR_Flags: ::ULONG, +}} +pub type PIRQ_RANGE = *mut IRQ_RANGE; +STRUCT!{struct IRQ_DES_32 { + IRQD_Count: ::DWORD, + IRQD_Type: ::DWORD, + IRQD_Flags: ::DWORD, + IRQD_Alloc_Num: ::ULONG, + IRQD_Affinity: ::ULONG32, +}} +pub type PIRQ_DES_32 = *mut IRQ_DES_32; +STRUCT!{struct IRQ_DES_64 { + IRQD_Count: ::DWORD, + IRQD_Type: ::DWORD, + IRQD_Flags: ::DWORD, + IRQD_Alloc_Num: ::ULONG, + IRQD_Affinity: ::ULONG64, +}} +pub type PIRQ_DES_64 = *mut IRQ_DES_64; +STRUCT!{struct IRQ_RESOURCE_32 { + IRQ_Header: IRQ_DES_32, + IRQ_Data: [IRQ_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PIRQ_RESOURCE_32 = *mut IRQ_RESOURCE_32; +STRUCT!{struct IRQ_RESOURCE_64 { + IRQ_Header: IRQ_DES_64, + IRQ_Data: [IRQ_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PIRQ_RESOURCE_64 = *mut IRQ_RESOURCE_64; +STRUCT!{struct DEVPRIVATE_RANGE { + PR_Data1: ::DWORD, + PR_Data2: ::DWORD, + PR_Data3: ::DWORD, +}} +pub type PDEVPRIVATE_RANGE = *mut DEVPRIVATE_RANGE; +STRUCT!{struct DEVPRIVATE_DES { + PD_Count: ::DWORD, + PD_Type: ::DWORD, + PD_Data1: ::DWORD, + PD_Data2: ::DWORD, + PD_Data3: ::DWORD, + PD_Flags: ::DWORD, +}} +pub type PDEVPRIVATE_DES = *mut DEVPRIVATE_DES; +STRUCT!{struct DEVPRIVATE_RESOURCE { + PRV_Header: DEVPRIVATE_DES, + PRV_Data: [DEVPRIVATE_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PDEVPRIVATE_RESOURCE = *mut DEVPRIVATE_RESOURCE; +STRUCT!{struct CS_DES { + CSD_SignatureLength: ::DWORD, + CSD_LegacyDataOffset: ::DWORD, + CSD_LegacyDataSize: ::DWORD, + CSD_Flags: ::DWORD, + CSD_ClassGuid: ::GUID, + CSD_Signature: [::BYTE; ::ANYSIZE_ARRAY], +}} +pub type PCS_DES = *mut CS_DES; +STRUCT!{struct CS_RESOURCE { + CS_Header: CS_DES, +}} +pub type PCS_RESOURCE = *mut CS_RESOURCE; +pub const mPCD_IO_8_16: ::DWORD = 0x1; +pub const fPCD_IO_8: ::DWORD = 0x0; +pub const fPCD_IO_16: ::DWORD = 0x1; +pub const mPCD_MEM_8_16: ::DWORD = 0x2; +pub const fPCD_MEM_8: ::DWORD = 0x0; +pub const fPCD_MEM_16: ::DWORD = 0x2; +pub const mPCD_MEM_A_C: ::DWORD = 0xC; +pub const fPCD_MEM1_A: ::DWORD = 0x4; +pub const fPCD_MEM2_A: ::DWORD = 0x8; +pub const fPCD_IO_ZW_8: ::DWORD = 0x10; +pub const fPCD_IO_SRC_16: ::DWORD = 0x20; +pub const fPCD_IO_WS_16: ::DWORD = 0x40; +pub const mPCD_MEM_WS: ::DWORD = 0x300; +pub const fPCD_MEM_WS_ONE: ::DWORD = 0x100; +pub const fPCD_MEM_WS_TWO: ::DWORD = 0x200; +pub const fPCD_MEM_WS_THREE: ::DWORD = 0x300; +pub const fPCD_MEM_A: ::DWORD = 0x4; +pub const fPCD_ATTRIBUTES_PER_WINDOW: ::DWORD = 0x8000; +pub const fPCD_IO1_16: ::DWORD = 0x00010000; +pub const fPCD_IO1_ZW_8: ::DWORD = 0x00020000; +pub const fPCD_IO1_SRC_16: ::DWORD = 0x00040000; +pub const fPCD_IO1_WS_16: ::DWORD = 0x00080000; +pub const fPCD_IO2_16: ::DWORD = 0x00100000; +pub const fPCD_IO2_ZW_8: ::DWORD = 0x00200000; +pub const fPCD_IO2_SRC_16: ::DWORD = 0x00400000; +pub const fPCD_IO2_WS_16: ::DWORD = 0x00800000; +pub const mPCD_MEM1_WS: ::DWORD = 0x03000000; +pub const fPCD_MEM1_WS_TWO: ::DWORD = 0x02000000; +pub const fPCD_MEM1_WS_THREE: ::DWORD = 0x03000000; +pub const fPCD_MEM1_16: ::DWORD = 0x04000000; +pub const mPCD_MEM2_WS: ::DWORD = 0x30000000; +pub const fPCD_MEM2_WS_ONE: ::DWORD = 0x10000000; +pub const fPCD_MEM2_WS_TWO: ::DWORD = 0x20000000; +pub const fPCD_MEM2_WS_THREE: ::DWORD = 0x30000000; +pub const fPCD_MEM2_16: ::DWORD = 0x40000000; +pub const PCD_MAX_MEMORY: usize = 2; +pub const PCD_MAX_IO: usize = 2; +STRUCT!{struct PCCARD_DES { + PCD_Count: ::DWORD, + PCD_Type: ::DWORD, + PCD_Flags: ::DWORD, + PCD_ConfigIndex: ::BYTE, + PCD_Reserved: [::BYTE; 3], + PCD_MemoryCardBase1: ::DWORD, + PCD_MemoryCardBase2: ::DWORD, + PCD_MemoryCardBase: [::DWORD; PCD_MAX_MEMORY], + PCD_MemoryFlags: [::WORD; PCD_MAX_MEMORY], + PCD_IoFlags: [::BYTE; PCD_MAX_IO], +}} +pub type PPCCARD_DES = *mut PCCARD_DES; +STRUCT!{struct PCCARD_RESOURCE { + PcCard_Header: PCCARD_DES, +}} +pub type PPCCARD_RESOURCE = *mut PCCARD_RESOURCE; +pub const mPMF_AUDIO_ENABLE: ::DWORD = 0x8; +pub const fPMF_AUDIO_ENABLE: ::DWORD = 0x8; +STRUCT!{struct MFCARD_DES { + PMF_Count: ::DWORD, + PMF_Type: ::DWORD, + PMF_Flags: ::DWORD, + PMF_ConfigOptions: ::BYTE, + PMF_IoResourceIndex: ::BYTE, + PMF_Reserved: [::BYTE; 2], + PMF_ConfigRegisterBase: ::DWORD, +}} +pub type PMFCARD_DES = *mut MFCARD_DES; +STRUCT!{struct MFCARD_RESOURCE { + MfCard_Header: MFCARD_DES, +}} +pub type PMFCARD_RESOURCE = *mut MFCARD_RESOURCE; +STRUCT!{struct BUSNUMBER_RANGE { + BUSR_Min: ::ULONG, + BUSR_Max: ::ULONG, + BUSR_nBusNumbers: ::ULONG, + BUSR_Flags: ::ULONG, +}} +pub type PBUSNUMBER_RANGE = *mut BUSNUMBER_RANGE; +STRUCT!{struct BUSNUMBER_DES { + BUSD_Count: ::DWORD, + BUSD_Type: ::DWORD, + BUSD_Flags: ::DWORD, + BUSD_Alloc_Base: ::ULONG, + BUSD_Alloc_End: ::ULONG, +}} +pub type PBUSNUMBER_DES = *mut BUSNUMBER_DES; +STRUCT!{struct BUSNUMBER_RESOURCE { + BusNumber_Header: BUSNUMBER_DES, + BusNumber_Data: [BUSNUMBER_RANGE; ::ANYSIZE_ARRAY], +}} +pub type PBUSNUMBER_RESOURCE = *mut BUSNUMBER_RESOURCE; +STRUCT!{struct CONNECTION_DES { + COND_Type: ::DWORD, + COND_Flags: ::DWORD, + COND_Class: ::BYTE, + COND_ClassType: ::BYTE, + COND_Reserved1: ::BYTE, + COND_Reserved2: ::BYTE, + COND_Id: ::LARGE_INTEGER, +}} +pub type PCONNECTION_DES = *mut CONNECTION_DES; +STRUCT!{struct CONNECTION_RESOURCE { + Connection_Header: CONNECTION_DES, +}} +pub type PCONNECTION_RESOURCE = *mut CONNECTION_RESOURCE; +pub const CM_HWPI_NOT_DOCKABLE: ::DWORD = 0x00000000; +pub const CM_HWPI_UNDOCKED: ::DWORD = 0x00000001; +pub const CM_HWPI_DOCKED: ::DWORD = 0x00000002; +STRUCT!{nodebug struct HWPROFILEINFO_A { + HWPI_ulHWProfile: ::ULONG, + HWPI_szFriendlyName: [::CHAR; MAX_PROFILE_LEN], + HWPI_dwFlags: ::DWORD, +}} +pub type PHWPROFILEINFO_A = *mut HWPROFILEINFO_A; +STRUCT!{nodebug struct HWPROFILEINFO_W { + HWPI_ulHWProfile: ::ULONG, + HWPI_szFriendlyName: [::WCHAR; MAX_PROFILE_LEN], + HWPI_dwFlags: ::DWORD, +}} +pub type PHWPROFILEINFO_W = *mut HWPROFILEINFO_W; +pub const ResType_All: RESOURCEID = 0x00000000; +pub const ResType_None: RESOURCEID = 0x00000000; +pub const ResType_Mem: RESOURCEID = 0x00000001; +pub const ResType_IO: RESOURCEID = 0x00000002; +pub const ResType_DMA: RESOURCEID = 0x00000003; +pub const ResType_IRQ: RESOURCEID = 0x00000004; +pub const ResType_DoNotUse: RESOURCEID = 0x00000005; +pub const ResType_BusNumber: RESOURCEID = 0x00000006; +pub const ResType_MemLarge: RESOURCEID = 0x00000007; +pub const ResType_MAX: RESOURCEID = 0x00000007; +pub const ResType_Ignored_Bit: RESOURCEID = 0x00008000; +pub const ResType_ClassSpecific: RESOURCEID = 0x0000FFFF; +pub const ResType_Reserved: RESOURCEID = 0x00008000; +pub const ResType_DevicePrivate: RESOURCEID = 0x00008001; +pub const ResType_PcCardConfig: RESOURCEID = 0x00008002; +pub const ResType_MfCardConfig: RESOURCEID = 0x00008003; +pub const ResType_Connection: RESOURCEID = 0x00008004; +pub const CM_ADD_RANGE_ADDIFCONFLICT: ::ULONG = 0x00000000; +pub const CM_ADD_RANGE_DONOTADDIFCONFLICT: ::ULONG = 0x00000001; +pub const CM_ADD_RANGE_BITS: ::ULONG = 0x00000001; +pub const BASIC_LOG_CONF: ::ULONG = 0x00000000; +pub const FILTERED_LOG_CONF: ::ULONG = 0x00000001; +pub const ALLOC_LOG_CONF: ::ULONG = 0x00000002; +pub const BOOT_LOG_CONF: ::ULONG = 0x00000003; +pub const FORCED_LOG_CONF: ::ULONG = 0x00000004; +pub const OVERRIDE_LOG_CONF: ::ULONG = 0x00000005; +pub const NUM_LOG_CONF: ::ULONG = 0x00000006; +pub const LOG_CONF_BITS: ::ULONG = 0x00000007; +pub const PRIORITY_EQUAL_FIRST: ::ULONG = 0x00000008; +pub const PRIORITY_EQUAL_LAST: ::ULONG = 0x00000000; +pub const PRIORITY_BIT: ::ULONG = 0x00000008; +pub const RegDisposition_OpenAlways: REGDISPOSITION = 0x00000000; +pub const RegDisposition_OpenExisting: REGDISPOSITION = 0x00000001; +pub const RegDisposition_Bits: REGDISPOSITION = 0x00000001; +pub const CM_ADD_ID_HARDWARE: ::ULONG = 0x00000000; +pub const CM_ADD_ID_COMPATIBLE: ::ULONG = 0x00000001; +pub const CM_ADD_ID_BITS: ::ULONG = 0x00000001; +pub const CM_CREATE_DEVNODE_NORMAL: ::ULONG = 0x00000000; +pub const CM_CREATE_DEVNODE_NO_WAIT_INSTALL: ::ULONG = 0x00000001; +pub const CM_CREATE_DEVNODE_PHANTOM: ::ULONG = 0x00000002; +pub const CM_CREATE_DEVNODE_GENERATE_ID: ::ULONG = 0x00000004; +pub const CM_CREATE_DEVNODE_DO_NOT_INSTALL: ::ULONG = 0x00000008; +pub const CM_CREATE_DEVNODE_BITS: ::ULONG = 0x0000000F; +pub const CM_CREATE_DEVINST_NORMAL: ::ULONG = CM_CREATE_DEVNODE_NORMAL; +pub const CM_CREATE_DEVINST_NO_WAIT_INSTALL: ::ULONG = CM_CREATE_DEVNODE_NO_WAIT_INSTALL; +pub const CM_CREATE_DEVINST_PHANTOM: ::ULONG = CM_CREATE_DEVNODE_PHANTOM; +pub const CM_CREATE_DEVINST_GENERATE_ID: ::ULONG = CM_CREATE_DEVNODE_GENERATE_ID; +pub const CM_CREATE_DEVINST_DO_NOT_INSTALL: ::ULONG = CM_CREATE_DEVNODE_DO_NOT_INSTALL; +pub const CM_CREATE_DEVINST_BITS: ::ULONG = CM_CREATE_DEVNODE_BITS; +pub const CM_DELETE_CLASS_ONLY: ::ULONG = 0x00000000; +pub const CM_DELETE_CLASS_SUBKEYS: ::ULONG = 0x00000001; +pub const CM_DELETE_CLASS_INTERFACE: ::ULONG = 0x00000002; +pub const CM_DELETE_CLASS_BITS: ::ULONG = 0x00000003; +pub const CM_ENUMERATE_CLASSES_INSTALLER: ::ULONG = 0x00000000; +pub const CM_ENUMERATE_CLASSES_INTERFACE: ::ULONG = 0x00000001; +pub const CM_ENUMERATE_CLASSES_BITS: ::ULONG = 0x00000001; +pub const CM_DETECT_NEW_PROFILE: ::ULONG = 0x00000001; +pub const CM_DETECT_CRASHED: ::ULONG = 0x00000002; +pub const CM_DETECT_HWPROF_FIRST_BOOT: ::ULONG = 0x00000004; +pub const CM_DETECT_RUN: ::ULONG = 0x80000000; +pub const CM_DETECT_BITS: ::ULONG = 0x80000007; +pub const CM_DISABLE_POLITE: ::ULONG = 0x00000000; +pub const CM_DISABLE_ABSOLUTE: ::ULONG = 0x00000001; +pub const CM_DISABLE_HARDWARE: ::ULONG = 0x00000002; +pub const CM_DISABLE_UI_NOT_OK: ::ULONG = 0x00000004; +pub const CM_DISABLE_BITS: ::ULONG = 0x00000007; +pub const CM_GETIDLIST_FILTER_NONE: ::ULONG = 0x00000000; +pub const CM_GETIDLIST_FILTER_ENUMERATOR: ::ULONG = 0x00000001; +pub const CM_GETIDLIST_FILTER_SERVICE: ::ULONG = 0x00000002; +pub const CM_GETIDLIST_FILTER_EJECTRELATIONS: ::ULONG = 0x00000004; +pub const CM_GETIDLIST_FILTER_REMOVALRELATIONS: ::ULONG = 0x00000008; +pub const CM_GETIDLIST_FILTER_POWERRELATIONS: ::ULONG = 0x00000010; +pub const CM_GETIDLIST_FILTER_BUSRELATIONS: ::ULONG = 0x00000020; +pub const CM_GETIDLIST_DONOTGENERATE: ::ULONG = 0x10000040; +pub const CM_GETIDLIST_FILTER_TRANSPORTRELATIONS: ::ULONG = 0x00000080; +pub const CM_GETIDLIST_FILTER_PRESENT: ::ULONG = 0x00000100; +pub const CM_GETIDLIST_FILTER_CLASS: ::ULONG = 0x00000200; +pub const CM_GETIDLIST_FILTER_BITS: ::ULONG = 0x100003FF; +pub const CM_GET_DEVICE_INTERFACE_LIST_PRESENT: ::ULONG = 0x00000000; +pub const CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES: ::ULONG = 0x00000001; +pub const CM_GET_DEVICE_INTERFACE_LIST_BITS: ::ULONG = 0x00000001; +pub const CM_DRP_DEVICEDESC: ::ULONG = 0x00000001; +pub const CM_DRP_HARDWAREID: ::ULONG = 0x00000002; +pub const CM_DRP_COMPATIBLEIDS: ::ULONG = 0x00000003; +pub const CM_DRP_UNUSED0: ::ULONG = 0x00000004; +pub const CM_DRP_SERVICE: ::ULONG = 0x00000005; +pub const CM_DRP_UNUSED1: ::ULONG = 0x00000006; +pub const CM_DRP_UNUSED2: ::ULONG = 0x00000007; +pub const CM_DRP_CLASS: ::ULONG = 0x00000008; +pub const CM_DRP_CLASSGUID: ::ULONG = 0x00000009; +pub const CM_DRP_DRIVER: ::ULONG = 0x0000000A; +pub const CM_DRP_CONFIGFLAGS: ::ULONG = 0x0000000B; +pub const CM_DRP_MFG: ::ULONG = 0x0000000C; +pub const CM_DRP_FRIENDLYNAME: ::ULONG = 0x0000000D; +pub const CM_DRP_LOCATION_INFORMATION: ::ULONG = 0x0000000E; +pub const CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME: ::ULONG = 0x0000000F; +pub const CM_DRP_CAPABILITIES: ::ULONG = 0x00000010; +pub const CM_DRP_UI_NUMBER: ::ULONG = 0x00000011; +pub const CM_DRP_UPPERFILTERS: ::ULONG = 0x00000012; +pub const CM_CRP_UPPERFILTERS: ::ULONG = CM_DRP_UPPERFILTERS; +pub const CM_DRP_LOWERFILTERS: ::ULONG = 0x00000013; +pub const CM_CRP_LOWERFILTERS: ::ULONG = CM_DRP_LOWERFILTERS; +pub const CM_DRP_BUSTYPEGUID: ::ULONG = 0x00000014; +pub const CM_DRP_LEGACYBUSTYPE: ::ULONG = 0x00000015; +pub const CM_DRP_BUSNUMBER: ::ULONG = 0x00000016; +pub const CM_DRP_ENUMERATOR_NAME: ::ULONG = 0x00000017; +pub const CM_DRP_SECURITY: ::ULONG = 0x00000018; +pub const CM_CRP_SECURITY: ::ULONG = CM_DRP_SECURITY; +pub const CM_DRP_SECURITY_SDS: ::ULONG = 0x00000019; +pub const CM_CRP_SECURITY_SDS: ::ULONG = CM_DRP_SECURITY_SDS; +pub const CM_DRP_DEVTYPE: ::ULONG = 0x0000001A; +pub const CM_CRP_DEVTYPE: ::ULONG = CM_DRP_DEVTYPE; +pub const CM_DRP_EXCLUSIVE: ::ULONG = 0x0000001B; +pub const CM_CRP_EXCLUSIVE: ::ULONG = CM_DRP_EXCLUSIVE; +pub const CM_DRP_CHARACTERISTICS: ::ULONG = 0x0000001C; +pub const CM_CRP_CHARACTERISTICS: ::ULONG = CM_DRP_CHARACTERISTICS; +pub const CM_DRP_ADDRESS: ::ULONG = 0x0000001D; +pub const CM_DRP_UI_NUMBER_DESC_FORMAT: ::ULONG = 0x0000001E; +pub const CM_DRP_DEVICE_POWER_DATA: ::ULONG = 0x0000001F; +pub const CM_DRP_REMOVAL_POLICY: ::ULONG = 0x00000020; +pub const CM_DRP_REMOVAL_POLICY_HW_DEFAULT: ::ULONG = 0x00000021; +pub const CM_DRP_REMOVAL_POLICY_OVERRIDE: ::ULONG = 0x00000022; +pub const CM_DRP_INSTALL_STATE: ::ULONG = 0x00000023; +pub const CM_DRP_LOCATION_PATHS: ::ULONG = 0x00000024; +pub const CM_DRP_BASE_CONTAINERID: ::ULONG = 0x00000025; +pub const CM_DRP_MIN: ::ULONG = 0x00000001; +pub const CM_CRP_MIN: ::ULONG = CM_DRP_MIN; +pub const CM_DRP_MAX: ::ULONG = 0x00000025; +pub const CM_CRP_MAX: ::ULONG = CM_DRP_MAX; +pub const CM_DEVCAP_LOCKSUPPORTED: ::ULONG = 0x00000001; +pub const CM_DEVCAP_EJECTSUPPORTED: ::ULONG = 0x00000002; +pub const CM_DEVCAP_REMOVABLE: ::ULONG = 0x00000004; +pub const CM_DEVCAP_DOCKDEVICE: ::ULONG = 0x00000008; +pub const CM_DEVCAP_UNIQUEID: ::ULONG = 0x00000010; +pub const CM_DEVCAP_SILENTINSTALL: ::ULONG = 0x00000020; +pub const CM_DEVCAP_RAWDEVICEOK: ::ULONG = 0x00000040; +pub const CM_DEVCAP_SURPRISEREMOVALOK: ::ULONG = 0x00000080; +pub const CM_DEVCAP_HARDWAREDISABLED: ::ULONG = 0x00000100; +pub const CM_DEVCAP_NONDYNAMIC: ::ULONG = 0x00000200; +pub const CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL: ::ULONG = 1; +pub const CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL: ::ULONG = 2; +pub const CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL: ::ULONG = 3; +pub const CM_INSTALL_STATE_INSTALLED: ::ULONG = 0; +pub const CM_INSTALL_STATE_NEEDS_REINSTALL: ::ULONG = 1; +pub const CM_INSTALL_STATE_FAILED_INSTALL: ::ULONG = 2; +pub const CM_INSTALL_STATE_FINISH_INSTALL: ::ULONG = 3; +pub const CM_LOCATE_DEVNODE_NORMAL: ::ULONG = 0x00000000; +pub const CM_LOCATE_DEVNODE_PHANTOM: ::ULONG = 0x00000001; +pub const CM_LOCATE_DEVNODE_CANCELREMOVE: ::ULONG = 0x00000002; +pub const CM_LOCATE_DEVNODE_NOVALIDATION: ::ULONG = 0x00000004; +pub const CM_LOCATE_DEVNODE_BITS: ::ULONG = 0x00000007; +pub const CM_LOCATE_DEVINST_NORMAL: ::ULONG = CM_LOCATE_DEVNODE_NORMAL; +pub const CM_LOCATE_DEVINST_PHANTOM: ::ULONG = CM_LOCATE_DEVNODE_PHANTOM; +pub const CM_LOCATE_DEVINST_CANCELREMOVE: ::ULONG = CM_LOCATE_DEVNODE_CANCELREMOVE; +pub const CM_LOCATE_DEVINST_NOVALIDATION: ::ULONG = CM_LOCATE_DEVNODE_NOVALIDATION; +pub const CM_LOCATE_DEVINST_BITS: ::ULONG = CM_LOCATE_DEVNODE_BITS; +pub const CM_OPEN_CLASS_KEY_INSTALLER: ::ULONG = 0x00000000; +pub const CM_OPEN_CLASS_KEY_INTERFACE: ::ULONG = 0x00000001; +pub const CM_OPEN_CLASS_KEY_BITS: ::ULONG = 0x00000001; +pub const CM_REMOVE_UI_OK: ::ULONG = 0x00000000; +pub const CM_REMOVE_UI_NOT_OK: ::ULONG = 0x00000001; +pub const CM_REMOVE_NO_RESTART: ::ULONG = 0x00000002; +pub const CM_REMOVE_BITS: ::ULONG = 0x00000003; +pub const CM_QUERY_REMOVE_UI_OK: ::ULONG = CM_REMOVE_UI_OK; +pub const CM_QUERY_REMOVE_UI_NOT_OK: ::ULONG = CM_REMOVE_UI_NOT_OK; +pub const CM_QUERY_REMOVE_BITS: ::ULONG = CM_QUERY_REMOVE_UI_OK | CM_QUERY_REMOVE_UI_NOT_OK; +pub const CM_REENUMERATE_NORMAL: ::ULONG = 0x00000000; +pub const CM_REENUMERATE_SYNCHRONOUS: ::ULONG = 0x00000001; +pub const CM_REENUMERATE_RETRY_INSTALLATION: ::ULONG = 0x00000002; +pub const CM_REENUMERATE_ASYNCHRONOUS: ::ULONG = 0x00000004; +pub const CM_REENUMERATE_BITS: ::ULONG = 0x00000007; +pub const CM_REGISTER_DEVICE_DRIVER_STATIC: ::ULONG = 0x00000000; +pub const CM_REGISTER_DEVICE_DRIVER_DISABLEABLE: ::ULONG = 0x00000001; +pub const CM_REGISTER_DEVICE_DRIVER_REMOVABLE: ::ULONG = 0x00000002; +pub const CM_REGISTER_DEVICE_DRIVER_BITS: ::ULONG = 0x00000003; +pub const CM_REGISTRY_HARDWARE: ::ULONG = 0x00000000; +pub const CM_REGISTRY_SOFTWARE: ::ULONG = 0x00000001; +pub const CM_REGISTRY_USER: ::ULONG = 0x00000100; +pub const CM_REGISTRY_CONFIG: ::ULONG = 0x00000200; +pub const CM_REGISTRY_BITS: ::ULONG = 0x00000301; +pub const CM_SET_DEVNODE_PROBLEM_NORMAL: ::ULONG = 0x00000000; +pub const CM_SET_DEVNODE_PROBLEM_OVERRIDE: ::ULONG = 0x00000001; +pub const CM_SET_DEVNODE_PROBLEM_BITS: ::ULONG = 0x00000001; +pub const CM_SET_DEVINST_PROBLEM_NORMAL: ::ULONG = CM_SET_DEVNODE_PROBLEM_NORMAL; +pub const CM_SET_DEVINST_PROBLEM_OVERRIDE: ::ULONG = CM_SET_DEVNODE_PROBLEM_OVERRIDE; +pub const CM_SET_DEVINST_PROBLEM_BITS: ::ULONG = CM_SET_DEVNODE_PROBLEM_BITS; +pub const CM_SET_HW_PROF_FLAGS_UI_NOT_OK: ::ULONG = 0x00000001; +pub const CM_SET_HW_PROF_FLAGS_BITS: ::ULONG = 0x00000001; +pub const CM_SETUP_DEVNODE_READY: ::ULONG = 0x00000000; +pub const CM_SETUP_DEVINST_READY: ::ULONG = CM_SETUP_DEVNODE_READY; +pub const CM_SETUP_DOWNLOAD: ::ULONG = 0x00000001; +pub const CM_SETUP_WRITE_LOG_CONFS: ::ULONG = 0x00000002; +pub const CM_SETUP_PROP_CHANGE: ::ULONG = 0x00000003; +pub const CM_SETUP_DEVNODE_RESET: ::ULONG = 0x00000004; +pub const CM_SETUP_DEVINST_RESET: ::ULONG = CM_SETUP_DEVNODE_RESET; +pub const CM_SETUP_DEVNODE_CONFIG: ::ULONG = 0x00000005; +pub const CM_SETUP_DEVINST_CONFIG: ::ULONG = CM_SETUP_DEVNODE_CONFIG; +pub const CM_SETUP_DEVNODE_CONFIG_CLASS: ::ULONG = 0x00000006; +pub const CM_SETUP_DEVINST_CONFIG_CLASS: ::ULONG = CM_SETUP_DEVNODE_CONFIG_CLASS; +pub const CM_SETUP_DEVNODE_CONFIG_EXTENSIONS: ::ULONG = 0x00000007; +pub const CM_SETUP_DEVINST_CONFIG_EXTENSIONS: ::ULONG = CM_SETUP_DEVNODE_CONFIG_EXTENSIONS; +pub const CM_SETUP_BITS: ::ULONG = 0x00000007; +pub const CM_QUERY_ARBITRATOR_RAW: ::ULONG = 0x00000000; +pub const CM_QUERY_ARBITRATOR_TRANSLATED: ::ULONG = 0x00000001; +pub const CM_QUERY_ARBITRATOR_BITS: ::ULONG = 0x00000001; +pub const CM_CUSTOMDEVPROP_MERGE_MULTISZ: ::ULONG = 0x00000001; +pub const CM_CUSTOMDEVPROP_BITS: ::ULONG = 0x00000001; +pub const CM_NAME_ATTRIBUTE_NAME_RETRIEVED_FROM_DEVICE: ::ULONG = 0x1; +pub const CM_NAME_ATTRIBUTE_USER_ASSIGNED_NAME: ::ULONG = 0x2; +pub const CM_CLASS_PROPERTY_INSTALLER: ::ULONG = 0x00000000; +pub const CM_CLASS_PROPERTY_INTERFACE: ::ULONG = 0x00000001; +pub const CM_CLASS_PROPERTY_BITS: ::ULONG = 0x00000001; +DECLARE_HANDLE!(HCMNOTIFICATION, HCMNOTIFICATION__); +pub type PHCMNOTIFICATION = *mut HCMNOTIFICATION; +pub const CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES: ::ULONG = 0x00000001; +pub const CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES: ::ULONG = 0x00000002; +pub const CM_NOTIFY_FILTER_VALID_FLAGS: ::ULONG = CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES + | CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES; +ENUM!{enum CM_NOTIFY_FILTER_TYPE { + CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE = 0, + CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE, + CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE, + CM_NOTIFY_FILTER_TYPE_MAX, +}} +pub type PCM_NOTIFY_FILTER_TYPE = *mut CM_NOTIFY_FILTER_TYPE; +STRUCT!{struct CM_NOTIFY_FILTER_DeviceInterface { + ClassGuid: ::GUID, +}} +STRUCT!{struct CM_NOTIFY_FILTER_DeviceHandle { + hTarget: ::HANDLE, +}} +STRUCT!{nodebug struct CM_NOTIFY_FILTER_DeviceInstance { + InstanceId: [::WCHAR; MAX_DEVICE_ID_LEN], +}} +STRUCT!{nodebug struct CM_NOTIFY_FILTER { + cbSize: ::DWORD, + Flags: ::DWORD, + FilterType: CM_NOTIFY_FILTER_TYPE, + Reserved: ::DWORD, + u: [::BYTE; 400], +}} +UNION!(CM_NOTIFY_FILTER, u, DeviceInterface, DeviceInterface_mut, CM_NOTIFY_FILTER_DeviceInterface); +UNION!(CM_NOTIFY_FILTER, u, DeviceHandle, DeviceHandle_mut, CM_NOTIFY_FILTER_DeviceHandle); +UNION!(CM_NOTIFY_FILTER, u, DeviceInstance, DeviceInstance_mut, CM_NOTIFY_FILTER_DeviceInstance); +pub type PCM_NOTIFY_FILTER = *mut CM_NOTIFY_FILTER; +ENUM!{enum CM_NOTIFY_ACTION { + CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL = 0, + CM_NOTIFY_ACTION_DEVICEINTERFACEREMOVAL, + CM_NOTIFY_ACTION_DEVICEQUERYREMOVE, + CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED, + CM_NOTIFY_ACTION_DEVICEREMOVEPENDING, + CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE, + CM_NOTIFY_ACTION_DEVICECUSTOMEVENT, + CM_NOTIFY_ACTION_DEVICEINSTANCEENUMERATED, + CM_NOTIFY_ACTION_DEVICEINSTANCESTARTED, + CM_NOTIFY_ACTION_DEVICEINSTANCEREMOVED, + CM_NOTIFY_ACTION_MAX, +}} +pub type PCM_NOTIFY_ACTION = *mut CM_NOTIFY_ACTION; +STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceInterface { + ClassGuid: ::GUID, + SymbolicLink: [::WCHAR; ::ANYSIZE_ARRAY], +}} +STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceHandle { + EventGuid: ::GUID, + NameOffset: ::LONG, + DataSize: ::DWORD, + Data: [::BYTE; ::ANYSIZE_ARRAY], +}} +STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceInstance { + InstanceId: [::WCHAR; ::ANYSIZE_ARRAY], +}} +STRUCT!{struct CM_NOTIFY_EVENT_DATA { + FilterType: CM_NOTIFY_FILTER_TYPE, + Reserved: ::DWORD, + u: [::BYTE; 25], +}} +UNION!( + CM_NOTIFY_EVENT_DATA, u, DeviceInterface, DeviceInterface_mut, + CM_NOTIFY_EVENT_DATA_DeviceInterface +); +UNION!(CM_NOTIFY_EVENT_DATA, u, DeviceHandle, DeviceHandle_mut, CM_NOTIFY_EVENT_DATA_DeviceHandle); +UNION!( + CM_NOTIFY_EVENT_DATA, u, DeviceInstance, DeviceInstance_mut, CM_NOTIFY_EVENT_DATA_DeviceInstance +); +pub type PCM_NOTIFY_EVENT_DATA = *mut CM_NOTIFY_EVENT_DATA; +pub type PCM_NOTIFY_CALLBACK = Option ::DWORD>; +pub const CR_SUCCESS: CONFIGRET = 0x00000000; +pub const CR_DEFAULT: CONFIGRET = 0x00000001; +pub const CR_OUT_OF_MEMORY: CONFIGRET = 0x00000002; +pub const CR_INVALID_POINTER: CONFIGRET = 0x00000003; +pub const CR_INVALID_FLAG: CONFIGRET = 0x00000004; +pub const CR_INVALID_DEVNODE: CONFIGRET = 0x00000005; +pub const CR_INVALID_DEVINST: CONFIGRET = CR_INVALID_DEVNODE; +pub const CR_INVALID_RES_DES: CONFIGRET = 0x00000006; +pub const CR_INVALID_LOG_CONF: CONFIGRET = 0x00000007; +pub const CR_INVALID_ARBITRATOR: CONFIGRET = 0x00000008; +pub const CR_INVALID_NODELIST: CONFIGRET = 0x00000009; +pub const CR_DEVNODE_HAS_REQS: CONFIGRET = 0x0000000A; +pub const CR_DEVINST_HAS_REQS: CONFIGRET = CR_DEVNODE_HAS_REQS; +pub const CR_INVALID_RESOURCEID: CONFIGRET = 0x0000000B; +pub const CR_DLVXD_NOT_FOUND: CONFIGRET = 0x0000000C; +pub const CR_NO_SUCH_DEVNODE: CONFIGRET = 0x0000000D; +pub const CR_NO_SUCH_DEVINST: CONFIGRET = CR_NO_SUCH_DEVNODE; +pub const CR_NO_MORE_LOG_CONF: CONFIGRET = 0x0000000E; +pub const CR_NO_MORE_RES_DES: CONFIGRET = 0x0000000F; +pub const CR_ALREADY_SUCH_DEVNODE: CONFIGRET = 0x00000010; +pub const CR_ALREADY_SUCH_DEVINST: CONFIGRET = CR_ALREADY_SUCH_DEVNODE; +pub const CR_INVALID_RANGE_LIST: CONFIGRET = 0x00000011; +pub const CR_INVALID_RANGE: CONFIGRET = 0x00000012; +pub const CR_FAILURE: CONFIGRET = 0x00000013; +pub const CR_NO_SUCH_LOGICAL_DEV: CONFIGRET = 0x00000014; +pub const CR_CREATE_BLOCKED: CONFIGRET = 0x00000015; +pub const CR_NOT_SYSTEM_VM: CONFIGRET = 0x00000016; +pub const CR_REMOVE_VETOED: CONFIGRET = 0x00000017; +pub const CR_APM_VETOED: CONFIGRET = 0x00000018; +pub const CR_INVALID_LOAD_TYPE: CONFIGRET = 0x00000019; +pub const CR_BUFFER_SMALL: CONFIGRET = 0x0000001A; +pub const CR_NO_ARBITRATOR: CONFIGRET = 0x0000001B; +pub const CR_NO_REGISTRY_HANDLE: CONFIGRET = 0x0000001C; +pub const CR_REGISTRY_ERROR: CONFIGRET = 0x0000001D; +pub const CR_INVALID_DEVICE_ID: CONFIGRET = 0x0000001E; +pub const CR_INVALID_DATA: CONFIGRET = 0x0000001F; +pub const CR_INVALID_API: CONFIGRET = 0x00000020; +pub const CR_DEVLOADER_NOT_READY: CONFIGRET = 0x00000021; +pub const CR_NEED_RESTART: CONFIGRET = 0x00000022; +pub const CR_NO_MORE_HW_PROFILES: CONFIGRET = 0x00000023; +pub const CR_DEVICE_NOT_THERE: CONFIGRET = 0x00000024; +pub const CR_NO_SUCH_VALUE: CONFIGRET = 0x00000025; +pub const CR_WRONG_TYPE: CONFIGRET = 0x00000026; +pub const CR_INVALID_PRIORITY: CONFIGRET = 0x00000027; +pub const CR_NOT_DISABLEABLE: CONFIGRET = 0x00000028; +pub const CR_FREE_RESOURCES: CONFIGRET = 0x00000029; +pub const CR_QUERY_VETOED: CONFIGRET = 0x0000002A; +pub const CR_CANT_SHARE_IRQ: CONFIGRET = 0x0000002B; +pub const CR_NO_DEPENDENT: CONFIGRET = 0x0000002C; +pub const CR_SAME_RESOURCES: CONFIGRET = 0x0000002D; +pub const CR_NO_SUCH_REGISTRY_KEY: CONFIGRET = 0x0000002E; +pub const CR_INVALID_MACHINENAME: CONFIGRET = 0x0000002F; +pub const CR_REMOTE_COMM_FAILURE: CONFIGRET = 0x00000030; +pub const CR_MACHINE_UNAVAILABLE: CONFIGRET = 0x00000031; +pub const CR_NO_CM_SERVICES: CONFIGRET = 0x00000032; +pub const CR_ACCESS_DENIED: CONFIGRET = 0x00000033; +pub const CR_CALL_NOT_IMPLEMENTED: CONFIGRET = 0x00000034; +pub const CR_INVALID_PROPERTY: CONFIGRET = 0x00000035; +pub const CR_DEVICE_INTERFACE_ACTIVE: CONFIGRET = 0x00000036; +pub const CR_NO_SUCH_DEVICE_INTERFACE: CONFIGRET = 0x00000037; +pub const CR_INVALID_REFERENCE_STRING: CONFIGRET = 0x00000038; +pub const CR_INVALID_CONFLICT_LIST: CONFIGRET = 0x00000039; +pub const CR_INVALID_INDEX: CONFIGRET = 0x0000003A; +pub const CR_INVALID_STRUCTURE_SIZE: CONFIGRET = 0x0000003B; +pub const NUM_CR_RESULTS: CONFIGRET = 0x0000003C; diff --git a/third_party/rust/winapi/src/combaseapi.rs b/third_party/rust/winapi/src/combaseapi.rs new file mode 100644 index 000000000000..9233bc58a05e --- /dev/null +++ b/third_party/rust/winapi/src/combaseapi.rs @@ -0,0 +1,17 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +pub const CLSCTX_INPROC_SERVER: DWORD = 0x1; +pub const CLSCTX_INPROC_HANDLER: DWORD = 0x2; +pub const CLSCTX_LOCAL_SERVER: DWORD = 0x4; +pub const CLSCTX_REMOTE_SERVER: DWORD = 0x10; +pub const CLSCTX_SERVER: DWORD = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | + CLSCTX_REMOTE_SERVER; +pub const CLSCTX_ALL: DWORD = CLSCTX_INPROC_HANDLER | CLSCTX_SERVER; +STRUCT!{struct ServerInformation { + dwServerPid: DWORD, + dwServerTid: DWORD, + ui64ServerAddress: UINT64, +}} +pub type PServerInformation = *mut ServerInformation; +DECLARE_HANDLE!(CO_MTA_USAGE_COOKIE, CO_MTA_USAGE_COOKIE__); diff --git a/third_party/rust/winapi/src/commctrl.rs b/third_party/rust/winapi/src/commctrl.rs new file mode 100644 index 000000000000..88513e1170ae --- /dev/null +++ b/third_party/rust/winapi/src/commctrl.rs @@ -0,0 +1,3578 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//138 +STRUCT!{struct INITCOMMONCONTROLSEX { + dwSize: ::DWORD, + dwICC: ::DWORD, +}} +pub type LPINITCOMMONCONTROLSEX = *mut INITCOMMONCONTROLSEX; +pub const ICC_LISTVIEW_CLASSES: ::DWORD = 0x1; +pub const ICC_TREEVIEW_CLASSES: ::DWORD = 0x2; +pub const ICC_BAR_CLASSES: ::DWORD = 0x4; +pub const ICC_TAB_CLASSES: ::DWORD = 0x8; +pub const ICC_UPDOWN_CLASS: ::DWORD = 0x10; +pub const ICC_PROGRESS_CLASS: ::DWORD = 0x20; +pub const ICC_HOTKEY_CLASS: ::DWORD = 0x40; +pub const ICC_ANIMATE_CLASS: ::DWORD = 0x80; +pub const ICC_WIN95_CLASSES: ::DWORD = 0xFF; +pub const ICC_DATE_CLASSES: ::DWORD = 0x100; +pub const ICC_USEREX_CLASSES: ::DWORD = 0x200; +pub const ICC_COOL_CLASSES: ::DWORD = 0x400; +pub const ICC_INTERNET_CLASSES: ::DWORD = 0x800; +pub const ICC_PAGESCROLLER_CLASS: ::DWORD = 0x1000; +pub const ICC_NATIVEFNTCTL_CLASS: ::DWORD = 0x2000; +pub const ICC_STANDARD_CLASSES: ::DWORD = 0x4000; +pub const ICC_LINK_CLASS: ::DWORD = 0x8000; +pub const ODT_HEADER: ::UINT = 100; +pub const ODT_TAB: ::UINT = 101; +pub const ODT_LISTVIEW: ::UINT = 102; +pub const LVM_FIRST: ::UINT = 0x1000; +pub const TV_FIRST: ::UINT = 0x1100; +pub const HDM_FIRST: ::UINT = 0x1200; +pub const TCM_FIRST: ::UINT = 0x1300; +pub const PGM_FIRST: ::UINT = 0x1400; +pub const ECM_FIRST: ::UINT = 0x1500; +pub const BCM_FIRST: ::UINT = 0x1600; +pub const CBM_FIRST: ::UINT = 0x1700; +pub const CCM_FIRST: ::UINT = 0x2000; +pub const CCM_LAST: ::UINT = CCM_FIRST + 0x200; +pub const CCM_SETBKCOLOR: ::UINT = CCM_FIRST + 1; +STRUCT!{struct COLORSCHEME { + dwSize: ::DWORD, + clrBtnHighlight: ::COLORREF, + clrBtnShadow: ::COLORREF, +}} +pub type LPCOLORSCHEME = *mut COLORSCHEME; +pub const CCM_SETCOLORSCHEME: ::UINT = CCM_FIRST + 2; +pub const CCM_GETCOLORSCHEME: ::UINT = CCM_FIRST + 3; +pub const CCM_GETDROPTARGET: ::UINT = CCM_FIRST + 4; +pub const CCM_SETUNICODEFORMAT: ::UINT = CCM_FIRST + 5; +pub const CCM_GETUNICODEFORMAT: ::UINT = CCM_FIRST + 6; +pub const CCM_SETVERSION: ::UINT = CCM_FIRST + 7; +pub const CCM_GETVERSION: ::UINT = CCM_FIRST + 8; +pub const CCM_SETNOTIFYWINDOW: ::UINT = CCM_FIRST + 9; +pub const CCM_SETWINDOWTHEME: ::UINT = CCM_FIRST + 0xb; +pub const CCM_DPISCALE: ::UINT = CCM_FIRST + 0xc; +pub const INFOTIPSIZE: ::c_int = 1024; +pub const NM_OUTOFMEMORY: ::UINT = (NM_FIRST as ::INT - 1) as ::UINT; +pub const NM_CLICK: ::UINT = (NM_FIRST as ::INT - 2) as ::UINT; +pub const NM_DBLCLK: ::UINT = (NM_FIRST as ::INT - 3) as ::UINT; +pub const NM_RETURN: ::UINT = (NM_FIRST as ::INT - 4) as ::UINT; +pub const NM_RCLICK: ::UINT = (NM_FIRST as ::INT - 5) as ::UINT; +pub const NM_RDBLCLK: ::UINT = (NM_FIRST as ::INT - 6) as ::UINT; +pub const NM_SETFOCUS: ::UINT = (NM_FIRST as ::INT - 7) as ::UINT; +pub const NM_KILLFOCUS: ::UINT = (NM_FIRST as ::INT - 8) as ::UINT; +pub const NM_CUSTOMDRAW: ::UINT = (NM_FIRST as ::INT - 12) as ::UINT; +pub const NM_HOVER: ::UINT = (NM_FIRST as ::INT - 13) as ::UINT; +pub const NM_NCHITTEST: ::UINT = (NM_FIRST as ::INT - 14) as ::UINT; +pub const NM_KEYDOWN: ::UINT = (NM_FIRST as ::INT - 15) as ::UINT; +pub const NM_RELEASEDCAPTURE: ::UINT = (NM_FIRST as ::INT - 16) as ::UINT; +pub const NM_SETCURSOR: ::UINT = (NM_FIRST as ::INT - 17) as ::UINT; +pub const NM_CHAR: ::UINT = (NM_FIRST as ::INT - 18) as ::UINT; +pub const NM_TOOLTIPSCREATED: ::UINT = (NM_FIRST as ::INT - 19) as ::UINT; +pub const NM_LDOWN: ::UINT = (NM_FIRST as ::INT - 20) as ::UINT; +pub const NM_RDOWN: ::UINT = (NM_FIRST as ::INT - 21) as ::UINT; +pub const NM_THEMECHANGED: ::UINT = (NM_FIRST as ::INT - 22) as ::UINT; +pub const NM_FONTCHANGED: ::UINT = (NM_FIRST as ::INT - 23) as ::UINT; +pub const NM_CUSTOMTEXT: ::UINT = (NM_FIRST as ::INT - 24) as ::UINT; +pub const NM_TVSTATEIMAGECHANGING: ::UINT = (NM_FIRST as ::INT - 24) as ::UINT; +STRUCT!{struct NMTOOLTIPSCREATED { + hdr: ::NMHDR, + hwndToolTips: ::HWND, +}} +pub type LPNMTOOLTIPSCREATED = *mut NMTOOLTIPSCREATED; +STRUCT!{struct NMMOUSE { + hdr : ::NMHDR, + dwItemSpec: ::DWORD_PTR, + dwItemData: ::DWORD_PTR, + pt: ::POINT, + dwHitInfo: ::LPARAM, +}} +pub type LPNMMOUSE = *mut NMMOUSE; +pub type NMCLICK = NMMOUSE; +pub type LPNMCLICK = LPNMMOUSE; +STRUCT!{struct NMOBJECTNOTIFY { + hdr: ::NMHDR, + iItem: ::c_int, + piid: *const ::IID, + pObject: *mut ::c_void, + hResult: ::HRESULT, + dwFlags: ::DWORD, +}} +pub type LPNMOBJECTNOTIFY = *mut NMOBJECTNOTIFY; +STRUCT!{struct NMKEY { + hdr: ::NMHDR, + nVKey: ::UINT, + uFlags: ::UINT, +}} +pub type LPNMKEY = *mut NMKEY; +STRUCT!{struct NMCHAR { + hdr: ::NMHDR, + ch: ::UINT, + dwItemPrev: ::DWORD, + dwItemNext: ::DWORD, +}} +pub type LPNMCHAR = *mut NMCHAR; +STRUCT!{struct NMCUSTOMTEXT { + hdr: ::NMHDR, + hDC: ::HDC, + lpString: ::LPCWSTR, + nCount: ::c_int, + lpRect: ::LPRECT, + uFormat: ::UINT, + fLink: ::BOOL, +}} +pub type LPNMCUSTOMTEXT = *mut NMCUSTOMTEXT; +pub const NM_FIRST: ::UINT = 0; +pub const NM_LAST: ::UINT = -99i32 as ::UINT; +pub const LVN_FIRST: ::UINT = -100i32 as ::UINT; +pub const LVN_LAST: ::UINT = -199i32 as ::UINT; +pub const HDN_FIRST: ::UINT = -300i32 as ::UINT; +pub const HDN_LAST: ::UINT = -399i32 as ::UINT; +pub const TVN_FIRST: ::UINT = -400i32 as ::UINT; +pub const TVN_LAST: ::UINT = -499i32 as ::UINT; +pub const TTN_FIRST: ::UINT = -520i32 as ::UINT; +pub const TTN_LAST: ::UINT = -549i32 as ::UINT; +pub const TCN_FIRST: ::UINT = -550i32 as ::UINT; +pub const TCN_LAST: ::UINT = -580i32 as ::UINT; +// pub const CDN_FIRST: ::UINT = 0 - 601; +// pub const CDN_LAST: ::UINT = 0 - 699; +pub const TBN_FIRST: ::UINT = -700i32 as ::UINT; +pub const TBN_LAST: ::UINT = -720i32 as ::UINT; +pub const UDN_FIRST: ::UINT = -721i32 as ::UINT; +pub const UDN_LAST: ::UINT = -729i32 as ::UINT; +pub const DTN_FIRST: ::UINT = -740i32 as ::UINT; +pub const DTN_LAST: ::UINT = -745i32 as ::UINT; +pub const MCN_FIRST: ::UINT = -746i32 as ::UINT; +pub const MCN_LAST: ::UINT = -752i32 as ::UINT; +pub const DTN_FIRST2: ::UINT = -753i32 as ::UINT; +pub const DTN_LAST2: ::UINT = -799i32 as ::UINT; +pub const CBEN_FIRST: ::UINT = -800i32 as ::UINT; +pub const CBEN_LAST: ::UINT = -830i32 as ::UINT; +pub const RBN_FIRST: ::UINT = -831i32 as ::UINT; +pub const RBN_LAST: ::UINT = -859i32 as ::UINT; +pub const IPN_FIRST: ::UINT = -860i32 as ::UINT; +pub const IPN_LAST: ::UINT = -879i32 as ::UINT; +pub const SBN_FIRST: ::UINT = -880i32 as ::UINT; +pub const SBN_LAST: ::UINT = -899i32 as ::UINT; +pub const PGN_FIRST: ::UINT = -900i32 as ::UINT; +pub const PGN_LAST: ::UINT = -950i32 as ::UINT; +pub const WMN_FIRST: ::UINT = -1000i32 as ::UINT; +pub const WMN_LAST: ::UINT = -1200i32 as ::UINT; +pub const BCN_FIRST: ::UINT = -1250i32 as ::UINT; +pub const BCN_LAST: ::UINT = -1350i32 as ::UINT; +pub const TRBN_FIRST: ::UINT = -1501i32 as ::UINT; +pub const TRBN_LAST: ::UINT = -1519i32 as ::UINT; +pub const CDRF_DODEFAULT: ::LRESULT = 0x00000000; +pub const CDRF_NEWFONT: ::LRESULT = 0x00000002; +pub const CDRF_SKIPDEFAULT: ::LRESULT = 0x00000004; +pub const CDRF_DOERASE: ::LRESULT = 0x00000008; +pub const CDRF_SKIPPOSTPAINT: ::LRESULT = 0x00000100; +pub const CDRF_NOTIFYPOSTPAINT: ::LRESULT = 0x00000010; +pub const CDRF_NOTIFYITEMDRAW: ::LRESULT = 0x00000020; +pub const CDRF_NOTIFYSUBITEMDRAW: ::LRESULT = 0x00000020; +pub const CDRF_NOTIFYPOSTERASE: ::LRESULT = 0x00000040; +pub const CDDS_PREPAINT: ::DWORD = 0x00000001; +pub const CDDS_POSTPAINT: ::DWORD = 0x00000002; +pub const CDDS_PREERASE: ::DWORD = 0x00000003; +pub const CDDS_POSTERASE: ::DWORD = 0x00000004; +pub const CDDS_ITEM: ::DWORD = 0x00010000; +pub const CDDS_ITEMPREPAINT: ::DWORD = CDDS_ITEM | CDDS_PREPAINT; +pub const CDDS_ITEMPOSTPAINT: ::DWORD = CDDS_ITEM | CDDS_POSTPAINT; +pub const CDDS_ITEMPREERASE: ::DWORD = CDDS_ITEM | CDDS_PREERASE; +pub const CDDS_ITEMPOSTERASE: ::DWORD = CDDS_ITEM | CDDS_POSTERASE; +pub const CDDS_SUBITEM: ::DWORD = 0x00020000; +pub const CDIS_SELECTED: ::UINT = 0x0001; +pub const CDIS_GRAYED: ::UINT = 0x0002; +pub const CDIS_DISABLED: ::UINT = 0x0004; +pub const CDIS_CHECKED: ::UINT = 0x0008; +pub const CDIS_FOCUS: ::UINT = 0x0010; +pub const CDIS_DEFAULT: ::UINT = 0x0020; +pub const CDIS_HOT: ::UINT = 0x0040; +pub const CDIS_MARKED: ::UINT = 0x0080; +pub const CDIS_INDETERMINATE: ::UINT = 0x0100; +pub const CDIS_SHOWKEYBOARDCUES: ::UINT = 0x0200; +pub const CDIS_NEARHOT: ::UINT = 0x0400; +pub const CDIS_OTHERSIDEHOT: ::UINT = 0x0800; +pub const CDIS_DROPHILITED: ::UINT = 0x1000; +STRUCT!{struct NMCUSTOMDRAW { + hdr: ::NMHDR, + dwDrawStage: ::DWORD, + hdc: ::HDC, + rc: ::RECT, + dwItemSpec: ::DWORD_PTR, + uItemState: ::UINT, + lItemlParam: ::LPARAM, +}} +pub type LPNMCUSTOMDRAW = *mut NMCUSTOMDRAW; +STRUCT!{struct NMTTCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + uDrawFlags: ::UINT, +}} +pub type LPNMTTCUSTOMDRAW = *mut NMTTCUSTOMDRAW; +STRUCT!{struct NMCUSTOMSPLITRECTINFO { + hdr: ::NMHDR, + rcClient: ::RECT, + rcButton: ::RECT, + rcSplit: ::RECT, +}} +pub type LPNMCUSTOMSPLITRECTINFO = *mut NMCUSTOMSPLITRECTINFO; +pub const NM_GETCUSTOMSPLITRECT: ::UINT = BCN_FIRST + 0x0003; +pub const CLR_NONE: ::DWORD = 0xFFFFFFFF; +pub const CLR_DEFAULT: ::DWORD = 0xFF000000; +pub enum IMAGELIST {} +pub type HIMAGELIST = *mut IMAGELIST; +STRUCT!{struct IMAGELISTDRAWPARAMS { + cbSize: ::DWORD, + himl: HIMAGELIST, + i: ::c_int, + hdcDst: ::HDC, + x: ::c_int, + y: ::c_int, + cx: ::c_int, + cy: ::c_int, + xBitmap: ::c_int, + yBitmap: ::c_int, + rgbBk: ::COLORREF, + rgbFg: ::COLORREF, + fStyle: ::UINT, + dwRop: ::DWORD, + fState: ::DWORD, + Frame: ::DWORD, + crEffect: ::COLORREF, +}} +pub type LPIMAGELISTDRAWPARAMS = *mut IMAGELISTDRAWPARAMS; +pub const ILC_MASK: ::UINT = 0x00000001; +pub const ILC_COLOR: ::UINT = 0x00000000; +pub const ILC_COLORDDB: ::UINT = 0x000000FE; +pub const ILC_COLOR4: ::UINT = 0x00000004; +pub const ILC_COLOR8: ::UINT = 0x00000008; +pub const ILC_COLOR16: ::UINT = 0x00000010; +pub const ILC_COLOR24: ::UINT = 0x00000018; +pub const ILC_COLOR32: ::UINT = 0x00000020; +pub const ILC_PALETTE: ::UINT = 0x00000800; +pub const ILC_MIRROR: ::UINT = 0x00002000; +pub const ILC_PERITEMMIRROR: ::UINT = 0x00008000; +pub const ILC_ORIGINALSIZE: ::UINT = 0x00010000; +pub const ILC_HIGHQUALITYSCALE: ::UINT = 0x00020000; +pub const ILD_NORMAL: ::UINT = 0x00000000; +pub const ILD_TRANSPARENT: ::UINT = 0x00000001; +pub const ILD_MASK: ::UINT = 0x00000010; +pub const ILD_IMAGE: ::UINT = 0x00000020; +pub const ILD_ROP: ::UINT = 0x00000040; +pub const ILD_BLEND25: ::UINT = 0x00000002; +pub const ILD_BLEND50: ::UINT = 0x00000004; +pub const ILD_OVERLAYMASK: ::UINT = 0x00000F00; +#[inline] #[allow(dead_code)] +pub fn INDEXTOOVERLAYMASK(i: ::UINT) -> ::UINT { i << 8 } +pub const ILD_PRESERVEALPHA: ::UINT = 0x00001000; +pub const ILD_SCALE: ::UINT = 0x00002000; +pub const ILD_DPISCALE: ::UINT = 0x00004000; +pub const ILD_ASYNC: ::UINT = 0x00008000; +pub const ILD_SELECTED: ::UINT = ILD_BLEND50; +pub const ILD_FOCUS: ::UINT = ILD_BLEND25; +pub const ILD_BLEND: ::UINT = ILD_BLEND50; +pub const CLR_HILIGHT: ::DWORD = CLR_DEFAULT; +pub const ILS_NORMAL: ::DWORD = 0x00000000; +pub const ILS_GLOW: ::DWORD = 0x00000001; +pub const ILS_SHADOW: ::DWORD = 0x00000002; +pub const ILS_SATURATE: ::DWORD = 0x00000004; +pub const ILS_ALPHA: ::DWORD = 0x00000008; +pub const HBITMAP_CALLBACK: ::HBITMAP = (0-1) as ::HBITMAP; +pub const ILCF_MOVE: ::UINT = 0x00000000; +pub const ILCF_SWAP: ::UINT = 0x00000001; +STRUCT!{struct IMAGEINFO { + hbmImage: ::HBITMAP, + hbmMask: ::HBITMAP, + Unused1: ::c_int, + Unused2: ::c_int, + rcImage: ::RECT, +}} +pub type LPIMAGEINFO = *mut IMAGEINFO; +pub const HDS_HORZ: ::DWORD = 0x0000; +pub const HDS_BUTTONS: ::DWORD = 0x0002; +pub const HDS_HOTTRACK: ::DWORD = 0x0004; +pub const HDS_HIDDEN: ::DWORD = 0x0008; +pub const HDS_DRAGDROP: ::DWORD = 0x0040; +pub const HDS_FULLDRAG: ::DWORD = 0x0080; +pub const HDS_FILTERBAR: ::DWORD = 0x0100; +pub const HDS_FLAT: ::DWORD = 0x0200; +pub const HDS_CHECKBOXES: ::DWORD = 0x0400; +pub const HDS_NOSIZING: ::DWORD = 0x0800; +pub const HDS_OVERFLOW: ::DWORD = 0x1000; +pub const HDFT_ISSTRING: ::UINT = 0x0000; +pub const HDFT_ISNUMBER: ::UINT = 0x0001; +pub const HDFT_ISDATE: ::UINT = 0x0002; +pub const HDFT_HASNOVALUE: ::UINT = 0x8000; +STRUCT!{struct HD_TEXTFILTERA { + pszText: ::LPSTR, + cchTextMax: ::INT, +}} +pub type LPHD_TEXTFILTERA = *mut HD_TEXTFILTERA; +STRUCT!{struct HD_TEXTFILTERW { + pszText: ::LPWSTR, + cchTextMax: ::INT, +}} +pub type LPHD_TEXTFILTERW = *mut HD_TEXTFILTERW; +STRUCT!{struct HDITEMA { + mask: ::UINT, + cxy: ::c_int, + pszText: ::LPSTR, + hbm: ::HBITMAP, + cchTextMax: ::c_int, + fmt: ::c_int, + lParam: ::LPARAM, + iImage: ::c_int, + iOrder: ::c_int, + _type: ::UINT, + pvFilter: *mut ::c_void, + state: ::UINT, +}} +pub type LPHDITEMA = *mut HDITEMA; +STRUCT!{struct HDITEMW { + mask: ::UINT, + cxy: ::c_int, + pszText: ::LPWSTR, + hbm: ::HBITMAP, + cchTextMax: ::c_int, + fmt: ::c_int, + lParam: ::LPARAM, + iImage: ::c_int, + iOrder: ::c_int, + _type: ::UINT, + pvFilter: *mut ::c_void, + state: ::UINT, +}} +pub type LPHDITEMW = *mut HDITEMW; +pub const HDI_WIDTH: ::UINT = 0x0001; +pub const HDI_HEIGHT: ::UINT = HDI_WIDTH; +pub const HDI_TEXT: ::UINT = 0x0002; +pub const HDI_FORMAT: ::UINT = 0x0004; +pub const HDI_LPARAM: ::UINT = 0x0008; +pub const HDI_BITMAP: ::UINT = 0x0010; +pub const HDI_IMAGE: ::UINT = 0x0020; +pub const HDI_DI_SETITEM: ::UINT = 0x0040; +pub const HDI_ORDER: ::UINT = 0x0080; +pub const HDI_FILTER: ::UINT = 0x0100; +pub const HDI_STATE: ::UINT = 0x0200; +pub const HDF_LEFT: ::c_int = 0x0000; +pub const HDF_RIGHT: ::c_int = 0x0001; +pub const HDF_CENTER: ::c_int = 0x0002; +pub const HDF_JUSTIFYMASK: ::c_int = 0x0003; +pub const HDF_RTLREADING: ::c_int = 0x0004; +pub const HDF_BITMAP: ::c_int = 0x2000; +pub const HDF_STRING: ::c_int = 0x4000; +pub const HDF_OWNERDRAW: ::c_int = 0x8000; +pub const HDF_IMAGE: ::c_int = 0x0800; +pub const HDF_BITMAP_ON_RIGHT: ::c_int = 0x1000; +pub const HDF_SORTUP: ::c_int = 0x0400; +pub const HDF_SORTDOWN: ::c_int = 0x0200; +pub const HDF_CHECKBOX: ::c_int = 0x0040; +pub const HDF_CHECKED: ::c_int = 0x0080; +pub const HDF_FIXEDWIDTH: ::c_int = 0x0100; +pub const HDF_SPLITBUTTON: ::c_int = 0x1000000; +pub const HDIS_FOCUSED: ::UINT = 0x00000001; +pub const HDM_GETITEMCOUNT: ::UINT = HDM_FIRST + 0; +pub const HDM_INSERTITEMA: ::UINT = HDM_FIRST + 1; +pub const HDM_INSERTITEMW: ::UINT = HDM_FIRST + 10; +pub const HDM_DELETEITEM: ::UINT = HDM_FIRST + 2; +pub const HDM_GETITEMA: ::UINT = HDM_FIRST + 3; +pub const HDM_GETITEMW: ::UINT = HDM_FIRST + 11; +pub const HDM_SETITEMA: ::UINT = HDM_FIRST + 4; +pub const HDM_SETITEMW: ::UINT = HDM_FIRST + 12; +STRUCT!{struct HDLAYOUT { + prc: *mut ::RECT, + pwpos: *mut ::WINDOWPOS, +}} +pub type LPHDLAYOUT = *mut HDLAYOUT; +pub const HDM_LAYOUT: ::UINT = HDM_FIRST + 5; +pub const HHT_NOWHERE: ::UINT = 0x0001; +pub const HHT_ONHEADER: ::UINT = 0x0002; +pub const HHT_ONDIVIDER: ::UINT = 0x0004; +pub const HHT_ONDIVOPEN: ::UINT = 0x0008; +pub const HHT_ONFILTER: ::UINT = 0x0010; +pub const HHT_ONFILTERBUTTON: ::UINT = 0x0020; +pub const HHT_ABOVE: ::UINT = 0x0100; +pub const HHT_BELOW: ::UINT = 0x0200; +pub const HHT_TORIGHT: ::UINT = 0x0400; +pub const HHT_TOLEFT: ::UINT = 0x0800; +pub const HHT_ONITEMSTATEICON: ::UINT = 0x1000; +pub const HHT_ONDROPDOWN: ::UINT = 0x2000; +pub const HHT_ONOVERFLOW: ::UINT = 0x4000; +STRUCT!{struct HDHITTESTINFO { + pt: ::POINT, + flags: ::UINT, + iItem: ::c_int, +}} +pub type LPHDHITTESTINFO = *mut HDHITTESTINFO; +pub const HDSIL_NORMAL: ::WPARAM = 0; +pub const HDSIL_STATE: ::WPARAM = 1; +pub const HDM_HITTEST: ::UINT = HDM_FIRST + 6; +pub const HDM_GETITEMRECT: ::UINT = HDM_FIRST + 7; +pub const HDM_SETIMAGELIST: ::UINT = HDM_FIRST + 8; +pub const HDM_GETIMAGELIST: ::UINT = HDM_FIRST + 9; +pub const HDM_ORDERTOINDEX: ::UINT = HDM_FIRST + 15; +pub const HDM_CREATEDRAGIMAGE: ::UINT = HDM_FIRST + 16; +pub const HDM_GETORDERARRAY: ::UINT = HDM_FIRST + 17; +pub const HDM_SETORDERARRAY: ::UINT = HDM_FIRST + 18; +pub const HDM_SETHOTDIVIDER: ::UINT = HDM_FIRST + 19; +pub const HDM_SETBITMAPMARGIN: ::UINT = HDM_FIRST + 20; +pub const HDM_GETBITMAPMARGIN: ::UINT = HDM_FIRST + 21; +pub const HDM_SETFILTERCHANGETIMEOUT: ::UINT = HDM_FIRST + 22; +pub const HDM_EDITFILTER: ::UINT = HDM_FIRST + 23; +pub const HDM_CLEARFILTER: ::UINT = HDM_FIRST + 24; +pub const HDM_GETITEMDROPDOWNRECT: ::UINT = HDM_FIRST + 25; +pub const HDM_GETOVERFLOWRECT: ::UINT = HDM_FIRST + 26; +pub const HDM_GETFOCUSEDITEM: ::UINT = HDM_FIRST + 27; +pub const HDM_SETFOCUSEDITEM: ::UINT = HDM_FIRST + 28; +pub const HDN_ITEMCHANGINGA: ::UINT = HDN_FIRST-0; +pub const HDN_ITEMCHANGINGW: ::UINT = HDN_FIRST-20; +pub const HDN_ITEMCHANGEDA: ::UINT = HDN_FIRST-1; +pub const HDN_ITEMCHANGEDW: ::UINT = HDN_FIRST-21; +pub const HDN_ITEMCLICKA: ::UINT = HDN_FIRST-2; +pub const HDN_ITEMCLICKW: ::UINT = HDN_FIRST-22; +pub const HDN_ITEMDBLCLICKA: ::UINT = HDN_FIRST-3; +pub const HDN_ITEMDBLCLICKW: ::UINT = HDN_FIRST-23; +pub const HDN_DIVIDERDBLCLICKA: ::UINT = HDN_FIRST-5; +pub const HDN_DIVIDERDBLCLICKW: ::UINT = HDN_FIRST-25; +pub const HDN_BEGINTRACKA: ::UINT = HDN_FIRST-6; +pub const HDN_BEGINTRACKW: ::UINT = HDN_FIRST-26; +pub const HDN_ENDTRACKA: ::UINT = HDN_FIRST-7; +pub const HDN_ENDTRACKW: ::UINT = HDN_FIRST-27; +pub const HDN_TRACKA: ::UINT = HDN_FIRST-8; +pub const HDN_TRACKW: ::UINT = HDN_FIRST-28; +pub const HDN_GETDISPINFOA: ::UINT = HDN_FIRST-9; +pub const HDN_GETDISPINFOW: ::UINT = HDN_FIRST-29; +pub const HDN_BEGINDRAG: ::UINT = HDN_FIRST-10; +pub const HDN_ENDDRAG: ::UINT = HDN_FIRST-11; +pub const HDN_FILTERCHANGE: ::UINT = HDN_FIRST-12; +pub const HDN_FILTERBTNCLICK: ::UINT = HDN_FIRST-13; +pub const HDN_BEGINFILTEREDIT: ::UINT = HDN_FIRST-14; +pub const HDN_ENDFILTEREDIT: ::UINT = HDN_FIRST-15; +pub const HDN_ITEMSTATEICONCLICK: ::UINT = HDN_FIRST-16; +pub const HDN_ITEMKEYDOWN: ::UINT = HDN_FIRST-17; +pub const HDN_DROPDOWN: ::UINT = HDN_FIRST-18; +pub const HDN_OVERFLOWCLICK: ::UINT = HDN_FIRST-19; +STRUCT!{struct NMHEADERA { + hdr: ::NMHDR, + iItem: ::c_int, + iButton: ::c_int, + pitem: *mut HDITEMA, +}} +pub type LPNMHEADERA = *mut NMHEADERA; +STRUCT!{struct NMHEADERW { + hdr: ::NMHDR, + iItem: ::c_int, + iButton: ::c_int, + pitem: *mut HDITEMW, +}} +pub type LPNMHEADERW = *mut NMHEADERW; +STRUCT!{struct NMHDDISPINFOW { + hdr: ::NMHDR, + iItem: ::c_int, + mask: ::UINT, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + lParam: ::LPARAM, +}} +pub type LPNMHDDISPINFOW = *mut NMHDDISPINFOW; +STRUCT!{struct NMHDDISPINFOA { + hdr: ::NMHDR, + iItem: ::c_int, + mask: ::UINT, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + lParam: ::LPARAM, +}} +pub type LPNMHDDISPINFOA = *mut NMHDDISPINFOA; +STRUCT!{struct NMHDFILTERBTNCLICK { + hdr: ::NMHDR, + iItem: ::INT, + rc: ::RECT, +}} +pub type LPNMHDFILTERBTNCLICK = *mut NMHDFILTERBTNCLICK; +#[cfg(target_arch="x86")] +STRUCT!{struct TBBUTTON { + iBitmap: ::c_int, + idCommand: ::c_int, + fsState: ::BYTE, + fsStyle: ::BYTE, + bReserved: [::BYTE; 2], + dwData: ::DWORD_PTR, + iString: ::INT_PTR, +}} +#[cfg(target_arch="x86_64")] +STRUCT!{struct TBBUTTON { + iBitmap: ::c_int, + idCommand: ::c_int, + fsState: ::BYTE, + fsStyle: ::BYTE, + bReserved: [::BYTE; 6], + dwData: ::DWORD_PTR, + iString: ::INT_PTR, +}} +pub type PTBBUTTON = *mut TBBUTTON; +pub type LPTBBUTTON = *mut TBBUTTON; +pub type LPCTBBUTTON = *const TBBUTTON; +STRUCT!{struct COLORMAP { + from: ::COLORREF, + to: ::COLORREF, +}} +pub type LPCOLORMAP = *mut COLORMAP; +pub const CMB_MASKED: ::UINT = 0x02; +pub const TBSTATE_CHECKED: ::BYTE = 0x01; +pub const TBSTATE_PRESSED: ::BYTE = 0x02; +pub const TBSTATE_ENABLED: ::BYTE = 0x04; +pub const TBSTATE_HIDDEN: ::BYTE = 0x08; +pub const TBSTATE_INDETERMINATE: ::BYTE = 0x10; +pub const TBSTATE_WRAP: ::BYTE = 0x20; +pub const TBSTATE_ELLIPSES: ::BYTE = 0x40; +pub const TBSTATE_MARKED: ::BYTE = 0x80; +pub const TBSTYLE_BUTTON: ::DWORD = 0x0000; +pub const TBSTYLE_SEP: ::DWORD = 0x0001; +pub const TBSTYLE_CHECK: ::DWORD = 0x0002; +pub const TBSTYLE_GROUP: ::DWORD = 0x0004; +pub const TBSTYLE_CHECKGROUP: ::DWORD = TBSTYLE_GROUP | TBSTYLE_CHECK; +pub const TBSTYLE_DROPDOWN: ::DWORD = 0x0008; +pub const TBSTYLE_AUTOSIZE: ::DWORD = 0x0010; +pub const TBSTYLE_NOPREFIX: ::DWORD = 0x0020; +pub const TBSTYLE_TOOLTIPS: ::DWORD = 0x0100; +pub const TBSTYLE_WRAPABLE: ::DWORD = 0x0200; +pub const TBSTYLE_ALTDRAG: ::DWORD = 0x0400; +pub const TBSTYLE_FLAT: ::DWORD = 0x0800; +pub const TBSTYLE_LIST: ::DWORD = 0x1000; +pub const TBSTYLE_CUSTOMERASE: ::DWORD = 0x2000; +pub const TBSTYLE_REGISTERDROP: ::DWORD = 0x4000; +pub const TBSTYLE_TRANSPARENT: ::DWORD = 0x8000; +pub const TBSTYLE_EX_DRAWDDARROWS: ::DWORD = 0x00000001; +pub const BTNS_BUTTON: ::DWORD = TBSTYLE_BUTTON; +pub const BTNS_SEP: ::DWORD = TBSTYLE_SEP; +pub const BTNS_CHECK: ::DWORD = TBSTYLE_CHECK; +pub const BTNS_GROUP: ::DWORD = TBSTYLE_GROUP; +pub const BTNS_CHECKGROUP: ::DWORD = TBSTYLE_CHECKGROUP; +pub const BTNS_DROPDOWN: ::DWORD = TBSTYLE_DROPDOWN; +pub const BTNS_AUTOSIZE: ::DWORD = TBSTYLE_AUTOSIZE; +pub const BTNS_NOPREFIX: ::DWORD = TBSTYLE_NOPREFIX; +pub const BTNS_SHOWTEXT: ::DWORD = 0x0040; +pub const BTNS_WHOLEDROPDOWN: ::DWORD = 0x0080; +pub const TBSTYLE_EX_MIXEDBUTTONS: ::DWORD = 0x00000008; +pub const TBSTYLE_EX_HIDECLIPPEDBUTTONS: ::DWORD = 0x00000010; +pub const TBSTYLE_EX_MULTICOLUMN: ::DWORD = 0x00000002; +pub const TBSTYLE_EX_VERTICAL: ::DWORD = 0x00000004; +pub const TBSTYLE_EX_DOUBLEBUFFER: ::DWORD = 0x00000080; +STRUCT!{struct NMTBCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + hbrMonoDither: ::HBRUSH, + hbrLines: ::HBRUSH, + hpenLines: ::HPEN, + clrText: ::COLORREF, + clrMark: ::COLORREF, + clrTextHighlight: ::COLORREF, + clrBtnFace: ::COLORREF, + clrBtnHighlight: ::COLORREF, + clrHighlightHotTrack: ::COLORREF, + rcText: ::RECT, + nStringBkMode: ::c_int, + nHLStringBkMode: ::c_int, + iListGap: ::c_int, +}} +pub type LPNMTBCUSTOMDRAW = *mut NMTBCUSTOMDRAW; +pub const TBCDRF_NOEDGES: ::LRESULT = 0x00010000; +pub const TBCDRF_HILITEHOTTRACK: ::LRESULT = 0x00020000; +pub const TBCDRF_NOOFFSET: ::LRESULT = 0x00040000; +pub const TBCDRF_NOMARK: ::LRESULT = 0x00080000; +pub const TBCDRF_NOETCHEDEFFECT: ::LRESULT = 0x00100000; +pub const TBCDRF_BLENDICON: ::LRESULT = 0x00200000; +pub const TBCDRF_NOBACKGROUND: ::LRESULT = 0x00400000; +pub const TBCDRF_USECDCOLORS: ::LRESULT = 0x00800000; +pub const TB_ENABLEBUTTON: ::UINT = ::WM_USER + 1; +pub const TB_CHECKBUTTON: ::UINT = ::WM_USER + 2; +pub const TB_PRESSBUTTON: ::UINT = ::WM_USER + 3; +pub const TB_HIDEBUTTON: ::UINT = ::WM_USER + 4; +pub const TB_INDETERMINATE: ::UINT = ::WM_USER + 5; +pub const TB_MARKBUTTON: ::UINT = ::WM_USER + 6; +pub const TB_ISBUTTONENABLED: ::UINT = ::WM_USER + 9; +pub const TB_ISBUTTONCHECKED: ::UINT = ::WM_USER + 10; +pub const TB_ISBUTTONPRESSED: ::UINT = ::WM_USER + 11; +pub const TB_ISBUTTONHIDDEN: ::UINT = ::WM_USER + 12; +pub const TB_ISBUTTONINDETERMINATE : ::UINT = ::WM_USER + 13; +pub const TB_ISBUTTONHIGHLIGHTED: ::UINT = ::WM_USER + 14; +pub const TB_SETSTATE: ::UINT = ::WM_USER + 17; +pub const TB_GETSTATE: ::UINT = ::WM_USER + 18; +pub const TB_ADDBITMAP: ::UINT = ::WM_USER + 19; +STRUCT!{struct TBADDBITMAP { + hInst: ::HINSTANCE, + nID: ::UINT_PTR, +}} +pub type LPTBADDBITMAP = *mut TBADDBITMAP; +pub const HINST_COMMCTRL: ::HINSTANCE = (0 - 1) as ::HINSTANCE; +pub const IDB_STD_SMALL_COLOR: ::WPARAM = 0; +pub const IDB_STD_LARGE_COLOR: ::WPARAM = 1; +pub const IDB_VIEW_SMALL_COLOR: ::WPARAM = 4; +pub const IDB_VIEW_LARGE_COLOR: ::WPARAM = 5; +pub const IDB_HIST_SMALL_COLOR: ::WPARAM = 8; +pub const IDB_HIST_LARGE_COLOR: ::WPARAM = 9; +pub const IDB_HIST_NORMAL: ::WPARAM = 12; +pub const IDB_HIST_HOT: ::WPARAM = 13; +pub const IDB_HIST_DISABLED: ::WPARAM = 14; +pub const IDB_HIST_PRESSED: ::WPARAM = 15; +pub const STD_CUT: ::c_int = 0; +pub const STD_COPY: ::c_int = 1; +pub const STD_PASTE: ::c_int = 2; +pub const STD_UNDO: ::c_int = 3; +pub const STD_REDOW: ::c_int = 4; +pub const STD_DELETE: ::c_int = 5; +pub const STD_FILENEW: ::c_int = 6; +pub const STD_FILEOPEN: ::c_int = 7; +pub const STD_FILESAVE: ::c_int = 8; +pub const STD_PRINTPRE: ::c_int = 9; +pub const STD_PROPERTIES: ::c_int = 10; +pub const STD_HELP: ::c_int = 11; +pub const STD_FIND: ::c_int = 12; +pub const STD_REPLACE: ::c_int = 13; +pub const STD_PRINT: ::c_int = 14; +pub const VIEW_LARGEICONS: ::c_int = 0; +pub const VIEW_SMALLICONS: ::c_int = 1; +pub const VIEW_LIST: ::c_int = 2; +pub const VIEW_DETAILS: ::c_int = 3; +pub const VIEW_SORTNAME: ::c_int = 4; +pub const VIEW_SORTSIZE: ::c_int = 5; +pub const VIEW_SORTDATE: ::c_int = 6; +pub const VIEW_SORTTYPE: ::c_int = 7; +pub const VIEW_PARENTFOLDER: ::c_int = 8; +pub const VIEW_NETCONNECT: ::c_int = 9; +pub const VIEW_NETDISCONNECT: ::c_int = 10; +pub const VIEW_NEWFOLDER: ::c_int = 11; +pub const VIEW_VIEWMENU: ::c_int = 12; +pub const HIST_BACK: ::c_int = 0; +pub const HIST_FORWARD: ::c_int = 1; +pub const HIST_FAVORITES: ::c_int = 2; +pub const HIST_ADDTOFAVORITES: ::c_int = 3; +pub const HIST_VIEWTREE: ::c_int = 4; +pub const TB_ADDBUTTONSA: ::UINT = ::WM_USER + 20; +pub const TB_INSERTBUTTONA: ::UINT = ::WM_USER + 21; +pub const TB_DELETEBUTTON: ::UINT = ::WM_USER + 22; +pub const TB_GETBUTTON: ::UINT = ::WM_USER + 23; +pub const TB_BUTTONCOUNT: ::UINT = ::WM_USER + 24; +pub const TB_COMMANDTOINDEX: ::UINT = ::WM_USER + 25; +STRUCT!{struct TBSAVEPARAMSA { + hkr: ::HKEY, + pszSubKey: ::LPCSTR, + pszValueName: ::LPCSTR, +}} +pub type LPTBSAVEPARAMSA = *mut TBSAVEPARAMSA; +STRUCT!{struct TBSAVEPARAMSW { + hkr: ::HKEY, + pszSubKey: ::LPCWSTR, + pszValueName: ::LPCWSTR, +}} +pub type LPTBSAVEPARAMSW = *mut TBSAVEPARAMSW; +pub const TB_SAVERESTOREA: ::UINT = ::WM_USER + 26; +pub const TB_SAVERESTOREW: ::UINT = ::WM_USER + 76; +pub const TB_CUSTOMIZE: ::UINT = ::WM_USER + 27; +pub const TB_ADDSTRINGA: ::UINT = ::WM_USER + 28; +pub const TB_ADDSTRINGW: ::UINT = ::WM_USER + 77; +pub const TB_GETITEMRECT: ::UINT = ::WM_USER + 29; +pub const TB_BUTTONSTRUCTSIZE: ::UINT = ::WM_USER + 30; +pub const TB_SETBUTTONSIZE: ::UINT = ::WM_USER + 31; +pub const TB_SETBITMAPSIZE: ::UINT = ::WM_USER + 32; +pub const TB_AUTOSIZE: ::UINT = ::WM_USER + 33; +pub const TB_GETTOOLTIPS: ::UINT = ::WM_USER + 35; +pub const TB_SETTOOLTIPS: ::UINT = ::WM_USER + 36; +pub const TB_SETPARENT: ::UINT = ::WM_USER + 37; +pub const TB_SETROWS: ::UINT = ::WM_USER + 39; +pub const TB_GETROWS: ::UINT = ::WM_USER + 40; +pub const TB_SETCMDID: ::UINT = ::WM_USER + 42; +pub const TB_CHANGEBITMAP: ::UINT = ::WM_USER + 43; +pub const TB_GETBITMAP: ::UINT = ::WM_USER + 44; +pub const TB_GETBUTTONTEXTA: ::UINT = ::WM_USER + 45; +pub const TB_GETBUTTONTEXTW: ::UINT = ::WM_USER + 75; +pub const TB_REPLACEBITMAP: ::UINT = ::WM_USER + 46; +pub const TB_SETINDENT: ::UINT = ::WM_USER + 47; +pub const TB_SETIMAGELIST: ::UINT = ::WM_USER + 48; +pub const TB_GETIMAGELIST: ::UINT = ::WM_USER + 49; +pub const TB_LOADIMAGES: ::UINT = ::WM_USER + 50; +pub const TB_GETRECT: ::UINT = ::WM_USER + 51; +pub const TB_SETHOTIMAGELIST: ::UINT = ::WM_USER + 52; +pub const TB_GETHOTIMAGELIST: ::UINT = ::WM_USER + 53; +pub const TB_SETDISABLEDIMAGELIST: ::UINT = ::WM_USER + 54; +pub const TB_GETDISABLEDIMAGELIST: ::UINT = ::WM_USER + 55; +pub const TB_SETSTYLE: ::UINT = ::WM_USER + 56; +pub const TB_GETSTYLE: ::UINT = ::WM_USER + 57; +pub const TB_GETBUTTONSIZE: ::UINT = ::WM_USER + 58; +pub const TB_SETBUTTONWIDTH: ::UINT = ::WM_USER + 59; +pub const TB_SETMAXTEXTROWS: ::UINT = ::WM_USER + 60; +pub const TB_GETTEXTROWS: ::UINT = ::WM_USER + 61; +pub const TB_GETOBJECT: ::UINT = ::WM_USER + 62; +pub const TB_GETHOTITEM: ::UINT = ::WM_USER + 71; +pub const TB_SETHOTITEM: ::UINT = ::WM_USER + 72; +pub const TB_SETANCHORHIGHLIGHT: ::UINT = ::WM_USER + 73; +pub const TB_GETANCHORHIGHLIGHT: ::UINT = ::WM_USER + 74; +pub const TB_MAPACCELERATORA: ::UINT = ::WM_USER + 78; +STRUCT!{struct TBINSERTMARK { + iButton: ::c_int, + dwFlags: ::DWORD, +}} +pub type LPTBINSERTMARK = *mut TBINSERTMARK; +pub const TBIMHT_AFTER: ::DWORD = 0x00000001; +pub const TBIMHT_BACKGROUND: ::DWORD = 0x00000002; +pub const TB_GETINSERTMARK: ::UINT = ::WM_USER + 79; +pub const TB_SETINSERTMARK: ::UINT = ::WM_USER + 80; +pub const TB_INSERTMARKHITTEST: ::UINT = ::WM_USER + 81; +pub const TB_MOVEBUTTON: ::UINT = ::WM_USER + 82; +pub const TB_GETMAXSIZE: ::UINT = ::WM_USER + 83; +pub const TB_SETEXTENDEDSTYLE: ::UINT = ::WM_USER + 84; +pub const TB_GETEXTENDEDSTYLE: ::UINT = ::WM_USER + 85; +pub const TB_GETPADDING: ::UINT = ::WM_USER + 86; +pub const TB_SETPADDING: ::UINT = ::WM_USER + 87; +pub const TB_SETINSERTMARKCOLOR: ::UINT = ::WM_USER + 88; +pub const TB_GETINSERTMARKCOLOR: ::UINT = ::WM_USER + 89; +pub const TB_SETCOLORSCHEME: ::UINT = CCM_SETCOLORSCHEME; +pub const TB_GETCOLORSCHEME: ::UINT = CCM_GETCOLORSCHEME; +pub const TB_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const TB_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const TB_MAPACCELERATORW: ::UINT = ::WM_USER + 90; +STRUCT!{struct TBREPLACEBITMAP { + hInstOld: ::HINSTANCE, + nIDOld: ::UINT_PTR, + hInstNew: ::HINSTANCE, + nIDNew: ::UINT_PTR, + nButtons: ::c_int, +}} +pub type LPTBREPLACEBITMAP = *mut TBREPLACEBITMAP; +pub const TBBF_LARGE: ::DWORD = 0x0001; +pub const TB_GETBITMAPFLAGS: ::UINT = ::WM_USER + 41; +pub const TBIF_IMAGE: ::DWORD = 0x00000001; +pub const TBIF_TEXT: ::DWORD = 0x00000002; +pub const TBIF_STATE: ::DWORD = 0x00000004; +pub const TBIF_STYLE: ::DWORD = 0x00000008; +pub const TBIF_LPARAM: ::DWORD = 0x00000010; +pub const TBIF_COMMAND: ::DWORD = 0x00000020; +pub const TBIF_SIZE: ::DWORD = 0x00000040; +pub const TBIF_BYINDEX: ::DWORD = 0x80000000; +STRUCT!{struct TBBUTTONINFOA { + cbSize: ::UINT, + dwMask: ::DWORD, + idCommand: ::c_int, + iImage: ::c_int, + fsState: ::BYTE, + fsStyle: ::BYTE, + cx: ::WORD, + lParam: ::DWORD_PTR, + pszText: ::LPSTR, + cchText: ::c_int, +}} +pub type LPTBBUTTONINFOA = *mut TBBUTTONINFOA; +STRUCT!{struct TBBUTTONINFOW { + cbSize: ::UINT, + dwMask: ::DWORD, + idCommand: ::c_int, + iImage: ::c_int, + fsState: ::BYTE, + fsStyle: ::BYTE, + cx: ::WORD, + lParam: ::DWORD_PTR, + pszText: ::LPWSTR, + cchText: ::c_int, +}} +pub type LPTBBUTTONINFOW = *mut TBBUTTONINFOW; +pub const TB_GETBUTTONINFOW: ::UINT = ::WM_USER + 63; +pub const TB_SETBUTTONINFOW: ::UINT = ::WM_USER + 64; +pub const TB_GETBUTTONINFOA: ::UINT = ::WM_USER + 65; +pub const TB_SETBUTTONINFOA: ::UINT = ::WM_USER + 66; +pub const TB_INSERTBUTTONW: ::UINT = ::WM_USER + 67; +pub const TB_ADDBUTTONSW: ::UINT = ::WM_USER + 68; +pub const TB_HITTEST: ::UINT = ::WM_USER + 69; +pub const TB_SETDRAWTEXTFLAGS: ::UINT = ::WM_USER + 70; +pub const TB_GETSTRINGW: ::UINT = ::WM_USER + 91; +pub const TB_GETSTRINGA: ::UINT = ::WM_USER + 92; +pub const TB_SETBOUNDINGSIZE: ::UINT = ::WM_USER + 93; +pub const TB_SETHOTITEM2: ::UINT = ::WM_USER + 94; +pub const TB_HASACCELERATOR: ::UINT = ::WM_USER + 95; +pub const TB_SETLISTGAP: ::UINT = ::WM_USER + 96; +pub const TB_GETIMAGELISTCOUNT: ::UINT = ::WM_USER + 98; +pub const TB_GETIDEALSIZE: ::UINT = ::WM_USER + 99; +pub const TBMF_PAD: ::DWORD = 0x00000001; +pub const TBMF_BARPAD: ::DWORD = 0x00000002; +pub const TBMF_BUTTONSPACING: ::DWORD = 0x00000004; +STRUCT!{struct TBMETRICS { + cbSize: ::UINT, + dwMask: ::DWORD, + cxPad: ::c_int, + cyPad: ::c_int, + cxBarPad: ::c_int, + cyBarPad: ::c_int, + cxButtonSpacing: ::c_int, + cyButtonSpacing: ::c_int, +}} +pub type LPTBMETRICS = *mut TBMETRICS; +pub const TB_GETMETRICS: ::UINT = ::WM_USER + 101; +pub const TB_SETMETRICS: ::UINT = ::WM_USER + 102; +pub const TB_GETITEMDROPDOWNRECT: ::UINT = ::WM_USER + 103; +pub const TB_SETPRESSEDIMAGELIST: ::UINT = ::WM_USER + 104; +pub const TB_GETPRESSEDIMAGELIST: ::UINT = ::WM_USER + 105; +pub const TB_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; +pub const TBN_GETBUTTONINFOA: ::UINT = TBN_FIRST - 0; +pub const TBN_BEGINDRAG: ::UINT = TBN_FIRST - 1; +pub const TBN_ENDDRAG: ::UINT = TBN_FIRST - 2; +pub const TBN_BEGINADJUST: ::UINT = TBN_FIRST - 3; +pub const TBN_ENDADJUST: ::UINT = TBN_FIRST - 4; +pub const TBN_RESET: ::UINT = TBN_FIRST - 5; +pub const TBN_QUERYINSERT: ::UINT = TBN_FIRST - 6; +pub const TBN_QUERYDELETE: ::UINT = TBN_FIRST - 7; +pub const TBN_TOOLBARCHANGE: ::UINT = TBN_FIRST - 8; +pub const TBN_CUSTHELP: ::UINT = TBN_FIRST - 9; +pub const TBN_DROPDOWN: ::UINT = TBN_FIRST - 10; +pub const TBN_GETOBJECT: ::UINT = TBN_FIRST - 12; +STRUCT!{struct NMTBHOTITEM { + hdr: ::NMHDR, + idOld: ::c_int, + idNew: ::c_int, + dwFlags: ::DWORD, +}} +pub type LPNMTBHOTITEM = *mut NMTBHOTITEM; +pub const HICF_OTHER: ::DWORD = 0x00000000; +pub const HICF_MOUSE: ::DWORD = 0x00000001; +pub const HICF_ARROWKEYS: ::DWORD = 0x00000002; +pub const HICF_ACCELERATOR: ::DWORD = 0x00000004; +pub const HICF_DUPACCEL: ::DWORD = 0x00000008; +pub const HICF_ENTERING: ::DWORD = 0x00000010; +pub const HICF_LEAVING: ::DWORD = 0x00000020; +pub const HICF_RESELECT: ::DWORD = 0x00000040; +pub const HICF_LMOUSE: ::DWORD = 0x00000080; +pub const HICF_TOGGLEDROPDOWN: ::DWORD = 0x00000100; +pub const TBN_HOTITEMCHANGE: ::UINT = TBN_FIRST - 13; +pub const TBN_DRAGOUT: ::UINT = TBN_FIRST - 14; +pub const TBN_DELETINGBUTTON: ::UINT = TBN_FIRST - 15; +pub const TBN_GETDISPINFOA: ::UINT = TBN_FIRST - 16; +pub const TBN_GETDISPINFOW: ::UINT = TBN_FIRST - 17; +pub const TBN_GETINFOTIPA: ::UINT = TBN_FIRST - 18; +pub const TBN_GETINFOTIPW: ::UINT = TBN_FIRST - 19; +pub const TBN_GETBUTTONINFOW: ::UINT = TBN_FIRST - 20; +pub const TBN_RESTORE: ::UINT = TBN_FIRST - 21; +pub const TBN_SAVE: ::UINT = TBN_FIRST - 22; +pub const TBN_INITCUSTOMIZE: ::UINT = TBN_FIRST - 23; +pub const TBN_WRAPHOTITEM: ::UINT = TBN_FIRST - 24; +pub const TBN_DUPACCELERATOR: ::UINT = TBN_FIRST - 25; +pub const TBN_WRAPACCELERATOR: ::UINT = TBN_FIRST - 26; +pub const TBN_DRAGOVER: ::UINT = TBN_FIRST - 27; +pub const TBN_MAPACCELERATOR: ::UINT = TBN_FIRST - 28; +pub const TBNRF_HIDEHELP: ::LRESULT = 0x00000001; +pub const TBNRF_ENDCUSTOMIZE: ::LRESULT = 0x00000002; +STRUCT!{struct NMTBSAVE { + hdr: ::NMHDR, + pData: *mut ::DWORD, + pCurrent: *mut ::DWORD, + cbData: ::UINT, + iItem: ::c_int, + cButtons: ::c_int, + tbButton: TBBUTTON, +}} +pub type LPNMTBSAVE = *mut NMTBSAVE; +STRUCT!{struct NMTBRESTORE { + hdr: ::NMHDR, + pData: *mut ::DWORD, + pCurrent: *mut ::DWORD, + cbData: ::UINT, + iItem: ::c_int, + cButtons: ::c_int, + cbBytesPerRecord: ::c_int, + tbButton: TBBUTTON, +}} +pub type LPNMTBRESTORE = *mut NMTBRESTORE; +STRUCT!{struct NMTBGETINFOTIPA { + hdr: ::NMHDR, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iItem: ::c_int, + lParal: ::LPARAM, +}} +pub type LPNMTBGETINFOTIPA = *mut NMTBGETINFOTIPA; +STRUCT!{struct NMTBGETINFOTIPW { + hdr: ::NMHDR, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iItem: ::c_int, + lParal: ::LPARAM, +}} +pub type LPNMTBGETINFOTIPW = *mut NMTBGETINFOTIPW; +pub const TBNF_IMAGE: ::DWORD = 0x00000001; +pub const TBNF_TEXT: ::DWORD = 0x00000002; +pub const TBNF_DI_SETITEM: ::DWORD = 0x10000000; +STRUCT!{struct NMTBDISPINFOA { + hdr: ::NMHDR, + dwMask: ::DWORD, + idCommand: ::c_int, + lParam: ::DWORD_PTR, + iImage: ::c_int, + pszText: ::LPSTR, + cchText: ::c_int, +}} +pub type LPNMTBDISPINFOA = *mut NMTBDISPINFOA; +STRUCT!{struct NMTBDISPINFOW { + hdr: ::NMHDR, + dwMask: ::DWORD, + idCommand: ::c_int, + lParam: ::DWORD_PTR, + iImage: ::c_int, + pszText: ::LPWSTR, + cchText: ::c_int, +}} +pub type LPNMTBDISPINFOW = *mut NMTBDISPINFOW; +pub const TBDDRET_DEFAULT: ::LRESULT = 0; +pub const TBDDRET_NODEFAULT: ::LRESULT = 1; +pub const TBDDRET_TREATPRESSED: ::LRESULT = 2; +pub type TBNOTIFYA = NMTOOLBARA; +pub type TBNOTIFYW = NMTOOLBARW; +pub type LPTBNOTIFYA = LPNMTOOLBARA; +pub type LPTBNOTIFYW = LPNMTOOLBARW; +STRUCT!{struct NMTOOLBARA { + hdr: ::NMHDR, + iItem: ::c_int, + tbButton: TBBUTTON, + cchText: ::c_int, + pszText: ::LPSTR, + rcButton: ::RECT, +}} +pub type LPNMTOOLBARA = *mut NMTOOLBARA; +STRUCT!{struct NMTOOLBARW { + hdr: ::NMHDR, + iItem: ::c_int, + tbButton: TBBUTTON, + cchText: ::c_int, + pszText: ::LPWSTR, + rcButton: ::RECT, +}} +pub type LPNMTOOLBARW = *mut NMTOOLBARW; +pub const RBIM_IMAGELIST: ::UINT = 0x00000001; +pub const RBS_TOOLTIPS: ::DWORD = 0x00000100; +pub const RBS_VARHEIGHT: ::DWORD = 0x00000200; +pub const RBS_BANDBORDERS: ::DWORD = 0x00000400; +pub const RBS_FIXEDORDER: ::DWORD = 0x00000800; +pub const RBS_REGISTERDROP: ::DWORD = 0x00001000; +pub const RBS_AUTOSIZE: ::DWORD = 0x00002000; +pub const RBS_VERTICALGRIPPER: ::DWORD = 0x00004000; +pub const RBS_DBLCLKTOGGLE: ::DWORD = 0x00008000; +STRUCT!{struct REBARINFO { + cbSize: ::UINT, + fMask: ::UINT, + himl: HIMAGELIST, +}} +pub type LPREBARINFO = *mut REBARINFO; +pub const RBBS_BREAK: ::UINT = 0x00000001; +pub const RBBS_FIXEDSIZE: ::UINT = 0x00000002; +pub const RBBS_CHILDEDGE: ::UINT = 0x00000004; +pub const RBBS_HIDDEN: ::UINT = 0x00000008; +pub const RBBS_NOVERT: ::UINT = 0x00000010; +pub const RBBS_FIXEDBMP: ::UINT = 0x00000020; +pub const RBBS_VARIABLEHEIGHT: ::UINT = 0x00000040; +pub const RBBS_GRIPPERALWAYS: ::UINT = 0x00000080; +pub const RBBS_NOGRIPPER: ::UINT = 0x00000100; +pub const RBBS_USECHEVRON: ::UINT = 0x00000200; +pub const RBBS_HIDETITLE: ::UINT = 0x00000400; +pub const RBBS_TOPALIGN: ::UINT = 0x00000800; +pub const RBBIM_STYLE: ::UINT = 0x00000001; +pub const RBBIM_COLORS: ::UINT = 0x00000002; +pub const RBBIM_TEXT: ::UINT = 0x00000004; +pub const RBBIM_IMAGE: ::UINT = 0x00000008; +pub const RBBIM_CHILD: ::UINT = 0x00000010; +pub const RBBIM_CHILDSIZE: ::UINT = 0x00000020; +pub const RBBIM_SIZE: ::UINT = 0x00000040; +pub const RBBIM_BACKGROUND: ::UINT = 0x00000080; +pub const RBBIM_ID: ::UINT = 0x00000100; +pub const RBBIM_IDEALSIZE: ::UINT = 0x00000200; +pub const RBBIM_LPARAM: ::UINT = 0x00000400; +pub const RBBIM_HEADERSIZE: ::UINT = 0x00000800; +pub const RBBIM_CHEVRONLOCATION: ::UINT = 0x00001000; +pub const RBBIM_CHEVRONSTATE: ::UINT = 0x00002000; +STRUCT!{struct REBARBANDINFOA { + cbSize: ::UINT, + fMask: ::UINT, + fStyle: ::UINT, + clrFore: ::COLORREF, + clrBack: ::COLORREF, + lpText: ::LPSTR, + cch: ::UINT, + iImage: ::c_int, + hwndChild: ::HWND, + cxMinChild: ::UINT, + cyMinChild: ::UINT, + cx: ::UINT, + hbmBack: ::HBITMAP, + wID: ::UINT, + cyChild: ::UINT, + cyMaxChild: ::UINT, + cyIntegral: ::UINT, + cxIdeal: ::UINT, + lParam: ::LPARAM, + cxHeader: ::UINT, + rcChevronLocation: ::RECT, + uChevronState: ::UINT, +}} +pub type LPREBARBANDINFOA = *mut REBARBANDINFOA; +pub type LPCREBARBANDINFOA = *const REBARBANDINFOA; +STRUCT!{struct REBARBANDINFOW { + cbSize: ::UINT, + fMask: ::UINT, + fStyle: ::UINT, + clrFore: ::COLORREF, + clrBack: ::COLORREF, + lpText: ::LPWSTR, + cch: ::UINT, + iImage: ::c_int, + hwndChild: ::HWND, + cxMinChild: ::UINT, + cyMinChild: ::UINT, + cx: ::UINT, + hbmBack: ::HBITMAP, + wID: ::UINT, + cyChild: ::UINT, + cyMaxChild: ::UINT, + cyIntegral: ::UINT, + cxIdeal: ::UINT, + lParam: ::LPARAM, + cxHeader: ::UINT, + rcChevronLocation: ::RECT, + uChevronState: ::UINT, +}} +pub type LPREBARBANDINFOW = *mut REBARBANDINFOW; +pub type LPCREBARBANDINFOW = *const REBARBANDINFOW; +pub const RB_INSERTBANDA: ::UINT = ::WM_USER + 1; +pub const RB_DELETEBAND: ::UINT = ::WM_USER + 2; +pub const RB_GETBARINFO: ::UINT = ::WM_USER + 3; +pub const RB_SETBARINFO: ::UINT = ::WM_USER + 4; +pub const RB_SETBANDINFOA: ::UINT = ::WM_USER + 6; +pub const RB_SETPARENT: ::UINT = ::WM_USER + 7; +pub const RB_HITTEST: ::UINT = ::WM_USER + 8; +pub const RB_GETRECT: ::UINT = ::WM_USER + 9; +pub const RB_INSERTBANDW: ::UINT = ::WM_USER + 10; +pub const RB_SETBANDINFOW: ::UINT = ::WM_USER + 11; +pub const RB_GETBANDCOUNT: ::UINT = ::WM_USER + 12; +pub const RB_GETROWCOUNT: ::UINT = ::WM_USER + 13; +pub const RB_GETROWHEIGHT: ::UINT = ::WM_USER + 14; +pub const RB_IDTOINDEX: ::UINT = ::WM_USER + 16; +pub const RB_GETTOOLTIPS: ::UINT = ::WM_USER + 17; +pub const RB_SETTOOLTIPS: ::UINT = ::WM_USER + 18; +pub const RB_SETBKCOLOR: ::UINT = ::WM_USER + 19; +pub const RB_GETBKCOLOR: ::UINT = ::WM_USER + 20; +pub const RB_SETTEXTCOLOR: ::UINT = ::WM_USER + 21; +pub const RB_GETTEXTCOLOR: ::UINT = ::WM_USER + 22; +pub const RBSTR_CHANGERECT: ::WPARAM = 0x0001; +pub const RB_SIZETORECT: ::UINT = ::WM_USER + 23; +pub const RB_SETCOLORSCHEME: ::UINT = CCM_SETCOLORSCHEME; +pub const RB_GETCOLORSCHEME: ::UINT = CCM_GETCOLORSCHEME; +pub const RB_BEGINDRAG: ::UINT = ::WM_USER + 24; +pub const RB_ENDDRAG: ::UINT = ::WM_USER + 25; +pub const RB_DRAGMOVE: ::UINT = ::WM_USER + 26; +pub const RB_GETBARHEIGHT: ::UINT = ::WM_USER + 27; +pub const RB_GETBANDINFOW: ::UINT = ::WM_USER + 28; +pub const RB_GETBANDINFOA: ::UINT = ::WM_USER + 29; +pub const RB_MINIMIZEBAND: ::UINT = ::WM_USER + 30; +pub const RB_MAXIMIZEBAND: ::UINT = ::WM_USER + 31; +pub const RB_GETDROPTARGET: ::UINT = CCM_GETDROPTARGET; +pub const RB_GETBANDBORDERS: ::UINT = ::WM_USER + 34; +pub const RB_SHOWBAND: ::UINT = ::WM_USER + 35; +pub const RB_SETPALETTE: ::UINT = ::WM_USER + 37; +pub const RB_GETPALETTE: ::UINT = ::WM_USER + 38; +pub const RB_MOVEBAND: ::UINT = ::WM_USER + 39; +pub const RB_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const RB_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const RB_GETBANDMARGINS: ::UINT = ::WM_USER + 40; +pub const RB_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; +pub const RB_SETEXTENDEDSTYLE: ::UINT = ::WM_USER + 41; +pub const RB_GETEXTENDEDSTYLE: ::UINT = ::WM_USER + 42; +pub const RB_PUSHCHEVRON: ::UINT = ::WM_USER + 43; +pub const RB_SETBANDWIDTH: ::UINT = ::WM_USER + 44; +pub const RBN_HEIGHTCHANGE: ::UINT = RBN_FIRST - 0; +pub const RBN_GETOBJECT: ::UINT = RBN_FIRST - 1; +pub const RBN_LAYOUTCHANGED: ::UINT = RBN_FIRST - 2; +pub const RBN_AUTOSIZE: ::UINT = RBN_FIRST - 3; +pub const RBN_BEGINDRAG: ::UINT = RBN_FIRST - 4; +pub const RBN_ENDDRAG: ::UINT = RBN_FIRST - 5; +pub const RBN_DELETINGBAND: ::UINT = RBN_FIRST - 6; +pub const RBN_DELETEDBAND: ::UINT = RBN_FIRST - 7; +pub const RBN_CHILDSIZE: ::UINT = RBN_FIRST - 8; +pub const RBN_CHEVRONPUSHED: ::UINT = RBN_FIRST - 10; +pub const RBN_SPLITTERDRAG: ::UINT = RBN_FIRST - 11; +pub const RBN_MINMAX: ::UINT = RBN_FIRST - 21; +pub const RBN_AUTOBREAK: ::UINT = RBN_FIRST - 22; +STRUCT!{struct NMREBARCHILDSIZE { + hdr: ::NMHDR, + uBand: ::UINT, + wID: ::UINT, + rcChild: ::RECT, + rcBand: ::RECT, +}} +pub type LPNMREBARCHILDSIZE = *mut NMREBARCHILDSIZE; +STRUCT!{struct NMREBAR { + hdr: ::NMHDR, + dwMask: ::DWORD, + uBand: ::UINT, + fStyle: ::UINT, + wID: ::UINT, + lParam: ::LPARAM, +}} +pub type LPNMREBAR = *mut NMREBAR; +pub const RBNM_ID: ::DWORD = 0x00000001; +pub const RBNM_STYLE: ::DWORD = 0x00000002; +pub const RBNM_LPARAM: ::DWORD = 0x00000004; +STRUCT!{struct NMRBAUTOSIZE { + hdr: ::NMHDR, + fChanged: ::BOOL, + rcTarget: ::RECT, + rcActual: ::RECT, +}} +pub type LPNMRBAUTOSIZE = *mut NMRBAUTOSIZE; +STRUCT!{struct NMREBARCHEVRON { + hdr: ::NMHDR, + uBand: ::UINT, + wID: ::UINT, + lParam: ::LPARAM, + rc: ::RECT, + lParamNM: ::LPARAM, +}} +pub type LPNMREBARCHEVRON = *mut NMREBARCHEVRON; +STRUCT!{struct NMREBARSPLITTER { + hdr: ::NMHDR, + rcSizing: ::RECT, +}} +pub type LPNMREBARSPLITTER = *mut NMREBARSPLITTER; +pub const RBAB_AUTOSIZE: ::UINT = 0x0001; +pub const RBAB_ADDBAND: ::UINT = 0x0002; +STRUCT!{struct NMREBARAUTOBREAK { + hdr: ::NMHDR, + uBand: ::UINT, + wID: ::UINT, + lParam: ::LPARAM, + uMsg: ::UINT, + fStyleCurrent: ::UINT, + fAutoBreak: ::UINT, +}} +pub type LPNMREBARAUTOBREAK = *mut NMREBARAUTOBREAK; +pub const RBHT_NOWHERE: ::UINT = 0x0001; +pub const RBHT_CAPTION: ::UINT = 0x0002; +pub const RBHT_CLIENT: ::UINT = 0x0003; +pub const RBHT_GRABBER: ::UINT = 0x0004; +pub const RBHT_CHEVRON: ::UINT = 0x0008; +pub const RBHT_SPLITTER: ::UINT = 0x0010; +STRUCT!{struct RBHITTESTINFO { + pt: ::POINT, + flags: ::UINT, + iBand: ::c_int, +}} +pub type LPRBHITTESTINFO = *mut RBHITTESTINFO; +pub type LPTOOLINFOA = LPTTTOOLINFOA; +pub type LPTOOLINFOW = LPTTTOOLINFOW; +pub type TOOLINFOA = TTTOOLINFOA; +pub type TOOLINFOW = TTTOOLINFOW; +STRUCT!{struct TTTOOLINFOA { + cbSize: ::UINT, + uFlags: ::UINT, + hwnd: ::HWND, + uId: ::UINT_PTR, + rect: ::RECT, + hinst: ::HINSTANCE, + lpszText: ::LPSTR, + lParam: ::LPARAM, + lpReserved: *mut ::c_void, +}} +pub type PTTTOOLINFOA = *mut TTTOOLINFOA; +pub type LPTTTOOLINFOA = *mut TTTOOLINFOA; +STRUCT!{struct TTTOOLINFOW { + cbSize: ::UINT, + uFlags: ::UINT, + hwnd: ::HWND, + uId: ::UINT_PTR, + rect: ::RECT, + hinst: ::HINSTANCE, + lpszText: ::LPSTR, + lParam: ::LPARAM, + lpReserved: *mut ::c_void, +}} +pub type PTTTOOLINFOW = *mut TTTOOLINFOW; +pub type LPTTTOOLINFOW = *mut TTTOOLINFOW; +pub const TTS_ALWAYSTIP: ::DWORD = 0x01; +pub const TTS_NOPREFIX: ::DWORD = 0x02; +pub const TTS_NOANIMATE: ::DWORD = 0x10; +pub const TTS_NOFADE: ::DWORD = 0x20; +pub const TTS_BALLOON: ::DWORD = 0x40; +pub const TTS_CLOSE: ::DWORD = 0x80; +pub const TTS_USEVISUALSTYLE: ::DWORD = 0x100; +pub const TTF_IDISHWND: ::UINT = 0x0001; +pub const TTF_CENTERTIP: ::UINT = 0x0002; +pub const TTF_RTLREADING: ::UINT = 0x0004; +pub const TTF_SUBCLASS: ::UINT = 0x0010; +pub const TTF_TRACK: ::UINT = 0x0020; +pub const TTF_ABSOLUTE: ::UINT = 0x0080; +pub const TTF_TRANSPARENT: ::UINT = 0x0100; +pub const TTF_PARSELINKS: ::UINT = 0x1000; +pub const TTF_DI_SETITEM: ::UINT = 0x8000; +pub const TTDT_AUTOMATIC: ::WPARAM = 0; +pub const TTDT_RESHOW: ::WPARAM = 1; +pub const TTDT_AUTOPOP: ::WPARAM = 2; +pub const TTDT_INITIAL: ::WPARAM = 3; +pub const TTI_NONE: ::WPARAM = 0; +pub const TTI_INFO: ::WPARAM = 1; +pub const TTI_WARNING: ::WPARAM = 2; +pub const TTI_ERROR: ::WPARAM = 3; +pub const TTI_INFO_LARGE: ::WPARAM = 4; +pub const TTI_WARNING_LARGE: ::WPARAM = 5; +pub const TTI_ERROR_LARGE: ::WPARAM = 6; +pub const TTM_ACTIVATE: ::UINT = ::WM_USER + 1; +pub const TTM_SETDELAYTIME: ::UINT = ::WM_USER + 3; +pub const TTM_ADDTOOLA: ::UINT = ::WM_USER + 4; +pub const TTM_ADDTOOLW: ::UINT = ::WM_USER + 50; +pub const TTM_DELTOOLA: ::UINT = ::WM_USER + 5; +pub const TTM_DELTOOLW: ::UINT = ::WM_USER + 51; +pub const TTM_NEWTOOLRECTA: ::UINT = ::WM_USER + 6; +pub const TTM_NEWTOOLRECTW: ::UINT = ::WM_USER + 52; +pub const TTM_RELAYEVENT: ::UINT = ::WM_USER + 7; +pub const TTM_GETTOOLINFOA: ::UINT = ::WM_USER + 8; +pub const TTM_GETTOOLINFOW: ::UINT = ::WM_USER + 53; +pub const TTM_SETTOOLINFOA: ::UINT = ::WM_USER + 9; +pub const TTM_SETTOOLINFOW: ::UINT = ::WM_USER + 54; +pub const TTM_HITTESTA: ::UINT = ::WM_USER + 10; +pub const TTM_HITTESTW: ::UINT = ::WM_USER + 55; +pub const TTM_GETTEXTA: ::UINT = ::WM_USER + 11; +pub const TTM_GETTEXTW: ::UINT = ::WM_USER + 56; +pub const TTM_UPDATETIPTEXTA: ::UINT = ::WM_USER + 12; +pub const TTM_UPDATETIPTEXTW: ::UINT = ::WM_USER + 57; +pub const TTM_GETTOOLCOUNT: ::UINT = ::WM_USER + 13; +pub const TTM_ENUMTOOLSA: ::UINT = ::WM_USER + 14; +pub const TTM_ENUMTOOLSW: ::UINT = ::WM_USER + 58; +pub const TTM_GETCURRENTTOOLA: ::UINT = ::WM_USER + 15; +pub const TTM_GETCURRENTTOOLW: ::UINT = ::WM_USER + 59; +pub const TTM_WINDOWFROMPOINT: ::UINT = ::WM_USER + 16; +pub const TTM_TRACKACTIVATE: ::UINT = ::WM_USER + 17; +pub const TTM_TRACKPOSITION: ::UINT = ::WM_USER + 18; +pub const TTM_SETTIPBKCOLOR: ::UINT = ::WM_USER + 19; +pub const TTM_SETTIPTEXTCOLOR: ::UINT = ::WM_USER + 20; +pub const TTM_GETDELAYTIME: ::UINT = ::WM_USER + 21; +pub const TTM_GETTIPBKCOLOR: ::UINT = ::WM_USER + 22; +pub const TTM_GETTIPTEXTCOLOR: ::UINT = ::WM_USER + 23; +pub const TTM_SETMAXTIPWIDTH: ::UINT = ::WM_USER + 24; +pub const TTM_GETMAXTIPWIDTH: ::UINT = ::WM_USER + 25; +pub const TTM_SETMARGIN: ::UINT = ::WM_USER + 26; +pub const TTM_GETMARGIN: ::UINT = ::WM_USER + 27; +pub const TTM_POP: ::UINT = ::WM_USER + 28; +pub const TTM_UPDATE: ::UINT = ::WM_USER + 29; +pub const TTM_GETBUBBLESIZE: ::UINT = ::WM_USER + 30; +pub const TTM_ADJUSTRECT: ::UINT = ::WM_USER + 31; +pub const TTM_SETTITLEA: ::UINT = ::WM_USER + 32; +pub const TTM_SETTITLEW: ::UINT = ::WM_USER + 33; +pub const TTM_POPUP: ::UINT = ::WM_USER + 34; +pub const TTM_GETTITLE: ::UINT = ::WM_USER + 35; +STRUCT!{struct TTGETTITLE { + dwSize: ::DWORD, + uTitleBitmap: ::UINT, + cch: ::UINT, + pszTitle: *mut ::WCHAR, +}} +pub type LPTTGETTITLE = *mut TTGETTITLE; +pub const TTM_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; +pub type LPHITTESTINFOW = LPTTHITTESTINFOW; +pub type LPHITTESTINFOA = LPTTHITTESTINFOA; +STRUCT!{struct TTHITTESTINFOA { + hwnd: ::HWND, + pt: ::POINT, + ti: TTTOOLINFOA, +}} +pub type LPTTHITTESTINFOA = *mut TTHITTESTINFOA; +STRUCT!{struct TTHITTESTINFOW { + hwnd: ::HWND, + pt: ::POINT, + ti: TTTOOLINFOW, +}} +pub type LPTTHITTESTINFOW = *mut TTHITTESTINFOW; +pub const TTN_GETDISPINFOA: ::UINT = TTN_FIRST - 0; +pub const TTN_GETDISPINFOW: ::UINT = TTN_FIRST - 10; +pub const TTN_SHOW: ::UINT = TTN_FIRST - 1; +pub const TTN_POP: ::UINT = TTN_FIRST - 2; +pub const TTN_LINKCLICK: ::UINT = TTN_FIRST - 3; +pub const TTN_NEEDTEXTA: ::UINT = TTN_GETDISPINFOA; +pub const TTN_NEEDTEXTW: ::UINT = TTN_GETDISPINFOW; +pub type TOOLTIPTEXTW = NMTTDISPINFOW; +pub type TOOLTIPTEXTA = NMTTDISPINFOA; +pub type LPTOOLTIPTEXTA = LPNMTTDISPINFOA; +pub type LPTOOLTIPTEXTW = LPNMTTDISPINFOW; +STRUCT!{nodebug struct NMTTDISPINFOA { + hdr: ::NMHDR, + lpszText: ::LPSTR, + szText: [::c_char; 80], + hinst: ::HINSTANCE, + uFlags: ::UINT, + lParam: ::LPARAM, +}} +pub type LPNMTTDISPINFOA = *mut NMTTDISPINFOA; +STRUCT!{nodebug struct NMTTDISPINFOW { + hdr: ::NMHDR, + lpszText: ::LPWSTR, + szText: [::WCHAR; 80], + hinst: ::HINSTANCE, + uFlags: ::UINT, + lParam: ::LPARAM, +}} +pub type LPNMTTDISPINFOW = *mut NMTTDISPINFOW; +pub const SBARS_SIZEGRIP: ::DWORD = 0x0100; +pub const SBARS_TOOLTIPS: ::DWORD = 0x0800; +pub const SBT_TOOLTIPS: ::DWORD = 0x0800; +pub const SB_SETTEXTA: ::UINT = ::WM_USER + 1; +pub const SB_SETTEXTW: ::UINT = ::WM_USER + 11; +pub const SB_GETTEXTA: ::UINT = ::WM_USER + 2; +pub const SB_GETTEXTW: ::UINT = ::WM_USER + 13; +pub const SB_GETTEXTLENGTHA: ::UINT = ::WM_USER + 3; +pub const SB_GETTEXTLENGTHW: ::UINT = ::WM_USER + 12; +pub const SB_SETPARTS: ::UINT = ::WM_USER + 4; +pub const SB_GETPARTS: ::UINT = ::WM_USER + 6; +pub const SB_GETBORDERS: ::UINT = ::WM_USER + 7; +pub const SB_SETMINHEIGHT: ::UINT = ::WM_USER + 8; +pub const SB_SIMPLE: ::UINT = ::WM_USER + 9; +pub const SB_GETRECT: ::UINT = ::WM_USER + 10; +pub const SB_ISSIMPLE: ::UINT = ::WM_USER + 14; +pub const SB_SETICON: ::UINT = ::WM_USER + 15; +pub const SB_SETTIPTEXTA: ::UINT = ::WM_USER + 16; +pub const SB_SETTIPTEXTW: ::UINT = ::WM_USER + 17; +pub const SB_GETTIPTEXTA: ::UINT = ::WM_USER + 18; +pub const SB_GETTIPTEXTW: ::UINT = ::WM_USER + 19; +pub const SB_GETICON: ::UINT = ::WM_USER + 20; +pub const SB_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const SB_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const SBT_OWNERDRAW: ::WPARAM = 0x1000; +pub const SBT_NOBORDERS: ::WPARAM = 0x0100; +pub const SBT_POPOUT: ::WPARAM = 0x0200; +pub const SBT_RTLREADING: ::WPARAM = 0x0400; +pub const SBT_NOTABPARSING: ::WPARAM = 0x0800; +pub const SB_SETBKCOLOR: ::UINT = CCM_SETBKCOLOR; +pub const SBN_SIMPLEMODECHANGE: ::UINT = SBN_FIRST - 0; +pub const SB_SIMPLEID: ::WPARAM = 0x00ff; +pub const TBS_AUTOTICKS: ::DWORD = 0x0001; +pub const TBS_VERT: ::DWORD = 0x0002; +pub const TBS_HORZ: ::DWORD = 0x0000; +pub const TBS_TOP: ::DWORD = 0x0004; +pub const TBS_BOTTOM: ::DWORD = 0x0000; +pub const TBS_LEFT: ::DWORD = 0x0004; +pub const TBS_RIGHT: ::DWORD = 0x0000; +pub const TBS_BOTH: ::DWORD = 0x0008; +pub const TBS_NOTICKS: ::DWORD = 0x0010; +pub const TBS_ENABLESELRANGE: ::DWORD = 0x0020; +pub const TBS_FIXEDLENGTH: ::DWORD = 0x0040; +pub const TBS_NOTHUMB: ::DWORD = 0x0080; +pub const TBS_TOOLTIPS: ::DWORD = 0x0100; +pub const TBS_REVERSED: ::DWORD = 0x0200; +pub const TBS_DOWNISLEFT: ::DWORD = 0x0400; +pub const TBS_NOTIFYBEFOREMOVE: ::DWORD = 0x0800; +pub const TBS_TRANSPARENTBKGND: ::DWORD = 0x1000; +pub const TBM_GETPOS: ::UINT = ::WM_USER; +pub const TBM_GETRANGEMIN: ::UINT = ::WM_USER + 1; +pub const TBM_GETRANGEMAX: ::UINT = ::WM_USER + 2; +pub const TBM_GETTIC: ::UINT = ::WM_USER + 3; +pub const TBM_SETTIC: ::UINT = ::WM_USER + 4; +pub const TBM_SETPOS: ::UINT = ::WM_USER + 5; +pub const TBM_SETRANGE: ::UINT = ::WM_USER + 6; +pub const TBM_SETRANGEMIN: ::UINT = ::WM_USER + 7; +pub const TBM_SETRANGEMAX: ::UINT = ::WM_USER + 8; +pub const TBM_CLEARTICS: ::UINT = ::WM_USER + 9; +pub const TBM_SETSEL: ::UINT = ::WM_USER + 10; +pub const TBM_SETSELSTART: ::UINT = ::WM_USER + 11; +pub const TBM_SETSELEND: ::UINT = ::WM_USER + 12; +pub const TBM_GETPTICS: ::UINT = ::WM_USER + 14; +pub const TBM_GETTICPOS: ::UINT = ::WM_USER + 15; +pub const TBM_GETNUMTICS: ::UINT = ::WM_USER + 16; +pub const TBM_GETSELSTART: ::UINT = ::WM_USER + 17; +pub const TBM_GETSELEND: ::UINT = ::WM_USER + 18; +pub const TBM_CLEARSEL: ::UINT = ::WM_USER + 19; +pub const TBM_SETTICFREQ: ::UINT = ::WM_USER + 20; +pub const TBM_SETPAGESIZE: ::UINT = ::WM_USER + 21; +pub const TBM_GETPAGESIZE: ::UINT = ::WM_USER + 22; +pub const TBM_SETLINESIZE: ::UINT = ::WM_USER + 23; +pub const TBM_GETLINESIZE: ::UINT = ::WM_USER + 24; +pub const TBM_GETTHUMBRECT: ::UINT = ::WM_USER + 25; +pub const TBM_GETCHANNELRECT: ::UINT = ::WM_USER + 26; +pub const TBM_SETTHUMBLENGTH: ::UINT = ::WM_USER + 27; +pub const TBM_GETTHUMBLENGTH: ::UINT = ::WM_USER + 28; +pub const TBM_SETTOOLTIPS: ::UINT = ::WM_USER + 29; +pub const TBM_GETTOOLTIPS: ::UINT = ::WM_USER + 30; +pub const TBM_SETTIPSIDE: ::UINT = ::WM_USER + 31; +pub const TBTS_TOP: ::WPARAM = 0; +pub const TBTS_LEFT: ::WPARAM = 1; +pub const TBTS_BOTTOM: ::WPARAM = 2; +pub const TBTS_RIGHT: ::WPARAM = 3; +pub const TBM_SETBUDDY: ::UINT = ::WM_USER + 32; +pub const TBM_GETBUDDY: ::UINT = ::WM_USER + 33; +pub const TBM_SETPOSNOTIFY: ::UINT = ::WM_USER + 34; +pub const TBM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const TBM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const TBCD_TICS: ::DWORD_PTR = 0x0001; +pub const TBCD_THUMB: ::DWORD_PTR = 0x0001; +pub const TBCD_CHANNEL: ::DWORD_PTR = 0x0001; +pub const TB_LINEUP: ::WPARAM = 0; +pub const TB_LINEDOWN: ::WPARAM = 1; +pub const TB_PAGEUP: ::WPARAM = 2; +pub const TB_PAGEDOWN: ::WPARAM = 3; +pub const TB_THUMBPOSITION: ::WPARAM = 4; +pub const TB_THUMBTRACK: ::WPARAM = 5; +pub const TB_TOP: ::WPARAM = 6; +pub const TB_BOTTOM: ::WPARAM = 7; +pub const TB_ENDTRACK: ::WPARAM = 8; +pub const TRBN_THUMBPOSCHANGING: ::UINT = TRBN_FIRST - 1; +STRUCT!{struct NMTRBTHUMBPOSCHANGING { + hdr: ::NMHDR, + dwPos: ::DWORD, + nReason: ::c_int, +}} +STRUCT!{struct DRAGLISTINFO { + uNotification: ::UINT, + hWnd: ::HWND, + ptCursor: ::POINT, +}} +pub type LPDRAGLISTINFO = *mut DRAGLISTINFO; +pub const DL_BEGINDRAG: ::UINT = ::WM_USER + 133; +pub const DL_DRAGGING: ::UINT = ::WM_USER + 134; +pub const DL_DROPPED: ::UINT = ::WM_USER + 135; +pub const DL_CANCELDRAG: ::UINT = ::WM_USER + 136; +pub const DL_CURSORSET: ::UINT = 0; +pub const DL_STOPCURSOR: ::UINT = 1; +pub const DL_COPYCURSOR: ::UINT = 2; +pub const DL_MOVECURSOR: ::UINT = 3; +STRUCT!{struct UDACCEL { + nSec: ::UINT, + nInc: ::UINT, +}} +pub type LPUDACCEL = *mut UDACCEL; +pub const UD_MAXVAL: ::c_short = 0x7fff; +pub const UD_MINVAL: ::c_short = 0 - UD_MAXVAL; +pub const UDS_WRAP: ::DWORD = 0x0001; +pub const UDS_SETBUDDYINT: ::DWORD = 0x0002; +pub const UDS_ALIGNRIGHT: ::DWORD = 0x0004; +pub const UDS_ALIGNLEFT: ::DWORD = 0x0008; +pub const UDS_AUTOBUDDY: ::DWORD = 0x0010; +pub const UDS_ARROWKEYS: ::DWORD = 0x0020; +pub const UDS_HORZ: ::DWORD = 0x0040; +pub const UDS_NOTHOUSANDS: ::DWORD = 0x0080; +pub const UDS_HOTTRACK: ::DWORD = 0x0100; +pub const UDM_SETRANGE: ::UINT = ::WM_USER + 101; +pub const UDM_GETRANGE: ::UINT = ::WM_USER + 102; +pub const UDM_SETPOS: ::UINT = ::WM_USER + 103; +pub const UDM_GETPOS: ::UINT = ::WM_USER + 104; +pub const UDM_SETBUDDY: ::UINT = ::WM_USER + 105; +pub const UDM_GETBUDDY: ::UINT = ::WM_USER + 106; +pub const UDM_SETACCEL: ::UINT = ::WM_USER + 107; +pub const UDM_GETACCEL: ::UINT = ::WM_USER + 108; +pub const UDM_SETBASE: ::UINT = ::WM_USER + 109; +pub const UDM_GETBASE: ::UINT = ::WM_USER + 110; +pub const UDM_SETRANGE32: ::UINT = ::WM_USER + 111; +pub const UDM_GETRANGE32: ::UINT = ::WM_USER + 112; +pub const UDM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const UDM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const UDM_SETPOS32: ::UINT = ::WM_USER + 113; +pub const UDM_GETPOS32: ::UINT = ::WM_USER + 114; +pub type NM_UPDOWN = NMUPDOWN; +pub type LPNM_UPDOWN = LPNMUPDOWN; +STRUCT!{struct NMUPDOWN { + hdr: ::NMHDR, + iPos: ::c_int, + iDelta: ::c_int, +}} +pub type LPNMUPDOWN = *mut NMUPDOWN; +pub const UDN_DELTAPOS: ::UINT = UDN_FIRST - 1; +pub const PBS_SMOOTH: ::DWORD = 0x01; +pub const PBS_VERTICAL: ::DWORD = 0x04; +pub const PBM_SETRANGE: ::UINT = ::WM_USER + 1; +pub const PBM_SETPOS: ::UINT = ::WM_USER + 2; +pub const PBM_DELTAPOS: ::UINT = ::WM_USER + 3; +pub const PBM_SETSTEP: ::UINT = ::WM_USER + 4; +pub const PBM_STEPIT: ::UINT = ::WM_USER + 5; +pub const PBM_SETRANGE32: ::UINT = ::WM_USER + 6; +STRUCT!{struct PBRANGE { + iLow: ::c_int, + iHigh: ::c_int, +}} +pub type LPPBRANGE = *mut PBRANGE; +pub const PBM_GETRANGE: ::UINT = ::WM_USER + 7; +pub const PBM_GETPOS: ::UINT = ::WM_USER + 8; +pub const PBM_SETBARCOLOR: ::UINT = ::WM_USER + 9; +pub const PBM_SETBKCOLOR: ::UINT = CCM_SETBKCOLOR; +pub const PBM_SETMARQUEE: ::UINT = ::WM_USER + 10; +pub const PBS_MARQUEE: ::DWORD = 0x08; +pub const PBS_SMOOTHREVERSE: ::DWORD = 0x10; +pub const PBM_GETSTEP: ::UINT = ::WM_USER + 13; +pub const PBM_GETBKCOLOR: ::UINT = ::WM_USER + 14; +pub const PBM_GETBARCOLOR: ::UINT = ::WM_USER + 15; +pub const PBM_SETSTATE: ::UINT = ::WM_USER + 16; +pub const PBM_GETSTATE: ::UINT = ::WM_USER + 17; +pub const PBST_NORMAL: ::c_int = 0x0001; +pub const PBST_ERROR: ::c_int = 0x0002; +pub const PBST_PAUSED: ::c_int = 0x0003; +pub const HOTKEYF_SHIFT: ::BYTE = 0x01; +pub const HOTKEYF_CONTROL: ::BYTE = 0x02; +pub const HOTKEYF_ALT: ::BYTE = 0x04; +pub const HOTKEYF_EXT: ::BYTE = 0x08; +pub const HKCOMB_NONE: ::WPARAM = 0x0001; +pub const HKCOMB_S: ::WPARAM = 0x0002; +pub const HKCOMB_C: ::WPARAM = 0x0004; +pub const HKCOMB_A: ::WPARAM = 0x0008; +pub const HKCOMB_SC: ::WPARAM = 0x0010; +pub const HKCOMB_SA: ::WPARAM = 0x0020; +pub const HKCOMB_CA: ::WPARAM = 0x0040; +pub const HKCOMB_SCA: ::WPARAM = 0x0080; +pub const HKM_SETHOTKEY: ::UINT = ::WM_USER + 1; +pub const HKM_GETHOTKEY: ::UINT = ::WM_USER + 2; +pub const HKM_SETRULES: ::UINT = ::WM_USER + 3; +pub const CCS_TOP: ::DWORD = 0x00000001; +pub const CCS_NOMOVEY: ::DWORD = 0x00000002; +pub const CCS_BOTTOM: ::DWORD = 0x00000003; +pub const CCS_NORESIZE: ::DWORD = 0x00000004; +pub const CCS_NOPARENTALIGN: ::DWORD = 0x00000008; +pub const CCS_ADJUSTABLE: ::DWORD = 0x00000020; +pub const CCS_NODIVIDER: ::DWORD = 0x00000040; +pub const CCS_VERT: ::DWORD = 0x00000080; +pub const CCS_LEFT: ::DWORD = CCS_VERT | CCS_TOP; +pub const CCS_RIGHT: ::DWORD = CCS_VERT | CCS_BOTTOM; +pub const CCS_NOMOVEX: ::DWORD = CCS_VERT | CCS_NOMOVEY; +pub const MAX_LINKID_TEXT: usize = 48; +pub const L_MAX_URL_LENGTH: usize = 2048 + 32 + 4; +pub const LWS_TRANSPARENT: ::DWORD = 0x0001; +pub const LWS_IGNORERETURN: ::DWORD = 0x0002; +pub const LWS_NOPREFIX: ::DWORD = 0x0004; +pub const LWS_USEVISUALSTYLE: ::DWORD = 0x0008; +pub const LWS_USECUSTOMTEXT: ::DWORD = 0x0010; +pub const LWS_RIGHT: ::DWORD = 0x0020; +pub const LIF_ITEMINDEX: ::UINT = 0x00000001; +pub const LIF_STATE: ::UINT = 0x00000002; +pub const LIF_ITEMID: ::UINT = 0x00000004; +pub const LIF_URL: ::UINT = 0x00000008; +pub const LIS_FOCUSED: ::UINT = 0x00000001; +pub const LIS_ENABLED: ::UINT = 0x00000002; +pub const LIS_VISITED: ::UINT = 0x00000004; +pub const LIS_HOTTRACK: ::UINT = 0x00000008; +pub const LIS_DEFAULTCOLORS: ::UINT = 0x00000010; +STRUCT!{nodebug struct LITEM { + mask: ::UINT, + iLink: ::c_int, + state: ::UINT, + stateMask: ::UINT, + szID: [::WCHAR; MAX_LINKID_TEXT], + szUrl: [::WCHAR; L_MAX_URL_LENGTH], +}} +pub type PLITEM = *mut LITEM; +STRUCT!{nodebug struct LHITTESTINFO { + pt: ::POINT, + item: LITEM, +}} +pub type PLHITTESTINFO = *mut LHITTESTINFO; +STRUCT!{nodebug struct NMLINK { + hdr: ::NMHDR, + item: LITEM, +}} +pub type PNMLINK = *mut NMLINK; +pub const LM_HITTEST: ::UINT = ::WM_USER + 0x300; +pub const LM_GETIDEALHEIGHT: ::UINT = ::WM_USER + 0x301; +pub const LM_SETITEM: ::UINT = ::WM_USER + 0x302; +pub const LM_GETITEM: ::UINT = ::WM_USER + 0x303; +pub const LM_GETIDEALSIZE: ::UINT = LM_GETIDEALHEIGHT; +pub const LVS_ICON: ::DWORD = 0x0000; +pub const LVS_REPORT: ::DWORD = 0x0001; +pub const LVS_SMALLICON: ::DWORD = 0x0002; +pub const LVS_LIST: ::DWORD = 0x0003; +pub const LVS_TYPEMASK: ::DWORD = 0x0003; +pub const LVS_SINGLESEL: ::DWORD = 0x0004; +pub const LVS_SHOWSELALWAYS: ::DWORD = 0x0008; +pub const LVS_SORTASCENDING: ::DWORD = 0x0010; +pub const LVS_SORTDESCENDING: ::DWORD = 0x0020; +pub const LVS_SHAREIMAGELISTS: ::DWORD = 0x0040; +pub const LVS_NOLABELWRAP: ::DWORD = 0x0080; +pub const LVS_AUTOARRANGE: ::DWORD = 0x0100; +pub const LVS_EDITLABELS: ::DWORD = 0x0200; +pub const LVS_OWNERDATA: ::DWORD = 0x1000; +pub const LVS_NOSCROLL: ::DWORD = 0x2000; +pub const LVS_TYPESTYLEMASK: ::DWORD = 0xfc00; +pub const LVS_ALIGNTOP: ::DWORD = 0x0000; +pub const LVS_ALIGNLEFT: ::DWORD = 0x0800; +pub const LVS_ALIGNMASK: ::DWORD = 0x0c00; +pub const LVS_OWNERDRAWFIXED: ::DWORD = 0x0400; +pub const LVS_NOCOLUMNHEADER: ::DWORD = 0x4000; +pub const LVS_NOSORTHEADER: ::DWORD = 0x8000; +pub const LVM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const LVM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const LVM_GETBKCOLOR: ::UINT = LVM_FIRST + 0; +pub const LVM_SETBKCOLOR: ::UINT = LVM_FIRST + 1; +pub const LVM_GETIMAGELIST: ::UINT = LVM_FIRST + 2; +pub const LVM_SETIMAGELIST: ::UINT = LVM_FIRST + 3; +pub const LVM_GETITEMCOUNT: ::UINT = LVM_FIRST + 4; +pub const LVSIL_NORMAL: ::c_int = 0; +pub const LVSIL_SMALL: ::c_int = 1; +pub const LVSIL_STATE: ::c_int = 2; +pub const LVSIL_GROUPHEADER: ::c_int = 3; +pub const LVIF_TEXT: ::UINT = 0x00000001; +pub const LVIF_IMAGE: ::UINT = 0x00000002; +pub const LVIF_PARAM: ::UINT = 0x00000004; +pub const LVIF_STATE: ::UINT = 0x00000008; +pub const LVIF_INDENT: ::UINT = 0x00000010; +pub const LVIF_NORECOMPUTE: ::UINT = 0x00000800; +pub const LVIF_GROUPID: ::UINT = 0x00000100; +pub const LVIF_COLUMNS: ::UINT = 0x00000200; +pub const LVIF_COLFMT: ::UINT = 0x00010000; +pub const LVIS_FOCUSED: ::UINT = 0x0001; +pub const LVIS_SELECTED: ::UINT = 0x0002; +pub const LVIS_CUT: ::UINT = 0x0004; +pub const LVIS_DROPHILITED: ::UINT = 0x0008; +pub const LVIS_GLOW: ::UINT = 0x0010; +pub const LVIS_ACTIVATING: ::UINT = 0x0020; +pub const LVIS_OVERLAYMASK: ::UINT = 0x0F00; +pub const LVIS_STATEIMAGEMASK: ::UINT = 0xF000; +#[inline] #[allow(dead_code)] +pub fn INDEXTOSTATEIMAGEMASK(i: ::UINT) -> ::UINT { i << 12 } +pub const I_INDENTCALLBACK: ::c_int = -1; +pub type LV_ITEMA = LVITEMA; +pub type LV_ITEMW = LVITEMW; +pub const I_GROUPIDCALLBACK: ::c_int = -1; +pub const I_GROUPIDNONE: ::c_int = -2; +STRUCT!{struct LVITEMA { + mask: ::UINT, + iItem: ::c_int, + iSubItem: ::c_int, + state: ::UINT, + stateMask: ::UINT, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + lParam: ::LPARAM, + iIndent: ::c_int, + iGroupId: ::c_int, + cColumns: ::UINT, + puColumns: ::PUINT, + piColFmt: *mut ::c_int, + iGroup: ::c_int, +}} +pub type LPLVITEMA = *mut LVITEMA; +STRUCT!{struct LVITEMW { + mask: ::UINT, + iItem: ::c_int, + iSubItem: ::c_int, + state: ::UINT, + stateMask: ::UINT, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + lParam: ::LPARAM, + iIndent: ::c_int, + iGroupId: ::c_int, + cColumns: ::UINT, + puColumns: ::PUINT, + piColFmt: *mut ::c_int, + iGroup: ::c_int, +}} +pub type LPLVITEMW = *mut LVITEMW; +pub const LPSTR_TEXTCALLBACKW: ::LPWSTR = (0 - 1) as ::LPWSTR; +pub const LPSTR_TEXTCALLBACKA: ::LPSTR = (0 - 1) as ::LPSTR; +pub const I_IMAGECALLBACK: ::c_int = -1; +pub const I_IMAGENONE: ::c_int = -2; +pub const I_COLUMNSCALLBACK: ::UINT = -1i32 as ::UINT; +pub const LVM_GETITEMA: ::UINT = LVM_FIRST + 5; +pub const LVM_GETITEMW: ::UINT = LVM_FIRST + 75; +pub const LVM_SETITEMA: ::UINT = LVM_FIRST + 6; +pub const LVM_SETITEMW: ::UINT = LVM_FIRST + 76; +pub const LVM_INSERTITEMA: ::UINT = LVM_FIRST + 7; +pub const LVM_INSERTITEMW: ::UINT = LVM_FIRST + 77; +pub const LVM_DELETEITEM: ::UINT = LVM_FIRST + 8; +pub const LVM_DELETEALLITEMS: ::UINT = LVM_FIRST + 9; +pub const LVM_GETCALLBACKMASK: ::UINT = LVM_FIRST + 10; +pub const LVM_SETCALLBACKMASK: ::UINT = LVM_FIRST + 11; +pub const LVM_GETNEXTITEM: ::UINT = LVM_FIRST + 12; +pub const LVNI_ALL: ::LPARAM = 0x0000; +pub const LVNI_FOCUSED: ::LPARAM = 0x0001; +pub const LVNI_SELECTED: ::LPARAM = 0x0002; +pub const LVNI_CUT: ::LPARAM = 0x0004; +pub const LVNI_DROPHILITED: ::LPARAM = 0x0008; +pub const LVNI_STATEMASK: ::LPARAM = LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED; +pub const LVNI_VISIBLEORDER: ::LPARAM = 0x0010; +pub const LVNI_PREVIOUS: ::LPARAM = 0x0020; +pub const LVNI_VISIBLEONLY: ::LPARAM = 0x0040; +pub const LVNI_SAMEGROUPONLY: ::LPARAM = 0x0080; +pub const LVNI_ABOVE: ::LPARAM = 0x0100; +pub const LVNI_BELOW: ::LPARAM = 0x0200; +pub const LVNI_TOLEFT: ::LPARAM = 0x0400; +pub const LVNI_TORIGHT: ::LPARAM = 0x0800; +pub const LVNI_DIRECTIONMASK: ::LPARAM = LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT; +pub const LVFI_PARAM: ::UINT = 0x0001; +pub const LVFI_STRING: ::UINT = 0x0002; +pub const LVFI_SUBSTRING: ::UINT = 0x0004; +pub const LVFI_PARTIAL: ::UINT = 0x0008; +pub const LVFI_WRAP: ::UINT = 0x0020; +pub const LVFI_NEARESTXY: ::UINT = 0x0040; +pub type LV_FINDINFOA = LVFINDINFOA; +pub type LV_FINDINFOW = LVFINDINFOW; +STRUCT!{struct LVFINDINFOA { + flags: ::UINT, + psz: ::LPCSTR, + lParam: ::LPARAM, + pt: ::POINT, + vkDirection: ::UINT, +}} +pub type LPLVFINDINFOA = *mut LVFINDINFOA; +STRUCT!{struct LVFINDINFOW { + flags: ::UINT, + psz: ::LPCWSTR, + lParam: ::LPARAM, + pt: ::POINT, + vkDirection: ::UINT, +}} +pub type LPLVFINDINFOW = *mut LVFINDINFOW; +pub const LVM_FINDITEMA: ::UINT = LVM_FIRST + 13; +pub const LVM_FINDITEMW: ::UINT = LVM_FIRST + 83; +pub const LVIR_BOUNDS: ::c_int = 0; +pub const LVIR_ICON: ::c_int = 1; +pub const LVIR_LABEL: ::c_int = 2; +pub const LVIR_SELECTBOUNDS: ::c_int = 3; +pub const LVM_GETITEMRECT: ::UINT = LVM_FIRST + 14; +pub const LVM_SETITEMPOSITION: ::UINT = LVM_FIRST + 15; +pub const LVM_GETITEMPOSITION: ::UINT = LVM_FIRST + 16; +pub const LVM_GETSTRINGWIDTHA: ::UINT = LVM_FIRST + 17; +pub const LVM_GETSTRINGWIDTHW: ::UINT = LVM_FIRST + 87; +pub const LVHT_NOWHERE: ::UINT = 0x00000001; +pub const LVHT_ONITEMICON: ::UINT = 0x00000002; +pub const LVHT_ONITEMLABEL: ::UINT = 0x00000004; +pub const LVHT_ONITEMSTATEICON: ::UINT = 0x00000008; +pub const LVHT_ONITEM: ::UINT = LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON; +pub const LVHT_ABOVE: ::UINT = 0x00000008; +pub const LVHT_BELOW: ::UINT = 0x00000010; +pub const LVHT_TORIGHT: ::UINT = 0x00000020; +pub const LVHT_TOLEFT: ::UINT = 0x00000040; +pub const LVHT_EX_GROUP_HEADER: ::UINT = 0x10000000; +pub const LVHT_EX_GROUP_FOOTER: ::UINT = 0x20000000; +pub const LVHT_EX_GROUP_COLLAPSE: ::UINT = 0x40000000; +pub const LVHT_EX_GROUP_BACKGROUND: ::UINT = 0x80000000; +pub const LVHT_EX_GROUP_STATEICON: ::UINT = 0x01000000; +pub const LVHT_EX_GROUP_SUBSETLINK: ::UINT = 0x02000000; +pub const LVHT_EX_GROUP: ::UINT = LVHT_EX_GROUP_BACKGROUND | LVHT_EX_GROUP_COLLAPSE + | LVHT_EX_GROUP_FOOTER | LVHT_EX_GROUP_HEADER | LVHT_EX_GROUP_STATEICON + | LVHT_EX_GROUP_SUBSETLINK; +pub const LVHT_EX_ONCONTENTS: ::UINT = 0x04000000; +pub const LVHT_EX_FOOTER: ::UINT = 0x08000000; +pub type LV_HITTESTINFO = LVHITTESTINFO; +STRUCT!{struct LVHITTESTINFO { + pt: ::POINT, + flags: ::UINT, + iItem: ::c_int, + iSubItem: ::c_int, + iGroup: ::c_int, +}} +pub type LPLVHITTESTINFO = *mut LVHITTESTINFO; +pub const LVM_HITTEST: ::UINT = LVM_FIRST + 18; +pub const LVM_ENSUREVISIBLE: ::UINT = LVM_FIRST + 19; +pub const LVM_SCROLL: ::UINT = LVM_FIRST + 20; +pub const LVM_REDRAWITEMS: ::UINT = LVM_FIRST + 21; +pub const LVA_DEFAULT: ::WPARAM = 0x0000; +pub const LVA_ALIGNLEFT: ::WPARAM = 0x0001; +pub const LVA_ALIGNTOP: ::WPARAM = 0x0002; +pub const LVA_SNAPTOGRID: ::WPARAM = 0x0005; +pub const LVM_ARRANGE: ::UINT = LVM_FIRST + 22; +pub const LVM_EDITLABELA: ::UINT = LVM_FIRST + 23; +pub const LVM_EDITLABELW: ::UINT = LVM_FIRST + 118; +pub const LVM_GETEDITCONTROL: ::UINT = LVM_FIRST + 24; +pub type LV_COLUMNA = LVCOLUMNA; +pub type LV_COLUMNW = LVCOLUMNW; +STRUCT!{struct LVCOLUMNA { + mask: ::UINT, + fmt: ::c_int, + cx: ::c_int, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iSubItem: ::c_int, + iImage: ::c_int, + iOrder: ::c_int, + cxMin: ::c_int, + cxDefault: ::c_int, + cxIdeal: ::c_int, +}} +pub type LPLVCOLUMNA = *mut LVCOLUMNA; +STRUCT!{struct LVCOLUMNW { + mask: ::UINT, + fmt: ::c_int, + cx: ::c_int, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iSubItem: ::c_int, + iImage: ::c_int, + iOrder: ::c_int, + cxMin: ::c_int, + cxDefault: ::c_int, + cxIdeal: ::c_int, +}} +pub type LPLVCOLUMNW = *mut LVCOLUMNW; +pub const LVCF_FMT: ::UINT = 0x0001; +pub const LVCF_WIDTH: ::UINT = 0x0002; +pub const LVCF_TEXT: ::UINT = 0x0004; +pub const LVCF_SUBITEM: ::UINT = 0x0008; +pub const LVCF_IMAGE: ::UINT = 0x0010; +pub const LVCF_ORDER: ::UINT = 0x0020; +pub const LVCF_MINWIDTH: ::UINT = 0x0040; +pub const LVCF_DEFAULTWIDTH: ::UINT = 0x0080; +pub const LVCF_IDEALWIDTH: ::UINT = 0x0100; +pub const LVCFMT_LEFT: ::c_int = 0x0000; +pub const LVCFMT_RIGHT: ::c_int = 0x0001; +pub const LVCFMT_CENTER: ::c_int = 0x0002; +pub const LVCFMT_JUSTIFYMASK: ::c_int = 0x0003; +pub const LVCFMT_IMAGE: ::c_int = 0x0800; +pub const LVCFMT_BITMAP_ON_RIGHT: ::c_int = 0x1000; +pub const LVCFMT_COL_HAS_IMAGES: ::c_int = 0x8000; +pub const LVCFMT_FIXED_WIDTH: ::c_int = 0x00100; +pub const LVCFMT_NO_DPI_SCALE: ::c_int = 0x40000; +pub const LVCFMT_FIXED_RATIO: ::c_int = 0x80000; +pub const LVCFMT_LINE_BREAK: ::c_int = 0x100000; +pub const LVCFMT_FILL: ::c_int = 0x200000; +pub const LVCFMT_WRAP: ::c_int = 0x400000; +pub const LVCFMT_NO_TITLE: ::c_int = 0x800000; +pub const LVCFMT_TILE_PLACEMENTMASK: ::c_int = LVCFMT_LINE_BREAK | LVCFMT_FILL; +pub const LVCFMT_SPLITBUTTON: ::c_int = 0x1000000; +pub const LVM_GETCOLUMNA: ::UINT = LVM_FIRST + 25; +pub const LVM_GETCOLUMNW: ::UINT = LVM_FIRST + 95; +pub const LVM_SETCOLUMNA: ::UINT = LVM_FIRST + 26; +pub const LVM_SETCOLUMNW: ::UINT = LVM_FIRST + 96; +pub const LVM_INSERTCOLUMNA: ::UINT = LVM_FIRST + 27; +pub const LVM_INSERTCOLUMNW: ::UINT = LVM_FIRST + 97; +pub const LVM_DELETECOLUMN: ::UINT = LVM_FIRST + 28; +pub const LVM_GETCOLUMNWIDTH: ::UINT = LVM_FIRST + 29; +pub const LVM_SETCOLUMNWIDTH: ::UINT = LVM_FIRST + 30; +pub const LVM_GETHEADER: ::UINT = LVM_FIRST + 31; +pub const LVM_CREATEDRAGIMAGE: ::UINT = LVM_FIRST + 33; +pub const LVM_GETVIEWRECT: ::UINT = LVM_FIRST + 34; +pub const LVM_GETTEXTCOLOR: ::UINT = LVM_FIRST + 35; +pub const LVM_SETTEXTCOLOR: ::UINT = LVM_FIRST + 36; +pub const LVM_GETTEXTBKCOLOR: ::UINT = LVM_FIRST + 37; +pub const LVM_SETTEXTBKCOLOR: ::UINT = LVM_FIRST + 38; +pub const LVM_GETTOPINDEX: ::UINT = LVM_FIRST + 39; +pub const LVM_GETCOUNTPERPAGE: ::UINT = LVM_FIRST + 40; +pub const LVM_GETORIGIN: ::UINT = LVM_FIRST + 41; +pub const LVM_UPDATE: ::UINT = LVM_FIRST + 42; +pub const LVM_SETITEMSTATE: ::UINT = LVM_FIRST + 43; +pub const LVM_GETITEMSTATE: ::UINT = LVM_FIRST + 44; +pub const LVM_GETITEMTEXTA: ::UINT = LVM_FIRST + 45; +pub const LVM_GETITEMTEXTW: ::UINT = LVM_FIRST + 115; +pub const LVM_SETITEMTEXTA: ::UINT = LVM_FIRST + 46; +pub const LVM_SETITEMTEXTW: ::UINT = LVM_FIRST + 116; +pub const LVM_SETITEMCOUNT: ::UINT = LVM_FIRST + 47; +pub const LVM_SORTITEMS: ::UINT = LVM_FIRST + 48; +pub const LVM_SETITEMPOSITION32: ::UINT = LVM_FIRST + 49; +pub const LVM_GETSELECTEDCOUNT: ::UINT = LVM_FIRST + 50; +pub const LVM_GETITEMSPACING: ::UINT = LVM_FIRST + 51; +pub const LVM_GETISEARCHSTRINGA: ::UINT = LVM_FIRST + 52; +pub const LVM_GETISEARCHSTRINGW: ::UINT = LVM_FIRST + 117; +pub const LVM_SETICONSPACING: ::UINT = LVM_FIRST + 53; +pub const LVM_SETEXTENDEDLISTVIEWSTYLE: ::UINT = LVM_FIRST + 54; +pub const LVM_GETEXTENDEDLISTVIEWSTYLE: ::UINT = LVM_FIRST + 55; +pub const LVSICF_NOINVALIDATEALL: ::LPARAM = 0x00000001; +pub const LVSICF_NOSCROLL: ::LPARAM = 0x00000002; +pub const LVS_EX_GRIDLINES: ::DWORD = 0x00000001; +pub const LVS_EX_SUBITEMIMAGES: ::DWORD = 0x00000002; +pub const LVS_EX_CHECKBOXES: ::DWORD = 0x00000004; +pub const LVS_EX_TRACKSELECT: ::DWORD = 0x00000008; +pub const LVS_EX_HEADERDRAGDROP: ::DWORD = 0x00000010; +pub const LVS_EX_FULLROWSELECT: ::DWORD = 0x00000020; +pub const LVS_EX_ONECLICKACTIVATE: ::DWORD = 0x00000040; +pub const LVS_EX_TWOCLICKACTIVATE: ::DWORD = 0x00000080; +pub const LVS_EX_FLATSB: ::DWORD = 0x00000100; +pub const LVS_EX_REGIONAL: ::DWORD = 0x00000200; +pub const LVS_EX_INFOTIP: ::DWORD = 0x00000400; +pub const LVS_EX_UNDERLINEHOT: ::DWORD = 0x00000800; +pub const LVS_EX_UNDERLINECOLD: ::DWORD = 0x00001000; +pub const LVS_EX_MULTIWORKAREAS: ::DWORD = 0x00002000; +pub const LVS_EX_LABELTIP: ::DWORD = 0x00004000; +pub const LVS_EX_BORDERSELECT: ::DWORD = 0x00008000; +pub const LVS_EX_DOUBLEBUFFER: ::DWORD = 0x00010000; +pub const LVS_EX_HIDELABELS: ::DWORD = 0x00020000; +pub const LVS_EX_SINGLEROW: ::DWORD = 0x00040000; +pub const LVS_EX_SNAPTOGRID: ::DWORD = 0x00080000; +pub const LVS_EX_SIMPLESELECT: ::DWORD = 0x00100000; +pub const LVS_EX_JUSTIFYCOLUMNS: ::DWORD = 0x00200000; +pub const LVS_EX_TRANSPARENTBKGND: ::DWORD = 0x00400000; +pub const LVS_EX_TRANSPARENTSHADOWTEXT: ::DWORD = 0x00800000; +pub const LVS_EX_AUTOAUTOARRANGE: ::DWORD = 0x01000000; +pub const LVS_EX_HEADERINALLVIEWS: ::DWORD = 0x02000000; +pub const LVS_EX_AUTOCHECKSELECT: ::DWORD = 0x08000000; +pub const LVS_EX_AUTOSIZECOLUMNS: ::DWORD = 0x10000000; +pub const LVS_EX_COLUMNSNAPPOINTS: ::DWORD = 0x40000000; +pub const LVS_EX_COLUMNOVERFLOW: ::DWORD = 0x80000000; +pub const LVM_GETSUBITEMRECT: ::UINT = LVM_FIRST + 56; +pub const LVM_SUBITEMHITTEST: ::UINT = LVM_FIRST + 57; +pub const LVM_SETCOLUMNORDERARRAY: ::UINT = LVM_FIRST + 58; +pub const LVM_GETCOLUMNORDERARRAY: ::UINT = LVM_FIRST + 59; +pub const LVM_SETHOTITEM: ::UINT = LVM_FIRST + 60; +pub const LVM_GETHOTITEM: ::UINT = LVM_FIRST + 61; +pub const LVM_SETHOTCURSOR: ::UINT = LVM_FIRST + 62; +pub const LVM_GETHOTCURSOR: ::UINT = LVM_FIRST + 63; +pub const LVM_APPROXIMATEVIEWRECT: ::UINT = LVM_FIRST + 64; +pub const LV_MAX_WORKAREAS: ::WPARAM = 16; +pub const LVM_SETWORKAREAS: ::UINT = LVM_FIRST + 65; +pub const LVM_GETWORKAREAS: ::UINT = LVM_FIRST + 70; +pub const LVM_GETNUMBEROFWORKAREAS: ::UINT = LVM_FIRST + 73; +pub const LVM_GETSELECTIONMARK: ::UINT = LVM_FIRST + 66; +pub const LVM_SETSELECTIONMARK: ::UINT = LVM_FIRST + 67; +pub const LVM_SETHOVERTIME: ::UINT = LVM_FIRST + 71; +pub const LVM_GETHOVERTIME: ::UINT = LVM_FIRST + 72; +pub const LVM_SETTOOLTIPS: ::UINT = LVM_FIRST + 74; +pub const LVM_GETTOOLTIPS: ::UINT = LVM_FIRST + 78; +pub const LVM_SORTITEMSEX: ::UINT = LVM_FIRST + 81; +STRUCT!{struct LVBKIMAGEA { + ulFlags: ::ULONG, + hbm: ::HBITMAP, + pszImage: ::LPSTR, + cchImageMax: ::UINT, + xOffsetPercent: ::c_int, + yOffsetPercent: ::c_int, +}} +pub type LPLVBKIMAGEA = *mut LVBKIMAGEA; +STRUCT!{struct LVBKIMAGEW { + ulFlags: ::ULONG, + hbm: ::HBITMAP, + pszImage: ::LPWSTR, + cchImageMax: ::UINT, + xOffsetPercent: ::c_int, + yOffsetPercent: ::c_int, +}} +pub type LPLVBKIMAGEW = *mut LVBKIMAGEW; +pub const LVBKIF_SOURCE_NONE: ::ULONG = 0x00000000; +pub const LVBKIF_SOURCE_HBITMAP: ::ULONG = 0x00000001; +pub const LVBKIF_SOURCE_URL: ::ULONG = 0x00000002; +pub const LVBKIF_SOURCE_MASK: ::ULONG = 0x00000003; +pub const LVBKIF_STYLE_NORMAL: ::ULONG = 0x00000000; +pub const LVBKIF_STYLE_TILE: ::ULONG = 0x00000010; +pub const LVBKIF_STYLE_MASK: ::ULONG = 0x00000010; +pub const LVBKIF_FLAG_TILEOFFSET: ::ULONG = 0x00000100; +pub const LVBKIF_TYPE_WATERMARK: ::ULONG = 0x10000000; +pub const LVBKIF_FLAG_ALPHABLEND: ::ULONG = 0x20000000; +pub const LVM_SETBKIMAGEA: ::UINT = LVM_FIRST + 68; +pub const LVM_SETBKIMAGEW: ::UINT = LVM_FIRST + 138; +pub const LVM_GETBKIMAGEA: ::UINT = LVM_FIRST + 69; +pub const LVM_GETBKIMAGEW: ::UINT = LVM_FIRST + 139; +pub const LVM_SETSELECTEDCOLUMN: ::UINT = LVM_FIRST + 140; +pub const LV_VIEW_ICON: ::DWORD = 0x0000; +pub const LV_VIEW_DETAILS: ::DWORD = 0x0001; +pub const LV_VIEW_SMALLICON: ::DWORD = 0x0002; +pub const LV_VIEW_LIST: ::DWORD = 0x0003; +pub const LV_VIEW_TILE: ::DWORD = 0x0004; +pub const LV_VIEW_MAX: ::DWORD = 0x0004; +pub const LVM_SETVIEW: ::UINT = LVM_FIRST + 142; +pub const LVM_GETVIEW: ::UINT = LVM_FIRST + 143; +pub const LVGF_NONE: ::UINT = 0x00000000; +pub const LVGF_HEADER: ::UINT = 0x00000001; +pub const LVGF_FOOTER: ::UINT = 0x00000002; +pub const LVGF_STATE: ::UINT = 0x00000004; +pub const LVGF_ALIGN: ::UINT = 0x00000008; +pub const LVGF_GROUPID: ::UINT = 0x00000010; +pub const LVGF_SUBTITLE: ::UINT = 0x00000100; +pub const LVGF_TASK: ::UINT = 0x00000200; +pub const LVGF_DESCRIPTIONTOP: ::UINT = 0x00000400; +pub const LVGF_DESCRIPTIONBOTTOM: ::UINT = 0x00000800; +pub const LVGF_TITLEIMAGE: ::UINT = 0x00001000; +pub const LVGF_EXTENDEDIMAGE: ::UINT = 0x00002000; +pub const LVGF_ITEMS: ::UINT = 0x00004000; +pub const LVGF_SUBSET: ::UINT = 0x00008000; +pub const LVGF_SUBSETITEMS: ::UINT = 0x00010000; +pub const LVGS_NORMAL: ::UINT = 0x00000000; +pub const LVGS_COLLAPSED: ::UINT = 0x00000001; +pub const LVGS_HIDDEN: ::UINT = 0x00000002; +pub const LVGS_NOHEADER: ::UINT = 0x00000004; +pub const LVGS_COLLAPSIBLE: ::UINT = 0x00000008; +pub const LVGS_FOCUSED: ::UINT = 0x00000010; +pub const LVGS_SELECTED: ::UINT = 0x00000020; +pub const LVGS_SUBSETED: ::UINT = 0x00000040; +pub const LVGS_SUBSETLINKFOCUSED: ::UINT = 0x00000080; +pub const LVGA_HEADER_LEFT: ::UINT = 0x00000001; +pub const LVGA_HEADER_CENTER: ::UINT = 0x00000002; +pub const LVGA_HEADER_RIGHT: ::UINT = 0x00000004; +pub const LVGA_FOOTER_LEFT: ::UINT = 0x00000008; +pub const LVGA_FOOTER_CENTER: ::UINT = 0x00000010; +pub const LVGA_FOOTER_RIGHT: ::UINT = 0x00000020; +STRUCT!{struct LVGROUP { + cbSize: ::UINT, + mask: ::UINT, + pszHeader: ::LPWSTR, + cchHeader: ::c_int, + pszFooter: ::LPWSTR, + cchFooter: ::c_int, + iGroupId: ::c_int, + stateMask: ::UINT, + state: ::UINT, + uAlign: ::UINT, + pszSubtitle: ::LPWSTR, + cchSubtitle: ::UINT, + pszTask: ::LPWSTR, + cchTask: ::UINT, + pszDescriptionTop: ::LPWSTR, + cchDescriptionTop: ::UINT, + pszDescriptionBottom: ::LPWSTR, + cchDescriptionBottom: ::UINT, + iTitleImage: ::c_int, + iExtendedImage: ::c_int, + iFirstItem: ::c_int, + cItems: ::UINT, + pszSubsetTitle: ::LPWSTR, + cchSubsetTitle: ::UINT, +}} +pub type PLVGROUP = *mut LVGROUP; +pub const LVM_INSERTGROUP: ::UINT = LVM_FIRST + 145; +pub const LVM_SETGROUPINFO: ::UINT = LVM_FIRST + 147; +pub const LVM_GETGROUPINFO: ::UINT = LVM_FIRST + 149; +pub const LVM_REMOVEGROUP: ::UINT = LVM_FIRST + 150; +pub const LVM_MOVEGROUP: ::UINT = LVM_FIRST + 151; +pub const LVM_GETGROUPCOUNT: ::UINT = LVM_FIRST + 152; +pub const LVM_GETGROUPINFOBYINDEX: ::UINT = LVM_FIRST + 153; +pub const LVM_MOVEITEMTOGROUP: ::UINT = LVM_FIRST + 154; +pub const LVM_GETGROUPRECT: ::UINT = LVM_FIRST + 98; +pub const LVGGR_GROUP: ::LPARAM = 0; +pub const LVGGR_HEADER: ::LPARAM = 1; +pub const LVGGR_LABEL: ::LPARAM = 2; +pub const LVGGR_SUBSETLINK: ::LPARAM = 3; +pub const LVGMF_NONE: ::UINT = 0x00000000; +pub const LVGMF_BORDERSIZE: ::UINT = 0x00000001; +pub const LVGMF_BORDERCOLOR: ::UINT = 0x00000002; +pub const LVGMF_TEXTCOLOR: ::UINT = 0x00000004; +STRUCT!{struct LVGROUPMETRICS { + cbSize: ::UINT, + mask: ::UINT, + Left: ::UINT, + Top: ::UINT, + Right: ::UINT, + Bottom: ::UINT, + crLeft: ::COLORREF, + crTop: ::COLORREF, + crRight: ::COLORREF, + crBottom: ::COLORREF, + crHeader: ::COLORREF, + crFooter: ::COLORREF, +}} +pub type PLVGROUPMETRICS = *mut LVGROUPMETRICS; +pub const LVM_SETGROUPMETRICS: ::UINT = LVM_FIRST + 155; +pub const LVM_GETGROUPMETRICS: ::UINT = LVM_FIRST + 156; +pub const LVM_ENABLEGROUPVIEW: ::UINT = LVM_FIRST + 157; +pub const LVM_SORTGROUPS: ::UINT = LVM_FIRST + 158; +pub type PFNLVGROUPCOMPARE = Option ::c_int>; +STRUCT!{nodebug struct LVINSERTGROUPSORTED { + pfnGroupCompare: PFNLVGROUPCOMPARE, + pvData: *mut ::c_void, + lvGroup: LVGROUP, +}} +pub type PLVINSERTGROUPSORTED = *mut LVINSERTGROUPSORTED; +pub const LVM_INSERTGROUPSORTED: ::UINT = LVM_FIRST + 159; +pub const LVM_REMOVEALLGROUPS: ::UINT = LVM_FIRST + 160; +pub const LVM_HASGROUP: ::UINT = LVM_FIRST + 161; +pub const LVM_GETGROUPSTATE: ::UINT = LVM_FIRST + 92; +pub const LVM_GETFOCUSEDGROUP: ::UINT = LVM_FIRST + 93; +pub const LVTVIF_AUTOSIZE: ::DWORD = 0x00000000; +pub const LVTVIF_FIXEDWIDTH: ::DWORD = 0x00000001; +pub const LVTVIF_FIXEDHEIGHT: ::DWORD = 0x00000002; +pub const LVTVIF_FIXEDSIZE: ::DWORD = 0x00000003; +pub const LVTVIF_EXTENDED: ::DWORD = 0x00000004; +pub const LVTVIM_TILESIZE: ::DWORD = 0x00000001; +pub const LVTVIM_COLUMNS: ::DWORD = 0x00000002; +pub const LVTVIM_LABELMARGIN: ::DWORD = 0x00000004; +STRUCT!{struct LVTILEVIEWINFO { + cbSize: ::UINT, + dwMask: ::DWORD, + dwFlags: ::DWORD, + sizeTile: ::SIZE, + cLines: ::c_int, + rcLabelMargin: ::RECT, +}} +pub type PLVTILEVIEWINFO = *mut LVTILEVIEWINFO; +STRUCT!{struct LVTILEINFO { + cbSize: ::UINT, + iItem: ::c_int, + cColumns: ::UINT, + puColumns: ::PUINT, + piColFmt: *mut ::c_int, +}} +pub type PLVTILEINFO = *mut LVTILEINFO; +pub const LVM_SETTILEVIEWINFO: ::UINT = LVM_FIRST + 162; +pub const LVM_GETTILEVIEWINFO: ::UINT = LVM_FIRST + 163; +pub const LVM_SETTILEINFO: ::UINT = LVM_FIRST + 164; +pub const LVM_GETTILEINFO: ::UINT = LVM_FIRST + 165; +STRUCT!{struct LVINSERTMARK { + cbSize: ::UINT, + dwFlags: ::DWORD, + iItem: ::c_int, + dwReserved: ::DWORD, +}} +pub type LPLVINSERTMARK = *mut LVINSERTMARK; +pub const LVIM_AFTER: ::DWORD = 0x00000001; +pub const LVM_SETINSERTMARK: ::UINT = LVM_FIRST + 166; +pub const LVM_GETINSERTMARK: ::UINT = LVM_FIRST + 167; +pub const LVM_INSERTMARKHITTEST: ::UINT = LVM_FIRST + 168; +pub const LVM_GETINSERTMARKRECT: ::UINT = LVM_FIRST + 169; +pub const LVM_SETINSERTMARKCOLOR: ::UINT = LVM_FIRST + 170; +pub const LVM_GETINSERTMARKCOLOR: ::UINT = LVM_FIRST + 171; +STRUCT!{struct LVSETINFOTIP { + cbSize: ::UINT, + dwFlags: ::DWORD, + pszText: ::LPWSTR, + iItem: ::c_int, + iSubItem: ::c_int, +}} +pub type PLVSETINFOTIP = *mut LVSETINFOTIP; +pub const LVM_SETINFOTIP: ::UINT = LVM_FIRST + 173; +pub const LVM_GETSELECTEDCOLUMN: ::UINT = LVM_FIRST + 174; +pub const LVM_ISGROUPVIEWENABLED: ::UINT = LVM_FIRST + 175; +pub const LVM_GETOUTLINECOLOR: ::UINT = LVM_FIRST + 176; +pub const LVM_SETOUTLINECOLOR: ::UINT = LVM_FIRST + 177; +pub const LVM_CANCELEDITLABEL: ::UINT = LVM_FIRST + 179; +pub const LVM_MAPINDEXTOID: ::UINT = LVM_FIRST + 180; +pub const LVM_MAPIDTOINDEX: ::UINT = LVM_FIRST + 181; +pub const LVM_ISITEMVISIBLE: ::UINT = LVM_FIRST + 182; +pub const LVM_GETEMPTYTEXT: ::UINT = LVM_FIRST + 204; +pub const LVM_GETFOOTERRECT: ::UINT = LVM_FIRST + 205; +pub const LVFF_ITEMCOUNT: ::UINT = 0x00000001; +STRUCT!{struct LVFOOTERINFO { + mask: ::UINT, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + cItems: ::UINT, +}} +pub type LPLVFOOTERINFO = *mut LVFOOTERINFO; +pub const LVM_GETFOOTERINFO: ::UINT = LVM_FIRST + 206; +pub const LVM_GETFOOTERITEMRECT: ::UINT = LVM_FIRST + 207; +pub const LVFIF_TEXT: ::UINT = 0x00000001; +pub const LVFIF_STATE: ::UINT = 0x00000002; +pub const LVFIS_FOCUSED: ::UINT = 0x0001; +STRUCT!{struct LVFOOTERITEM { + mask: ::UINT, + iItem: ::c_int, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + state: ::UINT, + stateMask: ::UINT, +}} +pub type LPLVFOOTERITEM = *mut LVFOOTERITEM; +pub const LVM_GETFOOTERITEM: ::UINT = LVM_FIRST + 208; +STRUCT!{struct LVITEMINDEX { + iItem: ::c_int, + iGroup: ::c_int, +}} +pub type PLVITEMINDEX = *mut LVITEMINDEX; +pub const LVM_GETITEMINDEXRECT: ::UINT = LVM_FIRST + 209; +pub const LVM_SETITEMINDEXSTATE: ::UINT = LVM_FIRST + 210; +pub const LVM_GETNEXTITEMINDEX: ::UINT = LVM_FIRST + 211; +pub type LPNM_LISTVIEW = LPNMLISTVIEW; +pub type NM_LISTVIEW = NMLISTVIEW; +STRUCT!{struct NMLISTVIEW { + hdr: ::NMHDR, + iItem: ::c_int, + iSubItem: ::c_int, + uNewState: ::UINT, + uOldState: ::UINT, + uChanged: ::UINT, + ptAction: ::POINT, + lParam: ::LPARAM, +}} +pub type LPNMLISTVIEW = *mut NMLISTVIEW; +STRUCT!{struct NMITEMACTIVATE { + hdr: ::NMHDR, + iItem: ::c_int, + iSubItem: ::c_int, + uNewState: ::UINT, + uOldState: ::UINT, + uChanged: ::UINT, + ptAction: ::POINT, + lParam: ::LPARAM, + uKeyFlags: ::UINT, +}} +pub type LPNMITEMACTIVATE = *mut NMITEMACTIVATE; +pub const LVKF_ALT: ::UINT = 0x0001; +pub const LVKF_CONTROL: ::UINT = 0x0002; +pub const LVKF_SHIFT: ::UINT = 0x0004; +STRUCT!{struct NMLVCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + clrText: ::COLORREF, + clrTextBk: ::COLORREF, + iSubItem: ::c_int, + dwItemType: ::DWORD, + clrFace: ::COLORREF, + iIconEffect: ::c_int, + iIconPhase: ::c_int, + iPartId: ::c_int, + iStateId: ::c_int, + rcText: ::RECT, + uAlign: ::UINT, +}} +pub type LPNMLVCUSTOMDRAW = *mut NMLVCUSTOMDRAW; +pub const LVCDI_ITEM: ::DWORD = 0x00000000; +pub const LVCDI_GROUP: ::DWORD = 0x00000001; +pub const LVCDI_ITEMSLIST: ::DWORD = 0x00000002; +pub const LVCDRF_NOSELECT: ::LRESULT = 0x00010000; +pub const LVCDRF_NOGROUPFRAME: ::LRESULT = 0x00020000; +STRUCT!{struct NMLVCACHEHINT { + hdr: ::NMHDR, + iFrom: ::c_int, + iTo: ::c_int, +}} +pub type LPNMLVCACHEHINT = *mut NMLVCACHEHINT; +pub type LPNM_CACHEHINT = LPNMLVCACHEHINT; +pub type PNM_CACHEHINT = LPNMLVCACHEHINT; +pub type NM_CACHEHINT = NMLVCACHEHINT; +STRUCT!{struct NMLVFINDITEMA { + hdr: ::NMHDR, + iStart: ::c_int, + lvfi: LVFINDINFOA, +}} +pub type LPNMLVFINDITEMA = *mut NMLVFINDITEMA; +STRUCT!{struct NMLVFINDITEMW { + hdr: ::NMHDR, + iStart: ::c_int, + lvfi: LVFINDINFOW, +}} +pub type LPNMLVFINDITEMW = *mut NMLVFINDITEMW; +pub type PNM_FINDITEMA = LPNMLVFINDITEMA; +pub type LPNM_FINDITEMA = LPNMLVFINDITEMA; +pub type NM_FINDITEMA = NMLVFINDITEMA; +pub type PNM_FINDITEMW = LPNMLVFINDITEMW; +pub type LPNM_FINDITEMW = LPNMLVFINDITEMW; +pub type NM_FINDITEMW = NMLVFINDITEMW; +STRUCT!{struct NMLVODSTATECHANGE { + hdr: ::NMHDR, + iFrom: ::c_int, + iTo: ::c_int, + uNewState: ::UINT, + uOldState: ::UINT, +}} +pub type LPNMLVODSTATECHANGE = *mut NMLVODSTATECHANGE; +pub type PNM_ODSTATECHANGE = LPNMLVODSTATECHANGE; +pub type LPNM_ODSTATECHANGE = LPNMLVODSTATECHANGE; +pub type NM_ODSTATECHANGE = NMLVODSTATECHANGE; +pub const LVN_ITEMCHANGING: ::UINT = LVN_FIRST - 0; +pub const LVN_ITEMCHANGED: ::UINT = LVN_FIRST - 1; +pub const LVN_INSERTITEM: ::UINT = LVN_FIRST - 2; +pub const LVN_DELETEITEM: ::UINT = LVN_FIRST - 3; +pub const LVN_DELETEALLITEMS: ::UINT = LVN_FIRST - 4; +pub const LVN_BEGINLABELEDITA: ::UINT = LVN_FIRST - 5; +pub const LVN_BEGINLABELEDITW: ::UINT = LVN_FIRST - 75; +pub const LVN_ENDLABELEDITA: ::UINT = LVN_FIRST - 6; +pub const LVN_ENDLABELEDITW: ::UINT = LVN_FIRST - 76; +pub const LVN_COLUMNCLICK: ::UINT = LVN_FIRST - 8; +pub const LVN_BEGINDRAG: ::UINT = LVN_FIRST - 9; +pub const LVN_BEGINRDRAG: ::UINT = LVN_FIRST - 11; +pub const LVN_ODCACHEHINT: ::UINT = LVN_FIRST - 13; +pub const LVN_ODFINDITEMA: ::UINT = LVN_FIRST - 52; +pub const LVN_ODFINDITEMW: ::UINT = LVN_FIRST - 79; +pub const LVN_ITEMACTIVATE: ::UINT = LVN_FIRST - 14; +pub const LVN_ODSTATECHANGED: ::UINT = LVN_FIRST - 15; +pub const LVN_HOTTRACK: ::UINT = LVN_FIRST - 21; +pub const LVN_GETDISPINFOA: ::UINT = LVN_FIRST - 50; +pub const LVN_GETDISPINFOW: ::UINT = LVN_FIRST - 77; +pub const LVN_SETDISPINFOA: ::UINT = LVN_FIRST - 51; +pub const LVN_SETDISPINFOW: ::UINT = LVN_FIRST - 78; +pub const LVIF_DI_SETITEM: ::UINT = 0x1000; +pub type LV_DISPINFOA = NMLVDISPINFOA; +pub type LV_DISPINFOW = NMLVDISPINFOW; +STRUCT!{struct NMLVDISPINFOA { + hdr: ::NMHDR, + item: LVITEMA, +}} +pub type LPNMLVDISPINFOA = *mut NMLVDISPINFOA; +STRUCT!{struct NMLVDISPINFOW { + hdr: ::NMHDR, + item: LVITEMW, +}} +pub type LPNMLVDISPINFOW = *mut NMLVDISPINFOW; +pub const LVN_KEYDOWN: ::UINT = LVN_FIRST - 55; +pub type LV_KEYDOWN = NMLVKEYDOWN; +STRUCT!{struct NMLVKEYDOWN { + hdr: ::NMHDR, + wVKey: ::WORD, + flags: ::UINT, +}} +pub type LPNMLVKEYDOWN = *mut NMLVKEYDOWN; +pub const LVN_MARQUEEBEGIN: ::UINT = LVN_FIRST - 56; +STRUCT!{nodebug struct NMLVLINK { + hdr: ::NMHDR, + link: LITEM, + iItem: ::c_int, + iSubItem: ::c_int, +}} +pub type PNMLVLINK = *mut NMLVLINK; +STRUCT!{struct NMLVGETINFOTIPA { + hdr: ::NMHDR, + dwFlags: ::DWORD, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iItem: ::c_int, + iSubItem: ::c_int, + lParam: ::LPARAM, +}} +pub type LPNMLVGETINFOTIPA = *mut NMLVGETINFOTIPA; +STRUCT!{struct NMLVGETINFOTIPW { + hdr: ::NMHDR, + dwFlags: ::DWORD, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iItem: ::c_int, + iSubItem: ::c_int, + lParam: ::LPARAM, +}} +pub type LPNMLVGETINFOTIPW = *mut NMLVGETINFOTIPW; +pub const LVGIT_UNFOLDED: ::DWORD = 0x0001; +pub const LVN_GETINFOTIPA: ::UINT = LVN_FIRST - 57; +pub const LVN_GETINFOTIPW: ::UINT = LVN_FIRST - 58; +pub const LVNSCH_DEFAULT: ::LPARAM = -1; +pub const LVNSCH_ERROR: ::LPARAM = -2; +pub const LVNSCH_IGNORE: ::LPARAM = -3; +pub const LVN_INCREMENTALSEARCHA: ::UINT = LVN_FIRST - 62; +pub const LVN_INCREMENTALSEARCHW: ::UINT = LVN_FIRST - 63; +pub const LVN_COLUMNDROPDOWN: ::UINT = LVN_FIRST - 64; +pub const LVN_COLUMNOVERFLOWCLICK: ::UINT = LVN_FIRST - 66; +STRUCT!{struct NMLVSCROLL { + hdr: ::NMHDR, + dx: ::c_int, + dy: ::c_int, +}} +pub type LPNMLVSCROLL = *mut NMLVSCROLL; +pub const LVN_BEGINSCROLL: ::UINT = LVN_FIRST - 80; +pub const LVN_ENDSCROLL: ::UINT = LVN_FIRST - 81; +pub const LVN_LINKCLICK: ::UINT = LVN_FIRST - 84; +pub const EMF_CENTERED: ::DWORD = 0x00000001; +STRUCT!{nodebug struct NMLVEMPTYMARKUP { + hdr: ::NMHDR, + dwFlags: ::DWORD, + szMarkup: [::WCHAR; L_MAX_URL_LENGTH], +}} +pub const LVN_GETEMPTYMARKUP: ::UINT = LVN_FIRST - 87; +pub const TVS_HASBUTTONS: ::DWORD = 0x0001; +pub const TVS_HASLINES: ::DWORD = 0x0002; +pub const TVS_LINESATROOT: ::DWORD = 0x0004; +pub const TVS_EDITLABELS: ::DWORD = 0x0008; +pub const TVS_DISABLEDRAGDROP: ::DWORD = 0x0010; +pub const TVS_SHOWSELALWAYS: ::DWORD = 0x0020; +pub const TVS_RTLREADING: ::DWORD = 0x0040; +pub const TVS_NOTOOLTIPS: ::DWORD = 0x0080; +pub const TVS_CHECKBOXES: ::DWORD = 0x0100; +pub const TVS_TRACKSELECT: ::DWORD = 0x0200; +pub const TVS_SINGLEEXPAND: ::DWORD = 0x0400; +pub const TVS_INFOTIP: ::DWORD = 0x0800; +pub const TVS_FULLROWSELECT: ::DWORD = 0x1000; +pub const TVS_NOSCROLL: ::DWORD = 0x2000; +pub const TVS_NONEVENHEIGHT: ::DWORD = 0x4000; +pub const TVS_NOHSCROLL: ::DWORD = 0x8000; +pub const TVS_EX_NOSINGLECOLLAPSE: ::DWORD = 0x0001; +pub const TVS_EX_MULTISELECT: ::DWORD = 0x0002; +pub const TVS_EX_DOUBLEBUFFER: ::DWORD = 0x0004; +pub const TVS_EX_NOINDENTSTATE: ::DWORD = 0x0008; +pub const TVS_EX_RICHTOOLTIP: ::DWORD = 0x0010; +pub const TVS_EX_AUTOHSCROLL: ::DWORD = 0x0020; +pub const TVS_EX_FADEINOUTEXPANDOS: ::DWORD = 0x0040; +pub const TVS_EX_PARTIALCHECKBOXES: ::DWORD = 0x0080; +pub const TVS_EX_EXCLUSIONCHECKBOXES: ::DWORD = 0x0100; +pub const TVS_EX_DIMMEDCHECKBOXES: ::DWORD = 0x0200; +pub const TVS_EX_DRAWIMAGEASYNC: ::DWORD = 0x0400; +pub enum TREEITEM {} +pub type HTREEITEM = *mut TREEITEM; +pub const TVIF_TEXT: ::UINT = 0x0001; +pub const TVIF_IMAGE: ::UINT = 0x0002; +pub const TVIF_PARAM: ::UINT = 0x0004; +pub const TVIF_STATE: ::UINT = 0x0008; +pub const TVIF_HANDLE: ::UINT = 0x0010; +pub const TVIF_SELECTEDIMAGE: ::UINT = 0x0020; +pub const TVIF_CHILDREN: ::UINT = 0x0040; +pub const TVIF_INTEGRAL: ::UINT = 0x0080; +pub const TVIF_STATEEX: ::UINT = 0x0100; +pub const TVIF_EXPANDEDIMAGE: ::UINT = 0x0200; +pub const TVIS_SELECTED: ::UINT = 0x0002; +pub const TVIS_CUT: ::UINT = 0x0004; +pub const TVIS_DROPHILITED: ::UINT = 0x0008; +pub const TVIS_BOLD: ::UINT = 0x0010; +pub const TVIS_EXPANDED: ::UINT = 0x0020; +pub const TVIS_EXPANDEDONCE: ::UINT = 0x0040; +pub const TVIS_EXPANDPARTIAL: ::UINT = 0x0080; +pub const TVIS_OVERLAYMASK: ::UINT = 0x0F00; +pub const TVIS_STATEIMAGEMASK: ::UINT = 0xF000; +pub const TVIS_USERMASK: ::UINT = 0xF000; +pub const TVIS_EX_FLAT: ::UINT = 0x0001; +pub const TVIS_EX_DISABLED: ::UINT = 0x0002; +pub const TVIS_EX_ALL: ::UINT = 0x0002; +STRUCT!{struct NMTVSTATEIMAGECHANGING { + hdr: ::NMHDR, + hti: HTREEITEM, + iOldStateImageIndex: ::c_int, + iNewStateImageIndex: ::c_int, +}} +pub type LPNMTVSTATEIMAGECHANGING = *mut NMTVSTATEIMAGECHANGING; +pub const I_CHILDRENCALLBACK: ::c_int = -1; +pub const I_CHILDRENAUTO: ::c_int = -2; +pub type LPTV_ITEMW = LPTVITEMW; +pub type LPTV_ITEMA = LPTVITEMA; +pub type TV_ITEMW = TVITEMW; +pub type TV_ITEMA = TVITEMA; +STRUCT!{struct TVITEMA { + mask: ::UINT, + hItem: HTREEITEM, + state: ::UINT, + stateMask: ::UINT, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + iSelectedImage: ::c_int, + cChildren: ::c_int, + lParam: ::LPARAM, +}} +pub type LPTVITEMA = *mut TVITEMA; +STRUCT!{struct TVITEMW { + mask: ::UINT, + hItem: HTREEITEM, + state: ::UINT, + stateMask: ::UINT, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + iSelectedImage: ::c_int, + cChildren: ::c_int, + lParam: ::LPARAM, +}} +pub type LPTVITEMW = *mut TVITEMW; +STRUCT!{struct TVITEMEXA { + mask: ::UINT, + hItem: HTREEITEM, + state: ::UINT, + stateMask: ::UINT, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + iSelectedImage: ::c_int, + cChildren: ::c_int, + lParam: ::LPARAM, + iIntegral: ::c_int, + uStateEx: ::UINT, + hwnd: ::HWND, + iExpandedImage: ::c_int, + iReserved: ::c_int, +}} +pub type LPTVITEMEXA = *mut TVITEMEXA; +STRUCT!{struct TVITEMEXW { + mask: ::UINT, + hItem: HTREEITEM, + state: ::UINT, + stateMask: ::UINT, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + iSelectedImage: ::c_int, + cChildren: ::c_int, + lParam: ::LPARAM, + iIntegral: ::c_int, + uStateEx: ::UINT, + hwnd: ::HWND, + iExpandedImage: ::c_int, + iReserved: ::c_int, +}} +pub type LPTVITEMEXW = *mut TVITEMEXW; +pub const TVI_ROOT: HTREEITEM = (0 - 0x10000) as HTREEITEM; +pub const TVI_FIRST: HTREEITEM = (0 - 0x0FFFF) as HTREEITEM; +pub const TVI_LAST: HTREEITEM = (0 - 0x0FFFE) as HTREEITEM; +pub const TVI_SORT: HTREEITEM = (0 - 0x0FFFD) as HTREEITEM; +pub type LPTV_INSERTSTRUCTA = LPTVINSERTSTRUCTA; +pub type LPTV_INSERTSTRUCTW = LPTVINSERTSTRUCTW; +pub type TV_INSERTSTRUCTA = TVINSERTSTRUCTA; +pub type TV_INSERTSTRUCTW = TVINSERTSTRUCTW; +STRUCT!{struct TVINSERTSTRUCTA { + hParent: HTREEITEM, + hInsertAfter: HTREEITEM, + itemex: TVITEMEXA, +}} +UNION!(TVINSERTSTRUCTA, itemex, item, item_mut, TV_ITEMA); +pub type LPTVINSERTSTRUCTA = *mut TVINSERTSTRUCTA; +STRUCT!{struct TVINSERTSTRUCTW { + hParent: HTREEITEM, + hInsertAfter: HTREEITEM, + itemex: TVITEMEXW, +}} +UNION!(TVINSERTSTRUCTW, itemex, item, item_mut, TV_ITEMW); +pub type LPTVINSERTSTRUCTW = *mut TVINSERTSTRUCTW; +pub const TVM_INSERTITEMA: ::UINT = TV_FIRST + 0; +pub const TVM_INSERTITEMW: ::UINT = TV_FIRST + 50; +pub const TVM_DELETEITEM: ::UINT = TV_FIRST + 1; +pub const TVM_EXPAND: ::UINT = TV_FIRST + 2; +pub const TVM_GETITEMRECT: ::UINT = TV_FIRST + 4; +pub const TVE_COLLAPSE: ::WPARAM = 0x0001; +pub const TVE_EXPAND: ::WPARAM = 0x0002; +pub const TVE_TOGGLE: ::WPARAM = 0x0003; +pub const TVE_EXPANDPARTIAL: ::WPARAM = 0x4000; +pub const TVE_COLLAPSERESET: ::WPARAM = 0x8000; +pub const TVM_GETCOUNT: ::UINT = TV_FIRST + 5; +pub const TVM_GETINDENT: ::UINT = TV_FIRST + 6; +pub const TVM_SETINDENT: ::UINT = TV_FIRST + 7; +pub const TVM_GETIMAGELIST: ::UINT = TV_FIRST + 8; +pub const TVM_SETIMAGELIST: ::UINT = TV_FIRST + 9; +pub const TVM_GETNEXTITEM: ::UINT = TV_FIRST + 10; +pub const TVSIL_NORMAL: ::WPARAM = 0; +pub const TVSIL_STATE: ::WPARAM = 2; +pub const TVGN_ROOT: ::WPARAM = 0x0000; +pub const TVGN_NEXT: ::WPARAM = 0x0001; +pub const TVGN_PREVIOUS: ::WPARAM = 0x0002; +pub const TVGN_PARENT: ::WPARAM = 0x0003; +pub const TVGN_CHILD: ::WPARAM = 0x0004; +pub const TVGN_FIRSTVISIBLE: ::WPARAM = 0x0005; +pub const TVGN_NEXTVISIBLE: ::WPARAM = 0x0006; +pub const TVGN_PREVIOUSVISIBLE: ::WPARAM = 0x0007; +pub const TVGN_DROPHILITE: ::WPARAM = 0x0008; +pub const TVGN_CARET: ::WPARAM = 0x0009; +pub const TVGN_LASTVISIBLE: ::WPARAM = 0x000A; +pub const TVGN_NEXTSELECTED: ::WPARAM = 0x000B; +pub const TVSI_NOSINGLEEXPAND: ::WPARAM = 0x8000; +pub const TVM_SELECTITEM: ::UINT = TV_FIRST + 11; +pub const TVM_GETITEMA: ::UINT = TV_FIRST + 12; +pub const TVM_GETITEMW: ::UINT = TV_FIRST + 62; +pub const TVM_SETITEMA: ::UINT = TV_FIRST + 13; +pub const TVM_SETITEMW: ::UINT = TV_FIRST + 63; +pub const TVM_EDITLABELA: ::UINT = TV_FIRST + 14; +pub const TVM_EDITLABELW: ::UINT = TV_FIRST + 65; +pub const TVM_GETEDITCONTROL: ::UINT = TV_FIRST + 15; +pub const TVM_GETVISIBLECOUNT: ::UINT = TV_FIRST + 16; +pub const TVM_HITTEST: ::UINT = TV_FIRST + 17; +pub type LPTV_HITTESTINFO = LPTVHITTESTINFO; +pub type TV_HITTESTINFO = TVHITTESTINFO; +STRUCT!{struct TVHITTESTINFO { + pt: ::POINT, + flags: ::UINT, + hItem: HTREEITEM, +}} +pub type LPTVHITTESTINFO = *mut TVHITTESTINFO; +pub const TVHT_NOWHERE: ::UINT = 0x0001; +pub const TVHT_ONITEMICON: ::UINT = 0x0002; +pub const TVHT_ONITEMLABEL: ::UINT = 0x0004; +pub const TVHT_ONITEM: ::UINT = TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON; +pub const TVHT_ONITEMINDENT: ::UINT = 0x0008; +pub const TVHT_ONITEMBUTTON: ::UINT = 0x0010; +pub const TVHT_ONITEMRIGHT: ::UINT = 0x0020; +pub const TVHT_ONITEMSTATEICON: ::UINT = 0x0040; +pub const TVHT_ABOVE: ::UINT = 0x0100; +pub const TVHT_BELOW: ::UINT = 0x0200; +pub const TVHT_TORIGHT: ::UINT = 0x0400; +pub const TVHT_TOLEFT: ::UINT = 0x0800; +pub const TVM_CREATEDRAGIMAGE: ::UINT = TV_FIRST + 18; +pub const TVM_SORTCHILDREN: ::UINT = TV_FIRST + 19; +pub const TVM_ENSUREVISIBLE: ::UINT = TV_FIRST + 20; +pub const TVM_SORTCHILDRENCB: ::UINT = TV_FIRST + 21; +pub const TVM_ENDEDITLABELNOW: ::UINT = TV_FIRST + 22; +pub const TVM_GETISEARCHSTRINGA: ::UINT = TV_FIRST + 23; +pub const TVM_GETISEARCHSTRINGW: ::UINT = TV_FIRST + 64; +pub const TVM_SETTOOLTIPS: ::UINT = TV_FIRST + 24; +pub const TVM_GETTOOLTIPS: ::UINT = TV_FIRST + 25; +pub const TVM_SETINSERTMARK: ::UINT = TV_FIRST + 26; +pub const TVM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const TVM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const TVM_SETITEMHEIGHT: ::UINT = TV_FIRST + 27; +pub const TVM_GETITEMHEIGHT: ::UINT = TV_FIRST + 28; +pub const TVM_SETBKCOLOR: ::UINT = TV_FIRST + 29; +pub const TVM_SETTEXTCOLOR: ::UINT = TV_FIRST + 30; +pub const TVM_GETBKCOLOR: ::UINT = TV_FIRST + 31; +pub const TVM_GETTEXTCOLOR: ::UINT = TV_FIRST + 32; +pub const TVM_SETSCROLLTIME: ::UINT = TV_FIRST + 33; +pub const TVM_GETSCROLLTIME: ::UINT = TV_FIRST + 34; +pub const TVM_SETINSERTMARKCOLOR: ::UINT = TV_FIRST + 37; +pub const TVM_GETINSERTMARKCOLOR: ::UINT = TV_FIRST + 38; +pub const TVM_SETBORDER: ::UINT = TV_FIRST + 35; +pub const TVSBF_XBORDER: ::WPARAM = 0x00000001; +pub const TVSBF_YBORDER: ::WPARAM = 0x00000002; +pub const TVM_GETITEMSTATE: ::UINT = TV_FIRST + 39; +pub const TVM_SETLINECOLOR: ::UINT = TV_FIRST + 40; +pub const TVM_GETLINECOLOR: ::UINT = TV_FIRST + 41; +pub const TVM_MAPACCIDTOHTREEITEM: ::UINT = TV_FIRST + 42; +pub const TVM_MAPHTREEITEMTOACCID: ::UINT = TV_FIRST + 43; +pub const TVM_SETEXTENDEDSTYLE: ::UINT = TV_FIRST + 44; +pub const TVM_GETEXTENDEDSTYLE: ::UINT = TV_FIRST + 45; +pub const TVM_SETAUTOSCROLLINFO: ::UINT = TV_FIRST + 59; +pub const TVM_SETHOT: ::UINT = TV_FIRST + 58; +pub const TVM_GETSELECTEDCOUNT: ::UINT = TV_FIRST + 70; +pub const TVM_SHOWINFOTIP: ::UINT = TV_FIRST + 71; +ENUM!{enum TVITEMPART { + TVGIPR_BUTTON = 0x0001, +}} +STRUCT!{struct TVGETITEMPARTRECTINFO { + hti: HTREEITEM, + prc: *mut ::RECT, + partID: TVITEMPART, +}} +pub const TVM_GETITEMPARTRECT: ::UINT = TV_FIRST + 72; +pub type PFNTVCOMPARE = Option ::c_int>; +pub type LPTV_SORTCB = LPTVSORTCB; +pub type TV_SORTCB = TVSORTCB; +STRUCT!{nodebug struct TVSORTCB { + hParent: HTREEITEM, + lpfnCompare: PFNTVCOMPARE, + lParam: ::LPARAM, +}} +pub type LPTVSORTCB = *mut TVSORTCB; +pub type LPNM_TREEVIEWA = LPNMTREEVIEWA; +pub type LPNM_TREEVIEWW = LPNMTREEVIEWW; +pub type NM_TREEVIEWA = NMTREEVIEWA; +pub type NM_TREEVIEWW = NMTREEVIEWW; +STRUCT!{struct NMTREEVIEWA { + hdr: ::NMHDR, + action: ::UINT, + itemOld: TVITEMA, + itemNew: TVITEMA, + ptDrag: ::POINT, +}} +pub type LPNMTREEVIEWA = *mut NMTREEVIEWA; +STRUCT!{struct NMTREEVIEWW { + hdr: ::NMHDR, + action: ::UINT, + itemOld: TVITEMW, + itemNew: TVITEMW, + ptDrag: ::POINT, +}} +pub type LPNMTREEVIEWW = *mut NMTREEVIEWW; +pub const TVN_SELCHANGINGA: ::UINT = TVN_FIRST - 1; +pub const TVN_SELCHANGINGW: ::UINT = TVN_FIRST - 50; +pub const TVN_SELCHANGEDA: ::UINT = TVN_FIRST - 2; +pub const TVN_SELCHANGEDW: ::UINT = TVN_FIRST - 51; +pub const TVN_GETDISPINFOA: ::UINT = TVN_FIRST - 3; +pub const TVN_GETDISPINFOW: ::UINT = TVN_FIRST - 52; +pub const TVN_SETDISPINFOA: ::UINT = TVN_FIRST - 4; +pub const TVN_SETDISPINFOW: ::UINT = TVN_FIRST - 53; +pub const TVC_UNKNOWN: ::LPARAM = 0x0000; +pub const TVC_BYMOUSE: ::LPARAM = 0x0001; +pub const TVC_BYKEYBOARD: ::LPARAM = 0x0002; +pub const TVIF_DI_SETITEM: ::UINT = 0x1000; +pub type TV_DISPINFOA = NMTVDISPINFOA; +pub type TV_DISPINFOW = NMTVDISPINFOW; +STRUCT!{struct NMTVDISPINFOA { + hdr: ::NMHDR, + item: TVITEMA, +}} +pub type LPNMTVDISPINFOA = *mut NMTVDISPINFOA; +STRUCT!{struct NMTVDISPINFOW { + hdr: ::NMHDR, + item: TVITEMW, +}} +pub type LPNMTVDISPINFOW = *mut NMTVDISPINFOW; +STRUCT!{struct NMTVDISPINFOEXA { + hdr: ::NMHDR, + item: TVITEMEXA, +}} +pub type LPNMTVDISPINFOEXA = *mut NMTVDISPINFOEXA; +STRUCT!{struct NMTVDISPINFOEXW { + hdr: ::NMHDR, + item: TVITEMEXW, +}} +pub type LPNMTVDISPINFOEXW = *mut NMTVDISPINFOEXW; +pub type TV_DISPINFOEXA = NMTVDISPINFOEXA; +pub type TV_DISPINFOEXW = NMTVDISPINFOEXW; +pub const TVN_ITEMEXPANDINGA: ::UINT = TVN_FIRST - 5; +pub const TVN_ITEMEXPANDINGW: ::UINT = TVN_FIRST - 54; +pub const TVN_ITEMEXPANDEDA: ::UINT = TVN_FIRST - 6; +pub const TVN_ITEMEXPANDEDW: ::UINT = TVN_FIRST - 55; +pub const TVN_BEGINDRAGA: ::UINT = TVN_FIRST - 7; +pub const TVN_BEGINDRAGW: ::UINT = TVN_FIRST - 56; +pub const TVN_BEGINRDRAGA: ::UINT = TVN_FIRST - 8; +pub const TVN_BEGINRDRAGW: ::UINT = TVN_FIRST - 57; +pub const TVN_DELETEITEMA: ::UINT = TVN_FIRST - 9; +pub const TVN_DELETEITEMW: ::UINT = TVN_FIRST - 58; +pub const TVN_BEGINLABELEDITA: ::UINT = TVN_FIRST - 10; +pub const TVN_BEGINLABELEDITW: ::UINT = TVN_FIRST - 59; +pub const TVN_ENDLABELEDITA: ::UINT = TVN_FIRST - 11; +pub const TVN_ENDLABELEDITW: ::UINT = TVN_FIRST - 60; +pub const TVN_KEYDOWN: ::UINT = TVN_FIRST - 12; +pub const TVN_GETINFOTIPA: ::UINT = TVN_FIRST - 13; +pub const TVN_GETINFOTIPW: ::UINT = TVN_FIRST - 14; +pub const TVN_SINGLEEXPAND: ::UINT = TVN_FIRST - 15; +pub const TVN_ITEMCHANGINGA: ::UINT = TVN_FIRST - 16; +pub const TVN_ITEMCHANGINGW: ::UINT = TVN_FIRST - 17; +pub const TVN_ITEMCHANGEDA: ::UINT = TVN_FIRST - 18; +pub const TVN_ITEMCHANGEDW: ::UINT = TVN_FIRST - 19; +pub const TVN_ASYNCDRAW: ::UINT = TVN_FIRST - 20; +pub const TVNRET_DEFAULT: ::LRESULT = 0; +pub const TVNRET_SKIPOLD: ::LRESULT = 1; +pub const TVNRET_SKIPNEW: ::LRESULT = 2; +pub type TV_KEYDOWN = NMTVKEYDOWN; +STRUCT!{struct NMTVKEYDOWN { + hdr: ::NMHDR, + wVKey: ::WORD, + flags: ::UINT, +}} +pub type LPNMTVKEYDOWN = *mut NMTVKEYDOWN; +STRUCT!{struct NMTVCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + clrText: ::COLORREF, + clrTextBk: ::COLORREF, + iLevel: ::c_int, +}} +pub type LPNMTVCUSTOMDRAW = *mut NMTVCUSTOMDRAW; +STRUCT!{struct NMTVGETINFOTIPA { + hdr: ::NMHDR, + pszText: ::LPSTR, + cchTextMax: ::c_int, + hItem: HTREEITEM, + lParam: ::LPARAM, +}} +pub type LPNMTVGETINFOTIPA = *mut NMTVGETINFOTIPA; +STRUCT!{struct NMTVGETINFOTIPW { + hdr: ::NMHDR, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + hItem: HTREEITEM, + lParam: ::LPARAM, +}} +pub type LPNMTVGETINFOTIPW = *mut NMTVGETINFOTIPW; +pub const TVCDRF_NOIMAGES: ::LRESULT = 0x00010000; +STRUCT!{struct NMTVITEMCHANGE { + hdr: ::NMHDR, + uChanged: ::UINT, + hItem: HTREEITEM, + uStateNew: ::UINT, + uStateOld: ::UINT, + lParam: ::LPARAM, +}} +STRUCT!{struct NMTVASYNCDRAW { + hdr: ::NMHDR, + pimldp: *mut IMAGELISTDRAWPARAMS, + hr: ::HRESULT, + hItem: HTREEITEM, + lParam: ::LPARAM, + dwRetFlags: ::DWORD, + iRetImageIndex: ::c_int, +}} +pub const CBEIF_TEXT: ::UINT = 0x00000001; +pub const CBEIF_IMAGE: ::UINT = 0x00000002; +pub const CBEIF_SELECTEDIMAGE: ::UINT = 0x00000004; +pub const CBEIF_OVERLAY: ::UINT = 0x00000008; +pub const CBEIF_INDENT: ::UINT = 0x00000010; +pub const CBEIF_LPARAM: ::UINT = 0x00000020; +pub const CBEIF_DI_SETITEM: ::UINT = 0x10000000; +STRUCT!{struct COMBOBOXEXITEMA { + mask: ::UINT, + iItem: ::INT_PTR, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + iSelectedImage: ::c_int, + iOverlay: ::c_int, + iIndent: ::c_int, + lParam: ::LPARAM, +}} +pub type PCOMBOBOXEXITEMA = *mut COMBOBOXEXITEMA; +pub type PCCOMBOBOXEXITEMA = *const COMBOBOXEXITEMA; +STRUCT!{struct COMBOBOXEXITEMW { + mask: ::UINT, + iItem: ::INT_PTR, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + iSelectedImage: ::c_int, + iOverlay: ::c_int, + iIndent: ::c_int, + lParam: ::LPARAM, +}} +pub type PCOMBOBOXEXITEMW = *mut COMBOBOXEXITEMW; +pub type PCCOMBOBOXEXITEMW = *const COMBOBOXEXITEMW; +pub const CBEM_INSERTITEMA: ::UINT = ::WM_USER + 1; +pub const CBEM_SETIMAGELIST: ::UINT = ::WM_USER + 2; +pub const CBEM_GETIMAGELIST: ::UINT = ::WM_USER + 3; +pub const CBEM_GETITEMA: ::UINT = ::WM_USER + 4; +pub const CBEM_SETITEMA: ::UINT = ::WM_USER + 5; +pub const CBEM_DELETEITEM: ::UINT = ::CB_DELETESTRING; +pub const CBEM_GETCOMBOCONTROL: ::UINT = ::WM_USER + 6; +pub const CBEM_GETEDITCONTROL: ::UINT = ::WM_USER + 7; +pub const CBEM_SETEXSTYLE: ::UINT = ::WM_USER + 8; +pub const CBEM_SETEXTENDEDSTYLE: ::UINT = ::WM_USER + 14; +pub const CBEM_GETEXSTYLE: ::UINT = ::WM_USER + 9; +pub const CBEM_GETEXTENDEDSTYLE: ::UINT = ::WM_USER + 9; +pub const CBEM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const CBEM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const CBEM_HASEDITCHANGED: ::UINT = ::WM_USER + 10; +pub const CBEM_INSERTITEMW: ::UINT = ::WM_USER + 11; +pub const CBEM_SETITEMW: ::UINT = ::WM_USER + 12; +pub const CBEM_GETITEMW: ::UINT = ::WM_USER + 13; +pub const CBEM_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; +pub const CBES_EX_NOEDITIMAGE: ::DWORD = 0x00000001; +pub const CBES_EX_NOEDITIMAGEINDENT: ::DWORD = 0x00000002; +pub const CBES_EX_PATHWORDBREAKPROC: ::DWORD = 0x00000004; +pub const CBES_EX_NOSIZELIMIT: ::DWORD = 0x00000008; +pub const CBES_EX_CASESENSITIVE: ::DWORD = 0x00000010; +pub const CBES_EX_TEXTENDELLIPSIS: ::DWORD = 0x00000020; +STRUCT!{struct NMCOMBOBOXEXA { + hdr: ::NMHDR, + ceItem: COMBOBOXEXITEMA, +}} +pub type PNMCOMBOBOXEXA = *mut NMCOMBOBOXEXA; +STRUCT!{struct NMCOMBOBOXEXW { + hdr: ::NMHDR, + ceItem: COMBOBOXEXITEMW, +}} +pub type PNMCOMBOBOXEXW = *mut NMCOMBOBOXEXW; +pub const CBEN_GETDISPINFOA: ::UINT = CBEN_FIRST - 0; +pub const CBEN_INSERTITEM: ::UINT = CBEN_FIRST - 1; +pub const CBEN_DELETEITEM: ::UINT = CBEN_FIRST - 2; +pub const CBEN_BEGINEDIT: ::UINT = CBEN_FIRST - 4; +pub const CBEN_ENDEDITA: ::UINT = CBEN_FIRST - 5; +pub const CBEN_ENDEDITW: ::UINT = CBEN_FIRST - 6; +pub const CBEN_GETDISPINFOW: ::UINT = CBEN_FIRST - 7; +pub const CBEN_DRAGBEGINA: ::UINT = CBEN_FIRST - 8; +pub const CBEN_DRAGBEGINW: ::UINT = CBEN_FIRST - 9; +pub const CBENF_KILLFOCUS: ::c_int = 1; +pub const CBENF_RETURN: ::c_int = 2; +pub const CBENF_ESCAPE: ::c_int = 3; +pub const CBENF_DROPDOWN: ::c_int = 4; +pub const CBEMAXSTRLEN: usize = 260; +STRUCT!{nodebug struct NMCBEDRAGBEGINW { + hdr: ::NMHDR, + iItemid: ::c_int, + szText: [::WCHAR; CBEMAXSTRLEN], +}} +pub type PNMCBEDRAGBEGINW = *mut NMCBEDRAGBEGINW; +pub type LPNMCBEDRAGBEGINW = *mut NMCBEDRAGBEGINW; +STRUCT!{nodebug struct NMCBEDRAGBEGINA { + hdr: ::NMHDR, + iItemid: ::c_int, + szText: [::c_char; CBEMAXSTRLEN], +}} +pub type PNMCBEDRAGBEGINA = *mut NMCBEDRAGBEGINA; +pub type LPNMCBEDRAGBEGINA = *mut NMCBEDRAGBEGINA; +STRUCT!{nodebug struct NMCBEENDEDITW { + hdr: ::NMHDR, + fChanged: ::BOOL, + iNewSelection: ::c_int, + szText: [::WCHAR; CBEMAXSTRLEN], + iWhy: ::c_int, +}} +pub type PNMCBEENDEDITW = *mut NMCBEENDEDITW; +pub type LPNMCBEENDEDITW = *mut NMCBEENDEDITW; +STRUCT!{nodebug struct NMCBEENDEDITA { + hdr: ::NMHDR, + fChanged: ::BOOL, + iNewSelection: ::c_int, + szText: [::c_char; CBEMAXSTRLEN], + iWhy: ::c_int, +}} +pub type PNMCBEENDEDITA = *mut NMCBEENDEDITA; +pub type LPNMCBEENDEDITA = *mut NMCBEENDEDITA; +pub const TCS_SCROLLOPPOSITE: ::DWORD = 0x0001; +pub const TCS_BOTTOM: ::DWORD = 0x0002; +pub const TCS_RIGHT: ::DWORD = 0x0002; +pub const TCS_MULTISELECT: ::DWORD = 0x0004; +pub const TCS_FLATBUTTONS: ::DWORD = 0x0008; +pub const TCS_FORCEICONLEFT: ::DWORD = 0x0010; +pub const TCS_FORCELABELLEFT: ::DWORD = 0x0020; +pub const TCS_HOTTRACK: ::DWORD = 0x0040; +pub const TCS_VERTICAL: ::DWORD = 0x0080; +pub const TCS_TABS: ::DWORD = 0x0000; +pub const TCS_BUTTONS: ::DWORD = 0x0100; +pub const TCS_SINGLELINE: ::DWORD = 0x0000; +pub const TCS_MULTILINE: ::DWORD = 0x0200; +pub const TCS_RIGHTJUSTIFY: ::DWORD = 0x0000; +pub const TCS_FIXEDWIDTH: ::DWORD = 0x0400; +pub const TCS_RAGGEDRIGHT: ::DWORD = 0x0800; +pub const TCS_FOCUSONBUTTONDOWN: ::DWORD = 0x1000; +pub const TCS_OWNERDRAWFIXED: ::DWORD = 0x2000; +pub const TCS_TOOLTIPS: ::DWORD = 0x4000; +pub const TCS_FOCUSNEVER: ::DWORD = 0x8000; +pub const TCS_EX_FLATSEPARATORS: ::DWORD = 0x00000001; +pub const TCS_EX_REGISTERDROP: ::DWORD = 0x00000002; +pub const TCM_GETIMAGELIST: ::UINT = TCM_FIRST + 2; +pub const TCM_SETIMAGELIST: ::UINT = TCM_FIRST + 3; +pub const TCM_GETITEMCOUNT: ::UINT = TCM_FIRST + 4; +pub const TCIF_TEXT: ::UINT = 0x0001; +pub const TCIF_IMAGE: ::UINT = 0x0002; +pub const TCIF_RTLREADING: ::UINT = 0x0004; +pub const TCIF_PARAM: ::UINT = 0x0008; +pub const TCIF_STATE: ::UINT = 0x0010; +pub const TCIS_BUTTONPRESSED: ::DWORD = 0x0001; +pub const TCIS_HIGHLIGHTED: ::DWORD = 0x0002; +pub type TC_ITEMHEADERA = TCITEMHEADERA; +pub type TC_ITEMHEADERW = TCITEMHEADERW; +STRUCT!{struct TCITEMHEADERA { + mask: ::UINT, + lpReserved1: ::UINT, + lpReserved2: ::UINT, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iImage: ::c_int, +}} +pub type LPTCITEMHEADERA = *mut TCITEMHEADERA; +STRUCT!{struct TCITEMHEADERW { + mask: ::UINT, + lpReserved1: ::UINT, + lpReserved2: ::UINT, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iImage: ::c_int, +}} +pub type LPTCITEMHEADERW = *mut TCITEMHEADERW; +pub type TC_ITEMA = TCITEMA; +pub type TC_ITEMW = TCITEMW; +STRUCT!{struct TCITEMA { + mask: ::UINT, + dwState: ::DWORD, + dwStateMask: ::DWORD, + pszText: ::LPSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + lParam: ::LPARAM, +}} +pub type LPTCITEMA = *mut TCITEMA; +STRUCT!{struct TCITEMW { + mask: ::UINT, + dwState: ::DWORD, + dwStateMask: ::DWORD, + pszText: ::LPWSTR, + cchTextMax: ::c_int, + iImage: ::c_int, + lParam: ::LPARAM, +}} +pub type LPTCITEMW = *mut TCITEMW; +pub const TCM_GETITEMA: ::UINT = TCM_FIRST + 5; +pub const TCM_GETITEMW: ::UINT = TCM_FIRST + 60; +pub const TCM_SETITEMA: ::UINT = TCM_FIRST + 6; +pub const TCM_SETITEMW: ::UINT = TCM_FIRST + 61; +pub const TCM_INSERTITEMA: ::UINT = TCM_FIRST + 7; +pub const TCM_INSERTITEMW: ::UINT = TCM_FIRST + 62; +pub const TCM_DELETEITEM: ::UINT = TCM_FIRST + 8; +pub const TCM_DELETEALLITEMS: ::UINT = TCM_FIRST + 9; +pub const TCM_GETITEMRECT: ::UINT = TCM_FIRST + 10; +pub const TCM_GETCURSEL: ::UINT = TCM_FIRST + 11; +pub const TCM_SETCURSEL: ::UINT = TCM_FIRST + 12; +pub const TCHT_NOWHERE: ::UINT = 0x0001; +pub const TCHT_ONITEMICON: ::UINT = 0x0002; +pub const TCHT_ONITEMLABEL: ::UINT = 0x0004; +pub const TCHT_ONITEM: ::UINT = TCHT_ONITEMICON | TCHT_ONITEMLABEL; +pub type LPTC_HITTESTINFO = LPTCHITTESTINFO; +pub type TC_HITTESTINFO = TCHITTESTINFO; +STRUCT!{struct TCHITTESTINFO { + pt: ::POINT, + flags: ::UINT, +}} +pub type LPTCHITTESTINFO = *mut TCHITTESTINFO; +pub const TCM_HITTEST: ::UINT = TCM_FIRST + 13; +pub const TCM_SETITEMEXTRA: ::UINT = TCM_FIRST + 14; +pub const TCM_ADJUSTRECT: ::UINT = TCM_FIRST + 40; +pub const TCM_SETITEMSIZE: ::UINT = TCM_FIRST + 41; +pub const TCM_REMOVEIMAGE: ::UINT = TCM_FIRST + 42; +pub const TCM_SETPADDING: ::UINT = TCM_FIRST + 43; +pub const TCM_GETROWCOUNT: ::UINT = TCM_FIRST + 44; +pub const TCM_GETTOOLTIPS: ::UINT = TCM_FIRST + 45; +pub const TCM_SETTOOLTIPS: ::UINT = TCM_FIRST + 46; +pub const TCM_GETCURFOCUS: ::UINT = TCM_FIRST + 47; +pub const TCM_SETCURFOCUS: ::UINT = TCM_FIRST + 48; +pub const TCM_SETMINTABWIDTH: ::UINT = TCM_FIRST + 49; +pub const TCM_DESELECTALL: ::UINT = TCM_FIRST + 50; +pub const TCM_HIGHLIGHTITEM: ::UINT = TCM_FIRST + 51; +pub const TCM_SETEXTENDEDSTYLE: ::UINT = TCM_FIRST + 52; +pub const TCM_GETEXTENDEDSTYLE: ::UINT = TCM_FIRST + 53; +pub const TCM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const TCM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const TCN_KEYDOWN: ::UINT = TCN_FIRST - 0; +pub type TC_KEYDOWN = NMTCKEYDOWN; +STRUCT!{struct NMTCKEYDOWN { + hdr: ::NMHDR, + wVKey: ::WORD, + flags: ::UINT, +}} +pub const TCN_SELCHANGE: ::UINT = TCN_FIRST - 1; +pub const TCN_SELCHANGING: ::UINT = TCN_FIRST - 2; +pub const TCN_GETOBJECT: ::UINT = TCN_FIRST - 3; +pub const TCN_FOCUSCHANGE: ::UINT = TCN_FIRST - 4; +pub const ACS_CENTER: ::DWORD = 0x0001; +pub const ACS_TRANSPARENT: ::DWORD = 0x0002; +pub const ACS_AUTOPLAY: ::DWORD = 0x0004; +pub const ACS_TIMER: ::DWORD = 0x0008; +pub const ACM_OPENA: ::UINT = ::WM_USER + 100; +pub const ACM_OPENW: ::UINT = ::WM_USER + 103; +pub const ACM_PLAY: ::UINT = ::WM_USER + 101; +pub const ACM_STOP: ::UINT = ::WM_USER + 102; +pub const ACM_ISPLAYING: ::UINT = ::WM_USER + 104; +pub const ACN_START: ::WPARAM = 1; +pub const ACN_STOP: ::WPARAM = 2; +pub type MONTHDAYSTATE = ::DWORD; +pub type LPMONTHDAYSTATE = *mut ::DWORD; +pub const MCM_FIRST: ::UINT = 0x1000; +pub const MCM_GETCURSEL: ::UINT = MCM_FIRST + 1; +pub const MCM_SETCURSEL: ::UINT = MCM_FIRST + 2; +pub const MCM_GETMAXSELCOUNT: ::UINT = MCM_FIRST + 3; +pub const MCM_SETMAXSELCOUNT: ::UINT = MCM_FIRST + 4; +pub const MCM_GETSELRANGE: ::UINT = MCM_FIRST + 5; +pub const MCM_SETSELRANGE: ::UINT = MCM_FIRST + 6; +pub const MCM_GETMONTHRANGE: ::UINT = MCM_FIRST + 7; +pub const MCM_SETDAYSTATE: ::UINT = MCM_FIRST + 8; +pub const MCM_GETMINREQRECT: ::UINT = MCM_FIRST + 9; +pub const MCM_SETCOLOR: ::UINT = MCM_FIRST + 10; +pub const MCM_GETCOLOR: ::UINT = MCM_FIRST + 11; +pub const MCM_SETTODAY: ::UINT = MCM_FIRST + 12; +pub const MCM_GETTODAY: ::UINT = MCM_FIRST + 13; +pub const MCM_HITTEST: ::UINT = MCM_FIRST + 14; +pub const MCSC_BACKGROUND: ::WPARAM = 0; +pub const MCSC_TEXT: ::WPARAM = 1; +pub const MCSC_TITLEBK: ::WPARAM = 2; +pub const MCSC_TITLETEXT: ::WPARAM = 3; +pub const MCSC_MONTHBK: ::WPARAM = 4; +pub const MCSC_TRAILINGTEXT: ::WPARAM = 5; +STRUCT!{struct MCHITTESTINFO { + cbSize: ::UINT, + pt: ::POINT, + uHit: ::UINT, + st: ::SYSTEMTIME, + rc: ::RECT, + iOffset: ::c_int, + iRow: ::c_int, + iCol: ::c_int, +}} +pub type PMCHITTESTINFO = *mut MCHITTESTINFO; +pub const MCHT_TITLE: ::UINT = 0x00010000; +pub const MCHT_CALENDAR: ::UINT = 0x00020000; +pub const MCHT_TODAYLINK: ::UINT = 0x00030000; +pub const MCHT_CALENDARCONTROL: ::UINT = 0x00100000; +pub const MCHT_NEXT: ::UINT = 0x01000000; +pub const MCHT_PREV: ::UINT = 0x02000000; +pub const MCHT_NOWHERE: ::UINT = 0x00000000; +pub const MCHT_TITLEBK: ::UINT = MCHT_TITLE; +pub const MCHT_TITLEMONTH: ::UINT = MCHT_TITLE | 0x0001; +pub const MCHT_TITLEYEAR: ::UINT = MCHT_TITLE | 0x0002; +pub const MCHT_TITLEBTNNEXT: ::UINT = MCHT_TITLE | MCHT_NEXT | 0x0003; +pub const MCHT_TITLEBTNPREV: ::UINT = MCHT_TITLE | MCHT_PREV | 0x0003; +pub const MCHT_CALENDARBK: ::UINT = MCHT_CALENDAR; +pub const MCHT_CALENDARDATE: ::UINT = MCHT_CALENDAR | 0x0001; +pub const MCHT_CALENDARDATENEXT: ::UINT = MCHT_CALENDARDATE | MCHT_NEXT; +pub const MCHT_CALENDARDATEPREV: ::UINT = MCHT_CALENDARDATE | MCHT_PREV; +pub const MCHT_CALENDARDAY: ::UINT = MCHT_CALENDAR | 0x0002; +pub const MCHT_CALENDARWEEKNUM: ::UINT = MCHT_CALENDAR | 0x0003; +pub const MCHT_CALENDARDATEMIN: ::UINT = MCHT_CALENDAR | 0x0004; +pub const MCHT_CALENDARDATEMAX: ::UINT = MCHT_CALENDAR | 0x0005; +pub const MCM_SETFIRSTDAYOFWEEK: ::UINT = MCM_FIRST + 15; +pub const MCM_GETFIRSTDAYOFWEEK: ::UINT = MCM_FIRST + 16; +pub const MCM_GETRANGE: ::UINT = MCM_FIRST + 17; +pub const MCM_SETRANGE: ::UINT = MCM_FIRST + 18; +pub const MCM_GETMONTHDELTA: ::UINT = MCM_FIRST + 19; +pub const MCM_SETMONTHDELTA: ::UINT = MCM_FIRST + 20; +pub const MCM_GETMAXTODAYWIDTH: ::UINT = MCM_FIRST + 21; +pub const MCM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; +pub const MCM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; +pub const MCM_GETCURRENTVIEW: ::UINT = MCM_FIRST + 22; +pub const MCM_GETCALENDARCOUNT: ::UINT = MCM_FIRST + 23; +pub const MCMV_MONTH: ::DWORD = 0; +pub const MCMV_YEAR: ::DWORD = 1; +pub const MCMV_DECADE: ::DWORD = 2; +pub const MCMV_CENTURY: ::DWORD = 3; +pub const MCMV_MAX: ::DWORD = MCMV_CENTURY; +pub const MCGIP_CALENDARCONTROL: ::DWORD = 0; +pub const MCGIP_NEXT: ::DWORD = 1; +pub const MCGIP_PREV: ::DWORD = 2; +pub const MCGIP_FOOTER: ::DWORD = 3; +pub const MCGIP_CALENDAR: ::DWORD = 4; +pub const MCGIP_CALENDARHEADER: ::DWORD = 5; +pub const MCGIP_CALENDARBODY: ::DWORD = 6; +pub const MCGIP_CALENDARROW: ::DWORD = 7; +pub const MCGIP_CALENDARCELL: ::DWORD = 8; +pub const MCGIF_DATE: ::DWORD = 0x00000001; +pub const MCGIF_RECT: ::DWORD = 0x00000002; +pub const MCGIF_NAME: ::DWORD = 0x00000004; +STRUCT!{struct MCGRIDINFO { + cbSize: ::UINT, + dwPart: ::DWORD, + dwFlags: ::DWORD, + iCalendar: ::c_int, + iRow: ::c_int, + iCol: ::c_int, + bSelected: ::BOOL, + stStart: ::SYSTEMTIME, + stEnd: ::SYSTEMTIME, + rc: ::RECT, + pszName: ::PWSTR, + cchName: ::size_t, +}} +pub type PMCGRIDINFO = *mut MCGRIDINFO; +pub const MCM_GETCALENDARGRIDINFO: ::UINT = MCM_FIRST + 24; +pub const MCM_GETCALID: ::UINT = MCM_FIRST + 27; +pub const MCM_SETCALID: ::UINT = MCM_FIRST + 28; +pub const MCM_SIZERECTTOMIN: ::UINT = MCM_FIRST + 29; +pub const MCM_SETCALENDARBORDER: ::UINT = MCM_FIRST + 30; +pub const MCM_GETCALENDARBORDER: ::UINT = MCM_FIRST + 31; +pub const MCM_SETCURRENTVIEW: ::UINT = MCM_FIRST + 32; +STRUCT!{struct NMSELCHANGE { + nmhdr: ::NMHDR, + stSelStart: ::SYSTEMTIME, + stSelEnd: ::SYSTEMTIME, +}} +pub type LPNMSELCHANGE = *mut NMSELCHANGE; +pub const MCN_SELCHANGE: ::UINT = MCN_FIRST - 3; +STRUCT!{struct NMDAYSTATE { + nmhdr: ::NMHDR, + stStart: ::SYSTEMTIME, + cDayState: ::c_int, + prgDayState: LPMONTHDAYSTATE, +}} +pub type LPNMDAYSTATE = *mut NMDAYSTATE; +pub const MCN_GETDAYSTATE: ::UINT = MCN_FIRST - 1; +pub type NMSELECT = NMSELCHANGE; +pub type LPNMSELECT = *mut NMSELCHANGE; +pub const MCN_SELECT: ::UINT = MCN_FIRST; +STRUCT!{struct NMVIEWCHANGE { + nmhdr: ::NMHDR, + dwOldView: ::DWORD, + dwNewView: ::DWORD, +}} +pub type LPNMVIEWCHANGE = *mut NMVIEWCHANGE; +pub const MCN_VIEWCHANGE: ::UINT = MCN_FIRST - 4; +pub const MCS_DAYSTATE: ::DWORD = 0x0001; +pub const MCS_MULTISELECT: ::DWORD = 0x0002; +pub const MCS_WEEKNUMBERS: ::DWORD = 0x0004; +pub const MCS_NOTODAYCIRCLE: ::DWORD = 0x0008; +pub const MCS_NOTODAY: ::DWORD = 0x0010; +pub const MCS_NOTRAILINGDATES: ::DWORD = 0x0040; +pub const MCS_SHORTDAYSOFWEEK: ::DWORD = 0x0080; +pub const MCS_NOSELCHANGEONNAV: ::DWORD = 0x0100; +pub const GMR_VISIBLE: ::DWORD = 0; +pub const GMR_DAYSTATE: ::DWORD = 1; +STRUCT!{struct DATETIMEPICKERINFO { + cbSize: ::UINT, + rcCheck: ::RECT, + stateCheck: ::DWORD, + rcButton: ::RECT, + stateButton: ::DWORD, + hwndEdit: ::HWND, + hwndUD: ::HWND, + hwndDropDown: ::HWND, +}} +pub type LPDATETIMEPICKERINFO = *mut DATETIMEPICKERINFO; +pub const DTM_FIRST: ::UINT = 0x1000; +pub const DTM_GETSYSTEMTIME: ::UINT = DTM_FIRST + 1; +pub const DTM_SETSYSTEMTIME: ::UINT = DTM_FIRST + 2; +pub const DTM_GETRANGE: ::UINT = DTM_FIRST + 3; +pub const DTM_SETRANGE: ::UINT = DTM_FIRST + 4; +pub const DTM_SETFORMATA: ::UINT = DTM_FIRST + 5; +pub const DTM_SETFORMATW: ::UINT = DTM_FIRST + 50; +pub const DTM_SETMCCOLOR: ::UINT = DTM_FIRST + 6; +pub const DTM_GETMCCOLOR: ::UINT = DTM_FIRST + 7; +pub const DTM_GETMONTHCAL: ::UINT = DTM_FIRST + 8; +pub const DTM_SETMCFONT: ::UINT = DTM_FIRST + 9; +pub const DTM_GETMCFONT: ::UINT = DTM_FIRST + 10; +pub const DTM_SETMCSTYLE: ::UINT = DTM_FIRST + 11; +pub const DTM_GETMCSTYLE: ::UINT = DTM_FIRST + 12; +pub const DTM_CLOSEMONTHCAL: ::UINT = DTM_FIRST + 13; +pub const DTM_GETDATETIMEPICKERINFO: ::UINT = DTM_FIRST + 14; +pub const DTM_GETIDEALSIZE: ::UINT = DTM_FIRST + 15; +pub const DTS_UPDOWN: ::DWORD = 0x0001; +pub const DTS_SHOWNONE: ::DWORD = 0x0002; +pub const DTS_SHORTDATEFORMAT: ::DWORD = 0x0000; +pub const DTS_LONGDATEFORMAT: ::DWORD = 0x0004; +pub const DTS_SHORTDATECENTURYFORMAT: ::DWORD = 0x000C; +pub const DTS_TIMEFORMAT: ::DWORD = 0x0009; +pub const DTS_APPCANPARSE: ::DWORD = 0x0010; +pub const DTS_RIGHTALIGN: ::DWORD = 0x0020; +pub const DTN_DATETIMECHANGE: ::UINT = DTN_FIRST2 - 6; +STRUCT!{struct NMDATETIMECHANGE { + nmhdr: ::NMHDR, + dwFlags: ::DWORD, + st: ::SYSTEMTIME, +}} +pub type LPNMDATETIMECHANGE = *mut NMDATETIMECHANGE; +pub const DTN_USERSTRINGA: ::UINT = DTN_FIRST2 - 5; +pub const DTN_USERSTRINGW: ::UINT = DTN_FIRST - 5; +STRUCT!{struct NMDATETIMESTRINGA { + nmhdr: ::NMHDR, + pszUserString: ::LPCSTR, + st: ::SYSTEMTIME, + dwFlags: ::DWORD, +}} +pub type LPNMDATETIMESTRINGA = *mut NMDATETIMESTRINGA; +STRUCT!{struct NMDATETIMESTRINGW { + nmhdr: ::NMHDR, + pszUserString: ::LPCWSTR, + st: ::SYSTEMTIME, + dwFlags: ::DWORD, +}} +pub type LPNMDATETIMESTRINGW = *mut NMDATETIMESTRINGW; +pub const DTN_WMKEYDOWNA: ::UINT = DTN_FIRST2 - 4; +pub const DTN_WMKEYDOWNW: ::UINT = DTN_FIRST - 4; +STRUCT!{struct NMDATETIMEWMKEYDOWNA { + nmhdr: ::NMHDR, + nVirtKey: ::c_int, + pszFormat: ::LPCSTR, + st: ::SYSTEMTIME, +}} +pub type LPNMDATETIMEWMKEYDOWNA = *mut NMDATETIMEWMKEYDOWNA; +STRUCT!{struct NMDATETIMEWMKEYDOWNW { + nmhdr: ::NMHDR, + nVirtKey: ::c_int, + pszFormat: ::LPCWSTR, + st: ::SYSTEMTIME, +}} +pub type LPNMDATETIMEWMKEYDOWNW = *mut NMDATETIMEWMKEYDOWNW; +pub const DTN_FORMATA: ::UINT = DTN_FIRST2 - 3; +pub const DTN_FORMATW: ::UINT = DTN_FIRST - 3; +STRUCT!{nodebug struct NMDATETIMEFORMATA { + nmhdr: ::NMHDR, + pszFormat: ::LPCSTR, + st: ::SYSTEMTIME, + pszDisplay: ::LPCSTR, + szDisplay: [::CHAR; 64], +}} +pub type LPNMDATETIMEFORMATA = *mut NMDATETIMEFORMATA; +STRUCT!{nodebug struct NMDATETIMEFORMATW { + nmhdr: ::NMHDR, + pszFormat: ::LPCWSTR, + st: ::SYSTEMTIME, + pszDisplay: ::LPCWSTR, + szDisplay: [::WCHAR; 64], +}} +pub type LPNMDATETIMEFORMATW = *mut NMDATETIMEFORMATW; +pub const DTN_FORMATQUERYA: ::UINT = DTN_FIRST2 - 2; +pub const DTN_FORMATQUERYW: ::UINT = DTN_FIRST - 2; +STRUCT!{struct NMDATETIMEFORMATQUERYA { + nmhdr: ::NMHDR, + pszFormat: ::LPCSTR, + szMax: ::SIZE, +}} +pub type LPNMDATETIMEFORMATQUERYA = *mut NMDATETIMEFORMATQUERYA; +STRUCT!{struct NMDATETIMEFORMATQUERYW { + nmhdr: ::NMHDR, + pszFormat: ::LPCWSTR, + szMax: ::SIZE, +}} +pub type LPNMDATETIMEFORMATQUERYW = *mut NMDATETIMEFORMATQUERYW; +pub const DTN_DROPDOWN: ::UINT = DTN_FIRST2 - 1; +pub const DTN_CLOSEUP: ::UINT = DTN_FIRST2; +pub const GDTR_MIN: ::WPARAM = 0x0001; +pub const GDTR_MAX: ::WPARAM = 0x0002; +pub const GDT_ERROR: ::LRESULT = -1; +pub const GDT_VALID: ::LRESULT = 0; +pub const GDT_NONE: ::LRESULT = 1; +pub const IPM_CLEARADDRESS: ::UINT = ::WM_USER + 100; +pub const IPM_SETADDRESS: ::UINT = ::WM_USER + 101; +pub const IPM_GETADDRESS: ::UINT = ::WM_USER + 102; +pub const IPM_SETRANGE: ::UINT = ::WM_USER + 103; +pub const IPM_SETFOCUS: ::UINT = ::WM_USER + 104; +pub const IPM_ISBLANK: ::UINT = ::WM_USER + 105; +pub const IPN_FIELDCHANGED: ::UINT = IPN_FIRST - 0; +STRUCT!{struct NMIPADDRESS { + hdr: ::NMHDR, + iField: ::c_int, + iValue: ::c_int, +}} +pub type LPNMIPADDRESS = *mut NMIPADDRESS; +#[inline] #[allow(dead_code)] +pub fn MAKEIPRANGE(low: ::BYTE, high: ::BYTE) -> ::LPARAM { + (high << 8 + low) as ::LPARAM +} +#[inline] #[allow(dead_code)] +pub fn MAKEIPADDRESS(b1: ::DWORD, b2: ::DWORD, b3: ::DWORD, b4: ::DWORD) -> ::LPARAM { + ((b1 << 24) + (b2 << 16) + (b3 << 8) + b4) as ::LPARAM +} +pub const PGS_VERT: ::DWORD = 0x00000000; +pub const PGS_HORZ: ::DWORD = 0x00000001; +pub const PGS_AUTOSCROLL: ::DWORD = 0x00000002; +pub const PGS_DRAGNDROP: ::DWORD = 0x00000004; +pub const PGF_INVISIBLE: ::DWORD = 0; +pub const PGF_NORMAL: ::DWORD = 1; +pub const PGF_GRAYED: ::DWORD = 2; +pub const PGF_DEPRESSED: ::DWORD = 4; +pub const PGF_HOT: ::DWORD = 8; +pub const PGB_TOPORLEFT: ::c_int = 0; +pub const PGB_BOTTOMORRIGHT: ::c_int = 1; +pub const PGM_SETCHILD: ::UINT = PGM_FIRST + 1; +pub const PGM_RECALCSIZE: ::UINT = PGM_FIRST + 2; +pub const PGM_FORWARDMOUSE: ::UINT = PGM_FIRST + 3; +pub const PGM_SETBKCOLOR: ::UINT = PGM_FIRST + 4; +pub const PGM_GETBKCOLOR: ::UINT = PGM_FIRST + 5; +pub const PGM_SETBORDER: ::UINT = PGM_FIRST + 6; +pub const PGM_GETBORDER: ::UINT = PGM_FIRST + 7; +pub const PGM_SETPOS: ::UINT = PGM_FIRST + 8; +pub const PGM_GETPOS: ::UINT = PGM_FIRST + 9; +pub const PGM_SETBUTTONSIZE: ::UINT = PGM_FIRST + 10; +pub const PGM_GETBUTTONSIZE: ::UINT = PGM_FIRST + 11; +pub const PGM_GETBUTTONSTATE: ::UINT = PGM_FIRST + 12; +pub const PGM_GETDROPTARGET: ::UINT = CCM_GETDROPTARGET; +pub const PGM_SETSCROLLINFO: ::UINT = PGM_FIRST + 13; +pub const PGN_SCROLL: ::UINT = PGN_FIRST - 1; +pub const PGF_SCROLLUP: ::c_int = 1; +pub const PGF_SCROLLDOWN: ::c_int = 2; +pub const PGF_SCROLLLEFT: ::c_int = 4; +pub const PGF_SCROLLRIGHT: ::c_int = 8; +pub const PGK_SHIFT: ::BOOL = 1; +pub const PGK_CONTROL: ::BOOL = 2; +pub const PGK_MENU: ::BOOL = 4; +STRUCT!{struct NMPGSCROLL { + hdr: ::NMHDR, + fwKeys: ::BOOL, + rcParent: ::RECT, + iDir: ::c_int, + iXpos: ::c_int, + iYpos: ::c_int, + iScroll: ::c_int, +}} +pub type LPNMPGSCROLL = *mut NMPGSCROLL; +pub const PGN_CALCSIZE: ::UINT = PGN_FIRST - 2; +pub const PGF_CALCWIDTH: ::DWORD = 1; +pub const PGF_CALCHEIGHT: ::DWORD = 2; +STRUCT!{struct NMPGCALCSIZE { + hdr: ::NMHDR, + dwFlag: ::DWORD, + iWidth: ::c_int, + iHeight: ::c_int, +}} +pub type LPNMPGCALCSIZE = *mut NMPGCALCSIZE; +pub const PGN_HOTITEMCHANGE: ::UINT = PGN_FIRST - 3; +STRUCT!{struct NMPGHOTITEM { + hdr: ::NMHDR, + idOld: ::c_int, + idNew: ::c_int, + dwFlags: ::DWORD, +}} +pub type LPNMPGHOTITEM = *mut NMPGHOTITEM; +pub const NFS_EDIT: ::DWORD = 0x0001; +pub const NFS_STATIC: ::DWORD = 0x0002; +pub const NFS_LISTCOMBO: ::DWORD = 0x0004; +pub const NFS_BUTTON: ::DWORD = 0x0008; +pub const NFS_ALL: ::DWORD = 0x0010; +pub const NFS_USEFONTASSOC: ::DWORD = 0x0020; +pub const BUTTON_IMAGELIST_ALIGN_LEFT: ::UINT = 0; +pub const BUTTON_IMAGELIST_ALIGN_RIGHT: ::UINT = 1; +pub const BUTTON_IMAGELIST_ALIGN_TOP: ::UINT = 2; +pub const BUTTON_IMAGELIST_ALIGN_BOTTOM: ::UINT = 3; +pub const BUTTON_IMAGELIST_ALIGN_CENTER: ::UINT = 4; +STRUCT!{struct BUTTON_IMAGELIST { + himl: HIMAGELIST, + margin: ::RECT, + uAlign: ::UINT, +}} +pub type PBUTTON_IMAGELIST = *mut BUTTON_IMAGELIST; +pub const BCM_GETIDEALSIZE: ::UINT = BCM_FIRST + 0x0001; +pub const BCM_SETIMAGELIST: ::UINT = BCM_FIRST + 0x0002; +pub const BCM_GETIMAGELIST: ::UINT = BCM_FIRST + 0x0003; +pub const BCM_SETTEXTMARGIN: ::UINT = BCM_FIRST + 0x0004; +pub const BCM_GETTEXTMARGIN: ::UINT = BCM_FIRST + 0x0005; +STRUCT!{struct NMBCHOTITEM { + hdr: ::NMHDR, + dwFlags: ::DWORD, +}} +pub type LPNMBCHOTITEM = *mut NMBCHOTITEM; +pub const BCN_HOTITEMCHANGE: ::UINT = BCN_FIRST + 0x0001; +pub const BS_SPLITBUTTON: ::UINT = 0x0000000C; +pub const BS_DEFSPLITBUTTON: ::UINT = 0x0000000D; +pub const BS_COMMANDLINK: ::UINT = 0x0000000E; +pub const BS_DEFCOMMANDLINK: ::UINT = 0x0000000F; +pub const BCSIF_GLYPH: ::UINT = 0x0001; +pub const BCSIF_IMAGE: ::UINT = 0x0002; +pub const BCSIF_STYLE: ::UINT = 0x0004; +pub const BCSIF_SIZE: ::UINT = 0x0008; +pub const BCSS_NOSPLIT: ::UINT = 0x0001; +pub const BCSS_STRETCH: ::UINT = 0x0002; +pub const BCSS_ALIGNLEFT: ::UINT = 0x0004; +pub const BCSS_IMAGE: ::UINT = 0x0008; +STRUCT!{struct BUTTON_SPLITINFO { + mask: ::UINT, + himlGlyph: HIMAGELIST, + uSplitStyle: ::UINT, + size: ::SIZE, +}} +pub type PBUTTON_SPLITINFO = *mut BUTTON_SPLITINFO; +pub const BCM_SETDROPDOWNSTATE: ::UINT = BCM_FIRST + 0x0006; +pub const BCM_SETSPLITINFO: ::UINT = BCM_FIRST + 0x0007; +pub const BCM_GETSPLITINFO: ::UINT = BCM_FIRST + 0x0008; +pub const BCM_SETNOTE: ::UINT = BCM_FIRST + 0x0009; +pub const BCM_GETNOTE: ::UINT = BCM_FIRST + 0x000A; +pub const BCM_GETNOTELENGTH: ::UINT = BCM_FIRST + 0x000B; +pub const BCM_SETSHIELD: ::UINT = BCM_FIRST + 0x000C; +pub const BCCL_NOGLYPH: HIMAGELIST = (0 - 1) as HIMAGELIST; +STRUCT!{struct NMBCDROPDOWN { + hdr: ::NMHDR, + rcButton: ::RECT, +}} +pub type LPNMBCDROPDOWN = *mut NMBCDROPDOWN; +pub const BCN_DROPDOWN: ::UINT = BCN_FIRST + 0x0002; +pub const EM_SETCUEBANNER: ::UINT = ECM_FIRST + 1; +pub const EM_GETCUEBANNER: ::UINT = ECM_FIRST + 2; +pub const EM_SHOWBALLOONTIP: ::UINT = ECM_FIRST + 3; +pub const EM_HIDEBALLOONTIP: ::UINT = ECM_FIRST + 4; +pub const EM_SETHILITE: ::UINT = ECM_FIRST + 5; +pub const EM_GETHILITE: ::UINT = ECM_FIRST + 6; +pub const EM_NOSETFOCUS: ::UINT = ECM_FIRST + 7; +pub const EM_TAKEFOCUS: ::UINT = ECM_FIRST + 8; +STRUCT!{struct EDITBALLOONTIP { + cbStruct: ::DWORD, + pszTitle: ::LPCWSTR, + pszText: ::LPCWSTR, + ttiIcon: ::INT, +}} +pub type PEDITBALLOONTIP = *mut EDITBALLOONTIP; +pub const CB_SETMINVISIBLE: ::UINT = CBM_FIRST + 1; +pub const CB_GETMINVISIBLE: ::UINT = CBM_FIRST + 2; +pub const CB_SETCUEBANNER: ::UINT = CBM_FIRST + 3; +pub const CB_GETCUEBANNER: ::UINT = CBM_FIRST + 4; +pub type PFTASKDIALOGCALLBACK = Option ::HRESULT>; +FLAGS!{enum TASKDIALOG_FLAGS { + TDF_ENABLE_HYPERLINKS = 0x0001, + TDF_USE_HICON_MAIN = 0x0002, + TDF_USE_HICON_FOOTER = 0x0004, + TDF_ALLOW_DIALOG_CANCELLATION = 0x0008, + TDF_USE_COMMAND_LINKS = 0x0010, + TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020, + TDF_EXPAND_FOOTER_AREA = 0x0040, + TDF_EXPANDED_BY_DEFAULT = 0x0080, + TDF_VERIFICATION_FLAG_CHECKED = 0x0100, + TDF_SHOW_PROGRESS_BAR = 0x0200, + TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400, + TDF_CALLBACK_TIMER = 0x0800, + TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000, + TDF_RTL_LAYOUT = 0x2000, + TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000, + TDF_CAN_BE_MINIMIZED = 0x8000, + TDF_NO_SET_FOREGROUND = 0x00010000, + TDF_SIZE_TO_CONTENT = 0x01000000, +}} +ENUM!{enum TASKDIALOG_MESSAGES { + TDM_NAVIGATE_PAGE = ::WM_USER + 101, + TDM_CLICK_BUTTON = ::WM_USER + 102, + TDM_SET_MARQUEE_PROGRESS_BAR = ::WM_USER + 103, + TDM_SET_PROGRESS_BAR_STATE = ::WM_USER + 104, + TDM_SET_PROGRESS_BAR_RANGE = ::WM_USER + 105, + TDM_SET_PROGRESS_BAR_POS = ::WM_USER + 106, + TDM_SET_PROGRESS_BAR_MARQUEE = ::WM_USER + 107, + TDM_SET_ELEMENT_TEXT = ::WM_USER + 108, + TDM_CLICK_RADIO_BUTTON = ::WM_USER + 110, + TDM_ENABLE_BUTTON = ::WM_USER + 111, + TDM_ENABLE_RADIO_BUTTON = ::WM_USER + 112, + TDM_CLICK_VERIFICATION = ::WM_USER + 113, + TDM_UPDATE_ELEMENT_TEXT = ::WM_USER + 114, + TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = ::WM_USER + 115, + TDM_UPDATE_ICON = ::WM_USER + 116, +}} +ENUM!{enum TASKDIALOG_NOTIFICATIONS { + TDN_CREATED = 0, + TDN_NAVIGATED = 1, + TDN_BUTTON_CLICKED = 2, + TDN_HYPERLINK_CLICKED = 3, + TDN_TIMER = 4, + TDN_DESTROYED = 5, + TDN_RADIO_BUTTON_CLICKED = 6, + TDN_DIALOG_CONSTRUCTED = 7, + TDN_VERIFICATION_CLICKED = 8, + TDN_HELP = 9, + TDN_EXPANDO_BUTTON_CLICKED = 10, +}} +STRUCT!{struct TASKDIALOG_BUTTON { + nButtonID: ::c_int, + pszButtonText: ::PCWSTR, +}} +ENUM!{enum TASKDIALOG_ELEMENTS { + TDE_CONTENT, + TDE_EXPANDED_INFORMATION, + TDE_FOOTER, + TDE_MAIN_INSTRUCTION, +}} +ENUM!{enum TASKDIALOG_ICON_ELEMENTS { + TDIE_ICON_MAIN, + TDIE_ICON_FOOTER, +}} +FLAGS!{enum TASKDIALOG_COMMON_BUTTON_FLAGS { + TDCBF_OK_BUTTON = 0x0001, + TDCBF_YES_BUTTON = 0x0002, + TDCBF_NO_BUTTON = 0x0004, + TDCBF_CANCEL_BUTTON = 0x0008, + TDCBF_RETRY_BUTTON = 0x0010, + TDCBF_CLOSE_BUTTON = 0x0020, +}} +STRUCT!{nodebug struct TASKDIALOGCONFIG { + cbSize: ::UINT, + hwndParent: ::HWND, + hInstance: ::HINSTANCE, + dwFlags: TASKDIALOG_FLAGS, + dwCommonButtons: TASKDIALOG_COMMON_BUTTON_FLAGS, + pszWindowTitle: ::PCWSTR, + hMainIcon: ::HICON, + pszMainInstruction: ::PCWSTR, + pszContent: ::PCWSTR, + cButtons: ::UINT, + pButtons: *const TASKDIALOG_BUTTON, + nDefaultButton: ::c_int, + cRadioButtons: ::UINT, + pRadioButtons: *const TASKDIALOG_BUTTON, + nDefaultRadioButton: ::c_int, + pszVerificationText: ::PCWSTR, + pszExpandedInformation: ::PCWSTR, + pszExpandedControlText: ::PCWSTR, + pszCollapsedControlText: ::PCWSTR, + hFooterIcon: ::HICON, + pszFooter: ::PCWSTR, + pfCallback: PFTASKDIALOGCALLBACK, + lpCallbackData: ::LONG_PTR, + cxWidth: ::UINT, +}} +UNION!(TASKDIALOGCONFIG, hMainIcon, pszMainIcon, pszMainIcon_mut, ::PCWSTR); +UNION!(TASKDIALOGCONFIG, hFooterIcon, pszFooterIcon, pszFooterIcon_mut, ::PCWSTR); +pub const DA_LAST: ::c_int = 0x7FFFFFFF; +pub const DA_ERR: ::c_int = -1; +pub type PFNDAENUMCALLBACK = Option ::c_int>; +pub type PFNDAENUMCALLBACKCONST = Option ::c_int>; +pub type PFNDACOMPARE = Option ::c_int>; +pub type PFNDACOMPARECONST = Option ::c_int>; +pub enum DSA {} +pub type HDSA = *mut DSA; +pub const DSA_APPEND: ::c_int = DA_LAST; +pub const DSA_ERR: ::c_int = DA_ERR; +pub type PFNDSAENUMCALLBACK = PFNDAENUMCALLBACK; +pub type PFNDSAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; +pub type PFNDSACOMPARE = PFNDACOMPARE; +pub type PFNDSACOMPARECONST = PFNDACOMPARECONST; +pub enum DPA {} +pub type HDPA = *mut DPA; +STRUCT!{struct DPASTREAMINFO { + iPos: ::c_int, + pvItem: *mut ::c_void, +}} +pub type PFNDPASTREAM = Option ::HRESULT>; +pub const DPAM_SORTED: ::DWORD = 0x00000001; +pub const DPAM_NORMAL: ::DWORD = 0x00000002; +pub const DPAM_UNION: ::DWORD = 0x00000004; +pub const DPAM_INTERSECT: ::DWORD = 0x00000008; +pub type PFNDPAMERGE = Option *mut ::c_void>; +pub type PFNDPAMERGECONST = Option *const ::c_void>; +pub const DPAMM_MERGE: ::UINT = 1; +pub const DPAMM_DELETE: ::UINT = 2; +pub const DPAMM_INSERT: ::UINT = 3; +pub const DPAS_SORTED: ::UINT = 0x0001; +pub const DPAS_INSERTBEFORE: ::UINT = 0x0002; +pub const DPAS_INSERTAFTER: ::UINT = 0x0004; +pub const DPA_APPEND: ::c_int = DA_LAST; +pub const DPA_ERR: ::c_int = DA_ERR; +pub type PFNDPAENUMCALLBACK = PFNDAENUMCALLBACK; +pub type PFNDPAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; +pub type PFNDPACOMPARE = PFNDACOMPARE; +pub type PFNDPACOMPARECONST = PFNDACOMPARECONST; +pub const WSB_PROP_CYVSCROLL: ::UINT = 0x00000001; +pub const WSB_PROP_CXHSCROLL: ::UINT = 0x00000002; +pub const WSB_PROP_CYHSCROLL: ::UINT = 0x00000004; +pub const WSB_PROP_CXVSCROLL: ::UINT = 0x00000008; +pub const WSB_PROP_CXHTHUMB: ::UINT = 0x00000010; +pub const WSB_PROP_CYVTHUMB: ::UINT = 0x00000020; +pub const WSB_PROP_VBKGCOLOR: ::UINT = 0x00000040; +pub const WSB_PROP_HBKGCOLOR: ::UINT = 0x00000080; +pub const WSB_PROP_VSTYLE: ::UINT = 0x00000100; +pub const WSB_PROP_HSTYLE: ::UINT = 0x00000200; +pub const WSB_PROP_WINSTYLE: ::UINT = 0x00000400; +pub const WSB_PROP_PALETTE: ::UINT = 0x00000800; +pub const WSB_PROP_MASK: ::UINT = 0x00000FFF; +pub const FSB_FLAT_MODE: ::INT_PTR = 2; +pub const FSB_ENCARTA_MODE: ::INT_PTR = 1; +pub const FSB_REGULAR_MODE: ::INT_PTR = 0; +pub type SUBCLASSPROC = Option ::LRESULT>; diff --git a/third_party/rust/winapi/src/commdlg.rs b/third_party/rust/winapi/src/commdlg.rs new file mode 100644 index 000000000000..0eb3fd87215c --- /dev/null +++ b/third_party/rust/winapi/src/commdlg.rs @@ -0,0 +1,583 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! 32-Bit Common Dialog APIs +pub type LPOFNHOOKPROC = Option ::UINT_PTR>; +STRUCT!{nodebug struct OPENFILENAME_NT4A { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + lpstrFilter: ::LPCSTR, + lpstrCustomFilter: ::LPSTR, + nMaxCustFilter: ::DWORD, + nFilterIndex: ::DWORD, + lpstrFile: ::LPSTR, + nMaxFile: ::DWORD, + lpstrFileTitle: ::LPSTR, + nMaxFileTitle: ::DWORD, + lpstrInitialDir: ::LPCSTR, + lpstrTitle: ::LPCSTR, + Flags: ::DWORD, + nFileOffset: ::WORD, + nFileExtension: ::WORD, + lpstrDefExt: ::LPCSTR, + lCustData: ::LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: ::LPCSTR, +}} +pub type LPOPENFILENAME_NT4A = *mut OPENFILENAME_NT4A; +STRUCT!{nodebug struct OPENFILENAME_NT4W { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + lpstrFilter: ::LPCWSTR, + lpstrCustomFilter: ::LPWSTR, + nMaxCustFilter: ::DWORD, + nFilterIndex: ::DWORD, + lpstrFile: ::LPWSTR, + nMaxFile: ::DWORD, + lpstrFileTitle: ::LPWSTR, + nMaxFileTitle: ::DWORD, + lpstrInitialDir: ::LPCWSTR, + lpstrTitle: ::LPCWSTR, + Flags: ::DWORD, + nFileOffset: ::WORD, + nFileExtension: ::WORD, + lpstrDefExt: ::LPCWSTR, + lCustData: ::LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: ::LPCWSTR, +}} +pub type LPOPENFILENAME_NT4W = *mut OPENFILENAME_NT4W; +STRUCT!{nodebug struct OPENFILENAMEA { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + lpstrFilter: ::LPCSTR, + lpstrCustomFilter: ::LPSTR, + nMaxCustFilter: ::DWORD, + nFilterIndex: ::DWORD, + lpstrFile: ::LPSTR, + nMaxFile: ::DWORD, + lpstrFileTitle: ::LPSTR, + nMaxFileTitle: ::DWORD, + lpstrInitialDir: ::LPCSTR, + lpstrTitle: ::LPCSTR, + Flags: ::DWORD, + nFileOffset: ::WORD, + nFileExtension: ::WORD, + lpstrDefExt: ::LPCSTR, + lCustData: ::LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: ::LPCSTR, + pvReserved: *mut ::c_void, + dwReserved: ::DWORD, + FlagsEx: ::DWORD, +}} +pub type LPOPENFILENAMEA = *mut OPENFILENAMEA; +STRUCT!{nodebug struct OPENFILENAMEW { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + lpstrFilter: ::LPCWSTR, + lpstrCustomFilter: ::LPWSTR, + nMaxCustFilter: ::DWORD, + nFilterIndex: ::DWORD, + lpstrFile: ::LPWSTR, + nMaxFile: ::DWORD, + lpstrFileTitle: ::LPWSTR, + nMaxFileTitle: ::DWORD, + lpstrInitialDir: ::LPCWSTR, + lpstrTitle: ::LPCWSTR, + Flags: ::DWORD, + nFileOffset: ::WORD, + nFileExtension: ::WORD, + lpstrDefExt: ::LPCWSTR, + lCustData: ::LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: ::LPCWSTR, + pvReserved: *mut ::c_void, + dwReserved: ::DWORD, + FlagsEx: ::DWORD, +}} +pub type LPOPENFILENAMEW = *mut OPENFILENAMEW; +pub const OFN_READONLY: ::DWORD = 0x00000001; +pub const OFN_OVERWRITEPROMPT: ::DWORD = 0x00000002; +pub const OFN_HIDEREADONLY: ::DWORD = 0x00000004; +pub const OFN_NOCHANGEDIR: ::DWORD = 0x00000008; +pub const OFN_SHOWHELP: ::DWORD = 0x00000010; +pub const OFN_ENABLEHOOK: ::DWORD = 0x00000020; +pub const OFN_ENABLETEMPLATE: ::DWORD = 0x00000040; +pub const OFN_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000080; +pub const OFN_NOVALIDATE: ::DWORD = 0x00000100; +pub const OFN_ALLOWMULTISELECT: ::DWORD = 0x00000200; +pub const OFN_EXTENSIONDIFFERENT: ::DWORD = 0x00000400; +pub const OFN_PATHMUSTEXIST: ::DWORD = 0x00000800; +pub const OFN_FILEMUSTEXIST: ::DWORD = 0x00001000; +pub const OFN_CREATEPROMPT: ::DWORD = 0x00002000; +pub const OFN_SHAREAWARE: ::DWORD = 0x00004000; +pub const OFN_NOREADONLYRETURN: ::DWORD = 0x00008000; +pub const OFN_NOTESTFILECREATE: ::DWORD = 0x00010000; +pub const OFN_NONETWORKBUTTON: ::DWORD = 0x00020000; +pub const OFN_NOLONGNAMES: ::DWORD = 0x00040000; +pub const OFN_EXPLORER: ::DWORD = 0x00080000; +pub const OFN_NODEREFERENCELINKS: ::DWORD = 0x00100000; +pub const OFN_LONGNAMES: ::DWORD = 0x00200000; +pub const OFN_ENABLEINCLUDENOTIFY: ::DWORD = 0x00400000; +pub const OFN_ENABLESIZING: ::DWORD = 0x00800000; +pub const OFN_DONTADDTORECENT: ::DWORD = 0x02000000; +pub const OFN_FORCESHOWHIDDEN: ::DWORD = 0x10000000; +pub const OFN_EX_NOPLACESBAR: ::DWORD = 0x00000001; +pub const OFN_SHAREFALLTHROUGH: ::UINT_PTR = 2; +pub const OFN_SHARENOWARN: ::UINT_PTR = 1; +pub const OFN_SHAREWARN: ::UINT_PTR = 0; +pub type LPCCHOOKPROC = Option ::UINT_PTR>; +STRUCT!{struct OFNOTIFYA { + hdr: ::NMHDR, + lpOFN: LPOPENFILENAMEA, + pszFile: ::LPSTR, +}} +pub type LPOFNOTIFYA = *mut OFNOTIFYA; +STRUCT!{struct OFNOTIFYW { + hdr: ::NMHDR, + lpOFN: LPOPENFILENAMEW, + pszFile: ::LPWSTR, +}} +pub type LPOFNOTIFYW = *mut OFNOTIFYW; +STRUCT!{struct OFNOTIFYEXA { + hdr: ::NMHDR, + lpOFN: LPOPENFILENAMEA, + psf: ::LPVOID, + pidl: ::LPVOID, +}} +pub type LPOFNOTIFYEXA = *mut OFNOTIFYEXA; +STRUCT!{struct OFNOTIFYEXW { + hdr: ::NMHDR, + lpOFN: LPOPENFILENAMEW, + psf: ::LPVOID, + pidl: ::LPVOID, +}} +pub type LPOFNOTIFYEXW = *mut OFNOTIFYEXW; +pub const CDN_FIRST: ::UINT = -601i32 as ::UINT; +pub const CDN_LAST: ::UINT = -699i32 as ::UINT; +pub const CDN_INITDONE: ::UINT = CDN_FIRST - 0x0000; +pub const CDN_SELCHANGE: ::UINT = CDN_FIRST - 0x0001; +pub const CDN_FOLDERCHANGE: ::UINT = CDN_FIRST - 0x0002; +pub const CDN_SHAREVIOLATION: ::UINT = CDN_FIRST - 0x0003; +pub const CDN_HELP: ::UINT = CDN_FIRST - 0x0004; +pub const CDN_FILEOK: ::UINT = CDN_FIRST - 0x0005; +pub const CDN_TYPECHANGE: ::UINT = CDN_FIRST - 0x0006; +pub const CDN_INCLUDEITEM: ::UINT = CDN_FIRST - 0x0007; +pub const CDM_FIRST: ::UINT = ::WM_USER + 100; +pub const CDM_LAST: ::UINT = ::WM_USER + 200; +pub const CDM_GETSPEC: ::UINT = CDM_FIRST + 0x0000; +pub const CDM_GETFILEPATH: ::UINT = CDM_FIRST + 0x0001; +pub const CDM_GETFOLDERPATH: ::UINT = CDM_FIRST + 0x0002; +pub const CDM_GETFOLDERIDLIST: ::UINT = CDM_FIRST + 0x0003; +pub const CDM_SETCONTROLTEXT: ::UINT = CDM_FIRST + 0x0004; +pub const CDM_HIDECONTROL: ::UINT = CDM_FIRST + 0x0005; +pub const CDM_SETDEFEXT: ::UINT = CDM_FIRST + 0x0006; +STRUCT!{nodebug struct CHOOSECOLORA { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HWND, + rgbResult: ::COLORREF, + lpCustColors: *mut ::COLORREF, + Flags: ::DWORD, + lCustData: ::LPARAM, + lpfnHook: LPCCHOOKPROC, + lpTemplateName: ::LPCSTR, +}} +pub type LPCHOOSECOLORA = *mut CHOOSECOLORA; +STRUCT!{nodebug struct CHOOSECOLORW { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HWND, + rgbResult: ::COLORREF, + lpCustColors: *mut ::COLORREF, + Flags: ::DWORD, + lCustData: ::LPARAM, + lpfnHook: LPCCHOOKPROC, + lpTemplateName: ::LPCWSTR, +}} +pub type LPCHOOSECOLORW = *mut CHOOSECOLORW; +pub const CC_RGBINIT: ::DWORD = 0x00000001; +pub const CC_FULLOPEN: ::DWORD = 0x00000002; +pub const CC_PREVENTFULLOPEN: ::DWORD = 0x00000004; +pub const CC_SHOWHELP: ::DWORD = 0x00000008; +pub const CC_ENABLEHOOK: ::DWORD = 0x00000010; +pub const CC_ENABLETEMPLATE: ::DWORD = 0x00000020; +pub const CC_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000040; +pub const CC_SOLIDCOLOR: ::DWORD = 0x00000080; +pub const CC_ANYCOLOR: ::DWORD = 0x00000100; +pub type LPFRHOOKPROC = Option ::UINT_PTR>; +STRUCT!{nodebug struct FINDREPLACEA { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + Flags: ::DWORD, + lpstrFindWhat: ::LPSTR, + lpstrReplaceWith: ::LPSTR, + wFindWhatLen: ::WORD, + wReplaceWithLen: ::WORD, + lCustData: ::LPARAM, + lpfnHook: LPFRHOOKPROC, + lpTemplateName: ::LPCSTR, +}} +pub type LPFINDREPLACEA = *mut FINDREPLACEA; +STRUCT!{nodebug struct FINDREPLACEW { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + Flags: ::DWORD, + lpstrFindWhat: ::LPWSTR, + lpstrReplaceWith: ::LPWSTR, + wFindWhatLen: ::WORD, + wReplaceWithLen: ::WORD, + lCustData: ::LPARAM, + lpfnHook: LPFRHOOKPROC, + lpTemplateName: ::LPCWSTR, +}} +pub type LPFINDREPLACEW = *mut FINDREPLACEW; +pub const FR_DOWN: ::DWORD = 0x00000001; +pub const FR_WHOLEWORD: ::DWORD = 0x00000002; +pub const FR_MATCHCASE: ::DWORD = 0x00000004; +pub const FR_FINDNEXT: ::DWORD = 0x00000008; +pub const FR_REPLACE: ::DWORD = 0x00000010; +pub const FR_REPLACEALL: ::DWORD = 0x00000020; +pub const FR_DIALOGTERM: ::DWORD = 0x00000040; +pub const FR_SHOWHELP: ::DWORD = 0x00000080; +pub const FR_ENABLEHOOK: ::DWORD = 0x00000100; +pub const FR_ENABLETEMPLATE: ::DWORD = 0x00000200; +pub const FR_NOUPDOWN: ::DWORD = 0x00000400; +pub const FR_NOMATCHCASE: ::DWORD = 0x00000800; +pub const FR_NOWHOLEWORD: ::DWORD = 0x00001000; +pub const FR_ENABLETEMPLATEHANDLE: ::DWORD = 0x00002000; +pub const FR_HIDEUPDOWN: ::DWORD = 0x00004000; +pub const FR_HIDEMATCHCASE: ::DWORD = 0x00008000; +pub const FR_HIDEWHOLEWORD: ::DWORD = 0x00010000; +pub const FR_RAW: ::DWORD = 0x00020000; +pub const FR_MATCHDIAC: ::DWORD = 0x20000000; +pub const FR_MATCHKASHIDA: ::DWORD = 0x40000000; +pub const FR_MATCHALEFHAMZA: ::DWORD = 0x80000000; +pub type LPCFHOOKPROC = Option ::UINT_PTR>; +STRUCT!{nodebug struct CHOOSEFONTA { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDC: ::HDC, + lpLogFont: ::LPLOGFONTA, + iPointSize: ::INT, + Flags: ::DWORD, + rgbColors: ::COLORREF, + lCustData: ::LPARAM, + lpfnHook: LPCFHOOKPROC, + lpTemplateName: ::LPCSTR, + hInstance: ::HINSTANCE, + lpszStyle: ::LPSTR, + nFontType: ::WORD, + ___MISSING_ALIGNMENT__: ::WORD, + nSizeMin: ::INT, + nSizeMax: ::INT, +}} +pub type LPCHOOSEFONTA = *mut CHOOSEFONTA; +STRUCT!{nodebug struct CHOOSEFONTW { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDC: ::HDC, + lpLogFont: ::LPLOGFONTW, + iPointSize: ::INT, + Flags: ::DWORD, + rgbColors: ::COLORREF, + lCustData: ::LPARAM, + lpfnHook: LPCFHOOKPROC, + lpTemplateName: ::LPCWSTR, + hInstance: ::HINSTANCE, + lpszStyle: ::LPWSTR, + nFontType: ::WORD, + ___MISSING_ALIGNMENT__: ::WORD, + nSizeMin: ::INT, + nSizeMax: ::INT, +}} +pub type LPCHOOSEFONTW = *mut CHOOSEFONTW; +pub const CF_SCREENFONTS: ::DWORD = 0x00000001; +pub const CF_PRINTERFONTS: ::DWORD = 0x00000002; +pub const CF_BOTH: ::DWORD = CF_SCREENFONTS | CF_PRINTERFONTS; +pub const CF_SHOWHELP: ::DWORD = 0x00000004; +pub const CF_ENABLEHOOK: ::DWORD = 0x00000008; +pub const CF_ENABLETEMPLATE: ::DWORD = 0x00000010; +pub const CF_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000020; +pub const CF_INITTOLOGFONTSTRUCT: ::DWORD = 0x00000040; +pub const CF_USESTYLE: ::DWORD = 0x00000080; +pub const CF_EFFECTS: ::DWORD = 0x00000100; +pub const CF_APPLY: ::DWORD = 0x00000200; +pub const CF_ANSIONLY: ::DWORD = 0x00000400; +pub const CF_SCRIPTSONLY: ::DWORD = CF_ANSIONLY; +pub const CF_NOVECTORFONTS: ::DWORD = 0x00000800; +pub const CF_NOOEMFONTS: ::DWORD = CF_NOVECTORFONTS; +pub const CF_NOSIMULATIONS: ::DWORD = 0x00001000; +pub const CF_LIMITSIZE: ::DWORD = 0x00002000; +pub const CF_FIXEDPITCHONLY: ::DWORD = 0x00004000; +pub const CF_WYSIWYG: ::DWORD = 0x00008000; +pub const CF_FORCEFONTEXIST: ::DWORD = 0x00010000; +pub const CF_SCALABLEONLY: ::DWORD = 0x00020000; +pub const CF_TTONLY: ::DWORD = 0x00040000; +pub const CF_NOFACESEL: ::DWORD = 0x00080000; +pub const CF_NOSTYLESEL: ::DWORD = 0x00100000; +pub const CF_NOSIZESEL: ::DWORD = 0x00200000; +pub const CF_SELECTSCRIPT: ::DWORD = 0x00400000; +pub const CF_NOSCRIPTSEL: ::DWORD = 0x00800000; +pub const CF_NOVERTFONTS: ::DWORD = 0x01000000; +pub const CF_INACTIVEFONTS: ::DWORD = 0x02000000; +pub const SIMULATED_FONTTYPE: ::WORD = 0x8000; +pub const PRINTER_FONTTYPE: ::WORD = 0x4000; +pub const SCREEN_FONTTYPE: ::WORD = 0x2000; +pub const BOLD_FONTTYPE: ::WORD = 0x0100; +pub const ITALIC_FONTTYPE: ::WORD = 0x0200; +pub const REGULAR_FONTTYPE: ::WORD = 0x0400; +pub const PS_OPENTYPE_FONTTYPE: ::DWORD = 0x10000; +pub const TT_OPENTYPE_FONTTYPE: ::DWORD = 0x20000; +pub const TYPE1_FONTTYPE: ::DWORD = 0x40000; +pub const SYMBOL_FONTTYPE: ::DWORD = 0x80000; +pub const WM_CHOOSEFONT_GETLOGFONT: ::UINT = ::WM_USER + 1; +pub const WM_CHOOSEFONT_SETLOGFONT: ::UINT = ::WM_USER + 101; +pub const WM_CHOOSEFONT_SETFLAGS: ::UINT = ::WM_USER + 102; +pub const CD_LBSELNOITEMS: ::WORD = -1i16 as ::WORD; +pub const CD_LBSELCHANGE: ::WORD = 0; +pub const CD_LBSELSUB: ::WORD = 1; +pub const CD_LBSELADD: ::WORD = 2; +pub type LPPRINTHOOKPROC = Option ::UINT_PTR>; +pub type LPSETUPHOOKPROC = Option ::UINT_PTR>; +STRUCT!{nodebug struct PRINTDLGA { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDevMode: ::HGLOBAL, + hDevNames: ::HGLOBAL, + hDC: ::HDC, + Flags: ::DWORD, + nFromPage: ::WORD, + nToPage: ::WORD, + nMinPage: ::WORD, + nMaxPage: ::WORD, + nCopies: ::WORD, + hInstance: ::HINSTANCE, + lCustData: ::LPARAM, + lpfnPrintHook: LPPRINTHOOKPROC, + lpfnSetupHook: LPSETUPHOOKPROC, + lpPrintTemplateName: ::LPCSTR, + lpSetupTemplateName: ::LPCSTR, + hPrintTemplate: ::HGLOBAL, + hSetupTemplate: ::HGLOBAL, +}} +pub type LPPRINTDLGA = *mut PRINTDLGA; +STRUCT!{nodebug struct PRINTDLGW { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDevMode: ::HGLOBAL, + hDevNames: ::HGLOBAL, + hDC: ::HDC, + Flags: ::DWORD, + nFromPage: ::WORD, + nToPage: ::WORD, + nMinPage: ::WORD, + nMaxPage: ::WORD, + nCopies: ::WORD, + hInstance: ::HINSTANCE, + lCustData: ::LPARAM, + lpfnPrintHook: LPPRINTHOOKPROC, + lpfnSetupHook: LPSETUPHOOKPROC, + lpPrintTemplateName: ::LPCWSTR, + lpSetupTemplateName: ::LPCWSTR, + hPrintTemplate: ::HGLOBAL, + hSetupTemplate: ::HGLOBAL, +}} +pub type LPPRINTDLGW = *mut PRINTDLGW; +RIDL!( +interface IPrintDialogCallback(IPrintDialogCallbackVtbl) : IUnknown(IUnknownVtbl) { + fn InitDone(&mut self) -> ::HRESULT, + fn SelectionChange(&mut self) -> ::HRESULT, + fn HandleMessage( + &mut self, hDlg: ::HWND, uMsg: ::UINT, wParam: ::WPARAM, lParam: ::LPARAM, + pResult: *mut ::LRESULT + ) -> ::HRESULT +} +); +RIDL!( +interface IPrintDialogServices(IPrintDialogServicesVtbl) : IUnknown(IUnknownVtbl) { + fn GetCurrentDevMode(&mut self, pDevMode: ::LPDEVMODEW, pcbSize: *mut ::UINT) -> ::HRESULT, + fn GetCurrentPrinterName(&mut self, pPrinterName: ::LPWSTR, pcchSize: *mut ::UINT) -> ::HRESULT, + fn GetCurrentPortName(&mut self, pPortName: ::LPWSTR, pcchSize: *mut ::UINT) -> ::HRESULT +} +); +STRUCT!{struct PRINTPAGERANGE { + nFromPage: ::DWORD, + nToPage: ::DWORD, +}} +pub type LPPRINTPAGERANGE = *mut PRINTPAGERANGE; +pub type PCPRINTPAGERANGE = *const PRINTPAGERANGE; +STRUCT!{struct PRINTDLGEXA { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDevMode: ::HGLOBAL, + hDevNames: ::HGLOBAL, + hDC: ::HDC, + Flags: ::DWORD, + Flags2: ::DWORD, + ExclusionFlags: ::DWORD, + nPageRanges: ::DWORD, + nMaxPageRanges: ::DWORD, + lpPageRanges: LPPRINTPAGERANGE, + nMinPage: ::DWORD, + nMaxPage: ::DWORD, + nCopies: ::DWORD, + hInstance: ::HINSTANCE, + lpPrintTemplateName: ::LPCSTR, + lpCallback: ::LPUNKNOWN, + nPropertyPages: ::DWORD, + lphPropertyPages: *mut ::HPROPSHEETPAGE, + nStartPage: ::DWORD, + dwResultAction: ::DWORD, +}} +pub type LPPRINTDLGEXA = *mut PRINTDLGEXA; +STRUCT!{struct PRINTDLGEXW { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDevMode: ::HGLOBAL, + hDevNames: ::HGLOBAL, + hDC: ::HDC, + Flags: ::DWORD, + Flags2: ::DWORD, + ExclusionFlags: ::DWORD, + nPageRanges: ::DWORD, + nMaxPageRanges: ::DWORD, + lpPageRanges: LPPRINTPAGERANGE, + nMinPage: ::DWORD, + nMaxPage: ::DWORD, + nCopies: ::DWORD, + hInstance: ::HINSTANCE, + lpPrintTemplateName: ::LPCWSTR, + lpCallback: ::LPUNKNOWN, + nPropertyPages: ::DWORD, + lphPropertyPages: *mut ::HPROPSHEETPAGE, + nStartPage: ::DWORD, + dwResultAction: ::DWORD, +}} +pub type LPPRINTDLGEXW = *mut PRINTDLGEXW; +pub const PD_ALLPAGES: ::DWORD = 0x00000000; +pub const PD_SELECTION: ::DWORD = 0x00000001; +pub const PD_PAGENUMS: ::DWORD = 0x00000002; +pub const PD_NOSELECTION: ::DWORD = 0x00000004; +pub const PD_NOPAGENUMS: ::DWORD = 0x00000008; +pub const PD_COLLATE: ::DWORD = 0x00000010; +pub const PD_PRINTTOFILE: ::DWORD = 0x00000020; +pub const PD_PRINTSETUP: ::DWORD = 0x00000040; +pub const PD_NOWARNING: ::DWORD = 0x00000080; +pub const PD_RETURNDC: ::DWORD = 0x00000100; +pub const PD_RETURNIC: ::DWORD = 0x00000200; +pub const PD_RETURNDEFAULT: ::DWORD = 0x00000400; +pub const PD_SHOWHELP: ::DWORD = 0x00000800; +pub const PD_ENABLEPRINTHOOK: ::DWORD = 0x00001000; +pub const PD_ENABLESETUPHOOK: ::DWORD = 0x00002000; +pub const PD_ENABLEPRINTTEMPLATE: ::DWORD = 0x00004000; +pub const PD_ENABLESETUPTEMPLATE: ::DWORD = 0x00008000; +pub const PD_ENABLEPRINTTEMPLATEHANDLE: ::DWORD = 0x00010000; +pub const PD_ENABLESETUPTEMPLATEHANDLE: ::DWORD = 0x00020000; +pub const PD_USEDEVMODECOPIES: ::DWORD = 0x00040000; +pub const PD_USEDEVMODECOPIESANDCOLLATE: ::DWORD = 0x00040000; +pub const PD_DISABLEPRINTTOFILE: ::DWORD = 0x00080000; +pub const PD_HIDEPRINTTOFILE: ::DWORD = 0x00100000; +pub const PD_NONETWORKBUTTON: ::DWORD = 0x00200000; +pub const PD_CURRENTPAGE: ::DWORD = 0x00400000; +pub const PD_NOCURRENTPAGE: ::DWORD = 0x00800000; +pub const PD_EXCLUSIONFLAGS: ::DWORD = 0x01000000; +pub const PD_USELARGETEMPLATE: ::DWORD = 0x10000000; +pub const PD_EXCL_COPIESANDCOLLATE: ::DWORD = ::DM_COPIES | ::DM_COLLATE; +pub const START_PAGE_GENERAL: ::DWORD = 0xffffffff; +pub const PD_RESULT_CANCEL: ::DWORD = 0; +pub const PD_RESULT_PRINT: ::DWORD = 1; +pub const PD_RESULT_APPLY: ::DWORD = 2; +STRUCT!{struct DEVNAMES { + wDriverOffset: ::WORD, + wDeviceOffset: ::WORD, + wOutputOffset: ::WORD, + wDefault: ::WORD, +}} +pub type LPDEVNAMES = *mut DEVNAMES; +pub type PCDEVNAMES = *const DEVNAMES; +pub const DN_DEFAULTPRN: ::WORD = 0x0001; +pub const WM_PSD_PAGESETUPDLG: ::UINT = ::WM_USER; +pub const WM_PSD_FULLPAGERECT: ::UINT = ::WM_USER + 1; +pub const WM_PSD_MINMARGINRECT: ::UINT = ::WM_USER + 2; +pub const WM_PSD_MARGINRECT: ::UINT = ::WM_USER + 3; +pub const WM_PSD_GREEKTEXTRECT: ::UINT = ::WM_USER + 4; +pub const WM_PSD_ENVSTAMPRECT: ::UINT = ::WM_USER + 5; +pub const WM_PSD_YAFULLPAGERECT: ::UINT = ::WM_USER + 6; +pub type LPPAGEPAINTHOOK = Option ::UINT_PTR>; +pub type LPPAGESETUPHOOK = Option ::UINT_PTR>; +STRUCT!{nodebug struct PAGESETUPDLGA { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDevMode: ::HGLOBAL, + hDevNames: ::HGLOBAL, + Flags: ::DWORD, + ptPaperSize: ::POINT, + rtMinMargin: ::RECT, + rtMargin: ::RECT, + hInstance: ::HINSTANCE, + lCustData: ::LPARAM, + lpfnPageSetupHook: LPPAGESETUPHOOK, + lpfnPagePaintHook: LPPAGEPAINTHOOK, + lpPageSetupTemplateName: ::LPCSTR, + hPageSetupTemplate: ::HGLOBAL, +}} +pub type LPPAGESETUPDLGA = *mut PAGESETUPDLGA; +STRUCT!{nodebug struct PAGESETUPDLGW { + lStructSize: ::DWORD, + hwndOwner: ::HWND, + hDevMode: ::HGLOBAL, + hDevNames: ::HGLOBAL, + Flags: ::DWORD, + ptPaperSize: ::POINT, + rtMinMargin: ::RECT, + rtMargin: ::RECT, + hInstance: ::HINSTANCE, + lCustData: ::LPARAM, + lpfnPageSetupHook: LPPAGESETUPHOOK, + lpfnPagePaintHook: LPPAGEPAINTHOOK, + lpPageSetupTemplateName: ::LPCWSTR, + hPageSetupTemplate: ::HGLOBAL, +}} +pub type LPPAGESETUPDLGW = *mut PAGESETUPDLGW; +pub const PSD_DEFAULTMINMARGINS: ::DWORD = 0x00000000; +pub const PSD_INWININIINTLMEASURE: ::DWORD = 0x00000000; +pub const PSD_MINMARGINS: ::DWORD = 0x00000001; +pub const PSD_MARGINS: ::DWORD = 0x00000002; +pub const PSD_INTHOUSANDTHSOFINCHES: ::DWORD = 0x00000004; +pub const PSD_INHUNDREDTHSOFMILLIMETERS: ::DWORD = 0x00000008; +pub const PSD_DISABLEMARGINS: ::DWORD = 0x00000010; +pub const PSD_DISABLEPRINTER: ::DWORD = 0x00000020; +pub const PSD_NOWARNING: ::DWORD = 0x00000080; +pub const PSD_DISABLEORIENTATION: ::DWORD = 0x00000100; +pub const PSD_RETURNDEFAULT: ::DWORD = 0x00000400; +pub const PSD_DISABLEPAPER: ::DWORD = 0x00000200; +pub const PSD_SHOWHELP: ::DWORD = 0x00000800; +pub const PSD_ENABLEPAGESETUPHOOK: ::DWORD = 0x00002000; +pub const PSD_ENABLEPAGESETUPTEMPLATE: ::DWORD = 0x00008000; +pub const PSD_ENABLEPAGESETUPTEMPLATEHANDLE: ::DWORD = 0x00020000; +pub const PSD_ENABLEPAGEPAINTHOOK: ::DWORD = 0x00040000; +pub const PSD_DISABLEPAGEPAINTING: ::DWORD = 0x00080000; +pub const PSD_NONETWORKBUTTON: ::DWORD = 0x00200000; diff --git a/third_party/rust/winapi/src/corsym.rs b/third_party/rust/winapi/src/corsym.rs new file mode 100644 index 000000000000..d036f07d6451 --- /dev/null +++ b/third_party/rust/winapi/src/corsym.rs @@ -0,0 +1,79 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Common Language Runtime Debugging Symbol Reader/Writer/Binder Interfaces +DEFINE_GUID!(CorSym_LanguageType_C, 0x63a08714, 0xfc37, 0x11d2, + 0x90, 0x4c, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); +DEFINE_GUID!(CorSym_LanguageType_CPlusPlus, 0x3a12d0b7, 0xc26c, 0x11d0, + 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); +DEFINE_GUID!(CorSym_LanguageType_CSharp, 0x3f5162f8, 0x07c6, 0x11d3, + 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); +DEFINE_GUID!(CorSym_LanguageType_Basic, 0x3a12d0b8, 0xc26c, 0x11d0, + 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); +DEFINE_GUID!(CorSym_LanguageType_Java, 0x3a12d0b4, 0xc26c, 0x11d0, + 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); +DEFINE_GUID!(CorSym_LanguageType_Cobol, 0xaf046cd1, 0xd0e1, 0x11d2, + 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); +DEFINE_GUID!(CorSym_LanguageType_Pascal, 0xaf046cd2, 0xd0e1, 0x11d2, + 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); +DEFINE_GUID!(CorSym_LanguageType_ILAssembly, 0xaf046cd3, 0xd0e1, 0x11d2, + 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); +DEFINE_GUID!(CorSym_LanguageType_JScript, 0x3a12d0b6, 0xc26c, 0x11d0, + 0xb4, 0x42, 0x00, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); +DEFINE_GUID!(CorSym_LanguageType_SMC, 0xd9b9f7b, 0x6611, 0x11d3, + 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd); +DEFINE_GUID!(CorSym_LanguageType_MCPlusPlus, 0x4b35fde8, 0x07c6, 0x11d3, + 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); +DEFINE_GUID!(CorSym_LanguageVendor_Microsoft, 0x994b45c4, 0xe6e9, 0x11d2, + 0x90, 0x3f, 0x00, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); +DEFINE_GUID!(CorSym_DocumentType_Text, 0x5a869d0b, 0x6611, 0x11d3, + 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd); +DEFINE_GUID!(CorSym_DocumentType_MC, 0xeb40cb65, 0x3c1f, 0x4352, + 0x9d, 0x7b, 0xba, 0xf, 0xc4, 0x7a, 0x9d, 0x77); +DEFINE_GUID!(CorSym_SourceHash_MD5, 0x406ea660, 0x64cf, 0x4c82, + 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99); +DEFINE_GUID!(CorSym_SourceHash_SHA1, 0xff1816ec, 0xaa5e, 0x4d10, + 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60); +ENUM!{enum CorSymAddrKind { + ADDR_IL_OFFSET = 1, + ADDR_NATIVE_RVA = 2, + ADDR_NATIVE_REGISTER = 3, + ADDR_NATIVE_REGREL = 4, + ADDR_NATIVE_OFFSET = 5, + ADDR_NATIVE_REGREG = 6, + ADDR_NATIVE_REGSTK = 7, + ADDR_NATIVE_STKREG = 8, + ADDR_BITFIELD = 9, + ADDR_NATIVE_ISECTOFFSET = 10, +}} +FLAGS!{enum CorSymVarFlag { + VAR_IS_COMP_GEN = 1, +}} +RIDL!( +interface ISymUnmanagedBinder(ISymUnmanagedBinderVtbl): IUnknown(IUnknownVtbl) { + fn GetReaderForFile( + &mut self, importer: *mut ::IUnknown, fileName: *const ::WCHAR, searchPath: *const ::WCHAR, + pRetVal: *mut *mut ISymUnmanagedReader + ) -> ::HRESULT, + fn GetReaderFromStream( + &mut self, importer: *mut ::IUnknown, pstream: *mut ::IStream, + pRetVal: *mut *mut ISymUnmanagedReader + ) -> ::HRESULT +} +); +FLAGS!{enum CorSymSearchPolicyAttributes { + AllowRegistryAccess = 0x1, + AllowSymbolServerAccess = 0x2, + AllowOriginalPathAccess = 0x4, + AllowReferencePathAccess = 0x8, +}} +RIDL!( +interface ISymUnmanagedBinder2(ISymUnmanagedBinder2Vtbl): + ISymUnmanagedBinder(ISymUnmanagedBinderVtbl) { + fn GetReaderForFile2( + &mut self, importer: *mut ::IUnknown, fileName: *const ::WCHAR, searchPath: *const ::WCHAR, + searchPolicy: ::ULONG32, pRetVal: *mut *mut ISymUnmanagedReader + ) -> ::HRESULT +} +); +#[derive(Clone, Copy)] +pub struct ISymUnmanagedReader; diff --git a/third_party/rust/winapi/src/d2d1.rs b/third_party/rust/winapi/src/d2d1.rs new file mode 100644 index 000000000000..1b1b03980350 --- /dev/null +++ b/third_party/rust/winapi/src/d2d1.rs @@ -0,0 +1,734 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of d2d1.h +// Types confirmed affected by the ABI issue: +// D2D1_SIZE_F, D2D1_SIZE_U, D2D1_COLOR_F, D2D1_PIXEL_FORMAT, +// D2D1_POINT_2F +pub const D2D1_DEFAULT_FLATTENING_TOLERANCE: ::FLOAT = 0.25; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR: ::DWORD = 0; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR: ::DWORD = 1; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC: ::DWORD = 2; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR: ::DWORD = 3; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC: ::DWORD = 4; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC: ::DWORD = 5; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_FANT: ::DWORD = 6; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR: ::DWORD = 7; +ENUM!{enum D2D1_GAMMA { + D2D1_GAMMA_2_2 = 0, + D2D1_GAMMA_1_0 = 1, +}} +ENUM!{enum D2D1_OPACITY_MASK_CONTENT { + D2D1_OPACITY_MASK_CONTENT_GRAPHICS = 0, + D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL = 1, + D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE = 2, +}} +ENUM!{enum D2D1_EXTEND_MODE { + D2D1_EXTEND_MODE_CLAMP = 0, + D2D1_EXTEND_MODE_WRAP = 1, + D2D1_EXTEND_MODE_MIRROR = 2, +}} +ENUM!{enum D2D1_ANTIALIAS_MODE { + D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0, + D2D1_ANTIALIAS_MODE_ALIASED = 1, +}} +ENUM!{enum D2D1_TEXT_ANTIALIAS_MODE { + D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0, + D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1, + D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2, + D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3, +}} +ENUM!{enum D2D1_BITMAP_INTERPOLATION_MODE { + D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = + D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, + D2D1_BITMAP_INTERPOLATION_MODE_LINEAR = + D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, +}} +FLAGS!{enum D2D1_DRAW_TEXT_OPTIONS { + D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001, + D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002, + D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004, + D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000, +}} +pub type D2D1_POINT_2U = ::D2D_POINT_2U; +pub type D2D1_POINT_2F = ::D2D_POINT_2F; +pub type D2D1_RECT_F = ::D2D_RECT_F; +pub type D2D1_RECT_U = ::D2D_RECT_U; +pub type D2D1_SIZE_F = ::D2D_SIZE_F; +pub type D2D1_SIZE_U = ::D2D_SIZE_U; +pub type D2D1_COLOR_F = ::D2D_COLOR_F; +pub type D2D1_MATRIX_3X2_F = ::D2D_MATRIX_3X2_F; +pub type D2D1_TAG = ::UINT64; +STRUCT!{struct D2D1_BITMAP_PROPERTIES { + pixelFormat: ::D2D1_PIXEL_FORMAT, + dpiX: ::FLOAT, + dpiY: ::FLOAT, +}} +STRUCT!{struct D2D1_GRADIENT_STOP { + position: ::FLOAT, + color: D2D1_COLOR_F, +}} +STRUCT!{struct D2D1_BRUSH_PROPERTIES { + opacity: ::FLOAT, + transform: D2D1_MATRIX_3X2_F, +}} +STRUCT!{struct D2D1_BITMAP_BRUSH_PROPERTIES { + extendModeX: D2D1_EXTEND_MODE, + extendModeY: D2D1_EXTEND_MODE, + interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE, +}} +STRUCT!{struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES { + startPoint: ::D2D1_POINT_2F, + endPoint: ::D2D1_POINT_2F, +}} +STRUCT!{struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES { + center: ::D2D1_POINT_2F, + gradientOriginOffset: ::D2D1_POINT_2F, + radiusX: ::FLOAT, + radiusY: ::FLOAT, +}} +ENUM!{enum D2D1_ARC_SIZE { + D2D1_ARC_SIZE_SMALL = 0, + D2D1_ARC_SIZE_LARGE = 1, +}} +ENUM!{enum D2D1_CAP_STYLE { + D2D1_CAP_STYLE_FLAT = 0, + D2D1_CAP_STYLE_SQUARE = 1, + D2D1_CAP_STYLE_ROUND = 2, + D2D1_CAP_STYLE_TRIANGLE = 3, +}} +ENUM!{enum D2D1_DASH_STYLE { + D2D1_DASH_STYLE_SOLID = 0, + D2D1_DASH_STYLE_DASH = 1, + D2D1_DASH_STYLE_DOT = 2, + D2D1_DASH_STYLE_DASH_DOT = 3, + D2D1_DASH_STYLE_DASH_DOT_DOT = 4, + D2D1_DASH_STYLE_CUSTOM = 5, +}} +ENUM!{enum D2D1_LINE_JOIN { + D2D1_LINE_JOIN_MITER = 0, + D2D1_LINE_JOIN_BEVEL = 1, + D2D1_LINE_JOIN_ROUND = 2, + D2D1_LINE_JOIN_MITER_OR_BEVEL = 3, +}} +ENUM!{enum D2D1_COMBINE_MODE { + D2D1_COMBINE_MODE_UNION = 0, + D2D1_COMBINE_MODE_INTERSECT = 1, + D2D1_COMBINE_MODE_XOR = 2, + D2D1_COMBINE_MODE_EXCLUDE = 3, +}} +ENUM!{enum D2D1_GEOMETRY_RELATION { + D2D1_GEOMETRY_RELATION_UNKNOWN = 0, + D2D1_GEOMETRY_RELATION_DISJOINT = 1, + D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2, + D2D1_GEOMETRY_RELATION_CONTAINS = 3, + D2D1_GEOMETRY_RELATION_OVERLAP = 4, +}} +ENUM!{enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION { + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0, + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1, +}} +ENUM!{enum D2D1_FIGURE_BEGIN { + D2D1_FIGURE_BEGIN_FILLED = 0, + D2D1_FIGURE_BEGIN_HOLLOW = 1, +}} +ENUM!{enum D2D1_FIGURE_END { + D2D1_FIGURE_END_OPEN = 0, + D2D1_FIGURE_END_CLOSED = 1, +}} +STRUCT!{struct D2D1_BEZIER_SEGMENT { + point1: ::D2D1_POINT_2F, + point2: ::D2D1_POINT_2F, + point3: ::D2D1_POINT_2F, +}} +STRUCT!{struct D2D1_TRIANGLE { + point1: ::D2D1_POINT_2F, + point2: ::D2D1_POINT_2F, + point3: ::D2D1_POINT_2F, +}} +FLAGS!{enum D2D1_PATH_SEGMENT { + D2D1_PATH_SEGMENT_NONE = 0x00000000, + D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001, + D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002, +}} +ENUM!{enum D2D1_SWEEP_DIRECTION { + D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0, + D2D1_SWEEP_DIRECTION_CLOCKWISE = 1, +}} +ENUM!{enum D2D1_FILL_MODE { + D2D1_FILL_MODE_ALTERNATE = 0, + D2D1_FILL_MODE_WINDING = 1, +}} +STRUCT!{struct D2D1_ARC_SEGMENT { + point: ::D2D1_POINT_2F, + size: D2D1_SIZE_F, + rotationAngle: ::FLOAT, + sweepDirection: D2D1_SWEEP_DIRECTION, + arcSize: D2D1_ARC_SIZE, +}} +STRUCT!{struct D2D1_QUADRATIC_BEZIER_SEGMENT { + point1: ::D2D1_POINT_2F, + point2: ::D2D1_POINT_2F, +}} +STRUCT!{struct D2D1_ELLIPSE { + point: ::D2D1_POINT_2F, + radiusX: ::FLOAT, + radiusY: ::FLOAT, +}} +STRUCT!{struct D2D1_ROUNDED_RECT { + rect: ::D2D1_RECT_F, + radiusX: ::FLOAT, + radiusY: ::FLOAT, +}} +STRUCT!{struct D2D1_STROKE_STYLE_PROPERTIES { + startCap: D2D1_CAP_STYLE, + endCap: D2D1_CAP_STYLE, + dashCap: D2D1_CAP_STYLE, + lineJoin: D2D1_LINE_JOIN, + miterLimit: ::FLOAT, + dashStyle: D2D1_DASH_STYLE, + dashOffset: ::FLOAT, +}} +FLAGS!{enum D2D1_LAYER_OPTIONS { + D2D1_LAYER_OPTIONS_NONE = 0x00000000, + D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001, +}} +STRUCT!{struct D2D1_LAYER_PARAMETERS { + contentBounds: ::D2D1_RECT_F, + geometricMask: *mut ID2D1Geometry, + maskAntialiasMode: D2D1_ANTIALIAS_MODE, + maskTransform: D2D1_MATRIX_3X2_F, + opacity: ::FLOAT, + opacityBrush: *mut ID2D1Brush, + layerOptions: D2D1_LAYER_OPTIONS, +}} +ENUM!{enum D2D1_WINDOW_STATE { + D2D1_WINDOW_STATE_NONE = 0x0000000, + D2D1_WINDOW_STATE_OCCLUDED = 0x0000001, +}} +ENUM!{enum D2D1_RENDER_TARGET_TYPE { + D2D1_RENDER_TARGET_TYPE_DEFAULT = 0, + D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1, + D2D1_RENDER_TARGET_TYPE_HARDWARE = 2, +}} +ENUM!{enum D2D1_FEATURE_LEVEL { + D2D1_FEATURE_LEVEL_DEFAULT = 0, + D2D1_FEATURE_LEVEL_9 = ::D3D_FEATURE_LEVEL_9_1.0, + D2D1_FEATURE_LEVEL_10 = ::D3D_FEATURE_LEVEL_10_0.0, +}} +FLAGS!{enum D2D1_RENDER_TARGET_USAGE { + D2D1_RENDER_TARGET_USAGE_NONE = 0x00000000, + D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 0x00000001, + D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 0x00000002, +}} +FLAGS!{enum D2D1_PRESENT_OPTIONS { + D2D1_PRESENT_OPTIONS_NONE = 0x00000000, + D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS = 0x00000001, + D2D1_PRESENT_OPTIONS_IMMEDIATELY = 0x00000002, +}} +STRUCT!{struct D2D1_RENDER_TARGET_PROPERTIES { + _type: D2D1_RENDER_TARGET_TYPE, + pixelFormat: ::D2D1_PIXEL_FORMAT, + dpiX: ::FLOAT, + dpiY: ::FLOAT, + usage: D2D1_RENDER_TARGET_USAGE, + minLevel: D2D1_FEATURE_LEVEL, +}} +STRUCT!{struct D2D1_HWND_RENDER_TARGET_PROPERTIES { + hwnd: ::HWND, + pixelSize: D2D1_SIZE_U, + presentOptions: D2D1_PRESENT_OPTIONS, +}} +FLAGS!{enum D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS { + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001, +}} +STRUCT!{struct D2D1_DRAWING_STATE_DESCRIPTION { + antialiasMode: D2D1_ANTIALIAS_MODE, + textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE, + tag1: D2D1_TAG, + tag2: D2D1_TAG, + transform: D2D1_MATRIX_3X2_F, +}} +ENUM!{enum D2D1_DC_INITIALIZE_MODE { + D2D1_DC_INITIALIZE_MODE_COPY = 0, + D2D1_DC_INITIALIZE_MODE_CLEAR = 1, +}} +ENUM!{enum D2D1_DEBUG_LEVEL { + D2D1_DEBUG_LEVEL_NONE = 0, + D2D1_DEBUG_LEVEL_ERROR = 1, + D2D1_DEBUG_LEVEL_WARNING = 2, + D2D1_DEBUG_LEVEL_INFORMATION = 3, +}} +ENUM!{enum D2D1_FACTORY_TYPE { + D2D1_FACTORY_TYPE_SINGLE_THREADED = 0, + D2D1_FACTORY_TYPE_MULTI_THREADED = 1, +}} +STRUCT!{struct D2D1_FACTORY_OPTIONS { + debugLevel: D2D1_DEBUG_LEVEL, +}} +RIDL!( +interface ID2D1Resource(ID2D1ResourceVtbl): IUnknown(IUnknownVtbl) { + fn GetFactory(&mut self, factory: *mut *mut ID2D1Factory) -> () +}); +RIDL!( +interface ID2D1Image(ID2D1ImageVtbl): ID2D1Resource(ID2D1ResourceVtbl) { +}); +RIDL!( +interface ID2D1Bitmap(ID2D1BitmapVtbl): ID2D1Image(ID2D1ImageVtbl) { + fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F, // FIXME: ABI issue + fn GetPixelSize(&mut self, ret: *mut D2D1_SIZE_U) -> *mut D2D1_SIZE_U, // FIXME: ABI issue + fn GetPixelFormat( + &mut self, ret: *mut ::D2D1_PIXEL_FORMAT + ) -> *mut ::D2D1_PIXEL_FORMAT, // FIXME: ABI issue + fn GetDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (), + fn CopyFromBitmap( + &mut self, destPoint: *const ::D2D1_POINT_2U, bitmap: *mut ID2D1Bitmap, + srcRect: *const ::D2D1_RECT_U + ) -> ::HRESULT, + fn CopyFromRenderTarget( + &mut self, destPoint: *const ::D2D1_POINT_2U, renderTarget: *mut ID2D1RenderTarget, + srcRect: *const ::D2D1_RECT_U + ) -> ::HRESULT, + fn CopyFromMemory( + &mut self, dstRect: *const ::D2D1_RECT_U, srcData: *const ::c_void, pitch: ::UINT32 + ) -> ::HRESULT +}); +RIDL!( +interface ID2D1GradientStopCollection(ID2D1GradientStopCollectionVtbl) + : ID2D1Resource(ID2D1ResourceVtbl) { + fn GetGradientStopCount(&mut self) -> ::UINT32, + fn GetGradientStops( + &mut self, gradientStops: *mut D2D1_GRADIENT_STOP, gradientStopsCount: ::UINT32 + ) -> (), + fn GetColorInterpolationGamma(&mut self) -> D2D1_GAMMA, + fn GetExtendMode(&mut self) -> D2D1_EXTEND_MODE +}); +RIDL!( +interface ID2D1Brush(ID2D1BrushVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn SetOpacity(&mut self, opacity: ::FLOAT) -> (), + fn SetTransform(&mut self, transform: *const D2D1_MATRIX_3X2_F) -> (), + fn GetOpacity(&mut self) -> ::FLOAT, + fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> () +}); +RIDL!( +interface ID2D1BitmapBrush(ID2D1BitmapBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetExtendModeX(&mut self, extendModeX: D2D1_EXTEND_MODE) -> (), + fn SetExtendModeY(&mut self, extendModeY: D2D1_EXTEND_MODE) -> (), + fn SetInterpolationMode(&mut self, interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE) -> (), + fn SetBitmap(&mut self, bitmap: *mut ID2D1Bitmap) -> (), + fn GetExtendModeX(&mut self) -> D2D1_EXTEND_MODE, + fn GetExtendModeY(&mut self) -> D2D1_EXTEND_MODE, + fn GetInterpolationMode(&mut self) -> D2D1_BITMAP_INTERPOLATION_MODE, + fn GetBitmap(&mut self, bitmap: *mut *mut ID2D1Bitmap) -> () +}); +RIDL!( +interface ID2D1SolidColorBrush(ID2D1SolidColorBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetColor(&mut self, color: *const D2D1_COLOR_F) -> (), + fn GetColor(&mut self, color: *mut D2D1_COLOR_F) -> *mut D2D1_COLOR_F +}); +RIDL!( +interface ID2D1LinearGradientBrush(ID2D1LinearGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetStartPoint(&mut self, startPoint: ::D2D1_POINT_2F) -> (), + fn SetEndPoint(&mut self, endPoint: ::D2D1_POINT_2F) -> (), + fn GetStartPoint(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue + fn GetEndPoint(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue + fn GetGradientStopCollection( + &mut self, gradientStopCollection: *mut *mut ID2D1GradientStopCollection + ) -> () +}); +RIDL!( +interface ID2D1RadialGradientBrush(ID2D1RadialGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetCenter(&mut self, center: ::D2D1_POINT_2F) -> (), + fn SetGradientOriginOffset(&mut self, gradientOriginOffset: ::D2D1_POINT_2F) -> (), + fn SetRadiusX(&mut self, radiusX: ::FLOAT) -> (), + fn SetRadiusY(&mut self, radiusY: ::FLOAT) -> (), + fn GetCenter(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue + fn GetGradientOriginOffset( + &mut self, ret: *mut D2D1_POINT_2F + ) -> *mut D2D1_POINT_2F, // FIXME ABI issue + fn GetRadiusX(&mut self) -> ::FLOAT, + fn GetRadiusY(&mut self) -> ::FLOAT, + fn GetGradientStopCollection( + &mut self, gradientStopCollection: *mut *mut ID2D1GradientStopCollection + ) -> () +}); +RIDL!( +interface ID2D1StrokeStyle(ID2D1StrokeStyleVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetStartCap(&mut self) -> D2D1_CAP_STYLE, + fn GetEndCap(&mut self) -> D2D1_CAP_STYLE, + fn GetDashCap(&mut self) -> D2D1_CAP_STYLE, + fn GetMiterLimit(&mut self) -> ::FLOAT, + fn GetLineJoin(&mut self) -> D2D1_LINE_JOIN, + fn GetDashOffset(&mut self) -> ::FLOAT, + fn GetDashStyle(&mut self) -> D2D1_DASH_STYLE, + fn GetDashesCount(&mut self) -> ::UINT32, + fn GetDashes(&mut self, dashes: *mut ::FLOAT, dashesCount: ::UINT32) -> () +}); +RIDL!( +interface ID2D1Geometry(ID2D1GeometryVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetBounds( + &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, bounds: *mut ::D2D1_RECT_F + ) -> ::HRESULT, + fn GetWidenedBounds( + &mut self, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle, + worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + bounds: *mut ::D2D1_RECT_F + ) -> ::HRESULT, + fn StrokeContainsPoint( + &mut self, point: ::D2D1_POINT_2F, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle, + worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + contains: *mut ::BOOL + ) -> ::HRESULT, + fn FillContainsPoint( + &mut self, point: ::D2D1_POINT_2F, worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: ::FLOAT, contains: *mut ::BOOL + ) -> ::HRESULT, + fn CompareWithGeometry( + &mut self, inputGeometry: *mut ID2D1Geometry, + inputGeometryTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + relation: *mut D2D1_GEOMETRY_RELATION + ) -> ::HRESULT, + fn Simplify( + &mut self, simplificationOption: D2D1_GEOMETRY_SIMPLIFICATION_OPTION, + worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink + ) -> ::HRESULT, + fn Tessellate( + &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + tessellationSink: *mut ID2D1TessellationSink + ) -> ::HRESULT, + fn CombineWithGeometry( + &mut self, inputGeometry: *mut ID2D1Geometry, combineMode: D2D1_COMBINE_MODE, + inputGeometryTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink + ) -> ::HRESULT, + fn Outline( + &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink + ) -> ::HRESULT, + fn ComputeArea( + &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + area: *mut ::FLOAT + ) -> ::HRESULT, + fn ComputeLength( + &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + length: *mut ::FLOAT + ) -> ::HRESULT, + fn ComputePointAtLength( + &mut self, length: ::FLOAT, worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: ::FLOAT, point: *mut ::D2D1_POINT_2F, + unitTangentVector: *mut ::D2D1_POINT_2F + ) -> ::HRESULT, + fn Widen( + &mut self, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle, + worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink + ) -> ::HRESULT +}); +RIDL!( +interface ID2D1RectangleGeometry(ID2D1RectangleGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetRect(&mut self, rect: *mut ::D2D1_RECT_F) -> () +}); +RIDL!( +interface ID2D1RoundedRectangleGeometry(ID2D1RoundedRectangleGeometryVtbl) + : ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetRoundedRect(&mut self, roundedRect: *mut D2D1_ROUNDED_RECT) -> () +}); +RIDL!( +interface ID2D1EllipseGeometry(ID2D1EllipseGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetEllipse(&mut self, ellipse: *mut D2D1_ELLIPSE) -> () +}); +RIDL!( +interface ID2D1GeometryGroup(ID2D1GeometryGroupVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetFillMode(&mut self) -> D2D1_FILL_MODE, + fn GetSourceGeometryCount(&mut self) -> ::UINT32, + fn GetSourceGeometries( + &mut self, geometries: *mut *mut ID2D1Geometry, geometriesCount: ::UINT32 + ) -> () +}); +RIDL!( +interface ID2D1TransformedGeometry(ID2D1TransformedGeometryVtbl) + : ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetSourceGeometry(&mut self, sourceGeometry: *mut *mut ID2D1Geometry) -> (), + fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> () +}); +RIDL!( +interface ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl): IUnknown(IUnknownVtbl) { + fn SetFillMode(&mut self, fillMode: D2D1_FILL_MODE) -> (), + fn SetSegmentFlags(&mut self, vertexFlags: D2D1_PATH_SEGMENT) -> (), + fn BeginFigure(&mut self, startPoint: ::D2D1_POINT_2F, figureBegin: D2D1_FIGURE_BEGIN) -> (), + fn AddLines(&mut self, points: *const ::D2D1_POINT_2F, pointsCount: ::UINT32) -> (), + fn AddBeziers(&mut self, beziers: *const D2D1_BEZIER_SEGMENT, beziersCount: ::UINT32) -> (), + fn EndFigure(&mut self, figureEnd: D2D1_FIGURE_END) -> (), + fn Close(&mut self) -> ::HRESULT +}); +RIDL!( +interface ID2D1GeometrySink(ID2D1GeometrySinkVtbl) + : ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl) { + fn AddLine(&mut self, point: ::D2D1_POINT_2F) -> (), + fn AddBezier(&mut self, bezier: *const D2D1_BEZIER_SEGMENT) -> (), + fn AddQuadraticBezier(&mut self, bezier: *const D2D1_QUADRATIC_BEZIER_SEGMENT) -> (), + fn AddQuadraticBeziers( + &mut self, beziers: *const D2D1_QUADRATIC_BEZIER_SEGMENT, beziersCount: ::UINT32 + ) -> (), + fn AddArc(&mut self, arc: *const D2D1_ARC_SEGMENT) -> () +}); +RIDL!( +interface ID2D1TessellationSink(ID2D1TessellationSinkVtbl): IUnknown(IUnknownVtbl) { + fn AddTriangles(&mut self, triangles: *const D2D1_TRIANGLE, triangleCount: ::UINT32) -> (), + fn Close(&mut self) -> ::HRESULT +}); +RIDL!( +interface ID2D1PathGeometry(ID2D1PathGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn Open(&mut self, geometrySink: *mut *mut ID2D1GeometrySink) -> ::HRESULT, + fn Stream(&mut self, geometrySink: *mut ID2D1GeometrySink) -> ::HRESULT, + fn GetSegmentCount(&mut self, count: *mut ::UINT32) -> ::HRESULT, + fn GetFigureCount(&mut self, count: *mut ::UINT32) -> ::HRESULT +}); +RIDL!( +interface ID2D1Mesh(ID2D1MeshVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn Open(&mut self, tessellationSink: *mut *mut ID2D1TessellationSink) -> ::HRESULT +}); +RIDL!( +interface ID2D1Layer(ID2D1LayerVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F // FIXME: ABI issue +}); +RIDL!( +interface ID2D1DrawingStateBlock(ID2D1DrawingStateBlockVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetDescription(&mut self, stateDescription: *mut D2D1_DRAWING_STATE_DESCRIPTION) -> (), + fn SetDescription(&mut self, stateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION) -> (), + fn SetTextRenderingParams( + &mut self, textRenderingParams: *mut ::IDWriteRenderingParams + ) -> (), + fn GetTextRenderingParams( + &mut self, textRenderingParams: *mut *mut ::IDWriteRenderingParams + ) -> () +}); +RIDL!( +interface ID2D1RenderTarget(ID2D1RenderTargetVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn CreateBitmap( + &mut self, size: D2D1_SIZE_U, srcData: *const ::c_void, pitch: ::UINT32, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap + ) -> ::HRESULT, + fn CreateBitmapFromWicBitmap( + &mut self, wicBitmapSource: *mut ::IWICBitmapSource, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap + ) -> ::HRESULT, + fn CreateSharedBitmap( + &mut self, riid: ::REFIID, data: *const ::c_void, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap + ) -> ::HRESULT, + fn CreateBitmapBrush( + &mut self, bitmap: *mut ID2D1Bitmap, + bitmapBrushProperties: *const D2D1_BITMAP_BRUSH_PROPERTIES, + brushProperties: *const D2D1_BRUSH_PROPERTIES, bitmapBrush: *mut *mut ID2D1BitmapBrush + ) -> ::HRESULT, + fn CreateSolidColorBrush( + &mut self, color: *const D2D1_COLOR_F, brushProperties: *const D2D1_BRUSH_PROPERTIES, + solidColorBrush: *mut *mut ID2D1SolidColorBrush + ) -> ::HRESULT, + fn CreateGradientStopCollection( + &mut self, gradientStops: *const D2D1_GRADIENT_STOP, gradientStopsCount: ::UINT32, + colorInterpolationGamma: D2D1_GAMMA, extendMode: D2D1_EXTEND_MODE, + gradientStopCollection: *mut *mut ID2D1GradientStopCollection + ) -> ::HRESULT, + fn CreateLinearGradientBrush( + &mut self, linearGradientBrushProperties: *const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + gradientStopCollection: *mut ID2D1GradientStopCollection, + linearGradientBrush: *mut *mut ID2D1LinearGradientBrush + ) -> ::HRESULT, + fn CreateRadialGradientBrush( + &mut self, radialGradientBrushProperties: *const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + gradientStopCollection: *mut ID2D1GradientStopCollection, + radialGradientBrush: *mut *mut ID2D1RadialGradientBrush + ) -> ::HRESULT, + fn CreateCompatibleRenderTarget( + &mut self, desiredSize: *const D2D1_SIZE_F, desiredPixelSize: *const D2D1_SIZE_U, + desiredFormat: *const ::D2D1_PIXEL_FORMAT, options: D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS, + bitmapRenderTarget: *mut *mut ID2D1BitmapRenderTarget + ) -> ::HRESULT, + fn CreateLayer(&mut self, size: *const D2D1_SIZE_F, layer: *mut *mut ID2D1Layer) -> ::HRESULT, + fn CreateMesh(&mut self, mesh: *mut *mut ID2D1Mesh) -> ::HRESULT, + fn DrawLine( + &mut self, point0: ::D2D1_POINT_2F, point1: ::D2D1_POINT_2F, brush: *mut ID2D1Brush, + strokeWidth: ::FLOAT, strokeStype: *mut ID2D1StrokeStyle + ) -> (), + fn DrawRectangle( + &mut self, rect: *const ::D2D1_RECT_F, brush: *mut ID2D1Brush, + strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle + ) -> (), + fn FillRectangle( + &mut self, rect: *const ::D2D1_RECT_F, brush: *mut ID2D1Brush + ) -> (), + fn DrawRoundedRectangle( + &mut self, roundedRect: *const D2D1_ROUNDED_RECT, brush: *mut ID2D1Brush, + strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle + ) -> (), + fn FillRoundedRectangle( + &mut self, roundedRect: *const D2D1_ROUNDED_RECT, brush: *mut ID2D1Brush + ) -> (), + fn DrawEllipse( + &mut self, ellipse: *const D2D1_ELLIPSE, brush: *mut ID2D1Brush, + strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle + ) -> (), + fn FillEllipse( + &mut self, ellipse: *const D2D1_ELLIPSE, brush: *mut ID2D1Brush + ) -> (), + fn DrawGeometry( + &mut self, geometry: *mut ID2D1Geometry, brush: *mut ID2D1Brush, + strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle + ) -> (), + fn FillGeometry( + &mut self, geometry: *mut ID2D1Geometry, brush: *mut ID2D1Brush, + opacityBrush: *mut ID2D1Brush + ) -> (), + fn FillMesh( + &mut self, mesh: *mut ID2D1Mesh, brush: *const ID2D1Brush + ) -> (), + fn FillOpacityMask( + &mut self, opacityMask: *mut ID2D1Bitmap, brush: *mut ID2D1Brush, + content: D2D1_OPACITY_MASK_CONTENT, destinationRectangle: *const ::D2D1_RECT_F, + sourceRectangle: *const ::D2D1_RECT_F + ) -> (), + fn DrawBitmap( + &mut self, bitmap: *mut ID2D1Bitmap, destinationRectangle: *const ::D2D1_RECT_F, + opacity: ::FLOAT, interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE, + sourceRectangle: *const ::D2D1_RECT_F + ) -> (), + fn DrawText( + &mut self, string: *const ::WCHAR, stringLength: ::UINT32, + textFormat: *mut ::IDWriteTextFormat, layoutRect: *const ::D2D1_RECT_F, + defaultForegroundBrush: *mut ID2D1Brush, options: D2D1_DRAW_TEXT_OPTIONS, + measuringMode: ::DWRITE_MEASURING_MODE + ) -> (), + fn DrawTextLayout( + &mut self, origin: ::D2D1_POINT_2F, textLayout: *mut ::IDWriteTextLayout, + defaultForegroundBrush: *mut ID2D1Brush, options: D2D1_DRAW_TEXT_OPTIONS + ) -> (), + fn DrawGlyphRun( + &mut self, baselineOrigin: ::D2D1_POINT_2F, glyphRun: *const ::DWRITE_GLYPH_RUN, + foregroundBrush: *mut ID2D1Brush, measuringMode: ::DWRITE_MEASURING_MODE + ) -> (), + fn SetTransform(&mut self, transform: *const D2D1_MATRIX_3X2_F) -> (), + fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> (), + fn SetAntialiasMode(&mut self, antialiasMode: D2D1_ANTIALIAS_MODE) -> (), + fn GetAntialiasMode(&mut self) -> D2D1_ANTIALIAS_MODE, + fn SetTextAntialiasMode(&mut self, textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE) -> (), + fn GetTextAntialiasMode(&mut self) -> D2D1_TEXT_ANTIALIAS_MODE, + fn SetTextRenderingParams( + &mut self, textRenderingParams: *mut ::IDWriteRenderingParams + ) -> (), + fn GetTextRenderingParams( + &mut self, textRenderingParams: *mut *mut ::IDWriteRenderingParams + ) -> (), + fn SetTags(&mut self, tag1: D2D1_TAG, tag2: D2D1_TAG) -> (), + fn GetTags(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> (), + fn PushLayer( + &mut self, layerParameters: *const D2D1_LAYER_PARAMETERS, layer: *mut ID2D1Layer + ) -> (), + fn PopLayer(&mut self) -> (), + fn Flush(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> ::HRESULT, + fn SaveDrawingState(&mut self, drawingStateBlock: *mut ID2D1DrawingStateBlock) -> (), + fn RestoreDrawingState(&mut self, drawingStateBlock: *mut ID2D1DrawingStateBlock) -> (), + fn PushAxisAlignedClip( + &mut self, clipRect: *const ::D2D1_RECT_F, antialiasMode: D2D1_ANTIALIAS_MODE + ) -> (), + fn PopAxisAlignedClip(&mut self) -> (), + fn Clear(&mut self, clearColor: *const D2D1_COLOR_F) -> (), + fn BeginDraw(&mut self) -> (), + fn EndDraw(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> ::HRESULT, + fn GetPixelFormat( + &mut self, ret: *mut ::D2D1_PIXEL_FORMAT + ) -> *mut ::D2D1_PIXEL_FORMAT, // FIXME: ABI issue + fn SetDpi(&mut self, dpiX: ::FLOAT, dpiY: ::FLOAT) -> (), + fn GetDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (), + fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F, // FIXME: ABI issue + fn GetPixelSize(&mut self, ret: *mut D2D1_SIZE_U) -> *mut D2D1_SIZE_U, // FIXME: ABI issue + fn GetMaximumBitmapSize(&mut self) -> ::UINT32, + fn IsSupported( + &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES + ) -> ::BOOL +}); +RIDL!( +interface ID2D1BitmapRenderTarget(ID2D1BitmapRenderTargetVtbl) + : ID2D1RenderTarget(ID2D1RenderTargetVtbl) { + fn GetBitmap(&mut self, bitmap: *mut *mut ID2D1Bitmap) -> ::HRESULT +}); +RIDL!( +interface ID2D1HwndRenderTarget(ID2D1HwndRenderTargetVtbl) + : ID2D1RenderTarget(ID2D1RenderTargetVtbl) { + fn CheckWindowState(&mut self) -> D2D1_WINDOW_STATE, + fn Resize(&mut self, pixelSize: *const D2D1_SIZE_U) -> ::HRESULT, + fn GetHwnd(&mut self) -> ::HWND +}); +RIDL!( +interface ID2D1GdiInteropRenderTarget(ID2D1GdiInteropRenderTargetVtbl): IUnknown(IUnknownVtbl) { + fn GetDC(&mut self, mode: D2D1_DC_INITIALIZE_MODE, hdc: *mut ::HDC) -> ::HRESULT, + fn ReleaseDC(&mut self, update: *const ::RECT) -> ::HRESULT +}); +RIDL!( +interface ID2D1DCRenderTarget(ID2D1DCRenderTargetVtbl): ID2D1RenderTarget(ID2D1RenderTargetVtbl) { + fn BindDC(&mut self, hDC: ::HDC, pSubRect: *const ::RECT) -> ::HRESULT +}); +RIDL!( +interface ID2D1Factory(ID2D1FactoryVtbl): IUnknown(IUnknownVtbl) { + fn ReloadSystemMetrics(&mut self) -> ::HRESULT, + fn GetDesktopDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (), + fn CreateRectangleGeometry( + &mut self, rectangle: *const ::D2D1_RECT_F, + rectangleGeometry: *mut *mut ID2D1RectangleGeometry + ) -> ::HRESULT, + fn CreateRoundedRectangleGeometry( + &mut self, roundedRectangle: *const D2D1_ROUNDED_RECT, + roundedRectangleGeometry: *mut *mut ID2D1RoundedRectangleGeometry + ) -> ::HRESULT, + fn CreateEllipseGeometry( + &mut self, ellipse: *const D2D1_ELLIPSE, + ellipseGeometry: *mut *mut ID2D1EllipseGeometry + ) -> ::HRESULT, + fn CreateGeometryGroup( + &mut self, fillMode: D2D1_FILL_MODE, geometries: *mut *mut ID2D1Geometry, + geometriesCount: ::UINT32, geometryGroup: *mut *mut ID2D1GeometryGroup + ) -> ::HRESULT, + fn CreateTransformedGeometry( + &mut self, sourceGeometry: *mut ID2D1Geometry, transform: *const D2D1_MATRIX_3X2_F, + transformedGeometry: *mut *mut ID2D1TransformedGeometry + ) -> ::HRESULT, + fn CreatePathGeometry( + &mut self, pathGeometry: *mut *mut ID2D1PathGeometry + ) -> ::HRESULT, + fn CreateStrokeStyle( + &mut self, strokeStyleProperties: *const D2D1_STROKE_STYLE_PROPERTIES, + dashes: *const ::FLOAT, dashesCount: ::UINT32, strokeStyle: *mut *mut ID2D1StrokeStyle + ) -> ::HRESULT, + fn CreateDrawingStateBlock( + &mut self, drawingStateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION, + textRenderingParams: *mut ::IDWriteRenderingParams, + drawingStateBlock: *mut *mut ID2D1DrawingStateBlock + ) -> ::HRESULT, + fn CreateWicBitmapRenderTarget( + &mut self, target: *mut ::IWICBitmap, + renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + renderTarget: *mut *mut ID2D1RenderTarget + ) -> ::HRESULT, + fn CreateHwndRenderTarget( + &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + hwndRenderTargetProperties: *const D2D1_HWND_RENDER_TARGET_PROPERTIES, + hwndRenderTarget: *mut *mut ID2D1HwndRenderTarget + ) -> ::HRESULT, + fn CreateDxgiSurfaceRenderTarget( + &mut self, dxgiSurface: *mut ::IDXGISurface, + renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + renderTarget: *mut *mut ID2D1RenderTarget + ) -> ::HRESULT, + fn CreateDCRenderTarget( + &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + dcRenderTarget: *mut *mut ID2D1DCRenderTarget + ) -> ::HRESULT +}); +DEFINE_GUID!( + UuidOfID2D1Factory, + 0x06152247, 0x6f50, 0x465a, 0x92, 0x45, 0x11, 0x8b, 0xfd, 0x3b, 0x60, 0x07 +); diff --git a/third_party/rust/winapi/src/d2dbasetypes.rs b/third_party/rust/winapi/src/d2dbasetypes.rs new file mode 100644 index 000000000000..45a5a1414d15 --- /dev/null +++ b/third_party/rust/winapi/src/d2dbasetypes.rs @@ -0,0 +1,61 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of d2dbasetypes.h +STRUCT!{struct D2D_POINT_2U { + x: ::UINT32, + y: ::UINT32, +}} +STRUCT!{struct D2D_POINT_2F { + x: ::FLOAT, + y: ::FLOAT, +}} +pub type D2D_POINT_2L = ::POINT; +STRUCT!{struct D2D_VECTOR_2F { + x: ::FLOAT, + y: ::FLOAT, +}} +STRUCT!{struct D2D_VECTOR_3F { + x: ::FLOAT, + y: ::FLOAT, + z: ::FLOAT, +}} +STRUCT!{struct D2D_VECTOR_4F { + x: ::FLOAT, + y: ::FLOAT, + z: ::FLOAT, + w: ::FLOAT, +}} +STRUCT!{struct D2D_RECT_F { + left: ::FLOAT, + top: ::FLOAT, + right: ::FLOAT, + bottom: ::FLOAT, +}} +STRUCT!{struct D2D_RECT_U { + left: ::UINT32, + top: ::UINT32, + right: ::UINT32, + bottom: ::UINT32, +}} +pub type D2D_RECT_L = ::RECT; +STRUCT!{struct D2D_SIZE_F { + width: ::FLOAT, + height: ::FLOAT, +}} +STRUCT!{struct D2D_SIZE_U { + width: ::UINT32, + height: ::UINT32, +}} +pub type D2D_COLOR_F = ::D3DCOLORVALUE; +STRUCT!{struct D2D_MATRIX_3X2_F { + matrix: [[::FLOAT; 2]; 3], +}} +STRUCT!{struct D2D_MATRIX_4X3_F { + matrix: [[::FLOAT; 3]; 4], +}} +STRUCT!{struct D2D_MATRIX_4X4_F { + matrix: [[::FLOAT; 4]; 4], +}} +STRUCT!{struct D2D_MATRIX_5X4_F { + matrix: [[::FLOAT; 4]; 5], +}} diff --git a/third_party/rust/winapi/src/d3d10shader.rs b/third_party/rust/winapi/src/d3d10shader.rs new file mode 100644 index 000000000000..4f64c5f33073 --- /dev/null +++ b/third_party/rust/winapi/src/d3d10shader.rs @@ -0,0 +1,110 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +pub type D3D10_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; +pub type D3D10_CBUFFER_TYPE = D3D_CBUFFER_TYPE; +STRUCT!{struct D3D10_SHADER_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InputParameters: UINT, + OutputParameters: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + CutInstructionCount: UINT, + EmitInstructionCount: UINT, + GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, + GSMaxOutputVertexCount: UINT, +}} +STRUCT!{struct D3D10_SHADER_BUFFER_DESC { + Name: LPCSTR, + Type: D3D10_CBUFFER_TYPE, + Variables: UINT, + Size: UINT, + uFlags: UINT, +}} +STRUCT!{struct D3D10_SHADER_VARIABLE_DESC { + Name: LPCSTR, + StartOffset: UINT, + Size: UINT, + uFlags: UINT, + DefaultValue: LPVOID, +}} +STRUCT!{struct D3D10_SHADER_TYPE_DESC { + Class: D3D_SHADER_VARIABLE_CLASS, + Type: D3D_SHADER_VARIABLE_TYPE, + Rows: UINT, + Columns: UINT, + Elements: UINT, + Members: UINT, + Offset: UINT, +}} +STRUCT!{struct D3D10_SHADER_INPUT_BIND_DESC { + Name: LPCSTR, + Type: D3D_SHADER_INPUT_TYPE, + BindPoint: UINT, + BindCount: UINT, + uFlags: UINT, + ReturnType: D3D_RESOURCE_RETURN_TYPE, + Dimension: D3D_SRV_DIMENSION, + NumSamples: UINT, +}} +STRUCT!{struct D3D10_SIGNATURE_PARAMETER_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Register: UINT, + SystemValueType: D3D_NAME, + ComponentType: D3D_REGISTER_COMPONENT_TYPE, + Mask: BYTE, + ReadWriteMask: BYTE, +}} +RIDL!{interface ID3D10ShaderReflectionType(ID3D10ShaderReflectionTypeVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_TYPE_DESC) -> HRESULT, + fn GetMemberTypeByIndex(&mut self, Index: UINT) -> *mut ID3D10ShaderReflectionType, + fn GetMemberTypeByName(&mut self, Name: LPCSTR) -> *mut ID3D10ShaderReflectionType, + fn GetMemberTypeName(&mut self, Index: UINT) -> LPCSTR +}} +RIDL!{interface ID3D10ShaderReflectionVariable(ID3D10ShaderReflectionVariableVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_VARIABLE_DESC) -> HRESULT, + fn GetType(&mut self) -> *mut ID3D10ShaderReflectionType +}} +RIDL!{interface ID3D10ShaderReflectionConstantBuffer(ID3D10ShaderReflectionConstantBufferVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_BUFFER_DESC) -> HRESULT, + fn GetVariableByIndex(&mut self, Index: UINT) -> *mut ID3D10ShaderReflectionVariable, + fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D10ShaderReflectionVariable +}} +RIDL!{interface ID3D10ShaderReflection(ID3D10ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_DESC) -> HRESULT, + fn GetConstantBufferByIndex( + &mut self, Index: UINT + ) -> *mut ID3D10ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + &mut self, Name: LPCSTR + ) -> *mut ID3D10ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + &mut self, ResourceIndex: UINT, pDesc: *mut D3D10_SHADER_INPUT_BIND_DESC + ) -> HRESULT, + fn GetInputParameterDesc( + &mut self, ParameterIndex: UINT, pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC + ) -> HRESULT, + fn GetOutputParameterDesc( + &mut self, ParameterIndex: UINT, pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC + ) -> HRESULT +}} diff --git a/third_party/rust/winapi/src/d3d11.rs b/third_party/rust/winapi/src/d3d11.rs new file mode 100644 index 000000000000..4fed70ca2ea8 --- /dev/null +++ b/third_party/rust/winapi/src/d3d11.rs @@ -0,0 +1,2665 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +use super::*; +pub const D3D11_16BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xffff; +pub const D3D11_32BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xffffffff; +pub const D3D11_8BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xff; +pub const D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT: DWORD = 9; +pub const D3D11_CLIP_OR_CULL_DISTANCE_COUNT: DWORD = 8; +pub const D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT: DWORD = 2; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT: DWORD = 14; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT: DWORD = 15; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT: DWORD = 16; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT: DWORD = 15; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT: DWORD = 64; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT: DWORD = 1; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT: DWORD = 128; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT: DWORD = 128; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT: DWORD = 16; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT: DWORD = 16; +pub const D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT: DWORD = 32; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_COUNT: DWORD = 4096; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST: DWORD = 3; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS: DWORD = 3; +pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX: DWORD = 10; +pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN: c_long = -10; +pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE: c_long = -8; +pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE: DWORD = 7; +pub const D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 256; +pub const D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP: DWORD = 64; +pub const D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 240; +pub const D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP: DWORD = 68; +pub const D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 224; +pub const D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP: DWORD = 72; +pub const D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 208; +pub const D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP: DWORD = 76; +pub const D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 192; +pub const D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP: DWORD = 84; +pub const D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 176; +pub const D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP: DWORD = 92; +pub const D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 160; +pub const D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP: DWORD = 100; +pub const D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 144; +pub const D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP: DWORD = 112; +pub const D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 128; +pub const D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP: DWORD = 128; +pub const D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 112; +pub const D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP: DWORD = 144; +pub const D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 96; +pub const D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP: DWORD = 168; +pub const D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 80; +pub const D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP: DWORD = 204; +pub const D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 64; +pub const D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP: DWORD = 256; +pub const D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 48; +pub const D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP: DWORD = 340; +pub const D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 32; +pub const D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP: DWORD = 512; +pub const D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 16; +pub const D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP: DWORD = 768; +pub const D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION: DWORD = 1; +pub const D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT: DWORD = 256; +pub const D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP: DWORD = 768; +pub const D3D11_CS_4_X_THREAD_GROUP_MAX_X: DWORD = 768; +pub const D3D11_CS_4_X_THREAD_GROUP_MAX_Y: DWORD = 768; +pub const D3D11_CS_4_X_UAV_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION: DWORD = 65535; +pub const D3D11_CS_TGSM_REGISTER_COUNT: DWORD = 8192; +pub const D3D11_CS_TGSM_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_CS_THREADGROUPID_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_CS_THREADGROUPID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREADIDINGROUP_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_CS_THREADIDINGROUP_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREADID_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_CS_THREADID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP: DWORD = 1024; +pub const D3D11_CS_THREAD_GROUP_MAX_X: DWORD = 1024; +pub const D3D11_CS_THREAD_GROUP_MAX_Y: DWORD = 1024; +pub const D3D11_CS_THREAD_GROUP_MAX_Z: DWORD = 64; +pub const D3D11_CS_THREAD_GROUP_MIN_X: DWORD = 1; +pub const D3D11_CS_THREAD_GROUP_MIN_Y: DWORD = 1; +pub const D3D11_CS_THREAD_GROUP_MIN_Z: DWORD = 1; +pub const D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL: DWORD = 16384; +pub const D3D11_DEFAULT_BLEND_FACTOR_ALPHA: FLOAT = 1.0; +pub const D3D11_DEFAULT_BLEND_FACTOR_BLUE: FLOAT = 1.0; +pub const D3D11_DEFAULT_BLEND_FACTOR_GREEN: FLOAT = 1.0; +pub const D3D11_DEFAULT_BLEND_FACTOR_RED: FLOAT = 1.0; +pub const D3D11_DEFAULT_BORDER_COLOR_COMPONENT: FLOAT = 0.0; +pub const D3D11_DEFAULT_DEPTH_BIAS: DWORD = 0; +pub const D3D11_DEFAULT_DEPTH_BIAS_CLAMP: FLOAT = 0.0; +pub const D3D11_DEFAULT_MAX_ANISOTROPY: DWORD = 16; +pub const D3D11_DEFAULT_MIP_LOD_BIAS: FLOAT = 0.0; +pub const D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX: DWORD = 0; +pub const D3D11_DEFAULT_SAMPLE_MASK: DWORD = 0xffffffff; +pub const D3D11_DEFAULT_SCISSOR_ENDX: DWORD = 0; +pub const D3D11_DEFAULT_SCISSOR_ENDY: DWORD = 0; +pub const D3D11_DEFAULT_SCISSOR_STARTX: DWORD = 0; +pub const D3D11_DEFAULT_SCISSOR_STARTY: DWORD = 0; +pub const D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS: FLOAT = 0.0; +pub const D3D11_DEFAULT_STENCIL_READ_MASK: DWORD = 0xff; +pub const D3D11_DEFAULT_STENCIL_REFERENCE: DWORD = 0; +pub const D3D11_DEFAULT_STENCIL_WRITE_MASK: DWORD = 0xff; +pub const D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_HEIGHT: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_MAX_DEPTH: FLOAT = 0.0; +pub const D3D11_DEFAULT_VIEWPORT_MIN_DEPTH: FLOAT = 0.0; +pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTX: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTY: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_WIDTH: DWORD = 0; +pub const D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: DWORD = 3968; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT: DWORD = 1; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP: FLOAT = 0.6; +pub const D3D11_FLOAT32_MAX: FLOAT = 3.402823466E+38; +pub const D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP: FLOAT = 0.6; +pub const D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR: FLOAT = 2.4; +pub const D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR: FLOAT = 1.0; +pub const D3D11_FLOAT_TO_SRGB_OFFSET: FLOAT = 0.055; +pub const D3D11_FLOAT_TO_SRGB_SCALE_1: FLOAT = 12.92; +pub const D3D11_FLOAT_TO_SRGB_SCALE_2: FLOAT = 1.055; +pub const D3D11_FLOAT_TO_SRGB_THRESHOLD: FLOAT = 0.0031308; +pub const D3D11_FTOI_INSTRUCTION_MAX_INPUT: FLOAT = 2147483647.999; +pub const D3D11_FTOI_INSTRUCTION_MIN_INPUT: FLOAT = -2147483648.999; +pub const D3D11_FTOU_INSTRUCTION_MAX_INPUT: FLOAT = 4294967295.999; +pub const D3D11_FTOU_INSTRUCTION_MIN_INPUT: FLOAT = 0.0; +pub const D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST: DWORD = 2; +pub const D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS: DWORD = 1; +pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT: DWORD = 1; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_GS_INPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_GS_INPUT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_GS_INPUT_REGISTER_VERTICES: DWORD = 32; +pub const D3D11_GS_MAX_INSTANCE_COUNT: DWORD = 32; +pub const D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES: DWORD = 1024; +pub const D3D11_GS_OUTPUT_ELEMENTS: DWORD = 32; +pub const D3D11_GS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND: DWORD = 0xffffffff; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND: DWORD = 0xffffffff; +pub const D3D11_HS_MAXTESSFACTOR_LOWER_BOUND: FLOAT = 1.0; +pub const D3D11_HS_MAXTESSFACTOR_UPPER_BOUND: FLOAT = 64.0; +pub const D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: DWORD = 3968; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS: DWORD = 128; +pub const D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES: DWORD = 0; +pub const D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY: DWORD = 0; +pub const D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES: DWORD = 0; +pub const D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT: DWORD = 1; +pub const D3D11_IA_INSTANCE_ID_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT: DWORD = 32; +pub const D3D11_IA_PRIMITIVE_ID_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_VERTEX_ID_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT: DWORD = 32; +pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS: DWORD = 128; +pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT: DWORD = 32; +pub const D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT: DWORD = 0xffffffff; +pub const D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER: DWORD = 0xffffffff; +pub const D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL: DWORD = 0xffffffff; +pub const D3D11_KEEP_UNORDERED_ACCESS_VIEWS: DWORD = 0xffffffff; +pub const D3D11_LINEAR_GAMMA: FLOAT = 1.0; +pub const D3D11_MAJOR_VERSION: DWORD = 11; +pub const D3D11_MAX_BORDER_COLOR_COMPONENT: FLOAT = 1.0; +pub const D3D11_MAX_DEPTH: FLOAT = 1.0; +pub const D3D11_MAX_MAXANISOTROPY: DWORD = 16; +pub const D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT: DWORD = 32; +pub const D3D11_MAX_POSITION_VALUE: FLOAT = 3.402823466E+34; +pub const D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP: DWORD = 17; +pub const D3D11_MINOR_VERSION: DWORD = 0; +pub const D3D11_MIN_BORDER_COLOR_COMPONENT: FLOAT = 0.0; +pub const D3D11_MIN_DEPTH: FLOAT = 0.0; +pub const D3D11_MIN_MAXANISOTROPY: DWORD = 0; +pub const D3D11_MIP_LOD_BIAS_MAX: FLOAT = 15.99; +pub const D3D11_MIP_LOD_BIAS_MIN: FLOAT = -16.0; +pub const D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT: DWORD = 8; +pub const D3D11_MIP_LOD_RANGE_BIT_COUNT: DWORD = 8; +pub const D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH: FLOAT = 1.4; +pub const D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT: DWORD = 0; +pub const D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 15; +pub const D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 16; +pub const D3D11_PS_CS_UAV_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_PS_CS_UAV_REGISTER_COUNT: DWORD = 8; +pub const D3D11_PS_CS_UAV_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_PS_CS_UAV_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_PS_FRONTFACING_DEFAULT_VALUE: DWORD = 0xffffffff; +pub const D3D11_PS_FRONTFACING_FALSE_VALUE: DWORD = 0; +pub const D3D11_PS_FRONTFACING_TRUE_VALUE: DWORD = 0xffffffff; +pub const D3D11_PS_INPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_PS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_PS_INPUT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.0; +pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT: DWORD = 1; +pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_OUTPUT_MASK_REGISTER_COUNT: DWORD = 1; +pub const D3D11_PS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_OUTPUT_REGISTER_COUNT: DWORD = 8; +pub const D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.5; +pub const D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT: DWORD = 16; +pub const D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP: DWORD = 27; +pub const D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT: DWORD = 4096; +pub const D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: DWORD = 32; +pub const D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP: DWORD = 32; +pub const D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION: DWORD = 16384; +pub const D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT: DWORD = 1024; +pub const D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT: DWORD = 4096; +pub const D3D11_REQ_MAXANISOTROPY: DWORD = 16; +pub const D3D11_REQ_MIP_LEVELS: DWORD = 15; +pub const D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES: DWORD = 2048; +pub const D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH: DWORD = 16384; +pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM: DWORD = 128; +pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM: FLOAT = 0.25; +pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM: DWORD = 2048; +pub const D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP: DWORD = 20; +pub const D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION: DWORD = 2048; +pub const D3D11_REQ_TEXTURE1D_U_DIMENSION: DWORD = 16384; +pub const D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION: DWORD = 2048; +pub const D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION: DWORD = 16384; +pub const D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION: DWORD = 2048; +pub const D3D11_REQ_TEXTURECUBE_DIMENSION: DWORD = 16384; +pub const D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL: DWORD = 0; +pub const D3D11_SHADER_MAJOR_VERSION: DWORD = 5; +pub const D3D11_SHADER_MAX_INSTANCES: DWORD = 65535; +pub const D3D11_SHADER_MAX_INTERFACES: DWORD = 253; +pub const D3D11_SHADER_MAX_INTERFACE_CALL_SITES: DWORD = 4096; +pub const D3D11_SHADER_MAX_TYPES: DWORD = 65535; +pub const D3D11_SHADER_MINOR_VERSION: DWORD = 0; +pub const D3D11_SHIFT_INSTRUCTION_PAD_VALUE: DWORD = 0; +pub const D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT: DWORD = 5; +pub const D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT: DWORD = 8; +pub const D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES: DWORD = 2048; +pub const D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES: DWORD = 512; +pub const D3D11_SO_BUFFER_SLOT_COUNT: DWORD = 4; +pub const D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP: DWORD = 0xffffffff; +pub const D3D11_SO_NO_RASTERIZED_STREAM: DWORD = 0xffffffff; +pub const D3D11_SO_OUTPUT_COMPONENT_COUNT: DWORD = 128; +pub const D3D11_SO_STREAM_COUNT: DWORD = 4; +pub const D3D11_SPEC_DATE_DAY: DWORD = 16; +pub const D3D11_SPEC_DATE_MONTH: DWORD = 05; +pub const D3D11_SPEC_DATE_YEAR: DWORD = 2011; +pub const D3D11_SPEC_VERSION: FLOAT = 1.07; +pub const D3D11_SRGB_GAMMA: FLOAT = 2.2; +pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_1: FLOAT = 12.92; +pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_2: FLOAT = 1.055; +pub const D3D11_SRGB_TO_FLOAT_EXPONENT: FLOAT = 2.4; +pub const D3D11_SRGB_TO_FLOAT_OFFSET: FLOAT = 0.055; +pub const D3D11_SRGB_TO_FLOAT_THRESHOLD: FLOAT = 0.04045; +pub const D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP: FLOAT = 0.5; +pub const D3D11_STANDARD_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED: DWORD = 64; +pub const D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE: DWORD = 4; +pub const D3D11_STANDARD_PIXEL_COMPONENT_COUNT: DWORD = 128; +pub const D3D11_STANDARD_PIXEL_ELEMENT_COUNT: DWORD = 32; +pub const D3D11_STANDARD_VECTOR_SIZE: DWORD = 4; +pub const D3D11_STANDARD_VERTEX_ELEMENT_COUNT: DWORD = 32; +pub const D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT: DWORD = 64; +pub const D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT: DWORD = 8; +pub const D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT: DWORD = 8; +pub const D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR: DWORD = 64; +pub const D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR: DWORD = 64; +pub const D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR: DWORD = 63; +pub const D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR: DWORD = 64; +pub const D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR: DWORD = 2; +pub const D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR: DWORD = 1; +pub const D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR: DWORD = 1; +pub const D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 16; +pub const D3D11_UNBOUND_MEMORY_ACCESS_RESULT: DWORD = 0; +pub const D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX: DWORD = 15; +pub const D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE: DWORD = 16; +pub const D3D11_VIEWPORT_BOUNDS_MAX: DWORD = 32767; +pub const D3D11_VIEWPORT_BOUNDS_MIN: c_long = -32768; +pub const D3D11_VS_INPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_VS_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_VS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_VS_INPUT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_VS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_VS_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT: DWORD = 10; +pub const D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: DWORD = 25; +pub const D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP: DWORD = 25; +pub const D3D11_1_UAV_SLOT_COUNT: DWORD = 64; +pub const D3D11_2_TILED_RESOURCE_TILE_SIZE_IN_BYTES: DWORD = 65536; +ENUM!{enum D3D11_INPUT_CLASSIFICATION { + D3D11_INPUT_PER_VERTEX_DATA = 0, + D3D11_INPUT_PER_INSTANCE_DATA = 1, +}} +pub const D3D11_APPEND_ALIGNED_ELEMENT: DWORD = 0xffffffff; +STRUCT!{struct D3D11_INPUT_ELEMENT_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Format: DXGI_FORMAT, + InputSlot: UINT, + AlignedByteOffset: UINT, + InputSlotClass: D3D11_INPUT_CLASSIFICATION, + InstanceDataStepRate: UINT, +}} +ENUM!{enum D3D11_FILL_MODE { + D3D11_FILL_WIREFRAME = 2, + D3D11_FILL_SOLID = 3, +}} +pub type D3D11_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY; +pub type D3D11_PRIMITIVE = D3D_PRIMITIVE; +ENUM!{enum D3D11_CULL_MODE { + D3D11_CULL_NONE = 1, + D3D11_CULL_FRONT = 2, + D3D11_CULL_BACK = 3, +}} +STRUCT!{struct D3D11_SO_DECLARATION_ENTRY { + Stream: UINT, + SemanticName: LPCSTR, + SemanticIndex: UINT, + StartComponent: BYTE, + ComponentCount: BYTE, + OutputSlot: BYTE, +}} +STRUCT!{struct D3D11_VIEWPORT { + TopLeftX: FLOAT, + TopLeftY: FLOAT, + Width: FLOAT, + Height: FLOAT, + MinDepth: FLOAT, + MaxDepth: FLOAT, +}} +STRUCT!{struct D3D11_DRAW_INSTANCED_INDIRECT_ARGS { + VertexCountPerInstance: UINT, + InstanceCount: UINT, + StartVertexLocation: UINT, + StartInstanceLocation: UINT, +}} +STRUCT!{struct D3D11_DRAW_INDEXED_INSTANCED_INDIRECT_ARGS { + IndexCountPerInstance: UINT, + InstanceCount: UINT, + StartIndexLocation: UINT, + BaseVertexLocation: INT, + StartInstanceLocation: UINT, +}} +ENUM!{enum D3D11_RESOURCE_DIMENSION { + D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D11_RESOURCE_DIMENSION_BUFFER = 1, + D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4, +}} +pub type D3D11_SRV_DIMENSION = D3D_SRV_DIMENSION; +ENUM!{enum D3D11_DSV_DIMENSION { + D3D11_DSV_DIMENSION_UNKNOWN = 0, + D3D11_DSV_DIMENSION_TEXTURE1D = 1, + D3D11_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D11_DSV_DIMENSION_TEXTURE2D = 3, + D3D11_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D11_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, +}} +ENUM!{enum D3D11_RTV_DIMENSION { + D3D11_RTV_DIMENSION_UNKNOWN = 0, + D3D11_RTV_DIMENSION_BUFFER = 1, + D3D11_RTV_DIMENSION_TEXTURE1D = 2, + D3D11_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D11_RTV_DIMENSION_TEXTURE2D = 4, + D3D11_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D11_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D11_RTV_DIMENSION_TEXTURE3D = 8, +}} +ENUM!{enum D3D11_UAV_DIMENSION { + D3D11_UAV_DIMENSION_UNKNOWN = 0, + D3D11_UAV_DIMENSION_BUFFER = 1, + D3D11_UAV_DIMENSION_TEXTURE1D = 2, + D3D11_UAV_DIMENSION_TEXTURE1DARRAY = 3, + D3D11_UAV_DIMENSION_TEXTURE2D = 4, + D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5, + D3D11_UAV_DIMENSION_TEXTURE3D = 8, +}} +ENUM!{enum D3D11_USAGE { + D3D11_USAGE_DEFAULT = 0, + D3D11_USAGE_IMMUTABLE = 1, + D3D11_USAGE_DYNAMIC = 2, + D3D11_USAGE_STAGING = 3, +}} +FLAGS!{enum D3D11_BIND_FLAG { + D3D11_BIND_VERTEX_BUFFER = 0x1, + D3D11_BIND_INDEX_BUFFER = 0x2, + D3D11_BIND_CONSTANT_BUFFER = 0x4, + D3D11_BIND_SHADER_RESOURCE = 0x8, + D3D11_BIND_STREAM_OUTPUT = 0x10, + D3D11_BIND_RENDER_TARGET = 0x20, + D3D11_BIND_DEPTH_STENCIL = 0x40, + D3D11_BIND_UNORDERED_ACCESS = 0x80, + D3D11_BIND_DECODER = 0x200, + D3D11_BIND_VIDEO_ENCODER = 0x400, +}} +FLAGS!{enum D3D11_CPU_ACCESS_FLAG { + D3D11_CPU_ACCESS_WRITE = 0x10000, + D3D11_CPU_ACCESS_READ = 0x20000, +}} +FLAGS!{enum D3D11_RESOURCE_MISC_FLAG { + D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1, + D3D11_RESOURCE_MISC_SHARED = 0x2, + D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4, + D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10, + D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20, + D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40, + D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80, + D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100, + D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200, + D3D11_RESOURCE_MISC_SHARED_NTHANDLE = 0x800, + D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = 0x1000, + D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = 0x2000, + D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER = 0x4000, + D3D11_RESOURCE_MISC_GUARDED = 0x8000, + D3D11_RESOURCE_MISC_TILE_POOL = 0x20000, + D3D11_RESOURCE_MISC_TILED = 0x40000, + D3D11_RESOURCE_MISC_HW_PROTECTED = 0x80000, +}} +ENUM!{enum D3D11_MAP { + D3D11_MAP_READ = 1, + D3D11_MAP_WRITE = 2, + D3D11_MAP_READ_WRITE = 3, + D3D11_MAP_WRITE_DISCARD = 4, + D3D11_MAP_WRITE_NO_OVERWRITE = 5, +}} +FLAGS!{enum D3D11_MAP_FLAG { + D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000, +}} +FLAGS!{enum D3D11_RAISE_FLAG { + D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1, +}} +FLAGS!{enum D3D11_CLEAR_FLAG { + D3D11_CLEAR_DEPTH = 0x1, + D3D11_CLEAR_STENCIL = 0x2, +}} +pub type D3D11_RECT = RECT; +STRUCT!{struct D3D11_BOX { + left: UINT, + top: UINT, + front: UINT, + right: UINT, + bottom: UINT, + back: UINT, +}} +RIDL!{interface ID3D11DeviceChild(ID3D11DeviceChildVtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut ID3D11Device) -> (), + fn GetPrivateData( + &mut self, guid: REFGUID, pDataSize: *mut UINT, pData: *mut c_void + ) -> HRESULT, + fn SetPrivateData( + &mut self, guid: REFGUID, DataSize: UINT, pData: *const c_void + ) -> HRESULT, + fn SetPrivateDataInterface(&mut self, guid: REFGUID, pData: *const IUnknown) -> HRESULT +}} +ENUM!{enum D3D11_COMPARISON_FUNC { + D3D11_COMPARISON_NEVER = 1, + D3D11_COMPARISON_LESS = 2, + D3D11_COMPARISON_EQUAL = 3, + D3D11_COMPARISON_LESS_EQUAL = 4, + D3D11_COMPARISON_GREATER = 5, + D3D11_COMPARISON_NOT_EQUAL = 6, + D3D11_COMPARISON_GREATER_EQUAL = 7, + D3D11_COMPARISON_ALWAYS = 8, +}} +ENUM!{enum D3D11_DEPTH_WRITE_MASK { + D3D11_DEPTH_WRITE_MASK_ZERO = 0, + D3D11_DEPTH_WRITE_MASK_ALL = 1, +}} +ENUM!{enum D3D11_STENCIL_OP { + D3D11_STENCIL_OP_KEEP = 1, + D3D11_STENCIL_OP_ZERO = 2, + D3D11_STENCIL_OP_REPLACE = 3, + D3D11_STENCIL_OP_INCR_SAT = 4, + D3D11_STENCIL_OP_DECR_SAT = 5, + D3D11_STENCIL_OP_INVERT = 6, + D3D11_STENCIL_OP_INCR = 7, + D3D11_STENCIL_OP_DECR = 8, +}} +STRUCT!{struct D3D11_DEPTH_STENCILOP_DESC { + StencilFailOp: D3D11_STENCIL_OP, + StencilDepthFailOp: D3D11_STENCIL_OP, + StencilPassOp: D3D11_STENCIL_OP, + StencilFunc: D3D11_COMPARISON_FUNC, +}} +STRUCT!{struct D3D11_DEPTH_STENCIL_DESC { + DepthEnable: BOOL, + DepthWriteMask: D3D11_DEPTH_WRITE_MASK, + DepthFunc: D3D11_COMPARISON_FUNC, + StencilEnable: BOOL, + StencilReadMask: UINT8, + StencilWriteMask: UINT8, + FrontFace: D3D11_DEPTH_STENCILOP_DESC, + BackFace: D3D11_DEPTH_STENCILOP_DESC, +}} +RIDL!{interface ID3D11DepthStencilState(ID3D11DepthStencilStateVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_DEPTH_STENCIL_DESC) -> () +}} +ENUM!{enum D3D11_BLEND { + D3D11_BLEND_ZERO = 1, + D3D11_BLEND_ONE = 2, + D3D11_BLEND_SRC_COLOR = 3, + D3D11_BLEND_INV_SRC_COLOR = 4, + D3D11_BLEND_SRC_ALPHA = 5, + D3D11_BLEND_INV_SRC_ALPHA = 6, + D3D11_BLEND_DEST_ALPHA = 7, + D3D11_BLEND_INV_DEST_ALPHA = 8, + D3D11_BLEND_DEST_COLOR = 9, + D3D11_BLEND_INV_DEST_COLOR = 10, + D3D11_BLEND_SRC_ALPHA_SAT = 11, + D3D11_BLEND_BLEND_FACTOR = 14, + D3D11_BLEND_INV_BLEND_FACTOR = 15, + D3D11_BLEND_SRC1_COLOR = 16, + D3D11_BLEND_INV_SRC1_COLOR = 17, + D3D11_BLEND_SRC1_ALPHA = 18, + D3D11_BLEND_INV_SRC1_ALPHA = 19, +}} +ENUM!{enum D3D11_BLEND_OP { + D3D11_BLEND_OP_ADD = 1, + D3D11_BLEND_OP_SUBTRACT = 2, + D3D11_BLEND_OP_REV_SUBTRACT = 3, + D3D11_BLEND_OP_MIN = 4, + D3D11_BLEND_OP_MAX = 5, +}} +FLAGS!{enum D3D11_COLOR_WRITE_ENABLE { + D3D11_COLOR_WRITE_ENABLE_RED = 1, + D3D11_COLOR_WRITE_ENABLE_GREEN = 2, + D3D11_COLOR_WRITE_ENABLE_BLUE = 4, + D3D11_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D11_COLOR_WRITE_ENABLE_ALL = D3D11_COLOR_WRITE_ENABLE_RED.0 | D3D11_COLOR_WRITE_ENABLE_GREEN.0 | + D3D11_COLOR_WRITE_ENABLE_BLUE.0 | D3D11_COLOR_WRITE_ENABLE_ALPHA.0, +}} +STRUCT!{struct D3D11_RENDER_TARGET_BLEND_DESC { + BlendEnable: BOOL, + SrcBlend: D3D11_BLEND, + DestBlend: D3D11_BLEND, + BlendOp: D3D11_BLEND_OP, + SrcBlendAlpha: D3D11_BLEND, + DestBlendAlpha: D3D11_BLEND, + BlendOpAlpha: D3D11_BLEND_OP, + RenderTargetWriteMask: UINT8, +}} +STRUCT!{struct D3D11_BLEND_DESC { + AlphaToCoverageEnable: BOOL, + IndependentBlendEnable: BOOL, + RenderTarget: [D3D11_RENDER_TARGET_BLEND_DESC; 8], +}} +RIDL!{interface ID3D11BlendState(ID3D11BlendStateVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_BLEND_DESC) -> () +}} +STRUCT!{struct D3D11_RASTERIZER_DESC { + FillMode: D3D11_FILL_MODE, + CullMode: D3D11_CULL_MODE, + FrontCounterClockwise: BOOL, + DepthBias: INT, + DepthBiasClamp: FLOAT, + SlopeScaledDepthBias: FLOAT, + DepthClipEnable: BOOL, + ScissorEnable: BOOL, + MultisampleEnable: BOOL, + AntialiasedLineEnable: BOOL, +}} +RIDL!{interface ID3D11RasterizerState(ID3D11RasterizerStateVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_RASTERIZER_DESC) -> () +}} +STRUCT!{struct D3D11_SUBRESOURCE_DATA { + pSysMem: *const c_void, + SysMemPitch: UINT, + SysMemSlicePitch: UINT, +}} +STRUCT!{struct D3D11_MAPPED_SUBRESOURCE { + pData: *mut c_void, + RowPitch: UINT, + DepthPitch: UINT, +}} +RIDL!{interface ID3D11Resource(ID3D11ResourceVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetType(&mut self, pResourceDimension: *mut D3D11_RESOURCE_DIMENSION) -> (), + fn SetEvictionPriority(&mut self, EvictionPriority: UINT) -> (), + fn GetEvictionPriority(&mut self) -> UINT +}} +STRUCT!{struct D3D11_BUFFER_DESC { + ByteWidth: UINT, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, + StructureByteStride: UINT, +}} +RIDL!{interface ID3D11Buffer(ID3D11BufferVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_BUFFER_DESC) -> () +}} +STRUCT!{struct D3D11_TEXTURE1D_DESC { + Width: UINT, + MipLevels: UINT, + ArraySize: UINT, + Format: DXGI_FORMAT, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, +}} +RIDL!{interface ID3D11Texture1D(ID3D11Texture1DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_TEXTURE1D_DESC) -> () +}} +STRUCT!{struct D3D11_TEXTURE2D_DESC { + Width: UINT, + Height: UINT, + MipLevels: UINT, + ArraySize: UINT, + Format: DXGI_FORMAT, + SampleDesc: DXGI_SAMPLE_DESC, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, +}} +RIDL!{interface ID3D11Texture2D(ID3D11Texture2DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_TEXTURE2D_DESC) -> () +}} +STRUCT!{struct D3D11_TEXTURE3D_DESC { + Width: UINT, + Height: UINT, + Depth: UINT, + MipLevels: UINT, + Format: DXGI_FORMAT, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, +}} +RIDL!{interface ID3D11Texture3D(ID3D11Texture3DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_TEXTURE3D_DESC) -> () +}} +ENUM!{enum D3D11_TEXTURECUBE_FACE { + D3D11_TEXTURECUBE_FACE_POSITIVE_X = 0, + D3D11_TEXTURECUBE_FACE_NEGATIVE_X = 1, + D3D11_TEXTURECUBE_FACE_POSITIVE_Y = 2, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Y = 3, + D3D11_TEXTURECUBE_FACE_POSITIVE_Z = 4, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Z = 5, +}} +RIDL!{interface ID3D11View(ID3D11ViewVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetResource(&mut self, ppResource: *mut *mut ID3D11Resource) -> () +}} +STRUCT!{struct D3D11_BUFFER_SRV { + u1: UINT, + u2: UINT, +}} +UNION!{D3D11_BUFFER_SRV, u1, FirstElement, FirstElement_mut, UINT} +UNION!{D3D11_BUFFER_SRV, u1, ElementOffset, ElementOffset_mut, UINT} +UNION!{D3D11_BUFFER_SRV, u2, NumElements, NumElements_mut, UINT} +UNION!{D3D11_BUFFER_SRV, u2, ElementWidth, ElementWidth_mut, UINT} +FLAGS!{enum D3D11_BUFFEREX_SRV_FLAG { + D3D11_BUFFEREX_SRV_FLAG_RAW = 0x1, +}} +STRUCT!{struct D3D11_BUFFEREX_SRV { + FirstElement: UINT, + NumElements: UINT, + Flags: UINT, +}} +STRUCT!{struct D3D11_TEX1D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX3D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEXCUBE_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEXCUBE_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + First2DArrayFace: UINT, + NumCubes: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_SRV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_ARRAY_SRV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_SHADER_RESOURCE_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_SRV_DIMENSION, + u: [UINT; 4], +}} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Buffer, Buffer_mut, D3D11_BUFFER_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + D3D11_TEX1D_ARRAY_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + D3D11_TEX2D_ARRAY_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, D3D11_TEX2DMS_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, + D3D11_TEX2DMS_ARRAY_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture3D, Texture3D_mut, D3D11_TEX3D_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, TextureCube, TextureCube_mut, D3D11_TEXCUBE_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, TextureCubeArray, TextureCubeArray_mut, + D3D11_TEXCUBE_ARRAY_SRV} +UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, BufferEx, BufferEx_mut, D3D11_BUFFEREX_SRV} +RIDL!{interface ID3D11ShaderResourceView(ID3D11ShaderResourceViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_RESOURCE_VIEW_DESC) -> () +}} +STRUCT!{struct D3D11_BUFFER_RTV { + u1: UINT, + u2: UINT, +}} +UNION!{D3D11_BUFFER_RTV, u1, FirstElement, FirstElement_mut, UINT} +UNION!{D3D11_BUFFER_RTV, u1, ElementOffset, ElementOffset_mut, UINT} +UNION!{D3D11_BUFFER_RTV, u2, NumElements, NumElements_mut, UINT} +UNION!{D3D11_BUFFER_RTV, u2, ElementWidth, ElementWidth_mut, UINT} +STRUCT!{struct D3D11_TEX1D_RTV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_RTV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_RTV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_RTV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_RTV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_ARRAY_RTV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX3D_RTV { + MipSlice: UINT, + FirstWSlice: UINT, + WSize: UINT, +}} +STRUCT!{struct D3D11_RENDER_TARGET_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_RTV_DIMENSION, + u: [UINT; 3], +}} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Buffer, Buffer_mut, D3D11_BUFFER_RTV} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_RTV} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + D3D11_TEX1D_ARRAY_RTV} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_RTV} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + D3D11_TEX2D_ARRAY_RTV} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, D3D11_TEX2DMS_RTV} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2DMSArray,Texture2DMSArray_mut, + D3D11_TEX2DMS_ARRAY_RTV} +UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture3D, Texture3D_mut, D3D11_TEX3D_RTV} +RIDL!{interface ID3D11RenderTargetView(ID3D11RenderTargetViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_RENDER_TARGET_VIEW_DESC) -> () +}} +STRUCT!{struct D3D11_TEX1D_DSV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_DSV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_DSV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_DSV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_DSV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_ARRAY_DSV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +FLAGS!{enum D3D11_DSV_FLAG{ + D3D11_DSV_READ_ONLY_DEPTH = 0x1, + D3D11_DSV_READ_ONLY_STENCIL = 0x2, +}} +STRUCT!{struct D3D11_DEPTH_STENCIL_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_DSV_DIMENSION, + Flags: UINT, + u: [UINT; 3], +}} +UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_DSV} +UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + D3D11_TEX1D_ARRAY_DSV} +UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_DSV} +UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + D3D11_TEX2D_ARRAY_DSV} +UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, D3D11_TEX2DMS_DSV} +UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, + D3D11_TEX2DMS_ARRAY_DSV} +RIDL!{interface ID3D11DepthStencilView(ID3D11DepthStencilViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_DEPTH_STENCIL_VIEW_DESC) -> () +}} +FLAGS!{enum D3D11_BUFFER_UAV_FLAG { + D3D11_BUFFER_UAV_FLAG_RAW = 0x1, + D3D11_BUFFER_UAV_FLAG_APPEND = 0x2, + D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4, +}} +STRUCT!{struct D3D11_BUFFER_UAV { + FirstElement: UINT, + NumElements: UINT, + Flags: UINT, +}} +STRUCT!{struct D3D11_TEX1D_UAV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_UAV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_UAV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_UAV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX3D_UAV { + MipSlice: UINT, + FirstWSlice: UINT, + WSize: UINT, +}} +STRUCT!{struct D3D11_UNORDERED_ACCESS_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_UAV_DIMENSION, + u: [UINT; 3], +}} +UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Buffer, Buffer_mut, D3D11_BUFFER_UAV} +UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_UAV} +UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + D3D11_TEX1D_ARRAY_UAV} +UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_UAV} +UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + D3D11_TEX2D_ARRAY_UAV} +UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture3D, Texture3D_mut, D3D11_TEX3D_UAV} +RIDL!{interface ID3D11UnorderedAccessView(ID3D11UnorderedAccessViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_UNORDERED_ACCESS_VIEW_DESC) -> () +}} +RIDL!{interface ID3D11VertexShader(ID3D11VertexShaderVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{interface ID3D11HullShader(ID3D11HullShaderVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{interface ID3D11DomainShader(ID3D11DomainShaderVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{interface ID3D11GeometryShader(ID3D11GeometryShaderVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{interface ID3D11PixelShader(ID3D11PixelShaderVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{interface ID3D11ComputeShader(ID3D11ComputeShaderVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{interface ID3D11InputLayout(ID3D11InputLayoutVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +ENUM!{enum D3D11_FILTER { + D3D11_FILTER_MIN_MAG_MIP_POINT = 0, + D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D11_FILTER_ANISOTROPIC = 0x55, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D11_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100, + D3D11_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101, + D3D11_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104, + D3D11_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105, + D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110, + D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111, + D3D11_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114, + D3D11_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115, + D3D11_FILTER_MINIMUM_ANISOTROPIC = 0x155, + D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180, + D3D11_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181, + D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184, + D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185, + D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190, + D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191, + D3D11_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194, + D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, + D3D11_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5, +}} +ENUM!{enum D3D11_FILTER_TYPE { + D3D11_FILTER_TYPE_POINT = 0, + D3D11_FILTER_TYPE_LINEAR = 1, +}} +ENUM!{enum D3D11_FILTER_REDUCTION_TYPE { + D3D11_FILTER_REDUCTION_TYPE_STANDARD = 0, + D3D11_FILTER_REDUCTION_TYPE_COMPARISON = 1, + D3D11_FILTER_REDUCTION_TYPE_MINIMUM = 2, + D3D11_FILTER_REDUCTION_TYPE_MAXIMUM = 3, +}} +pub const D3D11_FILTER_REDUCTION_TYPE_MASK: DWORD = 0x3; +pub const D3D11_FILTER_REDUCTION_TYPE_SHIFT: DWORD = 7; +pub const D3D11_FILTER_TYPE_MASK: DWORD = 0x3; +pub const D3D11_MIN_FILTER_SHIFT: DWORD = 4; +pub const D3D11_MAG_FILTER_SHIFT: DWORD = 2; +pub const D3D11_MIP_FILTER_SHIFT: DWORD = 0; +pub const D3D11_COMPARISON_FILTERING_BIT: DWORD = 0x80; +pub const D3D11_ANISOTROPIC_FILTERING_BIT: DWORD = 0x40; +ENUM!{enum D3D11_TEXTURE_ADDRESS_MODE { + D3D11_TEXTURE_ADDRESS_WRAP = 1, + D3D11_TEXTURE_ADDRESS_MIRROR = 2, + D3D11_TEXTURE_ADDRESS_CLAMP = 3, + D3D11_TEXTURE_ADDRESS_BORDER = 4, + D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5, +}} +STRUCT!{struct D3D11_SAMPLER_DESC { + Filter: D3D11_FILTER, + AddressU: D3D11_TEXTURE_ADDRESS_MODE, + AddressV: D3D11_TEXTURE_ADDRESS_MODE, + AddressW: D3D11_TEXTURE_ADDRESS_MODE, + MipLODBias: FLOAT, + MaxAnisotropy: UINT, + ComparisonFunc: D3D11_COMPARISON_FUNC, + BorderColor: [FLOAT; 4], + MinLOD: FLOAT, + MaxLOD: FLOAT, +}} +RIDL!{interface ID3D11SamplerState(ID3D11SamplerStateVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_SAMPLER_DESC) -> () +}} +FLAGS!{enum D3D11_FORMAT_SUPPORT { + D3D11_FORMAT_SUPPORT_BUFFER = 0x1, + D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, + D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, + D3D11_FORMAT_SUPPORT_SO_BUFFER = 0x8, + D3D11_FORMAT_SUPPORT_TEXTURE1D = 0x10, + D3D11_FORMAT_SUPPORT_TEXTURE2D = 0x20, + D3D11_FORMAT_SUPPORT_TEXTURE3D = 0x40, + D3D11_FORMAT_SUPPORT_TEXTURECUBE = 0x80, + D3D11_FORMAT_SUPPORT_SHADER_LOAD = 0x100, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D11_FORMAT_SUPPORT_MIP = 0x1000, + D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, + D3D11_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, + D3D11_FORMAT_SUPPORT_BLENDABLE = 0x8000, + D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, + D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, + D3D11_FORMAT_SUPPORT_DISPLAY = 0x80000, + D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, + D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000, + D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000, + D3D11_FORMAT_SUPPORT_DECODER_OUTPUT = 0x8000000, + D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT = 0x10000000, + D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT = 0x20000000, + D3D11_FORMAT_SUPPORT_VIDEO_ENCODER = 0x40000000, +}} +FLAGS!{enum D3D11_FORMAT_SUPPORT2 { + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, + D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, + D3D11_FORMAT_SUPPORT2_TILED = 0x200, + D3D11_FORMAT_SUPPORT2_SHAREABLE = 0x400, + D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, +}} +RIDL!{interface ID3D11Asynchronous(ID3D11AsynchronousVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDataSize(&mut self) -> UINT +}} +FLAGS!{enum D3D11_ASYNC_GETDATA_FLAG { + D3D11_ASYNC_GETDATA_DONOTFLUSH = 0x1, +}} +ENUM!{enum D3D11_QUERY { + D3D11_QUERY_EVENT = 0, + D3D11_QUERY_OCCLUSION = D3D11_QUERY_EVENT.0 + 1, + D3D11_QUERY_TIMESTAMP = D3D11_QUERY_OCCLUSION.0 + 1, + D3D11_QUERY_TIMESTAMP_DISJOINT = D3D11_QUERY_TIMESTAMP.0 + 1, + D3D11_QUERY_PIPELINE_STATISTICS = D3D11_QUERY_TIMESTAMP_DISJOINT.0 + 1, + D3D11_QUERY_OCCLUSION_PREDICATE = D3D11_QUERY_PIPELINE_STATISTICS.0 + 1, + D3D11_QUERY_SO_STATISTICS = D3D11_QUERY_OCCLUSION_PREDICATE.0 + 1, + D3D11_QUERY_SO_OVERFLOW_PREDICATE = D3D11_QUERY_SO_STATISTICS.0 + 1, + D3D11_QUERY_SO_STATISTICS_STREAM0 = D3D11_QUERY_SO_OVERFLOW_PREDICATE.0 + 1, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = D3D11_QUERY_SO_STATISTICS_STREAM0.0 + 1, + D3D11_QUERY_SO_STATISTICS_STREAM1 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0.0 + 1, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = D3D11_QUERY_SO_STATISTICS_STREAM1.0 + 1, + D3D11_QUERY_SO_STATISTICS_STREAM2 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1.0 + 1, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = D3D11_QUERY_SO_STATISTICS_STREAM2.0 + 1, + D3D11_QUERY_SO_STATISTICS_STREAM3 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2.0 + 1, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = D3D11_QUERY_SO_STATISTICS_STREAM3.0 + 1, +}} +FLAGS!{enum D3D11_QUERY_MISC_FLAG { + D3D11_QUERY_MISC_PREDICATEHINT = 0x1, +}} +STRUCT!{struct D3D11_QUERY_DESC { + Query: D3D11_QUERY, + MiscFlags: UINT, +}} +RIDL!{interface ID3D11Query(ID3D11QueryVtbl): ID3D11Asynchronous(ID3D11AsynchronousVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_QUERY_DESC) -> () +}} +RIDL!{interface ID3D11Predicate(ID3D11PredicateVtbl): ID3D11Query(ID3D11QueryVtbl) {}} +STRUCT!{struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT { + Frequency: UINT64, + Disjoint: BOOL, +}} +STRUCT!{struct D3D11_QUERY_DATA_PIPELINE_STATISTICS { + IAVertices: UINT64, + IAPrimitives: UINT64, + VSInvocations: UINT64, + GSInvocations: UINT64, + GSPrimitives: UINT64, + CInvocations: UINT64, + CPrimitives: UINT64, + PSInvocations: UINT64, + HSInvocations: UINT64, + DSInvocations: UINT64, + CSInvocations: UINT64, +}} +STRUCT!{struct D3D11_QUERY_DATA_SO_STATISTICS { + NumPrimitivesWritten: UINT64, + PrimitivesStorageNeeded: UINT64, +}} +FLAGS!{enum D3D11_COUNTER { + D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000, +}} +ENUM!{enum D3D11_COUNTER_TYPE { + D3D11_COUNTER_TYPE_FLOAT32 = 0, + D3D11_COUNTER_TYPE_UINT16 = D3D11_COUNTER_TYPE_FLOAT32.0 + 1, + D3D11_COUNTER_TYPE_UINT32 = D3D11_COUNTER_TYPE_UINT16.0 + 1, + D3D11_COUNTER_TYPE_UINT64 = D3D11_COUNTER_TYPE_UINT32.0 + 1, +}} +STRUCT!{struct D3D11_COUNTER_DESC { + Counter: D3D11_COUNTER, + MiscFlags: UINT, +}} +STRUCT!{struct D3D11_COUNTER_INFO { + LastDeviceDependentCounter: D3D11_COUNTER, + NumSimultaneousCounters: UINT, + NumDetectableParallelUnits: UINT8, +}} +RIDL!{interface ID3D11Counter(ID3D11CounterVtbl): ID3D11Asynchronous(ID3D11AsynchronousVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_COUNTER_DESC) -> () +}} +ENUM!{enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS { + D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D11_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe, +}} +ENUM!{enum D3D11_DEVICE_CONTEXT_TYPE { + D3D11_DEVICE_CONTEXT_IMMEDIATE = 0, + D3D11_DEVICE_CONTEXT_DEFERRED = D3D11_DEVICE_CONTEXT_IMMEDIATE.0 + 1, +}} +STRUCT!{struct D3D11_CLASS_INSTANCE_DESC { + InstanceId: UINT, + InstanceIndex: UINT, + TypeId: UINT, + ConstantBuffer: UINT, + BaseConstantBufferOffset: UINT, + BaseTexture: UINT, + BaseSampler: UINT, + Created: BOOL, +}} +RIDL!{interface ID3D11ClassInstance(ID3D11ClassInstanceVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetClassLinkage(&mut self, ppLinkage: *mut *mut ID3D11ClassLinkage) -> (), + fn GetDesc(&mut self, pDesc: *mut D3D11_CLASS_INSTANCE_DESC) -> (), + fn GetInstanceName(&mut self, pInstanceName: LPSTR, pBufferLength: *mut SIZE_T) -> (), + fn GetTypeName(&mut self, pTypeName: LPSTR, pBufferLength: *mut SIZE_T) -> () +}} +RIDL!{interface ID3D11ClassLinkage(ID3D11ClassLinkageVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetClassInstance( + &mut self, GetClassInstance: LPCSTR, InstanceIndex: UINT, + ppInstance: *mut *mut ID3D11ClassInstance + ) -> HRESULT, + fn CreateClassInstance( + &mut self, pClassTypeName: LPCSTR, ConstantBufferOffset: UINT, ConstantVectorOffset: UINT, TextureOffset: UINT, SamplerOffset: UINT, ppInstance: *mut *mut ID3D11ClassInstance + ) -> HRESULT +}} +RIDL!{interface ID3D11CommandList(ID3D11CommandListVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetContextFlags(&mut self) -> UINT +}} +ENUM!{enum D3D11_FEATURE { + D3D11_FEATURE_THREADING = 0, + D3D11_FEATURE_DOUBLES = D3D11_FEATURE_THREADING.0 + 1, + D3D11_FEATURE_FORMAT_SUPPORT = D3D11_FEATURE_DOUBLES.0 + 1, + D3D11_FEATURE_FORMAT_SUPPORT2 = D3D11_FEATURE_FORMAT_SUPPORT.0 + 1, + D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = D3D11_FEATURE_FORMAT_SUPPORT2.0 + 1, + D3D11_FEATURE_D3D11_OPTIONS = D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS.0 + 1, + D3D11_FEATURE_ARCHITECTURE_INFO = D3D11_FEATURE_D3D11_OPTIONS.0 + 1, + D3D11_FEATURE_D3D9_OPTIONS = D3D11_FEATURE_ARCHITECTURE_INFO.0 + 1, + D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT = D3D11_FEATURE_D3D9_OPTIONS.0 + 1, + D3D11_FEATURE_D3D9_SHADOW_SUPPORT = D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT.0 + 1, + D3D11_FEATURE_D3D11_OPTIONS1 = D3D11_FEATURE_D3D9_SHADOW_SUPPORT.0 + 1, + D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT = D3D11_FEATURE_D3D11_OPTIONS1.0 + 1, + D3D11_FEATURE_MARKER_SUPPORT = D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT.0 + 1, + D3D11_FEATURE_D3D9_OPTIONS1 = D3D11_FEATURE_MARKER_SUPPORT.0 + 1, + D3D11_FEATURE_D3D11_OPTIONS2 = D3D11_FEATURE_D3D9_OPTIONS1.0 + 1, + D3D11_FEATURE_D3D11_OPTIONS3 = D3D11_FEATURE_D3D11_OPTIONS2.0 + 1, + D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = D3D11_FEATURE_D3D11_OPTIONS3.0 + 1, +}} +STRUCT!{struct D3D11_FEATURE_DATA_THREADING { + DriverConcurrentCreates: BOOL, + DriverCommandLists: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_DOUBLES { + DoublePrecisionFloatShaderOps: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_FORMAT_SUPPORT { + InFormat: DXGI_FORMAT, + OutFormatSupport: UINT, +}} +STRUCT!{struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 { + InFormat: DXGI_FORMAT, + OutFormatSupport2: UINT, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS { + ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS { + OutputMergerLogicOp: BOOL, + UAVOnlyRenderingForcedSampleCount: BOOL, + DiscardAPIsSeenByDriver: BOOL, + FlagsForUpdateAndCopySeenByDriver: BOOL, + ClearView: BOOL, + CopyWithOverlap: BOOL, + ConstantBufferPartialUpdate: BOOL, + ConstantBufferOffsetting: BOOL, + MapNoOverwriteOnDynamicConstantBuffer: BOOL, + MapNoOverwriteOnDynamicBufferSRV: BOOL, + MultisampleRTVWithForcedSampleCountOne: BOOL, + SAD4ShaderInstructions: BOOL, + ExtendedDoublesShaderInstructions: BOOL, + ExtendedResourceSharing: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_ARCHITECTURE_INFO { + TileBasedDeferredRenderer: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_OPTIONS { + FullNonPow2TextureSupport: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT { + SupportsDepthAsTextureWithLessEqualComparisonFilter: BOOL, +}} +FLAGS!{enum D3D11_SHADER_MIN_PRECISION_SUPPORT { + D3D11_SHADER_MIN_PRECISION_10_BIT = 0x1, + D3D11_SHADER_MIN_PRECISION_16_BIT = 0x2, +}} +STRUCT!{struct D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT { + PixelShaderMinPrecision: UINT, + AllOtherShaderStagesMinPrecision: UINT, +}} +ENUM!{enum D3D11_TILED_RESOURCES_TIER { + D3D11_TILED_RESOURCES_NOT_SUPPORTED = 0, + D3D11_TILED_RESOURCES_TIER_1 = 1, + D3D11_TILED_RESOURCES_TIER_2 = 2, + D3D11_TILED_RESOURCES_TIER_3 = 3, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS1 { + TiledResourcesTier: D3D11_TILED_RESOURCES_TIER, + MinMaxFiltering: BOOL, + ClearViewAlsoSupportsDepthOnlyFormats: BOOL, + MapOnDefaultBuffers: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT { + SimpleInstancingSupported: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_MARKER_SUPPORT { + Profile: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_OPTIONS1 { + FullNonPow2TextureSupported: BOOL, + DepthAsTextureWithLessEqualComparisonFilterSupported: BOOL, + SimpleInstancingSupported: BOOL, + TextureCubeFaceRenderTargetWithNonCubeDepthStencilSupported: BOOL, +}} +ENUM!{enum D3D11_CONSERVATIVE_RASTERIZATION_TIER { + D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED = 0, + D3D11_CONSERVATIVE_RASTERIZATION_TIER_1 = 1, + D3D11_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, + D3D11_CONSERVATIVE_RASTERIZATION_TIER_3 = 3, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS2 { + PSSpecifiedStencilRefSupported: BOOL, + TypedUAVLoadAdditionalFormats: BOOL, + ROVsSupported: BOOL, + ConservativeRasterizationTier: D3D11_CONSERVATIVE_RASTERIZATION_TIER, + TiledResourcesTier: D3D11_TILED_RESOURCES_TIER, + MapOnDefaultTextures: BOOL, + StandardSwizzle: BOOL, + UnifiedMemoryArchitecture: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS3 { + VPAndRTArrayIndexFromAnyShaderFeedingRasterizer: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT { + MaxGPUVirtualAddressBitsPerResource: UINT, + MaxGPUVirtualAddressBitsPerProcess: UINT, +}} +RIDL!{interface ID3D11DeviceContext(ID3D11DeviceContextVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn VSSetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer + ) -> (), + fn PSSetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView + ) -> (), + fn PSSetShader( + &mut self, pPixelShader: *mut ID3D11PixelShader, + ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT + ) -> (), + fn PSSetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState + ) -> (), + fn VSSetShader( + &mut self, pVertexShader: *mut ID3D11VertexShader, + ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT + ) -> (), + fn DrawIndexed( + &mut self, IndexCount: UINT, StartIndexLocation: UINT, BaseVertexLocation: INT + ) -> (), + fn Draw(&mut self, VertexCount: UINT, StartVertexLocation: UINT) -> (), + fn Map( + &mut self, pResource: *mut ID3D11Resource, Subresource: UINT, MapType: D3D11_MAP, + MapFlags: UINT, pMappedResource: *mut D3D11_MAPPED_SUBRESOURCE + ) -> HRESULT, + fn Unmap(&mut self, pResource: *mut ID3D11Resource, Subresource: UINT) -> (), + fn PSSetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer + ) -> (), + fn IASetInputLayout(&mut self, pInputLayout: *mut ID3D11InputLayout) -> (), + fn IASetVertexBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppVertexBuffers: *const *mut ID3D11Buffer, + pStrides: *const UINT, pOffsets: *const UINT + ) -> (), + fn IASetIndexBuffer( + &mut self, pIndexBuffer: *mut ID3D11Buffer, Format: DXGI_FORMAT, Offset: UINT + ) -> (), + fn DrawIndexedInstanced( + &mut self, IndexCountPerInstance: UINT, InstanceCount: UINT, StartIndexLocation: UINT, + BaseVertexLocation: INT, StartInstanceLocation: UINT + ) -> (), + fn DrawInstanced( + &mut self, VertexCountPerInstance: UINT, InstanceCount: UINT, StartVertexLocation: UINT, + StartInstanceLocation: UINT + ) -> (), + fn GSSetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer + ) -> (), + fn GSSetShader( + &mut self, pShader: *mut ID3D11GeometryShader, + ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT + ) -> (), + fn IASetPrimitiveTopology(&mut self, Topology: D3D11_PRIMITIVE_TOPOLOGY) -> (), + fn VSSetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView + ) -> (), + fn VSSetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState + ) -> (), + fn Begin(&mut self, pAsync: *mut ID3D11Asynchronous) -> (), + fn End(&mut self, pAsync: *mut ID3D11Asynchronous) -> (), + fn GetData( + &mut self, pAsync: *mut ID3D11Asynchronous, pData: *mut c_void, DataSize: UINT, + GetDataFlags: UINT + ) -> HRESULT, + fn SetPredication( + &mut self, pPredicate: *mut ID3D11Predicate, PredicateValue: BOOL + ) -> (), + fn GSSetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView + ) -> (), + fn GSSetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState + ) -> (), + fn OMSetRenderTargets( + &mut self, NumViews: UINT, ppRenderTargetViews: *const *mut ID3D11RenderTargetView, + pDepthStencilView: *mut ID3D11DepthStencilView + ) -> (), + fn OMSetRenderTargetsAndUnorderedAccessViews( + &mut self, NumRTVs: UINT, ppRenderTargetViews: *const *mut ID3D11RenderTargetView, + pDepthStencilView: *mut ID3D11DepthStencilView, UAVStartSlot: UINT, NumUAVs: UINT, + ppUnorderedAccessViews: *const *mut ID3D11UnorderedAccessView, + pUAVInitialCounts: *const UINT + ) -> (), + fn OMSetBlendState( + &mut self, pBlendState: *mut ID3D11BlendState, BlendFactor: &[FLOAT; 4], SampleMask: UINT + ) -> (), + fn OMSetDepthStencilState( + &mut self, pDepthStencilState: *mut ID3D11DepthStencilState, StencilRef: UINT + ) -> (), + fn SOSetTargets( + &mut self, NumBuffers: UINT, ppSOTargets: *const *mut ID3D11Buffer, pOffsets: *const UINT + ) -> (), + fn DrawAuto(&mut self) -> (), + fn DrawIndexedInstancedIndirect( + &mut self, pBufferForArgs: *mut ID3D11Buffer, AlignedByteOffsetForArgs: UINT + ) -> (), + fn DrawInstancedIndirect( + &mut self, pBufferForArgs: *mut ID3D11Buffer, AlignedByteOffsetForArgs: UINT + ) -> (), + fn Dispatch( + &mut self, ThreadGroupCountX: UINT, ThreadGroupCountY: UINT, ThreadGroupCountZ: UINT + ) -> (), + fn DispatchIndirect( + &mut self, pBufferForArgs: *mut ID3D11Buffer, AlignedByteOffsetForArgs: UINT + ) -> (), + fn RSSetState(&mut self, pRasterizerState: *mut ID3D11RasterizerState) -> (), + fn RSSetViewports(&mut self, NumViewports: UINT, pViewports: *const D3D11_VIEWPORT) -> (), + fn RSSetScissorRects(&mut self, NumRects: UINT, pRects: *const D3D11_RECT) -> (), + fn CopySubresourceRegion( + &mut self, pDstResource: *mut ID3D11Resource, DstSubresource: UINT, DstX: UINT, DstY: UINT, + DstZ: UINT, pSrcResource: *mut ID3D11Resource, SrcSubresource: UINT, + pSrcBox: *const D3D11_BOX + ) -> (), + fn CopyResource( + &mut self, pDstResource: *mut ID3D11Resource, pSrcResource: *mut ID3D11Resource + ) -> (), + fn UpdateSubresource( + &mut self, pDstResource: *mut ID3D11Resource, DstSubresource: UINT, + pDstBox: *const D3D11_BOX, pSrcData: *const c_void, SrcRowPitch: UINT, SrcDepthPitch: UINT + ) -> (), + fn CopyStructureCount( + &mut self, pDstBuffer: *mut ID3D11Buffer, DstAlignedByteOffset: UINT, + pSrcView: *mut ID3D11UnorderedAccessView + ) -> (), + fn ClearRenderTargetView( + &mut self, pRenderTargetView: *mut ID3D11RenderTargetView, ColorRGBA: &[FLOAT; 4] + ) -> (), + fn ClearUnorderedAccessViewUint( + &mut self, pUnorderedAccessView: *mut ID3D11UnorderedAccessView, Values: &[UINT; 4] + ) -> (), + fn ClearUnorderedAccessViewFloat( + &mut self, pUnorderedAccessView: *mut ID3D11UnorderedAccessView, Values: &[FLOAT; 4] + ) -> (), + fn ClearDepthStencilView( + &mut self, pDepthStencilView: *mut ID3D11DepthStencilView, ClearFlags: UINT, Depth: FLOAT, + Stencil: UINT8 + ) -> (), + fn GenerateMips(&mut self, pShaderResourceView: *mut ID3D11ShaderResourceView) -> (), + fn SetResourceMinLOD(&mut self, pResource: *mut ID3D11Resource, MinLOD: FLOAT) -> (), + fn GetResourceMinLOD(&mut self, pResource: *mut ID3D11Resource) -> FLOAT, + fn ResolveSubresource( + &mut self, pDstResource: *mut ID3D11Resource, DstSubresource: UINT, + pSrcResource: *mut ID3D11Resource, SrcSubresource: UINT, Format: DXGI_FORMAT + ) -> (), + fn ExecuteCommandList( + &mut self, pCommandList: *mut ID3D11CommandList, + RestoreContextState: BOOL + ) -> (), + fn HSSetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView + ) -> (), + fn HSSetShader( + &mut self, pHullShader: *mut ID3D11HullShader, + ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT + ) -> (), + fn HSSetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState + ) -> (), + fn HSSetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer + ) -> (), + fn DSSetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView + ) -> (), + fn DSSetShader( + &mut self, pDomainShader: *mut ID3D11DomainShader, + ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT + ) -> (), + fn DSSetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState + ) -> (), + fn DSSetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer + ) -> (), + fn CSSetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView + ) -> (), + fn CSSetUnorderedAccessViews( + &mut self, StartSlot: UINT, NumUAVs: UINT, + ppUnorderedAccessViews: *const *mut ID3D11UnorderedAccessView + ) -> (), + fn CSSetShader( + &mut self, pComputeShader: *mut ID3D11ComputeShader, + ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT + ) -> (), + fn CSSetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState + ) -> (), + fn CSSetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer + ) -> (), + fn VSGetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer + ) -> (), + fn PSGetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView + ) -> (), + fn PSGetShader( + &mut self, ppPixelShader: *mut *mut ID3D11PixelShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT + ) -> (), + fn PSGetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState + ) -> (), + fn VSGetShader( + &mut self, ppVertexShader: *mut *mut ID3D11VertexShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT + ) -> (), + fn PSGetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer + ) -> (), + fn IAGetInputLayout(&mut self, ppInputLayout: *mut *mut ID3D11InputLayout) -> (), + fn IAGetVertexBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppVertexBuffers: *mut *mut ID3D11Buffer, + pStrides: *mut UINT, pOffsets: *mut UINT + ) -> (), + fn IAGetIndexBuffer( + &mut self, pIndexBuffer: *mut *mut ID3D11Buffer, Format: *mut DXGI_FORMAT, + Offset: *mut UINT + ) -> (), + fn GSGetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer + ) -> (), + fn GSGetShader( + &mut self, ppGeometryShader: *mut *mut ID3D11GeometryShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT + ) -> (), + fn IAGetPrimitiveTopology(&mut self, pTopology: *mut D3D11_PRIMITIVE_TOPOLOGY) -> (), + fn VSGetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView + ) -> (), + fn VSGetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState + ) -> (), + fn GetPredication( + &mut self, ppPredicate: *mut *mut ID3D11Predicate, pPredicateValue: *mut BOOL + ) -> (), + fn GSGetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView + ) -> (), + fn GSGetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState + ) -> (), + fn OMGetRenderTargets( + &mut self, NumViews: UINT, ppRenderTargetViews: *mut *mut ID3D11RenderTargetView, + ppDepthStencilView: *mut *mut ID3D11DepthStencilView + ) -> (), + fn OMGetRenderTargetsAndUnorderedAccessViews( + &mut self, NumRTVs: UINT, ppRenderTargetViews: *mut *mut ID3D11RenderTargetView, + ppDepthStencilView: *mut *mut ID3D11DepthStencilView, UAVStartSlot: UINT, + ppUnorderedAccessViews: *mut *mut ID3D11UnorderedAccessView + ) -> (), + fn OMGetBlendState( + &mut self, ppBlendState: *mut *mut ID3D11BlendState, BlendFactor: &mut [FLOAT; 4], + pSampleMask: *mut UINT + ) -> (), + fn OMGetDepthStencilState( + &mut self, ppDepthStencilState: *mut *mut ID3D11DepthStencilState, pStencilRef: *mut UINT + ) -> (), + fn SOGetTargets(&mut self, NumBuffers: UINT, ppSOTargets: *mut *mut ID3D11Buffer) -> (), + fn RSGetState(&mut self, ppRasterizerState: *mut *mut ID3D11RasterizerState) -> (), + fn RSGetViewports(&mut self, pNumViewports: *mut UINT, pViewports: *mut D3D11_VIEWPORT) -> (), + fn RSGetScissorRects(&mut self, pNumRects: *mut UINT, pRects: *mut D3D11_RECT) -> (), + fn HSGetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView + ) -> (), + fn HSGetShader( + &mut self, ppHullShader: *mut *mut ID3D11HullShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT + ) -> (), + fn HSGetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState + ) -> (), + fn HSGetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer + ) -> (), + fn DSGetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView + ) -> (), + fn DSGetShader( + &mut self, ppDomainShader: *mut *mut ID3D11DomainShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT + ) -> (), + fn DSGetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState + ) -> (), + fn DSGetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer + ) -> (), + fn CSGetShaderResources( + &mut self, StartSlot: UINT, NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView + ) -> (), + fn CSGetUnorderedAccessViews( + &mut self, StartSlot: UINT, NumUAVs: UINT, + ppUnorderedAccessViews: *mut *mut ID3D11UnorderedAccessView + ) -> (), + fn CSGetShader( + &mut self, ppComputeShader: *mut *mut ID3D11ComputeShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT + ) -> (), + fn CSGetSamplers( + &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState + ) -> (), + fn CSGetConstantBuffers( + &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer + ) -> (), + fn ClearState(&mut self) -> (), + fn Flush(&mut self) -> (), + fn GetType(&mut self) -> D3D11_DEVICE_CONTEXT_TYPE, + fn GetContextFlags(&mut self) -> UINT, + fn FinishCommandList( + &mut self, RestoreDeferredContextState: BOOL, ppCommandList: *mut *mut ID3D11CommandList + ) -> HRESULT +}} +STRUCT!{struct D3D11_VIDEO_DECODER_DESC { + Guid: GUID, + SampleWidth: UINT, + SampleHeight: UINT, + OutputFormat: DXGI_FORMAT, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_CONFIG { + guidConfigBitstreamEncryption: GUID, + guidConfigMBcontrolEncryption: GUID, + guidConfigResidDiffEncryption: GUID, + ConfigBitstreamRaw: UINT, + ConfigMBcontrolRasterOrder: UINT, + ConfigResidDiffHost: UINT, + ConfigSpatialResid8: UINT, + ConfigResid8Subtraction: UINT, + ConfigSpatialHost8or9Clipping: UINT, + ConfigSpatialResidInterleaved: UINT, + ConfigIntraResidUnsigned: UINT, + ConfigResidDiffAccelerator: UINT, + ConfigHostInverseScan: UINT, + ConfigSpecificIDCT: UINT, + Config4GroupedCoefs: UINT, + ConfigMinRenderTargetBuffCount: USHORT, + ConfigDecoderSpecific: USHORT, +}} +ENUM!{enum D3D11_VIDEO_DECODER_BUFFER_TYPE { + D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS = 0, + D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL = 1, + D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE = 2, + D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL = 3, + D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX = 4, + D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL = 5, + D3D11_VIDEO_DECODER_BUFFER_BITSTREAM = 6, + D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR = 7, + D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN = 8, +}} +STRUCT!{struct D3D11_AES_CTR_IV { + IV: UINT64, + Count: UINT64, +}} +STRUCT!{struct D3D11_ENCRYPTED_BLOCK_INFO { + NumEncryptedBytesAtBeginning: UINT, + NumBytesInSkipPattern: UINT, + NumBytesInEncryptPattern: UINT, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_BUFFER_DESC { + BufferType: D3D11_VIDEO_DECODER_BUFFER_TYPE, + BufferIndex: UINT, + DataOffset: UINT, + DataSize: UINT, + FirstMBaddress: UINT, + NumMBsInBuffer: UINT, + Width: UINT, + Height: UINT, + Stride: UINT, + ReservedBits: UINT, + pIV: *mut c_void, + IVSize: UINT, + PartialEncryption: BOOL, + EncryptedBlockInfo: D3D11_ENCRYPTED_BLOCK_INFO, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_EXTENSION { + Function: UINT, + pPrivateInputData: *mut c_void, + PrivateInputDataSize: UINT, + pPrivateOutputData: *mut c_void, + PrivateOutputDataSize: UINT, + ResourceCount: UINT, + ppResourceList: *mut *mut ID3D11Resource, +}} +RIDL!{interface ID3D11VideoDecoder(ID3D11VideoDecoderVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetCreationParameters( + &mut self, pVideoDesc: *mut D3D11_VIDEO_DECODER_DESC, + pConfig: *mut D3D11_VIDEO_DECODER_CONFIG + ) -> HRESULT, + fn GetDriverHandle(&mut self, pDriverHandle: *mut HANDLE) -> HRESULT +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT { + D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT = 0x1, + D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT = 0x2, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_DEVICE_CAPS { + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_LINEAR_SPACE = 0x1, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_xvYCC = 0x2, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x4, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x8, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_NOMINAL_RANGE = 0x10, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_FEATURE_CAPS { + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_FILL = 0x1, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_CONSTRICTION = 0x2, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LUMA_KEY = 0x4, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_PALETTE = 0x8, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LEGACY = 0x10, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_STEREO = 0x20, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ROTATION = 0x40, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = 0x80, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = 0x100, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = 0x200, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_FILTER_CAPS { + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_BRIGHTNESS = 0x1, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_CONTRAST = 0x2, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_HUE = 0x4, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_SATURATION = 0x8, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_NOISE_REDUCTION = 0x10, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_STEREO_ADJUSTMENT = 0x80, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_FORMAT_CAPS { + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_INTERLACED = 0x1, + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_PROCAMP = 0x2, + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_LUMA_KEY = 0x4, + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_PALETTE_INTERLACED = 0x8, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS { + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DENOISE = 0x1, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DERINGING = 0x2, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_EDGE_ENHANCEMENT = 0x4, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_COLOR_CORRECTION = 0x8, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_FLESH_TONE_MAPPING = 0x10, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_IMAGE_STABILIZATION = 0x20, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_SUPER_RESOLUTION = 0x40, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_ANAMORPHIC_SCALING = 0x80, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_STEREO_CAPS { + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_MONO_OFFSET = 0x1, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_ROW_INTERLEAVED = 0x2, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_COLUMN_INTERLEAVED = 0x4, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_CHECKERBOARD = 0x8, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_FLIP_MODE = 0x10, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_CAPS { + DeviceCaps: UINT, + FeatureCaps: UINT, + FilterCaps: UINT, + InputFormatCaps: UINT, + AutoStreamCaps: UINT, + StereoCaps: UINT, + RateConversionCapsCount: UINT, + MaxInputStreams: UINT, + MaxStreamStates: UINT, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS { + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND = 0x1, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB = 0x2, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = 0x4, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = 0x8, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE = 0x10, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = 0x20, +}} +FLAGS!{enum D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS { + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32 = 0x1, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_22 = 0x2, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2224 = 0x4, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2332 = 0x8, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32322 = 0x10, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_55 = 0x20, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_64 = 0x40, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_87 = 0x80, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_222222222223 = 0x100, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_OTHER = 0x80000000, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS { + PastFrames: UINT, + FutureFrames: UINT, + ProcessorCaps: UINT, + ITelecineCaps: UINT, + CustomRateCount: UINT, +}} +FLAGS!{enum D3D11_CONTENT_PROTECTION_CAPS { + D3D11_CONTENT_PROTECTION_CAPS_SOFTWARE = 0x1, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE = 0x2, + D3D11_CONTENT_PROTECTION_CAPS_PROTECTION_ALWAYS_ON = 0x4, + D3D11_CONTENT_PROTECTION_CAPS_PARTIAL_DECRYPTION = 0x8, + D3D11_CONTENT_PROTECTION_CAPS_CONTENT_KEY = 0x10, + D3D11_CONTENT_PROTECTION_CAPS_FRESHEN_SESSION_KEY = 0x20, + D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK = 0x40, + D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK_KEY = 0x80, + D3D11_CONTENT_PROTECTION_CAPS_SEQUENTIAL_CTR_IV = 0x100, + D3D11_CONTENT_PROTECTION_CAPS_ENCRYPT_SLICEDATA_ONLY = 0x200, + D3D11_CONTENT_PROTECTION_CAPS_DECRYPTION_BLT = 0x400, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECT_UNCOMPRESSED = 0x800, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECTED_MEMORY_PAGEABLE = 0x1000, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_TEARDOWN = 0x2000, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION = 0x4000, +}} +STRUCT!{struct D3D11_VIDEO_CONTENT_PROTECTION_CAPS { + Caps: UINT, + KeyExchangeTypeCount: UINT, + BlockAlignmentSize: UINT, + ProtectedMemorySize: ULONGLONG, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE { + CustomRate: DXGI_RATIONAL, + OutputFrames: UINT, + InputInterlaced: BOOL, + InputFramesOrFields: UINT, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_FILTER { + D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS = 0, + D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST = 1, + D3D11_VIDEO_PROCESSOR_FILTER_HUE = 2, + D3D11_VIDEO_PROCESSOR_FILTER_SATURATION = 3, + D3D11_VIDEO_PROCESSOR_FILTER_NOISE_REDUCTION = 4, + D3D11_VIDEO_PROCESSOR_FILTER_EDGE_ENHANCEMENT = 5, + D3D11_VIDEO_PROCESSOR_FILTER_ANAMORPHIC_SCALING = 6, + D3D11_VIDEO_PROCESSOR_FILTER_STEREO_ADJUSTMENT = 7, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_FILTER_RANGE { + Minimum: c_int, + Maximum: c_int, + Default: c_int, + Multiplier: c_float, +}} +ENUM!{enum D3D11_VIDEO_FRAME_FORMAT { + D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0, + D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1, + D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2, +}} +ENUM!{enum D3D11_VIDEO_USAGE { + D3D11_VIDEO_USAGE_PLAYBACK_NORMAL = 0, + D3D11_VIDEO_USAGE_OPTIMAL_SPEED = 1, + D3D11_VIDEO_USAGE_OPTIMAL_QUALITY = 2, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_CONTENT_DESC { + InputFrameFormat: D3D11_VIDEO_FRAME_FORMAT, + InputFrameRate: DXGI_RATIONAL, + InputWidth: UINT, + InputHeight: UINT, + OutputFrameRate: DXGI_RATIONAL, + OutputWidth: UINT, + OutputHeight: UINT, + Usage: D3D11_VIDEO_USAGE, +}} +RIDL!{interface ID3D11VideoProcessorEnumerator(ID3D11VideoProcessorEnumeratorVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetVideoProcessorContentDesc( + &mut self, pContentDesc: *mut D3D11_VIDEO_PROCESSOR_CONTENT_DESC + ) -> HRESULT, + fn CheckVideoProcessorFormat(&mut self, Format: DXGI_FORMAT, pFlags: *mut UINT) -> HRESULT, + fn GetVideoProcessorCaps(&mut self, pCaps: *mut D3D11_VIDEO_PROCESSOR_CAPS) -> HRESULT, + fn GetVideoProcessorRateConversionCaps( + &mut self, TypeIndex: UINT, pCaps: *mut D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS + ) -> HRESULT, + fn GetVideoProcessorCustomRate( + &mut self, TypeIndex: UINT, CustomRateIndex: UINT, + pRate: *mut D3D11_VIDEO_PROCESSOR_CUSTOM_RATE + ) -> HRESULT, + fn GetVideoProcessorFilterRange( + &mut self, Filter: D3D11_VIDEO_PROCESSOR_FILTER, + Range: *mut D3D11_VIDEO_PROCESSOR_FILTER_RANGE + ) -> HRESULT +}} +STRUCT!{struct D3D11_VIDEO_COLOR_RGBA { + R: c_float, + G: c_float, + B: c_float, + A: c_float, +}} +STRUCT!{struct D3D11_VIDEO_COLOR_YCbCrA { + Y: c_float, + Cb: c_float, + Cr: c_float, + A: c_float, +}} +STRUCT!{struct D3D11_VIDEO_COLOR { + u: [c_float; 4], +}} +UNION!{D3D11_VIDEO_COLOR, u, YCbCr, YCbCr_mut, D3D11_VIDEO_COLOR_YCbCrA} +UNION!{D3D11_VIDEO_COLOR, u, RGBA, RGBA_mut, D3D11_VIDEO_COLOR_RGBA} +ENUM!{enum D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE { + D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_UNDEFINED = 0, + D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_16_235 = 1, + D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255 = 2, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_COLOR_SPACE { + bitfield: UINT, +}} +BITFIELD!{D3D11_VIDEO_PROCESSOR_COLOR_SPACE bitfield: UINT [ + Usage set_Usage[0..1], + RGB_Range set_RGB_Range[1..2], + YCbCr_Matrix set_YCbCr_Matrix[2..3], + YCbCr_xvYCC set_YCbCr_xvYCC[3..4], + Nominal_Range set_Nominal_Range[4..6], +]} +ENUM!{enum D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE { + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_OPAQUE = 0, + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_BACKGROUND = 1, + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_DESTINATION = 2, + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_SOURCE_STREAM = 3, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_OUTPUT_RATE { + D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_NORMAL = 0, + D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_HALF = 1, + D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_CUSTOM = 2, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_STEREO_FORMAT { + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO = 0, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_HORIZONTAL = 1, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_VERTICAL = 2, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_SEPARATE = 3, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO_OFFSET = 4, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_ROW_INTERLEAVED = 5, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_COLUMN_INTERLEAVED = 6, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_CHECKERBOARD = 7, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE { + D3D11_VIDEO_PROCESSOR_STEREO_FLIP_NONE = 0, + D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME0 = 1, + D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME1 = 2, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_ROTATION { + D3D11_VIDEO_PROCESSOR_ROTATION_IDENTITY = 0, + D3D11_VIDEO_PROCESSOR_ROTATION_90 = 1, + D3D11_VIDEO_PROCESSOR_ROTATION_180 = 2, + D3D11_VIDEO_PROCESSOR_ROTATION_270 = 3, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_STREAM { + Enable: BOOL, + OutputIndex: UINT, + InputFrameOrField: UINT, + PastFrames: UINT, + FutureFrames: UINT, + ppPastSurfaces: *mut *mut ID3D11VideoProcessorInputView, + pInputSurface: *mut ID3D11VideoProcessorInputView, + ppFutureSurfaces: *mut *mut ID3D11VideoProcessorInputView, + ppPastSurfacesRight: *mut *mut ID3D11VideoProcessorInputView, + pInputSurfaceRight: *mut ID3D11VideoProcessorInputView, + ppFutureSurfacesRight: *mut *mut ID3D11VideoProcessorInputView, +}} +RIDL!{interface ID3D11VideoProcessor(ID3D11VideoProcessorVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetContentDesc(&mut self, pDesc: *mut D3D11_VIDEO_PROCESSOR_CONTENT_DESC) -> (), + fn GetRateConversionCaps( + &mut self, pCaps: *mut D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS + ) -> () +}} +STRUCT!{struct D3D11_OMAC { + Omac: [BYTE; 16], +}} +ENUM!{enum D3D11_AUTHENTICATED_CHANNEL_TYPE { + D3D11_AUTHENTICATED_CHANNEL_D3D11 = 1, + D3D11_AUTHENTICATED_CHANNEL_DRIVER_SOFTWARE = 2, + D3D11_AUTHENTICATED_CHANNEL_DRIVER_HARDWARE = 3, +}} +RIDL!{interface ID3D11AuthenticatedChannel(ID3D11AuthenticatedChannelVtbl) + : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetCertificateSize(&mut self, pCertificateSize: *mut UINT) -> HRESULT, + fn GetCertificate(&mut self, CertificateSize: UINT, pCertificate: *mut BYTE) -> HRESULT, + fn GetChannelHandle(&mut self, pChannelHandle: *mut HANDLE) -> () +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_INPUT { + QueryType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT { + omac: D3D11_OMAC, + QueryType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, + ReturnCode: HRESULT, +}} +//FIXME bitfield +STRUCT!{struct D3D11_AUTHENTICATED_PROTECTION_FLAGS { + u: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_PROTECTION_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + ProtectionFlags: D3D11_AUTHENTICATED_PROTECTION_FLAGS, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CHANNEL_TYPE_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_DEVICE_HANDLE_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DeviceHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + DecoderHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DecoderHandle: HANDLE, + CryptoSessionHandle: HANDLE, + DeviceHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + RestrictedSharedResourceProcessCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + ProcessIndex: UINT, +}} +ENUM!{enum D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE { + DD3D11_PROCESSIDTYPE_UNKNOWN = 0, + DD3D11_PROCESSIDTYPE_DWM = 1, + DD3D11_PROCESSIDTYPE_HANDLE = 2, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + ProcessIndex: UINT, + ProcessIdentifier: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE, + ProcessHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_UNRESTRICTED_PROTECTED_SHARED_RESOURCE_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + UnrestrictedProtectedSharedResourceCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDIndex: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDIndex: UINT, + OutputID: UINT64, +}} +ENUM!{enum D3D11_BUS_TYPE { + D3D11_BUS_TYPE_OTHER = 0, + D3D11_BUS_TYPE_PCI = 0x1, + D3D11_BUS_TYPE_PCIX = 0x2, + D3D11_BUS_TYPE_PCIEXPRESS = 0x3, + D3D11_BUS_TYPE_AGP = 0x4, + D3D11_BUS_IMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x10000, + D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x20000, + D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x30000, + D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x40000, + D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x50000, + D3D11_BUS_IMPL_MODIFIER_NON_STANDARD = 0x80000000, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACESSIBILITY_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + BusType: D3D11_BUS_TYPE, + AccessibleInContiguousBlocks: BOOL, + AccessibleInNonContiguousBlocks: BOOL, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + EncryptionGuidCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + EncryptionGuidIndex: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + EncryptionGuidIndex: UINT, + EncryptionGuid: GUID, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CURRENT_ACCESSIBILITY_ENCRYPTION_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + EncryptionGuid: GUID, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_INPUT { + omac: D3D11_OMAC, + ConfigureType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_OUTPUT { + omac: D3D11_OMAC, + ConfigureType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, + ReturnCode: HRESULT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_INITIALIZE_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + StartSequenceQuery: UINT, + StartSequenceConfigure: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_PROTECTION_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + Protections: D3D11_AUTHENTICATED_PROTECTION_FLAGS, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_CRYPTO_SESSION_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + DecoderHandle: HANDLE, + CryptoSessionHandle: HANDLE, + DeviceHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_SHARED_RESOURCE_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + ProcessType: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE, + ProcessHandle: HANDLE, + AllowAccess: BOOL, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_ACCESSIBLE_ENCRYPTION_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + EncryptionGuid: GUID, +}} +RIDL!{interface ID3D11CryptoSession(ID3D11CryptoSessionVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetCryptoType(&mut self, pCryptoType: *mut GUID) -> (), + fn GetDecoderProfile(&mut self, pDecoderProfile: *mut GUID) -> (), + fn GetCertificateSize(&mut self, pCertificateSize: *mut UINT) -> HRESULT, + fn GetCertificate(&mut self, CertificateSize: UINT, pCertificate: *mut BYTE) -> HRESULT, + fn GetCryptoSessionHandle(&mut self, pCertificate: *mut HANDLE) -> () +}} +ENUM!{enum D3D11_VDOV_DIMENSION { + D3D11_VDOV_DIMENSION_UNKNOWN = 0, + D3D11_VDOV_DIMENSION_TEXTURE2D = 1, +}} +STRUCT!{struct D3D11_TEX2D_VDOV { + ArraySlice: UINT, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC { + DecodeProfile: GUID, + ViewDimension: D3D11_VDOV_DIMENSION, + Texture2D: D3D11_TEX2D_VDOV, +}} +RIDL!{interface ID3D11VideoDecoderOutputView(ID3D11VideoDecoderOutputViewVtbl) + : ID3D11View(ID3D11ViewVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC) -> () +}} +ENUM!{enum D3D11_VPIV_DIMENSION { + D3D11_VPIV_DIMENSION_UNKNOWN = 0, + D3D11_VPIV_DIMENSION_TEXTURE2D = 1, +}} +STRUCT!{struct D3D11_TEX2D_VPIV { + MipSlice: UINT, + ArraySlice: UINT, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC { + FourCC: UINT, + ViewDimension: D3D11_VPIV_DIMENSION, + Texture2D: D3D11_TEX2D_VPIV, +}} +RIDL!{interface ID3D11VideoProcessorInputView(ID3D11VideoProcessorInputViewVtbl) + : ID3D11View(ID3D11ViewVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC) -> () +}} +ENUM!{enum D3D11_VPOV_DIMENSION { + D3D11_VPOV_DIMENSION_UNKNOWN = 0, + D3D11_VPOV_DIMENSION_TEXTURE2D = 1, + D3D11_VPOV_DIMENSION_TEXTURE2DARRAY = 2, +}} +STRUCT!{struct D3D11_TEX2D_VPOV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_VPOV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC { + ViewDimension: D3D11_VPOV_DIMENSION, + u: [UINT; 3], +}} +UNION!{D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_VPOV} +UNION!{D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + D3D11_TEX2D_ARRAY_VPOV} +RIDL!{interface ID3D11VideoProcessorOutputView(ID3D11VideoProcessorOutputViewVtbl) + : ID3D11View(ID3D11ViewVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC) -> () +}} +RIDL!{interface ID3D11VideoContext(ID3D11VideoContextVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDecoderBuffer( + &mut self, pDecoder: *mut ID3D11VideoDecoder, Type: D3D11_VIDEO_DECODER_BUFFER_TYPE, + pBufferSize: *mut UINT, ppBuffer: *mut *mut c_void + ) -> HRESULT, + fn ReleaseDecoderBuffer( + &mut self, pDecoder: *mut ID3D11VideoDecoder, Type: D3D11_VIDEO_DECODER_BUFFER_TYPE + ) -> HRESULT, + fn DecoderBeginFrame( + &mut self, pDecoder: *mut ID3D11VideoDecoder, pView: *mut ID3D11VideoDecoderOutputView, + ContentKeySize: UINT, pContentKey: *const c_void + ) -> HRESULT, + fn DecoderEndFrame(&mut self, pDecoder: *mut ID3D11VideoDecoder) -> HRESULT, + fn SubmitDecoderBuffers( + &mut self, pDecoder: *mut ID3D11VideoDecoder, NumBuffers: UINT, + pBufferDesc: *const D3D11_VIDEO_DECODER_BUFFER_DESC + ) -> HRESULT, + fn DecoderExtension( + &mut self, pDecoder: *mut ID3D11VideoDecoder, + pExtensionData: *const D3D11_VIDEO_DECODER_EXTENSION + ) -> HRESULT, + fn VideoProcessorSetOutputTargetRect( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enable: BOOL, pRect: *const RECT + ) -> (), + fn VideoProcessorSetOutputBackgroundColor( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, YCbCr: BOOL, pRect: *const RECT + ) -> (), + fn VideoProcessorSetOutputColorSpace( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, + pColorSpace: *const D3D11_VIDEO_PROCESSOR_COLOR_SPACE + ) -> HRESULT, + fn VideoProcessorSetOutputAlphaFillMode( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, + AlphaFillMode: D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, StreamIndex: UINT + ) -> (), + fn VideoProcessorSetOutputConstriction( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enable: BOOL, Size: SIZE + ) -> (), + fn VideoProcessorSetOutputStereoMode( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enable: BOOL + ) -> (), + fn VideoProcessorSetOutputExtension( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pExtensionGuid: *const GUID, + DataSize: UINT, pData: *mut c_void + ) -> HRESULT, + fn VideoProcessorGetOutputTargetRect( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enabled: *mut BOOL, pRect: *mut RECT + ) -> (), + fn VideoProcessorGetOutputBackgroundColor( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pYCbCr: *mut BOOL, + pColor: *mut D3D11_VIDEO_COLOR + ) -> (), + fn VideoProcessorGetOutputColorSpace( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, + pColorSpace: *mut D3D11_VIDEO_PROCESSOR_COLOR_SPACE + ) -> (), + fn VideoProcessorGetOutputAlphaFillMode( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, + pAlphaFillMode: *mut D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, pStreamIndex: *mut UINT + ) -> (), + fn VideoProcessorGetOutputConstriction( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pEnabled: *mut BOOL, + pSize: *mut SIZE + ) -> (), + fn VideoProcessorGetOutputStereoMode( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pEnabled: *mut BOOL + ) -> (), + fn VideoProcessorGetOutputExtension( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pExtensionGuid: *const GUID, + DataSize: UINT, pData: *mut c_void + ) -> HRESULT, + fn VideoProcessorSetStreamFrameFormat( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + FrameFormat: D3D11_VIDEO_FRAME_FORMAT + ) -> (), + fn VideoProcessorSetStreamColorSpace( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pColorSpace: *const D3D11_VIDEO_PROCESSOR_COLOR_SPACE + ) -> (), + fn VideoProcessorSetStreamOutputRate( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + OutputRate: D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, RepeatFrame: BOOL, + pCustomRate: *const DXGI_RATIONAL + ) -> (), + fn VideoProcessorSetStreamSourceRect( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, + pRect: *const RECT + ) -> (), + fn VideoProcessorSetStreamDestRect( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, + pRect: *const RECT + ) -> (), + fn VideoProcessorSetStreamAlpha( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, + Alpha: FLOAT + ) -> (), + fn VideoProcessorSetStreamPalette( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Count: UINT, + pEntries: *const UINT + ) -> (), + fn VideoProcessorSetStreamPixelAspectRatio( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, + pSourceAspectRatio: *const DXGI_RATIONAL, pDestinationAspectRatio: *const DXGI_RATIONAL + ) -> (), + fn VideoProcessorSetStreamLumaKey( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, + Lower: FLOAT, Upper: FLOAT + ) -> (), + fn VideoProcessorSetStreamStereoFormat( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, + Format: D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, LeftViewFrame0: BOOL, BaseViewFrame0: BOOL, + FlipMode: D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE + ) -> (), + fn VideoProcessorSetStreamAutoProcessingMode( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL + ) -> (), + fn VideoProcessorSetStreamFilter( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + Filter: D3D11_VIDEO_PROCESSOR_FILTER, Enable: BOOL, Level: c_int + ) -> (), + fn VideoProcessorSetStreamExtension( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pExtensionGuid: *const GUID, DataSize: UINT, pData: *mut c_void + ) -> HRESULT, + fn VideoProcessorGetStreamFrameFormat( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pFrameFormat: *mut D3D11_VIDEO_FRAME_FORMAT + ) -> (), + fn VideoProcessorGetStreamColorSpace( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pColorSpace: *mut D3D11_VIDEO_PROCESSOR_COLOR_SPACE + ) -> (), + fn VideoProcessorGetStreamOutputRate( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pOutputRate: *mut D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, pRepeatFrame: *mut BOOL, + pCustomRate: *mut DXGI_RATIONAL + ) -> (), + fn VideoProcessorGetStreamSourceRect( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnabled: *mut BOOL, pRect: *mut RECT + ) -> (), + fn VideoProcessorGetStreamDestRect( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnabled: *mut BOOL, pRect: *mut RECT + ) -> (), + fn VideoProcessorGetStreamAlpha( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnabled: *mut BOOL, pAlpha: *mut FLOAT + ) -> (), + fn VideoProcessorGetStreamPalette( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Count: UINT, + pEntries: *mut UINT + ) -> (), + fn VideoProcessorGetStreamPixelAspectRatio( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnabled: *mut BOOL, pSourceAspectRatio: *mut DXGI_RATIONAL, + pDestinationAspectRatio: *mut DXGI_RATIONAL + ) -> (), + fn VideoProcessorGetStreamLumaKey( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnabled: *mut BOOL, pLower: *mut FLOAT, pUpper: *mut FLOAT + ) -> (), + fn VideoProcessorGetStreamStereoFormat( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnabled: *mut BOOL, pFormat: *mut D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, + pLeftViewFrame0: *mut BOOL, pBaseViewFrame0: *mut BOOL, + pFlipMode: *mut D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE, MonoOffset: *mut c_int + ) -> (), + fn VideoProcessorGetStreamAutoProcessingMode( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnabled: *mut BOOL + ) -> (), + fn VideoProcessorGetStreamFilter( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + Filter: D3D11_VIDEO_PROCESSOR_FILTER, pEnabled: *mut BOOL, pLevel: *mut c_int + ) -> (), + fn VideoProcessorGetStreamExtension( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pExtensionGuid: *const GUID, DataSize: UINT, pData: *mut c_void + ) -> HRESULT, + fn VideoProcessorBlt( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, + pView: *mut ID3D11VideoProcessorOutputView, OutputFrame: UINT, StreamCount: UINT, + pStreams: *const D3D11_VIDEO_PROCESSOR_STREAM + ) -> HRESULT, + fn NegotiateCryptoSessionKeyExchange( + &mut self, pCryptoSession: *mut ID3D11CryptoSession, DataSize: UINT, pData: *mut c_void + ) -> HRESULT, + fn EncryptionBlt( + &mut self, pCryptoSession: *mut ID3D11CryptoSession, pSrcSurface: *mut ID3D11Texture2D, + pDstSurface: *mut ID3D11Texture2D, IVSize: UINT, pIV: *mut c_void + ) -> HRESULT, + fn DecryptionBlt( + &mut self, pCryptoSession: *mut ID3D11CryptoSession, pSrcSurface: *mut ID3D11Texture2D, + pDstSurface: *mut ID3D11Texture2D, pEncryptedBlockInfo: *mut D3D11_ENCRYPTED_BLOCK_INFO, + ContentKeySize: UINT, pContentKey: *const c_void, IVSize: UINT, pIV: *mut c_void + ) -> HRESULT, + fn StartSessionKeyRefresh( + &mut self, pCryptoSession: *mut ID3D11CryptoSession, RandomNumberSize: UINT, + pRandomNumber: *mut c_void + ) -> HRESULT, + fn FinishSessionKeyRefresh(&mut self, pCryptoSession: *mut ID3D11CryptoSession) -> HRESULT, + fn GetEncryptionBltKey( + &mut self, pCryptoSession: *mut ID3D11CryptoSession, KeySize: UINT, + pReadbackKey: *mut c_void + ) -> HRESULT, + fn NegotiateAuthenticatedChannelKeyExchange( + &mut self, pChannel: *mut ID3D11AuthenticatedChannel, DataSize: UINT, pData: *mut c_void + ) -> HRESULT, + fn QueryAuthenticatedChannel( + &mut self, pChannel: *mut ID3D11AuthenticatedChannel, InputSize: UINT, + pInput: *const c_void, OutputSize: UINT, pOutput: *mut c_void + ) -> HRESULT, + fn ConfigureAuthenticatedChannel( + &mut self, pChannel: *mut ID3D11AuthenticatedChannel, InputSize: UINT, + pInput: *const c_void, pOutput: *mut D3D11_AUTHENTICATED_CONFIGURE_OUTPUT + ) -> HRESULT, + fn VideoProcessorSetStreamRotation( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, + Rotation: D3D11_VIDEO_PROCESSOR_ROTATION + ) -> HRESULT, + fn VideoProcessorGetStreamRotation( + &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, + pEnable: *mut BOOL, pRotation: *mut D3D11_VIDEO_PROCESSOR_ROTATION + ) -> HRESULT +}} +RIDL!{interface ID3D11VideoDevice(ID3D11VideoDeviceVtbl): IUnknown(IUnknownVtbl) { + fn CreateVideoDecoder( + &mut self, pVideoDesc: *const D3D11_VIDEO_DECODER_DESC, + pConfig: *const D3D11_VIDEO_DECODER_CONFIG, ppDecoder: *mut *mut ID3D11VideoDecoder + ) -> HRESULT, + fn CreateVideoProcessor( + &mut self, pEnum: *mut ID3D11VideoProcessorEnumerator, RateConversionIndex: UINT, + ppVideoProcessor: *mut *mut ID3D11VideoProcessor + ) -> HRESULT, + fn CreateAuthenticatedChannel( + &mut self, ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE, + ppAuthenticatedChannel: *mut *mut ID3D11AuthenticatedChannel + ) -> HRESULT, + fn CreateCryptoSession( + &mut self, pCryptoType: *const GUID, pDecoderProfile: *const GUID, + pKeyExchangeType: *const GUID, ppCryptoSession: *mut *mut ID3D11CryptoSession + ) -> HRESULT, + fn CreateVideoDecoderOutputView( + &mut self, pResource: *mut ID3D11Resource, + pDesc: *const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC, + ppVDOVView: *mut *mut ID3D11VideoDecoderOutputView + ) -> HRESULT, + fn CreateVideoProcessorInputView( + &mut self, pResource: *mut ID3D11Resource, pEnum: *mut ID3D11VideoProcessorEnumerator, + pDesc: *const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC, + ppVPIView: *mut *mut ID3D11VideoProcessorInputView + ) -> HRESULT, + fn CreateVideoProcessorOutputView( + &mut self, pResource: *mut ID3D11Resource, pEnum: *mut ID3D11VideoProcessorEnumerator, + pDesc: *const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, + ppVPOView: *mut *mut ID3D11VideoProcessorOutputView + ) -> HRESULT, + fn CreateVideoProcessorEnumerator( + &mut self, pDesc: *const D3D11_VIDEO_PROCESSOR_CONTENT_DESC, + ppEnum: *mut *mut ID3D11VideoProcessorEnumerator + ) -> HRESULT, + fn GetVideoDecoderProfileCount(&mut self) -> UINT, + fn GetVideoDecoderProfile(&mut self, Index: UINT, pDecoderProfile: *mut GUID) -> HRESULT, + fn CheckVideoDecoderFormat( + &mut self, pDecoderProfile: *const GUID, Format: DXGI_FORMAT, pSupported: *mut BOOL + ) -> HRESULT, + fn GetVideoDecoderConfigCount( + &mut self, pDesc: *const D3D11_VIDEO_DECODER_DESC, pCount: *mut UINT + ) -> HRESULT, + fn GetVideoDecoderConfig( + &mut self, pDesc: *const D3D11_VIDEO_DECODER_DESC, Index: UINT, + pConfig: *mut D3D11_VIDEO_DECODER_CONFIG + ) -> HRESULT, + fn GetContentProtectionCaps( + &mut self, pCryptoType: *const GUID, pDecoderProfile: *const GUID, + pCaps: *mut D3D11_VIDEO_CONTENT_PROTECTION_CAPS + ) -> HRESULT, + fn CheckCryptoKeyExchange( + &mut self, pCryptoType: *const GUID, pDecoderProfile: *const GUID, Index: UINT, + pKeyExchangeType: *mut GUID + ) -> HRESULT, + fn SetPrivateData( &mut self, guid: REFGUID, DataSize: UINT, pData: *const c_void) -> HRESULT, + fn SetPrivateDataInterface(&mut self, guid: REFGUID, pData: *const IUnknown) -> HRESULT +}} +RIDL!{interface ID3D11Device(ID3D11DeviceVtbl): IUnknown(IUnknownVtbl) { + fn CreateBuffer( + &mut self, pDesc: *const D3D11_BUFFER_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppBuffer: *mut *mut ID3D11Buffer + ) -> HRESULT, + fn CreateTexture1D( + &mut self, pDesc: *const D3D11_TEXTURE1D_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppTexture1D: *mut *mut ID3D11Texture1D + ) -> HRESULT, + fn CreateTexture2D( + &mut self, pDesc: *const D3D11_TEXTURE2D_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppTexture2D: *mut *mut ID3D11Texture2D + ) -> HRESULT, + fn CreateTexture3D( + &mut self, pDesc: *const D3D11_TEXTURE3D_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppTexture3D: *mut *mut ID3D11Texture3D + ) -> HRESULT, + fn CreateShaderResourceView( + &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_SHADER_RESOURCE_VIEW_DESC, + ppSRView: *mut *mut ID3D11ShaderResourceView + ) -> HRESULT, + fn CreateUnorderedAccessView( + &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_UNORDERED_ACCESS_VIEW_DESC, + ppUAView: *mut *mut ID3D11UnorderedAccessView + ) -> HRESULT, + fn CreateRenderTargetView( + &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_RENDER_TARGET_VIEW_DESC, + ppRTView: *mut *mut ID3D11RenderTargetView + ) -> HRESULT, + fn CreateDepthStencilView( + &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_DEPTH_STENCIL_VIEW_DESC, + ppDepthStencilView: *mut *mut ID3D11DepthStencilView + ) -> HRESULT, + fn CreateInputLayout( + &mut self, pInputElementDescs: *const D3D11_INPUT_ELEMENT_DESC, NumElements: UINT, + pShaderBytecodeWithInputSignature: *const c_void, BytecodeLength: SIZE_T, + ppInputLayout: *mut *mut ID3D11InputLayout + ) -> HRESULT, + fn CreateVertexShader( + &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, ppVertexShader: *mut *mut ID3D11VertexShader + ) -> HRESULT, + fn CreateGeometryShader( + &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, ppGeometryShader: *mut *mut ID3D11GeometryShader + ) -> HRESULT, + fn CreateGeometryShaderWithStreamOutput( + &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, + pSODeclaration: *const D3D11_SO_DECLARATION_ENTRY, NumEntries: UINT, + pBufferStrides: *const UINT, NumStrides: UINT, RasterizedStream: UINT, + pClassLinkage: *mut ID3D11ClassLinkage, ppGeometryShader: *mut *mut ID3D11GeometryShader + ) -> HRESULT, + fn CreatePixelShader( + &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, ppPixelShader: *mut *mut ID3D11PixelShader + ) -> HRESULT, + fn CreateHullShader( + &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, ppHullShader: *mut *mut ID3D11HullShader + ) -> HRESULT, + fn CreateDomainShader( + &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, ppDomainShader: *mut *mut ID3D11DomainShader + ) -> HRESULT, + fn CreateComputeShader( + &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, ppComputeShader: *mut *mut ID3D11ComputeShader + ) -> HRESULT, + fn CreateClassLinkage(&mut self, ppLinkage: *mut *mut ID3D11ClassLinkage) -> HRESULT, + fn CreateBlendState( + &mut self, pBlendStateDesc: *const D3D11_BLEND_DESC, + ppBlendState: *mut *mut ID3D11BlendState + ) -> HRESULT, + fn CreateDepthStencilState( + &mut self, pDepthStencilDesc: *const D3D11_DEPTH_STENCIL_DESC, + ppDepthStencilState: *mut *mut ID3D11DepthStencilState + ) -> HRESULT, + fn CreateRasterizerState( + &mut self, pRasterizerDesc: *const D3D11_RASTERIZER_DESC, + ppRasterizerState: *mut *mut ID3D11RasterizerState + ) -> HRESULT, + fn CreateSamplerState( + &mut self, pSamplerDesc: *const D3D11_SAMPLER_DESC, + ppSamplerState: *mut *mut ID3D11SamplerState + ) -> HRESULT, + fn CreateQuery( + &mut self, pQueryDesc: *const D3D11_QUERY_DESC, ppQuery: *mut *mut ID3D11Query + ) -> HRESULT, + fn CreatePredicate( + &mut self, pPredicateDesc: *const D3D11_QUERY_DESC, ppPredicate: *mut *mut ID3D11Predicate + ) -> HRESULT, + fn CreateCounter( + &mut self, pCounterDesc: *const D3D11_COUNTER_DESC, ppCounter: *mut *mut ID3D11Counter + ) -> HRESULT, + fn CreateDeferredContext( + &mut self, ContextFlags: UINT, ppDeferredContext: *mut *mut ID3D11DeviceContext + ) -> HRESULT, + fn OpenSharedResource( + &mut self, hResource: HANDLE, ReturnedInterface: REFIID, ppResource: *mut *mut c_void + ) -> HRESULT, + fn CheckFormatSupport( + &mut self, Format: DXGI_FORMAT, pFormatSupport: *mut UINT + ) -> HRESULT, + fn CheckMultisampleQualityLevels( + &mut self, Format: DXGI_FORMAT, SampleCount: UINT, pNumQualityLevels: *mut UINT + ) -> HRESULT, + fn CheckCounterInfo(&mut self, pCounterInfo: *mut D3D11_COUNTER_INFO) -> (), + fn CheckCounter( + &mut self, pDesc: *const D3D11_COUNTER_DESC, pType: *mut D3D11_COUNTER_TYPE, + pActiveCounters: *mut UINT, szName: LPSTR, pNameLength: *mut UINT, szUnits: LPSTR, + pUnitsLength: *mut UINT, szDescription: LPSTR, pDescriptionLength: *mut UINT + ) -> HRESULT, + fn CheckFeatureSupport( + &mut self, Feature: D3D11_FEATURE, pFeatureSupportData: *mut c_void, + FeatureSupportDataSize: UINT + ) -> HRESULT, + fn GetPrivateData( + &mut self, guid: REFGUID, pDataSize: *mut UINT, pData: *mut c_void + ) -> HRESULT, + fn SetPrivateData( + &mut self, guid: REFGUID, DataSize: UINT, pData: *const c_void + ) -> HRESULT, + fn SetPrivateDataInterface(&mut self, guid: REFGUID, pData: *const IUnknown) -> HRESULT, + fn GetFeatureLevel(&mut self) -> D3D_FEATURE_LEVEL, + fn GetCreationFlags(&mut self) -> UINT, + fn GetDeviceRemovedReason(&mut self) -> HRESULT, + fn GetImmediateContext(&mut self, ppImmediateContext: *mut *mut ID3D11DeviceContext) -> (), + fn SetExceptionMode(&mut self, RaiseFlags: UINT) -> HRESULT, + fn GetExceptionMode(&mut self) -> UINT +}} +FLAGS!{enum D3D11_CREATE_DEVICE_FLAG { + D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1, + D3D11_CREATE_DEVICE_DEBUG = 0x2, + D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4, + D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, + D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20, + D3D11_CREATE_DEVICE_DEBUGGABLE = 0x40, + D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 0x80, + D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = 0x100, + D3D11_CREATE_DEVICE_VIDEO_SUPPORT = 0x800, +}} +pub const D3D11_SDK_VERSION: DWORD = 7; + +pub fn D3D11CalcSubresource(MipSlice: ::UINT, ArraySlice: ::UINT, MipLevels: ::UINT) -> ::UINT { + MipSlice + ArraySlice * MipLevels +} diff --git a/third_party/rust/winapi/src/d3d11shader.rs b/third_party/rust/winapi/src/d3d11shader.rs new file mode 100644 index 000000000000..8328abe82e9f --- /dev/null +++ b/third_party/rust/winapi/src/d3d11shader.rs @@ -0,0 +1,320 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +ENUM!{enum D3D11_SHADER_VERSION_TYPE { + D3D11_SHVER_PIXEL_SHADER = 0, + D3D11_SHVER_VERTEX_SHADER = 1, + D3D11_SHVER_GEOMETRY_SHADER = 2, + D3D11_SHVER_HULL_SHADER = 3, + D3D11_SHVER_DOMAIN_SHADER = 4, + D3D11_SHVER_COMPUTE_SHADER = 5, + D3D11_SHVER_RESERVED0 = 0xFFF0, +}} +pub const D3D_RETURN_PARAMETER_INDEX: c_int = -1; +pub type D3D11_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; +pub type D3D11_CBUFFER_TYPE = D3D_CBUFFER_TYPE; +STRUCT!{struct D3D11_SIGNATURE_PARAMETER_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Register: UINT, + SystemValueType: D3D_NAME, + ComponentType: D3D_REGISTER_COMPONENT_TYPE, + Mask: BYTE, + ReadWriteMask: BYTE, + Stream: UINT, + MinPrecision: D3D_MIN_PRECISION, +}} +STRUCT!{struct D3D11_SHADER_BUFFER_DESC { + Name: LPCSTR, + Type: D3D_CBUFFER_TYPE, + Variables: UINT, + Size: UINT, + uFlags: UINT, +}} +STRUCT!{struct D3D11_SHADER_VARIABLE_DESC { + Name: LPCSTR, + StartOffset: UINT, + Size: UINT, + uFlags: UINT, + DefaultValue: LPVOID, + StartTexture: UINT, + TextureSize: UINT, + StartSampler: UINT, + SamplerSize: UINT, +}} +STRUCT!{struct D3D11_SHADER_TYPE_DESC { + Class: D3D_SHADER_VARIABLE_CLASS, + Type: D3D_SHADER_VARIABLE_TYPE, + Rows: UINT, + Columns: UINT, + Elements: UINT, + Members: UINT, + Offset: UINT, + Name: LPCSTR, +}} +pub type D3D11_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN; +pub type D3D11_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING; +pub type D3D11_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE; +STRUCT!{struct D3D11_SHADER_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InputParameters: UINT, + OutputParameters: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + CutInstructionCount: UINT, + EmitInstructionCount: UINT, + GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, + GSMaxOutputVertexCount: UINT, + InputPrimitive: D3D_PRIMITIVE, + PatchConstantParameters: UINT, + cGSInstanceCount: UINT, + cControlPoints: UINT, + HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE, + HSPartitioning: D3D_TESSELLATOR_PARTITIONING, + TessellatorDomain: D3D_TESSELLATOR_DOMAIN, + cBarrierInstructions: UINT, + cInterlockedInstructions: UINT, + cTextureStoreInstructions: UINT, +}} +STRUCT!{struct D3D11_SHADER_INPUT_BIND_DESC { + Name: LPCSTR, + Type: D3D_SHADER_INPUT_TYPE, + BindPoint: UINT, + BindCount: UINT, + uFlags: UINT, + ReturnType: D3D_RESOURCE_RETURN_TYPE, + Dimension: D3D_SRV_DIMENSION, + NumSamples: UINT, +}} +pub const D3D_SHADER_REQUIRES_DOUBLES: UINT64 = 0x00000001; +pub const D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL: UINT64 = 0x00000002; +pub const D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE: UINT64 = 0x00000004; +pub const D3D_SHADER_REQUIRES_64_UAVS: UINT64 = 0x00000008; +pub const D3D_SHADER_REQUIRES_MINIMUM_PRECISION: UINT64 = 0x00000010; +pub const D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS: UINT64 = 0x00000020; +pub const D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS: UINT64 = 0x00000040; +pub const D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING: UINT64 = 0x00000080; +pub const D3D_SHADER_REQUIRES_TILED_RESOURCES: UINT64 = 0x00000100; +STRUCT!{struct D3D11_LIBRARY_DESC { + Creator: LPCSTR, + Flags: UINT, + FunctionCount: UINT, +}} +STRUCT!{struct D3D11_FUNCTION_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + MovInstructionCount: UINT, + MovcInstructionCount: UINT, + ConversionInstructionCount: UINT, + BitwiseInstructionCount: UINT, + MinFeatureLevel: D3D_FEATURE_LEVEL, + RequiredFeatureFlags: UINT64, + Name: LPCSTR, + FunctionParameterCount: INT, + HasReturn: BOOL, + Has10Level9VertexShader: BOOL, + Has10Level9PixelShader: BOOL, +}} +STRUCT!{struct D3D11_PARAMETER_DESC { + Name: LPCSTR, + SemanticName: LPCSTR, + Type: D3D_SHADER_VARIABLE_TYPE, + Class: D3D_SHADER_VARIABLE_CLASS, + Rows: UINT, + Columns: UINT, + InterpolationMode: D3D_INTERPOLATION_MODE, + Flags: D3D_PARAMETER_FLAGS, + FirstInRegister: UINT, + FirstInComponent: UINT, + FirstOutRegister: UINT, + FirstOutComponent: UINT, +}} +RIDL!{interface ID3D11ShaderReflectionType(ID3D11ShaderReflectionTypeVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_TYPE_DESC) -> HRESULT, + fn GetMemberTypeByIndex(&mut self, Index: UINT) -> *mut ID3D11ShaderReflectionType, + fn GetMemberTypeByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionType, + fn GetMemberTypeName(&mut self, Index: UINT) -> LPCSTR, + fn IsEqual(&mut self, pType: *mut ID3D11ShaderReflectionType) -> HRESULT, + fn GetSubType(&mut self) -> *mut ID3D11ShaderReflectionType, + fn GetBaseClass(&mut self) -> *mut ID3D11ShaderReflectionType, + fn GetNumInterfaces(&mut self) -> UINT, + fn GetInterfaceByIndex(&mut self, uIndex: UINT) -> *mut ID3D11ShaderReflectionType, + fn IsOfType(&mut self, pType: *mut ID3D11ShaderReflectionType) -> HRESULT, + fn ImplementsInterface(&mut self, pBase: *mut ID3D11ShaderReflectionType) -> HRESULT +}} +RIDL!{interface ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariableVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_VARIABLE_DESC) -> HRESULT, + fn GetType(&mut self) -> *mut ID3D11ShaderReflectionType, + fn GetBuffer(&mut self) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetInterfaceSlot(&mut self, uArrayIndex: UINT) -> UINT +}} +RIDL!{interface ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBufferVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_BUFFER_DESC) -> HRESULT, + fn GetVariableByIndex(&mut self, Index: UINT) -> *mut ID3D11ShaderReflectionVariable, + fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable +}} +RIDL!{interface ID3D11ShaderReflection(ID3D11ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_DESC) -> HRESULT, + fn GetConstantBufferByIndex( + &mut self, Index: UINT + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + &mut self, Name: LPCSTR + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + &mut self, ResourceIndex: UINT, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC + ) -> HRESULT, + fn GetInputParameterDesc( + &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC + ) -> HRESULT, + fn GetOutputParameterDesc( + &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC + ) -> HRESULT, + fn GetPatchConstantParameterDesc( + &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC + ) -> HRESULT, + fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable, + fn GetResourceBindingDescByName( + &mut self, Name: LPCSTR, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC + ) -> HRESULT, + fn GetMovInstructionCount(&mut self) -> UINT, + fn GetMovcInstructionCount(&mut self) -> UINT, + fn GetConversionInstructionCount(&mut self) -> UINT, + fn GetBitwiseInstructionCount(&mut self) -> UINT, + fn GetGSInputPrimitive(&mut self) -> D3D_PRIMITIVE, + fn IsSampleFrequencyShader(&mut self) -> BOOL, + fn GetNumInterfaceSlots(&mut self) -> UINT, + fn GetMinFeatureLevel(&mut self, pLevel: *mut D3D_FEATURE_LEVEL) -> HRESULT, + fn GetThreadGroupSize( + &mut self, pSizeX: *mut UINT, pSizeY: *mut UINT, pSizeZ: *mut UINT + ) -> UINT, + fn GetRequiresFlags(&mut self) -> UINT64 +}} +RIDL!{interface ID3D11LibraryReflection(ID3D11LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_LIBRARY_DESC) -> HRESULT, + fn GetFunctionByIndex(&mut self, FunctionIndex: INT) -> *mut ID3D11FunctionReflection +}} +RIDL!{interface ID3D11FunctionReflection(ID3D11FunctionReflectionVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_FUNCTION_DESC) -> HRESULT, + fn GetConstantBufferByIndex( + &mut self, BufferIndex: UINT + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + &mut self, Name: LPCSTR + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + &mut self, ResourceIndex: UINT, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC + ) -> HRESULT, + fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable, + fn GetResourceBindingDescByName( + &mut self, Name: LPCSTR, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC + ) -> HRESULT, + fn GetFunctionParameter( + &mut self, ParameterIndex: INT + ) -> *mut ID3D11FunctionParameterReflection +}} +RIDL!{interface ID3D11FunctionParameterReflection(ID3D11FunctionParameterReflectionVtbl) { + fn GetDesc(&mut self, pDesc: *mut D3D11_PARAMETER_DESC) -> HRESULT +}} +RIDL!{interface ID3D11Module(ID3D11ModuleVtbl): IUnknown(IUnknownVtbl) { + fn CreateInstance( + &mut self, pNamespace: LPCSTR, ppModuleInstance: *mut *mut ID3D11ModuleInstance + ) -> HRESULT +}} +RIDL!{interface ID3D11ModuleInstance(ID3D11ModuleInstanceVtbl): IUnknown(IUnknownVtbl) { + fn BindConstantBuffer(&mut self, uSrcSlot: UINT, uDstSlot: UINT, cbDstOffset: UINT) -> HRESULT, + fn BindConstantBufferByName( + &mut self, pName: LPCSTR, uDstSlot: UINT, cbDstOffset: UINT + ) -> HRESULT, + fn BindResource(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, + fn BindResourceByName(&mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT) -> HRESULT, + fn BindSampler(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, + fn BindSamplerByName(&mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT) -> HRESULT, + fn BindUnorderedAccessView(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, + fn BindUnorderedAccessViewByName( + &mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT + ) -> HRESULT, + fn BindResourceAsUnorderedAccessView( + &mut self, uSrcSrvSlot: UINT, uDstUavSlot: UINT, uCount: UINT + ) -> HRESULT, + fn BindResourceAsUnorderedAccessViewByName( + &mut self, pSrvName: LPCSTR, uDstUavSlot: UINT, uCount: UINT + ) -> HRESULT +}} +RIDL!{interface ID3D11Linker(ID3D11LinkerVtbl): IUnknown(IUnknownVtbl) { + fn Link( + &mut self, pEntry: *mut ID3D11ModuleInstance, pEntryName: LPCSTR, pTargetName: LPCSTR, + uFlags: UINT, ppShaderBlob: *mut *mut ID3DBlob, ppErrorBuffer: *mut *mut ID3DBlob + ) -> HRESULT, + fn UseLibrary(&mut self, pLibraryMI: *mut ID3D11ModuleInstance) -> HRESULT, + fn AddClipPlaneFromCBuffer(&mut self, uCBufferSlot: UINT, uCBufferEntry: UINT) -> HRESULT +}} +RIDL!{interface ID3D11LinkingNode(ID3D11LinkingNodeVtbl): IUnknown(IUnknownVtbl) {}} +RIDL!{interface ID3D11FunctionLinkingGraph(ID3D11FunctionLinkingGraphVtbl): IUnknown(IUnknownVtbl) { + fn CreateModuleInstance( + &mut self, ppModuleInstance: *mut *mut ID3D11ModuleInstance, + ppErrorBuffer: *mut *mut ID3DBlob + ) -> HRESULT, + fn SetInputSignature( + &mut self, pInputParameters: *const D3D11_PARAMETER_DESC, cInputParameters: UINT, + ppInputNode: *mut *mut ID3D11LinkingNode + ) -> HRESULT, + fn SetOutputSignature( + &mut self, pOutputParameters: *const D3D11_PARAMETER_DESC, cOutputParameters: UINT, + ppOutputNode: *mut *mut ID3D11LinkingNode + ) -> HRESULT, + fn CallFunction( + &mut self, pModuleInstanceNamespace: LPCSTR, + pModuleWithFunctionPrototype: *mut ID3D11Module, pFunctionName: LPCSTR, + ppCallNode: *mut *mut ID3D11LinkingNode + ) -> HRESULT, + fn PassValue( + &mut self, pSrcNode: *mut ID3D11LinkingNode, SrcParameterIndex: INT, + pDstNode: *mut ID3D11LinkingNode, DstParameterIndex: INT + ) -> HRESULT, + fn PassValueWithSwizzle( + &mut self, pSrcNode: *mut ID3D11LinkingNode, SrcParameterIndex: INT, pSrcSwizzle: LPCSTR, + pDstNode: *mut ID3D11LinkingNode, DstParameterIndex: INT, pDstSwizzle: LPCSTR + ) -> HRESULT, + fn GetLastError(&mut self, ppErrorBuffer: *mut *mut ID3DBlob) -> HRESULT, + fn GenerateHlsl(&mut self, uFlags: UINT, ppBuffer: *mut *mut ID3DBlob) -> HRESULT +}} diff --git a/third_party/rust/winapi/src/d3d12.rs b/third_party/rust/winapi/src/d3d12.rs new file mode 100644 index 000000000000..ac6ae3bdd2b3 --- /dev/null +++ b/third_party/rust/winapi/src/d3d12.rs @@ -0,0 +1,2324 @@ +// Copyright © 2015, Dmitry Roschin +// Licensed under the MIT License +pub const D3D12_16BIT_INDEX_STRIP_CUT_VALUE: ::UINT = 0xffff; +pub const D3D12_32BIT_INDEX_STRIP_CUT_VALUE: ::UINT = 0xffffffff; +pub const D3D12_8BIT_INDEX_STRIP_CUT_VALUE: ::UINT = 0xff; +pub const D3D12_ANISOTROPIC_FILTERING_BIT: ::UINT = 0x40; +pub const D3D12_APPEND_ALIGNED_ELEMENT: ::UINT = 0xffffffff; +pub const D3D12_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT: ::UINT = 9; +pub const D3D12_CLIP_OR_CULL_DISTANCE_COUNT: ::UINT = 8; +pub const D3D12_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT: ::UINT = 2; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT: ::UINT = 14; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS: ::UINT = 4; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT: ::UINT = 15; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT: ::UINT = 16; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT: ::UINT = 15; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST: ::UINT = 1; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT: ::UINT = 64; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST: ::UINT = 1; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT: ::UINT = 128; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST: ::UINT = 1; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT: ::UINT = 128; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_COUNT: ::UINT = 16; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST: ::UINT = 1; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_COMMONSHADER_SAMPLER_SLOT_COUNT: ::UINT = 16; +pub const D3D12_COMMONSHADER_SUBROUTINE_NESTING_LIMIT: ::UINT = 32; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_COUNT: ::UINT = 4096; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_READS_PER_INST: ::UINT = 3; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_READ_PORTS: ::UINT = 3; +pub const D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX: ::UINT = 10; +pub const D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN: ::INT = -10; +pub const D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE: ::INT = -8; +pub const D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE: ::UINT = 7; +pub const D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT: ::UINT = 256; +pub const D3D12_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 256; +pub const D3D12_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP: ::UINT = 64; +pub const D3D12_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 240; +pub const D3D12_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP: ::UINT = 68; +pub const D3D12_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 224; +pub const D3D12_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP: ::UINT = 72; +pub const D3D12_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 208; +pub const D3D12_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP: ::UINT = 76; +pub const D3D12_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 192; +pub const D3D12_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP: ::UINT = 84; +pub const D3D12_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 176; +pub const D3D12_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP: ::UINT = 92; +pub const D3D12_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 160; +pub const D3D12_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP: ::UINT = 100; +pub const D3D12_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 144; +pub const D3D12_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP: ::UINT = 112; +pub const D3D12_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 128; +pub const D3D12_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP: ::UINT = 128; +pub const D3D12_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 112; +pub const D3D12_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP: ::UINT = 144; +pub const D3D12_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 96; +pub const D3D12_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP: ::UINT = 168; +pub const D3D12_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 80; +pub const D3D12_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP: ::UINT = 204; +pub const D3D12_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 64; +pub const D3D12_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP: ::UINT = 256; +pub const D3D12_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 48; +pub const D3D12_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP: ::UINT = 340; +pub const D3D12_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 32; +pub const D3D12_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP: ::UINT = 512; +pub const D3D12_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 16; +pub const D3D12_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP: ::UINT = 768; +pub const D3D12_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION: ::UINT = 1; +pub const D3D12_CS_4_X_RAW_UAV_BYTE_ALIGNMENT: ::UINT = 256; +pub const D3D12_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP: ::UINT = 768; +pub const D3D12_CS_4_X_THREAD_GROUP_MAX_X: ::UINT = 768; +pub const D3D12_CS_4_X_THREAD_GROUP_MAX_Y: ::UINT = 768; +pub const D3D12_CS_4_X_UAV_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION: ::UINT = 65535; +pub const D3D12_CS_TGSM_REGISTER_COUNT: ::UINT = 8192; +pub const D3D12_CS_TGSM_REGISTER_READS_PER_INST: ::UINT = 1; +pub const D3D12_CS_TGSM_RESOURCE_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_CS_TGSM_RESOURCE_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_CS_THREADGROUPID_REGISTER_COMPONENTS: ::UINT = 3; +pub const D3D12_CS_THREADGROUPID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_CS_THREADIDINGROUP_REGISTER_COMPONENTS: ::UINT = 3; +pub const D3D12_CS_THREADIDINGROUP_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_CS_THREADID_REGISTER_COMPONENTS: ::UINT = 3; +pub const D3D12_CS_THREADID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP: ::UINT = 1024; +pub const D3D12_CS_THREAD_GROUP_MAX_X: ::UINT = 1024; +pub const D3D12_CS_THREAD_GROUP_MAX_Y: ::UINT = 1024; +pub const D3D12_CS_THREAD_GROUP_MAX_Z: ::UINT = 64; +pub const D3D12_CS_THREAD_GROUP_MIN_X: ::UINT = 1; +pub const D3D12_CS_THREAD_GROUP_MIN_Y: ::UINT = 1; +pub const D3D12_CS_THREAD_GROUP_MIN_Z: ::UINT = 1; +pub const D3D12_CS_THREAD_LOCAL_TEMP_REGISTER_POOL: ::UINT = 16384; +pub const D3D12_DEFAULT_BLEND_FACTOR_ALPHA: ::FLOAT = 1.0; +pub const D3D12_DEFAULT_BLEND_FACTOR_BLUE: ::FLOAT = 1.0; +pub const D3D12_DEFAULT_BLEND_FACTOR_GREEN: ::FLOAT = 1.0; +pub const D3D12_DEFAULT_BLEND_FACTOR_RED: ::FLOAT = 1.0; +pub const D3D12_DEFAULT_BORDER_COLOR_COMPONENT: ::FLOAT = 0.0; +pub const D3D12_DEFAULT_DEPTH_BIAS: ::UINT = 0; +pub const D3D12_DEFAULT_DEPTH_BIAS_CLAMP: ::FLOAT = 0.0; +pub const D3D12_DEFAULT_MAX_ANISOTROPY: ::UINT = 16; +pub const D3D12_DEFAULT_MIP_LOD_BIAS: ::FLOAT = 0.0; +pub const D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 4194304; +pub const D3D12_DEFAULT_RENDER_TARGET_ARRAY_INDEX: ::UINT = 0; +pub const D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 65536; +pub const D3D12_DEFAULT_SAMPLE_MASK: ::UINT = 0xffffffff; +pub const D3D12_DEFAULT_SCISSOR_ENDX: ::UINT = 0; +pub const D3D12_DEFAULT_SCISSOR_ENDY: ::UINT = 0; +pub const D3D12_DEFAULT_SCISSOR_STARTX: ::UINT = 0; +pub const D3D12_DEFAULT_SCISSOR_STARTY: ::UINT = 0; +pub const D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS: ::FLOAT = 0.0; +pub const D3D12_DEFAULT_STENCIL_READ_MASK: ::UINT = 0xff; +pub const D3D12_DEFAULT_STENCIL_REFERENCE: ::UINT = 0; +pub const D3D12_DEFAULT_STENCIL_WRITE_MASK: ::UINT = 0xff; +pub const D3D12_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX: ::UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_HEIGHT: ::UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_MAX_DEPTH: ::FLOAT = 0.0; +pub const D3D12_DEFAULT_VIEWPORT_MIN_DEPTH: ::FLOAT = 0.0; +pub const D3D12_DEFAULT_VIEWPORT_TOPLEFTX: ::UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_TOPLEFTY: ::UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_WIDTH: ::UINT = 0; +pub const D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND: ::UINT = 0xffffffff; +pub const D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_END: ::UINT = 0xfffffff7; +pub const D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_START: ::UINT = 0xfffffff0; +pub const D3D12_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: ::UINT = 3968; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS: ::UINT = 3; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_DS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_DS_OUTPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_FILTER_REDUCTION_TYPE_MASK: ::UINT = 0x3; +pub const D3D12_FILTER_REDUCTION_TYPE_SHIFT: ::UINT = 7; +pub const D3D12_FILTER_TYPE_MASK: ::UINT = 0x3; +pub const D3D12_FLOAT16_FUSED_TOLERANCE_IN_ULP: ::DOUBLE = 0.6; +pub const D3D12_FLOAT32_MAX: ::FLOAT = 3.402823466e+38; +pub const D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP: ::FLOAT = 0.6; +pub const D3D12_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR: ::FLOAT = 2.4; +pub const D3D12_FLOAT_TO_SRGB_EXPONENT_NUMERATOR: ::FLOAT = 1.0; +pub const D3D12_FLOAT_TO_SRGB_OFFSET: ::FLOAT = 0.055; +pub const D3D12_FLOAT_TO_SRGB_SCALE_1: ::FLOAT = 12.92; +pub const D3D12_FLOAT_TO_SRGB_SCALE_2: ::FLOAT = 1.055; +pub const D3D12_FLOAT_TO_SRGB_THRESHOLD: ::FLOAT = 0.0031308; +pub const D3D12_FTOI_INSTRUCTION_MAX_INPUT: ::FLOAT = 2147483647.999; +pub const D3D12_FTOI_INSTRUCTION_MIN_INPUT: ::FLOAT = -2147483648.999; +pub const D3D12_FTOU_INSTRUCTION_MAX_INPUT: ::FLOAT = 4294967295.999; +pub const D3D12_FTOU_INSTRUCTION_MIN_INPUT: ::FLOAT = 0.0; +pub const D3D12_GS_INPUT_INSTANCE_ID_READS_PER_INST: ::UINT = 2; +pub const D3D12_GS_INPUT_INSTANCE_ID_READ_PORTS: ::UINT = 1; +pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_GS_INPUT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_GS_INPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_GS_INPUT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_GS_INPUT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_GS_INPUT_REGISTER_VERTICES: ::UINT = 32; +pub const D3D12_GS_MAX_INSTANCE_COUNT: ::UINT = 32; +pub const D3D12_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES: ::UINT = 1024; +pub const D3D12_GS_OUTPUT_ELEMENTS: ::UINT = 32; +pub const D3D12_GS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_GS_OUTPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_HS_CONTROL_POINT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_HS_CONTROL_POINT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_HS_CONTROL_POINT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND: ::UINT = 0xffffffff; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND: ::UINT = 0xffffffff; +pub const D3D12_HS_MAXTESSFACTOR_LOWER_BOUND: ::FLOAT = 1.0; +pub const D3D12_HS_MAXTESSFACTOR_UPPER_BOUND: ::FLOAT = 64.0; +pub const D3D12_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: ::UINT = 3968; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS: ::UINT = 128; +pub const D3D12_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES: ::UINT = 0; +pub const D3D12_IA_DEFAULT_PRIMITIVE_TOPOLOGY: ::UINT = 0; +pub const D3D12_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES: ::UINT = 0; +pub const D3D12_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT: ::UINT = 1; +pub const D3D12_IA_INSTANCE_ID_BIT_COUNT: ::UINT = 32; +pub const D3D12_IA_INTEGER_ARITHMETIC_BIT_COUNT: ::UINT = 32; +pub const D3D12_IA_PATCH_MAX_CONTROL_POINT_COUNT: ::UINT = 32; +pub const D3D12_IA_PRIMITIVE_ID_BIT_COUNT: ::UINT = 32; +pub const D3D12_IA_VERTEX_ID_BIT_COUNT: ::UINT = 32; +pub const D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT: ::UINT = 32; +pub const D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS: ::UINT = 128; +pub const D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT: ::UINT = 32; +pub const D3D12_INTEGER_DIVIDE_BY_ZERO_QUOTIENT: ::UINT = 0xffffffff; +pub const D3D12_INTEGER_DIVIDE_BY_ZERO_REMAINDER: ::UINT = 0xffffffff; +pub const D3D12_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL: ::UINT = 0xffffffff; +pub const D3D12_KEEP_UNORDERED_ACCESS_VIEWS: ::UINT = 0xffffffff; +pub const D3D12_LINEAR_GAMMA: ::FLOAT = 1.0; +pub const D3D12_MAG_FILTER_SHIFT: ::UINT = 2; +pub const D3D12_MAJOR_VERSION: ::UINT = 12; +pub const D3D12_MAX_BORDER_COLOR_COMPONENT: ::FLOAT = 1.0; +pub const D3D12_MAX_DEPTH: ::FLOAT = 1.0; +pub const D3D12_MAX_LIVE_STATIC_SAMPLERS: ::UINT = 2032; +pub const D3D12_MAX_MAXANISOTROPY: ::UINT = 16; +pub const D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT: ::UINT = 32; +pub const D3D12_MAX_POSITION_VALUE: ::FLOAT = 3.402823466e+34; +pub const D3D12_MAX_ROOT_COST: ::UINT = 64; +pub const D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1: ::UINT = 1000000; +pub const D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2: ::UINT = 1000000; +pub const D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE: ::UINT = 2048; +pub const D3D12_MAX_TEXTURE_DIMENSION_2_TO_EXP: ::UINT = 17; +pub const D3D12_MINOR_VERSION: ::UINT = 0; +pub const D3D12_MIN_BORDER_COLOR_COMPONENT: ::FLOAT = 0.0; +pub const D3D12_MIN_DEPTH: ::FLOAT = 0.0; +pub const D3D12_MIN_FILTER_SHIFT: ::UINT = 4; +pub const D3D12_MIN_MAXANISOTROPY: ::UINT = 0; +pub const D3D12_MIP_FILTER_SHIFT: ::UINT = 0; +pub const D3D12_MIP_LOD_BIAS_MAX: ::FLOAT = 15.99; +pub const D3D12_MIP_LOD_BIAS_MIN: ::FLOAT = -16.0; +pub const D3D12_MIP_LOD_FRACTIONAL_BIT_COUNT: ::UINT = 8; +pub const D3D12_MIP_LOD_RANGE_BIT_COUNT: ::UINT = 8; +pub const D3D12_MULTISAMPLE_ANTIALIAS_LINE_WIDTH: ::FLOAT = 1.4; +pub const D3D12_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT: ::UINT = 0; +pub const D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_END: ::UINT = 0xffffffff; +pub const D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_START: ::UINT = 0xfffffff8; +pub const D3D12_PACKED_TILE: ::UINT = 0xffffffff; +pub const D3D12_PIXEL_ADDRESS_RANGE_BIT_COUNT: ::UINT = 15; +pub const D3D12_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT: ::UINT = 16; +pub const D3D12_PS_CS_UAV_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_PS_CS_UAV_REGISTER_COUNT: ::UINT = 8; +pub const D3D12_PS_CS_UAV_REGISTER_READS_PER_INST: ::UINT = 1; +pub const D3D12_PS_CS_UAV_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_PS_FRONTFACING_DEFAULT_VALUE: ::UINT = 0xffffffff; +pub const D3D12_PS_FRONTFACING_FALSE_VALUE: ::UINT = 0; +pub const D3D12_PS_FRONTFACING_TRUE_VALUE: ::UINT = 0xffffffff; +pub const D3D12_PS_INPUT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_PS_INPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_PS_INPUT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_PS_INPUT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT: ::FLOAT = 0.0; +pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENTS: ::UINT = 1; +pub const D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_PS_OUTPUT_MASK_REGISTER_COUNT: ::UINT = 1; +pub const D3D12_PS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_PS_OUTPUT_REGISTER_COUNT: ::UINT = 8; +pub const D3D12_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT: ::FLOAT = 0.5; +pub const D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT: ::UINT = 16; +pub const D3D12_REQ_BLEND_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; +pub const D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP: ::UINT = 27; +pub const D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT: ::UINT = 4096; +pub const D3D12_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; +pub const D3D12_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: ::UINT = 32; +pub const D3D12_REQ_DRAW_VERTEX_COUNT_2_TO_EXP: ::UINT = 32; +pub const D3D12_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION: ::UINT = 16384; +pub const D3D12_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT: ::UINT = 1024; +pub const D3D12_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT: ::UINT = 4096; +pub const D3D12_REQ_MAXANISOTROPY: ::UINT = 16; +pub const D3D12_REQ_MIP_LEVELS: ::UINT = 15; +pub const D3D12_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES: ::UINT = 2048; +pub const D3D12_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; +pub const D3D12_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH: ::UINT = 16384; +pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM: ::UINT = 128; +pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM: ::FLOAT = 0.25; +pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM: ::UINT = 2048; +pub const D3D12_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP: ::UINT = 20; +pub const D3D12_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; +pub const D3D12_REQ_SUBRESOURCES: ::UINT = 30720; +pub const D3D12_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION: ::UINT = 2048; +pub const D3D12_REQ_TEXTURE1D_U_DIMENSION: ::UINT = 16384; +pub const D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION: ::UINT = 2048; +pub const D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION: ::UINT = 16384; +pub const D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION: ::UINT = 2048; +pub const D3D12_REQ_TEXTURECUBE_DIMENSION: ::UINT = 16384; +pub const D3D12_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL: ::UINT = 0; +pub const D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES: ::UINT = 0xffffffff; +pub const D3D12_SHADER_COMPONENT_MAPPING_MASK: ::UINT = 0x7; +pub const D3D12_SHADER_COMPONENT_MAPPING_SHIFT: ::UINT = 3; +pub const D3D12_SHADER_MAJOR_VERSION: ::UINT = 5; +pub const D3D12_SHADER_MAX_INSTANCES: ::UINT = 65535; +pub const D3D12_SHADER_MAX_INTERFACES: ::UINT = 253; +pub const D3D12_SHADER_MAX_INTERFACE_CALL_SITES: ::UINT = 4096; +pub const D3D12_SHADER_MAX_TYPES: ::UINT = 65535; +pub const D3D12_SHADER_MINOR_VERSION: ::UINT = 1; +pub const D3D12_SHIFT_INSTRUCTION_PAD_VALUE: ::UINT = 0; +pub const D3D12_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT: ::UINT = 5; +pub const D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT: ::UINT = 8; +pub const D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 65536; +pub const D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 4096; +pub const D3D12_SO_BUFFER_MAX_STRIDE_IN_BYTES: ::UINT = 2048; +pub const D3D12_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES: ::UINT = 512; +pub const D3D12_SO_BUFFER_SLOT_COUNT: ::UINT = 4; +pub const D3D12_SO_DDI_REGISTER_INDEX_DENOTING_GAP: ::UINT = 0xffffffff; +pub const D3D12_SO_NO_RASTERIZED_STREAM: ::UINT = 0xffffffff; +pub const D3D12_SO_OUTPUT_COMPONENT_COUNT: ::UINT = 128; +pub const D3D12_SO_STREAM_COUNT: ::UINT = 4; +pub const D3D12_SPEC_DATE_DAY: ::UINT = 14; +pub const D3D12_SPEC_DATE_MONTH: ::UINT = 11; +pub const D3D12_SPEC_DATE_YEAR: ::UINT = 2014; +pub const D3D12_SPEC_VERSION: ::DOUBLE = 1.16; +pub const D3D12_SRGB_GAMMA: ::FLOAT = 2.2; +pub const D3D12_SRGB_TO_FLOAT_DENOMINATOR_1: ::FLOAT = 12.92; +pub const D3D12_SRGB_TO_FLOAT_DENOMINATOR_2: ::FLOAT = 1.055; +pub const D3D12_SRGB_TO_FLOAT_EXPONENT: ::FLOAT = 2.4; +pub const D3D12_SRGB_TO_FLOAT_OFFSET: ::FLOAT = 0.055; +pub const D3D12_SRGB_TO_FLOAT_THRESHOLD: ::FLOAT = 0.04045; +pub const D3D12_SRGB_TO_FLOAT_TOLERANCE_IN_ULP: ::FLOAT = 0.5; +pub const D3D12_STANDARD_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_STANDARD_COMPONENT_BIT_COUNT_DOUBLED: ::UINT = 64; +pub const D3D12_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE: ::UINT = 4; +pub const D3D12_STANDARD_PIXEL_COMPONENT_COUNT: ::UINT = 128; +pub const D3D12_STANDARD_PIXEL_ELEMENT_COUNT: ::UINT = 32; +pub const D3D12_STANDARD_VECTOR_SIZE: ::UINT = 4; +pub const D3D12_STANDARD_VERTEX_ELEMENT_COUNT: ::UINT = 32; +pub const D3D12_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT: ::UINT = 64; +pub const D3D12_SUBPIXEL_FRACTIONAL_BIT_COUNT: ::UINT = 8; +pub const D3D12_SUBTEXEL_FRACTIONAL_BIT_COUNT: ::UINT = 8; +pub const D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_END: ::UINT = 0xffffffff; +pub const D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_START: ::UINT = 0xfffffff0; +pub const D3D12_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR: ::UINT = 64; +pub const D3D12_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR: ::UINT = 64; +pub const D3D12_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR: ::UINT = 63; +pub const D3D12_TESSELLATOR_MAX_TESSELLATION_FACTOR: ::UINT = 64; +pub const D3D12_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR: ::UINT = 2; +pub const D3D12_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR: ::UINT = 1; +pub const D3D12_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR: ::UINT = 1; +pub const D3D12_TEXEL_ADDRESS_RANGE_BIT_COUNT: ::UINT = 16; +pub const D3D12_TEXTURE_DATA_PITCH_ALIGNMENT: ::UINT = 256; +pub const D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT: ::UINT = 512; +pub const D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES: ::UINT = 65536; +pub const D3D12_UAV_COUNTER_PLACEMENT_ALIGNMENT: ::UINT = 4096; +pub const D3D12_UAV_SLOT_COUNT: ::UINT = 64; +pub const D3D12_UNBOUND_MEMORY_ACCESS_RESULT: ::UINT = 0; +pub const D3D12_VIEWPORT_AND_SCISSORRECT_MAX_INDEX: ::UINT = 15; +pub const D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE: ::UINT = 16; +pub const D3D12_VIEWPORT_BOUNDS_MAX: ::UINT = 32767; +pub const D3D12_VIEWPORT_BOUNDS_MIN: ::INT = -32768; +pub const D3D12_VS_INPUT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_VS_INPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_VS_INPUT_REGISTER_READS_PER_INST: ::UINT = 2; +pub const D3D12_VS_INPUT_REGISTER_READ_PORTS: ::UINT = 1; +pub const D3D12_VS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; +pub const D3D12_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; +pub const D3D12_VS_OUTPUT_REGISTER_COUNT: ::UINT = 32; +pub const D3D12_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT: ::UINT = 10; +pub const D3D12_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: ::UINT = 25; +pub const D3D12_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP: ::UINT = 25; +pub type D3D12_GPU_VIRTUAL_ADDRESS = ::UINT64; +ENUM!{enum D3D12_COMMAND_LIST_TYPE { + D3D12_COMMAND_LIST_TYPE_DIRECT = 0, + D3D12_COMMAND_LIST_TYPE_BUNDLE = 1, + D3D12_COMMAND_LIST_TYPE_COMPUTE = 2, + D3D12_COMMAND_LIST_TYPE_COPY = 3, +}} +FLAGS!{enum D3D12_COMMAND_QUEUE_FLAGS { + D3D12_COMMAND_QUEUE_FLAG_NONE = 0x0, + D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT = 0x1, +}} +ENUM!{enum D3D12_COMMAND_QUEUE_PRIORITY { + D3D12_COMMAND_QUEUE_PRIORITY_NORMAL = 0, + D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100, +}} +STRUCT!{struct D3D12_COMMAND_QUEUE_DESC { + Type: D3D12_COMMAND_LIST_TYPE, + Priority: ::INT, + Flags: D3D12_COMMAND_QUEUE_FLAGS, + NodeMask: ::UINT, +}} +ENUM!{enum D3D12_PRIMITIVE_TOPOLOGY_TYPE { + D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED = 0, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT = 1, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE = 2, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE = 3, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH = 4, +}} +ENUM!{enum D3D12_INPUT_CLASSIFICATION { + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA = 0, + D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA = 1, +}} +STRUCT!{struct D3D12_INPUT_ELEMENT_DESC { + SemanticName: ::LPCSTR, + SemanticIndex: ::UINT, + Format: ::DXGI_FORMAT, + InputSlot: ::UINT, + AlignedByteOffset: ::UINT, + InputSlotClass: D3D12_INPUT_CLASSIFICATION, + InstanceDataStepRate: ::UINT, +}} +ENUM!{enum D3D12_FILL_MODE { + D3D12_FILL_MODE_WIREFRAME = 2, + D3D12_FILL_MODE_SOLID = 3, +}} +pub type D3D12_PRIMITIVE_TOPOLOGY = ::D3D_PRIMITIVE_TOPOLOGY; +pub type D3D12_PRIMITIVE = ::D3D_PRIMITIVE; +ENUM!{enum D3D12_CULL_MODE { + D3D12_CULL_MODE_NONE = 1, + D3D12_CULL_MODE_FRONT = 2, + D3D12_CULL_MODE_BACK = 3, +}} +STRUCT!{struct D3D12_SO_DECLARATION_ENTRY { + Stream: ::UINT, + SemanticName: ::LPCSTR, + SemanticIndex: ::UINT, + StartComponent: ::BYTE, + ComponentCount: ::BYTE, + OutputSlot: ::BYTE, +}} +STRUCT!{struct D3D12_VIEWPORT { + TopLeftX: ::FLOAT, + TopLeftY: ::FLOAT, + Width: ::FLOAT, + Height: ::FLOAT, + MinDepth: ::FLOAT, + MaxDepth: ::FLOAT, +}} +pub type D3D12_RECT = ::RECT; +STRUCT!{struct D3D12_BOX { + left: ::UINT, + top: ::UINT, + front: ::UINT, + right: ::UINT, + bottom: ::UINT, + back: ::UINT, +}} +ENUM!{enum D3D12_COMPARISON_FUNC { + D3D12_COMPARISON_FUNC_NEVER = 1, + D3D12_COMPARISON_FUNC_LESS = 2, + D3D12_COMPARISON_FUNC_EQUAL = 3, + D3D12_COMPARISON_FUNC_LESS_EQUAL = 4, + D3D12_COMPARISON_FUNC_GREATER = 5, + D3D12_COMPARISON_FUNC_NOT_EQUAL = 6, + D3D12_COMPARISON_FUNC_GREATER_EQUAL = 7, + D3D12_COMPARISON_FUNC_ALWAYS = 8, +}} +ENUM!{enum D3D12_DEPTH_WRITE_MASK { + D3D12_DEPTH_WRITE_MASK_ZERO = 0, + D3D12_DEPTH_WRITE_MASK_ALL = 1, +}} +ENUM!{enum D3D12_STENCIL_OP { + D3D12_STENCIL_OP_KEEP = 1, + D3D12_STENCIL_OP_ZERO = 2, + D3D12_STENCIL_OP_REPLACE = 3, + D3D12_STENCIL_OP_INCR_SAT = 4, + D3D12_STENCIL_OP_DECR_SAT = 5, + D3D12_STENCIL_OP_INVERT = 6, + D3D12_STENCIL_OP_INCR = 7, + D3D12_STENCIL_OP_DECR = 8, +}} +STRUCT!{struct D3D12_DEPTH_STENCILOP_DESC { + StencilFailOp: D3D12_STENCIL_OP, + StencilDepthFailOp: D3D12_STENCIL_OP, + StencilPassOp: D3D12_STENCIL_OP, + StencilFunc: D3D12_COMPARISON_FUNC, +}} +STRUCT!{struct D3D12_DEPTH_STENCIL_DESC { + DepthEnable: ::BOOL, + DepthWriteMask: D3D12_DEPTH_WRITE_MASK, + DepthFunc: D3D12_COMPARISON_FUNC, + StencilEnable: ::BOOL, + StencilReadMask: ::UINT8, + StencilWriteMask: ::UINT8, + FrontFace: D3D12_DEPTH_STENCILOP_DESC, + BackFace: D3D12_DEPTH_STENCILOP_DESC, +}} +ENUM!{enum D3D12_BLEND { + D3D12_BLEND_ZERO = 1, + D3D12_BLEND_ONE = 2, + D3D12_BLEND_SRC_COLOR = 3, + D3D12_BLEND_INV_SRC_COLOR = 4, + D3D12_BLEND_SRC_ALPHA = 5, + D3D12_BLEND_INV_SRC_ALPHA = 6, + D3D12_BLEND_DEST_ALPHA = 7, + D3D12_BLEND_INV_DEST_ALPHA = 8, + D3D12_BLEND_DEST_COLOR = 9, + D3D12_BLEND_INV_DEST_COLOR = 10, + D3D12_BLEND_SRC_ALPHA_SAT = 11, + D3D12_BLEND_BLEND_FACTOR = 14, + D3D12_BLEND_INV_BLEND_FACTOR = 15, + D3D12_BLEND_SRC1_COLOR = 16, + D3D12_BLEND_INV_SRC1_COLOR = 17, + D3D12_BLEND_SRC1_ALPHA = 18, + D3D12_BLEND_INV_SRC1_ALPHA = 19, +}} +ENUM!{enum D3D12_BLEND_OP { + D3D12_BLEND_OP_ADD = 1, + D3D12_BLEND_OP_SUBTRACT = 2, + D3D12_BLEND_OP_REV_SUBTRACT = 3, + D3D12_BLEND_OP_MIN = 4, + D3D12_BLEND_OP_MAX = 5, +}} +FLAGS!{enum D3D12_COLOR_WRITE_ENABLE { + D3D12_COLOR_WRITE_ENABLE_RED = 0x1, + D3D12_COLOR_WRITE_ENABLE_GREEN = 0x2, + D3D12_COLOR_WRITE_ENABLE_BLUE = 0x4, + D3D12_COLOR_WRITE_ENABLE_ALPHA = 0x8, + D3D12_COLOR_WRITE_ENABLE_ALL = 0xF, +}} +ENUM!{enum D3D12_LOGIC_OP { + D3D12_LOGIC_OP_CLEAR = 0, + D3D12_LOGIC_OP_SET = 1, + D3D12_LOGIC_OP_COPY = 2, + D3D12_LOGIC_OP_COPY_INVERTED = 3, + D3D12_LOGIC_OP_NOOP = 4, + D3D12_LOGIC_OP_INVERT = 5, + D3D12_LOGIC_OP_AND = 6, + D3D12_LOGIC_OP_NAND = 7, + D3D12_LOGIC_OP_OR = 8, + D3D12_LOGIC_OP_NOR = 9, + D3D12_LOGIC_OP_XOR = 10, + D3D12_LOGIC_OP_EQUIV = 11, + D3D12_LOGIC_OP_AND_REVERSE = 12, + D3D12_LOGIC_OP_AND_INVERTED = 13, + D3D12_LOGIC_OP_OR_REVERSE = 14, + D3D12_LOGIC_OP_OR_INVERTED = 15, +}} +STRUCT!{struct D3D12_RENDER_TARGET_BLEND_DESC { + BlendEnable: ::BOOL, + LogicOpEnable: ::BOOL, + SrcBlend: D3D12_BLEND, + DestBlend: D3D12_BLEND, + BlendOp: D3D12_BLEND_OP, + SrcBlendAlpha: D3D12_BLEND, + DestBlendAlpha: D3D12_BLEND, + BlendOpAlpha: D3D12_BLEND_OP, + LogicOp: D3D12_LOGIC_OP, + RenderTargetWriteMask: ::UINT8, +}} +STRUCT!{struct D3D12_BLEND_DESC { + AlphaToCoverageEnable: ::BOOL, + IndependentBlendEnable: ::BOOL, + RenderTarget: [D3D12_RENDER_TARGET_BLEND_DESC; 8], +}} +ENUM!{enum D3D12_CONSERVATIVE_RASTERIZATION_MODE { + D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF = 0, + D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON = 1, +}} +STRUCT!{struct D3D12_RASTERIZER_DESC { + FillMode: D3D12_FILL_MODE, + CullMode: D3D12_CULL_MODE, + FrontCounterClockwise: ::BOOL, + DepthBias: ::INT, + DepthBiasClamp: ::FLOAT, + SlopeScaledDepthBias: ::FLOAT, + DepthClipEnable: ::BOOL, + MultisampleEnable: ::BOOL, + AntialiasedLineEnable: ::BOOL, + ForcedSampleCount: ::UINT, + ConservativeRaster: D3D12_CONSERVATIVE_RASTERIZATION_MODE, +}} +RIDL!{interface ID3D12Object(ID3D12ObjectVtbl): IUnknown(IUnknownVtbl) { + fn GetPrivateData( + &mut self, guid: ::REFGUID, pDataSize: *mut ::UINT, pData: *mut ::c_void + ) -> ::HRESULT, + fn SetPrivateData( + &mut self, guid: ::REFGUID, DataSize: ::UINT, pData: *const ::c_void + ) -> ::HRESULT, + fn SetPrivateDataInterface( + &mut self, guid: ::REFGUID, pData: *const ::IUnknown + ) -> ::HRESULT, + fn SetName(&mut self, Name: ::LPCWSTR) -> ::HRESULT +}} +RIDL!{interface ID3D12DeviceChild(ID3D12DeviceChildVtbl): ID3D12Object(ID3D12ObjectVtbl) { + fn GetDevice( + &mut self, riid: ::REFGUID, ppvDevice: *mut *mut ::c_void + ) -> ::HRESULT +}} +RIDL!{interface ID3D12RootSignature(ID3D12RootSignatureVtbl): + ID3D12DeviceChild(ID3D12DeviceChildVtbl) { +}} +STRUCT!{struct D3D12_SHADER_BYTECODE { + pShaderBytecode: *const ::c_void, + BytecodeLength: ::SIZE_T, +}} +STRUCT!{struct D3D12_STREAM_OUTPUT_DESC { + pSODeclaration: *const D3D12_SO_DECLARATION_ENTRY, + NumEntries: ::UINT, + pBufferStrides: *const ::UINT, + NumStrides: ::UINT, + RasterizedStream: ::UINT, +}} +STRUCT!{struct D3D12_INPUT_LAYOUT_DESC { + pInputElementDescs: *const D3D12_INPUT_ELEMENT_DESC, + NumElements: ::UINT, +}} +ENUM!{enum D3D12_INDEX_BUFFER_STRIP_CUT_VALUE { + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED = 0, + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF = 1, + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF = 2, +}} +STRUCT!{struct D3D12_CACHED_PIPELINE_STATE { + pCachedBlob: *const ::c_void, + CachedBlobSizeInBytes: ::SIZE_T, +}} +FLAGS!{enum D3D12_PIPELINE_STATE_FLAGS { + D3D12_PIPELINE_STATE_FLAG_NONE = 0x0, + D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG = 0x1, +}} +STRUCT!{struct D3D12_GRAPHICS_PIPELINE_STATE_DESC { + pRootSignature: *mut ID3D12RootSignature, + VS: D3D12_SHADER_BYTECODE, + PS: D3D12_SHADER_BYTECODE, + DS: D3D12_SHADER_BYTECODE, + HS: D3D12_SHADER_BYTECODE, + GS: D3D12_SHADER_BYTECODE, + StreamOutput: D3D12_STREAM_OUTPUT_DESC, + BlendState: D3D12_BLEND_DESC, + SampleMask: ::UINT, + RasterizerState: D3D12_RASTERIZER_DESC, + DepthStencilState: D3D12_DEPTH_STENCIL_DESC, + InputLayout: D3D12_INPUT_LAYOUT_DESC, + IBStripCutValue: D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, + PrimitiveTopologyType: D3D12_PRIMITIVE_TOPOLOGY_TYPE, + NumRenderTargets: ::UINT, + RTVFormats: [::DXGI_FORMAT; 8], + DSVFormat: ::DXGI_FORMAT, + SampleDesc: ::DXGI_SAMPLE_DESC, + NodeMask: ::UINT, + CachedPSO: D3D12_CACHED_PIPELINE_STATE, + Flags: D3D12_PIPELINE_STATE_FLAGS, +}} +STRUCT!{struct D3D12_COMPUTE_PIPELINE_STATE_DESC { + pRootSignature: *mut ID3D12RootSignature, + CS: D3D12_SHADER_BYTECODE, + NodeMask: ::UINT, + CachedPSO: D3D12_CACHED_PIPELINE_STATE, + Flags: D3D12_PIPELINE_STATE_FLAGS, +}} +ENUM!{enum D3D12_FEATURE { + D3D12_FEATURE_D3D12_OPTIONS = 0, + D3D12_FEATURE_ARCHITECTURE = 1, + D3D12_FEATURE_FEATURE_LEVELS = 2, + D3D12_FEATURE_FORMAT_SUPPORT = 3, + D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS = 4, + D3D12_FEATURE_FORMAT_INFO = 5, + D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = 6, +}} +FLAGS!{enum D3D12_SHADER_MIN_PRECISION_SUPPORT { + D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE = 0, + D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT = 0x1, + D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT = 0x2, +}} +ENUM!{enum D3D12_TILED_RESOURCES_TIER { + D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED = 0, + D3D12_TILED_RESOURCES_TIER_1 = 1, + D3D12_TILED_RESOURCES_TIER_2 = 2, + D3D12_TILED_RESOURCES_TIER_3 = 3, +}} +ENUM!{enum D3D12_RESOURCE_BINDING_TIER { + D3D12_RESOURCE_BINDING_TIER_1 = 1, + D3D12_RESOURCE_BINDING_TIER_2 = 2, + D3D12_RESOURCE_BINDING_TIER_3 = 3, +}} +ENUM!{enum D3D12_CONSERVATIVE_RASTERIZATION_TIER { + D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED = 0, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_1 = 1, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_3 = 3, +}} +FLAGS!{enum D3D12_FORMAT_SUPPORT1 { + D3D12_FORMAT_SUPPORT1_NONE = 0x0, + D3D12_FORMAT_SUPPORT1_BUFFER = 0x1, + D3D12_FORMAT_SUPPORT1_IA_VERTEX_BUFFER = 0x2, + D3D12_FORMAT_SUPPORT1_IA_INDEX_BUFFER = 0x4, + D3D12_FORMAT_SUPPORT1_SO_BUFFER = 0x8, + D3D12_FORMAT_SUPPORT1_TEXTURE1D = 0x10, + D3D12_FORMAT_SUPPORT1_TEXTURE2D = 0x20, + D3D12_FORMAT_SUPPORT1_TEXTURE3D = 0x40, + D3D12_FORMAT_SUPPORT1_TEXTURECUBE = 0x80, + D3D12_FORMAT_SUPPORT1_SHADER_LOAD = 0x100, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE = 0x200, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON = 0x400, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D12_FORMAT_SUPPORT1_MIP = 0x1000, + D3D12_FORMAT_SUPPORT1_RENDER_TARGET = 0x4000, + D3D12_FORMAT_SUPPORT1_BLENDABLE = 0x8000, + D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL = 0x10000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE = 0x40000, + D3D12_FORMAT_SUPPORT1_DISPLAY = 0x80000, + D3D12_FORMAT_SUPPORT1_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_LOAD = 0x400000, + D3D12_FORMAT_SUPPORT1_SHADER_GATHER = 0x800000, + D3D12_FORMAT_SUPPORT1_BACK_BUFFER_CAST = 0x1000000, + D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, + D3D12_FORMAT_SUPPORT1_SHADER_GATHER_COMPARISON = 0x4000000, + D3D12_FORMAT_SUPPORT1_DECODER_OUTPUT = 0x8000000, + D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_OUTPUT = 0x10000000, + D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_INPUT = 0x20000000, + D3D12_FORMAT_SUPPORT1_VIDEO_ENCODER = 0x40000000, +}} +FLAGS!{enum D3D12_FORMAT_SUPPORT2 { + D3D12_FORMAT_SUPPORT2_NONE = 0x0, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, + D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, + D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, + D3D12_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, + D3D12_FORMAT_SUPPORT2_TILED = 0x200, + D3D12_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, +}} +FLAGS!{enum D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS { + D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE = 0x0, + D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_TILED_RESOURCE = 0x1, +}} +ENUM!{enum D3D12_CROSS_NODE_SHARING_TIER { + D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED = 0, + D3D12_CROSS_NODE_SHARING_TIER_1_EMULATED = 1, + D3D12_CROSS_NODE_SHARING_TIER_1 = 2, + D3D12_CROSS_NODE_SHARING_TIER_2 = 3, +}} +ENUM!{enum D3D12_RESOURCE_HEAP_TIER { + D3D12_RESOURCE_HEAP_TIER_1 = 1, + D3D12_RESOURCE_HEAP_TIER_2 = 2, +}} +STRUCT!{struct D3D12_FEATURE_DATA_D3D12_OPTIONS { + DoublePrecisionFloatShaderOps: ::BOOL, + OutputMergerLogicOp: ::BOOL, + MinPrecisionSupport: D3D12_SHADER_MIN_PRECISION_SUPPORT, + TiledResourcesTier: D3D12_TILED_RESOURCES_TIER, + ResourceBindingTier: D3D12_RESOURCE_BINDING_TIER, + PSSpecifiedStencilRefSupported: ::BOOL, + TypedUAVLoadAdditionalFormats: ::BOOL, + ROVsSupported: ::BOOL, + ConservativeRasterizationTier: D3D12_CONSERVATIVE_RASTERIZATION_TIER, + MaxGPUVirtualAddressBitsPerResource: ::UINT, + StandardSwizzle64KBSupported: ::BOOL, + CrossNodeSharingTier: D3D12_CROSS_NODE_SHARING_TIER, + CrossAdapterRowMajorTextureSupported: ::BOOL, + VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation: ::BOOL, + ResourceHeapTier: D3D12_RESOURCE_HEAP_TIER, +}} + + + + + + + + + +FLAGS!{ enum D3D12_BUFFER_SRV_FLAGS { + D3D12_BUFFER_SRV_FLAG_NONE = 0x0, + D3D12_BUFFER_SRV_FLAG_RAW = 0x1, +}} + +FLAGS!{ enum D3D12_BUFFER_UAV_FLAGS { + D3D12_BUFFER_UAV_FLAG_NONE = 0x0, + D3D12_BUFFER_UAV_FLAG_RAW = 0x1, +}} + +FLAGS!{ enum D3D12_CLEAR_FLAGS { + D3D12_CLEAR_FLAG_DEPTH = 0x1, + D3D12_CLEAR_FLAG_STENCIL = 0x2, +}} + + +ENUM!{ enum D3D12_CPU_PAGE_PROPERTY { + D3D12_CPU_PAGE_PROPERTY_UNKNOWN = 0, + D3D12_CPU_PAGE_PROPERTY_NOT_AVAILABLE = 1, + D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE = 2, + D3D12_CPU_PAGE_PROPERTY_WRITE_BACK = 3, +}} + + +FLAGS!{ enum D3D12_DESCRIPTOR_HEAP_FLAGS { + D3D12_DESCRIPTOR_HEAP_FLAG_NONE = 0x0, + D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE = 0x1, +}} + +ENUM!{ enum D3D12_DESCRIPTOR_HEAP_TYPE { + D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV = 0, + D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER = 1, + D3D12_DESCRIPTOR_HEAP_TYPE_RTV = 2, + D3D12_DESCRIPTOR_HEAP_TYPE_DSV = 3, + D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES = 4, +}} + +ENUM!{ enum D3D12_DESCRIPTOR_RANGE_TYPE { + D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, + D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1, + D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2, + D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER = 3, +}} + +ENUM!{ enum D3D12_DSV_DIMENSION { + D3D12_DSV_DIMENSION_UNKNOWN = 0, + D3D12_DSV_DIMENSION_TEXTURE1D = 1, + D3D12_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D12_DSV_DIMENSION_TEXTURE2D = 3, + D3D12_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D12_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, +}} + +FLAGS!{ enum D3D12_DSV_FLAGS { + D3D12_DSV_FLAG_NONE = 0x0, + D3D12_DSV_FLAG_READ_ONLY_DEPTH = 0x1, + D3D12_DSV_FLAG_READ_ONLY_STENCIL = 0x2, +}} + + + +FLAGS!{ enum D3D12_FENCE_FLAGS { + D3D12_FENCE_FLAG_NONE = 0x0, + D3D12_FENCE_FLAG_SHARED = 0x1, + D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x2, +}} + + + +ENUM!{ enum D3D12_FILTER { + D3D12_FILTER_MIN_MAG_MIP_POINT = 0, + D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR = 1, + D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 4, + D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR = 5, + D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT = 16, + D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 17, + D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT = 20, + D3D12_FILTER_MIN_MAG_MIP_LINEAR = 21, + D3D12_FILTER_ANISOTROPIC = 85, + D3D12_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 128, + D3D12_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 129, + D3D12_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 132, + D3D12_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 133, + D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 144, + D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 145, + D3D12_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 148, + D3D12_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 149, + D3D12_FILTER_COMPARISON_ANISOTROPIC = 213, + D3D12_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 256, + D3D12_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 257, + D3D12_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 260, + D3D12_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 261, + D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 272, + D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 273, + D3D12_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 276, + D3D12_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 277, + D3D12_FILTER_MINIMUM_ANISOTROPIC = 341, + D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 384, + D3D12_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 385, + D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 388, + D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 389, + D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 400, + D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 401, + D3D12_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 404, + D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 405, + D3D12_FILTER_MAXIMUM_ANISOTROPIC = 469, +}} + +ENUM!{ enum D3D12_FILTER_REDUCTION_TYPE { + D3D12_FILTER_REDUCTION_TYPE_STANDARD = 0, + D3D12_FILTER_REDUCTION_TYPE_COMPARISON = 1, + D3D12_FILTER_REDUCTION_TYPE_MINIMUM = 2, + D3D12_FILTER_REDUCTION_TYPE_MAXIMUM = 3, +}} + +ENUM!{ enum D3D12_FILTER_TYPE { + D3D12_FILTER_TYPE_POINT = 0, + D3D12_FILTER_TYPE_LINEAR = 1, +}} + + + +FLAGS!{ enum D3D12_HEAP_FLAGS { + D3D12_HEAP_FLAG_NONE = 0x0, + D3D12_HEAP_FLAG_SHARED = 0x1, + D3D12_HEAP_FLAG_DENY_BUFFERS = 0x4, + D3D12_HEAP_FLAG_ALLOW_DISPLAY = 0x8, + D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER = 0x20, + D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES = 0x40, + D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES = 0x80, + D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES = 0x0, + D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS = 0xC0, + D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = 0x44, + D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES = 0x84, +}} + +ENUM!{ enum D3D12_HEAP_TYPE { + D3D12_HEAP_TYPE_DEFAULT = 1, + D3D12_HEAP_TYPE_UPLOAD = 2, + D3D12_HEAP_TYPE_READBACK = 3, + D3D12_HEAP_TYPE_CUSTOM = 4, +}} + + + +ENUM!{ enum D3D12_INDIRECT_ARGUMENT_TYPE { + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW = 0, + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED = 1, + D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH = 2, + D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW = 3, + D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW = 4, + D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT = 5, + D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW = 6, + D3D12_INDIRECT_ARGUMENT_TYPE_SHADER_RESOURCE_VIEW = 7, + D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW = 8, +}} + + + + + +ENUM!{ enum D3D12_MEMORY_POOL { + D3D12_MEMORY_POOL_UNKNOWN = 0, + D3D12_MEMORY_POOL_L0 = 1, + D3D12_MEMORY_POOL_L1 = 2, +}} + + + + +ENUM!{ enum D3D12_PREDICATION_OP { + D3D12_PREDICATION_OP_EQUAL_ZERO = 0, + D3D12_PREDICATION_OP_NOT_EQUAL_ZERO = 1, +}} + + + +ENUM!{ enum D3D12_QUERY_HEAP_TYPE { + D3D12_QUERY_HEAP_TYPE_OCCLUSION = 0, + D3D12_QUERY_HEAP_TYPE_TIMESTAMP = 1, + D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS = 2, + D3D12_QUERY_HEAP_TYPE_SO_STATISTICS = 3, +}} + +ENUM!{ enum D3D12_QUERY_TYPE { + D3D12_QUERY_TYPE_OCCLUSION = 0, + D3D12_QUERY_TYPE_BINARY_OCCLUSION = 1, + D3D12_QUERY_TYPE_TIMESTAMP = 2, + D3D12_QUERY_TYPE_PIPELINE_STATISTICS = 3, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 = 4, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM1 = 5, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM2 = 6, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3 = 7, +}} + +FLAGS!{ enum D3D12_RESOURCE_BARRIER_FLAGS { + D3D12_RESOURCE_BARRIER_FLAG_NONE = 0x0, + D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY = 0x1, + D3D12_RESOURCE_BARRIER_FLAG_END_ONLY = 0x2, +}} + +ENUM!{ enum D3D12_RESOURCE_BARRIER_TYPE { + D3D12_RESOURCE_BARRIER_TYPE_TRANSITION = 0, + D3D12_RESOURCE_BARRIER_TYPE_ALIASING = 1, + D3D12_RESOURCE_BARRIER_TYPE_UAV = 2, +}} + + +ENUM!{ enum D3D12_RESOURCE_DIMENSION { + D3D12_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D12_RESOURCE_DIMENSION_BUFFER = 1, + D3D12_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D12_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D12_RESOURCE_DIMENSION_TEXTURE3D = 4, +}} + +FLAGS!{ enum D3D12_RESOURCE_FLAGS { + D3D12_RESOURCE_FLAG_NONE = 0x0, + D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET = 0x1, + D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL = 0x2, + D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS = 0x4, + D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE = 0x8, + D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER = 0x10, + D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS = 0x20, +}} + + +FLAGS!{ enum D3D12_RESOURCE_STATES { + D3D12_RESOURCE_STATE_COMMON = 0x0, + D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER = 0x1, + D3D12_RESOURCE_STATE_INDEX_BUFFER = 0x2, + D3D12_RESOURCE_STATE_RENDER_TARGET = 0x4, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS = 0x8, + D3D12_RESOURCE_STATE_DEPTH_WRITE = 0x10, + D3D12_RESOURCE_STATE_DEPTH_READ = 0x20, + D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE = 0x40, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE = 0x80, + D3D12_RESOURCE_STATE_STREAM_OUT = 0x100, + D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT = 0x200, + D3D12_RESOURCE_STATE_COPY_DEST = 0x400, + D3D12_RESOURCE_STATE_COPY_SOURCE = 0x800, + D3D12_RESOURCE_STATE_RESOLVE_DEST = 0x1000, + D3D12_RESOURCE_STATE_RESOLVE_SOURCE = 0x2000, + D3D12_RESOURCE_STATE_GENERIC_READ = 0xAC3, + D3D12_RESOURCE_STATE_PRESENT = 0x0, + D3D12_RESOURCE_STATE_PREDICATION = 0x200, +}} + +ENUM!{ enum D3D12_ROOT_PARAMETER_TYPE { + D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0, + D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 1, + D3D12_ROOT_PARAMETER_TYPE_CBV = 2, + D3D12_ROOT_PARAMETER_TYPE_SRV = 3, + D3D12_ROOT_PARAMETER_TYPE_UAV = 4, +}} + +FLAGS!{ enum D3D12_ROOT_SIGNATURE_FLAGS { + D3D12_ROOT_SIGNATURE_FLAG_NONE = 0x0, + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT = 0x1, + D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS = 0x2, + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS = 0x4, + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS = 0x8, + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS = 0x10, + D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS = 0x20, + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40, +}} + +ENUM!{ enum D3D12_RTV_DIMENSION { + D3D12_RTV_DIMENSION_UNKNOWN = 0, + D3D12_RTV_DIMENSION_BUFFER = 1, + D3D12_RTV_DIMENSION_TEXTURE1D = 2, + D3D12_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_RTV_DIMENSION_TEXTURE2D = 4, + D3D12_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D12_RTV_DIMENSION_TEXTURE3D = 8, +}} + +ENUM!{ enum D3D12_SHADER_COMPONENT_MAPPING { + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0 = 0, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1 = 1, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2 = 2, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3 = 3, + D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0 = 4, + D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1 = 5, +}} + + +ENUM!{ enum D3D12_SHADER_VISIBILITY { + D3D12_SHADER_VISIBILITY_ALL = 0, + D3D12_SHADER_VISIBILITY_VERTEX = 1, + D3D12_SHADER_VISIBILITY_HULL = 2, + D3D12_SHADER_VISIBILITY_DOMAIN = 3, + D3D12_SHADER_VISIBILITY_GEOMETRY = 4, + D3D12_SHADER_VISIBILITY_PIXEL = 5, +}} + +ENUM!{ enum D3D12_SRV_DIMENSION { + D3D12_SRV_DIMENSION_UNKNOWN = 0, + D3D12_SRV_DIMENSION_BUFFER = 1, + D3D12_SRV_DIMENSION_TEXTURE1D = 2, + D3D12_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_SRV_DIMENSION_TEXTURE2D = 4, + D3D12_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D12_SRV_DIMENSION_TEXTURE3D = 8, + D3D12_SRV_DIMENSION_TEXTURECUBE = 9, + D3D12_SRV_DIMENSION_TEXTURECUBEARRAY = 10, +}} + +ENUM!{ enum D3D12_STATIC_BORDER_COLOR { + D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK = 0, + D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK = 1, + D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE = 2, +}} + + + +ENUM!{ enum D3D12_TEXTURE_ADDRESS_MODE { + D3D12_TEXTURE_ADDRESS_MODE_WRAP = 1, + D3D12_TEXTURE_ADDRESS_MODE_MIRROR = 2, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP = 3, + D3D12_TEXTURE_ADDRESS_MODE_BORDER = 4, + D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 5, +}} + +ENUM!{ enum D3D12_TEXTURE_COPY_TYPE { + D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX = 0, + D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT = 1, +}} + +ENUM!{ enum D3D12_TEXTURE_LAYOUT { + D3D12_TEXTURE_LAYOUT_UNKNOWN = 0, + D3D12_TEXTURE_LAYOUT_ROW_MAJOR = 1, + D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE = 2, + D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE = 3, +}} + + +FLAGS!{ enum D3D12_TILE_COPY_FLAGS { + D3D12_TILE_COPY_FLAG_NONE = 0x0, + D3D12_TILE_COPY_FLAG_NO_HAZARD = 0x1, + D3D12_TILE_COPY_FLAG_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 0x2, + D3D12_TILE_COPY_FLAG_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 0x4, +}} + +FLAGS!{ enum D3D12_TILE_MAPPING_FLAGS { + D3D12_TILE_MAPPING_FLAG_NONE = 0x0, + D3D12_TILE_MAPPING_FLAG_NO_HAZARD = 0x1, +}} + +FLAGS!{ enum D3D12_TILE_RANGE_FLAGS { + D3D12_TILE_RANGE_FLAG_NONE = 0x0, + D3D12_TILE_RANGE_FLAG_NULL = 0x1, + D3D12_TILE_RANGE_FLAG_SKIP = 0x2, + D3D12_TILE_RANGE_FLAG_REUSE_SINGLE_TILE = 0x4, +}} + +ENUM!{ enum D3D12_UAV_DIMENSION { + D3D12_UAV_DIMENSION_UNKNOWN = 0, + D3D12_UAV_DIMENSION_BUFFER = 1, + D3D12_UAV_DIMENSION_TEXTURE1D = 2, + D3D12_UAV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_UAV_DIMENSION_TEXTURE2D = 4, + D3D12_UAV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_UAV_DIMENSION_TEXTURE3D = 8, +}} + +ENUM!{ enum D3D_ROOT_SIGNATURE_VERSION { + D3D_ROOT_SIGNATURE_VERSION_1 = 1, +}} + + + + + +STRUCT!{struct D3D12_BUFFER_RTV { + FirstElement: ::UINT64, + NumElements: ::UINT, +}} + +STRUCT!{struct D3D12_BUFFER_SRV { + FirstElement: ::UINT64, + NumElements: ::UINT, + StructureByteStride: ::UINT, + Flags: ::D3D12_BUFFER_SRV_FLAGS, +}} + +STRUCT!{struct D3D12_BUFFER_UAV { + FirstElement: ::UINT64, + NumElements: ::UINT, + StructureByteStride: ::UINT, + CounterOffsetInBytes: ::UINT64, + Flags: ::D3D12_BUFFER_UAV_FLAGS, +}} + + + +STRUCT!{struct D3D12_CLEAR_VALUE { + Format: ::DXGI_FORMAT, + u: [::FLOAT; 4], +}} + +UNION!(D3D12_CLEAR_VALUE, u, DepthStencil, DepthStencil_mut, ::D3D12_DEPTH_STENCIL_VALUE); +UNION!(D3D12_CLEAR_VALUE, u, Color, Color_mut, [::FLOAT; 4]); + + + +STRUCT!{struct D3D12_COMMAND_SIGNATURE_DESC { + ByteStride: ::UINT, + NumArgumentDescs: ::UINT, + pArgumentDescs: *const ::D3D12_INDIRECT_ARGUMENT_DESC, + NodeMask: ::UINT, +}} + + + +STRUCT!{struct D3D12_CONSTANT_BUFFER_VIEW_DESC { + BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: ::UINT, +}} + +STRUCT!{struct D3D12_CPU_DESCRIPTOR_HANDLE { + ptr: ::SIZE_T, +}} + + + +STRUCT!{struct D3D12_DEPTH_STENCIL_VALUE { + Depth: ::FLOAT, + Stencil: ::UINT8, +}} + +STRUCT!{struct D3D12_DEPTH_STENCIL_VIEW_DESC { + Format: ::DXGI_FORMAT, + ViewDimension: ::D3D12_DSV_DIMENSION, + Flags: ::D3D12_DSV_FLAGS, + u: ::D3D12_TEX1D_ARRAY_DSV, +}} + +UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, + ::D3D12_TEX2DMS_ARRAY_DSV); +UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, ::D3D12_TEX2DMS_DSV); +UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + ::D3D12_TEX2D_ARRAY_DSV); +UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_DSV); +UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + ::D3D12_TEX1D_ARRAY_DSV); +UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_DSV); + +STRUCT!{struct D3D12_DESCRIPTOR_HEAP_DESC { + Type: ::D3D12_DESCRIPTOR_HEAP_TYPE, + NumDescriptors: ::UINT, + Flags: ::D3D12_DESCRIPTOR_HEAP_FLAGS, + NodeMask: ::UINT, +}} + +STRUCT!{struct D3D12_DESCRIPTOR_RANGE { + RangeType: ::D3D12_DESCRIPTOR_RANGE_TYPE, + NumDescriptors: ::UINT, + BaseShaderRegister: ::UINT, + RegisterSpace: ::UINT, + OffsetInDescriptorsFromTableStart: ::UINT, +}} + +STRUCT!{struct D3D12_DISCARD_REGION { + NumRects: ::UINT, + pRects: *const ::D3D12_RECT, + FirstSubresource: ::UINT, + NumSubresources: ::UINT, +}} + +STRUCT!{struct D3D12_DISPATCH_ARGUMENTS { + ThreadGroupCountX: ::UINT, + ThreadGroupCountY: ::UINT, + ThreadGroupCountZ: ::UINT, +}} + +STRUCT!{struct D3D12_DRAW_ARGUMENTS { + VertexCountPerInstance: ::UINT, + InstanceCount: ::UINT, + StartVertexLocation: ::UINT, + StartInstanceLocation: ::UINT, +}} + +STRUCT!{struct D3D12_DRAW_INDEXED_ARGUMENTS { + IndexCountPerInstance: ::UINT, + InstanceCount: ::UINT, + StartIndexLocation: ::UINT, + BaseVertexLocation: ::INT, + StartInstanceLocation: ::UINT, +}} + +STRUCT!{struct D3D12_FEATURE_DATA_ARCHITECTURE { + NodeIndex: ::UINT, + TileBasedRenderer: ::BOOL, + UMA: ::BOOL, + CacheCoherentUMA: ::BOOL, +}} + + +STRUCT!{struct D3D12_FEATURE_DATA_FEATURE_LEVELS { + NumFeatureLevels: ::UINT, + pFeatureLevelsRequested: *const ::D3D_FEATURE_LEVEL, + MaxSupportedFeatureLevel: ::D3D_FEATURE_LEVEL, +}} + +STRUCT!{struct D3D12_FEATURE_DATA_FORMAT_INFO { + Format: ::DXGI_FORMAT, + PlaneCount: ::UINT8, +}} + +STRUCT!{struct D3D12_FEATURE_DATA_FORMAT_SUPPORT { + Format: ::DXGI_FORMAT, + Support1: ::D3D12_FORMAT_SUPPORT1, + Support2: ::D3D12_FORMAT_SUPPORT2, +}} + +STRUCT!{struct D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT { + MaxGPUVirtualAddressBitsPerResource: ::UINT, + MaxGPUVirtualAddressBitsPerProcess: ::UINT, +}} + +STRUCT!{struct D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS { + Format: ::DXGI_FORMAT, + SampleCount: ::UINT, + Flags: ::D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS, + NumQualityLevels: ::UINT, +}} + +STRUCT!{struct D3D12_GPU_DESCRIPTOR_HANDLE { + ptr: ::UINT64, +}} + + + +STRUCT!{struct D3D12_HEAP_DESC { + SizeInBytes: ::UINT64, + Properties: ::D3D12_HEAP_PROPERTIES, + Alignment: ::UINT64, + Flags: ::D3D12_HEAP_FLAGS, +}} + +STRUCT!{struct D3D12_HEAP_PROPERTIES { + Type: ::D3D12_HEAP_TYPE, + CPUPageProperty: ::D3D12_CPU_PAGE_PROPERTY, + MemoryPoolPreference: ::D3D12_MEMORY_POOL, + CreationNodeMask: ::UINT, + VisibleNodeMask: ::UINT, +}} + +STRUCT!{struct D3D12_INDEX_BUFFER_VIEW { + BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: ::UINT, + Format: ::DXGI_FORMAT, +}} + +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_VertexBuffer { + Slot: ::UINT, +}} + +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_Constant { + RootParameterIndex: ::UINT, + DestOffsetIn32BitValues: ::UINT, + Num32BitValuesToSet: ::UINT, +}} + +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_ConstantBufferView { + RootParameterIndex: ::UINT, +}} + +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_ShaderResourceView { + RootParameterIndex: ::UINT, +}} + +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_UnorderedAccessView { + RootParameterIndex: ::UINT, +}} + +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC { + Type: ::D3D12_INDIRECT_ARGUMENT_TYPE, + u: ::D3D12_INDIRECT_ARGUMENT_DESC_Constant, +}} + +UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, UnorderedAccessView, UnorderedAccessView_mut, + D3D12_INDIRECT_ARGUMENT_DESC_UnorderedAccessView); +UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, ShaderResourceView, ShaderResourceView_mut, + D3D12_INDIRECT_ARGUMENT_DESC_ShaderResourceView); +UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, ConstantBufferView, ConstantBufferView_mut, + D3D12_INDIRECT_ARGUMENT_DESC_ConstantBufferView); +UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, Constant, Constant_mut, + D3D12_INDIRECT_ARGUMENT_DESC_Constant); +UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, VertexBuffer, VertexBuffer_mut, + D3D12_INDIRECT_ARGUMENT_DESC_VertexBuffer); + + + + +STRUCT!{struct D3D12_MEMCPY_DEST { + pData: *mut ::c_void, + RowPitch: ::SIZE_T, + SlicePitch: ::SIZE_T, +}} + +STRUCT!{struct D3D12_PACKED_MIP_INFO { + NumStandardMips: ::UINT8, + NumPackedMips: ::UINT8, + NumTilesForPackedMips: ::UINT, + StartTileIndexInOverallResource: ::UINT, +}} + +STRUCT!{struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT { + Offset: ::UINT64, + Footprint: ::D3D12_SUBRESOURCE_FOOTPRINT, +}} + +STRUCT!{struct D3D12_QUERY_DATA_PIPELINE_STATISTICS { + IAVertices: ::UINT64, + IAPrimitives: ::UINT64, + VSInvocations: ::UINT64, + GSInvocations: ::UINT64, + GSPrimitives: ::UINT64, + CInvocations: ::UINT64, + CPrimitives: ::UINT64, + PSInvocations: ::UINT64, + HSInvocations: ::UINT64, + DSInvocations: ::UINT64, + CSInvocations: ::UINT64, +}} + +STRUCT!{struct D3D12_QUERY_DATA_SO_STATISTICS { + NumPrimitivesWritten: ::UINT64, + PrimitivesStorageNeeded: ::UINT64, +}} + +STRUCT!{struct D3D12_QUERY_HEAP_DESC { + Type: ::D3D12_QUERY_HEAP_TYPE, + Count: ::UINT, + NodeMask: ::UINT, +}} + +STRUCT!{struct D3D12_RANGE { + Begin: ::SIZE_T, + End: ::SIZE_T, +}} + + + +STRUCT!{struct D3D12_RENDER_TARGET_VIEW_DESC { + Format: ::DXGI_FORMAT, + ViewDimension: ::D3D12_RTV_DIMENSION, + u: ::D3D12_BUFFER_RTV, +}} + +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture3D, Texture3D_mut, ::D3D12_TEX3D_RTV); +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, + ::D3D12_TEX2DMS_ARRAY_RTV); +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, ::D3D12_TEX2DMS_RTV); +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + ::D3D12_TEX2D_ARRAY_RTV); +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_RTV); +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + ::D3D12_TEX1D_ARRAY_RTV); +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_RTV); +UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Buffer, Buffer_mut, ::D3D12_BUFFER_RTV); + +STRUCT!{struct D3D12_RESOURCE_ALIASING_BARRIER { + pResourceBefore: *mut ::ID3D12Resource, + pResourceAfter: *mut ::ID3D12Resource, +}} + +STRUCT!{struct D3D12_RESOURCE_ALLOCATION_INFO { + SizeInBytes: ::UINT64, + Alignment: ::UINT64, +}} + +STRUCT!{struct D3D12_RESOURCE_BARRIER { + Type: ::D3D12_RESOURCE_BARRIER_TYPE, + Flags: ::D3D12_RESOURCE_BARRIER_FLAGS, + u: ::D3D12_RESOURCE_TRANSITION_BARRIER, +}} + +UNION!(D3D12_RESOURCE_BARRIER, u, UAV, UAV_mut, ::D3D12_RESOURCE_UAV_BARRIER); +UNION!(D3D12_RESOURCE_BARRIER, u, Aliasing, Aliasing_mut, ::D3D12_RESOURCE_ALIASING_BARRIER); +UNION!(D3D12_RESOURCE_BARRIER, u, Transition, Transition_mut, ::D3D12_RESOURCE_TRANSITION_BARRIER); + +STRUCT!{struct D3D12_RESOURCE_DESC { + Dimension: ::D3D12_RESOURCE_DIMENSION, + Alignment: ::UINT64, + Width: ::UINT64, + Height: ::UINT, + DepthOrArraySize: ::UINT16, + MipLevels: ::UINT16, + Format: ::DXGI_FORMAT, + SampleDesc: ::DXGI_SAMPLE_DESC, + Layout: ::D3D12_TEXTURE_LAYOUT, + Flags: ::D3D12_RESOURCE_FLAGS, +}} + +STRUCT!{struct D3D12_RESOURCE_TRANSITION_BARRIER { + pResource: *mut ::ID3D12Resource, + Subresource: ::UINT, + StateBefore: ::D3D12_RESOURCE_STATES, + StateAfter: ::D3D12_RESOURCE_STATES, +}} + +STRUCT!{struct D3D12_RESOURCE_UAV_BARRIER { + pResource: *mut ::ID3D12Resource, +}} + +STRUCT!{struct D3D12_ROOT_CONSTANTS { + ShaderRegister: ::UINT, + RegisterSpace: ::UINT, + Num32BitValues: ::UINT, +}} + +STRUCT!{struct D3D12_ROOT_DESCRIPTOR { + ShaderRegister: ::UINT, + RegisterSpace: ::UINT, +}} + +STRUCT!{struct D3D12_ROOT_DESCRIPTOR_TABLE { + NumDescriptorRanges: ::UINT, + pDescriptorRanges: *const ::D3D12_DESCRIPTOR_RANGE, +}} + +#[cfg(target_pointer_width = "64")] +STRUCT!{struct D3D12_ROOT_PARAMETER { + ParameterType: ::D3D12_ROOT_PARAMETER_TYPE, + u: ::D3D12_ROOT_DESCRIPTOR_TABLE, + ShaderVisibility: ::D3D12_SHADER_VISIBILITY, +}} + +#[cfg(target_pointer_width = "32")] +STRUCT!{struct D3D12_ROOT_PARAMETER { + ParameterType: ::D3D12_ROOT_PARAMETER_TYPE, + u: ::D3D12_ROOT_CONSTANTS, + ShaderVisibility: ::D3D12_SHADER_VISIBILITY, +}} + +UNION!(D3D12_ROOT_PARAMETER, u, Descriptor, Descriptor_mut, ::D3D12_ROOT_DESCRIPTOR); +UNION!(D3D12_ROOT_PARAMETER, u, Constants, Constants_mut, ::D3D12_ROOT_CONSTANTS); +UNION!(D3D12_ROOT_PARAMETER, u, DescriptorTable, DescriptorTable_mut, + ::D3D12_ROOT_DESCRIPTOR_TABLE); + +STRUCT!{struct D3D12_ROOT_SIGNATURE_DESC { + NumParameters: ::UINT, + pParameters: *const ::D3D12_ROOT_PARAMETER, + NumStaticSamplers: ::UINT, + pStaticSamplers: *const ::D3D12_STATIC_SAMPLER_DESC, + Flags: ::D3D12_ROOT_SIGNATURE_FLAGS, +}} + +STRUCT!{struct D3D12_SAMPLER_DESC { + Filter: ::D3D12_FILTER, + AddressU: ::D3D12_TEXTURE_ADDRESS_MODE, + AddressV: ::D3D12_TEXTURE_ADDRESS_MODE, + AddressW: ::D3D12_TEXTURE_ADDRESS_MODE, + MipLODBias: ::FLOAT, + MaxAnisotropy: ::UINT, + ComparisonFunc: ::D3D12_COMPARISON_FUNC, + BorderColor: [::FLOAT; 4], + MinLOD: ::FLOAT, + MaxLOD: ::FLOAT, +}} + + + +STRUCT!{struct D3D12_SHADER_RESOURCE_VIEW_DESC { + Format: ::DXGI_FORMAT, + ViewDimension: ::D3D12_SRV_DIMENSION, + Shader4ComponentMapping: ::UINT, + u: ::D3D12_BUFFER_SRV, +}} + +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, TextureCubeArray, TextureCubeArray_mut, + ::D3D12_TEXCUBE_ARRAY_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, TextureCube, TextureCube_mut, ::D3D12_TEXCUBE_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture3D, Texture3D_mut, ::D3D12_TEX3D_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, + ::D3D12_TEX2DMS_ARRAY_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, ::D3D12_TEX2DMS_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + ::D3D12_TEX2D_ARRAY_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + ::D3D12_TEX1D_ARRAY_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_SRV); +UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Buffer, Buffer_mut, ::D3D12_BUFFER_SRV); + + + +STRUCT!{struct D3D12_STATIC_SAMPLER_DESC { + Filter: ::D3D12_FILTER, + AddressU: ::D3D12_TEXTURE_ADDRESS_MODE, + AddressV: ::D3D12_TEXTURE_ADDRESS_MODE, + AddressW: ::D3D12_TEXTURE_ADDRESS_MODE, + MipLODBias: ::FLOAT, + MaxAnisotropy: ::UINT, + ComparisonFunc: ::D3D12_COMPARISON_FUNC, + BorderColor: ::D3D12_STATIC_BORDER_COLOR, + MinLOD: ::FLOAT, + MaxLOD: ::FLOAT, + ShaderRegister: ::UINT, + RegisterSpace: ::UINT, + ShaderVisibility: ::D3D12_SHADER_VISIBILITY, +}} + +STRUCT!{struct D3D12_STREAM_OUTPUT_BUFFER_VIEW { + BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: ::UINT64, + BufferFilledSizeLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, +}} + + + +STRUCT!{struct D3D12_SUBRESOURCE_DATA { + pData: *const ::c_void, + RowPitch: ::LONG_PTR, + SlicePitch: ::LONG_PTR, +}} + +STRUCT!{struct D3D12_SUBRESOURCE_FOOTPRINT { + Format: ::DXGI_FORMAT, + Width: ::UINT, + Height: ::UINT, + Depth: ::UINT, + RowPitch: ::UINT, +}} + +STRUCT!{struct D3D12_SUBRESOURCE_INFO { + Offset: ::UINT64, + RowPitch: ::UINT, + DepthPitch: ::UINT, +}} + +STRUCT!{struct D3D12_SUBRESOURCE_TILING { + WidthInTiles: ::UINT, + HeightInTiles: ::UINT16, + DepthInTiles: ::UINT16, + StartTileIndexInOverallResource: ::UINT, +}} + +STRUCT!{struct D3D12_TEX1D_ARRAY_DSV { + MipSlice: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX1D_ARRAY_RTV { + MipSlice: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX1D_ARRAY_SRV { + MostDetailedMip: ::UINT, + MipLevels: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, + ResourceMinLODClamp: ::FLOAT, +}} + +STRUCT!{struct D3D12_TEX1D_ARRAY_UAV { + MipSlice: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX1D_DSV { + MipSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX1D_RTV { + MipSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX1D_SRV { + MostDetailedMip: ::UINT, + MipLevels: ::UINT, + ResourceMinLODClamp: ::FLOAT, +}} + +STRUCT!{struct D3D12_TEX1D_UAV { + MipSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2DMS_ARRAY_DSV { + FirstArraySlice: ::UINT, + ArraySize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2DMS_ARRAY_RTV { + FirstArraySlice: ::UINT, + ArraySize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2DMS_ARRAY_SRV { + FirstArraySlice: ::UINT, + ArraySize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2DMS_DSV { + UnusedField_NothingToDefine: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2DMS_RTV { + UnusedField_NothingToDefine: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2DMS_SRV { + UnusedField_NothingToDefine: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2D_ARRAY_DSV { + MipSlice: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2D_ARRAY_RTV { + MipSlice: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, + PlaneSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2D_ARRAY_SRV { + MostDetailedMip: ::UINT, + MipLevels: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, + PlaneSlice: ::UINT, + ResourceMinLODClamp: ::FLOAT, +}} + +STRUCT!{struct D3D12_TEX2D_ARRAY_UAV { + MipSlice: ::UINT, + FirstArraySlice: ::UINT, + ArraySize: ::UINT, + PlaneSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2D_DSV { + MipSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2D_RTV { + MipSlice: ::UINT, + PlaneSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX2D_SRV { + MostDetailedMip: ::UINT, + MipLevels: ::UINT, + PlaneSlice: ::UINT, + ResourceMinLODClamp: ::FLOAT, +}} + +STRUCT!{struct D3D12_TEX2D_UAV { + MipSlice: ::UINT, + PlaneSlice: ::UINT, +}} + +STRUCT!{struct D3D12_TEX3D_RTV { + MipSlice: ::UINT, + FirstWSlice: ::UINT, + WSize: ::UINT, +}} + +STRUCT!{struct D3D12_TEX3D_SRV { + MostDetailedMip: ::UINT, + MipLevels: ::UINT, + ResourceMinLODClamp: ::FLOAT, +}} + +STRUCT!{struct D3D12_TEX3D_UAV { + MipSlice: ::UINT, + FirstWSlice: ::UINT, + WSize: ::UINT, +}} + +STRUCT!{struct D3D12_TEXCUBE_ARRAY_SRV { + MostDetailedMip: ::UINT, + MipLevels: ::UINT, + First2DArrayFace: ::UINT, + NumCubes: ::UINT, + ResourceMinLODClamp: ::FLOAT, +}} + +STRUCT!{struct D3D12_TEXCUBE_SRV { + MostDetailedMip: ::UINT, + MipLevels: ::UINT, + ResourceMinLODClamp: ::FLOAT, +}} + +STRUCT!{struct D3D12_TEXTURE_COPY_LOCATION { + pResource: *mut ::ID3D12Resource, + Type: ::D3D12_TEXTURE_COPY_TYPE, + u: ::D3D12_PLACED_SUBRESOURCE_FOOTPRINT, +}} + +UNION!(D3D12_TEXTURE_COPY_LOCATION, u, SubresourceIndex, SubresourceIndex_mut, ::UINT); +UNION!(D3D12_TEXTURE_COPY_LOCATION, u, PlacedFootprint, PlacedFootprint_mut, + ::D3D12_PLACED_SUBRESOURCE_FOOTPRINT); + +STRUCT!{struct D3D12_TILED_RESOURCE_COORDINATE { + X: ::UINT, + Y: ::UINT, + Z: ::UINT, + Subresource: ::UINT, +}} + +STRUCT!{struct D3D12_TILE_REGION_SIZE { + NumTiles: ::UINT, + UseBox: ::BOOL, + Width: ::UINT, + Height: ::UINT16, + Depth: ::UINT16, +}} + +STRUCT!{struct D3D12_TILE_SHAPE { + WidthInTexels: ::UINT, + HeightInTexels: ::UINT, + DepthInTexels: ::UINT, +}} + +STRUCT!{struct D3D12_UNORDERED_ACCESS_VIEW_DESC { + Format: ::DXGI_FORMAT, + ViewDimension: ::D3D12_UAV_DIMENSION, + u: ::D3D12_BUFFER_UAV, +}} + +UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture3D, Texture3D_mut, ::D3D12_TEX3D_UAV); +UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, + ::D3D12_TEX2D_ARRAY_UAV); +UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_UAV); +UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, + ::D3D12_TEX1D_ARRAY_UAV); +UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_UAV); +UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Buffer, Buffer_mut, ::D3D12_BUFFER_UAV); + +STRUCT!{struct D3D12_VERTEX_BUFFER_VIEW { + BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: ::UINT, + StrideInBytes: ::UINT, +}} + + + +RIDL!( +interface ID3D12CommandAllocator(ID3D12CommandAllocatorVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn Reset(&mut self) -> ::HRESULT +}); + +RIDL!( +interface ID3D12CommandList(ID3D12CommandListVtbl): ID3D12DeviceChild(ID3D12DeviceChildVtbl) { + fn GetType(&mut self) -> ::D3D12_COMMAND_LIST_TYPE +}); + +RIDL!( +interface ID3D12CommandQueue(ID3D12CommandQueueVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn UpdateTileMappings( + &mut self, pResource: *mut ::ID3D12Resource, NumResourceRegions: ::UINT, + pResourceRegionStartCoordinates: *const ::D3D12_TILED_RESOURCE_COORDINATE, + pResourceRegionSizes: *const ::D3D12_TILE_REGION_SIZE, pHeap: *mut ::ID3D12Heap, + NumRanges: ::UINT, pRangeFlags: *const ::D3D12_TILE_RANGE_FLAGS, + pHeapRangeStartOffsets: *const ::UINT, pRangeTileCounts: *const ::UINT, + Flags: ::D3D12_TILE_MAPPING_FLAGS + ) -> (), + fn CopyTileMappings( + &mut self, pDstResource: *mut ::ID3D12Resource, + pDstRegionStartCoordinate: *const ::D3D12_TILED_RESOURCE_COORDINATE, + pSrcResource: *mut ::ID3D12Resource, + pSrcRegionStartCoordinate: *const ::D3D12_TILED_RESOURCE_COORDINATE, + pRegionSize: *const ::D3D12_TILE_REGION_SIZE, Flags: ::D3D12_TILE_MAPPING_FLAGS + ) -> (), + fn ExecuteCommandLists( + &mut self, NumCommandLists: ::UINT, ppCommandLists: *mut *mut ::ID3D12CommandList + ) -> (), + fn SetMarker( + &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT + ) -> (), + fn BeginEvent( + &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT + ) -> (), + fn EndEvent(&mut self) -> (), + fn Signal( + &mut self, pFence: *mut ::ID3D12Fence, Value: ::UINT64 + ) -> ::HRESULT, + fn Wait( + &mut self, pFence: *mut ::ID3D12Fence, Value: ::UINT64 + ) -> ::HRESULT, + fn GetTimestampFrequency(&mut self, pFrequency: *mut ::UINT64) -> ::HRESULT, + fn GetClockCalibration( + &mut self, pGpuTimestamp: *mut ::UINT64, pCpuTimestamp: *mut ::UINT64 + ) -> ::HRESULT, + fn GetDesc( + &mut self, __ret_val: *mut ::D3D12_COMMAND_QUEUE_DESC + ) -> *mut ::D3D12_COMMAND_QUEUE_DESC +}); + +RIDL!( +interface ID3D12CommandSignature(ID3D12CommandSignatureVtbl): ID3D12Pageable(ID3D12PageableVtbl) { +}); + +RIDL!( +interface ID3D12DescriptorHeap(ID3D12DescriptorHeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn GetDesc( + &mut self, __ret_val: *mut ::D3D12_DESCRIPTOR_HEAP_DESC + ) -> *mut ::D3D12_DESCRIPTOR_HEAP_DESC, + fn GetCPUDescriptorHandleForHeapStart( + &mut self, __ret_val: *mut ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> *mut ::D3D12_CPU_DESCRIPTOR_HANDLE, + fn GetGPUDescriptorHandleForHeapStart( + &mut self, __ret_val: *mut ::D3D12_GPU_DESCRIPTOR_HANDLE + ) -> *mut ::D3D12_GPU_DESCRIPTOR_HANDLE +}); + + + +RIDL!( +interface ID3D12Device(ID3D12DeviceVtbl): ID3D12Object(ID3D12ObjectVtbl) { + fn GetNodeCount(&mut self) -> ::UINT, + fn CreateCommandQueue( + &mut self, pDesc: *const ::D3D12_COMMAND_QUEUE_DESC, riid: ::REFGUID, + ppCommandQueue: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateCommandAllocator( + &mut self, type_: ::D3D12_COMMAND_LIST_TYPE, riid: ::REFGUID, + ppCommandAllocator: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateGraphicsPipelineState( + &mut self, pDesc: *const ::D3D12_GRAPHICS_PIPELINE_STATE_DESC, riid: ::REFGUID, + ppPipelineState: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateComputePipelineState( + &mut self, pDesc: *const ::D3D12_COMPUTE_PIPELINE_STATE_DESC, riid: ::REFGUID, + ppPipelineState: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateCommandList( + &mut self, nodeMask: ::UINT, type_: ::D3D12_COMMAND_LIST_TYPE, + pCommandAllocator: *mut ::ID3D12CommandAllocator, + pInitialState: *mut ::ID3D12PipelineState, riid: ::REFGUID, + ppCommandList: *mut *mut ::c_void + ) -> ::HRESULT, + fn CheckFeatureSupport( + &mut self, Feature: ::D3D12_FEATURE, pFeatureSupportData: *mut ::c_void, + FeatureSupportDataSize: ::UINT + ) -> ::HRESULT, + fn CreateDescriptorHeap( + &mut self, pDescriptorHeapDesc: *const ::D3D12_DESCRIPTOR_HEAP_DESC, riid: ::REFGUID, + ppvHeap: *mut *mut ::c_void + ) -> ::HRESULT, + fn GetDescriptorHandleIncrementSize( + &mut self, DescriptorHeapType: ::D3D12_DESCRIPTOR_HEAP_TYPE + ) -> ::UINT, + fn CreateRootSignature( + &mut self, nodeMask: ::UINT, pBlobWithRootSignature: *const ::c_void, + blobLengthInBytes: ::SIZE_T, riid: ::REFGUID, ppvRootSignature: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateConstantBufferView( + &mut self, pDesc: *const ::D3D12_CONSTANT_BUFFER_VIEW_DESC, + DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> (), + fn CreateShaderResourceView( + &mut self, pResource: *mut ::ID3D12Resource, + pDesc: *const ::D3D12_SHADER_RESOURCE_VIEW_DESC, + DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> (), + fn CreateUnorderedAccessView( + &mut self, pResource: *mut ::ID3D12Resource, pCounterResource: *mut ::ID3D12Resource, + pDesc: *const ::D3D12_UNORDERED_ACCESS_VIEW_DESC, + DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> (), + fn CreateRenderTargetView( + &mut self, pResource: *mut ::ID3D12Resource, pDesc: *const ::D3D12_RENDER_TARGET_VIEW_DESC, + DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> (), + fn CreateDepthStencilView( + &mut self, pResource: *mut ::ID3D12Resource, pDesc: *const ::D3D12_DEPTH_STENCIL_VIEW_DESC, + DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> (), + fn CreateSampler( + &mut self, pDesc: *const ::D3D12_SAMPLER_DESC, + DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> (), + fn CopyDescriptors( + &mut self, NumDestDescriptorRanges: ::UINT, + pDestDescriptorRangeStarts: *const ::D3D12_CPU_DESCRIPTOR_HANDLE, + pDestDescriptorRangeSizes: *const ::UINT, NumSrcDescriptorRanges: ::UINT, + pSrcDescriptorRangeStarts: *const ::D3D12_CPU_DESCRIPTOR_HANDLE, + pSrcDescriptorRangeSizes: *const ::UINT, DescriptorHeapsType: ::D3D12_DESCRIPTOR_HEAP_TYPE + ) -> (), + fn CopyDescriptorsSimple( + &mut self, NumDescriptors: ::UINT, DestDescriptorRangeStart: ::D3D12_CPU_DESCRIPTOR_HANDLE, + SrcDescriptorRangeStart: ::D3D12_CPU_DESCRIPTOR_HANDLE, + DescriptorHeapsType: ::D3D12_DESCRIPTOR_HEAP_TYPE + ) -> (), + fn GetResourceAllocationInfo( + &mut self, visibleMask: ::UINT, numResourceDescs: ::UINT, + pResourceDescs: *const ::D3D12_RESOURCE_DESC, + __ret_val: *mut ::D3D12_RESOURCE_ALLOCATION_INFO + ) -> *mut ::D3D12_RESOURCE_ALLOCATION_INFO, + fn GetCustomHeapProperties( + &mut self, nodeMask: ::UINT, heapType: ::D3D12_HEAP_TYPE, + __ret_val: *mut ::D3D12_HEAP_PROPERTIES + ) -> *mut ::D3D12_HEAP_PROPERTIES, + fn CreateCommittedResource( + &mut self, pHeapProperties: *const ::D3D12_HEAP_PROPERTIES, HeapFlags: ::D3D12_HEAP_FLAGS, + pResourceDesc: *const ::D3D12_RESOURCE_DESC, InitialResourceState: ::D3D12_RESOURCE_STATES, + pOptimizedClearValue: *const ::D3D12_CLEAR_VALUE, riidResource: ::REFGUID, + ppvResource: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateHeap( + &mut self, pDesc: *const ::D3D12_HEAP_DESC, riid: ::REFGUID, ppvHeap: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreatePlacedResource( + &mut self, pHeap: *mut ::ID3D12Heap, HeapOffset: ::UINT64, + pDesc: *const ::D3D12_RESOURCE_DESC, InitialState: ::D3D12_RESOURCE_STATES, + pOptimizedClearValue: *const ::D3D12_CLEAR_VALUE, riid: ::REFGUID, + ppvResource: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateReservedResource( + &mut self, pDesc: *const ::D3D12_RESOURCE_DESC, InitialState: ::D3D12_RESOURCE_STATES, + pOptimizedClearValue: *const ::D3D12_CLEAR_VALUE, riid: ::REFGUID, + ppvResource: *mut *mut ::c_void + ) -> ::HRESULT, + fn CreateSharedHandle( + &mut self, pObject: *mut ::ID3D12DeviceChild, pAttributes: *const ::SECURITY_ATTRIBUTES, + Access: ::DWORD, Name: ::LPCWSTR, pHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn OpenSharedHandle( + &mut self, NTHandle: ::HANDLE, riid: ::REFGUID, ppvObj: *mut *mut ::c_void + ) -> ::HRESULT, + fn OpenSharedHandleByName( + &mut self, Name: ::LPCWSTR, Access: ::DWORD, pNTHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn MakeResident( + &mut self, NumObjects: ::UINT, ppObjects: *mut *mut ::ID3D12Pageable + ) -> ::HRESULT, + fn Evict( + &mut self, NumObjects: ::UINT, ppObjects: *mut *mut ::ID3D12Pageable + ) -> ::HRESULT, + fn CreateFence( + &mut self, InitialValue: ::UINT64, Flags: ::D3D12_FENCE_FLAGS, riid: ::REFGUID, + ppFence: *mut *mut ::c_void + ) -> ::HRESULT, + fn GetDeviceRemovedReason(&mut self) -> ::HRESULT, + fn GetCopyableFootprints( + &mut self, pResourceDesc: *const ::D3D12_RESOURCE_DESC, FirstSubresource: ::UINT, + NumSubresources: ::UINT, BaseOffset: ::UINT64, + pLayouts: *mut ::D3D12_PLACED_SUBRESOURCE_FOOTPRINT, pNumRows: *mut ::UINT, + pRowSizeInBytes: *mut ::UINT64, pTotalBytes: *mut ::UINT64 + ) -> (), + fn CreateQueryHeap( + &mut self, pDesc: *const ::D3D12_QUERY_HEAP_DESC, riid: ::REFGUID, + ppvHeap: *mut *mut ::c_void + ) -> ::HRESULT, + fn SetStablePowerState(&mut self, Enable: ::BOOL) -> ::HRESULT, + fn CreateCommandSignature( + &mut self, pDesc: *const ::D3D12_COMMAND_SIGNATURE_DESC, + pRootSignature: *mut ::ID3D12RootSignature, riid: ::REFGUID, + ppvCommandSignature: *mut *mut ::c_void + ) -> ::HRESULT, + fn GetResourceTiling( + &mut self, pTiledResource: *mut ::ID3D12Resource, pNumTilesForEntireResource: *mut ::UINT, + pPackedMipDesc: *mut ::D3D12_PACKED_MIP_INFO, + pStandardTileShapeForNonPackedMips: *mut ::D3D12_TILE_SHAPE, + pNumSubresourceTilings: *mut ::UINT, FirstSubresourceTilingToGet: ::UINT, + pSubresourceTilingsForNonPackedMips: *mut ::D3D12_SUBRESOURCE_TILING + ) -> (), + fn GetAdapterLuid(&mut self, __ret_val: *mut ::LUID) -> *mut ::LUID +}); + +RIDL!( +interface ID3D12Fence(ID3D12FenceVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn GetCompletedValue(&mut self) -> ::UINT64, + fn SetEventOnCompletion( + &mut self, Value: ::UINT64, hEvent: ::HANDLE + ) -> ::HRESULT, + fn Signal(&mut self, Value: ::UINT64) -> ::HRESULT +}); + +RIDL!( +interface ID3D12GraphicsCommandList(ID3D12GraphicsCommandListVtbl): ID3D12CommandList(ID3D12CommandListVtbl) { + fn Close(&mut self) -> ::HRESULT, + fn Reset( + &mut self, pAllocator: *mut ::ID3D12CommandAllocator, + pInitialState: *mut ::ID3D12PipelineState + ) -> ::HRESULT, + fn ClearState(&mut self, pPipelineState: *mut ::ID3D12PipelineState) -> (), + fn DrawInstanced( + &mut self, VertexCountPerInstance: ::UINT, InstanceCount: ::UINT, + StartVertexLocation: ::UINT, StartInstanceLocation: ::UINT + ) -> (), + fn DrawIndexedInstanced( + &mut self, IndexCountPerInstance: ::UINT, InstanceCount: ::UINT, + StartIndexLocation: ::UINT, BaseVertexLocation: ::INT, StartInstanceLocation: ::UINT + ) -> (), + fn Dispatch( + &mut self, ThreadGroupCountX: ::UINT, ThreadGroupCountY: ::UINT, ThreadGroupCountZ: ::UINT + ) -> (), + fn CopyBufferRegion( + &mut self, pDstBuffer: *mut ::ID3D12Resource, DstOffset: ::UINT64, + pSrcBuffer: *mut ::ID3D12Resource, SrcOffset: ::UINT64, NumBytes: ::UINT64 + ) -> (), + fn CopyTextureRegion( + &mut self, pDst: *const ::D3D12_TEXTURE_COPY_LOCATION, DstX: ::UINT, DstY: ::UINT, + DstZ: ::UINT, pSrc: *const ::D3D12_TEXTURE_COPY_LOCATION, pSrcBox: *const ::D3D12_BOX + ) -> (), + fn CopyResource( + &mut self, pDstResource: *mut ::ID3D12Resource, pSrcResource: *mut ::ID3D12Resource + ) -> (), + fn CopyTiles( + &mut self, pTiledResource: *mut ::ID3D12Resource, + pTileRegionStartCoordinate: *const ::D3D12_TILED_RESOURCE_COORDINATE, + pTileRegionSize: *const ::D3D12_TILE_REGION_SIZE, pBuffer: *mut ::ID3D12Resource, + BufferStartOffsetInBytes: ::UINT64, Flags: ::D3D12_TILE_COPY_FLAGS + ) -> (), + fn ResolveSubresource( + &mut self, pDstResource: *mut ::ID3D12Resource, DstSubresource: ::UINT, + pSrcResource: *mut ::ID3D12Resource, SrcSubresource: ::UINT, Format: ::DXGI_FORMAT + ) -> (), + fn IASetPrimitiveTopology( + &mut self, PrimitiveTopology: ::D3D12_PRIMITIVE_TOPOLOGY + ) -> (), + fn RSSetViewports( + &mut self, NumViewports: ::UINT, pViewports: *const ::D3D12_VIEWPORT + ) -> (), + fn RSSetScissorRects( + &mut self, NumRects: ::UINT, pRects: *const ::D3D12_RECT + ) -> (), + fn OMSetBlendFactor(&mut self, BlendFactor: *const [::FLOAT; 4]) -> (), + fn OMSetStencilRef(&mut self, StencilRef: ::UINT) -> (), + fn SetPipelineState( + &mut self, pPipelineState: *mut ::ID3D12PipelineState + ) -> (), + fn ResourceBarrier( + &mut self, NumBarriers: ::UINT, pBarriers: *const ::D3D12_RESOURCE_BARRIER + ) -> (), + fn ExecuteBundle( + &mut self, pCommandList: *mut ::ID3D12GraphicsCommandList + ) -> (), + fn SetDescriptorHeaps( + &mut self, NumDescriptorHeaps: ::UINT, ppDescriptorHeaps: *mut *mut ::ID3D12DescriptorHeap + ) -> (), + fn SetComputeRootSignature( + &mut self, pRootSignature: *mut ::ID3D12RootSignature + ) -> (), + fn SetGraphicsRootSignature( + &mut self, pRootSignature: *mut ::ID3D12RootSignature + ) -> (), + fn SetComputeRootDescriptorTable( + &mut self, RootParameterIndex: ::UINT, BaseDescriptor: ::D3D12_GPU_DESCRIPTOR_HANDLE + ) -> (), + fn SetGraphicsRootDescriptorTable( + &mut self, RootParameterIndex: ::UINT, BaseDescriptor: ::D3D12_GPU_DESCRIPTOR_HANDLE + ) -> (), + fn SetComputeRoot32BitConstant( + &mut self, RootParameterIndex: ::UINT, SrcData: ::UINT, DestOffsetIn32BitValues: ::UINT + ) -> (), + fn SetGraphicsRoot32BitConstant( + &mut self, RootParameterIndex: ::UINT, SrcData: ::UINT, DestOffsetIn32BitValues: ::UINT + ) -> (), + fn SetComputeRoot32BitConstants( + &mut self, RootParameterIndex: ::UINT, Num32BitValuesToSet: ::UINT, + pSrcData: *const ::c_void, DestOffsetIn32BitValues: ::UINT + ) -> (), + fn SetGraphicsRoot32BitConstants( + &mut self, RootParameterIndex: ::UINT, Num32BitValuesToSet: ::UINT, + pSrcData: *const ::c_void, DestOffsetIn32BitValues: ::UINT + ) -> (), + fn SetComputeRootConstantBufferView( + &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS + ) -> (), + fn SetGraphicsRootConstantBufferView( + &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS + ) -> (), + fn SetComputeRootShaderResourceView( + &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS + ) -> (), + fn SetGraphicsRootShaderResourceView( + &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS + ) -> (), + fn SetComputeRootUnorderedAccessView( + &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS + ) -> (), + fn SetGraphicsRootUnorderedAccessView( + &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS + ) -> (), + fn IASetIndexBuffer( + &mut self, pView: *const ::D3D12_INDEX_BUFFER_VIEW + ) -> (), + fn IASetVertexBuffers( + &mut self, StartSlot: ::UINT, NumViews: ::UINT, pViews: *const ::D3D12_VERTEX_BUFFER_VIEW + ) -> (), + fn SOSetTargets( + &mut self, StartSlot: ::UINT, NumViews: ::UINT, + pViews: *const ::D3D12_STREAM_OUTPUT_BUFFER_VIEW + ) -> (), + fn OMSetRenderTargets( + &mut self, NumRenderTargetDescriptors: ::UINT, + pRenderTargetDescriptors: *const ::D3D12_CPU_DESCRIPTOR_HANDLE, + RTsSingleHandleToDescriptorRange: ::BOOL, + pDepthStencilDescriptor: *const ::D3D12_CPU_DESCRIPTOR_HANDLE + ) -> (), + fn ClearDepthStencilView( + &mut self, DepthStencilView: ::D3D12_CPU_DESCRIPTOR_HANDLE, + ClearFlags: ::D3D12_CLEAR_FLAGS, Depth: ::FLOAT, Stencil: ::UINT8, NumRects: ::UINT, + pRects: *const ::D3D12_RECT + ) -> (), + fn ClearRenderTargetView( + &mut self, RenderTargetView: ::D3D12_CPU_DESCRIPTOR_HANDLE, ColorRGBA: *const [::FLOAT; 4], + NumRects: ::UINT, pRects: *const ::D3D12_RECT + ) -> (), + fn ClearUnorderedAccessViewUint( + &mut self, ViewGPUHandleInCurrentHeap: ::D3D12_GPU_DESCRIPTOR_HANDLE, + ViewCPUHandle: ::D3D12_CPU_DESCRIPTOR_HANDLE, pResource: *mut ::ID3D12Resource, + Values: *const [::UINT; 4], NumRects: ::UINT, pRects: *const ::D3D12_RECT + ) -> (), + fn ClearUnorderedAccessViewFloat( + &mut self, ViewGPUHandleInCurrentHeap: ::D3D12_GPU_DESCRIPTOR_HANDLE, + ViewCPUHandle: ::D3D12_CPU_DESCRIPTOR_HANDLE, pResource: *mut ::ID3D12Resource, + Values: *const [::FLOAT; 4], NumRects: ::UINT, pRects: *const ::D3D12_RECT + ) -> (), + fn DiscardResource( + &mut self, pResource: *mut ::ID3D12Resource, pRegion: *const ::D3D12_DISCARD_REGION + ) -> (), + fn BeginQuery( + &mut self, pQueryHeap: *mut ::ID3D12QueryHeap, Type: ::D3D12_QUERY_TYPE, Index: ::UINT + ) -> (), + fn EndQuery( + &mut self, pQueryHeap: *mut ::ID3D12QueryHeap, Type: ::D3D12_QUERY_TYPE, Index: ::UINT + ) -> (), + fn ResolveQueryData( + &mut self, pQueryHeap: *mut ::ID3D12QueryHeap, Type: ::D3D12_QUERY_TYPE, + StartIndex: ::UINT, NumQueries: ::UINT, pDestinationBuffer: *mut ::ID3D12Resource, + AlignedDestinationBufferOffset: ::UINT64 + ) -> (), + fn SetPredication( + &mut self, pBuffer: *mut ::ID3D12Resource, AlignedBufferOffset: ::UINT64, + Operation: ::D3D12_PREDICATION_OP + ) -> (), + fn SetMarker( + &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT + ) -> (), + fn BeginEvent( + &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT + ) -> (), + fn EndEvent(&mut self) -> (), + fn ExecuteIndirect( + &mut self, pCommandSignature: *mut ::ID3D12CommandSignature, MaxCommandCount: ::UINT, + pArgumentBuffer: *mut ::ID3D12Resource, ArgumentBufferOffset: ::UINT64, + pCountBuffer: *mut ::ID3D12Resource, CountBufferOffset: ::UINT64 + ) -> () +}); + +RIDL!( +interface ID3D12Heap(ID3D12HeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn GetDesc( + &mut self, __ret_val: *mut ::D3D12_HEAP_DESC + ) -> *mut ::D3D12_HEAP_DESC +}); + + + +RIDL!( +interface ID3D12Pageable(ID3D12PageableVtbl): ID3D12DeviceChild(ID3D12DeviceChildVtbl) { +}); + +RIDL!( +interface ID3D12PipelineState(ID3D12PipelineStateVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn GetCachedBlob(&mut self, ppBlob: *mut *mut ::ID3DBlob) -> ::HRESULT +}); + +RIDL!( +interface ID3D12QueryHeap(ID3D12QueryHeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { +}); + +RIDL!( +interface ID3D12Resource(ID3D12ResourceVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn Map( + &mut self, Subresource: ::UINT, pReadRange: *const ::D3D12_RANGE, + ppData: *mut *mut ::c_void + ) -> ::HRESULT, + fn Unmap( + &mut self, Subresource: ::UINT, pWrittenRange: *const ::D3D12_RANGE + ) -> (), + fn GetDesc( + &mut self, __ret_val: *mut ::D3D12_RESOURCE_DESC + ) -> *mut ::D3D12_RESOURCE_DESC, + fn GetGPUVirtualAddress(&mut self) -> ::D3D12_GPU_VIRTUAL_ADDRESS, + fn WriteToSubresource( + &mut self, DstSubresource: ::UINT, pDstBox: *const ::D3D12_BOX, pSrcData: *const ::c_void, + SrcRowPitch: ::UINT, SrcDepthPitch: ::UINT + ) -> ::HRESULT, + fn ReadFromSubresource( + &mut self, pDstData: *mut ::c_void, DstRowPitch: ::UINT, DstDepthPitch: ::UINT, + SrcSubresource: ::UINT, pSrcBox: *const ::D3D12_BOX + ) -> ::HRESULT, + fn GetHeapProperties( + &mut self, pHeapProperties: *mut ::D3D12_HEAP_PROPERTIES, + pHeapFlags: *mut ::D3D12_HEAP_FLAGS + ) -> ::HRESULT +}); + +RIDL!( +interface ID3D12RootSignatureDeserializer(ID3D12RootSignatureDeserializerVtbl): IUnknown(IUnknownVtbl) { + fn GetRootSignatureDesc(&mut self) -> *const ::D3D12_ROOT_SIGNATURE_DESC +}); + + + +pub type PFN_D3D12_CREATE_DEVICE = extern "system" fn (_ : *mut ::IUnknown, _ : ::D3D_FEATURE_LEVEL, _ : ::REFGUID, _ : *mut *mut ::c_void) -> ::HRESULT; +pub type PFN_D3D12_CREATE_ROOT_SIGNATURE_DESERIALIZER = extern "system" fn (pSrcData: ::LPCVOID, SrcDataSizeInBytes: ::SIZE_T, pRootSignatureDeserializerInterface: ::REFGUID, ppRootSignatureDeserializer: *mut *mut ::c_void) -> ::HRESULT; +pub type PFN_D3D12_GET_DEBUG_INTERFACE = extern "system" fn (_ : ::REFGUID, _ : *mut *mut ::c_void) -> ::HRESULT; +pub type PFN_D3D12_SERIALIZE_ROOT_SIGNATURE = extern "system" fn (pRootSignature: *const ::D3D12_ROOT_SIGNATURE_DESC, Version: ::D3D_ROOT_SIGNATURE_VERSION, ppBlob: *mut *mut ::ID3DBlob, ppErrorBlob: *mut *mut ::ID3DBlob) -> ::HRESULT; diff --git a/third_party/rust/winapi/src/d3d12sdklayers.rs b/third_party/rust/winapi/src/d3d12sdklayers.rs new file mode 100644 index 000000000000..f1598867ed9f --- /dev/null +++ b/third_party/rust/winapi/src/d3d12sdklayers.rs @@ -0,0 +1,1063 @@ +// Copyright © 2015, Dmitry Roschin +// Licensed under the MIT License +RIDL!{interface ID3D12Debug(ID3D12DebugVtbl): IUnknown(IUnknownVtbl) { + fn EnableDebugLayer(&mut self) -> () +}} +FLAGS!{enum D3D12_DEBUG_FEATURE { + D3D12_DEBUG_FEATURE_NONE = 0, + D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DRAW = 0x1, + D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DISPATCH = 0x2, +}} +FLAGS!{enum D3D12_RLDO_FLAGS { + D3D12_RLDO_NONE = 0x0, + D3D12_RLDO_SUMMARY = 0x1, + D3D12_RLDO_DETAIL = 0x2, + D3D12_RLDO_IGNORE_INTERNAL = 0x4, +}} +RIDL!{interface ID3D12DebugDevice(ID3D12DebugDeviceVtbl): IUnknown(IUnknownVtbl) { + fn SetFeatureMask(&mut self, Mask: ::D3D12_DEBUG_FEATURE) -> ::HRESULT, + fn GetFeatureMask(&mut self) -> ::D3D12_DEBUG_FEATURE, + fn ReportLiveDeviceObjects(&mut self, Flags: ::D3D12_RLDO_FLAGS) -> ::HRESULT +}} +RIDL!{interface ID3D12DebugCommandQueue(ID3D12DebugCommandQueueVtbl): IUnknown(IUnknownVtbl) { + fn AssertResourceState( + &mut self, pResource: *mut ::ID3D12Resource, Subresource: ::UINT, State: ::UINT + ) -> ::BOOL +}} +RIDL!{interface ID3D12DebugCommandList(ID3D12DebugCommandListVtbl): IUnknown(IUnknownVtbl) { + fn AssertResourceState( + &mut self, pResource: *mut ::ID3D12Resource, Subresource: ::UINT, State: ::UINT + ) -> ::BOOL, + fn SetFeatureMask(&mut self, Mask: ::D3D12_DEBUG_FEATURE) -> ::HRESULT, + fn GetFeatureMask(&mut self) -> ::D3D12_DEBUG_FEATURE +}} +ENUM!{enum D3D12_MESSAGE_CATEGORY { + D3D12_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, + D3D12_MESSAGE_CATEGORY_MISCELLANEOUS = 1, + D3D12_MESSAGE_CATEGORY_INITIALIZATION = 2, + D3D12_MESSAGE_CATEGORY_CLEANUP = 3, + D3D12_MESSAGE_CATEGORY_COMPILATION = 4, + D3D12_MESSAGE_CATEGORY_STATE_CREATION = 5, + D3D12_MESSAGE_CATEGORY_STATE_SETTING = 6, + D3D12_MESSAGE_CATEGORY_STATE_GETTING = 7, + D3D12_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = 8, + D3D12_MESSAGE_CATEGORY_EXECUTION = 9, + D3D12_MESSAGE_CATEGORY_SHADER = 10, +}} +ENUM!{enum D3D12_MESSAGE_SEVERITY { + D3D12_MESSAGE_SEVERITY_CORRUPTION = 0, + D3D12_MESSAGE_SEVERITY_ERROR = 1, + D3D12_MESSAGE_SEVERITY_WARNING = 2, + D3D12_MESSAGE_SEVERITY_INFO = 3, + D3D12_MESSAGE_SEVERITY_MESSAGE = 4, +}} +ENUM!{enum D3D12_MESSAGE_ID { + D3D12_MESSAGE_ID_UNKNOWN = 0, + D3D12_MESSAGE_ID_STRING_FROM_APPLICATION = 1, + D3D12_MESSAGE_ID_CORRUPTED_THIS = 2, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER1 = 3, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER2 = 4, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER3 = 5, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER4 = 6, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER5 = 7, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER6 = 8, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER7 = 9, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER8 = 10, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER9 = 11, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER10 = 12, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER11 = 13, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER12 = 14, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER13 = 15, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER14 = 16, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER15 = 17, + D3D12_MESSAGE_ID_CORRUPTED_MULTITHREADING = 18, + D3D12_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = 19, + D3D12_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = 20, + D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = 21, + D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = 22, + D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = 23, + D3D12_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = 24, + D3D12_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = 25, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = 26, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = 27, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = 28, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANESLICE = 29, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANESLICE = 30, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = 31, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = 32, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = 33, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = 34, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = 35, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = 36, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = 37, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = 38, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANESLICE = 39, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANESLICE = 40, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = 41, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = 42, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = 43, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = 44, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = 45, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = 46, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = 47, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = 48, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = 49, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = 50, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = 51, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = 52, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = 53, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = 54, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = 55, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = 56, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = 57, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = 58, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = 59, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = 60, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = 61, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = 62, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = 63, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = 64, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = 65, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = 66, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = 67, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = 68, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = 69, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = 70, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = 71, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = 72, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = 73, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 74, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = 75, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = 76, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = 77, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = 78, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = 79, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = 80, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = 81, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = 82, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = 83, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = 84, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = 85, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = 86, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = 87, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = 88, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = 89, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = 90, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = 91, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = 92, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = 93, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = 94, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = 95, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = 96, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = 97, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = 98, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = 99, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = 100, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = 101, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = 102, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = 103, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = 104, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = 105, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = 106, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = 107, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = 108, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = 109, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = 110, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = 111, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = 112, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = 113, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = 114, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = 115, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = 116, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = 117, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = 118, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = 119, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = 120, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = 121, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = 122, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = 123, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = 124, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = 125, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = 126, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = 127, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = 128, + D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = 129, + D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = 130, + D3D12_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = 131, + D3D12_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = 132, + D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = 133, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = 134, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = 135, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = 136, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = 137, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = 138, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = 139, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = 140, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = 141, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = 142, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = 143, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = 144, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = 145, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = 146, + D3D12_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = 147, + D3D12_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = 148, + D3D12_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = 149, + D3D12_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = 150, + D3D12_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = 151, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = 152, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = 153, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = 154, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = 155, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = 156, + D3D12_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = 157, + D3D12_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = 158, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = 159, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = 160, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = 161, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = 162, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = 163, + D3D12_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = 164, + D3D12_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = 165, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = 166, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = 167, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = 168, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = 169, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = 170, + D3D12_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = 171, + D3D12_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = 172, + D3D12_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = 173, + D3D12_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = 174, + D3D12_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = 175, + D3D12_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = 176, + D3D12_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = 177, + D3D12_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = 178, + D3D12_MESSAGE_ID_REF_THREADING_MODE = 179, + D3D12_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = 180, + D3D12_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = 181, + D3D12_MESSAGE_ID_REF_HARDWARE_EXCEPTION = 182, + D3D12_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = 183, + D3D12_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = 184, + D3D12_MESSAGE_ID_REF_OUT_OF_MEMORY = 185, + D3D12_MESSAGE_ID_REF_INFO = 186, + D3D12_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = 187, + D3D12_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = 188, + D3D12_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = 189, + D3D12_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = 190, + D3D12_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = 191, + D3D12_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = 192, + D3D12_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = 193, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 194, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = 195, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = 196, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = 197, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = 198, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 199, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_NOT_SET = 200, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_MISMATCH = 201, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_NOT_SET = 202, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INPUTLAYOUT_NOT_SET = 203, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_CONSTANT_BUFFER_NOT_SET = 204, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_CONSTANT_BUFFER_TOO_SMALL = 205, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SAMPLER_NOT_SET = 206, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SHADERRESOURCEVIEW_NOT_SET = 207, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VIEW_DIMENSION_MISMATCH = 208, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = 209, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_TOO_SMALL = 210, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_NOT_SET = 211, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_FORMAT_INVALID = 212, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_TOO_SMALL = 213, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = 214, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = 215, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_POSITION_NOT_PRESENT = 216, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OUTPUT_STREAM_NOT_SET = 217, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_BOUND_RESOURCE_MAPPED = 218, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INVALID_PRIMITIVETOPOLOGY = 219, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_OFFSET_UNALIGNED = 220, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_STRIDE_UNALIGNED = 221, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_OFFSET_UNALIGNED = 222, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = 223, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = 224, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = 225, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = 226, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = 227, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = 228, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = 229, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 230, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 231, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = 232, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = 233, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = 234, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = 235, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = 236, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = 237, + D3D12_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = 238, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = 239, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = 240, + D3D12_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = 241, + D3D12_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = 242, + D3D12_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = 243, + D3D12_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = 244, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = 245, + D3D12_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = 246, + D3D12_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = 247, + D3D12_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = 248, + D3D12_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = 249, + D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 250, + D3D12_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = 251, + D3D12_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = 252, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = 253, + D3D12_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = 254, + D3D12_MESSAGE_ID_LIVE_OBJECT_SUMMARY = 255, + D3D12_MESSAGE_ID_LIVE_BUFFER = 256, + D3D12_MESSAGE_ID_LIVE_TEXTURE1D = 257, + D3D12_MESSAGE_ID_LIVE_TEXTURE2D = 258, + D3D12_MESSAGE_ID_LIVE_TEXTURE3D = 259, + D3D12_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW = 260, + D3D12_MESSAGE_ID_LIVE_RENDERTARGETVIEW = 261, + D3D12_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW = 262, + D3D12_MESSAGE_ID_LIVE_VERTEXSHADER = 263, + D3D12_MESSAGE_ID_LIVE_GEOMETRYSHADER = 264, + D3D12_MESSAGE_ID_LIVE_PIXELSHADER = 265, + D3D12_MESSAGE_ID_LIVE_INPUTLAYOUT = 266, + D3D12_MESSAGE_ID_LIVE_SAMPLER = 267, + D3D12_MESSAGE_ID_LIVE_BLENDSTATE = 268, + D3D12_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE = 269, + D3D12_MESSAGE_ID_LIVE_RASTERIZERSTATE = 270, + D3D12_MESSAGE_ID_LIVE_QUERY = 271, + D3D12_MESSAGE_ID_LIVE_PREDICATE = 272, + D3D12_MESSAGE_ID_LIVE_COUNTER = 273, + D3D12_MESSAGE_ID_LIVE_DEVICE = 274, + D3D12_MESSAGE_ID_LIVE_SWAPCHAIN = 275, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = 276, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = 277, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = 278, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS = 279, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = 280, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS = 281, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE = 282, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDCLASSLINKAGE = 283, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = 284, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = 285, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = 286, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = 287, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDCALL = 288, + D3D12_MESSAGE_ID_CREATEHULLSHADER_OUTOFMEMORY = 289, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERBYTECODE = 290, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERTYPE = 291, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDCLASSLINKAGE = 292, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCALL = 293, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_OUTOFMEMORY = 294, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = 295, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERTYPE = 296, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = 297, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_XOR_DS_MISMATCH = 298, + D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER = 299, + D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED = 300, + D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW = 301, + D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDMAPTYPE = 302, + D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDSUBRESOURCE = 303, + D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDFLAGS = 304, + D3D12_MESSAGE_ID_RESOURCE_MAP_ALREADYMAPPED = 305, + D3D12_MESSAGE_ID_RESOURCE_MAP_DEVICEREMOVED_RETURN = 306, + D3D12_MESSAGE_ID_RESOURCE_MAP_OUTOFMEMORY_RETURN = 307, + D3D12_MESSAGE_ID_RESOURCE_MAP_WITHOUT_INITIAL_DISCARD = 308, + D3D12_MESSAGE_ID_RESOURCE_UNMAP_INVALIDSUBRESOURCE = 309, + D3D12_MESSAGE_ID_RESOURCE_UNMAP_NOTMAPPED = 310, + D3D12_MESSAGE_ID_DEVICE_DRAW_RASTERIZING_CONTROL_POINTS = 311, + D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED = 312, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH = 313, + D3D12_MESSAGE_ID_DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 314, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 315, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 316, + D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE = 317, + D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = 318, + D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN = 319, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCALL = 320, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_OUTOFMEMORY = 321, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = 322, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = 323, + D3D12_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY = 324, + D3D12_MESSAGE_ID_CSSETCONSTANTBUFFERS_INVALIDBUFFER = 325, + D3D12_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 326, + D3D12_MESSAGE_ID_DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY = 327, + D3D12_MESSAGE_ID_DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY = 328, + D3D12_MESSAGE_ID_DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 329, + D3D12_MESSAGE_ID_DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY = 330, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 331, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 332, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 333, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 334, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = 335, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 336, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = 337, + D3D12_MESSAGE_ID_CREATEBUFFER_INVALIDSTRUCTURESTRIDE = 338, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFLAGS = 339, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = 340, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDESC = 341, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = 342, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANESLICE = 343, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE = 344, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = 345, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = 346, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS = 347, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP = 348, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN = 349, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN = 350, + D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_DENORMFLUSH = 351, + D3D12_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY = 352, + D3D12_MESSAGE_ID_DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY = 353, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = 354, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER = 355, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED = 356, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW = 357, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DEPTH_READONLY = 358, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_STENCIL_READONLY = 359, + D3D12_MESSAGE_ID_CHECKFEATURESUPPORT_FORMAT_DEPRECATED = 360, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH = 361, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET = 362, + D3D12_MESSAGE_ID_DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP = 363, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH = 364, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED = 365, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED = 366, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH = 367, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH = 368, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED = 369, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED = 370, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED = 371, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED = 372, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED = 373, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED = 374, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED = 375, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED = 376, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED = 377, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED = 378, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW = 379, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO = 380, + D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH = 381, + D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH = 382, + D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED = 383, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_UNSUPPORTED = 384, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_UNSUPPORTED = 385, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDOFFSET = 386, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_LARGEOFFSET = 387, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE = 388, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDSOURCESTATE = 389, + D3D12_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED = 390, + D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT = 391, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED = 392, + D3D12_MESSAGE_ID_DEVICE_DRAW_PIXEL_SHADER_WITHOUT_RTV_OR_DSV = 393, + D3D12_MESSAGE_ID_SHADER_ABORT = 394, + D3D12_MESSAGE_ID_SHADER_MESSAGE = 395, + D3D12_MESSAGE_ID_SHADER_ERROR = 396, + D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDRESOURCE = 397, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_INVALIDARG_RETURN = 398, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_OUTOFMEMORY_RETURN = 399, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_ACCESSDENIED_RETURN = 400, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = 401, + D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 402, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS = 403, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER = 404, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER = 405, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER = 406, + D3D12_MESSAGE_ID_DEVICE_LOCKEDOUT_INTERFACE = 407, + D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDPRIORITY = 408, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDVIEW = 409, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 410, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_SHADEREXTENSIONSNOTSUPPORTED = 411, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 412, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_SHADEREXTENSIONSNOTSUPPORTED = 413, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 414, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_SHADEREXTENSIONSNOTSUPPORTED = 415, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 416, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_SHADEREXTENSIONSNOTSUPPORTED = 417, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED = 418, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_SHADEREXTENSIONSNOTSUPPORTED = 419, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 420, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_SHADEREXTENSIONSNOTSUPPORTED = 421, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 422, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_SHADEREXTENSIONSNOTSUPPORTED = 423, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_MINPRECISION = 424, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED = 425, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED = 426, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED = 427, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED = 428, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED = 429, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED = 430, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED = 431, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_INVALIDOFFSET = 432, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_TOOMANYVIEWS = 433, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_NOTSUPPORTED = 434, + D3D12_MESSAGE_ID_SWAPDEVICECONTEXTSTATE_NOTSUPPORTED = 435, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1 = 436, + D3D12_MESSAGE_ID_GETDC_INACCESSIBLE = 437, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDRECT = 438, + D3D12_MESSAGE_ID_DEVICE_DRAW_SAMPLE_MASK_IGNORED_ON_FL9 = 439, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE1_NOT_SUPPORTED = 440, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BY_NAME_NOT_SUPPORTED = 441, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_NOT_SUPPORTED = 442, + D3D12_MESSAGE_ID_OFFERRELEASE_NOT_SUPPORTED = 443, + D3D12_MESSAGE_ID_OFFERRESOURCES_INACCESSIBLE = 444, + D3D12_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMSAA = 445, + D3D12_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMSAA = 446, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDSOURCERECT = 447, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_EMPTYRECT = 448, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_EMPTYDESTBOX = 449, + D3D12_MESSAGE_ID_COPYSUBRESOURCEREGION_EMPTYSOURCEBOX = 450, + D3D12_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 451, + D3D12_MESSAGE_ID_DEVICE_DRAW_DEPTHSTENCILVIEW_NOT_SET = 452, + D3D12_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET = 453, + D3D12_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 454, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 455, + D3D12_MESSAGE_ID_GETDATAFORNEWHARDWAREKEY_NULLPARAM = 456, + D3D12_MESSAGE_ID_CHECKCRYPTOSESSIONSTATUS_NULLPARAM = 457, + D3D12_MESSAGE_ID_SETEVENTONHARDWARECONTENTPROTECTIONTILT_NULLPARAM = 458, + D3D12_MESSAGE_ID_GETVIDEODECODERCAPS_NULLPARAM = 459, + D3D12_MESSAGE_ID_GETVIDEODECODERCAPS_ZEROWIDTHHEIGHT = 460, + D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_NULLPARAM = 461, + D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 462, + D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 463, + D3D12_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_NULLPARAM = 464, + D3D12_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_UNSUPPORTED = 465, + D3D12_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_NULLPARAM = 466, + D3D12_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_UNSUPPORTED = 467, + D3D12_MESSAGE_ID_CHECKVIDEOPROCESSORFORMATCONVERSION_NULLPARAM = 468, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCOLORSPACE1_NULLPARAM = 469, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTCOLORSPACE1_NULLPARAM = 470, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_NULLPARAM = 471, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_INVALIDSTREAM = 472, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_NULLPARAM = 473, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_INVALIDSTREAM = 474, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_UNSUPPORTED = 475, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE1_NULLPARAM = 476, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETSTREAMMIRROR_NULLPARAM = 477, + D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_NULLPARAM = 478, + D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 479, + D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 480, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTSHADERUSAGE_NULLPARAM = 481, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTSHADERUSAGE_NULLPARAM = 482, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_NULLPARAM = 483, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT = 484, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT = 485, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT = 486, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT = 487, + D3D12_MESSAGE_ID_CREATEBUFFER_INVALIDUSAGE = 488, + D3D12_MESSAGE_ID_CREATETEXTURE1D_INVALIDUSAGE = 489, + D3D12_MESSAGE_ID_CREATETEXTURE2D_INVALIDUSAGE = 490, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_STEPRATE_NOT_1 = 491, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_INSTANCING_NOT_SUPPORTED = 492, + D3D12_MESSAGE_ID_UPDATETILEMAPPINGS_INVALID_PARAMETER = 493, + D3D12_MESSAGE_ID_COPYTILEMAPPINGS_INVALID_PARAMETER = 494, + D3D12_MESSAGE_ID_COPYTILES_INVALID_PARAMETER = 495, + D3D12_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_WARNING = 496, + D3D12_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_ERROR = 497, + D3D12_MESSAGE_ID_DIRTY_TILE_MAPPING_ACCESS = 498, + D3D12_MESSAGE_ID_DUPLICATE_TILE_MAPPINGS_IN_COVERED_AREA = 499, + D3D12_MESSAGE_ID_TILE_MAPPINGS_IN_COVERED_AREA_DUPLICATED_OUTSIDE = 500, + D3D12_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INCOMPATIBLE_RESOURCES = 501, + D3D12_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INPUT_AND_OUTPUT = 502, + D3D12_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_INVALIDFLAGS = 503, + D3D12_MESSAGE_ID_GETRESOURCETILING_NONTILED_RESOURCE = 504, + D3D12_MESSAGE_ID_NEED_TO_CALL_TILEDRESOURCEBARRIER = 505, + D3D12_MESSAGE_ID_CREATEDEVICE_INVALIDARGS = 506, + D3D12_MESSAGE_ID_CREATEDEVICE_WARNING = 507, + D3D12_MESSAGE_ID_TILED_RESOURCE_TIER_1_BUFFER_TEXTURE_MISMATCH = 508, + D3D12_MESSAGE_ID_CREATE_CRYPTOSESSION = 509, + D3D12_MESSAGE_ID_CREATE_AUTHENTICATEDCHANNEL = 510, + D3D12_MESSAGE_ID_LIVE_CRYPTOSESSION = 511, + D3D12_MESSAGE_ID_LIVE_AUTHENTICATEDCHANNEL = 512, + D3D12_MESSAGE_ID_DESTROY_CRYPTOSESSION = 513, + D3D12_MESSAGE_ID_DESTROY_AUTHENTICATEDCHANNEL = 514, + D3D12_MESSAGE_ID_MAP_INVALID_SUBRESOURCE = 515, + D3D12_MESSAGE_ID_MAP_INVALID_TYPE = 516, + D3D12_MESSAGE_ID_MAP_UNSUPPORTED_TYPE = 517, + D3D12_MESSAGE_ID_UNMAP_INVALID_SUBRESOURCE = 518, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_TYPE = 519, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_NULL_POINTER = 520, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SUBRESOURCE = 521, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_RESERVED_BITS = 522, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISSING_BIND_FLAGS = 523, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_MISC_FLAGS = 524, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MATCHING_STATES = 525, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINATION = 526, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH = 527, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_RESOURCE = 528, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_SAMPLE_COUNT = 529, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS = 530, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINED_FLAGS = 531, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS_FOR_FORMAT = 532, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SPLIT_BARRIER = 533, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_END = 534, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_BEGIN = 535, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAG = 536, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMMAND_LIST_TYPE = 537, + D3D12_MESSAGE_ID_INVALID_SUBRESOURCE_STATE = 538, + D3D12_MESSAGE_ID_INEFFICIENT_PRESENT = 539, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CONTENTION = 540, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET = 541, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET_BUNDLE = 542, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CANNOT_RESET = 543, + D3D12_MESSAGE_ID_COMMAND_LIST_OPEN = 544, + D3D12_MESSAGE_ID_QUERY_STATE_MISMATCH = 545, + D3D12_MESSAGE_ID_INVALID_BUNDLE_API = 546, + D3D12_MESSAGE_ID_COMMAND_LIST_CLOSED = 547, + D3D12_MESSAGE_ID_COMMAND_LIST_CLOSED_WITH_INVALID_RESOURCE = 548, + D3D12_MESSAGE_ID_WRONG_COMMAND_ALLOCATOR_TYPE = 549, + D3D12_MESSAGE_ID_INVALID_INDIRECT_ARGUMENT_BUFFER = 550, + D3D12_MESSAGE_ID_COMPUTE_AND_GRAPHICS_PIPELINE = 551, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_SYNC = 552, + D3D12_MESSAGE_ID_COMMAND_LIST_SYNC = 553, + D3D12_MESSAGE_ID_SET_DESCRIPTOR_HEAP_INVALID = 554, + D3D12_MESSAGE_ID_CREATE_QUEUE_IMAGE_NOT_SUPPORTED = 555, + D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_IMAGE_NOT_SUPPORTED = 556, + D3D12_MESSAGE_ID_CREATE_COMMANDQUEUE = 557, + D3D12_MESSAGE_ID_CREATE_COMMANDALLOCATOR = 558, + D3D12_MESSAGE_ID_CREATE_PIPELINESTATE = 559, + D3D12_MESSAGE_ID_CREATE_COMMANDLIST12 = 560, + D3D12_MESSAGE_ID_CREATE_IMAGECOMMANDLIST = 561, + D3D12_MESSAGE_ID_CREATE_RESOURCE = 562, + D3D12_MESSAGE_ID_CREATE_DESCRIPTORHEAP = 563, + D3D12_MESSAGE_ID_CREATE_ROOTSIGNATURE = 564, + D3D12_MESSAGE_ID_CREATE_LIBRARY = 565, + D3D12_MESSAGE_ID_CREATE_HEAP = 566, + D3D12_MESSAGE_ID_CREATE_MONITOREDFENCE = 567, + D3D12_MESSAGE_ID_CREATE_QUERYHEAP = 568, + D3D12_MESSAGE_ID_CREATE_COMMANDSIGNATURE = 569, + D3D12_MESSAGE_ID_LIVE_COMMANDQUEUE = 570, + D3D12_MESSAGE_ID_LIVE_COMMANDALLOCATOR = 571, + D3D12_MESSAGE_ID_LIVE_PIPELINESTATE = 572, + D3D12_MESSAGE_ID_LIVE_COMMANDLIST12 = 573, + D3D12_MESSAGE_ID_LIVE_IMAGECOMMANDLIST = 574, + D3D12_MESSAGE_ID_LIVE_RESOURCE = 575, + D3D12_MESSAGE_ID_LIVE_DESCRIPTORHEAP = 576, + D3D12_MESSAGE_ID_LIVE_ROOTSIGNATURE = 577, + D3D12_MESSAGE_ID_LIVE_LIBRARY = 578, + D3D12_MESSAGE_ID_LIVE_HEAP = 579, + D3D12_MESSAGE_ID_LIVE_MONITOREDFENCE = 580, + D3D12_MESSAGE_ID_LIVE_QUERYHEAP = 581, + D3D12_MESSAGE_ID_LIVE_COMMANDSIGNATURE = 582, + D3D12_MESSAGE_ID_DESTROY_COMMANDQUEUE = 583, + D3D12_MESSAGE_ID_DESTROY_COMMANDALLOCATOR = 584, + D3D12_MESSAGE_ID_DESTROY_PIPELINESTATE = 585, + D3D12_MESSAGE_ID_DESTROY_COMMANDLIST12 = 586, + D3D12_MESSAGE_ID_DESTROY_IMAGECOMMANDLIST = 587, + D3D12_MESSAGE_ID_DESTROY_RESOURCE = 588, + D3D12_MESSAGE_ID_DESTROY_DESCRIPTORHEAP = 589, + D3D12_MESSAGE_ID_DESTROY_ROOTSIGNATURE = 590, + D3D12_MESSAGE_ID_DESTROY_LIBRARY = 591, + D3D12_MESSAGE_ID_DESTROY_HEAP = 592, + D3D12_MESSAGE_ID_DESTROY_MONITOREDFENCE = 593, + D3D12_MESSAGE_ID_DESTROY_QUERYHEAP = 594, + D3D12_MESSAGE_ID_DESTROY_COMMANDSIGNATURE = 595, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDHEAPTYPE = 596, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONS = 597, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDMISCFLAGS = 598, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMISCFLAGS = 599, + D3D12_MESSAGE_ID_CREATERESOURCE_LARGEALLOCATION = 600, + D3D12_MESSAGE_ID_CREATERESOURCE_SMALLALLOCATION = 601, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDARG_RETURN = 602, + D3D12_MESSAGE_ID_CREATERESOURCE_OUTOFMEMORY_RETURN = 603, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDESC = 604, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDINITIALSTATE = 605, + D3D12_MESSAGE_ID_RESOURCE_HAS_PENDING_INITIAL_DATA = 606, + D3D12_MESSAGE_ID_POSSIBLY_INVALID_SUBRESOURCE_STATE = 607, + D3D12_MESSAGE_ID_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 608, + D3D12_MESSAGE_ID_POSSIBLE_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 609, + D3D12_MESSAGE_ID_BUNDLE_PIPELINE_STATE_MISMATCH = 610, + D3D12_MESSAGE_ID_PRIMITIVE_TOPOLOGY_MISMATCH_PIPELINE_STATE = 611, + D3D12_MESSAGE_ID_RENDER_TARGET_NUMBER_MISMATCH_PIPELINE_STATE = 612, + D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_PIPELINE_STATE = 613, + D3D12_MESSAGE_ID_RENDER_TARGET_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 614, + D3D12_MESSAGE_ID_DEPTH_STENCIL_FORMAT_MISMATCH_PIPELINE_STATE = 615, + D3D12_MESSAGE_ID_DEPTH_STENCIL_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 616, + D3D12_MESSAGE_ID_RENDER_TARGET_NUMBER_MISMATCH_BUNDLE_PIPELINE_STATE = 617, + D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_BUNDLE_PIPELINE_STATE = 618, + D3D12_MESSAGE_ID_RENDER_TARGET_SAMPLE_DESC_MISMATCH_BUNDLE_PIPELINE_STATE = 619, + D3D12_MESSAGE_ID_DEPTH_STENCIL_FORMAT_MISMATCH_BUNDLE_PIPELINE_STATE = 620, + D3D12_MESSAGE_ID_DEPTH_STENCIL_SAMPLE_DESC_MISMATCH_BUNDLE_PIPELINE_STATE = 621, + D3D12_MESSAGE_ID_CREATESHADER_INVALIDBYTECODE = 622, + D3D12_MESSAGE_ID_CREATEHEAP_NULLDESC = 623, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDSIZE = 624, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDHEAPTYPE = 625, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 626, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMEMORYPOOL = 627, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDPROPERTIES = 628, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDALIGNMENT = 629, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMISCFLAGS = 630, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDMISCFLAGS = 631, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDARG_RETURN = 632, + D3D12_MESSAGE_ID_CREATEHEAP_OUTOFMEMORY_RETURN = 633, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAPPROPERTIES = 634, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPTYPE = 635, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 636, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDMEMORYPOOL = 637, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPPROPERTIES = 638, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPMISCFLAGS = 639, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPMISCFLAGS = 640, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDARG_RETURN = 641, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_OUTOFMEMORY_RETURN = 642, + D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_UNRECOGNIZEDHEAPTYPE = 643, + D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_INVALIDHEAPTYPE = 644, + D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_INVALID_DESC = 645, + D3D12_MESSAGE_ID_INVALID_DESCRIPTOR_HANDLE = 646, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE = 647, + D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_SYSTEMVALUE = 648, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_RESOURCE = 649, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_DESC = 650, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_LARGE_OFFSET = 651, + D3D12_MESSAGE_ID_CREATE_UNORDEREDACCESS_VIEW_INVALID_COUNTER_USAGE = 652, + D3D12_MESSAGE_ID_COPY_DESCRIPTORS_INVALID_RANGES = 653, + D3D12_MESSAGE_ID_COPY_DESCRIPTORS_WRITE_ONLY_DESCRIPTOR = 654, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RTV_FORMAT_NOT_UNKNOWN = 655, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_RENDER_TARGET_COUNT = 656, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VERTEX_SHADER_NOT_SET = 657, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INPUTLAYOUT_NOT_SET = 658, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_HS_DS_SIGNATURE_MISMATCH = 659, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERINDEX = 660, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_COMPONENTTYPE = 661, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERMASK = 662, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SYSTEMVALUE = 663, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 664, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_MINPRECISION = 665, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 666, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_XOR_DS_MISMATCH = 667, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 668, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 669, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 670, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 671, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 672, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_PRIMITIVETOPOLOGY = 673, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SYSTEMVALUE = 674, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 675, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 676, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_TYPE_MISMATCH = 677, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 678, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDERTARGETVIEW_NOT_SET = 679, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DEPTHSTENCILVIEW_NOT_SET = 680, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_INPUT_PRIMITIVE_MISMATCH = 681, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_POSITION_NOT_PRESENT = 682, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE_FLAGS = 683, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_INDEX_BUFFER_PROPERTIES = 684, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SAMPLE_DESC = 685, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_ROOT_SIGNATURE_MISMATCH = 686, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DS_ROOT_SIGNATURE_MISMATCH = 687, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VS_ROOT_SIGNATURE_MISMATCH = 688, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_ROOT_SIGNATURE_MISMATCH = 689, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_ROOT_SIGNATURE_MISMATCH = 690, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE = 691, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_OPEN_BUNDLE = 692, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_DESCRIPTOR_HEAP_MISMATCH = 693, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_TYPE = 694, + D3D12_MESSAGE_ID_DRAW_EMPTY_SCISSOR_RECTANGLE = 695, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_BLOB_NOT_FOUND = 696, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_DESERIALIZE_FAILED = 697, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_INVALID_CONFIGURATION = 698, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_NOT_SUPPORTED_ON_DEVICE = 699, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLRESOURCEPROPERTIES = 700, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAP = 701, + D3D12_MESSAGE_ID_GETRESOURCEALLOCATIONINFO_INVALIDRDESCS = 702, + D3D12_MESSAGE_ID_MAKERESIDENT_NULLOBJECTARRAY = 703, + D3D12_MESSAGE_ID_MAKERESIDENT_INVALIDOBJECT = 704, + D3D12_MESSAGE_ID_EVICT_NULLOBJECTARRAY = 705, + D3D12_MESSAGE_ID_EVICT_INVALIDOBJECT = 706, + D3D12_MESSAGE_ID_HEAPS_UNSUPPORTED = 707, + D3D12_MESSAGE_ID_SET_DESCRIPTOR_TABLE_INVALID = 708, + D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_INVALID = 709, + D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_BUFFER_VIEW_INVALID = 710, + D3D12_MESSAGE_ID_SET_ROOT_SHADER_RESOURCE_VIEW_INVALID = 711, + D3D12_MESSAGE_ID_SET_ROOT_UNORDERED_ACCESS_VIEW_INVALID = 712, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID_DESC = 713, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_LARGE_OFFSET = 714, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID_DESC = 715, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_LARGE_OFFSET = 716, + D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID_DESC = 717, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDDIMENSIONALITY = 718, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDLAYOUT = 719, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONALITY = 720, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT = 721, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMIPLEVELS = 722, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDSAMPLEDESC = 723, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDLAYOUT = 724, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID = 725, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID = 726, + D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID = 727, + D3D12_MESSAGE_ID_SET_RENDER_TARGETS_INVALID = 728, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_INVALID_PARAMETERS = 729, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_JPEG_NOT_SUPPORTED = 730, + D3D12_MESSAGE_ID_BEGIN_END_QUERY_INVALID_PARAMETERS = 731, + D3D12_MESSAGE_ID_CLOSE_COMMAND_LIST_OPEN_QUERY = 732, + D3D12_MESSAGE_ID_RESOLVE_QUERY_DATA_INVALID_PARAMETERS = 733, + D3D12_MESSAGE_ID_SET_PREDICATION_INVALID_PARAMETERS = 734, + D3D12_MESSAGE_ID_TIMESTAMPS_NOT_SUPPORTED = 735, + D3D12_MESSAGE_ID_UNSTABLE_POWER_STATE = 736, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDFORMAT = 737, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDFORMAT = 738, + D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDSUBRESOURCERANGE = 739, + D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDBASEOFFSET = 740, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_HEAP = 741, + D3D12_MESSAGE_ID_CREATE_SAMPLER_INVALID = 742, + D3D12_MESSAGE_ID_CREATECOMMANDSIGNATURE_INVALID = 743, + D3D12_MESSAGE_ID_EXECUTE_INDIRECT_INVALID_PARAMETERS = 744, + D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_RESOURCE_DIMENSION = 745, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE = 746, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_DECODENOTSUPPORTED = 747, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED = 748, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = 749, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX = 750, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX = 751, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANEINDEX = 752, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANEINDEX = 753, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_AMBIGUOUSVIDEOPLANEINDEX = 754, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANEINDEX = 755, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANEINDEX = 756, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_AMBIGUOUSVIDEOPLANEINDEX = 757, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSCANDATAOFFSET = 758, + D3D12_MESSAGE_ID_JPEGDECODE_NOTSUPPORTED = 759, + D3D12_MESSAGE_ID_JPEGDECODE_DIMENSIONSTOOLARGE = 760, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDCOMPONENTS = 761, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDCOMPONENTS = 762, + D3D12_MESSAGE_ID_JPEGDECODE_DESTINATIONNOT2D = 763, + D3D12_MESSAGE_ID_JPEGDECODE_TILEDRESOURCESUNSUPPORTED = 764, + D3D12_MESSAGE_ID_JPEGDECODE_GUARDRECTSUNSUPPORTED = 765, + D3D12_MESSAGE_ID_JPEGDECODE_FORMATUNSUPPORTED = 766, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSUBRESOURCE = 767, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDMIPLEVEL = 768, + D3D12_MESSAGE_ID_JPEGDECODE_EMPTYDESTBOX = 769, + D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXNOT2D = 770, + D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXNOTSUB = 771, + D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXESINTERSECT = 772, + D3D12_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEMISMATCH = 773, + D3D12_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEMISMATCH = 774, + D3D12_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEODD = 775, + D3D12_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEODD = 776, + D3D12_MESSAGE_ID_JPEGDECODE_UPSCALEUNSUPPORTED = 777, + D3D12_MESSAGE_ID_JPEGDECODE_TIER4DOWNSCALETOLARGE = 778, + D3D12_MESSAGE_ID_JPEGDECODE_TIER3DOWNSCALEUNSUPPORTED = 779, + D3D12_MESSAGE_ID_JPEGDECODE_CHROMASIZEMISMATCH = 780, + D3D12_MESSAGE_ID_JPEGDECODE_LUMACHROMASIZEMISMATCH = 781, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDNUMDESTINATIONS = 782, + D3D12_MESSAGE_ID_JPEGDECODE_SUBBOXUNSUPPORTED = 783, + D3D12_MESSAGE_ID_JPEGDECODE_1DESTUNSUPPORTEDFORMAT = 784, + D3D12_MESSAGE_ID_JPEGDECODE_3DESTUNSUPPORTEDFORMAT = 785, + D3D12_MESSAGE_ID_JPEGDECODE_SCALEUNSUPPORTED = 786, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSOURCESIZE = 787, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDCOPYFLAGS = 788, + D3D12_MESSAGE_ID_JPEGDECODE_HAZARD = 789, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE = 790, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS = 791, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE = 792, + D3D12_MESSAGE_ID_JPEGDECODE_BACKBUFFERNOTSUPPORTED = 793, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPRTEDCOPYFLAGS = 794, + D3D12_MESSAGE_ID_JPEGENCODE_NOTSUPPORTED = 795, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSCANDATAOFFSET = 796, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDCOMPONENTS = 797, + D3D12_MESSAGE_ID_JPEGENCODE_SOURCENOT2D = 798, + D3D12_MESSAGE_ID_JPEGENCODE_TILEDRESOURCESUNSUPPORTED = 799, + D3D12_MESSAGE_ID_JPEGENCODE_GUARDRECTSUNSUPPORTED = 800, + D3D12_MESSAGE_ID_JPEGENCODE_XSUBSAMPLEMISMATCH = 801, + D3D12_MESSAGE_ID_JPEGENCODE_YSUBSAMPLEMISMATCH = 802, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDCOMPONENTS = 803, + D3D12_MESSAGE_ID_JPEGENCODE_FORMATUNSUPPORTED = 804, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSUBRESOURCE = 805, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDMIPLEVEL = 806, + D3D12_MESSAGE_ID_JPEGENCODE_DIMENSIONSTOOLARGE = 807, + D3D12_MESSAGE_ID_JPEGENCODE_HAZARD = 808, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE = 809, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS = 810, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE = 811, + D3D12_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED = 812, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = 813, + D3D12_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE = 814, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUE = 815, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDCLEARVALUEFORMAT = 816, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUEFORMAT = 817, + D3D12_MESSAGE_ID_CREATERESOURCE_CLEARVALUEDENORMFLUSH = 818, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALIDDEPTH = 819, + D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE = 820, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE = 821, + D3D12_MESSAGE_ID_MAP_INVALIDHEAP = 822, + D3D12_MESSAGE_ID_UNMAP_INVALIDHEAP = 823, + D3D12_MESSAGE_ID_MAP_INVALIDRESOURCE = 824, + D3D12_MESSAGE_ID_UNMAP_INVALIDRESOURCE = 825, + D3D12_MESSAGE_ID_MAP_INVALIDSUBRESOURCE = 826, + D3D12_MESSAGE_ID_UNMAP_INVALIDSUBRESOURCE = 827, + D3D12_MESSAGE_ID_MAP_INVALIDRANGE = 828, + D3D12_MESSAGE_ID_UNMAP_INVALIDRANGE = 829, + D3D12_MESSAGE_ID_MAP_NULLRANGE = 830, + D3D12_MESSAGE_ID_UNMAP_NULLRANGE = 831, + D3D12_MESSAGE_ID_MAP_INVALIDDATAPOINTER = 832, + D3D12_MESSAGE_ID_MAP_INVALIDARG_RETURN = 833, + D3D12_MESSAGE_ID_MAP_OUTOFMEMORY_RETURN = 834, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_BUNDLENOTSUPPORTED = 835, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_COMMANDLISTMISMATCH = 836, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_OPENCOMMANDLIST = 837, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_FAILEDCOMMANDLIST = 838, + D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLDST = 839, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDDSTRESOURCEDIMENSION = 840, + D3D12_MESSAGE_ID_COPYBUFFERREGION_DSTRANGEOUTOFBOUNDS = 841, + D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLSRC = 842, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDSRCRESOURCEDIMENSION = 843, + D3D12_MESSAGE_ID_COPYBUFFERREGION_SRCRANGEOUTOFBOUNDS = 844, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDCOPYFLAGS = 845, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLDST = 846, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTTYPE = 847, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCEDIMENSION = 848, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCE = 849, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTSUBRESOURCE = 850, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTOFFSET = 851, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTFORMAT = 852, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTFORMAT = 853, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDIMENSIONS = 854, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTROWPITCH = 855, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTPLACEMENT = 856, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDSPLACEDFOOTPRINTFORMAT = 857, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_DSTREGIONOUTOFBOUNDS = 858, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLSRC = 859, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCTYPE = 860, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCEDIMENSION = 861, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCE = 862, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCSUBRESOURCE = 863, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCOFFSET = 864, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCFORMAT = 865, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCFORMAT = 866, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDIMENSIONS = 867, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCROWPITCH = 868, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCPLACEMENT = 869, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDSPLACEDFOOTPRINTFORMAT = 870, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_SRCREGIONOUTOFBOUNDS = 871, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTCOORDINATES = 872, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCBOX = 873, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_FORMATMISMATCH = 874, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_EMPTYBOX = 875, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDCOPYFLAGS = 876, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SUBRESOURCE_INDEX = 877, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_FORMAT = 878, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_MISMATCH = 879, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SAMPLE_COUNT = 880, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_INVALID_SHADER = 881, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_CS_ROOT_SIGNATURE_MISMATCH = 882, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_MISSING_ROOT_SIGNATURE = 883, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALIDCACHEDBLOB = 884, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBADAPTERMISMATCH = 885, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDRIVERVERSIONMISMATCH = 886, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDESCMISMATCH = 887, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBIGNORED = 888, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDHEAP = 889, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDRESOURCE = 890, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDBOX = 891, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDSUBRESOURCE = 892, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_EMPTYBOX = 893, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDHEAP = 894, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDRESOURCE = 895, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDBOX = 896, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDSUBRESOURCE = 897, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_EMPTYBOX = 898, + D3D12_MESSAGE_ID_TOO_MANY_NODES_SPECIFIED = 899, + D3D12_MESSAGE_ID_INVALID_NODE_INDEX = 900, + D3D12_MESSAGE_ID_GETHEAPPROPERTIES_INVALIDRESOURCE = 901, + D3D12_MESSAGE_ID_NODE_MASK_MISMATCH = 902, + D3D12_MESSAGE_ID_COMMAND_LIST_OUTOFMEMORY = 903, + D3D12_MESSAGE_ID_COMMAND_LIST_MULTIPLE_SWAPCHAIN_BUFFER_REFERENCES = 904, + D3D12_MESSAGE_ID_COMMAND_LIST_TOO_MANY_SWAPCHAIN_REFERENCES = 905, + D3D12_MESSAGE_ID_COMMAND_QUEUE_TOO_MANY_SWAPCHAIN_REFERENCES = 906, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_WRONGSWAPCHAINBUFFERREFERENCE = 907, + D3D12_MESSAGE_ID_COMMAND_LIST_SETRENDERTARGETS_INVALIDNUMRENDERTARGETS = 908, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_TYPE = 909, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_FLAGS = 910, + D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFLAGS = 911, + D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFORMAT = 912, + D3D12_MESSAGE_ID_CREATESHAREDHEAP_INVALIDFLAGS = 913, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_UNRECOGNIZEDPROPERTIES = 914, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDSIZE = 915, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDOBJECT = 916, + D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDOBJECT = 917, + D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDKEY = 918, + D3D12_MESSAGE_ID_KEYEDMUTEX_WRONGSTATE = 919, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_PRIORITY = 920, + D3D12_MESSAGE_ID_OBJECT_DELETED_WHILE_STILL_IN_USE = 921, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_FLAGS = 922, + D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_HAS_NO_RESOURCE = 923, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RENDER_TARGET_DELETED = 924, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_ALL_RENDER_TARGETS_HAVE_UNKNOWN_FORMAT = 925, + D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS = 926, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_GPU_WRITTEN_READBACK_RESOURCE_MAPPED = 927, + D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_NEEDED = 928, + D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_EMPTY = 929, + D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE = 930, + D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE = 931, + D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT = 932, + D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT = 933, + D3D12_MESSAGE_ID_D3D12_MESSAGES_END = 934, +}} +STRUCT!{struct D3D12_MESSAGE { + Category: D3D12_MESSAGE_CATEGORY, + Severity: D3D12_MESSAGE_SEVERITY, + ID: D3D12_MESSAGE_ID, + pDescription: *const ::c_char, + DescriptionByteLength: ::SIZE_T, +}} +STRUCT!{struct D3D12_INFO_QUEUE_FILTER_DESC { + NumCategories: ::UINT, + pCategoryList: *mut D3D12_MESSAGE_CATEGORY, + NumSeverities: ::UINT, + pSeverityList: *mut D3D12_MESSAGE_SEVERITY, + NumIDs: ::UINT, + pIDList: *mut D3D12_MESSAGE_ID, +}} +STRUCT!{struct D3D12_INFO_QUEUE_FILTER { + AllowList: D3D12_INFO_QUEUE_FILTER_DESC, + DenyList: D3D12_INFO_QUEUE_FILTER_DESC, +}} +pub const D3D12_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT: ::UINT = 1024; +RIDL!{interface ID3D12InfoQueue(ID3D12InfoQueueVtbl): IUnknown(IUnknownVtbl) { + fn SetMessageCountLimit(&mut self, MessageCountLimit: ::UINT64) -> ::HRESULT, + fn ClearStoredMessages(&mut self) -> (), + fn GetMessage( + &mut self, MessageIndex: ::UINT64, pMessage: *mut ::D3D12_MESSAGE, + pMessageByteLength: *mut ::SIZE_T + ) -> ::HRESULT, + fn GetNumMessagesAllowedByStorageFilter(&mut self) -> ::UINT64, + fn GetNumMessagesDeniedByStorageFilter(&mut self) -> ::UINT64, + fn GetNumStoredMessages(&mut self) -> ::UINT64, + fn GetNumStoredMessagesAllowedByRetrievalFilter(&mut self) -> ::UINT64, + fn GetNumMessagesDiscardedByMessageCountLimit(&mut self) -> ::UINT64, + fn GetMessageCountLimit(&mut self) -> ::UINT64, + fn AddStorageFilterEntries(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, + fn GetStorageFilter( + &mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER, pFilterByteLength: *mut ::SIZE_T + ) -> ::HRESULT, + fn ClearStorageFilter(&mut self) -> (), + fn PushEmptyStorageFilter(&mut self) -> ::HRESULT, + fn PushCopyOfStorageFilter(&mut self) -> ::HRESULT, + fn PushStorageFilter(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, + fn PopStorageFilter(&mut self) -> (), + fn GetStorageFilterStackSize(&mut self) -> ::UINT, + fn AddRetrievalFilterEntries(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, + fn GetRetrievalFilter( + &mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER, pFilterByteLength: *mut ::SIZE_T + ) -> ::HRESULT, + fn ClearRetrievalFilter(&mut self) -> (), + fn PushEmptyRetrievalFilter(&mut self) -> ::HRESULT, + fn PushCopyOfRetrievalFilter(&mut self) -> ::HRESULT, + fn PushRetrievalFilter(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, + fn PopRetrievalFilter(&mut self) -> (), + fn GetRetrievalFilterStackSize(&mut self) -> ::UINT, + fn AddMessage( + &mut self, Category: ::D3D12_MESSAGE_CATEGORY, Severity: ::D3D12_MESSAGE_SEVERITY, + ID: ::D3D12_MESSAGE_ID, pDescription: ::LPCSTR + ) -> ::HRESULT, + fn AddApplicationMessage( + &mut self, Severity: ::D3D12_MESSAGE_SEVERITY, pDescription: ::LPCSTR + ) -> ::HRESULT, + fn SetBreakOnCategory( + &mut self, Category: ::D3D12_MESSAGE_CATEGORY, bEnable: ::BOOL + ) -> ::HRESULT, + fn SetBreakOnSeverity( + &mut self, Severity: ::D3D12_MESSAGE_SEVERITY, bEnable: ::BOOL + ) -> ::HRESULT, + fn SetBreakOnID(&mut self, ID: ::D3D12_MESSAGE_ID, bEnable: ::BOOL) -> ::HRESULT, + fn GetBreakOnCategory(&mut self, Category: ::D3D12_MESSAGE_CATEGORY) -> ::BOOL, + fn GetBreakOnSeverity(&mut self, Severity: ::D3D12_MESSAGE_SEVERITY) -> ::BOOL, + fn GetBreakOnID(&mut self, ID: ::D3D12_MESSAGE_ID) -> ::BOOL, + fn SetMuteDebugOutput(&mut self, bMute: ::BOOL) -> (), + fn GetMuteDebugOutput(&mut self) -> ::BOOL +}} diff --git a/third_party/rust/winapi/src/d3d12shader.rs b/third_party/rust/winapi/src/d3d12shader.rs new file mode 100644 index 000000000000..bd210b25d4e9 --- /dev/null +++ b/third_party/rust/winapi/src/d3d12shader.rs @@ -0,0 +1,320 @@ +// Copyright © 2016; Dmitry Roschin +// Licensed under the MIT License +FLAGS!{ enum D3D12_SHADER_VERSION_TYPE { + D3D12_SHVER_PIXEL_SHADER = 0x0, + D3D12_SHVER_VERTEX_SHADER = 0x1, + D3D12_SHVER_GEOMETRY_SHADER = 0x2, + D3D12_SHVER_HULL_SHADER = 0x3, + D3D12_SHVER_DOMAIN_SHADER = 0x4, + D3D12_SHVER_COMPUTE_SHADER = 0x5, + D3D12_SHVER_RESERVED0 = 0xFFF0, +}} + +STRUCT!{struct D3D12_FUNCTION_DESC { + Version: ::UINT, + Creator: ::LPCSTR, + Flags: ::UINT, + ConstantBuffers: ::UINT, + BoundResources: ::UINT, + InstructionCount: ::UINT, + TempRegisterCount: ::UINT, + TempArrayCount: ::UINT, + DefCount: ::UINT, + DclCount: ::UINT, + TextureNormalInstructions: ::UINT, + TextureLoadInstructions: ::UINT, + TextureCompInstructions: ::UINT, + TextureBiasInstructions: ::UINT, + TextureGradientInstructions: ::UINT, + FloatInstructionCount: ::UINT, + IntInstructionCount: ::UINT, + UintInstructionCount: ::UINT, + StaticFlowControlCount: ::UINT, + DynamicFlowControlCount: ::UINT, + MacroInstructionCount: ::UINT, + ArrayInstructionCount: ::UINT, + MovInstructionCount: ::UINT, + MovcInstructionCount: ::UINT, + ConversionInstructionCount: ::UINT, + BitwiseInstructionCount: ::UINT, + MinFeatureLevel: ::D3D_FEATURE_LEVEL, + RequiredFeatureFlags: ::UINT64, + Name: ::LPCSTR, + FunctionParameterCount: ::INT, + HasReturn: ::BOOL, + Has10Level9VertexShader: ::BOOL, + Has10Level9PixelShader: ::BOOL, +}} + +STRUCT!{struct D3D12_LIBRARY_DESC { + Creator: ::LPCSTR, + Flags: ::UINT, + FunctionCount: ::UINT, +}} + +STRUCT!{struct D3D12_PARAMETER_DESC { + Name: ::LPCSTR, + SemanticName: ::LPCSTR, + Type: ::D3D_SHADER_VARIABLE_TYPE, + Class: ::D3D_SHADER_VARIABLE_CLASS, + Rows: ::UINT, + Columns: ::UINT, + InterpolationMode: ::D3D_INTERPOLATION_MODE, + Flags: ::D3D_PARAMETER_FLAGS, + FirstInRegister: ::UINT, + FirstInComponent: ::UINT, + FirstOutRegister: ::UINT, + FirstOutComponent: ::UINT, +}} + +STRUCT!{struct D3D12_SHADER_BUFFER_DESC { + Name: ::LPCSTR, + Type: ::D3D_CBUFFER_TYPE, + Variables: ::UINT, + Size: ::UINT, + uFlags: ::UINT, +}} + +STRUCT!{struct D3D12_SHADER_DESC { + Version: ::UINT, + Creator: ::LPCSTR, + Flags: ::UINT, + ConstantBuffers: ::UINT, + BoundResources: ::UINT, + InputParameters: ::UINT, + OutputParameters: ::UINT, + InstructionCount: ::UINT, + TempRegisterCount: ::UINT, + TempArrayCount: ::UINT, + DefCount: ::UINT, + DclCount: ::UINT, + TextureNormalInstructions: ::UINT, + TextureLoadInstructions: ::UINT, + TextureCompInstructions: ::UINT, + TextureBiasInstructions: ::UINT, + TextureGradientInstructions: ::UINT, + FloatInstructionCount: ::UINT, + IntInstructionCount: ::UINT, + UintInstructionCount: ::UINT, + StaticFlowControlCount: ::UINT, + DynamicFlowControlCount: ::UINT, + MacroInstructionCount: ::UINT, + ArrayInstructionCount: ::UINT, + CutInstructionCount: ::UINT, + EmitInstructionCount: ::UINT, + GSOutputTopology: ::D3D_PRIMITIVE_TOPOLOGY, + GSMaxOutputVertexCount: ::UINT, + InputPrimitive: ::D3D_PRIMITIVE, + PatchConstantParameters: ::UINT, + cGSInstanceCount: ::UINT, + cControlPoints: ::UINT, + HSOutputPrimitive: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE, + HSPartitioning: ::D3D_TESSELLATOR_PARTITIONING, + TessellatorDomain: ::D3D_TESSELLATOR_DOMAIN, + cBarrierInstructions: ::UINT, + cInterlockedInstructions: ::UINT, + cTextureStoreInstructions: ::UINT, +}} + +STRUCT!{struct D3D12_SHADER_INPUT_BIND_DESC { + Name: ::LPCSTR, + Type: ::D3D_SHADER_INPUT_TYPE, + BindPoint: ::UINT, + BindCount: ::UINT, + uFlags: ::UINT, + ReturnType: ::D3D_RESOURCE_RETURN_TYPE, + Dimension: ::D3D_SRV_DIMENSION, + NumSamples: ::UINT, + Space: ::UINT, + uID: ::UINT, +}} + +STRUCT!{struct D3D12_SHADER_TYPE_DESC { + Class: ::D3D_SHADER_VARIABLE_CLASS, + Type: ::D3D_SHADER_VARIABLE_TYPE, + Rows: ::UINT, + Columns: ::UINT, + Elements: ::UINT, + Members: ::UINT, + Offset: ::UINT, + Name: ::LPCSTR, +}} + +STRUCT!{struct D3D12_SHADER_VARIABLE_DESC { + Name: ::LPCSTR, + StartOffset: ::UINT, + Size: ::UINT, + uFlags: ::UINT, + DefaultValue: ::LPVOID, + StartTexture: ::UINT, + TextureSize: ::UINT, + StartSampler: ::UINT, + SamplerSize: ::UINT, +}} + +STRUCT!{struct D3D12_SIGNATURE_PARAMETER_DESC { + SemanticName: ::LPCSTR, + SemanticIndex: ::UINT, + Register: ::UINT, + SystemValueType: ::D3D_NAME, + ComponentType: ::D3D_REGISTER_COMPONENT_TYPE, + Mask: ::BYTE, + ReadWriteMask: ::BYTE, + Stream: ::UINT, + MinPrecision: ::D3D_MIN_PRECISION, +}} + +RIDL!( +interface ID3D12FunctionParameterReflection(ID3D12FunctionParameterReflectionVtbl) { + fn GetDesc(&mut self, pDesc: *mut ::D3D12_PARAMETER_DESC) -> ::HRESULT +}); + +RIDL!( +interface ID3D12FunctionReflection(ID3D12FunctionReflectionVtbl) { + fn GetDesc(&mut self, pDesc: *mut ::D3D12_FUNCTION_DESC) -> ::HRESULT, + fn GetConstantBufferByIndex( + &mut self, BufferIndex: ::UINT + ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + &mut self, Name: ::LPCSTR + ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + &mut self, ResourceIndex: ::UINT, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC + ) -> ::HRESULT, + fn GetVariableByName( + &mut self, Name: ::LPCSTR + ) -> *mut ::ID3D12ShaderReflectionVariable, + fn GetResourceBindingDescByName( + &mut self, Name: ::LPCSTR, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC + ) -> ::HRESULT, + fn GetFunctionParameter( + &mut self, ParameterIndex: ::INT + ) -> *mut ::ID3D12FunctionParameterReflection +}); + +RIDL!( +interface ID3D12LibraryReflection(ID3D12LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { + fn QueryInterface( + &mut self, iid: *const ::IID, ppv: *mut ::LPVOID + ) -> ::HRESULT, + fn AddRef(&mut self) -> ::ULONG, + fn Release(&mut self) -> ::ULONG, + fn GetDesc(&mut self, pDesc: *mut ::D3D12_LIBRARY_DESC) -> ::HRESULT, + fn GetFunctionByIndex( + &mut self, FunctionIndex: ::INT + ) -> *mut ::ID3D12FunctionReflection +}); + +RIDL!( +interface ID3D12ShaderReflectionConstantBuffer(ID3D12ShaderReflectionConstantBufferVtbl) { + fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_BUFFER_DESC) -> ::HRESULT, + fn GetVariableByIndex( + &mut self, Index: ::UINT + ) -> *mut ::ID3D12ShaderReflectionVariable, + fn GetVariableByName( + &mut self, Name: ::LPCSTR + ) -> *mut ::ID3D12ShaderReflectionVariable +}); + +RIDL!( +interface ID3D12ShaderReflectionType(ID3D12ShaderReflectionTypeVtbl) { + fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_TYPE_DESC) -> ::HRESULT, + fn GetMemberTypeByIndex( + &mut self, Index: ::UINT + ) -> *mut ::ID3D12ShaderReflectionType, + fn GetMemberTypeByName( + &mut self, Name: ::LPCSTR + ) -> *mut ::ID3D12ShaderReflectionType, + fn GetMemberTypeName(&mut self, Index: ::UINT) -> ::LPCSTR, + fn IsEqual( + &mut self, pType: *mut ::ID3D12ShaderReflectionType + ) -> ::HRESULT, + fn GetSubType(&mut self) -> *mut ::ID3D12ShaderReflectionType, + fn GetBaseClass(&mut self) -> *mut ::ID3D12ShaderReflectionType, + fn GetNumInterfaces(&mut self) -> ::UINT, + fn GetInterfaceByIndex( + &mut self, uIndex: ::UINT + ) -> *mut ::ID3D12ShaderReflectionType, + fn IsOfType( + &mut self, pType: *mut ::ID3D12ShaderReflectionType + ) -> ::HRESULT, + fn ImplementsInterface( + &mut self, pBase: *mut ::ID3D12ShaderReflectionType + ) -> ::HRESULT +}); + +RIDL!( +interface ID3D12ShaderReflectionVariable(ID3D12ShaderReflectionVariableVtbl) { + fn GetDesc( + &mut self, pDesc: *mut ::D3D12_SHADER_VARIABLE_DESC + ) -> ::HRESULT, + fn GetType(&mut self) -> *mut ::ID3D12ShaderReflectionType, + fn GetBuffer(&mut self) -> *mut ::ID3D12ShaderReflectionConstantBuffer, + fn GetInterfaceSlot(&mut self, uArrayIndex: ::UINT) -> ::UINT +}); + +RIDL!( +interface ID3D12ShaderReflection(ID3D12ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { + fn QueryInterface( + &mut self, iid: *const ::IID, ppv: *mut ::LPVOID + ) -> ::HRESULT, + fn AddRef(&mut self) -> ::ULONG, + fn Release(&mut self) -> ::ULONG, + fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_DESC) -> ::HRESULT, + fn GetConstantBufferByIndex( + &mut self, Index: ::UINT + ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + &mut self, Name: ::LPCSTR + ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + &mut self, ResourceIndex: ::UINT, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC + ) -> ::HRESULT, + fn GetInputParameterDesc( + &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC + ) -> ::HRESULT, + fn GetOutputParameterDesc( + &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC + ) -> ::HRESULT, + fn GetPatchConstantParameterDesc( + &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC + ) -> ::HRESULT, + fn GetVariableByName( + &mut self, Name: ::LPCSTR + ) -> *mut ::ID3D12ShaderReflectionVariable, + fn GetResourceBindingDescByName( + &mut self, Name: ::LPCSTR, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC + ) -> ::HRESULT, + fn GetMovInstructionCount(&mut self) -> ::UINT, + fn GetMovcInstructionCount(&mut self) -> ::UINT, + fn GetConversionInstructionCount(&mut self) -> ::UINT, + fn GetBitwiseInstructionCount(&mut self) -> ::UINT, + fn GetGSInputPrimitive(&mut self) -> ::D3D_PRIMITIVE, + fn IsSampleFrequencyShader(&mut self) -> ::BOOL, + fn GetNumInterfaceSlots(&mut self) -> ::UINT, + fn GetMinFeatureLevel( + &mut self, pLevel: *mut ::D3D_FEATURE_LEVEL + ) -> ::HRESULT, + fn GetThreadGroupSize( + &mut self, pSizeX: *mut ::UINT, pSizeY: *mut ::UINT, pSizeZ: *mut ::UINT + ) -> ::UINT, + fn GetRequiresFlags(&mut self) -> ::UINT64 +}); + +pub type D3D12_CBUFFER_TYPE = ::D3D_CBUFFER_TYPE; +pub type D3D12_RESOURCE_RETURN_TYPE = ::D3D_RESOURCE_RETURN_TYPE; +pub type D3D12_TESSELLATOR_DOMAIN = ::D3D_TESSELLATOR_DOMAIN; +pub type D3D12_TESSELLATOR_OUTPUT_PRIMITIVE = ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE; +pub type D3D12_TESSELLATOR_PARTITIONING = ::D3D_TESSELLATOR_PARTITIONING; +pub type LPD3D12FUNCTIONPARAMETERREFLECTION = *mut ::ID3D12FunctionParameterReflection; +pub type LPD3D12FUNCTIONREFLECTION = *mut ::ID3D12FunctionReflection; +pub type LPD3D12LIBRARYREFLECTION = *mut ::ID3D12LibraryReflection; +pub type LPD3D12SHADERREFLECTION = *mut ::ID3D12ShaderReflection; +pub type LPD3D12SHADERREFLECTIONCONSTANTBUFFER = *mut ::ID3D12ShaderReflectionConstantBuffer; +pub type LPD3D12SHADERREFLECTIONTYPE = *mut ::ID3D12ShaderReflectionType; +pub type LPD3D12SHADERREFLECTIONVARIABLE = *mut ::ID3D12ShaderReflectionVariable; +pub const D3D_SHADER_REQUIRES_INNER_COVERAGE: ::UINT64 = 0x00000400; +pub const D3D_SHADER_REQUIRES_ROVS: ::UINT64 = 0x00001000; +pub const D3D_SHADER_REQUIRES_STENCIL_REF: ::UINT64 = 0x00000200; +pub const D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS: ::UINT64 = 0x00000800; +pub const D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER: ::UINT64 = 0x00002000; diff --git a/third_party/rust/winapi/src/d3d9.rs b/third_party/rust/winapi/src/d3d9.rs new file mode 100644 index 000000000000..26f9031d0618 --- /dev/null +++ b/third_party/rust/winapi/src/d3d9.rs @@ -0,0 +1,713 @@ +// Copyright © 2015, Corey Richardson +// Licensed under the MIT License +//! Direct3D include file +pub const D3D_SDK_VERSION: ::DWORD = 32; +pub const D3D9b_SDK_VERSION: ::DWORD = 31; +RIDL!( +interface IDirect3D9(IDirect3D9Vtbl): IUnknown(IUnknownVtbl) { + fn RegisterSoftwareDevice(&mut self, pInitializeFunction: *mut ::VOID) -> ::HRESULT, + fn GetAdapterCount(&mut self) -> ::UINT, + fn GetAdapterIdentifier( + &mut self, Adapter: ::UINT, Flags: ::DWORD, pIdentifier: *mut ::D3DADAPTER_IDENTIFIER9 + ) -> ::HRESULT, + fn GetAdapterModeCount(&mut self, Adapter: ::UINT, Format: ::D3DFORMAT) -> ::UINT, + fn EnumAdapterModes( + &mut self, Adapter: ::UINT, Format: ::D3DFORMAT, Mode: ::UINT, pMode: *mut ::D3DDISPLAYMODE + ) -> ::HRESULT, + fn GetAdapterDisplayMode( + &mut self, Adapter: ::UINT, pMode: *mut ::D3DDISPLAYMODE + ) -> ::HRESULT, + fn CheckDeviceType( + &mut self, Adapter: ::UINT, DevType: ::D3DDEVTYPE, AdapterFormat: ::D3DFORMAT, + BackBufferFormat: ::D3DFORMAT, bWindowed: ::BOOL + ) -> ::HRESULT, + fn CheckDeviceFormat( + &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, AdapterFormat: ::D3DFORMAT, + Usage: ::DWORD, RType: ::D3DRESOURCETYPE, CheckFormat: ::D3DFORMAT + ) -> ::HRESULT, + fn CheckDeviceMultiSampleType( + &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, SurfaceFormat: ::D3DFORMAT, + Windowed: ::BOOL, MultiSampleType: ::D3DMULTISAMPLE_TYPE, pQualityLevels: *mut ::DWORD + ) -> ::HRESULT, + fn CheckDepthStencilMatch( + &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, AdapterFormat: ::D3DFORMAT, + RenderTargetFormat: ::D3DFORMAT, DepthStencilFormat: ::D3DFORMAT + ) -> ::HRESULT, + fn CheckDeviceFormatConversion( + &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, SourceFormat: ::D3DFORMAT, + TargetFormat: ::D3DFORMAT + ) -> ::HRESULT, + fn GetDeviceCaps( + &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, pCaps: *mut ::D3DCAPS9 + ) -> ::HRESULT, + fn GetAdapterMonitor(&mut self, Adapter: ::UINT) -> ::HMONITOR, + fn CreateDevice( + &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, hFocusWindow: ::HWND, + BehaviorFlags: ::DWORD, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, + ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9 + ) -> ::HRESULT +} +); +pub type LPDIRECT3D9 = *mut IDirect3D9; +pub type PDIRECT3D9 = *mut IDirect3D9; +RIDL!( +interface IDirect3DDevice9(IDirect3DDevice9Vtbl): IUnknown(IUnknownVtbl) { + fn TestCooperativeLevel(&mut self) -> ::HRESULT, + fn GetAvailableTextureMem(&mut self) -> ::UINT, + fn EvictManagedResources(&mut self) -> ::HRESULT, + fn GetDirect3D(&mut self, ppD3D9: *mut *mut IDirect3D9) -> ::HRESULT, + fn GetDeviceCaps(&mut self, pCaps: *mut ::D3DCAPS9) -> ::HRESULT, + fn GetDisplayMode(&mut self, iSwapChain: ::UINT, pMode: *mut ::D3DDISPLAYMODE) -> ::HRESULT, + fn GetCreationParameters( + &mut self, pParameters: *mut ::D3DDEVICE_CREATION_PARAMETERS + ) -> ::HRESULT, + fn SetCursorProperties( + &mut self, XHotSpot: ::UINT, YHotSpot: ::UINT, pCursorBitmap: *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn SetCursorPosition(&mut self, X: ::INT, Y: ::INT, Flags: ::DWORD) -> (), + fn ShowCursor(&mut self, bShow: ::BOOL) -> ::BOOL, + fn CreateAdditionalSwapChain( + &mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, + pSwapChain: *mut *mut IDirect3DSwapChain9 + ) -> ::HRESULT, + fn GetSwapChain( + &mut self, iSwapChain: ::UINT, pSwapChain: *mut *mut IDirect3DSwapChain9 + ) -> ::HRESULT, + fn GetNumberOfSwapChains(&mut self) -> ::UINT, + fn Reset(&mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS) -> ::HRESULT, + fn Present( + &mut self, pSourceRect: *const ::RECT, pDestRect: *const ::RECT, + hDestWindowOverride: ::HWND, pDirtyRegion: *const ::RGNDATA + ) -> ::HRESULT, + fn GetBackBuffer( + &mut self, iSwapChain: ::UINT, iBackBuffer: ::UINT, Type: ::D3DBACKBUFFER_TYPE, + ppBackBuffer: *mut *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn GetRasterStatus( + &mut self, iSwapChain: ::UINT, pRasterStatus: *mut ::D3DRASTER_STATUS + ) -> ::HRESULT, + fn SetDialogBoxMode(&mut self, bEnableDialogs: ::BOOL) -> ::HRESULT, + fn SetGammaRamp( + &mut self, iSwapChain: ::UINT, Flags: ::DWORD, pRamp: *const ::D3DGAMMARAMP + ) -> (), + fn GetGammaRamp(&mut self, iSwapChain: ::UINT, pRamp: *mut ::D3DGAMMARAMP) -> (), + fn CreateTexture( + &mut self, Width: ::UINT, Height: ::UINT, Levels: ::UINT, Usage: ::DWORD, + Format: ::D3DFORMAT, Pool: ::D3DPOOL, ppTexture: *mut *mut IDirect3DTexture9, + pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn CreateVolumeTexture( + &mut self, Width: ::UINT, Height: ::UINT, Depth: ::UINT, Levels: ::UINT, Usage: ::DWORD, + Format: ::D3DFORMAT, Pool: ::D3DPOOL, ppVolumeTexture: *mut *mut IDirect3DVolumeTexture9, + pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn CreateCubeTexture( + &mut self, EdgeLength: ::UINT, Levels: ::UINT, Usage: ::DWORD, Format: ::D3DFORMAT, + Pool: ::D3DPOOL, ppCubeTexture: *mut *mut IDirect3DCubeTexture9, + pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn CreateVertexBuffer( + &mut self, Length: ::UINT, Usage: ::DWORD, FVF: ::DWORD, Pool: ::D3DPOOL, + ppVertexBuffer: *mut *mut IDirect3DVertexBuffer9, pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn CreateIndexBuffer( + &mut self, Length: ::UINT, Usage: ::DWORD, Format: ::D3DFORMAT, Pool: ::D3DPOOL, + ppIndexBuffer: *mut *mut IDirect3DIndexBuffer9, pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn CreateRenderTarget( + &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, + MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Lockable: ::BOOL, + ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn CreateDepthStencilSurface( + &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, + MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Discard: ::BOOL, + ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn UpdateSurface( + &mut self, pSourceSurface: *mut IDirect3DSurface9, pSourceRect: *const ::RECT, + pDestinationSurface: *mut IDirect3DSurface9, pDestPoint: *const ::POINT + ) -> ::HRESULT, + fn UpdateTexture( + &mut self, pSourceTexture: *mut IDirect3DBaseTexture9, + pDestinationTexture: *mut IDirect3DBaseTexture9 + ) -> ::HRESULT, + fn GetRenderTargetData( + &mut self, pRenderTarget: *mut IDirect3DSurface9, pDestSurface: *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn GetFrontBufferData( + &mut self, iSwapChain: ::UINT, pDestSurface: *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn StretchRect( + &mut self, pSourceSurface: *mut IDirect3DSurface9, pSourceRect: *const ::RECT, + pDestSurface: *mut IDirect3DSurface9, pDestRect: *const ::RECT, + Filter: ::D3DTEXTUREFILTERTYPE + ) -> ::HRESULT, + fn ColorFill( + &mut self, pSurface: *mut IDirect3DSurface9, pRect: *const ::RECT, color: ::D3DCOLOR + ) -> ::HRESULT, + fn CreateOffscreenPlainSurface( + &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, Pool: ::D3DPOOL, + ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn SetRenderTarget( + &mut self, RenderTargetIndex: ::DWORD, pRenderTarget: *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn GetRenderTarget( + &mut self, RenderTargetIndex: ::DWORD, ppRenderTarget: *mut *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn SetDepthStencilSurface(&mut self, pNewZStencil: *mut IDirect3DSurface9) -> ::HRESULT, + fn GetDepthStencilSurface( + &mut self, ppZStencilSurface: *mut *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn BeginScene(&mut self) -> ::HRESULT, + fn EndScene(&mut self) -> ::HRESULT, + fn Clear( + &mut self, Count: ::DWORD, pRects: *const ::D3DRECT, Flags: ::DWORD, Color: ::D3DCOLOR, + Z: ::FLOAT, Stencil: ::DWORD + ) -> ::HRESULT, + fn SetTransform( + &mut self, State: ::D3DTRANSFORMSTATETYPE, pMatrix: *const ::D3DMATRIX + ) -> ::HRESULT, + fn GetTransform( + &mut self, State: ::D3DTRANSFORMSTATETYPE, pMatrix: *mut ::D3DMATRIX + ) -> ::HRESULT, + fn MultiplyTransform( + &mut self, arg1: ::D3DTRANSFORMSTATETYPE, arg2: *const ::D3DMATRIX + ) -> ::HRESULT, + fn SetViewport(&mut self, pViewport: *const ::D3DVIEWPORT9) -> ::HRESULT, + fn GetViewport(&mut self, pViewport: *mut ::D3DVIEWPORT9) -> ::HRESULT, + fn SetMaterial(&mut self, pMaterial: *const ::D3DMATERIAL9) -> ::HRESULT, + fn GetMaterial(&mut self, pMaterial: *mut ::D3DMATERIAL9) -> ::HRESULT, + fn SetLight(&mut self, Index: ::DWORD, arg1: *const ::D3DLIGHT9) -> ::HRESULT, + fn GetLight(&mut self, Index: ::DWORD, arg1: *mut ::D3DLIGHT9) -> ::HRESULT, + fn LightEnable(&mut self, Index: ::DWORD, Enable: ::BOOL) -> ::HRESULT, + fn GetLightEnable(&mut self, Index: ::DWORD, pEnable: *mut ::BOOL) -> ::HRESULT, + fn SetClipPlane(&mut self, Index: ::DWORD, pPlane: *const ::FLOAT) -> ::HRESULT, + fn GetClipPlane(&mut self, Index: ::DWORD, pPlane: *mut ::FLOAT) -> ::HRESULT, + fn SetRenderState(&mut self, State: ::D3DRENDERSTATETYPE, Value: ::DWORD) -> ::HRESULT, + fn GetRenderState(&mut self, State: ::D3DRENDERSTATETYPE, pValue: *mut ::DWORD) -> ::HRESULT, + fn CreateStateBlock( + &mut self, Type: ::D3DSTATEBLOCKTYPE, ppSB: *mut *mut IDirect3DStateBlock9 + ) -> ::HRESULT, + fn BeginStateBlock(&mut self) -> ::HRESULT, + fn EndStateBlock(&mut self, ppSB: *mut *mut IDirect3DStateBlock9) -> ::HRESULT, + fn SetClipStatus(&mut self, pClipStatus: *const ::D3DCLIPSTATUS9) -> ::HRESULT, + fn GetClipStatus(&mut self, pClipStatus: *mut ::D3DCLIPSTATUS9) -> ::HRESULT, + fn GetTexture( + &mut self, Stage: ::DWORD, ppTexture: *mut *mut IDirect3DBaseTexture9 + ) -> ::HRESULT, + fn SetTexture(&mut self, Stage: ::DWORD, pTexture: *mut IDirect3DBaseTexture9) -> ::HRESULT, + fn GetTextureStageState( + &mut self, Stage: ::DWORD, Type: ::D3DTEXTURESTAGESTATETYPE, pValue: *mut ::DWORD + ) -> ::HRESULT, + fn SetTextureStageState( + &mut self, Stage: ::DWORD, Type: ::D3DTEXTURESTAGESTATETYPE, Value: ::DWORD + ) -> ::HRESULT, + fn GetSamplerState( + &mut self, Sampler: ::DWORD, Type: ::D3DSAMPLERSTATETYPE, pValue: *mut ::DWORD + ) -> ::HRESULT, + fn SetSamplerState( + &mut self, Sampler: ::DWORD, Type: ::D3DSAMPLERSTATETYPE, Value: ::DWORD + ) -> ::HRESULT, + fn ValidateDevice(&mut self, pNumPasses: *mut ::DWORD) -> ::HRESULT, + fn SetPaletteEntries( + &mut self, PaletteNumber: ::UINT, pEntries: *const ::PALETTEENTRY + ) -> ::HRESULT, + fn GetPaletteEntries( + &mut self, PaletteNumber: ::UINT, pEntries: *mut ::PALETTEENTRY + ) -> ::HRESULT, + fn SetCurrentTexturePalette(&mut self, PaletteNumber: ::UINT) -> ::HRESULT, + fn GetCurrentTexturePalette(&mut self, PaletteNumber: *mut ::UINT) -> ::HRESULT, + fn SetScissorRect(&mut self, pRect: *const ::RECT) -> ::HRESULT, + fn GetScissorRect(&mut self, pRect: *mut ::RECT) -> ::HRESULT, + fn SetSoftwareVertexProcessing(&mut self, bSoftware: ::BOOL) -> ::HRESULT, + fn GetSoftwareVertexProcessing(&mut self) -> ::BOOL, + fn SetNPatchMode(&mut self, nSegments: ::FLOAT) -> ::HRESULT, + fn GetNPatchMode(&mut self) -> ::FLOAT, + fn DrawPrimitive( + &mut self, PrimitiveType: ::D3DPRIMITIVETYPE, StartVertex: ::UINT, PrimitiveCount: ::UINT + ) -> ::HRESULT, + fn DrawIndexedPrimitive( + &mut self, arg1: ::D3DPRIMITIVETYPE, BaseVertexIndex: ::INT, MinVertexIndex: ::UINT, + NumVertices: ::UINT, startIndex: ::UINT, primCount: ::UINT + ) -> ::HRESULT, + fn DrawPrimitiveUP( + &mut self, PrimitiveType: ::D3DPRIMITIVETYPE, PrimitiveCount: ::UINT, + pVertexStreamZeroData: *const ::VOID, VertexStreamZeroStride: ::UINT + ) -> ::HRESULT, + fn DrawIndexedPrimitiveUP( + &mut self, PrimitiveType: ::D3DPRIMITIVETYPE, MinVertexIndex: ::UINT, NumVertices: ::UINT, + PrimitiveCount: ::UINT, pIndexData: *const ::VOID, IndexDataFormat: ::D3DFORMAT, + pVertexStreamZeroData: *const ::VOID, VertexStreamZeroStride: ::UINT + ) -> ::HRESULT, + fn ProcessVertices( + &mut self, SrcStartIndex: ::UINT, DestIndex: ::UINT, VertexCount: ::UINT, + pDestBuffer: *mut IDirect3DVertexBuffer9, pVertexDecl: *mut IDirect3DVertexDeclaration9, + Flags: ::DWORD + ) -> ::HRESULT, + fn CreateVertexDeclaration( + &mut self, pVertexElements: *const ::D3DVERTEXELEMENT9, + ppDecl: *mut *mut IDirect3DVertexDeclaration9 + ) -> ::HRESULT, + fn SetVertexDeclaration(&mut self, pDecl: *mut IDirect3DVertexDeclaration9) -> ::HRESULT, + fn GetVertexDeclaration(&mut self, ppDecl: *mut *mut IDirect3DVertexDeclaration9) -> ::HRESULT, + fn SetFVF(&mut self, FVF: ::DWORD) -> ::HRESULT, + fn GetFVF(&mut self, pFVF: *mut ::DWORD) -> ::HRESULT, + fn CreateVertexShader( + &mut self, pFunction: *const ::DWORD, ppShader: *mut *mut IDirect3DVertexShader9 + ) -> ::HRESULT, + fn SetVertexShader(&mut self, pShader: *mut IDirect3DVertexShader9) -> ::HRESULT, + fn GetVertexShader(&mut self, ppShader: *mut *mut IDirect3DVertexShader9) -> ::HRESULT, + fn SetVertexShaderConstantF( + &mut self, StartRegister: ::UINT, pConstantData: *const ::FLOAT, Vector4fCount: ::UINT + ) -> ::HRESULT, + fn GetVertexShaderConstantF( + &mut self, StartRegister: ::UINT, pConstantData: *mut ::FLOAT, Vector4fCount: ::UINT + ) -> ::HRESULT, + fn SetVertexShaderConstantI( + &mut self, StartRegister: ::UINT, pConstantData: *const ::INT, Vector4iCount: ::UINT + ) -> ::HRESULT, + fn GetVertexShaderConstantI( + &mut self, StartRegister: ::UINT, pConstantData: *mut ::INT, Vector4iCount: ::UINT + ) -> ::HRESULT, + fn SetVertexShaderConstantB( + &mut self, StartRegister: ::UINT, pConstantData: *const ::BOOL, BoolCount: ::UINT + ) -> ::HRESULT, + fn GetVertexShaderConstantB( + &mut self, StartRegister: ::UINT, pConstantData: *mut ::BOOL, BoolCount: ::UINT + ) -> ::HRESULT, + fn SetStreamSource( + &mut self, StreamNumber: ::UINT, pStreamData: *mut IDirect3DVertexBuffer9, + OffsetInBytes: ::UINT, Stride: ::UINT + ) -> ::HRESULT, + fn GetStreamSource( + &mut self, StreamNumber: ::UINT, ppStreamData: *mut *mut IDirect3DVertexBuffer9, + pOffsetInBytes: *mut ::UINT, pStride: *mut ::UINT + ) -> ::HRESULT, + fn SetStreamSourceFreq(&mut self, StreamNumber: ::UINT, Setting: ::UINT) -> ::HRESULT, + fn GetStreamSourceFreq(&mut self, StreamNumber: ::UINT, pSetting: *mut ::UINT) -> ::HRESULT, + fn SetIndices(&mut self, pIndexData: *mut IDirect3DIndexBuffer9) -> ::HRESULT, + fn GetIndices(&mut self, ppIndexData: *mut *mut IDirect3DIndexBuffer9) -> ::HRESULT, + fn CreatePixelShader( + &mut self, pFunction: *const ::DWORD, ppShader: *mut *mut IDirect3DPixelShader9 + ) -> ::HRESULT, + fn SetPixelShader(&mut self, pShader: *mut IDirect3DPixelShader9) -> ::HRESULT, + fn GetPixelShader(&mut self, ppShader: *mut *mut IDirect3DPixelShader9) -> ::HRESULT, + fn SetPixelShaderConstantF( + &mut self, StartRegister: ::UINT, pConstantData: *const ::FLOAT, Vector4fCount: ::UINT + ) -> ::HRESULT, + fn GetPixelShaderConstantF( + &mut self, StartRegister: ::UINT, pConstantData: *mut ::FLOAT, Vector4fCount: ::UINT + ) -> ::HRESULT, + fn SetPixelShaderConstantI( + &mut self, StartRegister: ::UINT, pConstantData: *const ::INT, Vector4iCount: ::UINT + ) -> ::HRESULT, + fn GetPixelShaderConstantI( + &mut self, StartRegister: ::UINT, pConstantData: *mut ::INT, Vector4iCount: ::UINT + ) -> ::HRESULT, + fn SetPixelShaderConstantB( + &mut self, StartRegister: ::UINT, pConstantData: *const ::BOOL, BoolCount: ::UINT + ) -> ::HRESULT, + fn GetPixelShaderConstantB( + &mut self, StartRegister: ::UINT, pConstantData: *mut ::BOOL, BoolCount: ::UINT + ) -> ::HRESULT, + fn DrawRectPatch( + &mut self, Handle: ::UINT, pNumSegs: *const ::FLOAT, + pRectPatchInfo: *const ::D3DRECTPATCH_INFO + ) -> ::HRESULT, + fn DrawTriPatch( + &mut self, Handle: ::UINT, pNumSegs: *const ::FLOAT, + pTriPatchInfo: *const ::D3DTRIPATCH_INFO + ) -> ::HRESULT, + fn DeletePatch(&mut self, Handle: ::UINT) -> ::HRESULT, + fn CreateQuery( + &mut self, Type: ::D3DQUERYTYPE, ppQuery: *mut *mut IDirect3DQuery9 + ) -> ::HRESULT +} +); +pub type LPDIRECT3DDEVICE9 = *mut IDirect3DDevice9; +pub type PDIRECT3DDEVICE9 = *mut IDirect3DDevice9; +RIDL!( +interface IDirect3DStateBlock9(IDirect3DStateBlock9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn Capture(&mut self) -> ::HRESULT, + fn Apply(&mut self) -> ::HRESULT +} +); +pub type LPDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9; +pub type PDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9; +RIDL!( +interface IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl): IUnknown(IUnknownVtbl) { + fn Present( + &mut self, pSourceRect: *const ::RECT, pDestRect: *const ::RECT, + hDestWindowOverride: ::HWND, pDirtyRegion: *const ::RGNDATA, dwFlags: ::DWORD + ) -> ::HRESULT, + fn GetFrontBufferData(&mut self, pDestSurface: *mut IDirect3DSurface9) -> ::HRESULT, + fn GetBackBuffer( + &mut self, iBackBuffer: ::UINT, Type: ::D3DBACKBUFFER_TYPE, + ppBackBuffer: *mut *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn GetRasterStatus(&mut self, pRasterStatus: *mut ::D3DRASTER_STATUS) -> ::HRESULT, + fn GetDisplayMode(&mut self, pMode: *mut ::D3DDISPLAYMODE) -> ::HRESULT, + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn GetPresentParameters( + &mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS + ) -> ::HRESULT +} +); +pub type LPDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9; +pub type PDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9; +RIDL!( +interface IDirect3DResource9(IDirect3DResource9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn SetPrivateData( + &mut self, refguid: *const ::GUID, pData: *const ::VOID, SizeOfData: ::DWORD, + Flags: ::DWORD + ) -> ::HRESULT, + fn GetPrivateData( + &mut self, refguid: *const ::GUID, pData: *mut ::VOID, pSizeOfData: *mut ::DWORD + ) -> ::HRESULT, + fn FreePrivateData(&mut self, refguid: *const ::GUID) -> ::HRESULT, + fn SetPriority(&mut self, PriorityNew: ::DWORD) -> ::DWORD, + fn GetPriority(&mut self) -> ::DWORD, + fn PreLoad(&mut self) -> (), + fn GetType(&mut self) -> ::D3DRESOURCETYPE +} +); +pub type LPDIRECT3DRESOURCE9 = *mut IDirect3DResource9; +pub type PDIRECT3DRESOURCE9 = *mut IDirect3DResource9; +RIDL!( +interface IDirect3DVertexDeclaration9(IDirect3DVertexDeclaration9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn GetDeclaration( + &mut self, pElement: *mut ::D3DVERTEXELEMENT9, pNumElements: *mut ::UINT + ) -> ::HRESULT +} +); +pub type LPDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9; +pub type PDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9; +RIDL!( +interface IDirect3DVertexShader9(IDirect3DVertexShader9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn GetFunction(&mut self, arg1: *mut ::VOID, pSizeOfData: *mut ::UINT) -> ::HRESULT +} +); +pub type LPDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9; +pub type PDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9; +RIDL!( +interface IDirect3DPixelShader9(IDirect3DPixelShader9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn GetFunction(&mut self, arg1: *mut ::VOID, pSizeOfData: *mut ::UINT) -> ::HRESULT +} +); +pub type LPDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9; +pub type PDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9; +RIDL!( +interface IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { + fn SetLOD(&mut self, LODNew: ::DWORD) -> ::DWORD, + fn GetLOD(&mut self) -> ::DWORD, + fn GetLevelCount(&mut self) -> ::DWORD, + fn SetAutoGenFilterType(&mut self, FilterType: ::D3DTEXTUREFILTERTYPE) -> ::HRESULT, + fn GetAutoGenFilterType(&mut self) -> ::D3DTEXTUREFILTERTYPE, + fn GenerateMipSubLevels(&mut self) -> () +} +); +pub type LPDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9; +pub type PDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9; +RIDL!( +interface IDirect3DTexture9(IDirect3DTexture9Vtbl): IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { + fn GetLevelDesc(&mut self, Level: ::UINT, pDesc: *mut ::D3DSURFACE_DESC) -> ::HRESULT, + fn GetSurfaceLevel( + &mut self, Level: ::UINT, ppSurfaceLevel: *mut *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn LockRect( + &mut self, Level: ::UINT, pLockedRect: *mut ::D3DLOCKED_RECT, pRect: *const ::RECT, + Flags: ::DWORD + ) -> ::HRESULT, + fn UnlockRect(&mut self, Level: ::UINT) -> ::HRESULT, + fn AddDirtyRect(&mut self, pDirtyRect: *const ::RECT) -> ::HRESULT +} +); +pub type LPDIRECT3DTEXTURE9 = *mut IDirect3DTexture9; +pub type PDIRECT3DTEXTURE9 = *mut IDirect3DTexture9; +RIDL!( +interface IDirect3DVolumeTexture9(IDirect3DVolumeTexture9Vtbl): IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { + fn GetLevelDesc(&mut self, Level: ::UINT, pDesc: *mut ::D3DVOLUME_DESC) -> ::HRESULT, + fn GetVolumeLevel( + &mut self, Level: ::UINT, ppVolumeLevel: *mut *mut IDirect3DVolume9 + ) -> ::HRESULT, + fn LockBox( + &mut self, Level: ::UINT, pLockedVolume: *mut ::D3DLOCKED_BOX, pBox: *const ::D3DBOX, + Flags: ::DWORD + ) -> ::HRESULT, + fn UnlockBox(&mut self, Level: ::UINT) -> ::HRESULT, + fn AddDirtyBox(&mut self, pDirtyBox: *const ::D3DBOX) -> ::HRESULT +} +); +pub type LPDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9; +pub type PDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9; +RIDL!( +interface IDirect3DCubeTexture9(IDirect3DCubeTexture9Vtbl): IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { + fn GetLevelDesc(&mut self, Level: ::UINT, pDesc: *mut ::D3DSURFACE_DESC) -> ::HRESULT, + fn GetCubeMapSurface( + &mut self, FaceType: ::D3DCUBEMAP_FACES, Level: ::UINT, + ppCubeMapSurface: *mut *mut IDirect3DSurface9 + ) -> ::HRESULT, + fn LockRect( + &mut self, FaceType: ::D3DCUBEMAP_FACES, Level: ::UINT, pLockedRect: *mut ::D3DLOCKED_RECT, + pRect: *const ::RECT, Flags: ::DWORD + ) -> ::HRESULT, + fn UnlockRect(&mut self, FaceType: ::D3DCUBEMAP_FACES, Level: ::UINT) -> ::HRESULT, + fn AddDirtyRect( + &mut self, FaceType: ::D3DCUBEMAP_FACES, pDirtyRect: *const ::RECT + ) -> ::HRESULT +} +); +pub type LPDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9; +pub type PDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9; +RIDL!( +interface IDirect3DVertexBuffer9(IDirect3DVertexBuffer9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { + fn Lock( + &mut self, OffsetToLock: ::UINT, SizeToLock: ::UINT, ppbData: *mut *mut ::VOID, + Flags: ::DWORD + ) -> ::HRESULT, + fn Unlock(&mut self) -> ::HRESULT, + fn GetDesc(&mut self, pDesc: *mut ::D3DVERTEXBUFFER_DESC) -> ::HRESULT +} +); +pub type LPDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9; +pub type PDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9; +RIDL!( +interface IDirect3DIndexBuffer9(IDirect3DIndexBuffer9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { + fn Lock( + &mut self, OffsetToLock: ::UINT, SizeToLock: ::UINT, ppbData: *mut *mut ::VOID, + Flags: ::DWORD + ) -> ::HRESULT, + fn Unlock(&mut self) -> ::HRESULT, + fn GetDesc(&mut self, pDesc: *mut ::D3DINDEXBUFFER_DESC) -> ::HRESULT +} +); +pub type LPDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9; +pub type PDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9; +RIDL!( +interface IDirect3DSurface9(IDirect3DSurface9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { + fn GetContainer(&mut self, riid: *const ::IID, ppContainer: *mut *mut ::VOID) -> ::HRESULT, + fn GetDesc(&mut self, pDesc: *mut ::D3DSURFACE_DESC) -> ::HRESULT, + fn LockRect( + &mut self, pLockedRect: *mut ::D3DLOCKED_RECT, pRect: *const ::RECT, Flags: ::DWORD + ) -> ::HRESULT, + fn UnlockRect(&mut self) -> ::HRESULT, + fn GetDC(&mut self, phdc: *mut ::HDC) -> ::HRESULT, + fn ReleaseDC(&mut self, hdc: ::HDC) -> ::HRESULT +} +); +pub type LPDIRECT3DSURFACE9 = *mut IDirect3DSurface9; +pub type PDIRECT3DSURFACE9 = *mut IDirect3DSurface9; +RIDL!( +interface IDirect3DVolume9(IDirect3DVolume9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn SetPrivateData( + &mut self, refguid: *const ::GUID, pData: *const ::VOID, SizeOfData: ::DWORD, + Flags: ::DWORD + ) -> ::HRESULT, + fn GetPrivateData( + &mut self, refguid: *const ::GUID, pData: *mut ::VOID, pSizeOfData: *mut ::DWORD + ) -> ::HRESULT, + fn FreePrivateData(&mut self, refguid: *const ::GUID) -> ::HRESULT, + fn GetContainer(&mut self, riid: *const ::IID, ppContainer: *mut *mut ::VOID) -> ::HRESULT, + fn GetDesc(&mut self, pDesc: *mut ::D3DVOLUME_DESC) -> ::HRESULT, + fn LockBox( + &mut self, pLockedVolume: *mut ::D3DLOCKED_BOX, pBox: *const ::D3DBOX, Flags: ::DWORD + ) -> ::HRESULT, + fn UnlockBox(&mut self) -> ::HRESULT +} +); +pub type LPDIRECT3DVOLUME9 = *mut IDirect3DVolume9; +pub type PDIRECT3DVOLUME9 = *mut IDirect3DVolume9; +RIDL!( +interface IDirect3DQuery9(IDirect3DQuery9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, + fn GetType(&mut self) -> ::D3DRESOURCETYPE, + fn GetDataSize(&mut self) -> ::DWORD, + fn Issue(&mut self, dwIssueFlags: ::DWORD) -> ::HRESULT, + fn GetData( + &mut self, pData: *mut ::VOID, dwSize: ::DWORD, dwGetDataFlags: ::DWORD + ) -> ::HRESULT +} +); +pub type LPDIRECT3DQUERY9 = *mut IDirect3DQuery9; +pub type PDIRECT3DQUERY9 = *mut IDirect3DQuery9; +pub const D3DCREATE_FPU_PRESERVE: ::DWORD = 0x2; +pub const D3DCREATE_MULTITHREADED: ::DWORD = 0x4; +pub const D3DCREATE_PUREDEVICE: ::DWORD = 0x10; +pub const D3DCREATE_SOFTWARE_VERTEXPROCESSING: ::DWORD = 0x20; +pub const D3DCREATE_HARDWARE_VERTEXPROCESSING: ::DWORD = 0x40; +pub const D3DCREATE_MIXED_VERTEXPROCESSING: ::DWORD = 0x80; +pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT: ::DWORD = 0x100; +pub const D3DCREATE_ADAPTERGROUP_DEVICE: ::DWORD = 0x200; +pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX: ::DWORD = 0x400; +pub const D3DCREATE_NOWINDOWCHANGES: ::DWORD = 0x800; +pub const D3DCREATE_DISABLE_PSGP_THREADING: ::DWORD = 0x2000; +pub const D3DCREATE_ENABLE_PRESENTSTATS: ::DWORD = 0x4000; +pub const D3DCREATE_DISABLE_PRESENTSTATS: ::DWORD = 0x8000; +pub const D3DCREATE_SCREENSAVER: ::DWORD = 0x10000000; +pub const D3DADAPTER_DEFAULT: ::DWORD = 0; +RIDL!( +interface IDirect3D9Ex(IDirect3D9ExVtbl): IDirect3D9(IDirect3D9Vtbl) { + fn GetAdapterModeCountEx( + &mut self, Adapter: ::UINT, pFilter: *const ::D3DDISPLAYMODEFILTER + ) -> ::UINT, + fn EnumAdapterModesEx( + &mut self, Adapter: ::UINT, pFilter: *const ::D3DDISPLAYMODEFILTER, Mode: ::UINT, + pMode: *mut ::D3DDISPLAYMODEEX + ) -> ::HRESULT, + fn GetAdapterDisplayModeEx( + &mut self, Adapter: ::UINT, pMode: *mut ::D3DDISPLAYMODEEX, + pRotation: *mut ::D3DDISPLAYROTATION + ) -> ::HRESULT, + fn CreateDeviceEx( + &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, hFocusWindow: ::HWND, + BehaviorFlags: ::DWORD, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, + pFullscreenDisplayMode: *mut ::D3DDISPLAYMODEEX, + ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9Ex + ) -> ::HRESULT, + fn GetAdapterLUID(&mut self, Adapter: ::UINT, pLUID: *mut ::LUID) -> ::HRESULT +} +); +pub type LPDIRECT3D9EX = *mut IDirect3D9Ex; +pub type PDIRECT3D9EX = *mut IDirect3D9Ex; +RIDL!( +interface IDirect3DDevice9Ex(IDirect3DDevice9ExVtbl): IDirect3DDevice9(IDirect3DDevice9Vtbl) { + fn SetConvolutionMonoKernel( + &mut self, width: ::UINT, height: ::UINT, rows: *mut ::FLOAT, columns: *mut ::FLOAT + ) -> ::HRESULT, + fn ComposeRects( + &mut self, pSrc: *mut IDirect3DSurface9, pDst: *mut IDirect3DSurface9, + pSrcRectDescs: *mut IDirect3DVertexBuffer9, NumRects: ::UINT, + pDstRectDescs: *mut IDirect3DVertexBuffer9, Operation: ::D3DCOMPOSERECTSOP, Xoffset: ::INT, + Yoffset: ::INT + ) -> ::HRESULT, + fn PresentEx( + &mut self, pSourceRect: *const ::RECT, pDestRect: *const ::RECT, + hDestWindowOverride: ::HWND, pDirtyRegion: *const ::RGNDATA, dwFlags: ::DWORD + ) -> ::HRESULT, + fn GetGPUThreadPriority(&mut self, pPriority: *mut ::INT) -> ::HRESULT, + fn SetGPUThreadPriority(&mut self, Priority: ::INT) -> ::HRESULT, + fn WaitForVBlank(&mut self, iSwapChain: ::UINT) -> ::HRESULT, + fn CheckResourceResidency( + &mut self, pResourceArray: *mut *mut IDirect3DResource9, NumResources: ::UINT32 + ) -> ::HRESULT, + fn SetMaximumFrameLatency(&mut self, MaxLatency: ::UINT) -> ::HRESULT, + fn GetMaximumFrameLatency(&mut self, pMaxLatency: *mut ::UINT) -> ::HRESULT, + fn CheckDeviceState(&mut self, hDestinationWindow: ::HWND) -> ::HRESULT, + fn CreateRenderTargetEx( + &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, + MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Lockable: ::BOOL, + ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE, Usage: ::DWORD + ) -> ::HRESULT, + fn CreateOffscreenPlainSurfaceEx( + &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, Pool: ::D3DPOOL, + ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE, Usage: ::DWORD + ) -> ::HRESULT, + fn CreateDepthStencilSurfaceEx( + &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, + MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Discard: ::BOOL, + ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE, Usage: ::DWORD + ) -> ::HRESULT, + fn ResetEx( + &mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, + pFullscreenDisplayMode: *mut ::D3DDISPLAYMODEEX + ) -> ::HRESULT, + fn GetDisplayModeEx( + &mut self, iSwapChain: ::UINT, pMode: *mut ::D3DDISPLAYMODEEX, + pRotation: *mut ::D3DDISPLAYROTATION + ) -> ::HRESULT +} +); +pub type LPDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex; +pub type PDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex; +RIDL!( +interface IDirect3DSwapChain9Ex(IDirect3DSwapChain9ExVtbl): IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl) { + fn GetLastPresentCount(&mut self, pLastPresentCount: *mut ::UINT) -> ::HRESULT, + fn GetPresentStats(&mut self, pPresentationStatistics: *mut ::D3DPRESENTSTATS) -> ::HRESULT, + fn GetDisplayModeEx( + &mut self, pMode: *mut ::D3DDISPLAYMODEEX, pRotation: *mut ::D3DDISPLAYROTATION + ) -> ::HRESULT +} +); +pub type LPDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex; +pub type PDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex; +RIDL!( +interface IDirect3D9ExOverlayExtension(IDirect3D9ExOverlayExtensionVtbl): IUnknown(IUnknownVtbl) { + fn CheckDeviceOverlayType( + &mut self, Adapter: ::UINT, DevType: ::D3DDEVTYPE, OverlayWidth: ::UINT, + OverlayHeight: ::UINT, OverlayFormat: ::D3DFORMAT, pDisplayMode: *mut ::D3DDISPLAYMODEEX, + DisplayRotation: ::D3DDISPLAYROTATION, pOverlayCaps: *mut ::D3DOVERLAYCAPS + ) -> ::HRESULT +} +); +pub type LPDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension; +pub type PDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension; +RIDL!( +interface IDirect3DDevice9Video(IDirect3DDevice9VideoVtbl): IUnknown(IUnknownVtbl) { + fn GetContentProtectionCaps( + &mut self, pCryptoType: *const ::GUID, pDecodeProfile: *const ::GUID, + pCaps: *mut ::D3DCONTENTPROTECTIONCAPS + ) -> ::HRESULT, + fn CreateAuthenticatedChannel( + &mut self, ChannelType: ::D3DAUTHENTICATEDCHANNELTYPE, + ppAuthenticatedChannel: *mut *mut IDirect3DAuthenticatedChannel9, + pChannelHandle: *mut ::HANDLE + ) -> ::HRESULT, + fn CreateCryptoSession( + &mut self, pCryptoType: *const ::GUID, pDecodeProfile: *const ::GUID, + ppCryptoSession: *mut *mut IDirect3DCryptoSession9, pCryptoHandle: *mut ::HANDLE + ) -> ::HRESULT +} +); +pub type LPDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video; +pub type PDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video; +RIDL!( +interface IDirect3DAuthenticatedChannel9(IDirect3DAuthenticatedChannel9Vtbl): IUnknown(IUnknownVtbl) { + fn GetCertificateSize(&mut self, pCertificateSize: *mut ::UINT) -> ::HRESULT, + fn GetCertificate(&mut self, CertifacteSize: ::UINT, ppCertificate: *mut ::BYTE) -> ::HRESULT, + fn NegotiateKeyExchange(&mut self, DataSize: ::UINT, pData: *mut ::VOID) -> ::HRESULT, + fn Query( + &mut self, InputSize: ::UINT, pInput: *const ::VOID, OutputSize: ::UINT, + pOutput: *mut ::VOID + ) -> ::HRESULT, + fn Configure( + &mut self, InputSize: ::UINT, pInput: *const ::VOID, + pOutput: *mut ::D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT + ) -> ::HRESULT +} +); +pub type LPDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9; +pub type PDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9; +RIDL!( +interface IDirect3DCryptoSession9(IDirect3DCryptoSession9Vtbl): IUnknown(IUnknownVtbl) { + fn GetCertificateSize(&mut self, pCertificateSize: *mut ::UINT) -> ::HRESULT, + fn GetCertificate(&mut self, CertifacteSize: ::UINT, ppCertificate: *mut ::BYTE) -> ::HRESULT, + fn NegotiateKeyExchange(&mut self, DataSize: ::UINT, pData: *mut ::VOID) -> ::HRESULT, + fn EncryptionBlt( + &mut self, pSrcSurface: *mut IDirect3DSurface9, pDstSurface: *mut IDirect3DSurface9, + DstSurfaceSize: ::UINT, pIV: *mut ::VOID + ) -> ::HRESULT, + fn DecryptionBlt( + &mut self, pSrcSurface: *mut IDirect3DSurface9, pDstSurface: *mut IDirect3DSurface9, + SrcSurfaceSize: ::UINT, pEncryptedBlockInfo: *mut ::D3DENCRYPTED_BLOCK_INFO, + pContentKey: *mut ::VOID, pIV: *mut ::VOID + ) -> ::HRESULT, + fn GetSurfacePitch( + &mut self, pSrcSurface: *mut IDirect3DSurface9, pSurfacePitch: *mut ::UINT + ) -> ::HRESULT, + fn StartSessionKeyRefresh( + &mut self, pRandomNumber: *mut ::VOID, RandomNumberSize: ::UINT + ) -> ::HRESULT, + fn FinishSessionKeyRefresh(&mut self) -> ::HRESULT, + fn GetEncryptionBltKey(&mut self, pReadbackKey: *mut ::VOID, KeySize: ::UINT) -> ::HRESULT +} +); +pub type LPDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9; +pub type PDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9; diff --git a/third_party/rust/winapi/src/d3d9caps.rs b/third_party/rust/winapi/src/d3d9caps.rs new file mode 100644 index 000000000000..74c877d7b654 --- /dev/null +++ b/third_party/rust/winapi/src/d3d9caps.rs @@ -0,0 +1,349 @@ +// Copyright © 2015, Corey Richardson +// Licensed under the MIT License +//! Direct3D capabilities include file +STRUCT!{struct D3DVSHADERCAPS2_0 { + Caps: ::DWORD, + DynamicFlowControlDepth: ::INT, + NumTemps: ::INT, + StaticFlowControlDepth: ::INT, +}} +pub const D3DVS20CAPS_PREDICATION: ::DWORD = 1 << 0; +pub const D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 24; +pub const D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 0; +pub const D3DVS20_MAX_NUMTEMPS: ::DWORD = 32; +pub const D3DVS20_MIN_NUMTEMPS: ::DWORD = 12; +pub const D3DVS20_MAX_STATICFLOWCONTROLDEPTH: ::DWORD = 4; +pub const D3DVS20_MIN_STATICFLOWCONTROLDEPTH: ::DWORD = 1; +STRUCT!{struct D3DPSHADERCAPS2_0 { + Caps: ::DWORD, + DynamicFlowControlDepth: ::INT, + NumTemps: ::INT, + StaticFlowControlDepth: ::INT, + NumInstructionSlots: ::INT, +}} +pub const D3DPS20CAPS_ARBITRARYSWIZZLE: ::DWORD = 1 << 0; +pub const D3DPS20CAPS_GRADIENTINSTRUCTIONS: ::DWORD = 1 << 1; +pub const D3DPS20CAPS_PREDICATION: ::DWORD = 1 << 2; +pub const D3DPS20CAPS_NODEPENDENTREADLIMIT: ::DWORD = 1 << 3; +pub const D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT: ::DWORD = 1 << 4; +pub const D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 24; +pub const D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 0; +pub const D3DPS20_MAX_NUMTEMPS: ::DWORD = 32; +pub const D3DPS20_MIN_NUMTEMPS: ::DWORD = 12; +pub const D3DPS20_MAX_STATICFLOWCONTROLDEPTH: ::DWORD = 4; +pub const D3DPS20_MIN_STATICFLOWCONTROLDEPTH: ::DWORD = 0; +pub const D3DPS20_MAX_NUMINSTRUCTIONSLOTS: ::DWORD = 512; +pub const D3DPS20_MIN_NUMINSTRUCTIONSLOTS: ::DWORD = 96; +pub const D3DMIN30SHADERINSTRUCTIONS: ::DWORD = 512; +pub const D3DMAX30SHADERINSTRUCTIONS: ::DWORD = 32768; +STRUCT!{struct D3DOVERLAYCAPS { + Caps: ::UINT, + MaxOverlayDisplayWidth: ::UINT, + MaxOverlayDisplayHeight: ::UINT, +}} +pub const D3DOVERLAYCAPS_FULLRANGERGB: ::DWORD = 0x00000001; +pub const D3DOVERLAYCAPS_LIMITEDRANGERGB: ::DWORD = 0x00000002; +pub const D3DOVERLAYCAPS_YCbCr_BT601: ::DWORD = 0x00000004; +pub const D3DOVERLAYCAPS_YCbCr_BT709: ::DWORD = 0x00000008; +pub const D3DOVERLAYCAPS_YCbCr_BT601_xvYCC: ::DWORD = 0x00000010; +pub const D3DOVERLAYCAPS_YCbCr_BT709_xvYCC: ::DWORD = 0x00000020; +pub const D3DOVERLAYCAPS_STRETCHX: ::DWORD = 0x00000040; +pub const D3DOVERLAYCAPS_STRETCHY: ::DWORD = 0x00000080; +STRUCT!{struct D3DCONTENTPROTECTIONCAPS { + Caps: ::DWORD, + KeyExchangeType: ::GUID, + BufferAlignmentStart: ::UINT, + BlockAlignmentSize: ::UINT, + ProtectedMemorySize: ::ULONGLONG, +}} +pub const D3DCPCAPS_SOFTWARE: ::DWORD = 0x00000001; +pub const D3DCPCAPS_HARDWARE: ::DWORD = 0x00000002; +pub const D3DCPCAPS_PROTECTIONALWAYSON: ::DWORD = 0x00000004; +pub const D3DCPCAPS_PARTIALDECRYPTION: ::DWORD = 0x00000008; +pub const D3DCPCAPS_CONTENTKEY: ::DWORD = 0x00000010; +pub const D3DCPCAPS_FRESHENSESSIONKEY: ::DWORD = 0x00000020; +pub const D3DCPCAPS_ENCRYPTEDREADBACK: ::DWORD = 0x00000040; +pub const D3DCPCAPS_ENCRYPTEDREADBACKKEY: ::DWORD = 0x00000080; +pub const D3DCPCAPS_SEQUENTIAL_CTR_IV: ::DWORD = 0x00000100; +pub const D3DCPCAPS_ENCRYPTSLICEDATAONLY: ::DWORD = 0x00000200; +STRUCT!{struct D3DCAPS9 { + DeviceType: ::D3DDEVTYPE, + AdapterOrdinal: ::UINT, + Caps: ::DWORD, + Caps2: ::DWORD, + Caps3: ::DWORD, + PresentationIntervals: ::DWORD, + CursorCaps: ::DWORD, + DevCaps: ::DWORD, + PrimitiveMiscCaps: ::DWORD, + RasterCaps: ::DWORD, + ZCmpCaps: ::DWORD, + SrcBlendCaps: ::DWORD, + DestBlendCaps: ::DWORD, + AlphaCmpCaps: ::DWORD, + ShadeCaps: ::DWORD, + TextureCaps: ::DWORD, + TextureFilterCaps: ::DWORD, + CubeTextureFilterCaps: ::DWORD, + VolumeTextureFilterCaps: ::DWORD, + TextureAddressCaps: ::DWORD, + VolumeTextureAddressCaps: ::DWORD, + LineCaps: ::DWORD, + MaxTextureWidth: ::DWORD, + MaxTextureHeight: ::DWORD, + MaxVolumeExtent: ::DWORD, + MaxTextureRepeat: ::DWORD, + MaxTextureAspectRatio: ::DWORD, + MaxAnisotropy: ::DWORD, + MaxVertexW: ::c_float, + GuardBandLeft: ::c_float, + GuardBandTop: ::c_float, + GuardBandRight: ::c_float, + GuardBandBottom: ::c_float, + ExtentsAdjust: ::c_float, + StencilCaps: ::DWORD, + FVFCaps: ::DWORD, + TextureOpCaps: ::DWORD, + MaxTextureBlendStages: ::DWORD, + MaxSimultaneousTextures: ::DWORD, + VertexProcessingCaps: ::DWORD, + MaxActiveLights: ::DWORD, + MaxUserClipPlanes: ::DWORD, + MaxVertexBlendMatrices: ::DWORD, + MaxVertexBlendMatrixIndex: ::DWORD, + MaxPointSize: ::c_float, + MaxPrimitiveCount: ::DWORD, + MaxVertexIndex: ::DWORD, + MaxStreams: ::DWORD, + MaxStreamStride: ::DWORD, + VertexShaderVersion: ::DWORD, + MaxVertexShaderConst: ::DWORD, + PixelShaderVersion: ::DWORD, + PixelShader1xMaxValue: ::c_float, + DevCaps2: ::DWORD, + MaxNpatchTessellationLevel: ::c_float, + Reserved5: ::DWORD, + MasterAdapterOrdinal: ::UINT, + AdapterOrdinalInGroup: ::UINT, + NumberOfAdaptersInGroup: ::UINT, + DeclTypes: ::DWORD, + NumSimultaneousRTs: ::DWORD, + StretchRectFilterCaps: ::DWORD, + VS20Caps: ::D3DVSHADERCAPS2_0, + PS20Caps: ::D3DPSHADERCAPS2_0, + VertexTextureFilterCaps: ::DWORD, + MaxVShaderInstructionsExecuted: ::DWORD, + MaxPShaderInstructionsExecuted: ::DWORD, + MaxVertexShader30InstructionSlots: ::DWORD, + MaxPixelShader30InstructionSlots: ::DWORD, +}} +pub const D3DCAPS_OVERLAY: ::DWORD = 0x00000800; +pub const D3DCAPS_READ_SCANLINE: ::DWORD = 0x00020000; +pub const D3DCAPS2_FULLSCREENGAMMA: ::DWORD = 0x00020000; +pub const D3DCAPS2_CANCALIBRATEGAMMA: ::DWORD = 0x00100000; +pub const D3DCAPS2_RESERVED: ::DWORD = 0x02000000; +pub const D3DCAPS2_CANMANAGERESOURCE: ::DWORD = 0x10000000; +pub const D3DCAPS2_DYNAMICTEXTURES: ::DWORD = 0x20000000; +pub const D3DCAPS2_CANAUTOGENMIPMAP: ::DWORD = 0x40000000; +pub const D3DCAPS2_CANSHARERESOURCE: ::DWORD = 0x80000000; +pub const D3DCAPS3_RESERVED: ::DWORD = 0x8000001f; +pub const D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD: ::DWORD = 0x00000020; +pub const D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION: ::DWORD = 0x00000080; +pub const D3DCAPS3_COPY_TO_VIDMEM: ::DWORD = 0x00000100; +pub const D3DCAPS3_COPY_TO_SYSTEMMEM: ::DWORD = 0x00000200; +pub const D3DCAPS3_DXVAHD: ::DWORD = 0x00000400; +pub const D3DCAPS3_DXVAHD_LIMITED: ::DWORD = 0x00000800; +pub const D3DPRESENT_INTERVAL_DEFAULT: ::DWORD = 0x00000000; +pub const D3DPRESENT_INTERVAL_ONE: ::DWORD = 0x00000001; +pub const D3DPRESENT_INTERVAL_TWO: ::DWORD = 0x00000002; +pub const D3DPRESENT_INTERVAL_THREE: ::DWORD = 0x00000004; +pub const D3DPRESENT_INTERVAL_FOUR: ::DWORD = 0x00000008; +pub const D3DPRESENT_INTERVAL_IMMEDIATE: ::DWORD = 0x80000000; +pub const D3DCURSORCAPS_COLOR: ::DWORD = 0x00000001; +pub const D3DCURSORCAPS_LOWRES: ::DWORD = 0x00000002; +pub const D3DDEVCAPS_EXECUTESYSTEMMEMORY: ::DWORD = 0x00000010; +pub const D3DDEVCAPS_EXECUTEVIDEOMEMORY: ::DWORD = 0x00000020; +pub const D3DDEVCAPS_TLVERTEXSYSTEMMEMORY: ::DWORD = 0x00000040; +pub const D3DDEVCAPS_TLVERTEXVIDEOMEMORY: ::DWORD = 0x00000080; +pub const D3DDEVCAPS_TEXTURESYSTEMMEMORY: ::DWORD = 0x00000100; +pub const D3DDEVCAPS_TEXTUREVIDEOMEMORY: ::DWORD = 0x00000200; +pub const D3DDEVCAPS_DRAWPRIMTLVERTEX: ::DWORD = 0x00000400; +pub const D3DDEVCAPS_CANRENDERAFTERFLIP: ::DWORD = 0x00000800; +pub const D3DDEVCAPS_TEXTURENONLOCALVIDMEM: ::DWORD = 0x00001000; +pub const D3DDEVCAPS_DRAWPRIMITIVES2: ::DWORD = 0x00002000; +pub const D3DDEVCAPS_SEPARATETEXTUREMEMORIES: ::DWORD = 0x00004000; +pub const D3DDEVCAPS_DRAWPRIMITIVES2EX: ::DWORD = 0x00008000; +pub const D3DDEVCAPS_HWTRANSFORMANDLIGHT: ::DWORD = 0x00010000; +pub const D3DDEVCAPS_CANBLTSYSTONONLOCAL: ::DWORD = 0x00020000; +pub const D3DDEVCAPS_HWRASTERIZATION: ::DWORD = 0x00080000; +pub const D3DDEVCAPS_PUREDEVICE: ::DWORD = 0x00100000; +pub const D3DDEVCAPS_QUINTICRTPATCHES: ::DWORD = 0x00200000; +pub const D3DDEVCAPS_RTPATCHES: ::DWORD = 0x00400000; +pub const D3DDEVCAPS_RTPATCHHANDLEZERO: ::DWORD = 0x00800000; +pub const D3DDEVCAPS_NPATCHES: ::DWORD = 0x01000000; +pub const D3DPMISCCAPS_MASKZ: ::DWORD = 0x00000002; +pub const D3DPMISCCAPS_CULLNONE: ::DWORD = 0x00000010; +pub const D3DPMISCCAPS_CULLCW: ::DWORD = 0x00000020; +pub const D3DPMISCCAPS_CULLCCW: ::DWORD = 0x00000040; +pub const D3DPMISCCAPS_COLORWRITEENABLE: ::DWORD = 0x00000080; +pub const D3DPMISCCAPS_CLIPPLANESCALEDPOINTS: ::DWORD = 0x00000100; +pub const D3DPMISCCAPS_CLIPTLVERTS: ::DWORD = 0x00000200; +pub const D3DPMISCCAPS_TSSARGTEMP: ::DWORD = 0x00000400; +pub const D3DPMISCCAPS_BLENDOP: ::DWORD = 0x00000800; +pub const D3DPMISCCAPS_NULLREFERENCE: ::DWORD = 0x00001000; +pub const D3DPMISCCAPS_INDEPENDENTWRITEMASKS: ::DWORD = 0x00004000; +pub const D3DPMISCCAPS_PERSTAGECONSTANT: ::DWORD = 0x00008000; +pub const D3DPMISCCAPS_FOGANDSPECULARALPHA: ::DWORD = 0x00010000; +pub const D3DPMISCCAPS_SEPARATEALPHABLEND: ::DWORD = 0x00020000; +pub const D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS: ::DWORD = 0x00040000; +pub const D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING: ::DWORD = 0x00080000; +pub const D3DPMISCCAPS_FOGVERTEXCLAMPED: ::DWORD = 0x00100000; +pub const D3DPMISCCAPS_POSTBLENDSRGBCONVERT: ::DWORD = 0x00200000; +pub const D3DLINECAPS_TEXTURE: ::DWORD = 0x00000001; +pub const D3DLINECAPS_ZTEST: ::DWORD = 0x00000002; +pub const D3DLINECAPS_BLEND: ::DWORD = 0x00000004; +pub const D3DLINECAPS_ALPHACMP: ::DWORD = 0x00000008; +pub const D3DLINECAPS_FOG: ::DWORD = 0x00000010; +pub const D3DLINECAPS_ANTIALIAS: ::DWORD = 0x00000020; +pub const D3DPRASTERCAPS_DITHER: ::DWORD = 0x00000001; +pub const D3DPRASTERCAPS_ZTEST: ::DWORD = 0x00000010; +pub const D3DPRASTERCAPS_FOGVERTEX: ::DWORD = 0x00000080; +pub const D3DPRASTERCAPS_FOGTABLE: ::DWORD = 0x00000100; +pub const D3DPRASTERCAPS_MIPMAPLODBIAS: ::DWORD = 0x00002000; +pub const D3DPRASTERCAPS_ZBUFFERLESSHSR: ::DWORD = 0x00008000; +pub const D3DPRASTERCAPS_FOGRANGE: ::DWORD = 0x00010000; +pub const D3DPRASTERCAPS_ANISOTROPY: ::DWORD = 0x00020000; +pub const D3DPRASTERCAPS_WBUFFER: ::DWORD = 0x00040000; +pub const D3DPRASTERCAPS_WFOG: ::DWORD = 0x00100000; +pub const D3DPRASTERCAPS_ZFOG: ::DWORD = 0x00200000; +pub const D3DPRASTERCAPS_COLORPERSPECTIVE: ::DWORD = 0x00400000; +pub const D3DPRASTERCAPS_SCISSORTEST: ::DWORD = 0x01000000; +pub const D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS: ::DWORD = 0x02000000; +pub const D3DPRASTERCAPS_DEPTHBIAS: ::DWORD = 0x04000000; +pub const D3DPRASTERCAPS_MULTISAMPLE_TOGGLE: ::DWORD = 0x08000000; +pub const D3DPCMPCAPS_NEVER: ::DWORD = 0x00000001; +pub const D3DPCMPCAPS_LESS: ::DWORD = 0x00000002; +pub const D3DPCMPCAPS_EQUAL: ::DWORD = 0x00000004; +pub const D3DPCMPCAPS_LESSEQUAL: ::DWORD = 0x00000008; +pub const D3DPCMPCAPS_GREATER: ::DWORD = 0x00000010; +pub const D3DPCMPCAPS_NOTEQUAL: ::DWORD = 0x00000020; +pub const D3DPCMPCAPS_GREATEREQUAL: ::DWORD = 0x00000040; +pub const D3DPCMPCAPS_ALWAYS: ::DWORD = 0x00000080; +pub const D3DPBLENDCAPS_ZERO: ::DWORD = 0x00000001; +pub const D3DPBLENDCAPS_ONE: ::DWORD = 0x00000002; +pub const D3DPBLENDCAPS_SRCCOLOR: ::DWORD = 0x00000004; +pub const D3DPBLENDCAPS_INVSRCCOLOR: ::DWORD = 0x00000008; +pub const D3DPBLENDCAPS_SRCALPHA: ::DWORD = 0x00000010; +pub const D3DPBLENDCAPS_INVSRCALPHA: ::DWORD = 0x00000020; +pub const D3DPBLENDCAPS_DESTALPHA: ::DWORD = 0x00000040; +pub const D3DPBLENDCAPS_INVDESTALPHA: ::DWORD = 0x00000080; +pub const D3DPBLENDCAPS_DESTCOLOR: ::DWORD = 0x00000100; +pub const D3DPBLENDCAPS_INVDESTCOLOR: ::DWORD = 0x00000200; +pub const D3DPBLENDCAPS_SRCALPHASAT: ::DWORD = 0x00000400; +pub const D3DPBLENDCAPS_BOTHSRCALPHA: ::DWORD = 0x00000800; +pub const D3DPBLENDCAPS_BOTHINVSRCALPHA: ::DWORD = 0x00001000; +pub const D3DPBLENDCAPS_BLENDFACTOR: ::DWORD = 0x00002000; +pub const D3DPBLENDCAPS_SRCCOLOR2: ::DWORD = 0x00004000; +pub const D3DPBLENDCAPS_INVSRCCOLOR2: ::DWORD = 0x00008000; +pub const D3DPSHADECAPS_COLORGOURAUDRGB: ::DWORD = 0x00000008; +pub const D3DPSHADECAPS_SPECULARGOURAUDRGB: ::DWORD = 0x00000200; +pub const D3DPSHADECAPS_ALPHAGOURAUDBLEND: ::DWORD = 0x00004000; +pub const D3DPSHADECAPS_FOGGOURAUD: ::DWORD = 0x00080000; +pub const D3DPTEXTURECAPS_PERSPECTIVE: ::DWORD = 0x00000001; +pub const D3DPTEXTURECAPS_POW2: ::DWORD = 0x00000002; +pub const D3DPTEXTURECAPS_ALPHA: ::DWORD = 0x00000004; +pub const D3DPTEXTURECAPS_SQUAREONLY: ::DWORD = 0x00000020; +pub const D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE: ::DWORD = 0x00000040; +pub const D3DPTEXTURECAPS_ALPHAPALETTE: ::DWORD = 0x00000080; +pub const D3DPTEXTURECAPS_NONPOW2CONDITIONAL: ::DWORD = 0x00000100; +pub const D3DPTEXTURECAPS_PROJECTED: ::DWORD = 0x00000400; +pub const D3DPTEXTURECAPS_CUBEMAP: ::DWORD = 0x00000800; +pub const D3DPTEXTURECAPS_VOLUMEMAP: ::DWORD = 0x00002000; +pub const D3DPTEXTURECAPS_MIPMAP: ::DWORD = 0x00004000; +pub const D3DPTEXTURECAPS_MIPVOLUMEMAP: ::DWORD = 0x00008000; +pub const D3DPTEXTURECAPS_MIPCUBEMAP: ::DWORD = 0x00010000; +pub const D3DPTEXTURECAPS_CUBEMAP_POW2: ::DWORD = 0x00020000; +pub const D3DPTEXTURECAPS_VOLUMEMAP_POW2: ::DWORD = 0x00040000; +pub const D3DPTEXTURECAPS_NOPROJECTEDBUMPENV: ::DWORD = 0x00200000; +pub const D3DPTFILTERCAPS_MINFPOINT: ::DWORD = 0x00000100; +pub const D3DPTFILTERCAPS_MINFLINEAR: ::DWORD = 0x00000200; +pub const D3DPTFILTERCAPS_MINFANISOTROPIC: ::DWORD = 0x00000400; +pub const D3DPTFILTERCAPS_MINFPYRAMIDALQUAD: ::DWORD = 0x00000800; +pub const D3DPTFILTERCAPS_MINFGAUSSIANQUAD: ::DWORD = 0x00001000; +pub const D3DPTFILTERCAPS_MIPFPOINT: ::DWORD = 0x00010000; +pub const D3DPTFILTERCAPS_MIPFLINEAR: ::DWORD = 0x00020000; +pub const D3DPTFILTERCAPS_CONVOLUTIONMONO: ::DWORD = 0x00040000; +pub const D3DPTFILTERCAPS_MAGFPOINT: ::DWORD = 0x01000000; +pub const D3DPTFILTERCAPS_MAGFLINEAR: ::DWORD = 0x02000000; +pub const D3DPTFILTERCAPS_MAGFANISOTROPIC: ::DWORD = 0x04000000; +pub const D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD: ::DWORD = 0x08000000; +pub const D3DPTFILTERCAPS_MAGFGAUSSIANQUAD: ::DWORD = 0x10000000; +pub const D3DPTADDRESSCAPS_WRAP: ::DWORD = 0x00000001; +pub const D3DPTADDRESSCAPS_MIRROR: ::DWORD = 0x00000002; +pub const D3DPTADDRESSCAPS_CLAMP: ::DWORD = 0x00000004; +pub const D3DPTADDRESSCAPS_BORDER: ::DWORD = 0x00000008; +pub const D3DPTADDRESSCAPS_INDEPENDENTUV: ::DWORD = 0x00000010; +pub const D3DPTADDRESSCAPS_MIRRORONCE: ::DWORD = 0x00000020; +pub const D3DSTENCILCAPS_KEEP: ::DWORD = 0x00000001; +pub const D3DSTENCILCAPS_ZERO: ::DWORD = 0x00000002; +pub const D3DSTENCILCAPS_REPLACE: ::DWORD = 0x00000004; +pub const D3DSTENCILCAPS_INCRSAT: ::DWORD = 0x00000008; +pub const D3DSTENCILCAPS_DECRSAT: ::DWORD = 0x00000010; +pub const D3DSTENCILCAPS_INVERT: ::DWORD = 0x00000020; +pub const D3DSTENCILCAPS_INCR: ::DWORD = 0x00000040; +pub const D3DSTENCILCAPS_DECR: ::DWORD = 0x00000080; +pub const D3DSTENCILCAPS_TWOSIDED: ::DWORD = 0x00000100; +pub const D3DTEXOPCAPS_DISABLE: ::DWORD = 0x00000001; +pub const D3DTEXOPCAPS_SELECTARG1: ::DWORD = 0x00000002; +pub const D3DTEXOPCAPS_SELECTARG2: ::DWORD = 0x00000004; +pub const D3DTEXOPCAPS_MODULATE: ::DWORD = 0x00000008; +pub const D3DTEXOPCAPS_MODULATE2X: ::DWORD = 0x00000010; +pub const D3DTEXOPCAPS_MODULATE4X: ::DWORD = 0x00000020; +pub const D3DTEXOPCAPS_ADD: ::DWORD = 0x00000040; +pub const D3DTEXOPCAPS_ADDSIGNED: ::DWORD = 0x00000080; +pub const D3DTEXOPCAPS_ADDSIGNED2X: ::DWORD = 0x00000100; +pub const D3DTEXOPCAPS_SUBTRACT: ::DWORD = 0x00000200; +pub const D3DTEXOPCAPS_ADDSMOOTH: ::DWORD = 0x00000400; +pub const D3DTEXOPCAPS_BLENDDIFFUSEALPHA: ::DWORD = 0x00000800; +pub const D3DTEXOPCAPS_BLENDTEXTUREALPHA: ::DWORD = 0x00001000; +pub const D3DTEXOPCAPS_BLENDFACTORALPHA: ::DWORD = 0x00002000; +pub const D3DTEXOPCAPS_BLENDTEXTUREALPHAPM: ::DWORD = 0x00004000; +pub const D3DTEXOPCAPS_BLENDCURRENTALPHA: ::DWORD = 0x00008000; +pub const D3DTEXOPCAPS_PREMODULATE: ::DWORD = 0x00010000; +pub const D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR: ::DWORD = 0x00020000; +pub const D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA: ::DWORD = 0x00040000; +pub const D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR: ::DWORD = 0x00080000; +pub const D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA: ::DWORD = 0x00100000; +pub const D3DTEXOPCAPS_BUMPENVMAP: ::DWORD = 0x00200000; +pub const D3DTEXOPCAPS_BUMPENVMAPLUMINANCE: ::DWORD = 0x00400000; +pub const D3DTEXOPCAPS_DOTPRODUCT3: ::DWORD = 0x00800000; +pub const D3DTEXOPCAPS_MULTIPLYADD: ::DWORD = 0x01000000; +pub const D3DTEXOPCAPS_LERP: ::DWORD = 0x02000000; +pub const D3DFVFCAPS_TEXCOORDCOUNTMASK: ::DWORD = 0x0000ffff; +pub const D3DFVFCAPS_DONOTSTRIPELEMENTS: ::DWORD = 0x00080000; +pub const D3DFVFCAPS_PSIZE: ::DWORD = 0x00100000; +pub const D3DVTXPCAPS_TEXGEN: ::DWORD = 0x00000001; +pub const D3DVTXPCAPS_MATERIALSOURCE7: ::DWORD = 0x00000002; +pub const D3DVTXPCAPS_DIRECTIONALLIGHTS: ::DWORD = 0x00000008; +pub const D3DVTXPCAPS_POSITIONALLIGHTS: ::DWORD = 0x00000010; +pub const D3DVTXPCAPS_LOCALVIEWER: ::DWORD = 0x00000020; +pub const D3DVTXPCAPS_TWEENING: ::DWORD = 0x00000040; +pub const D3DVTXPCAPS_TEXGEN_SPHEREMAP: ::DWORD = 0x00000100; +pub const D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER: ::DWORD = 0x00000200; +pub const D3DDEVCAPS2_STREAMOFFSET: ::DWORD = 0x00000001; +pub const D3DDEVCAPS2_DMAPNPATCH: ::DWORD = 0x00000002; +pub const D3DDEVCAPS2_ADAPTIVETESSRTPATCH: ::DWORD = 0x00000004; +pub const D3DDEVCAPS2_ADAPTIVETESSNPATCH: ::DWORD = 0x00000008; +pub const D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES: ::DWORD = 0x00000010; +pub const D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH: ::DWORD = 0x00000020; +pub const D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET: ::DWORD = 0x00000040; +pub const D3DDTCAPS_UBYTE4: ::DWORD = 0x00000001; +pub const D3DDTCAPS_UBYTE4N: ::DWORD = 0x00000002; +pub const D3DDTCAPS_SHORT2N: ::DWORD = 0x00000004; +pub const D3DDTCAPS_SHORT4N: ::DWORD = 0x00000008; +pub const D3DDTCAPS_USHORT2N: ::DWORD = 0x00000010; +pub const D3DDTCAPS_USHORT4N: ::DWORD = 0x00000020; +pub const D3DDTCAPS_UDEC3: ::DWORD = 0x00000040; +pub const D3DDTCAPS_DEC3N: ::DWORD = 0x00000080; +pub const D3DDTCAPS_FLOAT16_2: ::DWORD = 0x00000100; +pub const D3DDTCAPS_FLOAT16_4: ::DWORD = 0x00000200; diff --git a/third_party/rust/winapi/src/d3d9types.rs b/third_party/rust/winapi/src/d3d9types.rs new file mode 100644 index 000000000000..28d0bedfcaa5 --- /dev/null +++ b/third_party/rust/winapi/src/d3d9types.rs @@ -0,0 +1,1397 @@ +// Copyright © 2015, Corey Richardson +// Licensed under the MIT License +//! Direct3D capabilities include file +pub type D3DCOLOR = ::DWORD; +STRUCT!{struct D3DVECTOR { + x: ::c_float, + y: ::c_float, + z: ::c_float, +}} +STRUCT!{struct D3DCOLORVALUE { + r: ::c_float, + g: ::c_float, + b: ::c_float, + a: ::c_float, +}} +STRUCT!{struct D3DRECT { + x1: ::LONG, + y1: ::LONG, + x2: ::LONG, + y2: ::LONG, +}} +STRUCT!{struct D3DMATRIX { + m: [[::c_float; 4]; 4], +}} +STRUCT!{struct D3DVIEWPORT9 { + X: ::DWORD, + Y: ::DWORD, + Width: ::DWORD, + Height: ::DWORD, + MinZ: ::c_float, + MaxZ: ::c_float, +}} +pub const D3DMAXUSERCLIPPLANES: ::DWORD = 32; +pub const D3DCLIPPLANE0: ::DWORD = (1 << 0); +pub const D3DCLIPPLANE1: ::DWORD = (1 << 1); +pub const D3DCLIPPLANE2: ::DWORD = (1 << 2); +pub const D3DCLIPPLANE3: ::DWORD = (1 << 3); +pub const D3DCLIPPLANE4: ::DWORD = (1 << 4); +pub const D3DCLIPPLANE5: ::DWORD = (1 << 5); +pub const D3DCS_LEFT: ::DWORD = 0x00000001; +pub const D3DCS_RIGHT: ::DWORD = 0x00000002; +pub const D3DCS_TOP: ::DWORD = 0x00000004; +pub const D3DCS_BOTTOM: ::DWORD = 0x00000008; +pub const D3DCS_FRONT: ::DWORD = 0x00000010; +pub const D3DCS_BACK: ::DWORD = 0x00000020; +pub const D3DCS_PLANE0: ::DWORD = 0x00000040; +pub const D3DCS_PLANE1: ::DWORD = 0x00000080; +pub const D3DCS_PLANE2: ::DWORD = 0x00000100; +pub const D3DCS_PLANE3: ::DWORD = 0x00000200; +pub const D3DCS_PLANE4: ::DWORD = 0x00000400; +pub const D3DCS_PLANE5: ::DWORD = 0x00000800; +pub const D3DCS_ALL: ::DWORD = D3DCS_LEFT | D3DCS_RIGHT | D3DCS_TOP | D3DCS_BOTTOM | D3DCS_FRONT + | D3DCS_BACK | D3DCS_PLANE0 | D3DCS_PLANE1 | D3DCS_PLANE2 | D3DCS_PLANE3 | D3DCS_PLANE4 + | D3DCS_PLANE5; +STRUCT!{struct D3DCLIPSTATUS9 { + ClipUnion: ::DWORD, + ClipIntersection: ::DWORD, +}} +STRUCT!{struct D3DMATERIAL9 { + Diffuse: D3DCOLORVALUE, + Ambient: D3DCOLORVALUE, + Specular: D3DCOLORVALUE, + Emissive: D3DCOLORVALUE, + Power: ::c_float, +}} +ENUM!{enum D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, +}} +STRUCT!{struct D3DLIGHT9 { + Type: D3DLIGHTTYPE, + Diffuse: D3DCOLORVALUE, + Specular: D3DCOLORVALUE, + Ambient: D3DCOLORVALUE, + Position: D3DVECTOR, + Direction: D3DVECTOR, + Range: ::c_float, + Falloff: ::c_float, + Attenuation0: ::c_float, + Attenuation1: ::c_float, + Attenuation2: ::c_float, + Theta: ::c_float, + Phi: ::c_float, +}} +pub const D3DCLEAR_TARGET: ::DWORD = 0x1; +pub const D3DCLEAR_ZBUFFER: ::DWORD = 0x2; +pub const D3DCLEAR_STENCIL: ::DWORD = 0x4; +ENUM!{enum D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, +}} +ENUM!{enum D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, +}} +ENUM!{enum D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_BLENDFACTOR = 14, + D3DBLEND_INVBLENDFACTOR = 15, +}} +ENUM!{enum D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, +}} +ENUM!{enum D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, +}} +ENUM!{enum D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, +}} +ENUM!{enum D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, +}} +ENUM!{enum D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, +}} +ENUM!{enum D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, +}} +ENUM!{enum D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, + D3DZB_USEW = 2, +}} +ENUM!{enum D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, +}} +ENUM!{enum D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, +}} +ENUM!{enum D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, + D3DRS_FILLMODE = 8, + D3DRS_SHADEMODE = 9, + D3DRS_ZWRITEENABLE = 14, + D3DRS_ALPHATESTENABLE = 15, + D3DRS_LASTPIXEL = 16, + D3DRS_SRCBLEND = 19, + D3DRS_DESTBLEND = 20, + D3DRS_CULLMODE = 22, + D3DRS_ZFUNC = 23, + D3DRS_ALPHAREF = 24, + D3DRS_ALPHAFUNC = 25, + D3DRS_DITHERENABLE = 26, + D3DRS_ALPHABLENDENABLE = 27, + D3DRS_FOGENABLE = 28, + D3DRS_SPECULARENABLE = 29, + D3DRS_FOGCOLOR = 34, + D3DRS_FOGTABLEMODE = 35, + D3DRS_FOGSTART = 36, + D3DRS_FOGEND = 37, + D3DRS_FOGDENSITY = 38, + D3DRS_RANGEFOGENABLE = 48, + D3DRS_STENCILENABLE = 52, + D3DRS_STENCILFAIL = 53, + D3DRS_STENCILZFAIL = 54, + D3DRS_STENCILPASS = 55, + D3DRS_STENCILFUNC = 56, + D3DRS_STENCILREF = 57, + D3DRS_STENCILMASK = 58, + D3DRS_STENCILWRITEMASK = 59, + D3DRS_TEXTUREFACTOR = 60, + D3DRS_WRAP0 = 128, + D3DRS_WRAP1 = 129, + D3DRS_WRAP2 = 130, + D3DRS_WRAP3 = 131, + D3DRS_WRAP4 = 132, + D3DRS_WRAP5 = 133, + D3DRS_WRAP6 = 134, + D3DRS_WRAP7 = 135, + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_POINTSIZE = 154, + D3DRS_POINTSIZE_MIN = 155, + D3DRS_POINTSPRITEENABLE = 156, + D3DRS_POINTSCALEENABLE = 157, + D3DRS_POINTSCALE_A = 158, + D3DRS_POINTSCALE_B = 159, + D3DRS_POINTSCALE_C = 160, + D3DRS_MULTISAMPLEANTIALIAS = 161, + D3DRS_MULTISAMPLEMASK = 162, + D3DRS_PATCHEDGESTYLE = 163, + D3DRS_DEBUGMONITORTOKEN = 165, + D3DRS_POINTSIZE_MAX = 166, + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, + D3DRS_TWEENFACTOR = 170, + D3DRS_BLENDOP = 171, + D3DRS_POSITIONDEGREE = 172, + D3DRS_NORMALDEGREE = 173, + D3DRS_SCISSORTESTENABLE = 174, + D3DRS_SLOPESCALEDEPTHBIAS = 175, + D3DRS_ANTIALIASEDLINEENABLE = 176, + D3DRS_MINTESSELLATIONLEVEL = 178, + D3DRS_MAXTESSELLATIONLEVEL = 179, + D3DRS_ADAPTIVETESS_X = 180, + D3DRS_ADAPTIVETESS_Y = 181, + D3DRS_ADAPTIVETESS_Z = 182, + D3DRS_ADAPTIVETESS_W = 183, + D3DRS_ENABLEADAPTIVETESSELLATION = 184, + D3DRS_TWOSIDEDSTENCILMODE = 185, + D3DRS_CCW_STENCILFAIL = 186, + D3DRS_CCW_STENCILZFAIL = 187, + D3DRS_CCW_STENCILPASS = 188, + D3DRS_CCW_STENCILFUNC = 189, + D3DRS_COLORWRITEENABLE1 = 190, + D3DRS_COLORWRITEENABLE2 = 191, + D3DRS_COLORWRITEENABLE3 = 192, + D3DRS_BLENDFACTOR = 193, + D3DRS_SRGBWRITEENABLE = 194, + D3DRS_DEPTHBIAS = 195, + D3DRS_WRAP8 = 198, + D3DRS_WRAP9 = 199, + D3DRS_WRAP10 = 200, + D3DRS_WRAP11 = 201, + D3DRS_WRAP12 = 202, + D3DRS_WRAP13 = 203, + D3DRS_WRAP14 = 204, + D3DRS_WRAP15 = 205, + D3DRS_SEPARATEALPHABLENDENABLE = 206, + D3DRS_SRCBLENDALPHA = 207, + D3DRS_DESTBLENDALPHA = 208, + D3DRS_BLENDOPALPHA = 209, +}} +pub const D3D_MAX_SIMULTANEOUS_RENDERTARGETS: ::DWORD = 4; +ENUM!{enum D3DMATERIALCOLORSOURCE { + D3DMCS_MATERIAL = 0, + D3DMCS_COLOR1 = 1, + D3DMCS_COLOR2 = 2, +}} +pub const D3DRENDERSTATE_WRAPBIAS: ::DWORD = 128; +pub const D3DWRAP_U: ::DWORD = 0x00000001; +pub const D3DWRAP_V: ::DWORD = 0x00000002; +pub const D3DWRAP_W: ::DWORD = 0x00000004; +pub const D3DWRAPCOORD_0: ::DWORD = 0x00000001; +pub const D3DWRAPCOORD_1: ::DWORD = 0x00000002; +pub const D3DWRAPCOORD_2: ::DWORD = 0x00000004; +pub const D3DWRAPCOORD_3: ::DWORD = 0x00000008; +pub const D3DCOLORWRITEENABLE_RED: ::DWORD = 1 << 0; +pub const D3DCOLORWRITEENABLE_GREEN: ::DWORD = 1 << 1; +pub const D3DCOLORWRITEENABLE_BLUE: ::DWORD = 1 << 2; +pub const D3DCOLORWRITEENABLE_ALPHA: ::DWORD = 1 << 3; +ENUM!{enum D3DTEXTURESTAGESTATETYPE { + D3DTSS_COLOROP = 1, + D3DTSS_COLORARG1 = 2, + D3DTSS_COLORARG2 = 3, + D3DTSS_ALPHAOP = 4, + D3DTSS_ALPHAARG1 = 5, + D3DTSS_ALPHAARG2 = 6, + D3DTSS_BUMPENVMAT00 = 7, + D3DTSS_BUMPENVMAT01 = 8, + D3DTSS_BUMPENVMAT10 = 9, + D3DTSS_BUMPENVMAT11 = 10, + D3DTSS_TEXCOORDINDEX = 11, + D3DTSS_BUMPENVLSCALE = 22, + D3DTSS_BUMPENVLOFFSET = 23, + D3DTSS_TEXTURETRANSFORMFLAGS = 24, + D3DTSS_COLORARG0 = 26, + D3DTSS_ALPHAARG0 = 27, + D3DTSS_RESULTARG = 28, + D3DTSS_CONSTANT = 32, +}} +ENUM!{enum D3DSAMPLERSTATETYPE { + D3DSAMP_ADDRESSU = 1, + D3DSAMP_ADDRESSV = 2, + D3DSAMP_ADDRESSW = 3, + D3DSAMP_BORDERCOLOR = 4, + D3DSAMP_MAGFILTER = 5, + D3DSAMP_MINFILTER = 6, + D3DSAMP_MIPFILTER = 7, + D3DSAMP_MIPMAPLODBIAS = 8, + D3DSAMP_MAXMIPLEVEL = 9, + D3DSAMP_MAXANISOTROPY = 10, + D3DSAMP_SRGBTEXTURE = 11, + D3DSAMP_ELEMENTINDEX = 12, + D3DSAMP_DMAPOFFSET = 13, +}} +pub const D3DDMAPSAMPLER: ::DWORD = 256; +pub const D3DVERTEXTEXTURESAMPLER0: ::DWORD = D3DDMAPSAMPLER + 1; +pub const D3DVERTEXTEXTURESAMPLER1: ::DWORD = D3DDMAPSAMPLER + 2; +pub const D3DVERTEXTEXTURESAMPLER2: ::DWORD = D3DDMAPSAMPLER + 3; +pub const D3DVERTEXTEXTURESAMPLER3: ::DWORD = D3DDMAPSAMPLER + 4; +pub const D3DTSS_TCI_PASSTHRU: ::DWORD = 0x00000000; +pub const D3DTSS_TCI_CAMERASPACENORMAL: ::DWORD = 0x00010000; +pub const D3DTSS_TCI_CAMERASPACEPOSITION: ::DWORD = 0x00020000; +pub const D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR: ::DWORD = 0x00030000; +pub const D3DTSS_TCI_SPHEREMAP: ::DWORD = 0x00040000; +ENUM!{enum D3DTEXTUREOP { + D3DTOP_DISABLE = 1, + D3DTOP_SELECTARG1 = 2, + D3DTOP_SELECTARG2 = 3, + D3DTOP_MODULATE = 4, + D3DTOP_MODULATE2X = 5, + D3DTOP_MODULATE4X = 6, + D3DTOP_ADD = 7, + D3DTOP_ADDSIGNED = 8, + D3DTOP_ADDSIGNED2X = 9, + D3DTOP_SUBTRACT = 10, + D3DTOP_ADDSMOOTH = 11, + D3DTOP_BLENDDIFFUSEALPHA = 12, + D3DTOP_BLENDTEXTUREALPHA = 13, + D3DTOP_BLENDFACTORALPHA = 14, + D3DTOP_BLENDTEXTUREALPHAPM = 15, + D3DTOP_BLENDCURRENTALPHA = 16, + D3DTOP_PREMODULATE = 17, + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, + D3DTOP_MODULATECOLOR_ADDALPHA = 19, + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, + D3DTOP_BUMPENVMAP = 22, + D3DTOP_BUMPENVMAPLUMINANCE = 23, + D3DTOP_DOTPRODUCT3 = 24, + D3DTOP_MULTIPLYADD = 25, + D3DTOP_LERP = 26, +}} +pub const D3DTA_SELECTMASK: ::DWORD = 0x0000000f; +pub const D3DTA_DIFFUSE: ::DWORD = 0x00000000; +pub const D3DTA_CURRENT: ::DWORD = 0x00000001; +pub const D3DTA_TEXTURE: ::DWORD = 0x00000002; +pub const D3DTA_TFACTOR: ::DWORD = 0x00000003; +pub const D3DTA_SPECULAR: ::DWORD = 0x00000004; +pub const D3DTA_TEMP: ::DWORD = 0x00000005; +pub const D3DTA_CONSTANT: ::DWORD = 0x00000006; +pub const D3DTA_COMPLEMENT: ::DWORD = 0x00000010; +pub const D3DTA_ALPHAREPLICATE: ::DWORD = 0x00000020; +ENUM!{enum D3DTEXTUREFILTERTYPE { + D3DTEXF_NONE = 0, + D3DTEXF_POINT = 1, + D3DTEXF_LINEAR = 2, + D3DTEXF_ANISOTROPIC = 3, + D3DTEXF_PYRAMIDALQUAD = 6, + D3DTEXF_GAUSSIANQUAD = 7, + D3DTEXF_CONVOLUTIONMONO = 8, +}} +pub const D3DPV_DONOTCOPYDATA: ::DWORD = 1 << 0; +pub const D3DFVF_RESERVED0: ::DWORD = 0x001; +pub const D3DFVF_POSITION_MASK: ::DWORD = 0x400E; +pub const D3DFVF_XYZ: ::DWORD = 0x002; +pub const D3DFVF_XYZRHW: ::DWORD = 0x004; +pub const D3DFVF_XYZB1: ::DWORD = 0x006; +pub const D3DFVF_XYZB2: ::DWORD = 0x008; +pub const D3DFVF_XYZB3: ::DWORD = 0x00a; +pub const D3DFVF_XYZB4: ::DWORD = 0x00c; +pub const D3DFVF_XYZB5: ::DWORD = 0x00e; +pub const D3DFVF_XYZW: ::DWORD = 0x4002; +pub const D3DFVF_NORMAL: ::DWORD = 0x010; +pub const D3DFVF_PSIZE: ::DWORD = 0x020; +pub const D3DFVF_DIFFUSE: ::DWORD = 0x040; +pub const D3DFVF_SPECULAR: ::DWORD = 0x080; +pub const D3DFVF_TEXCOUNT_MASK: ::DWORD = 0xf00; +pub const D3DFVF_TEXCOUNT_SHIFT: ::DWORD = 8; +pub const D3DFVF_TEX0: ::DWORD = 0x000; +pub const D3DFVF_TEX1: ::DWORD = 0x100; +pub const D3DFVF_TEX2: ::DWORD = 0x200; +pub const D3DFVF_TEX3: ::DWORD = 0x300; +pub const D3DFVF_TEX4: ::DWORD = 0x400; +pub const D3DFVF_TEX5: ::DWORD = 0x500; +pub const D3DFVF_TEX6: ::DWORD = 0x600; +pub const D3DFVF_TEX7: ::DWORD = 0x700; +pub const D3DFVF_TEX8: ::DWORD = 0x800; +pub const D3DFVF_LASTBETA_UBYTE4: ::DWORD = 0x1000; +pub const D3DFVF_LASTBETA_D3DCOLOR: ::DWORD = 0x8000; +pub const D3DFVF_RESERVED2: ::DWORD = 0x6000; +ENUM!{enum D3DDECLUSAGE { + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT, + D3DDECLUSAGE_BLENDINDICES, + D3DDECLUSAGE_NORMAL, + D3DDECLUSAGE_PSIZE, + D3DDECLUSAGE_TEXCOORD, + D3DDECLUSAGE_TANGENT, + D3DDECLUSAGE_BINORMAL, + D3DDECLUSAGE_TESSFACTOR, + D3DDECLUSAGE_POSITIONT, + D3DDECLUSAGE_COLOR, + D3DDECLUSAGE_FOG, + D3DDECLUSAGE_DEPTH, + D3DDECLUSAGE_SAMPLE, +}} +pub const MAXD3DDECLUSAGE: D3DDECLUSAGE = D3DDECLUSAGE_SAMPLE; +pub const MAXD3DDECLUSAGEINDEX: ::DWORD = 15; +pub const MAXD3DDECLLENGTH: ::DWORD = 64; +ENUM!{enum D3DDECLMETHOD { + D3DDECLMETHOD_DEFAULT = 0, + D3DDECLMETHOD_PARTIALU, + D3DDECLMETHOD_PARTIALV, + D3DDECLMETHOD_CROSSUV, + D3DDECLMETHOD_UV, + D3DDECLMETHOD_LOOKUP, + D3DDECLMETHOD_LOOKUPPRESAMPLED, +}} +pub const MAXD3DDECLMETHOD: D3DDECLMETHOD = D3DDECLMETHOD_LOOKUPPRESAMPLED; +ENUM!{enum D3DDECLTYPE { + D3DDECLTYPE_FLOAT1 = 0, + D3DDECLTYPE_FLOAT2 = 1, + D3DDECLTYPE_FLOAT3 = 2, + D3DDECLTYPE_FLOAT4 = 3, + D3DDECLTYPE_D3DCOLOR = 4, + D3DDECLTYPE_UBYTE4 = 5, + D3DDECLTYPE_SHORT2 = 6, + D3DDECLTYPE_SHORT4 = 7, + D3DDECLTYPE_UBYTE4N = 8, + D3DDECLTYPE_SHORT2N = 9, + D3DDECLTYPE_SHORT4N = 10, + D3DDECLTYPE_USHORT2N = 11, + D3DDECLTYPE_USHORT4N = 12, + D3DDECLTYPE_UDEC3 = 13, + D3DDECLTYPE_DEC3N = 14, + D3DDECLTYPE_FLOAT16_2 = 15, + D3DDECLTYPE_FLOAT16_4 = 16, + D3DDECLTYPE_UNUSED = 17, +}} +pub const MAXD3DDECLTYPE: D3DDECLTYPE = D3DDECLTYPE_UNUSED; +STRUCT!{struct D3DVERTEXELEMENT9 { + Stream: ::WORD, + Offset: ::WORD, + Type: ::BYTE, + Method: ::BYTE, + Usage: ::BYTE, + UsageIndex: ::BYTE, +}} +pub type LPD3DVERTEXELEMENT9 = *mut D3DVERTEXELEMENT9; +pub const D3DDECL_END: D3DVERTEXELEMENT9 = D3DVERTEXELEMENT9 { + Stream: 0xFF, + Offset: 0, + Type: D3DDECLTYPE_UNUSED.0 as ::BYTE, + Method: 0, + Usage: 0, + UsageIndex: 0, +}; +pub const D3DDP_MAXTEXCOORD: ::DWORD = 8; +pub const D3DSTREAMSOURCE_INDEXEDDATA: ::DWORD = 1 << 30; +pub const D3DSTREAMSOURCE_INSTANCEDATA: ::DWORD = 2 << 30; +pub const D3DSI_OPCODE_MASK: ::DWORD = 0x0000FFFF; +pub const D3DSI_INSTLENGTH_MASK: ::DWORD = 0x0F000000; +pub const D3DSI_INSTLENGTH_SHIFT: ::DWORD = 24; +ENUM!{enum D3DSHADER_INSTRUCTION_OPCODE_TYPE { + D3DSIO_NOP = 0, + D3DSIO_MOV = 1, + D3DSIO_ADD = 2, + D3DSIO_SUB = 3, + D3DSIO_MAD = 4, + D3DSIO_MUL = 5, + D3DSIO_RCP = 6, + D3DSIO_RSQ = 7, + D3DSIO_DP3 = 8, + D3DSIO_DP4 = 9, + D3DSIO_MIN = 10, + D3DSIO_MAX = 11, + D3DSIO_SLT = 12, + D3DSIO_SGE = 13, + D3DSIO_EXP = 14, + D3DSIO_LOG = 15, + D3DSIO_LIT = 16, + D3DSIO_DST = 17, + D3DSIO_LRP = 18, + D3DSIO_FRC = 18, + D3DSIO_M4x4 = 20, + D3DSIO_M4x3 = 21, + D3DSIO_M3x4 = 22, + D3DSIO_M3x3 = 23, + D3DSIO_M3x2 = 24, + D3DSIO_CALL = 25, + D3DSIO_CALLNZ = 26, + D3DSIO_LOOP = 27, + D3DSIO_RET = 28, + D3DSIO_ENDLOOP = 29, + D3DSIO_LABEL = 30, + D3DSIO_DCL = 31, + D3DSIO_POW = 32, + D3DSIO_CRS = 33, + D3DSIO_SGN = 34, + D3DSIO_ABS = 35, + D3DSIO_NRM = 36, + D3DSIO_SINCOS = 37, + D3DSIO_REP = 38, + D3DSIO_ENDREP = 39, + D3DSIO_IF = 40, + D3DSIO_IFC = 41, + D3DSIO_ELSE = 42, + D3DSIO_ENDIF = 43, + D3DSIO_BREAK = 44, + D3DSIO_BREAKC = 45, + D3DSIO_MOVA = 46, + D3DSIO_DEFB = 47, + D3DSIO_DEFI = 48, + D3DSIO_TEXCOORD = 64, + D3DSIO_TEXKILL = 65, + D3DSIO_TEX = 66, + D3DSIO_TEXBEM = 67, + D3DSIO_TEXBEML = 68, + D3DSIO_TEXREG2AR = 69, + D3DSIO_TEXREG2GB = 70, + D3DSIO_TEXM3x2PAD = 71, + D3DSIO_TEXM3x2TEX = 72, + D3DSIO_TEXM3x3PAD = 73, + D3DSIO_TEXM3x3TEX = 74, + D3DSIO_RESERVED0 = 75, + D3DSIO_TEXM3x3SPEC = 76, + D3DSIO_TEXM3x3VSPEC = 77, + D3DSIO_EXPP = 78, + D3DSIO_LOGP = 79, + D3DSIO_CND = 80, + D3DSIO_DEF = 81, + D3DSIO_TEXREG2RGB = 82, + D3DSIO_TEXDP3TEX = 83, + D3DSIO_TEXM3x2DEPTH = 84, + D3DSIO_TEXDP3 = 85, + D3DSIO_TEXM3x3 = 86, + D3DSIO_TEXDEPTH = 87, + D3DSIO_CMP = 88, + D3DSIO_BEM = 89, + D3DSIO_DP2ADD = 90, + D3DSIO_DSX = 91, + D3DSIO_DSY = 92, + D3DSIO_TEXLDD = 93, + D3DSIO_SETP = 94, + D3DSIO_TEXLDL = 95, + D3DSIO_BREAKP = 96, + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, +}} +pub const D3DSI_COISSUE: ::DWORD = 0x40000000; +pub const D3DSP_OPCODESPECIFICCONTROL_MASK: ::DWORD = 0x00ff0000; +pub const D3DSP_OPCODESPECIFICCONTROL_SHIFT: ::DWORD = 16; +pub const D3DSI_TEXLD_PROJECT: ::DWORD = 0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT; +pub const D3DSI_TEXLD_BIAS: ::DWORD = 0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT; +ENUM!{enum D3DSHADER_COMPARISON { + D3DSPC_RESERVED0 = 0, + D3DSPC_GT = 1, + D3DSPC_EQ = 2, + D3DSPC_GE = 3, + D3DSPC_LT = 4, + D3DSPC_NE = 5, + D3DSPC_LE = 6, + D3DSPC_RESERVED1 = 7, +}} +pub const D3DSHADER_COMPARISON_SHIFT: ::DWORD = D3DSP_OPCODESPECIFICCONTROL_SHIFT; +pub const D3DSHADER_COMPARISON_MASK: ::DWORD = 0x7 << D3DSHADER_COMPARISON_SHIFT; +pub const D3DSHADER_INSTRUCTION_PREDICATED: ::DWORD = 0x1 << 28; +pub const D3DSP_DCL_USAGE_SHIFT: ::DWORD = 0; +pub const D3DSP_DCL_USAGE_MASK: ::DWORD = 0x0000000f; +pub const D3DSP_DCL_USAGEINDEX_SHIFT: ::DWORD = 16; +pub const D3DSP_DCL_USAGEINDEX_MASK: ::DWORD = 0x000f0000; +pub const D3DSP_TEXTURETYPE_SHIFT: ::DWORD = 27; +pub const D3DSP_TEXTURETYPE_MASK: ::DWORD = 0x78000000; +ENUM!{enum D3DSAMPLER_TEXTURE_TYPE { + D3DSTT_UNKNOWN = 0 << D3DSP_TEXTURETYPE_SHIFT, + D3DSTT_2D = 2 << D3DSP_TEXTURETYPE_SHIFT, + D3DSTT_CUBE = 3 << D3DSP_TEXTURETYPE_SHIFT, + D3DSTT_VOLUME = 4 << D3DSP_TEXTURETYPE_SHIFT, +}} +pub const D3DSP_REGNUM_MASK: ::DWORD = 0x000007FF; +pub const D3DSP_WRITEMASK_0: ::DWORD = 0x00010000; +pub const D3DSP_WRITEMASK_1: ::DWORD = 0x00020000; +pub const D3DSP_WRITEMASK_2: ::DWORD = 0x00040000; +pub const D3DSP_WRITEMASK_3: ::DWORD = 0x00080000; +pub const D3DSP_WRITEMASK_ALL: ::DWORD = 0x000F0000; +pub const D3DSP_DSTMOD_SHIFT: ::DWORD = 20; +pub const D3DSP_DSTMOD_MASK: ::DWORD = 0x00F00000; +pub const D3DSPDM_NONE: ::DWORD = 0 << D3DSP_DSTMOD_SHIFT; +pub const D3DSPDM_SATURATE: ::DWORD = 1 << D3DSP_DSTMOD_SHIFT; +pub const D3DSPDM_PARTIALPRECISION: ::DWORD = 2 << D3DSP_DSTMOD_SHIFT; +pub const D3DSPDM_MSAMPCENTROID: ::DWORD = 4 << D3DSP_DSTMOD_SHIFT; +pub const D3DSP_DSTSHIFT_SHIFT: ::DWORD = 24; +pub const D3DSP_DSTSHIFT_MASK: ::DWORD = 0x0F000000; +pub const D3DSP_REGTYPE_SHIFT: ::DWORD = 28; +pub const D3DSP_REGTYPE_SHIFT2: ::DWORD = 8; +pub const D3DSP_REGTYPE_MASK: ::DWORD = 0x70000000; +pub const D3DSP_REGTYPE_MASK2: ::DWORD = 0x00001800; +ENUM!{enum D3DSHADER_PARAM_REGISTER_TYPE { + D3DSPR_TEMP = 0, + D3DSPR_INPUT = 1, + D3DSPR_CONST = 2, + D3DSPR_ADDR = 3, + D3DSPR_TEXTURE = 3, + D3DSPR_RASTOUT = 4, + D3DSPR_ATTROUT = 5, + D3DSPR_TEXCRDOUT = 6, + D3DSPR_OUTPUT = 6, + D3DSPR_CONSTINT = 7, + D3DSPR_COLOROUT = 8, + D3DSPR_DEPTHOUT = 9, + D3DSPR_SAMPLER = 10, + D3DSPR_CONST2 = 11, + D3DSPR_CONST3 = 12, + D3DSPR_CONST4 = 13, + D3DSPR_CONSTBOOL = 14, + D3DSPR_LOOP = 15, + D3DSPR_TEMPFLOAT16 = 16, + D3DSPR_MISCTYPE = 17, + D3DSPR_LABEL = 18, + D3DSPR_PREDICATE = 19, +}} +ENUM!{enum D3DSHADER_MISCTYPE_OFFSETS { + D3DSMO_POSITION = 0, + D3DSMO_FACE = 1, +}} +ENUM!{enum D3DVS_RASTOUT_OFFSETS { + D3DSRO_POSITION = 0, + D3DSRO_FOG, + D3DSRO_POINT_SIZE, +}} +pub const D3DVS_ADDRESSMODE_SHIFT: ::DWORD = 13; +pub const D3DVS_ADDRESSMODE_MASK: ::DWORD = 1 << D3DVS_ADDRESSMODE_SHIFT; +ENUM!{enum D3DVS_ADDRESSMODE_TYPE { + D3DVS_ADDRMODE_ABSOLUTE = 0 << D3DVS_ADDRESSMODE_SHIFT, + D3DVS_ADDRMODE_RELATIVE = 1 << D3DVS_ADDRESSMODE_SHIFT, +}} +pub const D3DSHADER_ADDRESSMODE_SHIFT: ::DWORD = 13; +pub const D3DSHADER_ADDRESSMODE_MASK: ::DWORD = 1 << D3DSHADER_ADDRESSMODE_SHIFT; +ENUM!{enum D3DSHADER_ADDRESSMODE_TYPE { + D3DSHADER_ADDRMODE_ABSOLUTE = 0 << D3DSHADER_ADDRESSMODE_SHIFT, + D3DSHADER_ADDRMODE_RELATIVE = 1 << D3DSHADER_ADDRESSMODE_SHIFT, +}} +pub const D3DVS_SWIZZLE_SHIFT: ::DWORD = 16; +pub const D3DVS_SWIZZLE_MASK: ::DWORD = 0x00FF0000; +pub const D3DVS_X_X: ::DWORD = 0 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_X_Y: ::DWORD = 1 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_X_Z: ::DWORD = 2 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_X_W: ::DWORD = 3 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_Y_X: ::DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Y_Y: ::DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Y_Z: ::DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Y_W: ::DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Z_X: ::DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_Z_Y: ::DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_Z_Z: ::DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_Z_W: ::DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_W_X: ::DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_W_Y: ::DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_W_Z: ::DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_W_W: ::DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_NOSWIZZLE: ::DWORD = D3DVS_X_X | D3DVS_Y_Y | D3DVS_Z_Z | D3DVS_W_W; +pub const D3DSP_SWIZZLE_SHIFT: ::DWORD = 16; +pub const D3DSP_SWIZZLE_MASK: ::DWORD = 0x00FF0000; +pub const D3DSP_NOSWIZZLE: ::DWORD = (0 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (3 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATERED: ::DWORD = (0 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (0 << (D3DSP_SWIZZLE_SHIFT + 2)) | (0 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (0 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATEGREEN: ::DWORD = (1 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (1 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (1 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATEBLUE: ::DWORD = (2 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (2 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (2 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATEALPHA: ::DWORD = (3 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (3 << (D3DSP_SWIZZLE_SHIFT + 2)) | (3 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (3 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_SRCMOD_SHIFT: ::DWORD = 24; +pub const D3DSP_SRCMOD_MASK: ::DWORD = 0x0F000000; +ENUM!{enum D3DSHADER_PARAM_SRCMOD_TYPE { + D3DSPSM_NONE = 0 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_NEG = 1 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_BIAS = 2 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_BIASNEG = 3 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_SIGN = 4 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_SIGNNEG = 5 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_COMP = 6 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_X2 = 7 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_X2NEG = 8 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_DZ = 9 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_DW = 10 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_ABS = 11 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_ABSNEG = 12 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_NOT = 13 << D3DSP_SRCMOD_SHIFT, +}} +pub const D3DSP_MIN_PRECISION_SHIFT: ::DWORD = 14; +pub const D3DSP_MIN_PRECISION_MASK: ::DWORD = 0x0000C000; +ENUM!{enum D3DSHADER_MIN_PRECISION { + D3DMP_DEFAULT = 0, + D3DMP_16 = 1, + D3DMP_2_8 = 2, +}} +pub const D3DSI_COMMENTSIZE_SHIFT: ::DWORD = 16; +pub const D3DSI_COMMENTSIZE_MASK: ::DWORD = 0x7FFF0000; +pub const D3DPS_END: ::DWORD = 0x0000FFFF; +pub const D3DVS_END: ::DWORD = 0x0000FFFF; +ENUM!{enum D3DBASISTYPE { + D3DBASIS_BEZIER = 0, + D3DBASIS_BSPLINE = 1, + D3DBASIS_CATMULL_ROM = 2, +}} +ENUM!{enum D3DDEGREETYPE { + D3DDEGREE_LINEAR = 1, + D3DDEGREE_QUADRATIC = 2, + D3DDEGREE_CUBIC = 3, + D3DDEGREE_QUINTIC = 5, +}} +ENUM!{enum D3DPATCHEDGESTYLE { + D3DPATCHEDGE_DISCRETE = 0, + D3DPATCHEDGE_CONTINUOUS = 1, +}} +ENUM!{enum D3DSTATEBLOCKTYPE { + D3DSBT_ALL = 1, + D3DSBT_PIXELSTATE = 2, + D3DSBT_VERTEXSTATE = 3, +}} +FLAGS!{enum D3DVERTEXBLENDFLAGS { + D3DVBF_DISABLE = 0, + D3DVBF_1WEIGHTS = 1, + D3DVBF_2WEIGHTS = 2, + D3DVBF_3WEIGHTS = 3, + D3DVBF_TWEENING = 255, + D3DVBF_0WEIGHTS = 256, +}} +ENUM!{enum D3DTEXTURETRANSFORMFLAGS { + D3DTTFF_DISABLE = 0, + D3DTTFF_COUNT1 = 1, + D3DTTFF_COUNT2 = 2, + D3DTTFF_COUNT3 = 3, + D3DTTFF_COUNT4 = 4, + D3DTTFF_PROJECTED = 256, +}} +pub const D3DFVF_TEXTUREFORMAT2: ::DWORD = 0; +pub const D3DFVF_TEXTUREFORMAT1: ::DWORD = 3; +pub const D3DFVF_TEXTUREFORMAT3: ::DWORD = 1; +pub const D3DFVF_TEXTUREFORMAT4: ::DWORD = 2; +ENUM!{enum D3DDEVTYPE { + D3DDEVTYPE_HAL = 1, + D3DDEVTYPE_REF = 2, + D3DDEVTYPE_SW = 3, + D3DDEVTYPE_NULLREF = 4, +}} +ENUM!{enum D3DMULTISAMPLE_TYPE { + D3DMULTISAMPLE_NONE = 0, + D3DMULTISAMPLE_NONMASKABLE = 1, + D3DMULTISAMPLE_2_SAMPLES = 2, + D3DMULTISAMPLE_3_SAMPLES = 3, + D3DMULTISAMPLE_4_SAMPLES = 4, + D3DMULTISAMPLE_5_SAMPLES = 5, + D3DMULTISAMPLE_6_SAMPLES = 6, + D3DMULTISAMPLE_7_SAMPLES = 7, + D3DMULTISAMPLE_8_SAMPLES = 8, + D3DMULTISAMPLE_9_SAMPLES = 9, + D3DMULTISAMPLE_10_SAMPLES = 10, + D3DMULTISAMPLE_11_SAMPLES = 11, + D3DMULTISAMPLE_12_SAMPLES = 12, + D3DMULTISAMPLE_13_SAMPLES = 13, + D3DMULTISAMPLE_14_SAMPLES = 14, + D3DMULTISAMPLE_15_SAMPLES = 15, + D3DMULTISAMPLE_16_SAMPLES = 16, +}} +ENUM!{enum D3DFORMAT { + D3DFMT_UNKNOWN = 0, + D3DFMT_R8G8B8 = 20, + D3DFMT_A8R8G8B8 = 21, + D3DFMT_X8R8G8B8 = 22, + D3DFMT_R5G6B5 = 23, + D3DFMT_X1R5G5B5 = 24, + D3DFMT_A1R5G5B5 = 25, + D3DFMT_A4R4G4B4 = 26, + D3DFMT_R3G3B2 = 27, + D3DFMT_A8 = 28, + D3DFMT_A8R3G3B2 = 29, + D3DFMT_X4R4G4B4 = 30, + D3DFMT_A2B10G10R10 = 31, + D3DFMT_A8B8G8R8 = 32, + D3DFMT_X8B8G8R8 = 33, + D3DFMT_G16R16 = 34, + D3DFMT_A2R10G10B10 = 35, + D3DFMT_A16B16G16R16 = 36, + D3DFMT_A8P8 = 40, + D3DFMT_P8 = 41, + D3DFMT_L8 = 50, + D3DFMT_A8L8 = 51, + D3DFMT_A4L4 = 52, + D3DFMT_V8U8 = 60, + D3DFMT_L6V5U5 = 61, + D3DFMT_X8L8V8U8 = 62, + D3DFMT_Q8W8V8U8 = 63, + D3DFMT_V16U16 = 64, + D3DFMT_A2W10V10U10 = 67, + D3DFMT_UYVY = MAKEFOURCC!(b'U', b'Y', b'V', b'Y') as u32, + D3DFMT_R8G8_B8G8 = MAKEFOURCC!(b'R', b'G', b'B', b'G') as u32, + D3DFMT_YUY2 = MAKEFOURCC!(b'Y', b'U', b'Y', b'2') as u32, + D3DFMT_G8R8_G8B8 = MAKEFOURCC!(b'G', b'R', b'G', b'B') as u32, + D3DFMT_DXT1 = MAKEFOURCC!(b'D', b'X', b'T', b'1') as u32, + D3DFMT_DXT2 = MAKEFOURCC!(b'D', b'X', b'T', b'2') as u32, + D3DFMT_DXT3 = MAKEFOURCC!(b'D', b'X', b'T', b'3') as u32, + D3DFMT_DXT4 = MAKEFOURCC!(b'D', b'X', b'T', b'4') as u32, + D3DFMT_DXT5 = MAKEFOURCC!(b'D', b'X', b'T', b'5') as u32, + D3DFMT_D16_LOCKABLE = 70, + D3DFMT_D32 = 71, + D3DFMT_D15S1 = 73, + D3DFMT_D24S8 = 75, + D3DFMT_D24X8 = 77, + D3DFMT_D24X4S4 = 79, + D3DFMT_D16 = 80, + D3DFMT_D32F_LOCKABLE = 82, + D3DFMT_D24FS8 = 83, + D3DFMT_D32_LOCKABLE = 84, + D3DFMT_S8_LOCKABLE = 85, + D3DFMT_L16 = 81, + D3DFMT_VERTEXDATA = 100, + D3DFMT_INDEX16 = 101, + D3DFMT_INDEX32 = 102, + D3DFMT_Q16W16V16U16 = 110, + D3DFMT_MULTI2_ARGB8 = MAKEFOURCC!(b'M', b'E', b'T', b'1') as u32, + D3DFMT_R16F = 111, + D3DFMT_G16R16F = 112, + D3DFMT_A16B16G16R16F = 113, + D3DFMT_R32F = 114, + D3DFMT_G32R32F = 115, + D3DFMT_A32B32G32R32F = 116, + D3DFMT_CxV8U8 = 117, + D3DFMT_A1 = 118, + D3DFMT_A2B10G10R10_XR_BIAS = 119, + D3DFMT_BINARYBUFFER = 199, +}} +STRUCT!{struct D3DDISPLAYMODE { + Width: ::UINT, + Height: ::UINT, + RefreshRate: ::UINT, + Format: D3DFORMAT, +}} +STRUCT!{struct D3DDEVICE_CREATION_PARAMETERS { + AdapterOrdinal: ::UINT, + DeviceType: D3DDEVTYPE, + hFocusWindow: ::HWND, + BehaviorFlags: ::DWORD, +}} +ENUM!{enum D3DSWAPEFFECT { + D3DSWAPEFFECT_DISCARD = 1, + D3DSWAPEFFECT_FLIP = 2, + D3DSWAPEFFECT_COPY = 3, + D3DSWAPEFFECT_OVERLAY = 4, + D3DSWAPEFFECT_FLIPEX = 5, +}} +ENUM!{enum D3DPOOL { + D3DPOOL_DEFAULT = 0, + D3DPOOL_MANAGED = 1, + D3DPOOL_SYSTEMMEM = 2, + D3DPOOL_SCRATCH = 3, +}} +pub const D3DPRESENT_RATE_DEFAULT: ::DWORD = 0x00000000; +STRUCT!{struct D3DPRESENT_PARAMETERS { + BackBufferWidth: ::UINT, + BackBufferHeight: ::UINT, + BackBufferFormat: D3DFORMAT, + BackBufferCount: ::UINT, + MultiSampleType: D3DMULTISAMPLE_TYPE, + MultiSampleQuality: ::DWORD, + SwapEffect: D3DSWAPEFFECT, + hDeviceWindow: ::HWND, + Windowed: ::BOOL, + EnableAutoDepthStencil: ::BOOL, + AutoDepthStencilFormat: D3DFORMAT, + Flags: ::DWORD, + FullScreen_RefreshRateInHz: ::UINT, + PresentationInterval: ::UINT, +}} +pub const D3DPRESENTFLAG_LOCKABLE_BACKBUFFER: ::DWORD = 0x00000001; +pub const D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL: ::DWORD = 0x00000002; +pub const D3DPRESENTFLAG_DEVICECLIP: ::DWORD = 0x00000004; +pub const D3DPRESENTFLAG_VIDEO: ::DWORD = 0x00000010; +pub const D3DPRESENTFLAG_NOAUTOROTATE: ::DWORD = 0x00000020; +pub const D3DPRESENTFLAG_UNPRUNEDMODE: ::DWORD = 0x00000040; +pub const D3DPRESENTFLAG_OVERLAY_LIMITEDRGB: ::DWORD = 0x00000080; +pub const D3DPRESENTFLAG_OVERLAY_YCbCr_BT709: ::DWORD = 0x00000100; +pub const D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC: ::DWORD = 0x00000200; +pub const D3DPRESENTFLAG_RESTRICTED_CONTENT: ::DWORD = 0x00000400; +pub const D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER: ::DWORD = 0x00000800; +STRUCT!{nodebug struct D3DGAMMARAMP { + red: [::WORD; 256], + green: [::WORD; 256], + blue: [::WORD; 256], +}} +ENUM!{enum D3DBACKBUFFER_TYPE { + D3DBACKBUFFER_TYPE_MONO = 0, + D3DBACKBUFFER_TYPE_LEFT = 1, + D3DBACKBUFFER_TYPE_RIGHT = 2, +}} +ENUM!{enum D3DRESOURCETYPE { + D3DRTYPE_SURFACE = 1, + D3DRTYPE_VOLUME = 2, + D3DRTYPE_TEXTURE = 3, + D3DRTYPE_VOLUMETEXTURE = 4, + D3DRTYPE_CUBETEXTURE = 5, + D3DRTYPE_VERTEXBUFFER = 6, + D3DRTYPE_INDEXBUFFER = 7, +}} +pub const D3DUSAGE_RENDERTARGET: ::DWORD = 0x00000001; +pub const D3DUSAGE_DEPTHSTENCIL: ::DWORD = 0x00000002; +pub const D3DUSAGE_DYNAMIC: ::DWORD = 0x00000200; +pub const D3DUSAGE_NONSECURE: ::DWORD = 0x00800000; +pub const D3DUSAGE_AUTOGENMIPMAP: ::DWORD = 0x00000400; +pub const D3DUSAGE_DMAP: ::DWORD = 0x00004000; +pub const D3DUSAGE_QUERY_LEGACYBUMPMAP: ::DWORD = 0x00008000; +pub const D3DUSAGE_QUERY_SRGBREAD: ::DWORD = 0x00010000; +pub const D3DUSAGE_QUERY_FILTER: ::DWORD = 0x00020000; +pub const D3DUSAGE_QUERY_SRGBWRITE: ::DWORD = 0x00040000; +pub const D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING: ::DWORD = 0x00080000; +pub const D3DUSAGE_QUERY_VERTEXTEXTURE: ::DWORD = 0x00100000; +pub const D3DUSAGE_QUERY_WRAPANDMIP: ::DWORD = 0x00200000; +pub const D3DUSAGE_WRITEONLY: ::DWORD = 0x00000008; +pub const D3DUSAGE_SOFTWAREPROCESSING: ::DWORD = 0x00000010; +pub const D3DUSAGE_DONOTCLIP: ::DWORD = 0x00000020; +pub const D3DUSAGE_POINTS: ::DWORD = 0x00000040; +pub const D3DUSAGE_RTPATCHES: ::DWORD = 0x00000080; +pub const D3DUSAGE_NPATCHES: ::DWORD = 0x00000100; +pub const D3DUSAGE_TEXTAPI: ::DWORD = 0x10000000; +pub const D3DUSAGE_RESTRICTED_CONTENT: ::DWORD = 0x00000800; +pub const D3DUSAGE_RESTRICT_SHARED_RESOURCE: ::DWORD = 0x00002000; +pub const D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER: ::DWORD = 0x00001000; +ENUM!{enum D3DCUBEMAP_FACES { + D3DCUBEMAP_FACE_POSITIVE_X = 0, + D3DCUBEMAP_FACE_NEGATIVE_X = 1, + D3DCUBEMAP_FACE_POSITIVE_Y = 2, + D3DCUBEMAP_FACE_NEGATIVE_Y = 3, + D3DCUBEMAP_FACE_POSITIVE_Z = 4, + D3DCUBEMAP_FACE_NEGATIVE_Z = 5, +}} +pub const D3DLOCK_READONLY: ::DWORD = 0x00000010; +pub const D3DLOCK_DISCARD: ::DWORD = 0x00002000; +pub const D3DLOCK_NOOVERWRITE: ::DWORD = 0x00001000; +pub const D3DLOCK_NOSYSLOCK: ::DWORD = 0x00000800; +pub const D3DLOCK_DONOTWAIT: ::DWORD = 0x00004000; +pub const D3DLOCK_NO_DIRTY_UPDATE: ::DWORD = 0x00008000; +STRUCT!{struct D3DVERTEXBUFFER_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: ::DWORD, + Pool: D3DPOOL, + Size: ::UINT, + FVF: ::DWORD, +}} +STRUCT!{struct D3DINDEXBUFFER_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: ::DWORD, + Pool: D3DPOOL, + Size: ::UINT, +}} +STRUCT!{struct D3DSURFACE_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: ::DWORD, + Pool: D3DPOOL, + MultiSampleType: D3DMULTISAMPLE_TYPE, + MultiSampleQuality: ::DWORD, + Width: ::UINT, + Height: ::UINT, +}} +STRUCT!{struct D3DVOLUME_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: ::DWORD, + Pool: D3DPOOL, + Width: ::UINT, + Height: ::UINT, + Depth: ::UINT, +}} +STRUCT!{struct D3DLOCKED_RECT { + Pitch: ::INT, + pBits: *mut ::c_void, +}} +STRUCT!{struct D3DBOX { + Left: ::UINT, + Top: ::UINT, + Right: ::UINT, + Bottom: ::UINT, + Front: ::UINT, + Back: ::UINT, +}} +STRUCT!{struct D3DLOCKED_BOX { + RowPitch: ::INT, + SlicePitch: ::INT, + pBits: *mut ::c_void, +}} +STRUCT!{struct D3DRANGE { + Offset: ::UINT, + Size: ::UINT, +}} +STRUCT!{struct D3DRECTPATCH_INFO { + StartVertexOffsetWidth: ::UINT, + StartVertexOffsetHeight: ::UINT, + Width: ::UINT, + Height: ::UINT, + Stride: ::UINT, + Basis: D3DBASISTYPE, + Degree: D3DDEGREETYPE, +}} +STRUCT!{struct D3DTRIPATCH_INFO { + StartVertexOffset: ::UINT, + NumVertices: ::UINT, + Basis: D3DBASISTYPE, + Degree: D3DDEGREETYPE, +}} +pub const MAX_DEVICE_IDENTIFIER_STRING: usize = 512; +STRUCT!{nodebug struct D3DADAPTER_IDENTIFIER9 { + Driver: [::c_char; MAX_DEVICE_IDENTIFIER_STRING], + Description: [::c_char; MAX_DEVICE_IDENTIFIER_STRING], + DeviceName: [::c_char; 32], + DriverVersion: ::LARGE_INTEGER, + VendorId: ::DWORD, + DeviceId: ::DWORD, + SubSysId: ::DWORD, + Revision: ::DWORD, + DeviceIdentifier: ::GUID, + WHQLLevel: ::DWORD, +}} +STRUCT!{struct D3DRASTER_STATUS { + InVBlank: ::BOOL, + ScanLine: ::UINT, +}} +ENUM!{enum D3DDEBUGMONITORTOKENS { + D3DDMT_ENABLE = 0, + D3DDMT_DISABLE = 1, +}} +ENUM!{enum D3DQUERYTYPE { + D3DQUERYTYPE_VCACHE = 4, + D3DQUERYTYPE_RESOURCEMANAGER = 5, + D3DQUERYTYPE_VERTEXSTATS = 6, + D3DQUERYTYPE_EVENT = 8, + D3DQUERYTYPE_OCCLUSION = 9, + D3DQUERYTYPE_TIMESTAMP = 10, + D3DQUERYTYPE_TIMESTAMPDISJOINT = 11, + D3DQUERYTYPE_TIMESTAMPFREQ = 12, + D3DQUERYTYPE_PIPELINETIMINGS = 13, + D3DQUERYTYPE_INTERFACETIMINGS = 14, + D3DQUERYTYPE_VERTEXTIMINGS = 15, + D3DQUERYTYPE_PIXELTIMINGS = 16, + D3DQUERYTYPE_BANDWIDTHTIMINGS = 17, + D3DQUERYTYPE_CACHEUTILIZATION = 18, + D3DQUERYTYPE_MEMORYPRESSURE = 19, +}} +pub const D3DISSUE_END: ::DWORD = 1 << 0; +pub const D3DISSUE_BEGIN: ::DWORD = 1 << 1; +pub const D3DGETDATA_FLUSH: ::DWORD = 1 << 0; +STRUCT!{struct D3DRESOURCESTATS { + bThrashing: ::BOOL, + ApproxBytesDownloaded: ::DWORD, + NumEvicts: ::DWORD, + NumVidCreates: ::DWORD, + LastPri: ::DWORD, + NumUsed: ::DWORD, + NumUsedInVidMem: ::DWORD, + WorkingSet: ::DWORD, + WorkingSetBytes: ::DWORD, + TotalManaged: ::DWORD, + TotalBytes: ::DWORD, +}} +pub const D3DRTYPECOUNT: usize = 8; +STRUCT!{struct D3DDEVINFO_RESOURCEMANAGER { + stats: [D3DRESOURCESTATS; 8 /*D3DRTYPECOUNT, rust bug?*/], +}} +pub type LPD3DDEVINFO_RESOURCEMANAGER = *mut D3DDEVINFO_RESOURCEMANAGER; +STRUCT!{struct D3DDEVINFO_D3DVERTEXSTATS { + NumRenderedTriangles: ::DWORD, + NumExtraClippingTriangles: ::DWORD, +}} +pub type LPD3DDEVINFO_D3DVERTEXSTATS = *mut D3DDEVINFO_D3DVERTEXSTATS; +STRUCT!{struct D3DDEVINFO_VCACHE { + Pattern: ::DWORD, + OptMethod: ::DWORD, + CacheSize: ::DWORD, + MagicNumber: ::DWORD, +}} +pub type LPD3DDEVINFO_VCACHE = *mut D3DDEVINFO_VCACHE; +STRUCT!{struct D3DDEVINFO_D3D9PIPELINETIMINGS { + VertexProcessingTimePercent: ::FLOAT, + PixelProcessingTimePercent: ::FLOAT, + OtherGPUProcessingTimePercent: ::FLOAT, + GPUIdleTimePercent: ::FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9INTERFACETIMINGS { + WaitingForGPUToUseApplicationResourceTimePercent: ::FLOAT, + WaitingForGPUToAcceptMoreCommandsTimePercent: ::FLOAT, + WaitingForGPUToStayWithinLatencyTimePercent: ::FLOAT, + WaitingForGPUExclusiveResourceTimePercent: ::FLOAT, + WaitingForGPUOtherTimePercent: ::FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9STAGETIMINGS { + MemoryProcessingPercent: ::FLOAT, + ComputationProcessingPercent: ::FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9BANDWIDTHTIMINGS { + MaxBandwidthUtilized: ::FLOAT, + FrontEndUploadMemoryUtilizedPercent: ::FLOAT, + VertexRateUtilizedPercent: ::FLOAT, + TriangleSetupRateUtilizedPercent: ::FLOAT, + FillRateUtilizedPercent: ::FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9CACHEUTILIZATION { + TextureCacheHitRate: ::FLOAT, + PostTransformVertexCacheHitRate: ::FLOAT, +}} +STRUCT!{struct D3DMEMORYPRESSURE { + BytesEvictedFromProcess: ::UINT64, + SizeOfInefficientAllocation: ::UINT64, + LevelOfEfficiency: ::DWORD, +}} +ENUM!{enum D3DCOMPOSERECTSOP { + D3DCOMPOSERECTS_COPY = 1, + D3DCOMPOSERECTS_OR = 2, + D3DCOMPOSERECTS_AND = 3, + D3DCOMPOSERECTS_NEG = 4, +}} +STRUCT!{struct D3DCOMPOSERECTDESC { + X: ::USHORT, + Y: ::USHORT, + Width: ::USHORT, + Height: ::USHORT, +}} +STRUCT!{struct D3DCOMPOSERECTDESTINATION { + SrcRectIndex: ::USHORT, + Reserved: ::USHORT, + X: ::SHORT, + Y: ::SHORT, +}} +pub const D3DCOMPOSERECTS_MAXNUMRECTS: ::DWORD = 0xFFFF; +pub const D3DCONVOLUTIONMONO_MAXWIDTH: ::DWORD = 7; +pub const D3DCONVOLUTIONMONO_MAXHEIGHT: ::DWORD = D3DCONVOLUTIONMONO_MAXWIDTH; +pub const D3DFMT_A1_SURFACE_MAXWIDTH: ::DWORD = 8192; +pub const D3DFMT_A1_SURFACE_MAXHEIGHT: ::DWORD = 2048; +STRUCT!{struct D3DPRESENTSTATS { + PresentCount: ::UINT, + PresentRefreshCount: ::UINT, + SyncRefreshCount: ::UINT, + SyncQPCTime: ::LARGE_INTEGER, + SyncGPUTime: ::LARGE_INTEGER, +}} +ENUM!{enum D3DSCANLINEORDERING { + D3DSCANLINEORDERING_UNKNOWN = 0, + D3DSCANLINEORDERING_PROGRESSIVE = 1, + D3DSCANLINEORDERING_INTERLACED = 2, +}} +STRUCT!{struct D3DDISPLAYMODEEX { + Size: ::UINT, + Width: ::UINT, + Height: ::UINT, + RefreshRate: ::UINT, + Format: D3DFORMAT, + ScanLineOrdering: D3DSCANLINEORDERING, +}} +STRUCT!{struct D3DDISPLAYMODEFILTER { + Size: ::UINT, + Format: D3DFORMAT, + ScanLineOrdering: D3DSCANLINEORDERING, +}} +ENUM!{enum D3DDISPLAYROTATION { + D3DDISPLAYROTATION_IDENTITY = 1, + D3DDISPLAYROTATION_90 = 2, + D3DDISPLAYROTATION_180 = 3, + D3DDISPLAYROTATION_270 = 4, +}} +pub const D3D9_RESOURCE_PRIORITY_MINIMUM: ::DWORD = 0x28000000; +pub const D3D9_RESOURCE_PRIORITY_LOW: ::DWORD = 0x50000000; +pub const D3D9_RESOURCE_PRIORITY_NORMAL: ::DWORD = 0x78000000; +pub const D3D9_RESOURCE_PRIORITY_HIGH: ::DWORD = 0xa0000000; +pub const D3D9_RESOURCE_PRIORITY_MAXIMUM: ::DWORD = 0xc8000000; +pub const D3D_OMAC_SIZE: usize = 16; +STRUCT!{struct D3D_OMAC { + Omac: [::BYTE; D3D_OMAC_SIZE], +}} +ENUM!{enum D3DAUTHENTICATEDCHANNELTYPE { + D3DAUTHENTICATEDCHANNEL_D3D9 = 1, + D3DAUTHENTICATEDCHANNEL_DRIVER_SOFTWARE = 2, + D3DAUTHENTICATEDCHANNEL_DRIVER_HARDWARE = 3, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERY_INPUT { + QueryType: ::GUID, + hChannel: ::HANDLE, + SequenceNumber: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT { + omac: D3D_OMAC, + QueryType: ::GUID, + hChannel: ::HANDLE, + SequenceNumber: ::UINT, + ReturnCode: ::HRESULT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS { + Value: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + ProtectionFlags: D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + ChannelType: D3DAUTHENTICATEDCHANNELTYPE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DeviceHandle: ::HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + DXVA2DecodeHandle: ::HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DXVA2DecodeHandle: ::HANDLE, + CryptoSessionHandle: ::HANDLE, + DeviceHandle: ::HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + NumRestrictedSharedResourceProcesses: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + ProcessIndex: ::UINT, +}} +ENUM!{enum D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE { + PROCESSIDTYPE_UNKNOWN = 0, + PROCESSIDTYPE_DWM = 1, + PROCESSIDTYPE_HANDLE = 2, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + ProcessIndex: ::UINT, + ProcessIdentifer: D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE, + ProcessHandle: ::HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + NumUnrestrictedProtectedSharedResources: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + DeviceHandle: ::HANDLE, + CryptoSessionHandle: ::HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DeviceHandle: ::HANDLE, + CryptoSessionHandle: ::HANDLE, + NumOutputIDs: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + DeviceHandle: ::HANDLE, + CryptoSessionHandle: ::HANDLE, + OutputIDIndex: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DeviceHandle: ::HANDLE, + CryptoSessionHandle: ::HANDLE, + OutputIDIndex: ::UINT, + OutputID: ::UINT64, +}} +FLAGS!{enum D3DBUSTYPE { + D3DBUSTYPE_OTHER = 0x00000000, + D3DBUSTYPE_PCI = 0x00000001, + D3DBUSTYPE_PCIX = 0x00000002, + D3DBUSTYPE_PCIEXPRESS = 0x00000003, + D3DBUSTYPE_AGP = 0x00000004, + D3DBUSIMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x00010000, + MD3DBUSIMPL_ODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x00020000, + D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x00030000, + D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x00040000, + D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x00050000, + D3DBUSIMPL_MODIFIER_NON_STANDARD = 0x80000000, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + BusType: D3DBUSTYPE, + bAccessibleInContiguousBlocks: ::BOOL, + bAccessibleInNonContiguousBlocks: ::BOOL, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + NumEncryptionGuids: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + EncryptionGuidIndex: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + EncryptionGuidIndex: ::UINT, + EncryptionGuid: ::GUID, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + EncryptionGuid: ::GUID, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT { + omac: D3D_OMAC, + ConfigureType: ::GUID, + hChannel: ::HANDLE, + SequenceNumber: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT { + omac: D3D_OMAC, + ConfigureType: ::GUID, + hChannel: ::HANDLE, + SequenceNumber: ::UINT, + ReturnCode: ::HRESULT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + StartSequenceQuery: ::UINT, + StartSequenceConfigure: ::UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + Protections: D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + DXVA2DecodeHandle: ::HANDLE, + CryptoSessionHandle: ::HANDLE, + DeviceHandle: ::HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + ProcessIdentiferType: D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE, + ProcessHandle: ::HANDLE, + AllowAccess: ::BOOL, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + EncryptionGuid: ::GUID, +}} +STRUCT!{struct D3DENCRYPTED_BLOCK_INFO { + NumEncryptedBytesAtBeginning: ::UINT, + NumBytesInSkipPattern: ::UINT, + NumBytesInEncryptPattern: ::UINT, +}} +STRUCT!{struct D3DAES_CTR_IV { + IV: ::UINT64, + Count: ::UINT64, +}} diff --git a/third_party/rust/winapi/src/d3dcommon.rs b/third_party/rust/winapi/src/d3dcommon.rs new file mode 100644 index 000000000000..51a1b4e8ed68 --- /dev/null +++ b/third_party/rust/winapi/src/d3dcommon.rs @@ -0,0 +1,753 @@ +// Copyright © 2015; Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of d3dcommon.h +ENUM!{enum D3D_DRIVER_TYPE { + D3D_DRIVER_TYPE_UNKNOWN, + D3D_DRIVER_TYPE_HARDWARE, + D3D_DRIVER_TYPE_REFERENCE, + D3D_DRIVER_TYPE_NULL, + D3D_DRIVER_TYPE_SOFTWARE, + D3D_DRIVER_TYPE_WARP, +}} +ENUM!{enum D3D_FEATURE_LEVEL { + D3D_FEATURE_LEVEL_9_1 = 0x9100, + D3D_FEATURE_LEVEL_9_2 = 0x9200, + D3D_FEATURE_LEVEL_9_3 = 0x9300, + D3D_FEATURE_LEVEL_10_0 = 0xa000, + D3D_FEATURE_LEVEL_10_1 = 0xa100, + D3D_FEATURE_LEVEL_11_0 = 0xb000, + D3D_FEATURE_LEVEL_11_1 = 0xb100, + D3D_FEATURE_LEVEL_12_0 = 0xc000, + D3D_FEATURE_LEVEL_12_1 = 0xc100, +}} +ENUM!{enum D3D_PRIMITIVE_TOPOLOGY { + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1, + D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13, + D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, + D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34, + D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35, + D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36, + D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37, + D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38, + D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39, + D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40, + D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41, + D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42, + D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43, + D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44, + D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45, + D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46, + D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47, + D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48, + D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49, + D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50, + D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51, + D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52, + D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53, + D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54, + D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55, + D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56, + D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57, + D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58, + D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59, + D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60, + D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61, + D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62, + D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63, + D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64, +}} +pub const D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; +pub const D3D10_PRIMITIVE_TOPOLOGY_POINTLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_POINTLIST; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; +pub const D3D11_PRIMITIVE_TOPOLOGY_POINTLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_POINTLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST; +ENUM!{enum D3D_PRIMITIVE { + D3D_PRIMITIVE_UNDEFINED = 0, + D3D_PRIMITIVE_POINT = 1, + D3D_PRIMITIVE_LINE = 2, + D3D_PRIMITIVE_TRIANGLE = 3, + D3D_PRIMITIVE_LINE_ADJ = 6, + D3D_PRIMITIVE_TRIANGLE_ADJ = 7, + D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, + D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9, + D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10, + D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11, + D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12, + D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13, + D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14, + D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15, + D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16, + D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17, + D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18, + D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19, + D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20, + D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21, + D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22, + D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23, + D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24, + D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25, + D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26, + D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 28, + D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 29, + D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 30, + D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 31, + D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 32, + D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 33, + D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 34, + D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 35, + D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 36, + D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 37, + D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 38, + D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 39, + D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 40, +}} +pub const D3D10_PRIMITIVE_UNDEFINED: ::D3D_PRIMITIVE = D3D_PRIMITIVE_UNDEFINED; +pub const D3D10_PRIMITIVE_POINT: ::D3D_PRIMITIVE = D3D_PRIMITIVE_POINT; +pub const D3D10_PRIMITIVE_LINE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE; +pub const D3D10_PRIMITIVE_TRIANGLE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE; +pub const D3D10_PRIMITIVE_LINE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE_ADJ; +pub const D3D10_PRIMITIVE_TRIANGLE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE_ADJ; +pub const D3D11_PRIMITIVE_UNDEFINED: ::D3D_PRIMITIVE = D3D_PRIMITIVE_UNDEFINED; +pub const D3D11_PRIMITIVE_POINT: ::D3D_PRIMITIVE = D3D_PRIMITIVE_POINT; +pub const D3D11_PRIMITIVE_LINE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE; +pub const D3D11_PRIMITIVE_TRIANGLE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE; +pub const D3D11_PRIMITIVE_LINE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE_ADJ; +pub const D3D11_PRIMITIVE_TRIANGLE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE_ADJ; +pub const D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_1_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_2_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_3_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_4_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_5_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_6_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_7_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_8_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_9_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_10_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_11_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_12_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_13_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_14_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_15_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_16_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_17_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_18_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_19_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_20_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_21_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_22_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_23_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_24_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_25_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_26_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_27_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_28_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_29_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_30_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_31_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = + D3D_PRIMITIVE_32_CONTROL_POINT_PATCH; +ENUM!{enum D3D_SRV_DIMENSION { + D3D_SRV_DIMENSION_UNKNOWN = 0, + D3D_SRV_DIMENSION_BUFFER = 1, + D3D_SRV_DIMENSION_TEXTURE1D = 2, + D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D_SRV_DIMENSION_TEXTURE2D = 4, + D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D_SRV_DIMENSION_TEXTURE3D = 8, + D3D_SRV_DIMENSION_TEXTURECUBE = 9, + D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10, + D3D_SRV_DIMENSION_BUFFEREX = 11, +}} +pub const D3D10_SRV_DIMENSION_UNKNOWN: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_UNKNOWN; +pub const D3D10_SRV_DIMENSION_BUFFER: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_BUFFER; +pub const D3D10_SRV_DIMENSION_TEXTURE1D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE1D; +pub const D3D10_SRV_DIMENSION_TEXTURE1DARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE1DARRAY; +pub const D3D10_SRV_DIMENSION_TEXTURE2D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2D; +pub const D3D10_SRV_DIMENSION_TEXTURE2DARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DARRAY; +pub const D3D10_SRV_DIMENSION_TEXTURE2DMS: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMS; +pub const D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; +pub const D3D10_SRV_DIMENSION_TEXTURE3D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE3D; +pub const D3D10_SRV_DIMENSION_TEXTURECUBE: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURECUBE; +pub const D3D10_1_SRV_DIMENSION_UNKNOWN: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_UNKNOWN; +pub const D3D10_1_SRV_DIMENSION_BUFFER: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_BUFFER; +pub const D3D10_1_SRV_DIMENSION_TEXTURE1D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE1D; +pub const D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE1DARRAY; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2D; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DARRAY; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMS: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMS; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; +pub const D3D10_1_SRV_DIMENSION_TEXTURE3D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE3D; +pub const D3D10_1_SRV_DIMENSION_TEXTURECUBE: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURECUBE; +pub const D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURECUBEARRAY; +pub const D3D11_SRV_DIMENSION_UNKNOWN: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_UNKNOWN; +pub const D3D11_SRV_DIMENSION_BUFFER: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_BUFFER; +pub const D3D11_SRV_DIMENSION_TEXTURE1D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE1D; +pub const D3D11_SRV_DIMENSION_TEXTURE1DARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE1DARRAY; +pub const D3D11_SRV_DIMENSION_TEXTURE2D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2D; +pub const D3D11_SRV_DIMENSION_TEXTURE2DARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DARRAY; +pub const D3D11_SRV_DIMENSION_TEXTURE2DMS: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMS; +pub const D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; +pub const D3D11_SRV_DIMENSION_TEXTURE3D: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE3D; +pub const D3D11_SRV_DIMENSION_TEXTURECUBE: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURECUBE; +pub const D3D11_SRV_DIMENSION_TEXTURECUBEARRAY: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURECUBEARRAY; +pub const D3D11_SRV_DIMENSION_BUFFEREX: ::D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_BUFFEREX; +STRUCT!{struct D3D_SHADER_MACRO { + Name: ::LPCSTR, + Definition: ::LPCSTR, +}} +pub type LPD3D_SHADER_MACRO = *mut D3D_SHADER_MACRO; +RIDL!( +interface ID3D10Blob(ID3D10BlobVtbl): IUnknown(IUnknownVtbl) { + fn GetBufferPointer(&mut self) -> ::LPVOID, + fn GetBufferSize(&mut self) -> ::SIZE_T +} +); +pub type LPD3D10BLOB = *mut ID3D10Blob; +pub type ID3DBlob = ID3D10Blob; +pub type LPD3DBLOB = *mut ID3DBlob; +ENUM!{enum D3D_INCLUDE_TYPE { + D3D_INCLUDE_LOCAL = 0, + D3D_INCLUDE_SYSTEM, +}} +pub const D3D10_INCLUDE_LOCAL: ::D3D_INCLUDE_TYPE = D3D_INCLUDE_LOCAL; +pub const D3D10_INCLUDE_SYSTEM: ::D3D_INCLUDE_TYPE = D3D_INCLUDE_SYSTEM; +RIDL!( +interface ID3DInclude(ID3DIncludeVtbl) { + fn Open( + &mut self, IncludeType: D3D_INCLUDE_TYPE, pFileName: ::LPCSTR, pParentData: ::LPCVOID, + ppData: *mut ::LPCVOID, pBytes: *mut ::UINT + ) -> ::HRESULT, + fn Close(&mut self, pData: ::LPCVOID) -> ::HRESULT +} +); +pub type LPD3DINCLUDE = *mut ID3DInclude; +ENUM!{enum D3D_SHADER_VARIABLE_CLASS { + D3D_SVC_SCALAR = 0, + D3D_SVC_VECTOR, + D3D_SVC_MATRIX_ROWS, + D3D_SVC_MATRIX_COLUMNS, + D3D_SVC_OBJECT, + D3D_SVC_STRUCT, + D3D_SVC_INTERFACE_CLASS, + D3D_SVC_INTERFACE_POINTER, +}} +pub const D3D10_SVC_SCALAR: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_SCALAR; +pub const D3D10_SVC_VECTOR: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_VECTOR; +pub const D3D10_SVC_MATRIX_ROWS: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_MATRIX_ROWS; +pub const D3D10_SVC_MATRIX_COLUMNS: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_MATRIX_COLUMNS; +pub const D3D10_SVC_OBJECT: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_OBJECT; +pub const D3D10_SVC_STRUCT: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_STRUCT; +pub const D3D11_SVC_INTERFACE_CLASS: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_INTERFACE_CLASS; +pub const D3D11_SVC_INTERFACE_POINTER: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_INTERFACE_POINTER; +FLAGS!{enum D3D_SHADER_VARIABLE_FLAGS { + D3D_SVF_USERPACKED = 1, + D3D_SVF_USED = 2, + D3D_SVF_INTERFACE_POINTER = 4, + D3D_SVF_INTERFACE_PARAMETER = 8, +}} +pub const D3D10_SVF_USERPACKED: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_USERPACKED; +pub const D3D10_SVF_USED: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_USED; +pub const D3D11_SVF_INTERFACE_POINTER: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_INTERFACE_POINTER; +pub const D3D11_SVF_INTERFACE_PARAMETER: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_INTERFACE_PARAMETER; +ENUM!{enum D3D_SHADER_VARIABLE_TYPE { + D3D_SVT_VOID = 0, + D3D_SVT_BOOL = 1, + D3D_SVT_INT = 2, + D3D_SVT_FLOAT = 3, + D3D_SVT_STRING = 4, + D3D_SVT_TEXTURE = 5, + D3D_SVT_TEXTURE1D = 6, + D3D_SVT_TEXTURE2D = 7, + D3D_SVT_TEXTURE3D = 8, + D3D_SVT_TEXTURECUBE = 9, + D3D_SVT_SAMPLER = 10, + D3D_SVT_SAMPLER1D = 11, + D3D_SVT_SAMPLER2D = 12, + D3D_SVT_SAMPLER3D = 13, + D3D_SVT_SAMPLERCUBE = 14, + D3D_SVT_PIXELSHADER = 15, + D3D_SVT_VERTEXSHADER = 16, + D3D_SVT_PIXELFRAGMENT = 17, + D3D_SVT_VERTEXFRAGMENT = 18, + D3D_SVT_UINT = 19, + D3D_SVT_UINT8 = 20, + D3D_SVT_GEOMETRYSHADER = 21, + D3D_SVT_RASTERIZER = 22, + D3D_SVT_DEPTHSTENCIL = 23, + D3D_SVT_BLEND = 24, + D3D_SVT_BUFFER = 25, + D3D_SVT_CBUFFER = 26, + D3D_SVT_TBUFFER = 27, + D3D_SVT_TEXTURE1DARRAY = 28, + D3D_SVT_TEXTURE2DARRAY = 29, + D3D_SVT_RENDERTARGETVIEW = 30, + D3D_SVT_DEPTHSTENCILVIEW = 31, + D3D_SVT_TEXTURE2DMS = 32, + D3D_SVT_TEXTURE2DMSARRAY = 33, + D3D_SVT_TEXTURECUBEARRAY = 34, + D3D_SVT_HULLSHADER = 35, + D3D_SVT_DOMAINSHADER = 36, + D3D_SVT_INTERFACE_POINTER = 37, + D3D_SVT_COMPUTESHADER = 38, + D3D_SVT_DOUBLE = 39, + D3D_SVT_RWTEXTURE1D = 40, + D3D_SVT_RWTEXTURE1DARRAY = 41, + D3D_SVT_RWTEXTURE2D = 42, + D3D_SVT_RWTEXTURE2DARRAY = 43, + D3D_SVT_RWTEXTURE3D = 44, + D3D_SVT_RWBUFFER = 45, + D3D_SVT_BYTEADDRESS_BUFFER = 46, + D3D_SVT_RWBYTEADDRESS_BUFFER = 47, + D3D_SVT_STRUCTURED_BUFFER = 48, + D3D_SVT_RWSTRUCTURED_BUFFER = 49, + D3D_SVT_APPEND_STRUCTURED_BUFFER = 50, + D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51, + D3D_SVT_MIN8FLOAT = 52, + D3D_SVT_MIN10FLOAT = 53, + D3D_SVT_MIN16FLOAT = 54, + D3D_SVT_MIN12INT = 55, + D3D_SVT_MIN16INT = 56, + D3D_SVT_MIN16UINT = 57, +}} +pub const D3D10_SVT_VOID: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VOID; +pub const D3D10_SVT_BOOL: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BOOL; +pub const D3D10_SVT_INT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_INT; +pub const D3D10_SVT_FLOAT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_FLOAT; +pub const D3D10_SVT_STRING: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_STRING; +pub const D3D10_SVT_TEXTURE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE; +pub const D3D10_SVT_TEXTURE1D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE1D; +pub const D3D10_SVT_TEXTURE2D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2D; +pub const D3D10_SVT_TEXTURE3D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE3D; +pub const D3D10_SVT_TEXTURECUBE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURECUBE; +pub const D3D10_SVT_SAMPLER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER; +pub const D3D10_SVT_SAMPLER1D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER1D; +pub const D3D10_SVT_SAMPLER2D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER2D; +pub const D3D10_SVT_SAMPLER3D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER3D; +pub const D3D10_SVT_SAMPLERCUBE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLERCUBE; +pub const D3D10_SVT_PIXELSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_PIXELSHADER; +pub const D3D10_SVT_VERTEXSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VERTEXSHADER; +pub const D3D10_SVT_PIXELFRAGMENT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_PIXELFRAGMENT; +pub const D3D10_SVT_VERTEXFRAGMENT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VERTEXFRAGMENT; +pub const D3D10_SVT_UINT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_UINT; +pub const D3D10_SVT_UINT8: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_UINT8; +pub const D3D10_SVT_GEOMETRYSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_GEOMETRYSHADER; +pub const D3D10_SVT_RASTERIZER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RASTERIZER; +pub const D3D10_SVT_DEPTHSTENCIL: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DEPTHSTENCIL; +pub const D3D10_SVT_BLEND: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BLEND; +pub const D3D10_SVT_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BUFFER; +pub const D3D10_SVT_CBUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_CBUFFER; +pub const D3D10_SVT_TBUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TBUFFER; +pub const D3D10_SVT_TEXTURE1DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE1DARRAY; +pub const D3D10_SVT_TEXTURE2DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DARRAY; +pub const D3D10_SVT_RENDERTARGETVIEW: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RENDERTARGETVIEW; +pub const D3D10_SVT_DEPTHSTENCILVIEW: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DEPTHSTENCILVIEW; +pub const D3D10_SVT_TEXTURE2DMS: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DMS; +pub const D3D10_SVT_TEXTURE2DMSARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DMSARRAY; +pub const D3D10_SVT_TEXTURECUBEARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURECUBEARRAY; +pub const D3D11_SVT_HULLSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_HULLSHADER; +pub const D3D11_SVT_DOMAINSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DOMAINSHADER; +pub const D3D11_SVT_INTERFACE_POINTER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_INTERFACE_POINTER; +pub const D3D11_SVT_COMPUTESHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_COMPUTESHADER; +pub const D3D11_SVT_DOUBLE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DOUBLE; +pub const D3D11_SVT_RWTEXTURE1D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE1D; +pub const D3D11_SVT_RWTEXTURE1DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE1DARRAY; +pub const D3D11_SVT_RWTEXTURE2D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE2D; +pub const D3D11_SVT_RWTEXTURE2DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE2DARRAY; +pub const D3D11_SVT_RWTEXTURE3D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE3D; +pub const D3D11_SVT_RWBUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWBUFFER; +pub const D3D11_SVT_BYTEADDRESS_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BYTEADDRESS_BUFFER; +pub const D3D11_SVT_RWBYTEADDRESS_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = + D3D_SVT_RWBYTEADDRESS_BUFFER; +pub const D3D11_SVT_STRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = + D3D_SVT_STRUCTURED_BUFFER; +pub const D3D11_SVT_RWSTRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = + D3D_SVT_RWSTRUCTURED_BUFFER; +pub const D3D11_SVT_APPEND_STRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = + D3D_SVT_APPEND_STRUCTURED_BUFFER; +pub const D3D11_SVT_CONSUME_STRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = + D3D_SVT_CONSUME_STRUCTURED_BUFFER; +FLAGS!{enum D3D_SHADER_INPUT_FLAGS { + D3D_SIF_USERPACKED = 0x1, + D3D_SIF_COMPARISON_SAMPLER = 0x2, + D3D_SIF_TEXTURE_COMPONENT_0 = 0x4, + D3D_SIF_TEXTURE_COMPONENT_1 = 0x8, + D3D_SIF_TEXTURE_COMPONENTS = 0xc, + D3D_SIF_UNUSED = 0x10, +}} +pub const D3D10_SIF_USERPACKED: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_USERPACKED; +pub const D3D10_SIF_COMPARISON_SAMPLER: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_COMPARISON_SAMPLER; +pub const D3D10_SIF_TEXTURE_COMPONENT_0: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENT_0; +pub const D3D10_SIF_TEXTURE_COMPONENT_1: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENT_1; +pub const D3D10_SIF_TEXTURE_COMPONENTS: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENTS; +ENUM!{enum D3D_SHADER_INPUT_TYPE { + D3D_SIT_CBUFFER, + D3D_SIT_TBUFFER, + D3D_SIT_TEXTURE, + D3D_SIT_SAMPLER, + D3D_SIT_UAV_RWTYPED, + D3D_SIT_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED, + D3D_SIT_BYTEADDRESS, + D3D_SIT_UAV_RWBYTEADDRESS, + D3D_SIT_UAV_APPEND_STRUCTURED, + D3D_SIT_UAV_CONSUME_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, +}} +pub const D3D10_SIT_CBUFFER: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_CBUFFER; +pub const D3D10_SIT_TBUFFER: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_TBUFFER; +pub const D3D10_SIT_TEXTURE: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_TEXTURE; +pub const D3D10_SIT_SAMPLER: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_SAMPLER; +pub const D3D11_SIT_UAV_RWTYPED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWTYPED; +pub const D3D11_SIT_STRUCTURED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_STRUCTURED; +pub const D3D11_SIT_UAV_RWSTRUCTURED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWSTRUCTURED; +pub const D3D11_SIT_BYTEADDRESS: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_BYTEADDRESS; +pub const D3D11_SIT_UAV_RWBYTEADDRESS: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWBYTEADDRESS; +pub const D3D11_SIT_UAV_APPEND_STRUCTURED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_APPEND_STRUCTURED; +pub const D3D11_SIT_UAV_CONSUME_STRUCTURED: ::D3D_SHADER_INPUT_TYPE = + D3D_SIT_UAV_CONSUME_STRUCTURED; +pub const D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER: ::D3D_SHADER_INPUT_TYPE = + D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER; +FLAGS!{enum D3D_SHADER_CBUFFER_FLAGS { + D3D_CBF_USERPACKED = 1, +}} +pub const D3D10_CBF_USERPACKED: ::D3D_SHADER_CBUFFER_FLAGS = D3D_CBF_USERPACKED; +ENUM!{enum D3D_CBUFFER_TYPE { + D3D_CT_CBUFFER, + D3D_CT_TBUFFER, + D3D_CT_INTERFACE_POINTERS, + D3D_CT_RESOURCE_BIND_INFO, +}} +pub const D3D10_CT_CBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_CBUFFER; +pub const D3D10_CT_TBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_TBUFFER; +pub const D3D11_CT_CBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_CBUFFER; +pub const D3D11_CT_TBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_TBUFFER; +pub const D3D11_CT_INTERFACE_POINTERS: ::D3D_CBUFFER_TYPE = D3D_CT_INTERFACE_POINTERS; +pub const D3D11_CT_RESOURCE_BIND_INFO: ::D3D_CBUFFER_TYPE = D3D_CT_RESOURCE_BIND_INFO; +ENUM!{enum D3D_NAME { + D3D_NAME_UNDEFINED = 0, + D3D_NAME_POSITION = 1, + D3D_NAME_CLIP_DISTANCE = 2, + D3D_NAME_CULL_DISTANCE = 3, + D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, + D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, + D3D_NAME_VERTEX_ID = 6, + D3D_NAME_PRIMITIVE_ID = 7, + D3D_NAME_INSTANCE_ID = 8, + D3D_NAME_IS_FRONT_FACE = 9, + D3D_NAME_SAMPLE_INDEX = 10, + D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11, + D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12, + D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13, + D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14, + D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15, + D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16, + D3D_NAME_TARGET = 64, + D3D_NAME_DEPTH = 65, + D3D_NAME_COVERAGE = 66, + D3D_NAME_DEPTH_GREATER_EQUAL = 67, + D3D_NAME_DEPTH_LESS_EQUAL = 68, +}} +pub const D3D10_NAME_UNDEFINED: D3D_NAME = D3D_NAME_UNDEFINED; +pub const D3D10_NAME_POSITION: D3D_NAME = D3D_NAME_POSITION; +pub const D3D10_NAME_CLIP_DISTANCE: D3D_NAME = D3D_NAME_CLIP_DISTANCE; +pub const D3D10_NAME_CULL_DISTANCE: D3D_NAME = D3D_NAME_CULL_DISTANCE; +pub const D3D10_NAME_RENDER_TARGET_ARRAY_INDEX: D3D_NAME = D3D_NAME_RENDER_TARGET_ARRAY_INDEX; +pub const D3D10_NAME_VIEWPORT_ARRAY_INDEX: D3D_NAME = D3D_NAME_VIEWPORT_ARRAY_INDEX; +pub const D3D10_NAME_VERTEX_ID: D3D_NAME = D3D_NAME_VERTEX_ID; +pub const D3D10_NAME_PRIMITIVE_ID: D3D_NAME = D3D_NAME_PRIMITIVE_ID; +pub const D3D10_NAME_INSTANCE_ID: D3D_NAME = D3D_NAME_INSTANCE_ID; +pub const D3D10_NAME_IS_FRONT_FACE: D3D_NAME = D3D_NAME_IS_FRONT_FACE; +pub const D3D10_NAME_SAMPLE_INDEX: D3D_NAME = D3D_NAME_SAMPLE_INDEX; +pub const D3D10_NAME_TARGET: D3D_NAME = D3D_NAME_TARGET; +pub const D3D10_NAME_DEPTH: D3D_NAME = D3D_NAME_DEPTH; +pub const D3D10_NAME_COVERAGE: D3D_NAME = D3D_NAME_COVERAGE; +pub const D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR; +pub const D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR; +pub const D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR; +pub const D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR; +pub const D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR; +pub const D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR; +pub const D3D11_NAME_DEPTH_GREATER_EQUAL: D3D_NAME = D3D_NAME_DEPTH_GREATER_EQUAL; +pub const D3D11_NAME_DEPTH_LESS_EQUAL: D3D_NAME = D3D_NAME_DEPTH_LESS_EQUAL; +ENUM!{enum D3D_RESOURCE_RETURN_TYPE { + D3D_RETURN_TYPE_UNORM = 1, + D3D_RETURN_TYPE_SNORM = 2, + D3D_RETURN_TYPE_SINT = 3, + D3D_RETURN_TYPE_UINT = 4, + D3D_RETURN_TYPE_FLOAT = 5, + D3D_RETURN_TYPE_MIXED = 6, + D3D_RETURN_TYPE_DOUBLE = 7, + D3D_RETURN_TYPE_CONTINUED = 8, +}} +pub const D3D10_RETURN_TYPE_UNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UNORM; +pub const D3D10_RETURN_TYPE_SNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SNORM; +pub const D3D10_RETURN_TYPE_SINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SINT; +pub const D3D10_RETURN_TYPE_UINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UINT; +pub const D3D10_RETURN_TYPE_FLOAT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_FLOAT; +pub const D3D10_RETURN_TYPE_MIXED: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_MIXED; +pub const D3D11_RETURN_TYPE_UNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UNORM; +pub const D3D11_RETURN_TYPE_SNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SNORM; +pub const D3D11_RETURN_TYPE_SINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SINT; +pub const D3D11_RETURN_TYPE_UINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UINT; +pub const D3D11_RETURN_TYPE_FLOAT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_FLOAT; +pub const D3D11_RETURN_TYPE_MIXED: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_MIXED; +pub const D3D11_RETURN_TYPE_DOUBLE: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_DOUBLE; +pub const D3D11_RETURN_TYPE_CONTINUED: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_CONTINUED; +ENUM!{enum D3D_REGISTER_COMPONENT_TYPE { + D3D_REGISTER_COMPONENT_UNKNOWN = 0, + D3D_REGISTER_COMPONENT_UINT32 = 1, + D3D_REGISTER_COMPONENT_SINT32 = 2, + D3D_REGISTER_COMPONENT_FLOAT32 = 3, +}} +pub const D3D10_REGISTER_COMPONENT_UNKNOWN: ::D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_UNKNOWN; +pub const D3D10_REGISTER_COMPONENT_UINT32: ::D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_UINT32; +pub const D3D10_REGISTER_COMPONENT_SINT32: ::D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_SINT32; +pub const D3D10_REGISTER_COMPONENT_FLOAT32: ::D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_FLOAT32; +ENUM!{enum D3D_TESSELLATOR_DOMAIN { + D3D_TESSELLATOR_DOMAIN_UNDEFINED, + D3D_TESSELLATOR_DOMAIN_ISOLINE, + D3D_TESSELLATOR_DOMAIN_TRI, + D3D_TESSELLATOR_DOMAIN_QUAD, +}} +pub const D3D11_TESSELLATOR_DOMAIN_UNDEFINED: ::D3D_TESSELLATOR_DOMAIN = + D3D_TESSELLATOR_DOMAIN_UNDEFINED; +pub const D3D11_TESSELLATOR_DOMAIN_ISOLINE: ::D3D_TESSELLATOR_DOMAIN = + D3D_TESSELLATOR_DOMAIN_ISOLINE; +pub const D3D11_TESSELLATOR_DOMAIN_TRI: ::D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN_TRI; +pub const D3D11_TESSELLATOR_DOMAIN_QUAD: ::D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN_QUAD; +ENUM!{enum D3D_TESSELLATOR_PARTITIONING { + D3D_TESSELLATOR_PARTITIONING_UNDEFINED, + D3D_TESSELLATOR_PARTITIONING_INTEGER, + D3D_TESSELLATOR_PARTITIONING_POW2, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, +}} +pub const D3D11_TESSELLATOR_PARTITIONING_UNDEFINED: ::D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_UNDEFINED; +pub const D3D11_TESSELLATOR_PARTITIONING_INTEGER: ::D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_INTEGER; +pub const D3D11_TESSELLATOR_PARTITIONING_POW2: ::D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_POW2; +pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD: ::D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD; +pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN: ::D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN; +ENUM!{enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE { + D3D_TESSELLATOR_OUTPUT_UNDEFINED, + D3D_TESSELLATOR_OUTPUT_POINT, + D3D_TESSELLATOR_OUTPUT_LINE, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, +}} +pub const D3D11_TESSELLATOR_OUTPUT_UNDEFINED: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_UNDEFINED; +pub const D3D11_TESSELLATOR_OUTPUT_POINT: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_POINT; +pub const D3D11_TESSELLATOR_OUTPUT_LINE: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_LINE; +pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW; +pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW; +ENUM!{enum D3D_MIN_PRECISION { + D3D_MIN_PRECISION_DEFAULT, + D3D_MIN_PRECISION_FLOAT_16, + D3D_MIN_PRECISION_FLOAT_2_8, + D3D_MIN_PRECISION_RESERVED, + D3D_MIN_PRECISION_SINT_16, + D3D_MIN_PRECISION_UINT_16, + D3D_MIN_PRECISION_ANY_16 = 0xf0, + D3D_MIN_PRECISION_ANY_10 = 0xf1, +}} +ENUM!{enum D3D_INTERPOLATION_MODE { + D3D_INTERPOLATION_UNDEFINED, + D3D_INTERPOLATION_CONSTANT, + D3D_INTERPOLATION_LINEAR, + D3D_INTERPOLATION_LINEAR_CENTROID, + D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE, + D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID, + D3D_INTERPOLATION_LINEAR_SAMPLE, + D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE, +}} +FLAGS!{enum D3D_PARAMETER_FLAGS { + D3D_PF_NONE = 0, + D3D_PF_IN = 0x1, + D3D_PF_OUT = 0x2, +}} diff --git a/third_party/rust/winapi/src/d3dcompiler.rs b/third_party/rust/winapi/src/d3dcompiler.rs new file mode 100644 index 000000000000..6918888f6a59 --- /dev/null +++ b/third_party/rust/winapi/src/d3dcompiler.rs @@ -0,0 +1,74 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +pub const D3DCOMPILER_DLL: &'static str = "d3dcompiler_47.dll"; +pub const D3D_COMPILER_VERSION: DWORD = 47; +pub const D3DCOMPILE_DEBUG: DWORD = 1 << 0; +pub const D3DCOMPILE_SKIP_VALIDATION: DWORD = 1 << 1; +pub const D3DCOMPILE_SKIP_OPTIMIZATION: DWORD = 1 << 2; +pub const D3DCOMPILE_PACK_MATRIX_ROW_MAJOR: DWORD = 1 << 3; +pub const D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR: DWORD = 1 << 4; +pub const D3DCOMPILE_PARTIAL_PRECISION: DWORD = 1 << 5; +pub const D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT: DWORD = 1 << 6; +pub const D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT: DWORD = 1 << 7; +pub const D3DCOMPILE_NO_PRESHADER: DWORD = 1 << 8; +pub const D3DCOMPILE_AVOID_FLOW_CONTROL: DWORD = 1 << 9; +pub const D3DCOMPILE_PREFER_FLOW_CONTROL: DWORD = 1 << 10; +pub const D3DCOMPILE_ENABLE_STRICTNESS: DWORD = 1 << 11; +pub const D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY: DWORD = 1 << 12; +pub const D3DCOMPILE_IEEE_STRICTNESS: DWORD = 1 << 13; +pub const D3DCOMPILE_OPTIMIZATION_LEVEL0: DWORD = 1 << 14; +pub const D3DCOMPILE_OPTIMIZATION_LEVEL1: DWORD = 0; +pub const D3DCOMPILE_OPTIMIZATION_LEVEL2: DWORD = (1 << 14) | (1 << 15); +pub const D3DCOMPILE_OPTIMIZATION_LEVEL3: DWORD = 1 << 15; +pub const D3DCOMPILE_RESERVED16: DWORD = 1 << 16; +pub const D3DCOMPILE_RESERVED17: DWORD = 1 << 17; +pub const D3DCOMPILE_WARNINGS_ARE_ERRORS: DWORD = 1 << 18; +pub const D3DCOMPILE_RESOURCES_MAY_ALIAS: DWORD = 1 << 19; +pub const D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES: DWORD = 1 << 20; +pub const D3DCOMPILE_ALL_RESOURCES_BOUND: DWORD = 1 << 21; +pub const D3DCOMPILE_EFFECT_CHILD_EFFECT: DWORD = 1 << 0; +pub const D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS: DWORD = 1 << 1; +pub const D3D_COMPILE_STANDARD_FILE_INCLUDE: *mut ID3DInclude = 1 as *mut ID3DInclude; +pub const D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS: DWORD = 0x00000001; +pub const D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS: DWORD = 0x00000002; +pub const D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH: DWORD = 0x00000004; +pub const D3D_DISASM_ENABLE_COLOR_CODE: DWORD = 0x00000001; +pub const D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS: DWORD = 0x00000002; +pub const D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING: DWORD = 0x00000004; +pub const D3D_DISASM_ENABLE_INSTRUCTION_CYCLE: DWORD = 0x00000008; +pub const D3D_DISASM_DISABLE_DEBUG_INFO: DWORD = 0x00000010; +pub const D3D_DISASM_ENABLE_INSTRUCTION_OFFSET: DWORD = 0x00000020; +pub const D3D_DISASM_INSTRUCTION_ONLY: DWORD = 0x00000040; +pub const D3D_DISASM_PRINT_HEX_LITERALS: DWORD = 0x00000080; +pub const D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE: DWORD = 0x00000001; +FLAGS!{enum D3DCOMPILER_STRIP_FLAGS { + D3DCOMPILER_STRIP_REFLECTION_DATA = 0x00000001, + D3DCOMPILER_STRIP_DEBUG_INFO = 0x00000002, + D3DCOMPILER_STRIP_TEST_BLOBS = 0x00000004, + D3DCOMPILER_STRIP_PRIVATE_DATA = 0x00000008, + D3DCOMPILER_STRIP_ROOT_SIGNATURE = 0x00000010, + D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff, +}} +ENUM!{enum D3D_BLOB_PART { + D3D_BLOB_INPUT_SIGNATURE_BLOB, + D3D_BLOB_OUTPUT_SIGNATURE_BLOB, + D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, + D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, + D3D_BLOB_ALL_SIGNATURE_BLOB, + D3D_BLOB_DEBUG_INFO, + D3D_BLOB_LEGACY_SHADER, + D3D_BLOB_XNA_PREPASS_SHADER, + D3D_BLOB_XNA_SHADER, + D3D_BLOB_PDB, + D3D_BLOB_PRIVATE_DATA, + D3D_BLOB_ROOT_SIGNATURE, + D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000, + D3D_BLOB_TEST_COMPILE_DETAILS, + D3D_BLOB_TEST_COMPILE_PERF, + D3D_BLOB_TEST_COMPILE_REPORT, +}} +STRUCT!{struct D3D_SHADER_DATA { + pBytecode: LPCVOID, + BytecodeLength: SIZE_T, +}} diff --git a/third_party/rust/winapi/src/dbghelp.rs b/third_party/rust/winapi/src/dbghelp.rs new file mode 100644 index 000000000000..8c20d72bf0db --- /dev/null +++ b/third_party/rust/winapi/src/dbghelp.rs @@ -0,0 +1,340 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! DbgHelp include file +#[cfg(target_arch = "x86_64")] +STRUCT!{struct LOADED_IMAGE { + ModuleName: ::PSTR, + hFile: ::HANDLE, + MappedAddress: ::PUCHAR, + FileHeader: ::PIMAGE_NT_HEADERS64, + LastRvaSection: ::PIMAGE_SECTION_HEADER, + NumberOfSections: ::ULONG, + Sections: ::PIMAGE_SECTION_HEADER, + Characteristics: ::ULONG, + fSystemImage: ::BOOLEAN, + fDOSImage: ::BOOLEAN, + fReadOnly: ::BOOLEAN, + Version: ::UCHAR, + Links: ::LIST_ENTRY, + SizeOfImage: ::ULONG, +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct LOADED_IMAGE { + ModuleName: ::PSTR, + hFile: ::HANDLE, + MappedAddress: ::PUCHAR, + FileHeader: ::PIMAGE_NT_HEADERS32, + LastRvaSection: ::PIMAGE_SECTION_HEADER, + NumberOfSections: ::ULONG, + Sections: ::PIMAGE_SECTION_HEADER, + Characteristics: ::ULONG, + fSystemImage: ::BOOLEAN, + fDOSImage: ::BOOLEAN, + fReadOnly: ::BOOLEAN, + Version: ::UCHAR, + Links: ::LIST_ENTRY, + SizeOfImage: ::ULONG, +}} +pub const MAX_SYM_NAME: usize = 2000; +pub const ERROR_IMAGE_NOT_STRIPPED: ::DWORD = 0x8800; +pub const ERROR_NO_DBG_POINTER: ::DWORD = 0x8801; +pub const ERROR_NO_PDB_POINTER: ::DWORD = 0x8802; +pub type PFIND_DEBUG_FILE_CALLBACK = Option ::BOOL>; +pub type PFIND_DEBUG_FILE_CALLBACKW = Option ::BOOL>; +pub type PFINDFILEINPATHCALLBACK = Option ::BOOL>; +pub type PFINDFILEINPATHCALLBACKW = Option ::BOOL>; +pub type PFIND_EXE_FILE_CALLBACK = Option ::BOOL>; +pub type PFIND_EXE_FILE_CALLBACKW = Option ::BOOL>; +#[cfg(target_arch = "x86")] +STRUCT!{struct IMAGE_DEBUG_INFORMATION { + List: ::LIST_ENTRY, + ReservedSize: ::DWORD, + ReservedMappedBase: ::PVOID, + ReservedMachine: ::USHORT, + ReservedCharacteristics: ::USHORT, + ReservedCheckSum: ::DWORD, + ImageBase: ::DWORD, + SizeOfImage: ::DWORD, + ReservedNumberOfSections: ::DWORD, + ReservedSections: ::PIMAGE_SECTION_HEADER, + ReservedExportedNamesSize: ::DWORD, + ReservedExportedNames: ::PSTR, + ReservedNumberOfFunctionTableEntries: ::DWORD, + ReservedFunctionTableEntries: ::PIMAGE_FUNCTION_ENTRY, + ReservedLowestFunctionStartingAddress: ::DWORD, + ReservedHighestFunctionEndingAddress: ::DWORD, + ReservedNumberOfFpoTableEntries: ::DWORD, + ReservedFpoTableEntries: ::PFPO_DATA, + SizeOfCoffSymbols: ::DWORD, + CoffSymbols: ::PIMAGE_COFF_SYMBOLS_HEADER, + ReservedSizeOfCodeViewSymbols: ::DWORD, + ReservedCodeViewSymbols: ::PVOID, + ImageFilePath: ::PSTR, + ImageFileName: ::PSTR, + ReservedDebugFilePath: ::PSTR, + ReservedTimeDateStamp: ::DWORD, + ReservedRomImage: ::BOOL, + ReservedDebugDirectory: ::PIMAGE_DEBUG_DIRECTORY, + ReservedNumberOfDebugDirectories: ::DWORD, + ReservedOriginalFunctionTableBaseAddress: ::DWORD, + Reserved: [::DWORD; 2], +}} +#[cfg(target_arch = "x86")] +pub type PIMAGE_DEBUG_INFORMATION = *mut IMAGE_DEBUG_INFORMATION; +pub type PENUMDIRTREE_CALLBACK = Option ::BOOL>; +pub type PENUMDIRTREE_CALLBACKW = Option ::BOOL>; +pub const UNDNAME_COMPLETE: ::DWORD = 0x0000; +pub const UNDNAME_NO_LEADING_UNDERSCORES: ::DWORD = 0x0001; +pub const UNDNAME_NO_MS_KEYWORDS: ::DWORD = 0x0002; +pub const UNDNAME_NO_FUNCTION_RETURNS: ::DWORD = 0x0004; +pub const UNDNAME_NO_ALLOCATION_MODEL: ::DWORD = 0x0008; +pub const UNDNAME_NO_ALLOCATION_LANGUAGE: ::DWORD = 0x0010; +pub const UNDNAME_NO_MS_THISTYPE: ::DWORD = 0x0020; +pub const UNDNAME_NO_CV_THISTYPE: ::DWORD = 0x0040; +pub const UNDNAME_NO_THISTYPE: ::DWORD = 0x0060; +pub const UNDNAME_NO_ACCESS_SPECIFIERS: ::DWORD = 0x0080; +pub const UNDNAME_NO_THROW_SIGNATURES: ::DWORD = 0x0100; +pub const UNDNAME_NO_MEMBER_TYPE: ::DWORD = 0x0200; +pub const UNDNAME_NO_RETURN_UDT_MODEL: ::DWORD = 0x0400; +pub const UNDNAME_32_BIT_DECODE: ::DWORD = 0x0800; +pub const UNDNAME_NAME_ONLY: ::DWORD = 0x1000; +pub const UNDNAME_NO_ARGUMENTS: ::DWORD = 0x2000; +pub const UNDNAME_NO_SPECIAL_SYMS: ::DWORD = 0x4000; +pub const DBHHEADER_DEBUGDIRS: ::DWORD = 0x1; +pub const DBHHEADER_CVMISC: ::DWORD = 0x2; +pub const DBHHEADER_PDBGUID: ::DWORD = 0x3; +STRUCT!{struct MODLOAD_DATA { + ssize: ::DWORD, + ssig: ::DWORD, + data: ::PVOID, + size: ::DWORD, + flags: ::DWORD, +}} +pub type PMODLOAD_DATA = *mut MODLOAD_DATA; +STRUCT!{struct MODLOAD_CVMISC { + oCV: ::DWORD, + cCV: ::size_t, + oMisc: ::DWORD, + cMisc: ::size_t, + dtImage: ::DWORD, + cImage: ::DWORD, +}} +pub type PMODLOAD_CVMISC = *mut MODLOAD_CVMISC; +STRUCT!{struct MODLOAD_PDBGUID_PDBAGE { + PdbGuid: ::GUID, + PdbAge: ::DWORD, +}} +pub type PMODLOAD_PDBGUID_PDBAGE = *mut MODLOAD_PDBGUID_PDBAGE; +ENUM!{enum ADDRESS_MODE { + AddrMode1616, + AddrMode1632, + AddrModeReal, + AddrModeFlat, +}} +STRUCT!{struct ADDRESS64 { + Offset: ::DWORD64, + Segment: ::WORD, + Mode: ::ADDRESS_MODE, +}} +pub type LPADDRESS64 = *mut ADDRESS64; +#[cfg(target_arch = "x86_64")] +pub type ADDRESS = ADDRESS64; +#[cfg(target_arch = "x86_64")] +pub type LPADDRESS = LPADDRESS64; +#[cfg(target_arch = "x86")] +STRUCT!{struct ADDRESS { + Offset: ::DWORD, + Segment: ::WORD, + Mode: ::ADDRESS_MODE, +}} +#[cfg(target_arch = "x86")] +pub type LPADDRESS = *mut ADDRESS; +STRUCT!{struct KDHELP64 { + Thread: ::DWORD64, + ThCallbackStack: ::DWORD, + ThCallbackBStore: ::DWORD, + NextCallback: ::DWORD, + FramePointer: ::DWORD, + KiCallUserMode: ::DWORD64, + KeUserCallbackDispatcher: ::DWORD64, + SystemRangeStart: ::DWORD64, + KiUserExceptionDispatcher: ::DWORD64, + StackBase: ::DWORD64, + StackLimit: ::DWORD64, + BuildVersion: ::DWORD, + Reserved0: ::DWORD, + Reserved1: [::DWORD64; 4], +}} +pub type PKDHELP64 = *mut KDHELP64; +#[cfg(target_arch = "x86_64")] +pub type KDHELP = KDHELP64; +#[cfg(target_arch = "x86_64")] +pub type PKDHELP = PKDHELP64; +#[cfg(target_arch = "x86")] +STRUCT!{struct KDHELP { + Thread: ::DWORD, + ThCallbackStack: ::DWORD, + NextCallback: ::DWORD, + FramePointer: ::DWORD, + KiCallUserMode: ::DWORD, + KeUserCallbackDispatcher: ::DWORD, + SystemRangeStart: ::DWORD, + ThCallbackBStore: ::DWORD, + KiUserExceptionDispatcher: ::DWORD, + StackBase: ::DWORD, + StackLimit: ::DWORD, + Reserved: [::DWORD; 5], +}} +#[cfg(target_arch = "x86")] +pub type PKDHELP = *mut KDHELP; +STRUCT!{struct STACKFRAME64 { + AddrPC: ::ADDRESS64, + AddrReturn: ::ADDRESS64, + AddrFrame: ::ADDRESS64, + AddrStack: ::ADDRESS64, + AddrBStore: ::ADDRESS64, + FuncTableEntry: ::PVOID, + Params: [::DWORD64; 4], + Far: ::BOOL, + Virtual: ::BOOL, + Reserved: [::DWORD64; 3], + KdHelp: ::KDHELP64, +}} +pub type LPSTACKFRAME64 = *mut STACKFRAME64; +pub const INLINE_FRAME_CONTEXT_INIT: ::DWORD = 0; +pub const INLINE_FRAME_CONTEXT_IGNORE: ::DWORD = 0xFFFFFFFF; +STRUCT!{struct STACKFRAME_EX { + AddrPC: ::ADDRESS64, + AddrReturn: ::ADDRESS64, + AddrFrame: ::ADDRESS64, + AddrStack: ::ADDRESS64, + AddrBStore: ::ADDRESS64, + FuncTableEntry: ::PVOID, + Params: [::DWORD64; 4], + Far: ::BOOL, + Virtual: ::BOOL, + Reserved: [::DWORD64; 3], + KdHelp: ::KDHELP64, + StackFrameSize: ::DWORD, + InlineFrameContext: ::DWORD, +}} +pub type LPSTACKFRAME_EX = *mut STACKFRAME_EX; +#[cfg(target_arch = "x86_64")] +pub type STACKFRAME = STACKFRAME64; +#[cfg(target_arch = "x86_64")] +pub type LPSTACKFRAME = LPSTACKFRAME64; +#[cfg(target_arch = "x86")] +STRUCT!{struct STACKFRAME { + AddrPC: ::ADDRESS, + AddrReturn: ::ADDRESS, + AddrFrame: ::ADDRESS, + AddrStack: ::ADDRESS, + FuncTableEntry: ::PVOID, + Params: [::DWORD; 4], + Far: ::BOOL, + Virtual: ::BOOL, + Reserved: [::DWORD; 3], + KdHelp: ::KDHELP, + AddrBStore: ::ADDRESS, +}} +#[cfg(target_arch = "x86")] +pub type LPSTACKFRAME = *mut STACKFRAME; +pub type PREAD_PROCESS_MEMORY_ROUTINE64 = Option ::BOOL>; +pub type PFUNCTION_TABLE_ACCESS_ROUTINE64 = Option ::PVOID>; +pub type PGET_MODULE_BASE_ROUTINE64 = Option ::DWORD64>; +pub type PTRANSLATE_ADDRESS_ROUTINE64 = Option ::DWORD64>; +pub const SYM_STKWALK_DEFAULT: ::DWORD = 0x00000000; +pub const SYM_STKWALK_FORCE_FRAMEPTR: ::DWORD = 0x00000001; +#[cfg(target_arch = "x86_64")] +pub type PREAD_PROCESS_MEMORY_ROUTINE = PREAD_PROCESS_MEMORY_ROUTINE64; +#[cfg(target_arch = "x86_64")] +pub type PFUNCTION_TABLE_ACCESS_ROUTINE = PFUNCTION_TABLE_ACCESS_ROUTINE64; +#[cfg(target_arch = "x86_64")] +pub type PGET_MODULE_BASE_ROUTINE = PGET_MODULE_BASE_ROUTINE64; +#[cfg(target_arch = "x86_64")] +pub type PTRANSLATE_ADDRESS_ROUTINE = PTRANSLATE_ADDRESS_ROUTINE64; +#[cfg(target_arch = "x86")] +pub type PREAD_PROCESS_MEMORY_ROUTINE = Option ::BOOL>; +#[cfg(target_arch = "x86")] +pub type PFUNCTION_TABLE_ACCESS_ROUTINE = Option ::PVOID>; +#[cfg(target_arch = "x86")] +pub type PGET_MODULE_BASE_ROUTINE = Option ::DWORD>; +#[cfg(target_arch = "x86")] +pub type PTRANSLATE_ADDRESS_ROUTINE = Option ::DWORD>; +pub const API_VERSION_NUMBER: ::USHORT = 12; +STRUCT!{struct API_VERSION { + MajorVersion: ::USHORT, + MinorVersion: ::USHORT, + Revision: ::USHORT, + Reserved: ::USHORT, +}} +pub type LPAPI_VERSION = *mut API_VERSION; +STRUCT!{struct SYMBOL_INFOW { + SizeOfStruct: ::ULONG, + TypeIndex: ::ULONG, + Reserved: [::ULONG64; 2], + Index: ::ULONG, + Size: ::ULONG, + ModBase: ::ULONG64, + Flags: ::ULONG, + Value: ::ULONG64, + Address: ::ULONG64, + Register: ::ULONG, + Scope: ::ULONG, + Tag: ::ULONG, + NameLen: ::ULONG, + MaxNameLen: ::ULONG, + Name: [::WCHAR; 1], +}} +pub type PSYMBOL_INFOW = *mut SYMBOL_INFOW; +STRUCT!{struct IMAGEHLP_SYMBOL64 { + SizeOfStruct: ::DWORD, + Address: ::DWORD64, + Size: ::DWORD, + Flags: ::DWORD, + MaxNameLength: ::DWORD, + Name: [::CHAR; 1], +}} +pub type PIMAGEHLP_SYMBOL64 = *mut IMAGEHLP_SYMBOL64; +STRUCT!{struct IMAGEHLP_LINEW64 { + SizeOfStruct: ::DWORD, + Key: ::PVOID, + LineNumber: ::DWORD, + FileName: ::PWSTR, + Address: ::DWORD64, +}} +pub type PIMAGEHLP_LINEW64 = *mut IMAGEHLP_LINEW64; diff --git a/third_party/rust/winapi/src/dcommon.rs b/third_party/rust/winapi/src/dcommon.rs new file mode 100644 index 000000000000..2c220e351a17 --- /dev/null +++ b/third_party/rust/winapi/src/dcommon.rs @@ -0,0 +1,18 @@ +// Copyright © 2015; Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of dcommon.h +ENUM!{enum DWRITE_MEASURING_MODE { + DWRITE_MEASURING_MODE_NATURAL = 0, + DWRITE_MEASURING_MODE_GDI_CLASSIC = 1, + DWRITE_MEASURING_MODE_GDI_NATURAL = 2, +}} +ENUM!{enum D2D1_ALPHA_MODE { + D2D1_ALPHA_MODE_UNKNOWN = 0, + D2D1_ALPHA_MODE_PREMULTIPLIED = 1, + D2D1_ALPHA_MODE_STRAIGHT = 2, + D2D1_ALPHA_MODE_IGNORE = 3, +}} +STRUCT!{struct D2D1_PIXEL_FORMAT { + format: ::DXGI_FORMAT, + alphaMode: D2D1_ALPHA_MODE, +}} diff --git a/third_party/rust/winapi/src/devpropdef.rs b/third_party/rust/winapi/src/devpropdef.rs new file mode 100644 index 000000000000..3deca43e3002 --- /dev/null +++ b/third_party/rust/winapi/src/devpropdef.rs @@ -0,0 +1,71 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Defines property types and keys for the Plug and Play Device Property API +pub type DEVPROPTYPE = ::ULONG; +pub type PDEVPROPTYPE = *mut ::ULONG; +pub const DEVPROP_TYPEMOD_ARRAY: DEVPROPTYPE = 0x00001000; +pub const DEVPROP_TYPEMOD_LIST: DEVPROPTYPE = 0x00002000; +pub const DEVPROP_TYPE_EMPTY: DEVPROPTYPE = 0x00000000; +pub const DEVPROP_TYPE_NULL: DEVPROPTYPE = 0x00000001; +pub const DEVPROP_TYPE_SBYTE: DEVPROPTYPE = 0x00000002; +pub const DEVPROP_TYPE_BYTE: DEVPROPTYPE = 0x00000003; +pub const DEVPROP_TYPE_INT16: DEVPROPTYPE = 0x00000004; +pub const DEVPROP_TYPE_UINT16: DEVPROPTYPE = 0x00000005; +pub const DEVPROP_TYPE_INT32: DEVPROPTYPE = 0x00000006; +pub const DEVPROP_TYPE_UINT32: DEVPROPTYPE = 0x00000007; +pub const DEVPROP_TYPE_INT64: DEVPROPTYPE = 0x00000008; +pub const DEVPROP_TYPE_UINT64: DEVPROPTYPE = 0x00000009; +pub const DEVPROP_TYPE_FLOAT: DEVPROPTYPE = 0x0000000A; +pub const DEVPROP_TYPE_DOUBLE: DEVPROPTYPE = 0x0000000B; +pub const DEVPROP_TYPE_DECIMAL: DEVPROPTYPE = 0x0000000C; +pub const DEVPROP_TYPE_GUID: DEVPROPTYPE = 0x0000000D; +pub const DEVPROP_TYPE_CURRENCY: DEVPROPTYPE = 0x0000000E; +pub const DEVPROP_TYPE_DATE: DEVPROPTYPE = 0x0000000F; +pub const DEVPROP_TYPE_FILETIME: DEVPROPTYPE = 0x00000010; +pub const DEVPROP_TYPE_BOOLEAN: DEVPROPTYPE = 0x00000011; +pub const DEVPROP_TYPE_STRING: DEVPROPTYPE = 0x00000012; +pub const DEVPROP_TYPE_STRING_LIST: DEVPROPTYPE = DEVPROP_TYPE_STRING | DEVPROP_TYPEMOD_LIST; +pub const DEVPROP_TYPE_SECURITY_DESCRIPTOR: DEVPROPTYPE = 0x00000013; +pub const DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING: DEVPROPTYPE = 0x00000014; +pub const DEVPROP_TYPE_DEVPROPKEY: DEVPROPTYPE = 0x00000015; +pub const DEVPROP_TYPE_DEVPROPTYPE: DEVPROPTYPE = 0x00000016; +pub const DEVPROP_TYPE_BINARY: DEVPROPTYPE = DEVPROP_TYPE_BYTE | DEVPROP_TYPEMOD_ARRAY; +pub const DEVPROP_TYPE_ERROR: DEVPROPTYPE = 0x00000017; +pub const DEVPROP_TYPE_NTSTATUS: DEVPROPTYPE = 0x00000018; +pub const DEVPROP_TYPE_STRING_INDIRECT: DEVPROPTYPE = 0x00000019; +pub const MAX_DEVPROP_TYPE: DEVPROPTYPE = 0x00000019; +pub const MAX_DEVPROP_TYPEMOD: DEVPROPTYPE = 0x00002000; +pub const DEVPROP_MASK_TYPE: DEVPROPTYPE = 0x00000FFF; +pub const DEVPROP_MASK_TYPEMOD: DEVPROPTYPE = 0x0000F000; +pub type DEVPROP_BOOLEAN = ::CHAR; +pub type PDEVPROP_BOOLEAN = *mut ::CHAR; +pub const DEVPROP_TRUE: DEVPROP_BOOLEAN = -1; +pub const DEVPROP_FALSE: DEVPROP_BOOLEAN = 0; +pub type DEVPROPGUID = ::GUID; +pub type PDEVPROPGUID = *mut ::GUID; +pub type DEVPROPID = ::ULONG; +pub type PDEVPROPID = *mut ::ULONG; +STRUCT!{struct DEVPROPKEY { + fmtid: DEVPROPGUID, + pid: DEVPROPID, +}} +pub type PDEVPROPKEY = *mut DEVPROPKEY; +ENUM!{enum DEVPROPSTORE { + DEVPROP_STORE_SYSTEM, + DEVPROP_STORE_USER, +}} +pub type PDEVPROPSTORE = *mut DEVPROPSTORE; +STRUCT!{struct DEVPROPCOMPKEY { + Key: DEVPROPKEY, + Store: DEVPROPSTORE, + LocaleName: ::PCWSTR, +}} +pub type PDEVPROPCOMPKEY = *mut DEVPROPCOMPKEY; +STRUCT!{struct DEVPROPERTY { + CompKey: DEVPROPCOMPKEY, + Type: DEVPROPTYPE, + BufferSize: ::ULONG, + Buffer: ::PVOID, +}} +pub type PDEVPROPERTY = *mut DEVPROPERTY; +pub const DEVPROPID_FIRST_USABLE: DEVPROPID = 2; diff --git a/third_party/rust/winapi/src/docobj.rs b/third_party/rust/winapi/src/docobj.rs new file mode 100644 index 000000000000..3d5f9044d967 --- /dev/null +++ b/third_party/rust/winapi/src/docobj.rs @@ -0,0 +1,22 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +STRUCT!{struct OLECMD { + cmdID: ::ULONG, + cmdf: ::DWORD, +}} +STRUCT!{struct OLECMDTEXT { + cmdtextf: ::DWORD, + cwActual: ::ULONG, + cwBuf: ::ULONG, + rgwz: [::wchar_t; 0], +}} +RIDL!{interface IOleCommandTarget(IOleCommandTargetVtbl): IUnknown(IUnknownVtbl) { + fn QueryStatus( + &mut self, pguidCmdGroup: *const ::GUID, cCmds: ::ULONG, prgCmds: *mut OLECMD, + pCmdText: *mut OLECMDTEXT + ) -> ::HRESULT, + fn Exec( + &mut self, pguidCmdGroup: *const :: GUID, nCmdID: ::DWORD, nCmdexecopt: ::DWORD, + pvaIn: *mut ::VARIANT, pvaOut: *mut ::VARIANT + ) -> ::HRESULT +}} diff --git a/third_party/rust/winapi/src/dpapi.rs b/third_party/rust/winapi/src/dpapi.rs new file mode 100644 index 000000000000..c62e56f3aa79 --- /dev/null +++ b/third_party/rust/winapi/src/dpapi.rs @@ -0,0 +1,11 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Data Protection API Prototypes and Definitions +pub const szFORCE_KEY_PROTECTION: &'static str = "ForceKeyProtection"; +STRUCT!{struct CRYPTPROTECT_PROMPTSTRUCT { + cbSize: ::DWORD, + dwPromptFlags: ::DWORD, + hwndApp: ::HWND, + szPrompt: ::LPCWSTR, +}} +pub type PCRYPTPROTECT_PROMPTSTRUCT = *mut CRYPTPROTECT_PROMPTSTRUCT; diff --git a/third_party/rust/winapi/src/dsgetdc.rs b/third_party/rust/winapi/src/dsgetdc.rs new file mode 100644 index 000000000000..09c81c0fdbb5 --- /dev/null +++ b/third_party/rust/winapi/src/dsgetdc.rs @@ -0,0 +1,113 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! This file contains structures, function prototypes, and definitions for the DsGetDcName API. +pub const DS_FORCE_REDISCOVERY: ::ULONG = 0x00000001; +pub const DS_DIRECTORY_SERVICE_REQUIRED: ::ULONG = 0x00000010; +pub const DS_DIRECTORY_SERVICE_PREFERRED: ::ULONG = 0x00000020; +pub const DS_GC_SERVER_REQUIRED: ::ULONG = 0x00000040; +pub const DS_PDC_REQUIRED: ::ULONG = 0x00000080; +pub const DS_BACKGROUND_ONLY: ::ULONG = 0x00000100; +pub const DS_IP_REQUIRED: ::ULONG = 0x00000200; +pub const DS_KDC_REQUIRED: ::ULONG = 0x00000400; +pub const DS_TIMESERV_REQUIRED: ::ULONG = 0x00000800; +pub const DS_WRITABLE_REQUIRED: ::ULONG = 0x00001000; +pub const DS_GOOD_TIMESERV_PREFERRED: ::ULONG = 0x00002000; +pub const DS_AVOID_SELF: ::ULONG = 0x00004000; +pub const DS_ONLY_LDAP_NEEDED: ::ULONG = 0x00008000; +pub const DS_IS_FLAT_NAME: ::ULONG = 0x00010000; +pub const DS_IS_DNS_NAME: ::ULONG = 0x00020000; +pub const DS_TRY_NEXTCLOSEST_SITE: ::ULONG = 0x00040000; +pub const DS_DIRECTORY_SERVICE_6_REQUIRED: ::ULONG = 0x00080000; +pub const DS_WEB_SERVICE_REQUIRED: ::ULONG = 0x00100000; +pub const DS_DIRECTORY_SERVICE_8_REQUIRED: ::ULONG = 0x00200000; +pub const DS_DIRECTORY_SERVICE_9_REQUIRED: ::ULONG = 0x00400000; +pub const DS_RETURN_DNS_NAME: ::ULONG = 0x40000000; +pub const DS_RETURN_FLAT_NAME: ::ULONG = 0x80000000; +pub const DSGETDC_VALID_FLAGS: ::ULONG = DS_FORCE_REDISCOVERY | DS_DIRECTORY_SERVICE_REQUIRED + | DS_DIRECTORY_SERVICE_PREFERRED | DS_GC_SERVER_REQUIRED | DS_PDC_REQUIRED | DS_BACKGROUND_ONLY + | DS_IP_REQUIRED | DS_KDC_REQUIRED | DS_TIMESERV_REQUIRED | DS_WRITABLE_REQUIRED + | DS_GOOD_TIMESERV_PREFERRED | DS_AVOID_SELF | DS_ONLY_LDAP_NEEDED | DS_IS_FLAT_NAME + | DS_IS_DNS_NAME | DS_TRY_NEXTCLOSEST_SITE | DS_DIRECTORY_SERVICE_6_REQUIRED + | DS_DIRECTORY_SERVICE_8_REQUIRED | DS_DIRECTORY_SERVICE_9_REQUIRED | DS_WEB_SERVICE_REQUIRED + | DS_RETURN_FLAT_NAME | DS_RETURN_DNS_NAME; +STRUCT!{struct DOMAIN_CONTROLLER_INFOA { + DomainControllerName: ::LPSTR, + DomainControllerAddress: ::LPSTR, + DomainControllerAddressType: ::ULONG, + DomainGuid: ::GUID, + DomainName: ::LPSTR, + DnsForestName: ::LPSTR, + Flags: ::ULONG, + DcSiteName: ::LPSTR, + ClientSiteName: ::LPSTR, +}} +pub type PDOMAIN_CONTROLLER_INFOA = *mut DOMAIN_CONTROLLER_INFOA; +STRUCT!{struct DOMAIN_CONTROLLER_INFOW { + DomainControllerName: ::LPWSTR, + DomainControllerAddress: ::LPWSTR, + DomainControllerAddressType: ::ULONG, + DomainGuid: ::GUID, + DomainName: ::LPWSTR, + DnsForestName: ::LPWSTR, + Flags: ::ULONG, + DcSiteName: ::LPWSTR, + ClientSiteName: ::LPWSTR, +}} +pub type PDOMAIN_CONTROLLER_INFOW = *mut DOMAIN_CONTROLLER_INFOW; +pub const DS_INET_ADDRESS: ::ULONG = 1; +pub const DS_NETBIOS_ADDRESS: ::ULONG = 2; +pub const DS_PDC_FLAG: ::ULONG = 0x00000001; +pub const DS_GC_FLAG: ::ULONG = 0x00000004; +pub const DS_LDAP_FLAG: ::ULONG = 0x00000008; +pub const DS_DS_FLAG: ::ULONG = 0x00000010; +pub const DS_KDC_FLAG: ::ULONG = 0x00000020; +pub const DS_TIMESERV_FLAG: ::ULONG = 0x00000040; +pub const DS_CLOSEST_FLAG: ::ULONG = 0x00000080; +pub const DS_WRITABLE_FLAG: ::ULONG = 0x00000100; +pub const DS_GOOD_TIMESERV_FLAG: ::ULONG = 0x00000200; +pub const DS_NDNC_FLAG: ::ULONG = 0x00000400; +pub const DS_SELECT_SECRET_DOMAIN_6_FLAG: ::ULONG = 0x00000800; +pub const DS_FULL_SECRET_DOMAIN_6_FLAG: ::ULONG = 0x00001000; +pub const DS_WS_FLAG: ::ULONG = 0x00002000; +pub const DS_DS_8_FLAG: ::ULONG = 0x00004000; +pub const DS_DS_9_FLAG: ::ULONG = 0x00008000; +pub const DS_PING_FLAGS: ::ULONG = 0x000FFFFF; +pub const DS_DNS_CONTROLLER_FLAG: ::ULONG = 0x20000000; +pub const DS_DNS_DOMAIN_FLAG: ::ULONG = 0x40000000; +pub const DS_DNS_FOREST_FLAG: ::ULONG = 0x80000000; +pub const DS_DOMAIN_IN_FOREST: ::ULONG = 0x0001; +pub const DS_DOMAIN_DIRECT_OUTBOUND: ::ULONG = 0x0002; +pub const DS_DOMAIN_TREE_ROOT: ::ULONG = 0x0004; +pub const DS_DOMAIN_PRIMARY: ::ULONG = 0x0008; +pub const DS_DOMAIN_NATIVE_MODE: ::ULONG = 0x0010; +pub const DS_DOMAIN_DIRECT_INBOUND: ::ULONG = 0x0020; +pub const DS_DOMAIN_VALID_FLAGS: ::ULONG = DS_DOMAIN_IN_FOREST | DS_DOMAIN_DIRECT_OUTBOUND + | DS_DOMAIN_TREE_ROOT | DS_DOMAIN_PRIMARY | DS_DOMAIN_NATIVE_MODE | DS_DOMAIN_DIRECT_INBOUND; +STRUCT!{struct DS_DOMAIN_TRUSTSW { + NetbiosDomainName: ::LPWSTR, + DnsDomainName: ::LPWSTR, + Flags: ::ULONG, + ParentIndex: ::ULONG, + TrustType: ::ULONG, + TrustAttributes: ::ULONG, + DomainSid: ::PSID, + DomainGuid: ::GUID, +}} +pub type PDS_DOMAIN_TRUSTSW = *mut DS_DOMAIN_TRUSTSW; +STRUCT!{struct DS_DOMAIN_TRUSTSA { + NetbiosDomainName: ::LPSTR, + DnsDomainName: ::LPSTR, + Flags: ::ULONG, + ParentIndex: ::ULONG, + TrustType: ::ULONG, + TrustAttributes: ::ULONG, + DomainSid: ::PSID, + DomainGuid: ::GUID, +}} +pub type PDS_DOMAIN_TRUSTSA = *mut DS_DOMAIN_TRUSTSA; +pub const DS_ONLY_DO_SITE_NAME: ::ULONG = 0x01; +pub const DS_NOTIFY_AFTER_SITE_RECORDS: ::ULONG = 0x02; +pub const DS_OPEN_VALID_OPTION_FLAGS: ::ULONG = DS_ONLY_DO_SITE_NAME + | DS_NOTIFY_AFTER_SITE_RECORDS; +pub const DS_OPEN_VALID_FLAGS: ::ULONG = DS_FORCE_REDISCOVERY | DS_ONLY_LDAP_NEEDED + | DS_KDC_REQUIRED | DS_PDC_REQUIRED | DS_GC_SERVER_REQUIRED | DS_WRITABLE_REQUIRED; diff --git a/third_party/rust/winapi/src/dsound.rs b/third_party/rust/winapi/src/dsound.rs new file mode 100644 index 000000000000..e8f167fab745 --- /dev/null +++ b/third_party/rust/winapi/src/dsound.rs @@ -0,0 +1,132 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! DSound procedure declarations, constant definitions and macros +STRUCT!{struct DSCAPS { + dwSize: ::DWORD, + dwFlags: ::DWORD, + dwMinSecondarySampleRate: ::DWORD, + dwMaxSecondarySampleRate: ::DWORD, + dwPrimaryBuffers: ::DWORD, + dwMaxHwMixingAllBuffers: ::DWORD, + dwMaxHwMixingStaticBuffers: ::DWORD, + dwMaxHwMixingStreamingBuffers: ::DWORD, + dwFreeHwMixingAllBuffers: ::DWORD, + dwFreeHwMixingStaticBuffers: ::DWORD, + dwFreeHwMixingStreamingBuffers: ::DWORD, + dwMaxHw3DAllBuffers: ::DWORD, + dwMaxHw3DStaticBuffers: ::DWORD, + dwMaxHw3DStreamingBuffers: ::DWORD, + dwFreeHw3DAllBuffers: ::DWORD, + dwFreeHw3DStaticBuffers: ::DWORD, + dwFreeHw3DStreamingBuffers: ::DWORD, + dwTotalHwMemBytes: ::DWORD, + dwFreeHwMemBytes: ::DWORD, + dwMaxContigFreeHwMemBytes: ::DWORD, + dwUnlockTransferRateHwBuffers: ::DWORD, + dwPlayCpuOverheadSwBuffers: ::DWORD, + dwReserved1: ::DWORD, + dwReserved2: ::DWORD, +}} +pub type LPDSCAPS = *mut DSCAPS; +STRUCT!{struct DSBCAPS { + dwSize: ::DWORD, + dwFlags: ::DWORD, + dwBufferBytes: ::DWORD, + dwUnlockTransferRate: ::DWORD, + dwPlayCpuOverhead: ::DWORD, +}} +pub type LPDSBCAPS = *mut DSBCAPS; +STRUCT!{struct DSBUFFERDESC { + dwSize: ::DWORD, + dwFlags: ::DWORD, + dwBufferBytes: ::DWORD, + dwReserved: ::DWORD, + lpwfxFormat: ::LPWAVEFORMATEX, + guid3DAlgorithm: ::GUID, +}} +pub type LPCDSBUFFERDESC = *const DSBUFFERDESC; +RIDL!( +interface IDirectSoundBuffer(IDirectSoundBufferVtbl): IUnknown(IUnknownVtbl) { + fn GetCaps(&mut self, pDSBufferCaps: ::LPDSBCAPS) -> ::HRESULT, + fn GetCurrentPosition( + &mut self, pdwCurrentPlayCursor: ::LPDWORD, pdwCurrentWriteCursor: ::LPDWORD + ) -> ::HRESULT, + fn GetFormat( + &mut self, pwfxFormat: ::LPWAVEFORMATEX, dwSizeAllocated: ::DWORD, + pdwSizeWritten: ::LPDWORD + ) -> ::HRESULT, + fn GetVolume(&mut self, plVolume: ::LPLONG) -> ::HRESULT, + fn GetPan(&mut self, plPan: ::LPLONG) -> ::HRESULT, + fn GetFrequency(&mut self, pdwFrequency: ::LPDWORD) -> ::HRESULT, + fn GetStatus(&mut self, pdwStatus: ::LPDWORD) -> ::HRESULT, + fn Initialize( + &mut self, pDirectSound: ::LPDIRECTSOUND, pcDSBufferDesc: ::LPCDSBUFFERDESC + ) -> ::HRESULT, + fn Lock( + &mut self, dwOffset: ::DWORD, dwBytes: ::DWORD, ppvAudioPtr1: *mut ::LPVOID, + pdwAudioBytes1: ::LPDWORD, ppvAudioPtr2: *mut ::LPVOID, pdwAudioBytes2: ::LPDWORD, + dwFlags: ::DWORD + ) -> ::HRESULT, + fn Play(&mut self, dwReserved1: ::DWORD, dwPriority: ::DWORD, dwFlags: ::DWORD) -> ::HRESULT, + fn SetCurrentPosition(&mut self, dwNewPosition: ::DWORD) -> ::HRESULT, + fn SetFormat(&mut self, pcfxFormat: ::LPCWAVEFORMATEX) -> ::HRESULT, + fn SetVolume(&mut self, lVolume: ::LONG) -> ::HRESULT, + fn SetPan(&mut self, lPan: ::LONG) -> ::HRESULT, + fn SetFrequency(&mut self, dwFrequency: ::DWORD) -> ::HRESULT, + fn Stop(&mut self) -> ::HRESULT, + fn Unlock( + &mut self, pvAudioPtr1: ::LPVOID, dwAudioBytes1: ::DWORD, pvAudioPtr2: ::LPVOID, + dwAudioBytes2: ::DWORD + ) -> ::HRESULT, + fn Restore(&mut self) -> ::HRESULT +} +); +pub type LPDIRECTSOUNDBUFFER = *mut IDirectSoundBuffer; +RIDL!( +interface IDirectSound(IDirectSoundVtbl): IUnknown(IUnknownVtbl) +{ + fn CreateSoundBuffer( + &mut self, pcDSBufferDesc: ::LPCDSBUFFERDESC, ppDSBuffer: *mut ::LPDIRECTSOUNDBUFFER, + pUnkOuter: ::LPUNKNOWN + ) -> ::HRESULT, + fn GetCaps(&mut self, pDSCaps: ::LPDSCAPS) -> ::HRESULT, + fn DuplicateSoundBuffer( + &mut self, pDSBufferOriginal: LPDIRECTSOUNDBUFFER, + ppDSBufferDuplicate: *mut ::LPDIRECTSOUNDBUFFER + ) -> ::HRESULT, + fn SetCooperativeLevel(&mut self, hWnd: ::HWND, dwLevel: ::DWORD) -> ::HRESULT, + fn Compact(&mut self) -> ::HRESULT, + fn GetSpeakerConfig(&mut self, pdwSpeakerConfig: ::LPDWORD) -> ::HRESULT, + fn SetSpeakerConfig(&mut self, dwSpeakerConfig: ::DWORD) -> ::HRESULT, + fn Initialize(&mut self, pcGuidDevice: ::LPCGUID) -> ::HRESULT +} +); +pub type LPDIRECTSOUND = *mut IDirectSound; +pub const DS_OK: ::HRESULT = ::S_OK; +pub const DSERR_GENERIC: ::HRESULT = ::E_FAIL; +pub const DSSCL_NORMAL: ::DWORD = 0x00000001; +pub const DSSCL_PRIORITY: ::DWORD = 0x00000002; +pub const DSSCL_EXCLUSIVE: ::DWORD = 0x00000003; +pub const DSSCL_WRITEPRIMARY: ::DWORD = 0x00000004; +pub const DSBCAPS_PRIMARYBUFFER: ::DWORD = 0x00000001; +pub const DSBCAPS_STATIC: ::DWORD = 0x00000002; +pub const DSBCAPS_LOCHARDWARE: ::DWORD = 0x00000004; +pub const DSBCAPS_LOCSOFTWARE: ::DWORD = 0x00000008; +pub const DSBCAPS_CTRL3D: ::DWORD = 0x00000010; +pub const DSBCAPS_CTRLFREQUENCY: ::DWORD = 0x00000020; +pub const DSBCAPS_CTRLPAN: ::DWORD = 0x00000040; +pub const DSBCAPS_CTRLVOLUME: ::DWORD = 0x00000080; +pub const DSBCAPS_CTRLPOSITIONNOTIFY: ::DWORD = 0x00000100; +pub const DSBCAPS_CTRLFX: ::DWORD = 0x00000200; +pub const DSBCAPS_STICKYFOCUS: ::DWORD = 0x00004000; +pub const DSBCAPS_GLOBALFOCUS: ::DWORD = 0x00008000; +pub const DSBCAPS_GETCURRENTPOSITION2: ::DWORD = 0x00010000; +pub const DSBCAPS_MUTE3DATMAXDISTANCE: ::DWORD = 0x00020000; +pub const DSBCAPS_LOCDEFER: ::DWORD = 0x00040000; +pub const DSBCAPS_TRUEPLAYPOSITION: ::DWORD = 0x00080000; +pub const DSBPLAY_LOOPING: ::DWORD = 0x00000001; +pub const DSBPLAY_LOCHARDWARE: ::DWORD = 0x00000002; +pub const DSBPLAY_LOCSOFTWARE: ::DWORD = 0x00000004; +pub const DSBPLAY_TERMINATEBY_TIME: ::DWORD = 0x00000008; +pub const DSBPLAY_TERMINATEBY_DISTANCE: ::DWORD = 0x000000010; +pub const DSBPLAY_TERMINATEBY_PRIORITY: ::DWORD = 0x000000020; diff --git a/third_party/rust/winapi/src/dsrole.rs b/third_party/rust/winapi/src/dsrole.rs new file mode 100644 index 000000000000..f9cf81c8923c --- /dev/null +++ b/third_party/rust/winapi/src/dsrole.rs @@ -0,0 +1,50 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Contains public interfaces to query the network roles of workstations, servers, and DCs +ENUM!{enum DSROLE_MACHINE_ROLE { + DsRole_RoleStandaloneWorkstation, + DsRole_RoleMemberWorkstation, + DsRole_RoleStandaloneServer, + DsRole_RoleMemberServer, + DsRole_RoleBackupDomainController, + DsRole_RolePrimaryDomainController, +}} +ENUM!{enum DSROLE_SERVER_STATE { + DsRoleServerUnknown = 0, + DsRoleServerPrimary, + DsRoleServerBackup, +}} +pub type PDSROLE_SERVER_STATE = *mut DSROLE_SERVER_STATE; +ENUM!{enum DSROLE_PRIMARY_DOMAIN_INFO_LEVEL { + DsRolePrimaryDomainInfoBasic = 1, + DsRoleUpgradeStatus, + DsRoleOperationState, +}} +pub const DSROLE_PRIMARY_DS_RUNNING: ::ULONG = 0x00000001; +pub const DSROLE_PRIMARY_DS_MIXED_MODE: ::ULONG = 0x00000002; +pub const DSROLE_UPGRADE_IN_PROGRESS: ::ULONG = 0x00000004; +pub const DSROLE_PRIMARY_DS_READONLY: ::ULONG = 0x00000008; +pub const DSROLE_PRIMARY_DOMAIN_GUID_PRESENT: ::ULONG = 0x01000000; +STRUCT!{struct DSROLE_PRIMARY_DOMAIN_INFO_BASIC { + MachineRole: DSROLE_MACHINE_ROLE, + Flags: ::ULONG, + DomainNameFlat: ::LPWSTR, + DomainNameDns: ::LPWSTR, + DomainForestName: ::LPWSTR, + DomainGuid: ::GUID, +}} +pub type PDSROLE_PRIMARY_DOMAIN_INFO_BASIC = *mut DSROLE_PRIMARY_DOMAIN_INFO_BASIC; +STRUCT!{struct DSROLE_UPGRADE_STATUS_INFO { + OperationState: ::ULONG, + PreviousServerState: DSROLE_SERVER_STATE, +}} +pub type PDSROLE_UPGRADE_STATUS_INFO = *mut DSROLE_UPGRADE_STATUS_INFO; +ENUM!{enum DSROLE_OPERATION_STATE { + DsRoleOperationIdle = 0, + DsRoleOperationActive, + DsRoleOperationNeedReboot, +}} +STRUCT!{struct DSROLE_OPERATION_STATE_INFO { + OperationState: DSROLE_OPERATION_STATE, +}} +pub type PDSROLE_OPERATION_STATE_INFO = *mut DSROLE_OPERATION_STATE_INFO; diff --git a/third_party/rust/winapi/src/dwmapi.rs b/third_party/rust/winapi/src/dwmapi.rs new file mode 100644 index 000000000000..f95e8f1d7093 --- /dev/null +++ b/third_party/rust/winapi/src/dwmapi.rs @@ -0,0 +1,9 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Procedure declarations, constant definitions, and macros for the NLS component. +STRUCT!{struct DWM_BLURBEHIND { + dwFlags: ::DWORD, + fEnable: ::BOOL, + hRgnBlur: ::HRGN, + fTransitionOnMaximized: ::BOOL, +}} diff --git a/third_party/rust/winapi/src/dwrite.rs b/third_party/rust/winapi/src/dwrite.rs new file mode 100644 index 000000000000..09bbf0d935df --- /dev/null +++ b/third_party/rust/winapi/src/dwrite.rs @@ -0,0 +1,1038 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! DirectX Typography Services public API definitions. +ENUM!{enum DWRITE_FONT_FILE_TYPE { + DWRITE_FONT_FILE_TYPE_UNKNOWN, + DWRITE_FONT_FILE_TYPE_CFF, + DWRITE_FONT_FILE_TYPE_TRUETYPE, + DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION, + DWRITE_FONT_FILE_TYPE_TYPE1_PFM, + DWRITE_FONT_FILE_TYPE_TYPE1_PFB, + DWRITE_FONT_FILE_TYPE_VECTOR, + DWRITE_FONT_FILE_TYPE_BITMAP, +}} +ENUM!{enum DWRITE_FONT_FACE_TYPE { + DWRITE_FONT_FACE_TYPE_CFF, + DWRITE_FONT_FACE_TYPE_TRUETYPE, + DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION, + DWRITE_FONT_FACE_TYPE_TYPE1, + DWRITE_FONT_FACE_TYPE_VECTOR, + DWRITE_FONT_FACE_TYPE_BITMAP, + DWRITE_FONT_FACE_TYPE_UNKNOWN, + DWRITE_FONT_FACE_TYPE_RAW_CFF, +}} +FLAGS!{enum DWRITE_FONT_SIMULATIONS { + DWRITE_FONT_SIMULATIONS_NONE = 0x0000, + DWRITE_FONT_SIMULATIONS_BOLD = 0x0001, + DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002, +}} +ENUM!{enum DWRITE_FONT_WEIGHT { + DWRITE_FONT_WEIGHT_THIN = 100, + DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200, + DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200, + DWRITE_FONT_WEIGHT_LIGHT = 300, + DWRITE_FONT_WEIGHT_SEMI_LIGHT = 350, + DWRITE_FONT_WEIGHT_NORMAL = 400, + DWRITE_FONT_WEIGHT_REGULAR = 400, + DWRITE_FONT_WEIGHT_MEDIUM = 500, + DWRITE_FONT_WEIGHT_DEMI_BOLD = 600, + DWRITE_FONT_WEIGHT_SEMI_BOLD = 600, + DWRITE_FONT_WEIGHT_BOLD = 700, + DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800, + DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800, + DWRITE_FONT_WEIGHT_BLACK = 900, + DWRITE_FONT_WEIGHT_HEAVY = 900, + DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950, + DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950, +}} +ENUM!{enum DWRITE_FONT_STRETCH { + DWRITE_FONT_STRETCH_UNDEFINED = 0, + DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1, + DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2, + DWRITE_FONT_STRETCH_CONDENSED = 3, + DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4, + DWRITE_FONT_STRETCH_NORMAL = 5, + DWRITE_FONT_STRETCH_MEDIUM = 5, + DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6, + DWRITE_FONT_STRETCH_EXPANDED = 7, + DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8, + DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9, +}} +ENUM!{enum DWRITE_FONT_STYLE { + DWRITE_FONT_STYLE_NORMAL, + DWRITE_FONT_STYLE_OBLIQUE, + DWRITE_FONT_STYLE_ITALIC, +}} +ENUM!{enum DWRITE_INFORMATIONAL_STRING_ID { + DWRITE_INFORMATIONAL_STRING_NONE, + DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, + DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, + DWRITE_INFORMATIONAL_STRING_TRADEMARK, + DWRITE_INFORMATIONAL_STRING_MANUFACTURER, + DWRITE_INFORMATIONAL_STRING_DESIGNER, + DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, + DWRITE_INFORMATIONAL_STRING_DESCRIPTION, + DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, + DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, + DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, + DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT, + DWRITE_INFORMATIONAL_STRING_FULL_NAME, + DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME, + DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME, + DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME, + DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG, + DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG, +}} +STRUCT!{struct DWRITE_FONT_METRICS { + designUnitsPerEm: ::UINT16, + ascent: ::UINT16, + descent: ::UINT16, + lineGap: ::INT16, + capHeight: ::UINT16, + xHeight: ::UINT16, + underlinePosition: ::INT16, + underlineThickness: ::UINT16, + strikethroughPosition: ::INT16, + strikethroughThickness: ::UINT16, +}} +STRUCT!{struct DWRITE_GLYPH_METRICS { + leftSideBearing: ::INT32, + advanceWidth: ::UINT32, + rightSideBearing: ::INT32, + topSideBearing: ::INT32, + advanceHeight: ::UINT32, + bottomSideBearing: ::INT32, + verticalOriginY: ::INT32, +}} +STRUCT!{struct DWRITE_GLYPH_OFFSET { + advanceOffset: ::FLOAT, + ascenderOffset: ::FLOAT, +}} +ENUM!{enum DWRITE_FACTORY_TYPE { + DWRITE_FACTORY_TYPE_SHARED, + DWRITE_FACTORY_TYPE_ISOLATED, +}} +#[inline] +pub fn DWRITE_MAKE_OPENTYPE_TAG(a: u8, b: u8, c: u8, d: u8) -> u32 { + ((d as u32) << 24) | ((c as u32) << 16) | ((b as u32) << 8) | (a as u32) +} +RIDL!{interface IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl): IUnknown(IUnknownVtbl) { + fn CreateStreamFromKey( + &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, + fontFileStream: *mut *mut IDWriteFontFileStream + ) -> ::HRESULT +}} +RIDL!{interface IDWriteLocalFontFileLoader(IDWriteLocalFontFileLoaderVtbl): + IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl) { + fn GetFilePathLengthFromKey( + &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, + filePathLength: *mut ::UINT32 + ) -> ::HRESULT, + fn GetFilePathFromKey( + &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, + filePath: *mut ::WCHAR, + filePathSize: ::UINT32 + ) -> ::HRESULT, + fn GetLastWriteTimeFromKey( + &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, + lastWriteTime: *mut ::FILETIME + ) -> ::HRESULT +}} +RIDL!{interface IDWriteFontFileStream(IDWriteFontFileStreamVtbl): IUnknown(IUnknownVtbl) { + fn ReadFileFragment( + &mut self, fragmentStart: *mut *const ::c_void, fileOffset: ::UINT64, + fragmentSize: ::UINT64, fragmentContext: *mut *mut ::c_void + ) -> ::HRESULT, + fn ReleaseFileFragment(&mut self, fragmentContext: *mut ::c_void) -> (), + fn GetFileSize(&mut self, fileSize: *mut ::UINT64) -> ::HRESULT, + fn GetLastWriteTime(&mut self, lastWriteTime: *mut ::UINT64) -> ::HRESULT +}} +RIDL!{interface IDWriteFontFile(IDWriteFontFileVtbl): IUnknown(IUnknownVtbl) { + fn GetReferenceKey( + &mut self, fontFileReferenceKey: *mut *const ::c_void, + fontFileReferenceKeySize: *mut ::UINT32 + ) -> ::HRESULT, + fn GetLoader(&mut self, fontFileLoader: *mut *mut IDWriteFontFileLoader) -> ::HRESULT, + fn Analyze( + &mut self, isSupportedFontType: *mut ::BOOL, fontFileType: *mut DWRITE_FONT_FILE_TYPE, + fontFaceType: *mut DWRITE_FONT_FACE_TYPE, numberOfFaces: *mut ::UINT32 + ) -> ::HRESULT +}} +ENUM!{enum DWRITE_PIXEL_GEOMETRY { + DWRITE_PIXEL_GEOMETRY_FLAT, + DWRITE_PIXEL_GEOMETRY_RGB, + DWRITE_PIXEL_GEOMETRY_BGR, +}} +ENUM!{enum DWRITE_RENDERING_MODE { + DWRITE_RENDERING_MODE_DEFAULT, + DWRITE_RENDERING_MODE_ALIASED, + DWRITE_RENDERING_MODE_GDI_CLASSIC, + DWRITE_RENDERING_MODE_GDI_NATURAL, + DWRITE_RENDERING_MODE_NATURAL, + DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + DWRITE_RENDERING_MODE_OUTLINE, + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC.0, + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL.0, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL.0, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC.0, +}} +STRUCT!{struct DWRITE_MATRIX { + m11: ::FLOAT, + m12: ::FLOAT, + m21: ::FLOAT, + m22: ::FLOAT, + dx: ::FLOAT, + dy: ::FLOAT, +}} +RIDL!{interface IDWriteRenderingParams(IDWriteRenderingParamsVtbl): IUnknown(IUnknownVtbl) { + fn GetGamma(&mut self) -> ::FLOAT, + fn GetEnhancedContrast(&mut self) -> ::FLOAT, + fn GetClearTypeLevel(&mut self) -> ::FLOAT, + fn GetPixelGeometry(&mut self) -> DWRITE_PIXEL_GEOMETRY, + fn GetRenderingMode(&mut self) -> DWRITE_RENDERING_MODE +}} +pub type IDWriteGeometrySink = ::ID2D1SimplifiedGeometrySink; +RIDL!{interface IDWriteFontFace(IDWriteFontFaceVtbl): IUnknown(IUnknownVtbl) { + fn GetType(&mut self) -> DWRITE_FONT_FACE_TYPE, + fn GetFiles( + &mut self, numberOfFiles: *mut ::UINT32, fontFiles: *mut *mut IDWriteFontFile + ) -> ::HRESULT, + fn GetIndex(&mut self) -> ::UINT32, + fn GetSimulations(&mut self) -> DWRITE_FONT_SIMULATIONS, + fn IsSymbolFont(&mut self) -> ::BOOL, + fn GetMetrics(&mut self, fontFaceMetrics: *mut DWRITE_FONT_METRICS) -> (), + fn GetGlyphCount(&mut self) -> ::UINT16, + fn GetDesignGlyphMetrics( + &mut self, glyphIndices: *const ::UINT16, glyphCount: ::UINT32, + glyphMetrics: *mut DWRITE_GLYPH_METRICS, isSideways: ::BOOL + ) -> ::HRESULT, + fn GetGlyphIndices( + &mut self, codePoints: *const ::UINT32, codePointCount: ::UINT32, + glyphIndices: *mut ::UINT16 + ) -> ::HRESULT, + fn TryGetFontTable( + &mut self, openTypeTableTag: ::UINT32, tableData: *mut *const ::c_void, + tableSize: *mut ::UINT32, tableContext: *mut *mut ::c_void, exists: *mut ::BOOL + ) -> ::HRESULT, + fn ReleaseFontTable( + &mut self, tableContext: *mut ::c_void + ) -> ::HRESULT, + fn GetGlyphRunOutline( + &mut self, emSize: ::FLOAT, glyphIndices: *const ::UINT16, glyphAdvances: *const ::FLOAT, + glyphOffsets: *const DWRITE_GLYPH_OFFSET, glyphCount: ::UINT32, isSideways: ::BOOL, + isRightToLeft: ::BOOL, geometrySink: *mut IDWriteGeometrySink + ) -> ::HRESULT, + fn GetRecommendedRenderingMode( + &mut self, emSize: ::FLOAT, pixelsPerDip: ::FLOAT, measuringMode: ::DWRITE_MEASURING_MODE, + renderingParams: *mut IDWriteRenderingParams, renderingMode: *mut DWRITE_RENDERING_MODE + ) -> ::HRESULT, + fn GetGdiCompatibleMetrics( + &mut self, emSize: ::FLOAT, pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, + fontFaceMetrics: *mut DWRITE_FONT_METRICS + ) -> ::HRESULT, + fn GetGdiCompatibleGlyphMetrics( + &mut self, enSize: ::FLOAT, pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, + useGdiNatrual: ::BOOL, glyphIndices: *const ::UINT16, glyphCount: ::UINT32, + glyphMetrics: *mut DWRITE_GLYPH_METRICS, isSideways: ::BOOL + ) -> ::HRESULT +}} +RIDL!{interface IDWriteFontCollectionLoader(IDWriteFontCollectionLoaderVtbl): + IUnknown(IUnknownVtbl) { + fn CreateEnumeratorFromKey( + &mut self, factory: *mut IDWriteFactory, collectionKey: *const ::c_void, + collectionKeySize: ::UINT32, fontFileEnumerator: *mut *mut IDWriteFontFileEnumerator + ) -> ::HRESULT +}} +RIDL!{interface IDWriteFontFileEnumerator(IDWriteFontFileEnumeratorVtbl): IUnknown(IUnknownVtbl) { + fn MoveNext(&mut self, hasCurrentFile: *mut ::BOOL) -> ::HRESULT, + fn GetCurrentFontFile(&mut self, fontFile: *mut *mut IDWriteFontFile) -> ::HRESULT +}} +RIDL!{interface IDWriteLocalizedStrings(IDWriteLocalizedStringsVtbl): IUnknown(IUnknownVtbl) { + fn GetCount(&mut self) -> ::UINT32, + fn FindLocaleName( + &mut self, localeName: *const ::WCHAR, index: *mut ::UINT32, exists: *mut ::BOOL + ) -> ::HRESULT, + fn GetLocaleNameLength(&mut self, index: ::UINT32, length: *mut ::UINT32) -> ::HRESULT, + fn GetLocaleName( + &mut self, index: ::UINT32, localeName: *mut ::WCHAR, size: ::UINT32 + ) -> ::HRESULT, + fn GetStringLength(&mut self, index: ::UINT32, length: *mut ::UINT32) -> ::HRESULT, + fn GetString( + &mut self, index: ::UINT32, stringBuffer: *mut ::WCHAR, size: ::UINT32 + ) -> ::HRESULT +}} +RIDL!{interface IDWriteFontCollection(IDWriteFontCollectionVtbl): IUnknown(IUnknownVtbl) { + fn GetFontFamilyCount(&mut self) -> ::UINT32, + fn GetFontFamily( + &mut self, index: ::UINT32, fontFamily: *mut *mut IDWriteFontFamily + ) -> ::HRESULT, + fn FindFamilyName( + &mut self, familyName: *const ::WCHAR, index: *mut ::UINT32, exists: *mut ::BOOL + ) -> ::HRESULT, + fn GetFontFromFontFace( + &mut self, fontFace: *mut IDWriteFontFace, font: *mut *mut IDWriteFont + ) -> ::HRESULT +}} +RIDL!{interface IDWriteFontList(IDWriteFontListVtbl): IUnknown(IUnknownVtbl) { + fn GetFontCollection(&mut self, fontCollection: *mut *mut IDWriteFontCollection) -> ::HRESULT, + fn GetFontCount(&mut self) -> ::UINT32, + fn GetFont(&mut self, index: ::UINT32, font: *mut *mut IDWriteFont) -> ::HRESULT +}} +RIDL!{interface IDWriteFontFamily(IDWriteFontFamilyVtbl): IDWriteFontList(IDWriteFontListVtbl) { + fn GetFamilyNames(&mut self, names: *mut *mut IDWriteLocalizedStrings) -> ::HRESULT, + fn GetFirstMatchingFont( + &mut self, weight: DWRITE_FONT_WEIGHT, stretch: DWRITE_FONT_STRETCH, + style: DWRITE_FONT_STYLE, matchingFont: *mut *mut IDWriteFont + ) -> ::HRESULT, + fn GetMatchingFonts( + &mut self, weight: DWRITE_FONT_WEIGHT, stretch: DWRITE_FONT_STRETCH, + style: DWRITE_FONT_STYLE, matchingFonts: *mut *mut IDWriteFontList + ) -> ::HRESULT +}} +RIDL!{interface IDWriteFont(IDWriteFontVtbl): IUnknown(IUnknownVtbl) { + fn GetFontFamily(&mut self, fontFamily: *mut *mut IDWriteFontFamily) -> ::HRESULT, + fn GetWeight(&mut self) -> DWRITE_FONT_WEIGHT, + fn GetStretch(&mut self) -> DWRITE_FONT_STRETCH, + fn GetStyle(&mut self) -> DWRITE_FONT_STYLE, + fn IsSymbolFont(&mut self) -> ::BOOL, + fn GetFaceNames(&mut self, names: *mut *mut IDWriteLocalizedStrings) -> ::HRESULT, + fn GetInformationalStrings( + &mut self, informationalStringId: DWRITE_INFORMATIONAL_STRING_ID, + informationalStrings: *mut *mut IDWriteLocalizedStrings, exists: *mut ::BOOL + ) -> ::HRESULT, + fn GetSimulations(&mut self) -> DWRITE_FONT_SIMULATIONS, + fn GetMetrics(&mut self, fontMetrics: *mut DWRITE_FONT_METRICS) -> (), + fn HasCharacter(&mut self, unicodeValue: ::UINT32, exists: *mut ::BOOL) -> ::HRESULT, + fn CreateFontFace(&mut self, fontFace: *mut *mut IDWriteFontFace) -> ::HRESULT +}} +ENUM!{enum DWRITE_READING_DIRECTION { + DWRITE_READING_DIRECTION_LEFT_TO_RIGHT = 0, + DWRITE_READING_DIRECTION_RIGHT_TO_LEFT = 1, + DWRITE_READING_DIRECTION_TOP_TO_BOTTOM = 2, + DWRITE_READING_DIRECTION_BOTTOM_TO_TOP = 3, +}} +ENUM!{enum DWRITE_FLOW_DIRECTION { + DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM = 0, + DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP = 1, + DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT = 2, + DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT = 3, +}} +ENUM!{enum DWRITE_TEXT_ALIGNMENT { + DWRITE_TEXT_ALIGNMENT_LEADING, + DWRITE_TEXT_ALIGNMENT_TRAILING, + DWRITE_TEXT_ALIGNMENT_CENTER, + DWRITE_TEXT_ALIGNMENT_JUSTIFIED, +}} +ENUM!{enum DWRITE_PARAGRAPH_ALIGNMENT { + DWRITE_PARAGRAPH_ALIGNMENT_NEAR, + DWRITE_PARAGRAPH_ALIGNMENT_FAR, + DWRITE_PARAGRAPH_ALIGNMENT_CENTER, +}} +ENUM!{enum DWRITE_WORD_WRAPPING { + DWRITE_WORD_WRAPPING_WRAP = 0, + DWRITE_WORD_WRAPPING_NO_WRAP = 1, + DWRITE_WORD_WRAPPING_EMERGENCY_BREAK = 2, + DWRITE_WORD_WRAPPING_WHOLE_WORD = 3, + DWRITE_WORD_WRAPPING_CHARACTER = 4, +}} +ENUM!{enum DWRITE_LINE_SPACING_METHOD { + DWRITE_LINE_SPACING_METHOD_DEFAULT, + DWRITE_LINE_SPACING_METHOD_UNIFORM, + DWRITE_LINE_SPACING_METHOD_PROPORTIONAL, +}} +ENUM!{enum DWRITE_TRIMMING_GRANULARITY { + DWRITE_TRIMMING_GRANULARITY_NONE, + DWRITE_TRIMMING_GRANULARITY_CHARACTER, + DWRITE_TRIMMING_GRANULARITY_WORD, +}} +ENUM!{enum DWRITE_FONT_FEATURE_TAG { + DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt' + DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case' + DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig' + DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh' + DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs' + DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt' + DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig' + DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt' + DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac' + DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid' + DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half' + DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist' + DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig' + DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid' + DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo' + DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04' + DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78' + DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83' + DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90' + DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern' + DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga' + DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum' + DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl' + DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark' + DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk' + DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt' + DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck' + DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum' + DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid' + DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid' + DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig' + DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt' + DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp' + DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20' + DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs' + DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups' + DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh' + DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam' + DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad' + DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid' + DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic' + DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING = 0x74726576, // 'vert' + DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION = 0x32747276, // 'vrt2' + DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero' +}} +STRUCT!{struct DWRITE_TEXT_RANGE { + startPosition: ::UINT32, + length: ::UINT32, +}} +STRUCT!{struct DWRITE_FONT_FEATURE { + nameTag: DWRITE_FONT_FEATURE_TAG, + parameter: ::UINT32, +}} +STRUCT!{struct DWRITE_TYPOGRAPHIC_FEATURES { + features: *mut DWRITE_FONT_FEATURE, + featureCount: ::UINT32, +}} +STRUCT!{struct DWRITE_TRIMMING { + granularity: DWRITE_TRIMMING_GRANULARITY, + delimiter: ::UINT32, + delimiterCount: ::UINT32, +}} +RIDL!{interface IDWriteTextFormat(IDWriteTextFormatVtbl): IUnknown(IUnknownVtbl) { + fn SetTextAlignment(&mut self, textAlignment: DWRITE_TEXT_ALIGNMENT) -> ::HRESULT, + fn SetParagraphAlignment( + &mut self, paragraphAlignment: DWRITE_PARAGRAPH_ALIGNMENT + ) -> ::HRESULT, + fn SetWordWrapping(&mut self, wordWrapping: DWRITE_WORD_WRAPPING) -> ::HRESULT, + fn SetReadingDirection(&mut self, readingDirection: DWRITE_READING_DIRECTION) -> ::HRESULT, + fn SetFlowDirection(&mut self, flowDirection: DWRITE_FLOW_DIRECTION) -> ::HRESULT, + fn SetIncrementalTabStop(&mut self, incrementalTabStop: ::FLOAT) -> ::HRESULT, + fn SetTrimming( + &mut self, trimmingOptions: *const DWRITE_TRIMMING, trimmingSign: *mut IDWriteInlineObject + ) -> ::HRESULT, + fn SetLineSpacing( + &mut self, lineSpacingMethod: DWRITE_LINE_SPACING_METHOD, lineSpacing: ::FLOAT, + baseLine: ::FLOAT + ) -> ::HRESULT, + fn GetTextAlignment(&mut self) -> DWRITE_TEXT_ALIGNMENT, + fn GetParagraphAlignment(&mut self) -> DWRITE_PARAGRAPH_ALIGNMENT, + fn GetWordWrapping(&mut self) -> DWRITE_WORD_WRAPPING, + fn GetReadingDirection(&mut self) -> DWRITE_READING_DIRECTION, + fn GetFlowDirection(&mut self) -> DWRITE_FLOW_DIRECTION, + fn GetIncrementalTabStop(&mut self) -> ::FLOAT, + fn GetTrimming( + &mut self, trimmingOptions: *mut DWRITE_TRIMMING, + trimmingSign: *mut *mut IDWriteInlineObject + ) -> ::HRESULT, + fn GetLineSpacing( + &mut self, lineSpacingMethod: *mut DWRITE_LINE_SPACING_METHOD, lineSpacing: *mut ::FLOAT, + baseline: *mut ::FLOAT + ) -> ::HRESULT, + fn GetFontCollection(&mut self, fontCollection: *mut *mut IDWriteFontCollection) -> ::HRESULT, + fn GetFontFamilyNameLength(&mut self) -> ::UINT32, + fn GetFontFamilyName(&mut self, fontFamilyName: *mut ::WCHAR, nameSize: ::UINT32) -> ::HRESULT, + fn GetFontWeight(&mut self) -> DWRITE_FONT_WEIGHT, + fn GetFontStyle(&mut self) -> DWRITE_FONT_STYLE, + fn GetFontStretch(&mut self) -> DWRITE_FONT_STRETCH, + fn GetFontSize(&mut self) -> ::FLOAT, + fn GetLocaleNameLength(&mut self) -> ::UINT32, + fn GetLocaleName(&mut self, localeName: *mut ::WCHAR, nameSize: ::UINT32) -> ::HRESULT +}} +RIDL!{interface IDWriteTypography(IDWriteTypographyVtbl): IUnknown(IUnknownVtbl) { + fn AddFontFeature(&mut self, fontFeature: DWRITE_FONT_FEATURE) -> ::HRESULT, + fn GetFontFeatureCount(&mut self) -> ::UINT32, + fn GetFontFeature( + &mut self, fontFeatureIndex: ::UINT32, fontFeature: *mut DWRITE_FONT_FEATURE + ) -> ::HRESULT +}} +FLAGS!{enum DWRITE_SCRIPT_SHAPES { + DWRITE_SCRIPT_SHAPES_DEFAULT = 0, + DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1, +}} +STRUCT!{struct DWRITE_SCRIPT_ANALYSIS { + script: ::UINT16, + shapes: DWRITE_SCRIPT_SHAPES, +}} +ENUM!{enum DWRITE_BREAK_CONDITION { + DWRITE_BREAK_CONDITION_NEUTRAL, + DWRITE_BREAK_CONDITION_CAN_BREAK, + DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, + DWRITE_BREAK_CONDITION_MUST_BREAK, +}} +STRUCT!{struct DWRITE_LINE_BREAKPOINT { + bit_fields: ::UINT8, +}} +BITFIELD!{DWRITE_LINE_BREAKPOINT bit_fields: ::UINT8 [ + breakConditionBefore set_breakConditionBefore[0..2], + breakConditionAfter set_breakConditionAfter[2..4], + isWhitespace set_isWhitespace[4..5], + isSoftHyphen set_isSoftHyphen[5..6], + padding set_padding[6..8], +]} +ENUM!{enum DWRITE_NUMBER_SUBSTITUTION_METHOD { + DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, + DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, + DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, + DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, + DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL, +}} +RIDL!{interface IDWriteNumberSubstitution(IDWriteNumberSubstitutionVtbl): IUnknown(IUnknownVtbl) { +}} +STRUCT!{struct DWRITE_SHAPING_TEXT_PROPERTIES { + bit_fields: ::UINT16, +}} +BITFIELD!{DWRITE_SHAPING_TEXT_PROPERTIES bit_fields: ::UINT16 [ + isShapedAlone set_isShapedAlone[0..1], + reserved set_reserved[1..16], +]} +STRUCT!{struct DWRITE_SHAPING_GLYPH_PROPERTIES { + bit_fields: ::UINT16, +}} +BITFIELD!{DWRITE_SHAPING_GLYPH_PROPERTIES bit_fields: ::UINT16 [ + justification set_justification[0..4], + isClusterStart set_isClusterStart[4..5], + isDiacritic set_isDiacritic[5..6], + isZeroWidthSpace set_isZeroWidthSpace[6..7], + reserved set_reserved[7..16], +]} +RIDL!{interface IDWriteTextAnalysisSource(IDWriteTextAnalysisSourceVtbl): IUnknown(IUnknownVtbl) { + fn GetTextAtPosition( + &mut self, textPosition: ::UINT32, textString: *mut *const ::WCHAR, + textLength: *mut ::UINT32 + ) -> ::HRESULT, + fn GetTextBeforePosition( + &mut self, textPosition: ::UINT32, textString: *mut *const ::WCHAR, + textLength: *mut ::UINT32 + ) -> ::HRESULT, + fn GetParagraphReadingDirection(&mut self) -> DWRITE_READING_DIRECTION, + fn GetLocaleName( + &mut self, textPosition: ::UINT32, textLength: *mut ::UINT32, + localeName: *mut *const ::WCHAR + ) -> ::HRESULT, + fn GetNumberSubstitution( + &mut self, textPosition: ::UINT32, textLength: *mut ::UINT32, + numberSubstitution: *mut *mut IDWriteNumberSubstitution + ) -> ::HRESULT +}} +RIDL!{interface IDWriteTextAnalysisSink(IDWriteTextAnalysisSinkVtbl): IUnknown(IUnknownVtbl) { + fn SetScriptAnalysis( + &mut self, textPosition: ::UINT32, textLength: ::UINT32, + scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS + ) -> ::HRESULT, + fn SetLineBreakpoints( + &mut self, textPosition: ::UINT32, textLength: ::UINT32, + lineBreakpoints: *const DWRITE_LINE_BREAKPOINT + ) -> ::HRESULT, + fn SetBidiLevel( + &mut self, textPosition: ::UINT32, textLength: ::UINT32, explicitLevel: ::UINT8, + resolvedLevel: ::UINT8 + ) -> ::HRESULT, + fn SetNumberSubstitution( + &mut self, textPosition: ::UINT32, textLength: ::UINT32, + numberSubstitution: *mut IDWriteNumberSubstitution + ) -> ::HRESULT +}} +RIDL!{interface IDWriteTextAnalyzer(IDWriteTextAnalyzerVtbl): IUnknown(IUnknownVtbl) { + fn AnalyzeScript( + &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, + textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink + ) -> ::HRESULT, + fn AnalyzeBidi( + &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, + textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink + ) -> ::HRESULT, + fn AnalyzeNumberSubstitution( + &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, + textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink + ) -> ::HRESULT, + fn AnalyzeLineBreakpoints( + &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, + textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink + ) -> ::HRESULT, + fn GetGlyphs( + &mut self, textString: *const ::WCHAR, textLength: ::UINT32, + fontFace: *mut IDWriteFontFace, isSideways: ::BOOL, isRightToLeft: ::BOOL, + scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, localeName: *const ::WCHAR, + numberSubstitution: *mut IDWriteNumberSubstitution, + features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, featureRangeLengths: *const ::UINT32, + featureRanges: ::UINT32, maxGlyphCount: ::UINT32, clusterMap: *mut ::UINT16, + textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, glyphIndices: *mut ::UINT16, + glyphProps: *mut DWRITE_SHAPING_GLYPH_PROPERTIES, actualGlyphCount: *mut ::UINT32 + ) -> ::HRESULT, + fn GetGlyphPlacements( + &mut self, textString: *const ::WCHAR, clusterMap: *const ::UINT16, + textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, textLength: ::UINT32, + glyphIndices: *const ::UINT16, glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES, + glyphCount: ::UINT32, fontFace: *mut IDWriteFontFace, fontEmSize: ::FLOAT, + isSideways: ::BOOL, isRightToLeft: ::BOOL, scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, + localeName: *const ::WCHAR, features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, + featureRangeLengths: *const ::UINT32, featureRanges: ::UINT32, glyphAdvances: *mut ::FLOAT, + glyphOffsets: *mut DWRITE_GLYPH_OFFSET + ) -> ::HRESULT, + fn GetGdiCompatibleGlyphPlacements( + &mut self, textString: *const ::WCHAR, clusterMap: *const ::UINT16, + textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, textLength: ::UINT32, + glyphIndices: *const ::UINT16, glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES, + glyphCount: ::UINT32, fontFace: *mut IDWriteFontFace, fontEmSize: ::FLOAT, + pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, useGdiNatrual: ::BOOL, + isSideways: ::BOOL, isRightToLeft: ::BOOL, scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, + localeName: *const ::WCHAR, features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, + featureRangeLengths: *const ::UINT32, featureRanges: ::UINT32, glyphAdvances: *mut ::FLOAT, + glyphOffsets: *mut DWRITE_GLYPH_OFFSET + ) -> ::HRESULT +}} +STRUCT!{struct DWRITE_GLYPH_RUN { + fontFace: *mut IDWriteFontFace, + fontEmSize: ::FLOAT, + glyphCount: ::UINT32, + glyphIndices: *const ::UINT16, + glyphAdvances: *const ::FLOAT, + glyphOffsets: *const DWRITE_GLYPH_OFFSET, + isSideways: ::BOOL, + bidiLevel: ::UINT32, +}} +STRUCT!{struct DWRITE_GLYPH_RUN_DESCRIPTION { + localeName: *const ::WCHAR, + string: *const ::WCHAR, + stringLength: ::UINT32, + clusterMap: *const ::UINT16, + textPosition: ::UINT32, +}} +STRUCT!{struct DWRITE_UNDERLINE { + width: ::FLOAT, + thickness: ::FLOAT, + offset: ::FLOAT, + runHeight: ::FLOAT, + readingDirection: DWRITE_READING_DIRECTION, + flowDirection: DWRITE_FLOW_DIRECTION, + localeName: *const ::WCHAR, + measuringMode: ::DWRITE_MEASURING_MODE, +}} +STRUCT!{struct DWRITE_STRIKETHROUGH { + width: ::FLOAT, + thickness: ::FLOAT, + offset: ::FLOAT, + readingDirection: DWRITE_READING_DIRECTION, + flowDirection: DWRITE_FLOW_DIRECTION, + localeName: *const ::WCHAR, + measuringMode: ::DWRITE_MEASURING_MODE, +}} +STRUCT!{struct DWRITE_LINE_METRICS { + length: ::UINT32, + trailingWhitespaceLength: ::UINT32, + newlineLength: ::UINT32, + height: ::FLOAT, + baseline: ::FLOAT, + isTrimmed: ::BOOL, +}} +STRUCT!{struct DWRITE_CLUSTER_METRICS { + width: ::FLOAT, + length: ::UINT16, + bit_fields: ::UINT16, +}} +BITFIELD!{DWRITE_CLUSTER_METRICS bit_fields: ::UINT16 [ + canWrapLineAfter set_canWrapLineAfter[0..1], + isWhitespace set_isWhitespace[1..2], + isNewline set_isNewline[2..3], + isSoftHyphen set_isSoftHyphen[3..4], + isRightToLeft set_isRightToLeft[4..5], + padding set_padding[5..16], +]} +STRUCT!{struct DWRITE_TEXT_METRICS { + left: ::FLOAT, + top: ::FLOAT, + width: ::FLOAT, + widthIncludingTrailingWhitespace: ::FLOAT, + height: ::FLOAT, + layoutWidth: ::FLOAT, + layoutHeight: ::FLOAT, + maxBidiReorderingDepth: ::UINT32, + lineCount: ::UINT32, +}} +STRUCT!{struct DWRITE_INLINE_OBJECT_METRICS { + width: ::FLOAT, + height: ::FLOAT, + baseline: ::FLOAT, + supportsSideways: ::BOOL, +}} +STRUCT!{struct DWRITE_OVERHANG_METRICS { + left: ::FLOAT, + top: ::FLOAT, + right: ::FLOAT, + bottom: ::FLOAT, +}} +STRUCT!{struct DWRITE_HIT_TEST_METRICS { + textPosition: ::UINT32, + length: ::UINT32, + left: ::FLOAT, + top: ::FLOAT, + width: ::FLOAT, + height: ::FLOAT, + bidiLevel: ::UINT32, + isText: ::BOOL, + isTrimmed: ::BOOL, +}} +RIDL!{interface IDWriteInlineObject(IDWriteInlineObjectVtbl): IUnknown(IUnknownVtbl) { + fn Draw( + &mut self, clientDrawingContext: *mut ::c_void, renderer: *mut IDWriteTextRenderer, + originX: ::FLOAT, originY: ::FLOAT, isSideways: ::BOOL, isRightToLeft: ::BOOL, + clientDrawingEffect: *mut ::IUnknown + ) -> ::HRESULT, + fn GetMetrics(&mut self, metrics: *mut DWRITE_INLINE_OBJECT_METRICS) -> ::HRESULT, + fn GetOverhangMetrics(&mut self, overhangs: *mut DWRITE_OVERHANG_METRICS) -> ::HRESULT, + fn GetBreakConditions( + &mut self, breakConditionBefore: *mut DWRITE_BREAK_CONDITION, + breakConditionAfter: *mut DWRITE_BREAK_CONDITION + ) -> ::HRESULT +}} +RIDL!{interface IDWritePixelSnapping(IDWritePixelSnappingVtbl): IUnknown(IUnknownVtbl) { + fn IsPixelSnappingDisabled( + &mut self, clientDrawingContext: *mut ::c_void, isDisabled: *mut ::BOOL + ) -> ::HRESULT, + fn GetCurrentTransform( + &mut self, clientDrawingContext: *mut ::c_void, transform: *mut DWRITE_MATRIX + ) -> ::HRESULT, + fn GetPixelsPerDip( + &mut self, clientDrawingContext: *mut ::c_void, pixelsPerDip: *mut ::FLOAT + ) -> ::HRESULT +}} +RIDL!{interface IDWriteTextRenderer(IDWriteTextRendererVtbl): + IDWritePixelSnapping(IDWritePixelSnappingVtbl) { + fn DrawGlyphRun( + &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, + baselineOriginY: ::FLOAT, measuringMode: ::DWRITE_MEASURING_MODE, + glyphRun: *const DWRITE_GLYPH_RUN, + glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, + clientDrawingEffect: *mut ::IUnknown + ) -> ::HRESULT, + fn DrawUnderline( + &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, + baselineOriginY: ::FLOAT, underline: *const DWRITE_UNDERLINE, + clientDrawingEffect: *mut ::IUnknown + ) -> ::HRESULT, + fn DrawStrikethrough( + &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, + baselineOriginY: ::FLOAT, strikethrough: *const DWRITE_STRIKETHROUGH, + clientDrawingEffect: *mut ::IUnknown + ) -> ::HRESULT, + fn DrawInlineObject( + &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, + baselineOriginY: ::FLOAT, inlineObject: *mut IDWriteInlineObject, + isSideways: ::BOOL, isRightToLeft: ::BOOL, clientDrawingEffect: *mut ::IUnknown + ) -> ::HRESULT +}} +RIDL!{interface IDWriteTextLayout(IDWriteTextLayoutVtbl): + IDWriteTextFormat(IDWriteTextFormatVtbl) { + fn SetMaxWidth(&mut self, maxWidth: ::FLOAT) -> ::HRESULT, + fn SetMaxHeight(&mut self, maxHeight: ::FLOAT) -> ::HRESULT, + fn SetFontCollection( + &mut self, fontCollection: *mut IDWriteFontCollection, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetFontFamilyName( + &mut self, fontFamilyName: *const ::WCHAR, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetFontWeight( + &mut self, fontWeight: DWRITE_FONT_WEIGHT, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetFontStyle( + &mut self, fontStyle: DWRITE_FONT_STYLE, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetFontStretch( + &mut self, fontStretch: DWRITE_FONT_STRETCH, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetFontSize(&mut self, fontSize: ::FLOAT, textRange: DWRITE_TEXT_RANGE) -> ::HRESULT, + fn SetUnderline(&mut self, hasUnderline: ::BOOL, textRange: DWRITE_TEXT_RANGE) -> ::HRESULT, + fn SetStrikethrough( + &mut self, hasStrikethrough: ::BOOL, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetDrawingEffect( + &mut self, drawingEffect: *mut ::IUnknown, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetInlineObject( + &mut self, inlineObject: *mut IDWriteInlineObject, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetTypography( + &mut self, typography: *mut IDWriteTypography, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn SetLocaleName( + &mut self, localeName: *const ::WCHAR, textRange: DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetMaxWidth(&mut self) -> ::FLOAT, + fn GetMaxHeight(&mut self) -> ::FLOAT, + fn GetFontCollection( + &mut self, currentPosition: ::UINT32, fontCollection: *mut *mut IDWriteFontCollection, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetFontFamilyNameLength( + &mut self, currentPosition: ::UINT32, nameLength: *mut ::UINT32, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetFontFamilyName( + &mut self, currentPosition: ::UINT32, fontFamilyName: *mut ::WCHAR, + nameSize: ::UINT32, textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetFontWeight( + &mut self, currentPosition: ::UINT32, fontWeight: *mut DWRITE_FONT_WEIGHT, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetFontStyle( + &mut self, currentPosition: ::UINT32, fontStyle: *mut DWRITE_FONT_STYLE, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetFontStretch( + &mut self, currentPosition: ::UINT32, fontStretch: *mut DWRITE_FONT_STRETCH, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetFontSize( + &mut self, currentPosition: ::UINT32, fontSize: *mut ::FLOAT, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetUnderline( + &mut self, currentPosition: ::UINT32, hasUnderline: *mut ::BOOL, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetStrikethrough( + &mut self, currentPosition: ::UINT32, hasStrikethrough: *mut ::BOOL, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetDrawingEffect( + &mut self, currentPosition: ::UINT32, drawingEffect: *mut *mut ::IUnknown, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetInlineObject( + &mut self, currentPosition: ::UINT32, inlineObject: *mut *mut IDWriteInlineObject, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetTypography( + &mut self, currentPosition: ::UINT32, typography: *mut *mut IDWriteTypography, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetLocaleNameLength( + &mut self, currentPosition: ::UINT32, nameLength: *mut ::UINT32, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn GetLocaleName( + &mut self, currentPosition: ::UINT32, localeName: *mut ::WCHAR, nameSize: ::UINT32, + textRange: *mut DWRITE_TEXT_RANGE + ) -> ::HRESULT, + fn Draw( + &mut self, clientDrawingContext: *mut ::c_void, renderer: *mut IDWriteTextRenderer, + originX: ::FLOAT, originY: ::FLOAT + ) -> ::HRESULT, + fn GetLineMetrics( + &mut self, lineMetrics: *mut DWRITE_LINE_METRICS, maxLineCount: ::UINT32, + actualLineCount: *mut ::UINT32 + ) -> ::HRESULT, + fn GetMetrics(&mut self, textMetrics: *mut DWRITE_TEXT_METRICS) -> ::HRESULT, + fn GetOverhangMetrics(&mut self, overhangs: *mut DWRITE_OVERHANG_METRICS) -> ::HRESULT, + fn GetClusterMetrics( + &mut self, clusterMetrics: *mut DWRITE_CLUSTER_METRICS, maxClusterCount: ::UINT32, + actualClusterCount: *mut ::UINT32 + ) -> ::HRESULT, + fn DetermineMinWidth(&mut self, minWidth: *mut ::FLOAT) -> ::HRESULT, + fn HitTestPoint( + &mut self, pointX: ::FLOAT, pointY: ::FLOAT, isTrailingHit: *mut ::BOOL, + isInside: *mut ::BOOL, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS + ) -> ::HRESULT, + fn HitTestTextPosition( + &mut self, textPosition: ::UINT32, isTrailingHit: ::BOOL, pointX: *mut ::FLOAT, + pointY: *mut ::FLOAT, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS + ) -> ::HRESULT, + fn HitTestTextRange( + &mut self, textPosition: ::UINT32, textLength: ::UINT32, originX: ::FLOAT, + originY: ::FLOAT, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS, + maxHitTestMetricsCount: ::UINT32, actualHitTestMetricsCount: *mut ::UINT32 + ) -> ::HRESULT +}} +RIDL!{interface IDWriteBitmapRenderTarget(IDWriteBitmapRenderTargetVtbl): IUnknown(IUnknownVtbl) { + fn DrawGlyphRun( + &mut self, baselineOriginX: ::FLOAT, baselineOriginY: ::FLOAT, + measuringMode: ::DWRITE_MEASURING_MODE, glyphRun: *const ::DWRITE_GLYPH_RUN, + renderingParams: *mut IDWriteRenderingParams, textColor: ::COLORREF, + blackBoxRect: *mut ::RECT + ) -> ::HRESULT, + fn GetMemoryDC(&mut self) -> ::HDC, + fn GetPixelsPerDip(&mut self) -> ::FLOAT, + fn SetPixelsPerDip(&mut self, pixelsPerDip: ::FLOAT) -> ::HRESULT, + fn GetCurrentTransform(&mut self, transform: *mut DWRITE_MATRIX) -> ::HRESULT, + fn SetCurrentTransform(&mut self, transform: *const DWRITE_MATRIX) -> ::HRESULT, + fn GetSize(&mut self, size: *mut ::SIZE) -> ::HRESULT, + fn Resize(&mut self, width: ::UINT32, height: ::UINT32) -> ::HRESULT +}} +RIDL!{interface IDWriteGdiInterop(IDWriteGdiInteropVtbl): IUnknown(IUnknownVtbl) { + fn CreateFontFromLOGFONT( + &mut self, logFont: *const ::LOGFONTW, font: *mut *mut IDWriteFont + ) -> ::HRESULT, + fn ConvertFontToLOGFONT( + &mut self, font: *mut IDWriteFont, logFont: *mut ::LOGFONTW, isSystemFont: *mut ::BOOL + ) -> ::HRESULT, + fn ConvertFontFaceToLOGFONT( + &mut self, font: *mut IDWriteFontFace, logFont: *mut ::LOGFONTW + ) -> ::HRESULT, + fn CreateFontFaceFromHdc( + &mut self, hdc: ::HDC, fontFace: *mut *mut IDWriteFontFace + ) -> ::HRESULT, + fn CreateBitmapRenderTarget( + &mut self, hdc: ::HDC, width: ::UINT32, height: ::UINT32, + renderTarget: *mut *mut IDWriteBitmapRenderTarget + ) -> ::HRESULT +}} +ENUM!{enum DWRITE_TEXTURE_TYPE { + DWRITE_TEXTURE_ALIASED_1x1 = 0, + DWRITE_TEXTURE_CLEARTYPE_3x1 = 1, +}} +pub const DWRITE_ALPHA_MAX: ::BYTE = 255; +RIDL!{interface IDWriteGlyphRunAnalysis(IDWriteGlyphRunAnalysisVtbl): IUnknown(IUnknownVtbl) { + fn GetAlphaTextureBounds( + &mut self, textureType: DWRITE_TEXTURE_TYPE, textureBounds: *mut ::RECT + ) -> ::HRESULT, + fn CreateAlphaTexture( + &mut self, textureType: DWRITE_TEXTURE_TYPE, textureBounds: *const ::RECT, + alphaValues: *mut ::BYTE, bufferSize: ::UINT32 + ) -> ::HRESULT, + fn GetAlphaBlendParams( + &mut self, renderingParams: *mut IDWriteRenderingParams, blendGamma: *mut ::FLOAT, + blendEnhancedContrast: *mut ::FLOAT, blendClearTypeLevel: *mut ::FLOAT + ) -> ::HRESULT +}} +RIDL!{interface IDWriteFactory(IDWriteFactoryVtbl): IUnknown(IUnknownVtbl) { + fn GetSystemFontCollection( + &mut self, fontCollection: *mut *mut IDWriteFontCollection, checkForUpdates: ::BOOL + ) -> ::HRESULT, + fn CreateCustomFontCollection( + &mut self, collectionLoader: *mut IDWriteFontCollectionLoader, + collectionKey: *const ::c_void, collectionKeySize: ::UINT32, + fontCollection: *mut *mut IDWriteFontCollection + ) -> ::HRESULT, + fn RegisterFontCollectionLoader( + &mut self, fontCollectionLoader: *mut IDWriteFontCollectionLoader + ) -> ::HRESULT, + fn UnregisterFontCollectionLoader( + &mut self, fontCollectionLoader: *mut IDWriteFontCollectionLoader + ) -> ::HRESULT, + fn CreateFontFileReference( + &mut self, filePath: *const ::WCHAR, lastWriteTime: *const ::FILETIME, + fontFile: *mut *mut IDWriteFontFile + ) -> ::HRESULT, + fn CreateCustomFontFileReference( + &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, + fontFileLoader: *mut IDWriteFontFileLoader, fontFile: *mut *mut IDWriteFontFile + ) -> ::HRESULT, + fn CreateFontFace( + &mut self, fontFaceType: DWRITE_FONT_FACE_TYPE, numberOfFiles: ::UINT32, + fontFiles: *const *mut IDWriteFontFile, faceIndex: ::UINT32, + fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS, fontFace: *mut *mut IDWriteFontFace + ) -> ::HRESULT, + fn CreateRenderingParams( + &mut self, renderingParams: *mut *mut IDWriteRenderingParams + ) -> ::HRESULT, + fn CreateMonitorRenderingParams( + &mut self, monitor: ::HMONITOR, renderingParams: *mut *mut IDWriteRenderingParams + ) -> ::HRESULT, + fn CreateCustomRenderingParams( + &mut self, gamma: ::FLOAT, enhancedContrast: ::FLOAT, clearTypeLevel: ::FLOAT, + pixelGeometry: DWRITE_PIXEL_GEOMETRY, renderingMode: DWRITE_RENDERING_MODE, + renderingParams: *mut *mut IDWriteRenderingParams + ) -> ::HRESULT, + fn RegisterFontFileLoader( + &mut self, fontFileLoader: *mut IDWriteFontFileLoader + ) -> ::HRESULT, + fn UnregisterFontFileLoader( + &mut self, fontFileLoader: *mut IDWriteFontFileLoader + ) -> ::HRESULT, + fn CreateTextFormat( + &mut self, fontFamilyName: *const ::WCHAR, fontCollection: *mut IDWriteFontCollection, + fontWeight: DWRITE_FONT_WEIGHT, fontStyle: DWRITE_FONT_STYLE, + fontStretch: DWRITE_FONT_STRETCH, fontSize: ::FLOAT, localeName: *const ::WCHAR, + textFormat: *mut *mut IDWriteTextFormat + ) -> ::HRESULT, + fn CreateTypography(&mut self, typography: *mut *mut IDWriteTypography) -> ::HRESULT, + fn GetGdiInterop(&mut self, gdiInterop: *mut *mut IDWriteGdiInterop) -> ::HRESULT, + fn CreateTextLayout( + &mut self, string: *const ::WCHAR, stringLength: ::UINT32, + textFormat: *mut IDWriteTextFormat, maxWidth: ::FLOAT, maxHeight: ::FLOAT, + textLayout: *mut *mut IDWriteTextLayout + ) -> ::HRESULT, + fn CreateGdiCompatibleTextLayout( + &mut self, string: *const ::WCHAR, stringLength: ::UINT32, + textFormat: *mut IDWriteTextFormat, layoutWidth: ::FLOAT, layoutHeight: ::FLOAT, + pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, useGdiNatrual: ::BOOL, + textLayout: *mut *mut IDWriteTextLayout + ) -> ::HRESULT, + fn CreateEllipsisTrimmingSign( + &mut self, textFormat: *mut IDWriteTextFormat, trimmingSign: *mut *mut IDWriteInlineObject + ) -> ::HRESULT, + fn CreateTextAnalyzer(&mut self, textAnalyzer: *mut *mut IDWriteTextAnalyzer) -> ::HRESULT, + fn CreateNumberSubstitution( + &mut self, substitutionMethod: DWRITE_NUMBER_SUBSTITUTION_METHOD, + localeName: *const ::WCHAR, ignoreUserOverride: ::BOOL, + numberSubstitution: *mut *mut IDWriteNumberSubstitution + ) -> ::HRESULT, + fn CreateGlyphRunAnalysis( + &mut self, glyphRun: *const DWRITE_GLYPH_RUN, pixelsPerDip: ::FLOAT, + transform: *const DWRITE_MATRIX, renderingMode: DWRITE_RENDERING_MODE, + measuringMode: ::DWRITE_MEASURING_MODE, baselineOriginX: ::FLOAT, + baselineOriginY: ::FLOAT, glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis + ) -> ::HRESULT +}} +pub const FACILITY_DWRITE: ::HRESULT = 0x898; +pub const DWRITE_ERR_BASE: ::HRESULT = 0x5000; +#[inline] +pub fn MAKE_DWRITE_HR(severity: ::HRESULT, code: ::HRESULT) -> ::HRESULT { + ::MAKE_HRESULT(severity, FACILITY_DWRITE, DWRITE_ERR_BASE + code) +} +#[inline] +pub fn MAKE_DWRITE_HR_ERR(code: ::HRESULT) -> ::HRESULT { + MAKE_DWRITE_HR(::SEVERITY_ERROR, code) +} diff --git a/third_party/rust/winapi/src/dxgi.rs b/third_party/rust/winapi/src/dxgi.rs new file mode 100644 index 000000000000..c81821504c3a --- /dev/null +++ b/third_party/rust/winapi/src/dxgi.rs @@ -0,0 +1,240 @@ +// Copyright © 2015; Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of dxgi.h +STRUCT!{struct DXGI_FRAME_STATISTICS { + PresentCount: ::UINT, + PresentRefreshCount: ::UINT, + SyncRefreshCount: ::UINT, + SyncQPCTime: ::LARGE_INTEGER, + SyncGPUTime: ::LARGE_INTEGER, +}} +STRUCT!{struct DXGI_MAPPED_RECT { + Pitch: ::INT, + pBits: *mut ::BYTE, +}} +STRUCT!{nodebug struct DXGI_ADAPTER_DESC { + Description: [::WCHAR; 128], + VectorId: ::UINT, + DeviceId: ::UINT, + SubSysId: ::UINT, + Revision: ::UINT, + DedicatedVideoMemory: ::SIZE_T, + DedicatedSystemMemory: ::SIZE_T, + SharedSystemMemory: ::SIZE_T, + AdapterLuid: ::LUID, +}} +STRUCT!{nodebug struct DXGI_OUTPUT_DESC { + DeviceName: [::WCHAR; 32], + DesktopCoordinates: ::RECT, + AttachedToDesktop: ::BOOL, + Rotation: ::DXGI_MODE_ROTATION, + Monitor: ::HMONITOR, +}} +STRUCT!{struct DXGI_SHARED_RESOURCE { + Handle: ::HANDLE, +}} +pub const DXGI_RESOURCE_PRIORITY_MINIMUM: ::DWORD = 0x28000000; +pub const DXGI_RESOURCE_PRIORITY_LOW: ::DWORD = 0x50000000; +pub const DXGI_RESOURCE_PRIORITY_NORMAL: ::DWORD = 0x78000000; +pub const DXGI_RESOURCE_PRIORITY_HIGH: ::DWORD = 0xa0000000; +pub const DXGI_RESOURCE_PRIORITY_MAXIMUM: ::DWORD = 0xc8000000; +ENUM!{enum DXGI_RESIDENCY { + DXGI_RESIDENCY_FULLY_RESIDENT = 1, + DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, + DXGI_RESIDENCY_EVICTED_TO_DISK = 3, +}} +STRUCT!{struct DXGI_SURFACE_DESC { + Width: ::UINT, + Height: ::UINT, + Format: ::DXGI_FORMAT, + SampleDesc: ::DXGI_SAMPLE_DESC, +}} +ENUM!{enum DXGI_SWAP_EFFECT { + DXGI_SWAP_EFFECT_DISCARD = 0, + DXGI_SWAP_EFFECT_SEQUENTIAL = 1, + DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, +}} +FLAGS!{enum DXGI_SWAP_CHAIN_FLAG { + DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, + DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, + DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4, + DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8, + DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16, + DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32, + DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 64, + DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, + DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, + DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, +}} +STRUCT!{struct DXGI_SWAP_CHAIN_DESC { + BufferDesc: ::DXGI_MODE_DESC, + SampleDesc: ::DXGI_SAMPLE_DESC, + BufferUsage: ::DXGI_USAGE, + BufferCount: ::UINT, + OutputWindow: ::HWND, + Windowed: ::BOOL, + SwapEffect: DXGI_SWAP_EFFECT, + Flags: ::UINT, +}} +RIDL!( +interface IDXGIObject(IDXGIObjectVtbl): IUnknown(IUnknownVtbl) { + fn SetPrivateData( + &mut self, Name: ::REFGUID, DataSize: ::UINT, pData: *const ::c_void + ) -> ::HRESULT, + fn SetPrivateDataInterface(&mut self, Name: ::REFGUID, pUnknown: *const ::IUnknown) -> ::HRESULT, + fn GetPrivateData( + &mut self, Name: ::REFGUID, pDataSize: *mut ::UINT, pData: *mut ::c_void + ) -> ::HRESULT, + fn GetParent( + &mut self, riid: ::REFIID, ppParent: *mut *mut ::c_void + ) -> ::HRESULT +}); +RIDL!( +interface IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetDevice(&mut self, riid: ::REFIID, ppDevice: *mut *mut ::c_void) -> ::HRESULT +}); +RIDL!( +interface IDXGIResource(IDXGIResourceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn GetSharedHandle(&mut self, pSharedHandle: *mut ::HANDLE) -> ::HRESULT, + fn GetUsage(&mut self, pUsage: *mut ::DXGI_USAGE) -> ::HRESULT, + fn SetEvictionPriority(&mut self, EvictionPriority: ::UINT) -> ::HRESULT, + fn GetEvictionPriority(&mut self, pEvictionPriority: *mut ::UINT) -> ::HRESULT +}); +RIDL!( +interface IDXGIKeyedMutex(IDXGIKeyedMutexVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn AcquireSync(&mut self, Key: ::UINT64, dwMilliseconds: ::DWORD) -> ::HRESULT, + fn ReleaseSync(&mut self, Key: ::UINT64) -> ::HRESULT +}); +RIDL!( +interface IDXGISurface(IDXGISurfaceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn GetDesc(&mut self, pDesc: *mut DXGI_SURFACE_DESC) -> ::HRESULT, + fn Map(&mut self, pLockedRect: *mut DXGI_MAPPED_RECT, MapFlags: ::UINT) -> ::HRESULT, + fn Unmap(&mut self) -> ::HRESULT +}); +RIDL!( +interface IDXGISurface1(IDXGISurface1Vtbl): IDXGISurface(IDXGISurfaceVtbl) { + fn GetDC(&mut self, Discard: ::BOOL, phdc: *mut ::HDC) -> ::HRESULT, + fn ReleaseDC(&mut self, pDirtyRect: *mut ::RECT) -> ::HRESULT +}); +RIDL!( +interface IDXGIAdapter(IDXGIAdapterVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn EnumOutputs(&mut self, Output: ::UINT, ppOutput: *mut *mut IDXGIOutput) -> ::HRESULT, + fn GetDesc(&mut self, pDesc: *mut DXGI_ADAPTER_DESC) -> ::HRESULT, + fn CheckInterfaceSupport( + &mut self, InterfaceName: ::REFGUID, pUMDVersion: *mut ::LARGE_INTEGER + ) -> ::HRESULT +}); +RIDL!( +interface IDXGIOutput(IDXGIOutputVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetDesc(&mut self, pDesc: *mut DXGI_OUTPUT_DESC) -> ::HRESULT, + fn GetDisplayModeList( + &mut self, EnumFormat: ::DXGI_FORMAT, Flags: ::UINT, pNumModes: *mut ::UINT, + pDesc: *mut ::DXGI_MODE_DESC + ) -> ::HRESULT, + fn FindClosestMatchingMode( + &mut self, pModeToMatch: *const ::DXGI_MODE_DESC, pClosestMatch: *mut ::DXGI_MODE_DESC, + pConcernedDevice: *mut ::IUnknown + ) -> ::HRESULT, + fn WaitForVBlank(&mut self) -> ::HRESULT, + fn TakeOwnership(&mut self, pDevice: *mut ::IUnknown, Exclusive: ::BOOL) -> ::HRESULT, + fn ReleaseOwnership(&mut self) -> (), + fn GetGammaControlCapabilities( + &mut self, pGammaCaps: *mut ::DXGI_GAMMA_CONTROL_CAPABILITIES + ) -> ::HRESULT, + fn SetGammaControl(&mut self, pArray: *const ::DXGI_GAMMA_CONTROL) -> ::HRESULT, + fn GetGammaControl(&mut self, pArray: *mut ::DXGI_GAMMA_CONTROL) -> ::HRESULT, + fn SetDisplaySurface(&mut self, pScanoutSurface: *mut IDXGISurface) -> ::HRESULT, + fn GetDisplaySurfaceData(&mut self, pDestination: *mut IDXGISurface) -> ::HRESULT, + fn GetFrameStatistics(&mut self, pStats: *mut DXGI_FRAME_STATISTICS) -> ::HRESULT +}); +pub const DXGI_MAX_SWAP_CHAIN_BUFFERS: ::DWORD = 16; +pub const DXGI_PRESENT_TEST: ::DWORD = 0x00000001; +pub const DXGI_PRESENT_DO_NOT_SEQUENCE: ::DWORD = 0x00000002; +pub const DXGI_PRESENT_RESTART: ::DWORD = 0x00000004; +pub const DXGI_PRESENT_DO_NOT_WAIT: ::DWORD = 0x00000008; +pub const DXGI_PRESENT_STEREO_PREFER_RIGHT: ::DWORD = 0x00000010; +pub const DXGI_PRESENT_STEREO_TEMPORARY_MONO: ::DWORD = 0x00000020; +pub const DXGI_PRESENT_RESTRICT_TO_OUTPUT: ::DWORD = 0x00000040; +pub const DXGI_PRESENT_USE_DURATION: ::DWORD = 0x00000100; +RIDL!( +interface IDXGISwapChain(IDXGISwapChainVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn Present(&mut self, SyncInterval: ::UINT, Flags: ::UINT) -> ::HRESULT, + fn GetBuffer( + &mut self, Buffer: ::UINT, riid: ::REFIID, ppSurface: *mut *mut ::c_void + ) -> ::HRESULT, + fn SetFullscreenState(&mut self, Fullscreen: ::BOOL, pTarget: *mut IDXGIOutput) -> ::HRESULT, + fn GetFullscreenState( + &mut self, pFullscreen: *mut ::BOOL, ppTarget: *mut *mut IDXGIOutput + ) -> ::HRESULT, + fn GetDesc(&mut self, pDesc: *mut DXGI_SWAP_CHAIN_DESC) -> ::HRESULT, + fn ResizeBuffers( + &mut self, BufferCount: ::UINT, Width: ::UINT, Height: ::UINT, NewFormat: ::DXGI_FORMAT, + SwapChainFlags: ::UINT + ) -> ::HRESULT, + fn ResizeTarget(&mut self, pNewTargetParameters: *const ::DXGI_MODE_DESC) -> ::HRESULT, + fn GetContainingOutput(&mut self, ppOutput: *mut *mut IDXGIOutput) -> ::HRESULT, + fn GetFrameStatistics(&mut self, pStats: *mut DXGI_FRAME_STATISTICS) -> ::HRESULT, + fn GetLastPresentCount(&mut self, pLastPresentCount: *mut ::UINT) -> ::HRESULT +}); +RIDL!( +interface IDXGIFactory(IDXGIFactoryVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn EnumAdapters(&mut self, Adapter: ::UINT, ppAdapter: *mut *mut IDXGIAdapter) -> ::HRESULT, + fn MakeWindowAssociation(&mut self, WindowHandle: ::HWND, Flags: ::UINT) -> ::HRESULT, + fn GetWindowAssociation(&mut self, pWindowHandle: *mut ::HWND) -> ::HRESULT, + fn CreateSwapChain( + &mut self, pDevice: *mut ::IUnknown, pDesc: *mut DXGI_SWAP_CHAIN_DESC, + ppSwapChain: *mut *mut IDXGISwapChain + ) -> ::HRESULT, + fn CreateSoftwareAdapter( + &mut self, Module: ::HMODULE, ppAdapter: *mut *mut IDXGIAdapter + ) -> ::HRESULT +}); +RIDL!( +interface IDXGIDevice(IDXGIDeviceVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetAdapter(&mut self, pAdapter: *mut *mut IDXGIAdapter) -> ::HRESULT, + fn CreateSurface( + &mut self, pDesc: *const DXGI_SURFACE_DESC, NumSurfaces: ::UINT, Usage: ::DXGI_USAGE, + pSharedResource: *const DXGI_SHARED_RESOURCE, ppSurface: *mut *mut IDXGISurface + ) -> ::HRESULT, + fn QueryResourceResidency( + &mut self, ppResources: *const *mut ::IUnknown, pResidencyStatus: *mut DXGI_RESIDENCY, + NumResources: ::UINT + ) -> ::HRESULT, + fn SetGPUThreadPriority(&mut self, Priority: ::INT) -> ::HRESULT, + fn GetGPUThreadPriority(&mut self, pPriority: *mut ::INT) -> ::HRESULT +}); +ENUM!{enum DXGI_ADAPTER_FLAG { + DXGI_ADAPTER_FLAG_NONE, + DXGI_ADAPTER_FLAG_REMOTE, + DXGI_ADAPTER_FLAG_SOFTWARE, +}} +STRUCT!{nodebug struct DXGI_ADAPTER_DESC1 { + Description: [::WCHAR; 128], + VendorId: ::UINT, + DeviceId: ::UINT, + SubSysId: ::UINT, + Revision: ::UINT, + DedicatedVideoMemory: ::SIZE_T, + DedicatedSystemMemory: ::SIZE_T, + SharedSystemMemory: ::SIZE_T, + AdapterLuid: ::LUID, + Flags: ::UINT, +}} +STRUCT!{struct DXGI_DISPLAY_COLOR_SPACE { + PrimaryCoordinates: [[::FLOAT; 2]; 8], + WhitePoints: [[::FLOAT; 2]; 16], +}} +RIDL!( +interface IDXGIFactory1(IDXGIFactory1Vtbl): IDXGIFactory(IDXGIFactoryVtbl) { + fn EnumAdapters1(&mut self, Adapter: ::UINT, ppAdapter: *mut *mut IDXGIAdapter1) -> ::HRESULT, + fn IsCurrent(&mut self) -> ::BOOL +}); +RIDL!( +interface IDXGIAdapter1(IDXGIAdapter1Vtbl): IDXGIAdapter(IDXGIAdapterVtbl) { + fn GetDesc1(&mut self, pDesc: *mut DXGI_ADAPTER_DESC1) -> ::HRESULT +}); +RIDL!( +interface IDXGIDevice1(IDXGIDevice1Vtbl): IDXGIDevice(IDXGIDeviceVtbl) { + fn SetMaximumFrameLatency(&mut self, MaxLatency: ::UINT) -> ::HRESULT, + fn GetMaximumFrameLatency(&mut self, pMaxLatency: *mut ::UINT) -> ::HRESULT +}); diff --git a/third_party/rust/winapi/src/dxgi1_2.rs b/third_party/rust/winapi/src/dxgi1_2.rs new file mode 100644 index 000000000000..42082747c2b1 --- /dev/null +++ b/third_party/rust/winapi/src/dxgi1_2.rs @@ -0,0 +1,288 @@ +// Copyright © 2015; Dmitry Roschin +// Licensed under the MIT License +//! Mappings for the contents of dxgi1_2.h + +ENUM!{ enum DXGI_ALPHA_MODE { + DXGI_ALPHA_MODE_UNSPECIFIED = 0, + DXGI_ALPHA_MODE_PREMULTIPLIED = 1, + DXGI_ALPHA_MODE_STRAIGHT = 2, + DXGI_ALPHA_MODE_IGNORE = 3, + DXGI_ALPHA_MODE_FORCE_DWORD = 0xFFFFFFFF, +}} + +ENUM!{ enum DXGI_COMPUTE_PREEMPTION_GRANULARITY { + DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, + DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY = 1, + DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY = 2, + DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY = 3, + DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY = 4, +}} + +ENUM!{ enum DXGI_GRAPHICS_PREEMPTION_GRANULARITY { + DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, + DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY = 1, + DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY = 2, + DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY = 3, + DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY = 4, +}} + +ENUM!{ enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE { + DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME = 1, + DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR = 2, + DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR = 4, +}} + +ENUM!{ enum DXGI_SCALING { + DXGI_SCALING_STRETCH = 0, + DXGI_SCALING_NONE = 1, + DXGI_SCALING_ASPECT_RATIO_STRETCH = 2, +}} + +ENUM!{ enum _DXGI_OFFER_RESOURCE_PRIORITY { + DXGI_OFFER_RESOURCE_PRIORITY_LOW = 1, + DXGI_OFFER_RESOURCE_PRIORITY_NORMAL = 2, + DXGI_OFFER_RESOURCE_PRIORITY_HIGH = 3, +}} + +STRUCT!{nodebug struct DXGI_ADAPTER_DESC2 { + Description: [::WCHAR; 128], + VendorId: ::UINT, + DeviceId: ::UINT, + SubSysId: ::UINT, + Revision: ::UINT, + DedicatedVideoMemory: ::SIZE_T, + DedicatedSystemMemory: ::SIZE_T, + SharedSystemMemory: ::SIZE_T, + AdapterLuid: ::LUID, + Flags: ::UINT, + GraphicsPreemptionGranularity: ::DXGI_GRAPHICS_PREEMPTION_GRANULARITY, + ComputePreemptionGranularity: ::DXGI_COMPUTE_PREEMPTION_GRANULARITY, +}} + +STRUCT!{struct DXGI_MODE_DESC1 { + Width: ::UINT, + Height: ::UINT, + RefreshRate: ::DXGI_RATIONAL, + Format: ::DXGI_FORMAT, + ScanlineOrdering: ::DXGI_MODE_SCANLINE_ORDER, + Scaling: ::DXGI_MODE_SCALING, + Stereo: ::BOOL, +}} + +STRUCT!{struct DXGI_OUTDUPL_DESC { + ModeDesc: ::DXGI_MODE_DESC, + Rotation: ::DXGI_MODE_ROTATION, + DesktopImageInSystemMemory: ::BOOL, +}} + +STRUCT!{struct DXGI_OUTDUPL_FRAME_INFO { + LastPresentTime: ::LARGE_INTEGER, + LastMouseUpdateTime: ::LARGE_INTEGER, + AccumulatedFrames: ::UINT, + RectsCoalesced: ::BOOL, + ProtectedContentMaskedOut: ::BOOL, + PointerPosition: ::DXGI_OUTDUPL_POINTER_POSITION, + TotalMetadataBufferSize: ::UINT, + PointerShapeBufferSize: ::UINT, +}} + +STRUCT!{struct DXGI_OUTDUPL_MOVE_RECT { + SourcePoint: ::POINT, + DestinationRect: ::RECT, +}} + +STRUCT!{struct DXGI_OUTDUPL_POINTER_POSITION { + Position: ::POINT, + Visible: ::BOOL, +}} + +STRUCT!{struct DXGI_OUTDUPL_POINTER_SHAPE_INFO { + Type: ::UINT, + Width: ::UINT, + Height: ::UINT, + Pitch: ::UINT, + HotSpot: ::POINT, +}} + +STRUCT!{struct DXGI_PRESENT_PARAMETERS { + DirtyRectsCount: ::UINT, + pDirtyRects: *mut ::RECT, + pScrollRect: *mut ::RECT, + pScrollOffset: *mut ::POINT, +}} + +STRUCT!{struct DXGI_SWAP_CHAIN_DESC1 { + Width: ::UINT, + Height: ::UINT, + Format: ::DXGI_FORMAT, + Stereo: ::BOOL, + SampleDesc: ::DXGI_SAMPLE_DESC, + BufferUsage: ::DXGI_USAGE, + BufferCount: ::UINT, + Scaling: ::DXGI_SCALING, + SwapEffect: ::DXGI_SWAP_EFFECT, + AlphaMode: ::DXGI_ALPHA_MODE, + Flags: ::UINT, +}} + +STRUCT!{struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC { + RefreshRate: ::DXGI_RATIONAL, + ScanlineOrdering: ::DXGI_MODE_SCANLINE_ORDER, + Scaling: ::DXGI_MODE_SCALING, + Windowed: ::BOOL, +}} + +RIDL!( +interface IDXGIAdapter2(IDXGIAdapter2Vtbl): IDXGIAdapter1(IDXGIAdapter1Vtbl) { + fn GetDesc2(&mut self, pDesc: *mut ::DXGI_ADAPTER_DESC2) -> ::HRESULT +}); + +RIDL!( +interface IDXGIDevice2(IDXGIDevice2Vtbl): IDXGIDevice1(IDXGIDevice1Vtbl) { + fn OfferResources( + &mut self, NumResources: ::UINT, ppResources: *mut *mut ::IDXGIResource, + Priority: ::DXGI_OFFER_RESOURCE_PRIORITY + ) -> ::HRESULT, + fn ReclaimResources( + &mut self, NumResources: ::UINT, ppResources: *mut *mut ::IDXGIResource, + pDiscarded: *mut ::BOOL + ) -> ::HRESULT, + fn EnqueueSetEvent(&mut self, hEvent: ::HANDLE) -> ::HRESULT +}); + +RIDL!( +interface IDXGIDisplayControl(IDXGIDisplayControlVtbl): IUnknown(IUnknownVtbl) { + fn IsStereoEnabled(&mut self) -> ::BOOL, + fn SetStereoEnabled(&mut self, enabled: ::BOOL) -> () +}); + +RIDL!( +interface IDXGIFactory2(IDXGIFactory2Vtbl): IDXGIFactory1(IDXGIFactory1Vtbl) { + fn IsWindowedStereoEnabled(&mut self) -> ::BOOL, + fn CreateSwapChainForHwnd( + &mut self, pDevice: *mut ::IUnknown, hWnd: ::HWND, pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, + pFullscreenDesc: *const ::DXGI_SWAP_CHAIN_FULLSCREEN_DESC, + pRestrictToOutput: *mut ::IDXGIOutput, ppSwapChain: *mut *mut ::IDXGISwapChain1 + ) -> ::HRESULT, + fn CreateSwapChainForCoreWindow( + &mut self, pDevice: *mut ::IUnknown, pWindow: *mut ::IUnknown, + pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, pRestrictToOutput: *mut ::IDXGIOutput, + ppSwapChain: *mut *mut ::IDXGISwapChain1 + ) -> ::HRESULT, + fn GetSharedResourceAdapterLuid( + &mut self, hResource: ::HANDLE, pLuid: *mut ::LUID + ) -> ::HRESULT, + fn RegisterStereoStatusWindow( + &mut self, WindowHandle: ::HWND, wMsg: ::UINT, pdwCookie: *mut ::DWORD + ) -> ::HRESULT, + fn RegisterStereoStatusEvent( + &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD + ) -> ::HRESULT, + fn UnregisterStereoStatus(&mut self, dwCookie: ::DWORD) -> (), + fn RegisterOcclusionStatusWindow( + &mut self, WindowHandle: ::HWND, wMsg: ::UINT, pdwCookie: *mut ::DWORD + ) -> ::HRESULT, + fn RegisterOcclusionStatusEvent( + &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD + ) -> ::HRESULT, + fn UnregisterOcclusionStatus(&mut self, dwCookie: ::DWORD) -> (), + fn CreateSwapChainForComposition( + &mut self, pDevice: *mut ::IUnknown, pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, + pRestrictToOutput: *mut ::IDXGIOutput, ppSwapChain: *mut *mut ::IDXGISwapChain1 + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGIOutput1(IDXGIOutput1Vtbl): IDXGIOutput(IDXGIOutputVtbl) { + fn GetDisplayModeList1( + &mut self, EnumFormat: ::DXGI_FORMAT, Flags: ::UINT, pNumModes: *mut ::UINT, + pDesc: *mut ::DXGI_MODE_DESC1 + ) -> ::HRESULT, + fn FindClosestMatchingMode1( + &mut self, pModeToMatch: *const ::DXGI_MODE_DESC1, pClosestMatch: *mut ::DXGI_MODE_DESC1, + pConcernedDevice: *mut ::IUnknown + ) -> ::HRESULT, + fn GetDisplaySurfaceData1( + &mut self, pDestination: *mut ::IDXGIResource + ) -> ::HRESULT, + fn DuplicateOutput( + &mut self, pDevice: *mut ::IUnknown, + ppOutputDuplication: *mut *mut ::IDXGIOutputDuplication + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGIOutputDuplication(IDXGIOutputDuplicationVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetDesc(&mut self, pDesc: *mut ::DXGI_OUTDUPL_DESC) -> (), + fn AcquireNextFrame( + &mut self, TimeoutInMilliseconds: ::UINT, pFrameInfo: *mut ::DXGI_OUTDUPL_FRAME_INFO, + ppDesktopResource: *mut *mut ::IDXGIResource + ) -> ::HRESULT, + fn GetFrameDirtyRects( + &mut self, DirtyRectsBufferSize: ::UINT, pDirtyRectsBuffer: *mut ::RECT, + pDirtyRectsBufferSizeRequired: *mut ::UINT + ) -> ::HRESULT, + fn GetFrameMoveRects( + &mut self, MoveRectsBufferSize: ::UINT, pMoveRectBuffer: *mut ::DXGI_OUTDUPL_MOVE_RECT, + pMoveRectsBufferSizeRequired: *mut ::UINT + ) -> ::HRESULT, + fn GetFramePointerShape( + &mut self, PointerShapeBufferSize: ::UINT, pPointerShapeBuffer: *mut ::c_void, + pPointerShapeBufferSizeRequired: *mut ::UINT, + pPointerShapeInfo: *mut ::DXGI_OUTDUPL_POINTER_SHAPE_INFO + ) -> ::HRESULT, + fn MapDesktopSurface( + &mut self, pLockedRect: *mut ::DXGI_MAPPED_RECT + ) -> ::HRESULT, + fn UnMapDesktopSurface(&mut self) -> ::HRESULT, + fn ReleaseFrame(&mut self) -> ::HRESULT +}); + +RIDL!( +interface IDXGIResource1(IDXGIResource1Vtbl): IDXGIResource(IDXGIResourceVtbl) { + fn CreateSubresourceSurface( + &mut self, index: ::UINT, ppSurface: *mut *mut ::IDXGISurface2 + ) -> ::HRESULT, + fn CreateSharedHandle( + &mut self, pAttributes: *const ::SECURITY_ATTRIBUTES, dwAccess: ::DWORD, lpName: ::LPCWSTR, + pHandle: *mut ::HANDLE + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGISurface2(IDXGISurface2Vtbl): IDXGISurface1(IDXGISurface1Vtbl) { + fn GetResource( + &mut self, riid: ::REFGUID, ppParentResource: *mut *mut ::c_void, + pSubresourceIndex: *mut ::UINT + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGISwapChain1(IDXGISwapChain1Vtbl): IDXGISwapChain(IDXGISwapChainVtbl) { + fn GetDesc1(&mut self, pDesc: *mut ::DXGI_SWAP_CHAIN_DESC1) -> ::HRESULT, + fn GetFullscreenDesc( + &mut self, pDesc: *mut ::DXGI_SWAP_CHAIN_FULLSCREEN_DESC + ) -> ::HRESULT, + fn GetHwnd(&mut self, pHwnd: *mut ::HWND) -> ::HRESULT, + fn GetCoreWindow( + &mut self, refiid: ::REFGUID, ppUnk: *mut *mut ::c_void + ) -> ::HRESULT, + fn Present1( + &mut self, SyncInterval: ::UINT, PresentFlags: ::UINT, + pPresentParameters: *const ::DXGI_PRESENT_PARAMETERS + ) -> ::HRESULT, + fn IsTemporaryMonoSupported(&mut self) -> ::BOOL, + fn GetRestrictToOutput( + &mut self, ppRestrictToOutput: *mut *mut ::IDXGIOutput + ) -> ::HRESULT, + fn SetBackgroundColor(&mut self, pColor: *const ::DXGI_RGBA) -> ::HRESULT, + fn GetBackgroundColor(&mut self, pColor: *mut ::DXGI_RGBA) -> ::HRESULT, + fn SetRotation(&mut self, Rotation: ::DXGI_MODE_ROTATION) -> ::HRESULT, + fn GetRotation(&mut self, pRotation: *mut ::DXGI_MODE_ROTATION) -> ::HRESULT +}); + +pub type DXGI_OFFER_RESOURCE_PRIORITY = ::_DXGI_OFFER_RESOURCE_PRIORITY; +pub const DXGI_ENUM_MODES_DISABLED_STEREO: ::UINT = 8; +pub const DXGI_ENUM_MODES_STEREO: ::UINT = 4; +pub const DXGI_SHARED_RESOURCE_READ: ::UINT = 0x80000000; +pub const DXGI_SHARED_RESOURCE_WRITE: ::UINT = 1; diff --git a/third_party/rust/winapi/src/dxgi1_3.rs b/third_party/rust/winapi/src/dxgi1_3.rs new file mode 100644 index 000000000000..71acf98c7cf0 --- /dev/null +++ b/third_party/rust/winapi/src/dxgi1_3.rs @@ -0,0 +1,131 @@ +// Copyright © 2015; Dmitry Roschin +// Licensed under the MIT License +//! Mappings for the contents of dxgi1_3.h + +ENUM!{ enum DXGI_FRAME_PRESENTATION_MODE { + DXGI_FRAME_PRESENTATION_MODE_COMPOSED = 0, + DXGI_FRAME_PRESENTATION_MODE_OVERLAY = 1, + DXGI_FRAME_PRESENTATION_MODE_NONE = 2, + DXGI_FRAME_PRESENTATION_MODE_COMPOSITION_FAILURE = 3, +}} + +FLAGS!{ enum DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS { + DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1, + DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2, + DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4, +}} + +FLAGS!{ enum DXGI_OVERLAY_SUPPORT_FLAG { + DXGI_OVERLAY_SUPPORT_FLAG_DIRECT = 0x1, + DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2, +}} + +STRUCT!{struct DXGI_DECODE_SWAP_CHAIN_DESC { + Flags: ::UINT, +}} + +STRUCT!{struct DXGI_FRAME_STATISTICS_MEDIA { + PresentCount: ::UINT, + PresentRefreshCount: ::UINT, + SyncRefreshCount: ::UINT, + SyncQPCTime: ::LARGE_INTEGER, + SyncGPUTime: ::LARGE_INTEGER, + CompositionMode: ::DXGI_FRAME_PRESENTATION_MODE, + ApprovedPresentDuration: ::UINT, +}} + +STRUCT!{struct DXGI_MATRIX_3X2_F { + _11: ::FLOAT, + _12: ::FLOAT, + _21: ::FLOAT, + _22: ::FLOAT, + _31: ::FLOAT, + _32: ::FLOAT, +}} + +RIDL!( +interface IDXGIDecodeSwapChain(IDXGIDecodeSwapChainVtbl): IUnknown(IUnknownVtbl) { + fn PresentBuffer( + &mut self, BufferToPresent: ::UINT, SyncInterval: ::UINT, Flags: ::UINT + ) -> ::HRESULT, + fn SetSourceRect(&mut self, pRect: *const ::RECT) -> ::HRESULT, + fn SetTargetRect(&mut self, pRect: *const ::RECT) -> ::HRESULT, + fn SetDestSize(&mut self, Width: ::UINT, Height: ::UINT) -> ::HRESULT, + fn GetSourceRect(&mut self, pRect: *mut ::RECT) -> ::HRESULT, + fn GetTargetRect(&mut self, pRect: *mut ::RECT) -> ::HRESULT, + fn GetDestSize( + &mut self, pWidth: *mut ::UINT, pHeight: *mut ::UINT + ) -> ::HRESULT, + fn SetColorSpace( + &mut self, ColorSpace: ::DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS + ) -> ::HRESULT, + fn GetColorSpace(&mut self) -> ::DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS +}); + +RIDL!( +interface IDXGIDevice3(IDXGIDevice3Vtbl): IDXGIDevice2(IDXGIDevice2Vtbl) { + fn Trim(&mut self) -> () +}); + +RIDL!( +interface IDXGIFactory3(IDXGIFactory3Vtbl): IDXGIFactory2(IDXGIFactory2Vtbl) { + fn GetCreationFlags(&mut self) -> ::UINT +}); + +RIDL!( +interface IDXGIFactoryMedia(IDXGIFactoryMediaVtbl): IUnknown(IUnknownVtbl) { + fn CreateSwapChainForCompositionSurfaceHandle( + &mut self, pDevice: *mut ::IUnknown, hSurface: ::HANDLE, + pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, pRestrictToOutput: *mut ::IDXGIOutput, + ppSwapChain: *mut *mut ::IDXGISwapChain1 + ) -> ::HRESULT, + fn CreateDecodeSwapChainForCompositionSurfaceHandle( + &mut self, pDevice: *mut ::IUnknown, hSurface: ::HANDLE, + pDesc: *mut ::DXGI_DECODE_SWAP_CHAIN_DESC, pYuvDecodeBuffers: *mut ::IDXGIResource, + pRestrictToOutput: *mut ::IDXGIOutput, ppSwapChain: *mut *mut ::IDXGIDecodeSwapChain + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGIOutput2(IDXGIOutput2Vtbl): IDXGIOutput1(IDXGIOutput1Vtbl) { + fn SupportsOverlays(&mut self) -> ::BOOL +}); + +RIDL!( +interface IDXGIOutput3(IDXGIOutput3Vtbl): IDXGIOutput2(IDXGIOutput2Vtbl) { + fn CheckOverlaySupport( + &mut self, EnumFormat: ::DXGI_FORMAT, pConcernedDevice: *mut ::IUnknown, + pFlags: *mut ::UINT + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGISwapChain2(IDXGISwapChain2Vtbl): IDXGISwapChain1(IDXGISwapChain1Vtbl) { + fn SetSourceSize(&mut self, Width: ::UINT, Height: ::UINT) -> ::HRESULT, + fn GetSourceSize( + &mut self, pWidth: *mut ::UINT, pHeight: *mut ::UINT + ) -> ::HRESULT, + fn SetMaximumFrameLatency(&mut self, MaxLatency: ::UINT) -> ::HRESULT, + fn GetMaximumFrameLatency(&mut self, pMaxLatency: *mut ::UINT) -> ::HRESULT, + fn GetFrameLatencyWaitableObject(&mut self) -> ::HANDLE, + fn SetMatrixTransform( + &mut self, pMatrix: *const ::DXGI_MATRIX_3X2_F + ) -> ::HRESULT, + fn GetMatrixTransform( + &mut self, pMatrix: *mut ::DXGI_MATRIX_3X2_F + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGISwapChainMedia(IDXGISwapChainMediaVtbl): IUnknown(IUnknownVtbl) { + fn GetFrameStatisticsMedia( + &mut self, pStats: *mut ::DXGI_FRAME_STATISTICS_MEDIA + ) -> ::HRESULT, + fn SetPresentDuration(&mut self, Duration: ::UINT) -> ::HRESULT, + fn CheckPresentDurationSupport( + &mut self, DesiredPresentDuration: ::UINT, pClosestSmallerPresentDuration: *mut ::UINT, + pClosestLargerPresentDuration: *mut ::UINT + ) -> ::HRESULT +}); + +pub const DXGI_CREATE_FACTORY_DEBUG: ::UINT = 0x1; diff --git a/third_party/rust/winapi/src/dxgi1_4.rs b/third_party/rust/winapi/src/dxgi1_4.rs new file mode 100644 index 000000000000..cbca18f1868a --- /dev/null +++ b/third_party/rust/winapi/src/dxgi1_4.rs @@ -0,0 +1,82 @@ +// Copyright © 2015; Dmitry Roschin +// Licensed under the MIT License +//! Mappings for the contents of dxgi1_4.h + +ENUM!{ enum DXGI_MEMORY_SEGMENT_GROUP { + DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0, + DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1, +}} + +FLAGS!{ enum DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG { + DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, +}} + +FLAGS!{ enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG { + DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, + DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x2, +}} + +STRUCT!{struct DXGI_QUERY_VIDEO_MEMORY_INFO { + Budget: ::UINT64, + CurrentUsage: ::UINT64, + AvailableForReservation: ::UINT64, + CurrentReservation: ::UINT64, +}} + +RIDL!( +interface IDXGIAdapter3(IDXGIAdapter3Vtbl): IDXGIAdapter2(IDXGIAdapter2Vtbl) { + fn RegisterHardwareContentProtectionTeardownStatusEvent( + &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD + ) -> ::HRESULT, + fn UnregisterHardwareContentProtectionTeardownStatus( + &mut self, dwCookie: ::DWORD + ) -> (), + fn QueryVideoMemoryInfo( + &mut self, NodeIndex: ::UINT, MemorySegmentGroup: ::DXGI_MEMORY_SEGMENT_GROUP, + pVideoMemoryInfo: *mut ::DXGI_QUERY_VIDEO_MEMORY_INFO + ) -> ::HRESULT, + fn SetVideoMemoryReservation( + &mut self, NodeIndex: ::UINT, MemorySegmentGroup: ::DXGI_MEMORY_SEGMENT_GROUP, + Reservation: ::UINT64 + ) -> ::HRESULT, + fn RegisterVideoMemoryBudgetChangeNotificationEvent( + &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD + ) -> ::HRESULT, + fn UnregisterVideoMemoryBudgetChangeNotification( + &mut self, dwCookie: ::DWORD + ) -> () +}); + +RIDL!( +interface IDXGIFactory4(IDXGIFactory4Vtbl): IDXGIFactory3(IDXGIFactory3Vtbl) { + fn EnumAdapterByLuid( + &mut self, AdapterLuid: ::LUID, riid: ::REFGUID, ppvAdapter: *mut *mut ::c_void + ) -> ::HRESULT, + fn EnumWarpAdapter( + &mut self, riid: ::REFGUID, ppvAdapter: *mut *mut ::c_void + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGIOutput4(IDXGIOutput4Vtbl): IDXGIOutput3(IDXGIOutput3Vtbl) { + fn CheckOverlayColorSpaceSupport( + &mut self, Format: ::DXGI_FORMAT, ColorSpace: ::DXGI_COLOR_SPACE_TYPE, + pConcernedDevice: *mut ::IUnknown, pFlags: *mut ::UINT + ) -> ::HRESULT +}); + +RIDL!( +interface IDXGISwapChain3(IDXGISwapChain3Vtbl): IDXGISwapChain2(IDXGISwapChain2Vtbl) { + fn GetCurrentBackBufferIndex(&mut self) -> ::UINT, + fn CheckColorSpaceSupport( + &mut self, ColorSpace: ::DXGI_COLOR_SPACE_TYPE, pColorSpaceSupport: *mut ::UINT + ) -> ::HRESULT, + fn SetColorSpace1( + &mut self, ColorSpace: ::DXGI_COLOR_SPACE_TYPE + ) -> ::HRESULT, + fn ResizeBuffers1( + &mut self, BufferCount: ::UINT, Width: ::UINT, Height: ::UINT, Format: ::DXGI_FORMAT, + SwapChainFlags: ::UINT, pCreationNodeMask: *const ::UINT, + ppPresentQueue: *mut *mut ::IUnknown + ) -> ::HRESULT +}); diff --git a/third_party/rust/winapi/src/dxgiformat.rs b/third_party/rust/winapi/src/dxgiformat.rs new file mode 100644 index 000000000000..3e46fc2edae8 --- /dev/null +++ b/third_party/rust/winapi/src/dxgiformat.rs @@ -0,0 +1,124 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of dxgiformat.h +ENUM!{enum DXGI_FORMAT { + DXGI_FORMAT_UNKNOWN = 0, + DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, + DXGI_FORMAT_R32G32B32A32_FLOAT = 2, + DXGI_FORMAT_R32G32B32A32_UINT = 3, + DXGI_FORMAT_R32G32B32A32_SINT = 4, + DXGI_FORMAT_R32G32B32_TYPELESS = 5, + DXGI_FORMAT_R32G32B32_FLOAT = 6, + DXGI_FORMAT_R32G32B32_UINT = 7, + DXGI_FORMAT_R32G32B32_SINT = 8, + DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, + DXGI_FORMAT_R16G16B16A16_FLOAT = 10, + DXGI_FORMAT_R16G16B16A16_UNORM = 11, + DXGI_FORMAT_R16G16B16A16_UINT = 12, + DXGI_FORMAT_R16G16B16A16_SNORM = 13, + DXGI_FORMAT_R16G16B16A16_SINT = 14, + DXGI_FORMAT_R32G32_TYPELESS = 15, + DXGI_FORMAT_R32G32_FLOAT = 16, + DXGI_FORMAT_R32G32_UINT = 17, + DXGI_FORMAT_R32G32_SINT = 18, + DXGI_FORMAT_R32G8X24_TYPELESS = 19, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, + DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, + DXGI_FORMAT_R10G10B10A2_UNORM = 24, + DXGI_FORMAT_R10G10B10A2_UINT = 25, + DXGI_FORMAT_R11G11B10_FLOAT = 26, + DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, + DXGI_FORMAT_R8G8B8A8_UNORM = 28, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, + DXGI_FORMAT_R8G8B8A8_UINT = 30, + DXGI_FORMAT_R8G8B8A8_SNORM = 31, + DXGI_FORMAT_R8G8B8A8_SINT = 32, + DXGI_FORMAT_R16G16_TYPELESS = 33, + DXGI_FORMAT_R16G16_FLOAT = 34, + DXGI_FORMAT_R16G16_UNORM = 35, + DXGI_FORMAT_R16G16_UINT = 36, + DXGI_FORMAT_R16G16_SNORM = 37, + DXGI_FORMAT_R16G16_SINT = 38, + DXGI_FORMAT_R32_TYPELESS = 39, + DXGI_FORMAT_D32_FLOAT = 40, + DXGI_FORMAT_R32_FLOAT = 41, + DXGI_FORMAT_R32_UINT = 42, + DXGI_FORMAT_R32_SINT = 43, + DXGI_FORMAT_R24G8_TYPELESS = 44, + DXGI_FORMAT_D24_UNORM_S8_UINT = 45, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, + DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, + DXGI_FORMAT_R8G8_TYPELESS = 48, + DXGI_FORMAT_R8G8_UNORM = 49, + DXGI_FORMAT_R8G8_UINT = 50, + DXGI_FORMAT_R8G8_SNORM = 51, + DXGI_FORMAT_R8G8_SINT = 52, + DXGI_FORMAT_R16_TYPELESS = 53, + DXGI_FORMAT_R16_FLOAT = 54, + DXGI_FORMAT_D16_UNORM = 55, + DXGI_FORMAT_R16_UNORM = 56, + DXGI_FORMAT_R16_UINT = 57, + DXGI_FORMAT_R16_SNORM = 58, + DXGI_FORMAT_R16_SINT = 59, + DXGI_FORMAT_R8_TYPELESS = 60, + DXGI_FORMAT_R8_UNORM = 61, + DXGI_FORMAT_R8_UINT = 62, + DXGI_FORMAT_R8_SNORM = 63, + DXGI_FORMAT_R8_SINT = 64, + DXGI_FORMAT_A8_UNORM = 65, + DXGI_FORMAT_R1_UNORM = 66, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, + DXGI_FORMAT_R8G8_B8G8_UNORM = 68, + DXGI_FORMAT_G8R8_G8B8_UNORM = 69, + DXGI_FORMAT_BC1_TYPELESS = 70, + DXGI_FORMAT_BC1_UNORM = 71, + DXGI_FORMAT_BC1_UNORM_SRGB = 72, + DXGI_FORMAT_BC2_TYPELESS = 73, + DXGI_FORMAT_BC2_UNORM = 74, + DXGI_FORMAT_BC2_UNORM_SRGB = 75, + DXGI_FORMAT_BC3_TYPELESS = 76, + DXGI_FORMAT_BC3_UNORM = 77, + DXGI_FORMAT_BC3_UNORM_SRGB = 78, + DXGI_FORMAT_BC4_TYPELESS = 79, + DXGI_FORMAT_BC4_UNORM = 80, + DXGI_FORMAT_BC4_SNORM = 81, + DXGI_FORMAT_BC5_TYPELESS = 82, + DXGI_FORMAT_BC5_UNORM = 83, + DXGI_FORMAT_BC5_SNORM = 84, + DXGI_FORMAT_B5G6R5_UNORM = 85, + DXGI_FORMAT_B5G5R5A1_UNORM = 86, + DXGI_FORMAT_B8G8R8A8_UNORM = 87, + DXGI_FORMAT_B8G8R8X8_UNORM = 88, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, + DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, + DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, + DXGI_FORMAT_BC6H_TYPELESS = 94, + DXGI_FORMAT_BC6H_UF16 = 95, + DXGI_FORMAT_BC6H_SF16 = 96, + DXGI_FORMAT_BC7_TYPELESS = 97, + DXGI_FORMAT_BC7_UNORM = 98, + DXGI_FORMAT_BC7_UNORM_SRGB = 99, + DXGI_FORMAT_AYUV = 100, + DXGI_FORMAT_Y410 = 101, + DXGI_FORMAT_Y416 = 102, + DXGI_FORMAT_NV12 = 103, + DXGI_FORMAT_P010 = 104, + DXGI_FORMAT_P016 = 105, + DXGI_FORMAT_420_OPAQUE = 106, + DXGI_FORMAT_YUY2 = 107, + DXGI_FORMAT_Y210 = 108, + DXGI_FORMAT_Y216 = 109, + DXGI_FORMAT_NV11 = 110, + DXGI_FORMAT_AI44 = 111, + DXGI_FORMAT_IA44 = 112, + DXGI_FORMAT_P8 = 113, + DXGI_FORMAT_A8P8 = 114, + DXGI_FORMAT_B4G4R4A4_UNORM = 115, + DXGI_FORMAT_P208 = 130, + DXGI_FORMAT_V208 = 131, + DXGI_FORMAT_V408 = 132, +}} diff --git a/third_party/rust/winapi/src/dxgitype.rs b/third_party/rust/winapi/src/dxgitype.rs new file mode 100644 index 000000000000..6c9a2f5a7138 --- /dev/null +++ b/third_party/rust/winapi/src/dxgitype.rs @@ -0,0 +1,86 @@ +// Copyright © 2015; Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of dxgitype.h +pub const DXGI_CPU_ACCESS_NONE: ::DWORD = 0; +pub const DXGI_CPU_ACCESS_DYNAMIC: ::DWORD = 1; +pub const DXGI_CPU_ACCESS_READ_WRITE: ::DWORD = 2; +pub const DXGI_CPU_ACCESS_SCRATCH: ::DWORD = 3; +pub const DXGI_CPU_ACCESS_FIELD: ::DWORD = 15; +FLAGS!{enum DXGI_USAGE { + DXGI_USAGE_SHADER_INPUT = 1 << (0 + 4), + DXGI_USAGE_RENDER_TARGET_OUTPUT = 1 << (1 + 4), + DXGI_USAGE_BACK_BUFFER = 1 << (2 + 4), + DXGI_USAGE_SHARED = 1 << (3 + 4), + DXGI_USAGE_READ_ONLY = 1 << (4 + 4), + DXGI_USAGE_DISCARD_ON_PRESENT = 1 << (5 + 4), + DXGI_USAGE_UNORDERED_ACCESS = 1 << (6 + 4), +}} +STRUCT!{struct DXGI_RGB { + Red: f32, + Green: f32, + Blue: f32, +}} +pub type DXGI_RGBA = ::D3DCOLORVALUE; +STRUCT!{nodebug struct DXGI_GAMMA_CONTROL { + Scale: DXGI_RGB, + Offset: DXGI_RGB, + GammaCurve: [DXGI_RGB; 1025], +}} +STRUCT!{nodebug struct DXGI_GAMMA_CONTROL_CAPABILITIES { + ScaleAndOffsetSupported: ::BOOL, + MaxConvertedValue: f32, + MinConvertedValue: f32, + NumGammaControlPoints: ::UINT, + ControlPointPositions: [f32; 1025], +}} +STRUCT!{struct DXGI_RATIONAL { + Numerator: ::UINT, + Denominator: ::UINT, +}} +ENUM!{enum DXGI_MODE_SCANLINE_ORDER { + DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED, + DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE, + DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST, + DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST, +}} +ENUM!{enum DXGI_MODE_SCALING { + DXGI_MODE_SCALING_UNSPECIFIED, + DXGI_MODE_SCALING_CENTERED, + DXGI_MODE_SCALING_STRETCHED, +}} +ENUM!{enum DXGI_MODE_ROTATION { + DXGI_MODE_ROTATION_UNSPECIFIED, + DXGI_MODE_ROTATION_IDENTITY, + DXGI_MODE_ROTATION_ROTATE90, + DXGI_MODE_ROTATION_ROTATE180, + DXGI_MODE_ROTATION_ROTATE270, +}} +STRUCT!{struct DXGI_MODE_DESC { + Width: ::UINT, + Height: ::UINT, + RefreshRate: DXGI_RATIONAL, + Format: ::DXGI_FORMAT, + ScanlineOrdering: DXGI_MODE_SCANLINE_ORDER, + Scaling: DXGI_MODE_SCALING, +}} +STRUCT!{struct DXGI_SAMPLE_DESC { + Count: ::UINT, + Quality: ::UINT, +}} +ENUM!{enum DXGI_COLOR_SPACE_TYPE { + DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0x0, + DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 0x1, + DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 0x2, + DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 0x3, + DXGI_COLOR_SPACE_RESERVED = 0x4, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 0x5, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 0x6, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 0x7, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 0x8, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 0x9, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 0xA, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 0xB, + DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF, +}} +pub const DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN: ::UINT = 0xfffffffe; +pub const DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN: ::UINT = 0xffffffff; diff --git a/third_party/rust/winapi/src/errhandlingapi.rs b/third_party/rust/winapi/src/errhandlingapi.rs new file mode 100644 index 000000000000..fbdde40afa80 --- /dev/null +++ b/third_party/rust/winapi/src/errhandlingapi.rs @@ -0,0 +1,7 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-errorhandling-l1 +pub type PTOP_LEVEL_EXCEPTION_FILTER = Option ::LONG>; +pub type LPTOP_LEVEL_EXCEPTION_FILTER = PTOP_LEVEL_EXCEPTION_FILTER; diff --git a/third_party/rust/winapi/src/excpt.rs b/third_party/rust/winapi/src/excpt.rs new file mode 100644 index 000000000000..53ea3ffc5c5e --- /dev/null +++ b/third_party/rust/winapi/src/excpt.rs @@ -0,0 +1,14 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +ENUM!{enum EXCEPTION_DISPOSITION { + ExceptionContinueExecution = 0, + ExceptionContinueSearch = 1, + ExceptionNestedException = 2, + ExceptionCollidedUnwind = 3, +}} +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct _EXCEPTION_RECORD; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct _CONTEXT; +#[cfg(target_arch = "x86_64")] #[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct _DISPATCHER_CONTEXT; diff --git a/third_party/rust/winapi/src/fileapi.rs b/third_party/rust/winapi/src/fileapi.rs new file mode 100644 index 000000000000..764a7f65e497 --- /dev/null +++ b/third_party/rust/winapi/src/fileapi.rs @@ -0,0 +1,152 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-file-l1 +pub const CREATE_NEW: ::DWORD = 1; +pub const CREATE_ALWAYS: ::DWORD = 2; +pub const OPEN_EXISTING: ::DWORD = 3; +pub const OPEN_ALWAYS: ::DWORD = 4; +pub const TRUNCATE_EXISTING: ::DWORD = 5; +pub const INVALID_FILE_SIZE: ::DWORD = 0xFFFFFFFF; +pub const INVALID_SET_FILE_POINTER: ::DWORD = 0xFFFFFFFF; +pub const INVALID_FILE_ATTRIBUTES: ::DWORD = 0xFFFFFFFF; +STRUCT!{struct WIN32_FILE_ATTRIBUTE_DATA { + dwFileAttributes: ::DWORD, + ftCreationTime: ::FILETIME, + ftLastAccessTime: ::FILETIME, + ftLastWriteTime: ::FILETIME, + nFileSizeHigh: ::DWORD, + nFileSizeLow: ::DWORD, +}} +pub type LPWIN32_FILE_ATTRIBUTE_DATA = *mut WIN32_FILE_ATTRIBUTE_DATA; +STRUCT!{struct BY_HANDLE_FILE_INFORMATION { + dwFileAttributes: ::DWORD, + ftCreationTime: ::FILETIME, + ftLastAccessTime: ::FILETIME, + ftLastWriteTime: ::FILETIME, + dwVolumeSerialNumber: ::DWORD, + nFileSizeHigh: ::DWORD, + nFileSizeLow: ::DWORD, + nNumberOfLinks: ::DWORD, + nFileIndexHigh: ::DWORD, + nFileIndexLow: ::DWORD, +}} +pub type PBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION; +pub type LPBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION; +STRUCT!{struct CREATEFILE2_EXTENDED_PARAMETERS { + dwSize: ::DWORD, + dwFileAttributes: ::DWORD, + dwFileFlags: ::DWORD, + dwSecurityQosFlags: ::DWORD, + lpSecurityAttributes: ::LPSECURITY_ATTRIBUTES, + hTemplateFile: ::HANDLE, +}} +pub type PCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS; +pub type LPCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS; +ENUM!{enum PRIORITY_HINT { + IoPriorityHintVeryLow = 0, + IoPriorityHintLow = 1, + IoPriorityHintNormal = 2, + MaximumIoPriorityHintType = 3, +}} +STRUCT!{struct FILE_BASIC_INFO { + CreationTime: ::LARGE_INTEGER, + LastAccessTime: ::LARGE_INTEGER, + LastWriteTime: ::LARGE_INTEGER, + ChangeTime: ::LARGE_INTEGER, + FileAttributes: ::DWORD, +}} +STRUCT!{struct FILE_STANDARD_INFO { + AllocationSize: ::LARGE_INTEGER, + EndOfFile: ::LARGE_INTEGER, + NumberOfLinks: ::DWORD, + DeletePending: ::BOOLEAN, + Directory: ::BOOLEAN, +}} +STRUCT!{struct FILE_NAME_INFO { + FileNameLength: ::DWORD, + FileName: [::WCHAR; 0], +}} +STRUCT!{struct FILE_RENAME_INFO { + ReplaceIfExists: ::BOOL, + RootDirectory: ::HANDLE, + FileNameLength: ::DWORD, + FileName: [::WCHAR; 0], +}} +STRUCT!{struct FILE_DISPOSITION_INFO { + DeleteFile: ::BOOL, +}} +STRUCT!{struct FILE_ALLOCATION_INFO { + AllocationSize: ::LARGE_INTEGER, +}} +STRUCT!{struct FILE_END_OF_FILE_INFO { + EndOfFile: ::LARGE_INTEGER, +}} +STRUCT!{struct FILE_STREAM_INFO { + NextEntryOffset: ::DWORD, + StreamNameLength: ::DWORD, + StreamSize: ::DWORD, + StreamAllocationSize: ::DWORD, + StreamName: [::WCHAR; 0], +}} +STRUCT!{struct FILE_COMPRESSION_INFO { + CompressedFileSize: ::LARGE_INTEGER, + CompressionFormat: ::WORD, + CompressionUnitShift: ::UCHAR, + ChunkShift: ::UCHAR, + ClusterShift: ::UCHAR, + Reserved: [::UCHAR; 3], +}} +STRUCT!{struct FILE_ATTRIBUTE_TAG_INFO { + NextEntryOffset: ::DWORD, + ReparseTag: ::DWORD, +}} +STRUCT!{struct FILE_ID_BOTH_DIR_INFO { + NextEntryOffset: ::DWORD, + FileIndex: ::DWORD, + CreationTime: ::LARGE_INTEGER, + LastAccessTime: ::LARGE_INTEGER, + LastWriteTime: ::LARGE_INTEGER, + ChangeTime: ::LARGE_INTEGER, + EndOfFile: ::LARGE_INTEGER, + AllocationSize: ::LARGE_INTEGER, + FileAttributes: ::DWORD, + FileNameLength: ::DWORD, + EaSize: ::DWORD, + ShortNameLength: ::CCHAR, + ShortName: [::WCHAR; 12], + FileId: ::LARGE_INTEGER, + FileName: [::WCHAR; 0], +}} +STRUCT!{struct FILE_IO_PRIORITY_HINT_INFO { + PriorityHint: ::PRIORITY_HINT, +}} +STRUCT!{struct FILE_FULL_DIR_INFO { + NextEntryOffset: ::ULONG, + FileIndex: ::ULONG, + CreationTime: ::LARGE_INTEGER, + LastAccessTime: ::LARGE_INTEGER, + LastWriteTime: ::LARGE_INTEGER, + ChangeTime: ::LARGE_INTEGER, + EndOfFile: ::LARGE_INTEGER, + AllocationSize: ::LARGE_INTEGER, + FileAttributes: ::ULONG, + FileNameLength: ::ULONG, + EaSize: ::ULONG, + FileName: [::WCHAR; 0], +}} +STRUCT!{struct FILE_STORAGE_INFO { + LogicalBytesPerSector: ::ULONG, + PhysicalBytesPerSectorForAtomicity: ::ULONG, + PhysicalBytesPerSectorForPerformance: ::ULONG, + FileSystemEffectivePhysicalBytesPerSectorForAtomicity: ::ULONG, + Flags: ::ULONG, + ByteOffsetForSectorAlignment: ::ULONG, + ByteOffsetForPartitionAlignment: ::ULONG, +}} +STRUCT!{struct FILE_ALIGNMENT_INFO { + AlignmentRequirement: ::ULONG, +}} +STRUCT!{struct FILE_ID_INFO { + VolumeSerialNumber: ::ULONGLONG, + FileId: ::FILE_ID_128, +}} diff --git a/third_party/rust/winapi/src/gl.rs b/third_party/rust/winapi/src/gl.rs new file mode 100644 index 000000000000..006c37e417c2 --- /dev/null +++ b/third_party/rust/winapi/src/gl.rs @@ -0,0 +1,35 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//48 +pub type GLenum = ::c_uint; +pub type GLboolean = ::c_uchar; +pub type GLbitfield = ::c_uint; +pub type GLbyte = ::c_schar; +pub type GLshort = ::c_short; +pub type GLint = ::c_int; +pub type GLsizei = ::c_int; +pub type GLubyte = ::c_uchar; +pub type GLushort = ::c_ushort; +pub type GLuint = ::c_uint; +pub type GLfloat = ::c_float; +pub type GLclampf = ::c_float; +pub type GLdouble = ::c_double; +pub type GLclampd = ::c_double; +pub type GLvoid = ::c_void; +//63 +//68 +//AccumOp +pub const GL_ACCUM: GLenum = 0x0100; +pub const GL_LOAD: GLenum = 0x0101; +pub const GL_RETURN: GLenum = 0x0102; +pub const GL_MULT: GLenum = 0x0103; +pub const GL_ADD: GLenum = 0x0104; +//AlphaFunction +pub const GL_NEVER: GLenum = 0x0200; +pub const GL_LESS: GLenum = 0x0201; +pub const GL_EQUAL: GLenum = 0x0202; +pub const GL_LEQUAL: GLenum = 0x0203; +pub const GL_GREATER: GLenum = 0x0204; +pub const GL_NOTEQUAL: GLenum = 0x0205; +pub const GL_GEQUAL: GLenum = 0x0206; +pub const GL_ALWAYS: GLenum = 0x0207; diff --git a/third_party/rust/winapi/src/guiddef.rs b/third_party/rust/winapi/src/guiddef.rs new file mode 100644 index 000000000000..8b436cdda525 --- /dev/null +++ b/third_party/rust/winapi/src/guiddef.rs @@ -0,0 +1,20 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +STRUCT!{struct GUID { + Data1: ::c_ulong, + Data2: ::c_ushort, + Data3: ::c_ushort, + Data4: [::c_uchar; 8], +}} +pub type LPGUID = *mut GUID; +pub type LPCGUID = *const GUID; +pub type IID = GUID; +pub type LPIID = *mut IID; +pub type CLSID = GUID; +pub type LPCLSID = *mut CLSID; +pub type FMTID = GUID; +pub type LPFMTID = *mut FMTID; +pub type REFGUID = *const GUID; +pub type REFIID = *const IID; +pub type REFCLSID = *const IID; +pub type REFFMTID = *const IID; diff --git a/third_party/rust/winapi/src/heapapi.rs b/third_party/rust/winapi/src/heapapi.rs new file mode 100644 index 000000000000..6f631c515af1 --- /dev/null +++ b/third_party/rust/winapi/src/heapapi.rs @@ -0,0 +1,12 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-heap-l1 +STRUCT!{struct HEAP_SUMMARY { + cb: ::DWORD, + cbAllocated: ::SIZE_T, + cbCommitted: ::SIZE_T, + cbReserved: ::SIZE_T, + cbMaxReserve: ::SIZE_T, +}} +pub type PHEAP_SUMMARY = *mut HEAP_SUMMARY; +pub type LPHEAP_SUMMARY = PHEAP_SUMMARY; diff --git a/third_party/rust/winapi/src/hidclass.rs b/third_party/rust/winapi/src/hidclass.rs new file mode 100644 index 000000000000..0851d5febbdf --- /dev/null +++ b/third_party/rust/winapi/src/hidclass.rs @@ -0,0 +1,56 @@ +// Copyright © 2015, Peter Atashian and Alex Daniel Jones +// Licensed under the MIT License +DEFINE_GUID!{GUID_DEVINTERFACE_HID, 0x4D1E55B2, 0xF16F, 0x11CF, + 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} +pub const GUID_CLASS_INPUT: ::GUID = GUID_DEVINTERFACE_HID; +DEFINE_GUID!{GUID_HID_INTERFACE_NOTIFY, 0x2c4e2e88, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81} +DEFINE_GUID!{GUID_HID_INTERFACE_HIDPARSE, 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b} +// FIXME devpropkey stuff +pub const HID_REVISION: ::DWORD = 0x00000001; +pub const IOCTL_HID_GET_DRIVER_CONFIG: ::DWORD = HID_BUFFER_CTL_CODE!(100); +pub const IOCTL_HID_SET_DRIVER_CONFIG: ::DWORD = HID_BUFFER_CTL_CODE!(101); +pub const IOCTL_HID_GET_POLL_FREQUENCY_MSEC: ::DWORD = HID_BUFFER_CTL_CODE!(102); +pub const IOCTL_HID_SET_POLL_FREQUENCY_MSEC: ::DWORD = HID_BUFFER_CTL_CODE!(103); +pub const IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS: ::DWORD = HID_BUFFER_CTL_CODE!(104); +pub const IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS: ::DWORD = HID_BUFFER_CTL_CODE!(105); +pub const IOCTL_HID_GET_COLLECTION_INFORMATION: ::DWORD = HID_BUFFER_CTL_CODE!(106); +pub const IOCTL_HID_ENABLE_WAKE_ON_SX: ::DWORD = HID_BUFFER_CTL_CODE!(107); +pub const IOCTL_HID_SET_S0_IDLE_TIMEOUT: ::DWORD = HID_BUFFER_CTL_CODE!(108); +pub const IOCTL_HID_GET_COLLECTION_DESCRIPTOR: ::DWORD = HID_CTL_CODE!(100); +pub const IOCTL_HID_FLUSH_QUEUE: ::DWORD = HID_CTL_CODE!(101); +pub const IOCTL_HID_SET_FEATURE: ::DWORD = HID_IN_CTL_CODE!(100); +pub const IOCTL_HID_SET_OUTPUT_REPORT: ::DWORD = HID_IN_CTL_CODE!(101); +pub const IOCTL_HID_GET_FEATURE: ::DWORD = HID_OUT_CTL_CODE!(100); +pub const IOCTL_GET_PHYSICAL_DESCRIPTOR: ::DWORD = HID_OUT_CTL_CODE!(102); +pub const IOCTL_HID_GET_HARDWARE_ID: ::DWORD = HID_OUT_CTL_CODE!(103); +pub const IOCTL_HID_GET_INPUT_REPORT: ::DWORD = HID_OUT_CTL_CODE!(104); +pub const IOCTL_HID_GET_OUTPUT_REPORT: ::DWORD = HID_OUT_CTL_CODE!(105); +pub const IOCTL_HID_GET_MANUFACTURER_STRING: ::DWORD = HID_OUT_CTL_CODE!(110); +pub const IOCTL_HID_GET_PRODUCT_STRING: ::DWORD = HID_OUT_CTL_CODE!(111); +pub const IOCTL_HID_GET_SERIALNUMBER_STRING: ::DWORD = HID_OUT_CTL_CODE!(112); +pub const IOCTL_HID_GET_INDEXED_STRING: ::DWORD = HID_OUT_CTL_CODE!(120); +pub const IOCTL_HID_GET_MS_GENRE_DESCRIPTOR: ::DWORD = HID_OUT_CTL_CODE!(121); +pub const IOCTL_HID_ENABLE_SECURE_READ: ::DWORD = HID_CTL_CODE!(130); +pub const IOCTL_HID_DISABLE_SECURE_READ: ::DWORD = HID_CTL_CODE!(131); +pub const IOCTL_HID_DEVICERESET_NOTIFICATION: ::DWORD = HID_CTL_CODE!(140); +STRUCT!{struct HID_XFER_PACKET { + reportBuffer: ::PUCHAR, + reportBufferLen: ::ULONG, + reportId: ::UCHAR, +}} +pub type PHID_XFER_PACKET = *mut HID_XFER_PACKET; +//FIXME Stuff for NT_INCLUDED +STRUCT!{struct HID_COLLECTION_INFORMATION { + DescriptorSize: ::ULONG, + Polled: ::BOOLEAN, + Reserved1: [::UCHAR; 1], + VendorID: ::USHORT, + ProductID: ::USHORT, + VersionNumber: ::USHORT, +}} +pub type PHID_COLLECTION_INFORMATION = *mut HID_COLLECTION_INFORMATION; +STRUCT!{struct HID_DRIVER_CONFIG { + Size: ::ULONG, + RingBufferSize: ::ULONG, +}} +pub type PHID_DRIVER_CONFIG = *mut HID_DRIVER_CONFIG; diff --git a/third_party/rust/winapi/src/hidpi.rs b/third_party/rust/winapi/src/hidpi.rs new file mode 100644 index 000000000000..b2321ea9e903 --- /dev/null +++ b/third_party/rust/winapi/src/hidpi.rs @@ -0,0 +1,182 @@ +// Copyright © 2015, Peter Atashian and Alex Daniel Jones +// Licensed under the MIT License +pub const HIDP_LINK_COLLECTION_ROOT: ::USHORT = -1i16 as u16; +pub const HIDP_LINK_COLLECTION_UNSPECIFIED: ::USHORT = 0; +ENUM!{enum HIDP_REPORT_TYPE { + HidP_Input, + HidP_Output, + HidP_Feature, +}} +STRUCT!{struct USAGE_AND_PAGE { + Usage: ::USAGE, + UsagePage: ::USAGE, +}} +pub type PUSAGE_AND_PAGE = *mut USAGE_AND_PAGE; +STRUCT!{struct HIDP_BUTTON_CAPS { + UsagePage: ::USAGE, + ReportID: ::UCHAR, + IsAlias: ::BOOLEAN, + BitField: ::USHORT, + LinkCollection: ::USHORT, + LinkUsage: ::USAGE, + LinkUsagePage: ::USAGE, + IsRange: ::BOOLEAN, + IsStringRange: ::BOOLEAN, + IsDesignatorRange: ::BOOLEAN, + IsAbsolute: ::BOOLEAN, + Reserved: [::ULONG; 10], + S_un: [u16; 8], +}} +UNION!{HIDP_BUTTON_CAPS, S_un, Range, Range_mut, HIDP_RANGE_STRUCT} +UNION!{HIDP_BUTTON_CAPS, S_un, NotRange, NotRange_mut, HIDP_NOTRANGE_STRUCT} +pub type PHIDP_BUTTON_CAPS = *mut HIDP_BUTTON_CAPS; +STRUCT!{struct HIDP_RANGE_STRUCT { + UsageMin: ::USAGE, + UsageMax: ::USAGE, + StringMin: ::USHORT, + StringMax: ::USHORT, + DesignatorMin: ::USHORT, + DesignatorMax: ::USHORT, + DataIndexMin: ::USHORT, + DataIndexMax: ::USHORT, +}} +STRUCT!{struct HIDP_NOTRANGE_STRUCT { + Usage: ::USAGE, + Reserved1: ::USAGE, + StringIndex: ::USHORT, + Reserved2: ::USHORT, + DesignatorIndex: ::USHORT, + Reserved3: ::USHORT, + DataIndex: ::USHORT, + Reserved4: ::USHORT, +}} +STRUCT!{struct HIDP_VALUE_CAPS { + UsagePage: ::USAGE, + ReportID: ::UCHAR, + IsAlias: ::BOOLEAN, + BitField: ::USHORT, + LinkCollection: ::USHORT, + LinkUsage: ::USAGE, + LinkUsagePage: ::USAGE, + IsRange: ::BOOLEAN, + IsStringRange: ::BOOLEAN, + IsDesignatorRange: ::BOOLEAN, + IsAbsolute: ::BOOLEAN, + HasNull: ::BOOLEAN, + Reserved: ::UCHAR, + BitSize: ::USHORT, + ReportCount: ::USHORT, + Reserved2: [::USHORT; 5], + UnitsExp: ::ULONG, + Units: ::ULONG, + LogicalMin: ::LONG, + LogicalMax: ::LONG, + PhysicalMin: ::LONG, + PhysicalMax: ::LONG, + S_un: [u16; 8], +}} +UNION!{HIDP_VALUE_CAPS, S_un, Range, Range_mut, HIDP_RANGE_STRUCT} +UNION!{HIDP_VALUE_CAPS, S_un, NotRange, NotRange_mut, HIDP_NOTRANGE_STRUCT} +pub type PHIDP_VALUE_CAPS = *mut HIDP_VALUE_CAPS; +STRUCT!{struct HIDP_LINK_COLLECTION_NODE { + LinkUsage: ::USAGE, + LinkUsagePage: ::USAGE, + Parent: ::USHORT, + NumberOfChildren: ::USHORT, + NextSibling: ::USHORT, + FirstChild: ::USHORT, + bit_fields: ::ULONG, + UserContext: ::PVOID, +}} +BITFIELD!{HIDP_LINK_COLLECTION_NODE bit_fields: ::ULONG [ + CollectionType set_CollectionType[0..8], + IsAlias set_IsAlias[8..9], +]} +pub type PHIDP_LINK_COLLECTION_NODE = *mut HIDP_LINK_COLLECTION_NODE; +pub type PHIDP_REPORT_DESCRIPTOR = ::PUCHAR; +pub enum HIDP_PREPARSED_DATA{} +pub type PHIDP_PREPARSED_DATA = *mut HIDP_PREPARSED_DATA; +STRUCT!{struct HIDP_CAPS { + Usage: ::USAGE, + UsagePage: ::USAGE, + InputReportByteLength: ::USHORT, + OutputReportByteLength: ::USHORT, + FeatureReportByteLength: ::USHORT, + Reserved: [::USHORT; 17], + NumberLinkCollectionNodes: ::USHORT, + NumberInputButtonCaps: ::USHORT, + NumberInputValueCaps: ::USHORT, + NumberInputDataIndices: ::USHORT, + NumberOutputButtonCaps: ::USHORT, + NumberOutputValueCaps: ::USHORT, + NumberOutputDataIndices: ::USHORT, + NumberFeatureButtonCaps: ::USHORT, + NumberFeatureValueCaps: ::USHORT, + NumberFeatureDataIndices: ::USHORT, +}} +pub type PHIDP_CAPS = *mut HIDP_CAPS; +STRUCT!{struct HIDP_DATA { + DataIndex: ::USHORT, + Reserved: ::USHORT, + S_un: [u32; 1], +}} +UNION!{HIDP_DATA, S_un, RawValue, RawValue_mut, ::ULONG} +UNION!{HIDP_DATA, S_un, On, On_mut, ::BOOLEAN} +pub type PHIDP_DATA = *mut HIDP_DATA; +STRUCT!{struct HIDP_UNKNOWN_TOKEN { + Token: ::UCHAR, + Reserved: [::UCHAR; 3], + BitField: ::ULONG, +}} +pub type PHIDP_UNKNOWN_TOKEN = *mut HIDP_UNKNOWN_TOKEN; +STRUCT!{struct HIDP_EXTENDED_ATTRIBUTES { + NumGlobalUnknowns: ::UCHAR, + Reserved: [::UCHAR; 3], + GlobalUnknowns: PHIDP_UNKNOWN_TOKEN, + Data: [::ULONG; 1], +}} +pub type PHIDP_EXTENDED_ATTRIBUTES = *mut HIDP_EXTENDED_ATTRIBUTES; +ENUM!{enum HIDP_KEYBOARD_DIRECTION { + HidP_Keyboard_Break, + HidP_Keyboard_Make, +}} +STRUCT!{struct HIDP_KEYBOARD_MODIFIER_STATE { + ul: ::ULONG, +}} +BITFIELD!{HIDP_KEYBOARD_MODIFIER_STATE ul: ::ULONG [ + LeftControl set_LeftControl[0..1], + LeftShift set_LeftShift[1..2], + LeftAlt set_LeftAlt[2..3], + LeftGUI set_LeftGUI[3..4], + RightControl set_RightControl[4..5], + RightShift set_RightShift[5..6], + RightAlt set_RightAlt[6..7], + RigthGUI set_RigthGUI[7..8], + CapsLock set_CapsLock[8..9], + ScollLock set_ScollLock[9..10], + NumLock set_NumLock[10..11], +]} +pub type PHIDP_KEYBOARD_MODIFIER_STATE = *mut HIDP_KEYBOARD_MODIFIER_STATE; +pub type PHIDP_INSERT_SCANCODES = Option ::BOOLEAN>; +pub const HIDP_STATUS_SUCCESS: ::NTSTATUS = HIDP_ERROR_CODES!(0x0, 0); +pub const HIDP_STATUS_NULL: ::NTSTATUS = HIDP_ERROR_CODES!(0x8, 1); +pub const HIDP_STATUS_INVALID_PREPARSED_DATA: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 1); +pub const HIDP_STATUS_INVALID_REPORT_TYPE: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 2); +pub const HIDP_STATUS_INVALID_REPORT_LENGTH: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 3); +pub const HIDP_STATUS_USAGE_NOT_FOUND: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 4); +pub const HIDP_STATUS_VALUE_OUT_OF_RANGE: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 5); +pub const HIDP_STATUS_BAD_LOG_PHY_VALUES: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 6); +pub const HIDP_STATUS_BUFFER_TOO_SMALL: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 7); +pub const HIDP_STATUS_INTERNAL_ERROR: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 8); +pub const HIDP_STATUS_I8042_TRANS_UNKNOWN: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 9); +pub const HIDP_STATUS_INCOMPATIBLE_REPORT_ID: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xA); +pub const HIDP_STATUS_NOT_VALUE_ARRAY: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xB); +pub const HIDP_STATUS_IS_VALUE_ARRAY: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xC); +pub const HIDP_STATUS_DATA_INDEX_NOT_FOUND: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xD); +pub const HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xE); +pub const HIDP_STATUS_BUTTON_NOT_PRESSED: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xF); +pub const HIDP_STATUS_REPORT_DOES_NOT_EXIST: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0x10); +pub const HIDP_STATUS_NOT_IMPLEMENTED: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0x20); +pub const HIDP_STATUS_I8242_TRANS_UNKNOWN: ::NTSTATUS = HIDP_STATUS_I8042_TRANS_UNKNOWN; diff --git a/third_party/rust/winapi/src/hidsdi.rs b/third_party/rust/winapi/src/hidsdi.rs new file mode 100644 index 000000000000..1b421f038adc --- /dev/null +++ b/third_party/rust/winapi/src/hidsdi.rs @@ -0,0 +1,15 @@ +// Copyright © 2015, Peter Atashian and Alex Daniel Jones +// Licensed under the MIT License +STRUCT!{struct HIDD_CONFIGURATION { + cookie: ::PVOID, + size: ::ULONG, + RingBufferSize: ::ULONG, +}} +pub type PHIDD_CONFIGURATION = *mut HIDD_CONFIGURATION; +STRUCT!{struct HIDD_ATTRIBUTES { + Size: ::ULONG, + VendorID: ::USHORT, + ProductID: ::USHORT, + VersionNumber: ::USHORT, +}} +pub type PHIDD_ATTRIBUTES = *mut HIDD_ATTRIBUTES; diff --git a/third_party/rust/winapi/src/hidusage.rs b/third_party/rust/winapi/src/hidusage.rs new file mode 100644 index 000000000000..4d76509ecefe --- /dev/null +++ b/third_party/rust/winapi/src/hidusage.rs @@ -0,0 +1,270 @@ +// Copyright © 2015, Peter Atashian and Alex Daniel Jones +// Licensed under the MIT License +pub type USAGE = ::USHORT; +pub type PUSAGE = *mut USAGE; +pub const HID_USAGE_PAGE_UNDEFINED: ::USAGE = 0x00; +pub const HID_USAGE_PAGE_GENERIC: ::USAGE = 0x01; +pub const HID_USAGE_PAGE_SIMULATION: ::USAGE = 0x02; +pub const HID_USAGE_PAGE_VR: ::USAGE = 0x03; +pub const HID_USAGE_PAGE_SPORT: ::USAGE = 0x04; +pub const HID_USAGE_PAGE_GAME: ::USAGE = 0x05; +pub const HID_USAGE_PAGE_KEYBOARD: ::USAGE = 0x07; +pub const HID_USAGE_PAGE_LED: ::USAGE = 0x08; +pub const HID_USAGE_PAGE_BUTTON: ::USAGE = 0x09; +pub const HID_USAGE_PAGE_ORDINAL: ::USAGE = 0x0A; +pub const HID_USAGE_PAGE_TELEPHONY: ::USAGE = 0x0B; +pub const HID_USAGE_PAGE_CONSUMER: ::USAGE = 0x0C; +pub const HID_USAGE_PAGE_DIGITIZER: ::USAGE = 0x0D; +pub const HID_USAGE_PAGE_UNICODE: ::USAGE = 0x10; +pub const HID_USAGE_PAGE_ALPHANUMERIC: ::USAGE = 0x14; +pub const HID_USAGE_PAGE_SENSOR: ::USAGE = 0x20; +pub const HID_USAGE_PAGE_BARCODE_SCANNER: ::USAGE = 0x8C; +pub const HID_USAGE_PAGE_WEIGHING_DEVICE: ::USAGE = 0x8D; +pub const HID_USAGE_PAGE_MAGNETIC_STRIPE_READER: ::USAGE = 0x8E; +pub const HID_USAGE_PAGE_CAMERA_CONTROL: ::USAGE = 0x90; +pub const HID_USAGE_PAGE_MICROSOFT_BLUETOOTH_HANDSFREE: ::USAGE = 0xFFF3; +pub const HID_USAGE_PAGE_VENDOR_DEFINED_BEGIN: ::USAGE = 0xFF00; +pub const HID_USAGE_PAGE_VENDOR_DEFINED_END: ::USAGE = 0xFFFF; +pub const HID_USAGE_GENERIC_POINTER: ::USAGE = 0x01; +pub const HID_USAGE_GENERIC_MOUSE: ::USAGE = 0x02; +pub const HID_USAGE_GENERIC_JOYSTICK: ::USAGE = 0x04; +pub const HID_USAGE_GENERIC_GAMEPAD: ::USAGE = 0x05; +pub const HID_USAGE_GENERIC_KEYBOARD: ::USAGE = 0x06; +pub const HID_USAGE_GENERIC_KEYPAD: ::USAGE = 0x07; +pub const HID_USAGE_GENERIC_PORTABLE_DEVICE_CONTROL: ::USAGE = 0x0D; +pub const HID_USAGE_GENERIC_SYSTEM_CTL: ::USAGE = 0x80; +pub const HID_USAGE_GENERIC_X: ::USAGE = 0x30; +pub const HID_USAGE_GENERIC_Y: ::USAGE = 0x31; +pub const HID_USAGE_GENERIC_Z: ::USAGE = 0x32; +pub const HID_USAGE_GENERIC_RX: ::USAGE = 0x33; +pub const HID_USAGE_GENERIC_RY: ::USAGE = 0x34; +pub const HID_USAGE_GENERIC_RZ: ::USAGE = 0x35; +pub const HID_USAGE_GENERIC_SLIDER: ::USAGE = 0x36; +pub const HID_USAGE_GENERIC_DIAL: ::USAGE = 0x37; +pub const HID_USAGE_GENERIC_WHEEL: ::USAGE = 0x38; +pub const HID_USAGE_GENERIC_HATSWITCH: ::USAGE = 0x39; +pub const HID_USAGE_GENERIC_COUNTED_BUFFER: ::USAGE = 0x3A; +pub const HID_USAGE_GENERIC_BYTE_COUNT: ::USAGE = 0x3B; +pub const HID_USAGE_GENERIC_MOTION_WAKEUP: ::USAGE = 0x3C; +pub const HID_USAGE_GENERIC_VX: ::USAGE = 0x40; +pub const HID_USAGE_GENERIC_VY: ::USAGE = 0x41; +pub const HID_USAGE_GENERIC_VZ: ::USAGE = 0x42; +pub const HID_USAGE_GENERIC_VBRX: ::USAGE = 0x43; +pub const HID_USAGE_GENERIC_VBRY: ::USAGE = 0x44; +pub const HID_USAGE_GENERIC_VBRZ: ::USAGE = 0x45; +pub const HID_USAGE_GENERIC_VNO: ::USAGE = 0x46; +pub const HID_USAGE_GENERIC_RESOLUTION_MULTIPLIER: ::USAGE = 0x48; +pub const HID_USAGE_GENERIC_SYSCTL_POWER: ::USAGE = 0x81; +pub const HID_USAGE_GENERIC_SYSCTL_SLEEP: ::USAGE = 0x82; +pub const HID_USAGE_GENERIC_SYSCTL_WAKE: ::USAGE = 0x83; +pub const HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU: ::USAGE = 0x84; +pub const HID_USAGE_GENERIC_SYSCTL_MAIN_MENU: ::USAGE = 0x85; +pub const HID_USAGE_GENERIC_SYSCTL_APP_MENU: ::USAGE = 0x86; +pub const HID_USAGE_GENERIC_SYSCTL_HELP_MENU: ::USAGE = 0x87; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_EXIT: ::USAGE = 0x88; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_SELECT: ::USAGE = 0x89; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT: ::USAGE = 0x8A; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_LEFT: ::USAGE = 0x8B; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_UP: ::USAGE = 0x8C; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_DOWN: ::USAGE = 0x8D; +pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_BUTTON: ::USAGE = 0xC9; +pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_SLIDER_SWITCH: ::USAGE = 0xCA; +pub const HID_USAGE_GENERIC_CONTROL_ENABLE: ::USAGE = 0xCB; +pub const HID_USAGE_SIMULATION_RUDDER: ::USAGE = 0xBA; +pub const HID_USAGE_SIMULATION_THROTTLE: ::USAGE = 0xBB; +pub const HID_USAGE_KEYBOARD_NOEVENT: ::USAGE = 0x00; +pub const HID_USAGE_KEYBOARD_ROLLOVER: ::USAGE = 0x01; +pub const HID_USAGE_KEYBOARD_POSTFAIL: ::USAGE = 0x02; +pub const HID_USAGE_KEYBOARD_UNDEFINED: ::USAGE = 0x03; +pub const HID_USAGE_KEYBOARD_aA: ::USAGE = 0x04; +pub const HID_USAGE_KEYBOARD_zZ: ::USAGE = 0x1D; +pub const HID_USAGE_KEYBOARD_ONE: ::USAGE = 0x1E; +pub const HID_USAGE_KEYBOARD_ZERO: ::USAGE = 0x27; +pub const HID_USAGE_KEYBOARD_LCTRL: ::USAGE = 0xE0; +pub const HID_USAGE_KEYBOARD_LSHFT: ::USAGE = 0xE1; +pub const HID_USAGE_KEYBOARD_LALT: ::USAGE = 0xE2; +pub const HID_USAGE_KEYBOARD_LGUI: ::USAGE = 0xE3; +pub const HID_USAGE_KEYBOARD_RCTRL: ::USAGE = 0xE4; +pub const HID_USAGE_KEYBOARD_RSHFT: ::USAGE = 0xE5; +pub const HID_USAGE_KEYBOARD_RALT: ::USAGE = 0xE6; +pub const HID_USAGE_KEYBOARD_RGUI: ::USAGE = 0xE7; +pub const HID_USAGE_KEYBOARD_SCROLL_LOCK: ::USAGE = 0x47; +pub const HID_USAGE_KEYBOARD_NUM_LOCK: ::USAGE = 0x53; +pub const HID_USAGE_KEYBOARD_CAPS_LOCK: ::USAGE = 0x39; +pub const HID_USAGE_KEYBOARD_F1: ::USAGE = 0x3A; +pub const HID_USAGE_KEYBOARD_F2: ::USAGE = 0x3B; +pub const HID_USAGE_KEYBOARD_F3: ::USAGE = 0x3C; +pub const HID_USAGE_KEYBOARD_F4: ::USAGE = 0x3D; +pub const HID_USAGE_KEYBOARD_F5: ::USAGE = 0x3E; +pub const HID_USAGE_KEYBOARD_F6: ::USAGE = 0x3F; +pub const HID_USAGE_KEYBOARD_F7: ::USAGE = 0x40; +pub const HID_USAGE_KEYBOARD_F8: ::USAGE = 0x41; +pub const HID_USAGE_KEYBOARD_F9: ::USAGE = 0x42; +pub const HID_USAGE_KEYBOARD_F10: ::USAGE = 0x43; +pub const HID_USAGE_KEYBOARD_F11: ::USAGE = 0x44; +pub const HID_USAGE_KEYBOARD_F12: ::USAGE = 0x45; +pub const HID_USAGE_KEYBOARD_F13: ::USAGE = 0x68; +pub const HID_USAGE_KEYBOARD_F14: ::USAGE = 0x69; +pub const HID_USAGE_KEYBOARD_F15: ::USAGE = 0x6A; +pub const HID_USAGE_KEYBOARD_F16: ::USAGE = 0x6B; +pub const HID_USAGE_KEYBOARD_F17: ::USAGE = 0x6C; +pub const HID_USAGE_KEYBOARD_F18: ::USAGE = 0x6D; +pub const HID_USAGE_KEYBOARD_F19: ::USAGE = 0x6E; +pub const HID_USAGE_KEYBOARD_F20: ::USAGE = 0x6F; +pub const HID_USAGE_KEYBOARD_F21: ::USAGE = 0x70; +pub const HID_USAGE_KEYBOARD_F22: ::USAGE = 0x71; +pub const HID_USAGE_KEYBOARD_F23: ::USAGE = 0x72; +pub const HID_USAGE_KEYBOARD_F24: ::USAGE = 0x73; +pub const HID_USAGE_KEYBOARD_RETURN: ::USAGE = 0x28; +pub const HID_USAGE_KEYBOARD_ESCAPE: ::USAGE = 0x29; +pub const HID_USAGE_KEYBOARD_DELETE: ::USAGE = 0x2A; +pub const HID_USAGE_KEYBOARD_PRINT_SCREEN: ::USAGE = 0x46; +pub const HID_USAGE_KEYBOARD_DELETE_FORWARD: ::USAGE = 0x4C; +pub const HID_USAGE_LED_NUM_LOCK: ::USAGE = 0x01; +pub const HID_USAGE_LED_CAPS_LOCK: ::USAGE = 0x02; +pub const HID_USAGE_LED_SCROLL_LOCK: ::USAGE = 0x03; +pub const HID_USAGE_LED_COMPOSE: ::USAGE = 0x04; +pub const HID_USAGE_LED_KANA: ::USAGE = 0x05; +pub const HID_USAGE_LED_POWER: ::USAGE = 0x06; +pub const HID_USAGE_LED_SHIFT: ::USAGE = 0x07; +pub const HID_USAGE_LED_DO_NOT_DISTURB: ::USAGE = 0x08; +pub const HID_USAGE_LED_MUTE: ::USAGE = 0x09; +pub const HID_USAGE_LED_TONE_ENABLE: ::USAGE = 0x0A; +pub const HID_USAGE_LED_HIGH_CUT_FILTER: ::USAGE = 0x0B; +pub const HID_USAGE_LED_LOW_CUT_FILTER: ::USAGE = 0x0C; +pub const HID_USAGE_LED_EQUALIZER_ENABLE: ::USAGE = 0x0D; +pub const HID_USAGE_LED_SOUND_FIELD_ON: ::USAGE = 0x0E; +pub const HID_USAGE_LED_SURROUND_FIELD_ON: ::USAGE = 0x0F; +pub const HID_USAGE_LED_REPEAT: ::USAGE = 0x10; +pub const HID_USAGE_LED_STEREO: ::USAGE = 0x11; +pub const HID_USAGE_LED_SAMPLING_RATE_DETECT: ::USAGE = 0x12; +pub const HID_USAGE_LED_SPINNING: ::USAGE = 0x13; +pub const HID_USAGE_LED_CAV: ::USAGE = 0x14; +pub const HID_USAGE_LED_CLV: ::USAGE = 0x15; +pub const HID_USAGE_LED_RECORDING_FORMAT_DET: ::USAGE = 0x16; +pub const HID_USAGE_LED_OFF_HOOK: ::USAGE = 0x17; +pub const HID_USAGE_LED_RING: ::USAGE = 0x18; +pub const HID_USAGE_LED_MESSAGE_WAITING: ::USAGE = 0x19; +pub const HID_USAGE_LED_DATA_MODE: ::USAGE = 0x1A; +pub const HID_USAGE_LED_BATTERY_OPERATION: ::USAGE = 0x1B; +pub const HID_USAGE_LED_BATTERY_OK: ::USAGE = 0x1C; +pub const HID_USAGE_LED_BATTERY_LOW: ::USAGE = 0x1D; +pub const HID_USAGE_LED_SPEAKER: ::USAGE = 0x1E; +pub const HID_USAGE_LED_HEAD_SET: ::USAGE = 0x1F; +pub const HID_USAGE_LED_HOLD: ::USAGE = 0x20; +pub const HID_USAGE_LED_MICROPHONE: ::USAGE = 0x21; +pub const HID_USAGE_LED_COVERAGE: ::USAGE = 0x22; +pub const HID_USAGE_LED_NIGHT_MODE: ::USAGE = 0x23; +pub const HID_USAGE_LED_SEND_CALLS: ::USAGE = 0x24; +pub const HID_USAGE_LED_CALL_PICKUP: ::USAGE = 0x25; +pub const HID_USAGE_LED_CONFERENCE: ::USAGE = 0x26; +pub const HID_USAGE_LED_STAND_BY: ::USAGE = 0x27; +pub const HID_USAGE_LED_CAMERA_ON: ::USAGE = 0x28; +pub const HID_USAGE_LED_CAMERA_OFF: ::USAGE = 0x29; +pub const HID_USAGE_LED_ON_LINE: ::USAGE = 0x2A; +pub const HID_USAGE_LED_OFF_LINE: ::USAGE = 0x2B; +pub const HID_USAGE_LED_BUSY: ::USAGE = 0x2C; +pub const HID_USAGE_LED_READY: ::USAGE = 0x2D; +pub const HID_USAGE_LED_PAPER_OUT: ::USAGE = 0x2E; +pub const HID_USAGE_LED_PAPER_JAM: ::USAGE = 0x2F; +pub const HID_USAGE_LED_REMOTE: ::USAGE = 0x30; +pub const HID_USAGE_LED_FORWARD: ::USAGE = 0x31; +pub const HID_USAGE_LED_REVERSE: ::USAGE = 0x32; +pub const HID_USAGE_LED_STOP: ::USAGE = 0x33; +pub const HID_USAGE_LED_REWIND: ::USAGE = 0x34; +pub const HID_USAGE_LED_FAST_FORWARD: ::USAGE = 0x35; +pub const HID_USAGE_LED_PLAY: ::USAGE = 0x36; +pub const HID_USAGE_LED_PAUSE: ::USAGE = 0x37; +pub const HID_USAGE_LED_RECORD: ::USAGE = 0x38; +pub const HID_USAGE_LED_ERROR: ::USAGE = 0x39; +pub const HID_USAGE_LED_SELECTED_INDICATOR: ::USAGE = 0x3A; +pub const HID_USAGE_LED_IN_USE_INDICATOR: ::USAGE = 0x3B; +pub const HID_USAGE_LED_MULTI_MODE_INDICATOR: ::USAGE = 0x3C; +pub const HID_USAGE_LED_INDICATOR_ON: ::USAGE = 0x3D; +pub const HID_USAGE_LED_INDICATOR_FLASH: ::USAGE = 0x3E; +pub const HID_USAGE_LED_INDICATOR_SLOW_BLINK: ::USAGE = 0x3F; +pub const HID_USAGE_LED_INDICATOR_FAST_BLINK: ::USAGE = 0x40; +pub const HID_USAGE_LED_INDICATOR_OFF: ::USAGE = 0x41; +pub const HID_USAGE_LED_FLASH_ON_TIME: ::USAGE = 0x42; +pub const HID_USAGE_LED_SLOW_BLINK_ON_TIME: ::USAGE = 0x43; +pub const HID_USAGE_LED_SLOW_BLINK_OFF_TIME: ::USAGE = 0x44; +pub const HID_USAGE_LED_FAST_BLINK_ON_TIME: ::USAGE = 0x45; +pub const HID_USAGE_LED_FAST_BLINK_OFF_TIME: ::USAGE = 0x46; +pub const HID_USAGE_LED_INDICATOR_COLOR: ::USAGE = 0x47; +pub const HID_USAGE_LED_RED: ::USAGE = 0x48; +pub const HID_USAGE_LED_GREEN: ::USAGE = 0x49; +pub const HID_USAGE_LED_AMBER: ::USAGE = 0x4A; +pub const HID_USAGE_LED_GENERIC_INDICATOR: ::USAGE = 0x4B; +pub const HID_USAGE_TELEPHONY_PHONE: ::USAGE = 0x01; +pub const HID_USAGE_TELEPHONY_ANSWERING_MACHINE: ::USAGE = 0x02; +pub const HID_USAGE_TELEPHONY_MESSAGE_CONTROLS: ::USAGE = 0x03; +pub const HID_USAGE_TELEPHONY_HANDSET: ::USAGE = 0x04; +pub const HID_USAGE_TELEPHONY_HEADSET: ::USAGE = 0x05; +pub const HID_USAGE_TELEPHONY_KEYPAD: ::USAGE = 0x06; +pub const HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON: ::USAGE = 0x07; +pub const HID_USAGE_TELEPHONY_REDIAL: ::USAGE = 0x24; +pub const HID_USAGE_TELEPHONY_TRANSFER: ::USAGE = 0x25; +pub const HID_USAGE_TELEPHONY_DROP: ::USAGE = 0x26; +pub const HID_USAGE_TELEPHONY_LINE: ::USAGE = 0x2A; +pub const HID_USAGE_TELEPHONY_RING_ENABLE: ::USAGE = 0x2D; +pub const HID_USAGE_TELEPHONY_SEND: ::USAGE = 0x31; +pub const HID_USAGE_TELEPHONY_KEYPAD_0: ::USAGE = 0xB0; +pub const HID_USAGE_TELEPHONY_KEYPAD_D: ::USAGE = 0xBF; +pub const HID_USAGE_TELEPHONY_HOST_AVAILABLE: ::USAGE = 0xF1; +pub const HID_USAGE_CONSUMERCTRL: ::USAGE = 0x01; +pub const HID_USAGE_CONSUMER_CHANNEL_INCREMENT: ::USAGE = 0x9C; +pub const HID_USAGE_CONSUMER_CHANNEL_DECREMENT: ::USAGE = 0x9D; +pub const HID_USAGE_CONSUMER_PLAY: ::USAGE = 0xB0; +pub const HID_USAGE_CONSUMER_PAUSE: ::USAGE = 0xB1; +pub const HID_USAGE_CONSUMER_RECORD: ::USAGE = 0xB2; +pub const HID_USAGE_CONSUMER_FAST_FORWARD: ::USAGE = 0xB3; +pub const HID_USAGE_CONSUMER_REWIND: ::USAGE = 0xB4; +pub const HID_USAGE_CONSUMER_SCAN_NEXT_TRACK: ::USAGE = 0xB5; +pub const HID_USAGE_CONSUMER_SCAN_PREV_TRACK: ::USAGE = 0xB6; +pub const HID_USAGE_CONSUMER_STOP: ::USAGE = 0xB7; +pub const HID_USAGE_CONSUMER_PLAY_PAUSE: ::USAGE = 0xCD; +pub const HID_USAGE_CONSUMER_VOLUME: ::USAGE = 0xE0; +pub const HID_USAGE_CONSUMER_BALANCE: ::USAGE = 0xE1; +pub const HID_USAGE_CONSUMER_MUTE: ::USAGE = 0xE2; +pub const HID_USAGE_CONSUMER_BASS: ::USAGE = 0xE3; +pub const HID_USAGE_CONSUMER_TREBLE: ::USAGE = 0xE4; +pub const HID_USAGE_CONSUMER_BASS_BOOST: ::USAGE = 0xE5; +pub const HID_USAGE_CONSUMER_SURROUND_MODE: ::USAGE = 0xE6; +pub const HID_USAGE_CONSUMER_LOUDNESS: ::USAGE = 0xE7; +pub const HID_USAGE_CONSUMER_MPX: ::USAGE = 0xE8; +pub const HID_USAGE_CONSUMER_VOLUME_INCREMENT: ::USAGE = 0xE9; +pub const HID_USAGE_CONSUMER_VOLUME_DECREMENT: ::USAGE = 0xEA; +pub const HID_USAGE_CONSUMER_BASS_INCREMENT: ::USAGE = 0x152; +pub const HID_USAGE_CONSUMER_BASS_DECREMENT: ::USAGE = 0x153; +pub const HID_USAGE_CONSUMER_TREBLE_INCREMENT: ::USAGE = 0x154; +pub const HID_USAGE_CONSUMER_TREBLE_DECREMENT: ::USAGE = 0x155; +pub const HID_USAGE_CONSUMER_AL_CONFIGURATION: ::USAGE = 0x183; +pub const HID_USAGE_CONSUMER_AL_EMAIL: ::USAGE = 0x18A; +pub const HID_USAGE_CONSUMER_AL_CALCULATOR: ::USAGE = 0x192; +pub const HID_USAGE_CONSUMER_AL_BROWSER: ::USAGE = 0x194; +pub const HID_USAGE_CONSUMER_AC_SEARCH: ::USAGE = 0x221; +pub const HID_USAGE_CONSUMER_AC_GOTO: ::USAGE = 0x222; +pub const HID_USAGE_CONSUMER_AC_HOME: ::USAGE = 0x223; +pub const HID_USAGE_CONSUMER_AC_BACK: ::USAGE = 0x224; +pub const HID_USAGE_CONSUMER_AC_FORWARD: ::USAGE = 0x225; +pub const HID_USAGE_CONSUMER_AC_STOP: ::USAGE = 0x226; +pub const HID_USAGE_CONSUMER_AC_REFRESH: ::USAGE = 0x227; +pub const HID_USAGE_CONSUMER_AC_PREVIOUS: ::USAGE = 0x228; +pub const HID_USAGE_CONSUMER_AC_NEXT: ::USAGE = 0x229; +pub const HID_USAGE_CONSUMER_AC_BOOKMARKS: ::USAGE = 0x22A; +pub const HID_USAGE_CONSUMER_AC_PAN: ::USAGE = 0x238; +pub const HID_USAGE_CONSUMER_EXTENDED_KEYBOARD_ATTRIBUTES_COLLECTION: ::USAGE = 0x2C0; +pub const HID_USAGE_CONSUMER_KEYBOARD_FORM_FACTOR: ::USAGE = 0x2C1; +pub const HID_USAGE_CONSUMER_KEYBOARD_KEY_TYPE: ::USAGE = 0x2C2; +pub const HID_USAGE_CONSUMER_KEYBOARD_PHYSICAL_LAYOUT: ::USAGE = 0x2C3; +pub const HID_USAGE_CONSUMER_VENDOR_SPECIFIC_KEYBOARD_PHYSICAL_LAYOUT: ::USAGE = 0x2C4; +pub const HID_USAGE_CONSUMER_KEYBOARD_IETF_LANGUAGE_TAG_INDEX: ::USAGE = 0x2C5; +pub const HID_USAGE_CONSUMER_IMPLEMENTED_KEYBOARD_INPUT_ASSIST_CONTROLS: ::USAGE = 0x2C6; +pub const HID_USAGE_DIGITIZER_PEN: ::USAGE = 0x02; +pub const HID_USAGE_DIGITIZER_IN_RANGE: ::USAGE = 0x32; +pub const HID_USAGE_DIGITIZER_TIP_SWITCH: ::USAGE = 0x42; +pub const HID_USAGE_DIGITIZER_BARREL_SWITCH: ::USAGE = 0x44; +pub const HID_USAGE_CAMERA_AUTO_FOCUS: ::USAGE = 0x20; +pub const HID_USAGE_CAMERA_SHUTTER: ::USAGE = 0x21; +pub const HID_USAGE_MS_BTH_HF_DIALNUMBER: ::USAGE = 0x21; +pub const HID_USAGE_MS_BTH_HF_DIALMEMORY: ::USAGE = 0x22; diff --git a/third_party/rust/winapi/src/hstring.rs b/third_party/rust/winapi/src/hstring.rs new file mode 100644 index 000000000000..01cfc6d3023a --- /dev/null +++ b/third_party/rust/winapi/src/hstring.rs @@ -0,0 +1,16 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This interface definition contains typedefs for Windows Runtime data types. +DECLARE_HANDLE!(HSTRING, HSTRING__); +#[cfg(target_arch = "x86_64")] +STRUCT!{struct HSTRING_HEADER { + Reserved: [::PVOID; 0], // For alignment + Reserved2: [::c_char; 24], +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct HSTRING_HEADER { + Reserved: [::PVOID; 0], // For alignment + Reserved2: [::c_char; 20], +}} +UNION!(HSTRING_HEADER, Reserved2, Reserved1, Reserved1_mut, ::PVOID); +DECLARE_HANDLE!(HSTRING_BUFFER, HSTRING_BUFFER__); diff --git a/third_party/rust/winapi/src/http.rs b/third_party/rust/winapi/src/http.rs new file mode 100644 index 000000000000..b0020f9cab06 --- /dev/null +++ b/third_party/rust/winapi/src/http.rs @@ -0,0 +1,828 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! HTTP API specification +pub const HTTP_INITIALIZE_SERVER: ::ULONG = 0x00000001; +pub const HTTP_INITIALIZE_CONFIG: ::ULONG = 0x00000002; +pub const HTTP_DEMAND_CBT: ::ULONG = 0x00000004; +ENUM!{enum HTTP_SERVER_PROPERTY { + HttpServerAuthenticationProperty, + HttpServerLoggingProperty, + HttpServerQosProperty, + HttpServerTimeoutsProperty, + HttpServerQueueLengthProperty, + HttpServerStateProperty, + HttpServer503VerbosityProperty, + HttpServerBindingProperty, + HttpServerExtendedAuthenticationProperty, + HttpServerListenEndpointProperty, + HttpServerChannelBindProperty, + HttpServerProtectionLevelProperty, +}} +pub type PHTTP_SERVER_PROPERTY = *mut HTTP_SERVER_PROPERTY; +STRUCT!{struct HTTP_PROPERTY_FLAGS { + BitFields: ::ULONG, +}} +BITFIELD!(HTTP_PROPERTY_FLAGS BitFields: ::ULONG [ + Present set_Present[0..1], +]); +pub type PHTTP_PROPERTY_FLAGS = *mut HTTP_PROPERTY_FLAGS; +ENUM!{enum HTTP_ENABLED_STATE { + HttpEnabledStateActive, + HttpEnabledStateInactive, +}} +pub type PHTTP_ENABLED_STATE = *mut HTTP_ENABLED_STATE; +STRUCT!{struct HTTP_STATE_INFO { + Flags: HTTP_PROPERTY_FLAGS, + State: HTTP_ENABLED_STATE, +}} +pub type PHTTP_STATE_INFO = *mut HTTP_STATE_INFO; +ENUM!{enum HTTP_503_RESPONSE_VERBOSITY { + Http503ResponseVerbosityBasic, + Http503ResponseVerbosityLimited, + Http503ResponseVerbosityFull, +}} +pub type PHTTP_503_RESPONSE_VERBOSITY = *mut HTTP_503_RESPONSE_VERBOSITY; +ENUM!{enum HTTP_QOS_SETTING_TYPE { + HttpQosSettingTypeBandwidth, + HttpQosSettingTypeConnectionLimit, + HttpQosSettingTypeFlowRate, +}} +pub type PHTTP_QOS_SETTING_TYPE = *mut HTTP_QOS_SETTING_TYPE; +STRUCT!{struct HTTP_QOS_SETTING_INFO { + QosType: HTTP_QOS_SETTING_TYPE, + QosSetting: ::PVOID, +}} +pub type PHTTP_QOS_SETTING_INFO = *mut HTTP_QOS_SETTING_INFO; +STRUCT!{struct HTTP_CONNECTION_LIMIT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + MaxConnections: ::ULONG, +}} +pub type PHTTP_CONNECTION_LIMIT_INFO = *mut HTTP_CONNECTION_LIMIT_INFO; +STRUCT!{struct HTTP_BANDWIDTH_LIMIT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + MaxBandwidth: ::ULONG, +}} +pub type PHTTP_BANDWIDTH_LIMIT_INFO = *mut HTTP_BANDWIDTH_LIMIT_INFO; +STRUCT!{struct HTTP_FLOWRATE_INFO { + Flags: HTTP_PROPERTY_FLAGS, + MaxBandwidth: ::ULONG, + MaxPeakBandwidth: ::ULONG, + BurstSize: ::ULONG, +}} +pub type PHTTP_FLOWRATE_INFO = *mut HTTP_FLOWRATE_INFO; +pub const HTTP_MIN_ALLOWED_BANDWIDTH_THROTTLING_RATE: ::ULONG = 1024; +pub const HTTP_LIMIT_INFINITE: ::ULONG = !0; +ENUM!{enum HTTP_SERVICE_CONFIG_TIMEOUT_KEY { + IdleConnectionTimeout = 0, + HeaderWaitTimeout, +}} +pub type PHTTP_SERVICE_CONFIG_TIMEOUT_KEY = *mut HTTP_SERVICE_CONFIG_TIMEOUT_KEY; +pub type HTTP_SERVICE_CONFIG_TIMEOUT_PARAM = ::USHORT; +pub type PHTTP_SERVICE_CONFIG_TIMEOUT_PARAM = *mut ::USHORT; +STRUCT!{struct HTTP_SERVICE_CONFIG_TIMEOUT_SET { + KeyDesc: HTTP_SERVICE_CONFIG_TIMEOUT_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_TIMEOUT_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_TIMEOUT_SET = *mut HTTP_SERVICE_CONFIG_TIMEOUT_SET; +STRUCT!{struct HTTP_TIMEOUT_LIMIT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + EntityBody: ::USHORT, + DrainEntityBody: ::USHORT, + RequestQueue: ::USHORT, + IdleConnection: ::USHORT, + HeaderWait: ::USHORT, + MinSendRate: ::ULONG, +}} +pub type PHTTP_TIMEOUT_LIMIT_INFO = *mut HTTP_TIMEOUT_LIMIT_INFO; +STRUCT!{struct HTTP_LISTEN_ENDPOINT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + EnableSharing: ::BOOLEAN, +}} +pub type PHTTP_LISTEN_ENDPOINT_INFO = *mut HTTP_LISTEN_ENDPOINT_INFO; +STRUCT!{struct HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS { + DomainNameLength: ::USHORT, + DomainName: ::PWSTR, + RealmLength: ::USHORT, + Realm: ::PWSTR, +}} +pub type PHTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS = *mut HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS; +STRUCT!{struct HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS { + RealmLength: ::USHORT, + Realm: ::PWSTR, +}} +pub type PHTTP_SERVER_AUTHENTICATION_BASIC_PARAMS = *mut HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS; +pub const HTTP_AUTH_ENABLE_BASIC: ::ULONG = 0x00000001; +pub const HTTP_AUTH_ENABLE_DIGEST: ::ULONG = 0x00000002; +pub const HTTP_AUTH_ENABLE_NTLM: ::ULONG = 0x00000004; +pub const HTTP_AUTH_ENABLE_NEGOTIATE: ::ULONG = 0x00000008; +pub const HTTP_AUTH_ENABLE_KERBEROS: ::ULONG = 0x00000010; +pub const HTTP_AUTH_ENABLE_ALL: ::ULONG = HTTP_AUTH_ENABLE_BASIC | HTTP_AUTH_ENABLE_DIGEST | + HTTP_AUTH_ENABLE_NTLM | HTTP_AUTH_ENABLE_NEGOTIATE | HTTP_AUTH_ENABLE_KERBEROS; +pub const HTTP_AUTH_EX_FLAG_ENABLE_KERBEROS_CREDENTIAL_CACHING: ::UCHAR = 0x01; +pub const HTTP_AUTH_EX_FLAG_CAPTURE_CREDENTIAL: ::UCHAR = 0x02; +STRUCT!{struct HTTP_SERVER_AUTHENTICATION_INFO { + Flags: HTTP_PROPERTY_FLAGS, + AuthSchemes: ::ULONG, + ReceiveMutualAuth: ::BOOLEAN, + ReceiveContextHandle: ::BOOLEAN, + DisableNTLMCredentialCaching: ::BOOLEAN, + ExFlags: ::UCHAR, + DigestParams: HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS, + BasicParams: HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS, +}} +pub type PHTTP_SERVER_AUTHENTICATION_INFO = *mut HTTP_SERVER_AUTHENTICATION_INFO; +ENUM!{enum HTTP_SERVICE_BINDING_TYPE { + HttpServiceBindingTypeNone = 0, + HttpServiceBindingTypeW, + HttpServiceBindingTypeA, +}} +STRUCT!{struct HTTP_SERVICE_BINDING_BASE { + Type: HTTP_SERVICE_BINDING_TYPE, +}} +pub type PHTTP_SERVICE_BINDING_BASE = *mut HTTP_SERVICE_BINDING_BASE; +STRUCT!{struct HTTP_SERVICE_BINDING_A { + Base: HTTP_SERVICE_BINDING_BASE, + Buffer: ::PCHAR, + BufferSize: ::ULONG, +}} +pub type PHTTP_SERVICE_BINDING_A = *mut HTTP_SERVICE_BINDING_A; +STRUCT!{struct HTTP_SERVICE_BINDING_W { + Base: HTTP_SERVICE_BINDING_BASE, + Buffer: ::PWCHAR, + BufferSize: ::ULONG, +}} +pub type PHTTP_SERVICE_BINDING_W = *mut HTTP_SERVICE_BINDING_W; +ENUM!{enum HTTP_AUTHENTICATION_HARDENING_LEVELS { + HttpAuthenticationHardeningLegacy = 0, + HttpAuthenticationHardeningMedium, + HttpAuthenticationHardeningStrict, +}} +pub const HTTP_CHANNEL_BIND_PROXY: ::ULONG = 0x1; +pub const HTTP_CHANNEL_BIND_PROXY_COHOSTING: ::ULONG = 0x20; +pub const HTTP_CHANNEL_BIND_NO_SERVICE_NAME_CHECK: ::ULONG = 0x2; +pub const HTTP_CHANNEL_BIND_DOTLESS_SERVICE: ::ULONG = 0x4; +pub const HTTP_CHANNEL_BIND_SECURE_CHANNEL_TOKEN: ::ULONG = 0x8; +pub const HTTP_CHANNEL_BIND_CLIENT_SERVICE: ::ULONG = 0x10; +STRUCT!{struct HTTP_CHANNEL_BIND_INFO { + Hardening: HTTP_AUTHENTICATION_HARDENING_LEVELS, + Flags: ::ULONG, + ServiceNames: *mut PHTTP_SERVICE_BINDING_BASE, + NumberOfServiceNames: ::ULONG, +}} +pub type PHTTP_CHANNEL_BIND_INFO = *mut HTTP_CHANNEL_BIND_INFO; +STRUCT!{struct HTTP_REQUEST_CHANNEL_BIND_STATUS { + ServiceName: PHTTP_SERVICE_BINDING_BASE, + ChannelToken: ::PUCHAR, + ChannelTokenSize: ::ULONG, + Flags: ::ULONG, +}} +pub type PHTTP_REQUEST_CHANNEL_BIND_STATUS = *mut HTTP_REQUEST_CHANNEL_BIND_STATUS; +pub const HTTP_LOG_FIELD_DATE: ::ULONG = 0x00000001; +pub const HTTP_LOG_FIELD_TIME: ::ULONG = 0x00000002; +pub const HTTP_LOG_FIELD_CLIENT_IP: ::ULONG = 0x00000004; +pub const HTTP_LOG_FIELD_USER_NAME: ::ULONG = 0x00000008; +pub const HTTP_LOG_FIELD_SITE_NAME: ::ULONG = 0x00000010; +pub const HTTP_LOG_FIELD_COMPUTER_NAME: ::ULONG = 0x00000020; +pub const HTTP_LOG_FIELD_SERVER_IP: ::ULONG = 0x00000040; +pub const HTTP_LOG_FIELD_METHOD: ::ULONG = 0x00000080; +pub const HTTP_LOG_FIELD_URI_STEM: ::ULONG = 0x00000100; +pub const HTTP_LOG_FIELD_URI_QUERY: ::ULONG = 0x00000200; +pub const HTTP_LOG_FIELD_STATUS: ::ULONG = 0x00000400; +pub const HTTP_LOG_FIELD_WIN32_STATUS: ::ULONG = 0x00000800; +pub const HTTP_LOG_FIELD_BYTES_SENT: ::ULONG = 0x00001000; +pub const HTTP_LOG_FIELD_BYTES_RECV: ::ULONG = 0x00002000; +pub const HTTP_LOG_FIELD_TIME_TAKEN: ::ULONG = 0x00004000; +pub const HTTP_LOG_FIELD_SERVER_PORT: ::ULONG = 0x00008000; +pub const HTTP_LOG_FIELD_USER_AGENT: ::ULONG = 0x00010000; +pub const HTTP_LOG_FIELD_COOKIE: ::ULONG = 0x00020000; +pub const HTTP_LOG_FIELD_REFERER: ::ULONG = 0x00040000; +pub const HTTP_LOG_FIELD_VERSION: ::ULONG = 0x00080000; +pub const HTTP_LOG_FIELD_HOST: ::ULONG = 0x00100000; +pub const HTTP_LOG_FIELD_SUB_STATUS: ::ULONG = 0x00200000; +pub const HTTP_LOG_FIELD_CLIENT_PORT: ::ULONG = 0x00400000; +pub const HTTP_LOG_FIELD_URI: ::ULONG = 0x00800000; +pub const HTTP_LOG_FIELD_SITE_ID: ::ULONG = 0x01000000; +pub const HTTP_LOG_FIELD_REASON: ::ULONG = 0x02000000; +pub const HTTP_LOG_FIELD_QUEUE_NAME: ::ULONG = 0x04000000; +ENUM!{enum HTTP_LOGGING_TYPE { + HttpLoggingTypeW3C, + HttpLoggingTypeIIS, + HttpLoggingTypeNCSA, + HttpLoggingTypeRaw, +}} +ENUM!{enum HTTP_LOGGING_ROLLOVER_TYPE { + HttpLoggingRolloverSize, + HttpLoggingRolloverDaily, + HttpLoggingRolloverWeekly, + HttpLoggingRolloverMonthly, + HttpLoggingRolloverHourly, +}} +pub const HTTP_MIN_ALLOWED_LOG_FILE_ROLLOVER_SIZE: ::ULONG = (1 * 1024 * 1024) as ::ULONG; +pub const HTTP_LOGGING_FLAG_LOCAL_TIME_ROLLOVER: ::ULONG = 0x00000001; +pub const HTTP_LOGGING_FLAG_USE_UTF8_CONVERSION: ::ULONG = 0x00000002; +pub const HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY: ::ULONG = 0x00000004; +pub const HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY: ::ULONG = 0x00000008; +STRUCT!{struct HTTP_LOGGING_INFO { + Flags: HTTP_PROPERTY_FLAGS, + LoggingFlags: ::ULONG, + SoftwareName: ::PCWSTR, + SoftwareNameLength: ::USHORT, + DirectoryNameLength: ::USHORT, + DirectoryName: ::PCWSTR, + Format: HTTP_LOGGING_TYPE, + Fields: ::ULONG, + pExtFields: ::PVOID, + NumOfExtFields: ::USHORT, + MaxRecordSize: ::USHORT, + RolloverType: HTTP_LOGGING_ROLLOVER_TYPE, + RolloverSize: ::ULONG, + pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, +}} +pub type PHTTP_LOGGING_INFO = *mut HTTP_LOGGING_INFO; +STRUCT!{struct HTTP_BINDING_INFO { + Flags: HTTP_PROPERTY_FLAGS, + RequestQueueHandle: ::HANDLE, +}} +pub type PHTTP_BINDING_INFO = *mut HTTP_BINDING_INFO; +ENUM!{enum HTTP_PROTECTION_LEVEL_TYPE { + HttpProtectionLevelUnrestricted, + HttpProtectionLevelEdgeRestricted, + HttpProtectionLevelRestricted, +}} +pub type PHTTP_PROTECTION_LEVEL_TYPE = *mut HTTP_PROTECTION_LEVEL_TYPE; +STRUCT!{struct HTTP_PROTECTION_LEVEL_INFO { + Flags: HTTP_PROPERTY_FLAGS, + Level: HTTP_PROTECTION_LEVEL_TYPE, +}} +pub type PHTTP_PROTECTION_LEVEL_INFO = *mut HTTP_PROTECTION_LEVEL_INFO; +pub const HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING: ::ULONG = 0x00000001; +pub const HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER: ::ULONG = 0x00000002; +pub const HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY: ::ULONG = 0x00000001; +pub const HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY: ::ULONG = 0x00000002; +pub const HTTP_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER: ::ULONG = 0x00000001; +pub const HTTP_SEND_RESPONSE_FLAG_DISCONNECT: ::ULONG = 0x00000001; +pub const HTTP_SEND_RESPONSE_FLAG_MORE_DATA: ::ULONG = 0x00000002; +pub const HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA: ::ULONG = 0x00000004; +pub const HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING: ::ULONG = 0x00000008; +pub const HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES: ::ULONG = 0x00000020; +pub const HTTP_SEND_RESPONSE_FLAG_OPAQUE: ::ULONG = 0x00000040; +pub const HTTP_FLUSH_RESPONSE_FLAG_RECURSIVE: ::ULONG = 0x00000001; +pub type HTTP_OPAQUE_ID = ::ULONGLONG; +pub type PHTTP_OPAQUE_ID = *mut ::ULONGLONG; +pub type HTTP_REQUEST_ID = HTTP_OPAQUE_ID; +pub type PHTTP_REQUEST_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_CONNECTION_ID = HTTP_OPAQUE_ID; +pub type PHTTP_CONNECTION_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_RAW_CONNECTION_ID = HTTP_OPAQUE_ID; +pub type PHTTP_RAW_CONNECTION_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_URL_GROUP_ID = HTTP_OPAQUE_ID; +pub type PHTTP_URL_GROUP_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_SERVER_SESSION_ID = HTTP_OPAQUE_ID; +pub type PHTTP_SERVER_SESSION_ID = *mut HTTP_OPAQUE_ID; +pub const HTTP_BYTE_RANGE_TO_EOF: ::ULONGLONG = !0; +STRUCT!{struct HTTP_BYTE_RANGE { + StartingOffset: ::ULARGE_INTEGER, + Length: ::ULARGE_INTEGER, +}} +pub type PHTTP_BYTE_RANGE = *mut HTTP_BYTE_RANGE; +STRUCT!{struct HTTP_VERSION { + MajorVersion: ::USHORT, + MinorVersion: ::USHORT, +}} +pub type PHTTP_VERSION = *mut HTTP_VERSION; +pub const HTTP_VERSION_UNKNOWN: HTTP_VERSION = HTTP_VERSION { MajorVersion: 0, MinorVersion: 0 }; +pub const HTTP_VERSION_0_9: HTTP_VERSION = HTTP_VERSION { MajorVersion: 0, MinorVersion: 9 }; +pub const HTTP_VERSION_1_0: HTTP_VERSION = HTTP_VERSION { MajorVersion: 1, MinorVersion: 0 }; +pub const HTTP_VERSION_1_1: HTTP_VERSION = HTTP_VERSION { MajorVersion: 1, MinorVersion: 1 }; +#[inline] #[allow(dead_code)] +pub fn HTTP_SET_VERSION(mut version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) { + version.MajorVersion = major; + version.MinorVersion = minor; +} +#[inline] #[allow(dead_code)] +pub fn HTTP_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + version.MajorVersion == major && version.MinorVersion == minor +} +#[inline] #[allow(dead_code)] +pub fn HTTP_GREATER_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + version.MajorVersion > major || (version.MajorVersion == major && version.MinorVersion > minor) +} +#[inline] #[allow(dead_code)] +pub fn HTTP_LESS_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + version.MajorVersion < major || (version.MajorVersion == major && version.MinorVersion < minor) +} +#[inline] #[allow(dead_code)] +pub fn HTTP_NOT_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + !HTTP_EQUAL_VERSION(version, major, minor) +} +#[inline] #[allow(dead_code)] +pub fn HTTP_GREATER_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + !HTTP_LESS_VERSION(version, major, minor) +} +#[inline] #[allow(dead_code)] +pub fn HTTP_LESS_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + !HTTP_GREATER_VERSION(version, major, minor) +} +ENUM!{enum HTTP_VERB { + HttpVerbUnparsed, + HttpVerbUnknown, + HttpVerbInvalid, + HttpVerbOPTIONS, + HttpVerbGET, + HttpVerbHEAD, + HttpVerbPOST, + HttpVerbPUT, + HttpVerbDELETE, + HttpVerbTRACE, + HttpVerbCONNECT, + HttpVerbTRACK, + HttpVerbMOVE, + HttpVerbCOPY, + HttpVerbPROPFIND, + HttpVerbPROPPATCH, + HttpVerbMKCOL, + HttpVerbLOCK, + HttpVerbUNLOCK, + HttpVerbSEARCH, + HttpVerbMaximum, +}} +pub type PHTTP_VERB = *mut HTTP_VERB; +ENUM!{enum HTTP_HEADER_ID { + HttpHeaderCacheControl = 0, + HttpHeaderConnection = 1, + HttpHeaderDate = 2, + HttpHeaderKeepAlive = 3, + HttpHeaderPragma = 4, + HttpHeaderTrailer = 5, + HttpHeaderTransferEncoding = 6, + HttpHeaderUpgrade = 7, + HttpHeaderVia = 8, + HttpHeaderWarning = 9, + HttpHeaderAllow = 10, + HttpHeaderContentLength = 11, + HttpHeaderContentType = 12, + HttpHeaderContentEncoding = 13, + HttpHeaderContentLanguage = 14, + HttpHeaderContentLocation = 15, + HttpHeaderContentMd5 = 16, + HttpHeaderContentRange = 17, + HttpHeaderExpires = 18, + HttpHeaderLastModified = 19, + HttpHeaderAccept = 20, + HttpHeaderAcceptCharset = 21, + HttpHeaderAcceptEncoding = 22, + HttpHeaderAcceptLanguage = 23, + HttpHeaderAuthorization = 24, + HttpHeaderCookie = 25, + HttpHeaderExpect = 26, + HttpHeaderFrom = 27, + HttpHeaderHost = 28, + HttpHeaderIfMatch = 29, + HttpHeaderIfModifiedSince = 30, + HttpHeaderIfNoneMatch = 31, + HttpHeaderIfRange = 32, + HttpHeaderIfUnmodifiedSince = 33, + HttpHeaderMaxForwards = 34, + HttpHeaderProxyAuthorization = 35, + HttpHeaderReferer = 36, + HttpHeaderRange = 37, + HttpHeaderTe = 38, + HttpHeaderTranslate = 39, + HttpHeaderUserAgent = 40, + HttpHeaderRequestMaximum = 41, + HttpHeaderAcceptRanges = 20, + HttpHeaderAge = 21, + HttpHeaderEtag = 22, + HttpHeaderLocation = 23, + HttpHeaderProxyAuthenticate = 24, + HttpHeaderRetryAfter = 25, + HttpHeaderServer = 26, + HttpHeaderSetCookie = 27, + HttpHeaderVary = 28, + HttpHeaderWwwAuthenticate = 29, + HttpHeaderResponseMaximum = 30, + HttpHeaderMaximum = 41, +}} +pub type PHTTP_HEADER_ID = *mut HTTP_HEADER_ID; +STRUCT!{struct HTTP_KNOWN_HEADER { + RawValueLength: ::USHORT, + pRawValue: ::PCSTR, +}} +pub type PHTTP_KNOWN_HEADER = *mut HTTP_KNOWN_HEADER; +STRUCT!{struct HTTP_UNKNOWN_HEADER { + NameLength: ::USHORT, + RawValueLength: ::USHORT, + pName: ::PCSTR, + pRawValue: ::PCSTR, +}} +pub type PHTTP_UNKNOWN_HEADER = *mut HTTP_UNKNOWN_HEADER; +ENUM!{enum HTTP_LOG_DATA_TYPE { + HttpLogDataTypeFields = 0, +}} +pub type PHTTP_LOG_DATA_TYPE = *mut HTTP_LOG_DATA_TYPE; +STRUCT!{struct HTTP_LOG_DATA { + Type: HTTP_LOG_DATA_TYPE, +}} +pub type PHTTP_LOG_DATA = *mut HTTP_LOG_DATA; +STRUCT!{struct HTTP_LOG_FIELDS_DATA { + Base: HTTP_LOG_DATA, + UserNameLength: ::USHORT, + UriStemLength: ::USHORT, + ClientIpLength: ::USHORT, + ServerNameLength: ::USHORT, + ServiceNameLength: ::USHORT, + ServerIpLength: ::USHORT, + MethodLength: ::USHORT, + UriQueryLength: ::USHORT, + HostLength: ::USHORT, + UserAgentLength: ::USHORT, + CookieLength: ::USHORT, + ReferrerLength: ::USHORT, + UserName: ::PWCHAR, + UriStem: ::PWCHAR, + ClientIp: ::PCHAR, + ServerName: ::PCHAR, + ServiceName: ::PCHAR, + ServerIp: ::PCHAR, + Method: ::PCHAR, + UriQuery: ::PCHAR, + Host: ::PCHAR, + UserAgent: ::PCHAR, + Cookie: ::PCHAR, + Referrer: ::PCHAR, + ServerPort: ::USHORT, + ProtocolStatus: ::USHORT, + Win32Status: ::ULONG, + MethodNum: HTTP_VERB, + SubStatus: ::USHORT, +}} +pub type PHTTP_LOG_FIELDS_DATA = *mut HTTP_LOG_FIELDS_DATA; +ENUM!{enum HTTP_DATA_CHUNK_TYPE { + HttpDataChunkFromMemory, + HttpDataChunkFromFileHandle, + HttpDataChunkFromFragmentCache, + HttpDataChunkFromFragmentCacheEx, + HttpDataChunkMaximum, +}} +pub type PHTTP_DATA_CHUNK_TYPE = *mut HTTP_DATA_CHUNK_TYPE; +STRUCT!{struct HTTP_DATA_CHUNK_FromMemory { + pBuffer: ::PVOID, + BufferLength: ::ULONG, +}} +STRUCT!{struct HTTP_DATA_CHUNK_FromFileHandle { + ByteRange: HTTP_BYTE_RANGE, + FileHandle: ::HANDLE, +}} +STRUCT!{struct HTTP_DATA_CHUNK_FromFragmentCache { + FragmentNameLength: ::USHORT, + pFragmentName: ::PCWSTR, +}} +STRUCT!{struct HTTP_DATA_CHUNK_FromFragmentCacheEx { + ByteRange: HTTP_BYTE_RANGE, + pFragmentName: ::PCWSTR, +}} +STRUCT!{struct HTTP_DATA_CHUNK { + DataChunkType: HTTP_DATA_CHUNK_TYPE, + FromFileHandle: HTTP_DATA_CHUNK_FromFileHandle, +}} +UNION!(HTTP_DATA_CHUNK, FromFileHandle, FromMemory, FromMemory_mut, HTTP_DATA_CHUNK_FromMemory); +UNION!( + HTTP_DATA_CHUNK, FromFileHandle, FromFragmentCache, FromFragmentCache_mut, + HTTP_DATA_CHUNK_FromFragmentCache +); +UNION!( + HTTP_DATA_CHUNK, FromFileHandle, FromFragmentCacheEx, FromFragmentCacheEx_mut, + HTTP_DATA_CHUNK_FromFragmentCacheEx +); +pub type PHTTP_DATA_CHUNK = *mut HTTP_DATA_CHUNK; +STRUCT!{nodebug struct HTTP_REQUEST_HEADERS { + UnknownHeaderCount: ::USHORT, + pUnknownHeaders: PHTTP_UNKNOWN_HEADER, + TrailerCount: ::USHORT, + pTrailers: PHTTP_UNKNOWN_HEADER, + KnownHeaders: [HTTP_KNOWN_HEADER; 41], // FIXME HttpHeaderRequestMaximum +}} +pub type PHTTP_REQUEST_HEADERS = *mut HTTP_REQUEST_HEADERS; +STRUCT!{nodebug struct HTTP_RESPONSE_HEADERS { + UnknownHeaderCount: ::USHORT, + pUnknownHeaders: PHTTP_UNKNOWN_HEADER, + TrailerCount: ::USHORT, + pTrailers: PHTTP_UNKNOWN_HEADER, + KnownHeaders: [HTTP_KNOWN_HEADER; 30], // FIXME HttpHeaderResponseMaximum +}} +pub type PHTTP_RESPONSE_HEADERS = *mut HTTP_RESPONSE_HEADERS; +STRUCT!{struct HTTP_TRANSPORT_ADDRESS { + pRemoteAddress: ::PSOCKADDR, + pLocalAddress: ::PSOCKADDR, +}} +pub type PHTTP_TRANSPORT_ADDRESS = *mut HTTP_TRANSPORT_ADDRESS; +STRUCT!{struct HTTP_COOKED_URL { + FullUrlLength: ::USHORT, + HostLength: ::USHORT, + AbsPathLength: ::USHORT, + QueryStringLength: ::USHORT, + pFullUrl: ::PCWSTR, + pHost: ::PCWSTR, + pAbsPath: ::PCWSTR, + pQueryString: ::PCWSTR, +}} +pub type PHTTP_COOKED_URL = *mut HTTP_COOKED_URL; +pub type HTTP_URL_CONTEXT = ::ULONGLONG; +pub const HTTP_URL_FLAG_REMOVE_ALL: ::ULONG = 0x00000001; +ENUM!{enum HTTP_AUTH_STATUS { + HttpAuthStatusSuccess, + HttpAuthStatusNotAuthenticated, + HttpAuthStatusFailure, +}} +pub type PHTTP_AUTH_STATUS = *mut HTTP_AUTH_STATUS; +ENUM!{enum HTTP_REQUEST_AUTH_TYPE { + HttpRequestAuthTypeNone = 0, + HttpRequestAuthTypeBasic, + HttpRequestAuthTypeDigest, + HttpRequestAuthTypeNTLM, + HttpRequestAuthTypeNegotiate, + HttpRequestAuthTypeKerberos, +}} +pub type PHTTP_REQUEST_AUTH_TYPE = *mut HTTP_REQUEST_AUTH_TYPE; +STRUCT!{struct HTTP_SSL_CLIENT_CERT_INFO { + CertFlags: ::ULONG, + CertEncodedSize: ::ULONG, + pCertEncoded: ::PUCHAR, + Token: ::HANDLE, + CertDeniedByMapper: ::BOOLEAN, +}} +pub type PHTTP_SSL_CLIENT_CERT_INFO = *mut HTTP_SSL_CLIENT_CERT_INFO; +pub const HTTP_RECEIVE_SECURE_CHANNEL_TOKEN: ::ULONG = 0x1; +STRUCT!{struct HTTP_SSL_INFO { + ServerCertKeySize: ::USHORT, + ConnectionKeySize: ::USHORT, + ServerCertIssuerSize: ::ULONG, + ServerCertSubjectSize: ::ULONG, + pServerCertIssuer: ::PCSTR, + pServerCertSubject: ::PCSTR, + pClientCertInfo: PHTTP_SSL_CLIENT_CERT_INFO, + SslClientCertNegotiated: ::ULONG, +}} +pub type PHTTP_SSL_INFO = *mut HTTP_SSL_INFO; +ENUM!{enum HTTP_REQUEST_INFO_TYPE { + HttpRequestInfoTypeAuth, + HttpRequestInfoTypeChannelBind, +}} +STRUCT!{struct HTTP_REQUEST_INFO { + InfoType: HTTP_REQUEST_INFO_TYPE, + InfoLength: ::ULONG, + pInfo: ::PVOID, +}} +pub type PHTTP_REQUEST_INFO = *mut HTTP_REQUEST_INFO; +pub const HTTP_REQUEST_AUTH_FLAG_TOKEN_FOR_CACHED_CRED: ::ULONG = 0x00000001; +STRUCT!{struct HTTP_REQUEST_AUTH_INFO { + AuthStatus: HTTP_AUTH_STATUS, + SecStatus: ::SECURITY_STATUS, + Flags: ::ULONG, + AuthType: HTTP_REQUEST_AUTH_TYPE, + AccessToken: ::HANDLE, + ContextAttributes: ::ULONG, + PackedContextLength: ::ULONG, + PackedContextType: ::ULONG, + PackedContext: ::PVOID, + MutualAuthDataLength: ::ULONG, + pMutualAuthData: ::PCHAR, + PackageNameLength: ::USHORT, + pPackageName: ::PWSTR, +}} +pub type PHTTP_REQUEST_AUTH_INFO = *mut HTTP_REQUEST_AUTH_INFO; +STRUCT!{nodebug struct HTTP_REQUEST_V1 { + Flags: ::ULONG, + ConnectionId: HTTP_CONNECTION_ID, + RequestId: HTTP_REQUEST_ID, + UrlContext: HTTP_URL_CONTEXT, + Version: HTTP_VERSION, + Verb: HTTP_VERB, + UnknownVerbLength: ::USHORT, + RawUrlLength: ::USHORT, + pUnknownVerb: ::PCSTR, + pRawUrl: ::PCSTR, + CookedUrl: HTTP_COOKED_URL, + Address: HTTP_TRANSPORT_ADDRESS, + Headers: HTTP_REQUEST_HEADERS, + BytesReceived: ::ULONGLONG, + EntityChunkCount: ::USHORT, + pEntityChunks: PHTTP_DATA_CHUNK, + RawConnectionId: HTTP_RAW_CONNECTION_ID, + pSslInfo: PHTTP_SSL_INFO, +}} +pub type PHTTP_REQUEST_V1 = *mut HTTP_REQUEST_V1; +STRUCT!{nodebug struct HTTP_REQUEST_V2 { + Base: HTTP_REQUEST_V1, + RequestInfoCount: ::USHORT, + pRequestInfo: PHTTP_REQUEST_INFO, +}} +pub type PHTTP_REQUEST_V2 = *mut HTTP_REQUEST_V2; +pub type HTTP_REQUEST = HTTP_REQUEST_V2; +pub type PHTTP_REQUEST = *mut HTTP_REQUEST; +pub const HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS: ::ULONG = 0x00000001; +pub const HTTP_REQUEST_FLAG_IP_ROUTED: ::ULONG = 0x00000002; +STRUCT!{nodebug struct HTTP_RESPONSE_V1 { + Flags: ::ULONG, + Version: HTTP_VERSION, + StatusCode: ::USHORT, + ReasonLength: ::USHORT, + pReason: ::PCSTR, + Headers: HTTP_RESPONSE_HEADERS, + EntityChunkCount: ::USHORT, + pEntityChunks: PHTTP_DATA_CHUNK, +}} +pub type PHTTP_RESPONSE_V1 = *mut HTTP_RESPONSE_V1; +pub const HTTP_RESPONSE_FLAG_MULTIPLE_ENCODINGS_AVAILABLE: ::ULONG = 0x00000001; +ENUM!{enum HTTP_RESPONSE_INFO_TYPE { + HttpResponseInfoTypeMultipleKnownHeaders, + HttpResponseInfoTypeAuthenticationProperty, + HttpResponseInfoTypeQoSProperty, + HttpResponseInfoTypeChannelBind, +}} +pub type PHTTP_RESPONSE_INFO_TYPE = *mut HTTP_RESPONSE_INFO_TYPE; +STRUCT!{struct HTTP_RESPONSE_INFO { + Type: HTTP_RESPONSE_INFO_TYPE, + Length: ::ULONG, + pInfo: ::PVOID, +}} +pub type PHTTP_RESPONSE_INFO = *mut HTTP_RESPONSE_INFO; +pub const HTTP_RESPONSE_INFO_FLAGS_PRESERVE_ORDER: ::ULONG = 0x00000001; +STRUCT!{struct HTTP_MULTIPLE_KNOWN_HEADERS { + HeaderId: HTTP_HEADER_ID, + Flags: ::ULONG, + KnownHeaderCount: ::USHORT, + KnownHeaders: PHTTP_KNOWN_HEADER, +}} +pub type PHTTP_MULTIPLE_KNOWN_HEADERS = *mut HTTP_MULTIPLE_KNOWN_HEADERS; +STRUCT!{nodebug struct HTTP_RESPONSE_V2 { + Base: HTTP_RESPONSE_V1, + ResponseInfoCount: ::USHORT, + pResponseInfo: PHTTP_RESPONSE_INFO, +}} +pub type PHTTP_RESPONSE_V2 = *mut HTTP_RESPONSE_V2; +pub type HTTP_RESPONSE = HTTP_RESPONSE_V2; +pub type PHTTP_RESPONSE = *mut HTTP_RESPONSE; +STRUCT!{struct HTTPAPI_VERSION { + HttpApiMajorVersion: ::USHORT, + HttpApiMinorVersion: ::USHORT, +}} +pub type PHTTPAPI_VERSION = *mut HTTPAPI_VERSION; +pub const HTTPAPI_VERSION_2: HTTPAPI_VERSION = HTTPAPI_VERSION { + HttpApiMajorVersion: 2, HttpApiMinorVersion: 0, +}; +pub const HTTPAPI_VERSION_1: HTTPAPI_VERSION = HTTPAPI_VERSION { + HttpApiMajorVersion: 1, HttpApiMinorVersion: 0, +}; +#[inline] #[allow(dead_code)] +pub fn HTTPAPI_EQUAL_VERSION(version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + version.HttpApiMajorVersion == major && version.HttpApiMinorVersion == minor +} +#[inline] #[allow(dead_code)] +pub fn HTTPAPI_GREATER_VERSION(version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + version.HttpApiMajorVersion > major || + (version.HttpApiMajorVersion == major && version.HttpApiMinorVersion > minor) +} +#[inline] #[allow(dead_code)] +pub fn HTTPAPI_LESS_VERSION(version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { + version.HttpApiMajorVersion < major || + (version.HttpApiMajorVersion == major && version.HttpApiMinorVersion < minor) +} +#[inline] #[allow(dead_code)] +pub fn HTTPAPI_VERSION_GREATER_OR_EQUAL( + version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT +) -> bool { + !HTTPAPI_LESS_VERSION(version, major, minor) +} +ENUM!{enum HTTP_CACHE_POLICY_TYPE { + HttpCachePolicyNocache, + HttpCachePolicyUserInvalidates, + HttpCachePolicyTimeToLive, + HttpCachePolicyMaximum, +}} +pub type PHTTP_CACHE_POLICY_TYPE = *mut HTTP_CACHE_POLICY_TYPE; +STRUCT!{struct HTTP_CACHE_POLICY { + Policy: HTTP_CACHE_POLICY_TYPE, + SecondsToLive: ::ULONG, +}} +pub type PHTTP_CACHE_POLICY = *mut HTTP_CACHE_POLICY; +ENUM!{enum HTTP_SERVICE_CONFIG_ID { + HttpServiceConfigIPListenList, + HttpServiceConfigSSLCertInfo, + HttpServiceConfigUrlAclInfo, + HttpServiceConfigTimeout, + HttpServiceConfigCache, + HttpServiceConfigSslSniCertInfo, + HttpServiceConfigSslCcsCertInfo, + HttpServiceConfigMax, +}} +pub type PHTTP_SERVICE_CONFIG_ID = *mut HTTP_SERVICE_CONFIG_ID; +ENUM!{enum HTTP_SERVICE_CONFIG_QUERY_TYPE { + HttpServiceConfigQueryExact, + HttpServiceConfigQueryNext, + HttpServiceConfigQueryMax, +}} +pub type PHTTP_SERVICE_CONFIG_QUERY_TYPE = *mut HTTP_SERVICE_CONFIG_QUERY_TYPE; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_KEY { + pIpPort: ::PSOCKADDR, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_KEY = *mut HTTP_SERVICE_CONFIG_SSL_KEY; +STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_SNI_KEY { + IpPort: ::SOCKADDR_STORAGE, + Host: ::PWSTR, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SNI_KEY = *mut HTTP_SERVICE_CONFIG_SSL_SNI_KEY; +STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_CCS_KEY { + LocalAddress: ::SOCKADDR_STORAGE, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_CCS_KEY = *mut HTTP_SERVICE_CONFIG_SSL_CCS_KEY; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_PARAM { + SslHashLength: ::ULONG, + pSslHash: ::PVOID, + AppId: ::GUID, + pSslCertStoreName: ::PWSTR, + DefaultCertCheckMode: ::DWORD, + DefaultRevocationFreshnessTime: ::DWORD, + DefaultRevocationUrlRetrievalTimeout: ::DWORD, + pDefaultSslCtlIdentifier: ::PWSTR, + pDefaultSslCtlStoreName: ::PWSTR, + DefaultFlags: ::DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_PARAM = *mut HTTP_SERVICE_CONFIG_SSL_PARAM; +pub const HTTP_SERVICE_CONFIG_SSL_FLAG_USE_DS_MAPPER: ::DWORD = 0x00000001; +pub const HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT: ::DWORD = 0x00000002; +pub const HTTP_SERVICE_CONFIG_SSL_FLAG_NO_RAW_FILTER: ::DWORD = 0x00000004; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_SET { + KeyDesc: HTTP_SERVICE_CONFIG_SSL_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SET = *mut HTTP_SERVICE_CONFIG_SSL_SET; +STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_SNI_SET { + KeyDesc: HTTP_SERVICE_CONFIG_SSL_SNI_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SNI_SET = *mut HTTP_SERVICE_CONFIG_SSL_SNI_SET; +STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_CCS_SET { + KeyDesc: HTTP_SERVICE_CONFIG_SSL_CCS_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_CCS_SET = *mut HTTP_SERVICE_CONFIG_SSL_CCS_SET; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_SSL_KEY, + dwToken: ::DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_QUERY; +STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_SNI_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_SSL_SNI_KEY, + dwToken: ::DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SNI_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_SNI_QUERY; +STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_CCS_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_SSL_CCS_KEY, + dwToken: ::DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_CCS_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_CCS_QUERY; +STRUCT!{struct HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM { + AddrLength: ::USHORT, + pAddress: ::PSOCKADDR, +}} +pub type PHTTP_SERVICE_CONFIG_IP_LISTEN_PARAM = *mut HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM; +STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY { + AddrCount: ::ULONG, + AddrList: [::SOCKADDR_STORAGE; ::ANYSIZE_ARRAY], +}} +pub type PHTTP_SERVICE_CONFIG_IP_LISTEN_QUERY = *mut HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_KEY { + pUrlPrefix: ::PWSTR, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_KEY = *mut HTTP_SERVICE_CONFIG_URLACL_KEY; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_PARAM { + pStringSecurityDescriptor: ::PWSTR, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_PARAM = *mut HTTP_SERVICE_CONFIG_URLACL_PARAM; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_SET { + KeyDesc: HTTP_SERVICE_CONFIG_URLACL_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_URLACL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_SET = *mut HTTP_SERVICE_CONFIG_URLACL_SET; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_URLACL_KEY, + dwToken: ::DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_QUERY = *mut HTTP_SERVICE_CONFIG_URLACL_QUERY; +ENUM!{enum HTTP_SERVICE_CONFIG_CACHE_KEY { + MaxCacheResponseSize = 0, + CacheRangeChunkSize, +}} +pub type PHTTP_SERVICE_CONFIG_CACHE_KEY = *mut HTTP_SERVICE_CONFIG_CACHE_KEY; +pub type HTTP_SERVICE_CONFIG_CACHE_PARAM = ::ULONG; +pub type PHTTP_SERVICE_CONFIG_CACHE_PARAM = *mut ::ULONG; +STRUCT!{struct HTTP_SERVICE_CONFIG_CACHE_SET { + KeyDesc: HTTP_SERVICE_CONFIG_CACHE_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_CACHE_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_CACHE_SET = *mut HTTP_SERVICE_CONFIG_CACHE_SET; diff --git a/third_party/rust/winapi/src/imm.rs b/third_party/rust/winapi/src/imm.rs new file mode 100644 index 000000000000..cadf6cf7ffa3 --- /dev/null +++ b/third_party/rust/winapi/src/imm.rs @@ -0,0 +1,3 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub type LPUINT = *mut ::c_uint; diff --git a/third_party/rust/winapi/src/inaddr.rs b/third_party/rust/winapi/src/inaddr.rs new file mode 100644 index 000000000000..f89e9babe6ca --- /dev/null +++ b/third_party/rust/winapi/src/inaddr.rs @@ -0,0 +1,22 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! IPv4 Internet address +STRUCT!{struct in_addr_S_un_b { + s_b1: ::UCHAR, + s_b2: ::UCHAR, + s_b3: ::UCHAR, + s_b4: ::UCHAR, +}} +STRUCT!{struct in_addr_S_un_w { + s_w1: ::USHORT, + s_w2: ::USHORT, +}} +STRUCT!{struct in_addr { + S_un: ::ULONG, +}} +UNION!(in_addr, S_un, S_un_b, S_un_b_mut, in_addr_S_un_b); +UNION!(in_addr, S_un, S_un_w, S_un_w_mut, in_addr_S_un_w); +UNION!(in_addr, S_un, S_addr, S_addr_mut, ::ULONG); +pub type IN_ADDR = in_addr; +pub type PIN_ADDR = *mut in_addr; +pub type LPIN_ADDR = *mut in_addr; diff --git a/third_party/rust/winapi/src/inspectable.rs b/third_party/rust/winapi/src/inspectable.rs new file mode 100644 index 000000000000..36575e1e50d3 --- /dev/null +++ b/third_party/rust/winapi/src/inspectable.rs @@ -0,0 +1,15 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub type LPINSPECTABLE = *mut IInspectable; +ENUM!{enum TrustLevel { + BaseTrust = 0, + PartialTrust, + FullTrust, +}} +RIDL!( +interface IInspectable(IInspectableVtbl): IUnknown(IUnknownVtbl) { + fn GetIids(&mut self, iidCount: *mut ::ULONG, iids: *mut *mut ::IID) -> ::HRESULT, + fn GetRuntimeClassName(&mut self, className: *mut ::HSTRING) -> ::HRESULT, + fn GetTrustLevel(&mut self, trustLevel: *mut TrustLevel) -> ::HRESULT +} +); diff --git a/third_party/rust/winapi/src/ksmedia.rs b/third_party/rust/winapi/src/ksmedia.rs new file mode 100644 index 000000000000..8ef270071627 --- /dev/null +++ b/third_party/rust/winapi/src/ksmedia.rs @@ -0,0 +1,18 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_ANALOG, 0x6DBA3190, 0x67BD, 0x11CF, + 0xA0, 0xF7, 0x00, 0x20, 0xAF, 0xD1, 0x56, 0xE4); +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, + 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, + 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_DRM, 0x00000009, 0x0000, 0x0010, + 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_ALAW, 0x00000006, 0x0000, 0x0010, + 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_MULAW, 0x00000007, 0x0000, 0x0010, + 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_ADPCM, 0x00000002, 0x0000, 0x0010, + 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); +DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_MPEG, 0x00000050, 0x0000, 0x0010, + 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); diff --git a/third_party/rust/winapi/src/lib.rs b/third_party/rust/winapi/src/lib.rs new file mode 100644 index 000000000000..0e99f815a8f4 --- /dev/null +++ b/third_party/rust/winapi/src/lib.rs @@ -0,0 +1,368 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Types and constants for WinAPI bindings. +#![allow(bad_style)] +#![warn(trivial_casts, trivial_numeric_casts)] +#![warn(unused_qualifications, unused)] +#![cfg(windows)] +//------------------------------------------------------------------------------------------------- +// Imports +//------------------------------------------------------------------------------------------------- +pub use std::os::raw::{ + c_void, + c_char, + c_schar, + c_uchar, + c_short, + c_ushort, + c_int, + c_uint, + c_long, + c_ulong, + c_longlong, + c_ulonglong, + c_float, + c_double, +}; +pub use activation::*; +pub use audioclient::*; +pub use audiosessiontypes::*; +pub use basetsd::*; +pub use bcrypt::*; +pub use cfg::*; +pub use cfgmgr32::*; +pub use combaseapi::*; +pub use commctrl::*; +pub use commdlg::*; +pub use corsym::*; +pub use d2d1::*; +pub use d2dbasetypes::*; +pub use d3d9::*; +pub use d3d9caps::*; +pub use d3d9types::*; +pub use d3d11::*; +pub use d3d10shader::*; +pub use d3d11shader::*; +pub use d3d12::*; +pub use d3d12sdklayers::*; +pub use d3d12shader::*; +pub use d3dcommon::*; +pub use d3dcompiler::*; +pub use dbghelp::*; +pub use dcommon::*; +pub use devpropdef::*; +pub use docobj::*; +pub use dpapi::*; +pub use dsgetdc::*; +pub use dsound::*; +pub use dsrole::*; +pub use dwmapi::*; +pub use dwrite::*; +pub use dxgi::*; +pub use dxgi1_2::*; +pub use dxgi1_3::*; +pub use dxgi1_4::*; +pub use dxgiformat::*; +pub use dxgitype::*; +pub use errhandlingapi::*; +pub use excpt::*; +pub use fileapi::*; +pub use gl::*; +pub use guiddef::*; +pub use heapapi::*; +pub use hidclass::*; +pub use hidpi::*; +pub use hidsdi::*; +pub use hidusage::*; +pub use hstring::*; +pub use http::*; +pub use imm::*; +pub use inaddr::*; +pub use inspectable::*; +pub use ksmedia::*; +pub use libloaderapi::*; +pub use lmaccess::*; +pub use lmcons::*; +pub use lmdfs::*; +pub use lmerrlog::*; +pub use lmjoin::*; +pub use lsalookup::*; +pub use memoryapi::*; +pub use minschannel::*; +pub use minwinbase::*; +pub use minwindef::*; +pub use mmdeviceapi::*; +pub use mmreg::*; +pub use mmsystem::*; +pub use mscat::*; +pub use mssip::*; +pub use nb30::*; +pub use ncrypt::*; +pub use ntdef::*; +pub use ntsecapi::*; +pub use ntstatus::*; +pub use oaidl::*; +pub use objbase::*; +pub use objidl::*; +pub use objidlbase::*; +pub use olectl::*; +pub use pdh::*; +pub use playsoundapi::*; +pub use processsnapshot::*; +pub use processthreadsapi::*; +pub use propidl::*; +pub use propsys::*; +pub use prsht::*; +pub use psapi::*; +pub use qos::*; +pub use reason::*; +pub use restrictederrorinfo::*; +pub use roapi::*; +pub use roerrorapi::*; +pub use rpc::*; +pub use rpcdce::*; +pub use sapi::*; +pub use schannel::*; +pub use servprov::*; +pub use setupapi::*; +pub use shellapi::*; +pub use shellscalingapi::*; +pub use shlguid::*; +pub use shlobj::*; +pub use shobjidl::*; +pub use shtypes::*; +pub use spapidef::*; +pub use sqltypes::*; +pub use sspi::*; +pub use strmif::*; +pub use subauth::*; +pub use synchapi::*; +pub use sysinfoapi::*; +pub use threadpoolapi::*; +pub use timezoneapi::*; +pub use tlhelp32::*; +pub use unknwnbase::*; +pub use urlhist::*; +pub use urlmon::*; +pub use usb::*; +pub use usbspec::*; +pub use usp10::*; +pub use vadefs::*; +pub use vsbackup::*; +pub use vss::*; +pub use vsserror::*; +pub use vswriter::*; +pub use werapi::*; +pub use winbase::*; +pub use wincon::*; +pub use wincred::*; +pub use wincrypt::*; +pub use windowsx::*; +pub use windef::*; +pub use windowscodecs::*; +pub use winerror::*; +pub use winevt::*; +pub use wingdi::*; +pub use winhttp::*; +pub use winioctl::*; +pub use winnetwk::*; +pub use winnls::*; +pub use winnt::*; +pub use winreg::*; +pub use winscard::*; +pub use winsmcrd::*; +pub use winsock2::*; +pub use winspool::*; +pub use winstring::*; +pub use winsvc::*; +pub use winusb::*; +pub use winusbio::*; +pub use winuser::*; +pub use ws2def::*; +pub use ws2ipdef::*; +pub use ws2spi::*; +pub use ws2tcpip::*; +pub use wtypes::*; +pub use wtypesbase::*; +pub use xinput::*; +//------------------------------------------------------------------------------------------------- +// Modules +//------------------------------------------------------------------------------------------------- +#[macro_use] mod macros; +pub mod activation; +pub mod audioclient; +pub mod audiosessiontypes; +pub mod basetsd; +pub mod bcrypt; +pub mod cfg; +pub mod cfgmgr32; +pub mod combaseapi; +pub mod commctrl; +pub mod commdlg; +pub mod corsym; +pub mod d2d1; +pub mod d2dbasetypes; +pub mod d3d9; +pub mod d3d9caps; +pub mod d3d9types; +pub mod d3d11; +pub mod d3d10shader; +pub mod d3d11shader; +pub mod d3d12; +pub mod d3d12sdklayers; +pub mod d3d12shader; +pub mod d3dcommon; +pub mod d3dcompiler; +pub mod dbghelp; +pub mod dcommon; +pub mod devpropdef; +pub mod docobj; +pub mod dpapi; +pub mod dsgetdc; +pub mod dsound; +pub mod dsrole; +pub mod dwmapi; +pub mod dwrite; +pub mod dxgi; +pub mod dxgi1_2; +pub mod dxgi1_3; +pub mod dxgi1_4; +pub mod dxgiformat; +pub mod dxgitype; +pub mod errhandlingapi; +pub mod excpt; +pub mod fileapi; +pub mod gl; +pub mod guiddef; +pub mod heapapi; +pub mod hidclass; +pub mod hidpi; +pub mod hidsdi; +pub mod hidusage; +pub mod hstring; +pub mod http; +pub mod imm; +pub mod inaddr; +pub mod inspectable; +pub mod ksmedia; +pub mod libloaderapi; +pub mod lmaccess; +pub mod lmcons; +pub mod lmdfs; +pub mod lmerrlog; +pub mod lmjoin; +pub mod lsalookup; +pub mod memoryapi; +pub mod minschannel; +pub mod minwinbase; +pub mod minwindef; +pub mod mmdeviceapi; +pub mod mmreg; +pub mod mmsystem; +pub mod mscat; +pub mod mssip; +pub mod nb30; +pub mod ncrypt; +pub mod ntdef; +pub mod ntsecapi; +pub mod ntstatus; +pub mod oaidl; +pub mod objbase; +pub mod objidl; +pub mod objidlbase; +pub mod olectl; +pub mod pdh; +pub mod playsoundapi; +pub mod processsnapshot; +pub mod processthreadsapi; +pub mod propidl; +pub mod propsys; +pub mod prsht; +pub mod psapi; +pub mod qos; +pub mod reason; +pub mod restrictederrorinfo; +pub mod roapi; +pub mod roerrorapi; +pub mod rpc; +pub mod rpcdce; +pub mod sapi; +pub mod schannel; +pub mod servprov; +pub mod setupapi; +pub mod shellapi; +pub mod shellscalingapi; +pub mod shlguid; +pub mod shlobj; +pub mod shobjidl; +pub mod shtypes; +pub mod spapidef; +pub mod sqltypes; +pub mod sspi; +pub mod strmif; +pub mod subauth; +pub mod synchapi; +pub mod sysinfoapi; +pub mod threadpoolapi; +pub mod timezoneapi; +pub mod tlhelp32; +pub mod unknwnbase; +pub mod urlhist; +pub mod urlmon; +pub mod usb; +pub mod usbspec; +pub mod usp10; +pub mod vadefs; +pub mod vsbackup; +pub mod vss; +pub mod vsserror; +pub mod vswriter; +pub mod werapi; +pub mod winbase; +pub mod wincon; +pub mod wincred; +pub mod wincrypt; +pub mod windef; +pub mod windowscodecs; +pub mod windowsx; +pub mod winerror; +pub mod winevt; +pub mod wingdi; +pub mod winhttp; +pub mod winioctl; +pub mod winnetwk; +pub mod winnls; +pub mod winnt; +pub mod winreg; +pub mod winscard; +pub mod winsmcrd; +pub mod winsock2; +pub mod winspool; +pub mod winstring; +pub mod winsvc; +pub mod winusb; +pub mod winusbio; +pub mod winuser; +pub mod ws2def; +pub mod ws2ipdef; +pub mod ws2spi; +pub mod ws2tcpip; +pub mod wtypes; +pub mod wtypesbase; +pub mod xinput; +//------------------------------------------------------------------------------------------------- +// Primitive types not provided by std +//------------------------------------------------------------------------------------------------- +pub type __int8 = i8; +pub type __uint8 = u8; +pub type __int16 = i16; +pub type __uint16 = u16; +pub type __int32 = i32; +pub type __uint32 = u32; +pub type __int64 = i64; +pub type __uint64 = u64; +pub type wchar_t = c_ushort; +#[cfg(target_arch = "x86")] +pub type size_t = c_uint; +#[cfg(target_arch = "x86_64")] +pub type size_t = __uint64; diff --git a/third_party/rust/winapi/src/libloaderapi.rs b/third_party/rust/winapi/src/libloaderapi.rs new file mode 100644 index 000000000000..9b47b0af88d0 --- /dev/null +++ b/third_party/rust/winapi/src/libloaderapi.rs @@ -0,0 +1,23 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-libraryloader-l1 +pub type DLL_DIRECTORY_COOKIE = ::PVOID; +pub type PDLL_DIRECTORY_COOKIE = *mut ::PVOID; +pub type ENUMRESLANGPROCA = Option ::BOOL>; +pub type ENUMRESLANGPROCW = Option ::BOOL>; +pub type ENUMRESNAMEPROCA = Option ::BOOL>; +pub type ENUMRESNAMEPROCW = Option ::BOOL>; +pub type ENUMRESTYPEPROCA = Option ::BOOL>; +pub type ENUMRESTYPEPROCW = Option ::BOOL>; diff --git a/third_party/rust/winapi/src/lmaccess.rs b/third_party/rust/winapi/src/lmaccess.rs new file mode 100644 index 000000000000..2768f8c32eea --- /dev/null +++ b/third_party/rust/winapi/src/lmaccess.rs @@ -0,0 +1,853 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +// This file contains structures, function prototypes, and definitions +// for the NetUser, NetUserModals, NetGroup, NetAccess, and NetLogon API. +STRUCT!{struct USER_INFO_0 { + usri0_name: ::LPWSTR, +}} +pub type PUSER_INFO_0 = *mut USER_INFO_0; +pub type LPUSER_INFO_0 = *mut USER_INFO_0; +STRUCT!{struct USER_INFO_1 { + usri1_name: ::LPWSTR, + usri1_password: ::LPWSTR, + usri1_password_age: ::DWORD, + usri1_priv: ::DWORD, + usri1_home_dir: ::LPWSTR, + usri1_comment: ::LPWSTR, + usri1_flags: ::DWORD, + usri1_script_path: ::LPWSTR, +}} +pub type PUSER_INFO_1 = *mut USER_INFO_1; +pub type LPUSER_INFO_1 = *mut USER_INFO_1; +STRUCT!{struct USER_INFO_2 { + usri2_name: ::LPWSTR, + usri2_password: ::LPWSTR, + usri2_password_age: ::DWORD, + usri2_priv: ::DWORD, + usri2_home_dir: ::LPWSTR, + usri2_comment: ::LPWSTR, + usri2_flags: ::DWORD, + usri2_script_path: ::LPWSTR, + usri2_auth_flags: ::DWORD, + usri2_full_name: ::LPWSTR, + usri2_usr_comment: ::LPWSTR, + usri2_parms: ::LPWSTR, + usri2_workstations: ::LPWSTR, + usri2_last_logon: ::DWORD, + usri2_last_logoff: ::DWORD, + usri2_acct_expires: ::DWORD, + usri2_max_storage: ::DWORD, + usri2_units_per_week: ::DWORD, + usri2_logon_hours: ::PBYTE, + usri2_bad_pw_count: ::DWORD, + usri2_num_logons: ::DWORD, + usri2_logon_server: ::LPWSTR, + usri2_country_code: ::DWORD, + usri2_code_page: ::DWORD, +}} +pub type PUSER_INFO_2 = *mut USER_INFO_2; +pub type LPUSER_INFO_2 = *mut USER_INFO_2; +STRUCT!{struct USER_INFO_3 { + usri3_name: ::LPWSTR, + usri3_password: ::LPWSTR, + usri3_password_age: ::DWORD, + usri3_priv: ::DWORD, + usri3_home_dir: ::LPWSTR, + usri3_comment: ::LPWSTR, + usri3_flags: ::DWORD, + usri3_script_path: ::LPWSTR, + usri3_auth_flags: ::DWORD, + usri3_full_name: ::LPWSTR, + usri3_usr_comment: ::LPWSTR, + usri3_parms: ::LPWSTR, + usri3_workstations: ::LPWSTR, + usri3_last_logon: ::DWORD, + usri3_last_logoff: ::DWORD, + usri3_acct_expires: ::DWORD, + usri3_max_storage: ::DWORD, + usri3_units_per_week: ::DWORD, + usri3_logon_hours: ::PBYTE, + usri3_bad_pw_count: ::DWORD, + usri3_num_logons: ::DWORD, + usri3_logon_server: ::LPWSTR, + usri3_country_code: ::DWORD, + usri3_code_page: ::DWORD, + usri3_user_id: ::DWORD, + usri3_primary_group_id: ::DWORD, + usri3_profile: ::LPWSTR, + usri3_home_dir_drive: ::LPWSTR, + usri3_password_expired: ::DWORD, +}} +pub type PUSER_INFO_3 = *mut USER_INFO_3; +pub type LPUSER_INFO_3 = *mut USER_INFO_3; +STRUCT!{struct USER_INFO_4 { + usri4_name: ::LPWSTR, + usri4_password: ::LPWSTR, + usri4_password_age: ::DWORD, + usri4_priv: ::DWORD, + usri4_home_dir: ::LPWSTR, + usri4_comment: ::LPWSTR, + usri4_flags: ::DWORD, + usri4_script_path: ::LPWSTR, + usri4_auth_flags: ::DWORD, + usri4_full_name: ::LPWSTR, + usri4_usr_comment: ::LPWSTR, + usri4_parms: ::LPWSTR, + usri4_workstations: ::LPWSTR, + usri4_last_logon: ::DWORD, + usri4_last_logoff: ::DWORD, + usri4_acct_expires: ::DWORD, + usri4_max_storage: ::DWORD, + usri4_units_per_week: ::DWORD, + usri4_logon_hours: ::PBYTE, + usri4_bad_pw_count: ::DWORD, + usri4_num_logons: ::DWORD, + usri4_logon_server: ::LPWSTR, + usri4_country_code: ::DWORD, + usri4_code_page: ::DWORD, + usri4_user_sid: ::PSID, + usri4_primary_group_id: ::DWORD, + usri4_profile: ::LPWSTR, + usri4_home_dir_drive: ::LPWSTR, + usri4_password_expired: ::DWORD, +}} +pub type PUSER_INFO_4 = *mut USER_INFO_4; +pub type LPUSER_INFO_4 = *mut USER_INFO_4; +STRUCT!{struct USER_INFO_10 { + usri10_name: ::LPWSTR, + usri10_comment: ::LPWSTR, + usri10_usr_comment: ::LPWSTR, + usri10_full_name: ::LPWSTR, +}} +pub type PUSER_INFO_10 = *mut USER_INFO_10; +pub type LPUSER_INFO_10 = *mut USER_INFO_10; +STRUCT!{struct USER_INFO_11 { + usri11_name: ::LPWSTR, + usri11_comment: ::LPWSTR, + usri11_usr_comment: ::LPWSTR, + usri11_full_name: ::LPWSTR, + usri11_priv: ::DWORD, + usri11_auth_flags: ::DWORD, + usri11_password_age: ::DWORD, + usri11_home_dir: ::LPWSTR, + usri11_parms: ::LPWSTR, + usri11_last_logon: ::DWORD, + usri11_last_logoff: ::DWORD, + usri11_bad_pw_count: ::DWORD, + usri11_num_logons: ::DWORD, + usri11_logon_server: ::LPWSTR, + usri11_country_code: ::DWORD, + usri11_workstations: ::LPWSTR, + usri11_max_storage: ::DWORD, + usri11_units_per_week: ::DWORD, + usri11_logon_hours: ::PBYTE, + usri11_code_page: ::DWORD, +}} +pub type PUSER_INFO_11 = *mut USER_INFO_11; +pub type LPUSER_INFO_11 = *mut USER_INFO_11; +STRUCT!{struct USER_INFO_20 { + usri20_name: ::LPWSTR, + usri20_full_name: ::LPWSTR, + usri20_comment: ::LPWSTR, + usri20_flags: ::DWORD, + usri20_user_id: ::DWORD, +}} +pub type PUSER_INFO_20 = *mut USER_INFO_20; +pub type LPUSER_INFO_20 = *mut USER_INFO_20; +STRUCT!{struct USER_INFO_21 { + usri21_password: [::BYTE; ::ENCRYPTED_PWLEN], +}} +pub type PUSER_INFO_21 = *mut USER_INFO_21; +pub type LPUSER_INFO_21 = *mut USER_INFO_21; +STRUCT!{struct USER_INFO_22 { + usri22_name: ::LPWSTR, + usri22_password: [::BYTE; ::ENCRYPTED_PWLEN], + usri22_password_age: ::DWORD, + usri22_priv: ::DWORD, + usri22_home_dir: ::LPWSTR, + usri22_comment: ::LPWSTR, + usri22_flags: ::DWORD, + usri22_script_path: ::LPWSTR, + usri22_auth_flags: ::DWORD, + usri22_full_name: ::LPWSTR, + usri22_usr_comment: ::LPWSTR, + usri22_parms: ::LPWSTR, + usri22_workstations: ::LPWSTR, + usri22_last_logon: ::DWORD, + usri22_last_logoff: ::DWORD, + usri22_acct_expires: ::DWORD, + usri22_max_storage: ::DWORD, + usri22_units_per_week: ::DWORD, + usri22_logon_hours: ::PBYTE, + usri22_bad_pw_count: ::DWORD, + usri22_num_logons: ::DWORD, + usri22_logon_server: ::LPWSTR, + usri22_country_code: ::DWORD, + usri22_code_page: ::DWORD, +}} +pub type PUSER_INFO_22 = *mut USER_INFO_22; +pub type LPUSER_INFO_22 = *mut USER_INFO_22; +STRUCT!{struct USER_INFO_23 { + usri23_name: ::LPWSTR, + usri23_full_name: ::LPWSTR, + usri23_comment: ::LPWSTR, + usri23_flags: ::DWORD, + usri23_user_sid: ::PSID, +}} +pub type PUSER_INFO_23 = *mut USER_INFO_23; +pub type LPUSER_INFO_23 = *mut USER_INFO_23; +STRUCT!{struct USER_INFO_24 { + usri24_internet_identity: ::BOOL, + usri24_flags: ::DWORD, + usri24_internet_provider_name: ::LPWSTR, + usri24_internet_principal_name: ::LPWSTR, + usri24_user_sid: ::PSID, +}} +pub type PUSER_INFO_24 = *mut USER_INFO_24; +pub type LPUSER_INFO_24 = *mut USER_INFO_24; +STRUCT!{struct USER_INFO_1003 { + usri1003_password: ::LPWSTR, +}} +pub type PUSER_INFO_1003 = *mut USER_INFO_1003; +pub type LPUSER_INFO_1003 = *mut USER_INFO_1003; +STRUCT!{struct USER_INFO_1005 { + usri1005_priv: ::DWORD, +}} +pub type PUSER_INFO_1005 = *mut USER_INFO_1005; +pub type LPUSER_INFO_1005 = *mut USER_INFO_1005; +STRUCT!{struct USER_INFO_1006 { + usri1006_home_dir: ::LPWSTR, +}} +pub type PUSER_INFO_1006 = *mut USER_INFO_1006; +pub type LPUSER_INFO_1006 = *mut USER_INFO_1006; +STRUCT!{struct USER_INFO_1007 { + usri1007_comment: ::LPWSTR, +}} +pub type PUSER_INFO_1007 = *mut USER_INFO_1007; +pub type LPUSER_INFO_1007 = *mut USER_INFO_1007; +STRUCT!{struct USER_INFO_1008 { + usri1008_flags: ::DWORD, +}} +pub type PUSER_INFO_1008 = *mut USER_INFO_1008; +pub type LPUSER_INFO_1008 = *mut USER_INFO_1008; +STRUCT!{struct USER_INFO_1009 { + usri1009_script_path: ::LPWSTR, +}} +pub type PUSER_INFO_1009 = *mut USER_INFO_1009; +pub type LPUSER_INFO_1009 = *mut USER_INFO_1009; +STRUCT!{struct USER_INFO_1010 { + usri1010_auth_flags: ::DWORD, +}} +pub type PUSER_INFO_1010 = *mut USER_INFO_1010; +pub type LPUSER_INFO_1010 = *mut USER_INFO_1010; +STRUCT!{struct USER_INFO_1011 { + usri1011_full_name: ::LPWSTR, +}} +pub type PUSER_INFO_1011 = *mut USER_INFO_1011; +pub type LPUSER_INFO_1011 = *mut USER_INFO_1011; +STRUCT!{struct USER_INFO_1012 { + usri1012_usr_comment: ::LPWSTR, +}} +pub type PUSER_INFO_1012 = *mut USER_INFO_1012; +pub type LPUSER_INFO_1012 = *mut USER_INFO_1012; +STRUCT!{struct USER_INFO_1013 { + usri1013_parms: ::LPWSTR, +}} +pub type PUSER_INFO_1013 = *mut USER_INFO_1013; +pub type LPUSER_INFO_1013 = *mut USER_INFO_1013; +STRUCT!{struct USER_INFO_1014 { + usri1014_workstations: ::LPWSTR, +}} +pub type PUSER_INFO_1014 = *mut USER_INFO_1014; +pub type LPUSER_INFO_1014 = *mut USER_INFO_1014; +STRUCT!{struct USER_INFO_1017 { + usri1017_acct_expires: ::DWORD, +}} +pub type PUSER_INFO_1017 = *mut USER_INFO_1017; +pub type LPUSER_INFO_1017 = *mut USER_INFO_1017; +STRUCT!{struct USER_INFO_1018 { + usri1018_max_storage: ::DWORD, +}} +pub type PUSER_INFO_1018 = *mut USER_INFO_1018; +pub type LPUSER_INFO_1018 = *mut USER_INFO_1018; +STRUCT!{struct USER_INFO_1020 { + usri1020_units_per_week: ::DWORD, + usri1020_logon_hours: ::LPBYTE, +}} +pub type PUSER_INFO_1020 = *mut USER_INFO_1020; +pub type LPUSER_INFO_1020 = *mut USER_INFO_1020; +STRUCT!{struct USER_INFO_1023 { + usri1023_logon_server: ::LPWSTR, +}} +pub type PUSER_INFO_1023 = *mut USER_INFO_1023; +pub type LPUSER_INFO_1023 = *mut USER_INFO_1023; +STRUCT!{struct USER_INFO_1024 { + usri1024_country_code: ::DWORD, +}} +pub type PUSER_INFO_1024 = *mut USER_INFO_1024; +pub type LPUSER_INFO_1024 = *mut USER_INFO_1024; +STRUCT!{struct USER_INFO_1025 { + usri1025_code_page: ::DWORD, +}} +pub type PUSER_INFO_1025 = *mut USER_INFO_1025; +pub type LPUSER_INFO_1025 = *mut USER_INFO_1025; +STRUCT!{struct USER_INFO_1051 { + usri1051_primary_group_id: ::DWORD, +}} +pub type PUSER_INFO_1051 = *mut USER_INFO_1051; +pub type LPUSER_INFO_1051 = *mut USER_INFO_1051; +STRUCT!{struct USER_INFO_1052 { + usri1052_profile: ::LPWSTR, +}} +pub type PUSER_INFO_1052 = *mut USER_INFO_1052; +pub type LPUSER_INFO_1052 = *mut USER_INFO_1052; +STRUCT!{struct USER_INFO_1053 { + usri1053_home_dir_drive: ::LPWSTR, +}} +pub type PUSER_INFO_1053 = *mut USER_INFO_1053; +pub type LPUSER_INFO_1053 = *mut USER_INFO_1053; +STRUCT!{struct USER_MODALS_INFO_0 { + usrmod0_min_passwd_len: ::DWORD, + usrmod0_max_passwd_age: ::DWORD, + usrmod0_min_passwd_age: ::DWORD, + usrmod0_force_logoff: ::DWORD, + usrmod0_password_hist_len: ::DWORD, +}} +pub type PUSER_MODALS_INFO_0 = *mut USER_MODALS_INFO_0; +pub type LPUSER_MODALS_INFO_0 = *mut USER_MODALS_INFO_0; +STRUCT!{struct USER_MODALS_INFO_1 { + usrmod1_role: ::DWORD, + usrmod1_primary: ::LPWSTR, +}} +pub type PUSER_MODALS_INFO_1 = *mut USER_MODALS_INFO_1; +pub type LPUSER_MODALS_INFO_1 = *mut USER_MODALS_INFO_1; +STRUCT!{struct USER_MODALS_INFO_2 { + usrmod2_domain_name: ::LPWSTR, + usrmod2_domain_id: ::PSID, +}} +pub type PUSER_MODALS_INFO_2 = *mut USER_MODALS_INFO_2; +pub type LPUSER_MODALS_INFO_2 = *mut USER_MODALS_INFO_2; +STRUCT!{struct USER_MODALS_INFO_3 { + usrmod3_lockout_duration: ::DWORD, + usrmod3_lockout_observation_window: ::DWORD, + usrmod3_lockout_threshold: ::DWORD, +}} +pub type PUSER_MODALS_INFO_3 = *mut USER_MODALS_INFO_3; +pub type LPUSER_MODALS_INFO_3 = *mut USER_MODALS_INFO_3; +STRUCT!{struct USER_MODALS_INFO_1001 { + usrmod1001_min_passwd_len: ::DWORD, +}} +pub type PUSER_MODALS_INFO_1001 = *mut USER_MODALS_INFO_1001; +pub type LPUSER_MODALS_INFO_1001 = *mut USER_MODALS_INFO_1001; +STRUCT!{struct USER_MODALS_INFO_1002 { + usrmod1002_max_passwd_age: ::DWORD, +}} +pub type PUSER_MODALS_INFO_1002 = *mut USER_MODALS_INFO_1002; +pub type LPUSER_MODALS_INFO_1002 = *mut USER_MODALS_INFO_1002; +STRUCT!{struct USER_MODALS_INFO_1003 { + usrmod1003_min_passwd_age: ::DWORD, +}} +pub type PUSER_MODALS_INFO_1003 = *mut USER_MODALS_INFO_1003; +pub type LPUSER_MODALS_INFO_1003 = *mut USER_MODALS_INFO_1003; +STRUCT!{struct USER_MODALS_INFO_1004 { + usrmod1004_force_logoff: ::DWORD, +}} +pub type PUSER_MODALS_INFO_1004 = *mut USER_MODALS_INFO_1004; +pub type LPUSER_MODALS_INFO_1004 = *mut USER_MODALS_INFO_1004; +STRUCT!{struct USER_MODALS_INFO_1005 { + usrmod1005_password_hist_len: ::DWORD, +}} +pub type PUSER_MODALS_INFO_1005 = *mut USER_MODALS_INFO_1005; +pub type LPUSER_MODALS_INFO_1005 = *mut USER_MODALS_INFO_1005; +STRUCT!{struct USER_MODALS_INFO_1006 { + usrmod1006_role: ::DWORD, +}} +pub type PUSER_MODALS_INFO_1006 = *mut USER_MODALS_INFO_1006; +pub type LPUSER_MODALS_INFO_1006 = *mut USER_MODALS_INFO_1006; +STRUCT!{struct USER_MODALS_INFO_1007 { + usrmod1007_primary: ::LPWSTR, +}} +pub type PUSER_MODALS_INFO_1007 = *mut USER_MODALS_INFO_1007; +pub type LPUSER_MODALS_INFO_1007 = *mut USER_MODALS_INFO_1007; +pub const UF_SCRIPT: ::DWORD = 0x0001; +pub const UF_ACCOUNTDISABLE: ::DWORD = 0x0002; +pub const UF_HOMEDIR_REQUIRED: ::DWORD = 0x0008; +pub const UF_LOCKOUT: ::DWORD = 0x0010; +pub const UF_PASSWD_NOTREQD: ::DWORD = 0x0020; +pub const UF_PASSWD_CANT_CHANGE: ::DWORD = 0x0040; +pub const UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED: ::DWORD = 0x0080; +pub const UF_TEMP_DUPLICATE_ACCOUNT: ::DWORD = 0x0100; +pub const UF_NORMAL_ACCOUNT: ::DWORD = 0x0200; +pub const UF_INTERDOMAIN_TRUST_ACCOUNT: ::DWORD = 0x0800; +pub const UF_WORKSTATION_TRUST_ACCOUNT: ::DWORD = 0x1000; +pub const UF_SERVER_TRUST_ACCOUNT: ::DWORD = 0x2000; +pub const UF_MACHINE_ACCOUNT_MASK: ::DWORD = UF_INTERDOMAIN_TRUST_ACCOUNT + | UF_WORKSTATION_TRUST_ACCOUNT | UF_SERVER_TRUST_ACCOUNT; +pub const UF_ACCOUNT_TYPE_MASK: ::DWORD = UF_TEMP_DUPLICATE_ACCOUNT | UF_NORMAL_ACCOUNT + | UF_INTERDOMAIN_TRUST_ACCOUNT | UF_WORKSTATION_TRUST_ACCOUNT | UF_SERVER_TRUST_ACCOUNT; +pub const UF_DONT_EXPIRE_PASSWD: ::DWORD = 0x10000; +pub const UF_MNS_LOGON_ACCOUNT: ::DWORD = 0x20000; +pub const UF_SMARTCARD_REQUIRED: ::DWORD = 0x40000; +pub const UF_TRUSTED_FOR_DELEGATION: ::DWORD = 0x80000; +pub const UF_NOT_DELEGATED: ::DWORD = 0x100000; +pub const UF_USE_DES_KEY_ONLY: ::DWORD = 0x200000; +pub const UF_DONT_REQUIRE_PREAUTH: ::DWORD = 0x400000; +pub const UF_PASSWORD_EXPIRED: ::DWORD = 0x800000; +pub const UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: ::DWORD = 0x1000000; +pub const UF_NO_AUTH_DATA_REQUIRED: ::DWORD = 0x2000000; +pub const UF_PARTIAL_SECRETS_ACCOUNT: ::DWORD = 0x4000000; +pub const UF_USE_AES_KEYS: ::DWORD = 0x8000000; +pub const UF_SETTABLE_BITS: ::DWORD = UF_SCRIPT | UF_ACCOUNTDISABLE | UF_LOCKOUT + | UF_HOMEDIR_REQUIRED | UF_PASSWD_NOTREQD | UF_PASSWD_CANT_CHANGE | UF_ACCOUNT_TYPE_MASK + | UF_DONT_EXPIRE_PASSWD | UF_MNS_LOGON_ACCOUNT | UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED + | UF_SMARTCARD_REQUIRED | UF_TRUSTED_FOR_DELEGATION | UF_NOT_DELEGATED | UF_USE_DES_KEY_ONLY + | UF_DONT_REQUIRE_PREAUTH | UF_PASSWORD_EXPIRED | UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION + | UF_NO_AUTH_DATA_REQUIRED | UF_USE_AES_KEYS | UF_PARTIAL_SECRETS_ACCOUNT; +pub const FILTER_TEMP_DUPLICATE_ACCOUNT: ::DWORD = 0x0001; +pub const FILTER_NORMAL_ACCOUNT: ::DWORD = 0x0002; +pub const FILTER_INTERDOMAIN_TRUST_ACCOUNT: ::DWORD = 0x0008; +pub const FILTER_WORKSTATION_TRUST_ACCOUNT: ::DWORD = 0x0010; +pub const FILTER_SERVER_TRUST_ACCOUNT: ::DWORD = 0x0020; +pub const LG_INCLUDE_INDIRECT: ::DWORD = 0x0001; +pub const AF_OP_PRINT: ::DWORD = 0x1; +pub const AF_OP_COMM: ::DWORD = 0x2; +pub const AF_OP_SERVER: ::DWORD = 0x4; +pub const AF_OP_ACCOUNTS: ::DWORD = 0x8; +pub const AF_SETTABLE_BITS: ::DWORD = AF_OP_PRINT | AF_OP_COMM | AF_OP_SERVER | AF_OP_ACCOUNTS; +pub const UAS_ROLE_STANDALONE: ::DWORD = 0; +pub const UAS_ROLE_MEMBER: ::DWORD = 1; +pub const UAS_ROLE_BACKUP: ::DWORD = 2; +pub const UAS_ROLE_PRIMARY: ::DWORD = 3; +pub const USER_NAME_PARMNUM: ::DWORD = 1; +pub const USER_PASSWORD_PARMNUM: ::DWORD = 3; +pub const USER_PASSWORD_AGE_PARMNUM: ::DWORD = 4; +pub const USER_PRIV_PARMNUM: ::DWORD = 5; +pub const USER_HOME_DIR_PARMNUM: ::DWORD = 6; +pub const USER_COMMENT_PARMNUM: ::DWORD = 7; +pub const USER_FLAGS_PARMNUM: ::DWORD = 8; +pub const USER_SCRIPT_PATH_PARMNUM: ::DWORD = 9; +pub const USER_AUTH_FLAGS_PARMNUM: ::DWORD = 10; +pub const USER_FULL_NAME_PARMNUM: ::DWORD = 11; +pub const USER_USR_COMMENT_PARMNUM: ::DWORD = 12; +pub const USER_PARMS_PARMNUM: ::DWORD = 13; +pub const USER_WORKSTATIONS_PARMNUM: ::DWORD = 14; +pub const USER_LAST_LOGON_PARMNUM: ::DWORD = 15; +pub const USER_LAST_LOGOFF_PARMNUM: ::DWORD = 16; +pub const USER_ACCT_EXPIRES_PARMNUM: ::DWORD = 17; +pub const USER_MAX_STORAGE_PARMNUM: ::DWORD = 18; +pub const USER_UNITS_PER_WEEK_PARMNUM: ::DWORD = 19; +pub const USER_LOGON_HOURS_PARMNUM: ::DWORD = 20; +pub const USER_PAD_PW_COUNT_PARMNUM: ::DWORD = 21; +pub const USER_NUM_LOGONS_PARMNUM: ::DWORD = 22; +pub const USER_LOGON_SERVER_PARMNUM: ::DWORD = 23; +pub const USER_COUNTRY_CODE_PARMNUM: ::DWORD = 24; +pub const USER_CODE_PAGE_PARMNUM: ::DWORD = 25; +pub const USER_PRIMARY_GROUP_PARMNUM: ::DWORD = 51; +pub const USER_PROFILE: ::DWORD = 52; +pub const USER_PROFILE_PARMNUM: ::DWORD = 52; +pub const USER_HOME_DIR_DRIVE_PARMNUM: ::DWORD = 53; +pub const USER_NAME_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_NAME_PARMNUM; +pub const USER_PASSWORD_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_PARMNUM; +pub const USER_PASSWORD_AGE_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_AGE_PARMNUM; +pub const USER_PRIV_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_PRIV_PARMNUM; +pub const USER_HOME_DIR_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_PARMNUM; +pub const USER_COMMENT_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_COMMENT_PARMNUM; +pub const USER_FLAGS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_FLAGS_PARMNUM; +pub const USER_SCRIPT_PATH_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_SCRIPT_PATH_PARMNUM; +pub const USER_AUTH_FLAGS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_AUTH_FLAGS_PARMNUM; +pub const USER_FULL_NAME_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_FULL_NAME_PARMNUM; +pub const USER_USR_COMMENT_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_USR_COMMENT_PARMNUM; +pub const USER_PARMS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_PARMS_PARMNUM; +pub const USER_WORKSTATIONS_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_WORKSTATIONS_PARMNUM; +pub const USER_LAST_LOGON_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGON_PARMNUM; +pub const USER_LAST_LOGOFF_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGOFF_PARMNUM; +pub const USER_ACCT_EXPIRES_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_ACCT_EXPIRES_PARMNUM; +pub const USER_MAX_STORAGE_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_MAX_STORAGE_PARMNUM; +pub const USER_UNITS_PER_WEEK_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_UNITS_PER_WEEK_PARMNUM; +pub const USER_LOGON_HOURS_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_LOGON_HOURS_PARMNUM; +pub const USER_PAD_PW_COUNT_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_PAD_PW_COUNT_PARMNUM; +pub const USER_NUM_LOGONS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_NUM_LOGONS_PARMNUM; +pub const USER_LOGON_SERVER_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_LOGON_SERVER_PARMNUM; +pub const USER_COUNTRY_CODE_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_COUNTRY_CODE_PARMNUM; +pub const USER_CODE_PAGE_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_CODE_PAGE_PARMNUM; +pub const USER_PRIMARY_GROUP_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_PRIMARY_GROUP_PARMNUM; +pub const USER_HOME_DIR_DRIVE_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_DRIVE_PARMNUM; +pub const TIMEQ_FOREVER: ::DWORD = -1i32 as ::DWORD; +pub const USER_MAXSTORAGE_UNLIMITED: ::DWORD = -1i32 as ::DWORD; +pub const USER_NO_LOGOFF: ::DWORD = -1i32 as ::DWORD; +pub const UNITS_PER_DAY: ::DWORD = 24; +pub const UNITS_PER_WEEK: ::DWORD = UNITS_PER_DAY * 7; +pub const USER_PRIV_MASK: ::DWORD = 0x3; +pub const USER_PRIV_GUEST: ::DWORD = 0; +pub const USER_PRIV_USER: ::DWORD = 1; +pub const USER_PRIV_ADMIN: ::DWORD = 2; +pub const MAX_PASSWD_LEN: ::DWORD = ::PWLEN; +pub const DEF_MIN_PWLEN: ::DWORD = 6; +pub const DEF_PWUNIQUENESS: ::DWORD = 5; +pub const DEF_MAX_PWHIST: ::DWORD = 8; +pub const DEF_MAX_PWAGE: ::DWORD = TIMEQ_FOREVER; +pub const DEF_MIN_PWAGE: ::DWORD = 0; +pub const DEF_FORCE_LOGOFF: ::DWORD = 0xffffffff; +pub const DEF_MAX_BADPW: ::DWORD = 0; +pub const ONE_DAY: ::DWORD = 1 * 24 * 3600; +pub const VALIDATED_LOGON: ::DWORD = 0; +pub const PASSWORD_EXPIRED: ::DWORD = 2; +pub const NON_VALIDATED_LOGON: ::DWORD = 3; +pub const VALID_LOGOFF: ::DWORD = 1; +pub const MODALS_MIN_PASSWD_LEN_PARMNUM: ::DWORD = 1; +pub const MODALS_MAX_PASSWD_AGE_PARMNUM: ::DWORD = 2; +pub const MODALS_MIN_PASSWD_AGE_PARMNUM: ::DWORD = 3; +pub const MODALS_FORCE_LOGOFF_PARMNUM: ::DWORD = 4; +pub const MODALS_PASSWD_HIST_LEN_PARMNUM: ::DWORD = 5; +pub const MODALS_ROLE_PARMNUM: ::DWORD = 6; +pub const MODALS_PRIMARY_PARMNUM: ::DWORD = 7; +pub const MODALS_DOMAIN_NAME_PARMNUM: ::DWORD = 8; +pub const MODALS_DOMAIN_ID_PARMNUM: ::DWORD = 9; +pub const MODALS_LOCKOUT_DURATION_PARMNUM: ::DWORD = 10; +pub const MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM: ::DWORD = 11; +pub const MODALS_LOCKOUT_THRESHOLD_PARMNUM: ::DWORD = 12; +pub const MODALS_MIN_PASSWD_LEN_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_LEN_PARMNUM; +pub const MODALS_MAX_PASSWD_AGE_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + MODALS_MAX_PASSWD_AGE_PARMNUM; +pub const MODALS_MIN_PASSWD_AGE_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_AGE_PARMNUM; +pub const MODALS_FORCE_LOGOFF_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + MODALS_FORCE_LOGOFF_PARMNUM; +pub const MODALS_PASSWD_HIST_LEN_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + MODALS_PASSWD_HIST_LEN_PARMNUM; +pub const MODALS_ROLE_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + MODALS_ROLE_PARMNUM; +pub const MODALS_PRIMARY_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + MODALS_PRIMARY_PARMNUM; +pub const MODALS_DOMAIN_NAME_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_NAME_PARMNUM; +pub const MODALS_DOMAIN_ID_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_ID_PARMNUM; +STRUCT!{struct GROUP_INFO_0 { + grpi0_name: ::LPWSTR, +}} +pub type PGROUP_INFO_0 = *mut GROUP_INFO_0; +pub type LPGROUP_INFO_0 = *mut GROUP_INFO_0; +STRUCT!{struct GROUP_INFO_1 { + grpi1_name: ::LPWSTR, + grpi1_comment: ::LPWSTR, +}} +pub type PGROUP_INFO_1 = *mut GROUP_INFO_1; +pub type LPGROUP_INFO_1 = *mut GROUP_INFO_1; +STRUCT!{struct GROUP_INFO_2 { + grpi2_name: ::LPWSTR, + grpi2_comment: ::LPWSTR, + grpi2_group_id: ::DWORD, + grpi2_attributes: ::DWORD, +}} +pub type PGROUP_INFO_2 = *mut GROUP_INFO_2; +STRUCT!{struct GROUP_INFO_3 { + grpi3_name: ::LPWSTR, + grpi3_comment: ::LPWSTR, + grpi3_group_sid: ::PSID, + grpi3_attributes: ::DWORD, +}} +pub type PGROUP_INFO_3 = *mut GROUP_INFO_3; +STRUCT!{struct GROUP_INFO_1002 { + grpi1002_comment: ::LPWSTR, +}} +pub type PGROUP_INFO_1002 = *mut GROUP_INFO_1002; +pub type LPGROUP_INFO_1002 = *mut GROUP_INFO_1002; +STRUCT!{struct GROUP_INFO_1005 { + grpi1005_attributes: ::DWORD, +}} +pub type PGROUP_INFO_1005 = *mut GROUP_INFO_1005; +pub type LPGROUP_INFO_1005 = *mut GROUP_INFO_1005; +STRUCT!{struct GROUP_USERS_INFO_0 { + grui0_name: ::LPWSTR, +}} +pub type PGROUP_USERS_INFO_0 = *mut GROUP_USERS_INFO_0; +pub type LPGROUP_USERS_INFO_0 = *mut GROUP_USERS_INFO_0; +STRUCT!{struct GROUP_USERS_INFO_1 { + grui1_name: ::LPWSTR, + grui1_attributes: ::DWORD, +}} +pub type PGROUP_USERS_INFO_1 = *mut GROUP_USERS_INFO_1; +pub type LPGROUP_USERS_INFO_1 = *mut GROUP_USERS_INFO_1; +pub const GROUPIDMASK: ::DWORD = 0x8000; +pub const GROUP_SPECIALGRP_USERS: &'static str = "USERS"; +pub const GROUP_SPECIALGRP_ADMINS: &'static str = "ADMINS"; +pub const GROUP_SPECIALGRP_GUESTS: &'static str = "GUESTS"; +pub const GROUP_SPECIALGRP_LOCAL: &'static str = "LOCAL"; +pub const GROUP_ALL_PARMNUM: ::DWORD = 0; +pub const GROUP_NAME_PARMNUM: ::DWORD = 1; +pub const GROUP_COMMENT_PARMNUM: ::DWORD = 2; +pub const GROUP_ATTRIBUTES_PARMNUM: ::DWORD = 3; +pub const GROUP_ALL_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_ALL_PARMNUM; +pub const GROUP_NAME_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_NAME_PARMNUM; +pub const GROUP_COMMENT_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_COMMENT_PARMNUM; +pub const GROUP_ATTRIBUTES_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_ATTRIBUTES_PARMNUM; +STRUCT!{struct LOCALGROUP_INFO_0 { + lgrpi0_name: ::LPWSTR, +}} +pub type PLOCALGROUP_INFO_0 = *mut LOCALGROUP_INFO_0; +pub type LPLOCALGROUP_INFO_0 = *mut LOCALGROUP_INFO_0; +STRUCT!{struct LOCALGROUP_INFO_1 { + lgrpi1_name: ::LPWSTR, + lgrpi1_comment: ::LPWSTR, +}} +pub type PLOCALGROUP_INFO_1 = *mut LOCALGROUP_INFO_1; +pub type LPLOCALGROUP_INFO_1 = *mut LOCALGROUP_INFO_1; +STRUCT!{struct LOCALGROUP_INFO_1002 { + lgrpi1002_comment: ::LPWSTR, +}} +pub type PLOCALGROUP_INFO_1002 = *mut LOCALGROUP_INFO_1002; +pub type LPLOCALGROUP_INFO_1002 = *mut LOCALGROUP_INFO_1002; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_0 { + lgrmi0_sid: ::PSID, +}} +pub type PLOCALGROUP_MEMBERS_INFO_0 = *mut LOCALGROUP_MEMBERS_INFO_0; +pub type LPLOCALGROUP_MEMBERS_INFO_0 = *mut LOCALGROUP_MEMBERS_INFO_0; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_1 { + lgrmi1_sid: ::PSID, + lgrmi1_sidusage: ::SID_NAME_USE, + lgrmi1_name: ::LPWSTR, +}} +pub type PLOCALGROUP_MEMBERS_INFO_1 = *mut LOCALGROUP_MEMBERS_INFO_1; +pub type LPLOCALGROUP_MEMBERS_INFO_1 = *mut LOCALGROUP_MEMBERS_INFO_1; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_2 { + lgrmi2_sid: ::PSID, + lgrmi2_sidusage: ::SID_NAME_USE, + lgrmi2_domainandname: ::LPWSTR, +}} +pub type PLOCALGROUP_MEMBERS_INFO_2 = *mut LOCALGROUP_MEMBERS_INFO_2; +pub type LPLOCALGROUP_MEMBERS_INFO_2 = *mut LOCALGROUP_MEMBERS_INFO_2; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_3 { + lgrmi3_domainandname: ::LPWSTR, +}} +pub type PLOCALGROUP_MEMBERS_INFO_3 = *mut LOCALGROUP_MEMBERS_INFO_3; +pub type LPLOCALGROUP_MEMBERS_INFO_3 = *mut LOCALGROUP_MEMBERS_INFO_3; +STRUCT!{struct LOCALGROUP_USERS_INFO_0 { + lgrui0_name: ::LPWSTR, +}} +pub type PLOCALGROUP_USERS_INFO_0 = *mut LOCALGROUP_USERS_INFO_0; +pub type LPLOCALGROUP_USERS_INFO_0 = *mut LOCALGROUP_USERS_INFO_0; +pub const LOCALGROUP_NAME_PARMNUM: ::DWORD = 1; +pub const LOCALGROUP_COMMENT_PARMNUM: ::DWORD = 2; +STRUCT!{struct NET_DISPLAY_USER { + usri1_name: ::LPWSTR, + usri1_comment: ::LPWSTR, + usri1_flags: ::DWORD, + usri1_full_name: ::LPWSTR, + usri1_user_id: ::DWORD, + usri1_next_index: ::DWORD, +}} +pub type PNET_DISPLAY_USER = *mut NET_DISPLAY_USER; +STRUCT!{struct NET_DISPLAY_MACHINE { + usri2_name: ::LPWSTR, + usri2_comment: ::LPWSTR, + usri2_flags: ::DWORD, + usri2_user_id: ::DWORD, + usri2_next_index: ::DWORD, +}} +pub type PNET_DISPLAY_MACHINE = *mut NET_DISPLAY_MACHINE; +STRUCT!{struct NET_DISPLAY_GROUP { + usri3_name: ::LPWSTR, + usri3_comment: ::LPWSTR, + grpi3_group_id: ::DWORD, + grpi3_attributes: ::DWORD, + grpi3_next_index: ::DWORD, +}} +pub type PNET_DISPLAY_GROUP = *mut NET_DISPLAY_GROUP; +STRUCT!{struct ACCESS_INFO_0 { + acc0_resource_name: ::LPWSTR, +}} +pub type PACCESS_INFO_0 = *mut ACCESS_INFO_0; +pub type LPACCESS_INFO_0 = *mut ACCESS_INFO_0; +STRUCT!{struct ACCESS_INFO_1 { + acc1_resource_name: ::LPWSTR, + acc1_attr: ::DWORD, + acc1_count: ::DWORD, +}} +pub type PACCESS_INFO_1 = *mut ACCESS_INFO_1; +pub type LPACCESS_INFO_1 = *mut ACCESS_INFO_1; +STRUCT!{struct ACCESS_INFO_1002 { + acc1002_attr: ::DWORD, +}} +pub type PACCESS_INFO_1002 = *mut ACCESS_INFO_1002; +pub type LPACCESS_INFO_1002 = *mut ACCESS_INFO_1002; +STRUCT!{struct ACCESS_LIST { + acl_ugname: ::LPWSTR, + acl_access: ::DWORD, +}} +pub type PACCESS_LIST = *mut ACCESS_LIST; +pub type LPACCESS_LIST = *mut ACCESS_LIST; +pub const ACCESS_NONE: ::DWORD = 0; +pub const ACCESS_ALL: ::DWORD = ACCESS_READ | ACCESS_WRITE | ACCESS_CREATE | ACCESS_EXEC + | ACCESS_DELETE | ACCESS_ATRIB | ACCESS_PERM; +pub const ACCESS_READ: ::DWORD = 0x01; +pub const ACCESS_WRITE: ::DWORD = 0x02; +pub const ACCESS_CREATE: ::DWORD = 0x04; +pub const ACCESS_EXEC: ::DWORD = 0x08; +pub const ACCESS_DELETE: ::DWORD = 0x10; +pub const ACCESS_ATRIB: ::DWORD = 0x20; +pub const ACCESS_PERM: ::DWORD = 0x40; +pub const ACCESS_GROUP: ::DWORD = 0x8000; +pub const ACCESS_AUDIT: ::DWORD = 0x1; +pub const ACCESS_SUCCESS_OPEN: ::DWORD = 0x10; +pub const ACCESS_SUCCESS_WRITE: ::DWORD = 0x20; +pub const ACCESS_SUCCESS_DELETE: ::DWORD = 0x40; +pub const ACCESS_SUCCESS_ACL: ::DWORD = 0x80; +pub const ACCESS_SUCCESS_MASK: ::DWORD = 0xF0; +pub const ACCESS_FAIL_OPEN: ::DWORD = 0x100; +pub const ACCESS_FAIL_WRITE: ::DWORD = 0x200; +pub const ACCESS_FAIL_DELETE: ::DWORD = 0x400; +pub const ACCESS_FAIL_ACL: ::DWORD = 0x800; +pub const ACCESS_FAIL_MASK: ::DWORD = 0xF00; +pub const ACCESS_FAIL_SHIFT: ::DWORD = 4; +pub const ACCESS_RESOURCE_NAME_PARMNUM: ::DWORD = 1; +pub const ACCESS_ATTR_PARMNUM: ::DWORD = 2; +pub const ACCESS_COUNT_PARMNUM: ::DWORD = 3; +pub const ACCESS_ACCESS_LIST_PARMNUM: ::DWORD = 4; +pub const ACCESS_RESOURCE_NAME_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + ACCESS_RESOURCE_NAME_PARMNUM; +pub const ACCESS_ATTR_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + ACCESS_ATTR_PARMNUM; +pub const ACCESS_COUNT_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + ACCESS_COUNT_PARMNUM; +pub const ACCESS_ACCESS_LIST_INFOLEVEL: ::DWORD = + ::PARMNUM_BASE_INFOLEVEL + ACCESS_ACCESS_LIST_PARMNUM; +ENUM!{enum NET_VALIDATE_PASSWORD_TYPE { + NetValidateAuthentication = 1, + NetValidatePasswordChange, + NetValidatePasswordReset, +}} +pub type PNET_VALIDATE_PASSWORD_TYPE = *mut NET_VALIDATE_PASSWORD_TYPE; +STRUCT!{struct NET_VALIDATE_PASSWORD_HASH { + Length: ::ULONG, + Hash: ::LPBYTE, +}} +pub type PNET_VALIDATE_PASSWORD_HASH = *mut NET_VALIDATE_PASSWORD_HASH; +pub const NET_VALIDATE_PASSWORD_LAST_SET: ::ULONG = 0x00000001; +pub const NET_VALIDATE_BAD_PASSWORD_TIME: ::ULONG = 0x00000002; +pub const NET_VALIDATE_LOCKOUT_TIME: ::ULONG = 0x00000004; +pub const NET_VALIDATE_BAD_PASSWORD_COUNT: ::ULONG = 0x00000008; +pub const NET_VALIDATE_PASSWORD_HISTORY_LENGTH: ::ULONG = 0x00000010; +pub const NET_VALIDATE_PASSWORD_HISTORY: ::ULONG = 0x00000020; +STRUCT!{struct NET_VALIDATE_PERSISTED_FIELDS { + PresentFields: ::ULONG, + PasswordLastSet: ::FILETIME, + BadPasswordTime: ::FILETIME, + LockoutTime: ::FILETIME, + BadPasswordCount: ::ULONG, + PasswordHistoryLength: ::ULONG, + PasswordHistory: PNET_VALIDATE_PASSWORD_HASH, +}} +pub type PNET_VALIDATE_PERSISTED_FIELDS = *mut NET_VALIDATE_PERSISTED_FIELDS; +STRUCT!{struct NET_VALIDATE_OUTPUT_ARG { + ChangedPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + ValidationStatus: ::NET_API_STATUS, +}} +pub type PNET_VALIDATE_OUTPUT_ARG = *mut NET_VALIDATE_OUTPUT_ARG; +STRUCT!{struct NET_VALIDATE_AUTHENTICATION_INPUT_ARG { + InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + PasswordMatched: ::BOOLEAN, +}} +pub type PNET_VALIDATE_AUTHENTICATION_INPUT_ARG = *mut NET_VALIDATE_AUTHENTICATION_INPUT_ARG; +STRUCT!{struct NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG { + InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + ClearPassword: ::LPWSTR, + UserAccountName: ::LPWSTR, + HashedPassword: NET_VALIDATE_PASSWORD_HASH, + PasswordMatch: ::BOOLEAN, +}} +pub type PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG = *mut NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG; +STRUCT!{struct NET_VALIDATE_PASSWORD_RESET_INPUT_ARG { + InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + ClearPassword: ::LPWSTR, + UserAccountName: ::LPWSTR, + HashedPassword: NET_VALIDATE_PASSWORD_HASH, + PasswordMustChangeAtNextLogon: ::BOOLEAN, + ClearLockout: ::BOOLEAN, +}} +pub type PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG = *mut NET_VALIDATE_PASSWORD_RESET_INPUT_ARG; +pub const NETLOGON_CONTROL_QUERY: ::DWORD = 1; +pub const NETLOGON_CONTROL_REPLICATE: ::DWORD = 2; +pub const NETLOGON_CONTROL_SYNCHRONIZE: ::DWORD = 3; +pub const NETLOGON_CONTROL_PDC_REPLICATE: ::DWORD = 4; +pub const NETLOGON_CONTROL_REDISCOVER: ::DWORD = 5; +pub const NETLOGON_CONTROL_TC_QUERY: ::DWORD = 6; +pub const NETLOGON_CONTROL_TRANSPORT_NOTIFY: ::DWORD = 7; +pub const NETLOGON_CONTROL_FIND_USER: ::DWORD = 8; +pub const NETLOGON_CONTROL_CHANGE_PASSWORD: ::DWORD = 9; +pub const NETLOGON_CONTROL_TC_VERIFY: ::DWORD = 10; +pub const NETLOGON_CONTROL_FORCE_DNS_REG: ::DWORD = 11; +pub const NETLOGON_CONTROL_QUERY_DNS_REG: ::DWORD = 12; +pub const NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL: ::DWORD = 0xFFFB; +pub const NETLOGON_CONTROL_BACKUP_CHANGE_LOG: ::DWORD = 0xFFFC; +pub const NETLOGON_CONTROL_TRUNCATE_LOG: ::DWORD = 0xFFFD; +pub const NETLOGON_CONTROL_SET_DBFLAG: ::DWORD = 0xFFFE; +pub const NETLOGON_CONTROL_BREAKPOINT: ::DWORD = 0xFFFF; +STRUCT!{struct NETLOGON_INFO_1 { + netlog1_flags: ::DWORD, + netlog1_pdc_connection_status: ::NET_API_STATUS, +}} +pub type PNETLOGON_INFO_1 = *mut NETLOGON_INFO_1; +STRUCT!{struct NETLOGON_INFO_2 { + netlog2_flags: ::DWORD, + netlog2_pdc_connection_status: ::NET_API_STATUS, + netlog2_trusted_dc_name: ::LPWSTR, + netlog2_tc_connection_status: ::NET_API_STATUS, +}} +pub type PNETLOGON_INFO_2 = *mut NETLOGON_INFO_2; +STRUCT!{struct NETLOGON_INFO_3 { + netlog3_flags: ::DWORD, + netlog3_logon_attempts: ::DWORD, + netlog3_reserved1: ::DWORD, + netlog3_reserved2: ::DWORD, + netlog3_reserved3: ::DWORD, + netlog3_reserved4: ::DWORD, + netlog3_reserved5: ::DWORD, +}} +pub type PNETLOGON_INFO_3 = *mut NETLOGON_INFO_3; +STRUCT!{struct NETLOGON_INFO_4 { + netlog4_trusted_dc_name: ::LPWSTR, + netlog4_trusted_domain_name: ::LPWSTR, +}} +pub type PNETLOGON_INFO_4 = *mut NETLOGON_INFO_4; +pub const NETLOGON_REPLICATION_NEEDED: ::DWORD = 0x01; +pub const NETLOGON_REPLICATION_IN_PROGRESS: ::DWORD = 0x02; +pub const NETLOGON_FULL_SYNC_REPLICATION: ::DWORD = 0x04; +pub const NETLOGON_REDO_NEEDED: ::DWORD = 0x08; +pub const NETLOGON_HAS_IP: ::DWORD = 0x10; +pub const NETLOGON_HAS_TIMESERV: ::DWORD = 0x20; +pub const NETLOGON_DNS_UPDATE_FAILURE: ::DWORD = 0x40; +pub const NETLOGON_VERIFY_STATUS_RETURNED: ::DWORD = 0x80; +DEFINE_GUID!(ServiceAccountPasswordGUID, 0x262E99C9, 0x6160, 0x4871, + 0xAC, 0xEC, 0x4E, 0x61, 0x73, 0x6B, 0x6F, 0x21); +pub const SERVICE_ACCOUNT_FLAG_LINK_TO_HOST_ONLY: ::DWORD = 0x00000001; +pub const SERVICE_ACCOUNT_FLAG_ADD_AGAINST_RODC: ::DWORD = 0x00000002; +pub const SERVICE_ACCOUNT_FLAG_UNLINK_FROM_HOST_ONLY: ::DWORD = 0x00000001; +pub const SERVICE_ACCOUNT_FLAG_REMOVE_OFFLINE: ::DWORD = 0x00000002; +ENUM!{enum MSA_INFO_LEVEL { + MsaInfoLevel0 = 0, + MsaInfoLevelMax, +}} +pub type PMSA_INFO_LEVEL = *mut MSA_INFO_LEVEL; +ENUM!{enum MSA_INFO_STATE { + MsaInfoNotExist = 1, + MsaInfoNotService, + MsaInfoCannotInstall, + MsaInfoCanInstall, + MsaInfoInstalled, +}} +pub type PMSA_INFO_STATE = *mut MSA_INFO_STATE; +STRUCT!{struct MSA_INFO_0 { + State: MSA_INFO_STATE, +}} +pub type PMSA_INFO_0 = *mut MSA_INFO_0; +pub type LPMSA_INFO_0 = *mut MSA_INFO_0; diff --git a/third_party/rust/winapi/src/lmcons.rs b/third_party/rust/winapi/src/lmcons.rs new file mode 100644 index 000000000000..267db8bfb1ba --- /dev/null +++ b/third_party/rust/winapi/src/lmcons.rs @@ -0,0 +1,55 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This file contains constants used throughout the LAN Manager API header files. +pub const CNLEN: ::DWORD = 15; +pub const LM20_CNLEN: ::DWORD = 15; +pub const DNLEN: ::DWORD = CNLEN; +pub const LM20_DNLEN: ::DWORD = LM20_CNLEN; +pub const UNCLEN: ::DWORD = CNLEN + 2; +pub const LM20_UNCLEN: ::DWORD = LM20_CNLEN + 2; +pub const NNLEN: ::DWORD = 80; +pub const LM20_NNLEN: ::DWORD = 12; +pub const RMLEN: ::DWORD = UNCLEN + 1 + NNLEN; +pub const LM20_RMLEN: ::DWORD = LM20_UNCLEN + 1 + LM20_NNLEN; +pub const SNLEN: ::DWORD = 80; +pub const LM20_SNLEN: ::DWORD = 15; +pub const STXTLEN: ::DWORD = 256; +pub const LM20_STXTLEN: ::DWORD = 63; +pub const PATHLEN: ::DWORD = 256; +pub const LM20_PATHLEN: ::DWORD = 256; +pub const DEVLEN: ::DWORD = 80; +pub const LM20_DEVLEN: ::DWORD = 8; +pub const EVLEN: ::DWORD = 16; +pub const UNLEN: ::DWORD = 256; +pub const LM20_UNLEN: ::DWORD = 20; +pub const GNLEN: ::DWORD = UNLEN; +pub const LM20_GNLEN: ::DWORD = LM20_UNLEN; +pub const PWLEN: ::DWORD = 256; +pub const LM20_PWLEN: ::DWORD = 14; +pub const SHPWLEN: ::DWORD = 8; +pub const CLTYPE_LEN: ::DWORD = 12; +pub const MAXCOMMENTSZ: ::DWORD = 256; +pub const LM20_MAXCOMMENTSZ: ::DWORD = 48; +pub const QNLEN: ::DWORD = NNLEN; +pub const LM20_QNLEN: ::DWORD = LM20_NNLEN; +pub const ALERTSZ: ::DWORD = 128; +pub const MAXDEVENTRIES: ::DWORD = 4 * 8; // FIXME: sizeof(int) instead of 4 +pub const NETBIOS_NAME_LEN: ::DWORD = 16; +pub const MAX_PREFERRED_LENGTH: ::DWORD = -1i32 as ::DWORD; +pub const CRYPT_KEY_LEN: ::DWORD = 7; +pub const CRYPT_TXT_LEN: ::DWORD = 8; +pub const ENCRYPTED_PWLEN: usize = 16; +pub const SESSION_PWLEN: ::DWORD = 24; +pub const SESSION_CRYPT_KLEN: ::DWORD = 21; +pub const PARM_ERROR_UNKNOWN: ::DWORD = -1i32 as ::DWORD; +pub const PARM_ERROR_NONE: ::DWORD = 0; +pub const PARMNUM_BASE_INFOLEVEL: ::DWORD = 1000; +pub type LMSTR = ::LPWSTR; +pub type LMCSTR = ::LPCWSTR; +pub type NET_API_STATUS = ::DWORD; +pub type API_RET_TYPE = NET_API_STATUS; +pub const PLATFORM_ID_DOS: ::DWORD = 300; +pub const PLATFORM_ID_OS2: ::DWORD = 400; +pub const PLATFORM_ID_NT: ::DWORD = 500; +pub const PLATFORM_ID_OSF: ::DWORD = 600; +pub const PLATFORM_ID_VMS: ::DWORD = 700; diff --git a/third_party/rust/winapi/src/lmdfs.rs b/third_party/rust/winapi/src/lmdfs.rs new file mode 100644 index 000000000000..b74c6478905e --- /dev/null +++ b/third_party/rust/winapi/src/lmdfs.rs @@ -0,0 +1,311 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +// This file contains structures, function prototypes, and definitions for the NetDfs API +pub const DFS_VOLUME_STATES: ::DWORD = 0xF; +pub const DFS_VOLUME_STATE_OK: ::DWORD = 1; +pub const DFS_VOLUME_STATE_INCONSISTENT: ::DWORD = 2; +pub const DFS_VOLUME_STATE_OFFLINE: ::DWORD = 3; +pub const DFS_VOLUME_STATE_ONLINE: ::DWORD = 4; +pub const DFS_VOLUME_STATE_RESYNCHRONIZE: ::DWORD = 0x10; +pub const DFS_VOLUME_STATE_STANDBY: ::DWORD = 0x20; +pub const DFS_VOLUME_STATE_FORCE_SYNC: ::DWORD = 0x40; +pub const DFS_VOLUME_FLAVORS: ::DWORD = 0x0300; +pub const DFS_VOLUME_FLAVOR_UNUSED1: ::DWORD = 0x0000; +pub const DFS_VOLUME_FLAVOR_STANDALONE: ::DWORD = 0x0100; +pub const DFS_VOLUME_FLAVOR_AD_BLOB: ::DWORD = 0x0200; +pub const DFS_STORAGE_FLAVOR_UNUSED2: ::DWORD = 0x0300; +pub const DFS_STORAGE_STATES: ::ULONG = 0xF; +pub const DFS_STORAGE_STATE_OFFLINE: ::ULONG = 1; +pub const DFS_STORAGE_STATE_ONLINE: ::ULONG = 2; +pub const DFS_STORAGE_STATE_ACTIVE: ::ULONG = 4; +ENUM!{enum DFS_TARGET_PRIORITY_CLASS { + DfsInvalidPriorityClass = -1i32 as u32, + DfsSiteCostNormalPriorityClass = 0, + DfsGlobalHighPriorityClass, + DfsSiteCostHighPriorityClass, + DfsSiteCostLowPriorityClass, + DfsGlobalLowPriorityClass, +}} +STRUCT!{struct DFS_TARGET_PRIORITY { + TargetPriorityClass: DFS_TARGET_PRIORITY_CLASS, + TargetPriorityRank: ::USHORT, + Reserved: ::USHORT, +}} +pub type PDFS_TARGET_PRIORITY = *mut DFS_TARGET_PRIORITY; +STRUCT!{struct DFS_INFO_1 { + EntryPath: ::LPWSTR, +}} +pub type PDFS_INFO_1 = *mut DFS_INFO_1; +pub type LPDFS_INFO_1 = *mut DFS_INFO_1; +#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_1_32 { + EntryPath: ::ULONG, +}} +#[cfg(target_arch="x86_64")] +pub type PDFS_INFO_1_32 = *mut DFS_INFO_1_32; +#[cfg(target_arch="x86_64")] +pub type LPDFS_INFO_1_32 = *mut DFS_INFO_1_32; +STRUCT!{struct DFS_INFO_2 { + EntryPath: ::LPWSTR, + Comment: ::LPWSTR, + State: ::DWORD, + NumberOfStorages: ::DWORD, +}} +pub type PDFS_INFO_2 = *mut DFS_INFO_2; +pub type LPDFS_INFO_2 = *mut DFS_INFO_2; +#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_2_32 { + EntryPath: ::ULONG, + Comment: ::ULONG, + State: ::DWORD, + NumberOfStorages: ::DWORD, +}} +#[cfg(target_arch="x86_64")] +pub type PDFS_INFO_2_32 = *mut DFS_INFO_2_32; +#[cfg(target_arch="x86_64")] +pub type LPDFS_INFO_2_32 = *mut DFS_INFO_2_32; +STRUCT!{struct DFS_STORAGE_INFO { + State: ::ULONG, + ServerName: ::LPWSTR, + ShareName: ::LPWSTR, +}} +pub type PDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO; +pub type LPDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO; +#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_STORAGE_INFO_0_32 { + State: ::ULONG, + ServerName: ::ULONG, + ShareName: ::ULONG, +}} +#[cfg(target_arch="x86_64")] +pub type PDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32; +#[cfg(target_arch="x86_64")] +pub type LPDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32; +STRUCT!{struct DFS_STORAGE_INFO_1 { + State: ::ULONG, + ServerName: ::LPWSTR, + ShareName: ::LPWSTR, + TargetPriority: DFS_TARGET_PRIORITY, +}} +pub type PDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1; +pub type LPDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1; +STRUCT!{struct DFS_INFO_3 { + EntryPath: ::LPWSTR, + Comment: ::LPWSTR, + State: ::DWORD, + NumberOfStorages: ::DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_3 = *mut DFS_INFO_3; +pub type LPDFS_INFO_3 = *mut DFS_INFO_3; +#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_3_32 { + EntryPath: ::ULONG, + Comment: ::ULONG, + State: ::DWORD, + NumberOfStorages: ::DWORD, + Storage: ::ULONG, +}} +#[cfg(target_arch="x86_64")] +pub type PDFS_INFO_3_32 = *mut DFS_INFO_3_32; +#[cfg(target_arch="x86_64")] +pub type LPDFS_INFO_3_32 = *mut DFS_INFO_3_32; +STRUCT!{struct DFS_INFO_4 { + EntryPath: ::LPWSTR, + Comment: ::LPWSTR, + State: ::DWORD, + Timeout: ::ULONG, + Guid: ::GUID, + NumberOfStorages: ::DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_4 = *mut DFS_INFO_4; +pub type LPDFS_INFO_4 = *mut DFS_INFO_4; +#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_4_32 { + EntryPath: ::ULONG, + Comment: ::ULONG, + State: ::DWORD, + Timeout: ::ULONG, + Guid: ::GUID, + NumberOfStorages: ::DWORD, + Storage: ::ULONG, +}} +#[cfg(target_arch="x86_64")] +pub type PDFS_INFO_4_32 = *mut DFS_INFO_4_32; +#[cfg(target_arch="x86_64")] +pub type LPDFS_INFO_4_32 = *mut DFS_INFO_4_32; +STRUCT!{struct DFS_INFO_5 { + EntryPath: ::LPWSTR, + Comment: ::LPWSTR, + State: ::DWORD, + Timeout: ::ULONG, + Guid: ::GUID, + PropertyFlags: ::ULONG, + MetadataSize: ::ULONG, + NumberOfStorages: ::DWORD, +}} +pub type PDFS_INFO_5 = *mut DFS_INFO_5; +pub type LPDFS_INFO_5 = *mut DFS_INFO_5; +STRUCT!{struct DFS_INFO_6 { + EntryPath: ::LPWSTR, + Comment: ::LPWSTR, + State: ::DWORD, + Timeout: ::ULONG, + Guid: ::GUID, + PropertyFlags: ::ULONG, + MetadataSize: ::ULONG, + NumberOfStorages: ::DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_6 = *mut DFS_INFO_6; +pub type LPDFS_INFO_6 = *mut DFS_INFO_6; +STRUCT!{struct DFS_INFO_7 { + GenerationGuid: ::GUID, +}} +pub type PDFS_INFO_7 = *mut DFS_INFO_7; +pub type LPDFS_INFO_7 = *mut DFS_INFO_7; +STRUCT!{struct DFS_INFO_8 { + EntryPath: ::LPWSTR, + Comment: ::LPWSTR, + State: ::DWORD, + Timeout: ::ULONG, + Guid: ::GUID, + PropertyFlags: ::ULONG, + MetadataSize: ::ULONG, + SdLengthReserved: ::ULONG, + pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, + NumberOfStorages: ::DWORD, +}} +pub type PDFS_INFO_8 = *mut DFS_INFO_8; +pub type LPDFS_INFO_8 = *mut DFS_INFO_8; +STRUCT!{struct DFS_INFO_9 { + EntryPath: ::LPWSTR, + Comment: ::LPWSTR, + State: ::DWORD, + Timeout: ::ULONG, + Guid: ::GUID, + PropertyFlags: ::ULONG, + MetadataSize: ::ULONG, + SdLengthReserved: ::ULONG, + pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, + NumberOfStorages: ::DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_9 = *mut DFS_INFO_9; +pub type LPDFS_INFO_9 = *mut DFS_INFO_9; +pub const DFS_PROPERTY_FLAG_INSITE_REFERRALS: ::ULONG = 0x00000001; +pub const DFS_PROPERTY_FLAG_ROOT_SCALABILITY: ::ULONG = 0x00000002; +pub const DFS_PROPERTY_FLAG_SITE_COSTING: ::ULONG = 0x00000004; +pub const DFS_PROPERTY_FLAG_TARGET_FAILBACK: ::ULONG = 0x00000008; +pub const DFS_PROPERTY_FLAG_CLUSTER_ENABLED: ::ULONG = 0x00000010; +pub const DFS_PROPERTY_FLAG_ABDE: ::ULONG = 0x00000020; +pub const DFS_VALID_PROPERTY_FLAGS: ::ULONG = DFS_PROPERTY_FLAG_INSITE_REFERRALS + | DFS_PROPERTY_FLAG_ROOT_SCALABILITY | DFS_PROPERTY_FLAG_SITE_COSTING + | DFS_PROPERTY_FLAG_TARGET_FAILBACK | DFS_PROPERTY_FLAG_CLUSTER_ENABLED + | DFS_PROPERTY_FLAG_ABDE; +STRUCT!{struct DFS_INFO_50 { + NamespaceMajorVersion: ::ULONG, + NamespaceMinorVersion: ::ULONG, + NamespaceCapabilities: ::ULONGLONG, +}} +pub type PDFS_INFO_50 = *mut DFS_INFO_50; +pub type LPDFS_INFO_50 = *mut DFS_INFO_50; +STRUCT!{struct DFS_INFO_100 { + Comment: ::LPWSTR, +}} +pub type PDFS_INFO_100 = *mut DFS_INFO_100; +pub type LPDFS_INFO_100 = *mut DFS_INFO_100; +STRUCT!{struct DFS_INFO_101 { + State: ::DWORD, +}} +pub type PDFS_INFO_101 = *mut DFS_INFO_101; +pub type LPDFS_INFO_101 = *mut DFS_INFO_101; +STRUCT!{struct DFS_INFO_102 { + Timeout: ::ULONG, +}} +pub type PDFS_INFO_102 = *mut DFS_INFO_102; +pub type LPDFS_INFO_102 = *mut DFS_INFO_102; +STRUCT!{struct DFS_INFO_103 { + PropertyFlagMask: ::ULONG, + PropertyFlags: ::ULONG, +}} +pub type PDFS_INFO_103 = *mut DFS_INFO_103; +pub type LPDFS_INFO_103 = *mut DFS_INFO_103; +STRUCT!{struct DFS_INFO_104 { + TargetPriority: DFS_TARGET_PRIORITY, +}} +pub type PDFS_INFO_104 = *mut DFS_INFO_104; +pub type LPDFS_INFO_104 = *mut DFS_INFO_104; +STRUCT!{struct DFS_INFO_105 { + Comment: ::LPWSTR, + State: ::DWORD, + Timeout: ::ULONG, + PropertyFlagMask: ::ULONG, + PropertyFlags: ::ULONG, +}} +pub type PDFS_INFO_105 = *mut DFS_INFO_105; +pub type LPDFS_INFO_105 = *mut DFS_INFO_105; +STRUCT!{struct DFS_INFO_106 { + State: ::DWORD, + TargetPriority: DFS_TARGET_PRIORITY, +}} +pub type PDFS_INFO_106 = *mut DFS_INFO_106; +pub type LPDFS_INFO_106 = *mut DFS_INFO_106; +STRUCT!{struct DFS_INFO_107 { + Comment: ::LPWSTR, + State: ::DWORD, + Timeout: ::ULONG, + PropertyFlagMask: ::ULONG, + PropertyFlags: ::ULONG, + SdLengthReserved: ::ULONG, + pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, +}} +pub type PDFS_INFO_107 = *mut DFS_INFO_107; +pub type LPDFS_INFO_107 = *mut DFS_INFO_107; +STRUCT!{struct DFS_INFO_150 { + SdLengthReserved: ::ULONG, + pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, +}} +pub type PDFS_INFO_150 = *mut DFS_INFO_150; +pub type LPDFS_INFO_150 = *mut DFS_INFO_150; +STRUCT!{struct DFS_INFO_200 { + FtDfsName: ::LPWSTR, +}} +pub type PDFS_INFO_200 = *mut DFS_INFO_200; +pub type LPDFS_INFO_200 = *mut DFS_INFO_200; +STRUCT!{struct DFS_INFO_300 { + Flags: ::DWORD, + DfsName: ::LPWSTR, +}} +pub type PDFS_INFO_300 = *mut DFS_INFO_300; +pub type LPDFS_INFO_300 = *mut DFS_INFO_300; +pub const DFS_ADD_VOLUME: ::DWORD = 1; +pub const DFS_RESTORE_VOLUME: ::DWORD = 2; +pub const NET_DFS_SETDC_FLAGS: ::DWORD = 0x00000000; +pub const NET_DFS_SETDC_TIMEOUT: ::DWORD = 0x00000001; +pub const NET_DFS_SETDC_INITPKT: ::DWORD = 0x00000002; +STRUCT!{struct DFS_SITENAME_INFO { + SiteFlags: ::ULONG, + SiteName: ::LPWSTR, +}} +pub type PDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO; +pub type LPDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO; +pub const DFS_SITE_PRIMARY: ::ULONG = 0x1; +STRUCT!{struct DFS_SITELIST_INFO { + cSites: ::ULONG, + Site: [DFS_SITENAME_INFO; 1], +}} +pub type PDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO; +pub type LPDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO; +ENUM!{enum DFS_NAMESPACE_VERSION_ORIGIN { + DFS_NAMESPACE_VERSION_ORIGIN_COMBINED = 0, + DFS_NAMESPACE_VERSION_ORIGIN_SERVER, + DFS_NAMESPACE_VERSION_ORIGIN_DOMAIN, +}} +pub type PDFS_NAMESPACE_VERSION_ORIGIN = *mut DFS_NAMESPACE_VERSION_ORIGIN; +pub const DFS_NAMESPACE_CAPABILITY_ABDE: ::ULONGLONG = 0x0000000000000001; +STRUCT!{struct DFS_SUPPORTED_NAMESPACE_VERSION_INFO { + DomainDfsMajorVersion: ::ULONG, + DomainDfsMinorVersion: ::ULONG, + DomainDfsCapabilities: ::ULONGLONG, + StandaloneDfsMajorVersion: ::ULONG, + StandaloneDfsMinorVersion: ::ULONG, + StandaloneDfsCapabilities: ::ULONGLONG, +}} +pub type PDFS_SUPPORTED_NAMESPACE_VERSION_INFO = *mut DFS_SUPPORTED_NAMESPACE_VERSION_INFO; diff --git a/third_party/rust/winapi/src/lmerrlog.rs b/third_party/rust/winapi/src/lmerrlog.rs new file mode 100644 index 000000000000..ebbe3b0fefd8 --- /dev/null +++ b/third_party/rust/winapi/src/lmerrlog.rs @@ -0,0 +1,263 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +STRUCT!{struct ERROR_LOG { + el_len: ::DWORD, + el_reserved: ::DWORD, + el_time: ::DWORD, + el_error: ::DWORD, + el_name: ::LPWSTR, + el_text: ::LPWSTR, + el_data: ::LPBYTE, + el_data_size: ::DWORD, + el_nstrings: ::DWORD, +}} +pub type PERROR_LOG = *mut ERROR_LOG; +pub type LPERROR_LOG = *mut ERROR_LOG; +STRUCT!{struct HLOG { + time: ::DWORD, + last_flags: ::DWORD, + offset: ::DWORD, + rec_offset: ::DWORD, +}} +pub type PHLOG = *mut HLOG; +pub type LPHLOG = *mut HLOG; +pub const LOGFLAGS_FORWARD: ::DWORD = 0; +pub const LOGFLAGS_BACKWARD: ::DWORD = 0x1; +pub const LOGFLAGS_SEEK: ::DWORD = 0x2; +pub const ERRLOG_BASE: ::DWORD = 3100; +pub const NELOG_Internal_Error: ::DWORD = ERRLOG_BASE + 0; +pub const NELOG_Resource_Shortage: ::DWORD = ERRLOG_BASE + 1; +pub const NELOG_Unable_To_Lock_Segment: ::DWORD = ERRLOG_BASE + 2; +pub const NELOG_Unable_To_Unlock_Segment: ::DWORD = ERRLOG_BASE + 3; +pub const NELOG_Uninstall_Service: ::DWORD = ERRLOG_BASE + 4; +pub const NELOG_Init_Exec_Fail: ::DWORD = ERRLOG_BASE + 5; +pub const NELOG_Ncb_Error: ::DWORD = ERRLOG_BASE + 6; +pub const NELOG_Net_Not_Started: ::DWORD = ERRLOG_BASE + 7; +pub const NELOG_Ioctl_Error: ::DWORD = ERRLOG_BASE + 8; +pub const NELOG_System_Semaphore: ::DWORD = ERRLOG_BASE + 9; +pub const NELOG_Init_OpenCreate_Err: ::DWORD = ERRLOG_BASE + 10; +pub const NELOG_NetBios: ::DWORD = ERRLOG_BASE + 11; +pub const NELOG_SMB_Illegal: ::DWORD = ERRLOG_BASE + 12; +pub const NELOG_Service_Fail: ::DWORD = ERRLOG_BASE + 13; +pub const NELOG_Entries_Lost: ::DWORD = ERRLOG_BASE + 14; +pub const NELOG_Init_Seg_Overflow: ::DWORD = ERRLOG_BASE + 20; +pub const NELOG_Srv_No_Mem_Grow: ::DWORD = ERRLOG_BASE + 21; +pub const NELOG_Access_File_Bad: ::DWORD = ERRLOG_BASE + 22; +pub const NELOG_Srvnet_Not_Started: ::DWORD = ERRLOG_BASE + 23; +pub const NELOG_Init_Chardev_Err: ::DWORD = ERRLOG_BASE + 24; +pub const NELOG_Remote_API: ::DWORD = ERRLOG_BASE + 25; +pub const NELOG_Ncb_TooManyErr: ::DWORD = ERRLOG_BASE + 26; +pub const NELOG_Mailslot_err: ::DWORD = ERRLOG_BASE + 27; +pub const NELOG_ReleaseMem_Alert: ::DWORD = ERRLOG_BASE + 28; +pub const NELOG_AT_cannot_write: ::DWORD = ERRLOG_BASE + 29; +pub const NELOG_Cant_Make_Msg_File: ::DWORD = ERRLOG_BASE + 30; +pub const NELOG_Exec_Netservr_NoMem: ::DWORD = ERRLOG_BASE + 31; +pub const NELOG_Server_Lock_Failure: ::DWORD = ERRLOG_BASE + 32; +pub const NELOG_Msg_Shutdown: ::DWORD = ERRLOG_BASE + 40; +pub const NELOG_Msg_Sem_Shutdown: ::DWORD = ERRLOG_BASE + 41; +pub const NELOG_Msg_Log_Err: ::DWORD = ERRLOG_BASE + 50; +pub const NELOG_VIO_POPUP_ERR: ::DWORD = ERRLOG_BASE + 51; +pub const NELOG_Msg_Unexpected_SMB_Type: ::DWORD = ERRLOG_BASE + 52; +pub const NELOG_Wksta_Infoseg: ::DWORD = ERRLOG_BASE + 60; +pub const NELOG_Wksta_Compname: ::DWORD = ERRLOG_BASE + 61; +pub const NELOG_Wksta_BiosThreadFailure: ::DWORD = ERRLOG_BASE + 62; +pub const NELOG_Wksta_IniSeg: ::DWORD = ERRLOG_BASE + 63; +pub const NELOG_Wksta_HostTab_Full: ::DWORD = ERRLOG_BASE + 64; +pub const NELOG_Wksta_Bad_Mailslot_SMB: ::DWORD = ERRLOG_BASE + 65; +pub const NELOG_Wksta_UASInit: ::DWORD = ERRLOG_BASE + 66; +pub const NELOG_Wksta_SSIRelogon: ::DWORD = ERRLOG_BASE + 67; +pub const NELOG_Build_Name: ::DWORD = ERRLOG_BASE + 70; +pub const NELOG_Name_Expansion: ::DWORD = ERRLOG_BASE + 71; +pub const NELOG_Message_Send: ::DWORD = ERRLOG_BASE + 72; +pub const NELOG_Mail_Slt_Err: ::DWORD = ERRLOG_BASE + 73; +pub const NELOG_AT_cannot_read: ::DWORD = ERRLOG_BASE + 74; +pub const NELOG_AT_sched_err: ::DWORD = ERRLOG_BASE + 75; +pub const NELOG_AT_schedule_file_created: ::DWORD = ERRLOG_BASE + 76; +pub const NELOG_Srvnet_NB_Open: ::DWORD = ERRLOG_BASE + 77; +pub const NELOG_AT_Exec_Err: ::DWORD = ERRLOG_BASE + 78; +pub const NELOG_Lazy_Write_Err: ::DWORD = ERRLOG_BASE + 80; +pub const NELOG_HotFix: ::DWORD = ERRLOG_BASE + 81; +pub const NELOG_HardErr_From_Server: ::DWORD = ERRLOG_BASE + 82; +pub const NELOG_LocalSecFail1: ::DWORD = ERRLOG_BASE + 83; +pub const NELOG_LocalSecFail2: ::DWORD = ERRLOG_BASE + 84; +pub const NELOG_LocalSecFail3: ::DWORD = ERRLOG_BASE + 85; +pub const NELOG_LocalSecGeneralFail: ::DWORD = ERRLOG_BASE + 86; +pub const NELOG_NetWkSta_Internal_Error: ::DWORD = ERRLOG_BASE + 90; +pub const NELOG_NetWkSta_No_Resource: ::DWORD = ERRLOG_BASE + 91; +pub const NELOG_NetWkSta_SMB_Err: ::DWORD = ERRLOG_BASE + 92; +pub const NELOG_NetWkSta_VC_Err: ::DWORD = ERRLOG_BASE + 93; +pub const NELOG_NetWkSta_Stuck_VC_Err: ::DWORD = ERRLOG_BASE + 94; +pub const NELOG_NetWkSta_NCB_Err: ::DWORD = ERRLOG_BASE + 95; +pub const NELOG_NetWkSta_Write_Behind_Err: ::DWORD = ERRLOG_BASE + 96; +pub const NELOG_NetWkSta_Reset_Err: ::DWORD = ERRLOG_BASE + 97; +pub const NELOG_NetWkSta_Too_Many: ::DWORD = ERRLOG_BASE + 98; +pub const NELOG_Srv_Thread_Failure: ::DWORD = ERRLOG_BASE + 104; +pub const NELOG_Srv_Close_Failure: ::DWORD = ERRLOG_BASE + 105; +pub const NELOG_ReplUserCurDir: ::DWORD = ERRLOG_BASE + 106; +pub const NELOG_ReplCannotMasterDir: ::DWORD = ERRLOG_BASE + 107; +pub const NELOG_ReplUpdateError: ::DWORD = ERRLOG_BASE + 108; +pub const NELOG_ReplLostMaster: ::DWORD = ERRLOG_BASE + 109; +pub const NELOG_NetlogonAuthDCFail: ::DWORD = ERRLOG_BASE + 110; +pub const NELOG_ReplLogonFailed: ::DWORD = ERRLOG_BASE + 111; +pub const NELOG_ReplNetErr: ::DWORD = ERRLOG_BASE + 112; +pub const NELOG_ReplMaxFiles: ::DWORD = ERRLOG_BASE + 113; +pub const NELOG_ReplMaxTreeDepth: ::DWORD = ERRLOG_BASE + 114; +pub const NELOG_ReplBadMsg: ::DWORD = ERRLOG_BASE + 115; +pub const NELOG_ReplSysErr: ::DWORD = ERRLOG_BASE + 116; +pub const NELOG_ReplUserLoged: ::DWORD = ERRLOG_BASE + 117; +pub const NELOG_ReplBadImport: ::DWORD = ERRLOG_BASE + 118; +pub const NELOG_ReplBadExport: ::DWORD = ERRLOG_BASE + 119; +pub const NELOG_ReplSignalFileErr: ::DWORD = ERRLOG_BASE + 120; +pub const NELOG_DiskFT: ::DWORD = ERRLOG_BASE + 121; +pub const NELOG_ReplAccessDenied: ::DWORD = ERRLOG_BASE + 122; +pub const NELOG_NetlogonFailedPrimary: ::DWORD = ERRLOG_BASE + 123; +pub const NELOG_NetlogonPasswdSetFailed: ::DWORD = ERRLOG_BASE + 124; +pub const NELOG_NetlogonTrackingError: ::DWORD = ERRLOG_BASE + 125; +pub const NELOG_NetlogonSyncError: ::DWORD = ERRLOG_BASE + 126; +pub const NELOG_NetlogonRequireSignOrSealError: ::DWORD = ERRLOG_BASE + 127; +pub const NELOG_UPS_PowerOut: ::DWORD = ERRLOG_BASE + 130; +pub const NELOG_UPS_Shutdown: ::DWORD = ERRLOG_BASE + 131; +pub const NELOG_UPS_CmdFileError: ::DWORD = ERRLOG_BASE + 132; +pub const NELOG_UPS_CannotOpenDriver: ::DWORD = ERRLOG_BASE+133; +pub const NELOG_UPS_PowerBack: ::DWORD = ERRLOG_BASE + 134; +pub const NELOG_UPS_CmdFileConfig: ::DWORD = ERRLOG_BASE + 135; +pub const NELOG_UPS_CmdFileExec: ::DWORD = ERRLOG_BASE + 136; +pub const NELOG_Missing_Parameter: ::DWORD = ERRLOG_BASE + 150; +pub const NELOG_Invalid_Config_Line: ::DWORD = ERRLOG_BASE + 151; +pub const NELOG_Invalid_Config_File: ::DWORD = ERRLOG_BASE + 152; +pub const NELOG_File_Changed: ::DWORD = ERRLOG_BASE + 153; +pub const NELOG_Files_Dont_Fit: ::DWORD = ERRLOG_BASE + 154; +pub const NELOG_Wrong_DLL_Version: ::DWORD = ERRLOG_BASE + 155; +pub const NELOG_Error_in_DLL: ::DWORD = ERRLOG_BASE + 156; +pub const NELOG_System_Error: ::DWORD = ERRLOG_BASE + 157; +pub const NELOG_FT_ErrLog_Too_Large: ::DWORD = ERRLOG_BASE + 158; +pub const NELOG_FT_Update_In_Progress: ::DWORD = ERRLOG_BASE + 159; +pub const NELOG_Joined_Domain: ::DWORD = ERRLOG_BASE + 160; +pub const NELOG_Joined_Workgroup: ::DWORD = ERRLOG_BASE + 161; +pub const NELOG_OEM_Code: ::DWORD = ERRLOG_BASE + 199; +pub const ERRLOG2_BASE: ::DWORD = 5700; +pub const NELOG_NetlogonSSIInitError: ::DWORD = ERRLOG2_BASE + 0; +pub const NELOG_NetlogonFailedToUpdateTrustList: ::DWORD = ERRLOG2_BASE + 1; +pub const NELOG_NetlogonFailedToAddRpcInterface: ::DWORD = ERRLOG2_BASE + 2; +pub const NELOG_NetlogonFailedToReadMailslot: ::DWORD = ERRLOG2_BASE + 3; +pub const NELOG_NetlogonFailedToRegisterSC: ::DWORD = ERRLOG2_BASE + 4; +pub const NELOG_NetlogonChangeLogCorrupt: ::DWORD = ERRLOG2_BASE + 5; +pub const NELOG_NetlogonFailedToCreateShare: ::DWORD = ERRLOG2_BASE + 6; +pub const NELOG_NetlogonDownLevelLogonFailed: ::DWORD = ERRLOG2_BASE + 7; +pub const NELOG_NetlogonDownLevelLogoffFailed: ::DWORD = ERRLOG2_BASE + 8; +pub const NELOG_NetlogonNTLogonFailed: ::DWORD = ERRLOG2_BASE + 9; +pub const NELOG_NetlogonNTLogoffFailed: ::DWORD = ERRLOG2_BASE + 10; +pub const NELOG_NetlogonPartialSyncCallSuccess: ::DWORD = ERRLOG2_BASE + 11; +pub const NELOG_NetlogonPartialSyncCallFailed: ::DWORD = ERRLOG2_BASE + 12; +pub const NELOG_NetlogonFullSyncCallSuccess: ::DWORD = ERRLOG2_BASE + 13; +pub const NELOG_NetlogonFullSyncCallFailed: ::DWORD = ERRLOG2_BASE + 14; +pub const NELOG_NetlogonPartialSyncSuccess: ::DWORD = ERRLOG2_BASE + 15; +pub const NELOG_NetlogonPartialSyncFailed: ::DWORD = ERRLOG2_BASE + 16; +pub const NELOG_NetlogonFullSyncSuccess: ::DWORD = ERRLOG2_BASE + 17; +pub const NELOG_NetlogonFullSyncFailed: ::DWORD = ERRLOG2_BASE + 18; +pub const NELOG_NetlogonAuthNoDomainController: ::DWORD = ERRLOG2_BASE + 19; +pub const NELOG_NetlogonAuthNoTrustLsaSecret: ::DWORD = ERRLOG2_BASE + 20; +pub const NELOG_NetlogonAuthNoTrustSamAccount: ::DWORD = ERRLOG2_BASE + 21; +pub const NELOG_NetlogonServerAuthFailed: ::DWORD = ERRLOG2_BASE + 22; +pub const NELOG_NetlogonServerAuthNoTrustSamAccount: ::DWORD = ERRLOG2_BASE + 23; +pub const NELOG_FailedToRegisterSC: ::DWORD = ERRLOG2_BASE + 24; +pub const NELOG_FailedToSetServiceStatus: ::DWORD = ERRLOG2_BASE + 25; +pub const NELOG_FailedToGetComputerName: ::DWORD = ERRLOG2_BASE + 26; +pub const NELOG_DriverNotLoaded: ::DWORD = ERRLOG2_BASE + 27; +pub const NELOG_NoTranportLoaded: ::DWORD = ERRLOG2_BASE + 28; +pub const NELOG_NetlogonFailedDomainDelta: ::DWORD = ERRLOG2_BASE + 29; +pub const NELOG_NetlogonFailedGlobalGroupDelta: ::DWORD = ERRLOG2_BASE + 30; +pub const NELOG_NetlogonFailedLocalGroupDelta: ::DWORD = ERRLOG2_BASE + 31; +pub const NELOG_NetlogonFailedUserDelta: ::DWORD = ERRLOG2_BASE + 32; +pub const NELOG_NetlogonFailedPolicyDelta: ::DWORD = ERRLOG2_BASE + 33; +pub const NELOG_NetlogonFailedTrustedDomainDelta: ::DWORD = ERRLOG2_BASE + 34; +pub const NELOG_NetlogonFailedAccountDelta: ::DWORD = ERRLOG2_BASE + 35; +pub const NELOG_NetlogonFailedSecretDelta: ::DWORD = ERRLOG2_BASE + 36; +pub const NELOG_NetlogonSystemError: ::DWORD = ERRLOG2_BASE + 37; +pub const NELOG_NetlogonDuplicateMachineAccounts: ::DWORD = ERRLOG2_BASE + 38; +pub const NELOG_NetlogonTooManyGlobalGroups: ::DWORD = ERRLOG2_BASE + 39; +pub const NELOG_NetlogonBrowserDriver: ::DWORD = ERRLOG2_BASE + 40; +pub const NELOG_NetlogonAddNameFailure: ::DWORD = ERRLOG2_BASE + 41; +pub const NELOG_RplMessages: ::DWORD = ERRLOG2_BASE + 42; +pub const NELOG_RplXnsBoot: ::DWORD = ERRLOG2_BASE + 43; +pub const NELOG_RplSystem: ::DWORD = ERRLOG2_BASE + 44; +pub const NELOG_RplWkstaTimeout: ::DWORD = ERRLOG2_BASE + 45; +pub const NELOG_RplWkstaFileOpen: ::DWORD = ERRLOG2_BASE + 46; +pub const NELOG_RplWkstaFileRead: ::DWORD = ERRLOG2_BASE + 47; +pub const NELOG_RplWkstaMemory: ::DWORD = ERRLOG2_BASE + 48; +pub const NELOG_RplWkstaFileChecksum: ::DWORD = ERRLOG2_BASE + 49; +pub const NELOG_RplWkstaFileLineCount: ::DWORD = ERRLOG2_BASE + 50; +pub const NELOG_RplWkstaBbcFile: ::DWORD = ERRLOG2_BASE + 51; +pub const NELOG_RplWkstaFileSize: ::DWORD = ERRLOG2_BASE + 52; +pub const NELOG_RplWkstaInternal: ::DWORD = ERRLOG2_BASE + 53; +pub const NELOG_RplWkstaWrongVersion: ::DWORD = ERRLOG2_BASE + 54; +pub const NELOG_RplWkstaNetwork: ::DWORD = ERRLOG2_BASE + 55; +pub const NELOG_RplAdapterResource: ::DWORD = ERRLOG2_BASE + 56; +pub const NELOG_RplFileCopy: ::DWORD = ERRLOG2_BASE + 57; +pub const NELOG_RplFileDelete: ::DWORD = ERRLOG2_BASE + 58; +pub const NELOG_RplFilePerms: ::DWORD = ERRLOG2_BASE + 59; +pub const NELOG_RplCheckConfigs: ::DWORD = ERRLOG2_BASE + 60; +pub const NELOG_RplCreateProfiles: ::DWORD = ERRLOG2_BASE + 61; +pub const NELOG_RplRegistry: ::DWORD = ERRLOG2_BASE + 62; +pub const NELOG_RplReplaceRPLDISK: ::DWORD = ERRLOG2_BASE + 63; +pub const NELOG_RplCheckSecurity: ::DWORD = ERRLOG2_BASE + 64; +pub const NELOG_RplBackupDatabase: ::DWORD = ERRLOG2_BASE + 65; +pub const NELOG_RplInitDatabase: ::DWORD = ERRLOG2_BASE + 66; +pub const NELOG_RplRestoreDatabaseFailure: ::DWORD = ERRLOG2_BASE + 67; +pub const NELOG_RplRestoreDatabaseSuccess: ::DWORD = ERRLOG2_BASE + 68; +pub const NELOG_RplInitRestoredDatabase: ::DWORD = ERRLOG2_BASE + 69; +pub const NELOG_NetlogonSessionTypeWrong: ::DWORD = ERRLOG2_BASE + 70; +pub const NELOG_RplUpgradeDBTo40: ::DWORD = ERRLOG2_BASE + 71; +pub const NELOG_NetlogonLanmanBdcsNotAllowed: ::DWORD = ERRLOG2_BASE + 72; +pub const NELOG_NetlogonNoDynamicDns: ::DWORD = ERRLOG2_BASE + 73; +pub const NELOG_NetlogonDynamicDnsRegisterFailure: ::DWORD = ERRLOG2_BASE + 74; +pub const NELOG_NetlogonDynamicDnsDeregisterFailure: ::DWORD = ERRLOG2_BASE + 75; +pub const NELOG_NetlogonFailedFileCreate: ::DWORD = ERRLOG2_BASE + 76; +pub const NELOG_NetlogonGetSubnetToSite: ::DWORD = ERRLOG2_BASE + 77; +pub const NELOG_NetlogonNoSiteForClient: ::DWORD = ERRLOG2_BASE + 78; +pub const NELOG_NetlogonBadSiteName: ::DWORD = ERRLOG2_BASE + 79; +pub const NELOG_NetlogonBadSubnetName: ::DWORD = ERRLOG2_BASE + 80; +pub const NELOG_NetlogonDynamicDnsServerFailure: ::DWORD = ERRLOG2_BASE + 81; +pub const NELOG_NetlogonDynamicDnsFailure: ::DWORD = ERRLOG2_BASE + 82; +pub const NELOG_NetlogonRpcCallCancelled: ::DWORD = ERRLOG2_BASE + 83; +pub const NELOG_NetlogonDcSiteCovered: ::DWORD = ERRLOG2_BASE + 84; +pub const NELOG_NetlogonDcSiteNotCovered: ::DWORD = ERRLOG2_BASE + 85; +pub const NELOG_NetlogonGcSiteCovered: ::DWORD = ERRLOG2_BASE + 86; +pub const NELOG_NetlogonGcSiteNotCovered: ::DWORD = ERRLOG2_BASE + 87; +pub const NELOG_NetlogonFailedSpnUpdate: ::DWORD = ERRLOG2_BASE + 88; +pub const NELOG_NetlogonFailedDnsHostNameUpdate: ::DWORD = ERRLOG2_BASE + 89; +pub const NELOG_NetlogonAuthNoUplevelDomainController: ::DWORD = ERRLOG2_BASE + 90; +pub const NELOG_NetlogonAuthDomainDowngraded: ::DWORD = ERRLOG2_BASE + 91; +pub const NELOG_NetlogonNdncSiteCovered: ::DWORD = ERRLOG2_BASE + 92; +pub const NELOG_NetlogonNdncSiteNotCovered: ::DWORD = ERRLOG2_BASE + 93; +pub const NELOG_NetlogonDcOldSiteCovered: ::DWORD = ERRLOG2_BASE + 94; +pub const NELOG_NetlogonDcSiteNotCoveredAuto: ::DWORD = ERRLOG2_BASE + 95; +pub const NELOG_NetlogonGcOldSiteCovered: ::DWORD = ERRLOG2_BASE + 96; +pub const NELOG_NetlogonGcSiteNotCoveredAuto: ::DWORD = ERRLOG2_BASE + 97; +pub const NELOG_NetlogonNdncOldSiteCovered: ::DWORD = ERRLOG2_BASE + 98; +pub const NELOG_NetlogonNdncSiteNotCoveredAuto: ::DWORD = ERRLOG2_BASE + 99; +pub const NELOG_NetlogonSpnMultipleSamAccountNames: ::DWORD = ERRLOG2_BASE + 100; +pub const NELOG_NetlogonSpnCrackNamesFailure: ::DWORD = ERRLOG2_BASE + 101; +pub const NELOG_NetlogonNoAddressToSiteMapping: ::DWORD = ERRLOG2_BASE + 102; +pub const NELOG_NetlogonInvalidGenericParameterValue: ::DWORD = ERRLOG2_BASE + 103; +pub const NELOG_NetlogonInvalidDwordParameterValue: ::DWORD = ERRLOG2_BASE + 104; +pub const NELOG_NetlogonServerAuthFailedNoAccount: ::DWORD = ERRLOG2_BASE + 105; +pub const NELOG_NetlogonNoDynamicDnsManual: ::DWORD = ERRLOG2_BASE + 106; +pub const NELOG_NetlogonNoSiteForClients: ::DWORD = ERRLOG2_BASE + 107; +pub const NELOG_NetlogonDnsDeregAborted: ::DWORD = ERRLOG2_BASE + 108; +pub const NELOG_NetlogonRpcPortRequestFailure: ::DWORD = ERRLOG2_BASE + 109; +pub const NELOG_NetlogonPartialSiteMappingForClients: ::DWORD = ERRLOG2_BASE + 110; +pub const NELOG_NetlogonRemoteDynamicDnsRegisterFailure: ::DWORD = ERRLOG2_BASE + 111; +pub const NELOG_NetlogonRemoteDynamicDnsDeregisterFailure: ::DWORD = ERRLOG2_BASE + 112; +pub const NELOG_NetlogonRejectedRemoteDynamicDnsRegister: ::DWORD = ERRLOG2_BASE + 113; +pub const NELOG_NetlogonRejectedRemoteDynamicDnsDeregister: ::DWORD = ERRLOG2_BASE + 114; +pub const NELOG_NetlogonRemoteDynamicDnsUpdateRequestFailure: ::DWORD = ERRLOG2_BASE + 115; +pub const NELOG_NetlogonUserValidationReqInitialTimeOut: ::DWORD = ERRLOG2_BASE + 116; +pub const NELOG_NetlogonUserValidationReqRecurringTimeOut: ::DWORD = ERRLOG2_BASE + 117; +pub const NELOG_NetlogonUserValidationReqWaitInitialWarning: ::DWORD = ERRLOG2_BASE + 118; +pub const NELOG_NetlogonUserValidationReqWaitRecurringWarning: ::DWORD = ERRLOG2_BASE + 119; +pub const NELOG_NetlogonFailedToAddAuthzRpcInterface: ::DWORD = ERRLOG2_BASE + 120; +pub const NELOG_NetLogonFailedToInitializeAuthzRm: ::DWORD = ERRLOG2_BASE + 121; +pub const NELOG_NetLogonFailedToInitializeRPCSD: ::DWORD = ERRLOG2_BASE + 122; +pub const NELOG_NetlogonMachinePasswdSetSucceeded: ::DWORD = ERRLOG2_BASE + 123; +pub const NELOG_NetlogonMsaPasswdSetSucceeded: ::DWORD = ERRLOG2_BASE + 124; diff --git a/third_party/rust/winapi/src/lmjoin.rs b/third_party/rust/winapi/src/lmjoin.rs new file mode 100644 index 000000000000..12b8a1014bd0 --- /dev/null +++ b/third_party/rust/winapi/src/lmjoin.rs @@ -0,0 +1,80 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +// Definitions and prototypes for the Net setup apis +ENUM!{enum NETSETUP_NAME_TYPE { + NetSetupUnknown = 0, + NetSetupMachine, + NetSetupWorkgroup, + NetSetupDomain, + NetSetupNonExistentDomain, + NetSetupDnsMachine, +}} +pub type PNETSETUP_NAME_TYPE = *mut NETSETUP_NAME_TYPE; +ENUM!{enum NETSETUP_JOIN_STATUS { + NetSetupUnknownStatus = 0, + NetSetupUnjoined, + NetSetupWorkgroupName, + NetSetupDomainName, +}} +pub type PNETSETUP_JOIN_STATUS = *mut NETSETUP_JOIN_STATUS; +pub const NETSETUP_JOIN_DOMAIN: ::DWORD = 0x00000001; +pub const NETSETUP_ACCT_CREATE: ::DWORD = 0x00000002; +pub const NETSETUP_ACCT_DELETE: ::DWORD = 0x00000004; +pub const NETSETUP_WIN9X_UPGRADE: ::DWORD = 0x00000010; +pub const NETSETUP_DOMAIN_JOIN_IF_JOINED: ::DWORD = 0x00000020; +pub const NETSETUP_JOIN_UNSECURE: ::DWORD = 0x00000040; +pub const NETSETUP_MACHINE_PWD_PASSED: ::DWORD = 0x00000080; +pub const NETSETUP_DEFER_SPN_SET: ::DWORD = 0x00000100; +pub const NETSETUP_JOIN_DC_ACCOUNT: ::DWORD = 0x00000200; +pub const NETSETUP_JOIN_WITH_NEW_NAME: ::DWORD = 0x00000400; +pub const NETSETUP_JOIN_READONLY: ::DWORD = 0x00000800; +pub const NETSETUP_DNS_NAME_CHANGES_ONLY: ::DWORD = 0x00001000; +pub const NETSETUP_INSTALL_INVOCATION: ::DWORD = 0x00040000; +pub const NETSETUP_AMBIGUOUS_DC: ::DWORD = 0x00001000; +pub const NETSETUP_NO_NETLOGON_CACHE: ::DWORD = 0x00002000; +pub const NETSETUP_DONT_CONTROL_SERVICES: ::DWORD = 0x00004000; +pub const NETSETUP_SET_MACHINE_NAME: ::DWORD = 0x00008000; +pub const NETSETUP_FORCE_SPN_SET: ::DWORD = 0x00010000; +pub const NETSETUP_NO_ACCT_REUSE: ::DWORD = 0x00020000; +pub const NETSETUP_ALT_SAMACCOUNTNAME: ::DWORD = 0x00020000; +pub const NETSETUP_IGNORE_UNSUPPORTED_FLAGS: ::DWORD = 0x10000000; +pub const NETSETUP_VALID_UNJOIN_FLAGS: ::DWORD = NETSETUP_ACCT_DELETE + | NETSETUP_IGNORE_UNSUPPORTED_FLAGS | NETSETUP_JOIN_DC_ACCOUNT; +pub const NETSETUP_PROCESS_OFFLINE_FLAGS: ::DWORD = NETSETUP_JOIN_DOMAIN + | NETSETUP_DOMAIN_JOIN_IF_JOINED | NETSETUP_JOIN_WITH_NEW_NAME | NETSETUP_DONT_CONTROL_SERVICES + | NETSETUP_MACHINE_PWD_PASSED; +pub const NETSETUP_PROVISION_DOWNLEVEL_PRIV_SUPPORT: ::DWORD = 0x00000001; +pub const NETSETUP_PROVISION_REUSE_ACCOUNT: ::DWORD = 0x00000002; +pub const NETSETUP_PROVISION_USE_DEFAULT_PASSWORD: ::DWORD = 0x00000004; +pub const NETSETUP_PROVISION_SKIP_ACCOUNT_SEARCH: ::DWORD = 0x00000008; +pub const NETSETUP_PROVISION_ROOT_CA_CERTS: ::DWORD = 0x00000010; +pub const NETSETUP_PROVISION_PERSISTENTSITE: ::DWORD = 0x00000020; +pub const NETSETUP_PROVISION_ONLINE_CALLER: ::DWORD = 0x40000000; +pub const NETSETUP_PROVISION_CHECK_PWD_ONLY: ::DWORD = 0x80000000; +pub const NETSETUP_PROVISIONING_PARAMS_WIN8_VERSION: ::DWORD = 0x00000001; +pub const NETSETUP_PROVISIONING_PARAMS_CURRENT_VERSION: ::DWORD = 0x00000002; +STRUCT!{struct NETSETUP_PROVISIONING_PARAMS { + dwVersion: ::DWORD, + lpDomain: ::LPCWSTR, + lpHostName: ::LPCWSTR, + lpMachineAccountOU: ::LPCWSTR, + lpDcName: ::LPCWSTR, + dwProvisionOptions: ::DWORD, + aCertTemplateNames: *mut ::LPCWSTR, + cCertTemplateNames: ::DWORD, + aMachinePolicyNames: *mut ::LPCWSTR, + cMachinePolicyNames: ::DWORD, + aMachinePolicyPaths: *mut ::LPCWSTR, + cMachinePolicyPaths: ::DWORD, + lpNetbiosName: ::LPWSTR, + lpSiteName: ::LPWSTR, + lpPrimaryDNSDomain: ::LPWSTR, +}} +pub type PNETSETUP_PROVISIONING_PARAMS = *mut NETSETUP_PROVISIONING_PARAMS; +ENUM!{enum NET_COMPUTER_NAME_TYPE { + NetPrimaryComputerName, + NetAlternateComputerNames, + NetAllComputerNames, + NetComputerNameTypeMax, +}} +pub type PNET_COMPUTER_NAME_TYPE = *mut NET_COMPUTER_NAME_TYPE; diff --git a/third_party/rust/winapi/src/lsalookup.rs b/third_party/rust/winapi/src/lsalookup.rs new file mode 100644 index 000000000000..039d72a3a07b --- /dev/null +++ b/third_party/rust/winapi/src/lsalookup.rs @@ -0,0 +1,69 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! LSA Policy Lookup API +STRUCT!{struct LSA_UNICODE_STRING { + Length: ::USHORT, + MaximumLength: ::USHORT, + Buffer: ::PWSTR, +}} +pub type PLSA_UNICODE_STRING = *mut LSA_UNICODE_STRING; +STRUCT!{struct LSA_STRING { + Length: ::USHORT, + MaximumLength: ::USHORT, + Buffer: ::PCHAR, +}} +pub type PLSA_STRING = *mut LSA_STRING; +STRUCT!{struct LSA_OBJECT_ATTRIBUTES { + Length: ::ULONG, + RootDirectory: ::HANDLE, + ObjectName: PLSA_UNICODE_STRING, + Attributes: ::ULONG, + SecurityDescriptor: ::PVOID, + SecurityQualityOfService: ::PVOID, +}} +pub type PLSA_OBJECT_ATTRIBUTES = *mut LSA_OBJECT_ATTRIBUTES; +STRUCT!{struct LSA_TRUST_INFORMATION { + Name: LSA_UNICODE_STRING, + Sid: ::PSID, +}} +pub type PLSA_TRUST_INFORMATION = *mut LSA_TRUST_INFORMATION; +STRUCT!{struct LSA_REFERENCED_DOMAIN_LIST { + Entries: ::ULONG, + Domains: PLSA_TRUST_INFORMATION, +}} +pub type PLSA_REFERENCED_DOMAIN_LIST = *mut LSA_REFERENCED_DOMAIN_LIST; +STRUCT!{struct LSA_TRANSLATED_SID2 { + Use: ::SID_NAME_USE, + Sid: ::PSID, + DomainIndex: ::LONG, + Flags: ::ULONG, +}} +pub type PLSA_TRANSLATED_SID2 = *mut LSA_TRANSLATED_SID2; +STRUCT!{struct LSA_TRANSLATED_NAME { + Use: ::SID_NAME_USE, + Name: LSA_UNICODE_STRING, + DomainIndex: ::LONG, +}} +pub type PLSA_TRANSLATED_NAME = *mut LSA_TRANSLATED_NAME; +STRUCT!{struct POLICY_ACCOUNT_DOMAIN_INFO { + DomainName: LSA_UNICODE_STRING, + DomainSid: ::PSID, +}} +pub type PPOLICY_ACCOUNT_DOMAIN_INFO = *mut POLICY_ACCOUNT_DOMAIN_INFO; +STRUCT!{struct POLICY_DNS_DOMAIN_INFO { + Name: LSA_UNICODE_STRING, + DnsDomainName: LSA_UNICODE_STRING, + DnsForestName: LSA_UNICODE_STRING, + DomainGuid: ::GUID, + Sid: ::PSID, +}} +pub type PPOLICY_DNS_DOMAIN_INFO = *mut POLICY_DNS_DOMAIN_INFO; +pub const LOOKUP_VIEW_LOCAL_INFORMATION: ::ACCESS_MASK = 0x00000001; +pub const LOOKUP_TRANSLATE_NAMES: ::ACCESS_MASK = 0x00000800; +ENUM!{enum LSA_LOOKUP_DOMAIN_INFO_CLASS { + AccountDomainInformation = 5, + DnsDomainInformation = 12, +}} +pub type PLSA_LOOKUP_DOMAIN_INFO_CLASS = *mut LSA_LOOKUP_DOMAIN_INFO_CLASS; +pub type LSA_LOOKUP_HANDLE = ::PVOID; +pub type PLSA_LOOKUP_HANDLE = *mut ::PVOID; diff --git a/third_party/rust/winapi/src/macros.rs b/third_party/rust/winapi/src/macros.rs new file mode 100644 index 000000000000..0bbd6aabff7d --- /dev/null +++ b/third_party/rust/winapi/src/macros.rs @@ -0,0 +1,270 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Macros to make things easier to define +macro_rules! DECLARE_HANDLE { + ($name:ident, $inner:ident) => { + #[allow(missing_copy_implementations)] pub enum $inner { } + pub type $name = *mut $inner; + }; +} +macro_rules! MAKE_HRESULT { + ($sev:expr, $fac:expr, $code:expr) => { + ($sev << 31) | ($fac << 16) | $code + } +} +macro_rules! MAKE_SCODE { + ($sev:expr, $fac:expr, $code:expr) => { + ($sev << 31) | ($fac << 16) | $code + } +} +macro_rules! HIDP_ERROR_CODES { + ($sev:expr, $code:expr) => { + ($sev << 28) | (::FACILITY_HID_ERROR_CODE << 16) | $code + } +} +macro_rules! MAKEFOURCC { + ($a:expr, $b:expr, $c:expr, $d:expr) => { + ($a as i32) | (($b as i32) << 8) | (($c as i32) << 16) | (($d as i32) << 24) + } +} +#[macro_export] +macro_rules! DEFINE_GUID { + ( + $name:ident, $l:expr, $w1:expr, $w2:expr, $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, + $b6:expr, $b7:expr, $b8:expr + ) => { + pub const $name: $crate::GUID = $crate::GUID { + Data1: $l, + Data2: $w1, + Data3: $w2, + Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8], + }; + } +} +macro_rules! CTL_CODE { + ($DeviceType:expr, $Function:expr, $Method:expr, $Access:expr) => { + ($DeviceType << 16) | ($Access << 14) | ($Function << 2) | $Method + } +} +macro_rules! HID_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_NEITHER, ::FILE_ANY_ACCESS) + } +} +macro_rules! HID_BUFFER_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_BUFFERED, ::FILE_ANY_ACCESS) + } +} +macro_rules! HID_IN_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_IN_DIRECT, ::FILE_ANY_ACCESS) + } +} +macro_rules! HID_OUT_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_OUT_DIRECT, ::FILE_ANY_ACCESS) + } +} +macro_rules! AUDCLNT_ERR { + ($n:expr) => { + MAKE_HRESULT!(::SEVERITY_ERROR, ::FACILITY_AUDCLNT, $n) + }; +} +macro_rules! AUDCLNT_SUCCESS { + ($n:expr) => { + MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_AUDCLNT, $n) + }; +} +macro_rules! BCRYPT_MAKE_INTERFACE_VERSION { + ($major:expr, $minor:expr) => { + ::BCRYPT_INTERFACE_VERSION { MajorVersion: $major, MinorVersion: $minor } + } +} +#[macro_export] +macro_rules! RIDL { + (interface $interface:ident ($vtbl:ident) + {$( + fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty + ),+} + ) => { + #[repr(C)] #[allow(missing_copy_implementations)] + pub struct $vtbl { + $(pub $method: unsafe extern "system" fn( + This: *mut $interface + $(,$p: $t)* + ) -> $rtr),+ + } + #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] + pub struct $interface { + pub lpVtbl: *const $vtbl + } + impl $interface { + #[inline] + $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { + ((*self.lpVtbl).$method)(self $(,$p)*) + })+ + } + }; + (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) { + }) => { + #[repr(C)] #[allow(missing_copy_implementations)] + pub struct $vtbl { + pub parent: $crate::$pvtbl + } + #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] + pub struct $interface { + pub lpVtbl: *const $vtbl + } + impl ::std::ops::Deref for $interface { + type Target = $crate::$pinterface; + #[inline] + fn deref(&self) -> &$crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + impl ::std::ops::DerefMut for $interface { + #[inline] + fn deref_mut(&mut self) -> &mut $crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + }; + (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) + {$( + fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty + ),+} + ) => { + #[repr(C)] #[allow(missing_copy_implementations)] + pub struct $vtbl { + pub parent: $crate::$pvtbl + $(,pub $method: unsafe extern "system" fn( + This: *mut $interface + $(,$p: $t)* + ) -> $rtr)+ + } + #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] + pub struct $interface { + pub lpVtbl: *const $vtbl + } + impl $interface { + #[inline] + $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { + ((*self.lpVtbl).$method)(self $(,$p)*) + })+ + } + impl ::std::ops::Deref for $interface { + type Target = $crate::$pinterface; + #[inline] + fn deref(&self) -> &$crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + impl ::std::ops::DerefMut for $interface { + #[inline] + fn deref_mut(&mut self) -> &mut $crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + }; +} +macro_rules! UNION { + ($base:ident, $field:ident, $variant:ident, $variantmut:ident, $fieldtype:ty) => { + impl $base { + #[inline] + pub unsafe fn $variant(&self) -> &$fieldtype { + ::std::mem::transmute(&self.$field) + } + #[inline] + pub unsafe fn $variantmut(&mut self) -> &mut $fieldtype { + ::std::mem::transmute(&mut self.$field) + } + } + } +} +macro_rules! BITFIELD { + ($base:ident $field:ident: $fieldtype:ty [ + $($thing:ident $set_thing:ident[$r:expr],)+ + ]) => { + impl $base {$( + #[inline] + pub fn $thing(&self) -> $fieldtype { + let size = ::std::mem::size_of::<$fieldtype>() * 8; + self.$field << (size - $r.end) >> (size - $r.end + $r.start) + } + #[inline] + pub fn $set_thing(&mut self, val: $fieldtype) { + let mask = ((1 << ($r.end - $r.start)) - 1) << $r.start; + self.$field &= !mask; + self.$field |= (val << $r.start) & mask; + } + )+} + } +} +#[macro_export] +macro_rules! ENUM { + {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { + #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] + pub struct $name(pub u32); + $(pub const $variant: $name = $name($value);)+ + }; + {enum $name:ident { $variant:ident = $value:expr, $($rest:tt)* }} => { + #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] + pub struct $name(pub u32); + pub const $variant: $name = $name($value); + ENUM!{@gen $name, $variant, $($rest)*} + }; + {enum $name:ident { $variant:ident, $($rest:tt)* }} => { + ENUM!{enum $name { $variant = 0, $($rest)* }} + }; + {@gen $name:ident, $base:ident,} => {}; + {@gen $name:ident, $base:ident, $variant:ident = $value:expr, $($rest:tt)*} => { + pub const $variant: $name = $name($value); + ENUM!{@gen $name, $variant, $($rest)*} + }; + {@gen $name:ident, $base:ident, $variant:ident, $($rest:tt)*} => { + pub const $variant: $name = $name($base.0 + 1u32); + ENUM!{@gen $name, $variant, $($rest)*} + }; +} +macro_rules! FLAGS { + {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { + #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] + pub struct $name(pub u32); + $(pub const $variant: $name = $name($value);)+ + impl ::std::ops::BitAnd<$name> for $name { + type Output = $name; + fn bitand(self, o: $name) -> $name { $name(self.0 & o.0) } + } + impl ::std::ops::BitOr<$name> for $name { + type Output = $name; + fn bitor(self, o: $name) -> $name { $name(self.0 | o.0) } + } + impl ::std::ops::BitXor<$name> for $name { + type Output = $name; + fn bitxor(self, o: $name) -> $name { $name(self.0 ^ o.0) } + } + impl ::std::ops::Not for $name { + type Output = $name; + fn not(self) -> $name { $name(!self.0) } + } + } +} +macro_rules! STRUCT { + {$(#[$attrs:meta])* nodebug struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { + #[repr(C)] $(#[$attrs])* + pub struct $name { + $(pub $field: $ftype,)+ + } + impl Copy for $name {} + impl Clone for $name { fn clone(&self) -> $name { *self } } + }; + {$(#[$attrs:meta])* struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { + #[repr(C)] #[derive(Debug)] $(#[$attrs])* + pub struct $name { + $(pub $field: $ftype,)+ + } + impl Copy for $name {} + impl Clone for $name { fn clone(&self) -> $name { *self } } + }; +} diff --git a/third_party/rust/winapi/src/memoryapi.rs b/third_party/rust/winapi/src/memoryapi.rs new file mode 100644 index 000000000000..30cefea5a62d --- /dev/null +++ b/third_party/rust/winapi/src/memoryapi.rs @@ -0,0 +1,19 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-memory-l1-1-0 +pub const FILE_MAP_WRITE: ::DWORD = ::SECTION_MAP_WRITE; +pub const FILE_MAP_READ: ::DWORD = ::SECTION_MAP_READ; +pub const FILE_MAP_ALL_ACCESS: ::DWORD = ::SECTION_ALL_ACCESS; +pub const FILE_MAP_EXECUTE: ::DWORD = ::SECTION_MAP_EXECUTE_EXPLICIT; +pub const FILE_MAP_COPY: ::DWORD = 0x00000001; +pub const FILE_MAP_RESERVE: ::DWORD = 0x80000000; +ENUM!{enum MEMORY_RESOURCE_NOTIFICATION_TYPE { + LowMemoryResourceNotification, + HighMemoryResourceNotification, +}} +STRUCT!{struct WIN32_MEMORY_RANGE_ENTRY { + VirtualAddress: ::PVOID, + NumberOfBytes: ::SIZE_T, +}} +pub type PWIN32_MEMORY_RANGE_ENTRY = *mut WIN32_MEMORY_RANGE_ENTRY; +pub type PBAD_MEMORY_CALLBACK_ROUTINE = Option; diff --git a/third_party/rust/winapi/src/minschannel.rs b/third_party/rust/winapi/src/minschannel.rs new file mode 100644 index 000000000000..828f1be6a795 --- /dev/null +++ b/third_party/rust/winapi/src/minschannel.rs @@ -0,0 +1,56 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Public Definitions for MIN SCHANNEL Security Provider + +pub const SECPKG_ATTR_ISSUER_LIST: ::DWORD = 0x50; +pub const SECPKG_ATTR_REMOTE_CRED: ::DWORD = 0x51; +pub const SECPKG_ATTR_LOCAL_CRED: ::DWORD = 0x52; +pub const SECPKG_ATTR_REMOTE_CERT_CONTEXT: ::DWORD = 0x53; +pub const SECPKG_ATTR_LOCAL_CERT_CONTEXT: ::DWORD = 0x54; +pub const SECPKG_ATTR_ROOT_STORE: ::DWORD = 0x55; +pub const SECPKG_ATTR_SUPPORTED_ALGS: ::DWORD = 0x56; +pub const SECPKG_ATTR_CIPHER_STRENGTHS: ::DWORD = 0x57; +pub const SECPKG_ATTR_SUPPORTED_PROTOCOLS: ::DWORD = 0x58; +pub const SECPKG_ATTR_ISSUER_LIST_EX: ::DWORD = 0x59; +pub const SECPKG_ATTR_CONNECTION_INFO: ::DWORD = 0x5a; +pub const SECPKG_ATTR_EAP_KEY_BLOCK: ::DWORD = 0x5b; +pub const SECPKG_ATTR_MAPPED_CRED_ATTR: ::DWORD = 0x5c; +pub const SECPKG_ATTR_SESSION_INFO: ::DWORD = 0x5d; +pub const SECPKG_ATTR_APP_DATA: ::DWORD = 0x5e; +pub const SECPKG_ATTR_REMOTE_CERTIFICATES: ::DWORD = 0x5F; +pub const SECPKG_ATTR_CLIENT_CERT_POLICY: ::DWORD = 0x60; +pub const SECPKG_ATTR_CC_POLICY_RESULT: ::DWORD = 0x61; +pub const SECPKG_ATTR_USE_NCRYPT: ::DWORD = 0x62; +pub const SECPKG_ATTR_LOCAL_CERT_INFO: ::DWORD = 0x63; +pub const SECPKG_ATTR_CIPHER_INFO: ::DWORD = 0x64; +pub const SECPKG_ATTR_EAP_PRF_INFO: ::DWORD = 0x65; +pub const SECPKG_ATTR_SUPPORTED_SIGNATURES: ::DWORD = 0x66; +pub const SECPKG_ATTR_REMOTE_CERT_CHAIN: ::DWORD = 0x67; +pub const SECPKG_ATTR_UI_INFO: ::DWORD = 0x68; +pub const SECPKG_ATTR_EARLY_START: ::DWORD = 0x69; + +STRUCT!{struct SecPkgCred_SupportedAlgs { + cSupportedAlgs: ::DWORD, + palgSupportedAlgs: ::ALG_ID, +}} + +STRUCT!{struct SecPkgCred_CipherStrengths { + dwMinimumCipherStrength: ::DWORD, + dwMaximumCipherStrength: ::DWORD, +}} + +STRUCT!{struct SecPkgCred_SupportedProtocols { + grbitProtocol: ::DWORD, +}} + +STRUCT!{struct SecPkgCred_ClientCertPolicy { + dwFlags: ::DWORD, + guidPolicyId: ::GUID, + dwCertFlags: ::DWORD, + dwUrlRetrievalTimeout: ::DWORD, + fCheckRevocationFreshnessTime: ::BOOL, + dwRevocationFreshnessTime: ::DWORD, + fOmitUsageCheck: ::BOOL, + pwszSslCtlStoreName: ::LPWSTR, + pwszSslCtlIdentifier: ::LPWSTR, +}} \ No newline at end of file diff --git a/third_party/rust/winapi/src/minwinbase.rs b/third_party/rust/winapi/src/minwinbase.rs new file mode 100644 index 000000000000..f6317fa25400 --- /dev/null +++ b/third_party/rust/winapi/src/minwinbase.rs @@ -0,0 +1,253 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This module defines the 32-Bit Windows Base APIs +STRUCT!{struct SECURITY_ATTRIBUTES { + nLength: ::DWORD, + lpSecurityDescriptor: ::LPVOID, + bInheritHandle: ::BOOL, +}} +pub type PSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; +pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; +STRUCT!{struct OVERLAPPED { + Internal: ::ULONG_PTR, + InternalHigh: ::ULONG_PTR, + Offset: ::DWORD, + OffsetHigh: ::DWORD, + hEvent: ::HANDLE, +}} +UNION!(OVERLAPPED, Offset, Pointer, Pointer_mut, ::PVOID); +pub type LPOVERLAPPED = *mut OVERLAPPED; +STRUCT!{struct OVERLAPPED_ENTRY { + lpCompletionKey: ::ULONG_PTR, + lpOverlapped: LPOVERLAPPED, + Internal: ::ULONG_PTR, + dwNumberOfBytesTransferred: ::DWORD, +}} +pub type LPOVERLAPPED_ENTRY = *mut OVERLAPPED_ENTRY; +STRUCT!{struct SYSTEMTIME { + wYear: ::WORD, + wMonth: ::WORD, + wDayOfWeek: ::WORD, + wDay: ::WORD, + wHour: ::WORD, + wMinute: ::WORD, + wSecond: ::WORD, + wMilliseconds: ::WORD, +}} +pub type PSYSTEMTIME = *mut SYSTEMTIME; +pub type LPSYSTEMTIME = *mut SYSTEMTIME; +STRUCT!{nodebug struct WIN32_FIND_DATAA { + dwFileAttributes: ::DWORD, + ftCreationTime: ::FILETIME, + ftLastAccessTime: ::FILETIME, + ftLastWriteTime: ::FILETIME, + nFileSizeHigh: ::DWORD, + nFileSizeLow: ::DWORD, + dwReserved0: ::DWORD, + dwReserved1: ::DWORD, + cFileName: [::CHAR; ::MAX_PATH], + cAlternateFileName: [::CHAR; 14], +}} +pub type PWIN32_FIND_DATAA = *mut WIN32_FIND_DATAA; +pub type LPWIN32_FIND_DATAA = *mut WIN32_FIND_DATAA; +STRUCT!{nodebug struct WIN32_FIND_DATAW { + dwFileAttributes: ::DWORD, + ftCreationTime: ::FILETIME, + ftLastAccessTime: ::FILETIME, + ftLastWriteTime: ::FILETIME, + nFileSizeHigh: ::DWORD, + nFileSizeLow: ::DWORD, + dwReserved0: ::DWORD, + dwReserved1: ::DWORD, + cFileName: [::WCHAR; ::MAX_PATH], + cAlternateFileName: [::WCHAR; 14], +}} +pub type PWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; +pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; +ENUM!{enum FINDEX_INFO_LEVELS { + FindExInfoStandard, + FindExInfoBasic, + FindExInfoMaxInfoLevel, +}} +pub const FIND_FIRST_EX_CASE_SENSITIVE: ::DWORD = 0x00000001; +pub const FIND_FIRST_EX_LARGE_FETCH: ::DWORD = 0x00000002; +ENUM!{enum FINDEX_SEARCH_OPS { + FindExSearchNameMatch, + FindExSearchLimitToDirectories, + FindExSearchLimitToDevices, + FindExSearchMaxSearchOp, +}} +ENUM!{enum GET_FILEEX_INFO_LEVELS { + GetFileExInfoStandard, + GetFileExMaxInfoLevel, +}} +ENUM!{enum FILE_INFO_BY_HANDLE_CLASS { + FileBasicInfo, + FileStandardInfo, + FileNameInfo, + FileRenameInfo, + FileDispositionInfo, + FileAllocationInfo, + FileEndOfFileInfo, + FileStreamInfo, + FileCompressionInfo, + FileAttributeTagInfo, + FileIdBothDirectoryInfo, + FileIdBothDirectoryRestartInfo, + FileIoPriorityHintInfo, + FileRemoteProtocolInfo, + FileFullDirectoryInfo, + FileFullDirectoryRestartInfo, + FileStorageInfo, + FileAlignmentInfo, + FileIdInfo, + FileIdExtdDirectoryInfo, + FileIdExtdDirectoryRestartInfo, + MaximumFileInfoByHandleClass, +}} +pub type PFILE_INFO_BY_HANDLE_CLASS = *mut FILE_INFO_BY_HANDLE_CLASS; +pub type CRITICAL_SECTION = ::RTL_CRITICAL_SECTION; +pub type PCRITICAL_SECTION = ::PRTL_CRITICAL_SECTION; +pub type LPCRITICAL_SECTION = ::PRTL_CRITICAL_SECTION; +pub type CRITICAL_SECTION_DEBUG = ::RTL_CRITICAL_SECTION_DEBUG; +pub type PCRITICAL_SECTION_DEBUG = ::PRTL_CRITICAL_SECTION_DEBUG; +pub type LPCRITICAL_SECTION_DEBUG = ::PRTL_CRITICAL_SECTION_DEBUG; +pub type LPOVERLAPPED_COMPLETION_ROUTINE = Option; +pub const LOCKFILE_FAIL_IMMEDIATELY: ::DWORD = 0x00000001; +pub const LOCKFILE_EXCLUSIVE_LOCK: ::DWORD = 0x00000002; +STRUCT!{struct PROCESS_HEAP_ENTRY_Block { + hMem: ::HANDLE, + dwReserved: [::DWORD; 3], +}} +STRUCT!{struct PROCESS_HEAP_ENTRY_Region { + dwCommittedSize: ::DWORD, + dwUnCommittedSize: ::DWORD, + lpFirstBlock: ::LPVOID, + lpLastBlock: ::LPVOID, +}} +STRUCT!{struct PROCESS_HEAP_ENTRY { + lpData: ::PVOID, + cbData: ::DWORD, + cbOverhead: ::BYTE, + iRegionIndex: ::BYTE, + wFlags: ::WORD, + Region: PROCESS_HEAP_ENTRY_Region, +}} +UNION!(PROCESS_HEAP_ENTRY, Region, Block, Block_mut, PROCESS_HEAP_ENTRY_Block); +pub type LPPROCESS_HEAP_ENTRY = *mut PROCESS_HEAP_ENTRY; +pub type PPROCESS_HEAP_ENTRY = *mut PROCESS_HEAP_ENTRY; +pub const PROCESS_HEAP_REGION: ::WORD = 0x0001; +pub const PROCESS_HEAP_UNCOMMITTED_RANGE: ::WORD = 0x0002; +pub const PROCESS_HEAP_ENTRY_BUSY: ::WORD = 0x0004; +pub const PROCESS_HEAP_SEG_ALLOC: ::WORD = 0x0008; +pub const PROCESS_HEAP_ENTRY_MOVEABLE: ::WORD = 0x0010; +pub const PROCESS_HEAP_ENTRY_DDESHARE: ::WORD = 0x0020; +pub type PTHREAD_START_ROUTINE = Option ::DWORD>; +pub type LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE; +pub type LPCONTEXT = ::PCONTEXT; +STRUCT!{struct REASON_CONTEXT_Detailed { + LocalizedReasonModule: ::HMODULE, + LocalizedReasonId: ::ULONG, + ReasonStringCount: ::ULONG, + ReasonStrings: *mut ::LPWSTR, +}} +STRUCT!{struct REASON_CONTEXT { + Version: ::ULONG, + Flags: ::DWORD, + Reason: REASON_CONTEXT_Detailed, +}} +UNION!(REASON_CONTEXT, Reason, SimpleReasonString, SimpleReasonString_mut, ::LPWSTR); +pub type PREASON_CONTEXT = *mut REASON_CONTEXT; +pub const EXCEPTION_DEBUG_EVENT: ::DWORD = 1; +pub const CREATE_THREAD_DEBUG_EVENT: ::DWORD = 2; +pub const CREATE_PROCESS_DEBUG_EVENT: ::DWORD = 3; +pub const EXIT_THREAD_DEBUG_EVENT: ::DWORD = 4; +pub const EXIT_PROCESS_DEBUG_EVENT: ::DWORD = 5; +pub const LOAD_DLL_DEBUG_EVENT: ::DWORD = 6; +pub const UNLOAD_DLL_DEBUG_EVENT: ::DWORD = 7; +pub const OUTPUT_DEBUG_STRING_EVENT: ::DWORD = 8; +pub const RIP_EVENT: ::DWORD = 9; +STRUCT!{struct EXCEPTION_DEBUG_INFO { + ExceptionRecord: ::EXCEPTION_RECORD, + dwFirstChance: ::DWORD, +}} +pub type LPEXCEPTION_DEBUG_INFO = *mut EXCEPTION_DEBUG_INFO; +STRUCT!{nodebug struct CREATE_THREAD_DEBUG_INFO { + hThread: ::HANDLE, + lpThreadLocalBase: ::LPVOID, + lpStartAddress: LPTHREAD_START_ROUTINE, +}} +pub type LPCREATE_THREAD_DEBUG_INFO = *mut CREATE_THREAD_DEBUG_INFO; +STRUCT!{nodebug struct CREATE_PROCESS_DEBUG_INFO { + hFile: ::HANDLE, + hProcess: ::HANDLE, + hThread: ::HANDLE, + lpBaseOfImage: ::LPVOID, + dwDebugInfoFileOffset: ::DWORD, + nDebugInfoSize: ::DWORD, + lpThreadLocalBase: ::LPVOID, + lpStartAddress: LPTHREAD_START_ROUTINE, + lpImageName: ::LPVOID, + fUnicode: ::WORD, +}} +pub type LPCREATE_PROCESS_DEBUG_INFO = *mut CREATE_PROCESS_DEBUG_INFO; +STRUCT!{struct EXIT_THREAD_DEBUG_INFO { + dwExitCode: ::DWORD, +}} +pub type LPEXIT_THREAD_DEBUG_INFO = *mut EXIT_THREAD_DEBUG_INFO; +STRUCT!{struct EXIT_PROCESS_DEBUG_INFO { + dwExitCode: ::DWORD, +}} +pub type LPEXIT_PROCESS_DEBUG_INFO = *mut EXIT_PROCESS_DEBUG_INFO; +STRUCT!{struct LOAD_DLL_DEBUG_INFO { + hFile: ::HANDLE, + lpBaseOfDll: ::LPVOID, + dwDebugInfoFileOffset: ::DWORD, + nDebugInfoSize: ::DWORD, + lpImageName: ::LPVOID, + fUnicode: ::WORD, +}} +pub type LPLOAD_DLL_DEBUG_INFO = *mut LOAD_DLL_DEBUG_INFO; +STRUCT!{struct UNLOAD_DLL_DEBUG_INFO { + lpBaseOfDll: ::LPVOID, +}} +pub type LPUNLOAD_DLL_DEBUG_INFO = *mut UNLOAD_DLL_DEBUG_INFO; +STRUCT!{struct OUTPUT_DEBUG_STRING_INFO { + lpDebugStringData: ::LPSTR, + fUnicode: ::WORD, + nDebugStringLength: ::WORD, +}} +pub type LPOUTPUT_DEBUG_STRING_INFO = *mut OUTPUT_DEBUG_STRING_INFO; +STRUCT!{struct RIP_INFO { + dwError: ::DWORD, + dwType: ::DWORD, +}} +pub type LPRIP_INFO = *mut RIP_INFO; +#[cfg(target_arch="x86_64")] +STRUCT!{nodebug struct DEBUG_EVENT { + dwDebugEventCode: ::DWORD, + dwProcessId: ::DWORD, + dwThreadId: ::DWORD, + u: [u8; 160], +}} +#[cfg(target_arch="x86")] +STRUCT!{nodebug struct DEBUG_EVENT { + dwDebugEventCode: ::DWORD, + dwProcessId: ::DWORD, + dwThreadId: ::DWORD, + u: [u8; 84], +}} +UNION!(DEBUG_EVENT, u, Exception, Exception_mut, EXCEPTION_DEBUG_INFO); +UNION!(DEBUG_EVENT, u, CreateThread, CreateThread_mut, CREATE_THREAD_DEBUG_INFO); +UNION!(DEBUG_EVENT, u, CreateProcessInfo, CreateProcessInfo_mut, CREATE_PROCESS_DEBUG_INFO); +UNION!(DEBUG_EVENT, u, ExitThread, ExitThread_mut, EXIT_THREAD_DEBUG_INFO); +UNION!(DEBUG_EVENT, u, ExitProcess, ExitProcess_mut, EXIT_PROCESS_DEBUG_INFO); +UNION!(DEBUG_EVENT, u, LoadDll, LoadDll_mut, LOAD_DLL_DEBUG_INFO); +UNION!(DEBUG_EVENT, u, UnloadDll, UnloadDll_mut, UNLOAD_DLL_DEBUG_INFO); +UNION!(DEBUG_EVENT, u, DebugString, DebugString_mut, OUTPUT_DEBUG_STRING_INFO); +UNION!(DEBUG_EVENT, u, RipInfo, RipInfo_mut, RIP_INFO); +pub type LPDEBUG_EVENT = *mut DEBUG_EVENT; diff --git a/third_party/rust/winapi/src/minwindef.rs b/third_party/rust/winapi/src/minwindef.rs new file mode 100644 index 000000000000..a5ed01771ed0 --- /dev/null +++ b/third_party/rust/winapi/src/minwindef.rs @@ -0,0 +1,89 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Basic Windows Type Definitions for minwin partition +pub type ULONG = ::c_ulong; +pub type PULONG = *mut ULONG; +pub type USHORT = ::c_ushort; +pub type PUSHORT = *mut USHORT; +pub type UCHAR = ::c_uchar; +pub type PUCHAR = *mut UCHAR; +pub type PSZ = *mut ::c_char; +pub const MAX_PATH: usize = 260; +pub const FALSE: BOOL = 0; +pub const TRUE: BOOL = 1; +pub type DWORD = ::c_ulong; +pub type BOOL = ::c_int; +pub type BYTE = ::c_uchar; +pub type WORD = ::c_ushort; +pub type FLOAT = ::c_float; +pub type PFLOAT = *mut FLOAT; +pub type PBOOL = *mut BOOL; +pub type LPBOOL = *mut BOOL; +pub type PBYTE = *mut BYTE; +pub type LPBYTE = *mut BYTE; +pub type PINT = *mut ::c_int; +pub type LPINT = *mut ::c_int; +pub type PWORD = *mut WORD; +pub type LPWORD = *mut WORD; +pub type LPLONG = *mut ::c_long; +pub type PDWORD = *mut DWORD; +pub type LPDWORD = *mut DWORD; +pub type LPVOID = *mut ::c_void; +pub type LPCVOID = *const ::c_void; +pub type INT = ::c_int; +pub type UINT = ::c_uint; +pub type PUINT = *mut ::c_uint; +pub type WPARAM = ::UINT_PTR; +pub type LPARAM = ::LONG_PTR; +pub type LRESULT = ::LONG_PTR; +pub fn MAKEWORD(a: BYTE, b: BYTE) -> WORD { + (a as WORD) | ((b as WORD) << 8) +} +pub fn MAKELONG(a: WORD, b: WORD) -> ::LONG { + ((a as DWORD) | ((b as DWORD) << 16)) as ::LONG +} +pub fn LOWORD(l: DWORD) -> WORD { + (l & 0xffff) as WORD +} +pub fn HIWORD(l: DWORD) -> WORD { + ((l >> 16) & 0xffff) as WORD +} +pub fn LOBYTE(l: WORD) -> BYTE { + (l & 0xff) as BYTE +} +pub fn HIBYTE(l: WORD) -> BYTE { + ((l >> 8) & 0xff) as BYTE +} +pub type SPHANDLE = *mut ::HANDLE; +pub type LPHANDLE = *mut ::HANDLE; +pub type HGLOBAL = ::HANDLE; +pub type HLOCAL = ::HANDLE; +pub type GLOBALHANDLE = ::HANDLE; +pub type LOCALHANDLE = ::HANDLE; +/// Pointer to probably a function with unknown type signature. +pub type FARPROC = *const ::c_void; +/// Pointer to probably a function with unknown type signature. +pub type NEARPROC = *const ::c_void; +/// Pointer to probably a function with unknown type signature. +pub type PROC = *const ::c_void; +pub type ATOM = WORD; +DECLARE_HANDLE!(HKEY, HKEY__); +pub type PHKEY = *mut HKEY; +DECLARE_HANDLE!(HMETAFILE, HMETAFILE__); +DECLARE_HANDLE!(HINSTANCE, HINSTANCE__); +pub type HMODULE = HINSTANCE; +DECLARE_HANDLE!(HRGN, HRGN__); +DECLARE_HANDLE!(HRSRC, HRSRC__); +DECLARE_HANDLE!(HSPRITE, HSPRITE__); +DECLARE_HANDLE!(HLSURF, HLSURF__); +DECLARE_HANDLE!(HSTR, HSTR__); +DECLARE_HANDLE!(HTASK, HTASK__); +DECLARE_HANDLE!(HWINSTA, HWINSTA__); +DECLARE_HANDLE!(HKL, HKL__); +pub type HFILE = ::c_int; +STRUCT!{struct FILETIME { + dwLowDateTime: DWORD, + dwHighDateTime: DWORD, +}} +pub type PFILETIME = *mut FILETIME; +pub type LPFILETIME = *mut FILETIME; diff --git a/third_party/rust/winapi/src/mmdeviceapi.rs b/third_party/rust/winapi/src/mmdeviceapi.rs new file mode 100644 index 000000000000..9fc85a7d2070 --- /dev/null +++ b/third_party/rust/winapi/src/mmdeviceapi.rs @@ -0,0 +1,63 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! this ALWAYS GENERATED file contains the definitions for the interfaces +pub const DEVICE_STATE_ACTIVE: ::DWORD = 0x00000001; +pub const DEVICE_STATE_DISABLED: ::DWORD = 0x00000002; +pub const DEVICE_STATE_NOTPRESENT: ::DWORD = 0x00000004; +pub const DEVICE_STATE_UNPLUGGED: ::DWORD = 0x00000008; +pub const DEVICE_STATEMASK_ALL: ::DWORD = 0x0000000F; +ENUM!{enum EDataFlow { + eRender, + eCapture, + eAll, + EDataFlow_enum_count, +}} +ENUM!{enum ERole { + eConsole, + eMultimedia, + eCommunications, + ERole_enum_count, +}} +DEFINE_GUID!(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, + 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); +DEFINE_GUID!(IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, + 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6); +RIDL!( +interface IMMDevice(IMMDeviceVtbl): IUnknown(IUnknownVtbl) { + fn Activate( + &mut self, iid: ::REFIID, dwClsCtx: ::DWORD, pActivationParams: *mut ::PROPVARIANT, + ppInterface: *mut ::LPVOID + ) -> ::HRESULT, + fn OpenPropertyStore( + &mut self, stgmAccess: ::DWORD, ppProperties: *mut *mut ::IPropertyStore + ) -> ::HRESULT, + fn GetId(&mut self, ppstrId: *mut ::LPWSTR) -> ::HRESULT, + fn GetState(&mut self, pdwState: *mut ::DWORD) -> ::HRESULT +} +); +RIDL!( +interface IMMDeviceEnumerator(IMMDeviceEnumeratorVtbl): IUnknown(IUnknownVtbl) { + fn EnumAudioEndpoints( + &mut self, dataFlow: EDataFlow, dwStateMask: ::DWORD, + ppDevices: *mut *mut IMMDeviceCollection + ) -> ::HRESULT, + fn GetDefaultAudioEndpoint( + &mut self, dataFlow: EDataFlow, role: ERole, ppEndpoint: *mut *mut IMMDevice + ) -> ::HRESULT, + fn GetDevice(&mut self, pwstrId: ::LPCWSTR, ppDevices: *mut *mut IMMDevice) -> ::HRESULT, + fn RegisterEndpointNotificationCallback( + &mut self, pClient: *mut IMMNotificationClient + ) -> ::HRESULT, + fn UnregisterEndpointNotificationCallback( + &mut self, pClient: *mut IMMNotificationClient + ) -> ::HRESULT +} +); +RIDL!( +interface IMMDeviceCollection(IMMDeviceCollectionVtbl): IUnknown(IUnknownVtbl) { + fn GetCount(&mut self, pcDevices: *const ::UINT) -> ::HRESULT, + fn Item(&mut self, nDevice: ::UINT, ppDevice: *mut *mut IMMDevice) -> ::HRESULT +} +); +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IMMNotificationClient; diff --git a/third_party/rust/winapi/src/mmreg.rs b/third_party/rust/winapi/src/mmreg.rs new file mode 100644 index 000000000000..826d96d50b41 --- /dev/null +++ b/third_party/rust/winapi/src/mmreg.rs @@ -0,0 +1,304 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub const WAVE_FORMAT_UNKNOWN: ::WORD = 0x0000; +pub const WAVE_FORMAT_PCM: ::WORD = 0x0001; +pub const WAVE_FORMAT_ADPCM: ::WORD = 0x0002; +pub const WAVE_FORMAT_IEEE_FLOAT: ::WORD = 0x0003; +pub const WAVE_FORMAT_VSELP: ::WORD = 0x0004; +pub const WAVE_FORMAT_IBM_CVSD: ::WORD = 0x0005; +pub const WAVE_FORMAT_ALAW: ::WORD = 0x0006; +pub const WAVE_FORMAT_MULAW: ::WORD = 0x0007; +pub const WAVE_FORMAT_DTS: ::WORD = 0x0008; +pub const WAVE_FORMAT_DRM: ::WORD = 0x0009; +pub const WAVE_FORMAT_WMAVOICE9: ::WORD = 0x000A; +pub const WAVE_FORMAT_WMAVOICE10: ::WORD = 0x000B; +pub const WAVE_FORMAT_OKI_ADPCM: ::WORD = 0x0010; +pub const WAVE_FORMAT_DVI_ADPCM: ::WORD = 0x0011; +pub const WAVE_FORMAT_IMA_ADPCM: ::WORD = WAVE_FORMAT_DVI_ADPCM; +pub const WAVE_FORMAT_MEDIASPACE_ADPCM: ::WORD = 0x0012; +pub const WAVE_FORMAT_SIERRA_ADPCM: ::WORD = 0x0013; +pub const WAVE_FORMAT_G723_ADPCM: ::WORD = 0x0014; +pub const WAVE_FORMAT_DIGISTD: ::WORD = 0x0015; +pub const WAVE_FORMAT_DIGIFIX: ::WORD = 0x0016; +pub const WAVE_FORMAT_DIALOGIC_OKI_ADPCM: ::WORD = 0x0017; +pub const WAVE_FORMAT_MEDIAVISION_ADPCM: ::WORD = 0x0018; +pub const WAVE_FORMAT_CU_CODEC: ::WORD = 0x0019; +pub const WAVE_FORMAT_HP_DYN_VOICE: ::WORD = 0x001A; +pub const WAVE_FORMAT_YAMAHA_ADPCM: ::WORD = 0x0020; +pub const WAVE_FORMAT_SONARC: ::WORD = 0x0021; +pub const WAVE_FORMAT_DSPGROUP_TRUESPEECH: ::WORD = 0x0022; +pub const WAVE_FORMAT_ECHOSC1: ::WORD = 0x0023; +pub const WAVE_FORMAT_AUDIOFILE_AF36: ::WORD = 0x0024; +pub const WAVE_FORMAT_APTX: ::WORD = 0x0025; +pub const WAVE_FORMAT_AUDIOFILE_AF10: ::WORD = 0x0026; +pub const WAVE_FORMAT_PROSODY_1612: ::WORD = 0x0027; +pub const WAVE_FORMAT_LRC: ::WORD = 0x0028; +pub const WAVE_FORMAT_DOLBY_AC2: ::WORD = 0x0030; +pub const WAVE_FORMAT_GSM610: ::WORD = 0x0031; +pub const WAVE_FORMAT_MSNAUDIO: ::WORD = 0x0032; +pub const WAVE_FORMAT_ANTEX_ADPCME: ::WORD = 0x0033; +pub const WAVE_FORMAT_CONTROL_RES_VQLPC: ::WORD = 0x0034; +pub const WAVE_FORMAT_DIGIREAL: ::WORD = 0x0035; +pub const WAVE_FORMAT_DIGIADPCM: ::WORD = 0x0036; +pub const WAVE_FORMAT_CONTROL_RES_CR10: ::WORD = 0x0037; +pub const WAVE_FORMAT_NMS_VBXADPCM: ::WORD = 0x0038; +pub const WAVE_FORMAT_CS_IMAADPCM: ::WORD = 0x0039; +pub const WAVE_FORMAT_ECHOSC3: ::WORD = 0x003A; +pub const WAVE_FORMAT_ROCKWELL_ADPCM: ::WORD = 0x003B; +pub const WAVE_FORMAT_ROCKWELL_DIGITALK: ::WORD = 0x003C; +pub const WAVE_FORMAT_XEBEC: ::WORD = 0x003D; +pub const WAVE_FORMAT_G721_ADPCM: ::WORD = 0x0040; +pub const WAVE_FORMAT_G728_CELP: ::WORD = 0x0041; +pub const WAVE_FORMAT_MSG723: ::WORD = 0x0042; +pub const WAVE_FORMAT_INTEL_G723_1: ::WORD = 0x0043; +pub const WAVE_FORMAT_INTEL_G729: ::WORD = 0x0044; +pub const WAVE_FORMAT_SHARP_G726: ::WORD = 0x0045; +pub const WAVE_FORMAT_MPEG: ::WORD = 0x0050; +pub const WAVE_FORMAT_RT24: ::WORD = 0x0052; +pub const WAVE_FORMAT_PAC: ::WORD = 0x0053; +pub const WAVE_FORMAT_MPEGLAYER3: ::WORD = 0x0055; +pub const WAVE_FORMAT_LUCENT_G723: ::WORD = 0x0059; +pub const WAVE_FORMAT_CIRRUS: ::WORD = 0x0060; +pub const WAVE_FORMAT_ESPCM: ::WORD = 0x0061; +pub const WAVE_FORMAT_VOXWARE: ::WORD = 0x0062; +pub const WAVE_FORMAT_CANOPUS_ATRAC: ::WORD = 0x0063; +pub const WAVE_FORMAT_G726_ADPCM: ::WORD = 0x0064; +pub const WAVE_FORMAT_G722_ADPCM: ::WORD = 0x0065; +pub const WAVE_FORMAT_DSAT: ::WORD = 0x0066; +pub const WAVE_FORMAT_DSAT_DISPLAY: ::WORD = 0x0067; +pub const WAVE_FORMAT_VOXWARE_BYTE_ALIGNED: ::WORD = 0x0069; +pub const WAVE_FORMAT_VOXWARE_AC8: ::WORD = 0x0070; +pub const WAVE_FORMAT_VOXWARE_AC10: ::WORD = 0x0071; +pub const WAVE_FORMAT_VOXWARE_AC16: ::WORD = 0x0072; +pub const WAVE_FORMAT_VOXWARE_AC20: ::WORD = 0x0073; +pub const WAVE_FORMAT_VOXWARE_RT24: ::WORD = 0x0074; +pub const WAVE_FORMAT_VOXWARE_RT29: ::WORD = 0x0075; +pub const WAVE_FORMAT_VOXWARE_RT29HW: ::WORD = 0x0076; +pub const WAVE_FORMAT_VOXWARE_VR12: ::WORD = 0x0077; +pub const WAVE_FORMAT_VOXWARE_VR18: ::WORD = 0x0078; +pub const WAVE_FORMAT_VOXWARE_TQ40: ::WORD = 0x0079; +pub const WAVE_FORMAT_VOXWARE_SC3: ::WORD = 0x007A; +pub const WAVE_FORMAT_VOXWARE_SC3_1: ::WORD = 0x007B; +pub const WAVE_FORMAT_SOFTSOUND: ::WORD = 0x0080; +pub const WAVE_FORMAT_VOXWARE_TQ60: ::WORD = 0x0081; +pub const WAVE_FORMAT_MSRT24: ::WORD = 0x0082; +pub const WAVE_FORMAT_G729A: ::WORD = 0x0083; +pub const WAVE_FORMAT_MVI_MVI2: ::WORD = 0x0084; +pub const WAVE_FORMAT_DF_G726: ::WORD = 0x0085; +pub const WAVE_FORMAT_DF_GSM610: ::WORD = 0x0086; +pub const WAVE_FORMAT_ISIAUDIO: ::WORD = 0x0088; +pub const WAVE_FORMAT_ONLIVE: ::WORD = 0x0089; +pub const WAVE_FORMAT_MULTITUDE_FT_SX20: ::WORD = 0x008A; +pub const WAVE_FORMAT_INFOCOM_ITS_G721_ADPCM: ::WORD = 0x008B; +pub const WAVE_FORMAT_CONVEDIA_G729: ::WORD = 0x008C; +pub const WAVE_FORMAT_CONGRUENCY: ::WORD = 0x008D; +pub const WAVE_FORMAT_SBC24: ::WORD = 0x0091; +pub const WAVE_FORMAT_DOLBY_AC3_SPDIF: ::WORD = 0x0092; +pub const WAVE_FORMAT_MEDIASONIC_G723: ::WORD = 0x0093; +pub const WAVE_FORMAT_PROSODY_8KBPS: ::WORD = 0x0094; +pub const WAVE_FORMAT_ZYXEL_ADPCM: ::WORD = 0x0097; +pub const WAVE_FORMAT_PHILIPS_LPCBB: ::WORD = 0x0098; +pub const WAVE_FORMAT_PACKED: ::WORD = 0x0099; +pub const WAVE_FORMAT_MALDEN_PHONYTALK: ::WORD = 0x00A0; +pub const WAVE_FORMAT_RACAL_RECORDER_GSM: ::WORD = 0x00A1; +pub const WAVE_FORMAT_RACAL_RECORDER_G720_A: ::WORD = 0x00A2; +pub const WAVE_FORMAT_RACAL_RECORDER_G723_1: ::WORD = 0x00A3; +pub const WAVE_FORMAT_RACAL_RECORDER_TETRA_ACELP: ::WORD = 0x00A4; +pub const WAVE_FORMAT_NEC_AAC: ::WORD = 0x00B0; +pub const WAVE_FORMAT_RAW_AAC1: ::WORD = 0x00FF; +pub const WAVE_FORMAT_RHETOREX_ADPCM: ::WORD = 0x0100; +pub const WAVE_FORMAT_IRAT: ::WORD = 0x0101; +pub const WAVE_FORMAT_VIVO_G723: ::WORD = 0x0111; +pub const WAVE_FORMAT_VIVO_SIREN: ::WORD = 0x0112; +pub const WAVE_FORMAT_PHILIPS_CELP: ::WORD = 0x0120; +pub const WAVE_FORMAT_PHILIPS_GRUNDIG: ::WORD = 0x0121; +pub const WAVE_FORMAT_DIGITAL_G723: ::WORD = 0x0123; +pub const WAVE_FORMAT_SANYO_LD_ADPCM: ::WORD = 0x0125; +pub const WAVE_FORMAT_SIPROLAB_ACEPLNET: ::WORD = 0x0130; +pub const WAVE_FORMAT_SIPROLAB_ACELP4800: ::WORD = 0x0131; +pub const WAVE_FORMAT_SIPROLAB_ACELP8V3: ::WORD = 0x0132; +pub const WAVE_FORMAT_SIPROLAB_G729: ::WORD = 0x0133; +pub const WAVE_FORMAT_SIPROLAB_G729A: ::WORD = 0x0134; +pub const WAVE_FORMAT_SIPROLAB_KELVIN: ::WORD = 0x0135; +pub const WAVE_FORMAT_VOICEAGE_AMR: ::WORD = 0x0136; +pub const WAVE_FORMAT_G726ADPCM: ::WORD = 0x0140; +pub const WAVE_FORMAT_DICTAPHONE_CELP68: ::WORD = 0x0141; +pub const WAVE_FORMAT_DICTAPHONE_CELP54: ::WORD = 0x0142; +pub const WAVE_FORMAT_QUALCOMM_PUREVOICE: ::WORD = 0x0150; +pub const WAVE_FORMAT_QUALCOMM_HALFRATE: ::WORD = 0x0151; +pub const WAVE_FORMAT_TUBGSM: ::WORD = 0x0155; +pub const WAVE_FORMAT_MSAUDIO1: ::WORD = 0x0160; +pub const WAVE_FORMAT_WMAUDIO2: ::WORD = 0x0161; +pub const WAVE_FORMAT_WMAUDIO3: ::WORD = 0x0162; +pub const WAVE_FORMAT_WMAUDIO_LOSSLESS: ::WORD = 0x0163; +pub const WAVE_FORMAT_WMASPDIF: ::WORD = 0x0164; +pub const WAVE_FORMAT_UNISYS_NAP_ADPCM: ::WORD = 0x0170; +pub const WAVE_FORMAT_UNISYS_NAP_ULAW: ::WORD = 0x0171; +pub const WAVE_FORMAT_UNISYS_NAP_ALAW: ::WORD = 0x0172; +pub const WAVE_FORMAT_UNISYS_NAP_16K: ::WORD = 0x0173; +pub const WAVE_FORMAT_SYCOM_ACM_SYC008: ::WORD = 0x0174; +pub const WAVE_FORMAT_SYCOM_ACM_SYC701_G726L: ::WORD = 0x0175; +pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP54: ::WORD = 0x0176; +pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP68: ::WORD = 0x0177; +pub const WAVE_FORMAT_KNOWLEDGE_ADVENTURE_ADPCM: ::WORD = 0x0178; +pub const WAVE_FORMAT_FRAUNHOFER_IIS_MPEG2_AAC: ::WORD = 0x0180; +pub const WAVE_FORMAT_DTS_DS: ::WORD = 0x0190; +pub const WAVE_FORMAT_CREATIVE_ADPCM: ::WORD = 0x0200; +pub const WAVE_FORMAT_CREATIVE_FASTSPEECH8: ::WORD = 0x0202; +pub const WAVE_FORMAT_CREATIVE_FASTSPEECH10: ::WORD = 0x0203; +pub const WAVE_FORMAT_UHER_ADPCM: ::WORD = 0x0210; +pub const WAVE_FORMAT_ULEAD_DV_AUDIO: ::WORD = 0x0215; +pub const WAVE_FORMAT_ULEAD_DV_AUDIO_1: ::WORD = 0x0216; +pub const WAVE_FORMAT_QUARTERDECK: ::WORD = 0x0220; +pub const WAVE_FORMAT_ILINK_VC: ::WORD = 0x0230; +pub const WAVE_FORMAT_RAW_SPORT: ::WORD = 0x0240; +pub const WAVE_FORMAT_ESST_AC3: ::WORD = 0x0241; +pub const WAVE_FORMAT_GENERIC_PASSTHRU: ::WORD = 0x0249; +pub const WAVE_FORMAT_IPI_HSX: ::WORD = 0x0250; +pub const WAVE_FORMAT_IPI_RPELP: ::WORD = 0x0251; +pub const WAVE_FORMAT_CS2: ::WORD = 0x0260; +pub const WAVE_FORMAT_SONY_SCX: ::WORD = 0x0270; +pub const WAVE_FORMAT_SONY_SCY: ::WORD = 0x0271; +pub const WAVE_FORMAT_SONY_ATRAC3: ::WORD = 0x0272; +pub const WAVE_FORMAT_SONY_SPC: ::WORD = 0x0273; +pub const WAVE_FORMAT_TELUM_AUDIO: ::WORD = 0x0280; +pub const WAVE_FORMAT_TELUM_IA_AUDIO: ::WORD = 0x0281; +pub const WAVE_FORMAT_NORCOM_VOICE_SYSTEMS_ADPCM: ::WORD = 0x0285; +pub const WAVE_FORMAT_FM_TOWNS_SND: ::WORD = 0x0300; +pub const WAVE_FORMAT_MICRONAS: ::WORD = 0x0350; +pub const WAVE_FORMAT_MICRONAS_CELP833: ::WORD = 0x0351; +pub const WAVE_FORMAT_BTV_DIGITAL: ::WORD = 0x0400; +pub const WAVE_FORMAT_INTEL_MUSIC_CODER: ::WORD = 0x0401; +pub const WAVE_FORMAT_INDEO_AUDIO: ::WORD = 0x0402; +pub const WAVE_FORMAT_QDESIGN_MUSIC: ::WORD = 0x0450; +pub const WAVE_FORMAT_ON2_VP7_AUDIO: ::WORD = 0x0500; +pub const WAVE_FORMAT_ON2_VP6_AUDIO: ::WORD = 0x0501; +pub const WAVE_FORMAT_VME_VMPCM: ::WORD = 0x0680; +pub const WAVE_FORMAT_TPC: ::WORD = 0x0681; +pub const WAVE_FORMAT_LIGHTWAVE_LOSSLESS: ::WORD = 0x08AE; +pub const WAVE_FORMAT_OLIGSM: ::WORD = 0x1000; +pub const WAVE_FORMAT_OLIADPCM: ::WORD = 0x1001; +pub const WAVE_FORMAT_OLICELP: ::WORD = 0x1002; +pub const WAVE_FORMAT_OLISBC: ::WORD = 0x1003; +pub const WAVE_FORMAT_OLIOPR: ::WORD = 0x1004; +pub const WAVE_FORMAT_LH_CODEC: ::WORD = 0x1100; +pub const WAVE_FORMAT_LH_CODEC_CELP: ::WORD = 0x1101; +pub const WAVE_FORMAT_LH_CODEC_SBC8: ::WORD = 0x1102; +pub const WAVE_FORMAT_LH_CODEC_SBC12: ::WORD = 0x1103; +pub const WAVE_FORMAT_LH_CODEC_SBC16: ::WORD = 0x1104; +pub const WAVE_FORMAT_NORRIS: ::WORD = 0x1400; +pub const WAVE_FORMAT_ISIAUDIO_2: ::WORD = 0x1401; +pub const WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS: ::WORD = 0x1500; +pub const WAVE_FORMAT_MPEG_ADTS_AAC: ::WORD = 0x1600; +pub const WAVE_FORMAT_MPEG_RAW_AAC: ::WORD = 0x1601; +pub const WAVE_FORMAT_MPEG_LOAS: ::WORD = 0x1602; +pub const WAVE_FORMAT_NOKIA_MPEG_ADTS_AAC: ::WORD = 0x1608; +pub const WAVE_FORMAT_NOKIA_MPEG_RAW_AAC: ::WORD = 0x1609; +pub const WAVE_FORMAT_VODAFONE_MPEG_ADTS_AAC: ::WORD = 0x160A; +pub const WAVE_FORMAT_VODAFONE_MPEG_RAW_AAC: ::WORD = 0x160B; +pub const WAVE_FORMAT_MPEG_HEAAC: ::WORD = 0x1610; +pub const WAVE_FORMAT_VOXWARE_RT24_SPEECH: ::WORD = 0x181C; +pub const WAVE_FORMAT_SONICFOUNDRY_LOSSLESS: ::WORD = 0x1971; +pub const WAVE_FORMAT_INNINGS_TELECOM_ADPCM: ::WORD = 0x1979; +pub const WAVE_FORMAT_LUCENT_SX8300P: ::WORD = 0x1C07; +pub const WAVE_FORMAT_LUCENT_SX5363S: ::WORD = 0x1C0C; +pub const WAVE_FORMAT_CUSEEME: ::WORD = 0x1F03; +pub const WAVE_FORMAT_NTCSOFT_ALF2CM_ACM: ::WORD = 0x1FC4; +pub const WAVE_FORMAT_DVM: ::WORD = 0x2000; +pub const WAVE_FORMAT_DTS2: ::WORD = 0x2001; +pub const WAVE_FORMAT_MAKEAVIS: ::WORD = 0x3313; +pub const WAVE_FORMAT_DIVIO_MPEG4_AAC: ::WORD = 0x4143; +pub const WAVE_FORMAT_NOKIA_ADAPTIVE_MULTIRATE: ::WORD = 0x4201; +pub const WAVE_FORMAT_DIVIO_G726: ::WORD = 0x4243; +pub const WAVE_FORMAT_LEAD_SPEECH: ::WORD = 0x434C; +pub const WAVE_FORMAT_LEAD_VORBIS: ::WORD = 0x564C; +pub const WAVE_FORMAT_WAVPACK_AUDIO: ::WORD = 0x5756; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_1: ::WORD = 0x674F; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_2: ::WORD = 0x6750; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_3: ::WORD = 0x6751; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_1_PLUS: ::WORD = 0x676F; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_2_PLUS: ::WORD = 0x6770; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_3_PLUS: ::WORD = 0x6771; +pub const WAVE_FORMAT_3COM_NBX: ::WORD = 0x7000; +pub const WAVE_FORMAT_FAAD_AAC: ::WORD = 0x706D; +pub const WAVE_FORMAT_AMR_NB: ::WORD = 0x7361; +pub const WAVE_FORMAT_AMR_WB: ::WORD = 0x7362; +pub const WAVE_FORMAT_AMR_WP: ::WORD = 0x7363; +pub const WAVE_FORMAT_GSM_AMR_CBR: ::WORD = 0x7A21; +pub const WAVE_FORMAT_GSM_AMR_VBR_SID: ::WORD = 0x7A22; +pub const WAVE_FORMAT_COMVERSE_INFOSYS_G723_1: ::WORD = 0xA100; +pub const WAVE_FORMAT_COMVERSE_INFOSYS_AVQSBC: ::WORD = 0xA101; +pub const WAVE_FORMAT_COMVERSE_INFOSYS_SBC: ::WORD = 0xA102; +pub const WAVE_FORMAT_SYMBOL_G729_A: ::WORD = 0xA103; +pub const WAVE_FORMAT_VOICEAGE_AMR_WB: ::WORD = 0xA104; +pub const WAVE_FORMAT_INGENIENT_G726: ::WORD = 0xA105; +pub const WAVE_FORMAT_MPEG4_AAC: ::WORD = 0xA106; +pub const WAVE_FORMAT_ENCORE_G726: ::WORD = 0xA107; +pub const WAVE_FORMAT_ZOLL_ASAO: ::WORD = 0xA108; +pub const WAVE_FORMAT_SPEEX_VOICE: ::WORD = 0xA109; +pub const WAVE_FORMAT_VIANIX_MASC: ::WORD = 0xA10A; +pub const WAVE_FORMAT_WM9_SPECTRUM_ANALYZER: ::WORD = 0xA10B; +pub const WAVE_FORMAT_WMF_SPECTRUM_ANAYZER: ::WORD = 0xA10C; +pub const WAVE_FORMAT_GSM_610: ::WORD = 0xA10D; +pub const WAVE_FORMAT_GSM_620: ::WORD = 0xA10E; +pub const WAVE_FORMAT_GSM_660: ::WORD = 0xA10F; +pub const WAVE_FORMAT_GSM_690: ::WORD = 0xA110; +pub const WAVE_FORMAT_GSM_ADAPTIVE_MULTIRATE_WB: ::WORD = 0xA111; +pub const WAVE_FORMAT_POLYCOM_G722: ::WORD = 0xA112; +pub const WAVE_FORMAT_POLYCOM_G728: ::WORD = 0xA113; +pub const WAVE_FORMAT_POLYCOM_G729_A: ::WORD = 0xA114; +pub const WAVE_FORMAT_POLYCOM_SIREN: ::WORD = 0xA115; +pub const WAVE_FORMAT_GLOBAL_IP_ILBC: ::WORD = 0xA116; +pub const WAVE_FORMAT_RADIOTIME_TIME_SHIFT_RADIO: ::WORD = 0xA117; +pub const WAVE_FORMAT_NICE_ACA: ::WORD = 0xA118; +pub const WAVE_FORMAT_NICE_ADPCM: ::WORD = 0xA119; +pub const WAVE_FORMAT_VOCORD_G721: ::WORD = 0xA11A; +pub const WAVE_FORMAT_VOCORD_G726: ::WORD = 0xA11B; +pub const WAVE_FORMAT_VOCORD_G722_1: ::WORD = 0xA11C; +pub const WAVE_FORMAT_VOCORD_G728: ::WORD = 0xA11D; +pub const WAVE_FORMAT_VOCORD_G729: ::WORD = 0xA11E; +pub const WAVE_FORMAT_VOCORD_G729_A: ::WORD = 0xA11F; +pub const WAVE_FORMAT_VOCORD_G723_1: ::WORD = 0xA120; +pub const WAVE_FORMAT_VOCORD_LBC: ::WORD = 0xA121; +pub const WAVE_FORMAT_NICE_G728: ::WORD = 0xA122; +pub const WAVE_FORMAT_FRACE_TELECOM_G729: ::WORD = 0xA123; +pub const WAVE_FORMAT_CODIAN: ::WORD = 0xA124; +pub const WAVE_FORMAT_FLAC: ::WORD = 0xF1AC; +pub const WAVE_FORMAT_EXTENSIBLE: ::WORD = 0xFFFE; +pub const WAVE_FORMAT_DEVELOPMENT: ::WORD = 0xFFFF; +//2557 +pub const SPEAKER_FRONT_LEFT: ::DWORD = 0x1; +pub const SPEAKER_FRONT_RIGHT: ::DWORD = 0x2; +pub const SPEAKER_FRONT_CENTER: ::DWORD = 0x4; +pub const SPEAKER_LOW_FREQUENCY: ::DWORD = 0x8; +pub const SPEAKER_BACK_LEFT: ::DWORD = 0x10; +pub const SPEAKER_BACK_RIGHT: ::DWORD = 0x20; +pub const SPEAKER_FRONT_LEFT_OF_CENTER: ::DWORD = 0x40; +pub const SPEAKER_FRONT_RIGHT_OF_CENTER: ::DWORD = 0x80; +pub const SPEAKER_BACK_CENTER: ::DWORD = 0x100; +pub const SPEAKER_SIDE_LEFT: ::DWORD = 0x200; +pub const SPEAKER_SIDE_RIGHT: ::DWORD = 0x400; +pub const SPEAKER_TOP_CENTER: ::DWORD = 0x800; +pub const SPEAKER_TOP_FRONT_LEFT: ::DWORD = 0x1000; +pub const SPEAKER_TOP_FRONT_CENTER: ::DWORD = 0x2000; +pub const SPEAKER_TOP_FRONT_RIGHT: ::DWORD = 0x4000; +pub const SPEAKER_TOP_BACK_LEFT: ::DWORD = 0x8000; +pub const SPEAKER_TOP_BACK_CENTER: ::DWORD = 0x10000; +pub const SPEAKER_TOP_BACK_RIGHT: ::DWORD = 0x20000; +pub const SPEAKER_RESERVED: ::DWORD = 0x7FFC0000; +pub const SPEAKER_ALL: ::DWORD = 0x80000000; +STRUCT!{#[repr(packed)] struct WAVEFORMATEX { + wFormatTag: ::WORD, + nChannels: ::WORD, + nSamplesPerSec: ::DWORD, + nAvgBytesPerSec: ::DWORD, + nBlockAlign: ::WORD, + wBitsPerSample: ::WORD, + cbSize: ::WORD, +}} +STRUCT!{#[repr(packed)] struct WAVEFORMATEXTENSIBLE { + Format: ::WAVEFORMATEX, + Samples: ::WORD, + dwChannelMask: ::DWORD, + SubFormat: ::GUID, +}} diff --git a/third_party/rust/winapi/src/mmsystem.rs b/third_party/rust/winapi/src/mmsystem.rs new file mode 100644 index 000000000000..c579edad3f86 --- /dev/null +++ b/third_party/rust/winapi/src/mmsystem.rs @@ -0,0 +1,259 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! MM procedure declarations, constant definitions and macros +//109 (Win 7 SDK) +pub type MMVERSION = ::UINT; +pub type MMRESULT = ::UINT; +STRUCT!{struct MMTIME { + wType: ::UINT, + u: MMTIME_u, +}} +pub type PMMTIME = *mut MMTIME; +pub type NPMMTIME = *mut MMTIME; +pub type LPMMTIME = *mut MMTIME; +STRUCT!{struct MMTIME_u { + data: [u8; 8], +}} +UNION!(MMTIME_u, data, ms, ms_mut, ::DWORD); +UNION!(MMTIME_u, data, sample, sample_mut, ::DWORD); +UNION!(MMTIME_u, data, cb, cb_mut, ::DWORD); +UNION!(MMTIME_u, data, ticks, ticks_mut, ::DWORD); +UNION!(MMTIME_u, data, smpte, smpte_mut, MMTIME_smpte); +UNION!(MMTIME_u, data, midi, midi_mut, MMTIME_midi); +STRUCT!{struct MMTIME_smpte { + hour: ::BYTE, + min: ::BYTE, + sec: ::BYTE, + frame: ::BYTE, + fps: ::BYTE, + dummy: ::BYTE, + pad: [::BYTE; 2], +}} +STRUCT!{struct MMTIME_midi { + songptrpos: ::DWORD, +}} +pub const TIME_MS: ::UINT = 0x0001; +pub const TIME_SAMPLES: ::UINT = 0x0002; +pub const TIME_BYTES: ::UINT = 0x0004; +pub const TIME_SMPTE: ::UINT = 0x0008; +pub const TIME_MIDI: ::UINT = 0x0010; +pub const TIME_TICKS: ::UINT = 0x0020; +pub const MM_JOY1MOVE: ::UINT = 0x3A0; +pub const MM_JOY2MOVE: ::UINT = 0x3A1; +pub const MM_JOY1ZMOVE: ::UINT = 0x3A2; +pub const MM_JOY2ZMOVE: ::UINT = 0x3A3; +pub const MM_JOY1BUTTONDOWN: ::UINT = 0x3B5; +pub const MM_JOY2BUTTONDOWN: ::UINT = 0x3B6; +pub const MM_JOY1BUTTONUP: ::UINT = 0x3B7; +pub const MM_JOY2BUTTONUP: ::UINT = 0x3B8; +pub const MM_MCINOTIFY: ::UINT = 0x3B9; +pub const MM_WOM_OPEN: ::UINT = 0x3BB; +pub const MM_WOM_CLOSE: ::UINT = 0x3BC; +pub const MM_WOM_DONE: ::UINT = 0x3BD; +pub const MM_WIM_OPEN: ::UINT = 0x3BE; +pub const MM_WIM_CLOSE: ::UINT = 0x3BF; +pub const MM_WIM_DATA: ::UINT = 0x3C0; +pub const MM_MIM_OPEN: ::UINT = 0x3C1; +pub const MM_MIM_CLOSE: ::UINT = 0x3C2; +pub const MM_MIM_DATA: ::UINT = 0x3C3; +pub const MM_MIM_LONGDATA: ::UINT = 0x3C4; +pub const MM_MIM_ERROR: ::UINT = 0x3C5; +pub const MM_MIM_LONGERROR: ::UINT = 0x3C6; +pub const MM_MOM_OPEN: ::UINT = 0x3C7; +pub const MM_MOM_CLOSE: ::UINT = 0x3C8; +pub const MM_MOM_DONE: ::UINT = 0x3C9; +pub const MMSYSERR_BASE: MMRESULT = 0; +pub const WAVERR_BASE: MMRESULT = 32; +pub const MIDIERR_BASE: MMRESULT = 64; +pub const TIMERR_BASE: MMRESULT = 96; +pub const JOYERR_BASE: MMRESULT = 160; +pub const MCIERR_BASE: MMRESULT = 256; +pub const MIXERR_BASE: MMRESULT = 1024; +pub const MMSYSERR_NOERROR: MMRESULT = 0; +pub const MMSYSERR_ERROR: MMRESULT = MMSYSERR_BASE + 1; +pub const MMSYSERR_BADDEVICEID: MMRESULT = MMSYSERR_BASE + 2; +pub const MMSYSERR_NOTENABLED: MMRESULT = MMSYSERR_BASE + 3; +pub const MMSYSERR_ALLOCATED: MMRESULT = MMSYSERR_BASE + 4; +pub const MMSYSERR_INVALHANDLE: MMRESULT = MMSYSERR_BASE + 5; +pub const MMSYSERR_NODRIVER: MMRESULT = MMSYSERR_BASE + 6; +pub const MMSYSERR_NOMEM: MMRESULT = MMSYSERR_BASE + 7; +pub const MMSYSERR_NOTSUPPORTED: MMRESULT = MMSYSERR_BASE + 8; +pub const MMSYSERR_BADERRNUM: MMRESULT = MMSYSERR_BASE + 9; +pub const MMSYSERR_INVALFLAG: MMRESULT = MMSYSERR_BASE + 10; +pub const MMSYSERR_INVALPARAM: MMRESULT = MMSYSERR_BASE + 11; +pub const MMSYSERR_HANDLEBUSY: MMRESULT = MMSYSERR_BASE + 12; +pub const MMSYSERR_INVALIDALIAS: MMRESULT = MMSYSERR_BASE + 13; +pub const MMSYSERR_BADDB: MMRESULT = MMSYSERR_BASE + 14; +pub const MMSYSERR_KEYNOTFOUND: MMRESULT = MMSYSERR_BASE + 15; +pub const MMSYSERR_READERROR: MMRESULT = MMSYSERR_BASE + 16; +pub const MMSYSERR_WRITEERROR: MMRESULT = MMSYSERR_BASE + 17; +pub const MMSYSERR_DELETEERROR: MMRESULT = MMSYSERR_BASE + 18; +pub const MMSYSERR_VALNOTFOUND: MMRESULT = MMSYSERR_BASE + 19; +pub const MMSYSERR_NODRIVERCB: MMRESULT = MMSYSERR_BASE + 20; +pub const MMSYSERR_MOREDATA: MMRESULT = MMSYSERR_BASE + 21; +pub const MMSYSERR_LASTERROR: MMRESULT = MMSYSERR_BASE + 21; +pub const MIDIERR_UNPREPARED: MMRESULT = MIDIERR_BASE + 0; +pub const MIDIERR_STILLPLAYING: MMRESULT = MIDIERR_BASE + 1; +pub const MIDIERR_NOMAP: MMRESULT = MIDIERR_BASE + 2; +pub const MIDIERR_NOTREADY: MMRESULT = MIDIERR_BASE + 3; +pub const MIDIERR_NODEVICE: MMRESULT = MIDIERR_BASE + 4; +pub const MIDIERR_INVALIDSETUP: MMRESULT = MIDIERR_BASE + 5; +pub const MIDIERR_BADOPENMODE: MMRESULT = MIDIERR_BASE + 6; +pub const MIDIERR_DONT_CONTINUE: MMRESULT = MIDIERR_BASE + 7; +pub const MIDIERR_LASTERROR: MMRESULT = MIDIERR_BASE + 7; +pub const CALLBACK_TYPEMASK: ::DWORD = 0x00070000; +pub const CALLBACK_NULL: ::DWORD = 0x00000000; +pub const CALLBACK_WINDOW: ::DWORD = 0x00010000; +pub const CALLBACK_TASK: ::DWORD = 0x00020000; +pub const CALLBACK_FUNCTION: ::DWORD = 0x00030000; +pub const CALLBACK_THREAD: ::DWORD = CALLBACK_TASK; +pub const CALLBACK_EVENT: ::DWORD = 0x00050000; +//497 (Win 7 SDK) +pub const WAVERR_BADFORMAT: MMRESULT = WAVERR_BASE + 0; +pub const WAVERR_STILLPLAYING: MMRESULT = WAVERR_BASE + 1; +pub const WAVERR_UNPREPARED: MMRESULT = WAVERR_BASE + 2; +pub const WAVERR_SYNC: MMRESULT = WAVERR_BASE + 3; +pub const WAVERR_LASTERROR: MMRESULT = WAVERR_BASE + 3; +DECLARE_HANDLE!(HWAVEIN, HWAVEIN__); +DECLARE_HANDLE!(HWAVEOUT, HWAVEOUT__); +pub type LPHWAVEIN = *mut HWAVEIN; +pub type LPHWAVEOUT = *mut HWAVEOUT; +pub const WOM_OPEN: ::UINT = MM_WOM_OPEN; +pub const WOM_CLOSE: ::UINT = MM_WOM_CLOSE; +pub const WOM_DONE: ::UINT = MM_WOM_DONE; +pub const WIM_OPEN: ::UINT = MM_WIM_OPEN; +pub const WIM_CLOSE: ::UINT = MM_WIM_CLOSE; +pub const WIM_DATA: ::UINT = MM_WIM_DATA; +pub const WAVE_MAPPER: ::UINT = 0xFFFFFFFF; +pub const WAVE_FORMAT_QUERY: ::DWORD = 0x0001; +pub const WAVE_ALLOWSYNC: ::DWORD = 0x0002; +pub const WAVE_MAPPED: ::DWORD = 0x0004; +pub const WAVE_FORMAT_DIRECT: ::DWORD = 0x0008; +pub const WAVE_FORMAT_DIRECT_QUERY: ::DWORD = WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT; +pub const WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE: ::DWORD = 0x0010; +STRUCT!{struct WAVEHDR { + lpData: ::LPSTR, + dwBufferLength: ::DWORD, + dwBytesRecorded: ::DWORD, + dwUser: ::DWORD_PTR, + dwFlags: ::DWORD, + dwLoops: ::DWORD, + lpNext: *mut WAVEHDR, + reserved: ::DWORD_PTR, +}} +pub type PWAVEHDR = *mut WAVEHDR; +pub type NPWAVEHDR = *mut WAVEHDR; +pub type LPWAVEHDR = *mut WAVEHDR; +STRUCT!{struct WAVEOUTCAPSW { + wMid: ::WORD, + wPid: ::WORD, + vDriverVersion: MMVERSION, + szPname: [::WCHAR; 32], + dwFormats: ::DWORD, + wChannels: ::WORD, + wReserved1: ::WORD, + dwSupport: ::DWORD, +}} +pub type PWAVEOUTCAPSW = *mut WAVEOUTCAPSW; +pub type NPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; +pub type LPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; +STRUCT!{struct WAVEINCAPSW { + wMid: ::WORD, + wPid: ::WORD, + vDriverVersion: MMVERSION, + szPname: [::WCHAR; 32], + dwFormats: ::DWORD, + wChannels: ::WORD, + wReserved1: ::WORD, +}} +pub type PWAVEINCAPSW = *mut WAVEINCAPSW; +pub type NPWAVEINCAPSW = *mut WAVEINCAPSW; +pub type LPWAVEINCAPSW = *mut WAVEINCAPSW; +pub const WAVE_INVALIDFORMAT: ::DWORD = 0x00000000; +pub const WAVE_FORMAT_1M08: ::DWORD = 0x00000001; +pub const WAVE_FORMAT_1S08: ::DWORD = 0x00000002; +pub const WAVE_FORMAT_1M16: ::DWORD = 0x00000004; +pub const WAVE_FORMAT_1S16: ::DWORD = 0x00000008; +pub const WAVE_FORMAT_2M08: ::DWORD = 0x00000010; +pub const WAVE_FORMAT_2S08: ::DWORD = 0x00000020; +pub const WAVE_FORMAT_2M16: ::DWORD = 0x00000040; +pub const WAVE_FORMAT_2S16: ::DWORD = 0x00000080; +pub const WAVE_FORMAT_4M08: ::DWORD = 0x00000100; +pub const WAVE_FORMAT_4S08: ::DWORD = 0x00000200; +pub const WAVE_FORMAT_4M16: ::DWORD = 0x00000400; +pub const WAVE_FORMAT_4S16: ::DWORD = 0x00000800; +pub const WAVE_FORMAT_44M08: ::DWORD = 0x00000100; +pub const WAVE_FORMAT_44S08: ::DWORD = 0x00000200; +pub const WAVE_FORMAT_44M16: ::DWORD = 0x00000400; +pub const WAVE_FORMAT_44S16: ::DWORD = 0x00000800; +pub const WAVE_FORMAT_48M08: ::DWORD = 0x00001000; +pub const WAVE_FORMAT_48S08: ::DWORD = 0x00002000; +pub const WAVE_FORMAT_48M16: ::DWORD = 0x00004000; +pub const WAVE_FORMAT_48S16: ::DWORD = 0x00008000; +pub const WAVE_FORMAT_96M08: ::DWORD = 0x00010000; +pub const WAVE_FORMAT_96S08: ::DWORD = 0x00020000; +pub const WAVE_FORMAT_96M16: ::DWORD = 0x00040000; +pub const WAVE_FORMAT_96S16: ::DWORD = 0x00080000; +//782 (Win 7 SDK) +pub type PWAVEFORMATEX = *mut ::WAVEFORMATEX; +pub type NPWAVEFORMATEX = *mut ::WAVEFORMATEX; +pub type LPWAVEFORMATEX = *mut ::WAVEFORMATEX; +pub type LPCWAVEFORMATEX = *const ::WAVEFORMATEX; +//2170 (Win 7 SDK) +pub const TIMERR_NOERROR: ::MMRESULT = 0; +pub const TIMERR_NOCANDO: ::MMRESULT = TIMERR_BASE + 1; +pub const TIMERR_STRUCT: ::MMRESULT = TIMERR_BASE + 33; +//2198 (Win 7 SDK) +STRUCT!{struct TIMECAPS { + wPeriodMin: ::UINT, + wPeriodMax: ::UINT, +}} +pub type PTIMECAPS = *mut TIMECAPS; +pub type NPTIMECAPS = *mut TIMECAPS; +pub type LPTIMECAPS = *mut TIMECAPS; +STRUCT!{struct MIDIHDR { + lpData: ::LPSTR, + dwBufferLength: ::DWORD, + dwBytesRecorded: ::DWORD, + dwUser: ::DWORD_PTR, + dwFlags: ::DWORD, + lpNext: *mut MIDIHDR, + reserved: ::DWORD_PTR, + dwOffset: ::DWORD, + dwReserved: [::DWORD_PTR; 4], +}} +pub type PMIDIHDR = *mut MIDIHDR; +pub type NPMIDIHDR = *mut MIDIHDR; +pub type LPMIDIHDR = *mut MIDIHDR; +STRUCT!{struct MIDIINCAPSW { + wMid: ::WORD, + wPid: ::WORD, + vDriverVersion: MMVERSION, + szPname: [::WCHAR; 32], + dwSupport: ::DWORD, +}} +pub type PMIDIINCAPSW = *mut MIDIINCAPSW; +pub type NPMIDIINCAPSW = *mut MIDIINCAPSW; +pub type LPMIDIINCAPSW = *mut MIDIINCAPSW; +STRUCT!{struct MIDIOUTCAPSW { + wMid: ::WORD, + wPid: ::WORD, + vDriverVersion: ::MMVERSION, + szPname: [::WCHAR; 32], + wTechnology: ::WORD, + wVoices: ::WORD, + wNotes: ::WORD, + wChannelMask: ::WORD, + dwSupport: ::DWORD, +}} +pub type PMIDIOUTCAPSW = *mut MIDIOUTCAPSW; +pub type NPMIDIOUTCAPSW = *mut MIDIOUTCAPSW; +pub type LPMIDIOUTCAPSW = *mut MIDIOUTCAPSW; +DECLARE_HANDLE!(HMIDIIN, HMIDIIN__); +DECLARE_HANDLE!(HMIDIOUT, HMIDIOUT__); +pub type LPHMIDIIN = *mut HMIDIIN; +pub type LPHMIDIOUT = *mut HMIDIOUT; +DECLARE_HANDLE!(HMIDISTRM, HMIDISTRM__); +DECLARE_HANDLE!(HMIDI, HMIDI__); +pub type LPHMIDISTRM = *mut HMIDISTRM; +pub type LPHMIDI = *mut HMIDI; diff --git a/third_party/rust/winapi/src/mscat.rs b/third_party/rust/winapi/src/mscat.rs new file mode 100644 index 000000000000..cc159de26f62 --- /dev/null +++ b/third_party/rust/winapi/src/mscat.rs @@ -0,0 +1,28 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Microsoft Internet Security Catalog API Prototypes and Definitions +STRUCT!{struct CRYPTCATSTORE { + cbStruct: ::DWORD, + dwPublicVersion: ::DWORD, + pwszP7File: ::LPWSTR, + hProv: ::HCRYPTPROV, + dwEncodingType: ::DWORD, + fdwStoreFlags: ::DWORD, + hReserved: ::HANDLE, + hAttrs: ::HANDLE, + hCryptMsg: ::HCRYPTMSG, + hSorted: ::HANDLE, +}} +STRUCT!{struct CRYPTCATMEMBER { + cbStruct: ::DWORD, + pwszReferenceTag: ::LPWSTR, + pwszFileName: ::LPWSTR, + gSubjectType: ::GUID, + fdwMemberFlags: ::DWORD, + pIndirectData: *mut ::SIP_INDIRECT_DATA, + dwCertVersion: ::DWORD, + dwReserved: ::DWORD, + hReserved: ::HANDLE, + sEncodedIndirectData: ::CRYPT_ATTR_BLOB, + sEncodedMemberInfo: ::CRYPT_ATTR_BLOB, +}} diff --git a/third_party/rust/winapi/src/mssip.rs b/third_party/rust/winapi/src/mssip.rs new file mode 100644 index 000000000000..5eeaa7e74a73 --- /dev/null +++ b/third_party/rust/winapi/src/mssip.rs @@ -0,0 +1,103 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Microsoft SIP Provider Prototypes and Definitions +STRUCT!{struct SIP_SUBJECTINFO { + cbSize: ::DWORD, + pgSubjectType: *mut ::GUID, + hFile: ::HANDLE, + pwsFileName: ::LPCWSTR, + pwsDisplayName: ::LPCWSTR, + dwReserved1: ::DWORD, + dwIntVersion: ::DWORD, + hProv: ::HCRYPTPROV, + DigestAlgorithm: ::CRYPT_ALGORITHM_IDENTIFIER, + dwFlags: ::DWORD, + dwEncodingType: ::DWORD, + dwReserved2: ::DWORD, + fdwCAPISettings: ::DWORD, + fdwSecuritySettings: ::DWORD, + dwIndex: ::DWORD, + dwUnionChoice: ::DWORD, + psFlat: *mut MS_ADDINFO_FLAT, + pClientData: ::LPVOID, +}} +UNION!(SIP_SUBJECTINFO, psFlat, psCatMember, psCatMember_mut, *mut MS_ADDINFO_CATALOGMEMBER); +UNION!(SIP_SUBJECTINFO, psFlat, psBlob, psBlob_mut, *mut MS_ADDINFO_BLOB); +pub type LPSIP_SUBJECTINFO = *mut SIP_SUBJECTINFO; +STRUCT!{struct MS_ADDINFO_FLAT { + cbStruct: ::DWORD, + pIndirectData: *mut SIP_INDIRECT_DATA, +}} +pub type PMS_ADDINFO_FLAT = *mut MS_ADDINFO_FLAT; +STRUCT!{struct MS_ADDINFO_CATALOGMEMBER { + cbStruct: ::DWORD, + pStore: *mut ::CRYPTCATSTORE, + pMember: *mut ::CRYPTCATMEMBER, +}} +pub type PMS_ADDINFO_CATALOGMEMBER = *mut MS_ADDINFO_CATALOGMEMBER; +STRUCT!{struct MS_ADDINFO_BLOB { + cbStruct: ::DWORD, + cbMemObject: ::DWORD, + pbMemObject: *mut ::BYTE, + cbMemSignedMsg: ::DWORD, + pbMemSignedMsg: *mut ::BYTE, +}} +pub type PMS_ADDINFO_BLOB = *mut MS_ADDINFO_BLOB; +STRUCT!{struct SIP_INDIRECT_DATA { + Data: ::CRYPT_ATTRIBUTE_TYPE_VALUE, + DigestAlgorithm: ::CRYPT_ALGORITHM_IDENTIFIER, + Digest: ::CRYPT_HASH_BLOB, +}} +pub type PSIP_INDIRECT_DATA = *mut SIP_INDIRECT_DATA; +STRUCT!{struct SIP_ADD_NEWPROVIDER { + cbStruct: ::DWORD, + pgSubject: *mut ::GUID, + pwszDLLFileName: *mut ::WCHAR, + pwszMagicNumber: *mut ::WCHAR, + pwszIsFunctionName: *mut ::WCHAR, + pwszGetFuncName: *mut ::WCHAR, + pwszPutFuncName: *mut ::WCHAR, + pwszCreateFuncName: *mut ::WCHAR, + pwszVerifyFuncName: *mut ::WCHAR, + pwszRemoveFuncName: *mut ::WCHAR, + pwszIsFunctionNameFmt2: *mut ::WCHAR, + pwszGetCapFuncName: ::PWSTR, +}} +pub type PSIP_ADD_NEWPROVIDER = *mut SIP_ADD_NEWPROVIDER; +STRUCT!{struct SIP_CAP_SET_V3 { + cbSize: ::DWORD, + dwVersion: ::DWORD, + isMultiSign: ::BOOL, + dwFlags: ::DWORD, +}} +UNION!(SIP_CAP_SET_V3, dwFlags, dwReserved, dwReserved_mut, ::DWORD); +pub type PSIP_CAP_SET_V3 = *mut SIP_CAP_SET_V3; +pub type SIP_CAP_SET = PSIP_CAP_SET_V3; +pub type pCryptSIPGetSignedDataMsg = Option ::BOOL>; +pub type pCryptSIPPutSignedDataMsg = Option ::BOOL>; +pub type pCryptSIPCreateIndirectData = Option ::BOOL>; +pub type pCryptSIPVerifyIndirectData = Option ::BOOL>; +pub type pCryptSIPRemoveSignedDataMsg = Option ::BOOL>; +STRUCT!{nodebug struct SIP_DISPATCH_INFO { + cbSize: ::DWORD, + hSIP: ::HANDLE, + pfGet: pCryptSIPGetSignedDataMsg, + pfPut: pCryptSIPPutSignedDataMsg, + pfCreate: pCryptSIPCreateIndirectData, + pfVerify: pCryptSIPVerifyIndirectData, + pfRemove: pCryptSIPRemoveSignedDataMsg, +}} +pub type LPSIP_DISPATCH_INFO = *mut SIP_DISPATCH_INFO; diff --git a/third_party/rust/winapi/src/nb30.rs b/third_party/rust/winapi/src/nb30.rs new file mode 100644 index 000000000000..26e9dea0ae8b --- /dev/null +++ b/third_party/rust/winapi/src/nb30.rs @@ -0,0 +1,200 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +// This module contains the definitions for portable NetBIOS 3.0 support. +pub const NCBNAMSZ: usize = 16; +pub const MAX_LANA: usize = 254; +pub type PFPOST = Option; +#[cfg(target_arch="x86_64")] +STRUCT!{nodebug struct NCB { + ncb_command: ::UCHAR, + ncb_retcode: ::UCHAR, + ncb_lsn: ::UCHAR, + ncb_num: ::UCHAR, + ncb_buffer: ::PUCHAR, + ncb_length: ::WORD, + ncb_callname: [::UCHAR; NCBNAMSZ], + ncb_name: [::UCHAR; NCBNAMSZ], + ncb_rto: ::UCHAR, + ncb_sto: ::UCHAR, + ncb_post: PFPOST, + ncb_lana_num: ::UCHAR, + ncb_cmd_cplt: ::UCHAR, + ncb_reserve: [::UCHAR; 18], + ncb_event: ::HANDLE, +}} +#[cfg(target_arch="x86")] +STRUCT!{nodebug struct NCB { + ncb_command: ::UCHAR, + ncb_retcode: ::UCHAR, + ncb_lsn: ::UCHAR, + ncb_num: ::UCHAR, + ncb_buffer: ::PUCHAR, + ncb_length: ::WORD, + ncb_callname: [::UCHAR; NCBNAMSZ], + ncb_name: [::UCHAR; NCBNAMSZ], + ncb_rto: ::UCHAR, + ncb_sto: ::UCHAR, + ncb_post: PFPOST, + ncb_lana_num: ::UCHAR, + ncb_cmd_cplt: ::UCHAR, + ncb_reserve: [::UCHAR; 10], + ncb_event: ::HANDLE, +}} +pub type PNCB = *mut NCB; +STRUCT!{struct ADAPTER_STATUS { + adapter_address: [::UCHAR; 6], + rev_major: ::UCHAR, + reserved0: ::UCHAR, + adapter_type: ::UCHAR, + rev_minor: ::UCHAR, + duration: ::WORD, + frmr_recv: ::WORD, + frmr_xmit: ::WORD, + iframe_recv_err: ::WORD, + xmit_aborts: ::WORD, + xmit_success: ::DWORD, + recv_success: ::DWORD, + iframe_xmit_err: ::WORD, + recv_buff_unavail: ::WORD, + t1_timeouts: ::WORD, + ti_timeouts: ::WORD, + reserved1: ::DWORD, + free_ncbs: ::WORD, + max_cfg_ncbs: ::WORD, + max_ncbs: ::WORD, + xmit_buf_unavail: ::WORD, + max_dgram_size: ::WORD, + pending_sess: ::WORD, + max_cfg_sess: ::WORD, + max_sess: ::WORD, + max_sess_pkt_size: ::WORD, + name_count: ::WORD, +}} +pub type PADAPTER_STATUS = *mut ADAPTER_STATUS; +STRUCT!{struct NAME_BUFFER { + name: [::UCHAR; NCBNAMSZ], + name_num: ::UCHAR, + name_flags: ::UCHAR, +}} +pub type PNAME_BUFFER = *mut NAME_BUFFER; +pub const NAME_FLAGS_MASK: ::UCHAR = 0x87; +pub const GROUP_NAME: ::UCHAR = 0x80; +pub const UNIQUE_NAME: ::UCHAR = 0x00; +pub const REGISTERING: ::UCHAR = 0x00; +pub const REGISTERED: ::UCHAR = 0x04; +pub const DEREGISTERED: ::UCHAR = 0x05; +pub const DUPLICATE: ::UCHAR = 0x06; +pub const DUPLICATE_DEREG: ::UCHAR = 0x07; +STRUCT!{struct SESSION_HEADER { + sess_name: ::UCHAR, + num_sess: ::UCHAR, + rcv_dg_outstanding: ::UCHAR, + rcv_any_outstanding: ::UCHAR, +}} +pub type PSESSION_HEADER = *mut SESSION_HEADER; +STRUCT!{struct SESSION_BUFFER { + lsn: ::UCHAR, + state: ::UCHAR, + local_name: [::UCHAR; NCBNAMSZ], + remote_name: [::UCHAR; NCBNAMSZ], + rcvs_outstanding: ::UCHAR, + sends_outstanding: ::UCHAR, +}} +pub type PSESSION_BUFFER = *mut SESSION_BUFFER; +pub const LISTEN_OUTSTANDING: ::UCHAR = 0x01; +pub const CALL_PENDING: ::UCHAR = 0x02; +pub const SESSION_ESTABLISHED: ::UCHAR = 0x03; +pub const HANGUP_PENDING: ::UCHAR = 0x04; +pub const HANGUP_COMPLETE: ::UCHAR = 0x05; +pub const SESSION_ABORTED: ::UCHAR = 0x06; +STRUCT!{nodebug struct LANA_ENUM { + length: ::UCHAR, + lana: [::UCHAR; MAX_LANA + 1], +}} +pub type PLANA_ENUM = *mut LANA_ENUM; +STRUCT!{struct FIND_NAME_HEADER { + node_count: ::WORD, + reserved: ::UCHAR, + unique_group: ::UCHAR, +}} +pub type PFIND_NAME_HEADER = *mut FIND_NAME_HEADER; +STRUCT!{struct FIND_NAME_BUFFER { + length: ::UCHAR, + access_control: ::UCHAR, + frame_control: ::UCHAR, + destination_addr: [::UCHAR; 6], + source_addr: [::UCHAR; 6], + routing_info: [::UCHAR; 18], +}} +pub type PFIND_NAME_BUFFER = *mut FIND_NAME_BUFFER; +STRUCT!{struct ACTION_HEADER { + transport_id: ::ULONG, + action_code: ::USHORT, + reserved: ::USHORT, +}} +pub type PACTION_HEADER = *mut ACTION_HEADER; +pub const NCBCALL: ::UCHAR = 0x10; +pub const NCBLISTEN: ::UCHAR = 0x11; +pub const NCBHANGUP: ::UCHAR = 0x12; +pub const NCBSEND: ::UCHAR = 0x14; +pub const NCBRECV: ::UCHAR = 0x15; +pub const NCBRECVANY: ::UCHAR = 0x16; +pub const NCBCHAINSEND: ::UCHAR = 0x17; +pub const NCBDGSEND: ::UCHAR = 0x20; +pub const NCBDGRECV: ::UCHAR = 0x21; +pub const NCBDGSENDBC: ::UCHAR = 0x22; +pub const NCBADDNAME: ::UCHAR = 0x30; +pub const NCBDELNAME: ::UCHAR = 0x31; +pub const NCBRESET: ::UCHAR = 0x32; +pub const NCBASTAT: ::UCHAR = 0x33; +pub const NCBSSTAT: ::UCHAR = 0x34; +pub const NCBCANCEL: ::UCHAR = 0x35; +pub const NCBADDGRNAME: ::UCHAR = 0x36; +pub const NCBENUM: ::UCHAR = 0x37; +pub const NCBUNLINK: ::UCHAR = 0x70; +pub const NCBSENDNA: ::UCHAR = 0x71; +pub const NCBCHAINSENDNA: ::UCHAR = 0x72; +pub const NCBLANSTALERT: ::UCHAR = 0x73; +pub const NCBACTION: ::UCHAR = 0x77; +pub const NCBFINDNAME: ::UCHAR = 0x78; +pub const NCBTRACE: ::UCHAR = 0x79; +pub const ASYNCH: ::UCHAR = 0x80; +pub const NRC_GOODRET: ::UCHAR = 0x00; +pub const NRC_BUFLEN: ::UCHAR = 0x01; +pub const NRC_ILLCMD: ::UCHAR = 0x03; +pub const NRC_CMDTMO: ::UCHAR = 0x05; +pub const NRC_INCOMP: ::UCHAR = 0x06; +pub const NRC_BADDR: ::UCHAR = 0x07; +pub const NRC_SNUMOUT: ::UCHAR = 0x08; +pub const NRC_NORES: ::UCHAR = 0x09; +pub const NRC_SCLOSED: ::UCHAR = 0x0a; +pub const NRC_CMDCAN: ::UCHAR = 0x0b; +pub const NRC_DUPNAME: ::UCHAR = 0x0d; +pub const NRC_NAMTFUL: ::UCHAR = 0x0e; +pub const NRC_ACTSES: ::UCHAR = 0x0f; +pub const NRC_LOCTFUL: ::UCHAR = 0x11; +pub const NRC_REMTFUL: ::UCHAR = 0x12; +pub const NRC_ILLNN: ::UCHAR = 0x13; +pub const NRC_NOCALL: ::UCHAR = 0x14; +pub const NRC_NOWILD: ::UCHAR = 0x15; +pub const NRC_INUSE: ::UCHAR = 0x16; +pub const NRC_NAMERR: ::UCHAR = 0x17; +pub const NRC_SABORT: ::UCHAR = 0x18; +pub const NRC_NAMCONF: ::UCHAR = 0x19; +pub const NRC_IFBUSY: ::UCHAR = 0x21; +pub const NRC_TOOMANY: ::UCHAR = 0x22; +pub const NRC_BRIDGE: ::UCHAR = 0x23; +pub const NRC_CANOCCR: ::UCHAR = 0x24; +pub const NRC_CANCEL: ::UCHAR = 0x26; +pub const NRC_DUPENV: ::UCHAR = 0x30; +pub const NRC_ENVNOTDEF: ::UCHAR = 0x34; +pub const NRC_OSRESNOTAV: ::UCHAR = 0x35; +pub const NRC_MAXAPPS: ::UCHAR = 0x36; +pub const NRC_NOSAPS: ::UCHAR = 0x37; +pub const NRC_NORESOURCES: ::UCHAR = 0x38; +pub const NRC_INVADDRESS: ::UCHAR = 0x39; +pub const NRC_INVDDID: ::UCHAR = 0x3B; +pub const NRC_LOCKFAIL: ::UCHAR = 0x3C; +pub const NRC_OPENERR: ::UCHAR = 0x3f; +pub const NRC_SYSTEM: ::UCHAR = 0x40; +pub const NRC_PENDING: ::UCHAR = 0xff; diff --git a/third_party/rust/winapi/src/ncrypt.rs b/third_party/rust/winapi/src/ncrypt.rs new file mode 100644 index 000000000000..e7301415cb27 --- /dev/null +++ b/third_party/rust/winapi/src/ncrypt.rs @@ -0,0 +1,9 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Cryptographic API Prototypes and Definitions +//191 +pub type NCRYPT_HANDLE = ::ULONG_PTR; +pub type NCRYPT_PROV_HANDLE = ::ULONG_PTR; +pub type NCRYPT_KEY_HANDLE = ::ULONG_PTR; +pub type NCRYPT_HASH_HANDLE = ::ULONG_PTR; +pub type NCRYPT_SECRET_HANDLE = ::ULONG_PTR; diff --git a/third_party/rust/winapi/src/ntdef.rs b/third_party/rust/winapi/src/ntdef.rs new file mode 100644 index 000000000000..2e6f14b0e2ab --- /dev/null +++ b/third_party/rust/winapi/src/ntdef.rs @@ -0,0 +1,7 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Type definitions for the basic types. +//909 +pub type NTSTATUS = ::LONG; +pub type PNTSTATUS = *mut NTSTATUS; +pub type PCNTSTATUS = *const NTSTATUS; diff --git a/third_party/rust/winapi/src/ntsecapi.rs b/third_party/rust/winapi/src/ntsecapi.rs new file mode 100644 index 000000000000..893ea9e4eab0 --- /dev/null +++ b/third_party/rust/winapi/src/ntsecapi.rs @@ -0,0 +1,1589 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! This module defines the Local Security Authority APIs. +DEFINE_GUID!(Audit_System_SecurityStateChange, 0x0cce9210, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_SecuritySubsystemExtension, 0x0cce9211, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_Integrity, 0x0cce9212, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_IPSecDriverEvents, 0x0cce9213, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_Others, 0x0cce9214, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Logon, 0x0cce9215, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Logoff, 0x0cce9216, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_AccountLockout, 0x0cce9217, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_IPSecMainMode, 0x0cce9218, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_IPSecQuickMode, 0x0cce9219, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_IPSecUserMode, 0x0cce921a, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_SpecialLogon, 0x0cce921b, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Others, 0x0cce921c, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_FileSystem, 0x0cce921d, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Registry, 0x0cce921e, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Kernel, 0x0cce921f, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Sam, 0x0cce9220, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_CertificationServices, 0x0cce9221, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_ApplicationGenerated, 0x0cce9222, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Handle, 0x0cce9223, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Share, 0x0cce9224, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_FirewallPacketDrops, 0x0cce9225, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_FirewallConnection, 0x0cce9226, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Other, 0x0cce9227, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse_Sensitive, 0x0cce9228, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse_NonSensitive, 0x0cce9229, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse_Others, 0x0cce922a, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_ProcessCreation, 0x0cce922b, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_ProcessTermination, 0x0cce922c, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_DpapiActivity, 0x0cce922d, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_RpcCall, 0x0cce922e, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_AuditPolicy, 0x0cce922f, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_AuthenticationPolicy, 0x0cce9230, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_AuthorizationPolicy, 0x0cce9231, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_MpsscvRulePolicy, 0x0cce9232, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_WfpIPSecPolicy, 0x0cce9233, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_Others, 0x0cce9234, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_UserAccount, 0x0cce9235, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_ComputerAccount, 0x0cce9236, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_SecurityGroup, 0x0cce9237, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_DistributionGroup, 0x0cce9238, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_ApplicationGroup, 0x0cce9239, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_Others, 0x0cce923a, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DSAccess_DSAccess, 0x0cce923b, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DsAccess_AdAuditChanges, 0x0cce923c, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Ds_Replication, 0x0cce923d, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Ds_DetailedReplication, 0x0cce923e, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_CredentialValidation, 0x0cce923f, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_Kerberos, 0x0cce9240, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_Others, 0x0cce9241, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_KerbCredentialValidation, 0x0cce9242, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_NPS, 0x0cce9243, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_DetailedFileShare, 0x0cce9244, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_RemovableStorage, 0x0cce9245, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_CbacStaging, 0x0cce9246, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Claims, 0x0cce9247, 0x69ae, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System, 0x69979848, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon, 0x69979849, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess, 0x6997984a, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse, 0x6997984b, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking, 0x6997984c, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange, 0x6997984d, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement, 0x6997984e, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DirectoryServiceAccess, 0x6997984f, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon, 0x69979850, 0x797a, 0x11d9, + 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +ENUM!{enum POLICY_AUDIT_EVENT_TYPE { + AuditCategorySystem = 0, + AuditCategoryLogon, + AuditCategoryObjectAccess, + AuditCategoryPrivilegeUse, + AuditCategoryDetailedTracking, + AuditCategoryPolicyChange, + AuditCategoryAccountManagement, + AuditCategoryDirectoryServiceAccess, + AuditCategoryAccountLogon, +}} +pub type PPOLICY_AUDIT_EVENT_TYPE = *mut POLICY_AUDIT_EVENT_TYPE; +pub const POLICY_AUDIT_EVENT_UNCHANGED: POLICY_AUDIT_EVENT_OPTIONS = 0x00000000; +pub const POLICY_AUDIT_EVENT_SUCCESS: POLICY_AUDIT_EVENT_OPTIONS = 0x00000001; +pub const POLICY_AUDIT_EVENT_FAILURE: POLICY_AUDIT_EVENT_OPTIONS = 0x00000002; +pub const POLICY_AUDIT_EVENT_NONE: POLICY_AUDIT_EVENT_OPTIONS = 0x00000004; +pub const POLICY_AUDIT_EVENT_MASK: POLICY_AUDIT_EVENT_OPTIONS = POLICY_AUDIT_EVENT_SUCCESS + | POLICY_AUDIT_EVENT_FAILURE | POLICY_AUDIT_EVENT_UNCHANGED | POLICY_AUDIT_EVENT_NONE; +pub const POLICY_VIEW_LOCAL_INFORMATION: ::ACCESS_MASK = 0x00000001; +pub const POLICY_VIEW_AUDIT_INFORMATION: ::ACCESS_MASK = 0x00000002; +pub const POLICY_GET_PRIVATE_INFORMATION: ::ACCESS_MASK = 0x00000004; +pub const POLICY_TRUST_ADMIN: ::ACCESS_MASK = 0x00000008; +pub const POLICY_CREATE_ACCOUNT: ::ACCESS_MASK = 0x00000010; +pub const POLICY_CREATE_SECRET: ::ACCESS_MASK = 0x00000020; +pub const POLICY_CREATE_PRIVILEGE: ::ACCESS_MASK = 0x00000040; +pub const POLICY_SET_DEFAULT_QUOTA_LIMITS: ::ACCESS_MASK = 0x00000080; +pub const POLICY_SET_AUDIT_REQUIREMENTS: ::ACCESS_MASK = 0x00000100; +pub const POLICY_AUDIT_LOG_ADMIN: ::ACCESS_MASK = 0x00000200; +pub const POLICY_SERVER_ADMIN: ::ACCESS_MASK = 0x00000400; +pub const POLICY_LOOKUP_NAMES: ::ACCESS_MASK = 0x00000800; +pub const POLICY_NOTIFICATION: ::ACCESS_MASK = 0x00001000; +pub const POLICY_ALL_ACCESS: ::ACCESS_MASK = ::STANDARD_RIGHTS_REQUIRED + | POLICY_VIEW_LOCAL_INFORMATION | POLICY_VIEW_AUDIT_INFORMATION + | POLICY_GET_PRIVATE_INFORMATION | POLICY_TRUST_ADMIN | POLICY_CREATE_ACCOUNT + | POLICY_CREATE_SECRET | POLICY_CREATE_PRIVILEGE | POLICY_SET_DEFAULT_QUOTA_LIMITS + | POLICY_SET_AUDIT_REQUIREMENTS | POLICY_AUDIT_LOG_ADMIN | POLICY_SERVER_ADMIN + | POLICY_LOOKUP_NAMES; +pub const POLICY_READ: ::ACCESS_MASK = ::STANDARD_RIGHTS_READ | POLICY_VIEW_AUDIT_INFORMATION + | POLICY_GET_PRIVATE_INFORMATION; +pub const POLICY_WRITE: ::ACCESS_MASK = ::STANDARD_RIGHTS_WRITE | POLICY_TRUST_ADMIN + | POLICY_CREATE_ACCOUNT | POLICY_CREATE_SECRET | POLICY_CREATE_PRIVILEGE + | POLICY_SET_DEFAULT_QUOTA_LIMITS | POLICY_SET_AUDIT_REQUIREMENTS | POLICY_AUDIT_LOG_ADMIN + | POLICY_SERVER_ADMIN; +pub const POLICY_EXECUTE: ::ACCESS_MASK = ::STANDARD_RIGHTS_EXECUTE + | POLICY_VIEW_LOCAL_INFORMATION | POLICY_LOOKUP_NAMES; +STRUCT!{struct LSA_TRANSLATED_SID { + Use: ::SID_NAME_USE, + RelativeId: ::ULONG, + DomainIndex: ::LONG, +}} +pub type PLSA_TRANSLATED_SID = *mut LSA_TRANSLATED_SID; +ENUM!{enum POLICY_LSA_SERVER_ROLE { + PolicyServerRoleBackup = 2, + PolicyServerRolePrimary, +}} +pub type PPOLICY_LSA_SERVER_ROLE = *mut POLICY_LSA_SERVER_ROLE; +pub type POLICY_AUDIT_EVENT_OPTIONS = ::ULONG; +pub type PPOLICY_AUDIT_EVENT_OPTIONS = *mut ::ULONG; +ENUM!{enum POLICY_INFORMATION_CLASS { + PolicyAuditLogInformation = 1, + PolicyAuditEventsInformation, + PolicyPrimaryDomainInformation, + PolicyPdAccountInformation, + PolicyAccountDomainInformation, + PolicyLsaServerRoleInformation, + PolicyReplicaSourceInformation, + PolicyDefaultQuotaInformation, + PolicyModificationInformation, + PolicyAuditFullSetInformation, + PolicyAuditFullQueryInformation, + PolicyDnsDomainInformation, + PolicyDnsDomainInformationInt, + PolicyLocalAccountDomainInformation, + PolicyLastEntry, +}} +pub type PPOLICY_INFORMATION_CLASS = *mut POLICY_INFORMATION_CLASS; +STRUCT!{struct POLICY_AUDIT_LOG_INFO { + AuditLogPercentFull: ::ULONG, + MaximumLogSize: ::ULONG, + AuditRetentionPeriod: ::LARGE_INTEGER, + AuditLogFullShutdownInProgress: ::BOOLEAN, + TimeToShutdown: ::LARGE_INTEGER, + NextAuditRecordId: ::ULONG, +}} +pub type PPOLICY_AUDIT_LOG_INFO = *mut POLICY_AUDIT_LOG_INFO; +STRUCT!{struct POLICY_AUDIT_EVENTS_INFO { + AuditingMode: ::BOOLEAN, + EventAuditingOptions: PPOLICY_AUDIT_EVENT_OPTIONS, + MaximumAuditEventCount: ::ULONG, +}} +pub type PPOLICY_AUDIT_EVENTS_INFO = *mut POLICY_AUDIT_EVENTS_INFO; +STRUCT!{struct POLICY_AUDIT_SUBCATEGORIES_INFO { + MaximumSubCategoryCount: ::ULONG, + EventAuditingOptions: PPOLICY_AUDIT_EVENT_OPTIONS, +}} +pub type PPOLICY_AUDIT_SUBCATEGORIES_INFO = *mut POLICY_AUDIT_SUBCATEGORIES_INFO; +STRUCT!{struct POLICY_AUDIT_CATEGORIES_INFO { + MaximumSubCategoryCount: ::ULONG, + SubCategoriesInfo: PPOLICY_AUDIT_SUBCATEGORIES_INFO, +}} +pub type PPOLICY_AUDIT_CATEGORIES_INFO = *mut POLICY_AUDIT_CATEGORIES_INFO; +pub const PER_USER_POLICY_UNCHANGED: ::ULONG = 0x00; +pub const PER_USER_AUDIT_SUCCESS_INCLUDE: ::ULONG = 0x01; +pub const PER_USER_AUDIT_SUCCESS_EXCLUDE: ::ULONG = 0x02; +pub const PER_USER_AUDIT_FAILURE_INCLUDE: ::ULONG = 0x04; +pub const PER_USER_AUDIT_FAILURE_EXCLUDE: ::ULONG = 0x08; +pub const PER_USER_AUDIT_NONE: ::ULONG = 0x10; +pub const VALID_PER_USER_AUDIT_POLICY_FLAG: ::ULONG = PER_USER_AUDIT_SUCCESS_INCLUDE + | PER_USER_AUDIT_SUCCESS_EXCLUDE | PER_USER_AUDIT_FAILURE_INCLUDE + | PER_USER_AUDIT_FAILURE_EXCLUDE | PER_USER_AUDIT_NONE; +STRUCT!{struct POLICY_PRIMARY_DOMAIN_INFO { + Name: ::LSA_UNICODE_STRING, + Sid: ::PSID, +}} +pub type PPOLICY_PRIMARY_DOMAIN_INFO = *mut POLICY_PRIMARY_DOMAIN_INFO; +STRUCT!{struct POLICY_PD_ACCOUNT_INFO { + Name: ::LSA_UNICODE_STRING, +}} +pub type PPOLICY_PD_ACCOUNT_INFO = *mut POLICY_PD_ACCOUNT_INFO; +STRUCT!{struct POLICY_LSA_SERVER_ROLE_INFO { + LsaServerRole: POLICY_LSA_SERVER_ROLE, +}} +pub type PPOLICY_LSA_SERVER_ROLE_INFO = *mut POLICY_LSA_SERVER_ROLE_INFO; +STRUCT!{struct POLICY_REPLICA_SOURCE_INFO { + ReplicaSource: ::LSA_UNICODE_STRING, + ReplicaAccountName: ::LSA_UNICODE_STRING, +}} +pub type PPOLICY_REPLICA_SOURCE_INFO = *mut POLICY_REPLICA_SOURCE_INFO; +STRUCT!{struct POLICY_DEFAULT_QUOTA_INFO { + QuotaLimits: ::QUOTA_LIMITS, +}} +pub type PPOLICY_DEFAULT_QUOTA_INFO = *mut POLICY_DEFAULT_QUOTA_INFO; +STRUCT!{struct POLICY_MODIFICATION_INFO { + ModifiedId: ::LARGE_INTEGER, + DatabaseCreationTime: ::LARGE_INTEGER, +}} +pub type PPOLICY_MODIFICATION_INFO = *mut POLICY_MODIFICATION_INFO; +STRUCT!{struct POLICY_AUDIT_FULL_SET_INFO { + ShutDownOnFull: ::BOOLEAN, +}} +pub type PPOLICY_AUDIT_FULL_SET_INFO = *mut POLICY_AUDIT_FULL_SET_INFO; +STRUCT!{struct POLICY_AUDIT_FULL_QUERY_INFO { + ShutDownOnFull: ::BOOLEAN, + LogIsFull: ::BOOLEAN, +}} +pub type PPOLICY_AUDIT_FULL_QUERY_INFO = *mut POLICY_AUDIT_FULL_QUERY_INFO; +ENUM!{enum POLICY_DOMAIN_INFORMATION_CLASS { + PolicyDomainEfsInformation = 2, + PolicyDomainKerberosTicketInformation, +}} +pub type PPOLICY_DOMAIN_INFORMATION_CLASS = *mut POLICY_DOMAIN_INFORMATION_CLASS; +STRUCT!{struct POLICY_DOMAIN_EFS_INFO { + InfoLength: ::ULONG, + EfsBlob: ::PUCHAR, +}} +pub type PPOLICY_DOMAIN_EFS_INFO = *mut POLICY_DOMAIN_EFS_INFO; +STRUCT!{struct POLICY_DOMAIN_KERBEROS_TICKET_INFO { + AuthenticationOptions: ::ULONG, + MaxServiceTicketAge: ::LARGE_INTEGER, + MaxTicketAge: ::LARGE_INTEGER, + MaxRenewAge: ::LARGE_INTEGER, + MaxClockSkew: ::LARGE_INTEGER, + Reserved: ::LARGE_INTEGER, +}} +pub type PPOLICY_DOMAIN_KERBEROS_TICKET_INFO = *mut POLICY_DOMAIN_KERBEROS_TICKET_INFO; +ENUM!{enum POLICY_NOTIFICATION_INFORMATION_CLASS { + PolicyNotifyAuditEventsInformation = 1, + PolicyNotifyAccountDomainInformation, + PolicyNotifyServerRoleInformation, + PolicyNotifyDnsDomainInformation, + PolicyNotifyDomainEfsInformation, + PolicyNotifyDomainKerberosTicketInformation, + PolicyNotifyMachineAccountPasswordInformation, + PolicyNotifyGlobalSaclInformation, + PolicyNotifyMax, +}} +pub type PPOLICY_NOTIFICATION_INFORMATION_CLASS = *mut POLICY_NOTIFICATION_INFORMATION_CLASS; +pub type LSA_HANDLE = ::PVOID; +pub type PLSA_HANDLE = *mut ::PVOID; +ENUM!{enum TRUSTED_INFORMATION_CLASS { + TrustedDomainNameInformation = 1, + TrustedControllersInformation, + TrustedPosixOffsetInformation, + TrustedPasswordInformation, + TrustedDomainInformationBasic, + TrustedDomainInformationEx, + TrustedDomainAuthInformation, + TrustedDomainFullInformation, + TrustedDomainAuthInformationInternal, + TrustedDomainFullInformationInternal, + TrustedDomainInformationEx2Internal, + TrustedDomainFullInformation2Internal, + TrustedDomainSupportedEncryptionTypes, +}} +pub type PTRUSTED_INFORMATION_CLASS = *mut TRUSTED_INFORMATION_CLASS; +STRUCT!{struct TRUSTED_DOMAIN_NAME_INFO { + Name: ::LSA_UNICODE_STRING, +}} +pub type PTRUSTED_DOMAIN_NAME_INFO = *mut TRUSTED_DOMAIN_NAME_INFO; +STRUCT!{struct TRUSTED_CONTROLLERS_INFO { + Entries: ::ULONG, + Names: ::PLSA_UNICODE_STRING, +}} +pub type PTRUSTED_CONTROLLERS_INFO = *mut TRUSTED_CONTROLLERS_INFO; +STRUCT!{struct TRUSTED_POSIX_OFFSET_INFO { + Offset: ::ULONG, +}} +pub type PTRUSTED_POSIX_OFFSET_INFO = *mut TRUSTED_POSIX_OFFSET_INFO; +STRUCT!{struct TRUSTED_PASSWORD_INFO { + Password: ::LSA_UNICODE_STRING, + OldPassword: ::LSA_UNICODE_STRING, +}} +pub type PTRUSTED_PASSWORD_INFO = *mut TRUSTED_PASSWORD_INFO; +pub type TRUSTED_DOMAIN_INFORMATION_BASIC = ::LSA_TRUST_INFORMATION; +pub type PTRUSTED_DOMAIN_INFORMATION_BASIC = ::PLSA_TRUST_INFORMATION; +pub const TRUST_DIRECTION_DISABLED: ::ULONG = 0x00000000; +pub const TRUST_DIRECTION_INBOUND: ::ULONG = 0x00000001; +pub const TRUST_DIRECTION_OUTBOUND: ::ULONG = 0x00000002; +pub const TRUST_DIRECTION_BIDIRECTIONAL: ::ULONG = TRUST_DIRECTION_INBOUND + | TRUST_DIRECTION_OUTBOUND; +pub const TRUST_TYPE_DOWNLEVEL: ::ULONG = 0x00000001; +pub const TRUST_TYPE_UPLEVEL: ::ULONG = 0x00000002; +pub const TRUST_TYPE_MIT: ::ULONG = 0x00000003; +pub const TRUST_ATTRIBUTE_NON_TRANSITIVE: ::ULONG = 0x00000001; +pub const TRUST_ATTRIBUTE_UPLEVEL_ONLY: ::ULONG = 0x00000002; +pub const TRUST_ATTRIBUTE_QUARANTINED_DOMAIN: ::ULONG = 0x00000004; +pub const TRUST_ATTRIBUTE_FOREST_TRANSITIVE: ::ULONG = 0x00000008; +pub const TRUST_ATTRIBUTE_CROSS_ORGANIZATION: ::ULONG = 0x00000010; +pub const TRUST_ATTRIBUTE_WITHIN_FOREST: ::ULONG = 0x00000020; +pub const TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL: ::ULONG = 0x00000040; +pub const TRUST_ATTRIBUTE_TRUST_USES_RC4_ENCRYPTION: ::ULONG = 0x00000080; +pub const TRUST_ATTRIBUTE_TRUST_USES_AES_KEYS: ::ULONG = 0x00000100; +pub const TRUST_ATTRIBUTE_CROSS_ORGANIZATION_NO_TGT_DELEGATION: ::ULONG = 0x00000200; +pub const TRUST_ATTRIBUTES_VALID: ::ULONG = 0xFF03FFFF; +pub const TRUST_ATTRIBUTES_USER: ::ULONG = 0xFF000000; +STRUCT!{struct TRUSTED_DOMAIN_INFORMATION_EX { + Name: ::LSA_UNICODE_STRING, + FlatName: ::LSA_UNICODE_STRING, + Sid: ::PSID, + TrustDirection: ::ULONG, + TrustType: ::ULONG, + TrustAttributes: ::ULONG, +}} +pub type PTRUSTED_DOMAIN_INFORMATION_EX = *mut TRUSTED_DOMAIN_INFORMATION_EX; +STRUCT!{struct TRUSTED_DOMAIN_INFORMATION_EX2 { + Name: ::LSA_UNICODE_STRING, + FlatName: ::LSA_UNICODE_STRING, + Sid: ::PSID, + TrustDirection: ::ULONG, + TrustType: ::ULONG, + TrustAttributes: ::ULONG, + ForestTrustLength: ::ULONG, + ForestTrustInfo: ::PUCHAR, +}} +pub type PTRUSTED_DOMAIN_INFORMATION_EX2 = *mut TRUSTED_DOMAIN_INFORMATION_EX2; +pub const TRUST_AUTH_TYPE_NONE: ::ULONG = 0; +pub const TRUST_AUTH_TYPE_NT4OWF: ::ULONG = 1; +pub const TRUST_AUTH_TYPE_CLEAR: ::ULONG = 2; +pub const TRUST_AUTH_TYPE_VERSION: ::ULONG = 3; +STRUCT!{struct LSA_AUTH_INFORMATION { + LastUpdateTime: ::LARGE_INTEGER, + AuthType: ::ULONG, + AuthInfoLength: ::ULONG, + AuthInfo: ::PUCHAR, +}} +pub type PLSA_AUTH_INFORMATION = *mut LSA_AUTH_INFORMATION; +STRUCT!{struct TRUSTED_DOMAIN_AUTH_INFORMATION { + IncomingAuthInfos: ::ULONG, + IncomingAuthenticationInformation: PLSA_AUTH_INFORMATION, + IncomingPreviousAuthenticationInformation: PLSA_AUTH_INFORMATION, + OutgoingAuthInfos: ::ULONG, + OutgoingAuthenticationInformation: PLSA_AUTH_INFORMATION, + OutgoingPreviousAuthenticationInformation: PLSA_AUTH_INFORMATION, +}} +pub type PTRUSTED_DOMAIN_AUTH_INFORMATION = *mut TRUSTED_DOMAIN_AUTH_INFORMATION; +STRUCT!{struct TRUSTED_DOMAIN_FULL_INFORMATION { + Information: TRUSTED_DOMAIN_INFORMATION_EX, + PosixOffset: TRUSTED_POSIX_OFFSET_INFO, + AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION, +}} +pub type PTRUSTED_DOMAIN_FULL_INFORMATION = *mut TRUSTED_DOMAIN_FULL_INFORMATION; +STRUCT!{struct TRUSTED_DOMAIN_FULL_INFORMATION2 { + Information: TRUSTED_DOMAIN_INFORMATION_EX2, + PosixOffset: TRUSTED_POSIX_OFFSET_INFO, + AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION, +}} +pub type PTRUSTED_DOMAIN_FULL_INFORMATION2 = *mut TRUSTED_DOMAIN_FULL_INFORMATION2; +STRUCT!{struct TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES { + SupportedEncryptionTypes: ::ULONG, +}} +pub type PTRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES = + *mut TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES; +ENUM!{enum LSA_FOREST_TRUST_RECORD_TYPE { + ForestTrustTopLevelName, + ForestTrustTopLevelNameEx, + ForestTrustDomainInfo, + ForestTrustRecordTypeLast, // = ForestTrustDomainInfo, +}} +pub const LSA_FTRECORD_DISABLED_REASONS: ::ULONG = 0x0000FFFF; +pub const LSA_TLN_DISABLED_NEW: ::ULONG = 0x00000001; +pub const LSA_TLN_DISABLED_ADMIN: ::ULONG = 0x00000002; +pub const LSA_TLN_DISABLED_CONFLICT: ::ULONG = 0x00000004; +pub const LSA_SID_DISABLED_ADMIN: ::ULONG = 0x00000001; +pub const LSA_SID_DISABLED_CONFLICT: ::ULONG = 0x00000002; +pub const LSA_NB_DISABLED_ADMIN: ::ULONG = 0x00000004; +pub const LSA_NB_DISABLED_CONFLICT: ::ULONG = 0x00000008; +STRUCT!{struct LSA_FOREST_TRUST_DOMAIN_INFO { + Sid: ::PSID, + DnsName: ::LSA_UNICODE_STRING, + NetbiosName: ::LSA_UNICODE_STRING, +}} +pub type PLSA_FOREST_TRUST_DOMAIN_INFO = *mut LSA_FOREST_TRUST_DOMAIN_INFO; +pub const MAX_FOREST_TRUST_BINARY_DATA_SIZE: ::ULONG = 128 * 1024; +STRUCT!{struct LSA_FOREST_TRUST_BINARY_DATA { + Length: ::ULONG, + Buffer: ::PUCHAR, +}} +pub type PLSA_FOREST_TRUST_BINARY_DATA = *mut LSA_FOREST_TRUST_BINARY_DATA; +STRUCT!{struct LSA_FOREST_TRUST_RECORD_ForestTrustData { + DomainInfo: LSA_FOREST_TRUST_DOMAIN_INFO, +}} +UNION!( + LSA_FOREST_TRUST_RECORD_ForestTrustData, DomainInfo, TopLevelName, TopLevelName_mut, + ::LSA_UNICODE_STRING +); +UNION!( + LSA_FOREST_TRUST_RECORD_ForestTrustData, DomainInfo, Data, Data_mut, + LSA_FOREST_TRUST_BINARY_DATA +); +STRUCT!{struct LSA_FOREST_TRUST_RECORD { + Flags: ::ULONG, + ForestTrustType: LSA_FOREST_TRUST_RECORD_TYPE, + Time: ::LARGE_INTEGER, + ForestTrustData: LSA_FOREST_TRUST_RECORD_ForestTrustData, +}} +pub type PLSA_FOREST_TRUST_RECORD = *mut LSA_FOREST_TRUST_RECORD; +pub const MAX_RECORDS_IN_FOREST_TRUST_INFO: ::ULONG = 4000; +STRUCT!{struct LSA_FOREST_TRUST_INFORMATION { + RecordCount: ::ULONG, + Entries: *mut PLSA_FOREST_TRUST_RECORD, +}} +pub type PLSA_FOREST_TRUST_INFORMATION = *mut LSA_FOREST_TRUST_INFORMATION; +ENUM!{enum LSA_FOREST_TRUST_COLLISION_RECORD_TYPE { + CollisionTdo, + CollisionXref, + CollisionOther, +}} +STRUCT!{struct LSA_FOREST_TRUST_COLLISION_RECORD { + Index: ::ULONG, + Type: LSA_FOREST_TRUST_COLLISION_RECORD_TYPE, + Flags: ::ULONG, + Name: ::LSA_UNICODE_STRING, +}} +pub type PLSA_FOREST_TRUST_COLLISION_RECORD = *mut LSA_FOREST_TRUST_COLLISION_RECORD; +STRUCT!{struct LSA_FOREST_TRUST_COLLISION_INFORMATION { + RecordCount: ::ULONG, + Entries: *mut PLSA_FOREST_TRUST_COLLISION_RECORD, +}} +pub type PLSA_FOREST_TRUST_COLLISION_INFORMATION = *mut LSA_FOREST_TRUST_COLLISION_INFORMATION; +pub type LSA_ENUMERATION_HANDLE = ::ULONG; +pub type PLSA_ENUMERATION_HANDLE = *mut ::ULONG; +STRUCT!{struct LSA_ENUMERATION_INFORMATION { + Sid: ::PSID, +}} +pub type PLSA_ENUMERATION_INFORMATION = *mut LSA_ENUMERATION_INFORMATION; +STRUCT!{struct LSA_LAST_INTER_LOGON_INFO { + LastSuccessfulLogon: ::LARGE_INTEGER, + LastFailedLogon: ::LARGE_INTEGER, + FailedAttemptCountSinceLastSuccessfulLogon: ::ULONG, +}} +pub type PLSA_LAST_INTER_LOGON_INFO = *mut LSA_LAST_INTER_LOGON_INFO; +STRUCT!{struct SECURITY_LOGON_SESSION_DATA { + Size: ::ULONG, + LogonId: ::LUID, + UserName: ::LSA_UNICODE_STRING, + LogonDomain: ::LSA_UNICODE_STRING, + AuthenticationPackage: ::LSA_UNICODE_STRING, + LogonType: ::ULONG, + Session: ::ULONG, + Sid: ::PSID, + LogonTime: ::LARGE_INTEGER, + LogonServer: ::LSA_UNICODE_STRING, + DnsDomainName: ::LSA_UNICODE_STRING, + Upn: ::LSA_UNICODE_STRING, + UserFlags: ::ULONG, + LastLogonInfo: LSA_LAST_INTER_LOGON_INFO, + LogonScript: ::LSA_UNICODE_STRING, + ProfilePath: ::LSA_UNICODE_STRING, + HomeDirectory: ::LSA_UNICODE_STRING, + HomeDirectoryDrive: ::LSA_UNICODE_STRING, + LogoffTime: ::LARGE_INTEGER, + KickOffTime: ::LARGE_INTEGER, + PasswordLastSet: ::LARGE_INTEGER, + PasswordCanChange: ::LARGE_INTEGER, + PasswordMustChange: ::LARGE_INTEGER, +}} +pub type PSECURITY_LOGON_SESSION_DATA = *mut SECURITY_LOGON_SESSION_DATA; +pub const CENTRAL_ACCESS_POLICY_OWNER_RIGHTS_PRESENT_FLAG: ::ULONG = 0x00000001; +pub const CENTRAL_ACCESS_POLICY_STAGED_OWNER_RIGHTS_PRESENT_FLAG: ::ULONG = 0x00000100; +pub const CENTRAL_ACCESS_POLICY_STAGED_FLAG: ::ULONG = 0x00010000; +pub const CENTRAL_ACCESS_POLICY_VALID_FLAG_MASK: ::ULONG = + CENTRAL_ACCESS_POLICY_OWNER_RIGHTS_PRESENT_FLAG + | CENTRAL_ACCESS_POLICY_STAGED_OWNER_RIGHTS_PRESENT_FLAG | CENTRAL_ACCESS_POLICY_STAGED_FLAG; +pub const LSASETCAPS_RELOAD_FLAG: ::ULONG = 0x00000001; +pub const LSASETCAPS_VALID_FLAG_MASK: ::ULONG = LSASETCAPS_RELOAD_FLAG; +STRUCT!{struct CENTRAL_ACCESS_POLICY_ENTRY { + Name: ::LSA_UNICODE_STRING, + Description: ::LSA_UNICODE_STRING, + ChangeId: ::LSA_UNICODE_STRING, + LengthAppliesTo: ::ULONG, + AppliesTo: ::PUCHAR, + LengthSD: ::ULONG, + SD: ::PSECURITY_DESCRIPTOR, + LengthStagedSD: ::ULONG, + StagedSD: ::PSECURITY_DESCRIPTOR, + Flags: ::ULONG, +}} +pub type PCENTRAL_ACCESS_POLICY_ENTRY = *mut CENTRAL_ACCESS_POLICY_ENTRY; +pub type PCCENTRAL_ACCESS_POLICY_ENTRY = *const CENTRAL_ACCESS_POLICY_ENTRY; +STRUCT!{struct CENTRAL_ACCESS_POLICY { + CAPID: ::PSID, + Name: ::LSA_UNICODE_STRING, + Description: ::LSA_UNICODE_STRING, + ChangeId: ::LSA_UNICODE_STRING, + Flags: ::ULONG, + CAPECount: ::ULONG, + CAPEs: *mut PCENTRAL_ACCESS_POLICY_ENTRY, +}} +pub type PCENTRAL_ACCESS_POLICY = *mut CENTRAL_ACCESS_POLICY; +pub type PCCENTRAL_ACCESS_POLICY = *const CENTRAL_ACCESS_POLICY; +ENUM!{enum NEGOTIATE_MESSAGES { + NegEnumPackagePrefixes = 0, + NegGetCallerName = 1, + NegTransferCredentials = 2, + NegCallPackageMax, +}} +pub const NEGOTIATE_MAX_PREFIX: usize = 32; +STRUCT!{struct NEGOTIATE_PACKAGE_PREFIX { + PackageId: ::ULONG_PTR, + PackageDataA: ::PVOID, + PackageDataW: ::PVOID, + PrefixLen: ::ULONG_PTR, + Prefix: [::UCHAR; NEGOTIATE_MAX_PREFIX], +}} +pub type PNEGOTIATE_PACKAGE_PREFIX = *mut NEGOTIATE_PACKAGE_PREFIX; +STRUCT!{struct NEGOTIATE_PACKAGE_PREFIXES { + MessageType: ::ULONG, + PrefixCount: ::ULONG, + Offset: ::ULONG, + Pad: ::ULONG, +}} +pub type PNEGOTIATE_PACKAGE_PREFIXES = *mut NEGOTIATE_PACKAGE_PREFIXES; +STRUCT!{struct NEGOTIATE_CALLER_NAME_REQUEST { + MessageType: ::ULONG, + LogonId: ::LUID, +}} +pub type PNEGOTIATE_CALLER_NAME_REQUEST = *mut NEGOTIATE_CALLER_NAME_REQUEST; +STRUCT!{struct NEGOTIATE_CALLER_NAME_RESPONSE { + MessageType: ::ULONG, + CallerName: ::PWSTR, +}} +pub type PNEGOTIATE_CALLER_NAME_RESPONSE = *mut NEGOTIATE_CALLER_NAME_RESPONSE; +STRUCT!{struct DOMAIN_PASSWORD_INFORMATION { + MinPasswordLength: ::USHORT, + PasswordHistoryLength: ::USHORT, + PasswordProperties: ::ULONG, + MaxPasswordAge: ::LARGE_INTEGER, + MinPasswordAge: ::LARGE_INTEGER, +}} +pub type PDOMAIN_PASSWORD_INFORMATION = *mut DOMAIN_PASSWORD_INFORMATION; +pub const DOMAIN_PASSWORD_COMPLEX: ::ULONG = 0x00000001; +pub const DOMAIN_PASSWORD_NO_ANON_CHANGE: ::ULONG = 0x00000002; +pub const DOMAIN_PASSWORD_NO_CLEAR_CHANGE: ::ULONG = 0x00000004; +pub const DOMAIN_LOCKOUT_ADMINS: ::ULONG = 0x00000008; +pub const DOMAIN_PASSWORD_STORE_CLEARTEXT: ::ULONG = 0x00000010; +pub const DOMAIN_REFUSE_PASSWORD_CHANGE: ::ULONG = 0x00000020; +pub const DOMAIN_NO_LM_OWF_CHANGE: ::ULONG = 0x00000040; +pub type PSAM_PASSWORD_NOTIFICATION_ROUTINE = Option ::NTSTATUS>; +pub type PSAM_INIT_NOTIFICATION_ROUTINE = Option ::BOOLEAN>; +pub type PSAM_PASSWORD_FILTER_ROUTINE = Option ::BOOLEAN>; +ENUM!{enum MSV1_0_LOGON_SUBMIT_TYPE { + MsV1_0InteractiveLogon = 2, + MsV1_0Lm20Logon, + MsV1_0NetworkLogon, + MsV1_0SubAuthLogon, + MsV1_0WorkstationUnlockLogon = 7, + MsV1_0S4ULogon = 12, + MsV1_0VirtualLogon = 82, + MsV1_0NoElevationLogon = 83, + MsV1_0LuidLogon = 84, +}} +pub type PMSV1_0_LOGON_SUBMIT_TYPE = *mut MSV1_0_LOGON_SUBMIT_TYPE; +ENUM!{enum MSV1_0_PROFILE_BUFFER_TYPE { + MsV1_0InteractiveProfile = 2, + MsV1_0Lm20LogonProfile, + MsV1_0SmartCardProfile, +}} +pub type PMSV1_0_PROFILE_BUFFER_TYPE = *mut MSV1_0_PROFILE_BUFFER_TYPE; +STRUCT!{struct MSV1_0_INTERACTIVE_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + LogonDomainName: ::UNICODE_STRING, + UserName: ::UNICODE_STRING, + Password: ::UNICODE_STRING, +}} +pub type PMSV1_0_INTERACTIVE_LOGON = *mut MSV1_0_INTERACTIVE_LOGON; +STRUCT!{struct MSV1_0_INTERACTIVE_PROFILE { + MessageType: MSV1_0_PROFILE_BUFFER_TYPE, + LogonCount: ::USHORT, + BadPasswordCount: ::USHORT, + LogonTime: ::LARGE_INTEGER, + LogoffTime: ::LARGE_INTEGER, + KickOffTime: ::LARGE_INTEGER, + PasswordLastSet: ::LARGE_INTEGER, + PasswordCanChange: ::LARGE_INTEGER, + PasswordMustChange: ::LARGE_INTEGER, + LogonScript: ::UNICODE_STRING, + HomeDirectory: ::UNICODE_STRING, + FullName: ::UNICODE_STRING, + ProfilePath: ::UNICODE_STRING, + HomeDirectoryDrive: ::UNICODE_STRING, + LogonServer: ::UNICODE_STRING, + UserFlags: ::ULONG, +}} +pub type PMSV1_0_INTERACTIVE_PROFILE = *mut MSV1_0_INTERACTIVE_PROFILE; +pub const MSV1_0_CHALLENGE_LENGTH: usize = 8; +pub const MSV1_0_USER_SESSION_KEY_LENGTH: usize = 16; +pub const MSV1_0_LANMAN_SESSION_KEY_LENGTH: usize = 8; +pub const MSV1_0_CLEARTEXT_PASSWORD_ALLOWED: ::ULONG = 0x02; +pub const MSV1_0_UPDATE_LOGON_STATISTICS: ::ULONG = 0x04; +pub const MSV1_0_RETURN_USER_PARAMETERS: ::ULONG = 0x08; +pub const MSV1_0_DONT_TRY_GUEST_ACCOUNT: ::ULONG = 0x10; +pub const MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT: ::ULONG = 0x20; +pub const MSV1_0_RETURN_PASSWORD_EXPIRY: ::ULONG = 0x40; +pub const MSV1_0_USE_CLIENT_CHALLENGE: ::ULONG = 0x80; +pub const MSV1_0_TRY_GUEST_ACCOUNT_ONLY: ::ULONG = 0x100; +pub const MSV1_0_RETURN_PROFILE_PATH: ::ULONG = 0x200; +pub const MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY: ::ULONG = 0x400; +pub const MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT: ::ULONG = 0x800; +pub const MSV1_0_DISABLE_PERSONAL_FALLBACK: ::ULONG = 0x00001000; +pub const MSV1_0_ALLOW_FORCE_GUEST: ::ULONG = 0x00002000; +pub const MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED: ::ULONG = 0x00004000; +pub const MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY: ::ULONG = 0x00008000; +pub const MSV1_0_SUBAUTHENTICATION_DLL_EX: ::ULONG = 0x00100000; +pub const MSV1_0_ALLOW_MSVCHAPV2: ::ULONG = 0x00010000; +pub const MSV1_0_S4U2SELF: ::ULONG = 0x00020000; +pub const MSV1_0_CHECK_LOGONHOURS_FOR_S4U: ::ULONG = 0x00040000; +pub const MSV1_0_INTERNET_DOMAIN: ::ULONG = 0x00080000; +pub const MSV1_0_SUBAUTHENTICATION_DLL: ::ULONG = 0xFF000000; +pub const MSV1_0_SUBAUTHENTICATION_DLL_SHIFT: ::ULONG = 24; +pub const MSV1_0_MNS_LOGON: ::ULONG = 0x01000000; +pub const MSV1_0_SUBAUTHENTICATION_DLL_RAS: ::ULONG = 2; +pub const MSV1_0_SUBAUTHENTICATION_DLL_IIS: ::ULONG = 132; +STRUCT!{struct MSV1_0_LM20_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + LogonDomainName: ::UNICODE_STRING, + UserName: ::UNICODE_STRING, + Workstation: ::UNICODE_STRING, + ChallengeToClient: [::UCHAR; MSV1_0_CHALLENGE_LENGTH], + CaseSensitiveChallengeResponse: ::STRING, + CaseInsensitiveChallengeResponse: ::STRING, + ParameterControl: ::ULONG, +}} +pub type PMSV1_0_LM20_LOGON = *mut MSV1_0_LM20_LOGON; +STRUCT!{struct MSV1_0_SUBAUTH_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + LogonDomainName: ::UNICODE_STRING, + UserName: ::UNICODE_STRING, + Workstation: ::UNICODE_STRING, + ChallengeToClient: [::UCHAR; MSV1_0_CHALLENGE_LENGTH], + AuthenticationInfo1: ::STRING, + AuthenticationInfo2: ::STRING, + ParameterControl: ::ULONG, + SubAuthPackageId: ::ULONG, +}} +pub type PMSV1_0_SUBAUTH_LOGON = *mut MSV1_0_SUBAUTH_LOGON; +STRUCT!{struct MSV1_0_S4U_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + MSV1_0_LOGON_SUBMIT_TYPE: ::ULONG, + UserPrincipalName: ::UNICODE_STRING, + DomainName: ::UNICODE_STRING, +}} +pub type PMSV1_0_S4U_LOGON = *mut MSV1_0_S4U_LOGON; +pub const LOGON_GUEST: ::ULONG = 0x01; +pub const LOGON_NOENCRYPTION: ::ULONG = 0x02; +pub const LOGON_CACHED_ACCOUNT: ::ULONG = 0x04; +pub const LOGON_USED_LM_PASSWORD: ::ULONG = 0x08; +pub const LOGON_EXTRA_SIDS: ::ULONG = 0x20; +pub const LOGON_SUBAUTH_SESSION_KEY: ::ULONG = 0x40; +pub const LOGON_SERVER_TRUST_ACCOUNT: ::ULONG = 0x80; +pub const LOGON_NTLMV2_ENABLED: ::ULONG = 0x100; +pub const LOGON_RESOURCE_GROUPS: ::ULONG = 0x200; +pub const LOGON_PROFILE_PATH_RETURNED: ::ULONG = 0x400; +pub const LOGON_NT_V2: ::ULONG = 0x800; +pub const LOGON_LM_V2: ::ULONG = 0x1000; +pub const LOGON_NTLM_V2: ::ULONG = 0x2000; +pub const LOGON_OPTIMIZED: ::ULONG = 0x4000; +pub const LOGON_WINLOGON: ::ULONG = 0x8000; +pub const LOGON_PKINIT: ::ULONG = 0x10000; +pub const LOGON_NO_OPTIMIZED: ::ULONG = 0x20000; +pub const LOGON_NO_ELEVATION: ::ULONG = 0x40000; +pub const LOGON_MANAGED_SERVICE: ::ULONG = 0x80000; +pub const LOGON_GRACE_LOGON: ::ULONG = 0x01000000; +STRUCT!{struct MSV1_0_LM20_LOGON_PROFILE { + MessageType: MSV1_0_PROFILE_BUFFER_TYPE, + KickOffTime: ::LARGE_INTEGER, + LogoffTime: ::LARGE_INTEGER, + UserFlags: ::ULONG, + UserSessionKey: [::UCHAR; MSV1_0_USER_SESSION_KEY_LENGTH], + LogonDomainName: ::UNICODE_STRING, + LanmanSessionKey: [::UCHAR; MSV1_0_LANMAN_SESSION_KEY_LENGTH], + LogonServer: ::UNICODE_STRING, + UserParameters: ::UNICODE_STRING, +}} +pub type PMSV1_0_LM20_LOGON_PROFILE = *mut MSV1_0_LM20_LOGON_PROFILE; +pub const MSV1_0_OWF_PASSWORD_LENGTH: usize = 16; +STRUCT!{struct MSV1_0_SUPPLEMENTAL_CREDENTIAL { + Version: ::ULONG, + Flags: ::ULONG, + LmPassword: [::UCHAR; MSV1_0_OWF_PASSWORD_LENGTH], + NtPassword: [::UCHAR; MSV1_0_OWF_PASSWORD_LENGTH], +}} +pub type PMSV1_0_SUPPLEMENTAL_CREDENTIAL = *mut MSV1_0_SUPPLEMENTAL_CREDENTIAL; +pub const MSV1_0_NTLM3_RESPONSE_LENGTH: usize = 16; +pub const MSV1_0_NTLM3_OWF_LENGTH: usize = 16; +STRUCT!{struct MSV1_0_NTLM3_RESPONSE { + Response: [::UCHAR; MSV1_0_NTLM3_RESPONSE_LENGTH], + RespType: ::UCHAR, + HiRespType: ::UCHAR, + Flags: ::USHORT, + MsgWord: ::ULONG, + TimeStamp: ::ULONGLONG, + ChallengeFromClient: [::UCHAR; MSV1_0_CHALLENGE_LENGTH], + AvPairsOff: ::ULONG, + Buffer: [::UCHAR; 1], +}} +pub type PMSV1_0_NTLM3_RESPONSE = *mut MSV1_0_NTLM3_RESPONSE; +ENUM!{enum MSV1_0_AVID { + MsvAvEOL, + MsvAvNbComputerName, + MsvAvNbDomainName, + MsvAvDnsComputerName, + MsvAvDnsDomainName, + MsvAvDnsTreeName, + MsvAvFlags, + MsvAvTimestamp, + MsvAvRestrictions, + MsvAvTargetName, + MsvAvChannelBindings, +}} +STRUCT!{struct MSV1_0_AV_PAIR { + AvId: ::USHORT, + AvLen: ::USHORT, +}} +pub type PMSV1_0_AV_PAIR = *mut MSV1_0_AV_PAIR; +ENUM!{enum MSV1_0_PROTOCOL_MESSAGE_TYPE { + MsV1_0Lm20ChallengeRequest = 0, + MsV1_0Lm20GetChallengeResponse, + MsV1_0EnumerateUsers, + MsV1_0GetUserInfo, + MsV1_0ReLogonUsers, + MsV1_0ChangePassword, + MsV1_0ChangeCachedPassword, + MsV1_0GenericPassthrough, + MsV1_0CacheLogon, + MsV1_0SubAuth, + MsV1_0DeriveCredential, + MsV1_0CacheLookup, + MsV1_0SetProcessOption, + MsV1_0ConfigLocalAliases, + MsV1_0ClearCachedCredentials, + MsV1_0LookupToken, + MsV1_0ValidateAuth, + MsV1_0CacheLookupEx, + MsV1_0GetCredentialKey, + MsV1_0SetThreadOption, +}} +pub type PMSV1_0_PROTOCOL_MESSAGE_TYPE = *mut MSV1_0_PROTOCOL_MESSAGE_TYPE; +STRUCT!{struct MSV1_0_CHANGEPASSWORD_REQUEST { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + DomainName: ::UNICODE_STRING, + AccountName: ::UNICODE_STRING, + OldPassword: ::UNICODE_STRING, + NewPassword: ::UNICODE_STRING, + Impersonating: ::BOOLEAN, +}} +pub type PMSV1_0_CHANGEPASSWORD_REQUEST = *mut MSV1_0_CHANGEPASSWORD_REQUEST; +STRUCT!{struct MSV1_0_CHANGEPASSWORD_RESPONSE { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + PasswordInfoValid: ::BOOLEAN, + DomainPasswordInfo: DOMAIN_PASSWORD_INFORMATION, +}} +pub type PMSV1_0_CHANGEPASSWORD_RESPONSE = *mut MSV1_0_CHANGEPASSWORD_RESPONSE; +STRUCT!{struct MSV1_0_PASSTHROUGH_REQUEST { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + DomainName: ::UNICODE_STRING, + PackageName: ::UNICODE_STRING, + DataLength: ::ULONG, + LogonData: ::PUCHAR, + Pad: ::ULONG, +}} +pub type PMSV1_0_PASSTHROUGH_REQUEST = *mut MSV1_0_PASSTHROUGH_REQUEST; +STRUCT!{struct MSV1_0_PASSTHROUGH_RESPONSE { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + Pad: ::ULONG, + DataLength: ::ULONG, + ValidationData: ::PUCHAR, +}} +pub type PMSV1_0_PASSTHROUGH_RESPONSE = *mut MSV1_0_PASSTHROUGH_RESPONSE; +STRUCT!{struct MSV1_0_SUBAUTH_REQUEST { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + SubAuthPackageId: ::ULONG, + SubAuthInfoLength: ::ULONG, + SubAuthSubmitBuffer: ::PUCHAR, +}} +pub type PMSV1_0_SUBAUTH_REQUEST = *mut MSV1_0_SUBAUTH_REQUEST; +STRUCT!{struct MSV1_0_SUBAUTH_RESPONSE { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + SubAuthInfoLength: ::ULONG, + SubAuthReturnBuffer: ::PUCHAR, +}} +pub type PMSV1_0_SUBAUTH_RESPONSE = *mut MSV1_0_SUBAUTH_RESPONSE; +pub const RTL_ENCRYPT_MEMORY_SIZE: ::ULONG = 8; +pub const RTL_ENCRYPT_OPTION_CROSS_PROCESS: ::ULONG = 0x01; +pub const RTL_ENCRYPT_OPTION_SAME_LOGON: ::ULONG = 0x02; +pub const KERB_ETYPE_NULL: ::LONG = 0; +pub const KERB_ETYPE_DES_CBC_CRC: ::LONG = 1; +pub const KERB_ETYPE_DES_CBC_MD4: ::LONG = 2; +pub const KERB_ETYPE_DES_CBC_MD5: ::LONG = 3; +pub const KERB_ETYPE_AES128_CTS_HMAC_SHA1_96: ::LONG = 17; +pub const KERB_ETYPE_AES256_CTS_HMAC_SHA1_96: ::LONG = 18; +pub const KERB_ETYPE_RC4_MD4: ::LONG = -128; +pub const KERB_ETYPE_RC4_PLAIN2: ::LONG = -129; +pub const KERB_ETYPE_RC4_LM: ::LONG = -130; +pub const KERB_ETYPE_RC4_SHA: ::LONG = -131; +pub const KERB_ETYPE_DES_PLAIN: ::LONG = -132; +pub const KERB_ETYPE_RC4_HMAC_OLD: ::LONG = -133; +pub const KERB_ETYPE_RC4_PLAIN_OLD: ::LONG = -134; +pub const KERB_ETYPE_RC4_HMAC_OLD_EXP: ::LONG = -135; +pub const KERB_ETYPE_RC4_PLAIN_OLD_EXP: ::LONG = -136; +pub const KERB_ETYPE_RC4_PLAIN: ::LONG = -140; +pub const KERB_ETYPE_RC4_PLAIN_EXP: ::LONG = -141; +pub const KERB_ETYPE_AES128_CTS_HMAC_SHA1_96_PLAIN: ::LONG = -148; +pub const KERB_ETYPE_AES256_CTS_HMAC_SHA1_96_PLAIN: ::LONG = -149; +pub const KERB_ETYPE_DSA_SHA1_CMS: ::LONG = 9; +pub const KERB_ETYPE_RSA_MD5_CMS: ::LONG = 10; +pub const KERB_ETYPE_RSA_SHA1_CMS: ::LONG = 11; +pub const KERB_ETYPE_RC2_CBC_ENV: ::LONG = 12; +pub const KERB_ETYPE_RSA_ENV: ::LONG = 13; +pub const KERB_ETYPE_RSA_ES_OEAP_ENV: ::LONG = 14; +pub const KERB_ETYPE_DES_EDE3_CBC_ENV: ::LONG = 15; +pub const KERB_ETYPE_DSA_SIGN: ::LONG = 8; +pub const KERB_ETYPE_RSA_PRIV: ::LONG = 9; +pub const KERB_ETYPE_RSA_PUB: ::LONG = 10; +pub const KERB_ETYPE_RSA_PUB_MD5: ::LONG = 11; +pub const KERB_ETYPE_RSA_PUB_SHA1: ::LONG = 12; +pub const KERB_ETYPE_PKCS7_PUB: ::LONG = 13; +pub const KERB_ETYPE_DES3_CBC_MD5: ::LONG = 5; +pub const KERB_ETYPE_DES3_CBC_SHA1: ::LONG = 7; +pub const KERB_ETYPE_DES3_CBC_SHA1_KD: ::LONG = 16; +pub const KERB_ETYPE_DES_CBC_MD5_NT: ::LONG = 20; +pub const KERB_ETYPE_RC4_HMAC_NT: ::LONG = 23; +pub const KERB_ETYPE_RC4_HMAC_NT_EXP: ::LONG = 24; +pub const KERB_CHECKSUM_NONE: ::LONG = 0; +pub const KERB_CHECKSUM_CRC32: ::LONG = 1; +pub const KERB_CHECKSUM_MD4: ::LONG = 2; +pub const KERB_CHECKSUM_KRB_DES_MAC: ::LONG = 4; +pub const KERB_CHECKSUM_KRB_DES_MAC_K: ::LONG = 5; +pub const KERB_CHECKSUM_MD5: ::LONG = 7; +pub const KERB_CHECKSUM_MD5_DES: ::LONG = 8; +pub const KERB_CHECKSUM_SHA1_NEW: ::LONG = 14; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES128: ::LONG = 15; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES256: ::LONG = 16; +pub const KERB_CHECKSUM_LM: ::LONG = -130; +pub const KERB_CHECKSUM_SHA1: ::LONG = -131; +pub const KERB_CHECKSUM_REAL_CRC32: ::LONG = -132; +pub const KERB_CHECKSUM_DES_MAC: ::LONG = -133; +pub const KERB_CHECKSUM_DES_MAC_MD5: ::LONG = -134; +pub const KERB_CHECKSUM_MD25: ::LONG = -135; +pub const KERB_CHECKSUM_RC4_MD5: ::LONG = -136; +pub const KERB_CHECKSUM_MD5_HMAC: ::LONG = -137; +pub const KERB_CHECKSUM_HMAC_MD5: ::LONG = -138; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES128_Ki: ::LONG = -150; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES256_Ki: ::LONG = -151; +pub const KERB_TICKET_FLAGS_reserved: ::ULONG = 0x80000000; +pub const KERB_TICKET_FLAGS_forwardable: ::ULONG = 0x40000000; +pub const KERB_TICKET_FLAGS_forwarded: ::ULONG = 0x20000000; +pub const KERB_TICKET_FLAGS_proxiable: ::ULONG = 0x10000000; +pub const KERB_TICKET_FLAGS_proxy: ::ULONG = 0x08000000; +pub const KERB_TICKET_FLAGS_may_postdate: ::ULONG = 0x04000000; +pub const KERB_TICKET_FLAGS_postdated: ::ULONG = 0x02000000; +pub const KERB_TICKET_FLAGS_invalid: ::ULONG = 0x01000000; +pub const KERB_TICKET_FLAGS_renewable: ::ULONG = 0x00800000; +pub const KERB_TICKET_FLAGS_initial: ::ULONG = 0x00400000; +pub const KERB_TICKET_FLAGS_pre_authent: ::ULONG = 0x00200000; +pub const KERB_TICKET_FLAGS_hw_authent: ::ULONG = 0x00100000; +pub const KERB_TICKET_FLAGS_ok_as_delegate: ::ULONG = 0x00040000; +pub const KERB_TICKET_FLAGS_name_canonicalize: ::ULONG = 0x00010000; +pub const KERB_TICKET_FLAGS_cname_in_pa_data: ::ULONG = 0x00040000; +pub const KERB_TICKET_FLAGS_enc_pa_rep: ::ULONG = 0x00010000; +pub const KERB_TICKET_FLAGS_reserved1: ::ULONG = 0x00000001; +pub const KRB_NT_UNKNOWN: ::LONG = 0; +pub const KRB_NT_PRINCIPAL: ::LONG = 1; +pub const KRB_NT_PRINCIPAL_AND_ID: ::LONG = -131; +pub const KRB_NT_SRV_INST: ::LONG = 2; +pub const KRB_NT_SRV_INST_AND_ID: ::LONG = -132; +pub const KRB_NT_SRV_HST: ::LONG = 3; +pub const KRB_NT_SRV_XHST: ::LONG = 4; +pub const KRB_NT_UID: ::LONG = 5; +pub const KRB_NT_ENTERPRISE_PRINCIPAL: ::LONG = 10; +pub const KRB_NT_WELLKNOWN: ::LONG = 11; +pub const KRB_NT_ENT_PRINCIPAL_AND_ID: ::LONG = -130; +pub const KRB_NT_MS_PRINCIPAL: ::LONG = -128; +pub const KRB_NT_MS_PRINCIPAL_AND_ID: ::LONG = -129; +pub const KRB_NT_MS_BRANCH_ID: ::LONG = -133; +pub const KRB_NT_X500_PRINCIPAL: ::LONG = 6; +pub const KERB_WRAP_NO_ENCRYPT: ::ULONG = 0x80000001; +ENUM!{enum KERB_LOGON_SUBMIT_TYPE { + KerbInteractiveLogon = 2, + KerbSmartCardLogon = 6, + KerbWorkstationUnlockLogon = 7, + KerbSmartCardUnlockLogon = 8, + KerbProxyLogon = 9, + KerbTicketLogon = 10, + KerbTicketUnlockLogon = 11, + KerbS4ULogon = 12, + KerbCertificateLogon = 13, + KerbCertificateS4ULogon = 14, + KerbCertificateUnlockLogon = 15, + KerbNoElevationLogon = 83, + KerbLuidLogon = 84, +}} +pub type PKERB_LOGON_SUBMIT_TYPE = *mut KERB_LOGON_SUBMIT_TYPE; +STRUCT!{struct KERB_INTERACTIVE_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + LogonDomainName: ::UNICODE_STRING, + UserName: ::UNICODE_STRING, + Password: ::UNICODE_STRING, +}} +pub type PKERB_INTERACTIVE_LOGON = *mut KERB_INTERACTIVE_LOGON; +STRUCT!{struct KERB_INTERACTIVE_UNLOCK_LOGON { + Logon: KERB_INTERACTIVE_LOGON, + LogonId: ::LUID, +}} +pub type PKERB_INTERACTIVE_UNLOCK_LOGON = *mut KERB_INTERACTIVE_UNLOCK_LOGON; +STRUCT!{struct KERB_SMART_CARD_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Pin: ::UNICODE_STRING, + CspDataLength: ::ULONG, + CspData: ::PUCHAR, +}} +pub type PKERB_SMART_CARD_LOGON = *mut KERB_SMART_CARD_LOGON; +STRUCT!{struct KERB_SMART_CARD_UNLOCK_LOGON { + Logon: KERB_SMART_CARD_LOGON, + LogonId: ::LUID, +}} +pub type PKERB_SMART_CARD_UNLOCK_LOGON = *mut KERB_SMART_CARD_UNLOCK_LOGON; +pub const KERB_CERTIFICATE_LOGON_FLAG_CHECK_DUPLICATES: ::ULONG = 0x1; +pub const KERB_CERTIFICATE_LOGON_FLAG_USE_CERTIFICATE_INFO: ::ULONG = 0x2; +STRUCT!{struct KERB_CERTIFICATE_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + DomainName: ::UNICODE_STRING, + UserName: ::UNICODE_STRING, + Pin: ::UNICODE_STRING, + Flags: ::ULONG, + CspDataLength: ::ULONG, + CspData: ::PUCHAR, +}} +pub type PKERB_CERTIFICATE_LOGON = *mut KERB_CERTIFICATE_LOGON; +STRUCT!{struct KERB_CERTIFICATE_UNLOCK_LOGON { + Logon: KERB_CERTIFICATE_LOGON, + LogonId: ::LUID, +}} +pub type PKERB_CERTIFICATE_UNLOCK_LOGON = *mut KERB_CERTIFICATE_UNLOCK_LOGON; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_CHECK_DUPLICATES: ::ULONG = 0x1; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_CHECK_LOGONHOURS: ::ULONG = 0x2; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_FAIL_IF_NT_AUTH_POLICY_REQUIRED: ::ULONG = 0x4; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_IDENTIFY: ::ULONG = 0x8; +STRUCT!{struct KERB_CERTIFICATE_S4U_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Flags: ::ULONG, + UserPrincipalName: ::UNICODE_STRING, + DomainName: ::UNICODE_STRING, + CertificateLength: ::ULONG, + Certificate: ::PUCHAR, +}} +pub type PKERB_CERTIFICATE_S4U_LOGON = *mut KERB_CERTIFICATE_S4U_LOGON; +STRUCT!{struct KERB_TICKET_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Flags: ::ULONG, + ServiceTicketLength: ::ULONG, + TicketGrantingTicketLength: ::ULONG, + ServiceTicket: ::PUCHAR, + TicketGrantingTicket: ::PUCHAR, +}} +pub type PKERB_TICKET_LOGON = *mut KERB_TICKET_LOGON; +STRUCT!{struct KERB_TICKET_UNLOCK_LOGON { + Logon: KERB_TICKET_LOGON, + LogonId: ::LUID, +}} +pub type PKERB_TICKET_UNLOCK_LOGON = *mut KERB_TICKET_UNLOCK_LOGON; +pub const KERB_S4U_LOGON_FLAG_CHECK_LOGONHOURS: ::ULONG = 0x2; +pub const KERB_S4U_LOGON_FLAG_IDENTIFY: ::ULONG = 0x8; +STRUCT!{struct KERB_S4U_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Flags: ::ULONG, + ClientUpn: ::UNICODE_STRING, + ClientRealm: ::UNICODE_STRING, +}} +pub type PKERB_S4U_LOGON = *mut KERB_S4U_LOGON; +ENUM!{enum KERB_PROFILE_BUFFER_TYPE { + KerbInteractiveProfile = 2, + KerbSmartCardProfile = 4, + KerbTicketProfile = 6, +}} +pub type PKERB_PROFILE_BUFFER_TYPE = *mut KERB_PROFILE_BUFFER_TYPE; +STRUCT!{struct KERB_INTERACTIVE_PROFILE { + MessageType: KERB_PROFILE_BUFFER_TYPE, + LogonCount: ::USHORT, + BadPasswordCount: ::USHORT, + LogonTime: ::LARGE_INTEGER, + LogoffTime: ::LARGE_INTEGER, + KickOffTime: ::LARGE_INTEGER, + PasswordLastSet: ::LARGE_INTEGER, + PasswordCanChange: ::LARGE_INTEGER, + PasswordMustChange: ::LARGE_INTEGER, + LogonScript: ::UNICODE_STRING, + HomeDirectory: ::UNICODE_STRING, + FullName: ::UNICODE_STRING, + ProfilePath: ::UNICODE_STRING, + HomeDirectoryDrive: ::UNICODE_STRING, + LogonServer: ::UNICODE_STRING, + UserFlags: ::ULONG, +}} +pub type PKERB_INTERACTIVE_PROFILE = *mut KERB_INTERACTIVE_PROFILE; +STRUCT!{struct KERB_SMART_CARD_PROFILE { + Profile: KERB_INTERACTIVE_PROFILE, + CertificateSize: ::ULONG, + CertificateData: ::PUCHAR, +}} +pub type PKERB_SMART_CARD_PROFILE = *mut KERB_SMART_CARD_PROFILE; +STRUCT!{struct KERB_CRYPTO_KEY { + KeyType: ::LONG, + Length: ::ULONG, + Value: ::PUCHAR, +}} +pub type PKERB_CRYPTO_KEY = *mut KERB_CRYPTO_KEY; +STRUCT!{struct KERB_CRYPTO_KEY32 { + KeyType: ::LONG, + Length: ::ULONG, + Offset: ::ULONG, +}} +pub type PKERB_CRYPTO_KEY32 = *mut KERB_CRYPTO_KEY32; +STRUCT!{struct KERB_TICKET_PROFILE { + Profile: KERB_INTERACTIVE_PROFILE, + SessionKey: KERB_CRYPTO_KEY, +}} +pub type PKERB_TICKET_PROFILE = *mut KERB_TICKET_PROFILE; +ENUM!{enum KERB_PROTOCOL_MESSAGE_TYPE { + KerbDebugRequestMessage = 0, + KerbQueryTicketCacheMessage, + KerbChangeMachinePasswordMessage, + KerbVerifyPacMessage, + KerbRetrieveTicketMessage, + KerbUpdateAddressesMessage, + KerbPurgeTicketCacheMessage, + KerbChangePasswordMessage, + KerbRetrieveEncodedTicketMessage, + KerbDecryptDataMessage, + KerbAddBindingCacheEntryMessage, + KerbSetPasswordMessage, + KerbSetPasswordExMessage, + KerbVerifyCredentialsMessage, + KerbQueryTicketCacheExMessage, + KerbPurgeTicketCacheExMessage, + KerbRefreshSmartcardCredentialsMessage, + KerbAddExtraCredentialsMessage, + KerbQuerySupplementalCredentialsMessage, + KerbTransferCredentialsMessage, + KerbQueryTicketCacheEx2Message, + KerbSubmitTicketMessage, + KerbAddExtraCredentialsExMessage, + KerbQueryKdcProxyCacheMessage, + KerbPurgeKdcProxyCacheMessage, + KerbQueryTicketCacheEx3Message, + KerbCleanupMachinePkinitCredsMessage, + KerbAddBindingCacheEntryExMessage, + KerbQueryBindingCacheMessage, + KerbPurgeBindingCacheMessage, + KerbPinKdcMessage, + KerbUnpinAllKdcsMessage, + KerbQueryDomainExtendedPoliciesMessage, + KerbQueryS4U2ProxyCacheMessage, +}} +pub type PKERB_PROTOCOL_MESSAGE_TYPE = *mut KERB_PROTOCOL_MESSAGE_TYPE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, +}} +pub type PKERB_QUERY_TKT_CACHE_REQUEST = *mut KERB_QUERY_TKT_CACHE_REQUEST; +STRUCT!{struct KERB_TICKET_CACHE_INFO { + ServerName: ::UNICODE_STRING, + RealmName: ::UNICODE_STRING, + StartTime: ::LARGE_INTEGER, + EndTime: ::LARGE_INTEGER, + RenewTime: ::LARGE_INTEGER, + EncryptionType: ::LONG, + TicketFlags: ::ULONG, +}} +pub type PKERB_TICKET_CACHE_INFO = *mut KERB_TICKET_CACHE_INFO; +STRUCT!{struct KERB_TICKET_CACHE_INFO_EX { + ClientName: ::UNICODE_STRING, + ClientRealm: ::UNICODE_STRING, + ServerName: ::UNICODE_STRING, + ServerRealm: ::UNICODE_STRING, + StartTime: ::LARGE_INTEGER, + EndTime: ::LARGE_INTEGER, + RenewTime: ::LARGE_INTEGER, + EncryptionType: ::LONG, + TicketFlags: ::ULONG, +}} +pub type PKERB_TICKET_CACHE_INFO_EX = *mut KERB_TICKET_CACHE_INFO_EX; +STRUCT!{struct KERB_TICKET_CACHE_INFO_EX2 { + ClientName: ::UNICODE_STRING, + ClientRealm: ::UNICODE_STRING, + ServerName: ::UNICODE_STRING, + ServerRealm: ::UNICODE_STRING, + StartTime: ::LARGE_INTEGER, + EndTime: ::LARGE_INTEGER, + RenewTime: ::LARGE_INTEGER, + EncryptionType: ::LONG, + TicketFlags: ::ULONG, + SessionKeyType: ::ULONG, + BranchId: ::ULONG, +}} +pub type PKERB_TICKET_CACHE_INFO_EX2 = *mut KERB_TICKET_CACHE_INFO_EX2; +STRUCT!{struct KERB_TICKET_CACHE_INFO_EX3 { + ClientName: ::UNICODE_STRING, + ClientRealm: ::UNICODE_STRING, + ServerName: ::UNICODE_STRING, + ServerRealm: ::UNICODE_STRING, + StartTime: ::LARGE_INTEGER, + EndTime: ::LARGE_INTEGER, + RenewTime: ::LARGE_INTEGER, + EncryptionType: ::LONG, + TicketFlags: ::ULONG, + SessionKeyType: ::ULONG, + BranchId: ::ULONG, + CacheFlags: ::ULONG, + KdcCalled: ::UNICODE_STRING, +}} +pub type PKERB_TICKET_CACHE_INFO_EX3 = *mut KERB_TICKET_CACHE_INFO_EX3; +STRUCT!{struct KERB_QUERY_TKT_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ::ULONG, + Tickets: [KERB_TICKET_CACHE_INFO; ::ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_RESPONSE = *mut KERB_QUERY_TKT_CACHE_RESPONSE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_EX_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ::ULONG, + Tickets: [KERB_TICKET_CACHE_INFO_EX; ::ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_EX_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX_RESPONSE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_EX2_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ::ULONG, + Tickets: [KERB_TICKET_CACHE_INFO_EX2; ::ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_EX2_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX2_RESPONSE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_EX3_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ::ULONG, + Tickets: [KERB_TICKET_CACHE_INFO_EX3; ::ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_EX3_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX3_RESPONSE; +pub const KERB_USE_DEFAULT_TICKET_FLAGS: ::ULONG = 0x0; +pub const KERB_RETRIEVE_TICKET_DEFAULT: ::ULONG = 0x0; +pub const KERB_RETRIEVE_TICKET_DONT_USE_CACHE: ::ULONG = 0x1; +pub const KERB_RETRIEVE_TICKET_USE_CACHE_ONLY: ::ULONG = 0x2; +pub const KERB_RETRIEVE_TICKET_USE_CREDHANDLE: ::ULONG = 0x4; +pub const KERB_RETRIEVE_TICKET_AS_KERB_CRED: ::ULONG = 0x8; +pub const KERB_RETRIEVE_TICKET_WITH_SEC_CRED: ::ULONG = 0x10; +pub const KERB_RETRIEVE_TICKET_CACHE_TICKET: ::ULONG = 0x20; +pub const KERB_RETRIEVE_TICKET_MAX_LIFETIME: ::ULONG = 0x40; +STRUCT!{struct KERB_AUTH_DATA { + Type: ::ULONG, + Length: ::ULONG, + Data: ::PUCHAR, +}} +pub type PKERB_AUTH_DATA = *mut KERB_AUTH_DATA; +STRUCT!{struct KERB_NET_ADDRESS { + Family: ::ULONG, + Length: ::ULONG, + Address: ::PUCHAR, +}} +pub type PKERB_NET_ADDRESS = *mut KERB_NET_ADDRESS; +STRUCT!{struct KERB_NET_ADDRESSES { + Number: ::ULONG, + Addresses: [KERB_NET_ADDRESS; ::ANYSIZE_ARRAY], +}} +pub type PKERB_NET_ADDRESSES = *mut KERB_NET_ADDRESSES; +STRUCT!{struct KERB_EXTERNAL_NAME { + NameType: ::SHORT, + NameCount: ::USHORT, + Names: [::UNICODE_STRING; ::ANYSIZE_ARRAY], +}} +pub type PKERB_EXTERNAL_NAME = *mut KERB_EXTERNAL_NAME; +STRUCT!{struct KERB_EXTERNAL_TICKET { + ServiceName: PKERB_EXTERNAL_NAME, + TargetName: PKERB_EXTERNAL_NAME, + ClientName: PKERB_EXTERNAL_NAME, + DomainName: ::UNICODE_STRING, + TargetDomainName: ::UNICODE_STRING, + AltTargetDomainName: ::UNICODE_STRING, + SessionKey: KERB_CRYPTO_KEY, + TicketFlags: ::ULONG, + Flags: ::ULONG, + KeyExpirationTime: ::LARGE_INTEGER, + StartTime: ::LARGE_INTEGER, + EndTime: ::LARGE_INTEGER, + RenewUntil: ::LARGE_INTEGER, + TimeSkew: ::LARGE_INTEGER, + EncodedTicketSize: ::ULONG, + EncodedTicket: ::PUCHAR, +}} +pub type PKERB_EXTERNAL_TICKET = *mut KERB_EXTERNAL_TICKET; +STRUCT!{struct KERB_RETRIEVE_TKT_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, + TargetName: ::UNICODE_STRING, + TicketFlags: ::ULONG, + CacheOptions: ::ULONG, + EncryptionType: ::LONG, + CredentialsHandle: ::SecHandle, +}} +pub type PKERB_RETRIEVE_TKT_REQUEST = *mut KERB_RETRIEVE_TKT_REQUEST; +STRUCT!{struct KERB_RETRIEVE_TKT_RESPONSE { + Ticket: KERB_EXTERNAL_TICKET, +}} +pub type PKERB_RETRIEVE_TKT_RESPONSE = *mut KERB_RETRIEVE_TKT_RESPONSE; +STRUCT!{struct KERB_PURGE_TKT_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, + ServerName: ::UNICODE_STRING, + RealmName: ::UNICODE_STRING, +}} +pub type PKERB_PURGE_TKT_CACHE_REQUEST = *mut KERB_PURGE_TKT_CACHE_REQUEST; +pub const KERB_PURGE_ALL_TICKETS: ::ULONG = 1; +STRUCT!{struct KERB_PURGE_TKT_CACHE_EX_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, + Flags: ::ULONG, + TicketTemplate: KERB_TICKET_CACHE_INFO_EX, +}} +pub type PKERB_PURGE_TKT_CACHE_EX_REQUEST = *mut KERB_PURGE_TKT_CACHE_EX_REQUEST; +STRUCT!{struct KERB_SUBMIT_TKT_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, + Flags: ::ULONG, + Key: KERB_CRYPTO_KEY32, + KerbCredSize: ::ULONG, + KerbCredOffset: ::ULONG, +}} +pub type PKERB_SUBMIT_TKT_REQUEST = *mut KERB_SUBMIT_TKT_REQUEST; +STRUCT!{struct KERB_QUERY_KDC_PROXY_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ::ULONG, + LogonId: ::LUID, +}} +pub type PKERB_QUERY_KDC_PROXY_CACHE_REQUEST = *mut KERB_QUERY_KDC_PROXY_CACHE_REQUEST; +STRUCT!{struct KDC_PROXY_CACHE_ENTRY_DATA { + SinceLastUsed: ::ULONG64, + DomainName: ::UNICODE_STRING, + ProxyServerName: ::UNICODE_STRING, + ProxyServerVdir: ::UNICODE_STRING, + ProxyServerPort: ::USHORT, + LogonId: ::LUID, + CredUserName: ::UNICODE_STRING, + CredDomainName: ::UNICODE_STRING, + GlobalCache: ::BOOLEAN, +}} +pub type PKDC_PROXY_CACHE_ENTRY_DATA = *mut KDC_PROXY_CACHE_ENTRY_DATA; +STRUCT!{struct KERB_QUERY_KDC_PROXY_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfEntries: ::ULONG, + Entries: PKDC_PROXY_CACHE_ENTRY_DATA, +}} +pub type PKERB_QUERY_KDC_PROXY_CACHE_RESPONSE = *mut KERB_QUERY_KDC_PROXY_CACHE_RESPONSE; +STRUCT!{struct KERB_PURGE_KDC_PROXY_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ::ULONG, + LogonId: ::LUID, +}} +pub type PKERB_PURGE_KDC_PROXY_CACHE_REQUEST = *mut KERB_PURGE_KDC_PROXY_CACHE_REQUEST; +STRUCT!{struct KERB_PURGE_KDC_PROXY_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfPurged: ::ULONG, +}} +pub type PKERB_PURGE_KDC_PROXY_CACHE_RESPONSE = *mut KERB_PURGE_KDC_PROXY_CACHE_RESPONSE; +pub const KERB_S4U2PROXY_CACHE_ENTRY_INFO_FLAG_NEGATIVE: ::ULONG = 0x1; +STRUCT!{struct KERB_S4U2PROXY_CACHE_ENTRY_INFO { + ServerName: ::UNICODE_STRING, + Flags: ::ULONG, + LastStatus: ::NTSTATUS, + Expiry: ::LARGE_INTEGER, +}} +pub type PKERB_S4U2PROXY_CACHE_ENTRY_INFO = *mut KERB_S4U2PROXY_CACHE_ENTRY_INFO; +pub const KERB_S4U2PROXY_CRED_FLAG_NEGATIVE: ::ULONG = 0x1; +STRUCT!{struct KERB_S4U2PROXY_CRED { + UserName: ::UNICODE_STRING, + DomainName: ::UNICODE_STRING, + Flags: ::ULONG, + LastStatus: ::NTSTATUS, + Expiry: ::LARGE_INTEGER, + CountOfEntries: ::ULONG, + Entries: PKERB_S4U2PROXY_CACHE_ENTRY_INFO, +}} +pub type PKERB_S4U2PROXY_CRED = *mut KERB_S4U2PROXY_CRED; +STRUCT!{struct KERB_QUERY_S4U2PROXY_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ::ULONG, + LogonId: ::LUID, +}} +pub type PKERB_QUERY_S4U2PROXY_CACHE_REQUEST = *mut KERB_QUERY_S4U2PROXY_CACHE_REQUEST; +STRUCT!{struct KERB_QUERY_S4U2PROXY_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfCreds: ::ULONG, + Creds: PKERB_S4U2PROXY_CRED, +}} +pub type PKERB_QUERY_S4U2PROXY_CACHE_RESPONSE = *mut KERB_QUERY_S4U2PROXY_CACHE_RESPONSE; +STRUCT!{struct KERB_CHANGEPASSWORD_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + DomainName: ::UNICODE_STRING, + AccountName: ::UNICODE_STRING, + OldPassword: ::UNICODE_STRING, + NewPassword: ::UNICODE_STRING, + Impersonating: ::BOOLEAN, +}} +pub type PKERB_CHANGEPASSWORD_REQUEST = *mut KERB_CHANGEPASSWORD_REQUEST; +STRUCT!{struct KERB_SETPASSWORD_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, + CredentialsHandle: ::SecHandle, + Flags: ::ULONG, + DomainName: ::UNICODE_STRING, + AccountName: ::UNICODE_STRING, + Password: ::UNICODE_STRING, +}} +pub type PKERB_SETPASSWORD_REQUEST = *mut KERB_SETPASSWORD_REQUEST; +STRUCT!{struct KERB_SETPASSWORD_EX_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, + CredentialsHandle: ::SecHandle, + Flags: ::ULONG, + AccountRealm: ::UNICODE_STRING, + AccountName: ::UNICODE_STRING, + Password: ::UNICODE_STRING, + ClientRealm: ::UNICODE_STRING, + ClientName: ::UNICODE_STRING, + Impersonating: ::BOOLEAN, + KdcAddress: ::UNICODE_STRING, + KdcAddressType: ::ULONG, +}} +pub type PKERB_SETPASSWORD_EX_REQUEST = *mut KERB_SETPASSWORD_EX_REQUEST; +pub const DS_UNKNOWN_ADDRESS_TYPE: ::ULONG = 0; +pub const KERB_SETPASS_USE_LOGONID: ::ULONG = 1; +pub const KERB_SETPASS_USE_CREDHANDLE: ::ULONG = 2; +STRUCT!{struct KERB_DECRYPT_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, + Flags: ::ULONG, + CryptoType: ::LONG, + KeyUsage: ::LONG, + Key: KERB_CRYPTO_KEY, + EncryptedDataSize: ::ULONG, + InitialVectorSize: ::ULONG, + InitialVector: ::PUCHAR, + EncryptedData: ::PUCHAR, +}} +pub type PKERB_DECRYPT_REQUEST = *mut KERB_DECRYPT_REQUEST; +pub const KERB_DECRYPT_FLAG_DEFAULT_KEY: ::ULONG = 0x00000001; +STRUCT!{struct KERB_DECRYPT_RESPONSE { + DecryptedData: [::UCHAR; ::ANYSIZE_ARRAY], +}} +pub type PKERB_DECRYPT_RESPONSE = *mut KERB_DECRYPT_RESPONSE; +STRUCT!{struct KERB_ADD_BINDING_CACHE_ENTRY_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + RealmName: ::UNICODE_STRING, + KdcAddress: ::UNICODE_STRING, + AddressType: ::ULONG, +}} +pub type PKERB_ADD_BINDING_CACHE_ENTRY_REQUEST = *mut KERB_ADD_BINDING_CACHE_ENTRY_REQUEST; +STRUCT!{struct KERB_REFRESH_SCCRED_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CredentialBlob: ::UNICODE_STRING, + LogonId: ::LUID, + Flags: ::ULONG, +}} +pub type PKERB_REFRESH_SCCRED_REQUEST = *mut KERB_REFRESH_SCCRED_REQUEST; +pub const KERB_REFRESH_SCCRED_RELEASE: ::ULONG = 0x0; +pub const KERB_REFRESH_SCCRED_GETTGT: ::ULONG = 0x1; +STRUCT!{struct KERB_ADD_CREDENTIALS_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + UserName: ::UNICODE_STRING, + DomainName: ::UNICODE_STRING, + Password: ::UNICODE_STRING, + LogonId: ::LUID, + Flags: ::ULONG, +}} +pub type PKERB_ADD_CREDENTIALS_REQUEST = *mut KERB_ADD_CREDENTIALS_REQUEST; +pub const KERB_REQUEST_ADD_CREDENTIAL: ::ULONG = 1; +pub const KERB_REQUEST_REPLACE_CREDENTIAL: ::ULONG = 2; +pub const KERB_REQUEST_REMOVE_CREDENTIAL: ::ULONG = 4; +STRUCT!{struct KERB_ADD_CREDENTIALS_REQUEST_EX { + Credentials: KERB_ADD_CREDENTIALS_REQUEST, + PrincipalNameCount: ::ULONG, + PrincipalNames: [::UNICODE_STRING; ::ANYSIZE_ARRAY], +}} +pub type PKERB_ADD_CREDENTIALS_REQUEST_EX = *mut KERB_ADD_CREDENTIALS_REQUEST_EX; +STRUCT!{struct KERB_TRANSFER_CRED_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + OriginLogonId: ::LUID, + DestinationLogonId: ::LUID, + Flags: ::ULONG, +}} +pub type PKERB_TRANSFER_CRED_REQUEST = *mut KERB_TRANSFER_CRED_REQUEST; +pub const KERB_TRANSFER_CRED_WITH_TICKETS: ::ULONG = 0x1; +pub const KERB_TRANSFER_CRED_CLEANUP_CREDENTIALS: ::ULONG = 0x2; +STRUCT!{struct KERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: ::LUID, +}} +pub type PKERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST = + *mut KERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST; +STRUCT!{struct KERB_BINDING_CACHE_ENTRY_DATA { + DiscoveryTime: ::ULONG64, + RealmName: ::UNICODE_STRING, + KdcAddress: ::UNICODE_STRING, + AddressType: ::ULONG, + Flags: ::ULONG, + DcFlags: ::ULONG, + CacheFlags: ::ULONG, + KdcName: ::UNICODE_STRING, +}} +pub type PKERB_BINDING_CACHE_ENTRY_DATA = *mut KERB_BINDING_CACHE_ENTRY_DATA; +STRUCT!{struct KERB_QUERY_BINDING_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfEntries: ::ULONG, + Entries: PKERB_BINDING_CACHE_ENTRY_DATA, +}} +pub type PKERB_QUERY_BINDING_CACHE_RESPONSE = *mut KERB_QUERY_BINDING_CACHE_RESPONSE; +STRUCT!{struct KERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + RealmName: ::UNICODE_STRING, + KdcAddress: ::UNICODE_STRING, + AddressType: ::ULONG, + DcFlags: ::ULONG, +}} +pub type PKERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST = *mut KERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST; +STRUCT!{struct KERB_QUERY_BINDING_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, +}} +pub type PKERB_QUERY_BINDING_CACHE_REQUEST = *mut KERB_QUERY_BINDING_CACHE_REQUEST; +STRUCT!{struct KERB_PURGE_BINDING_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, +}} +pub type PKERB_PURGE_BINDING_CACHE_REQUEST = *mut KERB_PURGE_BINDING_CACHE_REQUEST; +STRUCT!{struct KERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ::ULONG, + DomainName: ::UNICODE_STRING, +}} +pub type PKERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST = + *mut KERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST; +STRUCT!{struct KERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ::ULONG, + ExtendedPolicies: ::ULONG, + DsFlags: ::ULONG, +}} +pub type PKERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE = + *mut KERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE; +ENUM!{enum KERB_CERTIFICATE_INFO_TYPE { + CertHashInfo = 1, +}} +pub type PKERB_CERTIFICATE_INFO_TYPE = *mut KERB_CERTIFICATE_INFO_TYPE; +STRUCT!{struct KERB_CERTIFICATE_HASHINFO { + StoreNameLength: ::USHORT, + HashLength: ::USHORT, +}} +pub type PKERB_CERTIFICATE_HASHINFO = *mut KERB_CERTIFICATE_HASHINFO; +STRUCT!{struct KERB_CERTIFICATE_INFO { + CertInfoSize: ::ULONG, + InfoType: ::ULONG, +}} +pub type PKERB_CERTIFICATE_INFO = *mut KERB_CERTIFICATE_INFO; +STRUCT!{struct POLICY_AUDIT_SID_ARRAY { + UsersCount: ::ULONG, + UserSidArray: *mut ::PSID, +}} +pub type PPOLICY_AUDIT_SID_ARRAY = *mut POLICY_AUDIT_SID_ARRAY; +STRUCT!{struct AUDIT_POLICY_INFORMATION { + AuditSubCategoryGuid: ::GUID, + AuditingInformation: ::ULONG, + AuditCategoryGuid: ::GUID, +}} +pub type PAUDIT_POLICY_INFORMATION = *mut AUDIT_POLICY_INFORMATION; +pub type LPAUDIT_POLICY_INFORMATION = PAUDIT_POLICY_INFORMATION; +pub type PCAUDIT_POLICY_INFORMATION = *const AUDIT_POLICY_INFORMATION; +pub const AUDIT_SET_SYSTEM_POLICY: ::ULONG = 0x0001; +pub const AUDIT_QUERY_SYSTEM_POLICY: ::ULONG = 0x0002; +pub const AUDIT_SET_USER_POLICY: ::ULONG = 0x0004; +pub const AUDIT_QUERY_USER_POLICY: ::ULONG = 0x0008; +pub const AUDIT_ENUMERATE_USERS: ::ULONG = 0x0010; +pub const AUDIT_SET_MISC_POLICY: ::ULONG = 0x0020; +pub const AUDIT_QUERY_MISC_POLICY: ::ULONG = 0x0040; +pub const AUDIT_GENERIC_ALL: ::ULONG = ::STANDARD_RIGHTS_REQUIRED | AUDIT_SET_SYSTEM_POLICY + | AUDIT_QUERY_SYSTEM_POLICY | AUDIT_SET_USER_POLICY | AUDIT_QUERY_USER_POLICY + | AUDIT_ENUMERATE_USERS | AUDIT_SET_MISC_POLICY | AUDIT_QUERY_MISC_POLICY; +pub const AUDIT_GENERIC_READ: ::ULONG = ::STANDARD_RIGHTS_READ | AUDIT_QUERY_SYSTEM_POLICY + | AUDIT_QUERY_USER_POLICY | AUDIT_ENUMERATE_USERS | AUDIT_QUERY_MISC_POLICY; +pub const AUDIT_GENERIC_WRITE: ::ULONG = ::STANDARD_RIGHTS_WRITE | AUDIT_SET_USER_POLICY + | AUDIT_SET_MISC_POLICY | AUDIT_SET_SYSTEM_POLICY; +pub const AUDIT_GENERIC_EXECUTE: ::ULONG = ::STANDARD_RIGHTS_EXECUTE; +STRUCT!{struct PKU2U_CERT_BLOB { + CertOffset: ::ULONG, + CertLength: ::USHORT, +}} +pub type PPKU2U_CERT_BLOB = *mut PKU2U_CERT_BLOB; +pub const PKU2U_CREDUI_CONTEXT_VERSION: ::ULONG64 = 0x4154414454524543; +STRUCT!{struct PKU2U_CREDUI_CONTEXT { + Version: ::ULONG64, + cbHeaderLength: ::USHORT, + cbStructureLength: ::ULONG, + CertArrayCount: ::USHORT, + CertArrayOffset: ::ULONG, +}} +pub type PPKU2U_CREDUI_CONTEXT = *mut PKU2U_CREDUI_CONTEXT; +ENUM!{enum PKU2U_LOGON_SUBMIT_TYPE { + Pku2uCertificateS4ULogon = 14, +}} +pub type PPKU2U_LOGON_SUBMIT_TYPE = *mut PKU2U_LOGON_SUBMIT_TYPE; +STRUCT!{struct PKU2U_CERTIFICATE_S4U_LOGON { + MessageType: PKU2U_LOGON_SUBMIT_TYPE, + Flags: ::ULONG, + UserPrincipalName: ::UNICODE_STRING, + DomainName: ::UNICODE_STRING, + CertificateLength: ::ULONG, + Certificate: ::PUCHAR, +}} +pub type PPKU2U_CERTIFICATE_S4U_LOGON = *mut PKU2U_CERTIFICATE_S4U_LOGON; diff --git a/third_party/rust/winapi/src/ntstatus.rs b/third_party/rust/winapi/src/ntstatus.rs new file mode 100644 index 000000000000..466223558544 --- /dev/null +++ b/third_party/rust/winapi/src/ntstatus.rs @@ -0,0 +1,2474 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Constant definitions for the NTSTATUS values. +pub const STATUS_WAIT_0: ::NTSTATUS = 0x00000000; +pub const FACILITY_VSM: ::NTSTATUS = 0x45; +pub const FACILITY_VOLSNAP: ::NTSTATUS = 0x50; +pub const FACILITY_VOLMGR: ::NTSTATUS = 0x38; +pub const FACILITY_VIRTUALIZATION: ::NTSTATUS = 0x37; +pub const FACILITY_VIDEO: ::NTSTATUS = 0x1B; +pub const FACILITY_USB_ERROR_CODE: ::NTSTATUS = 0x10; +pub const FACILITY_TRANSACTION: ::NTSTATUS = 0x19; +pub const FACILITY_TPM: ::NTSTATUS = 0x29; +pub const FACILITY_TERMINAL_SERVER: ::NTSTATUS = 0xA; +pub const FACILITY_SXS_ERROR_CODE: ::NTSTATUS = 0x15; +pub const FACILITY_NTSSPI: ::NTSTATUS = 0x9; +pub const FACILITY_SPACES: ::NTSTATUS = 0xE7; +pub const FACILITY_SMB: ::NTSTATUS = 0x5D; +pub const FACILITY_SYSTEM_INTEGRITY: ::NTSTATUS = 0xE9; +pub const FACILITY_SHARED_VHDX: ::NTSTATUS = 0x5C; +pub const FACILITY_SECUREBOOT: ::NTSTATUS = 0x43; +pub const FACILITY_SECURITY_CORE: ::NTSTATUS = 0xE8; +pub const FACILITY_SDBUS: ::NTSTATUS = 0x51; +pub const FACILITY_RTPM: ::NTSTATUS = 0x2A; +pub const FACILITY_RPC_STUBS: ::NTSTATUS = 0x3; +pub const FACILITY_RPC_RUNTIME: ::NTSTATUS = 0x2; +pub const FACILITY_RESUME_KEY_FILTER: ::NTSTATUS = 0x40; +pub const FACILITY_RDBSS: ::NTSTATUS = 0x41; +pub const FACILITY_NTWIN32: ::NTSTATUS = 0x7; +pub const FACILITY_WIN32K_NTUSER: ::NTSTATUS = 0x3E; +pub const FACILITY_WIN32K_NTGDI: ::NTSTATUS = 0x3F; +pub const FACILITY_NDIS_ERROR_CODE: ::NTSTATUS = 0x23; +pub const FACILTIY_MUI_ERROR_CODE: ::NTSTATUS = 0xB; +pub const FACILITY_MONITOR: ::NTSTATUS = 0x1D; +pub const FACILITY_MAXIMUM_VALUE: ::NTSTATUS = 0xEB; +pub const FACILITY_LICENSING: ::NTSTATUS = 0xEA; +pub const FACILITY_IPSEC: ::NTSTATUS = 0x36; +pub const FACILITY_IO_ERROR_CODE: ::NTSTATUS = 0x4; +pub const FACILITY_INTERIX: ::NTSTATUS = 0x99; +pub const FACILITY_HYPERVISOR: ::NTSTATUS = 0x35; +pub const FACILITY_HID_ERROR_CODE: ::NTSTATUS = 0x11; +pub const FACILITY_GRAPHICS_KERNEL: ::NTSTATUS = 0x1E; +pub const FACILITY_FWP_ERROR_CODE: ::NTSTATUS = 0x22; +pub const FACILITY_FVE_ERROR_CODE: ::NTSTATUS = 0x21; +pub const FACILITY_FIREWIRE_ERROR_CODE: ::NTSTATUS = 0x12; +pub const FACILITY_FILTER_MANAGER: ::NTSTATUS = 0x1C; +pub const FACILITY_DRIVER_FRAMEWORK: ::NTSTATUS = 0x20; +pub const FACILITY_DEBUGGER: ::NTSTATUS = 0x1; +pub const FACILITY_COMMONLOG: ::NTSTATUS = 0x1A; +pub const FACILITY_CODCLASS_ERROR_CODE: ::NTSTATUS = 0x6; +pub const FACILITY_CLUSTER_ERROR_CODE: ::NTSTATUS = 0x13; +pub const FACILITY_NTCERT: ::NTSTATUS = 0x8; +pub const FACILITY_BTH_ATT: ::NTSTATUS = 0x42; +pub const FACILITY_BCD_ERROR_CODE: ::NTSTATUS = 0x39; +pub const FACILITY_AUDIO_KERNEL: ::NTSTATUS = 0x44; +pub const FACILITY_ACPI_ERROR_CODE: ::NTSTATUS = 0x14; +pub const STATUS_SEVERITY_WARNING: ::NTSTATUS = 0x2; +pub const STATUS_SEVERITY_SUCCESS: ::NTSTATUS = 0x0; +pub const STATUS_SEVERITY_INFORMATIONAL: ::NTSTATUS = 0x1; +pub const STATUS_SEVERITY_ERROR: ::NTSTATUS = 0x3; +pub const STATUS_SUCCESS: ::NTSTATUS = 0x00000000; +pub const STATUS_WAIT_1: ::NTSTATUS = 0x00000001; +pub const STATUS_WAIT_2: ::NTSTATUS = 0x00000002; +pub const STATUS_WAIT_3: ::NTSTATUS = 0x00000003; +pub const STATUS_WAIT_63: ::NTSTATUS = 0x0000003F; +pub const STATUS_ABANDONED: ::NTSTATUS = 0x00000080; +pub const STATUS_ABANDONED_WAIT_0: ::NTSTATUS = 0x00000080; +pub const STATUS_ABANDONED_WAIT_63: ::NTSTATUS = 0x000000BF; +pub const STATUS_USER_APC: ::NTSTATUS = 0x000000C0; +pub const STATUS_KERNEL_APC: ::NTSTATUS = 0x00000100; +pub const STATUS_ALERTED: ::NTSTATUS = 0x00000101; +pub const STATUS_TIMEOUT: ::NTSTATUS = 0x00000102; +pub const STATUS_PENDING: ::NTSTATUS = 0x00000103; +pub const STATUS_REPARSE: ::NTSTATUS = 0x00000104; +pub const STATUS_MORE_ENTRIES: ::NTSTATUS = 0x00000105; +pub const STATUS_NOT_ALL_ASSIGNED: ::NTSTATUS = 0x00000106; +pub const STATUS_SOME_NOT_MAPPED: ::NTSTATUS = 0x00000107; +pub const STATUS_OPLOCK_BREAK_IN_PROGRESS: ::NTSTATUS = 0x00000108; +pub const STATUS_VOLUME_MOUNTED: ::NTSTATUS = 0x00000109; +pub const STATUS_RXACT_COMMITTED: ::NTSTATUS = 0x0000010A; +pub const STATUS_NOTIFY_CLEANUP: ::NTSTATUS = 0x0000010B; +pub const STATUS_NOTIFY_ENUM_DIR: ::NTSTATUS = 0x0000010C; +pub const STATUS_NO_QUOTAS_FOR_ACCOUNT: ::NTSTATUS = 0x0000010D; +pub const STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED: ::NTSTATUS = 0x0000010E; +pub const STATUS_PAGE_FAULT_TRANSITION: ::NTSTATUS = 0x00000110; +pub const STATUS_PAGE_FAULT_DEMAND_ZERO: ::NTSTATUS = 0x00000111; +pub const STATUS_PAGE_FAULT_COPY_ON_WRITE: ::NTSTATUS = 0x00000112; +pub const STATUS_PAGE_FAULT_GUARD_PAGE: ::NTSTATUS = 0x00000113; +pub const STATUS_PAGE_FAULT_PAGING_FILE: ::NTSTATUS = 0x00000114; +pub const STATUS_CACHE_PAGE_LOCKED: ::NTSTATUS = 0x00000115; +pub const STATUS_CRASH_DUMP: ::NTSTATUS = 0x00000116; +pub const STATUS_BUFFER_ALL_ZEROS: ::NTSTATUS = 0x00000117; +pub const STATUS_REPARSE_OBJECT: ::NTSTATUS = 0x00000118; +pub const STATUS_RESOURCE_REQUIREMENTS_CHANGED: ::NTSTATUS = 0x00000119; +pub const STATUS_TRANSLATION_COMPLETE: ::NTSTATUS = 0x00000120; +pub const STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY: ::NTSTATUS = 0x00000121; +pub const STATUS_NOTHING_TO_TERMINATE: ::NTSTATUS = 0x00000122; +pub const STATUS_PROCESS_NOT_IN_JOB: ::NTSTATUS = 0x00000123; +pub const STATUS_PROCESS_IN_JOB: ::NTSTATUS = 0x00000124; +pub const STATUS_VOLSNAP_HIBERNATE_READY: ::NTSTATUS = 0x00000125; +pub const STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY: ::NTSTATUS = 0x00000126; +pub const STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED: ::NTSTATUS = 0x00000127; +pub const STATUS_INTERRUPT_STILL_CONNECTED: ::NTSTATUS = 0x00000128; +pub const STATUS_PROCESS_CLONED: ::NTSTATUS = 0x00000129; +pub const STATUS_FILE_LOCKED_WITH_ONLY_READERS: ::NTSTATUS = 0x0000012A; +pub const STATUS_FILE_LOCKED_WITH_WRITERS: ::NTSTATUS = 0x0000012B; +pub const STATUS_VALID_IMAGE_HASH: ::NTSTATUS = 0x0000012C; +pub const STATUS_VALID_CATALOG_HASH: ::NTSTATUS = 0x0000012D; +pub const STATUS_VALID_STRONG_CODE_HASH: ::NTSTATUS = 0x0000012E; +pub const STATUS_RESOURCEMANAGER_READ_ONLY: ::NTSTATUS = 0x00000202; +pub const STATUS_RING_PREVIOUSLY_EMPTY: ::NTSTATUS = 0x00000210; +pub const STATUS_RING_PREVIOUSLY_FULL: ::NTSTATUS = 0x00000211; +pub const STATUS_RING_PREVIOUSLY_ABOVE_QUOTA: ::NTSTATUS = 0x00000212; +pub const STATUS_RING_NEWLY_EMPTY: ::NTSTATUS = 0x00000213; +pub const STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT: ::NTSTATUS = 0x00000214; +pub const STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE: ::NTSTATUS = 0x00000215; +pub const STATUS_OPLOCK_HANDLE_CLOSED: ::NTSTATUS = 0x00000216; +pub const STATUS_WAIT_FOR_OPLOCK: ::NTSTATUS = 0x00000367; +pub const DBG_EXCEPTION_HANDLED: ::NTSTATUS = 0x00010001; +pub const DBG_CONTINUE: ::NTSTATUS = 0x00010002; +pub const STATUS_FLT_IO_COMPLETE: ::NTSTATUS = 0x001C0001; +pub const STATUS_OBJECT_NAME_EXISTS: ::NTSTATUS = 0x40000000; +pub const STATUS_THREAD_WAS_SUSPENDED: ::NTSTATUS = 0x40000001; +pub const STATUS_WORKING_SET_LIMIT_RANGE: ::NTSTATUS = 0x40000002; +pub const STATUS_IMAGE_NOT_AT_BASE: ::NTSTATUS = 0x40000003; +pub const STATUS_RXACT_STATE_CREATED: ::NTSTATUS = 0x40000004; +pub const STATUS_SEGMENT_NOTIFICATION: ::NTSTATUS = 0x40000005; +pub const STATUS_LOCAL_USER_SESSION_KEY: ::NTSTATUS = 0x40000006; +pub const STATUS_BAD_CURRENT_DIRECTORY: ::NTSTATUS = 0x40000007; +pub const STATUS_SERIAL_MORE_WRITES: ::NTSTATUS = 0x40000008; +pub const STATUS_REGISTRY_RECOVERED: ::NTSTATUS = 0x40000009; +pub const STATUS_FT_READ_RECOVERY_FROM_BACKUP: ::NTSTATUS = 0x4000000A; +pub const STATUS_FT_WRITE_RECOVERY: ::NTSTATUS = 0x4000000B; +pub const STATUS_SERIAL_COUNTER_TIMEOUT: ::NTSTATUS = 0x4000000C; +pub const STATUS_NULL_LM_PASSWORD: ::NTSTATUS = 0x4000000D; +pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH: ::NTSTATUS = 0x4000000E; +pub const STATUS_RECEIVE_PARTIAL: ::NTSTATUS = 0x4000000F; +pub const STATUS_RECEIVE_EXPEDITED: ::NTSTATUS = 0x40000010; +pub const STATUS_RECEIVE_PARTIAL_EXPEDITED: ::NTSTATUS = 0x40000011; +pub const STATUS_EVENT_DONE: ::NTSTATUS = 0x40000012; +pub const STATUS_EVENT_PENDING: ::NTSTATUS = 0x40000013; +pub const STATUS_CHECKING_FILE_SYSTEM: ::NTSTATUS = 0x40000014; +pub const STATUS_FATAL_APP_EXIT: ::NTSTATUS = 0x40000015; +pub const STATUS_PREDEFINED_HANDLE: ::NTSTATUS = 0x40000016; +pub const STATUS_WAS_UNLOCKED: ::NTSTATUS = 0x40000017; +pub const STATUS_SERVICE_NOTIFICATION: ::NTSTATUS = 0x40000018; +pub const STATUS_WAS_LOCKED: ::NTSTATUS = 0x40000019; +pub const STATUS_LOG_HARD_ERROR: ::NTSTATUS = 0x4000001A; +pub const STATUS_ALREADY_WIN32: ::NTSTATUS = 0x4000001B; +pub const STATUS_WX86_UNSIMULATE: ::NTSTATUS = 0x4000001C; +pub const STATUS_WX86_CONTINUE: ::NTSTATUS = 0x4000001D; +pub const STATUS_WX86_SINGLE_STEP: ::NTSTATUS = 0x4000001E; +pub const STATUS_WX86_BREAKPOINT: ::NTSTATUS = 0x4000001F; +pub const STATUS_WX86_EXCEPTION_CONTINUE: ::NTSTATUS = 0x40000020; +pub const STATUS_WX86_EXCEPTION_LASTCHANCE: ::NTSTATUS = 0x40000021; +pub const STATUS_WX86_EXCEPTION_CHAIN: ::NTSTATUS = 0x40000022; +pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE: ::NTSTATUS = 0x40000023; +pub const STATUS_NO_YIELD_PERFORMED: ::NTSTATUS = 0x40000024; +pub const STATUS_TIMER_RESUME_IGNORED: ::NTSTATUS = 0x40000025; +pub const STATUS_ARBITRATION_UNHANDLED: ::NTSTATUS = 0x40000026; +pub const STATUS_CARDBUS_NOT_SUPPORTED: ::NTSTATUS = 0x40000027; +pub const STATUS_WX86_CREATEWX86TIB: ::NTSTATUS = 0x40000028; +pub const STATUS_MP_PROCESSOR_MISMATCH: ::NTSTATUS = 0x40000029; +pub const STATUS_HIBERNATED: ::NTSTATUS = 0x4000002A; +pub const STATUS_RESUME_HIBERNATION: ::NTSTATUS = 0x4000002B; +pub const STATUS_FIRMWARE_UPDATED: ::NTSTATUS = 0x4000002C; +pub const STATUS_DRIVERS_LEAKING_LOCKED_PAGES: ::NTSTATUS = 0x4000002D; +pub const STATUS_MESSAGE_RETRIEVED: ::NTSTATUS = 0x4000002E; +pub const STATUS_SYSTEM_POWERSTATE_TRANSITION: ::NTSTATUS = 0x4000002F; +pub const STATUS_ALPC_CHECK_COMPLETION_LIST: ::NTSTATUS = 0x40000030; +pub const STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: ::NTSTATUS = 0x40000031; +pub const STATUS_ACCESS_AUDIT_BY_POLICY: ::NTSTATUS = 0x40000032; +pub const STATUS_ABANDON_HIBERFILE: ::NTSTATUS = 0x40000033; +pub const STATUS_BIZRULES_NOT_ENABLED: ::NTSTATUS = 0x40000034; +pub const STATUS_FT_READ_FROM_COPY: ::NTSTATUS = 0x40000035; +pub const STATUS_IMAGE_AT_DIFFERENT_BASE: ::NTSTATUS = 0x40000036; +pub const DBG_REPLY_LATER: ::NTSTATUS = 0x40010001; +pub const DBG_UNABLE_TO_PROVIDE_HANDLE: ::NTSTATUS = 0x40010002; +pub const DBG_TERMINATE_THREAD: ::NTSTATUS = 0x40010003; +pub const DBG_TERMINATE_PROCESS: ::NTSTATUS = 0x40010004; +pub const DBG_CONTROL_C: ::NTSTATUS = 0x40010005; +pub const DBG_PRINTEXCEPTION_C: ::NTSTATUS = 0x40010006; +pub const DBG_RIPEXCEPTION: ::NTSTATUS = 0x40010007; +pub const DBG_CONTROL_BREAK: ::NTSTATUS = 0x40010008; +pub const DBG_COMMAND_EXCEPTION: ::NTSTATUS = 0x40010009; +pub const DBG_PRINTEXCEPTION_WIDE_C: ::NTSTATUS = 0x4001000A; +pub const STATUS_HEURISTIC_DAMAGE_POSSIBLE: ::NTSTATUS = 0x40190001; +pub const STATUS_GUARD_PAGE_VIOLATION: ::NTSTATUS = 0x80000001u32 as i32; +pub const STATUS_DATATYPE_MISALIGNMENT: ::NTSTATUS = 0x80000002u32 as i32; +pub const STATUS_BREAKPOINT: ::NTSTATUS = 0x80000003u32 as i32; +pub const STATUS_SINGLE_STEP: ::NTSTATUS = 0x80000004u32 as i32; +pub const STATUS_BUFFER_OVERFLOW: ::NTSTATUS = 0x80000005u32 as i32; +pub const STATUS_NO_MORE_FILES: ::NTSTATUS = 0x80000006u32 as i32; +pub const STATUS_WAKE_SYSTEM_DEBUGGER: ::NTSTATUS = 0x80000007u32 as i32; +pub const STATUS_HANDLES_CLOSED: ::NTSTATUS = 0x8000000Au32 as i32; +pub const STATUS_NO_INHERITANCE: ::NTSTATUS = 0x8000000Bu32 as i32; +pub const STATUS_GUID_SUBSTITUTION_MADE: ::NTSTATUS = 0x8000000Cu32 as i32; +pub const STATUS_PARTIAL_COPY: ::NTSTATUS = 0x8000000Du32 as i32; +pub const STATUS_DEVICE_PAPER_EMPTY: ::NTSTATUS = 0x8000000Eu32 as i32; +pub const STATUS_DEVICE_POWERED_OFF: ::NTSTATUS = 0x8000000Fu32 as i32; +pub const STATUS_DEVICE_OFF_LINE: ::NTSTATUS = 0x80000010u32 as i32; +pub const STATUS_DEVICE_BUSY: ::NTSTATUS = 0x80000011u32 as i32; +pub const STATUS_NO_MORE_EAS: ::NTSTATUS = 0x80000012u32 as i32; +pub const STATUS_INVALID_EA_NAME: ::NTSTATUS = 0x80000013u32 as i32; +pub const STATUS_EA_LIST_INCONSISTENT: ::NTSTATUS = 0x80000014u32 as i32; +pub const STATUS_INVALID_EA_FLAG: ::NTSTATUS = 0x80000015u32 as i32; +pub const STATUS_VERIFY_REQUIRED: ::NTSTATUS = 0x80000016u32 as i32; +pub const STATUS_EXTRANEOUS_INFORMATION: ::NTSTATUS = 0x80000017u32 as i32; +pub const STATUS_RXACT_COMMIT_NECESSARY: ::NTSTATUS = 0x80000018u32 as i32; +pub const STATUS_NO_MORE_ENTRIES: ::NTSTATUS = 0x8000001Au32 as i32; +pub const STATUS_FILEMARK_DETECTED: ::NTSTATUS = 0x8000001Bu32 as i32; +pub const STATUS_MEDIA_CHANGED: ::NTSTATUS = 0x8000001Cu32 as i32; +pub const STATUS_BUS_RESET: ::NTSTATUS = 0x8000001Du32 as i32; +pub const STATUS_END_OF_MEDIA: ::NTSTATUS = 0x8000001Eu32 as i32; +pub const STATUS_BEGINNING_OF_MEDIA: ::NTSTATUS = 0x8000001Fu32 as i32; +pub const STATUS_MEDIA_CHECK: ::NTSTATUS = 0x80000020u32 as i32; +pub const STATUS_SETMARK_DETECTED: ::NTSTATUS = 0x80000021u32 as i32; +pub const STATUS_NO_DATA_DETECTED: ::NTSTATUS = 0x80000022u32 as i32; +pub const STATUS_REDIRECTOR_HAS_OPEN_HANDLES: ::NTSTATUS = 0x80000023u32 as i32; +pub const STATUS_SERVER_HAS_OPEN_HANDLES: ::NTSTATUS = 0x80000024u32 as i32; +pub const STATUS_ALREADY_DISCONNECTED: ::NTSTATUS = 0x80000025u32 as i32; +pub const STATUS_LONGJUMP: ::NTSTATUS = 0x80000026u32 as i32; +pub const STATUS_CLEANER_CARTRIDGE_INSTALLED: ::NTSTATUS = 0x80000027u32 as i32; +pub const STATUS_PLUGPLAY_QUERY_VETOED: ::NTSTATUS = 0x80000028u32 as i32; +pub const STATUS_UNWIND_CONSOLIDATE: ::NTSTATUS = 0x80000029u32 as i32; +pub const STATUS_REGISTRY_HIVE_RECOVERED: ::NTSTATUS = 0x8000002Au32 as i32; +pub const STATUS_DLL_MIGHT_BE_INSECURE: ::NTSTATUS = 0x8000002Bu32 as i32; +pub const STATUS_DLL_MIGHT_BE_INCOMPATIBLE: ::NTSTATUS = 0x8000002Cu32 as i32; +pub const STATUS_STOPPED_ON_SYMLINK: ::NTSTATUS = 0x8000002Du32 as i32; +pub const STATUS_CANNOT_GRANT_REQUESTED_OPLOCK: ::NTSTATUS = 0x8000002Eu32 as i32; +pub const STATUS_NO_ACE_CONDITION: ::NTSTATUS = 0x8000002Fu32 as i32; +pub const STATUS_DEVICE_SUPPORT_IN_PROGRESS: ::NTSTATUS = 0x80000030u32 as i32; +pub const STATUS_DEVICE_POWER_CYCLE_REQUIRED: ::NTSTATUS = 0x80000031u32 as i32; +pub const DBG_EXCEPTION_NOT_HANDLED: ::NTSTATUS = 0x80010001u32 as i32; +pub const STATUS_CLUSTER_NODE_ALREADY_UP: ::NTSTATUS = 0x80130001u32 as i32; +pub const STATUS_CLUSTER_NODE_ALREADY_DOWN: ::NTSTATUS = 0x80130002u32 as i32; +pub const STATUS_CLUSTER_NETWORK_ALREADY_ONLINE: ::NTSTATUS = 0x80130003u32 as i32; +pub const STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE: ::NTSTATUS = 0x80130004u32 as i32; +pub const STATUS_CLUSTER_NODE_ALREADY_MEMBER: ::NTSTATUS = 0x80130005u32 as i32; +pub const STATUS_FLT_BUFFER_TOO_SMALL: ::NTSTATUS = 0x801C0001u32 as i32; +pub const STATUS_FVE_PARTIAL_METADATA: ::NTSTATUS = 0x80210001u32 as i32; +pub const STATUS_FVE_TRANSIENT_STATE: ::NTSTATUS = 0x80210002u32 as i32; +pub const STATUS_UNSUCCESSFUL: ::NTSTATUS = 0xC0000001u32 as i32; +pub const STATUS_NOT_IMPLEMENTED: ::NTSTATUS = 0xC0000002u32 as i32; +pub const STATUS_INVALID_INFO_CLASS: ::NTSTATUS = 0xC0000003u32 as i32; +pub const STATUS_INFO_LENGTH_MISMATCH: ::NTSTATUS = 0xC0000004u32 as i32; +pub const STATUS_ACCESS_VIOLATION: ::NTSTATUS = 0xC0000005u32 as i32; +pub const STATUS_IN_PAGE_ERROR: ::NTSTATUS = 0xC0000006u32 as i32; +pub const STATUS_PAGEFILE_QUOTA: ::NTSTATUS = 0xC0000007u32 as i32; +pub const STATUS_INVALID_HANDLE: ::NTSTATUS = 0xC0000008u32 as i32; +pub const STATUS_BAD_INITIAL_STACK: ::NTSTATUS = 0xC0000009u32 as i32; +pub const STATUS_BAD_INITIAL_PC: ::NTSTATUS = 0xC000000Au32 as i32; +pub const STATUS_INVALID_CID: ::NTSTATUS = 0xC000000Bu32 as i32; +pub const STATUS_TIMER_NOT_CANCELED: ::NTSTATUS = 0xC000000Cu32 as i32; +pub const STATUS_INVALID_PARAMETER: ::NTSTATUS = 0xC000000Du32 as i32; +pub const STATUS_NO_SUCH_DEVICE: ::NTSTATUS = 0xC000000Eu32 as i32; +pub const STATUS_NO_SUCH_FILE: ::NTSTATUS = 0xC000000Fu32 as i32; +pub const STATUS_INVALID_DEVICE_REQUEST: ::NTSTATUS = 0xC0000010u32 as i32; +pub const STATUS_END_OF_FILE: ::NTSTATUS = 0xC0000011u32 as i32; +pub const STATUS_WRONG_VOLUME: ::NTSTATUS = 0xC0000012u32 as i32; +pub const STATUS_NO_MEDIA_IN_DEVICE: ::NTSTATUS = 0xC0000013u32 as i32; +pub const STATUS_UNRECOGNIZED_MEDIA: ::NTSTATUS = 0xC0000014u32 as i32; +pub const STATUS_NONEXISTENT_SECTOR: ::NTSTATUS = 0xC0000015u32 as i32; +pub const STATUS_MORE_PROCESSING_REQUIRED: ::NTSTATUS = 0xC0000016u32 as i32; +pub const STATUS_NO_MEMORY: ::NTSTATUS = 0xC0000017u32 as i32; +pub const STATUS_CONFLICTING_ADDRESSES: ::NTSTATUS = 0xC0000018u32 as i32; +pub const STATUS_NOT_MAPPED_VIEW: ::NTSTATUS = 0xC0000019u32 as i32; +pub const STATUS_UNABLE_TO_FREE_VM: ::NTSTATUS = 0xC000001Au32 as i32; +pub const STATUS_UNABLE_TO_DELETE_SECTION: ::NTSTATUS = 0xC000001Bu32 as i32; +pub const STATUS_INVALID_SYSTEM_SERVICE: ::NTSTATUS = 0xC000001Cu32 as i32; +pub const STATUS_ILLEGAL_INSTRUCTION: ::NTSTATUS = 0xC000001Du32 as i32; +pub const STATUS_INVALID_LOCK_SEQUENCE: ::NTSTATUS = 0xC000001Eu32 as i32; +pub const STATUS_INVALID_VIEW_SIZE: ::NTSTATUS = 0xC000001Fu32 as i32; +pub const STATUS_INVALID_FILE_FOR_SECTION: ::NTSTATUS = 0xC0000020u32 as i32; +pub const STATUS_ALREADY_COMMITTED: ::NTSTATUS = 0xC0000021u32 as i32; +pub const STATUS_ACCESS_DENIED: ::NTSTATUS = 0xC0000022u32 as i32; +pub const STATUS_BUFFER_TOO_SMALL: ::NTSTATUS = 0xC0000023u32 as i32; +pub const STATUS_OBJECT_TYPE_MISMATCH: ::NTSTATUS = 0xC0000024u32 as i32; +pub const STATUS_NONCONTINUABLE_EXCEPTION: ::NTSTATUS = 0xC0000025u32 as i32; +pub const STATUS_INVALID_DISPOSITION: ::NTSTATUS = 0xC0000026u32 as i32; +pub const STATUS_UNWIND: ::NTSTATUS = 0xC0000027u32 as i32; +pub const STATUS_BAD_STACK: ::NTSTATUS = 0xC0000028u32 as i32; +pub const STATUS_INVALID_UNWIND_TARGET: ::NTSTATUS = 0xC0000029u32 as i32; +pub const STATUS_NOT_LOCKED: ::NTSTATUS = 0xC000002Au32 as i32; +pub const STATUS_PARITY_ERROR: ::NTSTATUS = 0xC000002Bu32 as i32; +pub const STATUS_UNABLE_TO_DECOMMIT_VM: ::NTSTATUS = 0xC000002Cu32 as i32; +pub const STATUS_NOT_COMMITTED: ::NTSTATUS = 0xC000002Du32 as i32; +pub const STATUS_INVALID_PORT_ATTRIBUTES: ::NTSTATUS = 0xC000002Eu32 as i32; +pub const STATUS_PORT_MESSAGE_TOO_LONG: ::NTSTATUS = 0xC000002Fu32 as i32; +pub const STATUS_INVALID_PARAMETER_MIX: ::NTSTATUS = 0xC0000030u32 as i32; +pub const STATUS_INVALID_QUOTA_LOWER: ::NTSTATUS = 0xC0000031u32 as i32; +pub const STATUS_DISK_CORRUPT_ERROR: ::NTSTATUS = 0xC0000032u32 as i32; +pub const STATUS_OBJECT_NAME_INVALID: ::NTSTATUS = 0xC0000033u32 as i32; +pub const STATUS_OBJECT_NAME_NOT_FOUND: ::NTSTATUS = 0xC0000034u32 as i32; +pub const STATUS_OBJECT_NAME_COLLISION: ::NTSTATUS = 0xC0000035u32 as i32; +pub const STATUS_PORT_DO_NOT_DISTURB: ::NTSTATUS = 0xC0000036u32 as i32; +pub const STATUS_PORT_DISCONNECTED: ::NTSTATUS = 0xC0000037u32 as i32; +pub const STATUS_DEVICE_ALREADY_ATTACHED: ::NTSTATUS = 0xC0000038u32 as i32; +pub const STATUS_OBJECT_PATH_INVALID: ::NTSTATUS = 0xC0000039u32 as i32; +pub const STATUS_OBJECT_PATH_NOT_FOUND: ::NTSTATUS = 0xC000003Au32 as i32; +pub const STATUS_OBJECT_PATH_SYNTAX_BAD: ::NTSTATUS = 0xC000003Bu32 as i32; +pub const STATUS_DATA_OVERRUN: ::NTSTATUS = 0xC000003Cu32 as i32; +pub const STATUS_DATA_LATE_ERROR: ::NTSTATUS = 0xC000003Du32 as i32; +pub const STATUS_DATA_ERROR: ::NTSTATUS = 0xC000003Eu32 as i32; +pub const STATUS_CRC_ERROR: ::NTSTATUS = 0xC000003Fu32 as i32; +pub const STATUS_SECTION_TOO_BIG: ::NTSTATUS = 0xC0000040u32 as i32; +pub const STATUS_PORT_CONNECTION_REFUSED: ::NTSTATUS = 0xC0000041u32 as i32; +pub const STATUS_INVALID_PORT_HANDLE: ::NTSTATUS = 0xC0000042u32 as i32; +pub const STATUS_SHARING_VIOLATION: ::NTSTATUS = 0xC0000043u32 as i32; +pub const STATUS_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000044u32 as i32; +pub const STATUS_INVALID_PAGE_PROTECTION: ::NTSTATUS = 0xC0000045u32 as i32; +pub const STATUS_MUTANT_NOT_OWNED: ::NTSTATUS = 0xC0000046u32 as i32; +pub const STATUS_SEMAPHORE_LIMIT_EXCEEDED: ::NTSTATUS = 0xC0000047u32 as i32; +pub const STATUS_PORT_ALREADY_SET: ::NTSTATUS = 0xC0000048u32 as i32; +pub const STATUS_SECTION_NOT_IMAGE: ::NTSTATUS = 0xC0000049u32 as i32; +pub const STATUS_SUSPEND_COUNT_EXCEEDED: ::NTSTATUS = 0xC000004Au32 as i32; +pub const STATUS_THREAD_IS_TERMINATING: ::NTSTATUS = 0xC000004Bu32 as i32; +pub const STATUS_BAD_WORKING_SET_LIMIT: ::NTSTATUS = 0xC000004Cu32 as i32; +pub const STATUS_INCOMPATIBLE_FILE_MAP: ::NTSTATUS = 0xC000004Du32 as i32; +pub const STATUS_SECTION_PROTECTION: ::NTSTATUS = 0xC000004Eu32 as i32; +pub const STATUS_EAS_NOT_SUPPORTED: ::NTSTATUS = 0xC000004Fu32 as i32; +pub const STATUS_EA_TOO_LARGE: ::NTSTATUS = 0xC0000050u32 as i32; +pub const STATUS_NONEXISTENT_EA_ENTRY: ::NTSTATUS = 0xC0000051u32 as i32; +pub const STATUS_NO_EAS_ON_FILE: ::NTSTATUS = 0xC0000052u32 as i32; +pub const STATUS_EA_CORRUPT_ERROR: ::NTSTATUS = 0xC0000053u32 as i32; +pub const STATUS_FILE_LOCK_CONFLICT: ::NTSTATUS = 0xC0000054u32 as i32; +pub const STATUS_LOCK_NOT_GRANTED: ::NTSTATUS = 0xC0000055u32 as i32; +pub const STATUS_DELETE_PENDING: ::NTSTATUS = 0xC0000056u32 as i32; +pub const STATUS_CTL_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC0000057u32 as i32; +pub const STATUS_UNKNOWN_REVISION: ::NTSTATUS = 0xC0000058u32 as i32; +pub const STATUS_REVISION_MISMATCH: ::NTSTATUS = 0xC0000059u32 as i32; +pub const STATUS_INVALID_OWNER: ::NTSTATUS = 0xC000005Au32 as i32; +pub const STATUS_INVALID_PRIMARY_GROUP: ::NTSTATUS = 0xC000005Bu32 as i32; +pub const STATUS_NO_IMPERSONATION_TOKEN: ::NTSTATUS = 0xC000005Cu32 as i32; +pub const STATUS_CANT_DISABLE_MANDATORY: ::NTSTATUS = 0xC000005Du32 as i32; +pub const STATUS_NO_LOGON_SERVERS: ::NTSTATUS = 0xC000005Eu32 as i32; +pub const STATUS_NO_SUCH_LOGON_SESSION: ::NTSTATUS = 0xC000005Fu32 as i32; +pub const STATUS_NO_SUCH_PRIVILEGE: ::NTSTATUS = 0xC0000060u32 as i32; +pub const STATUS_PRIVILEGE_NOT_HELD: ::NTSTATUS = 0xC0000061u32 as i32; +pub const STATUS_INVALID_ACCOUNT_NAME: ::NTSTATUS = 0xC0000062u32 as i32; +pub const STATUS_USER_EXISTS: ::NTSTATUS = 0xC0000063u32 as i32; +pub const STATUS_NO_SUCH_USER: ::NTSTATUS = 0xC0000064u32 as i32; +pub const STATUS_GROUP_EXISTS: ::NTSTATUS = 0xC0000065u32 as i32; +pub const STATUS_NO_SUCH_GROUP: ::NTSTATUS = 0xC0000066u32 as i32; +pub const STATUS_MEMBER_IN_GROUP: ::NTSTATUS = 0xC0000067u32 as i32; +pub const STATUS_MEMBER_NOT_IN_GROUP: ::NTSTATUS = 0xC0000068u32 as i32; +pub const STATUS_LAST_ADMIN: ::NTSTATUS = 0xC0000069u32 as i32; +pub const STATUS_WRONG_PASSWORD: ::NTSTATUS = 0xC000006Au32 as i32; +pub const STATUS_ILL_FORMED_PASSWORD: ::NTSTATUS = 0xC000006Bu32 as i32; +pub const STATUS_PASSWORD_RESTRICTION: ::NTSTATUS = 0xC000006Cu32 as i32; +pub const STATUS_LOGON_FAILURE: ::NTSTATUS = 0xC000006Du32 as i32; +pub const STATUS_ACCOUNT_RESTRICTION: ::NTSTATUS = 0xC000006Eu32 as i32; +pub const STATUS_INVALID_LOGON_HOURS: ::NTSTATUS = 0xC000006Fu32 as i32; +pub const STATUS_INVALID_WORKSTATION: ::NTSTATUS = 0xC0000070u32 as i32; +pub const STATUS_PASSWORD_EXPIRED: ::NTSTATUS = 0xC0000071u32 as i32; +pub const STATUS_ACCOUNT_DISABLED: ::NTSTATUS = 0xC0000072u32 as i32; +pub const STATUS_NONE_MAPPED: ::NTSTATUS = 0xC0000073u32 as i32; +pub const STATUS_TOO_MANY_LUIDS_REQUESTED: ::NTSTATUS = 0xC0000074u32 as i32; +pub const STATUS_LUIDS_EXHAUSTED: ::NTSTATUS = 0xC0000075u32 as i32; +pub const STATUS_INVALID_SUB_AUTHORITY: ::NTSTATUS = 0xC0000076u32 as i32; +pub const STATUS_INVALID_ACL: ::NTSTATUS = 0xC0000077u32 as i32; +pub const STATUS_INVALID_SID: ::NTSTATUS = 0xC0000078u32 as i32; +pub const STATUS_INVALID_SECURITY_DESCR: ::NTSTATUS = 0xC0000079u32 as i32; +pub const STATUS_PROCEDURE_NOT_FOUND: ::NTSTATUS = 0xC000007Au32 as i32; +pub const STATUS_INVALID_IMAGE_FORMAT: ::NTSTATUS = 0xC000007Bu32 as i32; +pub const STATUS_NO_TOKEN: ::NTSTATUS = 0xC000007Cu32 as i32; +pub const STATUS_BAD_INHERITANCE_ACL: ::NTSTATUS = 0xC000007Du32 as i32; +pub const STATUS_RANGE_NOT_LOCKED: ::NTSTATUS = 0xC000007Eu32 as i32; +pub const STATUS_DISK_FULL: ::NTSTATUS = 0xC000007Fu32 as i32; +pub const STATUS_SERVER_DISABLED: ::NTSTATUS = 0xC0000080u32 as i32; +pub const STATUS_SERVER_NOT_DISABLED: ::NTSTATUS = 0xC0000081u32 as i32; +pub const STATUS_TOO_MANY_GUIDS_REQUESTED: ::NTSTATUS = 0xC0000082u32 as i32; +pub const STATUS_GUIDS_EXHAUSTED: ::NTSTATUS = 0xC0000083u32 as i32; +pub const STATUS_INVALID_ID_AUTHORITY: ::NTSTATUS = 0xC0000084u32 as i32; +pub const STATUS_AGENTS_EXHAUSTED: ::NTSTATUS = 0xC0000085u32 as i32; +pub const STATUS_INVALID_VOLUME_LABEL: ::NTSTATUS = 0xC0000086u32 as i32; +pub const STATUS_SECTION_NOT_EXTENDED: ::NTSTATUS = 0xC0000087u32 as i32; +pub const STATUS_NOT_MAPPED_DATA: ::NTSTATUS = 0xC0000088u32 as i32; +pub const STATUS_RESOURCE_DATA_NOT_FOUND: ::NTSTATUS = 0xC0000089u32 as i32; +pub const STATUS_RESOURCE_TYPE_NOT_FOUND: ::NTSTATUS = 0xC000008Au32 as i32; +pub const STATUS_RESOURCE_NAME_NOT_FOUND: ::NTSTATUS = 0xC000008Bu32 as i32; +pub const STATUS_ARRAY_BOUNDS_EXCEEDED: ::NTSTATUS = 0xC000008Cu32 as i32; +pub const STATUS_FLOAT_DENORMAL_OPERAND: ::NTSTATUS = 0xC000008Du32 as i32; +pub const STATUS_FLOAT_DIVIDE_BY_ZERO: ::NTSTATUS = 0xC000008Eu32 as i32; +pub const STATUS_FLOAT_INEXACT_RESULT: ::NTSTATUS = 0xC000008Fu32 as i32; +pub const STATUS_FLOAT_INVALID_OPERATION: ::NTSTATUS = 0xC0000090u32 as i32; +pub const STATUS_FLOAT_OVERFLOW: ::NTSTATUS = 0xC0000091u32 as i32; +pub const STATUS_FLOAT_STACK_CHECK: ::NTSTATUS = 0xC0000092u32 as i32; +pub const STATUS_FLOAT_UNDERFLOW: ::NTSTATUS = 0xC0000093u32 as i32; +pub const STATUS_INTEGER_DIVIDE_BY_ZERO: ::NTSTATUS = 0xC0000094u32 as i32; +pub const STATUS_INTEGER_OVERFLOW: ::NTSTATUS = 0xC0000095u32 as i32; +pub const STATUS_PRIVILEGED_INSTRUCTION: ::NTSTATUS = 0xC0000096u32 as i32; +pub const STATUS_TOO_MANY_PAGING_FILES: ::NTSTATUS = 0xC0000097u32 as i32; +pub const STATUS_FILE_INVALID: ::NTSTATUS = 0xC0000098u32 as i32; +pub const STATUS_ALLOTTED_SPACE_EXCEEDED: ::NTSTATUS = 0xC0000099u32 as i32; +pub const STATUS_INSUFFICIENT_RESOURCES: ::NTSTATUS = 0xC000009Au32 as i32; +pub const STATUS_DFS_EXIT_PATH_FOUND: ::NTSTATUS = 0xC000009Bu32 as i32; +pub const STATUS_DEVICE_DATA_ERROR: ::NTSTATUS = 0xC000009Cu32 as i32; +pub const STATUS_DEVICE_NOT_CONNECTED: ::NTSTATUS = 0xC000009Du32 as i32; +pub const STATUS_DEVICE_POWER_FAILURE: ::NTSTATUS = 0xC000009Eu32 as i32; +pub const STATUS_FREE_VM_NOT_AT_BASE: ::NTSTATUS = 0xC000009Fu32 as i32; +pub const STATUS_MEMORY_NOT_ALLOCATED: ::NTSTATUS = 0xC00000A0u32 as i32; +pub const STATUS_WORKING_SET_QUOTA: ::NTSTATUS = 0xC00000A1u32 as i32; +pub const STATUS_MEDIA_WRITE_PROTECTED: ::NTSTATUS = 0xC00000A2u32 as i32; +pub const STATUS_DEVICE_NOT_READY: ::NTSTATUS = 0xC00000A3u32 as i32; +pub const STATUS_INVALID_GROUP_ATTRIBUTES: ::NTSTATUS = 0xC00000A4u32 as i32; +pub const STATUS_BAD_IMPERSONATION_LEVEL: ::NTSTATUS = 0xC00000A5u32 as i32; +pub const STATUS_CANT_OPEN_ANONYMOUS: ::NTSTATUS = 0xC00000A6u32 as i32; +pub const STATUS_BAD_VALIDATION_CLASS: ::NTSTATUS = 0xC00000A7u32 as i32; +pub const STATUS_BAD_TOKEN_TYPE: ::NTSTATUS = 0xC00000A8u32 as i32; +pub const STATUS_BAD_MASTER_BOOT_RECORD: ::NTSTATUS = 0xC00000A9u32 as i32; +pub const STATUS_INSTRUCTION_MISALIGNMENT: ::NTSTATUS = 0xC00000AAu32 as i32; +pub const STATUS_INSTANCE_NOT_AVAILABLE: ::NTSTATUS = 0xC00000ABu32 as i32; +pub const STATUS_PIPE_NOT_AVAILABLE: ::NTSTATUS = 0xC00000ACu32 as i32; +pub const STATUS_INVALID_PIPE_STATE: ::NTSTATUS = 0xC00000ADu32 as i32; +pub const STATUS_PIPE_BUSY: ::NTSTATUS = 0xC00000AEu32 as i32; +pub const STATUS_ILLEGAL_FUNCTION: ::NTSTATUS = 0xC00000AFu32 as i32; +pub const STATUS_PIPE_DISCONNECTED: ::NTSTATUS = 0xC00000B0u32 as i32; +pub const STATUS_PIPE_CLOSING: ::NTSTATUS = 0xC00000B1u32 as i32; +pub const STATUS_PIPE_CONNECTED: ::NTSTATUS = 0xC00000B2u32 as i32; +pub const STATUS_PIPE_LISTENING: ::NTSTATUS = 0xC00000B3u32 as i32; +pub const STATUS_INVALID_READ_MODE: ::NTSTATUS = 0xC00000B4u32 as i32; +pub const STATUS_IO_TIMEOUT: ::NTSTATUS = 0xC00000B5u32 as i32; +pub const STATUS_FILE_FORCED_CLOSED: ::NTSTATUS = 0xC00000B6u32 as i32; +pub const STATUS_PROFILING_NOT_STARTED: ::NTSTATUS = 0xC00000B7u32 as i32; +pub const STATUS_PROFILING_NOT_STOPPED: ::NTSTATUS = 0xC00000B8u32 as i32; +pub const STATUS_COULD_NOT_INTERPRET: ::NTSTATUS = 0xC00000B9u32 as i32; +pub const STATUS_FILE_IS_A_DIRECTORY: ::NTSTATUS = 0xC00000BAu32 as i32; +pub const STATUS_NOT_SUPPORTED: ::NTSTATUS = 0xC00000BBu32 as i32; +pub const STATUS_REMOTE_NOT_LISTENING: ::NTSTATUS = 0xC00000BCu32 as i32; +pub const STATUS_DUPLICATE_NAME: ::NTSTATUS = 0xC00000BDu32 as i32; +pub const STATUS_BAD_NETWORK_PATH: ::NTSTATUS = 0xC00000BEu32 as i32; +pub const STATUS_NETWORK_BUSY: ::NTSTATUS = 0xC00000BFu32 as i32; +pub const STATUS_DEVICE_DOES_NOT_EXIST: ::NTSTATUS = 0xC00000C0u32 as i32; +pub const STATUS_TOO_MANY_COMMANDS: ::NTSTATUS = 0xC00000C1u32 as i32; +pub const STATUS_ADAPTER_HARDWARE_ERROR: ::NTSTATUS = 0xC00000C2u32 as i32; +pub const STATUS_INVALID_NETWORK_RESPONSE: ::NTSTATUS = 0xC00000C3u32 as i32; +pub const STATUS_UNEXPECTED_NETWORK_ERROR: ::NTSTATUS = 0xC00000C4u32 as i32; +pub const STATUS_BAD_REMOTE_ADAPTER: ::NTSTATUS = 0xC00000C5u32 as i32; +pub const STATUS_PRINT_QUEUE_FULL: ::NTSTATUS = 0xC00000C6u32 as i32; +pub const STATUS_NO_SPOOL_SPACE: ::NTSTATUS = 0xC00000C7u32 as i32; +pub const STATUS_PRINT_CANCELLED: ::NTSTATUS = 0xC00000C8u32 as i32; +pub const STATUS_NETWORK_NAME_DELETED: ::NTSTATUS = 0xC00000C9u32 as i32; +pub const STATUS_NETWORK_ACCESS_DENIED: ::NTSTATUS = 0xC00000CAu32 as i32; +pub const STATUS_BAD_DEVICE_TYPE: ::NTSTATUS = 0xC00000CBu32 as i32; +pub const STATUS_BAD_NETWORK_NAME: ::NTSTATUS = 0xC00000CCu32 as i32; +pub const STATUS_TOO_MANY_NAMES: ::NTSTATUS = 0xC00000CDu32 as i32; +pub const STATUS_TOO_MANY_SESSIONS: ::NTSTATUS = 0xC00000CEu32 as i32; +pub const STATUS_SHARING_PAUSED: ::NTSTATUS = 0xC00000CFu32 as i32; +pub const STATUS_REQUEST_NOT_ACCEPTED: ::NTSTATUS = 0xC00000D0u32 as i32; +pub const STATUS_REDIRECTOR_PAUSED: ::NTSTATUS = 0xC00000D1u32 as i32; +pub const STATUS_NET_WRITE_FAULT: ::NTSTATUS = 0xC00000D2u32 as i32; +pub const STATUS_PROFILING_AT_LIMIT: ::NTSTATUS = 0xC00000D3u32 as i32; +pub const STATUS_NOT_SAME_DEVICE: ::NTSTATUS = 0xC00000D4u32 as i32; +pub const STATUS_FILE_RENAMED: ::NTSTATUS = 0xC00000D5u32 as i32; +pub const STATUS_VIRTUAL_CIRCUIT_CLOSED: ::NTSTATUS = 0xC00000D6u32 as i32; +pub const STATUS_NO_SECURITY_ON_OBJECT: ::NTSTATUS = 0xC00000D7u32 as i32; +pub const STATUS_CANT_WAIT: ::NTSTATUS = 0xC00000D8u32 as i32; +pub const STATUS_PIPE_EMPTY: ::NTSTATUS = 0xC00000D9u32 as i32; +pub const STATUS_CANT_ACCESS_DOMAIN_INFO: ::NTSTATUS = 0xC00000DAu32 as i32; +pub const STATUS_CANT_TERMINATE_SELF: ::NTSTATUS = 0xC00000DBu32 as i32; +pub const STATUS_INVALID_SERVER_STATE: ::NTSTATUS = 0xC00000DCu32 as i32; +pub const STATUS_INVALID_DOMAIN_STATE: ::NTSTATUS = 0xC00000DDu32 as i32; +pub const STATUS_INVALID_DOMAIN_ROLE: ::NTSTATUS = 0xC00000DEu32 as i32; +pub const STATUS_NO_SUCH_DOMAIN: ::NTSTATUS = 0xC00000DFu32 as i32; +pub const STATUS_DOMAIN_EXISTS: ::NTSTATUS = 0xC00000E0u32 as i32; +pub const STATUS_DOMAIN_LIMIT_EXCEEDED: ::NTSTATUS = 0xC00000E1u32 as i32; +pub const STATUS_OPLOCK_NOT_GRANTED: ::NTSTATUS = 0xC00000E2u32 as i32; +pub const STATUS_INVALID_OPLOCK_PROTOCOL: ::NTSTATUS = 0xC00000E3u32 as i32; +pub const STATUS_INTERNAL_DB_CORRUPTION: ::NTSTATUS = 0xC00000E4u32 as i32; +pub const STATUS_INTERNAL_ERROR: ::NTSTATUS = 0xC00000E5u32 as i32; +pub const STATUS_GENERIC_NOT_MAPPED: ::NTSTATUS = 0xC00000E6u32 as i32; +pub const STATUS_BAD_DESCRIPTOR_FORMAT: ::NTSTATUS = 0xC00000E7u32 as i32; +pub const STATUS_INVALID_USER_BUFFER: ::NTSTATUS = 0xC00000E8u32 as i32; +pub const STATUS_UNEXPECTED_IO_ERROR: ::NTSTATUS = 0xC00000E9u32 as i32; +pub const STATUS_UNEXPECTED_MM_CREATE_ERR: ::NTSTATUS = 0xC00000EAu32 as i32; +pub const STATUS_UNEXPECTED_MM_MAP_ERROR: ::NTSTATUS = 0xC00000EBu32 as i32; +pub const STATUS_UNEXPECTED_MM_EXTEND_ERR: ::NTSTATUS = 0xC00000ECu32 as i32; +pub const STATUS_NOT_LOGON_PROCESS: ::NTSTATUS = 0xC00000EDu32 as i32; +pub const STATUS_LOGON_SESSION_EXISTS: ::NTSTATUS = 0xC00000EEu32 as i32; +pub const STATUS_INVALID_PARAMETER_1: ::NTSTATUS = 0xC00000EFu32 as i32; +pub const STATUS_INVALID_PARAMETER_2: ::NTSTATUS = 0xC00000F0u32 as i32; +pub const STATUS_INVALID_PARAMETER_3: ::NTSTATUS = 0xC00000F1u32 as i32; +pub const STATUS_INVALID_PARAMETER_4: ::NTSTATUS = 0xC00000F2u32 as i32; +pub const STATUS_INVALID_PARAMETER_5: ::NTSTATUS = 0xC00000F3u32 as i32; +pub const STATUS_INVALID_PARAMETER_6: ::NTSTATUS = 0xC00000F4u32 as i32; +pub const STATUS_INVALID_PARAMETER_7: ::NTSTATUS = 0xC00000F5u32 as i32; +pub const STATUS_INVALID_PARAMETER_8: ::NTSTATUS = 0xC00000F6u32 as i32; +pub const STATUS_INVALID_PARAMETER_9: ::NTSTATUS = 0xC00000F7u32 as i32; +pub const STATUS_INVALID_PARAMETER_10: ::NTSTATUS = 0xC00000F8u32 as i32; +pub const STATUS_INVALID_PARAMETER_11: ::NTSTATUS = 0xC00000F9u32 as i32; +pub const STATUS_INVALID_PARAMETER_12: ::NTSTATUS = 0xC00000FAu32 as i32; +pub const STATUS_REDIRECTOR_NOT_STARTED: ::NTSTATUS = 0xC00000FBu32 as i32; +pub const STATUS_REDIRECTOR_STARTED: ::NTSTATUS = 0xC00000FCu32 as i32; +pub const STATUS_STACK_OVERFLOW: ::NTSTATUS = 0xC00000FDu32 as i32; +pub const STATUS_NO_SUCH_PACKAGE: ::NTSTATUS = 0xC00000FEu32 as i32; +pub const STATUS_BAD_FUNCTION_TABLE: ::NTSTATUS = 0xC00000FFu32 as i32; +pub const STATUS_VARIABLE_NOT_FOUND: ::NTSTATUS = 0xC0000100u32 as i32; +pub const STATUS_DIRECTORY_NOT_EMPTY: ::NTSTATUS = 0xC0000101u32 as i32; +pub const STATUS_FILE_CORRUPT_ERROR: ::NTSTATUS = 0xC0000102u32 as i32; +pub const STATUS_NOT_A_DIRECTORY: ::NTSTATUS = 0xC0000103u32 as i32; +pub const STATUS_BAD_LOGON_SESSION_STATE: ::NTSTATUS = 0xC0000104u32 as i32; +pub const STATUS_LOGON_SESSION_COLLISION: ::NTSTATUS = 0xC0000105u32 as i32; +pub const STATUS_NAME_TOO_LONG: ::NTSTATUS = 0xC0000106u32 as i32; +pub const STATUS_FILES_OPEN: ::NTSTATUS = 0xC0000107u32 as i32; +pub const STATUS_CONNECTION_IN_USE: ::NTSTATUS = 0xC0000108u32 as i32; +pub const STATUS_MESSAGE_NOT_FOUND: ::NTSTATUS = 0xC0000109u32 as i32; +pub const STATUS_PROCESS_IS_TERMINATING: ::NTSTATUS = 0xC000010Au32 as i32; +pub const STATUS_INVALID_LOGON_TYPE: ::NTSTATUS = 0xC000010Bu32 as i32; +pub const STATUS_NO_GUID_TRANSLATION: ::NTSTATUS = 0xC000010Cu32 as i32; +pub const STATUS_CANNOT_IMPERSONATE: ::NTSTATUS = 0xC000010Du32 as i32; +pub const STATUS_IMAGE_ALREADY_LOADED: ::NTSTATUS = 0xC000010Eu32 as i32; +pub const STATUS_ABIOS_NOT_PRESENT: ::NTSTATUS = 0xC000010Fu32 as i32; +pub const STATUS_ABIOS_LID_NOT_EXIST: ::NTSTATUS = 0xC0000110u32 as i32; +pub const STATUS_ABIOS_LID_ALREADY_OWNED: ::NTSTATUS = 0xC0000111u32 as i32; +pub const STATUS_ABIOS_NOT_LID_OWNER: ::NTSTATUS = 0xC0000112u32 as i32; +pub const STATUS_ABIOS_INVALID_COMMAND: ::NTSTATUS = 0xC0000113u32 as i32; +pub const STATUS_ABIOS_INVALID_LID: ::NTSTATUS = 0xC0000114u32 as i32; +pub const STATUS_ABIOS_SELECTOR_NOT_AVAILABLE: ::NTSTATUS = 0xC0000115u32 as i32; +pub const STATUS_ABIOS_INVALID_SELECTOR: ::NTSTATUS = 0xC0000116u32 as i32; +pub const STATUS_NO_LDT: ::NTSTATUS = 0xC0000117u32 as i32; +pub const STATUS_INVALID_LDT_SIZE: ::NTSTATUS = 0xC0000118u32 as i32; +pub const STATUS_INVALID_LDT_OFFSET: ::NTSTATUS = 0xC0000119u32 as i32; +pub const STATUS_INVALID_LDT_DESCRIPTOR: ::NTSTATUS = 0xC000011Au32 as i32; +pub const STATUS_INVALID_IMAGE_NE_FORMAT: ::NTSTATUS = 0xC000011Bu32 as i32; +pub const STATUS_RXACT_INVALID_STATE: ::NTSTATUS = 0xC000011Cu32 as i32; +pub const STATUS_RXACT_COMMIT_FAILURE: ::NTSTATUS = 0xC000011Du32 as i32; +pub const STATUS_MAPPED_FILE_SIZE_ZERO: ::NTSTATUS = 0xC000011Eu32 as i32; +pub const STATUS_TOO_MANY_OPENED_FILES: ::NTSTATUS = 0xC000011Fu32 as i32; +pub const STATUS_CANCELLED: ::NTSTATUS = 0xC0000120u32 as i32; +pub const STATUS_CANNOT_DELETE: ::NTSTATUS = 0xC0000121u32 as i32; +pub const STATUS_INVALID_COMPUTER_NAME: ::NTSTATUS = 0xC0000122u32 as i32; +pub const STATUS_FILE_DELETED: ::NTSTATUS = 0xC0000123u32 as i32; +pub const STATUS_SPECIAL_ACCOUNT: ::NTSTATUS = 0xC0000124u32 as i32; +pub const STATUS_SPECIAL_GROUP: ::NTSTATUS = 0xC0000125u32 as i32; +pub const STATUS_SPECIAL_USER: ::NTSTATUS = 0xC0000126u32 as i32; +pub const STATUS_MEMBERS_PRIMARY_GROUP: ::NTSTATUS = 0xC0000127u32 as i32; +pub const STATUS_FILE_CLOSED: ::NTSTATUS = 0xC0000128u32 as i32; +pub const STATUS_TOO_MANY_THREADS: ::NTSTATUS = 0xC0000129u32 as i32; +pub const STATUS_THREAD_NOT_IN_PROCESS: ::NTSTATUS = 0xC000012Au32 as i32; +pub const STATUS_TOKEN_ALREADY_IN_USE: ::NTSTATUS = 0xC000012Bu32 as i32; +pub const STATUS_PAGEFILE_QUOTA_EXCEEDED: ::NTSTATUS = 0xC000012Cu32 as i32; +pub const STATUS_COMMITMENT_LIMIT: ::NTSTATUS = 0xC000012Du32 as i32; +pub const STATUS_INVALID_IMAGE_LE_FORMAT: ::NTSTATUS = 0xC000012Eu32 as i32; +pub const STATUS_INVALID_IMAGE_NOT_MZ: ::NTSTATUS = 0xC000012Fu32 as i32; +pub const STATUS_INVALID_IMAGE_PROTECT: ::NTSTATUS = 0xC0000130u32 as i32; +pub const STATUS_INVALID_IMAGE_WIN_16: ::NTSTATUS = 0xC0000131u32 as i32; +pub const STATUS_LOGON_SERVER_CONFLICT: ::NTSTATUS = 0xC0000132u32 as i32; +pub const STATUS_TIME_DIFFERENCE_AT_DC: ::NTSTATUS = 0xC0000133u32 as i32; +pub const STATUS_SYNCHRONIZATION_REQUIRED: ::NTSTATUS = 0xC0000134u32 as i32; +pub const STATUS_DLL_NOT_FOUND: ::NTSTATUS = 0xC0000135u32 as i32; +pub const STATUS_OPEN_FAILED: ::NTSTATUS = 0xC0000136u32 as i32; +pub const STATUS_IO_PRIVILEGE_FAILED: ::NTSTATUS = 0xC0000137u32 as i32; +pub const STATUS_ORDINAL_NOT_FOUND: ::NTSTATUS = 0xC0000138u32 as i32; +pub const STATUS_ENTRYPOINT_NOT_FOUND: ::NTSTATUS = 0xC0000139u32 as i32; +pub const STATUS_CONTROL_C_EXIT: ::NTSTATUS = 0xC000013Au32 as i32; +pub const STATUS_LOCAL_DISCONNECT: ::NTSTATUS = 0xC000013Bu32 as i32; +pub const STATUS_REMOTE_DISCONNECT: ::NTSTATUS = 0xC000013Cu32 as i32; +pub const STATUS_REMOTE_RESOURCES: ::NTSTATUS = 0xC000013Du32 as i32; +pub const STATUS_LINK_FAILED: ::NTSTATUS = 0xC000013Eu32 as i32; +pub const STATUS_LINK_TIMEOUT: ::NTSTATUS = 0xC000013Fu32 as i32; +pub const STATUS_INVALID_CONNECTION: ::NTSTATUS = 0xC0000140u32 as i32; +pub const STATUS_INVALID_ADDRESS: ::NTSTATUS = 0xC0000141u32 as i32; +pub const STATUS_DLL_INIT_FAILED: ::NTSTATUS = 0xC0000142u32 as i32; +pub const STATUS_MISSING_SYSTEMFILE: ::NTSTATUS = 0xC0000143u32 as i32; +pub const STATUS_UNHANDLED_EXCEPTION: ::NTSTATUS = 0xC0000144u32 as i32; +pub const STATUS_APP_INIT_FAILURE: ::NTSTATUS = 0xC0000145u32 as i32; +pub const STATUS_PAGEFILE_CREATE_FAILED: ::NTSTATUS = 0xC0000146u32 as i32; +pub const STATUS_NO_PAGEFILE: ::NTSTATUS = 0xC0000147u32 as i32; +pub const STATUS_INVALID_LEVEL: ::NTSTATUS = 0xC0000148u32 as i32; +pub const STATUS_WRONG_PASSWORD_CORE: ::NTSTATUS = 0xC0000149u32 as i32; +pub const STATUS_ILLEGAL_FLOAT_CONTEXT: ::NTSTATUS = 0xC000014Au32 as i32; +pub const STATUS_PIPE_BROKEN: ::NTSTATUS = 0xC000014Bu32 as i32; +pub const STATUS_REGISTRY_CORRUPT: ::NTSTATUS = 0xC000014Cu32 as i32; +pub const STATUS_REGISTRY_IO_FAILED: ::NTSTATUS = 0xC000014Du32 as i32; +pub const STATUS_NO_EVENT_PAIR: ::NTSTATUS = 0xC000014Eu32 as i32; +pub const STATUS_UNRECOGNIZED_VOLUME: ::NTSTATUS = 0xC000014Fu32 as i32; +pub const STATUS_SERIAL_NO_DEVICE_INITED: ::NTSTATUS = 0xC0000150u32 as i32; +pub const STATUS_NO_SUCH_ALIAS: ::NTSTATUS = 0xC0000151u32 as i32; +pub const STATUS_MEMBER_NOT_IN_ALIAS: ::NTSTATUS = 0xC0000152u32 as i32; +pub const STATUS_MEMBER_IN_ALIAS: ::NTSTATUS = 0xC0000153u32 as i32; +pub const STATUS_ALIAS_EXISTS: ::NTSTATUS = 0xC0000154u32 as i32; +pub const STATUS_LOGON_NOT_GRANTED: ::NTSTATUS = 0xC0000155u32 as i32; +pub const STATUS_TOO_MANY_SECRETS: ::NTSTATUS = 0xC0000156u32 as i32; +pub const STATUS_SECRET_TOO_LONG: ::NTSTATUS = 0xC0000157u32 as i32; +pub const STATUS_INTERNAL_DB_ERROR: ::NTSTATUS = 0xC0000158u32 as i32; +pub const STATUS_FULLSCREEN_MODE: ::NTSTATUS = 0xC0000159u32 as i32; +pub const STATUS_TOO_MANY_CONTEXT_IDS: ::NTSTATUS = 0xC000015Au32 as i32; +pub const STATUS_LOGON_TYPE_NOT_GRANTED: ::NTSTATUS = 0xC000015Bu32 as i32; +pub const STATUS_NOT_REGISTRY_FILE: ::NTSTATUS = 0xC000015Cu32 as i32; +pub const STATUS_NT_CROSS_ENCRYPTION_REQUIRED: ::NTSTATUS = 0xC000015Du32 as i32; +pub const STATUS_DOMAIN_CTRLR_CONFIG_ERROR: ::NTSTATUS = 0xC000015Eu32 as i32; +pub const STATUS_FT_MISSING_MEMBER: ::NTSTATUS = 0xC000015Fu32 as i32; +pub const STATUS_ILL_FORMED_SERVICE_ENTRY: ::NTSTATUS = 0xC0000160u32 as i32; +pub const STATUS_ILLEGAL_CHARACTER: ::NTSTATUS = 0xC0000161u32 as i32; +pub const STATUS_UNMAPPABLE_CHARACTER: ::NTSTATUS = 0xC0000162u32 as i32; +pub const STATUS_UNDEFINED_CHARACTER: ::NTSTATUS = 0xC0000163u32 as i32; +pub const STATUS_FLOPPY_VOLUME: ::NTSTATUS = 0xC0000164u32 as i32; +pub const STATUS_FLOPPY_ID_MARK_NOT_FOUND: ::NTSTATUS = 0xC0000165u32 as i32; +pub const STATUS_FLOPPY_WRONG_CYLINDER: ::NTSTATUS = 0xC0000166u32 as i32; +pub const STATUS_FLOPPY_UNKNOWN_ERROR: ::NTSTATUS = 0xC0000167u32 as i32; +pub const STATUS_FLOPPY_BAD_REGISTERS: ::NTSTATUS = 0xC0000168u32 as i32; +pub const STATUS_DISK_RECALIBRATE_FAILED: ::NTSTATUS = 0xC0000169u32 as i32; +pub const STATUS_DISK_OPERATION_FAILED: ::NTSTATUS = 0xC000016Au32 as i32; +pub const STATUS_DISK_RESET_FAILED: ::NTSTATUS = 0xC000016Bu32 as i32; +pub const STATUS_SHARED_IRQ_BUSY: ::NTSTATUS = 0xC000016Cu32 as i32; +pub const STATUS_FT_ORPHANING: ::NTSTATUS = 0xC000016Du32 as i32; +pub const STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT: ::NTSTATUS = 0xC000016Eu32 as i32; +pub const STATUS_PARTITION_FAILURE: ::NTSTATUS = 0xC0000172u32 as i32; +pub const STATUS_INVALID_BLOCK_LENGTH: ::NTSTATUS = 0xC0000173u32 as i32; +pub const STATUS_DEVICE_NOT_PARTITIONED: ::NTSTATUS = 0xC0000174u32 as i32; +pub const STATUS_UNABLE_TO_LOCK_MEDIA: ::NTSTATUS = 0xC0000175u32 as i32; +pub const STATUS_UNABLE_TO_UNLOAD_MEDIA: ::NTSTATUS = 0xC0000176u32 as i32; +pub const STATUS_EOM_OVERFLOW: ::NTSTATUS = 0xC0000177u32 as i32; +pub const STATUS_NO_MEDIA: ::NTSTATUS = 0xC0000178u32 as i32; +pub const STATUS_NO_SUCH_MEMBER: ::NTSTATUS = 0xC000017Au32 as i32; +pub const STATUS_INVALID_MEMBER: ::NTSTATUS = 0xC000017Bu32 as i32; +pub const STATUS_KEY_DELETED: ::NTSTATUS = 0xC000017Cu32 as i32; +pub const STATUS_NO_LOG_SPACE: ::NTSTATUS = 0xC000017Du32 as i32; +pub const STATUS_TOO_MANY_SIDS: ::NTSTATUS = 0xC000017Eu32 as i32; +pub const STATUS_LM_CROSS_ENCRYPTION_REQUIRED: ::NTSTATUS = 0xC000017Fu32 as i32; +pub const STATUS_KEY_HAS_CHILDREN: ::NTSTATUS = 0xC0000180u32 as i32; +pub const STATUS_CHILD_MUST_BE_VOLATILE: ::NTSTATUS = 0xC0000181u32 as i32; +pub const STATUS_DEVICE_CONFIGURATION_ERROR: ::NTSTATUS = 0xC0000182u32 as i32; +pub const STATUS_DRIVER_INTERNAL_ERROR: ::NTSTATUS = 0xC0000183u32 as i32; +pub const STATUS_INVALID_DEVICE_STATE: ::NTSTATUS = 0xC0000184u32 as i32; +pub const STATUS_IO_DEVICE_ERROR: ::NTSTATUS = 0xC0000185u32 as i32; +pub const STATUS_DEVICE_PROTOCOL_ERROR: ::NTSTATUS = 0xC0000186u32 as i32; +pub const STATUS_BACKUP_CONTROLLER: ::NTSTATUS = 0xC0000187u32 as i32; +pub const STATUS_LOG_FILE_FULL: ::NTSTATUS = 0xC0000188u32 as i32; +pub const STATUS_TOO_LATE: ::NTSTATUS = 0xC0000189u32 as i32; +pub const STATUS_NO_TRUST_LSA_SECRET: ::NTSTATUS = 0xC000018Au32 as i32; +pub const STATUS_NO_TRUST_SAM_ACCOUNT: ::NTSTATUS = 0xC000018Bu32 as i32; +pub const STATUS_TRUSTED_DOMAIN_FAILURE: ::NTSTATUS = 0xC000018Cu32 as i32; +pub const STATUS_TRUSTED_RELATIONSHIP_FAILURE: ::NTSTATUS = 0xC000018Du32 as i32; +pub const STATUS_EVENTLOG_FILE_CORRUPT: ::NTSTATUS = 0xC000018Eu32 as i32; +pub const STATUS_EVENTLOG_CANT_START: ::NTSTATUS = 0xC000018Fu32 as i32; +pub const STATUS_TRUST_FAILURE: ::NTSTATUS = 0xC0000190u32 as i32; +pub const STATUS_MUTANT_LIMIT_EXCEEDED: ::NTSTATUS = 0xC0000191u32 as i32; +pub const STATUS_NETLOGON_NOT_STARTED: ::NTSTATUS = 0xC0000192u32 as i32; +pub const STATUS_ACCOUNT_EXPIRED: ::NTSTATUS = 0xC0000193u32 as i32; +pub const STATUS_POSSIBLE_DEADLOCK: ::NTSTATUS = 0xC0000194u32 as i32; +pub const STATUS_NETWORK_CREDENTIAL_CONFLICT: ::NTSTATUS = 0xC0000195u32 as i32; +pub const STATUS_REMOTE_SESSION_LIMIT: ::NTSTATUS = 0xC0000196u32 as i32; +pub const STATUS_EVENTLOG_FILE_CHANGED: ::NTSTATUS = 0xC0000197u32 as i32; +pub const STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: ::NTSTATUS = 0xC0000198u32 as i32; +pub const STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT: ::NTSTATUS = 0xC0000199u32 as i32; +pub const STATUS_NOLOGON_SERVER_TRUST_ACCOUNT: ::NTSTATUS = 0xC000019Au32 as i32; +pub const STATUS_DOMAIN_TRUST_INCONSISTENT: ::NTSTATUS = 0xC000019Bu32 as i32; +pub const STATUS_FS_DRIVER_REQUIRED: ::NTSTATUS = 0xC000019Cu32 as i32; +pub const STATUS_IMAGE_ALREADY_LOADED_AS_DLL: ::NTSTATUS = 0xC000019Du32 as i32; +pub const STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: ::NTSTATUS = 0xC000019Eu32 as i32; +pub const STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: ::NTSTATUS = 0xC000019Fu32 as i32; +pub const STATUS_SECURITY_STREAM_IS_INCONSISTENT: ::NTSTATUS = 0xC00001A0u32 as i32; +pub const STATUS_INVALID_LOCK_RANGE: ::NTSTATUS = 0xC00001A1u32 as i32; +pub const STATUS_INVALID_ACE_CONDITION: ::NTSTATUS = 0xC00001A2u32 as i32; +pub const STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT: ::NTSTATUS = 0xC00001A3u32 as i32; +pub const STATUS_NOTIFICATION_GUID_ALREADY_DEFINED: ::NTSTATUS = 0xC00001A4u32 as i32; +pub const STATUS_INVALID_EXCEPTION_HANDLER: ::NTSTATUS = 0xC00001A5u32 as i32; +pub const STATUS_DUPLICATE_PRIVILEGES: ::NTSTATUS = 0xC00001A6u32 as i32; +pub const STATUS_NOT_ALLOWED_ON_SYSTEM_FILE: ::NTSTATUS = 0xC00001A7u32 as i32; +pub const STATUS_REPAIR_NEEDED: ::NTSTATUS = 0xC00001A8u32 as i32; +pub const STATUS_QUOTA_NOT_ENABLED: ::NTSTATUS = 0xC00001A9u32 as i32; +pub const STATUS_NO_APPLICATION_PACKAGE: ::NTSTATUS = 0xC00001AAu32 as i32; +pub const STATUS_FILE_METADATA_OPTIMIZATION_IN_PROGRESS: ::NTSTATUS = 0xC00001ABu32 as i32; +pub const STATUS_NOT_SAME_OBJECT: ::NTSTATUS = 0xC00001ACu32 as i32; +pub const STATUS_FATAL_MEMORY_EXHAUSTION: ::NTSTATUS = 0xC00001ADu32 as i32; +pub const STATUS_ERROR_PROCESS_NOT_IN_JOB: ::NTSTATUS = 0xC00001AEu32 as i32; +pub const STATUS_NETWORK_OPEN_RESTRICTION: ::NTSTATUS = 0xC0000201u32 as i32; +pub const STATUS_NO_USER_SESSION_KEY: ::NTSTATUS = 0xC0000202u32 as i32; +pub const STATUS_USER_SESSION_DELETED: ::NTSTATUS = 0xC0000203u32 as i32; +pub const STATUS_RESOURCE_LANG_NOT_FOUND: ::NTSTATUS = 0xC0000204u32 as i32; +pub const STATUS_INSUFF_SERVER_RESOURCES: ::NTSTATUS = 0xC0000205u32 as i32; +pub const STATUS_INVALID_BUFFER_SIZE: ::NTSTATUS = 0xC0000206u32 as i32; +pub const STATUS_INVALID_ADDRESS_COMPONENT: ::NTSTATUS = 0xC0000207u32 as i32; +pub const STATUS_INVALID_ADDRESS_WILDCARD: ::NTSTATUS = 0xC0000208u32 as i32; +pub const STATUS_TOO_MANY_ADDRESSES: ::NTSTATUS = 0xC0000209u32 as i32; +pub const STATUS_ADDRESS_ALREADY_EXISTS: ::NTSTATUS = 0xC000020Au32 as i32; +pub const STATUS_ADDRESS_CLOSED: ::NTSTATUS = 0xC000020Bu32 as i32; +pub const STATUS_CONNECTION_DISCONNECTED: ::NTSTATUS = 0xC000020Cu32 as i32; +pub const STATUS_CONNECTION_RESET: ::NTSTATUS = 0xC000020Du32 as i32; +pub const STATUS_TOO_MANY_NODES: ::NTSTATUS = 0xC000020Eu32 as i32; +pub const STATUS_TRANSACTION_ABORTED: ::NTSTATUS = 0xC000020Fu32 as i32; +pub const STATUS_TRANSACTION_TIMED_OUT: ::NTSTATUS = 0xC0000210u32 as i32; +pub const STATUS_TRANSACTION_NO_RELEASE: ::NTSTATUS = 0xC0000211u32 as i32; +pub const STATUS_TRANSACTION_NO_MATCH: ::NTSTATUS = 0xC0000212u32 as i32; +pub const STATUS_TRANSACTION_RESPONDED: ::NTSTATUS = 0xC0000213u32 as i32; +pub const STATUS_TRANSACTION_INVALID_ID: ::NTSTATUS = 0xC0000214u32 as i32; +pub const STATUS_TRANSACTION_INVALID_TYPE: ::NTSTATUS = 0xC0000215u32 as i32; +pub const STATUS_NOT_SERVER_SESSION: ::NTSTATUS = 0xC0000216u32 as i32; +pub const STATUS_NOT_CLIENT_SESSION: ::NTSTATUS = 0xC0000217u32 as i32; +pub const STATUS_CANNOT_LOAD_REGISTRY_FILE: ::NTSTATUS = 0xC0000218u32 as i32; +pub const STATUS_DEBUG_ATTACH_FAILED: ::NTSTATUS = 0xC0000219u32 as i32; +pub const STATUS_SYSTEM_PROCESS_TERMINATED: ::NTSTATUS = 0xC000021Au32 as i32; +pub const STATUS_DATA_NOT_ACCEPTED: ::NTSTATUS = 0xC000021Bu32 as i32; +pub const STATUS_NO_BROWSER_SERVERS_FOUND: ::NTSTATUS = 0xC000021Cu32 as i32; +pub const STATUS_VDM_HARD_ERROR: ::NTSTATUS = 0xC000021Du32 as i32; +pub const STATUS_DRIVER_CANCEL_TIMEOUT: ::NTSTATUS = 0xC000021Eu32 as i32; +pub const STATUS_REPLY_MESSAGE_MISMATCH: ::NTSTATUS = 0xC000021Fu32 as i32; +pub const STATUS_MAPPED_ALIGNMENT: ::NTSTATUS = 0xC0000220u32 as i32; +pub const STATUS_IMAGE_CHECKSUM_MISMATCH: ::NTSTATUS = 0xC0000221u32 as i32; +pub const STATUS_LOST_WRITEBEHIND_DATA: ::NTSTATUS = 0xC0000222u32 as i32; +pub const STATUS_CLIENT_SERVER_PARAMETERS_INVALID: ::NTSTATUS = 0xC0000223u32 as i32; +pub const STATUS_PASSWORD_MUST_CHANGE: ::NTSTATUS = 0xC0000224u32 as i32; +pub const STATUS_NOT_FOUND: ::NTSTATUS = 0xC0000225u32 as i32; +pub const STATUS_NOT_TINY_STREAM: ::NTSTATUS = 0xC0000226u32 as i32; +pub const STATUS_RECOVERY_FAILURE: ::NTSTATUS = 0xC0000227u32 as i32; +pub const STATUS_STACK_OVERFLOW_READ: ::NTSTATUS = 0xC0000228u32 as i32; +pub const STATUS_FAIL_CHECK: ::NTSTATUS = 0xC0000229u32 as i32; +pub const STATUS_DUPLICATE_OBJECTID: ::NTSTATUS = 0xC000022Au32 as i32; +pub const STATUS_OBJECTID_EXISTS: ::NTSTATUS = 0xC000022Bu32 as i32; +pub const STATUS_CONVERT_TO_LARGE: ::NTSTATUS = 0xC000022Cu32 as i32; +pub const STATUS_RETRY: ::NTSTATUS = 0xC000022Du32 as i32; +pub const STATUS_FOUND_OUT_OF_SCOPE: ::NTSTATUS = 0xC000022Eu32 as i32; +pub const STATUS_ALLOCATE_BUCKET: ::NTSTATUS = 0xC000022Fu32 as i32; +pub const STATUS_PROPSET_NOT_FOUND: ::NTSTATUS = 0xC0000230u32 as i32; +pub const STATUS_MARSHALL_OVERFLOW: ::NTSTATUS = 0xC0000231u32 as i32; +pub const STATUS_INVALID_VARIANT: ::NTSTATUS = 0xC0000232u32 as i32; +pub const STATUS_DOMAIN_CONTROLLER_NOT_FOUND: ::NTSTATUS = 0xC0000233u32 as i32; +pub const STATUS_ACCOUNT_LOCKED_OUT: ::NTSTATUS = 0xC0000234u32 as i32; +pub const STATUS_HANDLE_NOT_CLOSABLE: ::NTSTATUS = 0xC0000235u32 as i32; +pub const STATUS_CONNECTION_REFUSED: ::NTSTATUS = 0xC0000236u32 as i32; +pub const STATUS_GRACEFUL_DISCONNECT: ::NTSTATUS = 0xC0000237u32 as i32; +pub const STATUS_ADDRESS_ALREADY_ASSOCIATED: ::NTSTATUS = 0xC0000238u32 as i32; +pub const STATUS_ADDRESS_NOT_ASSOCIATED: ::NTSTATUS = 0xC0000239u32 as i32; +pub const STATUS_CONNECTION_INVALID: ::NTSTATUS = 0xC000023Au32 as i32; +pub const STATUS_CONNECTION_ACTIVE: ::NTSTATUS = 0xC000023Bu32 as i32; +pub const STATUS_NETWORK_UNREACHABLE: ::NTSTATUS = 0xC000023Cu32 as i32; +pub const STATUS_HOST_UNREACHABLE: ::NTSTATUS = 0xC000023Du32 as i32; +pub const STATUS_PROTOCOL_UNREACHABLE: ::NTSTATUS = 0xC000023Eu32 as i32; +pub const STATUS_PORT_UNREACHABLE: ::NTSTATUS = 0xC000023Fu32 as i32; +pub const STATUS_REQUEST_ABORTED: ::NTSTATUS = 0xC0000240u32 as i32; +pub const STATUS_CONNECTION_ABORTED: ::NTSTATUS = 0xC0000241u32 as i32; +pub const STATUS_BAD_COMPRESSION_BUFFER: ::NTSTATUS = 0xC0000242u32 as i32; +pub const STATUS_USER_MAPPED_FILE: ::NTSTATUS = 0xC0000243u32 as i32; +pub const STATUS_AUDIT_FAILED: ::NTSTATUS = 0xC0000244u32 as i32; +pub const STATUS_TIMER_RESOLUTION_NOT_SET: ::NTSTATUS = 0xC0000245u32 as i32; +pub const STATUS_CONNECTION_COUNT_LIMIT: ::NTSTATUS = 0xC0000246u32 as i32; +pub const STATUS_LOGIN_TIME_RESTRICTION: ::NTSTATUS = 0xC0000247u32 as i32; +pub const STATUS_LOGIN_WKSTA_RESTRICTION: ::NTSTATUS = 0xC0000248u32 as i32; +pub const STATUS_IMAGE_MP_UP_MISMATCH: ::NTSTATUS = 0xC0000249u32 as i32; +pub const STATUS_INSUFFICIENT_LOGON_INFO: ::NTSTATUS = 0xC0000250u32 as i32; +pub const STATUS_BAD_DLL_ENTRYPOINT: ::NTSTATUS = 0xC0000251u32 as i32; +pub const STATUS_BAD_SERVICE_ENTRYPOINT: ::NTSTATUS = 0xC0000252u32 as i32; +pub const STATUS_LPC_REPLY_LOST: ::NTSTATUS = 0xC0000253u32 as i32; +pub const STATUS_IP_ADDRESS_CONFLICT1: ::NTSTATUS = 0xC0000254u32 as i32; +pub const STATUS_IP_ADDRESS_CONFLICT2: ::NTSTATUS = 0xC0000255u32 as i32; +pub const STATUS_REGISTRY_QUOTA_LIMIT: ::NTSTATUS = 0xC0000256u32 as i32; +pub const STATUS_PATH_NOT_COVERED: ::NTSTATUS = 0xC0000257u32 as i32; +pub const STATUS_NO_CALLBACK_ACTIVE: ::NTSTATUS = 0xC0000258u32 as i32; +pub const STATUS_LICENSE_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000259u32 as i32; +pub const STATUS_PWD_TOO_SHORT: ::NTSTATUS = 0xC000025Au32 as i32; +pub const STATUS_PWD_TOO_RECENT: ::NTSTATUS = 0xC000025Bu32 as i32; +pub const STATUS_PWD_HISTORY_CONFLICT: ::NTSTATUS = 0xC000025Cu32 as i32; +pub const STATUS_PLUGPLAY_NO_DEVICE: ::NTSTATUS = 0xC000025Eu32 as i32; +pub const STATUS_UNSUPPORTED_COMPRESSION: ::NTSTATUS = 0xC000025Fu32 as i32; +pub const STATUS_INVALID_HW_PROFILE: ::NTSTATUS = 0xC0000260u32 as i32; +pub const STATUS_INVALID_PLUGPLAY_DEVICE_PATH: ::NTSTATUS = 0xC0000261u32 as i32; +pub const STATUS_DRIVER_ORDINAL_NOT_FOUND: ::NTSTATUS = 0xC0000262u32 as i32; +pub const STATUS_DRIVER_ENTRYPOINT_NOT_FOUND: ::NTSTATUS = 0xC0000263u32 as i32; +pub const STATUS_RESOURCE_NOT_OWNED: ::NTSTATUS = 0xC0000264u32 as i32; +pub const STATUS_TOO_MANY_LINKS: ::NTSTATUS = 0xC0000265u32 as i32; +pub const STATUS_QUOTA_LIST_INCONSISTENT: ::NTSTATUS = 0xC0000266u32 as i32; +pub const STATUS_FILE_IS_OFFLINE: ::NTSTATUS = 0xC0000267u32 as i32; +pub const STATUS_EVALUATION_EXPIRATION: ::NTSTATUS = 0xC0000268u32 as i32; +pub const STATUS_ILLEGAL_DLL_RELOCATION: ::NTSTATUS = 0xC0000269u32 as i32; +pub const STATUS_LICENSE_VIOLATION: ::NTSTATUS = 0xC000026Au32 as i32; +pub const STATUS_DLL_INIT_FAILED_LOGOFF: ::NTSTATUS = 0xC000026Bu32 as i32; +pub const STATUS_DRIVER_UNABLE_TO_LOAD: ::NTSTATUS = 0xC000026Cu32 as i32; +pub const STATUS_DFS_UNAVAILABLE: ::NTSTATUS = 0xC000026Du32 as i32; +pub const STATUS_VOLUME_DISMOUNTED: ::NTSTATUS = 0xC000026Eu32 as i32; +pub const STATUS_WX86_INTERNAL_ERROR: ::NTSTATUS = 0xC000026Fu32 as i32; +pub const STATUS_WX86_FLOAT_STACK_CHECK: ::NTSTATUS = 0xC0000270u32 as i32; +pub const STATUS_VALIDATE_CONTINUE: ::NTSTATUS = 0xC0000271u32 as i32; +pub const STATUS_NO_MATCH: ::NTSTATUS = 0xC0000272u32 as i32; +pub const STATUS_NO_MORE_MATCHES: ::NTSTATUS = 0xC0000273u32 as i32; +pub const STATUS_NOT_A_REPARSE_POINT: ::NTSTATUS = 0xC0000275u32 as i32; +pub const STATUS_IO_REPARSE_TAG_INVALID: ::NTSTATUS = 0xC0000276u32 as i32; +pub const STATUS_IO_REPARSE_TAG_MISMATCH: ::NTSTATUS = 0xC0000277u32 as i32; +pub const STATUS_IO_REPARSE_DATA_INVALID: ::NTSTATUS = 0xC0000278u32 as i32; +pub const STATUS_IO_REPARSE_TAG_NOT_HANDLED: ::NTSTATUS = 0xC0000279u32 as i32; +pub const STATUS_PWD_TOO_LONG: ::NTSTATUS = 0xC000027Au32 as i32; +pub const STATUS_STOWED_EXCEPTION: ::NTSTATUS = 0xC000027Bu32 as i32; +pub const STATUS_REPARSE_POINT_NOT_RESOLVED: ::NTSTATUS = 0xC0000280u32 as i32; +pub const STATUS_DIRECTORY_IS_A_REPARSE_POINT: ::NTSTATUS = 0xC0000281u32 as i32; +pub const STATUS_RANGE_LIST_CONFLICT: ::NTSTATUS = 0xC0000282u32 as i32; +pub const STATUS_SOURCE_ELEMENT_EMPTY: ::NTSTATUS = 0xC0000283u32 as i32; +pub const STATUS_DESTINATION_ELEMENT_FULL: ::NTSTATUS = 0xC0000284u32 as i32; +pub const STATUS_ILLEGAL_ELEMENT_ADDRESS: ::NTSTATUS = 0xC0000285u32 as i32; +pub const STATUS_MAGAZINE_NOT_PRESENT: ::NTSTATUS = 0xC0000286u32 as i32; +pub const STATUS_REINITIALIZATION_NEEDED: ::NTSTATUS = 0xC0000287u32 as i32; +pub const STATUS_DEVICE_REQUIRES_CLEANING: ::NTSTATUS = 0x80000288u32 as i32; +pub const STATUS_DEVICE_DOOR_OPEN: ::NTSTATUS = 0x80000289u32 as i32; +pub const STATUS_ENCRYPTION_FAILED: ::NTSTATUS = 0xC000028Au32 as i32; +pub const STATUS_DECRYPTION_FAILED: ::NTSTATUS = 0xC000028Bu32 as i32; +pub const STATUS_RANGE_NOT_FOUND: ::NTSTATUS = 0xC000028Cu32 as i32; +pub const STATUS_NO_RECOVERY_POLICY: ::NTSTATUS = 0xC000028Du32 as i32; +pub const STATUS_NO_EFS: ::NTSTATUS = 0xC000028Eu32 as i32; +pub const STATUS_WRONG_EFS: ::NTSTATUS = 0xC000028Fu32 as i32; +pub const STATUS_NO_USER_KEYS: ::NTSTATUS = 0xC0000290u32 as i32; +pub const STATUS_FILE_NOT_ENCRYPTED: ::NTSTATUS = 0xC0000291u32 as i32; +pub const STATUS_NOT_EXPORT_FORMAT: ::NTSTATUS = 0xC0000292u32 as i32; +pub const STATUS_FILE_ENCRYPTED: ::NTSTATUS = 0xC0000293u32 as i32; +pub const STATUS_WAKE_SYSTEM: ::NTSTATUS = 0x40000294; +pub const STATUS_WMI_GUID_NOT_FOUND: ::NTSTATUS = 0xC0000295u32 as i32; +pub const STATUS_WMI_INSTANCE_NOT_FOUND: ::NTSTATUS = 0xC0000296u32 as i32; +pub const STATUS_WMI_ITEMID_NOT_FOUND: ::NTSTATUS = 0xC0000297u32 as i32; +pub const STATUS_WMI_TRY_AGAIN: ::NTSTATUS = 0xC0000298u32 as i32; +pub const STATUS_SHARED_POLICY: ::NTSTATUS = 0xC0000299u32 as i32; +pub const STATUS_POLICY_OBJECT_NOT_FOUND: ::NTSTATUS = 0xC000029Au32 as i32; +pub const STATUS_POLICY_ONLY_IN_DS: ::NTSTATUS = 0xC000029Bu32 as i32; +pub const STATUS_VOLUME_NOT_UPGRADED: ::NTSTATUS = 0xC000029Cu32 as i32; +pub const STATUS_REMOTE_STORAGE_NOT_ACTIVE: ::NTSTATUS = 0xC000029Du32 as i32; +pub const STATUS_REMOTE_STORAGE_MEDIA_ERROR: ::NTSTATUS = 0xC000029Eu32 as i32; +pub const STATUS_NO_TRACKING_SERVICE: ::NTSTATUS = 0xC000029Fu32 as i32; +pub const STATUS_SERVER_SID_MISMATCH: ::NTSTATUS = 0xC00002A0u32 as i32; +pub const STATUS_DS_NO_ATTRIBUTE_OR_VALUE: ::NTSTATUS = 0xC00002A1u32 as i32; +pub const STATUS_DS_INVALID_ATTRIBUTE_SYNTAX: ::NTSTATUS = 0xC00002A2u32 as i32; +pub const STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED: ::NTSTATUS = 0xC00002A3u32 as i32; +pub const STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS: ::NTSTATUS = 0xC00002A4u32 as i32; +pub const STATUS_DS_BUSY: ::NTSTATUS = 0xC00002A5u32 as i32; +pub const STATUS_DS_UNAVAILABLE: ::NTSTATUS = 0xC00002A6u32 as i32; +pub const STATUS_DS_NO_RIDS_ALLOCATED: ::NTSTATUS = 0xC00002A7u32 as i32; +pub const STATUS_DS_NO_MORE_RIDS: ::NTSTATUS = 0xC00002A8u32 as i32; +pub const STATUS_DS_INCORRECT_ROLE_OWNER: ::NTSTATUS = 0xC00002A9u32 as i32; +pub const STATUS_DS_RIDMGR_INIT_ERROR: ::NTSTATUS = 0xC00002AAu32 as i32; +pub const STATUS_DS_OBJ_CLASS_VIOLATION: ::NTSTATUS = 0xC00002ABu32 as i32; +pub const STATUS_DS_CANT_ON_NON_LEAF: ::NTSTATUS = 0xC00002ACu32 as i32; +pub const STATUS_DS_CANT_ON_RDN: ::NTSTATUS = 0xC00002ADu32 as i32; +pub const STATUS_DS_CANT_MOD_OBJ_CLASS: ::NTSTATUS = 0xC00002AEu32 as i32; +pub const STATUS_DS_CROSS_DOM_MOVE_FAILED: ::NTSTATUS = 0xC00002AFu32 as i32; +pub const STATUS_DS_GC_NOT_AVAILABLE: ::NTSTATUS = 0xC00002B0u32 as i32; +pub const STATUS_DIRECTORY_SERVICE_REQUIRED: ::NTSTATUS = 0xC00002B1u32 as i32; +pub const STATUS_REPARSE_ATTRIBUTE_CONFLICT: ::NTSTATUS = 0xC00002B2u32 as i32; +pub const STATUS_CANT_ENABLE_DENY_ONLY: ::NTSTATUS = 0xC00002B3u32 as i32; +pub const STATUS_FLOAT_MULTIPLE_FAULTS: ::NTSTATUS = 0xC00002B4u32 as i32; +pub const STATUS_FLOAT_MULTIPLE_TRAPS: ::NTSTATUS = 0xC00002B5u32 as i32; +pub const STATUS_DEVICE_REMOVED: ::NTSTATUS = 0xC00002B6u32 as i32; +pub const STATUS_JOURNAL_DELETE_IN_PROGRESS: ::NTSTATUS = 0xC00002B7u32 as i32; +pub const STATUS_JOURNAL_NOT_ACTIVE: ::NTSTATUS = 0xC00002B8u32 as i32; +pub const STATUS_NOINTERFACE: ::NTSTATUS = 0xC00002B9u32 as i32; +pub const STATUS_DS_RIDMGR_DISABLED: ::NTSTATUS = 0xC00002BAu32 as i32; +pub const STATUS_DS_ADMIN_LIMIT_EXCEEDED: ::NTSTATUS = 0xC00002C1u32 as i32; +pub const STATUS_DRIVER_FAILED_SLEEP: ::NTSTATUS = 0xC00002C2u32 as i32; +pub const STATUS_MUTUAL_AUTHENTICATION_FAILED: ::NTSTATUS = 0xC00002C3u32 as i32; +pub const STATUS_CORRUPT_SYSTEM_FILE: ::NTSTATUS = 0xC00002C4u32 as i32; +pub const STATUS_DATATYPE_MISALIGNMENT_ERROR: ::NTSTATUS = 0xC00002C5u32 as i32; +pub const STATUS_WMI_READ_ONLY: ::NTSTATUS = 0xC00002C6u32 as i32; +pub const STATUS_WMI_SET_FAILURE: ::NTSTATUS = 0xC00002C7u32 as i32; +pub const STATUS_COMMITMENT_MINIMUM: ::NTSTATUS = 0xC00002C8u32 as i32; +pub const STATUS_REG_NAT_CONSUMPTION: ::NTSTATUS = 0xC00002C9u32 as i32; +pub const STATUS_TRANSPORT_FULL: ::NTSTATUS = 0xC00002CAu32 as i32; +pub const STATUS_DS_SAM_INIT_FAILURE: ::NTSTATUS = 0xC00002CBu32 as i32; +pub const STATUS_ONLY_IF_CONNECTED: ::NTSTATUS = 0xC00002CCu32 as i32; +pub const STATUS_DS_SENSITIVE_GROUP_VIOLATION: ::NTSTATUS = 0xC00002CDu32 as i32; +pub const STATUS_PNP_RESTART_ENUMERATION: ::NTSTATUS = 0xC00002CEu32 as i32; +pub const STATUS_JOURNAL_ENTRY_DELETED: ::NTSTATUS = 0xC00002CFu32 as i32; +pub const STATUS_DS_CANT_MOD_PRIMARYGROUPID: ::NTSTATUS = 0xC00002D0u32 as i32; +pub const STATUS_SYSTEM_IMAGE_BAD_SIGNATURE: ::NTSTATUS = 0xC00002D1u32 as i32; +pub const STATUS_PNP_REBOOT_REQUIRED: ::NTSTATUS = 0xC00002D2u32 as i32; +pub const STATUS_POWER_STATE_INVALID: ::NTSTATUS = 0xC00002D3u32 as i32; +pub const STATUS_DS_INVALID_GROUP_TYPE: ::NTSTATUS = 0xC00002D4u32 as i32; +pub const STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: ::NTSTATUS = 0xC00002D5u32 as i32; +pub const STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: ::NTSTATUS = 0xC00002D6u32 as i32; +pub const STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: ::NTSTATUS = 0xC00002D7u32 as i32; +pub const STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: ::NTSTATUS = 0xC00002D8u32 as i32; +pub const STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: ::NTSTATUS = 0xC00002D9u32 as i32; +pub const STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: ::NTSTATUS = 0xC00002DAu32 as i32; +pub const STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: ::NTSTATUS = 0xC00002DBu32 as i32; +pub const STATUS_DS_HAVE_PRIMARY_MEMBERS: ::NTSTATUS = 0xC00002DCu32 as i32; +pub const STATUS_WMI_NOT_SUPPORTED: ::NTSTATUS = 0xC00002DDu32 as i32; +pub const STATUS_INSUFFICIENT_POWER: ::NTSTATUS = 0xC00002DEu32 as i32; +pub const STATUS_SAM_NEED_BOOTKEY_PASSWORD: ::NTSTATUS = 0xC00002DFu32 as i32; +pub const STATUS_SAM_NEED_BOOTKEY_FLOPPY: ::NTSTATUS = 0xC00002E0u32 as i32; +pub const STATUS_DS_CANT_START: ::NTSTATUS = 0xC00002E1u32 as i32; +pub const STATUS_DS_INIT_FAILURE: ::NTSTATUS = 0xC00002E2u32 as i32; +pub const STATUS_SAM_INIT_FAILURE: ::NTSTATUS = 0xC00002E3u32 as i32; +pub const STATUS_DS_GC_REQUIRED: ::NTSTATUS = 0xC00002E4u32 as i32; +pub const STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: ::NTSTATUS = 0xC00002E5u32 as i32; +pub const STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS: ::NTSTATUS = 0xC00002E6u32 as i32; +pub const STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: ::NTSTATUS = 0xC00002E7u32 as i32; +pub const STATUS_MULTIPLE_FAULT_VIOLATION: ::NTSTATUS = 0xC00002E8u32 as i32; +pub const STATUS_CURRENT_DOMAIN_NOT_ALLOWED: ::NTSTATUS = 0xC00002E9u32 as i32; +pub const STATUS_CANNOT_MAKE: ::NTSTATUS = 0xC00002EAu32 as i32; +pub const STATUS_SYSTEM_SHUTDOWN: ::NTSTATUS = 0xC00002EBu32 as i32; +pub const STATUS_DS_INIT_FAILURE_CONSOLE: ::NTSTATUS = 0xC00002ECu32 as i32; +pub const STATUS_DS_SAM_INIT_FAILURE_CONSOLE: ::NTSTATUS = 0xC00002EDu32 as i32; +pub const STATUS_UNFINISHED_CONTEXT_DELETED: ::NTSTATUS = 0xC00002EEu32 as i32; +pub const STATUS_NO_TGT_REPLY: ::NTSTATUS = 0xC00002EFu32 as i32; +pub const STATUS_OBJECTID_NOT_FOUND: ::NTSTATUS = 0xC00002F0u32 as i32; +pub const STATUS_NO_IP_ADDRESSES: ::NTSTATUS = 0xC00002F1u32 as i32; +pub const STATUS_WRONG_CREDENTIAL_HANDLE: ::NTSTATUS = 0xC00002F2u32 as i32; +pub const STATUS_CRYPTO_SYSTEM_INVALID: ::NTSTATUS = 0xC00002F3u32 as i32; +pub const STATUS_MAX_REFERRALS_EXCEEDED: ::NTSTATUS = 0xC00002F4u32 as i32; +pub const STATUS_MUST_BE_KDC: ::NTSTATUS = 0xC00002F5u32 as i32; +pub const STATUS_STRONG_CRYPTO_NOT_SUPPORTED: ::NTSTATUS = 0xC00002F6u32 as i32; +pub const STATUS_TOO_MANY_PRINCIPALS: ::NTSTATUS = 0xC00002F7u32 as i32; +pub const STATUS_NO_PA_DATA: ::NTSTATUS = 0xC00002F8u32 as i32; +pub const STATUS_PKINIT_NAME_MISMATCH: ::NTSTATUS = 0xC00002F9u32 as i32; +pub const STATUS_SMARTCARD_LOGON_REQUIRED: ::NTSTATUS = 0xC00002FAu32 as i32; +pub const STATUS_KDC_INVALID_REQUEST: ::NTSTATUS = 0xC00002FBu32 as i32; +pub const STATUS_KDC_UNABLE_TO_REFER: ::NTSTATUS = 0xC00002FCu32 as i32; +pub const STATUS_KDC_UNKNOWN_ETYPE: ::NTSTATUS = 0xC00002FDu32 as i32; +pub const STATUS_SHUTDOWN_IN_PROGRESS: ::NTSTATUS = 0xC00002FEu32 as i32; +pub const STATUS_SERVER_SHUTDOWN_IN_PROGRESS: ::NTSTATUS = 0xC00002FFu32 as i32; +pub const STATUS_NOT_SUPPORTED_ON_SBS: ::NTSTATUS = 0xC0000300u32 as i32; +pub const STATUS_WMI_GUID_DISCONNECTED: ::NTSTATUS = 0xC0000301u32 as i32; +pub const STATUS_WMI_ALREADY_DISABLED: ::NTSTATUS = 0xC0000302u32 as i32; +pub const STATUS_WMI_ALREADY_ENABLED: ::NTSTATUS = 0xC0000303u32 as i32; +pub const STATUS_MFT_TOO_FRAGMENTED: ::NTSTATUS = 0xC0000304u32 as i32; +pub const STATUS_COPY_PROTECTION_FAILURE: ::NTSTATUS = 0xC0000305u32 as i32; +pub const STATUS_CSS_AUTHENTICATION_FAILURE: ::NTSTATUS = 0xC0000306u32 as i32; +pub const STATUS_CSS_KEY_NOT_PRESENT: ::NTSTATUS = 0xC0000307u32 as i32; +pub const STATUS_CSS_KEY_NOT_ESTABLISHED: ::NTSTATUS = 0xC0000308u32 as i32; +pub const STATUS_CSS_SCRAMBLED_SECTOR: ::NTSTATUS = 0xC0000309u32 as i32; +pub const STATUS_CSS_REGION_MISMATCH: ::NTSTATUS = 0xC000030Au32 as i32; +pub const STATUS_CSS_RESETS_EXHAUSTED: ::NTSTATUS = 0xC000030Bu32 as i32; +pub const STATUS_PASSWORD_CHANGE_REQUIRED: ::NTSTATUS = 0xC000030Cu32 as i32; +pub const STATUS_PKINIT_FAILURE: ::NTSTATUS = 0xC0000320u32 as i32; +pub const STATUS_SMARTCARD_SUBSYSTEM_FAILURE: ::NTSTATUS = 0xC0000321u32 as i32; +pub const STATUS_NO_KERB_KEY: ::NTSTATUS = 0xC0000322u32 as i32; +pub const STATUS_HOST_DOWN: ::NTSTATUS = 0xC0000350u32 as i32; +pub const STATUS_UNSUPPORTED_PREAUTH: ::NTSTATUS = 0xC0000351u32 as i32; +pub const STATUS_EFS_ALG_BLOB_TOO_BIG: ::NTSTATUS = 0xC0000352u32 as i32; +pub const STATUS_PORT_NOT_SET: ::NTSTATUS = 0xC0000353u32 as i32; +pub const STATUS_DEBUGGER_INACTIVE: ::NTSTATUS = 0xC0000354u32 as i32; +pub const STATUS_DS_VERSION_CHECK_FAILURE: ::NTSTATUS = 0xC0000355u32 as i32; +pub const STATUS_AUDITING_DISABLED: ::NTSTATUS = 0xC0000356u32 as i32; +pub const STATUS_PRENT4_MACHINE_ACCOUNT: ::NTSTATUS = 0xC0000357u32 as i32; +pub const STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: ::NTSTATUS = 0xC0000358u32 as i32; +pub const STATUS_INVALID_IMAGE_WIN_32: ::NTSTATUS = 0xC0000359u32 as i32; +pub const STATUS_INVALID_IMAGE_WIN_64: ::NTSTATUS = 0xC000035Au32 as i32; +pub const STATUS_BAD_BINDINGS: ::NTSTATUS = 0xC000035Bu32 as i32; +pub const STATUS_NETWORK_SESSION_EXPIRED: ::NTSTATUS = 0xC000035Cu32 as i32; +pub const STATUS_APPHELP_BLOCK: ::NTSTATUS = 0xC000035Du32 as i32; +pub const STATUS_ALL_SIDS_FILTERED: ::NTSTATUS = 0xC000035Eu32 as i32; +pub const STATUS_NOT_SAFE_MODE_DRIVER: ::NTSTATUS = 0xC000035Fu32 as i32; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT: ::NTSTATUS = 0xC0000361u32 as i32; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_PATH: ::NTSTATUS = 0xC0000362u32 as i32; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER: ::NTSTATUS = 0xC0000363u32 as i32; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_OTHER: ::NTSTATUS = 0xC0000364u32 as i32; +pub const STATUS_FAILED_DRIVER_ENTRY: ::NTSTATUS = 0xC0000365u32 as i32; +pub const STATUS_DEVICE_ENUMERATION_ERROR: ::NTSTATUS = 0xC0000366u32 as i32; +pub const STATUS_MOUNT_POINT_NOT_RESOLVED: ::NTSTATUS = 0xC0000368u32 as i32; +pub const STATUS_INVALID_DEVICE_OBJECT_PARAMETER: ::NTSTATUS = 0xC0000369u32 as i32; +pub const STATUS_MCA_OCCURED: ::NTSTATUS = 0xC000036Au32 as i32; +pub const STATUS_DRIVER_BLOCKED_CRITICAL: ::NTSTATUS = 0xC000036Bu32 as i32; +pub const STATUS_DRIVER_BLOCKED: ::NTSTATUS = 0xC000036Cu32 as i32; +pub const STATUS_DRIVER_DATABASE_ERROR: ::NTSTATUS = 0xC000036Du32 as i32; +pub const STATUS_SYSTEM_HIVE_TOO_LARGE: ::NTSTATUS = 0xC000036Eu32 as i32; +pub const STATUS_INVALID_IMPORT_OF_NON_DLL: ::NTSTATUS = 0xC000036Fu32 as i32; +pub const STATUS_DS_SHUTTING_DOWN: ::NTSTATUS = 0x40000370; +pub const STATUS_NO_SECRETS: ::NTSTATUS = 0xC0000371u32 as i32; +pub const STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: ::NTSTATUS = 0xC0000372u32 as i32; +pub const STATUS_FAILED_STACK_SWITCH: ::NTSTATUS = 0xC0000373u32 as i32; +pub const STATUS_HEAP_CORRUPTION: ::NTSTATUS = 0xC0000374u32 as i32; +pub const STATUS_SMARTCARD_WRONG_PIN: ::NTSTATUS = 0xC0000380u32 as i32; +pub const STATUS_SMARTCARD_CARD_BLOCKED: ::NTSTATUS = 0xC0000381u32 as i32; +pub const STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED: ::NTSTATUS = 0xC0000382u32 as i32; +pub const STATUS_SMARTCARD_NO_CARD: ::NTSTATUS = 0xC0000383u32 as i32; +pub const STATUS_SMARTCARD_NO_KEY_CONTAINER: ::NTSTATUS = 0xC0000384u32 as i32; +pub const STATUS_SMARTCARD_NO_CERTIFICATE: ::NTSTATUS = 0xC0000385u32 as i32; +pub const STATUS_SMARTCARD_NO_KEYSET: ::NTSTATUS = 0xC0000386u32 as i32; +pub const STATUS_SMARTCARD_IO_ERROR: ::NTSTATUS = 0xC0000387u32 as i32; +pub const STATUS_DOWNGRADE_DETECTED: ::NTSTATUS = 0xC0000388u32 as i32; +pub const STATUS_SMARTCARD_CERT_REVOKED: ::NTSTATUS = 0xC0000389u32 as i32; +pub const STATUS_ISSUING_CA_UNTRUSTED: ::NTSTATUS = 0xC000038Au32 as i32; +pub const STATUS_REVOCATION_OFFLINE_C: ::NTSTATUS = 0xC000038Bu32 as i32; +pub const STATUS_PKINIT_CLIENT_FAILURE: ::NTSTATUS = 0xC000038Cu32 as i32; +pub const STATUS_SMARTCARD_CERT_EXPIRED: ::NTSTATUS = 0xC000038Du32 as i32; +pub const STATUS_DRIVER_FAILED_PRIOR_UNLOAD: ::NTSTATUS = 0xC000038Eu32 as i32; +pub const STATUS_SMARTCARD_SILENT_CONTEXT: ::NTSTATUS = 0xC000038Fu32 as i32; +pub const STATUS_PER_USER_TRUST_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000401u32 as i32; +pub const STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000402u32 as i32; +pub const STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000403u32 as i32; +pub const STATUS_DS_NAME_NOT_UNIQUE: ::NTSTATUS = 0xC0000404u32 as i32; +pub const STATUS_DS_DUPLICATE_ID_FOUND: ::NTSTATUS = 0xC0000405u32 as i32; +pub const STATUS_DS_GROUP_CONVERSION_ERROR: ::NTSTATUS = 0xC0000406u32 as i32; +pub const STATUS_VOLSNAP_PREPARE_HIBERNATE: ::NTSTATUS = 0xC0000407u32 as i32; +pub const STATUS_USER2USER_REQUIRED: ::NTSTATUS = 0xC0000408u32 as i32; +pub const STATUS_STACK_BUFFER_OVERRUN: ::NTSTATUS = 0xC0000409u32 as i32; +pub const STATUS_NO_S4U_PROT_SUPPORT: ::NTSTATUS = 0xC000040Au32 as i32; +pub const STATUS_CROSSREALM_DELEGATION_FAILURE: ::NTSTATUS = 0xC000040Bu32 as i32; +pub const STATUS_REVOCATION_OFFLINE_KDC: ::NTSTATUS = 0xC000040Cu32 as i32; +pub const STATUS_ISSUING_CA_UNTRUSTED_KDC: ::NTSTATUS = 0xC000040Du32 as i32; +pub const STATUS_KDC_CERT_EXPIRED: ::NTSTATUS = 0xC000040Eu32 as i32; +pub const STATUS_KDC_CERT_REVOKED: ::NTSTATUS = 0xC000040Fu32 as i32; +pub const STATUS_PARAMETER_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000410u32 as i32; +pub const STATUS_HIBERNATION_FAILURE: ::NTSTATUS = 0xC0000411u32 as i32; +pub const STATUS_DELAY_LOAD_FAILED: ::NTSTATUS = 0xC0000412u32 as i32; +pub const STATUS_AUTHENTICATION_FIREWALL_FAILED: ::NTSTATUS = 0xC0000413u32 as i32; +pub const STATUS_VDM_DISALLOWED: ::NTSTATUS = 0xC0000414u32 as i32; +pub const STATUS_HUNG_DISPLAY_DRIVER_THREAD: ::NTSTATUS = 0xC0000415u32 as i32; +pub const STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: ::NTSTATUS = 0xC0000416u32 as i32; +pub const STATUS_INVALID_CRUNTIME_PARAMETER: ::NTSTATUS = 0xC0000417u32 as i32; +pub const STATUS_NTLM_BLOCKED: ::NTSTATUS = 0xC0000418u32 as i32; +pub const STATUS_DS_SRC_SID_EXISTS_IN_FOREST: ::NTSTATUS = 0xC0000419u32 as i32; +pub const STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST: ::NTSTATUS = 0xC000041Au32 as i32; +pub const STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST: ::NTSTATUS = 0xC000041Bu32 as i32; +pub const STATUS_INVALID_USER_PRINCIPAL_NAME: ::NTSTATUS = 0xC000041Cu32 as i32; +pub const STATUS_FATAL_USER_CALLBACK_EXCEPTION: ::NTSTATUS = 0xC000041Du32 as i32; +pub const STATUS_ASSERTION_FAILURE: ::NTSTATUS = 0xC0000420u32 as i32; +pub const STATUS_VERIFIER_STOP: ::NTSTATUS = 0xC0000421u32 as i32; +pub const STATUS_CALLBACK_POP_STACK: ::NTSTATUS = 0xC0000423u32 as i32; +pub const STATUS_INCOMPATIBLE_DRIVER_BLOCKED: ::NTSTATUS = 0xC0000424u32 as i32; +pub const STATUS_HIVE_UNLOADED: ::NTSTATUS = 0xC0000425u32 as i32; +pub const STATUS_COMPRESSION_DISABLED: ::NTSTATUS = 0xC0000426u32 as i32; +pub const STATUS_FILE_SYSTEM_LIMITATION: ::NTSTATUS = 0xC0000427u32 as i32; +pub const STATUS_INVALID_IMAGE_HASH: ::NTSTATUS = 0xC0000428u32 as i32; +pub const STATUS_NOT_CAPABLE: ::NTSTATUS = 0xC0000429u32 as i32; +pub const STATUS_REQUEST_OUT_OF_SEQUENCE: ::NTSTATUS = 0xC000042Au32 as i32; +pub const STATUS_IMPLEMENTATION_LIMIT: ::NTSTATUS = 0xC000042Bu32 as i32; +pub const STATUS_ELEVATION_REQUIRED: ::NTSTATUS = 0xC000042Cu32 as i32; +pub const STATUS_NO_SECURITY_CONTEXT: ::NTSTATUS = 0xC000042Du32 as i32; +pub const STATUS_PKU2U_CERT_FAILURE: ::NTSTATUS = 0xC000042Fu32 as i32; +pub const STATUS_BEYOND_VDL: ::NTSTATUS = 0xC0000432u32 as i32; +pub const STATUS_ENCOUNTERED_WRITE_IN_PROGRESS: ::NTSTATUS = 0xC0000433u32 as i32; +pub const STATUS_PTE_CHANGED: ::NTSTATUS = 0xC0000434u32 as i32; +pub const STATUS_PURGE_FAILED: ::NTSTATUS = 0xC0000435u32 as i32; +pub const STATUS_CRED_REQUIRES_CONFIRMATION: ::NTSTATUS = 0xC0000440u32 as i32; +pub const STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: ::NTSTATUS = 0xC0000441u32 as i32; +pub const STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER: ::NTSTATUS = 0xC0000442u32 as i32; +pub const STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: ::NTSTATUS = 0xC0000443u32 as i32; +pub const STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: ::NTSTATUS = 0xC0000444u32 as i32; +pub const STATUS_CS_ENCRYPTION_FILE_NOT_CSE: ::NTSTATUS = 0xC0000445u32 as i32; +pub const STATUS_INVALID_LABEL: ::NTSTATUS = 0xC0000446u32 as i32; +pub const STATUS_DRIVER_PROCESS_TERMINATED: ::NTSTATUS = 0xC0000450u32 as i32; +pub const STATUS_AMBIGUOUS_SYSTEM_DEVICE: ::NTSTATUS = 0xC0000451u32 as i32; +pub const STATUS_SYSTEM_DEVICE_NOT_FOUND: ::NTSTATUS = 0xC0000452u32 as i32; +pub const STATUS_RESTART_BOOT_APPLICATION: ::NTSTATUS = 0xC0000453u32 as i32; +pub const STATUS_INSUFFICIENT_NVRAM_RESOURCES: ::NTSTATUS = 0xC0000454u32 as i32; +pub const STATUS_INVALID_SESSION: ::NTSTATUS = 0xC0000455u32 as i32; +pub const STATUS_THREAD_ALREADY_IN_SESSION: ::NTSTATUS = 0xC0000456u32 as i32; +pub const STATUS_THREAD_NOT_IN_SESSION: ::NTSTATUS = 0xC0000457u32 as i32; +pub const STATUS_INVALID_WEIGHT: ::NTSTATUS = 0xC0000458u32 as i32; +pub const STATUS_REQUEST_PAUSED: ::NTSTATUS = 0xC0000459u32 as i32; +pub const STATUS_NO_RANGES_PROCESSED: ::NTSTATUS = 0xC0000460u32 as i32; +pub const STATUS_DISK_RESOURCES_EXHAUSTED: ::NTSTATUS = 0xC0000461u32 as i32; +pub const STATUS_NEEDS_REMEDIATION: ::NTSTATUS = 0xC0000462u32 as i32; +pub const STATUS_DEVICE_FEATURE_NOT_SUPPORTED: ::NTSTATUS = 0xC0000463u32 as i32; +pub const STATUS_DEVICE_UNREACHABLE: ::NTSTATUS = 0xC0000464u32 as i32; +pub const STATUS_INVALID_TOKEN: ::NTSTATUS = 0xC0000465u32 as i32; +pub const STATUS_SERVER_UNAVAILABLE: ::NTSTATUS = 0xC0000466u32 as i32; +pub const STATUS_FILE_NOT_AVAILABLE: ::NTSTATUS = 0xC0000467u32 as i32; +pub const STATUS_DEVICE_INSUFFICIENT_RESOURCES: ::NTSTATUS = 0xC0000468u32 as i32; +pub const STATUS_PACKAGE_UPDATING: ::NTSTATUS = 0xC0000469u32 as i32; +pub const STATUS_NOT_READ_FROM_COPY: ::NTSTATUS = 0xC000046Au32 as i32; +pub const STATUS_FT_WRITE_FAILURE: ::NTSTATUS = 0xC000046Bu32 as i32; +pub const STATUS_FT_DI_SCAN_REQUIRED: ::NTSTATUS = 0xC000046Cu32 as i32; +pub const STATUS_OBJECT_NOT_EXTERNALLY_BACKED: ::NTSTATUS = 0xC000046Du32 as i32; +pub const STATUS_EXTERNAL_BACKING_PROVIDER_UNKNOWN: ::NTSTATUS = 0xC000046Eu32 as i32; +pub const STATUS_COMPRESSION_NOT_BENEFICIAL: ::NTSTATUS = 0xC000046Fu32 as i32; +pub const STATUS_DATA_CHECKSUM_ERROR: ::NTSTATUS = 0xC0000470u32 as i32; +pub const STATUS_INTERMIXED_KERNEL_EA_OPERATION: ::NTSTATUS = 0xC0000471u32 as i32; +pub const STATUS_TRIM_READ_ZERO_NOT_SUPPORTED: ::NTSTATUS = 0xC0000472u32 as i32; +pub const STATUS_TOO_MANY_SEGMENT_DESCRIPTORS: ::NTSTATUS = 0xC0000473u32 as i32; +pub const STATUS_INVALID_OFFSET_ALIGNMENT: ::NTSTATUS = 0xC0000474u32 as i32; +pub const STATUS_INVALID_FIELD_IN_PARAMETER_LIST: ::NTSTATUS = 0xC0000475u32 as i32; +pub const STATUS_OPERATION_IN_PROGRESS: ::NTSTATUS = 0xC0000476u32 as i32; +pub const STATUS_INVALID_INITIATOR_TARGET_PATH: ::NTSTATUS = 0xC0000477u32 as i32; +pub const STATUS_SCRUB_DATA_DISABLED: ::NTSTATUS = 0xC0000478u32 as i32; +pub const STATUS_NOT_REDUNDANT_STORAGE: ::NTSTATUS = 0xC0000479u32 as i32; +pub const STATUS_RESIDENT_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000047Au32 as i32; +pub const STATUS_COMPRESSED_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000047Bu32 as i32; +pub const STATUS_DIRECTORY_NOT_SUPPORTED: ::NTSTATUS = 0xC000047Cu32 as i32; +pub const STATUS_IO_OPERATION_TIMEOUT: ::NTSTATUS = 0xC000047Du32 as i32; +pub const STATUS_SYSTEM_NEEDS_REMEDIATION: ::NTSTATUS = 0xC000047Eu32 as i32; +pub const STATUS_APPX_INTEGRITY_FAILURE_CLR_NGEN: ::NTSTATUS = 0xC000047Fu32 as i32; +pub const STATUS_SHARE_UNAVAILABLE: ::NTSTATUS = 0xC0000480u32 as i32; +pub const STATUS_APISET_NOT_HOSTED: ::NTSTATUS = 0xC0000481u32 as i32; +pub const STATUS_APISET_NOT_PRESENT: ::NTSTATUS = 0xC0000482u32 as i32; +pub const STATUS_DEVICE_HARDWARE_ERROR: ::NTSTATUS = 0xC0000483u32 as i32; +pub const STATUS_FIRMWARE_SLOT_INVALID: ::NTSTATUS = 0xC0000484u32 as i32; +pub const STATUS_FIRMWARE_IMAGE_INVALID: ::NTSTATUS = 0xC0000485u32 as i32; +pub const STATUS_STORAGE_TOPOLOGY_ID_MISMATCH: ::NTSTATUS = 0xC0000486u32 as i32; +pub const STATUS_WIM_NOT_BOOTABLE: ::NTSTATUS = 0xC0000487u32 as i32; +pub const STATUS_BLOCKED_BY_PARENTAL_CONTROLS: ::NTSTATUS = 0xC0000488u32 as i32; +pub const STATUS_NEEDS_REGISTRATION: ::NTSTATUS = 0xC0000489u32 as i32; +pub const STATUS_QUOTA_ACTIVITY: ::NTSTATUS = 0xC000048Au32 as i32; +pub const STATUS_INVALID_TASK_NAME: ::NTSTATUS = 0xC0000500u32 as i32; +pub const STATUS_INVALID_TASK_INDEX: ::NTSTATUS = 0xC0000501u32 as i32; +pub const STATUS_THREAD_ALREADY_IN_TASK: ::NTSTATUS = 0xC0000502u32 as i32; +pub const STATUS_CALLBACK_BYPASS: ::NTSTATUS = 0xC0000503u32 as i32; +pub const STATUS_UNDEFINED_SCOPE: ::NTSTATUS = 0xC0000504u32 as i32; +pub const STATUS_INVALID_CAP: ::NTSTATUS = 0xC0000505u32 as i32; +pub const STATUS_NOT_GUI_PROCESS: ::NTSTATUS = 0xC0000506u32 as i32; +pub const STATUS_DEVICE_HUNG: ::NTSTATUS = 0xC0000507u32 as i32; +pub const STATUS_FAIL_FAST_EXCEPTION: ::NTSTATUS = 0xC0000602u32 as i32; +pub const STATUS_IMAGE_CERT_REVOKED: ::NTSTATUS = 0xC0000603u32 as i32; +pub const STATUS_DYNAMIC_CODE_BLOCKED: ::NTSTATUS = 0xC0000604u32 as i32; +pub const STATUS_IMAGE_CERT_EXPIRED: ::NTSTATUS = 0xC0000605u32 as i32; +pub const STATUS_PORT_CLOSED: ::NTSTATUS = 0xC0000700u32 as i32; +pub const STATUS_MESSAGE_LOST: ::NTSTATUS = 0xC0000701u32 as i32; +pub const STATUS_INVALID_MESSAGE: ::NTSTATUS = 0xC0000702u32 as i32; +pub const STATUS_REQUEST_CANCELED: ::NTSTATUS = 0xC0000703u32 as i32; +pub const STATUS_RECURSIVE_DISPATCH: ::NTSTATUS = 0xC0000704u32 as i32; +pub const STATUS_LPC_RECEIVE_BUFFER_EXPECTED: ::NTSTATUS = 0xC0000705u32 as i32; +pub const STATUS_LPC_INVALID_CONNECTION_USAGE: ::NTSTATUS = 0xC0000706u32 as i32; +pub const STATUS_LPC_REQUESTS_NOT_ALLOWED: ::NTSTATUS = 0xC0000707u32 as i32; +pub const STATUS_RESOURCE_IN_USE: ::NTSTATUS = 0xC0000708u32 as i32; +pub const STATUS_HARDWARE_MEMORY_ERROR: ::NTSTATUS = 0xC0000709u32 as i32; +pub const STATUS_THREADPOOL_HANDLE_EXCEPTION: ::NTSTATUS = 0xC000070Au32 as i32; +pub const STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Bu32 as i32; +pub const STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Cu32 as i32; +pub const STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Du32 as i32; +pub const STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Eu32 as i32; +pub const STATUS_THREADPOOL_RELEASED_DURING_OPERATION: ::NTSTATUS = 0xC000070Fu32 as i32; +pub const STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING: ::NTSTATUS = 0xC0000710u32 as i32; +pub const STATUS_APC_RETURNED_WHILE_IMPERSONATING: ::NTSTATUS = 0xC0000711u32 as i32; +pub const STATUS_PROCESS_IS_PROTECTED: ::NTSTATUS = 0xC0000712u32 as i32; +pub const STATUS_MCA_EXCEPTION: ::NTSTATUS = 0xC0000713u32 as i32; +pub const STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE: ::NTSTATUS = 0xC0000714u32 as i32; +pub const STATUS_SYMLINK_CLASS_DISABLED: ::NTSTATUS = 0xC0000715u32 as i32; +pub const STATUS_INVALID_IDN_NORMALIZATION: ::NTSTATUS = 0xC0000716u32 as i32; +pub const STATUS_NO_UNICODE_TRANSLATION: ::NTSTATUS = 0xC0000717u32 as i32; +pub const STATUS_ALREADY_REGISTERED: ::NTSTATUS = 0xC0000718u32 as i32; +pub const STATUS_CONTEXT_MISMATCH: ::NTSTATUS = 0xC0000719u32 as i32; +pub const STATUS_PORT_ALREADY_HAS_COMPLETION_LIST: ::NTSTATUS = 0xC000071Au32 as i32; +pub const STATUS_CALLBACK_RETURNED_THREAD_PRIORITY: ::NTSTATUS = 0xC000071Bu32 as i32; +pub const STATUS_INVALID_THREAD: ::NTSTATUS = 0xC000071Cu32 as i32; +pub const STATUS_CALLBACK_RETURNED_TRANSACTION: ::NTSTATUS = 0xC000071Du32 as i32; +pub const STATUS_CALLBACK_RETURNED_LDR_LOCK: ::NTSTATUS = 0xC000071Eu32 as i32; +pub const STATUS_CALLBACK_RETURNED_LANG: ::NTSTATUS = 0xC000071Fu32 as i32; +pub const STATUS_CALLBACK_RETURNED_PRI_BACK: ::NTSTATUS = 0xC0000720u32 as i32; +pub const STATUS_CALLBACK_RETURNED_THREAD_AFFINITY: ::NTSTATUS = 0xC0000721u32 as i32; +pub const STATUS_DISK_REPAIR_DISABLED: ::NTSTATUS = 0xC0000800u32 as i32; +pub const STATUS_DS_DOMAIN_RENAME_IN_PROGRESS: ::NTSTATUS = 0xC0000801u32 as i32; +pub const STATUS_DISK_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000802u32 as i32; +pub const STATUS_DATA_LOST_REPAIR: ::NTSTATUS = 0x80000803u32 as i32; +pub const STATUS_CONTENT_BLOCKED: ::NTSTATUS = 0xC0000804u32 as i32; +pub const STATUS_BAD_CLUSTERS: ::NTSTATUS = 0xC0000805u32 as i32; +pub const STATUS_VOLUME_DIRTY: ::NTSTATUS = 0xC0000806u32 as i32; +pub const STATUS_DISK_REPAIR_REDIRECTED: ::NTSTATUS = 0x40000807; +pub const STATUS_DISK_REPAIR_UNSUCCESSFUL: ::NTSTATUS = 0xC0000808u32 as i32; +pub const STATUS_CORRUPT_LOG_OVERFULL: ::NTSTATUS = 0xC0000809u32 as i32; +pub const STATUS_CORRUPT_LOG_CORRUPTED: ::NTSTATUS = 0xC000080Au32 as i32; +pub const STATUS_CORRUPT_LOG_UNAVAILABLE: ::NTSTATUS = 0xC000080Bu32 as i32; +pub const STATUS_CORRUPT_LOG_DELETED_FULL: ::NTSTATUS = 0xC000080Cu32 as i32; +pub const STATUS_CORRUPT_LOG_CLEARED: ::NTSTATUS = 0xC000080Du32 as i32; +pub const STATUS_ORPHAN_NAME_EXHAUSTED: ::NTSTATUS = 0xC000080Eu32 as i32; +pub const STATUS_PROACTIVE_SCAN_IN_PROGRESS: ::NTSTATUS = 0xC000080Fu32 as i32; +pub const STATUS_ENCRYPTED_IO_NOT_POSSIBLE: ::NTSTATUS = 0xC0000810u32 as i32; +pub const STATUS_CORRUPT_LOG_UPLEVEL_RECORDS: ::NTSTATUS = 0xC0000811u32 as i32; +pub const STATUS_FILE_CHECKED_OUT: ::NTSTATUS = 0xC0000901u32 as i32; +pub const STATUS_CHECKOUT_REQUIRED: ::NTSTATUS = 0xC0000902u32 as i32; +pub const STATUS_BAD_FILE_TYPE: ::NTSTATUS = 0xC0000903u32 as i32; +pub const STATUS_FILE_TOO_LARGE: ::NTSTATUS = 0xC0000904u32 as i32; +pub const STATUS_FORMS_AUTH_REQUIRED: ::NTSTATUS = 0xC0000905u32 as i32; +pub const STATUS_VIRUS_INFECTED: ::NTSTATUS = 0xC0000906u32 as i32; +pub const STATUS_VIRUS_DELETED: ::NTSTATUS = 0xC0000907u32 as i32; +pub const STATUS_BAD_MCFG_TABLE: ::NTSTATUS = 0xC0000908u32 as i32; +pub const STATUS_CANNOT_BREAK_OPLOCK: ::NTSTATUS = 0xC0000909u32 as i32; +pub const STATUS_BAD_KEY: ::NTSTATUS = 0xC000090Au32 as i32; +pub const STATUS_BAD_DATA: ::NTSTATUS = 0xC000090Bu32 as i32; +pub const STATUS_NO_KEY: ::NTSTATUS = 0xC000090Cu32 as i32; +pub const STATUS_FILE_HANDLE_REVOKED: ::NTSTATUS = 0xC0000910u32 as i32; +pub const STATUS_WOW_ASSERTION: ::NTSTATUS = 0xC0009898u32 as i32; +pub const STATUS_INVALID_SIGNATURE: ::NTSTATUS = 0xC000A000u32 as i32; +pub const STATUS_HMAC_NOT_SUPPORTED: ::NTSTATUS = 0xC000A001u32 as i32; +pub const STATUS_AUTH_TAG_MISMATCH: ::NTSTATUS = 0xC000A002u32 as i32; +pub const STATUS_INVALID_STATE_TRANSITION: ::NTSTATUS = 0xC000A003u32 as i32; +pub const STATUS_INVALID_KERNEL_INFO_VERSION: ::NTSTATUS = 0xC000A004u32 as i32; +pub const STATUS_INVALID_PEP_INFO_VERSION: ::NTSTATUS = 0xC000A005u32 as i32; +pub const STATUS_HANDLE_REVOKED: ::NTSTATUS = 0xC000A006u32 as i32; +pub const STATUS_IPSEC_QUEUE_OVERFLOW: ::NTSTATUS = 0xC000A010u32 as i32; +pub const STATUS_ND_QUEUE_OVERFLOW: ::NTSTATUS = 0xC000A011u32 as i32; +pub const STATUS_HOPLIMIT_EXCEEDED: ::NTSTATUS = 0xC000A012u32 as i32; +pub const STATUS_PROTOCOL_NOT_SUPPORTED: ::NTSTATUS = 0xC000A013u32 as i32; +pub const STATUS_FASTPATH_REJECTED: ::NTSTATUS = 0xC000A014u32 as i32; +pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: ::NTSTATUS = 0xC000A080u32 as i32; +pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: ::NTSTATUS = 0xC000A081u32 as i32; +pub const STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: ::NTSTATUS = 0xC000A082u32 as i32; +pub const STATUS_XML_PARSE_ERROR: ::NTSTATUS = 0xC000A083u32 as i32; +pub const STATUS_XMLDSIG_ERROR: ::NTSTATUS = 0xC000A084u32 as i32; +pub const STATUS_WRONG_COMPARTMENT: ::NTSTATUS = 0xC000A085u32 as i32; +pub const STATUS_AUTHIP_FAILURE: ::NTSTATUS = 0xC000A086u32 as i32; +pub const STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: ::NTSTATUS = 0xC000A087u32 as i32; +pub const STATUS_DS_OID_NOT_FOUND: ::NTSTATUS = 0xC000A088u32 as i32; +pub const STATUS_INCORRECT_ACCOUNT_TYPE: ::NTSTATUS = 0xC000A089u32 as i32; +pub const STATUS_HASH_NOT_SUPPORTED: ::NTSTATUS = 0xC000A100u32 as i32; +pub const STATUS_HASH_NOT_PRESENT: ::NTSTATUS = 0xC000A101u32 as i32; +pub const STATUS_SECONDARY_IC_PROVIDER_NOT_REGISTERED: ::NTSTATUS = 0xC000A121u32 as i32; +pub const STATUS_GPIO_CLIENT_INFORMATION_INVALID: ::NTSTATUS = 0xC000A122u32 as i32; +pub const STATUS_GPIO_VERSION_NOT_SUPPORTED: ::NTSTATUS = 0xC000A123u32 as i32; +pub const STATUS_GPIO_INVALID_REGISTRATION_PACKET: ::NTSTATUS = 0xC000A124u32 as i32; +pub const STATUS_GPIO_OPERATION_DENIED: ::NTSTATUS = 0xC000A125u32 as i32; +pub const STATUS_GPIO_INCOMPATIBLE_CONNECT_MODE: ::NTSTATUS = 0xC000A126u32 as i32; +pub const STATUS_GPIO_INTERRUPT_ALREADY_UNMASKED: ::NTSTATUS = 0x8000A127u32 as i32; +pub const STATUS_CANNOT_SWITCH_RUNLEVEL: ::NTSTATUS = 0xC000A141u32 as i32; +pub const STATUS_INVALID_RUNLEVEL_SETTING: ::NTSTATUS = 0xC000A142u32 as i32; +pub const STATUS_RUNLEVEL_SWITCH_TIMEOUT: ::NTSTATUS = 0xC000A143u32 as i32; +pub const STATUS_SERVICES_FAILED_AUTOSTART: ::NTSTATUS = 0x4000A144; +pub const STATUS_RUNLEVEL_SWITCH_AGENT_TIMEOUT: ::NTSTATUS = 0xC000A145u32 as i32; +pub const STATUS_RUNLEVEL_SWITCH_IN_PROGRESS: ::NTSTATUS = 0xC000A146u32 as i32; +pub const STATUS_NOT_APPCONTAINER: ::NTSTATUS = 0xC000A200u32 as i32; +pub const STATUS_NOT_SUPPORTED_IN_APPCONTAINER: ::NTSTATUS = 0xC000A201u32 as i32; +pub const STATUS_INVALID_PACKAGE_SID_LENGTH: ::NTSTATUS = 0xC000A202u32 as i32; +pub const STATUS_APP_DATA_NOT_FOUND: ::NTSTATUS = 0xC000A281u32 as i32; +pub const STATUS_APP_DATA_EXPIRED: ::NTSTATUS = 0xC000A282u32 as i32; +pub const STATUS_APP_DATA_CORRUPT: ::NTSTATUS = 0xC000A283u32 as i32; +pub const STATUS_APP_DATA_LIMIT_EXCEEDED: ::NTSTATUS = 0xC000A284u32 as i32; +pub const STATUS_APP_DATA_REBOOT_REQUIRED: ::NTSTATUS = 0xC000A285u32 as i32; +pub const STATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A1u32 as i32; +pub const STATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A2u32 as i32; +pub const STATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A3u32 as i32; +pub const STATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A4u32 as i32; +pub const DBG_NO_STATE_CHANGE: ::NTSTATUS = 0xC0010001u32 as i32; +pub const DBG_APP_NOT_IDLE: ::NTSTATUS = 0xC0010002u32 as i32; +pub const RPC_NT_INVALID_STRING_BINDING: ::NTSTATUS = 0xC0020001u32 as i32; +pub const RPC_NT_WRONG_KIND_OF_BINDING: ::NTSTATUS = 0xC0020002u32 as i32; +pub const RPC_NT_INVALID_BINDING: ::NTSTATUS = 0xC0020003u32 as i32; +pub const RPC_NT_PROTSEQ_NOT_SUPPORTED: ::NTSTATUS = 0xC0020004u32 as i32; +pub const RPC_NT_INVALID_RPC_PROTSEQ: ::NTSTATUS = 0xC0020005u32 as i32; +pub const RPC_NT_INVALID_STRING_UUID: ::NTSTATUS = 0xC0020006u32 as i32; +pub const RPC_NT_INVALID_ENDPOINT_FORMAT: ::NTSTATUS = 0xC0020007u32 as i32; +pub const RPC_NT_INVALID_NET_ADDR: ::NTSTATUS = 0xC0020008u32 as i32; +pub const RPC_NT_NO_ENDPOINT_FOUND: ::NTSTATUS = 0xC0020009u32 as i32; +pub const RPC_NT_INVALID_TIMEOUT: ::NTSTATUS = 0xC002000Au32 as i32; +pub const RPC_NT_OBJECT_NOT_FOUND: ::NTSTATUS = 0xC002000Bu32 as i32; +pub const RPC_NT_ALREADY_REGISTERED: ::NTSTATUS = 0xC002000Cu32 as i32; +pub const RPC_NT_TYPE_ALREADY_REGISTERED: ::NTSTATUS = 0xC002000Du32 as i32; +pub const RPC_NT_ALREADY_LISTENING: ::NTSTATUS = 0xC002000Eu32 as i32; +pub const RPC_NT_NO_PROTSEQS_REGISTERED: ::NTSTATUS = 0xC002000Fu32 as i32; +pub const RPC_NT_NOT_LISTENING: ::NTSTATUS = 0xC0020010u32 as i32; +pub const RPC_NT_UNKNOWN_MGR_TYPE: ::NTSTATUS = 0xC0020011u32 as i32; +pub const RPC_NT_UNKNOWN_IF: ::NTSTATUS = 0xC0020012u32 as i32; +pub const RPC_NT_NO_BINDINGS: ::NTSTATUS = 0xC0020013u32 as i32; +pub const RPC_NT_NO_PROTSEQS: ::NTSTATUS = 0xC0020014u32 as i32; +pub const RPC_NT_CANT_CREATE_ENDPOINT: ::NTSTATUS = 0xC0020015u32 as i32; +pub const RPC_NT_OUT_OF_RESOURCES: ::NTSTATUS = 0xC0020016u32 as i32; +pub const RPC_NT_SERVER_UNAVAILABLE: ::NTSTATUS = 0xC0020017u32 as i32; +pub const RPC_NT_SERVER_TOO_BUSY: ::NTSTATUS = 0xC0020018u32 as i32; +pub const RPC_NT_INVALID_NETWORK_OPTIONS: ::NTSTATUS = 0xC0020019u32 as i32; +pub const RPC_NT_NO_CALL_ACTIVE: ::NTSTATUS = 0xC002001Au32 as i32; +pub const RPC_NT_CALL_FAILED: ::NTSTATUS = 0xC002001Bu32 as i32; +pub const RPC_NT_CALL_FAILED_DNE: ::NTSTATUS = 0xC002001Cu32 as i32; +pub const RPC_NT_PROTOCOL_ERROR: ::NTSTATUS = 0xC002001Du32 as i32; +pub const RPC_NT_UNSUPPORTED_TRANS_SYN: ::NTSTATUS = 0xC002001Fu32 as i32; +pub const RPC_NT_UNSUPPORTED_TYPE: ::NTSTATUS = 0xC0020021u32 as i32; +pub const RPC_NT_INVALID_TAG: ::NTSTATUS = 0xC0020022u32 as i32; +pub const RPC_NT_INVALID_BOUND: ::NTSTATUS = 0xC0020023u32 as i32; +pub const RPC_NT_NO_ENTRY_NAME: ::NTSTATUS = 0xC0020024u32 as i32; +pub const RPC_NT_INVALID_NAME_SYNTAX: ::NTSTATUS = 0xC0020025u32 as i32; +pub const RPC_NT_UNSUPPORTED_NAME_SYNTAX: ::NTSTATUS = 0xC0020026u32 as i32; +pub const RPC_NT_UUID_NO_ADDRESS: ::NTSTATUS = 0xC0020028u32 as i32; +pub const RPC_NT_DUPLICATE_ENDPOINT: ::NTSTATUS = 0xC0020029u32 as i32; +pub const RPC_NT_UNKNOWN_AUTHN_TYPE: ::NTSTATUS = 0xC002002Au32 as i32; +pub const RPC_NT_MAX_CALLS_TOO_SMALL: ::NTSTATUS = 0xC002002Bu32 as i32; +pub const RPC_NT_STRING_TOO_LONG: ::NTSTATUS = 0xC002002Cu32 as i32; +pub const RPC_NT_PROTSEQ_NOT_FOUND: ::NTSTATUS = 0xC002002Du32 as i32; +pub const RPC_NT_PROCNUM_OUT_OF_RANGE: ::NTSTATUS = 0xC002002Eu32 as i32; +pub const RPC_NT_BINDING_HAS_NO_AUTH: ::NTSTATUS = 0xC002002Fu32 as i32; +pub const RPC_NT_UNKNOWN_AUTHN_SERVICE: ::NTSTATUS = 0xC0020030u32 as i32; +pub const RPC_NT_UNKNOWN_AUTHN_LEVEL: ::NTSTATUS = 0xC0020031u32 as i32; +pub const RPC_NT_INVALID_AUTH_IDENTITY: ::NTSTATUS = 0xC0020032u32 as i32; +pub const RPC_NT_UNKNOWN_AUTHZ_SERVICE: ::NTSTATUS = 0xC0020033u32 as i32; +pub const EPT_NT_INVALID_ENTRY: ::NTSTATUS = 0xC0020034u32 as i32; +pub const EPT_NT_CANT_PERFORM_OP: ::NTSTATUS = 0xC0020035u32 as i32; +pub const EPT_NT_NOT_REGISTERED: ::NTSTATUS = 0xC0020036u32 as i32; +pub const RPC_NT_NOTHING_TO_EXPORT: ::NTSTATUS = 0xC0020037u32 as i32; +pub const RPC_NT_INCOMPLETE_NAME: ::NTSTATUS = 0xC0020038u32 as i32; +pub const RPC_NT_INVALID_VERS_OPTION: ::NTSTATUS = 0xC0020039u32 as i32; +pub const RPC_NT_NO_MORE_MEMBERS: ::NTSTATUS = 0xC002003Au32 as i32; +pub const RPC_NT_NOT_ALL_OBJS_UNEXPORTED: ::NTSTATUS = 0xC002003Bu32 as i32; +pub const RPC_NT_INTERFACE_NOT_FOUND: ::NTSTATUS = 0xC002003Cu32 as i32; +pub const RPC_NT_ENTRY_ALREADY_EXISTS: ::NTSTATUS = 0xC002003Du32 as i32; +pub const RPC_NT_ENTRY_NOT_FOUND: ::NTSTATUS = 0xC002003Eu32 as i32; +pub const RPC_NT_NAME_SERVICE_UNAVAILABLE: ::NTSTATUS = 0xC002003Fu32 as i32; +pub const RPC_NT_INVALID_NAF_ID: ::NTSTATUS = 0xC0020040u32 as i32; +pub const RPC_NT_CANNOT_SUPPORT: ::NTSTATUS = 0xC0020041u32 as i32; +pub const RPC_NT_NO_CONTEXT_AVAILABLE: ::NTSTATUS = 0xC0020042u32 as i32; +pub const RPC_NT_INTERNAL_ERROR: ::NTSTATUS = 0xC0020043u32 as i32; +pub const RPC_NT_ZERO_DIVIDE: ::NTSTATUS = 0xC0020044u32 as i32; +pub const RPC_NT_ADDRESS_ERROR: ::NTSTATUS = 0xC0020045u32 as i32; +pub const RPC_NT_FP_DIV_ZERO: ::NTSTATUS = 0xC0020046u32 as i32; +pub const RPC_NT_FP_UNDERFLOW: ::NTSTATUS = 0xC0020047u32 as i32; +pub const RPC_NT_FP_OVERFLOW: ::NTSTATUS = 0xC0020048u32 as i32; +pub const RPC_NT_NO_MORE_ENTRIES: ::NTSTATUS = 0xC0030001u32 as i32; +pub const RPC_NT_SS_CHAR_TRANS_OPEN_FAIL: ::NTSTATUS = 0xC0030002u32 as i32; +pub const RPC_NT_SS_CHAR_TRANS_SHORT_FILE: ::NTSTATUS = 0xC0030003u32 as i32; +pub const RPC_NT_SS_IN_NULL_CONTEXT: ::NTSTATUS = 0xC0030004u32 as i32; +pub const RPC_NT_SS_CONTEXT_MISMATCH: ::NTSTATUS = 0xC0030005u32 as i32; +pub const RPC_NT_SS_CONTEXT_DAMAGED: ::NTSTATUS = 0xC0030006u32 as i32; +pub const RPC_NT_SS_HANDLES_MISMATCH: ::NTSTATUS = 0xC0030007u32 as i32; +pub const RPC_NT_SS_CANNOT_GET_CALL_HANDLE: ::NTSTATUS = 0xC0030008u32 as i32; +pub const RPC_NT_NULL_REF_POINTER: ::NTSTATUS = 0xC0030009u32 as i32; +pub const RPC_NT_ENUM_VALUE_OUT_OF_RANGE: ::NTSTATUS = 0xC003000Au32 as i32; +pub const RPC_NT_BYTE_COUNT_TOO_SMALL: ::NTSTATUS = 0xC003000Bu32 as i32; +pub const RPC_NT_BAD_STUB_DATA: ::NTSTATUS = 0xC003000Cu32 as i32; +pub const RPC_NT_CALL_IN_PROGRESS: ::NTSTATUS = 0xC0020049u32 as i32; +pub const RPC_NT_NO_MORE_BINDINGS: ::NTSTATUS = 0xC002004Au32 as i32; +pub const RPC_NT_GROUP_MEMBER_NOT_FOUND: ::NTSTATUS = 0xC002004Bu32 as i32; +pub const EPT_NT_CANT_CREATE: ::NTSTATUS = 0xC002004Cu32 as i32; +pub const RPC_NT_INVALID_OBJECT: ::NTSTATUS = 0xC002004Du32 as i32; +pub const RPC_NT_NO_INTERFACES: ::NTSTATUS = 0xC002004Fu32 as i32; +pub const RPC_NT_CALL_CANCELLED: ::NTSTATUS = 0xC0020050u32 as i32; +pub const RPC_NT_BINDING_INCOMPLETE: ::NTSTATUS = 0xC0020051u32 as i32; +pub const RPC_NT_COMM_FAILURE: ::NTSTATUS = 0xC0020052u32 as i32; +pub const RPC_NT_UNSUPPORTED_AUTHN_LEVEL: ::NTSTATUS = 0xC0020053u32 as i32; +pub const RPC_NT_NO_PRINC_NAME: ::NTSTATUS = 0xC0020054u32 as i32; +pub const RPC_NT_NOT_RPC_ERROR: ::NTSTATUS = 0xC0020055u32 as i32; +pub const RPC_NT_UUID_LOCAL_ONLY: ::NTSTATUS = 0x40020056; +pub const RPC_NT_SEC_PKG_ERROR: ::NTSTATUS = 0xC0020057u32 as i32; +pub const RPC_NT_NOT_CANCELLED: ::NTSTATUS = 0xC0020058u32 as i32; +pub const RPC_NT_INVALID_ES_ACTION: ::NTSTATUS = 0xC0030059u32 as i32; +pub const RPC_NT_WRONG_ES_VERSION: ::NTSTATUS = 0xC003005Au32 as i32; +pub const RPC_NT_WRONG_STUB_VERSION: ::NTSTATUS = 0xC003005Bu32 as i32; +pub const RPC_NT_INVALID_PIPE_OBJECT: ::NTSTATUS = 0xC003005Cu32 as i32; +pub const RPC_NT_INVALID_PIPE_OPERATION: ::NTSTATUS = 0xC003005Du32 as i32; +pub const RPC_NT_WRONG_PIPE_VERSION: ::NTSTATUS = 0xC003005Eu32 as i32; +pub const RPC_NT_PIPE_CLOSED: ::NTSTATUS = 0xC003005Fu32 as i32; +pub const RPC_NT_PIPE_DISCIPLINE_ERROR: ::NTSTATUS = 0xC0030060u32 as i32; +pub const RPC_NT_PIPE_EMPTY: ::NTSTATUS = 0xC0030061u32 as i32; +pub const RPC_NT_INVALID_ASYNC_HANDLE: ::NTSTATUS = 0xC0020062u32 as i32; +pub const RPC_NT_INVALID_ASYNC_CALL: ::NTSTATUS = 0xC0020063u32 as i32; +pub const RPC_NT_PROXY_ACCESS_DENIED: ::NTSTATUS = 0xC0020064u32 as i32; +pub const RPC_NT_COOKIE_AUTH_FAILED: ::NTSTATUS = 0xC0020065u32 as i32; +pub const RPC_NT_SEND_INCOMPLETE: ::NTSTATUS = 0x400200AF; +pub const STATUS_ACPI_INVALID_OPCODE: ::NTSTATUS = 0xC0140001u32 as i32; +pub const STATUS_ACPI_STACK_OVERFLOW: ::NTSTATUS = 0xC0140002u32 as i32; +pub const STATUS_ACPI_ASSERT_FAILED: ::NTSTATUS = 0xC0140003u32 as i32; +pub const STATUS_ACPI_INVALID_INDEX: ::NTSTATUS = 0xC0140004u32 as i32; +pub const STATUS_ACPI_INVALID_ARGUMENT: ::NTSTATUS = 0xC0140005u32 as i32; +pub const STATUS_ACPI_FATAL: ::NTSTATUS = 0xC0140006u32 as i32; +pub const STATUS_ACPI_INVALID_SUPERNAME: ::NTSTATUS = 0xC0140007u32 as i32; +pub const STATUS_ACPI_INVALID_ARGTYPE: ::NTSTATUS = 0xC0140008u32 as i32; +pub const STATUS_ACPI_INVALID_OBJTYPE: ::NTSTATUS = 0xC0140009u32 as i32; +pub const STATUS_ACPI_INVALID_TARGETTYPE: ::NTSTATUS = 0xC014000Au32 as i32; +pub const STATUS_ACPI_INCORRECT_ARGUMENT_COUNT: ::NTSTATUS = 0xC014000Bu32 as i32; +pub const STATUS_ACPI_ADDRESS_NOT_MAPPED: ::NTSTATUS = 0xC014000Cu32 as i32; +pub const STATUS_ACPI_INVALID_EVENTTYPE: ::NTSTATUS = 0xC014000Du32 as i32; +pub const STATUS_ACPI_HANDLER_COLLISION: ::NTSTATUS = 0xC014000Eu32 as i32; +pub const STATUS_ACPI_INVALID_DATA: ::NTSTATUS = 0xC014000Fu32 as i32; +pub const STATUS_ACPI_INVALID_REGION: ::NTSTATUS = 0xC0140010u32 as i32; +pub const STATUS_ACPI_INVALID_ACCESS_SIZE: ::NTSTATUS = 0xC0140011u32 as i32; +pub const STATUS_ACPI_ACQUIRE_GLOBAL_LOCK: ::NTSTATUS = 0xC0140012u32 as i32; +pub const STATUS_ACPI_ALREADY_INITIALIZED: ::NTSTATUS = 0xC0140013u32 as i32; +pub const STATUS_ACPI_NOT_INITIALIZED: ::NTSTATUS = 0xC0140014u32 as i32; +pub const STATUS_ACPI_INVALID_MUTEX_LEVEL: ::NTSTATUS = 0xC0140015u32 as i32; +pub const STATUS_ACPI_MUTEX_NOT_OWNED: ::NTSTATUS = 0xC0140016u32 as i32; +pub const STATUS_ACPI_MUTEX_NOT_OWNER: ::NTSTATUS = 0xC0140017u32 as i32; +pub const STATUS_ACPI_RS_ACCESS: ::NTSTATUS = 0xC0140018u32 as i32; +pub const STATUS_ACPI_INVALID_TABLE: ::NTSTATUS = 0xC0140019u32 as i32; +pub const STATUS_ACPI_REG_HANDLER_FAILED: ::NTSTATUS = 0xC0140020u32 as i32; +pub const STATUS_ACPI_POWER_REQUEST_FAILED: ::NTSTATUS = 0xC0140021u32 as i32; +pub const STATUS_CTX_WINSTATION_NAME_INVALID: ::NTSTATUS = 0xC00A0001u32 as i32; +pub const STATUS_CTX_INVALID_PD: ::NTSTATUS = 0xC00A0002u32 as i32; +pub const STATUS_CTX_PD_NOT_FOUND: ::NTSTATUS = 0xC00A0003u32 as i32; +pub const STATUS_CTX_CDM_CONNECT: ::NTSTATUS = 0x400A0004; +pub const STATUS_CTX_CDM_DISCONNECT: ::NTSTATUS = 0x400A0005; +pub const STATUS_CTX_CLOSE_PENDING: ::NTSTATUS = 0xC00A0006u32 as i32; +pub const STATUS_CTX_NO_OUTBUF: ::NTSTATUS = 0xC00A0007u32 as i32; +pub const STATUS_CTX_MODEM_INF_NOT_FOUND: ::NTSTATUS = 0xC00A0008u32 as i32; +pub const STATUS_CTX_INVALID_MODEMNAME: ::NTSTATUS = 0xC00A0009u32 as i32; +pub const STATUS_CTX_RESPONSE_ERROR: ::NTSTATUS = 0xC00A000Au32 as i32; +pub const STATUS_CTX_MODEM_RESPONSE_TIMEOUT: ::NTSTATUS = 0xC00A000Bu32 as i32; +pub const STATUS_CTX_MODEM_RESPONSE_NO_CARRIER: ::NTSTATUS = 0xC00A000Cu32 as i32; +pub const STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE: ::NTSTATUS = 0xC00A000Du32 as i32; +pub const STATUS_CTX_MODEM_RESPONSE_BUSY: ::NTSTATUS = 0xC00A000Eu32 as i32; +pub const STATUS_CTX_MODEM_RESPONSE_VOICE: ::NTSTATUS = 0xC00A000Fu32 as i32; +pub const STATUS_CTX_TD_ERROR: ::NTSTATUS = 0xC00A0010u32 as i32; +pub const STATUS_CTX_LICENSE_CLIENT_INVALID: ::NTSTATUS = 0xC00A0012u32 as i32; +pub const STATUS_CTX_LICENSE_NOT_AVAILABLE: ::NTSTATUS = 0xC00A0013u32 as i32; +pub const STATUS_CTX_LICENSE_EXPIRED: ::NTSTATUS = 0xC00A0014u32 as i32; +pub const STATUS_CTX_WINSTATION_NOT_FOUND: ::NTSTATUS = 0xC00A0015u32 as i32; +pub const STATUS_CTX_WINSTATION_NAME_COLLISION: ::NTSTATUS = 0xC00A0016u32 as i32; +pub const STATUS_CTX_WINSTATION_BUSY: ::NTSTATUS = 0xC00A0017u32 as i32; +pub const STATUS_CTX_BAD_VIDEO_MODE: ::NTSTATUS = 0xC00A0018u32 as i32; +pub const STATUS_CTX_GRAPHICS_INVALID: ::NTSTATUS = 0xC00A0022u32 as i32; +pub const STATUS_CTX_NOT_CONSOLE: ::NTSTATUS = 0xC00A0024u32 as i32; +pub const STATUS_CTX_CLIENT_QUERY_TIMEOUT: ::NTSTATUS = 0xC00A0026u32 as i32; +pub const STATUS_CTX_CONSOLE_DISCONNECT: ::NTSTATUS = 0xC00A0027u32 as i32; +pub const STATUS_CTX_CONSOLE_CONNECT: ::NTSTATUS = 0xC00A0028u32 as i32; +pub const STATUS_CTX_SHADOW_DENIED: ::NTSTATUS = 0xC00A002Au32 as i32; +pub const STATUS_CTX_WINSTATION_ACCESS_DENIED: ::NTSTATUS = 0xC00A002Bu32 as i32; +pub const STATUS_CTX_INVALID_WD: ::NTSTATUS = 0xC00A002Eu32 as i32; +pub const STATUS_CTX_WD_NOT_FOUND: ::NTSTATUS = 0xC00A002Fu32 as i32; +pub const STATUS_CTX_SHADOW_INVALID: ::NTSTATUS = 0xC00A0030u32 as i32; +pub const STATUS_CTX_SHADOW_DISABLED: ::NTSTATUS = 0xC00A0031u32 as i32; +pub const STATUS_RDP_PROTOCOL_ERROR: ::NTSTATUS = 0xC00A0032u32 as i32; +pub const STATUS_CTX_CLIENT_LICENSE_NOT_SET: ::NTSTATUS = 0xC00A0033u32 as i32; +pub const STATUS_CTX_CLIENT_LICENSE_IN_USE: ::NTSTATUS = 0xC00A0034u32 as i32; +pub const STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE: ::NTSTATUS = 0xC00A0035u32 as i32; +pub const STATUS_CTX_SHADOW_NOT_RUNNING: ::NTSTATUS = 0xC00A0036u32 as i32; +pub const STATUS_CTX_LOGON_DISABLED: ::NTSTATUS = 0xC00A0037u32 as i32; +pub const STATUS_CTX_SECURITY_LAYER_ERROR: ::NTSTATUS = 0xC00A0038u32 as i32; +pub const STATUS_TS_INCOMPATIBLE_SESSIONS: ::NTSTATUS = 0xC00A0039u32 as i32; +pub const STATUS_TS_VIDEO_SUBSYSTEM_ERROR: ::NTSTATUS = 0xC00A003Au32 as i32; +pub const STATUS_PNP_BAD_MPS_TABLE: ::NTSTATUS = 0xC0040035u32 as i32; +pub const STATUS_PNP_TRANSLATION_FAILED: ::NTSTATUS = 0xC0040036u32 as i32; +pub const STATUS_PNP_IRQ_TRANSLATION_FAILED: ::NTSTATUS = 0xC0040037u32 as i32; +pub const STATUS_PNP_INVALID_ID: ::NTSTATUS = 0xC0040038u32 as i32; +pub const STATUS_IO_REISSUE_AS_CACHED: ::NTSTATUS = 0xC0040039u32 as i32; +pub const STATUS_MUI_FILE_NOT_FOUND: ::NTSTATUS = 0xC00B0001u32 as i32; +pub const STATUS_MUI_INVALID_FILE: ::NTSTATUS = 0xC00B0002u32 as i32; +pub const STATUS_MUI_INVALID_RC_CONFIG: ::NTSTATUS = 0xC00B0003u32 as i32; +pub const STATUS_MUI_INVALID_LOCALE_NAME: ::NTSTATUS = 0xC00B0004u32 as i32; +pub const STATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME: ::NTSTATUS = 0xC00B0005u32 as i32; +pub const STATUS_MUI_FILE_NOT_LOADED: ::NTSTATUS = 0xC00B0006u32 as i32; +pub const STATUS_RESOURCE_ENUM_USER_STOP: ::NTSTATUS = 0xC00B0007u32 as i32; +pub const STATUS_FLT_NO_HANDLER_DEFINED: ::NTSTATUS = 0xC01C0001u32 as i32; +pub const STATUS_FLT_CONTEXT_ALREADY_DEFINED: ::NTSTATUS = 0xC01C0002u32 as i32; +pub const STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST: ::NTSTATUS = 0xC01C0003u32 as i32; +pub const STATUS_FLT_DISALLOW_FAST_IO: ::NTSTATUS = 0xC01C0004u32 as i32; +pub const STATUS_FLT_INVALID_NAME_REQUEST: ::NTSTATUS = 0xC01C0005u32 as i32; +pub const STATUS_FLT_NOT_SAFE_TO_POST_OPERATION: ::NTSTATUS = 0xC01C0006u32 as i32; +pub const STATUS_FLT_NOT_INITIALIZED: ::NTSTATUS = 0xC01C0007u32 as i32; +pub const STATUS_FLT_FILTER_NOT_READY: ::NTSTATUS = 0xC01C0008u32 as i32; +pub const STATUS_FLT_POST_OPERATION_CLEANUP: ::NTSTATUS = 0xC01C0009u32 as i32; +pub const STATUS_FLT_INTERNAL_ERROR: ::NTSTATUS = 0xC01C000Au32 as i32; +pub const STATUS_FLT_DELETING_OBJECT: ::NTSTATUS = 0xC01C000Bu32 as i32; +pub const STATUS_FLT_MUST_BE_NONPAGED_POOL: ::NTSTATUS = 0xC01C000Cu32 as i32; +pub const STATUS_FLT_DUPLICATE_ENTRY: ::NTSTATUS = 0xC01C000Du32 as i32; +pub const STATUS_FLT_CBDQ_DISABLED: ::NTSTATUS = 0xC01C000Eu32 as i32; +pub const STATUS_FLT_DO_NOT_ATTACH: ::NTSTATUS = 0xC01C000Fu32 as i32; +pub const STATUS_FLT_DO_NOT_DETACH: ::NTSTATUS = 0xC01C0010u32 as i32; +pub const STATUS_FLT_INSTANCE_ALTITUDE_COLLISION: ::NTSTATUS = 0xC01C0011u32 as i32; +pub const STATUS_FLT_INSTANCE_NAME_COLLISION: ::NTSTATUS = 0xC01C0012u32 as i32; +pub const STATUS_FLT_FILTER_NOT_FOUND: ::NTSTATUS = 0xC01C0013u32 as i32; +pub const STATUS_FLT_VOLUME_NOT_FOUND: ::NTSTATUS = 0xC01C0014u32 as i32; +pub const STATUS_FLT_INSTANCE_NOT_FOUND: ::NTSTATUS = 0xC01C0015u32 as i32; +pub const STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND: ::NTSTATUS = 0xC01C0016u32 as i32; +pub const STATUS_FLT_INVALID_CONTEXT_REGISTRATION: ::NTSTATUS = 0xC01C0017u32 as i32; +pub const STATUS_FLT_NAME_CACHE_MISS: ::NTSTATUS = 0xC01C0018u32 as i32; +pub const STATUS_FLT_NO_DEVICE_OBJECT: ::NTSTATUS = 0xC01C0019u32 as i32; +pub const STATUS_FLT_VOLUME_ALREADY_MOUNTED: ::NTSTATUS = 0xC01C001Au32 as i32; +pub const STATUS_FLT_ALREADY_ENLISTED: ::NTSTATUS = 0xC01C001Bu32 as i32; +pub const STATUS_FLT_CONTEXT_ALREADY_LINKED: ::NTSTATUS = 0xC01C001Cu32 as i32; +pub const STATUS_FLT_NO_WAITER_FOR_REPLY: ::NTSTATUS = 0xC01C0020u32 as i32; +pub const STATUS_FLT_REGISTRATION_BUSY: ::NTSTATUS = 0xC01C0023u32 as i32; +pub const STATUS_SXS_SECTION_NOT_FOUND: ::NTSTATUS = 0xC0150001u32 as i32; +pub const STATUS_SXS_CANT_GEN_ACTCTX: ::NTSTATUS = 0xC0150002u32 as i32; +pub const STATUS_SXS_INVALID_ACTCTXDATA_FORMAT: ::NTSTATUS = 0xC0150003u32 as i32; +pub const STATUS_SXS_ASSEMBLY_NOT_FOUND: ::NTSTATUS = 0xC0150004u32 as i32; +pub const STATUS_SXS_MANIFEST_FORMAT_ERROR: ::NTSTATUS = 0xC0150005u32 as i32; +pub const STATUS_SXS_MANIFEST_PARSE_ERROR: ::NTSTATUS = 0xC0150006u32 as i32; +pub const STATUS_SXS_ACTIVATION_CONTEXT_DISABLED: ::NTSTATUS = 0xC0150007u32 as i32; +pub const STATUS_SXS_KEY_NOT_FOUND: ::NTSTATUS = 0xC0150008u32 as i32; +pub const STATUS_SXS_VERSION_CONFLICT: ::NTSTATUS = 0xC0150009u32 as i32; +pub const STATUS_SXS_WRONG_SECTION_TYPE: ::NTSTATUS = 0xC015000Au32 as i32; +pub const STATUS_SXS_THREAD_QUERIES_DISABLED: ::NTSTATUS = 0xC015000Bu32 as i32; +pub const STATUS_SXS_ASSEMBLY_MISSING: ::NTSTATUS = 0xC015000Cu32 as i32; +pub const STATUS_SXS_RELEASE_ACTIVATION_CONTEXT: ::NTSTATUS = 0x4015000D; +pub const STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET: ::NTSTATUS = 0xC015000Eu32 as i32; +pub const STATUS_SXS_EARLY_DEACTIVATION: ::NTSTATUS = 0xC015000Fu32 as i32; +pub const STATUS_SXS_INVALID_DEACTIVATION: ::NTSTATUS = 0xC0150010u32 as i32; +pub const STATUS_SXS_MULTIPLE_DEACTIVATION: ::NTSTATUS = 0xC0150011u32 as i32; +pub const STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: ::NTSTATUS = 0xC0150012u32 as i32; +pub const STATUS_SXS_PROCESS_TERMINATION_REQUESTED: ::NTSTATUS = 0xC0150013u32 as i32; +pub const STATUS_SXS_CORRUPT_ACTIVATION_STACK: ::NTSTATUS = 0xC0150014u32 as i32; +pub const STATUS_SXS_CORRUPTION: ::NTSTATUS = 0xC0150015u32 as i32; +pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: ::NTSTATUS = 0xC0150016u32 as i32; +pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: ::NTSTATUS = 0xC0150017u32 as i32; +pub const STATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: ::NTSTATUS = 0xC0150018u32 as i32; +pub const STATUS_SXS_IDENTITY_PARSE_ERROR: ::NTSTATUS = 0xC0150019u32 as i32; +pub const STATUS_SXS_COMPONENT_STORE_CORRUPT: ::NTSTATUS = 0xC015001Au32 as i32; +pub const STATUS_SXS_FILE_HASH_MISMATCH: ::NTSTATUS = 0xC015001Bu32 as i32; +pub const STATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: ::NTSTATUS = 0xC015001Cu32 as i32; +pub const STATUS_SXS_IDENTITIES_DIFFERENT: ::NTSTATUS = 0xC015001Du32 as i32; +pub const STATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: ::NTSTATUS = 0xC015001Eu32 as i32; +pub const STATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY: ::NTSTATUS = 0xC015001Fu32 as i32; +pub const STATUS_ADVANCED_INSTALLER_FAILED: ::NTSTATUS = 0xC0150020u32 as i32; +pub const STATUS_XML_ENCODING_MISMATCH: ::NTSTATUS = 0xC0150021u32 as i32; +pub const STATUS_SXS_MANIFEST_TOO_BIG: ::NTSTATUS = 0xC0150022u32 as i32; +pub const STATUS_SXS_SETTING_NOT_REGISTERED: ::NTSTATUS = 0xC0150023u32 as i32; +pub const STATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE: ::NTSTATUS = 0xC0150024u32 as i32; +pub const STATUS_SMI_PRIMITIVE_INSTALLER_FAILED: ::NTSTATUS = 0xC0150025u32 as i32; +pub const STATUS_GENERIC_COMMAND_FAILED: ::NTSTATUS = 0xC0150026u32 as i32; +pub const STATUS_SXS_FILE_HASH_MISSING: ::NTSTATUS = 0xC0150027u32 as i32; +pub const STATUS_CLUSTER_INVALID_NODE: ::NTSTATUS = 0xC0130001u32 as i32; +pub const STATUS_CLUSTER_NODE_EXISTS: ::NTSTATUS = 0xC0130002u32 as i32; +pub const STATUS_CLUSTER_JOIN_IN_PROGRESS: ::NTSTATUS = 0xC0130003u32 as i32; +pub const STATUS_CLUSTER_NODE_NOT_FOUND: ::NTSTATUS = 0xC0130004u32 as i32; +pub const STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND: ::NTSTATUS = 0xC0130005u32 as i32; +pub const STATUS_CLUSTER_NETWORK_EXISTS: ::NTSTATUS = 0xC0130006u32 as i32; +pub const STATUS_CLUSTER_NETWORK_NOT_FOUND: ::NTSTATUS = 0xC0130007u32 as i32; +pub const STATUS_CLUSTER_NETINTERFACE_EXISTS: ::NTSTATUS = 0xC0130008u32 as i32; +pub const STATUS_CLUSTER_NETINTERFACE_NOT_FOUND: ::NTSTATUS = 0xC0130009u32 as i32; +pub const STATUS_CLUSTER_INVALID_REQUEST: ::NTSTATUS = 0xC013000Au32 as i32; +pub const STATUS_CLUSTER_INVALID_NETWORK_PROVIDER: ::NTSTATUS = 0xC013000Bu32 as i32; +pub const STATUS_CLUSTER_NODE_DOWN: ::NTSTATUS = 0xC013000Cu32 as i32; +pub const STATUS_CLUSTER_NODE_UNREACHABLE: ::NTSTATUS = 0xC013000Du32 as i32; +pub const STATUS_CLUSTER_NODE_NOT_MEMBER: ::NTSTATUS = 0xC013000Eu32 as i32; +pub const STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS: ::NTSTATUS = 0xC013000Fu32 as i32; +pub const STATUS_CLUSTER_INVALID_NETWORK: ::NTSTATUS = 0xC0130010u32 as i32; +pub const STATUS_CLUSTER_NO_NET_ADAPTERS: ::NTSTATUS = 0xC0130011u32 as i32; +pub const STATUS_CLUSTER_NODE_UP: ::NTSTATUS = 0xC0130012u32 as i32; +pub const STATUS_CLUSTER_NODE_PAUSED: ::NTSTATUS = 0xC0130013u32 as i32; +pub const STATUS_CLUSTER_NODE_NOT_PAUSED: ::NTSTATUS = 0xC0130014u32 as i32; +pub const STATUS_CLUSTER_NO_SECURITY_CONTEXT: ::NTSTATUS = 0xC0130015u32 as i32; +pub const STATUS_CLUSTER_NETWORK_NOT_INTERNAL: ::NTSTATUS = 0xC0130016u32 as i32; +pub const STATUS_CLUSTER_POISONED: ::NTSTATUS = 0xC0130017u32 as i32; +pub const STATUS_CLUSTER_NON_CSV_PATH: ::NTSTATUS = 0xC0130018u32 as i32; +pub const STATUS_CLUSTER_CSV_VOLUME_NOT_LOCAL: ::NTSTATUS = 0xC0130019u32 as i32; +pub const STATUS_CLUSTER_CSV_READ_OPLOCK_BREAK_IN_PROGRESS: ::NTSTATUS = 0xC0130020u32 as i32; +pub const STATUS_CLUSTER_CSV_AUTO_PAUSE_ERROR: ::NTSTATUS = 0xC0130021u32 as i32; +pub const STATUS_CLUSTER_CSV_REDIRECTED: ::NTSTATUS = 0xC0130022u32 as i32; +pub const STATUS_CLUSTER_CSV_NOT_REDIRECTED: ::NTSTATUS = 0xC0130023u32 as i32; +pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING: ::NTSTATUS = 0xC0130024u32 as i32; +pub const STATUS_CLUSTER_CSV_SNAPSHOT_CREATION_IN_PROGRESS: ::NTSTATUS = 0xC0130025u32 as i32; +pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING_SUCCEEDED_DOWNLEVEL: ::NTSTATUS = 0xC0130026u32 as i32; +pub const STATUS_CLUSTER_CSV_NO_SNAPSHOTS: ::NTSTATUS = 0xC0130027u32 as i32; +pub const STATUS_CSV_IO_PAUSE_TIMEOUT: ::NTSTATUS = 0xC0130028u32 as i32; +pub const STATUS_TRANSACTIONAL_CONFLICT: ::NTSTATUS = 0xC0190001u32 as i32; +pub const STATUS_INVALID_TRANSACTION: ::NTSTATUS = 0xC0190002u32 as i32; +pub const STATUS_TRANSACTION_NOT_ACTIVE: ::NTSTATUS = 0xC0190003u32 as i32; +pub const STATUS_TM_INITIALIZATION_FAILED: ::NTSTATUS = 0xC0190004u32 as i32; +pub const STATUS_RM_NOT_ACTIVE: ::NTSTATUS = 0xC0190005u32 as i32; +pub const STATUS_RM_METADATA_CORRUPT: ::NTSTATUS = 0xC0190006u32 as i32; +pub const STATUS_TRANSACTION_NOT_JOINED: ::NTSTATUS = 0xC0190007u32 as i32; +pub const STATUS_DIRECTORY_NOT_RM: ::NTSTATUS = 0xC0190008u32 as i32; +pub const STATUS_COULD_NOT_RESIZE_LOG: ::NTSTATUS = 0x80190009u32 as i32; +pub const STATUS_TRANSACTIONS_UNSUPPORTED_REMOTE: ::NTSTATUS = 0xC019000Au32 as i32; +pub const STATUS_LOG_RESIZE_INVALID_SIZE: ::NTSTATUS = 0xC019000Bu32 as i32; +pub const STATUS_REMOTE_FILE_VERSION_MISMATCH: ::NTSTATUS = 0xC019000Cu32 as i32; +pub const STATUS_CRM_PROTOCOL_ALREADY_EXISTS: ::NTSTATUS = 0xC019000Fu32 as i32; +pub const STATUS_TRANSACTION_PROPAGATION_FAILED: ::NTSTATUS = 0xC0190010u32 as i32; +pub const STATUS_CRM_PROTOCOL_NOT_FOUND: ::NTSTATUS = 0xC0190011u32 as i32; +pub const STATUS_TRANSACTION_SUPERIOR_EXISTS: ::NTSTATUS = 0xC0190012u32 as i32; +pub const STATUS_TRANSACTION_REQUEST_NOT_VALID: ::NTSTATUS = 0xC0190013u32 as i32; +pub const STATUS_TRANSACTION_NOT_REQUESTED: ::NTSTATUS = 0xC0190014u32 as i32; +pub const STATUS_TRANSACTION_ALREADY_ABORTED: ::NTSTATUS = 0xC0190015u32 as i32; +pub const STATUS_TRANSACTION_ALREADY_COMMITTED: ::NTSTATUS = 0xC0190016u32 as i32; +pub const STATUS_TRANSACTION_INVALID_MARSHALL_BUFFER: ::NTSTATUS = 0xC0190017u32 as i32; +pub const STATUS_CURRENT_TRANSACTION_NOT_VALID: ::NTSTATUS = 0xC0190018u32 as i32; +pub const STATUS_LOG_GROWTH_FAILED: ::NTSTATUS = 0xC0190019u32 as i32; +pub const STATUS_OBJECT_NO_LONGER_EXISTS: ::NTSTATUS = 0xC0190021u32 as i32; +pub const STATUS_STREAM_MINIVERSION_NOT_FOUND: ::NTSTATUS = 0xC0190022u32 as i32; +pub const STATUS_STREAM_MINIVERSION_NOT_VALID: ::NTSTATUS = 0xC0190023u32 as i32; +pub const STATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: ::NTSTATUS = 0xC0190024u32 as i32; +pub const STATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: ::NTSTATUS = 0xC0190025u32 as i32; +pub const STATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS: ::NTSTATUS = 0xC0190026u32 as i32; +pub const STATUS_HANDLE_NO_LONGER_VALID: ::NTSTATUS = 0xC0190028u32 as i32; +pub const STATUS_NO_TXF_METADATA: ::NTSTATUS = 0x80190029u32 as i32; +pub const STATUS_LOG_CORRUPTION_DETECTED: ::NTSTATUS = 0xC0190030u32 as i32; +pub const STATUS_CANT_RECOVER_WITH_HANDLE_OPEN: ::NTSTATUS = 0x80190031u32 as i32; +pub const STATUS_RM_DISCONNECTED: ::NTSTATUS = 0xC0190032u32 as i32; +pub const STATUS_ENLISTMENT_NOT_SUPERIOR: ::NTSTATUS = 0xC0190033u32 as i32; +pub const STATUS_RECOVERY_NOT_NEEDED: ::NTSTATUS = 0x40190034; +pub const STATUS_RM_ALREADY_STARTED: ::NTSTATUS = 0x40190035; +pub const STATUS_FILE_IDENTITY_NOT_PERSISTENT: ::NTSTATUS = 0xC0190036u32 as i32; +pub const STATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: ::NTSTATUS = 0xC0190037u32 as i32; +pub const STATUS_CANT_CROSS_RM_BOUNDARY: ::NTSTATUS = 0xC0190038u32 as i32; +pub const STATUS_TXF_DIR_NOT_EMPTY: ::NTSTATUS = 0xC0190039u32 as i32; +pub const STATUS_INDOUBT_TRANSACTIONS_EXIST: ::NTSTATUS = 0xC019003Au32 as i32; +pub const STATUS_TM_VOLATILE: ::NTSTATUS = 0xC019003Bu32 as i32; +pub const STATUS_ROLLBACK_TIMER_EXPIRED: ::NTSTATUS = 0xC019003Cu32 as i32; +pub const STATUS_TXF_ATTRIBUTE_CORRUPT: ::NTSTATUS = 0xC019003Du32 as i32; +pub const STATUS_EFS_NOT_ALLOWED_IN_TRANSACTION: ::NTSTATUS = 0xC019003Eu32 as i32; +pub const STATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED: ::NTSTATUS = 0xC019003Fu32 as i32; +pub const STATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: ::NTSTATUS = 0xC0190040u32 as i32; +pub const STATUS_TXF_METADATA_ALREADY_PRESENT: ::NTSTATUS = 0x80190041u32 as i32; +pub const STATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: ::NTSTATUS = 0x80190042u32 as i32; +pub const STATUS_TRANSACTION_REQUIRED_PROMOTION: ::NTSTATUS = 0xC0190043u32 as i32; +pub const STATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION: ::NTSTATUS = 0xC0190044u32 as i32; +pub const STATUS_TRANSACTIONS_NOT_FROZEN: ::NTSTATUS = 0xC0190045u32 as i32; +pub const STATUS_TRANSACTION_FREEZE_IN_PROGRESS: ::NTSTATUS = 0xC0190046u32 as i32; +pub const STATUS_NOT_SNAPSHOT_VOLUME: ::NTSTATUS = 0xC0190047u32 as i32; +pub const STATUS_NO_SAVEPOINT_WITH_OPEN_FILES: ::NTSTATUS = 0xC0190048u32 as i32; +pub const STATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION: ::NTSTATUS = 0xC0190049u32 as i32; +pub const STATUS_TM_IDENTITY_MISMATCH: ::NTSTATUS = 0xC019004Au32 as i32; +pub const STATUS_FLOATED_SECTION: ::NTSTATUS = 0xC019004Bu32 as i32; +pub const STATUS_CANNOT_ACCEPT_TRANSACTED_WORK: ::NTSTATUS = 0xC019004Cu32 as i32; +pub const STATUS_CANNOT_ABORT_TRANSACTIONS: ::NTSTATUS = 0xC019004Du32 as i32; +pub const STATUS_TRANSACTION_NOT_FOUND: ::NTSTATUS = 0xC019004Eu32 as i32; +pub const STATUS_RESOURCEMANAGER_NOT_FOUND: ::NTSTATUS = 0xC019004Fu32 as i32; +pub const STATUS_ENLISTMENT_NOT_FOUND: ::NTSTATUS = 0xC0190050u32 as i32; +pub const STATUS_TRANSACTIONMANAGER_NOT_FOUND: ::NTSTATUS = 0xC0190051u32 as i32; +pub const STATUS_TRANSACTIONMANAGER_NOT_ONLINE: ::NTSTATUS = 0xC0190052u32 as i32; +pub const STATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: ::NTSTATUS = 0xC0190053u32 as i32; +pub const STATUS_TRANSACTION_NOT_ROOT: ::NTSTATUS = 0xC0190054u32 as i32; +pub const STATUS_TRANSACTION_OBJECT_EXPIRED: ::NTSTATUS = 0xC0190055u32 as i32; +pub const STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: ::NTSTATUS = 0xC0190056u32 as i32; +pub const STATUS_TRANSACTION_RESPONSE_NOT_ENLISTED: ::NTSTATUS = 0xC0190057u32 as i32; +pub const STATUS_TRANSACTION_RECORD_TOO_LONG: ::NTSTATUS = 0xC0190058u32 as i32; +pub const STATUS_NO_LINK_TRACKING_IN_TRANSACTION: ::NTSTATUS = 0xC0190059u32 as i32; +pub const STATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: ::NTSTATUS = 0xC019005Au32 as i32; +pub const STATUS_TRANSACTION_INTEGRITY_VIOLATED: ::NTSTATUS = 0xC019005Bu32 as i32; +pub const STATUS_TRANSACTIONMANAGER_IDENTITY_MISMATCH: ::NTSTATUS = 0xC019005Cu32 as i32; +pub const STATUS_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT: ::NTSTATUS = 0xC019005Du32 as i32; +pub const STATUS_TRANSACTION_MUST_WRITETHROUGH: ::NTSTATUS = 0xC019005Eu32 as i32; +pub const STATUS_TRANSACTION_NO_SUPERIOR: ::NTSTATUS = 0xC019005Fu32 as i32; +pub const STATUS_EXPIRED_HANDLE: ::NTSTATUS = 0xC0190060u32 as i32; +pub const STATUS_TRANSACTION_NOT_ENLISTED: ::NTSTATUS = 0xC0190061u32 as i32; +pub const STATUS_LOG_SECTOR_INVALID: ::NTSTATUS = 0xC01A0001u32 as i32; +pub const STATUS_LOG_SECTOR_PARITY_INVALID: ::NTSTATUS = 0xC01A0002u32 as i32; +pub const STATUS_LOG_SECTOR_REMAPPED: ::NTSTATUS = 0xC01A0003u32 as i32; +pub const STATUS_LOG_BLOCK_INCOMPLETE: ::NTSTATUS = 0xC01A0004u32 as i32; +pub const STATUS_LOG_INVALID_RANGE: ::NTSTATUS = 0xC01A0005u32 as i32; +pub const STATUS_LOG_BLOCKS_EXHAUSTED: ::NTSTATUS = 0xC01A0006u32 as i32; +pub const STATUS_LOG_READ_CONTEXT_INVALID: ::NTSTATUS = 0xC01A0007u32 as i32; +pub const STATUS_LOG_RESTART_INVALID: ::NTSTATUS = 0xC01A0008u32 as i32; +pub const STATUS_LOG_BLOCK_VERSION: ::NTSTATUS = 0xC01A0009u32 as i32; +pub const STATUS_LOG_BLOCK_INVALID: ::NTSTATUS = 0xC01A000Au32 as i32; +pub const STATUS_LOG_READ_MODE_INVALID: ::NTSTATUS = 0xC01A000Bu32 as i32; +pub const STATUS_LOG_NO_RESTART: ::NTSTATUS = 0x401A000C; +pub const STATUS_LOG_METADATA_CORRUPT: ::NTSTATUS = 0xC01A000Du32 as i32; +pub const STATUS_LOG_METADATA_INVALID: ::NTSTATUS = 0xC01A000Eu32 as i32; +pub const STATUS_LOG_METADATA_INCONSISTENT: ::NTSTATUS = 0xC01A000Fu32 as i32; +pub const STATUS_LOG_RESERVATION_INVALID: ::NTSTATUS = 0xC01A0010u32 as i32; +pub const STATUS_LOG_CANT_DELETE: ::NTSTATUS = 0xC01A0011u32 as i32; +pub const STATUS_LOG_CONTAINER_LIMIT_EXCEEDED: ::NTSTATUS = 0xC01A0012u32 as i32; +pub const STATUS_LOG_START_OF_LOG: ::NTSTATUS = 0xC01A0013u32 as i32; +pub const STATUS_LOG_POLICY_ALREADY_INSTALLED: ::NTSTATUS = 0xC01A0014u32 as i32; +pub const STATUS_LOG_POLICY_NOT_INSTALLED: ::NTSTATUS = 0xC01A0015u32 as i32; +pub const STATUS_LOG_POLICY_INVALID: ::NTSTATUS = 0xC01A0016u32 as i32; +pub const STATUS_LOG_POLICY_CONFLICT: ::NTSTATUS = 0xC01A0017u32 as i32; +pub const STATUS_LOG_PINNED_ARCHIVE_TAIL: ::NTSTATUS = 0xC01A0018u32 as i32; +pub const STATUS_LOG_RECORD_NONEXISTENT: ::NTSTATUS = 0xC01A0019u32 as i32; +pub const STATUS_LOG_RECORDS_RESERVED_INVALID: ::NTSTATUS = 0xC01A001Au32 as i32; +pub const STATUS_LOG_SPACE_RESERVED_INVALID: ::NTSTATUS = 0xC01A001Bu32 as i32; +pub const STATUS_LOG_TAIL_INVALID: ::NTSTATUS = 0xC01A001Cu32 as i32; +pub const STATUS_LOG_FULL: ::NTSTATUS = 0xC01A001Du32 as i32; +pub const STATUS_LOG_MULTIPLEXED: ::NTSTATUS = 0xC01A001Eu32 as i32; +pub const STATUS_LOG_DEDICATED: ::NTSTATUS = 0xC01A001Fu32 as i32; +pub const STATUS_LOG_ARCHIVE_NOT_IN_PROGRESS: ::NTSTATUS = 0xC01A0020u32 as i32; +pub const STATUS_LOG_ARCHIVE_IN_PROGRESS: ::NTSTATUS = 0xC01A0021u32 as i32; +pub const STATUS_LOG_EPHEMERAL: ::NTSTATUS = 0xC01A0022u32 as i32; +pub const STATUS_LOG_NOT_ENOUGH_CONTAINERS: ::NTSTATUS = 0xC01A0023u32 as i32; +pub const STATUS_LOG_CLIENT_ALREADY_REGISTERED: ::NTSTATUS = 0xC01A0024u32 as i32; +pub const STATUS_LOG_CLIENT_NOT_REGISTERED: ::NTSTATUS = 0xC01A0025u32 as i32; +pub const STATUS_LOG_FULL_HANDLER_IN_PROGRESS: ::NTSTATUS = 0xC01A0026u32 as i32; +pub const STATUS_LOG_CONTAINER_READ_FAILED: ::NTSTATUS = 0xC01A0027u32 as i32; +pub const STATUS_LOG_CONTAINER_WRITE_FAILED: ::NTSTATUS = 0xC01A0028u32 as i32; +pub const STATUS_LOG_CONTAINER_OPEN_FAILED: ::NTSTATUS = 0xC01A0029u32 as i32; +pub const STATUS_LOG_CONTAINER_STATE_INVALID: ::NTSTATUS = 0xC01A002Au32 as i32; +pub const STATUS_LOG_STATE_INVALID: ::NTSTATUS = 0xC01A002Bu32 as i32; +pub const STATUS_LOG_PINNED: ::NTSTATUS = 0xC01A002Cu32 as i32; +pub const STATUS_LOG_METADATA_FLUSH_FAILED: ::NTSTATUS = 0xC01A002Du32 as i32; +pub const STATUS_LOG_INCONSISTENT_SECURITY: ::NTSTATUS = 0xC01A002Eu32 as i32; +pub const STATUS_LOG_APPENDED_FLUSH_FAILED: ::NTSTATUS = 0xC01A002Fu32 as i32; +pub const STATUS_LOG_PINNED_RESERVATION: ::NTSTATUS = 0xC01A0030u32 as i32; +pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD: ::NTSTATUS = 0xC01B00EAu32 as i32; +pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED: ::NTSTATUS = 0x801B00EBu32 as i32; +pub const STATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST: ::NTSTATUS = 0x401B00EC; +pub const STATUS_MONITOR_NO_DESCRIPTOR: ::NTSTATUS = 0xC01D0001u32 as i32; +pub const STATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: ::NTSTATUS = 0xC01D0002u32 as i32; +pub const STATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: ::NTSTATUS = 0xC01D0003u32 as i32; +pub const STATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK: ::NTSTATUS = 0xC01D0004u32 as i32; +pub const STATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: ::NTSTATUS = 0xC01D0005u32 as i32; +pub const STATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: ::NTSTATUS = 0xC01D0006u32 as i32; +pub const STATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: ::NTSTATUS = 0xC01D0007u32 as i32; +pub const STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA: ::NTSTATUS = 0xC01D0008u32 as i32; +pub const STATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK: ::NTSTATUS = 0xC01D0009u32 as i32; +pub const STATUS_MONITOR_INVALID_MANUFACTURE_DATE: ::NTSTATUS = 0xC01D000Au32 as i32; +pub const STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: ::NTSTATUS = 0xC01E0000u32 as i32; +pub const STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: ::NTSTATUS = 0xC01E0001u32 as i32; +pub const STATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER: ::NTSTATUS = 0xC01E0002u32 as i32; +pub const STATUS_GRAPHICS_ADAPTER_WAS_RESET: ::NTSTATUS = 0xC01E0003u32 as i32; +pub const STATUS_GRAPHICS_INVALID_DRIVER_MODEL: ::NTSTATUS = 0xC01E0004u32 as i32; +pub const STATUS_GRAPHICS_PRESENT_MODE_CHANGED: ::NTSTATUS = 0xC01E0005u32 as i32; +pub const STATUS_GRAPHICS_PRESENT_OCCLUDED: ::NTSTATUS = 0xC01E0006u32 as i32; +pub const STATUS_GRAPHICS_PRESENT_DENIED: ::NTSTATUS = 0xC01E0007u32 as i32; +pub const STATUS_GRAPHICS_CANNOTCOLORCONVERT: ::NTSTATUS = 0xC01E0008u32 as i32; +pub const STATUS_GRAPHICS_DRIVER_MISMATCH: ::NTSTATUS = 0xC01E0009u32 as i32; +pub const STATUS_GRAPHICS_PARTIAL_DATA_POPULATED: ::NTSTATUS = 0x401E000A; +pub const STATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED: ::NTSTATUS = 0xC01E000Bu32 as i32; +pub const STATUS_GRAPHICS_PRESENT_UNOCCLUDED: ::NTSTATUS = 0xC01E000Cu32 as i32; +pub const STATUS_GRAPHICS_WINDOWDC_NOT_AVAILABLE: ::NTSTATUS = 0xC01E000Du32 as i32; +pub const STATUS_GRAPHICS_WINDOWLESS_PRESENT_DISABLED: ::NTSTATUS = 0xC01E000Eu32 as i32; +pub const STATUS_GRAPHICS_NO_VIDEO_MEMORY: ::NTSTATUS = 0xC01E0100u32 as i32; +pub const STATUS_GRAPHICS_CANT_LOCK_MEMORY: ::NTSTATUS = 0xC01E0101u32 as i32; +pub const STATUS_GRAPHICS_ALLOCATION_BUSY: ::NTSTATUS = 0xC01E0102u32 as i32; +pub const STATUS_GRAPHICS_TOO_MANY_REFERENCES: ::NTSTATUS = 0xC01E0103u32 as i32; +pub const STATUS_GRAPHICS_TRY_AGAIN_LATER: ::NTSTATUS = 0xC01E0104u32 as i32; +pub const STATUS_GRAPHICS_TRY_AGAIN_NOW: ::NTSTATUS = 0xC01E0105u32 as i32; +pub const STATUS_GRAPHICS_ALLOCATION_INVALID: ::NTSTATUS = 0xC01E0106u32 as i32; +pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: ::NTSTATUS = 0xC01E0107u32 as i32; +pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: ::NTSTATUS = 0xC01E0108u32 as i32; +pub const STATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: ::NTSTATUS = 0xC01E0109u32 as i32; +pub const STATUS_GRAPHICS_INVALID_ALLOCATION_USAGE: ::NTSTATUS = 0xC01E0110u32 as i32; +pub const STATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: ::NTSTATUS = 0xC01E0111u32 as i32; +pub const STATUS_GRAPHICS_ALLOCATION_CLOSED: ::NTSTATUS = 0xC01E0112u32 as i32; +pub const STATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE: ::NTSTATUS = 0xC01E0113u32 as i32; +pub const STATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE: ::NTSTATUS = 0xC01E0114u32 as i32; +pub const STATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE: ::NTSTATUS = 0xC01E0115u32 as i32; +pub const STATUS_GRAPHICS_ALLOCATION_CONTENT_LOST: ::NTSTATUS = 0xC01E0116u32 as i32; +pub const STATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: ::NTSTATUS = 0xC01E0200u32 as i32; +pub const STATUS_GRAPHICS_SKIP_ALLOCATION_PREPARATION: ::NTSTATUS = 0x401E0201; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY: ::NTSTATUS = 0xC01E0300u32 as i32; +pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0301u32 as i32; +pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0302u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDPN: ::NTSTATUS = 0xC01E0303u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: ::NTSTATUS = 0xC01E0304u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: ::NTSTATUS = 0xC01E0305u32 as i32; +pub const STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0306u32 as i32; +pub const STATUS_GRAPHICS_MODE_NOT_PINNED: ::NTSTATUS = 0x401E0307; +pub const STATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: ::NTSTATUS = 0xC01E0308u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET: ::NTSTATUS = 0xC01E0309u32 as i32; +pub const STATUS_GRAPHICS_INVALID_FREQUENCY: ::NTSTATUS = 0xC01E030Au32 as i32; +pub const STATUS_GRAPHICS_INVALID_ACTIVE_REGION: ::NTSTATUS = 0xC01E030Bu32 as i32; +pub const STATUS_GRAPHICS_INVALID_TOTAL_REGION: ::NTSTATUS = 0xC01E030Cu32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: ::NTSTATUS = 0xC01E0310u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: ::NTSTATUS = 0xC01E0311u32 as i32; +pub const STATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: ::NTSTATUS = 0xC01E0312u32 as i32; +pub const STATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0313u32 as i32; +pub const STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET: ::NTSTATUS = 0xC01E0314u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: ::NTSTATUS = 0xC01E0315u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: ::NTSTATUS = 0xC01E0316u32 as i32; +pub const STATUS_GRAPHICS_SOURCE_ALREADY_IN_SET: ::NTSTATUS = 0xC01E0317u32 as i32; +pub const STATUS_GRAPHICS_TARGET_ALREADY_IN_SET: ::NTSTATUS = 0xC01E0318u32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: ::NTSTATUS = 0xC01E0319u32 as i32; +pub const STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: ::NTSTATUS = 0xC01E031Au32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: ::NTSTATUS = 0xC01E031Bu32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: ::NTSTATUS = 0xC01E031Cu32 as i32; +pub const STATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: ::NTSTATUS = 0xC01E031Du32 as i32; +pub const STATUS_GRAPHICS_NO_PREFERRED_MODE: ::NTSTATUS = 0x401E031E; +pub const STATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: ::NTSTATUS = 0xC01E031Fu32 as i32; +pub const STATUS_GRAPHICS_STALE_MODESET: ::NTSTATUS = 0xC01E0320u32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: ::NTSTATUS = 0xC01E0321u32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: ::NTSTATUS = 0xC01E0322u32 as i32; +pub const STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: ::NTSTATUS = 0xC01E0323u32 as i32; +pub const STATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E0324u32 as i32; +pub const STATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: ::NTSTATUS = 0xC01E0325u32 as i32; +pub const STATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: ::NTSTATUS = 0xC01E0326u32 as i32; +pub const STATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0327u32 as i32; +pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: ::NTSTATUS = 0xC01E0328u32 as i32; +pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: ::NTSTATUS = 0xC01E0329u32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET: ::NTSTATUS = 0xC01E032Au32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR: ::NTSTATUS = 0xC01E032Bu32 as i32; +pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: ::NTSTATUS = 0xC01E032Cu32 as i32; +pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: ::NTSTATUS = 0xC01E032Du32 as i32; +pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E032Eu32 as i32; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: ::NTSTATUS = 0xC01E032Fu32 as i32; +pub const STATUS_GRAPHICS_RESOURCES_NOT_RELATED: ::NTSTATUS = 0xC01E0330u32 as i32; +pub const STATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E0331u32 as i32; +pub const STATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E0332u32 as i32; +pub const STATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: ::NTSTATUS = 0xC01E0333u32 as i32; +pub const STATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: ::NTSTATUS = 0xC01E0334u32 as i32; +pub const STATUS_GRAPHICS_NO_VIDPNMGR: ::NTSTATUS = 0xC01E0335u32 as i32; +pub const STATUS_GRAPHICS_NO_ACTIVE_VIDPN: ::NTSTATUS = 0xC01E0336u32 as i32; +pub const STATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY: ::NTSTATUS = 0xC01E0337u32 as i32; +pub const STATUS_GRAPHICS_MONITOR_NOT_CONNECTED: ::NTSTATUS = 0xC01E0338u32 as i32; +pub const STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0339u32 as i32; +pub const STATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: ::NTSTATUS = 0xC01E033Au32 as i32; +pub const STATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE: ::NTSTATUS = 0xC01E033Bu32 as i32; +pub const STATUS_GRAPHICS_INVALID_STRIDE: ::NTSTATUS = 0xC01E033Cu32 as i32; +pub const STATUS_GRAPHICS_INVALID_PIXELFORMAT: ::NTSTATUS = 0xC01E033Du32 as i32; +pub const STATUS_GRAPHICS_INVALID_COLORBASIS: ::NTSTATUS = 0xC01E033Eu32 as i32; +pub const STATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: ::NTSTATUS = 0xC01E033Fu32 as i32; +pub const STATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0340u32 as i32; +pub const STATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: ::NTSTATUS = 0xC01E0341u32 as i32; +pub const STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: ::NTSTATUS = 0xC01E0342u32 as i32; +pub const STATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: ::NTSTATUS = 0xC01E0343u32 as i32; +pub const STATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: ::NTSTATUS = 0xC01E0344u32 as i32; +pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: ::NTSTATUS = 0xC01E0345u32 as i32; +pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0346u32 as i32; +pub const STATUS_GRAPHICS_INVALID_GAMMA_RAMP: ::NTSTATUS = 0xC01E0347u32 as i32; +pub const STATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0348u32 as i32; +pub const STATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0349u32 as i32; +pub const STATUS_GRAPHICS_MODE_NOT_IN_MODESET: ::NTSTATUS = 0xC01E034Au32 as i32; +pub const STATUS_GRAPHICS_DATASET_IS_EMPTY: ::NTSTATUS = 0x401E034B; +pub const STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: ::NTSTATUS = 0x401E034C; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: ::NTSTATUS = 0xC01E034Du32 as i32; +pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE: ::NTSTATUS = 0xC01E034Eu32 as i32; +pub const STATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE: ::NTSTATUS = 0xC01E034Fu32 as i32; +pub const STATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: ::NTSTATUS = 0xC01E0350u32 as i32; +pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: ::NTSTATUS = 0x401E0351; +pub const STATUS_GRAPHICS_INVALID_SCANLINE_ORDERING: ::NTSTATUS = 0xC01E0352u32 as i32; +pub const STATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: ::NTSTATUS = 0xC01E0353u32 as i32; +pub const STATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: ::NTSTATUS = 0xC01E0354u32 as i32; +pub const STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: ::NTSTATUS = 0xC01E0355u32 as i32; +pub const STATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: ::NTSTATUS = 0xC01E0356u32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: ::NTSTATUS = 0xC01E0357u32 as i32; +pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: ::NTSTATUS = 0xC01E0358u32 as i32; +pub const STATUS_GRAPHICS_MAX_NUM_PATHS_REACHED: ::NTSTATUS = 0xC01E0359u32 as i32; +pub const STATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: ::NTSTATUS = 0xC01E035Au32 as i32; +pub const STATUS_GRAPHICS_INVALID_CLIENT_TYPE: ::NTSTATUS = 0xC01E035Bu32 as i32; +pub const STATUS_GRAPHICS_CLIENTVIDPN_NOT_SET: ::NTSTATUS = 0xC01E035Cu32 as i32; +pub const STATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: ::NTSTATUS = 0xC01E0400u32 as i32; +pub const STATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0401u32 as i32; +pub const STATUS_GRAPHICS_UNKNOWN_CHILD_STATUS: ::NTSTATUS = 0x401E042F; +pub const STATUS_GRAPHICS_NOT_A_LINKED_ADAPTER: ::NTSTATUS = 0xC01E0430u32 as i32; +pub const STATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED: ::NTSTATUS = 0xC01E0431u32 as i32; +pub const STATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: ::NTSTATUS = 0xC01E0432u32 as i32; +pub const STATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY: ::NTSTATUS = 0xC01E0433u32 as i32; +pub const STATUS_GRAPHICS_CHAINLINKS_NOT_STARTED: ::NTSTATUS = 0xC01E0434u32 as i32; +pub const STATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: ::NTSTATUS = 0xC01E0435u32 as i32; +pub const STATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: ::NTSTATUS = 0xC01E0436u32 as i32; +pub const STATUS_GRAPHICS_LEADLINK_START_DEFERRED: ::NTSTATUS = 0x401E0437; +pub const STATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER: ::NTSTATUS = 0xC01E0438u32 as i32; +pub const STATUS_GRAPHICS_POLLING_TOO_FREQUENTLY: ::NTSTATUS = 0x401E0439; +pub const STATUS_GRAPHICS_START_DEFERRED: ::NTSTATUS = 0x401E043A; +pub const STATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: ::NTSTATUS = 0xC01E043Bu32 as i32; +pub const STATUS_GRAPHICS_DEPENDABLE_CHILD_STATUS: ::NTSTATUS = 0x401E043C; +pub const STATUS_GRAPHICS_OPM_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0500u32 as i32; +pub const STATUS_GRAPHICS_COPP_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0501u32 as i32; +pub const STATUS_GRAPHICS_UAB_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0502u32 as i32; +pub const STATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: ::NTSTATUS = 0xC01E0503u32 as i32; +pub const STATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST: ::NTSTATUS = 0xC01E0505u32 as i32; +pub const STATUS_GRAPHICS_OPM_INTERNAL_ERROR: ::NTSTATUS = 0xC01E050Bu32 as i32; +pub const STATUS_GRAPHICS_OPM_INVALID_HANDLE: ::NTSTATUS = 0xC01E050Cu32 as i32; +pub const STATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: ::NTSTATUS = 0xC01E050Eu32 as i32; +pub const STATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED: ::NTSTATUS = 0xC01E050Fu32 as i32; +pub const STATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED: ::NTSTATUS = 0xC01E0510u32 as i32; +pub const STATUS_GRAPHICS_PVP_HFS_FAILED: ::NTSTATUS = 0xC01E0511u32 as i32; +pub const STATUS_GRAPHICS_OPM_INVALID_SRM: ::NTSTATUS = 0xC01E0512u32 as i32; +pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: ::NTSTATUS = 0xC01E0513u32 as i32; +pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: ::NTSTATUS = 0xC01E0514u32 as i32; +pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: ::NTSTATUS = 0xC01E0515u32 as i32; +pub const STATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: ::NTSTATUS = 0xC01E0516u32 as i32; +pub const STATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: ::NTSTATUS = 0xC01E0517u32 as i32; +pub const STATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: ::NTSTATUS = 0xC01E0518u32 as i32; +pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS: ::NTSTATUS = 0xC01E051Au32 as i32; +pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: ::NTSTATUS = 0xC01E051Cu32 as i32; +pub const STATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: ::NTSTATUS = 0xC01E051Du32 as i32; +pub const STATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: ::NTSTATUS = 0xC01E051Eu32 as i32; +pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: ::NTSTATUS = 0xC01E051Fu32 as i32; +pub const STATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0520u32 as i32; +pub const STATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: ::NTSTATUS = 0xC01E0521u32 as i32; +pub const STATUS_GRAPHICS_I2C_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0580u32 as i32; +pub const STATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: ::NTSTATUS = 0xC01E0581u32 as i32; +pub const STATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: ::NTSTATUS = 0xC01E0582u32 as i32; +pub const STATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA: ::NTSTATUS = 0xC01E0583u32 as i32; +pub const STATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0584u32 as i32; +pub const STATUS_GRAPHICS_DDCCI_INVALID_DATA: ::NTSTATUS = 0xC01E0585u32 as i32; +pub const STATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: ::NTSTATUS = 0xC01E0586u32 as i32; +pub const STATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING: ::NTSTATUS = 0xC01E0587u32 as i32; +pub const STATUS_GRAPHICS_MCA_INTERNAL_ERROR: ::NTSTATUS = 0xC01E0588u32 as i32; +pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: ::NTSTATUS = 0xC01E0589u32 as i32; +pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: ::NTSTATUS = 0xC01E058Au32 as i32; +pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: ::NTSTATUS = 0xC01E058Bu32 as i32; +pub const STATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: ::NTSTATUS = 0xC01E058Cu32 as i32; +pub const STATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS: ::NTSTATUS = 0xC01E058Du32 as i32; +pub const STATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: ::NTSTATUS = 0xC01E05E0u32 as i32; +pub const STATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: ::NTSTATUS = 0xC01E05E1u32 as i32; +pub const STATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: ::NTSTATUS = 0xC01E05E2u32 as i32; +pub const STATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: ::NTSTATUS = 0xC01E05E3u32 as i32; +pub const STATUS_GRAPHICS_INVALID_POINTER: ::NTSTATUS = 0xC01E05E4u32 as i32; +pub const STATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: ::NTSTATUS = 0xC01E05E5u32 as i32; +pub const STATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: ::NTSTATUS = 0xC01E05E6u32 as i32; +pub const STATUS_GRAPHICS_INTERNAL_ERROR: ::NTSTATUS = 0xC01E05E7u32 as i32; +pub const STATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: ::NTSTATUS = 0xC01E05E8u32 as i32; +pub const STATUS_FVE_LOCKED_VOLUME: ::NTSTATUS = 0xC0210000u32 as i32; +pub const STATUS_FVE_NOT_ENCRYPTED: ::NTSTATUS = 0xC0210001u32 as i32; +pub const STATUS_FVE_BAD_INFORMATION: ::NTSTATUS = 0xC0210002u32 as i32; +pub const STATUS_FVE_TOO_SMALL: ::NTSTATUS = 0xC0210003u32 as i32; +pub const STATUS_FVE_FAILED_WRONG_FS: ::NTSTATUS = 0xC0210004u32 as i32; +pub const STATUS_FVE_BAD_PARTITION_SIZE: ::NTSTATUS = 0xC0210005u32 as i32; +pub const STATUS_FVE_FS_NOT_EXTENDED: ::NTSTATUS = 0xC0210006u32 as i32; +pub const STATUS_FVE_FS_MOUNTED: ::NTSTATUS = 0xC0210007u32 as i32; +pub const STATUS_FVE_NO_LICENSE: ::NTSTATUS = 0xC0210008u32 as i32; +pub const STATUS_FVE_ACTION_NOT_ALLOWED: ::NTSTATUS = 0xC0210009u32 as i32; +pub const STATUS_FVE_BAD_DATA: ::NTSTATUS = 0xC021000Au32 as i32; +pub const STATUS_FVE_VOLUME_NOT_BOUND: ::NTSTATUS = 0xC021000Bu32 as i32; +pub const STATUS_FVE_NOT_DATA_VOLUME: ::NTSTATUS = 0xC021000Cu32 as i32; +pub const STATUS_FVE_CONV_READ_ERROR: ::NTSTATUS = 0xC021000Du32 as i32; +pub const STATUS_FVE_CONV_WRITE_ERROR: ::NTSTATUS = 0xC021000Eu32 as i32; +pub const STATUS_FVE_OVERLAPPED_UPDATE: ::NTSTATUS = 0xC021000Fu32 as i32; +pub const STATUS_FVE_FAILED_SECTOR_SIZE: ::NTSTATUS = 0xC0210010u32 as i32; +pub const STATUS_FVE_FAILED_AUTHENTICATION: ::NTSTATUS = 0xC0210011u32 as i32; +pub const STATUS_FVE_NOT_OS_VOLUME: ::NTSTATUS = 0xC0210012u32 as i32; +pub const STATUS_FVE_KEYFILE_NOT_FOUND: ::NTSTATUS = 0xC0210013u32 as i32; +pub const STATUS_FVE_KEYFILE_INVALID: ::NTSTATUS = 0xC0210014u32 as i32; +pub const STATUS_FVE_KEYFILE_NO_VMK: ::NTSTATUS = 0xC0210015u32 as i32; +pub const STATUS_FVE_TPM_DISABLED: ::NTSTATUS = 0xC0210016u32 as i32; +pub const STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO: ::NTSTATUS = 0xC0210017u32 as i32; +pub const STATUS_FVE_TPM_INVALID_PCR: ::NTSTATUS = 0xC0210018u32 as i32; +pub const STATUS_FVE_TPM_NO_VMK: ::NTSTATUS = 0xC0210019u32 as i32; +pub const STATUS_FVE_PIN_INVALID: ::NTSTATUS = 0xC021001Au32 as i32; +pub const STATUS_FVE_AUTH_INVALID_APPLICATION: ::NTSTATUS = 0xC021001Bu32 as i32; +pub const STATUS_FVE_AUTH_INVALID_CONFIG: ::NTSTATUS = 0xC021001Cu32 as i32; +pub const STATUS_FVE_DEBUGGER_ENABLED: ::NTSTATUS = 0xC021001Du32 as i32; +pub const STATUS_FVE_DRY_RUN_FAILED: ::NTSTATUS = 0xC021001Eu32 as i32; +pub const STATUS_FVE_BAD_METADATA_POINTER: ::NTSTATUS = 0xC021001Fu32 as i32; +pub const STATUS_FVE_OLD_METADATA_COPY: ::NTSTATUS = 0xC0210020u32 as i32; +pub const STATUS_FVE_REBOOT_REQUIRED: ::NTSTATUS = 0xC0210021u32 as i32; +pub const STATUS_FVE_RAW_ACCESS: ::NTSTATUS = 0xC0210022u32 as i32; +pub const STATUS_FVE_RAW_BLOCKED: ::NTSTATUS = 0xC0210023u32 as i32; +pub const STATUS_FVE_NO_AUTOUNLOCK_MASTER_KEY: ::NTSTATUS = 0xC0210024u32 as i32; +pub const STATUS_FVE_MOR_FAILED: ::NTSTATUS = 0xC0210025u32 as i32; +pub const STATUS_FVE_NO_FEATURE_LICENSE: ::NTSTATUS = 0xC0210026u32 as i32; +pub const STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: ::NTSTATUS = 0xC0210027u32 as i32; +pub const STATUS_FVE_CONV_RECOVERY_FAILED: ::NTSTATUS = 0xC0210028u32 as i32; +pub const STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG: ::NTSTATUS = 0xC0210029u32 as i32; +pub const STATUS_FVE_INVALID_DATUM_TYPE: ::NTSTATUS = 0xC021002Au32 as i32; +pub const STATUS_FVE_VOLUME_TOO_SMALL: ::NTSTATUS = 0xC0210030u32 as i32; +pub const STATUS_FVE_ENH_PIN_INVALID: ::NTSTATUS = 0xC0210031u32 as i32; +pub const STATUS_FVE_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE: ::NTSTATUS = 0xC0210032u32 as i32; +pub const STATUS_FVE_WIPE_NOT_ALLOWED_ON_TP_STORAGE: ::NTSTATUS = 0xC0210033u32 as i32; +pub const STATUS_FVE_NOT_ALLOWED_ON_CSV_STACK: ::NTSTATUS = 0xC0210034u32 as i32; +pub const STATUS_FVE_NOT_ALLOWED_ON_CLUSTER: ::NTSTATUS = 0xC0210035u32 as i32; +pub const STATUS_FVE_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING: ::NTSTATUS = 0xC0210036u32 as i32; +pub const STATUS_FVE_WIPE_CANCEL_NOT_APPLICABLE: ::NTSTATUS = 0xC0210037u32 as i32; +pub const STATUS_FVE_EDRIVE_DRY_RUN_FAILED: ::NTSTATUS = 0xC0210038u32 as i32; +pub const STATUS_FVE_SECUREBOOT_DISABLED: ::NTSTATUS = 0xC0210039u32 as i32; +pub const STATUS_FVE_SECUREBOOT_CONFIG_CHANGE: ::NTSTATUS = 0xC021003Au32 as i32; +pub const STATUS_FVE_DEVICE_LOCKEDOUT: ::NTSTATUS = 0xC021003Bu32 as i32; +pub const STATUS_FVE_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT: ::NTSTATUS = 0xC021003Cu32 as i32; +pub const STATUS_FVE_NOT_DE_VOLUME: ::NTSTATUS = 0xC021003Du32 as i32; +pub const STATUS_FVE_PROTECTION_DISABLED: ::NTSTATUS = 0xC021003Eu32 as i32; +pub const STATUS_FVE_PROTECTION_CANNOT_BE_DISABLED: ::NTSTATUS = 0xC021003Fu32 as i32; +pub const STATUS_FWP_CALLOUT_NOT_FOUND: ::NTSTATUS = 0xC0220001u32 as i32; +pub const STATUS_FWP_CONDITION_NOT_FOUND: ::NTSTATUS = 0xC0220002u32 as i32; +pub const STATUS_FWP_FILTER_NOT_FOUND: ::NTSTATUS = 0xC0220003u32 as i32; +pub const STATUS_FWP_LAYER_NOT_FOUND: ::NTSTATUS = 0xC0220004u32 as i32; +pub const STATUS_FWP_PROVIDER_NOT_FOUND: ::NTSTATUS = 0xC0220005u32 as i32; +pub const STATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND: ::NTSTATUS = 0xC0220006u32 as i32; +pub const STATUS_FWP_SUBLAYER_NOT_FOUND: ::NTSTATUS = 0xC0220007u32 as i32; +pub const STATUS_FWP_NOT_FOUND: ::NTSTATUS = 0xC0220008u32 as i32; +pub const STATUS_FWP_ALREADY_EXISTS: ::NTSTATUS = 0xC0220009u32 as i32; +pub const STATUS_FWP_IN_USE: ::NTSTATUS = 0xC022000Au32 as i32; +pub const STATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS: ::NTSTATUS = 0xC022000Bu32 as i32; +pub const STATUS_FWP_WRONG_SESSION: ::NTSTATUS = 0xC022000Cu32 as i32; +pub const STATUS_FWP_NO_TXN_IN_PROGRESS: ::NTSTATUS = 0xC022000Du32 as i32; +pub const STATUS_FWP_TXN_IN_PROGRESS: ::NTSTATUS = 0xC022000Eu32 as i32; +pub const STATUS_FWP_TXN_ABORTED: ::NTSTATUS = 0xC022000Fu32 as i32; +pub const STATUS_FWP_SESSION_ABORTED: ::NTSTATUS = 0xC0220010u32 as i32; +pub const STATUS_FWP_INCOMPATIBLE_TXN: ::NTSTATUS = 0xC0220011u32 as i32; +pub const STATUS_FWP_TIMEOUT: ::NTSTATUS = 0xC0220012u32 as i32; +pub const STATUS_FWP_NET_EVENTS_DISABLED: ::NTSTATUS = 0xC0220013u32 as i32; +pub const STATUS_FWP_INCOMPATIBLE_LAYER: ::NTSTATUS = 0xC0220014u32 as i32; +pub const STATUS_FWP_KM_CLIENTS_ONLY: ::NTSTATUS = 0xC0220015u32 as i32; +pub const STATUS_FWP_LIFETIME_MISMATCH: ::NTSTATUS = 0xC0220016u32 as i32; +pub const STATUS_FWP_BUILTIN_OBJECT: ::NTSTATUS = 0xC0220017u32 as i32; +pub const STATUS_FWP_TOO_MANY_CALLOUTS: ::NTSTATUS = 0xC0220018u32 as i32; +pub const STATUS_FWP_NOTIFICATION_DROPPED: ::NTSTATUS = 0xC0220019u32 as i32; +pub const STATUS_FWP_TRAFFIC_MISMATCH: ::NTSTATUS = 0xC022001Au32 as i32; +pub const STATUS_FWP_INCOMPATIBLE_SA_STATE: ::NTSTATUS = 0xC022001Bu32 as i32; +pub const STATUS_FWP_NULL_POINTER: ::NTSTATUS = 0xC022001Cu32 as i32; +pub const STATUS_FWP_INVALID_ENUMERATOR: ::NTSTATUS = 0xC022001Du32 as i32; +pub const STATUS_FWP_INVALID_FLAGS: ::NTSTATUS = 0xC022001Eu32 as i32; +pub const STATUS_FWP_INVALID_NET_MASK: ::NTSTATUS = 0xC022001Fu32 as i32; +pub const STATUS_FWP_INVALID_RANGE: ::NTSTATUS = 0xC0220020u32 as i32; +pub const STATUS_FWP_INVALID_INTERVAL: ::NTSTATUS = 0xC0220021u32 as i32; +pub const STATUS_FWP_ZERO_LENGTH_ARRAY: ::NTSTATUS = 0xC0220022u32 as i32; +pub const STATUS_FWP_NULL_DISPLAY_NAME: ::NTSTATUS = 0xC0220023u32 as i32; +pub const STATUS_FWP_INVALID_ACTION_TYPE: ::NTSTATUS = 0xC0220024u32 as i32; +pub const STATUS_FWP_INVALID_WEIGHT: ::NTSTATUS = 0xC0220025u32 as i32; +pub const STATUS_FWP_MATCH_TYPE_MISMATCH: ::NTSTATUS = 0xC0220026u32 as i32; +pub const STATUS_FWP_TYPE_MISMATCH: ::NTSTATUS = 0xC0220027u32 as i32; +pub const STATUS_FWP_OUT_OF_BOUNDS: ::NTSTATUS = 0xC0220028u32 as i32; +pub const STATUS_FWP_RESERVED: ::NTSTATUS = 0xC0220029u32 as i32; +pub const STATUS_FWP_DUPLICATE_CONDITION: ::NTSTATUS = 0xC022002Au32 as i32; +pub const STATUS_FWP_DUPLICATE_KEYMOD: ::NTSTATUS = 0xC022002Bu32 as i32; +pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER: ::NTSTATUS = 0xC022002Cu32 as i32; +pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER: ::NTSTATUS = 0xC022002Du32 as i32; +pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER: ::NTSTATUS = 0xC022002Eu32 as i32; +pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: ::NTSTATUS = 0xC022002Fu32 as i32; +pub const STATUS_FWP_INCOMPATIBLE_AUTH_METHOD: ::NTSTATUS = 0xC0220030u32 as i32; +pub const STATUS_FWP_INCOMPATIBLE_DH_GROUP: ::NTSTATUS = 0xC0220031u32 as i32; +pub const STATUS_FWP_EM_NOT_SUPPORTED: ::NTSTATUS = 0xC0220032u32 as i32; +pub const STATUS_FWP_NEVER_MATCH: ::NTSTATUS = 0xC0220033u32 as i32; +pub const STATUS_FWP_PROVIDER_CONTEXT_MISMATCH: ::NTSTATUS = 0xC0220034u32 as i32; +pub const STATUS_FWP_INVALID_PARAMETER: ::NTSTATUS = 0xC0220035u32 as i32; +pub const STATUS_FWP_TOO_MANY_SUBLAYERS: ::NTSTATUS = 0xC0220036u32 as i32; +pub const STATUS_FWP_CALLOUT_NOTIFICATION_FAILED: ::NTSTATUS = 0xC0220037u32 as i32; +pub const STATUS_FWP_INVALID_AUTH_TRANSFORM: ::NTSTATUS = 0xC0220038u32 as i32; +pub const STATUS_FWP_INVALID_CIPHER_TRANSFORM: ::NTSTATUS = 0xC0220039u32 as i32; +pub const STATUS_FWP_INCOMPATIBLE_CIPHER_TRANSFORM: ::NTSTATUS = 0xC022003Au32 as i32; +pub const STATUS_FWP_INVALID_TRANSFORM_COMBINATION: ::NTSTATUS = 0xC022003Bu32 as i32; +pub const STATUS_FWP_DUPLICATE_AUTH_METHOD: ::NTSTATUS = 0xC022003Cu32 as i32; +pub const STATUS_FWP_INVALID_TUNNEL_ENDPOINT: ::NTSTATUS = 0xC022003Du32 as i32; +pub const STATUS_FWP_L2_DRIVER_NOT_READY: ::NTSTATUS = 0xC022003Eu32 as i32; +pub const STATUS_FWP_KEY_DICTATOR_ALREADY_REGISTERED: ::NTSTATUS = 0xC022003Fu32 as i32; +pub const STATUS_FWP_KEY_DICTATION_INVALID_KEYING_MATERIAL: ::NTSTATUS = 0xC0220040u32 as i32; +pub const STATUS_FWP_CONNECTIONS_DISABLED: ::NTSTATUS = 0xC0220041u32 as i32; +pub const STATUS_FWP_INVALID_DNS_NAME: ::NTSTATUS = 0xC0220042u32 as i32; +pub const STATUS_FWP_STILL_ON: ::NTSTATUS = 0xC0220043u32 as i32; +pub const STATUS_FWP_IKEEXT_NOT_RUNNING: ::NTSTATUS = 0xC0220044u32 as i32; +pub const STATUS_FWP_TCPIP_NOT_READY: ::NTSTATUS = 0xC0220100u32 as i32; +pub const STATUS_FWP_INJECT_HANDLE_CLOSING: ::NTSTATUS = 0xC0220101u32 as i32; +pub const STATUS_FWP_INJECT_HANDLE_STALE: ::NTSTATUS = 0xC0220102u32 as i32; +pub const STATUS_FWP_CANNOT_PEND: ::NTSTATUS = 0xC0220103u32 as i32; +pub const STATUS_FWP_DROP_NOICMP: ::NTSTATUS = 0xC0220104u32 as i32; +pub const STATUS_NDIS_CLOSING: ::NTSTATUS = 0xC0230002u32 as i32; +pub const STATUS_NDIS_BAD_VERSION: ::NTSTATUS = 0xC0230004u32 as i32; +pub const STATUS_NDIS_BAD_CHARACTERISTICS: ::NTSTATUS = 0xC0230005u32 as i32; +pub const STATUS_NDIS_ADAPTER_NOT_FOUND: ::NTSTATUS = 0xC0230006u32 as i32; +pub const STATUS_NDIS_OPEN_FAILED: ::NTSTATUS = 0xC0230007u32 as i32; +pub const STATUS_NDIS_DEVICE_FAILED: ::NTSTATUS = 0xC0230008u32 as i32; +pub const STATUS_NDIS_MULTICAST_FULL: ::NTSTATUS = 0xC0230009u32 as i32; +pub const STATUS_NDIS_MULTICAST_EXISTS: ::NTSTATUS = 0xC023000Au32 as i32; +pub const STATUS_NDIS_MULTICAST_NOT_FOUND: ::NTSTATUS = 0xC023000Bu32 as i32; +pub const STATUS_NDIS_REQUEST_ABORTED: ::NTSTATUS = 0xC023000Cu32 as i32; +pub const STATUS_NDIS_RESET_IN_PROGRESS: ::NTSTATUS = 0xC023000Du32 as i32; +pub const STATUS_NDIS_NOT_SUPPORTED: ::NTSTATUS = 0xC02300BBu32 as i32; +pub const STATUS_NDIS_INVALID_PACKET: ::NTSTATUS = 0xC023000Fu32 as i32; +pub const STATUS_NDIS_ADAPTER_NOT_READY: ::NTSTATUS = 0xC0230011u32 as i32; +pub const STATUS_NDIS_INVALID_LENGTH: ::NTSTATUS = 0xC0230014u32 as i32; +pub const STATUS_NDIS_INVALID_DATA: ::NTSTATUS = 0xC0230015u32 as i32; +pub const STATUS_NDIS_BUFFER_TOO_SHORT: ::NTSTATUS = 0xC0230016u32 as i32; +pub const STATUS_NDIS_INVALID_OID: ::NTSTATUS = 0xC0230017u32 as i32; +pub const STATUS_NDIS_ADAPTER_REMOVED: ::NTSTATUS = 0xC0230018u32 as i32; +pub const STATUS_NDIS_UNSUPPORTED_MEDIA: ::NTSTATUS = 0xC0230019u32 as i32; +pub const STATUS_NDIS_GROUP_ADDRESS_IN_USE: ::NTSTATUS = 0xC023001Au32 as i32; +pub const STATUS_NDIS_FILE_NOT_FOUND: ::NTSTATUS = 0xC023001Bu32 as i32; +pub const STATUS_NDIS_ERROR_READING_FILE: ::NTSTATUS = 0xC023001Cu32 as i32; +pub const STATUS_NDIS_ALREADY_MAPPED: ::NTSTATUS = 0xC023001Du32 as i32; +pub const STATUS_NDIS_RESOURCE_CONFLICT: ::NTSTATUS = 0xC023001Eu32 as i32; +pub const STATUS_NDIS_MEDIA_DISCONNECTED: ::NTSTATUS = 0xC023001Fu32 as i32; +pub const STATUS_NDIS_INVALID_ADDRESS: ::NTSTATUS = 0xC0230022u32 as i32; +pub const STATUS_NDIS_INVALID_DEVICE_REQUEST: ::NTSTATUS = 0xC0230010u32 as i32; +pub const STATUS_NDIS_PAUSED: ::NTSTATUS = 0xC023002Au32 as i32; +pub const STATUS_NDIS_INTERFACE_NOT_FOUND: ::NTSTATUS = 0xC023002Bu32 as i32; +pub const STATUS_NDIS_UNSUPPORTED_REVISION: ::NTSTATUS = 0xC023002Cu32 as i32; +pub const STATUS_NDIS_INVALID_PORT: ::NTSTATUS = 0xC023002Du32 as i32; +pub const STATUS_NDIS_INVALID_PORT_STATE: ::NTSTATUS = 0xC023002Eu32 as i32; +pub const STATUS_NDIS_LOW_POWER_STATE: ::NTSTATUS = 0xC023002Fu32 as i32; +pub const STATUS_NDIS_REINIT_REQUIRED: ::NTSTATUS = 0xC0230030u32 as i32; +pub const STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED: ::NTSTATUS = 0xC0232000u32 as i32; +pub const STATUS_NDIS_DOT11_MEDIA_IN_USE: ::NTSTATUS = 0xC0232001u32 as i32; +pub const STATUS_NDIS_DOT11_POWER_STATE_INVALID: ::NTSTATUS = 0xC0232002u32 as i32; +pub const STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL: ::NTSTATUS = 0xC0232003u32 as i32; +pub const STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: ::NTSTATUS = 0xC0232004u32 as i32; +pub const STATUS_NDIS_INDICATION_REQUIRED: ::NTSTATUS = 0x40230001; +pub const STATUS_NDIS_OFFLOAD_POLICY: ::NTSTATUS = 0xC023100Fu32 as i32; +pub const STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED: ::NTSTATUS = 0xC0231012u32 as i32; +pub const STATUS_NDIS_OFFLOAD_PATH_REJECTED: ::NTSTATUS = 0xC0231013u32 as i32; +pub const STATUS_TPM_ERROR_MASK: ::NTSTATUS = 0xC0290000u32 as i32; +pub const STATUS_TPM_AUTHFAIL: ::NTSTATUS = 0xC0290001u32 as i32; +pub const STATUS_TPM_BADINDEX: ::NTSTATUS = 0xC0290002u32 as i32; +pub const STATUS_TPM_BAD_PARAMETER: ::NTSTATUS = 0xC0290003u32 as i32; +pub const STATUS_TPM_AUDITFAILURE: ::NTSTATUS = 0xC0290004u32 as i32; +pub const STATUS_TPM_CLEAR_DISABLED: ::NTSTATUS = 0xC0290005u32 as i32; +pub const STATUS_TPM_DEACTIVATED: ::NTSTATUS = 0xC0290006u32 as i32; +pub const STATUS_TPM_DISABLED: ::NTSTATUS = 0xC0290007u32 as i32; +pub const STATUS_TPM_DISABLED_CMD: ::NTSTATUS = 0xC0290008u32 as i32; +pub const STATUS_TPM_FAIL: ::NTSTATUS = 0xC0290009u32 as i32; +pub const STATUS_TPM_BAD_ORDINAL: ::NTSTATUS = 0xC029000Au32 as i32; +pub const STATUS_TPM_INSTALL_DISABLED: ::NTSTATUS = 0xC029000Bu32 as i32; +pub const STATUS_TPM_INVALID_KEYHANDLE: ::NTSTATUS = 0xC029000Cu32 as i32; +pub const STATUS_TPM_KEYNOTFOUND: ::NTSTATUS = 0xC029000Du32 as i32; +pub const STATUS_TPM_INAPPROPRIATE_ENC: ::NTSTATUS = 0xC029000Eu32 as i32; +pub const STATUS_TPM_MIGRATEFAIL: ::NTSTATUS = 0xC029000Fu32 as i32; +pub const STATUS_TPM_INVALID_PCR_INFO: ::NTSTATUS = 0xC0290010u32 as i32; +pub const STATUS_TPM_NOSPACE: ::NTSTATUS = 0xC0290011u32 as i32; +pub const STATUS_TPM_NOSRK: ::NTSTATUS = 0xC0290012u32 as i32; +pub const STATUS_TPM_NOTSEALED_BLOB: ::NTSTATUS = 0xC0290013u32 as i32; +pub const STATUS_TPM_OWNER_SET: ::NTSTATUS = 0xC0290014u32 as i32; +pub const STATUS_TPM_RESOURCES: ::NTSTATUS = 0xC0290015u32 as i32; +pub const STATUS_TPM_SHORTRANDOM: ::NTSTATUS = 0xC0290016u32 as i32; +pub const STATUS_TPM_SIZE: ::NTSTATUS = 0xC0290017u32 as i32; +pub const STATUS_TPM_WRONGPCRVAL: ::NTSTATUS = 0xC0290018u32 as i32; +pub const STATUS_TPM_BAD_PARAM_SIZE: ::NTSTATUS = 0xC0290019u32 as i32; +pub const STATUS_TPM_SHA_THREAD: ::NTSTATUS = 0xC029001Au32 as i32; +pub const STATUS_TPM_SHA_ERROR: ::NTSTATUS = 0xC029001Bu32 as i32; +pub const STATUS_TPM_FAILEDSELFTEST: ::NTSTATUS = 0xC029001Cu32 as i32; +pub const STATUS_TPM_AUTH2FAIL: ::NTSTATUS = 0xC029001Du32 as i32; +pub const STATUS_TPM_BADTAG: ::NTSTATUS = 0xC029001Eu32 as i32; +pub const STATUS_TPM_IOERROR: ::NTSTATUS = 0xC029001Fu32 as i32; +pub const STATUS_TPM_ENCRYPT_ERROR: ::NTSTATUS = 0xC0290020u32 as i32; +pub const STATUS_TPM_DECRYPT_ERROR: ::NTSTATUS = 0xC0290021u32 as i32; +pub const STATUS_TPM_INVALID_AUTHHANDLE: ::NTSTATUS = 0xC0290022u32 as i32; +pub const STATUS_TPM_NO_ENDORSEMENT: ::NTSTATUS = 0xC0290023u32 as i32; +pub const STATUS_TPM_INVALID_KEYUSAGE: ::NTSTATUS = 0xC0290024u32 as i32; +pub const STATUS_TPM_WRONG_ENTITYTYPE: ::NTSTATUS = 0xC0290025u32 as i32; +pub const STATUS_TPM_INVALID_POSTINIT: ::NTSTATUS = 0xC0290026u32 as i32; +pub const STATUS_TPM_INAPPROPRIATE_SIG: ::NTSTATUS = 0xC0290027u32 as i32; +pub const STATUS_TPM_BAD_KEY_PROPERTY: ::NTSTATUS = 0xC0290028u32 as i32; +pub const STATUS_TPM_BAD_MIGRATION: ::NTSTATUS = 0xC0290029u32 as i32; +pub const STATUS_TPM_BAD_SCHEME: ::NTSTATUS = 0xC029002Au32 as i32; +pub const STATUS_TPM_BAD_DATASIZE: ::NTSTATUS = 0xC029002Bu32 as i32; +pub const STATUS_TPM_BAD_MODE: ::NTSTATUS = 0xC029002Cu32 as i32; +pub const STATUS_TPM_BAD_PRESENCE: ::NTSTATUS = 0xC029002Du32 as i32; +pub const STATUS_TPM_BAD_VERSION: ::NTSTATUS = 0xC029002Eu32 as i32; +pub const STATUS_TPM_NO_WRAP_TRANSPORT: ::NTSTATUS = 0xC029002Fu32 as i32; +pub const STATUS_TPM_AUDITFAIL_UNSUCCESSFUL: ::NTSTATUS = 0xC0290030u32 as i32; +pub const STATUS_TPM_AUDITFAIL_SUCCESSFUL: ::NTSTATUS = 0xC0290031u32 as i32; +pub const STATUS_TPM_NOTRESETABLE: ::NTSTATUS = 0xC0290032u32 as i32; +pub const STATUS_TPM_NOTLOCAL: ::NTSTATUS = 0xC0290033u32 as i32; +pub const STATUS_TPM_BAD_TYPE: ::NTSTATUS = 0xC0290034u32 as i32; +pub const STATUS_TPM_INVALID_RESOURCE: ::NTSTATUS = 0xC0290035u32 as i32; +pub const STATUS_TPM_NOTFIPS: ::NTSTATUS = 0xC0290036u32 as i32; +pub const STATUS_TPM_INVALID_FAMILY: ::NTSTATUS = 0xC0290037u32 as i32; +pub const STATUS_TPM_NO_NV_PERMISSION: ::NTSTATUS = 0xC0290038u32 as i32; +pub const STATUS_TPM_REQUIRES_SIGN: ::NTSTATUS = 0xC0290039u32 as i32; +pub const STATUS_TPM_KEY_NOTSUPPORTED: ::NTSTATUS = 0xC029003Au32 as i32; +pub const STATUS_TPM_AUTH_CONFLICT: ::NTSTATUS = 0xC029003Bu32 as i32; +pub const STATUS_TPM_AREA_LOCKED: ::NTSTATUS = 0xC029003Cu32 as i32; +pub const STATUS_TPM_BAD_LOCALITY: ::NTSTATUS = 0xC029003Du32 as i32; +pub const STATUS_TPM_READ_ONLY: ::NTSTATUS = 0xC029003Eu32 as i32; +pub const STATUS_TPM_PER_NOWRITE: ::NTSTATUS = 0xC029003Fu32 as i32; +pub const STATUS_TPM_FAMILYCOUNT: ::NTSTATUS = 0xC0290040u32 as i32; +pub const STATUS_TPM_WRITE_LOCKED: ::NTSTATUS = 0xC0290041u32 as i32; +pub const STATUS_TPM_BAD_ATTRIBUTES: ::NTSTATUS = 0xC0290042u32 as i32; +pub const STATUS_TPM_INVALID_STRUCTURE: ::NTSTATUS = 0xC0290043u32 as i32; +pub const STATUS_TPM_KEY_OWNER_CONTROL: ::NTSTATUS = 0xC0290044u32 as i32; +pub const STATUS_TPM_BAD_COUNTER: ::NTSTATUS = 0xC0290045u32 as i32; +pub const STATUS_TPM_NOT_FULLWRITE: ::NTSTATUS = 0xC0290046u32 as i32; +pub const STATUS_TPM_CONTEXT_GAP: ::NTSTATUS = 0xC0290047u32 as i32; +pub const STATUS_TPM_MAXNVWRITES: ::NTSTATUS = 0xC0290048u32 as i32; +pub const STATUS_TPM_NOOPERATOR: ::NTSTATUS = 0xC0290049u32 as i32; +pub const STATUS_TPM_RESOURCEMISSING: ::NTSTATUS = 0xC029004Au32 as i32; +pub const STATUS_TPM_DELEGATE_LOCK: ::NTSTATUS = 0xC029004Bu32 as i32; +pub const STATUS_TPM_DELEGATE_FAMILY: ::NTSTATUS = 0xC029004Cu32 as i32; +pub const STATUS_TPM_DELEGATE_ADMIN: ::NTSTATUS = 0xC029004Du32 as i32; +pub const STATUS_TPM_TRANSPORT_NOTEXCLUSIVE: ::NTSTATUS = 0xC029004Eu32 as i32; +pub const STATUS_TPM_OWNER_CONTROL: ::NTSTATUS = 0xC029004Fu32 as i32; +pub const STATUS_TPM_DAA_RESOURCES: ::NTSTATUS = 0xC0290050u32 as i32; +pub const STATUS_TPM_DAA_INPUT_DATA0: ::NTSTATUS = 0xC0290051u32 as i32; +pub const STATUS_TPM_DAA_INPUT_DATA1: ::NTSTATUS = 0xC0290052u32 as i32; +pub const STATUS_TPM_DAA_ISSUER_SETTINGS: ::NTSTATUS = 0xC0290053u32 as i32; +pub const STATUS_TPM_DAA_TPM_SETTINGS: ::NTSTATUS = 0xC0290054u32 as i32; +pub const STATUS_TPM_DAA_STAGE: ::NTSTATUS = 0xC0290055u32 as i32; +pub const STATUS_TPM_DAA_ISSUER_VALIDITY: ::NTSTATUS = 0xC0290056u32 as i32; +pub const STATUS_TPM_DAA_WRONG_W: ::NTSTATUS = 0xC0290057u32 as i32; +pub const STATUS_TPM_BAD_HANDLE: ::NTSTATUS = 0xC0290058u32 as i32; +pub const STATUS_TPM_BAD_DELEGATE: ::NTSTATUS = 0xC0290059u32 as i32; +pub const STATUS_TPM_BADCONTEXT: ::NTSTATUS = 0xC029005Au32 as i32; +pub const STATUS_TPM_TOOMANYCONTEXTS: ::NTSTATUS = 0xC029005Bu32 as i32; +pub const STATUS_TPM_MA_TICKET_SIGNATURE: ::NTSTATUS = 0xC029005Cu32 as i32; +pub const STATUS_TPM_MA_DESTINATION: ::NTSTATUS = 0xC029005Du32 as i32; +pub const STATUS_TPM_MA_SOURCE: ::NTSTATUS = 0xC029005Eu32 as i32; +pub const STATUS_TPM_MA_AUTHORITY: ::NTSTATUS = 0xC029005Fu32 as i32; +pub const STATUS_TPM_PERMANENTEK: ::NTSTATUS = 0xC0290061u32 as i32; +pub const STATUS_TPM_BAD_SIGNATURE: ::NTSTATUS = 0xC0290062u32 as i32; +pub const STATUS_TPM_NOCONTEXTSPACE: ::NTSTATUS = 0xC0290063u32 as i32; +pub const STATUS_TPM_COMMAND_BLOCKED: ::NTSTATUS = 0xC0290400u32 as i32; +pub const STATUS_TPM_INVALID_HANDLE: ::NTSTATUS = 0xC0290401u32 as i32; +pub const STATUS_TPM_DUPLICATE_VHANDLE: ::NTSTATUS = 0xC0290402u32 as i32; +pub const STATUS_TPM_EMBEDDED_COMMAND_BLOCKED: ::NTSTATUS = 0xC0290403u32 as i32; +pub const STATUS_TPM_EMBEDDED_COMMAND_UNSUPPORTED: ::NTSTATUS = 0xC0290404u32 as i32; +pub const STATUS_TPM_RETRY: ::NTSTATUS = 0xC0290800u32 as i32; +pub const STATUS_TPM_NEEDS_SELFTEST: ::NTSTATUS = 0xC0290801u32 as i32; +pub const STATUS_TPM_DOING_SELFTEST: ::NTSTATUS = 0xC0290802u32 as i32; +pub const STATUS_TPM_DEFEND_LOCK_RUNNING: ::NTSTATUS = 0xC0290803u32 as i32; +pub const STATUS_TPM_COMMAND_CANCELED: ::NTSTATUS = 0xC0291001u32 as i32; +pub const STATUS_TPM_TOO_MANY_CONTEXTS: ::NTSTATUS = 0xC0291002u32 as i32; +pub const STATUS_TPM_NOT_FOUND: ::NTSTATUS = 0xC0291003u32 as i32; +pub const STATUS_TPM_ACCESS_DENIED: ::NTSTATUS = 0xC0291004u32 as i32; +pub const STATUS_TPM_INSUFFICIENT_BUFFER: ::NTSTATUS = 0xC0291005u32 as i32; +pub const STATUS_TPM_PPI_FUNCTION_UNSUPPORTED: ::NTSTATUS = 0xC0291006u32 as i32; +pub const STATUS_PCP_ERROR_MASK: ::NTSTATUS = 0xC0292000u32 as i32; +pub const STATUS_PCP_DEVICE_NOT_READY: ::NTSTATUS = 0xC0292001u32 as i32; +pub const STATUS_PCP_INVALID_HANDLE: ::NTSTATUS = 0xC0292002u32 as i32; +pub const STATUS_PCP_INVALID_PARAMETER: ::NTSTATUS = 0xC0292003u32 as i32; +pub const STATUS_PCP_FLAG_NOT_SUPPORTED: ::NTSTATUS = 0xC0292004u32 as i32; +pub const STATUS_PCP_NOT_SUPPORTED: ::NTSTATUS = 0xC0292005u32 as i32; +pub const STATUS_PCP_BUFFER_TOO_SMALL: ::NTSTATUS = 0xC0292006u32 as i32; +pub const STATUS_PCP_INTERNAL_ERROR: ::NTSTATUS = 0xC0292007u32 as i32; +pub const STATUS_PCP_AUTHENTICATION_FAILED: ::NTSTATUS = 0xC0292008u32 as i32; +pub const STATUS_PCP_AUTHENTICATION_IGNORED: ::NTSTATUS = 0xC0292009u32 as i32; +pub const STATUS_PCP_POLICY_NOT_FOUND: ::NTSTATUS = 0xC029200Au32 as i32; +pub const STATUS_PCP_PROFILE_NOT_FOUND: ::NTSTATUS = 0xC029200Bu32 as i32; +pub const STATUS_PCP_VALIDATION_FAILED: ::NTSTATUS = 0xC029200Cu32 as i32; +pub const STATUS_PCP_DEVICE_NOT_FOUND: ::NTSTATUS = 0xC029200Du32 as i32; +pub const STATUS_RTPM_CONTEXT_CONTINUE: ::NTSTATUS = 0x00293000; +pub const STATUS_RTPM_CONTEXT_COMPLETE: ::NTSTATUS = 0x00293001; +pub const STATUS_RTPM_NO_RESULT: ::NTSTATUS = 0xC0293002u32 as i32; +pub const STATUS_RTPM_PCR_READ_INCOMPLETE: ::NTSTATUS = 0xC0293003u32 as i32; +pub const STATUS_RTPM_INVALID_CONTEXT: ::NTSTATUS = 0xC0293004u32 as i32; +pub const STATUS_RTPM_UNSUPPORTED_CMD: ::NTSTATUS = 0xC0293005u32 as i32; +pub const STATUS_HV_INVALID_HYPERCALL_CODE: ::NTSTATUS = 0xC0350002u32 as i32; +pub const STATUS_HV_INVALID_HYPERCALL_INPUT: ::NTSTATUS = 0xC0350003u32 as i32; +pub const STATUS_HV_INVALID_ALIGNMENT: ::NTSTATUS = 0xC0350004u32 as i32; +pub const STATUS_HV_INVALID_PARAMETER: ::NTSTATUS = 0xC0350005u32 as i32; +pub const STATUS_HV_ACCESS_DENIED: ::NTSTATUS = 0xC0350006u32 as i32; +pub const STATUS_HV_INVALID_PARTITION_STATE: ::NTSTATUS = 0xC0350007u32 as i32; +pub const STATUS_HV_OPERATION_DENIED: ::NTSTATUS = 0xC0350008u32 as i32; +pub const STATUS_HV_UNKNOWN_PROPERTY: ::NTSTATUS = 0xC0350009u32 as i32; +pub const STATUS_HV_PROPERTY_VALUE_OUT_OF_RANGE: ::NTSTATUS = 0xC035000Au32 as i32; +pub const STATUS_HV_INSUFFICIENT_MEMORY: ::NTSTATUS = 0xC035000Bu32 as i32; +pub const STATUS_HV_PARTITION_TOO_DEEP: ::NTSTATUS = 0xC035000Cu32 as i32; +pub const STATUS_HV_INVALID_PARTITION_ID: ::NTSTATUS = 0xC035000Du32 as i32; +pub const STATUS_HV_INVALID_VP_INDEX: ::NTSTATUS = 0xC035000Eu32 as i32; +pub const STATUS_HV_INVALID_PORT_ID: ::NTSTATUS = 0xC0350011u32 as i32; +pub const STATUS_HV_INVALID_CONNECTION_ID: ::NTSTATUS = 0xC0350012u32 as i32; +pub const STATUS_HV_INSUFFICIENT_BUFFERS: ::NTSTATUS = 0xC0350013u32 as i32; +pub const STATUS_HV_NOT_ACKNOWLEDGED: ::NTSTATUS = 0xC0350014u32 as i32; +pub const STATUS_HV_ACKNOWLEDGED: ::NTSTATUS = 0xC0350016u32 as i32; +pub const STATUS_HV_INVALID_SAVE_RESTORE_STATE: ::NTSTATUS = 0xC0350017u32 as i32; +pub const STATUS_HV_INVALID_SYNIC_STATE: ::NTSTATUS = 0xC0350018u32 as i32; +pub const STATUS_HV_OBJECT_IN_USE: ::NTSTATUS = 0xC0350019u32 as i32; +pub const STATUS_HV_INVALID_PROXIMITY_DOMAIN_INFO: ::NTSTATUS = 0xC035001Au32 as i32; +pub const STATUS_HV_NO_DATA: ::NTSTATUS = 0xC035001Bu32 as i32; +pub const STATUS_HV_INACTIVE: ::NTSTATUS = 0xC035001Cu32 as i32; +pub const STATUS_HV_NO_RESOURCES: ::NTSTATUS = 0xC035001Du32 as i32; +pub const STATUS_HV_FEATURE_UNAVAILABLE: ::NTSTATUS = 0xC035001Eu32 as i32; +pub const STATUS_HV_INSUFFICIENT_BUFFER: ::NTSTATUS = 0xC0350033u32 as i32; +pub const STATUS_HV_INSUFFICIENT_DEVICE_DOMAINS: ::NTSTATUS = 0xC0350038u32 as i32; +pub const STATUS_HV_CPUID_FEATURE_VALIDATION_ERROR: ::NTSTATUS = 0xC035003Cu32 as i32; +pub const STATUS_HV_CPUID_XSAVE_FEATURE_VALIDATION_ERROR: ::NTSTATUS = 0xC035003Du32 as i32; +pub const STATUS_HV_PROCESSOR_STARTUP_TIMEOUT: ::NTSTATUS = 0xC035003Eu32 as i32; +pub const STATUS_HV_SMX_ENABLED: ::NTSTATUS = 0xC035003Fu32 as i32; +pub const STATUS_HV_INVALID_LP_INDEX: ::NTSTATUS = 0xC0350041u32 as i32; +pub const STATUS_HV_INVALID_REGISTER_VALUE: ::NTSTATUS = 0xC0350050u32 as i32; +pub const STATUS_HV_INVALID_VTL_STATE: ::NTSTATUS = 0xC0350051u32 as i32; +pub const STATUS_HV_NX_NOT_DETECTED: ::NTSTATUS = 0xC0350055u32 as i32; +pub const STATUS_HV_INVALID_DEVICE_ID: ::NTSTATUS = 0xC0350057u32 as i32; +pub const STATUS_HV_INVALID_DEVICE_STATE: ::NTSTATUS = 0xC0350058u32 as i32; +pub const STATUS_HV_PENDING_PAGE_REQUESTS: ::NTSTATUS = 0x00350059; +pub const STATUS_HV_PAGE_REQUEST_INVALID: ::NTSTATUS = 0xC0350060u32 as i32; +pub const STATUS_HV_NOT_PRESENT: ::NTSTATUS = 0xC0351000u32 as i32; +pub const STATUS_VID_DUPLICATE_HANDLER: ::NTSTATUS = 0xC0370001u32 as i32; +pub const STATUS_VID_TOO_MANY_HANDLERS: ::NTSTATUS = 0xC0370002u32 as i32; +pub const STATUS_VID_QUEUE_FULL: ::NTSTATUS = 0xC0370003u32 as i32; +pub const STATUS_VID_HANDLER_NOT_PRESENT: ::NTSTATUS = 0xC0370004u32 as i32; +pub const STATUS_VID_INVALID_OBJECT_NAME: ::NTSTATUS = 0xC0370005u32 as i32; +pub const STATUS_VID_PARTITION_NAME_TOO_LONG: ::NTSTATUS = 0xC0370006u32 as i32; +pub const STATUS_VID_MESSAGE_QUEUE_NAME_TOO_LONG: ::NTSTATUS = 0xC0370007u32 as i32; +pub const STATUS_VID_PARTITION_ALREADY_EXISTS: ::NTSTATUS = 0xC0370008u32 as i32; +pub const STATUS_VID_PARTITION_DOES_NOT_EXIST: ::NTSTATUS = 0xC0370009u32 as i32; +pub const STATUS_VID_PARTITION_NAME_NOT_FOUND: ::NTSTATUS = 0xC037000Au32 as i32; +pub const STATUS_VID_MESSAGE_QUEUE_ALREADY_EXISTS: ::NTSTATUS = 0xC037000Bu32 as i32; +pub const STATUS_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT: ::NTSTATUS = 0xC037000Cu32 as i32; +pub const STATUS_VID_MB_STILL_REFERENCED: ::NTSTATUS = 0xC037000Du32 as i32; +pub const STATUS_VID_CHILD_GPA_PAGE_SET_CORRUPTED: ::NTSTATUS = 0xC037000Eu32 as i32; +pub const STATUS_VID_INVALID_NUMA_SETTINGS: ::NTSTATUS = 0xC037000Fu32 as i32; +pub const STATUS_VID_INVALID_NUMA_NODE_INDEX: ::NTSTATUS = 0xC0370010u32 as i32; +pub const STATUS_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED: ::NTSTATUS = 0xC0370011u32 as i32; +pub const STATUS_VID_INVALID_MEMORY_BLOCK_HANDLE: ::NTSTATUS = 0xC0370012u32 as i32; +pub const STATUS_VID_PAGE_RANGE_OVERFLOW: ::NTSTATUS = 0xC0370013u32 as i32; +pub const STATUS_VID_INVALID_MESSAGE_QUEUE_HANDLE: ::NTSTATUS = 0xC0370014u32 as i32; +pub const STATUS_VID_INVALID_GPA_RANGE_HANDLE: ::NTSTATUS = 0xC0370015u32 as i32; +pub const STATUS_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE: ::NTSTATUS = 0xC0370016u32 as i32; +pub const STATUS_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED: ::NTSTATUS = 0xC0370017u32 as i32; +pub const STATUS_VID_INVALID_PPM_HANDLE: ::NTSTATUS = 0xC0370018u32 as i32; +pub const STATUS_VID_MBPS_ARE_LOCKED: ::NTSTATUS = 0xC0370019u32 as i32; +pub const STATUS_VID_MESSAGE_QUEUE_CLOSED: ::NTSTATUS = 0xC037001Au32 as i32; +pub const STATUS_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED: ::NTSTATUS = 0xC037001Bu32 as i32; +pub const STATUS_VID_STOP_PENDING: ::NTSTATUS = 0xC037001Cu32 as i32; +pub const STATUS_VID_INVALID_PROCESSOR_STATE: ::NTSTATUS = 0xC037001Du32 as i32; +pub const STATUS_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT: ::NTSTATUS = 0xC037001Eu32 as i32; +pub const STATUS_VID_KM_INTERFACE_ALREADY_INITIALIZED: ::NTSTATUS = 0xC037001Fu32 as i32; +pub const STATUS_VID_MB_PROPERTY_ALREADY_SET_RESET: ::NTSTATUS = 0xC0370020u32 as i32; +pub const STATUS_VID_MMIO_RANGE_DESTROYED: ::NTSTATUS = 0xC0370021u32 as i32; +pub const STATUS_VID_INVALID_CHILD_GPA_PAGE_SET: ::NTSTATUS = 0xC0370022u32 as i32; +pub const STATUS_VID_RESERVE_PAGE_SET_IS_BEING_USED: ::NTSTATUS = 0xC0370023u32 as i32; +pub const STATUS_VID_RESERVE_PAGE_SET_TOO_SMALL: ::NTSTATUS = 0xC0370024u32 as i32; +pub const STATUS_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE: ::NTSTATUS = 0xC0370025u32 as i32; +pub const STATUS_VID_MBP_COUNT_EXCEEDED_LIMIT: ::NTSTATUS = 0xC0370026u32 as i32; +pub const STATUS_VID_SAVED_STATE_CORRUPT: ::NTSTATUS = 0xC0370027u32 as i32; +pub const STATUS_VID_SAVED_STATE_UNRECOGNIZED_ITEM: ::NTSTATUS = 0xC0370028u32 as i32; +pub const STATUS_VID_SAVED_STATE_INCOMPATIBLE: ::NTSTATUS = 0xC0370029u32 as i32; +pub const STATUS_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED: ::NTSTATUS = 0x80370001u32 as i32; +pub const STATUS_IPSEC_BAD_SPI: ::NTSTATUS = 0xC0360001u32 as i32; +pub const STATUS_IPSEC_SA_LIFETIME_EXPIRED: ::NTSTATUS = 0xC0360002u32 as i32; +pub const STATUS_IPSEC_WRONG_SA: ::NTSTATUS = 0xC0360003u32 as i32; +pub const STATUS_IPSEC_REPLAY_CHECK_FAILED: ::NTSTATUS = 0xC0360004u32 as i32; +pub const STATUS_IPSEC_INVALID_PACKET: ::NTSTATUS = 0xC0360005u32 as i32; +pub const STATUS_IPSEC_INTEGRITY_CHECK_FAILED: ::NTSTATUS = 0xC0360006u32 as i32; +pub const STATUS_IPSEC_CLEAR_TEXT_DROP: ::NTSTATUS = 0xC0360007u32 as i32; +pub const STATUS_IPSEC_AUTH_FIREWALL_DROP: ::NTSTATUS = 0xC0360008u32 as i32; +pub const STATUS_IPSEC_THROTTLE_DROP: ::NTSTATUS = 0xC0360009u32 as i32; +pub const STATUS_IPSEC_DOSP_BLOCK: ::NTSTATUS = 0xC0368000u32 as i32; +pub const STATUS_IPSEC_DOSP_RECEIVED_MULTICAST: ::NTSTATUS = 0xC0368001u32 as i32; +pub const STATUS_IPSEC_DOSP_INVALID_PACKET: ::NTSTATUS = 0xC0368002u32 as i32; +pub const STATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED: ::NTSTATUS = 0xC0368003u32 as i32; +pub const STATUS_IPSEC_DOSP_MAX_ENTRIES: ::NTSTATUS = 0xC0368004u32 as i32; +pub const STATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: ::NTSTATUS = 0xC0368005u32 as i32; +pub const STATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: ::NTSTATUS = 0xC0368006u32 as i32; +pub const STATUS_VOLMGR_INCOMPLETE_REGENERATION: ::NTSTATUS = 0x80380001u32 as i32; +pub const STATUS_VOLMGR_INCOMPLETE_DISK_MIGRATION: ::NTSTATUS = 0x80380002u32 as i32; +pub const STATUS_VOLMGR_DATABASE_FULL: ::NTSTATUS = 0xC0380001u32 as i32; +pub const STATUS_VOLMGR_DISK_CONFIGURATION_CORRUPTED: ::NTSTATUS = 0xC0380002u32 as i32; +pub const STATUS_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC: ::NTSTATUS = 0xC0380003u32 as i32; +pub const STATUS_VOLMGR_PACK_CONFIG_UPDATE_FAILED: ::NTSTATUS = 0xC0380004u32 as i32; +pub const STATUS_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME: ::NTSTATUS = 0xC0380005u32 as i32; +pub const STATUS_VOLMGR_DISK_DUPLICATE: ::NTSTATUS = 0xC0380006u32 as i32; +pub const STATUS_VOLMGR_DISK_DYNAMIC: ::NTSTATUS = 0xC0380007u32 as i32; +pub const STATUS_VOLMGR_DISK_ID_INVALID: ::NTSTATUS = 0xC0380008u32 as i32; +pub const STATUS_VOLMGR_DISK_INVALID: ::NTSTATUS = 0xC0380009u32 as i32; +pub const STATUS_VOLMGR_DISK_LAST_VOTER: ::NTSTATUS = 0xC038000Au32 as i32; +pub const STATUS_VOLMGR_DISK_LAYOUT_INVALID: ::NTSTATUS = 0xC038000Bu32 as i32; +pub const STATUS_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS: ::NTSTATUS = 0xC038000Cu32 as i32; +pub const STATUS_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED: ::NTSTATUS = 0xC038000Du32 as i32; +pub const STATUS_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL: ::NTSTATUS = 0xC038000Eu32 as i32; +pub const STATUS_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS: ::NTSTATUS = 0xC038000Fu32 as i32; +pub const STATUS_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS: ::NTSTATUS = 0xC0380010u32 as i32; +pub const STATUS_VOLMGR_DISK_MISSING: ::NTSTATUS = 0xC0380011u32 as i32; +pub const STATUS_VOLMGR_DISK_NOT_EMPTY: ::NTSTATUS = 0xC0380012u32 as i32; +pub const STATUS_VOLMGR_DISK_NOT_ENOUGH_SPACE: ::NTSTATUS = 0xC0380013u32 as i32; +pub const STATUS_VOLMGR_DISK_REVECTORING_FAILED: ::NTSTATUS = 0xC0380014u32 as i32; +pub const STATUS_VOLMGR_DISK_SECTOR_SIZE_INVALID: ::NTSTATUS = 0xC0380015u32 as i32; +pub const STATUS_VOLMGR_DISK_SET_NOT_CONTAINED: ::NTSTATUS = 0xC0380016u32 as i32; +pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS: ::NTSTATUS = 0xC0380017u32 as i32; +pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES: ::NTSTATUS = 0xC0380018u32 as i32; +pub const STATUS_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED: ::NTSTATUS = 0xC0380019u32 as i32; +pub const STATUS_VOLMGR_EXTENT_ALREADY_USED: ::NTSTATUS = 0xC038001Au32 as i32; +pub const STATUS_VOLMGR_EXTENT_NOT_CONTIGUOUS: ::NTSTATUS = 0xC038001Bu32 as i32; +pub const STATUS_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION: ::NTSTATUS = 0xC038001Cu32 as i32; +pub const STATUS_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED: ::NTSTATUS = 0xC038001Du32 as i32; +pub const STATUS_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION: ::NTSTATUS = 0xC038001Eu32 as i32; +pub const STATUS_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH: ::NTSTATUS = 0xC038001Fu32 as i32; +pub const STATUS_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED: ::NTSTATUS = 0xC0380020u32 as i32; +pub const STATUS_VOLMGR_INTERLEAVE_LENGTH_INVALID: ::NTSTATUS = 0xC0380021u32 as i32; +pub const STATUS_VOLMGR_MAXIMUM_REGISTERED_USERS: ::NTSTATUS = 0xC0380022u32 as i32; +pub const STATUS_VOLMGR_MEMBER_IN_SYNC: ::NTSTATUS = 0xC0380023u32 as i32; +pub const STATUS_VOLMGR_MEMBER_INDEX_DUPLICATE: ::NTSTATUS = 0xC0380024u32 as i32; +pub const STATUS_VOLMGR_MEMBER_INDEX_INVALID: ::NTSTATUS = 0xC0380025u32 as i32; +pub const STATUS_VOLMGR_MEMBER_MISSING: ::NTSTATUS = 0xC0380026u32 as i32; +pub const STATUS_VOLMGR_MEMBER_NOT_DETACHED: ::NTSTATUS = 0xC0380027u32 as i32; +pub const STATUS_VOLMGR_MEMBER_REGENERATING: ::NTSTATUS = 0xC0380028u32 as i32; +pub const STATUS_VOLMGR_ALL_DISKS_FAILED: ::NTSTATUS = 0xC0380029u32 as i32; +pub const STATUS_VOLMGR_NO_REGISTERED_USERS: ::NTSTATUS = 0xC038002Au32 as i32; +pub const STATUS_VOLMGR_NO_SUCH_USER: ::NTSTATUS = 0xC038002Bu32 as i32; +pub const STATUS_VOLMGR_NOTIFICATION_RESET: ::NTSTATUS = 0xC038002Cu32 as i32; +pub const STATUS_VOLMGR_NUMBER_OF_MEMBERS_INVALID: ::NTSTATUS = 0xC038002Du32 as i32; +pub const STATUS_VOLMGR_NUMBER_OF_PLEXES_INVALID: ::NTSTATUS = 0xC038002Eu32 as i32; +pub const STATUS_VOLMGR_PACK_DUPLICATE: ::NTSTATUS = 0xC038002Fu32 as i32; +pub const STATUS_VOLMGR_PACK_ID_INVALID: ::NTSTATUS = 0xC0380030u32 as i32; +pub const STATUS_VOLMGR_PACK_INVALID: ::NTSTATUS = 0xC0380031u32 as i32; +pub const STATUS_VOLMGR_PACK_NAME_INVALID: ::NTSTATUS = 0xC0380032u32 as i32; +pub const STATUS_VOLMGR_PACK_OFFLINE: ::NTSTATUS = 0xC0380033u32 as i32; +pub const STATUS_VOLMGR_PACK_HAS_QUORUM: ::NTSTATUS = 0xC0380034u32 as i32; +pub const STATUS_VOLMGR_PACK_WITHOUT_QUORUM: ::NTSTATUS = 0xC0380035u32 as i32; +pub const STATUS_VOLMGR_PARTITION_STYLE_INVALID: ::NTSTATUS = 0xC0380036u32 as i32; +pub const STATUS_VOLMGR_PARTITION_UPDATE_FAILED: ::NTSTATUS = 0xC0380037u32 as i32; +pub const STATUS_VOLMGR_PLEX_IN_SYNC: ::NTSTATUS = 0xC0380038u32 as i32; +pub const STATUS_VOLMGR_PLEX_INDEX_DUPLICATE: ::NTSTATUS = 0xC0380039u32 as i32; +pub const STATUS_VOLMGR_PLEX_INDEX_INVALID: ::NTSTATUS = 0xC038003Au32 as i32; +pub const STATUS_VOLMGR_PLEX_LAST_ACTIVE: ::NTSTATUS = 0xC038003Bu32 as i32; +pub const STATUS_VOLMGR_PLEX_MISSING: ::NTSTATUS = 0xC038003Cu32 as i32; +pub const STATUS_VOLMGR_PLEX_REGENERATING: ::NTSTATUS = 0xC038003Du32 as i32; +pub const STATUS_VOLMGR_PLEX_TYPE_INVALID: ::NTSTATUS = 0xC038003Eu32 as i32; +pub const STATUS_VOLMGR_PLEX_NOT_RAID5: ::NTSTATUS = 0xC038003Fu32 as i32; +pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE: ::NTSTATUS = 0xC0380040u32 as i32; +pub const STATUS_VOLMGR_STRUCTURE_SIZE_INVALID: ::NTSTATUS = 0xC0380041u32 as i32; +pub const STATUS_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS: ::NTSTATUS = 0xC0380042u32 as i32; +pub const STATUS_VOLMGR_TRANSACTION_IN_PROGRESS: ::NTSTATUS = 0xC0380043u32 as i32; +pub const STATUS_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE: ::NTSTATUS = 0xC0380044u32 as i32; +pub const STATUS_VOLMGR_VOLUME_CONTAINS_MISSING_DISK: ::NTSTATUS = 0xC0380045u32 as i32; +pub const STATUS_VOLMGR_VOLUME_ID_INVALID: ::NTSTATUS = 0xC0380046u32 as i32; +pub const STATUS_VOLMGR_VOLUME_LENGTH_INVALID: ::NTSTATUS = 0xC0380047u32 as i32; +pub const STATUS_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE: ::NTSTATUS = 0xC0380048u32 as i32; +pub const STATUS_VOLMGR_VOLUME_NOT_MIRRORED: ::NTSTATUS = 0xC0380049u32 as i32; +pub const STATUS_VOLMGR_VOLUME_NOT_RETAINED: ::NTSTATUS = 0xC038004Au32 as i32; +pub const STATUS_VOLMGR_VOLUME_OFFLINE: ::NTSTATUS = 0xC038004Bu32 as i32; +pub const STATUS_VOLMGR_VOLUME_RETAINED: ::NTSTATUS = 0xC038004Cu32 as i32; +pub const STATUS_VOLMGR_NUMBER_OF_EXTENTS_INVALID: ::NTSTATUS = 0xC038004Du32 as i32; +pub const STATUS_VOLMGR_DIFFERENT_SECTOR_SIZE: ::NTSTATUS = 0xC038004Eu32 as i32; +pub const STATUS_VOLMGR_BAD_BOOT_DISK: ::NTSTATUS = 0xC038004Fu32 as i32; +pub const STATUS_VOLMGR_PACK_CONFIG_OFFLINE: ::NTSTATUS = 0xC0380050u32 as i32; +pub const STATUS_VOLMGR_PACK_CONFIG_ONLINE: ::NTSTATUS = 0xC0380051u32 as i32; +pub const STATUS_VOLMGR_NOT_PRIMARY_PACK: ::NTSTATUS = 0xC0380052u32 as i32; +pub const STATUS_VOLMGR_PACK_LOG_UPDATE_FAILED: ::NTSTATUS = 0xC0380053u32 as i32; +pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID: ::NTSTATUS = 0xC0380054u32 as i32; +pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID: ::NTSTATUS = 0xC0380055u32 as i32; +pub const STATUS_VOLMGR_VOLUME_MIRRORED: ::NTSTATUS = 0xC0380056u32 as i32; +pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE_SPANNED: ::NTSTATUS = 0xC0380057u32 as i32; +pub const STATUS_VOLMGR_NO_VALID_LOG_COPIES: ::NTSTATUS = 0xC0380058u32 as i32; +pub const STATUS_VOLMGR_PRIMARY_PACK_PRESENT: ::NTSTATUS = 0xC0380059u32 as i32; +pub const STATUS_VOLMGR_NUMBER_OF_DISKS_INVALID: ::NTSTATUS = 0xC038005Au32 as i32; +pub const STATUS_VOLMGR_MIRROR_NOT_SUPPORTED: ::NTSTATUS = 0xC038005Bu32 as i32; +pub const STATUS_VOLMGR_RAID5_NOT_SUPPORTED: ::NTSTATUS = 0xC038005Cu32 as i32; +pub const STATUS_BCD_NOT_ALL_ENTRIES_IMPORTED: ::NTSTATUS = 0x80390001u32 as i32; +pub const STATUS_BCD_TOO_MANY_ELEMENTS: ::NTSTATUS = 0xC0390002u32 as i32; +pub const STATUS_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED: ::NTSTATUS = 0x80390003u32 as i32; +pub const STATUS_VHD_DRIVE_FOOTER_MISSING: ::NTSTATUS = 0xC03A0001u32 as i32; +pub const STATUS_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH: ::NTSTATUS = 0xC03A0002u32 as i32; +pub const STATUS_VHD_DRIVE_FOOTER_CORRUPT: ::NTSTATUS = 0xC03A0003u32 as i32; +pub const STATUS_VHD_FORMAT_UNKNOWN: ::NTSTATUS = 0xC03A0004u32 as i32; +pub const STATUS_VHD_FORMAT_UNSUPPORTED_VERSION: ::NTSTATUS = 0xC03A0005u32 as i32; +pub const STATUS_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH: ::NTSTATUS = 0xC03A0006u32 as i32; +pub const STATUS_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION: ::NTSTATUS = 0xC03A0007u32 as i32; +pub const STATUS_VHD_SPARSE_HEADER_CORRUPT: ::NTSTATUS = 0xC03A0008u32 as i32; +pub const STATUS_VHD_BLOCK_ALLOCATION_FAILURE: ::NTSTATUS = 0xC03A0009u32 as i32; +pub const STATUS_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT: ::NTSTATUS = 0xC03A000Au32 as i32; +pub const STATUS_VHD_INVALID_BLOCK_SIZE: ::NTSTATUS = 0xC03A000Bu32 as i32; +pub const STATUS_VHD_BITMAP_MISMATCH: ::NTSTATUS = 0xC03A000Cu32 as i32; +pub const STATUS_VHD_PARENT_VHD_NOT_FOUND: ::NTSTATUS = 0xC03A000Du32 as i32; +pub const STATUS_VHD_CHILD_PARENT_ID_MISMATCH: ::NTSTATUS = 0xC03A000Eu32 as i32; +pub const STATUS_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH: ::NTSTATUS = 0xC03A000Fu32 as i32; +pub const STATUS_VHD_METADATA_READ_FAILURE: ::NTSTATUS = 0xC03A0010u32 as i32; +pub const STATUS_VHD_METADATA_WRITE_FAILURE: ::NTSTATUS = 0xC03A0011u32 as i32; +pub const STATUS_VHD_INVALID_SIZE: ::NTSTATUS = 0xC03A0012u32 as i32; +pub const STATUS_VHD_INVALID_FILE_SIZE: ::NTSTATUS = 0xC03A0013u32 as i32; +pub const STATUS_VIRTDISK_PROVIDER_NOT_FOUND: ::NTSTATUS = 0xC03A0014u32 as i32; +pub const STATUS_VIRTDISK_NOT_VIRTUAL_DISK: ::NTSTATUS = 0xC03A0015u32 as i32; +pub const STATUS_VHD_PARENT_VHD_ACCESS_DENIED: ::NTSTATUS = 0xC03A0016u32 as i32; +pub const STATUS_VHD_CHILD_PARENT_SIZE_MISMATCH: ::NTSTATUS = 0xC03A0017u32 as i32; +pub const STATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: ::NTSTATUS = 0xC03A0018u32 as i32; +pub const STATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: ::NTSTATUS = 0xC03A0019u32 as i32; +pub const STATUS_VIRTUAL_DISK_LIMITATION: ::NTSTATUS = 0xC03A001Au32 as i32; +pub const STATUS_VHD_INVALID_TYPE: ::NTSTATUS = 0xC03A001Bu32 as i32; +pub const STATUS_VHD_INVALID_STATE: ::NTSTATUS = 0xC03A001Cu32 as i32; +pub const STATUS_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE: ::NTSTATUS = 0xC03A001Du32 as i32; +pub const STATUS_VIRTDISK_DISK_ALREADY_OWNED: ::NTSTATUS = 0xC03A001Eu32 as i32; +pub const STATUS_VIRTDISK_DISK_ONLINE_AND_WRITABLE: ::NTSTATUS = 0xC03A001Fu32 as i32; +pub const STATUS_CTLOG_TRACKING_NOT_INITIALIZED: ::NTSTATUS = 0xC03A0020u32 as i32; +pub const STATUS_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE: ::NTSTATUS = 0xC03A0021u32 as i32; +pub const STATUS_CTLOG_VHD_CHANGED_OFFLINE: ::NTSTATUS = 0xC03A0022u32 as i32; +pub const STATUS_CTLOG_INVALID_TRACKING_STATE: ::NTSTATUS = 0xC03A0023u32 as i32; +pub const STATUS_CTLOG_INCONSISTENT_TRACKING_FILE: ::NTSTATUS = 0xC03A0024u32 as i32; +pub const STATUS_VHD_METADATA_FULL: ::NTSTATUS = 0xC03A0028u32 as i32; +pub const STATUS_VHD_INVALID_CHANGE_TRACKING_ID: ::NTSTATUS = 0xC03A0029u32 as i32; +pub const STATUS_VHD_CHANGE_TRACKING_DISABLED: ::NTSTATUS = 0xC03A002Au32 as i32; +pub const STATUS_VHD_MISSING_CHANGE_TRACKING_INFORMATION: ::NTSTATUS = 0xC03A0030u32 as i32; +pub const STATUS_VHD_RESIZE_WOULD_TRUNCATE_DATA: ::NTSTATUS = 0xC03A0031u32 as i32; +pub const STATUS_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE: ::NTSTATUS = 0xC03A0032u32 as i32; +pub const STATUS_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE: ::NTSTATUS = 0xC03A0033u32 as i32; +pub const STATUS_QUERY_STORAGE_ERROR: ::NTSTATUS = 0x803A0001u32 as i32; +pub const STATUS_RKF_KEY_NOT_FOUND: ::NTSTATUS = 0xC0400001u32 as i32; +pub const STATUS_RKF_DUPLICATE_KEY: ::NTSTATUS = 0xC0400002u32 as i32; +pub const STATUS_RKF_BLOB_FULL: ::NTSTATUS = 0xC0400003u32 as i32; +pub const STATUS_RKF_STORE_FULL: ::NTSTATUS = 0xC0400004u32 as i32; +pub const STATUS_RKF_FILE_BLOCKED: ::NTSTATUS = 0xC0400005u32 as i32; +pub const STATUS_RKF_ACTIVE_KEY: ::NTSTATUS = 0xC0400006u32 as i32; +pub const STATUS_RDBSS_RESTART_OPERATION: ::NTSTATUS = 0xC0410001u32 as i32; +pub const STATUS_RDBSS_CONTINUE_OPERATION: ::NTSTATUS = 0xC0410002u32 as i32; +pub const STATUS_RDBSS_POST_OPERATION: ::NTSTATUS = 0xC0410003u32 as i32; +pub const STATUS_BTH_ATT_INVALID_HANDLE: ::NTSTATUS = 0xC0420001u32 as i32; +pub const STATUS_BTH_ATT_READ_NOT_PERMITTED: ::NTSTATUS = 0xC0420002u32 as i32; +pub const STATUS_BTH_ATT_WRITE_NOT_PERMITTED: ::NTSTATUS = 0xC0420003u32 as i32; +pub const STATUS_BTH_ATT_INVALID_PDU: ::NTSTATUS = 0xC0420004u32 as i32; +pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHENTICATION: ::NTSTATUS = 0xC0420005u32 as i32; +pub const STATUS_BTH_ATT_REQUEST_NOT_SUPPORTED: ::NTSTATUS = 0xC0420006u32 as i32; +pub const STATUS_BTH_ATT_INVALID_OFFSET: ::NTSTATUS = 0xC0420007u32 as i32; +pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHORIZATION: ::NTSTATUS = 0xC0420008u32 as i32; +pub const STATUS_BTH_ATT_PREPARE_QUEUE_FULL: ::NTSTATUS = 0xC0420009u32 as i32; +pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_FOUND: ::NTSTATUS = 0xC042000Au32 as i32; +pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_LONG: ::NTSTATUS = 0xC042000Bu32 as i32; +pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE: ::NTSTATUS = 0xC042000Cu32 as i32; +pub const STATUS_BTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH: ::NTSTATUS = 0xC042000Du32 as i32; +pub const STATUS_BTH_ATT_UNLIKELY: ::NTSTATUS = 0xC042000Eu32 as i32; +pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION: ::NTSTATUS = 0xC042000Fu32 as i32; +pub const STATUS_BTH_ATT_UNSUPPORTED_GROUP_TYPE: ::NTSTATUS = 0xC0420010u32 as i32; +pub const STATUS_BTH_ATT_INSUFFICIENT_RESOURCES: ::NTSTATUS = 0xC0420011u32 as i32; +pub const STATUS_BTH_ATT_UNKNOWN_ERROR: ::NTSTATUS = 0xC0421000u32 as i32; +pub const STATUS_SECUREBOOT_ROLLBACK_DETECTED: ::NTSTATUS = 0xC0430001u32 as i32; +pub const STATUS_SECUREBOOT_POLICY_VIOLATION: ::NTSTATUS = 0xC0430002u32 as i32; +pub const STATUS_SECUREBOOT_INVALID_POLICY: ::NTSTATUS = 0xC0430003u32 as i32; +pub const STATUS_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND: ::NTSTATUS = 0xC0430004u32 as i32; +pub const STATUS_SECUREBOOT_POLICY_NOT_SIGNED: ::NTSTATUS = 0xC0430005u32 as i32; +pub const STATUS_SECUREBOOT_NOT_ENABLED: ::NTSTATUS = 0x80430006u32 as i32; +pub const STATUS_SECUREBOOT_FILE_REPLACED: ::NTSTATUS = 0xC0430007u32 as i32; +pub const STATUS_SYSTEM_INTEGRITY_ROLLBACK_DETECTED: ::NTSTATUS = 0xC0E90001u32 as i32; +pub const STATUS_SYSTEM_INTEGRITY_POLICY_VIOLATION: ::NTSTATUS = 0xC0E90002u32 as i32; +pub const STATUS_SYSTEM_INTEGRITY_INVALID_POLICY: ::NTSTATUS = 0xC0E90003u32 as i32; +pub const STATUS_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED: ::NTSTATUS = 0xC0E90004u32 as i32; +pub const STATUS_NO_APPLICABLE_APP_LICENSES_FOUND: ::NTSTATUS = 0xC0EA0001u32 as i32; +pub const STATUS_AUDIO_ENGINE_NODE_NOT_FOUND: ::NTSTATUS = 0xC0440001u32 as i32; +pub const STATUS_HDAUDIO_EMPTY_CONNECTION_LIST: ::NTSTATUS = 0xC0440002u32 as i32; +pub const STATUS_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED: ::NTSTATUS = 0xC0440003u32 as i32; +pub const STATUS_HDAUDIO_NO_LOGICAL_DEVICES_CREATED: ::NTSTATUS = 0xC0440004u32 as i32; +pub const STATUS_HDAUDIO_NULL_LINKED_LIST_ENTRY: ::NTSTATUS = 0xC0440005u32 as i32; +pub const STATUS_SPACES_RESILIENCY_TYPE_INVALID: ::NTSTATUS = 0xC0E70003u32 as i32; +pub const STATUS_SPACES_DRIVE_SECTOR_SIZE_INVALID: ::NTSTATUS = 0xC0E70004u32 as i32; +pub const STATUS_SPACES_DRIVE_REDUNDANCY_INVALID: ::NTSTATUS = 0xC0E70006u32 as i32; +pub const STATUS_SPACES_NUMBER_OF_DATA_COPIES_INVALID: ::NTSTATUS = 0xC0E70007u32 as i32; +pub const STATUS_SPACES_INTERLEAVE_LENGTH_INVALID: ::NTSTATUS = 0xC0E70009u32 as i32; +pub const STATUS_SPACES_NUMBER_OF_COLUMNS_INVALID: ::NTSTATUS = 0xC0E7000Au32 as i32; +pub const STATUS_SPACES_NOT_ENOUGH_DRIVES: ::NTSTATUS = 0xC0E7000Bu32 as i32; +pub const STATUS_SPACES_EXTENDED_ERROR: ::NTSTATUS = 0xC0E7000Cu32 as i32; +pub const STATUS_SPACES_PROVISIONING_TYPE_INVALID: ::NTSTATUS = 0xC0E7000Du32 as i32; +pub const STATUS_SPACES_ALLOCATION_SIZE_INVALID: ::NTSTATUS = 0xC0E7000Eu32 as i32; +pub const STATUS_SPACES_ENCLOSURE_AWARE_INVALID: ::NTSTATUS = 0xC0E7000Fu32 as i32; +pub const STATUS_SPACES_WRITE_CACHE_SIZE_INVALID: ::NTSTATUS = 0xC0E70010u32 as i32; +pub const STATUS_SPACES_NUMBER_OF_GROUPS_INVALID: ::NTSTATUS = 0xC0E70011u32 as i32; +pub const STATUS_SPACES_DRIVE_OPERATIONAL_STATE_INVALID: ::NTSTATUS = 0xC0E70012u32 as i32; +pub const STATUS_SPACES_UPDATE_COLUMN_STATE: ::NTSTATUS = 0xC0E70013u32 as i32; +pub const STATUS_SPACES_MAP_REQUIRED: ::NTSTATUS = 0xC0E70014u32 as i32; +pub const STATUS_SPACES_UNSUPPORTED_VERSION: ::NTSTATUS = 0xC0E70015u32 as i32; +pub const STATUS_SPACES_CORRUPT_METADATA: ::NTSTATUS = 0xC0E70016u32 as i32; +pub const STATUS_SPACES_DRT_FULL: ::NTSTATUS = 0xC0E70017u32 as i32; +pub const STATUS_SPACES_INCONSISTENCY: ::NTSTATUS = 0xC0E70018u32 as i32; +pub const STATUS_SPACES_LOG_NOT_READY: ::NTSTATUS = 0xC0E70019u32 as i32; +pub const STATUS_SPACES_NO_REDUNDANCY: ::NTSTATUS = 0xC0E7001Au32 as i32; +pub const STATUS_SPACES_DRIVE_NOT_READY: ::NTSTATUS = 0xC0E7001Bu32 as i32; +pub const STATUS_SPACES_REPAIRED: ::NTSTATUS = 0x00E7001C; +pub const STATUS_SPACES_PAUSE: ::NTSTATUS = 0x00E7001D; +pub const STATUS_SPACES_COMPLETE: ::NTSTATUS = 0x00E7001E; +pub const STATUS_VOLSNAP_BOOTFILE_NOT_VALID: ::NTSTATUS = 0xC0500003u32 as i32; +pub const STATUS_IO_PREEMPTED: ::NTSTATUS = 0xC0510001u32 as i32; +pub const STATUS_SVHDX_ERROR_STORED: ::NTSTATUS = 0xC05C0000u32 as i32; +pub const STATUS_SVHDX_ERROR_NOT_AVAILABLE: ::NTSTATUS = 0xC05CFF00u32 as i32; +pub const STATUS_SVHDX_UNIT_ATTENTION_AVAILABLE: ::NTSTATUS = 0xC05CFF01u32 as i32; +pub const STATUS_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED: ::NTSTATUS = 0xC05CFF02u32 as i32; +pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED: ::NTSTATUS = 0xC05CFF03u32 as i32; +pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED: ::NTSTATUS = 0xC05CFF04u32 as i32; +pub const STATUS_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED: ::NTSTATUS = 0xC05CFF05u32 as i32; +pub const STATUS_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED: ::NTSTATUS = 0xC05CFF06u32 as i32; +pub const STATUS_SVHDX_RESERVATION_CONFLICT: ::NTSTATUS = 0xC05CFF07u32 as i32; +pub const STATUS_SVHDX_WRONG_FILE_TYPE: ::NTSTATUS = 0xC05CFF08u32 as i32; +pub const STATUS_SVHDX_VERSION_MISMATCH: ::NTSTATUS = 0xC05CFF09u32 as i32; +pub const STATUS_VHD_SHARED: ::NTSTATUS = 0xC05CFF0Au32 as i32; +pub const STATUS_SVHDX_NO_INITIATOR: ::NTSTATUS = 0xC05CFF0Bu32 as i32; +pub const STATUS_VHDSET_BACKING_STORAGE_NOT_FOUND: ::NTSTATUS = 0xC05CFF0Cu32 as i32; +pub const STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP: ::NTSTATUS = 0xC05D0000u32 as i32; +pub const STATUS_SMB_BAD_CLUSTER_DIALECT: ::NTSTATUS = 0xC05D0001u32 as i32; +pub const STATUS_SMB_GUEST_LOGON_BLOCKED: ::NTSTATUS = 0xC05D0002u32 as i32; +pub const STATUS_SECCORE_INVALID_COMMAND: ::NTSTATUS = 0xC0E80000u32 as i32; +pub const STATUS_VSM_NOT_INITIALIZED: ::NTSTATUS = 0xC0450000u32 as i32; +pub const STATUS_VSM_DMA_PROTECTION_NOT_IN_USE: ::NTSTATUS = 0xC0450001u32 as i32; diff --git a/third_party/rust/winapi/src/oaidl.rs b/third_party/rust/winapi/src/oaidl.rs new file mode 100644 index 000000000000..c705060bd458 --- /dev/null +++ b/third_party/rust/winapi/src/oaidl.rs @@ -0,0 +1,590 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of OAIdl.h +pub type wireBRECORD = *mut _wireBRECORD; +pub type wireVARIANT = *mut _wireVARIANT; +STRUCT!{struct SAFEARRAYBOUND { + cElements: ::ULONG, + lLbound: ::LONG, +}} +STRUCT!{struct SAFEARR_BSTR { + Size: ::ULONG, + aBstr: *mut ::wireBSTR, +}} +STRUCT!{struct SAFEARR_UNKNOWN { + Size: ::ULONG, + apUnknown: *mut *mut ::IUnknown, +}} +STRUCT!{struct SAFEARR_DISPATCH { + Size: ::ULONG, + apDispatch: *mut *mut IDispatch, +}} +STRUCT!{struct SAFEARR_VARIANT { + Size: ::ULONG, + aVariant: *mut wireVARIANT, +}} +STRUCT!{struct SAFEARR_BRECORD { + Size: ::ULONG, + aRecord: *mut wireBRECORD, +}} +STRUCT!{struct SAFEARR_HAVEIID { + Size: ::ULONG, + apUnknown: *mut *mut ::IUnknown, + iid: ::IID, +}} +ENUM!{enum SF_TYPE { + SF_ERROR = ::VT_ERROR.0, + SF_I1 = ::VT_I1.0, + SF_I2 = ::VT_I2.0, + SF_I4 = ::VT_I4.0, + SF_I8 = ::VT_I8.0, + SF_BSTR = ::VT_BSTR.0, + SF_UNKNOWN = ::VT_UNKNOWN.0, + SF_DISPATCH = ::VT_DISPATCH.0, + SF_VARIANT = ::VT_VARIANT.0, + SF_RECORD = ::VT_RECORD.0, + SF_HAVEIID = ::VT_UNKNOWN.0 | ::VT_RESERVED.0, +}} +STRUCT!{struct SAFEARRAYUNION { + sfType: ::ULONG, + u: __MIDL_IOleAutomationTypes_0001, +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct __MIDL_IOleAutomationTypes_0001 { + data0: u32, + data1: [u32; 6], +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct __MIDL_IOleAutomationTypes_0001 { + data0: u32, + data1: [u32; 5], +}} +UNION!(__MIDL_IOleAutomationTypes_0001, data0, BstrStr, BstrStr_mut, SAFEARR_BSTR); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, UnknownStr, UnknownStr_mut, SAFEARR_UNKNOWN); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, DispatchStr, DispatchStr_mut, SAFEARR_DISPATCH); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, VariantStr, VariantStr_mut, SAFEARR_VARIANT); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, RecordStr, RecordStr_mut, SAFEARR_BRECORD); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, HaveIidStr, HaveIidStr_mut, SAFEARR_HAVEIID); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, ByteStr, ByteStr_mut, ::BYTE_SIZEDARR); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, WordStr, WordStr_mut, ::WORD_SIZEDARR); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, LongStr, LongStr_mut, ::DWORD_SIZEDARR); +UNION!(__MIDL_IOleAutomationTypes_0001, data0, HyperStr, HyperStr_mut, ::HYPER_SIZEDARR); +STRUCT!{struct _wireSAFEARRAY { + cDims: ::USHORT, + fFeatures: ::USHORT, + cbElements: ::ULONG, + cLocks: ::ULONG, + uArrayStructs: SAFEARRAYUNION, + rgsaBound: [SAFEARRAYBOUND; 1], +}} +pub type wireSAFEARRAY = *mut _wireSAFEARRAY; +pub type wirePSAFEARRAY = *mut wireSAFEARRAY; +STRUCT!{struct SAFEARRAY { + cDims: ::USHORT, + fFeatures: ::USHORT, + cbElements: ::ULONG, + cLocks: ::ULONG, + pvData: ::PVOID, + rgsabound: [SAFEARRAYBOUND; 1], +}} +pub type LPSAFEARRAY = *mut SAFEARRAY; +pub const FADF_AUTO: ::DWORD = 0x1; +pub const FADF_STATIC: ::DWORD = 0x2; +pub const FADF_EMBEDDED: ::DWORD = 0x4; +pub const FADF_FIXEDSIZE: ::DWORD = 0x10; +pub const FADF_RECORD: ::DWORD = 0x20; +pub const FADF_HAVEIID: ::DWORD = 0x40; +pub const FADF_HAVEVARTYPE: ::DWORD = 0x80; +pub const FADF_BSTR: ::DWORD = 0x100; +pub const FADF_UNKNOWN: ::DWORD = 0x200; +pub const FADF_DISPATCH: ::DWORD = 0x400; +pub const FADF_VARIANT: ::DWORD = 0x800; +pub const FADF_RESERVED: ::DWORD = 0xf008; +#[cfg(target_arch = "x86_64")] +STRUCT!{struct VARIANT { + data0: u64, + data1: u64, + data2: u64, +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct VARIANT { + data0: u64, + data1: u32, + data2: u32, +}} +UNION!(VARIANT, data0, vt, vt_mut, ::VARTYPE); +UNION!(VARIANT, data1, llVal, llVal_mut, ::LONGLONG); +UNION!(VARIANT, data1, lVal, lVal_mut, ::LONG); +UNION!(VARIANT, data1, bVal, bVal_mut, ::BYTE); +UNION!(VARIANT, data1, iVal, iVal_mut, ::SHORT); +UNION!(VARIANT, data1, fltVal, fltVal_mut, ::FLOAT); +UNION!(VARIANT, data1, dblVal, dblVal_mut, ::DOUBLE); +UNION!(VARIANT, data1, boolVal, boolVal_mut, ::VARIANT_BOOL); +UNION!(VARIANT, data1, scode, scode_mut, ::SCODE); +UNION!(VARIANT, data1, cyVal, cyVal_mut, ::CY); +UNION!(VARIANT, data1, date, date_mut, ::DATE); +UNION!(VARIANT, data1, bstrVal, bstrVal_mut, ::BSTR); +UNION!(VARIANT, data1, punkVal, punkVal_mut, *mut ::IUnknown); +UNION!(VARIANT, data1, pdispVal, pdispVal_mut, *mut IDispatch); +UNION!(VARIANT, data1, parray, parray_mut, *mut SAFEARRAY); +UNION!(VARIANT, data1, pllVal, pllVal_mut, *mut ::LONGLONG); +UNION!(VARIANT, data1, plVal, plVal_mut, *mut ::LONG); +UNION!(VARIANT, data1, pbVal, pbVal_mut, *mut ::BYTE); +UNION!(VARIANT, data1, piVal, piVal_mut, *mut ::SHORT); +UNION!(VARIANT, data1, pfltVal, pfltVal_mut, *mut ::FLOAT); +UNION!(VARIANT, data1, pdblVal, pdblVal_mut, *mut ::DOUBLE); +UNION!(VARIANT, data1, pboolVal, pboolVal_mut, *mut ::VARIANT_BOOL); +UNION!(VARIANT, data1, pscode, pscode_mut, *mut ::SCODE); +UNION!(VARIANT, data1, pcyVal, pcyVal_mut, *mut ::CY); +UNION!(VARIANT, data1, pdate, pdate_mut, *mut ::DATE); +UNION!(VARIANT, data1, pbstrVal, pbstrVal_mut, *mut ::BSTR); +UNION!(VARIANT, data1, ppunkVal, ppunkVal_mut, *mut *mut ::IUnknown); +UNION!(VARIANT, data1, ppdispVal, ppdispVal_mut, *mut *mut IDispatch); +UNION!(VARIANT, data1, pparray, pparray_mut, *mut *mut SAFEARRAY); +UNION!(VARIANT, data1, pvarVal, pvarVal_mut, *mut VARIANT); +UNION!(VARIANT, data1, byref, byref_mut, ::PVOID); +UNION!(VARIANT, data1, cVal, cVal_mut, ::CHAR); +UNION!(VARIANT, data1, uiVal, uiVal_mut, ::USHORT); +UNION!(VARIANT, data1, ulVal, ulVal_mut, ::ULONG); +UNION!(VARIANT, data1, ullVal, ullVal_mut, ::ULONGLONG); +UNION!(VARIANT, data1, intVal, intVal_mut, ::INT); +UNION!(VARIANT, data1, uintVal, uintVal_mut, ::UINT); +UNION!(VARIANT, data1, pdecVal, pdecVal_mut, *mut ::DECIMAL); +UNION!(VARIANT, data1, pcVal, pcVal_mut, *mut ::CHAR); +UNION!(VARIANT, data1, puiVal, puiVal_mut, *mut ::USHORT); +UNION!(VARIANT, data1, pulVal, pulVal_mut, *mut ::ULONG); +UNION!(VARIANT, data1, pullVal, pullVal_mut, *mut ::ULONGLONG); +UNION!(VARIANT, data1, pintVal, pintVal_mut, *mut ::INT); +UNION!(VARIANT, data1, puintVal, puintVal_mut, *mut ::UINT); +UNION!(VARIANT, data1, pvRecord, pvRecord_mut, ::PVOID); +UNION!(VARIANT, data2, pRecInfo, pRecInfo_mut, *mut IRecordInfo); +UNION!(VARIANT, data0, decVal, decVal_mut, ::DECIMAL); +pub type LPVARIANT = *mut VARIANT; +pub type VARIANTARG = VARIANT; +pub type LPVARIANTARG = *mut VARIANT; +pub type REFVARIANT = *const VARIANT; +STRUCT!{struct _wireBRECORD { + fFlags: ::ULONG, + clSize: ::ULONG, + pRecInfo: *mut IRecordInfo, + pRecord: *mut ::BYTE, +}} +STRUCT!{struct _wireVARIANT { + clSize: ::DWORD, + rpcReserved: ::DWORD, + vt: ::USHORT, + wReserved1: ::USHORT, + wReserved2: ::USHORT, + wReserved3: ::USHORT, + data0: u64, + data1: u64, +}} +UNION!(_wireVARIANT, data0, llVal, llVal_mut, ::LONGLONG); +UNION!(_wireVARIANT, data0, lVal, lVal_mut, ::LONG); +UNION!(_wireVARIANT, data0, bVal, bVal_mut, ::BYTE); +UNION!(_wireVARIANT, data0, iVal, iVal_mut, ::SHORT); +UNION!(_wireVARIANT, data0, fltVal, fltVal_mut, ::FLOAT); +UNION!(_wireVARIANT, data0, dblVal, dblVal_mut, ::DOUBLE); +UNION!(_wireVARIANT, data0, boolVal, boolVal_mut, ::VARIANT_BOOL); +UNION!(_wireVARIANT, data0, scode, scode_mut, ::SCODE); +UNION!(_wireVARIANT, data0, cyVal, cyVal_mut, ::CY); +UNION!(_wireVARIANT, data0, date, date_mut, ::DATE); +UNION!(_wireVARIANT, data0, bstrVal, bstrVal_mut, ::wireBSTR); +UNION!(_wireVARIANT, data0, punkVal, punkVal_mut, *mut ::IUnknown); +UNION!(_wireVARIANT, data0, pdispVal, pdispVal_mut, *mut IDispatch); +UNION!(_wireVARIANT, data0, parray, parray_mut, wirePSAFEARRAY); +UNION!(_wireVARIANT, data0, brecVal, brecVal_mut, wireBRECORD); +UNION!(_wireVARIANT, data0, pllVal, pllVal_mut, *mut ::LONGLONG); +UNION!(_wireVARIANT, data0, plVal, plVal_mut, *mut ::LONG); +UNION!(_wireVARIANT, data0, pbVal, pbVal_mut, *mut ::BYTE); +UNION!(_wireVARIANT, data0, piVal, piVal_mut, *mut ::SHORT); +UNION!(_wireVARIANT, data0, pfltVal, pfltVal_mut, *mut ::FLOAT); +UNION!(_wireVARIANT, data0, pdblVal, pdblVal_mut, *mut ::DOUBLE); +UNION!(_wireVARIANT, data0, pboolVal, pboolVal_mut, *mut ::VARIANT_BOOL); +UNION!(_wireVARIANT, data0, pscode, pscode_mut, *mut ::SCODE); +UNION!(_wireVARIANT, data0, pcyVal, pcyVal_mut, *mut ::CY); +UNION!(_wireVARIANT, data0, pdate, pdate_mut, *mut ::DATE); +UNION!(_wireVARIANT, data0, pbstrVal, pbstrVal_mut, *mut ::wireBSTR); +UNION!(_wireVARIANT, data0, ppunkVal, ppunkVal_mut, *mut *mut ::IUnknown); +UNION!(_wireVARIANT, data0, ppdispVal, ppdispVal_mut, *mut *mut IDispatch); +UNION!(_wireVARIANT, data0, pparray, pparray_mut, *mut wirePSAFEARRAY); +UNION!(_wireVARIANT, data0, pvarVal, pvarVal_mut, *mut wireVARIANT); +UNION!(_wireVARIANT, data0, cVal, cVal_mut, ::CHAR); +UNION!(_wireVARIANT, data0, uiVal, uiVal_mut, ::USHORT); +UNION!(_wireVARIANT, data0, ulVal, ulVal_mut, ::ULONG); +UNION!(_wireVARIANT, data0, ullVal, ullVal_mut, ::ULONGLONG); +UNION!(_wireVARIANT, data0, intVal, intVal_mut, ::INT); +UNION!(_wireVARIANT, data0, uintVal, uintVal_mut, ::UINT); +UNION!(_wireVARIANT, data0, decVal, decVal_mut, ::DECIMAL); +UNION!(_wireVARIANT, data0, pcVal, pcVal_mut, *mut ::CHAR); +UNION!(_wireVARIANT, data0, puiVal, puiVal_mut, *mut ::USHORT); +UNION!(_wireVARIANT, data0, pulVal, pulVal_mut, *mut ::ULONG); +UNION!(_wireVARIANT, data0, pullVal, pullVal_mut, *mut ::ULONGLONG); +UNION!(_wireVARIANT, data0, pintVal, pintVal_mut, *mut ::INT); +UNION!(_wireVARIANT, data0, puintVal, puintVal_mut, *mut ::UINT); +UNION!(_wireVARIANT, data0, pdecVal, pdecVal_mut, *mut ::DECIMAL); +pub type DISPID = ::LONG; +pub type MEMBERID = DISPID; +pub type HREFTYPE = ::DWORD; +ENUM!{enum TYPEKIND { + TKIND_ENUM = 0, + TKIND_RECORD, + TKIND_MODULE, + TKIND_INTERFACE, + TKIND_DISPATCH, + TKIND_COCLASS, + TKIND_ALIAS, + TKIND_UNION, + TKIND_MAX, +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct TYPEDESC { + data: u64, + vt: ::VARTYPE, +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct TYPEDESC { + data: u32, + vt: ::VARTYPE, +}} +UNION!(TYPEDESC, data, lptdesc, lptdesc_mut, *mut TYPEDESC); +UNION!(TYPEDESC, data, lpadesc, lpadesc_mut, *mut ARRAYDESC); +UNION!(TYPEDESC, data, hreftype, hreftype_mut, HREFTYPE); +STRUCT!{struct ARRAYDESC { + tdescElem: TYPEDESC, + cDims: ::USHORT, + rgbounds: [SAFEARRAYBOUND; 1], +}} +STRUCT!{struct PARAMDESCEX { + cBytes: ::ULONG, + varDefaultValue: VARIANTARG, +}} +pub type LPPARAMDESCEX = *mut PARAMDESCEX; +STRUCT!{struct PARAMDESC { + pparamdescex: LPPARAMDESCEX, + wParamFlags: ::USHORT, +}} +pub type LPPARAMDESC = *mut PARAMDESC; +pub const PARAMFLAG_NONE: ::DWORD = 0; +pub const PARAMFLAG_FIN: ::DWORD = 0x1; +pub const PARAMFLAG_FOUT: ::DWORD = 0x2; +pub const PARAMFLAG_FLCID: ::DWORD = 0x4; +pub const PARAMFLAG_FRETVAL: ::DWORD = 0x8; +pub const PARAMFLAG_FOPT: ::DWORD = 0x10; +pub const PARAMFLAG_FHASDEFAULT: ::DWORD = 0x20; +pub const PARAMFLAG_FHASCUSTDATA: ::DWORD = 0x40; +STRUCT!{struct IDLDESC { + dwReserved: ::ULONG_PTR, + wIDLFlags: ::USHORT, +}} +pub type LPIDLDESC = *mut IDLDESC; +pub const IDLFLAG_NONE: ::DWORD = PARAMFLAG_NONE; +pub const IDLFLAG_FIN: ::DWORD = PARAMFLAG_FIN; +pub const IDLFLAG_FOUT: ::DWORD = PARAMFLAG_FOUT; +pub const IDLFLAG_FLCID: ::DWORD = PARAMFLAG_FLCID; +pub const IDLFLAG_FRETVAL: ::DWORD = PARAMFLAG_FRETVAL; +STRUCT!{struct ELEMDESC { + tdesc: TYPEDESC, + idldesc: IDLDESC, +}} +UNION!(ELEMDESC, idldesc, paramdesc, paramdesc_mut, PARAMDESC); +pub type LPELEMDESC = *mut ELEMDESC; +STRUCT!{struct TYPEATTR { + guid: ::GUID, + lcid: ::LCID, + dwReserved: ::DWORD, + memidConstructor: ::MEMBERID, + memidDestructor: ::MEMBERID, + lpstrSchema: ::LPOLESTR, + cbSizeInstance: ::ULONG, + typekind: ::TYPEKIND, + cFuncs: ::WORD, + cVars: ::WORD, + cImplTypes: ::WORD, + cbSizeVft: ::WORD, + cbAlignment: ::WORD, + wTypeFlags: ::WORD, + wMajorVerNum: ::WORD, + wMinorVerNum: ::WORD, + tdescAlias: ::TYPEDESC, + idldescType: ::IDLDESC, +}} +pub type LPTYPEATTR = *mut TYPEATTR; +STRUCT!{struct DISPPARAMS { + rgvarg: *mut VARIANTARG, + rgdispidNamedArgs: *mut DISPID, + cArgs: ::UINT, + cNamedArgs: ::UINT, +}} +STRUCT!{nodebug struct EXCEPINFO { + wCode: ::WORD, + wReserved: ::WORD, + bstrSource: ::BSTR, + bstrDescription: ::BSTR, + bstrHelpFile: ::BSTR, + dwHelpContext: ::DWORD, + pvReserved: ::PVOID, + pfnDeferredFillIn: Option ::HRESULT>, + scode: ::SCODE, +}} +ENUM!{enum CALLCONV { + CC_FASTCALL = 0, + CC_CDECL = 1, + CC_MSCPASCAL, + CC_PASCAL, + CC_MACPASCAL, + CC_STDCALL, + CC_FPFASTCALL, + CC_SYSCALL, + CC_MPWCDECL, + CC_MPWPASCAL, + CC_MAX, +}} +ENUM!{enum FUNCKIND { + FUNC_VIRTUAL = 0, + FUNC_PUREVIRTUAL, + FUNC_NONVIRTUAL, + FUNC_STATIC, + FUNC_DISPATCH, +}} +FLAGS!{enum INVOKEKIND { + INVOKE_FUNC = 1, + INVOKE_PROPERTYGET = 2, + INVOKE_PROPERTYPUT = 4, + INVOKE_PROPERTYPUTREF = 8, +}} +STRUCT!{struct FUNCDESC { + memid: ::MEMBERID, + lprgscode: *mut ::SCODE, + lprgelemdescParam: *mut ::ELEMDESC, + funckind: ::FUNCKIND, + invkind: ::INVOKEKIND, + callconv: ::CALLCONV, + cParams: ::SHORT, + cParamsOpt: ::SHORT, + oVft: ::SHORT, + cScodes: ::SHORT, + elemdescFunc: ::ELEMDESC, + wFuncFlags: ::WORD, +}} +pub type LPFUNCDESC = *mut FUNCDESC; +ENUM!{enum VARKIND { + VAR_PERINSTANCE = 0, + VAR_STATIC, + VAR_CONST, + VAR_DISPATCH, +}} +pub const IMPLTYPEFLAG_FDEFAULT: ::DWORD = 0x1; +pub const IMPLTYPEFLAG_FSOURCE: ::DWORD = 0x2; +pub const IMPLTYPEFLAG_FRESTRICTED: ::DWORD = 0x4; +pub const IMPLTYPEFLAG_FDEFAULTVTABLE: ::DWORD = 0x8; +STRUCT!{struct VARDESC { + memid: MEMBERID, + lpstrSchema: ::LPOLESTR, + lpvarValue: *mut VARIANT, + elemdescVar: ::ELEMDESC, + wVarFlags: ::WORD, + varkind: VARKIND, +}} +UNION!(VARDESC, lpvarValue, oInst, oInst_mut, ::ULONG); +pub type LPVARDESC = *mut VARDESC; +FLAGS!{enum TYPEFLAGS { + TYPEFLAG_FAPPOBJECT = 0x1, + TYPEFLAG_FCANCREATE = 0x2, + TYPEFLAG_FLICENSED = 0x4, + TYPEFLAG_FPREDECLID = 0x8, + TYPEFLAG_FHIDDEN = 0x10, + TYPEFLAG_FCONTROL = 0x20, + TYPEFLAG_FDUAL = 0x40, + TYPEFLAG_FNONEXTENSIBLE = 0x80, + TYPEFLAG_FOLEAUTOMATION = 0x100, + TYPEFLAG_FRESTRICTED = 0x200, + TYPEFLAG_FAGGREGATABLE = 0x400, + TYPEFLAG_FREPLACEABLE = 0x800, + TYPEFLAG_FDISPATCHABLE = 0x1000, + TYPEFLAG_FREVERSEBIND = 0x2000, + TYPEFLAG_FPROXY = 0x4000, +}} +FLAGS!{enum FUNCFLAGS { + FUNCFLAG_FRESTRICTED = 0x1, + FUNCFLAG_FSOURCE = 0x2, + FUNCFLAG_FBINDABLE = 0x4, + FUNCFLAG_FREQUESTEDIT = 0x8, + FUNCFLAG_FDISPLAYBIND = 0x10, + FUNCFLAG_FDEFAULTBIND = 0x20, + FUNCFLAG_FHIDDEN = 0x40, + FUNCFLAG_FUSESGETLASTERROR = 0x80, + FUNCFLAG_FDEFAULTCOLLELEM = 0x100, + FUNCFLAG_FUIDEFAULT = 0x200, + FUNCFLAG_FNONBROWSABLE = 0x400, + FUNCFLAG_FREPLACEABLE = 0x800, + FUNCFLAG_FIMMEDIATEBIND = 0x1000, +}} +FLAGS!{enum VARFLAGS { + VARFLAG_FREADONLY = 0x1, + VARFLAG_FSOURCE = 0x2, + VARFLAG_FBINDABLE = 0x4, + VARFLAG_FREQUESTEDIT = 0x8, + VARFLAG_FDISPLAYBIND = 0x10, + VARFLAG_FDEFAULTBIND = 0x20, + VARFLAG_FHIDDEN = 0x40, + VARFLAG_FRESTRICTED = 0x80, + VARFLAG_FDEFAULTCOLLELEM = 0x100, + VARFLAG_FUIDEFAULT = 0x200, + VARFLAG_FNONBROWSABLE = 0x400, + VARFLAG_FREPLACEABLE = 0x800, + VARFLAG_FIMMEDIATEBIND = 0x1000, +}} +STRUCT!{struct CLEANLOCALSTORAGE { + pInterface: *mut ::IUnknown, + pStorage: ::PVOID, + flags: ::DWORD, +}} +STRUCT!{struct CUSTDATAITEM { + guid: ::GUID, + varValue: VARIANTARG, +}} +pub type LPCUSTDATAITEM = *mut CUSTDATAITEM; +STRUCT!{struct CUSTDATA { + cCustData: ::DWORD, + prgCustData: LPCUSTDATAITEM, +}} +pub type LPCUSTDATA = *mut CUSTDATA; +pub type LPCREATETYPEINFO = *mut ICreateTypeInfo; +RIDL!( +interface ICreateTypeInfo(ICreateTypeInfoVtbl): IUnknown(IUnknownVtbl) { + fn SetGuid(&mut self, guid: ::REFGUID) -> ::HRESULT, + fn SetTypeFlags(&mut self, uTypeFlags: ::UINT) -> ::HRESULT, + fn SetDocString(&mut self, pStrDoc: ::LPOLESTR) -> ::HRESULT, + fn SetHelpContext(&mut self, dwHelpContext: ::DWORD) -> ::HRESULT, + fn SetVersion(&mut self, wMajorVerNum: ::WORD, wMinorVerNum: ::WORD) -> ::HRESULT, + fn AddRefTypeInfo(&mut self, pTInfo: *mut ITypeInfo) -> ::HRESULT, + fn AddFuncDesc(&mut self, index: ::UINT, pFuncDesc: *mut FUNCDESC) -> ::HRESULT, + fn SetImplTypeFlags(&mut self, index: ::UINT, implTypeFlags: ::INT) -> ::HRESULT, + fn SetAlignment(&mut self, cbAlignment: ::WORD) -> ::HRESULT, + fn SetSchema(&mut self, pStrSchema: ::LPOLESTR) -> ::HRESULT, + fn AddVarDesc(&mut self, index: ::UINT, pVarDesc: *mut VARDESC) -> ::HRESULT, + fn SetFuncAndParamNames( + &mut self, index: ::UINT, rgszNames: *mut ::LPOLESTR, cNames: ::UINT + ) -> ::HRESULT, + fn SetVarName(&mut self, index: ::UINT, szName: ::LPOLESTR) -> ::HRESULT, + fn SetTypeDescAlias(&mut self, pTDescAlias: *mut TYPEDESC) -> ::HRESULT, + fn DefineFuncAsDllEntry( + &mut self, index: ::UINT, szDllName: ::LPOLESTR, szProcName: ::LPOLESTR + ) -> ::HRESULT, + fn SetFuncDocString(&mut self, index: ::UINT, szDocString: ::LPOLESTR) -> ::HRESULT, + fn SetVarDocString(&mut self, index: ::UINT, szDocString: ::LPOLESTR) -> ::HRESULT, + fn SetFuncHelpContext(&mut self, index: ::UINT, dwHelpContext: ::DWORD) -> ::HRESULT, + fn SetVarHelpContext(&mut self, index: ::UINT, dwHelpContext: ::DWORD) -> ::HRESULT, + fn SetMops(&mut self, index: ::UINT, bstrMops: ::BSTR) -> ::HRESULT, + fn SetTypeIdldesc(&mut self, pIdlDesc: *mut IDLDESC) -> ::HRESULT, + fn LayOut(&mut self) -> ::HRESULT +} +); +// FIXME: Implement these interfaces +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICreateTypeInfo2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICreateTypeLib; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICreateTypeLib2; +pub type LPDISPATCH = *mut IDispatch; +pub const DISPID_UNKNOWN: ::INT = -1; +pub const DISPID_VALUE: ::INT = 0; +pub const DISPID_PROPERTYPUT: ::INT = -3; +pub const DISPID_NEWENUM: ::INT = -4; +pub const DISPID_EVALUATE: ::INT = -5; +pub const DISPID_CONSTRUCTOR: ::INT = -6; +pub const DISPID_DESTRUCTOR: ::INT = -7; +pub const DISPID_COLLECT: ::INT = -8; +RIDL!( +interface IDispatch(IDispatchVtbl): IUnknown(IUnknownVtbl) { + fn GetTypeInfoCount(&mut self, pctinfo: *mut ::UINT) -> ::HRESULT, + fn GetTypeInfo( + &mut self, iTInfo: ::UINT, lcid: ::LCID, ppTInfo: *mut *mut ITypeInfo + ) -> ::HRESULT, + fn GetIDsOfNames( + &mut self, riid: ::REFIID, rgszNames: *mut ::LPOLESTR, cNames: ::UINT, lcid: ::LCID, + rgDispId: *mut ::DISPID + ) -> ::HRESULT, + fn Invoke( + &mut self, dispIdMember: ::DISPID, riid: ::REFIID, lcid: ::LCID, wFlags: ::WORD, + pDispParams: *mut ::DISPPARAMS, pVarResult: *mut VARIANT, pExcepInfo: *mut ::EXCEPINFO, + puArgErr: *mut ::UINT + ) -> ::HRESULT +} +); +// FIXME: Implement these interfaces +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumVARIANT; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITypeComp; +RIDL!( +interface ITypeInfo(ITypeInfoVtbl): IUnknown(IUnknownVtbl) { + fn GetTypeAttr(&mut self, ppTypeAttr: *mut *mut TYPEATTR) -> ::HRESULT, + fn GetTypeComp(&mut self, ppTComp: *mut *mut ITypeComp) -> ::HRESULT, + fn GetFuncDesc(&mut self, index: ::UINT, ppFunDesc: *mut *mut FUNCDESC) -> ::HRESULT, + fn GetVarDesc(&mut self, index: ::UINT, pPVarDesc: *mut *mut VARDESC) -> ::HRESULT, + fn GetNames( + &mut self, memid: MEMBERID, rgBstrNames: *mut ::BSTR, cMaxNames: ::UINT, + pcNames: *mut ::UINT + ) -> ::HRESULT, + fn GetRefTypeOfImplType(&mut self, index: ::UINT, pRefType: *mut HREFTYPE) -> ::HRESULT, + fn GetImplTypeFlags(&mut self, index: ::UINT, pImplTypeFlags: *mut ::INT) -> ::HRESULT, + fn GetIDsOfNames( + &mut self, rgszNames: *mut ::LPOLESTR, cNames: ::UINT, pMemId: *mut MEMBERID + ) -> ::HRESULT, + fn Invoke( + &mut self, pvInstance: ::PVOID, memid: MEMBERID, wFlags: ::WORD, + pDispParams: *mut DISPPARAMS, pVarResult: *mut VARIANT, pExcepInfo: *mut EXCEPINFO, + puArgErr: *mut ::UINT + ) -> ::HRESULT, + fn GetDocumentation( + &mut self, memid: MEMBERID, pBstrName: *mut ::BSTR, pBstrDocString: *mut ::BSTR, + pdwHelpContext: *mut ::DWORD, pBstrHelpFile: *mut ::BSTR + ) -> ::HRESULT, + fn GetDllEntry( + &mut self, memid: MEMBERID, invKind: ::INVOKEKIND, pBstrDllName: *mut ::BSTR, + pBstrName: *mut ::BSTR, pwOrdinal: *mut ::WORD + ) -> ::HRESULT, + fn GetRefTypeInfo(&mut self, hRefType: HREFTYPE, ppTInfo: *mut *mut ITypeInfo) -> ::HRESULT, + fn AddressOfMember( + &mut self, memid: MEMBERID, invKind: ::INVOKEKIND, ppv: *mut ::PVOID + ) -> ::HRESULT, + fn CreateInstance( + &mut self, pUnkOuter: *mut ::IUnknown, riid: ::REFIID, ppvObj: *mut ::PVOID + ) -> ::HRESULT, + fn GetMops(&mut self, memid: MEMBERID, pBstrMops: *mut ::BSTR) -> ::HRESULT, + fn GetContainingTypeLib( + &mut self, ppTLib: *mut *mut ITypeLib, pIndex: *mut ::UINT + ) -> ::HRESULT, + fn ReleaseTypeAttr(&mut self, pTypeAttr: *mut TYPEATTR) -> (), + fn ReleaseFuncDesc(&mut self, pFuncDesc: *mut FUNCDESC) -> (), + fn ReleaseVarDesc(&mut self, pVarDesc: *mut VARDESC) -> () +} +); +// FIXME: Implement these interfaces +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITypeInfo2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITypeLib; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITypeLib2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITypeChangeEvents; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IErrorInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICreateErrorInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ISupportErrorInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITypeFactory; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITypeMarshal; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IRecordInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IErrorLog; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPropertyBag; diff --git a/third_party/rust/winapi/src/objbase.rs b/third_party/rust/winapi/src/objbase.rs new file mode 100644 index 000000000000..cfd2b79903c4 --- /dev/null +++ b/third_party/rust/winapi/src/objbase.rs @@ -0,0 +1,5 @@ +//! Component object model defintions +pub const COINIT_APARTMENTTHREADED: ::DWORD = 0x2; +pub const COINIT_MULTITHREADED: ::DWORD = 0x0; +pub const COINIT_DISABLE_OLE1DDE: ::DWORD = 0x4; +pub const COINIT_SPEED_OVER_MEMORY: ::DWORD = 0x8; diff --git a/third_party/rust/winapi/src/objidl.rs b/third_party/rust/winapi/src/objidl.rs new file mode 100644 index 000000000000..ac49010bccb2 --- /dev/null +++ b/third_party/rust/winapi/src/objidl.rs @@ -0,0 +1,100 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! this ALWAYS GENERATED file contains the definitions for the interfaces +//8402 +STRUCT!{struct BIND_OPTS { + cbStruct: ::DWORD, + grfFlags: ::DWORD, + grfMode: ::DWORD, + dwTickCountDeadline: ::DWORD, +}} +pub type LPBIND_OPTS = *mut BIND_OPTS; +//8479 +RIDL!( +interface IBindCtx(IBindCtxVtbl): IUnknown(IUnknownVtbl) { + fn RegisterObjectBound(&mut self, punk: *mut ::IUnknown) -> ::HRESULT, + fn RevokeObjectBound(&mut self, punk: *mut ::IUnknown) -> ::HRESULT, + fn ReleaseBoundObjects(&mut self) -> ::HRESULT, + fn SetBindOptions(&mut self, pbindopts: *mut BIND_OPTS) -> ::HRESULT, + fn GetBindOptions(&mut self, pbindopts: *mut BIND_OPTS) -> ::HRESULT, + fn GetRunningObjectTable(&mut self, pprot: *mut *mut IRunningObjectTable) -> ::HRESULT, + fn RegisterObjectParam(&mut self, pszKey: ::LPOLESTR, punk: *mut ::IUnknown) -> ::HRESULT, + fn GetObjectParam(&mut self, pszKey: ::LPOLESTR, ppunk: *mut *mut ::IUnknown) -> ::HRESULT, + fn EnumObjectParam(&mut self, ppenum: *mut *mut ::IEnumString) -> ::HRESULT, + fn RevokeObjectParam(&mut self, pszKey: ::LPOLESTR) -> ::HRESULT +} +); +//8681 +pub type IEnumMoniker = ::IUnknown; // TODO +//8958 +RIDL!( +interface IRunningObjectTable(IRunningObjectTableVtbl): IUnknown(IUnknownVtbl) { + fn Register( + &mut self, grfFlags: ::DWORD, punkObject: *mut ::IUnknown, pmkObjectName: *mut IMoniker, + pdwRegister: *mut ::DWORD + ) -> ::HRESULT, + fn Revoke(&mut self, dwRegister: ::DWORD) -> ::HRESULT, + fn IsRunning(&mut self, pmkObjectName: *mut IMoniker) -> ::HRESULT, + fn GetObject( + &mut self, pmkObjectName: *mut IMoniker, ppunkObject: *mut *mut ::IUnknown + ) -> ::HRESULT, + fn NoteChangeTime(&mut self, dwRegister: ::DWORD, pfiletime: *mut ::FILETIME) -> ::HRESULT, + fn GetTimeOfLastChange( + &mut self, pmkObjectName: *mut IMoniker, pfiletime: *mut ::FILETIME + ) -> ::HRESULT, + fn EnumRunning(&mut self, ppenumMoniker: *mut *mut IEnumMoniker) -> ::HRESULT +} +); +//9350 +pub type IMoniker = ::IUnknown; // TODO +pub type EOLE_AUTHENTICATION_CAPABILITIES = ::DWORD; +pub const EOAC_NONE: ::DWORD = 0; +pub const EOAC_MUTUAL_AUTH: ::DWORD = 0x1; +pub const EOAC_STATIC_CLOAKING: ::DWORD = 0x20; +pub const EOAC_DYNAMIC_CLOAKING: ::DWORD = 0x40; +pub const EOAC_ANY_AUTHORITY: ::DWORD = 0x80; +pub const EOAC_MAKE_FULLSIC: ::DWORD = 0x100; +pub const EOAC_DEFAULT: ::DWORD = 0x800; +pub const EOAC_SECURE_REFS: ::DWORD = 0x2; +pub const EOAC_ACCESS_CONTROL: ::DWORD = 0x4; +pub const EOAC_APPID: ::DWORD = 0x8; +pub const EOAC_DYNAMIC: ::DWORD = 0x10; +pub const EOAC_REQUIRE_FULLSIC: ::DWORD = 0x200; +pub const EOAC_AUTO_IMPERSONATE: ::DWORD = 0x400; +pub const EOAC_NO_CUSTOM_MARSHAL: ::DWORD = 0x2000; +pub const EOAC_DISABLE_AAA: ::DWORD = 0x1000; +STRUCT!{struct SOLE_AUTHENTICATION_SERVICE { + dwAuthnSvc: ::DWORD, + dwAuthzSvc: ::DWORD, + pPrincipalName: *mut ::OLECHAR, + hr: ::HRESULT, +}} + +RIDL!( +interface IApartmentShutdown(IApartmentShutdownVtbl): IUnknown(IUnknownVtbl) { + fn OnUninitialize(&mut self, ui64ApartmentIdentifier: ::UINT64) -> ::VOID +} +); + +RIDL!( +interface IMarshal(IMarshalVtbl): IUnknown(IUnknownVtbl) { + fn GetUnmarshalClass( + &mut self, riid: ::REFIID, pv: *const ::VOID, dwDestContext: ::DWORD, + pvDestContext: *const ::VOID, mshlflags: ::DWORD, pCid: *mut ::CLSID + ) -> ::HRESULT, + fn GetMarshalSizeMax( + &mut self, riid: ::REFIID, pv: *const ::VOID, dwDestContext: ::DWORD, + pvDestContext: *const ::VOID, mshlflags: ::DWORD, pSize: *mut ::DWORD + ) -> ::HRESULT, + fn MarshalInterface( + &mut self, pStm: *const ::IStream, riid: ::REFIID, pv: *const ::VOID, + dwDestContext: ::DWORD, pvDestContext: *const ::VOID, + mshlflags: ::DWORD + ) -> ::HRESULT, + fn UnmarshalInterface( + &mut self, pStm: *const ::IStream, riid: ::REFIID, ppv: *mut *mut ::VOID + ) -> ::HRESULT, + fn ReleaseMarshalData(&mut self, pStm: *const ::IStream) -> ::HRESULT, + fn DisconnectObject(&mut self, dwReserved: ::DWORD) -> ::HRESULT +} +); \ No newline at end of file diff --git a/third_party/rust/winapi/src/objidlbase.rs b/third_party/rust/winapi/src/objidlbase.rs new file mode 100644 index 000000000000..f49353f82325 --- /dev/null +++ b/third_party/rust/winapi/src/objidlbase.rs @@ -0,0 +1,93 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! this ALWAYS GENERATED file contains the definitions for the interfaces +RIDL!( +interface IMalloc(IMallocVtbl): IUnknown(IUnknownVtbl) { + fn Alloc(&mut self, cb: ::SIZE_T) -> *mut ::c_void, + fn Realloc(&mut self, pv: *mut ::c_void, cb: ::SIZE_T) -> *mut ::c_void, + fn Free(&mut self, pv: *mut ::c_void) -> (), + fn GetSize(&mut self, pv: *mut ::c_void) -> ::SIZE_T, + fn DidAlloc(&mut self, pv: *mut ::c_void) -> ::c_int, + fn HeapMinimize(&mut self) -> () +} +); +pub type LPMALLOC = *mut IMalloc; +STRUCT!{struct STATSTG { + pwcsName: ::LPOLESTR, + type_: ::DWORD, + cbSize: ::ULARGE_INTEGER, + mtime: ::FILETIME, + ctime: ::FILETIME, + atime: ::FILETIME, + grfMode: ::DWORD, + grfLocksSupported: ::DWORD, + clsid: ::CLSID, + grfStateBits: ::DWORD, + reserved: ::DWORD, +}} +//1945 +pub type IEnumString = ::IUnknown; // TODO +//2075 +RIDL!( +interface ISequentialStream(ISequentialStreamVtbl): IUnknown(IUnknownVtbl) { + fn Read(&mut self, pv: *mut ::c_void, cb: ::ULONG, pcbRead: *mut ::ULONG) -> ::HRESULT, + fn Write(&mut self, pv: *const ::c_void, cb: ::ULONG, pcbWritten: *mut ::ULONG) -> ::HRESULT +} +); +ENUM!{enum STGTY { + STGTY_STORAGE = 1, + STGTY_STREAM = 2, + STGTY_LOCKBYTES = 3, + STGTY_PROPERTY = 4, +}} +ENUM!{enum STREAM_SEEK { + STREAM_SEEK_SET = 0, + STREAM_SEEK_CUR = 1, + STREAM_SEEK_END = 2, +}} +ENUM!{enum LOCKTYPE { + LOCK_WRITE = 1, + LOCK_EXCLUSIVE = 2, + LOCK_ONLYONCE = 4, +}} +//2255 +RIDL!( +interface IStream(IStreamVtbl): ISequentialStream(ISequentialStreamVtbl) { + fn Seek( + &mut self, dlibMove: ::LARGE_INTEGER, dwOrigin: ::DWORD, + plibNewPosition: *mut ::ULARGE_INTEGER + ) -> ::HRESULT, + fn SetSize(&mut self, libNewSize: ::ULARGE_INTEGER) -> ::HRESULT, + fn CopyTo( + &mut self, pstm: *mut IStream, cb: ::ULARGE_INTEGER, pcbRead: *mut ::ULARGE_INTEGER, + pcbWritten: *mut ::ULARGE_INTEGER + ) -> ::HRESULT, + fn Commit(&mut self, grfCommitFlags: ::DWORD) -> ::HRESULT, + fn Revert(&mut self) -> ::HRESULT, + fn LockRegion( + &mut self, libOffset: ::ULARGE_INTEGER, cb: ::ULARGE_INTEGER, dwLockType: ::DWORD + ) -> ::HRESULT, + fn UnlockRegion( + &mut self, libOffset: ::ULARGE_INTEGER, cb: ::ULARGE_INTEGER, dwLockType: ::DWORD + ) -> ::HRESULT, + fn Stat(&mut self, pstatstg: *mut STATSTG, grfStatFlag: ::DWORD) -> ::HRESULT, + fn Clone(&mut self, ppstm: *mut *mut IStream) -> ::HRESULT +} +); +pub type LPSTREAM = *mut IStream; +ENUM!{enum APTTYPEQUALIFIER { + APTTYPEQUALIFIER_NONE = 0, + APTTYPEQUALIFIER_IMPLICIT_MTA = 1, + APTTYPEQUALIFIER_NA_ON_MTA = 2, + APTTYPEQUALIFIER_NA_ON_STA = 3, + APTTYPEQUALIFIER_NA_ON_IMPLICIT_MTA = 4, + APTTYPEQUALIFIER_NA_ON_MAINSTA = 5, + APTTYPEQUALIFIER_APPLICATION_STA= 6, +}} +ENUM!{enum APTTYPE { + APTTYPE_CURRENT = -1i32 as u32, + APTTYPE_STA = 0, + APTTYPE_MTA = 1, + APTTYPE_NA = 2, + APTTYPE_MAINSTA = 3, +}} diff --git a/third_party/rust/winapi/src/olectl.rs b/third_party/rust/winapi/src/olectl.rs new file mode 100644 index 000000000000..b55762152649 --- /dev/null +++ b/third_party/rust/winapi/src/olectl.rs @@ -0,0 +1,10 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! OLE Control interfaces +//299 +pub const SELFREG_E_FIRST: ::HRESULT = MAKE_SCODE!(::SEVERITY_ERROR, ::FACILITY_ITF, 0x0200); +pub const SELFREG_E_LAST: ::HRESULT = MAKE_SCODE!(::SEVERITY_ERROR, ::FACILITY_ITF, 0x020F); +pub const SELFREG_S_FIRST: ::HRESULT = MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_ITF, 0x0200); +pub const SELFREG_S_LAST: ::HRESULT = MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_ITF, 0x020F); +pub const SELFREG_E_TYPELIB: ::HRESULT = SELFREG_E_FIRST + 0; +pub const SELFREG_E_CLASS: ::HRESULT = SELFREG_E_FIRST + 1; diff --git a/third_party/rust/winapi/src/pdh.rs b/third_party/rust/winapi/src/pdh.rs new file mode 100644 index 000000000000..165fe1e0c5dc --- /dev/null +++ b/third_party/rust/winapi/src/pdh.rs @@ -0,0 +1,52 @@ +// Copyright © 2016, Klavs Madsen +// Licensed under the MIT License +//! Common Performance Data Helper definitions +pub const PDH_FMT_RAW: ::DWORD = 0x00000010; +pub const PDH_FMT_ANSI: ::DWORD = 0x00000020; +pub const PDH_FMT_UNICODE: ::DWORD = 0x00000040; +pub const PDH_FMT_LONG: ::DWORD = 0x00000100; +pub const PDH_FMT_DOUBLE: ::DWORD = 0x00000200; +pub const PDH_FMT_LARGE: ::DWORD = 0x00000400; +pub const PDH_FMT_NOSCALE: ::DWORD = 0x00001000; +pub const PDH_FMT_1000: ::DWORD = 0x00002000; +pub const PDH_FMT_NODATA: ::DWORD = 0x00004000; +pub const PDH_FMT_NOCAP100: ::DWORD = 0x00008000; +pub const PERF_DETAIL_COSTLY: ::DWORD = 0x00010000; +pub const PERF_DETAIL_STANDARD: ::DWORD = 0x0000FFFF; + +pub type PDH_STATUS = ::LONG; +pub type PDH_HQUERY = ::HANDLE; +pub type HQUERY = PDH_HQUERY; +pub type PDH_HCOUNTER = ::HANDLE; +pub type HCOUNTER = PDH_HCOUNTER; + +STRUCT!{struct PDH_FMT_COUNTERVALUE { + CStatus: ::DWORD, + largeValue: ::LONGLONG, +}} +UNION!(PDH_FMT_COUNTERVALUE, largeValue, largeValue, largeValue_mut, ::LONGLONG); +UNION!(PDH_FMT_COUNTERVALUE, largeValue, longValue, longValue_mut, ::LONG); +UNION!(PDH_FMT_COUNTERVALUE, largeValue, doubleValue, doubleValue_mut, ::DOUBLE); +UNION!(PDH_FMT_COUNTERVALUE, largeValue, AnsiStringValue, AnsiStringValue_mut, ::LPCSTR); +UNION!(PDH_FMT_COUNTERVALUE, largeValue, WideStringValue, WideStringValue_mut, ::LPCWSTR); +pub type PPDH_FMT_COUNTERVALUE = *mut PDH_FMT_COUNTERVALUE; + +STRUCT!{struct PDH_COUNTER_PATH_ELEMENTS_A { + szMachineName: ::LPSTR, + szObjectName: ::LPSTR, + szInstanceName: ::LPSTR, + szParentInstance: ::LPSTR, + dwInstanceIndex: ::DWORD, + szCounterName: ::LPSTR, +}} +pub type PPDH_COUNTER_PATH_ELEMENTS_A = *mut PDH_COUNTER_PATH_ELEMENTS_A; + +STRUCT!{struct PDH_COUNTER_PATH_ELEMENTS_W { + szMachineName: ::LPWSTR, + szObjectName: ::LPWSTR, + szInstanceName: ::LPWSTR, + szParentInstance: ::LPWSTR, + dwInstanceIndex: ::DWORD, + szCounterName: ::LPWSTR, +}} +pub type PPDH_COUNTER_PATH_ELEMENTS_W = *mut PDH_COUNTER_PATH_ELEMENTS_W; diff --git a/third_party/rust/winapi/src/playsoundapi.rs b/third_party/rust/winapi/src/playsoundapi.rs new file mode 100644 index 000000000000..99f4501cdad4 --- /dev/null +++ b/third_party/rust/winapi/src/playsoundapi.rs @@ -0,0 +1,19 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +pub const SND_SYNC: DWORD = 0x0000; +pub const SND_ASYNC: DWORD = 0x0001; +pub const SND_NODEFAULT: DWORD = 0x0002; +pub const SND_MEMORY: DWORD = 0x0004; +pub const SND_LOOP: DWORD = 0x0008; +pub const SND_NOSTOP: DWORD = 0x0010; +pub const SND_NOWAIT: DWORD = 0x00002000; +pub const SND_ALIAS: DWORD = 0x00010000; +pub const SND_ALIAS_ID: DWORD = 0x00110000; +pub const SND_FILENAME: DWORD = 0x00020000; +pub const SND_RESOURCE: DWORD = 0x00040004; +pub const SND_PURGE: DWORD = 0x0040; +pub const SND_APPLICATION: DWORD = 0x0080; +pub const SND_SENTRY: DWORD = 0x00080000; +pub const SND_RING: DWORD = 0x00100000; +pub const SND_SYSTEM: DWORD = 0x00200000; diff --git a/third_party/rust/winapi/src/processsnapshot.rs b/third_party/rust/winapi/src/processsnapshot.rs new file mode 100644 index 000000000000..73ea679bea6e --- /dev/null +++ b/third_party/rust/winapi/src/processsnapshot.rs @@ -0,0 +1,58 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Defines the process snapshot API +FLAGS!{enum PSS_CAPTURE_FLAGS { + PSS_CAPTURE_NONE = 0x00000000, + PSS_CAPTURE_VA_CLONE = 0x00000001, + PSS_CAPTURE_RESERVED_00000002 = 0x00000002, + PSS_CAPTURE_HANDLES = 0x00000004, + PSS_CAPTURE_HANDLE_NAME_INFORMATION = 0x00000008, + PSS_CAPTURE_HANDLE_BASIC_INFORMATION = 0x00000010, + PSS_CAPTURE_HANDLE_TYPE_SPECIFIC_INFORMATION = 0x00000020, + PSS_CAPTURE_HANDLE_TRACE = 0x00000040, + PSS_CAPTURE_THREADS = 0x00000080, + PSS_CAPTURE_THREAD_CONTEXT = 0x00000100, + PSS_CAPTURE_THREAD_CONTEXT_EXTENDED = 0x00000200, + PSS_CAPTURE_RESERVED_00000400 = 0x00000400, + PSS_CAPTURE_VA_SPACE = 0x00000800, + PSS_CAPTURE_VA_SPACE_SECTION_INFORMATION = 0x00001000, + PSS_CREATE_BREAKAWAY_OPTIONAL = 0x04000000, + PSS_CREATE_BREAKAWAY = 0x08000000, + PSS_CREATE_FORCE_BREAKAWAY = 0x10000000, + PSS_CREATE_USE_VM_ALLOCATIONS = 0x20000000, + PSS_CREATE_MEASURE_PERFORMANCE = 0x40000000, + PSS_CREATE_RELEASE_SECTION = -2147483648i32 as u32, +}} +ENUM!{enum PSS_QUERY_INFORMATION_CLASS { + PSS_QUERY_PROCESS_INFORMATION = 0, + PSS_QUERY_VA_CLONE_INFORMATION = 1, + PSS_QUERY_AUXILIARY_PAGES_INFORMATION = 2, + PSS_QUERY_VA_SPACE_INFORMATION = 3, + PSS_QUERY_HANDLE_INFORMATION = 4, + PSS_QUERY_THREAD_INFORMATION = 5, + PSS_QUERY_HANDLE_TRACE_INFORMATION = 6, + PSS_QUERY_PERFORMANCE_COUNTERS = 7, +}} +ENUM!{enum PSS_WALK_INFORMATION_CLASS { + PSS_WALK_AUXILIARY_PAGES = 0, + PSS_WALK_VA_SPACE = 1, + PSS_WALK_HANDLES = 2, + PSS_WALK_THREADS = 3, +}} +FLAGS!{enum PSS_DUPLICATE_FLAGS { + PSS_DUPLICATE_NONE = 0x00, + PSS_DUPLICATE_CLOSE_SOURCE = 0x01, +}} +DECLARE_HANDLE!(HPSS, HPSS__); +DECLARE_HANDLE!(HPSSWALK, HPSSWALK__); +pub type pAllocRoutine = Option *mut ::c_void>; +pub type pFreeRoutine = Option; +STRUCT!{nodebug struct PSS_ALLOCATOR { + Context: *mut ::c_void, + AllocRoutine: pAllocRoutine, + FreeRoutine: pFreeRoutine, +}} diff --git a/third_party/rust/winapi/src/processthreadsapi.rs b/third_party/rust/winapi/src/processthreadsapi.rs new file mode 100644 index 000000000000..fad58c7e5ac3 --- /dev/null +++ b/third_party/rust/winapi/src/processthreadsapi.rs @@ -0,0 +1,62 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +STRUCT!{struct PROCESS_INFORMATION { + hProcess: ::HANDLE, + hThread: ::HANDLE, + dwProcessId: ::DWORD, + dwThreadId: ::DWORD, +}} +pub type PPROCESS_INFORMATION = *mut PROCESS_INFORMATION; +pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION; +STRUCT!{struct STARTUPINFOA { + cb: ::DWORD, + lpReserved: ::LPSTR, + lpDesktop: ::LPSTR, + lpTitle: ::LPSTR, + dwX: ::DWORD, + dwY: ::DWORD, + dwXSize: ::DWORD, + dwYSize: ::DWORD, + dwXCountChars: ::DWORD, + dwYCountChars: ::DWORD, + dwFillAttribute: ::DWORD, + dwFlags: ::DWORD, + wShowWindow: ::WORD, + cbReserved2: ::WORD, + lpReserved2: ::LPBYTE, + hStdInput: ::HANDLE, + hStdOutput: ::HANDLE, + hStdError: ::HANDLE, +}} +pub type LPSTARTUPINFOA = *mut STARTUPINFOA; +STRUCT!{struct STARTUPINFOW { + cb: ::DWORD, + lpReserved: ::LPWSTR, + lpDesktop: ::LPWSTR, + lpTitle: ::LPWSTR, + dwX: ::DWORD, + dwY: ::DWORD, + dwXSize: ::DWORD, + dwYSize: ::DWORD, + dwXCountChars: ::DWORD, + dwYCountChars: ::DWORD, + dwFillAttribute: ::DWORD, + dwFlags: ::DWORD, + wShowWindow: ::WORD, + cbReserved2: ::WORD, + lpReserved2: ::LPBYTE, + hStdInput: ::HANDLE, + hStdOutput: ::HANDLE, + hStdError: ::HANDLE, +}} +pub type LPSTARTUPINFOW = *mut STARTUPINFOW; +STRUCT!{struct PROC_THREAD_ATTRIBUTE_LIST { + dummy: *mut ::c_void, +}} +pub type PPROC_THREAD_ATTRIBUTE_LIST = *mut PROC_THREAD_ATTRIBUTE_LIST; +pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut PROC_THREAD_ATTRIBUTE_LIST; +ENUM!{enum THREAD_INFORMATION_CLASS { + ThreadMemoryPriority, + ThreadAbsoluteCpuPriority, + ThreadInformationClassMax, +}} diff --git a/third_party/rust/winapi/src/propidl.rs b/third_party/rust/winapi/src/propidl.rs new file mode 100644 index 000000000000..802bd182f721 --- /dev/null +++ b/third_party/rust/winapi/src/propidl.rs @@ -0,0 +1,10 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +STRUCT!{struct PROPVARIANT { + vt: VARTYPE, + wReserved1: WORD, + wReserved2: WORD, + wReserved3: WORD, + data: [u8; 16], +}} diff --git a/third_party/rust/winapi/src/propsys.rs b/third_party/rust/winapi/src/propsys.rs new file mode 100644 index 000000000000..0666fbd48f6c --- /dev/null +++ b/third_party/rust/winapi/src/propsys.rs @@ -0,0 +1,4 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub type IPropertyDescriptionList = ::IUnknown; // TODO +pub type IPropertyStore = ::IUnknown; // TODO diff --git a/third_party/rust/winapi/src/prsht.rs b/third_party/rust/winapi/src/prsht.rs new file mode 100644 index 000000000000..e1795a1bc7bb --- /dev/null +++ b/third_party/rust/winapi/src/prsht.rs @@ -0,0 +1,262 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Interface for the Windows Property Sheet Pages +pub enum PSP {} +pub type HPROPSHEETPAGE = *mut PSP; +pub type LPFNPSPCALLBACKA = Option ::UINT>; +pub type LPFNPSPCALLBACKW = Option ::UINT>; +pub const PSP_DEFAULT: ::DWORD = 0x00000000; +pub const PSP_DLGINDIRECT: ::DWORD = 0x00000001; +pub const PSP_USEHICON: ::DWORD = 0x00000002; +pub const PSP_USEICONID: ::DWORD = 0x00000004; +pub const PSP_USETITLE: ::DWORD = 0x00000008; +pub const PSP_RTLREADING: ::DWORD = 0x00000010; +pub const PSP_HASHELP: ::DWORD = 0x00000020; +pub const PSP_USEREFPARENT: ::DWORD = 0x00000040; +pub const PSP_USECALLBACK: ::DWORD = 0x00000080; +pub const PSP_PREMATURE: ::DWORD = 0x00000400; +pub const PSP_HIDEHEADER: ::DWORD = 0x00000800; +pub const PSP_USEHEADERTITLE: ::DWORD = 0x00001000; +pub const PSP_USEHEADERSUBTITLE: ::DWORD = 0x00002000; +pub const PSP_USEFUSIONCONTEXT: ::DWORD = 0x00004000; +pub const PSPCB_ADDREF: ::UINT = 0; +pub const PSPCB_RELEASE: ::UINT = 1; +pub const PSPCB_CREATE: ::UINT = 2; +pub type PROPSHEETPAGE_RESOURCE = ::LPCDLGTEMPLATEA; +STRUCT!{nodebug struct PROPSHEETPAGEA_V4 { + dwSize: ::DWORD, + dwFlags: ::DWORD, + hInstance: ::HINSTANCE, + pszTemplate: ::LPCSTR, + hIcon: ::HICON, + pszTitle: ::LPCSTR, + pfnDlgProc: ::DLGPROC, + lParam: ::LPARAM, + pfnCallback: LPFNPSPCALLBACKA, + pcRefParent: *mut ::UINT, + pszHeaderTitle: ::LPCSTR, + pszHeaderSubTitle: ::LPCSTR, + hActCtx: ::HANDLE, + hbmHeader: ::HBITMAP, +}} +UNION!(PROPSHEETPAGEA_V4, pszTemplate, pResource, pResource_mut, PROPSHEETPAGE_RESOURCE); +UNION!(PROPSHEETPAGEA_V4, hIcon, pszIcon, pszIcon_mut, ::LPCSTR); +UNION!(PROPSHEETPAGEA_V4, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCSTR); +pub type LPPROPSHEETPAGEA_V4 = *mut PROPSHEETPAGEA_V4; +pub type LPCPROPSHEETPAGEA_V4 = *const PROPSHEETPAGEA_V4; +STRUCT!{nodebug struct PROPSHEETPAGEW_V4 { + dwSize: ::DWORD, + dwFlags: ::DWORD, + hInstance: ::HINSTANCE, + pszTemplate: ::LPCWSTR, + hIcon: ::HICON, + pszTitle: ::LPCWSTR, + pfnDlgProc: ::DLGPROC, + lParam: ::LPARAM, + pfnCallback: LPFNPSPCALLBACKW, + pcRefParent: *mut ::UINT, + pszHeaderTitle: ::LPCWSTR, + pszHeaderSubTitle: ::LPCWSTR, + hActCtx: ::HANDLE, + hbmHeader: ::HBITMAP, +}} +UNION!(PROPSHEETPAGEW_V4, pszTemplate, pResource, pResource_mut, PROPSHEETPAGE_RESOURCE); +UNION!(PROPSHEETPAGEW_V4, hIcon, pszIcon, pszIcon_mut, ::LPCWSTR); +UNION!(PROPSHEETPAGEW_V4, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCWSTR); +pub type LPPROPSHEETPAGEW_V4 = *mut PROPSHEETPAGEW_V4; +pub type LPCPROPSHEETPAGEW_V4 = *const PROPSHEETPAGEW_V4; +pub type PROPSHEETPAGEA_LATEST = PROPSHEETPAGEA_V4; +pub type PROPSHEETPAGEW_LATEST = PROPSHEETPAGEW_V4; +pub type LPPROPSHEETPAGEA_LATEST = LPPROPSHEETPAGEA_V4; +pub type LPPROPSHEETPAGEW_LATEST = LPPROPSHEETPAGEW_V4; +pub type LPCPROPSHEETPAGEA_LATEST = LPCPROPSHEETPAGEA_V4; +pub type LPCPROPSHEETPAGEW_LATEST = LPCPROPSHEETPAGEW_V4; +pub type PROPSHEETPAGEA = PROPSHEETPAGEA_V4; +pub type PROPSHEETPAGEW = PROPSHEETPAGEW_V4; +pub type LPPROPSHEETPAGEA = LPPROPSHEETPAGEA_V4; +pub type LPPROPSHEETPAGEW = LPPROPSHEETPAGEW_V4; +pub type LPCPROPSHEETPAGEA = LPCPROPSHEETPAGEA_V4; +pub type LPCPROPSHEETPAGEW = LPCPROPSHEETPAGEW_V4; +pub const PSH_DEFAULT: ::DWORD = 0x00000000; +pub const PSH_PROPTITLE: ::DWORD = 0x00000001; +pub const PSH_USEHICON: ::DWORD = 0x00000002; +pub const PSH_USEICONID: ::DWORD = 0x00000004; +pub const PSH_PROPSHEETPAGE: ::DWORD = 0x00000008; +pub const PSH_WIZARDHASFINISH: ::DWORD = 0x00000010; +pub const PSH_WIZARD: ::DWORD = 0x00000020; +pub const PSH_USEPSTARTPAGE: ::DWORD = 0x00000040; +pub const PSH_NOAPPLYNOW: ::DWORD = 0x00000080; +pub const PSH_USECALLBACK: ::DWORD = 0x00000100; +pub const PSH_HASHELP: ::DWORD = 0x00000200; +pub const PSH_MODELESS: ::DWORD = 0x00000400; +pub const PSH_RTLREADING: ::DWORD = 0x00000800; +pub const PSH_WIZARDCONTEXTHELP: ::DWORD = 0x00001000; +pub const PSH_WIZARD97: ::DWORD = 0x01000000; +pub const PSH_WATERMARK: ::DWORD = 0x00008000; +pub const PSH_USEHBMWATERMARK: ::DWORD = 0x00010000; +pub const PSH_USEHPLWATERMARK: ::DWORD = 0x00020000; +pub const PSH_STRETCHWATERMARK: ::DWORD = 0x00040000; +pub const PSH_HEADER: ::DWORD = 0x00080000; +pub const PSH_USEHBMHEADER: ::DWORD = 0x00100000; +pub const PSH_USEPAGELANG: ::DWORD = 0x00200000; +pub const PSH_WIZARD_LITE: ::DWORD = 0x00400000; +pub const PSH_NOCONTEXTHELP: ::DWORD = 0x02000000; +pub const PSH_AEROWIZARD: ::DWORD = 0x00004000; +pub const PSH_RESIZABLE: ::DWORD = 0x04000000; +pub const PSH_HEADERBITMAP: ::DWORD = 0x08000000; +pub const PSH_NOMARGIN: ::DWORD = 0x10000000; +pub type PFNPROPSHEETCALLBACK = Option ::c_int>; +STRUCT!{nodebug struct PROPSHEETHEADERA_V2 { + dwSize: ::DWORD, + dwFlags: ::DWORD, + hwndParent: ::HWND, + hInstance: ::HINSTANCE, + hIcon: ::HICON, + pszCaption: ::LPCSTR, + nPages: ::UINT, + pStartPage: ::LPCSTR, + ppsp: LPCPROPSHEETPAGEA, + pfnCallback: PFNPROPSHEETCALLBACK, + hbmWatermark: ::HBITMAP, + hplWatermark: ::HPALETTE, + hbmHeader: ::HBITMAP, +}} +UNION!(PROPSHEETHEADERA_V2, hIcon, pszIcon, pszIcon_mut, ::LPCSTR); +UNION!(PROPSHEETHEADERA_V2, pStartPage, nStartPage, nStartPage_mut, ::UINT); +UNION!(PROPSHEETHEADERA_V2, ppsp, phpage, phpage_mut, *mut HPROPSHEETPAGE); +UNION!(PROPSHEETHEADERA_V2, hbmWatermark, pszbmWatermark, pszbmWatermark_mut, ::LPCSTR); +UNION!(PROPSHEETHEADERA_V2, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCSTR); +pub type LPPROPSHEETHEADERA_V2 = *mut PROPSHEETHEADERA_V2; +pub type LPCPROPSHEETHEADERA_V2 = *const PROPSHEETHEADERA_V2; +STRUCT!{nodebug struct PROPSHEETHEADERW_V2 { + dwSize: ::DWORD, + dwFlags: ::DWORD, + hwndParent: ::HWND, + hInstance: ::HINSTANCE, + hIcon: ::HICON, + pszCaption: ::LPCWSTR, + nPages: ::UINT, + pStartPage: ::LPCWSTR, + ppsp: LPCPROPSHEETPAGEW, + pfnCallback: PFNPROPSHEETCALLBACK, + hbmWatermark: ::HBITMAP, + hplWatermark: ::HPALETTE, + hbmHeader: ::HBITMAP, +}} +UNION!(PROPSHEETHEADERW_V2, hIcon, pszIcon, pszIcon_mut, ::LPCWSTR); +UNION!(PROPSHEETHEADERW_V2, pStartPage, nStartPage, nStartPage_mut, ::UINT); +UNION!(PROPSHEETHEADERW_V2, ppsp, phpage, phpage_mut, *mut HPROPSHEETPAGE); +UNION!(PROPSHEETHEADERW_V2, hbmWatermark, pszbmWatermark, pszbmWatermark_mut, ::LPCWSTR); +UNION!(PROPSHEETHEADERW_V2, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCWSTR); +pub type LPPROPSHEETHEADERW_V2 = *mut PROPSHEETHEADERW_V2; +pub type LPCPROPSHEETHEADERW_V2 = *const PROPSHEETHEADERW_V2; +pub type PROPSHEETHEADERA = PROPSHEETHEADERA_V2; +pub type PROPSHEETHEADERW = PROPSHEETHEADERW_V2; +pub type LPPROPSHEETHEADERA = LPPROPSHEETHEADERA_V2; +pub type LPPROPSHEETHEADERW = LPPROPSHEETHEADERW_V2; +pub type LPCPROPSHEETHEADERA = LPCPROPSHEETHEADERA_V2; +pub type LPCPROPSHEETHEADERW = LPCPROPSHEETHEADERW_V2; +pub const PSCB_INITIALIZED: ::UINT = 1; +pub const PSCB_PRECREATE: ::UINT = 2; +pub const PSCB_BUTTONPRESSED: ::UINT = 3; +pub type LPFNADDPROPSHEETPAGE = Option ::BOOL>; +pub type LPFNADDPROPSHEETPAGES = Option ::BOOL>; +STRUCT!{struct PSHNOTIFY { + hdr: ::NMHDR, + lParam: ::LPARAM, +}} +pub type LPPSHNOTIFY = *mut PSHNOTIFY; +pub const PSN_FIRST: ::UINT = -200i32 as ::UINT; +pub const PSN_LAST: ::UINT = -299i32 as ::UINT; +pub const PSN_SETACTIVE: ::UINT = PSN_FIRST - 0; +pub const PSN_KILLACTIVE: ::UINT = PSN_FIRST - 1; +pub const PSN_APPLY: ::UINT = PSN_FIRST - 2; +pub const PSN_RESET: ::UINT = PSN_FIRST - 3; +pub const PSN_HELP: ::UINT = PSN_FIRST - 5; +pub const PSN_WIZBACK: ::UINT = PSN_FIRST - 6; +pub const PSN_WIZNEXT: ::UINT = PSN_FIRST - 7; +pub const PSN_WIZFINISH: ::UINT = PSN_FIRST - 8; +pub const PSN_QUERYCANCEL: ::UINT = PSN_FIRST - 9; +pub const PSN_GETOBJECT: ::UINT = PSN_FIRST - 10; +pub const PSN_TRANSLATEACCELERATOR: ::UINT = PSN_FIRST - 12; +pub const PSN_QUERYINITIALFOCUS: ::UINT = PSN_FIRST - 13; +pub const PSNRET_NOERROR: ::LRESULT = 0; +pub const PSNRET_INVALID: ::LRESULT = 1; +pub const PSNRET_INVALID_NOCHANGEPAGE: ::LRESULT = 2; +pub const PSNRET_MESSAGEHANDLED: ::LRESULT = 3; +pub const PSM_SETCURSEL: ::UINT = ::WM_USER + 101; +pub const PSM_REMOVEPAGE: ::UINT = ::WM_USER + 102; +pub const PSM_ADDPAGE: ::UINT = ::WM_USER + 103; +pub const PSM_CHANGED: ::UINT = ::WM_USER + 104; +pub const PSM_RESTARTWINDOWS: ::UINT = ::WM_USER + 105; +pub const PSM_REBOOTSYSTEM: ::UINT = ::WM_USER + 106; +pub const PSM_CANCELTOCLOSE: ::UINT = ::WM_USER + 107; +pub const PSM_QUERYSIBLINGS: ::UINT = ::WM_USER + 108; +pub const PSM_UNCHANGED: ::UINT = ::WM_USER + 109; +pub const PSM_APPLY: ::UINT = ::WM_USER + 110; +pub const PSM_SETTITLEA: ::UINT = ::WM_USER + 111; +pub const PSM_SETTITLEW: ::UINT = ::WM_USER + 120; +pub const PSM_SETWIZBUTTONS: ::UINT = ::WM_USER + 112; +pub const PSWIZB_BACK: ::DWORD = 0x00000001; +pub const PSWIZB_NEXT: ::DWORD = 0x00000002; +pub const PSWIZB_FINISH: ::DWORD = 0x00000004; +pub const PSWIZB_DISABLEDFINISH: ::DWORD = 0x00000008; +pub const PSWIZB_CANCEL: ::DWORD = 0x00000008; +pub const PSWIZBF_ELEVATIONREQUIRED: ::WPARAM = 0x00000001; +pub const PSBTN_BACK: ::c_int = 0; +pub const PSBTN_NEXT: ::c_int = 1; +pub const PSBTN_FINISH: ::c_int = 2; +pub const PSBTN_OK: ::c_int = 3; +pub const PSBTN_APPLYNOW: ::c_int = 4; +pub const PSBTN_CANCEL: ::c_int = 5; +pub const PSBTN_HELP: ::c_int = 6; +pub const PSBTN_MAX: ::c_int = 6; +pub const PSM_PRESSBUTTON: ::UINT = ::WM_USER + 113; +pub const PSM_SETCURSELID: ::UINT = ::WM_USER + 114; +pub const PSM_SETFINISHTEXTA: ::UINT = ::WM_USER + 115; +pub const PSM_SETFINISHTEXTW: ::UINT = ::WM_USER + 121; +pub const PSM_GETTABCONTROL: ::UINT = ::WM_USER + 116; +pub const PSM_ISDIALOGMESSAGE: ::UINT = ::WM_USER + 117; +pub const PSM_GETCURRENTPAGEHWND: ::UINT = ::WM_USER + 118; +pub const PSM_INSERTPAGE: ::UINT = ::WM_USER + 119; +pub const PSM_SETHEADERTITLEA: ::UINT = ::WM_USER + 125; +pub const PSM_SETHEADERTITLEW: ::UINT = ::WM_USER + 126; +pub const PSWIZF_SETCOLOR: ::UINT = (0 - 1) as ::UINT; +pub const PSM_SETHEADERSUBTITLEA: ::UINT = ::WM_USER + 127; +pub const PSM_SETHEADERSUBTITLEW: ::UINT = ::WM_USER + 128; +pub const PSM_HWNDTOINDEX: ::UINT = ::WM_USER + 129; +pub const PSM_INDEXTOHWND: ::UINT = ::WM_USER + 130; +pub const PSM_PAGETOINDEX: ::UINT = ::WM_USER + 131; +pub const PSM_INDEXTOPAGE: ::UINT = ::WM_USER + 132; +pub const PSM_IDTOINDEX: ::UINT = ::WM_USER + 133; +pub const PSM_INDEXTOID: ::UINT = ::WM_USER + 134; +pub const PSM_GETRESULT: ::UINT = ::WM_USER + 135; +pub const PSM_RECALCPAGESIZES: ::UINT = ::WM_USER + 136; +pub const PSM_SETNEXTTEXTW: ::UINT = ::WM_USER + 137; +pub const PSM_SHOWWIZBUTTONS: ::UINT = ::WM_USER + 138; +pub const PSM_ENABLEWIZBUTTONS: ::UINT = ::WM_USER + 139; +pub const PSM_SETBUTTONTEXTW: ::UINT = ::WM_USER + 140; +pub const PSM_SETBUTTONTEXT: ::UINT = PSM_SETBUTTONTEXTW; +pub const ID_PSRESTARTWINDOWS: ::INT_PTR = 0x2; +pub const ID_PSREBOOTSYSTEM: ::INT_PTR = ID_PSRESTARTWINDOWS | 0x1; +pub const WIZ_CXDLG: ::DWORD = 276; +pub const WIZ_CYDLG: ::DWORD = 140; +pub const WIZ_CXBMP: ::DWORD = 80; +pub const WIZ_BODYX: ::DWORD = 92; +pub const WIZ_BODYCX: ::DWORD = 184; +pub const PROP_SM_CXDLG: ::c_short = 212; +pub const PROP_SM_CYDLG: ::c_short = 188; +pub const PROP_MED_CXDLG: ::c_short = 227; +pub const PROP_MED_CYDLG: ::c_short = 215; +pub const PROP_LG_CXDLG: ::c_short = 252; +pub const PROP_LG_CYDLG: ::c_short = 218; diff --git a/third_party/rust/winapi/src/psapi.rs b/third_party/rust/winapi/src/psapi.rs new file mode 100644 index 000000000000..801d35c9e4db --- /dev/null +++ b/third_party/rust/winapi/src/psapi.rs @@ -0,0 +1,166 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! API Prototypes and Definitions for PSAPI.DLL +pub const LIST_MODULES_DEFAULT: ::DWORD = 0x0; +pub const LIST_MODULES_32BIT: ::DWORD = 0x01; +pub const LIST_MODULES_64BIT: ::DWORD = 0x02; +pub const LIST_MODULES_ALL: ::DWORD = LIST_MODULES_32BIT | LIST_MODULES_64BIT; +STRUCT!{struct MODULEINFO { + lpBaseOfDll: ::LPVOID, + SizeOfImage: ::DWORD, + EntryPoint: ::LPVOID, +}} +pub type LPMODULEINFO = *mut MODULEINFO; +STRUCT!{struct PSAPI_WORKING_SET_BLOCK { + Flags: ::ULONG_PTR, + BitFields: ::ULONG_PTR, +}} +#[cfg(target_arch="x86")] +BITFIELD!(PSAPI_WORKING_SET_BLOCK BitFields: ::ULONG_PTR [ + Protection set_Protection[0..5], + ShareCount set_ShareCount[5..8], + Shared set_Shared[8..9], + Reserved set_Reserved[9..12], + VirtualPage set_VirtualPage[12..32], +]); +#[cfg(target_arch="x86_64")] +BITFIELD!(PSAPI_WORKING_SET_BLOCK BitFields: ::ULONG_PTR [ + Protection set_Protection[0..5], + ShareCount set_ShareCount[5..8], + Shared set_Shared[8..9], + Reserved set_Reserved[9..12], + VirtualPage set_VirtualPage[12..64], +]); +pub type PPSAPI_WORKING_SET_BLOCK = *mut PSAPI_WORKING_SET_BLOCK; +STRUCT!{struct PSAPI_WORKING_SET_INFORMATION { + NumberOfEntries: ::ULONG_PTR, + WorkingSetInfo: [PSAPI_WORKING_SET_BLOCK; 1], +}} +pub type PPSAPI_WORKING_SET_INFORMATION = *mut PSAPI_WORKING_SET_INFORMATION; +STRUCT!{struct PSAPI_WORKING_SET_EX_BLOCK_Invalid { + BitFields: ::ULONG_PTR, +}} +#[cfg(target_arch="x86")] +BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK_Invalid BitFields: ::ULONG_PTR [ + Valid set_Valid[0..1], + Reserved0 set_Reserved0[1..15], + Shared set_Shared[15..16], + Reserved1 set_Reserved1[16..31], + Bad set_Bad[31..32], +]); +#[cfg(target_arch="x86_64")] +BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK_Invalid BitFields: ::ULONG_PTR [ + Valid set_Valid[0..1], + Reserved0 set_Reserved0[1..15], + Shared set_Shared[15..16], + Reserved1 set_Reserved1[16..31], + Bad set_Bad[31..32], + ReservedUlong set_ReservedUlong[32..64], +]); +STRUCT!{struct PSAPI_WORKING_SET_EX_BLOCK { + Flags: ::ULONG_PTR, + BitFields: ::ULONG_PTR, +}} +#[cfg(target_arch="x86")] +BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK BitFields: ::ULONG_PTR [ + Valid set_Valid[0..1], + ShareCount set_ShareCount[1..4], + Win32Protection set_Win32Protection[4..15], + Shared set_Shared[15..16], + Node set_Node[16..22], + Locked set_Locked[22..23], + LargePage set_LargePage[23..24], + Reserved set_Reserved[24..31], + Bad set_Bad[31..32], +]); +#[cfg(target_arch="x86_64")] +BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK BitFields: ::ULONG_PTR [ + Valid set_Valid[0..1], + ShareCount set_ShareCount[1..4], + Win32Protection set_Win32Protection[4..15], + Shared set_Shared[15..16], + Node set_Node[16..22], + Locked set_Locked[22..23], + LargePage set_LargePage[23..24], + Reserved set_Reserved[24..31], + Bad set_Bad[31..32], + ReservedUlong set_ReservedUlong[32..64], +]); +UNION!( + PSAPI_WORKING_SET_EX_BLOCK, BitFields, Invalid, Invalid_mut, PSAPI_WORKING_SET_EX_BLOCK_Invalid +); +pub type PPSAPI_WORKING_SET_EX_BLOCK = *mut PSAPI_WORKING_SET_EX_BLOCK; +STRUCT!{struct PSAPI_WORKING_SET_EX_INFORMATION { + VirtualAddress: ::PVOID, + VirtualAttributes: PSAPI_WORKING_SET_EX_BLOCK, +}} +pub type PPSAPI_WORKING_SET_EX_INFORMATION = *mut PSAPI_WORKING_SET_EX_INFORMATION; +STRUCT!{struct PSAPI_WS_WATCH_INFORMATION { + FaultingPc: ::LPVOID, + FaultingVa: ::LPVOID, +}} +pub type PPSAPI_WS_WATCH_INFORMATION = *mut PSAPI_WS_WATCH_INFORMATION; +STRUCT!{struct PSAPI_WS_WATCH_INFORMATION_EX { + BasicInfo: PSAPI_WS_WATCH_INFORMATION, + FaultingThreadId: ::ULONG_PTR, + Flags: ::ULONG_PTR, +}} +pub type PPSAPI_WS_WATCH_INFORMATION_EX = *mut PSAPI_WS_WATCH_INFORMATION_EX; +STRUCT!{struct PROCESS_MEMORY_COUNTERS { + cb: ::DWORD, + PageFaultCount: ::DWORD, + PeakWorkingSetSize: ::SIZE_T, + WorkingSetSize: ::SIZE_T, + QuotaPeakPagedPoolUsage: ::SIZE_T, + QuotaPagedPoolUsage: ::SIZE_T, + QuotaPeakNonPagedPoolUsage: ::SIZE_T, + QuotaNonPagedPoolUsage: ::SIZE_T, + PagefileUsage: ::SIZE_T, + PeakPagefileUsage: ::SIZE_T, +}} +pub type PPROCESS_MEMORY_COUNTERS = *mut PROCESS_MEMORY_COUNTERS; +STRUCT!{struct PROCESS_MEMORY_COUNTERS_EX { + cb: ::DWORD, + PageFaultCount: ::DWORD, + PeakWorkingSetSize: ::SIZE_T, + WorkingSetSize: ::SIZE_T, + QuotaPeakPagedPoolUsage: ::SIZE_T, + QuotaPagedPoolUsage: ::SIZE_T, + QuotaPeakNonPagedPoolUsage: ::SIZE_T, + QuotaNonPagedPoolUsage: ::SIZE_T, + PagefileUsage: ::SIZE_T, + PeakPagefileUsage: ::SIZE_T, + PrivateUsage: ::SIZE_T, +}} +pub type PPROCESS_MEMORY_COUNTERS_EX = *mut PROCESS_MEMORY_COUNTERS_EX; +STRUCT!{struct PERFORMANCE_INFORMATION { + cb: ::DWORD, + CommitTotal: ::SIZE_T, + CommitLimit: ::SIZE_T, + CommitPeak: ::SIZE_T, + PhysicalTotal: ::SIZE_T, + PhysicalAvailable: ::SIZE_T, + SystemCache: ::SIZE_T, + KernelTotal: ::SIZE_T, + KernelPaged: ::SIZE_T, + KernelNonpaged: ::SIZE_T, + PageSize: ::SIZE_T, + HandleCount: ::DWORD, + ProcessCount: ::DWORD, + ThreadCount: ::DWORD, +}} +pub type PPERFORMANCE_INFORMATION = *mut PERFORMANCE_INFORMATION; +STRUCT!{struct ENUM_PAGE_FILE_INFORMATION { + cb: ::DWORD, + Reserved: ::DWORD, + TotalSize: ::SIZE_T, + TotalInUse: ::SIZE_T, + PeakUsage: ::SIZE_T, +}} +pub type PENUM_PAGE_FILE_INFORMATION = *mut ENUM_PAGE_FILE_INFORMATION; +pub type PENUM_PAGE_FILE_CALLBACKA = Option ::BOOL>; +pub type PENUM_PAGE_FILE_CALLBACKW = Option ::BOOL>; diff --git a/third_party/rust/winapi/src/qos.rs b/third_party/rust/winapi/src/qos.rs new file mode 100644 index 000000000000..91026b392e8d --- /dev/null +++ b/third_party/rust/winapi/src/qos.rs @@ -0,0 +1,16 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! QoS definitions for NDIS components. +pub type SERVICETYPE = ::ULONG; +STRUCT!{struct FLOWSPEC { + TokenRate: ::ULONG, + TokenBucketSize: ::ULONG, + PeakBandwidth: ::ULONG, + Latency: ::ULONG, + DelayVariation: ::ULONG, + ServiceType: SERVICETYPE, + MaxSduSize: ::ULONG, + MinimumPolicedSize: ::ULONG, +}} +pub type PFLOWSPEC = *mut FLOWSPEC; +pub type LPFLOWSPEC = *mut FLOWSPEC; diff --git a/third_party/rust/winapi/src/reason.rs b/third_party/rust/winapi/src/reason.rs new file mode 100644 index 000000000000..66b3ed39d4bd --- /dev/null +++ b/third_party/rust/winapi/src/reason.rs @@ -0,0 +1,63 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +// Flags used by the various UIs +pub const SHTDN_REASON_FLAG_COMMENT_REQUIRED: ::DWORD = 0x01000000; +pub const SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED: ::DWORD = 0x02000000; +pub const SHTDN_REASON_FLAG_CLEAN_UI: ::DWORD = 0x04000000; +pub const SHTDN_REASON_FLAG_DIRTY_UI: ::DWORD = 0x08000000; +// Flags that end up in the event log code. +pub const SHTDN_REASON_FLAG_USER_DEFINED: ::DWORD = 0x40000000; +pub const SHTDN_REASON_FLAG_PLANNED: ::DWORD = 0x80000000; +// Microsoft major reasons. +pub const SHTDN_REASON_MAJOR_OTHER: ::DWORD = 0x00000000; +pub const SHTDN_REASON_MAJOR_NONE: ::DWORD = 0x00000000; +pub const SHTDN_REASON_MAJOR_HARDWARE: ::DWORD = 0x00010000; +pub const SHTDN_REASON_MAJOR_OPERATINGSYSTEM: ::DWORD = 0x00020000; +pub const SHTDN_REASON_MAJOR_SOFTWARE: ::DWORD = 0x00030000; +pub const SHTDN_REASON_MAJOR_APPLICATION: ::DWORD = 0x00040000; +pub const SHTDN_REASON_MAJOR_SYSTEM: ::DWORD = 0x00050000; +pub const SHTDN_REASON_MAJOR_POWER: ::DWORD = 0x00060000; +pub const SHTDN_REASON_MAJOR_LEGACY_API: ::DWORD = 0x00070000; +// Microsoft minor reasons. +pub const SHTDN_REASON_MINOR_OTHER: ::DWORD = 0x00000000; +pub const SHTDN_REASON_MINOR_NONE: ::DWORD = 0x000000ff; +pub const SHTDN_REASON_MINOR_MAINTENANCE: ::DWORD = 0x00000001; +pub const SHTDN_REASON_MINOR_INSTALLATION: ::DWORD = 0x00000002; +pub const SHTDN_REASON_MINOR_UPGRADE: ::DWORD = 0x00000003; +pub const SHTDN_REASON_MINOR_RECONFIG: ::DWORD = 0x00000004; +pub const SHTDN_REASON_MINOR_HUNG: ::DWORD = 0x00000005; +pub const SHTDN_REASON_MINOR_UNSTABLE: ::DWORD = 0x00000006; +pub const SHTDN_REASON_MINOR_DISK: ::DWORD = 0x00000007; +pub const SHTDN_REASON_MINOR_PROCESSOR: ::DWORD = 0x00000008; +pub const SHTDN_REASON_MINOR_NETWORKCARD: ::DWORD = 0x00000009; +pub const SHTDN_REASON_MINOR_POWER_SUPPLY: ::DWORD = 0x0000000a; +pub const SHTDN_REASON_MINOR_CORDUNPLUGGED: ::DWORD = 0x0000000b; +pub const SHTDN_REASON_MINOR_ENVIRONMENT: ::DWORD = 0x0000000c; +pub const SHTDN_REASON_MINOR_HARDWARE_DRIVER: ::DWORD = 0x0000000d; +pub const SHTDN_REASON_MINOR_OTHERDRIVER: ::DWORD = 0x0000000e; +pub const SHTDN_REASON_MINOR_BLUESCREEN: ::DWORD = 0x0000000F; +pub const SHTDN_REASON_MINOR_SERVICEPACK: ::DWORD = 0x00000010; +pub const SHTDN_REASON_MINOR_HOTFIX: ::DWORD = 0x00000011; +pub const SHTDN_REASON_MINOR_SECURITYFIX: ::DWORD = 0x00000012; +pub const SHTDN_REASON_MINOR_SECURITY: ::DWORD = 0x00000013; +pub const SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY: ::DWORD = 0x00000014; +pub const SHTDN_REASON_MINOR_WMI: ::DWORD = 0x00000015; +pub const SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL: ::DWORD = 0x00000016; +pub const SHTDN_REASON_MINOR_HOTFIX_UNINSTALL: ::DWORD = 0x00000017; +pub const SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL: ::DWORD = 0x00000018; +pub const SHTDN_REASON_MINOR_MMC: ::DWORD = 0x00000019; +pub const SHTDN_REASON_MINOR_SYSTEMRESTORE: ::DWORD = 0x0000001a; +pub const SHTDN_REASON_MINOR_TERMSRV: ::DWORD = 0x00000020; +pub const SHTDN_REASON_MINOR_DC_PROMOTION: ::DWORD = 0x00000021; +pub const SHTDN_REASON_MINOR_DC_DEMOTION: ::DWORD = 0x00000022; +pub const SHTDN_REASON_UNKNOWN: ::DWORD = SHTDN_REASON_MINOR_NONE; +pub const SHTDN_REASON_LEGACY_API: ::DWORD = + (SHTDN_REASON_MAJOR_LEGACY_API | SHTDN_REASON_FLAG_PLANNED); +// This mask cuts out UI flags. +pub const SHTDN_REASON_VALID_BIT_MASK: ::DWORD = 0xc0ffffff; +// Convenience flags. +pub const PCLEANUI: ::DWORD = (SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_CLEAN_UI); +pub const UCLEANUI: ::DWORD = (SHTDN_REASON_FLAG_CLEAN_UI); +pub const PDIRTYUI: ::DWORD = (SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_DIRTY_UI); +pub const UDIRTYUI: ::DWORD = (SHTDN_REASON_FLAG_DIRTY_UI); +//89 diff --git a/third_party/rust/winapi/src/restrictederrorinfo.rs b/third_party/rust/winapi/src/restrictederrorinfo.rs new file mode 100644 index 000000000000..94fbb77bb0c4 --- /dev/null +++ b/third_party/rust/winapi/src/restrictederrorinfo.rs @@ -0,0 +1,9 @@ +RIDL!( +interface IRestrictedErrorInfo(IRestrictedErrorInfoVtbl): IUnknown(IUnknownVtbl) { + fn GetErrorDetails( + &mut self, description: *mut ::BSTR, error: *mut ::HRESULT, + restrictedDescription: *mut ::BSTR, capabilitySid: *mut ::BSTR + ) -> ::HRESULT, + fn GetReference(&mut self, reference: *mut ::BSTR) -> ::HRESULT +} +); diff --git a/third_party/rust/winapi/src/roapi.rs b/third_party/rust/winapi/src/roapi.rs new file mode 100644 index 000000000000..db8d5df02795 --- /dev/null +++ b/third_party/rust/winapi/src/roapi.rs @@ -0,0 +1,13 @@ +ENUM!{enum RO_INIT_TYPE { + RO_INIT_SINGLETHREADED = 0, + RO_INIT_MULTITHREADED = 1, +}} + +pub enum RO_REGISTRATION_COOKIE__{} +pub type RO_REGISTRATION_COOKIE = *mut RO_REGISTRATION_COOKIE__; + +pub type PFNGETACTIVATIONFACTORY = Option ::HRESULT>; + +DECLARE_HANDLE!(APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, APARTMENT_SHUTDOWN_REGISTRATION_COOKIE__); diff --git a/third_party/rust/winapi/src/roerrorapi.rs b/third_party/rust/winapi/src/roerrorapi.rs new file mode 100644 index 000000000000..9a0cbcc677d4 --- /dev/null +++ b/third_party/rust/winapi/src/roerrorapi.rs @@ -0,0 +1,11 @@ +FLAGS!{enum RO_ERROR_REPORTING_FLAGS { + RO_ERROR_REPORTING_NONE = 0x00000000, + RO_ERROR_REPORTING_SUPPRESSEXCEPTIONS = 0x00000001, + RO_ERROR_REPORTING_FORCEEXCEPTIONS = 0x00000002, + RO_ERROR_REPORTING_USESETERRORINFO = 0x00000004, + RO_ERROR_REPORTING_SUPPRESSSETERRORINFO = 0x00000008, +}} + +pub type PINSPECT_MEMORY_CALLBACK = Option ::HRESULT>; diff --git a/third_party/rust/winapi/src/rpc.rs b/third_party/rust/winapi/src/rpc.rs new file mode 100644 index 000000000000..0b013d39e96f --- /dev/null +++ b/third_party/rust/winapi/src/rpc.rs @@ -0,0 +1,5 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +// Master include file for RPC applications. +pub type I_RPC_HANDLE = *mut ::c_void; +pub type RPC_STATUS = ::c_long; diff --git a/third_party/rust/winapi/src/rpcdce.rs b/third_party/rust/winapi/src/rpcdce.rs new file mode 100644 index 000000000000..68d88c7a3254 --- /dev/null +++ b/third_party/rust/winapi/src/rpcdce.rs @@ -0,0 +1,535 @@ +// Copyright © 2015, Brian Vincent +// Licensed under the MIT License +// This module contains the DCE RPC runtime APIs. +pub type RPC_CSTR = *mut ::c_uchar; +pub type RPC_WSTR = *mut ::wchar_t; +pub type RPC_CWSTR = *const ::wchar_t; +pub type RPC_BINDING_HANDLE = ::I_RPC_HANDLE; +pub type handle_t = RPC_BINDING_HANDLE; +pub type rpc_binding_handle_t = RPC_BINDING_HANDLE; +pub type UUID = ::GUID; +pub type uuid_t = UUID; +STRUCT!{struct RPC_BINDING_VECTOR { + Count: ::c_ulong, + BindingH: [RPC_BINDING_HANDLE; 1], +}} +pub type rpc_binding_vector_t = RPC_BINDING_VECTOR; +STRUCT!{struct UUID_VECTOR { + Count: ::c_ulong, + Uuid: [*mut UUID; 1], +}} +pub type uuid_vector_t = UUID_VECTOR; +pub type RPC_IF_HANDLE = *mut ::c_void; +STRUCT!{struct RPC_IF_ID { + Uuid: UUID, + VersMajor: ::c_ushort, + VersMinor: ::c_ushort, +}} +pub const RPC_C_BINDING_INFINITE_TIMEOUT: ::DWORD = 10; +pub const RPC_C_BINDING_MIN_TIMEOUT: ::DWORD = 0; +pub const RPC_C_BINDING_DEFAULT_TIMEOUT: ::DWORD = 5; +pub const RPC_C_BINDING_MAX_TIMEOUT: ::DWORD = 9; +pub const RPC_C_CANCEL_INFINITE_TIMEOUT: ::c_int = -1; +pub const RPC_C_LISTEN_MAX_CALLS_DEFAULT: ::DWORD = 1234; +pub const RPC_C_PROTSEQ_MAX_REQS_DEFAULT: ::DWORD = 10; +pub const RPC_C_BIND_TO_ALL_NICS: ::DWORD = 1; +pub const RPC_C_USE_INTERNET_PORT: ::DWORD = 0x1; +pub const RPC_C_USE_INTRANET_PORT: ::DWORD = 0x2; +pub const RPC_C_DONT_FAIL: ::DWORD = 0x4; +pub const RPC_C_RPCHTTP_USE_LOAD_BALANCE: ::DWORD = 0x8; +pub const RPC_C_MQ_TEMPORARY: ::DWORD = 0x0000; +pub const RPC_C_MQ_PERMANENT: ::DWORD = 0x0001; +pub const RPC_C_MQ_CLEAR_ON_OPEN: ::DWORD = 0x0002; +pub const RPC_C_MQ_USE_EXISTING_SECURITY: ::DWORD = 0x0004; +pub const RPC_C_MQ_AUTHN_LEVEL_NONE: ::DWORD = 0x0000; +pub const RPC_C_MQ_AUTHN_LEVEL_PKT_INTEGRITY: ::DWORD = 0x0008; +pub const RPC_C_MQ_AUTHN_LEVEL_PKT_PRIVACY: ::DWORD = 0x0010; +pub const RPC_C_OPT_MQ_DELIVERY: ::DWORD = 1; +pub const RPC_C_OPT_MQ_PRIORITY: ::DWORD = 2; +pub const RPC_C_OPT_MQ_JOURNAL: ::DWORD = 3; +pub const RPC_C_OPT_MQ_ACKNOWLEDGE: ::DWORD = 4; +pub const RPC_C_OPT_MQ_AUTHN_SERVICE: ::DWORD = 5; +pub const RPC_C_OPT_MQ_AUTHN_LEVEL: ::DWORD = 6; +pub const RPC_C_OPT_MQ_TIME_TO_REACH_QUEUE: ::DWORD = 7; +pub const RPC_C_OPT_MQ_TIME_TO_BE_RECEIVED: ::DWORD = 8; +pub const RPC_C_OPT_BINDING_NONCAUSAL: ::DWORD = 9; +pub const RPC_C_OPT_SECURITY_CALLBACK: ::DWORD = 10; +pub const RPC_C_OPT_UNIQUE_BINDING: ::DWORD = 11; +pub const RPC_C_OPT_CALL_TIMEOUT: ::DWORD = 12; +pub const RPC_C_OPT_DONT_LINGER: ::DWORD = 13; +pub const RPC_C_OPT_TRUST_PEER: ::DWORD = 14; +pub const RPC_C_OPT_ASYNC_BLOCK: ::DWORD = 15; +pub const RPC_C_OPT_OPTIMIZE_TIME: ::DWORD = 16; +pub const RPC_C_OPT_MAX_OPTIONS: ::DWORD = 17; +pub const RPC_C_MQ_EXPRESS: ::DWORD = 0; +pub const RPC_C_MQ_RECOVERABLE: ::DWORD = 1; +pub const RPC_C_MQ_JOURNAL_NONE: ::DWORD = 0; +pub const RPC_C_MQ_JOURNAL_DEADLETTER: ::DWORD = 1; +pub const RPC_C_MQ_JOURNAL_ALWAYS: ::DWORD = 2; +pub const RPC_C_FULL_CERT_CHAIN: ::DWORD = 0x0001; +STRUCT!{struct RPC_PROTSEQ_VECTORA { + Count: ::c_uint, + Protseq: [*mut ::c_uchar; 1], +}} +STRUCT!{struct RPC_PROTSEQ_VECTORW { + Count: ::c_uint, + Protseq: [*mut ::c_ushort; 1], +}} +STRUCT!{struct RPC_POLICY { + Length: ::c_uint, + EndpointFlags: ::c_ulong, + NICFlags: ::c_ulong, +}} +pub type PRPC_POLICY = *mut RPC_POLICY; +pub type RPC_OBJECT_INQ_FN = Option; +pub type RPC_IF_CALLBACK_FN = Option ::RPC_STATUS>; +pub type RPC_SECURITY_CALLBACK_FN = Option; +pub type RPC_MGR_EPV = ::c_void; +STRUCT!{struct RPC_STATS_VECTOR { + Count: ::c_uint, + Stats: [::c_ulong; 1], +}} +pub const RPC_C_STATS_CALLS_IN: ::c_ulong = 0; +pub const RPC_C_STATS_CALLS_OUT: ::c_ulong = 1; +pub const RPC_C_STATS_PKTS_IN: ::c_ulong = 2; +pub const RPC_C_STATS_PKTS_OUT: ::c_ulong = 3; +STRUCT!{struct RPC_IF_ID_VECTOR { + Count: ::c_ulong, + IfId: [*mut RPC_IF_ID; 1], +}} +pub type RPC_AUTH_IDENTITY_HANDLE = *mut ::c_void; +pub type RPC_AUTHZ_HANDLE = *mut ::c_void; +pub const RPC_C_AUTHN_LEVEL_DEFAULT: ::DWORD = 0; +pub const RPC_C_AUTHN_LEVEL_NONE: ::DWORD = 1; +pub const RPC_C_AUTHN_LEVEL_CONNECT: ::DWORD = 2; +pub const RPC_C_AUTHN_LEVEL_CALL: ::DWORD = 3; +pub const RPC_C_AUTHN_LEVEL_PKT: ::DWORD = 4; +pub const RPC_C_AUTHN_LEVEL_PKT_INTEGRITY: ::DWORD = 5; +pub const RPC_C_AUTHN_LEVEL_PKT_PRIVACY: ::DWORD = 6; +pub const RPC_C_IMP_LEVEL_DEFAULT: ::DWORD = 0; +pub const RPC_C_IMP_LEVEL_ANONYMOUS: ::DWORD = 1; +pub const RPC_C_IMP_LEVEL_IDENTIFY: ::DWORD = 2; +pub const RPC_C_IMP_LEVEL_IMPERSONATE: ::DWORD = 3; +pub const RPC_C_IMP_LEVEL_DELEGATE: ::DWORD = 4; +pub const RPC_C_QOS_IDENTITY_STATIC: ::DWORD = 0; +pub const RPC_C_QOS_IDENTITY_DYNAMIC: ::DWORD = 1; +pub const RPC_C_QOS_CAPABILITIES_DEFAULT: ::DWORD = 0x0; +pub const RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH: ::DWORD = 0x1; +pub const RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC: ::DWORD = 0x2; +pub const RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY: ::DWORD = 0x4; +pub const RPC_C_QOS_CAPABILITIES_IGNORE_DELEGATE_FAILURE: ::DWORD = 0x8; +pub const RPC_C_QOS_CAPABILITIES_LOCAL_MA_HINT: ::DWORD = 0x10; +pub const RPC_C_QOS_CAPABILITIES_SCHANNEL_FULL_AUTH_IDENTITY: ::DWORD = 0x20; +pub const RPC_C_PROTECT_LEVEL_DEFAULT: ::DWORD = RPC_C_AUTHN_LEVEL_DEFAULT; +pub const RPC_C_PROTECT_LEVEL_NONE: ::DWORD = RPC_C_AUTHN_LEVEL_NONE; +pub const RPC_C_PROTECT_LEVEL_CONNECT: ::DWORD = RPC_C_AUTHN_LEVEL_CONNECT; +pub const RPC_C_PROTECT_LEVEL_CALL: ::DWORD = RPC_C_AUTHN_LEVEL_CALL; +pub const RPC_C_PROTECT_LEVEL_PKT: ::DWORD = RPC_C_AUTHN_LEVEL_PKT; +pub const RPC_C_PROTECT_LEVEL_PKT_INTEGRITY: ::DWORD = RPC_C_AUTHN_LEVEL_PKT_INTEGRITY; +pub const RPC_C_PROTECT_LEVEL_PKT_PRIVACY: ::DWORD = RPC_C_AUTHN_LEVEL_PKT_PRIVACY; +pub const RPC_C_AUTHN_NONE: ::DWORD = 0; +pub const RPC_C_AUTHN_DCE_PRIVATE: ::DWORD = 1; +pub const RPC_C_AUTHN_DCE_PUBLIC: ::DWORD = 2; +pub const RPC_C_AUTHN_DEC_PUBLIC: ::DWORD = 4; +pub const RPC_C_AUTHN_GSS_NEGOTIATE: ::DWORD = 9; +pub const RPC_C_AUTHN_WINNT: ::DWORD = 10; +pub const RPC_C_AUTHN_GSS_SCHANNEL: ::DWORD = 14; +pub const RPC_C_AUTHN_GSS_KERBEROS: ::DWORD = 16; +pub const RPC_C_AUTHN_DPA: ::DWORD = 17; +pub const RPC_C_AUTHN_MSN: ::DWORD = 18; +pub const RPC_C_AUTHN_DIGEST: ::DWORD = 21; +pub const RPC_C_AUTHN_KERNEL: ::DWORD = 20; +pub const RPC_C_AUTHN_NEGO_EXTENDER: ::DWORD = 30; +pub const RPC_C_AUTHN_PKU2U: ::DWORD = 31; +pub const RPC_C_AUTHN_LIVE_SSP: ::DWORD = 32; +pub const RPC_C_AUTHN_LIVEXP_SSP: ::DWORD = 35; +pub const RPC_C_AUTHN_MSONLINE: ::DWORD = 82; +pub const RPC_C_AUTHN_MQ: ::DWORD = 100; +pub const RPC_C_AUTHN_DEFAULT: ::DWORD = 0xFFFFFFFF; +pub const RPC_C_NO_CREDENTIALS: ::DWORD = 0xFFFFFFFF; +pub const RPC_C_SECURITY_QOS_VERSION: ::DWORD = 1; +pub const RPC_C_SECURITY_QOS_VERSION_1: ::DWORD = 1; +STRUCT!{struct RPC_SECURITY_QOS { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, +}} +pub type PRPC_SECURITY_QOS = *mut RPC_SECURITY_QOS; +STRUCT!{struct SEC_WINNT_AUTH_IDENTITY_W { + User: *mut ::c_ushort, + UserLength: ::c_ulong, + Domain: *mut ::c_ushort, + DomainLength: ::c_ulong, + Password: *mut ::c_ushort, + PasswordLength: ::c_ulong, + Flags: ::c_ulong, +}} +pub type PSEC_WINNT_AUTH_IDENTITY_W = *mut SEC_WINNT_AUTH_IDENTITY_W; +STRUCT!{struct SEC_WINNT_AUTH_IDENTITY_A { + User: *mut ::c_uchar, + UserLength: ::c_ulong, + Domain: *mut ::c_uchar, + DomainLength: ::c_ulong, + Password: *mut ::c_uchar, + PasswordLength: ::c_ulong, + Flags: ::c_ulong, +}} +pub type PSEC_WINNT_AUTH_IDENTITY_A = *mut SEC_WINNT_AUTH_IDENTITY_A; +pub const RPC_C_AUTHN_INFO_TYPE_HTTP: ::c_ulong = 1; +pub const RPC_C_HTTP_AUTHN_TARGET_SERVER: ::c_ulong = 1; +pub const RPC_C_HTTP_AUTHN_TARGET_PROXY: ::c_ulong = 2; +pub const RPC_C_HTTP_AUTHN_SCHEME_BASIC: ::c_ulong = 0x00000001; +pub const RPC_C_HTTP_AUTHN_SCHEME_NTLM: ::c_ulong = 0x00000002; +pub const RPC_C_HTTP_AUTHN_SCHEME_PASSPORT: ::c_ulong = 0x00000004; +pub const RPC_C_HTTP_AUTHN_SCHEME_DIGEST: ::c_ulong = 0x00000008; +pub const RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE: ::c_ulong = 0x00000010; +pub const RPC_C_HTTP_AUTHN_SCHEME_CERT: ::c_ulong = 0x00010000; +pub const RPC_C_HTTP_FLAG_USE_SSL: ::c_ulong = 1; +pub const RPC_C_HTTP_FLAG_USE_FIRST_AUTH_SCHEME: ::c_ulong = 2; +pub const RPC_C_HTTP_FLAG_IGNORE_CERT_CN_INVALID: ::c_ulong = 8; +pub const RPC_C_HTTP_FLAG_ENABLE_CERT_REVOCATION_CHECK: ::c_ulong = 16; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_W { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, + Flags: ::c_ulong, + AuthenticationTarget: ::c_ulong, + NumberOfAuthnSchemes: ::c_ulong, + AuthnSchemes: *mut ::c_ulong, + ServerCertificateSubject: *mut ::c_ushort, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_A { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, + Flags: ::c_ulong, + AuthenticationTarget: ::c_ulong, + NumberOfAuthnSchemes: ::c_ulong, + AuthnSchemes: *mut ::c_ulong, + ServerCertificateSubject: *mut ::c_uchar, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, + Flags: ::c_ulong, + AuthenticationTarget: ::c_ulong, + NumberOfAuthnSchemes: ::c_ulong, + AuthnSchemes: *mut ::c_ulong, + ServerCertificateSubject: *mut ::c_ushort, + ProxyCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, + NumberOfProxyAuthnSchemes: ::c_ulong, + ProxyAuthnSchemes: *mut ::c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, + Flags: ::c_ulong, + AuthenticationTarget: ::c_ulong, + NumberOfAuthnSchemes: ::c_ulong, + AuthnSchemes: *mut ::c_ulong, + ServerCertificateSubject: *mut ::c_uchar, + ProxyCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, + NumberOfProxyAuthnSchemes: ::c_ulong, + ProxyAuthnSchemes: *mut ::c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W { + TransportCredentials: RPC_AUTH_IDENTITY_HANDLE, + Flags: ::c_ulong, + AuthenticationTarget: ::c_ulong, + NumberOfAuthnSchemes: ::c_ulong, + AuthnSchemes: *mut ::c_ulong, + ServerCertificateSubject: *mut ::c_ushort, + ProxyCredentials: *mut RPC_AUTH_IDENTITY_HANDLE, + NumberOfProxyAuthnSchemes: ::c_ulong, + ProxyAuthnSchemes: *mut ::c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A { + TransportCredentials: RPC_AUTH_IDENTITY_HANDLE, + Flags: ::c_ulong, + AuthenticationTarget: ::c_ulong, + NumberOfAuthnSchemes: ::c_ulong, + AuthnSchemes: *mut ::c_ulong, + ServerCertificateSubject: *mut ::c_uchar, + ProxyCredentials: *mut RPC_AUTH_IDENTITY_HANDLE, + NumberOfProxyAuthnSchemes: ::c_ulong, + ProxyAuthnSchemes: *mut ::c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A; +STRUCT!{struct RPC_SECURITY_QOS_V2_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V2_W { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V2_W_union, +}} +pub type PRPC_SECURITY_QOS_V2_W = *mut RPC_SECURITY_QOS_V2_W; +STRUCT!{struct RPC_SECURITY_QOS_V2_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V2_A { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V2_A_union, +}} +pub type PRPC_SECURITY_QOS_V2_A = *mut RPC_SECURITY_QOS_V2_A; +STRUCT!{struct RPC_SECURITY_QOS_V3_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V3_W { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V3_W_union, + Sid: *mut ::c_void, +}} +pub type PRPC_SECURITY_QOS_V3_W = *mut RPC_SECURITY_QOS_V3_W; +STRUCT!{struct RPC_SECURITY_QOS_V3_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V3_A { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V3_A_union, + Sid: *mut ::c_void, +}} +pub type PRPC_SECURITY_QOS_V3_A = *mut RPC_SECURITY_QOS_V3_A; +STRUCT!{struct RPC_SECURITY_QOS_V4_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V4_W { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V4_W_union, + Sid: *mut ::c_void, + EffectiveOnly: ::c_uint, +}} +pub type PRPC_SECURITY_QOS_V4_W = *mut RPC_SECURITY_QOS_V4_W; +STRUCT!{struct RPC_SECURITY_QOS_V4_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V4_A { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V4_A_union, + Sid: *mut ::c_void, + EffectiveOnly: ::c_uint, +}} +pub type PRPC_SECURITY_QOS_V4_A = *mut RPC_SECURITY_QOS_V4_A; +STRUCT!{struct RPC_SECURITY_QOS_V5_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V5_W { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V5_W_union, + Sid: *mut ::c_void, + EffectiveOnly: ::c_uint, + ServerSecurityDescriptor: *mut ::c_void, +}} +pub type PRPC_SECURITY_QOS_V5_W = *mut RPC_SECURITY_QOS_V5_W; +STRUCT!{struct RPC_SECURITY_QOS_V5_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V5_A { + Version: ::c_ulong, + Capabilities: ::c_ulong, + IdentityTracking: ::c_ulong, + ImpersonationType: ::c_ulong, + AdditionalSecurityInfoType: ::c_ulong, + u: RPC_SECURITY_QOS_V5_A_union, + Sid: *mut ::c_void, + EffectiveOnly: ::c_uint, + ServerSecurityDescriptor: *mut ::c_void, +}} +pub type PRPC_SECURITY_QOS_V5_A = *mut RPC_SECURITY_QOS_V5_A; +pub const RPC_PROTSEQ_TCP: ::c_ulong = 0x1; +pub const RPC_PROTSEQ_NMP: ::c_ulong = 0x2; +pub const RPC_PROTSEQ_LRPC: ::c_ulong = 0x3; +pub const RPC_PROTSEQ_HTTP: ::c_ulong = 0x4; +pub const RPC_BHT_OBJECT_UUID_VALID: ::c_ulong = 0x1; +pub const RPC_BHO_NONCAUSAL: ::c_ulong = 0x1; +pub const RPC_BHO_DONTLINGER: ::c_ulong = 0x2; +pub const RPC_BHO_EXCLUSIVE_AND_GUARANTEED: ::c_ulong = 0x4; +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_W_union { + Reserved: *mut ::c_ushort, +}} +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_W { + Version: ::c_ulong, + Flags: ::c_ulong, + ProtocolSequence: ::c_ulong, + NetworkAddress: *mut ::c_ushort, + StringEndpoint: *mut ::c_ushort, + u1: RPC_BINDING_HANDLE_TEMPLATE_V1_W_union, + ObjectUuid: UUID, +}} +pub type PRPC_BINDING_HANDLE_TEMPLATE_V1_W = *mut RPC_BINDING_HANDLE_TEMPLATE_V1_W; +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_A_union { + Reserved: *mut ::c_uchar, +}} +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_A { + Version: ::c_ulong, + Flags: ::c_ulong, + ProtocolSequence: ::c_ulong, + NetworkAddress: *mut ::c_uchar, + StringEndpoint: *mut ::c_uchar, + u1: RPC_BINDING_HANDLE_TEMPLATE_V1_A_union, + ObjectUuid: UUID, +}} +pub type PRPC_BINDING_HANDLE_TEMPLATE_V1_A = *mut RPC_BINDING_HANDLE_TEMPLATE_V1_A; +STRUCT!{struct RPC_BINDING_HANDLE_SECURITY_V1_W { + Version: ::c_ulong, + ServerPrincName: *mut ::c_ushort, + AuthnLevel: ::c_ulong, + AuthnSvc: ::c_ulong, + AuthIdentity: *mut SEC_WINNT_AUTH_IDENTITY_W, + SecurityQos: *mut RPC_SECURITY_QOS, +}} +pub type PRPC_BINDING_HANDLE_SECURITY_V1_W = *mut RPC_BINDING_HANDLE_SECURITY_V1_W; +STRUCT!{struct RPC_BINDING_HANDLE_SECURITY_V1_A { + Version: ::c_ulong, + ServerPrincName: *mut ::c_uchar, + AuthnLevel: ::c_ulong, + AuthnSvc: ::c_ulong, + AuthIdentity: *mut SEC_WINNT_AUTH_IDENTITY_A, + SecurityQos: *mut RPC_SECURITY_QOS, +}} +pub type PRPC_BINDING_HANDLE_SECURITY_V1_A = *mut RPC_BINDING_HANDLE_SECURITY_V1_A; +STRUCT!{struct RPC_BINDING_HANDLE_OPTIONS_V1 { + Version: ::c_ulong, + Flags: ::c_ulong, + ComTimeout: ::c_ulong, + CallTimeout: ::c_ulong, +}} +pub type PRPC_BINDING_HANDLE_OPTIONS_V1 = *mut RPC_BINDING_HANDLE_OPTIONS_V1; +ENUM!{enum RPC_HTTP_REDIRECTOR_STAGE { + RPCHTTP_RS_REDIRECT = 1, + RPCHTTP_RS_ACCESS_1, + RPCHTTP_RS_SESSION, + RPCHTTP_RS_ACCESS_2, + RPCHTTP_RS_INTERFACE, +}} +pub type RPC_NEW_HTTP_PROXY_CHANNEL = Option ::RPC_STATUS>; +pub type RPC_HTTP_PROXY_FREE_STRING = Option; +pub const RPC_C_AUTHZ_NONE: ::DWORD = 0; +pub const RPC_C_AUTHZ_NAME: ::DWORD = 1; +pub const RPC_C_AUTHZ_DCE: ::DWORD = 2; +pub const RPC_C_AUTHZ_DEFAULT: ::DWORD = 0xffffffff; +pub type RPC_AUTH_KEY_RETRIEVAL_FN = Option; +STRUCT!{struct RPC_CLIENT_INFORMATION1 { + UserName: *mut ::c_uchar, + ComputerName: *mut ::c_uchar, + Privilege: ::c_ushort, + AuthFlags: ::c_ulong, +}} +pub type PRPC_CLIENT_INFORMATION1 = *mut RPC_CLIENT_INFORMATION1; +pub type RPC_EP_INQ_HANDLE = *mut ::I_RPC_HANDLE; +pub const RPC_C_EP_ALL_ELTS: ::c_ulong = 0; +pub const RPC_C_EP_MATCH_BY_IF: ::c_ulong = 1; +pub const RPC_C_EP_MATCH_BY_OBJ: ::c_ulong = 2; +pub const RPC_C_EP_MATCH_BY_BOTH: ::c_ulong = 3; +pub const RPC_C_VERS_ALL: ::c_ulong = 1; +pub const RPC_C_VERS_COMPATIBLE: ::c_ulong = 2; +pub const RPC_C_VERS_EXACT: ::c_ulong = 3; +pub const RPC_C_VERS_MAJOR_ONLY: ::c_ulong = 4; +pub const RPC_C_VERS_UPTO: ::c_ulong = 5; +pub type RPC_MGMT_AUTHORIZATION_FN = Option ::c_int>; +pub const RPC_C_MGMT_INQ_IF_IDS: ::c_ulong = 0; +pub const RPC_C_MGMT_INQ_PRINC_NAME: ::c_ulong = 1; +pub const RPC_C_MGMT_INQ_STATS: ::c_ulong = 2; +pub const RPC_C_MGMT_IS_SERVER_LISTEN: ::c_ulong = 3; +pub const RPC_C_MGMT_STOP_SERVER_LISTEN: ::c_ulong = 4; +pub const RPC_IF_AUTOLISTEN: ::c_uint = 0x0001; +pub const RPC_IF_OLE: ::c_uint = 0x0002; +pub const RPC_IF_ALLOW_UNKNOWN_AUTHORITY: ::c_uint = 0x0004; +pub const RPC_IF_ALLOW_SECURE_ONLY: ::c_uint = 0x0008; +pub const RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH: ::c_uint = 0x0010; +pub const RPC_IF_ALLOW_LOCAL_ONLY: ::c_uint = 0x0020; +pub const RPC_IF_SEC_NO_CACHE: ::c_uint = 0x0040; +pub const RPC_IF_SEC_CACHE_PER_PROC: ::c_uint = 0x0080; +pub const RPC_IF_ASYNC_CALLBACK: ::c_uint = 0x0100; +pub const RPC_FW_IF_FLAG_DCOM: ::c_uint = 0x0001; +pub type RPC_INTERFACE_GROUP = *mut ::c_void; +pub type PRPC_INTERFACE_GROUP = *mut *mut ::c_void; +STRUCT!{struct RPC_ENDPOINT_TEMPLATEW { + Version: ::c_ulong, + ProtSeq: RPC_WSTR, + Endpoint: RPC_WSTR, + SecurityDescriptor: *mut ::c_void, + Backlog: ::c_ulong, +}} +pub type PRPC_ENDPOINT_TEMPLATEW = *mut RPC_ENDPOINT_TEMPLATEW; +STRUCT!{struct RPC_ENDPOINT_TEMPLATEA { + Version: ::c_ulong, + ProtSeq: RPC_CSTR, + Endpoint: RPC_CSTR, + SecurityDescriptor: *mut ::c_void, + Backlog: ::c_ulong, +}} +pub type PRPC_ENDPOINT_TEMPLATEA = *mut RPC_ENDPOINT_TEMPLATEA; +STRUCT!{struct RPC_INTERFACE_TEMPLATEA { + Version: ::c_ulong, + IfSpec: RPC_IF_HANDLE, + MgrTypeUuid: *mut UUID, + MgrEpv: *mut RPC_MGR_EPV, + Flags: ::c_uint, + MaxCalls: ::c_uint, + MaxRpcSize: ::c_uint, + IfCallback: *mut RPC_IF_CALLBACK_FN, + UuidVector: *mut UUID_VECTOR, + Annotation: RPC_CSTR, + SecurityDescriptor: *mut ::c_void, +}} +pub type PRPC_INTERFACE_TEMPLATEA = *mut RPC_INTERFACE_TEMPLATEA; +STRUCT!{struct RPC_INTERFACE_TEMPLATEW { + Version: ::c_ulong, + IfSpec: RPC_IF_HANDLE, + MgrTypeUuid: *mut UUID, + MgrEpv: *mut RPC_MGR_EPV, + Flags: ::c_uint, + MaxCalls: ::c_uint, + MaxRpcSize: ::c_uint, + IfCallback: *mut RPC_IF_CALLBACK_FN, + UuidVector: *mut UUID_VECTOR, + Annotation: RPC_WSTR, + SecurityDescriptor: *mut ::c_void, +}} +pub type PRPC_INTERFACE_TEMPLATEW = *mut RPC_INTERFACE_TEMPLATEW; +pub type RPC_INTERFACE_GROUP_IDLE_CALLBACK_FN = Option; diff --git a/third_party/rust/winapi/src/sapi.rs b/third_party/rust/winapi/src/sapi.rs new file mode 100644 index 000000000000..ac6ca11e7c74 --- /dev/null +++ b/third_party/rust/winapi/src/sapi.rs @@ -0,0 +1,2431 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of sapi.h +ENUM!{enum SPDATAKEYLOCATION { + SPDKL_DefaultLocation = 0, + SPDKL_CurrentUser = 1, + SPDKL_LocalMachine = 2, + SPDKL_CurrentConfig = 5, +}} +pub const SPDUI_EngineProperties: &'static str = "EngineProperties"; +pub const SPDUI_AddRemoveWord: &'static str = "AddRemoveWord"; +pub const SPDUI_UserTraining: &'static str = "UserTraining"; +pub const SPDUI_MicTraining: &'static str = "MicTraining"; +pub const SPDUI_RecoProfileProperties: &'static str = "RecoProfileProperties"; +pub const SPDUI_AudioProperties: &'static str = "AudioProperties"; +pub const SPDUI_AudioVolume: &'static str = "AudioVolume"; +pub const SPDUI_UserEnrollment: &'static str = "UserEnrollment"; +pub const SPDUI_ShareData: &'static str = "ShareData"; +pub const SPDUI_Tutorial: &'static str = "Tutorial"; +ENUM!{enum SPSTREAMFORMAT { + SPSF_Default = -1i32 as u32, + SPSF_NoAssignedFormat = 0, + SPSF_Text = 1, + SPSF_NonStandardFormat = 2, + SPSF_ExtendedAudioFormat = 3, + SPSF_8kHz8BitMono = 4, + SPSF_8kHz8BitStereo = 5, + SPSF_8kHz16BitMono = 6, + SPSF_8kHz16BitStereo = 7, + SPSF_11kHz8BitMono = 8, + SPSF_11kHz8BitStereo = 9, + SPSF_11kHz16BitMono = 10, + SPSF_11kHz16BitStereo = 11, + SPSF_12kHz8BitMono = 12, + SPSF_12kHz8BitStereo = 13, + SPSF_12kHz16BitMono = 14, + SPSF_12kHz16BitStereo = 15, + SPSF_16kHz8BitMono = 16, + SPSF_16kHz8BitStereo = 17, + SPSF_16kHz16BitMono = 18, + SPSF_16kHz16BitStereo = 19, + SPSF_22kHz8BitMono = 20, + SPSF_22kHz8BitStereo = 21, + SPSF_22kHz16BitMono = 22, + SPSF_22kHz16BitStereo = 23, + SPSF_24kHz8BitMono = 24, + SPSF_24kHz8BitStereo = 25, + SPSF_24kHz16BitMono = 26, + SPSF_24kHz16BitStereo = 27, + SPSF_32kHz8BitMono = 28, + SPSF_32kHz8BitStereo = 29, + SPSF_32kHz16BitMono = 30, + SPSF_32kHz16BitStereo = 31, + SPSF_44kHz8BitMono = 32, + SPSF_44kHz8BitStereo = 33, + SPSF_44kHz16BitMono = 34, + SPSF_44kHz16BitStereo = 35, + SPSF_48kHz8BitMono = 36, + SPSF_48kHz8BitStereo = 37, + SPSF_48kHz16BitMono = 38, + SPSF_48kHz16BitStereo = 39, + SPSF_TrueSpeech_8kHz1BitMono = 40, + SPSF_CCITT_ALaw_8kHzMono = 41, + SPSF_CCITT_ALaw_8kHzStereo = 42, + SPSF_CCITT_ALaw_11kHzMono = 43, + SPSF_CCITT_ALaw_11kHzStereo = 44, + SPSF_CCITT_ALaw_22kHzMono = 45, + SPSF_CCITT_ALaw_22kHzStereo = 46, + SPSF_CCITT_ALaw_44kHzMono = 47, + SPSF_CCITT_ALaw_44kHzStereo = 48, + SPSF_CCITT_uLaw_8kHzMono = 49, + SPSF_CCITT_uLaw_8kHzStereo = 50, + SPSF_CCITT_uLaw_11kHzMono = 51, + SPSF_CCITT_uLaw_11kHzStereo = 52, + SPSF_CCITT_uLaw_22kHzMono = 53, + SPSF_CCITT_uLaw_22kHzStereo = 54, + SPSF_CCITT_uLaw_44kHzMono = 55, + SPSF_CCITT_uLaw_44kHzStereo = 56, + SPSF_ADPCM_8kHzMono = 57, + SPSF_ADPCM_8kHzStereo = 58, + SPSF_ADPCM_11kHzMono = 59, + SPSF_ADPCM_11kHzStereo = 60, + SPSF_ADPCM_22kHzMono = 61, + SPSF_ADPCM_22kHzStereo = 62, + SPSF_ADPCM_44kHzMono = 63, + SPSF_ADPCM_44kHzStereo = 64, + SPSF_GSM610_8kHzMono = 65, + SPSF_GSM610_11kHzMono = 66, + SPSF_GSM610_22kHzMono = 67, + SPSF_GSM610_44kHzMono = 68, + SPSF_NUM_FORMATS = 69, +}} +pub const SPREG_USER_ROOT: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech"; +pub const SPREG_LOCAL_MACHINE_ROOT: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech"; +pub const SPCAT_AUDIOOUT: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput"; +pub const SPCAT_AUDIOIN: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput"; +pub const SPCAT_VOICES: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices"; +pub const SPCAT_RECOGNIZERS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Recognizers"; +pub const SPCAT_APPLEXICONS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AppLexicons"; +pub const SPCAT_PHONECONVERTERS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\PhoneConverters"; +pub const SPCAT_TEXTNORMALIZERS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\TextNormalizers"; +pub const SPCAT_RECOPROFILES: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles"; +pub const SPMMSYS_AUDIO_IN_TOKEN_ID: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput\\TokenEnums\\MMAudioIn\\"; +pub const SPMMSYS_AUDIO_OUT_TOKEN_ID: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput\\TokenEnums\\MMAudioOut\\"; +pub const SPCURRENT_USER_LEXICON_TOKEN_ID: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserLexicon"; +pub const SPCURRENT_USER_SHORTCUT_TOKEN_ID: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserShortcut"; +pub const SPTOKENVALUE_CLSID: &'static str = "CLSID"; +pub const SPTOKENKEY_FILES: &'static str = "Files"; +pub const SPTOKENKEY_UI: &'static str = "UI"; +pub const SPTOKENKEY_ATTRIBUTES: &'static str = "Attributes"; +pub const SPTOKENKEY_RETAINEDAUDIO: &'static str = "SecondsPerRetainedAudioEvent"; +pub const SPTOKENKEY_AUDIO_LATENCY_WARNING: &'static str = "LatencyWarningThreshold"; +pub const SPTOKENKEY_AUDIO_LATENCY_TRUNCATE: &'static str = "LatencyTruncateThreshold"; +pub const SPTOKENKEY_AUDIO_LATENCY_UPDATE_INTERVAL: &'static str = "LatencyUpdateInterval"; +pub const SPVOICECATEGORY_TTSRATE: &'static str = "DefaultTTSRate"; +pub const SPPROP_RESOURCE_USAGE: &'static str = "ResourceUsage"; +pub const SPPROP_HIGH_CONFIDENCE_THRESHOLD: &'static str = "HighConfidenceThreshold"; +pub const SPPROP_NORMAL_CONFIDENCE_THRESHOLD: &'static str = "NormalConfidenceThreshold"; +pub const SPPROP_LOW_CONFIDENCE_THRESHOLD: &'static str = "LowConfidenceThreshold"; +pub const SPPROP_RESPONSE_SPEED: &'static str = "ResponseSpeed"; +pub const SPPROP_COMPLEX_RESPONSE_SPEED: &'static str = "ComplexResponseSpeed"; +pub const SPPROP_ADAPTATION_ON: &'static str = "AdaptationOn"; +pub const SPPROP_PERSISTED_BACKGROUND_ADAPTATION: &'static str = "PersistedBackgroundAdaptation"; +pub const SPPROP_PERSISTED_LANGUAGE_MODEL_ADAPTATION: &'static str = "PersistedLanguageModelAdaptation"; +pub const SPPROP_UX_IS_LISTENING: &'static str = "UXIsListening"; +pub const SPTOPIC_SPELLING: &'static str = "Spelling"; +pub const SPWILDCARD: &'static str = "..."; +pub const SPDICTATION: &'static str = "*"; +pub const SPINFDICTATION: &'static str = "*+"; +pub const SPREG_SAFE_USER_TOKENS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\UserTokens"; +pub const SP_LOW_CONFIDENCE: i32 = -1; +pub const SP_NORMAL_CONFIDENCE: i32 = 0; +pub const SP_HIGH_CONFIDENCE: i32 = 1; +pub const DEFAULT_WEIGHT: i32 = 1; +pub const SP_MAX_WORD_LENGTH: i32 = 128; +pub const SP_MAX_PRON_LENGTH: i32 = 384; +pub const SP_EMULATE_RESULT: i32 = 0x40000000; +RIDL!( +interface ISpNotifyCallback(ISpNotifyCallbackVtbl) { + fn NotifyCallback(&mut self, wParam: ::WPARAM, lParam: ::LPARAM) -> ::HRESULT +} +); +pub type SPNOTIFYCALLBACK = unsafe extern "system" fn(wParam: ::WPARAM, lParam: ::LPARAM); +RIDL!( +interface ISpNotifySource(ISpNotifySourceVtbl): IUnknown(IUnknownVtbl) { + fn SetNotifySink(&mut self, pNotifySink: *mut ISpNotifySink) -> ::HRESULT, + fn SetNotifyWindowMessage( + &mut self, hWnd: ::HWND, Msg: ::UINT, wParam: ::WPARAM, lParam: ::LPARAM + ) -> ::HRESULT, + fn SetNotifyCallbackFunction( + &mut self, pfnCallback: SPNOTIFYCALLBACK, wParam: ::WPARAM, lParam: ::LPARAM + ) -> ::HRESULT, + fn SetNotifyCallbackInterface( + &mut self, pSpCallback: *mut ISpNotifyCallback, wParam: ::WPARAM, lParam: ::LPARAM + ) -> ::HRESULT, + fn SetNotifyWin32Event(&mut self) -> ::HRESULT, + fn WaitForNotifyEvent(&mut self, dwMilliseconds: ::DWORD) -> ::HRESULT, + fn GetNotifyEventHandle(&mut self) -> ::HANDLE +} +); +RIDL!( +interface ISpNotifySink(ISpNotifySinkVtbl): IUnknown(IUnknownVtbl) { + fn Notify(&mut self) -> ::HRESULT +} +); +RIDL!( +interface ISpNotifyTranslator(ISpNotifyTranslatorVtbl): ISpNotifySink(ISpNotifySinkVtbl) { + fn InitWindowMessage( + &mut self, hWnd: ::HWND, Msg: ::UINT, wParam: ::WPARAM, lParam: ::LPARAM + ) -> ::HRESULT, + fn InitCallback( + &mut self, pfnCallback: SPNOTIFYCALLBACK, wParam: ::WPARAM, lParam: ::LPARAM + ) -> ::HRESULT, + fn InitSpNotifyCallback( + &mut self, pSpCallback: *mut ISpNotifyCallback, wParam: ::WPARAM, lParam: ::LPARAM + ) -> ::HRESULT, + fn InitWin32Event(&mut self, hEvent: ::HANDLE, fCloseHandleOnRelease: ::BOOL) -> ::HRESULT, + fn Wait(&mut self, dwMilliseconds: ::DWORD) -> ::HRESULT, + fn GetEventHandle(&mut self) -> ::HANDLE +} +); +RIDL!( +interface ISpDataKey(ISpDataKeyVtbl): IUnknown(IUnknownVtbl) { + fn SetData( + &mut self, pszValueName: ::LPCWSTR, cbData: ::ULONG, pData: *const ::BYTE + ) -> ::HRESULT, + fn GetData( + &mut self, pszValueName: ::LPCWSTR, pcbData: *mut ::ULONG, pData: *mut ::BYTE + ) -> ::HRESULT, + fn SetStringValue(&mut self, pszValueName: ::LPCWSTR, pszValue: ::LPCWSTR) -> ::HRESULT, + fn GetStringValue(&mut self, pszValueName: ::LPCWSTR, ppszValue: *mut ::LPWSTR) -> ::HRESULT, + fn SetDWORD(&mut self, pszValueName: ::LPCWSTR, dwValue: ::DWORD) -> ::HRESULT, + fn GetDWORD(&mut self, pszValueName: ::LPCWSTR, pdwValue: *mut ::DWORD) -> ::HRESULT, + fn OpenKey(&mut self, pszSubKeyName: ::LPCWSTR, ppSubKey: *mut *mut ISpDataKey) -> ::HRESULT, + fn CreateKey(&mut self, pszSubKey: ::LPCWSTR, ppSubKey: *mut *mut ISpDataKey) -> ::HRESULT, + fn DeleteKey(&mut self, pszSubKey: ::LPCWSTR) -> ::HRESULT, + fn DeleteValue(&mut self, pszValueName: ::LPCWSTR) -> ::HRESULT, + fn EnumKeys(&mut self, Index: ::ULONG, ppszSubKeyName: *mut ::LPWSTR) -> ::HRESULT, + fn EnumValues(&mut self, Index: ::ULONG, ppszValueName: *mut ::LPWSTR) -> ::HRESULT +} +); +RIDL!( +interface ISpRegDataKey(ISpRegDataKeyVtbl): ISpDataKey(ISpDataKeyVtbl) { + fn SetKey(&mut self, hkey: ::HKEY, fReadOnly: ::BOOL) -> ::HRESULT +} +); +RIDL!( +interface ISpObjectTokenCategory(ISpObjectTokenCategoryVtbl): ISpDataKey(ISpDataKeyVtbl) { + fn SetId(&mut self, pszCategoryId: ::LPCWSTR, fCreateIfNotExist: ::BOOL) -> ::HRESULT, + fn GetId(&mut self, ppszCoMemCategoryId: *mut ::LPWSTR) -> ::HRESULT, + fn GetDataKey( + &mut self, spdkl: SPDATAKEYLOCATION, pppDataKey: *mut *mut ISpDataKey + ) -> ::HRESULT, + fn EnumTokens( + &mut self, pzsReqAttribs: ::LPCWSTR, pszOptAttribs: ::LPCWSTR, + ppEnum: *mut *mut IEnumSpObjectTokens + ) -> ::HRESULT, + fn SetDefaultTokenId(&mut self, pszTokenId: ::LPCWSTR) -> ::HRESULT, + fn GetDefaultTokenId(&mut self, ppszCoMemTokenId: *mut ::LPWSTR) -> ::HRESULT +} +); +RIDL!( +interface ISpObjectToken(ISpObjectTokenVtbl): ISpDataKey(ISpDataKeyVtbl) { + fn SetId( + &mut self, pszCategoryId: ::LPCWSTR, pszTokenId: ::LPCWSTR, fCreateIfNotExist: ::BOOL + ) -> ::HRESULT, + fn GetId(&mut self, ppszCoMemTokenId: *mut ::LPWSTR) -> ::HRESULT, + fn GetCategory(&mut self, ppTokenCategory: *mut *mut ISpObjectTokenCategory) -> ::HRESULT, + fn CreateInstance( + &mut self, pUnkOuter: *mut ::IUnknown, dwClsContext: ::DWORD, riid: ::REFIID, + ppvObject: *mut *mut ::c_void + ) -> ::HRESULT, + fn GetStorageFileName( + &mut self, clsidCaller: ::REFCLSID, pszValueName: ::LPCWSTR, + pszFileNameSpecifier: ::LPCWSTR, nFolder: ::ULONG, ppszFilePath: *mut ::LPWSTR + ) -> ::HRESULT, + fn RemoveStorageFileName(&mut self, pszKeyName: ::LPCWSTR, fDeleteFile: ::BOOL) -> ::HRESULT, + fn Remove(&mut self, pclsidCaller: *const ::CLSID) -> ::HRESULT, + fn IsUISupported( + &mut self, pszTypeOfUI: ::LPCWSTR, pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, + punkObject: *mut ::IUnknown, pfSupported: *mut ::BOOL + ) -> ::HRESULT, + fn DisplayUI( + &mut self, hwndParent: ::HWND, pszTitle: ::LPCWSTR, pszTypeOfUI: ::LPCWSTR, + pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, punkObject: *mut ::IUnknown + ) -> ::HRESULT, + fn MatchesAttributes(&mut self, pszAttributes: ::LPCWSTR, pfMatches: *mut ::BOOL) -> ::HRESULT +} +); +RIDL!( +interface ISpObjectTokenInit(ISpObjectTokenInitVtbl): ISpObjectToken(ISpObjectTokenVtbl) { + fn InitFromDataKey( + &mut self, pszCategoryId: ::LPCWSTR, pszTokenId: ::LPCWSTR, pDataKey: *mut ISpDataKey + ) -> ::HRESULT +} +); +RIDL!( +interface IEnumSpObjectTokens(IEnumSpObjectTokensVtbl): IUnknown(IUnknownVtbl) { + fn Next( + &mut self, celt: ::ULONG, pelt: *mut *mut ISpObjectToken, pceltFetched: *mut ::ULONG + ) -> ::HRESULT, + fn Skip(&mut self, celt: ::ULONG) -> ::HRESULT, + fn Reset(&mut self) -> ::HRESULT, + fn Clone(&mut self, ppEnum: *mut *mut IEnumSpObjectTokens) -> ::HRESULT, + fn Item(&mut self, Index: ::ULONG, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, + fn GetCount(&mut self, pCount: *mut ::ULONG) -> ::HRESULT +} +); +RIDL!( +interface ISpObjectWithToken(ISpObjectWithTokenVtbl): IUnknown(IUnknownVtbl) { + fn SetObjectToken(&mut self, pToken: *mut ISpObjectToken) -> ::HRESULT, + fn GetObjectToken(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT +} +); +RIDL!( +interface ISpResourceManager(ISpResourceManagerVtbl): IServiceProvider(IServiceProviderVtbl) { + fn SetObject(&mut self, guidServiceId: ::REFGUID, pUnkObject: *mut ::IUnknown) -> ::HRESULT, + fn GetObject( + &mut self, guidServiceId: ::REFGUID, ObjectCLSID: ::REFCLSID, ObjectIID: ::REFIID, + fReleaseWhenLastExternalRefReleased: ::BOOL, ppObject: *mut *mut ::c_void + ) -> ::HRESULT +} +); +ENUM!{enum SPEVENTLPARAMTYPE { + SPET_LPARAM_IS_UNDEFINED = 0, + SPET_LPARAM_IS_TOKEN, + SPET_LPARAM_IS_OBJECT, + SPET_LPARAM_IS_POINTER, + SPET_LPARAM_IS_STRING, +}} +ENUM!{enum SPEVENTENUM { + SPEI_UNDEFINED = 0, + SPEI_START_INPUT_STREAM = 1, + SPEI_END_INPUT_STREAM = 2, + SPEI_VOICE_CHANGE = 3, + SPEI_TTS_BOOKMARK = 4, + SPEI_WORD_BOUNDARY = 5, + SPEI_PHONEME = 6, + SPEI_SENTENCE_BOUNDARY = 7, + SPEI_VISEME = 8, + SPEI_TTS_AUDIO_LEVEL = 9, + SPEI_TTS_PRIVATE = 15, + SPEI_END_SR_STREAM = 34, + SPEI_SOUND_START = 35, + SPEI_SOUND_END = 36, + SPEI_PHRASE_START = 37, + SPEI_RECOGNITION = 38, + SPEI_HYPOTHESIS = 39, + SPEI_SR_BOOKMARK = 40, + SPEI_PROPERTY_NUM_CHANGE = 41, + SPEI_PROPERTY_STRING_CHANGE = 42, + SPEI_FALSE_RECOGNITION = 43, + SPEI_INTERFERENCE = 44, + SPEI_REQUEST_UI = 45, + SPEI_RECO_STATE_CHANGE = 46, + SPEI_ADAPTATION = 47, + SPEI_START_SR_STREAM = 48, + SPEI_RECO_OTHER_CONTEXT = 49, + SPEI_SR_AUDIO_LEVEL = 50, + SPEI_SR_RETAINEDAUDIO = 51, + SPEI_SR_PRIVATE = 52, + SPEI_ACTIVE_CATEGORY_CHANGED = 53, + SPEI_RESERVED5 = 54, + SPEI_RESERVED6 = 55, + SPEI_RESERVED1 = 30, + SPEI_RESERVED2 = 33, + SPEI_RESERVED3 = 63, +}} +pub const SPEI_MIN_TTS: SPEVENTENUM = SPEI_START_INPUT_STREAM; +pub const SPEI_MAX_TTS: SPEVENTENUM = SPEI_TTS_PRIVATE; +pub const SPEI_MIN_SR: SPEVENTENUM = SPEI_END_SR_STREAM; +pub const SPEI_MAX_SR: SPEVENTENUM = SPEI_RESERVED6; +pub const SPFEI_FLAGCHECK: u64 = (1 << SPEI_RESERVED1.0 as u64) | (1 << SPEI_RESERVED2.0 as u64); +pub const SPFEI_ALL_TTS_EVENTS: u64 = 0x000000000000FFFE | SPFEI_FLAGCHECK; +pub const SPFEI_ALL_SR_EVENTS: u64 = 0x003FFFFC00000000 | SPFEI_FLAGCHECK; +pub const SPFEI_ALL_EVENTS: u64 = 0xEFFFFFFFFFFFFFFF; +#[inline] +pub fn SPFEI(SPEI_ord: u64) -> u64 { + (1 << SPEI_ord) | SPFEI_FLAGCHECK +} +STRUCT!{struct SPEVENT { + eEventId: ::WORD, + elParamType: ::WORD, + ulStreamNum: ::ULONG, + ullAudioStreamOffset: ::ULONGLONG, + wParam: ::WPARAM, + lParam: ::LPARAM, +}} +STRUCT!{struct SPSERIALIZEDEVENT { + eEventId: ::WORD, + elParamType: ::WORD, + ulStreamNum: ::ULONG, + ullAudioStreamOffset: ::ULONGLONG, + SerializedwParam: ::ULONG, + SerializedlParam: ::LONG, +}} +STRUCT!{struct SPSERIALIZEDEVENT64 { + eEventId: ::WORD, + elParamType: ::WORD, + ulStreamNum: ::ULONG, + ullAudioStreamOffset: ::ULONGLONG, + SerializedwParam: ::ULONGLONG, + SerializedlParam: ::LONGLONG, +}} +STRUCT!{struct SPEVENTEX { + eEventId: ::WORD, + elParamType: ::WORD, + ulStreamNum: ::ULONG, + ullAudioStreamOffset: ::ULONGLONG, + wParam: ::WPARAM, + lParam: ::LPARAM, + ullAudioTimeOffset: ::ULONGLONG, +}} +ENUM!{enum SPINTERFERENCE { + SPINTERFERENCE_NONE = 0, + SPINTERFERENCE_NOISE = 1, + SPINTERFERENCE_NOSIGNAL = 2, + SPINTERFERENCE_TOOLOUD = 3, + SPINTERFERENCE_TOOQUIET = 4, + SPINTERFERENCE_TOOFAST = 5, + SPINTERFERENCE_TOOSLOW = 6, + SPINTERFERENCE_LATENCY_WARNING = 7, + SPINTERFERENCE_LATENCY_TRUNCATE_BEGIN = 8, + SPINTERFERENCE_LATENCY_TRUNCATE_END = 9, +}} +FLAGS!{enum SPENDSRSTREAMFLAGS { + SPESF_NONE = 0, + SPESF_STREAM_RELEASED = 1 << 0, + SPESF_EMULATED = 1 << 1, +}} +FLAGS!{enum SPVFEATURE { + SPVFEATURE_STRESSED = 1 << 0, + SPVFEATURE_EMPHASIS = 1 << 1, +}} +ENUM!{enum SPVISEMES { + SP_VISEME_0 = 0, + SP_VISEME_1, + SP_VISEME_2, + SP_VISEME_3, + SP_VISEME_4, + SP_VISEME_5, + SP_VISEME_6, + SP_VISEME_7, + SP_VISEME_8, + SP_VISEME_9, + SP_VISEME_10, + SP_VISEME_11, + SP_VISEME_12, + SP_VISEME_13, + SP_VISEME_14, + SP_VISEME_15, + SP_VISEME_16, + SP_VISEME_17, + SP_VISEME_18, + SP_VISEME_19, + SP_VISEME_20, + SP_VISEME_21, +}} +STRUCT!{struct SPEVENTSOURCEINFO { + ullEventInterest: ::ULONGLONG, + ullQueuedInterest: ::ULONGLONG, + ulCount: ::ULONG, +}} +RIDL!( +interface ISpEventSource(ISpEventSourceVtbl): ISpNotifySource(ISpNotifySourceVtbl) { + fn SetInterest( + &mut self, ullEventInterest: ::ULONGLONG, ullQueuedInterest: ::ULONGLONG + ) -> ::HRESULT, + fn GetEvents( + &mut self, ulCount: ::ULONG, pEventArray: *mut SPEVENT, pulFetched: *mut ::ULONG + ) -> ::HRESULT, + fn GetInfo(&mut self, pInfo: *mut SPEVENTSOURCEINFO) -> ::HRESULT +} +); +RIDL!( +interface ISpEventSource2(ISpEventSource2Vtbl): ISpEventSource(ISpEventSourceVtbl) { + fn GetEventsEx( + &mut self, ulCount: ::ULONG, pEventArray: *mut SPEVENTEX, pulFetched: *mut ::ULONG + ) -> ::HRESULT +} +); +RIDL!( +interface ISpEventSink(ISpEventSinkVtbl): IUnknown(IUnknownVtbl) { + fn AddEvents(&mut self, pEventArray: *const SPEVENT, ulCount: ::ULONG) -> ::HRESULT, + fn GetEventInterest(&mut self, pullEventInterest: *mut ::ULONGLONG) -> ::HRESULT +} +); +RIDL!( +interface ISpStreamFormat(ISpStreamFormatVtbl): IStream(IStreamVtbl) { + fn GetFormat( + &mut self, pguidFormatId: *mut ::GUID, ppCoMemWaveFormatEx: *mut *mut ::WAVEFORMATEX + ) -> ::HRESULT +} +); +ENUM!{enum SPFILEMODE { + SPFM_OPEN_READONLY = 0, + SPFM_OPEN_READWRITE = 1, + SPFM_CREATE = 2, + SPFM_CREATE_ALWAYS = 3, + SPFM_NUM_MODES = 4, +}} +RIDL!( +interface ISpStream(ISpStreamVtbl): ISpStreamFormat(ISpStreamFormatVtbl) { + fn SetBaseStream( + &mut self, pStream: *mut ::IStream, rguidFormat: ::REFGUID, + pWaveFormatEx: *const ::WAVEFORMATEX + ) -> ::HRESULT, + fn GetBaseStream(&mut self, ppStream: *mut *mut ::IStream) -> ::HRESULT, + fn BindToFile( + &mut self, pszFileName: ::LPCWSTR, eMode: SPFILEMODE, pFormatId: *const ::GUID, + pWaveFormatEx: *const ::WAVEFORMATEX, ullEventInterest: ::ULONGLONG + ) -> ::HRESULT, + fn Close(&mut self) -> ::HRESULT +} +); +RIDL!( +interface ISpStreamFormatConverter(ISpStreamFormatConverterVtbl) + : ISpStreamFormat(ISpStreamFormatVtbl) { + fn SetBaseStream( + &mut self, pStream: *mut ISpStreamFormat, fSetFormatToBaseStreamFormat: ::BOOL, + fWriteToBaseStream: ::BOOL + ) -> ::HRESULT, + fn GetBaseStream(&mut self, ppStream: *mut *mut ISpStreamFormat) -> ::HRESULT, + fn SetFormat( + &mut self, rguidFormatIdOfConvertedStream: ::REFGUID, + pWaveFormatExOfConvertedStream: *const ::WAVEFORMATEX + ) -> ::HRESULT, + fn ResetSeekPosition(&mut self) -> ::HRESULT, + fn ScaleConvertedToBaseOffset( + &mut self, ullOffsetConvertedStream: ::ULONGLONG, pullOffsetBaseStream: *mut ::ULONGLONG + ) -> ::HRESULT, + fn ScaleBaseToConvertedOffset( + &mut self, ullOffsetBaseStream: ::ULONGLONG, pullOffsetConvertedStream: *mut ::ULONGLONG + ) -> ::HRESULT +} +); +ENUM!{enum SPAUDIOSTATE { + SPAS_CLOSED = 0, + SPAS_STOP = 1, + SPAS_PAUSE = 2, + SPAS_RUN = 3, +}} +STRUCT!{struct SPAUDIOSTATUS { + cbFreeBuffSpace: ::LONG, + cbNonBlockingIO: ::ULONG, + State: SPAUDIOSTATE, + CurSeekPos: ::ULONGLONG, + CurDevicePos: ::ULONGLONG, + dwAudioLevel: ::DWORD, + dwReserved2: ::DWORD, +}} +STRUCT!{struct SPAUDIOBUFFERINFO { + ulMsMinNotification: ::ULONG, + ulMsBufferSize: ::ULONG, + ulMsEventBias: ::ULONG, +}} +RIDL!( +interface ISpAudio(ISpAudioVtbl): ISpStreamFormat(ISpStreamFormatVtbl) { + fn SetState(&mut self, NewState: SPAUDIOSTATE, ullReserved: ::ULONGLONG) -> ::HRESULT, + fn SetFormat( + &mut self, rguidFmtId: ::REFGUID, pWaveFormatEx: *const ::WAVEFORMATEX + ) -> ::HRESULT, + fn GetStatus(&mut self, pStatus: *mut SPAUDIOSTATUS) -> ::HRESULT, + fn SetBufferInfo(&mut self, pBuffInfo: *const SPAUDIOBUFFERINFO) -> ::HRESULT, + fn GetBufferInfo(&mut self, pBuffInfo: *mut SPAUDIOBUFFERINFO) -> ::HRESULT, + fn GetDefaultFormat( + &mut self, pFormatId: *mut ::GUID, ppCoMemWaveFormatEx: *mut *mut ::WAVEFORMATEX + ) -> ::HRESULT, + fn EventHandle(&mut self) -> ::HANDLE, + fn GetVolumeLevel(&mut self, pLevel: *mut ::ULONG) -> ::HRESULT, + fn SetVolumeLevel(&mut self, Level: ::ULONG) -> ::HRESULT, + fn GetBufferNotifySize(&mut self, pcbSize: *mut ::ULONG) -> ::HRESULT, + fn SetBufferNotifySize(&mut self, cbSize: ::ULONG) -> ::HRESULT +} +); +RIDL!( +interface ISpMMSysAudio(ISpMMSysAudioVtbl): ISpAudio(ISpAudioVtbl) { + fn GetDeviceId(&mut self, puDeviceId: *mut ::UINT) -> ::HRESULT, + fn SetDeviceId(&mut self, uDeviceId: ::UINT) -> ::HRESULT, + fn GetMMHandle(&mut self, pHandle: *mut *mut ::c_void) -> ::HRESULT, + fn GetLineId(&mut self, puLineId: *mut ::UINT) -> ::HRESULT, + fn SetLineId(&mut self, uLineId: ::UINT) -> ::HRESULT +} +); +RIDL!( +interface ISpTranscript(ISpTranscriptVtbl): IUnknown(IUnknownVtbl) { + fn GetTranscript(&mut self, ppszTranscript: *mut ::LPWSTR) -> ::HRESULT, + fn AppendTranscript(&mut self, pszTranscript: ::LPCWSTR) -> ::HRESULT +} +); +FLAGS!{enum SPDISPLYATTRIBUTES { + SPAF_ONE_TRAILING_SPACE = 0x2, + SPAF_TWO_TRAILING_SPACES = 0x4, + SPAF_CONSUME_LEADING_SPACES = 0x8, + SPAF_BUFFER_POSITION = 0x10, + SPAF_ALL = 0x1f, + SPAF_USER_SPECIFIED = 0x80, +}} +pub type SPPHONEID = ::WCHAR; +pub type PSPPHONEID = ::LPWSTR; +pub type PCSPPHONEID = ::LPCWSTR; +STRUCT!{struct SPPHRASEELEMENT { + ulAudioTimeOffset: ::ULONG, + ulAudioSizeTime: ::ULONG, + ulAudioStreamOffset: ::ULONG, + ulAudioSizeBytes: ::ULONG, + ulRetainedStreamOffset: ::ULONG, + ulRetainedSizeBytes: ::ULONG, + pszDisplayText: ::LPCWSTR, + pszLexicalForm: ::LPCWSTR, + pszPronunciation: *const SPPHONEID, + bDisplayAttributes: ::BYTE, + RequiredConfidence: ::c_char, + ActualConfidence: ::c_char, + Reserved: ::BYTE, + SREngineConfidence: ::c_float, +}} +STRUCT!{struct SPPHRASERULE { + pszName: ::LPCWSTR, + ulId: ::ULONG, + ulFirstElement: ::ULONG, + ulCountOfElements: ::ULONG, + pNextSibling: *const SPPHRASERULE, + pFirstChild: *const SPPHRASERULE, + SREngineConfidence: ::c_float, + Confidence: ::c_char, +}} +ENUM!{enum SPPHRASEPROPERTYUNIONTYPE { + SPPPUT_UNUSED = 0, + SPPPUT_ARRAY_INDEX, +}} +STRUCT!{struct SPPHRASEPROPERTY { + pszName: ::LPCWSTR, + bType: ::BYTE, + bReserved: ::BYTE, + usArrayIndex: u16, + pszValue: ::LPCWSTR, + vValue: ::VARIANT, + ulFirstElement: ::ULONG, + ulCountOfElements: ::ULONG, + pNextSibling: *const SPPHRASEPROPERTY, + pFirstChild: *const SPPHRASEPROPERTY, + SREngineConfidence: ::c_float, + Confidence: ::c_char, +}} +UNION!(SPPHRASEPROPERTY, bType, ulId, ulId_mut, ::ULONG); +STRUCT!{struct SPPHRASEREPLACEMENT { + bDisplayAttributes: ::BYTE, + pszReplacementText: ::LPCWSTR, + ulFirstElement: ::ULONG, + ulCountOfElements: ::ULONG, +}} +STRUCT!{struct SPSEMANTICERRORINFO { + ulLineNumber: ::ULONG, + pszScriptLine: ::LPWSTR, + pszSource: ::LPWSTR, + pszDescription: ::LPWSTR, + hrResultCode: ::HRESULT, +}} +ENUM!{enum SPSEMANTICFORMAT { + SPSMF_SAPI_PROPERTIES = 0, + SPSMF_SRGS_SEMANTICINTERPRETATION_MS = 1, + SPSMF_SRGS_SAPIPROPERTIES = 2, + SPSMF_UPS = 4, + SPSMF_SRGS_SEMANTICINTERPRETATION_W3C = 8, +}} +STRUCT!{struct SPPHRASE_50 { + cbSize: ::ULONG, + LangID: ::WORD, + wHomophoneGroupId: ::WORD, + ullGrammarID: ::ULONGLONG, + ftStartTime: ::ULONGLONG, + ullAudioStreamPosition: ::ULONGLONG, + ulAudioSizeBytes: ::ULONG, + ulRetainedSizeBytes: ::ULONG, + ulAudioSizeTime: ::ULONG, + Rule: ::SPPHRASERULE, + pProperties: *const ::SPPHRASEPROPERTY, + pElements: *const ::SPPHRASEELEMENT, + cReplacements: ::ULONG, + pReplacements: *const ::SPPHRASEREPLACEMENT, + SREngineID: ::GUID, + ulSREnginePrivateDataSize: ::ULONG, + pSREnginePrivateData: *const ::BYTE, +}} +STRUCT!{struct SPPHRASE_53 { + cbSize: ::ULONG, + LangID: ::WORD, + wHomophoneGroupId: ::WORD, + ullGrammarID: ::ULONGLONG, + ftStartTime: ::ULONGLONG, + ullAudioStreamPosition: ::ULONGLONG, + ulAudioSizeBytes: ::ULONG, + ulRetainedSizeBytes: ::ULONG, + ulAudioSizeTime: ::ULONG, + Rule: ::SPPHRASERULE, + pProperties: *const ::SPPHRASEPROPERTY, + pElements: *const ::SPPHRASEELEMENT, + cReplacements: ::ULONG, + pReplacements: *const ::SPPHRASEREPLACEMENT, + SREngineID: ::GUID, + ulSREnginePrivateDataSize: ::ULONG, + pSREnginePrivateData: *const ::BYTE, + pSML: ::LPWSTR, + pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, +}} +STRUCT!{struct SPPHRASE { + cbSize: ::ULONG, + LangID: ::WORD, + wHomophoneGroupId: ::WORD, + ullGrammarID: ::ULONGLONG, + ftStartTime: ::ULONGLONG, + ullAudioStreamPosition: ::ULONGLONG, + ulAudioSizeBytes: ::ULONG, + ulRetainedSizeBytes: ::ULONG, + ulAudioSizeTime: ::ULONG, + Rule: ::SPPHRASERULE, + pProperties: *const ::SPPHRASEPROPERTY, + pElements: *const ::SPPHRASEELEMENT, + cReplacements: ::ULONG, + pReplacements: *const ::SPPHRASEREPLACEMENT, + SREngineID: ::GUID, + ulSREnginePrivateDataSize: ::ULONG, + pSREnginePrivateData: *const ::BYTE, + pSML: ::LPWSTR, + pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, + SemanticTagFormat: SPSEMANTICFORMAT, +}} +STRUCT!{struct SPSERIALIZEDPHRASE { + ulSerializedSize: ::ULONG, +}} +STRUCT!{struct SPRULE { + pszRuleName: ::LPCWSTR, + ulRuleId: ::ULONG, + dwAttributes: ::DWORD, +}} +FLAGS!{enum SPVALUETYPE { + SPDF_PROPERTY = 0x1, + SPDF_REPLACEMENT = 0x2, + SPDF_RULE = 0x4, + SPDF_DISPLAYTEXT = 0x8, + SPDF_LEXICALFORM = 0x10, + SPDF_PRONUNCIATION = 0x20, + SPDF_AUDIO = 0x40, + SPDF_ALTERNATES = 0x80, + SPDF_ALL = 0xff, +}} +STRUCT!{struct SPBINARYGRAMMAR { + ulTotalSerializedSize: ::ULONG, +}} +ENUM!{enum SPPHRASERNG { + SPPR_ALL_ELEMENTS = -1i32 as u32, +}} +pub const SP_GETWHOLEPHRASE: SPPHRASERNG = SPPR_ALL_ELEMENTS; +pub const SPRR_ALL_ELEMENTS: SPPHRASERNG = SPPR_ALL_ELEMENTS; +DECLARE_HANDLE!(SPSTATEHANDLE, SPSTATEHANDLE__); +FLAGS!{enum SPRECOEVENTFLAGS { + SPREF_AutoPause = 1 << 0, + SPREF_Emulated = 1 << 1, + SPREF_SMLTimeout = 1 << 2, + SPREF_ExtendableParse = 1 << 3, + SPREF_ReSent = 1 << 4, + SPREF_Hypothesis = 1 << 5, + SPREF_FalseRecognition = 1 << 6, +}} +ENUM!{enum SPPARTOFSPEECH { + SPPS_NotOverriden = -1i32 as u32, + SPPS_Unknown = 0, + SPPS_Noun = 0x1000, + SPPS_Verb = 0x2000, + SPPS_Modifier = 0x3000, + SPPS_Function = 0x4000, + SPPS_Interjection = 0x5000, + SPPS_Noncontent = 0x6000, + SPPS_LMA = 0x7000, + SPPS_SuppressWord = 0xf000, +}} +FLAGS!{enum SPLEXICONTYPE { + eLEXTYPE_USER = 1 << 0, + eLEXTYPE_APP = 1 << 1, + eLEXTYPE_VENDORLEXICON = 1 << 2, + eLEXTYPE_LETTERTOSOUND = 1 << 3, + eLEXTYPE_MORPHOLOGY = 1 << 4, + eLEXTYPE_RESERVED4 = 1 << 5, + eLEXTYPE_USER_SHORTCUT = 1 << 6, + eLEXTYPE_RESERVED6 = 1 << 7, + eLEXTYPE_RESERVED7 = 1 << 8, + eLEXTYPE_RESERVED8 = 1 << 9, + eLEXTYPE_RESERVED9 = 1 << 10, + eLEXTYPE_RESERVED10 = 1 << 11, + eLEXTYPE_PRIVATE1 = 1 << 12, + eLEXTYPE_PRIVATE2 = 1 << 13, + eLEXTYPE_PRIVATE3 = 1 << 14, + eLEXTYPE_PRIVATE4 = 1 << 15, + eLEXTYPE_PRIVATE5 = 1 << 16, + eLEXTYPE_PRIVATE6 = 1 << 17, + eLEXTYPE_PRIVATE7 = 1 << 18, + eLEXTYPE_PRIVATE8 = 1 << 19, + eLEXTYPE_PRIVATE9 = 1 << 20, + eLEXTYPE_PRIVATE10 = 1 << 21, + eLEXTYPE_PRIVATE11 = 1 << 22, + eLEXTYPE_PRIVATE12 = 1 << 23, + eLEXTYPE_PRIVATE13 = 1 << 24, + eLEXTYPE_PRIVATE14 = 1 << 25, + eLEXTYPE_PRIVATE15 = 1 << 26, + eLEXTYPE_PRIVATE16 = 1 << 27, + eLEXTYPE_PRIVATE17 = 1 << 28, + eLEXTYPE_PRIVATE18 = 1 << 29, + eLEXTYPE_PRIVATE19 = 1 << 30, + eLEXTYPE_PRIVATE20 = 1 << 31, +}} +FLAGS!{enum SPWORDTYPE { + eWORDTYPE_ADDED = 1 << 0, + eWORDTYPE_DELETED = 1 << 1, +}} +FLAGS!{enum SPPRONUNCIATIONFLAGS { + ePRONFLAG_USED = 1 << 0, +}} +STRUCT!{struct SPWORDPRONUNCIATION { + pNextWordPronunciation: *mut SPWORDPRONUNCIATION, + eLexiconType: SPLEXICONTYPE, + LangID: ::WORD, + wPronunciationFlags: ::WORD, + ePartOfSpeech: SPPARTOFSPEECH, + szPronunciation: [SPPHONEID; 1], +}} +STRUCT!{struct SPWORDPRONUNCIATIONLIST { + ulSize: ::ULONG, + pvBuffer: *mut ::BYTE, + pFirstWordPronunciation: *mut SPWORDPRONUNCIATION, +}} +STRUCT!{struct SPWORD { + pNextWord: *mut SPWORD, + LangID: ::WORD, + wReserved: ::WORD, + eWordType: SPWORDTYPE, + pszWord: ::LPWSTR, + pFirstWordPronunciation: *mut SPWORDPRONUNCIATION, +}} +STRUCT!{struct SPWORDLIST { + ulSize: ::ULONG, + pvBuffer: *mut ::BYTE, + pFirstWord: *mut SPWORD, +}} +RIDL!( +interface ISpLexicon(ISpLexiconVtbl): IUnknown(IUnknownVtbl) { + fn GetPronunciations( + &mut self, pszWord: ::LPCWSTR, LangID: ::WORD, dwFlags: ::DWORD, + pWordPronunciationList: *mut SPWORDPRONUNCIATIONLIST + ) -> ::HRESULT, + fn AddPronunciation( + &mut self, pszWord: ::LPCWSTR, LangID: ::WORD, ePartOfSpeech: SPPARTOFSPEECH, + pszPronunciation: PCSPPHONEID + ) -> ::HRESULT, + fn RemovePronunciation( + &mut self, pszWord: ::LPCWSTR, LangID: ::WORD, ePartOfSpeech: SPPARTOFSPEECH, + pszPronunciation: PCSPPHONEID + ) -> ::HRESULT, + fn GetGeneration(&mut self, pdwGeneration: *mut ::DWORD) -> ::HRESULT, + fn GetGenerationChange( + &mut self, dwFlags: ::DWORD, pdwGeneration: *mut ::DWORD, pWordList: *mut SPWORDLIST + ) -> ::HRESULT, + fn GetWords( + &mut self, dwFlags: ::DWORD, pdwGeneration: *mut ::DWORD, pdwCookie: *mut ::DWORD, + pWordList: *mut SPWORDLIST + ) -> ::HRESULT +} +); +RIDL!( +interface ISpContainerLexicon(ISpContainerLexiconVtbl): ISpLexicon(ISpLexiconVtbl) { + fn AddLexicon(&mut self, pAddLexicon: *mut ISpLexicon, dwFlags: ::DWORD) -> ::HRESULT +} +); +ENUM!{enum SPSHORTCUTTYPE { + SPSHT_NotOverriden = -1i32 as u32, + SPSHT_Unknown = 0, + SPSHT_EMAIL = 0x1000, + SPSHT_OTHER = 0x2000, + SPPS_RESERVED1 = 0x3000, + SPPS_RESERVED2 = 0x4000, + SPPS_RESERVED3 = 0x5000, + SPPS_RESERVED4 = 0xf000, +}} +STRUCT!{struct SPSHORTCUTPAIR { + pNextSHORTCUTPAIR: *mut SPSHORTCUTPAIR, + LangID: ::WORD, + shType: SPSHORTCUTTYPE, + pszDisplay: ::LPWSTR, + pszSpoken: ::LPWSTR, +}} +STRUCT!{struct SPSHORTCUTPAIRLIST { + ulSize: ::ULONG, + pvBuffer: *mut ::BYTE, + pFirstShortcutPair: *mut SPSHORTCUTPAIR, +}} +RIDL!( +interface ISpShortcut(ISpShortcutVtbl): IUnknown(IUnknownVtbl) { + fn AddShortcut( + &mut self, pszDisplay: ::LPCWSTR, LangID: ::WORD, pszSpoken: ::LPCWSTR, + shType: SPSHORTCUTTYPE + ) -> ::HRESULT, + fn RemoveShortcut( + &mut self, pszDisplay: ::LPCWSTR, LangID: ::WORD, pszSpoken: ::LPCWSTR, + shType: SPSHORTCUTTYPE + ) -> ::HRESULT, + fn GetShortcuts( + &mut self, LangId: ::WORD, pShortcutpairList: *mut SPSHORTCUTPAIRLIST + ) -> ::HRESULT, + fn GetGeneration(&mut self, pdwGeneration: *mut ::DWORD) -> ::HRESULT, + fn GetWordsFromGenerationChange( + &mut self, pdwGeneration: *mut ::DWORD, pWordList: *mut SPWORDLIST + ) -> ::HRESULT, + fn GetWords( + &mut self, pdwGeneration: *mut ::DWORD, pdwCookie: *mut ::DWORD, pWordList: *mut SPWORDLIST + ) -> ::HRESULT, + fn GetShortcutsForGeneration( + &mut self, pdwGeneration: *mut ::DWORD, pdwCookie: *mut ::DWORD, + pShortcutpairList: *mut SPSHORTCUTPAIRLIST + ) -> ::HRESULT, + fn GetGenerationChange( + &mut self, pdwGeneration: *mut ::DWORD, pShortcutpairList: *mut SPSHORTCUTPAIRLIST + ) -> ::HRESULT +} +); +RIDL!( +interface ISpPhoneConverter(ISpPhoneConverterVtbl): ISpObjectWithToken(ISpObjectWithTokenVtbl) { + fn PhoneToId(&mut self, pszPhone: ::LPCWSTR, pId: *mut SPPHONEID) -> ::HRESULT, + fn IdToPhone(&mut self, pId: PCSPPHONEID, pszPhone: *mut ::WCHAR) -> ::HRESULT +} +); +RIDL!( +interface ISpPhoneticAlphabetConverter(ISpPhoneticAlphabetConverterVtbl): IUnknown(IUnknownVtbl) { + fn GetLangId(&mut self, pLangID: *mut ::WORD) -> ::HRESULT, + fn SetLangId(&mut self, LangID: *mut ::WORD) -> ::HRESULT, + fn SAPI2UPS( + &mut self, pszSAPIId: *const SPPHONEID, pszUPSId: *mut SPPHONEID, cMaxLength: ::DWORD + ) -> ::HRESULT, + fn UPS2SAPI( + &mut self, pszUPSId: *const SPPHONEID, pszSAPIId: *mut SPPHONEID, cMaxLength: ::DWORD + ) -> ::HRESULT, + fn GetMaxConvertLength( + &mut self, cSrcLength: ::DWORD, bSAPI2UPS: ::BOOL, pcMaxDestLength: *mut ::DWORD + ) -> ::HRESULT +} +); +RIDL!( +interface ISpPhoneticAlphabetSelection(ISpPhoneticAlphabetSelectionVtbl): IUnknown(IUnknownVtbl) { + fn IsAlphabetUPS(&mut self, pfIsUPS: *mut ::BOOL) -> ::HRESULT, + fn SetAlphabetToUPS(&mut self, fForceUPS: ::BOOL) -> ::HRESULT +} +); +STRUCT!{struct SPVPITCH { + MiddleAdj: ::c_long, + RangeAdj: ::c_long, +}} +ENUM!{enum SPVACTIONS { + SPVA_Speak = 0, + SPVA_Silence, + SPVA_Pronounce, + SPVA_Bookmark, + SPVA_SpellOut, + SPVA_Section, + SPVA_ParseUnknownTag, +}} +STRUCT!{struct SPVCONTEXT { + pCategory: ::LPCWSTR, + pBefore: ::LPCWSTR, + pAfter: ::LPCWSTR, +}} +STRUCT!{struct SPVSTATE { + eAction: SPVACTIONS, + LangID: ::WORD, + wReserved: ::WORD, + EmphAdj: ::c_long, + RateAdj: ::c_long, + Volume: ::ULONG, + PitchAdj: SPVPITCH, + SilenceMSecs: ::ULONG, + pPhoneIds: *mut SPPHONEID, + ePartOfSpeech: SPPARTOFSPEECH, + Context: SPVCONTEXT, +}} +ENUM!{enum SPRUNSTATE { + SPRS_DONE = 1 << 0, + SPRS_IS_SPEAKING = 1 << 1, +}} +ENUM!{enum SPVLIMITS { + SPMIN_VOLUME = 0, + SPMAX_VOLUME = 100, + SPMIN_RATE = -10i32 as u32, + SPMAX_RATE = 10, +}} +ENUM!{enum SPVPRIORITY { + SPVPRI_NORMAL = 0, + SPVPRI_ALERT = 1 << 0, + SPVPRI_OVER = 1 << 1, +}} +STRUCT!{struct SPVOICESTATUS { + ulCurrentStream: ::ULONG, + ulLastStreamQueued: ::ULONG, + hrLastResult: ::HRESULT, + dwRunningState: ::DWORD, + ulInputWordPos: ::ULONG, + ulInputWordLen: ::ULONG, + ulInputSentPos: ::ULONG, + ulInputSentLen: ::ULONG, + lBookmarkId: ::LONG, + PhonemeId: SPPHONEID, + VisemeId: SPVISEMES, + dwReserved1: ::DWORD, + dwReserved2: ::DWORD, +}} +FLAGS!{enum SPEAKFLAGS { + SPF_DEFAULT = 0, + SPF_ASYNC = 1 << 0, + SPF_PURGEBEFORESPEAK = 1 << 1, + SPF_IS_FILENAME = 1 << 2, + SPF_IS_XML = 1 << 3, + SPF_IS_NOT_XML = 1 << 4, + SPF_PERSIST_XML = 1 << 5, + SPF_NLP_SPEAK_PUNC = 1 << 6, + SPF_PARSE_SAPI = 1 << 7, + SPF_PARSE_SSML = 1 << 8, +}} +pub const SPF_PARSE_AUTODETECT: SPEAKFLAGS = SPF_DEFAULT; +pub const SPF_NLP_MASK: SPEAKFLAGS = SPF_NLP_SPEAK_PUNC; +pub const SPF_PARSE_MASK: i32 = SPF_PARSE_SAPI.0 as i32 | SPF_PARSE_SSML.0 as i32; +pub const SPF_VOICE_MASK: i32 = + SPF_ASYNC.0 as i32 | SPF_PURGEBEFORESPEAK.0 as i32 | SPF_IS_FILENAME.0 as i32 | SPF_IS_XML.0 as i32 | + SPF_IS_NOT_XML.0 as i32 | SPF_NLP_MASK.0 as i32 | SPF_PERSIST_XML.0 as i32 | SPF_PARSE_MASK; +pub const SPF_UNUSED_FLAGS: i32 = !SPF_VOICE_MASK; +RIDL!( +interface ISpVoice(ISpVoiceVtbl): ISpEventSource(ISpEventSourceVtbl) { + fn SetOutput(&mut self, pUnkOutput: *mut ::IUnknown, fAllowFormatChanges: ::BOOL) -> ::HRESULT, + fn GetOutputObjectToken(&mut self, ppObjectToken: *mut *mut ISpObjectToken) -> ::HRESULT, + fn GetOutputStream(&mut self, ppStream: *mut *mut ISpStreamFormat) -> ::HRESULT, + fn Pause(&mut self) -> ::HRESULT, + fn Resume(&mut self) -> ::HRESULT, + fn SetVoice(&mut self, pToken: *mut ISpObjectToken) -> ::HRESULT, + fn GetVoice(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, + fn Speak( + &mut self, pwcs: ::LPCWSTR, dwFlags: ::DWORD, pulStreamNumber: *mut ::ULONG + ) -> ::HRESULT, + fn SpeakStream( + &mut self, pStream: *mut ::IStream, dwFlags: ::DWORD, pulStreamNumber: *mut ::ULONG + ) -> ::HRESULT, + fn GetStatus( + &mut self, pStatus: *mut SPVOICESTATUS, ppszLastBookmark: *mut ::LPWSTR + ) -> ::HRESULT, + fn Skip( + &mut self, pItemType: ::LPCWSTR, lNumItems: ::c_long, pulNumSkipped: *mut ::ULONG + ) -> ::HRESULT, + fn SetPriority(&mut self, ePriority: SPVPRIORITY) -> ::HRESULT, + fn GetPriority(&mut self, pePriority: *mut SPVPRIORITY) -> ::HRESULT, + fn SetAlertBoundary(&mut self, eBoundary: SPEVENTENUM) -> ::HRESULT, + fn GetAlertBoundary(&mut self, peBoundary: *mut SPEVENTENUM) -> ::HRESULT, + fn SetRate(&mut self, RateAdjust: ::c_long) -> ::HRESULT, + fn GetRate(&mut self, pRateAdjust: *mut ::c_long) -> ::HRESULT, + fn SetVolume(&mut self, usVolume: ::USHORT) -> ::HRESULT, + fn GetVolume(&mut self, pusVolume: *mut ::USHORT) -> ::HRESULT, + fn WaitUntilDone(&mut self, msTimeout: ::ULONG) -> ::HRESULT, + fn SetSyncSpeakTimeout(&mut self, msTimeout: ::ULONG) -> ::HRESULT, + fn GetSyncSpeakTimeout(&mut self, pmsTimeout: *mut ::ULONG) -> ::HRESULT, + fn SpeakCompleteEvent(&mut self) -> ::HANDLE, + fn IsUISupported( + &mut self, pszTypeOfUI: ::LPCWSTR, pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, + pfSupported: *mut ::BOOL + ) -> ::HRESULT, + fn DisplayUI( + &mut self, hwndParent: ::HWND, pszTitle: ::LPCWSTR, pszTypeOfUI: ::LPCWSTR, + pvExtraData: *mut ::c_void, cbExtraData: ::ULONG + ) -> ::HRESULT +} +); +DEFINE_GUID!( + UuidOfISpVoice, + 0x6C44DF74, 0x72B9, 0x4992, 0xA1, 0xEC, 0xEF, 0x99, 0x6E, 0x04, 0x22, 0xD4 +); +RIDL!( +interface ISpPhrase(ISpPhraseVtbl): IUnknown(IUnknownVtbl) { + fn GetPhrase(&mut self, ppCoMemPhrase: *mut *mut SPPHRASE) -> ::HRESULT, + fn GetSerializedPhrase(&mut self, ppCoMemPhrase: *mut *mut SPSERIALIZEDPHRASE) -> ::HRESULT, + fn GetText( + &mut self, ulStart: ::ULONG, ulCount: ::ULONG, fUseTextReplacements: ::BOOL, + ppszCoMemText: *mut ::LPWSTR, pbDisplayAttributes: *mut ::BYTE + ) -> ::HRESULT, + fn Discard(&mut self, dwValueTypes: ::DWORD) -> ::HRESULT +} +); +RIDL!( +interface ISpPhraseAlt(ISpPhraseAltVtbl): ISpPhrase(ISpPhraseVtbl) { + fn GetAltInfo( + &mut self, pParent: *mut *mut ISpPhrase, pulStartElementInParent: *mut ::ULONG, + pcElementsInParent: *mut ::ULONG, pcElementsInAlt: *mut ::ULONG + ) -> ::HRESULT, + fn Commit(&mut self) -> ::HRESULT +} +); +ENUM!{enum SPXMLRESULTOPTIONS { + SPXRO_SML = 0, + SPXRO_Alternates_SML = 1, +}} +RIDL!( +interface ISpPhrase2(ISpPhrase2Vtbl): ISpPhrase(ISpPhraseVtbl) { + fn GetXMLResult( + &mut self, ppszCoMemXMLResult: *mut ::LPWSTR, Options: SPXMLRESULTOPTIONS + ) -> ::HRESULT, + fn GetXMLErrorInfo(&mut self, pSemanticErrorInfo: *mut SPSEMANTICERRORINFO) -> ::HRESULT, + fn GetAudio( + &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, ppStream: *mut *mut ISpStreamFormat + ) -> ::HRESULT +} +); +STRUCT!{struct SPRECORESULTTIMES { + ftStreamTime: ::FILETIME, + ullLength: ::ULONGLONG, + dwTickCount: ::DWORD, + ullStart: ::ULONGLONG, +}} +STRUCT!{struct SPSERIALIZEDRESULT { + ulSerializedSize: ::ULONG, +}} +RIDL!( +interface ISpRecoResult(ISpRecoResultVtbl): ISpPhrase(ISpPhraseVtbl) { + fn GetResultTimes(&mut self, pTimes: *mut SPRECORESULTTIMES) -> ::HRESULT, + fn GetAlternates( + &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, ulRequestCount: ::ULONG, + ppPhrases: *mut *mut ISpPhraseAlt, pcPhrasesReturned: *mut ::ULONG + ) -> ::HRESULT, + fn GetAudio( + &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, ppStream: *mut *mut ISpStreamFormat + ) -> ::HRESULT, + fn SpeakAudio( + &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, dwFlags: ::DWORD, + pulStreamNumber: *mut ::ULONG + ) -> ::HRESULT, + fn Serialize(&mut self, ppCoMemSerializedResult: *mut *mut SPSERIALIZEDRESULT) -> ::HRESULT, + fn ScaleAudio( + &mut self, pAudioFormatId: *const ::GUID, pWaveFormatEx: *const ::WAVEFORMATEX + ) -> ::HRESULT, + fn GetRecoContext(&mut self, ppRecoContext: *mut *mut ISpRecoContext) -> ::HRESULT +} +); +FLAGS!{enum SPCOMMITFLAGS { + SPCF_NONE = 0, + SPCF_ADD_TO_USER_LEXICON = 1 << 0, + SPCF_DEFINITE_CORRECTION = 1 << 1, +}} +RIDL!( +interface ISpRecoResult2(ISpRecoResult2Vtbl): ISpRecoResult(ISpRecoResultVtbl) { + fn CommitAlternate( + &mut self, pPhraseAlt: *mut ISpPhraseAlt, ppNewResult: *mut *mut ISpRecoResult + ) -> ::HRESULT, + fn CommitText( + &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, pszCorrectedData: ::LPCWSTR, + eCommitFlags: ::DWORD + ) -> ::HRESULT, + fn SetTextFeedback(&mut self, pszFeedback: ::LPCWSTR, fSuccessful: ::BOOL) -> ::HRESULT +} +); +RIDL!( +interface ISpXMLRecoResult(ISpXMLRecoResultVtbl): ISpRecoResult(ISpRecoResultVtbl) { + fn GetXMLResult( + &mut self, ppszCoMemXMLResult: *mut ::LPWSTR, Options: SPXMLRESULTOPTIONS + ) -> ::HRESULT, + fn GetXMLErrorInfo(&mut self, pSemanticErrorInfo: *mut SPSEMANTICERRORINFO) -> ::HRESULT +} +); +STRUCT!{struct SPTEXTSELECTIONINFO { + ulStartActiveOffset: ::ULONG, + cchActiveChars: ::ULONG, + ulStartSelection: ::ULONG, + cchSelection: ::ULONG, +}} +ENUM!{enum SPWORDPRONOUNCEABLE { + SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1, + SPWP_KNOWN_WORD_PRONOUNCEABLE = 2, +}} +ENUM!{enum SPGRAMMARSTATE { + SPGS_DISABLED = 0, + SPGS_ENABLED = 1, + SPGS_EXCLUSIVE = 3, +}} +ENUM!{enum SPCONTEXTSTATE { + SPCS_DISABLED = 0, + SPCS_ENABLED = 1, +}} +ENUM!{enum SPRULESTATE { + SPRS_INACTIVE = 0, + SPRS_ACTIVE = 1, + SPRS_ACTIVE_WITH_AUTO_PAUSE = 3, + SPRS_ACTIVE_USER_DELIMITED = 4, +}} +pub const SP_STREAMPOS_ASAP: ::INT = 0; +pub const SP_STREAMPOS_REALTIME: ::INT = -1; +pub const SPRULETRANS_TEXTBUFFER: SPSTATEHANDLE = -1isize as SPSTATEHANDLE; +pub const SPRULETRANS_WILDCARD: SPSTATEHANDLE = -2isize as SPSTATEHANDLE; +pub const SPRULETRANS_DICTATION: SPSTATEHANDLE = -3isize as SPSTATEHANDLE; +ENUM!{enum SPGRAMMARWORDTYPE { + SPWT_DISPLAY = 0, + SPWT_LEXICAL = 1, + SPWT_PRONUNCIATION = 2, + SPWT_LEXICAL_NO_SPECIAL_CHARS = 3, +}} +STRUCT!{struct SPPROPERTYINFO { + pszName: ::LPCWSTR, + ulId: ::ULONG, + pszValue: ::LPCWSTR, + vValue: ::VARIANT, +}} +FLAGS!{enum SPCFGRULEATTRIBUTES { + SPRAF_TopLevel = 1 << 0, + SPRAF_Active = 1 << 1, + SPRAF_Export = 1 << 2, + SPRAF_Import = 1 << 3, + SPRAF_Interpreter = 1 << 4, + SPRAF_Dynamic = 1 << 5, + SPRAF_Root = 1 << 6, + SPRAF_AutoPause = 1 << 16, + SPRAF_UserDelimited = 1 << 17, +}} +RIDL!( +interface ISpGrammarBuilder(ISpGrammarBuilderVtbl): IUnknown(IUnknownVtbl) { + fn ResetGrammar(&mut self, NewLanguage: ::WORD) -> ::HRESULT, + fn GetRule( + &mut self, pszRuleName: ::LPCWSTR, dwRuleId: ::DWORD, dwAttributes: ::DWORD, + fCreateIfNotExist: ::BOOL, phInitialState: *mut SPSTATEHANDLE + ) -> ::HRESULT, + fn ClearRule(&mut self, hState: SPSTATEHANDLE) -> ::HRESULT, + fn CreateNewState(&mut self, hState: SPSTATEHANDLE, phState: *mut SPSTATEHANDLE) -> ::HRESULT, + fn AddWordTransition( + &mut self, hFromState: SPSTATEHANDLE, hToState: SPSTATEHANDLE, psz: ::LPCWSTR, + pszSeparators: ::LPCWSTR, eWordType: SPGRAMMARWORDTYPE, Weight: ::c_float, + pPropInfo: *const SPPROPERTYINFO + ) -> ::HRESULT, + fn AddRuleTransition( + &mut self, hFromState: SPSTATEHANDLE, hToState: SPSTATEHANDLE, hRule: SPSTATEHANDLE, + Weight: ::c_float, pPropInfo: *const SPPROPERTYINFO + ) -> ::HRESULT, + fn AddResource( + &mut self, hRuleState: SPSTATEHANDLE, pszResourceName: ::LPCWSTR, + pszResourceValue: ::LPCWSTR + ) -> ::HRESULT, + fn Commit(&mut self, dwReserved: ::DWORD) -> ::HRESULT +} +); +ENUM!{enum SPLOADOPTIONS { + SPLO_STATIC = 0, + SPLO_DYNAMIC = 1, +}} +RIDL!( +interface ISpRecoGrammar(ISpRecoGrammarVtbl): ISpGrammarBuilder(ISpGrammarBuilderVtbl) { + fn GetGrammarId(&mut self, pullGrammarId: *mut ::ULONGLONG) -> ::HRESULT, + fn GetRecoContext(&mut self, ppRecoCtxt: *mut *mut ISpRecoContext) -> ::HRESULT, + fn LoadCmdFromFile(&mut self, pszFileName: ::LPCWSTR, Options: SPLOADOPTIONS) -> ::HRESULT, + fn LoadCmdFromObject( + &mut self, rcid: ::REFCLSID, pszGrammarName: ::LPCWSTR, Options: SPLOADOPTIONS + ) -> ::HRESULT, + fn LoadCmdFromResource( + &mut self, hModule: ::HMODULE, pszResourceName: ::LPCWSTR, pszResourceType: ::LPCWSTR, + wLanguage: ::WORD, Options: SPLOADOPTIONS + ) -> ::HRESULT, + fn LoadCmdFromMemory( + &mut self, pGrammar: *const SPBINARYGRAMMAR, Options: SPLOADOPTIONS + ) -> ::HRESULT, + fn LoadCmdFromProprietaryGrammar( + &mut self, rguidParam: ::REFGUID, pszStringParam: ::LPCWSTR, pvDataPrarm: *const ::c_void, + cbDataSize: ::ULONG, Options: SPLOADOPTIONS + ) -> ::HRESULT, + fn SetRuleState( + &mut self, pszName: ::LPCWSTR, pReserved: *mut ::c_void, NewState: SPRULESTATE + ) -> ::HRESULT, + fn SetRuleIdState(&mut self, ulRuleId: ::ULONG, NewState: SPRULESTATE) -> ::HRESULT, + fn LoadDictation(&mut self, pszTopicName: ::LPCWSTR, Options: SPLOADOPTIONS) -> ::HRESULT, + fn UnloadDictation(&mut self) -> ::HRESULT, + fn SetDictationState(&mut self, NewState: SPRULESTATE) -> ::HRESULT, + fn SetWordSequenceData( + &mut self, pText: *const ::WCHAR, cchText: ::ULONG, pInfo: *const SPTEXTSELECTIONINFO + ) -> ::HRESULT, + fn SetTextSelection(&mut self, pInfo: *const SPTEXTSELECTIONINFO) -> ::HRESULT, + fn IsPronounceable( + &mut self, pszWord: ::LPCWSTR, pWordPronounceable: *mut SPWORDPRONOUNCEABLE + ) -> ::HRESULT, + fn SetGrammarState(&mut self, eGrammarState: SPGRAMMARSTATE) -> ::HRESULT, + fn SaveCmd(&mut self, pStream: *mut ::IStream, ppszCoMemErrorText: *mut ::LPWSTR) -> ::HRESULT, + fn GetGrammarState(&mut self, peGrammarState: *mut SPGRAMMARSTATE) -> ::HRESULT +} +); +ENUM!{enum SPMATCHINGMODE { + AllWords = 0, + Subsequence = 1, + OrderedSubset = 3, + SubsequenceContentRequired = 5, + OrderedSubsetContentRequired = 7, +}} +ENUM!{enum PHONETICALPHABET { + PA_Ipa = 0, + PA_Ups = 1, + PA_Sapi = 2, +}} +RIDL!( +interface ISpGrammarBuilder2(ISpGrammarBuilder2Vtbl): IUnknown(IUnknownVtbl) { + fn AddTextSubset( + &mut self, hFromState: SPSTATEHANDLE, hToState: SPSTATEHANDLE, psz: ::LPCWSTR, + eMatchMode: SPMATCHINGMODE + ) -> ::HRESULT, + fn SetPhoneticAlphabet(&mut self, phoneticALphabet: PHONETICALPHABET) -> ::HRESULT +} +); +RIDL!( +interface ISpRecoGrammar2(ISpRecoGrammar2Vtbl): IUnknown(IUnknownVtbl) { + fn GetRules(&mut self, ppCoMemRules: *mut *mut SPRULE, puNumRules: *mut ::UINT) -> ::HRESULT, + fn LoadCmdFromFile2( + &mut self, pszFileName: ::LPCWSTR, Options: SPLOADOPTIONS, pszSharingUri: ::LPCWSTR, + pszBaseUri: ::LPCWSTR + ) -> ::HRESULT, + fn LoadCmdFromMemory2( + &mut self, pGrammar: *const SPBINARYGRAMMAR, Options: SPLOADOPTIONS, + pszSharingUri: ::LPCWSTR, pszBaseUri: ::LPCWSTR + ) -> ::HRESULT, + fn SetRulePriority( + &mut self, pszRuleName: ::LPCWSTR, ulRuleId: ::ULONG, nRulePriority: ::c_int + ) -> ::HRESULT, + fn SetRuleWeight( + &mut self, pszRuleName: ::LPCWSTR, ulRuleId: ::ULONG, flWeight: ::c_float + ) -> ::HRESULT, + fn SetDictationWeight(&mut self, flWeight: ::c_float) -> ::HRESULT, + fn SetGrammarLoader(&mut self, pLoader: *mut ISpeechResourceLoader) -> ::HRESULT, + fn SetSMLSecurityManager( + &mut self, pSMLSecurityManager: *mut ::IInternetSecurityManager + ) -> ::HRESULT +} +); +RIDL!( +interface ISpeechResourceLoader(ISpeechResourceLoaderVtbl): IDispatch(IDispatchVtbl) { + fn LoadResource( + &mut self, bstrResourceUri: ::BSTR, fAlwaysReload: ::VARIANT_BOOL, + pStream: *mut *mut ::IUnknown, pbstrMIMEType: *mut ::BSTR, pfModified: *mut ::VARIANT_BOOL, + pbstrRedirectUrl: *mut ::BSTR + ) -> ::HRESULT, + fn GetLocalCopy( + &mut self, bstrResourceUri: ::BSTR, pbstrLocalPath: *mut ::BSTR, + pbstrMIMEType: *mut ::BSTR, pbstrRedirectUrl: *mut ::BSTR + ) -> ::HRESULT, + fn ReleaseLocalCopy(&mut self, pbstrLocalPath: ::BSTR) -> ::HRESULT +} +); +STRUCT!{nodebug struct SPRECOCONTEXTSTATUS { + eInterference: SPINTERFERENCE, + szRequestTypeOfUI: [::WCHAR; 255], + dwReserved1: ::DWORD, + dwReserved2: ::DWORD, +}} +FLAGS!{enum SPBOOKMARKOPTIONS { + SPBO_NONE = 0, + SPBO_PAUSE = 1 << 0, + SPBO_AHEAD = 1 << 1, + SPBO_TIME_UNITS = 1 << 2, +}} +FLAGS!{enum SPAUDIOOPTIONS { + SPAO_NONE = 0, + SPAO_RETAIN_AUDIO = 1 << 0, +}} +RIDL!( +interface ISpRecoContext(ISpRecoContextVtbl): ISpEventSource(ISpEventSourceVtbl) { + fn GetRecognizer(&mut self, ppRecognizer: *mut *mut ISpRecognizer) -> ::HRESULT, + fn CreateGrammer( + &mut self, ullGrammarId: ::ULONGLONG, ppGrammar: *mut *mut ISpRecoGrammar + ) -> ::HRESULT, + fn GetStatus(&mut self, pState: *mut SPRECOCONTEXTSTATUS) -> ::HRESULT, + fn GetMaxAlternates(&mut self, pcAlternates: *mut ::ULONG) -> ::HRESULT, + fn SetMaxAlternates(&mut self, cAlternates: ::ULONG) -> ::HRESULT, + fn SetAudioOptions( + &mut self, Options: SPAUDIOOPTIONS, pAudioFormatId: *const ::GUID, + pWaveFormatEx: *const ::WAVEFORMATEX + ) -> ::HRESULT, + fn GetAudioOptions( + &mut self, pOptions: *mut SPAUDIOOPTIONS, pAudioFormatId: *mut ::GUID, + ppCoMemWFEX: *mut *mut ::WAVEFORMATEX + ) -> ::HRESULT, + fn DeserializeResult( + &mut self, pSerializedResult: *const SPSERIALIZEDRESULT, ppResult: *mut *mut ISpRecoResult + ) -> ::HRESULT, + fn Bookmark( + &mut self, Options: SPBOOKMARKOPTIONS, ullStreamPosition: ::ULONGLONG, + lparamEvent: ::LPARAM + ) -> ::HRESULT, + fn SetAdaptionData(&mut self, pAdaptionData: ::LPCWSTR, cch: ::ULONG) -> ::HRESULT, + fn Pause(&mut self, dwReserved: ::DWORD) -> ::HRESULT, + fn Resume(&mut self, dwReserved: ::DWORD) -> ::HRESULT, + fn SetVoice(&mut self, pVoice: *mut ISpVoice, fAllowFormatChanges: ::BOOL) -> ::HRESULT, + fn GetVoice(&mut self, ppVoice: *mut *mut ISpVoice) -> ::HRESULT, + fn SetVoicePurgeEvent(&mut self, ullEventIntereset: ::ULONGLONG) -> ::HRESULT, + fn GetVoicePurgeEvent(&mut self, pullEventIntereset: *mut ::ULONGLONG) -> ::HRESULT, + fn SetContextState(&mut self, eContextState: SPCONTEXTSTATE) -> ::HRESULT, + fn GetContextState(&mut self, peContextState: *mut SPCONTEXTSTATE) -> ::HRESULT +} +); +FLAGS!{enum SPGRAMMAROPTIONS { + SPGO_SAPI = 0x1, + SPGO_SRGS = 0x2, + SPGO_UPS = 0x4, + SPGO_SRGS_MS_SCRIPT = 0x8, + SPGO_SRGS_W3C_SCRIPT = 0x100, + SPGO_SRGS_STG_SCRIPT = 0x200, + SPGO_SRGS_SCRIPT = + SPGO_SRGS.0 | SPGO_SRGS_MS_SCRIPT.0 | SPGO_SRGS_W3C_SCRIPT.0 | + SPGO_SRGS_STG_SCRIPT.0, + SPGO_FILE = 0x10, + SPGO_HTTP = 0x20, + SPGO_RES = 0x40, + SPGO_OBJECT = 0x80, + SPGO_DEFAULT = 0x3fb, + SPGO_ALL = 0x3ff, +}} +FLAGS!{enum SPADAPTATIONSETTINGS { + SPADS_Default = 0, + SPADS_CurrentRecognizer = 0x1, + SPADS_RecoProfile = 0x2, + SPADS_Immediate = 0x4, + SPADS_Reset = 0x8, + SPADS_HighVolumeDataSource = 0x10, +}} +ENUM!{enum SPADAPTATIONRELEVANCE { + SPAR_Unknown = 0, + SPAR_Low = 1, + SPAR_Medium = 2, + SPAR_High = 3, +}} +RIDL!( +interface ISpRecoContext2(ISpRecoContext2Vtbl): IUnknown(IUnknownVtbl) { + fn SetGrammarOptions(&mut self, eGrammarOptions: ::DWORD) -> ::HRESULT, + fn GetGrammarOptions(&mut self, peGrammarOptions: *mut ::DWORD) -> ::HRESULT, + fn SetAdaptationData2( + &mut self, pAdaptationData: ::LPCWSTR, cch: ::ULONG, pTopicName: ::LPCWSTR, + eAdaptationSettings: ::DWORD, eRelevance: SPADAPTATIONRELEVANCE + ) -> ::HRESULT +} +); +RIDL!( +interface ISpProperties(ISpPropertiesVtbl): IUnknown(IUnknownVtbl) { + fn SetPropertyNum(&mut self, pName: ::LPCWSTR, lValue: ::LONG) -> ::HRESULT, + fn GetPropertyNum(&mut self, pName: ::LPCWSTR, plValue: *mut ::LONG) -> ::HRESULT, + fn SetPropertyString(&mut self, pName: ::LPCWSTR, pValue: ::LPCWSTR) -> ::HRESULT, + fn GetPropertyString(&mut self, pName: ::LPCWSTR, ppCoMemValue: *mut ::LPWSTR) -> ::HRESULT +} +); +STRUCT!{struct SPRECOGNIZERSTATUS { + AudioStatus: SPAUDIOSTATUS, + ullRecognitionStreamPos: ::ULONGLONG, + ulStreamNumber: ::ULONG, + ulNumActive: ::ULONG, + clsidEngine: ::CLSID, + cLangIDs: ::ULONG, + aLangID: [::WORD; 20], + ullRecognitionStreamTime: ::ULONGLONG, +}} +ENUM!{enum SPWAVEFORMATTYPE { + SPWF_INPUT = 0, + SPWF_SRENGINE = 1, +}} +pub type SPSTREAMFORMATTYPE = SPWAVEFORMATTYPE; +ENUM!{enum SPRECOSTATE { + SPRST_INACTIVE = 0, + SPRST_ACTIVE = 1, + SPRST_ACTIVE_ALWAYS = 2, + SPRST_INACTIVE_WITH_PURGE = 3, + SPRST_NUM_STATES = 4, +}} +RIDL!( +interface ISpRecognizer(ISpRecognizerVtbl): ISpProperties(ISpPropertiesVtbl) { + fn SetRecognizer(&mut self, pRecognizer: *mut ISpObjectToken) -> ::HRESULT, + fn GetRecognizer(&mut self, ppRecognizer: *mut *mut ISpObjectToken) -> ::HRESULT, + fn SetInput(&mut self, pUnkInput: *mut ::IUnknown, fAllowFormatChanges: ::BOOL) -> ::HRESULT, + fn GetInputObjectToken(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, + fn GetInputStream(&mut self, ppStream: *mut *mut ISpStreamFormat) -> ::HRESULT, + fn CreateRecoContext(&mut self, ppNewCtxt: *mut *mut ISpRecoContext) -> ::HRESULT, + fn GetRecoProfile(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, + fn SetRecoProfile(&mut self, pToken: *mut ISpObjectToken) -> ::HRESULT, + fn IsSharedInstance(&mut self) -> ::HRESULT, + fn GetRecoState(&mut self, pState: *mut SPRECOSTATE) -> ::HRESULT, + fn SetRecoState(&mut self, NewState: SPRECOSTATE) -> ::HRESULT, + fn GetStatus(&mut self, pStatus: *mut SPRECOGNIZERSTATUS) -> ::HRESULT, + fn GetFormat( + &mut self, WaveFormatType: SPSTREAMFORMATTYPE, pFormatId: *mut ::GUID, + ppCoMemWFEX: *mut ::WAVEFORMATEX + ) -> ::HRESULT, + fn IsUISupported( + &mut self, pszTypeOfUI: ::LPCWSTR, pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, + pfSupported: *mut ::BOOL + ) -> ::HRESULT, + fn DisplayUI( + &mut self, hwndParent: ::HWND, pszTitle: ::LPCWSTR, pszTypeOfUI: ::LPCWSTR, + pvExtraData: *mut ::c_void, cbExtraData: ::ULONG + ) -> ::HRESULT, + fn EmulateRecognition(&mut self, pPhrase: *mut ISpPhrase) -> ::HRESULT +} +); +RIDL!( +interface ISpSerializeState(ISpSerializeStateVtbl): IUnknown(IUnknownVtbl) { + fn GetSerializedState( + &mut self, ppbData: *mut *mut ::BYTE, pulSize: *mut ::ULONG, dwReserved: ::DWORD + ) -> ::HRESULT, + fn SetSerializedState( + &mut self, pbData: *mut ::BYTE, ulSize: ::ULONG, dwReserved: ::DWORD + ) -> ::HRESULT +} +); +RIDL!( +interface ISpRecognizer2(ISpRecognizer2Vtbl): IUnknown(IUnknownVtbl) { + fn EmulateRecognitionEx( + &mut self, pPhrase: *mut ISpPhrase, dwCompareFlags: ::DWORD + ) -> ::HRESULT, + fn SetTrainingState( + &mut self, fDoingTraining: ::BOOL, fAdaptFromTrainingData: ::BOOL + ) -> ::HRESULT, + fn ResetAcousticModelAdaptation(&mut self) -> ::HRESULT +} +); +ENUM!{enum SPCATEGORYTYPE { + SPCT_COMMAND = 0, + SPCT_DICTATION, + SPCT_SLEEP, + SPCT_SUB_COMMAND, + SPCT_SUB_DICTATION, +}} +RIDL!( +interface ISpRecoCategory(ISpRecoCategoryVtbl): IUnknown(IUnknownVtbl) { + fn GetType(&mut self, peCategoryType: *mut SPCATEGORYTYPE) -> ::HRESULT +} +); +RIDL!( +interface ISpRecognizer3(ISpRecognizer3Vtbl): IUnknown(IUnknownVtbl) { + fn GetCategory( + &mut self, categoryType: SPCATEGORYTYPE, ppCategory: *mut *mut ISpRecoCategory + ) -> ::HRESULT, + fn SetActiveCategory(&mut self, pCategory: *mut ISpRecoCategory) -> ::HRESULT, + fn GetActiveCategory(&mut self, ppCategory: *mut *mut ISpRecoCategory) -> ::HRESULT +} +); +STRUCT!{struct SPNORMALIZATIONLIST { + ulSize: ::ULONG, + ppszzNormalizedList: *mut *mut ::WCHAR, +}} +RIDL!( +interface ISpEnginePronunciation(ISpEnginePronunciationVtbl): IUnknown(IUnknownVtbl) { + fn Normalize( + &mut self, pszWord: ::LPCWSTR, pszLeftContext: ::LPCWSTR, pszRightContext: ::LPCWSTR, + LangID: ::WORD, pNormalizationList: *mut SPNORMALIZATIONLIST + ) -> ::HRESULT, + fn GetPronunciations( + &mut self, pszWord: ::LPCWSTR, pszLeftContext: ::LPCWSTR, pszRightContext: ::LPCWSTR, + LangID: ::WORD, pEnginePronunciationList: *mut SPWORDPRONUNCIATIONLIST + ) -> ::HRESULT +} +); +STRUCT!{struct SPDISPLAYTOKEN { + pszLexical: *const ::WCHAR, + pszDisplay: *const ::WCHAR, + bDisplayAttributes: ::BYTE, +}} +STRUCT!{struct SPDISPLAYPHRASE { + ulNumTokens: ::ULONG, + pTokens: *mut SPDISPLAYTOKEN, +}} +RIDL!( +interface ISpDisplayAlternates(ISpDisplayAlternatesVtbl): IUnknown(IUnknownVtbl) { + fn GetDisplayAlternates( + &mut self, pPhrase: *const SPDISPLAYPHRASE, cRequestCount: ::ULONG, + ppCoMemPhrases: *mut *mut SPDISPLAYPHRASE, pcPhrasesReturned: *mut ::ULONG + ) -> ::HRESULT, + fn SetFullStopTrailSpace(&mut self, ulTrailSpace: ::ULONG) -> ::HRESULT +} +); +pub type SpeechLanguageId = ::c_long; +ENUM!{enum DISPID_SpeechDataKey { + DISPID_SDKSetBinaryValue = 1, + DISPID_SDKGetBinaryValue, + DISPID_SDKSetStringValue, + DISPID_SDKGetStringValue, + DISPID_SDKSetLongValue, + DISPID_SDKGetlongValue, + DISPID_SDKOpenKey, + DISPID_SDKCreateKey, + DISPID_SDKDeleteKey, + DISPID_SDKDeleteValue, + DISPID_SDKEnumKeys, + DISPID_SDKEnumValues, +}} +ENUM!{enum DISPID_SpeechObjectToken { + DISPID_SOTId = 1, + DISPID_SOTDataKey, + DISPID_SOTCategory, + DISPID_SOTGetDescription, + DISPID_SOTSetId, + DISPID_SOTGetAttribute, + DISPID_SOTCreateInstance, + DISPID_SOTRemove, + DISPID_SOTGetStorageFileName, + DISPID_SOTRemoveStorageFileName, + DISPID_SOTIsUISupported, + DISPID_SOTDisplayUI, + DISPID_SOTMatchesAttributes, +}} +ENUM!{enum SpeechDataKeyLocation { + SDKLDefaultLocation = SPDKL_DefaultLocation.0, + SDKLCurrentUser = SPDKL_CurrentUser.0, + SDKLLocalMachine = SPDKL_LocalMachine.0, + SDKLCurrentConfig = SPDKL_CurrentConfig.0, +}} +ENUM!{enum SpeechTokenContext { + STCInprocServer = ::CLSCTX_INPROC_SERVER, + STCInprocHandler = ::CLSCTX_INPROC_HANDLER, + STCLocalServer = ::CLSCTX_LOCAL_SERVER, + STCRemoteServer = ::CLSCTX_REMOTE_SERVER, + STCAll = ::CLSCTX_INPROC_SERVER | ::CLSCTX_INPROC_HANDLER | + ::CLSCTX_LOCAL_SERVER | ::CLSCTX_REMOTE_SERVER, +}} +ENUM!{enum SpeechTokenShellFolder { + STSF_AppData = 0x1a, + STSF_LocalAppData = 0x1c, + STSF_CommonAppData = 0x23, + STSF_FlagCreate = 0x8000, +}} +ENUM!{enum DISPID_SpeechObjectTokens { + DISPID_SOTsCount = 1, + DISPID_SOTsItem = ::DISPID_VALUE as u32, + DISPID_SOTs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechObjectTokenCategory { + DISPID_SOTCId = 1, + DISPID_SOTCDefault, + DISPID_SOTCSetId, + DISPID_SOTCGetDataKey, + DISPID_SOTCEnumerateTokens, +}} +ENUM!{enum SpeechAudioFormatType { + SAFTDefault = -1i32 as u32, + SAFTNoAssignedFormat = 0, + SAFTText = 1, + SAFTNonStandardFormat = 2, + SAFTExtendedAudioFormat = 3, + SAFT8kHz8BitMono = 4, + SAFT8kHz8BitStereo = 5, + SAFT8kHz16BitMono = 6, + SAFT8kHz16BitStereo = 7, + SAFT11kHz8BitMono = 8, + SAFT11kHz8BitStereo = 9, + SAFT11kHz16BitMono = 10, + SAFT11kHz16BitStereo = 11, + SAFT12kHz8BitMono = 12, + SAFT12kHz8BitStereo = 13, + SAFT12kHz16BitMono = 14, + SAFT12kHz16BitStereo = 15, + SAFT16kHz8BitMono = 16, + SAFT16kHz8BitStereo = 17, + SAFT16kHz16BitMono = 18, + SAFT16kHz16BitStereo = 19, + SAFT22kHz8BitMono = 20, + SAFT22kHz8BitStereo = 21, + SAFT22kHz16BitMono = 22, + SAFT22kHz16BitStereo = 23, + SAFT24kHz8BitMono = 24, + SAFT24kHz8BitStereo = 25, + SAFT24kHz16BitMono = 26, + SAFT24kHz16BitStereo = 27, + SAFT32kHz8BitMono = 28, + SAFT32kHz8BitStereo = 29, + SAFT32kHz16BitMono = 30, + SAFT32kHz16BitStereo = 31, + SAFT44kHz8BitMono = 32, + SAFT44kHz8BitStereo = 33, + SAFT44kHz16BitMono = 34, + SAFT44kHz16BitStereo = 35, + SAFT48kHz8BitMono = 36, + SAFT48kHz8BitStereo = 37, + SAFT48kHz16BitMono = 38, + SAFT48kHz16BitStereo = 39, + SAFTTrueSpeech_8kHz1BitMono = 40, + SAFTCCITT_ALaw_8kHzMono = 41, + SAFTCCITT_ALaw_8kHzStereo = 42, + SAFTCCITT_ALaw_11kHzMono = 43, + SAFTCCITT_ALaw_11kHzStereo = 44, + SAFTCCITT_ALaw_22kHzMono = 45, + SAFTCCITT_ALaw_22kHzStereo = 46, + SAFTCCITT_ALaw_44kHzMono = 47, + SAFTCCITT_ALaw_44kHzStereo = 48, + SAFTCCITT_uLaw_8kHzMono = 49, + SAFTCCITT_uLaw_8kHzStereo = 50, + SAFTCCITT_uLaw_11kHzMono = 51, + SAFTCCITT_uLaw_11kHzStereo = 52, + SAFTCCITT_uLaw_22kHzMono = 53, + SAFTCCITT_uLaw_22kHzStereo = 54, + SAFTCCITT_uLaw_44kHzMono = 55, + SAFTCCITT_uLaw_44kHzStereo = 56, + SAFTADPCM_8kHzMono = 57, + SAFTADPCM_8kHzStereo = 58, + SAFTADPCM_11kHzMono = 59, + SAFTADPCM_11kHzStereo = 60, + SAFTADPCM_22kHzMono = 61, + SAFTADPCM_22kHzStereo = 62, + SAFTADPCM_44kHzMono = 63, + SAFTADPCM_44kHzStereo = 64, + SAFTGSM610_8kHzMono = 65, + SAFTGSM610_11kHzMono = 66, + SAFTGSM610_22kHzMono = 67, + SAFTGSM610_44kHzMono = 68, +}} +ENUM!{enum DISPID_SpeechAudioFormat { + DISPID_SAFType = 1, + DISPID_SAFGuid, + DISPID_SAFGetWaveFormatEx, + DISPID_SAFSetWaveFormatEx, +}} +ENUM!{enum DISPID_SpeechBaseStream { + DISPID_SBSFormat = 1, + DISPID_SBSRead, + DISPID_SBSWrite, + DISPID_SBSSeek, +}} +ENUM!{enum SpeechStreamSeekPositionType { + SSSPTRelativeToStart = ::STREAM_SEEK_SET.0, + SSSPTRelativeToCurrentPosition = ::STREAM_SEEK_CUR.0, + SSSPTRelativeToEnd = ::STREAM_SEEK_END.0, +}} +ENUM!{enum DISPID_SpeechAudio { + DISPID_SAStatus = 200, + DISPID_SABufferInfo, + DISPID_SADefaultFormat, + DISPID_SAVolume, + DISPID_SABufferNotifySize, + DISPID_SAEventHandle, + DISPID_SASetState, +}} +ENUM!{enum SpeechAudioState { + SASClosed = SPAS_CLOSED.0, + SASStop = SPAS_STOP.0, + SASPause = SPAS_PAUSE.0, + SASRun = SPAS_RUN.0, +}} +ENUM!{enum DISPID_SpeechMMSysAudio { + DISPID_SMSADeviceId = 300, + DISPID_SMSALineId, + DISPID_SMSAMMHandle, +}} +ENUM!{enum DISPID_SpeechFileStream { + DISPID_SFSOpen = 100, + DISPID_SFSClose, +}} +ENUM!{enum SpeechStreamFileMode { + SSFMOpenForRead = SPFM_OPEN_READONLY.0, + SSFMOpenReadWrite = SPFM_OPEN_READWRITE.0, + SSFMCreate = SPFM_CREATE.0, + SSFMCreateForWrite = SPFM_CREATE_ALWAYS.0, +}} +ENUM!{enum DISPID_SpeechCustomStream { + DISPID_SCSBaseStream = 100, +}} +ENUM!{enum DISPID_SpeechMemoryStream { + DISPID_SMSSetData = 100, + DISPID_SMSGetData, +}} +ENUM!{enum DISPID_SpeechAudioStatus { + DISPID_SASFreeBufferSpace = 1, + DISPID_SASNonBlockingIO, + DISPID_SASState, + DISPID_SASCurrentSeekPosition, + DISPID_SASCurrentDevicePosition, +}} +ENUM!{enum DISPID_SpeechAudioBufferInfo { + DISPID_SABIMinNotification = 1, + DISPID_SABIBufferSize, + DISPID_SABIEventBias, +}} +ENUM!{enum DISPID_SpeechWaveFormatEx { + DISPID_SWFEFormatTag = 1, + DISPID_SWFEChannels, + DISPID_SWFESamplesPerSec, + DISPID_SWFEAvgBytesPerSec, + DISPID_SWFEBlockAlign, + DISPID_SWFEBitsPerSample, + DISPID_SWFEExtraData, +}} +ENUM!{enum DISPID_SpeechVoice { + DISPID_SVStatus = 1, + DISPID_SVVoice, + DISPID_SVAudioOutput, + DISPID_SVAudioOutputStream, + DISPID_SVRate, + DISPID_SVVolume, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet, + DISPID_SVEventInterests, + DISPID_SVPriority, + DISPID_SVAlertBoundary, + DISPID_SVSyncronousSpeakTimeout, + DISPID_SVSpeak, + DISPID_SVSpeakStream, + DISPID_SVPause, + DISPID_SVResume, + DISPID_SVSkip, + DISPID_SVGetVoices, + DISPID_SVGetAudioOutputs, + DISPID_SVWaitUntilDone, + DISPID_SVSpeakCompleteEvent, + DISPID_SVIsUISupported, + DISPID_SVDisplayUI, +}} +ENUM!{enum SpeechVoicePriority { + SVPNormal = SPVPRI_NORMAL.0, + SVPAlert = SPVPRI_ALERT.0, + SVPOver = SPVPRI_OVER.0, +}} +FLAGS!{enum SpeechVoiceSpeakFlags { + SVSFDefault = SPF_DEFAULT.0, + SVSFlagsAsync = SPF_ASYNC.0, + SVSFPurgeBeforeSpeak = SPF_PURGEBEFORESPEAK.0, + SVSFIsFilename = SPF_IS_FILENAME.0, + SVSFIsXML = SPF_IS_XML.0, + SVSFIsNotXML = SPF_IS_NOT_XML.0, + SVSFPersistXML = SPF_PERSIST_XML.0, + SVSFNLPSpeakPunc = SPF_NLP_SPEAK_PUNC.0, + SVSFParseSapi = SPF_PARSE_SAPI.0, + SVSFParseSsml = SPF_PARSE_SSML.0, + SVSFParseMask = SPF_PARSE_MASK as u32, + SVSFVoiceMask = SPF_VOICE_MASK as u32, + SVSFUnusedFlags = SPF_UNUSED_FLAGS as u32, +}} +pub const SVSFParseAutodetect: SpeechVoiceSpeakFlags = SVSFDefault; +pub const SVSFNLPMask: SpeechVoiceSpeakFlags = SVSFNLPSpeakPunc; +FLAGS!{enum SpeechVoiceEvents { + SVEStartInputStream = 1 << 1, + SVEEndInputStream = 1 << 2, + SVEVoiceChange = 1 << 3, + SVEBookmark = 1 << 4, + SVEWordBoundary = 1 << 5, + SVEPhoneme = 1 << 6, + SVESentenceBoundary = 1 << 7, + SVEViseme = 1 << 8, + SVEAudioLevel = 1 << 9, + SVEPrivate = 1 << 15, + SVEAllEvents = 0x83fe, +}} +ENUM!{enum DISPID_SpeechVoiceStatus { + DISPID_SVSCurrentStreamNumber = 1, + DISPID_SVSLastStreamNumberQueued, + DISPID_SVSLastResult, + DISPID_SVSRunningState, + DISPID_SVSInputWordPosition, + DISPID_SVSInputWordLength, + DISPID_SVSInputSentencePosition, + DISPID_SVSInputSentenceLength, + DISPID_SVSLastBookmark, + DISPID_SVSLastBookmarkId, + DISPID_SVSPhonemeId, + DISPID_SVSVisemeId, +}} +ENUM!{enum SpeechRunState { + SRSEDone = SPRS_DONE.0, + SRSEIsSpeaking = SPRS_IS_SPEAKING.0, +}} +ENUM!{enum SpeechVisemeType { + SVP_0 = 0, + SVP_1, + SVP_2, + SVP_3, + SVP_4, + SVP_5, + SVP_6, + SVP_7, + SVP_8, + SVP_9, + SVP_10, + SVP_11, + SVP_12, + SVP_13, + SVP_14, + SVP_15, + SVP_16, + SVP_17, + SVP_18, + SVP_19, + SVP_20, + SVP_21, +}} +ENUM!{enum SpeechVisemeFeature { + SVF_None = 0, + SVF_Stressed = SPVFEATURE_STRESSED.0, + SVF_Emphasis = SPVFEATURE_EMPHASIS.0, +}} +ENUM!{enum DISPID_SpeechVoiceEvent { + DISPID_SVEStreamStart = 1, + DISPID_SVEStreamEnd, + DISPID_SVEVoiceChange, + DISPID_SVEBookmark, + DISPID_SVEWord, + DISPID_SVEPhoneme, + DISPID_SVESentenceBoundary, + DISPID_SVEViseme, + DISPID_SVEAudioLevel, + DISPID_SVEEnginePrivate, +}} +ENUM!{enum DISPID_SpeechRecognizer { + DISPID_SRRecognizer = 1, + DISPID_SRAllowAudioInputFormatChangesOnNextSet, + DISPID_SRAudioInput, + DISPID_SRAudioInputStream, + DISPID_SRIsShared, + DISPID_SRState, + DISPID_SRStatus, + DISPID_SRProfile, + DISPID_SREmulateRecognition, + DISPID_SRCreateRecoContext, + DISPID_SRGetFormat, + DISPID_SRSetPropertyNumber, + DISPID_SRGetPropertyNumber, + DISPID_SRSetPropertyString, + DISPID_SRGetPropertyString, + DISPID_SRIsUISupported, + DISPID_SRDisplayUI, + DISPID_SRGetRecognizers, + DISPID_SVGetAudioInputs, + DISPID_SVGetProfiles, +}} +ENUM!{enum SpeechRecognizerState { + SRSInactive = SPRST_INACTIVE.0, + SRSActive = SPRST_ACTIVE.0, + SRSActiveAlways = SPRST_ACTIVE_ALWAYS.0, + SRSInactiveWithPurge = SPRST_INACTIVE_WITH_PURGE.0, +}} +ENUM!{enum SpeechDisplayAttributes { + SDA_No_Trailing_Space = 0, + SDA_One_Trailing_Space = SPAF_ONE_TRAILING_SPACE.0, + SDA_Two_Trailing_Spaces = SPAF_TWO_TRAILING_SPACES.0, + SDA_Consume_Leading_Spaces = SPAF_CONSUME_LEADING_SPACES.0, +}} +ENUM!{enum SpeechFormatType { + SFTInput = SPWF_INPUT.0, + SFTSREngine = SPWF_SRENGINE.0, +}} +FLAGS!{enum SpeechEmulationCompareFlags { + SECFIgnoreCase = 0x1, + SECFIgnoreKanaType = 0x10000, + SECFIgnoreWidth = 0x20000, + SECFNoSpecialChars = 0x20000000, + SECFEmulateResult = 0x40000000, + SECFDefault = SECFIgnoreCase.0 | SECFIgnoreKanaType.0 | SECFIgnoreWidth.0, +}} +ENUM!{enum DISPID_SpeechRecognizerStatus { + DISPID_SRSAudioStatus = 1, + DISPID_SRSCurrentStreamPosition, + DISPID_SRSCurrentStreamNumber, + DISPID_SRSNumberOfActiveRules, + DISPID_SRSClsidEngine, + DISPID_SRSSupportedLanguages, +}} +ENUM!{enum DISPID_SpeechRecoContext { + DISPID_SRCRecognizer = 1, + DISPID_SRCAudioInInterferenceStatus, + DISPID_SRCRequestedUIType, + DISPID_SRCVoice, + DISPID_SRAllowVoiceFormatMatchingOnNextSet, + DISPID_SRCVoicePurgeEvent, + DISPID_SRCEventInterests, + DISPID_SRCCmdMaxAlternates, + DISPID_SRCState, + DISPID_SRCRetainedAudio, + DISPID_SRCRetainedAudioFormat, + DISPID_SRCPause, + DISPID_SRCResume, + DISPID_SRCCreateGrammar, + DISPID_SRCCreateResultFromMemory, + DISPID_SRCBookmark, + DISPID_SRCSetAdaptationData, +}} +ENUM!{enum SpeechRetainedAudioOptions { + SRAONone = SPAO_NONE.0, + SRAORetainAudio = SPAO_RETAIN_AUDIO.0, +}} +ENUM!{enum SpeechBookmarkOptions { + SBONone = SPBO_NONE.0, + SBOPause = SPBO_PAUSE.0, +}} +ENUM!{enum SpeechInterference { + SINone = SPINTERFERENCE_NONE.0, + SINoise = SPINTERFERENCE_NOISE.0, + SINoSignal = SPINTERFERENCE_NOSIGNAL.0, + SITooLoud = SPINTERFERENCE_TOOLOUD.0, + SITooQuiet = SPINTERFERENCE_TOOQUIET.0, + SITooFast = SPINTERFERENCE_TOOFAST.0, + SITooSlow = SPINTERFERENCE_TOOSLOW.0, +}} +FLAGS!{enum SpeechRecoEvents { + SREStreamEnd = 1 << 0, + SRESoundStart = 1 << 1, + SRESoundEnd = 1 << 2, + SREPhraseStart = 1 << 3, + SRERecognition = 1 << 4, + SREHypothesis = 1 << 5, + SREBookmark = 1 << 6, + SREPropertyNumChange = 1 << 7, + SREPropertyStringChange = 1 << 8, + SREFalseRecognition = 1 << 9, + SREInterference = 1 << 10, + SRERequestUI = 1 << 11, + SREStateChange = 1 << 12, + SREAdaptation = 1 << 13, + SREStreamStart = 1 << 14, + SRERecoOtherContext = 1 << 15, + SREAudioLevel = 1 << 16, + SREPrivate = 1 << 18, + SREAllEvents = 0x5ffff, +}} +ENUM!{enum SpeechRecoContextState { + SRCS_Disabled = SPCS_DISABLED.0, + SRCS_Enabled = SPCS_ENABLED.0, +}} +ENUM!{enum DISPIDSPRG { + DISPID_SRGId = 1, + DISPID_SRGRecoContext, + DISPID_SRGState, + DISPID_SRGRules, + DISPID_SRGReset, + DISPID_SRGCommit, + DISPID_SRGCmdLoadFromFile, + DISPID_SRGCmdLoadFromObject, + DISPID_SRGCmdLoadFromResource, + DISPID_SRGCmdLoadFromMemory, + DISPID_SRGCmdLoadFromProprietaryGrammar, + DISPID_SRGCmdSetRuleState, + DISPID_SRGCmdSetRuleIdState, + DISPID_SRGDictationLoad, + DISPID_SRGDictationUnload, + DISPID_SRGDictationSetState, + DISPID_SRGSetWordSequenceData, + DISPID_SRGSetTextSelection, + DISPID_SRGIsPronounceable, +}} +ENUM!{enum SpeechLoadOption { + SLOStatic = SPLO_STATIC.0, + SLODynamic = SPLO_DYNAMIC.0, +}} +ENUM!{enum SpeechWordPronounceable { + SWPUnknownWordUnpronounceable = SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE.0, + SWPUnknownWordPronounceable = SPWP_UNKNOWN_WORD_PRONOUNCEABLE.0, + SWPKnownWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE.0, +}} +ENUM!{enum SpeechGrammarState { + SGSEnabled = SPGS_ENABLED.0, + SGSDisabled = SPGS_DISABLED.0, + SGSExclusive = SPGS_EXCLUSIVE.0, +}} +ENUM!{enum SpeechRuleState { + SGDSInactive = SPRS_INACTIVE.0, + SGDSActive = SPRS_ACTIVE.0, + SGDSActiveWithAutoPause = SPRS_ACTIVE_WITH_AUTO_PAUSE.0, + SGDSActiveUserDelimited = SPRS_ACTIVE_USER_DELIMITED.0, +}} +ENUM!{enum SpeechRuleAttributes { + SRATopLevel = SPRAF_TopLevel.0, + SRADefaultToActive = SPRAF_Active.0, + SRAExport = SPRAF_Export.0, + SRAImport = SPRAF_Import.0, + SRAInterpreter = SPRAF_Interpreter.0, + SRADynamic = SPRAF_Dynamic.0, + SRARoot = SPRAF_Root.0, +}} +ENUM!{enum SpeechGrammarWordType { + SGDisplay = SPWT_DISPLAY.0, + SGLexical = SPWT_LEXICAL.0, + SGPronounciation = SPWT_PRONUNCIATION.0, + SGLexicalNoSpecialChars = SPWT_LEXICAL_NO_SPECIAL_CHARS.0, +}} +ENUM!{enum DISPID_SpeechRecoContextEvents { + DISPID_SRCEStartStream = 1, + DISPID_SRCEEndStream, + DISPID_SRCEBookmark, + DISPID_SRCESoundStart, + DISPID_SRCESoundEnd, + DISPID_SRCEPhraseStart, + DISPID_SRCERecognition, + DISPID_SRCEHypothesis, + DISPID_SRCEPropertyNumberChange, + DISPID_SRCEPropertyStringChange, + DISPID_SRCEFalseRecognition, + DISPID_SRCEInterference, + DISPID_SRCERequestUI, + DISPID_SRCERecognizerStateChange, + DISPID_SRCEAdaptation, + DISPID_SRCERecognitionForOtherContext, + DISPID_SRCEAudioLevel, + DISPID_SRCEEnginePrivate, +}} +ENUM!{enum SpeechRecognitionType { + SRTStandard = 0, + SRTAutopause = SPREF_AutoPause.0, + SRTEmulated = SPREF_Emulated.0, + SRTSMLTimeout = SPREF_SMLTimeout.0, + SRTExtendableParse = SPREF_ExtendableParse.0, + SRTReSent = SPREF_ReSent.0, +}} +ENUM!{enum DISPID_SpeechGrammarRule { + DISPID_SGRAttributes = 1, + DISPID_SGRInitialState, + DISPID_SGRName, + DISPID_SGRId, + DISPID_SGRClear, + DISPID_SGRAddResource, + DISPID_SGRAddState, +}} +ENUM!{enum DISPID_SpeechGrammarRules { + DISPID_SGRsCount = 1, + DISPID_SGRsDynamic, + DISPID_SGRsAdd, + DISPID_SGRsCommit, + DISPID_SGRsCommitAndSave, + DISPID_SGRsFindRule, + DISPID_SGRsItem = ::DISPID_VALUE as u32, + DISPID_SGRs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechGrammarRuleState { + DISPID_SGRSRule = 1, + DISPID_SGRSTransitions, + DISPID_SGRSAddWordTransition, + DISPID_SGRSAddRuleTransition, + DISPID_SGRSAddSpecialTransition, +}} +ENUM!{enum SpeechSpecialTransitionType { + SSTTWildcard = 1, + SSTTDictation, + SSTTTextBuffer, +}} +ENUM!{enum DISPID_SpeechGrammarRuleStateTransitions { + DISPID_SGRSTsCount = 1, + DISPID_SGRSTsItem = ::DISPID_VALUE as u32, + DISPID_SGRSTs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechGrammarRuleStateTransition { + DISPID_SGRSTType = 1, + DISPID_SGRSTText, + DISPID_SGRSTRule, + DISPID_SGRSTWeight, + DISPID_SGRSTPropertyName, + DISPID_SGRSTPropertyId, + DISPID_SGRSTPropertyValue, + DISPID_SGRSTNextState, +}} +ENUM!{enum SpeechGrammarRuleStateTransitionType { + SGRSTTEpsilon = 0, + SGRSTTWord, + SGRSTTRule, + SGRSTTDictation, + SGRSTTWildcard, + SGRSTTTextBuffer, +}} +ENUM!{enum DISPIDSPTSI { + DISPIDSPTSI_ActiveOffset = 1, + DISPIDSPTSI_ActiveLength, + DISPIDSPTSI_SelectionOffset, + DISPIDSPTSI_SelectionLength, +}} +ENUM!{enum DISPID_SpeechRecoResult { + DISPID_SRRRecoContext = 1, + DISPID_SRRTimes, + DISPID_SRRAudioFormat, + DISPID_SRRPhraseInfo, + DISPID_SRRAlternates, + DISPID_SRRAudio, + DISPID_SRRSpeakAudio, + DISPID_SRRSaveToMemory, + DISPID_SRRDiscardResultInfo, +}} +ENUM!{enum SpeechDiscardType { + SDTProperty = SPDF_PROPERTY.0, + SDTReplacement = SPDF_REPLACEMENT.0, + SDTRule = SPDF_RULE.0, + SDTDisplayText = SPDF_DISPLAYTEXT.0, + SDTLexicalForm = SPDF_LEXICALFORM.0, + SDTPronunciation = SPDF_PRONUNCIATION.0, + SDTAudio = SPDF_AUDIO.0, + SDTAlternates = SPDF_ALTERNATES.0, + SDTAll = SPDF_ALL.0, +}} +ENUM!{enum DISPID_SpeechXMLRecoResult { + DISPID_SRRGetXMLResult, + DISPID_SRRGetXMLErrorInfo, +}} +ENUM!{enum DISPID_SpeechRecoResult2 { + DISPID_SRRSetTextFeedback, +}} +ENUM!{enum DISPID_SpeechPhraseBuilder { + DISPID_SPPBRestorePhraseFromMemory = 1, +}} +ENUM!{enum DISPID_SpeechRecoResultTimes { + DISPID_SRRTStreamTime = 1, + DISPID_SRRTLength, + DISPID_SRRTTickCount, + DISPID_SRRTOffsetFromStart, +}} +ENUM!{enum DISPID_SpeechPhraseAlternate { + DISPID_SPARecoResult = 1, + DISPID_SPAStartElementInResult, + DISPID_SPANumberOfElementsInResult, + DISPID_SPAPhraseInfo, + DISPID_SPACommit, +}} +ENUM!{enum DISPID_SpeechPhraseAlternates { + DISPID_SPAsCount = 1, + DISPID_SPAsItem = ::DISPID_VALUE as u32, + DISPID_SPAs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseInfo { + DISPID_SPILanguageId = 1, + DISPID_SPIGrammarId, + DISPID_SPIStartTime, + DISPID_SPIAudioStreamPosition, + DISPID_SPIAudioSizeBytes, + DISPID_SPIRetainedSizeBytes, + DISPID_SPIAudioSizeTime, + DISPID_SPIRule, + DISPID_SPIProperties, + DISPID_SPIElements, + DISPID_SPIReplacements, + DISPID_SPIEngineId, + DISPID_SPIEnginePrivateData, + DISPID_SPISaveToMemory, + DISPID_SPIGetText, + DISPID_SPIGetDisplayAttributes, +}} +ENUM!{enum DISPID_SpeechPhraseElement { + DISPID_SPEAudioTimeOffset = 1, + DISPID_SPEAudioSizeTime, + DISPID_SPEAudioStreamOffset, + DISPID_SPEAudioSizeBytes, + DISPID_SPERetainedStreamOffset, + DISPID_SPERetainedSizeBytes, + DISPID_SPEDisplayText, + DISPID_SPELexicalForm, + DISPID_SPEPronunciation, + DISPID_SPEDisplayAttributes, + DISPID_SPERequiredConfidence, + DISPID_SPEActualConfidence, + DISPID_SPEEngineConfidence, +}} +ENUM!{enum SpeechEngineConfidence { + SECLowConfidence = -1i32 as u32, + SECNormalConfidence = 0, + SECHighConfidence = 1, +}} +ENUM!{enum DISPID_SpeechPhraseElements { + DISPID_SPEsCount = 1, + DISPID_SPEsItem = ::DISPID_VALUE as u32, + DISPID_SPEs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseReplacement { + DISPID_SPRDisplayAttributes = 1, + DISPID_SPRText, + DISPID_SPRFirstElement, + DISPID_SPRNumberOfElements, +}} +ENUM!{enum DISPID_SpeechPhraseReplacements { + DISPID_SPRsCount = 1, + DISPID_SPRsItem = ::DISPID_VALUE as u32, + DISPID_SPRs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseProperty { + DISPID_SPPName = 1, + DISPID_SPPId, + DISPID_SPPValue, + DISPID_SPPFirstElement, + DISPID_SPPNumberOfElements, + DISPID_SPPEngineConfidence, + DISPID_SPPConfidence, + DISPID_SPPParent, + DISPID_SPPChildren, +}} +ENUM!{enum DISPID_SpeechPhraseProperties { + DISPID_SPPsCount = 1, + DISPID_SPPsItem = ::DISPID_VALUE as u32, + DISPID_SPPs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseRule { + DISPID_SPRuleName = 1, + DISPID_SPRuleId, + DISPID_SPRuleFirstElement, + DISPID_SPRuleNumberOfElements, + DISPID_SPRuleParent, + DISPID_SPRuleChildren, + DISPID_SPRuleConfidence, + DISPID_SPRuleEngineConfidence, +}} +ENUM!{enum DISPID_SpeechPhraseRules { + DISPID_SPRulesCount = 1, + DISPID_SPRulesItem = ::DISPID_VALUE as u32, + DISPID_SPRules_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechLexicon { + DISPID_SLGenerationId = 1, + DISPID_SLGetWords, + DISPID_SLAddPronunciation, + DISPID_SLAddPronunciationByPhoneIds, + DISPID_SLRemovePronunciation, + DISPID_SLRemovePronunciationByPhoneIds, + DISPID_SLGetPronunciations, + DISPID_SLGetGenerationChange, +}} +ENUM!{enum SpeechLexiconType { + SLTUser = eLEXTYPE_USER.0, + SLTApp = eLEXTYPE_APP.0, +}} +ENUM!{enum SpeechPartOfSpeech { + SPSNotOverriden = SPPS_NotOverriden.0, + SPSUnknown = SPPS_Unknown.0, + SPSNoun = SPPS_Noun.0, + SPSVerb = SPPS_Verb.0, + SPSModifier = SPPS_Modifier.0, + SPSFunction = SPPS_Function.0, + SPSInterjection = SPPS_Interjection.0, + SPSLMA = SPPS_LMA.0, + SPSSuppressWord = SPPS_SuppressWord.0, +}} +ENUM!{enum DISPID_SpeechLexiconWords { + DISPID_SLWsCount = 1, + DISPID_SLWsItem = ::DISPID_VALUE as u32, + DISPID_SLWs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum SpeechWordType { + SWTAdded = eWORDTYPE_ADDED.0, + SWTDeleted = eWORDTYPE_DELETED.0, +}} +ENUM!{enum DISPID_SpeechLexiconWord { + DISPID_SLWLangId = 1, + DISPID_SLWType, + DISPID_SLWWord, + DISPID_SLWPronunciations, +}} +ENUM!{enum DISPID_SpeechLexiconProns { + DISPID_SLPsCount = 1, + DISPID_SLPsItem = ::DISPID_VALUE as u32, + DISPID_SLPs_NewEnum = ::DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechLexiconPronunciation { + DISPID_SLPType = 1, + DISPID_SLPLangId, + DISPID_SLPPartOfSpeech, + DISPID_SLPPhoneIds, + DISPID_SLPSymbolic, +}} +ENUM!{enum DISPID_SpeechPhoneConverter { + DISPID_SPCLangId = 1, + DISPID_SPCPhoneToId, + DISPID_SPCIdToPhone, +}} +RIDL!( +interface ISpeechDataKey(ISpeechDataKeyVtbl): IDispatch(IDispatchVtbl) { + fn SetBinaryValue(&mut self, ValueName: ::BSTR, Value: ::VARIANT) -> ::HRESULT, + fn GetBinaryValue(&mut self, ValueName: ::BSTR, Value: *mut ::VARIANT) -> ::HRESULT, + fn SetStringValue(&mut self, ValueName: ::BSTR, Value: ::BSTR) -> ::HRESULT, + fn GetStringValue(&mut self, ValueName: ::BSTR, Value: *mut ::BSTR) -> ::HRESULT, + fn SetLongValue(&mut self, ValueName: ::BSTR, Value: ::c_long) -> ::HRESULT, + fn GetLongValue(&mut self, ValueName: ::BSTR, Value: *mut ::c_long) -> ::HRESULT, + fn OpenKey(&mut self, SubKeyName: ::BSTR, SubKey: *mut *mut ISpeechDataKey) -> ::HRESULT, + fn CreateKey(&mut self, SubKeyName: ::BSTR, SubKey: *mut *mut ISpeechDataKey) -> ::HRESULT, + fn DeleteKey(&mut self, SubKeyName: ::BSTR) -> ::HRESULT, + fn DeleteValue(&mut self, ValueName: ::BSTR) -> ::HRESULT, + fn EnumKeys(&mut self, Index: ::c_long, SubKeyName: *mut ::BSTR) -> ::HRESULT, + fn EnumValues(&mut self, Index: ::c_long, ValueName: *mut ::BSTR) -> ::HRESULT +} +); +RIDL!( +interface ISpeechObjectToken(ISpeechObjectTokenVtbl): IDispatch(IDispatchVtbl) { + fn get_Id(&mut self, ObjectId: *mut ::BSTR) -> ::HRESULT, + fn get_DataKey(&mut self, DataKey: *mut *mut ISpeechDataKey) -> ::HRESULT, + fn get_Category(&mut self, Category: *mut *mut ISpeechObjectTokenCategory) -> ::HRESULT, + fn GetDescription(&mut self, Locale: ::c_long, Description: *mut ::BSTR) -> ::HRESULT, + fn SetId( + &mut self, Id: ::BSTR, CategoryId: ::BSTR, CreateIfNotExist: ::VARIANT_BOOL + ) -> ::HRESULT, + fn GetAttribute(&mut self, AttributeName: ::BSTR, AttributeValue: *mut ::BSTR) -> ::HRESULT, + fn CreateInstance( + &mut self, pUnkOuter: *mut ::IUnknown, ClsContext: SpeechTokenContext, + Object: *mut *mut ::IUnknown + ) -> ::HRESULT, + fn Remove(&mut self, ObjectStorageCLSID: ::BSTR) -> ::HRESULT, + fn GetStorageFileName( + &mut self, ObjectStorageCLSID: ::BSTR, KeyName: ::BSTR, FileName: ::BSTR, Folder: ::BSTR, + FilePath: *mut ::BSTR + ) -> ::HRESULT, + fn RemoveStorageFileName( + &mut self, ObjectStorageCLSID: ::BSTR, KeyName: ::BSTR, DeleteFile: ::VARIANT_BOOL + ) -> ::HRESULT, + fn IsUISupported( + &mut self, TypeOfUI: ::BSTR, ExtraData: *const ::VARIANT, Object: *mut ::IUnknown, + Supported: *mut ::VARIANT_BOOL + ) -> ::HRESULT, + fn DisplayUI( + &mut self, hWnd: ::c_long, Title: ::BSTR, TypeOfUI: ::BSTR, ExtraData: *const ::VARIANT, + Object: *mut ::IUnknown + ) -> ::HRESULT, + fn MatchesAttributes(&mut self, Attributes: ::BSTR, Matches: *mut ::VARIANT_BOOL) -> ::HRESULT +} +); +RIDL!( +interface ISpeechObjectTokens(ISpeechObjectTokensVtbl): IDispatch(IDispatchVtbl) { + fn get_Count(&mut self, Count: *mut ::c_long) -> ::HRESULT, + fn Item(&mut self, Index: ::c_long, Token: *mut *mut ISpeechObjectToken) -> ::HRESULT, + fn get__NewEnum(&mut self, ppEnumVARIANT: *mut *mut ::IUnknown) -> ::HRESULT +} +); +RIDL!( +interface ISpeechObjectTokenCategory(ISpeechObjectTokenCategoryVtbl): IDispatch(IDispatchVtbl) { + fn get_Id(&mut self, Id: *mut ::BSTR) -> ::HRESULT, + fn put_Default(&mut self, TokenId: ::BSTR) -> ::HRESULT, + fn get_Default(&mut self, TokenId: *mut ::BSTR) -> ::HRESULT, + fn SetId(&mut self, Id: ::BSTR, CreateIfNotExist: ::VARIANT_BOOL) -> ::HRESULT, + fn GetDataKey( + &mut self, Location: SpeechDataKeyLocation, DataKey: *mut *mut ISpeechDataKey + ) -> ::HRESULT, + fn EnumerateTokens( + &mut self, RequiredAttributes: ::BSTR, OptionalAttributes: ::BSTR, + Tokens: *mut *mut ISpeechObjectTokens + ) -> ::HRESULT +} +); +RIDL!( +interface ISpeechAudioBufferInfo(ISpeechAudioBufferInfoVtbl): IDispatch(IDispatchVtbl) { + fn get_MinNotification(&mut self, MinNotification: *mut ::c_long) -> ::HRESULT, + fn put_MinNotification(&mut self, MinNotification: ::c_long) -> ::HRESULT, + fn get_BufferSize(&mut self, BufferSize: *mut ::c_long) -> ::HRESULT, + fn put_BufferSize(&mut self, BufferSize: ::c_long) -> ::HRESULT, + fn get_EventBias(&mut self, EventBias: *mut ::c_long) -> ::HRESULT, + fn put_EventBias(&mut self, EventBias: ::c_long) -> ::HRESULT +} +); +RIDL!( +interface ISpeechAudioStatus(ISpeechAudioStatusVtbl): IDispatch(IDispatchVtbl) { + fn get_FreeBufferSpace(&mut self, FreeBufferSpace: *mut ::c_long) -> ::HRESULT, + fn get_NonBlockingIO(&mut self, NonBlockingIO: *mut ::c_long) -> ::HRESULT, + fn get_State(&mut self, State: *mut SpeechAudioState) -> ::HRESULT, + fn get_CurrentSeekPosition(&mut self, CurrentSeekPosition: *mut ::VARIANT) -> ::HRESULT, + fn get_CurrentDevicePosition(&mut self, CurrentDevicePosition: *mut ::VARIANT) -> ::HRESULT +} +); +RIDL!( +interface ISpeechAudioFormat(ISpeechAudioFormatVtbl): IDispatch(IDispatchVtbl) { + fn get_Type(&mut self, AudioFormat: *mut SpeechAudioFormatType) -> ::HRESULT, + fn put_Type(&mut self, AudioFormat: SpeechAudioFormatType) -> ::HRESULT, + fn get_Guid(&mut self, Guid: *mut ::BSTR) -> ::HRESULT, + fn put_Guid(&mut self, Guid: ::BSTR) -> ::HRESULT, + fn GetWaveFormatEx(&mut self, SpeechWaveFormatEx: *mut *mut ISpeechWaveFormatEx) -> ::HRESULT, + fn SetWaveFormatEx(&mut self, SpeechWaveFormatEx: *mut ISpeechWaveFormatEx) -> ::HRESULT +} +); +RIDL!( +interface ISpeechWaveFormatEx(ISpeechWaveFormatExVtbl): IDispatch(IDispatchVtbl) { + fn get_FormatTag(&mut self, FormatTag: *mut ::c_short) -> ::HRESULT, + fn put_FormatTag(&mut self, FormatTag: ::c_short) -> ::HRESULT, + fn get_Channels(&mut self, Channels: *mut ::c_short) -> ::HRESULT, + fn put_Channels(&mut self, Channels: ::c_short) -> ::HRESULT, + fn get_SamplesPerSec(&mut self, SamplesPerSec: *mut ::c_long) -> ::HRESULT, + fn put_SamplesPerSec(&mut self, SamplesPerSec: ::c_long) -> ::HRESULT, + fn get_AvgBytesPerSec(&mut self, AvgBytesPerSec: *mut ::c_long) -> ::HRESULT, + fn put_AvgBytesPerSec(&mut self, AvgBytesPerSec: ::c_long) -> ::HRESULT, + fn get_BlockAlign(&mut self, BlockAlign: *mut ::c_short) -> ::HRESULT, + fn put_BlockAlign(&mut self, BlockAlign: ::c_short) -> ::HRESULT, + fn get_BitsPerSample(&mut self, BitsPerSample: *mut ::c_short) -> ::HRESULT, + fn put_BitsPerSample(&mut self, BitsPerSample: ::c_short) -> ::HRESULT, + fn get_ExtraData(&mut self, ExtraData: *mut ::VARIANT) -> ::HRESULT, + fn put_ExtraData(&mut self, ExtraData: ::VARIANT) -> ::HRESULT +} +); diff --git a/third_party/rust/winapi/src/schannel.rs b/third_party/rust/winapi/src/schannel.rs new file mode 100644 index 000000000000..d57aec82fe91 --- /dev/null +++ b/third_party/rust/winapi/src/schannel.rs @@ -0,0 +1,333 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Public Definitions for SCHANNEL Security Provider +pub const UNISP_NAME: &'static str = "Microsoft Unified Security Protocol Provider"; +pub const SSL2SP_NAME: &'static str = "Microsoft SSL 2.0"; +pub const SSL3SP_NAME: &'static str = "Microsoft SSL 3.0"; +pub const TLS1SP_NAME: &'static str = "Microsoft TLS 1.0"; +pub const PCT1SP_NAME: &'static str = "Microsoft PCT 1.0"; +pub const SCHANNEL_NAME: &'static str = "Schannel"; +ENUM!{enum eTlsSignatureAlgorithm { + TlsSignatureAlgorithm_Anonymous = 0, + TlsSignatureAlgorithm_Rsa = 1, + TlsSignatureAlgorithm_Dsa = 2, + TlsSignatureAlgorithm_Ecdsa = 3, +}} +ENUM!{enum eTlsHashAlgorithm { + TlsHashAlgorithm_None = 0, + TlsHashAlgorithm_Md5 = 1, + TlsHashAlgorithm_Sha1 = 2, + TlsHashAlgorithm_Sha224 = 3, + TlsHashAlgorithm_Sha256 = 4, + TlsHashAlgorithm_Sha384 = 5, + TlsHashAlgorithm_Sha512 = 6, +}} +pub const UNISP_RPC_ID: ::DWORD = 14; +STRUCT!{struct SecPkgContext_RemoteCredentialInfo { + cbCertificateChain: ::DWORD, + pbCertificateChain: ::PBYTE, + cCertificates: ::DWORD, + fFlags: ::DWORD, + dwBits: ::DWORD, +}} +pub type PSecPkgContext_RemoteCredentialInfo = *mut SecPkgContext_RemoteCredentialInfo; +pub type SecPkgContext_RemoteCredenitalInfo = SecPkgContext_RemoteCredentialInfo; +pub type PSecPkgContext_RemoteCredenitalInfo = *mut SecPkgContext_RemoteCredentialInfo; +pub const RCRED_STATUS_NOCRED: ::DWORD = 0x00000000; +pub const RCRED_CRED_EXISTS: ::DWORD = 0x00000001; +pub const RCRED_STATUS_UNKNOWN_ISSUER: ::DWORD = 0x00000002; +STRUCT!{struct SecPkgContext_LocalCredentialInfo { + cbCertificateChain: ::DWORD, + pbCertificateChain: ::PBYTE, + cCertificates: ::DWORD, + fFlags: ::DWORD, + dwBits: ::DWORD, +}} +pub type PSecPkgContext_LocalCredentialInfo = *mut SecPkgContext_LocalCredentialInfo; +pub type SecPkgContext_LocalCredenitalInfo = SecPkgContext_LocalCredentialInfo; +pub type PSecPkgContext_LocalCredenitalInfo = *mut SecPkgContext_LocalCredentialInfo; +pub const LCRED_STATUS_NOCRED: ::DWORD = 0x00000000; +pub const LCRED_CRED_EXISTS: ::DWORD = 0x00000001; +pub const LCRED_STATUS_UNKNOWN_ISSUER: ::DWORD = 0x00000002; +STRUCT!{struct SecPkgContext_ClientCertPolicyResult { + dwPolicyResult: ::HRESULT, + guidPolicyId: ::GUID, +}} +pub type PSecPkgContext_ClientCertPolicyResult = *mut SecPkgContext_ClientCertPolicyResult; +STRUCT!{struct SecPkgContext_IssuerListInfoEx { + aIssuers: ::PCERT_NAME_BLOB, + cIssuers: ::DWORD, +}} +pub type PSecPkgContext_IssuerListInfoEx = *mut SecPkgContext_IssuerListInfoEx; +STRUCT!{struct SecPkgContext_ConnectionInfo { + dwProtocol: ::DWORD, + aiCipher: ::ALG_ID, + dwCipherStrength: ::DWORD, + aiHash: ::ALG_ID, + dwHashStrength: ::DWORD, + aiExch: ::ALG_ID, + dwExchStrength: ::DWORD, +}} +pub type PSecPkgContext_ConnectionInfo = *mut SecPkgContext_ConnectionInfo; +pub const SZ_ALG_MAX_SIZE: usize = 64; +pub const SECPKGCONTEXT_CIPHERINFO_V1: ::DWORD = 1; +STRUCT!{nodebug struct SecPkgContext_CipherInfo { + dwVersion: ::DWORD, + dwProtocol: ::DWORD, + dwCipherSuite: ::DWORD, + dwBaseCipherSuite: ::DWORD, + szCipherSuite: [::WCHAR; SZ_ALG_MAX_SIZE], + szCipher: [::WCHAR; SZ_ALG_MAX_SIZE], + dwCipherLen: ::DWORD, + dwCipherBlockLen: ::DWORD, + szHash: [::WCHAR; SZ_ALG_MAX_SIZE], + dwHashLen: ::DWORD, + szExchange: [::WCHAR; SZ_ALG_MAX_SIZE], + dwMinExchangeLen: ::DWORD, + dwMaxExchangeLen: ::DWORD, + szCertificate: [::WCHAR; SZ_ALG_MAX_SIZE], + dwKeyType: ::DWORD, +}} +pub type PSecPkgContext_CipherInfo = *mut SecPkgContext_CipherInfo; +STRUCT!{nodebug struct SecPkgContext_EapKeyBlock { + rgbKeys: [::BYTE; 128], + rgbIVs: [::BYTE; 64], +}} +pub type PSecPkgContext_EapKeyBlock = *mut SecPkgContext_EapKeyBlock; +STRUCT!{struct SecPkgContext_MappedCredAttr { + dwAttribute: ::DWORD, + pvBuffer: ::PVOID, +}} +pub type PSecPkgContext_MappedCredAttr = *mut SecPkgContext_MappedCredAttr; +pub const SSL_SESSION_RECONNECT: ::DWORD = 1; +STRUCT!{struct SecPkgContext_SessionInfo { + dwFlags: ::DWORD, + cbSessionId: ::DWORD, + rgbSessionId: [::BYTE; 32], +}} +pub type PSecPkgContext_SessionInfo = *mut SecPkgContext_SessionInfo; +STRUCT!{struct SecPkgContext_SessionAppData { + dwFlags: ::DWORD, + cbAppData: ::DWORD, + pbAppData: ::PBYTE, +}} +pub type PSecPkgContext_SessionAppData = *mut SecPkgContext_SessionAppData; +STRUCT!{struct SecPkgContext_EapPrfInfo { + dwVersion: ::DWORD, + cbPrfData: ::DWORD, + pbPrfData: ::PBYTE, +}} +pub type PSecPkgContext_EapPrfInfo = *mut SecPkgContext_EapPrfInfo; +STRUCT!{struct SecPkgContext_SupportedSignatures { + cSignatureAndHashAlgorithms: ::WORD, + pSignatureAndHashAlgorithms: *mut ::WORD, +}} +pub type PSecPkgContext_SupportedSignatures = *mut SecPkgContext_SupportedSignatures; +STRUCT!{struct SecPkgContext_Certificates { + cCertificates: ::DWORD, + cbCertificateChain: ::DWORD, + pbCertificateChain: ::PBYTE, +}} +pub type PSecPkgContext_Certificates = *mut SecPkgContext_Certificates; +STRUCT!{struct SecPkgContext_CertInfo { + dwVersion: ::DWORD, + cbSubjectName: ::DWORD, + pwszSubjectName: ::LPWSTR, + cbIssuerName: ::DWORD, + pwszIssuerName: ::LPWSTR, + dwKeySize: ::DWORD, +}} +pub type PSecPkgContext_CertInfo = *mut SecPkgContext_CertInfo; +pub const KERN_CONTEXT_CERT_INFO_V1: ::DWORD = 0x00000000; +STRUCT!{struct SecPkgContext_UiInfo { + hParentWindow: ::HWND, +}} +pub type PSecPkgContext_UiInfo = *mut SecPkgContext_UiInfo; +STRUCT!{struct SecPkgContext_EarlyStart { + dwEarlyStartFlags: ::DWORD, +}} +pub type PSecPkgContext_EarlyStart = *mut SecPkgContext_EarlyStart; +pub const ENABLE_TLS_CLIENT_EARLY_START: ::DWORD = 0x00000001; +pub const SCH_CRED_V1: ::DWORD = 0x00000001; +pub const SCH_CRED_V2: ::DWORD = 0x00000002; +pub const SCH_CRED_VERSION: ::DWORD = 0x00000002; +pub const SCH_CRED_V3: ::DWORD = 0x00000003; +pub const SCHANNEL_CRED_VERSION: ::DWORD = 0x00000004; +pub enum _HMAPPER {} +STRUCT!{struct SCHANNEL_CRED { + dwVersion: ::DWORD, + cCreds: ::DWORD, + paCred: *mut ::PCCERT_CONTEXT, + hRootStore: ::HCERTSTORE, + cMappers: ::DWORD, + aphMappers: *mut *mut _HMAPPER, + cSupportedAlgs: ::DWORD, + palgSupportedAlgs: *mut ::ALG_ID, + grbitEnabledProtocols: ::DWORD, + dwMinimumCipherStrength: ::DWORD, + dwMaximumCipherStrength: ::DWORD, + dwSessionLifespan: ::DWORD, + dwFlags: ::DWORD, + dwCredFormat: ::DWORD, +}} +pub type PSCHANNEL_CRED = *mut SCHANNEL_CRED; +pub const SCH_CRED_FORMAT_CERT_CONTEXT: ::DWORD = 0x00000000; +pub const SCH_CRED_FORMAT_CERT_HASH: ::DWORD = 0x00000001; +pub const SCH_CRED_FORMAT_CERT_HASH_STORE: ::DWORD = 0x00000002; +pub const SCH_CRED_MAX_STORE_NAME_SIZE: usize = 128; +pub const SCH_CRED_MAX_SUPPORTED_ALGS: ::DWORD = 256; +pub const SCH_CRED_MAX_SUPPORTED_CERTS: ::DWORD = 100; +STRUCT!{struct SCHANNEL_CERT_HASH { + dwLength: ::DWORD, + dwFlags: ::DWORD, + hProv: ::HCRYPTPROV, + ShaHash: [::BYTE; 20], +}} +pub type PSCHANNEL_CERT_HASH = *mut SCHANNEL_CERT_HASH; +STRUCT!{nodebug struct SCHANNEL_CERT_HASH_STORE { + dwLength: ::DWORD, + dwFlags: ::DWORD, + hProv: ::HCRYPTPROV, + ShaHash: [::BYTE; 20], + pwszStoreName: [::WCHAR; SCH_CRED_MAX_STORE_NAME_SIZE], +}} +pub type PSCHANNEL_CERT_HASH_STORE = *mut SCHANNEL_CERT_HASH_STORE; +pub const SCH_MACHINE_CERT_HASH: ::DWORD = 0x00000001; +pub const SCH_CRED_NO_SYSTEM_MAPPER: ::DWORD = 0x00000002; +pub const SCH_CRED_NO_SERVERNAME_CHECK: ::DWORD = 0x00000004; +pub const SCH_CRED_MANUAL_CRED_VALIDATION: ::DWORD = 0x00000008; +pub const SCH_CRED_NO_DEFAULT_CREDS: ::DWORD = 0x00000010; +pub const SCH_CRED_AUTO_CRED_VALIDATION: ::DWORD = 0x00000020; +pub const SCH_CRED_USE_DEFAULT_CREDS: ::DWORD = 0x00000040; +pub const SCH_CRED_DISABLE_RECONNECTS: ::DWORD = 0x00000080; +pub const SCH_CRED_REVOCATION_CHECK_END_CERT: ::DWORD = 0x00000100; +pub const SCH_CRED_REVOCATION_CHECK_CHAIN: ::DWORD = 0x00000200; +pub const SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT: ::DWORD = 0x00000400; +pub const SCH_CRED_IGNORE_NO_REVOCATION_CHECK: ::DWORD = 0x00000800; +pub const SCH_CRED_IGNORE_REVOCATION_OFFLINE: ::DWORD = 0x00001000; +pub const SCH_CRED_RESTRICTED_ROOTS: ::DWORD = 0x00002000; +pub const SCH_CRED_REVOCATION_CHECK_CACHE_ONLY: ::DWORD = 0x00004000; +pub const SCH_CRED_CACHE_ONLY_URL_RETRIEVAL: ::DWORD = 0x00008000; +pub const SCH_CRED_MEMORY_STORE_CERT: ::DWORD = 0x00010000; +pub const SCH_CRED_CACHE_ONLY_URL_RETRIEVAL_ON_CREATE: ::DWORD = 0x00020000; +pub const SCH_SEND_ROOT_CERT: ::DWORD = 0x00040000; +pub const SCH_CRED_SNI_CREDENTIAL: ::DWORD = 0x00080000; +pub const SCH_CRED_SNI_ENABLE_OCSP: ::DWORD = 0x00100000; +pub const SCH_SEND_AUX_RECORD: ::DWORD = 0x00200000; +pub const SCH_USE_STRONG_CRYPTO: ::DWORD = 0x00400000; +pub const SCHANNEL_RENEGOTIATE: ::DWORD = 0; +pub const SCHANNEL_SHUTDOWN: ::DWORD = 1; +pub const SCHANNEL_ALERT: ::DWORD = 2; +pub const SCHANNEL_SESSION: ::DWORD = 3; +STRUCT!{struct SCHANNEL_ALERT_TOKEN { + dwTokenType: ::DWORD, + dwAlertType: ::DWORD, + dwAlertNumber: ::DWORD, +}} +pub const TLS1_ALERT_WARNING: ::DWORD = 1; +pub const TLS1_ALERT_FATAL: ::DWORD = 2; +pub const TLS1_ALERT_CLOSE_NOTIFY: ::DWORD = 0; +pub const TLS1_ALERT_UNEXPECTED_MESSAGE: ::DWORD = 10; +pub const TLS1_ALERT_BAD_RECORD_MAC: ::DWORD = 20; +pub const TLS1_ALERT_DECRYPTION_FAILED: ::DWORD = 21; +pub const TLS1_ALERT_RECORD_OVERFLOW: ::DWORD = 22; +pub const TLS1_ALERT_DECOMPRESSION_FAIL: ::DWORD = 30; +pub const TLS1_ALERT_HANDSHAKE_FAILURE: ::DWORD = 40; +pub const TLS1_ALERT_BAD_CERTIFICATE: ::DWORD = 42; +pub const TLS1_ALERT_UNSUPPORTED_CERT: ::DWORD = 43; +pub const TLS1_ALERT_CERTIFICATE_REVOKED: ::DWORD = 44; +pub const TLS1_ALERT_CERTIFICATE_EXPIRED: ::DWORD = 45; +pub const TLS1_ALERT_CERTIFICATE_UNKNOWN: ::DWORD = 46; +pub const TLS1_ALERT_ILLEGAL_PARAMETER: ::DWORD = 47; +pub const TLS1_ALERT_UNKNOWN_CA: ::DWORD = 48; +pub const TLS1_ALERT_ACCESS_DENIED: ::DWORD = 49; +pub const TLS1_ALERT_DECODE_ERROR: ::DWORD = 50; +pub const TLS1_ALERT_DECRYPT_ERROR: ::DWORD = 51; +pub const TLS1_ALERT_EXPORT_RESTRICTION: ::DWORD = 60; +pub const TLS1_ALERT_PROTOCOL_VERSION: ::DWORD = 70; +pub const TLS1_ALERT_INSUFFIENT_SECURITY: ::DWORD = 71; +pub const TLS1_ALERT_INTERNAL_ERROR: ::DWORD = 80; +pub const TLS1_ALERT_USER_CANCELED: ::DWORD = 90; +pub const TLS1_ALERT_NO_RENEGOTIATION: ::DWORD = 100; +pub const TLS1_ALERT_UNSUPPORTED_EXT: ::DWORD = 110; +pub const TLS1_ALERT_NO_APP_PROTOCOL: ::DWORD = 120; +pub const SSL_SESSION_ENABLE_RECONNECTS: ::DWORD = 1; +pub const SSL_SESSION_DISABLE_RECONNECTS: ::DWORD = 2; +STRUCT!{struct SCHANNEL_SESSION_TOKEN { + dwTokenType: ::DWORD, + dwFlags: ::DWORD, +}} +STRUCT!{nodebug struct SCHANNEL_CLIENT_SIGNATURE { + cbLength: ::DWORD, + aiHash: ::ALG_ID, + cbHash: ::DWORD, + HashValue: [::BYTE; 36], + CertThumbprint: [::BYTE; 20], +}} +pub type PSCHANNEL_CLIENT_SIGNATURE = *mut SCHANNEL_CLIENT_SIGNATURE; +pub const SP_PROT_PCT1_SERVER: ::DWORD = 0x00000001; +pub const SP_PROT_PCT1_CLIENT: ::DWORD = 0x00000002; +pub const SP_PROT_PCT1: ::DWORD = SP_PROT_PCT1_SERVER | SP_PROT_PCT1_CLIENT; +pub const SP_PROT_SSL2_SERVER: ::DWORD = 0x00000004; +pub const SP_PROT_SSL2_CLIENT: ::DWORD = 0x00000008; +pub const SP_PROT_SSL2: ::DWORD = SP_PROT_SSL2_SERVER | SP_PROT_SSL2_CLIENT; +pub const SP_PROT_SSL3_SERVER: ::DWORD = 0x00000010; +pub const SP_PROT_SSL3_CLIENT: ::DWORD = 0x00000020; +pub const SP_PROT_SSL3: ::DWORD = SP_PROT_SSL3_SERVER | SP_PROT_SSL3_CLIENT; +pub const SP_PROT_TLS1_SERVER: ::DWORD = 0x00000040; +pub const SP_PROT_TLS1_CLIENT: ::DWORD = 0x00000080; +pub const SP_PROT_TLS1: ::DWORD = SP_PROT_TLS1_SERVER | SP_PROT_TLS1_CLIENT; +pub const SP_PROT_SSL3TLS1_CLIENTS: ::DWORD = SP_PROT_TLS1_CLIENT | SP_PROT_SSL3_CLIENT; +pub const SP_PROT_SSL3TLS1_SERVERS: ::DWORD = SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER; +pub const SP_PROT_SSL3TLS1: ::DWORD = SP_PROT_SSL3 | SP_PROT_TLS1; +pub const SP_PROT_UNI_SERVER: ::DWORD = 0x40000000; +pub const SP_PROT_UNI_CLIENT: ::DWORD = 0x80000000; +pub const SP_PROT_UNI: ::DWORD = SP_PROT_UNI_SERVER | SP_PROT_UNI_CLIENT; +pub const SP_PROT_ALL: ::DWORD = 0xffffffff; +pub const SP_PROT_NONE: ::DWORD = 0; +pub const SP_PROT_CLIENTS: ::DWORD = SP_PROT_PCT1_CLIENT | SP_PROT_SSL2_CLIENT + | SP_PROT_SSL3_CLIENT | SP_PROT_UNI_CLIENT | SP_PROT_TLS1_CLIENT; +pub const SP_PROT_SERVERS: ::DWORD = SP_PROT_PCT1_SERVER | SP_PROT_SSL2_SERVER + | SP_PROT_SSL3_SERVER | SP_PROT_UNI_SERVER | SP_PROT_TLS1_SERVER; +pub const SP_PROT_TLS1_0_SERVER: ::DWORD = SP_PROT_TLS1_SERVER; +pub const SP_PROT_TLS1_0_CLIENT: ::DWORD = SP_PROT_TLS1_CLIENT; +pub const SP_PROT_TLS1_0: ::DWORD = SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_0_CLIENT; +pub const SP_PROT_TLS1_1_SERVER: ::DWORD = 0x00000100; +pub const SP_PROT_TLS1_1_CLIENT: ::DWORD = 0x00000200; +pub const SP_PROT_TLS1_1: ::DWORD = SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_1_CLIENT; +pub const SP_PROT_TLS1_2_SERVER: ::DWORD = 0x00000400; +pub const SP_PROT_TLS1_2_CLIENT: ::DWORD = 0x00000800; +pub const SP_PROT_TLS1_2: ::DWORD = SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_2_CLIENT; +pub const SP_PROT_DTLS_SERVER: ::DWORD = 0x00010000; +pub const SP_PROT_DTLS_CLIENT: ::DWORD = 0x00020000; +pub const SP_PROT_DTLS: ::DWORD = SP_PROT_DTLS_SERVER | SP_PROT_DTLS_CLIENT; +pub const SP_PROT_DTLS1_0_SERVER: ::DWORD = SP_PROT_DTLS_SERVER; +pub const SP_PROT_DTLS1_0_CLIENT: ::DWORD = SP_PROT_DTLS_CLIENT; +pub const SP_PROT_DTLS1_0: ::DWORD = SP_PROT_DTLS1_0_SERVER | SP_PROT_DTLS1_0_CLIENT; +pub const SP_PROT_DTLS1_X_SERVER: ::DWORD = SP_PROT_DTLS1_0_SERVER; +pub const SP_PROT_DTLS1_X_CLIENT: ::DWORD = SP_PROT_DTLS1_0_CLIENT; +pub const SP_PROT_DTLS1_X: ::DWORD = SP_PROT_DTLS1_X_SERVER | SP_PROT_DTLS1_X_CLIENT; +pub const SP_PROT_TLS1_1PLUS_SERVER: ::DWORD = SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER; +pub const SP_PROT_TLS1_1PLUS_CLIENT: ::DWORD = SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT; +pub const SP_PROT_TLS1_1PLUS: ::DWORD = SP_PROT_TLS1_1PLUS_SERVER | SP_PROT_TLS1_1PLUS_CLIENT; +pub const SP_PROT_TLS1_X_SERVER: ::DWORD = SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_1_SERVER + | SP_PROT_TLS1_2_SERVER; +pub const SP_PROT_TLS1_X_CLIENT: ::DWORD = SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_1_CLIENT + | SP_PROT_TLS1_2_CLIENT; +pub const SP_PROT_TLS1_X: ::DWORD = SP_PROT_TLS1_X_SERVER | SP_PROT_TLS1_X_CLIENT; +pub const SP_PROT_SSL3TLS1_X_CLIENTS: ::DWORD = SP_PROT_TLS1_X_CLIENT | SP_PROT_SSL3_CLIENT; +pub const SP_PROT_SSL3TLS1_X_SERVERS: ::DWORD = SP_PROT_TLS1_X_SERVER | SP_PROT_SSL3_SERVER; +pub const SP_PROT_SSL3TLS1_X: ::DWORD = SP_PROT_SSL3 | SP_PROT_TLS1_X; +pub const SP_PROT_X_CLIENTS: ::DWORD = SP_PROT_CLIENTS | SP_PROT_TLS1_X_CLIENT + | SP_PROT_DTLS1_X_CLIENT; +pub const SP_PROT_X_SERVERS: ::DWORD = SP_PROT_SERVERS | SP_PROT_TLS1_X_SERVER + | SP_PROT_DTLS1_X_SERVER; +//716 +pub const SCHANNEL_SECRET_TYPE_CAPI: ::DWORD = 0x00000001; +pub const SCHANNEL_SECRET_PRIVKEY: ::DWORD = 0x00000002; +pub const SCH_CRED_X509_CERTCHAIN: ::DWORD = 0x00000001; +pub const SCH_CRED_X509_CAPI: ::DWORD = 0x00000002; +pub const SCH_CRED_CERT_CONTEXT: ::DWORD = 0x00000003; +//838 +pub const SSL_CRACK_CERTIFICATE_NAME: &'static str = "SslCrackCertificate"; +pub const SSL_FREE_CERTIFICATE_NAME: &'static str = "SslFreeCertificate"; diff --git a/third_party/rust/winapi/src/servprov.rs b/third_party/rust/winapi/src/servprov.rs new file mode 100644 index 000000000000..8b37ba8b6c09 --- /dev/null +++ b/third_party/rust/winapi/src/servprov.rs @@ -0,0 +1,11 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of servprov.h +pub type LPSERVICEPROVIDER = *mut IServiceProvider; +RIDL!( +interface IServiceProvider(IServiceProviderVtbl): IUnknown(IUnknownVtbl) { + fn QueryService( + &mut self, guidService: ::REFGUID, riid: ::REFIID, ppvObject: *mut *mut ::c_void + ) -> ::HRESULT +} +); diff --git a/third_party/rust/winapi/src/setupapi.rs b/third_party/rust/winapi/src/setupapi.rs new file mode 100644 index 000000000000..cf3149d79fd8 --- /dev/null +++ b/third_party/rust/winapi/src/setupapi.rs @@ -0,0 +1,1301 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Windows NT Setup and Device Installer services +pub const LINE_LEN: usize = 256; +pub const MAX_INF_STRING_LENGTH: usize = 4096; +pub const MAX_INF_SECTION_NAME_LENGTH: usize = 255; +pub const MAX_TITLE_LEN: usize = 60; +pub const MAX_INSTRUCTION_LEN: usize = 256; +pub const MAX_LABEL_LEN: usize = 30; +pub const MAX_SERVICE_NAME_LEN: usize = 256; +pub const MAX_SUBTITLE_LEN: usize = 256; +pub const SP_MAX_MACHINENAME_LENGTH: usize = ::MAX_PATH + 3; +pub type HINF = ::PVOID; +STRUCT!{struct INFCONTEXT { + Inf: ::PVOID, + CurrentInf: ::PVOID, + Section: ::UINT, + Line: ::UINT, +}} +pub type PINFCONTEXT = *mut INFCONTEXT; +STRUCT!{struct SP_INF_INFORMATION { + InfStyle: ::DWORD, + InfCount: ::DWORD, + VersionData: [::BYTE; ::ANYSIZE_ARRAY], +}} +pub type PSP_INF_INFORMATION = *mut SP_INF_INFORMATION; +STRUCT!{struct SP_ALTPLATFORM_INFO_V2 { + cbSize: ::DWORD, + Platform: ::DWORD, + MajorVersion: ::DWORD, + MinorVersion: ::DWORD, + ProcessorArchitecture: ::WORD, + Reserved: ::WORD, + FirstValidatedMajorVersion: ::DWORD, + FirstValidatedMinorVersion: ::DWORD, +}} +UNION!(SP_ALTPLATFORM_INFO_V2, Reserved, Flags, Flags_mut, ::WORD); +pub type PSP_ALTPLATFORM_INFO_V2 = *mut SP_ALTPLATFORM_INFO_V2; +STRUCT!{struct SP_ALTPLATFORM_INFO_V1 { + cbSize: ::DWORD, + Platform: ::DWORD, + MajorVersion: ::DWORD, + MinorVersion: ::DWORD, + ProcessorArchitecture: ::WORD, + Reserved: ::WORD, +}} +pub type PSP_ALTPLATFORM_INFO_V1 = *mut SP_ALTPLATFORM_INFO_V1; +pub type SP_ALTPLATFORM_INFO = SP_ALTPLATFORM_INFO_V2; +pub type PSP_ALTPLATFORM_INFO = PSP_ALTPLATFORM_INFO_V2; +pub const SP_ALTPLATFORM_FLAGS_VERSION_RANGE: ::WORD = 0x0001; +STRUCT!{nodebug struct SP_ORIGINAL_FILE_INFO_A { + cbSize: ::DWORD, + OriginalInfName: [::CHAR; ::MAX_PATH], + OriginalCatalogName: [::CHAR; ::MAX_PATH], +}} +pub type PSP_ORIGINAL_FILE_INFO_A = *mut SP_ORIGINAL_FILE_INFO_A; +STRUCT!{nodebug struct SP_ORIGINAL_FILE_INFO_W { + cbSize: ::DWORD, + OriginalInfName: [::WCHAR; ::MAX_PATH], + OriginalCatalogName: [::WCHAR; ::MAX_PATH], +}} +pub type PSP_ORIGINAL_FILE_INFO_W = *mut SP_ORIGINAL_FILE_INFO_W; +pub const INF_STYLE_NONE: ::DWORD = 0x00000000; +pub const INF_STYLE_OLDNT: ::DWORD = 0x00000001; +pub const INF_STYLE_WIN4: ::DWORD = 0x00000002; +pub const INF_STYLE_CACHE_ENABLE: ::DWORD = 0x00000010; +pub const INF_STYLE_CACHE_DISABLE: ::DWORD = 0x00000020; +pub const INF_STYLE_CACHE_IGNORE: ::DWORD = 0x00000040; +pub const DIRID_ABSOLUTE: ::DWORD = -1i32 as ::DWORD; +pub const DIRID_ABSOLUTE_16BIT: ::DWORD = 0xffff; +pub const DIRID_NULL: ::DWORD = 0; +pub const DIRID_SRCPATH: ::DWORD = 1; +pub const DIRID_WINDOWS: ::DWORD = 10; +pub const DIRID_SYSTEM: ::DWORD = 11; +pub const DIRID_DRIVERS: ::DWORD = 12; +pub const DIRID_IOSUBSYS: ::DWORD = DIRID_DRIVERS; +pub const DIRID_DRIVER_STORE: ::DWORD = 13; +pub const DIRID_INF: ::DWORD = 17; +pub const DIRID_HELP: ::DWORD = 18; +pub const DIRID_FONTS: ::DWORD = 20; +pub const DIRID_VIEWERS: ::DWORD = 21; +pub const DIRID_COLOR: ::DWORD = 23; +pub const DIRID_APPS: ::DWORD = 24; +pub const DIRID_SHARED: ::DWORD = 25; +pub const DIRID_BOOT: ::DWORD = 30; +pub const DIRID_SYSTEM16: ::DWORD = 50; +pub const DIRID_SPOOL: ::DWORD = 51; +pub const DIRID_SPOOLDRIVERS: ::DWORD = 52; +pub const DIRID_USERPROFILE: ::DWORD = 53; +pub const DIRID_LOADER: ::DWORD = 54; +pub const DIRID_PRINTPROCESSOR: ::DWORD = 55; +pub const DIRID_DEFAULT: ::DWORD = DIRID_SYSTEM; +pub const DIRID_COMMON_STARTMENU: ::DWORD = 16406; +pub const DIRID_COMMON_PROGRAMS: ::DWORD = 16407; +pub const DIRID_COMMON_STARTUP: ::DWORD = 16408; +pub const DIRID_COMMON_DESKTOPDIRECTORY: ::DWORD = 16409; +pub const DIRID_COMMON_FAVORITES: ::DWORD = 16415; +pub const DIRID_COMMON_APPDATA: ::DWORD = 16419; +pub const DIRID_PROGRAM_FILES: ::DWORD = 16422; +pub const DIRID_SYSTEM_X86: ::DWORD = 16425; +pub const DIRID_PROGRAM_FILES_X86: ::DWORD = 16426; +pub const DIRID_PROGRAM_FILES_COMMON: ::DWORD = 16427; +pub const DIRID_PROGRAM_FILES_COMMONX86: ::DWORD = 16428; +pub const DIRID_COMMON_TEMPLATES: ::DWORD = 16429; +pub const DIRID_COMMON_DOCUMENTS: ::DWORD = 16430; +pub const DIRID_USER: ::DWORD = 0x8000; +pub type PSP_FILE_CALLBACK_A = Option ::UINT>; +pub type PSP_FILE_CALLBACK_W = Option ::UINT>; +pub const SPFILENOTIFY_STARTQUEUE: ::UINT = 0x00000001; +pub const SPFILENOTIFY_ENDQUEUE: ::UINT = 0x00000002; +pub const SPFILENOTIFY_STARTSUBQUEUE: ::UINT = 0x00000003; +pub const SPFILENOTIFY_ENDSUBQUEUE: ::UINT = 0x00000004; +pub const SPFILENOTIFY_STARTDELETE: ::UINT = 0x00000005; +pub const SPFILENOTIFY_ENDDELETE: ::UINT = 0x00000006; +pub const SPFILENOTIFY_DELETEERROR: ::UINT = 0x00000007; +pub const SPFILENOTIFY_STARTRENAME: ::UINT = 0x00000008; +pub const SPFILENOTIFY_ENDRENAME: ::UINT = 0x00000009; +pub const SPFILENOTIFY_RENAMEERROR: ::UINT = 0x0000000a; +pub const SPFILENOTIFY_STARTCOPY: ::UINT = 0x0000000b; +pub const SPFILENOTIFY_ENDCOPY: ::UINT = 0x0000000c; +pub const SPFILENOTIFY_COPYERROR: ::UINT = 0x0000000d; +pub const SPFILENOTIFY_NEEDMEDIA: ::UINT = 0x0000000e; +pub const SPFILENOTIFY_QUEUESCAN: ::UINT = 0x0000000f; +pub const SPFILENOTIFY_CABINETINFO: ::UINT = 0x00000010; +pub const SPFILENOTIFY_FILEINCABINET: ::UINT = 0x00000011; +pub const SPFILENOTIFY_NEEDNEWCABINET: ::UINT = 0x00000012; +pub const SPFILENOTIFY_FILEEXTRACTED: ::UINT = 0x00000013; +pub const SPFILENOTIFY_FILEOPDELAYED: ::UINT = 0x00000014; +pub const SPFILENOTIFY_STARTBACKUP: ::UINT = 0x00000015; +pub const SPFILENOTIFY_BACKUPERROR: ::UINT = 0x00000016; +pub const SPFILENOTIFY_ENDBACKUP: ::UINT = 0x00000017; +pub const SPFILENOTIFY_QUEUESCAN_EX: ::UINT = 0x00000018; +pub const SPFILENOTIFY_STARTREGISTRATION: ::UINT = 0x00000019; +pub const SPFILENOTIFY_ENDREGISTRATION: ::UINT = 0x00000020; +pub const SPFILENOTIFY_QUEUESCAN_SIGNERINFO: ::UINT = 0x00000040; +pub const SPFILENOTIFY_LANGMISMATCH: ::UINT = 0x00010000; +pub const SPFILENOTIFY_TARGETEXISTS: ::UINT = 0x00020000; +pub const SPFILENOTIFY_TARGETNEWER: ::UINT = 0x00040000; +pub const FILEOP_COPY: ::UINT = 0; +pub const FILEOP_RENAME: ::UINT = 1; +pub const FILEOP_DELETE: ::UINT = 2; +pub const FILEOP_BACKUP: ::UINT = 3; +pub const FILEOP_ABORT: ::UINT = 0; +pub const FILEOP_DOIT: ::UINT = 1; +pub const FILEOP_SKIP: ::UINT = 2; +pub const FILEOP_RETRY: ::UINT = FILEOP_DOIT; +pub const FILEOP_NEWPATH: ::UINT = 4; +pub const COPYFLG_WARN_IF_SKIP: ::UINT = 0x00000001; +pub const COPYFLG_NOSKIP: ::UINT = 0x00000002; +pub const COPYFLG_NOVERSIONCHECK: ::UINT = 0x00000004; +pub const COPYFLG_FORCE_FILE_IN_USE: ::UINT = 0x00000008; +pub const COPYFLG_NO_OVERWRITE: ::UINT = 0x00000010; +pub const COPYFLG_NO_VERSION_DIALOG: ::UINT = 0x00000020; +pub const COPYFLG_OVERWRITE_OLDER_ONLY: ::UINT = 0x00000040; +pub const COPYFLG_PROTECTED_WINDOWS_DRIVER_FILE: ::UINT = 0x00000100; +pub const COPYFLG_REPLACEONLY: ::UINT = 0x00000400; +pub const COPYFLG_NODECOMP: ::UINT = 0x00000800; +pub const COPYFLG_REPLACE_BOOT_FILE: ::UINT = 0x00001000; +pub const COPYFLG_NOPRUNE: ::UINT = 0x00002000; +pub const COPYFLG_IN_USE_TRY_RENAME: ::UINT = 0x00004000; +pub const DELFLG_IN_USE: ::UINT = 0x00000001; +pub const DELFLG_IN_USE1: ::UINT = 0x00010000; +STRUCT!{struct FILEPATHS_A { + Target: ::PCSTR, + Source: ::PCSTR, + Win32Error: ::UINT, + Flags: ::DWORD, +}} +pub type PFILEPATHS_A = *mut FILEPATHS_A; +STRUCT!{struct FILEPATHS_W { + Target: ::PCWSTR, + Source: ::PCWSTR, + Win32Error: ::UINT, + Flags: ::DWORD, +}} +pub type PFILEPATHS_W = *mut FILEPATHS_W; +STRUCT!{struct FILEPATHS_SIGNERINFO_A { + Target: ::PCSTR, + Source: ::PCSTR, + Win32Error: ::UINT, + Flags: ::DWORD, + DigitalSigner: ::PCSTR, + Version: ::PCSTR, + CatalogFile: ::PCSTR, +}} +pub type PFILEPATHS_SIGNERINFO_A = *mut FILEPATHS_SIGNERINFO_A; +STRUCT!{struct FILEPATHS_SIGNERINFO_W { + Target: ::PCWSTR, + Source: ::PCWSTR, + Win32Error: ::UINT, + Flags: ::DWORD, + DigitalSigner: ::PCWSTR, + Version: ::PCWSTR, + CatalogFile: ::PCWSTR, +}} +pub type PFILEPATHS_SIGNERINFO_W = *mut FILEPATHS_SIGNERINFO_W; +STRUCT!{struct SOURCE_MEDIA_A { + Reserved: ::PCSTR, + Tagfile: ::PCSTR, + Description: ::PCSTR, + SourcePath: ::PCSTR, + SourceFile: ::PCSTR, + Flags: ::DWORD, +}} +pub type PSOURCE_MEDIA_A = *mut SOURCE_MEDIA_A; +STRUCT!{struct SOURCE_MEDIA_W { + Reserved: ::PCWSTR, + Tagfile: ::PCWSTR, + Description: ::PCWSTR, + SourcePath: ::PCWSTR, + SourceFile: ::PCWSTR, + Flags: ::DWORD, +}} +pub type PSOURCE_MEDIA_W = *mut SOURCE_MEDIA_W; +STRUCT!{struct CABINET_INFO_A { + CabinetPath: ::PCSTR, + CabinetFile: ::PCSTR, + DiskName: ::PCSTR, + SetId: ::USHORT, + CabinetNumber: ::USHORT, +}} +pub type PCABINET_INFO_A = *mut CABINET_INFO_A; +STRUCT!{struct CABINET_INFO_W { + CabinetPath: ::PCWSTR, + CabinetFile: ::PCWSTR, + DiskName: ::PCWSTR, + SetId: ::USHORT, + CabinetNumber: ::USHORT, +}} +pub type PCABINET_INFO_W = *mut CABINET_INFO_W; +STRUCT!{nodebug struct FILE_IN_CABINET_INFO_A { + NameInCabinet: ::PCSTR, + FileSize: ::DWORD, + Win32Error: ::DWORD, + DosDate: ::WORD, + DosTime: ::WORD, + DosAttribs: ::WORD, + FullTargetName: [::CHAR; ::MAX_PATH], +}} +pub type PFILE_IN_CABINET_INFO_A = *mut FILE_IN_CABINET_INFO_A; +STRUCT!{nodebug struct FILE_IN_CABINET_INFO_W { + NameInCabinet: ::PCWSTR, + FileSize: ::DWORD, + Win32Error: ::DWORD, + DosDate: ::WORD, + DosTime: ::WORD, + DosAttribs: ::WORD, + FullTargetName: [::WCHAR; ::MAX_PATH], +}} +pub type PFILE_IN_CABINET_INFO_W = *mut FILE_IN_CABINET_INFO_W; +STRUCT!{struct SP_REGISTER_CONTROL_STATUSA { + cbSize: ::DWORD, + FileName: ::PCSTR, + Win32Error: ::DWORD, + FailureCode: ::DWORD, +}} +pub type PSP_REGISTER_CONTROL_STATUSA = *mut SP_REGISTER_CONTROL_STATUSA; +STRUCT!{struct SP_REGISTER_CONTROL_STATUSW { + cbSize: ::DWORD, + FileName: ::PCWSTR, + Win32Error: ::DWORD, + FailureCode: ::DWORD, +}} +pub type PSP_REGISTER_CONTROL_STATUSW = *mut SP_REGISTER_CONTROL_STATUSW; +pub const SPREG_SUCCESS: ::DWORD = 0x00000000; +pub const SPREG_LOADLIBRARY: ::DWORD = 0x00000001; +pub const SPREG_GETPROCADDR: ::DWORD = 0x00000002; +pub const SPREG_REGSVR: ::DWORD = 0x00000003; +pub const SPREG_DLLINSTALL: ::DWORD = 0x00000004; +pub const SPREG_TIMEOUT: ::DWORD = 0x00000005; +pub const SPREG_UNKNOWN: ::DWORD = 0xFFFFFFFF; +pub type HSPFILEQ = ::PVOID; +STRUCT!{struct SP_FILE_COPY_PARAMS_A { + cbSize: ::DWORD, + QueueHandle: HSPFILEQ, + SourceRootPath: ::PCSTR, + SourcePath: ::PCSTR, + SourceFilename: ::PCSTR, + SourceDescription: ::PCSTR, + SourceTagfile: ::PCSTR, + TargetDirectory: ::PCSTR, + TargetFilename: ::PCSTR, + CopyStyle: ::DWORD, + LayoutInf: HINF, + SecurityDescriptor: ::PCSTR, +}} +pub type PSP_FILE_COPY_PARAMS_A = *mut SP_FILE_COPY_PARAMS_A; +STRUCT!{struct SP_FILE_COPY_PARAMS_W { + cbSize: ::DWORD, + QueueHandle: HSPFILEQ, + SourceRootPath: ::PCWSTR, + SourcePath: ::PCWSTR, + SourceFilename: ::PCWSTR, + SourceDescription: ::PCWSTR, + SourceTagfile: ::PCWSTR, + TargetDirectory: ::PCWSTR, + TargetFilename: ::PCWSTR, + CopyStyle: ::DWORD, + LayoutInf: HINF, + SecurityDescriptor: ::PCWSTR, +}} +pub type PSP_FILE_COPY_PARAMS_W = *mut SP_FILE_COPY_PARAMS_W; +pub type HDSKSPC = ::PVOID; +pub type HDEVINFO = ::PVOID; +STRUCT!{struct SP_DEVINFO_DATA { + cbSize: ::DWORD, + ClassGuid: ::GUID, + DevInst: ::DWORD, + Reserved: ::ULONG_PTR, +}} +pub type PSP_DEVINFO_DATA = *mut SP_DEVINFO_DATA; +STRUCT!{struct SP_DEVICE_INTERFACE_DATA { + cbSize: ::DWORD, + InterfaceClassGuid: ::GUID, + Flags: ::DWORD, + Reserved: ::ULONG_PTR, +}} +pub type PSP_DEVICE_INTERFACE_DATA = *mut SP_DEVICE_INTERFACE_DATA; +pub const SPINT_ACTIVE: ::DWORD = 0x00000001; +pub const SPINT_DEFAULT: ::DWORD = 0x00000002; +pub const SPINT_REMOVED: ::DWORD = 0x00000004; +pub type SP_INTERFACE_DEVICE_DATA = SP_DEVICE_INTERFACE_DATA; +pub type PSP_INTERFACE_DEVICE_DATA = PSP_DEVICE_INTERFACE_DATA; +pub const SPID_ACTIVE: ::DWORD = SPINT_ACTIVE; +pub const SPID_DEFAULT: ::DWORD = SPINT_DEFAULT; +pub const SPID_REMOVED: ::DWORD = SPINT_REMOVED; +STRUCT!{struct SP_DEVICE_INTERFACE_DETAIL_DATA_A { + cbSize: ::DWORD, + DevicePath: [::CHAR; ::ANYSIZE_ARRAY], +}} +pub type PSP_DEVICE_INTERFACE_DETAIL_DATA_A = *mut SP_DEVICE_INTERFACE_DETAIL_DATA_A; +STRUCT!{struct SP_DEVICE_INTERFACE_DETAIL_DATA_W { + cbSize: ::DWORD, + DevicePath: [::WCHAR; ::ANYSIZE_ARRAY], +}} +pub type PSP_DEVICE_INTERFACE_DETAIL_DATA_W = *mut SP_DEVICE_INTERFACE_DETAIL_DATA_W; +STRUCT!{nodebug struct SP_DEVINFO_LIST_DETAIL_DATA_A { + cbSize: ::DWORD, + ClassGuid: ::GUID, + RemoteMachineHandle: ::HANDLE, + RemoteMachineName: [::CHAR; SP_MAX_MACHINENAME_LENGTH], +}} +pub type PSP_DEVINFO_LIST_DETAIL_DATA_A = *mut SP_DEVINFO_LIST_DETAIL_DATA_A; +STRUCT!{nodebug struct SP_DEVINFO_LIST_DETAIL_DATA_W { + cbSize: ::DWORD, + ClassGuid: ::GUID, + RemoteMachineHandle: ::HANDLE, + RemoteMachineName: [::WCHAR; SP_MAX_MACHINENAME_LENGTH], +}} +pub type PSP_DEVINFO_LIST_DETAIL_DATA_W = *mut SP_DEVINFO_LIST_DETAIL_DATA_W; +pub const DIF_SELECTDEVICE: DI_FUNCTION = 0x00000001; +pub const DIF_INSTALLDEVICE: DI_FUNCTION = 0x00000002; +pub const DIF_ASSIGNRESOURCES: DI_FUNCTION = 0x00000003; +pub const DIF_PROPERTIES: DI_FUNCTION = 0x00000004; +pub const DIF_REMOVE: DI_FUNCTION = 0x00000005; +pub const DIF_FIRSTTIMESETUP: DI_FUNCTION = 0x00000006; +pub const DIF_FOUNDDEVICE: DI_FUNCTION = 0x00000007; +pub const DIF_SELECTCLASSDRIVERS: DI_FUNCTION = 0x00000008; +pub const DIF_VALIDATECLASSDRIVERS: DI_FUNCTION = 0x00000009; +pub const DIF_INSTALLCLASSDRIVERS: DI_FUNCTION = 0x0000000A; +pub const DIF_CALCDISKSPACE: DI_FUNCTION = 0x0000000B; +pub const DIF_DESTROYPRIVATEDATA: DI_FUNCTION = 0x0000000C; +pub const DIF_VALIDATEDRIVER: DI_FUNCTION = 0x0000000D; +pub const DIF_DETECT: DI_FUNCTION = 0x0000000F; +pub const DIF_INSTALLWIZARD: DI_FUNCTION = 0x00000010; +pub const DIF_DESTROYWIZARDDATA: DI_FUNCTION = 0x00000011; +pub const DIF_PROPERTYCHANGE: DI_FUNCTION = 0x00000012; +pub const DIF_ENABLECLASS: DI_FUNCTION = 0x00000013; +pub const DIF_DETECTVERIFY: DI_FUNCTION = 0x00000014; +pub const DIF_INSTALLDEVICEFILES: DI_FUNCTION = 0x00000015; +pub const DIF_UNREMOVE: DI_FUNCTION = 0x00000016; +pub const DIF_SELECTBESTCOMPATDRV: DI_FUNCTION = 0x00000017; +pub const DIF_ALLOW_INSTALL: DI_FUNCTION = 0x00000018; +pub const DIF_REGISTERDEVICE: DI_FUNCTION = 0x00000019; +pub const DIF_NEWDEVICEWIZARD_PRESELECT: DI_FUNCTION = 0x0000001A; +pub const DIF_NEWDEVICEWIZARD_SELECT: DI_FUNCTION = 0x0000001B; +pub const DIF_NEWDEVICEWIZARD_PREANALYZE: DI_FUNCTION = 0x0000001C; +pub const DIF_NEWDEVICEWIZARD_POSTANALYZE: DI_FUNCTION = 0x0000001D; +pub const DIF_NEWDEVICEWIZARD_FINISHINSTALL: DI_FUNCTION = 0x0000001E; +pub const DIF_UNUSED1: DI_FUNCTION = 0x0000001F; +pub const DIF_INSTALLINTERFACES: DI_FUNCTION = 0x00000020; +pub const DIF_DETECTCANCEL: DI_FUNCTION = 0x00000021; +pub const DIF_REGISTER_COINSTALLERS: DI_FUNCTION = 0x00000022; +pub const DIF_ADDPROPERTYPAGE_ADVANCED: DI_FUNCTION = 0x00000023; +pub const DIF_ADDPROPERTYPAGE_BASIC: DI_FUNCTION = 0x00000024; +pub const DIF_RESERVED1: DI_FUNCTION = 0x00000025; +pub const DIF_TROUBLESHOOTER: DI_FUNCTION = 0x00000026; +pub const DIF_POWERMESSAGEWAKE: DI_FUNCTION = 0x00000027; +pub const DIF_ADDREMOTEPROPERTYPAGE_ADVANCED: DI_FUNCTION = 0x00000028; +pub const DIF_UPDATEDRIVER_UI: DI_FUNCTION = 0x00000029; +pub const DIF_FINISHINSTALL_ACTION: DI_FUNCTION = 0x0000002A; +pub const DIF_RESERVED2: DI_FUNCTION = 0x00000030; +pub const DIF_MOVEDEVICE: DI_FUNCTION = 0x0000000E; +pub type DI_FUNCTION = ::UINT; +STRUCT!{nodebug struct SP_DEVINSTALL_PARAMS_A { + cbSize: ::DWORD, + Flags: ::DWORD, + FlagsEx: ::DWORD, + hwndParent: ::HWND, + InstallMsgHandler: PSP_FILE_CALLBACK_A, + InstallMsgHandlerContext: ::PVOID, + FileQueue: HSPFILEQ, + ClassInstallReserved: ::ULONG_PTR, + Reserved: ::DWORD, + DriverPath: [::CHAR; ::MAX_PATH], +}} +pub type PSP_DEVINSTALL_PARAMS_A = *mut SP_DEVINSTALL_PARAMS_A; +STRUCT!{nodebug struct SP_DEVINSTALL_PARAMS_W { + cbSize: ::DWORD, + Flags: ::DWORD, + FlagsEx: ::DWORD, + hwndParent: ::HWND, + InstallMsgHandler: PSP_FILE_CALLBACK_W, + InstallMsgHandlerContext: ::PVOID, + FileQueue: HSPFILEQ, + ClassInstallReserved: ::ULONG_PTR, + Reserved: ::DWORD, + DriverPath: [::WCHAR; ::MAX_PATH], +}} +pub type PSP_DEVINSTALL_PARAMS_W = *mut SP_DEVINSTALL_PARAMS_W; +pub const DI_SHOWOEM: ::DWORD = 0x00000001; +pub const DI_SHOWCOMPAT: ::DWORD = 0x00000002; +pub const DI_SHOWCLASS: ::DWORD = 0x00000004; +pub const DI_SHOWALL: ::DWORD = 0x00000007; +pub const DI_NOVCP: ::DWORD = 0x00000008; +pub const DI_DIDCOMPAT: ::DWORD = 0x00000010; +pub const DI_DIDCLASS: ::DWORD = 0x00000020; +pub const DI_AUTOASSIGNRES: ::DWORD = 0x00000040; +pub const DI_NEEDRESTART: ::DWORD = 0x00000080; +pub const DI_NEEDREBOOT: ::DWORD = 0x00000100; +pub const DI_NOBROWSE: ::DWORD = 0x00000200; +pub const DI_MULTMFGS: ::DWORD = 0x00000400; +pub const DI_DISABLED: ::DWORD = 0x00000800; +pub const DI_GENERALPAGE_ADDED: ::DWORD = 0x00001000; +pub const DI_RESOURCEPAGE_ADDED: ::DWORD = 0x00002000; +pub const DI_PROPERTIES_CHANGE: ::DWORD = 0x00004000; +pub const DI_INF_IS_SORTED: ::DWORD = 0x00008000; +pub const DI_ENUMSINGLEINF: ::DWORD = 0x00010000; +pub const DI_DONOTCALLCONFIGMG: ::DWORD = 0x00020000; +pub const DI_INSTALLDISABLED: ::DWORD = 0x00040000; +pub const DI_COMPAT_FROM_CLASS: ::DWORD = 0x00080000; +pub const DI_CLASSINSTALLPARAMS: ::DWORD = 0x00100000; +pub const DI_NODI_DEFAULTACTION: ::DWORD = 0x00200000; +pub const DI_QUIETINSTALL: ::DWORD = 0x00800000; +pub const DI_NOFILECOPY: ::DWORD = 0x01000000; +pub const DI_FORCECOPY: ::DWORD = 0x02000000; +pub const DI_DRIVERPAGE_ADDED: ::DWORD = 0x04000000; +pub const DI_USECI_SELECTSTRINGS: ::DWORD = 0x08000000; +pub const DI_OVERRIDE_INFFLAGS: ::DWORD = 0x10000000; +pub const DI_PROPS_NOCHANGEUSAGE: ::DWORD = 0x20000000; +pub const DI_NOSELECTICONS: ::DWORD = 0x40000000; +pub const DI_NOWRITE_IDS: ::DWORD = 0x80000000; +pub const DI_FLAGSEX_RESERVED2: ::DWORD = 0x00000001; +pub const DI_FLAGSEX_RESERVED3: ::DWORD = 0x00000002; +pub const DI_FLAGSEX_CI_FAILED: ::DWORD = 0x00000004; +pub const DI_FLAGSEX_FINISHINSTALL_ACTION: ::DWORD = 0x00000008; +pub const DI_FLAGSEX_DIDINFOLIST: ::DWORD = 0x00000010; +pub const DI_FLAGSEX_DIDCOMPATINFO: ::DWORD = 0x00000020; +pub const DI_FLAGSEX_FILTERCLASSES: ::DWORD = 0x00000040; +pub const DI_FLAGSEX_SETFAILEDINSTALL: ::DWORD = 0x00000080; +pub const DI_FLAGSEX_DEVICECHANGE: ::DWORD = 0x00000100; +pub const DI_FLAGSEX_ALWAYSWRITEIDS: ::DWORD = 0x00000200; +pub const DI_FLAGSEX_PROPCHANGE_PENDING: ::DWORD = 0x00000400; +pub const DI_FLAGSEX_ALLOWEXCLUDEDDRVS: ::DWORD = 0x00000800; +pub const DI_FLAGSEX_NOUIONQUERYREMOVE: ::DWORD = 0x00001000; +pub const DI_FLAGSEX_USECLASSFORCOMPAT: ::DWORD = 0x00002000; +pub const DI_FLAGSEX_RESERVED4: ::DWORD = 0x00004000; +pub const DI_FLAGSEX_NO_DRVREG_MODIFY: ::DWORD = 0x00008000; +pub const DI_FLAGSEX_IN_SYSTEM_SETUP: ::DWORD = 0x00010000; +pub const DI_FLAGSEX_INET_DRIVER: ::DWORD = 0x00020000; +pub const DI_FLAGSEX_APPENDDRIVERLIST: ::DWORD = 0x00040000; +pub const DI_FLAGSEX_PREINSTALLBACKUP: ::DWORD = 0x00080000; +pub const DI_FLAGSEX_BACKUPONREPLACE: ::DWORD = 0x00100000; +pub const DI_FLAGSEX_DRIVERLIST_FROM_URL: ::DWORD = 0x00200000; +pub const DI_FLAGSEX_RESERVED1: ::DWORD = 0x00400000; +pub const DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS: ::DWORD = 0x00800000; +pub const DI_FLAGSEX_POWERPAGE_ADDED: ::DWORD = 0x01000000; +pub const DI_FLAGSEX_FILTERSIMILARDRIVERS: ::DWORD = 0x02000000; +pub const DI_FLAGSEX_INSTALLEDDRIVER: ::DWORD = 0x04000000; +pub const DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE: ::DWORD = 0x08000000; +pub const DI_FLAGSEX_ALTPLATFORM_DRVSEARCH: ::DWORD = 0x10000000; +pub const DI_FLAGSEX_RESTART_DEVICE_ONLY: ::DWORD = 0x20000000; +pub const DI_FLAGSEX_RECURSIVESEARCH: ::DWORD = 0x40000000; +pub const DI_FLAGSEX_SEARCH_PUBLISHED_INFS: ::DWORD = 0x80000000; +STRUCT!{struct SP_CLASSINSTALL_HEADER { + cbSize: ::DWORD, + InstallFunction: DI_FUNCTION, +}} +pub type PSP_CLASSINSTALL_HEADER = *mut SP_CLASSINSTALL_HEADER; +STRUCT!{struct SP_ENABLECLASS_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + ClassGuid: ::GUID, + EnableMessage: ::DWORD, +}} +pub type PSP_ENABLECLASS_PARAMS = *mut SP_ENABLECLASS_PARAMS; +pub const ENABLECLASS_QUERY: ::DWORD = 0; +pub const ENABLECLASS_SUCCESS: ::DWORD = 1; +pub const ENABLECLASS_FAILURE: ::DWORD = 2; +pub const DICS_ENABLE: ::DWORD = 0x00000001; +pub const DICS_DISABLE: ::DWORD = 0x00000002; +pub const DICS_PROPCHANGE: ::DWORD = 0x00000003; +pub const DICS_START: ::DWORD = 0x00000004; +pub const DICS_STOP: ::DWORD = 0x00000005; +pub const DICS_FLAG_GLOBAL: ::DWORD = 0x00000001; +pub const DICS_FLAG_CONFIGSPECIFIC: ::DWORD = 0x00000002; +pub const DICS_FLAG_CONFIGGENERAL: ::DWORD = 0x00000004; +STRUCT!{struct SP_PROPCHANGE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + StateChange: ::DWORD, + Scope: ::DWORD, + HwProfile: ::DWORD, +}} +pub type PSP_PROPCHANGE_PARAMS = *mut SP_PROPCHANGE_PARAMS; +STRUCT!{struct SP_REMOVEDEVICE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Scope: ::DWORD, + HwProfile: ::DWORD, +}} +pub type PSP_REMOVEDEVICE_PARAMS = *mut SP_REMOVEDEVICE_PARAMS; +pub const DI_REMOVEDEVICE_GLOBAL: ::DWORD = 0x00000001; +pub const DI_REMOVEDEVICE_CONFIGSPECIFIC: ::DWORD = 0x00000002; +STRUCT!{struct SP_UNREMOVEDEVICE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Scope: ::DWORD, + HwProfile: ::DWORD, +}} +pub type PSP_UNREMOVEDEVICE_PARAMS = *mut SP_UNREMOVEDEVICE_PARAMS; +pub const DI_UNREMOVEDEVICE_CONFIGSPECIFIC: ::DWORD = 0x00000002; +STRUCT!{nodebug struct SP_SELECTDEVICE_PARAMS_A { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Title: [::CHAR; MAX_TITLE_LEN], + Instructions: [::CHAR; MAX_INSTRUCTION_LEN], + ListLabel: [::CHAR; MAX_LABEL_LEN], + SubTitle: [::CHAR; MAX_SUBTITLE_LEN], + Reserved: [::BYTE; 2], +}} +pub type PSP_SELECTDEVICE_PARAMS_A = *mut SP_SELECTDEVICE_PARAMS_A; +STRUCT!{nodebug struct SP_SELECTDEVICE_PARAMS_W { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Title: [::WCHAR; MAX_TITLE_LEN], + Instructions: [::WCHAR; MAX_INSTRUCTION_LEN], + ListLabel: [::WCHAR; MAX_LABEL_LEN], + SubTitle: [::WCHAR; MAX_SUBTITLE_LEN], +}} +pub type PSP_SELECTDEVICE_PARAMS_W = *mut SP_SELECTDEVICE_PARAMS_W; +pub type PDETECT_PROGRESS_NOTIFY = Option ::BOOL>; +STRUCT!{nodebug struct SP_DETECTDEVICE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + DetectProgressNotify: PDETECT_PROGRESS_NOTIFY, + ProgressNotifyParam: ::PVOID, +}} +pub type PSP_DETECTDEVICE_PARAMS = *mut SP_DETECTDEVICE_PARAMS; +pub const MAX_INSTALLWIZARD_DYNAPAGES: usize = 20; +STRUCT!{struct SP_INSTALLWIZARD_DATA { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Flags: ::DWORD, + DynamicPages: [::HPROPSHEETPAGE; MAX_INSTALLWIZARD_DYNAPAGES], + NumDynamicPages: ::DWORD, + DynamicPageFlags: ::DWORD, + PrivateFlags: ::DWORD, + PrivateData: ::LPARAM, + hwndWizardDlg: ::HWND, +}} +pub type PSP_INSTALLWIZARD_DATA = *mut SP_INSTALLWIZARD_DATA; +pub const NDW_INSTALLFLAG_DIDFACTDEFS: ::DWORD = 0x00000001; +pub const NDW_INSTALLFLAG_HARDWAREALLREADYIN: ::DWORD = 0x00000002; +pub const NDW_INSTALLFLAG_NEEDRESTART: ::DWORD = DI_NEEDRESTART; +pub const NDW_INSTALLFLAG_NEEDREBOOT: ::DWORD = DI_NEEDREBOOT; +pub const NDW_INSTALLFLAG_NEEDSHUTDOWN: ::DWORD = 0x00000200; +pub const NDW_INSTALLFLAG_EXPRESSINTRO: ::DWORD = 0x00000400; +pub const NDW_INSTALLFLAG_SKIPISDEVINSTALLED: ::DWORD = 0x00000800; +pub const NDW_INSTALLFLAG_NODETECTEDDEVS: ::DWORD = 0x00001000; +pub const NDW_INSTALLFLAG_INSTALLSPECIFIC: ::DWORD = 0x00002000; +pub const NDW_INSTALLFLAG_SKIPCLASSLIST: ::DWORD = 0x00004000; +pub const NDW_INSTALLFLAG_CI_PICKED_OEM: ::DWORD = 0x00008000; +pub const NDW_INSTALLFLAG_PCMCIAMODE: ::DWORD = 0x00010000; +pub const NDW_INSTALLFLAG_PCMCIADEVICE: ::DWORD = 0x00020000; +pub const NDW_INSTALLFLAG_USERCANCEL: ::DWORD = 0x00040000; +pub const NDW_INSTALLFLAG_KNOWNCLASS: ::DWORD = 0x00080000; +pub const DYNAWIZ_FLAG_PAGESADDED: ::DWORD = 0x00000001; +pub const DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT: ::DWORD = 0x00000008; +pub const DYNAWIZ_FLAG_INSTALLDET_NEXT: ::DWORD = 0x00000002; +pub const DYNAWIZ_FLAG_INSTALLDET_PREV: ::DWORD = 0x00000004; +pub const MIN_IDD_DYNAWIZ_RESOURCE_ID: ::c_int = 10000; +pub const MAX_IDD_DYNAWIZ_RESOURCE_ID: ::c_int = 11000; +pub const IDD_DYNAWIZ_FIRSTPAGE: ::c_int = 10000; +pub const IDD_DYNAWIZ_SELECT_PREVPAGE: ::c_int = 10001; +pub const IDD_DYNAWIZ_SELECT_NEXTPAGE: ::c_int = 10002; +pub const IDD_DYNAWIZ_ANALYZE_PREVPAGE: ::c_int = 10003; +pub const IDD_DYNAWIZ_ANALYZE_NEXTPAGE: ::c_int = 10004; +pub const IDD_DYNAWIZ_SELECTDEV_PAGE: ::c_int = 10009; +pub const IDD_DYNAWIZ_ANALYZEDEV_PAGE: ::c_int = 10010; +pub const IDD_DYNAWIZ_INSTALLDETECTEDDEVS_PAGE: ::c_int = 10011; +pub const IDD_DYNAWIZ_SELECTCLASS_PAGE: ::c_int = 10012; +pub const IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE: ::c_int = 10006; +pub const IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE: ::c_int = 10007; +pub const IDD_DYNAWIZ_INSTALLDETECTED_NODEVS: ::c_int = 10008; +STRUCT!{struct SP_NEWDEVICEWIZARD_DATA { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Flags: ::DWORD, + DynamicPages: [::HPROPSHEETPAGE; MAX_INSTALLWIZARD_DYNAPAGES], + NumDynamicPages: ::DWORD, + hwndWizardDlg: ::HWND, +}} +pub type PSP_NEWDEVICEWIZARD_DATA = *mut SP_NEWDEVICEWIZARD_DATA; +pub type SP_ADDPROPERTYPAGE_DATA = SP_NEWDEVICEWIZARD_DATA; +pub type PSP_ADDPROPERTYPAGE_DATA = PSP_NEWDEVICEWIZARD_DATA; +STRUCT!{nodebug struct SP_TROUBLESHOOTER_PARAMS_A { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + ChmFile: [::CHAR; ::MAX_PATH], + HtmlTroubleShooter: [::CHAR; ::MAX_PATH], +}} +pub type PSP_TROUBLESHOOTER_PARAMS_A = *mut SP_TROUBLESHOOTER_PARAMS_A; +STRUCT!{nodebug struct SP_TROUBLESHOOTER_PARAMS_W { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + ChmFile: [::WCHAR; ::MAX_PATH], + HtmlTroubleShooter: [::WCHAR; ::MAX_PATH], +}} +pub type PSP_TROUBLESHOOTER_PARAMS_W = *mut SP_TROUBLESHOOTER_PARAMS_W; +STRUCT!{nodebug struct SP_POWERMESSAGEWAKE_PARAMS_A { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + PowerMessageWake: [::CHAR; LINE_LEN * 2], +}} +pub type PSP_POWERMESSAGEWAKE_PARAMS_A = *mut SP_POWERMESSAGEWAKE_PARAMS_A; +STRUCT!{nodebug struct SP_POWERMESSAGEWAKE_PARAMS_W { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + PowerMessageWake: [::WCHAR; LINE_LEN * 2], +}} +pub type PSP_POWERMESSAGEWAKE_PARAMS_W = *mut SP_POWERMESSAGEWAKE_PARAMS_W; +STRUCT!{nodebug struct SP_DRVINFO_DATA_V2_A { + cbSize: ::DWORD, + DriverType: ::DWORD, + Reserved: ::ULONG_PTR, + Description: [::CHAR; LINE_LEN], + MfgName: [::CHAR; LINE_LEN], + ProviderName: [::CHAR; LINE_LEN], + DriverDate: ::FILETIME, + DriverVersion: ::DWORDLONG, +}} +pub type PSP_DRVINFO_DATA_V2_A = *mut SP_DRVINFO_DATA_V2_A; +STRUCT!{nodebug struct SP_DRVINFO_DATA_V2_W { + cbSize: ::DWORD, + DriverType: ::DWORD, + Reserved: ::ULONG_PTR, + Description: [::WCHAR; LINE_LEN], + MfgName: [::WCHAR; LINE_LEN], + ProviderName: [::WCHAR; LINE_LEN], + DriverDate: ::FILETIME, + DriverVersion: ::DWORDLONG, +}} +pub type PSP_DRVINFO_DATA_V2_W = *mut SP_DRVINFO_DATA_V2_W; +STRUCT!{nodebug struct SP_DRVINFO_DATA_V1_A { + cbSize: ::DWORD, + DriverType: ::DWORD, + Reserved: ::ULONG_PTR, + Description: [::CHAR; LINE_LEN], + MfgName: [::CHAR; LINE_LEN], + ProviderName: [::CHAR; LINE_LEN], +}} +pub type PSP_DRVINFO_DATA_V1_A = *mut SP_DRVINFO_DATA_V1_A; +STRUCT!{nodebug struct SP_DRVINFO_DATA_V1_W { + cbSize: ::DWORD, + DriverType: ::DWORD, + Reserved: ::ULONG_PTR, + Description: [::WCHAR; LINE_LEN], + MfgName: [::WCHAR; LINE_LEN], + ProviderName: [::WCHAR; LINE_LEN], +}} +pub type PSP_DRVINFO_DATA_V1_W = *mut SP_DRVINFO_DATA_V1_W; +pub type SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V2_A; +pub type PSP_DRVINFO_DATA_A = PSP_DRVINFO_DATA_V2_A; +pub type SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V2_W; +pub type PSP_DRVINFO_DATA_W = PSP_DRVINFO_DATA_V2_W; +STRUCT!{nodebug struct SP_DRVINFO_DETAIL_DATA_A { + cbSize: ::DWORD, + InfDate: ::FILETIME, + CompatIDsOffset: ::DWORD, + CompatIDsLength: ::DWORD, + Reserved: ::ULONG_PTR, + SectionName: [::CHAR; LINE_LEN], + InfFileName: [::CHAR; ::MAX_PATH], + DrvDescription: [::CHAR; LINE_LEN], + HardwareID: [::CHAR; ::ANYSIZE_ARRAY], +}} +pub type PSP_DRVINFO_DETAIL_DATA_A = *mut SP_DRVINFO_DETAIL_DATA_A; +STRUCT!{nodebug struct SP_DRVINFO_DETAIL_DATA_W { + cbSize: ::DWORD, + InfDate: ::FILETIME, + CompatIDsOffset: ::DWORD, + CompatIDsLength: ::DWORD, + Reserved: ::ULONG_PTR, + SectionName: [::WCHAR; LINE_LEN], + InfFileName: [::WCHAR; ::MAX_PATH], + DrvDescription: [::WCHAR; LINE_LEN], + HardwareID: [::WCHAR; ::ANYSIZE_ARRAY], +}} +pub type PSP_DRVINFO_DETAIL_DATA_W = *mut SP_DRVINFO_DETAIL_DATA_W; +STRUCT!{struct SP_DRVINSTALL_PARAMS { + cbSize: ::DWORD, + Rank: ::DWORD, + Flags: ::DWORD, + PrivateData: ::DWORD_PTR, + Reserved: ::DWORD, +}} +pub type PSP_DRVINSTALL_PARAMS = *mut SP_DRVINSTALL_PARAMS; +pub const DNF_DUPDESC: ::DWORD = 0x00000001; +pub const DNF_OLDDRIVER: ::DWORD = 0x00000002; +pub const DNF_EXCLUDEFROMLIST: ::DWORD = 0x00000004; +pub const DNF_NODRIVER: ::DWORD = 0x00000008; +pub const DNF_LEGACYINF: ::DWORD = 0x00000010; +pub const DNF_CLASS_DRIVER: ::DWORD = 0x00000020; +pub const DNF_COMPATIBLE_DRIVER: ::DWORD = 0x00000040; +pub const DNF_INET_DRIVER: ::DWORD = 0x00000080; +pub const DNF_UNUSED1: ::DWORD = 0x00000100; +pub const DNF_UNUSED2: ::DWORD = 0x00000200; +pub const DNF_OLD_INET_DRIVER: ::DWORD = 0x00000400; +pub const DNF_BAD_DRIVER: ::DWORD = 0x00000800; +pub const DNF_DUPPROVIDER: ::DWORD = 0x00001000; +pub const DNF_INF_IS_SIGNED: ::DWORD = 0x00002000; +pub const DNF_OEM_F6_INF: ::DWORD = 0x00004000; +pub const DNF_DUPDRIVERVER: ::DWORD = 0x00008000; +pub const DNF_BASIC_DRIVER: ::DWORD = 0x00010000; +pub const DNF_AUTHENTICODE_SIGNED: ::DWORD = 0x00020000; +pub const DNF_INSTALLEDDRIVER: ::DWORD = 0x00040000; +pub const DNF_ALWAYSEXCLUDEFROMLIST: ::DWORD = 0x00080000; +pub const DNF_INBOX_DRIVER: ::DWORD = 0x00100000; +pub const DNF_REQUESTADDITIONALSOFTWARE: ::DWORD = 0x00200000; +pub const DNF_UNUSED_22: ::DWORD = 0x00400000; +pub const DNF_UNUSED_23: ::DWORD = 0x00800000; +pub const DNF_UNUSED_24: ::DWORD = 0x01000000; +pub const DNF_UNUSED_25: ::DWORD = 0x02000000; +pub const DNF_UNUSED_26: ::DWORD = 0x04000000; +pub const DNF_UNUSED_27: ::DWORD = 0x08000000; +pub const DNF_UNUSED_28: ::DWORD = 0x10000000; +pub const DNF_UNUSED_29: ::DWORD = 0x20000000; +pub const DNF_UNUSED_30: ::DWORD = 0x40000000; +pub const DNF_UNUSED_31: ::DWORD = 0x80000000; +pub type PSP_DETSIG_CMPPROC = Option ::DWORD>; +STRUCT!{struct COINSTALLER_CONTEXT_DATA { + PostProcessing: ::BOOL, + InstallResult: ::DWORD, + PrivateData: ::PVOID, +}} +pub type PCOINSTALLER_CONTEXT_DATA = *mut COINSTALLER_CONTEXT_DATA; +STRUCT!{struct SP_CLASSIMAGELIST_DATA { + cbSize: ::DWORD, + ImageList: ::HIMAGELIST, + Reserved: ::ULONG_PTR, +}} +pub type PSP_CLASSIMAGELIST_DATA = *mut SP_CLASSIMAGELIST_DATA; +STRUCT!{struct SP_PROPSHEETPAGE_REQUEST { + cbSize: ::DWORD, + PageRequested: ::DWORD, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, +}} +pub type PSP_PROPSHEETPAGE_REQUEST = *mut SP_PROPSHEETPAGE_REQUEST; +pub const SPPSR_SELECT_DEVICE_RESOURCES: ::DWORD = 1; +pub const SPPSR_ENUM_BASIC_DEVICE_PROPERTIES: ::DWORD = 2; +pub const SPPSR_ENUM_ADV_DEVICE_PROPERTIES: ::DWORD = 3; +STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V2_A { + cbSize: ::DWORD, + FullInfPath: [::CHAR; ::MAX_PATH], + FilenameOffset: ::INT, + ReinstallInstance: [::CHAR; ::MAX_PATH], +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V2_A = *mut SP_BACKUP_QUEUE_PARAMS_V2_A; +STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V2_W { + cbSize: ::DWORD, + FullInfPath: [::WCHAR; ::MAX_PATH], + FilenameOffset: ::INT, + ReinstallInstance: [::WCHAR; ::MAX_PATH], +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V2_W = *mut SP_BACKUP_QUEUE_PARAMS_V2_W; +STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V1_A { + cbSize: ::DWORD, + FullInfPath: [::CHAR; ::MAX_PATH], + FilenameOffset: ::INT, +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V1_A = *mut SP_BACKUP_QUEUE_PARAMS_V1_A; +STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V1_W { + cbSize: ::DWORD, + FullInfPath: [::WCHAR; ::MAX_PATH], + FilenameOffset: ::INT, +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V1_W = *mut SP_BACKUP_QUEUE_PARAMS_V1_W; +pub type SP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_V2_A; +pub type PSP_BACKUP_QUEUE_PARAMS_A = PSP_BACKUP_QUEUE_PARAMS_V2_A; +pub type SP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_V2_W; +pub type PSP_BACKUP_QUEUE_PARAMS_W = PSP_BACKUP_QUEUE_PARAMS_V2_W; +pub const ERROR_EXPECTED_SECTION_NAME: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0; +pub const ERROR_BAD_SECTION_NAME_LINE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 1; +pub const ERROR_SECTION_NAME_TOO_LONG: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 2; +pub const ERROR_GENERAL_SYNTAX: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 3; +pub const ERROR_WRONG_INF_STYLE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x100; +pub const ERROR_SECTION_NOT_FOUND: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x101; +pub const ERROR_LINE_NOT_FOUND: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x102; +pub const ERROR_NO_BACKUP: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x103; +pub const ERROR_NO_ASSOCIATED_CLASS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x200; +pub const ERROR_CLASS_MISMATCH: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x201; +pub const ERROR_DUPLICATE_FOUND: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x202; +pub const ERROR_NO_DRIVER_SELECTED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x203; +pub const ERROR_KEY_DOES_NOT_EXIST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x204; +pub const ERROR_INVALID_DEVINST_NAME: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x205; +pub const ERROR_INVALID_CLASS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x206; +pub const ERROR_DEVINST_ALREADY_EXISTS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x207; +pub const ERROR_DEVINFO_NOT_REGISTERED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x208; +pub const ERROR_INVALID_REG_PROPERTY: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x209; +pub const ERROR_NO_INF: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x20A; +pub const ERROR_NO_SUCH_DEVINST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x20B; +pub const ERROR_CANT_LOAD_CLASS_ICON: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x20C; +pub const ERROR_INVALID_CLASS_INSTALLER: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x20D; +pub const ERROR_DI_DO_DEFAULT: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x20E; +pub const ERROR_DI_NOFILECOPY: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x20F; +pub const ERROR_INVALID_HWPROFILE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x210; +pub const ERROR_NO_DEVICE_SELECTED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x211; +pub const ERROR_DEVINFO_LIST_LOCKED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x212; +pub const ERROR_DEVINFO_DATA_LOCKED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x213; +pub const ERROR_DI_BAD_PATH: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x214; +pub const ERROR_NO_CLASSINSTALL_PARAMS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x215; +pub const ERROR_FILEQUEUE_LOCKED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x216; +pub const ERROR_BAD_SERVICE_INSTALLSECT: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x217; +pub const ERROR_NO_CLASS_DRIVER_LIST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x218; +pub const ERROR_NO_ASSOCIATED_SERVICE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x219; +pub const ERROR_NO_DEFAULT_DEVICE_INTERFACE: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x21A; +pub const ERROR_DEVICE_INTERFACE_ACTIVE: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x21B; +pub const ERROR_DEVICE_INTERFACE_REMOVED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x21C; +pub const ERROR_BAD_INTERFACE_INSTALLSECT: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x21D; +pub const ERROR_NO_SUCH_INTERFACE_CLASS: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x21E; +pub const ERROR_INVALID_REFERENCE_STRING: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x21F; +pub const ERROR_INVALID_MACHINENAME: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x220; +pub const ERROR_REMOTE_COMM_FAILURE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x221; +pub const ERROR_MACHINE_UNAVAILABLE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x222; +pub const ERROR_NO_CONFIGMGR_SERVICES: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x223; +pub const ERROR_INVALID_PROPPAGE_PROVIDER: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x224; +pub const ERROR_NO_SUCH_DEVICE_INTERFACE: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x225; +pub const ERROR_DI_POSTPROCESSING_REQUIRED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x226; +pub const ERROR_INVALID_COINSTALLER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x227; +pub const ERROR_NO_COMPAT_DRIVERS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x228; +pub const ERROR_NO_DEVICE_ICON: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x229; +pub const ERROR_INVALID_INF_LOGCONFIG: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x22A; +pub const ERROR_DI_DONT_INSTALL: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x22B; +pub const ERROR_INVALID_FILTER_DRIVER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x22C; +pub const ERROR_NON_WINDOWS_NT_DRIVER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x22D; +pub const ERROR_NON_WINDOWS_DRIVER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x22E; +pub const ERROR_NO_CATALOG_FOR_OEM_INF: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x22F; +pub const ERROR_DEVINSTALL_QUEUE_NONNATIVE: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x230; +pub const ERROR_NOT_DISABLEABLE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x231; +pub const ERROR_CANT_REMOVE_DEVINST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x232; +pub const ERROR_INVALID_TARGET: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x233; +pub const ERROR_DRIVER_NONNATIVE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x234; +pub const ERROR_IN_WOW64: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x235; +pub const ERROR_SET_SYSTEM_RESTORE_POINT: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x236; +pub const ERROR_SCE_DISABLED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x238; +pub const ERROR_UNKNOWN_EXCEPTION: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x239; +pub const ERROR_PNP_REGISTRY_ERROR: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x23A; +pub const ERROR_REMOTE_REQUEST_UNSUPPORTED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x23B; +pub const ERROR_NOT_AN_INSTALLED_OEM_INF: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x23C; +pub const ERROR_INF_IN_USE_BY_DEVICES: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x23D; +pub const ERROR_DI_FUNCTION_OBSOLETE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x23E; +pub const ERROR_NO_AUTHENTICODE_CATALOG: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x23F; +pub const ERROR_AUTHENTICODE_DISALLOWED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x240; +pub const ERROR_AUTHENTICODE_TRUSTED_PUBLISHER: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x241; +pub const ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x242; +pub const ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x243; +pub const ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x244; +pub const ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x245; +pub const ERROR_DEVICE_INSTALLER_NOT_READY: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x246; +pub const ERROR_DRIVER_STORE_ADD_FAILED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x247; +pub const ERROR_DEVICE_INSTALL_BLOCKED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x248; +pub const ERROR_DRIVER_INSTALL_BLOCKED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x249; +pub const ERROR_WRONG_INF_TYPE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x24A; +pub const ERROR_FILE_HASH_NOT_IN_CATALOG: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x24B; +pub const ERROR_DRIVER_STORE_DELETE_FAILED: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x24C; +pub const ERROR_UNRECOVERABLE_STACK_OVERFLOW: ::DWORD = ::APPLICATION_ERROR_MASK + | ::ERROR_SEVERITY_ERROR | 0x300; +pub const EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW: ::DWORD = + ERROR_UNRECOVERABLE_STACK_OVERFLOW; +pub const ERROR_NO_DEFAULT_INTERFACE_DEVICE: ::DWORD = ERROR_NO_DEFAULT_DEVICE_INTERFACE; +pub const ERROR_INTERFACE_DEVICE_ACTIVE: ::DWORD = ERROR_DEVICE_INTERFACE_ACTIVE; +pub const ERROR_INTERFACE_DEVICE_REMOVED: ::DWORD = ERROR_DEVICE_INTERFACE_REMOVED; +pub const ERROR_NO_SUCH_INTERFACE_DEVICE: ::DWORD = ERROR_NO_SUCH_DEVICE_INTERFACE; +pub const ERROR_NOT_INSTALLED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR + | 0x1000; +pub const INFINFO_INF_SPEC_IS_HINF: ::DWORD = 1; +pub const INFINFO_INF_NAME_IS_ABSOLUTE: ::DWORD = 2; +pub const INFINFO_DEFAULT_SEARCH: ::DWORD = 3; +pub const INFINFO_REVERSE_DEFAULT_SEARCH: ::DWORD = 4; +pub const INFINFO_INF_PATH_LIST_SEARCH: ::DWORD = 5; +pub const FILE_COMPRESSION_NONE: ::UINT = 0; +pub const FILE_COMPRESSION_WINLZA: ::UINT = 1; +pub const FILE_COMPRESSION_MSZIP: ::UINT = 2; +pub const FILE_COMPRESSION_NTCAB: ::UINT = 3; +pub const SRCLIST_TEMPORARY: ::DWORD = 0x00000001; +pub const SRCLIST_NOBROWSE: ::DWORD = 0x00000002; +pub const SRCLIST_SYSTEM: ::DWORD = 0x00000010; +pub const SRCLIST_USER: ::DWORD = 0x00000020; +pub const SRCLIST_SYSIFADMIN: ::DWORD = 0x00000040; +pub const SRCLIST_SUBDIRS: ::DWORD = 0x00000100; +pub const SRCLIST_APPEND: ::DWORD = 0x00000200; +pub const SRCLIST_NOSTRIPPLATFORM: ::DWORD = 0x00000400; +pub const IDF_NOBROWSE: ::DWORD = 0x00000001; +pub const IDF_NOSKIP: ::DWORD = 0x00000002; +pub const IDF_NODETAILS: ::DWORD = 0x00000004; +pub const IDF_NOCOMPRESSED: ::DWORD = 0x00000008; +pub const IDF_CHECKFIRST: ::DWORD = 0x00000100; +pub const IDF_NOBEEP: ::DWORD = 0x00000200; +pub const IDF_NOFOREGROUND: ::DWORD = 0x00000400; +pub const IDF_WARNIFSKIP: ::DWORD = 0x00000800; +pub const IDF_NOREMOVABLEMEDIAPROMPT: ::DWORD = 0x00001000; +pub const IDF_USEDISKNAMEASPROMPT: ::DWORD = 0x00002000; +pub const IDF_OEMDISK: ::DWORD = 0x80000000; +pub const DPROMPT_SUCCESS: ::UINT = 0; +pub const DPROMPT_CANCEL: ::UINT = 1; +pub const DPROMPT_SKIPFILE: ::UINT = 2; +pub const DPROMPT_BUFFERTOOSMALL: ::UINT = 3; +pub const DPROMPT_OUTOFMEMORY: ::UINT = 4; +pub const SETDIRID_NOT_FULL_PATH: ::DWORD = 0x00000001; +pub const SRCINFO_PATH: ::UINT = 1; +pub const SRCINFO_TAGFILE: ::UINT = 2; +pub const SRCINFO_DESCRIPTION: ::UINT = 3; +pub const SRCINFO_FLAGS: ::UINT = 4; +pub const SRCINFO_TAGFILE2: ::UINT = 4; +pub const SRC_FLAGS_CABFILE: ::UINT = 0x0010; +pub const SP_COPY_DELETESOURCE: ::DWORD = 0x0000001; +pub const SP_COPY_REPLACEONLY: ::DWORD = 0x0000002; +pub const SP_COPY_NEWER: ::DWORD = 0x0000004; +pub const SP_COPY_NEWER_OR_SAME: ::DWORD = SP_COPY_NEWER; +pub const SP_COPY_NOOVERWRITE: ::DWORD = 0x0000008; +pub const SP_COPY_NODECOMP: ::DWORD = 0x0000010; +pub const SP_COPY_LANGUAGEAWARE: ::DWORD = 0x0000020; +pub const SP_COPY_SOURCE_ABSOLUTE: ::DWORD = 0x0000040; +pub const SP_COPY_SOURCEPATH_ABSOLUTE: ::DWORD = 0x0000080; +pub const SP_COPY_IN_USE_NEEDS_REBOOT: ::DWORD = 0x0000100; +pub const SP_COPY_FORCE_IN_USE: ::DWORD = 0x0000200; +pub const SP_COPY_NOSKIP: ::DWORD = 0x0000400; +pub const SP_FLAG_CABINETCONTINUATION: ::DWORD = 0x0000800; +pub const SP_COPY_FORCE_NOOVERWRITE: ::DWORD = 0x0001000; +pub const SP_COPY_FORCE_NEWER: ::DWORD = 0x0002000; +pub const SP_COPY_WARNIFSKIP: ::DWORD = 0x0004000; +pub const SP_COPY_NOBROWSE: ::DWORD = 0x0008000; +pub const SP_COPY_NEWER_ONLY: ::DWORD = 0x0010000; +pub const SP_COPY_RESERVED: ::DWORD = 0x0020000; +pub const SP_COPY_OEMINF_CATALOG_ONLY: ::DWORD = 0x0040000; +pub const SP_COPY_REPLACE_BOOT_FILE: ::DWORD = 0x0080000; +pub const SP_COPY_NOPRUNE: ::DWORD = 0x0100000; +pub const SP_COPY_OEM_F6_INF: ::DWORD = 0x0200000; +pub const SP_COPY_ALREADYDECOMP: ::DWORD = 0x0400000; +pub const SP_COPY_WINDOWS_SIGNED: ::DWORD = 0x1000000; +pub const SP_COPY_PNPLOCKED: ::DWORD = 0x2000000; +pub const SP_COPY_IN_USE_TRY_RENAME: ::DWORD = 0x4000000; +pub const SP_COPY_INBOX_INF: ::DWORD = 0x8000000; +pub const SP_COPY_HARDLINK: ::DWORD = 0x10000000; +pub const SP_BACKUP_BACKUPPASS: ::DWORD = 0x00000001; +pub const SP_BACKUP_DEMANDPASS: ::DWORD = 0x00000002; +pub const SP_BACKUP_SPECIAL: ::DWORD = 0x00000004; +pub const SP_BACKUP_BOOTFILE: ::DWORD = 0x00000008; +pub const SPQ_SCAN_FILE_PRESENCE: ::DWORD = 0x00000001; +pub const SPQ_SCAN_FILE_VALIDITY: ::DWORD = 0x00000002; +pub const SPQ_SCAN_USE_CALLBACK: ::DWORD = 0x00000004; +pub const SPQ_SCAN_USE_CALLBACKEX: ::DWORD = 0x00000008; +pub const SPQ_SCAN_INFORM_USER: ::DWORD = 0x00000010; +pub const SPQ_SCAN_PRUNE_COPY_QUEUE: ::DWORD = 0x00000020; +pub const SPQ_SCAN_USE_CALLBACK_SIGNERINFO: ::DWORD = 0x00000040; +pub const SPQ_SCAN_PRUNE_DELREN: ::DWORD = 0x00000080; +pub const SPQ_SCAN_FILE_PRESENCE_WITHOUT_SOURCE: ::DWORD = 0x00000100; +pub const SPQ_SCAN_FILE_COMPARISON: ::DWORD = 0x00000200; +pub const SPQ_SCAN_ACTIVATE_DRP: ::DWORD = 0x00000400; +pub const SPQ_DELAYED_COPY: ::DWORD = 0x00000001; +pub const SPQ_FLAG_BACKUP_AWARE: ::DWORD = 0x00000001; +pub const SPQ_FLAG_ABORT_IF_UNSIGNED: ::DWORD = 0x00000002; +pub const SPQ_FLAG_FILES_MODIFIED: ::DWORD = 0x00000004; +pub const SPQ_FLAG_DO_SHUFFLEMOVE: ::DWORD = 0x00000008; +pub const SPQ_FLAG_VALID: ::DWORD = 0x0000000F; +pub const SPOST_NONE: ::DWORD = 0; +pub const SPOST_PATH: ::DWORD = 1; +pub const SPOST_URL: ::DWORD = 2; +pub const SPOST_MAX: ::DWORD = 3; +pub const SUOI_FORCEDELETE: ::DWORD = 0x00000001; +pub const SUOI_INTERNAL1: ::DWORD = 0x00000002; +pub const SPDSL_IGNORE_DISK: ::UINT = 0x00000001; +pub const SPDSL_DISALLOW_NEGATIVE_ADJUST: ::UINT = 0x00000002; +pub const SPFILEQ_FILE_IN_USE: ::INT = 0x00000001; +pub const SPFILEQ_REBOOT_RECOMMENDED: ::INT = 0x00000002; +pub const SPFILEQ_REBOOT_IN_PROGRESS: ::INT = 0x00000004; +pub const FLG_ADDREG_DELREG_BIT: ::DWORD = 0x00008000; +pub const FLG_ADDREG_BINVALUETYPE: ::DWORD = 0x00000001; +pub const FLG_ADDREG_NOCLOBBER: ::DWORD = 0x00000002; +pub const FLG_ADDREG_DELVAL: ::DWORD = 0x00000004; +pub const FLG_ADDREG_APPEND: ::DWORD = 0x00000008; +pub const FLG_ADDREG_KEYONLY: ::DWORD = 0x00000010; +pub const FLG_ADDREG_OVERWRITEONLY: ::DWORD = 0x00000020; +pub const FLG_ADDREG_64BITKEY: ::DWORD = 0x00001000; +pub const FLG_ADDREG_KEYONLY_COMMON: ::DWORD = 0x00002000; +pub const FLG_ADDREG_32BITKEY: ::DWORD = 0x00004000; +pub const FLG_ADDREG_TYPE_MASK: ::DWORD = 0xFFFF0000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_ADDREG_TYPE_SZ: ::DWORD = 0x00000000; +pub const FLG_ADDREG_TYPE_MULTI_SZ: ::DWORD = 0x00010000; +pub const FLG_ADDREG_TYPE_EXPAND_SZ: ::DWORD = 0x00020000; +pub const FLG_ADDREG_TYPE_BINARY: ::DWORD = 0x00000000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_ADDREG_TYPE_DWORD: ::DWORD = 0x00010000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_ADDREG_TYPE_NONE: ::DWORD = 0x00020000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_DELREG_VALUE: ::DWORD = 0x00000000; +pub const FLG_DELREG_TYPE_MASK: ::DWORD = FLG_ADDREG_TYPE_MASK; +pub const FLG_DELREG_TYPE_SZ: ::DWORD = FLG_ADDREG_TYPE_SZ; +pub const FLG_DELREG_TYPE_MULTI_SZ: ::DWORD = FLG_ADDREG_TYPE_MULTI_SZ; +pub const FLG_DELREG_TYPE_EXPAND_SZ: ::DWORD = FLG_ADDREG_TYPE_EXPAND_SZ; +pub const FLG_DELREG_TYPE_BINARY: ::DWORD = FLG_ADDREG_TYPE_BINARY; +pub const FLG_DELREG_TYPE_DWORD: ::DWORD = FLG_ADDREG_TYPE_DWORD; +pub const FLG_DELREG_TYPE_NONE: ::DWORD = FLG_ADDREG_TYPE_NONE; +pub const FLG_DELREG_64BITKEY: ::DWORD = FLG_ADDREG_64BITKEY; +pub const FLG_DELREG_KEYONLY_COMMON: ::DWORD = FLG_ADDREG_KEYONLY_COMMON; +pub const FLG_DELREG_32BITKEY: ::DWORD = FLG_ADDREG_32BITKEY; +pub const FLG_DELREG_OPERATION_MASK: ::DWORD = 0x000000FE; +pub const FLG_DELREG_MULTI_SZ_DELSTRING: ::DWORD = FLG_DELREG_TYPE_MULTI_SZ | FLG_ADDREG_DELREG_BIT + | 0x00000002; +pub const FLG_BITREG_CLEARBITS: ::DWORD = 0x00000000; +pub const FLG_BITREG_SETBITS: ::DWORD = 0x00000001; +pub const FLG_BITREG_64BITKEY: ::DWORD = 0x00001000; +pub const FLG_BITREG_32BITKEY: ::DWORD = 0x00004000; +pub const FLG_INI2REG_64BITKEY: ::DWORD = 0x00001000; +pub const FLG_INI2REG_32BITKEY: ::DWORD = 0x00004000; +pub const FLG_REGSVR_DLLREGISTER: ::DWORD = 0x00000001; +pub const FLG_REGSVR_DLLINSTALL: ::DWORD = 0x00000002; +pub const FLG_PROFITEM_CURRENTUSER: ::DWORD = 0x00000001; +pub const FLG_PROFITEM_DELETE: ::DWORD = 0x00000002; +pub const FLG_PROFITEM_GROUP: ::DWORD = 0x00000004; +pub const FLG_PROFITEM_CSIDL: ::DWORD = 0x00000008; +pub const FLG_ADDPROPERTY_NOCLOBBER: ::DWORD = 0x00000001; +pub const FLG_ADDPROPERTY_OVERWRITEONLY: ::DWORD = 0x00000002; +pub const FLG_ADDPROPERTY_APPEND: ::DWORD = 0x00000004; +pub const FLG_ADDPROPERTY_OR: ::DWORD = 0x00000008; +pub const FLG_ADDPROPERTY_AND: ::DWORD = 0x00000010; +pub const FLG_DELPROPERTY_MULTI_SZ_DELSTRING: ::DWORD = 0x00000001; +pub const SPINST_LOGCONFIG: ::UINT = 0x00000001; +pub const SPINST_INIFILES: ::UINT = 0x00000002; +pub const SPINST_REGISTRY: ::UINT = 0x00000004; +pub const SPINST_INI2REG: ::UINT = 0x00000008; +pub const SPINST_FILES: ::UINT = 0x00000010; +pub const SPINST_BITREG: ::UINT = 0x00000020; +pub const SPINST_REGSVR: ::UINT = 0x00000040; +pub const SPINST_UNREGSVR: ::UINT = 0x00000080; +pub const SPINST_PROFILEITEMS: ::UINT = 0x00000100; +pub const SPINST_COPYINF: ::UINT = 0x00000200; +pub const SPINST_PROPERTIES: ::UINT = 0x00000400; +pub const SPINST_ALL: ::UINT = 0x000007ff; +pub const SPINST_SINGLESECTION: ::UINT = 0x00010000; +pub const SPINST_LOGCONFIG_IS_FORCED: ::UINT = 0x00020000; +pub const SPINST_LOGCONFIGS_ARE_OVERRIDES: ::UINT = 0x00040000; +pub const SPINST_REGISTERCALLBACKAWARE: ::UINT = 0x00080000; +pub const SPINST_DEVICEINSTALL: ::UINT = 0x00100000; +pub const SPSVCINST_TAGTOFRONT: ::DWORD = 0x00000001; +pub const SPSVCINST_ASSOCSERVICE: ::DWORD = 0x00000002; +pub const SPSVCINST_DELETEEVENTLOGENTRY: ::DWORD = 0x00000004; +pub const SPSVCINST_NOCLOBBER_DISPLAYNAME: ::DWORD = 0x00000008; +pub const SPSVCINST_NOCLOBBER_STARTTYPE: ::DWORD = 0x00000010; +pub const SPSVCINST_NOCLOBBER_ERRORCONTROL: ::DWORD = 0x00000020; +pub const SPSVCINST_NOCLOBBER_LOADORDERGROUP: ::DWORD = 0x00000040; +pub const SPSVCINST_NOCLOBBER_DEPENDENCIES: ::DWORD = 0x00000080; +pub const SPSVCINST_NOCLOBBER_DESCRIPTION: ::DWORD = 0x00000100; +pub const SPSVCINST_STOPSERVICE: ::DWORD = 0x00000200; +pub const SPSVCINST_CLOBBER_SECURITY: ::DWORD = 0x00000400; +pub const SPSVCINST_STARTSERVICE: ::DWORD = 0x00000800; +pub const SPSVCINST_NOCLOBBER_REQUIREDPRIVILEGES: ::DWORD = 0x00001000; +pub type HSPFILELOG = ::PVOID; +pub const SPFILELOG_SYSTEMLOG: ::DWORD = 0x00000001; +pub const SPFILELOG_FORCENEW: ::DWORD = 0x00000002; +pub const SPFILELOG_QUERYONLY: ::DWORD = 0x00000004; +pub const SPFILELOG_OEMFILE: ::DWORD = 0x00000001; +ENUM!{enum SetupFileLogInfo { + SetupFileLogSourceFilename, + SetupFileLogChecksum, + SetupFileLogDiskTagfile, + SetupFileLogDiskDescription, + SetupFileLogOtherInfo, + SetupFileLogMax, +}} +pub type LogSeverity = ::DWORD; +pub const LogSevInformation: LogSeverity = 0x00000000; +pub const LogSevWarning: LogSeverity = 0x00000001; +pub const LogSevError: LogSeverity = 0x00000002; +pub const LogSevFatalError: LogSeverity = 0x00000003; +pub const LogSevMaximum: LogSeverity = 0x00000004; +pub const DICD_GENERATE_ID: ::DWORD = 0x00000001; +pub const DICD_INHERIT_CLASSDRVS: ::DWORD = 0x00000002; +pub const DIOD_INHERIT_CLASSDRVS: ::DWORD = 0x00000002; +pub const DIOD_CANCEL_REMOVE: ::DWORD = 0x00000004; +pub const DIODI_NO_ADD: ::DWORD = 0x00000001; +pub const SPRDI_FIND_DUPS: ::DWORD = 0x00000001; +pub const SPDIT_NODRIVER: ::DWORD = 0x00000000; +pub const SPDIT_CLASSDRIVER: ::DWORD = 0x00000001; +pub const SPDIT_COMPATDRIVER: ::DWORD = 0x00000002; +pub const DIGCF_DEFAULT: ::DWORD = 0x00000001; +pub const DIGCF_PRESENT: ::DWORD = 0x00000002; +pub const DIGCF_ALLCLASSES: ::DWORD = 0x00000004; +pub const DIGCF_PROFILE: ::DWORD = 0x00000008; +pub const DIGCF_DEVICEINTERFACE: ::DWORD = 0x00000010; +pub const DIBCI_NOINSTALLCLASS: ::DWORD = 0x00000001; +pub const DIBCI_NODISPLAYCLASS: ::DWORD = 0x00000002; +pub const DIOCR_INSTALLER: ::DWORD = 0x00000001; +pub const DIOCR_INTERFACE: ::DWORD = 0x00000002; +pub const DIREG_DEV: ::DWORD = 0x00000001; +pub const DIREG_DRV: ::DWORD = 0x00000002; +pub const DIREG_BOTH: ::DWORD = 0x00000004; +pub const DICLASSPROP_INSTALLER: ::DWORD = 0x00000001; +pub const DICLASSPROP_INTERFACE: ::DWORD = 0x00000002; +pub const SPDRP_DEVICEDESC: ::DWORD = 0x00000000; +pub const SPDRP_HARDWAREID: ::DWORD = 0x00000001; +pub const SPDRP_COMPATIBLEIDS: ::DWORD = 0x00000002; +pub const SPDRP_UNUSED0: ::DWORD = 0x00000003; +pub const SPDRP_SERVICE: ::DWORD = 0x00000004; +pub const SPDRP_UNUSED1: ::DWORD = 0x00000005; +pub const SPDRP_UNUSED2: ::DWORD = 0x00000006; +pub const SPDRP_CLASS: ::DWORD = 0x00000007; +pub const SPDRP_CLASSGUID: ::DWORD = 0x00000008; +pub const SPDRP_DRIVER: ::DWORD = 0x00000009; +pub const SPDRP_CONFIGFLAGS: ::DWORD = 0x0000000A; +pub const SPDRP_MFG: ::DWORD = 0x0000000B; +pub const SPDRP_FRIENDLYNAME: ::DWORD = 0x0000000C; +pub const SPDRP_LOCATION_INFORMATION: ::DWORD = 0x0000000D; +pub const SPDRP_PHYSICAL_DEVICE_OBJECT_NAME: ::DWORD = 0x0000000E; +pub const SPDRP_CAPABILITIES: ::DWORD = 0x0000000F; +pub const SPDRP_UI_NUMBER: ::DWORD = 0x00000010; +pub const SPDRP_UPPERFILTERS: ::DWORD = 0x00000011; +pub const SPDRP_LOWERFILTERS: ::DWORD = 0x00000012; +pub const SPDRP_BUSTYPEGUID: ::DWORD = 0x00000013; +pub const SPDRP_LEGACYBUSTYPE: ::DWORD = 0x00000014; +pub const SPDRP_BUSNUMBER: ::DWORD = 0x00000015; +pub const SPDRP_ENUMERATOR_NAME: ::DWORD = 0x00000016; +pub const SPDRP_SECURITY: ::DWORD = 0x00000017; +pub const SPDRP_SECURITY_SDS: ::DWORD = 0x00000018; +pub const SPDRP_DEVTYPE: ::DWORD = 0x00000019; +pub const SPDRP_EXCLUSIVE: ::DWORD = 0x0000001A; +pub const SPDRP_CHARACTERISTICS: ::DWORD = 0x0000001B; +pub const SPDRP_ADDRESS: ::DWORD = 0x0000001C; +pub const SPDRP_UI_NUMBER_DESC_FORMAT: ::DWORD = 0x0000001D; +pub const SPDRP_DEVICE_POWER_DATA: ::DWORD = 0x0000001E; +pub const SPDRP_REMOVAL_POLICY: ::DWORD = 0x0000001F; +pub const SPDRP_REMOVAL_POLICY_HW_DEFAULT: ::DWORD = 0x00000020; +pub const SPDRP_REMOVAL_POLICY_OVERRIDE: ::DWORD = 0x00000021; +pub const SPDRP_INSTALL_STATE: ::DWORD = 0x00000022; +pub const SPDRP_LOCATION_PATHS: ::DWORD = 0x00000023; +pub const SPDRP_BASE_CONTAINERID: ::DWORD = 0x00000024; +pub const SPDRP_MAXIMUM_PROPERTY: ::DWORD = 0x00000025; +pub const SPCRP_UPPERFILTERS: ::DWORD = 0x00000011; +pub const SPCRP_LOWERFILTERS: ::DWORD = 0x00000012; +pub const SPCRP_SECURITY: ::DWORD = 0x00000017; +pub const SPCRP_SECURITY_SDS: ::DWORD = 0x00000018; +pub const SPCRP_DEVTYPE: ::DWORD = 0x00000019; +pub const SPCRP_EXCLUSIVE: ::DWORD = 0x0000001A; +pub const SPCRP_CHARACTERISTICS: ::DWORD = 0x0000001B; +pub const SPCRP_MAXIMUM_PROPERTY: ::DWORD = 0x0000001C; +pub const DMI_MASK: ::DWORD = 0x00000001; +pub const DMI_BKCOLOR: ::DWORD = 0x00000002; +pub const DMI_USERECT: ::DWORD = 0x00000004; +pub const DIGCDP_FLAG_BASIC: ::DWORD = 0x00000001; +pub const DIGCDP_FLAG_ADVANCED: ::DWORD = 0x00000002; +pub const DIGCDP_FLAG_REMOTE_BASIC: ::DWORD = 0x00000003; +pub const DIGCDP_FLAG_REMOTE_ADVANCED: ::DWORD = 0x00000004; +pub const IDI_RESOURCEFIRST: ::c_int = 159; +pub const IDI_RESOURCE: ::c_int = 159; +pub const IDI_RESOURCELAST: ::c_int = 161; +pub const IDI_RESOURCEOVERLAYFIRST: ::c_int = 161; +pub const IDI_RESOURCEOVERLAYLAST: ::c_int = 161; +pub const IDI_CONFLICT: ::c_int = 161; +pub const IDI_CLASSICON_OVERLAYFIRST: ::c_int = 500; +pub const IDI_CLASSICON_OVERLAYLAST: ::c_int = 502; +pub const IDI_PROBLEM_OVL: ::c_int = 500; +pub const IDI_DISABLED_OVL: ::c_int = 501; +pub const IDI_FORCED_OVL: ::c_int = 502; +pub const SPWPT_SELECTDEVICE: ::DWORD = 0x00000001; +pub const SPWP_USE_DEVINFO_DATA: ::DWORD = 0x00000001; +STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V1_A { + cbSize: ::DWORD, + CatalogFile: [::CHAR; ::MAX_PATH], + DigitalSigner: [::CHAR; ::MAX_PATH], + DigitalSignerVersion: [::CHAR; ::MAX_PATH], +}} +pub type PSP_INF_SIGNER_INFO_V1_A = *mut SP_INF_SIGNER_INFO_V1_A; +STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V1_W { + cbSize: ::DWORD, + CatalogFile: [::WCHAR; ::MAX_PATH], + DigitalSigner: [::WCHAR; ::MAX_PATH], + DigitalSignerVersion: [::WCHAR; ::MAX_PATH], +}} +pub type PSP_INF_SIGNER_INFO_V1_W = *mut SP_INF_SIGNER_INFO_V1_W; +STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V2_A { + cbSize: ::DWORD, + CatalogFile: [::CHAR; ::MAX_PATH], + DigitalSigner: [::CHAR; ::MAX_PATH], + DigitalSignerVersion: [::CHAR; ::MAX_PATH], + SignerScore: ::DWORD, +}} +pub type PSP_INF_SIGNER_INFO_V2_A = *mut SP_INF_SIGNER_INFO_V2_A; +STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V2_W { + cbSize: ::DWORD, + CatalogFile: [::WCHAR; ::MAX_PATH], + DigitalSigner: [::WCHAR; ::MAX_PATH], + DigitalSignerVersion: [::WCHAR; ::MAX_PATH], + SignerScore: ::DWORD, +}} +pub type PSP_INF_SIGNER_INFO_V2_W = *mut SP_INF_SIGNER_INFO_V2_W; +pub type SP_INF_SIGNER_INFO_A = SP_INF_SIGNER_INFO_V2_A; +pub type PSP_INF_SIGNER_INFO_A = PSP_INF_SIGNER_INFO_V2_A; +pub type SP_INF_SIGNER_INFO_W = SP_INF_SIGNER_INFO_V2_W; +pub type PSP_INF_SIGNER_INFO_W = PSP_INF_SIGNER_INFO_V2_W; +pub const SIGNERSCORE_UNKNOWN: ::DWORD = 0xFF000000; +pub const SIGNERSCORE_W9X_SUSPECT: ::DWORD = 0xC0000000; +pub const SIGNERSCORE_UNSIGNED: ::DWORD = 0x80000000; +pub const SIGNERSCORE_AUTHENTICODE: ::DWORD = 0x0F000000; +pub const SIGNERSCORE_WHQL: ::DWORD = 0x0D000005; +pub const SIGNERSCORE_UNCLASSIFIED: ::DWORD = 0x0D000004; +pub const SIGNERSCORE_INBOX: ::DWORD = 0x0D000003; +pub const SIGNERSCORE_LOGO_STANDARD: ::DWORD = 0x0D000002; +pub const SIGNERSCORE_LOGO_PREMIUM: ::DWORD = 0x0D000001; +pub const SIGNERSCORE_MASK: ::DWORD = 0xFF000000; +pub const SIGNERSCORE_SIGNED_MASK: ::DWORD = 0xF0000000; +pub const DICUSTOMDEVPROP_MERGE_MULTISZ: ::DWORD = 0x00000001; +pub const SCWMI_CLOBBER_SECURITY: ::DWORD = 0x00000001; diff --git a/third_party/rust/winapi/src/shellapi.rs b/third_party/rust/winapi/src/shellapi.rs new file mode 100644 index 000000000000..6f253cfd1574 --- /dev/null +++ b/third_party/rust/winapi/src/shellapi.rs @@ -0,0 +1,62 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +// STUB +DECLARE_HANDLE!(HDROP, HDROP__); + +pub const NIM_ADD: ::DWORD = 0x00000000; +pub const NIM_MODIFY: ::DWORD = 0x00000001; +pub const NIM_DELETE: ::DWORD = 0x00000002; +pub const NIM_SETFOCUS: ::DWORD = 0x00000003; +pub const NIM_SETVERSION: ::DWORD = 0x00000004; +pub const NIF_MESSAGE: ::UINT = 0x00000001; +pub const NIF_ICON: ::UINT = 0x00000002; +pub const NIF_TIP: ::UINT = 0x00000004; +pub const NIF_STATE: ::UINT = 0x00000008; +pub const NIF_INFO: ::UINT = 0x00000010; +pub const NIF_GUID: ::UINT = 0x00000020; +pub const NIF_REALTIME: ::UINT = 0x00000040; +pub const NIF_SHOWTIP: ::UINT = 0x00000080; +pub const NOTIFYICON_VERSION: ::UINT = 3; +pub const NOTIFYICON_VERSION_4: ::UINT = 4; + +STRUCT!{nodebug struct NOTIFYICONDATAA { + cbSize: ::DWORD, + hWnd: ::HWND, + uID: ::UINT, + uFlags: ::UINT, + uCallbackMessage: ::UINT, + hIcon: ::HICON, + szTip: [::CHAR; 128], + dwState: ::DWORD, + dwStateMask: ::DWORD, + szInfo: [::CHAR; 256], + uTimeout: ::UINT, + szInfoTitle: [::CHAR; 64], + dwInfoFlags: ::DWORD, + guidItem: ::GUID, + hBalloonIcon: ::HICON, +}} +UNION!(NOTIFYICONDATAA, uTimeout, uTimeout, uTimeout_mut, ::UINT); +UNION!(NOTIFYICONDATAA, uTimeout, uVersion, uVersion_mut, ::UINT); +pub type PNOTIFYICONDATAA = *mut NOTIFYICONDATAA; + +STRUCT!{nodebug struct NOTIFYICONDATAW { + cbSize: ::DWORD, + hWnd: ::HWND, + uID: ::UINT, + uFlags: ::UINT, + uCallbackMessage: ::UINT, + hIcon: ::HICON, + szTip: [::WCHAR; 128], + dwState: ::DWORD, + dwStateMask: ::DWORD, + szInfo: [::WCHAR; 256], + uTimeout: ::UINT, + szInfoTitle: [::WCHAR; 64], + dwInfoFlags: ::DWORD, + guidItem: ::GUID, + hBalloonIcon: ::HICON, +}} +UNION!(NOTIFYICONDATAW, uTimeout, uTimeout, uTimeout_mut, ::UINT); +UNION!(NOTIFYICONDATAW, uTimeout, uVersion, uVersion_mut, ::UINT); // used with NIM_SETVERSION, values 0, 3 and 4 +pub type PNOTIFYICONDATAW = *mut NOTIFYICONDATAW; diff --git a/third_party/rust/winapi/src/shellscalingapi.rs b/third_party/rust/winapi/src/shellscalingapi.rs new file mode 100644 index 000000000000..d313ddef92e0 --- /dev/null +++ b/third_party/rust/winapi/src/shellscalingapi.rs @@ -0,0 +1,19 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +// ShellScalingApi.h +ENUM!{enum PROCESS_DPI_AWARENESS { + Process_DPI_Unaware = 0, + Process_System_DPI_Aware = 1, + Process_Per_Monitor_DPI_Aware = 2, +}} +ENUM!{enum SHELL_UI_COMPONENT { + SHELL_UI_COMPONENT_TASKBARS = 0, + SHELL_UI_COMPONENT_NOTIFICATIONAREA = 1, + SHELL_UI_COMPONENT_DESKBAND = 2, +}} +ENUM!{enum MONITOR_DPI_TYPE { + MDT_EFFECTIVE_DPI = 0, + MDT_ANGULAR_DPI = 1, + MDT_RAW_DPI = 2, +}} +pub const MDT_DEFAULT: MONITOR_DPI_TYPE = MDT_EFFECTIVE_DPI; diff --git a/third_party/rust/winapi/src/shlguid.rs b/third_party/rust/winapi/src/shlguid.rs new file mode 100644 index 000000000000..f01b4e45224d --- /dev/null +++ b/third_party/rust/winapi/src/shlguid.rs @@ -0,0 +1,2 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License diff --git a/third_party/rust/winapi/src/shlobj.rs b/third_party/rust/winapi/src/shlobj.rs new file mode 100644 index 000000000000..d551f9215ce3 --- /dev/null +++ b/third_party/rust/winapi/src/shlobj.rs @@ -0,0 +1,94 @@ +// Copyright © 2015, Peter Atashian, skdltmxn +// Licensed under the MIT License +pub const INVALID_HANDLE_VALUE: ::HANDLE = -1isize as ::HANDLE; +pub type GPFIDL_FLAGS = ::c_int; +ENUM!{enum KNOWN_FOLDER_FLAG { + KF_FLAG_DEFAULT = 0x00000000, + KF_FLAG_NO_APPCONTAINER_REDIRECTION = 0x00010000, + KF_FLAG_CREATE = 0x00008000, + KF_FLAG_DONT_VERIFY = 0x00004000, + KF_FLAG_DONT_UNEXPAND = 0x00002000, + KF_FLAG_NO_ALIAS = 0x00001000, + KF_FLAG_INIT = 0x00000800, + KF_FLAG_DEFAULT_PATH = 0x00000400, + KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200, + KF_FLAG_SIMPLE_IDLIST = 0x00000100, + KF_FLAG_ALIAS_ONLY = 0x80000000, +}} +pub const IDO_SHGIOI_SHARE: ::c_int = 0x0FFFFFFF; +pub const IDO_SHGIOI_LINK: ::c_int = 0x0FFFFFFE; +// Yes, these values are supposed to overflow. Blame Microsoft. +pub const IDO_SHGIOI_SLOWFILE: ::c_int = 0xFFFFFFFDu32 as ::c_int; +pub const IDO_SHGIOI_DEFAULT: ::c_int = 0xFFFFFFFCu32 as ::c_int; +pub const GPFIDL_DEFAULT: GPFIDL_FLAGS = 0x0000; +pub const GPFIDL_ALTNAME: GPFIDL_FLAGS = 0x0001; +pub const GPFIDL_UNCPRINTER: GPFIDL_FLAGS = 0x0002; +pub const OFASI_EDIT: ::DWORD = 0x0001; +pub const OFASI_OPENDESKTOP: ::DWORD = 0x0002; +// 1204 +pub const CSIDL_DESKTOP: ::c_int = 0x0000; +pub const CSIDL_INTERNET: ::c_int = 0x0001; +pub const CSIDL_PROGRAMS: ::c_int = 0x0002; +pub const CSIDL_CONTROLS: ::c_int = 0x0003; +pub const CSIDL_PRINTERS: ::c_int = 0x0004; +pub const CSIDL_PERSONAL: ::c_int = 0x0005; +pub const CSIDL_FAVORITES: ::c_int = 0x0006; +pub const CSIDL_STARTUP: ::c_int = 0x0007; +pub const CSIDL_RECENT: ::c_int = 0x0008; +pub const CSIDL_SENDTO: ::c_int = 0x0009; +pub const CSIDL_BITBUCKET: ::c_int = 0x000a; +pub const CSIDL_STARTMENU: ::c_int = 0x000b; +pub const CSIDL_MYDOCUMENTS: ::c_int = CSIDL_PERSONAL; +pub const CSIDL_MYMUSIC: ::c_int = 0x000d; +pub const CSIDL_MYVIDEO: ::c_int = 0x000e; +pub const CSIDL_DESKTOPDIRECTORY: ::c_int = 0x0010; +pub const CSIDL_DRIVES: ::c_int = 0x0011; +pub const CSIDL_NETWORK: ::c_int = 0x0012; +pub const CSIDL_NETHOOD: ::c_int = 0x0013; +pub const CSIDL_FONTS: ::c_int = 0x0014; +pub const CSIDL_TEMPLATES: ::c_int = 0x0015; +pub const CSIDL_COMMON_STARTMENU: ::c_int = 0x0016; +pub const CSIDL_COMMON_PROGRAMS: ::c_int = 0x0017; +pub const CSIDL_COMMON_STARTUP: ::c_int = 0x0018; +pub const CSIDL_COMMON_DESKTOPDIRECTORY: ::c_int = 0x0019; +pub const CSIDL_APPDATA: ::c_int = 0x001a; +pub const CSIDL_PRINTHOOD: ::c_int = 0x001b; +pub const CSIDL_LOCAL_APPDATA: ::c_int = 0x001c; +pub const CSIDL_ALTSTARTUP: ::c_int = 0x001d; +pub const CSIDL_COMMON_ALTSTARTUP: ::c_int = 0x001e; +pub const CSIDL_COMMON_FAVORITES: ::c_int = 0x001f; +pub const CSIDL_INTERNET_CACHE: ::c_int = 0x0020; +pub const CSIDL_COOKIES: ::c_int = 0x0021; +pub const CSIDL_HISTORY: ::c_int = 0x0022; +pub const CSIDL_COMMON_APPDATA: ::c_int = 0x0023; +pub const CSIDL_WINDOWS: ::c_int = 0x0024; +pub const CSIDL_SYSTEM: ::c_int = 0x0025; +pub const CSIDL_PROGRAM_FILES: ::c_int = 0x0026; +pub const CSIDL_MYPICTURES: ::c_int = 0x0027; +pub const CSIDL_PROFILE: ::c_int = 0x0028; +pub const CSIDL_SYSTEMX86: ::c_int = 0x0029; +pub const CSIDL_PROGRAM_FILESX86: ::c_int = 0x002a; +pub const CSIDL_PROGRAM_FILES_COMMON: ::c_int = 0x002b; +pub const CSIDL_PROGRAM_FILES_COMMONX86: ::c_int = 0x002c; +pub const CSIDL_COMMON_TEMPLATES: ::c_int = 0x002d; +pub const CSIDL_COMMON_DOCUMENTS: ::c_int = 0x002e; +pub const CSIDL_COMMON_ADMINTOOLS: ::c_int = 0x002f; +pub const CSIDL_ADMINTOOLS: ::c_int = 0x0030; +pub const CSIDL_CONNECTIONS: ::c_int = 0x0031; +pub const CSIDL_COMMON_MUSIC: ::c_int = 0x0035; +pub const CSIDL_COMMON_PICTURES: ::c_int = 0x0036; +pub const CSIDL_COMMON_VIDEO: ::c_int = 0x0037; +pub const CSIDL_RESOURCES: ::c_int = 0x0038; +pub const CSIDL_RESOURCES_LOCALIZED: ::c_int = 0x0039; +pub const CSIDL_COMMON_OEM_LINKS: ::c_int = 0x003a; +pub const CSIDL_CDBURN_AREA: ::c_int = 0x003b; +pub const CSIDL_COMPUTERSNEARME: ::c_int = 0x003d; +pub const CSIDL_FLAG_CREATE: ::c_int = 0x8000; +pub const CSIDL_FLAG_DONT_VERIFY: ::c_int = 0x4000; +pub const CSIDL_FLAG_DONT_UNEXPAND: ::c_int = 0x2000; +pub const CSIDL_FLAG_NO_ALIAS: ::c_int = 0x1000; +pub const CSIDL_FLAG_PER_USER_INIT: ::c_int = 0x0800; +pub const CSIDL_FLAG_MASK: ::c_int = 0xff00; +//1312 +pub const SHGFP_TYPE_CURRENT: ::DWORD = 0; +pub const SHGFP_TYPE_DEFAULT: ::DWORD = 1; diff --git a/third_party/rust/winapi/src/shobjidl.rs b/third_party/rust/winapi/src/shobjidl.rs new file mode 100644 index 000000000000..ef7caa1c375d --- /dev/null +++ b/third_party/rust/winapi/src/shobjidl.rs @@ -0,0 +1,652 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! this ALWAYS GENERATED file contains the definitions for the interfaces +//Terrible forward declarations that need to be filled in +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IContextMenu; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IContextMenu2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IContextMenu3; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExecuteCommand; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPersistFolder; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IRunnableTask; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellTaskScheduler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IQueryCodePage; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPersistFolder2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPersistFolder3; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPersistIDList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumIDList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumFullIDList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFileSyncMergeHandler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IObjectWithFolderEnumMode; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IParseAndCreateItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellFolder; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumExtraSearch; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellFolder2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderViewOptions; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellView; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellView2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellView3; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderView; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ISearchBoxInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderView2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderViewSettings; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPreviewHandlerVisuals; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IVisualProperties; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICommDlgBrowser; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICommDlgBrowser2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICommDlgBrowser3; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IColumnManager; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderFilterSite; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderFilter; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInputObjectSite; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInputObject; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInputObject2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellIcon; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellBrowser; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IProfferService; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellItem2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellItemImageFactory; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IUserAccountChangeCallback; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumShellItems; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITransferAdviseSink; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITransferSource; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumResources; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellItemResources; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITransferDestination; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IStreamAsync; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IStreamUnbufferedInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInitializeWithItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IObjectWithSelection; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IObjectWithBackReferences; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPropertyUI; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICategoryProvider; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICategorizer; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDropTargetHelper; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDragSourceHelper; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDragSourceHelper2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellLinkA; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellLinkW; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellLinkDataList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IResolveShellLink; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IActionProgressDialog; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IHWEventHandler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IHWEventHandler2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IQueryCancelAutoPlay; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDynamicHWHandler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IActionProgress; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellExtInit; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellPropSheetExt; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IRemoteComputer; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IQueryContinue; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IObjectWithCancelEvent; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IUserNotification; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IUserNotificationCallback; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IUserNotification2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IItemNameLimits; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ISearchFolderItemFactory; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExtractImage; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExtractImage2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IThumbnailHandlerFactory; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IParentAndItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDockingWindow; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDeskBand; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDeskBandInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDeskBand2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITaskbarList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITaskbarList2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITaskbarList3; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITaskbarList4; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IStartMenuPinnedList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICDBurn; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IWizardSite; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IWizardExtension; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IWebWizardExtension; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPublishingWizard; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderViewHost; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExplorerBrowserEvents; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExplorerBrowser; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAccessibleObject; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IResultsFolder; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumObjects; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IOperationsProgressDialog; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IIOCancelInformation; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFileOperation; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IObjectProvider; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INamespaceWalkCB; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INamespaceWalkCB2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INamespaceWalk; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAutoCompleteDropDown; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IBandSite; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICDBurnExt; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IContextMenuSite; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumReadyCallback; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumerableView; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInsertItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IMenuBand; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFolderBandPriv; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IRegTreeItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IImageRecompress; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDeskBar; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IMenuPopup; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFileIsInUse; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IApplicationAssociationRegistration; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IApplicationAssociationRegistrationUI; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDelegateFolder; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IBrowserFrameOptions; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INewWindowManager; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAttachmentExecute; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellMenuCallback; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellMenu; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellRunDll; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IKnownFolder; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IKnownFolderManager; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ISharingConfigurationManager; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPreviousVersionsInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IRelatedItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IIdentityName; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDelegateItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICurrentItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITransferMediumItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IUseToBrowseItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDisplayItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IViewStateIdentityItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPreviewItem; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDestinationStreamFactory; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INewMenuClient; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInitializeWithBindCtx; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INameSpaceTreeControl; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INameSpaceTreeControl2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INameSpaceTreeControlEvents; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INameSpaceTreeControlDropHandler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INameSpaceTreeAccessible; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INameSpaceTreeControlCustomDraw; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct INameSpaceTreeControlFolderCapabilities; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPreviewHandler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPreviewHandlerFrame; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ITrayDeskBand; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IBandHost; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExplorerPaneVisibility; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IContextMenuCB; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDefaultExtractIconInit; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExplorerCommand; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExplorerCommandState; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInitializeCommand; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumExplorerCommand; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExplorerCommandProvider; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IMarkupCallback; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IControlMarkup; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInitializeNetworkFolder; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IOpenControlPanel; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IComputerInfoChangeNotify; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFileSystemBindData; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFileSystemBindData2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ICustomDestinationList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IApplicationDestinations; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IApplicationDocumentLists; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IObjectWithAppUserModelID; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IObjectWithProgID; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IUpdateIDList; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDesktopGadget; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDesktopWallpaper; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IHomeGroup; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInitializeWithPropertyStore; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IOpenSearchSource; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IShellLibrary; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDefaultFolderMenuInitialize; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IApplicationActivationManager; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAssocHandlerInvoker; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAssocHandler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IEnumAssocHandlers; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDataObjectProvider; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IDataTransferManagerInterop; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFrameworkInputPaneHandler; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IFrameworkInputPane; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAccessibilityDockingServiceCallback; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAccessibilityDockingService; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAppVisibilityEvents; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IAppVisibility; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPackageExecutionStateChangeNotification; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IPackageDebugSettings; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ISuspensionDependencyManager; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExecuteCommandApplicationHostEnvironment; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IExecuteCommandHost; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IApplicationDesignModeSettings; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IApplicationDesignModeSettings2; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ILaunchTargetMonitor; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ILaunchSourceViewSizePreference; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ILaunchTargetViewSizePreference; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct ILaunchSourceAppUserModelId; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInitializeWithWindow; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IHandlerInfo; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IHandlerActivationHost; +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IContactManagerInterop; +//4498 +pub type SFGAOF = ::ULONG; +//9466 +ENUM!{enum SIGDN { + SIGDN_NORMALDISPLAY = 0, + SIGDN_PARENTRELATIVEPARSING = 0x80018001, + SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000, + SIGDN_PARENTRELATIVEEDITING = 0x80031001, + SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000, + SIGDN_FILESYSPATH = 0x80058000, + SIGDN_URL = 0x80068000, + SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8007c001, + SIGDN_PARENTRELATIVE = 0x80080001, + SIGDN_PARENTRELATIVEFORUI = 0x80094001, +}} +ENUM!{enum SICHINTF { + SICHINT_DISPLAY = 0, + SICHINT_ALLFIELDS = 0x80000000, + SICHINT_CANONICAL = 0x10000000, + SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000, +}} +//9498 +RIDL!( +interface IShellItem(IShellItemVtbl): IUnknown(IUnknownVtbl) { + fn BindToHandler( + &mut self, pbc: *mut ::IBindCtx, bhid: ::REFGUID, riid: ::REFIID, ppv: *mut *mut ::c_void + ) -> ::HRESULT, + fn GetParent(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, + fn GetDisplayName(&mut self, sigdnName: SIGDN, ppszName: *mut ::LPWSTR) -> ::HRESULT, + fn GetAttributes(&mut self, sfgaoMask: SFGAOF, psfgaoAttribs: *mut SFGAOF) -> ::HRESULT, + fn Compare(&mut self, psi: *mut IShellItem, hint: SICHINTF, piOrder: *mut ::c_int) -> ::HRESULT +} +); +//11963 +pub type IFileOperationProgressSink = ::IUnknown; // TODO +pub type IShellItemArray = ::IUnknown; // TODO +//20869 +RIDL!( +interface IModalWindow(IModalWindowVtbl): IUnknown(IUnknownVtbl) { + fn Show(&mut self, hwndOwner: ::HWND) -> ::HRESULT +} +); +//22307 +ENUM!{enum FDE_OVERWRITE_RESPONSE { + FDEOR_DEFAULT = 0, + FDEOR_ACCEPT = 1, + FDEOR_REFUSE = 2, +}} +ENUM!{enum FDE_SHAREVIOLATION_RESPONSE { + FDESVR_DEFAULT = 0, + FDESVR_ACCEPT = 1, + FDESVR_REFUSE = 2, +}} +ENUM!{enum FDAP { + FDAP_BOTTOM = 0, + FDAP_TOP = 1, +}} +RIDL!( +interface IFileDialogEvents(IFileDialogEventsVtbl): IUnknown(IUnknownVtbl) { + fn OnFileOk(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, + fn OnFolderChanging(&mut self, pfd: *mut IFileDialog, psiFolder: *mut IShellItem) -> ::HRESULT, + fn OnFolderChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, + fn OnSelectionChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, + fn OnShareViolation( + &mut self, pfd: *mut IFileDialog, psi: *mut IShellItem, + pResponse: *mut FDE_SHAREVIOLATION_RESPONSE + ) -> ::HRESULT, + fn OnTypeChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, + fn OnOverwrite( + &mut self, pfd: *mut IFileDialog, psi: *mut IShellItem, + pResponse: *mut FDE_OVERWRITE_RESPONSE + ) -> ::HRESULT +} +); +FLAGS!{enum FILEOPENDIALOGOPTIONS { + FOS_OVERWRITEPROMPT = 0x2, + FOS_STRICTFILETYPES = 0x4, + FOS_NOCHANGEDIR = 0x8, + FOS_PICKFOLDERS = 0x20, + FOS_FORCEFILESYSTEM = 0x40, + FOS_ALLNONSTORAGEITEMS = 0x80, + FOS_NOVALIDATE = 0x100, + FOS_ALLOWMULTISELECT = 0x200, + FOS_PATHMUSTEXIST = 0x800, + FOS_FILEMUSTEXIST = 0x1000, + FOS_CREATEPROMPT = 0x2000, + FOS_SHAREAWARE = 0x4000, + FOS_NOREADONLYRETURN = 0x8000, + FOS_NOTESTFILECREATE = 0x10000, + FOS_HIDEMRUPLACES = 0x20000, + FOS_HIDEPINNEDPLACES = 0x40000, + FOS_NODEREFERENCELINKS = 0x100000, + FOS_DONTADDTORECENT = 0x2000000, + FOS_FORCESHOWHIDDEN = 0x10000000, + FOS_DEFAULTNOMINIMODE = 0x20000000, + FOS_FORCEPREVIEWPANEON = 0x40000000, + FOS_SUPPORTSTREAMABLEITEMS = 0x80000000, +}} +RIDL!( +interface IFileDialog(IFileDialogVtbl): IModalWindow(IModalWindowVtbl) { + fn SetFileTypes( + &mut self, cFileTypes: ::UINT, rgFilterSpec: *const ::COMDLG_FILTERSPEC + ) -> ::HRESULT, + fn SetFileTypeIndex(&mut self, iFileType: ::UINT) -> ::HRESULT, + fn GetFileTypeIndex(&mut self, piFileType: *mut ::UINT) -> ::HRESULT, + fn Advise(&mut self, pfde: *mut IFileDialogEvents, pdwCookie: *mut ::DWORD) -> ::HRESULT, + fn Unadvise(&mut self, dwCookie: ::DWORD) -> ::HRESULT, + fn SetOptions(&mut self, fos: FILEOPENDIALOGOPTIONS) -> ::HRESULT, + fn GetOptions(&mut self, pfos: *mut FILEOPENDIALOGOPTIONS) -> ::HRESULT, + fn SetDefaultFolder(&mut self, psi: *mut IShellItem) -> ::HRESULT, + fn SetFolder(&mut self, psi: *mut IShellItem) -> ::HRESULT, + fn GetFolder(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, + fn GetCurrentSelection(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, + fn SetFileName(&mut self, pszName: ::LPCWSTR) -> ::HRESULT, + fn GetFileName(&mut self, pszName: *mut ::LPWSTR) -> ::HRESULT, + fn SetTitle(&mut self, pszTitle: ::LPCWSTR) -> ::HRESULT, + fn SetOkButtonLabel(&mut self, pszText: ::LPCWSTR) -> ::HRESULT, + fn SetFileNameLabel(&mut self, pszLabel: ::LPCWSTR) -> ::HRESULT, + fn GetResult(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, + fn AddPlace(&mut self, psi: *mut IShellItem, fdap: FDAP) -> ::HRESULT, + fn SetDefaultExtension(&mut self, pszDefaultExtension: ::LPCWSTR) -> ::HRESULT, + fn Close(&mut self, hr: ::HRESULT) -> ::HRESULT, + fn SetClientGuid(&mut self, guid: ::REFGUID) -> ::HRESULT, + fn ClearClientData(&mut self) -> ::HRESULT, + fn SetFilter(&mut self, pFilter: *mut IShellItemFilter) -> ::HRESULT +} +); +RIDL!( +interface IFileSaveDialog(IFileSaveDialogVtbl): IFileDialog(IFileDialogVtbl) { + fn SetSaveAsItem(&mut self, psi: *mut IShellItem) -> ::HRESULT, + fn SetProperties(&mut self, pStore: *mut ::IPropertyStore) -> ::HRESULT, + fn SetCollectedProperties( + &mut self, pList: *mut ::IPropertyDescriptionList, fAppendDefault: ::BOOL + ) -> ::HRESULT, + fn GetProperties(&mut self, ppStore: *mut *mut ::IPropertyStore) -> ::HRESULT, + fn ApplyProperties( + &mut self, psi: *mut IShellItem, pStore: *mut ::IPropertyStore, hwnd: ::HWND, + pSink: *mut IFileOperationProgressSink + ) -> ::HRESULT +} +); +RIDL!( +interface IFileOpenDialog(IFileOpenDialogVtbl): IFileDialog(IFileDialogVtbl) { + fn GetResults(&mut self, ppenum: *mut *mut IShellItemArray) -> ::HRESULT, + fn GetSelectedItems(&mut self, ppsai: *mut *mut IShellItemArray) -> ::HRESULT +} +); +ENUM!{enum CDCONTROLSTATE { + CDCS_INACTIVE = 0x00000000, + CDCS_ENABLED = 0x00000001, + CDCS_VISIBLE = 0x00000002, + CDCS_ENABLEDVISIBLE = 0x00000003, +}} +RIDL!( +interface IFileDialogCustomize(IFileDialogCustomizeVtbl): IUnknown(IUnknownVtbl) { + fn EnableOpenDropDown(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, + fn AddMenu(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, + fn AddPushButton(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, + fn AddComboBox(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, + fn AddRadioButtonList(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, + fn AddCheckButton( + &mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR, bChecked: ::BOOL + ) -> ::HRESULT, + fn AddEditBox(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT, + fn AddSeparator(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, + fn AddText(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT, + fn SetControlLabel(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, + fn GetControlState(&mut self, dwIDCtl: ::DWORD, pdwState: *mut CDCONTROLSTATE) -> ::HRESULT, + fn SetControlState(&mut self, dwIDCtl: ::DWORD, dwState: CDCONTROLSTATE) -> ::HRESULT, + fn GetEditBoxText(&mut self, dwIDCtl: ::DWORD, ppszText: *mut *mut ::WCHAR) -> ::HRESULT, + fn SetEditBoxText(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT, + fn GetCheckButtonState(&mut self, dwIDCtl: ::DWORD, pbChecked: *mut ::BOOL) -> ::HRESULT, + fn SetCheckButtonState(&mut self, dwIDCtl: ::DWORD, bChecked: ::BOOL) -> ::HRESULT, + fn AddControlItem( + &mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pszLabel: ::LPCWSTR + ) -> ::HRESULT, + fn RemoveControlItem(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD) -> ::HRESULT, + fn RemoveAllControlItems(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, + fn GetControlItemState( + &mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pdwState: *mut CDCONTROLSTATE + ) -> ::HRESULT, + fn SetControlItemState( + &mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, dwState: CDCONTROLSTATE + ) -> ::HRESULT, + fn GetSelectedControlItem(&mut self, dwIDCtl: ::DWORD, pdwIDItem: *mut ::DWORD) -> ::HRESULT, + fn SetSelectedControlItem(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD) -> ::HRESULT, + fn StartVisualGroup(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, + fn EndVisualGroup(&mut self) -> ::HRESULT, + fn MakeProminent(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, + fn SetControlItemText(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT +} +); +RIDL!( +interface IFileDialogControlEvents(IFileDialogControlEventsVtbl): IUnknown(IUnknownVtbl) { + fn OnItemSelected( + &mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD, dwIDItem: ::DWORD + ) -> ::HRESULT, + fn OnButtonClicked(&mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD) -> ::HRESULT, + fn OnCheckButtonToggled( + &mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD, bChecked: ::BOOL + ) -> ::HRESULT, + fn OnControlActivating( + &mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD + ) -> ::HRESULT +} +); +RIDL!( +interface IFileDialog2(IFileDialog2Vtbl): IFileDialog(IFileDialogVtbl) { + fn SetCancelButtonLabel(&mut self, pszLabel: ::LPCWSTR) -> ::HRESULT, + fn SetNavigationRoot(&mut self, psi: IShellItem) -> ::HRESULT +} +); +//27457 +pub type IShellItemFilter = ::IUnknown; // TODO diff --git a/third_party/rust/winapi/src/shtypes.rs b/third_party/rust/winapi/src/shtypes.rs new file mode 100644 index 000000000000..0bea4b1f7084 --- /dev/null +++ b/third_party/rust/winapi/src/shtypes.rs @@ -0,0 +1,40 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! this ALWAYS GENERATED file contains the definitions for the interfaces +#[repr(C)] #[allow(missing_copy_implementations)] +pub struct SHITEMID { + pub cb: ::USHORT, + pub abID: [::BYTE; 0], +} +pub type LPSHITEMID = *mut SHITEMID; +pub type LPCSHITEMID = *const SHITEMID; +#[repr(C)] +pub struct ITEMIDLIST { + pub mkid: SHITEMID, +} +pub type ITEMIDLIST_RELATIVE = ITEMIDLIST; +pub type ITEMID_CHILD = ITEMIDLIST; +pub type ITEMIDLIST_ABSOLUTE = ITEMIDLIST; +pub type LPITEMIDLIST = *mut ITEMIDLIST; +pub type LPCITEMIDLIST = *const ITEMIDLIST; +pub type PIDLIST_ABSOLUTE = *mut ITEMIDLIST_ABSOLUTE; +pub type PCIDLIST_ABSOLUTE = *const ITEMIDLIST_ABSOLUTE; +pub type PCUIDLIST_ABSOLUTE = *const ITEMIDLIST_ABSOLUTE; +pub type PIDLIST_RELATIVE = *mut ITEMIDLIST_RELATIVE; +pub type PCIDLIST_RELATIVE = *const ITEMIDLIST_RELATIVE; +pub type PUIDLIST_RELATIVE = *mut ITEMIDLIST_RELATIVE; +pub type PCUIDLIST_RELATIVE = *const ITEMIDLIST_RELATIVE; +pub type PITEMID_CHILD = *mut ITEMID_CHILD; +pub type PCITEMID_CHILD = *const ITEMID_CHILD; +pub type PUITEMID_CHILD = *mut ITEMID_CHILD; +pub type PCUITEMID_CHILD = *const ITEMID_CHILD; +pub type PCUITEMID_CHILD_ARRAY = *const PCUITEMID_CHILD; +pub type PCUIDLIST_RELATIVE_ARRAY = *const PCUIDLIST_RELATIVE; +pub type PCIDLIST_ABSOLUTE_ARRAY = *const PCIDLIST_ABSOLUTE; +pub type PCUIDLIST_ABSOLUTE_ARRAY = *const PCUIDLIST_ABSOLUTE; +STRUCT!{struct COMDLG_FILTERSPEC { + pszName: ::LPCWSTR, + pszSpec: ::LPCWSTR, +}} +pub type KNOWNFOLDERID = ::GUID; +pub type REFKNOWNFOLDERID = *const KNOWNFOLDERID; diff --git a/third_party/rust/winapi/src/spapidef.rs b/third_party/rust/winapi/src/spapidef.rs new file mode 100644 index 000000000000..05861ddc800e --- /dev/null +++ b/third_party/rust/winapi/src/spapidef.rs @@ -0,0 +1,48 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Windows NT Setup and Device Installer services +pub type SP_LOG_TOKEN = ::DWORDLONG; +pub type PSP_LOG_TOKEN = *mut ::DWORDLONG; +pub const LOGTOKEN_TYPE_MASK: SP_LOG_TOKEN = 3; +pub const LOGTOKEN_UNSPECIFIED: SP_LOG_TOKEN = 0; +pub const LOGTOKEN_NO_LOG: SP_LOG_TOKEN = 1; +pub const LOGTOKEN_SETUPAPI_APPLOG: SP_LOG_TOKEN = 2; +pub const LOGTOKEN_SETUPAPI_DEVLOG: SP_LOG_TOKEN = 3; +pub const TXTLOG_SETUPAPI_DEVLOG: ::DWORD = 0x00000001; +pub const TXTLOG_SETUPAPI_CMDLINE: ::DWORD = 0x00000002; +pub const TXTLOG_SETUPAPI_BITS: ::DWORD = 0x00000003; +pub const TXTLOG_ERROR: ::DWORD = 0x1; +pub const TXTLOG_WARNING: ::DWORD = 0x2; +pub const TXTLOG_SYSTEM_STATE_CHANGE: ::DWORD = 0x3; +pub const TXTLOG_SUMMARY: ::DWORD = 0x4; +pub const TXTLOG_DETAILS: ::DWORD = 0x5; +pub const TXTLOG_VERBOSE: ::DWORD = 0x6; +pub const TXTLOG_VERY_VERBOSE: ::DWORD = 0x7; +pub const TXTLOG_RESERVED_FLAGS: ::DWORD = 0x0000FFF0; +pub const TXTLOG_TIMESTAMP: ::DWORD = 0x00010000; +pub const TXTLOG_DEPTH_INCR: ::DWORD = 0x00020000; +pub const TXTLOG_DEPTH_DECR: ::DWORD = 0x00040000; +pub const TXTLOG_TAB_1: ::DWORD = 0x00080000; +pub const TXTLOG_FLUSH_FILE: ::DWORD = 0x00100000; +#[inline] #[allow(dead_code)] +pub fn TXTLOG_LEVEL(flags: ::DWORD) -> ::DWORD { + return flags & 0xf; +} +pub const TXTLOG_DEVINST: ::DWORD = 0x00000001; +pub const TXTLOG_INF: ::DWORD = 0x00000002; +pub const TXTLOG_FILEQ: ::DWORD = 0x00000004; +pub const TXTLOG_COPYFILES: ::DWORD = 0x00000008; +pub const TXTLOG_SIGVERIF: ::DWORD = 0x00000020; +pub const TXTLOG_BACKUP: ::DWORD = 0x00000080; +pub const TXTLOG_UI: ::DWORD = 0x00000100; +pub const TXTLOG_UTIL: ::DWORD = 0x00000200; +pub const TXTLOG_INFDB: ::DWORD = 0x00000400; +pub const TXTLOG_POLICY: ::DWORD = 0x00800000; +pub const TXTLOG_NEWDEV: ::DWORD = 0x01000000; +pub const TXTLOG_UMPNPMGR: ::DWORD = 0x02000000; +pub const TXTLOG_DRIVER_STORE: ::DWORD = 0x04000000; +pub const TXTLOG_SETUP: ::DWORD = 0x08000000; +pub const TXTLOG_CMI: ::DWORD = 0x10000000; +pub const TXTLOG_DEVMGR: ::DWORD = 0x20000000; +pub const TXTLOG_INSTALLER: ::DWORD = 0x40000000; +pub const TXTLOG_VENDOR: ::DWORD = 0x80000000; diff --git a/third_party/rust/winapi/src/sql.rs b/third_party/rust/winapi/src/sql.rs new file mode 100644 index 000000000000..503fa8162944 --- /dev/null +++ b/third_party/rust/winapi/src/sql.rs @@ -0,0 +1,179 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub const SQL_NULL_DATA: SQLLEN = -1; +pub const SQL_DATA_AT_EXEC: SQLLEN = -2; +pub const SQL_SUCCESS: SQLRETURN = 0; +pub const SQL_SUCCESS_WITH_INFO: SQLRETURN = 1; +pub const SQL_NO_DATA: SQLRETURN = 100; +pub const SQL_PARAM_DATA_AVAILABLE: SQLRETURN = 101; +pub const SQL_ERROR: SQLRETURN = -1; +pub const SQL_INVALID_HANDLE: SQLRETURN = -2; +pub const SQL_STILL_EXECUTING: SQLRETURN = 2; +pub const SQL_NEED_DATA: SQLRETURN = 99; +pub const SQL_NTS: SQLSMALLINT = -3; +pub const SQL_MAX_MESSAGE_LENGTH: usize = 512; +pub const SQL_DATE_LEN: usize = 10; +pub const SQL_TIME_LEN: usize = 8; +pub const SQL_TIMESTAMP_LEN: usize = 19; +pub const SQL_HANDLE_ENV: SQLSMALLINT = 1; +pub const SQL_HANDLE_DBC: SQLSMALLINT = 2; +pub const SQL_HANDLE_STMT: SQLSMALLINT = 3; +pub const SQL_HANDLE_DESC: SQLSMALLINT = 4; +pub const SQL_ATTR_OUTPUT_NTS: SQLINTEGER = 10001; +pub const SQL_ATTR_AUTO_IPD: SQLINTEGER = 10001; +pub const SQL_ATTR_METADATA_ID: SQLINTEGER = 10014; +pub const SQL_ATTR_APP_ROW_DESC: SQLINTEGER = 10010; +pub const SQL_ATTR_APP_PARAM_DESC: SQLINTEGER = 10011; +pub const SQL_ATTR_IMP_ROW_DESC: SQLINTEGER = 10012; +pub const SQL_ATTR_IMP_PARAM_DESC: SQLINTEGER = 10013; +pub const SQL_ATTR_CURSOR_SCROLLABLE: SQLINTEGER = -1; +pub const SQL_ATTR_CURSOR_SENSITIVITY: SQLINTEGER = -2; + +//Null handle used in place of parent handle when allocating HENV +pub const SQL_NULL_HANDLE: SQLHANDLE = 0 as SQLHANDLE; + +//Special length/indicator values + +//Return values from functions + + +//Values of NULLABLE field in descriptor +pub const SQL_NO_NULLS: SQLSMALLINT = 0; +pub const SQL_NULLABLE: SQLSMALLINT = 1; +pub const SQL_NULLABLE_UNKNOWN: SQLSMALLINT = 2; + +//Env attribute +pub const SQL_ATTR_ODBC_VERSION: SQLINTEGER = 200; +pub const SQL_ATTR_CONNECTION_POOLING: SQLINTEGER = 201; +pub const SQL_ATTR_CP_MATCH: SQLINTEGER = 202; + +//Values for SQL_ATTR_ODBC_VERSION +pub const SQL_OV_ODBC2: SQLINTEGER = 2; +pub const SQL_OV_ODBC3: SQLINTEGER = 3; +pub const SQL_OV_ODBC3_80: SQLINTEGER = 380; + +//Connection attributes +pub const SQL_ACCESS_MODE: SQLINTEGER = 101; +pub const SQL_AUTOCOMMIT: SQLINTEGER = 102; +pub const SQL_LOGIN_TIMEOUT: SQLINTEGER = 103; +pub const SQL_OPT_TRACE: SQLINTEGER = 104; +pub const SQL_OPT_TRACEFILE: SQLINTEGER = 105; +pub const SQL_TRANSLATE_DLL: SQLINTEGER = 106; +pub const SQL_TRANSLATE_OPTION: SQLINTEGER = 107; +pub const SQL_TXN_ISOLATION: SQLINTEGER = 108; +pub const SQL_CURRENT_QUALIFIER: SQLINTEGER = 109; +pub const SQL_ODBC_CURSORS: SQLINTEGER = 110; +pub const SQL_QUIET_MODE: SQLINTEGER = 111; +pub const SQL_PACKET_SIZE: SQLINTEGER = 112; + +//Connection attributes with new names +pub const SQL_ATTR_ACCESS_MODE: SQLINTEGER = SQL_ACCESS_MODE; +pub const SQL_ATTR_AUTOCOMMIT: SQLINTEGER = SQL_AUTOCOMMIT; +pub const SQL_ATTR_CONNECTION_TIMEOUT: SQLINTEGER = 113; +pub const SQL_ATTR_CURRENT_CATALOG: SQLINTEGER = SQL_CURRENT_QUALIFIER; +pub const SQL_ATTR_DISCONNECT_BEHAVIOR: SQLINTEGER = 114; +pub const SQL_ATTR_ENLIST_IN_DTC: SQLINTEGER = 1207; +pub const SQL_ATTR_ENLIST_IN_XA: SQLINTEGER = 1208; +pub const SQL_ATTR_LOGIN_TIMEOUT: SQLINTEGER = SQL_LOGIN_TIMEOUT; +pub const SQL_ATTR_ODBC_CURSORS: SQLINTEGER = SQL_ODBC_CURSORS; +pub const SQL_ATTR_PACKET_SIZE: SQLINTEGER = SQL_PACKET_SIZE; +pub const SQL_ATTR_QUIET_MODE: SQLINTEGER = SQL_QUIET_MODE; +pub const SQL_ATTR_TRACE: SQLINTEGER = SQL_OPT_TRACE; +pub const SQL_ATTR_TRACEFILE: SQLINTEGER = SQL_OPT_TRACEFILE; +pub const SQL_ATTR_TRANSLATE_LIB: SQLINTEGER = SQL_TRANSLATE_DLL; +pub const SQL_ATTR_TRANSLATE_OPTION: SQLINTEGER = SQL_TRANSLATE_OPTION; +pub const SQL_ATTR_TXN_ISOLATION: SQLINTEGER = SQL_TXN_ISOLATION; +pub const SQL_ATTR_CONNECTION_DEAD: SQLINTEGER = 1209; + +//Flags for null-terminated string +pub const SQL_NTS: SQLSMALLINT = -3; + +//Options for SQLDriverConnect +pub const SQL_DRIVER_NOPROMPT: SQLUSMALLINT = 0; +pub const SQL_DRIVER_COMPLETE: SQLUSMALLINT = 1; +pub const SQL_DRIVER_PROMPT: SQLUSMALLINT = 2; +pub const SQL_DRIVER_COMPLETE_REQUIRED: SQLUSMALLINT = 3; + +//Whether an attribute is a pointer or not +pub const SQL_IS_POINTER: SQLINTEGER = -4; +pub const SQL_IS_UINTEGER: SQLINTEGER = -5; +pub const SQL_IS_INTEGER: SQLINTEGER = -6; +pub const SQL_IS_USMALLINT: SQLINTEGER = -7; +pub const SQL_IS_SMALLINT: SQLINTEGER = -8; + +//FreeStmt options +pub const SQL_CLOSE: SQLUSMALLINT = 0; +pub const SQL_DROP: SQLUSMALLINT = 1; +pub const SQL_UNBIND: SQLUSMALLINT = 2; +pub const SQL_RESET_PARAMS: SQLUSMALLINT = 3; + +//C datatype to SQL datatype mapping +pub const SQL_UNKNOWN_TYPE: SQLSMALLINT = 0; +pub const SQL_CHAR: SQLSMALLINT = 1; +pub const SQL_NUMERIC: SQLSMALLINT = 2; +pub const SQL_DECIMAL: SQLSMALLINT = 3; +pub const SQL_INTEGER: SQLSMALLINT = 4; +pub const SQL_SMALLINT: SQLSMALLINT = 5; +pub const SQL_FLOAT: SQLSMALLINT = 6; +pub const SQL_REAL: SQLSMALLINT = 7; +pub const SQL_DOUBLE: SQLSMALLINT = 8; +pub const SQL_DATETIME: SQLSMALLINT = 9; +pub const SQL_VARCHAR: SQLSMALLINT = 12; + +pub const SQL_TYPE_DATE: SQLSMALLINT = 91; +pub const SQL_TYPE_TIME: SQLSMALLINT = 92; +pub const SQL_TYPE_TIMESTAMP: SQLSMALLINT = 93; + +pub const SQL_DATE: SQLSMALLINT = 9; +pub const SQL_INTERVAL: SQLSMALLINT = 10; +pub const SQL_TIME: SQLSMALLINT = 10; +pub const SQL_TIMESTAMP: SQLSMALLINT = 11; +pub const SQL_LONGVARCHAR: SQLSMALLINT = -1; +pub const SQL_BINARY: SQLSMALLINT = -2; +pub const SQL_VARBINARY: SQLSMALLINT = -3; +pub const SQL_LONGVARBINARY: SQLSMALLINT = -4; +pub const SQL_BIGINT: SQLSMALLINT = -5; +pub const SQL_TINYINT: SQLSMALLINT = -6; +pub const SQL_BIT: SQLSMALLINT = -7; +pub const SQL_GUID: SQLSMALLINT = -11; + +pub const SQL_C_CHAR: SQLSMALLINT = SQL_CHAR; +pub const SQL_C_LONG: SQLSMALLINT = SQL_INTEGER; +pub const SQL_C_SHORT: SQLSMALLINT = SQL_SMALLINT; +pub const SQL_C_FLOAT: SQLSMALLINT = SQL_REAL; +pub const SQL_C_DOUBLE: SQLSMALLINT = SQL_DOUBLE; +pub const SQL_C_NUMERIC: SQLSMALLINT = SQL_NUMERIC; +pub const SQL_C_DEFAULT: SQLSMALLINT = 99; + +pub const SQL_SIGNED_OFFSET: SQLSMALLINT = -20; +pub const SQL_UNSIGNED_OFFSET: SQLSMALLINT = -22; + +pub const SQL_C_DATE: SQLSMALLINT = SQL_DATE; +pub const SQL_C_TIME: SQLSMALLINT = SQL_TIME; +pub const SQL_C_TIMESTAMP: SQLSMALLINT = SQL_TIMESTAMP; + +pub const SQL_C_TYPE_DATE: SQLSMALLINT = SQL_TYPE_DATE; +pub const SQL_C_TYPE_TIME: SQLSMALLINT = SQL_TYPE_TIME; +pub const SQL_C_TYPE_TIMESTAMP: SQLSMALLINT = SQL_TYPE_TIMESTAMP; + +pub const SQL_C_BINARY: SQLSMALLINT = SQL_BINARY; +pub const SQL_C_BIT: SQLSMALLINT = SQL_BIT; +pub const SQL_C_SBIGINT: SQLSMALLINT = SQL_BIGINT + SQL_SIGNED_OFFSET; +pub const SQL_C_UBIGINT: SQLSMALLINT = SQL_BIGINT + SQL_UNSIGNED_OFFSET; +pub const SQL_C_TINYINT: SQLSMALLINT = SQL_TINYINT; +pub const SQL_C_SLONG: SQLSMALLINT = SQL_C_LONG + SQL_SIGNED_OFFSET; +pub const SQL_C_SSHORT: SQLSMALLINT = SQL_C_SHORT + SQL_SIGNED_OFFSET; +pub const SQL_C_STINYINT: SQLSMALLINT = SQL_TINYINT + SQL_SIGNED_OFFSET; +pub const SQL_C_ULONG: SQLSMALLINT = SQL_C_LONG + SQL_UNSIGNED_OFFSET; +pub const SQL_C_USHORT: SQLSMALLINT = SQL_C_SHORT + SQL_UNSIGNED_OFFSET; +pub const SQL_C_UTINYINT: SQLSMALLINT = SQL_TINYINT + SQL_UNSIGNED_OFFSET; + +pub const SQL_C_GUID: SQLSMALLINT = SQL_GUID; + +pub const SQL_WCHAR: SQLSMALLINT = -8; +pub const SQL_WVARCHAR: SQLSMALLINT = -9; +pub const SQL_WLONGVARCHAR: SQLSMALLINT = -10; +pub const SQL_C_WCHAR: SQLSMALLINT = SQL_WCHAR; + +pub const SQL_TYPE_NULL: SQLSMALLINT = 0; + diff --git a/third_party/rust/winapi/src/sqltypes.rs b/third_party/rust/winapi/src/sqltypes.rs new file mode 100644 index 000000000000..a5ded3afcc09 --- /dev/null +++ b/third_party/rust/winapi/src/sqltypes.rs @@ -0,0 +1,130 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub type SQLCHAR = ::c_uchar; +pub type SQLSCHAR = ::c_schar; +pub type SQLDATE = ::c_uchar; +pub type SQLDECIMAL = ::c_uchar; +pub type SQLDOUBLE = ::c_double; +pub type SQLFLOAT = ::c_double; +pub type SQLINTEGER = ::c_long; +pub type SQLUINTEGER = ::c_ulong; +#[cfg(target_arch = "x86_64")] +pub type SQLLEN = ::INT64; +#[cfg(target_arch = "x86_64")] +pub type SQLULEN = ::UINT64; +#[cfg(target_arch = "x86_64")] +pub type SQLSETPOSIROW = ::UINT64; +#[cfg(target_arch = "x86")] +pub type SQLLEN = SQLINTEGER; +#[cfg(target_arch = "x86")] +pub type SQLULEN = SQLUINTEGER; +#[cfg(target_arch = "x86")] +pub type SQLSETPOSIROW = SQLUSMALLINT; +pub type SQLROWCOUNT = SQLULEN; +pub type SQLROWSETSIZE = SQLULEN; +pub type SQLTRANSID = SQLULEN; +pub type SQLROWOFFSET = SQLLEN; +pub type SQLNUMERIC = ::c_uchar; +pub type SQLPOINTER = *mut ::c_void; +pub type SQLREAL = ::c_float; +pub type SQLSMALLINT = ::c_short; +pub type SQLUSMALLINT = ::c_ushort; +pub type SQLTIME = ::c_uchar; +pub type SQLTIMESTAMP = ::c_uchar; +pub type SQLVARCHAR = ::c_uchar; +pub type SQLRETURN = SQLSMALLINT; +pub type SQLHANDLE = *mut ::c_void; +pub type SQLHENV = SQLHANDLE; +pub type SQLHDBC = SQLHANDLE; +pub type SQLHSTMT = SQLHANDLE; +pub type SQLHDESC = SQLHANDLE; +//pub type UCHAR = ::c_uchar; +pub type SCHAR = ::c_schar; +//pub type SQLSCHAR = SCHAR; +pub type SDWORD = ::c_long; +pub type SWORD = ::c_short; +pub type UDWORD = ::c_ulong; +//pub type UWORD = ::c_ushort; +//#[cfg(target_arch = "x86")] +//pub type SQLUINTEGER = ::UDWORD; +pub type SLONG = ::c_long; +pub type SSHORT = ::c_short; +//pub type ULONG = ::c_ulong; +//pub type USHORT = ::c_ushort; +pub type SDOUBLE = ::c_double; +pub type LDOUBLE = ::c_double; +pub type SFLOAT = ::c_float; +pub type PTR = *mut ::c_void; +pub type HENV = *mut ::c_void; +pub type HDBC = *mut ::c_void; +pub type HSTMT = *mut ::c_void; +pub type RETCODE = ::c_short; +pub type SQLHWND = ::HWND; +STRUCT!{struct DATE_STRUCT { + year: SQLSMALLINT, + month: SQLUSMALLINT, + day: SQLUSMALLINT, +}} +pub type SQL_DATE_STRUCT = DATE_STRUCT; +STRUCT!{struct TIME_STRUCT { + hour: SQLUSMALLINT, + minute: SQLUSMALLINT, + second: SQLUSMALLINT, +}} +pub type SQL_TIME_STRUCT = TIME_STRUCT; +STRUCT!{struct TIMESTAMP_STRUCT { + year: SQLSMALLINT, + month: SQLUSMALLINT, + day: SQLUSMALLINT, + hour: SQLUSMALLINT, + minute: SQLUSMALLINT, + second: SQLUSMALLINT, + fraction: SQLUINTEGER, +}} +pub type SQL_TIMESTAMP_STRUCT = TIMESTAMP_STRUCT; +ENUM!{enum SQLINTERVAL { + SQL_IS_YEAR = 1, + SQL_IS_MONTH = 2, + SQL_IS_DAY = 3, + SQL_IS_HOUR = 4, + SQL_IS_MINUTE = 5, + SQL_IS_SECOND = 6, + SQL_IS_YEAR_TO_MONTH = 7, + SQL_IS_DAY_TO_HOUR = 8, + SQL_IS_DAY_TO_MINUTE = 9, + SQL_IS_DAY_TO_SECOND = 10, + SQL_IS_HOUR_TO_MINUTE = 11, + SQL_IS_HOUR_TO_SECOND = 12, + SQL_IS_MINUTE_TO_SECOND = 13, +}} +STRUCT!{struct SQL_YEAR_MONTH_STRUCT { + year: SQLUINTEGER, + month: SQLUINTEGER, +}} +STRUCT!{struct SQL_DAY_SECOND_STRUCT { + day: SQLUINTEGER, + hour: SQLUINTEGER, + minute: SQLUINTEGER, + second: SQLUINTEGER, + fraction: SQLUINTEGER, +}} +STRUCT!{struct SQL_INTERVAL_STRUCT { + interval_type: SQLINTERVAL, + interval_sign: SQLSMALLINT, + intval: [u32; 5], +}} +UNION!{SQL_INTERVAL_STRUCT, intval, year_month, year_month_mut, SQL_YEAR_MONTH_STRUCT} +UNION!{SQL_INTERVAL_STRUCT, intval, day_second, day_second_mut, SQL_DAY_SECOND_STRUCT} +pub type ODBCINT64 = ::__int64; +pub type SQLBIGINT = ODBCINT64; +pub type SQLUBIGINT = ::__uint64; +pub const SQL_MAX_NUMERIC_LEN: usize = 16; +STRUCT!{struct SQL_NUMERIC_STRUCT { + precision: SQLCHAR, + scale: SQLSCHAR, + sign: SQLCHAR, + val: [SQLCHAR; SQL_MAX_NUMERIC_LEN], +}} +pub type SQLGUID = ::GUID; +pub type BOOKMARK = SQLULEN; +pub type SQLWCHAR = ::wchar_t; diff --git a/third_party/rust/winapi/src/sspi.rs b/third_party/rust/winapi/src/sspi.rs new file mode 100644 index 000000000000..688fe70c7491 --- /dev/null +++ b/third_party/rust/winapi/src/sspi.rs @@ -0,0 +1,657 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Security Support Provider Interface Prototypes and structure definitions +pub type SEC_WCHAR = ::WCHAR; +pub type SEC_CHAR = ::CHAR; +pub type SECURITY_STATUS = ::LONG; +STRUCT!{struct SecHandle { + dwLower: ::ULONG_PTR, + dwUpper: ::ULONG_PTR, +}} +pub type PSecHandle = *mut SecHandle; +pub const SEC_DELETED_HANDLE: ::ULONG_PTR = 2; +pub type CredHandle = SecHandle; +pub type PCredHandle = PSecHandle; +pub type CtxtHandle = SecHandle; +pub type PCtxtHandle = PSecHandle; +pub type SECURITY_INTEGER = ::LARGE_INTEGER; +pub type PSECURITY_INTEGER = *mut ::LARGE_INTEGER; +pub type TimeStamp = SECURITY_INTEGER; +pub type PTimeStamp = *mut SECURITY_INTEGER; +STRUCT!{struct SECURITY_STRING { + Length: ::c_ushort, + MaximumLength: ::c_ushort, + Buffer: *mut ::c_ushort, +}} +pub type PSECURITY_STRING = *mut SECURITY_STRING; +STRUCT!{struct SecPkgInfoW { + fCapabilities: ::c_ulong, + wVersion: ::c_ushort, + wRPCID: ::c_ushort, + cbMaxToken: ::c_ulong, + Name: *mut SEC_WCHAR, + Comment: *mut SEC_WCHAR, +}} +pub type PSecPkgInfoW = *mut SecPkgInfoW; +STRUCT!{struct SecPkgInfoA { + fCapabilities: ::c_ulong, + wVersion: ::c_ushort, + wRPCID: ::c_ushort, + cbMaxToken: ::c_ulong, + Name: *mut SEC_CHAR, + Comment: *mut SEC_CHAR, +}} +pub type PSecPkgInfoA = *mut SecPkgInfoA; +pub const SECPKG_FLAG_INTEGRITY: ::c_ulong = 0x00000001; +pub const SECPKG_FLAG_PRIVACY: ::c_ulong = 0x00000002; +pub const SECPKG_FLAG_TOKEN_ONLY: ::c_ulong = 0x00000004; +pub const SECPKG_FLAG_DATAGRAM: ::c_ulong = 0x00000008; +pub const SECPKG_FLAG_CONNECTION: ::c_ulong = 0x00000010; +pub const SECPKG_FLAG_MULTI_REQUIRED: ::c_ulong = 0x00000020; +pub const SECPKG_FLAG_CLIENT_ONLY: ::c_ulong = 0x00000040; +pub const SECPKG_FLAG_EXTENDED_ERROR: ::c_ulong = 0x00000080; +pub const SECPKG_FLAG_IMPERSONATION: ::c_ulong = 0x00000100; +pub const SECPKG_FLAG_ACCEPT_WIN32_NAME: ::c_ulong = 0x00000200; +pub const SECPKG_FLAG_STREAM: ::c_ulong = 0x00000400; +pub const SECPKG_FLAG_NEGOTIABLE: ::c_ulong = 0x00000800; +pub const SECPKG_FLAG_GSS_COMPATIBLE: ::c_ulong = 0x00001000; +pub const SECPKG_FLAG_LOGON: ::c_ulong = 0x00002000; +pub const SECPKG_FLAG_ASCII_BUFFERS: ::c_ulong = 0x00004000; +pub const SECPKG_FLAG_FRAGMENT: ::c_ulong = 0x00008000; +pub const SECPKG_FLAG_MUTUAL_AUTH: ::c_ulong = 0x00010000; +pub const SECPKG_FLAG_DELEGATION: ::c_ulong = 0x00020000; +pub const SECPKG_FLAG_READONLY_WITH_CHECKSUM: ::c_ulong = 0x00040000; +pub const SECPKG_FLAG_RESTRICTED_TOKENS: ::c_ulong = 0x00080000; +pub const SECPKG_FLAG_NEGO_EXTENDER: ::c_ulong = 0x00100000; +pub const SECPKG_FLAG_NEGOTIABLE2: ::c_ulong = 0x00200000; +pub const SECPKG_FLAG_APPCONTAINER_PASSTHROUGH: ::c_ulong = 0x00400000; +pub const SECPKG_FLAG_APPCONTAINER_CHECKS: ::c_ulong = 0x00800000; +pub const SECPKG_ID_NONE: ::c_ulong = 0xFFFF; +pub const SECPKG_CALLFLAGS_APPCONTAINER: ::c_ulong = 0x00000001; +pub const SECPKG_CALLFLAGS_APPCONTAINER_AUTHCAPABLE: ::c_ulong = 0x00000002; +pub const SECPKG_CALLFLAGS_FORCE_SUPPLIED: ::c_ulong = 0x00000004; +STRUCT!{struct SecBuffer { + cbBuffer: ::c_ulong, + BufferType: ::c_ulong, + pvBuffer: *mut ::c_void, +}} +pub type PSecBuffer = *mut SecBuffer; +STRUCT!{struct SecBufferDesc { + ulVersion: ::c_ulong, + cBuffers: ::c_ulong, + pBuffers: PSecBuffer, +}} +pub type PSecBufferDesc = *mut SecBufferDesc; +pub const SECBUFFER_VERSION: ::c_ulong = 0; +pub const SECBUFFER_EMPTY: ::c_ulong = 0; +pub const SECBUFFER_DATA: ::c_ulong = 1; +pub const SECBUFFER_TOKEN: ::c_ulong = 2; +pub const SECBUFFER_PKG_PARAMS: ::c_ulong = 3; +pub const SECBUFFER_MISSING: ::c_ulong = 4; +pub const SECBUFFER_EXTRA: ::c_ulong = 5; +pub const SECBUFFER_STREAM_TRAILER: ::c_ulong = 6; +pub const SECBUFFER_STREAM_HEADER: ::c_ulong = 7; +pub const SECBUFFER_NEGOTIATION_INFO: ::c_ulong = 8; +pub const SECBUFFER_PADDING: ::c_ulong = 9; +pub const SECBUFFER_STREAM: ::c_ulong = 10; +pub const SECBUFFER_MECHLIST: ::c_ulong = 11; +pub const SECBUFFER_MECHLIST_SIGNATURE: ::c_ulong = 12; +pub const SECBUFFER_TARGET: ::c_ulong = 13; +pub const SECBUFFER_CHANNEL_BINDINGS: ::c_ulong = 14; +pub const SECBUFFER_CHANGE_PASS_RESPONSE: ::c_ulong = 15; +pub const SECBUFFER_TARGET_HOST: ::c_ulong = 16; +pub const SECBUFFER_ALERT: ::c_ulong = 17; +pub const SECBUFFER_APPLICATION_PROTOCOLS: ::c_ulong = 18; +pub const SECBUFFER_ATTRMASK: ::c_ulong = 0xF0000000; +pub const SECBUFFER_READONLY: ::c_ulong = 0x80000000; +pub const SECBUFFER_READONLY_WITH_CHECKSUM: ::c_ulong = 0x10000000; +pub const SECBUFFER_RESERVED: ::c_ulong = 0x60000000; +STRUCT!{struct SEC_NEGOTIATION_INFO { + Size: ::c_ulong, + NameLength: ::c_ulong, + Name: *mut SEC_WCHAR, + Reserved: *mut ::c_void, +}} +pub type PSEC_NEGOTIATION_INFO = *mut SEC_NEGOTIATION_INFO; +STRUCT!{struct SEC_CHANNEL_BINDINGS { + dwInitiatorAddrType: ::c_ulong, + cbInitiatorLength: ::c_ulong, + dwInitiatorOffset: ::c_ulong, + dwAcceptorAddrType: ::c_ulong, + cbAcceptorLength: ::c_ulong, + dwAcceptorOffset: ::c_ulong, + cbApplicationDataLength: ::c_ulong, + dwApplicationDataOffset: ::c_ulong, +}} +pub type PSEC_CHANNEL_BINDINGS = *mut SEC_CHANNEL_BINDINGS; +ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT { + SecApplicationProtocolNegotiationExt_None, + SecApplicationProtocolNegotiationExt_NPN, + SecApplicationProtocolNegotiationExt_ALPN, +}} +pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT = *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT; +STRUCT!{struct SEC_APPLICATION_PROTOCOL_LIST { + ProtoNegoExt: ::SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT, + ProtocolListSize: ::c_ushort, + ProtocolList: [::c_uchar; 0], +}} +STRUCT!{struct SEC_APPLICATION_PROTOCOLS { + ProtocolListsSize: ::c_ulong, + ProtocolLists: [SEC_APPLICATION_PROTOCOL_LIST; 0], +}} +pub type PSEC_APPLICATION_PROTOCOLS = *mut SEC_APPLICATION_PROTOCOLS; +pub const SECURITY_NATIVE_DREP: ::c_ulong = 0x00000010; +pub const SECURITY_NETWORK_DREP: ::c_ulong = 0x00000000; +pub const SECPKG_CRED_INBOUND: ::c_ulong = 0x00000001; +pub const SECPKG_CRED_OUTBOUND: ::c_ulong = 0x00000002; +pub const SECPKG_CRED_BOTH: ::c_ulong = 0x00000003; +pub const SECPKG_CRED_DEFAULT: ::c_ulong = 0x00000004; +pub const SECPKG_CRED_RESERVED: ::c_ulong = 0xF0000000; +pub const SECPKG_CRED_AUTOLOGON_RESTRICTED: ::c_ulong = 0x00000010; +pub const SECPKG_CRED_PROCESS_POLICY_ONLY: ::c_ulong = 0x00000020; +pub const ISC_REQ_DELEGATE: ::c_ulong = 0x00000001; +pub const ISC_REQ_MUTUAL_AUTH: ::c_ulong = 0x00000002; +pub const ISC_REQ_REPLAY_DETECT: ::c_ulong = 0x00000004; +pub const ISC_REQ_SEQUENCE_DETECT: ::c_ulong = 0x00000008; +pub const ISC_REQ_CONFIDENTIALITY: ::c_ulong = 0x00000010; +pub const ISC_REQ_USE_SESSION_KEY: ::c_ulong = 0x00000020; +pub const ISC_REQ_PROMPT_FOR_CREDS: ::c_ulong = 0x00000040; +pub const ISC_REQ_USE_SUPPLIED_CREDS: ::c_ulong = 0x00000080; +pub const ISC_REQ_ALLOCATE_MEMORY: ::c_ulong = 0x00000100; +pub const ISC_REQ_USE_DCE_STYLE: ::c_ulong = 0x00000200; +pub const ISC_REQ_DATAGRAM: ::c_ulong = 0x00000400; +pub const ISC_REQ_CONNECTION: ::c_ulong = 0x00000800; +pub const ISC_REQ_CALL_LEVEL: ::c_ulong = 0x00001000; +pub const ISC_REQ_FRAGMENT_SUPPLIED: ::c_ulong = 0x00002000; +pub const ISC_REQ_EXTENDED_ERROR: ::c_ulong = 0x00004000; +pub const ISC_REQ_STREAM: ::c_ulong = 0x00008000; +pub const ISC_REQ_INTEGRITY: ::c_ulong = 0x00010000; +pub const ISC_REQ_IDENTIFY: ::c_ulong = 0x00020000; +pub const ISC_REQ_NULL_SESSION: ::c_ulong = 0x00040000; +pub const ISC_REQ_MANUAL_CRED_VALIDATION: ::c_ulong = 0x00080000; +pub const ISC_REQ_RESERVED1: ::c_ulong = 0x00100000; +pub const ISC_REQ_FRAGMENT_TO_FIT: ::c_ulong = 0x00200000; +pub const ISC_REQ_FORWARD_CREDENTIALS: ::c_ulong = 0x00400000; +pub const ISC_REQ_NO_INTEGRITY: ::c_ulong = 0x00800000; +pub const ISC_REQ_USE_HTTP_STYLE: ::c_ulong = 0x01000000; +pub const ISC_REQ_UNVERIFIED_TARGET_NAME: ::c_ulong = 0x20000000; +pub const ISC_REQ_CONFIDENTIALITY_ONLY: ::c_ulong = 0x40000000; +pub const ISC_RET_DELEGATE: ::c_ulong = 0x00000001; +pub const ISC_RET_MUTUAL_AUTH: ::c_ulong = 0x00000002; +pub const ISC_RET_REPLAY_DETECT: ::c_ulong = 0x00000004; +pub const ISC_RET_SEQUENCE_DETECT: ::c_ulong = 0x00000008; +pub const ISC_RET_CONFIDENTIALITY: ::c_ulong = 0x00000010; +pub const ISC_RET_USE_SESSION_KEY: ::c_ulong = 0x00000020; +pub const ISC_RET_USED_COLLECTED_CREDS: ::c_ulong = 0x00000040; +pub const ISC_RET_USED_SUPPLIED_CREDS: ::c_ulong = 0x00000080; +pub const ISC_RET_ALLOCATED_MEMORY: ::c_ulong = 0x00000100; +pub const ISC_RET_USED_DCE_STYLE: ::c_ulong = 0x00000200; +pub const ISC_RET_DATAGRAM: ::c_ulong = 0x00000400; +pub const ISC_RET_CONNECTION: ::c_ulong = 0x00000800; +pub const ISC_RET_INTERMEDIATE_RETURN: ::c_ulong = 0x00001000; +pub const ISC_RET_CALL_LEVEL: ::c_ulong = 0x00002000; +pub const ISC_RET_EXTENDED_ERROR: ::c_ulong = 0x00004000; +pub const ISC_RET_STREAM: ::c_ulong = 0x00008000; +pub const ISC_RET_INTEGRITY: ::c_ulong = 0x00010000; +pub const ISC_RET_IDENTIFY: ::c_ulong = 0x00020000; +pub const ISC_RET_NULL_SESSION: ::c_ulong = 0x00040000; +pub const ISC_RET_MANUAL_CRED_VALIDATION: ::c_ulong = 0x00080000; +pub const ISC_RET_RESERVED1: ::c_ulong = 0x00100000; +pub const ISC_RET_FRAGMENT_ONLY: ::c_ulong = 0x00200000; +pub const ISC_RET_FORWARD_CREDENTIALS: ::c_ulong = 0x00400000; +pub const ISC_RET_USED_HTTP_STYLE: ::c_ulong = 0x01000000; +pub const ISC_RET_NO_ADDITIONAL_TOKEN: ::c_ulong = 0x02000000; +pub const ISC_RET_REAUTHENTICATION: ::c_ulong = 0x08000000; +pub const ISC_RET_CONFIDENTIALITY_ONLY: ::c_ulong = 0x40000000; +pub const ASC_REQ_DELEGATE: ::c_ulong = 0x00000001; +pub const ASC_REQ_MUTUAL_AUTH: ::c_ulong = 0x00000002; +pub const ASC_REQ_REPLAY_DETECT: ::c_ulong = 0x00000004; +pub const ASC_REQ_SEQUENCE_DETECT: ::c_ulong = 0x00000008; +pub const ASC_REQ_CONFIDENTIALITY: ::c_ulong = 0x00000010; +pub const ASC_REQ_USE_SESSION_KEY: ::c_ulong = 0x00000020; +pub const ASC_REQ_SESSION_TICKET: ::c_ulong = 0x00000040; +pub const ASC_REQ_ALLOCATE_MEMORY: ::c_ulong = 0x00000100; +pub const ASC_REQ_USE_DCE_STYLE: ::c_ulong = 0x00000200; +pub const ASC_REQ_DATAGRAM: ::c_ulong = 0x00000400; +pub const ASC_REQ_CONNECTION: ::c_ulong = 0x00000800; +pub const ASC_REQ_CALL_LEVEL: ::c_ulong = 0x00001000; +pub const ASC_REQ_EXTENDED_ERROR: ::c_ulong = 0x00008000; +pub const ASC_REQ_STREAM: ::c_ulong = 0x00010000; +pub const ASC_REQ_INTEGRITY: ::c_ulong = 0x00020000; +pub const ASC_REQ_LICENSING: ::c_ulong = 0x00040000; +pub const ASC_REQ_IDENTIFY: ::c_ulong = 0x00080000; +pub const ASC_REQ_ALLOW_NULL_SESSION: ::c_ulong = 0x00100000; +pub const ASC_REQ_ALLOW_NON_USER_LOGONS: ::c_ulong = 0x00200000; +pub const ASC_REQ_ALLOW_CONTEXT_REPLAY: ::c_ulong = 0x00400000; +pub const ASC_REQ_FRAGMENT_TO_FIT: ::c_ulong = 0x00800000; +pub const ASC_REQ_FRAGMENT_SUPPLIED: ::c_ulong = 0x00002000; +pub const ASC_REQ_NO_TOKEN: ::c_ulong = 0x01000000; +pub const ASC_REQ_PROXY_BINDINGS: ::c_ulong = 0x04000000; +pub const ASC_REQ_ALLOW_MISSING_BINDINGS: ::c_ulong = 0x10000000; +pub const ASC_RET_DELEGATE: ::c_ulong = 0x00000001; +pub const ASC_RET_MUTUAL_AUTH: ::c_ulong = 0x00000002; +pub const ASC_RET_REPLAY_DETECT: ::c_ulong = 0x00000004; +pub const ASC_RET_SEQUENCE_DETECT: ::c_ulong = 0x00000008; +pub const ASC_RET_CONFIDENTIALITY: ::c_ulong = 0x00000010; +pub const ASC_RET_USE_SESSION_KEY: ::c_ulong = 0x00000020; +pub const ASC_RET_SESSION_TICKET: ::c_ulong = 0x00000040; +pub const ASC_RET_ALLOCATED_MEMORY: ::c_ulong = 0x00000100; +pub const ASC_RET_USED_DCE_STYLE: ::c_ulong = 0x00000200; +pub const ASC_RET_DATAGRAM: ::c_ulong = 0x00000400; +pub const ASC_RET_CONNECTION: ::c_ulong = 0x00000800; +pub const ASC_RET_CALL_LEVEL: ::c_ulong = 0x00002000; +pub const ASC_RET_THIRD_LEG_FAILED: ::c_ulong = 0x00004000; +pub const ASC_RET_EXTENDED_ERROR: ::c_ulong = 0x00008000; +pub const ASC_RET_STREAM: ::c_ulong = 0x00010000; +pub const ASC_RET_INTEGRITY: ::c_ulong = 0x00020000; +pub const ASC_RET_LICENSING: ::c_ulong = 0x00040000; +pub const ASC_RET_IDENTIFY: ::c_ulong = 0x00080000; +pub const ASC_RET_NULL_SESSION: ::c_ulong = 0x00100000; +pub const ASC_RET_ALLOW_NON_USER_LOGONS: ::c_ulong = 0x00200000; +pub const ASC_RET_ALLOW_CONTEXT_REPLAY: ::c_ulong = 0x00400000; +pub const ASC_RET_FRAGMENT_ONLY: ::c_ulong = 0x00800000; +pub const ASC_RET_NO_TOKEN: ::c_ulong = 0x01000000; +pub const ASC_RET_NO_ADDITIONAL_TOKEN: ::c_ulong = 0x02000000; +pub const SECPKG_CRED_ATTR_NAMES: ::c_ulong = 1; +pub const SECPKG_CRED_ATTR_SSI_PROVIDER: ::c_ulong = 2; +pub const SECPKG_CRED_ATTR_KDC_PROXY_SETTINGS: ::c_ulong = 3; +pub const SECPKG_CRED_ATTR_CERT: ::c_ulong = 4; +STRUCT!{struct SecPkgCredentials_NamesW { + sUserName: *mut SEC_WCHAR, +}} +pub type PSecPkgCredentials_NamesW = *mut SecPkgCredentials_NamesW; +STRUCT!{struct SecPkgCredentials_NamesA { + sUserName: *mut SEC_CHAR, +}} +pub type PSecPkgCredentials_NamesA = *mut SecPkgCredentials_NamesA; +STRUCT!{struct SecPkgCredentials_SSIProviderW { + sProviderName: *mut SEC_WCHAR, + ProviderInfoLength: ::c_ulong, + ProviderInfo: *mut ::c_char, +}} +pub type PSecPkgCredentials_SSIProviderW = *mut SecPkgCredentials_SSIProviderW; +STRUCT!{struct SecPkgCredentials_SSIProviderA { + sProviderName: *mut SEC_CHAR, + ProviderInfoLength: ::c_ulong, + ProviderInfo: *mut ::c_char, +}} +pub type PSecPkgCredentials_SSIProviderA = *mut SecPkgCredentials_SSIProviderA; +pub const KDC_PROXY_SETTINGS_V1: ::ULONG = 1; +pub const KDC_PROXY_SETTINGS_FLAGS_FORCEPROXY: ::ULONG = 0x1; +STRUCT!{struct SecPkgCredentials_KdcProxySettingsW { + Version: ::ULONG, + Flags: ::ULONG, + ProxyServerOffset: ::USHORT, + ProxyServerLength: ::USHORT, + ClientTlsCredOffset: ::USHORT, + ClientTlsCredLength: ::USHORT, +}} +pub type PSecPkgCredentials_KdcProxySettingsW = *mut SecPkgCredentials_KdcProxySettingsW; +STRUCT!{struct SecPkgCredentials_Cert { + EncodedCertSize: ::c_ulong, + EncodedCert: *mut ::c_uchar, +}} +pub type PSecPkgCredentials_Cert = *mut SecPkgCredentials_Cert; +pub const SECPKG_ATTR_SIZES: ::c_ulong = 0; +pub const SECPKG_ATTR_NAMES: ::c_ulong = 1; +pub const SECPKG_ATTR_LIFESPAN: ::c_ulong = 2; +pub const SECPKG_ATTR_DCE_INFO: ::c_ulong = 3; +pub const SECPKG_ATTR_STREAM_SIZES: ::c_ulong = 4; +pub const SECPKG_ATTR_KEY_INFO: ::c_ulong = 5; +pub const SECPKG_ATTR_AUTHORITY: ::c_ulong = 6; +pub const SECPKG_ATTR_PROTO_INFO: ::c_ulong = 7; +pub const SECPKG_ATTR_PASSWORD_EXPIRY: ::c_ulong = 8; +pub const SECPKG_ATTR_SESSION_KEY: ::c_ulong = 9; +pub const SECPKG_ATTR_PACKAGE_INFO: ::c_ulong = 10; +pub const SECPKG_ATTR_USER_FLAGS: ::c_ulong = 11; +pub const SECPKG_ATTR_NEGOTIATION_INFO: ::c_ulong = 12; +pub const SECPKG_ATTR_NATIVE_NAMES: ::c_ulong = 13; +pub const SECPKG_ATTR_FLAGS: ::c_ulong = 14; +pub const SECPKG_ATTR_USE_VALIDATED: ::c_ulong = 15; +pub const SECPKG_ATTR_CREDENTIAL_NAME: ::c_ulong = 16; +pub const SECPKG_ATTR_TARGET_INFORMATION: ::c_ulong = 17; +pub const SECPKG_ATTR_ACCESS_TOKEN: ::c_ulong = 18; +pub const SECPKG_ATTR_TARGET: ::c_ulong = 19; +pub const SECPKG_ATTR_AUTHENTICATION_ID: ::c_ulong = 20; +pub const SECPKG_ATTR_LOGOFF_TIME: ::c_ulong = 21; +pub const SECPKG_ATTR_NEGO_KEYS: ::c_ulong = 22; +pub const SECPKG_ATTR_PROMPTING_NEEDED: ::c_ulong = 24; +pub const SECPKG_ATTR_UNIQUE_BINDINGS: ::c_ulong = 25; +pub const SECPKG_ATTR_ENDPOINT_BINDINGS: ::c_ulong = 26; +pub const SECPKG_ATTR_CLIENT_SPECIFIED_TARGET: ::c_ulong = 27; +pub const SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS: ::c_ulong = 30; +pub const SECPKG_ATTR_NEGO_PKG_INFO: ::c_ulong = 31; +pub const SECPKG_ATTR_NEGO_STATUS: ::c_ulong = 32; +pub const SECPKG_ATTR_CONTEXT_DELETED: ::c_ulong = 33; +pub const SECPKG_ATTR_DTLS_MTU: ::c_ulong = 34; +pub const SECPKG_ATTR_DATAGRAM_SIZES: ::c_ulong = SECPKG_ATTR_STREAM_SIZES; +pub const SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES: ::c_ulong = 128; +pub const SECPKG_ATTR_APPLICATION_PROTOCOL: ::c_ulong = 35; +STRUCT!{struct SecPkgContext_SubjectAttributes { + AttributeInfo: *mut ::c_void, +}} +pub type PSecPkgContext_SubjectAttributes = *mut SecPkgContext_SubjectAttributes; +pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS: ::c_ulong = 0x1; +pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM: ::c_ulong = 0x2; +ENUM!{enum SECPKG_CRED_CLASS { + SecPkgCredClass_None = 0, + SecPkgCredClass_Ephemeral = 10, + SecPkgCredClass_PersistedGeneric = 20, + SecPkgCredClass_PersistedSpecific = 30, + SecPkgCredClass_Explicit = 40, +}} +pub type PSECPKG_CRED_CLASS = *mut SECPKG_CRED_CLASS; +STRUCT!{struct SecPkgContext_CredInfo { + CredClass: SECPKG_CRED_CLASS, + IsPromptingNeeded: ::c_ulong, +}} +pub type PSecPkgContext_CredInfo = *mut SecPkgContext_CredInfo; +STRUCT!{struct SecPkgContext_NegoPackageInfo { + PackageMask: ::c_ulong, +}} +pub type PSecPkgContext_NegoPackageInfo = *mut SecPkgContext_NegoPackageInfo; +STRUCT!{struct SecPkgContext_NegoStatus { + LastStatus: ::c_ulong, +}} +pub type PSecPkgContext_NegoStatus = *mut SecPkgContext_NegoStatus; +STRUCT!{struct SecPkgContext_Sizes { + cbMaxToken: ::c_ulong, + cbMaxSignature: ::c_ulong, + cbBlockSize: ::c_ulong, + cbSecurityTrailer: ::c_ulong, +}} +pub type PSecPkgContext_Sizes = *mut SecPkgContext_Sizes; +STRUCT!{struct SecPkgContext_StreamSizes { + cbHeader: ::c_ulong, + cbTrailer: ::c_ulong, + cbMaximumMessage: ::c_ulong, + cBuffers: ::c_ulong, + cbBlockSize: ::c_ulong, +}} +pub type PSecPkgContext_StreamSizes = *mut SecPkgContext_StreamSizes; +pub type SecPkgContext_DatagramSizes = SecPkgContext_StreamSizes; +pub type PSecPkgContext_DatagramSizes = PSecPkgContext_StreamSizes; +STRUCT!{struct SecPkgContext_NamesW { + sUserName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_NamesW = *mut SecPkgContext_NamesW; +ENUM!{enum SECPKG_ATTR_LCT_STATUS { + SecPkgAttrLastClientTokenYes, + SecPkgAttrLastClientTokenNo, + SecPkgAttrLastClientTokenMaybe, +}} +pub type PSECPKG_ATTR_LCT_STATUS = *mut SECPKG_ATTR_LCT_STATUS; +STRUCT!{struct SecPkgContext_LastClientTokenStatus { + LastClientTokenStatus: SECPKG_ATTR_LCT_STATUS, +}} +pub type PSecPkgContext_LastClientTokenStatus = *mut SecPkgContext_LastClientTokenStatus; +STRUCT!{struct SecPkgContext_NamesA { + sUserName: *mut SEC_CHAR, +}} +pub type PSecPkgContext_NamesA = *mut SecPkgContext_NamesA; +STRUCT!{struct SecPkgContext_Lifespan { + tsStart: TimeStamp, + tsExpiry: TimeStamp, +}} +pub type PSecPkgContext_Lifespan = *mut SecPkgContext_Lifespan; +STRUCT!{struct SecPkgContext_DceInfo { + AuthzSvc: ::c_ulong, + pPac: *mut ::c_void, +}} +pub type PSecPkgContext_DceInfo = *mut SecPkgContext_DceInfo; +STRUCT!{struct SecPkgContext_KeyInfoA { + sSignatureAlgorithmName: *mut ::SEC_CHAR, + sEncryptAlgorithmName: *mut ::SEC_CHAR, + KeySize: ::c_ulong, + SignatureAlgorithm: ::c_ulong, + EncryptAlgorithm: ::c_ulong, +}} +pub type PSecPkgContext_KeyInfoA = *mut SecPkgContext_KeyInfoA; +STRUCT!{struct SecPkgContext_KeyInfoW { + sSignatureAlgorithmName: *mut ::SEC_WCHAR, + sEncryptAlgorithmName: *mut ::SEC_WCHAR, + KeySize: ::c_ulong, + SignatureAlgorithm: ::c_ulong, + EncryptAlgorithm: ::c_ulong, +}} +pub type PSecPkgContext_KeyInfoW = *mut SecPkgContext_KeyInfoW; +STRUCT!{struct SecPkgContext_AuthorityA { + sAuthorityName: *mut SEC_CHAR, +}} +pub type PSecPkgContext_AuthorityA = *mut SecPkgContext_AuthorityA; +STRUCT!{struct SecPkgContext_AuthorityW { + sAuthorityName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_AuthorityW = *mut SecPkgContext_AuthorityW; +STRUCT!{struct SecPkgContext_ProtoInfoA { + sProtocolName: *mut SEC_CHAR, + majorVersion: ::c_ulong, + minorVersion: ::c_ulong, +}} +pub type PSecPkgContext_ProtoInfoA = *mut SecPkgContext_ProtoInfoA; +STRUCT!{struct SecPkgContext_ProtoInfoW { + sProtocolName: *mut SEC_WCHAR, + majorVersion: ::c_ulong, + minorVersion: ::c_ulong, +}} +pub type PSecPkgContext_ProtoInfoW = *mut SecPkgContext_ProtoInfoW; +STRUCT!{struct SecPkgContext_PasswordExpiry { + tsPasswordExpires: TimeStamp, +}} +pub type PSecPkgContext_PasswordExpiry = *mut SecPkgContext_PasswordExpiry; +STRUCT!{struct SecPkgContext_LogoffTime { + tsLogoffTime: TimeStamp, +}} +pub type PSecPkgContext_LogoffTime = *mut SecPkgContext_LogoffTime; +STRUCT!{struct SecPkgContext_SessionKey { + SessionKeyLength: ::c_ulong, + SessionKey: *mut ::c_uchar, +}} +pub type PSecPkgContext_SessionKey = *mut SecPkgContext_SessionKey; +STRUCT!{struct SecPkgContext_NegoKeys { + KeyType: ::c_ulong, + KeyLength: ::c_ushort, + KeyValue: *mut ::c_uchar, + VerifyKeyType: ::c_ulong, + VerifyKeyLength: ::c_ushort, + VerifyKeyValue: *mut ::c_uchar, +}} +pub type PSecPkgContext_NegoKeys = *mut SecPkgContext_NegoKeys; +STRUCT!{struct SecPkgContext_PackageInfoW { + PackageInfo: PSecPkgInfoW, +}} +pub type PSecPkgContext_PackageInfoW = *mut SecPkgContext_PackageInfoW; +STRUCT!{struct SecPkgContext_PackageInfoA { + PackageInfo: PSecPkgInfoA, +}} +pub type PSecPkgContext_PackageInfoA = *mut SecPkgContext_PackageInfoA; +STRUCT!{struct SecPkgContext_UserFlags { + UserFlags: ::c_ulong, +}} +pub type PSecPkgContext_UserFlags = *mut SecPkgContext_UserFlags; +STRUCT!{struct SecPkgContext_Flags { + Flags: ::c_ulong, +}} +pub type PSecPkgContext_Flags = *mut SecPkgContext_Flags; +STRUCT!{struct SecPkgContext_NegotiationInfoA { + PackageInfo: PSecPkgInfoA, + NegotiationState: ::c_ulong, +}} +pub type PSecPkgContext_NegotiationInfoA = *mut SecPkgContext_NegotiationInfoA; +STRUCT!{struct SecPkgContext_NegotiationInfoW { + PackageInfo: PSecPkgInfoW, + NegotiationState: ::c_ulong, +}} +pub type PSecPkgContext_NegotiationInfoW = *mut SecPkgContext_NegotiationInfoW; +pub const SECPKG_NEGOTIATION_COMPLETE: ::c_ulong = 0; +pub const SECPKG_NEGOTIATION_OPTIMISTIC: ::c_ulong = 1; +pub const SECPKG_NEGOTIATION_IN_PROGRESS: ::c_ulong = 2; +pub const SECPKG_NEGOTIATION_DIRECT: ::c_ulong = 3; +pub const SECPKG_NEGOTIATION_TRY_MULTICRED: ::c_ulong = 4; +STRUCT!{struct SecPkgContext_NativeNamesW { + sClientName: SEC_WCHAR, + sServerName: SEC_WCHAR, +}} +pub type PSecPkgContext_NativeNamesW = *mut SecPkgContext_NativeNamesW; +STRUCT!{struct SecPkgContext_NativeNamesA { + sClientName: SEC_CHAR, + sServerName: SEC_CHAR, +}} +pub type PSecPkgContext_NativeNamesA = *mut SecPkgContext_NativeNamesA; +STRUCT!{struct SecPkgContext_CredentialNameW { + CredentialType: ::c_ulong, + sCredentialName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_CredentialNameW = *mut SecPkgContext_CredentialNameW; +STRUCT!{struct SecPkgContext_CredentialNameA { + CredentialType: ::c_ulong, + sCredentialName: *mut SEC_CHAR, +}} +pub type PSecPkgContext_CredentialNameA = *mut SecPkgContext_CredentialNameA; +STRUCT!{struct SecPkgContext_AccessToken { + AccessToken: *mut ::c_void, +}} +pub type PSecPkgContext_AccessToken = *mut SecPkgContext_AccessToken; +STRUCT!{struct SecPkgContext_TargetInformation { + MarshalledTargetInfoLength: ::c_ulong, + MarshalledTargetInfo: *mut ::c_uchar, +}} +pub type PSecPkgContext_TargetInformation = *mut SecPkgContext_TargetInformation; +STRUCT!{struct SecPkgContext_AuthzID { + AuthzIDLength: ::c_ulong, + AuthzID: *mut ::c_char, +}} +pub type PSecPkgContext_AuthzID = *mut SecPkgContext_AuthzID; +STRUCT!{struct SecPkgContext_Target { + TargetLength: ::c_ulong, + Target: *mut ::c_char, +}} +pub type PSecPkgContext_Target = *mut SecPkgContext_Target; +STRUCT!{struct SecPkgContext_ClientSpecifiedTarget { + sTargetName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_ClientSpecifiedTarget = *mut SecPkgContext_ClientSpecifiedTarget; +STRUCT!{struct SecPkgContext_Bindings { + BindingsLength: ::c_ulong, + Bindings: *mut SEC_CHANNEL_BINDINGS, +}} +pub type PSecPkgContext_Bindings = *mut SecPkgContext_Bindings; +ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS { + SecApplicationProtocolNegotiationStatus_None, + SecApplicationProtocolNegotiationStatus_Success, + SecApplicationProtocolNegotiationStatus_SelectedClientOnly, +}} +pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS = + *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS; +pub const MAX_PROTOCOL_ID_SIZE: usize = 0xff; +STRUCT!{nodebug struct SecPkgContext_ApplicationProtocol { + ProtoNegoStatus: SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS, + ProtoNegoExt: SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT, + ProtocolIdSize: ::c_uchar, + ProtocolId: [::c_uchar; MAX_PROTOCOL_ID_SIZE], +}} +pub type PSecPkgContext_ApplicationProtocol = *mut SecPkgContext_ApplicationProtocol; +pub type SEC_GET_KEY_FN = Option; +pub const SECPKG_CONTEXT_EXPORT_RESET_NEW: ::c_ulong = 0x00000001; +pub const SECPKG_CONTEXT_EXPORT_DELETE_OLD: ::c_ulong = 0x00000002; +pub const SECPKG_CONTEXT_EXPORT_TO_KERNEL: ::c_ulong = 0x00000004; +pub type ACQUIRE_CREDENTIALS_HANDLE_FN_W = Option SECURITY_STATUS>; +pub type ACQUIRE_CREDENTIALS_HANDLE_FN_A = Option SECURITY_STATUS>; +pub type FREE_CREDENTIALS_HANDLE_FN = Option SECURITY_STATUS>; +pub type ADD_CREDENTIALS_FN_W = Option SECURITY_STATUS>; +pub type ADD_CREDENTIALS_FN_A = Option SECURITY_STATUS>; +pub type CHANGE_PASSWORD_FN_W = Option SECURITY_STATUS>; +pub type CHANGE_PASSWORD_FN_A = Option SECURITY_STATUS>; +//1844 +ENUM!{enum SecDelegationType { + SecFull, + SecService, + SecTree, + SecDirectory, + SecObject, +}} +pub type PSecDelegationType = *mut SecDelegationType; +STRUCT!{struct SEC_WINNT_AUTH_BYTE_VECTOR { + ByteArrayOffset: ::c_ulong, + ByteArrayLength: ::c_ushort, +}} +pub type PSEC_WINNT_AUTH_BYTE_VECTOR = *mut SEC_WINNT_AUTH_BYTE_VECTOR; +STRUCT!{struct SEC_WINNT_AUTH_DATA { + CredType: ::GUID, + CredData: SEC_WINNT_AUTH_BYTE_VECTOR, +}} +pub type PSEC_WINNT_AUTH_DATA = *mut SEC_WINNT_AUTH_DATA; +STRUCT!{struct SEC_WINNT_AUTH_PACKED_CREDENTIALS { + cbHeaderLength: ::c_ushort, + cbStructureLength: ::c_ushort, + AuthData: SEC_WINNT_AUTH_DATA, +}} +pub type PSEC_WINNT_AUTH_PACKED_CREDENTIALS = *mut SEC_WINNT_AUTH_PACKED_CREDENTIALS; +DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_PASSWORD, 0x28bfc32f, 0x10f6, 0x4738, + 0x98, 0xd1, 0x1a, 0xc0, 0x61, 0xdf, 0x71, 0x6a); +DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_CERT, 0x235f69ad, 0x73fb, 0x4dbc, + 0x82, 0x3, 0x6, 0x29, 0xe7, 0x39, 0x33, 0x9b); +STRUCT!{struct SEC_WINNT_AUTH_DATA_PASSWORD { + UnicodePassword: SEC_WINNT_AUTH_BYTE_VECTOR, +}} +pub type PSEC_WINNT_AUTH_DATA_PASSWORD = *mut SEC_WINNT_AUTH_DATA_PASSWORD; +DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_CSP_DATA, 0x68fd9879, 0x79c, 0x4dfe, + 0x82, 0x81, 0x57, 0x8a, 0xad, 0xc1, 0xc1, 0x0); +STRUCT!{struct SEC_WINNT_AUTH_CERTIFICATE_DATA { + cbHeaderLength: ::c_ushort, + cbStructureLength: ::c_ushort, + Certificate: SEC_WINNT_AUTH_BYTE_VECTOR, +}} +pub type PSEC_WINNT_AUTH_CERTIFICATE_DATA = *mut SEC_WINNT_AUTH_CERTIFICATE_DATA; +STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT_VECTOR { + CredUIContextArrayOffset: ::ULONG, + CredUIContextCount: ::USHORT, +}} +pub type PSEC_WINNT_CREDUI_CONTEXT_VECTOR = *mut SEC_WINNT_CREDUI_CONTEXT_VECTOR; +STRUCT!{struct SEC_WINNT_AUTH_SHORT_VECTOR { + ShortArrayOffset: ::ULONG, + ShortArrayCount: ::USHORT, +}} +pub type PSEC_WINNT_AUTH_SHORT_VECTOR = *mut SEC_WINNT_AUTH_SHORT_VECTOR; +STRUCT!{struct CREDUIWIN_MARSHALED_CONTEXT { + StructureType: ::GUID, + cbHeaderLength: ::USHORT, + LogonId: ::LUID, + MarshaledDataType: ::GUID, + MarshaledDataOffset: ::ULONG, + MarshaledDataLength: ::USHORT, +}} +pub type PCREDUIWIN_MARSHALED_CONTEXT = *mut CREDUIWIN_MARSHALED_CONTEXT; +STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT { + cbHeaderLength: ::USHORT, + CredUIContextHandle: ::HANDLE, + UIInfo: ::PCREDUI_INFOW, + dwAuthError: ::ULONG, + pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE, + TargetName: ::PUNICODE_STRING, +}} +pub type PSEC_WINNT_CREDUI_CONTEXT = *mut SEC_WINNT_CREDUI_CONTEXT; +pub type PSEC_WINNT_AUTH_IDENTITY_OPAQUE = ::PVOID; diff --git a/third_party/rust/winapi/src/strmif.rs b/third_party/rust/winapi/src/strmif.rs new file mode 100644 index 000000000000..0edfe72c9951 --- /dev/null +++ b/third_party/rust/winapi/src/strmif.rs @@ -0,0 +1,4 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +pub type REFERENCE_TIME = LONGLONG; diff --git a/third_party/rust/winapi/src/subauth.rs b/third_party/rust/winapi/src/subauth.rs new file mode 100644 index 000000000000..d84dc8cad2db --- /dev/null +++ b/third_party/rust/winapi/src/subauth.rs @@ -0,0 +1,198 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Types and macros for Subauthentication Packages. +STRUCT!{struct UNICODE_STRING { + Length: ::USHORT, + MaximumLength: ::USHORT, + Buffer: ::PWSTR, +}} +pub type PUNICODE_STRING = *mut UNICODE_STRING; +STRUCT!{struct STRING { + Length: ::USHORT, + MaximumLength: ::USHORT, + Buffer: ::PCHAR, +}} +pub type PSTRING = *mut STRING; +STRUCT!{struct OLD_LARGE_INTEGER { + LowPart: ::ULONG, + HighPart: ::LONG, +}} +pub type POLD_LARGE_INTEGER = *mut OLD_LARGE_INTEGER; +pub type SAM_HANDLE = ::PVOID; +pub type PSAM_HANDLE = *mut ::PVOID; +pub const USER_ACCOUNT_DISABLED: ::ULONG = 0x00000001; +pub const USER_HOME_DIRECTORY_REQUIRED: ::ULONG = 0x00000002; +pub const USER_PASSWORD_NOT_REQUIRED: ::ULONG = 0x00000004; +pub const USER_TEMP_DUPLICATE_ACCOUNT: ::ULONG = 0x00000008; +pub const USER_NORMAL_ACCOUNT: ::ULONG = 0x00000010; +pub const USER_MNS_LOGON_ACCOUNT: ::ULONG = 0x00000020; +pub const USER_INTERDOMAIN_TRUST_ACCOUNT: ::ULONG = 0x00000040; +pub const USER_WORKSTATION_TRUST_ACCOUNT: ::ULONG = 0x00000080; +pub const USER_SERVER_TRUST_ACCOUNT: ::ULONG = 0x00000100; +pub const USER_DONT_EXPIRE_PASSWORD: ::ULONG = 0x00000200; +pub const USER_ACCOUNT_AUTO_LOCKED: ::ULONG = 0x00000400; +pub const USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED: ::ULONG = 0x00000800; +pub const USER_SMARTCARD_REQUIRED: ::ULONG = 0x00001000; +pub const USER_TRUSTED_FOR_DELEGATION: ::ULONG = 0x00002000; +pub const USER_NOT_DELEGATED: ::ULONG = 0x00004000; +pub const USER_USE_DES_KEY_ONLY: ::ULONG = 0x00008000; +pub const USER_DONT_REQUIRE_PREAUTH: ::ULONG = 0x00010000; +pub const USER_PASSWORD_EXPIRED: ::ULONG = 0x00020000; +pub const USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: ::ULONG = 0x00040000; +pub const USER_NO_AUTH_DATA_REQUIRED: ::ULONG = 0x00080000; +pub const USER_PARTIAL_SECRETS_ACCOUNT: ::ULONG = 0x00100000; +pub const USER_USE_AES_KEYS: ::ULONG = 0x00200000; +pub const NEXT_FREE_ACCOUNT_CONTROL_BIT: ::ULONG = USER_USE_AES_KEYS << 1; +pub const USER_MACHINE_ACCOUNT_MASK: ::ULONG = USER_INTERDOMAIN_TRUST_ACCOUNT + | USER_WORKSTATION_TRUST_ACCOUNT | USER_SERVER_TRUST_ACCOUNT; +pub const USER_ACCOUNT_TYPE_MASK: ::ULONG = USER_TEMP_DUPLICATE_ACCOUNT | USER_NORMAL_ACCOUNT + | USER_MACHINE_ACCOUNT_MASK; +pub const USER_COMPUTED_ACCOUNT_CONTROL_BITS: ::ULONG = USER_ACCOUNT_AUTO_LOCKED +| USER_PASSWORD_EXPIRED; +pub const SAM_DAYS_PER_WEEK: ::USHORT = 7; +pub const SAM_HOURS_PER_WEEK: ::USHORT = 24 * SAM_DAYS_PER_WEEK; +pub const SAM_MINUTES_PER_WEEK: ::USHORT = 60 * SAM_HOURS_PER_WEEK; +STRUCT!{struct LOGON_HOURS { + UnitsPerWeek: ::USHORT, + LogonHours: ::PUCHAR, +}} +pub type PLOGON_HOURS = *mut LOGON_HOURS; +STRUCT!{struct SR_SECURITY_DESCRIPTOR { + Length: ::ULONG, + SecurityDescriptor: ::PUCHAR, +}} +pub type PSR_SECURITY_DESCRIPTOR = *mut SR_SECURITY_DESCRIPTOR; +STRUCT!{struct USER_ALL_INFORMATION { + LastLogon: ::LARGE_INTEGER, + LastLogoff: ::LARGE_INTEGER, + PasswordLastSet: ::LARGE_INTEGER, + AccountExpires: ::LARGE_INTEGER, + PasswordCanChange: ::LARGE_INTEGER, + PasswordMustChange: ::LARGE_INTEGER, + UserName: UNICODE_STRING, + FullName: UNICODE_STRING, + HomeDirectory: UNICODE_STRING, + HomeDirectoryDrive: UNICODE_STRING, + ScriptPath: UNICODE_STRING, + ProfilePath: UNICODE_STRING, + AdminComment: UNICODE_STRING, + WorkStations: UNICODE_STRING, + UserComment: UNICODE_STRING, + Parameters: UNICODE_STRING, + LmPassword: UNICODE_STRING, + NtPassword: UNICODE_STRING, + PrivateData: UNICODE_STRING, + SecurityDescriptor: SR_SECURITY_DESCRIPTOR, + UserId: ::ULONG, + PrimaryGroupId: ::ULONG, + UserAccountControl: ::ULONG, + WhichFields: ::ULONG, + LogonHours: LOGON_HOURS, + BadPasswordCount: ::USHORT, + LogonCount: ::USHORT, + CountryCode: ::USHORT, + CodePage: ::USHORT, + LmPasswordPresent: ::BOOLEAN, + NtPasswordPresent: ::BOOLEAN, + PasswordExpired: ::BOOLEAN, + PrivateDataSensitive: ::BOOLEAN, +}} +pub type PUSER_ALL_INFORMATION = *mut USER_ALL_INFORMATION; +pub const USER_ALL_PARAMETERS: ::ULONG = 0x00200000; +pub const CLEAR_BLOCK_LENGTH: usize = 8; +STRUCT!{struct CLEAR_BLOCK { + data: [::CHAR; CLEAR_BLOCK_LENGTH], +}} +pub type PCLEAR_BLOCK = *mut CLEAR_BLOCK; +pub const CYPHER_BLOCK_LENGTH: usize = 8; +STRUCT!{struct CYPHER_BLOCK { + data: [::CHAR; CYPHER_BLOCK_LENGTH], +}} +pub type PCYPHER_BLOCK = *mut CYPHER_BLOCK; +STRUCT!{struct LM_OWF_PASSWORD { + data: [CYPHER_BLOCK; 2], +}} +pub type PLM_OWF_PASSWORD = *mut LM_OWF_PASSWORD; +pub type LM_CHALLENGE = CLEAR_BLOCK; +pub type PLM_CHALLENGE = *mut LM_CHALLENGE; +pub type NT_OWF_PASSWORD = LM_OWF_PASSWORD; +pub type PNT_OWF_PASSWORD = *mut NT_OWF_PASSWORD; +pub type NT_CHALLENGE = LM_CHALLENGE; +pub type PNT_CHALLENGE = *mut NT_CHALLENGE; +pub const USER_SESSION_KEY_LENGTH: usize = CYPHER_BLOCK_LENGTH * 2; +STRUCT!{struct USER_SESSION_KEY { + data: [CYPHER_BLOCK; 2], +}} +pub type PUSER_SESSION_KEY = *mut USER_SESSION_KEY; +ENUM!{enum NETLOGON_LOGON_INFO_CLASS { + NetlogonInteractiveInformation = 1, + NetlogonNetworkInformation, + NetlogonServiceInformation, + NetlogonGenericInformation, + NetlogonInteractiveTransitiveInformation, + NetlogonNetworkTransitiveInformation, + NetlogonServiceTransitiveInformation, +}} +STRUCT!{struct NETLOGON_LOGON_IDENTITY_INFO { + LogonDomainName: UNICODE_STRING, + ParameterControl: ::ULONG, + LogonId: OLD_LARGE_INTEGER, + UserName: UNICODE_STRING, + Workstation: UNICODE_STRING, +}} +pub type PNETLOGON_LOGON_IDENTITY_INFO = *mut NETLOGON_LOGON_IDENTITY_INFO; +STRUCT!{struct NETLOGON_INTERACTIVE_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + LmOwfPassword: LM_OWF_PASSWORD, + NtOwfPassword: NT_OWF_PASSWORD, +}} +pub type PNETLOGON_INTERACTIVE_INFO = *mut NETLOGON_INTERACTIVE_INFO; +STRUCT!{struct NETLOGON_SERVICE_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + LmOwfPassword: LM_OWF_PASSWORD, + NtOwfPassword: NT_OWF_PASSWORD, +}} +pub type PNETLOGON_SERVICE_INFO = *mut NETLOGON_SERVICE_INFO; +STRUCT!{struct NETLOGON_NETWORK_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + LmChallenge: LM_CHALLENGE, + NtChallengeResponse: STRING, + LmChallengeResponse: STRING, +}} +pub type PNETLOGON_NETWORK_INFO = *mut NETLOGON_NETWORK_INFO; +STRUCT!{struct NETLOGON_GENERIC_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + PackageName: UNICODE_STRING, + DataLength: ::ULONG, + LogonData: ::PUCHAR, +}} +pub type PNETLOGON_GENERIC_INFO = *mut NETLOGON_GENERIC_INFO; +pub const MSV1_0_PASSTHRU: ::ULONG = 0x01; +pub const MSV1_0_GUEST_LOGON: ::ULONG = 0x02; +STRUCT!{struct MSV1_0_VALIDATION_INFO { + LogoffTime: ::LARGE_INTEGER, + KickoffTime: ::LARGE_INTEGER, + LogonServer: UNICODE_STRING, + LogonDomainName: UNICODE_STRING, + SessionKey: USER_SESSION_KEY, + Authoritative: ::BOOLEAN, + UserFlags: ::ULONG, + WhichFields: ::ULONG, + UserId: ::ULONG, +}} +pub type PMSV1_0_VALIDATION_INFO = *mut MSV1_0_VALIDATION_INFO; +pub const MSV1_0_VALIDATION_LOGOFF_TIME: ::ULONG = 0x00000001; +pub const MSV1_0_VALIDATION_KICKOFF_TIME: ::ULONG = 0x00000002; +pub const MSV1_0_VALIDATION_LOGON_SERVER: ::ULONG = 0x00000004; +pub const MSV1_0_VALIDATION_LOGON_DOMAIN: ::ULONG = 0x00000008; +pub const MSV1_0_VALIDATION_SESSION_KEY: ::ULONG = 0x00000010; +pub const MSV1_0_VALIDATION_USER_FLAGS: ::ULONG = 0x00000020; +pub const MSV1_0_VALIDATION_USER_ID: ::ULONG = 0x00000040; +pub const MSV1_0_SUBAUTH_ACCOUNT_DISABLED: ::ULONG = 0x00000001; +pub const MSV1_0_SUBAUTH_PASSWORD: ::ULONG = 0x00000002; +pub const MSV1_0_SUBAUTH_WORKSTATIONS: ::ULONG = 0x00000004; +pub const MSV1_0_SUBAUTH_LOGON_HOURS: ::ULONG = 0x00000008; +pub const MSV1_0_SUBAUTH_ACCOUNT_EXPIRY: ::ULONG = 0x00000010; +pub const MSV1_0_SUBAUTH_PASSWORD_EXPIRY: ::ULONG = 0x00000020; +pub const MSV1_0_SUBAUTH_ACCOUNT_TYPE: ::ULONG = 0x00000040; +pub const MSV1_0_SUBAUTH_LOCKOUT: ::ULONG = 0x00000080; diff --git a/third_party/rust/winapi/src/synchapi.rs b/third_party/rust/winapi/src/synchapi.rs new file mode 100644 index 000000000000..2eb9d1af250b --- /dev/null +++ b/third_party/rust/winapi/src/synchapi.rs @@ -0,0 +1,14 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-synch-l1 +pub type SRWLOCK = ::RTL_SRWLOCK; +pub type PSRWLOCK = *mut ::RTL_SRWLOCK; +pub type SYNCHRONIZATION_BARRIER = ::RTL_BARRIER; +pub type PSYNCHRONIZATION_BARRIER = ::PRTL_BARRIER; +pub type LPSYNCHRONIZATION_BARRIER = ::PRTL_BARRIER; +pub type PINIT_ONCE_FN = Option ::BOOL>; +pub type PTIMERAPCROUTINE = Option; diff --git a/third_party/rust/winapi/src/sysinfoapi.rs b/third_party/rust/winapi/src/sysinfoapi.rs new file mode 100644 index 000000000000..95c38c64a83c --- /dev/null +++ b/third_party/rust/winapi/src/sysinfoapi.rs @@ -0,0 +1,46 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-sysinfo-l1. +STRUCT!{struct SYSTEM_INFO { + wProcessorArchitecture: ::WORD, + wReserved: ::WORD, + dwPageSize: ::DWORD, + lpMinimumApplicationAddress: ::LPVOID, + lpMaximumApplicationAddress: ::LPVOID, + dwActiveProcessorMask: ::DWORD_PTR, + dwNumberOfProcessors: ::DWORD, + dwProcessorType: ::DWORD, + dwAllocationGranularity: ::DWORD, + wProcessorLevel: ::WORD, + wProcessorRevision: ::WORD, +}} +UNION!(SYSTEM_INFO, wProcessorArchitecture, dwOemId, dwOemId_mut, ::DWORD); +pub type LPSYSTEM_INFO = *mut SYSTEM_INFO; +STRUCT!{struct MEMORYSTATUSEX { + dwLength: ::DWORD, + dwMemoryLoad: ::DWORD, + ullTotalPhys: ::DWORDLONG, + ullAvailPhys: ::DWORDLONG, + ullTotalPageFile: ::DWORDLONG, + ullAvailPageFile: ::DWORDLONG, + ullTotalVirtual: ::DWORDLONG, + ullAvailVirtual: ::DWORDLONG, + ullAvailExtendedVirtual: ::DWORDLONG, +}} +pub type LPMEMORYSTATUSEX = *mut MEMORYSTATUSEX; +ENUM!{enum COMPUTER_NAME_FORMAT { + ComputerNameNetBIOS, + ComputerNameDnsHostname, + ComputerNameDnsDomain, + ComputerNameDnsFullyQualified, + ComputerNamePhysicalNetBIOS, + ComputerNamePhysicalDnsHostname, + ComputerNamePhysicalDnsDomain, + ComputerNamePhysicalDnsFullyQualified, + ComputerNameMax, +}} +pub type INIT_ONCE = ::RTL_RUN_ONCE; +pub type PINIT_ONCE = ::PRTL_RUN_ONCE; +pub type LPINIT_ONCE = ::PRTL_RUN_ONCE; +pub type CONDITION_VARIABLE = ::RTL_CONDITION_VARIABLE; +pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; diff --git a/third_party/rust/winapi/src/threadpoolapi.rs b/third_party/rust/winapi/src/threadpoolapi.rs new file mode 100644 index 000000000000..ec21aa05bc5f --- /dev/null +++ b/third_party/rust/winapi/src/threadpoolapi.rs @@ -0,0 +1,7 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-threadpool-l1. +pub type PTP_WIN32_IO_CALLBACK = Option; diff --git a/third_party/rust/winapi/src/timezoneapi.rs b/third_party/rust/winapi/src/timezoneapi.rs new file mode 100644 index 000000000000..3c84b209fc60 --- /dev/null +++ b/third_party/rust/winapi/src/timezoneapi.rs @@ -0,0 +1,27 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! ApiSet Contract for api-ms-win-core-timezone-l1 +pub const TIME_ZONE_ID_INVALID: ::DWORD = 0xFFFFFFFF; +STRUCT!{struct TIME_ZONE_INFORMATION { + Bias: ::LONG, + StandardName: [::WCHAR; 32], + StandardDate: ::SYSTEMTIME, + StandardBias: ::LONG, + DaylightName: [::WCHAR; 32], + DaylightDate: ::SYSTEMTIME, + DaylightBias: ::LONG, +}} +pub type PTIME_ZONE_INFORMATION = *mut TIME_ZONE_INFORMATION; +pub type LPTIME_ZONE_INFORMATION = *mut TIME_ZONE_INFORMATION; +STRUCT!{nodebug struct DYNAMIC_TIME_ZONE_INFORMATION { + Bias: ::LONG, + StandardName: [::WCHAR; 32], + StandardDate: ::SYSTEMTIME, + StandardBias: ::LONG, + DaylightName: [::WCHAR; 32], + DaylightDate: ::SYSTEMTIME, + DaylightBias: ::LONG, + TimeZoneKeyName: [::WCHAR; 128], + DynamicDaylightTimeDisabled: ::BOOLEAN, +}} +pub type PDYNAMIC_TIME_ZONE_INFORMATION = *mut DYNAMIC_TIME_ZONE_INFORMATION; diff --git a/third_party/rust/winapi/src/tlhelp32.rs b/third_party/rust/winapi/src/tlhelp32.rs new file mode 100644 index 000000000000..2e809b25d949 --- /dev/null +++ b/third_party/rust/winapi/src/tlhelp32.rs @@ -0,0 +1,104 @@ +// Copyright © 2015, Gigih Aji Ibrahim +// Licensed under the MIT License +pub const MAX_MODULE_NAME32: usize = 255; +pub const TH32CS_SNAPHEAPLIST: ::DWORD = 0x00000001; +pub const TH32CS_SNAPPROCESS: ::DWORD = 0x00000002; +pub const TH32CS_SNAPTHREAD: ::DWORD = 0x00000004; +pub const TH32CS_SNAPMODULE: ::DWORD = 0x00000008; +pub const TH32CS_SNAPMODULE32: ::DWORD = 0x00000010; +pub const TH32CS_SNAPALL: ::DWORD = + (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE); +pub const TH32CS_INHERIT: ::DWORD = 0x80000000; +STRUCT!{struct HEAPLIST32 { + dwSize: ::SIZE_T, + th32ProcessID: ::DWORD, + th32HeapID: :: ULONG_PTR, + dwFlags: ::DWORD, +}} +pub type PHEAPLIST32 = *mut HEAPLIST32; +pub type LPHEAPLIST32 = *mut HEAPLIST32; +pub const HF32_DEFAULT: ::DWORD = 1; +pub const HF32_SHARED: ::DWORD = 2; +STRUCT!{struct HEAPENTRY32 { + dwSize: ::SIZE_T, + hHandle: ::HANDLE, + dwAddress: ::ULONG_PTR, + dwBlockSize: ::SIZE_T, + dwFlags: ::DWORD, + dwLockCount: ::DWORD, + dwResvd: ::DWORD, + th32ProcessID: ::DWORD, + th32HeapID: ::ULONG_PTR, +}} +pub type PHEAPENTRY32 = *mut HEAPENTRY32; +pub type LPHEAPENTRY32 = *mut HEAPENTRY32; +pub const LF32_FIXED: ::DWORD = 0x00000001; +pub const LF32_FREE: ::DWORD = 0x00000002; +pub const LF32_MOVEABLE: ::DWORD = 0x00000004; +STRUCT!{nodebug struct PROCESSENTRY32W { + dwSize: ::DWORD, + cntUsage: ::DWORD, + th32ProcessID: ::DWORD, + th32DefaultHeapID: ::ULONG_PTR, + th32ModuleID: ::DWORD, + cntThreads: ::DWORD, + th32ParentProcessID: ::DWORD, + pcPriClassBase: ::LONG, + dwFlags: ::DWORD, + szExeFile: [::WCHAR; ::MAX_PATH], +}} +pub type PPROCESSENTRY32W = *mut PROCESSENTRY32W; +pub type LPPROCESSENTRY32W = *mut PROCESSENTRY32W; +STRUCT!{nodebug struct PROCESSENTRY32 { + dwSize: ::DWORD, + cntUsage: ::DWORD, + th32ProcessID: ::DWORD, + th32DefaultHeapID: ::ULONG_PTR, + th32ModuleID: ::DWORD, + cntThreads: ::DWORD, + th32ParentProcessID: ::DWORD, + pcPriClassBase: ::LONG, + dwFlags: ::DWORD, + szExeFile: [::CHAR; ::MAX_PATH], +}} +pub type PPROCESSENTRY32 = *mut PROCESSENTRY32; +pub type LPPROCESSENTRY32 = *mut PROCESSENTRY32; +STRUCT!{struct THREADENTRY32 { + dwSize: ::DWORD, + cntUsage: ::DWORD, + th32ThreadID: ::DWORD, + th32OwnerProcessID: ::DWORD, + tpBasePri: ::LONG, + tpDeltaPri: ::LONG, + dwFlags: ::DWORD, +}} +pub type PTHREADENTRY32 = *mut THREADENTRY32; +pub type LPTHREADENTRY32 = *mut THREADENTRY32; +STRUCT!{nodebug struct MODULEENTRY32W { + dwSize: ::DWORD, + th32ModuleID: ::DWORD, + th32ProcessID: ::DWORD, + GlblcntUsage: ::DWORD, + ProccntUsage: ::DWORD, + modBaseAddr: *mut ::BYTE, + modBaseSize: ::DWORD, + hModule: ::HMODULE, + szModule: [::WCHAR; ::MAX_MODULE_NAME32 + 1], + szExePath: [::WCHAR; ::MAX_PATH], +}} +pub type PMODULEENTRY32W = *mut MODULEENTRY32W; +pub type LPMODULEENTRY32W = *mut MODULEENTRY32W; +STRUCT!{nodebug struct MODULEENTRY32 { + dwSize: ::DWORD, + th32ModuleID: ::DWORD, + th32ProcessID: ::DWORD, + GlblcntUsage: ::DWORD, + ProccntUsage: ::DWORD, + modBaseAddr: *mut ::BYTE, + modBaseSize: ::DWORD, + hModule: ::HMODULE, + szModule: [::CHAR; ::MAX_MODULE_NAME32 + 1], + szExePath: [::CHAR; ::MAX_PATH], +}} +pub type PMODULEENTRY32 = *mut MODULEENTRY32; +pub type LPMODULEENTRY32 = *mut MODULEENTRY32; diff --git a/third_party/rust/winapi/src/unknwnbase.rs b/third_party/rust/winapi/src/unknwnbase.rs new file mode 100644 index 000000000000..2112561adb14 --- /dev/null +++ b/third_party/rust/winapi/src/unknwnbase.rs @@ -0,0 +1,29 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! this ALWAYS GENERATED file contains the definitions for the interfaces +RIDL!( +interface IUnknown(IUnknownVtbl) { + fn QueryInterface(&mut self, riid: ::REFIID, ppvObject: *mut *mut ::c_void) -> ::HRESULT, + fn AddRef(&mut self) -> ::ULONG, + fn Release(&mut self) -> ::ULONG +} +); +pub type LPUNKNOWN = *mut IUnknown; +RIDL!( +interface AsyncIUnknown(AsyncIUnknownVtbl): IUnknown(IUnknownVtbl) { + fn Begin_QueryInterface(&mut self, riid: ::REFIID) -> ::HRESULT, + fn Finish_QueryInterface(&mut self, ppvObject: *mut *mut ::c_void) -> ::HRESULT, + fn Begin_AddRef(&mut self) -> ::HRESULT, + fn Finish_AddRef(&mut self) -> ::ULONG, + fn Begin_Release(&mut self) -> ::HRESULT, + fn Finish_Release(&mut self) -> ::ULONG +} +); +RIDL!( +interface IClassFactory(IClassFactoryVtbl): IUnknown(IUnknownVtbl) { + fn CreateInstance( + &mut self, pUnkOuter: *mut IUnknown, riid: ::REFIID, ppvObject: *mut *mut ::c_void + ) -> ::HRESULT, + fn LockServer(&mut self, fLock: ::BOOL) -> ::HRESULT +} +); diff --git a/third_party/rust/winapi/src/urlhist.rs b/third_party/rust/winapi/src/urlhist.rs new file mode 100644 index 000000000000..b6fc2db155c5 --- /dev/null +++ b/third_party/rust/winapi/src/urlhist.rs @@ -0,0 +1,56 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Url History Interfaces +pub const STATURL_QUERYFLAG_ISCACHED: ::DWORD = 0x00010000; +pub const STATURL_QUERYFLAG_NOURL: ::DWORD = 0x00020000; +pub const STATURL_QUERYFLAG_NOTITLE: ::DWORD = 0x00040000; +pub const STATURL_QUERYFLAG_TOPLEVEL: ::DWORD = 0x00080000; +pub const STATURLFLAG_ISCACHED: ::DWORD = 0x00000001; +pub const STATURLFLAG_ISTOPLEVEL: ::DWORD = 0x00000002; +ENUM!{enum ADDURL_FLAG { + ADDURL_FIRST = 0, + ADDURL_ADDTOHISTORYANDCACHE = 0, + ADDURL_ADDTOCACHE = 1, + ADDURL_Max = 2147483647, +}} +pub type LPENUMSTATURL = *mut IEnumSTATURL; +STRUCT!{struct STATURL { + cbSize: ::DWORD, + pwcsUrl: ::LPWSTR, + pwcsTitle: ::LPWSTR, + ftLastVisited: ::FILETIME, + ftLastUpdated: ::FILETIME, + ftExpires: ::FILETIME, + dwFlags: ::DWORD, +}} +pub type LPSTATURL = *mut STATURL; +RIDL!{interface IEnumSTATURL(IEnumSTATURLVtbl): IUnknown(IUnknownVtbl) { + fn Next(&mut self, celt: ::ULONG, rgelt: LPSTATURL, pceltFetched: *mut ::ULONG) -> ::HRESULT, + fn Skip(&mut self, celt: ::ULONG) -> ::HRESULT, + fn Reset(&mut self) -> ::HRESULT, + fn Clone(&mut self, ppenum: *mut *mut ::IEnumSTATURL) -> ::HRESULT, + fn SetFilter(&mut self, poszFilter: ::LPCOLESTR, dwFlags: ::DWORD) -> ::HRESULT +}} +pub type LPURLHISTORYSTG = *mut IUrlHistoryStg; +RIDL!{interface IUrlHistoryStg(IUrlHistoryStgVtbl): IUnknown(IUnknownVtbl) { + fn AddUrl(&mut self, pocsUrl: ::LPCOLESTR) -> ::HRESULT, + fn DeleteUrl(&mut self, pocsUrl: ::LPCOLESTR, dwFlags: ::DWORD) -> ::HRESULT, + fn QueryUrl( + &mut self, pocsUrl: ::LPCOLESTR, dwFlags: ::DWORD, lpSTATURL: LPSTATURL + ) -> ::HRESULT, + fn BindToObject( + &mut self, pocsUrl: ::LPCOLESTR, riid: ::REFIID, ppvOut: *mut *mut ::c_void + ) -> ::HRESULT, + fn EnumUrls(&mut self, ppEnum: *mut *mut ::IEnumSTATURL) -> ::HRESULT +}} +pub type LPURLHISTORYSTG2 = *mut IUrlHistoryStg2; +RIDL!{interface IUrlHistoryStg2(IUrlHistoryStg2Vtbl): IUrlHistoryStg(IUrlHistoryStgVtbl) { + fn AddUrlAndNotify( + &mut self, pocsUrl: ::LPCOLESTR, pocsTitle: ::LPCOLESTR, dwFlags: ::DWORD, + fWriteHistory: ::BOOL, poctNotify: *mut ::IOleCommandTarget, punkISFolder: *mut ::IUnknown + ) -> ::HRESULT, + fn ClearHistory(&mut self) -> ::HRESULT +}} +pub type LPURLHISTORYNOTIFY = *mut IUrlHistoryNotify; +RIDL!{interface IUrlHistoryNotify(IUrlHistoryNotifyVtbl): + IOleCommandTarget(IOleCommandTargetVtbl) {}} diff --git a/third_party/rust/winapi/src/urlmon.rs b/third_party/rust/winapi/src/urlmon.rs new file mode 100644 index 000000000000..e0a5e935625f --- /dev/null +++ b/third_party/rust/winapi/src/urlmon.rs @@ -0,0 +1,6 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of Urlmon.h +// FIXME: Implement these interfaces +#[repr(C)] #[derive(Clone, Copy, Debug)] +pub struct IInternetSecurityManager; diff --git a/third_party/rust/winapi/src/usb.rs b/third_party/rust/winapi/src/usb.rs new file mode 100644 index 000000000000..5a5904ec5ea1 --- /dev/null +++ b/third_party/rust/winapi/src/usb.rs @@ -0,0 +1,18 @@ +// Copyright © 2016, bitbegin +// Licensed under the MIT License +//! USB Definitions. +ENUM!{enum USBD_PIPE_TYPE { + UsbdPipeTypeControl, + UsbdPipeTypeIsochronous, + UsbdPipeTypeBulk, + UsbdPipeTypeInterrupt, +}} + +pub type USBD_STATUS = ::LONG; + +STRUCT!{struct USBD_ISO_PACKET_DESCRIPTOR { + Offset: ::ULONG, + Length: ::ULONG, + Status: ::USBD_STATUS, +}} +pub type PUSBD_ISO_PACKET_DESCRIPTOR = *mut USBD_ISO_PACKET_DESCRIPTOR; diff --git a/third_party/rust/winapi/src/usbspec.rs b/third_party/rust/winapi/src/usbspec.rs new file mode 100644 index 000000000000..6b9605ba4735 --- /dev/null +++ b/third_party/rust/winapi/src/usbspec.rs @@ -0,0 +1,41 @@ +// Copyright © 2016, bitbegin +// Licensed under the MIT License +//! USB Spec Definitions. +ENUM!{enum USB_DEVICE_SPEED { + UsbLowSpeed = 0, + UsbFullSpeed, + UsbHighSpeed, + UsbSuperSpeed, +}} +ENUM!{enum USB_DEVICE_TYPE { + Usb11Device = 0, + Usb20Device, +}} +STRUCT!{struct BM_REQUEST_TYPE { + _BM: ::UCHAR, + B: ::UCHAR, +}} +BITFIELD!{BM_REQUEST_TYPE _BM: ::UINT8 [ + Recipient set_Recipient[0..2], + Reserved set_Reserved[2..5], + Type set_Type[5..7], + Dir set_Dir[7..8], +]} +pub type PBM_REQUEST_TYPE = *mut BM_REQUEST_TYPE; + +STRUCT!{#[repr(packed)] struct USB_CONFIGURATION_DESCRIPTOR { + bLength: ::UCHAR, + bDescriptorType: ::UCHAR, + wTotalLength: ::USHORT, + bNumInterfaces: ::UCHAR, + bConfigurationValue: ::UCHAR, + iConfiguration: ::UCHAR, + bmAttributes: ::UCHAR, + MaxPower: ::UCHAR, +}} +pub type PUSB_CONFIGURATION_DESCRIPTOR = *mut USB_CONFIGURATION_DESCRIPTOR; +#[test] +fn test_USB_CONFIGURATION_DESCRIPTOR_size() { + use std::mem::size_of; + assert_eq!(size_of::(), 9) +} diff --git a/third_party/rust/winapi/src/usp10.rs b/third_party/rust/winapi/src/usp10.rs new file mode 100644 index 000000000000..6c7b42bcd30f --- /dev/null +++ b/third_party/rust/winapi/src/usp10.rs @@ -0,0 +1,201 @@ +// Copyright © 2015, Jordan Miner +// Licensed under the MIT License +//! Uniscribe structure declarations and constant definitions +pub const SCRIPT_UNDEFINED: ::WORD = 0; +pub const USP_E_SCRIPT_NOT_IN_FONT: ::HRESULT = MAKE_HRESULT!( + ::SEVERITY_ERROR, ::FACILITY_ITF, 0x200 +); +DECLARE_HANDLE!(SCRIPT_CACHE, SCRIPT_CACHE__); +STRUCT!{struct SCRIPT_CONTROL { + bit_fields: ::DWORD, +}} +BITFIELD!(SCRIPT_CONTROL bit_fields: ::DWORD [ + uDefaultLanguage set_uDefaultLanguage[0..16], + fContextDigits set_fContextDigits[16..17], + fInvertPreBoundDir set_fInvertPreBoundDir[17..18], + fInvertPostBoundDir set_fInvertPostBoundDir[18..19], + fLinkStringBefore set_fLinkStringBefore[19..20], + fLinkStringAfter set_fLinkStringAfter[20..21], + fNeutralOverride set_fNeutralOverride[21..22], + fNumericOverride set_fNumericOverride[22..23], + fLegacyBidiClass set_fLegacyBidiClass[23..24], + fMergeNeutralItems set_fMergeNeutralItems[24..25], + fReserved set_fReserved[25..32], +]); +STRUCT!{struct SCRIPT_STATE { + bit_fields: ::WORD, +}} +BITFIELD!(SCRIPT_STATE bit_fields: ::WORD [ + uBidiLevel set_uBidiLevel[0..5], + fOverrideDirection set_fOverrideDirection[5..6], + fInhibitSymSwap set_fInhibitSymSwap[6..7], + fCharShape set_fCharShape[7..8], + fDigitSubstitute set_fDigitSubstitute[8..9], + fInhibitLigate set_fInhibitLigate[9..10], + fDisplayZWG set_fDisplayZWG[10..11], + fArabicNumContext set_fArabicNumContext[11..12], + fGcpClusters set_fGcpClusters[12..13], + fReserved set_fReserved[13..14], + fEngineReserved set_fEngineReserved[14..16], +]); +STRUCT!{struct SCRIPT_ANALYSIS { + bit_fields: ::WORD, + s: SCRIPT_STATE, +}} +BITFIELD!(SCRIPT_ANALYSIS bit_fields: ::WORD [ + eScript set_eScript[0..10], + fRTL set_fRTL[10..11], + fLayoutRTL set_fLayoutRTL[11..12], + fLinkBefore set_fLinkBefore[12..13], + fLinkAfter set_fLinkAfter[13..14], + fLogicalOrder set_fLogicalOrder[14..15], + fNoGlyphIndex set_fNoGlyphIndex[15..16], +]); +STRUCT!{struct SCRIPT_ITEM { + iCharPos: ::c_int, + a: SCRIPT_ANALYSIS, +}} +//490 +pub const SCRIPT_JUSTIFY_NONE: ::WORD = 0; +pub const SCRIPT_JUSTIFY_ARABIC_BLANK: ::WORD = 1; +pub const SCRIPT_JUSTIFY_CHARACTER: ::WORD = 2; +pub const SCRIPT_JUSTIFY_RESERVED1: ::WORD = 3; +pub const SCRIPT_JUSTIFY_BLANK: ::WORD = 4; +pub const SCRIPT_JUSTIFY_RESERVED2: ::WORD = 5; +pub const SCRIPT_JUSTIFY_RESERVED3: ::WORD = 6; +pub const SCRIPT_JUSTIFY_ARABIC_NORMAL: ::WORD = 7; +pub const SCRIPT_JUSTIFY_ARABIC_KASHIDA: ::WORD = 8; +pub const SCRIPT_JUSTIFY_ARABIC_ALEF: ::WORD = 9; +pub const SCRIPT_JUSTIFY_ARABIC_HA: ::WORD = 10; +pub const SCRIPT_JUSTIFY_ARABIC_RA: ::WORD = 11; +pub const SCRIPT_JUSTIFY_ARABIC_BA: ::WORD = 12; +pub const SCRIPT_JUSTIFY_ARABIC_BARA: ::WORD = 13; +pub const SCRIPT_JUSTIFY_ARABIC_SEEN: ::WORD = 14; +pub const SCRIPT_JUSTIFY_ARABIC_SEEN_M: ::WORD = 15; +STRUCT!{struct SCRIPT_VISATTR { + bit_fields: ::WORD, +}} +BITFIELD!(SCRIPT_VISATTR bit_fields: ::WORD [ + uJustification set_uJustification[0..4], + fClusterStart set_fClusterStart[4..5], + fDiacritic set_fDiacritic[5..6], + fZeroWidth set_fZeroWidth[6..7], + fReserved set_fReserved[7..8], + fShapeReserved set_fShapeReserved[8..16], +]); +STRUCT!{struct GOFFSET { + du: ::LONG, + dv: ::LONG, +}} +STRUCT!{struct SCRIPT_LOGATTR { + bit_fields: ::BYTE, +}} +BITFIELD!(SCRIPT_LOGATTR bit_fields: ::BYTE [ + fSoftBreak set_fSoftBreak[0..1], + fWhiteSpace set_fWhiteSpace[1..2], + fCharStop set_fCharStop[2..3], + fWordStop set_fWordStop[3..4], + fInvalid set_fInvalid[4..5], + fReserved set_fReserved[5..8], +]); +pub const SGCM_RTL: ::DWORD = 0x00000001; +STRUCT!{struct SCRIPT_PROPERTIES { + bit_fields1: ::DWORD, + bit_fields2: ::DWORD, +}} +BITFIELD!(SCRIPT_PROPERTIES bit_fields1: ::DWORD [ + langid set_langid[0..16], + fNumeric set_fNumeric[16..17], + fComplex set_fComplex[17..18], + fNeedsWordBreaking set_fNeedsWordBreaking[18..19], + fNeedsCaretInfo set_fNeedsCaretInfo[19..20], + bCharSet set_bCharSet[20..28], + fControl set_fControl[28..29], + fPrivateUseArea set_fPrivateUseArea[29..30], + fNeedsCharacterJustify set_fNeedsCharacterJustify[30..31], + fInvalidGlyph set_fInvalidGlyph[31..32], +]); +BITFIELD!(SCRIPT_PROPERTIES bit_fields2: ::DWORD [ + fInvalidLogAttr set_fInvalidLogAttr[0..1], + fCDM set_fCDM[1..2], + fAmbiguousCharSet set_fAmbiguousCharSet[2..3], + fClusterSizeVaries set_fClusterSizeVaries[3..4], + fRejectInvalid set_fRejectInvalid[4..5], +]); +STRUCT!{struct SCRIPT_FONTPROPERTIES { + cBytes: ::c_int, + wgBlank: ::WORD, + wgDefault: ::WORD, + wgInvalid: ::WORD, + wgKashida: ::WORD, + iKashidaWidth: ::c_int, +}} +//1440 +pub const SSA_PASSWORD: ::DWORD = 0x00000001; +pub const SSA_TAB: ::DWORD = 0x00000002; +pub const SSA_CLIP: ::DWORD = 0x00000004; +pub const SSA_FIT: ::DWORD = 0x00000008; +pub const SSA_DZWG: ::DWORD = 0x00000010; +pub const SSA_FALLBACK: ::DWORD = 0x00000020; +pub const SSA_BREAK: ::DWORD = 0x00000040; +pub const SSA_GLYPHS: ::DWORD = 0x00000080; +pub const SSA_RTL: ::DWORD = 0x00000100; +pub const SSA_GCP: ::DWORD = 0x00000200; +pub const SSA_HOTKEY: ::DWORD = 0x00000400; +pub const SSA_METAFILE: ::DWORD = 0x00000800; +pub const SSA_LINK: ::DWORD = 0x00001000; +pub const SSA_HIDEHOTKEY: ::DWORD = 0x00002000; +pub const SSA_HOTKEYONLY: ::DWORD = 0x00002400; +pub const SSA_FULLMEASURE: ::DWORD = 0x04000000; +pub const SSA_LPKANSIFALLBACK: ::DWORD = 0x08000000; +pub const SSA_PIDX: ::DWORD = 0x10000000; +pub const SSA_LAYOUTRTL: ::DWORD = 0x20000000; +pub const SSA_DONTGLYPH: ::DWORD = 0x40000000; +pub const SSA_NOKASHIDA: ::DWORD = 0x80000000; +STRUCT!{struct SCRIPT_TABDEF { + cTabStops: ::c_int, + iScale: ::c_int, + pTabStops: *mut ::c_int, + iTabOrigin: ::c_int, +}} +DECLARE_HANDLE!(SCRIPT_STRING_ANALYSIS, SCRIPT_STRING_ANALYSIS__); +pub const SIC_COMPLEX: ::DWORD = 1; +pub const SIC_ASCIIDIGIT: ::DWORD = 2; +pub const SIC_NEUTRAL: ::DWORD = 4; +STRUCT!{struct SCRIPT_DIGITSUBSTITUTE { + bit_fields1: ::DWORD, + bit_fields2: ::DWORD, + dwReserved: ::DWORD, +}} +BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields1: ::DWORD [ + NationalDigitLanguage set_NationalDigitLanguage[0..16], + TraditionalDigitLanguage set_TraditionalDigitLanguage[16..32], +]); +BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields2: ::DWORD [ + DigitSubstitute set_DigitSubstitute[0..8], +]); +pub const SCRIPT_DIGITSUBSTITUTE_CONTEXT: ::BYTE = 0; +pub const SCRIPT_DIGITSUBSTITUTE_NONE: ::BYTE = 1; +pub const SCRIPT_DIGITSUBSTITUTE_NATIONAL: ::BYTE = 2; +pub const SCRIPT_DIGITSUBSTITUTE_TRADITIONAL: ::BYTE = 3; +pub type OPENTYPE_TAG = ::ULONG; +pub const SCRIPT_TAG_UNKNOWN: OPENTYPE_TAG = 0x00000000; +STRUCT!{struct OPENTYPE_FEATURE_RECORD { + tagFeature: OPENTYPE_TAG, + lParameter: ::LONG, +}} +STRUCT!{struct TEXTRANGE_PROPERTIES { + potfRecords: *mut OPENTYPE_FEATURE_RECORD, + cotfRecords: ::c_int, +}} +STRUCT!{struct SCRIPT_CHARPROP { + bit_fields: ::WORD, +}} +BITFIELD!(SCRIPT_CHARPROP bit_fields: ::WORD [ + fCanGlyphAlone set_fCanGlyphAlone[0..1], + reserved set_reserved[1..16], +]); +STRUCT!{struct SCRIPT_GLYPHPROP { + sva: SCRIPT_VISATTR, + reserved: ::WORD, +}} diff --git a/third_party/rust/winapi/src/vadefs.rs b/third_party/rust/winapi/src/vadefs.rs new file mode 100644 index 000000000000..c482026f0e28 --- /dev/null +++ b/third_party/rust/winapi/src/vadefs.rs @@ -0,0 +1,7 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Definitions of macro helpers used by . This is the topmost header in the CRT header +//! lattice, and is always the first CRT header to be included, explicitly or implicitly. +//! Therefore, this header also has several definitions that are used throughout the CRT. +//39 +pub type va_list = *mut ::c_char; diff --git a/third_party/rust/winapi/src/vsbackup.rs b/third_party/rust/winapi/src/vsbackup.rs new file mode 100644 index 000000000000..5f6036a40d20 --- /dev/null +++ b/third_party/rust/winapi/src/vsbackup.rs @@ -0,0 +1,303 @@ +// Copyright © 2015, Brian Vincent +// Licensed under the MIT License +//! VSS backup interfaces +DEFINE_GUID!(IID_IVssExamineWriterMetadata, 0x902fcf7f, 0xb7fd, 0x42f8, + 0x81, 0xf1, 0xb2, 0xe4, 0x00, 0xb1, 0xe5, 0xbd); +DEFINE_GUID!(IID_IVssExamineWriterMetadataEx, 0x0c0e5ec0, 0xca44, 0x472b, + 0xb7, 0x02, 0xe6, 0x52, 0xdb, 0x1c, 0x04, 0x51); +DEFINE_GUID!(IID_IVssBackupComponents, 0x665c1d5f, 0xc218, 0x414d, + 0xa0, 0x5d, 0x7f, 0xef, 0x5f, 0x9d, 0x5c, 0x86); +DEFINE_GUID!(IID_IVssBackupComponentsEx, 0x963f03ad, 0x9e4c, 0x4a34, + 0xac, 0x15, 0xe4, 0xb6, 0x17, 0x4e, 0x50, 0x36); +STRUCT!{struct VSS_COMPONENTINFO { + type_: ::VSS_COMPONENT_TYPE, // type is a keyword in rust + bstrLogicalPath: ::BSTR, + bstrComponentName: ::BSTR, + bstrCaption: ::BSTR, + pbIcon: *mut ::BYTE, + cbIcon: ::UINT, + bRestoreMetadata: bool, + bNotifyOnBackupComplete: bool, + bSelectable: bool, + bSelectableForRestore: bool, + dwComponentFlags: ::DWORD, + cFileCount: ::UINT, + cDatabases: ::UINT, + cLogFiles: ::UINT, + cDependencies: ::UINT, +}} +pub type PVSSCOMPONENTINFO = *const ::VSS_COMPONENTINFO; +RIDL!( +interface IVssWMComponent(IVssWMComponentVtbl): IUnknown(IUnknownVtbl) { + fn GetComponentInfo(&mut self, ppInfo: *mut ::PVSSCOMPONENTINFO) -> ::HRESULT, + fn FreeComponentInfo(&mut self, pInfo: ::PVSSCOMPONENTINFO) -> ::HRESULT, + fn GetFile(&mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc) -> ::HRESULT, + fn GetDatabaseFile( + &mut self, iDBFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT, + fn GetDatabaseLogFile( + &mut self, iDbLogFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT, + fn GetDependency( + &mut self, iDependency: ::UINT, ppDependency: *mut *mut ::IVssWMDependency + ) -> ::HRESULT +} +); +RIDL!( +interface IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl): IUnknown(IUnknownVtbl) { + fn GetIdentity( + &mut self, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, + pbstrWriterName: *mut ::BSTR, pUsage: *mut ::VSS_USAGE_TYPE, + pSource: *mut ::VSS_SOURCE_TYPE + ) -> ::HRESULT, + fn GetFileCounts(&mut self, pcIncludeFiles: *mut ::UINT, pcExcludeFiles: *mut ::UINT, + pcComponents: *mut ::UINT + ) -> ::HRESULT, + fn GetIncludeFile( + &mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT, + fn GetExcludeFile( + &mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT, + fn GetComponent( + &mut self, iComponent: ::UINT, ppComponent: *mut *mut ::IVssWMComponent + ) -> ::HRESULT, + fn GetRestoreMethod( + &mut self, pMethod: *mut ::VSS_RESTOREMETHOD_ENUM, pbstrService: *mut ::BSTR, + pbstrUserProcedure: *mut ::BSTR, pwriterRestore: *mut ::VSS_WRITERRESTORE_ENUM, + pbRebootRequired: *mut bool, pcMappings: *mut ::UINT + ) -> ::HRESULT, + fn GetAlternateLocationMapping( + &mut self, iMapping: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT, + fn GetBackupSchema(&mut self, pdwSchemaMask: *mut ::DWORD) -> ::HRESULT, + fn GetDocument(&mut self, pDoc: *mut ::c_void) -> ::HRESULT, //TODO IXMLDOMDocument + fn SaveAsXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT, + fn LoadFromXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT +} +); +RIDL!( +interface IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl): + IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl) { + fn GetIdentityEx( + &mut self, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, + pbstrWriterName: *mut ::BSTR, pbstrInstanceName: *mut ::BSTR, + pUsage: *mut ::VSS_USAGE_TYPE, pSource: *mut ::VSS_SOURCE_TYPE + ) -> ::HRESULT +} +); +RIDL!( +interface IVssExamineWriterMetadataEx2(IVssExamineWriterMetadataEx2Vtbl): + IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl) { + fn GetVersion( + &mut self, pdwMajorVersion: *mut ::DWORD, pdwMinorVersion: *mut ::DWORD + ) -> ::HRESULT, + fn GetExcludeFromSnapshotCount(&mut self, pcExcludedFromSnapshot: *mut ::UINT) -> ::HRESULT, + fn GetExcludeFromSnapshotFile( + &mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT +} +); +#[repr(C)] +pub struct IVssWriterComponentsExt { + pub lpVtbl: *const IVssWriterComponentsExtVtbl, +} +#[repr(C)] +pub struct IVssWriterComponentsExtVtbl { + pub parent1: ::IVssWriterComponentsVtbl, + pub parent2: ::IUnknownVtbl, +} +RIDL!( +interface IVssBackupComponents(IVssBackupComponentsVtbl): IUnknown(IUnknownVtbl) { + fn GetWriterComponentsCount(&mut self, pcComponents: *mut ::UINT) -> ::HRESULT, + fn GetWriterComponents( + &mut self, iWriter: ::UINT, ppWriter: *mut *mut IVssWriterComponentsExt + ) -> ::HRESULT, + fn InitializeForBackup(&mut self, bstrXML: ::BSTR) -> ::HRESULT, + fn SetBackupState( + &mut self, bSelectComponents: bool, bBackupBootableSystemState: bool, + backupType: ::VSS_BACKUP_TYPE, bPartialFileSupport: bool + ) -> ::HRESULT, + fn InitializeForRestore(&mut self, bstrXML: ::BSTR) -> ::HRESULT, + fn SetRestoreState(&mut self, restoreType: ::VSS_RESTORE_TYPE) -> ::HRESULT, + fn GatherWriterMetadata(&mut self, pAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn GetWriterMetadataCount(&mut self, pcWriters: *mut ::UINT) -> ::HRESULT, + fn GetWriterMetadata( + &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, + ppMetadata: *mut *mut IVssExamineWriterMetadata + ) -> ::HRESULT, + fn FreeWriterMetadata(&mut self) -> ::HRESULT, + fn AddComponent( + &mut self, instanceId: ::VSS_ID, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, + wszLogicalPath: ::LPCWSTR, wszComponentName: ::LPCWSTR + ) -> ::HRESULT, + fn PrepareForBackup(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn AbortBackup(&mut self) -> ::HRESULT, + fn GatherWriterStatus(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn GetWriterStatusCount(&mut self, pcWriters: *mut ::UINT) -> ::HRESULT, + fn FreeWriterStatus(&mut self) -> ::HRESULT, + fn GetWriterStatus( + &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, + pbstrWriter: *mut ::BSTR, pnStatus: *mut ::VSS_WRITER_STATE, + phResultFailure: *mut ::HRESULT + ) -> ::HRESULT, + fn SetBackupSucceeded( + &mut self, instanceId: ::VSS_ID, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, + wszLogicalPath: ::LPCWSTR, wszComponentName: ::LPCWSTR, bSucceded: bool + ) -> ::HRESULT, + fn SetBackupOptions( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszBackupOptions: ::LPCWSTR + ) -> ::HRESULT, + fn SetSelectedForRestore( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, bSelectedForRestore: bool + ) -> ::HRESULT, + fn SetRestoreOptions( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszRestoreOptions: ::LPCWSTR + ) -> ::HRESULT, + fn SetAdditionalRestores( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, bAdditionalRestores: bool + ) -> ::HRESULT, + fn SetPreviousBackupStamp( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszPreviousBackupStamp: ::LPCWSTR + ) -> ::HRESULT, + fn SaveAsXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT, + fn BackupComplete(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn AddAlternativeLocationMapping( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool, + wszDestination: ::LPCWSTR + ) -> ::HRESULT, + fn AddRestoreSubcomponent( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszSubComponentLogicalPath: ::LPCWSTR, + wszSubComponentName: ::LPCWSTR, bRepair: bool + ) -> ::HRESULT, + fn SetFileRestoreStatus( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, status: ::VSS_FILE_RESTORE_STATUS + ) -> ::HRESULT, + fn AddNewTarget( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszPath: ::LPCWSTR, wszFileName: ::LPCWSTR, bRecursive: bool, + wszAlternatePath: ::LPCWSTR + ) -> ::HRESULT, + fn SetRangesFilePath( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, iPartialFile: ::UINT, wszRangesFile: ::LPCWSTR + ) -> ::HRESULT, + fn PreRestore(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn PostRestore(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn SetContext(&mut self, lContext: ::LONG) -> ::HRESULT, + fn StartSnapshotSet(&mut self, pSnapshotSetId: *mut ::VSS_ID) -> ::HRESULT, + fn AddToSnapshotSet( + &mut self, pwszVolumeName: ::VSS_PWSZ, ProviderId: ::VSS_ID, pidSnapshot: *mut ::VSS_ID + ) -> ::HRESULT, + fn DoSnapshotSet(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn DeleteSnapshots( + &mut self, SourceObjectId: ::VSS_ID, eSourceObjectType: ::VSS_OBJECT_TYPE, + bForceDelete: ::BOOL, plDeletedSnapshots: *mut ::LONG, pNondeletedSnapshotID: *mut ::VSS_ID + ) -> ::HRESULT, + fn ImportSnapshots(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn BreakSnapshotSet(&mut self, SnapshotSetId: ::VSS_ID) -> ::HRESULT, + fn GetSnapshotProperties( + &mut self, SnapshotId: ::VSS_ID, + pProp: *mut ::VSS_SNAPSHOT_PROP + ) -> ::HRESULT, + fn Query(&mut self, QueriedObjectId: ::VSS_ID, eQueriedObjectType: ::VSS_OBJECT_TYPE, + eReturnedObjectsType: ::VSS_OBJECT_TYPE, ppEnum: *mut *mut ::IVssEnumObject) -> ::HRESULT, + fn IsVolumeSupported( + &mut self, ProviderId: ::VSS_ID, pwszVolumeName: ::VSS_PWSZ, + pbSupportedByThisProvider: *mut ::BOOL + ) -> ::HRESULT, + fn DisableWriterClasses( + &mut self, rgWriterClassId: *const ::VSS_ID, cClassId: ::UINT + ) -> ::HRESULT, + fn EnableWriterClasses( + &mut self, rgWriterClassId: *const ::VSS_ID, cClassId: ::UINT + ) -> ::HRESULT, + fn DisableWriterInstances( + &mut self, rgWriterInstanceId: *const ::VSS_ID, cInstanceId: ::UINT + ) -> ::HRESULT, + fn ExposeSnapshot(&mut self, SnapshotId: ::VSS_ID, wszPathFromRoot: ::VSS_PWSZ, + lAttributes: ::LONG, wszExpose: ::VSS_PWSZ, pwszExposed: ::VSS_PWSZ + ) -> ::HRESULT, + fn RevertToSnapshot(&mut self, SnapshotId: ::VSS_ID, bForceDismount: ::BOOL) -> ::HRESULT, + fn QueryRevertStatus( + &mut self, pwszVolume: ::VSS_PWSZ, ppAsync: *mut *mut ::IVssAsync + ) -> ::HRESULT +} +); +RIDL!( +interface IVssBackupComponentsEx(IVssBackupComponentsExVtbl): + IVssBackupComponents(IVssBackupComponentsVtbl) { + fn GetWriterMetadataEx( + &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, + ppMetadata: *mut *mut ::IVssExamineWriterMetadataEx + ) -> ::HRESULT, + fn SetSelectedForRestoreEx( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, bSelectedForRestore: bool, instanceId: ::VSS_ID + ) -> ::HRESULT +} +); +RIDL!( +interface IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl): + IVssBackupComponentsEx(IVssBackupComponentsExVtbl) { + fn UnexposeSnapshot(&mut self, snapshotId: ::VSS_ID) -> ::HRESULT, + fn SetAuthoritativeRestore( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, bAuth: bool + ) -> ::HRESULT, + fn SetRollForward( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, rollType: ::VSS_ROLLFORWARD_TYPE, + wszRollForwardPoint: ::LPCWSTR + ) -> ::HRESULT, + fn SetRestoreName( + &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszRestoreName: ::LPCWSTR + ) -> ::HRESULT, + fn BreakSnapshotSetEx( + &mut self, SnapshotSetID: ::VSS_ID, dwBreakFlags: ::DWORD, ppAsync: *mut *mut ::IVssAsync + ) -> ::HRESULT, + fn PreFastRecovery( + &mut self, SnapshotSetID: ::VSS_ID, dwPreFastRecoveryFlags: ::DWORD, + ppAsync: *mut *mut ::IVssAsync + ) -> ::HRESULT, + fn FastRecovery( + &mut self, SnapshotSetID: ::VSS_ID, dwFastRecoveryFlags: ::DWORD, + ppAsync: *mut *mut ::IVssAsync + ) -> ::HRESULT +} +); +RIDL!( +interface IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl): + IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl) { + fn GetWriterStatusEx( + &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, + pbstrWriter: *mut ::BSTR, pnStatus: *mut ::VSS_WRITER_STATE, + phrFailureWriter: *mut ::HRESULT, phrApplication: *mut ::HRESULT, + pbstrApplicationMessage: *mut ::BSTR + ) -> ::HRESULT, + fn AddSnapshotToRecoverySet( + &mut self, snapshotId: ::VSS_ID, dwFlags: ::DWORD, pwszDestinationVolume: ::VSS_PWSZ + ) -> ::HRESULT, + fn RecoverSet(&mut self, dwFlags: ::DWORD, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, + fn GetSessionId(&mut self, idSession: *mut ::VSS_ID) -> ::HRESULT +} +); +RIDL!( +interface IVssBackupComponentsEx4(IVssBackupComponentsEx4Vtbl): + IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl) { + fn GetRootAndLogicalPrefixPaths( + &mut self, pwszFilePath: ::VSS_PWSZ, ppwszRootPath: *mut ::VSS_PWSZ, + ppwszLogicalPrefix: *mut ::VSS_PWSZ, bNormalizeFQDNforRootPath: ::BOOL + ) -> ::HRESULT +} +); +pub const VSS_SW_BOOTABLE_STATE: ::DWORD = 1; diff --git a/third_party/rust/winapi/src/vss.rs b/third_party/rust/winapi/src/vss.rs new file mode 100644 index 000000000000..259f18106896 --- /dev/null +++ b/third_party/rust/winapi/src/vss.rs @@ -0,0 +1,256 @@ +// Copyright © 2015, Brian Vincent +// Licensed under the MIT License +//! VSS header file +ENUM!{enum VSS_OBJECT_TYPE { + VSS_OBJECT_UNKNOWN = 0, + VSS_OBJECT_NONE = 1, + VSS_OBJECT_SNAPSHOT_SET = 2, + VSS_OBJECT_SNAPSHOT = 3, + VSS_OBJECT_PROVIDER = 4, + VSS_OBJECT_TYPE_COUNT = 5, +}} +pub type PVSS_OBJECT_TYPE = *mut VSS_OBJECT_TYPE; +ENUM!{enum VSS_SNAPSHOT_STATE { + VSS_SS_UNKNOWN = 0x00, + VSS_SS_PREPARING = 0x01, + VSS_SS_PROCESSING_PREPARE = 0x02, + VSS_SS_PREPARED = 0x03, + VSS_SS_PROCESSING_PRECOMMIT = 0x04, + VSS_SS_PRECOMMITTED = 0x05, + VSS_SS_PROCESSING_COMMIT = 0x06, + VSS_SS_COMMITTED = 0x07, + VSS_SS_PROCESSING_POSTCOMMIT = 0x08, + VSS_SS_PROCESSING_PREFINALCOMMIT = 0x09, + VSS_SS_PREFINALCOMMITTED = 0x0a, + VSS_SS_PROCESSING_POSTFINALCOMMIT = 0x0b, + VSS_SS_CREATED = 0x0c, + VSS_SS_ABORTED = 0x0d, + VSS_SS_DELETED = 0x0e, + VSS_SS_POSTCOMMITTED = 0x0f, + VSS_SS_COUNT = 0x10, +}} +pub type PVSS_SNAPSHOT_STATE = *mut VSS_SNAPSHOT_STATE; +pub type VSS_VOLUME_SNAPSHOT_ATTRIBUTES = ::LONG; +pub const VSS_VOLSNAP_ATTR_PERSISTENT: ::LONG = 0x00000001; +pub const VSS_VOLSNAP_ATTR_NO_AUTORECOVERY: ::LONG = 0x00000002; +pub const VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE: ::LONG = 0x00000004; +pub const VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE: ::LONG = 0x00000008; +pub const VSS_VOLSNAP_ATTR_NO_WRITERS: ::LONG = 0x00000010; +pub const VSS_VOLSNAP_ATTR_TRANSPORTABLE: ::LONG = 0x00000020; +pub const VSS_VOLSNAP_ATTR_NOT_SURFACED: ::LONG = 0x00000040; +pub const VSS_VOLSNAP_ATTR_NOT_TRANSACTED: ::LONG = 0x00000080; +pub const VSS_VOLSNAP_ATTR_HARDWARE_ASSISTED: ::LONG = 0x00010000; +pub const VSS_VOLSNAP_ATTR_DIFFERENTIAL: ::LONG = 0x00020000; +pub const VSS_VOLSNAP_ATTR_PLEX: ::LONG = 0x00040000; +pub const VSS_VOLSNAP_ATTR_IMPORTED: ::LONG = 0x00080000; +pub const VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY: ::LONG = 0x00100000; +pub const VSS_VOLSNAP_ATTR_EXPOSED_REMOTELY: ::LONG = 0x00200000; +pub const VSS_VOLSNAP_ATTR_AUTORECOVER: ::LONG = 0x00400000; +pub const VSS_VOLSNAP_ATTR_ROLLBACK_RECOVERY: ::LONG = 0x00800000; +pub const VSS_VOLSNAP_ATTR_DELAYED_POSTSNAPSHOT: ::LONG = 0x01000000; +pub const VSS_VOLSNAP_ATTR_TXF_RECOVERY: ::LONG = 0x02000000; +pub const VSS_VOLSNAP_ATTR_FILE_SHARE: ::LONG = 0x04000000; +pub type PVSS_VOLUME_SNAPSHOT_ATTRIBUTES = *mut VSS_VOLUME_SNAPSHOT_ATTRIBUTES; +pub type VSS_SNAPSHOT_CONTEXT = ::LONG; +pub type PVSS_SNAPSHOT_CONTEXT = *mut VSS_SNAPSHOT_CONTEXT; +pub const VSS_CTX_BACKUP: ::LONG = 0; +pub const VSS_CTX_FILE_SHARE_BACKUP: ::LONG = VSS_VOLSNAP_ATTR_NO_WRITERS; +pub const VSS_CTX_NAS_ROLLBACK: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE | VSS_VOLSNAP_ATTR_NO_WRITERS; +pub const VSS_CTX_APP_ROLLBACK: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE; +pub const VSS_CTX_CLIENT_ACCESSIBLE: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE + | VSS_VOLSNAP_ATTR_NO_WRITERS; +pub const VSS_CTX_CLIENT_ACCESSIBLE_WRITERS: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE; +pub const VSS_CTX_ALL: ::LONG = 0xffffffffu32 as ::LONG; +pub type VSS_PROVIDER_CAPABILITIES = ::DWORD; +pub type PVSS_PROVIDER_CAPABILITIES = *mut VSS_PROVIDER_CAPABILITIES; +pub const VSS_PRV_CAPABILITY_LEGACY: ::DWORD = 0x1; +pub const VSS_PRV_CAPABILITY_COMPLIANT: ::DWORD = 0x2; +pub const VSS_PRV_CAPABILITY_LUN_REPOINT: ::DWORD = 0x4; +pub const VSS_PRV_CAPABILITY_LUN_RESYNC: ::DWORD = 0x8; +pub const VSS_PRV_CAPABILITY_OFFLINE_CREATION: ::DWORD = 0x10; +pub const VSS_PRV_CAPABILITY_MULTIPLE_IMPORT: ::DWORD = 0x20; +pub const VSS_PRV_CAPABILITY_RECYCLING: ::DWORD = 0x40; +pub const VSS_PRV_CAPABILITY_PLEX: ::DWORD = 0x80; +pub const VSS_PRV_CAPABILITY_DIFFERENTIAL: ::DWORD = 0x100; +pub const VSS_PRV_CAPABILITY_CLUSTERED: ::DWORD = 0x200; +pub type VSS_HARDWARE_OPTIONS = ::DWORD; +pub type PVSS_HARDWARE_OPTIONS = *mut VSS_HARDWARE_OPTIONS; +pub const VSS_BREAKEX_FLAG_MASK_LUNS: ::DWORD = 0x1; +pub const VSS_BREAKEX_FLAG_MAKE_READ_WRITE: ::DWORD = 0x2; +pub const VSS_BREAKEX_FLAG_REVERT_IDENTITY_ALL: ::DWORD = 0x4; +pub const VSS_BREAKEX_FLAG_REVERT_IDENTITY_NONE: ::DWORD = 0x8; +pub const VSS_ONLUNSTATECHANGE_NOTIFY_READ_WRITE: ::DWORD = 0x100; +pub const VSS_ONLUNSTATECHANGE_NOTIFY_LUN_PRE_RECOVERY: ::DWORD = 0x200; +pub const VSS_ONLUNSTATECHANGE_NOTIFY_LUN_POST_RECOVERY: ::DWORD = 0x400; +pub const VSS_ONLUNSTATECHANGE_DO_MASK_LUNS: ::DWORD = 0x800; +pub type VSS_RECOVERY_OPTIONS = ::DWORD; +pub type PVSS_RECOVERY_OPTIONS = *mut VSS_RECOVERY_OPTIONS; +pub const VSS_RECOVERY_REVERT_IDENTITY_ALL: ::DWORD = 0x00000100; +pub const VSS_RECOVERY_NO_VOLUME_CHECK: ::DWORD = 0x00000200; +ENUM!{enum VSS_WRITER_STATE { + VSS_WS_UNKNOWN = 0, + VSS_WS_STABLE = 1, + VSS_WS_WAITING_FOR_FREEZE = 2, + VSS_WS_WAITING_FOR_THAW = 3, + VSS_WS_WAITING_FOR_POST_SNAPSHOT = 4, + VSS_WS_WAITING_FOR_BACKUP_COMPLETE = 5, + VSS_WS_FAILED_AT_IDENTIFY = 6, + VSS_WS_FAILED_AT_PREPARE_BACKUP = 7, + VSS_WS_FAILED_AT_PREPARE_SNAPSHOT = 8, + VSS_WS_FAILED_AT_FREEZE = 9, + VSS_WS_FAILED_AT_THAW = 10, + VSS_WS_FAILED_AT_POST_SNAPSHOT = 11, + VSS_WS_FAILED_AT_BACKUP_COMPLETE = 12, + VSS_WS_FAILED_AT_PRE_RESTORE = 13, + VSS_WS_FAILED_AT_POST_RESTORE = 14, + VSS_WS_FAILED_AT_BACKUPSHUTDOWN = 15, + VSS_WS_COUNT = 16, +}} +pub type PVSS_WRITER_STATE = *mut VSS_WRITER_STATE; +ENUM!{enum VSS_BACKUP_TYPE { + VSS_BT_UNDEFINED = 0, + VSS_BT_FULL = 1, + VSS_BT_INCREMENTAL = 2, + VSS_BT_DIFFERENTIAL = 3, + VSS_BT_LOG = 4, + VSS_BT_COPY = 5, + VSS_BT_OTHER = 6, +}} +pub type PVSS_BACKUP_TYPE = *mut VSS_BACKUP_TYPE; +ENUM!{enum VSS_RESTORE_TYPE { + VSS_RTYPE_UNDEFINED = 0, + VSS_RTYPE_BY_COPY = 1, + VSS_RTYPE_IMPORT = 2, + VSS_RTYPE_OTHER = 3, +}} +pub type PVSS_RESTORE_TYPE = *mut VSS_RESTORE_TYPE; +ENUM!{enum VSS_ROLLFORWARD_TYPE { + VSS_RF_UNDEFINED = 0, + VSS_RF_NONE = 1, + VSS_RF_ALL = 2, + VSS_RF_PARTIAL = 3, +}} +pub type PVSS_ROLLFORWARD_TYPE = *mut VSS_ROLLFORWARD_TYPE; +ENUM!{enum VSS_PROVIDER_TYPE { + VSS_PROV_UNKNOWN = 0, + VSS_PROV_SYSTEM = 1, + VSS_PROV_SOFTWARE = 2, + VSS_PROV_HARDWARE = 3, + VSS_PROV_FILESHARE = 4, +}} +pub type PVSS_PROVIDER_TYPE = *mut VSS_PROVIDER_TYPE; +ENUM!{enum VSS_APPLICATION_LEVEL { + VSS_APP_UNKNOWN = 0, + VSS_APP_SYSTEM = 1, + VSS_APP_BACK_END = 2, + VSS_APP_FRONT_END = 3, + VSS_APP_SYSTEM_RM = 4, + VSS_APP_AUTO = -1i32 as u32, +}} +pub type PVSS_APPLICATION_LEVEL = *mut VSS_APPLICATION_LEVEL; +ENUM!{enum VSS_SNAPSHOT_PROPERTY_ID { + VSS_SPROPID_UNKNOWN = 0, + VSS_SPROPID_SNAPSHOT_ID = 0x1, + VSS_SPROPID_SNAPSHOT_SET_ID = 0x2, + VSS_SPROPID_SNAPSHOTS_COUNT = 0x3, + VSS_SPROPID_SNAPSHOT_DEVICE = 0x4, + VSS_SPROPID_ORIGINAL_VOLUME = 0x5, + VSS_SPROPID_ORIGINATING_MACHINE = 0x6, + VSS_SPROPID_SERVICE_MACHINE = 0x7, + VSS_SPROPID_EXPOSED_NAME = 0x8, + VSS_SPROPID_EXPOSED_PATH = 0x9, + VSS_SPROPID_PROVIDER_ID = 0xa, + VSS_SPROPID_SNAPSHOT_ATTRIBUTES = 0xb, + VSS_SPROPID_CREATION_TIMESTAMP = 0xc, + VSS_SPROPID_STATUS = 0xd, +}} +pub type PVSS_SNAPSHOT_PROPERTY_ID = *mut VSS_SNAPSHOT_PROPERTY_ID; +pub type VSS_FILE_SPEC_BACKUP_TYPE = ::DWORD; +pub type PVSS_FILE_SPEC_BACKUP_TYPE = *mut VSS_FILE_SPEC_BACKUP_TYPE; +pub const VSS_FSBT_FULL_BACKUP_REQUIRED: ::DWORD = 0x1; +pub const VSS_FSBT_DIFFERENTIAL_BACKUP_REQUIRED: ::DWORD = 0x2; +pub const VSS_FSBT_INCREMENTAL_BACKUP_REQUIRED: ::DWORD = 0x4; +pub const VSS_FSBT_LOG_BACKUP_REQUIRED: ::DWORD = 0x8; +pub const VSS_FSBT_FULL_SNAPSHOT_REQUIRED: ::DWORD = 0x100; +pub const VSS_FSBT_DIFFERENTIAL_SNAPSHOT_REQUIRED: ::DWORD = 0x200; +pub const VSS_FSBT_INCREMENTAL_SNAPSHOT_REQUIRED: ::DWORD = 0x400; +pub const VSS_FSBT_LOG_SNAPSHOT_REQUIRED: ::DWORD = 0x800; +pub const VSS_FSBT_CREATED_DURING_BACKUP: ::DWORD = 0x10000; +pub const VSS_FSBT_ALL_BACKUP_REQUIRED: ::DWORD = 0xf; +pub const VSS_FSBT_ALL_SNAPSHOT_REQUIRED: ::DWORD = 0xf00; +pub type VSS_BACKUP_SCHEMA = ::DWORD; +pub type PVSS_BACKUP_SCHEMA = *mut VSS_BACKUP_SCHEMA; +pub const VSS_BS_UNDEFINED: ::DWORD = 0; +pub const VSS_BS_DIFFERENTIAL: ::DWORD = 0x1; +pub const VSS_BS_INCREMENTAL: ::DWORD = 0x2; +pub const VSS_BS_EXCLUSIVE_INCREMENTAL_DIFFERENTIAL: ::DWORD = 0x4; +pub const VSS_BS_LOG: ::DWORD = 0x8; +pub const VSS_BS_COPY: ::DWORD = 0x10; +pub const VSS_BS_TIMESTAMPED: ::DWORD = 0x20; +pub const VSS_BS_LAST_MODIFY: ::DWORD = 0x40; +pub const VSS_BS_LSN: ::DWORD = 0x80; +pub const VSS_BS_WRITER_SUPPORTS_NEW_TARGET: ::DWORD = 0x100; +pub const VSS_BS_WRITER_SUPPORTS_RESTORE_WITH_MOVE: ::DWORD = 0x200; +pub const VSS_BS_INDEPENDENT_SYSTEM_STATE: ::DWORD = 0x400; +pub const VSS_BS_ROLLFORWARD_RESTORE: ::DWORD = 0x1000; +pub const VSS_BS_RESTORE_RENAME: ::DWORD = 0x2000; +pub const VSS_BS_AUTHORITATIVE_RESTORE: ::DWORD = 0x4000; +pub const VSS_BS_WRITER_SUPPORTS_PARALLEL_RESTORES: ::DWORD = 0x8000; +pub type VSS_ID = ::GUID; +pub type VSS_PWSZ = *mut ::WCHAR; +pub type VSS_TIMESTAMP = ::LONGLONG; +STRUCT!{struct VSS_SNAPSHOT_PROP { + m_SnapshotId: ::VSS_ID, + m_SnapshotSetId: ::VSS_ID, + m_lSnapshotsCount: ::LONG, + m_pwszSnapshotDeviceObject: ::VSS_PWSZ, + m_pwszOriginalVolumeName: ::VSS_PWSZ, + m_pwszOriginatingMachine: ::VSS_PWSZ, + m_pwszServiceMachine: ::VSS_PWSZ, + m_pwszExposedName: ::VSS_PWSZ, + m_pwszExposedPath: ::VSS_PWSZ, + m_ProviderId: ::VSS_ID, + m_lSnapshotAttributes: ::LONG, + m_tsCreationTimestamp: ::VSS_TIMESTAMP, + m_eStatus: ::VSS_SNAPSHOT_STATE, +}} +type PVSS_SNAPSHOT_PROP = *mut VSS_SNAPSHOT_PROP; +STRUCT!{struct VSS_PROVIDER_PROP { + m_ProviderId: ::VSS_ID, + m_pwszProviderName: ::VSS_PWSZ, + m_eProviderType: ::VSS_PROVIDER_TYPE, + m_pwszProviderVersion: ::VSS_PWSZ, + m_ProviderVersionId: ::VSS_ID, + m_ClassId: ::CLSID, +}} +type PVSS_PROVIDER_PROP = *mut VSS_PROVIDER_PROP; +STRUCT!{struct VSS_OBJECT_UNION { + Snap: ::VSS_SNAPSHOT_PROP, +}} +UNION!(VSS_OBJECT_UNION, Snap, Prov, Prov_mut, VSS_PROVIDER_PROP); +STRUCT!{struct VSS_OBJECT_PROP { + Type: ::VSS_OBJECT_TYPE, + Obj: ::VSS_OBJECT_UNION, +}} +type PVSS_OBJECT_PROP = *mut VSS_OBJECT_PROP; +RIDL!( +interface IVssEnumObject(IVssEnumObjectVtbl): IUnknown(IUnknownVtbl) { + fn Next( + &mut self, celt: ::ULONG, rgelt: *mut ::VSS_OBJECT_PROP, pceltFetched: *mut ::ULONG + ) -> ::HRESULT, + fn Skip(&mut self, celt: ::ULONG) -> ::HRESULT, + fn Reset(&mut self) -> ::HRESULT, + fn Clone(&mut self, ppenum: *mut *mut ::IVssEnumObject) -> ::HRESULT +} +); +RIDL!( +interface IVssAsync(IVssAsyncVtbl): IUnknown(IUnknownVtbl) { + fn Cancel(&mut self) -> ::HRESULT, + fn Wait(&mut self, dwMilliseconds: ::DWORD) -> ::HRESULT, + fn QueryStatus(&mut self, pHrResult: *mut ::HRESULT, pReserved: *mut ::INT) -> ::HRESULT +} +); diff --git a/third_party/rust/winapi/src/vsserror.rs b/third_party/rust/winapi/src/vsserror.rs new file mode 100644 index 000000000000..ef84af0f080a --- /dev/null +++ b/third_party/rust/winapi/src/vsserror.rs @@ -0,0 +1,85 @@ +// Copyright © 2015, Brian Vincent +// Licensed under the MIT License +//! VSS Error header file +pub const VSS_E_BAD_STATE: ::HRESULT = 0x80042301u32 as i32; +pub const VSS_E_UNEXPECTED: ::HRESULT = 0x80042302u32 as i32; +pub const VSS_E_PROVIDER_ALREADY_REGISTERED: ::HRESULT = 0x80042303u32 as i32; +pub const VSS_E_PROVIDER_NOT_REGISTERED: ::HRESULT = 0x80042304u32 as i32; +pub const VSS_E_PROVIDER_VETO: ::HRESULT = 0x80042306u32 as i32; +pub const VSS_E_PROVIDER_IN_USE: ::HRESULT = 0x80042307u32 as i32; +pub const VSS_E_OBJECT_NOT_FOUND: ::HRESULT = 0x80042308u32 as i32; +pub const VSS_S_ASYNC_PENDING: ::HRESULT = 0x00042309u32 as i32; +pub const VSS_S_ASYNC_FINISHED: ::HRESULT = 0x0004230Au32 as i32; +pub const VSS_S_ASYNC_CANCELLED: ::HRESULT = 0x0004230Bu32 as i32; +pub const VSS_E_VOLUME_NOT_SUPPORTED: ::HRESULT = 0x8004230Cu32 as i32; +pub const VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER: ::HRESULT = 0x8004230Eu32 as i32; +pub const VSS_E_OBJECT_ALREADY_EXISTS: ::HRESULT = 0x8004230Du32 as i32; +pub const VSS_E_UNEXPECTED_PROVIDER_ERROR: ::HRESULT = 0x8004230Fu32 as i32; +pub const VSS_E_CORRUPT_XML_DOCUMENT: ::HRESULT = 0x80042310u32 as i32; +pub const VSS_E_INVALID_XML_DOCUMENT: ::HRESULT = 0x80042311u32 as i32; +pub const VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED: ::HRESULT = 0x80042312u32 as i32; +pub const VSS_E_FLUSH_WRITES_TIMEOUT: ::HRESULT = 0x80042313u32 as i32; +pub const VSS_E_HOLD_WRITES_TIMEOUT: ::HRESULT = 0x80042314u32 as i32; +pub const VSS_E_UNEXPECTED_WRITER_ERROR: ::HRESULT = 0x80042315u32 as i32; +pub const VSS_E_SNAPSHOT_SET_IN_PROGRESS: ::HRESULT = 0x80042316u32 as i32; +pub const VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED: ::HRESULT = 0x80042317u32 as i32; +pub const VSS_E_WRITER_INFRASTRUCTURE: ::HRESULT = 0x80042318u32 as i32; +pub const VSS_E_WRITER_NOT_RESPONDING: ::HRESULT = 0x80042319u32 as i32; +pub const VSS_E_WRITER_ALREADY_SUBSCRIBED: ::HRESULT = 0x8004231Au32 as i32; +pub const VSS_E_UNSUPPORTED_CONTEXT: ::HRESULT = 0x8004231Bu32 as i32; +pub const VSS_E_VOLUME_IN_USE: ::HRESULT = 0x8004231Du32 as i32; +pub const VSS_E_MAXIMUM_DIFFAREA_ASSOCIATIONS_REACHED: ::HRESULT = 0x8004231Eu32 as i32; +pub const VSS_E_INSUFFICIENT_STORAGE: ::HRESULT = 0x8004231Fu32 as i32; +pub const VSS_E_NO_SNAPSHOTS_IMPORTED: ::HRESULT = 0x80042320u32 as i32; +pub const VSS_S_SOME_SNAPSHOTS_NOT_IMPORTED: ::HRESULT = 0x00042321u32 as i32; +pub const VSS_E_SOME_SNAPSHOTS_NOT_IMPORTED: ::HRESULT = 0x80042321u32 as i32; +pub const VSS_E_MAXIMUM_NUMBER_OF_REMOTE_MACHINES_REACHED: ::HRESULT = 0x80042322u32 as i32; +pub const VSS_E_REMOTE_SERVER_UNAVAILABLE: ::HRESULT = 0x80042323u32 as i32; +pub const VSS_E_REMOTE_SERVER_UNSUPPORTED: ::HRESULT = 0x80042324u32 as i32; +pub const VSS_E_REVERT_IN_PROGRESS: ::HRESULT = 0x80042325u32 as i32; +pub const VSS_E_REVERT_VOLUME_LOST: ::HRESULT = 0x80042326u32 as i32; +pub const VSS_E_REBOOT_REQUIRED: ::HRESULT = 0x80042327u32 as i32; +pub const VSS_E_TRANSACTION_FREEZE_TIMEOUT: ::HRESULT = 0x80042328u32 as i32; +pub const VSS_E_TRANSACTION_THAW_TIMEOUT: ::HRESULT = 0x80042329u32 as i32; +pub const VSS_E_VOLUME_NOT_LOCAL: ::HRESULT = 0x8004232Du32 as i32; +pub const VSS_E_CLUSTER_TIMEOUT: ::HRESULT = 0x8004232Eu32 as i32; +pub const VSS_E_WRITERERROR_INCONSISTENTSNAPSHOT: ::HRESULT = 0x800423F0u32 as i32; +pub const VSS_E_WRITERERROR_OUTOFRESOURCES: ::HRESULT = 0x800423F1u32 as i32; +pub const VSS_E_WRITERERROR_TIMEOUT: ::HRESULT = 0x800423F2u32 as i32; +pub const VSS_E_WRITERERROR_RETRYABLE: ::HRESULT = 0x800423F3u32 as i32; +pub const VSS_E_WRITERERROR_NONRETRYABLE: ::HRESULT = 0x800423F4u32 as i32; +pub const VSS_E_WRITERERROR_RECOVERY_FAILED: ::HRESULT = 0x800423F5u32 as i32; +pub const VSS_E_BREAK_REVERT_ID_FAILED: ::HRESULT = 0x800423F6u32 as i32; +pub const VSS_E_LEGACY_PROVIDER: ::HRESULT = 0x800423F7u32 as i32; +pub const VSS_E_MISSING_DISK: ::HRESULT = 0x800423F8u32 as i32; +pub const VSS_E_MISSING_HIDDEN_VOLUME: ::HRESULT = 0x800423F9u32 as i32; +pub const VSS_E_MISSING_VOLUME: ::HRESULT = 0x800423FAu32 as i32; +pub const VSS_E_AUTORECOVERY_FAILED: ::HRESULT = 0x800423FBu32 as i32; +pub const VSS_E_DYNAMIC_DISK_ERROR: ::HRESULT = 0x800423FCu32 as i32; +pub const VSS_E_NONTRANSPORTABLE_BCD: ::HRESULT = 0x800423FDu32 as i32; +pub const VSS_E_CANNOT_REVERT_DISKID: ::HRESULT = 0x800423FEu32 as i32; +pub const VSS_E_RESYNC_IN_PROGRESS: ::HRESULT = 0x800423FFu32 as i32; +pub const VSS_E_CLUSTER_ERROR: ::HRESULT = 0x80042400u32 as i32; +pub const VSS_E_UNSELECTED_VOLUME: ::HRESULT = 0x8004232Au32 as i32; +pub const VSS_E_SNAPSHOT_NOT_IN_SET: ::HRESULT = 0x8004232Bu32 as i32; +pub const VSS_E_NESTED_VOLUME_LIMIT: ::HRESULT = 0x8004232Cu32 as i32; +pub const VSS_E_NOT_SUPPORTED: ::HRESULT = 0x8004232Fu32 as i32; +pub const VSS_E_WRITERERROR_PARTIAL_FAILURE: ::HRESULT = 0x80042336u32 as i32; +pub const VSS_E_ASRERROR_DISK_ASSIGNMENT_FAILED: ::HRESULT = 0x80042401u32 as i32; +pub const VSS_E_ASRERROR_DISK_RECREATION_FAILED: ::HRESULT = 0x80042402u32 as i32; +pub const VSS_E_ASRERROR_NO_ARCPATH: ::HRESULT = 0x80042403u32 as i32; +pub const VSS_E_ASRERROR_MISSING_DYNDISK: ::HRESULT = 0x80042404u32 as i32; +pub const VSS_E_ASRERROR_SHARED_CRIDISK: ::HRESULT = 0x80042405u32 as i32; +pub const VSS_E_ASRERROR_DATADISK_RDISK0: ::HRESULT = 0x80042406u32 as i32; +pub const VSS_E_ASRERROR_RDISK0_TOOSMALL: ::HRESULT = 0x80042407u32 as i32; +pub const VSS_E_ASRERROR_CRITICAL_DISKS_TOO_SMALL: ::HRESULT = 0x80042408u32 as i32; +pub const VSS_E_WRITER_STATUS_NOT_AVAILABLE: ::HRESULT = 0x80042409u32 as i32; +pub const VSS_E_ASRERROR_DYNAMIC_VHD_NOT_SUPPORTED: ::HRESULT = 0x8004240Au32 as i32; +pub const VSS_E_CRITICAL_VOLUME_ON_INVALID_DISK: ::HRESULT = 0x80042411u32 as i32; +pub const VSS_E_ASRERROR_RDISK_FOR_SYSTEM_DISK_NOT_FOUND: ::HRESULT = 0x80042412u32 as i32; +pub const VSS_E_ASRERROR_NO_PHYSICAL_DISK_AVAILABLE: ::HRESULT = 0x80042413u32 as i32; +pub const VSS_E_ASRERROR_FIXED_PHYSICAL_DISK_AVAILABLE_AFTER_DISK_EXCLUSION: ::HRESULT = + 0x80042414u32 as i32; +pub const VSS_E_ASRERROR_CRITICAL_DISK_CANNOT_BE_EXCLUDED: ::HRESULT = 0x80042415u32 as i32; +pub const VSS_E_ASRERROR_SYSTEM_PARTITION_HIDDEN: ::HRESULT = 0x80042416u32 as i32; +pub const VSS_E_FSS_TIMEOUT: ::HRESULT = 0x80042417u32 as i32; diff --git a/third_party/rust/winapi/src/vswriter.rs b/third_party/rust/winapi/src/vswriter.rs new file mode 100644 index 000000000000..fd1509c81453 --- /dev/null +++ b/third_party/rust/winapi/src/vswriter.rs @@ -0,0 +1,241 @@ +// Copyright © 2015, Brian Vincent +// Licensed under the MIT License +//! VSS Writer header file +ENUM!{enum VSS_USAGE_TYPE { + VSS_UT_UNDEFINED = 0, + VSS_UT_BOOTABLESYSTEMSTATE = 1, + VSS_UT_SYSTEMSERVICE = 2, + VSS_UT_USERDATA = 3, + VSS_UT_OTHER = 4, +}} +ENUM!{enum VSS_SOURCE_TYPE { + VSS_ST_UNDEFINED = 0, + VSS_ST_TRANSACTEDDB = 1, + VSS_ST_NONTRANSACTEDDB = 2, + VSS_ST_OTHER = 3, +}} +ENUM!{enum VSS_RESTOREMETHOD_ENUM { + VSS_RME_UNDEFINED = 0, + VSS_RME_RESTORE_IF_NOT_THERE = 1, + VSS_RME_RESTORE_IF_CAN_REPLACE = 2, + VSS_RME_STOP_RESTORE_START = 3, + VSS_RME_RESTORE_TO_ALTERNATE_LOCATION = 4, + VSS_RME_RESTORE_AT_REBOOT = 5, + VSS_RME_RESTORE_AT_REBOOT_IF_CANNOT_REPLACE = 6, + VSS_RME_CUSTOM = 7, + VSS_RME_RESTORE_STOP_START = 8, +}} +ENUM!{enum VSS_WRITERRESTORE_ENUM { + VSS_WRE_UNDEFINED = 0, + VSS_WRE_NEVER = 1, + VSS_WRE_IF_REPLACE_FAILS = 2, + VSS_WRE_ALWAYS = 3, +}} +ENUM!{enum VSS_COMPONENT_TYPE { + VSS_CT_UNDEFINED = 0, + VSS_CT_DATABASE = 1, + VSS_CT_FILEGROUP = 2, +}} +ENUM!{enum VSS_ALTERNATE_WRITER_STATE { + VSS_AWS_UNDEFINED = 0, + VSS_AWS_NO_ALTERNATE_WRITER = 1, + VSS_AWS_ALTERNATE_WRITER_EXISTS = 2, + VSS_AWS_THIS_IS_ALTERNATE_WRITER = 3, +}} +pub type VSS_SUBSCRIBE_MASK = ::DWORD; +pub const VSS_SM_POST_SNAPSHOT_FLAG: ::DWORD = 0x00000001; +pub const VSS_SM_BACKUP_EVENTS_FLAG: ::DWORD = 0x00000002; +pub const VSS_SM_RESTORE_EVENTS_FLAG: ::DWORD = 0x00000004; +pub const VSS_SM_IO_THROTTLING_FLAG: ::DWORD = 0x00000008; +pub const VSS_SM_ALL_FLAGS: ::DWORD = 0xffffffff; +ENUM!{enum VSS_RESTORE_TARGET { + VSS_RT_UNDEFINED = 0, + VSS_RT_ORIGINAL = 1, + VSS_RT_ALTERNATE = 2, + VSS_RT_DIRECTED = 3, + VSS_RT_ORIGINAL_LOCATION = 4, +}} +ENUM!{enum VSS_FILE_RESTORE_STATUS { + VSS_RS_UNDEFINED = 0, + VSS_RS_NONE = 1, + VSS_RS_ALL = 2, + VSS_RS_FAILED = 3, +}} +pub type VSS_COMPONENT_FLAGS = ::DWORD; +pub const VSS_CF_BACKUP_RECOVERY: ::DWORD = 0x00000001; +pub const VSS_CF_APP_ROLLBACK_RECOVERY: ::DWORD = 0x00000002; +pub const VSS_CF_NOT_SYSTEM_STATE: ::DWORD = 0x00000004; +RIDL!( +interface IVssWMFiledesc(IVssWMFiledescVtbl): IUnknown(IUnknownVtbl) { + fn GetPath(&mut self, pbstrPath: *mut ::BSTR) -> ::HRESULT, + fn GetFilespec(&mut self, pbstrFilespec: *mut ::BSTR) -> ::HRESULT, + fn GetRecursive(&mut self, pbRecursive: *mut bool) -> ::HRESULT, + fn GetAlternateLocation(&mut self, pbstrAlternateLocation: *mut ::BSTR) -> ::HRESULT, + fn GetBackupTypeMask(&mut self, pdwTypeMask: *mut ::DWORD) -> ::HRESULT +} +); +RIDL!( +interface IVssWMDependency(IVssWMDependencyVtbl): IUnknown(IUnknownVtbl) { + fn GetWriterId(&mut self, pWriterId: *mut ::VSS_ID) -> ::HRESULT, + fn GetLogicalPath(&mut self, pbstrLogicalPath: *mut ::BSTR) -> ::HRESULT, + fn GetComponentName(&mut self, pbstrComponentName: *mut ::BSTR) -> ::HRESULT +} +); +RIDL!( +interface IVssComponent(IVssComponentVtbl): IUnknown(IUnknownVtbl) { + fn GetLogicalPath(&mut self, pbstrPath: *mut ::BSTR) -> ::HRESULT, + fn GetComponentType(&mut self, pct: *mut ::VSS_COMPONENT_TYPE) -> ::HRESULT, + fn GetComponentName(&mut self, pbstrName: *mut ::BSTR) -> ::HRESULT, + fn GetBackupSucceeded(&mut self, pbSucceeded: *mut bool) -> ::HRESULT, + fn GetAlternateLocationMappingCount(&mut self, pcMappings: *mut ::UINT) -> ::HRESULT, + fn GetAlternateLocationMapping( + &mut self, iMapping: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT, + fn SetBackupMetadata(&mut self, wszData: ::LPCWSTR) -> ::HRESULT, + fn GetBackupMetadata(&mut self, pbstrData: *mut ::BSTR) -> ::HRESULT, + fn AddPartialFile( + &mut self, wszPath: ::LPCWSTR, wszFilename: ::LPCWSTR, wszRanges: ::LPCWSTR, + wszMetadata: ::LPCWSTR + ) -> ::HRESULT, + fn GetPartialFileCount(&mut self, pcPartialFiles: *mut ::UINT) -> ::HRESULT, + fn GetPartialFile( + &mut self, iPartialFile: ::UINT, pbstrPath: *mut ::BSTR, pbstrFilename: *mut ::BSTR, + pbstrRange: *mut ::BSTR, pbstrMetadata: *mut ::BSTR + ) -> ::HRESULT, + fn IsSelectedForRestore(&mut self, pbSelectedForRestore: *mut bool) -> ::HRESULT, + fn GetAdditionalRestores(&mut self, pbAdditionalRestores: *mut bool) -> ::HRESULT, + fn GetNewTargetCount(&mut self, pcNewTarget: *mut ::UINT) -> ::HRESULT, + fn GetNewTarget( + &mut self, iNewTarget: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc + ) -> ::HRESULT, + fn AddDirectedTarget( + &mut self, wszSourcePath: ::LPCWSTR, wszSourceFilename: ::LPCWSTR, + wszSourceRangeList: ::LPCWSTR, wszDestinationPath: ::LPCWSTR, + wszDestinationFilename: ::LPCWSTR, wszDestinationRangeList: ::LPCWSTR + ) -> ::HRESULT, + fn GetDirectedTargetCount(&mut self, pcDirectedTarget: *mut ::UINT) -> ::HRESULT, + fn GetDirectedTarget( + &mut self, iDirectedTarget: ::UINT, pbstrSourcePath: *mut ::BSTR, + pbstrSourceFileName: *mut ::BSTR, pbstrSourceRangeList: *mut ::BSTR, + pbstrDestinationPath: *mut ::BSTR, pbstrDestinationFilename: *mut ::BSTR, + pbstrDestinationRangeList: *mut ::BSTR + ) -> ::HRESULT, + fn SetRestoreMetadata(&mut self, wszRestoreMetadata: ::LPCWSTR) -> ::HRESULT, + fn GetRestoreMetadata(&mut self, pbstrRestoreMetadata: *mut ::BSTR) -> ::HRESULT, + fn SetRestoreTarget(&mut self, target: ::VSS_RESTORE_TARGET) -> ::HRESULT, + fn GetRestoreTarget(&mut self, pTarget: *mut ::VSS_RESTORE_TARGET) -> ::HRESULT, + fn SetPreRestoreFailureMsg(&mut self, wszPreRestoreFailureMsg: ::LPCWSTR) -> ::HRESULT, + fn GetPreRestoreFailureMsg(&mut self, pbstrPreRestoreFailureMsg: *mut ::BSTR) -> ::HRESULT, + fn SetPostRestoreFailureMsg(&mut self, wszPostRestoreFailureMsg: ::LPCWSTR) -> ::HRESULT, + fn GetPostRestoreFailureMsg(&mut self, pbstrPostRestoreFailureMsg: *mut ::BSTR) -> ::HRESULT, + fn SetBackupStamp(&mut self, wszBackupStamp: ::LPCWSTR) -> ::HRESULT, + fn GetBackupStamp(&mut self, pbstrBackupStamp: *mut ::BSTR) -> ::HRESULT, + fn GetPreviousBackupStamp(&mut self, pbstrBackupStamp: *mut ::BSTR) -> ::HRESULT, + fn GetBackupOptions(&mut self, pbstrBackupOptions: *mut ::BSTR) -> ::HRESULT, + fn GetRestoreOptions(&mut self, pbstrRestoreOptions: *mut ::BSTR) -> ::HRESULT, + fn GetRestoreSubcomponentCount(&mut self, pcRestoreSubcomponent: *mut ::UINT) -> ::HRESULT, + fn GetRestoreSubcomponent( + &mut self, iComponent: ::UINT, pbstrLogicalPath: *mut ::BSTR, + pbstrComponentName: *mut ::BSTR, pbRepair: *mut bool + ) -> ::HRESULT, + fn GetFileRestoreStatus(&mut self, pStatus: *mut VSS_FILE_RESTORE_STATUS) -> ::HRESULT, + fn AddDifferencedFilesByLastModifyTime( + &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: ::BOOL, + ftLastModifyTime: ::FILETIME + ) -> ::HRESULT, + fn AddDifferencedFilesByLastModifyLSN( + &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: ::BOOL, + bstrLsnString: ::BSTR + ) -> ::HRESULT, + fn GetDifferencedFilesCount(&mut self, pcDifferencedFiles: *mut ::UINT) -> ::HRESULT, + fn GetDifferencedFile( + &mut self, iDifferencedFile: ::UINT, pbstrPath: *mut ::BSTR, pbstrFilespec: *mut ::BSTR, + pbRecursive: *mut ::BOOL, pbstrLsnString: *mut ::BSTR, pftLastModifyTime: *mut ::FILETIME + ) -> ::HRESULT +} +); +RIDL!( +interface IVssWriterComponents(IVssWriterComponentsVtbl) { + fn GetComponentCount(&mut self, pcComponents: *mut ::UINT) -> ::HRESULT, + fn GetWriterInfo( + &mut self, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID + ) -> ::HRESULT, + fn GetComponent( + &mut self, iComponent: ::UINT, ppComponent: *mut *mut ::IVssComponent + ) -> ::HRESULT +} +); +RIDL!( +interface IVssComponentEx(IVssComponentExVtbl): IVssComponent(IVssComponentVtbl) { + fn SetPrepareForBackupFailureMsg(&mut self, wszFailureMsg: ::LPCWSTR) -> ::HRESULT, + fn SetPostSnapshotFailureMsg(&mut self, wszFailureMsg: ::LPCWSTR) -> ::HRESULT, + fn GetPrepareForBackupFailureMsg(&mut self, pbstrFailureMsg: *mut ::BSTR) -> ::HRESULT, + fn GetPostSnapshotFailureMsg(&mut self, pbstrFailureMsg: *mut ::BSTR) -> ::HRESULT, + fn GetAuthoritativeRestore(&mut self, pbAuth: *mut bool) -> ::HRESULT, + fn GetRollForward( + &mut self, pRollType: *mut ::VSS_ROLLFORWARD_TYPE, pbstrPoint: *mut ::BSTR + ) -> ::HRESULT, + fn GetRestoreName(&mut self, pbstrName: *mut ::BSTR) -> ::HRESULT +} +); +RIDL!( +interface IVssComponentEx2(IVssComponentEx2Vtbl): IVssComponentEx(IVssComponentExVtbl) { + fn SetFailure( + &mut self, hr: ::HRESULT, hrApplication: ::HRESULT, wszApplicationMessage: ::LPCWSTR, + dwReserved: ::DWORD + ) -> ::HRESULT, + fn GetFailure( + &mut self, phr: *mut ::HRESULT, phrApplication: *mut ::HRESULT, + pbstrApplicationMessage: *mut ::BSTR, pdwReserved: *mut ::DWORD + ) -> ::HRESULT +} +); +RIDL!( +interface IVssCreateWriterMetadata(IVssCreateWriterMetadataVtbl) { + fn AddIncludeFiles( + &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool, + wszAlternateLocation: ::LPCWSTR + ) -> ::HRESULT, + fn AddExcludeFiles( + &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool + ) -> ::HRESULT, + fn AddComponent( + &mut self, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, + wszComponentName: ::LPCWSTR, wszCaption: ::LPCWSTR, pbIcon: *const ::BYTE, cbIcon: ::UINT, + bRestoreMetadata: bool, bNotifyOnBackupComplete: bool, bSelectableForRestore: bool, + dwComponentFlags: ::DWORD + ) -> ::HRESULT, + fn AddDatabaseFiles( + &mut self, wszLogicalPath: ::LPCWSTR, wszDatabaseName: ::LPCWSTR, wszPath: ::LPCWSTR, + wszFilespec: ::LPCWSTR, dwBackupTypeMask: ::DWORD + ) -> ::HRESULT, + fn AddDatabaseLogFiles(&mut self, wszLogicalPath: ::LPCWSTR, wszDatabaseName: ::LPCWSTR, + wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, dwBackupTypeMask: ::DWORD + ) -> ::HRESULT, + fn AddFilesToFileGroup(&mut self, wszLogicalPath: ::LPCWSTR, wszGroupName: ::LPCWSTR, + wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool, + wszAlternateLocation: ::LPCWSTR, dwBackupTypeMask: ::DWORD + ) -> ::HRESULT, + fn SetRestoreMethod(&mut self, method: ::VSS_RESTOREMETHOD_ENUM, wszService: ::LPCWSTR, + wszUserProcedure: ::LPCWSTR, writerRestore: ::VSS_WRITERRESTORE_ENUM, + bRebootRequired: bool + ) -> ::HRESULT, + fn AddAlternateLocationMapping(&mut self, wszSourcePath: ::LPCWSTR, + wszSourceFilespec: ::LPCWSTR, bRecursive: bool, wszDestination: ::LPCWSTR + ) -> ::HRESULT, + fn AddComponentDependency(&mut self, wszForLogicalPath: ::LPCWSTR, + wszForComponentName: ::LPCWSTR, onWriterId: ::VSS_ID, wszOnLogicalPath: ::LPCWSTR, + wszOnComponentName: ::LPCWSTR + ) -> ::HRESULT, + fn SetBackupSchema(&mut self, dwSchemaMask: ::DWORD) -> ::HRESULT, + fn GetDocument(&mut self, pDoc: *mut *mut ::VOID) -> ::HRESULT, //TODO IXMLDOMDocument + fn SaveAsXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT +} +); +//IVssCreateWriterMetadataEx +//IVssWriterImpl +//IVssCreateExpressWriterMetadata +//IVssExpressWriter +//CVssWriter +//CVssWriterEx +//CVssWriterEx2 diff --git a/third_party/rust/winapi/src/werapi.rs b/third_party/rust/winapi/src/werapi.rs new file mode 100644 index 000000000000..33a5a50d7ec3 --- /dev/null +++ b/third_party/rust/winapi/src/werapi.rs @@ -0,0 +1,8 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Function prototypes for Windows Error Reporting (WER) +ENUM!{enum WER_REGISTER_FILE_TYPE { + WerRegFileTypeUserDocument = 1, + WerRegFileTypeOther = 2, + WerRegFileTypeMax, +}} diff --git a/third_party/rust/winapi/src/winbase.rs b/third_party/rust/winapi/src/winbase.rs new file mode 100644 index 000000000000..59e3988a17f7 --- /dev/null +++ b/third_party/rust/winapi/src/winbase.rs @@ -0,0 +1,552 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This module defines the 32-Bit Windows Base APIs +pub const FILE_BEGIN: ::DWORD = 0; +pub const FILE_CURRENT: ::DWORD = 1; +pub const FILE_END: ::DWORD = 2; +pub const WAIT_FAILED: ::DWORD = 0xFFFFFFFF; +pub const WAIT_OBJECT_0: ::DWORD = ::STATUS_WAIT_0 as ::DWORD; +pub const WAIT_ABANDONED: ::DWORD = ::STATUS_ABANDONED_WAIT_0 as ::DWORD; +pub const WAIT_ABANDONED_0: ::DWORD = ::STATUS_ABANDONED_WAIT_0 as ::DWORD; +pub const WAIT_IO_COMPLETION: ::DWORD = ::STATUS_USER_APC as ::DWORD; +pub const FILE_FLAG_WRITE_THROUGH: ::DWORD = 0x80000000; +pub const FILE_FLAG_OVERLAPPED: ::DWORD = 0x40000000; +pub const FILE_FLAG_NO_BUFFERING: ::DWORD = 0x20000000; +pub const FILE_FLAG_RANDOM_ACCESS: ::DWORD = 0x10000000; +pub const FILE_FLAG_SEQUENTIAL_SCAN: ::DWORD = 0x08000000; +pub const FILE_FLAG_DELETE_ON_CLOSE: ::DWORD = 0x04000000; +pub const FILE_FLAG_BACKUP_SEMANTICS: ::DWORD = 0x02000000; +pub const FILE_FLAG_POSIX_SEMANTICS: ::DWORD = 0x01000000; +pub const FILE_FLAG_SESSION_AWARE: ::DWORD = 0x00800000; +pub const FILE_FLAG_OPEN_REPARSE_POINT: ::DWORD = 0x00200000; +pub const FILE_FLAG_OPEN_NO_RECALL: ::DWORD = 0x00100000; +pub const FILE_FLAG_FIRST_PIPE_INSTANCE: ::DWORD = 0x00080000; +pub const FILE_FLAG_OPEN_REQUIRING_OPLOCK: ::DWORD = 0x00040000; +pub const PROGRESS_CONTINUE: ::DWORD = 0; +pub const PROGRESS_CANCEL: ::DWORD = 1; +pub const PROGRESS_STOP: ::DWORD = 2; +pub const PROGRESS_QUIET: ::DWORD = 3; +pub const CALLBACK_CHUNK_FINISHED: ::DWORD = 0x00000000; +pub const CALLBACK_STREAM_SWITCH: ::DWORD = 0x00000001; +pub const COPY_FILE_FAIL_IF_EXISTS: ::DWORD = 0x00000001; +pub const COPY_FILE_RESTARTABLE: ::DWORD = 0x00000002; +pub const COPY_FILE_OPEN_SOURCE_FOR_WRITE: ::DWORD = 0x00000004; +pub const COPY_FILE_ALLOW_DECRYPTED_DESTINATION: ::DWORD = 0x00000008; +pub const COPY_FILE_COPY_SYMLINK: ::DWORD = 0x00000800; +pub const COPY_FILE_NO_BUFFERING: ::DWORD = 0x00001000; +pub const COPY_FILE_REQUEST_SECURITY_PRIVILEGES: ::DWORD = 0x00002000; +pub const COPY_FILE_RESUME_FROM_PAUSE: ::DWORD = 0x00004000; +pub const COPY_FILE_NO_OFFLOAD: ::DWORD = 0x00040000; +pub const REPLACEFILE_WRITE_THROUGH: ::DWORD = 0x00000001; +pub const REPLACEFILE_IGNORE_MERGE_ERRORS: ::DWORD = 0x00000002; +pub const REPLACEFILE_IGNORE_ACL_ERRORS: ::DWORD = 0x00000004; +pub const PIPE_ACCESS_INBOUND: ::DWORD = 0x00000001; +pub const PIPE_ACCESS_OUTBOUND: ::DWORD = 0x00000002; +pub const PIPE_ACCESS_DUPLEX: ::DWORD = 0x00000003; +pub const PIPE_CLIENT_END: ::DWORD = 0x00000000; +pub const PIPE_SERVER_END: ::DWORD = 0x00000001; +pub const PIPE_WAIT: ::DWORD = 0x00000000; +pub const PIPE_NOWAIT: ::DWORD = 0x00000001; +pub const PIPE_READMODE_BYTE: ::DWORD = 0x00000000; +pub const PIPE_READMODE_MESSAGE: ::DWORD = 0x00000002; +pub const PIPE_TYPE_BYTE: ::DWORD = 0x00000000; +pub const PIPE_TYPE_MESSAGE: ::DWORD = 0x00000004; +pub const PIPE_ACCEPT_REMOTE_CLIENTS: ::DWORD = 0x00000000; +pub const PIPE_REJECT_REMOTE_CLIENTS: ::DWORD = 0x00000008; +pub const PIPE_UNLIMITED_INSTANCES: ::DWORD = 255; +//270 +pub const SECURITY_CONTEXT_TRACKING: ::DWORD = 0x00040000; +pub const SECURITY_EFFECTIVE_ONLY: ::DWORD = 0x00080000; +pub const SECURITY_SQOS_PRESENT: ::DWORD = 0x00100000; +pub const SECURITY_VALID_SQOS_FLAGS: ::DWORD = 0x001F0000; +//282 +pub type PFIBER_START_ROUTINE = Option; +pub type LPFIBER_START_ROUTINE = PFIBER_START_ROUTINE; +pub type PFIBER_CALLOUT_ROUTINE = Option ::LPVOID>; +//299 +pub type LPLDT_ENTRY = ::LPVOID; // TODO - fix this for 32-bit +//405 +STRUCT!{struct COMMPROP { + wPacketLength: ::WORD, + wPacketVersion: ::WORD, + dwServiceMask: ::DWORD, + dwReserved1: ::DWORD, + dwMaxTxQueue: ::DWORD, + dwMaxRxQueue: ::DWORD, + dwMaxBaud: ::DWORD, + dwProvSubType: ::DWORD, + dwProvCapabilities: ::DWORD, + dwSettableParams: ::DWORD, + dwSettableBaud: ::DWORD, + wSettableData: ::WORD, + wSettableStopParity: ::WORD, + dwCurrentTxQueue: ::DWORD, + dwCurrentRxQueue: ::DWORD, + dwProvSpec1: ::DWORD, + dwProvSpec2: ::DWORD, + wcProvChar: [::WCHAR; 1], +}} +pub type LPCOMMPROP = *mut COMMPROP; +//432 +STRUCT!{struct COMSTAT { + BitFields: ::DWORD, + cbInQue: ::DWORD, + cbOutQue : ::DWORD, +}} +BITFIELD!(COMSTAT BitFields: ::DWORD [ + fCtsHold set_fCtsHold[0..1], + fDsrHold set_fDsrHold[1..2], + fRlsdHold set_fRlsdHold[2..3], + fXoffHold set_fXoffHold[3..4], + fXoffSent set_fXoffSent[4..5], + fEof set_fEof[5..6], + fTxim set_fTxim[6..7], + fReserved set_fReserved[7..32], +]); +pub type LPCOMSTAT = *mut COMSTAT; +//460 +STRUCT!{struct DCB { + DCBlength: ::DWORD, + BaudRate: ::DWORD, + BitFields: ::DWORD, + wReserved: ::WORD, + XonLim: ::WORD, + XoffLim: ::WORD, + ByteSize: ::BYTE, + Parity: ::BYTE, + StopBits: ::BYTE, + XonChar: ::c_char, + XoffChar: ::c_char, + ErrorChar: ::c_char, + EofChar: ::c_char, + EvtChar: ::c_char, + wReserved1: ::WORD, +}} +BITFIELD!(DCB BitFields: ::DWORD [ + fBinary set_fBinary[0..1], + fParity set_fParity[1..2], + fOutxCtsFlow set_fOutxCtsFlow[2..3], + fOutxDsrFlow set_fOutxDsrFlow[3..4], + fDtrControl set_fDtrControl[4..6], + fDsrSensitivity set_fDsrSensitivity[6..7], + fTXContinueOnXoff set_fTXContinueOnXoff[7..8], + fOutX set_fOutX[8..9], + fInX set_fInX[9..10], + fErrorChar set_fErrorChar[10..11], + fNull set_fNull[11..12], + fRtsControl set_fRtsControl[12..14], + fAbortOnError set_fAbortOnError[14..15], + fDummy2 set_fDummy2[15..32], +]); +pub type LPDCB = *mut DCB; +STRUCT!{struct COMMTIMEOUTS { + ReadIntervalTimeout: ::DWORD, + ReadTotalTimeoutMultiplier: ::DWORD, + ReadTotalTimeoutConstant: ::DWORD, + WriteTotalTimeoutMultiplier: ::DWORD, + WriteTotalTimeoutConstant: ::DWORD, +}} +pub type LPCOMMTIMEOUTS = *mut COMMTIMEOUTS; +STRUCT!{struct COMMCONFIG { + dwSize: ::DWORD, + wVersion: ::WORD, + wReserved: ::WORD, + dcb: DCB, + dwProviderSubType: ::DWORD, + dwProviderOffset: ::DWORD, + dwProviderSize: ::DWORD, + wcProviderData: [::WCHAR; 1], +}} +pub type LPCOMMCONFIG = *mut COMMCONFIG; +//547 +STRUCT!{struct MEMORYSTATUS { + dwLength: ::DWORD, + dwMemoryLoad: ::DWORD, + dwTotalPhys: ::SIZE_T, + dwAvailPhys: ::SIZE_T, + dwTotalPageFile: ::SIZE_T, + dwAvailPageFile: ::SIZE_T, + dwTotalVirtual: ::SIZE_T, + dwAvailVirtual: ::SIZE_T, +}} +pub type LPMEMORYSTATUS = *mut MEMORYSTATUS; +//568 +pub const DEBUG_PROCESS: ::DWORD = 0x00000001; +pub const DEBUG_ONLY_THIS_PROCESS: ::DWORD = 0x00000002; +pub const CREATE_SUSPENDED: ::DWORD = 0x00000004; +pub const DETACHED_PROCESS: ::DWORD = 0x00000008; +pub const CREATE_NEW_CONSOLE: ::DWORD = 0x00000010; +pub const NORMAL_PRIORITY_CLASS: ::DWORD = 0x00000020; +pub const IDLE_PRIORITY_CLASS: ::DWORD = 0x00000040; +pub const HIGH_PRIORITY_CLASS: ::DWORD = 0x00000080; +pub const REALTIME_PRIORITY_CLASS: ::DWORD = 0x00000100; +pub const CREATE_NEW_PROCESS_GROUP: ::DWORD = 0x00000200; +pub const CREATE_UNICODE_ENVIRONMENT: ::DWORD = 0x00000400; +pub const CREATE_SEPARATE_WOW_VDM: ::DWORD = 0x00000800; +pub const CREATE_SHARED_WOW_VDM: ::DWORD = 0x00001000; +pub const CREATE_FORCEDOS: ::DWORD = 0x00002000; +pub const BELOW_NORMAL_PRIORITY_CLASS: ::DWORD = 0x00004000; +pub const ABOVE_NORMAL_PRIORITY_CLASS: ::DWORD = 0x00008000; +pub const INHERIT_PARENT_AFFINITY: ::DWORD = 0x00010000; +pub const INHERIT_CALLER_PRIORITY: ::DWORD = 0x00020000; +pub const CREATE_PROTECTED_PROCESS: ::DWORD = 0x00040000; +pub const EXTENDED_STARTUPINFO_PRESENT: ::DWORD = 0x00080000; +pub const PROCESS_MODE_BACKGROUND_BEGIN: ::DWORD = 0x00100000; +pub const PROCESS_MODE_BACKGROUND_END: ::DWORD = 0x00200000; +pub const CREATE_BREAKAWAY_FROM_JOB: ::DWORD = 0x01000000; +pub const CREATE_PRESERVE_CODE_AUTHZ_LEVEL: ::DWORD = 0x02000000; +pub const CREATE_DEFAULT_ERROR_MODE: ::DWORD = 0x04000000; +pub const CREATE_NO_WINDOW: ::DWORD = 0x08000000; +pub const PROFILE_USER: ::DWORD = 0x10000000; +pub const PROFILE_KERNEL: ::DWORD = 0x20000000; +pub const PROFILE_SERVER: ::DWORD = 0x40000000; +pub const CREATE_IGNORE_SYSTEM_DEFAULT: ::DWORD = 0x80000000; +//618 +pub const THREAD_PRIORITY_LOWEST: ::DWORD = ::THREAD_BASE_PRIORITY_MIN; +pub const THREAD_PRIORITY_BELOW_NORMAL: ::DWORD = THREAD_PRIORITY_LOWEST + 1; +pub const THREAD_PRIORITY_NORMAL: ::DWORD = 0; +pub const THREAD_PRIORITY_HIGHEST: ::DWORD = ::THREAD_BASE_PRIORITY_MAX; +pub const THREAD_PRIORITY_ABOVE_NORMAL: ::DWORD = THREAD_PRIORITY_HIGHEST - 1; +pub const THREAD_PRIORITY_ERROR_RETURN: ::DWORD = ::MAXLONG as ::DWORD; +pub const THREAD_PRIORITY_TIME_CRITICAL: ::DWORD = ::THREAD_BASE_PRIORITY_LOWRT; +pub const THREAD_PRIORITY_IDLE: ::DWORD = ::THREAD_BASE_PRIORITY_IDLE; +pub const THREAD_MODE_BACKGROUND_BEGIN: ::DWORD = 0x00010000; +pub const THREAD_MODE_BACKGROUND_END: ::DWORD = 0x00020000; +//666 +pub const DRIVE_UNKNOWN: ::DWORD = 0; +pub const DRIVE_NO_ROOT_DIR: ::DWORD = 1; +pub const DRIVE_REMOVABLE: ::DWORD = 2; +pub const DRIVE_FIXED: ::DWORD = 3; +pub const DRIVE_REMOTE: ::DWORD = 4; +pub const DRIVE_CDROM: ::DWORD = 5; +pub const DRIVE_RAMDISK: ::DWORD = 6; +pub const FILE_TYPE_UNKNOWN: ::DWORD = 0x0000; +pub const FILE_TYPE_DISK: ::DWORD = 0x0001; +pub const FILE_TYPE_CHAR: ::DWORD = 0x0002; +pub const FILE_TYPE_PIPE: ::DWORD = 0x0003; +pub const FILE_TYPE_REMOTE: ::DWORD = 0x8000; +pub const STD_INPUT_HANDLE: ::DWORD = 0xFFFFFFF6; +pub const STD_OUTPUT_HANDLE: ::DWORD = 0xFFFFFFF5; +pub const STD_ERROR_HANDLE: ::DWORD = 0xFFFFFFF4; +pub const NOPARITY: ::DWORD = 0; +pub const ODDPARITY: ::DWORD = 1; +pub const EVENPARITY: ::DWORD = 2; +pub const MARKPARITY: ::DWORD = 3; +pub const SPACEPARITY: ::DWORD = 4; +pub const ONESTOPBIT: ::DWORD = 0; +pub const ONE5STOPBITS: ::DWORD = 1; +pub const TWOSTOPBITS: ::DWORD = 2; +pub const IGNORE: ::DWORD = 0; +pub const INFINITE: ::DWORD = 0xFFFFFFFF; +//1729 +pub const SEM_FAILCRITICALERRORS: ::UINT = 0x0001; +pub const SEM_NOGPFAULTERRORBOX: ::UINT = 0x0002; +pub const SEM_NOALIGNMENTFAULTEXCEPT: ::UINT = 0x0004; +pub const SEM_NOOPENFILEERRORBOX: ::UINT = 0x8000; +//2320 +pub const FORMAT_MESSAGE_IGNORE_INSERTS: ::DWORD = 0x00000200; +pub const FORMAT_MESSAGE_FROM_STRING: ::DWORD = 0x00000400; +pub const FORMAT_MESSAGE_FROM_HMODULE: ::DWORD = 0x00000800; +pub const FORMAT_MESSAGE_FROM_SYSTEM: ::DWORD = 0x00001000; +pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: ::DWORD = 0x00002000; +pub const FORMAT_MESSAGE_MAX_WIDTH_MASK: ::DWORD = 0x000000FF; +pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: ::DWORD = 0x00000100; +//2873 +pub const STARTF_USESHOWWINDOW: ::DWORD = 0x00000001; +pub const STARTF_USESIZE: ::DWORD = 0x00000002; +pub const STARTF_USEPOSITION: ::DWORD = 0x00000004; +pub const STARTF_USECOUNTCHARS: ::DWORD = 0x00000008; +pub const STARTF_USEFILLATTRIBUTE: ::DWORD = 0x00000010; +pub const STARTF_RUNFULLSCREEN: ::DWORD = 0x00000020; +pub const STARTF_FORCEONFEEDBACK: ::DWORD = 0x00000040; +pub const STARTF_FORCEOFFFEEDBACK: ::DWORD = 0x00000080; +pub const STARTF_USESTDHANDLES: ::DWORD = 0x00000100; +pub const STARTF_USEHOTKEY: ::DWORD = 0x00000200; +pub const STARTF_TITLEISLINKNAME: ::DWORD = 0x00000800; +pub const STARTF_TITLEISAPPID: ::DWORD = 0x00001000; +pub const STARTF_PREVENTPINNING: ::DWORD = 0x00002000; +pub const STARTF_UNTRUSTEDSOURCE: ::DWORD = 0x00008000; +//5002 +pub type LPPROGRESS_ROUTINE = Option ::DWORD>; +//5095 +ENUM!{enum COPYFILE2_MESSAGE_TYPE { + COPYFILE2_CALLBACK_NONE = 0, + COPYFILE2_CALLBACK_CHUNK_STARTED, + COPYFILE2_CALLBACK_CHUNK_FINISHED, + COPYFILE2_CALLBACK_STREAM_STARTED, + COPYFILE2_CALLBACK_STREAM_FINISHED, + COPYFILE2_CALLBACK_POLL_CONTINUE, + COPYFILE2_CALLBACK_ERROR, + COPYFILE2_CALLBACK_MAX, +}} +ENUM!{enum COPYFILE2_MESSAGE_ACTION { + COPYFILE2_PROGRESS_CONTINUE = 0, + COPYFILE2_PROGRESS_CANCEL, + COPYFILE2_PROGRESS_STOP, + COPYFILE2_PROGRESS_QUIET, + COPYFILE2_PROGRESS_PAUSE, +}} +ENUM!{enum COPYFILE2_COPY_PHASE { + COPYFILE2_PHASE_NONE = 0, + COPYFILE2_PHASE_PREPARE_SOURCE, + COPYFILE2_PHASE_PREPARE_DEST, + COPYFILE2_PHASE_READ_SOURCE, + COPYFILE2_PHASE_WRITE_DESTINATION, + COPYFILE2_PHASE_SERVER_COPY, + COPYFILE2_PHASE_NAMEGRAFT_COPY, + COPYFILE2_PHASE_MAX, +}} +//5129 +STRUCT!{struct COPYFILE2_MESSAGE_ChunkStarted { + dwStreamNumber: ::DWORD, + dwReserved: ::DWORD, + hSourceFile: ::HANDLE, + hDestinationFile: ::HANDLE, + uliChunkNumber: ::ULARGE_INTEGER, + uliChunkSize: ::ULARGE_INTEGER, + uliStreamSize: ::ULARGE_INTEGER, + uliTotalFileSize: ::ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_ChunkFinished { + dwStreamNumber: ::DWORD, + dwFlags: ::DWORD, + hSourceFile: ::HANDLE, + hDestinationFile: ::HANDLE, + uliChunkNumber: ::ULARGE_INTEGER, + uliChunkSize: ::ULARGE_INTEGER, + uliStreamSize: ::ULARGE_INTEGER, + uliStreamBytesTransferred: ::ULARGE_INTEGER, + uliTotalFileSize: ::ULARGE_INTEGER, + uliTotalBytesTransferred: ::ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_StreamStarted { + dwStreamNumber: ::DWORD, + dwReserved: ::DWORD, + hSourceFile: ::HANDLE, + hDestinationFile: ::HANDLE, + uliStreamSize: ::ULARGE_INTEGER, + uliTotalFileSize: ::ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_StreamFinished { + dwStreamNumber: ::DWORD, + dwReserved: ::DWORD, + hSourceFile: ::HANDLE, + hDestinationFile: ::HANDLE, + uliStreamSize: ::ULARGE_INTEGER, + uliStreamBytesTransferred: ::ULARGE_INTEGER, + uliTotalFileSize: ::ULARGE_INTEGER, + uliTotalBytesTransferred: ::ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_PollContinue { + dwReserved: ::DWORD, +}} +STRUCT!{struct COPYFILE2_MESSAGE_Error { + CopyPhase: COPYFILE2_COPY_PHASE, + dwStreamNumber: ::DWORD, + hrFailure: ::HRESULT, + dwReserved: ::DWORD, + uliChunkNumber: ::ULARGE_INTEGER, + uliStreamSize: ::ULARGE_INTEGER, + uliStreamBytesTransferred: ::ULARGE_INTEGER, + uliTotalFileSize: ::ULARGE_INTEGER, + uliTotalBytesTransferred: ::ULARGE_INTEGER, +}} +#[cfg(target_arch="x86")] +STRUCT!{struct COPYFILE2_MESSAGE { + Type: COPYFILE2_MESSAGE_TYPE, + dwPadding: ::DWORD, + Info: [u64; 8], +}} +#[cfg(target_arch="x86_64")] +STRUCT!{struct COPYFILE2_MESSAGE { + Type: COPYFILE2_MESSAGE_TYPE, + dwPadding: ::DWORD, + Info: [u64; 9], +}} +UNION!{COPYFILE2_MESSAGE, Info, ChunkStarted, ChunkStarted_mut, COPYFILE2_MESSAGE_ChunkStarted} +UNION!{COPYFILE2_MESSAGE, Info, ChunkFinished, ChunkFinished_mut, COPYFILE2_MESSAGE_ChunkFinished} +UNION!{COPYFILE2_MESSAGE, Info, StreamStarted, StreamStarted_mut, COPYFILE2_MESSAGE_StreamStarted} +UNION!{COPYFILE2_MESSAGE, Info, StreamFinished, StreamFinished_mut, + COPYFILE2_MESSAGE_StreamFinished} +UNION!{COPYFILE2_MESSAGE, Info, PollContinue, PollContinue_mut, COPYFILE2_MESSAGE_PollContinue} +UNION!{COPYFILE2_MESSAGE, Info, Error, Error_mut, COPYFILE2_MESSAGE_Error} +pub type PCOPYFILE2_PROGRESS_ROUTINE = Option COPYFILE2_MESSAGE_ACTION>; +STRUCT!{nodebug struct COPYFILE2_EXTENDED_PARAMETERS { + dwSize: ::DWORD, + dwCopyFlags: ::DWORD, + pfCancel: *mut ::BOOL, + pProgressRoutine: PCOPYFILE2_PROGRESS_ROUTINE, + pvCallbackContext: ::PVOID, +}} +//5377 +pub const MOVEFILE_REPLACE_EXISTING: ::DWORD = 0x00000001; +pub const MOVEFILE_COPY_ALLOWED: ::DWORD = 0x00000002; +pub const MOVEFILE_DELAY_UNTIL_REBOOT: ::DWORD = 0x00000004; +pub const MOVEFILE_WRITE_THROUGH: ::DWORD = 0x00000008; +pub const MOVEFILE_CREATE_HARDLINK: ::DWORD = 0x00000010; +pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: ::DWORD = 0x00000020; +//7176 +pub const HW_PROFILE_GUIDLEN: usize = 39; +//pub const MAX_PROFILE_LEN: usize = 80; +pub const DOCKINFO_UNDOCKED: ::DWORD = 0x1; +pub const DOCKINFO_DOCKED: ::DWORD = 0x2; +pub const DOCKINFO_USER_SUPPLIED: ::DWORD = 0x4; +pub const DOCKINFO_USER_UNDOCKED: ::DWORD = DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED; +pub const DOCKINFO_USER_DOCKED: ::DWORD = DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED; +STRUCT!{nodebug struct HW_PROFILE_INFOA { + dwDockInfo: ::DWORD, + szHwProfileGuid: [::CHAR; HW_PROFILE_GUIDLEN], + szHwProfileName: [::CHAR; ::MAX_PROFILE_LEN], +}} +pub type LPHW_PROFILE_INFOA = *mut HW_PROFILE_INFOA; +STRUCT!{nodebug struct HW_PROFILE_INFOW { + dwDockInfo: ::DWORD, + szHwProfileGuid: [::WCHAR; HW_PROFILE_GUIDLEN], + szHwProfileName: [::WCHAR; ::MAX_PROFILE_LEN], +}} +pub type LPHW_PROFILE_INFOW = *mut HW_PROFILE_INFOW; +//7574 +STRUCT!{struct ACTCTXA { + cbSize: ::ULONG, + dwFlags: ::DWORD, + lpSource: ::LPCSTR, + wProcessorArchitecture: ::USHORT, + wLangId: ::LANGID, + lpAssemblyDirectory: ::LPCSTR, + lpResourceName: ::LPCSTR, + lpApplicationName: ::LPCSTR, + hModule: ::HMODULE, +}} +pub type PACTCTXA = *mut ACTCTXA; +STRUCT!{struct ACTCTXW { + cbSize: ::ULONG, + dwFlags: ::DWORD, + lpSource: ::LPCWSTR, + wProcessorArchitecture: ::USHORT, + wLangId: ::LANGID, + lpAssemblyDirectory: ::LPCWSTR, + lpResourceName: ::LPCWSTR, + lpApplicationName: ::LPCWSTR, + hModule: ::HMODULE, +}} +pub type PACTCTXW = *mut ACTCTXW; +pub type PCACTCTXA = *const ACTCTXA; +pub type PCACTCTXW = *const ACTCTXW; +// +pub type PUMS_CONTEXT = *mut ::c_void; +pub type PUMS_COMPLETION_LIST = *mut ::c_void; +pub type UMS_THREAD_INFO_CLASS = ::RTL_UMS_THREAD_INFO_CLASS; +pub type PUMS_THREAD_INFO_CLASS = *mut UMS_THREAD_INFO_CLASS; +pub type PUMS_SCHEDULER_ENTRY_POINT = ::PRTL_UMS_SCHEDULER_ENTRY_POINT; +STRUCT!{nodebug struct UMS_SCHEDULER_STARTUP_INFO { + UmsVersion: ::ULONG, + CompletionList: PUMS_COMPLETION_LIST, + SchedulerProc: PUMS_SCHEDULER_ENTRY_POINT, + SchedulerParam: ::PVOID, +}} +pub type PUMS_SCHEDULER_STARTUP_INFO = *mut UMS_SCHEDULER_STARTUP_INFO; +STRUCT!{struct UMS_SYSTEM_THREAD_INFORMATION { + UmsVersion: ::ULONG, + BitFields: ::ULONG, +}} +BITFIELD!(UMS_SYSTEM_THREAD_INFORMATION BitFields: ::ULONG [ + IsUmsSchedulerThread set_IsUmsSchedulerThread[0..1], + IsUmsWorkerThread set_IsUmsWorkerThread[1..2], +]); +UNION!( + UMS_SYSTEM_THREAD_INFORMATION, BitFields, ThreadUmsFlags, ThreadUmsFlags_mut, + ::ULONG +); +pub type PUMS_SYSTEM_THREAD_INFORMATION = *mut UMS_SYSTEM_THREAD_INFORMATION; +STRUCT!{struct ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA { + lpInformation: ::PVOID, + lpSectionBase: ::PVOID, + ulSectionLength: ::ULONG, + lpSectionGlobalDataBase: ::PVOID, + ulSectionGlobalDataLength: ::ULONG, +}} +pub type PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA = + *mut ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; +pub type PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA = + *const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; +STRUCT!{struct ACTCTX_SECTION_KEYED_DATA { + cbSize: ::ULONG, + ulDataFormatVersion: ::ULONG, + lpData: ::PVOID, + ulLength: ::ULONG, + lpSectionGlobalData: ::PVOID, + ulSectionGlobalDataLength: ::ULONG, + lpSectionBase: ::PVOID, + ulSectionTotalLength: ::ULONG, + hActCtx: ::HANDLE, + ulAssemblyRosterIndex: ::ULONG, + ulFlags: ::ULONG, + AssemblyMetadata: ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, +}} +pub type PACTCTX_SECTION_KEYED_DATA = *mut ACTCTX_SECTION_KEYED_DATA; +pub type PCACTCTX_SECTION_KEYED_DATA = *const ACTCTX_SECTION_KEYED_DATA; +ENUM!{enum STREAM_INFO_LEVELS { + FindStreamInfoStandard, + FindStreamInfoMaxInfoLevel, +}} +ENUM!{enum PROCESS_INFORMATION_CLASS { + ProcessMemoryPriority, + ProcessInformationClassMax, +}} +ENUM!{enum DEP_SYSTEM_POLICY_TYPE { + DEPPolicyAlwaysOff = 0, + DEPPolicyAlwaysOn, + DEPPolicyOptIn, + DEPPolicyOptOut, + DEPTotalPolicyCount, +}} +ENUM!{enum PIPE_ATTRIBUTE_TYPE { + PipeAttribute, + PipeConnectionAttribute, + PipeHandleAttribute, +}} +pub type APPLICATION_RECOVERY_CALLBACK = Option ::DWORD>; +STRUCT!{struct SYSTEM_POWER_STATUS { + ACLineStatus: ::BYTE, + BatteryFlag: ::BYTE, + BatteryLifePercent: ::BYTE, + Reserved1: ::BYTE, + BatteryLifeTime: ::DWORD, + BatteryFullLifeTime: ::DWORD, +}} +pub type LPSYSTEM_POWER_STATUS = *mut SYSTEM_POWER_STATUS; +pub const OFS_MAXPATHNAME: usize = 128; +STRUCT!{nodebug struct OFSTRUCT { + cBytes: ::BYTE, + fFixedDisk: ::BYTE, + nErrCode: ::WORD, + Reserved1: ::WORD, + Reserved2: ::WORD, + szPathName: [::CHAR; OFS_MAXPATHNAME], +}} +pub type POFSTRUCT = *mut OFSTRUCT; +pub type LPOFSTRUCT = *mut OFSTRUCT; +ENUM!{enum FILE_ID_TYPE { + FileIdType, + ObjectIdType, + ExtendedFileIdType, + MaximumFileIdType, +}} +STRUCT!{struct FILE_ID_DESCRIPTOR { + dwSize: ::DWORD, + Type: FILE_ID_TYPE, + ObjectId: ::GUID, +}} +UNION!(FILE_ID_DESCRIPTOR, ObjectId, FileId, FileId_mut, ::LARGE_INTEGER); +UNION!(FILE_ID_DESCRIPTOR, ObjectId, ExtendedFileId, ExtendedFileId_mut, ::FILE_ID_128); +pub type LPFILE_ID_DESCRIPTOR = *mut FILE_ID_DESCRIPTOR; diff --git a/third_party/rust/winapi/src/wincon.rs b/third_party/rust/winapi/src/wincon.rs new file mode 100644 index 000000000000..23c2e74244ce --- /dev/null +++ b/third_party/rust/winapi/src/wincon.rs @@ -0,0 +1,198 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This module contains the public data structures, data types, and procedures exported by the NT +//! console subsystem. +STRUCT!{struct COORD { + X: ::SHORT, + Y: ::SHORT, +}} +pub type PCOORD = *mut COORD; +STRUCT!{struct SMALL_RECT { + Left: ::SHORT, + Top: ::SHORT, + Right: ::SHORT, + Bottom: ::SHORT, +}} +pub type PSMALL_RECT = *mut SMALL_RECT; +STRUCT!{struct KEY_EVENT_RECORD { + bKeyDown: ::BOOL, + wRepeatCount: ::WORD, + wVirtualKeyCode: ::WORD, + wVirtualScanCode: ::WORD, + UnicodeChar: ::WCHAR, + dwControlKeyState: ::DWORD, +}} +UNION!{KEY_EVENT_RECORD, UnicodeChar, AsciiChar, AsciiChar_mut, ::CHAR} +pub type PKEY_EVENT_RECORD = *mut KEY_EVENT_RECORD; +pub const RIGHT_ALT_PRESSED: ::DWORD = 0x0001; +pub const LEFT_ALT_PRESSED: ::DWORD = 0x0002; +pub const RIGHT_CTRL_PRESSED: ::DWORD = 0x0004; +pub const LEFT_CTRL_PRESSED: ::DWORD = 0x0008; +pub const SHIFT_PRESSED: ::DWORD = 0x0010; +pub const NUMLOCK_ON: ::DWORD = 0x0020; +pub const SCROLLLOCK_ON: ::DWORD = 0x0040; +pub const CAPSLOCK_ON: ::DWORD = 0x0080; +pub const ENHANCED_KEY: ::DWORD = 0x0100; +pub const NLS_DBCSCHAR: ::DWORD = 0x00010000; +pub const NLS_ALPHANUMERIC: ::DWORD = 0x00000000; +pub const NLS_KATAKANA: ::DWORD = 0x00020000; +pub const NLS_HIRAGANA: ::DWORD = 0x00040000; +pub const NLS_ROMAN: ::DWORD = 0x00400000; +pub const NLS_IME_CONVERSION: ::DWORD = 0x00800000; +pub const NLS_IME_DISABLE: ::DWORD = 0x20000000; +STRUCT!{struct MOUSE_EVENT_RECORD { + dwMousePosition: COORD, + dwButtonState: ::DWORD, + dwControlKeyState: ::DWORD, + dwEventFlags: ::DWORD, +}} +pub type PMOUSE_EVENT_RECORD = *mut MOUSE_EVENT_RECORD; +pub const FROM_LEFT_1ST_BUTTON_PRESSED: ::DWORD = 0x0001; +pub const RIGHTMOST_BUTTON_PRESSED: ::DWORD = 0x0002; +pub const FROM_LEFT_2ND_BUTTON_PRESSED: ::DWORD = 0x0004; +pub const FROM_LEFT_3RD_BUTTON_PRESSED: ::DWORD = 0x0008; +pub const FROM_LEFT_4TH_BUTTON_PRESSED: ::DWORD = 0x0010; +pub const MOUSE_MOVED: ::DWORD = 0x0001; +pub const DOUBLE_CLICK: ::DWORD = 0x0002; +pub const MOUSE_WHEELED: ::DWORD = 0x0004; +pub const MOUSE_HWHEELED: ::DWORD = 0x0008; +STRUCT!{struct WINDOW_BUFFER_SIZE_RECORD { + dwSize: COORD, +}} +pub type PWINDOW_BUFFER_SIZE_RECORD = *mut WINDOW_BUFFER_SIZE_RECORD; +STRUCT!{struct MENU_EVENT_RECORD { + dwCommandId: ::UINT, +}} +pub type PMENU_EVENT_RECORD = *mut MENU_EVENT_RECORD; +STRUCT!{struct FOCUS_EVENT_RECORD { + bSetFocus: ::BOOL, +}} +pub type PFOCUS_EVENT_RECORD = *mut FOCUS_EVENT_RECORD; +STRUCT!{struct INPUT_RECORD { + EventType: ::WORD, + Event: [u32; 4], +}} +UNION!{INPUT_RECORD, Event, KeyEvent, KeyEvent_mut, KEY_EVENT_RECORD} +UNION!{INPUT_RECORD, Event, MouseEvent, MouseEvent_mut, MOUSE_EVENT_RECORD} +UNION!{INPUT_RECORD, Event, WindowBufferSizeEvent, WindowBufferSizeEvent_mut, + WINDOW_BUFFER_SIZE_RECORD} +UNION!{INPUT_RECORD, Event, MenuEvent, MenuEvent_mut, MENU_EVENT_RECORD} +UNION!{INPUT_RECORD, Event, FocusEvent, FocusEvent_mut, FOCUS_EVENT_RECORD} +pub type PINPUT_RECORD = *mut INPUT_RECORD; +pub const KEY_EVENT: ::WORD = 0x0001; +pub const MOUSE_EVENT: ::WORD = 0x0002; +pub const WINDOW_BUFFER_SIZE_EVENT: ::WORD = 0x0004; +pub const MENU_EVENT: ::WORD = 0x0008; +pub const FOCUS_EVENT: ::WORD = 0x0010; +STRUCT!{struct CHAR_INFO { + UnicodeChar: ::WCHAR, + Attributes: ::WORD, +}} +UNION!{CHAR_INFO, UnicodeChar, AsciiChar, AsciiChar_mut, ::CHAR} +pub type PCHAR_INFO = *mut CHAR_INFO; +pub const FOREGROUND_BLUE: ::DWORD = 0x0001; +pub const FOREGROUND_GREEN: ::DWORD = 0x0002; +pub const FOREGROUND_RED: ::DWORD = 0x0004; +pub const FOREGROUND_INTENSITY: ::DWORD = 0x0008; +pub const BACKGROUND_BLUE: ::DWORD = 0x0010; +pub const BACKGROUND_GREEN: ::DWORD = 0x0020; +pub const BACKGROUND_RED: ::DWORD = 0x0040; +pub const BACKGROUND_INTENSITY: ::DWORD = 0x0080; +pub const COMMON_LVB_LEADING_BYTE: ::DWORD = 0x0100; +pub const COMMON_LVB_TRAILING_BYTE: ::DWORD = 0x0200; +pub const COMMON_LVB_GRID_HORIZONTAL: ::DWORD = 0x0400; +pub const COMMON_LVB_GRID_LVERTICAL: ::DWORD = 0x0800; +pub const COMMON_LVB_GRID_RVERTICAL: ::DWORD = 0x1000; +pub const COMMON_LVB_REVERSE_VIDEO: ::DWORD = 0x4000; +pub const COMMON_LVB_UNDERSCORE: ::DWORD = 0x8000; +pub const COMMON_LVB_SBCSDBCS: ::DWORD = 0x0300; +STRUCT!{struct CONSOLE_SCREEN_BUFFER_INFO { + dwSize: COORD, + dwCursorPosition: COORD, + wAttributes: ::WORD, + srWindow: SMALL_RECT, + dwMaximumWindowSize: COORD, +}} +pub type PCONSOLE_SCREEN_BUFFER_INFO = *mut CONSOLE_SCREEN_BUFFER_INFO; +STRUCT!{struct CONSOLE_SCREEN_BUFFER_INFOEX { + cbSize: ::ULONG, + dwSize: COORD, + dwCursorPosition: COORD, + wAttributes: ::WORD, + srWindow: SMALL_RECT, + dwMaximumWindowSize: COORD, + wPopupAttributes: ::WORD, + bFullscreenSupported: ::BOOL, + ColorTable: [::COLORREF; 16], +}} +pub type PCONSOLE_SCREEN_BUFFER_INFOEX = *mut CONSOLE_SCREEN_BUFFER_INFOEX; +STRUCT!{struct CONSOLE_CURSOR_INFO { + dwSize: ::DWORD, + bVisible: ::BOOL, +}} +pub type PCONSOLE_CURSOR_INFO = *mut CONSOLE_CURSOR_INFO; +STRUCT!{struct CONSOLE_FONT_INFO { + nFont: ::DWORD, + dwFontSize: ::COORD, +}} +pub type PCONSOLE_FONT_INFO = *mut CONSOLE_FONT_INFO; +STRUCT!{struct CONSOLE_FONT_INFOEX { + cbSize: ::ULONG, + nFont: ::DWORD, + dwFontSize: COORD, + FontFamily: ::UINT, + FontWeight: ::UINT, + FaceName: [::WCHAR; ::LF_FACESIZE], +}} +pub type PCONSOLE_FONT_INFOEX = *mut CONSOLE_FONT_INFOEX; +pub const HISTORY_NO_DUP_FLAG: ::DWORD = 0x1; +STRUCT!{struct CONSOLE_HISTORY_INFO { + cbSize: ::UINT, + HistoryBufferSize: ::UINT, + NumberOfHistoryBuffers: ::UINT, + dwFlags: ::DWORD, +}} +pub type PCONSOLE_HISTORY_INFO = *mut CONSOLE_HISTORY_INFO; +STRUCT!{struct CONSOLE_SELECTION_INFO { + dwFlags: ::DWORD, + dwSelectionAnchor: COORD, + srSelection: SMALL_RECT, +}} +pub type PCONSOLE_SELECTION_INFO = *mut CONSOLE_SELECTION_INFO; +pub const CONSOLE_NO_SELECTION: ::DWORD = 0x0000; +pub const CONSOLE_SELECTION_IN_PROGRESS: ::DWORD = 0x0001; +pub const CONSOLE_SELECTION_NOT_EMPTY: ::DWORD = 0x0002; +pub const CONSOLE_MOUSE_SELECTION: ::DWORD = 0x0004; +pub const CONSOLE_MOUSE_DOWN: ::DWORD = 0x0008; +pub type PHANDLER_ROUTINE = Option ::BOOL>; +pub const CTRL_C_EVENT: ::DWORD = 0; +pub const CTRL_BREAK_EVENT: ::DWORD = 1; +pub const CTRL_CLOSE_EVENT: ::DWORD = 2; +pub const CTRL_LOGOFF_EVENT: ::DWORD = 5; +pub const CTRL_SHUTDOWN_EVENT: ::DWORD = 6; +pub const ENABLE_PROCESSED_INPUT: ::DWORD = 0x0001; +pub const ENABLE_LINE_INPUT: ::DWORD = 0x0002; +pub const ENABLE_ECHO_INPUT: ::DWORD = 0x0004; +pub const ENABLE_WINDOW_INPUT: ::DWORD = 0x0008; +pub const ENABLE_MOUSE_INPUT: ::DWORD = 0x0010; +pub const ENABLE_INSERT_MODE: ::DWORD = 0x0020; +pub const ENABLE_QUICK_EDIT_MODE: ::DWORD = 0x0040; +pub const ENABLE_EXTENDED_FLAGS: ::DWORD = 0x0080; +pub const ENABLE_AUTO_POSITION: ::DWORD = 0x0100; +pub const ENABLE_PROCESSED_OUTPUT: ::DWORD = 0x0001; +pub const ENABLE_WRAP_AT_EOL_OUTPUT: ::DWORD = 0x0002; +pub const CONSOLE_REAL_OUTPUT_HANDLE: *mut ::c_void = -2isize as *mut ::c_void; +pub const CONSOLE_REAL_INPUT_HANDLE: *mut ::c_void = -3isize as *mut ::c_void; +pub const ATTACH_PARENT_PROCESS: ::DWORD = 0xFFFFFFFF; +STRUCT!{struct CONSOLE_READCONSOLE_CONTROL { + nLength: ::ULONG, + nInitialChars: ::ULONG, + dwCtrlWakeupMask: ::ULONG, + dwControlKeyState: ::ULONG, +}} +pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL; +pub const CONSOLE_TEXTMODE_BUFFER: ::DWORD = 1; +pub const CONSOLE_FULLSCREEN: ::DWORD = 1; +pub const CONSOLE_FULLSCREEN_HARDWARE: ::DWORD = 2; +pub const CONSOLE_FULLSCREEN_MODE: ::DWORD = 1; +pub const CONSOLE_WINDOWED_MODE: ::DWORD = 2; diff --git a/third_party/rust/winapi/src/wincred.rs b/third_party/rust/winapi/src/wincred.rs new file mode 100644 index 000000000000..af98bd928d93 --- /dev/null +++ b/third_party/rust/winapi/src/wincred.rs @@ -0,0 +1,209 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Authentication API Prototypes and Definitions +pub const NERR_BASE: ::DWORD = 2100; +pub const NERR_PasswordExpired: ::DWORD = NERR_BASE+142; +pub const CRED_MAX_STRING_LENGTH: ::DWORD = 256; +pub const CRED_MAX_USERNAME_LENGTH: ::DWORD = 256+1+256; +pub const CRED_MAX_GENERIC_TARGET_NAME_LENGTH: ::DWORD = 32767; +pub const CRED_MAX_DOMAIN_TARGET_NAME_LENGTH: ::DWORD = 256+1+80; +pub const CRED_MAX_TARGETNAME_NAMESPACE_LENGTH: ::DWORD = 256; +pub const CRED_MAX_TARGETNAME_ATTRIBUTE_LENGTH: ::DWORD = 256; +pub const CRED_MAX_VALUE_SIZE: ::DWORD = 256; +pub const CRED_MAX_ATTRIBUTES: ::DWORD = 64; +pub const CRED_LOGON_TYPES_MASK: ::DWORD = 0xF000; +pub const CRED_FLAGS_PASSWORD_FOR_CERT: ::DWORD = 0x0001; +pub const CRED_FLAGS_PROMPT_NOW: ::DWORD = 0x0002; +pub const CRED_FLAGS_USERNAME_TARGET: ::DWORD = 0x0004; +pub const CRED_FLAGS_OWF_CRED_BLOB: ::DWORD = 0x0008; +pub const CRED_FLAGS_REQUIRE_CONFIRMATION: ::DWORD = 0x0010; +pub const CRED_FLAGS_WILDCARD_MATCH: ::DWORD = 0x0020; +pub const CRED_FLAGS_VALID_FLAGS: ::DWORD = 0xF03F; +pub const CRED_FLAGS_VALID_INPUT_FLAGS: ::DWORD = 0xF01F; +pub const CRED_TYPE_GENERIC: ::DWORD = 1; +pub const CRED_TYPE_DOMAIN_PASSWORD: ::DWORD = 2; +pub const CRED_TYPE_DOMAIN_CERTIFICATE: ::DWORD = 3; +pub const CRED_TYPE_DOMAIN_VISIBLE_PASSWORD: ::DWORD = 4; +pub const CRED_TYPE_GENERIC_CERTIFICATE: ::DWORD = 5; +pub const CRED_TYPE_DOMAIN_EXTENDED: ::DWORD = 6; +pub const CRED_TYPE_MAXIMUM: ::DWORD = 7; +pub const CRED_TYPE_MAXIMUM_EX: ::DWORD = CRED_TYPE_MAXIMUM+1000; +pub const CRED_MAX_CREDENTIAL_BLOB_SIZE: ::DWORD = 5*512; +pub const CRED_PERSIST_NONE: ::DWORD = 0; +pub const CRED_PERSIST_SESSION: ::DWORD = 1; +pub const CRED_PERSIST_LOCAL_MACHINE: ::DWORD = 2; +pub const CRED_PERSIST_ENTERPRISE: ::DWORD = 3; +STRUCT!{struct CREDENTIAL_ATTRIBUTEA { + Keyword: ::LPSTR, + Flags: ::DWORD, + ValueSize: ::DWORD, + Value: ::LPBYTE, +}} +pub type PCREDENTIAL_ATTRIBUTEA = *mut CREDENTIAL_ATTRIBUTEA; +STRUCT!{struct CREDENTIAL_ATTRIBUTEW { + Keyword: ::LPWSTR, + Flags: ::DWORD, + ValueSize: ::DWORD, + Value: ::LPBYTE, +}} +pub type PCREDENTIAL_ATTRIBUTEW = *mut CREDENTIAL_ATTRIBUTEW; +STRUCT!{struct CREDENTIALA { + Flags: ::DWORD, + Type: ::DWORD, + TargetName: ::LPSTR, + Comment: ::LPSTR, + LastWritten: ::FILETIME, + CredentialBlobSize: ::DWORD, + CredentialBlob: ::LPBYTE, + Persist: ::DWORD, + AttributeCount: ::DWORD, + Attributes: PCREDENTIAL_ATTRIBUTEA, + TargetAlias: ::LPSTR, + UserName: ::LPSTR, +}} +pub type PCREDENTIALA = *mut CREDENTIALA; +STRUCT!{struct CREDENTIALW { + Flags: ::DWORD, + Type: ::DWORD, + TargetName: ::LPWSTR, + Comment: ::LPWSTR, + LastWritten: ::FILETIME, + CredentialBlobSize: ::DWORD, + CredentialBlob: ::LPBYTE, + Persist: ::DWORD, + AttributeCount: ::DWORD, + Attributes: PCREDENTIAL_ATTRIBUTEW, + TargetAlias: ::LPWSTR, + UserName: ::LPWSTR, +}} +pub type PCREDENTIALW = *mut CREDENTIALW; +pub const CRED_TI_SERVER_FORMAT_UNKNOWN: ::ULONG = 0x0001; +pub const CRED_TI_DOMAIN_FORMAT_UNKNOWN: ::ULONG = 0x0002; +pub const CRED_TI_ONLY_PASSWORD_REQUIRED: ::ULONG = 0x0004; +pub const CRED_TI_USERNAME_TARGET: ::ULONG = 0x0008; +pub const CRED_TI_CREATE_EXPLICIT_CRED: ::ULONG = 0x0010; +pub const CRED_TI_WORKGROUP_MEMBER: ::ULONG = 0x0020; +pub const CRED_TI_VALID_FLAGS: ::ULONG = 0xF07F; +STRUCT!{struct CREDENTIAL_TARGET_INFORMATIONA { + TargetName: ::LPSTR, + NetbiosServerName: ::LPSTR, + DnsServerName: ::LPSTR, + NetbiosDomainName: ::LPSTR, + DnsDomainName: ::LPSTR, + DnsTreeName: ::LPSTR, + PackageName: ::LPSTR, + Flags: ::ULONG, + CredTypeCount: ::DWORD, + CredTypes: ::LPDWORD, +}} +pub type PCREDENTIAL_TARGET_INFORMATIONA = *mut CREDENTIAL_TARGET_INFORMATIONA; +STRUCT!{struct CREDENTIAL_TARGET_INFORMATIONW { + TargetName: ::LPWSTR, + NetbiosServerName: ::LPWSTR, + DnsServerName: ::LPWSTR, + NetbiosDomainName: ::LPWSTR, + DnsDomainName: ::LPWSTR, + DnsTreeName: ::LPWSTR, + PackageName: ::LPWSTR, + Flags: ::ULONG, + CredTypeCount: ::DWORD, + CredTypes: ::LPDWORD, +}} +pub type PCREDENTIAL_TARGET_INFORMATIONW = *mut CREDENTIAL_TARGET_INFORMATIONW; +pub const CERT_HASH_LENGTH: usize = 20; +STRUCT!{struct CERT_CREDENTIAL_INFO { + cbSize: ::ULONG, + rgbHashOfCert: [::UCHAR; CERT_HASH_LENGTH], +}} +pub type PCERT_CREDENTIAL_INFO = *mut CERT_CREDENTIAL_INFO; +STRUCT!{struct USERNAME_TARGET_CREDENTIAL_INFO { + UserName: ::LPWSTR, +}} +pub type PUSERNAME_TARGET_CREDENTIAL_INFO = *mut USERNAME_TARGET_CREDENTIAL_INFO; +STRUCT!{struct BINARY_BLOB_CREDENTIAL_INFO { + cbBlob: ::ULONG, + pbBlob: ::LPBYTE, +}} +pub type PBINARY_BLOB_CREDENTIAL_INFO = *mut BINARY_BLOB_CREDENTIAL_INFO; +ENUM!{enum CRED_MARSHAL_TYPE { + CertCredential = 1, + UsernameTargetCredential, + BinaryBlobCredential, + UsernameForPackedCredentials, +}} +pub type PCRED_MARSHAL_TYPE = *mut CRED_MARSHAL_TYPE; +ENUM!{enum CRED_PROTECTION_TYPE { + CredUnprotected, + CredUserProtection, + CredTrustedProtection, +}} +pub type PCRED_PROTECTION_TYPE = *mut CRED_PROTECTION_TYPE; +pub const CRED_PACK_PROTECTED_CREDENTIALS: ::DWORD = 0x1; +pub const CRED_PACK_WOW_BUFFER: ::DWORD = 0x2; +pub const CRED_PACK_GENERIC_CREDENTIALS: ::DWORD = 0x4; +pub const CRED_PACK_ID_PROVIDER_CREDENTIALS: ::DWORD = 0x8; +STRUCT!{struct CREDUI_INFOA { + cbSize: ::DWORD, + hwndParent: ::HWND, + pszMessageText: ::PCSTR, + pszCaptionText: ::PCSTR, + hbmBanner: ::HBITMAP, +}} +pub type PCREDUI_INFOA = *mut CREDUI_INFOA; +STRUCT!{struct CREDUI_INFOW { + cbSize: ::DWORD, + hwndParent: ::HWND, + pszMessageText: ::PCWSTR, + pszCaptionText: ::PCWSTR, + hbmBanner: ::HBITMAP, +}} +pub type PCREDUI_INFOW = *mut CREDUI_INFOW; +pub const CREDUI_MAX_MESSAGE_LENGTH: ::DWORD = 1024; +pub const CREDUI_MAX_CAPTION_LENGTH: ::DWORD = 128; +pub const CREDUI_MAX_GENERIC_TARGET_LENGTH: ::DWORD = CRED_MAX_GENERIC_TARGET_NAME_LENGTH; +pub const CREDUI_MAX_DOMAIN_TARGET_LENGTH: ::DWORD = CRED_MAX_DOMAIN_TARGET_NAME_LENGTH; +pub const CREDUI_MAX_USERNAME_LENGTH: ::DWORD = CRED_MAX_USERNAME_LENGTH; +pub const CREDUI_MAX_PASSWORD_LENGTH: ::DWORD = 512 / 2; +pub const CREDUI_FLAGS_INCORRECT_PASSWORD: ::DWORD = 0x00001; +pub const CREDUI_FLAGS_DO_NOT_PERSIST: ::DWORD = 0x00002; +pub const CREDUI_FLAGS_REQUEST_ADMINISTRATOR: ::DWORD = 0x00004; +pub const CREDUI_FLAGS_EXCLUDE_CERTIFICATES: ::DWORD = 0x00008; +pub const CREDUI_FLAGS_REQUIRE_CERTIFICATE: ::DWORD = 0x00010; +pub const CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX: ::DWORD = 0x00040; +pub const CREDUI_FLAGS_ALWAYS_SHOW_UI: ::DWORD = 0x00080; +pub const CREDUI_FLAGS_REQUIRE_SMARTCARD: ::DWORD = 0x00100; +pub const CREDUI_FLAGS_PASSWORD_ONLY_OK: ::DWORD = 0x00200; +pub const CREDUI_FLAGS_VALIDATE_USERNAME: ::DWORD = 0x00400; +pub const CREDUI_FLAGS_COMPLETE_USERNAME: ::DWORD = 0x00800; +pub const CREDUI_FLAGS_PERSIST: ::DWORD = 0x01000; +pub const CREDUI_FLAGS_SERVER_CREDENTIAL: ::DWORD = 0x04000; +pub const CREDUI_FLAGS_EXPECT_CONFIRMATION: ::DWORD = 0x20000; +pub const CREDUI_FLAGS_GENERIC_CREDENTIALS: ::DWORD = 0x40000; +pub const CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS: ::DWORD = 0x80000; +pub const CREDUI_FLAGS_KEEP_USERNAME: ::DWORD = 0x100000; +pub const CREDUI_FLAGS_PROMPT_VALID: ::DWORD = CREDUI_FLAGS_INCORRECT_PASSWORD + | CREDUI_FLAGS_DO_NOT_PERSIST | CREDUI_FLAGS_REQUEST_ADMINISTRATOR + | CREDUI_FLAGS_EXCLUDE_CERTIFICATES | CREDUI_FLAGS_REQUIRE_CERTIFICATE + | CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX | CREDUI_FLAGS_ALWAYS_SHOW_UI + | CREDUI_FLAGS_REQUIRE_SMARTCARD | CREDUI_FLAGS_PASSWORD_ONLY_OK + | CREDUI_FLAGS_VALIDATE_USERNAME | CREDUI_FLAGS_COMPLETE_USERNAME | CREDUI_FLAGS_PERSIST + | CREDUI_FLAGS_SERVER_CREDENTIAL | CREDUI_FLAGS_EXPECT_CONFIRMATION + | CREDUI_FLAGS_GENERIC_CREDENTIALS | CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS + | CREDUI_FLAGS_KEEP_USERNAME; +pub const CREDUIWIN_GENERIC: ::DWORD = 0x00000001; +pub const CREDUIWIN_CHECKBOX: ::DWORD = 0x00000002; +pub const CREDUIWIN_AUTHPACKAGE_ONLY: ::DWORD = 0x00000010; +pub const CREDUIWIN_IN_CRED_ONLY: ::DWORD = 0x00000020; +pub const CREDUIWIN_ENUMERATE_ADMINS: ::DWORD = 0x00000100; +pub const CREDUIWIN_ENUMERATE_CURRENT_USER: ::DWORD = 0x00000200; +pub const CREDUIWIN_SECURE_PROMPT: ::DWORD = 0x00001000; +pub const CREDUIWIN_PREPROMPTING: ::DWORD = 0x00002000; +pub const CREDUIWIN_PACK_32_WOW: ::DWORD = 0x10000000; +pub const CREDUIWIN_VALID_FLAGS: ::DWORD = CREDUIWIN_GENERIC | CREDUIWIN_CHECKBOX + | CREDUIWIN_AUTHPACKAGE_ONLY | CREDUIWIN_IN_CRED_ONLY | CREDUIWIN_ENUMERATE_ADMINS + | CREDUIWIN_ENUMERATE_CURRENT_USER | CREDUIWIN_SECURE_PROMPT | CREDUIWIN_PREPROMPTING + | CREDUIWIN_PACK_32_WOW; +pub const CRED_PRESERVE_CREDENTIAL_BLOB: ::DWORD = 0x1; +pub const CRED_ENUMERATE_ALL_CREDENTIALS: ::DWORD = 0x1; +pub const CRED_CACHE_TARGET_INFORMATION: ::DWORD = 0x1; +pub const CRED_ALLOW_NAME_RESOLUTION: ::DWORD = 0x1; diff --git a/third_party/rust/winapi/src/wincrypt.rs b/third_party/rust/winapi/src/wincrypt.rs new file mode 100644 index 000000000000..5b3e748cc9be --- /dev/null +++ b/third_party/rust/winapi/src/wincrypt.rs @@ -0,0 +1,2206 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Cryptographic API Prototypes and Definitions +//108 +pub const ALG_CLASS_ANY: ALG_ID = 0; +pub const ALG_CLASS_SIGNATURE: ALG_ID = 1 << 13; +pub const ALG_CLASS_MSG_ENCRYPT: ALG_ID = 2 << 13; +pub const ALG_CLASS_DATA_ENCRYPT: ALG_ID = 3 << 13; +pub const ALG_CLASS_HASH: ALG_ID = 4 << 13; +pub const ALG_CLASS_KEY_EXCHANGE: ALG_ID = 5 << 13; +pub const ALG_CLASS_ALL: ALG_ID = 7 << 13; +pub const ALG_TYPE_ANY: ALG_ID = 0; +pub const ALG_TYPE_DSS: ALG_ID = 1 << 9; +pub const ALG_TYPE_RSA: ALG_ID = 2 << 9; +pub const ALG_TYPE_BLOCK: ALG_ID = 3 << 9; +pub const ALG_TYPE_STREAM: ALG_ID = 4 << 9; +pub const ALG_TYPE_DH: ALG_ID = 5 << 9; +pub const ALG_TYPE_SECURECHANNEL: ALG_ID = 6 << 9; +pub const ALG_SID_ANY: ALG_ID = 0; +pub const ALG_SID_RSA_ANY: ALG_ID = 0; +pub const ALG_SID_RSA_PKCS: ALG_ID = 1; +pub const ALG_SID_RSA_MSATWORK: ALG_ID = 2; +pub const ALG_SID_RSA_ENTRUST: ALG_ID = 3; +pub const ALG_SID_RSA_PGP: ALG_ID = 4; +pub const ALG_SID_DSS_ANY: ALG_ID = 0; +pub const ALG_SID_DSS_PKCS: ALG_ID = 1; +pub const ALG_SID_DSS_DMS: ALG_ID = 2; +pub const ALG_SID_ECDSA: ALG_ID = 3; +pub const ALG_SID_DES: ALG_ID = 1; +pub const ALG_SID_3DES: ALG_ID = 3; +pub const ALG_SID_DESX: ALG_ID = 4; +pub const ALG_SID_IDEA: ALG_ID = 5; +pub const ALG_SID_CAST: ALG_ID = 6; +pub const ALG_SID_SAFERSK64: ALG_ID = 7; +pub const ALG_SID_SAFERSK128: ALG_ID = 8; +pub const ALG_SID_3DES_112: ALG_ID = 9; +pub const ALG_SID_CYLINK_MEK: ALG_ID = 12; +pub const ALG_SID_RC5: ALG_ID = 13; +pub const ALG_SID_AES_128: ALG_ID = 14; +pub const ALG_SID_AES_192: ALG_ID = 15; +pub const ALG_SID_AES_256: ALG_ID = 16; +pub const ALG_SID_AES: ALG_ID = 17; +pub const ALG_SID_SKIPJACK: ALG_ID = 10; +pub const ALG_SID_TEK: ALG_ID = 11; +pub const CRYPT_MODE_CBCI: ALG_ID = 6; +pub const CRYPT_MODE_CFBP: ALG_ID = 7; +pub const CRYPT_MODE_OFBP: ALG_ID = 8; +pub const CRYPT_MODE_CBCOFM: ALG_ID = 9; +pub const CRYPT_MODE_CBCOFMI: ALG_ID = 10; +pub const ALG_SID_RC2: ALG_ID = 2; +pub const ALG_SID_RC4: ALG_ID = 1; +pub const ALG_SID_SEAL: ALG_ID = 2; +pub const ALG_SID_DH_SANDF: ALG_ID = 1; +pub const ALG_SID_DH_EPHEM: ALG_ID = 2; +pub const ALG_SID_AGREED_KEY_ANY: ALG_ID = 3; +pub const ALG_SID_KEA: ALG_ID = 4; +pub const ALG_SID_ECDH: ALG_ID = 5; +pub const ALG_SID_MD2: ALG_ID = 1; +pub const ALG_SID_MD4: ALG_ID = 2; +pub const ALG_SID_MD5: ALG_ID = 3; +pub const ALG_SID_SHA: ALG_ID = 4; +pub const ALG_SID_SHA1: ALG_ID = 4; +pub const ALG_SID_MAC: ALG_ID = 5; +pub const ALG_SID_RIPEMD: ALG_ID = 6; +pub const ALG_SID_RIPEMD160: ALG_ID = 7; +pub const ALG_SID_SSL3SHAMD5: ALG_ID = 8; +pub const ALG_SID_HMAC: ALG_ID = 9; +pub const ALG_SID_TLS1PRF: ALG_ID = 10; +pub const ALG_SID_HASH_REPLACE_OWF: ALG_ID = 11; +pub const ALG_SID_SHA_256: ALG_ID = 12; +pub const ALG_SID_SHA_384: ALG_ID = 13; +pub const ALG_SID_SHA_512: ALG_ID = 14; +pub const ALG_SID_SSL3_MASTER: ALG_ID = 1; +pub const ALG_SID_SCHANNEL_MASTER_HASH: ALG_ID = 2; +pub const ALG_SID_SCHANNEL_MAC_KEY: ALG_ID = 3; +pub const ALG_SID_PCT1_MASTER: ALG_ID = 4; +pub const ALG_SID_SSL2_MASTER: ALG_ID = 5; +pub const ALG_SID_TLS1_MASTER: ALG_ID = 6; +pub const ALG_SID_SCHANNEL_ENC_KEY: ALG_ID = 7; +pub const ALG_SID_ECMQV: ALG_ID = 1; +pub const ALG_SID_EXAMPLE: ALG_ID = 80; +pub type ALG_ID = ::c_uint; +pub const CALG_MD2: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2; +pub const CALG_MD4: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4; +pub const CALG_MD5: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5; +pub const CALG_SHA: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA; +pub const CALG_SHA1: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA1; +pub const CALG_MAC: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC; +pub const CALG_RSA_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY; +pub const CALG_DSS_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY; +pub const CALG_NO_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_ANY | ALG_SID_ANY; +pub const CALG_RSA_KEYX: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY; +pub const CALG_DES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES; +pub const CALG_3DES_112: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112; +pub const CALG_3DES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES; +pub const CALG_DESX: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DESX; +pub const CALG_RC2: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2; +pub const CALG_RC4: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4; +pub const CALG_SEAL: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL; +pub const CALG_DH_SF: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF; +pub const CALG_DH_EPHEM: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM; +pub const CALG_AGREEDKEY_ANY: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH + | ALG_SID_AGREED_KEY_ANY; +pub const CALG_KEA_KEYX: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_KEA; +pub const CALG_HUGHES_MD5: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_MD5; +pub const CALG_SKIPJACK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_SKIPJACK; +pub const CALG_TEK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_TEK; +pub const CALG_CYLINK_MEK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_CYLINK_MEK; +pub const CALG_SSL3_SHAMD5: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5; +pub const CALG_SSL3_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SSL3_MASTER; +pub const CALG_SCHANNEL_MASTER_HASH: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SCHANNEL_MASTER_HASH; +pub const CALG_SCHANNEL_MAC_KEY: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SCHANNEL_MAC_KEY; +pub const CALG_SCHANNEL_ENC_KEY: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SCHANNEL_ENC_KEY; +pub const CALG_PCT1_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_PCT1_MASTER; +pub const CALG_SSL2_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SSL2_MASTER; +pub const CALG_TLS1_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_TLS1_MASTER; +pub const CALG_RC5: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC5; +pub const CALG_HMAC: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC; +pub const CALG_TLS1PRF: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF; +pub const CALG_HASH_REPLACE_OWF: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HASH_REPLACE_OWF; +pub const CALG_AES_128: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_128; +pub const CALG_AES_192: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_192; +pub const CALG_AES_256: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_256; +pub const CALG_AES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES; +pub const CALG_SHA_256: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256; +pub const CALG_SHA_384: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384; +pub const CALG_SHA_512: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512; +pub const CALG_ECDH: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_ECDH; +pub const CALG_ECMQV: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_ECMQV; +pub const CALG_ECDSA: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_ECDSA; +pub type HCRYPTPROV = ::ULONG_PTR; +pub type HCRYPTKEY = ::ULONG_PTR; +pub type HCRYPTHASH = ::ULONG_PTR; +pub const CRYPT_VERIFYCONTEXT: ::DWORD = 0xF0000000; +pub const CRYPT_NEWKEYSET: ::DWORD = 0x00000008; +pub const CRYPT_DELETEKEYSET: ::DWORD = 0x00000010; +pub const CRYPT_MACHINE_KEYSET: ::DWORD = 0x00000020; +pub const CRYPT_SILENT: ::DWORD = 0x00000040; +pub const CRYPT_DEFAULT_CONTAINER_OPTIONAL: ::DWORD = 0x00000080; +pub const CRYPT_EXPORTABLE: ::DWORD = 0x00000001; +pub const CRYPT_USER_PROTECTED: ::DWORD = 0x00000002; +pub const CRYPT_CREATE_SALT: ::DWORD = 0x00000004; +pub const CRYPT_UPDATE_KEY: ::DWORD = 0x00000008; +pub const CRYPT_NO_SALT: ::DWORD = 0x00000010; +pub const CRYPT_PREGEN: ::DWORD = 0x00000040; +pub const CRYPT_RECIPIENT: ::DWORD = 0x00000010; +pub const CRYPT_INITIATOR: ::DWORD = 0x00000040; +pub const CRYPT_ONLINE: ::DWORD = 0x00000080; +pub const CRYPT_SF: ::DWORD = 0x00000100; +pub const CRYPT_CREATE_IV: ::DWORD = 0x00000200; +pub const CRYPT_KEK: ::DWORD = 0x00000400; +pub const CRYPT_DATA_KEY: ::DWORD = 0x00000800; +pub const CRYPT_VOLATILE: ::DWORD = 0x00001000; +pub const CRYPT_SGCKEY: ::DWORD = 0x00002000; +pub const CRYPT_USER_PROTECTED_STRONG: ::DWORD = 0x00100000; +pub const CRYPT_ARCHIVABLE: ::DWORD = 0x00004000; +pub const CRYPT_FORCE_KEY_PROTECTION_HIGH: ::DWORD = 0x00008000; +pub const RSA1024BIT_KEY: ::DWORD = 0x04000000; +pub const CRYPT_SERVER: ::DWORD = 0x00000400; +pub const KEY_LENGTH_MASK: ::DWORD = 0xFFFF0000; +pub const CRYPT_Y_ONLY: ::DWORD = 0x00000001; +pub const CRYPT_SSL2_FALLBACK: ::DWORD = 0x00000002; +pub const CRYPT_DESTROYKEY: ::DWORD = 0x00000004; +pub const CRYPT_OAEP: ::DWORD = 0x00000040; +pub const CRYPT_BLOB_VER3: ::DWORD = 0x00000080; +pub const CRYPT_IPSEC_HMAC_KEY: ::DWORD = 0x00000100; +pub const CRYPT_DECRYPT_RSA_NO_PADDING_CHECK: ::DWORD = 0x00000020; +pub const CRYPT_SECRETDIGEST: ::DWORD = 0x00000001; +pub const CRYPT_OWF_REPL_LM_HASH: ::DWORD = 0x00000001; +pub const CRYPT_LITTLE_ENDIAN: ::DWORD = 0x00000001; +pub const CRYPT_NOHASHOID: ::DWORD = 0x00000001; +pub const CRYPT_TYPE2_FORMAT: ::DWORD = 0x00000002; +pub const CRYPT_X931_FORMAT: ::DWORD = 0x00000004; +pub const CRYPT_MACHINE_DEFAULT: ::DWORD = 0x00000001; +pub const CRYPT_USER_DEFAULT: ::DWORD = 0x00000002; +pub const CRYPT_DELETE_DEFAULT: ::DWORD = 0x00000004; +pub const SIMPLEBLOB: ::DWORD = 0x1; +pub const PUBLICKEYBLOB: ::DWORD = 0x6; +pub const PRIVATEKEYBLOB: ::DWORD = 0x7; +pub const PLAINTEXTKEYBLOB: ::DWORD = 0x8; +pub const OPAQUEKEYBLOB: ::DWORD = 0x9; +pub const PUBLICKEYBLOBEX: ::DWORD = 0xA; +pub const SYMMETRICWRAPKEYBLOB: ::DWORD = 0xB; +pub const KEYSTATEBLOB: ::DWORD = 0xC; +pub const AT_KEYEXCHANGE: ::DWORD = 1; +pub const AT_SIGNATURE: ::DWORD = 2; +pub const CRYPT_USERDATA: ::DWORD = 1; +pub const KP_IV: ::DWORD = 1; +pub const KP_SALT: ::DWORD = 2; +pub const KP_PADDING: ::DWORD = 3; +pub const KP_MODE: ::DWORD = 4; +pub const KP_MODE_BITS: ::DWORD = 5; +pub const KP_PERMISSIONS: ::DWORD = 6; +pub const KP_ALGID: ::DWORD = 7; +pub const KP_BLOCKLEN: ::DWORD = 8; +pub const KP_KEYLEN: ::DWORD = 9; +pub const KP_SALT_EX: ::DWORD = 10; +pub const KP_P: ::DWORD = 11; +pub const KP_G: ::DWORD = 12; +pub const KP_Q: ::DWORD = 13; +pub const KP_X: ::DWORD = 14; +pub const KP_Y: ::DWORD = 15; +pub const KP_RA: ::DWORD = 16; +pub const KP_RB: ::DWORD = 17; +pub const KP_INFO: ::DWORD = 18; +pub const KP_EFFECTIVE_KEYLEN: ::DWORD = 19; +pub const KP_SCHANNEL_ALG: ::DWORD = 20; +pub const KP_CLIENT_RANDOM: ::DWORD = 21; +pub const KP_SERVER_RANDOM: ::DWORD = 22; +pub const KP_RP: ::DWORD = 23; +pub const KP_PRECOMP_MD5: ::DWORD = 24; +pub const KP_PRECOMP_SHA: ::DWORD = 25; +pub const KP_CERTIFICATE: ::DWORD = 26; +pub const KP_CLEAR_KEY: ::DWORD = 27; +pub const KP_PUB_EX_LEN: ::DWORD = 28; +pub const KP_PUB_EX_VAL: ::DWORD = 29; +pub const KP_KEYVAL: ::DWORD = 30; +pub const KP_ADMIN_PIN: ::DWORD = 31; +pub const KP_KEYEXCHANGE_PIN: ::DWORD = 32; +pub const KP_SIGNATURE_PIN: ::DWORD = 33; +pub const KP_PREHASH: ::DWORD = 34; +pub const KP_ROUNDS: ::DWORD = 35; +pub const KP_OAEP_PARAMS: ::DWORD = 36; +pub const KP_CMS_KEY_INFO: ::DWORD = 37; +pub const KP_CMS_DH_KEY_INFO: ::DWORD = 38; +pub const KP_PUB_PARAMS: ::DWORD = 39; +pub const KP_VERIFY_PARAMS: ::DWORD = 40; +pub const KP_HIGHEST_VERSION: ::DWORD = 41; +pub const KP_GET_USE_COUNT: ::DWORD = 42; +pub const KP_PIN_ID: ::DWORD = 43; +pub const KP_PIN_INFO: ::DWORD = 44; +pub const PKCS5_PADDING: ::DWORD = 1; +pub const RANDOM_PADDING: ::DWORD = 2; +pub const ZERO_PADDING: ::DWORD = 3; +pub const CRYPT_MODE_CBC: ::DWORD = 1; +pub const CRYPT_MODE_ECB: ::DWORD = 2; +pub const CRYPT_MODE_OFB: ::DWORD = 3; +pub const CRYPT_MODE_CFB: ::DWORD = 4; +pub const CRYPT_MODE_CTS: ::DWORD = 5; +pub const CRYPT_ENCRYPT: ::DWORD = 0x0001; +pub const CRYPT_DECRYPT: ::DWORD = 0x0002; +pub const CRYPT_EXPORT: ::DWORD = 0x0004; +pub const CRYPT_READ: ::DWORD = 0x0008; +pub const CRYPT_WRITE: ::DWORD = 0x0010; +pub const CRYPT_MAC: ::DWORD = 0x0020; +pub const CRYPT_EXPORT_KEY: ::DWORD = 0x0040; +pub const CRYPT_IMPORT_KEY: ::DWORD = 0x0080; +pub const CRYPT_ARCHIVE: ::DWORD = 0x0100; +pub const HP_ALGID: ::DWORD = 0x0001; +pub const HP_HASHVAL: ::DWORD = 0x0002; +pub const HP_HASHSIZE: ::DWORD = 0x0004; +pub const HP_HMAC_INFO: ::DWORD = 0x0005; +pub const HP_TLS1PRF_LABEL: ::DWORD = 0x0006; +pub const HP_TLS1PRF_SEED: ::DWORD = 0x0007; +pub const CRYPT_FAILED: ::BOOL = ::FALSE; +pub const CRYPT_SUCCEED: ::BOOL = ::TRUE; +pub const PP_ENUMALGS: ::DWORD = 1; +pub const PP_ENUMCONTAINERS: ::DWORD = 2; +pub const PP_IMPTYPE: ::DWORD = 3; +pub const PP_NAME: ::DWORD = 4; +pub const PP_VERSION: ::DWORD = 5; +pub const PP_CONTAINER: ::DWORD = 6; +pub const PP_CHANGE_PASSWORD: ::DWORD = 7; +pub const PP_KEYSET_SEC_DESCR: ::DWORD = 8; +pub const PP_CERTCHAIN: ::DWORD = 9; +pub const PP_KEY_TYPE_SUBTYPE: ::DWORD = 10; +pub const PP_PROVTYPE: ::DWORD = 16; +pub const PP_KEYSTORAGE: ::DWORD = 17; +pub const PP_APPLI_CERT: ::DWORD = 18; +pub const PP_SYM_KEYSIZE: ::DWORD = 19; +pub const PP_SESSION_KEYSIZE: ::DWORD = 20; +pub const PP_UI_PROMPT: ::DWORD = 21; +pub const PP_ENUMALGS_EX: ::DWORD = 22; +pub const PP_ENUMMANDROOTS: ::DWORD = 25; +pub const PP_ENUMELECTROOTS: ::DWORD = 26; +pub const PP_KEYSET_TYPE: ::DWORD = 27; +pub const PP_ADMIN_PIN: ::DWORD = 31; +pub const PP_KEYEXCHANGE_PIN: ::DWORD = 32; +pub const PP_SIGNATURE_PIN: ::DWORD = 33; +pub const PP_SIG_KEYSIZE_INC: ::DWORD = 34; +pub const PP_KEYX_KEYSIZE_INC: ::DWORD = 35; +pub const PP_UNIQUE_CONTAINER: ::DWORD = 36; +pub const PP_SGC_INFO: ::DWORD = 37; +pub const PP_USE_HARDWARE_RNG: ::DWORD = 38; +pub const PP_KEYSPEC: ::DWORD = 39; +pub const PP_ENUMEX_SIGNING_PROT: ::DWORD = 40; +pub const PP_CRYPT_COUNT_KEY_USE: ::DWORD = 41; +pub const PP_USER_CERTSTORE: ::DWORD = 42; +pub const PP_SMARTCARD_READER: ::DWORD = 43; +pub const PP_SMARTCARD_GUID: ::DWORD = 45; +pub const PP_ROOT_CERTSTORE: ::DWORD = 46; +pub const PP_SMARTCARD_READER_ICON: ::DWORD = 47; +pub const CRYPT_FIRST: ::DWORD = 1; +pub const CRYPT_NEXT: ::DWORD = 2; +pub const CRYPT_SGC_ENUM: ::DWORD = 4; +pub const CRYPT_IMPL_HARDWARE: ::DWORD = 1; +pub const CRYPT_IMPL_SOFTWARE: ::DWORD = 2; +pub const CRYPT_IMPL_MIXED: ::DWORD = 3; +pub const CRYPT_IMPL_UNKNOWN: ::DWORD = 4; +pub const CRYPT_IMPL_REMOVABLE: ::DWORD = 8; +pub const CRYPT_SEC_DESCR: ::DWORD = 0x00000001; +pub const CRYPT_PSTORE: ::DWORD = 0x00000002; +pub const CRYPT_UI_PROMPT: ::DWORD = 0x00000004; +pub const CRYPT_FLAG_PCT1: ::DWORD = 0x0001; +pub const CRYPT_FLAG_SSL2: ::DWORD = 0x0002; +pub const CRYPT_FLAG_SSL3: ::DWORD = 0x0004; +pub const CRYPT_FLAG_TLS1: ::DWORD = 0x0008; +pub const CRYPT_FLAG_IPSEC: ::DWORD = 0x0010; +pub const CRYPT_FLAG_SIGNING: ::DWORD = 0x0020; +pub const CRYPT_SGC: ::DWORD = 0x0001; +pub const CRYPT_FASTSGC: ::DWORD = 0x0002; +pub const PP_CLIENT_HWND: ::DWORD = 1; +pub const PP_CONTEXT_INFO: ::DWORD = 11; +pub const PP_KEYEXCHANGE_KEYSIZE: ::DWORD = 12; +pub const PP_SIGNATURE_KEYSIZE: ::DWORD = 13; +pub const PP_KEYEXCHANGE_ALG: ::DWORD = 14; +pub const PP_SIGNATURE_ALG: ::DWORD = 15; +pub const PP_DELETEKEY: ::DWORD = 24; +pub const PP_PIN_PROMPT_STRING: ::DWORD = 44; +pub const PP_SECURE_KEYEXCHANGE_PIN: ::DWORD = 47; +pub const PP_SECURE_SIGNATURE_PIN: ::DWORD = 48; +pub const PROV_RSA_FULL: ::DWORD = 1; +pub const PROV_RSA_SIG: ::DWORD = 2; +pub const PROV_DSS: ::DWORD = 3; +pub const PROV_FORTEZZA: ::DWORD = 4; +pub const PROV_MS_EXCHANGE: ::DWORD = 5; +pub const PROV_SSL: ::DWORD = 6; +pub const PROV_RSA_SCHANNEL: ::DWORD = 12; +pub const PROV_DSS_DH: ::DWORD = 13; +pub const PROV_EC_ECDSA_SIG: ::DWORD = 14; +pub const PROV_EC_ECNRA_SIG: ::DWORD = 15; +pub const PROV_EC_ECDSA_FULL: ::DWORD = 16; +pub const PROV_EC_ECNRA_FULL: ::DWORD = 17; +pub const PROV_DH_SCHANNEL: ::DWORD = 18; +pub const PROV_SPYRUS_LYNKS: ::DWORD = 20; +pub const PROV_RNG: ::DWORD = 21; +pub const PROV_INTEL_SEC: ::DWORD = 22; +pub const PROV_REPLACE_OWF: ::DWORD = 23; +pub const PROV_RSA_AES: ::DWORD = 24; +pub const MS_DEF_PROV: &'static str = "Microsoft Base Cryptographic Provider v1.0"; +pub const MS_ENHANCED_PROV: &'static str = "Microsoft Enhanced Cryptographic Provider v1.0"; +pub const MS_STRONG_PROV: &'static str = "Microsoft Strong Cryptographic Provider"; +pub const MS_DEF_RSA_SIG_PROV: &'static str = "Microsoft RSA Signature Cryptographic Provider"; +pub const MS_DEF_RSA_SCHANNEL_PROV: &'static str = "Microsoft RSA SChannel Cryptographic Provider"; +pub const MS_DEF_DSS_PROV: &'static str = "Microsoft Base DSS Cryptographic Provider"; +pub const MS_DEF_DSS_DH_PROV: &'static str = + "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"; +pub const MS_ENH_DSS_DH_PROV: &'static str = + "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"; +pub const MS_DEF_DH_SCHANNEL_PROV: &'static str = "Microsoft DH SChannel Cryptographic Provider"; +pub const MS_SCARD_PROV: &'static str = "Microsoft Base Smart Card Crypto Provider"; +pub const MS_ENH_RSA_AES_PROV: &'static str = + "Microsoft Enhanced RSA and AES Cryptographic Provider"; +pub const MS_ENH_RSA_AES_PROV_XP: &'static str = + "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"; +pub const MAXUIDLEN: usize = 64; +pub const EXPO_OFFLOAD_REG_VALUE: &'static str = "ExpoOffload"; +pub const EXPO_OFFLOAD_FUNC_NAME: &'static str = "OffloadModExpo"; +pub const szKEY_CRYPTOAPI_PRIVATE_KEY_OPTIONS: &'static str = + "Software\\Policies\\Microsoft\\Cryptography"; +pub const szKEY_CACHE_ENABLED: &'static str = "CachePrivateKeys"; +pub const szKEY_CACHE_SECONDS: &'static str = "PrivateKeyLifetimeSeconds"; +pub const szPRIV_KEY_CACHE_MAX_ITEMS: &'static str = "PrivKeyCacheMaxItems"; +pub const cPRIV_KEY_CACHE_MAX_ITEMS_DEFAULT: ::DWORD = 20; +pub const szPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS: &'static str = + "PrivKeyCachePurgeIntervalSeconds"; +pub const cPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS_DEFAULT: ::DWORD = 86400; +pub const CUR_BLOB_VERSION: ::DWORD = 2; +STRUCT!{struct CMS_KEY_INFO { + dwVersion: ::DWORD, + Algid: ALG_ID, + pbOID: *mut ::BYTE, + cbOID: ::DWORD, +}} +pub type PCMS_KEY_INFO = *mut CMS_KEY_INFO; +STRUCT!{struct HMAC_INFO { + HashAlgid: ALG_ID, + pbInnerString: *mut ::BYTE, + cbInnerString: ::DWORD, + pbOuterString: *mut ::BYTE, + cbOuterString: ::DWORD, +}} +pub type PHMAC_INFO = *mut HMAC_INFO; +STRUCT!{struct SCHANNEL_ALG { + dwUse: ::DWORD, + Algid: ALG_ID, + cBits: ::DWORD, + dwFlags: ::DWORD, + dwReserved: ::DWORD, +}} +pub type PSCHANNEL_ALG = *mut SCHANNEL_ALG; +pub const SCHANNEL_MAC_KEY: ::DWORD = 0x00000000; +pub const SCHANNEL_ENC_KEY: ::DWORD = 0x00000001; +pub const INTERNATIONAL_USAGE: ::DWORD = 0x00000001; +STRUCT!{struct PROV_ENUMALGS { + aiAlgid: ALG_ID, + dwBitLen: ::DWORD, + dwNameLen: ::DWORD, + szName: [::CHAR; 20], +}} +STRUCT!{nodebug struct PROV_ENUMALGS_EX { + aiAlgid: ALG_ID, + dwDefaultLen: ::DWORD, + dwMinLen: ::DWORD, + dwMaxLen: ::DWORD, + dwProtocols: ::DWORD, + dwNameLen: ::DWORD, + szName: [::CHAR; 20], + dwLongNameLen: ::DWORD, + szLongName: [::CHAR; 40], +}} +STRUCT!{struct BLOBHEADER { + bType: ::BYTE, + bVersion: ::BYTE, + reserved: ::WORD, + aiKeyAlg: ::ALG_ID, +}} +pub type PUBLICKEYSTRUC = BLOBHEADER; +STRUCT!{struct RSAPUBKEY { + magic: ::DWORD, + bitlen: ::DWORD, + pubexp: ::DWORD, +}} +STRUCT!{struct DHPUBKEY { + magic: ::DWORD, + bitlen: ::DWORD, +}} +pub type DSSPUBKEY = DHPUBKEY; +pub type KEAPUBKEY = DHPUBKEY; +pub type TEKPUBKEY = DHPUBKEY; +STRUCT!{struct DSSSEED { + counter: ::DWORD, + seed: [::BYTE; 20], +}} +STRUCT!{struct DHPUBKEY_VER3 { + magic: ::DWORD, + bitlenP: ::DWORD, + bitlenQ: ::DWORD, + bitlenJ: ::DWORD, + DSSSeed: DSSSEED, +}} +pub type DSSPUBKEY_VER3 = DHPUBKEY_VER3; +STRUCT!{struct DHPRIVKEY_VER3 { + magic: ::DWORD, + bitlenP: ::DWORD, + bitlenQ: ::DWORD, + bitlenJ: ::DWORD, + bitlenX: ::DWORD, + DSSSeed: DSSSEED, +}} +pub type DSSPRIVKEY_VER3 = DHPRIVKEY_VER3; +STRUCT!{struct KEY_TYPE_SUBTYPE { + dwKeySpec: ::DWORD, + Type: ::GUID, + Subtype: ::GUID, +}} +pub type PKEY_TYPE_SUBTYPE = *mut KEY_TYPE_SUBTYPE; +STRUCT!{nodebug struct CERT_FORTEZZA_DATA_PROP { + SerialNumber: [::c_uchar; 8], + CertIndex: ::c_int, + CertLabel: [::c_uchar; 36], +}} +STRUCT!{nodebug struct CRYPT_RC4_KEY_STATE { + Key: [::c_uchar; 16], + SBox: [::c_uchar; 256], + i: ::c_uchar, + j: ::c_uchar, +}} +pub type PCRYPT_RC4_KEY_STATE = *mut CRYPT_RC4_KEY_STATE; +STRUCT!{struct CRYPT_DES_KEY_STATE { + Key: [::c_uchar; 8], + IV: [::c_uchar; 8], + Feedback: [::c_uchar; 8], +}} +pub type PCRYPT_DES_KEY_STATE = *mut CRYPT_DES_KEY_STATE; +STRUCT!{struct CRYPT_3DES_KEY_STATE { + Key: [::c_uchar; 24], + IV: [::c_uchar; 8], + Feedback: [::c_uchar; 8], +}} +pub type PCRYPT_3DES_KEY_STATE = *mut CRYPT_3DES_KEY_STATE; +STRUCT!{struct CRYPT_AES_128_KEY_STATE { + Key: [::c_uchar; 16], + IV: [::c_uchar; 16], + EncryptionState: [[::c_uchar; 16]; 11], + DecryptionState: [[::c_uchar; 16]; 11], + Feedback: [::c_uchar; 16], +}} +pub type PCRYPT_AES_128_KEY_STATE = *mut CRYPT_AES_128_KEY_STATE; +STRUCT!{struct CRYPT_AES_256_KEY_STATE { + Key: [::c_uchar; 32], + IV: [::c_uchar; 16], + EncryptionState: [[::c_uchar; 16]; 15], + DecryptionState: [[::c_uchar; 16]; 15], + Feedback: [::c_uchar; 16], +}} +pub type PCRYPT_AES_256_KEY_STATE = *mut CRYPT_AES_256_KEY_STATE; +STRUCT!{struct CRYPTOAPI_BLOB { + cbData: ::DWORD, + pbData: *mut ::BYTE, +}} +pub type CRYPT_INTEGER_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_INTEGER_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_UINT_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_UINT_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_OBJID_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_OBJID_BLOB = *mut CRYPTOAPI_BLOB; +pub type CERT_NAME_BLOB = CRYPTOAPI_BLOB; +pub type PCERT_NAME_BLOB = *mut CRYPTOAPI_BLOB; +pub type CERT_RDN_VALUE_BLOB = CRYPTOAPI_BLOB; +pub type PCERT_RDN_VALUE_BLOB = *mut CRYPTOAPI_BLOB; +pub type CERT_BLOB = CRYPTOAPI_BLOB; +pub type PCERT_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRL_BLOB = CRYPTOAPI_BLOB; +pub type PCRL_BLOB = *mut CRYPTOAPI_BLOB; +pub type DATA_BLOB = CRYPTOAPI_BLOB; +pub type PDATA_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_DATA_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_DATA_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_HASH_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_HASH_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_DIGEST_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_DIGEST_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_DER_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_DER_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_ATTR_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_ATTR_BLOB = *mut CRYPTOAPI_BLOB; +STRUCT!{struct CMS_DH_KEY_INFO { + dwVersion: ::DWORD, + Algid: ALG_ID, + pszContentEncObjId: ::LPSTR, + PubInfo: CRYPT_DATA_BLOB, + pReserved: *mut ::c_void, +}} +pub type PCMS_DH_KEY_INFO = *mut CMS_DH_KEY_INFO; +pub type HCRYPTPROV_OR_NCRYPT_KEY_HANDLE = ::ULONG_PTR; +pub type HCRYPTPROV_LEGACY = ::ULONG_PTR; +STRUCT!{struct CRYPT_BIT_BLOB { + cbData: ::DWORD, + pbData: *mut ::BYTE, + cUnusedBits: ::DWORD, +}} +pub type PCRYPT_BIT_BLOB = *mut CRYPT_BIT_BLOB; +STRUCT!{struct CRYPT_ALGORITHM_IDENTIFIER { + pszObjId: ::LPSTR, + Parameters: CRYPT_OBJID_BLOB, +}} +pub type PCRYPT_ALGORITHM_IDENTIFIER = *mut CRYPT_ALGORITHM_IDENTIFIER; +pub const szOID_RSA: &'static str = "1.2.840.113549"; +pub const szOID_PKCS: &'static str = "1.2.840.113549.1"; +pub const szOID_RSA_HASH: &'static str = "1.2.840.113549.2"; +pub const szOID_RSA_ENCRYPT: &'static str = "1.2.840.113549.3"; +pub const szOID_PKCS_1: &'static str = "1.2.840.113549.1.1"; +pub const szOID_PKCS_2: &'static str = "1.2.840.113549.1.2"; +pub const szOID_PKCS_3: &'static str = "1.2.840.113549.1.3"; +pub const szOID_PKCS_4: &'static str = "1.2.840.113549.1.4"; +pub const szOID_PKCS_5: &'static str = "1.2.840.113549.1.5"; +pub const szOID_PKCS_6: &'static str = "1.2.840.113549.1.6"; +pub const szOID_PKCS_7: &'static str = "1.2.840.113549.1.7"; +pub const szOID_PKCS_8: &'static str = "1.2.840.113549.1.8"; +pub const szOID_PKCS_9: &'static str = "1.2.840.113549.1.9"; +pub const szOID_PKCS_10: &'static str = "1.2.840.113549.1.10"; +pub const szOID_PKCS_12: &'static str = "1.2.840.113549.1.12"; +pub const szOID_RSA_RSA: &'static str = "1.2.840.113549.1.1.1"; +pub const szOID_RSA_MD2RSA: &'static str = "1.2.840.113549.1.1.2"; +pub const szOID_RSA_MD4RSA: &'static str = "1.2.840.113549.1.1.3"; +pub const szOID_RSA_MD5RSA: &'static str = "1.2.840.113549.1.1.4"; +pub const szOID_RSA_SHA1RSA: &'static str = "1.2.840.113549.1.1.5"; +pub const szOID_RSA_SETOAEP_RSA: &'static str = "1.2.840.113549.1.1.6"; +pub const szOID_RSAES_OAEP: &'static str = "1.2.840.113549.1.1.7"; +pub const szOID_RSA_MGF1: &'static str = "1.2.840.113549.1.1.8"; +pub const szOID_RSA_PSPECIFIED: &'static str = "1.2.840.113549.1.1.9"; +pub const szOID_RSA_SSA_PSS: &'static str = "1.2.840.113549.1.1.10"; +pub const szOID_RSA_SHA256RSA: &'static str = "1.2.840.113549.1.1.11"; +pub const szOID_RSA_SHA384RSA: &'static str = "1.2.840.113549.1.1.12"; +pub const szOID_RSA_SHA512RSA: &'static str = "1.2.840.113549.1.1.13"; +pub const szOID_RSA_DH: &'static str = "1.2.840.113549.1.3.1"; +pub const szOID_RSA_data: &'static str = "1.2.840.113549.1.7.1"; +pub const szOID_RSA_signedData: &'static str = "1.2.840.113549.1.7.2"; +pub const szOID_RSA_envelopedData: &'static str = "1.2.840.113549.1.7.3"; +pub const szOID_RSA_signEnvData: &'static str = "1.2.840.113549.1.7.4"; +pub const szOID_RSA_digestedData: &'static str = "1.2.840.113549.1.7.5"; +pub const szOID_RSA_hashedData: &'static str = "1.2.840.113549.1.7.5"; +pub const szOID_RSA_encryptedData: &'static str = "1.2.840.113549.1.7.6"; +pub const szOID_RSA_emailAddr: &'static str = "1.2.840.113549.1.9.1"; +pub const szOID_RSA_unstructName: &'static str = "1.2.840.113549.1.9.2"; +pub const szOID_RSA_contentType: &'static str = "1.2.840.113549.1.9.3"; +pub const szOID_RSA_messageDigest: &'static str = "1.2.840.113549.1.9.4"; +pub const szOID_RSA_signingTime: &'static str = "1.2.840.113549.1.9.5"; +pub const szOID_RSA_counterSign: &'static str = "1.2.840.113549.1.9.6"; +pub const szOID_RSA_challengePwd: &'static str = "1.2.840.113549.1.9.7"; +pub const szOID_RSA_unstructAddr: &'static str = "1.2.840.113549.1.9.8"; +pub const szOID_RSA_extCertAttrs: &'static str = "1.2.840.113549.1.9.9"; +pub const szOID_RSA_certExtensions: &'static str = "1.2.840.113549.1.9.14"; +pub const szOID_RSA_SMIMECapabilities: &'static str = "1.2.840.113549.1.9.15"; +pub const szOID_RSA_preferSignedData: &'static str = "1.2.840.113549.1.9.15.1"; +pub const szOID_TIMESTAMP_TOKEN: &'static str = "1.2.840.113549.1.9.16.1.4"; +pub const szOID_RFC3161_counterSign: &'static str = "1.3.6.1.4.1.311.3.3.1"; +pub const szOID_RSA_SMIMEalg: &'static str = "1.2.840.113549.1.9.16.3"; +pub const szOID_RSA_SMIMEalgESDH: &'static str = "1.2.840.113549.1.9.16.3.5"; +pub const szOID_RSA_SMIMEalgCMS3DESwrap: &'static str = "1.2.840.113549.1.9.16.3.6"; +pub const szOID_RSA_SMIMEalgCMSRC2wrap: &'static str = "1.2.840.113549.1.9.16.3.7"; +pub const szOID_RSA_MD2: &'static str = "1.2.840.113549.2.2"; +pub const szOID_RSA_MD4: &'static str = "1.2.840.113549.2.4"; +pub const szOID_RSA_MD5: &'static str = "1.2.840.113549.2.5"; +pub const szOID_RSA_RC2CBC: &'static str = "1.2.840.113549.3.2"; +pub const szOID_RSA_RC4: &'static str = "1.2.840.113549.3.4"; +pub const szOID_RSA_DES_EDE3_CBC: &'static str = "1.2.840.113549.3.7"; +pub const szOID_RSA_RC5_CBCPad: &'static str = "1.2.840.113549.3.9"; +pub const szOID_ANSI_X942: &'static str = "1.2.840.10046"; +pub const szOID_ANSI_X942_DH: &'static str = "1.2.840.10046.2.1"; +pub const szOID_X957: &'static str = "1.2.840.10040"; +pub const szOID_X957_DSA: &'static str = "1.2.840.10040.4.1"; +pub const szOID_X957_SHA1DSA: &'static str = "1.2.840.10040.4.3"; +pub const szOID_ECC_PUBLIC_KEY: &'static str = "1.2.840.10045.2.1"; +pub const szOID_ECC_CURVE_P256: &'static str = "1.2.840.10045.3.1.7"; +pub const szOID_ECC_CURVE_P384: &'static str = "1.3.132.0.34"; +pub const szOID_ECC_CURVE_P521: &'static str = "1.3.132.0.35"; +pub const szOID_ECDSA_SHA1: &'static str = "1.2.840.10045.4.1"; +pub const szOID_ECDSA_SPECIFIED: &'static str = "1.2.840.10045.4.3"; +pub const szOID_ECDSA_SHA256: &'static str = "1.2.840.10045.4.3.2"; +pub const szOID_ECDSA_SHA384: &'static str = "1.2.840.10045.4.3.3"; +pub const szOID_ECDSA_SHA512: &'static str = "1.2.840.10045.4.3.4"; +pub const szOID_NIST_AES128_CBC: &'static str = "2.16.840.1.101.3.4.1.2"; +pub const szOID_NIST_AES192_CBC: &'static str = "2.16.840.1.101.3.4.1.22"; +pub const szOID_NIST_AES256_CBC: &'static str = "2.16.840.1.101.3.4.1.42"; +pub const szOID_NIST_AES128_WRAP: &'static str = "2.16.840.1.101.3.4.1.5"; +pub const szOID_NIST_AES192_WRAP: &'static str = "2.16.840.1.101.3.4.1.25"; +pub const szOID_NIST_AES256_WRAP: &'static str = "2.16.840.1.101.3.4.1.45"; +pub const szOID_DH_SINGLE_PASS_STDDH_SHA1_KDF: &'static str = "1.3.133.16.840.63.0.2"; +pub const szOID_DH_SINGLE_PASS_STDDH_SHA256_KDF: &'static str = "1.3.132.1.11.1"; +pub const szOID_DH_SINGLE_PASS_STDDH_SHA384_KDF: &'static str = "1.3.132.1.11.2"; +pub const szOID_DS: &'static str = "2.5"; +pub const szOID_DSALG: &'static str = "2.5.8"; +pub const szOID_DSALG_CRPT: &'static str = "2.5.8.1"; +pub const szOID_DSALG_HASH: &'static str = "2.5.8.2"; +pub const szOID_DSALG_SIGN: &'static str = "2.5.8.3"; +pub const szOID_DSALG_RSA: &'static str = "2.5.8.1.1"; +pub const szOID_OIW: &'static str = "1.3.14"; +pub const szOID_OIWSEC: &'static str = "1.3.14.3.2"; +pub const szOID_OIWSEC_md4RSA: &'static str = "1.3.14.3.2.2"; +pub const szOID_OIWSEC_md5RSA: &'static str = "1.3.14.3.2.3"; +pub const szOID_OIWSEC_md4RSA2: &'static str = "1.3.14.3.2.4"; +pub const szOID_OIWSEC_desECB: &'static str = "1.3.14.3.2.6"; +pub const szOID_OIWSEC_desCBC: &'static str = "1.3.14.3.2.7"; +pub const szOID_OIWSEC_desOFB: &'static str = "1.3.14.3.2.8"; +pub const szOID_OIWSEC_desCFB: &'static str = "1.3.14.3.2.9"; +pub const szOID_OIWSEC_desMAC: &'static str = "1.3.14.3.2.10"; +pub const szOID_OIWSEC_rsaSign: &'static str = "1.3.14.3.2.11"; +pub const szOID_OIWSEC_dsa: &'static str = "1.3.14.3.2.12"; +pub const szOID_OIWSEC_shaDSA: &'static str = "1.3.14.3.2.13"; +pub const szOID_OIWSEC_mdc2RSA: &'static str = "1.3.14.3.2.14"; +pub const szOID_OIWSEC_shaRSA: &'static str = "1.3.14.3.2.15"; +pub const szOID_OIWSEC_dhCommMod: &'static str = "1.3.14.3.2.16"; +pub const szOID_OIWSEC_desEDE: &'static str = "1.3.14.3.2.17"; +pub const szOID_OIWSEC_sha: &'static str = "1.3.14.3.2.18"; +pub const szOID_OIWSEC_mdc2: &'static str = "1.3.14.3.2.19"; +pub const szOID_OIWSEC_dsaComm: &'static str = "1.3.14.3.2.20"; +pub const szOID_OIWSEC_dsaCommSHA: &'static str = "1.3.14.3.2.21"; +pub const szOID_OIWSEC_rsaXchg: &'static str = "1.3.14.3.2.22"; +pub const szOID_OIWSEC_keyHashSeal: &'static str = "1.3.14.3.2.23"; +pub const szOID_OIWSEC_md2RSASign: &'static str = "1.3.14.3.2.24"; +pub const szOID_OIWSEC_md5RSASign: &'static str = "1.3.14.3.2.25"; +pub const szOID_OIWSEC_sha1: &'static str = "1.3.14.3.2.26"; +pub const szOID_OIWSEC_dsaSHA1: &'static str = "1.3.14.3.2.27"; +pub const szOID_OIWSEC_dsaCommSHA1: &'static str = "1.3.14.3.2.28"; +pub const szOID_OIWSEC_sha1RSASign: &'static str = "1.3.14.3.2.29"; +pub const szOID_OIWDIR: &'static str = "1.3.14.7.2"; +pub const szOID_OIWDIR_CRPT: &'static str = "1.3.14.7.2.1"; +pub const szOID_OIWDIR_HASH: &'static str = "1.3.14.7.2.2"; +pub const szOID_OIWDIR_SIGN: &'static str = "1.3.14.7.2.3"; +pub const szOID_OIWDIR_md2: &'static str = "1.3.14.7.2.2.1"; +pub const szOID_OIWDIR_md2RSA: &'static str = "1.3.14.7.2.3.1"; +pub const szOID_INFOSEC: &'static str = "2.16.840.1.101.2.1"; +pub const szOID_INFOSEC_sdnsSignature: &'static str = "2.16.840.1.101.2.1.1.1"; +pub const szOID_INFOSEC_mosaicSignature: &'static str = "2.16.840.1.101.2.1.1.2"; +pub const szOID_INFOSEC_sdnsConfidentiality: &'static str = "2.16.840.1.101.2.1.1.3"; +pub const szOID_INFOSEC_mosaicConfidentiality: &'static str = "2.16.840.1.101.2.1.1.4"; +pub const szOID_INFOSEC_sdnsIntegrity: &'static str = "2.16.840.1.101.2.1.1.5"; +pub const szOID_INFOSEC_mosaicIntegrity: &'static str = "2.16.840.1.101.2.1.1.6"; +pub const szOID_INFOSEC_sdnsTokenProtection: &'static str = "2.16.840.1.101.2.1.1.7"; +pub const szOID_INFOSEC_mosaicTokenProtection: &'static str = "2.16.840.1.101.2.1.1.8"; +pub const szOID_INFOSEC_sdnsKeyManagement: &'static str = "2.16.840.1.101.2.1.1.9"; +pub const szOID_INFOSEC_mosaicKeyManagement: &'static str = "2.16.840.1.101.2.1.1.10"; +pub const szOID_INFOSEC_sdnsKMandSig: &'static str = "2.16.840.1.101.2.1.1.11"; +pub const szOID_INFOSEC_mosaicKMandSig: &'static str = "2.16.840.1.101.2.1.1.12"; +pub const szOID_INFOSEC_SuiteASignature: &'static str = "2.16.840.1.101.2.1.1.13"; +pub const szOID_INFOSEC_SuiteAConfidentiality: &'static str = "2.16.840.1.101.2.1.1.14"; +pub const szOID_INFOSEC_SuiteAIntegrity: &'static str = "2.16.840.1.101.2.1.1.15"; +pub const szOID_INFOSEC_SuiteATokenProtection: &'static str = "2.16.840.1.101.2.1.1.16"; +pub const szOID_INFOSEC_SuiteAKeyManagement: &'static str = "2.16.840.1.101.2.1.1.17"; +pub const szOID_INFOSEC_SuiteAKMandSig: &'static str = "2.16.840.1.101.2.1.1.18"; +pub const szOID_INFOSEC_mosaicUpdatedSig: &'static str = "2.16.840.1.101.2.1.1.19"; +pub const szOID_INFOSEC_mosaicKMandUpdSig: &'static str = "2.16.840.1.101.2.1.1.20"; +pub const szOID_INFOSEC_mosaicUpdatedInteg: &'static str = "2.16.840.1.101.2.1.1.21"; +pub const szOID_NIST_sha256: &'static str = "2.16.840.1.101.3.4.2.1"; +pub const szOID_NIST_sha384: &'static str = "2.16.840.1.101.3.4.2.2"; +pub const szOID_NIST_sha512: &'static str = "2.16.840.1.101.3.4.2.3"; +STRUCT!{struct CRYPT_OBJID_TABLE { + dwAlgId: ::DWORD, + pszObjId: ::LPCSTR, +}} +pub type PCRYPT_OBJID_TABLE = *mut CRYPT_OBJID_TABLE; +STRUCT!{struct CRYPT_HASH_INFO { + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Hash: CRYPT_HASH_BLOB, +}} +pub type PCRYPT_HASH_INFO = *mut CRYPT_HASH_INFO; +STRUCT!{struct CERT_EXTENSION { + pszObjId: ::LPSTR, + fCritical: ::BOOL, + Value: CRYPT_OBJID_BLOB, +}} +pub type PCERT_EXTENSION = *mut CERT_EXTENSION; +pub type PCCERT_EXTENSION = *const CERT_EXTENSION; +STRUCT!{struct CRYPT_ATTRIBUTE_TYPE_VALUE { + pszObjId: ::LPSTR, + Value: CRYPT_OBJID_BLOB, +}} +pub type PCRYPT_ATTRIBUTE_TYPE_VALUE = *mut CRYPT_ATTRIBUTE_TYPE_VALUE; +STRUCT!{struct CRYPT_ATTRIBUTE { + pszObjId: ::LPSTR, + cValue: ::DWORD, + rgValue: PCRYPT_ATTR_BLOB, +}} +pub type PCRYPT_ATTRIBUTE = *mut CRYPT_ATTRIBUTE; +STRUCT!{struct CRYPT_ATTRIBUTES { + cAttr: ::DWORD, + rgAttr: PCRYPT_ATTRIBUTE, +}} +pub type PCRYPT_ATTRIBUTES = *mut CRYPT_ATTRIBUTES; +STRUCT!{struct CERT_RDN_ATTR { + pszObjId: ::LPSTR, + dwValueType: ::DWORD, + Value: CERT_RDN_VALUE_BLOB, +}} +pub type PCERT_RDN_ATTR = *mut CERT_RDN_ATTR; +pub const szOID_COMMON_NAME: &'static str = "2.5.4.3"; +pub const szOID_SUR_NAME: &'static str = "2.5.4.4"; +pub const szOID_DEVICE_SERIAL_NUMBER: &'static str = "2.5.4.5"; +pub const szOID_COUNTRY_NAME: &'static str = "2.5.4.6"; +pub const szOID_LOCALITY_NAME: &'static str = "2.5.4.7"; +pub const szOID_STATE_OR_PROVINCE_NAME: &'static str = "2.5.4.8"; +pub const szOID_STREET_ADDRESS: &'static str = "2.5.4.9"; +pub const szOID_ORGANIZATION_NAME: &'static str = "2.5.4.10"; +pub const szOID_ORGANIZATIONAL_UNIT_NAME: &'static str = "2.5.4.11"; +pub const szOID_TITLE: &'static str = "2.5.4.12"; +pub const szOID_DESCRIPTION: &'static str = "2.5.4.13"; +pub const szOID_SEARCH_GUIDE: &'static str = "2.5.4.14"; +pub const szOID_BUSINESS_CATEGORY: &'static str = "2.5.4.15"; +pub const szOID_POSTAL_ADDRESS: &'static str = "2.5.4.16"; +pub const szOID_POSTAL_CODE: &'static str = "2.5.4.17"; +pub const szOID_POST_OFFICE_BOX: &'static str = "2.5.4.18"; +pub const szOID_PHYSICAL_DELIVERY_OFFICE_NAME: &'static str = "2.5.4.19"; +pub const szOID_TELEPHONE_NUMBER: &'static str = "2.5.4.20"; +pub const szOID_TELEX_NUMBER: &'static str = "2.5.4.21"; +pub const szOID_TELETEXT_TERMINAL_IDENTIFIER: &'static str = "2.5.4.22"; +pub const szOID_FACSIMILE_TELEPHONE_NUMBER: &'static str = "2.5.4.23"; +pub const szOID_X21_ADDRESS: &'static str = "2.5.4.24"; +pub const szOID_INTERNATIONAL_ISDN_NUMBER: &'static str = "2.5.4.25"; +pub const szOID_REGISTERED_ADDRESS: &'static str = "2.5.4.26"; +pub const szOID_DESTINATION_INDICATOR: &'static str = "2.5.4.27"; +pub const szOID_PREFERRED_DELIVERY_METHOD: &'static str = "2.5.4.28"; +pub const szOID_PRESENTATION_ADDRESS: &'static str = "2.5.4.29"; +pub const szOID_SUPPORTED_APPLICATION_CONTEXT: &'static str = "2.5.4.30"; +pub const szOID_MEMBER: &'static str = "2.5.4.31"; +pub const szOID_OWNER: &'static str = "2.5.4.32"; +pub const szOID_ROLE_OCCUPANT: &'static str = "2.5.4.33"; +pub const szOID_SEE_ALSO: &'static str = "2.5.4.34"; +pub const szOID_USER_PASSWORD: &'static str = "2.5.4.35"; +pub const szOID_USER_CERTIFICATE: &'static str = "2.5.4.36"; +pub const szOID_CA_CERTIFICATE: &'static str = "2.5.4.37"; +pub const szOID_AUTHORITY_REVOCATION_LIST: &'static str = "2.5.4.38"; +pub const szOID_CERTIFICATE_REVOCATION_LIST: &'static str = "2.5.4.39"; +pub const szOID_CROSS_CERTIFICATE_PAIR: &'static str = "2.5.4.40"; +pub const szOID_GIVEN_NAME: &'static str = "2.5.4.42"; +pub const szOID_INITIALS: &'static str = "2.5.4.43"; +pub const szOID_DN_QUALIFIER: &'static str = "2.5.4.46"; +pub const szOID_DOMAIN_COMPONENT: &'static str = "0.9.2342.19200300.100.1.25"; +pub const szOID_PKCS_12_FRIENDLY_NAME_ATTR: &'static str = "1.2.840.113549.1.9.20"; +pub const szOID_PKCS_12_LOCAL_KEY_ID: &'static str = "1.2.840.113549.1.9.21"; +pub const szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR: &'static str = "1.3.6.1.4.1.311.17.1"; +pub const szOID_LOCAL_MACHINE_KEYSET: &'static str = "1.3.6.1.4.1.311.17.2"; +pub const szOID_PKCS_12_EXTENDED_ATTRIBUTES: &'static str = "1.3.6.1.4.1.311.17.3"; +pub const szOID_PKCS_12_PROTECTED_PASSWORD_SECRET_BAG_TYPE_ID: &'static str = + "1.3.6.1.4.1.311.17.4"; +pub const szOID_KEYID_RDN: &'static str = "1.3.6.1.4.1.311.10.7.1"; +pub const szOID_EV_RDN_LOCALE: &'static str = "1.3.6.1.4.1.311.60.2.1.1"; +pub const szOID_EV_RDN_STATE_OR_PROVINCE: &'static str = "1.3.6.1.4.1.311.60.2.1.2"; +pub const szOID_EV_RDN_COUNTRY: &'static str = "1.3.6.1.4.1.311.60.2.1.3"; +pub const CERT_RDN_ANY_TYPE: ::DWORD = 0; +pub const CERT_RDN_ENCODED_BLOB: ::DWORD = 1; +pub const CERT_RDN_OCTET_STRING: ::DWORD = 2; +pub const CERT_RDN_NUMERIC_STRING: ::DWORD = 3; +pub const CERT_RDN_PRINTABLE_STRING: ::DWORD = 4; +pub const CERT_RDN_TELETEX_STRING: ::DWORD = 5; +pub const CERT_RDN_T61_STRING: ::DWORD = 5; +pub const CERT_RDN_VIDEOTEX_STRING: ::DWORD = 6; +pub const CERT_RDN_IA5_STRING: ::DWORD = 7; +pub const CERT_RDN_GRAPHIC_STRING: ::DWORD = 8; +pub const CERT_RDN_VISIBLE_STRING: ::DWORD = 9; +pub const CERT_RDN_ISO646_STRING: ::DWORD = 9; +pub const CERT_RDN_GENERAL_STRING: ::DWORD = 10; +pub const CERT_RDN_UNIVERSAL_STRING: ::DWORD = 11; +pub const CERT_RDN_INT4_STRING: ::DWORD = 11; +pub const CERT_RDN_BMP_STRING: ::DWORD = 12; +pub const CERT_RDN_UNICODE_STRING: ::DWORD = 12; +pub const CERT_RDN_UTF8_STRING: ::DWORD = 13; +pub const CERT_RDN_TYPE_MASK: ::DWORD = 0x000000FF; +pub const CERT_RDN_FLAGS_MASK: ::DWORD = 0xFF000000; +pub const CERT_RDN_ENABLE_T61_UNICODE_FLAG: ::DWORD = 0x80000000; +pub const CERT_RDN_ENABLE_UTF8_UNICODE_FLAG: ::DWORD = 0x20000000; +pub const CERT_RDN_FORCE_UTF8_UNICODE_FLAG: ::DWORD = 0x10000000; +pub const CERT_RDN_DISABLE_CHECK_TYPE_FLAG: ::DWORD = 0x40000000; +pub const CERT_RDN_DISABLE_IE4_UTF8_FLAG: ::DWORD = 0x01000000; +pub const CERT_RDN_ENABLE_PUNYCODE_FLAG: ::DWORD = 0x02000000; +STRUCT!{struct CERT_RDN { + cRDNAttr: ::DWORD, + rgRDNAttr: PCERT_RDN_ATTR, +}} +pub type PCERT_RDN = *mut CERT_RDN; +STRUCT!{struct CERT_NAME_INFO { + cRDN: ::DWORD, + rgRDN: PCERT_RDN, +}} +pub type PCERT_NAME_INFO = *mut CERT_NAME_INFO; +STRUCT!{struct CERT_NAME_VALUE { + dwValueType: ::DWORD, + Value: CERT_RDN_VALUE_BLOB, +}} +pub type PCERT_NAME_VALUE = *mut CERT_NAME_VALUE; +STRUCT!{struct CERT_PUBLIC_KEY_INFO { + Algorithm: CRYPT_ALGORITHM_IDENTIFIER, + PublicKey: CRYPT_BIT_BLOB, +}} +pub type PCERT_PUBLIC_KEY_INFO = *mut CERT_PUBLIC_KEY_INFO; +pub const CERT_RSA_PUBLIC_KEY_OBJID: &'static str = szOID_RSA_RSA; +pub const CERT_DEFAULT_OID_PUBLIC_KEY_SIGN: &'static str = szOID_RSA_RSA; +pub const CERT_DEFAULT_OID_PUBLIC_KEY_XCHG: &'static str = szOID_RSA_RSA; +STRUCT!{struct CRYPT_ECC_PRIVATE_KEY_INFO { + dwVersion: ::DWORD, + PrivateKey: CRYPT_DER_BLOB, + szCurveOid: ::LPSTR, + PublicKey: CRYPT_BIT_BLOB, +}} +pub type PCRYPT_ECC_PRIVATE_KEY_INFO = *mut CRYPT_ECC_PRIVATE_KEY_INFO; +pub const CRYPT_ECC_PRIVATE_KEY_INFO_v1: ::DWORD = 1; +STRUCT!{struct CRYPT_PRIVATE_KEY_INFO { + Version: ::DWORD, + Algorithm: CRYPT_ALGORITHM_IDENTIFIER, + PrivateKey: CRYPT_DER_BLOB, + pAttributes: PCRYPT_ATTRIBUTES, +}} +pub type PCRYPT_PRIVATE_KEY_INFO = *mut CRYPT_PRIVATE_KEY_INFO; +STRUCT!{struct CRYPT_ENCRYPTED_PRIVATE_KEY_INFO { + EncryptionAlgorithm: ::CRYPT_ALGORITHM_IDENTIFIER, + EncryptedPrivateKey: ::CRYPT_DATA_BLOB, +}} +pub type PCRYPT_ENCRYPTED_PRIVATE_KEY_INFO = *mut CRYPT_ENCRYPTED_PRIVATE_KEY_INFO; +pub type PCRYPT_DECRYPT_PRIVATE_KEY_FUNC = Option ::BOOL>; +pub type PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC = Option ::BOOL>; +pub type PCRYPT_RESOLVE_HCRYPTPROV_FUNC = Option ::BOOL>; +STRUCT!{nodebug struct CRYPT_PKCS8_IMPORT_PARAMS { + PrivateKey: CRYPT_DIGEST_BLOB, + pResolvehCryptProvFunc: PCRYPT_RESOLVE_HCRYPTPROV_FUNC, + pVoidResolveFunc: ::LPVOID, + pDecryptPrivateKeyFunc: PCRYPT_DECRYPT_PRIVATE_KEY_FUNC, + pVoidDecryptFunc: ::LPVOID, +}} +pub type PCRYPT_PKCS8_IMPORT_PARAMS = *mut CRYPT_PKCS8_IMPORT_PARAMS; +pub type CRYPT_PRIVATE_KEY_BLOB_AND_PARAMS = CRYPT_PKCS8_IMPORT_PARAMS; +pub type PPCRYPT_PRIVATE_KEY_BLOB_AND_PARAMS = *mut CRYPT_PKCS8_IMPORT_PARAMS; +STRUCT!{nodebug struct CRYPT_PKCS8_EXPORT_PARAMS { + hCryptProv: HCRYPTPROV, + dwKeySpec: ::DWORD, + pszPrivateKeyObjId: ::LPSTR, + pEncryptPrivateKeyFunc: PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC, + pVoidEncryptFunc: ::LPVOID, +}} +pub type PCRYPT_PKCS8_EXPORT_PARAMS = *mut CRYPT_PKCS8_EXPORT_PARAMS; +STRUCT!{struct CERT_INFO { + dwVersion: ::DWORD, + SerialNumber: CRYPT_INTEGER_BLOB, + SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Issuer: CERT_NAME_BLOB, + NotBefore: ::FILETIME, + NotAfter: ::FILETIME, + Subject: CERT_NAME_BLOB, + SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, + IssuerUniqueId: CRYPT_BIT_BLOB, + SubjectUniqueId: CRYPT_BIT_BLOB, + cExtension: ::DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCERT_INFO = *mut CERT_INFO; +pub const CERT_V1: ::DWORD = 0; +pub const CERT_V2: ::DWORD = 1; +pub const CERT_V3: ::DWORD = 2; +pub const CERT_INFO_VERSION_FLAG: ::DWORD = 1; +pub const CERT_INFO_SERIAL_NUMBER_FLAG: ::DWORD = 2; +pub const CERT_INFO_SIGNATURE_ALGORITHM_FLAG: ::DWORD = 3; +pub const CERT_INFO_ISSUER_FLAG: ::DWORD = 4; +pub const CERT_INFO_NOT_BEFORE_FLAG: ::DWORD = 5; +pub const CERT_INFO_NOT_AFTER_FLAG: ::DWORD = 6; +pub const CERT_INFO_SUBJECT_FLAG: ::DWORD = 7; +pub const CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG: ::DWORD = 8; +pub const CERT_INFO_ISSUER_UNIQUE_ID_FLAG: ::DWORD = 9; +pub const CERT_INFO_SUBJECT_UNIQUE_ID_FLAG: ::DWORD = 10; +pub const CERT_INFO_EXTENSION_FLAG: ::DWORD = 11; +STRUCT!{struct CRL_ENTRY { + SerialNumber: CRYPT_INTEGER_BLOB, + RevocationDate: ::FILETIME, + cExtension: ::DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRL_ENTRY = *mut CRL_ENTRY; +STRUCT!{struct CRL_INFO { + dwVersion: ::DWORD, + SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Issuer: CERT_NAME_BLOB, + ThisUpdate: ::FILETIME, + NextUpdate: ::FILETIME, + cCRLEntry: ::DWORD, + rgCRLEntry: PCRL_ENTRY, + cExtension: ::DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRL_INFO = *mut CRL_INFO; +pub const CRL_V1: ::DWORD = 0; +pub const CRL_V2: ::DWORD = 1; +pub const CERT_BUNDLE_CERTIFICATE: ::DWORD = 0; +pub const CERT_BUNDLE_CRL: ::DWORD = 1; +STRUCT!{struct CERT_OR_CRL_BLOB { + dwChoice: ::DWORD, + cbEncoded: ::DWORD, + pbEncoded: *mut ::BYTE, +}} +pub type PCERT_OR_CRL_BLOB = *mut CERT_OR_CRL_BLOB; +STRUCT!{struct CERT_OR_CRL_BUNDLE { + cItem: ::DWORD, + rgItem: PCERT_OR_CRL_BLOB, +}} +pub type PCERT_OR_CRL_BUNDLE = *mut CERT_OR_CRL_BUNDLE; +STRUCT!{struct CERT_REQUEST_INFO { + dwVersion: ::DWORD, + Subject: CERT_NAME_BLOB, + SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, + cAttribute: ::DWORD, + rgAttribute: PCRYPT_ATTRIBUTE, +}} +pub type PCERT_REQUEST_INFO = *mut CERT_REQUEST_INFO; +pub const CERT_REQUEST_V1: ::DWORD = 0; +STRUCT!{struct CERT_KEYGEN_REQUEST_INFO { + dwVersion: ::DWORD, + SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, + pwszChallengeString: ::LPWSTR, +}} +pub type PCERT_KEYGEN_REQUEST_INFO = *mut CERT_KEYGEN_REQUEST_INFO; +pub const CERT_KEYGEN_REQUEST_V1: ::DWORD = 0; +STRUCT!{struct CERT_SIGNED_CONTENT_INFO { + ToBeSigned: CRYPT_DER_BLOB, + SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Signature: CRYPT_BIT_BLOB, +}} +pub type PCERT_SIGNED_CONTENT_INFO = *mut CERT_SIGNED_CONTENT_INFO; +STRUCT!{struct CTL_USAGE { + cUsageIdentifier: ::DWORD, + rgpszUsageIdentifier: *mut ::LPSTR, +}} +pub type PCTL_USAGE = *mut CTL_USAGE; +pub type CERT_ENHKEY_USAGE = CTL_USAGE; +pub type PCERT_ENHKEY_USAGE = *mut CERT_ENHKEY_USAGE; +pub type PCCTL_USAGE = *const CTL_USAGE; +pub type PCCERT_ENHKEY_USAGE = *const CERT_ENHKEY_USAGE; +STRUCT!{struct CTL_ENTRY { + SubjectIdentifier: CRYPT_DATA_BLOB, + cAttribute: ::DWORD, + rgAttribute: PCRYPT_ATTRIBUTE, +}} +pub type PCTL_ENTRY = *mut CTL_ENTRY; +STRUCT!{struct CTL_INFO { + dwVersion: ::DWORD, + SubjectUsage: CTL_USAGE, + ListIdentifier: CRYPT_DATA_BLOB, + SequenceNumber: CRYPT_INTEGER_BLOB, + ThisUpdate: ::FILETIME, + NextUpdate: ::FILETIME, + SubjectAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + cCTLEntry: ::DWORD, + rgCTLEntry: PCTL_ENTRY, + cExtension: ::DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCTL_INFO = *mut CTL_INFO; +pub const CTL_V1: ::DWORD = 0; +STRUCT!{struct CRYPT_TIME_STAMP_REQUEST_INFO { + pszTimeStampAlgorithm: ::LPSTR, + pszContentType: ::LPSTR, + Content: CRYPT_OBJID_BLOB, + cAttribute: ::DWORD, + rgAttribute: PCRYPT_ATTRIBUTE, +}} +pub type PCRYPT_TIME_STAMP_REQUEST_INFO = *mut CRYPT_TIME_STAMP_REQUEST_INFO; +STRUCT!{struct CRYPT_ENROLLMENT_NAME_VALUE_PAIR { + pwszName: ::LPWSTR, + pwszValue: ::LPWSTR, +}} +pub type PCRYPT_ENROLLMENT_NAME_VALUE_PAIR = *mut CRYPT_ENROLLMENT_NAME_VALUE_PAIR; +STRUCT!{struct CRYPT_CSP_PROVIDER { + dwKeySpec: ::DWORD, + pwszProviderName: ::LPWSTR, + Signature: CRYPT_BIT_BLOB, +}} +pub type PCRYPT_CSP_PROVIDER = *mut CRYPT_CSP_PROVIDER; +pub const CERT_ENCODING_TYPE_MASK: ::DWORD = 0x0000FFFF; +pub const CMSG_ENCODING_TYPE_MASK: ::DWORD = 0xFFFF0000; +pub const CRYPT_ASN_ENCODING: ::DWORD = 0x00000001; +pub const CRYPT_NDR_ENCODING: ::DWORD = 0x00000002; +pub const X509_ASN_ENCODING: ::DWORD = 0x00000001; +pub const X509_NDR_ENCODING: ::DWORD = 0x00000002; +pub const PKCS_7_ASN_ENCODING: ::DWORD = 0x00010000; +pub const PKCS_7_NDR_ENCODING: ::DWORD = 0x00020000; +pub const CRYPT_FORMAT_STR_MULTI_LINE: ::DWORD = 0x0001; +pub const CRYPT_FORMAT_STR_NO_HEX: ::DWORD = 0x0010; +pub const CRYPT_FORMAT_SIMPLE: ::DWORD = 0x0001; +pub const CRYPT_FORMAT_X509: ::DWORD = 0x0002; +pub const CRYPT_FORMAT_OID: ::DWORD = 0x0004; +pub const CRYPT_FORMAT_RDN_SEMICOLON: ::DWORD = 0x0100; +pub const CRYPT_FORMAT_RDN_CRLF: ::DWORD = 0x0200; +pub const CRYPT_FORMAT_RDN_UNQUOTE: ::DWORD = 0x0400; +pub const CRYPT_FORMAT_RDN_REVERSE: ::DWORD = 0x0800; +pub const CRYPT_FORMAT_COMMA: ::DWORD = 0x1000; +pub const CRYPT_FORMAT_SEMICOLON: ::DWORD = CRYPT_FORMAT_RDN_SEMICOLON; +pub const CRYPT_FORMAT_CRLF: ::DWORD = CRYPT_FORMAT_RDN_CRLF; +pub type PFN_CRYPT_ALLOC = Option; +pub type PFN_CRYPT_FREE = Option; +STRUCT!{nodebug struct CRYPT_ENCODE_PARA { + cbSize: ::DWORD, + pfnAlloc: PFN_CRYPT_ALLOC, + pfnFree: PFN_CRYPT_FREE, +}} +pub type PCRYPT_ENCODE_PARA = *mut CRYPT_ENCODE_PARA; +pub const CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: ::DWORD = 0x8; +pub const CRYPT_ENCODE_ALLOC_FLAG: ::DWORD = 0x8000; +pub const CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG: ::DWORD = + CERT_RDN_ENABLE_T61_UNICODE_FLAG; +pub const CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG: ::DWORD = + CERT_RDN_ENABLE_UTF8_UNICODE_FLAG; +pub const CRYPT_UNICODE_NAME_ENCODE_FORCE_UTF8_UNICODE_FLAG: ::DWORD = + CERT_RDN_FORCE_UTF8_UNICODE_FLAG; +pub const CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG: ::DWORD = + CERT_RDN_DISABLE_CHECK_TYPE_FLAG; +pub const CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: ::DWORD = 0x10000; +pub const CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG: ::DWORD = 0x20000; +pub const CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG: ::DWORD = 0x40000; +pub const CRYPT_ENCODE_ENABLE_IA5CONVERSION_FLAG: ::DWORD = CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG + | CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG; +STRUCT!{nodebug struct CRYPT_DECODE_PARA { + cbSize: ::DWORD, + pfnAlloc: PFN_CRYPT_ALLOC, + pfnFree: PFN_CRYPT_FREE, +}} +pub type PCRYPT_DECODE_PARA = *mut CRYPT_DECODE_PARA; +pub const CRYPT_DECODE_NOCOPY_FLAG: ::DWORD = 0x1; +pub const CRYPT_DECODE_TO_BE_SIGNED_FLAG: ::DWORD = 0x2; +pub const CRYPT_DECODE_SHARE_OID_STRING_FLAG: ::DWORD = 0x4; +pub const CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: ::DWORD = 0x8; +pub const CRYPT_DECODE_ALLOC_FLAG: ::DWORD = 0x8000; +pub const CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG: ::DWORD = + CERT_RDN_DISABLE_IE4_UTF8_FLAG; +pub const CRYPT_DECODE_ENABLE_PUNYCODE_FLAG: ::DWORD = 0x02000000; +pub const CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG: ::DWORD = 0x04000000; +pub const CRYPT_DECODE_ENABLE_IA5CONVERSION_FLAG: ::DWORD = CRYPT_DECODE_ENABLE_PUNYCODE_FLAG + | CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG; +pub const CRYPT_ENCODE_DECODE_NONE: ::LPCSTR = 0 as ::LPCSTR; +pub const X509_CERT: ::LPCSTR = 1 as ::LPCSTR; +pub const X509_CERT_TO_BE_SIGNED: ::LPCSTR = 2 as ::LPCSTR; +pub const X509_CERT_CRL_TO_BE_SIGNED: ::LPCSTR = 3 as ::LPCSTR; +pub const X509_CERT_REQUEST_TO_BE_SIGNED: ::LPCSTR = 4 as ::LPCSTR; +pub const X509_EXTENSIONS: ::LPCSTR = 5 as ::LPCSTR; +pub const X509_NAME_VALUE: ::LPCSTR = 6 as ::LPCSTR; +pub const X509_NAME: ::LPCSTR = 7 as ::LPCSTR; +pub const X509_PUBLIC_KEY_INFO: ::LPCSTR = 8 as ::LPCSTR; +pub const X509_AUTHORITY_KEY_ID: ::LPCSTR = 9 as ::LPCSTR; +pub const X509_KEY_ATTRIBUTES: ::LPCSTR = 10 as ::LPCSTR; +pub const X509_KEY_USAGE_RESTRICTION: ::LPCSTR = 11 as ::LPCSTR; +pub const X509_ALTERNATE_NAME: ::LPCSTR = 12 as ::LPCSTR; +pub const X509_BASIC_CONSTRAINTS: ::LPCSTR = 13 as ::LPCSTR; +pub const X509_KEY_USAGE: ::LPCSTR = 14 as ::LPCSTR; +pub const X509_BASIC_CONSTRAINTS2: ::LPCSTR = 15 as ::LPCSTR; +pub const X509_CERT_POLICIES: ::LPCSTR = 16 as ::LPCSTR; +pub const PKCS_UTC_TIME: ::LPCSTR = 17 as ::LPCSTR; +pub const PKCS_TIME_REQUEST: ::LPCSTR = 18 as ::LPCSTR; +pub const RSA_CSP_PUBLICKEYBLOB: ::LPCSTR = 19 as ::LPCSTR; +pub const X509_UNICODE_NAME: ::LPCSTR = 20 as ::LPCSTR; +pub const X509_KEYGEN_REQUEST_TO_BE_SIGNED: ::LPCSTR = 21 as ::LPCSTR; +pub const PKCS_ATTRIBUTE: ::LPCSTR = 22 as ::LPCSTR; +pub const PKCS_CONTENT_INFO_SEQUENCE_OF_ANY: ::LPCSTR = 23 as ::LPCSTR; +pub const X509_UNICODE_NAME_VALUE: ::LPCSTR = 24 as ::LPCSTR; +pub const X509_ANY_STRING: ::LPCSTR = X509_NAME_VALUE; +pub const X509_UNICODE_ANY_STRING: ::LPCSTR = X509_UNICODE_NAME_VALUE; +pub const X509_OCTET_STRING: ::LPCSTR = 25 as ::LPCSTR; +pub const X509_BITS: ::LPCSTR = 26 as ::LPCSTR; +pub const X509_INTEGER: ::LPCSTR = 27 as ::LPCSTR; +pub const X509_MULTI_BYTE_INTEGER: ::LPCSTR = 28 as ::LPCSTR; +pub const X509_ENUMERATED: ::LPCSTR = 29 as ::LPCSTR; +pub const X509_CHOICE_OF_TIME: ::LPCSTR = 30 as ::LPCSTR; +pub const X509_AUTHORITY_KEY_ID2: ::LPCSTR = 31 as ::LPCSTR; +pub const X509_AUTHORITY_INFO_ACCESS: ::LPCSTR = 32 as ::LPCSTR; +pub const X509_SUBJECT_INFO_ACCESS: ::LPCSTR = X509_AUTHORITY_INFO_ACCESS; +pub const X509_CRL_REASON_CODE: ::LPCSTR = X509_ENUMERATED; +pub const PKCS_CONTENT_INFO: ::LPCSTR = 33 as ::LPCSTR; +pub const X509_SEQUENCE_OF_ANY: ::LPCSTR = 34 as ::LPCSTR; +pub const X509_CRL_DIST_POINTS: ::LPCSTR = 35 as ::LPCSTR; +pub const X509_ENHANCED_KEY_USAGE: ::LPCSTR = 36 as ::LPCSTR; +pub const PKCS_CTL: ::LPCSTR = 37 as ::LPCSTR; +pub const X509_MULTI_BYTE_UINT: ::LPCSTR = 38 as ::LPCSTR; +pub const X509_DSS_PUBLICKEY: ::LPCSTR = X509_MULTI_BYTE_UINT; +pub const X509_DSS_PARAMETERS: ::LPCSTR = 39 as ::LPCSTR; +pub const X509_DSS_SIGNATURE: ::LPCSTR = 40 as ::LPCSTR; +pub const PKCS_RC2_CBC_PARAMETERS: ::LPCSTR = 41 as ::LPCSTR; +pub const PKCS_SMIME_CAPABILITIES: ::LPCSTR = 42 as ::LPCSTR; +pub const X509_QC_STATEMENTS_EXT: ::LPCSTR = 42 as ::LPCSTR; +pub const PKCS_RSA_PRIVATE_KEY: ::LPCSTR = 43 as ::LPCSTR; +pub const PKCS_PRIVATE_KEY_INFO: ::LPCSTR = 44 as ::LPCSTR; +pub const PKCS_ENCRYPTED_PRIVATE_KEY_INFO: ::LPCSTR = 45 as ::LPCSTR; +pub const X509_PKIX_POLICY_QUALIFIER_USERNOTICE: ::LPCSTR = 46 as ::LPCSTR; +pub const X509_DH_PUBLICKEY: ::LPCSTR = X509_MULTI_BYTE_UINT; +pub const X509_DH_PARAMETERS: ::LPCSTR = 47 as ::LPCSTR; +pub const PKCS_ATTRIBUTES: ::LPCSTR = 48 as ::LPCSTR; +pub const PKCS_SORTED_CTL: ::LPCSTR = 49 as ::LPCSTR; +pub const X509_ECC_SIGNATURE: ::LPCSTR = 47 as ::LPCSTR; +pub const X942_DH_PARAMETERS: ::LPCSTR = 50 as ::LPCSTR; +pub const X509_BITS_WITHOUT_TRAILING_ZEROES: ::LPCSTR = 51 as ::LPCSTR; +pub const X942_OTHER_INFO: ::LPCSTR = 52 as ::LPCSTR; +pub const X509_CERT_PAIR: ::LPCSTR = 53 as ::LPCSTR; +pub const X509_ISSUING_DIST_POINT: ::LPCSTR = 54 as ::LPCSTR; +pub const X509_NAME_CONSTRAINTS: ::LPCSTR = 55 as ::LPCSTR; +pub const X509_POLICY_MAPPINGS: ::LPCSTR = 56 as ::LPCSTR; +pub const X509_POLICY_CONSTRAINTS: ::LPCSTR = 57 as ::LPCSTR; +pub const X509_CROSS_CERT_DIST_POINTS: ::LPCSTR = 58 as ::LPCSTR; +pub const CMC_DATA: ::LPCSTR = 59 as ::LPCSTR; +pub const CMC_RESPONSE: ::LPCSTR = 60 as ::LPCSTR; +pub const CMC_STATUS: ::LPCSTR = 61 as ::LPCSTR; +pub const CMC_ADD_EXTENSIONS: ::LPCSTR = 62 as ::LPCSTR; +pub const CMC_ADD_ATTRIBUTES: ::LPCSTR = 63 as ::LPCSTR; +pub const X509_CERTIFICATE_TEMPLATE: ::LPCSTR = 64 as ::LPCSTR; +pub const OCSP_SIGNED_REQUEST: ::LPCSTR = 65 as ::LPCSTR; +pub const OCSP_REQUEST: ::LPCSTR = 66 as ::LPCSTR; +pub const OCSP_RESPONSE: ::LPCSTR = 67 as ::LPCSTR; +pub const OCSP_BASIC_SIGNED_RESPONSE: ::LPCSTR = 68 as ::LPCSTR; +pub const OCSP_BASIC_RESPONSE: ::LPCSTR = 69 as ::LPCSTR; +pub const X509_LOGOTYPE_EXT: ::LPCSTR = 70 as ::LPCSTR; +pub const X509_BIOMETRIC_EXT: ::LPCSTR = 71 as ::LPCSTR; +pub const CNG_RSA_PUBLIC_KEY_BLOB: ::LPCSTR = 72 as ::LPCSTR; +pub const X509_OBJECT_IDENTIFIER: ::LPCSTR = 73 as ::LPCSTR; +pub const X509_ALGORITHM_IDENTIFIER: ::LPCSTR = 74 as ::LPCSTR; +pub const PKCS_RSA_SSA_PSS_PARAMETERS: ::LPCSTR = 75 as ::LPCSTR; +pub const PKCS_RSAES_OAEP_PARAMETERS: ::LPCSTR = 76 as ::LPCSTR; +pub const ECC_CMS_SHARED_INFO: ::LPCSTR = 77 as ::LPCSTR; +pub const TIMESTAMP_REQUEST: ::LPCSTR = 78 as ::LPCSTR; +pub const TIMESTAMP_RESPONSE: ::LPCSTR = 79 as ::LPCSTR; +pub const TIMESTAMP_INFO: ::LPCSTR = 80 as ::LPCSTR; +pub const X509_CERT_BUNDLE: ::LPCSTR = 81 as ::LPCSTR; +pub const X509_ECC_PRIVATE_KEY: ::LPCSTR = 82 as ::LPCSTR; +pub const CNG_RSA_PRIVATE_KEY_BLOB: ::LPCSTR = 83 as ::LPCSTR; +pub const X509_SUBJECT_DIR_ATTRS: ::LPCSTR = 84 as ::LPCSTR; +pub const PKCS7_SIGNER_INFO: ::LPCSTR = 500 as ::LPCSTR; +pub const CMS_SIGNER_INFO: ::LPCSTR = 501 as ::LPCSTR; +pub const szOID_AUTHORITY_KEY_IDENTIFIER: &'static str = "2.5.29.1"; +pub const szOID_KEY_ATTRIBUTES: &'static str = "2.5.29.2"; +pub const szOID_CERT_POLICIES_95: &'static str = "2.5.29.3"; +pub const szOID_KEY_USAGE_RESTRICTION: &'static str = "2.5.29.4"; +pub const szOID_SUBJECT_ALT_NAME: &'static str = "2.5.29.7"; +pub const szOID_ISSUER_ALT_NAME: &'static str = "2.5.29.8"; +pub const szOID_BASIC_CONSTRAINTS: &'static str = "2.5.29.10"; +pub const szOID_KEY_USAGE: &'static str = "2.5.29.15"; +pub const szOID_PRIVATEKEY_USAGE_PERIOD: &'static str = "2.5.29.16"; +pub const szOID_BASIC_CONSTRAINTS2: &'static str = "2.5.29.19"; +pub const szOID_CERT_POLICIES: &'static str = "2.5.29.32"; +pub const szOID_ANY_CERT_POLICY: &'static str = "2.5.29.32.0"; +pub const szOID_INHIBIT_ANY_POLICY: &'static str = "2.5.29.54"; +pub const szOID_AUTHORITY_KEY_IDENTIFIER2: &'static str = "2.5.29.35"; +pub const szOID_SUBJECT_KEY_IDENTIFIER: &'static str = "2.5.29.14"; +pub const szOID_SUBJECT_ALT_NAME2: &'static str = "2.5.29.17"; +pub const szOID_ISSUER_ALT_NAME2: &'static str = "2.5.29.18"; +pub const szOID_CRL_REASON_CODE: &'static str = "2.5.29.21"; +pub const szOID_REASON_CODE_HOLD: &'static str = "2.5.29.23"; +pub const szOID_CRL_DIST_POINTS: &'static str = "2.5.29.31"; +pub const szOID_ENHANCED_KEY_USAGE: &'static str = "2.5.29.37"; +pub const szOID_ANY_ENHANCED_KEY_USAGE: &'static str = "2.5.29.37.0"; +pub const szOID_CRL_NUMBER: &'static str = "2.5.29.20"; +pub const szOID_DELTA_CRL_INDICATOR: &'static str = "2.5.29.27"; +pub const szOID_ISSUING_DIST_POINT: &'static str = "2.5.29.28"; +pub const szOID_FRESHEST_CRL: &'static str = "2.5.29.46"; +pub const szOID_NAME_CONSTRAINTS: &'static str = "2.5.29.30"; +pub const szOID_POLICY_MAPPINGS: &'static str = "2.5.29.33"; +pub const szOID_LEGACY_POLICY_MAPPINGS: &'static str = "2.5.29.5"; +pub const szOID_POLICY_CONSTRAINTS: &'static str = "2.5.29.36"; +pub const szOID_RENEWAL_CERTIFICATE: &'static str = "1.3.6.1.4.1.311.13.1"; +pub const szOID_ENROLLMENT_NAME_VALUE_PAIR: &'static str = "1.3.6.1.4.1.311.13.2.1"; +pub const szOID_ENROLLMENT_CSP_PROVIDER: &'static str = "1.3.6.1.4.1.311.13.2.2"; +pub const szOID_OS_VERSION: &'static str = "1.3.6.1.4.1.311.13.2.3"; +pub const szOID_ENROLLMENT_AGENT: &'static str = "1.3.6.1.4.1.311.20.2.1"; +pub const szOID_PKIX: &'static str = "1.3.6.1.5.5.7"; +pub const szOID_PKIX_PE: &'static str = "1.3.6.1.5.5.7.1"; +pub const szOID_AUTHORITY_INFO_ACCESS: &'static str = "1.3.6.1.5.5.7.1.1"; +pub const szOID_SUBJECT_INFO_ACCESS: &'static str = "1.3.6.1.5.5.7.1.11"; +pub const szOID_BIOMETRIC_EXT: &'static str = "1.3.6.1.5.5.7.1.2"; +pub const szOID_QC_STATEMENTS_EXT: &'static str = "1.3.6.1.5.5.7.1.3"; +pub const szOID_LOGOTYPE_EXT: &'static str = "1.3.6.1.5.5.7.1.12"; +pub const szOID_CERT_EXTENSIONS: &'static str = "1.3.6.1.4.1.311.2.1.14"; +pub const szOID_NEXT_UPDATE_LOCATION: &'static str = "1.3.6.1.4.1.311.10.2"; +pub const szOID_REMOVE_CERTIFICATE: &'static str = "1.3.6.1.4.1.311.10.8.1"; +pub const szOID_CROSS_CERT_DIST_POINTS: &'static str = "1.3.6.1.4.1.311.10.9.1"; +pub const szOID_CTL: &'static str = "1.3.6.1.4.1.311.10.1"; +pub const szOID_SORTED_CTL: &'static str = "1.3.6.1.4.1.311.10.1.1"; +pub const szOID_SERIALIZED: &'static str = "1.3.6.1.4.1.311.10.3.3.1"; +pub const szOID_NT_PRINCIPAL_NAME: &'static str = "1.3.6.1.4.1.311.20.2.3"; +pub const szOID_INTERNATIONALIZED_EMAIL_ADDRESS: &'static str = "1.3.6.1.4.1.311.20.2.4"; +pub const szOID_PRODUCT_UPDATE: &'static str = "1.3.6.1.4.1.311.31.1"; +pub const szOID_ANY_APPLICATION_POLICY: &'static str = "1.3.6.1.4.1.311.10.12.1"; +pub const szOID_AUTO_ENROLL_CTL_USAGE: &'static str = "1.3.6.1.4.1.311.20.1"; +pub const szOID_ENROLL_CERTTYPE_EXTENSION: &'static str = "1.3.6.1.4.1.311.20.2"; +pub const szOID_CERT_MANIFOLD: &'static str = "1.3.6.1.4.1.311.20.3"; +pub const szOID_CERTSRV_CA_VERSION: &'static str = "1.3.6.1.4.1.311.21.1"; +pub const szOID_CERTSRV_PREVIOUS_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.2"; +pub const szOID_CRL_VIRTUAL_BASE: &'static str = "1.3.6.1.4.1.311.21.3"; +pub const szOID_CRL_NEXT_PUBLISH: &'static str = "1.3.6.1.4.1.311.21.4"; +pub const szOID_KP_CA_EXCHANGE: &'static str = "1.3.6.1.4.1.311.21.5"; +pub const szOID_KP_KEY_RECOVERY_AGENT: &'static str = "1.3.6.1.4.1.311.21.6"; +pub const szOID_CERTIFICATE_TEMPLATE: &'static str = "1.3.6.1.4.1.311.21.7"; +pub const szOID_ENTERPRISE_OID_ROOT: &'static str = "1.3.6.1.4.1.311.21.8"; +pub const szOID_RDN_DUMMY_SIGNER: &'static str = "1.3.6.1.4.1.311.21.9"; +pub const szOID_APPLICATION_CERT_POLICIES: &'static str = "1.3.6.1.4.1.311.21.10"; +pub const szOID_APPLICATION_POLICY_MAPPINGS: &'static str = "1.3.6.1.4.1.311.21.11"; +pub const szOID_APPLICATION_POLICY_CONSTRAINTS: &'static str = "1.3.6.1.4.1.311.21.12"; +pub const szOID_ARCHIVED_KEY_ATTR: &'static str = "1.3.6.1.4.1.311.21.13"; +pub const szOID_CRL_SELF_CDP: &'static str = "1.3.6.1.4.1.311.21.14"; +pub const szOID_REQUIRE_CERT_CHAIN_POLICY: &'static str = "1.3.6.1.4.1.311.21.15"; +pub const szOID_ARCHIVED_KEY_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.16"; +pub const szOID_ISSUED_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.17"; +pub const szOID_DS_EMAIL_REPLICATION: &'static str = "1.3.6.1.4.1.311.21.19"; +pub const szOID_REQUEST_CLIENT_INFO: &'static str = "1.3.6.1.4.1.311.21.20"; +pub const szOID_ENCRYPTED_KEY_HASH: &'static str = "1.3.6.1.4.1.311.21.21"; +pub const szOID_CERTSRV_CROSSCA_VERSION: &'static str = "1.3.6.1.4.1.311.21.22"; +pub const szOID_NTDS_REPLICATION: &'static str = "1.3.6.1.4.1.311.25.1"; +pub const szOID_SUBJECT_DIR_ATTRS: &'static str = "2.5.29.9"; +pub const szOID_PKIX_KP: &'static str = "1.3.6.1.5.5.7.3"; +pub const szOID_PKIX_KP_SERVER_AUTH: &'static str = "1.3.6.1.5.5.7.3.1"; +pub const szOID_PKIX_KP_CLIENT_AUTH: &'static str = "1.3.6.1.5.5.7.3.2"; +pub const szOID_PKIX_KP_CODE_SIGNING: &'static str = "1.3.6.1.5.5.7.3.3"; +pub const szOID_PKIX_KP_EMAIL_PROTECTION: &'static str = "1.3.6.1.5.5.7.3.4"; +pub const szOID_PKIX_KP_IPSEC_END_SYSTEM: &'static str = "1.3.6.1.5.5.7.3.5"; +pub const szOID_PKIX_KP_IPSEC_TUNNEL: &'static str = "1.3.6.1.5.5.7.3.6"; +pub const szOID_PKIX_KP_IPSEC_USER: &'static str = "1.3.6.1.5.5.7.3.7"; +pub const szOID_PKIX_KP_TIMESTAMP_SIGNING: &'static str = "1.3.6.1.5.5.7.3.8"; +pub const szOID_PKIX_KP_OCSP_SIGNING: &'static str = "1.3.6.1.5.5.7.3.9"; +pub const szOID_PKIX_OCSP_NOCHECK: &'static str = "1.3.6.1.5.5.7.48.1.5"; +pub const szOID_PKIX_OCSP_NONCE: &'static str = "1.3.6.1.5.5.7.48.1.2"; +pub const szOID_IPSEC_KP_IKE_INTERMEDIATE: &'static str = "1.3.6.1.5.5.8.2.2"; +pub const szOID_PKINIT_KP_KDC: &'static str = "1.3.6.1.5.2.3.5"; +pub const szOID_KP_CTL_USAGE_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.1"; +pub const szOID_KP_TIME_STAMP_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.2"; +pub const szOID_SERVER_GATED_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.3"; +pub const szOID_SGC_NETSCAPE: &'static str = "2.16.840.1.113730.4.1"; +pub const szOID_KP_EFS: &'static str = "1.3.6.1.4.1.311.10.3.4"; +pub const szOID_EFS_RECOVERY: &'static str = "1.3.6.1.4.1.311.10.3.4.1"; +pub const szOID_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.5"; +pub const szOID_NT5_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.6"; +pub const szOID_OEM_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.7"; +pub const szOID_EMBEDDED_NT_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.8"; +pub const szOID_ROOT_LIST_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.9"; +pub const szOID_KP_QUALIFIED_SUBORDINATION: &'static str = "1.3.6.1.4.1.311.10.3.10"; +pub const szOID_KP_KEY_RECOVERY: &'static str = "1.3.6.1.4.1.311.10.3.11"; +pub const szOID_KP_DOCUMENT_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.12"; +pub const szOID_KP_LIFETIME_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.13"; +pub const szOID_KP_MOBILE_DEVICE_SOFTWARE: &'static str = "1.3.6.1.4.1.311.10.3.14"; +pub const szOID_KP_SMART_DISPLAY: &'static str = "1.3.6.1.4.1.311.10.3.15"; +pub const szOID_KP_CSP_SIGNATURE: &'static str = "1.3.6.1.4.1.311.10.3.16"; +pub const szOID_DRM: &'static str = "1.3.6.1.4.1.311.10.5.1"; +pub const szOID_DRM_INDIVIDUALIZATION: &'static str = "1.3.6.1.4.1.311.10.5.2"; +pub const szOID_LICENSES: &'static str = "1.3.6.1.4.1.311.10.6.1"; +pub const szOID_LICENSE_SERVER: &'static str = "1.3.6.1.4.1.311.10.6.2"; +pub const szOID_KP_SMARTCARD_LOGON: &'static str = "1.3.6.1.4.1.311.20.2.2"; +pub const szOID_KP_KERNEL_MODE_CODE_SIGNING: &'static str = "1.3.6.1.4.1.311.61.1.1"; +pub const szOID_KP_KERNEL_MODE_TRUSTED_BOOT_SIGNING: &'static str = "1.3.6.1.4.1.311.61.4.1"; +pub const szOID_REVOKED_LIST_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.19"; +pub const szOID_WINDOWS_KITS_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.20"; +pub const szOID_WINDOWS_RT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.21"; +pub const szOID_PROTECTED_PROCESS_LIGHT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.22"; +pub const szOID_WINDOWS_TCB_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.23"; +pub const szOID_PROTECTED_PROCESS_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.24"; +pub const szOID_WINDOWS_THIRD_PARTY_COMPONENT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.25"; +pub const szOID_WINDOWS_SOFTWARE_EXTENSION_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.26"; +pub const szOID_DISALLOWED_LIST: &'static str = "1.3.6.1.4.1.311.10.3.30"; +pub const szOID_SYNC_ROOT_CTL_EXT: &'static str = "1.3.6.1.4.1.311.10.3.50"; +pub const szOID_KP_KERNEL_MODE_HAL_EXTENSION_SIGNING: &'static str = "1.3.6.1.4.1.311.61.5.1"; +pub const szOID_WINDOWS_STORE_SIGNER: &'static str = "1.3.6.1.4.1.311.76.3.1"; +pub const szOID_DYNAMIC_CODE_GEN_SIGNER: &'static str = "1.3.6.1.4.1.311.76.5.1"; +pub const szOID_MICROSOFT_PUBLISHER_SIGNER: &'static str = "1.3.6.1.4.1.311.76.8.1"; +pub const szOID_YESNO_TRUST_ATTR: &'static str = "1.3.6.1.4.1.311.10.4.1"; +pub const szOID_PKIX_POLICY_QUALIFIER_CPS: &'static str = "1.3.6.1.5.5.7.2.1"; +pub const szOID_PKIX_POLICY_QUALIFIER_USERNOTICE: &'static str = "1.3.6.1.5.5.7.2.2"; +pub const szOID_ROOT_PROGRAM_FLAGS: &'static str = "1.3.6.1.4.1.311.60.1.1"; +//6992 +pub type HCRYPTMSG = *mut ::c_void; +//9353 +pub type HCERTSTORE = *mut ::c_void; +STRUCT!{struct CERT_CONTEXT { + dwCertEncodingType: ::DWORD, + pbCertEncoded: *mut ::BYTE, + cbCertEncoded: ::DWORD, + pCertInfo: ::PCERT_INFO, + hCertStore: HCERTSTORE, +}} +pub type PCERT_CONTEXT = *mut CERT_CONTEXT; +pub type PCCERT_CONTEXT = *const CERT_CONTEXT; +STRUCT!{struct CRL_CONTEXT { + dwCertEncodingType: ::DWORD, + pbCrlEncoded: *mut ::BYTE, + cbCrlEncoded: ::DWORD, + pCrlInfo: ::PCRL_INFO, + hCertStore: HCERTSTORE, +}} +pub type PCRL_CONTEXT = *mut CRL_CONTEXT; +pub type PCCRL_CONTEXT = *const CRL_CONTEXT; +STRUCT!{struct CTL_CONTEXT { + dwMsgAndCertEncodingType: ::DWORD, + pbCtlEncoded: *mut ::BYTE, + cbCtlEncoded: ::DWORD, + pCtlInfo: ::PCTL_INFO, + hCertStore: HCERTSTORE, + hCryptMsg: HCRYPTMSG, + pbCtlContent: *mut ::BYTE, + cbCtlContent: ::DWORD, +}} +pub type PCTL_CONTEXT = *mut CTL_CONTEXT; +pub type PCCTL_CONTEXT = *const CTL_CONTEXT; +pub const CERT_STORE_PROV_MSG: ::DWORD = 1; +pub const CERT_STORE_PROV_MEMORY: ::DWORD = 2; +pub const CERT_STORE_PROV_FILE: ::DWORD = 3; +pub const CERT_STORE_PROV_REG: ::DWORD = 4; +pub const CERT_STORE_PROV_PKCS7: ::DWORD = 5; +pub const CERT_STORE_PROV_SERIALIZED: ::DWORD = 6; +pub const CERT_STORE_PROV_FILENAME_A: ::DWORD = 7; +pub const CERT_STORE_PROV_FILENAME_W: ::DWORD = 8; +pub const CERT_STORE_PROV_FILENAME: ::DWORD = CERT_STORE_PROV_FILENAME_W; +pub const CERT_STORE_PROV_SYSTEM_A: ::DWORD = 9; +pub const CERT_STORE_PROV_SYSTEM_W: ::DWORD = 10; +pub const CERT_STORE_PROV_SYSTEM: ::DWORD = CERT_STORE_PROV_SYSTEM_W; +pub const CERT_STORE_PROV_COLLECTION: ::DWORD = 11; +pub const CERT_STORE_PROV_SYSTEM_REGISTRY_A: ::DWORD = 12; +pub const CERT_STORE_PROV_SYSTEM_REGISTRY_W: ::DWORD = 13; +pub const CERT_STORE_PROV_SYSTEM_REGISTRY: ::DWORD = CERT_STORE_PROV_SYSTEM_REGISTRY_W; +pub const CERT_STORE_PROV_PHYSICAL_W: ::DWORD = 14; +pub const CERT_STORE_PROV_PHYSICAL: ::DWORD = CERT_STORE_PROV_PHYSICAL_W; +pub const CERT_STORE_PROV_SMART_CARD_W: ::DWORD = 15; +pub const CERT_STORE_PROV_SMART_CARD: ::DWORD = CERT_STORE_PROV_SMART_CARD_W; +pub const CERT_STORE_PROV_LDAP_W: ::DWORD = 16; +pub const CERT_STORE_PROV_LDAP: ::DWORD = CERT_STORE_PROV_LDAP_W; +pub const CERT_STORE_NO_CRYPT_RELEASE_FLAG: ::DWORD = 0x00000001; +pub const CERT_STORE_SET_LOCALIZED_NAME_FLAG: ::DWORD = 0x00000002; +pub const CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG: ::DWORD = 0x00000004; +pub const CERT_STORE_DELETE_FLAG: ::DWORD = 0x00000010; +pub const CERT_STORE_SHARE_STORE_FLAG: ::DWORD = 0x00000040; +pub const CERT_STORE_SHARE_CONTEXT_FLAG: ::DWORD = 0x00000080; +pub const CERT_STORE_MANIFOLD_FLAG: ::DWORD = 0x00000100; +pub const CERT_STORE_ENUM_ARCHIVED_FLAG: ::DWORD = 0x00000200; +pub const CERT_STORE_UPDATE_KEYID_FLAG: ::DWORD = 0x00000400; +pub const CERT_STORE_BACKUP_RESTORE_FLAG: ::DWORD = 0x00000800; +pub const CERT_STORE_READONLY_FLAG: ::DWORD = 0x00008000; +pub const CERT_STORE_OPEN_EXISTING_FLAG: ::DWORD = 0x00004000; +pub const CERT_STORE_CREATE_NEW_FLAG: ::DWORD = 0x00002000; +pub const CERT_STORE_MAXIMUM_ALLOWED_FLAG: ::DWORD = 0x00001000; +pub const CERT_SYSTEM_STORE_UNPROTECTED_FLAG: ::DWORD = 0x40000000; +pub const CERT_SYSTEM_STORE_LOCATION_MASK: ::DWORD = 0x00FF0000; +pub const CERT_SYSTEM_STORE_LOCATION_SHIFT: ::DWORD = 16; +pub const CERT_SYSTEM_STORE_CURRENT_USER_ID: ::DWORD = 1; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ID: ::DWORD = 2; +pub const CERT_SYSTEM_STORE_CURRENT_SERVICE_ID: ::DWORD = 4; +pub const CERT_SYSTEM_STORE_SERVICES_ID: ::DWORD = 5; +pub const CERT_SYSTEM_STORE_USERS_ID: ::DWORD = 6; +pub const CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID: ::DWORD = 7; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID: ::DWORD = 8; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID: ::DWORD = 9; +pub const CERT_SYSTEM_STORE_CURRENT_USER: ::DWORD = CERT_SYSTEM_STORE_CURRENT_USER_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE: ::DWORD = CERT_SYSTEM_STORE_LOCAL_MACHINE_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_CURRENT_SERVICE: ::DWORD = CERT_SYSTEM_STORE_CURRENT_SERVICE_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_SERVICES: ::DWORD = CERT_SYSTEM_STORE_SERVICES_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_USERS: ::DWORD = CERT_SYSTEM_STORE_USERS_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY: ::DWORD = + CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY: ::DWORD = + CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE: ::DWORD = + CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_NAME_EMAIL_TYPE: ::DWORD = 1; +pub const CERT_NAME_RDN_TYPE: ::DWORD = 2; +pub const CERT_NAME_ATTR_TYPE: ::DWORD = 3; +pub const CERT_NAME_SIMPLE_DISPLAY_TYPE: ::DWORD = 4; +pub const CERT_NAME_FRIENDLY_DISPLAY_TYPE: ::DWORD = 5; +pub const CERT_NAME_DNS_TYPE: ::DWORD = 6; +pub const CERT_NAME_URL_TYPE: ::DWORD = 7; +pub const CERT_NAME_UPN_TYPE: ::DWORD = 8; +pub const CERT_SIMPLE_NAME_STR: ::DWORD = 1; +pub const CERT_OID_NAME_STR: ::DWORD = 2; +pub const CERT_X500_NAME_STR: ::DWORD = 3; + +pub const CERT_NAME_STR_SEMICOLON_FLAG: ::DWORD = 0x40000000; +pub const CERT_NAME_STR_NO_PLUS_FLAG: ::DWORD = 0x20000000; +pub const CERT_NAME_STR_NO_QUOTING_FLAG: ::DWORD = 0x10000000; +pub const CERT_NAME_STR_CRLF_FLAG: ::DWORD = 0x08000000; +pub const CERT_NAME_STR_COMMA_FLAG: ::DWORD = 0x04000000; +pub const CERT_NAME_STR_REVERSE_FLAG: ::DWORD = 0x02000000; + +pub const CERT_NAME_ISSUER_FLAG: ::DWORD = 0x1; +pub const CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG: ::DWORD = 0x00010000; +pub const CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG: ::DWORD = 0x00020000; +pub const CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG: ::DWORD = 0x00040000; +pub const CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG: ::DWORD = 0x00080000; +pub const CERT_DELETE_KEYSET_PROP_ID: ::DWORD = 101; +pub const CERT_COMPARE_MASK: ::DWORD = 0xFFFF; +pub const CERT_COMPARE_SHIFT: ::DWORD = 16; +pub const CERT_COMPARE_ANY: ::DWORD = 0; +pub const CERT_COMPARE_SHA1_HASH: ::DWORD = 1; +pub const CERT_COMPARE_NAME: ::DWORD = 2; +pub const CERT_COMPARE_ATTR: ::DWORD = 3; +pub const CERT_COMPARE_MD5_HASH: ::DWORD = 4; +pub const CERT_COMPARE_PROPERTY: ::DWORD = 5; +pub const CERT_COMPARE_PUBLIC_KEY: ::DWORD = 6; +pub const CERT_COMPARE_HASH: ::DWORD = CERT_COMPARE_SHA1_HASH; +pub const CERT_COMPARE_NAME_STR_A: ::DWORD = 7; +pub const CERT_COMPARE_NAME_STR_W: ::DWORD = 8; +pub const CERT_COMPARE_KEY_SPEC: ::DWORD = 9; +pub const CERT_COMPARE_ENHKEY_USAGE: ::DWORD = 10; +pub const CERT_COMPARE_CTL_USAGE: ::DWORD = CERT_COMPARE_ENHKEY_USAGE; +pub const CERT_COMPARE_SUBJECT_CERT: ::DWORD = 11; +pub const CERT_COMPARE_ISSUER_OF: ::DWORD = 12; +pub const CERT_COMPARE_EXISTING: ::DWORD = 13; +pub const CERT_COMPARE_SIGNATURE_HASH: ::DWORD = 14; +pub const CERT_COMPARE_KEY_IDENTIFIER: ::DWORD = 15; +pub const CERT_COMPARE_CERT_ID: ::DWORD = 16; +pub const CERT_COMPARE_CROSS_CERT_DIST_POINTS: ::DWORD = 17; +pub const CERT_COMPARE_PUBKEY_MD5_HASH: ::DWORD = 18; +pub const CERT_FIND_ANY: ::DWORD = CERT_COMPARE_ANY << CERT_COMPARE_SHIFT; +pub const CERT_FIND_SHA1_HASH: ::DWORD = CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT; +pub const CERT_FIND_MD5_HASH: ::DWORD = CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT; +pub const CERT_FIND_SIGNATURE_HASH: ::DWORD = CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT; +pub const CERT_FIND_KEY_IDENTIFIER: ::DWORD = CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT; +pub const CERT_FIND_HASH: ::DWORD = CERT_FIND_SHA1_HASH; +pub const CERT_FIND_PROPERTY: ::DWORD = CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT; +pub const CERT_FIND_PUBLIC_KEY: ::DWORD = CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT; +pub const CERT_FIND_SUBJECT_NAME: ::DWORD = (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_SUBJECT_ATTR: ::DWORD = (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_ISSUER_NAME: ::DWORD = (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_ISSUER_ATTR: ::DWORD = (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_SUBJECT_STR_A: ::DWORD = (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_SUBJECT_STR_W: ::DWORD = (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_SUBJECT_STR: ::DWORD = CERT_FIND_SUBJECT_STR_W; +pub const CERT_FIND_ISSUER_STR_A: ::DWORD = (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_ISSUER_STR_W: ::DWORD = (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_ISSUER_STR: ::DWORD = CERT_FIND_ISSUER_STR_W; +pub const CERT_FIND_KEY_SPEC: ::DWORD = CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT; +pub const CERT_FIND_ENHKEY_USAGE: ::DWORD = CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT; +pub const CERT_FIND_CTL_USAGE: ::DWORD = CERT_FIND_ENHKEY_USAGE; +pub const CERT_FIND_SUBJECT_CERT: ::DWORD = CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT; +pub const CERT_FIND_ISSUER_OF: ::DWORD = CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT; +pub const CERT_FIND_EXISTING: ::DWORD = CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT; +pub const CERT_FIND_CERT_ID: ::DWORD = CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT; +pub const CERT_FIND_CROSS_CERT_DIST_POINTS: ::DWORD = CERT_COMPARE_CROSS_CERT_DIST_POINTS + << CERT_COMPARE_SHIFT; +pub const CERT_FIND_PUBKEY_MD5_HASH: ::DWORD = CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT; +pub const CERT_ENCIPHER_ONLY_KEY_USAGE: ::DWORD = 0x0001; +pub const CERT_CRL_SIGN_KEY_USAGE: ::DWORD = 0x0002; +pub const CERT_KEY_CERT_SIGN_KEY_USAGE: ::DWORD = 0x0004; +pub const CERT_KEY_AGREEMENT_KEY_USAGE: ::DWORD = 0x0008; +pub const CERT_DATA_ENCIPHERMENT_KEY_USAGE: ::DWORD = 0x0010; +pub const CERT_KEY_ENCIPHERMENT_KEY_USAGE: ::DWORD = 0x0020; +pub const CERT_NON_REPUDIATION_KEY_USAGE: ::DWORD = 0x0040; +pub const CERT_DIGITAL_SIGNATURE_KEY_USAGE: ::DWORD = 0x0080; +pub const CERT_DECIPHER_ONLY_KEY_USAGE: ::DWORD = 0x8000; +pub const CERT_STORE_ADD_NEW: ::DWORD = 1; +pub const CERT_STORE_ADD_USE_EXISTING: ::DWORD = 2; +pub const CERT_STORE_ADD_REPLACE_EXISTING: ::DWORD = 3; +pub const CERT_STORE_ADD_ALWAYS: ::DWORD = 4; +pub const CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: ::DWORD = 5; +pub const CERT_STORE_ADD_NEWER: ::DWORD = 6; +pub const CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: ::DWORD = 7; +pub const CERT_STORE_SAVE_AS_STORE: ::DWORD = 1; +pub const CERT_STORE_SAVE_AS_PKCS7: ::DWORD = 2; +pub const CERT_STORE_SAVE_TO_FILE: ::DWORD = 1; +pub const CERT_STORE_SAVE_TO_MEMORY: ::DWORD = 2; +pub const CERT_STORE_SAVE_TO_FILENAME_A: ::DWORD = 3; +pub const CERT_STORE_SAVE_TO_FILENAME_W: ::DWORD = 4; +pub const CERT_STORE_SAVE_TO_FILENAME: ::DWORD = CERT_STORE_SAVE_TO_FILENAME_W; +pub const CERT_CA_SUBJECT_FLAG: ::DWORD = 0x80; +pub const CERT_END_ENTITY_SUBJECT_FLAG: ::DWORD = 0x40; +pub const CERT_CHAIN_POLICY_BASE: ::DWORD = 1; +pub const CERT_CHAIN_POLICY_AUTHENTICODE: ::DWORD = 2; +pub const CERT_CHAIN_POLICY_AUTHENTICODE_TS: ::DWORD = 3; +pub const CERT_CHAIN_POLICY_SSL: ::DWORD = 4; +pub const CERT_CHAIN_POLICY_BASIC_CONSTRAINTS: ::DWORD = 5; +pub const CERT_CHAIN_POLICY_NT_AUTH: ::DWORD = 6; +pub const CERT_CHAIN_POLICY_MICROSOFT_ROOT: ::DWORD = 7; +pub const CERT_CHAIN_REVOCATION_CHECK_END_CERT: ::DWORD = 0x10000000; +pub const CERT_CHAIN_REVOCATION_CHECK_CHAIN: ::DWORD = 0x20000000; +pub const CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT: ::DWORD = 0x40000000; +pub const CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY: ::DWORD = 0x80000000; +pub const CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT: ::DWORD = 0x08000000; +pub const CERT_TRUST_NO_ERROR: ::DWORD = 0x00000000; +pub const CERT_TRUST_IS_NOT_TIME_VALID: ::DWORD = 0x00000001; +pub const CERT_TRUST_IS_NOT_TIME_NESTED: ::DWORD = 0x00000002; +pub const CERT_TRUST_IS_REVOKED: ::DWORD = 0x00000004; +pub const CERT_TRUST_IS_NOT_SIGNATURE_VALID: ::DWORD = 0x00000008; +pub const CERT_TRUST_IS_NOT_VALID_FOR_USAGE: ::DWORD = 0x00000010; +pub const CERT_TRUST_IS_UNTRUSTED_ROOT: ::DWORD = 0x00000020; +pub const CERT_TRUST_REVOCATION_STATUS_UNKNOWN: ::DWORD = 0x00000040; +pub const CERT_TRUST_IS_CYCLIC: ::DWORD = 0x00000080; + +pub const CERT_TRUST_INVALID_EXTENSION: ::DWORD = 0x00000100; +pub const CERT_TRUST_INVALID_POLICY_CONSTRAINTS: ::DWORD = 0x00000200; +pub const CERT_TRUST_INVALID_BASIC_CONSTRAINTS: ::DWORD = 0x00000400; +pub const CERT_TRUST_INVALID_NAME_CONSTRAINTS: ::DWORD = 0x00000800; +pub const CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT: ::DWORD = 0x00001000; +pub const CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT: ::DWORD = 0x00002000; +pub const CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT: ::DWORD = 0x00004000; +pub const CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT: ::DWORD = 0x00008000; + +pub const CERT_TRUST_IS_OFFLINE_REVOCATION: ::DWORD = 0x01000000; +pub const CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY: ::DWORD = 0x02000000; +pub const CERT_TRUST_IS_PARTIAL_CHAIN: ::DWORD = 0x00010000; +pub const CERT_TRUST_CTL_IS_NOT_TIME_VALID: ::DWORD = 0x00020000; +pub const CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID: ::DWORD = 0x00040000; +pub const CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE: ::DWORD = 0x00080000; +pub const CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG: ::DWORD = 0x00000001; +pub const CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG: ::DWORD = 0x00000002; +pub const CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG: ::DWORD = 0x00000004; +pub const CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG: ::DWORD = 0x00000008; + +pub const CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG: ::DWORD = 0x00000010; +pub const CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG: ::DWORD = 0x00000020; +pub const CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG: ::DWORD = 0x00000040; +pub const CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG: ::DWORD = 0x00000080; + +pub const CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG: ::DWORD = 0x00000100; +pub const CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG: ::DWORD = 0x00000200; +pub const CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG: ::DWORD = 0x00000400; +pub const CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG: ::DWORD = 0x00000800; + +pub const CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS: ::DWORD = + CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG | + CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG | + CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG | + CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG; +pub const CERT_TRUST_HAS_EXACT_MATCH_ISSUER: ::DWORD = 0x00000001; +pub const CERT_TRUST_HAS_KEY_MATCH_ISSUER: ::DWORD = 0x00000002; +pub const CERT_TRUST_HAS_NAME_MATCH_ISSUER: ::DWORD = 0x00000004; +pub const CERT_TRUST_IS_SELF_SIGNED: ::DWORD = 0x00000008; +pub const CERT_TRUST_HAS_PREFERRED_ISSUER: ::DWORD = 0x00000100; +pub const CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY: ::DWORD = 0x00000200; +pub const CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS: ::DWORD = 0x00000400; +pub const CERT_TRUST_IS_COMPLEX_CHAIN: ::DWORD = 0x00010000; +pub const CERT_ALT_NAME_OTHER_NAME: ::DWORD = 1; +pub const CERT_ALT_NAME_RFC822_NAME: ::DWORD = 2; +pub const CERT_ALT_NAME_DNS_NAME: ::DWORD = 3; +pub const CERT_ALT_NAME_X400_ADDRESS: ::DWORD = 4; +pub const CERT_ALT_NAME_DIRECTORY_NAME: ::DWORD = 5; +pub const CERT_ALT_NAME_EDI_PARTY_NAME: ::DWORD = 6; +pub const CERT_ALT_NAME_URL: ::DWORD = 7; +pub const CERT_ALT_NAME_IP_ADDRESS: ::DWORD = 8; +pub const CERT_ALT_NAME_REGISTERED_ID: ::DWORD = 9; +pub const CERT_STORE_CTRL_RESYNC: ::DWORD = 1; +pub const CERT_STORE_CTRL_NOTIFY_CHANGE: ::DWORD = 2; +pub const CERT_STORE_CTRL_COMMIT: ::DWORD = 3; +pub const CERT_STORE_CTRL_AUTO_RESYNC: ::DWORD = 4; +pub const CERT_STORE_CTRL_CANCEL_NOTIFY: ::DWORD = 5; +pub const CERT_ID_ISSUER_SERIAL_NUMBER: ::DWORD = 1; +pub const CERT_ID_KEY_IDENTIFIER: ::DWORD = 2; +pub const CERT_ID_SHA1_HASH: ::DWORD = 3; +pub const CERT_KEY_PROV_HANDLE_PROP_ID: ::DWORD = 1; +pub const CERT_KEY_PROV_INFO_PROP_ID: ::DWORD = 2; +pub const CERT_SHA1_HASH_PROP_ID: ::DWORD = 3; +pub const CERT_MD5_HASH_PROP_ID: ::DWORD = 4; +pub const CERT_HASH_PROP_ID: ::DWORD = CERT_SHA1_HASH_PROP_ID; +pub const CERT_KEY_CONTEXT_PROP_ID: ::DWORD = 5; +pub const CERT_KEY_SPEC_PROP_ID: ::DWORD = 6; +pub const CERT_IE30_RESERVED_PROP_ID: ::DWORD = 7; +pub const CERT_PUBKEY_HASH_RESERVED_PROP_ID: ::DWORD = 8; +pub const CERT_ENHKEY_USAGE_PROP_ID: ::DWORD = 9; +pub const CERT_CTL_USAGE_PROP_ID: ::DWORD = CERT_ENHKEY_USAGE_PROP_ID; +pub const CERT_NEXT_UPDATE_LOCATION_PROP_ID: ::DWORD = 10; +pub const CERT_FRIENDLY_NAME_PROP_ID: ::DWORD = 11; +pub const CERT_PVK_FILE_PROP_ID: ::DWORD = 12; +pub const CERT_DESCRIPTION_PROP_ID: ::DWORD = 13; +pub const CERT_ACCESS_STATE_PROP_ID: ::DWORD = 14; +pub const CERT_SIGNATURE_HASH_PROP_ID: ::DWORD = 15; +pub const CERT_SMART_CARD_DATA_PROP_ID: ::DWORD = 16; +pub const CERT_EFS_PROP_ID: ::DWORD = 17; +pub const CERT_FORTEZZA_DATA_PROP_ID: ::DWORD = 18; +pub const CERT_ARCHIVED_PROP_ID: ::DWORD = 19; +pub const CERT_KEY_IDENTIFIER_PROP_ID: ::DWORD = 20; +pub const CERT_AUTO_ENROLL_PROP_ID: ::DWORD = 21; +pub const CERT_PUBKEY_ALG_PARA_PROP_ID: ::DWORD = 22; +pub const CERT_CROSS_CERT_DIST_POINTS_PROP_ID: ::DWORD = 23; +pub const CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID: ::DWORD = 24; +pub const CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: ::DWORD = 25; +pub const CERT_ENROLLMENT_PROP_ID: ::DWORD = 26; +pub const CERT_DATE_STAMP_PROP_ID: ::DWORD = 27; +pub const CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: ::DWORD = 28; +pub const CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: ::DWORD = 29; +pub const CERT_EXTENDED_ERROR_INFO_PROP_ID: ::DWORD = 30; +pub const CERT_RENEWAL_PROP_ID: ::DWORD = 64; +pub const CERT_ARCHIVED_KEY_HASH_PROP_ID: ::DWORD = 65; +pub const CERT_AUTO_ENROLL_RETRY_PROP_ID: ::DWORD = 66; +pub const CERT_AIA_URL_RETRIEVED_PROP_ID: ::DWORD = 67; +pub const CERT_AUTHORITY_INFO_ACCESS_PROP_ID: ::DWORD = 68; +pub const CERT_BACKED_UP_PROP_ID: ::DWORD = 69; +pub const CERT_OCSP_RESPONSE_PROP_ID: ::DWORD = 70; +pub const CERT_REQUEST_ORIGINATOR_PROP_ID: ::DWORD = 71; +pub const CERT_SOURCE_LOCATION_PROP_ID: ::DWORD = 72; +pub const CERT_SOURCE_URL_PROP_ID: ::DWORD = 73; +pub const CERT_NEW_KEY_PROP_ID: ::DWORD = 74; +pub const CERT_OCSP_CACHE_PREFIX_PROP_ID: ::DWORD = 75; +pub const CERT_SMART_CARD_ROOT_INFO_PROP_ID: ::DWORD = 76; +pub const CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID: ::DWORD = 77; +pub const CERT_NCRYPT_KEY_HANDLE_PROP_ID: ::DWORD = 78; +pub const CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID: ::DWORD = 79; +pub const CERT_SUBJECT_INFO_ACCESS_PROP_ID: ::DWORD = 80; +pub const CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: ::DWORD = 81; +pub const CERT_CA_DISABLE_CRL_PROP_ID: ::DWORD = 82; +pub const CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID: ::DWORD = 83; +pub const CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID: ::DWORD = 84; +pub const CERT_SUBJECT_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: ::DWORD = 85; +pub const CERT_SUBJECT_DISABLE_CRL_PROP_ID: ::DWORD = 86; +pub const CERT_CEP_PROP_ID: ::DWORD = 87; +pub const CERT_SIGN_HASH_CNG_ALG_PROP_ID: ::DWORD = 89; +pub const CERT_SCARD_PIN_ID_PROP_ID: ::DWORD = 90; +pub const CERT_SCARD_PIN_INFO_PROP_ID: ::DWORD = 91; +pub const CERT_SUBJECT_PUB_KEY_BIT_LENGTH_PROP_ID: ::DWORD = 92; +pub const CERT_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID: ::DWORD = 93; +pub const CERT_ISSUER_PUB_KEY_BIT_LENGTH_PROP_ID: ::DWORD = 94; +pub const CERT_ISSUER_CHAIN_SIGN_HASH_CNG_ALG_PROP_ID: ::DWORD = 95; +pub const CERT_ISSUER_CHAIN_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID: ::DWORD = 96; +pub const CERT_NO_EXPIRE_NOTIFICATION_PROP_ID: ::DWORD = 97; +pub const CERT_AUTH_ROOT_SHA256_HASH_PROP_ID: ::DWORD = 98; +pub const CERT_NCRYPT_KEY_HANDLE_TRANSFER_PROP_ID: ::DWORD = 99; +pub const CERT_HCRYPTPROV_TRANSFER_PROP_ID: ::DWORD = 100; +pub const CERT_SMART_CARD_READER_PROP_ID: ::DWORD = 101; +pub const CERT_SEND_AS_TRUSTED_ISSUER_PROP_ID: ::DWORD = 102; +pub const CERT_KEY_REPAIR_ATTEMPTED_PROP_ID: ::DWORD = 103; +pub const CERT_DISALLOWED_FILETIME_PROP_ID: ::DWORD = 104; +pub const CERT_ROOT_PROGRAM_CHAIN_POLICIES_PROP_ID: ::DWORD = 105; +pub const CERT_SMART_CARD_READER_NON_REMOVABLE_PROP_ID: ::DWORD = 106; +pub const CERT_SHA256_HASH_PROP_ID: ::DWORD = 107; +pub const CERT_SCEP_SERVER_CERTS_PROP_ID: ::DWORD = 108; +pub const CERT_SCEP_RA_SIGNATURE_CERT_PROP_ID: ::DWORD = 109; +pub const CERT_SCEP_RA_ENCRYPTION_CERT_PROP_ID: ::DWORD = 110; +pub const CERT_SCEP_CA_CERT_PROP_ID: ::DWORD = 111; +pub const CERT_SCEP_SIGNER_CERT_PROP_ID: ::DWORD = 112; +pub const CERT_SCEP_NONCE_PROP_ID: ::DWORD = 113; +pub const CERT_SCEP_ENCRYPT_HASH_CNG_ALG_PROP_ID: ::DWORD = 114; +pub const CERT_SCEP_FLAGS_PROP_ID: ::DWORD = 115; +pub const CERT_SCEP_GUID_PROP_ID: ::DWORD = 116; +pub const CERT_SERIALIZABLE_KEY_CONTEXT_PROP_ID: ::DWORD = 117; +pub const CERT_ISOLATED_KEY_PROP_ID: ::DWORD = 118; +pub const CERT_FIRST_RESERVED_PROP_ID: ::DWORD = 119; +pub const CERT_LAST_RESERVED_PROP_ID: ::DWORD = 0x00007FFF; +pub const CERT_FIRST_USER_PROP_ID: ::DWORD = 0x00008000; +pub const CERT_LAST_USER_PROP_ID: ::DWORD = 0x0000FFFF; +pub const szOID_CERT_PROP_ID_PREFIX: &'static str = "1.3.6.1.4.1.311.10.11."; +pub const szOID_CERT_KEY_IDENTIFIER_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.20"; +pub const szOID_CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: &'static str + = "1.3.6.1.4.1.311.10.11.28"; +pub const szOID_CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.29"; +pub const szOID_CERT_MD5_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.4"; +pub const szOID_CERT_SIGNATURE_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.15"; +pub const szOID_DISALLOWED_HASH: &'static str = szOID_CERT_SIGNATURE_HASH_PROP_ID; +pub const szOID_CERT_DISALLOWED_FILETIME_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.104"; +pub const CERT_ACCESS_STATE_WRITE_PERSIST_FLAG: ::DWORD = 0x1; +pub const CERT_ACCESS_STATE_SYSTEM_STORE_FLAG: ::DWORD = 0x2; +pub const CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG: ::DWORD = 0x4; +pub const CERT_ACCESS_STATE_GP_SYSTEM_STORE_FLAG: ::DWORD = 0x8; +pub const CERT_ACCESS_STATE_SHARED_USER_FLAG: ::DWORD = 0x10; +pub const szOID_ROOT_PROGRAM_AUTO_UPDATE_CA_REVOCATION: &'static str = "1.3.6.1.4.1.311.60.3.1"; +pub const szOID_ROOT_PROGRAM_AUTO_UPDATE_END_REVOCATION: &'static str = "1.3.6.1.4.1.311.60.3.2"; +pub const szOID_ROOT_PROGRAM_NO_OCSP_FAILOVER_TO_CRL: &'static str = "1.3.6.1.4.1.311.60.3.3"; +STRUCT!{struct CRYPT_KEY_PROV_PARAM { + dwParam: ::DWORD, + pbData: *mut ::BYTE, + cbData: ::DWORD, + dwFlags: ::DWORD, +}} +pub type PCRYPT_KEY_PROV_PARAM = *mut CRYPT_KEY_PROV_PARAM; +STRUCT!{struct CRYPT_KEY_PROV_INFO { + pwszContainerName: ::LPWSTR, + pwszProvName: ::LPWSTR, + dwProvType: ::DWORD, + dwFlags: ::DWORD, + cProvParam: ::DWORD, + rgProvParam: PCRYPT_KEY_PROV_PARAM, + dwKeySpec: ::DWORD, +}} +pub type PCRYPT_KEY_PROV_INFO = *mut CRYPT_KEY_PROV_INFO; +pub const CERT_SET_KEY_PROV_HANDLE_PROP_ID: ::DWORD = 0x00000001; +pub const CERT_SET_KEY_CONTEXT_PROP_ID: ::DWORD = 0x00000001; +pub const CERT_NCRYPT_KEY_SPEC: ::DWORD = 0xFFFFFFFF; +//20213 +pub type HCERT_SERVER_OCSP_RESPONSE = *mut ::c_void; +STRUCT!{struct CERT_SERVER_OCSP_RESPONSE_CONTEXT { + cbSize: ::DWORD, + pbEncodedOcspResponse: *mut ::BYTE, + cbEncodedOcspResponse: ::DWORD, +}} +pub type PCERT_SERVER_OCSP_RESPONSE_CONTEXT = *mut CERT_SERVER_OCSP_RESPONSE_CONTEXT; +pub type PCCERT_SERVER_OCSP_RESPONSE_CONTEXT = *const CERT_SERVER_OCSP_RESPONSE_CONTEXT; + +pub const CERT_CHAIN_CACHE_END_CERT: ::DWORD = 0x00000001; +pub const CERT_CHAIN_THREAD_STORE_SYNC: ::DWORD = 0x00000002; +pub const CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL: ::DWORD = 0x00000004; +pub const CERT_CHAIN_USE_LOCAL_MACHINE_STORE: ::DWORD = 0x00000008; +pub const CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE: ::DWORD = 0x00000010; +pub const CERT_CHAIN_ENABLE_SHARE_STORE: ::DWORD = 0x00000020; + +STRUCT!{struct CERT_CHAIN_ENGINE_CONFIG { + cbSize: ::DWORD, + hRestrictedRoot: HCERTSTORE, + hRestrictedTrust: HCERTSTORE, + hRestrictedOther: HCERTSTORE, + cAdditionalStore: ::DWORD, + rghAdditionalStore: *mut HCERTSTORE, + dwFlags: ::DWORD, + dwUrlRetrievalTimeout: ::DWORD, + MaximumCachedCertificates: ::DWORD, + CycleDetectionModulus: ::DWORD, + // #if (NTDDI_VERSION >= NTDDI_WIN7) + hExclusiveRoot: HCERTSTORE, + hExclusiveTrustedPeople: HCERTSTORE, + // #if (NTDDI_VERSION >= NTDDI_WIN8) + dwExclusiveFlags: ::DWORD, +}} +pub type PCERT_CHAIN_ENGINE_CONFIG = *mut CERT_CHAIN_ENGINE_CONFIG; +// 18748 +pub type HCERTCHAINENGINE = ::HANDLE; +pub type PFN_CERT_CREATE_CONTEXT_SORT_FUNC = Option ::BOOL>; +STRUCT!{nodebug struct CERT_CREATE_CONTEXT_PARA { + cbSize: ::DWORD, + pfnFree: PFN_CRYPT_FREE, + pvFree: *mut ::c_void, + pfnSort: PFN_CERT_CREATE_CONTEXT_SORT_FUNC, + pvSort: *mut ::c_void, +}} +pub type PCERT_CREATE_CONTEXT_PARA = *mut CERT_CREATE_CONTEXT_PARA; +STRUCT!{struct CERT_EXTENSIONS { + cExtension: ::DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCERT_EXTENSIONS = *mut CERT_EXTENSIONS; +STRUCT!{struct CERT_REVOCATION_CRL_INFO { + cbSize: ::DWORD, + pBaseCrlContext: PCCRL_CONTEXT, + pDeltaCrlContext: PCCRL_CONTEXT, + pCrlEntry: PCRL_ENTRY, + fDeltaCrlEntry: ::BOOL, +}} +pub type PCERT_REVOCATION_CRL_INFO = *mut CERT_REVOCATION_CRL_INFO; +STRUCT!{struct CERT_TRUST_STATUS { + dwErrorStatus: ::DWORD, + dwInfoStatus: ::DWORD, +}} +pub type PCERT_TRUST_STATUS = *mut CERT_TRUST_STATUS; +STRUCT!{struct CERT_REVOCATION_INFO { + cbSize: ::DWORD, + dwRevocationResult: ::DWORD, + pszRevocationOid: ::LPCSTR, + pvOidSpecificInfo: ::LPVOID, + fHasFreshnessTime: ::BOOL, + dwFreshnessTime: ::DWORD, + pCrlInfo: PCERT_REVOCATION_CRL_INFO, +}} +pub type PCERT_REVOCATION_INFO = *mut CERT_REVOCATION_INFO; +STRUCT!{struct CERT_TRUST_LIST_INFO { + cbSize: ::DWORD, + pCtlEntry: PCTL_ENTRY, + pCtlContext: PCCTL_CONTEXT, +}} +pub type PCERT_TRUST_LIST_INFO = *mut CERT_TRUST_LIST_INFO; +STRUCT!{struct CERT_CHAIN_ELEMENT { + cbSize: ::DWORD, + pCertContext: PCCERT_CONTEXT, + TrustStatus: CERT_TRUST_STATUS, + pRevocationInfo: PCERT_REVOCATION_INFO, + pIssuanceUsage: PCERT_ENHKEY_USAGE, + pApplicationUsage: PCERT_ENHKEY_USAGE, + pwszExtendedErrorInfo: ::LPWSTR, +}} +pub type PCERT_CHAIN_ELEMENT = *mut CERT_CHAIN_ELEMENT; +pub type PCCERT_CHAIN_ELEMENT = *const CERT_CHAIN_ELEMENT; +STRUCT!{struct CERT_SIMPLE_CHAIN { + cbSize: ::DWORD, + TrustStatus: CERT_TRUST_STATUS, + cElement: ::DWORD, + rgpElement: *mut PCERT_CHAIN_ELEMENT, + pTrustListInfo: PCERT_TRUST_LIST_INFO, + fHasRevocationFreshnessTime: ::BOOL, + dwRevocationFreshnessTime: ::DWORD, +}} +pub type PCERT_SIMPLE_CHAIN = *mut CERT_SIMPLE_CHAIN; +pub type PCCERT_SIMPLE_CHAIN = *const CERT_SIMPLE_CHAIN; +STRUCT!{struct CERT_CHAIN_CONTEXT { + cbSize: ::DWORD, + TrustStatus: CERT_TRUST_STATUS, + cChain: ::DWORD, + rgpChain: *mut PCERT_SIMPLE_CHAIN, + cLowerQualityChainContext: ::DWORD, + rgpLowerQualityChainContext: *mut PCCERT_CHAIN_CONTEXT, + fHasRevocationFreshnessTime: ::BOOL, + dwRevocationFreshnessTime: ::DWORD, + dwCreateFlags: ::DWORD, + ChainId: ::GUID, +}} +pub type PCERT_CHAIN_CONTEXT = *mut CERT_CHAIN_CONTEXT; +pub type PCCERT_CHAIN_CONTEXT = *const CERT_CHAIN_CONTEXT; +STRUCT!{struct CERT_PHYSICAL_STORE_INFO { + cbSize: ::DWORD, + pszOpenStoreProvider: ::LPSTR, + dwOpenEncodingType: ::DWORD, + dwOpenFlags: ::DWORD, + OpenParameters: CRYPT_DATA_BLOB, + dwFlags: ::DWORD, + dwPriority: ::DWORD, +}} +pub type PCERT_PHYSICAL_STORE_INFO = *mut CERT_PHYSICAL_STORE_INFO; +STRUCT!{struct CERT_SYSTEM_STORE_INFO { + cbSize: ::DWORD, +}} +pub type PCERT_SYSTEM_STORE_INFO = *mut CERT_SYSTEM_STORE_INFO; +//13401 +pub type PFN_CERT_ENUM_SYSTEM_STORE_LOCATION = Option ::BOOL>; +//13408 +pub type PFN_CERT_ENUM_SYSTEM_STORE = Option ::BOOL>; +//13416 +pub type PFN_CERT_ENUM_PHYSICAL_STORE = Option ::BOOL>; +STRUCT!{struct CERT_STRONG_SIGN_SERIALIZED_INFO { + dwFlags: ::DWORD, + pwszCNGSignHashAlgids: ::LPWSTR, + pwszCNGPubKeyMinBitLengths: ::LPWSTR, +}} +pub type PCERT_STRONG_SIGN_SERIALIZED_INFO = *mut CERT_STRONG_SIGN_SERIALIZED_INFO; +STRUCT!{struct CERT_STRONG_SIGN_PARA { + cbSize: ::DWORD, + dwInfoChoice: ::DWORD, + pvInfo: *mut ::c_void, +}} +UNION!( + CERT_STRONG_SIGN_PARA, pvInfo, pSerializedInfo, pSerializedInfo_mut, + PCERT_STRONG_SIGN_SERIALIZED_INFO +); +UNION!(CERT_STRONG_SIGN_PARA, pvInfo, pszOID, pszOID_mut, ::LPSTR); +pub type PCERT_STRONG_SIGN_PARA = *mut CERT_STRONG_SIGN_PARA; +pub type PCCERT_STRONG_SIGN_PARA = *const CERT_STRONG_SIGN_PARA; +pub const USAGE_MATCH_TYPE_AND: ::DWORD = 0x00000000; +pub const USAGE_MATCH_TYPE_OR: ::DWORD = 0x00000001; +STRUCT!{struct CERT_USAGE_MATCH { + dwType: ::DWORD, + Usage: CERT_ENHKEY_USAGE, +}} +pub type PCERT_USAGE_MATCH = *mut CERT_USAGE_MATCH; +STRUCT!{struct CERT_CHAIN_PARA { + cbSize: ::DWORD, + RequestedUsage: CERT_USAGE_MATCH, + RequestedIssuancePolicy: CERT_USAGE_MATCH, + dwUrlRetrievalTimeout: ::DWORD, + fCheckRevocationFreshnessTime: ::BOOL, + dwRevocationFreshnessTime: ::DWORD, + pftCacheResync: ::LPFILETIME, + pStrongSignPara: PCCERT_STRONG_SIGN_PARA, + dwStrongSignFlags: ::DWORD, +}} +pub type PCERT_CHAIN_PARA = *mut CERT_CHAIN_PARA; +STRUCT!{struct CERT_SELECT_CHAIN_PARA { + hChainEngine: HCERTCHAINENGINE, + pTime: ::PFILETIME, + hAdditionalStore: HCERTSTORE, + pChainPara: PCERT_CHAIN_PARA, + dwFlags: ::DWORD, +}} +pub type PCERT_SELECT_CHAIN_PARA = *mut CERT_SELECT_CHAIN_PARA; +pub type PCCERT_SELECT_CHAIN_PARA = *const CERT_SELECT_CHAIN_PARA; +STRUCT!{struct CERT_SELECT_CRITERIA { + dwType: ::DWORD, + cPara: ::DWORD, + ppPara: *mut *mut ::c_void, +}} +pub type PCERT_SELECT_CRITERIA = *mut CERT_SELECT_CRITERIA; +pub type PCCERT_SELECT_CRITERIA = *const CERT_SELECT_CRITERIA; +STRUCT!{struct CTL_VERIFY_USAGE_PARA { + cbSize: ::DWORD, + ListIdentifier: CRYPT_DATA_BLOB, + cCtlStore: ::DWORD, + rghCtlStore: *mut HCERTSTORE, + cSignerStore: ::DWORD, + rghSignerStore: *mut HCERTSTORE, +}} +pub type PCTL_VERIFY_USAGE_PARA = *mut CTL_VERIFY_USAGE_PARA; +STRUCT!{struct CTL_VERIFY_USAGE_STATUS { + cbSize: ::DWORD, + dwError: ::DWORD, + dwFlags: ::DWORD, + ppCtl: *mut PCCTL_CONTEXT, + dwCtlEntryIndex: ::DWORD, + ppSigner: *mut PCCERT_CONTEXT, + dwSignerIndex: ::DWORD, +}} +pub type PCTL_VERIFY_USAGE_STATUS = *mut CTL_VERIFY_USAGE_STATUS; +STRUCT!{struct CERT_CHAIN_POLICY_PARA { + cbSize: ::DWORD, + dwFlags: ::DWORD, + pvExtraPolicyPara: *mut ::c_void, +}} +pub type PCERT_CHAIN_POLICY_PARA = *mut CERT_CHAIN_POLICY_PARA; +STRUCT!{struct CERT_CHAIN_POLICY_STATUS { + cbSize: ::DWORD, + dwError: ::DWORD, + lChainIndex: ::LONG, + lElementIndex: ::LONG, + pvExtraPolicyStatus: *mut ::c_void, +}} +pub type PCERT_CHAIN_POLICY_STATUS = *mut CERT_CHAIN_POLICY_STATUS; +STRUCT!{struct CERT_REVOCATION_CHAIN_PARA { + cbSize: ::DWORD, + hChainEngine: HCERTCHAINENGINE, + hAdditionalStore: HCERTSTORE, + dwChainFlags: ::DWORD, + dwUrlRetrievalTimeout: ::DWORD, + pftCurrentTime: ::LPFILETIME, + pftCacheResync: ::LPFILETIME, +}} +pub type PCERT_REVOCATION_CHAIN_PARA = *mut CERT_REVOCATION_CHAIN_PARA; +STRUCT!{struct CERT_REVOCATION_PARA { + cbSize: ::DWORD, + pIssuerCert: PCCERT_CONTEXT, + cCertStore: ::DWORD, + rgCertStore: *mut HCERTSTORE, + hCrlStore: HCERTSTORE, + pftTimeToUse: ::LPFILETIME, + dwUrlRetrievalTimeout: ::DWORD, + fCheckFreshnessTime: ::BOOL, + dwFreshnessTime: ::DWORD, + pftCurrentTime: ::LPFILETIME, + pCrlInfo: PCERT_REVOCATION_CRL_INFO, + pftCacheResync: ::LPFILETIME, + pChainPara: PCERT_REVOCATION_CHAIN_PARA, +}} +pub type PCERT_REVOCATION_PARA = *mut CERT_REVOCATION_PARA; +STRUCT!{struct CERT_REVOCATION_STATUS { + cbSize: ::DWORD, + dwIndex: ::DWORD, + dwError: ::DWORD, + dwReason: ::DWORD, + fHasFreshnessTime: ::BOOL, + dwFreshnessTime: ::DWORD, +}} +pub type PCERT_REVOCATION_STATUS = *mut CERT_REVOCATION_STATUS; +//16990 +pub type HCRYPTASYNC = ::HANDLE; +pub type PHCRYPTASYNC = *mut ::HANDLE; +STRUCT!{struct CRYPT_ENCRYPT_MESSAGE_PARA { + cbSize: ::DWORD, + dwMsgEncodingType: ::DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + ContentEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvEncryptionAuxInfo: *mut ::c_void, + dwFlags: ::DWORD, + dwInnerContentType: ::DWORD, +}} +pub type PCRYPT_ENCRYPT_MESSAGE_PARA = *mut CRYPT_DECRYPT_MESSAGE_PARA; +STRUCT!{struct CRYPT_DECRYPT_MESSAGE_PARA { + cbSize: ::DWORD, + dwMsgAndCertEncodingType: ::DWORD, + cCertStore: ::DWORD, + rghCertStore: *mut HCERTSTORE, + dwFlags: ::DWORD, +}} +pub type PCRYPT_DECRYPT_MESSAGE_PARA = *mut CRYPT_DECRYPT_MESSAGE_PARA; +pub type PFN_CRYPT_GET_SIGNER_CERTIFICATE = Option PCCERT_CONTEXT>; +STRUCT!{nodebug struct CRYPT_VERIFY_MESSAGE_PARA { + cbSize: ::DWORD, + dwMsgAndCertEncodingType: ::DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + pfnGetSignerCertificate: PFN_CRYPT_GET_SIGNER_CERTIFICATE, + pvGetArg: *mut ::c_void, + pStrongSignPara: PCCERT_STRONG_SIGN_PARA, +}} +pub type PCRYPT_VERIFY_MESSAGE_PARA = *mut CRYPT_VERIFY_MESSAGE_PARA; +STRUCT!{struct CRYPT_OID_INFO { + cbSize: ::DWORD, + oszOID: ::LPCSTR, + pwszName: ::LPCWSTR, + dwGroupId: ::DWORD, + dwValue: ::DWORD, + ExtraInfo: CRYPT_DATA_BLOB, + pwszCNGAlgid: ::LPCWSTR, + pwszCNGExtraAlgid: ::LPCWSTR, +}} +UNION!(CRYPT_OID_INFO, dwValue, Algid, Algid_mut, ALG_ID); +UNION!(CRYPT_OID_INFO, dwValue, dwLength, dwLength_mut, ::DWORD); +pub type PCRYPT_OID_INFO = *mut CRYPT_OID_INFO; +pub type PCCRYPT_OID_INFO = *const CRYPT_OID_INFO; +//18004 +pub type PFN_CRYPT_ENUM_KEYID_PROP = Option ::BOOL>; +//6379 +pub type PFN_CRYPT_ENUM_OID_FUNC = Option ::BOOL>; +//6675 +pub type PFN_CRYPT_ENUM_OID_INFO = Option ::BOOL>; +//6022 +pub type HCRYPTOIDFUNCSET = *mut ::c_void; +pub type HCRYPTOIDFUNCADDR = *mut ::c_void; +pub type PFN_CRYPT_ASYNC_PARAM_FREE_FUNC = Option; +STRUCT!{struct CRYPT_HASH_MESSAGE_PARA { + cbSize: ::DWORD, + dwMsgEncodingType: ::DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut ::c_void, +}} +pub type PCRYPT_HASH_MESSAGE_PARA = *mut CRYPT_HASH_MESSAGE_PARA; +//14750 +pub type HCRYPTDEFAULTCONTEXT = *mut ::c_void; +STRUCT!{struct CRYPT_OID_FUNC_ENTRY { + pszOID: ::LPCSTR, + pvFuncAddr: *mut ::c_void, +}} +pub type PCRYPT_OID_FUNC_ENTRY = *mut CRYPT_OID_FUNC_ENTRY; +STRUCT!{struct CMSG_SIGNER_ENCODE_INFO { + cbSize: ::DWORD, + pCertInfo: PCERT_INFO, + hCryptProv: HCRYPTPROV, + dwKeySpec: ::DWORD, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut ::c_void, + cAuthAttr: ::DWORD, + rgAuthAttr: PCRYPT_ATTRIBUTE, + cUnauthAttr: ::DWORD, + rgUnauthAttr: PCRYPT_ATTRIBUTE, +}} +UNION!(CMSG_SIGNER_ENCODE_INFO, hCryptProv, hNCryptKey, hNCryptKey_mut, ::NCRYPT_KEY_HANDLE); +pub type PCMSG_SIGNER_ENCODE_INFO = *mut CMSG_SIGNER_ENCODE_INFO; +STRUCT!{struct CMSG_SIGNED_ENCODE_INFO { + cbSize: ::DWORD, + cSigners: ::DWORD, + rgSigners: PCMSG_SIGNER_ENCODE_INFO, + cCertEncoded: ::DWORD, + rgCertEncoded: PCERT_BLOB, + cCrlEncoded: ::DWORD, + rgCrlEncoded: PCRL_BLOB, +}} +pub type PCMSG_SIGNED_ENCODE_INFO = *mut CMSG_SIGNED_ENCODE_INFO; +//7393 +pub type PFN_CMSG_STREAM_OUTPUT = Option ::BOOL>; +STRUCT!{nodebug struct CMSG_STREAM_INFO { + cbContent: ::DWORD, + pfnStreamOutput: PFN_CMSG_STREAM_OUTPUT, + pvArg: *mut ::c_void, +}} +pub type PCMSG_STREAM_INFO = *mut CMSG_STREAM_INFO; +STRUCT!{struct CRYPT_TIMESTAMP_ACCURACY { + dwSeconds: ::DWORD, + dwMillis: ::DWORD, + dwMicros: ::DWORD, +}} +pub type PCRYPT_TIMESTAMP_ACCURACY = *mut CRYPT_TIMESTAMP_ACCURACY; +STRUCT!{struct CRYPT_TIMESTAMP_INFO { + dwVersion: ::DWORD, + pszTSAPolicyId: ::LPSTR, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + HashedMessage: CRYPT_DER_BLOB, + SerialNumber: CRYPT_INTEGER_BLOB, + ftTime: ::FILETIME, + pvAccuracy: PCRYPT_TIMESTAMP_ACCURACY, + fOrdering: ::BOOL, + Nonce: CRYPT_DER_BLOB, + Tsa: CRYPT_DER_BLOB, + cExtension: ::DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRYPT_TIMESTAMP_INFO = *mut CRYPT_TIMESTAMP_INFO; +STRUCT!{struct CRYPT_TIMESTAMP_CONTEXT { + cbEncoded: ::DWORD, + pbEncoded: *mut ::BYTE, + pTimeStamp: PCRYPT_TIMESTAMP_INFO, +}} +pub type PCRYPT_TIMESTAMP_CONTEXT = *mut CRYPT_TIMESTAMP_CONTEXT; +STRUCT!{struct CRYPT_TIMESTAMP_PARA { + pszTSAPolicyId: ::LPCSTR, + fRequestCerts: ::BOOL, + Nonce: CRYPT_INTEGER_BLOB, + cExtension: ::DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRYPT_TIMESTAMP_PARA = *mut CRYPT_TIMESTAMP_PARA; +STRUCT!{struct CRYPT_SIGN_MESSAGE_PARA { + cbSize: ::DWORD, + dwMsgEncodingType: ::DWORD, + pSigningCert: PCCERT_CONTEXT, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut ::c_void, + cMsgCert: ::DWORD, + rgpMsgCert: *mut PCCERT_CONTEXT, + cMsgCrl: ::DWORD, + rgpMsgCrl: *mut PCCRL_CONTEXT, + cAuthAttr: ::DWORD, + rgAuthAttr: PCRYPT_ATTRIBUTE, + cUnauthAttr: ::DWORD, + rgUnauthAttr: PCRYPT_ATTRIBUTE, + dwFlags: ::DWORD, + dwInnerContentType: ::DWORD, +}} +pub type PCRYPT_SIGN_MESSAGE_PARA = *mut CRYPT_SIGN_MESSAGE_PARA; +STRUCT!{struct CRYPT_KEY_SIGN_MESSAGE_PARA { + cbSize: ::DWORD, + dwMsgAndCertEncodingType: ::DWORD, + hCryptProv: HCRYPTPROV, + dwKeySpec: ::DWORD, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut ::c_void, + PubKeyAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, +}} +UNION!(CRYPT_KEY_SIGN_MESSAGE_PARA, hCryptProv, hNCryptKey, hNCryptKey_mut, ::NCRYPT_KEY_HANDLE); +pub type PCRYPT_KEY_SIGN_MESSAGE_PARA = *mut CRYPT_KEY_SIGN_MESSAGE_PARA; +STRUCT!{struct CRYPT_KEY_VERIFY_MESSAGE_PARA { + cbSize: ::DWORD, + dwMsgEncodingType: ::DWORD, + hCryptProv: HCRYPTPROV_LEGACY, +}} +pub type PCRYPT_KEY_VERIFY_MESSAGE_PARA = *mut CRYPT_KEY_VERIFY_MESSAGE_PARA; +STRUCT!{struct HTTPSPolicyCallbackData { + cbSize: ::DWORD, + dwAuthType: ::DWORD, + fdwChecks: ::DWORD, + pwszServerName: *mut ::WCHAR, +}} +pub type PHTTPSPolicyCallbackData = *mut HTTPSPolicyCallbackData; +pub type SSL_EXTRA_CERT_CHAIN_POLICY_PARA = HTTPSPolicyCallbackData; +pub type PSSL_EXTRA_CERT_CHAIN_POLICY_PARA = *mut HTTPSPolicyCallbackData; +pub const AUTHTYPE_CLIENT: ::DWORD = 1; +pub const AUTHTYPE_SERVER: ::DWORD = 2; +pub const CTL_ENTRY_FROM_PROP_CHAIN_FLAG: ::DWORD = 0x1; +pub const CMSG_ENCODE_SORTED_CTL_FLAG: ::DWORD = 0x1; +pub const CMSG_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: ::DWORD = 0x2; diff --git a/third_party/rust/winapi/src/windef.rs b/third_party/rust/winapi/src/windef.rs new file mode 100644 index 000000000000..6493b48c1fa4 --- /dev/null +++ b/third_party/rust/winapi/src/windef.rs @@ -0,0 +1,57 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Basic Windows Type Definitions +DECLARE_HANDLE!(HWND, HWND__); +DECLARE_HANDLE!(HHOOK, HHOOK__); +DECLARE_HANDLE!(HEVENT, HEVENT__); +pub type HGDIOBJ = *mut ::c_void; +DECLARE_HANDLE!(HACCEL, HACCEL__); +DECLARE_HANDLE!(HBITMAP, HBITMAP__); +DECLARE_HANDLE!(HBRUSH, HBRUSH__); +DECLARE_HANDLE!(HCOLORSPACE, HCOLORSPACE__); +DECLARE_HANDLE!(HDC, HDC__); +DECLARE_HANDLE!(HGLRC, HGLRC__); +DECLARE_HANDLE!(HDESK, HDESK__); +DECLARE_HANDLE!(HENHMETAFILE, HENHMETAFILE__); +DECLARE_HANDLE!(HFONT, HFONT__); +DECLARE_HANDLE!(HICON, HICON__); +DECLARE_HANDLE!(HMENU, HMENU__); +DECLARE_HANDLE!(HPALETTE, HPALETTE__); +DECLARE_HANDLE!(HPEN, HPEN__); +DECLARE_HANDLE!(HWINEVENTHOOK, HWINEVENTHOOK__); +DECLARE_HANDLE!(HMONITOR, HMONITOR__); +DECLARE_HANDLE!(HUMPD, HUMPD__); +pub type HCURSOR = HICON; +pub type COLORREF = ::DWORD; +pub type LPCOLORREF = *mut ::DWORD; +STRUCT!{struct RECT { + left: ::LONG, + top: ::LONG, + right: ::LONG, + bottom: ::LONG, +}} +pub type PRECT = *mut RECT; +pub type NPRECT = *mut RECT; +pub type LPRECT = *mut RECT; +pub type LPCRECT = *const RECT; +STRUCT!{struct RECTL { + left: ::LONG, + top: ::LONG, + right: ::LONG, + bottom: ::LONG, +}} +pub type PRECTL = *mut RECTL; +pub type LPRECTL = *mut RECTL; +pub type LPCRECTL = *const RECTL; +STRUCT!{struct POINT { + x: ::LONG, + y: ::LONG, +}} +pub type PPOINT = *mut POINT; +pub type NPPOINT = *mut POINT; +pub type LPPOINT = *mut POINT; +STRUCT!{struct POINTL { + x: ::LONG, + y: ::LONG, +}} +pub type PPOINTL = *mut POINTL; diff --git a/third_party/rust/winapi/src/windowscodecs.rs b/third_party/rust/winapi/src/windowscodecs.rs new file mode 100644 index 000000000000..37596264c214 --- /dev/null +++ b/third_party/rust/winapi/src/windowscodecs.rs @@ -0,0 +1,363 @@ +// Copyright © 2015; Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of wincodec.h +pub type WICColor = ::UINT32; +pub type WICInProcPointer = *mut ::BYTE; +pub type REFWICPixelFormatGUID = ::REFGUID; +pub type WICPixelFormatGUID = ::GUID; +STRUCT!{struct WICRect { + X: ::INT, + Y: ::INT, + Width: ::INT, + Height: ::INT, +}} +ENUM!{enum WICColorContextType { + WICColorContextUninitialized = 0, + WICColorContextProfile = 0x1, + WICColorContextExifColorSpace = 0x2, +}} +ENUM!{enum WICBitmapCreateCacheOption { + WICBitmapNoCache = 0, + WICBitmapCacheOnDemand = 0x1, + WICBitmapCacheOnLoad = 0x2, +}} +ENUM!{enum WICDecodeOptions { + WICDecodeMetadataCacheOnDemand = 0, + WICDecodeMetadataCacheOnLoad = 0x1, +}} +ENUM!{enum WICBitmapEncoderCacheOption { + WICBitmapEncoderCacheInMemory = 0, + WICBitmapEncoderCacheTempFile = 0x1, + WICBitmapEncoderNoCache = 0x2, +}} +FLAGS!{enum WICComponentType { + WICDecoder = 0x1, + WICEncoder = 0x2, + WICPixelFormatConverter = 0x4, + WICMetadataReader = 0x8, + WICMetadataWriter = 0x10, + WICPixelFormat = 0x20, + WICAllComponents = 0x3f, +}} +FLAGS!{enum WICComponentEnumerateOptions { + WICComponentEnumerateDefault = 0, + WICComponentEnumerateRefresh = 0x1, + WICComponentEnumerateDisabled = 0x80000000, + WICComponentEnumerateUnsigned = 0x40000000, + WICComponentEnumerateBuiltInOnly = 0x20000000, +}} +#[allow(unused_qualifications)] +STRUCT!{struct WICBitmapPattern { + Position: ::ULARGE_INTEGER, + Length: ::ULONG, + Pattern: *mut ::BYTE, + Mask: *mut ::BYTE, + EndOfStream: ::BOOL, +}} +ENUM!{enum WICBitmapInterpolationMode { + WICBitmapInterpolationModeNearestNeighbor = 0, + WICBitmapInterpolationModeLinear = 0x1, + WICBitmapInterpolationModeCubic = 0x2, + WICBitmapInterpolationModeFant = 0x3, +}} +ENUM!{enum WICBitmapPaletteType { + WICBitmapPaletteTypeCustom = 0, + WICBitmapPaletteTypeMedianCut = 0x1, + WICBitmapPaletteTypeFixedBW = 0x2, + WICBitmapPaletteTypeFixedHalftone8 = 0x3, + WICBitmapPaletteTypeFixedHalftone27 = 0x4, + WICBitmapPaletteTypeFixedHalftone64 = 0x5, + WICBitmapPaletteTypeFixedHalftone125 = 0x6, + WICBitmapPaletteTypeFixedHalftone216 = 0x7, + WICBitmapPaletteTypeFixedHalftone252 = 0x8, + WICBitmapPaletteTypeFixedHalftone256 = 0x9, + WICBitmapPaletteTypeFixedGray4 = 0xa, + WICBitmapPaletteTypeFixedGray16 = 0xb, + WICBitmapPaletteTypeFixedGray256 = 0xc, +}} +pub const WICBitmapPaletteTypeFixedWebPalette: WICBitmapPaletteType = + WICBitmapPaletteTypeFixedHalftone216; +ENUM!{enum WICBitmapDitherType { + WICBitmapDitherTypeSolid = 0, + WICBitmapDitherTypeOrdered4x4 = 0x1, + WICBitmapDitherTypeOrdered8x8 = 0x2, + WICBitmapDitherTypeOrdered16x16 = 0x3, + WICBitmapDitherTypeSpiral4x4 = 0x4, + WICBitmapDitherTypeSpiral8x8 = 0x5, + WICBitmapDitherTypeDualSpiral4x4 = 0x6, + WICBitmapDitherTypeDualSpiral8x8 = 0x7, + WICBitmapDitherTypeErrorDiffusion = 0x8, +}} +pub const WICBitmapDitherTypeNone: WICBitmapDitherType = WICBitmapDitherTypeSolid; +ENUM!{enum WICBitmapAlphaChannelOption { + WICBitmapUseAlpha = 0, + WICBitmapUsePremultipliedAlpha = 0x1, + WICBitmapIgnoreAlpha = 0x2, +}} +FLAGS!{enum WICBitmapTransformOptions { + WICBitmapTransformRotate0 = 0, + WICBitmapTransformRotate90 = 0x1, + WICBitmapTransformRotate180 = 0x2, + WICBitmapTransformRotate270 = 0x3, + WICBitmapTransformFlipHorizontal = 0x8, + WICBitmapTransformFlipVertical = 0x10, +}} +FLAGS!{enum WICBitmapLockFlags { + WICBitmapLockRead = 0x1, + WICBitmapLockWrite = 0x2, +}} +FLAGS!{enum WICBitmapDecoderCapabilities { + WICBitmapDecoderCapabilitySameEncoder = 0x1, + WICBitmapDecoderCapabilityCanDecodeAllImages = 0x2, + WICBitmapDecoderCapabilityCanDecodeSomeImages = 0x4, + WICBitmapDecoderCapabilityCanEnumerateMetadata = 0x8, + WICBitmapDecoderCapabilityCanDecodeThumbnail = 0x10, +}} +FLAGS!{enum WICProgressOperation { + WICProgressOperationCopyPixels = 0x1, + WICProgressOperationWritePixels = 0x2, + WICProgressOperationAll = 0xffff, +}} +FLAGS!{enum WICProgressNotification { + WICProgressNotificationBegin = 0x10000, + WICProgressNotificationEnd = 0x20000, + WICProgressNotificationFrequent = 0x40000, + WICProgressNotificationAll = 0xffff0000, +}} +FLAGS!{enum WICComponentSigning { + WICComponentSigned = 0x1, + WICComponentUnsigned = 0x2, + WICComponentSafe = 0x4, + WICComponentDisabled = 0x80000000, +}} +ENUM!{enum WICGifLogicalScreenDescriptorProperties { + WICGifLogicalScreenSignature = 0x1, + WICGifLogicalScreenDescriptorWidth = 0x2, + WICGifLogicalScreenDescriptorHeight = 0x3, + WICGifLogicalScreenDescriptorGlobalColorTableFlag = 0x4, + WICGifLogicalScreenDescriptorColorResolution = 0x5, + WICGifLogicalScreenDescriptorSortFlag = 0x6, + WICGifLogicalScreenDescriptorGlobalColorTableSize = 0x7, + WICGifLogicalScreenDescriptorBackgroundColorIndex = 0x8, + WICGifLogicalScreenDescriptorPixelAspectRatio = 0x9, +}} +ENUM!{enum WICGifImageDescriptorProperties { + WICGifImageDescriptorLeft = 0x1, + WICGifImageDescriptorTop = 0x2, + WICGifImageDescriptorWidth = 0x3, + WICGifImageDescriptorHeight = 0x4, + WICGifImageDescriptorLocalColorTableFlag = 0x5, + WICGifImageDescriptorInterlaceFlag = 0x6, + WICGifImageDescriptorSortFlag = 0x7, + WICGifImageDescriptorLocalColorTableSize = 0x8, +}} +ENUM!{enum WICGifGraphicControlExtensionProperties { + WICGifGraphicControlExtensionDisposal = 0x1, + WICGifGraphicControlExtensionUserInputFlag = 0x2, + WICGifGraphicControlExtensionTransparencyFlag = 0x3, + WICGifGraphicControlExtensionDelay = 0x4, + WICGifGraphicControlExtensionTransparentColorIndex = 0x5, +}} +ENUM!{enum WICGifApplicationExtensionProperties { + WICGifApplicationExtensionApplication = 0x1, + WICGifApplicationExtensionData = 0x2, +}} +ENUM!{enum WICGifCommentExtensionProperties { + WICGifCommentExtensionText = 0x1, +}} +ENUM!{enum WICJpegCommentProperties { + WICJpegCommentText = 0x1, +}} +ENUM!{enum WICJpegLuminanceProperties { + WICJpegLuminanceTable = 0x1, +}} +ENUM!{enum WICJpegChrominanceProperties { + WICJpegChrominanceTable = 0x1, +}} +ENUM!{enum WIC8BIMIptcProperties { + WIC8BIMIptcPString = 0, + WIC8BIMIptcEmbeddedIPTC = 0x1, +}} +ENUM!{enum WIC8BIMResolutionInfoProperties { + WIC8BIMResolutionInfoPString = 0x1, + WIC8BIMResolutionInfoHResolution = 0x2, + WIC8BIMResolutionInfoHResolutionUnit = 0x3, + WIC8BIMResolutionInfoWidthUnit = 0x4, + WIC8BIMResolutionInfoVResolution = 0x5, + WIC8BIMResolutionInfoVResolutionUnit = 0x6, + WIC8BIMResolutionInfoHeightUnit = 0x7, +}} +ENUM!{enum WIC8BIMIptcDigestProperties { + WIC8BIMIptcDigestPString = 0x1, + WIC8BIMIptcDigestIptcDigest = 0x2, +}} +ENUM!{enum WICPngGamaProperties { + WICPngGamaGamma = 0x1, +}} +ENUM!{enum WICPngBkgdProperties { + WICPngBkgdBackgroundColor = 0x1, +}} +ENUM!{enum WICPngItxtProperties { + WICPngItxtKeyword = 0x1, + WICPngItxtCompressionFlag = 0x2, + WICPngItxtLanguageTag = 0x3, + WICPngItxtTranslatedKeyword = 0x4, + WICPngItxtText = 0x5, +}} +ENUM!{enum WICPngChrmProperties { + WICPngChrmWhitePointX = 0x1, + WICPngChrmWhitePointY = 0x2, + WICPngChrmRedX = 0x3, + WICPngChrmRedY = 0x4, + WICPngChrmGreenX = 0x5, + WICPngChrmGreenY = 0x6, + WICPngChrmBlueX = 0x7, + WICPngChrmBlueY = 0x8, +}} +ENUM!{enum WICPngHistProperties { + WICPngHistFrequencies = 0x1, +}} +ENUM!{enum WICPngIccpProperties { + WICPngIccpProfileName = 0x1, + WICPngIccpProfileData = 0x2, +}} +ENUM!{enum WICPngSrgbProperties { + WICPngSrgbRenderingIntent = 0x1, +}} +ENUM!{enum WICPngTimeProperties { + WICPngTimeYear = 0x1, + WICPngTimeMonth = 0x2, + WICPngTimeDay = 0x3, + WICPngTimeHour = 0x4, + WICPngTimeMinute = 0x5, + WICPngTimeSecond = 0x6, +}} +ENUM!{enum WICSectionAccessLevel { + WICSectionAccessLevelRead = 0x1, + WICSectionAccessLevelReadWrite = 0x3, +}} +ENUM!{enum WICPixelFormatNumericRepresentation { + WICPixelFormatNumericRepresentationUnspecified = 0, + WICPixelFormatNumericRepresentationIndexed = 0x1, + WICPixelFormatNumericRepresentationUnsignedInteger = 0x2, + WICPixelFormatNumericRepresentationSignedInteger = 0x3, + WICPixelFormatNumericRepresentationFixed = 0x4, + WICPixelFormatNumericRepresentationFloat = 0x5, +}} +ENUM!{enum WICPlanarOptions { + WICPlanarOptionsDefault = 0, + WICPlanarOptionsPreserveSubsampling = 0x1, +}} +#[allow(unused_qualifications)] +STRUCT!{struct WICImageParameters { + PixelFormat: ::D2D1_PIXEL_FORMAT, + DpiX: ::FLOAT, + DpiY: ::FLOAT, + Top: ::FLOAT, + Left: ::FLOAT, + PixelWidth: ::FLOAT, + PixelHeight: ::FLOAT, +}} +#[allow(unused_qualifications)] +STRUCT!{struct WICBitmapPlaneDescription { + Format: WICPixelFormatGUID, + Width: ::UINT, + Height: ::UINT, +}} +#[allow(unused_qualifications)] +STRUCT!{struct WICBitmapPlane { + Format: WICPixelFormatGUID, + pbBuffer: *mut ::BYTE, + cbStride: ::UINT, + cbBufferSize: ::UINT, +}} +RIDL!( +interface IWICPalette(IWICPaletteVtbl): IUnknown(IUnknownVtbl) { + fn InitializePredefined( + &mut self, ePaletteType: WICBitmapPaletteType, fAddTransparentColor: ::BOOL + ) -> ::HRESULT, + fn InitializeCustom(&mut self, pColors: *mut WICColor, cCount: ::UINT) -> ::HRESULT, + fn InitializeFromBitmap( + &mut self, pISurface: *mut IWICBitmapSource, cCount: ::UINT, fAddTransparentColor: ::BOOL + ) -> ::HRESULT, + fn InitializeFromPalette(&mut self, pIPalette: *mut IWICPalette) -> ::HRESULT, + fn GetType(&mut self, pePaletteType: *mut WICBitmapPaletteType) -> ::HRESULT, + fn GetColorCount(&mut self, pcCount: *mut ::UINT) -> ::HRESULT, + fn GetColors( + &mut self, cCount: ::UINT, pColros: *mut WICColor, pcActualColors: *mut ::UINT + ) -> ::HRESULT, + fn IsBlackWhite(&mut self, pfIsBlackWhite: *mut ::BOOL) -> ::HRESULT, + fn IsGrayscale(&mut self, pfIsGrayscale: *mut ::BOOL) -> ::HRESULT, + fn HasAlpha(&mut self, pfHasAlpha: *mut ::BOOL) -> ::HRESULT +}); +RIDL!( +interface IWICBitmapSource(IWICBitmapSourceVtbl): IUnknown(IUnknownVtbl) { + fn GetSize(&mut self, puiWidth: *mut ::UINT, puiHeight: ::UINT) -> ::HRESULT, + fn GetPixelFormat(&mut self, pPixelFormat: *mut WICPixelFormatGUID) -> ::HRESULT, + fn GetResolution(&mut self, pDpiX: *mut f64, pDpiY: *mut f64) -> ::HRESULT, + fn CopyPalette(&mut self, pIPalette: *mut IWICPalette) -> ::HRESULT, + fn CopyPixels( + &mut self, prc: *const WICRect, cbStride: ::UINT, cbBufferSize: ::UINT, + pbBuffer: *mut ::BYTE + ) -> ::HRESULT +}); +RIDL!( +interface IWICFormatConverter(IWICFormatConverterVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + &mut self, pISource: *mut IWICBitmapSource, dstFormat: REFWICPixelFormatGUID, + dither: WICBitmapDitherType, pIPalette: *mut IWICPalette, alphaThreasholdPercent: f64, + paletteTranslate: WICBitmapPaletteType + ) -> ::HRESULT, + fn CanConvert( + &mut self, srcPixelFormat: REFWICPixelFormatGUID, dstPixelFormat: REFWICPixelFormatGUID, + pfCanConvert: *mut ::BOOL + ) -> ::HRESULT +}); +RIDL!( +interface IWICPlanarFormatConverter(IWICPlanarFormatConverterVtbl) + : IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + &mut self, ppPlanes: *mut *mut IWICBitmapSource, cPlanes: ::UINT, + dstFormat: REFWICPixelFormatGUID, dither: WICBitmapDitherType, pIPalette: *mut IWICPalette, + alphaThreasholdPercent: f64, paletteTranslate: WICBitmapPaletteType + ) -> ::HRESULT, + fn CanConvert( + &mut self, pSrcPixelFormats: *const WICPixelFormatGUID, cSrcPlanes: ::UINT, + dstPixelFormat: REFWICPixelFormatGUID, pfCanConvert: *mut ::BOOL + ) -> ::HRESULT +}); +RIDL!( +interface IWICBitmapScaler(IWICBitmapScalerVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + &mut self, pISource: *mut IWICBitmapSource, uiWidth: ::UINT, uiHeight: ::UINT, + mode: WICBitmapInterpolationMode + ) -> ::HRESULT +}); +RIDL!( +interface IWICBitmapClipper(IWICBitmapClipperVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize(&mut self, pISource: *mut IWICBitmapSource, prc: *const WICRect) -> ::HRESULT +}); +RIDL!( +interface IWICBitmapFlipRotator(IWICBitmapFlipRotatorVtbl) + : IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + &mut self, pISource: *mut IWICBitmapSource, options: WICBitmapTransformOptions + ) -> ::HRESULT +}); +RIDL!( +interface IWICBitmapLock(IWICBitmapLockVtbl): IUnknown(IUnknownVtbl) { + fn GetSize(&mut self, puiWidth: *mut ::UINT, puiHeight: *mut ::UINT) -> ::HRESULT, + fn GetStride(&mut self, pcbStride: *mut ::UINT) -> ::HRESULT, + fn GetDataPointer( + &mut self, pcbBufferSize: *mut ::UINT, ppbData: *mut WICInProcPointer + ) -> ::HRESULT, + fn GetPixelFormat(&mut self, pPixelFormat: *mut WICPixelFormatGUID) -> ::HRESULT +}); +RIDL!( +interface IWICBitmap(IWICBitmapVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Lock( + &mut self, prcLock: *const WICRect, flags: ::DWORD, ppILock: *mut *mut IWICBitmapLock + ) -> ::HRESULT, + fn SetPalette(&mut self, pIPalette: *mut IWICPalette) -> ::HRESULT, + fn SetResolution(&mut self, dpiX: f64, dpiY: f64) -> ::HRESULT +}); diff --git a/third_party/rust/winapi/src/windowsx.rs b/third_party/rust/winapi/src/windowsx.rs new file mode 100644 index 000000000000..0441e63a4090 --- /dev/null +++ b/third_party/rust/winapi/src/windowsx.rs @@ -0,0 +1,22 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Macro APIs, window message crackers, and control APIs +//1233 +pub fn GET_X_LPARAM(lp: ::LPARAM) -> ::c_int { + ::LOWORD(lp as ::DWORD) as ::c_short as ::c_int +} +pub fn GET_Y_LPARAM(lp: ::LPARAM) -> ::c_int { + ::HIWORD(lp as ::DWORD) as ::c_short as ::c_int +} +#[test] +fn test_get_x_lparam() { + assert_eq!(GET_X_LPARAM(0xDEAD1234u32 as ::LPARAM), 0x1234); + assert_eq!(GET_X_LPARAM(0xBEEFffffu32 as ::LPARAM), -1); + assert_eq!(GET_X_LPARAM(0xCAFEFB2Eu32 as ::LPARAM), -1234); +} +#[test] +fn test_get_y_lparam() { + assert_eq!(GET_Y_LPARAM(0x1234DEADu32 as ::LPARAM), 0x1234); + assert_eq!(GET_Y_LPARAM(0xffffBEEFu32 as ::LPARAM), -1); + assert_eq!(GET_Y_LPARAM(0xFB2ECAFEu32 as ::LPARAM), -1234); +} diff --git a/third_party/rust/winapi/src/winerror.rs b/third_party/rust/winapi/src/winerror.rs new file mode 100644 index 000000000000..6792cf852109 --- /dev/null +++ b/third_party/rust/winapi/src/winerror.rs @@ -0,0 +1,6065 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! error code definitions for the Win32 API functions +#[inline] +pub fn SUCCEEDED(hr: HRESULT) -> bool { + hr >= 0 +} +pub const FACILITY_XPS: HRESULT = 82; +pub const FACILITY_XAML: HRESULT = 43; +pub const FACILITY_USN: HRESULT = 129; +pub const FACILITY_BLBUI: HRESULT = 128; +pub const FACILITY_SPP: HRESULT = 256; +pub const FACILITY_WSB_ONLINE: HRESULT = 133; +pub const FACILITY_DLS: HRESULT = 153; +pub const FACILITY_BLB_CLI: HRESULT = 121; +pub const FACILITY_BLB: HRESULT = 120; +pub const FACILITY_WSBAPP: HRESULT = 122; +pub const FACILITY_WPN: HRESULT = 62; +pub const FACILITY_WMAAECMA: HRESULT = 1996; +pub const FACILITY_WINRM: HRESULT = 51; +pub const FACILITY_WINPE: HRESULT = 61; +pub const FACILITY_WINDOWSUPDATE: HRESULT = 36; +pub const FACILITY_WINDOWS_STORE: HRESULT = 63; +pub const FACILITY_WINDOWS_SETUP: HRESULT = 48; +pub const FACILITY_WINDOWS_DEFENDER: HRESULT = 80; +pub const FACILITY_WINDOWS_CE: HRESULT = 24; +pub const FACILITY_WINDOWS: HRESULT = 8; +pub const FACILITY_WINCODEC_DWRITE_DWM: HRESULT = 2200; +pub const FACILITY_WIA: HRESULT = 33; +pub const FACILITY_WER: HRESULT = 27; +pub const FACILITY_WEP: HRESULT = 2049; +pub const FACILITY_WEB_SOCKET: HRESULT = 886; +pub const FACILITY_WEB: HRESULT = 885; +pub const FACILITY_USERMODE_VOLSNAP: HRESULT = 130; +pub const FACILITY_USERMODE_VOLMGR: HRESULT = 56; +pub const FACILITY_VISUALCPP: HRESULT = 109; +pub const FACILITY_USERMODE_VIRTUALIZATION: HRESULT = 55; +pub const FACILITY_USERMODE_VHD: HRESULT = 58; +pub const FACILITY_URT: HRESULT = 19; +pub const FACILITY_UMI: HRESULT = 22; +pub const FACILITY_UI: HRESULT = 42; +pub const FACILITY_TPM_SOFTWARE: HRESULT = 41; +pub const FACILITY_TPM_SERVICES: HRESULT = 40; +pub const FACILITY_TIERING: HRESULT = 131; +pub const FACILITY_SYNCENGINE: HRESULT = 2050; +pub const FACILITY_SXS: HRESULT = 23; +pub const FACILITY_STORAGE: HRESULT = 3; +pub const FACILITY_STATE_MANAGEMENT: HRESULT = 34; +pub const FACILITY_SSPI: HRESULT = 9; +pub const FACILITY_USERMODE_SPACES: HRESULT = 231; +pub const FACILITY_SOS: HRESULT = 160; +pub const FACILITY_SCARD: HRESULT = 16; +pub const FACILITY_SHELL: HRESULT = 39; +pub const FACILITY_SETUPAPI: HRESULT = 15; +pub const FACILITY_SECURITY: HRESULT = 9; +pub const FACILITY_SDIAG: HRESULT = 60; +pub const FACILITY_USERMODE_SDBUS: HRESULT = 2305; +pub const FACILITY_RPC: HRESULT = 1; +pub const FACILITY_RESTORE: HRESULT = 256; +pub const FACILITY_SCRIPT: HRESULT = 112; +pub const FACILITY_PARSE: HRESULT = 113; +pub const FACILITY_RAS: HRESULT = 83; +pub const FACILITY_POWERSHELL: HRESULT = 84; +pub const FACILITY_PLA: HRESULT = 48; +pub const FACILITY_PIDGENX: HRESULT = 2561; +pub const FACILITY_P2P_INT: HRESULT = 98; +pub const FACILITY_P2P: HRESULT = 99; +pub const FACILITY_OPC: HRESULT = 81; +pub const FACILITY_ONLINE_ID: HRESULT = 134; +pub const FACILITY_WIN32: HRESULT = 7; +pub const FACILITY_CONTROL: HRESULT = 10; +pub const FACILITY_WEBSERVICES: HRESULT = 61; +pub const FACILITY_NULL: HRESULT = 0; +pub const FACILITY_NDIS: HRESULT = 52; +pub const FACILITY_NAP: HRESULT = 39; +pub const FACILITY_MOBILE: HRESULT = 1793; +pub const FACILITY_METADIRECTORY: HRESULT = 35; +pub const FACILITY_MSMQ: HRESULT = 14; +pub const FACILITY_MEDIASERVER: HRESULT = 13; +pub const FACILITY_MBN: HRESULT = 84; +pub const FACILITY_LINGUISTIC_SERVICES: HRESULT = 305; +pub const FACILITY_LEAP: HRESULT = 2184; +pub const FACILITY_JSCRIPT: HRESULT = 2306; +pub const FACILITY_INTERNET: HRESULT = 12; +pub const FACILITY_ITF: HRESULT = 4; +pub const FACILITY_INPUT: HRESULT = 64; +pub const FACILITY_USERMODE_HYPERVISOR: HRESULT = 53; +pub const FACILITY_ACCELERATOR: HRESULT = 1536; +pub const FACILITY_HTTP: HRESULT = 25; +pub const FACILITY_GRAPHICS: HRESULT = 38; +pub const FACILITY_FWP: HRESULT = 50; +pub const FACILITY_FVE: HRESULT = 49; +pub const FACILITY_USERMODE_FILTER_MANAGER: HRESULT = 31; +pub const FACILITY_EAS: HRESULT = 85; +pub const FACILITY_EAP: HRESULT = 66; +pub const FACILITY_DXGI_DDI: HRESULT = 2171; +pub const FACILITY_DXGI: HRESULT = 2170; +pub const FACILITY_DPLAY: HRESULT = 21; +pub const FACILITY_DMSERVER: HRESULT = 256; +pub const FACILITY_DISPATCH: HRESULT = 2; +pub const FACILITY_DIRECTORYSERVICE: HRESULT = 37; +pub const FACILITY_DIRECTMUSIC: HRESULT = 2168; +pub const FACILITY_DIRECT3D11: HRESULT = 2172; +pub const FACILITY_DIRECT3D10: HRESULT = 2169; +pub const FACILITY_DIRECT2D: HRESULT = 2201; +pub const FACILITY_DAF: HRESULT = 100; +pub const FACILITY_DEPLOYMENT_SERVICES_UTIL: HRESULT = 260; +pub const FACILITY_DEPLOYMENT_SERVICES_TRANSPORT_MANAGEMENT: HRESULT = 272; +pub const FACILITY_DEPLOYMENT_SERVICES_TFTP: HRESULT = 264; +pub const FACILITY_DEPLOYMENT_SERVICES_PXE: HRESULT = 263; +pub const FACILITY_DEPLOYMENT_SERVICES_MULTICAST_SERVER: HRESULT = 289; +pub const FACILITY_DEPLOYMENT_SERVICES_MULTICAST_CLIENT: HRESULT = 290; +pub const FACILITY_DEPLOYMENT_SERVICES_MANAGEMENT: HRESULT = 259; +pub const FACILITY_DEPLOYMENT_SERVICES_IMAGING: HRESULT = 258; +pub const FACILITY_DEPLOYMENT_SERVICES_DRIVER_PROVISIONING: HRESULT = 278; +pub const FACILITY_DEPLOYMENT_SERVICES_SERVER: HRESULT = 257; +pub const FACILITY_DEPLOYMENT_SERVICES_CONTENT_PROVIDER: HRESULT = 293; +pub const FACILITY_DEPLOYMENT_SERVICES_BINLSVC: HRESULT = 261; +pub const FACILITY_DEFRAG: HRESULT = 2304; +pub const FACILITY_DEBUGGERS: HRESULT = 176; +pub const FACILITY_CONFIGURATION: HRESULT = 33; +pub const FACILITY_COMPLUS: HRESULT = 17; +pub const FACILITY_USERMODE_COMMONLOG: HRESULT = 26; +pub const FACILITY_CMI: HRESULT = 54; +pub const FACILITY_CERT: HRESULT = 11; +pub const FACILITY_BLUETOOTH_ATT: HRESULT = 101; +pub const FACILITY_BCD: HRESULT = 57; +pub const FACILITY_BACKGROUNDCOPY: HRESULT = 32; +pub const FACILITY_AUDIOSTREAMING: HRESULT = 1094; +pub const FACILITY_AUDCLNT: HRESULT = 2185; +pub const FACILITY_AUDIO: HRESULT = 102; +pub const FACILITY_ACTION_QUEUE: HRESULT = 44; +pub const FACILITY_ACS: HRESULT = 20; +pub const FACILITY_AAF: HRESULT = 18; +pub const ERROR_SUCCESS: ::DWORD = 0; +pub const NO_ERROR: ::DWORD = 0; +pub const SEC_E_OK: HRESULT = 0; +pub const ERROR_INVALID_FUNCTION: ::DWORD = 1; +pub const ERROR_FILE_NOT_FOUND: ::DWORD = 2; +pub const ERROR_PATH_NOT_FOUND: ::DWORD = 3; +pub const ERROR_TOO_MANY_OPEN_FILES: ::DWORD = 4; +pub const ERROR_ACCESS_DENIED: ::DWORD = 5; +pub const ERROR_INVALID_HANDLE: ::DWORD = 6; +pub const ERROR_ARENA_TRASHED: ::DWORD = 7; +pub const ERROR_NOT_ENOUGH_MEMORY: ::DWORD = 8; +pub const ERROR_INVALID_BLOCK: ::DWORD = 9; +pub const ERROR_BAD_ENVIRONMENT: ::DWORD = 10; +pub const ERROR_BAD_FORMAT: ::DWORD = 11; +pub const ERROR_INVALID_ACCESS: ::DWORD = 12; +pub const ERROR_INVALID_DATA: ::DWORD = 13; +pub const ERROR_OUTOFMEMORY: ::DWORD = 14; +pub const ERROR_INVALID_DRIVE: ::DWORD = 15; +pub const ERROR_CURRENT_DIRECTORY: ::DWORD = 16; +pub const ERROR_NOT_SAME_DEVICE: ::DWORD = 17; +pub const ERROR_NO_MORE_FILES: ::DWORD = 18; +pub const ERROR_WRITE_PROTECT: ::DWORD = 19; +pub const ERROR_BAD_UNIT: ::DWORD = 20; +pub const ERROR_NOT_READY: ::DWORD = 21; +pub const ERROR_BAD_COMMAND: ::DWORD = 22; +pub const ERROR_CRC: ::DWORD = 23; +pub const ERROR_BAD_LENGTH: ::DWORD = 24; +pub const ERROR_SEEK: ::DWORD = 25; +pub const ERROR_NOT_DOS_DISK: ::DWORD = 26; +pub const ERROR_SECTOR_NOT_FOUND: ::DWORD = 27; +pub const ERROR_OUT_OF_PAPER: ::DWORD = 28; +pub const ERROR_WRITE_FAULT: ::DWORD = 29; +pub const ERROR_READ_FAULT: ::DWORD = 30; +pub const ERROR_GEN_FAILURE: ::DWORD = 31; +pub const ERROR_SHARING_VIOLATION: ::DWORD = 32; +pub const ERROR_LOCK_VIOLATION: ::DWORD = 33; +pub const ERROR_WRONG_DISK: ::DWORD = 34; +pub const ERROR_SHARING_BUFFER_EXCEEDED: ::DWORD = 36; +pub const ERROR_HANDLE_EOF: ::DWORD = 38; +pub const ERROR_HANDLE_DISK_FULL: ::DWORD = 39; +pub const ERROR_NOT_SUPPORTED: ::DWORD = 50; +pub const ERROR_REM_NOT_LIST: ::DWORD = 51; +pub const ERROR_DUP_NAME: ::DWORD = 52; +pub const ERROR_BAD_NETPATH: ::DWORD = 53; +pub const ERROR_NETWORK_BUSY: ::DWORD = 54; +pub const ERROR_DEV_NOT_EXIST: ::DWORD = 55; +pub const ERROR_TOO_MANY_CMDS: ::DWORD = 56; +pub const ERROR_ADAP_HDW_ERR: ::DWORD = 57; +pub const ERROR_BAD_NET_RESP: ::DWORD = 58; +pub const ERROR_UNEXP_NET_ERR: ::DWORD = 59; +pub const ERROR_BAD_REM_ADAP: ::DWORD = 60; +pub const ERROR_PRINTQ_FULL: ::DWORD = 61; +pub const ERROR_NO_SPOOL_SPACE: ::DWORD = 62; +pub const ERROR_PRINT_CANCELLED: ::DWORD = 63; +pub const ERROR_NETNAME_DELETED: ::DWORD = 64; +pub const ERROR_NETWORK_ACCESS_DENIED: ::DWORD = 65; +pub const ERROR_BAD_DEV_TYPE: ::DWORD = 66; +pub const ERROR_BAD_NET_NAME: ::DWORD = 67; +pub const ERROR_TOO_MANY_NAMES: ::DWORD = 68; +pub const ERROR_TOO_MANY_SESS: ::DWORD = 69; +pub const ERROR_SHARING_PAUSED: ::DWORD = 70; +pub const ERROR_REQ_NOT_ACCEP: ::DWORD = 71; +pub const ERROR_REDIR_PAUSED: ::DWORD = 72; +pub const ERROR_FILE_EXISTS: ::DWORD = 80; +pub const ERROR_CANNOT_MAKE: ::DWORD = 82; +pub const ERROR_FAIL_I24: ::DWORD = 83; +pub const ERROR_OUT_OF_STRUCTURES: ::DWORD = 84; +pub const ERROR_ALREADY_ASSIGNED: ::DWORD = 85; +pub const ERROR_INVALID_PASSWORD: ::DWORD = 86; +pub const ERROR_INVALID_PARAMETER: ::DWORD = 87; +pub const ERROR_NET_WRITE_FAULT: ::DWORD = 88; +pub const ERROR_NO_PROC_SLOTS: ::DWORD = 89; +pub const ERROR_TOO_MANY_SEMAPHORES: ::DWORD = 100; +pub const ERROR_EXCL_SEM_ALREADY_OWNED: ::DWORD = 101; +pub const ERROR_SEM_IS_SET: ::DWORD = 102; +pub const ERROR_TOO_MANY_SEM_REQUESTS: ::DWORD = 103; +pub const ERROR_INVALID_AT_INTERRUPT_TIME: ::DWORD = 104; +pub const ERROR_SEM_OWNER_DIED: ::DWORD = 105; +pub const ERROR_SEM_USER_LIMIT: ::DWORD = 106; +pub const ERROR_DISK_CHANGE: ::DWORD = 107; +pub const ERROR_DRIVE_LOCKED: ::DWORD = 108; +pub const ERROR_BROKEN_PIPE: ::DWORD = 109; +pub const ERROR_OPEN_FAILED: ::DWORD = 110; +pub const ERROR_BUFFER_OVERFLOW: ::DWORD = 111; +pub const ERROR_DISK_FULL: ::DWORD = 112; +pub const ERROR_NO_MORE_SEARCH_HANDLES: ::DWORD = 113; +pub const ERROR_INVALID_TARGET_HANDLE: ::DWORD = 114; +pub const ERROR_INVALID_CATEGORY: ::DWORD = 117; +pub const ERROR_INVALID_VERIFY_SWITCH: ::DWORD = 118; +pub const ERROR_BAD_DRIVER_LEVEL: ::DWORD = 119; +pub const ERROR_CALL_NOT_IMPLEMENTED: ::DWORD = 120; +pub const ERROR_SEM_TIMEOUT: ::DWORD = 121; +pub const ERROR_INSUFFICIENT_BUFFER: ::DWORD = 122; +pub const ERROR_INVALID_NAME: ::DWORD = 123; +pub const ERROR_INVALID_LEVEL: ::DWORD = 124; +pub const ERROR_NO_VOLUME_LABEL: ::DWORD = 125; +pub const ERROR_MOD_NOT_FOUND: ::DWORD = 126; +pub const ERROR_PROC_NOT_FOUND: ::DWORD = 127; +pub const ERROR_WAIT_NO_CHILDREN: ::DWORD = 128; +pub const ERROR_CHILD_NOT_COMPLETE: ::DWORD = 129; +pub const ERROR_DIRECT_ACCESS_HANDLE: ::DWORD = 130; +pub const ERROR_NEGATIVE_SEEK: ::DWORD = 131; +pub const ERROR_SEEK_ON_DEVICE: ::DWORD = 132; +pub const ERROR_IS_JOIN_TARGET: ::DWORD = 133; +pub const ERROR_IS_JOINED: ::DWORD = 134; +pub const ERROR_IS_SUBSTED: ::DWORD = 135; +pub const ERROR_NOT_JOINED: ::DWORD = 136; +pub const ERROR_NOT_SUBSTED: ::DWORD = 137; +pub const ERROR_JOIN_TO_JOIN: ::DWORD = 138; +pub const ERROR_SUBST_TO_SUBST: ::DWORD = 139; +pub const ERROR_JOIN_TO_SUBST: ::DWORD = 140; +pub const ERROR_SUBST_TO_JOIN: ::DWORD = 141; +pub const ERROR_BUSY_DRIVE: ::DWORD = 142; +pub const ERROR_SAME_DRIVE: ::DWORD = 143; +pub const ERROR_DIR_NOT_ROOT: ::DWORD = 144; +pub const ERROR_DIR_NOT_EMPTY: ::DWORD = 145; +pub const ERROR_IS_SUBST_PATH: ::DWORD = 146; +pub const ERROR_IS_JOIN_PATH: ::DWORD = 147; +pub const ERROR_PATH_BUSY: ::DWORD = 148; +pub const ERROR_IS_SUBST_TARGET: ::DWORD = 149; +pub const ERROR_SYSTEM_TRACE: ::DWORD = 150; +pub const ERROR_INVALID_EVENT_COUNT: ::DWORD = 151; +pub const ERROR_TOO_MANY_MUXWAITERS: ::DWORD = 152; +pub const ERROR_INVALID_LIST_FORMAT: ::DWORD = 153; +pub const ERROR_LABEL_TOO_LONG: ::DWORD = 154; +pub const ERROR_TOO_MANY_TCBS: ::DWORD = 155; +pub const ERROR_SIGNAL_REFUSED: ::DWORD = 156; +pub const ERROR_DISCARDED: ::DWORD = 157; +pub const ERROR_NOT_LOCKED: ::DWORD = 158; +pub const ERROR_BAD_THREADID_ADDR: ::DWORD = 159; +pub const ERROR_BAD_ARGUMENTS: ::DWORD = 160; +pub const ERROR_BAD_PATHNAME: ::DWORD = 161; +pub const ERROR_SIGNAL_PENDING: ::DWORD = 162; +pub const ERROR_MAX_THRDS_REACHED: ::DWORD = 164; +pub const ERROR_LOCK_FAILED: ::DWORD = 167; +pub const ERROR_BUSY: ::DWORD = 170; +pub const ERROR_DEVICE_SUPPORT_IN_PROGRESS: ::DWORD = 171; +pub const ERROR_CANCEL_VIOLATION: ::DWORD = 173; +pub const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: ::DWORD = 174; +pub const ERROR_INVALID_SEGMENT_NUMBER: ::DWORD = 180; +pub const ERROR_INVALID_ORDINAL: ::DWORD = 182; +pub const ERROR_ALREADY_EXISTS: ::DWORD = 183; +pub const ERROR_INVALID_FLAG_NUMBER: ::DWORD = 186; +pub const ERROR_SEM_NOT_FOUND: ::DWORD = 187; +pub const ERROR_INVALID_STARTING_CODESEG: ::DWORD = 188; +pub const ERROR_INVALID_STACKSEG: ::DWORD = 189; +pub const ERROR_INVALID_MODULETYPE: ::DWORD = 190; +pub const ERROR_INVALID_EXE_SIGNATURE: ::DWORD = 191; +pub const ERROR_EXE_MARKED_INVALID: ::DWORD = 192; +pub const ERROR_BAD_EXE_FORMAT: ::DWORD = 193; +pub const ERROR_ITERATED_DATA_EXCEEDS_64k: ::DWORD = 194; +pub const ERROR_INVALID_MINALLOCSIZE: ::DWORD = 195; +pub const ERROR_DYNLINK_FROM_INVALID_RING: ::DWORD = 196; +pub const ERROR_IOPL_NOT_ENABLED: ::DWORD = 197; +pub const ERROR_INVALID_SEGDPL: ::DWORD = 198; +pub const ERROR_AUTODATASEG_EXCEEDS_64k: ::DWORD = 199; +pub const ERROR_RING2SEG_MUST_BE_MOVABLE: ::DWORD = 200; +pub const ERROR_RELOC_CHAIN_XEEDS_SEGLIM: ::DWORD = 201; +pub const ERROR_INFLOOP_IN_RELOC_CHAIN: ::DWORD = 202; +pub const ERROR_ENVVAR_NOT_FOUND: ::DWORD = 203; +pub const ERROR_NO_SIGNAL_SENT: ::DWORD = 205; +pub const ERROR_FILENAME_EXCED_RANGE: ::DWORD = 206; +pub const ERROR_RING2_STACK_IN_USE: ::DWORD = 207; +pub const ERROR_META_EXPANSION_TOO_LONG: ::DWORD = 208; +pub const ERROR_INVALID_SIGNAL_NUMBER: ::DWORD = 209; +pub const ERROR_THREAD_1_INACTIVE: ::DWORD = 210; +pub const ERROR_LOCKED: ::DWORD = 212; +pub const ERROR_TOO_MANY_MODULES: ::DWORD = 214; +pub const ERROR_NESTING_NOT_ALLOWED: ::DWORD = 215; +pub const ERROR_EXE_MACHINE_TYPE_MISMATCH: ::DWORD = 216; +pub const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: ::DWORD = 217; +pub const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: ::DWORD = 218; +pub const ERROR_FILE_CHECKED_OUT: ::DWORD = 220; +pub const ERROR_CHECKOUT_REQUIRED: ::DWORD = 221; +pub const ERROR_BAD_FILE_TYPE: ::DWORD = 222; +pub const ERROR_FILE_TOO_LARGE: ::DWORD = 223; +pub const ERROR_FORMS_AUTH_REQUIRED: ::DWORD = 224; +pub const ERROR_VIRUS_INFECTED: ::DWORD = 225; +pub const ERROR_VIRUS_DELETED: ::DWORD = 226; +pub const ERROR_PIPE_LOCAL: ::DWORD = 229; +pub const ERROR_BAD_PIPE: ::DWORD = 230; +pub const ERROR_PIPE_BUSY: ::DWORD = 231; +pub const ERROR_NO_DATA: ::DWORD = 232; +pub const ERROR_PIPE_NOT_CONNECTED: ::DWORD = 233; +pub const ERROR_MORE_DATA: ::DWORD = 234; +pub const ERROR_VC_DISCONNECTED: ::DWORD = 240; +pub const ERROR_INVALID_EA_NAME: ::DWORD = 254; +pub const ERROR_EA_LIST_INCONSISTENT: ::DWORD = 255; +pub const WAIT_TIMEOUT: ::DWORD = 258; +pub const ERROR_NO_MORE_ITEMS: ::DWORD = 259; +pub const ERROR_CANNOT_COPY: ::DWORD = 266; +pub const ERROR_DIRECTORY: ::DWORD = 267; +pub const ERROR_EAS_DIDNT_FIT: ::DWORD = 275; +pub const ERROR_EA_FILE_CORRUPT: ::DWORD = 276; +pub const ERROR_EA_TABLE_FULL: ::DWORD = 277; +pub const ERROR_INVALID_EA_HANDLE: ::DWORD = 278; +pub const ERROR_EAS_NOT_SUPPORTED: ::DWORD = 282; +pub const ERROR_NOT_OWNER: ::DWORD = 288; +pub const ERROR_TOO_MANY_POSTS: ::DWORD = 298; +pub const ERROR_PARTIAL_COPY: ::DWORD = 299; +pub const ERROR_OPLOCK_NOT_GRANTED: ::DWORD = 300; +pub const ERROR_INVALID_OPLOCK_PROTOCOL: ::DWORD = 301; +pub const ERROR_DISK_TOO_FRAGMENTED: ::DWORD = 302; +pub const ERROR_DELETE_PENDING: ::DWORD = 303; +pub const ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: ::DWORD = 304; +pub const ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: ::DWORD = 305; +pub const ERROR_SECURITY_STREAM_IS_INCONSISTENT: ::DWORD = 306; +pub const ERROR_INVALID_LOCK_RANGE: ::DWORD = 307; +pub const ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT: ::DWORD = 308; +pub const ERROR_NOTIFICATION_GUID_ALREADY_DEFINED: ::DWORD = 309; +pub const ERROR_INVALID_EXCEPTION_HANDLER: ::DWORD = 310; +pub const ERROR_DUPLICATE_PRIVILEGES: ::DWORD = 311; +pub const ERROR_NO_RANGES_PROCESSED: ::DWORD = 312; +pub const ERROR_NOT_ALLOWED_ON_SYSTEM_FILE: ::DWORD = 313; +pub const ERROR_DISK_RESOURCES_EXHAUSTED: ::DWORD = 314; +pub const ERROR_INVALID_TOKEN: ::DWORD = 315; +pub const ERROR_DEVICE_FEATURE_NOT_SUPPORTED: ::DWORD = 316; +pub const ERROR_MR_MID_NOT_FOUND: ::DWORD = 317; +pub const ERROR_SCOPE_NOT_FOUND: ::DWORD = 318; +pub const ERROR_UNDEFINED_SCOPE: ::DWORD = 319; +pub const ERROR_INVALID_CAP: ::DWORD = 320; +pub const ERROR_DEVICE_UNREACHABLE: ::DWORD = 321; +pub const ERROR_DEVICE_NO_RESOURCES: ::DWORD = 322; +pub const ERROR_DATA_CHECKSUM_ERROR: ::DWORD = 323; +pub const ERROR_INTERMIXED_KERNEL_EA_OPERATION: ::DWORD = 324; +pub const ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED: ::DWORD = 326; +pub const ERROR_OFFSET_ALIGNMENT_VIOLATION: ::DWORD = 327; +pub const ERROR_INVALID_FIELD_IN_PARAMETER_LIST: ::DWORD = 328; +pub const ERROR_OPERATION_IN_PROGRESS: ::DWORD = 329; +pub const ERROR_BAD_DEVICE_PATH: ::DWORD = 330; +pub const ERROR_TOO_MANY_DESCRIPTORS: ::DWORD = 331; +pub const ERROR_SCRUB_DATA_DISABLED: ::DWORD = 332; +pub const ERROR_NOT_REDUNDANT_STORAGE: ::DWORD = 333; +pub const ERROR_RESIDENT_FILE_NOT_SUPPORTED: ::DWORD = 334; +pub const ERROR_COMPRESSED_FILE_NOT_SUPPORTED: ::DWORD = 335; +pub const ERROR_DIRECTORY_NOT_SUPPORTED: ::DWORD = 336; +pub const ERROR_NOT_READ_FROM_COPY: ::DWORD = 337; +pub const ERROR_FT_WRITE_FAILURE: ::DWORD = 338; +pub const ERROR_FT_DI_SCAN_REQUIRED: ::DWORD = 339; +pub const ERROR_INVALID_KERNEL_INFO_VERSION: ::DWORD = 340; +pub const ERROR_INVALID_PEP_INFO_VERSION: ::DWORD = 341; +pub const ERROR_OBJECT_NOT_EXTERNALLY_BACKED: ::DWORD = 342; +pub const ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN: ::DWORD = 343; +pub const ERROR_FAIL_NOACTION_REBOOT: ::DWORD = 350; +pub const ERROR_FAIL_SHUTDOWN: ::DWORD = 351; +pub const ERROR_FAIL_RESTART: ::DWORD = 352; +pub const ERROR_MAX_SESSIONS_REACHED: ::DWORD = 353; +pub const ERROR_THREAD_MODE_ALREADY_BACKGROUND: ::DWORD = 400; +pub const ERROR_THREAD_MODE_NOT_BACKGROUND: ::DWORD = 401; +pub const ERROR_PROCESS_MODE_ALREADY_BACKGROUND: ::DWORD = 402; +pub const ERROR_PROCESS_MODE_NOT_BACKGROUND: ::DWORD = 403; +pub const ERROR_DEVICE_HARDWARE_ERROR: ::DWORD = 483; +pub const ERROR_INVALID_ADDRESS: ::DWORD = 487; +pub const ERROR_USER_PROFILE_LOAD: ::DWORD = 500; +pub const ERROR_ARITHMETIC_OVERFLOW: ::DWORD = 534; +pub const ERROR_PIPE_CONNECTED: ::DWORD = 535; +pub const ERROR_PIPE_LISTENING: ::DWORD = 536; +pub const ERROR_VERIFIER_STOP: ::DWORD = 537; +pub const ERROR_ABIOS_ERROR: ::DWORD = 538; +pub const ERROR_WX86_WARNING: ::DWORD = 539; +pub const ERROR_WX86_ERROR: ::DWORD = 540; +pub const ERROR_TIMER_NOT_CANCELED: ::DWORD = 541; +pub const ERROR_UNWIND: ::DWORD = 542; +pub const ERROR_BAD_STACK: ::DWORD = 543; +pub const ERROR_INVALID_UNWIND_TARGET: ::DWORD = 544; +pub const ERROR_INVALID_PORT_ATTRIBUTES: ::DWORD = 545; +pub const ERROR_PORT_MESSAGE_TOO_LONG: ::DWORD = 546; +pub const ERROR_INVALID_QUOTA_LOWER: ::DWORD = 547; +pub const ERROR_DEVICE_ALREADY_ATTACHED: ::DWORD = 548; +pub const ERROR_INSTRUCTION_MISALIGNMENT: ::DWORD = 549; +pub const ERROR_PROFILING_NOT_STARTED: ::DWORD = 550; +pub const ERROR_PROFILING_NOT_STOPPED: ::DWORD = 551; +pub const ERROR_COULD_NOT_INTERPRET: ::DWORD = 552; +pub const ERROR_PROFILING_AT_LIMIT: ::DWORD = 553; +pub const ERROR_CANT_WAIT: ::DWORD = 554; +pub const ERROR_CANT_TERMINATE_SELF: ::DWORD = 555; +pub const ERROR_UNEXPECTED_MM_CREATE_ERR: ::DWORD = 556; +pub const ERROR_UNEXPECTED_MM_MAP_ERROR: ::DWORD = 557; +pub const ERROR_UNEXPECTED_MM_EXTEND_ERR: ::DWORD = 558; +pub const ERROR_BAD_FUNCTION_TABLE: ::DWORD = 559; +pub const ERROR_NO_GUID_TRANSLATION: ::DWORD = 560; +pub const ERROR_INVALID_LDT_SIZE: ::DWORD = 561; +pub const ERROR_INVALID_LDT_OFFSET: ::DWORD = 563; +pub const ERROR_INVALID_LDT_DESCRIPTOR: ::DWORD = 564; +pub const ERROR_TOO_MANY_THREADS: ::DWORD = 565; +pub const ERROR_THREAD_NOT_IN_PROCESS: ::DWORD = 566; +pub const ERROR_PAGEFILE_QUOTA_EXCEEDED: ::DWORD = 567; +pub const ERROR_LOGON_SERVER_CONFLICT: ::DWORD = 568; +pub const ERROR_SYNCHRONIZATION_REQUIRED: ::DWORD = 569; +pub const ERROR_NET_OPEN_FAILED: ::DWORD = 570; +pub const ERROR_IO_PRIVILEGE_FAILED: ::DWORD = 571; +pub const ERROR_CONTROL_C_EXIT: ::DWORD = 572; +pub const ERROR_MISSING_SYSTEMFILE: ::DWORD = 573; +pub const ERROR_UNHANDLED_EXCEPTION: ::DWORD = 574; +pub const ERROR_APP_INIT_FAILURE: ::DWORD = 575; +pub const ERROR_PAGEFILE_CREATE_FAILED: ::DWORD = 576; +pub const ERROR_INVALID_IMAGE_HASH: ::DWORD = 577; +pub const ERROR_NO_PAGEFILE: ::DWORD = 578; +pub const ERROR_ILLEGAL_FLOAT_CONTEXT: ::DWORD = 579; +pub const ERROR_NO_EVENT_PAIR: ::DWORD = 580; +pub const ERROR_DOMAIN_CTRLR_CONFIG_ERROR: ::DWORD = 581; +pub const ERROR_ILLEGAL_CHARACTER: ::DWORD = 582; +pub const ERROR_UNDEFINED_CHARACTER: ::DWORD = 583; +pub const ERROR_FLOPPY_VOLUME: ::DWORD = 584; +pub const ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT: ::DWORD = 585; +pub const ERROR_BACKUP_CONTROLLER: ::DWORD = 586; +pub const ERROR_MUTANT_LIMIT_EXCEEDED: ::DWORD = 587; +pub const ERROR_FS_DRIVER_REQUIRED: ::DWORD = 588; +pub const ERROR_CANNOT_LOAD_REGISTRY_FILE: ::DWORD = 589; +pub const ERROR_DEBUG_ATTACH_FAILED: ::DWORD = 590; +pub const ERROR_SYSTEM_PROCESS_TERMINATED: ::DWORD = 591; +pub const ERROR_DATA_NOT_ACCEPTED: ::DWORD = 592; +pub const ERROR_VDM_HARD_ERROR: ::DWORD = 593; +pub const ERROR_DRIVER_CANCEL_TIMEOUT: ::DWORD = 594; +pub const ERROR_REPLY_MESSAGE_MISMATCH: ::DWORD = 595; +pub const ERROR_LOST_WRITEBEHIND_DATA: ::DWORD = 596; +pub const ERROR_CLIENT_SERVER_PARAMETERS_INVALID: ::DWORD = 597; +pub const ERROR_NOT_TINY_STREAM: ::DWORD = 598; +pub const ERROR_STACK_OVERFLOW_READ: ::DWORD = 599; +pub const ERROR_CONVERT_TO_LARGE: ::DWORD = 600; +pub const ERROR_FOUND_OUT_OF_SCOPE: ::DWORD = 601; +pub const ERROR_ALLOCATE_BUCKET: ::DWORD = 602; +pub const ERROR_MARSHALL_OVERFLOW: ::DWORD = 603; +pub const ERROR_INVALID_VARIANT: ::DWORD = 604; +pub const ERROR_BAD_COMPRESSION_BUFFER: ::DWORD = 605; +pub const ERROR_AUDIT_FAILED: ::DWORD = 606; +pub const ERROR_TIMER_RESOLUTION_NOT_SET: ::DWORD = 607; +pub const ERROR_INSUFFICIENT_LOGON_INFO: ::DWORD = 608; +pub const ERROR_BAD_DLL_ENTRYPOINT: ::DWORD = 609; +pub const ERROR_BAD_SERVICE_ENTRYPOINT: ::DWORD = 610; +pub const ERROR_IP_ADDRESS_CONFLICT1: ::DWORD = 611; +pub const ERROR_IP_ADDRESS_CONFLICT2: ::DWORD = 612; +pub const ERROR_REGISTRY_QUOTA_LIMIT: ::DWORD = 613; +pub const ERROR_NO_CALLBACK_ACTIVE: ::DWORD = 614; +pub const ERROR_PWD_TOO_SHORT: ::DWORD = 615; +pub const ERROR_PWD_TOO_RECENT: ::DWORD = 616; +pub const ERROR_PWD_HISTORY_CONFLICT: ::DWORD = 617; +pub const ERROR_UNSUPPORTED_COMPRESSION: ::DWORD = 618; +pub const ERROR_INVALID_HW_PROFILE: ::DWORD = 619; +pub const ERROR_INVALID_PLUGPLAY_DEVICE_PATH: ::DWORD = 620; +pub const ERROR_QUOTA_LIST_INCONSISTENT: ::DWORD = 621; +pub const ERROR_EVALUATION_EXPIRATION: ::DWORD = 622; +pub const ERROR_ILLEGAL_DLL_RELOCATION: ::DWORD = 623; +pub const ERROR_DLL_INIT_FAILED_LOGOFF: ::DWORD = 624; +pub const ERROR_VALIDATE_CONTINUE: ::DWORD = 625; +pub const ERROR_NO_MORE_MATCHES: ::DWORD = 626; +pub const ERROR_RANGE_LIST_CONFLICT: ::DWORD = 627; +pub const ERROR_SERVER_SID_MISMATCH: ::DWORD = 628; +pub const ERROR_CANT_ENABLE_DENY_ONLY: ::DWORD = 629; +pub const ERROR_FLOAT_MULTIPLE_FAULTS: ::DWORD = 630; +pub const ERROR_FLOAT_MULTIPLE_TRAPS: ::DWORD = 631; +pub const ERROR_NOINTERFACE: ::DWORD = 632; +pub const ERROR_DRIVER_FAILED_SLEEP: ::DWORD = 633; +pub const ERROR_CORRUPT_SYSTEM_FILE: ::DWORD = 634; +pub const ERROR_COMMITMENT_MINIMUM: ::DWORD = 635; +pub const ERROR_PNP_RESTART_ENUMERATION: ::DWORD = 636; +pub const ERROR_SYSTEM_IMAGE_BAD_SIGNATURE: ::DWORD = 637; +pub const ERROR_PNP_REBOOT_REQUIRED: ::DWORD = 638; +pub const ERROR_INSUFFICIENT_POWER: ::DWORD = 639; +pub const ERROR_MULTIPLE_FAULT_VIOLATION: ::DWORD = 640; +pub const ERROR_SYSTEM_SHUTDOWN: ::DWORD = 641; +pub const ERROR_PORT_NOT_SET: ::DWORD = 642; +pub const ERROR_DS_VERSION_CHECK_FAILURE: ::DWORD = 643; +pub const ERROR_RANGE_NOT_FOUND: ::DWORD = 644; +pub const ERROR_NOT_SAFE_MODE_DRIVER: ::DWORD = 646; +pub const ERROR_FAILED_DRIVER_ENTRY: ::DWORD = 647; +pub const ERROR_DEVICE_ENUMERATION_ERROR: ::DWORD = 648; +pub const ERROR_MOUNT_POINT_NOT_RESOLVED: ::DWORD = 649; +pub const ERROR_INVALID_DEVICE_OBJECT_PARAMETER: ::DWORD = 650; +pub const ERROR_MCA_OCCURED: ::DWORD = 651; +pub const ERROR_DRIVER_DATABASE_ERROR: ::DWORD = 652; +pub const ERROR_SYSTEM_HIVE_TOO_LARGE: ::DWORD = 653; +pub const ERROR_DRIVER_FAILED_PRIOR_UNLOAD: ::DWORD = 654; +pub const ERROR_VOLSNAP_PREPARE_HIBERNATE: ::DWORD = 655; +pub const ERROR_HIBERNATION_FAILURE: ::DWORD = 656; +pub const ERROR_PWD_TOO_LONG: ::DWORD = 657; +pub const ERROR_FILE_SYSTEM_LIMITATION: ::DWORD = 665; +pub const ERROR_ASSERTION_FAILURE: ::DWORD = 668; +pub const ERROR_ACPI_ERROR: ::DWORD = 669; +pub const ERROR_WOW_ASSERTION: ::DWORD = 670; +pub const ERROR_PNP_BAD_MPS_TABLE: ::DWORD = 671; +pub const ERROR_PNP_TRANSLATION_FAILED: ::DWORD = 672; +pub const ERROR_PNP_IRQ_TRANSLATION_FAILED: ::DWORD = 673; +pub const ERROR_PNP_INVALID_ID: ::DWORD = 674; +pub const ERROR_WAKE_SYSTEM_DEBUGGER: ::DWORD = 675; +pub const ERROR_HANDLES_CLOSED: ::DWORD = 676; +pub const ERROR_EXTRANEOUS_INFORMATION: ::DWORD = 677; +pub const ERROR_RXACT_COMMIT_NECESSARY: ::DWORD = 678; +pub const ERROR_MEDIA_CHECK: ::DWORD = 679; +pub const ERROR_GUID_SUBSTITUTION_MADE: ::DWORD = 680; +pub const ERROR_STOPPED_ON_SYMLINK: ::DWORD = 681; +pub const ERROR_LONGJUMP: ::DWORD = 682; +pub const ERROR_PLUGPLAY_QUERY_VETOED: ::DWORD = 683; +pub const ERROR_UNWIND_CONSOLIDATE: ::DWORD = 684; +pub const ERROR_REGISTRY_HIVE_RECOVERED: ::DWORD = 685; +pub const ERROR_DLL_MIGHT_BE_INSECURE: ::DWORD = 686; +pub const ERROR_DLL_MIGHT_BE_INCOMPATIBLE: ::DWORD = 687; +pub const ERROR_DBG_EXCEPTION_NOT_HANDLED: ::DWORD = 688; +pub const ERROR_DBG_REPLY_LATER: ::DWORD = 689; +pub const ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE: ::DWORD = 690; +pub const ERROR_DBG_TERMINATE_THREAD: ::DWORD = 691; +pub const ERROR_DBG_TERMINATE_PROCESS: ::DWORD = 692; +pub const ERROR_DBG_CONTROL_C: ::DWORD = 693; +pub const ERROR_DBG_PRINTEXCEPTION_C: ::DWORD = 694; +pub const ERROR_DBG_RIPEXCEPTION: ::DWORD = 695; +pub const ERROR_DBG_CONTROL_BREAK: ::DWORD = 696; +pub const ERROR_DBG_COMMAND_EXCEPTION: ::DWORD = 697; +pub const ERROR_OBJECT_NAME_EXISTS: ::DWORD = 698; +pub const ERROR_THREAD_WAS_SUSPENDED: ::DWORD = 699; +pub const ERROR_IMAGE_NOT_AT_BASE: ::DWORD = 700; +pub const ERROR_RXACT_STATE_CREATED: ::DWORD = 701; +pub const ERROR_SEGMENT_NOTIFICATION: ::DWORD = 702; +pub const ERROR_BAD_CURRENT_DIRECTORY: ::DWORD = 703; +pub const ERROR_FT_READ_RECOVERY_FROM_BACKUP: ::DWORD = 704; +pub const ERROR_FT_WRITE_RECOVERY: ::DWORD = 705; +pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH: ::DWORD = 706; +pub const ERROR_RECEIVE_PARTIAL: ::DWORD = 707; +pub const ERROR_RECEIVE_EXPEDITED: ::DWORD = 708; +pub const ERROR_RECEIVE_PARTIAL_EXPEDITED: ::DWORD = 709; +pub const ERROR_EVENT_DONE: ::DWORD = 710; +pub const ERROR_EVENT_PENDING: ::DWORD = 711; +pub const ERROR_CHECKING_FILE_SYSTEM: ::DWORD = 712; +pub const ERROR_FATAL_APP_EXIT: ::DWORD = 713; +pub const ERROR_PREDEFINED_HANDLE: ::DWORD = 714; +pub const ERROR_WAS_UNLOCKED: ::DWORD = 715; +pub const ERROR_SERVICE_NOTIFICATION: ::DWORD = 716; +pub const ERROR_WAS_LOCKED: ::DWORD = 717; +pub const ERROR_LOG_HARD_ERROR: ::DWORD = 718; +pub const ERROR_ALREADY_WIN32: ::DWORD = 719; +pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE: ::DWORD = 720; +pub const ERROR_NO_YIELD_PERFORMED: ::DWORD = 721; +pub const ERROR_TIMER_RESUME_IGNORED: ::DWORD = 722; +pub const ERROR_ARBITRATION_UNHANDLED: ::DWORD = 723; +pub const ERROR_CARDBUS_NOT_SUPPORTED: ::DWORD = 724; +pub const ERROR_MP_PROCESSOR_MISMATCH: ::DWORD = 725; +pub const ERROR_HIBERNATED: ::DWORD = 726; +pub const ERROR_RESUME_HIBERNATION: ::DWORD = 727; +pub const ERROR_FIRMWARE_UPDATED: ::DWORD = 728; +pub const ERROR_DRIVERS_LEAKING_LOCKED_PAGES: ::DWORD = 729; +pub const ERROR_WAKE_SYSTEM: ::DWORD = 730; +pub const ERROR_WAIT_1: ::DWORD = 731; +pub const ERROR_WAIT_2: ::DWORD = 732; +pub const ERROR_WAIT_3: ::DWORD = 733; +pub const ERROR_WAIT_63: ::DWORD = 734; +pub const ERROR_ABANDONED_WAIT_0: ::DWORD = 735; +pub const ERROR_ABANDONED_WAIT_63: ::DWORD = 736; +pub const ERROR_USER_APC: ::DWORD = 737; +pub const ERROR_KERNEL_APC: ::DWORD = 738; +pub const ERROR_ALERTED: ::DWORD = 739; +pub const ERROR_ELEVATION_REQUIRED: ::DWORD = 740; +pub const ERROR_REPARSE: ::DWORD = 741; +pub const ERROR_OPLOCK_BREAK_IN_PROGRESS: ::DWORD = 742; +pub const ERROR_VOLUME_MOUNTED: ::DWORD = 743; +pub const ERROR_RXACT_COMMITTED: ::DWORD = 744; +pub const ERROR_NOTIFY_CLEANUP: ::DWORD = 745; +pub const ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED: ::DWORD = 746; +pub const ERROR_PAGE_FAULT_TRANSITION: ::DWORD = 747; +pub const ERROR_PAGE_FAULT_DEMAND_ZERO: ::DWORD = 748; +pub const ERROR_PAGE_FAULT_COPY_ON_WRITE: ::DWORD = 749; +pub const ERROR_PAGE_FAULT_GUARD_PAGE: ::DWORD = 750; +pub const ERROR_PAGE_FAULT_PAGING_FILE: ::DWORD = 751; +pub const ERROR_CACHE_PAGE_LOCKED: ::DWORD = 752; +pub const ERROR_CRASH_DUMP: ::DWORD = 753; +pub const ERROR_BUFFER_ALL_ZEROS: ::DWORD = 754; +pub const ERROR_REPARSE_OBJECT: ::DWORD = 755; +pub const ERROR_RESOURCE_REQUIREMENTS_CHANGED: ::DWORD = 756; +pub const ERROR_TRANSLATION_COMPLETE: ::DWORD = 757; +pub const ERROR_NOTHING_TO_TERMINATE: ::DWORD = 758; +pub const ERROR_PROCESS_NOT_IN_JOB: ::DWORD = 759; +pub const ERROR_PROCESS_IN_JOB: ::DWORD = 760; +pub const ERROR_VOLSNAP_HIBERNATE_READY: ::DWORD = 761; +pub const ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY: ::DWORD = 762; +pub const ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED: ::DWORD = 763; +pub const ERROR_INTERRUPT_STILL_CONNECTED: ::DWORD = 764; +pub const ERROR_WAIT_FOR_OPLOCK: ::DWORD = 765; +pub const ERROR_DBG_EXCEPTION_HANDLED: ::DWORD = 766; +pub const ERROR_DBG_CONTINUE: ::DWORD = 767; +pub const ERROR_CALLBACK_POP_STACK: ::DWORD = 768; +pub const ERROR_COMPRESSION_DISABLED: ::DWORD = 769; +pub const ERROR_CANTFETCHBACKWARDS: ::DWORD = 770; +pub const ERROR_CANTSCROLLBACKWARDS: ::DWORD = 771; +pub const ERROR_ROWSNOTRELEASED: ::DWORD = 772; +pub const ERROR_BAD_ACCESSOR_FLAGS: ::DWORD = 773; +pub const ERROR_ERRORS_ENCOUNTERED: ::DWORD = 774; +pub const ERROR_NOT_CAPABLE: ::DWORD = 775; +pub const ERROR_REQUEST_OUT_OF_SEQUENCE: ::DWORD = 776; +pub const ERROR_VERSION_PARSE_ERROR: ::DWORD = 777; +pub const ERROR_BADSTARTPOSITION: ::DWORD = 778; +pub const ERROR_MEMORY_HARDWARE: ::DWORD = 779; +pub const ERROR_DISK_REPAIR_DISABLED: ::DWORD = 780; +pub const ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: ::DWORD = 781; +pub const ERROR_SYSTEM_POWERSTATE_TRANSITION: ::DWORD = 782; +pub const ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: ::DWORD = 783; +pub const ERROR_MCA_EXCEPTION: ::DWORD = 784; +pub const ERROR_ACCESS_AUDIT_BY_POLICY: ::DWORD = 785; +pub const ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: ::DWORD = 786; +pub const ERROR_ABANDON_HIBERFILE: ::DWORD = 787; +pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: ::DWORD = 788; +pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: ::DWORD = 789; +pub const ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: ::DWORD = 790; +pub const ERROR_BAD_MCFG_TABLE: ::DWORD = 791; +pub const ERROR_DISK_REPAIR_REDIRECTED: ::DWORD = 792; +pub const ERROR_DISK_REPAIR_UNSUCCESSFUL: ::DWORD = 793; +pub const ERROR_CORRUPT_LOG_OVERFULL: ::DWORD = 794; +pub const ERROR_CORRUPT_LOG_CORRUPTED: ::DWORD = 795; +pub const ERROR_CORRUPT_LOG_UNAVAILABLE: ::DWORD = 796; +pub const ERROR_CORRUPT_LOG_DELETED_FULL: ::DWORD = 797; +pub const ERROR_CORRUPT_LOG_CLEARED: ::DWORD = 798; +pub const ERROR_ORPHAN_NAME_EXHAUSTED: ::DWORD = 799; +pub const ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE: ::DWORD = 800; +pub const ERROR_CANNOT_GRANT_REQUESTED_OPLOCK: ::DWORD = 801; +pub const ERROR_CANNOT_BREAK_OPLOCK: ::DWORD = 802; +pub const ERROR_OPLOCK_HANDLE_CLOSED: ::DWORD = 803; +pub const ERROR_NO_ACE_CONDITION: ::DWORD = 804; +pub const ERROR_INVALID_ACE_CONDITION: ::DWORD = 805; +pub const ERROR_FILE_HANDLE_REVOKED: ::DWORD = 806; +pub const ERROR_IMAGE_AT_DIFFERENT_BASE: ::DWORD = 807; +pub const ERROR_ENCRYPTED_IO_NOT_POSSIBLE: ::DWORD = 808; +pub const ERROR_EA_ACCESS_DENIED: ::DWORD = 994; +pub const ERROR_OPERATION_ABORTED: ::DWORD = 995; +pub const ERROR_IO_INCOMPLETE: ::DWORD = 996; +pub const ERROR_IO_PENDING: ::DWORD = 997; +pub const ERROR_NOACCESS: ::DWORD = 998; +pub const ERROR_SWAPERROR: ::DWORD = 999; +pub const ERROR_STACK_OVERFLOW: ::DWORD = 1001; +pub const ERROR_INVALID_MESSAGE: ::DWORD = 1002; +pub const ERROR_CAN_NOT_COMPLETE: ::DWORD = 1003; +pub const ERROR_INVALID_FLAGS: ::DWORD = 1004; +pub const ERROR_UNRECOGNIZED_VOLUME: ::DWORD = 1005; +pub const ERROR_FILE_INVALID: ::DWORD = 1006; +pub const ERROR_FULLSCREEN_MODE: ::DWORD = 1007; +pub const ERROR_NO_TOKEN: ::DWORD = 1008; +pub const ERROR_BADDB: ::DWORD = 1009; +pub const ERROR_BADKEY: ::DWORD = 1010; +pub const ERROR_CANTOPEN: ::DWORD = 1011; +pub const ERROR_CANTREAD: ::DWORD = 1012; +pub const ERROR_CANTWRITE: ::DWORD = 1013; +pub const ERROR_REGISTRY_RECOVERED: ::DWORD = 1014; +pub const ERROR_REGISTRY_CORRUPT: ::DWORD = 1015; +pub const ERROR_REGISTRY_IO_FAILED: ::DWORD = 1016; +pub const ERROR_NOT_REGISTRY_FILE: ::DWORD = 1017; +pub const ERROR_KEY_DELETED: ::DWORD = 1018; +pub const ERROR_NO_LOG_SPACE: ::DWORD = 1019; +pub const ERROR_KEY_HAS_CHILDREN: ::DWORD = 1020; +pub const ERROR_CHILD_MUST_BE_VOLATILE: ::DWORD = 1021; +pub const ERROR_NOTIFY_ENUM_DIR: ::DWORD = 1022; +pub const ERROR_DEPENDENT_SERVICES_RUNNING: ::DWORD = 1051; +pub const ERROR_INVALID_SERVICE_CONTROL: ::DWORD = 1052; +pub const ERROR_SERVICE_REQUEST_TIMEOUT: ::DWORD = 1053; +pub const ERROR_SERVICE_NO_THREAD: ::DWORD = 1054; +pub const ERROR_SERVICE_DATABASE_LOCKED: ::DWORD = 1055; +pub const ERROR_SERVICE_ALREADY_RUNNING: ::DWORD = 1056; +pub const ERROR_INVALID_SERVICE_ACCOUNT: ::DWORD = 1057; +pub const ERROR_SERVICE_DISABLED: ::DWORD = 1058; +pub const ERROR_CIRCULAR_DEPENDENCY: ::DWORD = 1059; +pub const ERROR_SERVICE_DOES_NOT_EXIST: ::DWORD = 1060; +pub const ERROR_SERVICE_CANNOT_ACCEPT_CTRL: ::DWORD = 1061; +pub const ERROR_SERVICE_NOT_ACTIVE: ::DWORD = 1062; +pub const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: ::DWORD = 1063; +pub const ERROR_EXCEPTION_IN_SERVICE: ::DWORD = 1064; +pub const ERROR_DATABASE_DOES_NOT_EXIST: ::DWORD = 1065; +pub const ERROR_SERVICE_SPECIFIC_ERROR: ::DWORD = 1066; +pub const ERROR_PROCESS_ABORTED: ::DWORD = 1067; +pub const ERROR_SERVICE_DEPENDENCY_FAIL: ::DWORD = 1068; +pub const ERROR_SERVICE_LOGON_FAILED: ::DWORD = 1069; +pub const ERROR_SERVICE_START_HANG: ::DWORD = 1070; +pub const ERROR_INVALID_SERVICE_LOCK: ::DWORD = 1071; +pub const ERROR_SERVICE_MARKED_FOR_DELETE: ::DWORD = 1072; +pub const ERROR_SERVICE_EXISTS: ::DWORD = 1073; +pub const ERROR_ALREADY_RUNNING_LKG: ::DWORD = 1074; +pub const ERROR_SERVICE_DEPENDENCY_DELETED: ::DWORD = 1075; +pub const ERROR_BOOT_ALREADY_ACCEPTED: ::DWORD = 1076; +pub const ERROR_SERVICE_NEVER_STARTED: ::DWORD = 1077; +pub const ERROR_DUPLICATE_SERVICE_NAME: ::DWORD = 1078; +pub const ERROR_DIFFERENT_SERVICE_ACCOUNT: ::DWORD = 1079; +pub const ERROR_CANNOT_DETECT_DRIVER_FAILURE: ::DWORD = 1080; +pub const ERROR_CANNOT_DETECT_PROCESS_ABORT: ::DWORD = 1081; +pub const ERROR_NO_RECOVERY_PROGRAM: ::DWORD = 1082; +pub const ERROR_SERVICE_NOT_IN_EXE: ::DWORD = 1083; +pub const ERROR_NOT_SAFEBOOT_SERVICE: ::DWORD = 1084; +pub const ERROR_END_OF_MEDIA: ::DWORD = 1100; +pub const ERROR_FILEMARK_DETECTED: ::DWORD = 1101; +pub const ERROR_BEGINNING_OF_MEDIA: ::DWORD = 1102; +pub const ERROR_SETMARK_DETECTED: ::DWORD = 1103; +pub const ERROR_NO_DATA_DETECTED: ::DWORD = 1104; +pub const ERROR_PARTITION_FAILURE: ::DWORD = 1105; +pub const ERROR_INVALID_BLOCK_LENGTH: ::DWORD = 1106; +pub const ERROR_DEVICE_NOT_PARTITIONED: ::DWORD = 1107; +pub const ERROR_UNABLE_TO_LOCK_MEDIA: ::DWORD = 1108; +pub const ERROR_UNABLE_TO_UNLOAD_MEDIA: ::DWORD = 1109; +pub const ERROR_MEDIA_CHANGED: ::DWORD = 1110; +pub const ERROR_BUS_RESET: ::DWORD = 1111; +pub const ERROR_NO_MEDIA_IN_DRIVE: ::DWORD = 1112; +pub const ERROR_NO_UNICODE_TRANSLATION: ::DWORD = 1113; +pub const ERROR_DLL_INIT_FAILED: ::DWORD = 1114; +pub const ERROR_SHUTDOWN_IN_PROGRESS: ::DWORD = 1115; +pub const ERROR_NO_SHUTDOWN_IN_PROGRESS: ::DWORD = 1116; +pub const ERROR_IO_DEVICE: ::DWORD = 1117; +pub const ERROR_SERIAL_NO_DEVICE: ::DWORD = 1118; +pub const ERROR_IRQ_BUSY: ::DWORD = 1119; +pub const ERROR_MORE_WRITES: ::DWORD = 1120; +pub const ERROR_COUNTER_TIMEOUT: ::DWORD = 1121; +pub const ERROR_FLOPPY_ID_MARK_NOT_FOUND: ::DWORD = 1122; +pub const ERROR_FLOPPY_WRONG_CYLINDER: ::DWORD = 1123; +pub const ERROR_FLOPPY_UNKNOWN_ERROR: ::DWORD = 1124; +pub const ERROR_FLOPPY_BAD_REGISTERS: ::DWORD = 1125; +pub const ERROR_DISK_RECALIBRATE_FAILED: ::DWORD = 1126; +pub const ERROR_DISK_OPERATION_FAILED: ::DWORD = 1127; +pub const ERROR_DISK_RESET_FAILED: ::DWORD = 1128; +pub const ERROR_EOM_OVERFLOW: ::DWORD = 1129; +pub const ERROR_NOT_ENOUGH_SERVER_MEMORY: ::DWORD = 1130; +pub const ERROR_POSSIBLE_DEADLOCK: ::DWORD = 1131; +pub const ERROR_MAPPED_ALIGNMENT: ::DWORD = 1132; +pub const ERROR_SET_POWER_STATE_VETOED: ::DWORD = 1140; +pub const ERROR_SET_POWER_STATE_FAILED: ::DWORD = 1141; +pub const ERROR_TOO_MANY_LINKS: ::DWORD = 1142; +pub const ERROR_OLD_WIN_VERSION: ::DWORD = 1150; +pub const ERROR_APP_WRONG_OS: ::DWORD = 1151; +pub const ERROR_SINGLE_INSTANCE_APP: ::DWORD = 1152; +pub const ERROR_RMODE_APP: ::DWORD = 1153; +pub const ERROR_INVALID_DLL: ::DWORD = 1154; +pub const ERROR_NO_ASSOCIATION: ::DWORD = 1155; +pub const ERROR_DDE_FAIL: ::DWORD = 1156; +pub const ERROR_DLL_NOT_FOUND: ::DWORD = 1157; +pub const ERROR_NO_MORE_USER_HANDLES: ::DWORD = 1158; +pub const ERROR_MESSAGE_SYNC_ONLY: ::DWORD = 1159; +pub const ERROR_SOURCE_ELEMENT_EMPTY: ::DWORD = 1160; +pub const ERROR_DESTINATION_ELEMENT_FULL: ::DWORD = 1161; +pub const ERROR_ILLEGAL_ELEMENT_ADDRESS: ::DWORD = 1162; +pub const ERROR_MAGAZINE_NOT_PRESENT: ::DWORD = 1163; +pub const ERROR_DEVICE_REINITIALIZATION_NEEDED: ::DWORD = 1164; +pub const ERROR_DEVICE_REQUIRES_CLEANING: ::DWORD = 1165; +pub const ERROR_DEVICE_DOOR_OPEN: ::DWORD = 1166; +pub const ERROR_DEVICE_NOT_CONNECTED: ::DWORD = 1167; +pub const ERROR_NOT_FOUND: ::DWORD = 1168; +pub const ERROR_NO_MATCH: ::DWORD = 1169; +pub const ERROR_SET_NOT_FOUND: ::DWORD = 1170; +pub const ERROR_POINT_NOT_FOUND: ::DWORD = 1171; +pub const ERROR_NO_TRACKING_SERVICE: ::DWORD = 1172; +pub const ERROR_NO_VOLUME_ID: ::DWORD = 1173; +pub const ERROR_UNABLE_TO_REMOVE_REPLACED: ::DWORD = 1175; +pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT: ::DWORD = 1176; +pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2: ::DWORD = 1177; +pub const ERROR_JOURNAL_DELETE_IN_PROGRESS: ::DWORD = 1178; +pub const ERROR_JOURNAL_NOT_ACTIVE: ::DWORD = 1179; +pub const ERROR_POTENTIAL_FILE_FOUND: ::DWORD = 1180; +pub const ERROR_JOURNAL_ENTRY_DELETED: ::DWORD = 1181; +pub const ERROR_SHUTDOWN_IS_SCHEDULED: ::DWORD = 1190; +pub const ERROR_SHUTDOWN_USERS_LOGGED_ON: ::DWORD = 1191; +pub const ERROR_BAD_DEVICE: ::DWORD = 1200; +pub const ERROR_CONNECTION_UNAVAIL: ::DWORD = 1201; +pub const ERROR_DEVICE_ALREADY_REMEMBERED: ::DWORD = 1202; +pub const ERROR_NO_NET_OR_BAD_PATH: ::DWORD = 1203; +pub const ERROR_BAD_PROVIDER: ::DWORD = 1204; +pub const ERROR_CANNOT_OPEN_PROFILE: ::DWORD = 1205; +pub const ERROR_BAD_PROFILE: ::DWORD = 1206; +pub const ERROR_NOT_CONTAINER: ::DWORD = 1207; +pub const ERROR_EXTENDED_ERROR: ::DWORD = 1208; +pub const ERROR_INVALID_GROUPNAME: ::DWORD = 1209; +pub const ERROR_INVALID_COMPUTERNAME: ::DWORD = 1210; +pub const ERROR_INVALID_EVENTNAME: ::DWORD = 1211; +pub const ERROR_INVALID_DOMAINNAME: ::DWORD = 1212; +pub const ERROR_INVALID_SERVICENAME: ::DWORD = 1213; +pub const ERROR_INVALID_NETNAME: ::DWORD = 1214; +pub const ERROR_INVALID_SHARENAME: ::DWORD = 1215; +pub const ERROR_INVALID_PASSWORDNAME: ::DWORD = 1216; +pub const ERROR_INVALID_MESSAGENAME: ::DWORD = 1217; +pub const ERROR_INVALID_MESSAGEDEST: ::DWORD = 1218; +pub const ERROR_SESSION_CREDENTIAL_CONFLICT: ::DWORD = 1219; +pub const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: ::DWORD = 1220; +pub const ERROR_DUP_DOMAINNAME: ::DWORD = 1221; +pub const ERROR_NO_NETWORK: ::DWORD = 1222; +pub const ERROR_CANCELLED: ::DWORD = 1223; +pub const ERROR_USER_MAPPED_FILE: ::DWORD = 1224; +pub const ERROR_CONNECTION_REFUSED: ::DWORD = 1225; +pub const ERROR_GRACEFUL_DISCONNECT: ::DWORD = 1226; +pub const ERROR_ADDRESS_ALREADY_ASSOCIATED: ::DWORD = 1227; +pub const ERROR_ADDRESS_NOT_ASSOCIATED: ::DWORD = 1228; +pub const ERROR_CONNECTION_INVALID: ::DWORD = 1229; +pub const ERROR_CONNECTION_ACTIVE: ::DWORD = 1230; +pub const ERROR_NETWORK_UNREACHABLE: ::DWORD = 1231; +pub const ERROR_HOST_UNREACHABLE: ::DWORD = 1232; +pub const ERROR_PROTOCOL_UNREACHABLE: ::DWORD = 1233; +pub const ERROR_PORT_UNREACHABLE: ::DWORD = 1234; +pub const ERROR_REQUEST_ABORTED: ::DWORD = 1235; +pub const ERROR_CONNECTION_ABORTED: ::DWORD = 1236; +pub const ERROR_RETRY: ::DWORD = 1237; +pub const ERROR_CONNECTION_COUNT_LIMIT: ::DWORD = 1238; +pub const ERROR_LOGIN_TIME_RESTRICTION: ::DWORD = 1239; +pub const ERROR_LOGIN_WKSTA_RESTRICTION: ::DWORD = 1240; +pub const ERROR_INCORRECT_ADDRESS: ::DWORD = 1241; +pub const ERROR_ALREADY_REGISTERED: ::DWORD = 1242; +pub const ERROR_SERVICE_NOT_FOUND: ::DWORD = 1243; +pub const ERROR_NOT_AUTHENTICATED: ::DWORD = 1244; +pub const ERROR_NOT_LOGGED_ON: ::DWORD = 1245; +pub const ERROR_CONTINUE: ::DWORD = 1246; +pub const ERROR_ALREADY_INITIALIZED: ::DWORD = 1247; +pub const ERROR_NO_MORE_DEVICES: ::DWORD = 1248; +pub const ERROR_NO_SUCH_SITE: ::DWORD = 1249; +pub const ERROR_DOMAIN_CONTROLLER_EXISTS: ::DWORD = 1250; +pub const ERROR_ONLY_IF_CONNECTED: ::DWORD = 1251; +pub const ERROR_OVERRIDE_NOCHANGES: ::DWORD = 1252; +pub const ERROR_BAD_USER_PROFILE: ::DWORD = 1253; +pub const ERROR_NOT_SUPPORTED_ON_SBS: ::DWORD = 1254; +pub const ERROR_SERVER_SHUTDOWN_IN_PROGRESS: ::DWORD = 1255; +pub const ERROR_HOST_DOWN: ::DWORD = 1256; +pub const ERROR_NON_ACCOUNT_SID: ::DWORD = 1257; +pub const ERROR_NON_DOMAIN_SID: ::DWORD = 1258; +pub const ERROR_APPHELP_BLOCK: ::DWORD = 1259; +pub const ERROR_ACCESS_DISABLED_BY_POLICY: ::DWORD = 1260; +pub const ERROR_REG_NAT_CONSUMPTION: ::DWORD = 1261; +pub const ERROR_CSCSHARE_OFFLINE: ::DWORD = 1262; +pub const ERROR_PKINIT_FAILURE: ::DWORD = 1263; +pub const ERROR_SMARTCARD_SUBSYSTEM_FAILURE: ::DWORD = 1264; +pub const ERROR_DOWNGRADE_DETECTED: ::DWORD = 1265; +pub const ERROR_MACHINE_LOCKED: ::DWORD = 1271; +pub const ERROR_CALLBACK_SUPPLIED_INVALID_DATA: ::DWORD = 1273; +pub const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED: ::DWORD = 1274; +pub const ERROR_DRIVER_BLOCKED: ::DWORD = 1275; +pub const ERROR_INVALID_IMPORT_OF_NON_DLL: ::DWORD = 1276; +pub const ERROR_ACCESS_DISABLED_WEBBLADE: ::DWORD = 1277; +pub const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER: ::DWORD = 1278; +pub const ERROR_RECOVERY_FAILURE: ::DWORD = 1279; +pub const ERROR_ALREADY_FIBER: ::DWORD = 1280; +pub const ERROR_ALREADY_THREAD: ::DWORD = 1281; +pub const ERROR_STACK_BUFFER_OVERRUN: ::DWORD = 1282; +pub const ERROR_PARAMETER_QUOTA_EXCEEDED: ::DWORD = 1283; +pub const ERROR_DEBUGGER_INACTIVE: ::DWORD = 1284; +pub const ERROR_DELAY_LOAD_FAILED: ::DWORD = 1285; +pub const ERROR_VDM_DISALLOWED: ::DWORD = 1286; +pub const ERROR_UNIDENTIFIED_ERROR: ::DWORD = 1287; +pub const ERROR_INVALID_CRUNTIME_PARAMETER: ::DWORD = 1288; +pub const ERROR_BEYOND_VDL: ::DWORD = 1289; +pub const ERROR_INCOMPATIBLE_SERVICE_SID_TYPE: ::DWORD = 1290; +pub const ERROR_DRIVER_PROCESS_TERMINATED: ::DWORD = 1291; +pub const ERROR_IMPLEMENTATION_LIMIT: ::DWORD = 1292; +pub const ERROR_PROCESS_IS_PROTECTED: ::DWORD = 1293; +pub const ERROR_SERVICE_NOTIFY_CLIENT_LAGGING: ::DWORD = 1294; +pub const ERROR_DISK_QUOTA_EXCEEDED: ::DWORD = 1295; +pub const ERROR_CONTENT_BLOCKED: ::DWORD = 1296; +pub const ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE: ::DWORD = 1297; +pub const ERROR_APP_HANG: ::DWORD = 1298; +pub const ERROR_INVALID_LABEL: ::DWORD = 1299; +pub const ERROR_NOT_ALL_ASSIGNED: ::DWORD = 1300; +pub const ERROR_SOME_NOT_MAPPED: ::DWORD = 1301; +pub const ERROR_NO_QUOTAS_FOR_ACCOUNT: ::DWORD = 1302; +pub const ERROR_LOCAL_USER_SESSION_KEY: ::DWORD = 1303; +pub const ERROR_NULL_LM_PASSWORD: ::DWORD = 1304; +pub const ERROR_UNKNOWN_REVISION: ::DWORD = 1305; +pub const ERROR_REVISION_MISMATCH: ::DWORD = 1306; +pub const ERROR_INVALID_OWNER: ::DWORD = 1307; +pub const ERROR_INVALID_PRIMARY_GROUP: ::DWORD = 1308; +pub const ERROR_NO_IMPERSONATION_TOKEN: ::DWORD = 1309; +pub const ERROR_CANT_DISABLE_MANDATORY: ::DWORD = 1310; +pub const ERROR_NO_LOGON_SERVERS: ::DWORD = 1311; +pub const ERROR_NO_SUCH_LOGON_SESSION: ::DWORD = 1312; +pub const ERROR_NO_SUCH_PRIVILEGE: ::DWORD = 1313; +pub const ERROR_PRIVILEGE_NOT_HELD: ::DWORD = 1314; +pub const ERROR_INVALID_ACCOUNT_NAME: ::DWORD = 1315; +pub const ERROR_USER_EXISTS: ::DWORD = 1316; +pub const ERROR_NO_SUCH_USER: ::DWORD = 1317; +pub const ERROR_GROUP_EXISTS: ::DWORD = 1318; +pub const ERROR_NO_SUCH_GROUP: ::DWORD = 1319; +pub const ERROR_MEMBER_IN_GROUP: ::DWORD = 1320; +pub const ERROR_MEMBER_NOT_IN_GROUP: ::DWORD = 1321; +pub const ERROR_LAST_ADMIN: ::DWORD = 1322; +pub const ERROR_WRONG_PASSWORD: ::DWORD = 1323; +pub const ERROR_ILL_FORMED_PASSWORD: ::DWORD = 1324; +pub const ERROR_PASSWORD_RESTRICTION: ::DWORD = 1325; +pub const ERROR_LOGON_FAILURE: ::DWORD = 1326; +pub const ERROR_ACCOUNT_RESTRICTION: ::DWORD = 1327; +pub const ERROR_INVALID_LOGON_HOURS: ::DWORD = 1328; +pub const ERROR_INVALID_WORKSTATION: ::DWORD = 1329; +pub const ERROR_PASSWORD_EXPIRED: ::DWORD = 1330; +pub const ERROR_ACCOUNT_DISABLED: ::DWORD = 1331; +pub const ERROR_NONE_MAPPED: ::DWORD = 1332; +pub const ERROR_TOO_MANY_LUIDS_REQUESTED: ::DWORD = 1333; +pub const ERROR_LUIDS_EXHAUSTED: ::DWORD = 1334; +pub const ERROR_INVALID_SUB_AUTHORITY: ::DWORD = 1335; +pub const ERROR_INVALID_ACL: ::DWORD = 1336; +pub const ERROR_INVALID_SID: ::DWORD = 1337; +pub const ERROR_INVALID_SECURITY_DESCR: ::DWORD = 1338; +pub const ERROR_BAD_INHERITANCE_ACL: ::DWORD = 1340; +pub const ERROR_SERVER_DISABLED: ::DWORD = 1341; +pub const ERROR_SERVER_NOT_DISABLED: ::DWORD = 1342; +pub const ERROR_INVALID_ID_AUTHORITY: ::DWORD = 1343; +pub const ERROR_ALLOTTED_SPACE_EXCEEDED: ::DWORD = 1344; +pub const ERROR_INVALID_GROUP_ATTRIBUTES: ::DWORD = 1345; +pub const ERROR_BAD_IMPERSONATION_LEVEL: ::DWORD = 1346; +pub const ERROR_CANT_OPEN_ANONYMOUS: ::DWORD = 1347; +pub const ERROR_BAD_VALIDATION_CLASS: ::DWORD = 1348; +pub const ERROR_BAD_TOKEN_TYPE: ::DWORD = 1349; +pub const ERROR_NO_SECURITY_ON_OBJECT: ::DWORD = 1350; +pub const ERROR_CANT_ACCESS_DOMAIN_INFO: ::DWORD = 1351; +pub const ERROR_INVALID_SERVER_STATE: ::DWORD = 1352; +pub const ERROR_INVALID_DOMAIN_STATE: ::DWORD = 1353; +pub const ERROR_INVALID_DOMAIN_ROLE: ::DWORD = 1354; +pub const ERROR_NO_SUCH_DOMAIN: ::DWORD = 1355; +pub const ERROR_DOMAIN_EXISTS: ::DWORD = 1356; +pub const ERROR_DOMAIN_LIMIT_EXCEEDED: ::DWORD = 1357; +pub const ERROR_INTERNAL_DB_CORRUPTION: ::DWORD = 1358; +pub const ERROR_INTERNAL_ERROR: ::DWORD = 1359; +pub const ERROR_GENERIC_NOT_MAPPED: ::DWORD = 1360; +pub const ERROR_BAD_DESCRIPTOR_FORMAT: ::DWORD = 1361; +pub const ERROR_NOT_LOGON_PROCESS: ::DWORD = 1362; +pub const ERROR_LOGON_SESSION_EXISTS: ::DWORD = 1363; +pub const ERROR_NO_SUCH_PACKAGE: ::DWORD = 1364; +pub const ERROR_BAD_LOGON_SESSION_STATE: ::DWORD = 1365; +pub const ERROR_LOGON_SESSION_COLLISION: ::DWORD = 1366; +pub const ERROR_INVALID_LOGON_TYPE: ::DWORD = 1367; +pub const ERROR_CANNOT_IMPERSONATE: ::DWORD = 1368; +pub const ERROR_RXACT_INVALID_STATE: ::DWORD = 1369; +pub const ERROR_RXACT_COMMIT_FAILURE: ::DWORD = 1370; +pub const ERROR_SPECIAL_ACCOUNT: ::DWORD = 1371; +pub const ERROR_SPECIAL_GROUP: ::DWORD = 1372; +pub const ERROR_SPECIAL_USER: ::DWORD = 1373; +pub const ERROR_MEMBERS_PRIMARY_GROUP: ::DWORD = 1374; +pub const ERROR_TOKEN_ALREADY_IN_USE: ::DWORD = 1375; +pub const ERROR_NO_SUCH_ALIAS: ::DWORD = 1376; +pub const ERROR_MEMBER_NOT_IN_ALIAS: ::DWORD = 1377; +pub const ERROR_MEMBER_IN_ALIAS: ::DWORD = 1378; +pub const ERROR_ALIAS_EXISTS: ::DWORD = 1379; +pub const ERROR_LOGON_NOT_GRANTED: ::DWORD = 1380; +pub const ERROR_TOO_MANY_SECRETS: ::DWORD = 1381; +pub const ERROR_SECRET_TOO_LONG: ::DWORD = 1382; +pub const ERROR_INTERNAL_DB_ERROR: ::DWORD = 1383; +pub const ERROR_TOO_MANY_CONTEXT_IDS: ::DWORD = 1384; +pub const ERROR_LOGON_TYPE_NOT_GRANTED: ::DWORD = 1385; +pub const ERROR_NT_CROSS_ENCRYPTION_REQUIRED: ::DWORD = 1386; +pub const ERROR_NO_SUCH_MEMBER: ::DWORD = 1387; +pub const ERROR_INVALID_MEMBER: ::DWORD = 1388; +pub const ERROR_TOO_MANY_SIDS: ::DWORD = 1389; +pub const ERROR_LM_CROSS_ENCRYPTION_REQUIRED: ::DWORD = 1390; +pub const ERROR_NO_INHERITANCE: ::DWORD = 1391; +pub const ERROR_FILE_CORRUPT: ::DWORD = 1392; +pub const ERROR_DISK_CORRUPT: ::DWORD = 1393; +pub const ERROR_NO_USER_SESSION_KEY: ::DWORD = 1394; +pub const ERROR_LICENSE_QUOTA_EXCEEDED: ::DWORD = 1395; +pub const ERROR_WRONG_TARGET_NAME: ::DWORD = 1396; +pub const ERROR_MUTUAL_AUTH_FAILED: ::DWORD = 1397; +pub const ERROR_TIME_SKEW: ::DWORD = 1398; +pub const ERROR_CURRENT_DOMAIN_NOT_ALLOWED: ::DWORD = 1399; +pub const ERROR_INVALID_WINDOW_HANDLE: ::DWORD = 1400; +pub const ERROR_INVALID_MENU_HANDLE: ::DWORD = 1401; +pub const ERROR_INVALID_CURSOR_HANDLE: ::DWORD = 1402; +pub const ERROR_INVALID_ACCEL_HANDLE: ::DWORD = 1403; +pub const ERROR_INVALID_HOOK_HANDLE: ::DWORD = 1404; +pub const ERROR_INVALID_DWP_HANDLE: ::DWORD = 1405; +pub const ERROR_TLW_WITH_WSCHILD: ::DWORD = 1406; +pub const ERROR_CANNOT_FIND_WND_CLASS: ::DWORD = 1407; +pub const ERROR_WINDOW_OF_OTHER_THREAD: ::DWORD = 1408; +pub const ERROR_HOTKEY_ALREADY_REGISTERED: ::DWORD = 1409; +pub const ERROR_CLASS_ALREADY_EXISTS: ::DWORD = 1410; +pub const ERROR_CLASS_DOES_NOT_EXIST: ::DWORD = 1411; +pub const ERROR_CLASS_HAS_WINDOWS: ::DWORD = 1412; +pub const ERROR_INVALID_INDEX: ::DWORD = 1413; +pub const ERROR_INVALID_ICON_HANDLE: ::DWORD = 1414; +pub const ERROR_PRIVATE_DIALOG_INDEX: ::DWORD = 1415; +pub const ERROR_LISTBOX_ID_NOT_FOUND: ::DWORD = 1416; +pub const ERROR_NO_WILDCARD_CHARACTERS: ::DWORD = 1417; +pub const ERROR_CLIPBOARD_NOT_OPEN: ::DWORD = 1418; +pub const ERROR_HOTKEY_NOT_REGISTERED: ::DWORD = 1419; +pub const ERROR_WINDOW_NOT_DIALOG: ::DWORD = 1420; +pub const ERROR_CONTROL_ID_NOT_FOUND: ::DWORD = 1421; +pub const ERROR_INVALID_COMBOBOX_MESSAGE: ::DWORD = 1422; +pub const ERROR_WINDOW_NOT_COMBOBOX: ::DWORD = 1423; +pub const ERROR_INVALID_EDIT_HEIGHT: ::DWORD = 1424; +pub const ERROR_DC_NOT_FOUND: ::DWORD = 1425; +pub const ERROR_INVALID_HOOK_FILTER: ::DWORD = 1426; +pub const ERROR_INVALID_FILTER_PROC: ::DWORD = 1427; +pub const ERROR_HOOK_NEEDS_HMOD: ::DWORD = 1428; +pub const ERROR_GLOBAL_ONLY_HOOK: ::DWORD = 1429; +pub const ERROR_JOURNAL_HOOK_SET: ::DWORD = 1430; +pub const ERROR_HOOK_NOT_INSTALLED: ::DWORD = 1431; +pub const ERROR_INVALID_LB_MESSAGE: ::DWORD = 1432; +pub const ERROR_SETCOUNT_ON_BAD_LB: ::DWORD = 1433; +pub const ERROR_LB_WITHOUT_TABSTOPS: ::DWORD = 1434; +pub const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: ::DWORD = 1435; +pub const ERROR_CHILD_WINDOW_MENU: ::DWORD = 1436; +pub const ERROR_NO_SYSTEM_MENU: ::DWORD = 1437; +pub const ERROR_INVALID_MSGBOX_STYLE: ::DWORD = 1438; +pub const ERROR_INVALID_SPI_VALUE: ::DWORD = 1439; +pub const ERROR_SCREEN_ALREADY_LOCKED: ::DWORD = 1440; +pub const ERROR_HWNDS_HAVE_DIFF_PARENT: ::DWORD = 1441; +pub const ERROR_NOT_CHILD_WINDOW: ::DWORD = 1442; +pub const ERROR_INVALID_GW_COMMAND: ::DWORD = 1443; +pub const ERROR_INVALID_THREAD_ID: ::DWORD = 1444; +pub const ERROR_NON_MDICHILD_WINDOW: ::DWORD = 1445; +pub const ERROR_POPUP_ALREADY_ACTIVE: ::DWORD = 1446; +pub const ERROR_NO_SCROLLBARS: ::DWORD = 1447; +pub const ERROR_INVALID_SCROLLBAR_RANGE: ::DWORD = 1448; +pub const ERROR_INVALID_SHOWWIN_COMMAND: ::DWORD = 1449; +pub const ERROR_NO_SYSTEM_RESOURCES: ::DWORD = 1450; +pub const ERROR_NONPAGED_SYSTEM_RESOURCES: ::DWORD = 1451; +pub const ERROR_PAGED_SYSTEM_RESOURCES: ::DWORD = 1452; +pub const ERROR_WORKING_SET_QUOTA: ::DWORD = 1453; +pub const ERROR_PAGEFILE_QUOTA: ::DWORD = 1454; +pub const ERROR_COMMITMENT_LIMIT: ::DWORD = 1455; +pub const ERROR_MENU_ITEM_NOT_FOUND: ::DWORD = 1456; +pub const ERROR_INVALID_KEYBOARD_HANDLE: ::DWORD = 1457; +pub const ERROR_HOOK_TYPE_NOT_ALLOWED: ::DWORD = 1458; +pub const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: ::DWORD = 1459; +pub const ERROR_TIMEOUT: ::DWORD = 1460; +pub const ERROR_INVALID_MONITOR_HANDLE: ::DWORD = 1461; +pub const ERROR_INCORRECT_SIZE: ::DWORD = 1462; +pub const ERROR_SYMLINK_CLASS_DISABLED: ::DWORD = 1463; +pub const ERROR_SYMLINK_NOT_SUPPORTED: ::DWORD = 1464; +pub const ERROR_XML_PARSE_ERROR: ::DWORD = 1465; +pub const ERROR_XMLDSIG_ERROR: ::DWORD = 1466; +pub const ERROR_RESTART_APPLICATION: ::DWORD = 1467; +pub const ERROR_WRONG_COMPARTMENT: ::DWORD = 1468; +pub const ERROR_AUTHIP_FAILURE: ::DWORD = 1469; +pub const ERROR_NO_NVRAM_RESOURCES: ::DWORD = 1470; +pub const ERROR_NOT_GUI_PROCESS: ::DWORD = 1471; +pub const ERROR_EVENTLOG_FILE_CORRUPT: ::DWORD = 1500; +pub const ERROR_EVENTLOG_CANT_START: ::DWORD = 1501; +pub const ERROR_LOG_FILE_FULL: ::DWORD = 1502; +pub const ERROR_EVENTLOG_FILE_CHANGED: ::DWORD = 1503; +pub const ERROR_INVALID_TASK_NAME: ::DWORD = 1550; +pub const ERROR_INVALID_TASK_INDEX: ::DWORD = 1551; +pub const ERROR_THREAD_ALREADY_IN_TASK: ::DWORD = 1552; +pub const ERROR_INSTALL_SERVICE_FAILURE: ::DWORD = 1601; +pub const ERROR_INSTALL_USEREXIT: ::DWORD = 1602; +pub const ERROR_INSTALL_FAILURE: ::DWORD = 1603; +pub const ERROR_INSTALL_SUSPEND: ::DWORD = 1604; +pub const ERROR_UNKNOWN_PRODUCT: ::DWORD = 1605; +pub const ERROR_UNKNOWN_FEATURE: ::DWORD = 1606; +pub const ERROR_UNKNOWN_COMPONENT: ::DWORD = 1607; +pub const ERROR_UNKNOWN_PROPERTY: ::DWORD = 1608; +pub const ERROR_INVALID_HANDLE_STATE: ::DWORD = 1609; +pub const ERROR_BAD_CONFIGURATION: ::DWORD = 1610; +pub const ERROR_INDEX_ABSENT: ::DWORD = 1611; +pub const ERROR_INSTALL_SOURCE_ABSENT: ::DWORD = 1612; +pub const ERROR_INSTALL_PACKAGE_VERSION: ::DWORD = 1613; +pub const ERROR_PRODUCT_UNINSTALLED: ::DWORD = 1614; +pub const ERROR_BAD_QUERY_SYNTAX: ::DWORD = 1615; +pub const ERROR_INVALID_FIELD: ::DWORD = 1616; +pub const ERROR_DEVICE_REMOVED: ::DWORD = 1617; +pub const ERROR_INSTALL_ALREADY_RUNNING: ::DWORD = 1618; +pub const ERROR_INSTALL_PACKAGE_OPEN_FAILED: ::DWORD = 1619; +pub const ERROR_INSTALL_PACKAGE_INVALID: ::DWORD = 1620; +pub const ERROR_INSTALL_UI_FAILURE: ::DWORD = 1621; +pub const ERROR_INSTALL_LOG_FAILURE: ::DWORD = 1622; +pub const ERROR_INSTALL_LANGUAGE_UNSUPPORTED: ::DWORD = 1623; +pub const ERROR_INSTALL_TRANSFORM_FAILURE: ::DWORD = 1624; +pub const ERROR_INSTALL_PACKAGE_REJECTED: ::DWORD = 1625; +pub const ERROR_FUNCTION_NOT_CALLED: ::DWORD = 1626; +pub const ERROR_FUNCTION_FAILED: ::DWORD = 1627; +pub const ERROR_INVALID_TABLE: ::DWORD = 1628; +pub const ERROR_DATATYPE_MISMATCH: ::DWORD = 1629; +pub const ERROR_UNSUPPORTED_TYPE: ::DWORD = 1630; +pub const ERROR_CREATE_FAILED: ::DWORD = 1631; +pub const ERROR_INSTALL_TEMP_UNWRITABLE: ::DWORD = 1632; +pub const ERROR_INSTALL_PLATFORM_UNSUPPORTED: ::DWORD = 1633; +pub const ERROR_INSTALL_NOTUSED: ::DWORD = 1634; +pub const ERROR_PATCH_PACKAGE_OPEN_FAILED: ::DWORD = 1635; +pub const ERROR_PATCH_PACKAGE_INVALID: ::DWORD = 1636; +pub const ERROR_PATCH_PACKAGE_UNSUPPORTED: ::DWORD = 1637; +pub const ERROR_PRODUCT_VERSION: ::DWORD = 1638; +pub const ERROR_INVALID_COMMAND_LINE: ::DWORD = 1639; +pub const ERROR_INSTALL_REMOTE_DISALLOWED: ::DWORD = 1640; +pub const ERROR_SUCCESS_REBOOT_INITIATED: ::DWORD = 1641; +pub const ERROR_PATCH_TARGET_NOT_FOUND: ::DWORD = 1642; +pub const ERROR_PATCH_PACKAGE_REJECTED: ::DWORD = 1643; +pub const ERROR_INSTALL_TRANSFORM_REJECTED: ::DWORD = 1644; +pub const ERROR_INSTALL_REMOTE_PROHIBITED: ::DWORD = 1645; +pub const ERROR_PATCH_REMOVAL_UNSUPPORTED: ::DWORD = 1646; +pub const ERROR_UNKNOWN_PATCH: ::DWORD = 1647; +pub const ERROR_PATCH_NO_SEQUENCE: ::DWORD = 1648; +pub const ERROR_PATCH_REMOVAL_DISALLOWED: ::DWORD = 1649; +pub const ERROR_INVALID_PATCH_XML: ::DWORD = 1650; +pub const ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT: ::DWORD = 1651; +pub const ERROR_INSTALL_SERVICE_SAFEBOOT: ::DWORD = 1652; +pub const ERROR_FAIL_FAST_EXCEPTION: ::DWORD = 1653; +pub const ERROR_INSTALL_REJECTED: ::DWORD = 1654; +pub const ERROR_DYNAMIC_CODE_BLOCKED: ::DWORD = 1655; +pub const RPC_S_INVALID_STRING_BINDING: ::DWORD = 1700; +pub const RPC_S_WRONG_KIND_OF_BINDING: ::DWORD = 1701; +pub const RPC_S_INVALID_BINDING: ::DWORD = 1702; +pub const RPC_S_PROTSEQ_NOT_SUPPORTED: ::DWORD = 1703; +pub const RPC_S_INVALID_RPC_PROTSEQ: ::DWORD = 1704; +pub const RPC_S_INVALID_STRING_UUID: ::DWORD = 1705; +pub const RPC_S_INVALID_ENDPOINT_FORMAT: ::DWORD = 1706; +pub const RPC_S_INVALID_NET_ADDR: ::DWORD = 1707; +pub const RPC_S_NO_ENDPOINT_FOUND: ::DWORD = 1708; +pub const RPC_S_INVALID_TIMEOUT: ::DWORD = 1709; +pub const RPC_S_OBJECT_NOT_FOUND: ::DWORD = 1710; +pub const RPC_S_ALREADY_REGISTERED: ::DWORD = 1711; +pub const RPC_S_TYPE_ALREADY_REGISTERED: ::DWORD = 1712; +pub const RPC_S_ALREADY_LISTENING: ::DWORD = 1713; +pub const RPC_S_NO_PROTSEQS_REGISTERED: ::DWORD = 1714; +pub const RPC_S_NOT_LISTENING: ::DWORD = 1715; +pub const RPC_S_UNKNOWN_MGR_TYPE: ::DWORD = 1716; +pub const RPC_S_UNKNOWN_IF: ::DWORD = 1717; +pub const RPC_S_NO_BINDINGS: ::DWORD = 1718; +pub const RPC_S_NO_PROTSEQS: ::DWORD = 1719; +pub const RPC_S_CANT_CREATE_ENDPOINT: ::DWORD = 1720; +pub const RPC_S_OUT_OF_RESOURCES: ::DWORD = 1721; +pub const RPC_S_SERVER_UNAVAILABLE: ::DWORD = 1722; +pub const RPC_S_SERVER_TOO_BUSY: ::DWORD = 1723; +pub const RPC_S_INVALID_NETWORK_OPTIONS: ::DWORD = 1724; +pub const RPC_S_NO_CALL_ACTIVE: ::DWORD = 1725; +pub const RPC_S_CALL_FAILED: ::DWORD = 1726; +pub const RPC_S_CALL_FAILED_DNE: ::DWORD = 1727; +pub const RPC_S_PROTOCOL_ERROR: ::DWORD = 1728; +pub const RPC_S_PROXY_ACCESS_DENIED: ::DWORD = 1729; +pub const RPC_S_UNSUPPORTED_TRANS_SYN: ::DWORD = 1730; +pub const RPC_S_UNSUPPORTED_TYPE: ::DWORD = 1732; +pub const RPC_S_INVALID_TAG: ::DWORD = 1733; +pub const RPC_S_INVALID_BOUND: ::DWORD = 1734; +pub const RPC_S_NO_ENTRY_NAME: ::DWORD = 1735; +pub const RPC_S_INVALID_NAME_SYNTAX: ::DWORD = 1736; +pub const RPC_S_UNSUPPORTED_NAME_SYNTAX: ::DWORD = 1737; +pub const RPC_S_UUID_NO_ADDRESS: ::DWORD = 1739; +pub const RPC_S_DUPLICATE_ENDPOINT: ::DWORD = 1740; +pub const RPC_S_UNKNOWN_AUTHN_TYPE: ::DWORD = 1741; +pub const RPC_S_MAX_CALLS_TOO_SMALL: ::DWORD = 1742; +pub const RPC_S_STRING_TOO_LONG: ::DWORD = 1743; +pub const RPC_S_PROTSEQ_NOT_FOUND: ::DWORD = 1744; +pub const RPC_S_PROCNUM_OUT_OF_RANGE: ::DWORD = 1745; +pub const RPC_S_BINDING_HAS_NO_AUTH: ::DWORD = 1746; +pub const RPC_S_UNKNOWN_AUTHN_SERVICE: ::DWORD = 1747; +pub const RPC_S_UNKNOWN_AUTHN_LEVEL: ::DWORD = 1748; +pub const RPC_S_INVALID_AUTH_IDENTITY: ::DWORD = 1749; +pub const RPC_S_UNKNOWN_AUTHZ_SERVICE: ::DWORD = 1750; +pub const EPT_S_INVALID_ENTRY: ::DWORD = 1751; +pub const EPT_S_CANT_PERFORM_OP: ::DWORD = 1752; +pub const EPT_S_NOT_REGISTERED: ::DWORD = 1753; +pub const RPC_S_NOTHING_TO_EXPORT: ::DWORD = 1754; +pub const RPC_S_INCOMPLETE_NAME: ::DWORD = 1755; +pub const RPC_S_INVALID_VERS_OPTION: ::DWORD = 1756; +pub const RPC_S_NO_MORE_MEMBERS: ::DWORD = 1757; +pub const RPC_S_NOT_ALL_OBJS_UNEXPORTED: ::DWORD = 1758; +pub const RPC_S_INTERFACE_NOT_FOUND: ::DWORD = 1759; +pub const RPC_S_ENTRY_ALREADY_EXISTS: ::DWORD = 1760; +pub const RPC_S_ENTRY_NOT_FOUND: ::DWORD = 1761; +pub const RPC_S_NAME_SERVICE_UNAVAILABLE: ::DWORD = 1762; +pub const RPC_S_INVALID_NAF_ID: ::DWORD = 1763; +pub const RPC_S_CANNOT_SUPPORT: ::DWORD = 1764; +pub const RPC_S_NO_CONTEXT_AVAILABLE: ::DWORD = 1765; +pub const RPC_S_INTERNAL_ERROR: ::DWORD = 1766; +pub const RPC_S_ZERO_DIVIDE: ::DWORD = 1767; +pub const RPC_S_ADDRESS_ERROR: ::DWORD = 1768; +pub const RPC_S_FP_DIV_ZERO: ::DWORD = 1769; +pub const RPC_S_FP_UNDERFLOW: ::DWORD = 1770; +pub const RPC_S_FP_OVERFLOW: ::DWORD = 1771; +pub const RPC_X_NO_MORE_ENTRIES: ::DWORD = 1772; +pub const RPC_X_SS_CHAR_TRANS_OPEN_FAIL: ::DWORD = 1773; +pub const RPC_X_SS_CHAR_TRANS_SHORT_FILE: ::DWORD = 1774; +pub const RPC_X_SS_IN_NULL_CONTEXT: ::DWORD = 1775; +pub const RPC_X_SS_CONTEXT_DAMAGED: ::DWORD = 1777; +pub const RPC_X_SS_HANDLES_MISMATCH: ::DWORD = 1778; +pub const RPC_X_SS_CANNOT_GET_CALL_HANDLE: ::DWORD = 1779; +pub const RPC_X_NULL_REF_POINTER: ::DWORD = 1780; +pub const RPC_X_ENUM_VALUE_OUT_OF_RANGE: ::DWORD = 1781; +pub const RPC_X_BYTE_COUNT_TOO_SMALL: ::DWORD = 1782; +pub const RPC_X_BAD_STUB_DATA: ::DWORD = 1783; +pub const ERROR_INVALID_USER_BUFFER: ::DWORD = 1784; +pub const ERROR_UNRECOGNIZED_MEDIA: ::DWORD = 1785; +pub const ERROR_NO_TRUST_LSA_SECRET: ::DWORD = 1786; +pub const ERROR_NO_TRUST_SAM_ACCOUNT: ::DWORD = 1787; +pub const ERROR_TRUSTED_DOMAIN_FAILURE: ::DWORD = 1788; +pub const ERROR_TRUSTED_RELATIONSHIP_FAILURE: ::DWORD = 1789; +pub const ERROR_TRUST_FAILURE: ::DWORD = 1790; +pub const RPC_S_CALL_IN_PROGRESS: ::DWORD = 1791; +pub const ERROR_NETLOGON_NOT_STARTED: ::DWORD = 1792; +pub const ERROR_ACCOUNT_EXPIRED: ::DWORD = 1793; +pub const ERROR_REDIRECTOR_HAS_OPEN_HANDLES: ::DWORD = 1794; +pub const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: ::DWORD = 1795; +pub const ERROR_UNKNOWN_PORT: ::DWORD = 1796; +pub const ERROR_UNKNOWN_PRINTER_DRIVER: ::DWORD = 1797; +pub const ERROR_UNKNOWN_PRINTPROCESSOR: ::DWORD = 1798; +pub const ERROR_INVALID_SEPARATOR_FILE: ::DWORD = 1799; +pub const ERROR_INVALID_PRIORITY: ::DWORD = 1800; +pub const ERROR_INVALID_PRINTER_NAME: ::DWORD = 1801; +pub const ERROR_PRINTER_ALREADY_EXISTS: ::DWORD = 1802; +pub const ERROR_INVALID_PRINTER_COMMAND: ::DWORD = 1803; +pub const ERROR_INVALID_DATATYPE: ::DWORD = 1804; +pub const ERROR_INVALID_ENVIRONMENT: ::DWORD = 1805; +pub const RPC_S_NO_MORE_BINDINGS: ::DWORD = 1806; +pub const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: ::DWORD = 1807; +pub const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: ::DWORD = 1808; +pub const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: ::DWORD = 1809; +pub const ERROR_DOMAIN_TRUST_INCONSISTENT: ::DWORD = 1810; +pub const ERROR_SERVER_HAS_OPEN_HANDLES: ::DWORD = 1811; +pub const ERROR_RESOURCE_DATA_NOT_FOUND: ::DWORD = 1812; +pub const ERROR_RESOURCE_TYPE_NOT_FOUND: ::DWORD = 1813; +pub const ERROR_RESOURCE_NAME_NOT_FOUND: ::DWORD = 1814; +pub const ERROR_RESOURCE_LANG_NOT_FOUND: ::DWORD = 1815; +pub const ERROR_NOT_ENOUGH_QUOTA: ::DWORD = 1816; +pub const RPC_S_NO_INTERFACES: ::DWORD = 1817; +pub const RPC_S_CALL_CANCELLED: ::DWORD = 1818; +pub const RPC_S_BINDING_INCOMPLETE: ::DWORD = 1819; +pub const RPC_S_COMM_FAILURE: ::DWORD = 1820; +pub const RPC_S_UNSUPPORTED_AUTHN_LEVEL: ::DWORD = 1821; +pub const RPC_S_NO_PRINC_NAME: ::DWORD = 1822; +pub const RPC_S_NOT_RPC_ERROR: ::DWORD = 1823; +pub const RPC_S_UUID_LOCAL_ONLY: ::DWORD = 1824; +pub const RPC_S_SEC_PKG_ERROR: ::DWORD = 1825; +pub const RPC_S_NOT_CANCELLED: ::DWORD = 1826; +pub const RPC_X_INVALID_ES_ACTION: ::DWORD = 1827; +pub const RPC_X_WRONG_ES_VERSION: ::DWORD = 1828; +pub const RPC_X_WRONG_STUB_VERSION: ::DWORD = 1829; +pub const RPC_X_INVALID_PIPE_OBJECT: ::DWORD = 1830; +pub const RPC_X_WRONG_PIPE_ORDER: ::DWORD = 1831; +pub const RPC_X_WRONG_PIPE_VERSION: ::DWORD = 1832; +pub const RPC_S_COOKIE_AUTH_FAILED: ::DWORD = 1833; +pub const RPC_S_GROUP_MEMBER_NOT_FOUND: ::DWORD = 1898; +pub const EPT_S_CANT_CREATE: ::DWORD = 1899; +pub const RPC_S_INVALID_OBJECT: ::DWORD = 1900; +pub const ERROR_INVALID_TIME: ::DWORD = 1901; +pub const ERROR_INVALID_FORM_NAME: ::DWORD = 1902; +pub const ERROR_INVALID_FORM_SIZE: ::DWORD = 1903; +pub const ERROR_ALREADY_WAITING: ::DWORD = 1904; +pub const ERROR_PRINTER_DELETED: ::DWORD = 1905; +pub const ERROR_INVALID_PRINTER_STATE: ::DWORD = 1906; +pub const ERROR_PASSWORD_MUST_CHANGE: ::DWORD = 1907; +pub const ERROR_DOMAIN_CONTROLLER_NOT_FOUND: ::DWORD = 1908; +pub const ERROR_ACCOUNT_LOCKED_OUT: ::DWORD = 1909; +pub const OR_INVALID_OXID: ::DWORD = 1910; +pub const OR_INVALID_OID: ::DWORD = 1911; +pub const OR_INVALID_SET: ::DWORD = 1912; +pub const RPC_S_SEND_INCOMPLETE: ::DWORD = 1913; +pub const RPC_S_INVALID_ASYNC_HANDLE: ::DWORD = 1914; +pub const RPC_S_INVALID_ASYNC_CALL: ::DWORD = 1915; +pub const RPC_X_PIPE_CLOSED: ::DWORD = 1916; +pub const RPC_X_PIPE_DISCIPLINE_ERROR: ::DWORD = 1917; +pub const RPC_X_PIPE_EMPTY: ::DWORD = 1918; +pub const ERROR_NO_SITENAME: ::DWORD = 1919; +pub const ERROR_CANT_ACCESS_FILE: ::DWORD = 1920; +pub const ERROR_CANT_RESOLVE_FILENAME: ::DWORD = 1921; +pub const RPC_S_ENTRY_TYPE_MISMATCH: ::DWORD = 1922; +pub const RPC_S_NOT_ALL_OBJS_EXPORTED: ::DWORD = 1923; +pub const RPC_S_INTERFACE_NOT_EXPORTED: ::DWORD = 1924; +pub const RPC_S_PROFILE_NOT_ADDED: ::DWORD = 1925; +pub const RPC_S_PRF_ELT_NOT_ADDED: ::DWORD = 1926; +pub const RPC_S_PRF_ELT_NOT_REMOVED: ::DWORD = 1927; +pub const RPC_S_GRP_ELT_NOT_ADDED: ::DWORD = 1928; +pub const RPC_S_GRP_ELT_NOT_REMOVED: ::DWORD = 1929; +pub const ERROR_KM_DRIVER_BLOCKED: ::DWORD = 1930; +pub const ERROR_CONTEXT_EXPIRED: ::DWORD = 1931; +pub const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: ::DWORD = 1932; +pub const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: ::DWORD = 1933; +pub const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: ::DWORD = 1934; +pub const ERROR_AUTHENTICATION_FIREWALL_FAILED: ::DWORD = 1935; +pub const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: ::DWORD = 1936; +pub const ERROR_NTLM_BLOCKED: ::DWORD = 1937; +pub const ERROR_PASSWORD_CHANGE_REQUIRED: ::DWORD = 1938; +pub const ERROR_INVALID_PIXEL_FORMAT: ::DWORD = 2000; +pub const ERROR_BAD_DRIVER: ::DWORD = 2001; +pub const ERROR_INVALID_WINDOW_STYLE: ::DWORD = 2002; +pub const ERROR_METAFILE_NOT_SUPPORTED: ::DWORD = 2003; +pub const ERROR_TRANSFORM_NOT_SUPPORTED: ::DWORD = 2004; +pub const ERROR_CLIPPING_NOT_SUPPORTED: ::DWORD = 2005; +pub const ERROR_INVALID_CMM: ::DWORD = 2010; +pub const ERROR_INVALID_PROFILE: ::DWORD = 2011; +pub const ERROR_TAG_NOT_FOUND: ::DWORD = 2012; +pub const ERROR_TAG_NOT_PRESENT: ::DWORD = 2013; +pub const ERROR_DUPLICATE_TAG: ::DWORD = 2014; +pub const ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE: ::DWORD = 2015; +pub const ERROR_PROFILE_NOT_FOUND: ::DWORD = 2016; +pub const ERROR_INVALID_COLORSPACE: ::DWORD = 2017; +pub const ERROR_ICM_NOT_ENABLED: ::DWORD = 2018; +pub const ERROR_DELETING_ICM_XFORM: ::DWORD = 2019; +pub const ERROR_INVALID_TRANSFORM: ::DWORD = 2020; +pub const ERROR_COLORSPACE_MISMATCH: ::DWORD = 2021; +pub const ERROR_INVALID_COLORINDEX: ::DWORD = 2022; +pub const ERROR_PROFILE_DOES_NOT_MATCH_DEVICE: ::DWORD = 2023; +pub const ERROR_CONNECTED_OTHER_PASSWORD: ::DWORD = 2108; +pub const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: ::DWORD = 2109; +pub const ERROR_BAD_USERNAME: ::DWORD = 2202; +pub const ERROR_NOT_CONNECTED: ::DWORD = 2250; +pub const ERROR_OPEN_FILES: ::DWORD = 2401; +pub const ERROR_ACTIVE_CONNECTIONS: ::DWORD = 2402; +pub const ERROR_DEVICE_IN_USE: ::DWORD = 2404; +pub const ERROR_UNKNOWN_PRINT_MONITOR: ::DWORD = 3000; +pub const ERROR_PRINTER_DRIVER_IN_USE: ::DWORD = 3001; +pub const ERROR_SPOOL_FILE_NOT_FOUND: ::DWORD = 3002; +pub const ERROR_SPL_NO_STARTDOC: ::DWORD = 3003; +pub const ERROR_SPL_NO_ADDJOB: ::DWORD = 3004; +pub const ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED: ::DWORD = 3005; +pub const ERROR_PRINT_MONITOR_ALREADY_INSTALLED: ::DWORD = 3006; +pub const ERROR_INVALID_PRINT_MONITOR: ::DWORD = 3007; +pub const ERROR_PRINT_MONITOR_IN_USE: ::DWORD = 3008; +pub const ERROR_PRINTER_HAS_JOBS_QUEUED: ::DWORD = 3009; +pub const ERROR_SUCCESS_REBOOT_REQUIRED: ::DWORD = 3010; +pub const ERROR_SUCCESS_RESTART_REQUIRED: ::DWORD = 3011; +pub const ERROR_PRINTER_NOT_FOUND: ::DWORD = 3012; +pub const ERROR_PRINTER_DRIVER_WARNED: ::DWORD = 3013; +pub const ERROR_PRINTER_DRIVER_BLOCKED: ::DWORD = 3014; +pub const ERROR_PRINTER_DRIVER_PACKAGE_IN_USE: ::DWORD = 3015; +pub const ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND: ::DWORD = 3016; +pub const ERROR_FAIL_REBOOT_REQUIRED: ::DWORD = 3017; +pub const ERROR_FAIL_REBOOT_INITIATED: ::DWORD = 3018; +pub const ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED: ::DWORD = 3019; +pub const ERROR_PRINT_JOB_RESTART_REQUIRED: ::DWORD = 3020; +pub const ERROR_INVALID_PRINTER_DRIVER_MANIFEST: ::DWORD = 3021; +pub const ERROR_PRINTER_NOT_SHAREABLE: ::DWORD = 3022; +pub const ERROR_REQUEST_PAUSED: ::DWORD = 3050; +pub const ERROR_IO_REISSUE_AS_CACHED: ::DWORD = 3950; +pub const ERROR_WINS_INTERNAL: ::DWORD = 4000; +pub const ERROR_CAN_NOT_DEL_LOCAL_WINS: ::DWORD = 4001; +pub const ERROR_STATIC_INIT: ::DWORD = 4002; +pub const ERROR_INC_BACKUP: ::DWORD = 4003; +pub const ERROR_FULL_BACKUP: ::DWORD = 4004; +pub const ERROR_REC_NON_EXISTENT: ::DWORD = 4005; +pub const ERROR_RPL_NOT_ALLOWED: ::DWORD = 4006; +pub const PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED: ::DWORD = 4050; +pub const PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO: ::DWORD = 4051; +pub const PEERDIST_ERROR_MISSING_DATA: ::DWORD = 4052; +pub const PEERDIST_ERROR_NO_MORE: ::DWORD = 4053; +pub const PEERDIST_ERROR_NOT_INITIALIZED: ::DWORD = 4054; +pub const PEERDIST_ERROR_ALREADY_INITIALIZED: ::DWORD = 4055; +pub const PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS: ::DWORD = 4056; +pub const PEERDIST_ERROR_INVALIDATED: ::DWORD = 4057; +pub const PEERDIST_ERROR_ALREADY_EXISTS: ::DWORD = 4058; +pub const PEERDIST_ERROR_OPERATION_NOTFOUND: ::DWORD = 4059; +pub const PEERDIST_ERROR_ALREADY_COMPLETED: ::DWORD = 4060; +pub const PEERDIST_ERROR_OUT_OF_BOUNDS: ::DWORD = 4061; +pub const PEERDIST_ERROR_VERSION_UNSUPPORTED: ::DWORD = 4062; +pub const PEERDIST_ERROR_INVALID_CONFIGURATION: ::DWORD = 4063; +pub const PEERDIST_ERROR_NOT_LICENSED: ::DWORD = 4064; +pub const PEERDIST_ERROR_SERVICE_UNAVAILABLE: ::DWORD = 4065; +pub const PEERDIST_ERROR_TRUST_FAILURE: ::DWORD = 4066; +pub const ERROR_DHCP_ADDRESS_CONFLICT: ::DWORD = 4100; +pub const ERROR_WMI_GUID_NOT_FOUND: ::DWORD = 4200; +pub const ERROR_WMI_INSTANCE_NOT_FOUND: ::DWORD = 4201; +pub const ERROR_WMI_ITEMID_NOT_FOUND: ::DWORD = 4202; +pub const ERROR_WMI_TRY_AGAIN: ::DWORD = 4203; +pub const ERROR_WMI_DP_NOT_FOUND: ::DWORD = 4204; +pub const ERROR_WMI_UNRESOLVED_INSTANCE_REF: ::DWORD = 4205; +pub const ERROR_WMI_ALREADY_ENABLED: ::DWORD = 4206; +pub const ERROR_WMI_GUID_DISCONNECTED: ::DWORD = 4207; +pub const ERROR_WMI_SERVER_UNAVAILABLE: ::DWORD = 4208; +pub const ERROR_WMI_DP_FAILED: ::DWORD = 4209; +pub const ERROR_WMI_INVALID_MOF: ::DWORD = 4210; +pub const ERROR_WMI_INVALID_REGINFO: ::DWORD = 4211; +pub const ERROR_WMI_ALREADY_DISABLED: ::DWORD = 4212; +pub const ERROR_WMI_READ_ONLY: ::DWORD = 4213; +pub const ERROR_WMI_SET_FAILURE: ::DWORD = 4214; +pub const ERROR_NOT_APPCONTAINER: ::DWORD = 4250; +pub const ERROR_APPCONTAINER_REQUIRED: ::DWORD = 4251; +pub const ERROR_NOT_SUPPORTED_IN_APPCONTAINER: ::DWORD = 4252; +pub const ERROR_INVALID_PACKAGE_SID_LENGTH: ::DWORD = 4253; +pub const ERROR_INVALID_MEDIA: ::DWORD = 4300; +pub const ERROR_INVALID_LIBRARY: ::DWORD = 4301; +pub const ERROR_INVALID_MEDIA_POOL: ::DWORD = 4302; +pub const ERROR_DRIVE_MEDIA_MISMATCH: ::DWORD = 4303; +pub const ERROR_MEDIA_OFFLINE: ::DWORD = 4304; +pub const ERROR_LIBRARY_OFFLINE: ::DWORD = 4305; +pub const ERROR_EMPTY: ::DWORD = 4306; +pub const ERROR_NOT_EMPTY: ::DWORD = 4307; +pub const ERROR_MEDIA_UNAVAILABLE: ::DWORD = 4308; +pub const ERROR_RESOURCE_DISABLED: ::DWORD = 4309; +pub const ERROR_INVALID_CLEANER: ::DWORD = 4310; +pub const ERROR_UNABLE_TO_CLEAN: ::DWORD = 4311; +pub const ERROR_OBJECT_NOT_FOUND: ::DWORD = 4312; +pub const ERROR_DATABASE_FAILURE: ::DWORD = 4313; +pub const ERROR_DATABASE_FULL: ::DWORD = 4314; +pub const ERROR_MEDIA_INCOMPATIBLE: ::DWORD = 4315; +pub const ERROR_RESOURCE_NOT_PRESENT: ::DWORD = 4316; +pub const ERROR_INVALID_OPERATION: ::DWORD = 4317; +pub const ERROR_MEDIA_NOT_AVAILABLE: ::DWORD = 4318; +pub const ERROR_DEVICE_NOT_AVAILABLE: ::DWORD = 4319; +pub const ERROR_REQUEST_REFUSED: ::DWORD = 4320; +pub const ERROR_INVALID_DRIVE_OBJECT: ::DWORD = 4321; +pub const ERROR_LIBRARY_FULL: ::DWORD = 4322; +pub const ERROR_MEDIUM_NOT_ACCESSIBLE: ::DWORD = 4323; +pub const ERROR_UNABLE_TO_LOAD_MEDIUM: ::DWORD = 4324; +pub const ERROR_UNABLE_TO_INVENTORY_DRIVE: ::DWORD = 4325; +pub const ERROR_UNABLE_TO_INVENTORY_SLOT: ::DWORD = 4326; +pub const ERROR_UNABLE_TO_INVENTORY_TRANSPORT: ::DWORD = 4327; +pub const ERROR_TRANSPORT_FULL: ::DWORD = 4328; +pub const ERROR_CONTROLLING_IEPORT: ::DWORD = 4329; +pub const ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA: ::DWORD = 4330; +pub const ERROR_CLEANER_SLOT_SET: ::DWORD = 4331; +pub const ERROR_CLEANER_SLOT_NOT_SET: ::DWORD = 4332; +pub const ERROR_CLEANER_CARTRIDGE_SPENT: ::DWORD = 4333; +pub const ERROR_UNEXPECTED_OMID: ::DWORD = 4334; +pub const ERROR_CANT_DELETE_LAST_ITEM: ::DWORD = 4335; +pub const ERROR_MESSAGE_EXCEEDS_MAX_SIZE: ::DWORD = 4336; +pub const ERROR_VOLUME_CONTAINS_SYS_FILES: ::DWORD = 4337; +pub const ERROR_INDIGENOUS_TYPE: ::DWORD = 4338; +pub const ERROR_NO_SUPPORTING_DRIVES: ::DWORD = 4339; +pub const ERROR_CLEANER_CARTRIDGE_INSTALLED: ::DWORD = 4340; +pub const ERROR_IEPORT_FULL: ::DWORD = 4341; +pub const ERROR_FILE_OFFLINE: ::DWORD = 4350; +pub const ERROR_REMOTE_STORAGE_NOT_ACTIVE: ::DWORD = 4351; +pub const ERROR_REMOTE_STORAGE_MEDIA_ERROR: ::DWORD = 4352; +pub const ERROR_NOT_A_REPARSE_POINT: ::DWORD = 4390; +pub const ERROR_REPARSE_ATTRIBUTE_CONFLICT: ::DWORD = 4391; +pub const ERROR_INVALID_REPARSE_DATA: ::DWORD = 4392; +pub const ERROR_REPARSE_TAG_INVALID: ::DWORD = 4393; +pub const ERROR_REPARSE_TAG_MISMATCH: ::DWORD = 4394; +pub const ERROR_APP_DATA_NOT_FOUND: ::DWORD = 4400; +pub const ERROR_APP_DATA_EXPIRED: ::DWORD = 4401; +pub const ERROR_APP_DATA_CORRUPT: ::DWORD = 4402; +pub const ERROR_APP_DATA_LIMIT_EXCEEDED: ::DWORD = 4403; +pub const ERROR_APP_DATA_REBOOT_REQUIRED: ::DWORD = 4404; +pub const ERROR_SECUREBOOT_ROLLBACK_DETECTED: ::DWORD = 4420; +pub const ERROR_SECUREBOOT_POLICY_VIOLATION: ::DWORD = 4421; +pub const ERROR_SECUREBOOT_INVALID_POLICY: ::DWORD = 4422; +pub const ERROR_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND: ::DWORD = 4423; +pub const ERROR_SECUREBOOT_POLICY_NOT_SIGNED: ::DWORD = 4424; +pub const ERROR_SECUREBOOT_NOT_ENABLED: ::DWORD = 4425; +pub const ERROR_SECUREBOOT_FILE_REPLACED: ::DWORD = 4426; +pub const ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED: ::DWORD = 4440; +pub const ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: ::DWORD = 4441; +pub const ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED: ::DWORD = 4442; +pub const ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: ::DWORD = 4443; +pub const ERROR_VOLUME_NOT_SIS_ENABLED: ::DWORD = 4500; +pub const ERROR_DEPENDENT_RESOURCE_EXISTS: ::DWORD = 5001; +pub const ERROR_DEPENDENCY_NOT_FOUND: ::DWORD = 5002; +pub const ERROR_DEPENDENCY_ALREADY_EXISTS: ::DWORD = 5003; +pub const ERROR_RESOURCE_NOT_ONLINE: ::DWORD = 5004; +pub const ERROR_HOST_NODE_NOT_AVAILABLE: ::DWORD = 5005; +pub const ERROR_RESOURCE_NOT_AVAILABLE: ::DWORD = 5006; +pub const ERROR_RESOURCE_NOT_FOUND: ::DWORD = 5007; +pub const ERROR_SHUTDOWN_CLUSTER: ::DWORD = 5008; +pub const ERROR_CANT_EVICT_ACTIVE_NODE: ::DWORD = 5009; +pub const ERROR_OBJECT_ALREADY_EXISTS: ::DWORD = 5010; +pub const ERROR_OBJECT_IN_LIST: ::DWORD = 5011; +pub const ERROR_GROUP_NOT_AVAILABLE: ::DWORD = 5012; +pub const ERROR_GROUP_NOT_FOUND: ::DWORD = 5013; +pub const ERROR_GROUP_NOT_ONLINE: ::DWORD = 5014; +pub const ERROR_HOST_NODE_NOT_RESOURCE_OWNER: ::DWORD = 5015; +pub const ERROR_HOST_NODE_NOT_GROUP_OWNER: ::DWORD = 5016; +pub const ERROR_RESMON_CREATE_FAILED: ::DWORD = 5017; +pub const ERROR_RESMON_ONLINE_FAILED: ::DWORD = 5018; +pub const ERROR_RESOURCE_ONLINE: ::DWORD = 5019; +pub const ERROR_QUORUM_RESOURCE: ::DWORD = 5020; +pub const ERROR_NOT_QUORUM_CAPABLE: ::DWORD = 5021; +pub const ERROR_CLUSTER_SHUTTING_DOWN: ::DWORD = 5022; +pub const ERROR_INVALID_STATE: ::DWORD = 5023; +pub const ERROR_RESOURCE_PROPERTIES_STORED: ::DWORD = 5024; +pub const ERROR_NOT_QUORUM_CLASS: ::DWORD = 5025; +pub const ERROR_CORE_RESOURCE: ::DWORD = 5026; +pub const ERROR_QUORUM_RESOURCE_ONLINE_FAILED: ::DWORD = 5027; +pub const ERROR_QUORUMLOG_OPEN_FAILED: ::DWORD = 5028; +pub const ERROR_CLUSTERLOG_CORRUPT: ::DWORD = 5029; +pub const ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE: ::DWORD = 5030; +pub const ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE: ::DWORD = 5031; +pub const ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND: ::DWORD = 5032; +pub const ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE: ::DWORD = 5033; +pub const ERROR_QUORUM_OWNER_ALIVE: ::DWORD = 5034; +pub const ERROR_NETWORK_NOT_AVAILABLE: ::DWORD = 5035; +pub const ERROR_NODE_NOT_AVAILABLE: ::DWORD = 5036; +pub const ERROR_ALL_NODES_NOT_AVAILABLE: ::DWORD = 5037; +pub const ERROR_RESOURCE_FAILED: ::DWORD = 5038; +pub const ERROR_CLUSTER_INVALID_NODE: ::DWORD = 5039; +pub const ERROR_CLUSTER_NODE_EXISTS: ::DWORD = 5040; +pub const ERROR_CLUSTER_JOIN_IN_PROGRESS: ::DWORD = 5041; +pub const ERROR_CLUSTER_NODE_NOT_FOUND: ::DWORD = 5042; +pub const ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND: ::DWORD = 5043; +pub const ERROR_CLUSTER_NETWORK_EXISTS: ::DWORD = 5044; +pub const ERROR_CLUSTER_NETWORK_NOT_FOUND: ::DWORD = 5045; +pub const ERROR_CLUSTER_NETINTERFACE_EXISTS: ::DWORD = 5046; +pub const ERROR_CLUSTER_NETINTERFACE_NOT_FOUND: ::DWORD = 5047; +pub const ERROR_CLUSTER_INVALID_REQUEST: ::DWORD = 5048; +pub const ERROR_CLUSTER_INVALID_NETWORK_PROVIDER: ::DWORD = 5049; +pub const ERROR_CLUSTER_NODE_DOWN: ::DWORD = 5050; +pub const ERROR_CLUSTER_NODE_UNREACHABLE: ::DWORD = 5051; +pub const ERROR_CLUSTER_NODE_NOT_MEMBER: ::DWORD = 5052; +pub const ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS: ::DWORD = 5053; +pub const ERROR_CLUSTER_INVALID_NETWORK: ::DWORD = 5054; +pub const ERROR_CLUSTER_NODE_UP: ::DWORD = 5056; +pub const ERROR_CLUSTER_IPADDR_IN_USE: ::DWORD = 5057; +pub const ERROR_CLUSTER_NODE_NOT_PAUSED: ::DWORD = 5058; +pub const ERROR_CLUSTER_NO_SECURITY_CONTEXT: ::DWORD = 5059; +pub const ERROR_CLUSTER_NETWORK_NOT_INTERNAL: ::DWORD = 5060; +pub const ERROR_CLUSTER_NODE_ALREADY_UP: ::DWORD = 5061; +pub const ERROR_CLUSTER_NODE_ALREADY_DOWN: ::DWORD = 5062; +pub const ERROR_CLUSTER_NETWORK_ALREADY_ONLINE: ::DWORD = 5063; +pub const ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE: ::DWORD = 5064; +pub const ERROR_CLUSTER_NODE_ALREADY_MEMBER: ::DWORD = 5065; +pub const ERROR_CLUSTER_LAST_INTERNAL_NETWORK: ::DWORD = 5066; +pub const ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS: ::DWORD = 5067; +pub const ERROR_INVALID_OPERATION_ON_QUORUM: ::DWORD = 5068; +pub const ERROR_DEPENDENCY_NOT_ALLOWED: ::DWORD = 5069; +pub const ERROR_CLUSTER_NODE_PAUSED: ::DWORD = 5070; +pub const ERROR_NODE_CANT_HOST_RESOURCE: ::DWORD = 5071; +pub const ERROR_CLUSTER_NODE_NOT_READY: ::DWORD = 5072; +pub const ERROR_CLUSTER_NODE_SHUTTING_DOWN: ::DWORD = 5073; +pub const ERROR_CLUSTER_JOIN_ABORTED: ::DWORD = 5074; +pub const ERROR_CLUSTER_INCOMPATIBLE_VERSIONS: ::DWORD = 5075; +pub const ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED: ::DWORD = 5076; +pub const ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED: ::DWORD = 5077; +pub const ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND: ::DWORD = 5078; +pub const ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED: ::DWORD = 5079; +pub const ERROR_CLUSTER_RESNAME_NOT_FOUND: ::DWORD = 5080; +pub const ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED: ::DWORD = 5081; +pub const ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST: ::DWORD = 5082; +pub const ERROR_CLUSTER_DATABASE_SEQMISMATCH: ::DWORD = 5083; +pub const ERROR_RESMON_INVALID_STATE: ::DWORD = 5084; +pub const ERROR_CLUSTER_GUM_NOT_LOCKER: ::DWORD = 5085; +pub const ERROR_QUORUM_DISK_NOT_FOUND: ::DWORD = 5086; +pub const ERROR_DATABASE_BACKUP_CORRUPT: ::DWORD = 5087; +pub const ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT: ::DWORD = 5088; +pub const ERROR_RESOURCE_PROPERTY_UNCHANGEABLE: ::DWORD = 5089; +pub const ERROR_NO_ADMIN_ACCESS_POINT: ::DWORD = 5090; +pub const ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE: ::DWORD = 5890; +pub const ERROR_CLUSTER_QUORUMLOG_NOT_FOUND: ::DWORD = 5891; +pub const ERROR_CLUSTER_MEMBERSHIP_HALT: ::DWORD = 5892; +pub const ERROR_CLUSTER_INSTANCE_ID_MISMATCH: ::DWORD = 5893; +pub const ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP: ::DWORD = 5894; +pub const ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH: ::DWORD = 5895; +pub const ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP: ::DWORD = 5896; +pub const ERROR_CLUSTER_PARAMETER_MISMATCH: ::DWORD = 5897; +pub const ERROR_NODE_CANNOT_BE_CLUSTERED: ::DWORD = 5898; +pub const ERROR_CLUSTER_WRONG_OS_VERSION: ::DWORD = 5899; +pub const ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME: ::DWORD = 5900; +pub const ERROR_CLUSCFG_ALREADY_COMMITTED: ::DWORD = 5901; +pub const ERROR_CLUSCFG_ROLLBACK_FAILED: ::DWORD = 5902; +pub const ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT: ::DWORD = 5903; +pub const ERROR_CLUSTER_OLD_VERSION: ::DWORD = 5904; +pub const ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME: ::DWORD = 5905; +pub const ERROR_CLUSTER_NO_NET_ADAPTERS: ::DWORD = 5906; +pub const ERROR_CLUSTER_POISONED: ::DWORD = 5907; +pub const ERROR_CLUSTER_GROUP_MOVING: ::DWORD = 5908; +pub const ERROR_CLUSTER_RESOURCE_TYPE_BUSY: ::DWORD = 5909; +pub const ERROR_RESOURCE_CALL_TIMED_OUT: ::DWORD = 5910; +pub const ERROR_INVALID_CLUSTER_IPV6_ADDRESS: ::DWORD = 5911; +pub const ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION: ::DWORD = 5912; +pub const ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS: ::DWORD = 5913; +pub const ERROR_CLUSTER_PARTIAL_SEND: ::DWORD = 5914; +pub const ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION: ::DWORD = 5915; +pub const ERROR_CLUSTER_INVALID_STRING_TERMINATION: ::DWORD = 5916; +pub const ERROR_CLUSTER_INVALID_STRING_FORMAT: ::DWORD = 5917; +pub const ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS: ::DWORD = 5918; +pub const ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS: ::DWORD = 5919; +pub const ERROR_CLUSTER_NULL_DATA: ::DWORD = 5920; +pub const ERROR_CLUSTER_PARTIAL_READ: ::DWORD = 5921; +pub const ERROR_CLUSTER_PARTIAL_WRITE: ::DWORD = 5922; +pub const ERROR_CLUSTER_CANT_DESERIALIZE_DATA: ::DWORD = 5923; +pub const ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT: ::DWORD = 5924; +pub const ERROR_CLUSTER_NO_QUORUM: ::DWORD = 5925; +pub const ERROR_CLUSTER_INVALID_IPV6_NETWORK: ::DWORD = 5926; +pub const ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK: ::DWORD = 5927; +pub const ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP: ::DWORD = 5928; +pub const ERROR_DEPENDENCY_TREE_TOO_COMPLEX: ::DWORD = 5929; +pub const ERROR_EXCEPTION_IN_RESOURCE_CALL: ::DWORD = 5930; +pub const ERROR_CLUSTER_RHS_FAILED_INITIALIZATION: ::DWORD = 5931; +pub const ERROR_CLUSTER_NOT_INSTALLED: ::DWORD = 5932; +pub const ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE: ::DWORD = 5933; +pub const ERROR_CLUSTER_MAX_NODES_IN_CLUSTER: ::DWORD = 5934; +pub const ERROR_CLUSTER_TOO_MANY_NODES: ::DWORD = 5935; +pub const ERROR_CLUSTER_OBJECT_ALREADY_USED: ::DWORD = 5936; +pub const ERROR_NONCORE_GROUPS_FOUND: ::DWORD = 5937; +pub const ERROR_FILE_SHARE_RESOURCE_CONFLICT: ::DWORD = 5938; +pub const ERROR_CLUSTER_EVICT_INVALID_REQUEST: ::DWORD = 5939; +pub const ERROR_CLUSTER_SINGLETON_RESOURCE: ::DWORD = 5940; +pub const ERROR_CLUSTER_GROUP_SINGLETON_RESOURCE: ::DWORD = 5941; +pub const ERROR_CLUSTER_RESOURCE_PROVIDER_FAILED: ::DWORD = 5942; +pub const ERROR_CLUSTER_RESOURCE_CONFIGURATION_ERROR: ::DWORD = 5943; +pub const ERROR_CLUSTER_GROUP_BUSY: ::DWORD = 5944; +pub const ERROR_CLUSTER_NOT_SHARED_VOLUME: ::DWORD = 5945; +pub const ERROR_CLUSTER_INVALID_SECURITY_DESCRIPTOR: ::DWORD = 5946; +pub const ERROR_CLUSTER_SHARED_VOLUMES_IN_USE: ::DWORD = 5947; +pub const ERROR_CLUSTER_USE_SHARED_VOLUMES_API: ::DWORD = 5948; +pub const ERROR_CLUSTER_BACKUP_IN_PROGRESS: ::DWORD = 5949; +pub const ERROR_NON_CSV_PATH: ::DWORD = 5950; +pub const ERROR_CSV_VOLUME_NOT_LOCAL: ::DWORD = 5951; +pub const ERROR_CLUSTER_WATCHDOG_TERMINATING: ::DWORD = 5952; +pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_INCOMPATIBLE_NODES: ::DWORD = 5953; +pub const ERROR_CLUSTER_INVALID_NODE_WEIGHT: ::DWORD = 5954; +pub const ERROR_CLUSTER_RESOURCE_VETOED_CALL: ::DWORD = 5955; +pub const ERROR_RESMON_SYSTEM_RESOURCES_LACKING: ::DWORD = 5956; +pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_DESTINATION: ::DWORD = 5957; +pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_SOURCE: ::DWORD = 5958; +pub const ERROR_CLUSTER_GROUP_QUEUED: ::DWORD = 5959; +pub const ERROR_CLUSTER_RESOURCE_LOCKED_STATUS: ::DWORD = 5960; +pub const ERROR_CLUSTER_SHARED_VOLUME_FAILOVER_NOT_ALLOWED: ::DWORD = 5961; +pub const ERROR_CLUSTER_NODE_DRAIN_IN_PROGRESS: ::DWORD = 5962; +pub const ERROR_CLUSTER_DISK_NOT_CONNECTED: ::DWORD = 5963; +pub const ERROR_DISK_NOT_CSV_CAPABLE: ::DWORD = 5964; +pub const ERROR_RESOURCE_NOT_IN_AVAILABLE_STORAGE: ::DWORD = 5965; +pub const ERROR_CLUSTER_SHARED_VOLUME_REDIRECTED: ::DWORD = 5966; +pub const ERROR_CLUSTER_SHARED_VOLUME_NOT_REDIRECTED: ::DWORD = 5967; +pub const ERROR_CLUSTER_CANNOT_RETURN_PROPERTIES: ::DWORD = 5968; +pub const ERROR_CLUSTER_RESOURCE_CONTAINS_UNSUPPORTED_DIFF_AREA_FOR_SHARED_VOLUMES: ::DWORD = 5969; +pub const ERROR_CLUSTER_RESOURCE_IS_IN_MAINTENANCE_MODE: ::DWORD = 5970; +pub const ERROR_CLUSTER_AFFINITY_CONFLICT: ::DWORD = 5971; +pub const ERROR_CLUSTER_RESOURCE_IS_REPLICA_VIRTUAL_MACHINE: ::DWORD = 5972; +pub const ERROR_ENCRYPTION_FAILED: ::DWORD = 6000; +pub const ERROR_DECRYPTION_FAILED: ::DWORD = 6001; +pub const ERROR_FILE_ENCRYPTED: ::DWORD = 6002; +pub const ERROR_NO_RECOVERY_POLICY: ::DWORD = 6003; +pub const ERROR_NO_EFS: ::DWORD = 6004; +pub const ERROR_WRONG_EFS: ::DWORD = 6005; +pub const ERROR_NO_USER_KEYS: ::DWORD = 6006; +pub const ERROR_FILE_NOT_ENCRYPTED: ::DWORD = 6007; +pub const ERROR_NOT_EXPORT_FORMAT: ::DWORD = 6008; +pub const ERROR_FILE_READ_ONLY: ::DWORD = 6009; +pub const ERROR_DIR_EFS_DISALLOWED: ::DWORD = 6010; +pub const ERROR_EFS_SERVER_NOT_TRUSTED: ::DWORD = 6011; +pub const ERROR_BAD_RECOVERY_POLICY: ::DWORD = 6012; +pub const ERROR_EFS_ALG_BLOB_TOO_BIG: ::DWORD = 6013; +pub const ERROR_VOLUME_NOT_SUPPORT_EFS: ::DWORD = 6014; +pub const ERROR_EFS_DISABLED: ::DWORD = 6015; +pub const ERROR_EFS_VERSION_NOT_SUPPORT: ::DWORD = 6016; +pub const ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: ::DWORD = 6017; +pub const ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER: ::DWORD = 6018; +pub const ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: ::DWORD = 6019; +pub const ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: ::DWORD = 6020; +pub const ERROR_CS_ENCRYPTION_FILE_NOT_CSE: ::DWORD = 6021; +pub const ERROR_ENCRYPTION_POLICY_DENIES_OPERATION: ::DWORD = 6022; +pub const ERROR_NO_BROWSER_SERVERS_FOUND: ::DWORD = 6118; +pub const SCHED_E_SERVICE_NOT_LOCALSYSTEM: ::DWORD = 6200; +pub const ERROR_LOG_SECTOR_INVALID: ::DWORD = 6600; +pub const ERROR_LOG_SECTOR_PARITY_INVALID: ::DWORD = 6601; +pub const ERROR_LOG_SECTOR_REMAPPED: ::DWORD = 6602; +pub const ERROR_LOG_BLOCK_INCOMPLETE: ::DWORD = 6603; +pub const ERROR_LOG_INVALID_RANGE: ::DWORD = 6604; +pub const ERROR_LOG_BLOCKS_EXHAUSTED: ::DWORD = 6605; +pub const ERROR_LOG_READ_CONTEXT_INVALID: ::DWORD = 6606; +pub const ERROR_LOG_RESTART_INVALID: ::DWORD = 6607; +pub const ERROR_LOG_BLOCK_VERSION: ::DWORD = 6608; +pub const ERROR_LOG_BLOCK_INVALID: ::DWORD = 6609; +pub const ERROR_LOG_READ_MODE_INVALID: ::DWORD = 6610; +pub const ERROR_LOG_NO_RESTART: ::DWORD = 6611; +pub const ERROR_LOG_METADATA_CORRUPT: ::DWORD = 6612; +pub const ERROR_LOG_METADATA_INVALID: ::DWORD = 6613; +pub const ERROR_LOG_METADATA_INCONSISTENT: ::DWORD = 6614; +pub const ERROR_LOG_RESERVATION_INVALID: ::DWORD = 6615; +pub const ERROR_LOG_CANT_DELETE: ::DWORD = 6616; +pub const ERROR_LOG_CONTAINER_LIMIT_EXCEEDED: ::DWORD = 6617; +pub const ERROR_LOG_START_OF_LOG: ::DWORD = 6618; +pub const ERROR_LOG_POLICY_ALREADY_INSTALLED: ::DWORD = 6619; +pub const ERROR_LOG_POLICY_NOT_INSTALLED: ::DWORD = 6620; +pub const ERROR_LOG_POLICY_INVALID: ::DWORD = 6621; +pub const ERROR_LOG_POLICY_CONFLICT: ::DWORD = 6622; +pub const ERROR_LOG_PINNED_ARCHIVE_TAIL: ::DWORD = 6623; +pub const ERROR_LOG_RECORD_NONEXISTENT: ::DWORD = 6624; +pub const ERROR_LOG_RECORDS_RESERVED_INVALID: ::DWORD = 6625; +pub const ERROR_LOG_SPACE_RESERVED_INVALID: ::DWORD = 6626; +pub const ERROR_LOG_TAIL_INVALID: ::DWORD = 6627; +pub const ERROR_LOG_FULL: ::DWORD = 6628; +pub const ERROR_COULD_NOT_RESIZE_LOG: ::DWORD = 6629; +pub const ERROR_LOG_MULTIPLEXED: ::DWORD = 6630; +pub const ERROR_LOG_DEDICATED: ::DWORD = 6631; +pub const ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS: ::DWORD = 6632; +pub const ERROR_LOG_ARCHIVE_IN_PROGRESS: ::DWORD = 6633; +pub const ERROR_LOG_EPHEMERAL: ::DWORD = 6634; +pub const ERROR_LOG_NOT_ENOUGH_CONTAINERS: ::DWORD = 6635; +pub const ERROR_LOG_CLIENT_ALREADY_REGISTERED: ::DWORD = 6636; +pub const ERROR_LOG_CLIENT_NOT_REGISTERED: ::DWORD = 6637; +pub const ERROR_LOG_FULL_HANDLER_IN_PROGRESS: ::DWORD = 6638; +pub const ERROR_LOG_CONTAINER_READ_FAILED: ::DWORD = 6639; +pub const ERROR_LOG_CONTAINER_WRITE_FAILED: ::DWORD = 6640; +pub const ERROR_LOG_CONTAINER_OPEN_FAILED: ::DWORD = 6641; +pub const ERROR_LOG_CONTAINER_STATE_INVALID: ::DWORD = 6642; +pub const ERROR_LOG_STATE_INVALID: ::DWORD = 6643; +pub const ERROR_LOG_PINNED: ::DWORD = 6644; +pub const ERROR_LOG_METADATA_FLUSH_FAILED: ::DWORD = 6645; +pub const ERROR_LOG_INCONSISTENT_SECURITY: ::DWORD = 6646; +pub const ERROR_LOG_APPENDED_FLUSH_FAILED: ::DWORD = 6647; +pub const ERROR_LOG_PINNED_RESERVATION: ::DWORD = 6648; +pub const ERROR_INVALID_TRANSACTION: ::DWORD = 6700; +pub const ERROR_TRANSACTION_NOT_ACTIVE: ::DWORD = 6701; +pub const ERROR_TRANSACTION_REQUEST_NOT_VALID: ::DWORD = 6702; +pub const ERROR_TRANSACTION_NOT_REQUESTED: ::DWORD = 6703; +pub const ERROR_TRANSACTION_ALREADY_ABORTED: ::DWORD = 6704; +pub const ERROR_TRANSACTION_ALREADY_COMMITTED: ::DWORD = 6705; +pub const ERROR_TM_INITIALIZATION_FAILED: ::DWORD = 6706; +pub const ERROR_RESOURCEMANAGER_READ_ONLY: ::DWORD = 6707; +pub const ERROR_TRANSACTION_NOT_JOINED: ::DWORD = 6708; +pub const ERROR_TRANSACTION_SUPERIOR_EXISTS: ::DWORD = 6709; +pub const ERROR_CRM_PROTOCOL_ALREADY_EXISTS: ::DWORD = 6710; +pub const ERROR_TRANSACTION_PROPAGATION_FAILED: ::DWORD = 6711; +pub const ERROR_CRM_PROTOCOL_NOT_FOUND: ::DWORD = 6712; +pub const ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER: ::DWORD = 6713; +pub const ERROR_CURRENT_TRANSACTION_NOT_VALID: ::DWORD = 6714; +pub const ERROR_TRANSACTION_NOT_FOUND: ::DWORD = 6715; +pub const ERROR_RESOURCEMANAGER_NOT_FOUND: ::DWORD = 6716; +pub const ERROR_ENLISTMENT_NOT_FOUND: ::DWORD = 6717; +pub const ERROR_TRANSACTIONMANAGER_NOT_FOUND: ::DWORD = 6718; +pub const ERROR_TRANSACTIONMANAGER_NOT_ONLINE: ::DWORD = 6719; +pub const ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: ::DWORD = 6720; +pub const ERROR_TRANSACTION_NOT_ROOT: ::DWORD = 6721; +pub const ERROR_TRANSACTION_OBJECT_EXPIRED: ::DWORD = 6722; +pub const ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED: ::DWORD = 6723; +pub const ERROR_TRANSACTION_RECORD_TOO_LONG: ::DWORD = 6724; +pub const ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED: ::DWORD = 6725; +pub const ERROR_TRANSACTION_INTEGRITY_VIOLATED: ::DWORD = 6726; +pub const ERROR_TRANSACTIONMANAGER_IDENTITY_MISMATCH: ::DWORD = 6727; +pub const ERROR_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT: ::DWORD = 6728; +pub const ERROR_TRANSACTION_MUST_WRITETHROUGH: ::DWORD = 6729; +pub const ERROR_TRANSACTION_NO_SUPERIOR: ::DWORD = 6730; +pub const ERROR_HEURISTIC_DAMAGE_POSSIBLE: ::DWORD = 6731; +pub const ERROR_TRANSACTIONAL_CONFLICT: ::DWORD = 6800; +pub const ERROR_RM_NOT_ACTIVE: ::DWORD = 6801; +pub const ERROR_RM_METADATA_CORRUPT: ::DWORD = 6802; +pub const ERROR_DIRECTORY_NOT_RM: ::DWORD = 6803; +pub const ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE: ::DWORD = 6805; +pub const ERROR_LOG_RESIZE_INVALID_SIZE: ::DWORD = 6806; +pub const ERROR_OBJECT_NO_LONGER_EXISTS: ::DWORD = 6807; +pub const ERROR_STREAM_MINIVERSION_NOT_FOUND: ::DWORD = 6808; +pub const ERROR_STREAM_MINIVERSION_NOT_VALID: ::DWORD = 6809; +pub const ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: ::DWORD = 6810; +pub const ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: ::DWORD = 6811; +pub const ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS: ::DWORD = 6812; +pub const ERROR_REMOTE_FILE_VERSION_MISMATCH: ::DWORD = 6814; +pub const ERROR_HANDLE_NO_LONGER_VALID: ::DWORD = 6815; +pub const ERROR_NO_TXF_METADATA: ::DWORD = 6816; +pub const ERROR_LOG_CORRUPTION_DETECTED: ::DWORD = 6817; +pub const ERROR_CANT_RECOVER_WITH_HANDLE_OPEN: ::DWORD = 6818; +pub const ERROR_RM_DISCONNECTED: ::DWORD = 6819; +pub const ERROR_ENLISTMENT_NOT_SUPERIOR: ::DWORD = 6820; +pub const ERROR_RECOVERY_NOT_NEEDED: ::DWORD = 6821; +pub const ERROR_RM_ALREADY_STARTED: ::DWORD = 6822; +pub const ERROR_FILE_IDENTITY_NOT_PERSISTENT: ::DWORD = 6823; +pub const ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: ::DWORD = 6824; +pub const ERROR_CANT_CROSS_RM_BOUNDARY: ::DWORD = 6825; +pub const ERROR_TXF_DIR_NOT_EMPTY: ::DWORD = 6826; +pub const ERROR_INDOUBT_TRANSACTIONS_EXIST: ::DWORD = 6827; +pub const ERROR_TM_VOLATILE: ::DWORD = 6828; +pub const ERROR_ROLLBACK_TIMER_EXPIRED: ::DWORD = 6829; +pub const ERROR_TXF_ATTRIBUTE_CORRUPT: ::DWORD = 6830; +pub const ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION: ::DWORD = 6831; +pub const ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED: ::DWORD = 6832; +pub const ERROR_LOG_GROWTH_FAILED: ::DWORD = 6833; +pub const ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: ::DWORD = 6834; +pub const ERROR_TXF_METADATA_ALREADY_PRESENT: ::DWORD = 6835; +pub const ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: ::DWORD = 6836; +pub const ERROR_TRANSACTION_REQUIRED_PROMOTION: ::DWORD = 6837; +pub const ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION: ::DWORD = 6838; +pub const ERROR_TRANSACTIONS_NOT_FROZEN: ::DWORD = 6839; +pub const ERROR_TRANSACTION_FREEZE_IN_PROGRESS: ::DWORD = 6840; +pub const ERROR_NOT_SNAPSHOT_VOLUME: ::DWORD = 6841; +pub const ERROR_NO_SAVEPOINT_WITH_OPEN_FILES: ::DWORD = 6842; +pub const ERROR_DATA_LOST_REPAIR: ::DWORD = 6843; +pub const ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION: ::DWORD = 6844; +pub const ERROR_TM_IDENTITY_MISMATCH: ::DWORD = 6845; +pub const ERROR_FLOATED_SECTION: ::DWORD = 6846; +pub const ERROR_CANNOT_ACCEPT_TRANSACTED_WORK: ::DWORD = 6847; +pub const ERROR_CANNOT_ABORT_TRANSACTIONS: ::DWORD = 6848; +pub const ERROR_BAD_CLUSTERS: ::DWORD = 6849; +pub const ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: ::DWORD = 6850; +pub const ERROR_VOLUME_DIRTY: ::DWORD = 6851; +pub const ERROR_NO_LINK_TRACKING_IN_TRANSACTION: ::DWORD = 6852; +pub const ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: ::DWORD = 6853; +pub const ERROR_EXPIRED_HANDLE: ::DWORD = 6854; +pub const ERROR_TRANSACTION_NOT_ENLISTED: ::DWORD = 6855; +pub const ERROR_CTX_WINSTATION_NAME_INVALID: ::DWORD = 7001; +pub const ERROR_CTX_INVALID_PD: ::DWORD = 7002; +pub const ERROR_CTX_PD_NOT_FOUND: ::DWORD = 7003; +pub const ERROR_CTX_WD_NOT_FOUND: ::DWORD = 7004; +pub const ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY: ::DWORD = 7005; +pub const ERROR_CTX_SERVICE_NAME_COLLISION: ::DWORD = 7006; +pub const ERROR_CTX_CLOSE_PENDING: ::DWORD = 7007; +pub const ERROR_CTX_NO_OUTBUF: ::DWORD = 7008; +pub const ERROR_CTX_MODEM_INF_NOT_FOUND: ::DWORD = 7009; +pub const ERROR_CTX_INVALID_MODEMNAME: ::DWORD = 7010; +pub const ERROR_CTX_MODEM_RESPONSE_ERROR: ::DWORD = 7011; +pub const ERROR_CTX_MODEM_RESPONSE_TIMEOUT: ::DWORD = 7012; +pub const ERROR_CTX_MODEM_RESPONSE_NO_CARRIER: ::DWORD = 7013; +pub const ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE: ::DWORD = 7014; +pub const ERROR_CTX_MODEM_RESPONSE_BUSY: ::DWORD = 7015; +pub const ERROR_CTX_MODEM_RESPONSE_VOICE: ::DWORD = 7016; +pub const ERROR_CTX_TD_ERROR: ::DWORD = 7017; +pub const ERROR_CTX_WINSTATION_NOT_FOUND: ::DWORD = 7022; +pub const ERROR_CTX_WINSTATION_ALREADY_EXISTS: ::DWORD = 7023; +pub const ERROR_CTX_WINSTATION_BUSY: ::DWORD = 7024; +pub const ERROR_CTX_BAD_VIDEO_MODE: ::DWORD = 7025; +pub const ERROR_CTX_GRAPHICS_INVALID: ::DWORD = 7035; +pub const ERROR_CTX_LOGON_DISABLED: ::DWORD = 7037; +pub const ERROR_CTX_NOT_CONSOLE: ::DWORD = 7038; +pub const ERROR_CTX_CLIENT_QUERY_TIMEOUT: ::DWORD = 7040; +pub const ERROR_CTX_CONSOLE_DISCONNECT: ::DWORD = 7041; +pub const ERROR_CTX_CONSOLE_CONNECT: ::DWORD = 7042; +pub const ERROR_CTX_SHADOW_DENIED: ::DWORD = 7044; +pub const ERROR_CTX_WINSTATION_ACCESS_DENIED: ::DWORD = 7045; +pub const ERROR_CTX_INVALID_WD: ::DWORD = 7049; +pub const ERROR_CTX_SHADOW_INVALID: ::DWORD = 7050; +pub const ERROR_CTX_SHADOW_DISABLED: ::DWORD = 7051; +pub const ERROR_CTX_CLIENT_LICENSE_IN_USE: ::DWORD = 7052; +pub const ERROR_CTX_CLIENT_LICENSE_NOT_SET: ::DWORD = 7053; +pub const ERROR_CTX_LICENSE_NOT_AVAILABLE: ::DWORD = 7054; +pub const ERROR_CTX_LICENSE_CLIENT_INVALID: ::DWORD = 7055; +pub const ERROR_CTX_LICENSE_EXPIRED: ::DWORD = 7056; +pub const ERROR_CTX_SHADOW_NOT_RUNNING: ::DWORD = 7057; +pub const ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE: ::DWORD = 7058; +pub const ERROR_ACTIVATION_COUNT_EXCEEDED: ::DWORD = 7059; +pub const ERROR_CTX_WINSTATIONS_DISABLED: ::DWORD = 7060; +pub const ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED: ::DWORD = 7061; +pub const ERROR_CTX_SESSION_IN_USE: ::DWORD = 7062; +pub const ERROR_CTX_NO_FORCE_LOGOFF: ::DWORD = 7063; +pub const ERROR_CTX_ACCOUNT_RESTRICTION: ::DWORD = 7064; +pub const ERROR_RDP_PROTOCOL_ERROR: ::DWORD = 7065; +pub const ERROR_CTX_CDM_CONNECT: ::DWORD = 7066; +pub const ERROR_CTX_CDM_DISCONNECT: ::DWORD = 7067; +pub const ERROR_CTX_SECURITY_LAYER_ERROR: ::DWORD = 7068; +pub const ERROR_TS_INCOMPATIBLE_SESSIONS: ::DWORD = 7069; +pub const ERROR_TS_VIDEO_SUBSYSTEM_ERROR: ::DWORD = 7070; +pub const FRS_ERR_INVALID_API_SEQUENCE: ::DWORD = 8001; +pub const FRS_ERR_STARTING_SERVICE: ::DWORD = 8002; +pub const FRS_ERR_STOPPING_SERVICE: ::DWORD = 8003; +pub const FRS_ERR_INTERNAL_API: ::DWORD = 8004; +pub const FRS_ERR_INTERNAL: ::DWORD = 8005; +pub const FRS_ERR_SERVICE_COMM: ::DWORD = 8006; +pub const FRS_ERR_INSUFFICIENT_PRIV: ::DWORD = 8007; +pub const FRS_ERR_AUTHENTICATION: ::DWORD = 8008; +pub const FRS_ERR_PARENT_INSUFFICIENT_PRIV: ::DWORD = 8009; +pub const FRS_ERR_PARENT_AUTHENTICATION: ::DWORD = 8010; +pub const FRS_ERR_CHILD_TO_PARENT_COMM: ::DWORD = 8011; +pub const FRS_ERR_PARENT_TO_CHILD_COMM: ::DWORD = 8012; +pub const FRS_ERR_SYSVOL_POPULATE: ::DWORD = 8013; +pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: ::DWORD = 8014; +pub const FRS_ERR_SYSVOL_IS_BUSY: ::DWORD = 8015; +pub const FRS_ERR_SYSVOL_DEMOTE: ::DWORD = 8016; +pub const FRS_ERR_INVALID_SERVICE_PARAMETER: ::DWORD = 8017; +pub const DS_S_SUCCESS: ::DWORD = NO_ERROR; +pub const ERROR_DS_NOT_INSTALLED: ::DWORD = 8200; +pub const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: ::DWORD = 8201; +pub const ERROR_DS_NO_ATTRIBUTE_OR_VALUE: ::DWORD = 8202; +pub const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: ::DWORD = 8203; +pub const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: ::DWORD = 8204; +pub const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: ::DWORD = 8205; +pub const ERROR_DS_BUSY: ::DWORD = 8206; +pub const ERROR_DS_UNAVAILABLE: ::DWORD = 8207; +pub const ERROR_DS_NO_RIDS_ALLOCATED: ::DWORD = 8208; +pub const ERROR_DS_NO_MORE_RIDS: ::DWORD = 8209; +pub const ERROR_DS_INCORRECT_ROLE_OWNER: ::DWORD = 8210; +pub const ERROR_DS_RIDMGR_INIT_ERROR: ::DWORD = 8211; +pub const ERROR_DS_OBJ_CLASS_VIOLATION: ::DWORD = 8212; +pub const ERROR_DS_CANT_ON_NON_LEAF: ::DWORD = 8213; +pub const ERROR_DS_CANT_ON_RDN: ::DWORD = 8214; +pub const ERROR_DS_CANT_MOD_OBJ_CLASS: ::DWORD = 8215; +pub const ERROR_DS_CROSS_DOM_MOVE_ERROR: ::DWORD = 8216; +pub const ERROR_DS_GC_NOT_AVAILABLE: ::DWORD = 8217; +pub const ERROR_SHARED_POLICY: ::DWORD = 8218; +pub const ERROR_POLICY_OBJECT_NOT_FOUND: ::DWORD = 8219; +pub const ERROR_POLICY_ONLY_IN_DS: ::DWORD = 8220; +pub const ERROR_PROMOTION_ACTIVE: ::DWORD = 8221; +pub const ERROR_NO_PROMOTION_ACTIVE: ::DWORD = 8222; +pub const ERROR_DS_OPERATIONS_ERROR: ::DWORD = 8224; +pub const ERROR_DS_PROTOCOL_ERROR: ::DWORD = 8225; +pub const ERROR_DS_TIMELIMIT_EXCEEDED: ::DWORD = 8226; +pub const ERROR_DS_SIZELIMIT_EXCEEDED: ::DWORD = 8227; +pub const ERROR_DS_ADMIN_LIMIT_EXCEEDED: ::DWORD = 8228; +pub const ERROR_DS_COMPARE_FALSE: ::DWORD = 8229; +pub const ERROR_DS_COMPARE_TRUE: ::DWORD = 8230; +pub const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: ::DWORD = 8231; +pub const ERROR_DS_STRONG_AUTH_REQUIRED: ::DWORD = 8232; +pub const ERROR_DS_INAPPROPRIATE_AUTH: ::DWORD = 8233; +pub const ERROR_DS_AUTH_UNKNOWN: ::DWORD = 8234; +pub const ERROR_DS_REFERRAL: ::DWORD = 8235; +pub const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: ::DWORD = 8236; +pub const ERROR_DS_CONFIDENTIALITY_REQUIRED: ::DWORD = 8237; +pub const ERROR_DS_INAPPROPRIATE_MATCHING: ::DWORD = 8238; +pub const ERROR_DS_CONSTRAINT_VIOLATION: ::DWORD = 8239; +pub const ERROR_DS_NO_SUCH_OBJECT: ::DWORD = 8240; +pub const ERROR_DS_ALIAS_PROBLEM: ::DWORD = 8241; +pub const ERROR_DS_INVALID_DN_SYNTAX: ::DWORD = 8242; +pub const ERROR_DS_IS_LEAF: ::DWORD = 8243; +pub const ERROR_DS_ALIAS_DEREF_PROBLEM: ::DWORD = 8244; +pub const ERROR_DS_UNWILLING_TO_PERFORM: ::DWORD = 8245; +pub const ERROR_DS_LOOP_DETECT: ::DWORD = 8246; +pub const ERROR_DS_NAMING_VIOLATION: ::DWORD = 8247; +pub const ERROR_DS_OBJECT_RESULTS_TOO_LARGE: ::DWORD = 8248; +pub const ERROR_DS_AFFECTS_MULTIPLE_DSAS: ::DWORD = 8249; +pub const ERROR_DS_SERVER_DOWN: ::DWORD = 8250; +pub const ERROR_DS_LOCAL_ERROR: ::DWORD = 8251; +pub const ERROR_DS_ENCODING_ERROR: ::DWORD = 8252; +pub const ERROR_DS_DECODING_ERROR: ::DWORD = 8253; +pub const ERROR_DS_FILTER_UNKNOWN: ::DWORD = 8254; +pub const ERROR_DS_PARAM_ERROR: ::DWORD = 8255; +pub const ERROR_DS_NOT_SUPPORTED: ::DWORD = 8256; +pub const ERROR_DS_NO_RESULTS_RETURNED: ::DWORD = 8257; +pub const ERROR_DS_CONTROL_NOT_FOUND: ::DWORD = 8258; +pub const ERROR_DS_CLIENT_LOOP: ::DWORD = 8259; +pub const ERROR_DS_REFERRAL_LIMIT_EXCEEDED: ::DWORD = 8260; +pub const ERROR_DS_SORT_CONTROL_MISSING: ::DWORD = 8261; +pub const ERROR_DS_OFFSET_RANGE_ERROR: ::DWORD = 8262; +pub const ERROR_DS_RIDMGR_DISABLED: ::DWORD = 8263; +pub const ERROR_DS_ROOT_MUST_BE_NC: ::DWORD = 8301; +pub const ERROR_DS_ADD_REPLICA_INHIBITED: ::DWORD = 8302; +pub const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: ::DWORD = 8303; +pub const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: ::DWORD = 8304; +pub const ERROR_DS_OBJ_STRING_NAME_EXISTS: ::DWORD = 8305; +pub const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: ::DWORD = 8306; +pub const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: ::DWORD = 8307; +pub const ERROR_DS_NO_REQUESTED_ATTS_FOUND: ::DWORD = 8308; +pub const ERROR_DS_USER_BUFFER_TO_SMALL: ::DWORD = 8309; +pub const ERROR_DS_ATT_IS_NOT_ON_OBJ: ::DWORD = 8310; +pub const ERROR_DS_ILLEGAL_MOD_OPERATION: ::DWORD = 8311; +pub const ERROR_DS_OBJ_TOO_LARGE: ::DWORD = 8312; +pub const ERROR_DS_BAD_INSTANCE_TYPE: ::DWORD = 8313; +pub const ERROR_DS_MASTERDSA_REQUIRED: ::DWORD = 8314; +pub const ERROR_DS_OBJECT_CLASS_REQUIRED: ::DWORD = 8315; +pub const ERROR_DS_MISSING_REQUIRED_ATT: ::DWORD = 8316; +pub const ERROR_DS_ATT_NOT_DEF_FOR_CLASS: ::DWORD = 8317; +pub const ERROR_DS_ATT_ALREADY_EXISTS: ::DWORD = 8318; +pub const ERROR_DS_CANT_ADD_ATT_VALUES: ::DWORD = 8320; +pub const ERROR_DS_SINGLE_VALUE_CONSTRAINT: ::DWORD = 8321; +pub const ERROR_DS_RANGE_CONSTRAINT: ::DWORD = 8322; +pub const ERROR_DS_ATT_VAL_ALREADY_EXISTS: ::DWORD = 8323; +pub const ERROR_DS_CANT_REM_MISSING_ATT: ::DWORD = 8324; +pub const ERROR_DS_CANT_REM_MISSING_ATT_VAL: ::DWORD = 8325; +pub const ERROR_DS_ROOT_CANT_BE_SUBREF: ::DWORD = 8326; +pub const ERROR_DS_NO_CHAINING: ::DWORD = 8327; +pub const ERROR_DS_NO_CHAINED_EVAL: ::DWORD = 8328; +pub const ERROR_DS_NO_PARENT_OBJECT: ::DWORD = 8329; +pub const ERROR_DS_PARENT_IS_AN_ALIAS: ::DWORD = 8330; +pub const ERROR_DS_CANT_MIX_MASTER_AND_REPS: ::DWORD = 8331; +pub const ERROR_DS_CHILDREN_EXIST: ::DWORD = 8332; +pub const ERROR_DS_OBJ_NOT_FOUND: ::DWORD = 8333; +pub const ERROR_DS_ALIASED_OBJ_MISSING: ::DWORD = 8334; +pub const ERROR_DS_BAD_NAME_SYNTAX: ::DWORD = 8335; +pub const ERROR_DS_ALIAS_POINTS_TO_ALIAS: ::DWORD = 8336; +pub const ERROR_DS_CANT_DEREF_ALIAS: ::DWORD = 8337; +pub const ERROR_DS_OUT_OF_SCOPE: ::DWORD = 8338; +pub const ERROR_DS_OBJECT_BEING_REMOVED: ::DWORD = 8339; +pub const ERROR_DS_CANT_DELETE_DSA_OBJ: ::DWORD = 8340; +pub const ERROR_DS_GENERIC_ERROR: ::DWORD = 8341; +pub const ERROR_DS_DSA_MUST_BE_INT_MASTER: ::DWORD = 8342; +pub const ERROR_DS_CLASS_NOT_DSA: ::DWORD = 8343; +pub const ERROR_DS_INSUFF_ACCESS_RIGHTS: ::DWORD = 8344; +pub const ERROR_DS_ILLEGAL_SUPERIOR: ::DWORD = 8345; +pub const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: ::DWORD = 8346; +pub const ERROR_DS_NAME_TOO_MANY_PARTS: ::DWORD = 8347; +pub const ERROR_DS_NAME_TOO_LONG: ::DWORD = 8348; +pub const ERROR_DS_NAME_VALUE_TOO_LONG: ::DWORD = 8349; +pub const ERROR_DS_NAME_UNPARSEABLE: ::DWORD = 8350; +pub const ERROR_DS_NAME_TYPE_UNKNOWN: ::DWORD = 8351; +pub const ERROR_DS_NOT_AN_OBJECT: ::DWORD = 8352; +pub const ERROR_DS_SEC_DESC_TOO_SHORT: ::DWORD = 8353; +pub const ERROR_DS_SEC_DESC_INVALID: ::DWORD = 8354; +pub const ERROR_DS_NO_DELETED_NAME: ::DWORD = 8355; +pub const ERROR_DS_SUBREF_MUST_HAVE_PARENT: ::DWORD = 8356; +pub const ERROR_DS_NCNAME_MUST_BE_NC: ::DWORD = 8357; +pub const ERROR_DS_CANT_ADD_SYSTEM_ONLY: ::DWORD = 8358; +pub const ERROR_DS_CLASS_MUST_BE_CONCRETE: ::DWORD = 8359; +pub const ERROR_DS_INVALID_DMD: ::DWORD = 8360; +pub const ERROR_DS_OBJ_GUID_EXISTS: ::DWORD = 8361; +pub const ERROR_DS_NOT_ON_BACKLINK: ::DWORD = 8362; +pub const ERROR_DS_NO_CROSSREF_FOR_NC: ::DWORD = 8363; +pub const ERROR_DS_SHUTTING_DOWN: ::DWORD = 8364; +pub const ERROR_DS_UNKNOWN_OPERATION: ::DWORD = 8365; +pub const ERROR_DS_INVALID_ROLE_OWNER: ::DWORD = 8366; +pub const ERROR_DS_COULDNT_CONTACT_FSMO: ::DWORD = 8367; +pub const ERROR_DS_CROSS_NC_DN_RENAME: ::DWORD = 8368; +pub const ERROR_DS_CANT_MOD_SYSTEM_ONLY: ::DWORD = 8369; +pub const ERROR_DS_REPLICATOR_ONLY: ::DWORD = 8370; +pub const ERROR_DS_OBJ_CLASS_NOT_DEFINED: ::DWORD = 8371; +pub const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: ::DWORD = 8372; +pub const ERROR_DS_NAME_REFERENCE_INVALID: ::DWORD = 8373; +pub const ERROR_DS_CROSS_REF_EXISTS: ::DWORD = 8374; +pub const ERROR_DS_CANT_DEL_MASTER_CROSSREF: ::DWORD = 8375; +pub const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: ::DWORD = 8376; +pub const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: ::DWORD = 8377; +pub const ERROR_DS_DUP_RDN: ::DWORD = 8378; +pub const ERROR_DS_DUP_OID: ::DWORD = 8379; +pub const ERROR_DS_DUP_MAPI_ID: ::DWORD = 8380; +pub const ERROR_DS_DUP_SCHEMA_ID_GUID: ::DWORD = 8381; +pub const ERROR_DS_DUP_LDAP_DISPLAY_NAME: ::DWORD = 8382; +pub const ERROR_DS_SEMANTIC_ATT_TEST: ::DWORD = 8383; +pub const ERROR_DS_SYNTAX_MISMATCH: ::DWORD = 8384; +pub const ERROR_DS_EXISTS_IN_MUST_HAVE: ::DWORD = 8385; +pub const ERROR_DS_EXISTS_IN_MAY_HAVE: ::DWORD = 8386; +pub const ERROR_DS_NONEXISTENT_MAY_HAVE: ::DWORD = 8387; +pub const ERROR_DS_NONEXISTENT_MUST_HAVE: ::DWORD = 8388; +pub const ERROR_DS_AUX_CLS_TEST_FAIL: ::DWORD = 8389; +pub const ERROR_DS_NONEXISTENT_POSS_SUP: ::DWORD = 8390; +pub const ERROR_DS_SUB_CLS_TEST_FAIL: ::DWORD = 8391; +pub const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: ::DWORD = 8392; +pub const ERROR_DS_EXISTS_IN_AUX_CLS: ::DWORD = 8393; +pub const ERROR_DS_EXISTS_IN_SUB_CLS: ::DWORD = 8394; +pub const ERROR_DS_EXISTS_IN_POSS_SUP: ::DWORD = 8395; +pub const ERROR_DS_RECALCSCHEMA_FAILED: ::DWORD = 8396; +pub const ERROR_DS_TREE_DELETE_NOT_FINISHED: ::DWORD = 8397; +pub const ERROR_DS_CANT_DELETE: ::DWORD = 8398; +pub const ERROR_DS_ATT_SCHEMA_REQ_ID: ::DWORD = 8399; +pub const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: ::DWORD = 8400; +pub const ERROR_DS_CANT_CACHE_ATT: ::DWORD = 8401; +pub const ERROR_DS_CANT_CACHE_CLASS: ::DWORD = 8402; +pub const ERROR_DS_CANT_REMOVE_ATT_CACHE: ::DWORD = 8403; +pub const ERROR_DS_CANT_REMOVE_CLASS_CACHE: ::DWORD = 8404; +pub const ERROR_DS_CANT_RETRIEVE_DN: ::DWORD = 8405; +pub const ERROR_DS_MISSING_SUPREF: ::DWORD = 8406; +pub const ERROR_DS_CANT_RETRIEVE_INSTANCE: ::DWORD = 8407; +pub const ERROR_DS_CODE_INCONSISTENCY: ::DWORD = 8408; +pub const ERROR_DS_DATABASE_ERROR: ::DWORD = 8409; +pub const ERROR_DS_GOVERNSID_MISSING: ::DWORD = 8410; +pub const ERROR_DS_MISSING_EXPECTED_ATT: ::DWORD = 8411; +pub const ERROR_DS_NCNAME_MISSING_CR_REF: ::DWORD = 8412; +pub const ERROR_DS_SECURITY_CHECKING_ERROR: ::DWORD = 8413; +pub const ERROR_DS_SCHEMA_NOT_LOADED: ::DWORD = 8414; +pub const ERROR_DS_SCHEMA_ALLOC_FAILED: ::DWORD = 8415; +pub const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: ::DWORD = 8416; +pub const ERROR_DS_GCVERIFY_ERROR: ::DWORD = 8417; +pub const ERROR_DS_DRA_SCHEMA_MISMATCH: ::DWORD = 8418; +pub const ERROR_DS_CANT_FIND_DSA_OBJ: ::DWORD = 8419; +pub const ERROR_DS_CANT_FIND_EXPECTED_NC: ::DWORD = 8420; +pub const ERROR_DS_CANT_FIND_NC_IN_CACHE: ::DWORD = 8421; +pub const ERROR_DS_CANT_RETRIEVE_CHILD: ::DWORD = 8422; +pub const ERROR_DS_SECURITY_ILLEGAL_MODIFY: ::DWORD = 8423; +pub const ERROR_DS_CANT_REPLACE_HIDDEN_REC: ::DWORD = 8424; +pub const ERROR_DS_BAD_HIERARCHY_FILE: ::DWORD = 8425; +pub const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: ::DWORD = 8426; +pub const ERROR_DS_CONFIG_PARAM_MISSING: ::DWORD = 8427; +pub const ERROR_DS_COUNTING_AB_INDICES_FAILED: ::DWORD = 8428; +pub const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: ::DWORD = 8429; +pub const ERROR_DS_INTERNAL_FAILURE: ::DWORD = 8430; +pub const ERROR_DS_UNKNOWN_ERROR: ::DWORD = 8431; +pub const ERROR_DS_ROOT_REQUIRES_CLASS_TOP: ::DWORD = 8432; +pub const ERROR_DS_REFUSING_FSMO_ROLES: ::DWORD = 8433; +pub const ERROR_DS_MISSING_FSMO_SETTINGS: ::DWORD = 8434; +pub const ERROR_DS_UNABLE_TO_SURRENDER_ROLES: ::DWORD = 8435; +pub const ERROR_DS_DRA_GENERIC: ::DWORD = 8436; +pub const ERROR_DS_DRA_INVALID_PARAMETER: ::DWORD = 8437; +pub const ERROR_DS_DRA_BUSY: ::DWORD = 8438; +pub const ERROR_DS_DRA_BAD_DN: ::DWORD = 8439; +pub const ERROR_DS_DRA_BAD_NC: ::DWORD = 8440; +pub const ERROR_DS_DRA_DN_EXISTS: ::DWORD = 8441; +pub const ERROR_DS_DRA_INTERNAL_ERROR: ::DWORD = 8442; +pub const ERROR_DS_DRA_INCONSISTENT_DIT: ::DWORD = 8443; +pub const ERROR_DS_DRA_CONNECTION_FAILED: ::DWORD = 8444; +pub const ERROR_DS_DRA_BAD_INSTANCE_TYPE: ::DWORD = 8445; +pub const ERROR_DS_DRA_OUT_OF_MEM: ::DWORD = 8446; +pub const ERROR_DS_DRA_MAIL_PROBLEM: ::DWORD = 8447; +pub const ERROR_DS_DRA_REF_ALREADY_EXISTS: ::DWORD = 8448; +pub const ERROR_DS_DRA_REF_NOT_FOUND: ::DWORD = 8449; +pub const ERROR_DS_DRA_OBJ_IS_REP_SOURCE: ::DWORD = 8450; +pub const ERROR_DS_DRA_DB_ERROR: ::DWORD = 8451; +pub const ERROR_DS_DRA_NO_REPLICA: ::DWORD = 8452; +pub const ERROR_DS_DRA_ACCESS_DENIED: ::DWORD = 8453; +pub const ERROR_DS_DRA_NOT_SUPPORTED: ::DWORD = 8454; +pub const ERROR_DS_DRA_RPC_CANCELLED: ::DWORD = 8455; +pub const ERROR_DS_DRA_SOURCE_DISABLED: ::DWORD = 8456; +pub const ERROR_DS_DRA_SINK_DISABLED: ::DWORD = 8457; +pub const ERROR_DS_DRA_NAME_COLLISION: ::DWORD = 8458; +pub const ERROR_DS_DRA_SOURCE_REINSTALLED: ::DWORD = 8459; +pub const ERROR_DS_DRA_MISSING_PARENT: ::DWORD = 8460; +pub const ERROR_DS_DRA_PREEMPTED: ::DWORD = 8461; +pub const ERROR_DS_DRA_ABANDON_SYNC: ::DWORD = 8462; +pub const ERROR_DS_DRA_SHUTDOWN: ::DWORD = 8463; +pub const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: ::DWORD = 8464; +pub const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: ::DWORD = 8465; +pub const ERROR_DS_DRA_EXTN_CONNECTION_FAILED: ::DWORD = 8466; +pub const ERROR_DS_INSTALL_SCHEMA_MISMATCH: ::DWORD = 8467; +pub const ERROR_DS_DUP_LINK_ID: ::DWORD = 8468; +pub const ERROR_DS_NAME_ERROR_RESOLVING: ::DWORD = 8469; +pub const ERROR_DS_NAME_ERROR_NOT_FOUND: ::DWORD = 8470; +pub const ERROR_DS_NAME_ERROR_NOT_UNIQUE: ::DWORD = 8471; +pub const ERROR_DS_NAME_ERROR_NO_MAPPING: ::DWORD = 8472; +pub const ERROR_DS_NAME_ERROR_DOMAIN_ONLY: ::DWORD = 8473; +pub const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: ::DWORD = 8474; +pub const ERROR_DS_CONSTRUCTED_ATT_MOD: ::DWORD = 8475; +pub const ERROR_DS_WRONG_OM_OBJ_CLASS: ::DWORD = 8476; +pub const ERROR_DS_DRA_REPL_PENDING: ::DWORD = 8477; +pub const ERROR_DS_DS_REQUIRED: ::DWORD = 8478; +pub const ERROR_DS_INVALID_LDAP_DISPLAY_NAME: ::DWORD = 8479; +pub const ERROR_DS_NON_BASE_SEARCH: ::DWORD = 8480; +pub const ERROR_DS_CANT_RETRIEVE_ATTS: ::DWORD = 8481; +pub const ERROR_DS_BACKLINK_WITHOUT_LINK: ::DWORD = 8482; +pub const ERROR_DS_EPOCH_MISMATCH: ::DWORD = 8483; +pub const ERROR_DS_SRC_NAME_MISMATCH: ::DWORD = 8484; +pub const ERROR_DS_SRC_AND_DST_NC_IDENTICAL: ::DWORD = 8485; +pub const ERROR_DS_DST_NC_MISMATCH: ::DWORD = 8486; +pub const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: ::DWORD = 8487; +pub const ERROR_DS_SRC_GUID_MISMATCH: ::DWORD = 8488; +pub const ERROR_DS_CANT_MOVE_DELETED_OBJECT: ::DWORD = 8489; +pub const ERROR_DS_PDC_OPERATION_IN_PROGRESS: ::DWORD = 8490; +pub const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: ::DWORD = 8491; +pub const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: ::DWORD = 8492; +pub const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: ::DWORD = 8493; +pub const ERROR_DS_NC_MUST_HAVE_NC_PARENT: ::DWORD = 8494; +pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: ::DWORD = 8495; +pub const ERROR_DS_DST_DOMAIN_NOT_NATIVE: ::DWORD = 8496; +pub const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: ::DWORD = 8497; +pub const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: ::DWORD = 8498; +pub const ERROR_DS_CANT_MOVE_RESOURCE_GROUP: ::DWORD = 8499; +pub const ERROR_DS_INVALID_SEARCH_FLAG: ::DWORD = 8500; +pub const ERROR_DS_NO_TREE_DELETE_ABOVE_NC: ::DWORD = 8501; +pub const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: ::DWORD = 8502; +pub const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: ::DWORD = 8503; +pub const ERROR_DS_SAM_INIT_FAILURE: ::DWORD = 8504; +pub const ERROR_DS_SENSITIVE_GROUP_VIOLATION: ::DWORD = 8505; +pub const ERROR_DS_CANT_MOD_PRIMARYGROUPID: ::DWORD = 8506; +pub const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: ::DWORD = 8507; +pub const ERROR_DS_NONSAFE_SCHEMA_CHANGE: ::DWORD = 8508; +pub const ERROR_DS_SCHEMA_UPDATE_DISALLOWED: ::DWORD = 8509; +pub const ERROR_DS_CANT_CREATE_UNDER_SCHEMA: ::DWORD = 8510; +pub const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: ::DWORD = 8511; +pub const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: ::DWORD = 8512; +pub const ERROR_DS_INVALID_GROUP_TYPE: ::DWORD = 8513; +pub const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: ::DWORD = 8514; +pub const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: ::DWORD = 8515; +pub const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: ::DWORD = 8516; +pub const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: ::DWORD = 8517; +pub const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: ::DWORD = 8518; +pub const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: ::DWORD = 8519; +pub const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: ::DWORD = 8520; +pub const ERROR_DS_HAVE_PRIMARY_MEMBERS: ::DWORD = 8521; +pub const ERROR_DS_STRING_SD_CONVERSION_FAILED: ::DWORD = 8522; +pub const ERROR_DS_NAMING_MASTER_GC: ::DWORD = 8523; +pub const ERROR_DS_DNS_LOOKUP_FAILURE: ::DWORD = 8524; +pub const ERROR_DS_COULDNT_UPDATE_SPNS: ::DWORD = 8525; +pub const ERROR_DS_CANT_RETRIEVE_SD: ::DWORD = 8526; +pub const ERROR_DS_KEY_NOT_UNIQUE: ::DWORD = 8527; +pub const ERROR_DS_WRONG_LINKED_ATT_SYNTAX: ::DWORD = 8528; +pub const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: ::DWORD = 8529; +pub const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: ::DWORD = 8530; +pub const ERROR_DS_CANT_START: ::DWORD = 8531; +pub const ERROR_DS_INIT_FAILURE: ::DWORD = 8532; +pub const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: ::DWORD = 8533; +pub const ERROR_DS_SOURCE_DOMAIN_IN_FOREST: ::DWORD = 8534; +pub const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: ::DWORD = 8535; +pub const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: ::DWORD = 8536; +pub const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: ::DWORD = 8537; +pub const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: ::DWORD = 8538; +pub const ERROR_DS_SRC_SID_EXISTS_IN_FOREST: ::DWORD = 8539; +pub const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: ::DWORD = 8540; +pub const ERROR_SAM_INIT_FAILURE: ::DWORD = 8541; +pub const ERROR_DS_DRA_SCHEMA_INFO_SHIP: ::DWORD = 8542; +pub const ERROR_DS_DRA_SCHEMA_CONFLICT: ::DWORD = 8543; +pub const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: ::DWORD = 8544; +pub const ERROR_DS_DRA_OBJ_NC_MISMATCH: ::DWORD = 8545; +pub const ERROR_DS_NC_STILL_HAS_DSAS: ::DWORD = 8546; +pub const ERROR_DS_GC_REQUIRED: ::DWORD = 8547; +pub const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: ::DWORD = 8548; +pub const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: ::DWORD = 8549; +pub const ERROR_DS_CANT_ADD_TO_GC: ::DWORD = 8550; +pub const ERROR_DS_NO_CHECKPOINT_WITH_PDC: ::DWORD = 8551; +pub const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: ::DWORD = 8552; +pub const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: ::DWORD = 8553; +pub const ERROR_DS_INVALID_NAME_FOR_SPN: ::DWORD = 8554; +pub const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: ::DWORD = 8555; +pub const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: ::DWORD = 8556; +pub const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: ::DWORD = 8557; +pub const ERROR_DS_MUST_BE_RUN_ON_DST_DC: ::DWORD = 8558; +pub const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: ::DWORD = 8559; +pub const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: ::DWORD = 8560; +pub const ERROR_DS_INIT_FAILURE_CONSOLE: ::DWORD = 8561; +pub const ERROR_DS_SAM_INIT_FAILURE_CONSOLE: ::DWORD = 8562; +pub const ERROR_DS_FOREST_VERSION_TOO_HIGH: ::DWORD = 8563; +pub const ERROR_DS_DOMAIN_VERSION_TOO_HIGH: ::DWORD = 8564; +pub const ERROR_DS_FOREST_VERSION_TOO_LOW: ::DWORD = 8565; +pub const ERROR_DS_DOMAIN_VERSION_TOO_LOW: ::DWORD = 8566; +pub const ERROR_DS_INCOMPATIBLE_VERSION: ::DWORD = 8567; +pub const ERROR_DS_LOW_DSA_VERSION: ::DWORD = 8568; +pub const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: ::DWORD = 8569; +pub const ERROR_DS_NOT_SUPPORTED_SORT_ORDER: ::DWORD = 8570; +pub const ERROR_DS_NAME_NOT_UNIQUE: ::DWORD = 8571; +pub const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: ::DWORD = 8572; +pub const ERROR_DS_OUT_OF_VERSION_STORE: ::DWORD = 8573; +pub const ERROR_DS_INCOMPATIBLE_CONTROLS_USED: ::DWORD = 8574; +pub const ERROR_DS_NO_REF_DOMAIN: ::DWORD = 8575; +pub const ERROR_DS_RESERVED_LINK_ID: ::DWORD = 8576; +pub const ERROR_DS_LINK_ID_NOT_AVAILABLE: ::DWORD = 8577; +pub const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: ::DWORD = 8578; +pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: ::DWORD = 8579; +pub const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: ::DWORD = 8580; +pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: ::DWORD = 8581; +pub const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: ::DWORD = 8582; +pub const ERROR_DS_NAME_ERROR_TRUST_REFERRAL: ::DWORD = 8583; +pub const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: ::DWORD = 8584; +pub const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: ::DWORD = 8585; +pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: ::DWORD = 8586; +pub const ERROR_DS_THREAD_LIMIT_EXCEEDED: ::DWORD = 8587; +pub const ERROR_DS_NOT_CLOSEST: ::DWORD = 8588; +pub const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: ::DWORD = 8589; +pub const ERROR_DS_SINGLE_USER_MODE_FAILED: ::DWORD = 8590; +pub const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: ::DWORD = 8591; +pub const ERROR_DS_NTDSCRIPT_PROCESS_ERROR: ::DWORD = 8592; +pub const ERROR_DS_DIFFERENT_REPL_EPOCHS: ::DWORD = 8593; +pub const ERROR_DS_DRS_EXTENSIONS_CHANGED: ::DWORD = 8594; +pub const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: ::DWORD = 8595; +pub const ERROR_DS_NO_MSDS_INTID: ::DWORD = 8596; +pub const ERROR_DS_DUP_MSDS_INTID: ::DWORD = 8597; +pub const ERROR_DS_EXISTS_IN_RDNATTID: ::DWORD = 8598; +pub const ERROR_DS_AUTHORIZATION_FAILED: ::DWORD = 8599; +pub const ERROR_DS_INVALID_SCRIPT: ::DWORD = 8600; +pub const ERROR_DS_REMOTE_CROSSREF_OP_FAILED: ::DWORD = 8601; +pub const ERROR_DS_CROSS_REF_BUSY: ::DWORD = 8602; +pub const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: ::DWORD = 8603; +pub const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: ::DWORD = 8604; +pub const ERROR_DS_DUPLICATE_ID_FOUND: ::DWORD = 8605; +pub const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: ::DWORD = 8606; +pub const ERROR_DS_GROUP_CONVERSION_ERROR: ::DWORD = 8607; +pub const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: ::DWORD = 8608; +pub const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: ::DWORD = 8609; +pub const ERROR_DS_ROLE_NOT_VERIFIED: ::DWORD = 8610; +pub const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: ::DWORD = 8611; +pub const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: ::DWORD = 8612; +pub const ERROR_DS_EXISTING_AD_CHILD_NC: ::DWORD = 8613; +pub const ERROR_DS_REPL_LIFETIME_EXCEEDED: ::DWORD = 8614; +pub const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: ::DWORD = 8615; +pub const ERROR_DS_LDAP_SEND_QUEUE_FULL: ::DWORD = 8616; +pub const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: ::DWORD = 8617; +pub const ERROR_DS_POLICY_NOT_KNOWN: ::DWORD = 8618; +pub const ERROR_NO_SITE_SETTINGS_OBJECT: ::DWORD = 8619; +pub const ERROR_NO_SECRETS: ::DWORD = 8620; +pub const ERROR_NO_WRITABLE_DC_FOUND: ::DWORD = 8621; +pub const ERROR_DS_NO_SERVER_OBJECT: ::DWORD = 8622; +pub const ERROR_DS_NO_NTDSA_OBJECT: ::DWORD = 8623; +pub const ERROR_DS_NON_ASQ_SEARCH: ::DWORD = 8624; +pub const ERROR_DS_AUDIT_FAILURE: ::DWORD = 8625; +pub const ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE: ::DWORD = 8626; +pub const ERROR_DS_INVALID_SEARCH_FLAG_TUPLE: ::DWORD = 8627; +pub const ERROR_DS_HIERARCHY_TABLE_TOO_DEEP: ::DWORD = 8628; +pub const ERROR_DS_DRA_CORRUPT_UTD_VECTOR: ::DWORD = 8629; +pub const ERROR_DS_DRA_SECRETS_DENIED: ::DWORD = 8630; +pub const ERROR_DS_RESERVED_MAPI_ID: ::DWORD = 8631; +pub const ERROR_DS_MAPI_ID_NOT_AVAILABLE: ::DWORD = 8632; +pub const ERROR_DS_DRA_MISSING_KRBTGT_SECRET: ::DWORD = 8633; +pub const ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST: ::DWORD = 8634; +pub const ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST: ::DWORD = 8635; +pub const ERROR_INVALID_USER_PRINCIPAL_NAME: ::DWORD = 8636; +pub const ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: ::DWORD = 8637; +pub const ERROR_DS_OID_NOT_FOUND: ::DWORD = 8638; +pub const ERROR_DS_DRA_RECYCLED_TARGET: ::DWORD = 8639; +pub const ERROR_DS_DISALLOWED_NC_REDIRECT: ::DWORD = 8640; +pub const ERROR_DS_HIGH_ADLDS_FFL: ::DWORD = 8641; +pub const ERROR_DS_HIGH_DSA_VERSION: ::DWORD = 8642; +pub const ERROR_DS_LOW_ADLDS_FFL: ::DWORD = 8643; +pub const ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION: ::DWORD = 8644; +pub const ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED: ::DWORD = 8645; +pub const ERROR_INCORRECT_ACCOUNT_TYPE: ::DWORD = 8646; +pub const ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST: ::DWORD = 8647; +pub const ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST: ::DWORD = 8648; +pub const DNS_ERROR_RESPONSE_CODES_BASE: ::DWORD = 9000; +pub const DNS_ERROR_RCODE_NO_ERROR: ::DWORD = NO_ERROR; +pub const DNS_ERROR_MASK: ::DWORD = 0x00002328; +pub const DNS_ERROR_RCODE_FORMAT_ERROR: ::DWORD = 9001; +pub const DNS_ERROR_RCODE_SERVER_FAILURE: ::DWORD = 9002; +pub const DNS_ERROR_RCODE_NAME_ERROR: ::DWORD = 9003; +pub const DNS_ERROR_RCODE_NOT_IMPLEMENTED: ::DWORD = 9004; +pub const DNS_ERROR_RCODE_REFUSED: ::DWORD = 9005; +pub const DNS_ERROR_RCODE_YXDOMAIN: ::DWORD = 9006; +pub const DNS_ERROR_RCODE_YXRRSET: ::DWORD = 9007; +pub const DNS_ERROR_RCODE_NXRRSET: ::DWORD = 9008; +pub const DNS_ERROR_RCODE_NOTAUTH: ::DWORD = 9009; +pub const DNS_ERROR_RCODE_NOTZONE: ::DWORD = 9010; +pub const DNS_ERROR_RCODE_BADSIG: ::DWORD = 9016; +pub const DNS_ERROR_RCODE_BADKEY: ::DWORD = 9017; +pub const DNS_ERROR_RCODE_BADTIME: ::DWORD = 9018; +pub const DNS_ERROR_RCODE_LAST: ::DWORD = DNS_ERROR_RCODE_BADTIME; +pub const DNS_ERROR_DNSSEC_BASE: ::DWORD = 9100; +pub const DNS_ERROR_KEYMASTER_REQUIRED: ::DWORD = 9101; +pub const DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE: ::DWORD = 9102; +pub const DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1: ::DWORD = 9103; +pub const DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS: ::DWORD = 9104; +pub const DNS_ERROR_UNSUPPORTED_ALGORITHM: ::DWORD = 9105; +pub const DNS_ERROR_INVALID_KEY_SIZE: ::DWORD = 9106; +pub const DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE: ::DWORD = 9107; +pub const DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION: ::DWORD = 9108; +pub const DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR: ::DWORD = 9109; +pub const DNS_ERROR_UNEXPECTED_CNG_ERROR: ::DWORD = 9110; +pub const DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION: ::DWORD = 9111; +pub const DNS_ERROR_KSP_NOT_ACCESSIBLE: ::DWORD = 9112; +pub const DNS_ERROR_TOO_MANY_SKDS: ::DWORD = 9113; +pub const DNS_ERROR_INVALID_ROLLOVER_PERIOD: ::DWORD = 9114; +pub const DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET: ::DWORD = 9115; +pub const DNS_ERROR_ROLLOVER_IN_PROGRESS: ::DWORD = 9116; +pub const DNS_ERROR_STANDBY_KEY_NOT_PRESENT: ::DWORD = 9117; +pub const DNS_ERROR_NOT_ALLOWED_ON_ZSK: ::DWORD = 9118; +pub const DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD: ::DWORD = 9119; +pub const DNS_ERROR_ROLLOVER_ALREADY_QUEUED: ::DWORD = 9120; +pub const DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE: ::DWORD = 9121; +pub const DNS_ERROR_BAD_KEYMASTER: ::DWORD = 9122; +pub const DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD: ::DWORD = 9123; +pub const DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT: ::DWORD = 9124; +pub const DNS_ERROR_DNSSEC_IS_DISABLED: ::DWORD = 9125; +pub const DNS_ERROR_INVALID_XML: ::DWORD = 9126; +pub const DNS_ERROR_NO_VALID_TRUST_ANCHORS: ::DWORD = 9127; +pub const DNS_ERROR_ROLLOVER_NOT_POKEABLE: ::DWORD = 9128; +pub const DNS_ERROR_NSEC3_NAME_COLLISION: ::DWORD = 9129; +pub const DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1: ::DWORD = 9130; +pub const DNS_ERROR_PACKET_FMT_BASE: ::DWORD = 9500; +pub const DNS_INFO_NO_RECORDS: ::DWORD = 9501; +pub const DNS_ERROR_BAD_PACKET: ::DWORD = 9502; +pub const DNS_ERROR_NO_PACKET: ::DWORD = 9503; +pub const DNS_ERROR_RCODE: ::DWORD = 9504; +pub const DNS_ERROR_UNSECURE_PACKET: ::DWORD = 9505; +pub const DNS_STATUS_PACKET_UNSECURE: ::DWORD = DNS_ERROR_UNSECURE_PACKET; +pub const DNS_REQUEST_PENDING: ::DWORD = 9506; +pub const DNS_ERROR_NO_MEMORY: ::DWORD = ERROR_OUTOFMEMORY; +pub const DNS_ERROR_INVALID_NAME: ::DWORD = ERROR_INVALID_NAME; +pub const DNS_ERROR_INVALID_DATA: ::DWORD = ERROR_INVALID_DATA; +pub const DNS_ERROR_GENERAL_API_BASE: ::DWORD = 9550; +pub const DNS_ERROR_INVALID_TYPE: ::DWORD = 9551; +pub const DNS_ERROR_INVALID_IP_ADDRESS: ::DWORD = 9552; +pub const DNS_ERROR_INVALID_PROPERTY: ::DWORD = 9553; +pub const DNS_ERROR_TRY_AGAIN_LATER: ::DWORD = 9554; +pub const DNS_ERROR_NOT_UNIQUE: ::DWORD = 9555; +pub const DNS_ERROR_NON_RFC_NAME: ::DWORD = 9556; +pub const DNS_STATUS_FQDN: ::DWORD = 9557; +pub const DNS_STATUS_DOTTED_NAME: ::DWORD = 9558; +pub const DNS_STATUS_SINGLE_PART_NAME: ::DWORD = 9559; +pub const DNS_ERROR_INVALID_NAME_CHAR: ::DWORD = 9560; +pub const DNS_ERROR_NUMERIC_NAME: ::DWORD = 9561; +pub const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER: ::DWORD = 9562; +pub const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION: ::DWORD = 9563; +pub const DNS_ERROR_CANNOT_FIND_ROOT_HINTS: ::DWORD = 9564; +pub const DNS_ERROR_INCONSISTENT_ROOT_HINTS: ::DWORD = 9565; +pub const DNS_ERROR_DWORD_VALUE_TOO_SMALL: ::DWORD = 9566; +pub const DNS_ERROR_DWORD_VALUE_TOO_LARGE: ::DWORD = 9567; +pub const DNS_ERROR_BACKGROUND_LOADING: ::DWORD = 9568; +pub const DNS_ERROR_NOT_ALLOWED_ON_RODC: ::DWORD = 9569; +pub const DNS_ERROR_NOT_ALLOWED_UNDER_DNAME: ::DWORD = 9570; +pub const DNS_ERROR_DELEGATION_REQUIRED: ::DWORD = 9571; +pub const DNS_ERROR_INVALID_POLICY_TABLE: ::DWORD = 9572; +pub const DNS_ERROR_ZONE_BASE: ::DWORD = 9600; +pub const DNS_ERROR_ZONE_DOES_NOT_EXIST: ::DWORD = 9601; +pub const DNS_ERROR_NO_ZONE_INFO: ::DWORD = 9602; +pub const DNS_ERROR_INVALID_ZONE_OPERATION: ::DWORD = 9603; +pub const DNS_ERROR_ZONE_CONFIGURATION_ERROR: ::DWORD = 9604; +pub const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD: ::DWORD = 9605; +pub const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS: ::DWORD = 9606; +pub const DNS_ERROR_ZONE_LOCKED: ::DWORD = 9607; +pub const DNS_ERROR_ZONE_CREATION_FAILED: ::DWORD = 9608; +pub const DNS_ERROR_ZONE_ALREADY_EXISTS: ::DWORD = 9609; +pub const DNS_ERROR_AUTOZONE_ALREADY_EXISTS: ::DWORD = 9610; +pub const DNS_ERROR_INVALID_ZONE_TYPE: ::DWORD = 9611; +pub const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP: ::DWORD = 9612; +pub const DNS_ERROR_ZONE_NOT_SECONDARY: ::DWORD = 9613; +pub const DNS_ERROR_NEED_SECONDARY_ADDRESSES: ::DWORD = 9614; +pub const DNS_ERROR_WINS_INIT_FAILED: ::DWORD = 9615; +pub const DNS_ERROR_NEED_WINS_SERVERS: ::DWORD = 9616; +pub const DNS_ERROR_NBSTAT_INIT_FAILED: ::DWORD = 9617; +pub const DNS_ERROR_SOA_DELETE_INVALID: ::DWORD = 9618; +pub const DNS_ERROR_FORWARDER_ALREADY_EXISTS: ::DWORD = 9619; +pub const DNS_ERROR_ZONE_REQUIRES_MASTER_IP: ::DWORD = 9620; +pub const DNS_ERROR_ZONE_IS_SHUTDOWN: ::DWORD = 9621; +pub const DNS_ERROR_ZONE_LOCKED_FOR_SIGNING: ::DWORD = 9622; +pub const DNS_ERROR_DATAFILE_BASE: ::DWORD = 9650; +pub const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE: ::DWORD = 9651; +pub const DNS_ERROR_INVALID_DATAFILE_NAME: ::DWORD = 9652; +pub const DNS_ERROR_DATAFILE_OPEN_FAILURE: ::DWORD = 9653; +pub const DNS_ERROR_FILE_WRITEBACK_FAILED: ::DWORD = 9654; +pub const DNS_ERROR_DATAFILE_PARSING: ::DWORD = 9655; +pub const DNS_ERROR_DATABASE_BASE: ::DWORD = 9700; +pub const DNS_ERROR_RECORD_DOES_NOT_EXIST: ::DWORD = 9701; +pub const DNS_ERROR_RECORD_FORMAT: ::DWORD = 9702; +pub const DNS_ERROR_NODE_CREATION_FAILED: ::DWORD = 9703; +pub const DNS_ERROR_UNKNOWN_RECORD_TYPE: ::DWORD = 9704; +pub const DNS_ERROR_RECORD_TIMED_OUT: ::DWORD = 9705; +pub const DNS_ERROR_NAME_NOT_IN_ZONE: ::DWORD = 9706; +pub const DNS_ERROR_CNAME_LOOP: ::DWORD = 9707; +pub const DNS_ERROR_NODE_IS_CNAME: ::DWORD = 9708; +pub const DNS_ERROR_CNAME_COLLISION: ::DWORD = 9709; +pub const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT: ::DWORD = 9710; +pub const DNS_ERROR_RECORD_ALREADY_EXISTS: ::DWORD = 9711; +pub const DNS_ERROR_SECONDARY_DATA: ::DWORD = 9712; +pub const DNS_ERROR_NO_CREATE_CACHE_DATA: ::DWORD = 9713; +pub const DNS_ERROR_NAME_DOES_NOT_EXIST: ::DWORD = 9714; +pub const DNS_WARNING_PTR_CREATE_FAILED: ::DWORD = 9715; +pub const DNS_WARNING_DOMAIN_UNDELETED: ::DWORD = 9716; +pub const DNS_ERROR_DS_UNAVAILABLE: ::DWORD = 9717; +pub const DNS_ERROR_DS_ZONE_ALREADY_EXISTS: ::DWORD = 9718; +pub const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE: ::DWORD = 9719; +pub const DNS_ERROR_NODE_IS_DNAME: ::DWORD = 9720; +pub const DNS_ERROR_DNAME_COLLISION: ::DWORD = 9721; +pub const DNS_ERROR_ALIAS_LOOP: ::DWORD = 9722; +pub const DNS_ERROR_OPERATION_BASE: ::DWORD = 9750; +pub const DNS_INFO_AXFR_COMPLETE: ::DWORD = 9751; +pub const DNS_ERROR_AXFR: ::DWORD = 9752; +pub const DNS_INFO_ADDED_LOCAL_WINS: ::DWORD = 9753; +pub const DNS_ERROR_SECURE_BASE: ::DWORD = 9800; +pub const DNS_STATUS_CONTINUE_NEEDED: ::DWORD = 9801; +pub const DNS_ERROR_SETUP_BASE: ::DWORD = 9850; +pub const DNS_ERROR_NO_TCPIP: ::DWORD = 9851; +pub const DNS_ERROR_NO_DNS_SERVERS: ::DWORD = 9852; +pub const DNS_ERROR_DP_BASE: ::DWORD = 9900; +pub const DNS_ERROR_DP_DOES_NOT_EXIST: ::DWORD = 9901; +pub const DNS_ERROR_DP_ALREADY_EXISTS: ::DWORD = 9902; +pub const DNS_ERROR_DP_NOT_ENLISTED: ::DWORD = 9903; +pub const DNS_ERROR_DP_ALREADY_ENLISTED: ::DWORD = 9904; +pub const DNS_ERROR_DP_NOT_AVAILABLE: ::DWORD = 9905; +pub const DNS_ERROR_DP_FSMO_ERROR: ::DWORD = 9906; +pub const DNS_ERROR_ZONESCOPE_ALREADY_EXISTS: ::DWORD = 9951; +pub const DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST: ::DWORD = 9952; +pub const DNS_ERROR_DEFAULT_ZONESCOPE: ::DWORD = 9953; +pub const DNS_ERROR_INVALID_ZONESCOPE_NAME: ::DWORD = 9954; +pub const DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES: ::DWORD = 9955; +pub const DNS_ERROR_LOAD_ZONESCOPE_FAILED: ::DWORD = 9956; +pub const DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED: ::DWORD = 9957; +pub const DNS_ERROR_INVALID_SCOPE_NAME: ::DWORD = 9958; +pub const DNS_ERROR_SCOPE_DOES_NOT_EXIST: ::DWORD = 9959; +pub const DNS_ERROR_DEFAULT_SCOPE: ::DWORD = 9960; +pub const DNS_ERROR_INVALID_SCOPE_OPERATION: ::DWORD = 9961; +pub const DNS_ERROR_SCOPE_LOCKED: ::DWORD = 9962; +pub const DNS_ERROR_SCOPE_ALREADY_EXISTS: ::DWORD = 9963; +pub const WSABASEERR: ::DWORD = 10000; +pub const WSAEINTR: ::DWORD = 10004; +pub const WSAEBADF: ::DWORD = 10009; +pub const WSAEACCES: ::DWORD = 10013; +pub const WSAEFAULT: ::DWORD = 10014; +pub const WSAEINVAL: ::DWORD = 10022; +pub const WSAEMFILE: ::DWORD = 10024; +pub const WSAEWOULDBLOCK: ::DWORD = 10035; +pub const WSAEINPROGRESS: ::DWORD = 10036; +pub const WSAEALREADY: ::DWORD = 10037; +pub const WSAENOTSOCK: ::DWORD = 10038; +pub const WSAEDESTADDRREQ: ::DWORD = 10039; +pub const WSAEMSGSIZE: ::DWORD = 10040; +pub const WSAEPROTOTYPE: ::DWORD = 10041; +pub const WSAENOPROTOOPT: ::DWORD = 10042; +pub const WSAEPROTONOSUPPORT: ::DWORD = 10043; +pub const WSAESOCKTNOSUPPORT: ::DWORD = 10044; +pub const WSAEOPNOTSUPP: ::DWORD = 10045; +pub const WSAEPFNOSUPPORT: ::DWORD = 10046; +pub const WSAEAFNOSUPPORT: ::DWORD = 10047; +pub const WSAEADDRINUSE: ::DWORD = 10048; +pub const WSAEADDRNOTAVAIL: ::DWORD = 10049; +pub const WSAENETDOWN: ::DWORD = 10050; +pub const WSAENETUNREACH: ::DWORD = 10051; +pub const WSAENETRESET: ::DWORD = 10052; +pub const WSAECONNABORTED: ::DWORD = 10053; +pub const WSAECONNRESET: ::DWORD = 10054; +pub const WSAENOBUFS: ::DWORD = 10055; +pub const WSAEISCONN: ::DWORD = 10056; +pub const WSAENOTCONN: ::DWORD = 10057; +pub const WSAESHUTDOWN: ::DWORD = 10058; +pub const WSAETOOMANYREFS: ::DWORD = 10059; +pub const WSAETIMEDOUT: ::DWORD = 10060; +pub const WSAECONNREFUSED: ::DWORD = 10061; +pub const WSAELOOP: ::DWORD = 10062; +pub const WSAENAMETOOLONG: ::DWORD = 10063; +pub const WSAEHOSTDOWN: ::DWORD = 10064; +pub const WSAEHOSTUNREACH: ::DWORD = 10065; +pub const WSAENOTEMPTY: ::DWORD = 10066; +pub const WSAEPROCLIM: ::DWORD = 10067; +pub const WSAEUSERS: ::DWORD = 10068; +pub const WSAEDQUOT: ::DWORD = 10069; +pub const WSAESTALE: ::DWORD = 10070; +pub const WSAEREMOTE: ::DWORD = 10071; +pub const WSASYSNOTREADY: ::DWORD = 10091; +pub const WSAVERNOTSUPPORTED: ::DWORD = 10092; +pub const WSANOTINITIALISED: ::DWORD = 10093; +pub const WSAEDISCON: ::DWORD = 10101; +pub const WSAENOMORE: ::DWORD = 10102; +pub const WSAECANCELLED: ::DWORD = 10103; +pub const WSAEINVALIDPROCTABLE: ::DWORD = 10104; +pub const WSAEINVALIDPROVIDER: ::DWORD = 10105; +pub const WSAEPROVIDERFAILEDINIT: ::DWORD = 10106; +pub const WSASYSCALLFAILURE: ::DWORD = 10107; +pub const WSASERVICE_NOT_FOUND: ::DWORD = 10108; +pub const WSATYPE_NOT_FOUND: ::DWORD = 10109; +pub const WSA_E_NO_MORE: ::DWORD = 10110; +pub const WSA_E_CANCELLED: ::DWORD = 10111; +pub const WSAEREFUSED: ::DWORD = 10112; +pub const WSAHOST_NOT_FOUND: ::DWORD = 11001; +pub const WSATRY_AGAIN: ::DWORD = 11002; +pub const WSANO_RECOVERY: ::DWORD = 11003; +pub const WSANO_DATA: ::DWORD = 11004; +pub const WSA_QOS_RECEIVERS: ::DWORD = 11005; +pub const WSA_QOS_SENDERS: ::DWORD = 11006; +pub const WSA_QOS_NO_SENDERS: ::DWORD = 11007; +pub const WSA_QOS_NO_RECEIVERS: ::DWORD = 11008; +pub const WSA_QOS_REQUEST_CONFIRMED: ::DWORD = 11009; +pub const WSA_QOS_ADMISSION_FAILURE: ::DWORD = 11010; +pub const WSA_QOS_POLICY_FAILURE: ::DWORD = 11011; +pub const WSA_QOS_BAD_STYLE: ::DWORD = 11012; +pub const WSA_QOS_BAD_OBJECT: ::DWORD = 11013; +pub const WSA_QOS_TRAFFIC_CTRL_ERROR: ::DWORD = 11014; +pub const WSA_QOS_GENERIC_ERROR: ::DWORD = 11015; +pub const WSA_QOS_ESERVICETYPE: ::DWORD = 11016; +pub const WSA_QOS_EFLOWSPEC: ::DWORD = 11017; +pub const WSA_QOS_EPROVSPECBUF: ::DWORD = 11018; +pub const WSA_QOS_EFILTERSTYLE: ::DWORD = 11019; +pub const WSA_QOS_EFILTERTYPE: ::DWORD = 11020; +pub const WSA_QOS_EFILTERCOUNT: ::DWORD = 11021; +pub const WSA_QOS_EOBJLENGTH: ::DWORD = 11022; +pub const WSA_QOS_EFLOWCOUNT: ::DWORD = 11023; +pub const WSA_QOS_EUNKOWNPSOBJ: ::DWORD = 11024; +pub const WSA_QOS_EPOLICYOBJ: ::DWORD = 11025; +pub const WSA_QOS_EFLOWDESC: ::DWORD = 11026; +pub const WSA_QOS_EPSFLOWSPEC: ::DWORD = 11027; +pub const WSA_QOS_EPSFILTERSPEC: ::DWORD = 11028; +pub const WSA_QOS_ESDMODEOBJ: ::DWORD = 11029; +pub const WSA_QOS_ESHAPERATEOBJ: ::DWORD = 11030; +pub const WSA_QOS_RESERVED_PETYPE: ::DWORD = 11031; +pub const WSA_SECURE_HOST_NOT_FOUND: ::DWORD = 11032; +pub const WSA_IPSEC_NAME_POLICY_ERROR: ::DWORD = 11033; +pub const ERROR_IPSEC_QM_POLICY_EXISTS: ::DWORD = 13000; +pub const ERROR_IPSEC_QM_POLICY_NOT_FOUND: ::DWORD = 13001; +pub const ERROR_IPSEC_QM_POLICY_IN_USE: ::DWORD = 13002; +pub const ERROR_IPSEC_MM_POLICY_EXISTS: ::DWORD = 13003; +pub const ERROR_IPSEC_MM_POLICY_NOT_FOUND: ::DWORD = 13004; +pub const ERROR_IPSEC_MM_POLICY_IN_USE: ::DWORD = 13005; +pub const ERROR_IPSEC_MM_FILTER_EXISTS: ::DWORD = 13006; +pub const ERROR_IPSEC_MM_FILTER_NOT_FOUND: ::DWORD = 13007; +pub const ERROR_IPSEC_TRANSPORT_FILTER_EXISTS: ::DWORD = 13008; +pub const ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND: ::DWORD = 13009; +pub const ERROR_IPSEC_MM_AUTH_EXISTS: ::DWORD = 13010; +pub const ERROR_IPSEC_MM_AUTH_NOT_FOUND: ::DWORD = 13011; +pub const ERROR_IPSEC_MM_AUTH_IN_USE: ::DWORD = 13012; +pub const ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND: ::DWORD = 13013; +pub const ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND: ::DWORD = 13014; +pub const ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND: ::DWORD = 13015; +pub const ERROR_IPSEC_TUNNEL_FILTER_EXISTS: ::DWORD = 13016; +pub const ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND: ::DWORD = 13017; +pub const ERROR_IPSEC_MM_FILTER_PENDING_DELETION: ::DWORD = 13018; +pub const ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION: ::DWORD = 13019; +pub const ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION: ::DWORD = 13020; +pub const ERROR_IPSEC_MM_POLICY_PENDING_DELETION: ::DWORD = 13021; +pub const ERROR_IPSEC_MM_AUTH_PENDING_DELETION: ::DWORD = 13022; +pub const ERROR_IPSEC_QM_POLICY_PENDING_DELETION: ::DWORD = 13023; +pub const WARNING_IPSEC_MM_POLICY_PRUNED: ::DWORD = 13024; +pub const WARNING_IPSEC_QM_POLICY_PRUNED: ::DWORD = 13025; +pub const ERROR_IPSEC_IKE_NEG_STATUS_BEGIN: ::DWORD = 13800; +pub const ERROR_IPSEC_IKE_AUTH_FAIL: ::DWORD = 13801; +pub const ERROR_IPSEC_IKE_ATTRIB_FAIL: ::DWORD = 13802; +pub const ERROR_IPSEC_IKE_NEGOTIATION_PENDING: ::DWORD = 13803; +pub const ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR: ::DWORD = 13804; +pub const ERROR_IPSEC_IKE_TIMED_OUT: ::DWORD = 13805; +pub const ERROR_IPSEC_IKE_NO_CERT: ::DWORD = 13806; +pub const ERROR_IPSEC_IKE_SA_DELETED: ::DWORD = 13807; +pub const ERROR_IPSEC_IKE_SA_REAPED: ::DWORD = 13808; +pub const ERROR_IPSEC_IKE_MM_ACQUIRE_DROP: ::DWORD = 13809; +pub const ERROR_IPSEC_IKE_QM_ACQUIRE_DROP: ::DWORD = 13810; +pub const ERROR_IPSEC_IKE_QUEUE_DROP_MM: ::DWORD = 13811; +pub const ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM: ::DWORD = 13812; +pub const ERROR_IPSEC_IKE_DROP_NO_RESPONSE: ::DWORD = 13813; +pub const ERROR_IPSEC_IKE_MM_DELAY_DROP: ::DWORD = 13814; +pub const ERROR_IPSEC_IKE_QM_DELAY_DROP: ::DWORD = 13815; +pub const ERROR_IPSEC_IKE_ERROR: ::DWORD = 13816; +pub const ERROR_IPSEC_IKE_CRL_FAILED: ::DWORD = 13817; +pub const ERROR_IPSEC_IKE_INVALID_KEY_USAGE: ::DWORD = 13818; +pub const ERROR_IPSEC_IKE_INVALID_CERT_TYPE: ::DWORD = 13819; +pub const ERROR_IPSEC_IKE_NO_PRIVATE_KEY: ::DWORD = 13820; +pub const ERROR_IPSEC_IKE_SIMULTANEOUS_REKEY: ::DWORD = 13821; +pub const ERROR_IPSEC_IKE_DH_FAIL: ::DWORD = 13822; +pub const ERROR_IPSEC_IKE_CRITICAL_PAYLOAD_NOT_RECOGNIZED: ::DWORD = 13823; +pub const ERROR_IPSEC_IKE_INVALID_HEADER: ::DWORD = 13824; +pub const ERROR_IPSEC_IKE_NO_POLICY: ::DWORD = 13825; +pub const ERROR_IPSEC_IKE_INVALID_SIGNATURE: ::DWORD = 13826; +pub const ERROR_IPSEC_IKE_KERBEROS_ERROR: ::DWORD = 13827; +pub const ERROR_IPSEC_IKE_NO_PUBLIC_KEY: ::DWORD = 13828; +pub const ERROR_IPSEC_IKE_PROCESS_ERR: ::DWORD = 13829; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_SA: ::DWORD = 13830; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_PROP: ::DWORD = 13831; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_TRANS: ::DWORD = 13832; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_KE: ::DWORD = 13833; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_ID: ::DWORD = 13834; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT: ::DWORD = 13835; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ: ::DWORD = 13836; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_HASH: ::DWORD = 13837; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_SIG: ::DWORD = 13838; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_NONCE: ::DWORD = 13839; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY: ::DWORD = 13840; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_DELETE: ::DWORD = 13841; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR: ::DWORD = 13842; +pub const ERROR_IPSEC_IKE_INVALID_PAYLOAD: ::DWORD = 13843; +pub const ERROR_IPSEC_IKE_LOAD_SOFT_SA: ::DWORD = 13844; +pub const ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN: ::DWORD = 13845; +pub const ERROR_IPSEC_IKE_INVALID_COOKIE: ::DWORD = 13846; +pub const ERROR_IPSEC_IKE_NO_PEER_CERT: ::DWORD = 13847; +pub const ERROR_IPSEC_IKE_PEER_CRL_FAILED: ::DWORD = 13848; +pub const ERROR_IPSEC_IKE_POLICY_CHANGE: ::DWORD = 13849; +pub const ERROR_IPSEC_IKE_NO_MM_POLICY: ::DWORD = 13850; +pub const ERROR_IPSEC_IKE_NOTCBPRIV: ::DWORD = 13851; +pub const ERROR_IPSEC_IKE_SECLOADFAIL: ::DWORD = 13852; +pub const ERROR_IPSEC_IKE_FAILSSPINIT: ::DWORD = 13853; +pub const ERROR_IPSEC_IKE_FAILQUERYSSP: ::DWORD = 13854; +pub const ERROR_IPSEC_IKE_SRVACQFAIL: ::DWORD = 13855; +pub const ERROR_IPSEC_IKE_SRVQUERYCRED: ::DWORD = 13856; +pub const ERROR_IPSEC_IKE_GETSPIFAIL: ::DWORD = 13857; +pub const ERROR_IPSEC_IKE_INVALID_FILTER: ::DWORD = 13858; +pub const ERROR_IPSEC_IKE_OUT_OF_MEMORY: ::DWORD = 13859; +pub const ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED: ::DWORD = 13860; +pub const ERROR_IPSEC_IKE_INVALID_POLICY: ::DWORD = 13861; +pub const ERROR_IPSEC_IKE_UNKNOWN_DOI: ::DWORD = 13862; +pub const ERROR_IPSEC_IKE_INVALID_SITUATION: ::DWORD = 13863; +pub const ERROR_IPSEC_IKE_DH_FAILURE: ::DWORD = 13864; +pub const ERROR_IPSEC_IKE_INVALID_GROUP: ::DWORD = 13865; +pub const ERROR_IPSEC_IKE_ENCRYPT: ::DWORD = 13866; +pub const ERROR_IPSEC_IKE_DECRYPT: ::DWORD = 13867; +pub const ERROR_IPSEC_IKE_POLICY_MATCH: ::DWORD = 13868; +pub const ERROR_IPSEC_IKE_UNSUPPORTED_ID: ::DWORD = 13869; +pub const ERROR_IPSEC_IKE_INVALID_HASH: ::DWORD = 13870; +pub const ERROR_IPSEC_IKE_INVALID_HASH_ALG: ::DWORD = 13871; +pub const ERROR_IPSEC_IKE_INVALID_HASH_SIZE: ::DWORD = 13872; +pub const ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG: ::DWORD = 13873; +pub const ERROR_IPSEC_IKE_INVALID_AUTH_ALG: ::DWORD = 13874; +pub const ERROR_IPSEC_IKE_INVALID_SIG: ::DWORD = 13875; +pub const ERROR_IPSEC_IKE_LOAD_FAILED: ::DWORD = 13876; +pub const ERROR_IPSEC_IKE_RPC_DELETE: ::DWORD = 13877; +pub const ERROR_IPSEC_IKE_BENIGN_REINIT: ::DWORD = 13878; +pub const ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY: ::DWORD = 13879; +pub const ERROR_IPSEC_IKE_INVALID_MAJOR_VERSION: ::DWORD = 13880; +pub const ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN: ::DWORD = 13881; +pub const ERROR_IPSEC_IKE_MM_LIMIT: ::DWORD = 13882; +pub const ERROR_IPSEC_IKE_NEGOTIATION_DISABLED: ::DWORD = 13883; +pub const ERROR_IPSEC_IKE_QM_LIMIT: ::DWORD = 13884; +pub const ERROR_IPSEC_IKE_MM_EXPIRED: ::DWORD = 13885; +pub const ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID: ::DWORD = 13886; +pub const ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH: ::DWORD = 13887; +pub const ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID: ::DWORD = 13888; +pub const ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD: ::DWORD = 13889; +pub const ERROR_IPSEC_IKE_DOS_COOKIE_SENT: ::DWORD = 13890; +pub const ERROR_IPSEC_IKE_SHUTTING_DOWN: ::DWORD = 13891; +pub const ERROR_IPSEC_IKE_CGA_AUTH_FAILED: ::DWORD = 13892; +pub const ERROR_IPSEC_IKE_PROCESS_ERR_NATOA: ::DWORD = 13893; +pub const ERROR_IPSEC_IKE_INVALID_MM_FOR_QM: ::DWORD = 13894; +pub const ERROR_IPSEC_IKE_QM_EXPIRED: ::DWORD = 13895; +pub const ERROR_IPSEC_IKE_TOO_MANY_FILTERS: ::DWORD = 13896; +pub const ERROR_IPSEC_IKE_NEG_STATUS_END: ::DWORD = 13897; +pub const ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL: ::DWORD = 13898; +pub const ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE: ::DWORD = 13899; +pub const ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING: ::DWORD = 13900; +pub const ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING: ::DWORD = 13901; +pub const ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS: ::DWORD = 13902; +pub const ERROR_IPSEC_IKE_RATELIMIT_DROP: ::DWORD = 13903; +pub const ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE: ::DWORD = 13904; +pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE: ::DWORD = 13905; +pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE: ::DWORD = 13906; +pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY: ::DWORD = 13907; +pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE: ::DWORD = 13908; +pub const ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END: ::DWORD = 13909; +pub const ERROR_IPSEC_BAD_SPI: ::DWORD = 13910; +pub const ERROR_IPSEC_SA_LIFETIME_EXPIRED: ::DWORD = 13911; +pub const ERROR_IPSEC_WRONG_SA: ::DWORD = 13912; +pub const ERROR_IPSEC_REPLAY_CHECK_FAILED: ::DWORD = 13913; +pub const ERROR_IPSEC_INVALID_PACKET: ::DWORD = 13914; +pub const ERROR_IPSEC_INTEGRITY_CHECK_FAILED: ::DWORD = 13915; +pub const ERROR_IPSEC_CLEAR_TEXT_DROP: ::DWORD = 13916; +pub const ERROR_IPSEC_AUTH_FIREWALL_DROP: ::DWORD = 13917; +pub const ERROR_IPSEC_THROTTLE_DROP: ::DWORD = 13918; +pub const ERROR_IPSEC_DOSP_BLOCK: ::DWORD = 13925; +pub const ERROR_IPSEC_DOSP_RECEIVED_MULTICAST: ::DWORD = 13926; +pub const ERROR_IPSEC_DOSP_INVALID_PACKET: ::DWORD = 13927; +pub const ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED: ::DWORD = 13928; +pub const ERROR_IPSEC_DOSP_MAX_ENTRIES: ::DWORD = 13929; +pub const ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: ::DWORD = 13930; +pub const ERROR_IPSEC_DOSP_NOT_INSTALLED: ::DWORD = 13931; +pub const ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: ::DWORD = 13932; +pub const ERROR_SXS_SECTION_NOT_FOUND: ::DWORD = 14000; +pub const ERROR_SXS_CANT_GEN_ACTCTX: ::DWORD = 14001; +pub const ERROR_SXS_INVALID_ACTCTXDATA_FORMAT: ::DWORD = 14002; +pub const ERROR_SXS_ASSEMBLY_NOT_FOUND: ::DWORD = 14003; +pub const ERROR_SXS_MANIFEST_FORMAT_ERROR: ::DWORD = 14004; +pub const ERROR_SXS_MANIFEST_PARSE_ERROR: ::DWORD = 14005; +pub const ERROR_SXS_ACTIVATION_CONTEXT_DISABLED: ::DWORD = 14006; +pub const ERROR_SXS_KEY_NOT_FOUND: ::DWORD = 14007; +pub const ERROR_SXS_VERSION_CONFLICT: ::DWORD = 14008; +pub const ERROR_SXS_WRONG_SECTION_TYPE: ::DWORD = 14009; +pub const ERROR_SXS_THREAD_QUERIES_DISABLED: ::DWORD = 14010; +pub const ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET: ::DWORD = 14011; +pub const ERROR_SXS_UNKNOWN_ENCODING_GROUP: ::DWORD = 14012; +pub const ERROR_SXS_UNKNOWN_ENCODING: ::DWORD = 14013; +pub const ERROR_SXS_INVALID_XML_NAMESPACE_URI: ::DWORD = 14014; +pub const ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED: ::DWORD = 14015; +pub const ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED: ::DWORD = 14016; +pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE: ::DWORD = 14017; +pub const ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE: ::DWORD = 14018; +pub const ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE: ::DWORD = 14019; +pub const ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT: ::DWORD = 14020; +pub const ERROR_SXS_DUPLICATE_DLL_NAME: ::DWORD = 14021; +pub const ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME: ::DWORD = 14022; +pub const ERROR_SXS_DUPLICATE_CLSID: ::DWORD = 14023; +pub const ERROR_SXS_DUPLICATE_IID: ::DWORD = 14024; +pub const ERROR_SXS_DUPLICATE_TLBID: ::DWORD = 14025; +pub const ERROR_SXS_DUPLICATE_PROGID: ::DWORD = 14026; +pub const ERROR_SXS_DUPLICATE_ASSEMBLY_NAME: ::DWORD = 14027; +pub const ERROR_SXS_FILE_HASH_MISMATCH: ::DWORD = 14028; +pub const ERROR_SXS_POLICY_PARSE_ERROR: ::DWORD = 14029; +pub const ERROR_SXS_XML_E_MISSINGQUOTE: ::DWORD = 14030; +pub const ERROR_SXS_XML_E_COMMENTSYNTAX: ::DWORD = 14031; +pub const ERROR_SXS_XML_E_BADSTARTNAMECHAR: ::DWORD = 14032; +pub const ERROR_SXS_XML_E_BADNAMECHAR: ::DWORD = 14033; +pub const ERROR_SXS_XML_E_BADCHARINSTRING: ::DWORD = 14034; +pub const ERROR_SXS_XML_E_XMLDECLSYNTAX: ::DWORD = 14035; +pub const ERROR_SXS_XML_E_BADCHARDATA: ::DWORD = 14036; +pub const ERROR_SXS_XML_E_MISSINGWHITESPACE: ::DWORD = 14037; +pub const ERROR_SXS_XML_E_EXPECTINGTAGEND: ::DWORD = 14038; +pub const ERROR_SXS_XML_E_MISSINGSEMICOLON: ::DWORD = 14039; +pub const ERROR_SXS_XML_E_UNBALANCEDPAREN: ::DWORD = 14040; +pub const ERROR_SXS_XML_E_INTERNALERROR: ::DWORD = 14041; +pub const ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE: ::DWORD = 14042; +pub const ERROR_SXS_XML_E_INCOMPLETE_ENCODING: ::DWORD = 14043; +pub const ERROR_SXS_XML_E_MISSING_PAREN: ::DWORD = 14044; +pub const ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE: ::DWORD = 14045; +pub const ERROR_SXS_XML_E_MULTIPLE_COLONS: ::DWORD = 14046; +pub const ERROR_SXS_XML_E_INVALID_DECIMAL: ::DWORD = 14047; +pub const ERROR_SXS_XML_E_INVALID_HEXIDECIMAL: ::DWORD = 14048; +pub const ERROR_SXS_XML_E_INVALID_UNICODE: ::DWORD = 14049; +pub const ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK: ::DWORD = 14050; +pub const ERROR_SXS_XML_E_UNEXPECTEDENDTAG: ::DWORD = 14051; +pub const ERROR_SXS_XML_E_UNCLOSEDTAG: ::DWORD = 14052; +pub const ERROR_SXS_XML_E_DUPLICATEATTRIBUTE: ::DWORD = 14053; +pub const ERROR_SXS_XML_E_MULTIPLEROOTS: ::DWORD = 14054; +pub const ERROR_SXS_XML_E_INVALIDATROOTLEVEL: ::DWORD = 14055; +pub const ERROR_SXS_XML_E_BADXMLDECL: ::DWORD = 14056; +pub const ERROR_SXS_XML_E_MISSINGROOT: ::DWORD = 14057; +pub const ERROR_SXS_XML_E_UNEXPECTEDEOF: ::DWORD = 14058; +pub const ERROR_SXS_XML_E_BADPEREFINSUBSET: ::DWORD = 14059; +pub const ERROR_SXS_XML_E_UNCLOSEDSTARTTAG: ::DWORD = 14060; +pub const ERROR_SXS_XML_E_UNCLOSEDENDTAG: ::DWORD = 14061; +pub const ERROR_SXS_XML_E_UNCLOSEDSTRING: ::DWORD = 14062; +pub const ERROR_SXS_XML_E_UNCLOSEDCOMMENT: ::DWORD = 14063; +pub const ERROR_SXS_XML_E_UNCLOSEDDECL: ::DWORD = 14064; +pub const ERROR_SXS_XML_E_UNCLOSEDCDATA: ::DWORD = 14065; +pub const ERROR_SXS_XML_E_RESERVEDNAMESPACE: ::DWORD = 14066; +pub const ERROR_SXS_XML_E_INVALIDENCODING: ::DWORD = 14067; +pub const ERROR_SXS_XML_E_INVALIDSWITCH: ::DWORD = 14068; +pub const ERROR_SXS_XML_E_BADXMLCASE: ::DWORD = 14069; +pub const ERROR_SXS_XML_E_INVALID_STANDALONE: ::DWORD = 14070; +pub const ERROR_SXS_XML_E_UNEXPECTED_STANDALONE: ::DWORD = 14071; +pub const ERROR_SXS_XML_E_INVALID_VERSION: ::DWORD = 14072; +pub const ERROR_SXS_XML_E_MISSINGEQUALS: ::DWORD = 14073; +pub const ERROR_SXS_PROTECTION_RECOVERY_FAILED: ::DWORD = 14074; +pub const ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT: ::DWORD = 14075; +pub const ERROR_SXS_PROTECTION_CATALOG_NOT_VALID: ::DWORD = 14076; +pub const ERROR_SXS_UNTRANSLATABLE_HRESULT: ::DWORD = 14077; +pub const ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING: ::DWORD = 14078; +pub const ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE: ::DWORD = 14079; +pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME: ::DWORD = 14080; +pub const ERROR_SXS_ASSEMBLY_MISSING: ::DWORD = 14081; +pub const ERROR_SXS_CORRUPT_ACTIVATION_STACK: ::DWORD = 14082; +pub const ERROR_SXS_CORRUPTION: ::DWORD = 14083; +pub const ERROR_SXS_EARLY_DEACTIVATION: ::DWORD = 14084; +pub const ERROR_SXS_INVALID_DEACTIVATION: ::DWORD = 14085; +pub const ERROR_SXS_MULTIPLE_DEACTIVATION: ::DWORD = 14086; +pub const ERROR_SXS_PROCESS_TERMINATION_REQUESTED: ::DWORD = 14087; +pub const ERROR_SXS_RELEASE_ACTIVATION_CONTEXT: ::DWORD = 14088; +pub const ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: ::DWORD = 14089; +pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: ::DWORD = 14090; +pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: ::DWORD = 14091; +pub const ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: ::DWORD = 14092; +pub const ERROR_SXS_IDENTITY_PARSE_ERROR: ::DWORD = 14093; +pub const ERROR_MALFORMED_SUBSTITUTION_STRING: ::DWORD = 14094; +pub const ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN: ::DWORD = 14095; +pub const ERROR_UNMAPPED_SUBSTITUTION_STRING: ::DWORD = 14096; +pub const ERROR_SXS_ASSEMBLY_NOT_LOCKED: ::DWORD = 14097; +pub const ERROR_SXS_COMPONENT_STORE_CORRUPT: ::DWORD = 14098; +pub const ERROR_ADVANCED_INSTALLER_FAILED: ::DWORD = 14099; +pub const ERROR_XML_ENCODING_MISMATCH: ::DWORD = 14100; +pub const ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: ::DWORD = 14101; +pub const ERROR_SXS_IDENTITIES_DIFFERENT: ::DWORD = 14102; +pub const ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: ::DWORD = 14103; +pub const ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY: ::DWORD = 14104; +pub const ERROR_SXS_MANIFEST_TOO_BIG: ::DWORD = 14105; +pub const ERROR_SXS_SETTING_NOT_REGISTERED: ::DWORD = 14106; +pub const ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE: ::DWORD = 14107; +pub const ERROR_SMI_PRIMITIVE_INSTALLER_FAILED: ::DWORD = 14108; +pub const ERROR_GENERIC_COMMAND_FAILED: ::DWORD = 14109; +pub const ERROR_SXS_FILE_HASH_MISSING: ::DWORD = 14110; +pub const ERROR_EVT_INVALID_CHANNEL_PATH: ::DWORD = 15000; +pub const ERROR_EVT_INVALID_QUERY: ::DWORD = 15001; +pub const ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND: ::DWORD = 15002; +pub const ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND: ::DWORD = 15003; +pub const ERROR_EVT_INVALID_PUBLISHER_NAME: ::DWORD = 15004; +pub const ERROR_EVT_INVALID_EVENT_DATA: ::DWORD = 15005; +pub const ERROR_EVT_CHANNEL_NOT_FOUND: ::DWORD = 15007; +pub const ERROR_EVT_MALFORMED_XML_TEXT: ::DWORD = 15008; +pub const ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL: ::DWORD = 15009; +pub const ERROR_EVT_CONFIGURATION_ERROR: ::DWORD = 15010; +pub const ERROR_EVT_QUERY_RESULT_STALE: ::DWORD = 15011; +pub const ERROR_EVT_QUERY_RESULT_INVALID_POSITION: ::DWORD = 15012; +pub const ERROR_EVT_NON_VALIDATING_MSXML: ::DWORD = 15013; +pub const ERROR_EVT_FILTER_ALREADYSCOPED: ::DWORD = 15014; +pub const ERROR_EVT_FILTER_NOTELTSET: ::DWORD = 15015; +pub const ERROR_EVT_FILTER_INVARG: ::DWORD = 15016; +pub const ERROR_EVT_FILTER_INVTEST: ::DWORD = 15017; +pub const ERROR_EVT_FILTER_INVTYPE: ::DWORD = 15018; +pub const ERROR_EVT_FILTER_PARSEERR: ::DWORD = 15019; +pub const ERROR_EVT_FILTER_UNSUPPORTEDOP: ::DWORD = 15020; +pub const ERROR_EVT_FILTER_UNEXPECTEDTOKEN: ::DWORD = 15021; +pub const ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL: ::DWORD = 15022; +pub const ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE: ::DWORD = 15023; +pub const ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE: ::DWORD = 15024; +pub const ERROR_EVT_CHANNEL_CANNOT_ACTIVATE: ::DWORD = 15025; +pub const ERROR_EVT_FILTER_TOO_COMPLEX: ::DWORD = 15026; +pub const ERROR_EVT_MESSAGE_NOT_FOUND: ::DWORD = 15027; +pub const ERROR_EVT_MESSAGE_ID_NOT_FOUND: ::DWORD = 15028; +pub const ERROR_EVT_UNRESOLVED_VALUE_INSERT: ::DWORD = 15029; +pub const ERROR_EVT_UNRESOLVED_PARAMETER_INSERT: ::DWORD = 15030; +pub const ERROR_EVT_MAX_INSERTS_REACHED: ::DWORD = 15031; +pub const ERROR_EVT_EVENT_DEFINITION_NOT_FOUND: ::DWORD = 15032; +pub const ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND: ::DWORD = 15033; +pub const ERROR_EVT_VERSION_TOO_OLD: ::DWORD = 15034; +pub const ERROR_EVT_VERSION_TOO_NEW: ::DWORD = 15035; +pub const ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY: ::DWORD = 15036; +pub const ERROR_EVT_PUBLISHER_DISABLED: ::DWORD = 15037; +pub const ERROR_EVT_FILTER_OUT_OF_RANGE: ::DWORD = 15038; +pub const ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE: ::DWORD = 15080; +pub const ERROR_EC_LOG_DISABLED: ::DWORD = 15081; +pub const ERROR_EC_CIRCULAR_FORWARDING: ::DWORD = 15082; +pub const ERROR_EC_CREDSTORE_FULL: ::DWORD = 15083; +pub const ERROR_EC_CRED_NOT_FOUND: ::DWORD = 15084; +pub const ERROR_EC_NO_ACTIVE_CHANNEL: ::DWORD = 15085; +pub const ERROR_MUI_FILE_NOT_FOUND: ::DWORD = 15100; +pub const ERROR_MUI_INVALID_FILE: ::DWORD = 15101; +pub const ERROR_MUI_INVALID_RC_CONFIG: ::DWORD = 15102; +pub const ERROR_MUI_INVALID_LOCALE_NAME: ::DWORD = 15103; +pub const ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME: ::DWORD = 15104; +pub const ERROR_MUI_FILE_NOT_LOADED: ::DWORD = 15105; +pub const ERROR_RESOURCE_ENUM_USER_STOP: ::DWORD = 15106; +pub const ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED: ::DWORD = 15107; +pub const ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME: ::DWORD = 15108; +pub const ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE: ::DWORD = 15110; +pub const ERROR_MRM_INVALID_PRICONFIG: ::DWORD = 15111; +pub const ERROR_MRM_INVALID_FILE_TYPE: ::DWORD = 15112; +pub const ERROR_MRM_UNKNOWN_QUALIFIER: ::DWORD = 15113; +pub const ERROR_MRM_INVALID_QUALIFIER_VALUE: ::DWORD = 15114; +pub const ERROR_MRM_NO_CANDIDATE: ::DWORD = 15115; +pub const ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE: ::DWORD = 15116; +pub const ERROR_MRM_RESOURCE_TYPE_MISMATCH: ::DWORD = 15117; +pub const ERROR_MRM_DUPLICATE_MAP_NAME: ::DWORD = 15118; +pub const ERROR_MRM_DUPLICATE_ENTRY: ::DWORD = 15119; +pub const ERROR_MRM_INVALID_RESOURCE_IDENTIFIER: ::DWORD = 15120; +pub const ERROR_MRM_FILEPATH_TOO_LONG: ::DWORD = 15121; +pub const ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE: ::DWORD = 15122; +pub const ERROR_MRM_INVALID_PRI_FILE: ::DWORD = 15126; +pub const ERROR_MRM_NAMED_RESOURCE_NOT_FOUND: ::DWORD = 15127; +pub const ERROR_MRM_MAP_NOT_FOUND: ::DWORD = 15135; +pub const ERROR_MRM_UNSUPPORTED_PROFILE_TYPE: ::DWORD = 15136; +pub const ERROR_MRM_INVALID_QUALIFIER_OPERATOR: ::DWORD = 15137; +pub const ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE: ::DWORD = 15138; +pub const ERROR_MRM_AUTOMERGE_ENABLED: ::DWORD = 15139; +pub const ERROR_MRM_TOO_MANY_RESOURCES: ::DWORD = 15140; +pub const ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_MERGE: ::DWORD = 15141; +pub const ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_LOAD_UNLOAD_PRI_FILE: ::DWORD = 15142; +pub const ERROR_MRM_NO_CURRENT_VIEW_ON_THREAD: ::DWORD = 15143; +pub const ERROR_DIFFERENT_PROFILE_RESOURCE_MANAGER_EXIST: ::DWORD = 15144; +pub const ERROR_OPERATION_NOT_ALLOWED_FROM_SYSTEM_COMPONENT: ::DWORD = 15145; +pub const ERROR_MRM_DIRECT_REF_TO_NON_DEFAULT_RESOURCE: ::DWORD = 15146; +pub const ERROR_MRM_GENERATION_COUNT_MISMATCH: ::DWORD = 15147; +pub const ERROR_MCA_INVALID_CAPABILITIES_STRING: ::DWORD = 15200; +pub const ERROR_MCA_INVALID_VCP_VERSION: ::DWORD = 15201; +pub const ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION: ::DWORD = 15202; +pub const ERROR_MCA_MCCS_VERSION_MISMATCH: ::DWORD = 15203; +pub const ERROR_MCA_UNSUPPORTED_MCCS_VERSION: ::DWORD = 15204; +pub const ERROR_MCA_INTERNAL_ERROR: ::DWORD = 15205; +pub const ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED: ::DWORD = 15206; +pub const ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE: ::DWORD = 15207; +pub const ERROR_AMBIGUOUS_SYSTEM_DEVICE: ::DWORD = 15250; +pub const ERROR_SYSTEM_DEVICE_NOT_FOUND: ::DWORD = 15299; +pub const ERROR_HASH_NOT_SUPPORTED: ::DWORD = 15300; +pub const ERROR_HASH_NOT_PRESENT: ::DWORD = 15301; +pub const ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED: ::DWORD = 15321; +pub const ERROR_GPIO_CLIENT_INFORMATION_INVALID: ::DWORD = 15322; +pub const ERROR_GPIO_VERSION_NOT_SUPPORTED: ::DWORD = 15323; +pub const ERROR_GPIO_INVALID_REGISTRATION_PACKET: ::DWORD = 15324; +pub const ERROR_GPIO_OPERATION_DENIED: ::DWORD = 15325; +pub const ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE: ::DWORD = 15326; +pub const ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED: ::DWORD = 15327; +pub const ERROR_CANNOT_SWITCH_RUNLEVEL: ::DWORD = 15400; +pub const ERROR_INVALID_RUNLEVEL_SETTING: ::DWORD = 15401; +pub const ERROR_RUNLEVEL_SWITCH_TIMEOUT: ::DWORD = 15402; +pub const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT: ::DWORD = 15403; +pub const ERROR_RUNLEVEL_SWITCH_IN_PROGRESS: ::DWORD = 15404; +pub const ERROR_SERVICES_FAILED_AUTOSTART: ::DWORD = 15405; +pub const ERROR_COM_TASK_STOP_PENDING: ::DWORD = 15501; +pub const ERROR_INSTALL_OPEN_PACKAGE_FAILED: ::DWORD = 15600; +pub const ERROR_INSTALL_PACKAGE_NOT_FOUND: ::DWORD = 15601; +pub const ERROR_INSTALL_INVALID_PACKAGE: ::DWORD = 15602; +pub const ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED: ::DWORD = 15603; +pub const ERROR_INSTALL_OUT_OF_DISK_SPACE: ::DWORD = 15604; +pub const ERROR_INSTALL_NETWORK_FAILURE: ::DWORD = 15605; +pub const ERROR_INSTALL_REGISTRATION_FAILURE: ::DWORD = 15606; +pub const ERROR_INSTALL_DEREGISTRATION_FAILURE: ::DWORD = 15607; +pub const ERROR_INSTALL_CANCEL: ::DWORD = 15608; +pub const ERROR_INSTALL_FAILED: ::DWORD = 15609; +pub const ERROR_REMOVE_FAILED: ::DWORD = 15610; +pub const ERROR_PACKAGE_ALREADY_EXISTS: ::DWORD = 15611; +pub const ERROR_NEEDS_REMEDIATION: ::DWORD = 15612; +pub const ERROR_INSTALL_PREREQUISITE_FAILED: ::DWORD = 15613; +pub const ERROR_PACKAGE_REPOSITORY_CORRUPTED: ::DWORD = 15614; +pub const ERROR_INSTALL_POLICY_FAILURE: ::DWORD = 15615; +pub const ERROR_PACKAGE_UPDATING: ::DWORD = 15616; +pub const ERROR_DEPLOYMENT_BLOCKED_BY_POLICY: ::DWORD = 15617; +pub const ERROR_PACKAGES_IN_USE: ::DWORD = 15618; +pub const ERROR_RECOVERY_FILE_CORRUPT: ::DWORD = 15619; +pub const ERROR_INVALID_STAGED_SIGNATURE: ::DWORD = 15620; +pub const ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED: ::DWORD = 15621; +pub const ERROR_INSTALL_PACKAGE_DOWNGRADE: ::DWORD = 15622; +pub const ERROR_SYSTEM_NEEDS_REMEDIATION: ::DWORD = 15623; +pub const ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN: ::DWORD = 15624; +pub const ERROR_RESILIENCY_FILE_CORRUPT: ::DWORD = 15625; +pub const ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING: ::DWORD = 15626; +pub const APPMODEL_ERROR_NO_PACKAGE: ::DWORD = 15700; +pub const APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT: ::DWORD = 15701; +pub const APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT: ::DWORD = 15702; +pub const APPMODEL_ERROR_NO_APPLICATION: ::DWORD = 15703; +pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_READ_FAILED: ::DWORD = 15704; +pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_INVALID: ::DWORD = 15705; +pub const ERROR_STATE_LOAD_STORE_FAILED: ::DWORD = 15800; +pub const ERROR_STATE_GET_VERSION_FAILED: ::DWORD = 15801; +pub const ERROR_STATE_SET_VERSION_FAILED: ::DWORD = 15802; +pub const ERROR_STATE_STRUCTURED_RESET_FAILED: ::DWORD = 15803; +pub const ERROR_STATE_OPEN_CONTAINER_FAILED: ::DWORD = 15804; +pub const ERROR_STATE_CREATE_CONTAINER_FAILED: ::DWORD = 15805; +pub const ERROR_STATE_DELETE_CONTAINER_FAILED: ::DWORD = 15806; +pub const ERROR_STATE_READ_SETTING_FAILED: ::DWORD = 15807; +pub const ERROR_STATE_WRITE_SETTING_FAILED: ::DWORD = 15808; +pub const ERROR_STATE_DELETE_SETTING_FAILED: ::DWORD = 15809; +pub const ERROR_STATE_QUERY_SETTING_FAILED: ::DWORD = 15810; +pub const ERROR_STATE_READ_COMPOSITE_SETTING_FAILED: ::DWORD = 15811; +pub const ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED: ::DWORD = 15812; +pub const ERROR_STATE_ENUMERATE_CONTAINER_FAILED: ::DWORD = 15813; +pub const ERROR_STATE_ENUMERATE_SETTINGS_FAILED: ::DWORD = 15814; +pub const ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: ::DWORD = 15815; +pub const ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: ::DWORD = 15816; +pub const ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED: ::DWORD = 15817; +pub const ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED: ::DWORD = 15818; +pub const ERROR_API_UNAVAILABLE: ::DWORD = 15841; +pub const STORE_ERROR_UNLICENSED: ::DWORD = 15861; +pub const STORE_ERROR_UNLICENSED_USER: ::DWORD = 15862; +pub const STORE_ERROR_PENDING_COM_TRANSACTION: ::DWORD = 15863; +pub const STORE_ERROR_LICENSE_REVOKED: ::DWORD = 15864; +pub const SEVERITY_SUCCESS: HRESULT = 0; +pub const SEVERITY_ERROR: HRESULT = 1; +#[inline] +pub fn MAKE_HRESULT(sev: HRESULT, fac: HRESULT, code: HRESULT) -> HRESULT { + (sev << 31) | (fac << 16) | code +} +pub type HRESULT = ::c_long; +pub const NOERROR: HRESULT = 0; +pub const E_UNEXPECTED: HRESULT = 0x8000FFFFu32 as HRESULT; +pub const E_NOTIMPL: HRESULT = 0x80004001u32 as HRESULT; +pub const E_OUTOFMEMORY: HRESULT = 0x8007000Eu32 as HRESULT; +pub const E_INVALIDARG: HRESULT = 0x80070057u32 as HRESULT; +pub const E_NOINTERFACE: HRESULT = 0x80004002u32 as HRESULT; +pub const E_POINTER: HRESULT = 0x80004003u32 as HRESULT; +pub const E_HANDLE: HRESULT = 0x80070006u32 as HRESULT; +pub const E_ABORT: HRESULT = 0x80004004u32 as HRESULT; +pub const E_FAIL: HRESULT = 0x80004005u32 as HRESULT; +pub const E_ACCESSDENIED: HRESULT = 0x80070005u32 as HRESULT; +pub const E_PENDING: HRESULT = 0x8000000Au32 as HRESULT; +pub const E_BOUNDS: HRESULT = 0x8000000Bu32 as HRESULT; +pub const E_CHANGED_STATE: HRESULT = 0x8000000Cu32 as HRESULT; +pub const E_ILLEGAL_STATE_CHANGE: HRESULT = 0x8000000Du32 as HRESULT; +pub const E_ILLEGAL_METHOD_CALL: HRESULT = 0x8000000Eu32 as HRESULT; +pub const RO_E_METADATA_NAME_NOT_FOUND: HRESULT = 0x8000000Fu32 as HRESULT; +pub const RO_E_METADATA_NAME_IS_NAMESPACE: HRESULT = 0x80000010u32 as HRESULT; +pub const RO_E_METADATA_INVALID_TYPE_FORMAT: HRESULT = 0x80000011u32 as HRESULT; +pub const RO_E_INVALID_METADATA_FILE: HRESULT = 0x80000012u32 as HRESULT; +pub const RO_E_CLOSED: HRESULT = 0x80000013u32 as HRESULT; +pub const RO_E_EXCLUSIVE_WRITE: HRESULT = 0x80000014u32 as HRESULT; +pub const RO_E_CHANGE_NOTIFICATION_IN_PROGRESS: HRESULT = 0x80000015u32 as HRESULT; +pub const RO_E_ERROR_STRING_NOT_FOUND: HRESULT = 0x80000016u32 as HRESULT; +pub const E_STRING_NOT_NULL_TERMINATED: HRESULT = 0x80000017u32 as HRESULT; +pub const E_ILLEGAL_DELEGATE_ASSIGNMENT: HRESULT = 0x80000018u32 as HRESULT; +pub const E_ASYNC_OPERATION_NOT_STARTED: HRESULT = 0x80000019u32 as HRESULT; +pub const E_APPLICATION_EXITING: HRESULT = 0x8000001Au32 as HRESULT; +pub const E_APPLICATION_VIEW_EXITING: HRESULT = 0x8000001Bu32 as HRESULT; +pub const RO_E_MUST_BE_AGILE: HRESULT = 0x8000001Cu32 as HRESULT; +pub const RO_E_UNSUPPORTED_FROM_MTA: HRESULT = 0x8000001Du32 as HRESULT; +pub const RO_E_COMMITTED: HRESULT = 0x8000001Eu32 as HRESULT; +pub const RO_E_BLOCKED_CROSS_ASTA_CALL: HRESULT = 0x8000001Fu32 as HRESULT; +pub const CO_E_INIT_TLS: HRESULT = 0x80004006u32 as HRESULT; +pub const CO_E_INIT_SHARED_ALLOCATOR: HRESULT = 0x80004007u32 as HRESULT; +pub const CO_E_INIT_MEMORY_ALLOCATOR: HRESULT = 0x80004008u32 as HRESULT; +pub const CO_E_INIT_CLASS_CACHE: HRESULT = 0x80004009u32 as HRESULT; +pub const CO_E_INIT_RPC_CHANNEL: HRESULT = 0x8000400Au32 as HRESULT; +pub const CO_E_INIT_TLS_SET_CHANNEL_CONTROL: HRESULT = 0x8000400Bu32 as HRESULT; +pub const CO_E_INIT_TLS_CHANNEL_CONTROL: HRESULT = 0x8000400Cu32 as HRESULT; +pub const CO_E_INIT_UNACCEPTED_USER_ALLOCATOR: HRESULT = 0x8000400Du32 as HRESULT; +pub const CO_E_INIT_SCM_MUTEX_EXISTS: HRESULT = 0x8000400Eu32 as HRESULT; +pub const CO_E_INIT_SCM_FILE_MAPPING_EXISTS: HRESULT = 0x8000400Fu32 as HRESULT; +pub const CO_E_INIT_SCM_MAP_VIEW_OF_FILE: HRESULT = 0x80004010u32 as HRESULT; +pub const CO_E_INIT_SCM_EXEC_FAILURE: HRESULT = 0x80004011u32 as HRESULT; +pub const CO_E_INIT_ONLY_SINGLE_THREADED: HRESULT = 0x80004012u32 as HRESULT; +pub const CO_E_CANT_REMOTE: HRESULT = 0x80004013u32 as HRESULT; +pub const CO_E_BAD_SERVER_NAME: HRESULT = 0x80004014u32 as HRESULT; +pub const CO_E_WRONG_SERVER_IDENTITY: HRESULT = 0x80004015u32 as HRESULT; +pub const CO_E_OLE1DDE_DISABLED: HRESULT = 0x80004016u32 as HRESULT; +pub const CO_E_RUNAS_SYNTAX: HRESULT = 0x80004017u32 as HRESULT; +pub const CO_E_CREATEPROCESS_FAILURE: HRESULT = 0x80004018u32 as HRESULT; +pub const CO_E_RUNAS_CREATEPROCESS_FAILURE: HRESULT = 0x80004019u32 as HRESULT; +pub const CO_E_RUNAS_LOGON_FAILURE: HRESULT = 0x8000401Au32 as HRESULT; +pub const CO_E_LAUNCH_PERMSSION_DENIED: HRESULT = 0x8000401Bu32 as HRESULT; +pub const CO_E_START_SERVICE_FAILURE: HRESULT = 0x8000401Cu32 as HRESULT; +pub const CO_E_REMOTE_COMMUNICATION_FAILURE: HRESULT = 0x8000401Du32 as HRESULT; +pub const CO_E_SERVER_START_TIMEOUT: HRESULT = 0x8000401Eu32 as HRESULT; +pub const CO_E_CLSREG_INCONSISTENT: HRESULT = 0x8000401Fu32 as HRESULT; +pub const CO_E_IIDREG_INCONSISTENT: HRESULT = 0x80004020u32 as HRESULT; +pub const CO_E_NOT_SUPPORTED: HRESULT = 0x80004021u32 as HRESULT; +pub const CO_E_RELOAD_DLL: HRESULT = 0x80004022u32 as HRESULT; +pub const CO_E_MSI_ERROR: HRESULT = 0x80004023u32 as HRESULT; +pub const CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT: HRESULT = 0x80004024u32 as HRESULT; +pub const CO_E_SERVER_PAUSED: HRESULT = 0x80004025u32 as HRESULT; +pub const CO_E_SERVER_NOT_PAUSED: HRESULT = 0x80004026u32 as HRESULT; +pub const CO_E_CLASS_DISABLED: HRESULT = 0x80004027u32 as HRESULT; +pub const CO_E_CLRNOTAVAILABLE: HRESULT = 0x80004028u32 as HRESULT; +pub const CO_E_ASYNC_WORK_REJECTED: HRESULT = 0x80004029u32 as HRESULT; +pub const CO_E_SERVER_INIT_TIMEOUT: HRESULT = 0x8000402Au32 as HRESULT; +pub const CO_E_NO_SECCTX_IN_ACTIVATE: HRESULT = 0x8000402Bu32 as HRESULT; +pub const CO_E_TRACKER_CONFIG: HRESULT = 0x80004030u32 as HRESULT; +pub const CO_E_THREADPOOL_CONFIG: HRESULT = 0x80004031u32 as HRESULT; +pub const CO_E_SXS_CONFIG: HRESULT = 0x80004032u32 as HRESULT; +pub const CO_E_MALFORMED_SPN: HRESULT = 0x80004033u32 as HRESULT; +pub const CO_E_UNREVOKED_REGISTRATION_ON_APARTMENT_SHUTDOWN: HRESULT = 0x80004034u32 as HRESULT; +pub const CO_E_PREMATURE_STUB_RUNDOWN: HRESULT = 0x80004035u32 as HRESULT; +pub const S_OK: HRESULT = 0; +pub const S_FALSE: HRESULT = 1; +pub const OLE_E_FIRST: HRESULT = 0x80040000u32 as HRESULT; +pub const OLE_E_LAST: HRESULT = 0x800400FFu32 as HRESULT; +pub const OLE_S_FIRST: HRESULT = 0x00040000; +pub const OLE_S_LAST: HRESULT = 0x000400FF; +pub const OLE_E_OLEVERB: HRESULT = 0x80040000u32 as HRESULT; +pub const OLE_E_ADVF: HRESULT = 0x80040001u32 as HRESULT; +pub const OLE_E_ENUM_NOMORE: HRESULT = 0x80040002u32 as HRESULT; +pub const OLE_E_ADVISENOTSUPPORTED: HRESULT = 0x80040003u32 as HRESULT; +pub const OLE_E_NOCONNECTION: HRESULT = 0x80040004u32 as HRESULT; +pub const OLE_E_NOTRUNNING: HRESULT = 0x80040005u32 as HRESULT; +pub const OLE_E_NOCACHE: HRESULT = 0x80040006u32 as HRESULT; +pub const OLE_E_BLANK: HRESULT = 0x80040007u32 as HRESULT; +pub const OLE_E_CLASSDIFF: HRESULT = 0x80040008u32 as HRESULT; +pub const OLE_E_CANT_GETMONIKER: HRESULT = 0x80040009u32 as HRESULT; +pub const OLE_E_CANT_BINDTOSOURCE: HRESULT = 0x8004000Au32 as HRESULT; +pub const OLE_E_STATIC: HRESULT = 0x8004000Bu32 as HRESULT; +pub const OLE_E_PROMPTSAVECANCELLED: HRESULT = 0x8004000Cu32 as HRESULT; +pub const OLE_E_INVALIDRECT: HRESULT = 0x8004000Du32 as HRESULT; +pub const OLE_E_WRONGCOMPOBJ: HRESULT = 0x8004000Eu32 as HRESULT; +pub const OLE_E_INVALIDHWND: HRESULT = 0x8004000Fu32 as HRESULT; +pub const OLE_E_NOT_INPLACEACTIVE: HRESULT = 0x80040010u32 as HRESULT; +pub const OLE_E_CANTCONVERT: HRESULT = 0x80040011u32 as HRESULT; +pub const OLE_E_NOSTORAGE: HRESULT = 0x80040012u32 as HRESULT; +pub const DV_E_FORMATETC: HRESULT = 0x80040064u32 as HRESULT; +pub const DV_E_DVTARGETDEVICE: HRESULT = 0x80040065u32 as HRESULT; +pub const DV_E_STGMEDIUM: HRESULT = 0x80040066u32 as HRESULT; +pub const DV_E_STATDATA: HRESULT = 0x80040067u32 as HRESULT; +pub const DV_E_LINDEX: HRESULT = 0x80040068u32 as HRESULT; +pub const DV_E_TYMED: HRESULT = 0x80040069u32 as HRESULT; +pub const DV_E_CLIPFORMAT: HRESULT = 0x8004006Au32 as HRESULT; +pub const DV_E_DVASPECT: HRESULT = 0x8004006Bu32 as HRESULT; +pub const DV_E_DVTARGETDEVICE_SIZE: HRESULT = 0x8004006Cu32 as HRESULT; +pub const DV_E_NOIVIEWOBJECT: HRESULT = 0x8004006Du32 as HRESULT; +pub const DRAGDROP_E_FIRST: HRESULT = 0x80040100u32 as HRESULT; +pub const DRAGDROP_E_LAST: HRESULT = 0x8004010Fu32 as HRESULT; +pub const DRAGDROP_S_FIRST: HRESULT = 0x00040100; +pub const DRAGDROP_S_LAST: HRESULT = 0x0004010F; +pub const DRAGDROP_E_NOTREGISTERED: HRESULT = 0x80040100u32 as HRESULT; +pub const DRAGDROP_E_ALREADYREGISTERED: HRESULT = 0x80040101u32 as HRESULT; +pub const DRAGDROP_E_INVALIDHWND: HRESULT = 0x80040102u32 as HRESULT; +pub const DRAGDROP_E_CONCURRENT_DRAG_ATTEMPTED: HRESULT = 0x80040103u32 as HRESULT; +pub const CLASSFACTORY_E_FIRST: HRESULT = 0x80040110u32 as HRESULT; +pub const CLASSFACTORY_E_LAST: HRESULT = 0x8004011Fu32 as HRESULT; +pub const CLASSFACTORY_S_FIRST: HRESULT = 0x00040110; +pub const CLASSFACTORY_S_LAST: HRESULT = 0x0004011F; +pub const CLASS_E_NOAGGREGATION: HRESULT = 0x80040110u32 as HRESULT; +pub const CLASS_E_CLASSNOTAVAILABLE: HRESULT = 0x80040111u32 as HRESULT; +pub const CLASS_E_NOTLICENSED: HRESULT = 0x80040112u32 as HRESULT; +pub const MARSHAL_E_FIRST: HRESULT = 0x80040120u32 as HRESULT; +pub const MARSHAL_E_LAST: HRESULT = 0x8004012Fu32 as HRESULT; +pub const MARSHAL_S_FIRST: HRESULT = 0x00040120; +pub const MARSHAL_S_LAST: HRESULT = 0x0004012F; +pub const DATA_E_FIRST: HRESULT = 0x80040130u32 as HRESULT; +pub const DATA_E_LAST: HRESULT = 0x8004013Fu32 as HRESULT; +pub const DATA_S_FIRST: HRESULT = 0x00040130; +pub const DATA_S_LAST: HRESULT = 0x0004013F; +pub const VIEW_E_FIRST: HRESULT = 0x80040140u32 as HRESULT; +pub const VIEW_E_LAST: HRESULT = 0x8004014Fu32 as HRESULT; +pub const VIEW_S_FIRST: HRESULT = 0x00040140; +pub const VIEW_S_LAST: HRESULT = 0x0004014F; +pub const VIEW_E_DRAW: HRESULT = 0x80040140u32 as HRESULT; +pub const REGDB_E_FIRST: HRESULT = 0x80040150u32 as HRESULT; +pub const REGDB_E_LAST: HRESULT = 0x8004015Fu32 as HRESULT; +pub const REGDB_S_FIRST: HRESULT = 0x00040150; +pub const REGDB_S_LAST: HRESULT = 0x0004015F; +pub const REGDB_E_READREGDB: HRESULT = 0x80040150u32 as HRESULT; +pub const REGDB_E_WRITEREGDB: HRESULT = 0x80040151u32 as HRESULT; +pub const REGDB_E_KEYMISSING: HRESULT = 0x80040152u32 as HRESULT; +pub const REGDB_E_INVALIDVALUE: HRESULT = 0x80040153u32 as HRESULT; +pub const REGDB_E_CLASSNOTREG: HRESULT = 0x80040154u32 as HRESULT; +pub const REGDB_E_IIDNOTREG: HRESULT = 0x80040155u32 as HRESULT; +pub const REGDB_E_BADTHREADINGMODEL: HRESULT = 0x80040156u32 as HRESULT; +pub const CAT_E_FIRST: HRESULT = 0x80040160u32 as HRESULT; +pub const CAT_E_LAST: HRESULT = 0x80040161u32 as HRESULT; +pub const CAT_E_CATIDNOEXIST: HRESULT = 0x80040160u32 as HRESULT; +pub const CAT_E_NODESCRIPTION: HRESULT = 0x80040161u32 as HRESULT; +pub const CS_E_FIRST: HRESULT = 0x80040164u32 as HRESULT; +pub const CS_E_LAST: HRESULT = 0x8004016Fu32 as HRESULT; +pub const CS_E_PACKAGE_NOTFOUND: HRESULT = 0x80040164u32 as HRESULT; +pub const CS_E_NOT_DELETABLE: HRESULT = 0x80040165u32 as HRESULT; +pub const CS_E_CLASS_NOTFOUND: HRESULT = 0x80040166u32 as HRESULT; +pub const CS_E_INVALID_VERSION: HRESULT = 0x80040167u32 as HRESULT; +pub const CS_E_NO_CLASSSTORE: HRESULT = 0x80040168u32 as HRESULT; +pub const CS_E_OBJECT_NOTFOUND: HRESULT = 0x80040169u32 as HRESULT; +pub const CS_E_OBJECT_ALREADY_EXISTS: HRESULT = 0x8004016Au32 as HRESULT; +pub const CS_E_INVALID_PATH: HRESULT = 0x8004016Bu32 as HRESULT; +pub const CS_E_NETWORK_ERROR: HRESULT = 0x8004016Cu32 as HRESULT; +pub const CS_E_ADMIN_LIMIT_EXCEEDED: HRESULT = 0x8004016Du32 as HRESULT; +pub const CS_E_SCHEMA_MISMATCH: HRESULT = 0x8004016Eu32 as HRESULT; +pub const CS_E_INTERNAL_ERROR: HRESULT = 0x8004016Fu32 as HRESULT; +pub const CACHE_E_FIRST: HRESULT = 0x80040170u32 as HRESULT; +pub const CACHE_E_LAST: HRESULT = 0x8004017Fu32 as HRESULT; +pub const CACHE_S_FIRST: HRESULT = 0x00040170; +pub const CACHE_S_LAST: HRESULT = 0x0004017F; +pub const CACHE_E_NOCACHE_UPDATED: HRESULT = 0x80040170u32 as HRESULT; +pub const OLEOBJ_E_FIRST: HRESULT = 0x80040180u32 as HRESULT; +pub const OLEOBJ_E_LAST: HRESULT = 0x8004018Fu32 as HRESULT; +pub const OLEOBJ_S_FIRST: HRESULT = 0x00040180; +pub const OLEOBJ_S_LAST: HRESULT = 0x0004018F; +pub const OLEOBJ_E_NOVERBS: HRESULT = 0x80040180u32 as HRESULT; +pub const OLEOBJ_E_INVALIDVERB: HRESULT = 0x80040181u32 as HRESULT; +pub const CLIENTSITE_E_FIRST: HRESULT = 0x80040190u32 as HRESULT; +pub const CLIENTSITE_E_LAST: HRESULT = 0x8004019Fu32 as HRESULT; +pub const CLIENTSITE_S_FIRST: HRESULT = 0x00040190; +pub const CLIENTSITE_S_LAST: HRESULT = 0x0004019F; +pub const INPLACE_E_NOTUNDOABLE: HRESULT = 0x800401A0u32 as HRESULT; +pub const INPLACE_E_NOTOOLSPACE: HRESULT = 0x800401A1u32 as HRESULT; +pub const INPLACE_E_FIRST: HRESULT = 0x800401A0u32 as HRESULT; +pub const INPLACE_E_LAST: HRESULT = 0x800401AFu32 as HRESULT; +pub const INPLACE_S_FIRST: HRESULT = 0x000401A0; +pub const INPLACE_S_LAST: HRESULT = 0x000401AF; +pub const ENUM_E_FIRST: HRESULT = 0x800401B0u32 as HRESULT; +pub const ENUM_E_LAST: HRESULT = 0x800401BFu32 as HRESULT; +pub const ENUM_S_FIRST: HRESULT = 0x000401B0; +pub const ENUM_S_LAST: HRESULT = 0x000401BF; +pub const CONVERT10_E_FIRST: HRESULT = 0x800401C0u32 as HRESULT; +pub const CONVERT10_E_LAST: HRESULT = 0x800401CFu32 as HRESULT; +pub const CONVERT10_S_FIRST: HRESULT = 0x000401C0; +pub const CONVERT10_S_LAST: HRESULT = 0x000401CF; +pub const CONVERT10_E_OLESTREAM_GET: HRESULT = 0x800401C0u32 as HRESULT; +pub const CONVERT10_E_OLESTREAM_PUT: HRESULT = 0x800401C1u32 as HRESULT; +pub const CONVERT10_E_OLESTREAM_FMT: HRESULT = 0x800401C2u32 as HRESULT; +pub const CONVERT10_E_OLESTREAM_BITMAP_TO_DIB: HRESULT = 0x800401C3u32 as HRESULT; +pub const CONVERT10_E_STG_FMT: HRESULT = 0x800401C4u32 as HRESULT; +pub const CONVERT10_E_STG_NO_STD_STREAM: HRESULT = 0x800401C5u32 as HRESULT; +pub const CONVERT10_E_STG_DIB_TO_BITMAP: HRESULT = 0x800401C6u32 as HRESULT; +pub const CLIPBRD_E_FIRST: HRESULT = 0x800401D0u32 as HRESULT; +pub const CLIPBRD_E_LAST: HRESULT = 0x800401DFu32 as HRESULT; +pub const CLIPBRD_S_FIRST: HRESULT = 0x000401D0; +pub const CLIPBRD_S_LAST: HRESULT = 0x000401DF; +pub const CLIPBRD_E_CANT_OPEN: HRESULT = 0x800401D0u32 as HRESULT; +pub const CLIPBRD_E_CANT_EMPTY: HRESULT = 0x800401D1u32 as HRESULT; +pub const CLIPBRD_E_CANT_SET: HRESULT = 0x800401D2u32 as HRESULT; +pub const CLIPBRD_E_BAD_DATA: HRESULT = 0x800401D3u32 as HRESULT; +pub const CLIPBRD_E_CANT_CLOSE: HRESULT = 0x800401D4u32 as HRESULT; +pub const MK_E_FIRST: HRESULT = 0x800401E0u32 as HRESULT; +pub const MK_E_LAST: HRESULT = 0x800401EFu32 as HRESULT; +pub const MK_S_FIRST: HRESULT = 0x000401E0; +pub const MK_S_LAST: HRESULT = 0x000401EF; +pub const MK_E_CONNECTMANUALLY: HRESULT = 0x800401E0u32 as HRESULT; +pub const MK_E_EXCEEDEDDEADLINE: HRESULT = 0x800401E1u32 as HRESULT; +pub const MK_E_NEEDGENERIC: HRESULT = 0x800401E2u32 as HRESULT; +pub const MK_E_UNAVAILABLE: HRESULT = 0x800401E3u32 as HRESULT; +pub const MK_E_SYNTAX: HRESULT = 0x800401E4u32 as HRESULT; +pub const MK_E_NOOBJECT: HRESULT = 0x800401E5u32 as HRESULT; +pub const MK_E_INVALIDEXTENSION: HRESULT = 0x800401E6u32 as HRESULT; +pub const MK_E_INTERMEDIATEINTERFACENOTSUPPORTED: HRESULT = 0x800401E7u32 as HRESULT; +pub const MK_E_NOTBINDABLE: HRESULT = 0x800401E8u32 as HRESULT; +pub const MK_E_NOTBOUND: HRESULT = 0x800401E9u32 as HRESULT; +pub const MK_E_CANTOPENFILE: HRESULT = 0x800401EAu32 as HRESULT; +pub const MK_E_MUSTBOTHERUSER: HRESULT = 0x800401EBu32 as HRESULT; +pub const MK_E_NOINVERSE: HRESULT = 0x800401ECu32 as HRESULT; +pub const MK_E_NOSTORAGE: HRESULT = 0x800401EDu32 as HRESULT; +pub const MK_E_NOPREFIX: HRESULT = 0x800401EEu32 as HRESULT; +pub const MK_E_ENUMERATION_FAILED: HRESULT = 0x800401EFu32 as HRESULT; +pub const CO_E_FIRST: HRESULT = 0x800401F0u32 as HRESULT; +pub const CO_E_LAST: HRESULT = 0x800401FFu32 as HRESULT; +pub const CO_S_FIRST: HRESULT = 0x000401F0; +pub const CO_S_LAST: HRESULT = 0x000401FF; +pub const CO_E_NOTINITIALIZED: HRESULT = 0x800401F0u32 as HRESULT; +pub const CO_E_ALREADYINITIALIZED: HRESULT = 0x800401F1u32 as HRESULT; +pub const CO_E_CANTDETERMINECLASS: HRESULT = 0x800401F2u32 as HRESULT; +pub const CO_E_CLASSSTRING: HRESULT = 0x800401F3u32 as HRESULT; +pub const CO_E_IIDSTRING: HRESULT = 0x800401F4u32 as HRESULT; +pub const CO_E_APPNOTFOUND: HRESULT = 0x800401F5u32 as HRESULT; +pub const CO_E_APPSINGLEUSE: HRESULT = 0x800401F6u32 as HRESULT; +pub const CO_E_ERRORINAPP: HRESULT = 0x800401F7u32 as HRESULT; +pub const CO_E_DLLNOTFOUND: HRESULT = 0x800401F8u32 as HRESULT; +pub const CO_E_ERRORINDLL: HRESULT = 0x800401F9u32 as HRESULT; +pub const CO_E_WRONGOSFORAPP: HRESULT = 0x800401FAu32 as HRESULT; +pub const CO_E_OBJNOTREG: HRESULT = 0x800401FBu32 as HRESULT; +pub const CO_E_OBJISREG: HRESULT = 0x800401FCu32 as HRESULT; +pub const CO_E_OBJNOTCONNECTED: HRESULT = 0x800401FDu32 as HRESULT; +pub const CO_E_APPDIDNTREG: HRESULT = 0x800401FEu32 as HRESULT; +pub const CO_E_RELEASED: HRESULT = 0x800401FFu32 as HRESULT; +pub const EVENT_E_FIRST: HRESULT = 0x80040200u32 as HRESULT; +pub const EVENT_E_LAST: HRESULT = 0x8004021Fu32 as HRESULT; +pub const EVENT_S_FIRST: HRESULT = 0x00040200; +pub const EVENT_S_LAST: HRESULT = 0x0004021F; +pub const EVENT_S_SOME_SUBSCRIBERS_FAILED: HRESULT = 0x00040200; +pub const EVENT_E_ALL_SUBSCRIBERS_FAILED: HRESULT = 0x80040201u32 as HRESULT; +pub const EVENT_S_NOSUBSCRIBERS: HRESULT = 0x00040202; +pub const EVENT_E_QUERYSYNTAX: HRESULT = 0x80040203u32 as HRESULT; +pub const EVENT_E_QUERYFIELD: HRESULT = 0x80040204u32 as HRESULT; +pub const EVENT_E_INTERNALEXCEPTION: HRESULT = 0x80040205u32 as HRESULT; +pub const EVENT_E_INTERNALERROR: HRESULT = 0x80040206u32 as HRESULT; +pub const EVENT_E_INVALID_PER_USER_SID: HRESULT = 0x80040207u32 as HRESULT; +pub const EVENT_E_USER_EXCEPTION: HRESULT = 0x80040208u32 as HRESULT; +pub const EVENT_E_TOO_MANY_METHODS: HRESULT = 0x80040209u32 as HRESULT; +pub const EVENT_E_MISSING_EVENTCLASS: HRESULT = 0x8004020Au32 as HRESULT; +pub const EVENT_E_NOT_ALL_REMOVED: HRESULT = 0x8004020Bu32 as HRESULT; +pub const EVENT_E_COMPLUS_NOT_INSTALLED: HRESULT = 0x8004020Cu32 as HRESULT; +pub const EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT: HRESULT = 0x8004020Du32 as HRESULT; +pub const EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT: HRESULT = 0x8004020Eu32 as HRESULT; +pub const EVENT_E_INVALID_EVENT_CLASS_PARTITION: HRESULT = 0x8004020Fu32 as HRESULT; +pub const EVENT_E_PER_USER_SID_NOT_LOGGED_ON: HRESULT = 0x80040210u32 as HRESULT; +pub const TPC_E_INVALID_PROPERTY: HRESULT = 0x80040241u32 as HRESULT; +pub const TPC_E_NO_DEFAULT_TABLET: HRESULT = 0x80040212u32 as HRESULT; +pub const TPC_E_UNKNOWN_PROPERTY: HRESULT = 0x8004021Bu32 as HRESULT; +pub const TPC_E_INVALID_INPUT_RECT: HRESULT = 0x80040219u32 as HRESULT; +pub const TPC_E_INVALID_STROKE: HRESULT = 0x80040222u32 as HRESULT; +pub const TPC_E_INITIALIZE_FAIL: HRESULT = 0x80040223u32 as HRESULT; +pub const TPC_E_NOT_RELEVANT: HRESULT = 0x80040232u32 as HRESULT; +pub const TPC_E_INVALID_PACKET_DESCRIPTION: HRESULT = 0x80040233u32 as HRESULT; +pub const TPC_E_RECOGNIZER_NOT_REGISTERED: HRESULT = 0x80040235u32 as HRESULT; +pub const TPC_E_INVALID_RIGHTS: HRESULT = 0x80040236u32 as HRESULT; +pub const TPC_E_OUT_OF_ORDER_CALL: HRESULT = 0x80040237u32 as HRESULT; +pub const TPC_E_QUEUE_FULL: HRESULT = 0x80040238u32 as HRESULT; +pub const TPC_E_INVALID_CONFIGURATION: HRESULT = 0x80040239u32 as HRESULT; +pub const TPC_E_INVALID_DATA_FROM_RECOGNIZER: HRESULT = 0x8004023Au32 as HRESULT; +pub const TPC_S_TRUNCATED: HRESULT = 0x00040252; +pub const TPC_S_INTERRUPTED: HRESULT = 0x00040253; +pub const TPC_S_NO_DATA_TO_PROCESS: HRESULT = 0x00040254; +pub const XACT_E_FIRST: HRESULT = 0x8004D000u32 as HRESULT; +pub const XACT_E_LAST: HRESULT = 0x8004D02Bu32 as HRESULT; +pub const XACT_S_FIRST: HRESULT = 0x0004D000; +pub const XACT_S_LAST: HRESULT = 0x0004D010; +pub const XACT_E_ALREADYOTHERSINGLEPHASE: HRESULT = 0x8004D000u32 as HRESULT; +pub const XACT_E_CANTRETAIN: HRESULT = 0x8004D001u32 as HRESULT; +pub const XACT_E_COMMITFAILED: HRESULT = 0x8004D002u32 as HRESULT; +pub const XACT_E_COMMITPREVENTED: HRESULT = 0x8004D003u32 as HRESULT; +pub const XACT_E_HEURISTICABORT: HRESULT = 0x8004D004u32 as HRESULT; +pub const XACT_E_HEURISTICCOMMIT: HRESULT = 0x8004D005u32 as HRESULT; +pub const XACT_E_HEURISTICDAMAGE: HRESULT = 0x8004D006u32 as HRESULT; +pub const XACT_E_HEURISTICDANGER: HRESULT = 0x8004D007u32 as HRESULT; +pub const XACT_E_ISOLATIONLEVEL: HRESULT = 0x8004D008u32 as HRESULT; +pub const XACT_E_NOASYNC: HRESULT = 0x8004D009u32 as HRESULT; +pub const XACT_E_NOENLIST: HRESULT = 0x8004D00Au32 as HRESULT; +pub const XACT_E_NOISORETAIN: HRESULT = 0x8004D00Bu32 as HRESULT; +pub const XACT_E_NORESOURCE: HRESULT = 0x8004D00Cu32 as HRESULT; +pub const XACT_E_NOTCURRENT: HRESULT = 0x8004D00Du32 as HRESULT; +pub const XACT_E_NOTRANSACTION: HRESULT = 0x8004D00Eu32 as HRESULT; +pub const XACT_E_NOTSUPPORTED: HRESULT = 0x8004D00Fu32 as HRESULT; +pub const XACT_E_UNKNOWNRMGRID: HRESULT = 0x8004D010u32 as HRESULT; +pub const XACT_E_WRONGSTATE: HRESULT = 0x8004D011u32 as HRESULT; +pub const XACT_E_WRONGUOW: HRESULT = 0x8004D012u32 as HRESULT; +pub const XACT_E_XTIONEXISTS: HRESULT = 0x8004D013u32 as HRESULT; +pub const XACT_E_NOIMPORTOBJECT: HRESULT = 0x8004D014u32 as HRESULT; +pub const XACT_E_INVALIDCOOKIE: HRESULT = 0x8004D015u32 as HRESULT; +pub const XACT_E_INDOUBT: HRESULT = 0x8004D016u32 as HRESULT; +pub const XACT_E_NOTIMEOUT: HRESULT = 0x8004D017u32 as HRESULT; +pub const XACT_E_ALREADYINPROGRESS: HRESULT = 0x8004D018u32 as HRESULT; +pub const XACT_E_ABORTED: HRESULT = 0x8004D019u32 as HRESULT; +pub const XACT_E_LOGFULL: HRESULT = 0x8004D01Au32 as HRESULT; +pub const XACT_E_TMNOTAVAILABLE: HRESULT = 0x8004D01Bu32 as HRESULT; +pub const XACT_E_CONNECTION_DOWN: HRESULT = 0x8004D01Cu32 as HRESULT; +pub const XACT_E_CONNECTION_DENIED: HRESULT = 0x8004D01Du32 as HRESULT; +pub const XACT_E_REENLISTTIMEOUT: HRESULT = 0x8004D01Eu32 as HRESULT; +pub const XACT_E_TIP_CONNECT_FAILED: HRESULT = 0x8004D01Fu32 as HRESULT; +pub const XACT_E_TIP_PROTOCOL_ERROR: HRESULT = 0x8004D020u32 as HRESULT; +pub const XACT_E_TIP_PULL_FAILED: HRESULT = 0x8004D021u32 as HRESULT; +pub const XACT_E_DEST_TMNOTAVAILABLE: HRESULT = 0x8004D022u32 as HRESULT; +pub const XACT_E_TIP_DISABLED: HRESULT = 0x8004D023u32 as HRESULT; +pub const XACT_E_NETWORK_TX_DISABLED: HRESULT = 0x8004D024u32 as HRESULT; +pub const XACT_E_PARTNER_NETWORK_TX_DISABLED: HRESULT = 0x8004D025u32 as HRESULT; +pub const XACT_E_XA_TX_DISABLED: HRESULT = 0x8004D026u32 as HRESULT; +pub const XACT_E_UNABLE_TO_READ_DTC_CONFIG: HRESULT = 0x8004D027u32 as HRESULT; +pub const XACT_E_UNABLE_TO_LOAD_DTC_PROXY: HRESULT = 0x8004D028u32 as HRESULT; +pub const XACT_E_ABORTING: HRESULT = 0x8004D029u32 as HRESULT; +pub const XACT_E_PUSH_COMM_FAILURE: HRESULT = 0x8004D02Au32 as HRESULT; +pub const XACT_E_PULL_COMM_FAILURE: HRESULT = 0x8004D02Bu32 as HRESULT; +pub const XACT_E_LU_TX_DISABLED: HRESULT = 0x8004D02Cu32 as HRESULT; +pub const XACT_E_CLERKNOTFOUND: HRESULT = 0x8004D080u32 as HRESULT; +pub const XACT_E_CLERKEXISTS: HRESULT = 0x8004D081u32 as HRESULT; +pub const XACT_E_RECOVERYINPROGRESS: HRESULT = 0x8004D082u32 as HRESULT; +pub const XACT_E_TRANSACTIONCLOSED: HRESULT = 0x8004D083u32 as HRESULT; +pub const XACT_E_INVALIDLSN: HRESULT = 0x8004D084u32 as HRESULT; +pub const XACT_E_REPLAYREQUEST: HRESULT = 0x8004D085u32 as HRESULT; +pub const XACT_S_ASYNC: HRESULT = 0x0004D000; +pub const XACT_S_DEFECT: HRESULT = 0x0004D001; +pub const XACT_S_READONLY: HRESULT = 0x0004D002; +pub const XACT_S_SOMENORETAIN: HRESULT = 0x0004D003; +pub const XACT_S_OKINFORM: HRESULT = 0x0004D004; +pub const XACT_S_MADECHANGESCONTENT: HRESULT = 0x0004D005; +pub const XACT_S_MADECHANGESINFORM: HRESULT = 0x0004D006; +pub const XACT_S_ALLNORETAIN: HRESULT = 0x0004D007; +pub const XACT_S_ABORTING: HRESULT = 0x0004D008; +pub const XACT_S_SINGLEPHASE: HRESULT = 0x0004D009; +pub const XACT_S_LOCALLY_OK: HRESULT = 0x0004D00A; +pub const XACT_S_LASTRESOURCEMANAGER: HRESULT = 0x0004D010; +pub const CONTEXT_E_FIRST: HRESULT = 0x8004E000u32 as HRESULT; +pub const CONTEXT_E_LAST: HRESULT = 0x8004E02Fu32 as HRESULT; +pub const CONTEXT_S_FIRST: HRESULT = 0x0004E000; +pub const CONTEXT_S_LAST: HRESULT = 0x0004E02F; +pub const CONTEXT_E_ABORTED: HRESULT = 0x8004E002u32 as HRESULT; +pub const CONTEXT_E_ABORTING: HRESULT = 0x8004E003u32 as HRESULT; +pub const CONTEXT_E_NOCONTEXT: HRESULT = 0x8004E004u32 as HRESULT; +pub const CONTEXT_E_WOULD_DEADLOCK: HRESULT = 0x8004E005u32 as HRESULT; +pub const CONTEXT_E_SYNCH_TIMEOUT: HRESULT = 0x8004E006u32 as HRESULT; +pub const CONTEXT_E_OLDREF: HRESULT = 0x8004E007u32 as HRESULT; +pub const CONTEXT_E_ROLENOTFOUND: HRESULT = 0x8004E00Cu32 as HRESULT; +pub const CONTEXT_E_TMNOTAVAILABLE: HRESULT = 0x8004E00Fu32 as HRESULT; +pub const CO_E_ACTIVATIONFAILED: HRESULT = 0x8004E021u32 as HRESULT; +pub const CO_E_ACTIVATIONFAILED_EVENTLOGGED: HRESULT = 0x8004E022u32 as HRESULT; +pub const CO_E_ACTIVATIONFAILED_CATALOGERROR: HRESULT = 0x8004E023u32 as HRESULT; +pub const CO_E_ACTIVATIONFAILED_TIMEOUT: HRESULT = 0x8004E024u32 as HRESULT; +pub const CO_E_INITIALIZATIONFAILED: HRESULT = 0x8004E025u32 as HRESULT; +pub const CONTEXT_E_NOJIT: HRESULT = 0x8004E026u32 as HRESULT; +pub const CONTEXT_E_NOTRANSACTION: HRESULT = 0x8004E027u32 as HRESULT; +pub const CO_E_THREADINGMODEL_CHANGED: HRESULT = 0x8004E028u32 as HRESULT; +pub const CO_E_NOIISINTRINSICS: HRESULT = 0x8004E029u32 as HRESULT; +pub const CO_E_NOCOOKIES: HRESULT = 0x8004E02Au32 as HRESULT; +pub const CO_E_DBERROR: HRESULT = 0x8004E02Bu32 as HRESULT; +pub const CO_E_NOTPOOLED: HRESULT = 0x8004E02Cu32 as HRESULT; +pub const CO_E_NOTCONSTRUCTED: HRESULT = 0x8004E02Du32 as HRESULT; +pub const CO_E_NOSYNCHRONIZATION: HRESULT = 0x8004E02Eu32 as HRESULT; +pub const CO_E_ISOLEVELMISMATCH: HRESULT = 0x8004E02Fu32 as HRESULT; +pub const CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED: HRESULT = 0x8004E030u32 as HRESULT; +pub const CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED: HRESULT = 0x8004E031u32 as HRESULT; +pub const OLE_S_USEREG: HRESULT = 0x00040000; +pub const OLE_S_STATIC: HRESULT = 0x00040001; +pub const OLE_S_MAC_CLIPFORMAT: HRESULT = 0x00040002; +pub const DRAGDROP_S_DROP: HRESULT = 0x00040100; +pub const DRAGDROP_S_CANCEL: HRESULT = 0x00040101; +pub const DRAGDROP_S_USEDEFAULTCURSORS: HRESULT = 0x00040102; +pub const DATA_S_SAMEFORMATETC: HRESULT = 0x00040130; +pub const VIEW_S_ALREADY_FROZEN: HRESULT = 0x00040140; +pub const CACHE_S_FORMATETC_NOTSUPPORTED: HRESULT = 0x00040170; +pub const CACHE_S_SAMECACHE: HRESULT = 0x00040171; +pub const CACHE_S_SOMECACHES_NOTUPDATED: HRESULT = 0x00040172; +pub const OLEOBJ_S_INVALIDVERB: HRESULT = 0x00040180; +pub const OLEOBJ_S_CANNOT_DOVERB_NOW: HRESULT = 0x00040181; +pub const OLEOBJ_S_INVALIDHWND: HRESULT = 0x00040182; +pub const INPLACE_S_TRUNCATED: HRESULT = 0x000401A0; +pub const CONVERT10_S_NO_PRESENTATION: HRESULT = 0x000401C0; +pub const MK_S_REDUCED_TO_SELF: HRESULT = 0x000401E2; +pub const MK_S_ME: HRESULT = 0x000401E4; +pub const MK_S_HIM: HRESULT = 0x000401E5; +pub const MK_S_US: HRESULT = 0x000401E6; +pub const MK_S_MONIKERALREADYREGISTERED: HRESULT = 0x000401E7; +pub const SCHED_S_TASK_READY: HRESULT = 0x00041300; +pub const SCHED_S_TASK_RUNNING: HRESULT = 0x00041301; +pub const SCHED_S_TASK_DISABLED: HRESULT = 0x00041302; +pub const SCHED_S_TASK_HAS_NOT_RUN: HRESULT = 0x00041303; +pub const SCHED_S_TASK_NO_MORE_RUNS: HRESULT = 0x00041304; +pub const SCHED_S_TASK_NOT_SCHEDULED: HRESULT = 0x00041305; +pub const SCHED_S_TASK_TERMINATED: HRESULT = 0x00041306; +pub const SCHED_S_TASK_NO_VALID_TRIGGERS: HRESULT = 0x00041307; +pub const SCHED_S_EVENT_TRIGGER: HRESULT = 0x00041308; +pub const SCHED_E_TRIGGER_NOT_FOUND: HRESULT = 0x80041309u32 as HRESULT; +pub const SCHED_E_TASK_NOT_READY: HRESULT = 0x8004130Au32 as HRESULT; +pub const SCHED_E_TASK_NOT_RUNNING: HRESULT = 0x8004130Bu32 as HRESULT; +pub const SCHED_E_SERVICE_NOT_INSTALLED: HRESULT = 0x8004130Cu32 as HRESULT; +pub const SCHED_E_CANNOT_OPEN_TASK: HRESULT = 0x8004130Du32 as HRESULT; +pub const SCHED_E_INVALID_TASK: HRESULT = 0x8004130Eu32 as HRESULT; +pub const SCHED_E_ACCOUNT_INFORMATION_NOT_SET: HRESULT = 0x8004130Fu32 as HRESULT; +pub const SCHED_E_ACCOUNT_NAME_NOT_FOUND: HRESULT = 0x80041310u32 as HRESULT; +pub const SCHED_E_ACCOUNT_DBASE_CORRUPT: HRESULT = 0x80041311u32 as HRESULT; +pub const SCHED_E_NO_SECURITY_SERVICES: HRESULT = 0x80041312u32 as HRESULT; +pub const SCHED_E_UNKNOWN_OBJECT_VERSION: HRESULT = 0x80041313u32 as HRESULT; +pub const SCHED_E_UNSUPPORTED_ACCOUNT_OPTION: HRESULT = 0x80041314u32 as HRESULT; +pub const SCHED_E_SERVICE_NOT_RUNNING: HRESULT = 0x80041315u32 as HRESULT; +pub const SCHED_E_UNEXPECTEDNODE: HRESULT = 0x80041316u32 as HRESULT; +pub const SCHED_E_NAMESPACE: HRESULT = 0x80041317u32 as HRESULT; +pub const SCHED_E_INVALIDVALUE: HRESULT = 0x80041318u32 as HRESULT; +pub const SCHED_E_MISSINGNODE: HRESULT = 0x80041319u32 as HRESULT; +pub const SCHED_E_MALFORMEDXML: HRESULT = 0x8004131Au32 as HRESULT; +pub const SCHED_S_SOME_TRIGGERS_FAILED: HRESULT = 0x0004131B; +pub const SCHED_S_BATCH_LOGON_PROBLEM: HRESULT = 0x0004131C; +pub const SCHED_E_TOO_MANY_NODES: HRESULT = 0x8004131Du32 as HRESULT; +pub const SCHED_E_PAST_END_BOUNDARY: HRESULT = 0x8004131Eu32 as HRESULT; +pub const SCHED_E_ALREADY_RUNNING: HRESULT = 0x8004131Fu32 as HRESULT; +pub const SCHED_E_USER_NOT_LOGGED_ON: HRESULT = 0x80041320u32 as HRESULT; +pub const SCHED_E_INVALID_TASK_HASH: HRESULT = 0x80041321u32 as HRESULT; +pub const SCHED_E_SERVICE_NOT_AVAILABLE: HRESULT = 0x80041322u32 as HRESULT; +pub const SCHED_E_SERVICE_TOO_BUSY: HRESULT = 0x80041323u32 as HRESULT; +pub const SCHED_E_TASK_ATTEMPTED: HRESULT = 0x80041324u32 as HRESULT; +pub const SCHED_S_TASK_QUEUED: HRESULT = 0x00041325; +pub const SCHED_E_TASK_DISABLED: HRESULT = 0x80041326u32 as HRESULT; +pub const SCHED_E_TASK_NOT_V1_COMPAT: HRESULT = 0x80041327u32 as HRESULT; +pub const SCHED_E_START_ON_DEMAND: HRESULT = 0x80041328u32 as HRESULT; +pub const SCHED_E_TASK_NOT_UBPM_COMPAT: HRESULT = 0x80041329u32 as HRESULT; +pub const SCHED_E_DEPRECATED_FEATURE_USED: HRESULT = 0x80041330u32 as HRESULT; +pub const CO_E_CLASS_CREATE_FAILED: HRESULT = 0x80080001u32 as HRESULT; +pub const CO_E_SCM_ERROR: HRESULT = 0x80080002u32 as HRESULT; +pub const CO_E_SCM_RPC_FAILURE: HRESULT = 0x80080003u32 as HRESULT; +pub const CO_E_BAD_PATH: HRESULT = 0x80080004u32 as HRESULT; +pub const CO_E_SERVER_EXEC_FAILURE: HRESULT = 0x80080005u32 as HRESULT; +pub const CO_E_OBJSRV_RPC_FAILURE: HRESULT = 0x80080006u32 as HRESULT; +pub const MK_E_NO_NORMALIZED: HRESULT = 0x80080007u32 as HRESULT; +pub const CO_E_SERVER_STOPPING: HRESULT = 0x80080008u32 as HRESULT; +pub const MEM_E_INVALID_ROOT: HRESULT = 0x80080009u32 as HRESULT; +pub const MEM_E_INVALID_LINK: HRESULT = 0x80080010u32 as HRESULT; +pub const MEM_E_INVALID_SIZE: HRESULT = 0x80080011u32 as HRESULT; +pub const CO_S_NOTALLINTERFACES: HRESULT = 0x00080012; +pub const CO_S_MACHINENAMENOTFOUND: HRESULT = 0x00080013; +pub const CO_E_MISSING_DISPLAYNAME: HRESULT = 0x80080015u32 as HRESULT; +pub const CO_E_RUNAS_VALUE_MUST_BE_AAA: HRESULT = 0x80080016u32 as HRESULT; +pub const CO_E_ELEVATION_DISABLED: HRESULT = 0x80080017u32 as HRESULT; +pub const APPX_E_PACKAGING_INTERNAL: HRESULT = 0x80080200u32 as HRESULT; +pub const APPX_E_INTERLEAVING_NOT_ALLOWED: HRESULT = 0x80080201u32 as HRESULT; +pub const APPX_E_RELATIONSHIPS_NOT_ALLOWED: HRESULT = 0x80080202u32 as HRESULT; +pub const APPX_E_MISSING_REQUIRED_FILE: HRESULT = 0x80080203u32 as HRESULT; +pub const APPX_E_INVALID_MANIFEST: HRESULT = 0x80080204u32 as HRESULT; +pub const APPX_E_INVALID_BLOCKMAP: HRESULT = 0x80080205u32 as HRESULT; +pub const APPX_E_CORRUPT_CONTENT: HRESULT = 0x80080206u32 as HRESULT; +pub const APPX_E_BLOCK_HASH_INVALID: HRESULT = 0x80080207u32 as HRESULT; +pub const APPX_E_REQUESTED_RANGE_TOO_LARGE: HRESULT = 0x80080208u32 as HRESULT; +pub const APPX_E_INVALID_SIP_CLIENT_DATA: HRESULT = 0x80080209u32 as HRESULT; +pub const BT_E_SPURIOUS_ACTIVATION: HRESULT = 0x80080300u32 as HRESULT; +pub const DISP_E_UNKNOWNINTERFACE: HRESULT = 0x80020001u32 as HRESULT; +pub const DISP_E_MEMBERNOTFOUND: HRESULT = 0x80020003u32 as HRESULT; +pub const DISP_E_PARAMNOTFOUND: HRESULT = 0x80020004u32 as HRESULT; +pub const DISP_E_TYPEMISMATCH: HRESULT = 0x80020005u32 as HRESULT; +pub const DISP_E_UNKNOWNNAME: HRESULT = 0x80020006u32 as HRESULT; +pub const DISP_E_NONAMEDARGS: HRESULT = 0x80020007u32 as HRESULT; +pub const DISP_E_BADVARTYPE: HRESULT = 0x80020008u32 as HRESULT; +pub const DISP_E_EXCEPTION: HRESULT = 0x80020009u32 as HRESULT; +pub const DISP_E_OVERFLOW: HRESULT = 0x8002000Au32 as HRESULT; +pub const DISP_E_BADINDEX: HRESULT = 0x8002000Bu32 as HRESULT; +pub const DISP_E_UNKNOWNLCID: HRESULT = 0x8002000Cu32 as HRESULT; +pub const DISP_E_ARRAYISLOCKED: HRESULT = 0x8002000Du32 as HRESULT; +pub const DISP_E_BADPARAMCOUNT: HRESULT = 0x8002000Eu32 as HRESULT; +pub const DISP_E_PARAMNOTOPTIONAL: HRESULT = 0x8002000Fu32 as HRESULT; +pub const DISP_E_BADCALLEE: HRESULT = 0x80020010u32 as HRESULT; +pub const DISP_E_NOTACOLLECTION: HRESULT = 0x80020011u32 as HRESULT; +pub const DISP_E_DIVBYZERO: HRESULT = 0x80020012u32 as HRESULT; +pub const DISP_E_BUFFERTOOSMALL: HRESULT = 0x80020013u32 as HRESULT; +pub const TYPE_E_BUFFERTOOSMALL: HRESULT = 0x80028016u32 as HRESULT; +pub const TYPE_E_FIELDNOTFOUND: HRESULT = 0x80028017u32 as HRESULT; +pub const TYPE_E_INVDATAREAD: HRESULT = 0x80028018u32 as HRESULT; +pub const TYPE_E_UNSUPFORMAT: HRESULT = 0x80028019u32 as HRESULT; +pub const TYPE_E_REGISTRYACCESS: HRESULT = 0x8002801Cu32 as HRESULT; +pub const TYPE_E_LIBNOTREGISTERED: HRESULT = 0x8002801Du32 as HRESULT; +pub const TYPE_E_UNDEFINEDTYPE: HRESULT = 0x80028027u32 as HRESULT; +pub const TYPE_E_QUALIFIEDNAMEDISALLOWED: HRESULT = 0x80028028u32 as HRESULT; +pub const TYPE_E_INVALIDSTATE: HRESULT = 0x80028029u32 as HRESULT; +pub const TYPE_E_WRONGTYPEKIND: HRESULT = 0x8002802Au32 as HRESULT; +pub const TYPE_E_ELEMENTNOTFOUND: HRESULT = 0x8002802Bu32 as HRESULT; +pub const TYPE_E_AMBIGUOUSNAME: HRESULT = 0x8002802Cu32 as HRESULT; +pub const TYPE_E_NAMECONFLICT: HRESULT = 0x8002802Du32 as HRESULT; +pub const TYPE_E_UNKNOWNLCID: HRESULT = 0x8002802Eu32 as HRESULT; +pub const TYPE_E_DLLFUNCTIONNOTFOUND: HRESULT = 0x8002802Fu32 as HRESULT; +pub const TYPE_E_BADMODULEKIND: HRESULT = 0x800288BDu32 as HRESULT; +pub const TYPE_E_SIZETOOBIG: HRESULT = 0x800288C5u32 as HRESULT; +pub const TYPE_E_DUPLICATEID: HRESULT = 0x800288C6u32 as HRESULT; +pub const TYPE_E_INVALIDID: HRESULT = 0x800288CFu32 as HRESULT; +pub const TYPE_E_TYPEMISMATCH: HRESULT = 0x80028CA0u32 as HRESULT; +pub const TYPE_E_OUTOFBOUNDS: HRESULT = 0x80028CA1u32 as HRESULT; +pub const TYPE_E_IOERROR: HRESULT = 0x80028CA2u32 as HRESULT; +pub const TYPE_E_CANTCREATETMPFILE: HRESULT = 0x80028CA3u32 as HRESULT; +pub const TYPE_E_CANTLOADLIBRARY: HRESULT = 0x80029C4Au32 as HRESULT; +pub const TYPE_E_INCONSISTENTPROPFUNCS: HRESULT = 0x80029C83u32 as HRESULT; +pub const TYPE_E_CIRCULARTYPE: HRESULT = 0x80029C84u32 as HRESULT; +pub const STG_E_INVALIDFUNCTION: HRESULT = 0x80030001u32 as HRESULT; +pub const STG_E_FILENOTFOUND: HRESULT = 0x80030002u32 as HRESULT; +pub const STG_E_PATHNOTFOUND: HRESULT = 0x80030003u32 as HRESULT; +pub const STG_E_TOOMANYOPENFILES: HRESULT = 0x80030004u32 as HRESULT; +pub const STG_E_ACCESSDENIED: HRESULT = 0x80030005u32 as HRESULT; +pub const STG_E_INVALIDHANDLE: HRESULT = 0x80030006u32 as HRESULT; +pub const STG_E_INSUFFICIENTMEMORY: HRESULT = 0x80030008u32 as HRESULT; +pub const STG_E_INVALIDPOINTER: HRESULT = 0x80030009u32 as HRESULT; +pub const STG_E_NOMOREFILES: HRESULT = 0x80030012u32 as HRESULT; +pub const STG_E_DISKISWRITEPROTECTED: HRESULT = 0x80030013u32 as HRESULT; +pub const STG_E_SEEKERROR: HRESULT = 0x80030019u32 as HRESULT; +pub const STG_E_WRITEFAULT: HRESULT = 0x8003001Du32 as HRESULT; +pub const STG_E_READFAULT: HRESULT = 0x8003001Eu32 as HRESULT; +pub const STG_E_SHAREVIOLATION: HRESULT = 0x80030020u32 as HRESULT; +pub const STG_E_LOCKVIOLATION: HRESULT = 0x80030021u32 as HRESULT; +pub const STG_E_FILEALREADYEXISTS: HRESULT = 0x80030050u32 as HRESULT; +pub const STG_E_INVALIDPARAMETER: HRESULT = 0x80030057u32 as HRESULT; +pub const STG_E_MEDIUMFULL: HRESULT = 0x80030070u32 as HRESULT; +pub const STG_E_PROPSETMISMATCHED: HRESULT = 0x800300F0u32 as HRESULT; +pub const STG_E_ABNORMALAPIEXIT: HRESULT = 0x800300FAu32 as HRESULT; +pub const STG_E_INVALIDHEADER: HRESULT = 0x800300FBu32 as HRESULT; +pub const STG_E_INVALIDNAME: HRESULT = 0x800300FCu32 as HRESULT; +pub const STG_E_UNKNOWN: HRESULT = 0x800300FDu32 as HRESULT; +pub const STG_E_UNIMPLEMENTEDFUNCTION: HRESULT = 0x800300FEu32 as HRESULT; +pub const STG_E_INVALIDFLAG: HRESULT = 0x800300FFu32 as HRESULT; +pub const STG_E_INUSE: HRESULT = 0x80030100u32 as HRESULT; +pub const STG_E_NOTCURRENT: HRESULT = 0x80030101u32 as HRESULT; +pub const STG_E_REVERTED: HRESULT = 0x80030102u32 as HRESULT; +pub const STG_E_CANTSAVE: HRESULT = 0x80030103u32 as HRESULT; +pub const STG_E_OLDFORMAT: HRESULT = 0x80030104u32 as HRESULT; +pub const STG_E_OLDDLL: HRESULT = 0x80030105u32 as HRESULT; +pub const STG_E_SHAREREQUIRED: HRESULT = 0x80030106u32 as HRESULT; +pub const STG_E_NOTFILEBASEDSTORAGE: HRESULT = 0x80030107u32 as HRESULT; +pub const STG_E_EXTANTMARSHALLINGS: HRESULT = 0x80030108u32 as HRESULT; +pub const STG_E_DOCFILECORRUPT: HRESULT = 0x80030109u32 as HRESULT; +pub const STG_E_BADBASEADDRESS: HRESULT = 0x80030110u32 as HRESULT; +pub const STG_E_DOCFILETOOLARGE: HRESULT = 0x80030111u32 as HRESULT; +pub const STG_E_NOTSIMPLEFORMAT: HRESULT = 0x80030112u32 as HRESULT; +pub const STG_E_INCOMPLETE: HRESULT = 0x80030201u32 as HRESULT; +pub const STG_E_TERMINATED: HRESULT = 0x80030202u32 as HRESULT; +pub const STG_S_CONVERTED: HRESULT = 0x00030200; +pub const STG_S_BLOCK: HRESULT = 0x00030201; +pub const STG_S_RETRYNOW: HRESULT = 0x00030202; +pub const STG_S_MONITORING: HRESULT = 0x00030203; +pub const STG_S_MULTIPLEOPENS: HRESULT = 0x00030204; +pub const STG_S_CONSOLIDATIONFAILED: HRESULT = 0x00030205; +pub const STG_S_CANNOTCONSOLIDATE: HRESULT = 0x00030206; +pub const STG_E_STATUS_COPY_PROTECTION_FAILURE: HRESULT = 0x80030305u32 as HRESULT; +pub const STG_E_CSS_AUTHENTICATION_FAILURE: HRESULT = 0x80030306u32 as HRESULT; +pub const STG_E_CSS_KEY_NOT_PRESENT: HRESULT = 0x80030307u32 as HRESULT; +pub const STG_E_CSS_KEY_NOT_ESTABLISHED: HRESULT = 0x80030308u32 as HRESULT; +pub const STG_E_CSS_SCRAMBLED_SECTOR: HRESULT = 0x80030309u32 as HRESULT; +pub const STG_E_CSS_REGION_MISMATCH: HRESULT = 0x8003030Au32 as HRESULT; +pub const STG_E_RESETS_EXHAUSTED: HRESULT = 0x8003030Bu32 as HRESULT; +pub const RPC_E_CALL_REJECTED: HRESULT = 0x80010001u32 as HRESULT; +pub const RPC_E_CALL_CANCELED: HRESULT = 0x80010002u32 as HRESULT; +pub const RPC_E_CANTPOST_INSENDCALL: HRESULT = 0x80010003u32 as HRESULT; +pub const RPC_E_CANTCALLOUT_INASYNCCALL: HRESULT = 0x80010004u32 as HRESULT; +pub const RPC_E_CANTCALLOUT_INEXTERNALCALL: HRESULT = 0x80010005u32 as HRESULT; +pub const RPC_E_CONNECTION_TERMINATED: HRESULT = 0x80010006u32 as HRESULT; +pub const RPC_E_SERVER_DIED: HRESULT = 0x80010007u32 as HRESULT; +pub const RPC_E_CLIENT_DIED: HRESULT = 0x80010008u32 as HRESULT; +pub const RPC_E_INVALID_DATAPACKET: HRESULT = 0x80010009u32 as HRESULT; +pub const RPC_E_CANTTRANSMIT_CALL: HRESULT = 0x8001000Au32 as HRESULT; +pub const RPC_E_CLIENT_CANTMARSHAL_DATA: HRESULT = 0x8001000Bu32 as HRESULT; +pub const RPC_E_CLIENT_CANTUNMARSHAL_DATA: HRESULT = 0x8001000Cu32 as HRESULT; +pub const RPC_E_SERVER_CANTMARSHAL_DATA: HRESULT = 0x8001000Du32 as HRESULT; +pub const RPC_E_SERVER_CANTUNMARSHAL_DATA: HRESULT = 0x8001000Eu32 as HRESULT; +pub const RPC_E_INVALID_DATA: HRESULT = 0x8001000Fu32 as HRESULT; +pub const RPC_E_INVALID_PARAMETER: HRESULT = 0x80010010u32 as HRESULT; +pub const RPC_E_CANTCALLOUT_AGAIN: HRESULT = 0x80010011u32 as HRESULT; +pub const RPC_E_SERVER_DIED_DNE: HRESULT = 0x80010012u32 as HRESULT; +pub const RPC_E_SYS_CALL_FAILED: HRESULT = 0x80010100u32 as HRESULT; +pub const RPC_E_OUT_OF_RESOURCES: HRESULT = 0x80010101u32 as HRESULT; +pub const RPC_E_ATTEMPTED_MULTITHREAD: HRESULT = 0x80010102u32 as HRESULT; +pub const RPC_E_NOT_REGISTERED: HRESULT = 0x80010103u32 as HRESULT; +pub const RPC_E_FAULT: HRESULT = 0x80010104u32 as HRESULT; +pub const RPC_E_SERVERFAULT: HRESULT = 0x80010105u32 as HRESULT; +pub const RPC_E_CHANGED_MODE: HRESULT = 0x80010106u32 as HRESULT; +pub const RPC_E_INVALIDMETHOD: HRESULT = 0x80010107u32 as HRESULT; +pub const RPC_E_DISCONNECTED: HRESULT = 0x80010108u32 as HRESULT; +pub const RPC_E_RETRY: HRESULT = 0x80010109u32 as HRESULT; +pub const RPC_E_SERVERCALL_RETRYLATER: HRESULT = 0x8001010Au32 as HRESULT; +pub const RPC_E_SERVERCALL_REJECTED: HRESULT = 0x8001010Bu32 as HRESULT; +pub const RPC_E_INVALID_CALLDATA: HRESULT = 0x8001010Cu32 as HRESULT; +pub const RPC_E_CANTCALLOUT_ININPUTSYNCCALL: HRESULT = 0x8001010Du32 as HRESULT; +pub const RPC_E_WRONG_THREAD: HRESULT = 0x8001010Eu32 as HRESULT; +pub const RPC_E_THREAD_NOT_INIT: HRESULT = 0x8001010Fu32 as HRESULT; +pub const RPC_E_VERSION_MISMATCH: HRESULT = 0x80010110u32 as HRESULT; +pub const RPC_E_INVALID_HEADER: HRESULT = 0x80010111u32 as HRESULT; +pub const RPC_E_INVALID_EXTENSION: HRESULT = 0x80010112u32 as HRESULT; +pub const RPC_E_INVALID_IPID: HRESULT = 0x80010113u32 as HRESULT; +pub const RPC_E_INVALID_OBJECT: HRESULT = 0x80010114u32 as HRESULT; +pub const RPC_S_CALLPENDING: HRESULT = 0x80010115u32 as HRESULT; +pub const RPC_S_WAITONTIMER: HRESULT = 0x80010116u32 as HRESULT; +pub const RPC_E_CALL_COMPLETE: HRESULT = 0x80010117u32 as HRESULT; +pub const RPC_E_UNSECURE_CALL: HRESULT = 0x80010118u32 as HRESULT; +pub const RPC_E_TOO_LATE: HRESULT = 0x80010119u32 as HRESULT; +pub const RPC_E_NO_GOOD_SECURITY_PACKAGES: HRESULT = 0x8001011Au32 as HRESULT; +pub const RPC_E_ACCESS_DENIED: HRESULT = 0x8001011Bu32 as HRESULT; +pub const RPC_E_REMOTE_DISABLED: HRESULT = 0x8001011Cu32 as HRESULT; +pub const RPC_E_INVALID_OBJREF: HRESULT = 0x8001011Du32 as HRESULT; +pub const RPC_E_NO_CONTEXT: HRESULT = 0x8001011Eu32 as HRESULT; +pub const RPC_E_TIMEOUT: HRESULT = 0x8001011Fu32 as HRESULT; +pub const RPC_E_NO_SYNC: HRESULT = 0x80010120u32 as HRESULT; +pub const RPC_E_FULLSIC_REQUIRED: HRESULT = 0x80010121u32 as HRESULT; +pub const RPC_E_INVALID_STD_NAME: HRESULT = 0x80010122u32 as HRESULT; +pub const CO_E_FAILEDTOIMPERSONATE: HRESULT = 0x80010123u32 as HRESULT; +pub const CO_E_FAILEDTOGETSECCTX: HRESULT = 0x80010124u32 as HRESULT; +pub const CO_E_FAILEDTOOPENTHREADTOKEN: HRESULT = 0x80010125u32 as HRESULT; +pub const CO_E_FAILEDTOGETTOKENINFO: HRESULT = 0x80010126u32 as HRESULT; +pub const CO_E_TRUSTEEDOESNTMATCHCLIENT: HRESULT = 0x80010127u32 as HRESULT; +pub const CO_E_FAILEDTOQUERYCLIENTBLANKET: HRESULT = 0x80010128u32 as HRESULT; +pub const CO_E_FAILEDTOSETDACL: HRESULT = 0x80010129u32 as HRESULT; +pub const CO_E_ACCESSCHECKFAILED: HRESULT = 0x8001012Au32 as HRESULT; +pub const CO_E_NETACCESSAPIFAILED: HRESULT = 0x8001012Bu32 as HRESULT; +pub const CO_E_WRONGTRUSTEENAMESYNTAX: HRESULT = 0x8001012Cu32 as HRESULT; +pub const CO_E_INVALIDSID: HRESULT = 0x8001012Du32 as HRESULT; +pub const CO_E_CONVERSIONFAILED: HRESULT = 0x8001012Eu32 as HRESULT; +pub const CO_E_NOMATCHINGSIDFOUND: HRESULT = 0x8001012Fu32 as HRESULT; +pub const CO_E_LOOKUPACCSIDFAILED: HRESULT = 0x80010130u32 as HRESULT; +pub const CO_E_NOMATCHINGNAMEFOUND: HRESULT = 0x80010131u32 as HRESULT; +pub const CO_E_LOOKUPACCNAMEFAILED: HRESULT = 0x80010132u32 as HRESULT; +pub const CO_E_SETSERLHNDLFAILED: HRESULT = 0x80010133u32 as HRESULT; +pub const CO_E_FAILEDTOGETWINDIR: HRESULT = 0x80010134u32 as HRESULT; +pub const CO_E_PATHTOOLONG: HRESULT = 0x80010135u32 as HRESULT; +pub const CO_E_FAILEDTOGENUUID: HRESULT = 0x80010136u32 as HRESULT; +pub const CO_E_FAILEDTOCREATEFILE: HRESULT = 0x80010137u32 as HRESULT; +pub const CO_E_FAILEDTOCLOSEHANDLE: HRESULT = 0x80010138u32 as HRESULT; +pub const CO_E_EXCEEDSYSACLLIMIT: HRESULT = 0x80010139u32 as HRESULT; +pub const CO_E_ACESINWRONGORDER: HRESULT = 0x8001013Au32 as HRESULT; +pub const CO_E_INCOMPATIBLESTREAMVERSION: HRESULT = 0x8001013Bu32 as HRESULT; +pub const CO_E_FAILEDTOOPENPROCESSTOKEN: HRESULT = 0x8001013Cu32 as HRESULT; +pub const CO_E_DECODEFAILED: HRESULT = 0x8001013Du32 as HRESULT; +pub const CO_E_ACNOTINITIALIZED: HRESULT = 0x8001013Fu32 as HRESULT; +pub const CO_E_CANCEL_DISABLED: HRESULT = 0x80010140u32 as HRESULT; +pub const RPC_E_UNEXPECTED: HRESULT = 0x8001FFFFu32 as HRESULT; +pub const ERROR_AUDITING_DISABLED: HRESULT = 0xC0090001u32 as HRESULT; +pub const ERROR_ALL_SIDS_FILTERED: HRESULT = 0xC0090002u32 as HRESULT; +pub const ERROR_BIZRULES_NOT_ENABLED: HRESULT = 0xC0090003u32 as HRESULT; +pub const NTE_BAD_UID: HRESULT = 0x80090001u32 as HRESULT; +pub const NTE_BAD_HASH: HRESULT = 0x80090002u32 as HRESULT; +pub const NTE_BAD_KEY: HRESULT = 0x80090003u32 as HRESULT; +pub const NTE_BAD_LEN: HRESULT = 0x80090004u32 as HRESULT; +pub const NTE_BAD_DATA: HRESULT = 0x80090005u32 as HRESULT; +pub const NTE_BAD_SIGNATURE: HRESULT = 0x80090006u32 as HRESULT; +pub const NTE_BAD_VER: HRESULT = 0x80090007u32 as HRESULT; +pub const NTE_BAD_ALGID: HRESULT = 0x80090008u32 as HRESULT; +pub const NTE_BAD_FLAGS: HRESULT = 0x80090009u32 as HRESULT; +pub const NTE_BAD_TYPE: HRESULT = 0x8009000Au32 as HRESULT; +pub const NTE_BAD_KEY_STATE: HRESULT = 0x8009000Bu32 as HRESULT; +pub const NTE_BAD_HASH_STATE: HRESULT = 0x8009000Cu32 as HRESULT; +pub const NTE_NO_KEY: HRESULT = 0x8009000Du32 as HRESULT; +pub const NTE_NO_MEMORY: HRESULT = 0x8009000Eu32 as HRESULT; +pub const NTE_EXISTS: HRESULT = 0x8009000Fu32 as HRESULT; +pub const NTE_PERM: HRESULT = 0x80090010u32 as HRESULT; +pub const NTE_NOT_FOUND: HRESULT = 0x80090011u32 as HRESULT; +pub const NTE_DOUBLE_ENCRYPT: HRESULT = 0x80090012u32 as HRESULT; +pub const NTE_BAD_PROVIDER: HRESULT = 0x80090013u32 as HRESULT; +pub const NTE_BAD_PROV_TYPE: HRESULT = 0x80090014u32 as HRESULT; +pub const NTE_BAD_PUBLIC_KEY: HRESULT = 0x80090015u32 as HRESULT; +pub const NTE_BAD_KEYSET: HRESULT = 0x80090016u32 as HRESULT; +pub const NTE_PROV_TYPE_NOT_DEF: HRESULT = 0x80090017u32 as HRESULT; +pub const NTE_PROV_TYPE_ENTRY_BAD: HRESULT = 0x80090018u32 as HRESULT; +pub const NTE_KEYSET_NOT_DEF: HRESULT = 0x80090019u32 as HRESULT; +pub const NTE_KEYSET_ENTRY_BAD: HRESULT = 0x8009001Au32 as HRESULT; +pub const NTE_PROV_TYPE_NO_MATCH: HRESULT = 0x8009001Bu32 as HRESULT; +pub const NTE_SIGNATURE_FILE_BAD: HRESULT = 0x8009001Cu32 as HRESULT; +pub const NTE_PROVIDER_DLL_FAIL: HRESULT = 0x8009001Du32 as HRESULT; +pub const NTE_PROV_DLL_NOT_FOUND: HRESULT = 0x8009001Eu32 as HRESULT; +pub const NTE_BAD_KEYSET_PARAM: HRESULT = 0x8009001Fu32 as HRESULT; +pub const NTE_FAIL: HRESULT = 0x80090020u32 as HRESULT; +pub const NTE_SYS_ERR: HRESULT = 0x80090021u32 as HRESULT; +pub const NTE_SILENT_CONTEXT: HRESULT = 0x80090022u32 as HRESULT; +pub const NTE_TOKEN_KEYSET_STORAGE_FULL: HRESULT = 0x80090023u32 as HRESULT; +pub const NTE_TEMPORARY_PROFILE: HRESULT = 0x80090024u32 as HRESULT; +pub const NTE_FIXEDPARAMETER: HRESULT = 0x80090025u32 as HRESULT; +pub const NTE_INVALID_HANDLE: HRESULT = 0x80090026u32 as HRESULT; +pub const NTE_INVALID_PARAMETER: HRESULT = 0x80090027u32 as HRESULT; +pub const NTE_BUFFER_TOO_SMALL: HRESULT = 0x80090028u32 as HRESULT; +pub const NTE_NOT_SUPPORTED: HRESULT = 0x80090029u32 as HRESULT; +pub const NTE_NO_MORE_ITEMS: HRESULT = 0x8009002Au32 as HRESULT; +pub const NTE_BUFFERS_OVERLAP: HRESULT = 0x8009002Bu32 as HRESULT; +pub const NTE_DECRYPTION_FAILURE: HRESULT = 0x8009002Cu32 as HRESULT; +pub const NTE_INTERNAL_ERROR: HRESULT = 0x8009002Du32 as HRESULT; +pub const NTE_UI_REQUIRED: HRESULT = 0x8009002Eu32 as HRESULT; +pub const NTE_HMAC_NOT_SUPPORTED: HRESULT = 0x8009002Fu32 as HRESULT; +pub const NTE_DEVICE_NOT_READY: HRESULT = 0x80090030u32 as HRESULT; +pub const NTE_AUTHENTICATION_IGNORED: HRESULT = 0x80090031u32 as HRESULT; +pub const NTE_VALIDATION_FAILED: HRESULT = 0x80090032u32 as HRESULT; +pub const NTE_INCORRECT_PASSWORD: HRESULT = 0x80090033u32 as HRESULT; +pub const NTE_ENCRYPTION_FAILURE: HRESULT = 0x80090034u32 as HRESULT; +pub const NTE_DEVICE_NOT_FOUND: HRESULT = 0x80090035u32 as HRESULT; +pub const SEC_E_INSUFFICIENT_MEMORY: HRESULT = 0x80090300u32 as HRESULT; +pub const SEC_E_INVALID_HANDLE: HRESULT = 0x80090301u32 as HRESULT; +pub const SEC_E_UNSUPPORTED_FUNCTION: HRESULT = 0x80090302u32 as HRESULT; +pub const SEC_E_TARGET_UNKNOWN: HRESULT = 0x80090303u32 as HRESULT; +pub const SEC_E_INTERNAL_ERROR: HRESULT = 0x80090304u32 as HRESULT; +pub const SEC_E_SECPKG_NOT_FOUND: HRESULT = 0x80090305u32 as HRESULT; +pub const SEC_E_NOT_OWNER: HRESULT = 0x80090306u32 as HRESULT; +pub const SEC_E_CANNOT_INSTALL: HRESULT = 0x80090307u32 as HRESULT; +pub const SEC_E_INVALID_TOKEN: HRESULT = 0x80090308u32 as HRESULT; +pub const SEC_E_CANNOT_PACK: HRESULT = 0x80090309u32 as HRESULT; +pub const SEC_E_QOP_NOT_SUPPORTED: HRESULT = 0x8009030Au32 as HRESULT; +pub const SEC_E_NO_IMPERSONATION: HRESULT = 0x8009030Bu32 as HRESULT; +pub const SEC_E_LOGON_DENIED: HRESULT = 0x8009030Cu32 as HRESULT; +pub const SEC_E_UNKNOWN_CREDENTIALS: HRESULT = 0x8009030Du32 as HRESULT; +pub const SEC_E_NO_CREDENTIALS: HRESULT = 0x8009030Eu32 as HRESULT; +pub const SEC_E_MESSAGE_ALTERED: HRESULT = 0x8009030Fu32 as HRESULT; +pub const SEC_E_OUT_OF_SEQUENCE: HRESULT = 0x80090310u32 as HRESULT; +pub const SEC_E_NO_AUTHENTICATING_AUTHORITY: HRESULT = 0x80090311u32 as HRESULT; +pub const SEC_I_CONTINUE_NEEDED: HRESULT = 0x00090312; +pub const SEC_I_COMPLETE_NEEDED: HRESULT = 0x00090313; +pub const SEC_I_COMPLETE_AND_CONTINUE: HRESULT = 0x00090314; +pub const SEC_I_LOCAL_LOGON: HRESULT = 0x00090315; +pub const SEC_E_BAD_PKGID: HRESULT = 0x80090316u32 as HRESULT; +pub const SEC_E_CONTEXT_EXPIRED: HRESULT = 0x80090317u32 as HRESULT; +pub const SEC_I_CONTEXT_EXPIRED: HRESULT = 0x00090317; +pub const SEC_E_INCOMPLETE_MESSAGE: HRESULT = 0x80090318u32 as HRESULT; +pub const SEC_E_INCOMPLETE_CREDENTIALS: HRESULT = 0x80090320u32 as HRESULT; +pub const SEC_E_BUFFER_TOO_SMALL: HRESULT = 0x80090321u32 as HRESULT; +pub const SEC_I_INCOMPLETE_CREDENTIALS: HRESULT = 0x00090320; +pub const SEC_I_RENEGOTIATE: HRESULT = 0x00090321; +pub const SEC_E_WRONG_PRINCIPAL: HRESULT = 0x80090322u32 as HRESULT; +pub const SEC_I_NO_LSA_CONTEXT: HRESULT = 0x00090323; +pub const SEC_E_TIME_SKEW: HRESULT = 0x80090324u32 as HRESULT; +pub const SEC_E_UNTRUSTED_ROOT: HRESULT = 0x80090325u32 as HRESULT; +pub const SEC_E_ILLEGAL_MESSAGE: HRESULT = 0x80090326u32 as HRESULT; +pub const SEC_E_CERT_UNKNOWN: HRESULT = 0x80090327u32 as HRESULT; +pub const SEC_E_CERT_EXPIRED: HRESULT = 0x80090328u32 as HRESULT; +pub const SEC_E_ENCRYPT_FAILURE: HRESULT = 0x80090329u32 as HRESULT; +pub const SEC_E_DECRYPT_FAILURE: HRESULT = 0x80090330u32 as HRESULT; +pub const SEC_E_ALGORITHM_MISMATCH: HRESULT = 0x80090331u32 as HRESULT; +pub const SEC_E_SECURITY_QOS_FAILED: HRESULT = 0x80090332u32 as HRESULT; +pub const SEC_E_UNFINISHED_CONTEXT_DELETED: HRESULT = 0x80090333u32 as HRESULT; +pub const SEC_E_NO_TGT_REPLY: HRESULT = 0x80090334u32 as HRESULT; +pub const SEC_E_NO_IP_ADDRESSES: HRESULT = 0x80090335u32 as HRESULT; +pub const SEC_E_WRONG_CREDENTIAL_HANDLE: HRESULT = 0x80090336u32 as HRESULT; +pub const SEC_E_CRYPTO_SYSTEM_INVALID: HRESULT = 0x80090337u32 as HRESULT; +pub const SEC_E_MAX_REFERRALS_EXCEEDED: HRESULT = 0x80090338u32 as HRESULT; +pub const SEC_E_MUST_BE_KDC: HRESULT = 0x80090339u32 as HRESULT; +pub const SEC_E_STRONG_CRYPTO_NOT_SUPPORTED: HRESULT = 0x8009033Au32 as HRESULT; +pub const SEC_E_TOO_MANY_PRINCIPALS: HRESULT = 0x8009033Bu32 as HRESULT; +pub const SEC_E_NO_PA_DATA: HRESULT = 0x8009033Cu32 as HRESULT; +pub const SEC_E_PKINIT_NAME_MISMATCH: HRESULT = 0x8009033Du32 as HRESULT; +pub const SEC_E_SMARTCARD_LOGON_REQUIRED: HRESULT = 0x8009033Eu32 as HRESULT; +pub const SEC_E_SHUTDOWN_IN_PROGRESS: HRESULT = 0x8009033Fu32 as HRESULT; +pub const SEC_E_KDC_INVALID_REQUEST: HRESULT = 0x80090340u32 as HRESULT; +pub const SEC_E_KDC_UNABLE_TO_REFER: HRESULT = 0x80090341u32 as HRESULT; +pub const SEC_E_KDC_UNKNOWN_ETYPE: HRESULT = 0x80090342u32 as HRESULT; +pub const SEC_E_UNSUPPORTED_PREAUTH: HRESULT = 0x80090343u32 as HRESULT; +pub const SEC_E_DELEGATION_REQUIRED: HRESULT = 0x80090345u32 as HRESULT; +pub const SEC_E_BAD_BINDINGS: HRESULT = 0x80090346u32 as HRESULT; +pub const SEC_E_MULTIPLE_ACCOUNTS: HRESULT = 0x80090347u32 as HRESULT; +pub const SEC_E_NO_KERB_KEY: HRESULT = 0x80090348u32 as HRESULT; +pub const SEC_E_CERT_WRONG_USAGE: HRESULT = 0x80090349u32 as HRESULT; +pub const SEC_E_DOWNGRADE_DETECTED: HRESULT = 0x80090350u32 as HRESULT; +pub const SEC_E_SMARTCARD_CERT_REVOKED: HRESULT = 0x80090351u32 as HRESULT; +pub const SEC_E_ISSUING_CA_UNTRUSTED: HRESULT = 0x80090352u32 as HRESULT; +pub const SEC_E_REVOCATION_OFFLINE_C: HRESULT = 0x80090353u32 as HRESULT; +pub const SEC_E_PKINIT_CLIENT_FAILURE: HRESULT = 0x80090354u32 as HRESULT; +pub const SEC_E_SMARTCARD_CERT_EXPIRED: HRESULT = 0x80090355u32 as HRESULT; +pub const SEC_E_NO_S4U_PROT_SUPPORT: HRESULT = 0x80090356u32 as HRESULT; +pub const SEC_E_CROSSREALM_DELEGATION_FAILURE: HRESULT = 0x80090357u32 as HRESULT; +pub const SEC_E_REVOCATION_OFFLINE_KDC: HRESULT = 0x80090358u32 as HRESULT; +pub const SEC_E_ISSUING_CA_UNTRUSTED_KDC: HRESULT = 0x80090359u32 as HRESULT; +pub const SEC_E_KDC_CERT_EXPIRED: HRESULT = 0x8009035Au32 as HRESULT; +pub const SEC_E_KDC_CERT_REVOKED: HRESULT = 0x8009035Bu32 as HRESULT; +pub const SEC_I_SIGNATURE_NEEDED: HRESULT = 0x0009035C; +pub const SEC_E_INVALID_PARAMETER: HRESULT = 0x8009035Du32 as HRESULT; +pub const SEC_E_DELEGATION_POLICY: HRESULT = 0x8009035Eu32 as HRESULT; +pub const SEC_E_POLICY_NLTM_ONLY: HRESULT = 0x8009035Fu32 as HRESULT; +pub const SEC_I_NO_RENEGOTIATION: HRESULT = 0x00090360; +pub const SEC_E_NO_CONTEXT: HRESULT = 0x80090361u32 as HRESULT; +pub const SEC_E_PKU2U_CERT_FAILURE: HRESULT = 0x80090362u32 as HRESULT; +pub const SEC_E_MUTUAL_AUTH_FAILED: HRESULT = 0x80090363u32 as HRESULT; +pub const SEC_I_MESSAGE_FRAGMENT: HRESULT = 0x00090364; +pub const SEC_E_ONLY_HTTPS_ALLOWED: HRESULT = 0x80090365u32 as HRESULT; +pub const SEC_I_CONTINUE_NEEDED_MESSAGE_OK: HRESULT = 0x00090366; +pub const SEC_E_APPLICATION_PROTOCOL_MISMATCH: HRESULT = 0x80090367u32 as HRESULT; +pub const SEC_E_NO_SPM: HRESULT = SEC_E_INTERNAL_ERROR; +pub const SEC_E_NOT_SUPPORTED: HRESULT = SEC_E_UNSUPPORTED_FUNCTION; +pub const CRYPT_E_MSG_ERROR: HRESULT = 0x80091001u32 as HRESULT; +pub const CRYPT_E_UNKNOWN_ALGO: HRESULT = 0x80091002u32 as HRESULT; +pub const CRYPT_E_OID_FORMAT: HRESULT = 0x80091003u32 as HRESULT; +pub const CRYPT_E_INVALID_MSG_TYPE: HRESULT = 0x80091004u32 as HRESULT; +pub const CRYPT_E_UNEXPECTED_ENCODING: HRESULT = 0x80091005u32 as HRESULT; +pub const CRYPT_E_AUTH_ATTR_MISSING: HRESULT = 0x80091006u32 as HRESULT; +pub const CRYPT_E_HASH_VALUE: HRESULT = 0x80091007u32 as HRESULT; +pub const CRYPT_E_INVALID_INDEX: HRESULT = 0x80091008u32 as HRESULT; +pub const CRYPT_E_ALREADY_DECRYPTED: HRESULT = 0x80091009u32 as HRESULT; +pub const CRYPT_E_NOT_DECRYPTED: HRESULT = 0x8009100Au32 as HRESULT; +pub const CRYPT_E_RECIPIENT_NOT_FOUND: HRESULT = 0x8009100Bu32 as HRESULT; +pub const CRYPT_E_CONTROL_TYPE: HRESULT = 0x8009100Cu32 as HRESULT; +pub const CRYPT_E_ISSUER_SERIALNUMBER: HRESULT = 0x8009100Du32 as HRESULT; +pub const CRYPT_E_SIGNER_NOT_FOUND: HRESULT = 0x8009100Eu32 as HRESULT; +pub const CRYPT_E_ATTRIBUTES_MISSING: HRESULT = 0x8009100Fu32 as HRESULT; +pub const CRYPT_E_STREAM_MSG_NOT_READY: HRESULT = 0x80091010u32 as HRESULT; +pub const CRYPT_E_STREAM_INSUFFICIENT_DATA: HRESULT = 0x80091011u32 as HRESULT; +pub const CRYPT_I_NEW_PROTECTION_REQUIRED: HRESULT = 0x00091012; +pub const CRYPT_E_BAD_LEN: HRESULT = 0x80092001u32 as HRESULT; +pub const CRYPT_E_BAD_ENCODE: HRESULT = 0x80092002u32 as HRESULT; +pub const CRYPT_E_FILE_ERROR: HRESULT = 0x80092003u32 as HRESULT; +pub const CRYPT_E_NOT_FOUND: HRESULT = 0x80092004u32 as HRESULT; +pub const CRYPT_E_EXISTS: HRESULT = 0x80092005u32 as HRESULT; +pub const CRYPT_E_NO_PROVIDER: HRESULT = 0x80092006u32 as HRESULT; +pub const CRYPT_E_SELF_SIGNED: HRESULT = 0x80092007u32 as HRESULT; +pub const CRYPT_E_DELETED_PREV: HRESULT = 0x80092008u32 as HRESULT; +pub const CRYPT_E_NO_MATCH: HRESULT = 0x80092009u32 as HRESULT; +pub const CRYPT_E_UNEXPECTED_MSG_TYPE: HRESULT = 0x8009200Au32 as HRESULT; +pub const CRYPT_E_NO_KEY_PROPERTY: HRESULT = 0x8009200Bu32 as HRESULT; +pub const CRYPT_E_NO_DECRYPT_CERT: HRESULT = 0x8009200Cu32 as HRESULT; +pub const CRYPT_E_BAD_MSG: HRESULT = 0x8009200Du32 as HRESULT; +pub const CRYPT_E_NO_SIGNER: HRESULT = 0x8009200Eu32 as HRESULT; +pub const CRYPT_E_PENDING_CLOSE: HRESULT = 0x8009200Fu32 as HRESULT; +pub const CRYPT_E_REVOKED: HRESULT = 0x80092010u32 as HRESULT; +pub const CRYPT_E_NO_REVOCATION_DLL: HRESULT = 0x80092011u32 as HRESULT; +pub const CRYPT_E_NO_REVOCATION_CHECK: HRESULT = 0x80092012u32 as HRESULT; +pub const CRYPT_E_REVOCATION_OFFLINE: HRESULT = 0x80092013u32 as HRESULT; +pub const CRYPT_E_NOT_IN_REVOCATION_DATABASE: HRESULT = 0x80092014u32 as HRESULT; +pub const CRYPT_E_INVALID_NUMERIC_STRING: HRESULT = 0x80092020u32 as HRESULT; +pub const CRYPT_E_INVALID_PRINTABLE_STRING: HRESULT = 0x80092021u32 as HRESULT; +pub const CRYPT_E_INVALID_IA5_STRING: HRESULT = 0x80092022u32 as HRESULT; +pub const CRYPT_E_INVALID_X500_STRING: HRESULT = 0x80092023u32 as HRESULT; +pub const CRYPT_E_NOT_CHAR_STRING: HRESULT = 0x80092024u32 as HRESULT; +pub const CRYPT_E_FILERESIZED: HRESULT = 0x80092025u32 as HRESULT; +pub const CRYPT_E_SECURITY_SETTINGS: HRESULT = 0x80092026u32 as HRESULT; +pub const CRYPT_E_NO_VERIFY_USAGE_DLL: HRESULT = 0x80092027u32 as HRESULT; +pub const CRYPT_E_NO_VERIFY_USAGE_CHECK: HRESULT = 0x80092028u32 as HRESULT; +pub const CRYPT_E_VERIFY_USAGE_OFFLINE: HRESULT = 0x80092029u32 as HRESULT; +pub const CRYPT_E_NOT_IN_CTL: HRESULT = 0x8009202Au32 as HRESULT; +pub const CRYPT_E_NO_TRUSTED_SIGNER: HRESULT = 0x8009202Bu32 as HRESULT; +pub const CRYPT_E_MISSING_PUBKEY_PARA: HRESULT = 0x8009202Cu32 as HRESULT; +pub const CRYPT_E_OBJECT_LOCATOR_OBJECT_NOT_FOUND: HRESULT = 0x8009202Du32 as HRESULT; +pub const CRYPT_E_OSS_ERROR: HRESULT = 0x80093000u32 as HRESULT; +pub const OSS_MORE_BUF: HRESULT = 0x80093001u32 as HRESULT; +pub const OSS_NEGATIVE_UINTEGER: HRESULT = 0x80093002u32 as HRESULT; +pub const OSS_PDU_RANGE: HRESULT = 0x80093003u32 as HRESULT; +pub const OSS_MORE_INPUT: HRESULT = 0x80093004u32 as HRESULT; +pub const OSS_DATA_ERROR: HRESULT = 0x80093005u32 as HRESULT; +pub const OSS_BAD_ARG: HRESULT = 0x80093006u32 as HRESULT; +pub const OSS_BAD_VERSION: HRESULT = 0x80093007u32 as HRESULT; +pub const OSS_OUT_MEMORY: HRESULT = 0x80093008u32 as HRESULT; +pub const OSS_PDU_MISMATCH: HRESULT = 0x80093009u32 as HRESULT; +pub const OSS_LIMITED: HRESULT = 0x8009300Au32 as HRESULT; +pub const OSS_BAD_PTR: HRESULT = 0x8009300Bu32 as HRESULT; +pub const OSS_BAD_TIME: HRESULT = 0x8009300Cu32 as HRESULT; +pub const OSS_INDEFINITE_NOT_SUPPORTED: HRESULT = 0x8009300Du32 as HRESULT; +pub const OSS_MEM_ERROR: HRESULT = 0x8009300Eu32 as HRESULT; +pub const OSS_BAD_TABLE: HRESULT = 0x8009300Fu32 as HRESULT; +pub const OSS_TOO_LONG: HRESULT = 0x80093010u32 as HRESULT; +pub const OSS_CONSTRAINT_VIOLATED: HRESULT = 0x80093011u32 as HRESULT; +pub const OSS_FATAL_ERROR: HRESULT = 0x80093012u32 as HRESULT; +pub const OSS_ACCESS_SERIALIZATION_ERROR: HRESULT = 0x80093013u32 as HRESULT; +pub const OSS_NULL_TBL: HRESULT = 0x80093014u32 as HRESULT; +pub const OSS_NULL_FCN: HRESULT = 0x80093015u32 as HRESULT; +pub const OSS_BAD_ENCRULES: HRESULT = 0x80093016u32 as HRESULT; +pub const OSS_UNAVAIL_ENCRULES: HRESULT = 0x80093017u32 as HRESULT; +pub const OSS_CANT_OPEN_TRACE_WINDOW: HRESULT = 0x80093018u32 as HRESULT; +pub const OSS_UNIMPLEMENTED: HRESULT = 0x80093019u32 as HRESULT; +pub const OSS_OID_DLL_NOT_LINKED: HRESULT = 0x8009301Au32 as HRESULT; +pub const OSS_CANT_OPEN_TRACE_FILE: HRESULT = 0x8009301Bu32 as HRESULT; +pub const OSS_TRACE_FILE_ALREADY_OPEN: HRESULT = 0x8009301Cu32 as HRESULT; +pub const OSS_TABLE_MISMATCH: HRESULT = 0x8009301Du32 as HRESULT; +pub const OSS_TYPE_NOT_SUPPORTED: HRESULT = 0x8009301Eu32 as HRESULT; +pub const OSS_REAL_DLL_NOT_LINKED: HRESULT = 0x8009301Fu32 as HRESULT; +pub const OSS_REAL_CODE_NOT_LINKED: HRESULT = 0x80093020u32 as HRESULT; +pub const OSS_OUT_OF_RANGE: HRESULT = 0x80093021u32 as HRESULT; +pub const OSS_COPIER_DLL_NOT_LINKED: HRESULT = 0x80093022u32 as HRESULT; +pub const OSS_CONSTRAINT_DLL_NOT_LINKED: HRESULT = 0x80093023u32 as HRESULT; +pub const OSS_COMPARATOR_DLL_NOT_LINKED: HRESULT = 0x80093024u32 as HRESULT; +pub const OSS_COMPARATOR_CODE_NOT_LINKED: HRESULT = 0x80093025u32 as HRESULT; +pub const OSS_MEM_MGR_DLL_NOT_LINKED: HRESULT = 0x80093026u32 as HRESULT; +pub const OSS_PDV_DLL_NOT_LINKED: HRESULT = 0x80093027u32 as HRESULT; +pub const OSS_PDV_CODE_NOT_LINKED: HRESULT = 0x80093028u32 as HRESULT; +pub const OSS_API_DLL_NOT_LINKED: HRESULT = 0x80093029u32 as HRESULT; +pub const OSS_BERDER_DLL_NOT_LINKED: HRESULT = 0x8009302Au32 as HRESULT; +pub const OSS_PER_DLL_NOT_LINKED: HRESULT = 0x8009302Bu32 as HRESULT; +pub const OSS_OPEN_TYPE_ERROR: HRESULT = 0x8009302Cu32 as HRESULT; +pub const OSS_MUTEX_NOT_CREATED: HRESULT = 0x8009302Du32 as HRESULT; +pub const OSS_CANT_CLOSE_TRACE_FILE: HRESULT = 0x8009302Eu32 as HRESULT; +pub const CRYPT_E_ASN1_ERROR: HRESULT = 0x80093100u32 as HRESULT; +pub const CRYPT_E_ASN1_INTERNAL: HRESULT = 0x80093101u32 as HRESULT; +pub const CRYPT_E_ASN1_EOD: HRESULT = 0x80093102u32 as HRESULT; +pub const CRYPT_E_ASN1_CORRUPT: HRESULT = 0x80093103u32 as HRESULT; +pub const CRYPT_E_ASN1_LARGE: HRESULT = 0x80093104u32 as HRESULT; +pub const CRYPT_E_ASN1_CONSTRAINT: HRESULT = 0x80093105u32 as HRESULT; +pub const CRYPT_E_ASN1_MEMORY: HRESULT = 0x80093106u32 as HRESULT; +pub const CRYPT_E_ASN1_OVERFLOW: HRESULT = 0x80093107u32 as HRESULT; +pub const CRYPT_E_ASN1_BADPDU: HRESULT = 0x80093108u32 as HRESULT; +pub const CRYPT_E_ASN1_BADARGS: HRESULT = 0x80093109u32 as HRESULT; +pub const CRYPT_E_ASN1_BADREAL: HRESULT = 0x8009310Au32 as HRESULT; +pub const CRYPT_E_ASN1_BADTAG: HRESULT = 0x8009310Bu32 as HRESULT; +pub const CRYPT_E_ASN1_CHOICE: HRESULT = 0x8009310Cu32 as HRESULT; +pub const CRYPT_E_ASN1_RULE: HRESULT = 0x8009310Du32 as HRESULT; +pub const CRYPT_E_ASN1_UTF8: HRESULT = 0x8009310Eu32 as HRESULT; +pub const CRYPT_E_ASN1_PDU_TYPE: HRESULT = 0x80093133u32 as HRESULT; +pub const CRYPT_E_ASN1_NYI: HRESULT = 0x80093134u32 as HRESULT; +pub const CRYPT_E_ASN1_EXTENDED: HRESULT = 0x80093201u32 as HRESULT; +pub const CRYPT_E_ASN1_NOEOD: HRESULT = 0x80093202u32 as HRESULT; +pub const CERTSRV_E_BAD_REQUESTSUBJECT: HRESULT = 0x80094001u32 as HRESULT; +pub const CERTSRV_E_NO_REQUEST: HRESULT = 0x80094002u32 as HRESULT; +pub const CERTSRV_E_BAD_REQUESTSTATUS: HRESULT = 0x80094003u32 as HRESULT; +pub const CERTSRV_E_PROPERTY_EMPTY: HRESULT = 0x80094004u32 as HRESULT; +pub const CERTSRV_E_INVALID_CA_CERTIFICATE: HRESULT = 0x80094005u32 as HRESULT; +pub const CERTSRV_E_SERVER_SUSPENDED: HRESULT = 0x80094006u32 as HRESULT; +pub const CERTSRV_E_ENCODING_LENGTH: HRESULT = 0x80094007u32 as HRESULT; +pub const CERTSRV_E_ROLECONFLICT: HRESULT = 0x80094008u32 as HRESULT; +pub const CERTSRV_E_RESTRICTEDOFFICER: HRESULT = 0x80094009u32 as HRESULT; +pub const CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED: HRESULT = 0x8009400Au32 as HRESULT; +pub const CERTSRV_E_NO_VALID_KRA: HRESULT = 0x8009400Bu32 as HRESULT; +pub const CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL: HRESULT = 0x8009400Cu32 as HRESULT; +pub const CERTSRV_E_NO_CAADMIN_DEFINED: HRESULT = 0x8009400Du32 as HRESULT; +pub const CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE: HRESULT = 0x8009400Eu32 as HRESULT; +pub const CERTSRV_E_NO_DB_SESSIONS: HRESULT = 0x8009400Fu32 as HRESULT; +pub const CERTSRV_E_ALIGNMENT_FAULT: HRESULT = 0x80094010u32 as HRESULT; +pub const CERTSRV_E_ENROLL_DENIED: HRESULT = 0x80094011u32 as HRESULT; +pub const CERTSRV_E_TEMPLATE_DENIED: HRESULT = 0x80094012u32 as HRESULT; +pub const CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE: HRESULT = 0x80094013u32 as HRESULT; +pub const CERTSRV_E_ADMIN_DENIED_REQUEST: HRESULT = 0x80094014u32 as HRESULT; +pub const CERTSRV_E_NO_POLICY_SERVER: HRESULT = 0x80094015u32 as HRESULT; +pub const CERTSRV_E_WEAK_SIGNATURE_OR_KEY: HRESULT = 0x80094016u32 as HRESULT; +pub const CERTSRV_E_KEY_ATTESTATION_NOT_SUPPORTED: HRESULT = 0x80094017u32 as HRESULT; +pub const CERTSRV_E_ENCRYPTION_CERT_REQUIRED: HRESULT = 0x80094018u32 as HRESULT; +pub const CERTSRV_E_UNSUPPORTED_CERT_TYPE: HRESULT = 0x80094800u32 as HRESULT; +pub const CERTSRV_E_NO_CERT_TYPE: HRESULT = 0x80094801u32 as HRESULT; +pub const CERTSRV_E_TEMPLATE_CONFLICT: HRESULT = 0x80094802u32 as HRESULT; +pub const CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED: HRESULT = 0x80094803u32 as HRESULT; +pub const CERTSRV_E_ARCHIVED_KEY_REQUIRED: HRESULT = 0x80094804u32 as HRESULT; +pub const CERTSRV_E_SMIME_REQUIRED: HRESULT = 0x80094805u32 as HRESULT; +pub const CERTSRV_E_BAD_RENEWAL_SUBJECT: HRESULT = 0x80094806u32 as HRESULT; +pub const CERTSRV_E_BAD_TEMPLATE_VERSION: HRESULT = 0x80094807u32 as HRESULT; +pub const CERTSRV_E_TEMPLATE_POLICY_REQUIRED: HRESULT = 0x80094808u32 as HRESULT; +pub const CERTSRV_E_SIGNATURE_POLICY_REQUIRED: HRESULT = 0x80094809u32 as HRESULT; +pub const CERTSRV_E_SIGNATURE_COUNT: HRESULT = 0x8009480Au32 as HRESULT; +pub const CERTSRV_E_SIGNATURE_REJECTED: HRESULT = 0x8009480Bu32 as HRESULT; +pub const CERTSRV_E_ISSUANCE_POLICY_REQUIRED: HRESULT = 0x8009480Cu32 as HRESULT; +pub const CERTSRV_E_SUBJECT_UPN_REQUIRED: HRESULT = 0x8009480Du32 as HRESULT; +pub const CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED: HRESULT = 0x8009480Eu32 as HRESULT; +pub const CERTSRV_E_SUBJECT_DNS_REQUIRED: HRESULT = 0x8009480Fu32 as HRESULT; +pub const CERTSRV_E_ARCHIVED_KEY_UNEXPECTED: HRESULT = 0x80094810u32 as HRESULT; +pub const CERTSRV_E_KEY_LENGTH: HRESULT = 0x80094811u32 as HRESULT; +pub const CERTSRV_E_SUBJECT_EMAIL_REQUIRED: HRESULT = 0x80094812u32 as HRESULT; +pub const CERTSRV_E_UNKNOWN_CERT_TYPE: HRESULT = 0x80094813u32 as HRESULT; +pub const CERTSRV_E_CERT_TYPE_OVERLAP: HRESULT = 0x80094814u32 as HRESULT; +pub const CERTSRV_E_TOO_MANY_SIGNATURES: HRESULT = 0x80094815u32 as HRESULT; +pub const CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY: HRESULT = 0x80094816u32 as HRESULT; +pub const CERTSRV_E_INVALID_EK: HRESULT = 0x80094817u32 as HRESULT; +pub const CERTSRV_E_INVALID_IDBINDING: HRESULT = 0x80094818u32 as HRESULT; +pub const CERTSRV_E_INVALID_ATTESTATION: HRESULT = 0x80094819u32 as HRESULT; +pub const CERTSRV_E_KEY_ATTESTATION: HRESULT = 0x8009481Au32 as HRESULT; +pub const CERTSRV_E_CORRUPT_KEY_ATTESTATION: HRESULT = 0x8009481Bu32 as HRESULT; +pub const CERTSRV_E_EXPIRED_CHALLENGE: HRESULT = 0x8009481Cu32 as HRESULT; +pub const CERTSRV_E_INVALID_RESPONSE: HRESULT = 0x8009481Du32 as HRESULT; +pub const CERTSRV_E_INVALID_REQUESTID: HRESULT = 0x8009481Eu32 as HRESULT; +pub const XENROLL_E_KEY_NOT_EXPORTABLE: HRESULT = 0x80095000u32 as HRESULT; +pub const XENROLL_E_CANNOT_ADD_ROOT_CERT: HRESULT = 0x80095001u32 as HRESULT; +pub const XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND: HRESULT = 0x80095002u32 as HRESULT; +pub const XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH: HRESULT = 0x80095003u32 as HRESULT; +pub const XENROLL_E_RESPONSE_KA_HASH_MISMATCH: HRESULT = 0x80095004u32 as HRESULT; +pub const XENROLL_E_KEYSPEC_SMIME_MISMATCH: HRESULT = 0x80095005u32 as HRESULT; +pub const TRUST_E_SYSTEM_ERROR: HRESULT = 0x80096001u32 as HRESULT; +pub const TRUST_E_NO_SIGNER_CERT: HRESULT = 0x80096002u32 as HRESULT; +pub const TRUST_E_COUNTER_SIGNER: HRESULT = 0x80096003u32 as HRESULT; +pub const TRUST_E_CERT_SIGNATURE: HRESULT = 0x80096004u32 as HRESULT; +pub const TRUST_E_TIME_STAMP: HRESULT = 0x80096005u32 as HRESULT; +pub const TRUST_E_BAD_DIGEST: HRESULT = 0x80096010u32 as HRESULT; +pub const TRUST_E_BASIC_CONSTRAINTS: HRESULT = 0x80096019u32 as HRESULT; +pub const TRUST_E_FINANCIAL_CRITERIA: HRESULT = 0x8009601Eu32 as HRESULT; +pub const MSSIPOTF_E_OUTOFMEMRANGE: HRESULT = 0x80097001u32 as HRESULT; +pub const MSSIPOTF_E_CANTGETOBJECT: HRESULT = 0x80097002u32 as HRESULT; +pub const MSSIPOTF_E_NOHEADTABLE: HRESULT = 0x80097003u32 as HRESULT; +pub const MSSIPOTF_E_BAD_MAGICNUMBER: HRESULT = 0x80097004u32 as HRESULT; +pub const MSSIPOTF_E_BAD_OFFSET_TABLE: HRESULT = 0x80097005u32 as HRESULT; +pub const MSSIPOTF_E_TABLE_TAGORDER: HRESULT = 0x80097006u32 as HRESULT; +pub const MSSIPOTF_E_TABLE_LONGWORD: HRESULT = 0x80097007u32 as HRESULT; +pub const MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT: HRESULT = 0x80097008u32 as HRESULT; +pub const MSSIPOTF_E_TABLES_OVERLAP: HRESULT = 0x80097009u32 as HRESULT; +pub const MSSIPOTF_E_TABLE_PADBYTES: HRESULT = 0x8009700Au32 as HRESULT; +pub const MSSIPOTF_E_FILETOOSMALL: HRESULT = 0x8009700Bu32 as HRESULT; +pub const MSSIPOTF_E_TABLE_CHECKSUM: HRESULT = 0x8009700Cu32 as HRESULT; +pub const MSSIPOTF_E_FILE_CHECKSUM: HRESULT = 0x8009700Du32 as HRESULT; +pub const MSSIPOTF_E_FAILED_POLICY: HRESULT = 0x80097010u32 as HRESULT; +pub const MSSIPOTF_E_FAILED_HINTS_CHECK: HRESULT = 0x80097011u32 as HRESULT; +pub const MSSIPOTF_E_NOT_OPENTYPE: HRESULT = 0x80097012u32 as HRESULT; +pub const MSSIPOTF_E_FILE: HRESULT = 0x80097013u32 as HRESULT; +pub const MSSIPOTF_E_CRYPT: HRESULT = 0x80097014u32 as HRESULT; +pub const MSSIPOTF_E_BADVERSION: HRESULT = 0x80097015u32 as HRESULT; +pub const MSSIPOTF_E_DSIG_STRUCTURE: HRESULT = 0x80097016u32 as HRESULT; +pub const MSSIPOTF_E_PCONST_CHECK: HRESULT = 0x80097017u32 as HRESULT; +pub const MSSIPOTF_E_STRUCTURE: HRESULT = 0x80097018u32 as HRESULT; +pub const ERROR_CRED_REQUIRES_CONFIRMATION: HRESULT = 0x80097019u32 as HRESULT; +pub const NTE_OP_OK: HRESULT = 0; +pub const TRUST_E_PROVIDER_UNKNOWN: HRESULT = 0x800B0001u32 as HRESULT; +pub const TRUST_E_ACTION_UNKNOWN: HRESULT = 0x800B0002u32 as HRESULT; +pub const TRUST_E_SUBJECT_FORM_UNKNOWN: HRESULT = 0x800B0003u32 as HRESULT; +pub const TRUST_E_SUBJECT_NOT_TRUSTED: HRESULT = 0x800B0004u32 as HRESULT; +pub const DIGSIG_E_ENCODE: HRESULT = 0x800B0005u32 as HRESULT; +pub const DIGSIG_E_DECODE: HRESULT = 0x800B0006u32 as HRESULT; +pub const DIGSIG_E_EXTENSIBILITY: HRESULT = 0x800B0007u32 as HRESULT; +pub const DIGSIG_E_CRYPTO: HRESULT = 0x800B0008u32 as HRESULT; +pub const PERSIST_E_SIZEDEFINITE: HRESULT = 0x800B0009u32 as HRESULT; +pub const PERSIST_E_SIZEINDEFINITE: HRESULT = 0x800B000Au32 as HRESULT; +pub const PERSIST_E_NOTSELFSIZING: HRESULT = 0x800B000Bu32 as HRESULT; +pub const TRUST_E_NOSIGNATURE: HRESULT = 0x800B0100u32 as HRESULT; +pub const CERT_E_EXPIRED: HRESULT = 0x800B0101u32 as HRESULT; +pub const CERT_E_VALIDITYPERIODNESTING: HRESULT = 0x800B0102u32 as HRESULT; +pub const CERT_E_ROLE: HRESULT = 0x800B0103u32 as HRESULT; +pub const CERT_E_PATHLENCONST: HRESULT = 0x800B0104u32 as HRESULT; +pub const CERT_E_CRITICAL: HRESULT = 0x800B0105u32 as HRESULT; +pub const CERT_E_PURPOSE: HRESULT = 0x800B0106u32 as HRESULT; +pub const CERT_E_ISSUERCHAINING: HRESULT = 0x800B0107u32 as HRESULT; +pub const CERT_E_MALFORMED: HRESULT = 0x800B0108u32 as HRESULT; +pub const CERT_E_UNTRUSTEDROOT: HRESULT = 0x800B0109u32 as HRESULT; +pub const CERT_E_CHAINING: HRESULT = 0x800B010Au32 as HRESULT; +pub const TRUST_E_FAIL: HRESULT = 0x800B010Bu32 as HRESULT; +pub const CERT_E_REVOKED: HRESULT = 0x800B010Cu32 as HRESULT; +pub const CERT_E_UNTRUSTEDTESTROOT: HRESULT = 0x800B010Du32 as HRESULT; +pub const CERT_E_REVOCATION_FAILURE: HRESULT = 0x800B010Eu32 as HRESULT; +pub const CERT_E_CN_NO_MATCH: HRESULT = 0x800B010Fu32 as HRESULT; +pub const CERT_E_WRONG_USAGE: HRESULT = 0x800B0110u32 as HRESULT; +pub const TRUST_E_EXPLICIT_DISTRUST: HRESULT = 0x800B0111u32 as HRESULT; +pub const CERT_E_UNTRUSTEDCA: HRESULT = 0x800B0112u32 as HRESULT; +pub const CERT_E_INVALID_POLICY: HRESULT = 0x800B0113u32 as HRESULT; +pub const CERT_E_INVALID_NAME: HRESULT = 0x800B0114u32 as HRESULT; +pub const SPAPI_E_EXPECTED_SECTION_NAME: HRESULT = 0x800F0000u32 as HRESULT; +pub const SPAPI_E_BAD_SECTION_NAME_LINE: HRESULT = 0x800F0001u32 as HRESULT; +pub const SPAPI_E_SECTION_NAME_TOO_LONG: HRESULT = 0x800F0002u32 as HRESULT; +pub const SPAPI_E_GENERAL_SYNTAX: HRESULT = 0x800F0003u32 as HRESULT; +pub const SPAPI_E_WRONG_INF_STYLE: HRESULT = 0x800F0100u32 as HRESULT; +pub const SPAPI_E_SECTION_NOT_FOUND: HRESULT = 0x800F0101u32 as HRESULT; +pub const SPAPI_E_LINE_NOT_FOUND: HRESULT = 0x800F0102u32 as HRESULT; +pub const SPAPI_E_NO_BACKUP: HRESULT = 0x800F0103u32 as HRESULT; +pub const SPAPI_E_NO_ASSOCIATED_CLASS: HRESULT = 0x800F0200u32 as HRESULT; +pub const SPAPI_E_CLASS_MISMATCH: HRESULT = 0x800F0201u32 as HRESULT; +pub const SPAPI_E_DUPLICATE_FOUND: HRESULT = 0x800F0202u32 as HRESULT; +pub const SPAPI_E_NO_DRIVER_SELECTED: HRESULT = 0x800F0203u32 as HRESULT; +pub const SPAPI_E_KEY_DOES_NOT_EXIST: HRESULT = 0x800F0204u32 as HRESULT; +pub const SPAPI_E_INVALID_DEVINST_NAME: HRESULT = 0x800F0205u32 as HRESULT; +pub const SPAPI_E_INVALID_CLASS: HRESULT = 0x800F0206u32 as HRESULT; +pub const SPAPI_E_DEVINST_ALREADY_EXISTS: HRESULT = 0x800F0207u32 as HRESULT; +pub const SPAPI_E_DEVINFO_NOT_REGISTERED: HRESULT = 0x800F0208u32 as HRESULT; +pub const SPAPI_E_INVALID_REG_PROPERTY: HRESULT = 0x800F0209u32 as HRESULT; +pub const SPAPI_E_NO_INF: HRESULT = 0x800F020Au32 as HRESULT; +pub const SPAPI_E_NO_SUCH_DEVINST: HRESULT = 0x800F020Bu32 as HRESULT; +pub const SPAPI_E_CANT_LOAD_CLASS_ICON: HRESULT = 0x800F020Cu32 as HRESULT; +pub const SPAPI_E_INVALID_CLASS_INSTALLER: HRESULT = 0x800F020Du32 as HRESULT; +pub const SPAPI_E_DI_DO_DEFAULT: HRESULT = 0x800F020Eu32 as HRESULT; +pub const SPAPI_E_DI_NOFILECOPY: HRESULT = 0x800F020Fu32 as HRESULT; +pub const SPAPI_E_INVALID_HWPROFILE: HRESULT = 0x800F0210u32 as HRESULT; +pub const SPAPI_E_NO_DEVICE_SELECTED: HRESULT = 0x800F0211u32 as HRESULT; +pub const SPAPI_E_DEVINFO_LIST_LOCKED: HRESULT = 0x800F0212u32 as HRESULT; +pub const SPAPI_E_DEVINFO_DATA_LOCKED: HRESULT = 0x800F0213u32 as HRESULT; +pub const SPAPI_E_DI_BAD_PATH: HRESULT = 0x800F0214u32 as HRESULT; +pub const SPAPI_E_NO_CLASSINSTALL_PARAMS: HRESULT = 0x800F0215u32 as HRESULT; +pub const SPAPI_E_FILEQUEUE_LOCKED: HRESULT = 0x800F0216u32 as HRESULT; +pub const SPAPI_E_BAD_SERVICE_INSTALLSECT: HRESULT = 0x800F0217u32 as HRESULT; +pub const SPAPI_E_NO_CLASS_DRIVER_LIST: HRESULT = 0x800F0218u32 as HRESULT; +pub const SPAPI_E_NO_ASSOCIATED_SERVICE: HRESULT = 0x800F0219u32 as HRESULT; +pub const SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE: HRESULT = 0x800F021Au32 as HRESULT; +pub const SPAPI_E_DEVICE_INTERFACE_ACTIVE: HRESULT = 0x800F021Bu32 as HRESULT; +pub const SPAPI_E_DEVICE_INTERFACE_REMOVED: HRESULT = 0x800F021Cu32 as HRESULT; +pub const SPAPI_E_BAD_INTERFACE_INSTALLSECT: HRESULT = 0x800F021Du32 as HRESULT; +pub const SPAPI_E_NO_SUCH_INTERFACE_CLASS: HRESULT = 0x800F021Eu32 as HRESULT; +pub const SPAPI_E_INVALID_REFERENCE_STRING: HRESULT = 0x800F021Fu32 as HRESULT; +pub const SPAPI_E_INVALID_MACHINENAME: HRESULT = 0x800F0220u32 as HRESULT; +pub const SPAPI_E_REMOTE_COMM_FAILURE: HRESULT = 0x800F0221u32 as HRESULT; +pub const SPAPI_E_MACHINE_UNAVAILABLE: HRESULT = 0x800F0222u32 as HRESULT; +pub const SPAPI_E_NO_CONFIGMGR_SERVICES: HRESULT = 0x800F0223u32 as HRESULT; +pub const SPAPI_E_INVALID_PROPPAGE_PROVIDER: HRESULT = 0x800F0224u32 as HRESULT; +pub const SPAPI_E_NO_SUCH_DEVICE_INTERFACE: HRESULT = 0x800F0225u32 as HRESULT; +pub const SPAPI_E_DI_POSTPROCESSING_REQUIRED: HRESULT = 0x800F0226u32 as HRESULT; +pub const SPAPI_E_INVALID_COINSTALLER: HRESULT = 0x800F0227u32 as HRESULT; +pub const SPAPI_E_NO_COMPAT_DRIVERS: HRESULT = 0x800F0228u32 as HRESULT; +pub const SPAPI_E_NO_DEVICE_ICON: HRESULT = 0x800F0229u32 as HRESULT; +pub const SPAPI_E_INVALID_INF_LOGCONFIG: HRESULT = 0x800F022Au32 as HRESULT; +pub const SPAPI_E_DI_DONT_INSTALL: HRESULT = 0x800F022Bu32 as HRESULT; +pub const SPAPI_E_INVALID_FILTER_DRIVER: HRESULT = 0x800F022Cu32 as HRESULT; +pub const SPAPI_E_NON_WINDOWS_NT_DRIVER: HRESULT = 0x800F022Du32 as HRESULT; +pub const SPAPI_E_NON_WINDOWS_DRIVER: HRESULT = 0x800F022Eu32 as HRESULT; +pub const SPAPI_E_NO_CATALOG_FOR_OEM_INF: HRESULT = 0x800F022Fu32 as HRESULT; +pub const SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE: HRESULT = 0x800F0230u32 as HRESULT; +pub const SPAPI_E_NOT_DISABLEABLE: HRESULT = 0x800F0231u32 as HRESULT; +pub const SPAPI_E_CANT_REMOVE_DEVINST: HRESULT = 0x800F0232u32 as HRESULT; +pub const SPAPI_E_INVALID_TARGET: HRESULT = 0x800F0233u32 as HRESULT; +pub const SPAPI_E_DRIVER_NONNATIVE: HRESULT = 0x800F0234u32 as HRESULT; +pub const SPAPI_E_IN_WOW64: HRESULT = 0x800F0235u32 as HRESULT; +pub const SPAPI_E_SET_SYSTEM_RESTORE_POINT: HRESULT = 0x800F0236u32 as HRESULT; +pub const SPAPI_E_INCORRECTLY_COPIED_INF: HRESULT = 0x800F0237u32 as HRESULT; +pub const SPAPI_E_SCE_DISABLED: HRESULT = 0x800F0238u32 as HRESULT; +pub const SPAPI_E_UNKNOWN_EXCEPTION: HRESULT = 0x800F0239u32 as HRESULT; +pub const SPAPI_E_PNP_REGISTRY_ERROR: HRESULT = 0x800F023Au32 as HRESULT; +pub const SPAPI_E_REMOTE_REQUEST_UNSUPPORTED: HRESULT = 0x800F023Bu32 as HRESULT; +pub const SPAPI_E_NOT_AN_INSTALLED_OEM_INF: HRESULT = 0x800F023Cu32 as HRESULT; +pub const SPAPI_E_INF_IN_USE_BY_DEVICES: HRESULT = 0x800F023Du32 as HRESULT; +pub const SPAPI_E_DI_FUNCTION_OBSOLETE: HRESULT = 0x800F023Eu32 as HRESULT; +pub const SPAPI_E_NO_AUTHENTICODE_CATALOG: HRESULT = 0x800F023Fu32 as HRESULT; +pub const SPAPI_E_AUTHENTICODE_DISALLOWED: HRESULT = 0x800F0240u32 as HRESULT; +pub const SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER: HRESULT = 0x800F0241u32 as HRESULT; +pub const SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED: HRESULT = 0x800F0242u32 as HRESULT; +pub const SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED: HRESULT = 0x800F0243u32 as HRESULT; +pub const SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH: HRESULT = 0x800F0244u32 as HRESULT; +pub const SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE: HRESULT = 0x800F0245u32 as HRESULT; +pub const SPAPI_E_DEVICE_INSTALLER_NOT_READY: HRESULT = 0x800F0246u32 as HRESULT; +pub const SPAPI_E_DRIVER_STORE_ADD_FAILED: HRESULT = 0x800F0247u32 as HRESULT; +pub const SPAPI_E_DEVICE_INSTALL_BLOCKED: HRESULT = 0x800F0248u32 as HRESULT; +pub const SPAPI_E_DRIVER_INSTALL_BLOCKED: HRESULT = 0x800F0249u32 as HRESULT; +pub const SPAPI_E_WRONG_INF_TYPE: HRESULT = 0x800F024Au32 as HRESULT; +pub const SPAPI_E_FILE_HASH_NOT_IN_CATALOG: HRESULT = 0x800F024Bu32 as HRESULT; +pub const SPAPI_E_DRIVER_STORE_DELETE_FAILED: HRESULT = 0x800F024Cu32 as HRESULT; +pub const SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW: HRESULT = 0x800F0300u32 as HRESULT; +pub const SPAPI_E_ERROR_NOT_INSTALLED: HRESULT = 0x800F1000u32 as HRESULT; +pub const SCARD_S_SUCCESS: HRESULT = NO_ERROR as HRESULT; +pub const SCARD_F_INTERNAL_ERROR: HRESULT = 0x80100001u32 as HRESULT; +pub const SCARD_E_CANCELLED: HRESULT = 0x80100002u32 as HRESULT; +pub const SCARD_E_INVALID_HANDLE: HRESULT = 0x80100003u32 as HRESULT; +pub const SCARD_E_INVALID_PARAMETER: HRESULT = 0x80100004u32 as HRESULT; +pub const SCARD_E_INVALID_TARGET: HRESULT = 0x80100005u32 as HRESULT; +pub const SCARD_E_NO_MEMORY: HRESULT = 0x80100006u32 as HRESULT; +pub const SCARD_F_WAITED_TOO_LONG: HRESULT = 0x80100007u32 as HRESULT; +pub const SCARD_E_INSUFFICIENT_BUFFER: HRESULT = 0x80100008u32 as HRESULT; +pub const SCARD_E_UNKNOWN_READER: HRESULT = 0x80100009u32 as HRESULT; +pub const SCARD_E_TIMEOUT: HRESULT = 0x8010000Au32 as HRESULT; +pub const SCARD_E_SHARING_VIOLATION: HRESULT = 0x8010000Bu32 as HRESULT; +pub const SCARD_E_NO_SMARTCARD: HRESULT = 0x8010000Cu32 as HRESULT; +pub const SCARD_E_UNKNOWN_CARD: HRESULT = 0x8010000Du32 as HRESULT; +pub const SCARD_E_CANT_DISPOSE: HRESULT = 0x8010000Eu32 as HRESULT; +pub const SCARD_E_PROTO_MISMATCH: HRESULT = 0x8010000Fu32 as HRESULT; +pub const SCARD_E_NOT_READY: HRESULT = 0x80100010u32 as HRESULT; +pub const SCARD_E_INVALID_VALUE: HRESULT = 0x80100011u32 as HRESULT; +pub const SCARD_E_SYSTEM_CANCELLED: HRESULT = 0x80100012u32 as HRESULT; +pub const SCARD_F_COMM_ERROR: HRESULT = 0x80100013u32 as HRESULT; +pub const SCARD_F_UNKNOWN_ERROR: HRESULT = 0x80100014u32 as HRESULT; +pub const SCARD_E_INVALID_ATR: HRESULT = 0x80100015u32 as HRESULT; +pub const SCARD_E_NOT_TRANSACTED: HRESULT = 0x80100016u32 as HRESULT; +pub const SCARD_E_READER_UNAVAILABLE: HRESULT = 0x80100017u32 as HRESULT; +pub const SCARD_P_SHUTDOWN: HRESULT = 0x80100018u32 as HRESULT; +pub const SCARD_E_PCI_TOO_SMALL: HRESULT = 0x80100019u32 as HRESULT; +pub const SCARD_E_READER_UNSUPPORTED: HRESULT = 0x8010001Au32 as HRESULT; +pub const SCARD_E_DUPLICATE_READER: HRESULT = 0x8010001Bu32 as HRESULT; +pub const SCARD_E_CARD_UNSUPPORTED: HRESULT = 0x8010001Cu32 as HRESULT; +pub const SCARD_E_NO_SERVICE: HRESULT = 0x8010001Du32 as HRESULT; +pub const SCARD_E_SERVICE_STOPPED: HRESULT = 0x8010001Eu32 as HRESULT; +pub const SCARD_E_UNEXPECTED: HRESULT = 0x8010001Fu32 as HRESULT; +pub const SCARD_E_ICC_INSTALLATION: HRESULT = 0x80100020u32 as HRESULT; +pub const SCARD_E_ICC_CREATEORDER: HRESULT = 0x80100021u32 as HRESULT; +pub const SCARD_E_UNSUPPORTED_FEATURE: HRESULT = 0x80100022u32 as HRESULT; +pub const SCARD_E_DIR_NOT_FOUND: HRESULT = 0x80100023u32 as HRESULT; +pub const SCARD_E_FILE_NOT_FOUND: HRESULT = 0x80100024u32 as HRESULT; +pub const SCARD_E_NO_DIR: HRESULT = 0x80100025u32 as HRESULT; +pub const SCARD_E_NO_FILE: HRESULT = 0x80100026u32 as HRESULT; +pub const SCARD_E_NO_ACCESS: HRESULT = 0x80100027u32 as HRESULT; +pub const SCARD_E_WRITE_TOO_MANY: HRESULT = 0x80100028u32 as HRESULT; +pub const SCARD_E_BAD_SEEK: HRESULT = 0x80100029u32 as HRESULT; +pub const SCARD_E_INVALID_CHV: HRESULT = 0x8010002Au32 as HRESULT; +pub const SCARD_E_UNKNOWN_RES_MNG: HRESULT = 0x8010002Bu32 as HRESULT; +pub const SCARD_E_NO_SUCH_CERTIFICATE: HRESULT = 0x8010002Cu32 as HRESULT; +pub const SCARD_E_CERTIFICATE_UNAVAILABLE: HRESULT = 0x8010002Du32 as HRESULT; +pub const SCARD_E_NO_READERS_AVAILABLE: HRESULT = 0x8010002Eu32 as HRESULT; +pub const SCARD_E_COMM_DATA_LOST: HRESULT = 0x8010002Fu32 as HRESULT; +pub const SCARD_E_NO_KEY_CONTAINER: HRESULT = 0x80100030u32 as HRESULT; +pub const SCARD_E_SERVER_TOO_BUSY: HRESULT = 0x80100031u32 as HRESULT; +pub const SCARD_E_PIN_CACHE_EXPIRED: HRESULT = 0x80100032u32 as HRESULT; +pub const SCARD_E_NO_PIN_CACHE: HRESULT = 0x80100033u32 as HRESULT; +pub const SCARD_E_READ_ONLY_CARD: HRESULT = 0x80100034u32 as HRESULT; +pub const SCARD_W_UNSUPPORTED_CARD: HRESULT = 0x80100065u32 as HRESULT; +pub const SCARD_W_UNRESPONSIVE_CARD: HRESULT = 0x80100066u32 as HRESULT; +pub const SCARD_W_UNPOWERED_CARD: HRESULT = 0x80100067u32 as HRESULT; +pub const SCARD_W_RESET_CARD: HRESULT = 0x80100068u32 as HRESULT; +pub const SCARD_W_REMOVED_CARD: HRESULT = 0x80100069u32 as HRESULT; +pub const SCARD_W_SECURITY_VIOLATION: HRESULT = 0x8010006Au32 as HRESULT; +pub const SCARD_W_WRONG_CHV: HRESULT = 0x8010006Bu32 as HRESULT; +pub const SCARD_W_CHV_BLOCKED: HRESULT = 0x8010006Cu32 as HRESULT; +pub const SCARD_W_EOF: HRESULT = 0x8010006Du32 as HRESULT; +pub const SCARD_W_CANCELLED_BY_USER: HRESULT = 0x8010006Eu32 as HRESULT; +pub const SCARD_W_CARD_NOT_AUTHENTICATED: HRESULT = 0x8010006Fu32 as HRESULT; +pub const SCARD_W_CACHE_ITEM_NOT_FOUND: HRESULT = 0x80100070u32 as HRESULT; +pub const SCARD_W_CACHE_ITEM_STALE: HRESULT = 0x80100071u32 as HRESULT; +pub const SCARD_W_CACHE_ITEM_TOO_BIG: HRESULT = 0x80100072u32 as HRESULT; +pub const COMADMIN_E_OBJECTERRORS: HRESULT = 0x80110401u32 as HRESULT; +pub const COMADMIN_E_OBJECTINVALID: HRESULT = 0x80110402u32 as HRESULT; +pub const COMADMIN_E_KEYMISSING: HRESULT = 0x80110403u32 as HRESULT; +pub const COMADMIN_E_ALREADYINSTALLED: HRESULT = 0x80110404u32 as HRESULT; +pub const COMADMIN_E_APP_FILE_WRITEFAIL: HRESULT = 0x80110407u32 as HRESULT; +pub const COMADMIN_E_APP_FILE_READFAIL: HRESULT = 0x80110408u32 as HRESULT; +pub const COMADMIN_E_APP_FILE_VERSION: HRESULT = 0x80110409u32 as HRESULT; +pub const COMADMIN_E_BADPATH: HRESULT = 0x8011040Au32 as HRESULT; +pub const COMADMIN_E_APPLICATIONEXISTS: HRESULT = 0x8011040Bu32 as HRESULT; +pub const COMADMIN_E_ROLEEXISTS: HRESULT = 0x8011040Cu32 as HRESULT; +pub const COMADMIN_E_CANTCOPYFILE: HRESULT = 0x8011040Du32 as HRESULT; +pub const COMADMIN_E_NOUSER: HRESULT = 0x8011040Fu32 as HRESULT; +pub const COMADMIN_E_INVALIDUSERIDS: HRESULT = 0x80110410u32 as HRESULT; +pub const COMADMIN_E_NOREGISTRYCLSID: HRESULT = 0x80110411u32 as HRESULT; +pub const COMADMIN_E_BADREGISTRYPROGID: HRESULT = 0x80110412u32 as HRESULT; +pub const COMADMIN_E_AUTHENTICATIONLEVEL: HRESULT = 0x80110413u32 as HRESULT; +pub const COMADMIN_E_USERPASSWDNOTVALID: HRESULT = 0x80110414u32 as HRESULT; +pub const COMADMIN_E_CLSIDORIIDMISMATCH: HRESULT = 0x80110418u32 as HRESULT; +pub const COMADMIN_E_REMOTEINTERFACE: HRESULT = 0x80110419u32 as HRESULT; +pub const COMADMIN_E_DLLREGISTERSERVER: HRESULT = 0x8011041Au32 as HRESULT; +pub const COMADMIN_E_NOSERVERSHARE: HRESULT = 0x8011041Bu32 as HRESULT; +pub const COMADMIN_E_DLLLOADFAILED: HRESULT = 0x8011041Du32 as HRESULT; +pub const COMADMIN_E_BADREGISTRYLIBID: HRESULT = 0x8011041Eu32 as HRESULT; +pub const COMADMIN_E_APPDIRNOTFOUND: HRESULT = 0x8011041Fu32 as HRESULT; +pub const COMADMIN_E_REGISTRARFAILED: HRESULT = 0x80110423u32 as HRESULT; +pub const COMADMIN_E_COMPFILE_DOESNOTEXIST: HRESULT = 0x80110424u32 as HRESULT; +pub const COMADMIN_E_COMPFILE_LOADDLLFAIL: HRESULT = 0x80110425u32 as HRESULT; +pub const COMADMIN_E_COMPFILE_GETCLASSOBJ: HRESULT = 0x80110426u32 as HRESULT; +pub const COMADMIN_E_COMPFILE_CLASSNOTAVAIL: HRESULT = 0x80110427u32 as HRESULT; +pub const COMADMIN_E_COMPFILE_BADTLB: HRESULT = 0x80110428u32 as HRESULT; +pub const COMADMIN_E_COMPFILE_NOTINSTALLABLE: HRESULT = 0x80110429u32 as HRESULT; +pub const COMADMIN_E_NOTCHANGEABLE: HRESULT = 0x8011042Au32 as HRESULT; +pub const COMADMIN_E_NOTDELETEABLE: HRESULT = 0x8011042Bu32 as HRESULT; +pub const COMADMIN_E_SESSION: HRESULT = 0x8011042Cu32 as HRESULT; +pub const COMADMIN_E_COMP_MOVE_LOCKED: HRESULT = 0x8011042Du32 as HRESULT; +pub const COMADMIN_E_COMP_MOVE_BAD_DEST: HRESULT = 0x8011042Eu32 as HRESULT; +pub const COMADMIN_E_REGISTERTLB: HRESULT = 0x80110430u32 as HRESULT; +pub const COMADMIN_E_SYSTEMAPP: HRESULT = 0x80110433u32 as HRESULT; +pub const COMADMIN_E_COMPFILE_NOREGISTRAR: HRESULT = 0x80110434u32 as HRESULT; +pub const COMADMIN_E_COREQCOMPINSTALLED: HRESULT = 0x80110435u32 as HRESULT; +pub const COMADMIN_E_SERVICENOTINSTALLED: HRESULT = 0x80110436u32 as HRESULT; +pub const COMADMIN_E_PROPERTYSAVEFAILED: HRESULT = 0x80110437u32 as HRESULT; +pub const COMADMIN_E_OBJECTEXISTS: HRESULT = 0x80110438u32 as HRESULT; +pub const COMADMIN_E_COMPONENTEXISTS: HRESULT = 0x80110439u32 as HRESULT; +pub const COMADMIN_E_REGFILE_CORRUPT: HRESULT = 0x8011043Bu32 as HRESULT; +pub const COMADMIN_E_PROPERTY_OVERFLOW: HRESULT = 0x8011043Cu32 as HRESULT; +pub const COMADMIN_E_NOTINREGISTRY: HRESULT = 0x8011043Eu32 as HRESULT; +pub const COMADMIN_E_OBJECTNOTPOOLABLE: HRESULT = 0x8011043Fu32 as HRESULT; +pub const COMADMIN_E_APPLID_MATCHES_CLSID: HRESULT = 0x80110446u32 as HRESULT; +pub const COMADMIN_E_ROLE_DOES_NOT_EXIST: HRESULT = 0x80110447u32 as HRESULT; +pub const COMADMIN_E_START_APP_NEEDS_COMPONENTS: HRESULT = 0x80110448u32 as HRESULT; +pub const COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM: HRESULT = 0x80110449u32 as HRESULT; +pub const COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY: HRESULT = 0x8011044Au32 as HRESULT; +pub const COMADMIN_E_CAN_NOT_START_APP: HRESULT = 0x8011044Bu32 as HRESULT; +pub const COMADMIN_E_CAN_NOT_EXPORT_SYS_APP: HRESULT = 0x8011044Cu32 as HRESULT; +pub const COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT: HRESULT = 0x8011044Du32 as HRESULT; +pub const COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER: HRESULT = 0x8011044Eu32 as HRESULT; +pub const COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE: HRESULT = 0x8011044Fu32 as HRESULT; +pub const COMADMIN_E_BASE_PARTITION_ONLY: HRESULT = 0x80110450u32 as HRESULT; +pub const COMADMIN_E_START_APP_DISABLED: HRESULT = 0x80110451u32 as HRESULT; +pub const COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME: HRESULT = 0x80110457u32 as HRESULT; +pub const COMADMIN_E_CAT_INVALID_PARTITION_NAME: HRESULT = 0x80110458u32 as HRESULT; +pub const COMADMIN_E_CAT_PARTITION_IN_USE: HRESULT = 0x80110459u32 as HRESULT; +pub const COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES: HRESULT = 0x8011045Au32 as HRESULT; +pub const COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED: HRESULT = 0x8011045Bu32 as HRESULT; +pub const COMADMIN_E_AMBIGUOUS_APPLICATION_NAME: HRESULT = 0x8011045Cu32 as HRESULT; +pub const COMADMIN_E_AMBIGUOUS_PARTITION_NAME: HRESULT = 0x8011045Du32 as HRESULT; +pub const COMADMIN_E_REGDB_NOTINITIALIZED: HRESULT = 0x80110472u32 as HRESULT; +pub const COMADMIN_E_REGDB_NOTOPEN: HRESULT = 0x80110473u32 as HRESULT; +pub const COMADMIN_E_REGDB_SYSTEMERR: HRESULT = 0x80110474u32 as HRESULT; +pub const COMADMIN_E_REGDB_ALREADYRUNNING: HRESULT = 0x80110475u32 as HRESULT; +pub const COMADMIN_E_MIG_VERSIONNOTSUPPORTED: HRESULT = 0x80110480u32 as HRESULT; +pub const COMADMIN_E_MIG_SCHEMANOTFOUND: HRESULT = 0x80110481u32 as HRESULT; +pub const COMADMIN_E_CAT_BITNESSMISMATCH: HRESULT = 0x80110482u32 as HRESULT; +pub const COMADMIN_E_CAT_UNACCEPTABLEBITNESS: HRESULT = 0x80110483u32 as HRESULT; +pub const COMADMIN_E_CAT_WRONGAPPBITNESS: HRESULT = 0x80110484u32 as HRESULT; +pub const COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED: HRESULT = 0x80110485u32 as HRESULT; +pub const COMADMIN_E_CAT_SERVERFAULT: HRESULT = 0x80110486u32 as HRESULT; +pub const COMQC_E_APPLICATION_NOT_QUEUED: HRESULT = 0x80110600u32 as HRESULT; +pub const COMQC_E_NO_QUEUEABLE_INTERFACES: HRESULT = 0x80110601u32 as HRESULT; +pub const COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE: HRESULT = 0x80110602u32 as HRESULT; +pub const COMQC_E_NO_IPERSISTSTREAM: HRESULT = 0x80110603u32 as HRESULT; +pub const COMQC_E_BAD_MESSAGE: HRESULT = 0x80110604u32 as HRESULT; +pub const COMQC_E_UNAUTHENTICATED: HRESULT = 0x80110605u32 as HRESULT; +pub const COMQC_E_UNTRUSTED_ENQUEUER: HRESULT = 0x80110606u32 as HRESULT; +pub const MSDTC_E_DUPLICATE_RESOURCE: HRESULT = 0x80110701u32 as HRESULT; +pub const COMADMIN_E_OBJECT_PARENT_MISSING: HRESULT = 0x80110808u32 as HRESULT; +pub const COMADMIN_E_OBJECT_DOES_NOT_EXIST: HRESULT = 0x80110809u32 as HRESULT; +pub const COMADMIN_E_APP_NOT_RUNNING: HRESULT = 0x8011080Au32 as HRESULT; +pub const COMADMIN_E_INVALID_PARTITION: HRESULT = 0x8011080Bu32 as HRESULT; +pub const COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE: HRESULT = 0x8011080Du32 as HRESULT; +pub const COMADMIN_E_USER_IN_SET: HRESULT = 0x8011080Eu32 as HRESULT; +pub const COMADMIN_E_CANTRECYCLELIBRARYAPPS: HRESULT = 0x8011080Fu32 as HRESULT; +pub const COMADMIN_E_CANTRECYCLESERVICEAPPS: HRESULT = 0x80110811u32 as HRESULT; +pub const COMADMIN_E_PROCESSALREADYRECYCLED: HRESULT = 0x80110812u32 as HRESULT; +pub const COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED: HRESULT = 0x80110813u32 as HRESULT; +pub const COMADMIN_E_CANTMAKEINPROCSERVICE: HRESULT = 0x80110814u32 as HRESULT; +pub const COMADMIN_E_PROGIDINUSEBYCLSID: HRESULT = 0x80110815u32 as HRESULT; +pub const COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET: HRESULT = 0x80110816u32 as HRESULT; +pub const COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED: HRESULT = 0x80110817u32 as HRESULT; +pub const COMADMIN_E_PARTITION_ACCESSDENIED: HRESULT = 0x80110818u32 as HRESULT; +pub const COMADMIN_E_PARTITION_MSI_ONLY: HRESULT = 0x80110819u32 as HRESULT; +pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT: HRESULT = 0x8011081Au32 as HRESULT; +pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS: HRESULT = 0x8011081Bu32 as HRESULT; +pub const COMADMIN_E_COMP_MOVE_SOURCE: HRESULT = 0x8011081Cu32 as HRESULT; +pub const COMADMIN_E_COMP_MOVE_DEST: HRESULT = 0x8011081Du32 as HRESULT; +pub const COMADMIN_E_COMP_MOVE_PRIVATE: HRESULT = 0x8011081Eu32 as HRESULT; +pub const COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET: HRESULT = 0x8011081Fu32 as HRESULT; +pub const COMADMIN_E_CANNOT_ALIAS_EVENTCLASS: HRESULT = 0x80110820u32 as HRESULT; +pub const COMADMIN_E_PRIVATE_ACCESSDENIED: HRESULT = 0x80110821u32 as HRESULT; +pub const COMADMIN_E_SAFERINVALID: HRESULT = 0x80110822u32 as HRESULT; +pub const COMADMIN_E_REGISTRY_ACCESSDENIED: HRESULT = 0x80110823u32 as HRESULT; +pub const COMADMIN_E_PARTITIONS_DISABLED: HRESULT = 0x80110824u32 as HRESULT; +pub const WER_S_REPORT_DEBUG: HRESULT = 0x001B0000; +pub const WER_S_REPORT_UPLOADED: HRESULT = 0x001B0001; +pub const WER_S_REPORT_QUEUED: HRESULT = 0x001B0002; +pub const WER_S_DISABLED: HRESULT = 0x001B0003; +pub const WER_S_SUSPENDED_UPLOAD: HRESULT = 0x001B0004; +pub const WER_S_DISABLED_QUEUE: HRESULT = 0x001B0005; +pub const WER_S_DISABLED_ARCHIVE: HRESULT = 0x001B0006; +pub const WER_S_REPORT_ASYNC: HRESULT = 0x001B0007; +pub const WER_S_IGNORE_ASSERT_INSTANCE: HRESULT = 0x001B0008; +pub const WER_S_IGNORE_ALL_ASSERTS: HRESULT = 0x001B0009; +pub const WER_S_ASSERT_CONTINUE: HRESULT = 0x001B000A; +pub const WER_S_THROTTLED: HRESULT = 0x001B000B; +pub const WER_E_CRASH_FAILURE: HRESULT = 0x801B8000u32 as HRESULT; +pub const WER_E_CANCELED: HRESULT = 0x801B8001u32 as HRESULT; +pub const WER_E_NETWORK_FAILURE: HRESULT = 0x801B8002u32 as HRESULT; +pub const WER_E_NOT_INITIALIZED: HRESULT = 0x801B8003u32 as HRESULT; +pub const WER_E_ALREADY_REPORTING: HRESULT = 0x801B8004u32 as HRESULT; +pub const WER_E_DUMP_THROTTLED: HRESULT = 0x801B8005u32 as HRESULT; +pub const ERROR_FLT_IO_COMPLETE: HRESULT = 0x001F0001; +pub const ERROR_FLT_NO_HANDLER_DEFINED: HRESULT = 0x801F0001u32 as HRESULT; +pub const ERROR_FLT_CONTEXT_ALREADY_DEFINED: HRESULT = 0x801F0002u32 as HRESULT; +pub const ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST: HRESULT = 0x801F0003u32 as HRESULT; +pub const ERROR_FLT_DISALLOW_FAST_IO: HRESULT = 0x801F0004u32 as HRESULT; +pub const ERROR_FLT_INVALID_NAME_REQUEST: HRESULT = 0x801F0005u32 as HRESULT; +pub const ERROR_FLT_NOT_SAFE_TO_POST_OPERATION: HRESULT = 0x801F0006u32 as HRESULT; +pub const ERROR_FLT_NOT_INITIALIZED: HRESULT = 0x801F0007u32 as HRESULT; +pub const ERROR_FLT_FILTER_NOT_READY: HRESULT = 0x801F0008u32 as HRESULT; +pub const ERROR_FLT_POST_OPERATION_CLEANUP: HRESULT = 0x801F0009u32 as HRESULT; +pub const ERROR_FLT_INTERNAL_ERROR: HRESULT = 0x801F000Au32 as HRESULT; +pub const ERROR_FLT_DELETING_OBJECT: HRESULT = 0x801F000Bu32 as HRESULT; +pub const ERROR_FLT_MUST_BE_NONPAGED_POOL: HRESULT = 0x801F000Cu32 as HRESULT; +pub const ERROR_FLT_DUPLICATE_ENTRY: HRESULT = 0x801F000Du32 as HRESULT; +pub const ERROR_FLT_CBDQ_DISABLED: HRESULT = 0x801F000Eu32 as HRESULT; +pub const ERROR_FLT_DO_NOT_ATTACH: HRESULT = 0x801F000Fu32 as HRESULT; +pub const ERROR_FLT_DO_NOT_DETACH: HRESULT = 0x801F0010u32 as HRESULT; +pub const ERROR_FLT_INSTANCE_ALTITUDE_COLLISION: HRESULT = 0x801F0011u32 as HRESULT; +pub const ERROR_FLT_INSTANCE_NAME_COLLISION: HRESULT = 0x801F0012u32 as HRESULT; +pub const ERROR_FLT_FILTER_NOT_FOUND: HRESULT = 0x801F0013u32 as HRESULT; +pub const ERROR_FLT_VOLUME_NOT_FOUND: HRESULT = 0x801F0014u32 as HRESULT; +pub const ERROR_FLT_INSTANCE_NOT_FOUND: HRESULT = 0x801F0015u32 as HRESULT; +pub const ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND: HRESULT = 0x801F0016u32 as HRESULT; +pub const ERROR_FLT_INVALID_CONTEXT_REGISTRATION: HRESULT = 0x801F0017u32 as HRESULT; +pub const ERROR_FLT_NAME_CACHE_MISS: HRESULT = 0x801F0018u32 as HRESULT; +pub const ERROR_FLT_NO_DEVICE_OBJECT: HRESULT = 0x801F0019u32 as HRESULT; +pub const ERROR_FLT_VOLUME_ALREADY_MOUNTED: HRESULT = 0x801F001Au32 as HRESULT; +pub const ERROR_FLT_ALREADY_ENLISTED: HRESULT = 0x801F001Bu32 as HRESULT; +pub const ERROR_FLT_CONTEXT_ALREADY_LINKED: HRESULT = 0x801F001Cu32 as HRESULT; +pub const ERROR_FLT_NO_WAITER_FOR_REPLY: HRESULT = 0x801F0020u32 as HRESULT; +pub const ERROR_FLT_REGISTRATION_BUSY: HRESULT = 0x801F0023u32 as HRESULT; +pub const ERROR_HUNG_DISPLAY_DRIVER_THREAD: HRESULT = 0x80260001u32 as HRESULT; +pub const DWM_E_COMPOSITIONDISABLED: HRESULT = 0x80263001u32 as HRESULT; +pub const DWM_E_REMOTING_NOT_SUPPORTED: HRESULT = 0x80263002u32 as HRESULT; +pub const DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE: HRESULT = 0x80263003u32 as HRESULT; +pub const DWM_E_NOT_QUEUING_PRESENTS: HRESULT = 0x80263004u32 as HRESULT; +pub const DWM_E_ADAPTER_NOT_FOUND: HRESULT = 0x80263005u32 as HRESULT; +pub const DWM_S_GDI_REDIRECTION_SURFACE: HRESULT = 0x00263005; +pub const DWM_E_TEXTURE_TOO_LARGE: HRESULT = 0x80263007u32 as HRESULT; +pub const ERROR_MONITOR_NO_DESCRIPTOR: HRESULT = 0x80261001u32 as HRESULT; +pub const ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: HRESULT = 0x80261002u32 as HRESULT; +pub const ERROR_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: HRESULT = 0xC0261003u32 as HRESULT; +pub const ERROR_MONITOR_INVALID_STANDARD_TIMING_BLOCK: HRESULT = 0xC0261004u32 as HRESULT; +pub const ERROR_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: HRESULT = 0xC0261005u32 as HRESULT; +pub const ERROR_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: HRESULT = 0xC0261006u32 as HRESULT; +pub const ERROR_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: HRESULT = 0xC0261007u32 as HRESULT; +pub const ERROR_MONITOR_NO_MORE_DESCRIPTOR_DATA: HRESULT = 0xC0261008u32 as HRESULT; +pub const ERROR_MONITOR_INVALID_DETAILED_TIMING_BLOCK: HRESULT = 0xC0261009u32 as HRESULT; +pub const ERROR_MONITOR_INVALID_MANUFACTURE_DATE: HRESULT = 0xC026100Au32 as HRESULT; +pub const ERROR_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: HRESULT = 0xC0262000u32 as HRESULT; +pub const ERROR_GRAPHICS_INSUFFICIENT_DMA_BUFFER: HRESULT = 0xC0262001u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_DISPLAY_ADAPTER: HRESULT = 0xC0262002u32 as HRESULT; +pub const ERROR_GRAPHICS_ADAPTER_WAS_RESET: HRESULT = 0xC0262003u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_DRIVER_MODEL: HRESULT = 0xC0262004u32 as HRESULT; +pub const ERROR_GRAPHICS_PRESENT_MODE_CHANGED: HRESULT = 0xC0262005u32 as HRESULT; +pub const ERROR_GRAPHICS_PRESENT_OCCLUDED: HRESULT = 0xC0262006u32 as HRESULT; +pub const ERROR_GRAPHICS_PRESENT_DENIED: HRESULT = 0xC0262007u32 as HRESULT; +pub const ERROR_GRAPHICS_CANNOTCOLORCONVERT: HRESULT = 0xC0262008u32 as HRESULT; +pub const ERROR_GRAPHICS_DRIVER_MISMATCH: HRESULT = 0xC0262009u32 as HRESULT; +pub const ERROR_GRAPHICS_PARTIAL_DATA_POPULATED: HRESULT = 0x4026200A; +pub const ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED: HRESULT = 0xC026200Bu32 as HRESULT; +pub const ERROR_GRAPHICS_PRESENT_UNOCCLUDED: HRESULT = 0xC026200Cu32 as HRESULT; +pub const ERROR_GRAPHICS_WINDOWDC_NOT_AVAILABLE: HRESULT = 0xC026200Du32 as HRESULT; +pub const ERROR_GRAPHICS_WINDOWLESS_PRESENT_DISABLED: HRESULT = 0xC026200Eu32 as HRESULT; +pub const ERROR_GRAPHICS_NO_VIDEO_MEMORY: HRESULT = 0xC0262100u32 as HRESULT; +pub const ERROR_GRAPHICS_CANT_LOCK_MEMORY: HRESULT = 0xC0262101u32 as HRESULT; +pub const ERROR_GRAPHICS_ALLOCATION_BUSY: HRESULT = 0xC0262102u32 as HRESULT; +pub const ERROR_GRAPHICS_TOO_MANY_REFERENCES: HRESULT = 0xC0262103u32 as HRESULT; +pub const ERROR_GRAPHICS_TRY_AGAIN_LATER: HRESULT = 0xC0262104u32 as HRESULT; +pub const ERROR_GRAPHICS_TRY_AGAIN_NOW: HRESULT = 0xC0262105u32 as HRESULT; +pub const ERROR_GRAPHICS_ALLOCATION_INVALID: HRESULT = 0xC0262106u32 as HRESULT; +pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: HRESULT = 0xC0262107u32 as HRESULT; +pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: HRESULT = 0xC0262108u32 as HRESULT; +pub const ERROR_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: HRESULT = 0xC0262109u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_ALLOCATION_USAGE: HRESULT = 0xC0262110u32 as HRESULT; +pub const ERROR_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: HRESULT = 0xC0262111u32 as HRESULT; +pub const ERROR_GRAPHICS_ALLOCATION_CLOSED: HRESULT = 0xC0262112u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_ALLOCATION_INSTANCE: HRESULT = 0xC0262113u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_ALLOCATION_HANDLE: HRESULT = 0xC0262114u32 as HRESULT; +pub const ERROR_GRAPHICS_WRONG_ALLOCATION_DEVICE: HRESULT = 0xC0262115u32 as HRESULT; +pub const ERROR_GRAPHICS_ALLOCATION_CONTENT_LOST: HRESULT = 0xC0262116u32 as HRESULT; +pub const ERROR_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: HRESULT = 0xC0262200u32 as HRESULT; +pub const ERROR_GRAPHICS_SKIP_ALLOCATION_PREPARATION: HRESULT = 0x40262201; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY: HRESULT = 0xC0262300u32 as HRESULT; +pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: HRESULT = 0xC0262301u32 as HRESULT; +pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: HRESULT = 0xC0262302u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDPN: HRESULT = 0xC0262303u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: HRESULT = 0xC0262304u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: HRESULT = 0xC0262305u32 as HRESULT; +pub const ERROR_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: HRESULT = 0xC0262306u32 as HRESULT; +pub const ERROR_GRAPHICS_MODE_NOT_PINNED: HRESULT = 0x00262307; +pub const ERROR_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: HRESULT = 0xC0262308u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGETMODESET: HRESULT = 0xC0262309u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_FREQUENCY: HRESULT = 0xC026230Au32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_ACTIVE_REGION: HRESULT = 0xC026230Bu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_TOTAL_REGION: HRESULT = 0xC026230Cu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: HRESULT = 0xC0262310u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: HRESULT = 0xC0262311u32 as HRESULT; +pub const ERROR_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: HRESULT = 0xC0262312u32 as HRESULT; +pub const ERROR_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: HRESULT = 0xC0262313u32 as HRESULT; +pub const ERROR_GRAPHICS_MODE_ALREADY_IN_MODESET: HRESULT = 0xC0262314u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: HRESULT = 0xC0262315u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: HRESULT = 0xC0262316u32 as HRESULT; +pub const ERROR_GRAPHICS_SOURCE_ALREADY_IN_SET: HRESULT = 0xC0262317u32 as HRESULT; +pub const ERROR_GRAPHICS_TARGET_ALREADY_IN_SET: HRESULT = 0xC0262318u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: HRESULT = 0xC0262319u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: HRESULT = 0xC026231Au32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: HRESULT = 0xC026231Bu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: HRESULT = 0xC026231Cu32 as HRESULT; +pub const ERROR_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: HRESULT = 0xC026231Du32 as HRESULT; +pub const ERROR_GRAPHICS_NO_PREFERRED_MODE: HRESULT = 0x0026231E; +pub const ERROR_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: HRESULT = 0xC026231Fu32 as HRESULT; +pub const ERROR_GRAPHICS_STALE_MODESET: HRESULT = 0xC0262320u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: HRESULT = 0xC0262321u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: HRESULT = 0xC0262322u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: HRESULT = 0xC0262323u32 as HRESULT; +pub const ERROR_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262324u32 as HRESULT; +pub const ERROR_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: HRESULT = 0xC0262325u32 as HRESULT; +pub const ERROR_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: HRESULT = 0xC0262326u32 as HRESULT; +pub const ERROR_GRAPHICS_PATH_NOT_IN_TOPOLOGY: HRESULT = 0xC0262327u32 as HRESULT; +pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: HRESULT = 0xC0262328u32 as HRESULT; +pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: HRESULT = 0xC0262329u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTORSET: HRESULT = 0xC026232Au32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTOR: HRESULT = 0xC026232Bu32 as HRESULT; +pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: HRESULT = 0xC026232Cu32 as HRESULT; +pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: HRESULT = 0xC026232Du32 as HRESULT; +pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: HRESULT = 0xC026232Eu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: HRESULT = 0xC026232Fu32 as HRESULT; +pub const ERROR_GRAPHICS_RESOURCES_NOT_RELATED: HRESULT = 0xC0262330u32 as HRESULT; +pub const ERROR_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262331u32 as HRESULT; +pub const ERROR_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262332u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: HRESULT = 0xC0262333u32 as HRESULT; +pub const ERROR_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: HRESULT = 0xC0262334u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_VIDPNMGR: HRESULT = 0xC0262335u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_ACTIVE_VIDPN: HRESULT = 0xC0262336u32 as HRESULT; +pub const ERROR_GRAPHICS_STALE_VIDPN_TOPOLOGY: HRESULT = 0xC0262337u32 as HRESULT; +pub const ERROR_GRAPHICS_MONITOR_NOT_CONNECTED: HRESULT = 0xC0262338u32 as HRESULT; +pub const ERROR_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: HRESULT = 0xC0262339u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: HRESULT = 0xC026233Au32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_VISIBLEREGION_SIZE: HRESULT = 0xC026233Bu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_STRIDE: HRESULT = 0xC026233Cu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_PIXELFORMAT: HRESULT = 0xC026233Du32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_COLORBASIS: HRESULT = 0xC026233Eu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: HRESULT = 0xC026233Fu32 as HRESULT; +pub const ERROR_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: HRESULT = 0xC0262340u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: HRESULT = 0xC0262341u32 as HRESULT; +pub const ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0xC0262342u32 as HRESULT; +pub const ERROR_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: HRESULT = 0xC0262343u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: HRESULT = 0xC0262344u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: HRESULT = 0xC0262345u32 as HRESULT; +pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: HRESULT = 0xC0262346u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_GAMMA_RAMP: HRESULT = 0xC0262347u32 as HRESULT; +pub const ERROR_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: HRESULT = 0xC0262348u32 as HRESULT; +pub const ERROR_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: HRESULT = 0xC0262349u32 as HRESULT; +pub const ERROR_GRAPHICS_MODE_NOT_IN_MODESET: HRESULT = 0xC026234Au32 as HRESULT; +pub const ERROR_GRAPHICS_DATASET_IS_EMPTY: HRESULT = 0x0026234B; +pub const ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: HRESULT = 0x0026234C; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: HRESULT = 0xC026234Du32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_TYPE: HRESULT = 0xC026234Eu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_COPYPROTECTION_TYPE: HRESULT = 0xC026234Fu32 as HRESULT; +pub const ERROR_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: HRESULT = 0xC0262350u32 as HRESULT; +pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: HRESULT = 0x00262351; +pub const ERROR_GRAPHICS_INVALID_SCANLINE_ORDERING: HRESULT = 0xC0262352u32 as HRESULT; +pub const ERROR_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: HRESULT = 0xC0262353u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: HRESULT = 0xC0262354u32 as HRESULT; +pub const ERROR_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: HRESULT = 0xC0262355u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: HRESULT = 0xC0262356u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: HRESULT = 0xC0262357u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: HRESULT = 0xC0262358u32 as HRESULT; +pub const ERROR_GRAPHICS_MAX_NUM_PATHS_REACHED: HRESULT = 0xC0262359u32 as HRESULT; +pub const ERROR_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: HRESULT = 0xC026235Au32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_CLIENT_TYPE: HRESULT = 0xC026235Bu32 as HRESULT; +pub const ERROR_GRAPHICS_CLIENTVIDPN_NOT_SET: HRESULT = 0xC026235Cu32 as HRESULT; +pub const ERROR_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: HRESULT = 0xC0262400u32 as HRESULT; +pub const ERROR_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: HRESULT = 0xC0262401u32 as HRESULT; +pub const ERROR_GRAPHICS_UNKNOWN_CHILD_STATUS: HRESULT = 0x4026242F; +pub const ERROR_GRAPHICS_NOT_A_LINKED_ADAPTER: HRESULT = 0xC0262430u32 as HRESULT; +pub const ERROR_GRAPHICS_LEADLINK_NOT_ENUMERATED: HRESULT = 0xC0262431u32 as HRESULT; +pub const ERROR_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: HRESULT = 0xC0262432u32 as HRESULT; +pub const ERROR_GRAPHICS_ADAPTER_CHAIN_NOT_READY: HRESULT = 0xC0262433u32 as HRESULT; +pub const ERROR_GRAPHICS_CHAINLINKS_NOT_STARTED: HRESULT = 0xC0262434u32 as HRESULT; +pub const ERROR_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: HRESULT = 0xC0262435u32 as HRESULT; +pub const ERROR_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: HRESULT = 0xC0262436u32 as HRESULT; +pub const ERROR_GRAPHICS_LEADLINK_START_DEFERRED: HRESULT = 0x40262437; +pub const ERROR_GRAPHICS_NOT_POST_DEVICE_DRIVER: HRESULT = 0xC0262438u32 as HRESULT; +pub const ERROR_GRAPHICS_POLLING_TOO_FREQUENTLY: HRESULT = 0x40262439; +pub const ERROR_GRAPHICS_START_DEFERRED: HRESULT = 0x4026243A; +pub const ERROR_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: HRESULT = 0xC026243Bu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_NOT_SUPPORTED: HRESULT = 0xC0262500u32 as HRESULT; +pub const ERROR_GRAPHICS_COPP_NOT_SUPPORTED: HRESULT = 0xC0262501u32 as HRESULT; +pub const ERROR_GRAPHICS_UAB_NOT_SUPPORTED: HRESULT = 0xC0262502u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: HRESULT = 0xC0262503u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_NO_VIDEO_OUTPUTS_EXIST: HRESULT = 0xC0262505u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_INTERNAL_ERROR: HRESULT = 0xC026250Bu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_INVALID_HANDLE: HRESULT = 0xC026250Cu32 as HRESULT; +pub const ERROR_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: HRESULT = 0xC026250Eu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_SPANNING_MODE_ENABLED: HRESULT = 0xC026250Fu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_THEATER_MODE_ENABLED: HRESULT = 0xC0262510u32 as HRESULT; +pub const ERROR_GRAPHICS_PVP_HFS_FAILED: HRESULT = 0xC0262511u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_INVALID_SRM: HRESULT = 0xC0262512u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: HRESULT = 0xC0262513u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: HRESULT = 0xC0262514u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: HRESULT = 0xC0262515u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: HRESULT = 0xC0262516u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: HRESULT = 0xC0262517u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: HRESULT = 0xC0262518u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_NO_LONGER_EXISTS: HRESULT = 0xC026251Au32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS: HRESULT = 0xC026251Bu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: HRESULT = 0xC026251Cu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: HRESULT = 0xC026251Du32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: HRESULT = 0xC026251Eu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: HRESULT = 0xC026251Fu32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: HRESULT = 0xC0262520u32 as HRESULT; +pub const ERROR_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: HRESULT = 0xC0262521u32 as HRESULT; +pub const ERROR_GRAPHICS_I2C_NOT_SUPPORTED: HRESULT = 0xC0262580u32 as HRESULT; +pub const ERROR_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: HRESULT = 0xC0262581u32 as HRESULT; +pub const ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: HRESULT = 0xC0262582u32 as HRESULT; +pub const ERROR_GRAPHICS_I2C_ERROR_RECEIVING_DATA: HRESULT = 0xC0262583u32 as HRESULT; +pub const ERROR_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: HRESULT = 0xC0262584u32 as HRESULT; +pub const ERROR_GRAPHICS_DDCCI_INVALID_DATA: HRESULT = 0xC0262585u32 as HRESULT; +pub const ERROR_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: HRESULT = 0xC0262586u32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_INVALID_CAPABILITIES_STRING: HRESULT = 0xC0262587u32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_INTERNAL_ERROR: HRESULT = 0xC0262588u32 as HRESULT; +pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: HRESULT = 0xC0262589u32 as HRESULT; +pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: HRESULT = 0xC026258Au32 as HRESULT; +pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: HRESULT = 0xC026258Bu32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: HRESULT = 0xC026258Cu32 as HRESULT; +pub const ERROR_GRAPHICS_MONITOR_NO_LONGER_EXISTS: HRESULT = 0xC026258Du32 as HRESULT; +pub const ERROR_GRAPHICS_DDCCI_CURRENT_CURRENT_VALUE_GREATER_THAN_MAXIMUM_VALUE: HRESULT = 0xC02625D8u32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_INVALID_VCP_VERSION: HRESULT = 0xC02625D9u32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION: HRESULT = 0xC02625DAu32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_MCCS_VERSION_MISMATCH: HRESULT = 0xC02625DBu32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_MCCS_VERSION: HRESULT = 0xC02625DCu32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED: HRESULT = 0xC02625DEu32 as HRESULT; +pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_COLOR_TEMPERATURE: HRESULT = 0xC02625DFu32 as HRESULT; +pub const ERROR_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: HRESULT = 0xC02625E0u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: HRESULT = 0xC02625E1u32 as HRESULT; +pub const ERROR_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: HRESULT = 0xC02625E2u32 as HRESULT; +pub const ERROR_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: HRESULT = 0xC02625E3u32 as HRESULT; +pub const ERROR_GRAPHICS_INVALID_POINTER: HRESULT = 0xC02625E4u32 as HRESULT; +pub const ERROR_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: HRESULT = 0xC02625E5u32 as HRESULT; +pub const ERROR_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: HRESULT = 0xC02625E6u32 as HRESULT; +pub const ERROR_GRAPHICS_INTERNAL_ERROR: HRESULT = 0xC02625E7u32 as HRESULT; +pub const ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: HRESULT = 0xC02605E8u32 as HRESULT; +pub const NAP_E_INVALID_PACKET: HRESULT = 0x80270001u32 as HRESULT; +pub const NAP_E_MISSING_SOH: HRESULT = 0x80270002u32 as HRESULT; +pub const NAP_E_CONFLICTING_ID: HRESULT = 0x80270003u32 as HRESULT; +pub const NAP_E_NO_CACHED_SOH: HRESULT = 0x80270004u32 as HRESULT; +pub const NAP_E_STILL_BOUND: HRESULT = 0x80270005u32 as HRESULT; +pub const NAP_E_NOT_REGISTERED: HRESULT = 0x80270006u32 as HRESULT; +pub const NAP_E_NOT_INITIALIZED: HRESULT = 0x80270007u32 as HRESULT; +pub const NAP_E_MISMATCHED_ID: HRESULT = 0x80270008u32 as HRESULT; +pub const NAP_E_NOT_PENDING: HRESULT = 0x80270009u32 as HRESULT; +pub const NAP_E_ID_NOT_FOUND: HRESULT = 0x8027000Au32 as HRESULT; +pub const NAP_E_MAXSIZE_TOO_SMALL: HRESULT = 0x8027000Bu32 as HRESULT; +pub const NAP_E_SERVICE_NOT_RUNNING: HRESULT = 0x8027000Cu32 as HRESULT; +pub const NAP_S_CERT_ALREADY_PRESENT: HRESULT = 0x0027000D; +pub const NAP_E_ENTITY_DISABLED: HRESULT = 0x8027000Eu32 as HRESULT; +pub const NAP_E_NETSH_GROUPPOLICY_ERROR: HRESULT = 0x8027000Fu32 as HRESULT; +pub const NAP_E_TOO_MANY_CALLS: HRESULT = 0x80270010u32 as HRESULT; +pub const NAP_E_SHV_CONFIG_EXISTED: HRESULT = 0x80270011u32 as HRESULT; +pub const NAP_E_SHV_CONFIG_NOT_FOUND: HRESULT = 0x80270012u32 as HRESULT; +pub const NAP_E_SHV_TIMEOUT: HRESULT = 0x80270013u32 as HRESULT; +pub const TPM_E_ERROR_MASK: HRESULT = 0x80280000u32 as HRESULT; +pub const TPM_E_AUTHFAIL: HRESULT = 0x80280001u32 as HRESULT; +pub const TPM_E_BADINDEX: HRESULT = 0x80280002u32 as HRESULT; +pub const TPM_E_BAD_PARAMETER: HRESULT = 0x80280003u32 as HRESULT; +pub const TPM_E_AUDITFAILURE: HRESULT = 0x80280004u32 as HRESULT; +pub const TPM_E_CLEAR_DISABLED: HRESULT = 0x80280005u32 as HRESULT; +pub const TPM_E_DEACTIVATED: HRESULT = 0x80280006u32 as HRESULT; +pub const TPM_E_DISABLED: HRESULT = 0x80280007u32 as HRESULT; +pub const TPM_E_DISABLED_CMD: HRESULT = 0x80280008u32 as HRESULT; +pub const TPM_E_FAIL: HRESULT = 0x80280009u32 as HRESULT; +pub const TPM_E_BAD_ORDINAL: HRESULT = 0x8028000Au32 as HRESULT; +pub const TPM_E_INSTALL_DISABLED: HRESULT = 0x8028000Bu32 as HRESULT; +pub const TPM_E_INVALID_KEYHANDLE: HRESULT = 0x8028000Cu32 as HRESULT; +pub const TPM_E_KEYNOTFOUND: HRESULT = 0x8028000Du32 as HRESULT; +pub const TPM_E_INAPPROPRIATE_ENC: HRESULT = 0x8028000Eu32 as HRESULT; +pub const TPM_E_MIGRATEFAIL: HRESULT = 0x8028000Fu32 as HRESULT; +pub const TPM_E_INVALID_PCR_INFO: HRESULT = 0x80280010u32 as HRESULT; +pub const TPM_E_NOSPACE: HRESULT = 0x80280011u32 as HRESULT; +pub const TPM_E_NOSRK: HRESULT = 0x80280012u32 as HRESULT; +pub const TPM_E_NOTSEALED_BLOB: HRESULT = 0x80280013u32 as HRESULT; +pub const TPM_E_OWNER_SET: HRESULT = 0x80280014u32 as HRESULT; +pub const TPM_E_RESOURCES: HRESULT = 0x80280015u32 as HRESULT; +pub const TPM_E_SHORTRANDOM: HRESULT = 0x80280016u32 as HRESULT; +pub const TPM_E_SIZE: HRESULT = 0x80280017u32 as HRESULT; +pub const TPM_E_WRONGPCRVAL: HRESULT = 0x80280018u32 as HRESULT; +pub const TPM_E_BAD_PARAM_SIZE: HRESULT = 0x80280019u32 as HRESULT; +pub const TPM_E_SHA_THREAD: HRESULT = 0x8028001Au32 as HRESULT; +pub const TPM_E_SHA_ERROR: HRESULT = 0x8028001Bu32 as HRESULT; +pub const TPM_E_FAILEDSELFTEST: HRESULT = 0x8028001Cu32 as HRESULT; +pub const TPM_E_AUTH2FAIL: HRESULT = 0x8028001Du32 as HRESULT; +pub const TPM_E_BADTAG: HRESULT = 0x8028001Eu32 as HRESULT; +pub const TPM_E_IOERROR: HRESULT = 0x8028001Fu32 as HRESULT; +pub const TPM_E_ENCRYPT_ERROR: HRESULT = 0x80280020u32 as HRESULT; +pub const TPM_E_DECRYPT_ERROR: HRESULT = 0x80280021u32 as HRESULT; +pub const TPM_E_INVALID_AUTHHANDLE: HRESULT = 0x80280022u32 as HRESULT; +pub const TPM_E_NO_ENDORSEMENT: HRESULT = 0x80280023u32 as HRESULT; +pub const TPM_E_INVALID_KEYUSAGE: HRESULT = 0x80280024u32 as HRESULT; +pub const TPM_E_WRONG_ENTITYTYPE: HRESULT = 0x80280025u32 as HRESULT; +pub const TPM_E_INVALID_POSTINIT: HRESULT = 0x80280026u32 as HRESULT; +pub const TPM_E_INAPPROPRIATE_SIG: HRESULT = 0x80280027u32 as HRESULT; +pub const TPM_E_BAD_KEY_PROPERTY: HRESULT = 0x80280028u32 as HRESULT; +pub const TPM_E_BAD_MIGRATION: HRESULT = 0x80280029u32 as HRESULT; +pub const TPM_E_BAD_SCHEME: HRESULT = 0x8028002Au32 as HRESULT; +pub const TPM_E_BAD_DATASIZE: HRESULT = 0x8028002Bu32 as HRESULT; +pub const TPM_E_BAD_MODE: HRESULT = 0x8028002Cu32 as HRESULT; +pub const TPM_E_BAD_PRESENCE: HRESULT = 0x8028002Du32 as HRESULT; +pub const TPM_E_BAD_VERSION: HRESULT = 0x8028002Eu32 as HRESULT; +pub const TPM_E_NO_WRAP_TRANSPORT: HRESULT = 0x8028002Fu32 as HRESULT; +pub const TPM_E_AUDITFAIL_UNSUCCESSFUL: HRESULT = 0x80280030u32 as HRESULT; +pub const TPM_E_AUDITFAIL_SUCCESSFUL: HRESULT = 0x80280031u32 as HRESULT; +pub const TPM_E_NOTRESETABLE: HRESULT = 0x80280032u32 as HRESULT; +pub const TPM_E_NOTLOCAL: HRESULT = 0x80280033u32 as HRESULT; +pub const TPM_E_BAD_TYPE: HRESULT = 0x80280034u32 as HRESULT; +pub const TPM_E_INVALID_RESOURCE: HRESULT = 0x80280035u32 as HRESULT; +pub const TPM_E_NOTFIPS: HRESULT = 0x80280036u32 as HRESULT; +pub const TPM_E_INVALID_FAMILY: HRESULT = 0x80280037u32 as HRESULT; +pub const TPM_E_NO_NV_PERMISSION: HRESULT = 0x80280038u32 as HRESULT; +pub const TPM_E_REQUIRES_SIGN: HRESULT = 0x80280039u32 as HRESULT; +pub const TPM_E_KEY_NOTSUPPORTED: HRESULT = 0x8028003Au32 as HRESULT; +pub const TPM_E_AUTH_CONFLICT: HRESULT = 0x8028003Bu32 as HRESULT; +pub const TPM_E_AREA_LOCKED: HRESULT = 0x8028003Cu32 as HRESULT; +pub const TPM_E_BAD_LOCALITY: HRESULT = 0x8028003Du32 as HRESULT; +pub const TPM_E_READ_ONLY: HRESULT = 0x8028003Eu32 as HRESULT; +pub const TPM_E_PER_NOWRITE: HRESULT = 0x8028003Fu32 as HRESULT; +pub const TPM_E_FAMILYCOUNT: HRESULT = 0x80280040u32 as HRESULT; +pub const TPM_E_WRITE_LOCKED: HRESULT = 0x80280041u32 as HRESULT; +pub const TPM_E_BAD_ATTRIBUTES: HRESULT = 0x80280042u32 as HRESULT; +pub const TPM_E_INVALID_STRUCTURE: HRESULT = 0x80280043u32 as HRESULT; +pub const TPM_E_KEY_OWNER_CONTROL: HRESULT = 0x80280044u32 as HRESULT; +pub const TPM_E_BAD_COUNTER: HRESULT = 0x80280045u32 as HRESULT; +pub const TPM_E_NOT_FULLWRITE: HRESULT = 0x80280046u32 as HRESULT; +pub const TPM_E_CONTEXT_GAP: HRESULT = 0x80280047u32 as HRESULT; +pub const TPM_E_MAXNVWRITES: HRESULT = 0x80280048u32 as HRESULT; +pub const TPM_E_NOOPERATOR: HRESULT = 0x80280049u32 as HRESULT; +pub const TPM_E_RESOURCEMISSING: HRESULT = 0x8028004Au32 as HRESULT; +pub const TPM_E_DELEGATE_LOCK: HRESULT = 0x8028004Bu32 as HRESULT; +pub const TPM_E_DELEGATE_FAMILY: HRESULT = 0x8028004Cu32 as HRESULT; +pub const TPM_E_DELEGATE_ADMIN: HRESULT = 0x8028004Du32 as HRESULT; +pub const TPM_E_TRANSPORT_NOTEXCLUSIVE: HRESULT = 0x8028004Eu32 as HRESULT; +pub const TPM_E_OWNER_CONTROL: HRESULT = 0x8028004Fu32 as HRESULT; +pub const TPM_E_DAA_RESOURCES: HRESULT = 0x80280050u32 as HRESULT; +pub const TPM_E_DAA_INPUT_DATA0: HRESULT = 0x80280051u32 as HRESULT; +pub const TPM_E_DAA_INPUT_DATA1: HRESULT = 0x80280052u32 as HRESULT; +pub const TPM_E_DAA_ISSUER_SETTINGS: HRESULT = 0x80280053u32 as HRESULT; +pub const TPM_E_DAA_TPM_SETTINGS: HRESULT = 0x80280054u32 as HRESULT; +pub const TPM_E_DAA_STAGE: HRESULT = 0x80280055u32 as HRESULT; +pub const TPM_E_DAA_ISSUER_VALIDITY: HRESULT = 0x80280056u32 as HRESULT; +pub const TPM_E_DAA_WRONG_W: HRESULT = 0x80280057u32 as HRESULT; +pub const TPM_E_BAD_HANDLE: HRESULT = 0x80280058u32 as HRESULT; +pub const TPM_E_BAD_DELEGATE: HRESULT = 0x80280059u32 as HRESULT; +pub const TPM_E_BADCONTEXT: HRESULT = 0x8028005Au32 as HRESULT; +pub const TPM_E_TOOMANYCONTEXTS: HRESULT = 0x8028005Bu32 as HRESULT; +pub const TPM_E_MA_TICKET_SIGNATURE: HRESULT = 0x8028005Cu32 as HRESULT; +pub const TPM_E_MA_DESTINATION: HRESULT = 0x8028005Du32 as HRESULT; +pub const TPM_E_MA_SOURCE: HRESULT = 0x8028005Eu32 as HRESULT; +pub const TPM_E_MA_AUTHORITY: HRESULT = 0x8028005Fu32 as HRESULT; +pub const TPM_E_PERMANENTEK: HRESULT = 0x80280061u32 as HRESULT; +pub const TPM_E_BAD_SIGNATURE: HRESULT = 0x80280062u32 as HRESULT; +pub const TPM_E_NOCONTEXTSPACE: HRESULT = 0x80280063u32 as HRESULT; +pub const TPM_E_COMMAND_BLOCKED: HRESULT = 0x80280400u32 as HRESULT; +pub const TPM_E_INVALID_HANDLE: HRESULT = 0x80280401u32 as HRESULT; +pub const TPM_E_DUPLICATE_VHANDLE: HRESULT = 0x80280402u32 as HRESULT; +pub const TPM_E_EMBEDDED_COMMAND_BLOCKED: HRESULT = 0x80280403u32 as HRESULT; +pub const TPM_E_EMBEDDED_COMMAND_UNSUPPORTED: HRESULT = 0x80280404u32 as HRESULT; +pub const TPM_E_RETRY: HRESULT = 0x80280800u32 as HRESULT; +pub const TPM_E_NEEDS_SELFTEST: HRESULT = 0x80280801u32 as HRESULT; +pub const TPM_E_DOING_SELFTEST: HRESULT = 0x80280802u32 as HRESULT; +pub const TPM_E_DEFEND_LOCK_RUNNING: HRESULT = 0x80280803u32 as HRESULT; +pub const TBS_E_INTERNAL_ERROR: HRESULT = 0x80284001u32 as HRESULT; +pub const TBS_E_BAD_PARAMETER: HRESULT = 0x80284002u32 as HRESULT; +pub const TBS_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80284003u32 as HRESULT; +pub const TBS_E_INVALID_CONTEXT: HRESULT = 0x80284004u32 as HRESULT; +pub const TBS_E_INSUFFICIENT_BUFFER: HRESULT = 0x80284005u32 as HRESULT; +pub const TBS_E_IOERROR: HRESULT = 0x80284006u32 as HRESULT; +pub const TBS_E_INVALID_CONTEXT_PARAM: HRESULT = 0x80284007u32 as HRESULT; +pub const TBS_E_SERVICE_NOT_RUNNING: HRESULT = 0x80284008u32 as HRESULT; +pub const TBS_E_TOO_MANY_TBS_CONTEXTS: HRESULT = 0x80284009u32 as HRESULT; +pub const TBS_E_TOO_MANY_RESOURCES: HRESULT = 0x8028400Au32 as HRESULT; +pub const TBS_E_SERVICE_START_PENDING: HRESULT = 0x8028400Bu32 as HRESULT; +pub const TBS_E_PPI_NOT_SUPPORTED: HRESULT = 0x8028400Cu32 as HRESULT; +pub const TBS_E_COMMAND_CANCELED: HRESULT = 0x8028400Du32 as HRESULT; +pub const TBS_E_BUFFER_TOO_LARGE: HRESULT = 0x8028400Eu32 as HRESULT; +pub const TBS_E_TPM_NOT_FOUND: HRESULT = 0x8028400Fu32 as HRESULT; +pub const TBS_E_SERVICE_DISABLED: HRESULT = 0x80284010u32 as HRESULT; +pub const TBS_E_NO_EVENT_LOG: HRESULT = 0x80284011u32 as HRESULT; +pub const TBS_E_ACCESS_DENIED: HRESULT = 0x80284012u32 as HRESULT; +pub const TBS_E_PROVISIONING_NOT_ALLOWED: HRESULT = 0x80284013u32 as HRESULT; +pub const TBS_E_PPI_FUNCTION_UNSUPPORTED: HRESULT = 0x80284014u32 as HRESULT; +pub const TBS_E_OWNERAUTH_NOT_FOUND: HRESULT = 0x80284015u32 as HRESULT; +pub const TBS_E_PROVISIONING_INCOMPLETE: HRESULT = 0x80284016u32 as HRESULT; +pub const TPMAPI_E_INVALID_STATE: HRESULT = 0x80290100u32 as HRESULT; +pub const TPMAPI_E_NOT_ENOUGH_DATA: HRESULT = 0x80290101u32 as HRESULT; +pub const TPMAPI_E_TOO_MUCH_DATA: HRESULT = 0x80290102u32 as HRESULT; +pub const TPMAPI_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80290103u32 as HRESULT; +pub const TPMAPI_E_INVALID_PARAMETER: HRESULT = 0x80290104u32 as HRESULT; +pub const TPMAPI_E_OUT_OF_MEMORY: HRESULT = 0x80290105u32 as HRESULT; +pub const TPMAPI_E_BUFFER_TOO_SMALL: HRESULT = 0x80290106u32 as HRESULT; +pub const TPMAPI_E_INTERNAL_ERROR: HRESULT = 0x80290107u32 as HRESULT; +pub const TPMAPI_E_ACCESS_DENIED: HRESULT = 0x80290108u32 as HRESULT; +pub const TPMAPI_E_AUTHORIZATION_FAILED: HRESULT = 0x80290109u32 as HRESULT; +pub const TPMAPI_E_INVALID_CONTEXT_HANDLE: HRESULT = 0x8029010Au32 as HRESULT; +pub const TPMAPI_E_TBS_COMMUNICATION_ERROR: HRESULT = 0x8029010Bu32 as HRESULT; +pub const TPMAPI_E_TPM_COMMAND_ERROR: HRESULT = 0x8029010Cu32 as HRESULT; +pub const TPMAPI_E_MESSAGE_TOO_LARGE: HRESULT = 0x8029010Du32 as HRESULT; +pub const TPMAPI_E_INVALID_ENCODING: HRESULT = 0x8029010Eu32 as HRESULT; +pub const TPMAPI_E_INVALID_KEY_SIZE: HRESULT = 0x8029010Fu32 as HRESULT; +pub const TPMAPI_E_ENCRYPTION_FAILED: HRESULT = 0x80290110u32 as HRESULT; +pub const TPMAPI_E_INVALID_KEY_PARAMS: HRESULT = 0x80290111u32 as HRESULT; +pub const TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB: HRESULT = 0x80290112u32 as HRESULT; +pub const TPMAPI_E_INVALID_PCR_INDEX: HRESULT = 0x80290113u32 as HRESULT; +pub const TPMAPI_E_INVALID_DELEGATE_BLOB: HRESULT = 0x80290114u32 as HRESULT; +pub const TPMAPI_E_INVALID_CONTEXT_PARAMS: HRESULT = 0x80290115u32 as HRESULT; +pub const TPMAPI_E_INVALID_KEY_BLOB: HRESULT = 0x80290116u32 as HRESULT; +pub const TPMAPI_E_INVALID_PCR_DATA: HRESULT = 0x80290117u32 as HRESULT; +pub const TPMAPI_E_INVALID_OWNER_AUTH: HRESULT = 0x80290118u32 as HRESULT; +pub const TPMAPI_E_FIPS_RNG_CHECK_FAILED: HRESULT = 0x80290119u32 as HRESULT; +pub const TPMAPI_E_EMPTY_TCG_LOG: HRESULT = 0x8029011Au32 as HRESULT; +pub const TPMAPI_E_INVALID_TCG_LOG_ENTRY: HRESULT = 0x8029011Bu32 as HRESULT; +pub const TPMAPI_E_TCG_SEPARATOR_ABSENT: HRESULT = 0x8029011Cu32 as HRESULT; +pub const TPMAPI_E_TCG_INVALID_DIGEST_ENTRY: HRESULT = 0x8029011Du32 as HRESULT; +pub const TPMAPI_E_POLICY_DENIES_OPERATION: HRESULT = 0x8029011Eu32 as HRESULT; +pub const TBSIMP_E_BUFFER_TOO_SMALL: HRESULT = 0x80290200u32 as HRESULT; +pub const TBSIMP_E_CLEANUP_FAILED: HRESULT = 0x80290201u32 as HRESULT; +pub const TBSIMP_E_INVALID_CONTEXT_HANDLE: HRESULT = 0x80290202u32 as HRESULT; +pub const TBSIMP_E_INVALID_CONTEXT_PARAM: HRESULT = 0x80290203u32 as HRESULT; +pub const TBSIMP_E_TPM_ERROR: HRESULT = 0x80290204u32 as HRESULT; +pub const TBSIMP_E_HASH_BAD_KEY: HRESULT = 0x80290205u32 as HRESULT; +pub const TBSIMP_E_DUPLICATE_VHANDLE: HRESULT = 0x80290206u32 as HRESULT; +pub const TBSIMP_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80290207u32 as HRESULT; +pub const TBSIMP_E_INVALID_PARAMETER: HRESULT = 0x80290208u32 as HRESULT; +pub const TBSIMP_E_RPC_INIT_FAILED: HRESULT = 0x80290209u32 as HRESULT; +pub const TBSIMP_E_SCHEDULER_NOT_RUNNING: HRESULT = 0x8029020Au32 as HRESULT; +pub const TBSIMP_E_COMMAND_CANCELED: HRESULT = 0x8029020Bu32 as HRESULT; +pub const TBSIMP_E_OUT_OF_MEMORY: HRESULT = 0x8029020Cu32 as HRESULT; +pub const TBSIMP_E_LIST_NO_MORE_ITEMS: HRESULT = 0x8029020Du32 as HRESULT; +pub const TBSIMP_E_LIST_NOT_FOUND: HRESULT = 0x8029020Eu32 as HRESULT; +pub const TBSIMP_E_NOT_ENOUGH_SPACE: HRESULT = 0x8029020Fu32 as HRESULT; +pub const TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS: HRESULT = 0x80290210u32 as HRESULT; +pub const TBSIMP_E_COMMAND_FAILED: HRESULT = 0x80290211u32 as HRESULT; +pub const TBSIMP_E_UNKNOWN_ORDINAL: HRESULT = 0x80290212u32 as HRESULT; +pub const TBSIMP_E_RESOURCE_EXPIRED: HRESULT = 0x80290213u32 as HRESULT; +pub const TBSIMP_E_INVALID_RESOURCE: HRESULT = 0x80290214u32 as HRESULT; +pub const TBSIMP_E_NOTHING_TO_UNLOAD: HRESULT = 0x80290215u32 as HRESULT; +pub const TBSIMP_E_HASH_TABLE_FULL: HRESULT = 0x80290216u32 as HRESULT; +pub const TBSIMP_E_TOO_MANY_TBS_CONTEXTS: HRESULT = 0x80290217u32 as HRESULT; +pub const TBSIMP_E_TOO_MANY_RESOURCES: HRESULT = 0x80290218u32 as HRESULT; +pub const TBSIMP_E_PPI_NOT_SUPPORTED: HRESULT = 0x80290219u32 as HRESULT; +pub const TBSIMP_E_TPM_INCOMPATIBLE: HRESULT = 0x8029021Au32 as HRESULT; +pub const TBSIMP_E_NO_EVENT_LOG: HRESULT = 0x8029021Bu32 as HRESULT; +pub const TPM_E_PPI_ACPI_FAILURE: HRESULT = 0x80290300u32 as HRESULT; +pub const TPM_E_PPI_USER_ABORT: HRESULT = 0x80290301u32 as HRESULT; +pub const TPM_E_PPI_BIOS_FAILURE: HRESULT = 0x80290302u32 as HRESULT; +pub const TPM_E_PPI_NOT_SUPPORTED: HRESULT = 0x80290303u32 as HRESULT; +pub const TPM_E_PPI_BLOCKED_IN_BIOS: HRESULT = 0x80290304u32 as HRESULT; +pub const TPM_E_PCP_ERROR_MASK: HRESULT = 0x80290400u32 as HRESULT; +pub const TPM_E_PCP_DEVICE_NOT_READY: HRESULT = 0x80290401u32 as HRESULT; +pub const TPM_E_PCP_INVALID_HANDLE: HRESULT = 0x80290402u32 as HRESULT; +pub const TPM_E_PCP_INVALID_PARAMETER: HRESULT = 0x80290403u32 as HRESULT; +pub const TPM_E_PCP_FLAG_NOT_SUPPORTED: HRESULT = 0x80290404u32 as HRESULT; +pub const TPM_E_PCP_NOT_SUPPORTED: HRESULT = 0x80290405u32 as HRESULT; +pub const TPM_E_PCP_BUFFER_TOO_SMALL: HRESULT = 0x80290406u32 as HRESULT; +pub const TPM_E_PCP_INTERNAL_ERROR: HRESULT = 0x80290407u32 as HRESULT; +pub const TPM_E_PCP_AUTHENTICATION_FAILED: HRESULT = 0x80290408u32 as HRESULT; +pub const TPM_E_PCP_AUTHENTICATION_IGNORED: HRESULT = 0x80290409u32 as HRESULT; +pub const TPM_E_PCP_POLICY_NOT_FOUND: HRESULT = 0x8029040Au32 as HRESULT; +pub const TPM_E_PCP_PROFILE_NOT_FOUND: HRESULT = 0x8029040Bu32 as HRESULT; +pub const TPM_E_PCP_VALIDATION_FAILED: HRESULT = 0x8029040Cu32 as HRESULT; +pub const PLA_E_DCS_NOT_FOUND: HRESULT = 0x80300002u32 as HRESULT; +pub const PLA_E_DCS_IN_USE: HRESULT = 0x803000AAu32 as HRESULT; +pub const PLA_E_TOO_MANY_FOLDERS: HRESULT = 0x80300045u32 as HRESULT; +pub const PLA_E_NO_MIN_DISK: HRESULT = 0x80300070u32 as HRESULT; +pub const PLA_E_DCS_ALREADY_EXISTS: HRESULT = 0x803000B7u32 as HRESULT; +pub const PLA_S_PROPERTY_IGNORED: HRESULT = 0x00300100; +pub const PLA_E_PROPERTY_CONFLICT: HRESULT = 0x80300101u32 as HRESULT; +pub const PLA_E_DCS_SINGLETON_REQUIRED: HRESULT = 0x80300102u32 as HRESULT; +pub const PLA_E_CREDENTIALS_REQUIRED: HRESULT = 0x80300103u32 as HRESULT; +pub const PLA_E_DCS_NOT_RUNNING: HRESULT = 0x80300104u32 as HRESULT; +pub const PLA_E_CONFLICT_INCL_EXCL_API: HRESULT = 0x80300105u32 as HRESULT; +pub const PLA_E_NETWORK_EXE_NOT_VALID: HRESULT = 0x80300106u32 as HRESULT; +pub const PLA_E_EXE_ALREADY_CONFIGURED: HRESULT = 0x80300107u32 as HRESULT; +pub const PLA_E_EXE_PATH_NOT_VALID: HRESULT = 0x80300108u32 as HRESULT; +pub const PLA_E_DC_ALREADY_EXISTS: HRESULT = 0x80300109u32 as HRESULT; +pub const PLA_E_DCS_START_WAIT_TIMEOUT: HRESULT = 0x8030010Au32 as HRESULT; +pub const PLA_E_DC_START_WAIT_TIMEOUT: HRESULT = 0x8030010Bu32 as HRESULT; +pub const PLA_E_REPORT_WAIT_TIMEOUT: HRESULT = 0x8030010Cu32 as HRESULT; +pub const PLA_E_NO_DUPLICATES: HRESULT = 0x8030010Du32 as HRESULT; +pub const PLA_E_EXE_FULL_PATH_REQUIRED: HRESULT = 0x8030010Eu32 as HRESULT; +pub const PLA_E_INVALID_SESSION_NAME: HRESULT = 0x8030010Fu32 as HRESULT; +pub const PLA_E_PLA_CHANNEL_NOT_ENABLED: HRESULT = 0x80300110u32 as HRESULT; +pub const PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED: HRESULT = 0x80300111u32 as HRESULT; +pub const PLA_E_RULES_MANAGER_FAILED: HRESULT = 0x80300112u32 as HRESULT; +pub const PLA_E_CABAPI_FAILURE: HRESULT = 0x80300113u32 as HRESULT; +pub const FVE_E_LOCKED_VOLUME: HRESULT = 0x80310000u32 as HRESULT; +pub const FVE_E_NOT_ENCRYPTED: HRESULT = 0x80310001u32 as HRESULT; +pub const FVE_E_NO_TPM_BIOS: HRESULT = 0x80310002u32 as HRESULT; +pub const FVE_E_NO_MBR_METRIC: HRESULT = 0x80310003u32 as HRESULT; +pub const FVE_E_NO_BOOTSECTOR_METRIC: HRESULT = 0x80310004u32 as HRESULT; +pub const FVE_E_NO_BOOTMGR_METRIC: HRESULT = 0x80310005u32 as HRESULT; +pub const FVE_E_WRONG_BOOTMGR: HRESULT = 0x80310006u32 as HRESULT; +pub const FVE_E_SECURE_KEY_REQUIRED: HRESULT = 0x80310007u32 as HRESULT; +pub const FVE_E_NOT_ACTIVATED: HRESULT = 0x80310008u32 as HRESULT; +pub const FVE_E_ACTION_NOT_ALLOWED: HRESULT = 0x80310009u32 as HRESULT; +pub const FVE_E_AD_SCHEMA_NOT_INSTALLED: HRESULT = 0x8031000Au32 as HRESULT; +pub const FVE_E_AD_INVALID_DATATYPE: HRESULT = 0x8031000Bu32 as HRESULT; +pub const FVE_E_AD_INVALID_DATASIZE: HRESULT = 0x8031000Cu32 as HRESULT; +pub const FVE_E_AD_NO_VALUES: HRESULT = 0x8031000Du32 as HRESULT; +pub const FVE_E_AD_ATTR_NOT_SET: HRESULT = 0x8031000Eu32 as HRESULT; +pub const FVE_E_AD_GUID_NOT_FOUND: HRESULT = 0x8031000Fu32 as HRESULT; +pub const FVE_E_BAD_INFORMATION: HRESULT = 0x80310010u32 as HRESULT; +pub const FVE_E_TOO_SMALL: HRESULT = 0x80310011u32 as HRESULT; +pub const FVE_E_SYSTEM_VOLUME: HRESULT = 0x80310012u32 as HRESULT; +pub const FVE_E_FAILED_WRONG_FS: HRESULT = 0x80310013u32 as HRESULT; +pub const FVE_E_BAD_PARTITION_SIZE: HRESULT = 0x80310014u32 as HRESULT; +pub const FVE_E_NOT_SUPPORTED: HRESULT = 0x80310015u32 as HRESULT; +pub const FVE_E_BAD_DATA: HRESULT = 0x80310016u32 as HRESULT; +pub const FVE_E_VOLUME_NOT_BOUND: HRESULT = 0x80310017u32 as HRESULT; +pub const FVE_E_TPM_NOT_OWNED: HRESULT = 0x80310018u32 as HRESULT; +pub const FVE_E_NOT_DATA_VOLUME: HRESULT = 0x80310019u32 as HRESULT; +pub const FVE_E_AD_INSUFFICIENT_BUFFER: HRESULT = 0x8031001Au32 as HRESULT; +pub const FVE_E_CONV_READ: HRESULT = 0x8031001Bu32 as HRESULT; +pub const FVE_E_CONV_WRITE: HRESULT = 0x8031001Cu32 as HRESULT; +pub const FVE_E_KEY_REQUIRED: HRESULT = 0x8031001Du32 as HRESULT; +pub const FVE_E_CLUSTERING_NOT_SUPPORTED: HRESULT = 0x8031001Eu32 as HRESULT; +pub const FVE_E_VOLUME_BOUND_ALREADY: HRESULT = 0x8031001Fu32 as HRESULT; +pub const FVE_E_OS_NOT_PROTECTED: HRESULT = 0x80310020u32 as HRESULT; +pub const FVE_E_PROTECTION_DISABLED: HRESULT = 0x80310021u32 as HRESULT; +pub const FVE_E_RECOVERY_KEY_REQUIRED: HRESULT = 0x80310022u32 as HRESULT; +pub const FVE_E_FOREIGN_VOLUME: HRESULT = 0x80310023u32 as HRESULT; +pub const FVE_E_OVERLAPPED_UPDATE: HRESULT = 0x80310024u32 as HRESULT; +pub const FVE_E_TPM_SRK_AUTH_NOT_ZERO: HRESULT = 0x80310025u32 as HRESULT; +pub const FVE_E_FAILED_SECTOR_SIZE: HRESULT = 0x80310026u32 as HRESULT; +pub const FVE_E_FAILED_AUTHENTICATION: HRESULT = 0x80310027u32 as HRESULT; +pub const FVE_E_NOT_OS_VOLUME: HRESULT = 0x80310028u32 as HRESULT; +pub const FVE_E_AUTOUNLOCK_ENABLED: HRESULT = 0x80310029u32 as HRESULT; +pub const FVE_E_WRONG_BOOTSECTOR: HRESULT = 0x8031002Au32 as HRESULT; +pub const FVE_E_WRONG_SYSTEM_FS: HRESULT = 0x8031002Bu32 as HRESULT; +pub const FVE_E_POLICY_PASSWORD_REQUIRED: HRESULT = 0x8031002Cu32 as HRESULT; +pub const FVE_E_CANNOT_SET_FVEK_ENCRYPTED: HRESULT = 0x8031002Du32 as HRESULT; +pub const FVE_E_CANNOT_ENCRYPT_NO_KEY: HRESULT = 0x8031002Eu32 as HRESULT; +pub const FVE_E_BOOTABLE_CDDVD: HRESULT = 0x80310030u32 as HRESULT; +pub const FVE_E_PROTECTOR_EXISTS: HRESULT = 0x80310031u32 as HRESULT; +pub const FVE_E_RELATIVE_PATH: HRESULT = 0x80310032u32 as HRESULT; +pub const FVE_E_PROTECTOR_NOT_FOUND: HRESULT = 0x80310033u32 as HRESULT; +pub const FVE_E_INVALID_KEY_FORMAT: HRESULT = 0x80310034u32 as HRESULT; +pub const FVE_E_INVALID_PASSWORD_FORMAT: HRESULT = 0x80310035u32 as HRESULT; +pub const FVE_E_FIPS_RNG_CHECK_FAILED: HRESULT = 0x80310036u32 as HRESULT; +pub const FVE_E_FIPS_PREVENTS_RECOVERY_PASSWORD: HRESULT = 0x80310037u32 as HRESULT; +pub const FVE_E_FIPS_PREVENTS_EXTERNAL_KEY_EXPORT: HRESULT = 0x80310038u32 as HRESULT; +pub const FVE_E_NOT_DECRYPTED: HRESULT = 0x80310039u32 as HRESULT; +pub const FVE_E_INVALID_PROTECTOR_TYPE: HRESULT = 0x8031003Au32 as HRESULT; +pub const FVE_E_NO_PROTECTORS_TO_TEST: HRESULT = 0x8031003Bu32 as HRESULT; +pub const FVE_E_KEYFILE_NOT_FOUND: HRESULT = 0x8031003Cu32 as HRESULT; +pub const FVE_E_KEYFILE_INVALID: HRESULT = 0x8031003Du32 as HRESULT; +pub const FVE_E_KEYFILE_NO_VMK: HRESULT = 0x8031003Eu32 as HRESULT; +pub const FVE_E_TPM_DISABLED: HRESULT = 0x8031003Fu32 as HRESULT; +pub const FVE_E_NOT_ALLOWED_IN_SAFE_MODE: HRESULT = 0x80310040u32 as HRESULT; +pub const FVE_E_TPM_INVALID_PCR: HRESULT = 0x80310041u32 as HRESULT; +pub const FVE_E_TPM_NO_VMK: HRESULT = 0x80310042u32 as HRESULT; +pub const FVE_E_PIN_INVALID: HRESULT = 0x80310043u32 as HRESULT; +pub const FVE_E_AUTH_INVALID_APPLICATION: HRESULT = 0x80310044u32 as HRESULT; +pub const FVE_E_AUTH_INVALID_CONFIG: HRESULT = 0x80310045u32 as HRESULT; +pub const FVE_E_FIPS_DISABLE_PROTECTION_NOT_ALLOWED: HRESULT = 0x80310046u32 as HRESULT; +pub const FVE_E_FS_NOT_EXTENDED: HRESULT = 0x80310047u32 as HRESULT; +pub const FVE_E_FIRMWARE_TYPE_NOT_SUPPORTED: HRESULT = 0x80310048u32 as HRESULT; +pub const FVE_E_NO_LICENSE: HRESULT = 0x80310049u32 as HRESULT; +pub const FVE_E_NOT_ON_STACK: HRESULT = 0x8031004Au32 as HRESULT; +pub const FVE_E_FS_MOUNTED: HRESULT = 0x8031004Bu32 as HRESULT; +pub const FVE_E_TOKEN_NOT_IMPERSONATED: HRESULT = 0x8031004Cu32 as HRESULT; +pub const FVE_E_DRY_RUN_FAILED: HRESULT = 0x8031004Du32 as HRESULT; +pub const FVE_E_REBOOT_REQUIRED: HRESULT = 0x8031004Eu32 as HRESULT; +pub const FVE_E_DEBUGGER_ENABLED: HRESULT = 0x8031004Fu32 as HRESULT; +pub const FVE_E_RAW_ACCESS: HRESULT = 0x80310050u32 as HRESULT; +pub const FVE_E_RAW_BLOCKED: HRESULT = 0x80310051u32 as HRESULT; +pub const FVE_E_BCD_APPLICATIONS_PATH_INCORRECT: HRESULT = 0x80310052u32 as HRESULT; +pub const FVE_E_NOT_ALLOWED_IN_VERSION: HRESULT = 0x80310053u32 as HRESULT; +pub const FVE_E_NO_AUTOUNLOCK_MASTER_KEY: HRESULT = 0x80310054u32 as HRESULT; +pub const FVE_E_MOR_FAILED: HRESULT = 0x80310055u32 as HRESULT; +pub const FVE_E_HIDDEN_VOLUME: HRESULT = 0x80310056u32 as HRESULT; +pub const FVE_E_TRANSIENT_STATE: HRESULT = 0x80310057u32 as HRESULT; +pub const FVE_E_PUBKEY_NOT_ALLOWED: HRESULT = 0x80310058u32 as HRESULT; +pub const FVE_E_VOLUME_HANDLE_OPEN: HRESULT = 0x80310059u32 as HRESULT; +pub const FVE_E_NO_FEATURE_LICENSE: HRESULT = 0x8031005Au32 as HRESULT; +pub const FVE_E_INVALID_STARTUP_OPTIONS: HRESULT = 0x8031005Bu32 as HRESULT; +pub const FVE_E_POLICY_RECOVERY_PASSWORD_NOT_ALLOWED: HRESULT = 0x8031005Cu32 as HRESULT; +pub const FVE_E_POLICY_RECOVERY_PASSWORD_REQUIRED: HRESULT = 0x8031005Du32 as HRESULT; +pub const FVE_E_POLICY_RECOVERY_KEY_NOT_ALLOWED: HRESULT = 0x8031005Eu32 as HRESULT; +pub const FVE_E_POLICY_RECOVERY_KEY_REQUIRED: HRESULT = 0x8031005Fu32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_PIN_NOT_ALLOWED: HRESULT = 0x80310060u32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_PIN_REQUIRED: HRESULT = 0x80310061u32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_KEY_NOT_ALLOWED: HRESULT = 0x80310062u32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_KEY_REQUIRED: HRESULT = 0x80310063u32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_PIN_KEY_NOT_ALLOWED: HRESULT = 0x80310064u32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_PIN_KEY_REQUIRED: HRESULT = 0x80310065u32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_TPM_NOT_ALLOWED: HRESULT = 0x80310066u32 as HRESULT; +pub const FVE_E_POLICY_STARTUP_TPM_REQUIRED: HRESULT = 0x80310067u32 as HRESULT; +pub const FVE_E_POLICY_INVALID_PIN_LENGTH: HRESULT = 0x80310068u32 as HRESULT; +pub const FVE_E_KEY_PROTECTOR_NOT_SUPPORTED: HRESULT = 0x80310069u32 as HRESULT; +pub const FVE_E_POLICY_PASSPHRASE_NOT_ALLOWED: HRESULT = 0x8031006Au32 as HRESULT; +pub const FVE_E_POLICY_PASSPHRASE_REQUIRED: HRESULT = 0x8031006Bu32 as HRESULT; +pub const FVE_E_FIPS_PREVENTS_PASSPHRASE: HRESULT = 0x8031006Cu32 as HRESULT; +pub const FVE_E_OS_VOLUME_PASSPHRASE_NOT_ALLOWED: HRESULT = 0x8031006Du32 as HRESULT; +pub const FVE_E_INVALID_BITLOCKER_OID: HRESULT = 0x8031006Eu32 as HRESULT; +pub const FVE_E_VOLUME_TOO_SMALL: HRESULT = 0x8031006Fu32 as HRESULT; +pub const FVE_E_DV_NOT_SUPPORTED_ON_FS: HRESULT = 0x80310070u32 as HRESULT; +pub const FVE_E_DV_NOT_ALLOWED_BY_GP: HRESULT = 0x80310071u32 as HRESULT; +pub const FVE_E_POLICY_USER_CERTIFICATE_NOT_ALLOWED: HRESULT = 0x80310072u32 as HRESULT; +pub const FVE_E_POLICY_USER_CERTIFICATE_REQUIRED: HRESULT = 0x80310073u32 as HRESULT; +pub const FVE_E_POLICY_USER_CERT_MUST_BE_HW: HRESULT = 0x80310074u32 as HRESULT; +pub const FVE_E_POLICY_USER_CONFIGURE_FDV_AUTOUNLOCK_NOT_ALLOWED: HRESULT = 0x80310075u32 as HRESULT; +pub const FVE_E_POLICY_USER_CONFIGURE_RDV_AUTOUNLOCK_NOT_ALLOWED: HRESULT = 0x80310076u32 as HRESULT; +pub const FVE_E_POLICY_USER_CONFIGURE_RDV_NOT_ALLOWED: HRESULT = 0x80310077u32 as HRESULT; +pub const FVE_E_POLICY_USER_ENABLE_RDV_NOT_ALLOWED: HRESULT = 0x80310078u32 as HRESULT; +pub const FVE_E_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: HRESULT = 0x80310079u32 as HRESULT; +pub const FVE_E_POLICY_INVALID_PASSPHRASE_LENGTH: HRESULT = 0x80310080u32 as HRESULT; +pub const FVE_E_POLICY_PASSPHRASE_TOO_SIMPLE: HRESULT = 0x80310081u32 as HRESULT; +pub const FVE_E_RECOVERY_PARTITION: HRESULT = 0x80310082u32 as HRESULT; +pub const FVE_E_POLICY_CONFLICT_FDV_RK_OFF_AUK_ON: HRESULT = 0x80310083u32 as HRESULT; +pub const FVE_E_POLICY_CONFLICT_RDV_RK_OFF_AUK_ON: HRESULT = 0x80310084u32 as HRESULT; +pub const FVE_E_NON_BITLOCKER_OID: HRESULT = 0x80310085u32 as HRESULT; +pub const FVE_E_POLICY_PROHIBITS_SELFSIGNED: HRESULT = 0x80310086u32 as HRESULT; +pub const FVE_E_POLICY_CONFLICT_RO_AND_STARTUP_KEY_REQUIRED: HRESULT = 0x80310087u32 as HRESULT; +pub const FVE_E_CONV_RECOVERY_FAILED: HRESULT = 0x80310088u32 as HRESULT; +pub const FVE_E_VIRTUALIZED_SPACE_TOO_BIG: HRESULT = 0x80310089u32 as HRESULT; +pub const FVE_E_POLICY_CONFLICT_OSV_RP_OFF_ADB_ON: HRESULT = 0x80310090u32 as HRESULT; +pub const FVE_E_POLICY_CONFLICT_FDV_RP_OFF_ADB_ON: HRESULT = 0x80310091u32 as HRESULT; +pub const FVE_E_POLICY_CONFLICT_RDV_RP_OFF_ADB_ON: HRESULT = 0x80310092u32 as HRESULT; +pub const FVE_E_NON_BITLOCKER_KU: HRESULT = 0x80310093u32 as HRESULT; +pub const FVE_E_PRIVATEKEY_AUTH_FAILED: HRESULT = 0x80310094u32 as HRESULT; +pub const FVE_E_REMOVAL_OF_DRA_FAILED: HRESULT = 0x80310095u32 as HRESULT; +pub const FVE_E_OPERATION_NOT_SUPPORTED_ON_VISTA_VOLUME: HRESULT = 0x80310096u32 as HRESULT; +pub const FVE_E_CANT_LOCK_AUTOUNLOCK_ENABLED_VOLUME: HRESULT = 0x80310097u32 as HRESULT; +pub const FVE_E_FIPS_HASH_KDF_NOT_ALLOWED: HRESULT = 0x80310098u32 as HRESULT; +pub const FVE_E_ENH_PIN_INVALID: HRESULT = 0x80310099u32 as HRESULT; +pub const FVE_E_INVALID_PIN_CHARS: HRESULT = 0x8031009Au32 as HRESULT; +pub const FVE_E_INVALID_DATUM_TYPE: HRESULT = 0x8031009Bu32 as HRESULT; +pub const FVE_E_EFI_ONLY: HRESULT = 0x8031009Cu32 as HRESULT; +pub const FVE_E_MULTIPLE_NKP_CERTS: HRESULT = 0x8031009Du32 as HRESULT; +pub const FVE_E_REMOVAL_OF_NKP_FAILED: HRESULT = 0x8031009Eu32 as HRESULT; +pub const FVE_E_INVALID_NKP_CERT: HRESULT = 0x8031009Fu32 as HRESULT; +pub const FVE_E_NO_EXISTING_PIN: HRESULT = 0x803100A0u32 as HRESULT; +pub const FVE_E_PROTECTOR_CHANGE_PIN_MISMATCH: HRESULT = 0x803100A1u32 as HRESULT; +pub const FVE_E_PIN_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED: HRESULT = 0x803100A2u32 as HRESULT; +pub const FVE_E_PROTECTOR_CHANGE_MAX_PIN_CHANGE_ATTEMPTS_REACHED: HRESULT = 0x803100A3u32 as HRESULT; +pub const FVE_E_POLICY_PASSPHRASE_REQUIRES_ASCII: HRESULT = 0x803100A4u32 as HRESULT; +pub const FVE_E_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE: HRESULT = 0x803100A5u32 as HRESULT; +pub const FVE_E_WIPE_NOT_ALLOWED_ON_TP_STORAGE: HRESULT = 0x803100A6u32 as HRESULT; +pub const FVE_E_KEY_LENGTH_NOT_SUPPORTED_BY_EDRIVE: HRESULT = 0x803100A7u32 as HRESULT; +pub const FVE_E_NO_EXISTING_PASSPHRASE: HRESULT = 0x803100A8u32 as HRESULT; +pub const FVE_E_PROTECTOR_CHANGE_PASSPHRASE_MISMATCH: HRESULT = 0x803100A9u32 as HRESULT; +pub const FVE_E_PASSPHRASE_TOO_LONG: HRESULT = 0x803100AAu32 as HRESULT; +pub const FVE_E_NO_PASSPHRASE_WITH_TPM: HRESULT = 0x803100ABu32 as HRESULT; +pub const FVE_E_NO_TPM_WITH_PASSPHRASE: HRESULT = 0x803100ACu32 as HRESULT; +pub const FVE_E_NOT_ALLOWED_ON_CSV_STACK: HRESULT = 0x803100ADu32 as HRESULT; +pub const FVE_E_NOT_ALLOWED_ON_CLUSTER: HRESULT = 0x803100AEu32 as HRESULT; +pub const FVE_E_EDRIVE_NO_FAILOVER_TO_SW: HRESULT = 0x803100AFu32 as HRESULT; +pub const FVE_E_EDRIVE_BAND_IN_USE: HRESULT = 0x803100B0u32 as HRESULT; +pub const FVE_E_EDRIVE_DISALLOWED_BY_GP: HRESULT = 0x803100B1u32 as HRESULT; +pub const FVE_E_EDRIVE_INCOMPATIBLE_VOLUME: HRESULT = 0x803100B2u32 as HRESULT; +pub const FVE_E_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING: HRESULT = 0x803100B3u32 as HRESULT; +pub const FVE_E_EDRIVE_DV_NOT_SUPPORTED: HRESULT = 0x803100B4u32 as HRESULT; +pub const FVE_E_NO_PREBOOT_KEYBOARD_DETECTED: HRESULT = 0x803100B5u32 as HRESULT; +pub const FVE_E_NO_PREBOOT_KEYBOARD_OR_WINRE_DETECTED: HRESULT = 0x803100B6u32 as HRESULT; +pub const FVE_E_POLICY_REQUIRES_STARTUP_PIN_ON_TOUCH_DEVICE: HRESULT = 0x803100B7u32 as HRESULT; +pub const FVE_E_POLICY_REQUIRES_RECOVERY_PASSWORD_ON_TOUCH_DEVICE: HRESULT = 0x803100B8u32 as HRESULT; +pub const FVE_E_WIPE_CANCEL_NOT_APPLICABLE: HRESULT = 0x803100B9u32 as HRESULT; +pub const FVE_E_SECUREBOOT_DISABLED: HRESULT = 0x803100BAu32 as HRESULT; +pub const FVE_E_SECUREBOOT_CONFIGURATION_INVALID: HRESULT = 0x803100BBu32 as HRESULT; +pub const FVE_E_EDRIVE_DRY_RUN_FAILED: HRESULT = 0x803100BCu32 as HRESULT; +pub const FVE_E_SHADOW_COPY_PRESENT: HRESULT = 0x803100BDu32 as HRESULT; +pub const FVE_E_POLICY_INVALID_ENHANCED_BCD_SETTINGS: HRESULT = 0x803100BEu32 as HRESULT; +pub const FVE_E_EDRIVE_INCOMPATIBLE_FIRMWARE: HRESULT = 0x803100BFu32 as HRESULT; +pub const FVE_E_PROTECTOR_CHANGE_MAX_PASSPHRASE_CHANGE_ATTEMPTS_REACHED: HRESULT = 0x803100C0u32 as HRESULT; +pub const FVE_E_PASSPHRASE_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED: HRESULT = 0x803100C1u32 as HRESULT; +pub const FVE_E_LIVEID_ACCOUNT_SUSPENDED: HRESULT = 0x803100C2u32 as HRESULT; +pub const FVE_E_LIVEID_ACCOUNT_BLOCKED: HRESULT = 0x803100C3u32 as HRESULT; +pub const FVE_E_NOT_PROVISIONED_ON_ALL_VOLUMES: HRESULT = 0x803100C4u32 as HRESULT; +pub const FVE_E_DE_FIXED_DATA_NOT_SUPPORTED: HRESULT = 0x803100C5u32 as HRESULT; +pub const FVE_E_DE_HARDWARE_NOT_COMPLIANT: HRESULT = 0x803100C6u32 as HRESULT; +pub const FVE_E_DE_WINRE_NOT_CONFIGURED: HRESULT = 0x803100C7u32 as HRESULT; +pub const FVE_E_DE_PROTECTION_SUSPENDED: HRESULT = 0x803100C8u32 as HRESULT; +pub const FVE_E_DE_OS_VOLUME_NOT_PROTECTED: HRESULT = 0x803100C9u32 as HRESULT; +pub const FVE_E_DE_DEVICE_LOCKEDOUT: HRESULT = 0x803100CAu32 as HRESULT; +pub const FVE_E_DE_PROTECTION_NOT_YET_ENABLED: HRESULT = 0x803100CBu32 as HRESULT; +pub const FVE_E_INVALID_PIN_CHARS_DETAILED: HRESULT = 0x803100CCu32 as HRESULT; +pub const FVE_E_DEVICE_LOCKOUT_COUNTER_UNAVAILABLE: HRESULT = 0x803100CDu32 as HRESULT; +pub const FVE_E_DEVICELOCKOUT_COUNTER_MISMATCH: HRESULT = 0x803100CEu32 as HRESULT; +pub const FVE_E_BUFFER_TOO_LARGE: HRESULT = 0x803100CFu32 as HRESULT; +pub const FVE_E_NO_SUCH_CAPABILITY_ON_TARGET: HRESULT = 0x803100D0u32 as HRESULT; +pub const FVE_E_DE_PREVENTED_FOR_OS: HRESULT = 0x803100D1u32 as HRESULT; +pub const FVE_E_DE_VOLUME_OPTED_OUT: HRESULT = 0x803100D2u32 as HRESULT; +pub const FVE_E_DE_VOLUME_NOT_SUPPORTED: HRESULT = 0x803100D3u32 as HRESULT; +pub const FVE_E_EOW_NOT_SUPPORTED_IN_VERSION: HRESULT = 0x803100D4u32 as HRESULT; +pub const FVE_E_ADBACKUP_NOT_ENABLED: HRESULT = 0x803100D5u32 as HRESULT; +pub const FVE_E_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT: HRESULT = 0x803100D6u32 as HRESULT; +pub const FVE_E_NOT_DE_VOLUME: HRESULT = 0x803100D7u32 as HRESULT; +pub const FVE_E_PROTECTION_CANNOT_BE_DISABLED: HRESULT = 0x803100D8u32 as HRESULT; +pub const FWP_E_CALLOUT_NOT_FOUND: HRESULT = 0x80320001u32 as HRESULT; +pub const FWP_E_CONDITION_NOT_FOUND: HRESULT = 0x80320002u32 as HRESULT; +pub const FWP_E_FILTER_NOT_FOUND: HRESULT = 0x80320003u32 as HRESULT; +pub const FWP_E_LAYER_NOT_FOUND: HRESULT = 0x80320004u32 as HRESULT; +pub const FWP_E_PROVIDER_NOT_FOUND: HRESULT = 0x80320005u32 as HRESULT; +pub const FWP_E_PROVIDER_CONTEXT_NOT_FOUND: HRESULT = 0x80320006u32 as HRESULT; +pub const FWP_E_SUBLAYER_NOT_FOUND: HRESULT = 0x80320007u32 as HRESULT; +pub const FWP_E_NOT_FOUND: HRESULT = 0x80320008u32 as HRESULT; +pub const FWP_E_ALREADY_EXISTS: HRESULT = 0x80320009u32 as HRESULT; +pub const FWP_E_IN_USE: HRESULT = 0x8032000Au32 as HRESULT; +pub const FWP_E_DYNAMIC_SESSION_IN_PROGRESS: HRESULT = 0x8032000Bu32 as HRESULT; +pub const FWP_E_WRONG_SESSION: HRESULT = 0x8032000Cu32 as HRESULT; +pub const FWP_E_NO_TXN_IN_PROGRESS: HRESULT = 0x8032000Du32 as HRESULT; +pub const FWP_E_TXN_IN_PROGRESS: HRESULT = 0x8032000Eu32 as HRESULT; +pub const FWP_E_TXN_ABORTED: HRESULT = 0x8032000Fu32 as HRESULT; +pub const FWP_E_SESSION_ABORTED: HRESULT = 0x80320010u32 as HRESULT; +pub const FWP_E_INCOMPATIBLE_TXN: HRESULT = 0x80320011u32 as HRESULT; +pub const FWP_E_TIMEOUT: HRESULT = 0x80320012u32 as HRESULT; +pub const FWP_E_NET_EVENTS_DISABLED: HRESULT = 0x80320013u32 as HRESULT; +pub const FWP_E_INCOMPATIBLE_LAYER: HRESULT = 0x80320014u32 as HRESULT; +pub const FWP_E_KM_CLIENTS_ONLY: HRESULT = 0x80320015u32 as HRESULT; +pub const FWP_E_LIFETIME_MISMATCH: HRESULT = 0x80320016u32 as HRESULT; +pub const FWP_E_BUILTIN_OBJECT: HRESULT = 0x80320017u32 as HRESULT; +pub const FWP_E_TOO_MANY_CALLOUTS: HRESULT = 0x80320018u32 as HRESULT; +pub const FWP_E_NOTIFICATION_DROPPED: HRESULT = 0x80320019u32 as HRESULT; +pub const FWP_E_TRAFFIC_MISMATCH: HRESULT = 0x8032001Au32 as HRESULT; +pub const FWP_E_INCOMPATIBLE_SA_STATE: HRESULT = 0x8032001Bu32 as HRESULT; +pub const FWP_E_NULL_POINTER: HRESULT = 0x8032001Cu32 as HRESULT; +pub const FWP_E_INVALID_ENUMERATOR: HRESULT = 0x8032001Du32 as HRESULT; +pub const FWP_E_INVALID_FLAGS: HRESULT = 0x8032001Eu32 as HRESULT; +pub const FWP_E_INVALID_NET_MASK: HRESULT = 0x8032001Fu32 as HRESULT; +pub const FWP_E_INVALID_RANGE: HRESULT = 0x80320020u32 as HRESULT; +pub const FWP_E_INVALID_INTERVAL: HRESULT = 0x80320021u32 as HRESULT; +pub const FWP_E_ZERO_LENGTH_ARRAY: HRESULT = 0x80320022u32 as HRESULT; +pub const FWP_E_NULL_DISPLAY_NAME: HRESULT = 0x80320023u32 as HRESULT; +pub const FWP_E_INVALID_ACTION_TYPE: HRESULT = 0x80320024u32 as HRESULT; +pub const FWP_E_INVALID_WEIGHT: HRESULT = 0x80320025u32 as HRESULT; +pub const FWP_E_MATCH_TYPE_MISMATCH: HRESULT = 0x80320026u32 as HRESULT; +pub const FWP_E_TYPE_MISMATCH: HRESULT = 0x80320027u32 as HRESULT; +pub const FWP_E_OUT_OF_BOUNDS: HRESULT = 0x80320028u32 as HRESULT; +pub const FWP_E_RESERVED: HRESULT = 0x80320029u32 as HRESULT; +pub const FWP_E_DUPLICATE_CONDITION: HRESULT = 0x8032002Au32 as HRESULT; +pub const FWP_E_DUPLICATE_KEYMOD: HRESULT = 0x8032002Bu32 as HRESULT; +pub const FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER: HRESULT = 0x8032002Cu32 as HRESULT; +pub const FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER: HRESULT = 0x8032002Du32 as HRESULT; +pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER: HRESULT = 0x8032002Eu32 as HRESULT; +pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: HRESULT = 0x8032002Fu32 as HRESULT; +pub const FWP_E_INCOMPATIBLE_AUTH_METHOD: HRESULT = 0x80320030u32 as HRESULT; +pub const FWP_E_INCOMPATIBLE_DH_GROUP: HRESULT = 0x80320031u32 as HRESULT; +pub const FWP_E_EM_NOT_SUPPORTED: HRESULT = 0x80320032u32 as HRESULT; +pub const FWP_E_NEVER_MATCH: HRESULT = 0x80320033u32 as HRESULT; +pub const FWP_E_PROVIDER_CONTEXT_MISMATCH: HRESULT = 0x80320034u32 as HRESULT; +pub const FWP_E_INVALID_PARAMETER: HRESULT = 0x80320035u32 as HRESULT; +pub const FWP_E_TOO_MANY_SUBLAYERS: HRESULT = 0x80320036u32 as HRESULT; +pub const FWP_E_CALLOUT_NOTIFICATION_FAILED: HRESULT = 0x80320037u32 as HRESULT; +pub const FWP_E_INVALID_AUTH_TRANSFORM: HRESULT = 0x80320038u32 as HRESULT; +pub const FWP_E_INVALID_CIPHER_TRANSFORM: HRESULT = 0x80320039u32 as HRESULT; +pub const FWP_E_INCOMPATIBLE_CIPHER_TRANSFORM: HRESULT = 0x8032003Au32 as HRESULT; +pub const FWP_E_INVALID_TRANSFORM_COMBINATION: HRESULT = 0x8032003Bu32 as HRESULT; +pub const FWP_E_DUPLICATE_AUTH_METHOD: HRESULT = 0x8032003Cu32 as HRESULT; +pub const FWP_E_INVALID_TUNNEL_ENDPOINT: HRESULT = 0x8032003Du32 as HRESULT; +pub const FWP_E_L2_DRIVER_NOT_READY: HRESULT = 0x8032003Eu32 as HRESULT; +pub const FWP_E_KEY_DICTATOR_ALREADY_REGISTERED: HRESULT = 0x8032003Fu32 as HRESULT; +pub const FWP_E_KEY_DICTATION_INVALID_KEYING_MATERIAL: HRESULT = 0x80320040u32 as HRESULT; +pub const FWP_E_CONNECTIONS_DISABLED: HRESULT = 0x80320041u32 as HRESULT; +pub const FWP_E_INVALID_DNS_NAME: HRESULT = 0x80320042u32 as HRESULT; +pub const FWP_E_STILL_ON: HRESULT = 0x80320043u32 as HRESULT; +pub const FWP_E_IKEEXT_NOT_RUNNING: HRESULT = 0x80320044u32 as HRESULT; +pub const FWP_E_DROP_NOICMP: HRESULT = 0x80320104u32 as HRESULT; +pub const WS_S_ASYNC: HRESULT = 0x003D0000; +pub const WS_S_END: HRESULT = 0x003D0001; +pub const WS_E_INVALID_FORMAT: HRESULT = 0x803D0000u32 as HRESULT; +pub const WS_E_OBJECT_FAULTED: HRESULT = 0x803D0001u32 as HRESULT; +pub const WS_E_NUMERIC_OVERFLOW: HRESULT = 0x803D0002u32 as HRESULT; +pub const WS_E_INVALID_OPERATION: HRESULT = 0x803D0003u32 as HRESULT; +pub const WS_E_OPERATION_ABORTED: HRESULT = 0x803D0004u32 as HRESULT; +pub const WS_E_ENDPOINT_ACCESS_DENIED: HRESULT = 0x803D0005u32 as HRESULT; +pub const WS_E_OPERATION_TIMED_OUT: HRESULT = 0x803D0006u32 as HRESULT; +pub const WS_E_OPERATION_ABANDONED: HRESULT = 0x803D0007u32 as HRESULT; +pub const WS_E_QUOTA_EXCEEDED: HRESULT = 0x803D0008u32 as HRESULT; +pub const WS_E_NO_TRANSLATION_AVAILABLE: HRESULT = 0x803D0009u32 as HRESULT; +pub const WS_E_SECURITY_VERIFICATION_FAILURE: HRESULT = 0x803D000Au32 as HRESULT; +pub const WS_E_ADDRESS_IN_USE: HRESULT = 0x803D000Bu32 as HRESULT; +pub const WS_E_ADDRESS_NOT_AVAILABLE: HRESULT = 0x803D000Cu32 as HRESULT; +pub const WS_E_ENDPOINT_NOT_FOUND: HRESULT = 0x803D000Du32 as HRESULT; +pub const WS_E_ENDPOINT_NOT_AVAILABLE: HRESULT = 0x803D000Eu32 as HRESULT; +pub const WS_E_ENDPOINT_FAILURE: HRESULT = 0x803D000Fu32 as HRESULT; +pub const WS_E_ENDPOINT_UNREACHABLE: HRESULT = 0x803D0010u32 as HRESULT; +pub const WS_E_ENDPOINT_ACTION_NOT_SUPPORTED: HRESULT = 0x803D0011u32 as HRESULT; +pub const WS_E_ENDPOINT_TOO_BUSY: HRESULT = 0x803D0012u32 as HRESULT; +pub const WS_E_ENDPOINT_FAULT_RECEIVED: HRESULT = 0x803D0013u32 as HRESULT; +pub const WS_E_ENDPOINT_DISCONNECTED: HRESULT = 0x803D0014u32 as HRESULT; +pub const WS_E_PROXY_FAILURE: HRESULT = 0x803D0015u32 as HRESULT; +pub const WS_E_PROXY_ACCESS_DENIED: HRESULT = 0x803D0016u32 as HRESULT; +pub const WS_E_NOT_SUPPORTED: HRESULT = 0x803D0017u32 as HRESULT; +pub const WS_E_PROXY_REQUIRES_BASIC_AUTH: HRESULT = 0x803D0018u32 as HRESULT; +pub const WS_E_PROXY_REQUIRES_DIGEST_AUTH: HRESULT = 0x803D0019u32 as HRESULT; +pub const WS_E_PROXY_REQUIRES_NTLM_AUTH: HRESULT = 0x803D001Au32 as HRESULT; +pub const WS_E_PROXY_REQUIRES_NEGOTIATE_AUTH: HRESULT = 0x803D001Bu32 as HRESULT; +pub const WS_E_SERVER_REQUIRES_BASIC_AUTH: HRESULT = 0x803D001Cu32 as HRESULT; +pub const WS_E_SERVER_REQUIRES_DIGEST_AUTH: HRESULT = 0x803D001Du32 as HRESULT; +pub const WS_E_SERVER_REQUIRES_NTLM_AUTH: HRESULT = 0x803D001Eu32 as HRESULT; +pub const WS_E_SERVER_REQUIRES_NEGOTIATE_AUTH: HRESULT = 0x803D001Fu32 as HRESULT; +pub const WS_E_INVALID_ENDPOINT_URL: HRESULT = 0x803D0020u32 as HRESULT; +pub const WS_E_OTHER: HRESULT = 0x803D0021u32 as HRESULT; +pub const WS_E_SECURITY_TOKEN_EXPIRED: HRESULT = 0x803D0022u32 as HRESULT; +pub const WS_E_SECURITY_SYSTEM_FAILURE: HRESULT = 0x803D0023u32 as HRESULT; +pub const ERROR_NDIS_INTERFACE_CLOSING: HRESULT = 0x80340002u32 as HRESULT; +pub const ERROR_NDIS_BAD_VERSION: HRESULT = 0x80340004u32 as HRESULT; +pub const ERROR_NDIS_BAD_CHARACTERISTICS: HRESULT = 0x80340005u32 as HRESULT; +pub const ERROR_NDIS_ADAPTER_NOT_FOUND: HRESULT = 0x80340006u32 as HRESULT; +pub const ERROR_NDIS_OPEN_FAILED: HRESULT = 0x80340007u32 as HRESULT; +pub const ERROR_NDIS_DEVICE_FAILED: HRESULT = 0x80340008u32 as HRESULT; +pub const ERROR_NDIS_MULTICAST_FULL: HRESULT = 0x80340009u32 as HRESULT; +pub const ERROR_NDIS_MULTICAST_EXISTS: HRESULT = 0x8034000Au32 as HRESULT; +pub const ERROR_NDIS_MULTICAST_NOT_FOUND: HRESULT = 0x8034000Bu32 as HRESULT; +pub const ERROR_NDIS_REQUEST_ABORTED: HRESULT = 0x8034000Cu32 as HRESULT; +pub const ERROR_NDIS_RESET_IN_PROGRESS: HRESULT = 0x8034000Du32 as HRESULT; +pub const ERROR_NDIS_NOT_SUPPORTED: HRESULT = 0x803400BBu32 as HRESULT; +pub const ERROR_NDIS_INVALID_PACKET: HRESULT = 0x8034000Fu32 as HRESULT; +pub const ERROR_NDIS_ADAPTER_NOT_READY: HRESULT = 0x80340011u32 as HRESULT; +pub const ERROR_NDIS_INVALID_LENGTH: HRESULT = 0x80340014u32 as HRESULT; +pub const ERROR_NDIS_INVALID_DATA: HRESULT = 0x80340015u32 as HRESULT; +pub const ERROR_NDIS_BUFFER_TOO_SHORT: HRESULT = 0x80340016u32 as HRESULT; +pub const ERROR_NDIS_INVALID_OID: HRESULT = 0x80340017u32 as HRESULT; +pub const ERROR_NDIS_ADAPTER_REMOVED: HRESULT = 0x80340018u32 as HRESULT; +pub const ERROR_NDIS_UNSUPPORTED_MEDIA: HRESULT = 0x80340019u32 as HRESULT; +pub const ERROR_NDIS_GROUP_ADDRESS_IN_USE: HRESULT = 0x8034001Au32 as HRESULT; +pub const ERROR_NDIS_FILE_NOT_FOUND: HRESULT = 0x8034001Bu32 as HRESULT; +pub const ERROR_NDIS_ERROR_READING_FILE: HRESULT = 0x8034001Cu32 as HRESULT; +pub const ERROR_NDIS_ALREADY_MAPPED: HRESULT = 0x8034001Du32 as HRESULT; +pub const ERROR_NDIS_RESOURCE_CONFLICT: HRESULT = 0x8034001Eu32 as HRESULT; +pub const ERROR_NDIS_MEDIA_DISCONNECTED: HRESULT = 0x8034001Fu32 as HRESULT; +pub const ERROR_NDIS_INVALID_ADDRESS: HRESULT = 0x80340022u32 as HRESULT; +pub const ERROR_NDIS_INVALID_DEVICE_REQUEST: HRESULT = 0x80340010u32 as HRESULT; +pub const ERROR_NDIS_PAUSED: HRESULT = 0x8034002Au32 as HRESULT; +pub const ERROR_NDIS_INTERFACE_NOT_FOUND: HRESULT = 0x8034002Bu32 as HRESULT; +pub const ERROR_NDIS_UNSUPPORTED_REVISION: HRESULT = 0x8034002Cu32 as HRESULT; +pub const ERROR_NDIS_INVALID_PORT: HRESULT = 0x8034002Du32 as HRESULT; +pub const ERROR_NDIS_INVALID_PORT_STATE: HRESULT = 0x8034002Eu32 as HRESULT; +pub const ERROR_NDIS_LOW_POWER_STATE: HRESULT = 0x8034002Fu32 as HRESULT; +pub const ERROR_NDIS_REINIT_REQUIRED: HRESULT = 0x80340030u32 as HRESULT; +pub const ERROR_NDIS_DOT11_AUTO_CONFIG_ENABLED: HRESULT = 0x80342000u32 as HRESULT; +pub const ERROR_NDIS_DOT11_MEDIA_IN_USE: HRESULT = 0x80342001u32 as HRESULT; +pub const ERROR_NDIS_DOT11_POWER_STATE_INVALID: HRESULT = 0x80342002u32 as HRESULT; +pub const ERROR_NDIS_PM_WOL_PATTERN_LIST_FULL: HRESULT = 0x80342003u32 as HRESULT; +pub const ERROR_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: HRESULT = 0x80342004u32 as HRESULT; +pub const ERROR_NDIS_INDICATION_REQUIRED: HRESULT = 0x00340001; +pub const ERROR_NDIS_OFFLOAD_POLICY: HRESULT = 0xC034100Fu32 as HRESULT; +pub const ERROR_NDIS_OFFLOAD_CONNECTION_REJECTED: HRESULT = 0xC0341012u32 as HRESULT; +pub const ERROR_NDIS_OFFLOAD_PATH_REJECTED: HRESULT = 0xC0341013u32 as HRESULT; +pub const ERROR_HV_INVALID_HYPERCALL_CODE: HRESULT = 0xC0350002u32 as HRESULT; +pub const ERROR_HV_INVALID_HYPERCALL_INPUT: HRESULT = 0xC0350003u32 as HRESULT; +pub const ERROR_HV_INVALID_ALIGNMENT: HRESULT = 0xC0350004u32 as HRESULT; +pub const ERROR_HV_INVALID_PARAMETER: HRESULT = 0xC0350005u32 as HRESULT; +pub const ERROR_HV_ACCESS_DENIED: HRESULT = 0xC0350006u32 as HRESULT; +pub const ERROR_HV_INVALID_PARTITION_STATE: HRESULT = 0xC0350007u32 as HRESULT; +pub const ERROR_HV_OPERATION_DENIED: HRESULT = 0xC0350008u32 as HRESULT; +pub const ERROR_HV_UNKNOWN_PROPERTY: HRESULT = 0xC0350009u32 as HRESULT; +pub const ERROR_HV_PROPERTY_VALUE_OUT_OF_RANGE: HRESULT = 0xC035000Au32 as HRESULT; +pub const ERROR_HV_INSUFFICIENT_MEMORY: HRESULT = 0xC035000Bu32 as HRESULT; +pub const ERROR_HV_PARTITION_TOO_DEEP: HRESULT = 0xC035000Cu32 as HRESULT; +pub const ERROR_HV_INVALID_PARTITION_ID: HRESULT = 0xC035000Du32 as HRESULT; +pub const ERROR_HV_INVALID_VP_INDEX: HRESULT = 0xC035000Eu32 as HRESULT; +pub const ERROR_HV_INVALID_PORT_ID: HRESULT = 0xC0350011u32 as HRESULT; +pub const ERROR_HV_INVALID_CONNECTION_ID: HRESULT = 0xC0350012u32 as HRESULT; +pub const ERROR_HV_INSUFFICIENT_BUFFERS: HRESULT = 0xC0350013u32 as HRESULT; +pub const ERROR_HV_NOT_ACKNOWLEDGED: HRESULT = 0xC0350014u32 as HRESULT; +pub const ERROR_HV_ACKNOWLEDGED: HRESULT = 0xC0350016u32 as HRESULT; +pub const ERROR_HV_INVALID_SAVE_RESTORE_STATE: HRESULT = 0xC0350017u32 as HRESULT; +pub const ERROR_HV_INVALID_SYNIC_STATE: HRESULT = 0xC0350018u32 as HRESULT; +pub const ERROR_HV_OBJECT_IN_USE: HRESULT = 0xC0350019u32 as HRESULT; +pub const ERROR_HV_INVALID_PROXIMITY_DOMAIN_INFO: HRESULT = 0xC035001Au32 as HRESULT; +pub const ERROR_HV_NO_DATA: HRESULT = 0xC035001Bu32 as HRESULT; +pub const ERROR_HV_INACTIVE: HRESULT = 0xC035001Cu32 as HRESULT; +pub const ERROR_HV_NO_RESOURCES: HRESULT = 0xC035001Du32 as HRESULT; +pub const ERROR_HV_FEATURE_UNAVAILABLE: HRESULT = 0xC035001Eu32 as HRESULT; +pub const ERROR_HV_INSUFFICIENT_BUFFER: HRESULT = 0xC0350033u32 as HRESULT; +pub const ERROR_HV_INSUFFICIENT_DEVICE_DOMAINS: HRESULT = 0xC0350038u32 as HRESULT; +pub const ERROR_HV_INVALID_LP_INDEX: HRESULT = 0xC0350041u32 as HRESULT; +pub const ERROR_HV_NOT_PRESENT: HRESULT = 0xC0351000u32 as HRESULT; +pub const ERROR_VID_DUPLICATE_HANDLER: HRESULT = 0xC0370001u32 as HRESULT; +pub const ERROR_VID_TOO_MANY_HANDLERS: HRESULT = 0xC0370002u32 as HRESULT; +pub const ERROR_VID_QUEUE_FULL: HRESULT = 0xC0370003u32 as HRESULT; +pub const ERROR_VID_HANDLER_NOT_PRESENT: HRESULT = 0xC0370004u32 as HRESULT; +pub const ERROR_VID_INVALID_OBJECT_NAME: HRESULT = 0xC0370005u32 as HRESULT; +pub const ERROR_VID_PARTITION_NAME_TOO_LONG: HRESULT = 0xC0370006u32 as HRESULT; +pub const ERROR_VID_MESSAGE_QUEUE_NAME_TOO_LONG: HRESULT = 0xC0370007u32 as HRESULT; +pub const ERROR_VID_PARTITION_ALREADY_EXISTS: HRESULT = 0xC0370008u32 as HRESULT; +pub const ERROR_VID_PARTITION_DOES_NOT_EXIST: HRESULT = 0xC0370009u32 as HRESULT; +pub const ERROR_VID_PARTITION_NAME_NOT_FOUND: HRESULT = 0xC037000Au32 as HRESULT; +pub const ERROR_VID_MESSAGE_QUEUE_ALREADY_EXISTS: HRESULT = 0xC037000Bu32 as HRESULT; +pub const ERROR_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT: HRESULT = 0xC037000Cu32 as HRESULT; +pub const ERROR_VID_MB_STILL_REFERENCED: HRESULT = 0xC037000Du32 as HRESULT; +pub const ERROR_VID_CHILD_GPA_PAGE_SET_CORRUPTED: HRESULT = 0xC037000Eu32 as HRESULT; +pub const ERROR_VID_INVALID_NUMA_SETTINGS: HRESULT = 0xC037000Fu32 as HRESULT; +pub const ERROR_VID_INVALID_NUMA_NODE_INDEX: HRESULT = 0xC0370010u32 as HRESULT; +pub const ERROR_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED: HRESULT = 0xC0370011u32 as HRESULT; +pub const ERROR_VID_INVALID_MEMORY_BLOCK_HANDLE: HRESULT = 0xC0370012u32 as HRESULT; +pub const ERROR_VID_PAGE_RANGE_OVERFLOW: HRESULT = 0xC0370013u32 as HRESULT; +pub const ERROR_VID_INVALID_MESSAGE_QUEUE_HANDLE: HRESULT = 0xC0370014u32 as HRESULT; +pub const ERROR_VID_INVALID_GPA_RANGE_HANDLE: HRESULT = 0xC0370015u32 as HRESULT; +pub const ERROR_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE: HRESULT = 0xC0370016u32 as HRESULT; +pub const ERROR_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED: HRESULT = 0xC0370017u32 as HRESULT; +pub const ERROR_VID_INVALID_PPM_HANDLE: HRESULT = 0xC0370018u32 as HRESULT; +pub const ERROR_VID_MBPS_ARE_LOCKED: HRESULT = 0xC0370019u32 as HRESULT; +pub const ERROR_VID_MESSAGE_QUEUE_CLOSED: HRESULT = 0xC037001Au32 as HRESULT; +pub const ERROR_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED: HRESULT = 0xC037001Bu32 as HRESULT; +pub const ERROR_VID_STOP_PENDING: HRESULT = 0xC037001Cu32 as HRESULT; +pub const ERROR_VID_INVALID_PROCESSOR_STATE: HRESULT = 0xC037001Du32 as HRESULT; +pub const ERROR_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT: HRESULT = 0xC037001Eu32 as HRESULT; +pub const ERROR_VID_KM_INTERFACE_ALREADY_INITIALIZED: HRESULT = 0xC037001Fu32 as HRESULT; +pub const ERROR_VID_MB_PROPERTY_ALREADY_SET_RESET: HRESULT = 0xC0370020u32 as HRESULT; +pub const ERROR_VID_MMIO_RANGE_DESTROYED: HRESULT = 0xC0370021u32 as HRESULT; +pub const ERROR_VID_INVALID_CHILD_GPA_PAGE_SET: HRESULT = 0xC0370022u32 as HRESULT; +pub const ERROR_VID_RESERVE_PAGE_SET_IS_BEING_USED: HRESULT = 0xC0370023u32 as HRESULT; +pub const ERROR_VID_RESERVE_PAGE_SET_TOO_SMALL: HRESULT = 0xC0370024u32 as HRESULT; +pub const ERROR_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE: HRESULT = 0xC0370025u32 as HRESULT; +pub const ERROR_VID_MBP_COUNT_EXCEEDED_LIMIT: HRESULT = 0xC0370026u32 as HRESULT; +pub const ERROR_VID_SAVED_STATE_CORRUPT: HRESULT = 0xC0370027u32 as HRESULT; +pub const ERROR_VID_SAVED_STATE_UNRECOGNIZED_ITEM: HRESULT = 0xC0370028u32 as HRESULT; +pub const ERROR_VID_SAVED_STATE_INCOMPATIBLE: HRESULT = 0xC0370029u32 as HRESULT; +pub const ERROR_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED: HRESULT = 0x80370001u32 as HRESULT; +pub const ERROR_VOLMGR_INCOMPLETE_REGENERATION: HRESULT = 0x80380001u32 as HRESULT; +pub const ERROR_VOLMGR_INCOMPLETE_DISK_MIGRATION: HRESULT = 0x80380002u32 as HRESULT; +pub const ERROR_VOLMGR_DATABASE_FULL: HRESULT = 0xC0380001u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_CONFIGURATION_CORRUPTED: HRESULT = 0xC0380002u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC: HRESULT = 0xC0380003u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_CONFIG_UPDATE_FAILED: HRESULT = 0xC0380004u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME: HRESULT = 0xC0380005u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_DUPLICATE: HRESULT = 0xC0380006u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_DYNAMIC: HRESULT = 0xC0380007u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_ID_INVALID: HRESULT = 0xC0380008u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_INVALID: HRESULT = 0xC0380009u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_LAST_VOTER: HRESULT = 0xC038000Au32 as HRESULT; +pub const ERROR_VOLMGR_DISK_LAYOUT_INVALID: HRESULT = 0xC038000Bu32 as HRESULT; +pub const ERROR_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS: HRESULT = 0xC038000Cu32 as HRESULT; +pub const ERROR_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED: HRESULT = 0xC038000Du32 as HRESULT; +pub const ERROR_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL: HRESULT = 0xC038000Eu32 as HRESULT; +pub const ERROR_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS: HRESULT = 0xC038000Fu32 as HRESULT; +pub const ERROR_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS: HRESULT = 0xC0380010u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_MISSING: HRESULT = 0xC0380011u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_NOT_EMPTY: HRESULT = 0xC0380012u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_NOT_ENOUGH_SPACE: HRESULT = 0xC0380013u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_REVECTORING_FAILED: HRESULT = 0xC0380014u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_SECTOR_SIZE_INVALID: HRESULT = 0xC0380015u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_SET_NOT_CONTAINED: HRESULT = 0xC0380016u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS: HRESULT = 0xC0380017u32 as HRESULT; +pub const ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES: HRESULT = 0xC0380018u32 as HRESULT; +pub const ERROR_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED: HRESULT = 0xC0380019u32 as HRESULT; +pub const ERROR_VOLMGR_EXTENT_ALREADY_USED: HRESULT = 0xC038001Au32 as HRESULT; +pub const ERROR_VOLMGR_EXTENT_NOT_CONTIGUOUS: HRESULT = 0xC038001Bu32 as HRESULT; +pub const ERROR_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION: HRESULT = 0xC038001Cu32 as HRESULT; +pub const ERROR_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED: HRESULT = 0xC038001Du32 as HRESULT; +pub const ERROR_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION: HRESULT = 0xC038001Eu32 as HRESULT; +pub const ERROR_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH: HRESULT = 0xC038001Fu32 as HRESULT; +pub const ERROR_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED: HRESULT = 0xC0380020u32 as HRESULT; +pub const ERROR_VOLMGR_INTERLEAVE_LENGTH_INVALID: HRESULT = 0xC0380021u32 as HRESULT; +pub const ERROR_VOLMGR_MAXIMUM_REGISTERED_USERS: HRESULT = 0xC0380022u32 as HRESULT; +pub const ERROR_VOLMGR_MEMBER_IN_SYNC: HRESULT = 0xC0380023u32 as HRESULT; +pub const ERROR_VOLMGR_MEMBER_INDEX_DUPLICATE: HRESULT = 0xC0380024u32 as HRESULT; +pub const ERROR_VOLMGR_MEMBER_INDEX_INVALID: HRESULT = 0xC0380025u32 as HRESULT; +pub const ERROR_VOLMGR_MEMBER_MISSING: HRESULT = 0xC0380026u32 as HRESULT; +pub const ERROR_VOLMGR_MEMBER_NOT_DETACHED: HRESULT = 0xC0380027u32 as HRESULT; +pub const ERROR_VOLMGR_MEMBER_REGENERATING: HRESULT = 0xC0380028u32 as HRESULT; +pub const ERROR_VOLMGR_ALL_DISKS_FAILED: HRESULT = 0xC0380029u32 as HRESULT; +pub const ERROR_VOLMGR_NO_REGISTERED_USERS: HRESULT = 0xC038002Au32 as HRESULT; +pub const ERROR_VOLMGR_NO_SUCH_USER: HRESULT = 0xC038002Bu32 as HRESULT; +pub const ERROR_VOLMGR_NOTIFICATION_RESET: HRESULT = 0xC038002Cu32 as HRESULT; +pub const ERROR_VOLMGR_NUMBER_OF_MEMBERS_INVALID: HRESULT = 0xC038002Du32 as HRESULT; +pub const ERROR_VOLMGR_NUMBER_OF_PLEXES_INVALID: HRESULT = 0xC038002Eu32 as HRESULT; +pub const ERROR_VOLMGR_PACK_DUPLICATE: HRESULT = 0xC038002Fu32 as HRESULT; +pub const ERROR_VOLMGR_PACK_ID_INVALID: HRESULT = 0xC0380030u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_INVALID: HRESULT = 0xC0380031u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_NAME_INVALID: HRESULT = 0xC0380032u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_OFFLINE: HRESULT = 0xC0380033u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_HAS_QUORUM: HRESULT = 0xC0380034u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_WITHOUT_QUORUM: HRESULT = 0xC0380035u32 as HRESULT; +pub const ERROR_VOLMGR_PARTITION_STYLE_INVALID: HRESULT = 0xC0380036u32 as HRESULT; +pub const ERROR_VOLMGR_PARTITION_UPDATE_FAILED: HRESULT = 0xC0380037u32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_IN_SYNC: HRESULT = 0xC0380038u32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_INDEX_DUPLICATE: HRESULT = 0xC0380039u32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_INDEX_INVALID: HRESULT = 0xC038003Au32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_LAST_ACTIVE: HRESULT = 0xC038003Bu32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_MISSING: HRESULT = 0xC038003Cu32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_REGENERATING: HRESULT = 0xC038003Du32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_TYPE_INVALID: HRESULT = 0xC038003Eu32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_NOT_RAID5: HRESULT = 0xC038003Fu32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_NOT_SIMPLE: HRESULT = 0xC0380040u32 as HRESULT; +pub const ERROR_VOLMGR_STRUCTURE_SIZE_INVALID: HRESULT = 0xC0380041u32 as HRESULT; +pub const ERROR_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS: HRESULT = 0xC0380042u32 as HRESULT; +pub const ERROR_VOLMGR_TRANSACTION_IN_PROGRESS: HRESULT = 0xC0380043u32 as HRESULT; +pub const ERROR_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE: HRESULT = 0xC0380044u32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_CONTAINS_MISSING_DISK: HRESULT = 0xC0380045u32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_ID_INVALID: HRESULT = 0xC0380046u32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_LENGTH_INVALID: HRESULT = 0xC0380047u32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE: HRESULT = 0xC0380048u32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_NOT_MIRRORED: HRESULT = 0xC0380049u32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_NOT_RETAINED: HRESULT = 0xC038004Au32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_OFFLINE: HRESULT = 0xC038004Bu32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_RETAINED: HRESULT = 0xC038004Cu32 as HRESULT; +pub const ERROR_VOLMGR_NUMBER_OF_EXTENTS_INVALID: HRESULT = 0xC038004Du32 as HRESULT; +pub const ERROR_VOLMGR_DIFFERENT_SECTOR_SIZE: HRESULT = 0xC038004Eu32 as HRESULT; +pub const ERROR_VOLMGR_BAD_BOOT_DISK: HRESULT = 0xC038004Fu32 as HRESULT; +pub const ERROR_VOLMGR_PACK_CONFIG_OFFLINE: HRESULT = 0xC0380050u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_CONFIG_ONLINE: HRESULT = 0xC0380051u32 as HRESULT; +pub const ERROR_VOLMGR_NOT_PRIMARY_PACK: HRESULT = 0xC0380052u32 as HRESULT; +pub const ERROR_VOLMGR_PACK_LOG_UPDATE_FAILED: HRESULT = 0xC0380053u32 as HRESULT; +pub const ERROR_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID: HRESULT = 0xC0380054u32 as HRESULT; +pub const ERROR_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID: HRESULT = 0xC0380055u32 as HRESULT; +pub const ERROR_VOLMGR_VOLUME_MIRRORED: HRESULT = 0xC0380056u32 as HRESULT; +pub const ERROR_VOLMGR_PLEX_NOT_SIMPLE_SPANNED: HRESULT = 0xC0380057u32 as HRESULT; +pub const ERROR_VOLMGR_NO_VALID_LOG_COPIES: HRESULT = 0xC0380058u32 as HRESULT; +pub const ERROR_VOLMGR_PRIMARY_PACK_PRESENT: HRESULT = 0xC0380059u32 as HRESULT; +pub const ERROR_VOLMGR_NUMBER_OF_DISKS_INVALID: HRESULT = 0xC038005Au32 as HRESULT; +pub const ERROR_VOLMGR_MIRROR_NOT_SUPPORTED: HRESULT = 0xC038005Bu32 as HRESULT; +pub const ERROR_VOLMGR_RAID5_NOT_SUPPORTED: HRESULT = 0xC038005Cu32 as HRESULT; +pub const ERROR_BCD_NOT_ALL_ENTRIES_IMPORTED: HRESULT = 0x80390001u32 as HRESULT; +pub const ERROR_BCD_TOO_MANY_ELEMENTS: HRESULT = 0xC0390002u32 as HRESULT; +pub const ERROR_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED: HRESULT = 0x80390003u32 as HRESULT; +pub const ERROR_VHD_DRIVE_FOOTER_MISSING: HRESULT = 0xC03A0001u32 as HRESULT; +pub const ERROR_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH: HRESULT = 0xC03A0002u32 as HRESULT; +pub const ERROR_VHD_DRIVE_FOOTER_CORRUPT: HRESULT = 0xC03A0003u32 as HRESULT; +pub const ERROR_VHD_FORMAT_UNKNOWN: HRESULT = 0xC03A0004u32 as HRESULT; +pub const ERROR_VHD_FORMAT_UNSUPPORTED_VERSION: HRESULT = 0xC03A0005u32 as HRESULT; +pub const ERROR_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH: HRESULT = 0xC03A0006u32 as HRESULT; +pub const ERROR_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION: HRESULT = 0xC03A0007u32 as HRESULT; +pub const ERROR_VHD_SPARSE_HEADER_CORRUPT: HRESULT = 0xC03A0008u32 as HRESULT; +pub const ERROR_VHD_BLOCK_ALLOCATION_FAILURE: HRESULT = 0xC03A0009u32 as HRESULT; +pub const ERROR_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT: HRESULT = 0xC03A000Au32 as HRESULT; +pub const ERROR_VHD_INVALID_BLOCK_SIZE: HRESULT = 0xC03A000Bu32 as HRESULT; +pub const ERROR_VHD_BITMAP_MISMATCH: HRESULT = 0xC03A000Cu32 as HRESULT; +pub const ERROR_VHD_PARENT_VHD_NOT_FOUND: HRESULT = 0xC03A000Du32 as HRESULT; +pub const ERROR_VHD_CHILD_PARENT_ID_MISMATCH: HRESULT = 0xC03A000Eu32 as HRESULT; +pub const ERROR_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH: HRESULT = 0xC03A000Fu32 as HRESULT; +pub const ERROR_VHD_METADATA_READ_FAILURE: HRESULT = 0xC03A0010u32 as HRESULT; +pub const ERROR_VHD_METADATA_WRITE_FAILURE: HRESULT = 0xC03A0011u32 as HRESULT; +pub const ERROR_VHD_INVALID_SIZE: HRESULT = 0xC03A0012u32 as HRESULT; +pub const ERROR_VHD_INVALID_FILE_SIZE: HRESULT = 0xC03A0013u32 as HRESULT; +pub const ERROR_VIRTDISK_PROVIDER_NOT_FOUND: HRESULT = 0xC03A0014u32 as HRESULT; +pub const ERROR_VIRTDISK_NOT_VIRTUAL_DISK: HRESULT = 0xC03A0015u32 as HRESULT; +pub const ERROR_VHD_PARENT_VHD_ACCESS_DENIED: HRESULT = 0xC03A0016u32 as HRESULT; +pub const ERROR_VHD_CHILD_PARENT_SIZE_MISMATCH: HRESULT = 0xC03A0017u32 as HRESULT; +pub const ERROR_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: HRESULT = 0xC03A0018u32 as HRESULT; +pub const ERROR_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: HRESULT = 0xC03A0019u32 as HRESULT; +pub const ERROR_VIRTUAL_DISK_LIMITATION: HRESULT = 0xC03A001Au32 as HRESULT; +pub const ERROR_VHD_INVALID_TYPE: HRESULT = 0xC03A001Bu32 as HRESULT; +pub const ERROR_VHD_INVALID_STATE: HRESULT = 0xC03A001Cu32 as HRESULT; +pub const ERROR_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE: HRESULT = 0xC03A001Du32 as HRESULT; +pub const ERROR_VIRTDISK_DISK_ALREADY_OWNED: HRESULT = 0xC03A001Eu32 as HRESULT; +pub const ERROR_VIRTDISK_DISK_ONLINE_AND_WRITABLE: HRESULT = 0xC03A001Fu32 as HRESULT; +pub const ERROR_CTLOG_TRACKING_NOT_INITIALIZED: HRESULT = 0xC03A0020u32 as HRESULT; +pub const ERROR_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE: HRESULT = 0xC03A0021u32 as HRESULT; +pub const ERROR_CTLOG_VHD_CHANGED_OFFLINE: HRESULT = 0xC03A0022u32 as HRESULT; +pub const ERROR_CTLOG_INVALID_TRACKING_STATE: HRESULT = 0xC03A0023u32 as HRESULT; +pub const ERROR_CTLOG_INCONSISTENT_TRACKING_FILE: HRESULT = 0xC03A0024u32 as HRESULT; +pub const ERROR_VHD_RESIZE_WOULD_TRUNCATE_DATA: HRESULT = 0xC03A0025u32 as HRESULT; +pub const ERROR_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE: HRESULT = 0xC03A0026u32 as HRESULT; +pub const ERROR_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE: HRESULT = 0xC03A0027u32 as HRESULT; +pub const ERROR_VHD_METADATA_FULL: HRESULT = 0xC03A0028u32 as HRESULT; +pub const ERROR_QUERY_STORAGE_ERROR: HRESULT = 0x803A0001u32 as HRESULT; +pub const SDIAG_E_CANCELLED: HRESULT = 0x803C0100u32 as HRESULT; +pub const SDIAG_E_SCRIPT: HRESULT = 0x803C0101u32 as HRESULT; +pub const SDIAG_E_POWERSHELL: HRESULT = 0x803C0102u32 as HRESULT; +pub const SDIAG_E_MANAGEDHOST: HRESULT = 0x803C0103u32 as HRESULT; +pub const SDIAG_E_NOVERIFIER: HRESULT = 0x803C0104u32 as HRESULT; +pub const SDIAG_S_CANNOTRUN: HRESULT = 0x003C0105; +pub const SDIAG_E_DISABLED: HRESULT = 0x803C0106u32 as HRESULT; +pub const SDIAG_E_TRUST: HRESULT = 0x803C0107u32 as HRESULT; +pub const SDIAG_E_CANNOTRUN: HRESULT = 0x803C0108u32 as HRESULT; +pub const SDIAG_E_VERSION: HRESULT = 0x803C0109u32 as HRESULT; +pub const SDIAG_E_RESOURCE: HRESULT = 0x803C010Au32 as HRESULT; +pub const SDIAG_E_ROOTCAUSE: HRESULT = 0x803C010Bu32 as HRESULT; +pub const WPN_E_CHANNEL_CLOSED: HRESULT = 0x803E0100u32 as HRESULT; +pub const WPN_E_CHANNEL_REQUEST_NOT_COMPLETE: HRESULT = 0x803E0101u32 as HRESULT; +pub const WPN_E_INVALID_APP: HRESULT = 0x803E0102u32 as HRESULT; +pub const WPN_E_OUTSTANDING_CHANNEL_REQUEST: HRESULT = 0x803E0103u32 as HRESULT; +pub const WPN_E_DUPLICATE_CHANNEL: HRESULT = 0x803E0104u32 as HRESULT; +pub const WPN_E_PLATFORM_UNAVAILABLE: HRESULT = 0x803E0105u32 as HRESULT; +pub const WPN_E_NOTIFICATION_POSTED: HRESULT = 0x803E0106u32 as HRESULT; +pub const WPN_E_NOTIFICATION_HIDDEN: HRESULT = 0x803E0107u32 as HRESULT; +pub const WPN_E_NOTIFICATION_NOT_POSTED: HRESULT = 0x803E0108u32 as HRESULT; +pub const WPN_E_CLOUD_DISABLED: HRESULT = 0x803E0109u32 as HRESULT; +pub const WPN_E_CLOUD_INCAPABLE: HRESULT = 0x803E0110u32 as HRESULT; +pub const WPN_E_CLOUD_AUTH_UNAVAILABLE: HRESULT = 0x803E011Au32 as HRESULT; +pub const WPN_E_CLOUD_SERVICE_UNAVAILABLE: HRESULT = 0x803E011Bu32 as HRESULT; +pub const WPN_E_FAILED_LOCK_SCREEN_UPDATE_INTIALIZATION: HRESULT = 0x803E011Cu32 as HRESULT; +pub const WPN_E_NOTIFICATION_DISABLED: HRESULT = 0x803E0111u32 as HRESULT; +pub const WPN_E_NOTIFICATION_INCAPABLE: HRESULT = 0x803E0112u32 as HRESULT; +pub const WPN_E_INTERNET_INCAPABLE: HRESULT = 0x803E0113u32 as HRESULT; +pub const WPN_E_NOTIFICATION_TYPE_DISABLED: HRESULT = 0x803E0114u32 as HRESULT; +pub const WPN_E_NOTIFICATION_SIZE: HRESULT = 0x803E0115u32 as HRESULT; +pub const WPN_E_TAG_SIZE: HRESULT = 0x803E0116u32 as HRESULT; +pub const WPN_E_ACCESS_DENIED: HRESULT = 0x803E0117u32 as HRESULT; +pub const WPN_E_DUPLICATE_REGISTRATION: HRESULT = 0x803E0118u32 as HRESULT; +pub const WPN_E_PUSH_NOTIFICATION_INCAPABLE: HRESULT = 0x803E0119u32 as HRESULT; +pub const WPN_E_DEV_ID_SIZE: HRESULT = 0x803E0120u32 as HRESULT; +pub const WPN_E_TAG_ALPHANUMERIC: HRESULT = 0x803E012Au32 as HRESULT; +pub const WPN_E_INVALID_HTTP_STATUS_CODE: HRESULT = 0x803E012Bu32 as HRESULT; +pub const WPN_E_OUT_OF_SESSION: HRESULT = 0x803E0200u32 as HRESULT; +pub const WPN_E_POWER_SAVE: HRESULT = 0x803E0201u32 as HRESULT; +pub const WPN_E_IMAGE_NOT_FOUND_IN_CACHE: HRESULT = 0x803E0202u32 as HRESULT; +pub const WPN_E_ALL_URL_NOT_COMPLETED: HRESULT = 0x803E0203u32 as HRESULT; +pub const WPN_E_INVALID_CLOUD_IMAGE: HRESULT = 0x803E0204u32 as HRESULT; +pub const WPN_E_NOTIFICATION_ID_MATCHED: HRESULT = 0x803E0205u32 as HRESULT; +pub const WPN_E_CALLBACK_ALREADY_REGISTERED: HRESULT = 0x803E0206u32 as HRESULT; +pub const WPN_E_TOAST_NOTIFICATION_DROPPED: HRESULT = 0x803E0207u32 as HRESULT; +pub const WPN_E_STORAGE_LOCKED: HRESULT = 0x803E0208u32 as HRESULT; +pub const E_MBN_CONTEXT_NOT_ACTIVATED: HRESULT = 0x80548201u32 as HRESULT; +pub const E_MBN_BAD_SIM: HRESULT = 0x80548202u32 as HRESULT; +pub const E_MBN_DATA_CLASS_NOT_AVAILABLE: HRESULT = 0x80548203u32 as HRESULT; +pub const E_MBN_INVALID_ACCESS_STRING: HRESULT = 0x80548204u32 as HRESULT; +pub const E_MBN_MAX_ACTIVATED_CONTEXTS: HRESULT = 0x80548205u32 as HRESULT; +pub const E_MBN_PACKET_SVC_DETACHED: HRESULT = 0x80548206u32 as HRESULT; +pub const E_MBN_PROVIDER_NOT_VISIBLE: HRESULT = 0x80548207u32 as HRESULT; +pub const E_MBN_RADIO_POWER_OFF: HRESULT = 0x80548208u32 as HRESULT; +pub const E_MBN_SERVICE_NOT_ACTIVATED: HRESULT = 0x80548209u32 as HRESULT; +pub const E_MBN_SIM_NOT_INSERTED: HRESULT = 0x8054820Au32 as HRESULT; +pub const E_MBN_VOICE_CALL_IN_PROGRESS: HRESULT = 0x8054820Bu32 as HRESULT; +pub const E_MBN_INVALID_CACHE: HRESULT = 0x8054820Cu32 as HRESULT; +pub const E_MBN_NOT_REGISTERED: HRESULT = 0x8054820Du32 as HRESULT; +pub const E_MBN_PROVIDERS_NOT_FOUND: HRESULT = 0x8054820Eu32 as HRESULT; +pub const E_MBN_PIN_NOT_SUPPORTED: HRESULT = 0x8054820Fu32 as HRESULT; +pub const E_MBN_PIN_REQUIRED: HRESULT = 0x80548210u32 as HRESULT; +pub const E_MBN_PIN_DISABLED: HRESULT = 0x80548211u32 as HRESULT; +pub const E_MBN_FAILURE: HRESULT = 0x80548212u32 as HRESULT; +pub const E_MBN_INVALID_PROFILE: HRESULT = 0x80548218u32 as HRESULT; +pub const E_MBN_DEFAULT_PROFILE_EXIST: HRESULT = 0x80548219u32 as HRESULT; +pub const E_MBN_SMS_ENCODING_NOT_SUPPORTED: HRESULT = 0x80548220u32 as HRESULT; +pub const E_MBN_SMS_FILTER_NOT_SUPPORTED: HRESULT = 0x80548221u32 as HRESULT; +pub const E_MBN_SMS_INVALID_MEMORY_INDEX: HRESULT = 0x80548222u32 as HRESULT; +pub const E_MBN_SMS_LANG_NOT_SUPPORTED: HRESULT = 0x80548223u32 as HRESULT; +pub const E_MBN_SMS_MEMORY_FAILURE: HRESULT = 0x80548224u32 as HRESULT; +pub const E_MBN_SMS_NETWORK_TIMEOUT: HRESULT = 0x80548225u32 as HRESULT; +pub const E_MBN_SMS_UNKNOWN_SMSC_ADDRESS: HRESULT = 0x80548226u32 as HRESULT; +pub const E_MBN_SMS_FORMAT_NOT_SUPPORTED: HRESULT = 0x80548227u32 as HRESULT; +pub const E_MBN_SMS_OPERATION_NOT_ALLOWED: HRESULT = 0x80548228u32 as HRESULT; +pub const E_MBN_SMS_MEMORY_FULL: HRESULT = 0x80548229u32 as HRESULT; +pub const PEER_E_IPV6_NOT_INSTALLED: HRESULT = 0x80630001u32 as HRESULT; +pub const PEER_E_NOT_INITIALIZED: HRESULT = 0x80630002u32 as HRESULT; +pub const PEER_E_CANNOT_START_SERVICE: HRESULT = 0x80630003u32 as HRESULT; +pub const PEER_E_NOT_LICENSED: HRESULT = 0x80630004u32 as HRESULT; +pub const PEER_E_INVALID_GRAPH: HRESULT = 0x80630010u32 as HRESULT; +pub const PEER_E_DBNAME_CHANGED: HRESULT = 0x80630011u32 as HRESULT; +pub const PEER_E_DUPLICATE_GRAPH: HRESULT = 0x80630012u32 as HRESULT; +pub const PEER_E_GRAPH_NOT_READY: HRESULT = 0x80630013u32 as HRESULT; +pub const PEER_E_GRAPH_SHUTTING_DOWN: HRESULT = 0x80630014u32 as HRESULT; +pub const PEER_E_GRAPH_IN_USE: HRESULT = 0x80630015u32 as HRESULT; +pub const PEER_E_INVALID_DATABASE: HRESULT = 0x80630016u32 as HRESULT; +pub const PEER_E_TOO_MANY_ATTRIBUTES: HRESULT = 0x80630017u32 as HRESULT; +pub const PEER_E_CONNECTION_NOT_FOUND: HRESULT = 0x80630103u32 as HRESULT; +pub const PEER_E_CONNECT_SELF: HRESULT = 0x80630106u32 as HRESULT; +pub const PEER_E_ALREADY_LISTENING: HRESULT = 0x80630107u32 as HRESULT; +pub const PEER_E_NODE_NOT_FOUND: HRESULT = 0x80630108u32 as HRESULT; +pub const PEER_E_CONNECTION_FAILED: HRESULT = 0x80630109u32 as HRESULT; +pub const PEER_E_CONNECTION_NOT_AUTHENTICATED: HRESULT = 0x8063010Au32 as HRESULT; +pub const PEER_E_CONNECTION_REFUSED: HRESULT = 0x8063010Bu32 as HRESULT; +pub const PEER_E_CLASSIFIER_TOO_LONG: HRESULT = 0x80630201u32 as HRESULT; +pub const PEER_E_TOO_MANY_IDENTITIES: HRESULT = 0x80630202u32 as HRESULT; +pub const PEER_E_NO_KEY_ACCESS: HRESULT = 0x80630203u32 as HRESULT; +pub const PEER_E_GROUPS_EXIST: HRESULT = 0x80630204u32 as HRESULT; +pub const PEER_E_RECORD_NOT_FOUND: HRESULT = 0x80630301u32 as HRESULT; +pub const PEER_E_DATABASE_ACCESSDENIED: HRESULT = 0x80630302u32 as HRESULT; +pub const PEER_E_DBINITIALIZATION_FAILED: HRESULT = 0x80630303u32 as HRESULT; +pub const PEER_E_MAX_RECORD_SIZE_EXCEEDED: HRESULT = 0x80630304u32 as HRESULT; +pub const PEER_E_DATABASE_ALREADY_PRESENT: HRESULT = 0x80630305u32 as HRESULT; +pub const PEER_E_DATABASE_NOT_PRESENT: HRESULT = 0x80630306u32 as HRESULT; +pub const PEER_E_IDENTITY_NOT_FOUND: HRESULT = 0x80630401u32 as HRESULT; +pub const PEER_E_EVENT_HANDLE_NOT_FOUND: HRESULT = 0x80630501u32 as HRESULT; +pub const PEER_E_INVALID_SEARCH: HRESULT = 0x80630601u32 as HRESULT; +pub const PEER_E_INVALID_ATTRIBUTES: HRESULT = 0x80630602u32 as HRESULT; +pub const PEER_E_INVITATION_NOT_TRUSTED: HRESULT = 0x80630701u32 as HRESULT; +pub const PEER_E_CHAIN_TOO_LONG: HRESULT = 0x80630703u32 as HRESULT; +pub const PEER_E_INVALID_TIME_PERIOD: HRESULT = 0x80630705u32 as HRESULT; +pub const PEER_E_CIRCULAR_CHAIN_DETECTED: HRESULT = 0x80630706u32 as HRESULT; +pub const PEER_E_CERT_STORE_CORRUPTED: HRESULT = 0x80630801u32 as HRESULT; +pub const PEER_E_NO_CLOUD: HRESULT = 0x80631001u32 as HRESULT; +pub const PEER_E_CLOUD_NAME_AMBIGUOUS: HRESULT = 0x80631005u32 as HRESULT; +pub const PEER_E_INVALID_RECORD: HRESULT = 0x80632010u32 as HRESULT; +pub const PEER_E_NOT_AUTHORIZED: HRESULT = 0x80632020u32 as HRESULT; +pub const PEER_E_PASSWORD_DOES_NOT_MEET_POLICY: HRESULT = 0x80632021u32 as HRESULT; +pub const PEER_E_DEFERRED_VALIDATION: HRESULT = 0x80632030u32 as HRESULT; +pub const PEER_E_INVALID_GROUP_PROPERTIES: HRESULT = 0x80632040u32 as HRESULT; +pub const PEER_E_INVALID_PEER_NAME: HRESULT = 0x80632050u32 as HRESULT; +pub const PEER_E_INVALID_CLASSIFIER: HRESULT = 0x80632060u32 as HRESULT; +pub const PEER_E_INVALID_FRIENDLY_NAME: HRESULT = 0x80632070u32 as HRESULT; +pub const PEER_E_INVALID_ROLE_PROPERTY: HRESULT = 0x80632071u32 as HRESULT; +pub const PEER_E_INVALID_CLASSIFIER_PROPERTY: HRESULT = 0x80632072u32 as HRESULT; +pub const PEER_E_INVALID_RECORD_EXPIRATION: HRESULT = 0x80632080u32 as HRESULT; +pub const PEER_E_INVALID_CREDENTIAL_INFO: HRESULT = 0x80632081u32 as HRESULT; +pub const PEER_E_INVALID_CREDENTIAL: HRESULT = 0x80632082u32 as HRESULT; +pub const PEER_E_INVALID_RECORD_SIZE: HRESULT = 0x80632083u32 as HRESULT; +pub const PEER_E_UNSUPPORTED_VERSION: HRESULT = 0x80632090u32 as HRESULT; +pub const PEER_E_GROUP_NOT_READY: HRESULT = 0x80632091u32 as HRESULT; +pub const PEER_E_GROUP_IN_USE: HRESULT = 0x80632092u32 as HRESULT; +pub const PEER_E_INVALID_GROUP: HRESULT = 0x80632093u32 as HRESULT; +pub const PEER_E_NO_MEMBERS_FOUND: HRESULT = 0x80632094u32 as HRESULT; +pub const PEER_E_NO_MEMBER_CONNECTIONS: HRESULT = 0x80632095u32 as HRESULT; +pub const PEER_E_UNABLE_TO_LISTEN: HRESULT = 0x80632096u32 as HRESULT; +pub const PEER_E_IDENTITY_DELETED: HRESULT = 0x806320A0u32 as HRESULT; +pub const PEER_E_SERVICE_NOT_AVAILABLE: HRESULT = 0x806320A1u32 as HRESULT; +pub const PEER_E_CONTACT_NOT_FOUND: HRESULT = 0x80636001u32 as HRESULT; +pub const PEER_S_GRAPH_DATA_CREATED: HRESULT = 0x00630001; +pub const PEER_S_NO_EVENT_DATA: HRESULT = 0x00630002; +pub const PEER_S_ALREADY_CONNECTED: HRESULT = 0x00632000; +pub const PEER_S_SUBSCRIPTION_EXISTS: HRESULT = 0x00636000; +pub const PEER_S_NO_CONNECTIVITY: HRESULT = 0x00630005; +pub const PEER_S_ALREADY_A_MEMBER: HRESULT = 0x00630006; +pub const PEER_E_CANNOT_CONVERT_PEER_NAME: HRESULT = 0x80634001u32 as HRESULT; +pub const PEER_E_INVALID_PEER_HOST_NAME: HRESULT = 0x80634002u32 as HRESULT; +pub const PEER_E_NO_MORE: HRESULT = 0x80634003u32 as HRESULT; +pub const PEER_E_PNRP_DUPLICATE_PEER_NAME: HRESULT = 0x80634005u32 as HRESULT; +pub const PEER_E_INVITE_CANCELLED: HRESULT = 0x80637000u32 as HRESULT; +pub const PEER_E_INVITE_RESPONSE_NOT_AVAILABLE: HRESULT = 0x80637001u32 as HRESULT; +pub const PEER_E_NOT_SIGNED_IN: HRESULT = 0x80637003u32 as HRESULT; +pub const PEER_E_PRIVACY_DECLINED: HRESULT = 0x80637004u32 as HRESULT; +pub const PEER_E_TIMEOUT: HRESULT = 0x80637005u32 as HRESULT; +pub const PEER_E_INVALID_ADDRESS: HRESULT = 0x80637007u32 as HRESULT; +pub const PEER_E_FW_EXCEPTION_DISABLED: HRESULT = 0x80637008u32 as HRESULT; +pub const PEER_E_FW_BLOCKED_BY_POLICY: HRESULT = 0x80637009u32 as HRESULT; +pub const PEER_E_FW_BLOCKED_BY_SHIELDS_UP: HRESULT = 0x8063700Au32 as HRESULT; +pub const PEER_E_FW_DECLINED: HRESULT = 0x8063700Bu32 as HRESULT; +pub const UI_E_CREATE_FAILED: HRESULT = 0x802A0001u32 as HRESULT; +pub const UI_E_SHUTDOWN_CALLED: HRESULT = 0x802A0002u32 as HRESULT; +pub const UI_E_ILLEGAL_REENTRANCY: HRESULT = 0x802A0003u32 as HRESULT; +pub const UI_E_OBJECT_SEALED: HRESULT = 0x802A0004u32 as HRESULT; +pub const UI_E_VALUE_NOT_SET: HRESULT = 0x802A0005u32 as HRESULT; +pub const UI_E_VALUE_NOT_DETERMINED: HRESULT = 0x802A0006u32 as HRESULT; +pub const UI_E_INVALID_OUTPUT: HRESULT = 0x802A0007u32 as HRESULT; +pub const UI_E_BOOLEAN_EXPECTED: HRESULT = 0x802A0008u32 as HRESULT; +pub const UI_E_DIFFERENT_OWNER: HRESULT = 0x802A0009u32 as HRESULT; +pub const UI_E_AMBIGUOUS_MATCH: HRESULT = 0x802A000Au32 as HRESULT; +pub const UI_E_FP_OVERFLOW: HRESULT = 0x802A000Bu32 as HRESULT; +pub const UI_E_WRONG_THREAD: HRESULT = 0x802A000Cu32 as HRESULT; +pub const UI_E_STORYBOARD_ACTIVE: HRESULT = 0x802A0101u32 as HRESULT; +pub const UI_E_STORYBOARD_NOT_PLAYING: HRESULT = 0x802A0102u32 as HRESULT; +pub const UI_E_START_KEYFRAME_AFTER_END: HRESULT = 0x802A0103u32 as HRESULT; +pub const UI_E_END_KEYFRAME_NOT_DETERMINED: HRESULT = 0x802A0104u32 as HRESULT; +pub const UI_E_LOOPS_OVERLAP: HRESULT = 0x802A0105u32 as HRESULT; +pub const UI_E_TRANSITION_ALREADY_USED: HRESULT = 0x802A0106u32 as HRESULT; +pub const UI_E_TRANSITION_NOT_IN_STORYBOARD: HRESULT = 0x802A0107u32 as HRESULT; +pub const UI_E_TRANSITION_ECLIPSED: HRESULT = 0x802A0108u32 as HRESULT; +pub const UI_E_TIME_BEFORE_LAST_UPDATE: HRESULT = 0x802A0109u32 as HRESULT; +pub const UI_E_TIMER_CLIENT_ALREADY_CONNECTED: HRESULT = 0x802A010Au32 as HRESULT; +pub const UI_E_INVALID_DIMENSION: HRESULT = 0x802A010Bu32 as HRESULT; +pub const UI_E_PRIMITIVE_OUT_OF_BOUNDS: HRESULT = 0x802A010Cu32 as HRESULT; +pub const UI_E_WINDOW_CLOSED: HRESULT = 0x802A0201u32 as HRESULT; +pub const E_BLUETOOTH_ATT_INVALID_HANDLE: HRESULT = 0x80650001u32 as HRESULT; +pub const E_BLUETOOTH_ATT_READ_NOT_PERMITTED: HRESULT = 0x80650002u32 as HRESULT; +pub const E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED: HRESULT = 0x80650003u32 as HRESULT; +pub const E_BLUETOOTH_ATT_INVALID_PDU: HRESULT = 0x80650004u32 as HRESULT; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHENTICATION: HRESULT = 0x80650005u32 as HRESULT; +pub const E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED: HRESULT = 0x80650006u32 as HRESULT; +pub const E_BLUETOOTH_ATT_INVALID_OFFSET: HRESULT = 0x80650007u32 as HRESULT; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHORIZATION: HRESULT = 0x80650008u32 as HRESULT; +pub const E_BLUETOOTH_ATT_PREPARE_QUEUE_FULL: HRESULT = 0x80650009u32 as HRESULT; +pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_FOUND: HRESULT = 0x8065000Au32 as HRESULT; +pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_LONG: HRESULT = 0x8065000Bu32 as HRESULT; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE: HRESULT = 0x8065000Cu32 as HRESULT; +pub const E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH: HRESULT = 0x8065000Du32 as HRESULT; +pub const E_BLUETOOTH_ATT_UNLIKELY: HRESULT = 0x8065000Eu32 as HRESULT; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION: HRESULT = 0x8065000Fu32 as HRESULT; +pub const E_BLUETOOTH_ATT_UNSUPPORTED_GROUP_TYPE: HRESULT = 0x80650010u32 as HRESULT; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_RESOURCES: HRESULT = 0x80650011u32 as HRESULT; +pub const E_BLUETOOTH_ATT_UNKNOWN_ERROR: HRESULT = 0x80651000u32 as HRESULT; +pub const E_AUDIO_ENGINE_NODE_NOT_FOUND: HRESULT = 0x80660001u32 as HRESULT; +pub const E_HDAUDIO_EMPTY_CONNECTION_LIST: HRESULT = 0x80660002u32 as HRESULT; +pub const E_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED: HRESULT = 0x80660003u32 as HRESULT; +pub const E_HDAUDIO_NO_LOGICAL_DEVICES_CREATED: HRESULT = 0x80660004u32 as HRESULT; +pub const E_HDAUDIO_NULL_LINKED_LIST_ENTRY: HRESULT = 0x80660005u32 as HRESULT; +pub const ERROR_SPACES_POOL_WAS_DELETED: HRESULT = 0x00E70001; +pub const ERROR_SPACES_RESILIENCY_TYPE_INVALID: HRESULT = 0x80E70003u32 as HRESULT; +pub const ERROR_SPACES_DRIVE_SECTOR_SIZE_INVALID: HRESULT = 0x80E70004u32 as HRESULT; +pub const ERROR_SPACES_DRIVE_REDUNDANCY_INVALID: HRESULT = 0x80E70006u32 as HRESULT; +pub const ERROR_SPACES_NUMBER_OF_DATA_COPIES_INVALID: HRESULT = 0x80E70007u32 as HRESULT; +pub const ERROR_SPACES_PARITY_LAYOUT_INVALID: HRESULT = 0x80E70008u32 as HRESULT; +pub const ERROR_SPACES_INTERLEAVE_LENGTH_INVALID: HRESULT = 0x80E70009u32 as HRESULT; +pub const ERROR_SPACES_NUMBER_OF_COLUMNS_INVALID: HRESULT = 0x80E7000Au32 as HRESULT; +pub const ERROR_SPACES_NOT_ENOUGH_DRIVES: HRESULT = 0x80E7000Bu32 as HRESULT; +pub const ERROR_VOLSNAP_BOOTFILE_NOT_VALID: HRESULT = 0x80820001u32 as HRESULT; +pub const ERROR_TIERING_NOT_SUPPORTED_ON_VOLUME: HRESULT = 0x80830001u32 as HRESULT; +pub const ERROR_TIERING_VOLUME_DISMOUNT_IN_PROGRESS: HRESULT = 0x80830002u32 as HRESULT; +pub const ERROR_TIERING_STORAGE_TIER_NOT_FOUND: HRESULT = 0x80830003u32 as HRESULT; +pub const ERROR_TIERING_INVALID_FILE_ID: HRESULT = 0x80830004u32 as HRESULT; +pub const ERROR_TIERING_WRONG_CLUSTER_NODE: HRESULT = 0x80830005u32 as HRESULT; +pub const ERROR_TIERING_ALREADY_PROCESSING: HRESULT = 0x80830006u32 as HRESULT; +pub const ERROR_TIERING_CANNOT_PIN_OBJECT: HRESULT = 0x80830007u32 as HRESULT; +pub const DXGI_STATUS_OCCLUDED: HRESULT = 0x087A0001; +pub const DXGI_STATUS_CLIPPED: HRESULT = 0x087A0002; +pub const DXGI_STATUS_NO_REDIRECTION: HRESULT = 0x087A0004; +pub const DXGI_STATUS_NO_DESKTOP_ACCESS: HRESULT = 0x087A0005; +pub const DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0x087A0006; +pub const DXGI_STATUS_MODE_CHANGED: HRESULT = 0x087A0007; +pub const DXGI_STATUS_MODE_CHANGE_IN_PROGRESS: HRESULT = 0x087A0008; +pub const DXGI_ERROR_INVALID_CALL: HRESULT = 0x887A0001u32 as HRESULT; +pub const DXGI_ERROR_NOT_FOUND: HRESULT = 0x887A0002u32 as HRESULT; +pub const DXGI_ERROR_MORE_DATA: HRESULT = 0x887A0003u32 as HRESULT; +pub const DXGI_ERROR_UNSUPPORTED: HRESULT = 0x887A0004u32 as HRESULT; +pub const DXGI_ERROR_DEVICE_REMOVED: HRESULT = 0x887A0005u32 as HRESULT; +pub const DXGI_ERROR_DEVICE_HUNG: HRESULT = 0x887A0006u32 as HRESULT; +pub const DXGI_ERROR_DEVICE_RESET: HRESULT = 0x887A0007u32 as HRESULT; +pub const DXGI_ERROR_WAS_STILL_DRAWING: HRESULT = 0x887A000Au32 as HRESULT; +pub const DXGI_ERROR_FRAME_STATISTICS_DISJOINT: HRESULT = 0x887A000Bu32 as HRESULT; +pub const DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0x887A000Cu32 as HRESULT; +pub const DXGI_ERROR_DRIVER_INTERNAL_ERROR: HRESULT = 0x887A0020u32 as HRESULT; +pub const DXGI_ERROR_NONEXCLUSIVE: HRESULT = 0x887A0021u32 as HRESULT; +pub const DXGI_ERROR_NOT_CURRENTLY_AVAILABLE: HRESULT = 0x887A0022u32 as HRESULT; +pub const DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED: HRESULT = 0x887A0023u32 as HRESULT; +pub const DXGI_ERROR_REMOTE_OUTOFMEMORY: HRESULT = 0x887A0024u32 as HRESULT; +pub const DXGI_ERROR_ACCESS_LOST: HRESULT = 0x887A0026u32 as HRESULT; +pub const DXGI_ERROR_WAIT_TIMEOUT: HRESULT = 0x887A0027u32 as HRESULT; +pub const DXGI_ERROR_SESSION_DISCONNECTED: HRESULT = 0x887A0028u32 as HRESULT; +pub const DXGI_ERROR_RESTRICT_TO_OUTPUT_STALE: HRESULT = 0x887A0029u32 as HRESULT; +pub const DXGI_ERROR_CANNOT_PROTECT_CONTENT: HRESULT = 0x887A002Au32 as HRESULT; +pub const DXGI_ERROR_ACCESS_DENIED: HRESULT = 0x887A002Bu32 as HRESULT; +pub const DXGI_ERROR_NAME_ALREADY_EXISTS: HRESULT = 0x887A002Cu32 as HRESULT; +pub const DXGI_ERROR_SDK_COMPONENT_MISSING: HRESULT = 0x887A002Du32 as HRESULT; +pub const DXGI_STATUS_UNOCCLUDED: HRESULT = 0x087A0009; +pub const DXGI_STATUS_DDA_WAS_STILL_DRAWING: HRESULT = 0x087A000A; +pub const DXGI_ERROR_MODE_CHANGE_IN_PROGRESS: HRESULT = 0x887A0025u32 as HRESULT; +pub const DXGI_DDI_ERR_WASSTILLDRAWING: HRESULT = 0x887B0001u32 as HRESULT; +pub const DXGI_DDI_ERR_UNSUPPORTED: HRESULT = 0x887B0002u32 as HRESULT; +pub const DXGI_DDI_ERR_NONEXCLUSIVE: HRESULT = 0x887B0003u32 as HRESULT; +pub const D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: HRESULT = 0x88790001u32 as HRESULT; +pub const D3D10_ERROR_FILE_NOT_FOUND: HRESULT = 0x88790002u32 as HRESULT; +pub const D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: HRESULT = 0x887C0001u32 as HRESULT; +pub const D3D11_ERROR_FILE_NOT_FOUND: HRESULT = 0x887C0002u32 as HRESULT; +pub const D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS: HRESULT = 0x887C0003u32 as HRESULT; +pub const D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD: HRESULT = 0x887C0004u32 as HRESULT; +pub const D2DERR_WRONG_STATE: HRESULT = 0x88990001u32 as HRESULT; +pub const D2DERR_NOT_INITIALIZED: HRESULT = 0x88990002u32 as HRESULT; +pub const D2DERR_UNSUPPORTED_OPERATION: HRESULT = 0x88990003u32 as HRESULT; +pub const D2DERR_SCANNER_FAILED: HRESULT = 0x88990004u32 as HRESULT; +pub const D2DERR_SCREEN_ACCESS_DENIED: HRESULT = 0x88990005u32 as HRESULT; +pub const D2DERR_DISPLAY_STATE_INVALID: HRESULT = 0x88990006u32 as HRESULT; +pub const D2DERR_ZERO_VECTOR: HRESULT = 0x88990007u32 as HRESULT; +pub const D2DERR_INTERNAL_ERROR: HRESULT = 0x88990008u32 as HRESULT; +pub const D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED: HRESULT = 0x88990009u32 as HRESULT; +pub const D2DERR_INVALID_CALL: HRESULT = 0x8899000Au32 as HRESULT; +pub const D2DERR_NO_HARDWARE_DEVICE: HRESULT = 0x8899000Bu32 as HRESULT; +pub const D2DERR_RECREATE_TARGET: HRESULT = 0x8899000Cu32 as HRESULT; +pub const D2DERR_TOO_MANY_SHADER_ELEMENTS: HRESULT = 0x8899000Du32 as HRESULT; +pub const D2DERR_SHADER_COMPILE_FAILED: HRESULT = 0x8899000Eu32 as HRESULT; +pub const D2DERR_MAX_TEXTURE_SIZE_EXCEEDED: HRESULT = 0x8899000Fu32 as HRESULT; +pub const D2DERR_UNSUPPORTED_VERSION: HRESULT = 0x88990010u32 as HRESULT; +pub const D2DERR_BAD_NUMBER: HRESULT = 0x88990011u32 as HRESULT; +pub const D2DERR_WRONG_FACTORY: HRESULT = 0x88990012u32 as HRESULT; +pub const D2DERR_LAYER_ALREADY_IN_USE: HRESULT = 0x88990013u32 as HRESULT; +pub const D2DERR_POP_CALL_DID_NOT_MATCH_PUSH: HRESULT = 0x88990014u32 as HRESULT; +pub const D2DERR_WRONG_RESOURCE_DOMAIN: HRESULT = 0x88990015u32 as HRESULT; +pub const D2DERR_PUSH_POP_UNBALANCED: HRESULT = 0x88990016u32 as HRESULT; +pub const D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT: HRESULT = 0x88990017u32 as HRESULT; +pub const D2DERR_INCOMPATIBLE_BRUSH_TYPES: HRESULT = 0x88990018u32 as HRESULT; +pub const D2DERR_WIN32_ERROR: HRESULT = 0x88990019u32 as HRESULT; +pub const D2DERR_TARGET_NOT_GDI_COMPATIBLE: HRESULT = 0x8899001Au32 as HRESULT; +pub const D2DERR_TEXT_EFFECT_IS_WRONG_TYPE: HRESULT = 0x8899001Bu32 as HRESULT; +pub const D2DERR_TEXT_RENDERER_NOT_RELEASED: HRESULT = 0x8899001Cu32 as HRESULT; +pub const D2DERR_EXCEEDS_MAX_BITMAP_SIZE: HRESULT = 0x8899001Du32 as HRESULT; +pub const D2DERR_INVALID_GRAPH_CONFIGURATION: HRESULT = 0x8899001Eu32 as HRESULT; +pub const D2DERR_INVALID_INTERNAL_GRAPH_CONFIGURATION: HRESULT = 0x8899001Fu32 as HRESULT; +pub const D2DERR_CYCLIC_GRAPH: HRESULT = 0x88990020u32 as HRESULT; +pub const D2DERR_BITMAP_CANNOT_DRAW: HRESULT = 0x88990021u32 as HRESULT; +pub const D2DERR_OUTSTANDING_BITMAP_REFERENCES: HRESULT = 0x88990022u32 as HRESULT; +pub const D2DERR_ORIGINAL_TARGET_NOT_BOUND: HRESULT = 0x88990023u32 as HRESULT; +pub const D2DERR_INVALID_TARGET: HRESULT = 0x88990024u32 as HRESULT; +pub const D2DERR_BITMAP_BOUND_AS_TARGET: HRESULT = 0x88990025u32 as HRESULT; +pub const D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES: HRESULT = 0x88990026u32 as HRESULT; +pub const D2DERR_INTERMEDIATE_TOO_LARGE: HRESULT = 0x88990027u32 as HRESULT; +pub const D2DERR_EFFECT_IS_NOT_REGISTERED: HRESULT = 0x88990028u32 as HRESULT; +pub const D2DERR_INVALID_PROPERTY: HRESULT = 0x88990029u32 as HRESULT; +pub const D2DERR_NO_SUBPROPERTIES: HRESULT = 0x8899002Au32 as HRESULT; +pub const D2DERR_PRINT_JOB_CLOSED: HRESULT = 0x8899002Bu32 as HRESULT; +pub const D2DERR_PRINT_FORMAT_NOT_SUPPORTED: HRESULT = 0x8899002Cu32 as HRESULT; +pub const D2DERR_TOO_MANY_TRANSFORM_INPUTS: HRESULT = 0x8899002Du32 as HRESULT; +pub const DWRITE_E_FILEFORMAT: HRESULT = 0x88985000u32 as HRESULT; +pub const DWRITE_E_UNEXPECTED: HRESULT = 0x88985001u32 as HRESULT; +pub const DWRITE_E_NOFONT: HRESULT = 0x88985002u32 as HRESULT; +pub const DWRITE_E_FILENOTFOUND: HRESULT = 0x88985003u32 as HRESULT; +pub const DWRITE_E_FILEACCESS: HRESULT = 0x88985004u32 as HRESULT; +pub const DWRITE_E_FONTCOLLECTIONOBSOLETE: HRESULT = 0x88985005u32 as HRESULT; +pub const DWRITE_E_ALREADYREGISTERED: HRESULT = 0x88985006u32 as HRESULT; +pub const DWRITE_E_CACHEFORMAT: HRESULT = 0x88985007u32 as HRESULT; +pub const DWRITE_E_CACHEVERSION: HRESULT = 0x88985008u32 as HRESULT; +pub const DWRITE_E_UNSUPPORTEDOPERATION: HRESULT = 0x88985009u32 as HRESULT; +pub const DWRITE_E_TEXTRENDERERINCOMPATIBLE: HRESULT = 0x8898500Au32 as HRESULT; +pub const DWRITE_E_FLOWDIRECTIONCONFLICTS: HRESULT = 0x8898500Bu32 as HRESULT; +pub const DWRITE_E_NOCOLOR: HRESULT = 0x8898500Cu32 as HRESULT; +pub const WINCODEC_ERR_WRONGSTATE: HRESULT = 0x88982F04u32 as HRESULT; +pub const WINCODEC_ERR_VALUEOUTOFRANGE: HRESULT = 0x88982F05u32 as HRESULT; +pub const WINCODEC_ERR_UNKNOWNIMAGEFORMAT: HRESULT = 0x88982F07u32 as HRESULT; +pub const WINCODEC_ERR_UNSUPPORTEDVERSION: HRESULT = 0x88982F0Bu32 as HRESULT; +pub const WINCODEC_ERR_NOTINITIALIZED: HRESULT = 0x88982F0Cu32 as HRESULT; +pub const WINCODEC_ERR_ALREADYLOCKED: HRESULT = 0x88982F0Du32 as HRESULT; +pub const WINCODEC_ERR_PROPERTYNOTFOUND: HRESULT = 0x88982F40u32 as HRESULT; +pub const WINCODEC_ERR_PROPERTYNOTSUPPORTED: HRESULT = 0x88982F41u32 as HRESULT; +pub const WINCODEC_ERR_PROPERTYSIZE: HRESULT = 0x88982F42u32 as HRESULT; +pub const WINCODEC_ERR_CODECPRESENT: HRESULT = 0x88982F43u32 as HRESULT; +pub const WINCODEC_ERR_CODECNOTHUMBNAIL: HRESULT = 0x88982F44u32 as HRESULT; +pub const WINCODEC_ERR_PALETTEUNAVAILABLE: HRESULT = 0x88982F45u32 as HRESULT; +pub const WINCODEC_ERR_CODECTOOMANYSCANLINES: HRESULT = 0x88982F46u32 as HRESULT; +pub const WINCODEC_ERR_INTERNALERROR: HRESULT = 0x88982F48u32 as HRESULT; +pub const WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS: HRESULT = 0x88982F49u32 as HRESULT; +pub const WINCODEC_ERR_COMPONENTNOTFOUND: HRESULT = 0x88982F50u32 as HRESULT; +pub const WINCODEC_ERR_IMAGESIZEOUTOFRANGE: HRESULT = 0x88982F51u32 as HRESULT; +pub const WINCODEC_ERR_TOOMUCHMETADATA: HRESULT = 0x88982F52u32 as HRESULT; +pub const WINCODEC_ERR_BADIMAGE: HRESULT = 0x88982F60u32 as HRESULT; +pub const WINCODEC_ERR_BADHEADER: HRESULT = 0x88982F61u32 as HRESULT; +pub const WINCODEC_ERR_FRAMEMISSING: HRESULT = 0x88982F62u32 as HRESULT; +pub const WINCODEC_ERR_BADMETADATAHEADER: HRESULT = 0x88982F63u32 as HRESULT; +pub const WINCODEC_ERR_BADSTREAMDATA: HRESULT = 0x88982F70u32 as HRESULT; +pub const WINCODEC_ERR_STREAMWRITE: HRESULT = 0x88982F71u32 as HRESULT; +pub const WINCODEC_ERR_STREAMREAD: HRESULT = 0x88982F72u32 as HRESULT; +pub const WINCODEC_ERR_STREAMNOTAVAILABLE: HRESULT = 0x88982F73u32 as HRESULT; +pub const WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT: HRESULT = 0x88982F80u32 as HRESULT; +pub const WINCODEC_ERR_UNSUPPORTEDOPERATION: HRESULT = 0x88982F81u32 as HRESULT; +pub const WINCODEC_ERR_INVALIDREGISTRATION: HRESULT = 0x88982F8Au32 as HRESULT; +pub const WINCODEC_ERR_COMPONENTINITIALIZEFAILURE: HRESULT = 0x88982F8Bu32 as HRESULT; +pub const WINCODEC_ERR_INSUFFICIENTBUFFER: HRESULT = 0x88982F8Cu32 as HRESULT; +pub const WINCODEC_ERR_DUPLICATEMETADATAPRESENT: HRESULT = 0x88982F8Du32 as HRESULT; +pub const WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE: HRESULT = 0x88982F8Eu32 as HRESULT; +pub const WINCODEC_ERR_UNEXPECTEDSIZE: HRESULT = 0x88982F8Fu32 as HRESULT; +pub const WINCODEC_ERR_INVALIDQUERYREQUEST: HRESULT = 0x88982F90u32 as HRESULT; +pub const WINCODEC_ERR_UNEXPECTEDMETADATATYPE: HRESULT = 0x88982F91u32 as HRESULT; +pub const WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT: HRESULT = 0x88982F92u32 as HRESULT; +pub const WINCODEC_ERR_INVALIDQUERYCHARACTER: HRESULT = 0x88982F93u32 as HRESULT; +pub const WINCODEC_ERR_WIN32ERROR: HRESULT = 0x88982F94u32 as HRESULT; +pub const WINCODEC_ERR_INVALIDPROGRESSIVELEVEL: HRESULT = 0x88982F95u32 as HRESULT; +pub const MILERR_OBJECTBUSY: HRESULT = 0x88980001u32 as HRESULT; +pub const MILERR_INSUFFICIENTBUFFER: HRESULT = 0x88980002u32 as HRESULT; +pub const MILERR_WIN32ERROR: HRESULT = 0x88980003u32 as HRESULT; +pub const MILERR_SCANNER_FAILED: HRESULT = 0x88980004u32 as HRESULT; +pub const MILERR_SCREENACCESSDENIED: HRESULT = 0x88980005u32 as HRESULT; +pub const MILERR_DISPLAYSTATEINVALID: HRESULT = 0x88980006u32 as HRESULT; +pub const MILERR_NONINVERTIBLEMATRIX: HRESULT = 0x88980007u32 as HRESULT; +pub const MILERR_ZEROVECTOR: HRESULT = 0x88980008u32 as HRESULT; +pub const MILERR_TERMINATED: HRESULT = 0x88980009u32 as HRESULT; +pub const MILERR_BADNUMBER: HRESULT = 0x8898000Au32 as HRESULT; +pub const MILERR_INTERNALERROR: HRESULT = 0x88980080u32 as HRESULT; +pub const MILERR_DISPLAYFORMATNOTSUPPORTED: HRESULT = 0x88980084u32 as HRESULT; +pub const MILERR_INVALIDCALL: HRESULT = 0x88980085u32 as HRESULT; +pub const MILERR_ALREADYLOCKED: HRESULT = 0x88980086u32 as HRESULT; +pub const MILERR_NOTLOCKED: HRESULT = 0x88980087u32 as HRESULT; +pub const MILERR_DEVICECANNOTRENDERTEXT: HRESULT = 0x88980088u32 as HRESULT; +pub const MILERR_GLYPHBITMAPMISSED: HRESULT = 0x88980089u32 as HRESULT; +pub const MILERR_MALFORMEDGLYPHCACHE: HRESULT = 0x8898008Au32 as HRESULT; +pub const MILERR_GENERIC_IGNORE: HRESULT = 0x8898008Bu32 as HRESULT; +pub const MILERR_MALFORMED_GUIDELINE_DATA: HRESULT = 0x8898008Cu32 as HRESULT; +pub const MILERR_NO_HARDWARE_DEVICE: HRESULT = 0x8898008Du32 as HRESULT; +pub const MILERR_NEED_RECREATE_AND_PRESENT: HRESULT = 0x8898008Eu32 as HRESULT; +pub const MILERR_ALREADY_INITIALIZED: HRESULT = 0x8898008Fu32 as HRESULT; +pub const MILERR_MISMATCHED_SIZE: HRESULT = 0x88980090u32 as HRESULT; +pub const MILERR_NO_REDIRECTION_SURFACE_AVAILABLE: HRESULT = 0x88980091u32 as HRESULT; +pub const MILERR_REMOTING_NOT_SUPPORTED: HRESULT = 0x88980092u32 as HRESULT; +pub const MILERR_QUEUED_PRESENT_NOT_SUPPORTED: HRESULT = 0x88980093u32 as HRESULT; +pub const MILERR_NOT_QUEUING_PRESENTS: HRESULT = 0x88980094u32 as HRESULT; +pub const MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER: HRESULT = 0x88980095u32 as HRESULT; +pub const MILERR_TOOMANYSHADERELEMNTS: HRESULT = 0x88980096u32 as HRESULT; +pub const MILERR_MROW_READLOCK_FAILED: HRESULT = 0x88980097u32 as HRESULT; +pub const MILERR_MROW_UPDATE_FAILED: HRESULT = 0x88980098u32 as HRESULT; +pub const MILERR_SHADER_COMPILE_FAILED: HRESULT = 0x88980099u32 as HRESULT; +pub const MILERR_MAX_TEXTURE_SIZE_EXCEEDED: HRESULT = 0x8898009Au32 as HRESULT; +pub const MILERR_QPC_TIME_WENT_BACKWARD: HRESULT = 0x8898009Bu32 as HRESULT; +pub const MILERR_DXGI_ENUMERATION_OUT_OF_SYNC: HRESULT = 0x8898009Du32 as HRESULT; +pub const MILERR_ADAPTER_NOT_FOUND: HRESULT = 0x8898009Eu32 as HRESULT; +pub const MILERR_COLORSPACE_NOT_SUPPORTED: HRESULT = 0x8898009Fu32 as HRESULT; +pub const MILERR_PREFILTER_NOT_SUPPORTED: HRESULT = 0x889800A0u32 as HRESULT; +pub const MILERR_DISPLAYID_ACCESS_DENIED: HRESULT = 0x889800A1u32 as HRESULT; +pub const UCEERR_INVALIDPACKETHEADER: HRESULT = 0x88980400u32 as HRESULT; +pub const UCEERR_UNKNOWNPACKET: HRESULT = 0x88980401u32 as HRESULT; +pub const UCEERR_ILLEGALPACKET: HRESULT = 0x88980402u32 as HRESULT; +pub const UCEERR_MALFORMEDPACKET: HRESULT = 0x88980403u32 as HRESULT; +pub const UCEERR_ILLEGALHANDLE: HRESULT = 0x88980404u32 as HRESULT; +pub const UCEERR_HANDLELOOKUPFAILED: HRESULT = 0x88980405u32 as HRESULT; +pub const UCEERR_RENDERTHREADFAILURE: HRESULT = 0x88980406u32 as HRESULT; +pub const UCEERR_CTXSTACKFRSTTARGETNULL: HRESULT = 0x88980407u32 as HRESULT; +pub const UCEERR_CONNECTIONIDLOOKUPFAILED: HRESULT = 0x88980408u32 as HRESULT; +pub const UCEERR_BLOCKSFULL: HRESULT = 0x88980409u32 as HRESULT; +pub const UCEERR_MEMORYFAILURE: HRESULT = 0x8898040Au32 as HRESULT; +pub const UCEERR_PACKETRECORDOUTOFRANGE: HRESULT = 0x8898040Bu32 as HRESULT; +pub const UCEERR_ILLEGALRECORDTYPE: HRESULT = 0x8898040Cu32 as HRESULT; +pub const UCEERR_OUTOFHANDLES: HRESULT = 0x8898040Du32 as HRESULT; +pub const UCEERR_UNCHANGABLE_UPDATE_ATTEMPTED: HRESULT = 0x8898040Eu32 as HRESULT; +pub const UCEERR_NO_MULTIPLE_WORKER_THREADS: HRESULT = 0x8898040Fu32 as HRESULT; +pub const UCEERR_REMOTINGNOTSUPPORTED: HRESULT = 0x88980410u32 as HRESULT; +pub const UCEERR_MISSINGENDCOMMAND: HRESULT = 0x88980411u32 as HRESULT; +pub const UCEERR_MISSINGBEGINCOMMAND: HRESULT = 0x88980412u32 as HRESULT; +pub const UCEERR_CHANNELSYNCTIMEDOUT: HRESULT = 0x88980413u32 as HRESULT; +pub const UCEERR_CHANNELSYNCABANDONED: HRESULT = 0x88980414u32 as HRESULT; +pub const UCEERR_UNSUPPORTEDTRANSPORTVERSION: HRESULT = 0x88980415u32 as HRESULT; +pub const UCEERR_TRANSPORTUNAVAILABLE: HRESULT = 0x88980416u32 as HRESULT; +pub const UCEERR_FEEDBACK_UNSUPPORTED: HRESULT = 0x88980417u32 as HRESULT; +pub const UCEERR_COMMANDTRANSPORTDENIED: HRESULT = 0x88980418u32 as HRESULT; +pub const UCEERR_GRAPHICSSTREAMUNAVAILABLE: HRESULT = 0x88980419u32 as HRESULT; +pub const UCEERR_GRAPHICSSTREAMALREADYOPEN: HRESULT = 0x88980420u32 as HRESULT; +pub const UCEERR_TRANSPORTDISCONNECTED: HRESULT = 0x88980421u32 as HRESULT; +pub const UCEERR_TRANSPORTOVERLOADED: HRESULT = 0x88980422u32 as HRESULT; +pub const UCEERR_PARTITION_ZOMBIED: HRESULT = 0x88980423u32 as HRESULT; +pub const MILAVERR_NOCLOCK: HRESULT = 0x88980500u32 as HRESULT; +pub const MILAVERR_NOMEDIATYPE: HRESULT = 0x88980501u32 as HRESULT; +pub const MILAVERR_NOVIDEOMIXER: HRESULT = 0x88980502u32 as HRESULT; +pub const MILAVERR_NOVIDEOPRESENTER: HRESULT = 0x88980503u32 as HRESULT; +pub const MILAVERR_NOREADYFRAMES: HRESULT = 0x88980504u32 as HRESULT; +pub const MILAVERR_MODULENOTLOADED: HRESULT = 0x88980505u32 as HRESULT; +pub const MILAVERR_WMPFACTORYNOTREGISTERED: HRESULT = 0x88980506u32 as HRESULT; +pub const MILAVERR_INVALIDWMPVERSION: HRESULT = 0x88980507u32 as HRESULT; +pub const MILAVERR_INSUFFICIENTVIDEORESOURCES: HRESULT = 0x88980508u32 as HRESULT; +pub const MILAVERR_VIDEOACCELERATIONNOTAVAILABLE: HRESULT = 0x88980509u32 as HRESULT; +pub const MILAVERR_REQUESTEDTEXTURETOOBIG: HRESULT = 0x8898050Au32 as HRESULT; +pub const MILAVERR_SEEKFAILED: HRESULT = 0x8898050Bu32 as HRESULT; +pub const MILAVERR_UNEXPECTEDWMPFAILURE: HRESULT = 0x8898050Cu32 as HRESULT; +pub const MILAVERR_MEDIAPLAYERCLOSED: HRESULT = 0x8898050Du32 as HRESULT; +pub const MILAVERR_UNKNOWNHARDWAREERROR: HRESULT = 0x8898050Eu32 as HRESULT; +pub const MILEFFECTSERR_UNKNOWNPROPERTY: HRESULT = 0x8898060Eu32 as HRESULT; +pub const MILEFFECTSERR_EFFECTNOTPARTOFGROUP: HRESULT = 0x8898060Fu32 as HRESULT; +pub const MILEFFECTSERR_NOINPUTSOURCEATTACHED: HRESULT = 0x88980610u32 as HRESULT; +pub const MILEFFECTSERR_CONNECTORNOTCONNECTED: HRESULT = 0x88980611u32 as HRESULT; +pub const MILEFFECTSERR_CONNECTORNOTASSOCIATEDWITHEFFECT: HRESULT = 0x88980612u32 as HRESULT; +pub const MILEFFECTSERR_RESERVED: HRESULT = 0x88980613u32 as HRESULT; +pub const MILEFFECTSERR_CYCLEDETECTED: HRESULT = 0x88980614u32 as HRESULT; +pub const MILEFFECTSERR_EFFECTINMORETHANONEGRAPH: HRESULT = 0x88980615u32 as HRESULT; +pub const MILEFFECTSERR_EFFECTALREADYINAGRAPH: HRESULT = 0x88980616u32 as HRESULT; +pub const MILEFFECTSERR_EFFECTHASNOCHILDREN: HRESULT = 0x88980617u32 as HRESULT; +pub const MILEFFECTSERR_ALREADYATTACHEDTOLISTENER: HRESULT = 0x88980618u32 as HRESULT; +pub const MILEFFECTSERR_NOTAFFINETRANSFORM: HRESULT = 0x88980619u32 as HRESULT; +pub const MILEFFECTSERR_EMPTYBOUNDS: HRESULT = 0x8898061Au32 as HRESULT; +pub const MILEFFECTSERR_OUTPUTSIZETOOLARGE: HRESULT = 0x8898061Bu32 as HRESULT; +pub const DWMERR_STATE_TRANSITION_FAILED: HRESULT = 0x88980700u32 as HRESULT; +pub const DWMERR_THEME_FAILED: HRESULT = 0x88980701u32 as HRESULT; +pub const DWMERR_CATASTROPHIC_FAILURE: HRESULT = 0x88980702u32 as HRESULT; +pub const DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED: HRESULT = 0x88980800u32 as HRESULT; +pub const DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED: HRESULT = 0x88980801u32 as HRESULT; +pub const DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED: HRESULT = 0x88980802u32 as HRESULT; +pub const ONL_E_INVALID_AUTHENTICATION_TARGET: HRESULT = 0x80860001u32 as HRESULT; +pub const ONL_E_ACCESS_DENIED_BY_TOU: HRESULT = 0x80860002u32 as HRESULT; +pub const ONL_E_INVALID_APPLICATION: HRESULT = 0x80860003u32 as HRESULT; +pub const ONL_E_PASSWORD_UPDATE_REQUIRED: HRESULT = 0x80860004u32 as HRESULT; +pub const ONL_E_ACCOUNT_UPDATE_REQUIRED: HRESULT = 0x80860005u32 as HRESULT; +pub const ONL_E_FORCESIGNIN: HRESULT = 0x80860006u32 as HRESULT; +pub const ONL_E_ACCOUNT_LOCKED: HRESULT = 0x80860007u32 as HRESULT; +pub const ONL_E_PARENTAL_CONSENT_REQUIRED: HRESULT = 0x80860008u32 as HRESULT; +pub const ONL_E_EMAIL_VERIFICATION_REQUIRED: HRESULT = 0x80860009u32 as HRESULT; +pub const ONL_E_ACCOUNT_SUSPENDED_COMPROIMISE: HRESULT = 0x8086000Au32 as HRESULT; +pub const ONL_E_ACCOUNT_SUSPENDED_ABUSE: HRESULT = 0x8086000Bu32 as HRESULT; +pub const ONL_E_ACTION_REQUIRED: HRESULT = 0x8086000Cu32 as HRESULT; +pub const ONL_CONNECTION_COUNT_LIMIT: HRESULT = 0x8086000Du32 as HRESULT; +pub const ONL_E_CONNECTED_ACCOUNT_CAN_NOT_SIGNOUT: HRESULT = 0x8086000Eu32 as HRESULT; +pub const ONL_E_USER_AUTHENTICATION_REQUIRED: HRESULT = 0x8086000Fu32 as HRESULT; +pub const ONL_E_REQUEST_THROTTLED: HRESULT = 0x80860010u32 as HRESULT; +pub const FA_E_MAX_PERSISTED_ITEMS_REACHED: HRESULT = 0x80270220u32 as HRESULT; +pub const FA_E_HOMEGROUP_NOT_AVAILABLE: HRESULT = 0x80270222u32 as HRESULT; +pub const E_MONITOR_RESOLUTION_TOO_LOW: HRESULT = 0x80270250u32 as HRESULT; +pub const E_ELEVATED_ACTIVATION_NOT_SUPPORTED: HRESULT = 0x80270251u32 as HRESULT; +pub const E_UAC_DISABLED: HRESULT = 0x80270252u32 as HRESULT; +pub const E_FULL_ADMIN_NOT_SUPPORTED: HRESULT = 0x80270253u32 as HRESULT; +pub const E_APPLICATION_NOT_REGISTERED: HRESULT = 0x80270254u32 as HRESULT; +pub const E_MULTIPLE_EXTENSIONS_FOR_APPLICATION: HRESULT = 0x80270255u32 as HRESULT; +pub const E_MULTIPLE_PACKAGES_FOR_FAMILY: HRESULT = 0x80270256u32 as HRESULT; +pub const E_APPLICATION_MANAGER_NOT_RUNNING: HRESULT = 0x80270257u32 as HRESULT; +pub const S_STORE_LAUNCHED_FOR_REMEDIATION: HRESULT = 0x00270258; +pub const S_APPLICATION_ACTIVATION_ERROR_HANDLED_BY_DIALOG: HRESULT = 0x00270259; +pub const E_APPLICATION_ACTIVATION_TIMED_OUT: HRESULT = 0x8027025Au32 as HRESULT; +pub const E_APPLICATION_ACTIVATION_EXEC_FAILURE: HRESULT = 0x8027025Bu32 as HRESULT; +pub const E_APPLICATION_TEMPORARY_LICENSE_ERROR: HRESULT = 0x8027025Cu32 as HRESULT; +pub const E_APPLICATION_TRIAL_LICENSE_EXPIRED: HRESULT = 0x8027025Du32 as HRESULT; +pub const E_SKYDRIVE_ROOT_TARGET_FILE_SYSTEM_NOT_SUPPORTED: HRESULT = 0x80270260u32 as HRESULT; +pub const E_SKYDRIVE_ROOT_TARGET_OVERLAP: HRESULT = 0x80270261u32 as HRESULT; +pub const E_SKYDRIVE_ROOT_TARGET_CANNOT_INDEX: HRESULT = 0x80270262u32 as HRESULT; +pub const E_SKYDRIVE_FILE_NOT_UPLOADED: HRESULT = 0x80270263u32 as HRESULT; +pub const E_SKYDRIVE_UPDATE_AVAILABILITY_FAIL: HRESULT = 0x80270264u32 as HRESULT; +pub const E_SKYDRIVE_ROOT_TARGET_VOLUME_ROOT_NOT_SUPPORTED: HRESULT = 0x80270265u32 as HRESULT; +pub const E_SYNCENGINE_FILE_SIZE_OVER_LIMIT: HRESULT = 0x8802B001u32 as HRESULT; +pub const E_SYNCENGINE_FILE_SIZE_EXCEEDS_REMAINING_QUOTA: HRESULT = 0x8802B002u32 as HRESULT; +pub const E_SYNCENGINE_UNSUPPORTED_FILE_NAME: HRESULT = 0x8802B003u32 as HRESULT; +pub const E_SYNCENGINE_FOLDER_ITEM_COUNT_LIMIT_EXCEEDED: HRESULT = 0x8802B004u32 as HRESULT; +pub const E_SYNCENGINE_FILE_SYNC_PARTNER_ERROR: HRESULT = 0x8802B005u32 as HRESULT; +pub const E_SYNCENGINE_SYNC_PAUSED_BY_SERVICE: HRESULT = 0x8802B006u32 as HRESULT; +pub const E_SYNCENGINE_FILE_IDENTIFIER_UNKNOWN: HRESULT = 0x8802C002u32 as HRESULT; +pub const E_SYNCENGINE_SERVICE_AUTHENTICATION_FAILED: HRESULT = 0x8802C003u32 as HRESULT; +pub const E_SYNCENGINE_UNKNOWN_SERVICE_ERROR: HRESULT = 0x8802C004u32 as HRESULT; +pub const E_SYNCENGINE_SERVICE_RETURNED_UNEXPECTED_SIZE: HRESULT = 0x8802C005u32 as HRESULT; +pub const E_SYNCENGINE_REQUEST_BLOCKED_BY_SERVICE: HRESULT = 0x8802C006u32 as HRESULT; +pub const E_SYNCENGINE_REQUEST_BLOCKED_DUE_TO_CLIENT_ERROR: HRESULT = 0x8802C007u32 as HRESULT; +pub const E_SYNCENGINE_FOLDER_INACCESSIBLE: HRESULT = 0x8802D001u32 as HRESULT; +pub const E_SYNCENGINE_UNSUPPORTED_FOLDER_NAME: HRESULT = 0x8802D002u32 as HRESULT; +pub const E_SYNCENGINE_UNSUPPORTED_MARKET: HRESULT = 0x8802D003u32 as HRESULT; +pub const E_SYNCENGINE_PATH_LENGTH_LIMIT_EXCEEDED: HRESULT = 0x8802D004u32 as HRESULT; +pub const E_SYNCENGINE_REMOTE_PATH_LENGTH_LIMIT_EXCEEDED: HRESULT = 0x8802D005u32 as HRESULT; +pub const E_SYNCENGINE_CLIENT_UPDATE_NEEDED: HRESULT = 0x8802D006u32 as HRESULT; +pub const E_SYNCENGINE_PROXY_AUTHENTICATION_REQUIRED: HRESULT = 0x8802D007u32 as HRESULT; +pub const E_SYNCENGINE_STORAGE_SERVICE_PROVISIONING_FAILED: HRESULT = 0x8802D008u32 as HRESULT; +pub const E_SYNCENGINE_UNSUPPORTED_REPARSE_POINT: HRESULT = 0x8802D009u32 as HRESULT; +pub const E_SYNCENGINE_STORAGE_SERVICE_BLOCKED: HRESULT = 0x8802D00Au32 as HRESULT; +pub const E_SYNCENGINE_FOLDER_IN_REDIRECTION: HRESULT = 0x8802D00Bu32 as HRESULT; +pub const EAS_E_POLICY_NOT_MANAGED_BY_OS: HRESULT = 0x80550001u32 as HRESULT; +pub const EAS_E_POLICY_COMPLIANT_WITH_ACTIONS: HRESULT = 0x80550002u32 as HRESULT; +pub const EAS_E_REQUESTED_POLICY_NOT_ENFORCEABLE: HRESULT = 0x80550003u32 as HRESULT; +pub const EAS_E_CURRENT_USER_HAS_BLANK_PASSWORD: HRESULT = 0x80550004u32 as HRESULT; +pub const EAS_E_REQUESTED_POLICY_PASSWORD_EXPIRATION_INCOMPATIBLE: HRESULT = 0x80550005u32 as HRESULT; +pub const EAS_E_USER_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550006u32 as HRESULT; +pub const EAS_E_ADMINS_HAVE_BLANK_PASSWORD: HRESULT = 0x80550007u32 as HRESULT; +pub const EAS_E_ADMINS_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550008u32 as HRESULT; +pub const EAS_E_LOCAL_CONTROLLED_USERS_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550009u32 as HRESULT; +pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CONNECTED_ADMINS: HRESULT = 0x8055000Au32 as HRESULT; +pub const EAS_E_CONNECTED_ADMINS_NEED_TO_CHANGE_PASSWORD: HRESULT = 0x8055000Bu32 as HRESULT; +pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CURRENT_CONNECTED_USER: HRESULT = 0x8055000Cu32 as HRESULT; +pub const EAS_E_CURRENT_CONNECTED_USER_NEED_TO_CHANGE_PASSWORD: HRESULT = 0x8055000Du32 as HRESULT; +pub const WEB_E_UNSUPPORTED_FORMAT: HRESULT = 0x83750001u32 as HRESULT; +pub const WEB_E_INVALID_XML: HRESULT = 0x83750002u32 as HRESULT; +pub const WEB_E_MISSING_REQUIRED_ELEMENT: HRESULT = 0x83750003u32 as HRESULT; +pub const WEB_E_MISSING_REQUIRED_ATTRIBUTE: HRESULT = 0x83750004u32 as HRESULT; +pub const WEB_E_UNEXPECTED_CONTENT: HRESULT = 0x83750005u32 as HRESULT; +pub const WEB_E_RESOURCE_TOO_LARGE: HRESULT = 0x83750006u32 as HRESULT; +pub const WEB_E_INVALID_JSON_STRING: HRESULT = 0x83750007u32 as HRESULT; +pub const WEB_E_INVALID_JSON_NUMBER: HRESULT = 0x83750008u32 as HRESULT; +pub const WEB_E_JSON_VALUE_NOT_FOUND: HRESULT = 0x83750009u32 as HRESULT; +pub const HTTP_E_STATUS_UNEXPECTED: HRESULT = 0x80190001u32 as HRESULT; +pub const HTTP_E_STATUS_UNEXPECTED_REDIRECTION: HRESULT = 0x80190003u32 as HRESULT; +pub const HTTP_E_STATUS_UNEXPECTED_CLIENT_ERROR: HRESULT = 0x80190004u32 as HRESULT; +pub const HTTP_E_STATUS_UNEXPECTED_SERVER_ERROR: HRESULT = 0x80190005u32 as HRESULT; +pub const HTTP_E_STATUS_AMBIGUOUS: HRESULT = 0x8019012Cu32 as HRESULT; +pub const HTTP_E_STATUS_MOVED: HRESULT = 0x8019012Du32 as HRESULT; +pub const HTTP_E_STATUS_REDIRECT: HRESULT = 0x8019012Eu32 as HRESULT; +pub const HTTP_E_STATUS_REDIRECT_METHOD: HRESULT = 0x8019012Fu32 as HRESULT; +pub const HTTP_E_STATUS_NOT_MODIFIED: HRESULT = 0x80190130u32 as HRESULT; +pub const HTTP_E_STATUS_USE_PROXY: HRESULT = 0x80190131u32 as HRESULT; +pub const HTTP_E_STATUS_REDIRECT_KEEP_VERB: HRESULT = 0x80190133u32 as HRESULT; +pub const HTTP_E_STATUS_BAD_REQUEST: HRESULT = 0x80190190u32 as HRESULT; +pub const HTTP_E_STATUS_DENIED: HRESULT = 0x80190191u32 as HRESULT; +pub const HTTP_E_STATUS_PAYMENT_REQ: HRESULT = 0x80190192u32 as HRESULT; +pub const HTTP_E_STATUS_FORBIDDEN: HRESULT = 0x80190193u32 as HRESULT; +pub const HTTP_E_STATUS_NOT_FOUND: HRESULT = 0x80190194u32 as HRESULT; +pub const HTTP_E_STATUS_BAD_METHOD: HRESULT = 0x80190195u32 as HRESULT; +pub const HTTP_E_STATUS_NONE_ACCEPTABLE: HRESULT = 0x80190196u32 as HRESULT; +pub const HTTP_E_STATUS_PROXY_AUTH_REQ: HRESULT = 0x80190197u32 as HRESULT; +pub const HTTP_E_STATUS_REQUEST_TIMEOUT: HRESULT = 0x80190198u32 as HRESULT; +pub const HTTP_E_STATUS_CONFLICT: HRESULT = 0x80190199u32 as HRESULT; +pub const HTTP_E_STATUS_GONE: HRESULT = 0x8019019Au32 as HRESULT; +pub const HTTP_E_STATUS_LENGTH_REQUIRED: HRESULT = 0x8019019Bu32 as HRESULT; +pub const HTTP_E_STATUS_PRECOND_FAILED: HRESULT = 0x8019019Cu32 as HRESULT; +pub const HTTP_E_STATUS_REQUEST_TOO_LARGE: HRESULT = 0x8019019Du32 as HRESULT; +pub const HTTP_E_STATUS_URI_TOO_LONG: HRESULT = 0x8019019Eu32 as HRESULT; +pub const HTTP_E_STATUS_UNSUPPORTED_MEDIA: HRESULT = 0x8019019Fu32 as HRESULT; +pub const HTTP_E_STATUS_RANGE_NOT_SATISFIABLE: HRESULT = 0x801901A0u32 as HRESULT; +pub const HTTP_E_STATUS_EXPECTATION_FAILED: HRESULT = 0x801901A1u32 as HRESULT; +pub const HTTP_E_STATUS_SERVER_ERROR: HRESULT = 0x801901F4u32 as HRESULT; +pub const HTTP_E_STATUS_NOT_SUPPORTED: HRESULT = 0x801901F5u32 as HRESULT; +pub const HTTP_E_STATUS_BAD_GATEWAY: HRESULT = 0x801901F6u32 as HRESULT; +pub const HTTP_E_STATUS_SERVICE_UNAVAIL: HRESULT = 0x801901F7u32 as HRESULT; +pub const HTTP_E_STATUS_GATEWAY_TIMEOUT: HRESULT = 0x801901F8u32 as HRESULT; +pub const HTTP_E_STATUS_VERSION_NOT_SUP: HRESULT = 0x801901F9u32 as HRESULT; +pub const E_INVALID_PROTOCOL_OPERATION: HRESULT = 0x83760001u32 as HRESULT; +pub const E_INVALID_PROTOCOL_FORMAT: HRESULT = 0x83760002u32 as HRESULT; +pub const E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED: HRESULT = 0x83760003u32 as HRESULT; +pub const E_SUBPROTOCOL_NOT_SUPPORTED: HRESULT = 0x83760004u32 as HRESULT; +pub const E_PROTOCOL_VERSION_NOT_SUPPORTED: HRESULT = 0x83760005u32 as HRESULT; +pub const INPUT_E_OUT_OF_ORDER: HRESULT = 0x80400000u32 as HRESULT; +pub const INPUT_E_REENTRANCY: HRESULT = 0x80400001u32 as HRESULT; +pub const INPUT_E_MULTIMODAL: HRESULT = 0x80400002u32 as HRESULT; +pub const INPUT_E_PACKET: HRESULT = 0x80400003u32 as HRESULT; +pub const INPUT_E_FRAME: HRESULT = 0x80400004u32 as HRESULT; +pub const INPUT_E_HISTORY: HRESULT = 0x80400005u32 as HRESULT; +pub const INPUT_E_DEVICE_INFO: HRESULT = 0x80400006u32 as HRESULT; +pub const INPUT_E_TRANSFORM: HRESULT = 0x80400007u32 as HRESULT; +pub const INPUT_E_DEVICE_PROPERTY: HRESULT = 0x80400008u32 as HRESULT; +pub const INET_E_INVALID_URL: HRESULT = 0x800C0002u32 as HRESULT; +pub const INET_E_NO_SESSION: HRESULT = 0x800C0003u32 as HRESULT; +pub const INET_E_CANNOT_CONNECT: HRESULT = 0x800C0004u32 as HRESULT; +pub const INET_E_RESOURCE_NOT_FOUND: HRESULT = 0x800C0005u32 as HRESULT; +pub const INET_E_OBJECT_NOT_FOUND: HRESULT = 0x800C0006u32 as HRESULT; +pub const INET_E_DATA_NOT_AVAILABLE: HRESULT = 0x800C0007u32 as HRESULT; +pub const INET_E_DOWNLOAD_FAILURE: HRESULT = 0x800C0008u32 as HRESULT; +pub const INET_E_AUTHENTICATION_REQUIRED: HRESULT = 0x800C0009u32 as HRESULT; +pub const INET_E_NO_VALID_MEDIA: HRESULT = 0x800C000Au32 as HRESULT; +pub const INET_E_CONNECTION_TIMEOUT: HRESULT = 0x800C000Bu32 as HRESULT; +pub const INET_E_INVALID_REQUEST: HRESULT = 0x800C000Cu32 as HRESULT; +pub const INET_E_UNKNOWN_PROTOCOL: HRESULT = 0x800C000Du32 as HRESULT; +pub const INET_E_SECURITY_PROBLEM: HRESULT = 0x800C000Eu32 as HRESULT; +pub const INET_E_CANNOT_LOAD_DATA: HRESULT = 0x800C000Fu32 as HRESULT; +pub const INET_E_CANNOT_INSTANTIATE_OBJECT: HRESULT = 0x800C0010u32 as HRESULT; +pub const INET_E_INVALID_CERTIFICATE: HRESULT = 0x800C0019u32 as HRESULT; +pub const INET_E_REDIRECT_FAILED: HRESULT = 0x800C0014u32 as HRESULT; +pub const INET_E_REDIRECT_TO_DIR: HRESULT = 0x800C0015u32 as HRESULT; +pub const ERROR_DBG_CREATE_PROCESS_FAILURE_LOCKDOWN: HRESULT = 0x80B00001u32 as HRESULT; +pub const ERROR_DBG_ATTACH_PROCESS_FAILURE_LOCKDOWN: HRESULT = 0x80B00002u32 as HRESULT; +pub const ERROR_DBG_CONNECT_SERVER_FAILURE_LOCKDOWN: HRESULT = 0x80B00003u32 as HRESULT; +pub const ERROR_DBG_START_SERVER_FAILURE_LOCKDOWN: HRESULT = 0x80B00004u32 as HRESULT; +pub const ERROR_IO_PREEMPTED: HRESULT = 0x89010001u32 as HRESULT; +pub const JSCRIPT_E_CANTEXECUTE: HRESULT = 0x89020001u32 as HRESULT; +pub const WEP_E_NOT_PROVISIONED_ON_ALL_VOLUMES: HRESULT = 0x88010001u32 as HRESULT; +pub const WEP_E_FIXED_DATA_NOT_SUPPORTED: HRESULT = 0x88010002u32 as HRESULT; +pub const WEP_E_HARDWARE_NOT_COMPLIANT: HRESULT = 0x88010003u32 as HRESULT; +pub const WEP_E_LOCK_NOT_CONFIGURED: HRESULT = 0x88010004u32 as HRESULT; +pub const WEP_E_PROTECTION_SUSPENDED: HRESULT = 0x88010005u32 as HRESULT; +pub const WEP_E_NO_LICENSE: HRESULT = 0x88010006u32 as HRESULT; +pub const WEP_E_OS_NOT_PROTECTED: HRESULT = 0x88010007u32 as HRESULT; +pub const WEP_E_UNEXPECTED_FAIL: HRESULT = 0x88010008u32 as HRESULT; +pub const WEP_E_BUFFER_TOO_LARGE: HRESULT = 0x88010009u32 as HRESULT; +pub const ERROR_SVHDX_ERROR_STORED: HRESULT = 0xC05C0000u32 as HRESULT; +pub const ERROR_SVHDX_ERROR_NOT_AVAILABLE: HRESULT = 0xC05CFF00u32 as HRESULT; +pub const ERROR_SVHDX_UNIT_ATTENTION_AVAILABLE: HRESULT = 0xC05CFF01u32 as HRESULT; +pub const ERROR_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED: HRESULT = 0xC05CFF02u32 as HRESULT; +pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED: HRESULT = 0xC05CFF03u32 as HRESULT; +pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED: HRESULT = 0xC05CFF04u32 as HRESULT; +pub const ERROR_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED: HRESULT = 0xC05CFF05u32 as HRESULT; +pub const ERROR_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED: HRESULT = 0xC05CFF06u32 as HRESULT; +pub const ERROR_SVHDX_RESERVATION_CONFLICT: HRESULT = 0xC05CFF07u32 as HRESULT; +pub const ERROR_SVHDX_WRONG_FILE_TYPE: HRESULT = 0xC05CFF08u32 as HRESULT; +pub const ERROR_SVHDX_VERSION_MISMATCH: HRESULT = 0xC05CFF09u32 as HRESULT; +pub const ERROR_VHD_SHARED: HRESULT = 0xC05CFF0Au32 as HRESULT; +pub const WININET_E_OUT_OF_HANDLES: HRESULT = 0x80072EE1u32 as HRESULT; +pub const WININET_E_TIMEOUT: HRESULT = 0x80072EE2u32 as HRESULT; +pub const WININET_E_EXTENDED_ERROR: HRESULT = 0x80072EE3u32 as HRESULT; +pub const WININET_E_INTERNAL_ERROR: HRESULT = 0x80072EE4u32 as HRESULT; +pub const WININET_E_INVALID_URL: HRESULT = 0x80072EE5u32 as HRESULT; +pub const WININET_E_UNRECOGNIZED_SCHEME: HRESULT = 0x80072EE6u32 as HRESULT; +pub const WININET_E_NAME_NOT_RESOLVED: HRESULT = 0x80072EE7u32 as HRESULT; +pub const WININET_E_PROTOCOL_NOT_FOUND: HRESULT = 0x80072EE8u32 as HRESULT; +pub const WININET_E_INVALID_OPTION: HRESULT = 0x80072EE9u32 as HRESULT; +pub const WININET_E_BAD_OPTION_LENGTH: HRESULT = 0x80072EEAu32 as HRESULT; +pub const WININET_E_OPTION_NOT_SETTABLE: HRESULT = 0x80072EEBu32 as HRESULT; +pub const WININET_E_SHUTDOWN: HRESULT = 0x80072EECu32 as HRESULT; +pub const WININET_E_INCORRECT_USER_NAME: HRESULT = 0x80072EEDu32 as HRESULT; +pub const WININET_E_INCORRECT_PASSWORD: HRESULT = 0x80072EEEu32 as HRESULT; +pub const WININET_E_LOGIN_FAILURE: HRESULT = 0x80072EEFu32 as HRESULT; +pub const WININET_E_INVALID_OPERATION: HRESULT = 0x80072EF0u32 as HRESULT; +pub const WININET_E_OPERATION_CANCELLED: HRESULT = 0x80072EF1u32 as HRESULT; +pub const WININET_E_INCORRECT_HANDLE_TYPE: HRESULT = 0x80072EF2u32 as HRESULT; +pub const WININET_E_INCORRECT_HANDLE_STATE: HRESULT = 0x80072EF3u32 as HRESULT; +pub const WININET_E_NOT_PROXY_REQUEST: HRESULT = 0x80072EF4u32 as HRESULT; +pub const WININET_E_REGISTRY_VALUE_NOT_FOUND: HRESULT = 0x80072EF5u32 as HRESULT; +pub const WININET_E_BAD_REGISTRY_PARAMETER: HRESULT = 0x80072EF6u32 as HRESULT; +pub const WININET_E_NO_DIRECT_ACCESS: HRESULT = 0x80072EF7u32 as HRESULT; +pub const WININET_E_NO_CONTEXT: HRESULT = 0x80072EF8u32 as HRESULT; +pub const WININET_E_NO_CALLBACK: HRESULT = 0x80072EF9u32 as HRESULT; +pub const WININET_E_REQUEST_PENDING: HRESULT = 0x80072EFAu32 as HRESULT; +pub const WININET_E_INCORRECT_FORMAT: HRESULT = 0x80072EFBu32 as HRESULT; +pub const WININET_E_ITEM_NOT_FOUND: HRESULT = 0x80072EFCu32 as HRESULT; +pub const WININET_E_CANNOT_CONNECT: HRESULT = 0x80072EFDu32 as HRESULT; +pub const WININET_E_CONNECTION_ABORTED: HRESULT = 0x80072EFEu32 as HRESULT; +pub const WININET_E_CONNECTION_RESET: HRESULT = 0x80072EFFu32 as HRESULT; +pub const WININET_E_FORCE_RETRY: HRESULT = 0x80072F00u32 as HRESULT; +pub const WININET_E_INVALID_PROXY_REQUEST: HRESULT = 0x80072F01u32 as HRESULT; +pub const WININET_E_NEED_UI: HRESULT = 0x80072F02u32 as HRESULT; +pub const WININET_E_HANDLE_EXISTS: HRESULT = 0x80072F04u32 as HRESULT; +pub const WININET_E_SEC_CERT_DATE_INVALID: HRESULT = 0x80072F05u32 as HRESULT; +pub const WININET_E_SEC_CERT_CN_INVALID: HRESULT = 0x80072F06u32 as HRESULT; +pub const WININET_E_HTTP_TO_HTTPS_ON_REDIR: HRESULT = 0x80072F07u32 as HRESULT; +pub const WININET_E_HTTPS_TO_HTTP_ON_REDIR: HRESULT = 0x80072F08u32 as HRESULT; +pub const WININET_E_MIXED_SECURITY: HRESULT = 0x80072F09u32 as HRESULT; +pub const WININET_E_CHG_POST_IS_NON_SECURE: HRESULT = 0x80072F0Au32 as HRESULT; +pub const WININET_E_POST_IS_NON_SECURE: HRESULT = 0x80072F0Bu32 as HRESULT; +pub const WININET_E_CLIENT_AUTH_CERT_NEEDED: HRESULT = 0x80072F0Cu32 as HRESULT; +pub const WININET_E_INVALID_CA: HRESULT = 0x80072F0Du32 as HRESULT; +pub const WININET_E_CLIENT_AUTH_NOT_SETUP: HRESULT = 0x80072F0Eu32 as HRESULT; +pub const WININET_E_ASYNC_THREAD_FAILED: HRESULT = 0x80072F0Fu32 as HRESULT; +pub const WININET_E_REDIRECT_SCHEME_CHANGE: HRESULT = 0x80072F10u32 as HRESULT; +pub const WININET_E_DIALOG_PENDING: HRESULT = 0x80072F11u32 as HRESULT; +pub const WININET_E_RETRY_DIALOG: HRESULT = 0x80072F12u32 as HRESULT; +pub const WININET_E_NO_NEW_CONTAINERS: HRESULT = 0x80072F13u32 as HRESULT; +pub const WININET_E_HTTPS_HTTP_SUBMIT_REDIR: HRESULT = 0x80072F14u32 as HRESULT; +pub const WININET_E_SEC_CERT_ERRORS: HRESULT = 0x80072F17u32 as HRESULT; +pub const WININET_E_SEC_CERT_REV_FAILED: HRESULT = 0x80072F19u32 as HRESULT; +pub const WININET_E_HEADER_NOT_FOUND: HRESULT = 0x80072F76u32 as HRESULT; +pub const WININET_E_DOWNLEVEL_SERVER: HRESULT = 0x80072F77u32 as HRESULT; +pub const WININET_E_INVALID_SERVER_RESPONSE: HRESULT = 0x80072F78u32 as HRESULT; +pub const WININET_E_INVALID_HEADER: HRESULT = 0x80072F79u32 as HRESULT; +pub const WININET_E_INVALID_QUERY_REQUEST: HRESULT = 0x80072F7Au32 as HRESULT; +pub const WININET_E_HEADER_ALREADY_EXISTS: HRESULT = 0x80072F7Bu32 as HRESULT; +pub const WININET_E_REDIRECT_FAILED: HRESULT = 0x80072F7Cu32 as HRESULT; +pub const WININET_E_SECURITY_CHANNEL_ERROR: HRESULT = 0x80072F7Du32 as HRESULT; +pub const WININET_E_UNABLE_TO_CACHE_FILE: HRESULT = 0x80072F7Eu32 as HRESULT; +pub const WININET_E_TCPIP_NOT_INSTALLED: HRESULT = 0x80072F7Fu32 as HRESULT; +pub const WININET_E_DISCONNECTED: HRESULT = 0x80072F83u32 as HRESULT; +pub const WININET_E_SERVER_UNREACHABLE: HRESULT = 0x80072F84u32 as HRESULT; +pub const WININET_E_PROXY_SERVER_UNREACHABLE: HRESULT = 0x80072F85u32 as HRESULT; +pub const WININET_E_BAD_AUTO_PROXY_SCRIPT: HRESULT = 0x80072F86u32 as HRESULT; +pub const WININET_E_UNABLE_TO_DOWNLOAD_SCRIPT: HRESULT = 0x80072F87u32 as HRESULT; +pub const WININET_E_SEC_INVALID_CERT: HRESULT = 0x80072F89u32 as HRESULT; +pub const WININET_E_SEC_CERT_REVOKED: HRESULT = 0x80072F8Au32 as HRESULT; +pub const WININET_E_FAILED_DUETOSECURITYCHECK: HRESULT = 0x80072F8Bu32 as HRESULT; +pub const WININET_E_NOT_INITIALIZED: HRESULT = 0x80072F8Cu32 as HRESULT; +pub const WININET_E_LOGIN_FAILURE_DISPLAY_ENTITY_BODY: HRESULT = 0x80072F8Eu32 as HRESULT; +pub const WININET_E_DECODING_FAILED: HRESULT = 0x80072F8Fu32 as HRESULT; +pub const WININET_E_NOT_REDIRECTED: HRESULT = 0x80072F80u32 as HRESULT; +pub const WININET_E_COOKIE_NEEDS_CONFIRMATION: HRESULT = 0x80072F81u32 as HRESULT; +pub const WININET_E_COOKIE_DECLINED: HRESULT = 0x80072F82u32 as HRESULT; +pub const WININET_E_REDIRECT_NEEDS_CONFIRMATION: HRESULT = 0x80072F88u32 as HRESULT; diff --git a/third_party/rust/winapi/src/winevt.rs b/third_party/rust/winapi/src/winevt.rs new file mode 100644 index 000000000000..3f2d6a03a737 --- /dev/null +++ b/third_party/rust/winapi/src/winevt.rs @@ -0,0 +1,40 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Windows Events API +pub type EVT_HANDLE = ::HANDLE; +pub type PEVT_HANDLE = *mut ::HANDLE; +ENUM!{enum EVT_VARIANT_TYPE { + EvtVarTypeNull = 0, + EvtVarTypeString = 1, + EvtVarTypeAnsiString = 2, + EvtVarTypeSByte = 3, + EvtVarTypeByte = 4, + EvtVarTypeInt16 = 5, + EvtVarTypeUInt16 = 6, + EvtVarTypeInt32 = 7, + EvtVarTypeUInt32 = 8, + EvtVarTypeInt64 = 9, + EvtVarTypeUInt64 = 10, + EvtVarTypeSingle = 11, + EvtVarTypeDouble = 12, + EvtVarTypeBoolean = 13, + EvtVarTypeBinary = 14, + EvtVarTypeGuid = 15, + EvtVarTypeSizeT = 16, + EvtVarTypeFileTime = 17, + EvtVarTypeSysTime = 18, + EvtVarTypeSid = 19, + EvtVarTypeHexInt32 = 20, + EvtVarTypeHexInt64 = 21, + EvtVarTypeEvtHandle = 32, + EvtVarTypeEvtXml = 35, +}} +pub const EVT_VARIANT_TYPE_MASK: ::DWORD = 0x7f; +pub const EVT_VARIANT_TYPE_ARRAY: ::DWORD = 128; +STRUCT!{struct EVT_VARIANT { + u: u64, + Count: ::DWORD, + Type: ::DWORD, +}} +// TODO - All the UNION! for each variant +// TODO - The rest of this header diff --git a/third_party/rust/winapi/src/wingdi.rs b/third_party/rust/winapi/src/wingdi.rs new file mode 100644 index 000000000000..edc5850ed59f --- /dev/null +++ b/third_party/rust/winapi/src/wingdi.rs @@ -0,0 +1,1238 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! GDI procedure declarations, constant definitions and macros +pub const DISPLAY_DEVICE_ATTACHED_TO_DESKTOP: ::DWORD = 0x00000001; +pub const DISPLAY_DEVICE_MULTI_DRIVER: ::DWORD = 0x00000002; +pub const DISPLAY_DEVICE_PRIMARY_DEVICE: ::DWORD = 0x00000004; +pub const DISPLAY_DEVICE_MIRRORING_DRIVER: ::DWORD = 0x00000008; +pub const DISPLAY_DEVICE_VGA_COMPATIBLE: ::DWORD = 0x00000010; +pub const DISPLAY_DEVICE_REMOVABLE: ::DWORD = 0x00000020; +pub const DISPLAY_DEVICE_ACC_DRIVER: ::DWORD = 0x00000040; +pub const DISPLAY_DEVICE_MODESPRUNED: ::DWORD = 0x08000000; +pub const DISPLAY_DEVICE_REMOTE: ::DWORD = 0x04000000; +pub const DISPLAY_DEVICE_DISCONNECT: ::DWORD = 0x02000000; +pub const DISPLAY_DEVICE_TS_COMPATIBLE: ::DWORD = 0x00200000; +pub const DISPLAY_DEVICE_UNSAFE_MODES_ON: ::DWORD = 0x00080000; +pub const DISPLAY_DEVICE_ACTIVE: ::DWORD = 0x00000001; +pub const DISPLAY_DEVICE_ATTACHED: ::DWORD = 0x00000002; +pub const DM_ORIENTATION: ::DWORD = 0x00000001; +pub const DM_PAPERSIZE: ::DWORD = 0x00000002; +pub const DM_PAPERLENGTH: ::DWORD = 0x00000004; +pub const DM_PAPERWIDTH: ::DWORD = 0x00000008; +pub const DM_SCALE: ::DWORD = 0x00000010; +pub const DM_POSITION: ::DWORD = 0x00000020; +pub const DM_NUP: ::DWORD = 0x00000040; +pub const DM_DISPLAYORIENTATION: ::DWORD = 0x00000080; +pub const DM_COPIES: ::DWORD = 0x00000100; +pub const DM_DEFAULTSOURCE: ::DWORD = 0x00000200; +pub const DM_PRINTQUALITY: ::DWORD = 0x00000400; +pub const DM_COLOR: ::DWORD = 0x00000800; +pub const DM_DUPLEX: ::DWORD = 0x00001000; +pub const DM_YRESOLUTION: ::DWORD = 0x00002000; +pub const DM_TTOPTION: ::DWORD = 0x00004000; +pub const DM_COLLATE: ::DWORD = 0x00008000; +pub const DM_FORMNAME: ::DWORD = 0x00010000; +pub const DM_LOGPIXELS: ::DWORD = 0x00020000; +pub const DM_BITSPERPEL: ::DWORD = 0x00040000; +pub const DM_PELSWIDTH: ::DWORD = 0x00080000; +pub const DM_PELSHEIGHT: ::DWORD = 0x00100000; +pub const DM_DISPLAYFLAGS: ::DWORD = 0x00200000; +pub const DM_DISPLAYFREQUENCY: ::DWORD = 0x00400000; +pub const DM_ICMMETHOD: ::DWORD = 0x00800000; +pub const DM_ICMINTENT: ::DWORD = 0x01000000; +pub const DM_MEDIATYPE: ::DWORD = 0x02000000; +pub const DM_DITHERTYPE: ::DWORD = 0x04000000; +pub const DM_PANNINGWIDTH: ::DWORD = 0x08000000; +pub const DM_PANNINGHEIGHT: ::DWORD = 0x10000000; +pub const DM_DISPLAYFIXEDOUTPUT: ::DWORD = 0x20000000; +pub const PFD_TYPE_RGBA: ::BYTE = 0; +pub const PFD_TYPE_COLORINDEX: ::BYTE = 1; +pub const PFD_MAIN_PLANE: ::BYTE = 0; +pub const PFD_OVERLAY_PLANE: ::BYTE = 1; +pub const PFD_UNDERLAY_PLANE: ::BYTE = 0xFF; +pub const PFD_DOUBLEBUFFER: ::DWORD = 0x00000001; +pub const PFD_STEREO: ::DWORD = 0x00000002; +pub const PFD_DRAW_TO_WINDOW: ::DWORD = 0x00000004; +pub const PFD_DRAW_TO_BITMAP: ::DWORD = 0x00000008; +pub const PFD_SUPPORT_GDI: ::DWORD = 0x00000010; +pub const PFD_SUPPORT_OPENGL: ::DWORD = 0x00000020; +pub const PFD_GENERIC_FORMAT: ::DWORD = 0x00000040; +pub const PFD_NEED_PALETTE: ::DWORD = 0x00000080; +pub const PFD_NEED_SYSTEM_PALETTE: ::DWORD = 0x00000100; +pub const PFD_SWAP_EXCHANGE: ::DWORD = 0x00000200; +pub const PFD_SWAP_COPY: ::DWORD = 0x00000400; +pub const PFD_SWAP_LAYER_BUFFERS: ::DWORD = 0x00000800; +pub const PFD_GENERIC_ACCELERATED: ::DWORD = 0x00001000; +pub const PFD_SUPPORT_DIRECTDRAW: ::DWORD = 0x00002000; +pub const PFD_DIRECT3D_ACCELERATED: ::DWORD = 0x00004000; +pub const PFD_SUPPORT_COMPOSITION: ::DWORD = 0x00008000; +pub const PFD_DEPTH_DONTCARE: ::DWORD = 0x20000000; +pub const PFD_DOUBLEBUFFER_DONTCARE: ::DWORD = 0x40000000; +pub const PFD_STEREO_DONTCARE: ::DWORD = 0x80000000; +pub const CCHFORMNAME: usize = 32; +STRUCT!{struct DEVMODEA { + dmDeviceName: [::CHAR; ::CCHDEVICENAME], + dmSpecVersion: ::WORD, + dmDriverVersion: ::WORD, + dmSize: ::WORD, + dmDriverExtra: ::WORD, + dmFields: ::DWORD, + union1: [u8; 16], + dmColor: ::c_short, + dmDuplex: ::c_short, + dmYResolution: ::c_short, + dmTTOption: ::c_short, + dmCollate: ::c_short, + dmFormName: [::CHAR; CCHFORMNAME], + dmLogPixels: ::WORD, + dmBitsPerPel: ::DWORD, + dmPelsWidth: ::DWORD, + dmPelsHeight: ::DWORD, + dmDisplayFlags: ::DWORD, + dmDisplayFrequency: ::DWORD, + dmICMMethod: ::DWORD, + dmICMIntent: ::DWORD, + dmMediaType: ::DWORD, + dmDitherType: ::DWORD, + dmReserved1: ::DWORD, + dmReserved2: ::DWORD, + dmPanningWidth: ::DWORD, + dmPanningHeight: ::DWORD, +}} +pub type PDEVMODEA = *mut DEVMODEA; +pub type NPDEVMODEA = *mut DEVMODEA; +pub type LPDEVMODEA = *mut DEVMODEA; +STRUCT!{struct DEVMODEW { + dmDeviceName: [::WCHAR; ::CCHDEVICENAME], + dmSpecVersion: ::WORD, + dmDriverVersion: ::WORD, + dmSize: ::WORD, + dmDriverExtra: ::WORD, + dmFields: ::DWORD, + union1: [u8; 16], + dmColor: ::c_short, + dmDuplex: ::c_short, + dmYResolution: ::c_short, + dmTTOption: ::c_short, + dmCollate: ::c_short, + dmFormName: [::WCHAR; CCHFORMNAME], + dmLogPixels: ::WORD, + dmBitsPerPel: ::DWORD, + dmPelsWidth: ::DWORD, + dmPelsHeight: ::DWORD, + dmDisplayFlags: ::DWORD, + dmDisplayFrequency: ::DWORD, + dmICMMethod: ::DWORD, + dmICMIntent: ::DWORD, + dmMediaType: ::DWORD, + dmDitherType: ::DWORD, + dmReserved1: ::DWORD, + dmReserved2: ::DWORD, + dmPanningWidth: ::DWORD, + dmPanningHeight: ::DWORD, +}} +pub type PDEVMODEW = *mut DEVMODEW; +pub type NPDEVMODEW = *mut DEVMODEW; +pub type LPDEVMODEW = *mut DEVMODEW; +STRUCT!{nodebug struct DISPLAY_DEVICEW { + cb: ::DWORD, + DeviceName: [::WCHAR; 32], + DeviceString: [::WCHAR; 128], + StateFlags: ::DWORD, + DeviceID: [::WCHAR; 128], + DeviceKey: [::WCHAR; 128], +}} +pub type PDISPLAY_DEVICEW = *mut DISPLAY_DEVICEW; +pub type LPDISPLAY_DEVICEW = *mut DISPLAY_DEVICEW; +STRUCT!{nodebug struct DISPLAY_DEVICEA { + cb: ::DWORD, + DeviceName: [::CHAR; 32], + DeviceString: [::CHAR; 128], + StateFlags: ::DWORD, + DeviceID: [::CHAR; 128], + DeviceKey: [::CHAR; 128], +}} +pub type PDISPLAY_DEVICEA = *mut DISPLAY_DEVICEA; +pub type LPDISPLAY_DEVICEA = *mut DISPLAY_DEVICEA; +STRUCT!{struct PIXELFORMATDESCRIPTOR { + nSize: ::WORD, + nVersion: ::WORD, + dwFlags: ::DWORD, + iPixelType: ::BYTE, + cColorBits: ::BYTE, + cRedBits: ::BYTE, + cRedShift: ::BYTE, + cGreenBits: ::BYTE, + cGreenShift: ::BYTE, + cBlueBits: ::BYTE, + cBlueShift: ::BYTE, + cAlphaBits: ::BYTE, + cAlphaShift: ::BYTE, + cAccumBits: ::BYTE, + cAccumRedBits: ::BYTE, + cAccumGreenBits: ::BYTE, + cAccumBlueBits: ::BYTE, + cAccumAlphaBits: ::BYTE, + cDepthBits: ::BYTE, + cStencilBits: ::BYTE, + cAuxBuffers: ::BYTE, + iLayerType: ::BYTE, + bReserved: ::BYTE, + dwLayerMask: ::DWORD, + dwVisibleMask: ::DWORD, + dwDamageMask: ::DWORD, +}} +pub type PPIXELFORMATDESCRIPTOR = *mut PIXELFORMATDESCRIPTOR; +pub type LPPIXELFORMATDESCRIPTOR = *mut PIXELFORMATDESCRIPTOR; +pub const R2_BLACK: ::c_int = 1; +pub const R2_NOTMERGEPEN: ::c_int = 2; +pub const R2_MASKNOTPEN: ::c_int = 3; +pub const R2_NOTCOPYPEN: ::c_int = 4; +pub const R2_MASKPENNOT: ::c_int = 5; +pub const R2_NOT: ::c_int = 6; +pub const R2_XORPEN: ::c_int = 7; +pub const R2_NOTMASKPEN: ::c_int = 8; +pub const R2_MASKPEN: ::c_int = 9; +pub const R2_NOTXORPEN: ::c_int = 10; +pub const R2_NOP: ::c_int = 11; +pub const R2_MERGENOTPEN: ::c_int = 12; +pub const R2_COPYPEN: ::c_int = 13; +pub const R2_MERGEPENNOT: ::c_int = 14; +pub const R2_MERGEPEN: ::c_int = 15; +pub const R2_WHITE: ::c_int = 16; +pub const R2_LAST: ::c_int = 16; +//83 +pub const SRCCOPY: ::DWORD = 0x00CC0020; +pub const SRCPAINT: ::DWORD = 0x00EE0086; +pub const SRCAND: ::DWORD = 0x008800C6; +pub const SRCINVERT: ::DWORD = 0x00660046; +pub const SRCERASE: ::DWORD = 0x00440328; +pub const NOTSRCCOPY: ::DWORD = 0x00330008; +pub const NOTSRCERASE: ::DWORD = 0x001100A6; +pub const MERGECOPY: ::DWORD = 0x00C000CA; +pub const MERGEPAINT: ::DWORD = 0x00BB0226; +pub const PATCOPY: ::DWORD = 0x00F00021; +pub const PATPAINT: ::DWORD = 0x00FB0A09; +pub const PATINVERT: ::DWORD = 0x005A0049; +pub const DSTINVERT: ::DWORD = 0x00550009; +pub const BLACKNESS: ::DWORD = 0x00000042; +pub const WHITENESS: ::DWORD = 0x00FF0062; +//121 +// fnCombineMode values for CombineRgn +pub const RGN_AND: ::c_int = 1; +pub const RGN_OR: ::c_int = 2; +pub const RGN_XOR: ::c_int = 3; +pub const RGN_DIFF: ::c_int = 4; +pub const RGN_COPY: ::c_int = 5; +pub const RGN_MIN: ::c_int = RGN_AND; +pub const RGN_MAX: ::c_int = RGN_COPY; +//572 (Win 7 SDK) +STRUCT!{struct BITMAP { + bmType: ::LONG, + bmWidth: ::LONG, + bmHeight: ::LONG, + bmWidthBytes: ::LONG, + bmPlanes: ::WORD, + bmBitsPixel: ::WORD, + bmBits: ::LPVOID, +}} +pub type PBITMAP = *mut BITMAP; +pub type NPBITMAP = *mut BITMAP; +pub type LPBITMAP = *mut BITMAP; +STRUCT!{struct RGBQUAD { + rgbBlue: ::BYTE, + rgbGreen: ::BYTE, + rgbRed: ::BYTE, + rgbReserved: ::BYTE, +}} +pub type LPRGBQUAD = *mut RGBQUAD; +pub const CS_ENABLE: ::DWORD = 0x00000001; +pub const CS_DISABLE: ::DWORD = 0x00000002; +pub const CS_DELETE_TRANSFORM: ::DWORD = 0x00000003; +pub const LCS_SIGNATURE: ::DWORD = 0x5053_4F43; // 'PSOC' +pub const LCS_sRGB: LCSCSTYPE = 0x7352_4742; // 'sRGB' +pub const LCS_WINDOWS_COLOR_SPACE: LCSCSTYPE = 0x5769_6E20; // 'Win ' +pub type LCSCSTYPE = ::LONG; +pub const LCS_CALIBRATED_RGB: LCSCSTYPE = 0x00000000; +pub type LCSGAMUTMATCH = ::LONG; +pub const LCS_GM_BUSINESS: LCSGAMUTMATCH = 0x00000001; +pub const LCS_GM_GRAPHICS: LCSGAMUTMATCH = 0x00000002; +pub const LCS_GM_IMAGES: LCSGAMUTMATCH = 0x00000004; +pub const LCS_GM_ABS_COLORIMETRIC: LCSGAMUTMATCH = 0x00000008; +pub const CM_OUT_OF_GAMUT: ::BYTE = 255; +pub const CM_IN_GAMUT: ::BYTE = 0; +pub const ICM_ADDPROFILE: ::UINT = 1; +pub const ICM_DELETEPROFILE: ::UINT = 2; +pub const ICM_QUERYPROFILE: ::UINT = 3; +pub const ICM_SETDEFAULTPROFILE: ::UINT = 4; +pub const ICM_REGISTERICMATCHER: ::UINT = 5; +pub const ICM_UNREGISTERICMATCHER: ::UINT = 6; +pub const ICM_QUERYMATCH: ::UINT = 7; +pub type FXPT16DOT16 = ::c_long; +pub type LPFXPT16DOT16 = *mut ::c_long; +pub type FXPT2DOT30 = ::c_long; +pub type LPFXPT2DOT30 = *mut ::c_long; +STRUCT!{struct CIEXYZ { + ciexyzX: FXPT2DOT30, + ciexyzY: FXPT2DOT30, + ciexyzZ: FXPT2DOT30, +}} +pub type LPCIEXYZ = *mut CIEXYZ; +STRUCT!{struct CIEXYZTRIPLE { + ciexyzRed: CIEXYZ, + ciexyzGreen: CIEXYZ, + ciexyzBlue: CIEXYZ, +}} +pub type LPCIEXYZTRIPLE = *mut CIEXYZTRIPLE; +//716 (Win 7 SDK) +STRUCT!{struct BITMAPINFOHEADER { + biSize: ::DWORD, + biWidth: ::LONG, + biHeight: ::LONG, + biPlanes: ::WORD, + biBitCount: ::WORD, + biCompression: ::DWORD, + biSizeImage: ::DWORD, + biXPelsPerMeter: ::LONG, + biYPelsPerMeter: ::LONG, + biClrUsed: ::DWORD, + biClrImportant: ::DWORD, +}} +pub type LPBITMAPINFOHEADER = *mut BITMAPINFOHEADER; +pub type PBITMAPINFOHEADER = *mut BITMAPINFOHEADER; +STRUCT!{struct BITMAPV5HEADER { + bV5Size: ::DWORD, + bV5Width: ::LONG, + bV5Height: ::LONG, + bV5Planes: ::WORD, + bV5BitCount: ::WORD, + bV5Compression: ::DWORD, + bV5SizeImage: ::DWORD, + bV5XPelsPerMeter: ::LONG, + bV5YPelsPerMeter: ::LONG, + bV5ClrUsed: ::DWORD, + bV5ClrImportant: ::DWORD, + bV5RedMask: ::DWORD, + bV5GreenMask: ::DWORD, + bV5BlueMask: ::DWORD, + bV5AlphaMask: ::DWORD, + bV5CSType: ::LONG, // LONG to match LOGCOLORSPACE + bV5Endpoints: CIEXYZTRIPLE, + bV5GammaRed: ::DWORD, + bV5GammaGreen: ::DWORD, + bV5GammaBlue: ::DWORD, + bV5Intent: ::LONG, // LONG to match LOGCOLORSPACE + bV5ProfileData: ::DWORD, + bV5ProfileSize: ::DWORD, + bV5Reserved: ::DWORD, +}} +pub type LPBITMAPV5HEADER = *mut BITMAPV5HEADER; +pub type PBITMAPV5HEADER = *mut BITMAPV5HEADER; +pub const PROFILE_LINKED: ::LONG = 0x4C49_4E4B; // 'LINK' +pub const PROFILE_EMBEDDED: ::LONG = 0x4D42_4544; // 'MBED' +pub const BI_RGB: ::DWORD = 0; +pub const BI_RLE8: ::DWORD = 1; +pub const BI_RLE4: ::DWORD = 2; +pub const BI_BITFIELDS: ::DWORD = 3; +pub const BI_JPEG: ::DWORD = 4; +pub const BI_PNG: ::DWORD = 5; +STRUCT!{struct BITMAPINFO { + bmiHeader: BITMAPINFOHEADER, + bmiColors: [RGBQUAD; 0], +}} +pub type LPBITMAPINFO = *mut BITMAPINFO; +pub type PBITMAPINFO = *mut BITMAPINFO; +//1438 +pub const LF_FACESIZE: usize = 32; +STRUCT!{nodebug struct LOGFONTA { + lfHeight: ::LONG, + lfWidth: ::LONG, + lfEscapement: ::LONG, + lfOrientation: ::LONG, + lfWeight: ::LONG, + lfItalic: ::BYTE, + lfUnderline: ::BYTE, + lfStrikeOut: ::BYTE, + lfCharSet: ::BYTE, + lfOutPrecision: ::BYTE, + lfClipPrecision: ::BYTE, + lfQuality: ::BYTE, + lfPitchAndFamily: ::BYTE, + lfFaceName: [::CHAR; LF_FACESIZE], +}} +pub type LPLOGFONTA = *mut LOGFONTA; +STRUCT!{nodebug struct LOGFONTW { + lfHeight: ::LONG, + lfWidth: ::LONG, + lfEscapement: ::LONG, + lfOrientation: ::LONG, + lfWeight: ::LONG, + lfItalic: ::BYTE, + lfUnderline: ::BYTE, + lfStrikeOut: ::BYTE, + lfCharSet: ::BYTE, + lfOutPrecision: ::BYTE, + lfClipPrecision: ::BYTE, + lfQuality: ::BYTE, + lfPitchAndFamily: ::BYTE, + lfFaceName: [::WCHAR; LF_FACESIZE], +}} +pub type LPLOGFONTW = *mut LOGFONTW; +//1595 +#[inline] +pub fn RGB (r: ::BYTE, g: ::BYTE, b: ::BYTE) -> ::COLORREF { + r as ::COLORREF | ((g as ::COLORREF) << 8) | ((b as ::COLORREF) << 16) +} +// +pub const DRIVERVERSION: ::c_int = 0; +pub const TECHNOLOGY: ::c_int = 2; +pub const HORZSIZE: ::c_int = 4; +pub const VERTSIZE: ::c_int = 6; +pub const HORZRES: ::c_int = 8; +pub const VERTRES: ::c_int = 10; +pub const BITSPIXEL: ::c_int = 12; +pub const PLANES: ::c_int = 14; +pub const NUMBRUSHES: ::c_int = 16; +pub const NUMPENS: ::c_int = 18; +pub const NUMMARKERS: ::c_int = 20; +pub const NUMFONTS: ::c_int = 22; +pub const NUMCOLORS: ::c_int = 24; +pub const PDEVICESIZE: ::c_int = 26; +pub const CURVECAPS: ::c_int = 28; +pub const LINECAPS: ::c_int = 30; +pub const POLYGONALCAPS: ::c_int = 32; +pub const TEXTCAPS: ::c_int = 34; +pub const CLIPCAPS: ::c_int = 36; +pub const RASTERCAPS: ::c_int = 38; +pub const ASPECTX: ::c_int = 40; +pub const ASPECTY: ::c_int = 42; +pub const ASPECTXY: ::c_int = 44; +pub const LOGPIXELSX: ::c_int = 88; +pub const LOGPIXELSY: ::c_int = 90; +pub const SIZEPALETTE: ::c_int = 104; +pub const NUMRESERVED: ::c_int = 106; +pub const COLORRES: ::c_int = 108; +pub const PHYSICALWIDTH: ::c_int = 110; +pub const PHYSICALHEIGHT: ::c_int = 111; +pub const PHYSICALOFFSETX: ::c_int = 112; +pub const PHYSICALOFFSETY: ::c_int = 113; +pub const SCALINGFACTORX: ::c_int = 114; +pub const SCALINGFACTORY: ::c_int = 115; +pub const VREFRESH: ::c_int = 116; +pub const DESKTOPVERTRES: ::c_int = 117; +pub const DESKTOPHORZRES: ::c_int = 118; +pub const BLTALIGNMENT: ::c_int = 119; +pub const SHADEBLENDCAPS: ::c_int = 120; +pub const COLORMGMTCAPS: ::c_int = 121; +//1906 +pub const DIB_RGB_COLORS: ::UINT = 0; +pub const DIB_PAL_COLORS: ::UINT = 1; +pub const CBM_INIT: ::DWORD = 4; +STRUCT!{struct RGNDATAHEADER { + dwSize: ::DWORD, + iType: ::DWORD, + nCount: ::DWORD, + nRgnSize: ::DWORD, + rcBound: ::RECT, +}} +pub type PRGNDATAHEADER = *mut RGNDATAHEADER; +STRUCT!{nodebug struct RGNDATA { + rdh: RGNDATAHEADER, + Buffer: [::c_char; 0], +}} +pub type PRGNDATA = *mut RGNDATA; +pub type NPRGNDATA = *mut RGNDATA; +pub type LPRGNDATA = *mut RGNDATA; +STRUCT!{struct PALETTEENTRY { + peRed: ::BYTE, + peGreen: ::BYTE, + peBlue: ::BYTE, + peFlags: ::BYTE, +}} +pub type PPALETTEENTRY = *mut PALETTEENTRY; +pub type LPPALETTEENTRY = *mut PALETTEENTRY; +//2824 (Win 7 SDK) +STRUCT!{struct ABC { + abcA: ::c_int, + abcB: ::UINT, + abcC: ::c_int, +}} +pub type PABC = *mut ABC; +pub type NPABC = *mut ABC; +pub type LPABC = *mut ABC; +STRUCT!{struct ABCFLOAT { + abcfA: ::FLOAT, + abcfB: ::FLOAT, + abcfC: ::FLOAT, +}} +pub type PABCFLOAT = *mut ABCFLOAT; +pub type NPABCFLOAT = *mut ABCFLOAT; +pub type LPABCFLOAT = *mut ABCFLOAT; +//3581 +pub type LINEDDAPROC = Option; +STRUCT!{struct XFORM { + eM11: ::FLOAT, + eM12: ::FLOAT, + eM21: ::FLOAT, + eM22: ::FLOAT, + eDx: ::FLOAT, + eDy: ::FLOAT, +}} +pub type PXFORM = *mut XFORM; +pub type LPXFORM = *mut XFORM; +STRUCT!{struct LOGBRUSH { + lbStyle: ::UINT, + lbColor: ::COLORREF, + lbHatch: ::ULONG_PTR, +}} +pub type PLOGBRUSH = *mut LOGBRUSH; +STRUCT!{nodebug struct LOGCOLORSPACEA { + lcsSignature: ::DWORD, + lcsVersion: ::DWORD, + lcsSize: ::DWORD, + lcsCSType: LCSCSTYPE, + lcsIntent: LCSGAMUTMATCH, + lcsEndpoints: CIEXYZTRIPLE, + lcsGammaRed: ::DWORD, + lcsGammaGreen: ::DWORD, + lcsGammaBlue: ::DWORD, + lcsFilename: [::CHAR; ::MAX_PATH], +}} +pub type LPLOGCOLORSPACEA = *mut LOGCOLORSPACEA; +STRUCT!{nodebug struct LOGCOLORSPACEW { + lcsSignature: ::DWORD, + lcsVersion: ::DWORD, + lcsSize: ::DWORD, + lcsCSType: LCSCSTYPE, + lcsIntent: LCSGAMUTMATCH, + lcsEndpoints: CIEXYZTRIPLE, + lcsGammaRed: ::DWORD, + lcsGammaGreen: ::DWORD, + lcsGammaBlue: ::DWORD, + lcsFilename: [::WCHAR; ::MAX_PATH], +}} +pub type LPLOGCOLORSPACEW = *mut LOGCOLORSPACEW; +pub const LF_FULLFACESIZE: usize = 64; +STRUCT!{nodebug struct ENUMLOGFONTEXA { + elfLogFont: LOGFONTA, + elfFullName: [::BYTE; LF_FULLFACESIZE], + elfStyle: [::BYTE; LF_FACESIZE], + elfScript: [::BYTE; LF_FACESIZE], +}} +pub type LPENUMLOGFONTEXA = *mut ENUMLOGFONTEXA; +STRUCT!{nodebug struct ENUMLOGFONTEXW { + elfLogFont: LOGFONTW, + elfFullName: [::WCHAR; LF_FULLFACESIZE], + elfStyle: [::WCHAR; LF_FACESIZE], + elfScript: [::WCHAR; LF_FACESIZE], +}} +pub type LPENUMLOGFONTEXW = *mut ENUMLOGFONTEXW; +pub const MM_MAX_NUMAXES: usize = 16; +STRUCT!{struct DESIGNVECTOR { + dvReserved: ::DWORD, + dvNumAxes: ::DWORD, + dvValues: [::LONG; MM_MAX_NUMAXES], +}} +pub type PDESIGNVECTOR = *mut DESIGNVECTOR; +pub type LPDESIGNVECTOR = *mut DESIGNVECTOR; +STRUCT!{nodebug struct ENUMLOGFONTEXDVA { + elfEnumLogfontEx: ENUMLOGFONTEXA, + elfDesignVector: DESIGNVECTOR, +}} +pub type PENUMLOGFONTEXDVA = *mut ENUMLOGFONTEXDVA; +pub type LPENUMLOGFONTEXDVA = *mut ENUMLOGFONTEXDVA; +STRUCT!{nodebug struct ENUMLOGFONTEXDVW { + elfEnumLogfontEx: ENUMLOGFONTEXW, + elfDesignVector: DESIGNVECTOR, +}} +pub type PENUMLOGFONTEXDVW = *mut ENUMLOGFONTEXDVW; +pub type LPENUMLOGFONTEXDVW = *mut ENUMLOGFONTEXDVW; +STRUCT!{struct LOGPALETTE { + palVersion: ::WORD, + palNumEntries: ::WORD, + palPalEntry: [PALETTEENTRY; 1], +}} +pub type PLOGPALETTE = *mut LOGPALETTE; +pub type NPLOGPALETTE = *mut LOGPALETTE; +pub type LPLOGPALETTE = *mut LOGPALETTE; +STRUCT!{struct LOGPEN { + lopnStyle: ::UINT, + lopnWidth: ::POINT, + lopnColor: ::COLORREF, +}} +pub type PLOGPEN = *mut LOGPEN; +pub type NPLOGPEN = *mut LOGPEN; +pub type LPLOGPEN = *mut LOGPEN; +STRUCT!{struct BLENDFUNCTION { + BlendOp: ::BYTE, + BlendFlags: ::BYTE, + SourceConstantAlpha: ::BYTE, + AlphaFormat: ::BYTE, +}} +pub type PBLENDFUNCTION = *mut BLENDFUNCTION; +pub const TMPF_FIXED_PITCH: ::BYTE = 0x01; +pub const TMPF_VECTOR: ::BYTE = 0x02; +pub const TMPF_DEVICE: ::BYTE = 0x08; +pub const TMPF_TRUETYPE: ::BYTE = 0x04; +STRUCT!{struct TEXTMETRICA { + tmHeight: ::LONG, + tmAscent: ::LONG, + tmDescent: ::LONG, + tmInternalLeading: ::LONG, + tmExternalLeading: ::LONG, + tmAveCharWidth: ::LONG, + tmMaxCharWidth: ::LONG, + tmWeight: ::LONG, + tmOverhang: ::LONG, + tmDigitizedAspectX: ::LONG, + tmDigitizedAspectY: ::LONG, + tmFirstChar: ::BYTE, + tmLastChar: ::BYTE, + tmDefaultChar: ::BYTE, + tmBreakChar: ::BYTE, + tmItalic: ::BYTE, + tmUnderlined: ::BYTE, + tmStruckOut: ::BYTE, + tmPitchAndFamily: ::BYTE, + tmCharSet: ::BYTE, +}} +pub type PTEXTMETRICA = *mut TEXTMETRICA; +pub type NPTEXTMETRICA = *mut TEXTMETRICA; +pub type LPTEXTMETRICA = *mut TEXTMETRICA; +STRUCT!{struct TEXTMETRICW { + tmHeight: ::LONG, + tmAscent: ::LONG, + tmDescent: ::LONG, + tmInternalLeading: ::LONG, + tmExternalLeading: ::LONG, + tmAveCharWidth: ::LONG, + tmMaxCharWidth: ::LONG, + tmWeight: ::LONG, + tmOverhang: ::LONG, + tmDigitizedAspectX: ::LONG, + tmDigitizedAspectY: ::LONG, + tmFirstChar: ::WCHAR, + tmLastChar: ::WCHAR, + tmDefaultChar: ::WCHAR, + tmBreakChar: ::WCHAR, + tmItalic: ::BYTE, + tmUnderlined: ::BYTE, + tmStruckOut: ::BYTE, + tmPitchAndFamily: ::BYTE, + tmCharSet: ::BYTE, +}} +pub type PTEXTMETRICW = *mut TEXTMETRICW; +pub type NPTEXTMETRICW = *mut TEXTMETRICW; +pub type LPTEXTMETRICW = *mut TEXTMETRICW; +pub const TA_NOUPDATECP: ::UINT = 0; +pub const TA_UPDATECP: ::UINT = 1; +pub const TA_LEFT: ::UINT = 0; +pub const TA_RIGHT: ::UINT = 2; +pub const TA_CENTER: ::UINT = 6; +pub const TA_TOP: ::UINT = 0; +pub const TA_BOTTOM: ::UINT = 8; +pub const TA_BASELINE: ::UINT = 24; +pub const TA_RTLREADING: ::UINT = 256; +pub const TA_MASK: ::UINT = TA_BASELINE + TA_CENTER + TA_UPDATECP + TA_RTLREADING; +pub const WHITE_BRUSH: ::c_int = 0; +pub const LTGRAY_BRUSH: ::c_int = 1; +pub const GRAY_BRUSH: ::c_int = 2; +pub const DKGRAY_BRUSH: ::c_int = 3; +pub const BLACK_BRUSH: ::c_int = 4; +pub const NULL_BRUSH: ::c_int = 5; +pub const HOLLOW_BRUSH: ::c_int = 5; +pub const WHITE_PEN: ::c_int = 6; +pub const BLACK_PEN: ::c_int = 7; +pub const NULL_PEN: ::c_int = 8; +pub const OEM_FIXED_FONT: ::c_int = 10; +pub const ANSI_FIXED_FONT: ::c_int = 11; +pub const ANSI_VAR_FONT: ::c_int = 12; +pub const SYSTEM_FONT: ::c_int = 13; +pub const DEVICE_DEFAULT_FONT: ::c_int = 14; +pub const DEFAULT_PALETTE: ::c_int = 15; +pub const SYSTEM_FIXED_FONT: ::c_int = 16; +pub const DEFAULT_GUI_FONT: ::c_int = 17; +pub const DC_BRUSH: ::c_int = 18; +pub const DC_PEN: ::c_int = 19; +pub const STOCK_LAST: ::c_int = 19;pub const PS_SOLID: ::c_int = 0; +pub const PS_DASH: ::c_int = 1; +pub const PS_DOT: ::c_int = 2; +pub const PS_DASHDOT: ::c_int = 3; +pub const PS_DASHDOTDOT: ::c_int = 4; +pub const PS_NULL: ::c_int = 5; +pub const PS_INSIDEFRAME: ::c_int = 6; +pub const PS_USERSTYLE: ::c_int = 7; +pub const PS_ALTERNATE: ::c_int = 8; +pub const TRANSPARENT: ::c_int = 1; +pub const OPAQUE: ::c_int = 2; +pub const BKMODE_LAST: ::c_int = 2; +pub const MM_TEXT: ::c_int = 1; +pub const MM_LOMETRIC: ::c_int = 2; +pub const MM_HIMETRIC: ::c_int = 3; +pub const MM_LOENGLISH: ::c_int = 4; +pub const MM_HIENGLISH: ::c_int = 5; +pub const MM_TWIPS: ::c_int = 6; +pub const MM_ISOTROPIC: ::c_int = 7; +pub const MM_ANISOTROPIC: ::c_int = 8; +pub const ALTERNATE: ::c_int = 1; +pub const WINDING: ::c_int = 2; +pub const POLYFILL_LAST: ::c_int = 2; +pub const OUT_DEFAULT_PRECIS: ::DWORD = 0; +pub const OUT_STRING_PRECIS: ::DWORD = 1; +pub const OUT_CHARACTER_PRECIS: ::DWORD = 2; +pub const OUT_STROKE_PRECIS: ::DWORD = 3; +pub const OUT_TT_PRECIS: ::DWORD = 4; +pub const OUT_DEVICE_PRECIS: ::DWORD = 5; +pub const OUT_RASTER_PRECIS: ::DWORD = 6; +pub const OUT_TT_ONLY_PRECIS: ::DWORD = 7; +pub const OUT_OUTLINE_PRECIS: ::DWORD = 8; +pub const OUT_SCREEN_OUTLINE_PRECIS: ::DWORD = 9; +pub const OUT_PS_ONLY_PRECIS: ::DWORD = 10; +pub const CLIP_DEFAULT_PRECIS: ::DWORD = 0; +pub const CLIP_CHARACTER_PRECIS: ::DWORD = 1; +pub const CLIP_STROKE_PRECIS: ::DWORD = 2; +pub const CLIP_MASK: ::DWORD = 0xf; +pub const CLIP_LH_ANGLES: ::DWORD = 1 << 4; +pub const CLIP_TT_ALWAYS: ::DWORD = 2 << 4; +pub const CLIP_DFA_DISABLE: ::DWORD = 4 << 4; +pub const CLIP_EMBEDDED: ::DWORD = 8 << 4; +pub const DEFAULT_QUALITY: ::DWORD = 0; +pub const DRAFT_QUALITY: ::DWORD = 1; +pub const PROOF_QUALITY: ::DWORD = 2; +pub const NONANTIALIASED_QUALITY: ::DWORD = 3; +pub const ANTIALIASED_QUALITY: ::DWORD = 4; +pub const CLEARTYPE_QUALITY: ::DWORD = 5; +pub const CLEARTYPE_NATURAL_QUALITY: ::DWORD = 6; +pub const DEFAULT_PITCH: ::DWORD = 0; +pub const FIXED_PITCH: ::DWORD = 1; +pub const VARIABLE_PITCH: ::DWORD = 2; +pub const FF_DONTCARE: ::DWORD = 0 << 4; +pub const FF_ROMAN: ::DWORD = 1 << 4; +pub const FF_SWISS: ::DWORD = 2 << 4; +pub const FF_MODERN: ::DWORD = 3 << 4; +pub const FF_SCRIPT: ::DWORD = 4 << 4; +pub const FF_DECORATIVE: ::DWORD = 5 << 4; +pub const MONO_FONT: ::DWORD = 8; +pub const ANSI_CHARSET: ::DWORD = 0; +pub const DEFAULT_CHARSET: ::DWORD = 1; +pub const SYMBOL_CHARSET: ::DWORD = 2; +pub const SHIFTJIS_CHARSET: ::DWORD = 128; +pub const HANGEUL_CHARSET: ::DWORD = 129; +pub const HANGUL_CHARSET: ::DWORD = 129; +pub const GB2312_CHARSET: ::DWORD = 134; +pub const CHINESEBIG5_CHARSET: ::DWORD = 136; +pub const OEM_CHARSET: ::DWORD = 255; +pub const JOHAB_CHARSET: ::DWORD = 130; +pub const HEBREW_CHARSET: ::DWORD = 177; +pub const ARABIC_CHARSET: ::DWORD = 178; +pub const GREEK_CHARSET: ::DWORD = 161; +pub const TURKISH_CHARSET: ::DWORD = 162; +pub const VIETNAMESE_CHARSET: ::DWORD = 163; +pub const THAI_CHARSET: ::DWORD = 222; +pub const EASTEUROPE_CHARSET: ::DWORD = 238; +pub const RUSSIAN_CHARSET: ::DWORD = 204; +pub const MAC_CHARSET: ::DWORD = 77; +pub const BALTIC_CHARSET: ::DWORD = 186; +pub const FS_LATIN1: ::DWORD = 0x00000001; +pub const FS_LATIN2: ::DWORD = 0x00000002; +pub const FS_CYRILLIC: ::DWORD = 0x00000004; +pub const FS_GREEK: ::DWORD = 0x00000008; +pub const FS_TURKISH: ::DWORD = 0x00000010; +pub const FS_HEBREW: ::DWORD = 0x00000020; +pub const FS_ARABIC: ::DWORD = 0x00000040; +pub const FS_BALTIC: ::DWORD = 0x00000080; +pub const FS_VIETNAMESE: ::DWORD = 0x00000100; +pub const FS_THAI: ::DWORD = 0x00010000; +pub const FS_JISJAPAN: ::DWORD = 0x00020000; +pub const FS_CHINESESIMP: ::DWORD = 0x00040000; +pub const FS_WANSUNG: ::DWORD = 0x00080000; +pub const FS_CHINESETRAD: ::DWORD = 0x00100000; +pub const FS_JOHAB: ::DWORD = 0x00200000; +pub const FS_SYMBOL: ::DWORD = 0x80000000; +pub const FW_DONTCARE: ::c_int = 0; +pub const FW_THIN: ::c_int = 100; +pub const FW_EXTRALIGHT: ::c_int = 200; +pub const FW_LIGHT: ::c_int = 300; +pub const FW_NORMAL: ::c_int = 400; +pub const FW_MEDIUM: ::c_int = 500; +pub const FW_SEMIBOLD: ::c_int = 600; +pub const FW_BOLD: ::c_int = 700; +pub const FW_EXTRABOLD: ::c_int = 800; +pub const FW_HEAVY: ::c_int = 900; +pub const FW_ULTRALIGHT: ::c_int = FW_EXTRALIGHT; +pub const FW_REGULAR: ::c_int = FW_NORMAL; +pub const FW_DEMIBOLD: ::c_int = FW_SEMIBOLD; +pub const FW_ULTRABOLD: ::c_int = FW_EXTRABOLD; +pub const FW_BLACK: ::c_int = FW_HEAVY; +pub type COLOR16 = ::c_ushort; +STRUCT!{struct TRIVERTEX { + x: ::LONG, + y: ::LONG, + Red: COLOR16, + Green: COLOR16, + Blue: COLOR16, + Alpha: COLOR16, +}} +pub type PTRIVERTEX = *mut TRIVERTEX; +pub type LPTRIVERTEX = *mut TRIVERTEX; +STRUCT!{struct GRADIENT_RECT { + UpperLeft: ::ULONG, + LowerRight: ::ULONG, +}} +pub type PGRADIENT_RECT = *mut GRADIENT_RECT; +pub type LPGRADIENT_RECT = *mut GRADIENT_RECT; +/* Object Definitions for EnumObjects() */ +pub const OBJ_PEN: ::UINT = 1; +pub const OBJ_BRUSH: ::UINT = 2; +pub const OBJ_DC: ::UINT = 3; +pub const OBJ_METADC: ::UINT = 4; +pub const OBJ_PAL: ::UINT = 5; +pub const OBJ_FONT: ::UINT = 6; +pub const OBJ_BITMAP: ::UINT = 7; +pub const OBJ_REGION: ::UINT = 8; +pub const OBJ_METAFILE: ::UINT = 9; +pub const OBJ_MEMDC: ::UINT = 10; +pub const OBJ_EXTPEN: ::UINT = 11; +pub const OBJ_ENHMETADC: ::UINT = 12; +pub const OBJ_ENHMETAFILE: ::UINT = 13; +pub const OBJ_COLORSPACE: ::UINT = 14; +pub const GDI_OBJ_LAST: ::UINT = OBJ_COLORSPACE; +STRUCT!{struct COLORADJUSTMENT { + caSize: ::WORD, + caFlags: ::WORD, + caIlluminantIndex: ::WORD, + caRedGamma: ::WORD, + caGreenGamma: ::WORD, + caBlueGamma: ::WORD, + caReferenceBlack: ::WORD, + caReferenceWhite: ::WORD, + caContrast: ::SHORT, + caBrightness: ::SHORT, + caColorfulness: ::SHORT, + caRedGreenTint: ::SHORT, +}} +pub type PCOLORADJUSTMENT = *mut COLORADJUSTMENT; +pub type LPCOLORADJUSTMENT = *mut COLORADJUSTMENT; +pub type OLDFONTENUMPROCA = Option ::c_int>; +pub type OLDFONTENUMPROCW = Option ::c_int>; +pub type FONTENUMPROCA = OLDFONTENUMPROCA; +pub type FONTENUMPROCW = OLDFONTENUMPROCW; +STRUCT!{struct WCRANGE { + wcLow: ::WCHAR, + cGlyphs: ::USHORT, +}} +pub type PWCRANGE = *mut WCRANGE; +pub type LPWCRANGE = *mut WCRANGE; +STRUCT!{struct GLYPHSET { + cbThis: ::DWORD, + flAccel: ::DWORD, + cGlyphsSupported: ::DWORD, + cRanges: ::DWORD, + ranges: [WCRANGE;1], +}} +pub type PGLYPHSET = *mut GLYPHSET; +pub type LPGLYPHSET = *mut GLYPHSET; +pub type ABORTPROC = Option ::BOOL>; +STRUCT!{struct DOCINFOA { + cbSize: ::c_int, + lpszDocName: ::LPCSTR, + lpszOutput: ::LPCSTR, + lpszDatatype: ::LPCSTR, + fwType: ::DWORD, +}} +pub type LPDOCINFOA = *mut DOCINFOA; +STRUCT!{struct DOCINFOW { + cbSize: ::c_int, + lpszDocName: ::LPCWSTR, + lpszOutput: ::LPCWSTR, + lpszDatatype: ::LPCWSTR, + fwType: ::DWORD, +}} +pub type LPDOCINFOW = *mut DOCINFOW; +pub type ICMENUMPROCA = Option ::c_int>; +pub type ICMENUMPROCW = Option ::c_int>; +STRUCT!{struct HANDLETABLE { + objectHandle: [::HGDIOBJ; 1], +}} +pub type LPHANDLETABLE = *mut HANDLETABLE; +pub type PHANDLETABLE = *mut HANDLETABLE; +STRUCT!{struct METARECORD { + rdSize: ::DWORD, + rdFunction: ::WORD, + rdParm: [::WORD; 1], +}} +pub type PMETARECORD = *mut METARECORD; +pub type LPMETARECORD = *mut METARECORD; +pub type MFENUMPROC = Option ::c_int>; +pub type GOBJENUMPROC = Option ::c_int>; +STRUCT!{struct GCP_RESULTSA { + lStructSize: ::DWORD, + lpOutString: ::LPSTR, + lpOrder: *const ::UINT, + lpDx: *const ::c_int, + lpCaretPos: *const ::c_int, + lpClass: ::LPSTR, + lpGlyphs: ::LPWSTR, + nGlyphs: ::UINT, + nMaxFit: ::c_int, +}} +pub type LPGCP_RESULTSA = *mut GCP_RESULTSA; +STRUCT!{struct GCP_RESULTSW { + lStructSize: ::DWORD, + lpOutString: ::LPWSTR, + lpOrder: *const ::UINT, + lpDx: *const ::c_int, + lpCaretPos: *const ::c_int, + lpClass: ::LPSTR, + lpGlyphs: ::LPWSTR, + nGlyphs: ::UINT, + nMaxFit: ::c_int, +}} +pub type LPGCP_RESULTSW = *mut GCP_RESULTSW; +STRUCT!{struct FONTSIGNATURE { + fsUsb: [::DWORD; 4], + fsCsb: [::DWORD; 2], +}} +pub type LPFONTSIGNATURE = *mut FONTSIGNATURE; +pub type PFONTSIGNATURE = *mut FONTSIGNATURE; +STRUCT!{struct POLYTEXTA { + x: ::c_int, + y: ::c_int, + n: ::UINT, + lpstr: ::LPCSTR, + uiFlags: ::UINT, + rcl: ::RECT, + pdx: *const ::c_int, +}} +pub type PPOLYTEXTA = *mut POLYTEXTA; +pub type NPPOLYTEXTA = *mut POLYTEXTA; +pub type LPPOLYTEXTA = *mut POLYTEXTA; +STRUCT!{struct POLYTEXTW { + x: ::c_int, + y: ::c_int, + n: ::UINT, + lpstr: ::LPCWSTR, + uiFlags: ::UINT, + rcl: ::RECT, + pdx: *const ::c_int, +}} +pub type PPOLYTEXTW = *mut POLYTEXTW; +pub type NPPOLYTEXTW = *mut POLYTEXTW; +pub type LPPOLYTEXTW = *mut POLYTEXTW; +STRUCT!{struct CHARSETINFO { + ciCharset: ::UINT, + ciACP: ::UINT, + fs: ::FONTSIGNATURE, +}} +pub type PCHARSETINFO = *mut CHARSETINFO; +pub type NPCHARSETINFO = *mut CHARSETINFO; +pub type LPCHARSETINFO = *mut CHARSETINFO; +pub const GRADIENT_FILL_RECT_H: ::ULONG = 0x00000000; +pub const GRADIENT_FILL_RECT_V: ::ULONG = 0x00000001; +pub const GRADIENT_FILL_TRIANGLE: ::ULONG = 0x00000002; +pub const GRADIENT_FILL_OP_FLAG: ::ULONG = 0x000000ff; +STRUCT!{struct LAYERPLANEDESCRIPTOR { + nSize: ::WORD, + nVersion: ::WORD, + dwFlags: ::DWORD, + iPixelType: ::BYTE, + cColorBits: ::BYTE, + cRedBits: ::BYTE, + cRedShift: ::BYTE, + cGreenBits: ::BYTE, + cGreenShift: ::BYTE, + cBlueBits: ::BYTE, + cBlueShift: ::BYTE, + cAlphaBits: ::BYTE, + cAlphaShift: ::BYTE, + cAccumBits: ::BYTE, + cAccumRedBits: ::BYTE, + cAccumGreenBits: ::BYTE, + cAccumBlueBits: ::BYTE, + cAccumAlphaBits: ::BYTE, + cDepthBits: ::BYTE, + cStencilBits: ::BYTE, + cAuxBuffers: ::BYTE, + iLayerPlane: ::BYTE, + bReserved: ::BYTE, + crTransparent: ::COLORREF, +}} +pub type PLAYERPLANEDESCRIPTOR = *mut LAYERPLANEDESCRIPTOR; +pub type LPLAYERPLANEDESCRIPTOR = *mut LAYERPLANEDESCRIPTOR; +STRUCT!{struct ENHMETAHEADER { + iType: ::DWORD, + nSize: ::DWORD, + rclBounds: ::RECTL, + rclFrame: ::RECTL, + dSignature: ::DWORD, + nVersion: ::DWORD, + nBytes: ::DWORD, + nRecords: ::DWORD, + nHandles: ::WORD, + sReserved: ::WORD, + nDescription: ::DWORD, + offDescription: ::DWORD, + nPalEntries: ::DWORD, + szlDevice: ::SIZEL, + szlMillimeters: ::SIZEL, + cbPixelFormat: ::DWORD, + offPixelFormat: ::DWORD, + bOpenGL: ::DWORD, + szlMicrometers: ::SIZEL, +}} +pub type PENHMETAHEADER = *mut ENHMETAHEADER; +pub type LPENHMETAHEADER = *mut ENHMETAHEADER; +STRUCT!{struct FIXED { + fract: ::WORD, + value: ::c_short, +}} +STRUCT!{struct MAT2 { + eM11: FIXED, + eM12: FIXED, + eM21: FIXED, + eM22: FIXED, +}} +pub type LPMAT2 = *mut MAT2; +STRUCT!{struct GLYPHMETRICS { + gmBlackBoxX: ::UINT, + gmBlackBoxY: ::UINT, + gmptGlyphOrigin: ::POINT, + gmCellIncX: ::c_short, + gmCellIncY: ::c_short, +}} +pub type LPGLYPHMETRICS = *mut GLYPHMETRICS; +STRUCT!{struct KERNINGPAIR { + wFirst: ::WORD, + wSecond: ::WORD, + iKernAmount: ::c_int, +}} +pub type LPKERNINGPAIR = *mut KERNINGPAIR; +STRUCT!{struct PANOSE { + bFamilyType: ::BYTE, + bSerifStyle: ::BYTE, + bWeight: ::BYTE, + bProportion: ::BYTE, + bContrast: ::BYTE, + bStrokeVariation: ::BYTE, + bArmStyle: ::BYTE, + bLetterform: ::BYTE, + bMidline: ::BYTE, + bXHeight: ::BYTE, +}} +pub type LPPANOSE = *mut PANOSE; +STRUCT!{struct OUTLINETEXTMETRICA { + otmSize: ::UINT, + otmTextMetrics: TEXTMETRICA, + otmFiller: ::BYTE, + otmPanoseNumber: ::PANOSE, + otmfsSelection: ::UINT, + otmfsType: ::UINT, + otmsCharSlopeRise: ::c_int, + otmsCharSlopeRun: ::c_int, + otmItalicAngle: ::c_int, + otmEMSquare: ::UINT, + otmAscent: ::c_int, + otmDescent: ::c_int, + otmLineGap: ::UINT, + otmsCapEmHeight: ::UINT, + otmsXHeight: ::UINT, + otmrcFontBox: ::RECT, + otmMacAscent: ::c_int, + otmMacDescent: ::c_int, + otmMacLineGap: ::UINT, + otmusMinimumPPEM: ::UINT, + otmptSubscriptSize: ::POINT, + otmptSubscriptOffset: ::POINT, + otmptSuperscriptSize: ::POINT, + otmptSuperscriptOffset: ::POINT, + otmsStrikeoutSize: ::UINT, + otmsStrikeoutPosition: ::c_int, + otmsUnderscoreSize: ::c_int, + otmsUnderscorePosition: ::c_int, + otmpFamilyName: ::PSTR, + otmpFaceName: ::PSTR, + otmpStyleName: ::PSTR, + otmpFullName: ::PSTR, +}} +pub type POUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; +pub type NPOUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; +pub type LPOUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; +STRUCT!{struct OUTLINETEXTMETRICW { + otmSize: ::UINT, + otmTextMetrics: TEXTMETRICW, + otmFiller: ::BYTE, + otmPanoseNumber: ::PANOSE, + otmfsSelection: ::UINT, + otmfsType: ::UINT, + otmsCharSlopeRise: ::c_int, + otmsCharSlopeRun: ::c_int, + otmItalicAngle: ::c_int, + otmEMSquare: ::UINT, + otmAscent: ::c_int, + otmDescent: ::c_int, + otmLineGap: ::UINT, + otmsCapEmHeight: ::UINT, + otmsXHeight: ::UINT, + otmrcFontBox: ::RECT, + otmMacAscent: ::c_int, + otmMacDescent: ::c_int, + otmMacLineGap: ::UINT, + otmusMinimumPPEM: ::UINT, + otmptSubscriptSize: ::POINT, + otmptSubscriptOffset: ::POINT, + otmptSuperscriptSize: ::POINT, + otmptSuperscriptOffset: ::POINT, + otmsStrikeoutSize: ::UINT, + otmsStrikeoutPosition: ::c_int, + otmsUnderscoreSize: ::c_int, + otmsUnderscorePosition: ::c_int, + otmpFamilyName: ::PSTR, + otmpFaceName: ::PSTR, + otmpStyleName: ::PSTR, + otmpFullName: ::PSTR, +}} +pub type POUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; +pub type NPOUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; +pub type LPOUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; +STRUCT!{struct RASTERIZER_STATUS { + nSize: ::c_short, + wFlags: ::c_short, + nLanguageID: ::c_short, +}} +pub type LPRASTERIZER_STATUS = *mut RASTERIZER_STATUS; +STRUCT!{struct ENHMETARECORD { + iType: ::DWORD, + nSize: ::DWORD, + dParm: [::DWORD; 1], +}} +pub type PENHMETARECORD = *mut ENHMETARECORD; +pub type LPENHMETARECORD = *mut ENHMETARECORD; +STRUCT!{struct METAFILEPICT { + mm: ::LONG, + xExt: ::LONG, + yExt: ::LONG, + hMF: ::HMETAFILE, +}} +pub type LPMETAFILEPICT = *mut METAFILEPICT; +STRUCT!{struct POINTFLOAT { + x: ::FLOAT, + y: ::FLOAT, +}} +pub type PPOINTFLOAT = *mut POINTFLOAT; +STRUCT!{struct GLYPHMETRICSFLOAT { + gmfBlackBoxX: ::FLOAT, + gmfBlackBoxY: ::FLOAT, + gmfptGlyphOrigin: POINTFLOAT, + gmfCellIncX: ::FLOAT, + gmfCellIncY: ::FLOAT, +}} +pub type PGLYPHMETRICSFLOAT = *mut GLYPHMETRICSFLOAT; +pub type LPGLYPHMETRICSFLOAT = *mut GLYPHMETRICSFLOAT; +pub const DT_PLOTTER: ::c_int = 0; +pub const DT_RASDISPLAY: ::c_int = 1; +pub const DT_RASPRINTER: ::c_int = 2; +pub const DT_RASCAMERA: ::c_int = 3; +pub const DT_CHARSTREAM: ::c_int = 4; +pub const DT_METAFILE: ::c_int = 5; +pub const DT_DISPFILE: ::c_int = 6; +pub const CLR_INVALID: ::COLORREF = 0xFFFFFFFF; +pub const ETO_OPAQUE: ::UINT = 0x0002; +pub const ETO_CLIPPED: ::UINT = 0x0004; +pub const ETO_GLYPH_INDEX: ::UINT = 0x0010; +pub const ETO_RTLREADING: ::UINT = 0x0080; +pub const ETO_NUMERICSLOCAL: ::UINT = 0x0400; +pub const ETO_NUMERICSLATIN: ::UINT = 0x0800; +pub const ETO_IGNORELANGUAGE: ::UINT = 0x1000; +pub const ETO_PDY: ::UINT = 0x2000; +pub const ETO_REVERSE_INDEX_MAP: ::UINT = 0x10000; +STRUCT!{struct EXTLOGPEN { + elpPenStyle: ::DWORD, + elpWidth: ::DWORD, + elpBrushStyle: ::UINT, + elpColor: ::COLORREF, + elpHatch: ::ULONG_PTR, + elpNumEntries: ::DWORD, + elpStyleEntry: [::DWORD; 1], +}} +pub type PEXTLOGPEN = *mut EXTLOGPEN; +pub type NPEXTLOGPEN = *mut EXTLOGPEN; +pub type LPEXTLOGPEN = *mut EXTLOGPEN; +pub type ENHMFENUMPROC = Option ::c_int>; +/* Metafile Functions */ +pub const META_SETBKCOLOR: ::WORD = 0x0201; +pub const META_SETBKMODE: ::WORD = 0x0102; +pub const META_SETMAPMODE: ::WORD = 0x0103; +pub const META_SETROP2: ::WORD = 0x0104; +pub const META_SETRELABS: ::WORD = 0x0105; +pub const META_SETPOLYFILLMODE: ::WORD = 0x0106; +pub const META_SETSTRETCHBLTMODE: ::WORD = 0x0107; +pub const META_SETTEXTCHAREXTRA: ::WORD = 0x0108; +pub const META_SETTEXTCOLOR: ::WORD = 0x0209; +pub const META_SETTEXTJUSTIFICATION: ::WORD = 0x020A; +pub const META_SETWINDOWORG: ::WORD = 0x020B; +pub const META_SETWINDOWEXT: ::WORD = 0x020C; +pub const META_SETVIEWPORTORG: ::WORD = 0x020D; +pub const META_SETVIEWPORTEXT: ::WORD = 0x020E; +pub const META_OFFSETWINDOWORG: ::WORD = 0x020F; +pub const META_SCALEWINDOWEXT: ::WORD = 0x0410; +pub const META_OFFSETVIEWPORTORG: ::WORD = 0x0211; +pub const META_SCALEVIEWPORTEXT: ::WORD = 0x0412; +pub const META_LINETO: ::WORD = 0x0213; +pub const META_MOVETO: ::WORD = 0x0214; +pub const META_EXCLUDECLIPRECT: ::WORD = 0x0415; +pub const META_INTERSECTCLIPRECT: ::WORD = 0x0416; +pub const META_ARC: ::WORD = 0x0817; +pub const META_ELLIPSE: ::WORD = 0x0418; +pub const META_FLOODFILL: ::WORD = 0x0419; +pub const META_PIE: ::WORD = 0x081A; +pub const META_RECTANGLE: ::WORD = 0x041B; +pub const META_ROUNDRECT: ::WORD = 0x061C; +pub const META_PATBLT: ::WORD = 0x061D; +pub const META_SAVEDC: ::WORD = 0x001E; +pub const META_SETPIXEL: ::WORD = 0x041F; +pub const META_OFFSETCLIPRGN: ::WORD = 0x0220; +pub const META_TEXTOUT: ::WORD = 0x0521; +pub const META_BITBLT: ::WORD = 0x0922; +pub const META_STRETCHBLT: ::WORD = 0x0B23; +pub const META_POLYGON: ::WORD = 0x0324; +pub const META_POLYLINE: ::WORD = 0x0325; +pub const META_ESCAPE: ::WORD = 0x0626; +pub const META_RESTOREDC: ::WORD = 0x0127; +pub const META_FILLREGION: ::WORD = 0x0228; +pub const META_FRAMEREGION: ::WORD = 0x0429; +pub const META_INVERTREGION: ::WORD = 0x012A; +pub const META_PAINTREGION: ::WORD = 0x012B; +pub const META_SELECTCLIPREGION: ::WORD = 0x012C; +pub const META_SELECTOBJECT: ::WORD = 0x012D; +pub const META_SETTEXTALIGN: ::WORD = 0x012E; +pub const META_CHORD: ::WORD = 0x0830; +pub const META_SETMAPPERFLAGS: ::WORD = 0x0231; +pub const META_EXTTEXTOUT: ::WORD = 0x0a32; +pub const META_SETDIBTODEV: ::WORD = 0x0d33; +pub const META_SELECTPALETTE: ::WORD = 0x0234; +pub const META_REALIZEPALETTE: ::WORD = 0x0035; +pub const META_ANIMATEPALETTE: ::WORD = 0x0436; +pub const META_SETPALENTRIES: ::WORD = 0x0037; +pub const META_POLYPOLYGON: ::WORD = 0x0538; +pub const META_RESIZEPALETTE: ::WORD = 0x0139; +pub const META_DIBBITBLT: ::WORD = 0x0940; +pub const META_DIBSTRETCHBLT: ::WORD = 0x0b41; +pub const META_DIBCREATEPATTERNBRUSH: ::WORD = 0x0142; +pub const META_STRETCHDIB: ::WORD = 0x0f43; +pub const META_EXTFLOODFILL: ::WORD = 0x0548; +pub const META_SETLAYOUT: ::WORD = 0x0149; +pub const META_DELETEOBJECT: ::WORD = 0x01f0; +pub const META_CREATEPALETTE: ::WORD = 0x00f7; +pub const META_CREATEPATTERNBRUSH: ::WORD = 0x01F9; +pub const META_CREATEPENINDIRECT: ::WORD = 0x02FA; +pub const META_CREATEFONTINDIRECT: ::WORD = 0x02FB; +pub const META_CREATEBRUSHINDIRECT: ::WORD = 0x02FC; +pub const META_CREATEREGION: ::WORD = 0x06FF; diff --git a/third_party/rust/winapi/src/winhttp.rs b/third_party/rust/winapi/src/winhttp.rs new file mode 100644 index 000000000000..e8ca6f646bcb --- /dev/null +++ b/third_party/rust/winapi/src/winhttp.rs @@ -0,0 +1,441 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Windows HTTP Services API constant definitions and macros +//54 +pub type HINTERNET = ::LPVOID; +pub type LPHINTERNET = *mut HINTERNET; +pub type INTERNET_PORT = ::WORD; +pub type LPINTERNET_PORT = *mut INTERNET_PORT; +pub const INTERNET_DEFAULT_PORT: INTERNET_PORT = 0; +pub const INTERNET_DEFAULT_HTTP_PORT: INTERNET_PORT = 80; +pub const INTERNET_DEFAULT_HTTPS_PORT: INTERNET_PORT = 443; +pub const WINHTTP_FLAG_ASYNC: ::DWORD = 0x10000000; +pub const WINHTTP_FLAG_SECURE: ::DWORD = 0x00800000; +pub const WINHTTP_FLAG_ESCAPE_PERCENT: ::DWORD = 0x00000004; +pub const WINHTTP_FLAG_NULL_CODEPAGE: ::DWORD = 0x00000008; +pub const WINHTTP_FLAG_BYPASS_PROXY_CACHE: ::DWORD = 0x00000100; +pub const WINHTTP_FLAG_REFRESH: ::DWORD = WINHTTP_FLAG_BYPASS_PROXY_CACHE; +pub const WINHTTP_FLAG_ESCAPE_DISABLE: ::DWORD = 0x00000040; +pub const WINHTTP_FLAG_ESCAPE_DISABLE_QUERY: ::DWORD = 0x00000080; +STRUCT!{struct WINHTTP_ASYNC_RESULT { + dwResult: ::DWORD_PTR, + dwError: ::DWORD, +}} +pub type LPWINHTTP_ASYNC_RESULT = *mut WINHTTP_ASYNC_RESULT; +pub type INTERNET_SCHEME = ::c_int; +pub type LPINTERNET_SCHEME = *mut ::c_int; +pub const INTERNET_SCHEME_HTTP: INTERNET_SCHEME = 1; +pub const INTERNET_SCHEME_HTTPS: INTERNET_SCHEME = 2; +pub const INTERNET_SCHEME_FTP: INTERNET_SCHEME = 3; +pub const INTERNET_SCHEME_SOCKS: INTERNET_SCHEME = 4; +STRUCT!{struct URL_COMPONENTS { + dwStructSize: ::DWORD, + lpszScheme: ::LPWSTR, + dwSchemeLength: ::DWORD, + nScheme: INTERNET_SCHEME, + lpszHostName: ::LPWSTR, + dwHostNameLength: ::DWORD, + nPort: INTERNET_PORT, + lpszUserName: ::LPWSTR, + dwUserNameLength: ::DWORD, + lpszPassword: ::LPWSTR, + dwPasswordLength: ::DWORD, + lpszUrlPath: ::LPWSTR, + dwUrlPathLength: ::DWORD, + lpszExtraInfo: ::LPWSTR, + dwExtraInfoLength: ::DWORD, +}} +pub type LPURL_COMPONENTS = *mut URL_COMPONENTS; +pub type URL_COMPONENTSW = URL_COMPONENTS; +pub type LPURL_COMPONENTSW = LPURL_COMPONENTS; +STRUCT!{struct WINHTTP_PROXY_INFO { + dwAccessType: ::DWORD, + lpszProxy: ::LPWSTR, + lpszProxyBypass: ::LPWSTR, +}} +pub type LPWINHTTP_PROXY_INFO = *mut WINHTTP_PROXY_INFO; +pub type WINHTTP_PROXY_INFOW = WINHTTP_PROXY_INFO; +pub type LPWINHTTP_PROXY_INFOW = LPWINHTTP_PROXY_INFO; +STRUCT!{struct WINHTTP_AUTOPROXY_OPTIONS { + dwFlags: ::DWORD, + dwAutoDetectFlags: ::DWORD, + lpszAutoConfigUrl: ::LPCWSTR, + lpvReserved: ::LPVOID, + dwReserved: ::DWORD, + fAutoLogonIfChallenged: ::BOOL, +}} +pub const WINHTTP_AUTOPROXY_AUTO_DETECT: ::DWORD = 0x00000001; +pub const WINHTTP_AUTOPROXY_CONFIG_URL: ::DWORD = 0x00000002; +pub const WINHTTP_AUTOPROXY_HOST_KEEPCASE: ::DWORD = 0x00000004; +pub const WINHTTP_AUTOPROXY_HOST_LOWERCASE: ::DWORD = 0x00000008; +pub const WINHTTP_AUTOPROXY_RUN_INPROCESS: ::DWORD = 0x00010000; +pub const WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY: ::DWORD = 0x00020000; +pub const WINHTTP_AUTOPROXY_NO_DIRECTACCESS: ::DWORD = 0x00040000; +pub const WINHTTP_AUTOPROXY_NO_CACHE_CLIENT: ::DWORD = 0x00080000; +pub const WINHTTP_AUTOPROXY_NO_CACHE_SVC: ::DWORD = 0x00100000; +pub const WINHTTP_AUTOPROXY_SORT_RESULTS: ::DWORD = 0x00400000; +pub const WINHTTP_AUTO_DETECT_TYPE_DHCP: ::DWORD = 0x00000001; +pub const WINHTTP_AUTO_DETECT_TYPE_DNS_A: ::DWORD = 0x00000002; +STRUCT!{struct WINHTTP_PROXY_RESULT_ENTRY { + fProxy: ::BOOL, + fBypass: ::BOOL, + ProxyScheme: INTERNET_SCHEME, + pwszProxy: ::PWSTR, + ProxyPort: INTERNET_PORT, +}} +STRUCT!{struct WINHTTP_PROXY_RESULT { + cEntries: ::DWORD, + pEntries: *mut WINHTTP_PROXY_RESULT_ENTRY, +}} +pub const WINHTTP_FIRST_OPTION: ::DWORD = WINHTTP_OPTION_CALLBACK; +pub const WINHTTP_OPTION_CALLBACK: ::DWORD = 1; +pub const WINHTTP_OPTION_RESOLVE_TIMEOUT: ::DWORD = 2; +pub const WINHTTP_OPTION_CONNECT_TIMEOUT: ::DWORD = 3; +pub const WINHTTP_OPTION_CONNECT_RETRIES: ::DWORD = 4; +pub const WINHTTP_OPTION_SEND_TIMEOUT: ::DWORD = 5; +pub const WINHTTP_OPTION_RECEIVE_TIMEOUT: ::DWORD = 6; +pub const WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT: ::DWORD = 7; +pub const WINHTTP_OPTION_HANDLE_TYPE: ::DWORD = 9; +pub const WINHTTP_OPTION_READ_BUFFER_SIZE: ::DWORD = 12; +pub const WINHTTP_OPTION_WRITE_BUFFER_SIZE: ::DWORD = 13; +pub const WINHTTP_OPTION_PARENT_HANDLE: ::DWORD = 21; +pub const WINHTTP_OPTION_EXTENDED_ERROR: ::DWORD = 24; +pub const WINHTTP_OPTION_SECURITY_FLAGS: ::DWORD = 31; +pub const WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT: ::DWORD = 32; +pub const WINHTTP_OPTION_URL: ::DWORD = 34; +pub const WINHTTP_OPTION_SECURITY_KEY_BITNESS: ::DWORD = 36; +pub const WINHTTP_OPTION_PROXY: ::DWORD = 38; +pub const WINHTTP_OPTION_PROXY_RESULT_ENTRY: ::DWORD = 39; +pub const WINHTTP_OPTION_USER_AGENT: ::DWORD = 41; +pub const WINHTTP_OPTION_CONTEXT_VALUE: ::DWORD = 45; +pub const WINHTTP_OPTION_CLIENT_CERT_CONTEXT: ::DWORD = 47; +pub const WINHTTP_OPTION_REQUEST_PRIORITY: ::DWORD = 58; +pub const WINHTTP_OPTION_HTTP_VERSION: ::DWORD = 59; +pub const WINHTTP_OPTION_DISABLE_FEATURE: ::DWORD = 63; +pub const WINHTTP_OPTION_CODEPAGE: ::DWORD = 68; +pub const WINHTTP_OPTION_MAX_CONNS_PER_SERVER: ::DWORD = 73; +pub const WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER: ::DWORD = 74; +pub const WINHTTP_OPTION_AUTOLOGON_POLICY: ::DWORD = 77; +pub const WINHTTP_OPTION_SERVER_CERT_CONTEXT: ::DWORD = 78; +pub const WINHTTP_OPTION_ENABLE_FEATURE: ::DWORD = 79; +pub const WINHTTP_OPTION_WORKER_THREAD_COUNT: ::DWORD = 80; +pub const WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT: ::DWORD = 81; +pub const WINHTTP_OPTION_PASSPORT_COBRANDING_URL: ::DWORD = 82; +pub const WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH: ::DWORD = 83; +pub const WINHTTP_OPTION_SECURE_PROTOCOLS: ::DWORD = 84; +pub const WINHTTP_OPTION_ENABLETRACING: ::DWORD = 85; +pub const WINHTTP_OPTION_PASSPORT_SIGN_OUT: ::DWORD = 86; +pub const WINHTTP_OPTION_PASSPORT_RETURN_URL: ::DWORD = 87; +pub const WINHTTP_OPTION_REDIRECT_POLICY: ::DWORD = 88; +pub const WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS: ::DWORD = 89; +pub const WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE: ::DWORD = 90; +pub const WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE: ::DWORD = 91; +pub const WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE: ::DWORD = 92; +pub const WINHTTP_OPTION_CONNECTION_INFO: ::DWORD = 93; +pub const WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST: ::DWORD = 94; +pub const WINHTTP_OPTION_SPN: ::DWORD = 96; +pub const WINHTTP_OPTION_GLOBAL_PROXY_CREDS: ::DWORD = 97; +pub const WINHTTP_OPTION_GLOBAL_SERVER_CREDS: ::DWORD = 98; +pub const WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT: ::DWORD = 99; +pub const WINHTTP_OPTION_REJECT_USERPWD_IN_URL: ::DWORD = 100; +pub const WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS: ::DWORD = 101; +pub const WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE: ::DWORD = 103; +pub const WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE: ::DWORD = 104; +pub const WINHTTP_OPTION_SERVER_SPN_USED: ::DWORD = 106; +pub const WINHTTP_OPTION_PROXY_SPN_USED: ::DWORD = 107; +pub const WINHTTP_OPTION_SERVER_CBT: ::DWORD = 108; +pub const WINHTTP_OPTION_UNSAFE_HEADER_PARSING: ::DWORD = 110; +pub const WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS: ::DWORD = 111; +pub const WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET: ::DWORD = 114; +pub const WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT: ::DWORD = 115; +pub const WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL: ::DWORD = 116; +pub const WINHTTP_OPTION_DECOMPRESSION: ::DWORD = 118; +pub const WINHTTP_OPTION_WEB_SOCKET_RECEIVE_BUFFER_SIZE: ::DWORD = 122; +pub const WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE: ::DWORD = 123; +pub const WINHTTP_LAST_OPTION: ::DWORD = WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE; +pub const WINHTTP_OPTION_USERNAME: ::DWORD = 0x1000; +pub const WINHTTP_OPTION_PASSWORD: ::DWORD = 0x1001; +pub const WINHTTP_OPTION_PROXY_USERNAME: ::DWORD = 0x1002; +pub const WINHTTP_OPTION_PROXY_PASSWORD: ::DWORD = 0x1003; +//552 +pub type WINHTTP_STATUS_CALLBACK = Option; +pub type LPWINHTTP_STATUS_CALLBACK = *mut WINHTTP_STATUS_CALLBACK; +pub const WINHTTP_CALLBACK_STATUS_RESOLVING_NAME: ::DWORD = 0x00000001; +pub const WINHTTP_CALLBACK_STATUS_NAME_RESOLVED: ::DWORD = 0x00000002; +pub const WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER: ::DWORD = 0x00000004; +pub const WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER: ::DWORD = 0x00000008; +pub const WINHTTP_CALLBACK_STATUS_SENDING_REQUEST: ::DWORD = 0x00000010; +pub const WINHTTP_CALLBACK_STATUS_REQUEST_SENT: ::DWORD = 0x00000020; +pub const WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE: ::DWORD = 0x00000040; +pub const WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED: ::DWORD = 0x00000080; +pub const WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION: ::DWORD = 0x00000100; +pub const WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED: ::DWORD = 0x00000200; +pub const WINHTTP_CALLBACK_STATUS_HANDLE_CREATED: ::DWORD = 0x00000400; +pub const WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING: ::DWORD = 0x00000800; +pub const WINHTTP_CALLBACK_STATUS_DETECTING_PROXY: ::DWORD = 0x00001000; +pub const WINHTTP_CALLBACK_STATUS_REDIRECT: ::DWORD = 0x00004000; +pub const WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE: ::DWORD = 0x00008000; +pub const WINHTTP_CALLBACK_STATUS_SECURE_FAILURE: ::DWORD = 0x00010000; +pub const WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE: ::DWORD = 0x00020000; +pub const WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE: ::DWORD = 0x00040000; +pub const WINHTTP_CALLBACK_STATUS_READ_COMPLETE: ::DWORD = 0x00080000; +pub const WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE: ::DWORD = 0x00100000; +pub const WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: ::DWORD = 0x00200000; +pub const WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE: ::DWORD = 0x00400000; +pub const WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE: ::DWORD = 0x01000000; +pub const WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE: ::DWORD = 0x02000000; +pub const WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE: ::DWORD = 0x04000000; +pub const WINHTTP_CALLBACK_FLAG_RESOLVE_NAME: ::DWORD = WINHTTP_CALLBACK_STATUS_RESOLVING_NAME + | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED; +pub const WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER: ::DWORD = + WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER; +pub const WINHTTP_CALLBACK_FLAG_SEND_REQUEST: ::DWORD = + WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS_REQUEST_SENT; +pub const WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE: ::DWORD = + WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED; +pub const WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION: ::DWORD = + WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED; +pub const WINHTTP_CALLBACK_FLAG_HANDLES: ::DWORD = + WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING; +pub const WINHTTP_CALLBACK_FLAG_DETECTING_PROXY: ::DWORD = WINHTTP_CALLBACK_STATUS_DETECTING_PROXY; +pub const WINHTTP_CALLBACK_FLAG_REDIRECT: ::DWORD = WINHTTP_CALLBACK_STATUS_REDIRECT; +pub const WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE: ::DWORD = + WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE; +pub const WINHTTP_CALLBACK_FLAG_SECURE_FAILURE: ::DWORD = WINHTTP_CALLBACK_STATUS_SECURE_FAILURE; +pub const WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE: ::DWORD = + WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE: ::DWORD = + WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE; +pub const WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE: ::DWORD = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE; +pub const WINHTTP_CALLBACK_FLAG_READ_COMPLETE: ::DWORD = WINHTTP_CALLBACK_STATUS_READ_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE: ::DWORD = WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_REQUEST_ERROR: ::DWORD = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; +pub const WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE: ::DWORD = + WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS: ::DWORD = + WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE + | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE | WINHTTP_CALLBACK_STATUS_READ_COMPLETE + | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR + | WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS: ::DWORD = 0xffffffff; +pub const WINHTTP_QUERY_MIME_VERSION: ::DWORD = 0; +pub const WINHTTP_QUERY_CONTENT_TYPE: ::DWORD = 1; +pub const WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING: ::DWORD = 2; +pub const WINHTTP_QUERY_CONTENT_ID: ::DWORD = 3; +pub const WINHTTP_QUERY_CONTENT_DESCRIPTION: ::DWORD = 4; +pub const WINHTTP_QUERY_CONTENT_LENGTH: ::DWORD = 5; +pub const WINHTTP_QUERY_CONTENT_LANGUAGE: ::DWORD = 6; +pub const WINHTTP_QUERY_ALLOW: ::DWORD = 7; +pub const WINHTTP_QUERY_PUBLIC: ::DWORD = 8; +pub const WINHTTP_QUERY_DATE: ::DWORD = 9; +pub const WINHTTP_QUERY_EXPIRES: ::DWORD = 10; +pub const WINHTTP_QUERY_LAST_MODIFIED: ::DWORD = 11; +pub const WINHTTP_QUERY_MESSAGE_ID: ::DWORD = 12; +pub const WINHTTP_QUERY_URI: ::DWORD = 13; +pub const WINHTTP_QUERY_DERIVED_FROM: ::DWORD = 14; +pub const WINHTTP_QUERY_COST: ::DWORD = 15; +pub const WINHTTP_QUERY_LINK: ::DWORD = 16; +pub const WINHTTP_QUERY_PRAGMA: ::DWORD = 17; +pub const WINHTTP_QUERY_VERSION: ::DWORD = 18; +pub const WINHTTP_QUERY_STATUS_CODE: ::DWORD = 19; +pub const WINHTTP_QUERY_STATUS_TEXT: ::DWORD = 20; +pub const WINHTTP_QUERY_RAW_HEADERS: ::DWORD = 21; +pub const WINHTTP_QUERY_RAW_HEADERS_CRLF: ::DWORD = 22; +pub const WINHTTP_QUERY_CONNECTION: ::DWORD = 23; +pub const WINHTTP_QUERY_ACCEPT: ::DWORD = 24; +pub const WINHTTP_QUERY_ACCEPT_CHARSET: ::DWORD = 25; +pub const WINHTTP_QUERY_ACCEPT_ENCODING: ::DWORD = 26; +pub const WINHTTP_QUERY_ACCEPT_LANGUAGE: ::DWORD = 27; +pub const WINHTTP_QUERY_AUTHORIZATION: ::DWORD = 28; +pub const WINHTTP_QUERY_CONTENT_ENCODING: ::DWORD = 29; +pub const WINHTTP_QUERY_FORWARDED: ::DWORD = 30; +pub const WINHTTP_QUERY_FROM: ::DWORD = 31; +pub const WINHTTP_QUERY_IF_MODIFIED_SINCE: ::DWORD = 32; +pub const WINHTTP_QUERY_LOCATION: ::DWORD = 33; +pub const WINHTTP_QUERY_ORIG_URI: ::DWORD = 34; +pub const WINHTTP_QUERY_REFERER: ::DWORD = 35; +pub const WINHTTP_QUERY_RETRY_AFTER: ::DWORD = 36; +pub const WINHTTP_QUERY_SERVER: ::DWORD = 37; +pub const WINHTTP_QUERY_TITLE: ::DWORD = 38; +pub const WINHTTP_QUERY_USER_AGENT: ::DWORD = 39; +pub const WINHTTP_QUERY_WWW_AUTHENTICATE: ::DWORD = 40; +pub const WINHTTP_QUERY_PROXY_AUTHENTICATE: ::DWORD = 41; +pub const WINHTTP_QUERY_ACCEPT_RANGES: ::DWORD = 42; +pub const WINHTTP_QUERY_SET_COOKIE: ::DWORD = 43; +pub const WINHTTP_QUERY_COOKIE: ::DWORD = 44; +pub const WINHTTP_QUERY_REQUEST_METHOD: ::DWORD = 45; +pub const WINHTTP_QUERY_REFRESH: ::DWORD = 46; +pub const WINHTTP_QUERY_CONTENT_DISPOSITION: ::DWORD = 47; +pub const WINHTTP_QUERY_AGE: ::DWORD = 48; +pub const WINHTTP_QUERY_CACHE_CONTROL: ::DWORD = 49; +pub const WINHTTP_QUERY_CONTENT_BASE: ::DWORD = 50; +pub const WINHTTP_QUERY_CONTENT_LOCATION: ::DWORD = 51; +pub const WINHTTP_QUERY_CONTENT_MD5: ::DWORD = 52; +pub const WINHTTP_QUERY_CONTENT_RANGE: ::DWORD = 53; +pub const WINHTTP_QUERY_ETAG: ::DWORD = 54; +pub const WINHTTP_QUERY_HOST: ::DWORD = 55; +pub const WINHTTP_QUERY_IF_MATCH: ::DWORD = 56; +pub const WINHTTP_QUERY_IF_NONE_MATCH: ::DWORD = 57; +pub const WINHTTP_QUERY_IF_RANGE: ::DWORD = 58; +pub const WINHTTP_QUERY_IF_UNMODIFIED_SINCE: ::DWORD = 59; +pub const WINHTTP_QUERY_MAX_FORWARDS: ::DWORD = 60; +pub const WINHTTP_QUERY_PROXY_AUTHORIZATION: ::DWORD = 61; +pub const WINHTTP_QUERY_RANGE: ::DWORD = 62; +pub const WINHTTP_QUERY_TRANSFER_ENCODING: ::DWORD = 63; +pub const WINHTTP_QUERY_UPGRADE: ::DWORD = 64; +pub const WINHTTP_QUERY_VARY: ::DWORD = 65; +pub const WINHTTP_QUERY_VIA: ::DWORD = 66; +pub const WINHTTP_QUERY_WARNING: ::DWORD = 67; +pub const WINHTTP_QUERY_EXPECT: ::DWORD = 68; +pub const WINHTTP_QUERY_PROXY_CONNECTION: ::DWORD = 69; +pub const WINHTTP_QUERY_UNLESS_MODIFIED_SINCE: ::DWORD = 70; +pub const WINHTTP_QUERY_PROXY_SUPPORT: ::DWORD = 75; +pub const WINHTTP_QUERY_AUTHENTICATION_INFO: ::DWORD = 76; +pub const WINHTTP_QUERY_PASSPORT_URLS: ::DWORD = 77; +pub const WINHTTP_QUERY_PASSPORT_CONFIG: ::DWORD = 78; +pub const WINHTTP_QUERY_MAX: ::DWORD = 78; +pub const WINHTTP_QUERY_CUSTOM: ::DWORD = 65535; +pub const WINHTTP_QUERY_FLAG_REQUEST_HEADERS: ::DWORD = 0x80000000; +pub const WINHTTP_QUERY_FLAG_SYSTEMTIME: ::DWORD = 0x40000000; +pub const WINHTTP_QUERY_FLAG_NUMBER: ::DWORD = 0x20000000; +pub const HTTP_STATUS_CONTINUE: ::DWORD = 100; +pub const HTTP_STATUS_SWITCH_PROTOCOLS: ::DWORD = 101; +pub const HTTP_STATUS_OK: ::DWORD = 200; +pub const HTTP_STATUS_CREATED: ::DWORD = 201; +pub const HTTP_STATUS_ACCEPTED: ::DWORD = 202; +pub const HTTP_STATUS_PARTIAL: ::DWORD = 203; +pub const HTTP_STATUS_NO_CONTENT: ::DWORD = 204; +pub const HTTP_STATUS_RESET_CONTENT: ::DWORD = 205; +pub const HTTP_STATUS_PARTIAL_CONTENT: ::DWORD = 206; +pub const HTTP_STATUS_WEBDAV_MULTI_STATUS: ::DWORD = 207; +pub const HTTP_STATUS_AMBIGUOUS: ::DWORD = 300; +pub const HTTP_STATUS_MOVED: ::DWORD = 301; +pub const HTTP_STATUS_REDIRECT: ::DWORD = 302; +pub const HTTP_STATUS_REDIRECT_METHOD: ::DWORD = 303; +pub const HTTP_STATUS_NOT_MODIFIED: ::DWORD = 304; +pub const HTTP_STATUS_USE_PROXY: ::DWORD = 305; +pub const HTTP_STATUS_REDIRECT_KEEP_VERB: ::DWORD = 307; +pub const HTTP_STATUS_BAD_REQUEST: ::DWORD = 400; +pub const HTTP_STATUS_DENIED: ::DWORD = 401; +pub const HTTP_STATUS_PAYMENT_REQ: ::DWORD = 402; +pub const HTTP_STATUS_FORBIDDEN: ::DWORD = 403; +pub const HTTP_STATUS_NOT_FOUND: ::DWORD = 404; +pub const HTTP_STATUS_BAD_METHOD: ::DWORD = 405; +pub const HTTP_STATUS_NONE_ACCEPTABLE: ::DWORD = 406; +pub const HTTP_STATUS_PROXY_AUTH_REQ: ::DWORD = 407; +pub const HTTP_STATUS_REQUEST_TIMEOUT: ::DWORD = 408; +pub const HTTP_STATUS_CONFLICT: ::DWORD = 409; +pub const HTTP_STATUS_GONE: ::DWORD = 410; +pub const HTTP_STATUS_LENGTH_REQUIRED: ::DWORD = 411; +pub const HTTP_STATUS_PRECOND_FAILED: ::DWORD = 412; +pub const HTTP_STATUS_REQUEST_TOO_LARGE: ::DWORD = 413; +pub const HTTP_STATUS_URI_TOO_LONG: ::DWORD = 414; +pub const HTTP_STATUS_UNSUPPORTED_MEDIA: ::DWORD = 415; +pub const HTTP_STATUS_RETRY_WITH: ::DWORD = 449; +pub const HTTP_STATUS_SERVER_ERROR: ::DWORD = 500; +pub const HTTP_STATUS_NOT_SUPPORTED: ::DWORD = 501; +pub const HTTP_STATUS_BAD_GATEWAY: ::DWORD = 502; +pub const HTTP_STATUS_SERVICE_UNAVAIL: ::DWORD = 503; +pub const HTTP_STATUS_GATEWAY_TIMEOUT: ::DWORD = 504; +pub const HTTP_STATUS_VERSION_NOT_SUP: ::DWORD = 505; +pub const HTTP_STATUS_FIRST: ::DWORD = HTTP_STATUS_CONTINUE; +pub const HTTP_STATUS_LAST: ::DWORD = HTTP_STATUS_VERSION_NOT_SUP; +pub const WINHTTP_ACCESS_TYPE_DEFAULT_PROXY: ::DWORD = 0; +pub const WINHTTP_ACCESS_TYPE_NO_PROXY: ::DWORD = 1; +pub const WINHTTP_ACCESS_TYPE_NAMED_PROXY: ::DWORD = 3; +pub const WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY: ::DWORD = 4; +pub const WINHTTP_ERROR_BASE: ::DWORD = 12000; +pub const ERROR_WINHTTP_OUT_OF_HANDLES: ::DWORD = WINHTTP_ERROR_BASE + 1; +pub const ERROR_WINHTTP_TIMEOUT: ::DWORD = WINHTTP_ERROR_BASE + 2; +pub const ERROR_WINHTTP_INTERNAL_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 4; +pub const ERROR_WINHTTP_INVALID_URL: ::DWORD = WINHTTP_ERROR_BASE + 5; +pub const ERROR_WINHTTP_UNRECOGNIZED_SCHEME: ::DWORD = WINHTTP_ERROR_BASE + 6; +pub const ERROR_WINHTTP_NAME_NOT_RESOLVED: ::DWORD = WINHTTP_ERROR_BASE + 7; +pub const ERROR_WINHTTP_INVALID_OPTION: ::DWORD = WINHTTP_ERROR_BASE + 9; +pub const ERROR_WINHTTP_OPTION_NOT_SETTABLE: ::DWORD = WINHTTP_ERROR_BASE + 11; +pub const ERROR_WINHTTP_SHUTDOWN: ::DWORD = WINHTTP_ERROR_BASE + 12; +pub const ERROR_WINHTTP_LOGIN_FAILURE: ::DWORD = WINHTTP_ERROR_BASE + 15; +pub const ERROR_WINHTTP_OPERATION_CANCELLED: ::DWORD = WINHTTP_ERROR_BASE + 17; +pub const ERROR_WINHTTP_INCORRECT_HANDLE_TYPE: ::DWORD = WINHTTP_ERROR_BASE + 18; +pub const ERROR_WINHTTP_INCORRECT_HANDLE_STATE: ::DWORD = WINHTTP_ERROR_BASE + 19; +pub const ERROR_WINHTTP_CANNOT_CONNECT: ::DWORD = WINHTTP_ERROR_BASE + 29; +pub const ERROR_WINHTTP_CONNECTION_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 30; +pub const ERROR_WINHTTP_RESEND_REQUEST: ::DWORD = WINHTTP_ERROR_BASE + 32; +pub const ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED: ::DWORD = WINHTTP_ERROR_BASE + 44; +pub const ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN: ::DWORD = WINHTTP_ERROR_BASE + 100; +pub const ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND: ::DWORD = WINHTTP_ERROR_BASE + 101; +pub const ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND: ::DWORD = WINHTTP_ERROR_BASE + 102; +pub const ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN: ::DWORD = WINHTTP_ERROR_BASE + 103; +pub const ERROR_WINHTTP_HEADER_NOT_FOUND: ::DWORD = WINHTTP_ERROR_BASE + 150; +pub const ERROR_WINHTTP_INVALID_SERVER_RESPONSE: ::DWORD = WINHTTP_ERROR_BASE + 152; +pub const ERROR_WINHTTP_INVALID_HEADER: ::DWORD = WINHTTP_ERROR_BASE + 153; +pub const ERROR_WINHTTP_INVALID_QUERY_REQUEST: ::DWORD = WINHTTP_ERROR_BASE + 154; +pub const ERROR_WINHTTP_HEADER_ALREADY_EXISTS: ::DWORD = WINHTTP_ERROR_BASE + 155; +pub const ERROR_WINHTTP_REDIRECT_FAILED: ::DWORD = WINHTTP_ERROR_BASE + 156; +pub const ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 178; +pub const ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT: ::DWORD = WINHTTP_ERROR_BASE + 166; +pub const ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT: ::DWORD = WINHTTP_ERROR_BASE + 167; +pub const ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE: ::DWORD = WINHTTP_ERROR_BASE + 176; +pub const ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 177; +pub const ERROR_WINHTTP_NOT_INITIALIZED: ::DWORD = WINHTTP_ERROR_BASE + 172; +pub const ERROR_WINHTTP_SECURE_FAILURE: ::DWORD = WINHTTP_ERROR_BASE + 175; +pub const ERROR_WINHTTP_SECURE_CERT_DATE_INVALID: ::DWORD = WINHTTP_ERROR_BASE + 37; +pub const ERROR_WINHTTP_SECURE_CERT_CN_INVALID: ::DWORD = WINHTTP_ERROR_BASE + 38; +pub const ERROR_WINHTTP_SECURE_INVALID_CA: ::DWORD = WINHTTP_ERROR_BASE + 45; +pub const ERROR_WINHTTP_SECURE_CERT_REV_FAILED: ::DWORD = WINHTTP_ERROR_BASE + 57; +pub const ERROR_WINHTTP_SECURE_CHANNEL_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 157; +pub const ERROR_WINHTTP_SECURE_INVALID_CERT: ::DWORD = WINHTTP_ERROR_BASE + 169; +pub const ERROR_WINHTTP_SECURE_CERT_REVOKED: ::DWORD = WINHTTP_ERROR_BASE + 170; +pub const ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE: ::DWORD = WINHTTP_ERROR_BASE + 179; +pub const ERROR_WINHTTP_AUTODETECTION_FAILED: ::DWORD = WINHTTP_ERROR_BASE + 180; +pub const ERROR_WINHTTP_HEADER_COUNT_EXCEEDED: ::DWORD = WINHTTP_ERROR_BASE + 181; +pub const ERROR_WINHTTP_HEADER_SIZE_OVERFLOW: ::DWORD = WINHTTP_ERROR_BASE + 182; +pub const ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW: ::DWORD = WINHTTP_ERROR_BASE + 183; +pub const ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW: ::DWORD = WINHTTP_ERROR_BASE + 184; +pub const ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY: ::DWORD = WINHTTP_ERROR_BASE + 185; +pub const ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY: ::DWORD = WINHTTP_ERROR_BASE + 186; +pub const WINHTTP_ERROR_LAST: ::DWORD = WINHTTP_ERROR_BASE + 186; +pub const WINHTTP_RESET_STATE: ::DWORD = 0x00000001; +pub const WINHTTP_RESET_SWPAD_CURRENT_NETWORK: ::DWORD = 0x00000002; +pub const WINHTTP_RESET_SWPAD_ALL: ::DWORD = 0x00000004; +pub const WINHTTP_RESET_SCRIPT_CACHE: ::DWORD = 0x00000008; +pub const WINHTTP_RESET_ALL: ::DWORD = 0x0000FFFF; +pub const WINHTTP_RESET_NOTIFY_NETWORK_CHANGED: ::DWORD = 0x00010000; +pub const WINHTTP_RESET_OUT_OF_PROC: ::DWORD = 0x00020000; +STRUCT!{struct WINHTTP_CURRENT_USER_IE_PROXY_CONFIG { + fAutoDetect: ::BOOL, + lpszAutoConfigUrl: ::LPWSTR, + lpszProxy: ::LPWSTR, + lpszProxyBypass: ::LPWSTR, +}} +//1370 +ENUM!{enum WINHTTP_WEB_SOCKET_OPERATION { + WINHTTP_WEB_SOCKET_SEND_OPERATION = 0, + WINHTTP_WEB_SOCKET_RECEIVE_OPERATION = 1, + WINHTTP_WEB_SOCKET_CLOSE_OPERATION = 2, + WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION = 3, +}} +ENUM!{enum WINHTTP_WEB_SOCKET_BUFFER_TYPE { + WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE = 0, + WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE = 1, + WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE = 2, + WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE = 3, + WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE = 4, +}} +ENUM!{enum WINHTTP_WEB_SOCKET_CLOSE_STATUS { + WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS = 1000, + WINHTTP_WEB_SOCKET_ENDPOINT_TERMINATED_CLOSE_STATUS = 1001, + WINHTTP_WEB_SOCKET_PROTOCOL_ERROR_CLOSE_STATUS = 1002, + WINHTTP_WEB_SOCKET_INVALID_DATA_TYPE_CLOSE_STATUS = 1003, + WINHTTP_WEB_SOCKET_EMPTY_CLOSE_STATUS = 1005, + WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS = 1006, + WINHTTP_WEB_SOCKET_INVALID_PAYLOAD_CLOSE_STATUS = 1007, + WINHTTP_WEB_SOCKET_POLICY_VIOLATION_CLOSE_STATUS = 1008, + WINHTTP_WEB_SOCKET_MESSAGE_TOO_BIG_CLOSE_STATUS = 1009, + WINHTTP_WEB_SOCKET_UNSUPPORTED_EXTENSIONS_CLOSE_STATUS = 1010, + WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS = 1011, + WINHTTP_WEB_SOCKET_SECURE_HANDSHAKE_ERROR_CLOSE_STATUS = 1015, +}} diff --git a/third_party/rust/winapi/src/winioctl.rs b/third_party/rust/winapi/src/winioctl.rs new file mode 100644 index 000000000000..de3b96107c63 --- /dev/null +++ b/third_party/rust/winapi/src/winioctl.rs @@ -0,0 +1,754 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This module defines the 32-Bit Windows Device I/O control codes. +//123 +pub const FILE_DEVICE_BEEP: ::DWORD = 0x00000001; +pub const FILE_DEVICE_CD_ROM: ::DWORD = 0x00000002; +pub const FILE_DEVICE_CD_ROM_FILE_SYSTEM: ::DWORD = 0x00000003; +pub const FILE_DEVICE_CONTROLLER: ::DWORD = 0x00000004; +pub const FILE_DEVICE_DATALINK: ::DWORD = 0x00000005; +pub const FILE_DEVICE_DFS: ::DWORD = 0x00000006; +pub const FILE_DEVICE_DISK: ::DWORD = 0x00000007; +pub const FILE_DEVICE_DISK_FILE_SYSTEM: ::DWORD = 0x00000008; +pub const FILE_DEVICE_FILE_SYSTEM: ::DWORD = 0x00000009; +pub const FILE_DEVICE_INPORT_PORT: ::DWORD = 0x0000000a; +pub const FILE_DEVICE_KEYBOARD: ::DWORD = 0x0000000b; +pub const FILE_DEVICE_MAILSLOT: ::DWORD = 0x0000000c; +pub const FILE_DEVICE_MIDI_IN: ::DWORD = 0x0000000d; +pub const FILE_DEVICE_MIDI_OUT: ::DWORD = 0x0000000e; +pub const FILE_DEVICE_MOUSE: ::DWORD = 0x0000000f; +pub const FILE_DEVICE_MULTI_UNC_PROVIDER: ::DWORD = 0x00000010; +pub const FILE_DEVICE_NAMED_PIPE: ::DWORD = 0x00000011; +pub const FILE_DEVICE_NETWORK: ::DWORD = 0x00000012; +pub const FILE_DEVICE_NETWORK_BROWSER: ::DWORD = 0x00000013; +pub const FILE_DEVICE_NETWORK_FILE_SYSTEM: ::DWORD = 0x00000014; +pub const FILE_DEVICE_NULL: ::DWORD = 0x00000015; +pub const FILE_DEVICE_PARALLEL_PORT: ::DWORD = 0x00000016; +pub const FILE_DEVICE_PHYSICAL_NETCARD: ::DWORD = 0x00000017; +pub const FILE_DEVICE_PRINTER: ::DWORD = 0x00000018; +pub const FILE_DEVICE_SCANNER: ::DWORD = 0x00000019; +pub const FILE_DEVICE_SERIAL_MOUSE_PORT: ::DWORD = 0x0000001a; +pub const FILE_DEVICE_SERIAL_PORT: ::DWORD = 0x0000001b; +pub const FILE_DEVICE_SCREEN: ::DWORD = 0x0000001c; +pub const FILE_DEVICE_SOUND: ::DWORD = 0x0000001d; +pub const FILE_DEVICE_STREAMS: ::DWORD = 0x0000001e; +pub const FILE_DEVICE_TAPE: ::DWORD = 0x0000001f; +pub const FILE_DEVICE_TAPE_FILE_SYSTEM: ::DWORD = 0x00000020; +pub const FILE_DEVICE_TRANSPORT: ::DWORD = 0x00000021; +pub const FILE_DEVICE_UNKNOWN: ::DWORD = 0x00000022; +pub const FILE_DEVICE_VIDEO: ::DWORD = 0x00000023; +pub const FILE_DEVICE_VIRTUAL_DISK: ::DWORD = 0x00000024; +pub const FILE_DEVICE_WAVE_IN: ::DWORD = 0x00000025; +pub const FILE_DEVICE_WAVE_OUT: ::DWORD = 0x00000026; +pub const FILE_DEVICE_8042_PORT: ::DWORD = 0x00000027; +pub const FILE_DEVICE_NETWORK_REDIRECTOR: ::DWORD = 0x00000028; +pub const FILE_DEVICE_BATTERY: ::DWORD = 0x00000029; +pub const FILE_DEVICE_BUS_EXTENDER: ::DWORD = 0x0000002a; +pub const FILE_DEVICE_MODEM: ::DWORD = 0x0000002b; +pub const FILE_DEVICE_VDM: ::DWORD = 0x0000002c; +pub const FILE_DEVICE_MASS_STORAGE: ::DWORD = 0x0000002d; +pub const FILE_DEVICE_SMB: ::DWORD = 0x0000002e; +pub const FILE_DEVICE_KS: ::DWORD = 0x0000002f; +pub const FILE_DEVICE_CHANGER: ::DWORD = 0x00000030; +pub const FILE_DEVICE_SMARTCARD: ::DWORD = 0x00000031; +pub const FILE_DEVICE_ACPI: ::DWORD = 0x00000032; +pub const FILE_DEVICE_DVD: ::DWORD = 0x00000033; +pub const FILE_DEVICE_FULLSCREEN_VIDEO: ::DWORD = 0x00000034; +pub const FILE_DEVICE_DFS_FILE_SYSTEM: ::DWORD = 0x00000035; +pub const FILE_DEVICE_DFS_VOLUME: ::DWORD = 0x00000036; +pub const FILE_DEVICE_SERENUM: ::DWORD = 0x00000037; +pub const FILE_DEVICE_TERMSRV: ::DWORD = 0x00000038; +pub const FILE_DEVICE_KSEC: ::DWORD = 0x00000039; +pub const FILE_DEVICE_FIPS: ::DWORD = 0x0000003A; +pub const FILE_DEVICE_INFINIBAND: ::DWORD = 0x0000003B; +pub const FILE_DEVICE_VMBUS: ::DWORD = 0x0000003E; +pub const FILE_DEVICE_CRYPT_PROVIDER: ::DWORD = 0x0000003F; +pub const FILE_DEVICE_WPD: ::DWORD = 0x00000040; +pub const FILE_DEVICE_BLUETOOTH: ::DWORD = 0x00000041; +pub const FILE_DEVICE_MT_COMPOSITE: ::DWORD = 0x00000042; +pub const FILE_DEVICE_MT_TRANSPORT: ::DWORD = 0x00000043; +pub const FILE_DEVICE_BIOMETRIC: ::DWORD = 0x00000044; +pub const FILE_DEVICE_PMI: ::DWORD = 0x00000045; +pub const FILE_DEVICE_EHSTOR: ::DWORD = 0x00000046; +pub const FILE_DEVICE_DEVAPI: ::DWORD = 0x00000047; +pub const FILE_DEVICE_GPIO: ::DWORD = 0x00000048; +pub const FILE_DEVICE_USBEX: ::DWORD = 0x00000049; +pub const FILE_DEVICE_CONSOLE: ::DWORD = 0x00000050; +pub const FILE_DEVICE_NFP: ::DWORD = 0x00000051; +pub const FILE_DEVICE_SYSENV: ::DWORD = 0x00000052; +pub const FILE_DEVICE_VIRTUAL_BLOCK: ::DWORD = 0x00000053; +pub const FILE_DEVICE_POINT_OF_SERVICE: ::DWORD = 0x00000054; +//224 +pub const METHOD_BUFFERED: ::DWORD = 0; +pub const METHOD_IN_DIRECT: ::DWORD = 1; +pub const METHOD_OUT_DIRECT: ::DWORD = 2; +pub const METHOD_NEITHER: ::DWORD = 3; +//253 +pub const FILE_ANY_ACCESS: ::DWORD = 0; +pub const FILE_SPECIAL_ACCESS: ::DWORD = FILE_ANY_ACCESS; +pub const FILE_READ_ACCESS: ::DWORD = 0x0001; +pub const FILE_WRITE_ACCESS: ::DWORD = 0x0002; +//281 +pub const IOCTL_STORAGE_BASE: ::DWORD = FILE_DEVICE_MASS_STORAGE; +pub const IOCTL_STORAGE_CHECK_VERIFY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0200, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_CHECK_VERIFY2: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0200, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_MEDIA_REMOVAL: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0201, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_EJECT_MEDIA: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0202, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_LOAD_MEDIA: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0203, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_LOAD_MEDIA2: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0203, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_RESERVE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_STORAGE_RELEASE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_STORAGE_FIND_NEW_DEVICES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0206, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_EJECTION_CONTROL: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0250, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_MCN_CONTROL: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0251, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_MEDIA_TYPES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0300, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_MEDIA_TYPES_EX: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0301, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0304, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_HOTPLUG_INFO: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0305, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_SET_HOTPLUG_INFO: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0306, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_RESET_BUS: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_STORAGE_RESET_DEVICE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0401, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_BREAK_RESERVATION: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0405, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_PERSISTENT_RESERVE_IN: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0406, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_PERSISTENT_RESERVE_OUT: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0407, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_GET_DEVICE_NUMBER: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0420, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_PREDICT_FAILURE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0440, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_FAILURE_PREDICTION_CONFIG: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0441, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_READ_CAPACITY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0450, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_GET_DEVICE_TELEMETRY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0470, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_DEVICE_TELEMETRY_NOTIFY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0471, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_DEVICE_TELEMETRY_QUERY_CAPS: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, + 0x0472, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_GET_DEVICE_TELEMETRY_RAW: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0473, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_QUERY_PROPERTY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0500, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0501, + METHOD_BUFFERED, FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_GET_LB_PROVISIONING_MAP_RESOURCES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, + 0x0502, METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_GET_BC_PROPERTIES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0600, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_ALLOCATE_BC_STREAM: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0601, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_FREE_BC_STREAM: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0602, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, + 0x0620, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_START_DATA_INTEGRITY_CHECK: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0621, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_STOP_DATA_INTEGRITY_CHECK: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0622, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const OBSOLETE_IOCTL_STORAGE_RESET_BUS: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0400, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const OBSOLETE_IOCTL_STORAGE_RESET_DEVICE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0401, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_ENABLE_IDLE_POWER: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0720, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_IDLE_POWERUP_REASON: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0721, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_POWER_ACTIVE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0722, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_POWER_IDLE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0723, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_EVENT_NOTIFICATION: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0724, + METHOD_BUFFERED, FILE_ANY_ACCESS); +//2627 +pub const IOCTL_DISK_BASE: ::DWORD = FILE_DEVICE_DISK; +pub const IOCTL_DISK_GET_DRIVE_GEOMETRY: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0000, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_GET_PARTITION_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0001, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_SET_PARTITION_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0002, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_DRIVE_LAYOUT: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0003, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_SET_DRIVE_LAYOUT: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0004, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_VERIFY: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_FORMAT_TRACKS: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_REASSIGN_BLOCKS: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_PERFORMANCE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_IS_WRITABLE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_LOGGING: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_FORMAT_TRACKS_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000b, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_HISTOGRAM_STRUCTURE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000c, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_HISTOGRAM_DATA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_HISTOGRAM_RESET: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_REQUEST_STRUCTURE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000f, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_REQUEST_DATA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_PERFORMANCE_OFF: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_CONTROLLER_NUMBER: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0011, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const SMART_GET_VERSION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const SMART_SEND_DRIVE_COMMAND: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const SMART_RCV_DRIVE_DATA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_PARTITION_INFO_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0012, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_SET_PARTITION_INFO_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0013, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_DRIVE_LAYOUT_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0014, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_SET_DRIVE_LAYOUT_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0015, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_CREATE_DISK: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0016, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_LENGTH_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0028, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_REASSIGN_BLOCKS_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0029, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_UPDATE_DRIVE_SIZE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0032, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GROW_PARTITION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0034, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_CACHE_INFORMATION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0035, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_SET_CACHE_INFORMATION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0036, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_WRITE_CACHE_STATE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0037, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const OBSOLETE_DISK_GET_WRITE_CACHE_STATE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0037, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_DELETE_DRIVE_LAYOUT: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0040, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_UPDATE_PROPERTIES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0050, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_FORMAT_DRIVE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x00f3, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_SENSE_DEVICE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x00f8, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_CHECK_VERIFY: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_MEDIA_REMOVAL: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_EJECT_MEDIA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_LOAD_MEDIA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_RESERVE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_RELEASE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_FIND_NEW_DEVICES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0206, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_GET_MEDIA_TYPES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_GET_DISK_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x003c, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_SET_DISK_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x003d, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_RESET_SNAPSHOT_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0084, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +//3907 +pub const IOCTL_CHANGER_BASE: ::DWORD = FILE_DEVICE_CHANGER; +pub const IOCTL_CHANGER_GET_PARAMETERS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0000, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_GET_STATUS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0001, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_GET_PRODUCT_DATA: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0002, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_SET_ACCESS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0004, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_CHANGER_GET_ELEMENT_STATUS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0005, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0006, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_SET_POSITION: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0007, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_EXCHANGE_MEDIUM: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0008, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_MOVE_MEDIUM: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0009, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_REINITIALIZE_TRANSPORT: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x000A, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_QUERY_VOLUME_TAGS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x000B, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SERIAL_LSRMST_INSERT: ::DWORD = CTL_CODE!(FILE_DEVICE_SERIAL_PORT, 31, + METHOD_BUFFERED,FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_EXPOSE_HARDWARE: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 128, + METHOD_BUFFERED,FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_REMOVE_HARDWARE: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 129, + METHOD_BUFFERED,FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_PORT_DESC: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 130, + METHOD_BUFFERED,FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_GET_PORT_NAME: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 131, + METHOD_BUFFERED,FILE_ANY_ACCESS); +//4690 +pub const FSCTL_REQUEST_OPLOCK_LEVEL_1: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 0, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_OPLOCK_LEVEL_2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 1, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_BATCH_OPLOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 2, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OPLOCK_BREAK_ACKNOWLEDGE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 3, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OPBATCH_ACK_CLOSE_PENDING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 4, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OPLOCK_BREAK_NOTIFY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 5, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_LOCK_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_UNLOCK_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_DISMOUNT_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_IS_VOLUME_MOUNTED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 10, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_IS_PATHNAME_VALID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 11, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_MARK_VOLUME_DIRTY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 12, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_RETRIEVAL_POINTERS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 14, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_GET_COMPRESSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SET_COMPRESSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, + ::FILE_READ_DATA | ::FILE_WRITE_DATA); +pub const FSCTL_SET_BOOTLOADER_ACCESSED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 19, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_MARK_AS_SYSTEM_HIVE: ::DWORD = FSCTL_SET_BOOTLOADER_ACCESSED; +pub const FSCTL_OPLOCK_BREAK_ACK_NO_2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 20, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_INVALIDATE_VOLUMES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 21, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_FAT_BPB: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_FILTER_OPLOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 23, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_FILESYSTEM_GET_STATISTICS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 24, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_NTFS_VOLUME_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 25, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_NTFS_FILE_RECORD: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 26, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_VOLUME_BITMAP: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_GET_RETRIEVAL_POINTERS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 28, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_MOVE_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_IS_VOLUME_DIRTY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_ALLOW_EXTENDED_DASD_IO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 32, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_FIND_FILES_BY_SID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SET_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_GET_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_DELETE_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_REPARSE_POINT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 41, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_GET_REPARSE_POINT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 42, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DELETE_REPARSE_POINT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 43, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_ENUM_USN_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 44, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_SECURITY_ID_CHECK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, + ::FILE_READ_DATA); +pub const FSCTL_READ_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SET_OBJECT_ID_EXTENDED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 47, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_CREATE_OR_GET_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 48, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_SPARSE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_ZERO_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_QUERY_ALLOCATED_RANGES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 51, + METHOD_NEITHER, ::FILE_READ_DATA); +pub const FSCTL_ENABLE_UPGRADE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_SET_ENCRYPTION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_ENCRYPTION_FSCTL_IO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 54, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_WRITE_RAW_ENCRYPTED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 55, + METHOD_NEITHER, FILE_SPECIAL_ACCESS); +pub const FSCTL_READ_RAW_ENCRYPTED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 56, + METHOD_NEITHER, FILE_SPECIAL_ACCESS); +pub const FSCTL_CREATE_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 57, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_READ_FILE_USN_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 58, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_WRITE_USN_CLOSE_RECORD: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 59, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_EXTEND_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_QUERY_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 61, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DELETE_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 62, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_MARK_HANDLE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SIS_COPYFILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SIS_LINK_FILES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, + ::FILE_READ_DATA | ::FILE_WRITE_DATA); +pub const FSCTL_RECALL_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_READ_FROM_PLEX: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, + ::FILE_READ_DATA); +pub const FSCTL_FILE_PREFETCH: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_MAKE_MEDIA_COMPATIBLE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 76, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_SET_DEFECT_MANAGEMENT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 77, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_QUERY_SPARING_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 78, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_ON_DISK_VOLUME_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 79, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_VOLUME_COMPRESSION_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 80, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_TXFS_MODIFY_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 81, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_QUERY_RM_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 82, + METHOD_BUFFERED, ::FILE_READ_DATA); +pub const FSCTL_TXFS_ROLLFORWARD_REDO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 84, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_ROLLFORWARD_UNDO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 85, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_START_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 86, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_SHUTDOWN_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_READ_BACKUP_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 88, + METHOD_BUFFERED, ::FILE_READ_DATA); +pub const FSCTL_TXFS_WRITE_BACKUP_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 89, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_CREATE_SECONDARY_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 90, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_GET_METADATA_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 91, + METHOD_BUFFERED, ::FILE_READ_DATA); +pub const FSCTL_TXFS_GET_TRANSACTED_VERSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 92, + METHOD_BUFFERED, ::FILE_READ_DATA); +pub const FSCTL_TXFS_SAVEPOINT_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 94, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_CREATE_MINIVERSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 95, + METHOD_BUFFERED, ::FILE_WRITE_DATA); +pub const FSCTL_TXFS_TRANSACTION_ACTIVE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 99, + METHOD_BUFFERED, ::FILE_READ_DATA); +pub const FSCTL_SET_ZERO_ON_DEALLOCATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 101, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_GET_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_WAIT_FOR_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_INITIATE_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSC_INTERNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SHRINK_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_SHORT_NAME_BEHAVIOR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 109, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DFSR_SET_GHOST_HANDLE_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 110, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, + 120, METHOD_BUFFERED, ::FILE_READ_DATA); +pub const FSCTL_TXFS_LIST_TRANSACTIONS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 121, + METHOD_BUFFERED, ::FILE_READ_DATA); +pub const FSCTL_QUERY_PAGEFILE_ENCRYPTION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 122, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_RESET_VOLUME_ALLOCATION_HINTS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 123, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_DEPENDENT_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 124, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SD_GLOBAL_CHANGE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 125, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_TXFS_READ_BACKUP_INFORMATION2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 126, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_LOOKUP_STREAM_FROM_CLUSTER: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 127, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_TXFS_WRITE_BACKUP_INFORMATION2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 128, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_FILE_TYPE_NOTIFICATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 129, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_FILE_LEVEL_TRIM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 130, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_GET_BOOT_AREA_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 140, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_RETRIEVAL_POINTER_BASE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 141, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_PERSISTENT_VOLUME_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 142, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_PERSISTENT_VOLUME_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 143, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_OPLOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 144, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSV_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 145, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_IS_CSV_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_QUERY_FILE_SYSTEM_RECOGNITION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 147, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_GET_VOLUME_PATH_NAME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 148, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT: ::DWORD = CTL_CODE!( + FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME: ::DWORD = CTL_CODE!( + FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_IS_FILE_ON_CSV_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 151, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CORRUPTION_HANDLING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 152, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OFFLOAD_READ: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 153, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const FSCTL_OFFLOAD_WRITE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 154, METHOD_BUFFERED, + FILE_WRITE_ACCESS); +pub const FSCTL_CSV_INTERNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 155, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SET_PURGE_FAILURE_MODE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 156, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_FILE_LAYOUT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 157, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_IS_VOLUME_OWNED_BYCSVFS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 158, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_INTEGRITY_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 159, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_INTEGRITY_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 160, + METHOD_BUFFERED, ::FILE_READ_DATA | ::FILE_WRITE_DATA); +pub const FSCTL_QUERY_FILE_REGIONS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 161, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DEDUP_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 165, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_DEDUP_QUERY_FILE_HASHES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 166, + METHOD_NEITHER, ::FILE_READ_DATA); +pub const FSCTL_DEDUP_QUERY_RANGE_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 167, + METHOD_NEITHER, ::FILE_READ_DATA); +pub const FSCTL_DEDUP_QUERY_REPARSE_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 168, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_RKF_INTERNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 171, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SCRUB_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 172, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_REPAIR_COPIES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 173, METHOD_BUFFERED, + ::FILE_READ_DATA | ::FILE_WRITE_DATA); +pub const FSCTL_DISABLE_LOCAL_BUFFERING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 174, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_MGMT_LOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 175, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS: ::DWORD = CTL_CODE!( + FILE_DEVICE_FILE_SYSTEM, 176, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_ADVANCE_FILE_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 177, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSV_SYNC_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 178, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_QUERY_VETO_FILE_DIRECT_IO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 179, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_WRITE_USN_REASON: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 180, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_CONTROL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 181, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_GET_REFS_VOLUME_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 182, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_H_BREAKING_SYNC_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, + 185, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_STORAGE_CLASSES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 187, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_REGION_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 188, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_USN_TRACK_MODIFIED_RANGES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 189, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, + 192, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SVHDX_SYNC_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 193, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SVHDX_SET_INITIATOR_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 194, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 195, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_GET_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 196, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DELETE_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 197, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_ENUM_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 198, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_ENUM_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 199, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_ADD_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 204, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_REMOVE_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 205, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +pub const FSCTL_UPDATE_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 206, METHOD_BUFFERED, + ::FILE_WRITE_DATA); +// FILE_DEVICE_AVIO is defined nowhere +//pub const IOCTL_AVIO_ALLOCATE_STREAM: ::DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 1, METHOD_BUFFERED, +// FILE_SPECIAL_ACCESS); +//pub const IOCTL_AVIO_FREE_STREAM: ::DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 2, METHOD_BUFFERED, +// FILE_SPECIAL_ACCESS); +//pub const IOCTL_AVIO_MODIFY_STREAM: ::DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 3, METHOD_BUFFERED, +// FILE_SPECIAL_ACCESS); +STRUCT!{struct PATHNAME_BUFFER { + PathNameLength: ::DWORD, + Name: [::WCHAR; 1], +}} +pub type PPATHNAME_BUFFER = *mut PATHNAME_BUFFER; +STRUCT!{nodebug struct FSCTL_QUERY_FAT_BPB_BUFFER { + First0x24BytesOfBootSector: [::BYTE; 0x24], +}} +pub type PFSCTL_QUERY_FAT_BPB_BUFFER = *mut FSCTL_QUERY_FAT_BPB_BUFFER; +STRUCT!{struct NTFS_VOLUME_DATA_BUFFER { + VolumeSerialNumber: ::LARGE_INTEGER, + NumberSectors: ::LARGE_INTEGER, + TotalClusters: ::LARGE_INTEGER, + FreeClusters: ::LARGE_INTEGER, + TotalReserved: ::LARGE_INTEGER, + BytesPerSector: ::DWORD, + BytesPerCluster: ::DWORD, + BytesPerFileRecordSegment: ::DWORD, + ClustersPerFileRecordSegment: ::DWORD, + MftValidDataLength: ::LARGE_INTEGER, + MftStartLcn: ::LARGE_INTEGER, + Mft2StartLcn: ::LARGE_INTEGER, + MftZoneStart: ::LARGE_INTEGER, + MftZoneEnd: ::LARGE_INTEGER, +}} +pub type PNTFS_VOLUME_DATA_BUFFER = *mut NTFS_VOLUME_DATA_BUFFER; +STRUCT!{struct NTFS_EXTENDED_VOLUME_DATA { + ByteCount: ::DWORD, + MajorVersion: ::WORD, + MinorVersion: ::WORD, + BytesPerPhysicalSector: ::DWORD, + LfsMajorVersion: ::WORD, + LfsMinorVersion: ::WORD, +}} +pub type PNTFS_EXTENDED_VOLUME_DATA = *mut NTFS_EXTENDED_VOLUME_DATA; +STRUCT!{struct REFS_VOLUME_DATA_BUFFER { + ByteCount: ::DWORD, + MajorVersion: ::DWORD, + MinorVersion: ::DWORD, + BytesPerPhysicalSector: ::DWORD, + VolumeSerialNumber: ::LARGE_INTEGER, + NumberSectors: ::LARGE_INTEGER, + TotalClusters: ::LARGE_INTEGER, + FreeClusters: ::LARGE_INTEGER, + TotalReserved: ::LARGE_INTEGER, + BytesPerSector: ::DWORD, + BytesPerCluster: ::DWORD, + MaximumSizeOfResidentFile: ::LARGE_INTEGER, + Reserved: [::LARGE_INTEGER; 10], +}} +pub type PREFS_VOLUME_DATA_BUFFER = *mut REFS_VOLUME_DATA_BUFFER; +STRUCT!{struct STARTING_LCN_INPUT_BUFFER { + StartingLcn: ::LARGE_INTEGER, +}} +pub type PSTARTING_LCN_INPUT_BUFFER = *mut STARTING_LCN_INPUT_BUFFER; +STRUCT!{struct VOLUME_BITMAP_BUFFER { + StartingLcn: ::LARGE_INTEGER, + BitmapSize: ::LARGE_INTEGER, + Buffer: [::BYTE; 1], +}} +pub type PVOLUME_BITMAP_BUFFER = *mut VOLUME_BITMAP_BUFFER; +STRUCT!{struct STARTING_VCN_INPUT_BUFFER { + StartingVcn: ::LARGE_INTEGER, +}} +pub type PSTARTING_VCN_INPUT_BUFFER = *mut STARTING_VCN_INPUT_BUFFER; +STRUCT!{struct RETRIEVAL_POINTERS_BUFFER_INTERNAL { + NextVcn: ::LARGE_INTEGER, + Lcn: ::LARGE_INTEGER, +}} +STRUCT!{struct RETRIEVAL_POINTERS_BUFFER { + ExtentCount: ::DWORD, + StartingVcn: ::LARGE_INTEGER, + Extents: [RETRIEVAL_POINTERS_BUFFER_INTERNAL; 1], +}} +pub type PRETRIEVAL_POINTERS_BUFFER = *mut RETRIEVAL_POINTERS_BUFFER; +STRUCT!{struct NTFS_FILE_RECORD_INPUT_BUFFER { + FileReferenceNumber: ::LARGE_INTEGER, +}} +pub type PNTFS_FILE_RECORD_INPUT_BUFFER = *mut NTFS_FILE_RECORD_INPUT_BUFFER; +STRUCT!{struct NTFS_FILE_RECORD_OUTPUT_BUFFER { + FileReferenceNumber: ::LARGE_INTEGER, + FileRecordLength: ::DWORD, + FileRecordBuffer: [::BYTE; 1], +}} +pub type PNTFS_FILE_RECORD_OUTPUT_BUFFER = *mut NTFS_FILE_RECORD_OUTPUT_BUFFER; +STRUCT!{struct MOVE_FILE_DATA { + FileHandle: ::HANDLE, + StartingVcn: ::LARGE_INTEGER, + StartingLcn: ::LARGE_INTEGER, + ClusterCount: ::DWORD, +}} +pub type PMOVE_FILE_DATA = *mut MOVE_FILE_DATA; +STRUCT!{struct MOVE_FILE_RECORD_DATA { + FileHandle: ::HANDLE, + SourceFileRecord: ::LARGE_INTEGER, + TargetFileRecord: ::LARGE_INTEGER, +}} +pub type PMOVE_FILE_RECORD_DATA = *mut MOVE_FILE_RECORD_DATA; +//9207 +pub const IOCTL_VOLUME_BASE: ::DWORD = 0x00000056; +pub const IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 0, + METHOD_BUFFERED, FILE_ANY_ACCESS); +STRUCT!{struct DISK_EXTENT { + DiskNumber: ::DWORD, + StartingOffset: ::LARGE_INTEGER, + ExtentLength: ::LARGE_INTEGER, +}} +pub type PDISK_EXTENT = *mut DISK_EXTENT; +STRUCT!{struct VOLUME_DISK_EXTENTS { + NumberOfDiskExtents: ::DWORD, + Extents: [DISK_EXTENT; ::ANYSIZE_ARRAY], +}} +pub type PVOLUME_DISK_EXTENTS = *mut VOLUME_DISK_EXTENTS; +pub const IOCTL_VOLUME_ONLINE: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_VOLUME_OFFLINE: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_VOLUME_IS_CLUSTERED: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_VOLUME_GET_GPT_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 14, + METHOD_BUFFERED, FILE_ANY_ACCESS); diff --git a/third_party/rust/winapi/src/winnetwk.rs b/third_party/rust/winapi/src/winnetwk.rs new file mode 100644 index 000000000000..665d283ba807 --- /dev/null +++ b/third_party/rust/winapi/src/winnetwk.rs @@ -0,0 +1,275 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Standard WINNET Header File for WIN32 +pub const WNNC_NET_MSNET: ::DWORD = 0x00010000; +pub const WNNC_NET_SMB: ::DWORD = 0x00020000; +pub const WNNC_NET_NETWARE: ::DWORD = 0x00030000; +pub const WNNC_NET_VINES: ::DWORD = 0x00040000; +pub const WNNC_NET_10NET: ::DWORD = 0x00050000; +pub const WNNC_NET_LOCUS: ::DWORD = 0x00060000; +pub const WNNC_NET_SUN_PC_NFS: ::DWORD = 0x00070000; +pub const WNNC_NET_LANSTEP: ::DWORD = 0x00080000; +pub const WNNC_NET_9TILES: ::DWORD = 0x00090000; +pub const WNNC_NET_LANTASTIC: ::DWORD = 0x000A0000; +pub const WNNC_NET_AS400: ::DWORD = 0x000B0000; +pub const WNNC_NET_FTP_NFS: ::DWORD = 0x000C0000; +pub const WNNC_NET_PATHWORKS: ::DWORD = 0x000D0000; +pub const WNNC_NET_LIFENET: ::DWORD = 0x000E0000; +pub const WNNC_NET_POWERLAN: ::DWORD = 0x000F0000; +pub const WNNC_NET_BWNFS: ::DWORD = 0x00100000; +pub const WNNC_NET_COGENT: ::DWORD = 0x00110000; +pub const WNNC_NET_FARALLON: ::DWORD = 0x00120000; +pub const WNNC_NET_APPLETALK: ::DWORD = 0x00130000; +pub const WNNC_NET_INTERGRAPH: ::DWORD = 0x00140000; +pub const WNNC_NET_SYMFONET: ::DWORD = 0x00150000; +pub const WNNC_NET_CLEARCASE: ::DWORD = 0x00160000; +pub const WNNC_NET_FRONTIER: ::DWORD = 0x00170000; +pub const WNNC_NET_BMC: ::DWORD = 0x00180000; +pub const WNNC_NET_DCE: ::DWORD = 0x00190000; +pub const WNNC_NET_AVID: ::DWORD = 0x001A0000; +pub const WNNC_NET_DOCUSPACE: ::DWORD = 0x001B0000; +pub const WNNC_NET_MANGOSOFT: ::DWORD = 0x001C0000; +pub const WNNC_NET_SERNET: ::DWORD = 0x001D0000; +pub const WNNC_NET_RIVERFRONT1: ::DWORD = 0x001E0000; +pub const WNNC_NET_RIVERFRONT2: ::DWORD = 0x001F0000; +pub const WNNC_NET_DECORB: ::DWORD = 0x00200000; +pub const WNNC_NET_PROTSTOR: ::DWORD = 0x00210000; +pub const WNNC_NET_FJ_REDIR: ::DWORD = 0x00220000; +pub const WNNC_NET_DISTINCT: ::DWORD = 0x00230000; +pub const WNNC_NET_TWINS: ::DWORD = 0x00240000; +pub const WNNC_NET_RDR2SAMPLE: ::DWORD = 0x00250000; +pub const WNNC_NET_CSC: ::DWORD = 0x00260000; +pub const WNNC_NET_3IN1: ::DWORD = 0x00270000; +pub const WNNC_NET_EXTENDNET: ::DWORD = 0x00290000; +pub const WNNC_NET_STAC: ::DWORD = 0x002A0000; +pub const WNNC_NET_FOXBAT: ::DWORD = 0x002B0000; +pub const WNNC_NET_YAHOO: ::DWORD = 0x002C0000; +pub const WNNC_NET_EXIFS: ::DWORD = 0x002D0000; +pub const WNNC_NET_DAV: ::DWORD = 0x002E0000; +pub const WNNC_NET_KNOWARE: ::DWORD = 0x002F0000; +pub const WNNC_NET_OBJECT_DIRE: ::DWORD = 0x00300000; +pub const WNNC_NET_MASFAX: ::DWORD = 0x00310000; +pub const WNNC_NET_HOB_NFS: ::DWORD = 0x00320000; +pub const WNNC_NET_SHIVA: ::DWORD = 0x00330000; +pub const WNNC_NET_IBMAL: ::DWORD = 0x00340000; +pub const WNNC_NET_LOCK: ::DWORD = 0x00350000; +pub const WNNC_NET_TERMSRV: ::DWORD = 0x00360000; +pub const WNNC_NET_SRT: ::DWORD = 0x00370000; +pub const WNNC_NET_QUINCY: ::DWORD = 0x00380000; +pub const WNNC_NET_OPENAFS: ::DWORD = 0x00390000; +pub const WNNC_NET_AVID1: ::DWORD = 0x003A0000; +pub const WNNC_NET_DFS: ::DWORD = 0x003B0000; +pub const WNNC_NET_KWNP: ::DWORD = 0x003C0000; +pub const WNNC_NET_ZENWORKS: ::DWORD = 0x003D0000; +pub const WNNC_NET_DRIVEONWEB: ::DWORD = 0x003E0000; +pub const WNNC_NET_VMWARE: ::DWORD = 0x003F0000; +pub const WNNC_NET_RSFX: ::DWORD = 0x00400000; +pub const WNNC_NET_MFILES: ::DWORD = 0x00410000; +pub const WNNC_NET_MS_NFS: ::DWORD = 0x00420000; +pub const WNNC_NET_GOOGLE: ::DWORD = 0x00430000; +pub const WNNC_NET_NDFS: ::DWORD = 0x00440000; +pub const WNNC_NET_DOCUSHARE: ::DWORD = 0x00450000; +pub const WNNC_CRED_MANAGER: ::DWORD = 0xFFFF0000; +pub const WNNC_NET_LANMAN: ::DWORD = WNNC_NET_SMB; +pub const RESOURCE_CONNECTED: ::DWORD = 0x00000001; +pub const RESOURCE_GLOBALNET: ::DWORD = 0x00000002; +pub const RESOURCE_REMEMBERED: ::DWORD = 0x00000003; +pub const RESOURCE_RECENT: ::DWORD = 0x00000004; +pub const RESOURCE_CONTEXT: ::DWORD = 0x00000005; +pub const RESOURCETYPE_ANY: ::DWORD = 0x00000000; +pub const RESOURCETYPE_DISK: ::DWORD = 0x00000001; +pub const RESOURCETYPE_PRINT: ::DWORD = 0x00000002; +pub const RESOURCETYPE_RESERVED: ::DWORD = 0x00000008; +pub const RESOURCETYPE_UNKNOWN: ::DWORD = 0xFFFFFFFF; +pub const RESOURCEUSAGE_CONNECTABLE: ::DWORD = 0x00000001; +pub const RESOURCEUSAGE_CONTAINER: ::DWORD = 0x00000002; +pub const RESOURCEUSAGE_NOLOCALDEVICE: ::DWORD = 0x00000004; +pub const RESOURCEUSAGE_SIBLING: ::DWORD = 0x00000008; +pub const RESOURCEUSAGE_ATTACHED: ::DWORD = 0x00000010; +pub const RESOURCEUSAGE_ALL: ::DWORD = RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER + | RESOURCEUSAGE_ATTACHED; +pub const RESOURCEUSAGE_RESERVED: ::DWORD = 0x80000000; +pub const RESOURCEDISPLAYTYPE_GENERIC: ::DWORD = 0x00000000; +pub const RESOURCEDISPLAYTYPE_DOMAIN: ::DWORD = 0x00000001; +pub const RESOURCEDISPLAYTYPE_SERVER: ::DWORD = 0x00000002; +pub const RESOURCEDISPLAYTYPE_SHARE: ::DWORD = 0x00000003; +pub const RESOURCEDISPLAYTYPE_FILE: ::DWORD = 0x00000004; +pub const RESOURCEDISPLAYTYPE_GROUP: ::DWORD = 0x00000005; +pub const RESOURCEDISPLAYTYPE_NETWORK: ::DWORD = 0x00000006; +pub const RESOURCEDISPLAYTYPE_ROOT: ::DWORD = 0x00000007; +pub const RESOURCEDISPLAYTYPE_SHAREADMIN: ::DWORD = 0x00000008; +pub const RESOURCEDISPLAYTYPE_DIRECTORY: ::DWORD = 0x00000009; +pub const RESOURCEDISPLAYTYPE_TREE: ::DWORD = 0x0000000A; +pub const RESOURCEDISPLAYTYPE_NDSCONTAINER: ::DWORD = 0x0000000B; +STRUCT!{struct NETRESOURCEA { + dwScope: ::DWORD, + dwType: ::DWORD, + dwDisplayType: ::DWORD, + dwUsage: ::DWORD, + lpLocalName: ::LPSTR, + lpRemoteName: ::LPSTR, + lpComment: ::LPSTR, + lpProvider: ::LPSTR, +}} +pub type LPNETRESOURCEA = *mut NETRESOURCEA; +STRUCT!{struct NETRESOURCEW { + dwScope: ::DWORD, + dwType: ::DWORD, + dwDisplayType: ::DWORD, + dwUsage: ::DWORD, + lpLocalName: ::LPWSTR, + lpRemoteName: ::LPWSTR, + lpComment: ::LPWSTR, + lpProvider: ::LPWSTR, +}} +pub type LPNETRESOURCEW = *mut NETRESOURCEW; +pub const NETPROPERTY_PERSISTENT: ::DWORD = 1; +pub const CONNECT_UPDATE_PROFILE: ::DWORD = 0x00000001; +pub const CONNECT_UPDATE_RECENT: ::DWORD = 0x00000002; +pub const CONNECT_TEMPORARY: ::DWORD = 0x00000004; +pub const CONNECT_INTERACTIVE: ::DWORD = 0x00000008; +pub const CONNECT_PROMPT: ::DWORD = 0x00000010; +pub const CONNECT_NEED_DRIVE: ::DWORD = 0x00000020; +pub const CONNECT_REFCOUNT: ::DWORD = 0x00000040; +pub const CONNECT_REDIRECT: ::DWORD = 0x00000080; +pub const CONNECT_LOCALDRIVE: ::DWORD = 0x00000100; +pub const CONNECT_CURRENT_MEDIA: ::DWORD = 0x00000200; +pub const CONNECT_DEFERRED: ::DWORD = 0x00000400; +pub const CONNECT_RESERVED: ::DWORD = 0xFF000000; +pub const CONNECT_COMMANDLINE: ::DWORD = 0x00000800; +pub const CONNECT_CMD_SAVECRED: ::DWORD = 0x00001000; +pub const CONNECT_CRED_RESET: ::DWORD = 0x00002000; +STRUCT!{struct CONNECTDLGSTRUCTA { + cbStructure: ::DWORD, + hwndOwner: ::HWND, + lpConnRes: ::LPNETRESOURCEA, + dwFlags: ::DWORD, + dwDevNum: ::DWORD, +}} +pub type LPCONNECTDLGSTRUCTA = *mut CONNECTDLGSTRUCTA; +STRUCT!{struct CONNECTDLGSTRUCTW { + cbStructure: ::DWORD, + hwndOwner: ::HWND, + lpConnRes: ::LPNETRESOURCEW, + dwFlags: ::DWORD, + dwDevNum: ::DWORD, +}} +pub type LPCONNECTDLGSTRUCTW = *mut CONNECTDLGSTRUCTW; +pub const CONNDLG_RO_PATH: ::DWORD = 0x00000001; +pub const CONNDLG_CONN_POINT: ::DWORD = 0x00000002; +pub const CONNDLG_USE_MRU: ::DWORD = 0x00000004; +pub const CONNDLG_HIDE_BOX: ::DWORD = 0x00000008; +pub const CONNDLG_PERSIST: ::DWORD = 0x00000010; +pub const CONNDLG_NOT_PERSIST: ::DWORD = 0x00000020; +STRUCT!{struct DISCDLGSTRUCTA { + cbStructure: ::DWORD, + hwndOwner: ::HWND, + lpLocalName: ::LPSTR, + lpRemoteName: ::LPSTR, + dwFlags: ::DWORD, +}} +pub type LPDISCDLGSTRUCTA = *mut DISCDLGSTRUCTA; +STRUCT!{struct DISCDLGSTRUCTW { + cbStructure: ::DWORD, + hwndOwner: ::HWND, + lpLocalName: ::LPWSTR, + lpRemoteName: ::LPWSTR, + dwFlags: ::DWORD, +}} +pub type LPDISCDLGSTRUCTW = *mut DISCDLGSTRUCTW; +pub const DISC_UPDATE_PROFILE: ::DWORD = 0x00000001; +pub const DISC_NO_FORCE: ::DWORD = 0x00000040; +pub const UNIVERSAL_NAME_INFO_LEVEL: ::DWORD = 0x00000001; +pub const REMOTE_NAME_INFO_LEVEL: ::DWORD = 0x00000002; +STRUCT!{struct UNIVERSAL_NAME_INFOA { + lpUniversalName: ::LPSTR, +}} +pub type LPUNIVERSAL_NAME_INFOA = *mut UNIVERSAL_NAME_INFOA; +STRUCT!{struct UNIVERSAL_NAME_INFOW { + lpUniversalName: ::LPWSTR, +}} +pub type LPUNIVERSAL_NAME_INFOW = *mut UNIVERSAL_NAME_INFOW; +STRUCT!{struct REMOTE_NAME_INFOA { + lpUniversalName: ::LPSTR, + lpConnectionName: ::LPSTR, + lpRemainingPath: ::LPSTR, +}} +pub type LPREMOTE_NAME_INFOA = *mut REMOTE_NAME_INFOA; +STRUCT!{struct REMOTE_NAME_INFOW { + lpUniversalName: ::LPWSTR, + lpConnectionName: ::LPWSTR, + lpRemainingPath: ::LPWSTR, +}} +pub type LPREMOTE_NAME_INFOW = *mut REMOTE_NAME_INFOW; +pub const WNFMT_MULTILINE: ::DWORD = 0x01; +pub const WNFMT_ABBREVIATED: ::DWORD = 0x02; +pub const WNFMT_INENUM: ::DWORD = 0x10; +pub const WNFMT_CONNECTION: ::DWORD = 0x20; +STRUCT!{struct NETINFOSTRUCT { + cbStructure: ::DWORD, + dwProviderVersion: ::DWORD, + dwStatus: ::DWORD, + dwCharacteristics: ::DWORD, + dwHandle: ::ULONG_PTR, + wNetType: ::WORD, + dwPrinters: ::DWORD, + dwDrives: ::DWORD, +}} +pub type LPNETINFOSTRUCT = *mut NETINFOSTRUCT; +pub const NETINFO_DLL16: ::DWORD = 0x00000001; +pub const NETINFO_DISKRED: ::DWORD = 0x00000004; +pub const NETINFO_PRINTERRED: ::DWORD = 0x00000008; +pub const WN_SUCCESS: ::DWORD = ::NO_ERROR; +pub const WN_NO_ERROR: ::DWORD = ::NO_ERROR; +pub const WN_NOT_SUPPORTED: ::DWORD = ::ERROR_NOT_SUPPORTED; +pub const WN_CANCEL: ::DWORD = ::ERROR_CANCELLED; +pub const WN_RETRY: ::DWORD = ::ERROR_RETRY; +pub const WN_NET_ERROR: ::DWORD = ::ERROR_UNEXP_NET_ERR; +pub const WN_MORE_DATA: ::DWORD = ::ERROR_MORE_DATA; +pub const WN_BAD_POINTER: ::DWORD = ::ERROR_INVALID_ADDRESS; +pub const WN_BAD_VALUE: ::DWORD = ::ERROR_INVALID_PARAMETER; +pub const WN_BAD_USER: ::DWORD = ::ERROR_BAD_USERNAME; +pub const WN_BAD_PASSWORD: ::DWORD = ::ERROR_INVALID_PASSWORD; +pub const WN_ACCESS_DENIED: ::DWORD = ::ERROR_ACCESS_DENIED; +pub const WN_FUNCTION_BUSY: ::DWORD = ::ERROR_BUSY; +pub const WN_WINDOWS_ERROR: ::DWORD = ::ERROR_UNEXP_NET_ERR; +pub const WN_OUT_OF_MEMORY: ::DWORD = ::ERROR_NOT_ENOUGH_MEMORY; +pub const WN_NO_NETWORK: ::DWORD = ::ERROR_NO_NETWORK; +pub const WN_EXTENDED_ERROR: ::DWORD = ::ERROR_EXTENDED_ERROR; +pub const WN_BAD_LEVEL: ::DWORD = ::ERROR_INVALID_LEVEL; +pub const WN_BAD_HANDLE: ::DWORD = ::ERROR_INVALID_HANDLE; +pub const WN_NOT_INITIALIZING: ::DWORD = ::ERROR_ALREADY_INITIALIZED; +pub const WN_NO_MORE_DEVICES: ::DWORD = ::ERROR_NO_MORE_DEVICES; +pub const WN_NOT_CONNECTED: ::DWORD = ::ERROR_NOT_CONNECTED; +pub const WN_OPEN_FILES: ::DWORD = ::ERROR_OPEN_FILES; +pub const WN_DEVICE_IN_USE: ::DWORD = ::ERROR_DEVICE_IN_USE; +pub const WN_BAD_NETNAME: ::DWORD = ::ERROR_BAD_NET_NAME; +pub const WN_BAD_LOCALNAME: ::DWORD = ::ERROR_BAD_DEVICE; +pub const WN_ALREADY_CONNECTED: ::DWORD = ::ERROR_ALREADY_ASSIGNED; +pub const WN_DEVICE_ERROR: ::DWORD = ::ERROR_GEN_FAILURE; +pub const WN_CONNECTION_CLOSED: ::DWORD = ::ERROR_CONNECTION_UNAVAIL; +pub const WN_NO_NET_OR_BAD_PATH: ::DWORD = ::ERROR_NO_NET_OR_BAD_PATH; +pub const WN_BAD_PROVIDER: ::DWORD = ::ERROR_BAD_PROVIDER; +pub const WN_CANNOT_OPEN_PROFILE: ::DWORD = ::ERROR_CANNOT_OPEN_PROFILE; +pub const WN_BAD_PROFILE: ::DWORD = ::ERROR_BAD_PROFILE; +pub const WN_BAD_DEV_TYPE: ::DWORD = ::ERROR_BAD_DEV_TYPE; +pub const WN_DEVICE_ALREADY_REMEMBERED: ::DWORD = ::ERROR_DEVICE_ALREADY_REMEMBERED; +pub const WN_CONNECTED_OTHER_PASSWORD: ::DWORD = ::ERROR_CONNECTED_OTHER_PASSWORD; +pub const WN_CONNECTED_OTHER_PASSWORD_DEFAULT: ::DWORD = ::ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT; +pub const WN_NO_MORE_ENTRIES: ::DWORD = ::ERROR_NO_MORE_ITEMS; +pub const WN_NOT_CONTAINER: ::DWORD = ::ERROR_NOT_CONTAINER; +pub const WN_NOT_AUTHENTICATED: ::DWORD = ::ERROR_NOT_AUTHENTICATED; +pub const WN_NOT_LOGGED_ON: ::DWORD = ::ERROR_NOT_LOGGED_ON; +pub const WN_NOT_VALIDATED: ::DWORD = ::ERROR_NO_LOGON_SERVERS; +STRUCT!{struct NETCONNECTINFOSTRUCT { + cbStructure: ::DWORD, + dwFlags: ::DWORD, + dwSpeed: ::DWORD, + dwDelay: ::DWORD, + dwOptDataSize: ::DWORD, +}} +pub type LPNETCONNECTINFOSTRUCT = *mut NETCONNECTINFOSTRUCT; +pub const WNCON_FORNETCARD: ::DWORD = 0x00000001; +pub const WNCON_NOTROUTED: ::DWORD = 0x00000002; +pub const WNCON_SLOWLINK: ::DWORD = 0x00000004; +pub const WNCON_DYNAMIC: ::DWORD = 0x00000008; diff --git a/third_party/rust/winapi/src/winnls.rs b/third_party/rust/winapi/src/winnls.rs new file mode 100644 index 000000000000..b27e2f0ae808 --- /dev/null +++ b/third_party/rust/winapi/src/winnls.rs @@ -0,0 +1,164 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Procedure declarations, constant definitions, and macros for the NLS component. +pub const CP_ACP: ::DWORD = 0; +pub const CP_OEMCP: ::DWORD = 1; +pub const CP_MACCP: ::DWORD = 2; +pub const CP_THREAD_ACP: ::DWORD = 3; +pub const CP_SYMBOL: ::DWORD = 42; +pub const CP_UTF7: ::DWORD = 65000; +pub const CP_UTF8: ::DWORD = 65001; +pub const MAX_LEADBYTES: usize = 12; +pub const MAX_DEFAULTCHAR: usize = 2; +pub type LGRPID = ::DWORD; +pub type LCTYPE = ::DWORD; +pub type CALTYPE = ::DWORD; +pub type CALID = ::DWORD; +pub type GEOID = ::LONG; +pub type GEOTYPE = ::DWORD; +pub type GEOCLASS = ::DWORD; +STRUCT!{struct NLSVERSIONINFO { + dwNLSVersionInfoSize: ::DWORD, + dwNLSVersion: ::DWORD, + dwDefinedVersion: ::DWORD, + dwEffectiveId: ::DWORD, + guidCustomVersion: ::GUID, +}} +pub type LPNLSVERSIONINFO = *mut NLSVERSIONINFO; +STRUCT!{struct NLSVERSIONINFOEX { + dwNLSVersionInfoSize: ::DWORD, + dwNLSVersion: ::DWORD, + dwDefinedVersion: ::DWORD, + dwEffectiveId: ::DWORD, + guidCustomVersion: ::GUID, +}} +pub type LPNLSVERSIONINFOEX = *mut NLSVERSIONINFOEX; +ENUM!{enum NORM_FORM { + NormalizationOther = 0, + NormalizationC = 0x1, + NormalizationD = 0x2, + NormalizationKC = 0x5, + NormalizationKD = 0x6, +}} +pub type LANGUAGEGROUP_ENUMPROCA = Option ::BOOL>; +pub type LANGGROUPLOCALE_ENUMPROCA = Option ::BOOL>; +pub type UILANGUAGE_ENUMPROCA = Option ::BOOL>; +pub type CODEPAGE_ENUMPROCA = Option ::BOOL>; +pub type DATEFMT_ENUMPROCA = Option ::BOOL>; +pub type DATEFMT_ENUMPROCEXA = Option ::BOOL>; +pub type TIMEFMT_ENUMPROCA = Option ::BOOL>; +pub type CALINFO_ENUMPROCA = Option ::BOOL>; +pub type CALINFO_ENUMPROCEXA = Option ::BOOL>; +pub type LOCALE_ENUMPROCA = Option ::BOOL>; +pub type LOCALE_ENUMPROCW = Option ::BOOL>; +pub type LANGUAGEGROUP_ENUMPROCW = Option ::BOOL>; +pub type LANGGROUPLOCALE_ENUMPROCW = Option ::BOOL>; +pub type UILANGUAGE_ENUMPROCW = Option ::BOOL>; +pub type CODEPAGE_ENUMPROCW = Option ::BOOL>; +pub type DATEFMT_ENUMPROCW = Option ::BOOL>; +pub type DATEFMT_ENUMPROCEXW = Option ::BOOL>; +pub type TIMEFMT_ENUMPROCW = Option ::BOOL>; +pub type CALINFO_ENUMPROCW = Option ::BOOL>; +pub type CALINFO_ENUMPROCEXW = Option ::BOOL>; +pub type GEO_ENUMPROC = Option ::BOOL>; +STRUCT!{struct CPINFO { + MaxCharSize: ::UINT, + DefaultChar: [::BYTE; MAX_DEFAULTCHAR], + LeadByte: [::BYTE; MAX_LEADBYTES], +}} +pub type LPCPINFO = *mut CPINFO; +STRUCT!{nodebug struct CPINFOEXA { + MaxCharSize: ::UINT, + DefaultChar: [::BYTE; MAX_DEFAULTCHAR], + LeadByte: [::BYTE; MAX_LEADBYTES], + UnicodeDefaultChar: ::WCHAR, + CodePage: ::UINT, + CodePageName: [::CHAR; ::MAX_PATH], +}} +pub type LPCPINFOEXA = *mut CPINFOEXA; +STRUCT!{nodebug struct CPINFOEXW { + MaxCharSize: ::UINT, + DefaultChar: [::BYTE; MAX_DEFAULTCHAR], + LeadByte: [::BYTE; MAX_LEADBYTES], + UnicodeDefaultChar: ::WCHAR, + CodePage: ::UINT, + CodePageName: [::WCHAR; ::MAX_PATH], +}} +pub type LPCPINFOEXW = *mut CPINFOEXW; +STRUCT!{struct NUMBERFMTA { + NumDigits: ::UINT, + LeadingZero: ::UINT, + Grouping: ::UINT, + lpDecimalSep: ::LPSTR, + lpThousandSep: ::LPSTR, + NegativeOrder: ::UINT, +}} +pub type LPNUMBERFMTA = *mut NUMBERFMTA; +STRUCT!{struct NUMBERFMTW { + NumDigits: ::UINT, + LeadingZero: ::UINT, + Grouping: ::UINT, + lpDecimalSep: ::LPWSTR, + lpThousandSep: ::LPWSTR, + NegativeOrder: ::UINT, +}} +pub type LPNUMBERFMTW = *mut NUMBERFMTW; +STRUCT!{struct CURRENCYFMTA { + NumDigits: ::UINT, + LeadingZero: ::UINT, + Grouping: ::UINT, + lpDecimalSep: ::LPSTR, + lpThousandSep: ::LPSTR, + NegativeOrder: ::UINT, + PositiveOrder: ::UINT, + lpCurrencySymbol: ::LPSTR, +}} +pub type LPCURRENCYFMTA = *mut CURRENCYFMTA; +STRUCT!{struct CURRENCYFMTW { + NumDigits: ::UINT, + LeadingZero: ::UINT, + Grouping: ::UINT, + lpDecimalSep: ::LPWSTR, + lpThousandSep: ::LPWSTR, + NegativeOrder: ::UINT, + PositiveOrder: ::UINT, + lpCurrencySymbol: ::LPWSTR, +}} +pub type LPCURRENCYFMTW = *mut CURRENCYFMTW; +pub type NLS_FUNCTION = ::DWORD; +STRUCT!{struct FILEMUIINFO { + dwSize: ::DWORD, + dwVersion: ::DWORD, + dwFileType: ::DWORD, + pChecksum: [::BYTE; 16], + pServiceChecksum: [::BYTE; 16], + dwLanguageNameOffset: ::DWORD, + dwTypeIDMainSize: ::DWORD, + dwTypeIDMainOffset: ::DWORD, + dwTypeNameMainOffset: ::DWORD, + dwTypeIDMUISize: ::DWORD, + dwTypeIDMUIOffset: ::DWORD, + dwTypeNameMUIOffset: ::DWORD, + abBuffer: [::BYTE; 8], +}} +pub type PFILEMUIINFO = *mut FILEMUIINFO; +pub type CALINFO_ENUMPROCEXEX = Option ::BOOL>; +pub type DATEFMT_ENUMPROCEXEX = Option ::BOOL>; +pub type TIMEFMT_ENUMPROCEX = Option ::BOOL>; +pub type LOCALE_ENUMPROCEX = Option ::BOOL>; diff --git a/third_party/rust/winapi/src/winnt.rs b/third_party/rust/winapi/src/winnt.rs new file mode 100644 index 000000000000..cce242e9b75d --- /dev/null +++ b/third_party/rust/winapi/src/winnt.rs @@ -0,0 +1,2368 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This module defines the 32-Bit Windows types and constants that are defined by NT, but exposed +//! through the Win32 API. +pub const ANYSIZE_ARRAY: usize = 1; +//341 +pub type PVOID = *mut ::c_void; +pub type PVOID64 = u64; // This is a 64-bit pointer, even when in 32-bit +//382 +pub type VOID = ::c_void; +pub type CHAR = ::c_char; +pub type SHORT = ::c_short; +pub type LONG = ::c_long; +// pub type INT = ::c_int; // Already defined by minwindef.h +pub type WCHAR = ::wchar_t; +pub type PWCHAR = *mut WCHAR; +pub type LPWCH = *mut WCHAR; +pub type PWCH = *mut WCHAR; +pub type LPCWCH = *const WCHAR; +pub type PCWCH = *const WCHAR; +pub type NWPSTR = *mut WCHAR; +pub type LPWSTR = *mut WCHAR; +pub type PWSTR = *mut WCHAR; +pub type PZPWSTR = *mut PWSTR; +pub type PCZPWSTR = *const PWSTR; +pub type LPUWSTR = *mut WCHAR; +pub type PUWSTR = *mut WCHAR; +pub type LPCWSTR = *const WCHAR; +pub type PCWSTR = *const WCHAR; +pub type PZPCWSTR= *mut PCWSTR; +pub type PCZPCWSTR = *const PCWSTR; +pub type LPCUWSTR = *const WCHAR; +pub type PCUWSTR = *const WCHAR; +pub type PZZWSTR= *mut WCHAR; +pub type PCZZWSTR = *const WCHAR; +pub type PUZZWSTR = *mut WCHAR; +pub type PCUZZWSTR = *const WCHAR; +pub type PNZWCH = *mut WCHAR; +pub type PCNZWCH = *const WCHAR; +pub type PUNZWCH = *mut WCHAR; +pub type PCUNZWCH = *const WCHAR; +pub type LPCWCHAR = *const WCHAR; +pub type PCWCHAR = *const WCHAR; +pub type LPCUWCHAR = *const WCHAR; +pub type PCUWCHAR = *const WCHAR; +pub type UCSCHAR = ::c_ulong; +pub type PUCSCHAR = *mut UCSCHAR; +pub type PCUCSCHAR = *const UCSCHAR; +pub type PUCSSTR = *mut UCSCHAR; +pub type PUUCSSTR = *mut UCSCHAR; +pub type PCUCSSTR = *const UCSCHAR; +pub type PCUUCSSTR = *const UCSCHAR; +pub type PUUCSCHAR = *mut UCSCHAR; +pub type PCUUCSCHAR = *const UCSCHAR; +pub type PCHAR = *mut CHAR; +pub type LPCH = *mut CHAR; +pub type PCH = *mut CHAR; +pub type LPCCH = *const CHAR; +pub type PCCH = *const CHAR; +pub type NPSTR = *mut CHAR; +pub type LPSTR = *mut CHAR; +pub type PSTR = *mut CHAR; +pub type PZPSTR = *mut PSTR; +pub type PCZPSTR = *const PSTR; +pub type LPCSTR = *const CHAR; +pub type PCSTR = *const CHAR; +pub type PZPCSTR = *mut PCSTR; +pub type PCZPCSTR = *const PCSTR; +pub type PZZSTR = *mut CHAR; +pub type PCZZSTR = *const CHAR; +pub type PNZCH = *mut CHAR; +pub type PCNZCH = *const CHAR; +// Skipping TCHAR things +pub type PSHORT = *mut SHORT; +pub type PLONG = *mut LONG; +STRUCT!{struct PROCESSOR_NUMBER { + Group: ::WORD, + Number: ::BYTE, + Reserved: ::BYTE, +}} +pub type PPROCESSOR_NUMBER = *mut PROCESSOR_NUMBER; +STRUCT!{struct GROUP_AFFINITY { + Mask: ::KAFFINITY, + Group: ::WORD, + Reserved: [::WORD; 3], +}} +pub type PGROUP_AFFINITY = *mut GROUP_AFFINITY; +pub type HANDLE = *mut ::c_void; +pub type PHANDLE = *mut HANDLE; +pub type FCHAR = ::BYTE; +pub type FSHORT = ::WORD; +pub type FLONG = ::DWORD; +//667 +pub type CCHAR = ::c_char; +pub type LCID = ::DWORD; +pub type PLCID = ::PDWORD; +pub type LANGID = ::WORD; +ENUM!{enum COMPARTMENT_ID { + UNSPECIFIED_COMPARTMENT_ID = 0, + DEFAULT_COMPARTMENT_ID = 1, +}} +pub type PCOMPARTMENT_ID = *mut COMPARTMENT_ID; +pub const APPLICATION_ERROR_MASK: ::DWORD = 0x20000000; +pub const ERROR_SEVERITY_SUCCESS: ::DWORD = 0x00000000; +pub const ERROR_SEVERITY_INFORMATIONAL: ::DWORD = 0x40000000; +pub const ERROR_SEVERITY_WARNING: ::DWORD = 0x80000000; +pub const ERROR_SEVERITY_ERROR: ::DWORD = 0xC0000000; +//710 +STRUCT!{struct FLOAT128 { + LowPart: ::__int64, + HighPart: ::__int64, +}} +pub type PFLOAT128 = *mut FLOAT128; +pub type LONGLONG = ::__int64; +pub type ULONGLONG = ::__uint64; +pub type PLONGLONG = *mut LONGLONG; +pub type PULONGLONG = *mut ULONGLONG; +pub type USN = LONGLONG; +pub type LARGE_INTEGER = LONGLONG; +pub type PLARGE_INTEGER = *mut LARGE_INTEGER; +pub type ULARGE_INTEGER = ULONGLONG; +pub type PULARGE_INTEGER= *mut ULARGE_INTEGER; +pub type RTL_REFERENCE_COUNT = ::LONG_PTR; +pub type PRTL_REFERENCE_COUNT = *mut ::LONG_PTR; +STRUCT!{struct LUID { + LowPart: ::DWORD, + HighPart: LONG, +}} +pub type PLUID = *mut LUID; +pub type DWORDLONG = ULONGLONG; +pub type PDWORDLONG = *mut DWORDLONG; +//1042 +pub type BOOLEAN = ::BYTE; +pub type PBOOLEAN = *mut BOOLEAN; +STRUCT!{struct LIST_ENTRY { + Flink: *mut LIST_ENTRY, + Blink: *mut LIST_ENTRY, +}} +pub type PLIST_ENTRY = *mut LIST_ENTRY; +STRUCT!{struct SINGLE_LIST_ENTRY { + Next: *mut SINGLE_LIST_ENTRY, +}} +pub type PSINGLE_LIST_ENTRY = *mut SINGLE_LIST_ENTRY; +STRUCT!{struct LIST_ENTRY32 { + Flink: ::DWORD, + Blink: ::DWORD, +}} +pub type PLIST_ENTRY32 = *mut LIST_ENTRY32; +STRUCT!{struct LIST_ENTRY64 { + Flink: ULONGLONG, + Blink: ULONGLONG, +}} +pub type PLIST_ENTRY64 = *mut LIST_ENTRY64; +STRUCT!{struct OBJECTID { + Lineage: ::GUID, + Uniquifier: ::DWORD, +}} +pub const MINCHAR: ::CHAR = 0x80u8 as ::CHAR; +pub const MAXCHAR: ::CHAR = 0x7f; +pub const MINSHORT: ::SHORT = 0x8000u16 as ::SHORT; +pub const MAXSHORT: ::SHORT = 0x7fff; +pub const MINLONG: ::LONG = 0x80000000u32 as ::LONG; +pub const MAXLONG: ::LONG = 0x7fffffff; +pub const MAXBYTE: ::BYTE = 0xff; +pub const MAXWORD: ::WORD = 0xffff; +pub const MAXDWORD: ::DWORD = 0xffffffff; +//1300 +pub type PEXCEPTION_ROUTINE = Option ::EXCEPTION_DISPOSITION>; +//1498 +pub const LANG_NEUTRAL: ::WORD = 0x00; +pub const LANG_INVARIANT: ::WORD = 0x7f; +pub const LANG_AFRIKAANS: ::WORD = 0x36; +pub const LANG_ALBANIAN: ::WORD = 0x1c; +pub const LANG_ALSATIAN: ::WORD = 0x84; +pub const LANG_AMHARIC: ::WORD = 0x5e; +pub const LANG_ARABIC: ::WORD = 0x01; +pub const LANG_ARMENIAN: ::WORD = 0x2b; +pub const LANG_ASSAMESE: ::WORD = 0x4d; +pub const LANG_AZERI: ::WORD = 0x2c; +pub const LANG_AZERBAIJANI: ::WORD = 0x2c; +pub const LANG_BANGLA: ::WORD = 0x45; +pub const LANG_BASHKIR: ::WORD = 0x6d; +pub const LANG_BASQUE: ::WORD = 0x2d; +pub const LANG_BELARUSIAN: ::WORD = 0x23; +pub const LANG_BENGALI: ::WORD = 0x45; +pub const LANG_BRETON: ::WORD = 0x7e; +pub const LANG_BOSNIAN: ::WORD = 0x1a; +pub const LANG_BOSNIAN_NEUTRAL: ::WORD = 0x781a; +pub const LANG_BULGARIAN: ::WORD = 0x02; +pub const LANG_CATALAN: ::WORD = 0x03; +pub const LANG_CENTRAL_KURDISH: ::WORD = 0x92; +pub const LANG_CHEROKEE: ::WORD = 0x5c; +pub const LANG_CHINESE: ::WORD = 0x04; +pub const LANG_CHINESE_SIMPLIFIED: ::WORD = 0x04; +pub const LANG_CHINESE_TRADITIONAL: ::WORD = 0x7c04; +pub const LANG_CORSICAN: ::WORD = 0x83; +pub const LANG_CROATIAN: ::WORD = 0x1a; +pub const LANG_CZECH: ::WORD = 0x05; +pub const LANG_DANISH: ::WORD = 0x06; +pub const LANG_DARI: ::WORD = 0x8c; +pub const LANG_DIVEHI: ::WORD = 0x65; +pub const LANG_DUTCH: ::WORD = 0x13; +pub const LANG_ENGLISH: ::WORD = 0x09; +pub const LANG_ESTONIAN: ::WORD = 0x25; +pub const LANG_FAEROESE: ::WORD = 0x38; +pub const LANG_FARSI: ::WORD = 0x29; +pub const LANG_FILIPINO: ::WORD = 0x64; +pub const LANG_FINNISH: ::WORD = 0x0b; +pub const LANG_FRENCH: ::WORD = 0x0c; +pub const LANG_FRISIAN: ::WORD = 0x62; +pub const LANG_FULAH: ::WORD = 0x67; +pub const LANG_GALICIAN: ::WORD = 0x56; +pub const LANG_GEORGIAN: ::WORD = 0x37; +pub const LANG_GERMAN: ::WORD = 0x07; +pub const LANG_GREEK: ::WORD = 0x08; +pub const LANG_GREENLANDIC: ::WORD = 0x6f; +pub const LANG_GUJARATI: ::WORD = 0x47; +pub const LANG_HAUSA: ::WORD = 0x68; +pub const LANG_HAWAIIAN: ::WORD = 0x75; +pub const LANG_HEBREW: ::WORD = 0x0d; +pub const LANG_HINDI: ::WORD = 0x39; +pub const LANG_HUNGARIAN: ::WORD = 0x0e; +pub const LANG_ICELANDIC: ::WORD = 0x0f; +pub const LANG_IGBO: ::WORD = 0x70; +pub const LANG_INDONESIAN: ::WORD = 0x21; +pub const LANG_INUKTITUT: ::WORD = 0x5d; +pub const LANG_IRISH: ::WORD = 0x3c; +pub const LANG_ITALIAN: ::WORD = 0x10; +pub const LANG_JAPANESE: ::WORD = 0x11; +pub const LANG_KANNADA: ::WORD = 0x4b; +pub const LANG_KASHMIRI: ::WORD = 0x60; +pub const LANG_KAZAK: ::WORD = 0x3f; +pub const LANG_KHMER: ::WORD = 0x53; +pub const LANG_KICHE: ::WORD = 0x86; +pub const LANG_KINYARWANDA: ::WORD = 0x87; +pub const LANG_KONKANI: ::WORD = 0x57; +pub const LANG_KOREAN: ::WORD = 0x12; +pub const LANG_KYRGYZ: ::WORD = 0x40; +pub const LANG_LAO: ::WORD = 0x54; +pub const LANG_LATVIAN: ::WORD = 0x26; +pub const LANG_LITHUANIAN: ::WORD = 0x27; +pub const LANG_LOWER_SORBIAN: ::WORD = 0x2e; +pub const LANG_LUXEMBOURGISH: ::WORD = 0x6e; +pub const LANG_MACEDONIAN: ::WORD = 0x2f; +pub const LANG_MALAY: ::WORD = 0x3e; +pub const LANG_MALAYALAM: ::WORD = 0x4c; +pub const LANG_MALTESE: ::WORD = 0x3a; +pub const LANG_MANIPURI: ::WORD = 0x58; +pub const LANG_MAORI: ::WORD = 0x81; +pub const LANG_MAPUDUNGUN: ::WORD = 0x7a; +pub const LANG_MARATHI: ::WORD = 0x4e; +pub const LANG_MOHAWK: ::WORD = 0x7c; +pub const LANG_MONGOLIAN: ::WORD = 0x50; +pub const LANG_NEPALI: ::WORD = 0x61; +pub const LANG_NORWEGIAN: ::WORD = 0x14; +pub const LANG_OCCITAN: ::WORD = 0x82; +pub const LANG_ODIA: ::WORD = 0x48; +pub const LANG_ORIYA: ::WORD = 0x48; +pub const LANG_PASHTO: ::WORD = 0x63; +pub const LANG_PERSIAN: ::WORD = 0x29; +pub const LANG_POLISH: ::WORD = 0x15; +pub const LANG_PORTUGUESE: ::WORD = 0x16; +pub const LANG_PULAR: ::WORD = 0x67; +pub const LANG_PUNJABI: ::WORD = 0x46; +pub const LANG_QUECHUA: ::WORD = 0x6b; +pub const LANG_ROMANIAN: ::WORD = 0x18; +pub const LANG_ROMANSH: ::WORD = 0x17; +pub const LANG_RUSSIAN: ::WORD = 0x19; +pub const LANG_SAKHA: ::WORD = 0x85; +pub const LANG_SAMI: ::WORD = 0x3b; +pub const LANG_SANSKRIT: ::WORD = 0x4f; +pub const LANG_SCOTTISH_GAELIC: ::WORD = 0x91; +pub const LANG_SERBIAN: ::WORD = 0x1a; +pub const LANG_SERBIAN_NEUTRAL: ::WORD = 0x7c1a; +pub const LANG_SINDHI: ::WORD = 0x59; +pub const LANG_SINHALESE: ::WORD = 0x5b; +pub const LANG_SLOVAK: ::WORD = 0x1b; +pub const LANG_SLOVENIAN: ::WORD = 0x24; +pub const LANG_SOTHO: ::WORD = 0x6c; +pub const LANG_SPANISH: ::WORD = 0x0a; +pub const LANG_SWAHILI: ::WORD = 0x41; +pub const LANG_SWEDISH: ::WORD = 0x1d; +pub const LANG_SYRIAC: ::WORD = 0x5a; +pub const LANG_TAJIK: ::WORD = 0x28; +pub const LANG_TAMAZIGHT: ::WORD = 0x5f; +pub const LANG_TAMIL: ::WORD = 0x49; +pub const LANG_TATAR: ::WORD = 0x44; +pub const LANG_TELUGU: ::WORD = 0x4a; +pub const LANG_THAI: ::WORD = 0x1e; +pub const LANG_TIBETAN: ::WORD = 0x51; +pub const LANG_TIGRIGNA: ::WORD = 0x73; +pub const LANG_TIGRINYA: ::WORD = 0x73; +pub const LANG_TSWANA: ::WORD = 0x32; +pub const LANG_TURKISH: ::WORD = 0x1f; +pub const LANG_TURKMEN: ::WORD = 0x42; +pub const LANG_UIGHUR: ::WORD = 0x80; +pub const LANG_UKRAINIAN: ::WORD = 0x22; +pub const LANG_UPPER_SORBIAN: ::WORD = 0x2e; +pub const LANG_URDU: ::WORD = 0x20; +pub const LANG_UZBEK: ::WORD = 0x43; +pub const LANG_VALENCIAN: ::WORD = 0x03; +pub const LANG_VIETNAMESE: ::WORD = 0x2a; +pub const LANG_WELSH: ::WORD = 0x52; +pub const LANG_WOLOF: ::WORD = 0x88; +pub const LANG_XHOSA: ::WORD = 0x34; +pub const LANG_YAKUT: ::WORD = 0x85; +pub const LANG_YI: ::WORD = 0x78; +pub const LANG_YORUBA: ::WORD = 0x6a; +pub const LANG_ZULU: ::WORD = 0x35; +//1651 +pub const SUBLANG_NEUTRAL: ::WORD = 0x00; +pub const SUBLANG_DEFAULT: ::WORD = 0x01; +pub const SUBLANG_SYS_DEFAULT: ::WORD = 0x02; +pub const SUBLANG_CUSTOM_DEFAULT: ::WORD = 0x03; +pub const SUBLANG_CUSTOM_UNSPECIFIED: ::WORD = 0x04; +pub const SUBLANG_UI_CUSTOM_DEFAULT: ::WORD = 0x05; +pub const SUBLANG_AFRIKAANS_SOUTH_AFRICA: ::WORD = 0x01; +pub const SUBLANG_ALBANIAN_ALBANIA: ::WORD = 0x01; +pub const SUBLANG_ALSATIAN_FRANCE: ::WORD = 0x01; +pub const SUBLANG_AMHARIC_ETHIOPIA: ::WORD = 0x01; +pub const SUBLANG_ARABIC_SAUDI_ARABIA: ::WORD = 0x01; +pub const SUBLANG_ARABIC_IRAQ: ::WORD = 0x02; +pub const SUBLANG_ARABIC_EGYPT: ::WORD = 0x03; +pub const SUBLANG_ARABIC_LIBYA: ::WORD = 0x04; +pub const SUBLANG_ARABIC_ALGERIA: ::WORD = 0x05; +pub const SUBLANG_ARABIC_MOROCCO: ::WORD = 0x06; +pub const SUBLANG_ARABIC_TUNISIA: ::WORD = 0x07; +pub const SUBLANG_ARABIC_OMAN: ::WORD = 0x08; +pub const SUBLANG_ARABIC_YEMEN: ::WORD = 0x09; +pub const SUBLANG_ARABIC_SYRIA: ::WORD = 0x0a; +pub const SUBLANG_ARABIC_JORDAN: ::WORD = 0x0b; +pub const SUBLANG_ARABIC_LEBANON: ::WORD = 0x0c; +pub const SUBLANG_ARABIC_KUWAIT: ::WORD = 0x0d; +pub const SUBLANG_ARABIC_UAE: ::WORD = 0x0e; +pub const SUBLANG_ARABIC_BAHRAIN: ::WORD = 0x0f; +pub const SUBLANG_ARABIC_QATAR: ::WORD = 0x10; +pub const SUBLANG_ARMENIAN_ARMENIA: ::WORD = 0x01; +pub const SUBLANG_ASSAMESE_INDIA: ::WORD = 0x01; +pub const SUBLANG_AZERI_LATIN: ::WORD = 0x01; +pub const SUBLANG_AZERI_CYRILLIC: ::WORD = 0x02; +pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN: ::WORD = 0x01; +pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC: ::WORD = 0x02; +pub const SUBLANG_BANGLA_INDIA: ::WORD = 0x01; +pub const SUBLANG_BANGLA_BANGLADESH: ::WORD = 0x02; +pub const SUBLANG_BASHKIR_RUSSIA: ::WORD = 0x01; +pub const SUBLANG_BASQUE_BASQUE: ::WORD = 0x01; +pub const SUBLANG_BELARUSIAN_BELARUS: ::WORD = 0x01; +pub const SUBLANG_BENGALI_INDIA: ::WORD = 0x01; +pub const SUBLANG_BENGALI_BANGLADESH: ::WORD = 0x02; +pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: ::WORD = 0x05; +pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: ::WORD = 0x08; +pub const SUBLANG_BRETON_FRANCE: ::WORD = 0x01; +pub const SUBLANG_BULGARIAN_BULGARIA: ::WORD = 0x01; +pub const SUBLANG_CATALAN_CATALAN: ::WORD = 0x01; +pub const SUBLANG_CENTRAL_KURDISH_IRAQ: ::WORD = 0x01; +pub const SUBLANG_CHEROKEE_CHEROKEE: ::WORD = 0x01; +pub const SUBLANG_CHINESE_TRADITIONAL: ::WORD = 0x01; +pub const SUBLANG_CHINESE_SIMPLIFIED: ::WORD = 0x02; +pub const SUBLANG_CHINESE_HONGKONG: ::WORD = 0x03; +pub const SUBLANG_CHINESE_SINGAPORE: ::WORD = 0x04; +pub const SUBLANG_CHINESE_MACAU: ::WORD = 0x05; +pub const SUBLANG_CORSICAN_FRANCE: ::WORD = 0x01; +pub const SUBLANG_CZECH_CZECH_REPUBLIC: ::WORD = 0x01; +pub const SUBLANG_CROATIAN_CROATIA: ::WORD = 0x01; +pub const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: ::WORD = 0x04; +pub const SUBLANG_DANISH_DENMARK: ::WORD = 0x01; +pub const SUBLANG_DARI_AFGHANISTAN: ::WORD = 0x01; +pub const SUBLANG_DIVEHI_MALDIVES: ::WORD = 0x01; +pub const SUBLANG_DUTCH: ::WORD = 0x01; +pub const SUBLANG_DUTCH_BELGIAN: ::WORD = 0x02; +pub const SUBLANG_ENGLISH_US: ::WORD = 0x01; +pub const SUBLANG_ENGLISH_UK: ::WORD = 0x02; +pub const SUBLANG_ENGLISH_AUS: ::WORD = 0x03; +pub const SUBLANG_ENGLISH_CAN: ::WORD = 0x04; +pub const SUBLANG_ENGLISH_NZ: ::WORD = 0x05; +pub const SUBLANG_ENGLISH_EIRE: ::WORD = 0x06; +pub const SUBLANG_ENGLISH_SOUTH_AFRICA: ::WORD = 0x07; +pub const SUBLANG_ENGLISH_JAMAICA: ::WORD = 0x08; +pub const SUBLANG_ENGLISH_CARIBBEAN: ::WORD = 0x09; +pub const SUBLANG_ENGLISH_BELIZE: ::WORD = 0x0a; +pub const SUBLANG_ENGLISH_TRINIDAD: ::WORD = 0x0b; +pub const SUBLANG_ENGLISH_ZIMBABWE: ::WORD = 0x0c; +pub const SUBLANG_ENGLISH_PHILIPPINES: ::WORD = 0x0d; +pub const SUBLANG_ENGLISH_INDIA: ::WORD = 0x10; +pub const SUBLANG_ENGLISH_MALAYSIA: ::WORD = 0x11; +pub const SUBLANG_ENGLISH_SINGAPORE: ::WORD = 0x12; +pub const SUBLANG_ESTONIAN_ESTONIA: ::WORD = 0x01; +pub const SUBLANG_FAEROESE_FAROE_ISLANDS: ::WORD = 0x01; +pub const SUBLANG_FILIPINO_PHILIPPINES: ::WORD = 0x01; +pub const SUBLANG_FINNISH_FINLAND: ::WORD = 0x01; +pub const SUBLANG_FRENCH: ::WORD = 0x01; +pub const SUBLANG_FRENCH_BELGIAN: ::WORD = 0x02; +pub const SUBLANG_FRENCH_CANADIAN: ::WORD = 0x03; +pub const SUBLANG_FRENCH_SWISS: ::WORD = 0x04; +pub const SUBLANG_FRENCH_LUXEMBOURG: ::WORD = 0x05; +pub const SUBLANG_FRENCH_MONACO: ::WORD = 0x06; +pub const SUBLANG_FRISIAN_NETHERLANDS: ::WORD = 0x01; +pub const SUBLANG_FULAH_SENEGAL: ::WORD = 0x02; +pub const SUBLANG_GALICIAN_GALICIAN: ::WORD = 0x01; +pub const SUBLANG_GEORGIAN_GEORGIA: ::WORD = 0x01; +pub const SUBLANG_GERMAN: ::WORD = 0x01; +pub const SUBLANG_GERMAN_SWISS: ::WORD = 0x02; +pub const SUBLANG_GERMAN_AUSTRIAN: ::WORD = 0x03; +pub const SUBLANG_GERMAN_LUXEMBOURG: ::WORD = 0x04; +pub const SUBLANG_GERMAN_LIECHTENSTEIN: ::WORD = 0x05; +pub const SUBLANG_GREEK_GREECE: ::WORD = 0x01; +pub const SUBLANG_GREENLANDIC_GREENLAND: ::WORD = 0x01; +pub const SUBLANG_GUJARATI_INDIA: ::WORD = 0x01; +pub const SUBLANG_HAUSA_NIGERIA_LATIN: ::WORD = 0x01; +pub const SUBLANG_HAWAIIAN_US: ::WORD = 0x01; +pub const SUBLANG_HEBREW_ISRAEL: ::WORD = 0x01; +pub const SUBLANG_HINDI_INDIA: ::WORD = 0x01; +pub const SUBLANG_HUNGARIAN_HUNGARY: ::WORD = 0x01; +pub const SUBLANG_ICELANDIC_ICELAND: ::WORD = 0x01; +pub const SUBLANG_IGBO_NIGERIA: ::WORD = 0x01; +pub const SUBLANG_INDONESIAN_INDONESIA: ::WORD = 0x01; +pub const SUBLANG_INUKTITUT_CANADA: ::WORD = 0x01; +pub const SUBLANG_INUKTITUT_CANADA_LATIN: ::WORD = 0x02; +pub const SUBLANG_IRISH_IRELAND: ::WORD = 0x02; +pub const SUBLANG_ITALIAN: ::WORD = 0x01; +pub const SUBLANG_ITALIAN_SWISS: ::WORD = 0x02; +pub const SUBLANG_JAPANESE_JAPAN: ::WORD = 0x01; +pub const SUBLANG_KANNADA_INDIA: ::WORD = 0x01; +pub const SUBLANG_KASHMIRI_SASIA: ::WORD = 0x02; +pub const SUBLANG_KASHMIRI_INDIA: ::WORD = 0x02; +pub const SUBLANG_KAZAK_KAZAKHSTAN: ::WORD = 0x01; +pub const SUBLANG_KHMER_CAMBODIA: ::WORD = 0x01; +pub const SUBLANG_KICHE_GUATEMALA: ::WORD = 0x01; +pub const SUBLANG_KINYARWANDA_RWANDA: ::WORD = 0x01; +pub const SUBLANG_KONKANI_INDIA: ::WORD = 0x01; +pub const SUBLANG_KOREAN: ::WORD = 0x01; +pub const SUBLANG_KYRGYZ_KYRGYZSTAN: ::WORD = 0x01; +pub const SUBLANG_LAO_LAO: ::WORD = 0x01; +pub const SUBLANG_LATVIAN_LATVIA: ::WORD = 0x01; +pub const SUBLANG_LITHUANIAN: ::WORD = 0x01; +pub const SUBLANG_LOWER_SORBIAN_GERMANY: ::WORD = 0x02; +pub const SUBLANG_LUXEMBOURGISH_LUXEMBOURG: ::WORD = 0x01; +pub const SUBLANG_MACEDONIAN_MACEDONIA: ::WORD = 0x01; +pub const SUBLANG_MALAY_MALAYSIA: ::WORD = 0x01; +pub const SUBLANG_MALAY_BRUNEI_DARUSSALAM: ::WORD = 0x02; +pub const SUBLANG_MALAYALAM_INDIA: ::WORD = 0x01; +pub const SUBLANG_MALTESE_MALTA: ::WORD = 0x01; +pub const SUBLANG_MAORI_NEW_ZEALAND: ::WORD = 0x01; +pub const SUBLANG_MAPUDUNGUN_CHILE: ::WORD = 0x01; +pub const SUBLANG_MARATHI_INDIA: ::WORD = 0x01; +pub const SUBLANG_MOHAWK_MOHAWK: ::WORD = 0x01; +pub const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: ::WORD = 0x01; +pub const SUBLANG_MONGOLIAN_PRC: ::WORD = 0x02; +pub const SUBLANG_NEPALI_INDIA: ::WORD = 0x02; +pub const SUBLANG_NEPALI_NEPAL: ::WORD = 0x01; +pub const SUBLANG_NORWEGIAN_BOKMAL: ::WORD = 0x01; +pub const SUBLANG_NORWEGIAN_NYNORSK: ::WORD = 0x02; +pub const SUBLANG_OCCITAN_FRANCE: ::WORD = 0x01; +pub const SUBLANG_ODIA_INDIA: ::WORD = 0x01; +pub const SUBLANG_ORIYA_INDIA: ::WORD = 0x01; +pub const SUBLANG_PASHTO_AFGHANISTAN: ::WORD = 0x01; +pub const SUBLANG_PERSIAN_IRAN: ::WORD = 0x01; +pub const SUBLANG_POLISH_POLAND: ::WORD = 0x01; +pub const SUBLANG_PORTUGUESE: ::WORD = 0x02; +pub const SUBLANG_PORTUGUESE_BRAZILIAN: ::WORD = 0x01; +pub const SUBLANG_PULAR_SENEGAL: ::WORD = 0x02; +pub const SUBLANG_PUNJABI_INDIA: ::WORD = 0x01; +pub const SUBLANG_PUNJABI_PAKISTAN: ::WORD = 0x02; +pub const SUBLANG_QUECHUA_BOLIVIA: ::WORD = 0x01; +pub const SUBLANG_QUECHUA_ECUADOR: ::WORD = 0x02; +pub const SUBLANG_QUECHUA_PERU: ::WORD = 0x03; +pub const SUBLANG_ROMANIAN_ROMANIA: ::WORD = 0x01; +pub const SUBLANG_ROMANSH_SWITZERLAND: ::WORD = 0x01; +pub const SUBLANG_RUSSIAN_RUSSIA: ::WORD = 0x01; +pub const SUBLANG_SAKHA_RUSSIA: ::WORD = 0x01; +pub const SUBLANG_SAMI_NORTHERN_NORWAY: ::WORD = 0x01; +pub const SUBLANG_SAMI_NORTHERN_SWEDEN: ::WORD = 0x02; +pub const SUBLANG_SAMI_NORTHERN_FINLAND: ::WORD = 0x03; +pub const SUBLANG_SAMI_LULE_NORWAY: ::WORD = 0x04; +pub const SUBLANG_SAMI_LULE_SWEDEN: ::WORD = 0x05; +pub const SUBLANG_SAMI_SOUTHERN_NORWAY: ::WORD = 0x06; +pub const SUBLANG_SAMI_SOUTHERN_SWEDEN: ::WORD = 0x07; +pub const SUBLANG_SAMI_SKOLT_FINLAND: ::WORD = 0x08; +pub const SUBLANG_SAMI_INARI_FINLAND: ::WORD = 0x09; +pub const SUBLANG_SANSKRIT_INDIA: ::WORD = 0x01; +pub const SUBLANG_SCOTTISH_GAELIC: ::WORD = 0x01; +pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN: ::WORD = 0x06; +pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC: ::WORD = 0x07; +pub const SUBLANG_SERBIAN_MONTENEGRO_LATIN: ::WORD = 0x0b; +pub const SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC: ::WORD = 0x0c; +pub const SUBLANG_SERBIAN_SERBIA_LATIN: ::WORD = 0x09; +pub const SUBLANG_SERBIAN_SERBIA_CYRILLIC: ::WORD = 0x0a; +pub const SUBLANG_SERBIAN_CROATIA: ::WORD = 0x01; +pub const SUBLANG_SERBIAN_LATIN: ::WORD = 0x02; +pub const SUBLANG_SERBIAN_CYRILLIC: ::WORD = 0x03; +pub const SUBLANG_SINDHI_INDIA: ::WORD = 0x01; +pub const SUBLANG_SINDHI_PAKISTAN: ::WORD = 0x02; +pub const SUBLANG_SINDHI_AFGHANISTAN: ::WORD = 0x02; +pub const SUBLANG_SINHALESE_SRI_LANKA: ::WORD = 0x01; +pub const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA: ::WORD = 0x01; +pub const SUBLANG_SLOVAK_SLOVAKIA: ::WORD = 0x01; +pub const SUBLANG_SLOVENIAN_SLOVENIA: ::WORD = 0x01; +pub const SUBLANG_SPANISH: ::WORD = 0x01; +pub const SUBLANG_SPANISH_MEXICAN: ::WORD = 0x02; +pub const SUBLANG_SPANISH_MODERN: ::WORD = 0x03; +pub const SUBLANG_SPANISH_GUATEMALA: ::WORD = 0x04; +pub const SUBLANG_SPANISH_COSTA_RICA: ::WORD = 0x05; +pub const SUBLANG_SPANISH_PANAMA: ::WORD = 0x06; +pub const SUBLANG_SPANISH_DOMINICAN_REPUBLIC: ::WORD = 0x07; +pub const SUBLANG_SPANISH_VENEZUELA: ::WORD = 0x08; +pub const SUBLANG_SPANISH_COLOMBIA: ::WORD = 0x09; +pub const SUBLANG_SPANISH_PERU: ::WORD = 0x0a; +pub const SUBLANG_SPANISH_ARGENTINA: ::WORD = 0x0b; +pub const SUBLANG_SPANISH_ECUADOR: ::WORD = 0x0c; +pub const SUBLANG_SPANISH_CHILE: ::WORD = 0x0d; +pub const SUBLANG_SPANISH_URUGUAY: ::WORD = 0x0e; +pub const SUBLANG_SPANISH_PARAGUAY: ::WORD = 0x0f; +pub const SUBLANG_SPANISH_BOLIVIA: ::WORD = 0x10; +pub const SUBLANG_SPANISH_EL_SALVADOR: ::WORD = 0x11; +pub const SUBLANG_SPANISH_HONDURAS: ::WORD = 0x12; +pub const SUBLANG_SPANISH_NICARAGUA: ::WORD = 0x13; +pub const SUBLANG_SPANISH_PUERTO_RICO: ::WORD = 0x14; +pub const SUBLANG_SPANISH_US: ::WORD = 0x15; +pub const SUBLANG_SWAHILI_KENYA: ::WORD = 0x01; +pub const SUBLANG_SWEDISH: ::WORD = 0x01; +pub const SUBLANG_SWEDISH_FINLAND: ::WORD = 0x02; +pub const SUBLANG_SYRIAC_SYRIA: ::WORD = 0x01; +pub const SUBLANG_TAJIK_TAJIKISTAN: ::WORD = 0x01; +pub const SUBLANG_TAMAZIGHT_ALGERIA_LATIN: ::WORD = 0x02; +pub const SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH: ::WORD = 0x04; +pub const SUBLANG_TAMIL_INDIA: ::WORD = 0x01; +pub const SUBLANG_TAMIL_SRI_LANKA: ::WORD = 0x02; +pub const SUBLANG_TATAR_RUSSIA: ::WORD = 0x01; +pub const SUBLANG_TELUGU_INDIA: ::WORD = 0x01; +pub const SUBLANG_THAI_THAILAND: ::WORD = 0x01; +pub const SUBLANG_TIBETAN_PRC: ::WORD = 0x01; +pub const SUBLANG_TIGRIGNA_ERITREA: ::WORD = 0x02; +pub const SUBLANG_TIGRINYA_ERITREA: ::WORD = 0x02; +pub const SUBLANG_TIGRINYA_ETHIOPIA: ::WORD = 0x01; +pub const SUBLANG_TSWANA_BOTSWANA: ::WORD = 0x02; +pub const SUBLANG_TSWANA_SOUTH_AFRICA: ::WORD = 0x01; +pub const SUBLANG_TURKISH_TURKEY: ::WORD = 0x01; +pub const SUBLANG_TURKMEN_TURKMENISTAN: ::WORD = 0x01; +pub const SUBLANG_UIGHUR_PRC: ::WORD = 0x01; +pub const SUBLANG_UKRAINIAN_UKRAINE: ::WORD = 0x01; +pub const SUBLANG_UPPER_SORBIAN_GERMANY: ::WORD = 0x01; +pub const SUBLANG_URDU_PAKISTAN: ::WORD = 0x01; +pub const SUBLANG_URDU_INDIA: ::WORD = 0x02; +pub const SUBLANG_UZBEK_LATIN: ::WORD = 0x01; +pub const SUBLANG_UZBEK_CYRILLIC: ::WORD = 0x02; +pub const SUBLANG_VALENCIAN_VALENCIA: ::WORD = 0x02; +pub const SUBLANG_VIETNAMESE_VIETNAM: ::WORD = 0x01; +pub const SUBLANG_WELSH_UNITED_KINGDOM: ::WORD = 0x01; +pub const SUBLANG_WOLOF_SENEGAL: ::WORD = 0x01; +pub const SUBLANG_XHOSA_SOUTH_AFRICA: ::WORD = 0x01; +pub const SUBLANG_YAKUT_RUSSIA: ::WORD = 0x01; +pub const SUBLANG_YI_PRC: ::WORD = 0x01; +pub const SUBLANG_YORUBA_NIGERIA: ::WORD = 0x01; +pub const SUBLANG_ZULU_SOUTH_AFRICA: ::WORD = 0x01; +//1962 +// FIXME: Once feature(const_fn) or some CTFE alternative becomes stable, MAKELANGID! can go +// unless we want to #[macro_export] it ... +macro_rules! MAKELANGID { ($p:expr, $s:expr) => ($s << 10 | $p) } +pub fn MAKELANGID(p: ::WORD, s: ::WORD) -> ::LANGID { MAKELANGID!(p, s) } +pub fn PRIMARYLANGID(lgid: ::LANGID) -> ::WORD { lgid & 0x3ff } +pub fn SUBLANGID(lgid: ::LANGID) -> ::WORD { lgid >> 10 } +//2019 +pub const LANG_SYSTEM_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT); +pub const LANG_USER_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_DEFAULT); +//2214 +pub const MAXIMUM_WAIT_OBJECTS: ::DWORD = 64; +pub const MAXIMUM_SUSPEND_COUNT: ::CHAR = MAXCHAR; +//2277 +pub type KSPIN_LOCK = ::ULONG_PTR; +pub type PKSPIN_LOCK = *mut KSPIN_LOCK; +STRUCT!{struct M128A { // FIXME align 16 + Low: ULONGLONG, + High: LONGLONG, +}} +pub type PM128A = *mut M128A; +#[cfg(target_arch = "x86")] +STRUCT!{nodebug struct XSAVE_FORMAT { // FIXME align 16 + ControlWord: ::WORD, + StatusWord: ::WORD, + TagWord: ::BYTE, + Reserved1: ::BYTE, + ErrorOpcode: ::WORD, + ErrorOffset: ::DWORD, + ErrorSelector: ::WORD, + Reserved2: ::WORD, + DataOffset: ::DWORD, + DataSelector: ::WORD, + Reserved3: ::WORD, + MxCsr: ::DWORD, + MxCsr_Mask: ::DWORD, + FloatRegisters: [M128A; 8], + XmmRegisters: [M128A; 8], + Reserved4: [::BYTE; 224], +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{nodebug struct XSAVE_FORMAT { // FIXME align 16 + ControlWord: ::WORD, + StatusWord: ::WORD, + TagWord: ::BYTE, + Reserved1: ::BYTE, + ErrorOpcode: ::WORD, + ErrorOffset: ::DWORD, + ErrorSelector: ::WORD, + Reserved2: ::WORD, + DataOffset: ::DWORD, + DataSelector: ::WORD, + Reserved3: ::WORD, + MxCsr: ::DWORD, + MxCsr_Mask: ::DWORD, + FloatRegisters: [M128A; 8], + XmmRegisters: [M128A; 16], + Reserved4: [::BYTE; 96], +}} +//3563 +#[cfg(target_arch = "x86")] +pub const SIZE_OF_80387_REGISTERS: usize = 80; +#[cfg(target_arch = "x86")] +STRUCT!{nodebug struct FLOATING_SAVE_AREA { + ControlWord: ::DWORD, + StatusWord: ::DWORD, + TagWord: ::DWORD, + ErrorOffset: ::DWORD, + ErrorSelector: ::DWORD, + DataOffset: ::DWORD, + DataSelector: ::DWORD, + RegisterArea: [::BYTE; SIZE_OF_80387_REGISTERS], + Spare0: ::DWORD, +}} +#[cfg(target_arch = "x86")] +pub type PFLOATING_SAVE_AREA = *mut FLOATING_SAVE_AREA; +#[cfg(target_arch = "x86")] +pub const MAXIMUM_SUPPORTED_EXTENSION: usize = 512; +#[cfg(target_arch = "x86")] +STRUCT!{nodebug struct CONTEXT { + ContextFlags: ::DWORD, + Dr0: ::DWORD, + Dr1: ::DWORD, + Dr2: ::DWORD, + Dr3: ::DWORD, + Dr6: ::DWORD, + Dr7: ::DWORD, + FloatSave: FLOATING_SAVE_AREA, + SegGs: ::DWORD, + SegFs: ::DWORD, + SegEs: ::DWORD, + SegDs: ::DWORD, + Edi: ::DWORD, + Esi: ::DWORD, + Ebx: ::DWORD, + Edx: ::DWORD, + Ecx: ::DWORD, + Eax: ::DWORD, + Ebp: ::DWORD, + Eip: ::DWORD, + SegCs: ::DWORD, + EFlags: ::DWORD, + Esp: ::DWORD, + SegSs: ::DWORD, + ExtendedRegisters: [::BYTE; MAXIMUM_SUPPORTED_EXTENSION], +}} +#[cfg(target_arch = "x86_64")] +pub type XMM_SAVE_AREA32 = XSAVE_FORMAT; +pub type PXMM_SAVE_AREA32 = *mut XSAVE_FORMAT; +// FIXME - Align 16 +#[cfg(target_arch = "x86_64")] +STRUCT!{nodebug struct CONTEXT { + P1Home: ::DWORD64, + P2Home: ::DWORD64, + P3Home: ::DWORD64, + P4Home: ::DWORD64, + P5Home: ::DWORD64, + P6Home: ::DWORD64, + ContextFlags: ::DWORD, + MxCsr: ::DWORD, + SegCs: ::WORD, + SegDs: ::WORD, + SegEs: ::WORD, + SegFs: ::WORD, + SegGs: ::WORD, + SegSs: ::WORD, + EFlags: ::DWORD, + Dr0: ::DWORD64, + Dr1: ::DWORD64, + Dr2: ::DWORD64, + Dr3: ::DWORD64, + Dr6: ::DWORD64, + Dr7: ::DWORD64, + Rax: ::DWORD64, + Rcx: ::DWORD64, + Rdx: ::DWORD64, + Rbx: ::DWORD64, + Rsp: ::DWORD64, + Rbp: ::DWORD64, + Rsi: ::DWORD64, + Rdi: ::DWORD64, + R8: ::DWORD64, + R9: ::DWORD64, + R10: ::DWORD64, + R11: ::DWORD64, + R12: ::DWORD64, + R13: ::DWORD64, + R14: ::DWORD64, + R15: ::DWORD64, + Rip: ::DWORD64, + FltSave: XMM_SAVE_AREA32, + VectorRegister: [::M128A; 26], + VectorControl: ::DWORD64, + DebugControl: ::DWORD64, + LastBranchToRip: ::DWORD64, + LastBranchFromRip: ::DWORD64, + LastExceptionToRip: ::DWORD64, + LastExceptionFromRip: ::DWORD64, +}} +pub type PCONTEXT = *mut CONTEXT; +#[test] +fn test_CONTEXT_size() { + use std::mem::size_of; + if cfg!(target_arch = "x86_64") { + assert_eq!(size_of::(), 1232) + } else if cfg!(target_arch = "x86") { + assert_eq!(size_of::(), 716) + } +} +pub type RUNTIME_FUNCTION = IMAGE_RUNTIME_FUNCTION_ENTRY; +pub type PRUNTIME_FUNCTION = *mut RUNTIME_FUNCTION; +pub const UNWIND_HISTORY_TABLE_SIZE: usize = 12; +STRUCT!{struct UNWIND_HISTORY_TABLE_ENTRY { + ImageBase: ::DWORD64, + FunctionEntry: PRUNTIME_FUNCTION, +}} +pub type PUNWIND_HISTORY_TABLE_ENTRY = *mut UNWIND_HISTORY_TABLE_ENTRY; +STRUCT!{struct UNWIND_HISTORY_TABLE { + Count: ::DWORD, + LocalHint: ::BYTE, + GlobalHint: ::BYTE, + Search: ::BYTE, + Once: ::BYTE, + LowAddress: ::DWORD64, + HighAddress: ::DWORD64, + Entry: [UNWIND_HISTORY_TABLE_ENTRY; UNWIND_HISTORY_TABLE_SIZE], +}} +pub type PUNWIND_HISTORY_TABLE = *mut UNWIND_HISTORY_TABLE; +pub type PGET_RUNTIME_FUNCTION_CALLBACK = Option PRUNTIME_FUNCTION>; +STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u1 { + Xmm0: PM128A, + Xmm1: PM128A, + Xmm2: PM128A, + Xmm3: PM128A, + Xmm4: PM128A, + Xmm5: PM128A, + Xmm6: PM128A, + Xmm7: PM128A, + Xmm8: PM128A, + Xmm9: PM128A, + Xmm10: PM128A, + Xmm11: PM128A, + Xmm12: PM128A, + Xmm14: PM128A, + Xmm15: PM128A, +}} +STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u2 { + Rax: ::DWORD64, + Rcx: ::DWORD64, + Rdx: ::DWORD64, + Rbx: ::DWORD64, + Rsp: ::DWORD64, + Rbp: ::DWORD64, + Rsi: ::DWORD64, + Rdi: ::DWORD64, + R8: ::DWORD64, + R9: ::DWORD64, + R10: ::DWORD64, + R11: ::DWORD64, + R12: ::DWORD64, + R13: ::DWORD64, + R14: ::DWORD64, + R15: ::DWORD64, +}} +STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS { + FloatingContext: [PM128A; 16], + IntegerContext: [::PDWORD64; 16], +}} +// FIXME: all unions are untagged +UNION!( + KNONVOLATILE_CONTEXT_POINTERS, FloatingContext, Xmms, Xmms_mut, + KNONVOLATILE_CONTEXT_POINTERS_u1 +); +UNION!( + KNONVOLATILE_CONTEXT_POINTERS, IntegerContext, Regs, Regs_mut, + KNONVOLATILE_CONTEXT_POINTERS_u2 +); +pub type PKNONVOLATILE_CONTEXT_POINTERS = *mut KNONVOLATILE_CONTEXT_POINTERS; +//8983 +pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15; +STRUCT!{struct EXCEPTION_RECORD { + ExceptionCode: ::DWORD, + ExceptionFlags: ::DWORD, + ExceptionRecord: *mut EXCEPTION_RECORD, + ExceptionAddress: ::PVOID, + NumberParameters: ::DWORD, + ExceptionInformation: [::ULONG_PTR; EXCEPTION_MAXIMUM_PARAMETERS], +}} +pub type PEXCEPTION_RECORD = *mut EXCEPTION_RECORD; +//9023 +STRUCT!{struct EXCEPTION_POINTERS { + ExceptionRecord: PEXCEPTION_RECORD, + ContextRecord: PCONTEXT, +}} +pub type PEXCEPTION_POINTERS = *mut EXCEPTION_POINTERS; +pub type PACCESS_TOKEN = ::PVOID; +pub type PSECURITY_DESCRIPTOR = ::PVOID; +pub type PSID = ::PVOID; +pub type PCLAIMS_BLOB = ::PVOID; +//9091 +pub type ACCESS_MASK = ::DWORD; +pub type PACCESS_MASK = *mut ACCESS_MASK; +pub const DELETE: ::DWORD = 0x00010000; +pub const READ_CONTROL: ::DWORD = 0x00020000; +pub const WRITE_DAC: ::DWORD = 0x00040000; +pub const WRITE_OWNER: ::DWORD = 0x00080000; +pub const SYNCHRONIZE: ::DWORD = 0x00100000; +pub const STANDARD_RIGHTS_REQUIRED: ::DWORD = 0x000F0000; +pub const STANDARD_RIGHTS_READ: ::DWORD = READ_CONTROL; +pub const STANDARD_RIGHTS_WRITE: ::DWORD = READ_CONTROL; +pub const STANDARD_RIGHTS_EXECUTE: ::DWORD = READ_CONTROL; +pub const STANDARD_RIGHTS_ALL: ::DWORD = 0x001F0000; +pub const SPECIFIC_RIGHTS_ALL: ::DWORD = 0x0000FFFF; +pub const ACCESS_SYSTEM_SECURITY: ::DWORD = 0x01000000; +pub const MAXIMUM_ALLOWED: ::DWORD = 0x02000000; +pub const GENERIC_READ: ::DWORD = 0x80000000; +pub const GENERIC_WRITE: ::DWORD = 0x40000000; +pub const GENERIC_EXECUTE: ::DWORD = 0x20000000; +pub const GENERIC_ALL: ::DWORD = 0x10000000; +//9170 +STRUCT!{struct LUID_AND_ATTRIBUTES { + Luid: LUID, + Attributes: ::DWORD, +}} +pub type PLUID_AND_ATTRIBUTES = *mut LUID_AND_ATTRIBUTES; +//9243 +ENUM!{enum SID_NAME_USE { + SidTypeUser = 1, + SidTypeGroup, + SidTypeDomain, + SidTypeAlias, + SidTypeWellKnownGroup, + SidTypeDeletedAccount, + SidTypeInvalid, + SidTypeUnknown, + SidTypeComputer, + SidTypeLabel, +}} +pub type PSID_NAME_USE = *mut SID_NAME_USE; +STRUCT!{struct SID_AND_ATTRIBUTES { + Sid: PSID, + Attributes: ::DWORD, +}} +pub type PSID_AND_ATTRIBUTES = *mut SID_AND_ATTRIBUTES; +//9802 +pub const ACL_REVISION: ::BYTE = 2; +pub const ACL_REVISION_DS: ::BYTE = 4; +pub const ACL_REVISION1: ::BYTE = 1; +pub const MIN_ACL_REVISION: ::BYTE = ACL_REVISION2; +pub const ACL_REVISION2: ::BYTE = 2; +pub const ACL_REVISION3: ::BYTE = 3; +pub const ACL_REVISION4: ::BYTE = 4; +pub const MAX_ACL_REVISION: ::BYTE = ACL_REVISION4; +STRUCT!{struct ACL { + AclRevision: ::BYTE, + Sbz1: ::BYTE, + AclSize: ::WORD, + AceCount: ::WORD, + Sbz2: ::WORD, +}} +pub type PACL = *mut ACL; +//9888 +pub const SE_PRIVILEGE_ENABLED_BY_DEFAULT: ::DWORD = 0x00000001; +pub const SE_PRIVILEGE_ENABLED: ::DWORD = 0x00000002; +pub const SE_PRIVILEGE_REMOVED: ::DWORD = 0x00000004; +pub const SE_PRIVILEGE_USED_FOR_ACCESS: ::DWORD = 0x80000000; +pub const SE_PRIVILEGE_VALID_ATTRIBUTES: ::DWORD = SE_PRIVILEGE_ENABLED_BY_DEFAULT | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS; +pub const PRIVILEGE_SET_ALL_NECESSARY: ::DWORD = 1; +//10689 +pub const TOKEN_ASSIGN_PRIMARY: ::DWORD = 0x0001; +pub const TOKEN_DUPLICATE: ::DWORD = 0x0002; +pub const TOKEN_IMPERSONATE: ::DWORD = 0x0004; +pub const TOKEN_QUERY: ::DWORD = 0x0008; +pub const TOKEN_QUERY_SOURCE: ::DWORD = 0x0010; +pub const TOKEN_ADJUST_PRIVILEGES: ::DWORD = 0x0020; +pub const TOKEN_ADJUST_GROUPS: ::DWORD = 0x0040; +pub const TOKEN_ADJUST_DEFAULT: ::DWORD = 0x0080; +pub const TOKEN_ADJUST_SESSIONID: ::DWORD = 0x0100; +pub const TOKEN_ALL_ACCESS_P: ::DWORD = STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY + | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE + | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT; +pub const TOKEN_ALL_ACCESS: ::DWORD = TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID; +pub const TOKEN_READ: ::DWORD = STANDARD_RIGHTS_READ | TOKEN_QUERY; +pub const TOKEN_WRITE: ::DWORD = STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES + | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT; +pub const TOKEN_EXECUTE: ::DWORD = STANDARD_RIGHTS_EXECUTE; +//10823 +STRUCT!{nodebug struct TOKEN_PRIVILEGES { + PrivilegeCount: ::DWORD, + Privileges: [LUID_AND_ATTRIBUTES; 0], +}} +pub type PTOKEN_PRIVILEGES = *mut TOKEN_PRIVILEGES; +//10965 +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INVALID: ::WORD = 0x00; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64: ::WORD = 0x01; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64: ::WORD = 0x02; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING: ::WORD = 0x03; +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { + Version: ::DWORD64, + Name: ::PWSTR, +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE = *mut CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN: ::WORD = 0x04; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_SID: ::WORD = 0x05; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN: ::WORD = 0x06; +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { + pValue: ::PVOID, + ValueLength: ::DWORD, +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE = + *mut CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING: ::WORD = 0x10; +pub const CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE: ::DWORD = 0x0001; +pub const CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE: ::DWORD = 0x0002; +pub const CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY: ::DWORD = 0x0004; +pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT: ::DWORD = 0x0008; +pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED: ::DWORD = 0x0010; +pub const CLAIM_SECURITY_ATTRIBUTE_MANDATORY: ::DWORD = 0x0020; +pub const CLAIM_SECURITY_ATTRIBUTE_VALID_FLAGS: ::DWORD = CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE + | CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE | CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY + | CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT | CLAIM_SECURITY_ATTRIBUTE_DISABLED + | CLAIM_SECURITY_ATTRIBUTE_MANDATORY; +pub const CLAIM_SECURITY_ATTRIBUTE_CUSTOM_FLAGS: ::DWORD = 0xFFFF0000; +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_V1 { + Name: ::PWSTR, + ValueType: ::WORD, + Reserved: ::WORD, + Flags: ::DWORD, + ValueCount: ::DWORD, + // Put data here +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_V1; +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { + Name: ::DWORD, + ValueType: ::WORD, + Reserved: ::WORD, + Flags: ::DWORD, + ValueCount: ::DWORD, + // Put array here +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1; +pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1: ::WORD = 1; +pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION: ::WORD = + CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1; +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTES_INFORMATION { + Version: ::WORD, + Reserved: ::WORD, + AttributeCount: ::DWORD, + pAttributeV1: PCLAIM_SECURITY_ATTRIBUTE_V1, +}} +pub type PCLAIM_SECURITY_ATTRIBUTES_INFORMATION = *mut CLAIM_SECURITY_ATTRIBUTES_INFORMATION; +//11257 +pub type SECURITY_INFORMATION = ::DWORD; +pub type PSECURITY_INFORMATION = *mut ::DWORD; +pub const OWNER_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000001; +pub const GROUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000002; +pub const DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000004; +pub const SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000008; +pub const LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000010; +pub const ATTRIBUTE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000020; +pub const SCOPE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000040; +pub const PROCESS_TRUST_LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000080; +pub const BACKUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00010000; +pub const PROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x80000000; +pub const PROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x40000000; +pub const UNPROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x20000000; +pub const UNPROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x10000000; +ENUM!{enum SE_LEARNING_MODE_DATA_TYPE { + SeLearningModeInvalidType = 0, + SeLearningModeSettings, + SeLearningModeMax, +}} +STRUCT!{struct SECURITY_CAPABILITIES { + AppContainerSid: PSID, + Capabilities: PSID_AND_ATTRIBUTES, + CapabilityCount: ::DWORD, + Reserved: ::DWORD, +}} +pub type PSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES; +pub type LPSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES; +pub const PROCESS_TERMINATE: ::DWORD = 0x0001; +pub const PROCESS_CREATE_THREAD: ::DWORD = 0x0002; +pub const PROCESS_SET_SESSIONID: ::DWORD = 0x0004; +pub const PROCESS_VM_OPERATION: ::DWORD = 0x0008; +pub const PROCESS_VM_READ: ::DWORD = 0x0010; +pub const PROCESS_VM_WRITE: ::DWORD = 0x0020; +pub const PROCESS_DUP_HANDLE: ::DWORD = 0x0040; +pub const PROCESS_CREATE_PROCESS: ::DWORD = 0x0080; +pub const PROCESS_SET_QUOTA: ::DWORD = 0x0100; +pub const PROCESS_SET_INFORMATION: ::DWORD = 0x0200; +pub const PROCESS_QUERY_INFORMATION: ::DWORD = 0x0400; +pub const PROCESS_SUSPEND_RESUME: ::DWORD = 0x0800; +pub const PROCESS_QUERY_LIMITED_INFORMATION: ::DWORD = 0x1000; +pub const PROCESS_SET_LIMITED_INFORMATION: ::DWORD = 0x2000; +pub const PROCESS_ALL_ACCESS: ::DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF; +//11007 +pub const THREAD_BASE_PRIORITY_LOWRT: ::DWORD = 15; +pub const THREAD_BASE_PRIORITY_MAX: ::DWORD = 2; +pub const THREAD_BASE_PRIORITY_MIN: ::DWORD = -2i32 as ::DWORD; +pub const THREAD_BASE_PRIORITY_IDLE: ::DWORD = -15i32 as ::DWORD; +//11018 +STRUCT!{struct QUOTA_LIMITS { + PagedPoolLimit: ::SIZE_T, + NonPagedPoolLimit: ::SIZE_T, + MinimumWorkingSetSize: ::SIZE_T, + MaximumWorkingSetSize: ::SIZE_T, + PagefileLimit: ::SIZE_T, + TimeLimit: ::LARGE_INTEGER, +}} +pub type PQUOTA_LIMITS = *mut QUOTA_LIMITS; +pub const QUOTA_LIMITS_HARDWS_MIN_ENABLE: ::DWORD = 0x00000001; +pub const QUOTA_LIMITS_HARDWS_MIN_DISABLE: ::DWORD = 0x00000002; +pub const QUOTA_LIMITS_HARDWS_MAX_ENABLE: ::DWORD = 0x00000004; +pub const QUOTA_LIMITS_HARDWS_MAX_DISABLE: ::DWORD = 0x00000008; +pub const QUOTA_LIMITS_USE_DEFAULT_LIMITS: ::DWORD = 0x00000010; +STRUCT!{struct RATE_QUOTA_LIMIT { + RateData: ::DWORD, + BitFields: ::DWORD, +}} +BITFIELD!(RATE_QUOTA_LIMIT BitFields: ::DWORD [ + RatePercent set_RatePercent[0..7], + Reserved0 set_Reserved0[7..32], +]); +pub type PRATE_QUOTA_LIMIT = *mut RATE_QUOTA_LIMIT; +STRUCT!{struct QUOTA_LIMITS_EX { + PagedPoolLimit: ::SIZE_T, + NonPagedPoolLimit: ::SIZE_T, + MinimumWorkingSetSize: ::SIZE_T, + MaximumWorkingSetSize: ::SIZE_T, + PagefileLimit: ::SIZE_T, + TimeLimit: ::LARGE_INTEGER, + WorkingSetLimit: ::SIZE_T, + Reserved2: ::SIZE_T, + Reserved3: ::SIZE_T, + Reserved4: ::SIZE_T, + Flags: ::DWORD, + CpuRateLimit: RATE_QUOTA_LIMIT, +}} +pub type PQUOTA_LIMITS_EX = *mut QUOTA_LIMITS_EX; +STRUCT!{struct IO_COUNTERS { + ReadOperationCount: ::ULONGLONG, + WriteOperationCount: ::ULONGLONG, + OtherOperationCount: ::ULONGLONG, + ReadTransferCount: ::ULONGLONG, + WriteTransferCount: ::ULONGLONG, + OtherTransferCount: ::ULONGLONG, +}} +pub type PIO_COUNTERS = *mut IO_COUNTERS; +//11192 +STRUCT!{struct JOBOBJECT_BASIC_LIMIT_INFORMATION { + PerProcessUserTimeLimit: ::LARGE_INTEGER, + PerJobUserTimeLimit: ::LARGE_INTEGER, + LimitFlags: ::DWORD, + MinimumWorkingSetSize: ::SIZE_T, + MaximumWorkingSetSize: ::SIZE_T, + ActiveProcessLimit: ::DWORD, + Affinity: ::ULONG_PTR, + PriorityClass: ::DWORD, + SchedulingClass: ::DWORD, +}} +pub type PJOBOBJECT_BASIC_LIMIT_INFORMATION = *mut JOBOBJECT_BASIC_LIMIT_INFORMATION; +STRUCT!{struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { + BasicLimitInformation: JOBOBJECT_BASIC_LIMIT_INFORMATION, + IoInfo: IO_COUNTERS, + ProcessMemoryLimit: ::SIZE_T, + JobMemoryLimit: ::SIZE_T, + PeakProcessMemoryUsed: ::SIZE_T, + PeakJobMemoryUsed: ::SIZE_T, +}} +pub type PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = *mut JOBOBJECT_EXTENDED_LIMIT_INFORMATION; +STRUCT!{struct JOBOBJECT_BASIC_PROCESS_ID_LIST { + NumberOfAssignedProcesses: ::DWORD, + NumberOfProcessIdsInList: ::DWORD, + ProcessIdList: [::ULONG_PTR; 0], +}} +//11712 +pub const JOB_OBJECT_TERMINATE_AT_END_OF_JOB: ::DWORD = 0; +pub const JOB_OBJECT_POST_AT_END_OF_JOB: ::DWORD = 1; +pub const JOB_OBJECT_MSG_END_OF_JOB_TIME: ::DWORD = 1; +pub const JOB_OBJECT_MSG_END_OF_PROCESS_TIME: ::DWORD = 2; +pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT: ::DWORD = 3; +pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: ::DWORD = 4; +pub const JOB_OBJECT_MSG_NEW_PROCESS: ::DWORD = 6; +pub const JOB_OBJECT_MSG_EXIT_PROCESS: ::DWORD = 7; +pub const JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: ::DWORD = 8; +pub const JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: ::DWORD = 9; +pub const JOB_OBJECT_MSG_JOB_MEMORY_LIMIT: ::DWORD = 10; +pub const JOB_OBJECT_MSG_NOTIFICATION_LIMIT: ::DWORD = 11; +pub const JOB_OBJECT_MSG_JOB_CYCLE_TIME_LIMIT: ::DWORD = 12; +pub const JOB_OBJECT_MSG_MINIMUM: ::DWORD = 1; +pub const JOB_OBJECT_MSG_MAXIMUM: ::DWORD = 12; +pub const JOB_OBJECT_VALID_COMPLETION_FILTER: ::DWORD = ((1 << (JOB_OBJECT_MSG_MAXIMUM + 1)) - 1) + - ((1 << JOB_OBJECT_MSG_MINIMUM) - 1); +pub const JOB_OBJECT_LIMIT_WORKINGSET: ::DWORD = 0x00000001; +pub const JOB_OBJECT_LIMIT_PROCESS_TIME: ::DWORD = 0x00000002; +pub const JOB_OBJECT_LIMIT_JOB_TIME: ::DWORD = 0x00000004; +pub const JOB_OBJECT_LIMIT_ACTIVE_PROCESS: ::DWORD = 0x00000008; +pub const JOB_OBJECT_LIMIT_AFFINITY: ::DWORD = 0x00000010; +pub const JOB_OBJECT_LIMIT_PRIORITY_CLASS: ::DWORD = 0x00000020; +pub const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME: ::DWORD = 0x00000040; +pub const JOB_OBJECT_LIMIT_SCHEDULING_CLASS: ::DWORD = 0x00000080; +pub const JOB_OBJECT_LIMIT_PROCESS_MEMORY: ::DWORD = 0x00000100; +pub const JOB_OBJECT_LIMIT_JOB_MEMORY: ::DWORD = 0x00000200; +pub const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION: ::DWORD = 0x00000400; +pub const JOB_OBJECT_LIMIT_BREAKAWAY_OK: ::DWORD = 0x00000800; +pub const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK: ::DWORD = 0x00001000; +pub const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: ::DWORD = 0x00002000; +pub const JOB_OBJECT_LIMIT_SUBSET_AFFINITY: ::DWORD = 0x00004000; +pub const JOB_OBJECT_LIMIT_JOB_READ_BYTES: ::DWORD = 0x00010000; +pub const JOB_OBJECT_LIMIT_JOB_WRITE_BYTES: ::DWORD = 0x00020000; +pub const JOB_OBJECT_LIMIT_RATE_CONTROL: ::DWORD = 0x00040000; +pub const JOB_OBJECT_LIMIT_RESERVED3: ::DWORD = 0x00008000; +pub const JOB_OBJECT_LIMIT_VALID_FLAGS: ::DWORD = 0x0007ffff; +pub const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS: ::DWORD = 0x000000ff; +pub const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS: ::DWORD = 0x00007fff; +pub const JOB_OBJECT_NOTIFICATION_LIMIT_VALID_FLAGS: ::DWORD = 0x00070204; +pub const JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS: ::DWORD = 0x0007ffff; +pub const JOB_OBJECT_UILIMIT_NONE: ::DWORD = 0x00000000; +pub const JOB_OBJECT_UILIMIT_HANDLES: ::DWORD = 0x00000001; +pub const JOB_OBJECT_UILIMIT_READCLIPBOARD: ::DWORD = 0x00000002; +pub const JOB_OBJECT_UILIMIT_WRITECLIPBOARD: ::DWORD = 0x00000004; +pub const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS: ::DWORD = 0x00000008; +pub const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS: ::DWORD = 0x00000010; +pub const JOB_OBJECT_UILIMIT_GLOBALATOMS: ::DWORD = 0x00000020; +pub const JOB_OBJECT_UILIMIT_DESKTOP: ::DWORD = 0x00000040; +pub const JOB_OBJECT_UILIMIT_EXITWINDOWS: ::DWORD = 0x00000080; +pub const JOB_OBJECT_UILIMIT_ALL: ::DWORD = 0x000000FF; +pub const JOB_OBJECT_UI_VALID_FLAGS: ::DWORD = 0x000000FF; +pub const JOB_OBJECT_SECURITY_NO_ADMIN: ::DWORD = 0x00000001; +pub const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN: ::DWORD = 0x00000002; +pub const JOB_OBJECT_SECURITY_ONLY_TOKEN: ::DWORD = 0x00000004; +pub const JOB_OBJECT_SECURITY_FILTER_TOKENS: ::DWORD = 0x00000008; +pub const JOB_OBJECT_SECURITY_VALID_FLAGS: ::DWORD = 0x0000000f; +pub const JOB_OBJECT_CPU_RATE_CONTROL_ENABLE: ::DWORD = 0x1; +pub const JOB_OBJECT_CPU_RATE_CONTROL_WEIGHT_BASED: ::DWORD = 0x2; +pub const JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP: ::DWORD = 0x4; +pub const JOB_OBJECT_CPU_RATE_CONTROL_NOTIFY: ::DWORD = 0x8; +pub const JOB_OBJECT_CPU_RATE_CONTROL_VALID_FLAGS: ::DWORD = 0xf; +ENUM!{enum JOBOBJECTINFOCLASS { + JobObjectBasicAccountingInformation = 1, + JobObjectBasicLimitInformation, + JobObjectBasicProcessIdList, + JobObjectBasicUIRestrictions, + JobObjectSecurityLimitInformation, + JobObjectEndOfJobTimeInformation, + JobObjectAssociateCompletionPortInformation, + JobObjectBasicAndIoAccountingInformation, + JobObjectExtendedLimitInformation, + JobObjectJobSetInformation, + JobObjectGroupInformation, + JobObjectNotificationLimitInformation, + JobObjectLimitViolationInformation, + JobObjectGroupInformationEx, + JobObjectCpuRateControlInformation, + JobObjectCompletionFilter, + JobObjectCompletionCounter, + JobObjectReserved1Information = 18, + JobObjectReserved2Information, + JobObjectReserved3Information, + JobObjectReserved4Information, + JobObjectReserved5Information, + JobObjectReserved6Information, + JobObjectReserved7Information, + JobObjectReserved8Information, + JobObjectReserved9Information, + MaxJobObjectInfoClass, +}} +//12063 +pub const SECTION_QUERY: ::DWORD = 0x0001; +pub const SECTION_MAP_WRITE: ::DWORD = 0x0002; +pub const SECTION_MAP_READ: ::DWORD = 0x0004; +pub const SECTION_MAP_EXECUTE: ::DWORD = 0x0008; +pub const SECTION_EXTEND_SIZE: ::DWORD = 0x0010; +pub const SECTION_MAP_EXECUTE_EXPLICIT: ::DWORD = 0x0020; +pub const SECTION_ALL_ACCESS: ::DWORD = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY + | SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE; +//12100 +pub const PAGE_NOACCESS: ::DWORD = 0x01; +pub const PAGE_READONLY: ::DWORD = 0x02; +pub const PAGE_READWRITE: ::DWORD = 0x04; +pub const PAGE_WRITECOPY: ::DWORD = 0x08; +pub const PAGE_EXECUTE: ::DWORD = 0x10; +pub const PAGE_EXECUTE_READ: ::DWORD = 0x20; +pub const PAGE_EXECUTE_READWRITE: ::DWORD = 0x40; +pub const PAGE_EXECUTE_WRITECOPY: ::DWORD = 0x80; +pub const PAGE_GUARD: ::DWORD = 0x100; +pub const PAGE_NOCACHE: ::DWORD = 0x200; +pub const PAGE_WRITECOMBINE: ::DWORD = 0x400; +pub const PAGE_REVERT_TO_FILE_MAP: ::DWORD = 0x80000000; +pub const PAGE_TARGETS_NO_UPDATE: ::DWORD = 0x40000000; +pub const PAGE_TARGETS_INVALID: ::DWORD = 0x40000000; +pub const MEM_COMMIT: ::DWORD = 0x1000; +pub const MEM_RESERVE: ::DWORD = 0x2000; +pub const MEM_DECOMMIT: ::DWORD = 0x4000; +pub const MEM_RELEASE: ::DWORD = 0x8000; +pub const MEM_FREE: ::DWORD = 0x10000; +pub const MEM_PRIVATE: ::DWORD = 0x20000; +pub const MEM_MAPPED: ::DWORD = 0x40000; +pub const MEM_RESET: ::DWORD = 0x80000; +pub const MEM_TOP_DOWN: ::DWORD = 0x100000; +pub const MEM_WRITE_WATCH: ::DWORD = 0x200000; +pub const MEM_PHYSICAL: ::DWORD = 0x400000; +pub const MEM_ROTATE: ::DWORD = 0x800000; +pub const MEM_DIFFERENT_IMAGE_BASE_OK: ::DWORD = 0x800000; +pub const MEM_RESET_UNDO: ::DWORD = 0x1000000; +pub const MEM_LARGE_PAGES: ::DWORD = 0x20000000; +pub const MEM_4MB_PAGES: ::DWORD = 0x80000000; +pub const SEC_FILE: ::DWORD = 0x800000; +pub const SEC_IMAGE: ::DWORD = 0x1000000; +pub const SEC_PROTECTED_IMAGE: ::DWORD = 0x2000000; +pub const SEC_RESERVE: ::DWORD = 0x4000000; +pub const SEC_COMMIT: ::DWORD = 0x8000000; +pub const SEC_NOCACHE: ::DWORD = 0x10000000; +pub const SEC_WRITECOMBINE: ::DWORD = 0x40000000; +pub const SEC_LARGE_PAGES: ::DWORD = 0x80000000; +pub const SEC_IMAGE_NO_EXECUTE: ::DWORD = (SEC_IMAGE | SEC_NOCACHE); +pub const MEM_IMAGE: ::DWORD = SEC_IMAGE; +pub const WRITE_WATCH_FLAG_RESET: ::DWORD = 0x01; +pub const MEM_UNMAP_WITH_TRANSIENT_BOOST: ::DWORD = 0x01; +//12217 +pub const FILE_READ_DATA: ::DWORD = 0x0001; +pub const FILE_LIST_DIRECTORY: ::DWORD = 0x0001; +pub const FILE_WRITE_DATA: ::DWORD = 0x0002; +pub const FILE_ADD_FILE: ::DWORD = 0x0002; +pub const FILE_APPEND_DATA: ::DWORD = 0x0004; +pub const FILE_ADD_SUBDIRECTORY: ::DWORD = 0x0004; +pub const FILE_CREATE_PIPE_INSTANCE: ::DWORD = 0x0004; +pub const FILE_READ_EA: ::DWORD = 0x0008; +pub const FILE_WRITE_EA: ::DWORD = 0x0010; +pub const FILE_EXECUTE: ::DWORD = 0x0020; +pub const FILE_TRAVERSE: ::DWORD = 0x0020; +pub const FILE_DELETE_CHILD: ::DWORD = 0x0040; +pub const FILE_READ_ATTRIBUTES: ::DWORD = 0x0080; +pub const FILE_WRITE_ATTRIBUTES: ::DWORD = 0x0100; +pub const FILE_ALL_ACCESS: ::DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF; +pub const FILE_GENERIC_READ: ::DWORD = STANDARD_RIGHTS_READ | FILE_READ_DATA + | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE; +pub const FILE_GENERIC_WRITE: ::DWORD = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA + | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE; +pub const FILE_GENERIC_EXECUTE: ::DWORD = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES + | FILE_EXECUTE | SYNCHRONIZE; +pub const FILE_SHARE_READ: ::DWORD = 0x00000001; +pub const FILE_SHARE_WRITE: ::DWORD = 0x00000002; +pub const FILE_SHARE_DELETE: ::DWORD = 0x00000004; +pub const FILE_ATTRIBUTE_READONLY: ::DWORD = 0x00000001; +pub const FILE_ATTRIBUTE_HIDDEN: ::DWORD = 0x00000002; +pub const FILE_ATTRIBUTE_SYSTEM: ::DWORD = 0x00000004; +pub const FILE_ATTRIBUTE_DIRECTORY: ::DWORD = 0x00000010; +pub const FILE_ATTRIBUTE_ARCHIVE: ::DWORD = 0x00000020; +pub const FILE_ATTRIBUTE_DEVICE: ::DWORD = 0x00000040; +pub const FILE_ATTRIBUTE_NORMAL: ::DWORD = 0x00000080; +pub const FILE_ATTRIBUTE_TEMPORARY: ::DWORD = 0x00000100; +pub const FILE_ATTRIBUTE_SPARSE_FILE: ::DWORD = 0x00000200; +pub const FILE_ATTRIBUTE_REPARSE_POINT: ::DWORD = 0x00000400; +pub const FILE_ATTRIBUTE_COMPRESSED: ::DWORD = 0x00000800; +pub const FILE_ATTRIBUTE_OFFLINE: ::DWORD = 0x00001000; +pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: ::DWORD = 0x00002000; +pub const FILE_ATTRIBUTE_ENCRYPTED: ::DWORD = 0x00004000; +pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: ::DWORD = 0x00008000; +pub const FILE_ATTRIBUTE_VIRTUAL: ::DWORD = 0x00010000; +pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: ::DWORD = 0x00020000; +pub const FILE_ATTRIBUTE_EA: ::DWORD = 0x00040000; +pub const FILE_NOTIFY_CHANGE_FILE_NAME: ::DWORD = 0x00000001; +pub const FILE_NOTIFY_CHANGE_DIR_NAME: ::DWORD = 0x00000002; +pub const FILE_NOTIFY_CHANGE_ATTRIBUTES: ::DWORD = 0x00000004; +pub const FILE_NOTIFY_CHANGE_SIZE: ::DWORD = 0x00000008; +pub const FILE_NOTIFY_CHANGE_LAST_WRITE: ::DWORD = 0x00000010; +pub const FILE_NOTIFY_CHANGE_LAST_ACCESS: ::DWORD = 0x00000020; +pub const FILE_NOTIFY_CHANGE_CREATION: ::DWORD = 0x00000040; +pub const FILE_NOTIFY_CHANGE_SECURITY: ::DWORD = 0x00000100; +pub const FILE_ACTION_ADDED: ::DWORD = 0x00000001; +pub const FILE_ACTION_REMOVED: ::DWORD = 0x00000002; +pub const FILE_ACTION_MODIFIED: ::DWORD = 0x00000003; +pub const FILE_ACTION_RENAMED_OLD_NAME: ::DWORD = 0x00000004; +pub const FILE_ACTION_RENAMED_NEW_NAME: ::DWORD = 0x00000005; +pub const MAILSLOT_NO_MESSAGE: ::DWORD = 0xFFFFFFFF; +pub const MAILSLOT_WAIT_FOREVER: ::DWORD = 0xFFFFFFFF; +pub const FILE_CASE_SENSITIVE_SEARCH: ::DWORD = 0x00000001; +pub const FILE_CASE_PRESERVED_NAMES: ::DWORD = 0x00000002; +pub const FILE_UNICODE_ON_DISK: ::DWORD = 0x00000004; +pub const FILE_PERSISTENT_ACLS: ::DWORD = 0x00000008; +pub const FILE_FILE_COMPRESSION: ::DWORD = 0x00000010; +pub const FILE_VOLUME_QUOTAS: ::DWORD = 0x00000020; +pub const FILE_SUPPORTS_SPARSE_FILES: ::DWORD = 0x00000040; +pub const FILE_SUPPORTS_REPARSE_POINTS: ::DWORD = 0x00000080; +pub const FILE_SUPPORTS_REMOTE_STORAGE: ::DWORD = 0x00000100; +pub const FILE_VOLUME_IS_COMPRESSED: ::DWORD = 0x00008000; +pub const FILE_SUPPORTS_OBJECT_IDS: ::DWORD = 0x00010000; +pub const FILE_SUPPORTS_ENCRYPTION: ::DWORD = 0x00020000; +pub const FILE_NAMED_STREAMS: ::DWORD = 0x00040000; +pub const FILE_READ_ONLY_VOLUME: ::DWORD = 0x00080000; +pub const FILE_SEQUENTIAL_WRITE_ONCE: ::DWORD = 0x00100000; +pub const FILE_SUPPORTS_TRANSACTIONS: ::DWORD = 0x00200000; +pub const FILE_SUPPORTS_HARD_LINKS: ::DWORD = 0x00400000; +pub const FILE_SUPPORTS_EXTENDED_ATTRIBUTES: ::DWORD = 0x00800000; +pub const FILE_SUPPORTS_OPEN_BY_FILE_ID: ::DWORD = 0x01000000; +pub const FILE_SUPPORTS_USN_JOURNAL: ::DWORD = 0x02000000; +pub const FILE_SUPPORTS_INTEGRITY_STREAMS: ::DWORD = 0x04000000; +pub const FILE_INVALID_FILE_ID: ::LONGLONG = -1; +STRUCT!{struct FILE_ID_128 { + Identifier: [::BYTE; 16], +}} +pub type PFILE_ID_128 = *mut FILE_ID_128; +STRUCT!{struct FILE_NOTIFY_INFORMATION { + NextEntryOffset: ::DWORD, + Action: ::DWORD, + FileNameLength: ::DWORD, + FileName: [::WCHAR; 0], +}} +STRUCT!{struct FILE_SEGMENT_ELEMENT { + Buffer: ::PVOID64, + Alignment: ::ULONGLONG, +}} +pub type PFILE_SEGMENT_ELEMENT = *mut FILE_SEGMENT_ELEMENT; +//12475 +pub const IO_REPARSE_TAG_MOUNT_POINT: ::DWORD = 0xA0000003; +pub const IO_REPARSE_TAG_HSM: ::DWORD = 0xC0000004; +pub const IO_REPARSE_TAG_HSM2: ::DWORD = 0x80000006; +pub const IO_REPARSE_TAG_SIS: ::DWORD = 0x80000007; +pub const IO_REPARSE_TAG_WIM: ::DWORD = 0x80000008; +pub const IO_REPARSE_TAG_CSV: ::DWORD = 0x80000009; +pub const IO_REPARSE_TAG_DFS: ::DWORD = 0x8000000A; +pub const IO_REPARSE_TAG_SYMLINK: ::DWORD = 0xA000000C; +pub const IO_REPARSE_TAG_DFSR: ::DWORD = 0x80000012; +pub const IO_REPARSE_TAG_DEDUP: ::DWORD = 0x80000013; +pub const IO_REPARSE_TAG_NFS: ::DWORD = 0x80000014; +pub const IO_REPARSE_TAG_FILE_PLACEHOLDER: ::DWORD = 0x80000015; +pub const IO_REPARSE_TAG_WOF: ::DWORD = 0x80000017; +//12788 +pub const DUPLICATE_CLOSE_SOURCE: ::DWORD = 0x00000001; +pub const DUPLICATE_SAME_ACCESS: ::DWORD = 0x00000002; +//14708 +STRUCT!{struct PROCESSOR_POWER_POLICY_INFO { + TimeCheck: ::DWORD, + DemoteLimit: ::DWORD, + PromoteLimit: ::DWORD, + DemotePercent: ::BYTE, + PromotePercent: ::BYTE, + Spare: [::BYTE; 2], + Reserved: ::DWORD, +}} +BITFIELD!(PROCESSOR_POWER_POLICY_INFO Reserved: ::DWORD [ + AllowDemotion set_AllowDemotion[0..1], + AllowPromotion set_AllowPromotion[1..2], +]); +pub type PPROCESSOR_POWER_POLICY_INFO = *mut PROCESSOR_POWER_POLICY_INFO; +//15000 +STRUCT!{struct IMAGE_FILE_HEADER { + Machine: ::WORD, + NumberOfSections: ::WORD, + TimeDateStamp: ::DWORD, + PointerToSymbolTable: ::DWORD, + NumberOfSymbols: ::DWORD, + SizeOfOptionalHeader: ::WORD, + Characteristics: ::WORD, +}} +pub type PIMAGE_FILE_HEADER = *mut IMAGE_FILE_HEADER; +pub const IMAGE_SIZEOF_FILE_HEADER: usize = 20; +pub const IMAGE_FILE_RELOCS_STRIPPED: ::WORD = 0x0001; +pub const IMAGE_FILE_EXECUTABLE_IMAGE: ::WORD = 0x0002; +pub const IMAGE_FILE_LINE_NUMS_STRIPPED: ::WORD = 0x0004; +pub const IMAGE_FILE_LOCAL_SYMS_STRIPPED: ::WORD = 0x0008; +pub const IMAGE_FILE_AGGRESIVE_WS_TRIM: ::WORD = 0x0010; +pub const IMAGE_FILE_LARGE_ADDRESS_AWARE: ::WORD = 0x0020; +pub const IMAGE_FILE_BYTES_REVERSED_LO: ::WORD = 0x0080; +pub const IMAGE_FILE_32BIT_MACHINE: ::WORD = 0x0100; +pub const IMAGE_FILE_DEBUG_STRIPPED: ::WORD = 0x0200; +pub const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP: ::WORD = 0x0400; +pub const IMAGE_FILE_NET_RUN_FROM_SWAP: ::WORD = 0x0800; +pub const IMAGE_FILE_SYSTEM: ::WORD = 0x1000; +pub const IMAGE_FILE_DLL: ::WORD = 0x2000; +pub const IMAGE_FILE_UP_SYSTEM_ONLY: ::WORD = 0x4000; +pub const IMAGE_FILE_BYTES_REVERSED_HI: ::WORD = 0x8000; +pub const IMAGE_FILE_MACHINE_UNKNOWN: ::WORD = 0; +pub const IMAGE_FILE_MACHINE_I386: ::WORD = 0x014c; +pub const IMAGE_FILE_MACHINE_R3000: ::WORD = 0x0162; +pub const IMAGE_FILE_MACHINE_R4000: ::WORD = 0x0166; +pub const IMAGE_FILE_MACHINE_R10000: ::WORD = 0x0168; +pub const IMAGE_FILE_MACHINE_WCEMIPSV2: ::WORD = 0x0169; +pub const IMAGE_FILE_MACHINE_ALPHA: ::WORD = 0x0184; +pub const IMAGE_FILE_MACHINE_SH3: ::WORD = 0x01a2; +pub const IMAGE_FILE_MACHINE_SH3DSP: ::WORD = 0x01a3; +pub const IMAGE_FILE_MACHINE_SH3E: ::WORD = 0x01a4; +pub const IMAGE_FILE_MACHINE_SH4: ::WORD = 0x01a6; +pub const IMAGE_FILE_MACHINE_SH5: ::WORD = 0x01a8; +pub const IMAGE_FILE_MACHINE_ARM: ::WORD = 0x01c0; +pub const IMAGE_FILE_MACHINE_THUMB: ::WORD = 0x01c2; +pub const IMAGE_FILE_MACHINE_ARMNT: ::WORD = 0x01c4; +pub const IMAGE_FILE_MACHINE_AM33: ::WORD = 0x01d3; +pub const IMAGE_FILE_MACHINE_POWERPC: ::WORD = 0x01F0; +pub const IMAGE_FILE_MACHINE_POWERPCFP: ::WORD = 0x01f1; +pub const IMAGE_FILE_MACHINE_IA64: ::WORD = 0x0200; +pub const IMAGE_FILE_MACHINE_MIPS16: ::WORD = 0x0266; +pub const IMAGE_FILE_MACHINE_ALPHA64: ::WORD = 0x0284; +pub const IMAGE_FILE_MACHINE_MIPSFPU: ::WORD = 0x0366; +pub const IMAGE_FILE_MACHINE_MIPSFPU16: ::WORD = 0x0466; +pub const IMAGE_FILE_MACHINE_AXP64: ::WORD = IMAGE_FILE_MACHINE_ALPHA64; +pub const IMAGE_FILE_MACHINE_TRICORE: ::WORD = 0x0520; +pub const IMAGE_FILE_MACHINE_CEF: ::WORD = 0x0CEF; +pub const IMAGE_FILE_MACHINE_EBC: ::WORD = 0x0EBC; +pub const IMAGE_FILE_MACHINE_AMD64: ::WORD = 0x8664; +pub const IMAGE_FILE_MACHINE_M32R: ::WORD = 0x9041; +pub const IMAGE_FILE_MACHINE_CEE: ::WORD = 0xC0EE; +STRUCT!{struct IMAGE_DATA_DIRECTORY { + VirtualAddress: ::DWORD, + Size: ::DWORD, +}} +pub type PIMAGE_DATA_DIRECTORY = *mut IMAGE_DATA_DIRECTORY; +pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES: usize = 16; +STRUCT!{struct IMAGE_OPTIONAL_HEADER32 { + Magic: ::WORD, + MajorLinkerVersion: ::BYTE, + MinorLinkerVersion: ::BYTE, + SizeOfCode: ::DWORD, + SizeOfInitializedData: ::DWORD, + SizeOfUninitializedData: ::DWORD, + AddressOfEntryPoint: ::DWORD, + BaseOfCode: ::DWORD, + BaseOfData: ::DWORD, + ImageBase: ::DWORD, + SectionAlignment: ::DWORD, + FileAlignment: ::DWORD, + MajorOperatingSystemVersion: ::WORD, + MinorOperatingSystemVersion: ::WORD, + MajorImageVersion: ::WORD, + MinorImageVersion: ::WORD, + MajorSubsystemVersion: ::WORD, + MinorSubsystemVersion: ::WORD, + Win32VersionValue: ::DWORD, + SizeOfImage: ::DWORD, + SizeOfHeaders: ::DWORD, + CheckSum: ::DWORD, + Subsystem: ::WORD, + DllCharacteristics: ::WORD, + SizeOfStackReserve: ::DWORD, + SizeOfStackCommit: ::DWORD, + SizeOfHeapReserve: ::DWORD, + SizeOfHeapCommit: ::DWORD, + LoaderFlags: ::DWORD, + NumberOfRvaAndSizes: ::DWORD, + DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES], +}} +pub type PIMAGE_OPTIONAL_HEADER32 = *mut IMAGE_OPTIONAL_HEADER32; +STRUCT!{struct IMAGE_ROM_OPTIONAL_HEADER { + Magic: ::WORD, + MajorLinkerVersion: ::BYTE, + MinorLinkerVersion: ::BYTE, + SizeOfCode: ::DWORD, + SizeOfInitializedData: ::DWORD, + SizeOfUninitializedData: ::DWORD, + AddressOfEntryPoint: ::DWORD, + BaseOfCode: ::DWORD, + BaseOfData: ::DWORD, + BaseOfBss: ::DWORD, + GprMask: ::DWORD, + CprMask: [::DWORD; 4], + GpValue: ::DWORD, +}} +pub type PIMAGE_ROM_OPTIONAL_HEADER = *mut IMAGE_ROM_OPTIONAL_HEADER; +STRUCT!{struct IMAGE_OPTIONAL_HEADER64 { + Magic: ::WORD, + MajorLinkerVersion: ::BYTE, + MinorLinkerVersion: ::BYTE, + SizeOfCode: ::DWORD, + SizeOfInitializedData: ::DWORD, + SizeOfUninitializedData: ::DWORD, + AddressOfEntryPoint: ::DWORD, + BaseOfCode: ::DWORD, + ImageBase: ::ULONGLONG, + SectionAlignment: ::DWORD, + FileAlignment: ::DWORD, + MajorOperatingSystemVersion: ::WORD, + MinorOperatingSystemVersion: ::WORD, + MajorImageVersion: ::WORD, + MinorImageVersion: ::WORD, + MajorSubsystemVersion: ::WORD, + MinorSubsystemVersion: ::WORD, + Win32VersionValue: ::DWORD, + SizeOfImage: ::DWORD, + SizeOfHeaders: ::DWORD, + CheckSum: ::DWORD, + Subsystem: ::WORD, + DllCharacteristics: ::WORD, + SizeOfStackReserve: ULONGLONG, + SizeOfStackCommit: ULONGLONG, + SizeOfHeapReserve: ULONGLONG, + SizeOfHeapCommit: ULONGLONG, + LoaderFlags: ::DWORD, + NumberOfRvaAndSizes: ::DWORD, + DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES], +}} +pub type PIMAGE_OPTIONAL_HEADER64 = *mut IMAGE_OPTIONAL_HEADER64; +pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC: ::WORD = 0x10b; +pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC: ::WORD = 0x20b; +pub const IMAGE_ROM_OPTIONAL_HDR_MAGIC: ::WORD = 0x107; +#[cfg(target_arch = "x86_64")] +pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER64; +#[cfg(target_arch = "x86_64")] +pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER64; +#[cfg(target_arch = "x86")] +pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32; +#[cfg(target_arch = "x86")] +pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER32; +STRUCT!{struct IMAGE_NT_HEADERS64 { + Signature: ::DWORD, + FileHeader: IMAGE_FILE_HEADER, + OptionalHeader: IMAGE_OPTIONAL_HEADER64, +}} +pub type PIMAGE_NT_HEADERS64 = *mut IMAGE_NT_HEADERS64; +STRUCT!{struct IMAGE_NT_HEADERS32 { + Signature: ::DWORD, + FileHeader: IMAGE_FILE_HEADER, + OptionalHeader: IMAGE_OPTIONAL_HEADER32, +}} +pub type PIMAGE_NT_HEADERS32 = *mut IMAGE_NT_HEADERS32; +STRUCT!{struct IMAGE_ROM_HEADERS { + FileHeader: IMAGE_FILE_HEADER, + OptionalHeader: IMAGE_ROM_OPTIONAL_HEADER, +}} +pub type PIMAGE_ROM_HEADERS = *mut IMAGE_ROM_HEADERS; +#[cfg(target_arch = "x86_64")] +pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS64; +#[cfg(target_arch = "x86_64")] +pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS64; +#[cfg(target_arch = "x86")] +pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32; +#[cfg(target_arch = "x86")] +pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS32; +pub const IMAGE_SUBSYSTEM_UNKNOWN: ::WORD = 0; +pub const IMAGE_SUBSYSTEM_NATIVE: ::WORD = 1; +pub const IMAGE_SUBSYSTEM_WINDOWS_GUI: ::WORD = 2; +pub const IMAGE_SUBSYSTEM_WINDOWS_CUI: ::WORD = 3; +pub const IMAGE_SUBSYSTEM_OS2_CUI: ::WORD = 5; +pub const IMAGE_SUBSYSTEM_POSIX_CUI: ::WORD = 7; +pub const IMAGE_SUBSYSTEM_NATIVE_WINDOWS: ::WORD = 8; +pub const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: ::WORD = 9; +pub const IMAGE_SUBSYSTEM_EFI_APPLICATION: ::WORD = 10; +pub const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER: ::WORD = 11; +pub const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: ::WORD = 12; +pub const IMAGE_SUBSYSTEM_EFI_ROM: ::WORD = 13; +pub const IMAGE_SUBSYSTEM_XBOX: ::WORD = 14; +pub const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION: ::WORD = 16; +pub const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA: ::WORD = 0x0020; +pub const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE: ::WORD = 0x0040; +pub const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY: ::WORD = 0x0080; +pub const IMAGE_DLLCHARACTERISTICS_NX_COMPAT: ::WORD = 0x0100; +pub const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION: ::WORD = 0x0200; +pub const IMAGE_DLLCHARACTERISTICS_NO_SEH: ::WORD = 0x0400; +pub const IMAGE_DLLCHARACTERISTICS_NO_BIND: ::WORD = 0x0800; +pub const IMAGE_DLLCHARACTERISTICS_APPCONTAINER: ::WORD = 0x1000; +pub const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER: ::WORD = 0x2000; +pub const IMAGE_DLLCHARACTERISTICS_GUARD_CF: ::WORD = 0x4000; +pub const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE: ::WORD = 0x8000; +pub const IMAGE_DIRECTORY_ENTRY_EXPORT: ::WORD = 0; +pub const IMAGE_DIRECTORY_ENTRY_IMPORT: ::WORD = 1; +pub const IMAGE_DIRECTORY_ENTRY_RESOURCE: ::WORD = 2; +pub const IMAGE_DIRECTORY_ENTRY_EXCEPTION: ::WORD = 3; +pub const IMAGE_DIRECTORY_ENTRY_SECURITY: ::WORD = 4; +pub const IMAGE_DIRECTORY_ENTRY_BASERELOC: ::WORD = 5; +pub const IMAGE_DIRECTORY_ENTRY_DEBUG: ::WORD = 6; +pub const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE: ::WORD = 7; +pub const IMAGE_DIRECTORY_ENTRY_GLOBALPTR: ::WORD = 8; +pub const IMAGE_DIRECTORY_ENTRY_TLS: ::WORD = 9; +pub const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG: ::WORD = 10; +pub const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT: ::WORD = 11; +pub const IMAGE_DIRECTORY_ENTRY_IAT: ::WORD = 12; +pub const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT: ::WORD = 13; +pub const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR: ::WORD = 14; +STRUCT!{struct ANON_OBJECT_HEADER { + Sig1: ::WORD, + Sig2: ::WORD, + Version: ::WORD, + Machine: ::WORD, + TimeDateStamp: ::DWORD, + ClassID: ::CLSID, + SizeOfData: ::DWORD, +}} +STRUCT!{struct ANON_OBJECT_HEADER_V2 { + Sig1: ::WORD, + Sig2: ::WORD, + Version: ::WORD, + Machine: ::WORD, + TimeDateStamp: ::DWORD, + ClassID: ::CLSID, + SizeOfData: ::DWORD, + Flags: ::DWORD, + MetaDataSize: ::DWORD, + MetaDataOffset: ::DWORD, +}} +STRUCT!{struct ANON_OBJECT_HEADER_BIGOBJ { + Sig1: ::WORD, + Sig2: ::WORD, + Version: ::WORD, + Machine: ::WORD, + TimeDateStamp: ::DWORD, + ClassID: ::CLSID, + SizeOfData: ::DWORD, + Flags: ::DWORD, + MetaDataSize: ::DWORD, + MetaDataOffset: ::DWORD, + NumberOfSections: ::DWORD, + PointerToSymbolTable: ::DWORD, + NumberOfSymbols: ::DWORD, +}} +pub const IMAGE_SIZEOF_SHORT_NAME: usize = 8; +STRUCT!{struct IMAGE_SECTION_HEADER { + Name: [::BYTE; IMAGE_SIZEOF_SHORT_NAME], + PhysicalAddressOrVirtualSize: ::DWORD, + VirtualAddress: ::DWORD, + SizeOfRawData: ::DWORD, + PointerToRawData: ::DWORD, + PointerToRelocations: ::DWORD, + PointerToLinenumbers: ::DWORD, + NumberOfRelocations: ::WORD, + NumberOfLinenumbers: ::WORD, + Characteristics: ::DWORD, +}} +pub type PIMAGE_SECTION_HEADER = *mut IMAGE_SECTION_HEADER; +pub const IMAGE_SIZEOF_SECTION_HEADER: usize = 40; +pub const IMAGE_SCN_TYPE_NO_PAD: ::DWORD = 0x00000008; +pub const IMAGE_SCN_CNT_CODE: ::DWORD = 0x00000020; +pub const IMAGE_SCN_CNT_INITIALIZED_DATA: ::DWORD = 0x00000040; +pub const IMAGE_SCN_CNT_UNINITIALIZED_DATA: ::DWORD = 0x00000080; +pub const IMAGE_SCN_LNK_OTHER: ::DWORD = 0x00000100; +pub const IMAGE_SCN_LNK_INFO: ::DWORD = 0x00000200; +pub const IMAGE_SCN_LNK_REMOVE: ::DWORD = 0x00000800; +pub const IMAGE_SCN_LNK_COMDAT: ::DWORD = 0x00001000; +pub const IMAGE_SCN_NO_DEFER_SPEC_EXC: ::DWORD = 0x00004000; +pub const IMAGE_SCN_GPREL: ::DWORD = 0x00008000; +pub const IMAGE_SCN_MEM_FARDATA: ::DWORD = 0x00008000; +pub const IMAGE_SCN_MEM_PURGEABLE: ::DWORD = 0x00020000; +pub const IMAGE_SCN_MEM_16BIT: ::DWORD = 0x00020000; +pub const IMAGE_SCN_MEM_LOCKED: ::DWORD = 0x00040000; +pub const IMAGE_SCN_MEM_PRELOAD: ::DWORD = 0x00080000; +pub const IMAGE_SCN_ALIGN_1BYTES: ::DWORD = 0x00100000; +pub const IMAGE_SCN_ALIGN_2BYTES: ::DWORD = 0x00200000; +pub const IMAGE_SCN_ALIGN_4BYTES: ::DWORD = 0x00300000; +pub const IMAGE_SCN_ALIGN_8BYTES: ::DWORD = 0x00400000; +pub const IMAGE_SCN_ALIGN_16BYTES: ::DWORD = 0x00500000; +pub const IMAGE_SCN_ALIGN_32BYTES: ::DWORD = 0x00600000; +pub const IMAGE_SCN_ALIGN_64BYTES: ::DWORD = 0x00700000; +pub const IMAGE_SCN_ALIGN_128BYTES: ::DWORD = 0x00800000; +pub const IMAGE_SCN_ALIGN_256BYTES: ::DWORD = 0x00900000; +pub const IMAGE_SCN_ALIGN_512BYTES: ::DWORD = 0x00A00000; +pub const IMAGE_SCN_ALIGN_1024BYTES: ::DWORD = 0x00B00000; +pub const IMAGE_SCN_ALIGN_2048BYTES: ::DWORD = 0x00C00000; +pub const IMAGE_SCN_ALIGN_4096BYTES: ::DWORD = 0x00D00000; +pub const IMAGE_SCN_ALIGN_8192BYTES: ::DWORD = 0x00E00000; +pub const IMAGE_SCN_ALIGN_MASK: ::DWORD = 0x00F00000; +pub const IMAGE_SCN_LNK_NRELOC_OVFL: ::DWORD = 0x01000000; +pub const IMAGE_SCN_MEM_DISCARDABLE: ::DWORD = 0x02000000; +pub const IMAGE_SCN_MEM_NOT_CACHED: ::DWORD = 0x04000000; +pub const IMAGE_SCN_MEM_NOT_PAGED: ::DWORD = 0x08000000; +pub const IMAGE_SCN_MEM_SHARED: ::DWORD = 0x10000000; +pub const IMAGE_SCN_MEM_EXECUTE: ::DWORD = 0x20000000; +pub const IMAGE_SCN_MEM_READ: ::DWORD = 0x40000000; +pub const IMAGE_SCN_MEM_WRITE: ::DWORD = 0x80000000; +pub const IMAGE_SCN_SCALE_INDEX: ::DWORD = 0x00000001; +//16590 +STRUCT!{struct IMAGE_DEBUG_DIRECTORY { + Characteristics: ::DWORD, + TimeDateStamp: ::DWORD, + MajorVersion: ::WORD, + MinorVersion: ::WORD, + Type: ::DWORD, + SizeOfData: ::DWORD, + AddressOfRawData: ::DWORD, + PointerToRawData: ::DWORD, +}} +pub type PIMAGE_DEBUG_DIRECTORY = *mut IMAGE_DEBUG_DIRECTORY; +pub const IMAGE_DEBUG_TYPE_UNKNOWN: ::DWORD = 0; +pub const IMAGE_DEBUG_TYPE_COFF: ::DWORD = 1; +pub const IMAGE_DEBUG_TYPE_CODEVIEW: ::DWORD = 2; +pub const IMAGE_DEBUG_TYPE_FPO: ::DWORD = 3; +pub const IMAGE_DEBUG_TYPE_MISC: ::DWORD = 4; +pub const IMAGE_DEBUG_TYPE_EXCEPTION: ::DWORD = 5; +pub const IMAGE_DEBUG_TYPE_FIXUP: ::DWORD = 6; +pub const IMAGE_DEBUG_TYPE_OMAP_TO_SRC: ::DWORD = 7; +pub const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: ::DWORD = 8; +pub const IMAGE_DEBUG_TYPE_BORLAND: ::DWORD = 9; +pub const IMAGE_DEBUG_TYPE_RESERVED10: ::DWORD = 10; +pub const IMAGE_DEBUG_TYPE_CLSID: ::DWORD = 11; +STRUCT!{struct IMAGE_COFF_SYMBOLS_HEADER { + NumberOfSymbols: ::DWORD, + LvaToFirstSymbol: ::DWORD, + NumberOfLinenumbers: ::DWORD, + LvaToFirstLinenumber: ::DWORD, + RvaToFirstByteOfCode: ::DWORD, + RvaToLastByteOfCode: ::DWORD, + RvaToFirstByteOfData: ::DWORD, + RvaToLastByteOfData: ::DWORD, +}} +pub type PIMAGE_COFF_SYMBOLS_HEADER = *mut IMAGE_COFF_SYMBOLS_HEADER; +STRUCT!{struct IMAGE_RUNTIME_FUNCTION_ENTRY { + BeginAddress: ::DWORD, + EndAddress: ::DWORD, + UnwindInfoAddress: ::DWORD, +}} +UNION!(IMAGE_RUNTIME_FUNCTION_ENTRY, UnwindInfoAddress, UnwindData, UnwindData_mut, ::DWORD); +pub type PIMAGE_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_RUNTIME_FUNCTION_ENTRY; +pub const FRAME_FPO: ::WORD = 0; +pub const FRAME_TRAP: ::WORD = 1; +pub const FRAME_TSS: ::WORD = 2; +pub const FRAME_NONFPO: ::WORD = 3; +STRUCT!{struct FPO_DATA { + ulOffStart: ::DWORD, + cbProcSize: ::DWORD, + cdwLocals: ::DWORD, + cdwParams: ::WORD, + bitfield: ::WORD, +}} +pub type PFPO_DATA = *mut FPO_DATA; +pub const SIZEOF_RFPO_DATA: usize = 16; +pub const IMAGE_DEBUG_MISC_EXENAME: ::DWORD = 1; +STRUCT!{struct IMAGE_DEBUG_MISC { + DataType: ::DWORD, + Length: ::DWORD, + Unicode: ::BOOLEAN, + Reserved: [::BYTE; 3], + Data: [::BYTE; 0], +}} +pub type PIMAGE_DEBUG_MISC = *mut IMAGE_DEBUG_MISC; +STRUCT!{struct IMAGE_FUNCTION_ENTRY { + StartingAddress: ::DWORD, + EndingAddress: ::DWORD, + EndOfPrologue: ::DWORD, +}} +pub type PIMAGE_FUNCTION_ENTRY = *mut IMAGE_FUNCTION_ENTRY; +STRUCT!{struct IMAGE_FUNCTION_ENTRY64 { + StartingAddress: ::ULONGLONG, + EndingAddress: ::ULONGLONG, + EndOfPrologueOrUnwindInfoAddress: ::ULONGLONG, +}} +pub type PIMAGE_FUNCTION_ENTRY64 = *mut IMAGE_FUNCTION_ENTRY64; +//18245 +pub const HEAP_NO_SERIALIZE: ::DWORD = 0x00000001; +pub const HEAP_GROWABLE: ::DWORD = 0x00000002; +pub const HEAP_GENERATE_EXCEPTIONS: ::DWORD = 0x00000004; +pub const HEAP_ZERO_MEMORY: ::DWORD = 0x00000008; +pub const HEAP_REALLOC_IN_PLACE_ONLY: ::DWORD = 0x00000010; +pub const HEAP_TAIL_CHECKING_ENABLED: ::DWORD = 0x00000020; +pub const HEAP_FREE_CHECKING_ENABLED: ::DWORD = 0x00000040; +pub const HEAP_DISABLE_COALESCE_ON_FREE: ::DWORD = 0x00000080; +pub const HEAP_CREATE_ALIGN_16: ::DWORD = 0x00010000; +pub const HEAP_CREATE_ENABLE_TRACING: ::DWORD = 0x00020000; +pub const HEAP_CREATE_ENABLE_EXECUTE: ::DWORD = 0x00040000; +pub const HEAP_MAXIMUM_TAG: ::DWORD = 0x0FFF; +pub const HEAP_PSEUDO_TAG_FLAG: ::DWORD = 0x8000; +pub const HEAP_TAG_SHIFT: ::DWORD = 18; +//18145 +STRUCT!{struct RTL_CRITICAL_SECTION_DEBUG { + Type: ::WORD, + CreatorBackTraceIndex: ::WORD, + CriticalSection: *mut ::RTL_CRITICAL_SECTION, + ProcessLocksList: ::LIST_ENTRY, + EntryCount: ::DWORD, + ContentionCount: ::DWORD, + Flags: ::DWORD, + CreatorBackTraceIndexHigh: ::WORD, + SpareWORD: ::WORD, +}} +pub type PRTL_CRITICAL_SECTION_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG; +pub type RTL_RESOURCE_DEBUG = RTL_CRITICAL_SECTION_DEBUG; +pub type PRTL_RESOURCE_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG; +pub const RTL_CRITSECT_TYPE: ::WORD = 0; +pub const RTL_RESOURCE_TYPE: ::WORD = 1; +pub const RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO: ::ULONG_PTR = 0x01000000; +pub const RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN: ::ULONG_PTR = 0x02000000; +pub const RTL_CRITICAL_SECTION_FLAG_STATIC_INIT: ::ULONG_PTR = 0x04000000; +pub const RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE: ::ULONG_PTR = 0x08000000; +pub const RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO: ::ULONG_PTR = 0x10000000; +pub const RTL_CRITICAL_SECTION_ALL_FLAG_BITS: ::ULONG_PTR = 0xFF000000; +pub const RTL_CRITICAL_SECTION_FLAG_RESERVED: ::ULONG_PTR = RTL_CRITICAL_SECTION_ALL_FLAG_BITS & !(RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO | RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN | RTL_CRITICAL_SECTION_FLAG_STATIC_INIT | RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE | RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); +pub const RTL_CRITICAL_SECTION_DEBUG_FLAG_STATIC_INIT: ::DWORD = 0x00000001; +STRUCT!{struct RTL_CRITICAL_SECTION { + DebugInfo: ::PRTL_CRITICAL_SECTION_DEBUG, + LockCount: ::LONG, + RecursionCount: ::LONG, + OwningThread: ::HANDLE, + LockSemaphore: ::HANDLE, + SpinCount: ::ULONG_PTR, +}} +pub type PRTL_CRITICAL_SECTION = *mut RTL_CRITICAL_SECTION; +STRUCT!{struct RTL_SRWLOCK { + Ptr: ::PVOID, +}} +pub type PRTL_SRWLOCK = *mut RTL_SRWLOCK; +pub const RTL_SRWLOCK_INIT: RTL_SRWLOCK = RTL_SRWLOCK { Ptr: 0 as PVOID }; +STRUCT!{struct RTL_CONDITION_VARIABLE { + Ptr: ::PVOID, +}} +pub type PRTL_CONDITION_VARIABLE = *mut RTL_CONDITION_VARIABLE; +pub const RTL_CONDITION_VARIABLE_INIT: RTL_CONDITION_VARIABLE = RTL_CONDITION_VARIABLE { + Ptr: 0 as PVOID +}; +//18204 +pub type PAPCFUNC = Option; +pub type PVECTORED_EXCEPTION_HANDLER = Option ::LONG>; +ENUM!{enum HEAP_INFORMATION_CLASS { + HeapCompatibilityInformation = 0, + HeapEnableTerminationOnCorruption = 1, + HeapOptimizeResources = 3, +}} +//pub use self::HEAP_INFORMATION_CLASS::*; +pub const HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION: ::DWORD = 1; +STRUCT!{struct HEAP_OPTIMIZE_RESOURCES_INFORMATION { + Version: ::DWORD, + Flags: ::DWORD, +}} +pub type PHEAP_OPTIMIZE_RESOURCES_INFORMATION = *mut HEAP_OPTIMIZE_RESOURCES_INFORMATION; +pub const WT_EXECUTEDEFAULT: ::ULONG = 0x00000000; +pub const WT_EXECUTEINIOTHREAD: ::ULONG = 0x00000001; +pub const WT_EXECUTEINUITHREAD: ::ULONG = 0x00000002; +pub const WT_EXECUTEINWAITTHREAD: ::ULONG = 0x00000004; +pub const WT_EXECUTEONLYONCE: ::ULONG = 0x00000008; +pub const WT_EXECUTEINTIMERTHREAD: ::ULONG = 0x00000020; +pub const WT_EXECUTELONGFUNCTION: ::ULONG = 0x00000010; +pub const WT_EXECUTEINPERSISTENTIOTHREAD: ::ULONG = 0x00000040; +pub const WT_EXECUTEINPERSISTENTTHREAD: ::ULONG = 0x00000080; +pub const WT_TRANSFER_IMPERSONATION: ::ULONG = 0x00000100; +pub type WAITORTIMERCALLBACKFUNC = Option; +pub type WORKERCALLBACKFUNC = Option; +pub type APC_CALLBACK_FUNCTION = Option; +pub type WAITORTIMERCALLBACK = WAITORTIMERCALLBACKFUNC; +pub type PFLS_CALLBACK_FUNCTION = Option; +pub type PSECURE_MEMORY_CACHE_CALLBACK = Option ::BOOLEAN>; +pub const WT_EXECUTEINLONGTHREAD: ::ULONG = 0x00000010; +pub const WT_EXECUTEDELETEWAIT: ::ULONG = 0x00000008; +//18570 +pub const KEY_QUERY_VALUE: ::REGSAM = 0x0001; +pub const KEY_SET_VALUE: ::REGSAM = 0x0002; +pub const KEY_CREATE_SUB_KEY: ::REGSAM = 0x0004; +pub const KEY_ENUMERATE_SUB_KEYS: ::REGSAM = 0x0008; +pub const KEY_NOTIFY: ::REGSAM = 0x0010; +pub const KEY_CREATE_LINK: ::REGSAM = 0x0020; +pub const KEY_WOW64_32KEY: ::REGSAM = 0x0200; +pub const KEY_WOW64_64KEY: ::REGSAM = 0x0100; +pub const KEY_WOW64_RES: ::REGSAM = 0x0300; +pub const KEY_READ: ::REGSAM = ( + STANDARD_RIGHTS_READ | + KEY_QUERY_VALUE | + KEY_ENUMERATE_SUB_KEYS | + KEY_NOTIFY + ) & (!SYNCHRONIZE); +pub const KEY_WRITE: ::REGSAM = (STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (!SYNCHRONIZE); +pub const KEY_EXECUTE: ::REGSAM = KEY_READ & (!SYNCHRONIZE); +pub const KEY_ALL_ACCESS: ::REGSAM = ( + STANDARD_RIGHTS_ALL | + KEY_QUERY_VALUE | + KEY_SET_VALUE | + KEY_CREATE_SUB_KEY | + KEY_ENUMERATE_SUB_KEYS | + KEY_NOTIFY | + KEY_CREATE_LINK + ) & (!SYNCHRONIZE); +pub const REG_CREATED_NEW_KEY: ::DWORD = 0x00000001; +pub const REG_OPENED_EXISTING_KEY: ::DWORD = 0x00000002; +pub const REG_NOTIFY_CHANGE_NAME: ::DWORD = 0x00000001; +pub const REG_NOTIFY_CHANGE_ATTRIBUTES: ::DWORD = 0x00000002; +pub const REG_NOTIFY_CHANGE_LAST_SET: ::DWORD = 0x00000004; +pub const REG_NOTIFY_CHANGE_SECURITY: ::DWORD = 0x00000008; +pub const REG_LEGAL_CHANGE_FILTER: ::DWORD = REG_NOTIFY_CHANGE_NAME | + REG_NOTIFY_CHANGE_ATTRIBUTES | + REG_NOTIFY_CHANGE_LAST_SET | + REG_NOTIFY_CHANGE_SECURITY; +pub const REG_NOTIFY_THREAD_AGNOSTIC: ::DWORD = 0x10000000; //supported only on Windows 8 and later +pub const REG_OPTION_RESERVED: ::DWORD = 0x00000000; +pub const REG_OPTION_NON_VOLATILE: ::DWORD = 0x00000000; +pub const REG_OPTION_VOLATILE: ::DWORD = 0x00000001; +pub const REG_OPTION_CREATE_LINK: ::DWORD = 0x00000002; +pub const REG_OPTION_BACKUP_RESTORE: ::DWORD = 0x00000004; +pub const REG_OPTION_OPEN_LINK: ::DWORD = 0x00000008; +pub const REG_NONE: ::DWORD = 0; +pub const REG_SZ: ::DWORD = 1; +pub const REG_EXPAND_SZ: ::DWORD = 2; +pub const REG_BINARY: ::DWORD = 3; +pub const REG_DWORD: ::DWORD = 4; +pub const REG_DWORD_LITTLE_ENDIAN: ::DWORD = 4; +pub const REG_DWORD_BIG_ENDIAN: ::DWORD = 5; +pub const REG_LINK: ::DWORD = 6; +pub const REG_MULTI_SZ: ::DWORD = 7; +pub const REG_RESOURCE_LIST: ::DWORD = 8; +pub const REG_FULL_RESOURCE_DESCRIPTOR: ::DWORD = 9; +pub const REG_RESOURCE_REQUIREMENTS_LIST: ::DWORD = 10; +pub const REG_QWORD: ::DWORD = 11; +pub const REG_QWORD_LITTLE_ENDIAN: ::DWORD = 11; +//18720 +pub const SERVICE_KERNEL_DRIVER: ::DWORD = 0x00000001; +pub const SERVICE_FILE_SYSTEM_DRIVER: ::DWORD = 0x00000002; +pub const SERVICE_ADAPTER: ::DWORD = 0x00000004; +pub const SERVICE_RECOGNIZER_DRIVER: ::DWORD = 0x00000008; +pub const SERVICE_DRIVER: ::DWORD = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER + | SERVICE_RECOGNIZER_DRIVER; +pub const SERVICE_WIN32_OWN_PROCESS: ::DWORD = 0x00000010; +pub const SERVICE_WIN32_SHARE_PROCESS: ::DWORD = 0x00000020; +pub const SERVICE_WIN32: ::DWORD = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS; +pub const SERVICE_INTERACTIVE_PROCESS: ::DWORD = 0x00000100; +pub const SERVICE_TYPE_ALL: ::DWORD = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER + | SERVICE_INTERACTIVE_PROCESS; +STRUCT!{struct TP_CALLBACK_INSTANCE { + dummy: *mut ::c_void, +}} +pub type PTP_CALLBACK_INSTANCE = *mut TP_CALLBACK_INSTANCE; +STRUCT!{struct TP_IO { + dummy: *mut ::c_void, +}} +pub type PTP_IO = *mut TP_IO; +STRUCT!{struct TP_POOL { + dummy: *mut ::c_void, +}} +pub type PTP_POOL = *mut TP_POOL; +STRUCT!{struct TP_CLEANUP_GROUP { + dummy: *mut ::c_void, +}} +pub type PTP_CLEANUP_GROUP = *mut TP_CLEANUP_GROUP; +STRUCT!{struct TP_TIMER { + dummy: *mut ::c_void, +}} +pub type PTP_TIMER = *mut TP_TIMER; +STRUCT!{struct TP_WAIT { + dummy: *mut ::c_void, +}} +pub type PTP_WAIT = *mut TP_WAIT; +STRUCT!{struct TP_WORK { + dummy: *mut ::c_void, +}} +pub type PTP_WORK = *mut TP_WORK; +STRUCT!{struct ACTIVATION_CONTEXT { + dummy: *mut ::c_void, +}} +ENUM!{enum TP_CALLBACK_PRIORITY { + TP_CALLBACK_PRIORITY_HIGH, + TP_CALLBACK_PRIORITY_NORMAL, + TP_CALLBACK_PRIORITY_LOW, + TP_CALLBACK_PRIORITY_INVALID, + TP_CALLBACK_PRIORITY_COUNT = 4, +}} +pub type PTP_CLEANUP_GROUP_CANCEL_CALLBACK = Option; +pub type PTP_SIMPLE_CALLBACK = Option; +pub type PTP_WORK_CALLBACK = Option; +pub type PTP_TIMER_CALLBACK = Option; +pub type TP_WAIT_RESULT = ::DWORD; +pub type PTP_WAIT_CALLBACK = Option; +pub type TP_VERSION = ::DWORD; +pub type PTP_VERSION = *mut ::DWORD; +STRUCT!{struct TP_POOL_STACK_INFORMATION { + StackReserve: ::SIZE_T, + StackCommit: ::SIZE_T, +}} +pub type PTP_POOL_STACK_INFORMATION = *mut TP_POOL_STACK_INFORMATION; +STRUCT!{struct TP_CALLBACK_ENVIRON_V3_s { + BitFields: ::DWORD, +}} +BITFIELD!(TP_CALLBACK_ENVIRON_V3_s BitFields: ::DWORD [ + LongFunction set_LongFunction[0..1], + Persistent set_Persistent[1..2], + Private set_Private[2..32], +]); +STRUCT!{nodebug struct TP_CALLBACK_ENVIRON_V3 { + Version: TP_VERSION, + Pool: PTP_POOL, + CleanupGroup: PTP_CLEANUP_GROUP, + CleanupGroupCancelCallback: PTP_CLEANUP_GROUP_CANCEL_CALLBACK, + RaceDll: ::PVOID, + ActivationContext: *mut ACTIVATION_CONTEXT, + FinalizationCallback: PTP_SIMPLE_CALLBACK, + u: ::DWORD, + CallbackPriority: TP_CALLBACK_PRIORITY, + Size: ::DWORD, +}} +UNION!(TP_CALLBACK_ENVIRON_V3, u, Flags, Flags_mut, ::DWORD); +UNION!(TP_CALLBACK_ENVIRON_V3, u, s, s_mut, TP_CALLBACK_ENVIRON_V3_s); +pub type TP_CALLBACK_ENVIRON = TP_CALLBACK_ENVIRON_V3; +pub type PTP_CALLBACK_ENVIRON = *mut TP_CALLBACK_ENVIRON_V3; +STRUCT!{struct JOB_SET_ARRAY { + JobHandle: ::HANDLE, + MemberLevel: ::DWORD, + Flags: ::DWORD, +}} +pub type PJOB_SET_ARRAY = *mut JOB_SET_ARRAY; +STRUCT!{struct RTL_BARRIER { + Reserved1: ::DWORD, + Reserved2: ::DWORD, + Reserved3: [::ULONG_PTR; 2], + Reserved4: ::DWORD, + Reserved5: ::DWORD, +}} +pub type PRTL_BARRIER = *mut RTL_BARRIER; +STRUCT!{struct RTL_RUN_ONCE { + Ptr: ::PVOID, +}} +pub type PRTL_RUN_ONCE = *mut RTL_RUN_ONCE; +ENUM!{enum RTL_UMS_THREAD_INFO_CLASS { + UmsThreadInvalidInfoClass = 0, + UmsThreadUserContext, + UmsThreadPriority, // Reserved + UmsThreadAffinity, // Reserved + UmsThreadTeb, + UmsThreadIsSuspended, + UmsThreadIsTerminated, + UmsThreadMaxInfoClass, +}} +ENUM!{enum RTL_UMS_SCHEDULER_REASON { + UmsSchedulerStartup = 0, + UmsSchedulerThreadBlocked, + UmsSchedulerThreadYield, +}} +pub type PRTL_UMS_SCHEDULER_ENTRY_POINT = Option; +ENUM!{enum FIRMWARE_TYPE { + FirmwareTypeUnknown, + FirmwareTypeBios, + FirmwareTypeUefi, + FirmwareTypeMax, +}} +pub type PFIRMWARE_TYPE = *mut FIRMWARE_TYPE; +ENUM!{enum LOGICAL_PROCESSOR_RELATIONSHIP { + RelationProcessorCore, + RelationNumaNode, + RelationCache, + RelationProcessorPackage, + RelationGroup, + RelationAll = 0xffff, +}} +ENUM!{enum PROCESSOR_CACHE_TYPE { + CacheUnified, + CacheInstruction, + CacheData, + CacheTrace, +}} +STRUCT!{struct CACHE_DESCRIPTOR { + Level: ::BYTE, + Associativity: ::BYTE, + LineSize: ::WORD, + Size: ::DWORD, + Type: PROCESSOR_CACHE_TYPE, +}} +pub type PCACHE_DESCRIPTOR = *mut CACHE_DESCRIPTOR; +STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore { + Flags: ::BYTE, +}} +STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode { + NodeNumber: ::DWORD, +}} +STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION { + ProcessorMask: ::ULONG_PTR, + Relationship: LOGICAL_PROCESSOR_RELATIONSHIP, + Reserved: [::ULONGLONG; 2], +}} +UNION!( + SYSTEM_LOGICAL_PROCESSOR_INFORMATION, Reserved, ProcessorCore, ProcessorCore_mut, + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore +); +UNION!( + SYSTEM_LOGICAL_PROCESSOR_INFORMATION, Reserved, NumaNode, NumaNode_mut, + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode +); +UNION!(SYSTEM_LOGICAL_PROCESSOR_INFORMATION, Reserved, Cache, Cache_mut, CACHE_DESCRIPTOR); +pub type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION = *mut SYSTEM_LOGICAL_PROCESSOR_INFORMATION; +STRUCT!{struct SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION { + CycleTime: ::DWORD64, +}} +pub type PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION = *mut SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION; +ENUM!{enum HARDWARE_COUNTER_TYPE { + PMCCounter, + MaxHardwareCounterType, +}} +pub type PHARDWARE_COUNTER_TYPE = *mut HARDWARE_COUNTER_TYPE; +ENUM!{enum PROCESS_MITIGATION_POLICY { + ProcessDEPPolicy, + ProcessASLRPolicy, + ProcessDynamicCodePolicy, + ProcessStrictHandleCheckPolicy, + ProcessSystemCallDisablePolicy, + ProcessMitigationOptionsMask, + ProcessExtensionPointDisablePolicy, + ProcessReserved1Policy, + ProcessSignaturePolicy, + MaxProcessMitigationPolicy, +}} +STRUCT!{nodebug struct OSVERSIONINFOA { + dwOSVersionInfoSize: ::DWORD, + dwMajorVersion: ::DWORD, + dwMinorVersion: ::DWORD, + dwBuildNumber: ::DWORD, + dwPlatformId: ::DWORD, + szCSDVersion: [::CHAR; 128], +}} +pub type POSVERSIONINFOA = *mut OSVERSIONINFOA; +pub type LPOSVERSIONINFOA = *mut OSVERSIONINFOA; +STRUCT!{nodebug struct OSVERSIONINFOW { + dwOSVersionInfoSize: ::DWORD, + dwMajorVersion: ::DWORD, + dwMinorVersion: ::DWORD, + dwBuildNumber: ::DWORD, + dwPlatformId: ::DWORD, + szCSDVersion: [::WCHAR; 128], +}} +pub type POSVERSIONINFOW = *mut OSVERSIONINFOW; +pub type LPOSVERSIONINFOW = *mut OSVERSIONINFOW; +STRUCT!{nodebug struct OSVERSIONINFOEXA { + dwOSVersionInfoSize: ::DWORD, + dwMajorVersion: ::DWORD, + dwMinorVersion: ::DWORD, + dwBuildNumber: ::DWORD, + dwPlatformId: ::DWORD, + szCSDVersion: [::CHAR; 128], + wServicePackMajor: ::WORD, + wServicePackMinor: ::WORD, + wSuiteMask: ::WORD, + wProductType: ::BYTE, + wReserved: ::BYTE, +}} +pub type POSVERSIONINFOEXA = *mut OSVERSIONINFOEXA; +pub type LPOSVERSIONINFOEXA = *mut OSVERSIONINFOEXA; +STRUCT!{nodebug struct OSVERSIONINFOEXW { + dwOSVersionInfoSize: ::DWORD, + dwMajorVersion: ::DWORD, + dwMinorVersion: ::DWORD, + dwBuildNumber: ::DWORD, + dwPlatformId: ::DWORD, + szCSDVersion: [::WCHAR; 128], + wServicePackMajor: ::WORD, + wServicePackMinor: ::WORD, + wSuiteMask: ::WORD, + wProductType: ::BYTE, + wReserved: ::BYTE, +}} +pub type POSVERSIONINFOEXW = *mut OSVERSIONINFOEXW; +pub type LPOSVERSIONINFOEXW = *mut OSVERSIONINFOEXW; +STRUCT!{struct SLIST_ENTRY { + Next: *mut SLIST_ENTRY, +}} +pub type PSLIST_ENTRY = *mut SLIST_ENTRY; +STRUCT!{struct SLIST_HEADER_HeaderX64 { + BitFields1: ::ULONGLONG, + BitFields2: ::ULONGLONG, +}} +BITFIELD!(SLIST_HEADER_HeaderX64 BitFields1: ::ULONGLONG [ + Depth set_Depth[0..16], + Sequence set_Sequence[16..64], +]); +BITFIELD!(SLIST_HEADER_HeaderX64 BitFields2: ::ULONGLONG [ + Reserved set_Reserved[0..4], + NextEntry set_NextEntry[4..64], +]); +STRUCT!{struct SLIST_HEADER { + Alignment: ::ULONGLONG, + Region: ::ULONGLONG, +}} +UNION!(SLIST_HEADER, Alignment, HeaderX64, HeaderX64_mut, SLIST_HEADER_HeaderX64); +pub type PSLIST_HEADER = *mut SLIST_HEADER; +ENUM!{enum SYSTEM_POWER_STATE { + PowerSystemUnspecified = 0, + PowerSystemWorking = 1, + PowerSystemSleeping1 = 2, + PowerSystemSleeping2 = 3, + PowerSystemSleeping3 = 4, + PowerSystemHibernate = 5, + PowerSystemShutdown = 6, + PowerSystemMaximum = 7, +}} +pub type PSYSTEM_POWER_STATE = *mut SYSTEM_POWER_STATE; +ENUM!{enum POWER_ACTION { + PowerActionNone = 0, + PowerActionReserved, + PowerActionSleep, + PowerActionHibernate, + PowerActionShutdown, + PowerActionShutdownReset, + PowerActionShutdownOff, + PowerActionWarmEject, +}} +pub type PPOWER_ACTION = *mut POWER_ACTION; +ENUM!{enum DEVICE_POWER_STATE { + PowerDeviceUnspecified = 0, + PowerDeviceD0, + PowerDeviceD1, + PowerDeviceD2, + PowerDeviceD3, + PowerDeviceMaximum, +}} +pub type PDEVICE_POWER_STATE = *mut DEVICE_POWER_STATE; +ENUM!{enum MONITOR_DISPLAY_STATE { + PowerMonitorOff = 0, + PowerMonitorOn, + PowerMonitorDim, +}} +pub type PMONITOR_DISPLAY_STATE = *mut MONITOR_DISPLAY_STATE; +ENUM!{enum USER_ACTIVITY_PRESENCE { + PowerUserPresent = 0, + PowerUserNotPresent, + PowerUserInactive, + PowerUserMaximum, + //PowerUserInvalid = 3, +}} +pub type PUSER_ACTIVITY_PRESENCE = *mut USER_ACTIVITY_PRESENCE; +pub type EXECUTION_STATE = ::DWORD; +pub type PEXECUTION_STATE = *mut ::DWORD; +ENUM!{enum LATENCY_TIME { + LT_DONT_CARE, + LT_LOWEST_LATENCY, +}} +ENUM!{enum POWER_REQUEST_TYPE { + PowerRequestDisplayRequired, + PowerRequestSystemRequired, + PowerRequestAwayModeRequired, + PowerRequestExecutionRequired, +}} +pub type PPOWER_REQUEST_TYPE = *mut POWER_REQUEST_TYPE; +pub const MAX_HW_COUNTERS: usize = 16; +STRUCT!{struct HARDWARE_COUNTER_DATA { + Type: HARDWARE_COUNTER_TYPE, + Reserved: ::DWORD, + Value: ::DWORD64, +}} +pub type PHARDWARE_COUNTER_DATA = *mut HARDWARE_COUNTER_DATA; +STRUCT!{struct PERFORMANCE_DATA { + Size: ::WORD, + Version: ::BYTE, + HwCountersCount: ::BYTE, + ContextSwitchCount: ::DWORD, + WaitReasonBitMap: ::DWORD64, + CycleTime: ::DWORD64, + RetryCount: ::DWORD, + Reserved: ::DWORD, + HwCounters: [HARDWARE_COUNTER_DATA; MAX_HW_COUNTERS], +}} +pub type PPERFORMANCE_DATA = *mut PERFORMANCE_DATA; +STRUCT!{struct MEMORY_BASIC_INFORMATION { + BaseAddress: ::PVOID, + AllocationBase: ::PVOID, + AllocationProtect: ::DWORD, + RegionSize: ::SIZE_T, + State: ::DWORD, + Protect: ::DWORD, + Type: ::DWORD, +}} +pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION; +STRUCT!{struct MEMORY_BASIC_INFORMATION32 { + BaseAddress: ::DWORD, + AllocationBase: ::DWORD, + AllocationProtect: ::DWORD, + RegionSize: ::DWORD, + State: ::DWORD, + Protect: ::DWORD, + Type: ::DWORD, +}} +pub type PMEMORY_BASIC_INFORMATION32 = *mut MEMORY_BASIC_INFORMATION32; +STRUCT!{struct MEMORY_BASIC_INFORMATION64 { // FIXME: align 16 + BaseAddress: ::ULONGLONG, + AllocationBase: ::ULONGLONG, + AllocationProtect: ::DWORD, + __alignment1: ::DWORD, + RegionSize: ::ULONGLONG, + State: ::DWORD, + Protect: ::DWORD, + Type: ::DWORD, + __alignment2: ::DWORD, +}} +pub type PMEMORY_BASIC_INFORMATION64 = *mut MEMORY_BASIC_INFORMATION64; +pub const WOW64_SIZE_OF_80387_REGISTERS: usize = 80; +pub const WOW64_MAXIMUM_SUPPORTED_EXTENSION: usize = 512; +STRUCT!{nodebug struct WOW64_FLOATING_SAVE_AREA { + ControlWord: ::DWORD, + StatusWord: ::DWORD, + TagWord: ::DWORD, + ErrorOffset: ::DWORD, + ErrorSelector: ::DWORD, + DataOffset: ::DWORD, + DataSelector: ::DWORD, + RegisterArea: [::BYTE; WOW64_SIZE_OF_80387_REGISTERS], + Cr0NpxState: ::DWORD, +}} +pub type PWOW64_FLOATING_SAVE_AREA = *mut WOW64_FLOATING_SAVE_AREA; +STRUCT!{nodebug struct WOW64_CONTEXT { + ContextFlags: ::DWORD, + Dr0: ::DWORD, + Dr1: ::DWORD, + Dr2: ::DWORD, + Dr3: ::DWORD, + Dr4: ::DWORD, + Dr5: ::DWORD, + Dr6: ::DWORD, + Dr7: ::DWORD, + FloatSave: WOW64_FLOATING_SAVE_AREA, + SegGs: ::DWORD, + SegFs: ::DWORD, + SegEs: ::DWORD, + SegDs: ::DWORD, + Edi: ::DWORD, + Esi: ::DWORD, + Ebx: ::DWORD, + Edx: ::DWORD, + Ecx: ::DWORD, + Eax: ::DWORD, + Ebp: ::DWORD, + Eip: ::DWORD, + SegCs: ::DWORD, + EFlags: ::DWORD, + Esp: ::DWORD, + SegSs: ::DWORD, + ExtendedRegisters: [::BYTE; WOW64_MAXIMUM_SUPPORTED_EXTENSION], +}} +pub type PWOW64_CONTEXT = *mut WOW64_CONTEXT; +STRUCT!{struct WOW64_LDT_ENTRY_Bytes { + BaseMid: ::BYTE, + Flags1: ::BYTE, + Flags2: ::BYTE, + BaseHi: ::BYTE, +}} +STRUCT!{struct WOW64_LDT_ENTRY_Bits { + BitFields: ::DWORD, +}} +BITFIELD!(WOW64_LDT_ENTRY_Bits BitFields: ::DWORD [ + BaseMid set_BaseMid[0..8], + Type set_Type[8..13], + Dpl set_Dpl[13..15], + Pres set_Pres[15..16], + LimitHi set_LimitHi[16..20], + Sys set_Sys[20..21], + Reserved_0 set_Reserved_0[21..22], + Default_Big set_Default_Big[22..23], + Granularity set_Granularity[23..24], + BaseHi set_BaseHi[24..32], +]); +STRUCT!{struct WOW64_LDT_ENTRY { + LimitLow: ::WORD, + BaseLow: ::WORD, + HighWord: ::DWORD, +}} +UNION!(WOW64_LDT_ENTRY, HighWord, Bytes, Bytes_mut, WOW64_LDT_ENTRY_Bytes); +UNION!(WOW64_LDT_ENTRY, HighWord, Bits, Bits_mut, WOW64_LDT_ENTRY_Bits); +pub type PWOW64_LDT_ENTRY = *mut WOW64_LDT_ENTRY; diff --git a/third_party/rust/winapi/src/winreg.rs b/third_party/rust/winapi/src/winreg.rs new file mode 100644 index 000000000000..91ef168ca9cc --- /dev/null +++ b/third_party/rust/winapi/src/winreg.rs @@ -0,0 +1,41 @@ +// Copyright © 2016, Peter Atashian +// Licensed under the MIT License +use super::*; +pub type REGSAM = ACCESS_MASK; +STRUCT!{struct VALENTA { + ve_valuename: LPSTR, + ve_valuelen: DWORD, + ve_valueptr: DWORD_PTR, + ve_type: DWORD, +}} +pub type PVALENTA = *mut VALENTA; +STRUCT!{struct VALENTW { + ve_valuename: LPWSTR, + ve_valuelen: DWORD, + ve_valueptr: DWORD_PTR, + ve_type: DWORD, +}} +pub type PVALENTW = *mut VALENTW; +pub const HKEY_CLASSES_ROOT: HKEY = 0x80000000 as HKEY; +pub const HKEY_CURRENT_USER: HKEY = 0x80000001 as HKEY; +pub const HKEY_LOCAL_MACHINE: HKEY = 0x80000002 as HKEY; +pub const HKEY_USERS: HKEY = 0x80000003 as HKEY; +pub const HKEY_PERFORMANCE_DATA: HKEY = 0x80000004 as HKEY; +pub const HKEY_PERFORMANCE_TEXT: HKEY = 0x80000050 as HKEY; +pub const HKEY_PERFORMANCE_NLSTEXT: HKEY = 0x80000060 as HKEY; +pub const HKEY_CURRENT_CONFIG: HKEY = 0x80000005 as HKEY; +pub const HKEY_DYN_DATA: HKEY = 0x80000006 as HKEY; +pub const HKEY_CURRENT_USER_LOCAL_SETTINGS: HKEY = 0x80000007 as HKEY; +pub const REG_MUI_STRING_TRUNCATE: DWORD = 0x00000001; +pub const RRF_RT_REG_NONE: DWORD = 0x00000001; +pub const RRF_RT_REG_SZ: DWORD = 0x00000002; +pub const RRF_RT_REG_EXPAND_SZ: DWORD = 0x00000004; +pub const RRF_RT_REG_BINARY: DWORD = 0x00000008; +pub const RRF_RT_REG_DWORD: DWORD = 0x00000010; +pub const RRF_RT_REG_MULTI_SZ: DWORD = 0x00000020; +pub const RRF_RT_REG_QWORD: DWORD = 0x00000040; +pub const RRF_RT_DWORD: DWORD = RRF_RT_REG_BINARY|RRF_RT_REG_DWORD; +pub const RRF_RT_QWORD: DWORD = RRF_RT_REG_BINARY|RRF_RT_REG_QWORD; +pub const RRF_RT_ANY: DWORD = 0x0000ffff; +pub const RRF_NOEXPAND: DWORD = 0x10000000; +pub const RRF_ZEROONFAILURE: DWORD = 0x20000000; diff --git a/third_party/rust/winapi/src/winscard.rs b/third_party/rust/winapi/src/winscard.rs new file mode 100644 index 000000000000..7d20c2d99940 --- /dev/null +++ b/third_party/rust/winapi/src/winscard.rs @@ -0,0 +1,269 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Data Protection API Prototypes and Definitions +// This header file provides the definitions and symbols necessary for an +// Application or Smart Card Service Provider to access the Smartcard Subsystem. +pub type LPCBYTE = *const ::BYTE; +pub type SCARDCONTEXT = ::ULONG_PTR; +pub type PSCARDCONTEXT = *mut SCARDCONTEXT; +pub type LPSCARDCONTEXT = *mut SCARDCONTEXT; +pub type SCARDHANDLE = ::ULONG_PTR; +pub type PSCARDHANDLE = *mut SCARDHANDLE; +pub type LPSCARDHANDLE = *mut SCARDHANDLE; +pub const SCARD_AUTOALLOCATE: ::DWORD = -1i32 as ::DWORD; +pub const SCARD_SCOPE_USER: ::DWORD = 0; +pub const SCARD_SCOPE_TERMINAL: ::DWORD = 1; +pub const SCARD_SCOPE_SYSTEM: ::DWORD = 2; +pub const SCARD_PROVIDER_PRIMARY: ::DWORD = 1; +pub const SCARD_PROVIDER_CSP: ::DWORD = 2; +pub const SCARD_PROVIDER_KSP: ::DWORD = 3; +STRUCT!{nodebug struct SCARD_READERSTATEA { + szReader: ::LPCSTR, + pvUserData: ::LPVOID, + dwCurrentState: ::DWORD, + dwEventState: ::DWORD, + cbAtr: ::DWORD, + rgbAtr: [::BYTE; 36], +}} +pub type PSCARD_READERSTATEA = *mut SCARD_READERSTATEA; +pub type LPSCARD_READERSTATEA = *mut SCARD_READERSTATEA; +STRUCT!{nodebug struct SCARD_READERSTATEW { + szReader: ::LPCWSTR, + pvUserData: ::LPVOID, + dwCurrentState: ::DWORD, + dwEventState: ::DWORD, + cbAtr: ::DWORD, + rgbAtr: [::BYTE; 36], +}} +pub type PSCARD_READERSTATEW = *mut SCARD_READERSTATEW; +pub type LPSCARD_READERSTATEW = *mut SCARD_READERSTATEW; +pub type SCARD_READERSTATE_A = SCARD_READERSTATEA; +pub type SCARD_READERSTATE_W = SCARD_READERSTATEW; +pub type PSCARD_READERSTATE_A = PSCARD_READERSTATEA; +pub type PSCARD_READERSTATE_W = PSCARD_READERSTATEW; +pub type LPSCARD_READERSTATE_A = LPSCARD_READERSTATEA; +pub type LPSCARD_READERSTATE_W = LPSCARD_READERSTATEW; +pub const SCARD_STATE_UNAWARE: ::DWORD = 0x00000000; +pub const SCARD_STATE_IGNORE: ::DWORD = 0x00000001; +pub const SCARD_STATE_CHANGED: ::DWORD = 0x00000002; +pub const SCARD_STATE_UNKNOWN: ::DWORD = 0x00000004; +pub const SCARD_STATE_UNAVAILABLE: ::DWORD = 0x00000008; +pub const SCARD_STATE_EMPTY: ::DWORD = 0x00000010; +pub const SCARD_STATE_PRESENT: ::DWORD = 0x00000020; +pub const SCARD_STATE_ATRMATCH: ::DWORD = 0x00000040; +pub const SCARD_STATE_EXCLUSIVE: ::DWORD = 0x00000080; +pub const SCARD_STATE_INUSE: ::DWORD = 0x00000100; +pub const SCARD_STATE_MUTE: ::DWORD = 0x00000200; +pub const SCARD_STATE_UNPOWERED: ::DWORD = 0x00000400; +STRUCT!{nodebug struct SCARD_ATRMASK { + cbAtr: ::DWORD, + rgbAtr: [::BYTE; 36], + rgbMask: [::BYTE; 36], +}} +pub type PSCARD_ATRMASK = *mut SCARD_ATRMASK; +pub type LPSCARD_ATRMASK = *mut SCARD_ATRMASK; +pub const SCARD_SHARE_EXCLUSIVE: ::DWORD = 1; +pub const SCARD_SHARE_SHARED: ::DWORD = 2; +pub const SCARD_SHARE_DIRECT: ::DWORD = 3; +pub const SCARD_LEAVE_CARD: ::DWORD = 0; +pub const SCARD_RESET_CARD: ::DWORD = 1; +pub const SCARD_UNPOWER_CARD: ::DWORD = 2; +pub const SCARD_EJECT_CARD: ::DWORD = 3; +pub const SC_DLG_MINIMAL_UI: ::DWORD = 0x01; +pub const SC_DLG_NO_UI: ::DWORD = 0x02; +pub const SC_DLG_FORCE_UI: ::DWORD = 0x04; +pub const SCERR_NOCARDNAME: ::DWORD = 0x4000; +pub const SCERR_NOGUIDS: ::DWORD = 0x8000; +pub type LPOCNCONNPROCA = Option SCARDHANDLE>; +pub type LPOCNCONNPROCW = Option SCARDHANDLE>; +pub type LPOCNCHKPROC = Option ::BOOL>; +pub type LPOCNDSCPROC = Option; +STRUCT!{nodebug struct OPENCARD_SEARCH_CRITERIAA { + dwStructSize: ::DWORD, + lpstrGroupNames: ::LPSTR, + nMaxGroupNames: ::DWORD, + rgguidInterfaces: ::LPCGUID, + cguidInterfaces: ::DWORD, + lpstrCardNames: ::LPSTR, + nMaxCardNames: ::DWORD, + lpfnCheck: LPOCNCHKPROC, + lpfnConnect: LPOCNCONNPROCA, + lpfnDisconnect: LPOCNDSCPROC, + pvUserData: ::LPVOID, + dwShareMode: ::DWORD, + dwPreferredProtocols: ::DWORD, +}} +pub type POPENCARD_SEARCH_CRITERIAA = *mut OPENCARD_SEARCH_CRITERIAA; +pub type LPOPENCARD_SEARCH_CRITERIAA = *mut OPENCARD_SEARCH_CRITERIAA; +STRUCT!{nodebug struct OPENCARD_SEARCH_CRITERIAW { + dwStructSize: ::DWORD, + lpstrGroupNames: ::LPWSTR, + nMaxGroupNames: ::DWORD, + rgguidInterfaces: ::LPCGUID, + cguidInterfaces: ::DWORD, + lpstrCardNames: ::LPWSTR, + nMaxCardNames: ::DWORD, + lpfnCheck: LPOCNCHKPROC, + lpfnConnect: LPOCNCONNPROCW, + lpfnDisconnect: LPOCNDSCPROC, + pvUserData: ::LPVOID, + dwShareMode: ::DWORD, + dwPreferredProtocols: ::DWORD, +}} +pub type POPENCARD_SEARCH_CRITERIAW = *mut OPENCARD_SEARCH_CRITERIAW; +pub type LPOPENCARD_SEARCH_CRITERIAW = *mut OPENCARD_SEARCH_CRITERIAW; +STRUCT!{nodebug struct OPENCARDNAME_EXA { + dwStructSize: ::DWORD, + hSCardContext: SCARDCONTEXT, + hwndOwner: ::HWND, + dwFlags: ::DWORD, + lpstrTitle: ::LPCSTR, + lpstrSearchDesc: ::LPCSTR, + hIcon: ::HICON, + pOpenCardSearchCriteria: POPENCARD_SEARCH_CRITERIAA, + lpfnConnect: LPOCNCONNPROCA, + pvUserData: ::LPVOID, + dwShareMode: ::DWORD, + dwPreferredProtocols: ::DWORD, + lpstrRdr: ::LPSTR, + nMaxRdr: ::DWORD, + lpstrCard: ::LPSTR, + nMaxCard: ::DWORD, + dwActiveProtocol: ::DWORD, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAME_EXA = *mut OPENCARDNAME_EXA; +pub type LPOPENCARDNAME_EXA = *mut OPENCARDNAME_EXA; +STRUCT!{nodebug struct OPENCARDNAME_EXW { + dwStructSize: ::DWORD, + hSCardContext: SCARDCONTEXT, + hwndOwner: ::HWND, + dwFlags: ::DWORD, + lpstrTitle: ::LPCWSTR, + lpstrSearchDesc: ::LPCWSTR, + hIcon: ::HICON, + pOpenCardSearchCriteria: POPENCARD_SEARCH_CRITERIAW, + lpfnConnect: LPOCNCONNPROCW, + pvUserData: ::LPVOID, + dwShareMode: ::DWORD, + dwPreferredProtocols: ::DWORD, + lpstrRdr: ::LPWSTR, + nMaxRdr: ::DWORD, + lpstrCard: ::LPWSTR, + nMaxCard: ::DWORD, + dwActiveProtocol: ::DWORD, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAME_EXW = *mut OPENCARDNAME_EXW; +pub type LPOPENCARDNAME_EXW = *mut OPENCARDNAME_EXW; +pub type OPENCARDNAMEA_EX = OPENCARDNAME_EXA; +pub type OPENCARDNAMEW_EX = OPENCARDNAME_EXW; +pub type POPENCARDNAMEA_EX = POPENCARDNAME_EXA; +pub type POPENCARDNAMEW_EX = POPENCARDNAME_EXW; +pub type LPOPENCARDNAMEA_EX = LPOPENCARDNAME_EXA; +pub type LPOPENCARDNAMEW_EX = LPOPENCARDNAME_EXW; +pub const SCARD_READER_SEL_AUTH_PACKAGE: ::DWORD = -629i32 as ::DWORD; +ENUM!{enum READER_SEL_REQUEST_MATCH_TYPE { + RSR_MATCH_TYPE_READER_AND_CONTAINER = 1, + RSR_MATCH_TYPE_SERIAL_NUMBER, + RSR_MATCH_TYPE_ALL_CARDS, +}} +STRUCT!{struct READER_SEL_REQUEST_ReaderAndContainerParameter { + cbReaderNameOffset: ::DWORD, + cchReaderNameLength: ::DWORD, + cbContainerNameOffset: ::DWORD, + cchContainerNameLength: ::DWORD, + dwDesiredCardModuleVersion: ::DWORD, + dwCspFlags: ::DWORD, +}} +STRUCT!{struct READER_SEL_REQUEST_SerialNumberParameter { + cbSerialNumberOffset: ::DWORD, + cbSerialNumberLength: ::DWORD, + dwDesiredCardModuleVersion: ::DWORD, +}} +STRUCT!{struct READER_SEL_REQUEST { + dwShareMode: ::DWORD, + dwPreferredProtocols: ::DWORD, + MatchType: READER_SEL_REQUEST_MATCH_TYPE, + ReaderAndContainerParameter: READER_SEL_REQUEST_ReaderAndContainerParameter, +}} +UNION!( + READER_SEL_REQUEST, ReaderAndContainerParameter, SerialNumberParameter, + SerialNumberParameter_mut, READER_SEL_REQUEST_SerialNumberParameter +); +pub type PREADER_SEL_REQUEST = *mut READER_SEL_REQUEST; +STRUCT!{struct READER_SEL_RESPONSE { + cbReaderNameOffset: ::DWORD, + cchReaderNameLength: ::DWORD, + cbCardNameOffset: ::DWORD, + cchCardNameLength: ::DWORD, +}} +pub type PREADER_SEL_RESPONSE = *mut READER_SEL_RESPONSE; +STRUCT!{nodebug struct OPENCARDNAMEA { + dwStructSize: ::DWORD, + hwndOwner: ::HWND, + hSCardContext: SCARDCONTEXT, + lpstrGroupNames: ::LPSTR, + nMaxGroupNames: ::DWORD, + lpstrCardNames: ::LPSTR, + nMaxCardNames: ::DWORD, + rgguidInterfaces: ::LPCGUID, + cguidInterfaces: ::DWORD, + lpstrRdr: ::LPSTR, + nMaxRdr: ::DWORD, + lpstrCard: ::LPSTR, + nMaxCard: ::DWORD, + lpstrTitle: ::LPCSTR, + dwFlags: ::DWORD, + pvUserData: ::LPVOID, + dwShareMode: ::DWORD, + dwPreferredProtocols: ::DWORD, + dwActiveProtocol: ::DWORD, + lpfnConnect: LPOCNCONNPROCA, + lpfnCheck: LPOCNCHKPROC, + lpfnDisconnect: LPOCNDSCPROC, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAMEA = *mut OPENCARDNAMEA; +pub type LPOPENCARDNAMEA = *mut OPENCARDNAMEA; +STRUCT!{nodebug struct OPENCARDNAMEW { + dwStructSize: ::DWORD, + hwndOwner: ::HWND, + hSCardContext: SCARDCONTEXT, + lpstrGroupNames: ::LPWSTR, + nMaxGroupNames: ::DWORD, + lpstrCardNames: ::LPWSTR, + nMaxCardNames: ::DWORD, + rgguidInterfaces: ::LPCGUID, + cguidInterfaces: ::DWORD, + lpstrRdr: ::LPWSTR, + nMaxRdr: ::DWORD, + lpstrCard: ::LPWSTR, + nMaxCard: ::DWORD, + lpstrTitle: ::LPCWSTR, + dwFlags: ::DWORD, + pvUserData: ::LPVOID, + dwShareMode: ::DWORD, + dwPreferredProtocols: ::DWORD, + dwActiveProtocol: ::DWORD, + lpfnConnect: LPOCNCONNPROCW, + lpfnCheck: LPOCNCHKPROC, + lpfnDisconnect: LPOCNDSCPROC, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAMEW = *mut OPENCARDNAMEW; +pub type LPOPENCARDNAMEW = *mut OPENCARDNAMEW; +pub type OPENCARDNAME_A = OPENCARDNAMEA; +pub type OPENCARDNAME_W = OPENCARDNAMEW; +pub type POPENCARDNAME_A = POPENCARDNAMEA; +pub type POPENCARDNAME_W = POPENCARDNAMEW; +pub type LPOPENCARDNAME_A = LPOPENCARDNAMEA; +pub type LPOPENCARDNAME_W = LPOPENCARDNAMEW; +pub const SCARD_AUDIT_CHV_FAILURE: ::DWORD = 0x0; +pub const SCARD_AUDIT_CHV_SUCCESS: ::DWORD = 0x1; diff --git a/third_party/rust/winapi/src/winsmcrd.rs b/third_party/rust/winapi/src/winsmcrd.rs new file mode 100644 index 000000000000..28f347492df5 --- /dev/null +++ b/third_party/rust/winapi/src/winsmcrd.rs @@ -0,0 +1,157 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +// Smart Card class/port IOCTL codes. +pub type UWORD = ::WORD; +DEFINE_GUID!(GUID_DEVINTERFACE_SMARTCARD_READER, 0x50DD5230, 0xBA8A, 0x11D1, + 0xBF, 0x5D, 0x00, 0x00, 0xF8, 0x05, 0xF5, 0x30); +pub const SCARD_ATR_LENGTHL: ::DWORD = 33; +pub const SCARD_PROTOCOL_UNDEFINED: ::DWORD = 0x00000000; +pub const SCARD_PROTOCOL_T0: ::DWORD = 0x00000001; +pub const SCARD_PROTOCOL_T1: ::DWORD = 0x00000002; +pub const SCARD_PROTOCOL_RAW: ::DWORD = 0x00010000; +pub const SCARD_PROTOCOL_Tx: ::DWORD = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1; +pub const SCARD_PROTOCOL_DEFAULT: ::DWORD = 0x80000000; +pub const SCARD_PROTOCOL_OPTIMAL: ::DWORD = 0x00000000; +pub const SCARD_POWER_DOWN: ::DWORD = 0; +pub const SCARD_COLD_RESET: ::DWORD = 1; +pub const SCARD_WARM_RESET: ::DWORD = 2; +pub const IOCTL_SMARTCARD_POWER: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 1, ::METHOD_BUFFERED, + ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_ATTRIBUTE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 2, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_SET_ATTRIBUTE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 3, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_CONFISCATE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 4, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_TRANSMIT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 5, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_EJECT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 6, ::METHOD_BUFFERED, + ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_SWALLOW: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 7, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_IS_PRESENT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 10, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_IS_ABSENT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 11, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_SET_PROTOCOL: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 12, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_STATE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 14, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_LAST_ERROR: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 15, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_PERF_CNTR: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 16, + ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); +pub const MAXIMUM_ATTR_STRING_LENGTH: ::DWORD = 32; +pub const MAXIMUM_SMARTCARD_READERS: ::DWORD = 10; +pub const SCARD_CLASS_VENDOR_INFO: ::ULONG = 1; +pub const SCARD_CLASS_COMMUNICATIONS: ::ULONG = 2; +pub const SCARD_CLASS_PROTOCOL: ::ULONG = 3; +pub const SCARD_CLASS_POWER_MGMT: ::ULONG = 4; +pub const SCARD_CLASS_SECURITY: ::ULONG = 5; +pub const SCARD_CLASS_MECHANICAL: ::ULONG = 6; +pub const SCARD_CLASS_VENDOR_DEFINED: ::ULONG = 7; +pub const SCARD_CLASS_IFD_PROTOCOL: ::ULONG = 8; +pub const SCARD_CLASS_ICC_STATE: ::ULONG = 9; +pub const SCARD_CLASS_PERF: ::ULONG = 0x7ffe; +pub const SCARD_CLASS_SYSTEM: ::ULONG = 0x7fff; +pub const SCARD_ATTR_VENDOR_NAME: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0100; +pub const SCARD_ATTR_VENDOR_IFD_TYPE: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0101; +pub const SCARD_ATTR_VENDOR_IFD_VERSION: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0102; +pub const SCARD_ATTR_VENDOR_IFD_SERIAL_NO: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0103; +pub const SCARD_ATTR_CHANNEL_ID: ::ULONG = SCARD_CLASS_COMMUNICATIONS << 16 | 0x0110; +pub const SCARD_ATTR_PROTOCOL_TYPES: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0120; +pub const SCARD_ATTR_DEFAULT_CLK: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0121; +pub const SCARD_ATTR_MAX_CLK: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0122; +pub const SCARD_ATTR_DEFAULT_DATA_RATE: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0123; +pub const SCARD_ATTR_MAX_DATA_RATE: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0124; +pub const SCARD_ATTR_MAX_IFSD: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0125; +pub const SCARD_ATTR_POWER_MGMT_SUPPORT: ::ULONG = SCARD_CLASS_POWER_MGMT << 16 | 0x0131; +pub const SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE: ::ULONG = SCARD_CLASS_SECURITY << 16 | 0x0140; +pub const SCARD_ATTR_USER_AUTH_INPUT_DEVICE: ::ULONG = SCARD_CLASS_SECURITY << 16 | 0x0142; +pub const SCARD_ATTR_CHARACTERISTICS: ::ULONG = SCARD_CLASS_MECHANICAL << 16 | 0x0150; +pub const SCARD_ATTR_CURRENT_PROTOCOL_TYPE: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0201; +pub const SCARD_ATTR_CURRENT_CLK: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0202; +pub const SCARD_ATTR_CURRENT_F: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0203; +pub const SCARD_ATTR_CURRENT_D: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0204; +pub const SCARD_ATTR_CURRENT_N: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0205; +pub const SCARD_ATTR_CURRENT_W: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0206; +pub const SCARD_ATTR_CURRENT_IFSC: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0207; +pub const SCARD_ATTR_CURRENT_IFSD: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0208; +pub const SCARD_ATTR_CURRENT_BWT: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0209; +pub const SCARD_ATTR_CURRENT_CWT: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020a; +pub const SCARD_ATTR_CURRENT_EBC_ENCODING: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020b; +pub const SCARD_ATTR_EXTENDED_BWT: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020c; +pub const SCARD_ATTR_ICC_PRESENCE: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0300; +pub const SCARD_ATTR_ICC_INTERFACE_STATUS: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0301; +pub const SCARD_ATTR_CURRENT_IO_STATE: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0302; +pub const SCARD_ATTR_ATR_STRING: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0303; +pub const SCARD_ATTR_ICC_TYPE_PER_ATR: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0304; +pub const SCARD_ATTR_ESC_RESET: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA000; +pub const SCARD_ATTR_ESC_CANCEL: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA003; +pub const SCARD_ATTR_ESC_AUTHREQUEST: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA005; +pub const SCARD_ATTR_MAXINPUT: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA007; +pub const SCARD_ATTR_DEVICE_UNIT: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0001; +pub const SCARD_ATTR_DEVICE_IN_USE: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0002; +pub const SCARD_ATTR_DEVICE_FRIENDLY_NAME_A: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0003; +pub const SCARD_ATTR_DEVICE_SYSTEM_NAME_A: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0004; +pub const SCARD_ATTR_DEVICE_FRIENDLY_NAME_W: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0005; +pub const SCARD_ATTR_DEVICE_SYSTEM_NAME_W: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0006; +pub const SCARD_ATTR_SUPRESS_T1_IFS_REQUEST: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0007; +pub const SCARD_PERF_NUM_TRANSMISSIONS: ::ULONG = SCARD_CLASS_PERF << 16 | 0x0001; +pub const SCARD_PERF_BYTES_TRANSMITTED: ::ULONG = SCARD_CLASS_PERF << 16 | 0x0002; +pub const SCARD_PERF_TRANSMISSION_TIME: ::ULONG = SCARD_CLASS_PERF << 16 | 0x0003; +pub const SCARD_T0_HEADER_LENGTH: ::DWORD = 7; +pub const SCARD_T0_CMD_LENGTH: ::DWORD = 5; +pub const SCARD_T1_PROLOGUE_LENGTH: ::DWORD = 3; +pub const SCARD_T1_EPILOGUE_LENGTH: ::DWORD = 2; +pub const SCARD_T1_MAX_IFS: ::DWORD = 254; +pub const SCARD_UNKNOWN: ::ULONG = 0; +pub const SCARD_ABSENT: ::ULONG = 1; +pub const SCARD_PRESENT: ::ULONG = 2; +pub const SCARD_SWALLOWED: ::ULONG = 3; +pub const SCARD_POWERED: ::ULONG = 4; +pub const SCARD_NEGOTIABLE: ::ULONG = 5; +pub const SCARD_SPECIFIC: ::ULONG = 6; +STRUCT!{struct SCARD_IO_REQUEST { + dwProtocol: ::DWORD, + cbPciLength: ::DWORD, +}} +pub type PSCARD_IO_REQUEST = *mut SCARD_IO_REQUEST; +pub type LPSCARD_IO_REQUEST = *mut SCARD_IO_REQUEST; +pub type LPCSCARD_IO_REQUEST = *const SCARD_IO_REQUEST; +STRUCT!{struct SCARD_T0_COMMAND { + bCla: ::BYTE, + bIns: ::BYTE, + bP1: ::BYTE, + bP2: ::BYTE, + bP3: ::BYTE, +}} +pub type LPSCARD_T0_COMMAND = *mut SCARD_T0_COMMAND; +STRUCT!{struct SCARD_T0_REQUEST { + ioRequest: SCARD_IO_REQUEST, + bSw1: ::BYTE, + bSw2: ::BYTE, + CmdBytes: SCARD_T0_COMMAND, +}} +UNION!(SCARD_T0_REQUEST, CmdBytes, rgbHeader, rgbHeader_mut, [::BYTE; 5]); +pub type PSCARD_T0_REQUEST = *mut SCARD_T0_REQUEST; +pub type LPSCARD_T0_REQUEST = *mut SCARD_T0_REQUEST; +STRUCT!{struct SCARD_T1_REQUEST { + ioRequest: SCARD_IO_REQUEST, +}} +pub type PSCARD_T1_REQUEST = *mut SCARD_T1_REQUEST; +pub type LPSCARD_T1_REQUEST = *mut SCARD_T1_REQUEST; +pub const SCARD_READER_SWALLOWS: ::ULONG = 0x00000001; +pub const SCARD_READER_EJECTS: ::ULONG = 0x00000002; +pub const SCARD_READER_CONFISCATES: ::ULONG = 0x00000004; +pub const SCARD_READER_TYPE_SERIAL: ::ULONG = 0x01; +pub const SCARD_READER_TYPE_PARALELL: ::ULONG = 0x02; +pub const SCARD_READER_TYPE_KEYBOARD: ::ULONG = 0x04; +pub const SCARD_READER_TYPE_SCSI: ::ULONG = 0x08; +pub const SCARD_READER_TYPE_IDE: ::ULONG = 0x10; +pub const SCARD_READER_TYPE_USB: ::ULONG = 0x20; +pub const SCARD_READER_TYPE_PCMCIA: ::ULONG = 0x40; +pub const SCARD_READER_TYPE_TPM: ::ULONG = 0x80; +pub const SCARD_READER_TYPE_NFC: ::ULONG = 0x100; +pub const SCARD_READER_TYPE_UICC: ::ULONG = 0x200; +pub const SCARD_READER_TYPE_VENDOR: ::ULONG = 0xF0; diff --git a/third_party/rust/winapi/src/winsock2.rs b/third_party/rust/winapi/src/winsock2.rs new file mode 100644 index 000000000000..05b62f2c4315 --- /dev/null +++ b/third_party/rust/winapi/src/winsock2.rs @@ -0,0 +1,429 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! definitions to be used with the WinSock 2 DLL and WinSock 2 applications. +//! +//! This header file corresponds to version 2.2.x of the WinSock API specification. +pub const WINSOCK_VERSION: ::WORD = 2 | (2 << 8); +pub type u_char = ::c_uchar; +pub type u_short = ::c_ushort; +pub type u_int = ::c_uint; +pub type u_long = ::c_ulong; +pub type u_int64 = ::__uint64; +pub type SOCKET = ::UINT_PTR; +pub type GROUP = ::c_uint; +pub const FD_SETSIZE: usize = 64; +pub const FD_MAX_EVENTS: usize = 10; +STRUCT!{nodebug struct fd_set { + fd_count: u_int, + fd_array: [SOCKET; FD_SETSIZE], +}} +STRUCT!{struct timeval { + tv_sec: ::c_long, + tv_usec: ::c_long, +}} +STRUCT!{struct hostent { + h_name: *mut ::c_char, + h_aliases: *mut *mut ::c_char, + h_addrtype: ::c_short, + h_length: ::c_short, + h_addr_list: *mut *mut ::c_char, +}} +STRUCT!{struct netent { + n_name: *mut ::c_char, + n_aliases: *mut *mut ::c_char, + n_addrtype: ::c_short, + n_net: u_long, +}} +#[cfg(target_arch="x86")] +STRUCT!{struct servent { + s_name: *mut ::c_char, + s_aliases: *mut *mut ::c_char, + s_port: ::c_short, + s_proto: *mut ::c_char, +}} +#[cfg(target_arch="x86_64")] +STRUCT!{struct servent { + s_name: *mut ::c_char, + s_aliases: *mut *mut ::c_char, + s_proto: *mut ::c_char, + s_port: ::c_short, +}} +STRUCT!{struct protoent { + p_name: *mut ::c_char, + p_aliases: *mut *mut ::c_char, + p_proto: ::c_short, +}} +pub const WSADESCRIPTION_LEN: usize = 256; +pub const WSASYS_STATUS_LEN: usize = 128; +#[cfg(target_arch="x86")] +STRUCT!{nodebug struct WSADATA { + wVersion: ::WORD, + wHighVersion: ::WORD, + szDescription: [::c_char; WSADESCRIPTION_LEN + 1], + szSystemStatus: [::c_char; WSASYS_STATUS_LEN + 1], + iMaxSockets: ::c_ushort, + iMaxUdpDg: ::c_ushort, + lpVendorInfo: *mut ::c_char, +}} +#[cfg(target_arch="x86_64")] +STRUCT!{nodebug struct WSADATA { + wVersion: ::WORD, + wHighVersion: ::WORD, + iMaxSockets: ::c_ushort, + iMaxUdpDg: ::c_ushort, + lpVendorInfo: *mut ::c_char, + szDescription: [::c_char; WSADESCRIPTION_LEN + 1], + szSystemStatus: [::c_char; WSASYS_STATUS_LEN + 1], +}} +pub type LPWSADATA = *mut WSADATA; +//391 +pub const INVALID_SOCKET: SOCKET = !0; +pub const SOCKET_ERROR: ::c_int = -1; +STRUCT!{struct sockproto { + sp_family: u_short, + sp_protocol: u_short, +}} +pub const PF_UNSPEC: ::c_int = ::AF_UNSPEC; +pub const PF_UNIX: ::c_int = ::AF_UNIX; +pub const PF_INET: ::c_int = ::AF_INET; +pub const PF_IMPLINK: ::c_int = ::AF_IMPLINK; +pub const PF_PUP: ::c_int = ::AF_PUP; +pub const PF_CHAOS: ::c_int = ::AF_CHAOS; +pub const PF_NS: ::c_int = ::AF_NS; +pub const PF_IPX: ::c_int = ::AF_IPX; +pub const PF_ISO: ::c_int = ::AF_ISO; +pub const PF_OSI: ::c_int = ::AF_OSI; +pub const PF_ECMA: ::c_int = ::AF_ECMA; +pub const PF_DATAKIT: ::c_int = ::AF_DATAKIT; +pub const PF_CCITT: ::c_int = ::AF_CCITT; +pub const PF_SNA: ::c_int = ::AF_SNA; +pub const PF_DECnet: ::c_int = ::AF_DECnet; +pub const PF_DLI: ::c_int = ::AF_DLI; +pub const PF_LAT: ::c_int = ::AF_LAT; +pub const PF_HYLINK: ::c_int = ::AF_HYLINK; +pub const PF_APPLETALK: ::c_int = ::AF_APPLETALK; +pub const PF_VOICEVIEW: ::c_int = ::AF_VOICEVIEW; +pub const PF_FIREFOX: ::c_int = ::AF_FIREFOX; +pub const PF_UNKNOWN1: ::c_int = ::AF_UNKNOWN1; +pub const PF_BAN: ::c_int = ::AF_BAN; +pub const PF_ATM: ::c_int = ::AF_ATM; +pub const PF_INET6: ::c_int = ::AF_INET6; +pub const PF_BTH: ::c_int = ::AF_BTH; +pub const PF_MAX: ::c_int = ::AF_MAX; +STRUCT!{struct linger { + l_onoff: u_short, + l_linger: u_short, +}} +pub const SOMAXCONN: ::c_int = 0x7fffffff; +pub type WSAEVENT = ::HANDLE; +pub type LPWSAEVENT = ::LPHANDLE; +pub type WSAOVERLAPPED = ::OVERLAPPED; +pub type LPWSAOVERLAPPED = *mut ::OVERLAPPED; +pub const WSA_IO_PENDING: ::DWORD = ::ERROR_IO_PENDING; +pub const WSA_IO_INCOMPLETE: ::DWORD = ::ERROR_IO_INCOMPLETE; +pub const WSA_INVALID_HANDLE: ::DWORD = ::ERROR_INVALID_HANDLE; +pub const WSA_INVALID_PARAMETER: ::DWORD = ::ERROR_INVALID_PARAMETER; +pub const WSA_NOT_ENOUGH_MEMORY: ::DWORD = ::ERROR_NOT_ENOUGH_MEMORY; +pub const WSA_OPERATION_ABORTED: ::DWORD = ::ERROR_OPERATION_ABORTED; +STRUCT!{struct QOS { + SendingFlowspec: ::FLOWSPEC, + FLOWSPEC: ::FLOWSPEC, + ProviderSpecific: ::WSABUF, +}} +pub type LPQOS = *mut QOS; +STRUCT!{struct WSANETWORKEVENTS { + lNetworkEvents: ::c_long, + iErrorCode: [::c_int; FD_MAX_EVENTS], +}} +pub type LPWSANETWORKEVENTS = *mut WSANETWORKEVENTS; +pub const MAX_PROTOCOL_CHAIN: usize = 7; +STRUCT!{struct WSAPROTOCOLCHAIN { + ChainLen: ::c_int, + ChainEntries: [::DWORD; MAX_PROTOCOL_CHAIN], +}} +pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN; +pub const WSAPROTOCOL_LEN: usize = 255; +STRUCT!{nodebug struct WSAPROTOCOL_INFOA { + dwServiceFlags1: ::DWORD, + dwServiceFlags2: ::DWORD, + dwServiceFlags3: ::DWORD, + dwServiceFlags4: ::DWORD, + dwServiceFlags5: ::DWORD, + ProviderId: ::GUID, + dwCatalogEntryId: ::DWORD, + ProtocolChain: WSAPROTOCOLCHAIN, + iVersion: ::c_int, + iAddressFamily: ::c_int, + iMaxSockAddr: ::c_int, + iMinSockAddr: ::c_int, + iSocketType: ::c_int, + iProtocol: ::c_int, + iProtocolMaxOffset: ::c_int, + iNetworkByteOrder: ::c_int, + iSecurityScheme: ::c_int, + dwMessageSize: ::DWORD, + dwProviderReserved: ::DWORD, + szProtocol: [::CHAR; WSAPROTOCOL_LEN + 1], +}} +pub type LPWSAPROTOCOL_INFOA = *mut WSAPROTOCOL_INFOA; +STRUCT!{nodebug struct WSAPROTOCOL_INFOW { + dwServiceFlags1: ::DWORD, + dwServiceFlags2: ::DWORD, + dwServiceFlags3: ::DWORD, + dwServiceFlags4: ::DWORD, + dwServiceFlags5: ::DWORD, + ProviderId: ::GUID, + dwCatalogEntryId: ::DWORD, + ProtocolChain: WSAPROTOCOLCHAIN, + iVersion: ::c_int, + iAddressFamily: ::c_int, + iMaxSockAddr: ::c_int, + iMinSockAddr: ::c_int, + iSocketType: ::c_int, + iProtocol: ::c_int, + iProtocolMaxOffset: ::c_int, + iNetworkByteOrder: ::c_int, + iSecurityScheme: ::c_int, + dwMessageSize: ::DWORD, + dwProviderReserved: ::DWORD, + szProtocol: [::WCHAR; WSAPROTOCOL_LEN + 1], +}} +pub type LPWSAPROTOCOL_INFOW = *mut WSAPROTOCOL_INFOW; +pub type LPCONDITIONPROC = Option ::c_int>; +pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = Option; +ENUM!{enum WSACOMPLETIONTYPE { + NSP_NOTIFY_IMMEDIATELY = 0, + NSP_NOTIFY_HWND, + NSP_NOTIFY_EVENT, + NSP_NOTIFY_PORT, + NSP_NOTIFY_APC, +}} +pub type PWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE; +pub type LPWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE; +STRUCT!{struct WSACOMPLETION_WindowMessage { + hWnd: ::HWND, + uMsg: ::UINT, + context: ::WPARAM, +}} +STRUCT!{struct WSACOMPLETION_Event { + lpOverlapped: LPWSAOVERLAPPED, +}} +STRUCT!{nodebug struct WSACOMPLETION_Apc { + lpOverlapped: LPWSAOVERLAPPED, + lpfnCompletionProc: LPWSAOVERLAPPED_COMPLETION_ROUTINE, +}} +STRUCT!{struct WSACOMPLETION_Port { + lpOverlapped: LPWSAOVERLAPPED, + hPort: ::HANDLE, + Key: ::ULONG_PTR, +}} +#[cfg(target_arch="x86")] +STRUCT!{struct WSACOMPLETION { + Type: WSACOMPLETIONTYPE, + Parameters: [u8; 12], +}} +#[cfg(target_arch="x86_64")] +STRUCT!{struct WSACOMPLETION { + Type: WSACOMPLETIONTYPE, + Parameters: [u8; 24], +}} +UNION!(WSACOMPLETION, Parameters, WindowMessage, WindowMessage_mut, WSACOMPLETION_WindowMessage); +UNION!(WSACOMPLETION, Parameters, Event, Event_mut, WSACOMPLETION_Event); +UNION!(WSACOMPLETION, Parameters, Apc, Apc_mut, WSACOMPLETION_Apc); +UNION!(WSACOMPLETION, Parameters, Port, Port_mut, WSACOMPLETION_Port); +pub type PWSACOMPLETION = *mut WSACOMPLETION; +pub type LPWSACOMPLETION = *mut WSACOMPLETION; +STRUCT!{struct AFPROTOCOLS { + iAddressFamily: ::INT, + iProtocol: ::INT, +}} +pub type PAFPROTOCOLS = *mut AFPROTOCOLS; +pub type LPAFPROTOCOLS = *mut AFPROTOCOLS; +ENUM!{enum WSAECOMPARATOR { + COMP_EQUAL = 0, + COMP_NOTLESS, +}} +pub type PWSAECOMPARATOR = *mut WSAECOMPARATOR; +pub type LPWSAECOMPARATOR = *mut WSAECOMPARATOR; +STRUCT!{struct WSAVERSION { + dwVersion: ::DWORD, + ecHow: WSAECOMPARATOR, +}} +pub type PWSAVERSION = *mut WSAVERSION; +pub type LPWSAVERSION = *mut WSAVERSION; +STRUCT!{struct WSAQUERYSETA { + dwSize: ::DWORD, + lpszServiceInstanceName: ::LPSTR, + lpServiceClassId: ::LPGUID, + lpVersion: LPWSAVERSION, + lpszComment: ::LPSTR, + dwNameSpace: ::DWORD, + lpNSProviderId: ::LPGUID, + lpszContext: ::LPSTR, + dwNumberOfProtocols: ::DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: ::LPSTR, + dwNumberOfCsAddrs: ::DWORD, + lpcsaBuffer: ::LPCSADDR_INFO, + dwOutputFlags: ::DWORD, + lpBlob: ::LPBLOB, +}} +pub type PWSAQUERYSETA = *mut WSAQUERYSETA; +pub type LPWSAQUERYSETA = *mut WSAQUERYSETA; +STRUCT!{struct WSAQUERYSETW { + dwSize: ::DWORD, + lpszServiceInstanceName: ::LPWSTR, + lpServiceClassId: ::LPGUID, + lpVersion: LPWSAVERSION, + lpszComment: ::LPWSTR, + dwNameSpace: ::DWORD, + lpNSProviderId: ::LPGUID, + lpszContext: ::LPWSTR, + dwNumberOfProtocols: ::DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: ::LPWSTR, + dwNumberOfCsAddrs: ::DWORD, + lpcsaBuffer: ::LPCSADDR_INFO, + dwOutputFlags: ::DWORD, + lpBlob: ::LPBLOB, +}} +pub type PWSAQUERYSETW = *mut WSAQUERYSETW; +pub type LPWSAQUERYSETW = *mut WSAQUERYSETW; +STRUCT!{struct WSAQUERYSET2A { + dwSize: ::DWORD, + lpszServiceInstanceName: ::LPSTR, + lpVersion: LPWSAVERSION, + lpszComment: ::LPSTR, + dwNameSpace: ::DWORD, + lpNSProviderId: ::LPGUID, + lpszContext: ::LPSTR, + dwNumberOfProtocols: ::DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: ::LPSTR, + dwNumberOfCsAddrs: ::DWORD, + lpcsaBuffer: ::LPCSADDR_INFO, + dwOutputFlags: ::DWORD, + lpBlob: ::LPBLOB, +}} +pub type PWSAQUERYSET2A = *mut WSAQUERYSET2A; +pub type LPWSAQUERYSET2A = *mut WSAQUERYSET2A; +STRUCT!{struct WSAQUERYSET2W { + dwSize: ::DWORD, + lpszServiceInstanceName: ::LPWSTR, + lpVersion: LPWSAVERSION, + lpszComment: ::LPWSTR, + dwNameSpace: ::DWORD, + lpNSProviderId: ::LPGUID, + lpszContext: ::LPWSTR, + dwNumberOfProtocols: ::DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: ::LPWSTR, + dwNumberOfCsAddrs: ::DWORD, + lpcsaBuffer: ::LPCSADDR_INFO, + dwOutputFlags: ::DWORD, + lpBlob: ::LPBLOB, +}} +pub type PWSAQUERYSET2W = *mut WSAQUERYSET2W; +pub type LPWSAQUERYSET2W = *mut WSAQUERYSET2W; +ENUM!{enum WSAESETSERVICEOP { + RNRSERVICE_REGISTER = 0, + RNRSERVICE_DEREGISTER, + RNRSERVICE_DELETE, +}} +pub type PWSAESETSERVICEOP = *mut WSAESETSERVICEOP; +pub type LPWSAESETSERVICEOP = *mut WSAESETSERVICEOP; +STRUCT!{struct WSANSCLASSINFOA { + lpszName: ::LPSTR, + dwNameSpace: ::DWORD, + dwValueType: ::DWORD, + dwValueSize: ::DWORD, + lpValue: ::LPVOID, +}} +pub type PWSANSCLASSINFOA = *mut WSANSCLASSINFOA; +pub type LPWSANSCLASSINFOA = *mut WSANSCLASSINFOA; +STRUCT!{struct WSANSCLASSINFOW { + lpszName: ::LPWSTR, + dwNameSpace: ::DWORD, + dwValueType: ::DWORD, + dwValueSize: ::DWORD, + lpValue: ::LPVOID, +}} +pub type PWSANSCLASSINFOW = *mut WSANSCLASSINFOW; +pub type LPWSANSCLASSINFOW = *mut WSANSCLASSINFOW; +STRUCT!{struct WSASERVICECLASSINFOA { + lpServiceClassId: ::LPGUID, + lpszServiceClassName: ::LPSTR, + dwCount: ::DWORD, + lpClassInfos: LPWSANSCLASSINFOA, +}} +pub type PWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA; +pub type LPWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA; +STRUCT!{struct WSASERVICECLASSINFOW { + lpServiceClassId: ::LPGUID, + lpszServiceClassName: ::LPWSTR, + dwCount: ::DWORD, + lpClassInfos: LPWSANSCLASSINFOW, +}} +pub type PWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW; +pub type LPWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW; +STRUCT!{struct WSANAMESPACE_INFOA { + NSProviderId: ::GUID, + dwNameSpace: ::DWORD, + fActive: ::BOOL, + dwVersion: ::DWORD, + lpszIdentifier: ::LPSTR, +}} +pub type PWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA; +pub type LPWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA; +STRUCT!{struct WSANAMESPACE_INFOW { + NSProviderId: ::GUID, + dwNameSpace: ::DWORD, + fActive: ::BOOL, + dwVersion: ::DWORD, + lpszIdentifier: ::LPWSTR, +}} +pub type PWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW; +pub type LPWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW; +STRUCT!{struct WSANAMESPACE_INFOEXA { + NSProviderId: ::GUID, + dwNameSpace: ::DWORD, + fActive: ::BOOL, + dwVersion: ::DWORD, + lpszIdentifier: ::LPSTR, + ProviderSpecific: ::BLOB, +}} +pub type PWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA; +pub type LPWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA; +STRUCT!{struct WSANAMESPACE_INFOEXW { + NSProviderId: ::GUID, + dwNameSpace: ::DWORD, + fActive: ::BOOL, + dwVersion: ::DWORD, + lpszIdentifier: ::LPWSTR, + ProviderSpecific: ::BLOB, +}} +pub type PWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW; +pub type LPWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW; +pub const POLLRDNORM: ::SHORT = 0x0100; +pub const POLLRDBAND: ::SHORT = 0x0200; +pub const POLLIN: ::SHORT = POLLRDNORM | POLLRDBAND; +pub const POLLPRI: ::SHORT = 0x0400; +pub const POLLWRNORM: ::SHORT = 0x0010; +pub const POLLOUT: ::SHORT = POLLWRNORM; +pub const POLLWRBAND: ::SHORT = 0x0020; +pub const POLLERR: ::SHORT = 0x0001; +pub const POLLHUP: ::SHORT = 0x0002; +pub const POLLNVAL: ::SHORT = 0x0004; +STRUCT!{struct WSAPOLLFD { + fd: ::SOCKET, + events: ::SHORT, + revents: ::SHORT, +}} +pub type PWSAPOLLFD = *mut WSAPOLLFD; +pub type LPWSAPOLLFD = *mut WSAPOLLFD; +pub const FIONBIO: ::c_ulong = 0x8004667e; diff --git a/third_party/rust/winapi/src/winspool.rs b/third_party/rust/winapi/src/winspool.rs new file mode 100644 index 000000000000..eec339cc153a --- /dev/null +++ b/third_party/rust/winapi/src/winspool.rs @@ -0,0 +1,29 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Winspool header file +STRUCT!{struct PRINTER_DEFAULTSA { + pDataType: ::LPSTR, + pDevMode: ::LPDEVMODEA, + DesiredAccess: ::ACCESS_MASK, +}} +pub type PPRINTER_DEFAULTSA = *mut PRINTER_DEFAULTSA; +pub type LPPRINTER_DEFAULTSA = *mut PRINTER_DEFAULTSA; +STRUCT!{struct PRINTER_DEFAULTSW { + pDataType: ::LPWSTR, + pDevMode: ::LPDEVMODEW, + DesiredAccess: ::ACCESS_MASK, +}} +pub type PPRINTER_DEFAULTSW = *mut PRINTER_DEFAULTSW; +pub type LPPRINTER_DEFAULTSW = *mut PRINTER_DEFAULTSW; +STRUCT!{struct PRINTER_OPTIONSA { + cbSize: ::UINT, + dwFlags: ::DWORD, +}} +pub type PPRINTER_OPTIONSA = *mut PRINTER_OPTIONSA; +pub type LPPRINTER_OPTIONSA = *mut PRINTER_OPTIONSA; +STRUCT!{struct PRINTER_OPTIONSW { + cbSize: ::UINT, + dwFlags: ::DWORD, +}} +pub type PPRINTER_OPTIONSW = *mut PRINTER_OPTIONSW; +pub type LPPRINTER_OPTIONSW = *mut PRINTER_OPTIONSW; diff --git a/third_party/rust/winapi/src/winstring.rs b/third_party/rust/winapi/src/winstring.rs new file mode 100644 index 000000000000..74053d4e856b --- /dev/null +++ b/third_party/rust/winapi/src/winstring.rs @@ -0,0 +1,3 @@ +pub type PINSPECT_HSTRING_CALLBACK = Option ::HRESULT>; diff --git a/third_party/rust/winapi/src/winsvc.rs b/third_party/rust/winapi/src/winsvc.rs new file mode 100644 index 000000000000..93513668a87d --- /dev/null +++ b/third_party/rust/winapi/src/winsvc.rs @@ -0,0 +1,200 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Header file for the Service Control Manager +//80 +pub const SERVICE_NO_CHANGE: ::DWORD = 0xffffffff; +pub const SERVICE_ACTIVE: ::DWORD = 0x00000001; +pub const SERVICE_INACTIVE: ::DWORD = 0x00000002; +pub const SERVICE_STATE_ALL: ::DWORD = SERVICE_ACTIVE | SERVICE_INACTIVE; +pub const SERVICE_CONTROL_STOP: ::DWORD = 0x00000001; +pub const SERVICE_CONTROL_PAUSE: ::DWORD = 0x00000002; +pub const SERVICE_CONTROL_CONTINUE: ::DWORD = 0x00000003; +pub const SERVICE_CONTROL_INTERROGATE: ::DWORD = 0x00000004; +pub const SERVICE_CONTROL_SHUTDOWN: ::DWORD = 0x00000005; +pub const SERVICE_CONTROL_PARAMCHANGE: ::DWORD = 0x00000006; +pub const SERVICE_CONTROL_NETBINDADD: ::DWORD = 0x00000007; +pub const SERVICE_CONTROL_NETBINDREMOVE: ::DWORD = 0x00000008; +pub const SERVICE_CONTROL_NETBINDENABLE: ::DWORD = 0x00000009; +pub const SERVICE_CONTROL_NETBINDDISABLE: ::DWORD = 0x0000000A; +pub const SERVICE_CONTROL_DEVICEEVENT: ::DWORD = 0x0000000B; +pub const SERVICE_CONTROL_HARDWAREPROFILECHANGE: ::DWORD = 0x0000000C; +pub const SERVICE_CONTROL_POWEREVENT: ::DWORD = 0x0000000D; +pub const SERVICE_CONTROL_SESSIONCHANGE: ::DWORD = 0x0000000E; +pub const SERVICE_CONTROL_PRESHUTDOWN: ::DWORD = 0x0000000F; +pub const SERVICE_CONTROL_TIMECHANGE: ::DWORD = 0x00000010; +pub const SERVICE_CONTROL_TRIGGEREVENT: ::DWORD = 0x00000020; +pub const SERVICE_STOPPED: ::DWORD = 0x00000001; +pub const SERVICE_START_PENDING: ::DWORD = 0x00000002; +pub const SERVICE_STOP_PENDING: ::DWORD = 0x00000003; +pub const SERVICE_RUNNING: ::DWORD = 0x00000004; +pub const SERVICE_CONTINUE_PENDING: ::DWORD = 0x00000005; +pub const SERVICE_PAUSE_PENDING: ::DWORD = 0x00000006; +pub const SERVICE_PAUSED: ::DWORD = 0x00000007; +pub const SERVICE_ACCEPT_STOP: ::DWORD = 0x00000001; +pub const SERVICE_ACCEPT_PAUSE_CONTINUE: ::DWORD = 0x00000002; +pub const SERVICE_ACCEPT_SHUTDOWN: ::DWORD = 0x00000004; +pub const SERVICE_ACCEPT_PARAMCHANGE: ::DWORD = 0x00000008; +pub const SERVICE_ACCEPT_NETBINDCHANGE: ::DWORD = 0x00000010; +pub const SERVICE_ACCEPT_HARDWAREPROFILECHANGE: ::DWORD = 0x00000020; +pub const SERVICE_ACCEPT_POWEREVENT: ::DWORD = 0x00000040; +pub const SERVICE_ACCEPT_SESSIONCHANGE: ::DWORD = 0x00000080; +pub const SERVICE_ACCEPT_PRESHUTDOWN: ::DWORD = 0x00000100; +pub const SERVICE_ACCEPT_TIMECHANGE: ::DWORD = 0x00000200; +pub const SERVICE_ACCEPT_TRIGGEREVENT: ::DWORD = 0x00000400; +pub const SC_MANAGER_CONNECT: ::DWORD = 0x0001; +pub const SC_MANAGER_CREATE_SERVICE: ::DWORD = 0x0002; +pub const SC_MANAGER_ENUMERATE_SERVICE: ::DWORD = 0x0004; +pub const SC_MANAGER_LOCK: ::DWORD = 0x0008; +pub const SC_MANAGER_QUERY_LOCK_STATUS: ::DWORD = 0x0010; +pub const SC_MANAGER_MODIFY_BOOT_CONFIG: ::DWORD = 0x0020; +pub const SC_MANAGER_ALL_ACCESS: ::DWORD = ::STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT + | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK + | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG; +pub const SERVICE_QUERY_CONFIG: ::DWORD = 0x0001; +pub const SERVICE_CHANGE_CONFIG: ::DWORD = 0x0002; +pub const SERVICE_QUERY_STATUS: ::DWORD = 0x0004; +pub const SERVICE_ENUMERATE_DEPENDENTS: ::DWORD = 0x0008; +pub const SERVICE_START: ::DWORD = 0x0010; +pub const SERVICE_STOP: ::DWORD = 0x0020; +pub const SERVICE_PAUSE_CONTINUE: ::DWORD = 0x0040; +pub const SERVICE_INTERROGATE: ::DWORD = 0x0080; +pub const SERVICE_USER_DEFINED_CONTROL: ::DWORD = 0x0100; +pub const SERVICE_ALL_ACCESS: ::DWORD = ::STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG + | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START + | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL; +pub const SERVICE_RUNS_IN_SYSTEM_PROCESS: ::DWORD = 0x00000001; +pub const SERVICE_CONFIG_DESCRIPTION: ::DWORD = 1; +pub const SERVICE_CONFIG_FAILURE_ACTIONS: ::DWORD = 2; +pub const SERVICE_CONFIG_DELAYED_AUTO_START_INFO: ::DWORD = 3; +pub const SERVICE_CONFIG_FAILURE_ACTIONS_FLAG: ::DWORD = 4; +pub const SERVICE_CONFIG_SERVICE_SID_INFO: ::DWORD = 5; +pub const SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO: ::DWORD = 6; +pub const SERVICE_CONFIG_PRESHUTDOWN_INFO: ::DWORD = 7; +pub const SERVICE_CONFIG_TRIGGER_INFO: ::DWORD = 8; +pub const SERVICE_CONFIG_PREFERRED_NODE: ::DWORD = 9; +pub const SERVICE_CONFIG_LAUNCH_PROTECTED: ::DWORD = 12; +pub const SERVICE_NOTIFY_STATUS_CHANGE_1: ::DWORD = 1; +pub const SERVICE_NOTIFY_STATUS_CHANGE_2: ::DWORD = 2; +pub const SERVICE_NOTIFY_STATUS_CHANGE: ::DWORD = SERVICE_NOTIFY_STATUS_CHANGE_2; +pub const SERVICE_NOTIFY_STOPPED: ::DWORD = 0x00000001; +pub const SERVICE_NOTIFY_START_PENDING: ::DWORD = 0x00000002; +pub const SERVICE_NOTIFY_STOP_PENDING: ::DWORD = 0x00000004; +pub const SERVICE_NOTIFY_RUNNING: ::DWORD = 0x00000008; +pub const SERVICE_NOTIFY_CONTINUE_PENDING: ::DWORD = 0x00000010; +pub const SERVICE_NOTIFY_PAUSE_PENDING: ::DWORD = 0x00000020; +pub const SERVICE_NOTIFY_PAUSED: ::DWORD = 0x00000040; +pub const SERVICE_NOTIFY_CREATED: ::DWORD = 0x00000080; +pub const SERVICE_NOTIFY_DELETED: ::DWORD = 0x00000100; +pub const SERVICE_NOTIFY_DELETE_PENDING: ::DWORD = 0x00000200; +pub const SERVICE_STOP_REASON_FLAG_MIN: ::DWORD = 0x00000000; +pub const SERVICE_STOP_REASON_FLAG_UNPLANNED: ::DWORD = 0x10000000; +pub const SERVICE_STOP_REASON_FLAG_CUSTOM: ::DWORD = 0x20000000; +pub const SERVICE_STOP_REASON_FLAG_PLANNED: ::DWORD = 0x40000000; +pub const SERVICE_STOP_REASON_FLAG_MAX: ::DWORD = 0x80000000; +pub const SERVICE_STOP_REASON_MAJOR_MIN: ::DWORD = 0x00000000; +pub const SERVICE_STOP_REASON_MAJOR_OTHER: ::DWORD = 0x00010000; +pub const SERVICE_STOP_REASON_MAJOR_HARDWARE: ::DWORD = 0x00020000; +pub const SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM: ::DWORD = 0x00030000; +pub const SERVICE_STOP_REASON_MAJOR_SOFTWARE: ::DWORD = 0x00040000; +pub const SERVICE_STOP_REASON_MAJOR_APPLICATION: ::DWORD = 0x00050000; +pub const SERVICE_STOP_REASON_MAJOR_NONE: ::DWORD = 0x00060000; +pub const SERVICE_STOP_REASON_MAJOR_MAX: ::DWORD = 0x00070000; +pub const SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM: ::DWORD = 0x00400000; +pub const SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM: ::DWORD = 0x00ff0000; +pub const SERVICE_STOP_REASON_MINOR_MIN: ::DWORD = 0x00000000; +pub const SERVICE_STOP_REASON_MINOR_OTHER: ::DWORD = 0x00000001; +pub const SERVICE_STOP_REASON_MINOR_MAINTENANCE: ::DWORD = 0x00000002; +pub const SERVICE_STOP_REASON_MINOR_INSTALLATION: ::DWORD = 0x00000003; +pub const SERVICE_STOP_REASON_MINOR_UPGRADE: ::DWORD = 0x00000004; +pub const SERVICE_STOP_REASON_MINOR_RECONFIG: ::DWORD = 0x00000005; +pub const SERVICE_STOP_REASON_MINOR_HUNG: ::DWORD = 0x00000006; +pub const SERVICE_STOP_REASON_MINOR_UNSTABLE: ::DWORD = 0x00000007; +pub const SERVICE_STOP_REASON_MINOR_DISK: ::DWORD = 0x00000008; +pub const SERVICE_STOP_REASON_MINOR_NETWORKCARD: ::DWORD = 0x00000009; +pub const SERVICE_STOP_REASON_MINOR_ENVIRONMENT: ::DWORD = 0x0000000a; +pub const SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER: ::DWORD = 0x0000000b; +pub const SERVICE_STOP_REASON_MINOR_OTHERDRIVER: ::DWORD = 0x0000000c; +pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK: ::DWORD = 0x0000000d; +pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE: ::DWORD = 0x0000000e; +pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX: ::DWORD = 0x0000000f; +pub const SERVICE_STOP_REASON_MINOR_SECURITY: ::DWORD = 0x00000010; +pub const SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY: ::DWORD = 0x00000011; +pub const SERVICE_STOP_REASON_MINOR_WMI: ::DWORD = 0x00000012; +pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL: ::DWORD = 0x00000013; +pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL: ::DWORD = 0x00000014; +pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL: ::DWORD = 0x00000015; +pub const SERVICE_STOP_REASON_MINOR_MMC: ::DWORD = 0x00000016; +pub const SERVICE_STOP_REASON_MINOR_NONE: ::DWORD = 0x00000017; +pub const SERVICE_STOP_REASON_MINOR_MAX: ::DWORD = 0x00000018; +pub const SERVICE_STOP_REASON_MINOR_MIN_CUSTOM: ::DWORD = 0x00000100; +pub const SERVICE_STOP_REASON_MINOR_MAX_CUSTOM: ::DWORD = 0x0000FFFF; +pub const SERVICE_CONTROL_STATUS_REASON_INFO: ::DWORD = 1; +pub const SERVICE_SID_TYPE_NONE: ::DWORD = 0x00000000; +pub const SERVICE_SID_TYPE_UNRESTRICTED: ::DWORD = 0x00000001; +pub const SERVICE_SID_TYPE_RESTRICTED: ::DWORD = 0x00000002 | SERVICE_SID_TYPE_UNRESTRICTED; +pub const SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL: ::DWORD = 1; +pub const SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY: ::DWORD = 2; +pub const SERVICE_TRIGGER_TYPE_DOMAIN_JOIN: ::DWORD = 3; +pub const SERVICE_TRIGGER_TYPE_FIREWALL_PORT_EVENT: ::DWORD = 4; +pub const SERVICE_TRIGGER_TYPE_GROUP_POLICY: ::DWORD = 5; +pub const SERVICE_TRIGGER_TYPE_NETWORK_ENDPOINT: ::DWORD = 6; +pub const SERVICE_TRIGGER_TYPE_CUSTOM_SYSTEM_STATE_CHANGE: ::DWORD = 7; +pub const SERVICE_TRIGGER_TYPE_CUSTOM: ::DWORD = 20; +pub const SERVICE_TRIGGER_DATA_TYPE_BINARY: ::DWORD = 1; +pub const SERVICE_TRIGGER_DATA_TYPE_STRING: ::DWORD = 2; +pub const SERVICE_TRIGGER_DATA_TYPE_LEVEL: ::DWORD = 3; +pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ANY: ::DWORD = 4; +pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ALL: ::DWORD = 5; +pub const SERVICE_START_REASON_DEMAND: ::DWORD = 0x00000001; +pub const SERVICE_START_REASON_AUTO: ::DWORD = 0x00000002; +pub const SERVICE_START_REASON_TRIGGER: ::DWORD = 0x00000004; +pub const SERVICE_START_REASON_RESTART_ON_FAILURE: ::DWORD = 0x00000008; +pub const SERVICE_START_REASON_DELAYEDAUTO: ::DWORD = 0x00000010; +pub const SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON: ::DWORD = 1; +pub const SERVICE_LAUNCH_PROTECTED_NONE: ::DWORD = 0; +pub const SERVICE_LAUNCH_PROTECTED_WINDOWS: ::DWORD = 1; +pub const SERVICE_LAUNCH_PROTECTED_WINDOWS_LIGHT: ::DWORD = 2; +pub const SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT: ::DWORD = 3; +//678 +DECLARE_HANDLE!(SC_HANDLE, SC_HANDLE__); +pub type LPSC_HANDLE = *mut SC_HANDLE; +DECLARE_HANDLE!(SERVICE_STATUS_HANDLE, SERVICE_STATUS_HANDLE__); +ENUM!{enum SC_STATUS_TYPE { + SC_STATUS_PROCESS_INFO = 0, +}} +ENUM!{enum _SC_ENUM_TYPE { + SC_ENUM_PROCESS_INFO = 0, +}} +//700 +STRUCT!{struct SERVICE_STATUS { + dwServiceType: ::DWORD, + dwCurrentState: ::DWORD, + dwControlsAccepted: ::DWORD, + dwWin32ExitCode: ::DWORD, + dwServiceSpecificExitCode: ::DWORD, + dwCheckPoint: ::DWORD, + dwWaitHint: ::DWORD, +}} +pub type LPSERVICE_STATUS = *mut SERVICE_STATUS; +//848 +pub type LPSERVICE_MAIN_FUNCTIONW = Option; +pub type LPSERVICE_MAIN_FUNCTIONA = Option; +STRUCT!{nodebug struct SERVICE_TABLE_ENTRYA { + lpServiceName: ::LPCSTR, + lpServiceProc: LPSERVICE_MAIN_FUNCTIONA, +}} +pub type LPSERVICE_TABLE_ENTRYA = *mut SERVICE_TABLE_ENTRYA; +STRUCT!{nodebug struct SERVICE_TABLE_ENTRYW { + lpServiceName: ::LPCWSTR, + lpServiceProc: LPSERVICE_MAIN_FUNCTIONW, +}} +pub type LPSERVICE_TABLE_ENTRYW = *mut SERVICE_TABLE_ENTRYW; +//900 +pub type LPHANDLER_FUNCTION = Option; +pub type LPHANDLER_FUNCTION_EX = Option ::DWORD>; diff --git a/third_party/rust/winapi/src/winusb.rs b/third_party/rust/winapi/src/winusb.rs new file mode 100644 index 000000000000..2fbb6199758d --- /dev/null +++ b/third_party/rust/winapi/src/winusb.rs @@ -0,0 +1,33 @@ +// Copyright © 2016, bitbegin +// Licensed under the MIT License +//! FFI bindings to winusb. +pub type WINUSB_INTERFACE_HANDLE = ::PVOID; +pub type PWINUSB_INTERFACE_HANDLE = *mut ::PVOID; +pub type WINUSB_ISOCH_BUFFER_HANDLE = ::PVOID; +pub type PWINUSB_ISOCH_BUFFER_HANDLE = *mut ::PVOID; +STRUCT!{#[repr(packed)] struct WINUSB_SETUP_PACKET { + RequestType: ::UCHAR, + Request: ::UCHAR, + Value: ::USHORT, + Index: ::USHORT, + Length: ::USHORT, +}} +pub type PWINUSB_SETUP_PACKET = *mut WINUSB_SETUP_PACKET; + +STRUCT!{struct USB_INTERFACE_DESCRIPTOR { + bLength: ::UCHAR, + bDescriptorType: ::UCHAR, + bInterfaceNumber: ::UCHAR, + bAlternateSetting: ::UCHAR, + bNumEndpoints: ::UCHAR, + bInterfaceClass: ::UCHAR, + bInterfaceSubClass: ::UCHAR, + bInterfaceProtocol: ::UCHAR, + iInterface: ::UCHAR, +}} +pub type PUSB_INTERFACE_DESCRIPTOR = *mut USB_INTERFACE_DESCRIPTOR; +#[test] +fn test_USB_INTERFACE_DESCRIPTOR_size() { + use std::mem::size_of; + assert_eq!(size_of::(), 9) +} diff --git a/third_party/rust/winapi/src/winusbio.rs b/third_party/rust/winapi/src/winusbio.rs new file mode 100644 index 000000000000..3dedf2265f98 --- /dev/null +++ b/third_party/rust/winapi/src/winusbio.rs @@ -0,0 +1,18 @@ +// Copyright © 2016, bitbegin +// Licensed under the MIT License +//! USBIO Definitions. +STRUCT!{struct WINUSB_PIPE_INFORMATION { + PipeType: ::USBD_PIPE_TYPE, + PipeId: ::UCHAR, + MaximumPacketSize: ::USHORT, + Interval: ::UCHAR, +}} +pub type PWINUSB_PIPE_INFORMATION = *mut WINUSB_PIPE_INFORMATION; +STRUCT!{struct WINUSB_PIPE_INFORMATION_EX { + PipeType: ::USBD_PIPE_TYPE, + PipeId: ::UCHAR, + MaximumPacketSize: ::USHORT, + Interval: ::UCHAR, + MaximumBytesPerInterval: ::ULONG, +}} +pub type PWINUSB_PIPE_INFORMATION_EX = *mut WINUSB_PIPE_INFORMATION_EX; diff --git a/third_party/rust/winapi/src/winuser.rs b/third_party/rust/winapi/src/winuser.rs new file mode 100644 index 000000000000..576948911269 --- /dev/null +++ b/third_party/rust/winapi/src/winuser.rs @@ -0,0 +1,2334 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! USER procedure declarations, constant definitions and macros + +// Edit Control Styles +// +pub const ES_LEFT: ::DWORD = 0x0000; +pub const ES_CENTER: ::DWORD = 0x0001; +pub const ES_RIGHT: ::DWORD = 0x0002; +pub const ES_MULTILINE: ::DWORD = 0x0004; +pub const ES_UPPERCASE: ::DWORD = 0x0008; +pub const ES_LOWERCASE: ::DWORD = 0x0010; +pub const ES_PASSWORD: ::DWORD = 0x0020; +pub const ES_AUTOVSCROLL: ::DWORD = 0x0040; +pub const ES_AUTOHSCROLL: ::DWORD = 0x0080; +pub const ES_NOHIDESEL: ::DWORD = 0x0100; +pub const ES_OEMCONVERT: ::DWORD = 0x0400; +pub const ES_READONLY: ::DWORD = 0x0800; +pub const ES_WANTRETURN: ::DWORD = 0x1000; +pub const ES_NUMBER: ::DWORD = 0x2000; + +// Edit Control Notification Codes +// +pub const EN_SETFOCUS: ::WORD = 0x0100; +pub const EN_KILLFOCUS: ::WORD = 0x0200; +pub const EN_CHANGE: ::WORD = 0x0300; +pub const EN_UPDATE: ::WORD = 0x0400; +pub const EN_ERRSPACE: ::WORD = 0x0500; +pub const EN_MAXTEXT: ::WORD = 0x0501; +pub const EN_HSCROLL: ::WORD = 0x0601; +pub const EN_VSCROLL: ::WORD = 0x0602; + +pub const EN_ALIGN_LTR_EC: ::WORD = 0x0700; +pub const EN_ALIGN_RTL_EC: ::WORD = 0x0701; + +// Edit control EM_SETMARGIN parameters +pub const EC_LEFTMARGIN: ::WORD = 0x0001; +pub const EC_RIGHTMARGIN: ::WORD = 0x0002; +pub const EC_USEFONTINFO: ::WORD = 0xffff; + +// wParam of EM_GET/SETIMESTATUS +pub const EMSIS_COMPOSITIONSTRING: ::WORD = 0x0001; + +// lParam for EMSIS_COMPOSITIONSTRING +pub const EIMES_GETCOMPSTRATONCE: ::WORD = 0x0001; +pub const EIMES_CANCELCOMPSTRINFOCUS: ::WORD = 0x0002; +pub const EIMES_COMPLETECOMPSTRKILLFOCUS: ::WORD = 0x0004; + +// Edit Control Messages +// +pub const EM_GETSEL: ::WORD = 0x00B0; +pub const EM_SETSEL: ::WORD = 0x00B1; +pub const EM_GETRECT: ::WORD = 0x00B2; +pub const EM_SETRECT: ::WORD = 0x00B3; +pub const EM_SETRECTNP: ::WORD = 0x00B4; +pub const EM_SCROLL: ::WORD = 0x00B5; +pub const EM_LINESCROLL: ::WORD = 0x00B6; +pub const EM_SCROLLCARET: ::WORD = 0x00B7; +pub const EM_GETMODIFY: ::WORD = 0x00B8; +pub const EM_SETMODIFY: ::WORD = 0x00B9; +pub const EM_GETLINECOUNT: ::WORD = 0x00BA; +pub const EM_LINEINDEX: ::WORD = 0x00BB; +pub const EM_SETHANDLE: ::WORD = 0x00BC; +pub const EM_GETHANDLE: ::WORD = 0x00BD; +pub const EM_GETTHUMB: ::WORD = 0x00BE; +pub const EM_LINELENGTH: ::WORD = 0x00C1; +pub const EM_REPLACESEL: ::WORD = 0x00C2; +pub const EM_GETLINE: ::WORD = 0x00C4; +pub const EM_LIMITTEXT: ::WORD = 0x00C5; +pub const EM_CANUNDO: ::WORD = 0x00C6; +pub const EM_UNDO: ::WORD = 0x00C7; +pub const EM_FMTLINES: ::WORD = 0x00C8; +pub const EM_LINEFROMCHAR: ::WORD = 0x00C9; +pub const EM_SETTABSTOPS: ::WORD = 0x00CB; +pub const EM_SETPASSWORDCHAR: ::WORD = 0x00CC; +pub const EM_EMPTYUNDOBUFFER: ::WORD = 0x00CD; +pub const EM_GETFIRSTVISIBLELINE: ::WORD = 0x00CE; +pub const EM_SETREADONLY: ::WORD = 0x00CF; +pub const EM_SETWORDBREAKPROC: ::WORD = 0x00D0; +pub const EM_GETWORDBREAKPROC: ::WORD = 0x00D1; +pub const EM_GETPASSWORDCHAR: ::WORD = 0x00D2; + +pub const EM_SETMARGINS: ::WORD = 0x00D3; +pub const EM_GETMARGINS: ::WORD = 0x00D4; +pub const EM_SETLIMITTEXT: ::WORD = EM_LIMITTEXT; +pub const EM_GETLIMITTEXT: ::WORD = 0x00D5; +pub const EM_POSFROMCHAR: ::WORD = 0x00D6; +pub const EM_CHARFROMPOS: ::WORD = 0x00D7; + +pub const EM_SETIMESTATUS: ::WORD = 0x00D8; +pub const EM_GETIMESTATUS: ::WORD = 0x00D9; + +// EDITWORDBREAKPROC code values +// +pub const WB_LEFT: ::WORD = 0; +pub const WB_RIGHT: ::WORD = 1; +pub const WB_ISDELIMITER: ::WORD = 2; + +pub const BN_CLICKED: ::WORD = 0; +pub const BN_PAINT: ::WORD = 1; +pub const BN_HILITE: ::WORD = 2; +pub const BN_UNHILITE: ::WORD = 3; +pub const BN_DISABLE: ::WORD = 4; +pub const BN_DOUBLECLICKED: ::WORD = 5; +pub const BN_PUSHED: ::WORD = BN_HILITE; +pub const BN_UNPUSHED: ::WORD = BN_UNHILITE; +pub const BN_DBLCLK: ::WORD = BN_DOUBLECLICKED; +pub const BN_SETFOCUS: ::WORD = 6; +pub const BN_KILLFOCUS: ::WORD = 7; +pub const BS_PUSHBUTTON: ::DWORD = 0x00000000; +pub const BS_DEFPUSHBUTTON: ::DWORD = 0x00000001; +pub const BS_CHECKBOX: ::DWORD = 0x00000002; +pub const BS_AUTOCHECKBOX: ::DWORD = 0x00000003; +pub const BS_RADIOBUTTON: ::DWORD = 0x00000004; +pub const BS_3STATE: ::DWORD = 0x00000005; +pub const BS_AUTO3STATE: ::DWORD = 0x00000006; +pub const BS_GROUPBOX: ::DWORD = 0x00000007; +pub const BS_USERBUTTON: ::DWORD = 0x00000008; +pub const BS_AUTORADIOBUTTON: ::DWORD = 0x00000009; +pub const BS_PUSHBOX: ::DWORD = 0x0000000A; +pub const BS_OWNERDRAW: ::DWORD = 0x0000000B; +pub const BS_TYPEMASK: ::DWORD = 0x0000000F; +pub const BS_LEFTTEXT: ::DWORD = 0x00000020; +pub const BS_TEXT: ::DWORD = 0x00000000; +pub const BS_ICON: ::DWORD = 0x00000040; +pub const BS_BITMAP: ::DWORD = 0x00000080; +pub const BS_LEFT: ::DWORD = 0x00000100; +pub const BS_RIGHT: ::DWORD = 0x00000200; +pub const BS_CENTER: ::DWORD = 0x00000300; +pub const BS_TOP: ::DWORD = 0x00000400; +pub const BS_BOTTOM: ::DWORD = 0x00000800; +pub const BS_VCENTER: ::DWORD = 0x00000C00; +pub const BS_PUSHLIKE: ::DWORD = 0x00001000; +pub const BS_MULTILINE: ::DWORD = 0x00002000; +pub const BS_NOTIFY: ::DWORD = 0x00004000; +pub const BS_FLAT: ::DWORD = 0x00008000; +pub const BS_RIGHTBUTTON: ::DWORD = BS_LEFTTEXT; +pub const CCHILDREN_SCROLLBAR: usize = 5; +pub const CDS_UPDATEREGISTRY: ::DWORD = 0x00000001; +pub const CDS_TEST: ::DWORD = 0x00000002; +pub const CDS_FULLSCREEN: ::DWORD = 0x00000004; +pub const CDS_GLOBAL: ::DWORD = 0x00000008; +pub const CDS_SET_PRIMARY: ::DWORD = 0x00000010; +pub const CDS_VIDEOPARAMETERS: ::DWORD = 0x00000020; +pub const CDS_ENABLE_UNSAFE_MODES: ::DWORD = 0x00000100; +pub const CDS_DISABLE_UNSAFE_MODES: ::DWORD = 0x00000200; +pub const CDS_RESET: ::DWORD = 0x40000000; +pub const CDS_RESET_EX: ::DWORD = 0x20000000; +pub const CDS_NORESET: ::DWORD = 0x10000000; +pub const CF_TEXT: ::UINT = 1; +pub const CF_BITMAP: ::UINT = 2; +pub const CF_METAFILEPICT: ::UINT = 3; +pub const CF_SYLK: ::UINT = 4; +pub const CF_DIF: ::UINT = 5; +pub const CF_TIFF: ::UINT = 6; +pub const CF_OEMTEXT: ::UINT = 7; +pub const CF_DIB: ::UINT = 8; +pub const CF_PALETTE: ::UINT = 9; +pub const CF_PENDATA: ::UINT = 10; +pub const CF_RIFF: ::UINT = 11; +pub const CF_WAVE: ::UINT = 12; +pub const CF_UNICODETEXT: ::UINT = 13; +pub const CF_ENHMETAFILE: ::UINT = 14; +pub const CF_HDROP: ::UINT = 15; +pub const CF_LOCALE: ::UINT = 16; +pub const CF_DIBV5: ::UINT = 17; +pub const CF_OWNERDISPLAY: ::UINT = 0x0080; +pub const CF_DSPTEXT: ::UINT = 0x0081; +pub const CF_DSPBITMAP: ::UINT = 0x0082; +pub const CF_DSPENHMETAFILE: ::UINT = 0x008E; +pub const CF_DSPMETAFILEPICT: ::UINT = 0x0083; +pub const CF_PRIVATEFIRST: ::UINT = 0x0200; +pub const CF_PRIVATELAST: ::UINT = 0x02FF; +pub const CF_GDIOBJFIRST: ::UINT = 0x0300; +pub const CF_GDIOBJLAST: ::UINT = 0x03FF; +pub const CS_VREDRAW: ::DWORD = 0x0001; +pub const CS_HREDRAW: ::DWORD = 0x0002; +pub const CS_DBLCLKS: ::DWORD = 0x0008; +pub const CS_OWNDC: ::DWORD = 0x0020; +pub const CS_CLASSDC: ::DWORD = 0x0040; +pub const CS_PARENTDC: ::DWORD = 0x0080; +pub const CS_NOCLOSE: ::DWORD = 0x0200; +pub const CS_SAVEBITS: ::DWORD = 0x0800; +pub const CS_BYTEALIGNCLIENT: ::DWORD = 0x1000; +pub const CS_BYTEALIGNWINDOW: ::DWORD = 0x2000; +pub const CS_GLOBALCLASS: ::DWORD = 0x4000; +pub const CS_IME: ::DWORD = 0x00010000; +pub const CS_DROPSHADOW: ::DWORD = 0x00020000; +pub const DFC_CAPTION: ::UINT = 1; +pub const DFC_MENU: ::UINT = 2; +pub const DFC_SCROLL: ::UINT = 3; +pub const DFC_BUTTON: ::UINT = 4; +pub const DFCS_CAPTIONCLOSE: ::UINT = 0x0000; +pub const DFCS_CAPTIONMIN: ::UINT = 0x0001; +pub const DFCS_CAPTIONMAX: ::UINT = 0x0002; +pub const DFCS_CAPTIONRESTORE: ::UINT = 0x0003; +pub const DFCS_CAPTIONHELP: ::UINT = 0x0004; +pub const DFCS_MENUARROW: ::UINT = 0x0000; +pub const DFCS_MENUCHECK: ::UINT = 0x0001; +pub const DFCS_MENUBULLET: ::UINT = 0x0002; +pub const DFCS_MENUARROWRIGHT: ::UINT = 0x0004; +pub const DFCS_SCROLLUP: ::UINT = 0x0000; +pub const DFCS_SCROLLDOWN: ::UINT = 0x0001; +pub const DFCS_SCROLLLEFT: ::UINT = 0x0002; +pub const DFCS_SCROLLRIGHT: ::UINT = 0x0003; +pub const DFCS_SCROLLCOMBOBOX: ::UINT = 0x0005; +pub const DFCS_SCROLLSIZEGRIP: ::UINT = 0x0008; +pub const DFCS_SCROLLSIZEGRIPRIGHT: ::UINT = 0x0010; +pub const DFCS_BUTTONCHECK: ::UINT = 0x0000; +pub const DFCS_BUTTONRADIOIMAGE: ::UINT = 0x0001; +pub const DFCS_BUTTONRADIOMASK: ::UINT = 0x0002; +pub const DFCS_BUTTONRADIO: ::UINT = 0x0004; +pub const DFCS_BUTTON3STATE: ::UINT = 0x0008; +pub const DFCS_BUTTONPUSH: ::UINT = 0x0010; +pub const DFCS_INACTIVE: ::UINT = 0x0100; +pub const DFCS_PUSHED: ::UINT = 0x0200; +pub const DFCS_CHECKED: ::UINT = 0x0400; +// if WINVER >= 0x0500 +pub const DFCS_TRANSPARENT: ::UINT = 0x0800; +pub const DFCS_HOT: ::UINT = 0x1000; +// end if WINVER >= 0x0500 +pub const DFCS_ADJUSTRECT: ::UINT = 0x2000; +pub const DFCS_FLAT: ::UINT = 0x4000; +pub const DFCS_MONO: ::UINT = 0x8000; +pub const CW_USEDEFAULT: ::c_int = 0x80000000u32 as ::c_int; +pub const DISP_CHANGE_SUCCESSFUL: ::LONG = 0; +pub const DISP_CHANGE_RESTART: ::LONG = 1; +pub const DISP_CHANGE_FAILED: ::LONG = -1; +pub const DISP_CHANGE_BADMODE: ::LONG = -2; +pub const DISP_CHANGE_NOTUPDATED: ::LONG = -3; +pub const DISP_CHANGE_BADFLAGS: ::LONG = -4; +pub const DISP_CHANGE_BADPARAM: ::LONG = -5; +pub const DISP_CHANGE_BADDUALVIEW: ::LONG = -6; +pub const EDD_GET_DEVICE_INTERFACE_NAME: ::DWORD = 0x00000001; +pub const ENUM_CURRENT_SETTINGS: ::DWORD = 0xFFFFFFFF; +pub const ENUM_REGISTRY_SETTINGS: ::DWORD = 0xFFFFFFFE; +pub const GW_HWNDFIRST: ::UINT = 0; +pub const GW_HWNDLAST: ::UINT = 1; +pub const GW_HWNDNEXT: ::UINT = 2; +pub const GW_HWNDPREV: ::UINT = 3; +pub const GW_OWNER: ::UINT = 4; +pub const GW_CHILD: ::UINT = 5; +pub const GW_ENABLEDPOPUP: ::UINT = 6; +pub const GW_MAX: ::UINT = 6; +pub const HTERROR: ::c_int = -2; +pub const HTTRANSPARENT: ::c_int = -1; +pub const HTNOWHERE: ::c_int = 0; +pub const HTCLIENT: ::c_int = 1; +pub const HTCAPTION: ::c_int = 2; +pub const HTSYSMENU: ::c_int = 3; +pub const HTGROWBOX: ::c_int = 4; +pub const HTSIZE: ::c_int = HTGROWBOX; +pub const HTMENU: ::c_int = 5; +pub const HTHSCROLL: ::c_int = 6; +pub const HTVSCROLL: ::c_int = 7; +pub const HTMINBUTTON: ::c_int = 8; +pub const HTMAXBUTTON: ::c_int = 9; +pub const HTLEFT: ::c_int = 10; +pub const HTRIGHT: ::c_int = 11; +pub const HTTOP: ::c_int = 12; +pub const HTTOPLEFT: ::c_int = 13; +pub const HTTOPRIGHT: ::c_int = 14; +pub const HTBOTTOM: ::c_int = 15; +pub const HTBOTTOMLEFT: ::c_int = 16; +pub const HTBOTTOMRIGHT: ::c_int = 17; +pub const HTBORDER: ::c_int = 18; +pub const HTREDUCE: ::c_int = HTMINBUTTON; +pub const HTZOOM: ::c_int = HTMAXBUTTON; +pub const HTSIZEFIRST: ::c_int = HTLEFT; +pub const HTSIZELAST: ::c_int = HTBOTTOMRIGHT; +pub const HTOBJECT: ::c_int = 19; +pub const HTCLOSE: ::c_int = 20; +pub const HTHELP: ::c_int = 21; +pub const LSFW_LOCK: ::UINT = 1; +pub const LSFW_UNLOCK: ::UINT = 2; +pub const MDITILE_VERTICAL: ::UINT = 0x0000; +pub const MDITILE_HORIZONTAL: ::UINT = 0x0001; +pub const MDITILE_SKIPDISABLED: ::UINT = 0x0002; +pub const MDITILE_ZORDER: ::UINT = 0x0004; +pub const MB_OK: ::DWORD = 0x00000000; +pub const MB_OKCANCEL: ::DWORD = 0x00000001; +pub const MB_ABORTRETRYIGNORE: ::DWORD = 0x00000002; +pub const MB_YESNOCANCEL: ::DWORD = 0x00000003; +pub const MB_YESNO: ::DWORD = 0x00000004; +pub const MB_RETRYCANCEL: ::DWORD = 0x00000005; +pub const MB_CANCELTRYCONTINUE: ::DWORD = 0x00000006; +pub const MB_ICONHAND: ::DWORD = 0x00000010; +pub const MB_ICONQUESTION: ::DWORD = 0x00000020; +pub const MB_ICONEXCLAMATION: ::DWORD = 0x00000030; +pub const MB_ICONASTERISK: ::DWORD = 0x00000040; +pub const MB_USERICON: ::DWORD = 0x00000080; +pub const MB_ICONWARNING: ::DWORD = MB_ICONEXCLAMATION; +pub const MB_ICONERROR: ::DWORD = MB_ICONHAND; +pub const MB_ICONINFORMATION: ::DWORD = MB_ICONASTERISK; +pub const MB_ICONSTOP: ::DWORD = MB_ICONHAND; +pub const MB_DEFBUTTON1: ::DWORD = 0x00000000; +pub const MB_DEFBUTTON2: ::DWORD = 0x00000100; +pub const MB_DEFBUTTON3: ::DWORD = 0x00000200; +pub const MB_DEFBUTTON4: ::DWORD = 0x00000300; +pub const MB_APPLMODAL: ::DWORD = 0x00000000; +pub const MB_SYSTEMMODAL: ::DWORD = 0x00001000; +pub const MB_TASKMODAL: ::DWORD = 0x00002000; +pub const MB_HELP: ::DWORD = 0x00004000; +pub const MB_NOFOCUS: ::DWORD = 0x00008000; +pub const MB_SETFOREGROUND: ::DWORD = 0x00010000; +pub const MB_DEFAULT_DESKTOP_ONLY: ::DWORD = 0x00020000; +pub const MB_TOPMOST: ::DWORD = 0x00040000; +pub const MB_RIGHT: ::DWORD = 0x00080000; +pub const MB_RTLREADING: ::DWORD = 0x00100000; +pub const MB_SERVICE_NOTIFICATION: ::DWORD = 0x00200000; +pub const MB_SERVICE_NOTIFICATION_NT3X: ::DWORD = 0x00040000; +pub const MB_TYPEMASK: ::DWORD = 0x0000000F; +pub const MB_ICONMASK: ::DWORD = 0x000000F0; +pub const MB_DEFMASK: ::DWORD = 0x00000F00; +pub const MB_MODEMASK: ::DWORD = 0x00003000; +pub const MB_MISCMASK: ::DWORD = 0x0000C000; +pub const MF_BITMAP: ::UINT = 0x00000004; +pub const MF_CHECKED: ::UINT = 0x00000008; +pub const MF_DISABLED: ::UINT = 0x00000002; +pub const MF_ENABLED: ::UINT = 0x00000000; +pub const MF_GRAYED: ::UINT = 0x00000001; +pub const MF_MENUBARBREAK: ::UINT = 0x00000020; +pub const MF_MENUBREAK: ::UINT = 0x00000040; +pub const MF_OWNERDRAW: ::UINT = 0x00000100; +pub const MF_POPUP: ::UINT = 0x00000010; +pub const MF_SEPARATOR: ::UINT = 0x00000800; +pub const MF_STRING: ::UINT = 0x00000000; +pub const MF_UNCHECKED: ::UINT = 0x00000000; +pub const SB_HORZ: ::c_int = 0; +pub const SB_VERT: ::c_int = 1; +pub const SB_CTL: ::c_int = 2; +pub const SB_BOTH: ::c_int = 3; +pub const SW_HIDE: ::c_int = 0; +pub const SW_SHOWNORMAL: ::c_int = 1; +pub const SW_NORMAL: ::c_int = 1; +pub const SW_SHOWMINIMIZED: ::c_int = 2; +pub const SW_SHOWMAXIMIZED: ::c_int = 3; +pub const SW_MAXIMIZE: ::c_int = 3; +pub const SW_SHOWNOACTIVATE: ::c_int = 4; +pub const SW_SHOW: ::c_int = 5; +pub const SW_MINIMIZE: ::c_int = 6; +pub const SW_SHOWMINNOACTIVE: ::c_int = 7; +pub const SW_SHOWNA: ::c_int = 8; +pub const SW_RESTORE: ::c_int = 9; +pub const SW_SHOWDEFAULT: ::c_int = 10; +pub const SW_FORCEMINIMIZE: ::c_int = 11; +pub const SW_MAX: ::c_int = 11; +pub const SWP_NOSIZE: ::UINT = 0x0001; +pub const SWP_NOMOVE: ::UINT = 0x0002; +pub const SWP_NOZORDER: ::UINT = 0x0004; +pub const SWP_NOREDRAW: ::UINT = 0x0008; +pub const SWP_NOACTIVATE: ::UINT = 0x0010; +pub const SWP_FRAMECHANGED: ::UINT = 0x0020; +pub const SWP_SHOWWINDOW: ::UINT = 0x0040; +pub const SWP_HIDEWINDOW: ::UINT = 0x0080; +pub const SWP_NOCOPYBITS: ::UINT = 0x0100; +pub const SWP_NOOWNERZORDER: ::UINT = 0x0200; +pub const SWP_NOSENDCHANGING: ::UINT = 0x0400; +pub const SWP_DRAWFRAME: ::UINT = SWP_FRAMECHANGED; +pub const SWP_NOREPOSITION: ::UINT = SWP_NOOWNERZORDER; +pub const SWP_DEFERERASE: ::UINT = 0x2000; +pub const SWP_ASYNCWINDOWPOS: ::UINT = 0x4000; +pub const VK_LBUTTON: ::c_int = 0x01; +pub const VK_RBUTTON: ::c_int = 0x02; +pub const VK_CANCEL: ::c_int = 0x03; +pub const VK_MBUTTON: ::c_int = 0x04; +pub const VK_XBUTTON1: ::c_int = 0x05; +pub const VK_XBUTTON2: ::c_int = 0x06; +pub const VK_BACK: ::c_int = 0x08; +pub const VK_TAB: ::c_int = 0x09; +pub const VK_CLEAR: ::c_int = 0x0C; +pub const VK_RETURN: ::c_int = 0x0D; +pub const VK_SHIFT: ::c_int = 0x10; +pub const VK_CONTROL: ::c_int = 0x11; +pub const VK_MENU: ::c_int = 0x12; +pub const VK_PAUSE: ::c_int = 0x13; +pub const VK_CAPITAL: ::c_int = 0x14; +pub const VK_KANA: ::c_int = 0x15; +pub const VK_HANGUEL: ::c_int = 0x15; +pub const VK_HANGUL: ::c_int = 0x15; +pub const VK_JUNJA: ::c_int = 0x17; +pub const VK_FINAL: ::c_int = 0x18; +pub const VK_HANJA: ::c_int = 0x19; +pub const VK_KANJI: ::c_int = 0x19; +pub const VK_ESCAPE: ::c_int = 0x1B; +pub const VK_CONVERT: ::c_int = 0x1C; +pub const VK_NONCONVERT: ::c_int = 0x1D; +pub const VK_ACCEPT: ::c_int = 0x1E; +pub const VK_MODECHANGE: ::c_int = 0x1F; +pub const VK_SPACE: ::c_int = 0x20; +pub const VK_PRIOR: ::c_int = 0x21; +pub const VK_NEXT: ::c_int = 0x22; +pub const VK_END: ::c_int = 0x23; +pub const VK_HOME: ::c_int = 0x24; +pub const VK_LEFT: ::c_int = 0x25; +pub const VK_UP: ::c_int = 0x26; +pub const VK_RIGHT: ::c_int = 0x27; +pub const VK_DOWN: ::c_int = 0x28; +pub const VK_SELECT: ::c_int = 0x29; +pub const VK_PRINT: ::c_int = 0x2A; +pub const VK_EXECUTE: ::c_int = 0x2B; +pub const VK_SNAPSHOT: ::c_int = 0x2C; +pub const VK_INSERT: ::c_int = 0x2D; +pub const VK_DELETE: ::c_int = 0x2E; +pub const VK_HELP: ::c_int = 0x2F; +pub const VK_LWIN: ::c_int = 0x5B; +pub const VK_RWIN: ::c_int = 0x5C; +pub const VK_APPS: ::c_int = 0x5D; +pub const VK_SLEEP: ::c_int = 0x5F; +pub const VK_NUMPAD0: ::c_int = 0x60; +pub const VK_NUMPAD1: ::c_int = 0x61; +pub const VK_NUMPAD2: ::c_int = 0x62; +pub const VK_NUMPAD3: ::c_int = 0x63; +pub const VK_NUMPAD4: ::c_int = 0x64; +pub const VK_NUMPAD5: ::c_int = 0x65; +pub const VK_NUMPAD6: ::c_int = 0x66; +pub const VK_NUMPAD7: ::c_int = 0x67; +pub const VK_NUMPAD8: ::c_int = 0x68; +pub const VK_NUMPAD9: ::c_int = 0x69; +pub const VK_MULTIPLY: ::c_int = 0x6A; +pub const VK_ADD: ::c_int = 0x6B; +pub const VK_SEPARATOR: ::c_int = 0x6C; +pub const VK_SUBTRACT: ::c_int = 0x6D; +pub const VK_DECIMAL: ::c_int = 0x6E; +pub const VK_DIVIDE: ::c_int = 0x6F; +pub const VK_F1: ::c_int = 0x70; +pub const VK_F2: ::c_int = 0x71; +pub const VK_F3: ::c_int = 0x72; +pub const VK_F4: ::c_int = 0x73; +pub const VK_F5: ::c_int = 0x74; +pub const VK_F6: ::c_int = 0x75; +pub const VK_F7: ::c_int = 0x76; +pub const VK_F8: ::c_int = 0x77; +pub const VK_F9: ::c_int = 0x78; +pub const VK_F10: ::c_int = 0x79; +pub const VK_F11: ::c_int = 0x7A; +pub const VK_F12: ::c_int = 0x7B; +pub const VK_F13: ::c_int = 0x7C; +pub const VK_F14: ::c_int = 0x7D; +pub const VK_F15: ::c_int = 0x7E; +pub const VK_F16: ::c_int = 0x7F; +pub const VK_F17: ::c_int = 0x80; +pub const VK_F18: ::c_int = 0x81; +pub const VK_F19: ::c_int = 0x82; +pub const VK_F20: ::c_int = 0x83; +pub const VK_F21: ::c_int = 0x84; +pub const VK_F22: ::c_int = 0x85; +pub const VK_F23: ::c_int = 0x86; +pub const VK_F24: ::c_int = 0x87; +pub const VK_NUMLOCK: ::c_int = 0x90; +pub const VK_SCROLL: ::c_int = 0x91; +pub const VK_OEM_NEC_EQUAL: ::c_int = 0x92; +pub const VK_OEM_FJ_JISHO: ::c_int = 0x92; +pub const VK_OEM_FJ_MASSHOU: ::c_int = 0x93; +pub const VK_OEM_FJ_TOUROKU: ::c_int = 0x94; +pub const VK_OEM_FJ_LOYA: ::c_int = 0x95; +pub const VK_OEM_FJ_ROYA: ::c_int = 0x96; +pub const VK_LSHIFT: ::c_int = 0xA0; +pub const VK_RSHIFT: ::c_int = 0xA1; +pub const VK_LCONTROL: ::c_int = 0xA2; +pub const VK_RCONTROL: ::c_int = 0xA3; +pub const VK_LMENU: ::c_int = 0xA4; +pub const VK_RMENU: ::c_int = 0xA5; +pub const VK_BROWSER_BACK: ::c_int = 0xA6; +pub const VK_BROWSER_FORWARD: ::c_int = 0xA7; +pub const VK_BROWSER_REFRESH: ::c_int = 0xA8; +pub const VK_BROWSER_STOP: ::c_int = 0xA9; +pub const VK_BROWSER_SEARCH: ::c_int = 0xAA; +pub const VK_BROWSER_FAVORITES: ::c_int = 0xAB; +pub const VK_BROWSER_HOME: ::c_int = 0xAC; +pub const VK_VOLUME_MUTE: ::c_int = 0xAD; +pub const VK_VOLUME_DOWN: ::c_int = 0xAE; +pub const VK_VOLUME_UP: ::c_int = 0xAF; +pub const VK_MEDIA_NEXT_TRACK: ::c_int = 0xB0; +pub const VK_MEDIA_PREV_TRACK: ::c_int = 0xB1; +pub const VK_MEDIA_STOP: ::c_int = 0xB2; +pub const VK_MEDIA_PLAY_PAUSE: ::c_int = 0xB3; +pub const VK_LAUNCH_MAIL: ::c_int = 0xB4; +pub const VK_LAUNCH_MEDIA_SELECT: ::c_int = 0xB5; +pub const VK_LAUNCH_APP1: ::c_int = 0xB6; +pub const VK_LAUNCH_APP2: ::c_int = 0xB7; +pub const VK_OEM_1: ::c_int = 0xBA; +pub const VK_OEM_PLUS: ::c_int = 0xBB; +pub const VK_OEM_COMMA: ::c_int = 0xBC; +pub const VK_OEM_MINUS: ::c_int = 0xBD; +pub const VK_OEM_PERIOD: ::c_int = 0xBE; +pub const VK_OEM_2: ::c_int = 0xBF; +pub const VK_OEM_3: ::c_int = 0xC0; +pub const VK_OEM_4: ::c_int = 0xDB; +pub const VK_OEM_5: ::c_int = 0xDC; +pub const VK_OEM_6: ::c_int = 0xDD; +pub const VK_OEM_7: ::c_int = 0xDE; +pub const VK_OEM_8: ::c_int = 0xDF; +pub const VK_OEM_AX: ::c_int = 0xE1; +pub const VK_OEM_102: ::c_int = 0xE2; +pub const VK_ICO_HELP: ::c_int = 0xE3; +pub const VK_ICO_00: ::c_int = 0xE4; +pub const VK_PROCESSKEY: ::c_int = 0xE5; +pub const VK_ICO_CLEAR: ::c_int = 0xE6; +pub const VK_PACKET: ::c_int = 0xE7; +pub const VK_OEM_RESET: ::c_int = 0xE9; +pub const VK_OEM_JUMP: ::c_int = 0xEA; +pub const VK_OEM_PA1: ::c_int = 0xEB; +pub const VK_OEM_PA2: ::c_int = 0xEC; +pub const VK_OEM_PA3: ::c_int = 0xED; +pub const VK_OEM_WSCTRL: ::c_int = 0xEE; +pub const VK_OEM_CUSEL: ::c_int = 0xEF; +pub const VK_OEM_ATTN: ::c_int = 0xF0; +pub const VK_OEM_FINISH: ::c_int = 0xF1; +pub const VK_OEM_COPY: ::c_int = 0xF2; +pub const VK_OEM_AUTO: ::c_int = 0xF3; +pub const VK_OEM_ENLW: ::c_int = 0xF4; +pub const VK_OEM_BACKTAB: ::c_int = 0xF5; +pub const VK_ATTN: ::c_int = 0xF6; +pub const VK_CRSEL: ::c_int = 0xF7; +pub const VK_EXSEL: ::c_int = 0xF8; +pub const VK_EREOF: ::c_int = 0xF9; +pub const VK_PLAY: ::c_int = 0xFA; +pub const VK_ZOOM: ::c_int = 0xFB; +pub const VK_NONAME: ::c_int = 0xFC; +pub const VK_PA1: ::c_int = 0xFD; +pub const VK_OEM_CLEAR: ::c_int = 0xFE; +// if _WIN32_WINNT >= 0x0500 +pub const APPCOMMAND_BROWSER_BACKWARD: ::c_short = 1; +pub const APPCOMMAND_BROWSER_FORWARD: ::c_short = 2; +pub const APPCOMMAND_BROWSER_REFRESH: ::c_short = 3; +pub const APPCOMMAND_BROWSER_STOP: ::c_short = 4; +pub const APPCOMMAND_BROWSER_SEARCH: ::c_short = 5; +pub const APPCOMMAND_BROWSER_FAVORITES: ::c_short = 6; +pub const APPCOMMAND_BROWSER_HOME: ::c_short = 7; +pub const APPCOMMAND_VOLUME_MUTE: ::c_short = 8; +pub const APPCOMMAND_VOLUME_DOWN: ::c_short = 9; +pub const APPCOMMAND_VOLUME_UP: ::c_short = 10; +pub const APPCOMMAND_MEDIA_NEXTTRACK: ::c_short = 11; +pub const APPCOMMAND_MEDIA_PREVIOUSTRACK: ::c_short = 12; +pub const APPCOMMAND_MEDIA_STOP: ::c_short = 13; +pub const APPCOMMAND_MEDIA_PLAY_PAUSE: ::c_short = 14; +pub const APPCOMMAND_LAUNCH_MAIL: ::c_short = 15; +pub const APPCOMMAND_LAUNCH_MEDIA_SELECT: ::c_short = 16; +pub const APPCOMMAND_LAUNCH_APP1: ::c_short = 17; +pub const APPCOMMAND_LAUNCH_APP2: ::c_short = 18; +pub const APPCOMMAND_BASS_DOWN: ::c_short = 19; +pub const APPCOMMAND_BASS_BOOST: ::c_short = 20; +pub const APPCOMMAND_BASS_UP: ::c_short = 21; +pub const APPCOMMAND_TREBLE_DOWN: ::c_short = 22; +pub const APPCOMMAND_TREBLE_UP: ::c_short = 23; +// if _WIN32_WINNT >= 0x0501 +pub const APPCOMMAND_MICROPHONE_VOLUME_MUTE: ::c_short = 24; +pub const APPCOMMAND_MICROPHONE_VOLUME_DOWN: ::c_short = 25; +pub const APPCOMMAND_MICROPHONE_VOLUME_UP: ::c_short = 26; +pub const APPCOMMAND_HELP: ::c_short = 27; +pub const APPCOMMAND_FIND: ::c_short = 28; +pub const APPCOMMAND_NEW: ::c_short = 29; +pub const APPCOMMAND_OPEN: ::c_short = 30; +pub const APPCOMMAND_CLOSE: ::c_short = 31; +pub const APPCOMMAND_SAVE: ::c_short = 32; +pub const APPCOMMAND_PRINT: ::c_short = 33; +pub const APPCOMMAND_UNDO: ::c_short = 34; +pub const APPCOMMAND_REDO: ::c_short = 35; +pub const APPCOMMAND_COPY: ::c_short = 36; +pub const APPCOMMAND_CUT: ::c_short = 37; +pub const APPCOMMAND_PASTE: ::c_short = 38; +pub const APPCOMMAND_REPLY_TO_MAIL: ::c_short = 39; +pub const APPCOMMAND_FORWARD_MAIL: ::c_short = 40; +pub const APPCOMMAND_SEND_MAIL: ::c_short = 41; +pub const APPCOMMAND_SPELL_CHECK: ::c_short = 42; +pub const APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE: ::c_short = 43; +pub const APPCOMMAND_MIC_ON_OFF_TOGGLE: ::c_short = 44; +pub const APPCOMMAND_CORRECTION_LIST: ::c_short = 45; +pub const APPCOMMAND_MEDIA_PLAY: ::c_short = 46; +pub const APPCOMMAND_MEDIA_PAUSE: ::c_short = 47; +pub const APPCOMMAND_MEDIA_RECORD: ::c_short = 48; +pub const APPCOMMAND_MEDIA_FAST_FORWARD: ::c_short = 49; +pub const APPCOMMAND_MEDIA_REWIND: ::c_short = 50; +pub const APPCOMMAND_MEDIA_CHANNEL_UP: ::c_short = 51; +pub const APPCOMMAND_MEDIA_CHANNEL_DOWN: ::c_short = 52; +// end if _WIN32_WINNT >= 0x0501 +// if _WIN32_WINNT >= 0x0600 +pub const APPCOMMAND_DELETE: ::c_short = 53; +pub const APPCOMMAND_DWM_FLIP3D: ::c_short = 54; +// end if _WIN32_WINNT >= 0x0600 +pub const WM_NULL: ::UINT = 0x0000; +pub const WM_CREATE: ::UINT = 0x0001; +pub const WM_DESTROY: ::UINT = 0x0002; +pub const WM_MOVE: ::UINT = 0x0003; +pub const WM_SIZE: ::UINT = 0x0005; +pub const WM_ACTIVATE: ::UINT = 0x0006; +pub const WM_SETFOCUS: ::UINT = 0x0007; +pub const WM_KILLFOCUS: ::UINT = 0x0008; +pub const WM_ENABLE: ::UINT = 0x000A; +pub const WM_SETREDRAW: ::UINT = 0x000B; +pub const WM_SETTEXT: ::UINT = 0x000C; +pub const WM_GETTEXT: ::UINT = 0x000D; +pub const WM_GETTEXTLENGTH: ::UINT = 0x000E; +pub const WM_PAINT: ::UINT = 0x000F; +pub const WM_CLOSE: ::UINT = 0x0010; +pub const WM_QUERYENDSESSION: ::UINT = 0x0011; +pub const WM_QUERYOPEN: ::UINT = 0x0013; +pub const WM_ENDSESSION: ::UINT = 0x0016; +pub const WM_QUIT: ::UINT = 0x0012; +pub const WM_ERASEBKGND: ::UINT = 0x0014; +pub const WM_SYSCOLORCHANGE: ::UINT = 0x0015; +pub const WM_SHOWWINDOW: ::UINT = 0x0018; +pub const WM_WININICHANGE: ::UINT = 0x001A; +pub const WM_SETTINGCHANGE: ::UINT = WM_WININICHANGE; +pub const WM_DEVMODECHANGE: ::UINT = 0x001B; +pub const WM_ACTIVATEAPP: ::UINT = 0x001C; +pub const WM_FONTCHANGE: ::UINT = 0x001D; +pub const WM_TIMECHANGE: ::UINT = 0x001E; +pub const WM_CANCELMODE: ::UINT = 0x001F; +pub const WM_SETCURSOR: ::UINT = 0x0020; +pub const WM_MOUSEACTIVATE: ::UINT = 0x0021; +pub const WM_CHILDACTIVATE: ::UINT = 0x0022; +pub const WM_QUEUESYNC: ::UINT = 0x0023; +pub const WM_GETMINMAXINFO: ::UINT = 0x0024; +pub const WM_PAINTICON: ::UINT = 0x0026; +pub const WM_ICONERASEBKGND: ::UINT = 0x0027; +pub const WM_NEXTDLGCTL: ::UINT = 0x0028; +pub const WM_SPOOLERSTATUS: ::UINT = 0x002A; +pub const WM_DRAWITEM: ::UINT = 0x002B; +pub const WM_MEASUREITEM: ::UINT = 0x002C; +pub const WM_DELETEITEM: ::UINT = 0x002D; +pub const WM_VKEYTOITEM: ::UINT = 0x002E; +pub const WM_CHARTOITEM: ::UINT = 0x002F; +pub const WM_SETFONT: ::UINT = 0x0030; +pub const WM_GETFONT: ::UINT = 0x0031; +pub const WM_SETHOTKEY: ::UINT = 0x0032; +pub const WM_GETHOTKEY: ::UINT = 0x0033; +pub const WM_QUERYDRAGICON: ::UINT = 0x0037; +pub const WM_COMPAREITEM: ::UINT = 0x0039; +pub const WM_GETOBJECT: ::UINT = 0x003D; +pub const WM_COMPACTING: ::UINT = 0x0041; +pub const WM_COMMNOTIFY: ::UINT = 0x0044; +pub const WM_WINDOWPOSCHANGING: ::UINT = 0x0046; +pub const WM_WINDOWPOSCHANGED: ::UINT = 0x0047; +pub const WM_POWER: ::UINT = 0x0048; +pub const WM_COPYDATA: ::UINT = 0x004A; +pub const WM_CANCELJOURNAL: ::UINT = 0x004B; +pub const WM_NOTIFY: ::UINT = 0x004E; +pub const WM_INPUTLANGCHANGEREQUEST: ::UINT = 0x0050; +pub const WM_INPUTLANGCHANGE: ::UINT = 0x0051; +pub const WM_TCARD: ::UINT = 0x0052; +pub const WM_HELP: ::UINT = 0x0053; +pub const WM_USERCHANGED: ::UINT = 0x0054; +pub const WM_NOTIFYFORMAT: ::UINT = 0x0055; +pub const WM_CONTEXTMENU: ::UINT = 0x007B; +pub const WM_STYLECHANGING: ::UINT = 0x007C; +pub const WM_STYLECHANGED: ::UINT = 0x007D; +pub const WM_DISPLAYCHANGE: ::UINT = 0x007E; +pub const WM_GETICON: ::UINT = 0x007F; +pub const WM_SETICON: ::UINT = 0x0080; +pub const WM_NCCREATE: ::UINT = 0x0081; +pub const WM_NCDESTROY: ::UINT = 0x0082; +pub const WM_NCCALCSIZE: ::UINT = 0x0083; +pub const WM_NCHITTEST: ::UINT = 0x0084; +pub const WM_NCPAINT: ::UINT = 0x0085; +pub const WM_NCACTIVATE: ::UINT = 0x0086; +pub const WM_GETDLGCODE: ::UINT = 0x0087; +pub const WM_SYNCPAINT: ::UINT = 0x0088; +pub const WM_NCMOUSEMOVE: ::UINT = 0x00A0; +pub const WM_NCLBUTTONDOWN: ::UINT = 0x00A1; +pub const WM_NCLBUTTONUP: ::UINT = 0x00A2; +pub const WM_NCLBUTTONDBLCLK: ::UINT = 0x00A3; +pub const WM_NCRBUTTONDOWN: ::UINT = 0x00A4; +pub const WM_NCRBUTTONUP: ::UINT = 0x00A5; +pub const WM_NCRBUTTONDBLCLK: ::UINT = 0x00A6; +pub const WM_NCMBUTTONDOWN: ::UINT = 0x00A7; +pub const WM_NCMBUTTONUP: ::UINT = 0x00A8; +pub const WM_NCMBUTTONDBLCLK: ::UINT = 0x00A9; +pub const WM_NCXBUTTONDOWN: ::UINT = 0x00AB; +pub const WM_NCXBUTTONUP: ::UINT = 0x00AC; +pub const WM_NCXBUTTONDBLCLK: ::UINT = 0x00AD; +pub const WM_INPUT_DEVICE_CHANGE: ::UINT = 0x00FE; +pub const WM_INPUT: ::UINT = 0x00FF; +pub const WM_KEYFIRST: ::UINT = 0x0100; +pub const WM_KEYDOWN: ::UINT = 0x0100; +pub const WM_KEYUP: ::UINT = 0x0101; +pub const WM_CHAR: ::UINT = 0x0102; +pub const WM_DEADCHAR: ::UINT = 0x0103; +pub const WM_SYSKEYDOWN: ::UINT = 0x0104; +pub const WM_SYSKEYUP: ::UINT = 0x0105; +pub const WM_SYSCHAR: ::UINT = 0x0106; +pub const WM_SYSDEADCHAR: ::UINT = 0x0107; +pub const WM_UNICHAR: ::UINT = 0x0109; +pub const WM_KEYLAST: ::UINT = 0x0109; +pub const WM_IME_STARTCOMPOSITION: ::UINT = 0x010D; +pub const WM_IME_ENDCOMPOSITION: ::UINT = 0x010E; +pub const WM_IME_COMPOSITION: ::UINT = 0x010F; +pub const WM_IME_KEYLAST: ::UINT = 0x010F; +pub const WM_INITDIALOG: ::UINT = 0x0110; +pub const WM_COMMAND: ::UINT = 0x0111; +pub const WM_SYSCOMMAND: ::UINT = 0x0112; +pub const WM_TIMER: ::UINT = 0x0113; +pub const WM_HSCROLL: ::UINT = 0x0114; +pub const WM_VSCROLL: ::UINT = 0x0115; +pub const WM_INITMENU: ::UINT = 0x0116; +pub const WM_INITMENUPOPUP: ::UINT = 0x0117; +pub const WM_GESTURE: ::UINT = 0x0119; +pub const WM_GESTURENOTIFY: ::UINT = 0x011A; +pub const WM_MENUSELECT: ::UINT = 0x011F; +pub const WM_MENUCHAR: ::UINT = 0x0120; +pub const WM_ENTERIDLE: ::UINT = 0x0121; +pub const WM_MENURBUTTONUP: ::UINT = 0x0122; +pub const WM_MENUDRAG: ::UINT = 0x0123; +pub const WM_MENUGETOBJECT: ::UINT = 0x0124; +pub const WM_UNINITMENUPOPUP: ::UINT = 0x0125; +pub const WM_MENUCOMMAND: ::UINT = 0x0126; +pub const WM_CHANGEUISTATE: ::UINT = 0x0127; +pub const WM_UPDATEUISTATE: ::UINT = 0x0128; +pub const WM_QUERYUISTATE: ::UINT = 0x0129; +pub const WM_CTLCOLORMSGBOX: ::UINT = 0x0132; +pub const WM_CTLCOLOREDIT: ::UINT = 0x0133; +pub const WM_CTLCOLORLISTBOX: ::UINT = 0x0134; +pub const WM_CTLCOLORBTN: ::UINT = 0x0135; +pub const WM_CTLCOLORDLG: ::UINT = 0x0136; +pub const WM_CTLCOLORSCROLLBAR: ::UINT = 0x0137; +pub const WM_CTLCOLORSTATIC: ::UINT = 0x0138; +pub const WM_MOUSEFIRST: ::UINT = 0x0200; +pub const WM_MOUSEMOVE: ::UINT = 0x0200; +pub const WM_LBUTTONDOWN: ::UINT = 0x0201; +pub const WM_LBUTTONUP: ::UINT = 0x0202; +pub const WM_LBUTTONDBLCLK: ::UINT = 0x0203; +pub const WM_RBUTTONDOWN: ::UINT = 0x0204; +pub const WM_RBUTTONUP: ::UINT = 0x0205; +pub const WM_RBUTTONDBLCLK: ::UINT = 0x0206; +pub const WM_MBUTTONDOWN: ::UINT = 0x0207; +pub const WM_MBUTTONUP: ::UINT = 0x0208; +pub const WM_MBUTTONDBLCLK: ::UINT = 0x0209; +pub const WM_MOUSEWHEEL: ::UINT = 0x020A; +pub const WM_XBUTTONDOWN: ::UINT = 0x020B; +pub const WM_XBUTTONUP: ::UINT = 0x020C; +pub const WM_XBUTTONDBLCLK: ::UINT = 0x020D; +pub const WM_MOUSEHWHEEL: ::UINT = 0x020E; +pub const WM_MOUSELAST: ::UINT = 0x020E; +pub const WM_PARENTNOTIFY: ::UINT = 0x0210; +pub const WM_ENTERMENULOOP: ::UINT = 0x0211; +pub const WM_EXITMENULOOP: ::UINT = 0x0212; +pub const WM_NEXTMENU: ::UINT = 0x0213; +pub const WM_SIZING: ::UINT = 0x0214; +pub const WM_CAPTURECHANGED: ::UINT = 0x0215; +pub const WM_MOVING: ::UINT = 0x0216; +pub const WM_POWERBROADCAST: ::UINT = 0x0218; +pub const WM_DEVICECHANGE: ::UINT = 0x0219; +pub const WM_MDICREATE: ::UINT = 0x0220; +pub const WM_MDIDESTROY: ::UINT = 0x0221; +pub const WM_MDIACTIVATE: ::UINT = 0x0222; +pub const WM_MDIRESTORE: ::UINT = 0x0223; +pub const WM_MDINEXT: ::UINT = 0x0224; +pub const WM_MDIMAXIMIZE: ::UINT = 0x0225; +pub const WM_MDITILE: ::UINT = 0x0226; +pub const WM_MDICASCADE: ::UINT = 0x0227; +pub const WM_MDIICONARRANGE: ::UINT = 0x0228; +pub const WM_MDIGETACTIVE: ::UINT = 0x0229; +pub const WM_MDISETMENU: ::UINT = 0x0230; +pub const WM_ENTERSIZEMOVE: ::UINT = 0x0231; +pub const WM_EXITSIZEMOVE: ::UINT = 0x0232; +pub const WM_DROPFILES: ::UINT = 0x0233; +pub const WM_MDIREFRESHMENU: ::UINT = 0x0234; +pub const WM_POINTERDEVICECHANGE: ::UINT = 0x238; +pub const WM_POINTERDEVICEINRANGE: ::UINT = 0x239; +pub const WM_POINTERDEVICEOUTOFRANGE: ::UINT = 0x23A; +pub const WM_TOUCH: ::UINT = 0x0240; +pub const WM_NCPOINTERUPDATE: ::UINT = 0x0241; +pub const WM_NCPOINTERDOWN: ::UINT = 0x0242; +pub const WM_NCPOINTERUP: ::UINT = 0x0243; +pub const WM_POINTERUPDATE: ::UINT = 0x0245; +pub const WM_POINTERDOWN: ::UINT = 0x0246; +pub const WM_POINTERUP: ::UINT = 0x0247; +pub const WM_POINTERENTER: ::UINT = 0x0249; +pub const WM_POINTERLEAVE: ::UINT = 0x024A; +pub const WM_POINTERACTIVATE: ::UINT = 0x024B; +pub const WM_POINTERCAPTURECHANGED: ::UINT = 0x024C; +pub const WM_TOUCHHITTESTING: ::UINT = 0x024D; +pub const WM_POINTERWHEEL: ::UINT = 0x024E; +pub const WM_POINTERHWHEEL: ::UINT = 0x024F; +pub const WM_IME_SETCONTEXT: ::UINT = 0x0281; +pub const WM_IME_NOTIFY: ::UINT = 0x0282; +pub const WM_IME_CONTROL: ::UINT = 0x0283; +pub const WM_IME_COMPOSITIONFULL: ::UINT = 0x0284; +pub const WM_IME_SELECT: ::UINT = 0x0285; +pub const WM_IME_CHAR: ::UINT = 0x0286; +pub const WM_IME_REQUEST: ::UINT = 0x0288; +pub const WM_IME_KEYDOWN: ::UINT = 0x0290; +pub const WM_IME_KEYUP: ::UINT = 0x0291; +pub const WM_MOUSEHOVER: ::UINT = 0x02A1; +pub const WM_MOUSELEAVE: ::UINT = 0x02A3; +pub const WM_NCMOUSEHOVER: ::UINT = 0x02A0; +pub const WM_NCMOUSELEAVE: ::UINT = 0x02A2; +pub const WM_WTSSESSION_CHANGE: ::UINT = 0x02B1; +pub const WM_TABLET_FIRST: ::UINT = 0x02c0; +pub const WM_TABLET_LAST: ::UINT = 0x02df; +pub const WM_DPICHANGED: ::UINT = 0x02E0; +pub const WM_CUT: ::UINT = 0x0300; +pub const WM_COPY: ::UINT = 0x0301; +pub const WM_PASTE: ::UINT = 0x0302; +pub const WM_CLEAR: ::UINT = 0x0303; +pub const WM_UNDO: ::UINT = 0x0304; +pub const WM_RENDERFORMAT: ::UINT = 0x0305; +pub const WM_RENDERALLFORMATS: ::UINT = 0x0306; +pub const WM_DESTROYCLIPBOARD: ::UINT = 0x0307; +pub const WM_DRAWCLIPBOARD: ::UINT = 0x0308; +pub const WM_PAINTCLIPBOARD: ::UINT = 0x0309; +pub const WM_VSCROLLCLIPBOARD: ::UINT = 0x030A; +pub const WM_SIZECLIPBOARD: ::UINT = 0x030B; +pub const WM_ASKCBFORMATNAME: ::UINT = 0x030C; +pub const WM_CHANGECBCHAIN: ::UINT = 0x030D; +pub const WM_HSCROLLCLIPBOARD: ::UINT = 0x030E; +pub const WM_QUERYNEWPALETTE: ::UINT = 0x030F; +pub const WM_PALETTEISCHANGING: ::UINT = 0x0310; +pub const WM_PALETTECHANGED: ::UINT = 0x0311; +pub const WM_HOTKEY: ::UINT = 0x0312; +pub const WM_PRINT: ::UINT = 0x0317; +pub const WM_PRINTCLIENT: ::UINT = 0x0318; +pub const WM_APPCOMMAND: ::UINT = 0x0319; +pub const WM_THEMECHANGED: ::UINT = 0x031A; +pub const WM_CLIPBOARDUPDATE: ::UINT = 0x031D; +pub const WM_DWMCOMPOSITIONCHANGED: ::UINT = 0x031E; +pub const WM_DWMNCRENDERINGCHANGED: ::UINT = 0x031F; +pub const WM_DWMCOLORIZATIONCOLORCHANGED: ::UINT = 0x0320; +pub const WM_DWMWINDOWMAXIMIZEDCHANGE: ::UINT = 0x0321; +pub const WM_DWMSENDICONICTHUMBNAIL: ::UINT = 0x0323; +pub const WM_DWMSENDICONICLIVEPREVIEWBITMAP: ::UINT = 0x0326; +pub const WM_GETTITLEBARINFOEX: ::UINT = 0x033F; +pub const WM_HANDHELDFIRST: ::UINT = 0x0358; +pub const WM_HANDHELDLAST: ::UINT = 0x035F; +pub const WM_AFXFIRST: ::UINT = 0x0360; +pub const WM_AFXLAST: ::UINT = 0x037F; +pub const WM_PENWINFIRST: ::UINT = 0x0380; +pub const WM_PENWINLAST: ::UINT = 0x038F; +pub const WM_APP: ::UINT = 0x8000; +pub const WM_USER: ::UINT = 0x0400; +pub const WMSZ_LEFT: ::UINT = 1; +pub const WMSZ_RIGHT: ::UINT = 2; +pub const WMSZ_TOP: ::UINT = 3; +pub const WMSZ_TOPLEFT: ::UINT = 4; +pub const WMSZ_TOPRIGHT: ::UINT = 5; +pub const WMSZ_BOTTOM: ::UINT = 6; +pub const WMSZ_BOTTOMLEFT: ::UINT = 7; +pub const WMSZ_BOTTOMRIGHT: ::UINT = 8; +pub const SMTO_NORMAL: ::UINT = 0x0000; +pub const SMTO_BLOCK: ::UINT = 0x0001; +pub const SMTO_ABORTIFHUNG: ::UINT = 0x0002; +pub const SMTO_NOTIMEOUTIFNOTHUNG: ::UINT = 0x0008; +pub const SMTO_ERRORONEXIT: ::UINT = 0x0020; +pub const MA_ACTIVATE: ::UINT = 1; +pub const MA_ACTIVATEANDEAT: ::UINT = 2; +pub const MA_NOACTIVATE: ::UINT = 3; +pub const MA_NOACTIVATEANDEAT: ::UINT = 4; +pub const ICON_SMALL: ::UINT = 0; +pub const ICON_BIG: ::UINT = 1; +pub const ICON_SMALL2: ::UINT = 2; +pub const SIZE_RESTORED: ::UINT = 0; +pub const SIZE_MINIMIZED: ::UINT = 1; +pub const SIZE_MAXIMIZED: ::UINT = 2; +pub const SIZE_MAXSHOW: ::UINT = 3; +pub const SIZE_MAXHIDE: ::UINT = 4; +pub const SIZENORMAL: ::UINT = SIZE_RESTORED; +pub const SIZEICONIC: ::UINT = SIZE_MINIMIZED; +pub const SIZEFULLSCREEN: ::UINT = SIZE_MAXIMIZED; +pub const SIZEZOOMSHOW: ::UINT = SIZE_MAXSHOW; +pub const SIZEZOOMHIDE: ::UINT = SIZE_MAXHIDE; +STRUCT!{struct NCCALCSIZE_PARAMS { + rgrc: [::RECT; 3], + lppos: PWINDOWPOS, +}} +pub type PNCCALCSIZE_PARAMS = *mut NCCALCSIZE_PARAMS; +pub type NPNCCALCSIZE_PARAMS = *mut NCCALCSIZE_PARAMS; +pub type LPNCCALCSIZE_PARAMS = *mut NCCALCSIZE_PARAMS; +pub const WVR_ALIGNTOP: ::UINT = 0x0010; +pub const WVR_ALIGNLEFT: ::UINT = 0x0020; +pub const WVR_ALIGNBOTTOM: ::UINT = 0x0040; +pub const WVR_ALIGNRIGHT: ::UINT = 0x0080; +pub const WVR_HREDRAW: ::UINT = 0x0100; +pub const WVR_VREDRAW: ::UINT = 0x0200; +pub const WVR_REDRAW: ::UINT = WVR_HREDRAW | WVR_VREDRAW; +pub const WVR_VALIDRECTS: ::UINT = 0x0400; +pub const HOVER_DEFAULT: ::UINT = 0xFFFFFFFF; +pub const WS_OVERLAPPED: ::DWORD = 0x00000000; +pub const WS_POPUP: ::DWORD = 0x80000000; +pub const WS_CHILD: ::DWORD = 0x40000000; +pub const WS_MINIMIZE: ::DWORD = 0x20000000; +pub const WS_VISIBLE: ::DWORD = 0x10000000; +pub const WS_DISABLED: ::DWORD = 0x08000000; +pub const WS_CLIPSIBLINGS: ::DWORD = 0x04000000; +pub const WS_CLIPCHILDREN: ::DWORD = 0x02000000; +pub const WS_MAXIMIZE: ::DWORD = 0x01000000; +pub const WS_CAPTION: ::DWORD = 0x00C00000; +pub const WS_BORDER: ::DWORD = 0x00800000; +pub const WS_DLGFRAME: ::DWORD = 0x00400000; +pub const WS_VSCROLL: ::DWORD = 0x00200000; +pub const WS_HSCROLL: ::DWORD = 0x00100000; +pub const WS_SYSMENU: ::DWORD = 0x00080000; +pub const WS_THICKFRAME: ::DWORD = 0x00040000; +pub const WS_GROUP: ::DWORD = 0x00020000; +pub const WS_TABSTOP: ::DWORD = 0x00010000; +pub const WS_MINIMIZEBOX: ::DWORD = 0x00020000; +pub const WS_MAXIMIZEBOX: ::DWORD = 0x00010000; +pub const WS_TILED: ::DWORD = WS_OVERLAPPED; +pub const WS_ICONIC: ::DWORD = WS_MINIMIZE; +pub const WS_SIZEBOX: ::DWORD = WS_THICKFRAME; +pub const WS_TILEDWINDOW: ::DWORD = WS_OVERLAPPEDWINDOW; +pub const WS_OVERLAPPEDWINDOW: ::DWORD = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; +pub const WS_POPUPWINDOW: ::DWORD = WS_POPUP | WS_BORDER | WS_SYSMENU; +pub const WS_CHILDWINDOW: ::DWORD = WS_CHILD; +pub const WS_EX_DLGMODALFRAME: ::DWORD = 0x00000001; +pub const WS_EX_NOPARENTNOTIFY: ::DWORD = 0x00000004; +pub const WS_EX_TOPMOST: ::DWORD = 0x00000008; +pub const WS_EX_ACCEPTFILES: ::DWORD = 0x00000010; +pub const WS_EX_TRANSPARENT: ::DWORD = 0x00000020; +pub const WS_EX_MDICHILD: ::DWORD = 0x00000040; +pub const WS_EX_TOOLWINDOW: ::DWORD = 0x00000080; +pub const WS_EX_WINDOWEDGE: ::DWORD = 0x00000100; +pub const WS_EX_CLIENTEDGE: ::DWORD = 0x00000200; +pub const WS_EX_CONTEXTHELP: ::DWORD = 0x00000400; +pub const WS_EX_RIGHT: ::DWORD = 0x00001000; +pub const WS_EX_LEFT: ::DWORD = 0x00000000; +pub const WS_EX_RTLREADING: ::DWORD = 0x00002000; +pub const WS_EX_LTRREADING: ::DWORD = 0x00000000; +pub const WS_EX_LEFTSCROLLBAR: ::DWORD = 0x00004000; +pub const WS_EX_RIGHTSCROLLBAR: ::DWORD = 0x00000000; +pub const WS_EX_CONTROLPARENT: ::DWORD = 0x00010000; +pub const WS_EX_STATICEDGE: ::DWORD = 0x00020000; +pub const WS_EX_APPWINDOW: ::DWORD = 0x00040000; +pub const WS_EX_OVERLAPPEDWINDOW: ::DWORD = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE; +pub const WS_EX_PALETTEWINDOW: ::DWORD = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST; +pub const WS_EX_LAYERED: ::DWORD = 0x00080000; +pub const WS_EX_NOINHERITLAYOUT: ::DWORD = 0x00100000; +pub const WS_EX_NOREDIRECTIONBITMAP: ::DWORD = 0x00200000; +pub const WS_EX_LAYOUTRTL: ::DWORD = 0x00400000; +pub const WS_EX_COMPOSITED: ::DWORD = 0x02000000; +pub const WS_EX_NOACTIVATE: ::DWORD = 0x08000000; +pub type NAMEENUMPROCA = Option ::BOOL>; +pub type NAMEENUMPROCW = Option ::BOOL>; +pub type DESKTOPENUMPROCA = NAMEENUMPROCA; +pub type DESKTOPENUMPROCW = NAMEENUMPROCW; +pub type WINSTAENUMPROCA = NAMEENUMPROCA; +pub type WINSTAENUMPROCW = NAMEENUMPROCW; +pub type WNDENUMPROC = Option ::BOOL>; +pub type WNDPROC = Option ::LRESULT>; +pub type DLGPROC = Option ::INT_PTR>; +pub type HOOKPROC = Option ::LRESULT>; +pub type TimerProc = Option; +pub type DRAWSTATEPROC = Option ::BOOL>; +pub type PROPENUMPROCA = Option ::BOOL>; +pub type PROPENUMPROCW = Option ::BOOL>; +pub type GRAYSTRINGPROC = Option ::BOOL>; +pub type MSGBOXCALLBACK = Option; +pub type WINEVENTPROC = Option; +pub type HDEVNOTIFY = ::PVOID; +pub type MENUTEMPLATEA = ::VOID; +pub type MENUTEMPLATEW = ::VOID; +STRUCT!{struct MSG { + hwnd: ::HWND, + message: ::UINT, + wParam: ::WPARAM, + lParam: ::LPARAM, + time: ::DWORD, + pt: ::POINT, +}} +pub type PMSG = *mut MSG; +pub type NPMSG = *mut MSG; +pub type LPMSG = *mut MSG; +STRUCT!{struct PAINTSTRUCT { + hdc: ::HDC, + fErase: ::BOOL, + rcPaint: ::RECT, + fRestore: ::BOOL, + fIncUpdate: ::BOOL, + rgbReserved: [::BYTE; 32], +}} +pub type PPAINTSTRUCT = *mut PAINTSTRUCT; +pub type NPPAINTSTRUCT = *mut PAINTSTRUCT; +pub type LPPAINTSTRUCT = *mut PAINTSTRUCT; +STRUCT!{struct WINDOWPLACEMENT { + length: ::UINT, + flags: ::UINT, + showCmd: ::UINT, + ptMinPosition: ::POINT, + ptMaxPosition: ::POINT, + rcNormalPosition: ::RECT, +}} +pub type PWINDOWPLACEMENT = *mut WINDOWPLACEMENT; +pub type LPWINDOWPLACEMENT = *mut WINDOWPLACEMENT; +STRUCT!{nodebug struct WNDCLASSEXW { + cbSize: ::UINT, + style: ::UINT, + lpfnWndProc: WNDPROC, + cbClsExtra: ::c_int, + cbWndExtra: ::c_int, + hInstance: ::HINSTANCE, + hIcon: ::HICON, + hCursor: ::HCURSOR, + hbrBackground: ::HBRUSH, + lpszMenuName: ::LPCWSTR, + lpszClassName: ::LPCWSTR, + hIconSm: ::HICON, +}} +pub type PWNDCLASSEXW = *mut WNDCLASSEXW; +pub type NPWNDCLASSEXW = *mut WNDCLASSEXW; +pub type LPWNDCLASSEXW = *mut WNDCLASSEXW; +STRUCT!{nodebug struct WNDCLASSW { + style: ::UINT, + lpfnWndProc: WNDPROC, + cbClsExtra: ::c_int, + cbWndExtra: ::c_int, + hInstance: ::HINSTANCE, + hIcon: ::HICON, + hCursor: ::HCURSOR, + hbrBackground: ::HBRUSH, + lpszMenuName: ::LPCWSTR, + lpszClassName: ::LPCWSTR, +}} +pub type PWNDCLASSW = *mut WNDCLASSW; +pub type NPWNDCLASSW = *mut WNDCLASSW; +pub type LPWNDCLASSW = *mut WNDCLASSW; +STRUCT!{struct MINMAXINFO { + ptReserved: ::POINT, + ptMaxSize: ::POINT, + ptMaxPosition: ::POINT, + ptMinTrackSize: ::POINT, + ptMaxTrackSize: ::POINT, +}} +STRUCT!{struct SCROLLBARINFO { + cbSize: ::DWORD, + rcScrollBar: ::RECT, + dxyLineButton: ::c_int, + xyThumbTop: ::c_int, + xyThumbBottom: ::c_int, + reserved: ::c_int, + rgstate: [::DWORD; CCHILDREN_SCROLLBAR + 1], +}} +pub type PSCROLLBARINFO = *mut SCROLLBARINFO; +pub type LPSCROLLBARINFO = *mut SCROLLBARINFO; +STRUCT!{struct SCROLLINFO { + cbSize: ::UINT, + fMask: ::UINT, + nMin: ::c_int, + nMax: ::c_int, + nPage: ::UINT, + nPos: ::c_int, + nTrackPos: ::c_int, +}} +pub type LPSCROLLINFO = *mut SCROLLINFO; +pub type LPCSCROLLINFO = *const SCROLLINFO; +STRUCT!{struct SIZE { + cx: ::LONG, + cy: ::LONG, +}} +pub type PSIZE = *mut SIZE; +pub type LPSIZE = *mut SIZE; +pub type SIZEL = SIZE; +pub type PSIZEL = *mut SIZEL; +pub type LPSIZEL = *mut SIZEL; +//1913 +pub const UNICODE_NOCHAR: ::WPARAM = 0xffff; +pub type HDWP = *mut ::HANDLE; +//2193 +pub const WHEEL_DELTA: ::DWORD = 120; +//2206 +pub const XBUTTON1: ::DWORD = 0x0001; +pub const XBUTTON2: ::DWORD = 0x0002; +//2392 +pub const MK_LBUTTON: ::WPARAM = 0x0001; +pub const MK_RBUTTON: ::WPARAM = 0x0002; +pub const MK_SHIFT: ::WPARAM = 0x0004; +pub const MK_CONTROL: ::WPARAM = 0x0008; +pub const MK_MBUTTON: ::WPARAM = 0x0010; +pub const MK_XBUTTON1: ::WPARAM = 0x0020; +pub const MK_XBUTTON2: ::WPARAM = 0x0040; +//2408 +pub const TME_HOVER: ::DWORD = 0x0000_0001; +pub const TME_LEAVE: ::DWORD = 0x0000_0002; +pub const TME_NONCLIENT: ::DWORD = 0x0000_0010; +pub const TME_QUERY: ::DWORD = 0x4000_0000; +pub const TME_CANCEL: ::DWORD = 0x8000_0000; +pub const HWND_BROADCAST: ::HWND = 0xFFFF as ::HWND; +pub const HWND_MESSAGE: ::HWND = -3isize as ::HWND; +STRUCT!{struct TRACKMOUSEEVENT { + cbSize: ::DWORD, + dwFlags: ::DWORD, + hwndTrack: ::HWND, + dwHoverTime: ::DWORD, +}} +pub type LPTRACKMOUSEEVENT = *mut TRACKMOUSEEVENT; +//2575 +STRUCT!{nodebug struct WINDOWPOS { + hwnd: ::HWND, + hwndInsertAfter: ::HWND, + x: ::c_int, + y: ::c_int, + cx: ::c_int, + cy: ::c_int, + flags: ::UINT, +}} +pub type LPWINDOWPOS = *mut WINDOWPOS; +pub type PWINDOWPOS = *mut WINDOWPOS; +//3082 +STRUCT!{struct CREATESTRUCTA { + lpCreateParams: ::LPVOID, + hInstance: ::HINSTANCE, + hMenu: ::HMENU, + hwndParent: ::HWND, + cy: ::c_int, + cx: ::c_int, + y: ::c_int, + x: ::c_int, + style: ::LONG, + lpszName: ::LPCSTR, + lpszClass: ::LPCSTR, + dwExStyle: ::DWORD, +}} +pub type LPCREATESTRUCTA = *mut CREATESTRUCTA; +STRUCT!{struct CREATESTRUCTW { + lpCreateParams: ::LPVOID, + hInstance: ::HINSTANCE, + hMenu: ::HMENU, + hwndParent: ::HWND, + cy: ::c_int, + cx: ::c_int, + y: ::c_int, + x: ::c_int, + style: ::LONG, + lpszName: ::LPCWSTR, + lpszClass: ::LPCWSTR, + dwExStyle: ::DWORD, +}} +pub type LPCREATESTRUCTW = *mut CREATESTRUCTW; +//3145 +STRUCT!{struct NMHDR { + hwndFrom: ::HWND, + idFrom: ::UINT_PTR, + code: ::UINT, // NM_ code +}} +pub type LPNMHDR = *mut NMHDR; +//3400 +pub const PM_NOREMOVE: ::UINT = 0x0000; +pub const PM_REMOVE: ::UINT = 0x0001; +pub const PM_NOYIELD: ::UINT = 0x0002; +pub const PM_QS_INPUT: ::UINT = QS_INPUT << 16; +pub const PM_QS_POSTMESSAGE: ::UINT = (QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16; +pub const PM_QS_PAINT: ::UINT = QS_PAINT << 16; +pub const PM_QS_SENDMESSAGE: ::UINT = QS_SENDMESSAGE << 16; +// +pub const LWA_COLORKEY: ::DWORD = 0x00000001; +pub const LWA_ALPHA: ::DWORD = 0x00000002; +//3469 +pub const EWX_LOGOFF: ::UINT = 0x00000000; +pub const EWX_SHUTDOWN: ::UINT = 0x00000001; +pub const EWX_REBOOT: ::UINT = 0x00000002; +pub const EWX_FORCE: ::UINT = 0x00000004; +pub const EWX_POWEROFF: ::UINT = 0x00000008; +pub const EWX_FORCEIFHUNG: ::UINT = 0x00000010; +pub const EWX_QUICKRESOLVE: ::UINT = 0x00000020; +pub const EWX_RESTARTAPPS: ::UINT = 0x00000040; +pub const EWX_HYBRID_SHUTDOWN: ::UINT = 0x00400000; +pub const EWX_BOOTOPTIONS: ::UINT = 0x01000000; +//4054 (Win 7 SDK) +STRUCT!{struct FLASHWINFO { + cbSize: ::UINT, + hwnd: ::HWND, + dwFlags: ::DWORD, + uCount: ::UINT, + dwTimeout: ::DWORD, +}} +pub type PFLASHWINFO = *mut FLASHWINFO; +pub const FLASHW_STOP: ::DWORD = 0; +pub const FLASHW_CAPTION: ::DWORD = 0x00000001; +pub const FLASHW_TRAY: ::DWORD = 0x00000002; +pub const FLASHW_ALL: ::DWORD = FLASHW_CAPTION | FLASHW_TRAY; +pub const FLASHW_TIMER: ::DWORD = 0x00000004; +pub const FLASHW_TIMERNOFG: ::DWORD = 0x0000000C; +// 4674 +pub const HWND_TOP: ::HWND = 0 as ::HWND; +pub const HWND_BOTTOM: ::HWND = 1 as ::HWND; +pub const HWND_TOPMOST: ::HWND = -1isize as ::HWND; +pub const HWND_NOTOPMOST: ::HWND = -2isize as ::HWND; +//5499 +pub const MAPVK_VK_TO_VSC: ::UINT = 0; +pub const MAPVK_VSC_TO_VK: ::UINT = 1; +pub const MAPVK_VK_TO_CHAR: ::UINT = 2; +pub const MAPVK_VSC_TO_VK_EX: ::UINT = 3; +pub const MAPVK_VK_TO_VSC_EX: ::UINT = 4; +//5741 +pub const KEYEVENTF_EXTENDEDKEY: ::DWORD = 0x0001; +pub const KEYEVENTF_KEYUP: ::DWORD = 0x0002; +pub const KEYEVENTF_UNICODE: ::DWORD = 0x0004; +pub const KEYEVENTF_SCANCODE: ::DWORD = 0x0008; +pub const MOUSEEVENTF_MOVE: ::DWORD = 0x0001; +pub const MOUSEEVENTF_LEFTDOWN: ::DWORD = 0x0002; +pub const MOUSEEVENTF_LEFTUP: ::DWORD = 0x0004; +pub const MOUSEEVENTF_RIGHTDOWN: ::DWORD = 0x0008; +pub const MOUSEEVENTF_RIGHTUP: ::DWORD = 0x0010; +pub const MOUSEEVENTF_MIDDLEDOWN: ::DWORD = 0x0020; +pub const MOUSEEVENTF_MIDDLEUP: ::DWORD = 0x0040; +pub const MOUSEEVENTF_XDOWN: ::DWORD = 0x0080; +pub const MOUSEEVENTF_XUP: ::DWORD = 0x0100; +pub const MOUSEEVENTF_WHEEL: ::DWORD = 0x0800; +pub const MOUSEEVENTF_HWHEEL: ::DWORD = 0x01000; +pub const MOUSEEVENTF_MOVE_NOCOALESCE: ::DWORD = 0x2000; +pub const MOUSEEVENTF_VIRTUALDESK: ::DWORD = 0x4000; +pub const MOUSEEVENTF_ABSOLUTE: ::DWORD = 0x8000; +STRUCT!{struct MOUSEINPUT { + dx: ::LONG, + dy: ::LONG, + mouseData: ::DWORD, + dwFlags: ::DWORD, + time: ::DWORD, + dwExtraInfo: ::ULONG_PTR, +}} +pub type PMOUSEINPUT = *mut MOUSEINPUT; +pub type LPMOUSEINPUT = *mut MOUSEINPUT; +STRUCT!{struct KEYBDINPUT { + wVk: ::WORD, + wScan: ::WORD, + dwFlags: ::DWORD, + time: ::DWORD, + dwExtraInfo: ::ULONG_PTR, +}} +pub type PKEYBDINPUT = *mut KEYBDINPUT; +pub type LPKEYBDINPUT = *mut KEYBDINPUT; +STRUCT!{struct HARDWAREINPUT { + uMsg: ::DWORD, + wParamL: ::WORD, + wParamH: ::WORD, +}} +pub type PHARDWAREINPUT = *mut HARDWAREINPUT; +pub type LPHARDWAREINPUT= *mut HARDWAREINPUT; +pub const INPUT_MOUSE: ::DWORD = 0; +pub const INPUT_KEYBOARD: ::DWORD = 1; +pub const INPUT_HARDWARE: ::DWORD = 2; +#[cfg(target_arch = "x86")] +STRUCT!{struct INPUT { + type_: ::DWORD, + u: [u32; 6], +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct INPUT { + type_: ::DWORD, + u: [u64; 4], +}} +UNION!{INPUT, u, mi, mi_mut, MOUSEINPUT} +UNION!{INPUT, u, ki, ki_mut, KEYBDINPUT} +UNION!{INPUT, u, hi, hi_mut, HARDWAREINPUT} +pub type PINPUT = *mut INPUT; +pub type LPINPUT = *mut INPUT; +// if WINVER >= 0x0601 +DECLARE_HANDLE!(HTOUCHINPUT, HTOUCHINPUT__); +STRUCT!{struct TOUCHINPUT { + x: ::LONG, + y: ::LONG, + hSource: ::HANDLE, + dwID: ::DWORD, + dwFlags: ::DWORD, + dwMask: ::DWORD, + dwTime: ::DWORD, + dwExtraInfo: ::ULONG_PTR, + cxContact: ::DWORD, + cyContact: ::DWORD, +}} +pub type PTOUCHINPUT = *mut TOUCHINPUT; +pub type PCTOUCHINPUT = *const TOUCHINPUT; +//Touch input flag values (TOUCHINPUT.dwFlags) +pub const TOUCHEVENTF_MOVE: ::DWORD = 0x0001; +pub const TOUCHEVENTF_DOWN: ::DWORD = 0x0002; +pub const TOUCHEVENTF_UP: ::DWORD = 0x0004; +pub const TOUCHEVENTF_INRANGE: ::DWORD = 0x0008; +pub const TOUCHEVENTF_PRIMARY: ::DWORD = 0x0010; +pub const TOUCHEVENTF_NOCOALESCE: ::DWORD = 0x0020; +pub const TOUCHEVENTF_PEN: ::DWORD = 0x0040; +pub const TOUCHEVENTF_PALM: ::DWORD = 0x0080; +//Touch input mask values (TOUCHINPUT.dwMask) +pub const TOUCHINPUTMASKF_TIMEFROMSYSTEM: ::DWORD = 0x0001; +pub const TOUCHINPUTMASKF_EXTRAINFO: ::DWORD = 0x0002; +pub const TOUCHINPUTMASKF_CONTACTAREA: ::DWORD = 0x0004; +//RegisterTouchWindow flag values +pub const TWF_FINETOUCH: ::ULONG = 0x00000001; +pub const TWF_WANTPALM: ::ULONG = 0x00000002; +// end if WINVER >= 0x0601 +//Indices for GetWindowLong etc. +pub const GWL_EXSTYLE: ::c_int = -20; +pub const GWL_STYLE: ::c_int = -16; +pub const GWL_WNDPROC: ::c_int = -4; +pub const GWLP_WNDPROC: ::c_int = -4; +pub const GWL_HINSTANCE: ::c_int = -6; +pub const GWLP_HINSTANCE: ::c_int = -6; +pub const GWL_HWNDPARENT: ::c_int = -8; +pub const GWLP_HWNDPARENT: ::c_int = -8; +pub const GWL_ID: ::c_int = -12; +pub const GWLP_ID: ::c_int = -12; +pub const GWL_USERDATA: ::c_int = -21; +pub const GWLP_USERDATA: ::c_int = -21; +//5976 +ENUM!{enum POINTER_INPUT_TYPE { + PT_POINTER = 0x00000001, + PT_TOUCH = 0x00000002, + PT_PEN = 0x00000003, + PT_MOUSE = 0x00000004, + PT_TOUCHPAD = 0x00000005, +}} +//6566 +// flags for MsgWaitForMultipleObjectsEx +pub const MWMO_WAITALL: ::DWORD = 0x0001; +pub const MWMO_ALERTABLE: ::DWORD = 0x0002; +pub const MWMO_INPUTAVAILABLE: ::DWORD = 0x0004; +//6573 +pub const QS_KEY: ::UINT = 0x0001; +pub const QS_MOUSEMOVE: ::UINT = 0x0002; +pub const QS_MOUSEBUTTON: ::UINT = 0x0004; +pub const QS_POSTMESSAGE: ::UINT = 0x0008; +pub const QS_TIMER: ::UINT = 0x0010; +pub const QS_PAINT: ::UINT = 0x0020; +pub const QS_SENDMESSAGE: ::UINT = 0x0040; +pub const QS_HOTKEY: ::UINT = 0x0080; +pub const QS_ALLPOSTMESSAGE: ::UINT = 0x0100; +pub const QS_RAWINPUT: ::UINT = 0x0400; +pub const QS_TOUCH: ::UINT = 0x0800; +pub const QS_POINTER: ::UINT = 0x1000; +pub const QS_MOUSE: ::UINT = QS_MOUSEMOVE | QS_MOUSEBUTTON; +pub const QS_INPUT: ::UINT = QS_MOUSE | QS_KEY | QS_RAWINPUT | QS_TOUCH | QS_POINTER; +pub const QS_ALLEVENTS: ::UINT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY; +pub const QS_ALLINPUT: ::UINT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER + | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE; +//6789 +pub const SM_CXSCREEN: ::c_int = 0; +pub const SM_CYSCREEN: ::c_int = 1; +pub const SM_CXVSCROLL: ::c_int = 2; +pub const SM_CYHSCROLL: ::c_int = 3; +pub const SM_CYCAPTION: ::c_int = 4; +pub const SM_CXBORDER: ::c_int = 5; +pub const SM_CYBORDER: ::c_int = 6; +pub const SM_CXDLGFRAME: ::c_int = 7; +pub const SM_CYDLGFRAME: ::c_int = 8; +pub const SM_CYVTHUMB: ::c_int = 9; +pub const SM_CXHTHUMB: ::c_int = 10; +pub const SM_CXICON: ::c_int = 11; +pub const SM_CYICON: ::c_int = 12; +pub const SM_CXCURSOR: ::c_int = 13; +pub const SM_CYCURSOR: ::c_int = 14; +pub const SM_CYMENU: ::c_int = 15; +pub const SM_CXFULLSCREEN: ::c_int = 16; +pub const SM_CYFULLSCREEN: ::c_int = 17; +pub const SM_CYKANJIWINDOW: ::c_int = 18; +pub const SM_MOUSEPRESENT: ::c_int = 19; +pub const SM_CYVSCROLL: ::c_int = 20; +pub const SM_CXHSCROLL: ::c_int = 21; +pub const SM_DEBUG: ::c_int = 22; +pub const SM_SWAPBUTTON: ::c_int = 23; +pub const SM_RESERVED1: ::c_int = 24; +pub const SM_RESERVED2: ::c_int = 25; +pub const SM_RESERVED3: ::c_int = 26; +pub const SM_RESERVED4: ::c_int = 27; +pub const SM_CXMIN: ::c_int = 28; +pub const SM_CYMIN: ::c_int = 29; +pub const SM_CXSIZE: ::c_int = 30; +pub const SM_CYSIZE: ::c_int = 31; +pub const SM_CXFRAME: ::c_int = 32; +pub const SM_CYFRAME: ::c_int = 33; +pub const SM_CXMINTRACK: ::c_int = 34; +pub const SM_CYMINTRACK: ::c_int = 35; +pub const SM_CXDOUBLECLK: ::c_int = 36; +pub const SM_CYDOUBLECLK: ::c_int = 37; +pub const SM_CXICONSPACING: ::c_int = 38; +pub const SM_CYICONSPACING: ::c_int = 39; +pub const SM_MENUDROPALIGNMENT: ::c_int = 40; +pub const SM_PENWINDOWS: ::c_int = 41; +pub const SM_DBCSENABLED: ::c_int = 42; +pub const SM_CMOUSEBUTTONS: ::c_int = 43; +pub const SM_CXFIXEDFRAME: ::c_int = SM_CXDLGFRAME; +pub const SM_CYFIXEDFRAME: ::c_int = SM_CYDLGFRAME; +pub const SM_CXSIZEFRAME: ::c_int = SM_CXFRAME; +pub const SM_CYSIZEFRAME: ::c_int = SM_CYFRAME; +pub const SM_SECURE: ::c_int = 44; +pub const SM_CXEDGE: ::c_int = 45; +pub const SM_CYEDGE: ::c_int = 46; +pub const SM_CXMINSPACING: ::c_int = 47; +pub const SM_CYMINSPACING: ::c_int = 48; +pub const SM_CXSMICON: ::c_int = 49; +pub const SM_CYSMICON: ::c_int = 50; +pub const SM_CYSMCAPTION: ::c_int = 51; +pub const SM_CXSMSIZE: ::c_int = 52; +pub const SM_CYSMSIZE: ::c_int = 53; +pub const SM_CXMENUSIZE: ::c_int = 54; +pub const SM_CYMENUSIZE: ::c_int = 55; +pub const SM_ARRANGE: ::c_int = 56; +pub const SM_CXMINIMIZED: ::c_int = 57; +pub const SM_CYMINIMIZED: ::c_int = 58; +pub const SM_CXMAXTRACK: ::c_int = 59; +pub const SM_CYMAXTRACK: ::c_int = 60; +pub const SM_CXMAXIMIZED: ::c_int = 61; +pub const SM_CYMAXIMIZED: ::c_int = 62; +pub const SM_NETWORK: ::c_int = 63; +pub const SM_CLEANBOOT: ::c_int = 67; +pub const SM_CXDRAG: ::c_int = 68; +pub const SM_CYDRAG: ::c_int = 69; +pub const SM_SHOWSOUNDS: ::c_int = 70; +pub const SM_CXMENUCHECK: ::c_int = 71; +pub const SM_CYMENUCHECK: ::c_int = 72; +pub const SM_SLOWMACHINE: ::c_int = 73; +pub const SM_MIDEASTENABLED: ::c_int = 74; +pub const SM_MOUSEWHEELPRESENT: ::c_int = 75; +pub const SM_XVIRTUALSCREEN: ::c_int = 76; +pub const SM_YVIRTUALSCREEN: ::c_int = 77; +pub const SM_CXVIRTUALSCREEN: ::c_int = 78; +pub const SM_CYVIRTUALSCREEN: ::c_int = 79; +pub const SM_CMONITORS: ::c_int = 80; +pub const SM_SAMEDISPLAYFORMAT: ::c_int = 81; +pub const SM_IMMENABLED: ::c_int = 82; +pub const SM_CXFOCUSBORDER: ::c_int = 83; +pub const SM_CYFOCUSBORDER: ::c_int = 84; +pub const SM_TABLETPC: ::c_int = 86; +pub const SM_MEDIACENTER: ::c_int = 87; +pub const SM_STARTER: ::c_int = 88; +pub const SM_SERVERR2: ::c_int = 89; +pub const SM_MOUSEHORIZONTALWHEELPRESENT: ::c_int = 91; +pub const SM_CXPADDEDBORDER: ::c_int = 92; +pub const SM_DIGITIZER: ::c_int = 94; +pub const SM_MAXIMUMTOUCHES: ::c_int = 95; +pub const SM_CMETRICS: ::c_int = 97; +pub const SM_REMOTESESSION: ::c_int = 0x1000; +pub const SM_SHUTTINGDOWN: ::c_int = 0x2000; +pub const SM_REMOTECONTROL: ::c_int = 0x2001; +pub const SM_CARETBLINKINGENABLED: ::c_int = 0x2002; +pub const SM_CONVERTIBLESLATEMODE: ::c_int = 0x2003; +pub const SM_SYSTEMDOCKED: ::c_int = 0x2004; +//8855 (Win 7 SDK) +STRUCT!{struct ICONINFO { + fIcon: ::BOOL, + xHotspot: ::DWORD, + yHotspot: ::DWORD, + hbmMask: ::HBITMAP, + hbmColor: ::HBITMAP, +}} +pub type PICONINFO = *mut ICONINFO; +//9066 +// Color indexes for use in GetSysColor and SetSysColor +// 0-18 (after incrementing) are also valid in RegisterClass's WNDCLASS +pub const COLOR_SCROLLBAR: ::c_int = 0; +pub const COLOR_BACKGROUND: ::c_int = 1; +pub const COLOR_ACTIVECAPTION: ::c_int = 2; +pub const COLOR_INACTIVECAPTION: ::c_int = 3; +pub const COLOR_MENU: ::c_int = 4; +pub const COLOR_WINDOW: ::c_int = 5; +pub const COLOR_WINDOWFRAME: ::c_int = 6; +pub const COLOR_MENUTEXT: ::c_int = 7; +pub const COLOR_WINDOWTEXT: ::c_int = 8; +pub const COLOR_CAPTIONTEXT: ::c_int = 9; +pub const COLOR_ACTIVEBORDER: ::c_int = 10; +pub const COLOR_INACTIVEBORDER: ::c_int = 11; +pub const COLOR_APPWORKSPACE: ::c_int = 12; +pub const COLOR_HIGHLIGHT: ::c_int = 13; +pub const COLOR_HIGHLIGHTTEXT: ::c_int = 14; +pub const COLOR_BTNFACE: ::c_int = 15; +pub const COLOR_BTNSHADOW: ::c_int = 16; +pub const COLOR_GRAYTEXT: ::c_int = 17; +pub const COLOR_BTNTEXT: ::c_int = 18; +pub const COLOR_INACTIVECAPTIONTEXT: ::c_int = 19; +pub const COLOR_BTNHIGHLIGHT: ::c_int = 20; +// Introduced in Windows 95 (winver 0x0400): +pub const COLOR_3DDKSHADOW: ::c_int = 21; +pub const COLOR_3DLIGHT: ::c_int = 22; +pub const COLOR_INFOTEXT: ::c_int = 23; +pub const COLOR_INFOBK: ::c_int = 24; +pub const COLOR_DESKTOP: ::c_int = COLOR_BACKGROUND; +pub const COLOR_3DFACE: ::c_int = COLOR_BTNFACE; +pub const COLOR_3DSHADOW: ::c_int = COLOR_BTNSHADOW; +pub const COLOR_3DHIGHLIGHT: ::c_int = COLOR_BTNHIGHLIGHT; +pub const COLOR_3DHILIGHT: ::c_int = COLOR_BTNHIGHLIGHT; +pub const COLOR_BTNHILIGHT: ::c_int = COLOR_BTNHIGHLIGHT; +// Introduced in Windows 2000 (winver 0x0500) +pub const COLOR_HOTLIGHT: ::c_int = 26; +pub const COLOR_GRADIENTACTIVECAPTION: ::c_int = 27; +pub const COLOR_GRADIENTINACTIVECAPTION: ::c_int = 28; +// Introduced in Windows XP (winver 0x0501) +pub const COLOR_MENUHILIGHT: ::c_int = 29; +pub const COLOR_MENUBAR: ::c_int = 30; +//10069 +pub const IDC_ARROW: ::LPCWSTR = 32512 as ::LPCWSTR; +pub const IDC_IBEAM: ::LPCWSTR = 32513 as ::LPCWSTR; +pub const IDC_WAIT: ::LPCWSTR = 32514 as ::LPCWSTR; +pub const IDC_CROSS: ::LPCWSTR = 32515 as ::LPCWSTR; +pub const IDC_UPARROW: ::LPCWSTR = 32516 as ::LPCWSTR; +pub const IDC_SIZE: ::LPCWSTR = 32640 as ::LPCWSTR; +pub const IDC_ICON: ::LPCWSTR = 32641 as ::LPCWSTR; +pub const IDC_SIZENWSE: ::LPCWSTR = 32642 as ::LPCWSTR; +pub const IDC_SIZENESW: ::LPCWSTR = 32643 as ::LPCWSTR; +pub const IDC_SIZEWE: ::LPCWSTR = 32644 as ::LPCWSTR; +pub const IDC_SIZENS: ::LPCWSTR = 32645 as ::LPCWSTR; +pub const IDC_SIZEALL: ::LPCWSTR = 32646 as ::LPCWSTR; +pub const IDC_NO: ::LPCWSTR = 32648 as ::LPCWSTR; +pub const IDC_HAND: ::LPCWSTR = 32649 as ::LPCWSTR; +pub const IDC_APPSTARTING: ::LPCWSTR = 32650 as ::LPCWSTR; +pub const IDC_HELP: ::LPCWSTR = 32651 as ::LPCWSTR; +//10492 +pub const IDI_APPLICATION: ::LPCWSTR = 32512 as ::LPCWSTR; +pub const IDI_HAND: ::LPCWSTR = 32513 as ::LPCWSTR; +pub const IDI_QUESTION: ::LPCWSTR = 32514 as ::LPCWSTR; +pub const IDI_EXCLAMATION: ::LPCWSTR = 32515 as ::LPCWSTR; +pub const IDI_ASTERISK: ::LPCWSTR = 32516 as ::LPCWSTR; +pub const IDI_WINLOGO: ::LPCWSTR = 32517 as ::LPCWSTR; +pub const IDI_SHIELD: ::LPCWSTR = 32518 as ::LPCWSTR; +pub const IDI_WARNING: ::LPCWSTR = IDI_EXCLAMATION; +pub const IDI_ERROR: ::LPCWSTR = IDI_HAND; +pub const IDI_INFORMATION: ::LPCWSTR = IDI_ASTERISK; +pub const SPI_GETBEEP: ::UINT = 0x0001; +pub const SPI_SETBEEP: ::UINT = 0x0002; +pub const SPI_GETMOUSE: ::UINT = 0x0003; +pub const SPI_SETMOUSE: ::UINT = 0x0004; +pub const SPI_GETBORDER: ::UINT = 0x0005; +pub const SPI_SETBORDER: ::UINT = 0x0006; +pub const SPI_GETKEYBOARDSPEED: ::UINT = 0x000A; +pub const SPI_SETKEYBOARDSPEED: ::UINT = 0x000B; +pub const SPI_LANGDRIVER: ::UINT = 0x000C; +pub const SPI_ICONHORIZONTALSPACING: ::UINT = 0x000D; +pub const SPI_GETSCREENSAVETIMEOUT: ::UINT = 0x000E; +pub const SPI_SETSCREENSAVETIMEOUT: ::UINT = 0x000F; +pub const SPI_GETSCREENSAVEACTIVE: ::UINT = 0x0010; +pub const SPI_SETSCREENSAVEACTIVE: ::UINT = 0x0011; +pub const SPI_GETGRIDGRANULARITY: ::UINT = 0x0012; +pub const SPI_SETGRIDGRANULARITY: ::UINT = 0x0013; +pub const SPI_SETDESKWALLPAPER: ::UINT = 0x0014; +pub const SPI_SETDESKPATTERN: ::UINT = 0x0015; +pub const SPI_GETKEYBOARDDELAY: ::UINT = 0x0016; +pub const SPI_SETKEYBOARDDELAY: ::UINT = 0x0017; +pub const SPI_ICONVERTICALSPACING: ::UINT = 0x0018; +pub const SPI_GETICONTITLEWRAP: ::UINT = 0x0019; +pub const SPI_SETICONTITLEWRAP: ::UINT = 0x001A; +pub const SPI_GETMENUDROPALIGNMENT: ::UINT = 0x001B; +pub const SPI_SETMENUDROPALIGNMENT: ::UINT = 0x001C; +pub const SPI_SETDOUBLECLKWIDTH: ::UINT = 0x001D; +pub const SPI_SETDOUBLECLKHEIGHT: ::UINT = 0x001E; +pub const SPI_GETICONTITLELOGFONT: ::UINT = 0x001F; +pub const SPI_SETDOUBLECLICKTIME: ::UINT = 0x0020; +pub const SPI_SETMOUSEBUTTONSWAP: ::UINT = 0x0021; +pub const SPI_SETICONTITLELOGFONT: ::UINT = 0x0022; +pub const SPI_GETFASTTASKSWITCH: ::UINT = 0x0023; +pub const SPI_SETFASTTASKSWITCH: ::UINT = 0x0024; +pub const SPI_SETDRAGFULLWINDOWS: ::UINT = 0x0025; +pub const SPI_GETDRAGFULLWINDOWS: ::UINT = 0x0026; +pub const SPI_GETNONCLIENTMETRICS: ::UINT = 0x0029; +pub const SPI_SETNONCLIENTMETRICS: ::UINT = 0x002A; +pub const SPI_GETMINIMIZEDMETRICS: ::UINT = 0x002B; +pub const SPI_SETMINIMIZEDMETRICS: ::UINT = 0x002C; +pub const SPI_GETICONMETRICS: ::UINT = 0x002D; +pub const SPI_SETICONMETRICS: ::UINT = 0x002E; +pub const SPI_SETWORKAREA: ::UINT = 0x002F; +pub const SPI_GETWORKAREA: ::UINT = 0x0030; +pub const SPI_SETPENWINDOWS: ::UINT = 0x0031; +pub const SPI_GETHIGHCONTRAST: ::UINT = 0x0042; +pub const SPI_SETHIGHCONTRAST: ::UINT = 0x0043; +pub const SPI_GETKEYBOARDPREF: ::UINT = 0x0044; +pub const SPI_SETKEYBOARDPREF: ::UINT = 0x0045; +pub const SPI_GETSCREENREADER: ::UINT = 0x0046; +pub const SPI_SETSCREENREADER: ::UINT = 0x0047; +pub const SPI_GETANIMATION: ::UINT = 0x0048; +pub const SPI_SETANIMATION: ::UINT = 0x0049; +pub const SPI_GETFONTSMOOTHING: ::UINT = 0x004A; +pub const SPI_SETFONTSMOOTHING: ::UINT = 0x004B; +pub const SPI_SETDRAGWIDTH: ::UINT = 0x004C; +pub const SPI_SETDRAGHEIGHT: ::UINT = 0x004D; +pub const SPI_SETHANDHELD: ::UINT = 0x004E; +pub const SPI_GETLOWPOWERTIMEOUT: ::UINT = 0x004F; +pub const SPI_GETPOWEROFFTIMEOUT: ::UINT = 0x0050; +pub const SPI_SETLOWPOWERTIMEOUT: ::UINT = 0x0051; +pub const SPI_SETPOWEROFFTIMEOUT: ::UINT = 0x0052; +pub const SPI_GETLOWPOWERACTIVE: ::UINT = 0x0053; +pub const SPI_GETPOWEROFFACTIVE: ::UINT = 0x0054; +pub const SPI_SETLOWPOWERACTIVE: ::UINT = 0x0055; +pub const SPI_SETPOWEROFFACTIVE: ::UINT = 0x0056; +pub const SPI_SETCURSORS: ::UINT = 0x0057; +pub const SPI_SETICONS: ::UINT = 0x0058; +pub const SPI_GETDEFAULTINPUTLANG: ::UINT = 0x0059; +pub const SPI_SETDEFAULTINPUTLANG: ::UINT = 0x005A; +pub const SPI_SETLANGTOGGLE: ::UINT = 0x005B; +pub const SPI_GETWINDOWSEXTENSION: ::UINT = 0x005C; +pub const SPI_SETMOUSETRAILS: ::UINT = 0x005D; +pub const SPI_GETMOUSETRAILS: ::UINT = 0x005E; +pub const SPI_SETSCREENSAVERRUNNING: ::UINT = 0x0061; +pub const SPI_SCREENSAVERRUNNING: ::UINT = SPI_SETSCREENSAVERRUNNING; +pub const SPI_GETFILTERKEYS: ::UINT = 0x0032; +pub const SPI_SETFILTERKEYS: ::UINT = 0x0033; +pub const SPI_GETTOGGLEKEYS: ::UINT = 0x0034; +pub const SPI_SETTOGGLEKEYS: ::UINT = 0x0035; +pub const SPI_GETMOUSEKEYS: ::UINT = 0x0036; +pub const SPI_SETMOUSEKEYS: ::UINT = 0x0037; +pub const SPI_GETSHOWSOUNDS: ::UINT = 0x0038; +pub const SPI_SETSHOWSOUNDS: ::UINT = 0x0039; +pub const SPI_GETSTICKYKEYS: ::UINT = 0x003A; +pub const SPI_SETSTICKYKEYS: ::UINT = 0x003B; +pub const SPI_GETACCESSTIMEOUT: ::UINT = 0x003C; +pub const SPI_SETACCESSTIMEOUT: ::UINT = 0x003D; +pub const SPI_GETSERIALKEYS: ::UINT = 0x003E; +pub const SPI_SETSERIALKEYS: ::UINT = 0x003F; +pub const SPI_GETSOUNDSENTRY: ::UINT = 0x0040; +pub const SPI_SETSOUNDSENTRY: ::UINT = 0x0041; +pub const SPI_GETSNAPTODEFBUTTON: ::UINT = 0x005F; +pub const SPI_SETSNAPTODEFBUTTON: ::UINT = 0x0060; +pub const SPI_GETMOUSEHOVERWIDTH: ::UINT = 0x0062; +pub const SPI_SETMOUSEHOVERWIDTH: ::UINT = 0x0063; +pub const SPI_GETMOUSEHOVERHEIGHT: ::UINT = 0x0064; +pub const SPI_SETMOUSEHOVERHEIGHT: ::UINT = 0x0065; +pub const SPI_GETMOUSEHOVERTIME: ::UINT = 0x0066; +pub const SPI_SETMOUSEHOVERTIME: ::UINT = 0x0067; +pub const SPI_GETWHEELSCROLLLINES: ::UINT = 0x0068; +pub const SPI_SETWHEELSCROLLLINES: ::UINT = 0x0069; +pub const SPI_GETMENUSHOWDELAY: ::UINT = 0x006A; +pub const SPI_SETMENUSHOWDELAY: ::UINT = 0x006B; +pub const SPI_GETWHEELSCROLLCHARS: ::UINT = 0x006C; +pub const SPI_SETWHEELSCROLLCHARS: ::UINT = 0x006D; +pub const SPI_GETSHOWIMEUI: ::UINT = 0x006E; +pub const SPI_SETSHOWIMEUI: ::UINT = 0x006F; +pub const SPI_GETMOUSESPEED: ::UINT = 0x0070; +pub const SPI_SETMOUSESPEED: ::UINT = 0x0071; +pub const SPI_GETSCREENSAVERRUNNING: ::UINT = 0x0072; +pub const SPI_GETDESKWALLPAPER: ::UINT = 0x0073; +pub const SPI_GETAUDIODESCRIPTION: ::UINT = 0x0074; +pub const SPI_SETAUDIODESCRIPTION: ::UINT = 0x0075; +pub const SPI_GETSCREENSAVESECURE: ::UINT = 0x0076; +pub const SPI_SETSCREENSAVESECURE: ::UINT = 0x0077; +pub const SPI_GETHUNGAPPTIMEOUT: ::UINT = 0x0078; +pub const SPI_SETHUNGAPPTIMEOUT: ::UINT = 0x0079; +pub const SPI_GETWAITTOKILLTIMEOUT: ::UINT = 0x007A; +pub const SPI_SETWAITTOKILLTIMEOUT: ::UINT = 0x007B; +pub const SPI_GETWAITTOKILLSERVICETIMEOUT: ::UINT = 0x007C; +pub const SPI_SETWAITTOKILLSERVICETIMEOUT: ::UINT = 0x007D; +pub const SPI_GETMOUSEDOCKTHRESHOLD: ::UINT = 0x007E; +pub const SPI_SETMOUSEDOCKTHRESHOLD: ::UINT = 0x007F; +pub const SPI_GETPENDOCKTHRESHOLD: ::UINT = 0x0080; +pub const SPI_SETPENDOCKTHRESHOLD: ::UINT = 0x0081; +pub const SPI_GETWINARRANGING: ::UINT = 0x0082; +pub const SPI_SETWINARRANGING: ::UINT = 0x0083; +pub const SPI_GETMOUSEDRAGOUTTHRESHOLD: ::UINT = 0x0084; +pub const SPI_SETMOUSEDRAGOUTTHRESHOLD: ::UINT = 0x0085; +pub const SPI_GETPENDRAGOUTTHRESHOLD: ::UINT = 0x0086; +pub const SPI_SETPENDRAGOUTTHRESHOLD: ::UINT = 0x0087; +pub const SPI_GETMOUSESIDEMOVETHRESHOLD: ::UINT = 0x0088; +pub const SPI_SETMOUSESIDEMOVETHRESHOLD: ::UINT = 0x0089; +pub const SPI_GETPENSIDEMOVETHRESHOLD: ::UINT = 0x008A; +pub const SPI_SETPENSIDEMOVETHRESHOLD: ::UINT = 0x008B; +pub const SPI_GETDRAGFROMMAXIMIZE: ::UINT = 0x008C; +pub const SPI_SETDRAGFROMMAXIMIZE: ::UINT = 0x008D; +pub const SPI_GETSNAPSIZING: ::UINT = 0x008E; +pub const SPI_SETSNAPSIZING: ::UINT = 0x008F; +pub const SPI_GETDOCKMOVING: ::UINT = 0x0090; +pub const SPI_SETDOCKMOVING: ::UINT = 0x0091; +pub const SPI_GETACTIVEWINDOWTRACKING: ::UINT = 0x1000; +pub const SPI_SETACTIVEWINDOWTRACKING: ::UINT = 0x1001; +pub const SPI_GETMENUANIMATION: ::UINT = 0x1002; +pub const SPI_SETMENUANIMATION: ::UINT = 0x1003; +pub const SPI_GETCOMBOBOXANIMATION: ::UINT = 0x1004; +pub const SPI_SETCOMBOBOXANIMATION: ::UINT = 0x1005; +pub const SPI_GETLISTBOXSMOOTHSCROLLING: ::UINT = 0x1006; +pub const SPI_SETLISTBOXSMOOTHSCROLLING: ::UINT = 0x1007; +pub const SPI_GETGRADIENTCAPTIONS: ::UINT = 0x1008; +pub const SPI_SETGRADIENTCAPTIONS: ::UINT = 0x1009; +pub const SPI_GETKEYBOARDCUES: ::UINT = 0x100A; +pub const SPI_SETKEYBOARDCUES: ::UINT = 0x100B; +pub const SPI_GETMENUUNDERLINES: ::UINT = SPI_GETKEYBOARDCUES; +pub const SPI_SETMENUUNDERLINES: ::UINT = SPI_SETKEYBOARDCUES; +pub const SPI_GETACTIVEWNDTRKZORDER: ::UINT = 0x100C; +pub const SPI_SETACTIVEWNDTRKZORDER: ::UINT = 0x100D; +pub const SPI_GETHOTTRACKING: ::UINT = 0x100E; +pub const SPI_SETHOTTRACKING: ::UINT = 0x100F; +pub const SPI_GETMENUFADE: ::UINT = 0x1012; +pub const SPI_SETMENUFADE: ::UINT = 0x1013; +pub const SPI_GETSELECTIONFADE: ::UINT = 0x1014; +pub const SPI_SETSELECTIONFADE: ::UINT = 0x1015; +pub const SPI_GETTOOLTIPANIMATION: ::UINT = 0x1016; +pub const SPI_SETTOOLTIPANIMATION: ::UINT = 0x1017; +pub const SPI_GETTOOLTIPFADE: ::UINT = 0x1018; +pub const SPI_SETTOOLTIPFADE: ::UINT = 0x1019; +pub const SPI_GETCURSORSHADOW: ::UINT = 0x101A; +pub const SPI_SETCURSORSHADOW: ::UINT = 0x101B; +pub const SPI_GETMOUSESONAR: ::UINT = 0x101C; +pub const SPI_SETMOUSESONAR: ::UINT = 0x101D; +pub const SPI_GETMOUSECLICKLOCK: ::UINT = 0x101E; +pub const SPI_SETMOUSECLICKLOCK: ::UINT = 0x101F; +pub const SPI_GETMOUSEVANISH: ::UINT = 0x1020; +pub const SPI_SETMOUSEVANISH: ::UINT = 0x1021; +pub const SPI_GETFLATMENU: ::UINT = 0x1022; +pub const SPI_SETFLATMENU: ::UINT = 0x1023; +pub const SPI_GETDROPSHADOW: ::UINT = 0x1024; +pub const SPI_SETDROPSHADOW: ::UINT = 0x1025; +pub const SPI_GETBLOCKSENDINPUTRESETS: ::UINT = 0x1026; +pub const SPI_SETBLOCKSENDINPUTRESETS: ::UINT = 0x1027; +pub const SPI_GETUIEFFECTS: ::UINT = 0x103E; +pub const SPI_SETUIEFFECTS: ::UINT = 0x103F; +pub const SPI_GETDISABLEOVERLAPPEDCONTENT: ::UINT = 0x1040; +pub const SPI_SETDISABLEOVERLAPPEDCONTENT: ::UINT = 0x1041; +pub const SPI_GETCLIENTAREAANIMATION: ::UINT = 0x1042; +pub const SPI_SETCLIENTAREAANIMATION: ::UINT = 0x1043; +pub const SPI_GETCLEARTYPE: ::UINT = 0x1048; +pub const SPI_SETCLEARTYPE: ::UINT = 0x1049; +pub const SPI_GETSPEECHRECOGNITION: ::UINT = 0x104A; +pub const SPI_SETSPEECHRECOGNITION: ::UINT = 0x104B; +pub const SPI_GETFOREGROUNDLOCKTIMEOUT: ::UINT = 0x2000; +pub const SPI_SETFOREGROUNDLOCKTIMEOUT: ::UINT = 0x2001; +pub const SPI_GETACTIVEWNDTRKTIMEOUT: ::UINT = 0x2002; +pub const SPI_SETACTIVEWNDTRKTIMEOUT: ::UINT = 0x2003; +pub const SPI_GETFOREGROUNDFLASHCOUNT: ::UINT = 0x2004; +pub const SPI_SETFOREGROUNDFLASHCOUNT: ::UINT = 0x2005; +pub const SPI_GETCARETWIDTH: ::UINT = 0x2006; +pub const SPI_SETCARETWIDTH: ::UINT = 0x2007; +pub const SPI_GETMOUSECLICKLOCKTIME: ::UINT = 0x2008; +pub const SPI_SETMOUSECLICKLOCKTIME: ::UINT = 0x2009; +pub const SPI_GETFONTSMOOTHINGTYPE: ::UINT = 0x200A; +pub const SPI_SETFONTSMOOTHINGTYPE: ::UINT = 0x200B; +pub const FE_FONTSMOOTHINGSTANDARD: ::UINT = 0x0001; +pub const FE_FONTSMOOTHINGCLEARTYPE: ::UINT = 0x0002; +pub const SPI_GETFONTSMOOTHINGCONTRAST: ::UINT = 0x200C; +pub const SPI_SETFONTSMOOTHINGCONTRAST: ::UINT = 0x200D; +pub const SPI_GETFOCUSBORDERWIDTH: ::UINT = 0x200E; +pub const SPI_SETFOCUSBORDERWIDTH: ::UINT = 0x200F; +pub const SPI_GETFOCUSBORDERHEIGHT: ::UINT = 0x2010; +pub const SPI_SETFOCUSBORDERHEIGHT: ::UINT = 0x2011; +pub const SPI_GETFONTSMOOTHINGORIENTATION: ::UINT = 0x2012; +pub const SPI_SETFONTSMOOTHINGORIENTATION: ::UINT = 0x2013; +pub const FE_FONTSMOOTHINGORIENTATIONBGR: ::UINT = 0x0000; +pub const FE_FONTSMOOTHINGORIENTATIONRGB: ::UINT = 0x0001; +pub const SPI_GETMINIMUMHITRADIUS: ::UINT = 0x2014; +pub const SPI_SETMINIMUMHITRADIUS: ::UINT = 0x2015; +pub const SPI_GETMESSAGEDURATION: ::UINT = 0x2016; +pub const SPI_SETMESSAGEDURATION: ::UINT = 0x2017; +//11264 +pub const CB_GETEDITSEL: ::UINT = 0x0140; +pub const CB_LIMITTEXT: ::UINT = 0x0141; +pub const CB_SETEDITSEL: ::UINT = 0x0142; +pub const CB_ADDSTRING: ::UINT = 0x0143; +pub const CB_DELETESTRING: ::UINT = 0x0144; +pub const CB_DIR: ::UINT = 0x0145; +pub const CB_GETCOUNT: ::UINT = 0x0146; +pub const CB_GETCURSEL: ::UINT = 0x0147; +pub const CB_GETLBTEXT: ::UINT = 0x0148; +pub const CB_GETLBTEXTLEN: ::UINT = 0x0149; +pub const CB_INSERTSTRING: ::UINT = 0x014A; +pub const CB_RESETCONTENT: ::UINT = 0x014B; +pub const CB_FINDSTRING: ::UINT = 0x014C; +pub const CB_SELECTSTRING: ::UINT = 0x014D; +pub const CB_SETCURSEL: ::UINT = 0x014E; +pub const CB_SHOWDROPDOWN: ::UINT = 0x014F; +pub const CB_GETITEMDATA: ::UINT = 0x0150; +pub const CB_SETITEMDATA: ::UINT = 0x0151; +pub const CB_GETDROPPEDCONTROLRECT: ::UINT = 0x0152; +pub const CB_SETITEMHEIGHT: ::UINT = 0x0153; +pub const CB_GETITEMHEIGHT: ::UINT = 0x0154; +pub const CB_SETEXTENDEDUI: ::UINT = 0x0155; +pub const CB_GETEXTENDEDUI: ::UINT = 0x0156; +pub const CB_GETDROPPEDSTATE: ::UINT = 0x0157; +pub const CB_FINDSTRINGEXACT: ::UINT = 0x0158; +pub const CB_SETLOCALE: ::UINT = 0x0159; +pub const CB_GETLOCALE: ::UINT = 0x015A; +pub const CB_GETTOPINDEX: ::UINT = 0x015b; +pub const CB_SETTOPINDEX: ::UINT = 0x015c; +pub const CB_GETHORIZONTALEXTENT: ::UINT = 0x015d; +pub const CB_SETHORIZONTALEXTENT: ::UINT = 0x015e; +pub const CB_GETDROPPEDWIDTH: ::UINT = 0x015f; +pub const CB_SETDROPPEDWIDTH: ::UINT = 0x0160; +pub const CB_INITSTORAGE: ::UINT = 0x0161; +//12141 +STRUCT!{nodebug struct NONCLIENTMETRICSA { + cbSize: ::UINT, + iBorderWidth: ::c_int, + iScrollWidth: ::c_int, + iScrollHeight: ::c_int, + iCaptionWidth: ::c_int, + iCaptionHeight: ::c_int, + lfCaptionFont: ::LOGFONTA, + iSmCaptionWidth: ::c_int, + iSmCaptionHeight: ::c_int, + lfSmCaptionFont: ::LOGFONTA, + iMenuWidth: ::c_int, + iMenuHeight: ::c_int, + lfMenuFont: ::LOGFONTA, + lfStatusFont: ::LOGFONTA, + lfMessageFont: ::LOGFONTA, + iPaddedBorderWidth: ::c_int, +}} +pub type LPNONCLIENTMETRICSA = *mut NONCLIENTMETRICSA; +STRUCT!{nodebug struct NONCLIENTMETRICSW { + cbSize: ::UINT, + iBorderWidth: ::c_int, + iScrollWidth: ::c_int, + iScrollHeight: ::c_int, + iCaptionWidth: ::c_int, + iCaptionHeight: ::c_int, + lfCaptionFont: ::LOGFONTW, + iSmCaptionWidth: ::c_int, + iSmCaptionHeight: ::c_int, + lfSmCaptionFont: ::LOGFONTW, + iMenuWidth: ::c_int, + iMenuHeight: ::c_int, + lfMenuFont: ::LOGFONTW, + lfStatusFont: ::LOGFONTW, + lfMessageFont: ::LOGFONTW, + iPaddedBorderWidth: ::c_int, +}} +pub type LPNONCLIENTMETRICSW = *mut NONCLIENTMETRICSW; +//12869 +pub const MONITOR_DEFAULTTONULL: ::DWORD = 0x00000000; +pub const MONITOR_DEFAULTTOPRIMARY: ::DWORD = 0x00000001; +pub const MONITOR_DEFAULTTONEAREST: ::DWORD = 0x00000002; +//12900 +pub const MONITORINFOF_PRIMARY: ::DWORD = 1; +pub const CCHDEVICENAME: usize = 32; +STRUCT!{struct MONITORINFO { + cbSize: ::DWORD, + rcMonitor: ::RECT, + rcWork: ::RECT, + dwFlags: ::DWORD, +}} +pub type LPMONITORINFO = *mut MONITORINFO; +STRUCT!{struct MONITORINFOEXA { + cbSize: ::DWORD, + rcMonitor: ::RECT, + rcWork: ::RECT, + dwFlags: ::DWORD, + szDevice: [::CHAR; ::CCHDEVICENAME], +}} +pub type LPMONITORINFOEXA = *mut MONITORINFOEXA; +STRUCT!{struct MONITORINFOEXW { + cbSize: ::DWORD, + rcMonitor: ::RECT, + rcWork: ::RECT, + dwFlags: ::DWORD, + szDevice: [::WCHAR; ::CCHDEVICENAME], +}} +pub type LPMONITORINFOEXW = *mut MONITORINFOEXW; +//12971 +pub type MONITORENUMPROC = Option ::BOOL>; +//14098 +DECLARE_HANDLE!(HRAWINPUT, HRAWINPUT__); +pub fn GET_RAWINPUT_CODE_WPARAM(wParam: ::WPARAM) -> ::WPARAM { wParam & 0xff } +pub const RIM_INPUT: ::WPARAM = 0; +pub const RIM_INPUTSINK: ::WPARAM = 1; +STRUCT!{struct RAWINPUTHEADER { + dwType: ::DWORD, + dwSize: ::DWORD, + hDevice: ::HANDLE, + wParam: ::WPARAM, +}} +pub type PRAWINPUTHEADER = *mut RAWINPUTHEADER; +pub type LPRAWINPUTHEADER = *mut RAWINPUTHEADER; +pub const RIM_TYPEMOUSE: ::DWORD = 0; +pub const RIM_TYPEKEYBOARD: ::DWORD = 1; +pub const RIM_TYPEHID: ::DWORD = 2; +STRUCT!{struct RAWMOUSE { + usFlags: ::USHORT, + memory_padding: ::USHORT, // 16bit Padding for 32bit align in following union + usButtonFlags: ::USHORT, + usButtonData: ::USHORT, + ulRawButtons: ::ULONG, + lLastX: ::LONG, + lLastY: ::LONG, + ulExtraInformation: ::ULONG, +}} +pub type PRAWMOUSE = *mut RAWMOUSE; +pub type LPRAWMOUSE = *mut RAWMOUSE; +pub const RI_MOUSE_LEFT_BUTTON_DOWN: ::USHORT = 0x0001; +pub const RI_MOUSE_LEFT_BUTTON_UP: ::USHORT = 0x0002; +pub const RI_MOUSE_RIGHT_BUTTON_DOWN: ::USHORT = 0x0004; +pub const RI_MOUSE_RIGHT_BUTTON_UP: ::USHORT = 0x0008; +pub const RI_MOUSE_MIDDLE_BUTTON_DOWN: ::USHORT = 0x0010; +pub const RI_MOUSE_MIDDLE_BUTTON_UP: ::USHORT = 0x0020; +pub const RI_MOUSE_BUTTON_1_DOWN: ::USHORT = RI_MOUSE_LEFT_BUTTON_DOWN; +pub const RI_MOUSE_BUTTON_1_UP: ::USHORT = RI_MOUSE_LEFT_BUTTON_UP; +pub const RI_MOUSE_BUTTON_2_DOWN: ::USHORT = RI_MOUSE_RIGHT_BUTTON_DOWN; +pub const RI_MOUSE_BUTTON_2_UP: ::USHORT = RI_MOUSE_RIGHT_BUTTON_UP; +pub const RI_MOUSE_BUTTON_3_DOWN: ::USHORT = RI_MOUSE_MIDDLE_BUTTON_DOWN; +pub const RI_MOUSE_BUTTON_3_UP: ::USHORT = RI_MOUSE_MIDDLE_BUTTON_UP; +pub const RI_MOUSE_BUTTON_4_DOWN: ::USHORT = 0x0040; +pub const RI_MOUSE_BUTTON_4_UP: ::USHORT = 0x0080; +pub const RI_MOUSE_BUTTON_5_DOWN: ::USHORT = 0x0100; +pub const RI_MOUSE_BUTTON_5_UP: ::USHORT = 0x0200; +pub const RI_MOUSE_WHEEL: ::USHORT = 0x0400; +pub const MOUSE_MOVE_RELATIVE: ::USHORT = 0; +pub const MOUSE_MOVE_ABSOLUTE: ::USHORT = 1; +pub const MOUSE_VIRTUAL_DESKTOP: ::USHORT = 0x02; +pub const MOUSE_ATTRIBUTES_CHANGED: ::USHORT = 0x04; +pub const MOUSE_MOVE_NOCOALESCE: ::USHORT = 0x08; +STRUCT!{struct RAWKEYBOARD { + MakeCode: ::USHORT, + Flags: ::USHORT, + Reserved: ::USHORT, + VKey: ::USHORT, + Message: ::UINT, + ExtraInformation: ::ULONG, +}} +pub type PRAWKEYBOARD = *mut RAWKEYBOARD; +pub type LPRAWKEYBOARD = *mut RAWKEYBOARD; +pub const KEYBOARD_OVERRUN_MAKE_CODE: ::DWORD = 0xFF; +pub const RI_KEY_MAKE: ::DWORD = 0; +pub const RI_KEY_BREAK: ::DWORD = 1; +pub const RI_KEY_E0: ::DWORD = 2; +pub const RI_KEY_E1: ::DWORD = 4; +pub const RI_KEY_TERMSRV_SET_LED: ::DWORD = 8; +pub const RI_KEY_TERMSRV_SHADOW: ::DWORD = 0x10; +STRUCT!{struct RAWHID { + dwSizeHid: ::DWORD, + dwCount: ::DWORD, + bRawData: [::BYTE; 0], +}} +pub type PRAWHID = *mut RAWHID; +pub type LPRAWHID = *mut RAWHID; +STRUCT!{struct RAWINPUT { + header: RAWINPUTHEADER, + mouse: RAWMOUSE, +}} +UNION!(RAWINPUT, mouse, mouse, mouse_mut, RAWMOUSE); +UNION!(RAWINPUT, mouse, keyboard, keyboard_mut, RAWKEYBOARD); +UNION!(RAWINPUT, mouse, hid, hid_mut, RAWHID); +#[test] +fn test_RAWINPUT() { + use std::mem::{size_of, align_of}; + assert!(size_of::() >= size_of::()); + assert!(size_of::() >= size_of::()); + assert!(size_of::() >= size_of::()); + assert!(align_of::() >= align_of::()); + assert!(align_of::() >= align_of::()); + assert!(align_of::() >= align_of::()); +} +pub type PRAWINPUT = *mut RAWINPUT; +pub type LPRAWINPUT = *mut RAWINPUT; +pub const RID_INPUT: ::DWORD = 0x10000003; +pub const RID_HEADER: ::DWORD = 0x10000005; +pub const RIDI_PREPARSEDDATA: ::DWORD = 0x20000005; +pub const RIDI_DEVICENAME: ::DWORD = 0x20000007; +pub const RIDI_DEVICEINFO: ::DWORD = 0x2000000b; +STRUCT!{struct RID_DEVICE_INFO_MOUSE { + dwId: ::DWORD, + dwNumberOfButtons: ::DWORD, + dwSampleRate: ::DWORD, + fHasHorizontalWheel: ::BOOL, +}} +pub type PRID_DEVICE_INFO_MOUSE = *mut RID_DEVICE_INFO_MOUSE; +STRUCT!{struct RID_DEVICE_INFO_KEYBOARD { + dwType: ::DWORD, + dwSubType: ::DWORD, + dwKeyboardMode: ::DWORD, + dwNumberOfFunctionKeys: ::DWORD, + dwNumberOfIndicators: ::DWORD, + dwNumberOfKeysTotal: ::DWORD, +}} +pub type PRID_DEVICE_INFO_KEYBOARD = *mut RID_DEVICE_INFO_KEYBOARD; +STRUCT!{struct RID_DEVICE_INFO_HID { + dwVendorId: ::DWORD, + dwProductId: ::DWORD, + dwVersionNumber: ::DWORD, + usUsagePage: ::USHORT, + usUsage: ::USHORT, +}} +pub type PRID_DEVICE_INFO_HID = *mut RID_DEVICE_INFO_HID; +STRUCT!{struct RID_DEVICE_INFO { + cbSize: ::DWORD, + dwType: ::DWORD, + keyboard: RID_DEVICE_INFO_KEYBOARD, +}} +UNION!(RID_DEVICE_INFO, keyboard, mouse, mouse_mut, RID_DEVICE_INFO_MOUSE); +UNION!(RID_DEVICE_INFO, keyboard, keyboard, keyboard_mut, RID_DEVICE_INFO_KEYBOARD); +UNION!(RID_DEVICE_INFO, keyboard, hid, hid_mut, RID_DEVICE_INFO_HID); +#[test] +fn test_RID_DEVICE_INFO() { + use std::mem::{size_of, align_of}; + assert!(size_of::() >= size_of::()); + assert!(size_of::() >= size_of::()); + assert!(size_of::() >= size_of::()); + assert!(align_of::() >= align_of::()); + assert!(align_of::() + >= align_of::()); + assert!(align_of::() >= align_of::()); +} +pub type PRID_DEVICE_INFO = *mut RID_DEVICE_INFO; +pub type LPRID_DEVICE_INFO = *mut RID_DEVICE_INFO; +STRUCT!{struct RAWINPUTDEVICE { + usUsagePage: ::USHORT, + usUsage: ::USHORT, + dwFlags: ::DWORD, + hwndTarget: ::HWND, +}} +pub type PRAWINPUTDEVICE = *mut RAWINPUTDEVICE; +pub type LPRAWINPUTDEVICE = *mut RAWINPUTDEVICE; +pub type PCRAWINPUTDEVICE = *const RAWINPUTDEVICE; +pub const RIDEV_REMOVE: ::DWORD = 0x00000001; +pub const RIDEV_EXCLUDE: ::DWORD = 0x00000010; +pub const RIDEV_PAGEONLY: ::DWORD = 0x00000020; +pub const RIDEV_NOLEGACY: ::DWORD = 0x00000030; +pub const RIDEV_INPUTSINK: ::DWORD = 0x00000100; +pub const RIDEV_CAPTUREMOUSE: ::DWORD = 0x00000200; +pub const RIDEV_NOHOTKEYS: ::DWORD = 0x00000200; +pub const RIDEV_APPKEYS: ::DWORD = 0x00000400; +pub const RIDEV_EXINPUTSINK: ::DWORD = 0x00001000; +pub const RIDEV_DEVNOTIFY: ::DWORD = 0x00002000; +pub const RIDEV_EXMODEMASK: ::DWORD = 0x000000F0; +pub const GIDC_ARRIVAL: ::DWORD = 1; +pub const GIDC_REMOVAL: ::DWORD = 2; +STRUCT!{struct RAWINPUTDEVICELIST { + hDevice: ::HANDLE, + dwType: ::DWORD, +}} +pub type PRAWINPUTDEVICELIST = *mut RAWINPUTDEVICELIST; +STRUCT!{struct CHANGEFILTERSTRUCT { + cbSize: ::DWORD, + ExtStatus: ::DWORD, +}} +pub type PCHANGEFILTERSTRUCT = *mut CHANGEFILTERSTRUCT; +STRUCT!{struct DLGTEMPLATE { + style: ::DWORD, + dwExtendedStyle: ::DWORD, + cdit: ::WORD, + x: ::c_short, + y: ::c_short, + cx: ::c_short, + cy: ::c_short, +}} +pub type LPDLGTEMPLATEA = *mut DLGTEMPLATE; +pub type LPDLGTEMPLATEW = *mut DLGTEMPLATE; +pub type LPCDLGTEMPLATEA = *const DLGTEMPLATE; +pub type LPCDLGTEMPLATEW = *const DLGTEMPLATE; +STRUCT!{struct DRAWTEXTPARAMS { + cbSize: ::UINT, + iTabLength: ::c_int, + iLeftMargin: ::c_int, + iRightMargin: ::c_int, + uiLengthDrawn: ::UINT, +}} +pub type LPDRAWTEXTPARAMS = *mut DRAWTEXTPARAMS; +STRUCT!{struct ACCEL { + fVirt: ::BYTE, + key: ::WORD, + cmd: ::WORD, +}} +pub type LPACCEL = *mut ACCEL; +STRUCT!{struct MENUITEMINFOA { + cbSize: ::UINT, + fMask: ::UINT, + fType: ::UINT, + fState: ::UINT, + wID: ::UINT, + hSubMenu: ::HMENU, + hbmpChecked: ::HBITMAP, + hbmpUnchecked: ::HBITMAP, + dwItemData: ::ULONG_PTR, + dwTypeData: ::LPSTR, + cch: ::UINT, + hbmpItem: ::HBITMAP, +}} +pub type LPMENUITEMINFOA = *mut MENUITEMINFOA; +pub type LPCMENUITEMINFOA = *const MENUITEMINFOA; +STRUCT!{struct MENUITEMINFOW { + cbSize: ::UINT, + fMask: ::UINT, + fType: ::UINT, + fState: ::UINT, + wID: ::UINT, + hSubMenu: ::HMENU, + hbmpChecked: ::HBITMAP, + hbmpUnchecked: ::HBITMAP, + dwItemData: ::ULONG_PTR, + dwTypeData: ::LPWSTR, + cch: ::UINT, + hbmpItem: ::HBITMAP, +}} +pub type LPMENUITEMINFOW = *mut MENUITEMINFOW; +pub type LPCMENUITEMINFOW = *const MENUITEMINFOW; +STRUCT!{nodebug struct MSGBOXPARAMSA { + cbSize: ::UINT, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + lpszText: ::LPCSTR, + lpszCaption: ::LPCSTR, + dwStyle: ::DWORD, + lpszIcon: ::LPCSTR, + dwContextHelpId: ::DWORD_PTR, + lpfnMsgBoxCallback: ::MSGBOXCALLBACK, + dwLanguageId: ::DWORD, +}} +pub type PMSGBOXPARAMSA = *mut MSGBOXPARAMSA; +pub type LPMSGBOXPARAMSA = *mut MSGBOXPARAMSA; +STRUCT!{nodebug struct MSGBOXPARAMSW { + cbSize: ::UINT, + hwndOwner: ::HWND, + hInstance: ::HINSTANCE, + lpszText: ::LPCWSTR, + lpszCaption: ::LPCWSTR, + dwStyle: ::DWORD, + lpszIcon: ::LPCWSTR, + dwContextHelpId: ::DWORD_PTR, + lpfnMsgBoxCallback: ::MSGBOXCALLBACK, + dwLanguageId: ::DWORD, +}} +pub type PMSGBOXPARAMSW = *mut MSGBOXPARAMSW; +pub type LPMSGBOXPARAMSW = *mut MSGBOXPARAMSW; +STRUCT!{struct HELPINFO { + cbSize: ::UINT, + iContextType: ::c_int, + iCtrlId: ::c_int, + hItemHandle: ::HANDLE, + dwContextId: ::DWORD, + MousePos: ::POINT, +}} +pub type LPHELPINFO = *mut HELPINFO; +#[allow(trivial_numeric_casts)] +pub fn GET_WHEEL_DELTA_WPARAM(wParam: ::WPARAM) -> ::c_short { + ::HIWORD(wParam as ::DWORD) as ::c_short +} +#[allow(trivial_numeric_casts)] +pub fn GET_KEYSTATE_WPARAM(wparam: ::WPARAM) -> ::c_int { + ::LOWORD(wparam as ::DWORD) as ::c_short as ::c_int +} +#[allow(trivial_numeric_casts)] +pub fn GET_XBUTTON_WPARAM(wparam: ::WPARAM) -> ::c_int { + ::HIWORD(wparam as ::DWORD) as ::c_int +} +pub const SIF_RANGE: ::UINT = 0x0001; +pub const SIF_PAGE: ::UINT = 0x0002; +pub const SIF_POS: ::UINT = 0x0004; +pub const SIF_DISABLENOSCROLL: ::UINT = 0x0008; +pub const SIF_TRACKPOS: ::UINT = 0x0010; +pub const SIF_ALL: ::UINT = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS; +pub const SW_SCROLLCHILDREN: ::UINT = 0x0001; +pub const SW_INVALIDATE: ::UINT = 0x0002; +pub const SW_ERASE: ::UINT = 0x0004; +pub const SW_SMOOTHSCROLL: ::UINT = 0x0010; +pub const SB_LINEUP: ::c_int = 0; +pub const SB_LINELEFT: ::c_int = 0; +pub const SB_LINEDOWN: ::c_int = 1; +pub const SB_LINERIGHT: ::c_int = 1; +pub const SB_PAGEUP: ::c_int = 2; +pub const SB_PAGELEFT: ::c_int = 2; +pub const SB_PAGEDOWN: ::c_int = 3; +pub const SB_PAGERIGHT: ::c_int = 3; +pub const SB_THUMBPOSITION: ::c_int = 4; +pub const SB_THUMBTRACK: ::c_int = 5; +pub const SB_TOP: ::c_int = 6; +pub const SB_LEFT: ::c_int = 6; +pub const SB_BOTTOM: ::c_int = 7; +pub const SB_RIGHT: ::c_int = 7; +pub const SB_ENDSCROLL: ::c_int = 8; +pub const LR_DEFAULTCOLOR: ::UINT = 0x00000000; +pub const LR_MONOCHROME: ::UINT = 0x00000001; +pub const LR_COLOR: ::UINT = 0x00000002; +pub const LR_COPYRETURNORG: ::UINT = 0x00000004; +pub const LR_COPYDELETEORG: ::UINT = 0x00000008; +pub const LR_LOADFROMFILE: ::UINT = 0x00000010; +pub const LR_LOADTRANSPARENT: ::UINT = 0x00000020; +pub const LR_DEFAULTSIZE: ::UINT = 0x00000040; +pub const LR_VGACOLOR: ::UINT = 0x00000080; +pub const LR_LOADMAP3DCOLORS: ::UINT = 0x00001000; +pub const LR_CREATEDIBSECTION: ::UINT = 0x00002000; +pub const LR_COPYFROMRESOURCE: ::UINT = 0x00004000; +pub const LR_SHARED: ::UINT = 0x00008000; +pub const IMAGE_BITMAP: ::UINT = 0; +pub const IMAGE_ICON: ::UINT = 1; +pub const IMAGE_CURSOR: ::UINT = 2; +pub const IMAGE_ENHMETAFILE: ::UINT = 3; +pub const DT_TOP: ::UINT = 0x00000000; +pub const DT_LEFT: ::UINT = 0x00000000; +pub const DT_CENTER: ::UINT = 0x00000001; +pub const DT_RIGHT: ::UINT = 0x00000002; +pub const DT_VCENTER: ::UINT = 0x00000004; +pub const DT_BOTTOM: ::UINT = 0x00000008; +pub const DT_WORDBREAK: ::UINT = 0x00000010; +pub const DT_SINGLELINE: ::UINT = 0x00000020; +pub const DT_EXPANDTABS: ::UINT = 0x00000040; +pub const DT_TABSTOP: ::UINT = 0x00000080; +pub const DT_NOCLIP: ::UINT = 0x00000100; +pub const DT_EXTERNALLEADING: ::UINT = 0x00000200; +pub const DT_CALCRECT: ::UINT = 0x00000400; +pub const DT_NOPREFIX: ::UINT = 0x00000800; +pub const DT_INTERNAL: ::UINT = 0x00001000; +pub const DT_EDITCONTROL: ::UINT = 0x00002000; +pub const DT_PATH_ELLIPSIS: ::UINT = 0x00004000; +pub const DT_END_ELLIPSIS: ::UINT = 0x00008000; +pub const DT_MODIFYSTRING: ::UINT = 0x00010000; +pub const DT_RTLREADING: ::UINT = 0x00020000; +pub const DT_WORD_ELLIPSIS: ::UINT = 0x00040000; +pub const DT_NOFULLWIDTHCHARBREAK: ::UINT = 0x00080000; +pub const DT_HIDEPREFIX: ::UINT = 0x00100000; +pub const DT_PREFIXONLY: ::UINT = 0x00200000; +STRUCT!{struct KBDLLHOOKSTRUCT { + vkCode: ::DWORD, + scanCode: ::DWORD, + flags: ::DWORD, + time: ::DWORD, + dwExtraInfo: ::ULONG_PTR, +}} +pub type PKBDLLHOOKSTRUCT = *mut KBDLLHOOKSTRUCT; +pub type LPKBDLLHOOKSTRUCT = *mut KBDLLHOOKSTRUCT; +STRUCT!{struct MSLLHOOKSTRUCT { + pt: ::POINT, + mouseData: ::DWORD, + flags: ::DWORD, + time: ::DWORD, + dwExtraInfo: ::ULONG_PTR, +}} +pub type PMSLLHOOKSTRUCT = *mut MSLLHOOKSTRUCT; +pub type LPMSLLHOOKSTRUCT = *mut MSLLHOOKSTRUCT; +pub const WH_MIN: ::c_int = -1; +pub const WH_MSGFILTER: ::c_int = -1; +pub const WH_JOURNALRECORD: ::c_int = 0; +pub const WH_JOURNALPLAYBACK: ::c_int = 1; +pub const WH_KEYBOARD: ::c_int = 2; +pub const WH_GETMESSAGE: ::c_int = 3; +pub const WH_CALLWNDPROC: ::c_int = 4; +pub const WH_CBT: ::c_int = 5; +pub const WH_SYSMSGFILTER: ::c_int = 6; +pub const WH_MOUSE: ::c_int = 7; +pub const WH_HARDWARE: ::c_int = 8; +pub const WH_DEBUG: ::c_int = 9; +pub const WH_SHELL: ::c_int = 10; +pub const WH_FOREGROUNDIDLE: ::c_int = 11; +pub const WH_CALLWNDPROCRET: ::c_int = 12; +pub const WH_KEYBOARD_LL: ::c_int = 13; +pub const WH_MOUSE_LL: ::c_int = 14; +pub const WH_MAX: ::c_int = 14; +pub const WH_MINHOOK: ::c_int = WH_MIN; +pub const WH_MAXHOOK: ::c_int = WH_MAX; +pub const KLF_ACTIVATE: ::UINT = 1; +pub const KLF_SUBSTITUTE_OK: ::UINT = 2; +pub const KLF_UNLOADPREVIOUS: ::UINT = 4; +pub const KLF_REORDER: ::UINT = 8; +pub const KLF_REPLACELANG: ::UINT = 16; +pub const KLF_NOTELLSHELL: ::UINT = 128; +pub const KLF_SETFORPROCESS: ::UINT = 256; +//RedrawWindow() flags +pub const RDW_INVALIDATE: ::UINT = 0x0001; +pub const RDW_INTERNALPAINT: ::UINT = 0x0002; +pub const RDW_ERASE: ::UINT = 0x0004; +pub const RDW_VALIDATE: ::UINT = 0x0008; +pub const RDW_NOINTERNALPAINT: ::UINT = 0x0010; +pub const RDW_NOERASE: ::UINT = 0x0020; +pub const RDW_NOCHILDREN: ::UINT = 0x0040; +pub const RDW_ALLCHILDREN: ::UINT = 0x0080; +pub const RDW_UPDATENOW: ::UINT = 0x0100; +pub const RDW_ERASENOW: ::UINT = 0x0200; +pub const RDW_FRAME: ::UINT = 0x0400; +pub const RDW_NOFRAME: ::UINT = 0x0800; +STRUCT!{struct MEASUREITEMSTRUCT { + CtlType: ::UINT, + CtlID: ::UINT, + itemID: ::UINT, + itemWidth: ::UINT, + itemHeight: ::UINT, + itemData: ::ULONG_PTR, +}} +pub type LPMEASUREITEMSTRUCT = *mut MEASUREITEMSTRUCT; +STRUCT!{struct DRAWITEMSTRUCT { + CtlType: ::UINT, + CtlID: ::UINT, + itemID: ::UINT, + itemAction: ::UINT, + itemState: ::UINT, + hwndItem: ::HWND, + hDC: ::HDC, + rcItem: ::RECT, + itemData: ::ULONG_PTR, +}} +pub type LPDRAWITEMSTRUCT = *mut DRAWITEMSTRUCT; +STRUCT!{struct DELETEITEMSTRUCT { + CtlType: ::UINT, + CtlID: ::UINT, + itemID: ::UINT, + hwndItem: ::HWND, + itemData: ::ULONG_PTR, +}} +pub type LPDELETEITEMSTRUCT = *mut DELETEITEMSTRUCT; +STRUCT!{struct COMPAREITEMSTRUCT { + CtlType: ::UINT, + CtlID: ::UINT, + hwndItem: ::HWND, + itemID1: ::UINT, + itemData1: ::ULONG_PTR, + itemID2: ::UINT, + itemData2: ::ULONG_PTR, + dwLocaleId: ::DWORD, +}} +pub type LPCOMPAREITEMSTRUCT = *mut COMPAREITEMSTRUCT; +/* Image type */ +pub const DST_COMPLEX: ::UINT = 0x0000; +pub const DST_TEXT: ::UINT = 0x0001; +pub const DST_PREFIXTEXT: ::UINT = 0x0002; +pub const DST_ICON: ::UINT = 0x0003; +pub const DST_BITMAP: ::UINT = 0x0004; +pub const DI_MASK: ::UINT = 0x0001; +pub const DI_IMAGE: ::UINT = 0x0002; +pub const DI_NORMAL: ::UINT = 0x0003; +pub const DI_COMPAT: ::UINT = 0x0004; +pub const DI_DEFAULTSIZE: ::UINT = 0x0008; +// if WINVER >= 0x0601 +// GetSystemMetrics(SM_DIGITIZER) flag values +pub const NID_INTEGRATED_TOUCH: ::UINT = 0x00000001; +pub const NID_EXTERNAL_TOUCH: ::UINT = 0x00000002; +pub const NID_INTEGRATED_PEN: ::UINT = 0x00000004; +pub const NID_EXTERNAL_PEN: ::UINT = 0x00000008; +pub const NID_MULTI_INPUT: ::UINT = 0x00000040; +pub const NID_READY: ::UINT = 0x00000080; +// end if WINVER >= 0x0601 + +// System Menu Command Values +// +pub const SC_SIZE: ::WPARAM = 0xF000; +pub const SC_MOVE: ::WPARAM = 0xF010; +pub const SC_MINIMIZE: ::WPARAM = 0xF020; +pub const SC_MAXIMIZE: ::WPARAM = 0xF030; +pub const SC_NEXTWINDOW: ::WPARAM = 0xF040; +pub const SC_PREVWINDOW: ::WPARAM = 0xF050; +pub const SC_CLOSE: ::WPARAM = 0xF060; +pub const SC_VSCROLL: ::WPARAM = 0xF070; +pub const SC_HSCROLL: ::WPARAM = 0xF080; +pub const SC_MOUSEMENU: ::WPARAM = 0xF090; +pub const SC_KEYMENU: ::WPARAM = 0xF100; +pub const SC_ARRANGE: ::WPARAM = 0xF110; +pub const SC_RESTORE: ::WPARAM = 0xF120; +pub const SC_TASKLIST: ::WPARAM = 0xF130; +pub const SC_SCREENSAVE: ::WPARAM = 0xF140; +pub const SC_HOTKEY: ::WPARAM = 0xF150; +// if WINVER >= 0x0400 +pub const SC_DEFAULT: ::WPARAM = 0xF160; +pub const SC_MONITORPOWER: ::WPARAM = 0xF170; +pub const SC_CONTEXTHELP: ::WPARAM = 0xF180; +pub const SC_SEPARATOR: ::WPARAM = 0xF00F; +// endif WINVER >= 0x0400 diff --git a/third_party/rust/winapi/src/ws2def.rs b/third_party/rust/winapi/src/ws2def.rs new file mode 100644 index 000000000000..dcc4aaa6f115 --- /dev/null +++ b/third_party/rust/winapi/src/ws2def.rs @@ -0,0 +1,279 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! This file contains the core definitions for the Winsock2 specification that can be used by +//! both user-mode and kernel mode modules. +pub type ADDRESS_FAMILY = ::USHORT; +pub const AF_UNSPEC: ::c_int = 0; +pub const AF_UNIX: ::c_int = 1; +pub const AF_INET: ::c_int = 2; +pub const AF_IMPLINK: ::c_int = 3; +pub const AF_PUP: ::c_int = 4; +pub const AF_CHAOS: ::c_int = 5; +pub const AF_NS: ::c_int = 6; +pub const AF_IPX: ::c_int = AF_NS; +pub const AF_ISO: ::c_int = 7; +pub const AF_OSI: ::c_int = AF_ISO; +pub const AF_ECMA: ::c_int = 8; +pub const AF_DATAKIT: ::c_int = 9; +pub const AF_CCITT: ::c_int = 10; +pub const AF_SNA: ::c_int = 11; +pub const AF_DECnet: ::c_int = 12; +pub const AF_DLI: ::c_int = 13; +pub const AF_LAT: ::c_int = 14; +pub const AF_HYLINK: ::c_int = 15; +pub const AF_APPLETALK: ::c_int = 16; +pub const AF_NETBIOS: ::c_int = 17; +pub const AF_VOICEVIEW: ::c_int = 18; +pub const AF_FIREFOX: ::c_int = 19; +pub const AF_UNKNOWN1: ::c_int = 20; +pub const AF_BAN: ::c_int = 21; +pub const AF_ATM: ::c_int = 22; +pub const AF_INET6: ::c_int = 23; +pub const AF_CLUSTER: ::c_int = 24; +pub const AF_12844: ::c_int = 25; +pub const AF_IRDA: ::c_int = 26; +pub const AF_NETDES: ::c_int = 28; +pub const AF_TCNPROCESS: ::c_int = 29; +pub const AF_TCNMESSAGE: ::c_int = 30; +pub const AF_ICLFXBM: ::c_int = 31; +pub const AF_BTH: ::c_int = 32; +pub const AF_LINK: ::c_int = 33; +pub const AF_MAX: ::c_int = 34; +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_RAW: ::c_int = 3; +pub const SOCK_RDM: ::c_int = 4; +pub const SOCK_SEQPACKET: ::c_int = 5; +pub const SOL_SOCKET: ::c_int = 0xffff; +pub const SO_DEBUG: ::c_int = 0x0001; +pub const SO_ACCEPTCONN: ::c_int = 0x0002; +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_USELOOPBACK: ::c_int = 0x0040; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_OOBINLINE: ::c_int = 0x0100; +pub const SO_DONTLINGER: ::c_int = !SO_LINGER; +pub const SO_EXCLUSIVEADDRUSE: ::c_int = !SO_REUSEADDR; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDLOWAT: ::c_int = 0x1003; +pub const SO_RCVLOWAT: ::c_int = 0x1004; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_TYPE: ::c_int = 0x1008; +pub const SO_BSP_STATE: ::c_int = 0x1009; +pub const SO_GROUP_ID: ::c_int = 0x2001; +pub const SO_GROUP_PRIORITY: ::c_int = 0x2002; +pub const SO_MAX_MSG_SIZE: ::c_int = 0x2003; +pub const SO_CONDITIONAL_ACCEPT: ::c_int = 0x3002; +pub const SO_PAUSE_ACCEPT: ::c_int = 0x3003; +pub const SO_COMPARTMENT_ID: ::c_int = 0x3004; +pub const SO_RANDOMIZE_PORT: ::c_int = 0x3005; +pub const SO_PORT_SCALABILITY: ::c_int = 0x3006; +pub const WSK_SO_BASE: ::c_int = 0x4000; +pub const TCP_NODELAY: ::c_int = 0x0001; +STRUCT!{struct SOCKADDR { + sa_family: ADDRESS_FAMILY, + sa_data: [::CHAR; 14], +}} +pub type PSOCKADDR = *mut SOCKADDR; +pub type LPSOCKADDR = *mut SOCKADDR; +STRUCT!{struct SOCKET_ADDRESS { + lpSockaddr: LPSOCKADDR, + iSockaddrLength: ::INT, +}} +pub type PSOCKET_ADDRESS = *mut SOCKET_ADDRESS; +pub type LPSOCKET_ADDRESS = *mut SOCKET_ADDRESS; +STRUCT!{nodebug struct SOCKET_ADDRESS_LIST { + iAddressCount: ::INT, + Address: [SOCKET_ADDRESS; 0], +}} +pub type PSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; +pub type LPSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; +STRUCT!{struct CSADDR_INFO { + LocalAddr: SOCKET_ADDRESS, + RemoteAddr: SOCKET_ADDRESS, + iSocketType: ::INT, + iProtocol: ::INT, +}} +pub type PCSADDR_INFO = *mut CSADDR_INFO; +pub type LPCSADDR_INFO = *mut CSADDR_INFO; +STRUCT!{nodebug struct SOCKADDR_STORAGE_LH { + ss_family: ADDRESS_FAMILY, + __ss_pad1: [::CHAR; 6], + __ss_align: ::__int64, + __ss_pad2: [::CHAR; 112], +}} +pub type PSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; +pub type LPSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; +STRUCT!{nodebug struct SOCKADDR_STORAGE_XP { + ss_family: ::c_short, + __ss_pad1: [::CHAR; 6], + __ss_align: ::__int64, + __ss_pad2: [::CHAR; 112], +}} +pub type PSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; +pub type LPSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; +pub type SOCKADDR_STORAGE = SOCKADDR_STORAGE_LH; +pub type PSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; +pub type LPSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; +STRUCT!{struct SOCKET_PROCESSOR_AFFINITY { + Processor: ::PROCESSOR_NUMBER, + NumaNodeId: ::USHORT, + Reserved: ::USHORT, +}} +pub type PSOCKET_PROCESSOR_AFFINITY = *mut SOCKET_PROCESSOR_AFFINITY; +pub const IOC_UNIX: ::DWORD = 0x00000000; +pub const IOC_WS2: ::DWORD = 0x08000000; +pub const IOC_PROTOCOL: ::DWORD = 0x10000000; +pub const IOC_VENDOR: ::DWORD = 0x18000000; +pub const IOC_WSK: ::DWORD = IOC_WS2 | 0x07000000; +macro_rules! _WSAIO { ($x:expr, $y:expr) => { IOC_VOID | $x | $y } } +macro_rules! _WSAIOR { ($x:expr, $y:expr) => { IOC_OUT | $x | $y } } +macro_rules! _WSAIOW { ($x:expr, $y:expr) => { IOC_IN | $x | $y } } +macro_rules! _WSAIORW { ($x:expr, $y:expr) => { IOC_INOUT | $x | $y } } +pub const SIO_ASSOCIATE_HANDLE: ::DWORD = _WSAIOW!(IOC_WS2, 1); +pub const SIO_ENABLE_CIRCULAR_QUEUEING: ::DWORD = _WSAIO!(IOC_WS2, 2); +pub const SIO_FIND_ROUTE: ::DWORD = _WSAIOR!(IOC_WS2, 3); +pub const SIO_FLUSH: ::DWORD = _WSAIO!(IOC_WS2, 4); +pub const SIO_GET_BROADCAST_ADDRESS: ::DWORD = _WSAIOR!(IOC_WS2, 5); +pub const SIO_GET_EXTENSION_FUNCTION_POINTER: ::DWORD = _WSAIORW!(IOC_WS2, 6); +pub const SIO_GET_QOS: ::DWORD = _WSAIORW!(IOC_WS2, 7); +pub const SIO_GET_GROUP_QOS: ::DWORD = _WSAIORW!(IOC_WS2, 8); +pub const SIO_MULTIPOINT_LOOPBACK: ::DWORD = _WSAIOW!(IOC_WS2, 9); +pub const SIO_MULTICAST_SCOPE: ::DWORD = _WSAIOW!(IOC_WS2, 10); +pub const SIO_SET_QOS: ::DWORD = _WSAIOW!(IOC_WS2, 11); +pub const SIO_SET_GROUP_QOS: ::DWORD = _WSAIOW!(IOC_WS2, 12); +pub const SIO_TRANSLATE_HANDLE: ::DWORD = _WSAIORW!(IOC_WS2, 13); +pub const SIO_ROUTING_INTERFACE_QUERY: ::DWORD = _WSAIORW!(IOC_WS2, 20); +pub const SIO_ROUTING_INTERFACE_CHANGE: ::DWORD = _WSAIOW!(IOC_WS2, 21); +pub const SIO_ADDRESS_LIST_QUERY: ::DWORD = _WSAIOR!(IOC_WS2, 22); +pub const SIO_ADDRESS_LIST_CHANGE: ::DWORD = _WSAIO!(IOC_WS2, 23); +pub const SIO_QUERY_TARGET_PNP_HANDLE: ::DWORD = _WSAIOR!(IOC_WS2, 24); +pub const SIO_QUERY_RSS_PROCESSOR_INFO: ::DWORD = _WSAIOR!(IOC_WS2, 37); +pub const SIO_ADDRESS_LIST_SORT: ::DWORD = _WSAIORW!(IOC_WS2, 25); +pub const SIO_RESERVED_1: ::DWORD = _WSAIOW!(IOC_WS2, 26); +pub const SIO_RESERVED_2: ::DWORD = _WSAIOW!(IOC_WS2, 33); +pub const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER: ::DWORD = _WSAIORW!(IOC_WS2, 36); +pub const IPPROTO_IP: ::c_int = 0; +ENUM!{enum IPPROTO { + IPPROTO_HOPOPTS = 0, // IPv6 Hop-by-Hop options + IPPROTO_ICMP = 1, + IPPROTO_IGMP = 2, + IPPROTO_GGP = 3, + IPPROTO_IPV4 = 4, + IPPROTO_ST = 5, + IPPROTO_TCP = 6, + IPPROTO_CBT = 7, + IPPROTO_EGP = 8, + IPPROTO_IGP = 9, + IPPROTO_PUP = 12, + IPPROTO_UDP = 17, + IPPROTO_IDP = 22, + IPPROTO_RDP = 27, + IPPROTO_IPV6 = 41, // IPv6 header + IPPROTO_ROUTING = 43, // IPv6 Routing header + IPPROTO_FRAGMENT = 44, // IPv6 fragmentation header + IPPROTO_ESP = 50, // encapsulating security payload + IPPROTO_AH = 51, // authentication header + IPPROTO_ICMPV6 = 58, // ICMPv6 + IPPROTO_NONE = 59, // IPv6 no next header + IPPROTO_DSTOPTS = 60, // IPv6 Destination options + IPPROTO_ND = 77, + IPPROTO_ICLFXBM = 78, + IPPROTO_PIM = 103, + IPPROTO_PGM = 113, + IPPROTO_L2TP = 115, + IPPROTO_SCTP = 132, + IPPROTO_RAW = 255, + IPPROTO_MAX = 256, + IPPROTO_RESERVED_RAW = 257, + IPPROTO_RESERVED_IPSEC = 258, + IPPROTO_RESERVED_IPSECOFFLOAD = 259, + IPPROTO_RESERVED_WNV = 260, + IPPROTO_RESERVED_MAX = 261, +}} +pub type PIPPROTO = *mut IPPROTO; +STRUCT!{struct SOCKADDR_IN { + sin_family: ADDRESS_FAMILY, + sin_port: ::USHORT, + sin_addr: ::IN_ADDR, + sin_zero: [::CHAR; 8], +}} +pub type PSOCKADDR_IN = *mut SOCKADDR_IN; +//645 +pub const IOCPARM_MASK: ::DWORD = 0x7f; +pub const IOC_VOID: ::DWORD = 0x20000000; +pub const IOC_OUT: ::DWORD = 0x40000000; +pub const IOC_IN: ::DWORD = 0x80000000; +pub const IOC_INOUT: ::DWORD = IOC_IN | IOC_OUT; +STRUCT!{struct WSABUF { + len: ::ULONG, + buf: *mut ::CHAR, +}} +pub type LPWSABUF = *mut WSABUF; +STRUCT!{struct WSAMSG { + name: LPSOCKADDR, + namelen: ::INT, + lpBuffers: LPWSABUF, + dwBufferCount: ::ULONG, + Control: WSABUF, + dwFlags: ::ULONG, +}} +pub type PWSAMSG = *mut WSAMSG; +pub type LPWSAMSG = *mut WSAMSG; +STRUCT!{struct ADDRINFOA { + ai_flags: ::c_int, + ai_family: ::c_int, + ai_socktype: ::c_int, + ai_protocol: ::c_int, + ai_addrlen: ::size_t, + ai_canonname: *mut ::c_char, + ai_addr: *mut SOCKADDR, + ai_next: *mut ADDRINFOA, +}} +pub type PADDRINFOA = *mut ADDRINFOA; +STRUCT!{struct ADDRINFOW { + ai_flags: ::c_int, + ai_family: ::c_int, + ai_socktype: ::c_int, + ai_protocol: ::c_int, + ai_addrlen: ::size_t, + ai_canonname: ::PWSTR, + ai_addr: *mut SOCKADDR, + ai_next: *mut ADDRINFOW, +}} +pub type PADDRINFOW = *mut ADDRINFOW; +STRUCT!{struct ADDRINFOEXA { + ai_flags: ::c_int, + ai_family: ::c_int, + ai_socktype: ::c_int, + ai_protocol: ::c_int, + ai_addrlen: ::size_t, + ai_canonname: *mut ::c_char, + ai_addr: *mut SOCKADDR, + ai_blob: *mut ::c_void, + ai_bloblen: ::size_t, + ai_provider: ::LPGUID, + ai_next: *mut ADDRINFOEXW, +}} +pub type PADDRINFOEXA = *mut ADDRINFOEXA; +pub type LPADDRINFOEXA = *mut ADDRINFOEXA; +STRUCT!{struct ADDRINFOEXW { + ai_flags: ::c_int, + ai_family: ::c_int, + ai_socktype: ::c_int, + ai_protocol: ::c_int, + ai_addrlen: ::size_t, + ai_canonname: ::PWSTR, + ai_addr: *mut SOCKADDR, + ai_blob: *mut ::c_void, + ai_bloblen: ::size_t, + ai_provider: ::LPGUID, + ai_next: *mut ADDRINFOEXW, +}} +pub type PADDRINFOEXW = *mut ADDRINFOEXW; +pub type LPADDRINFOEXW = *mut ADDRINFOEXW; diff --git a/third_party/rust/winapi/src/ws2ipdef.rs b/third_party/rust/winapi/src/ws2ipdef.rs new file mode 100644 index 000000000000..86d3ffae2960 --- /dev/null +++ b/third_party/rust/winapi/src/ws2ipdef.rs @@ -0,0 +1,42 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +pub const IPV6_HOPOPTS: ::c_int = 1; +pub const IPV6_HDRINCL: ::c_int = 2; +pub const IPV6_UNICAST_HOPS: ::c_int = 4; +pub const IPV6_MULTICAST_IF: ::c_int = 9; +pub const IPV6_MULTICAST_HOPS: ::c_int = 10; +pub const IPV6_MULTICAST_LOOP: ::c_int = 11; +pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12; +pub const IPV6_JOIN_GROUP: ::c_int = IPV6_ADD_MEMBERSHIP; +pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13; +pub const IPV6_LEAVE_GROUP: ::c_int = IPV6_DROP_MEMBERSHIP; +pub const IPV6_DONTFRAG: ::c_int = 14; +pub const IPV6_PKTINFO: ::c_int = 19; +pub const IPV6_HOPLIMIT: ::c_int = 21; +pub const IPV6_PROTECTION_LEVEL: ::c_int = 23; +pub const IPV6_RECVIF: ::c_int = 24; +pub const IPV6_RECVDSTADDR: ::c_int = 25; +pub const IPV6_CHECKSUM: ::c_int = 26; +pub const IPV6_V6ONLY: ::c_int = 27; +pub const IPV6_IFLIST: ::c_int = 28; +pub const IPV6_ADD_IFLIST: ::c_int = 29; +pub const IPV6_DEL_IFLIST: ::c_int = 30; +pub const IPV6_UNICAST_IF: ::c_int = 31; +pub const IPV6_RTHDR: ::c_int = 32; +pub const IPV6_RECVRTHDR: ::c_int = 38; +pub const IPV6_TCLASS: ::c_int = 39; +pub const IPV6_RECVTCLASS: ::c_int = 40; +STRUCT!{struct ipv6_mreq { + ipv6mr_multiaddr: in6_addr, + ipv6mr_interface: ::c_uint, +}} +STRUCT!{struct in6_addr { + s6_addr: [u8; 16], +}} +STRUCT!{struct sockaddr_in6 { + sin6_family: ::c_short, + sin6_port: ::c_ushort, + sin6_flowinfo: ::c_ulong, + sin6_addr: in6_addr, + sin6_scope_id: ::c_ulong, +}} diff --git a/third_party/rust/winapi/src/ws2spi.rs b/third_party/rust/winapi/src/ws2spi.rs new file mode 100644 index 000000000000..9df67c191e99 --- /dev/null +++ b/third_party/rust/winapi/src/ws2spi.rs @@ -0,0 +1,57 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! Definitions to be used with the WinSock service provider +pub const WSPDESCRIPTION_LEN: usize = 255; +STRUCT!{nodebug struct WSPDATA { + wVersion: ::WORD, + wHighVersion: ::WORD, + szDescription: [::WCHAR; WSPDESCRIPTION_LEN + 1], +}} +pub type LPWSPDATA = *mut WSPDATA; +STRUCT!{struct WSATHREADID { + ThreadHandle: ::HANDLE, + Reserved: ::DWORD_PTR, +}} +pub type LPWSATHREADID = *mut WSATHREADID; +pub type LPNSPV2STARTUP = Option ::INT>; +pub type LPNSPV2CLEANUP = Option ::INT>; +pub type LPNSPV2LOOKUPSERVICEBEGIN = Option ::INT>; +pub type LPNSPV2LOOKUPSERVICENEXTEX = Option; +pub type LPNSPV2LOOKUPSERVICEEND = Option ::INT>; +pub type LPNSPV2SETSERVICEEX = Option; +pub type LPNSPV2CLIENTSESSIONRUNDOWN = Option; +STRUCT!{nodebug struct NSPV2_ROUTINE { + cbSize: ::DWORD, + dwMajorVersion: ::DWORD, + dwMinorVersion: ::DWORD, + NSPv2Startup: LPNSPV2STARTUP, + NSPv2Cleanup: LPNSPV2CLEANUP, + NSPv2LookupServiceBegin: LPNSPV2LOOKUPSERVICEBEGIN, + NSPv2LookupServiceNextEx: LPNSPV2LOOKUPSERVICENEXTEX, + NSPv2LookupServiceEnd: LPNSPV2LOOKUPSERVICEEND, + NSPv2SetServiceEx: LPNSPV2SETSERVICEEX, + NSPv2ClientSessionRundown: LPNSPV2CLIENTSESSIONRUNDOWN, +}} +pub type PNSPV2_ROUTINE = *mut NSPV2_ROUTINE; +pub type LPNSPV2_ROUTINE = *mut NSPV2_ROUTINE; +pub type PCNSPV2_ROUTINE = *const NSPV2_ROUTINE; +pub type LPCNSPV2_ROUTINE = *const NSPV2_ROUTINE; +ENUM!{enum WSC_PROVIDER_INFO_TYPE { + ProviderInfoLspCategories, + ProviderInfoAudit, +}} diff --git a/third_party/rust/winapi/src/ws2tcpip.rs b/third_party/rust/winapi/src/ws2tcpip.rs new file mode 100644 index 000000000000..d60c84178c35 --- /dev/null +++ b/third_party/rust/winapi/src/ws2tcpip.rs @@ -0,0 +1,27 @@ +// Copyright © 2015, skdltmxn +// Licensed under the MIT License +//! WinSock2 Extension for TCP/IP protocols +pub type LPLOOKUPSERVICE_COMPLETION_ROUTINE = Option; +pub type socklen_t = ::c_int; +STRUCT!{struct ip_mreq { + imr_multiaddr: ::in_addr, + imr_interface: ::in_addr, +}} +pub const IP_OPTIONS: ::c_int = 1; +pub const IP_HDRINCL: ::c_int = 2; +pub const IP_TOS: ::c_int = 3; +pub const IP_TTL: ::c_int = 4; +pub const IP_MULTICAST_IF: ::c_int = 9; +pub const IP_MULTICAST_TTL: ::c_int = 10; +pub const IP_MULTICAST_LOOP: ::c_int = 11; +pub const IP_ADD_MEMBERSHIP: ::c_int = 12; +pub const IP_DROP_MEMBERSHIP: ::c_int = 13; +pub const IP_DONTFRAGMENT: ::c_int = 14; +pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 15; +pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 16; +pub const IP_BLOCK_SOURCE: ::c_int = 17; +pub const IP_UNBLOCK_SOURCE: ::c_int = 18; +pub const IP_PKTINFO: ::c_int = 19; +pub const IP_RECEIVE_BROADCAST: ::c_int = 22; diff --git a/third_party/rust/winapi/src/wtypes.rs b/third_party/rust/winapi/src/wtypes.rs new file mode 100644 index 000000000000..36c8059ac8d6 --- /dev/null +++ b/third_party/rust/winapi/src/wtypes.rs @@ -0,0 +1,75 @@ +// Copyright © 2015, Connor Hilarides +// Licensed under the MIT License +//! Mappings for the contents of wstypes.h +ENUM!{enum VARENUM { + VT_EMPTY = 0, + VT_NULL = 1, + VT_I2 = 2, + VT_I4 = 3, + VT_R4 = 4, + VT_R8 = 5, + VT_CY = 6, + VT_DATE = 7, + VT_BSTR = 8, + VT_DISPATCH = 9, + VT_ERROR = 10, + VT_BOOL = 11, + VT_VARIANT = 12, + VT_UNKNOWN = 13, + VT_DECIMAL = 14, + VT_I1 = 16, + VT_UI1 = 17, + VT_UI2 = 18, + VT_UI4 = 19, + VT_I8 = 20, + VT_UI8 = 21, + VT_INT = 22, + VT_UINT = 23, + VT_VOID = 24, + VT_HRESULT = 25, + VT_PTR = 26, + VT_SAFEARRAY = 27, + VT_CARRAY = 28, + VT_USERDEFINED = 29, + VT_LPSTR = 30, + VT_LPWSTR = 31, + VT_RECORD = 36, + VT_INT_PTR = 37, + VT_UINT_PTR = 38, + VT_FILETIME = 64, + VT_BLOB = 65, + VT_STREAM = 66, + VT_STORAGE = 67, + VT_STREAMED_OBJECT = 68, + VT_STORED_OBJECT = 69, + VT_BLOB_OBJECT = 70, + VT_CF = 71, + VT_CLSID = 72, + VT_VERSIONED_STREAM = 73, + VT_BSTR_BLOB = 0xfff, + VT_VECTOR = 0x1000, + VT_ARRAY = 0x2000, + VT_BYREF = 0x4000, + VT_RESERVED = 0x8000, + VT_ILLEGAL = 0xffff, +}} +pub const VT_ILLEGALMASKED: VARENUM = VT_BSTR_BLOB; +pub const VT_TYPEMASK: VARENUM = VT_BSTR_BLOB; +pub type DATE = ::c_double; +STRUCT!{struct CY { + int64: ::LONGLONG, +}} +STRUCT!{struct DECIMAL { + wReserved: ::USHORT, + scale: ::BYTE, + sign: ::BYTE, + Hi32: ::ULONG, + Lo64: ::ULONGLONG, +}} +pub const DECIMAL_NEG: ::BYTE = 0x80; +pub type LPDECIMAL = *mut DECIMAL; +pub type VARTYPE = ::c_ushort; +pub type wireBSTR = *mut ::FLAGGED_WORD_BLOB; +pub type BSTR = *mut ::OLECHAR; +pub type LPBSTR = *mut BSTR; +pub type VARIANT_BOOL = ::c_short; diff --git a/third_party/rust/winapi/src/wtypesbase.rs b/third_party/rust/winapi/src/wtypesbase.rs new file mode 100644 index 000000000000..8683c53813ed --- /dev/null +++ b/third_party/rust/winapi/src/wtypesbase.rs @@ -0,0 +1,37 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//114 +pub type OLECHAR = ::WCHAR; +pub type LPOLESTR = *mut OLECHAR; +pub type LPCOLESTR = *const OLECHAR; +//147 +pub type DOUBLE = ::c_double; +//281 +pub type SCODE = ::LONG; +pub type PSCODE = *mut SCODE; +STRUCT!{struct BLOB { + cbSize: ::ULONG, + pBlobData: *mut ::BYTE, +}} +pub type LPBLOB = *mut BLOB; +STRUCT!{struct FLAGGED_WORD_BLOB { + fFlags: ::ULONG, + clSize: ::ULONG, + asData: [::c_ushort; 1], +}} +STRUCT!{struct BYTE_SIZEDARR { + clSize: ::ULONG, + pData: *mut ::BYTE, +}} +STRUCT!{struct WORD_SIZEDARR { + clSize: ::ULONG, + pData: *mut ::c_ushort, +}} +STRUCT!{struct DWORD_SIZEDARR { + clSize: ::ULONG, + pData: *mut ::ULONG, +}} +STRUCT!{struct HYPER_SIZEDARR { + clSize: ::ULONG, + pData: *mut i64, +}} diff --git a/third_party/rust/winapi/src/xinput.rs b/third_party/rust/winapi/src/xinput.rs new file mode 100644 index 000000000000..d18d4659aaab --- /dev/null +++ b/third_party/rust/winapi/src/xinput.rs @@ -0,0 +1,118 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! XInput procedure declarations, constant definitions and macros +pub const XINPUT_DEVTYPE_GAMEPAD: ::BYTE = 0x01; +pub const XINPUT_DEVSUBTYPE_GAMEPAD: ::BYTE = 0x01; +pub const XINPUT_DEVSUBTYPE_WHEEL: ::BYTE = 0x02; +pub const XINPUT_DEVSUBTYPE_ARCADE_STICK: ::BYTE = 0x03; +pub const XINPUT_DEVSUBTYPE_FLIGHT_SICK: ::BYTE = 0x04; +pub const XINPUT_DEVSUBTYPE_DANCE_PAD: ::BYTE = 0x05; +pub const XINPUT_DEVSUBTYPE_GUITAR: ::BYTE = 0x06; +pub const XINPUT_DEVSUBTYPE_DRUM_KIT: ::BYTE = 0x08; +pub const XINPUT_CAPS_VOICE_SUPPORTED: ::WORD = 0x0004; +pub const XINPUT_GAMEPAD_DPAD_UP: ::WORD = 0x0001; +pub const XINPUT_GAMEPAD_DPAD_DOWN: ::WORD = 0x0002; +pub const XINPUT_GAMEPAD_DPAD_LEFT: ::WORD = 0x0004; +pub const XINPUT_GAMEPAD_DPAD_RIGHT: ::WORD = 0x0008; +pub const XINPUT_GAMEPAD_START: ::WORD = 0x0010; +pub const XINPUT_GAMEPAD_BACK: ::WORD = 0x0020; +pub const XINPUT_GAMEPAD_LEFT_THUMB: ::WORD = 0x0040; +pub const XINPUT_GAMEPAD_RIGHT_THUMB: ::WORD = 0x0080; +pub const XINPUT_GAMEPAD_LEFT_SHOULDER: ::WORD = 0x0100; +pub const XINPUT_GAMEPAD_RIGHT_SHOULDER: ::WORD = 0x0200; +pub const XINPUT_GAMEPAD_A: ::WORD = 0x1000; +pub const XINPUT_GAMEPAD_B: ::WORD = 0x2000; +pub const XINPUT_GAMEPAD_X: ::WORD = 0x4000; +pub const XINPUT_GAMEPAD_Y: ::WORD = 0x8000; +pub const XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE: ::SHORT = 7849; +pub const XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE: ::SHORT = 8689; +pub const XINPUT_GAMEPAD_TRIGGER_THRESHOLD: ::BYTE = 30; +pub const XINPUT_FLAG_GAMEPAD: ::DWORD = 0x00000001; +pub const BATTERY_DEVTYPE_GAMEPAD: ::BYTE = 0x00; +pub const BATTERY_DEVTYPE_HEADSET: ::BYTE = 0x01; +pub const BATTERY_TYPE_DISCONNECTED: ::BYTE = 0x00; +pub const BATTERY_TYPE_WIRED: ::BYTE = 0x01; +pub const BATTERY_TYPE_ALKALINE: ::BYTE = 0x02; +pub const BATTERY_TYPE_NIMH: ::BYTE = 0x03; +pub const BATTERY_TYPE_UNKNOWN: ::BYTE = 0xFF; +pub const BATTERY_LEVEL_EMPTY: ::BYTE = 0x00; +pub const BATTERY_LEVEL_LOW: ::BYTE = 0x01; +pub const BATTERY_LEVEL_MEDIUM: ::BYTE = 0x02; +pub const BATTERY_LEVEL_FULL: ::BYTE = 0x03; +pub const XUSER_MAX_COUNT: ::DWORD = 4; +pub const XUSER_INDEX_ANY: ::DWORD = 0x000000FF; +pub const VK_PAD_A: ::WORD = 0x5800; +pub const VK_PAD_B: ::WORD = 0x5801; +pub const VK_PAD_X: ::WORD = 0x5802; +pub const VK_PAD_Y: ::WORD = 0x5803; +pub const VK_PAD_RSHOULDER: ::WORD = 0x5804; +pub const VK_PAD_LSHOULDER: ::WORD = 0x5805; +pub const VK_PAD_LTRIGGER: ::WORD = 0x5806; +pub const VK_PAD_RTRIGGER: ::WORD = 0x5807; +pub const VK_PAD_DPAD_UP: ::WORD = 0x5810; +pub const VK_PAD_DPAD_DOWN: ::WORD = 0x5811; +pub const VK_PAD_DPAD_LEFT: ::WORD = 0x5812; +pub const VK_PAD_DPAD_RIGHT: ::WORD = 0x5813; +pub const VK_PAD_START: ::WORD = 0x5814; +pub const VK_PAD_BACK: ::WORD = 0x5815; +pub const VK_PAD_LTHUMB_PRESS: ::WORD = 0x5816; +pub const VK_PAD_RTHUMB_PRESS: ::WORD = 0x5817; +pub const VK_PAD_LTHUMB_UP: ::WORD = 0x5820; +pub const VK_PAD_LTHUMB_DOWN: ::WORD = 0x5821; +pub const VK_PAD_LTHUMB_RIGHT: ::WORD = 0x5822; +pub const VK_PAD_LTHUMB_LEFT: ::WORD = 0x5823; +pub const VK_PAD_LTHUMB_UPLEFT: ::WORD = 0x5824; +pub const VK_PAD_LTHUMB_UPRIGHT: ::WORD = 0x5825; +pub const VK_PAD_LTHUMB_DOWNRIGHT: ::WORD = 0x5826; +pub const VK_PAD_LTHUMB_DOWNLEFT: ::WORD = 0x5827; +pub const VK_PAD_RTHUMB_UP: ::WORD = 0x5830; +pub const VK_PAD_RTHUMB_DOWN: ::WORD = 0x5831; +pub const VK_PAD_RTHUMB_RIGHT: ::WORD = 0x5832; +pub const VK_PAD_RTHUMB_LEFT: ::WORD = 0x5833; +pub const VK_PAD_RTHUMB_UPLEFT: ::WORD = 0x5834; +pub const VK_PAD_RTHUMB_UPRIGHT: ::WORD = 0x5835; +pub const VK_PAD_RTHUMB_DOWNRIGHT: ::WORD = 0x5836; +pub const VK_PAD_RTHUMB_DOWNLEFT: ::WORD = 0x5837; +pub const XINPUT_KEYSTROKE_KEYDOWN: ::WORD = 0x0001; +pub const XINPUT_KEYSTROKE_KEYUP: ::WORD = 0x0002; +pub const XINPUT_KEYSTROKE_REPEAT: ::WORD = 0x0004; +STRUCT!{struct XINPUT_GAMEPAD { + wButtons: ::WORD, + bLeftTrigger: ::BYTE, + bRightTrigger: ::BYTE, + sThumbLX: ::SHORT, + sThumbLY: ::SHORT, + sThumbRX: ::SHORT, + sThumbRY: ::SHORT, +}} +pub type PXINPUT_GAMEPAD = *mut XINPUT_GAMEPAD; +STRUCT!{struct XINPUT_STATE { + dwPacketNumber: ::DWORD, + Gamepad: ::XINPUT_GAMEPAD, +}} +pub type PXINPUT_STATE = *mut XINPUT_STATE; +STRUCT!{struct XINPUT_VIBRATION { + wLeftMotorSpeed: ::WORD, + wRightMotorSpeed: ::WORD, +}} +pub type PXINPUT_VIBRATION = *mut XINPUT_VIBRATION; +STRUCT!{struct XINPUT_CAPABILITIES { + Type: ::BYTE, + SubType: ::BYTE, + Flags: ::WORD, + Gamepad: ::XINPUT_GAMEPAD, + Vibration: ::XINPUT_VIBRATION, +}} +pub type PXINPUT_CAPABILITIES = *mut XINPUT_CAPABILITIES; +STRUCT!{struct XINPUT_BATTERY_INFORMATION { + BatteryType: ::BYTE, + BatteryLevel: ::BYTE, +}} +pub type PXINPUT_BATTERY_INFORMATION = *mut XINPUT_BATTERY_INFORMATION; +STRUCT!{struct XINPUT_KEYSTROKE { + VirtualKey: ::WORD, + Unicode: ::WCHAR, + UserIndex: ::BYTE, + HidCode: ::BYTE, +}} +pub type PXINPUT_KEYSTROKE = *mut XINPUT_KEYSTROKE; diff --git a/third_party/rust/x11/.cargo-checksum.json b/third_party/rust/x11/.cargo-checksum.json new file mode 100644 index 000000000000..a2601ef942ff --- /dev/null +++ b/third_party/rust/x11/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"51a03803afe9ea2446fcd62bbf9ba678628b1dfdf1a56464dfd2ed8a8d017327","build.rs":"c4ec61284fcbf2d836d9b42e86b013baf168c14058632b7c3d676139157e484b","examples/hello-world.rs":"0fc60afb6ba41930e0e74fc31b835faa771b06eb70314cdd9a07e05204b1b389","examples/input.rs":"18a254cbd92871c1c27edf420ff29eb02e0dd6eb744ecbb8dbebcd590780b96a","examples/xrecord.rs":"d2458011f4ee170db613d5effa483f51ac56bceab7f25c44eee4cb22c1863207","src/dpms.rs":"77cb9237a0262350bf6553e40d6cc9e97a599bca089a457ef87c57c9b9cf6194","src/glx.rs":"f41af4853dadc3fbf5154c8a8108505123118ddd8e8d9c6122ed1cd2ffda4262","src/internal.rs":"9e1f269e36e6a92325be4f5e67185d60c12e4a74b98c454759c0161325d0d1e4","src/keysym.rs":"4d65901072224729fe18fb5c815242e51e75a34c1dfc88e5ac1cea19e8a423a8","src/lib.rs":"49ad75828478d09a2f0aceb7effe61fecea9785285cd17d8622b924e88740c5a","src/link.rs":"5a6f63372091daf218d27d55e8ab5775ccf591e50c532c4c442acdf2b64136a9","src/xcursor.rs":"3dafa1d232321eb35e1c1a3e5cf0677ab9fd273a2b97799a4a6fc20dc546522e","src/xf86vmode.rs":"98f074fade0d0c6e063644f6a9f8720c12f9533c01722ff83ca77ed11b61b9ce","src/xfixes.rs":"cc2a1681415c3d2d32331dd610567376b6eaa5f42d58b8940a1ff1d765d9cc85","src/xft.rs":"1d5ff70c95b3c5d339903ea347e4436e226bfd2c2990fd5b476472c1a6aedba0","src/xinerama.rs":"13f9007d027e081169a22a3ad3fd9fd2a78bdcd831489a654e22e7a6a7e4bde5","src/xinput.rs":"84f79c8eb57a8feff5897d282479d4535e3ea17876871caee93879818157d674","src/xinput2.rs":"413ee38d11c340ab9dd12a9cb95f6746df8bb158f1201cb7e9b9ec6f0aeabd42","src/xlib.rs":"d332108571a727027205a0e300a9d87543c95be8e1ce1c6cb21b81f70a67bab6","src/xlib_xcb.rs":"71ee6274e261bb8f0b82ea260afffa9273531f0f87df9541152412b88aff468f","src/xmd.rs":"149c818c19e90a14c8f60016cd18a04d0de4fd702fc5df89e5283f6ee1ce4852","src/xmu.rs":"262df634c584dac47d0d898dd75b6b2de7c4256b9b494cf89123d8279dad3020","src/xrandr.rs":"78315519ceb035358f0f331770371528b540016f49a26c41ae22fb3c05a52e89","src/xrecord.rs":"8339eea0b42c2206444d98ac35e2ca9df82fb666dca9e942970155e324213e93","src/xrender.rs":"7883ea45cf2bde0f8dc7593b1011737f2b8ecb0745e1364c72adf7462751dabe","src/xss.rs":"313df0898df612afc8bdf7a5c475679a5dfa011a377b48f1bf7a5572dc414bc5","src/xt.rs":"fa2324391a91387f44eeee6742c50676329f08d941d002ff70d4eb99f36af7bc","src/xtest.rs":"dcd0eb130ffb3cf96165d1699d6b625649c28ed819036a85b5f175c2a3479918"},"package":"124eb405bf0262a54e1a982d4ffe4cd1c24261bdb306e49996e2ce7d492284a8"} \ No newline at end of file diff --git a/third_party/rust/x11/.cargo-ok b/third_party/rust/x11/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/x11/Cargo.toml b/third_party/rust/x11/Cargo.toml new file mode 100644 index 000000000000..237782d33897 --- /dev/null +++ b/third_party/rust/x11/Cargo.toml @@ -0,0 +1,52 @@ +[package] +name = "x11" +version = "2.12.1" +authors = ["Daggerbot "] +description = "X11 library bindings for Rust" +license = "CC0-1.0" +repository = "https://github.com/Daggerbot/x11-rs.git" +build = "build.rs" +documentation = "https://docs.rs/x11" +workspace = ".." + +[features] +dpms = [] +glx = [] +xcursor = [] +xf86vmode = [] +xft = [] +xinerama = [] +xinput = [] +xlib = [] +xlib_xcb = [] +xmu = [] +xrandr = [] +xrecord = ["xtst"] +xrender = [] +xss = [] +xt = [] +xtest = ["xtst"] +xtst = [] + +[dependencies] +libc = "0.2" + +[build-dependencies] +metadeps = "1.1" + +[package.metadata.pkg-config] +gl = { version = "1", feature = "glx" } +x11 = { version = "1.4.99.1", feature = "xlib" } +x11-xcb = { version = "1.6", feature = "xlib_xcb" } +xcursor = { version = "1.1", feature = "xcursor" } +xext = { version = "1.3", feature = "dpms" } +xft = { version = "2.1", feature = "xft" } +xi = { version = "1.7", feature = "xinput" } +xinerama = { version = "1.1", feature = "xinerama" } +xmu = { version = "1.1", feature = "xmu" } +xrandr = { version = "1.5", feature = "xrandr" } +xrender = { version = "0.9.6", feature = "xrender" } +xscrnsaver = { version = "1.2", feature = "xss" } +xt = { version = "1.1", feature = "xt" } +xtst = { version = "1.2", feature = "xtst" } +xxf86vm = { version = "1.1", feature = "xf86vmode" } diff --git a/third_party/rust/x11/build.rs b/third_party/rust/x11/build.rs new file mode 100644 index 000000000000..160dc9864c54 --- /dev/null +++ b/third_party/rust/x11/build.rs @@ -0,0 +1,9 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +extern crate metadeps; + +fn main () { + metadeps::probe().unwrap(); +} diff --git a/third_party/rust/x11/examples/hello-world.rs b/third_party/rust/x11/examples/hello-world.rs new file mode 100644 index 000000000000..1061ad4a1021 --- /dev/null +++ b/third_party/rust/x11/examples/hello-world.rs @@ -0,0 +1,89 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +#![cfg_attr(not(feature = "xlib"), allow(dead_code))] +#![cfg_attr(not(feature = "xlib"), allow(unused_imports))] + +extern crate x11; + +use std::ffi::CString; +use std::mem; +use std::os::raw::*; +use std::ptr; + +use x11::xlib; + +#[cfg(not(feature = "xlib"))] +fn main () { + panic!("this example requires `--features xlib`"); +} + +#[cfg(feature = "xlib")] +fn main () { + unsafe { + // Open display connection. + let display = xlib::XOpenDisplay(ptr::null()); + + if display.is_null() { + panic!("XOpenDisplay failed"); + } + + // Create window. + let screen = xlib::XDefaultScreen(display); + let root = xlib::XRootWindow(display, screen); + + let mut attributes: xlib::XSetWindowAttributes = mem::uninitialized(); + attributes.background_pixel = xlib::XWhitePixel(display, screen); + + let window = xlib::XCreateWindow(display, root, + 0, 0, 400, 300, + 0, 0, + xlib::InputOutput as c_uint, ptr::null_mut(), + xlib::CWBackPixel, &mut attributes); + + // Set window title. + let title_str = CString::new("hello-world").unwrap(); + xlib::XStoreName(display, window, title_str.as_ptr() as *mut c_char); + + // Hook close requests. + let wm_protocols_str = CString::new("WM_PROTOCOLS").unwrap(); + let wm_delete_window_str = CString::new("WM_DELETE_WINDOW").unwrap(); + + let wm_protocols = xlib::XInternAtom(display, wm_protocols_str.as_ptr(), xlib::False); + let wm_delete_window = xlib::XInternAtom(display, wm_delete_window_str.as_ptr(), xlib::False); + + let mut protocols = [wm_delete_window]; + + xlib::XSetWMProtocols(display, window, protocols.as_mut_ptr(), protocols.len() as c_int); + + // Show window. + xlib::XMapWindow(display, window); + + // Main loop. + let mut event: xlib::XEvent = mem::uninitialized(); + + loop { + xlib::XNextEvent(display, &mut event); + + match event.get_type() { + xlib::ClientMessage => { + let xclient = xlib::XClientMessageEvent::from(event); + + if xclient.message_type == wm_protocols && xclient.format == 32 { + let protocol = xclient.data.get_long(0) as xlib::Atom; + + if protocol == wm_delete_window { + break; + } + } + }, + + _ => () + } + } + + // Shut down. + xlib::XCloseDisplay(display); + } +} diff --git a/third_party/rust/x11/examples/input.rs b/third_party/rust/x11/examples/input.rs new file mode 100644 index 000000000000..acb361605c7d --- /dev/null +++ b/third_party/rust/x11/examples/input.rs @@ -0,0 +1,384 @@ +// XInput2 example for x11-rs +// +// This is a basic example showing how to use XInput2 to read +// keyboard, mouse and other input events in X11. +// +// See Pete Hutterer's "XI2 Recipes" blog series, +// starting at http://who-t.blogspot.co.uk/2009/05/xi2-recipes-part-1.html +// for a guide. + +#![cfg_attr(not(feature = "xlib"), allow(dead_code))] +#![cfg_attr(not(feature = "xlib"), allow(unused_imports))] + +extern crate x11; +extern crate libc; + +use std::ffi::CString; +use std::ptr::{ + null, + null_mut, +}; +use std::mem::{transmute, zeroed}; +use std::os::raw::*; +use std::slice::{from_raw_parts}; +use x11::{xlib, xinput2}; + +/// Provides a basic framework for connecting to an X Display, +/// creating a window, displaying it and running the event loop +pub struct DemoWindow { + pub display: *mut xlib::Display, + pub window: xlib::Window, + + wm_protocols: xlib::Atom, + wm_delete_window: xlib::Atom +} + +impl DemoWindow { + /// Create a new window with a given title and size + pub fn new(title: &str, width: u32, height: u32) -> DemoWindow { + unsafe { + // Open display + let display = xlib::XOpenDisplay(null()); + if display == null_mut() { + panic!("can't open display"); + } + + // Load atoms + let wm_delete_window_str = CString::new("WM_DELETE_WINDOW").unwrap(); + let wm_protocols_str = CString::new("WM_PROTOCOLS").unwrap(); + + let wm_delete_window = xlib::XInternAtom(display, wm_delete_window_str.as_ptr(), xlib::False); + let wm_protocols = xlib::XInternAtom(display, wm_protocols_str.as_ptr(), xlib::False); + + if wm_delete_window == 0 || wm_protocols == 0 { + panic!("can't load atoms"); + } + + // Create window + let screen_num = xlib::XDefaultScreen(display); + let root = xlib::XRootWindow(display, screen_num); + let white_pixel = xlib::XWhitePixel(display, screen_num); + + let mut attributes: xlib::XSetWindowAttributes = zeroed(); + attributes.background_pixel = white_pixel; + + let window = xlib::XCreateWindow(display, root, 0, 0, width as c_uint, height as c_uint, 0, 0, + xlib::InputOutput as c_uint, null_mut(), + xlib::CWBackPixel, &mut attributes); + // Set window title + let title_str = CString::new(title).unwrap(); + xlib::XStoreName(display, window, title_str.as_ptr() as *mut _); + + // Subscribe to delete (close) events + let mut protocols = [wm_delete_window]; + + if xlib::XSetWMProtocols(display, window, &mut protocols[0] as *mut xlib::Atom, 1) == xlib::False { + panic!("can't set WM protocols"); + } + + DemoWindow{ + display: display, + window: window, + wm_protocols: wm_protocols, + wm_delete_window: wm_delete_window + } + } + } + + /// Display the window + pub fn show(&mut self) { + unsafe { + xlib::XMapWindow(self.display, self.window); + } + } + + /// Process events for the window. Window close events are handled automatically, + /// other events are passed on to |event_handler| + pub fn run_event_loop(&mut self, mut event_handler: EventHandler) + where EventHandler: FnMut(&xlib::XEvent) { + let mut event: xlib::XEvent = unsafe{zeroed()}; + loop { + unsafe{xlib::XNextEvent(self.display, &mut event)}; + match event.get_type() { + xlib::ClientMessage => { + let xclient: xlib::XClientMessageEvent = From::from(event); + + // WM_PROTOCOLS client message + if xclient.message_type == self.wm_protocols && xclient.format == 32 { + let protocol = xclient.data.get_long(0) as xlib::Atom; + + // WM_DELETE_WINDOW (close event) + if protocol == self.wm_delete_window { + break; + } + } + }, + _ => event_handler(&event) + } + } + } +} + +impl Drop for DemoWindow { + /// Destroys the window and disconnects from the display + fn drop(&mut self) { + unsafe { + xlib::XDestroyWindow(self.display, self.window); + xlib::XCloseDisplay(self.display); + } + } +} + +const TITLE: &'static str = "XInput Demo"; +const DEFAULT_WIDTH: c_uint = 640; +const DEFAULT_HEIGHT: c_uint = 480; + +#[derive(Debug)] +enum AxisType { + HorizontalScroll, + VerticalScroll, + Other +} + +#[derive(Debug)] +struct Axis { + id: i32, + device_id: i32, + axis_number: i32, + axis_type: AxisType +} + +#[derive(Debug)] +struct AxisValue { + device_id: i32, + axis_number: i32, + value: f64 +} + +struct InputState { + cursor_pos: (f64, f64), + axis_values: Vec +} + +fn read_input_axis_info(display: *mut xlib::Display) -> Vec { + let mut axis_list = Vec::new(); + let mut device_count = 0; + + // only get events from the master devices which are 'attached' + // to the keyboard or cursor + let devices = unsafe{xinput2::XIQueryDevice(display, xinput2::XIAllMasterDevices, &mut device_count)}; + for i in 0..device_count { + let device = unsafe { *(devices.offset(i as isize)) }; + for k in 0..device.num_classes { + let class = unsafe { *(device.classes.offset(k as isize)) }; + match unsafe { (*class)._type } { + xinput2::XIScrollClass => { + let scroll_class: &xinput2::XIScrollClassInfo = unsafe{transmute(class)}; + axis_list.push(Axis{ + id: scroll_class.sourceid, + device_id: device.deviceid, + axis_number: scroll_class.number, + axis_type: match scroll_class.scroll_type { + xinput2::XIScrollTypeHorizontal => AxisType::HorizontalScroll, + xinput2::XIScrollTypeVertical => AxisType::VerticalScroll, + _ => { unreachable!() } + } + }) + }, + xinput2::XIValuatorClass => { + let valuator_class: &xinput2::XIValuatorClassInfo = unsafe{transmute(class)}; + axis_list.push(Axis{ + id: valuator_class.sourceid, + device_id: device.deviceid, + axis_number: valuator_class.number, + axis_type: AxisType::Other + }) + }, + _ => { /* TODO */ } + } + } + } + + axis_list.sort_by(|a, b| { + if a.device_id != b.device_id { + a.device_id.cmp(&b.device_id) + } else if a.id != b.id { + a.id.cmp(&b.id) + } else { + a.axis_number.cmp(&b.axis_number) + } + }); + axis_list +} + +/// Given an input motion event for an axis and the previous +/// state of the axises, return the horizontal/vertical +/// scroll deltas +fn calc_scroll_deltas(event: &xinput2::XIDeviceEvent, + axis_id: i32, + axis_value: f64, + axis_list: &[Axis], + prev_axis_values: &mut Vec) -> (f64, f64) { + let prev_value_pos = prev_axis_values.iter().position(|prev_axis| { + prev_axis.device_id == event.sourceid && + prev_axis.axis_number == axis_id + }); + let delta = match prev_value_pos { + Some(idx) => axis_value - prev_axis_values[idx].value, + None => 0.0 + }; + + let new_axis_value = AxisValue{ + device_id: event.sourceid, + axis_number: axis_id, + value: axis_value + }; + + match prev_value_pos { + Some(idx) => prev_axis_values[idx] = new_axis_value, + None => prev_axis_values.push(new_axis_value) + } + + let mut scroll_delta = (0.0, 0.0); + + for axis in axis_list.iter() { + if axis.id == event.sourceid && + axis.axis_number == axis_id { + match axis.axis_type { + AxisType::HorizontalScroll => scroll_delta.0 = delta, + AxisType::VerticalScroll => scroll_delta.1 = delta, + _ => {} + } + } + } + + scroll_delta +} + +#[cfg(not(all(feature = "xlib", feature = "xinput")))] +fn main () { + panic!("this example requires `--features 'xlib xinput'`"); +} + +#[cfg(all(feature = "xlib", feature = "xinput"))] +fn main () { + let mut demo_window = DemoWindow::new(TITLE, DEFAULT_WIDTH, DEFAULT_HEIGHT); + + // query XInput support + let mut opcode: c_int = 0; + let mut event: c_int = 0; + let mut error: c_int = 0; + let xinput_str = CString::new("XInputExtension").unwrap(); + let xinput_available = unsafe { + xlib::XQueryExtension(demo_window.display, xinput_str.as_ptr(), &mut opcode, &mut event, &mut error) + }; + if xinput_available == xlib::False { + panic!("XInput not available") + } + + let mut xinput_major_ver = xinput2::XI_2_Major; + let mut xinput_minor_ver = xinput2::XI_2_Minor; + if unsafe{xinput2::XIQueryVersion(demo_window.display, + &mut xinput_major_ver, &mut xinput_minor_ver)} != xlib::Success as c_int { + panic!("XInput2 not available"); + } + println!("XI version available {}.{}", xinput_major_ver, xinput_minor_ver); + + // init XInput events + let mut mask: [c_uchar; 1] = [0]; + let mut input_event_mask = xinput2::XIEventMask { + deviceid: xinput2::XIAllMasterDevices, + mask_len: mask.len() as i32, + mask: mask.as_mut_ptr() + }; + let events = &[ + xinput2::XI_ButtonPress, + xinput2::XI_ButtonRelease, + xinput2::XI_KeyPress, + xinput2::XI_KeyRelease, + xinput2::XI_Motion + ]; + for &event in events { + xinput2::XISetMask(&mut mask, event); + } + + match unsafe{xinput2::XISelectEvents(demo_window.display, + demo_window.window, &mut input_event_mask, 1)} { + status if status as u8 == xlib::Success => (), + err => panic!("Failed to select events {:?}", err) + } + + // Show window + demo_window.show(); + + // Main loop + let display = demo_window.display; + let axis_list = read_input_axis_info(display); + + let mut prev_state = InputState{ + cursor_pos: (0.0, 0.0), + axis_values: Vec::new() + }; + + demo_window.run_event_loop(|event| { + match event.get_type() { + xlib::GenericEvent => { + let mut cookie: xlib::XGenericEventCookie = From::from(*event); + if unsafe{xlib::XGetEventData(display, &mut cookie)} != xlib::True { + println!("Failed to retrieve event data"); + return; + } + match cookie.evtype { + xinput2::XI_KeyPress | xinput2::XI_KeyRelease => { + let event_data: &xinput2::XIDeviceEvent = unsafe{transmute(cookie.data)}; + if cookie.evtype == xinput2::XI_KeyPress { + if event_data.flags & xinput2::XIKeyRepeat == 0 { + println!("Key {} pressed", event_data.detail); + } + } else { + println!("Key {} released", event_data.detail); + } + }, + xinput2::XI_ButtonPress | xinput2::XI_ButtonRelease => { + let event_data: &xinput2::XIDeviceEvent = unsafe{transmute(cookie.data)}; + if cookie.evtype == xinput2::XI_ButtonPress { + println!("Button {} pressed", event_data.detail); + } else { + println!("Button {} released", event_data.detail); + } + }, + xinput2::XI_Motion => { + let event_data: &xinput2::XIDeviceEvent = unsafe{transmute(cookie.data)}; + let axis_state = event_data.valuators; + let mask = unsafe{ from_raw_parts(axis_state.mask, axis_state.mask_len as usize) }; + let mut axis_count = 0; + + let mut scroll_delta = (0.0, 0.0); + for axis_id in 0..axis_state.mask_len { + if xinput2::XIMaskIsSet(&mask, axis_id) { + let axis_value = unsafe{*axis_state.values.offset(axis_count)}; + let delta = calc_scroll_deltas(event_data, axis_id, axis_value, &axis_list, &mut prev_state.axis_values); + scroll_delta.0 += delta.0; + scroll_delta.1 += delta.1; + axis_count += 1; + } + } + + if scroll_delta.0.abs() > 0.0 || scroll_delta.1.abs() > 0.0 { + println!("Mouse wheel/trackpad scrolled by ({}, {})", scroll_delta.0, scroll_delta.1); + } + + let new_cursor_pos = (event_data.event_x, event_data.event_y); + if new_cursor_pos != prev_state.cursor_pos { + println!("Mouse moved to ({}, {})", new_cursor_pos.0, new_cursor_pos.1); + prev_state.cursor_pos = new_cursor_pos; + } + }, + _ => () + } + unsafe{xlib::XFreeEventData(display, &mut cookie)}; + }, + _ => () + } + }); +} diff --git a/third_party/rust/x11/examples/xrecord.rs b/third_party/rust/x11/examples/xrecord.rs new file mode 100644 index 000000000000..64b3a04976d0 --- /dev/null +++ b/third_party/rust/x11/examples/xrecord.rs @@ -0,0 +1,127 @@ +// Example for X Record Extension + +#![cfg_attr(not(feature = "xlib"), allow(dead_code))] +#![cfg_attr(not(feature = "xlib"), allow(unused_imports))] + +extern crate libc; +extern crate x11; + +use std::ffi::CString; +use std::ptr::{ + null, + null_mut, +}; + +use std::os::raw::{ + c_int +}; +use x11::xlib; +use x11::xrecord; + +static mut EVENT_COUNT:u32 = 0; + +#[cfg(not(all(feature = "xlib", feature = "xrecord")))] +fn main () { + panic!("this example requires `--features 'xlib xrecord'`"); +} + +#[cfg(all(feature = "xlib", feature = "xrecord"))] +fn main () { + unsafe { + // Open displays + let dpy_control = xlib::XOpenDisplay(null()); + let dpy_data = xlib::XOpenDisplay(null()); + if dpy_control == null_mut() || dpy_data == null_mut() { + panic!("can't open display"); + } + // Enable synchronization + xlib::XSynchronize(dpy_control, 1); + + let extension_name = CString::new("RECORD").unwrap(); + + let extension = xlib::XInitExtension( + dpy_control, + extension_name.as_ptr()); + if extension.is_null() { + panic!("Error init X Record Extension"); + } + + // Get version + let mut version_major: c_int = 0; + let mut version_minor: c_int = 0; + xrecord::XRecordQueryVersion( + dpy_control, + &mut version_major, + &mut version_minor + ); + println!( + "RECORD extension version {}.{}", + version_major, + version_minor + ); + + // Prepare record range + let mut record_range: xrecord::XRecordRange = *xrecord::XRecordAllocRange(); + record_range.device_events.first = xlib::KeyPress as u8; + record_range.device_events.last = xlib::MotionNotify as u8; + + // Create context + let context = xrecord::XRecordCreateContext( + dpy_control, + 0, + &mut xrecord::XRecordAllClients, + 1, + std::mem::transmute(&mut &mut record_range), + 1 + ); + + if context == 0 { + panic!("Fail create Record context\n"); + } + + // Run + let result = xrecord::XRecordEnableContext( + dpy_data, + context, + Some(record_callback), + &mut 0 + ); + if result == 0 { + panic!("Cound not enable the Record context!\n"); + } + } +} + +unsafe extern "C" fn record_callback(_:*mut i8, raw_data: *mut xrecord::XRecordInterceptData) { + EVENT_COUNT += 1; + let data = &*raw_data; + + // Skip server events + if data.category != xrecord::XRecordFromServer { + return; + } + + // Cast binary data + let xdatum = &*(data.data as *mut XRecordDatum); + + let event_type = match xdatum.xtype as i32 { + xlib::KeyPress => "KeyPress", + xlib::KeyRelease => "KeyRelease", + xlib::ButtonPress => "ButtonPress", + xlib::ButtonRelease => "ButtonRelease", + xlib::MotionNotify => "MotionNotify", + _ => "Other" + }; + + println!("Event recieve\t{:?}\tevent.", event_type); + + xrecord::XRecordFreeData(raw_data); +} + +#[repr(C)] +struct XRecordDatum { + xtype: u8, + code: u8, + unknown1: u8, + unknown2: u8 +} diff --git a/third_party/rust/x11/src/dpms.rs b/third_party/rust/x11/src/dpms.rs new file mode 100644 index 000000000000..a19a9de6e41a --- /dev/null +++ b/third_party/rust/x11/src/dpms.rs @@ -0,0 +1,44 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ c_int }; + +use xlib::{ Display, Status, Bool }; +use xmd::{ CARD16, BOOL }; + + +// +// functions +// + + +x11_link! { Xext, xext, ["libXext.so.6", "libXext.so"], 9, + pub fn DPMSQueryExtension (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Bool, + pub fn DPMSGetVersion (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Status, + pub fn DPMSCapable (_1: *mut Display) -> Bool, + pub fn DPMSSetTimeouts (_1: *mut Display, _2: CARD16, _3: CARD16, _4: CARD16) -> Status, + pub fn DPMSGetTimeouts (_1: *mut Display, _2: *mut CARD16, _3: *mut CARD16, _4: *mut CARD16) -> Bool, + pub fn DPMSEnable (_1: *mut Display) -> Status, + pub fn DPMSDisable (_1: *mut Display) -> Status, + pub fn DPMSForceLevel (_1: *mut Display, _2: CARD16) -> Status, + pub fn DPMSInfo (_1: *mut Display, _2: *mut CARD16, _3: *mut BOOL) -> Status, +variadic: +globals: +} + + +// +// constants +// + + +pub const DPMSMajorVersion: c_int = 1; +pub const DPMSMinorVersion: c_int = 1; + +pub const DPMSExtensionName: &'static str = "DPMS"; + +pub const DPMSModeOn: CARD16 = 0; +pub const DPMSModeStandby: CARD16 = 1; +pub const DPMSModeSuspend: CARD16 = 2; +pub const DPMSModeOff: CARD16 = 3; diff --git a/third_party/rust/x11/src/glx.rs b/third_party/rust/x11/src/glx.rs new file mode 100644 index 000000000000..6d7d34cd7b9f --- /dev/null +++ b/third_party/rust/x11/src/glx.rs @@ -0,0 +1,191 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_int, + c_uchar, + c_uint, + c_ulong, +}; + +use ::xlib::{ + Display, + XID, + XVisualInfo, +}; + + +// +// functions +// + + +x11_link! { Glx, gl, ["libGL.so.1", "libGL.so"], 39, + pub fn glXChooseFBConfig (_4: *mut Display, _3: c_int, _2: *const c_int, _1: *mut c_int) -> *mut GLXFBConfig, + pub fn glXChooseVisual (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut XVisualInfo, + pub fn glXCopyContext (_4: *mut Display, _3: GLXContext, _2: GLXContext, _1: c_ulong) -> (), + pub fn glXCreateContext (_4: *mut Display, _3: *mut XVisualInfo, _2: GLXContext, _1: c_int) -> GLXContext, + pub fn glXCreateGLXPixmap (_3: *mut Display, _2: *mut XVisualInfo, _1: c_ulong) -> c_ulong, + pub fn glXCreateNewContext (_5: *mut Display, _4: GLXFBConfig, _3: c_int, _2: GLXContext, _1: c_int) -> GLXContext, + pub fn glXCreatePbuffer (_3: *mut Display, _2: GLXFBConfig, _1: *const c_int) -> c_ulong, + pub fn glXCreatePixmap (_4: *mut Display, _3: GLXFBConfig, _2: c_ulong, _1: *const c_int) -> c_ulong, + pub fn glXCreateWindow (_4: *mut Display, _3: GLXFBConfig, _2: c_ulong, _1: *const c_int) -> c_ulong, + pub fn glXDestroyContext (_2: *mut Display, _1: GLXContext) -> (), + pub fn glXDestroyGLXPixmap (_2: *mut Display, _1: c_ulong) -> (), + pub fn glXDestroyPbuffer (_2: *mut Display, _1: c_ulong) -> (), + pub fn glXDestroyPixmap (_2: *mut Display, _1: c_ulong) -> (), + pub fn glXDestroyWindow (_2: *mut Display, _1: c_ulong) -> (), + pub fn glXGetClientString (_2: *mut Display, _1: c_int) -> *const c_char, + pub fn glXGetConfig (_4: *mut Display, _3: *mut XVisualInfo, _2: c_int, _1: *mut c_int) -> c_int, + pub fn glXGetCurrentContext () -> GLXContext, + pub fn glXGetCurrentDisplay () -> *mut Display, + pub fn glXGetCurrentDrawable () -> c_ulong, + pub fn glXGetCurrentReadDrawable () -> c_ulong, + pub fn glXGetFBConfigAttrib (_4: *mut Display, _3: GLXFBConfig, _2: c_int, _1: *mut c_int) -> c_int, + pub fn glXGetFBConfigs (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut GLXFBConfig, + pub fn glXGetProcAddress (_1: *const c_uchar) -> Option, + pub fn glXGetSelectedEvent (_3: *mut Display, _2: c_ulong, _1: *mut c_ulong) -> (), + pub fn glXGetVisualFromFBConfig (_2: *mut Display, _1: GLXFBConfig) -> *mut XVisualInfo, + pub fn glXIsDirect (_2: *mut Display, _1: GLXContext) -> c_int, + pub fn glXMakeContextCurrent (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: GLXContext) -> c_int, + pub fn glXMakeCurrent (_3: *mut Display, _2: c_ulong, _1: GLXContext) -> c_int, + pub fn glXQueryContext (_4: *mut Display, _3: GLXContext, _2: c_int, _1: *mut c_int) -> c_int, + pub fn glXQueryDrawable (_4: *mut Display, _3: c_ulong, _2: c_int, _1: *mut c_uint) -> (), + pub fn glXQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn glXQueryExtensionsString (_2: *mut Display, _1: c_int) -> *const c_char, + pub fn glXQueryServerString (_3: *mut Display, _2: c_int, _1: c_int) -> *const c_char, + pub fn glXQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn glXSelectEvent (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> (), + pub fn glXSwapBuffers (_2: *mut Display, _1: c_ulong) -> (), + pub fn glXUseXFont (_4: c_ulong, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn glXWaitGL () -> (), + pub fn glXWaitX () -> (), +variadic: +globals: +} + + +// +// types +// + + +// opaque structures +#[repr(C)] pub struct __GLXcontextRec; +#[repr(C)] pub struct __GLXFBConfigRec; + +// types +pub type GLXContext = *mut __GLXcontextRec; +pub type GLXContextID = XID; +pub type GLXDrawable = XID; +pub type GLXFBConfig = *mut __GLXFBConfigRec; +pub type GLXFBConfigID = XID; +pub type GLXPbuffer = XID; +pub type GLXPixmap = XID; +pub type GLXWindow = XID; + + +// +// constants +// + + +// config caveats +pub const GLX_SLOW_CONFIG: c_int = 0x8001; +pub const GLX_NON_CONFORMANT_CONFIG: c_int = 0x800d; + +// drawable type mask +pub const GLX_WINDOW_BIT: c_int = 0x0001; +pub const GLX_PIXMAP_BIT: c_int = 0x0002; +pub const GLX_PBUFFER_BIT: c_int = 0x0004; + +// framebuffer attributes +pub const GLX_USE_GL: c_int = 0x0001; +pub const GLX_BUFFER_SIZE: c_int = 0x0002; +pub const GLX_LEVEL: c_int = 0x0003; +pub const GLX_RGBA: c_int = 0x0004; +pub const GLX_DOUBLEBUFFER: c_int = 0x0005; +pub const GLX_STEREO: c_int = 0x0006; +pub const GLX_AUX_BUFFERS: c_int = 0x0007; +pub const GLX_RED_SIZE: c_int = 0x0008; +pub const GLX_GREEN_SIZE: c_int = 0x0009; +pub const GLX_BLUE_SIZE: c_int = 0x000a; +pub const GLX_ALPHA_SIZE: c_int = 0x000b; +pub const GLX_DEPTH_SIZE: c_int = 0x000c; +pub const GLX_STENCIL_SIZE: c_int = 0x000d; +pub const GLX_ACCUM_RED_SIZE: c_int = 0x000e; +pub const GLX_ACCUM_GREEN_SIZE: c_int = 0x000f; +pub const GLX_ACCUM_BLUE_SIZE: c_int = 0x0010; +pub const GLX_ACCUM_ALPHA_SIZE: c_int = 0x0011; +pub const GLX_CONFIG_CAVEAT: c_int = 0x0020; +pub const GLX_X_VISUAL_TYPE: c_int = 0x0022; +pub const GLX_TRANSPARENT_TYPE: c_int = 0x0023; +pub const GLX_TRANSPARENT_INDEX_VALUE: c_int = 0x0024; +pub const GLX_TRANSPARENT_RED_VALUE: c_int = 0x0025; +pub const GLX_TRANSPARENT_GREEN_VALUE: c_int = 0x0026; +pub const GLX_TRANSPARENT_BLUE_VALUE: c_int = 0x0027; +pub const GLX_TRANSPARENT_ALPHA_VALUE: c_int = 0x0028; +pub const GLX_DRAWABLE_TYPE: c_int = 0x8010; +pub const GLX_RENDER_TYPE: c_int = 0x8011; +pub const GLX_X_RENDERABLE: c_int = 0x8012; +pub const GLX_FBCONFIG_ID: c_int = 0x8013; + +// misc +pub const GLX_DONT_CARE: c_int = -1; +pub const GLX_NONE: c_int = 0x8000; + +// render type mask +pub const GLX_RGBA_BIT: c_int = 0x0001; +pub const GLX_COLOR_INDEX_BIT: c_int = 0x0002; + +// transparent types +pub const GLX_TRANSPARENT_RGB: c_int = 0x8008; +pub const GLX_TRANSPARENT_INDEX: c_int = 0x8009; + +// visual types +pub const GLX_TRUE_COLOR: c_int = 0x8002; +pub const GLX_DIRECT_COLOR: c_int = 0x8003; +pub const GLX_PSEUDO_COLOR: c_int = 0x8004; +pub const GLX_STATIC_COLOR: c_int = 0x8005; +pub const GLX_GRAY_SCALE: c_int = 0x8006; +pub const GLX_STATIC_GRAY: c_int = 0x8007; + + +// +// ARB extensions +// + + +pub mod arb { + use std::os::raw::c_int; + + // context attributes + pub const GLX_CONTEXT_MAJOR_VERSION_ARB: c_int = 0x2091; + pub const GLX_CONTEXT_MINOR_VERSION_ARB: c_int = 0x2092; + pub const GLX_CONTEXT_FLAGS_ARB: c_int = 0x2094; + pub const GLX_CONTEXT_PROFILE_MASK_ARB: c_int = 0x9126; + + // context flags + pub const GLX_CONTEXT_DEBUG_BIT_ARB: c_int = 0x0001; + pub const GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB: c_int = 0x0002; + + // context profile mask + pub const GLX_CONTEXT_CORE_PROFILE_BIT_ARB: c_int = 0x0001; + pub const GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: c_int = 0x0002; +} + + +// +// EXT extensions +// + + +pub mod ext { + use std::os::raw::c_int; + + // drawable attributes + pub const GLX_SWAP_INTERVAL_EXT: c_int = 0x20f1; + pub const GLX_MAX_SWAP_INTERVAL_EXT: c_int = 0x20f2; +} diff --git a/third_party/rust/x11/src/internal.rs b/third_party/rust/x11/src/internal.rs new file mode 100644 index 000000000000..b1ec344945b6 --- /dev/null +++ b/third_party/rust/x11/src/internal.rs @@ -0,0 +1,41 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::cmp::min; +use std::mem::{ + size_of, + zeroed, +}; + + +// +// public functions +// + + +pub unsafe fn mem_eq (a: &T, b: &T) -> bool { + let a_addr = a as *const T as usize; + let b_addr = b as *const T as usize; + + for i in 0..size_of::() { + if *((a_addr + i) as *const u8) != *((b_addr + i) as *const u8) { + return false; + } + } + + return true; +} + +pub unsafe fn transmute_union (input: &I) -> O + where I : Sized, O : Sized +{ + let mut output: O = zeroed(); + let copy_len = min(size_of::(), size_of::()); + + for i in 0..copy_len { + *((&mut output as *mut O as usize + i) as *mut u8) = *((input as *const I as usize + i) as *const u8); + } + + return output; +} diff --git a/third_party/rust/x11/src/keysym.rs b/third_party/rust/x11/src/keysym.rs new file mode 100644 index 000000000000..f075794990a2 --- /dev/null +++ b/third_party/rust/x11/src/keysym.rs @@ -0,0 +1,1332 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::c_uint; + +pub const XK_BackSpace: c_uint = 0xFF08; +pub const XK_Tab: c_uint = 0xFF09; +pub const XK_Linefeed: c_uint = 0xFF0A; +pub const XK_Clear: c_uint = 0xFF0B; +pub const XK_Return: c_uint = 0xFF0D; +pub const XK_Pause: c_uint = 0xFF13; +pub const XK_Scroll_Lock: c_uint = 0xFF14; +pub const XK_Sys_Req: c_uint = 0xFF15; +pub const XK_Escape: c_uint = 0xFF1B; +pub const XK_Delete: c_uint = 0xFFFF; +pub const XK_Multi_key: c_uint = 0xFF20; +pub const XK_Kanji: c_uint = 0xFF21; +pub const XK_Muhenkan: c_uint = 0xFF22; +pub const XK_Henkan_Mode: c_uint = 0xFF23; +pub const XK_Henkan: c_uint = 0xFF23; +pub const XK_Romaji: c_uint = 0xFF24; +pub const XK_Hiragana: c_uint = 0xFF25; +pub const XK_Katakana: c_uint = 0xFF26; +pub const XK_Hiragana_Katakana: c_uint = 0xFF27; +pub const XK_Zenkaku: c_uint = 0xFF28; +pub const XK_Hankaku: c_uint = 0xFF29; +pub const XK_Zenkaku_Hankaku: c_uint = 0xFF2A; +pub const XK_Touroku: c_uint = 0xFF2B; +pub const XK_Massyo: c_uint = 0xFF2C; +pub const XK_Kana_Lock: c_uint = 0xFF2D; +pub const XK_Kana_Shift: c_uint = 0xFF2E; +pub const XK_Eisu_Shift: c_uint = 0xFF2F; +pub const XK_Eisu_toggle: c_uint = 0xFF30; +pub const XK_Home: c_uint = 0xFF50; +pub const XK_Left: c_uint = 0xFF51; +pub const XK_Up: c_uint = 0xFF52; +pub const XK_Right: c_uint = 0xFF53; +pub const XK_Down: c_uint = 0xFF54; +pub const XK_Prior: c_uint = 0xFF55; +pub const XK_Page_Up: c_uint = 0xFF55; +pub const XK_Next: c_uint = 0xFF56; +pub const XK_Page_Down: c_uint = 0xFF56; +pub const XK_End: c_uint = 0xFF57; +pub const XK_Begin: c_uint = 0xFF58; +pub const XK_Win_L: c_uint = 0xFF5B; +pub const XK_Win_R: c_uint = 0xFF5C; +pub const XK_App: c_uint = 0xFF5D; +pub const XK_Select: c_uint = 0xFF60; +pub const XK_Print: c_uint = 0xFF61; +pub const XK_Execute: c_uint = 0xFF62; +pub const XK_Insert: c_uint = 0xFF63; +pub const XK_Undo: c_uint = 0xFF65; +pub const XK_Redo: c_uint = 0xFF66; +pub const XK_Menu: c_uint = 0xFF67; +pub const XK_Find: c_uint = 0xFF68; +pub const XK_Cancel: c_uint = 0xFF69; +pub const XK_Help: c_uint = 0xFF6A; +pub const XK_Break: c_uint = 0xFF6B; +pub const XK_Mode_switch: c_uint = 0xFF7E; +pub const XK_script_switch: c_uint = 0xFF7E; +pub const XK_Num_Lock: c_uint = 0xFF7F; +pub const XK_KP_Space: c_uint = 0xFF80; +pub const XK_KP_Tab: c_uint = 0xFF89; +pub const XK_KP_Enter: c_uint = 0xFF8D; +pub const XK_KP_F1: c_uint = 0xFF91; +pub const XK_KP_F2: c_uint = 0xFF92; +pub const XK_KP_F3: c_uint = 0xFF93; +pub const XK_KP_F4: c_uint = 0xFF94; +pub const XK_KP_Home: c_uint = 0xFF95; +pub const XK_KP_Left: c_uint = 0xFF96; +pub const XK_KP_Up: c_uint = 0xFF97; +pub const XK_KP_Right: c_uint = 0xFF98; +pub const XK_KP_Down: c_uint = 0xFF99; +pub const XK_KP_Prior: c_uint = 0xFF9A; +pub const XK_KP_Page_Up: c_uint = 0xFF9A; +pub const XK_KP_Next: c_uint = 0xFF9B; +pub const XK_KP_Page_Down: c_uint = 0xFF9B; +pub const XK_KP_End: c_uint = 0xFF9C; +pub const XK_KP_Begin: c_uint = 0xFF9D; +pub const XK_KP_Insert: c_uint = 0xFF9E; +pub const XK_KP_Delete: c_uint = 0xFF9F; +pub const XK_KP_Equal: c_uint = 0xFFBD; +pub const XK_KP_Multiply: c_uint = 0xFFAA; +pub const XK_KP_Add: c_uint = 0xFFAB; +pub const XK_KP_Separator: c_uint = 0xFFAC; +pub const XK_KP_Subtract: c_uint = 0xFFAD; +pub const XK_KP_Decimal: c_uint = 0xFFAE; +pub const XK_KP_Divide: c_uint = 0xFFAF; +pub const XK_KP_0: c_uint = 0xFFB0; +pub const XK_KP_1: c_uint = 0xFFB1; +pub const XK_KP_2: c_uint = 0xFFB2; +pub const XK_KP_3: c_uint = 0xFFB3; +pub const XK_KP_4: c_uint = 0xFFB4; +pub const XK_KP_5: c_uint = 0xFFB5; +pub const XK_KP_6: c_uint = 0xFFB6; +pub const XK_KP_7: c_uint = 0xFFB7; +pub const XK_KP_8: c_uint = 0xFFB8; +pub const XK_KP_9: c_uint = 0xFFB9; +pub const XK_F1: c_uint = 0xFFBE; +pub const XK_F2: c_uint = 0xFFBF; +pub const XK_F3: c_uint = 0xFFC0; +pub const XK_F4: c_uint = 0xFFC1; +pub const XK_F5: c_uint = 0xFFC2; +pub const XK_F6: c_uint = 0xFFC3; +pub const XK_F7: c_uint = 0xFFC4; +pub const XK_F8: c_uint = 0xFFC5; +pub const XK_F9: c_uint = 0xFFC6; +pub const XK_F10: c_uint = 0xFFC7; +pub const XK_F11: c_uint = 0xFFC8; +pub const XK_L1: c_uint = 0xFFC8; +pub const XK_F12: c_uint = 0xFFC9; +pub const XK_L2: c_uint = 0xFFC9; +pub const XK_F13: c_uint = 0xFFCA; +pub const XK_L3: c_uint = 0xFFCA; +pub const XK_F14: c_uint = 0xFFCB; +pub const XK_L4: c_uint = 0xFFCB; +pub const XK_F15: c_uint = 0xFFCC; +pub const XK_L5: c_uint = 0xFFCC; +pub const XK_F16: c_uint = 0xFFCD; +pub const XK_L6: c_uint = 0xFFCD; +pub const XK_F17: c_uint = 0xFFCE; +pub const XK_L7: c_uint = 0xFFCE; +pub const XK_F18: c_uint = 0xFFCF; +pub const XK_L8: c_uint = 0xFFCF; +pub const XK_F19: c_uint = 0xFFD0; +pub const XK_L9: c_uint = 0xFFD0; +pub const XK_F20: c_uint = 0xFFD1; +pub const XK_L10: c_uint = 0xFFD1; +pub const XK_F21: c_uint = 0xFFD2; +pub const XK_R1: c_uint = 0xFFD2; +pub const XK_F22: c_uint = 0xFFD3; +pub const XK_R2: c_uint = 0xFFD3; +pub const XK_F23: c_uint = 0xFFD4; +pub const XK_R3: c_uint = 0xFFD4; +pub const XK_F24: c_uint = 0xFFD5; +pub const XK_R4: c_uint = 0xFFD5; +pub const XK_F25: c_uint = 0xFFD6; +pub const XK_R5: c_uint = 0xFFD6; +pub const XK_F26: c_uint = 0xFFD7; +pub const XK_R6: c_uint = 0xFFD7; +pub const XK_F27: c_uint = 0xFFD8; +pub const XK_R7: c_uint = 0xFFD8; +pub const XK_F28: c_uint = 0xFFD9; +pub const XK_R8: c_uint = 0xFFD9; +pub const XK_F29: c_uint = 0xFFDA; +pub const XK_R9: c_uint = 0xFFDA; +pub const XK_F30: c_uint = 0xFFDB; +pub const XK_R10: c_uint = 0xFFDB; +pub const XK_F31: c_uint = 0xFFDC; +pub const XK_R11: c_uint = 0xFFDC; +pub const XK_F32: c_uint = 0xFFDD; +pub const XK_R12: c_uint = 0xFFDD; +pub const XK_F33: c_uint = 0xFFDE; +pub const XK_R13: c_uint = 0xFFDE; +pub const XK_F34: c_uint = 0xFFDF; +pub const XK_R14: c_uint = 0xFFDF; +pub const XK_F35: c_uint = 0xFFE0; +pub const XK_R15: c_uint = 0xFFE0; +pub const XK_Shift_L: c_uint = 0xFFE1; +pub const XK_Shift_R: c_uint = 0xFFE2; +pub const XK_Control_L: c_uint = 0xFFE3; +pub const XK_Control_R: c_uint = 0xFFE4; +pub const XK_Caps_Lock: c_uint = 0xFFE5; +pub const XK_Shift_Lock: c_uint = 0xFFE6; +pub const XK_Meta_L: c_uint = 0xFFE7; +pub const XK_Meta_R: c_uint = 0xFFE8; +pub const XK_Alt_L: c_uint = 0xFFE9; +pub const XK_Alt_R: c_uint = 0xFFEA; +pub const XK_Super_L: c_uint = 0xFFEB; +pub const XK_Super_R: c_uint = 0xFFEC; +pub const XK_Hyper_L: c_uint = 0xFFED; +pub const XK_Hyper_R: c_uint = 0xFFEE; +pub const XK_space: c_uint = 0x020; +pub const XK_exclam: c_uint = 0x021; +pub const XK_quotedbl: c_uint = 0x022; +pub const XK_numbersign: c_uint = 0x023; +pub const XK_dollar: c_uint = 0x024; +pub const XK_percent: c_uint = 0x025; +pub const XK_ampersand: c_uint = 0x026; +pub const XK_apostrophe: c_uint = 0x027; +pub const XK_quoteright: c_uint = 0x027; +pub const XK_parenleft: c_uint = 0x028; +pub const XK_parenright: c_uint = 0x029; +pub const XK_asterisk: c_uint = 0x02a; +pub const XK_plus: c_uint = 0x02b; +pub const XK_comma: c_uint = 0x02c; +pub const XK_minus: c_uint = 0x02d; +pub const XK_period: c_uint = 0x02e; +pub const XK_slash: c_uint = 0x02f; +pub const XK_0: c_uint = 0x030; +pub const XK_1: c_uint = 0x031; +pub const XK_2: c_uint = 0x032; +pub const XK_3: c_uint = 0x033; +pub const XK_4: c_uint = 0x034; +pub const XK_5: c_uint = 0x035; +pub const XK_6: c_uint = 0x036; +pub const XK_7: c_uint = 0x037; +pub const XK_8: c_uint = 0x038; +pub const XK_9: c_uint = 0x039; +pub const XK_colon: c_uint = 0x03a; +pub const XK_semicolon: c_uint = 0x03b; +pub const XK_less: c_uint = 0x03c; +pub const XK_equal: c_uint = 0x03d; +pub const XK_greater: c_uint = 0x03e; +pub const XK_question: c_uint = 0x03f; +pub const XK_at: c_uint = 0x040; +pub const XK_A: c_uint = 0x041; +pub const XK_B: c_uint = 0x042; +pub const XK_C: c_uint = 0x043; +pub const XK_D: c_uint = 0x044; +pub const XK_E: c_uint = 0x045; +pub const XK_F: c_uint = 0x046; +pub const XK_G: c_uint = 0x047; +pub const XK_H: c_uint = 0x048; +pub const XK_I: c_uint = 0x049; +pub const XK_J: c_uint = 0x04a; +pub const XK_K: c_uint = 0x04b; +pub const XK_L: c_uint = 0x04c; +pub const XK_M: c_uint = 0x04d; +pub const XK_N: c_uint = 0x04e; +pub const XK_O: c_uint = 0x04f; +pub const XK_P: c_uint = 0x050; +pub const XK_Q: c_uint = 0x051; +pub const XK_R: c_uint = 0x052; +pub const XK_S: c_uint = 0x053; +pub const XK_T: c_uint = 0x054; +pub const XK_U: c_uint = 0x055; +pub const XK_V: c_uint = 0x056; +pub const XK_W: c_uint = 0x057; +pub const XK_X: c_uint = 0x058; +pub const XK_Y: c_uint = 0x059; +pub const XK_Z: c_uint = 0x05a; +pub const XK_bracketleft: c_uint = 0x05b; +pub const XK_backslash: c_uint = 0x05c; +pub const XK_bracketright: c_uint = 0x05d; +pub const XK_asciicircum: c_uint = 0x05e; +pub const XK_underscore: c_uint = 0x05f; +pub const XK_grave: c_uint = 0x060; +pub const XK_quoteleft: c_uint = 0x060; +pub const XK_a: c_uint = 0x061; +pub const XK_b: c_uint = 0x062; +pub const XK_c: c_uint = 0x063; +pub const XK_d: c_uint = 0x064; +pub const XK_e: c_uint = 0x065; +pub const XK_f: c_uint = 0x066; +pub const XK_g: c_uint = 0x067; +pub const XK_h: c_uint = 0x068; +pub const XK_i: c_uint = 0x069; +pub const XK_j: c_uint = 0x06a; +pub const XK_k: c_uint = 0x06b; +pub const XK_l: c_uint = 0x06c; +pub const XK_m: c_uint = 0x06d; +pub const XK_n: c_uint = 0x06e; +pub const XK_o: c_uint = 0x06f; +pub const XK_p: c_uint = 0x070; +pub const XK_q: c_uint = 0x071; +pub const XK_r: c_uint = 0x072; +pub const XK_s: c_uint = 0x073; +pub const XK_t: c_uint = 0x074; +pub const XK_u: c_uint = 0x075; +pub const XK_v: c_uint = 0x076; +pub const XK_w: c_uint = 0x077; +pub const XK_x: c_uint = 0x078; +pub const XK_y: c_uint = 0x079; +pub const XK_z: c_uint = 0x07a; +pub const XK_braceleft: c_uint = 0x07b; +pub const XK_bar: c_uint = 0x07c; +pub const XK_braceright: c_uint = 0x07d; +pub const XK_asciitilde: c_uint = 0x07e; +pub const XK_nobreakspace: c_uint = 0x0a0; +pub const XK_exclamdown: c_uint = 0x0a1; +pub const XK_cent: c_uint = 0x0a2; +pub const XK_sterling: c_uint = 0x0a3; +pub const XK_currency: c_uint = 0x0a4; +pub const XK_yen: c_uint = 0x0a5; +pub const XK_brokenbar: c_uint = 0x0a6; +pub const XK_section: c_uint = 0x0a7; +pub const XK_diaeresis: c_uint = 0x0a8; +pub const XK_copyright: c_uint = 0x0a9; +pub const XK_ordfeminine: c_uint = 0x0aa; +pub const XK_guillemotleft: c_uint = 0x0ab; +pub const XK_notsign: c_uint = 0x0ac; +pub const XK_hyphen: c_uint = 0x0ad; +pub const XK_registered: c_uint = 0x0ae; +pub const XK_macron: c_uint = 0x0af; +pub const XK_degree: c_uint = 0x0b0; +pub const XK_plusminus: c_uint = 0x0b1; +pub const XK_twosuperior: c_uint = 0x0b2; +pub const XK_threesuperior: c_uint = 0x0b3; +pub const XK_acute: c_uint = 0x0b4; +pub const XK_mu: c_uint = 0x0b5; +pub const XK_paragraph: c_uint = 0x0b6; +pub const XK_periodcentered: c_uint = 0x0b7; +pub const XK_cedilla: c_uint = 0x0b8; +pub const XK_onesuperior: c_uint = 0x0b9; +pub const XK_masculine: c_uint = 0x0ba; +pub const XK_guillemotright: c_uint = 0x0bb; +pub const XK_onequarter: c_uint = 0x0bc; +pub const XK_onehalf: c_uint = 0x0bd; +pub const XK_threequarters: c_uint = 0x0be; +pub const XK_questiondown: c_uint = 0x0bf; +pub const XK_Agrave: c_uint = 0x0c0; +pub const XK_Aacute: c_uint = 0x0c1; +pub const XK_Acircumflex: c_uint = 0x0c2; +pub const XK_Atilde: c_uint = 0x0c3; +pub const XK_Adiaeresis: c_uint = 0x0c4; +pub const XK_Aring: c_uint = 0x0c5; +pub const XK_AE: c_uint = 0x0c6; +pub const XK_Ccedilla: c_uint = 0x0c7; +pub const XK_Egrave: c_uint = 0x0c8; +pub const XK_Eacute: c_uint = 0x0c9; +pub const XK_Ecircumflex: c_uint = 0x0ca; +pub const XK_Ediaeresis: c_uint = 0x0cb; +pub const XK_Igrave: c_uint = 0x0cc; +pub const XK_Iacute: c_uint = 0x0cd; +pub const XK_Icircumflex: c_uint = 0x0ce; +pub const XK_Idiaeresis: c_uint = 0x0cf; +pub const XK_ETH: c_uint = 0x0d0; +pub const XK_Eth: c_uint = 0x0d0; +pub const XK_Ntilde: c_uint = 0x0d1; +pub const XK_Ograve: c_uint = 0x0d2; +pub const XK_Oacute: c_uint = 0x0d3; +pub const XK_Ocircumflex: c_uint = 0x0d4; +pub const XK_Otilde: c_uint = 0x0d5; +pub const XK_Odiaeresis: c_uint = 0x0d6; +pub const XK_multiply: c_uint = 0x0d7; +pub const XK_Ooblique: c_uint = 0x0d8; +pub const XK_Ugrave: c_uint = 0x0d9; +pub const XK_Uacute: c_uint = 0x0da; +pub const XK_Ucircumflex: c_uint = 0x0db; +pub const XK_Udiaeresis: c_uint = 0x0dc; +pub const XK_Yacute: c_uint = 0x0dd; +pub const XK_THORN: c_uint = 0x0de; +pub const XK_Thorn: c_uint = 0x0de; +pub const XK_ssharp: c_uint = 0x0df; +pub const XK_agrave: c_uint = 0x0e0; +pub const XK_aacute: c_uint = 0x0e1; +pub const XK_acircumflex: c_uint = 0x0e2; +pub const XK_atilde: c_uint = 0x0e3; +pub const XK_adiaeresis: c_uint = 0x0e4; +pub const XK_aring: c_uint = 0x0e5; +pub const XK_ae: c_uint = 0x0e6; +pub const XK_ccedilla: c_uint = 0x0e7; +pub const XK_egrave: c_uint = 0x0e8; +pub const XK_eacute: c_uint = 0x0e9; +pub const XK_ecircumflex: c_uint = 0x0ea; +pub const XK_ediaeresis: c_uint = 0x0eb; +pub const XK_igrave: c_uint = 0x0ec; +pub const XK_iacute: c_uint = 0x0ed; +pub const XK_icircumflex: c_uint = 0x0ee; +pub const XK_idiaeresis: c_uint = 0x0ef; +pub const XK_eth: c_uint = 0x0f0; +pub const XK_ntilde: c_uint = 0x0f1; +pub const XK_ograve: c_uint = 0x0f2; +pub const XK_oacute: c_uint = 0x0f3; +pub const XK_ocircumflex: c_uint = 0x0f4; +pub const XK_otilde: c_uint = 0x0f5; +pub const XK_odiaeresis: c_uint = 0x0f6; +pub const XK_division: c_uint = 0x0f7; +pub const XK_oslash: c_uint = 0x0f8; +pub const XK_ugrave: c_uint = 0x0f9; +pub const XK_uacute: c_uint = 0x0fa; +pub const XK_ucircumflex: c_uint = 0x0fb; +pub const XK_udiaeresis: c_uint = 0x0fc; +pub const XK_yacute: c_uint = 0x0fd; +pub const XK_thorn: c_uint = 0x0fe; +pub const XK_ydiaeresis: c_uint = 0x0ff; +pub const XK_Aogonek: c_uint = 0x1a1; +pub const XK_breve: c_uint = 0x1a2; +pub const XK_Lstroke: c_uint = 0x1a3; +pub const XK_Lcaron: c_uint = 0x1a5; +pub const XK_Sacute: c_uint = 0x1a6; +pub const XK_Scaron: c_uint = 0x1a9; +pub const XK_Scedilla: c_uint = 0x1aa; +pub const XK_Tcaron: c_uint = 0x1ab; +pub const XK_Zacute: c_uint = 0x1ac; +pub const XK_Zcaron: c_uint = 0x1ae; +pub const XK_Zabovedot: c_uint = 0x1af; +pub const XK_aogonek: c_uint = 0x1b1; +pub const XK_ogonek: c_uint = 0x1b2; +pub const XK_lstroke: c_uint = 0x1b3; +pub const XK_lcaron: c_uint = 0x1b5; +pub const XK_sacute: c_uint = 0x1b6; +pub const XK_caron: c_uint = 0x1b7; +pub const XK_scaron: c_uint = 0x1b9; +pub const XK_scedilla: c_uint = 0x1ba; +pub const XK_tcaron: c_uint = 0x1bb; +pub const XK_zacute: c_uint = 0x1bc; +pub const XK_doubleacute: c_uint = 0x1bd; +pub const XK_zcaron: c_uint = 0x1be; +pub const XK_zabovedot: c_uint = 0x1bf; +pub const XK_Racute: c_uint = 0x1c0; +pub const XK_Abreve: c_uint = 0x1c3; +pub const XK_Lacute: c_uint = 0x1c5; +pub const XK_Cacute: c_uint = 0x1c6; +pub const XK_Ccaron: c_uint = 0x1c8; +pub const XK_Eogonek: c_uint = 0x1ca; +pub const XK_Ecaron: c_uint = 0x1cc; +pub const XK_Dcaron: c_uint = 0x1cf; +pub const XK_Dstroke: c_uint = 0x1d0; +pub const XK_Nacute: c_uint = 0x1d1; +pub const XK_Ncaron: c_uint = 0x1d2; +pub const XK_Odoubleacute: c_uint = 0x1d5; +pub const XK_Rcaron: c_uint = 0x1d8; +pub const XK_Uring: c_uint = 0x1d9; +pub const XK_Udoubleacute: c_uint = 0x1db; +pub const XK_Tcedilla: c_uint = 0x1de; +pub const XK_racute: c_uint = 0x1e0; +pub const XK_abreve: c_uint = 0x1e3; +pub const XK_lacute: c_uint = 0x1e5; +pub const XK_cacute: c_uint = 0x1e6; +pub const XK_ccaron: c_uint = 0x1e8; +pub const XK_eogonek: c_uint = 0x1ea; +pub const XK_ecaron: c_uint = 0x1ec; +pub const XK_dcaron: c_uint = 0x1ef; +pub const XK_dstroke: c_uint = 0x1f0; +pub const XK_nacute: c_uint = 0x1f1; +pub const XK_ncaron: c_uint = 0x1f2; +pub const XK_odoubleacute: c_uint = 0x1f5; +pub const XK_udoubleacute: c_uint = 0x1fb; +pub const XK_rcaron: c_uint = 0x1f8; +pub const XK_uring: c_uint = 0x1f9; +pub const XK_tcedilla: c_uint = 0x1fe; +pub const XK_abovedot: c_uint = 0x1ff; +pub const XK_Hstroke: c_uint = 0x2a1; +pub const XK_Hcircumflex: c_uint = 0x2a6; +pub const XK_Iabovedot: c_uint = 0x2a9; +pub const XK_Gbreve: c_uint = 0x2ab; +pub const XK_Jcircumflex: c_uint = 0x2ac; +pub const XK_hstroke: c_uint = 0x2b1; +pub const XK_hcircumflex: c_uint = 0x2b6; +pub const XK_idotless: c_uint = 0x2b9; +pub const XK_gbreve: c_uint = 0x2bb; +pub const XK_jcircumflex: c_uint = 0x2bc; +pub const XK_Cabovedot: c_uint = 0x2c5; +pub const XK_Ccircumflex: c_uint = 0x2c6; +pub const XK_Gabovedot: c_uint = 0x2d5; +pub const XK_Gcircumflex: c_uint = 0x2d8; +pub const XK_Ubreve: c_uint = 0x2dd; +pub const XK_Scircumflex: c_uint = 0x2de; +pub const XK_cabovedot: c_uint = 0x2e5; +pub const XK_ccircumflex: c_uint = 0x2e6; +pub const XK_gabovedot: c_uint = 0x2f5; +pub const XK_gcircumflex: c_uint = 0x2f8; +pub const XK_ubreve: c_uint = 0x2fd; +pub const XK_scircumflex: c_uint = 0x2fe; +pub const XK_kra: c_uint = 0x3a2; +pub const XK_kappa: c_uint = 0x3a2; +pub const XK_Rcedilla: c_uint = 0x3a3; +pub const XK_Itilde: c_uint = 0x3a5; +pub const XK_Lcedilla: c_uint = 0x3a6; +pub const XK_Emacron: c_uint = 0x3aa; +pub const XK_Gcedilla: c_uint = 0x3ab; +pub const XK_Tslash: c_uint = 0x3ac; +pub const XK_rcedilla: c_uint = 0x3b3; +pub const XK_itilde: c_uint = 0x3b5; +pub const XK_lcedilla: c_uint = 0x3b6; +pub const XK_emacron: c_uint = 0x3ba; +pub const XK_gcedilla: c_uint = 0x3bb; +pub const XK_tslash: c_uint = 0x3bc; +pub const XK_ENG: c_uint = 0x3bd; +pub const XK_eng: c_uint = 0x3bf; +pub const XK_Amacron: c_uint = 0x3c0; +pub const XK_Iogonek: c_uint = 0x3c7; +pub const XK_Eabovedot: c_uint = 0x3cc; +pub const XK_Imacron: c_uint = 0x3cf; +pub const XK_Ncedilla: c_uint = 0x3d1; +pub const XK_Omacron: c_uint = 0x3d2; +pub const XK_Kcedilla: c_uint = 0x3d3; +pub const XK_Uogonek: c_uint = 0x3d9; +pub const XK_Utilde: c_uint = 0x3dd; +pub const XK_Umacron: c_uint = 0x3de; +pub const XK_amacron: c_uint = 0x3e0; +pub const XK_iogonek: c_uint = 0x3e7; +pub const XK_eabovedot: c_uint = 0x3ec; +pub const XK_imacron: c_uint = 0x3ef; +pub const XK_ncedilla: c_uint = 0x3f1; +pub const XK_omacron: c_uint = 0x3f2; +pub const XK_kcedilla: c_uint = 0x3f3; +pub const XK_uogonek: c_uint = 0x3f9; +pub const XK_utilde: c_uint = 0x3fd; +pub const XK_umacron: c_uint = 0x3fe; +pub const XK_overline: c_uint = 0x47e; +pub const XK_kana_fullstop: c_uint = 0x4a1; +pub const XK_kana_openingbracket: c_uint = 0x4a2; +pub const XK_kana_closingbracket: c_uint = 0x4a3; +pub const XK_kana_comma: c_uint = 0x4a4; +pub const XK_kana_conjunctive: c_uint = 0x4a5; +pub const XK_kana_middledot: c_uint = 0x4a5; +pub const XK_kana_WO: c_uint = 0x4a6; +pub const XK_kana_a: c_uint = 0x4a7; +pub const XK_kana_i: c_uint = 0x4a8; +pub const XK_kana_u: c_uint = 0x4a9; +pub const XK_kana_e: c_uint = 0x4aa; +pub const XK_kana_o: c_uint = 0x4ab; +pub const XK_kana_ya: c_uint = 0x4ac; +pub const XK_kana_yu: c_uint = 0x4ad; +pub const XK_kana_yo: c_uint = 0x4ae; +pub const XK_kana_tsu: c_uint = 0x4af; +pub const XK_kana_tu: c_uint = 0x4af; +pub const XK_prolongedsound: c_uint = 0x4b0; +pub const XK_kana_A: c_uint = 0x4b1; +pub const XK_kana_I: c_uint = 0x4b2; +pub const XK_kana_U: c_uint = 0x4b3; +pub const XK_kana_E: c_uint = 0x4b4; +pub const XK_kana_O: c_uint = 0x4b5; +pub const XK_kana_KA: c_uint = 0x4b6; +pub const XK_kana_KI: c_uint = 0x4b7; +pub const XK_kana_KU: c_uint = 0x4b8; +pub const XK_kana_KE: c_uint = 0x4b9; +pub const XK_kana_KO: c_uint = 0x4ba; +pub const XK_kana_SA: c_uint = 0x4bb; +pub const XK_kana_SHI: c_uint = 0x4bc; +pub const XK_kana_SU: c_uint = 0x4bd; +pub const XK_kana_SE: c_uint = 0x4be; +pub const XK_kana_SO: c_uint = 0x4bf; +pub const XK_kana_TA: c_uint = 0x4c0; +pub const XK_kana_CHI: c_uint = 0x4c1; +pub const XK_kana_TI: c_uint = 0x4c1; +pub const XK_kana_TSU: c_uint = 0x4c2; +pub const XK_kana_TU: c_uint = 0x4c2; +pub const XK_kana_TE: c_uint = 0x4c3; +pub const XK_kana_TO: c_uint = 0x4c4; +pub const XK_kana_NA: c_uint = 0x4c5; +pub const XK_kana_NI: c_uint = 0x4c6; +pub const XK_kana_NU: c_uint = 0x4c7; +pub const XK_kana_NE: c_uint = 0x4c8; +pub const XK_kana_NO: c_uint = 0x4c9; +pub const XK_kana_HA: c_uint = 0x4ca; +pub const XK_kana_HI: c_uint = 0x4cb; +pub const XK_kana_FU: c_uint = 0x4cc; +pub const XK_kana_HU: c_uint = 0x4cc; +pub const XK_kana_HE: c_uint = 0x4cd; +pub const XK_kana_HO: c_uint = 0x4ce; +pub const XK_kana_MA: c_uint = 0x4cf; +pub const XK_kana_MI: c_uint = 0x4d0; +pub const XK_kana_MU: c_uint = 0x4d1; +pub const XK_kana_ME: c_uint = 0x4d2; +pub const XK_kana_MO: c_uint = 0x4d3; +pub const XK_kana_YA: c_uint = 0x4d4; +pub const XK_kana_YU: c_uint = 0x4d5; +pub const XK_kana_YO: c_uint = 0x4d6; +pub const XK_kana_RA: c_uint = 0x4d7; +pub const XK_kana_RI: c_uint = 0x4d8; +pub const XK_kana_RU: c_uint = 0x4d9; +pub const XK_kana_RE: c_uint = 0x4da; +pub const XK_kana_RO: c_uint = 0x4db; +pub const XK_kana_WA: c_uint = 0x4dc; +pub const XK_kana_N: c_uint = 0x4dd; +pub const XK_voicedsound: c_uint = 0x4de; +pub const XK_semivoicedsound: c_uint = 0x4df; +pub const XK_kana_switch: c_uint = 0xFF7E; +pub const XK_Arabic_comma: c_uint = 0x5ac; +pub const XK_Arabic_semicolon: c_uint = 0x5bb; +pub const XK_Arabic_question_mark: c_uint = 0x5bf; +pub const XK_Arabic_hamza: c_uint = 0x5c1; +pub const XK_Arabic_maddaonalef: c_uint = 0x5c2; +pub const XK_Arabic_hamzaonalef: c_uint = 0x5c3; +pub const XK_Arabic_hamzaonwaw: c_uint = 0x5c4; +pub const XK_Arabic_hamzaunderalef: c_uint = 0x5c5; +pub const XK_Arabic_hamzaonyeh: c_uint = 0x5c6; +pub const XK_Arabic_alef: c_uint = 0x5c7; +pub const XK_Arabic_beh: c_uint = 0x5c8; +pub const XK_Arabic_tehmarbuta: c_uint = 0x5c9; +pub const XK_Arabic_teh: c_uint = 0x5ca; +pub const XK_Arabic_theh: c_uint = 0x5cb; +pub const XK_Arabic_jeem: c_uint = 0x5cc; +pub const XK_Arabic_hah: c_uint = 0x5cd; +pub const XK_Arabic_khah: c_uint = 0x5ce; +pub const XK_Arabic_dal: c_uint = 0x5cf; +pub const XK_Arabic_thal: c_uint = 0x5d0; +pub const XK_Arabic_ra: c_uint = 0x5d1; +pub const XK_Arabic_zain: c_uint = 0x5d2; +pub const XK_Arabic_seen: c_uint = 0x5d3; +pub const XK_Arabic_sheen: c_uint = 0x5d4; +pub const XK_Arabic_sad: c_uint = 0x5d5; +pub const XK_Arabic_dad: c_uint = 0x5d6; +pub const XK_Arabic_tah: c_uint = 0x5d7; +pub const XK_Arabic_zah: c_uint = 0x5d8; +pub const XK_Arabic_ain: c_uint = 0x5d9; +pub const XK_Arabic_ghain: c_uint = 0x5da; +pub const XK_Arabic_tatweel: c_uint = 0x5e0; +pub const XK_Arabic_feh: c_uint = 0x5e1; +pub const XK_Arabic_qaf: c_uint = 0x5e2; +pub const XK_Arabic_kaf: c_uint = 0x5e3; +pub const XK_Arabic_lam: c_uint = 0x5e4; +pub const XK_Arabic_meem: c_uint = 0x5e5; +pub const XK_Arabic_noon: c_uint = 0x5e6; +pub const XK_Arabic_ha: c_uint = 0x5e7; +pub const XK_Arabic_heh: c_uint = 0x5e7; +pub const XK_Arabic_waw: c_uint = 0x5e8; +pub const XK_Arabic_alefmaksura: c_uint = 0x5e9; +pub const XK_Arabic_yeh: c_uint = 0x5ea; +pub const XK_Arabic_fathatan: c_uint = 0x5eb; +pub const XK_Arabic_dammatan: c_uint = 0x5ec; +pub const XK_Arabic_kasratan: c_uint = 0x5ed; +pub const XK_Arabic_fatha: c_uint = 0x5ee; +pub const XK_Arabic_damma: c_uint = 0x5ef; +pub const XK_Arabic_kasra: c_uint = 0x5f0; +pub const XK_Arabic_shadda: c_uint = 0x5f1; +pub const XK_Arabic_sukun: c_uint = 0x5f2; +pub const XK_Arabic_switch: c_uint = 0xFF7E; +pub const XK_Serbian_dje: c_uint = 0x6a1; +pub const XK_Macedonia_gje: c_uint = 0x6a2; +pub const XK_Cyrillic_io: c_uint = 0x6a3; +pub const XK_Ukrainian_ie: c_uint = 0x6a4; +pub const XK_Ukranian_je: c_uint = 0x6a4; +pub const XK_Macedonia_dse: c_uint = 0x6a5; +pub const XK_Ukrainian_i: c_uint = 0x6a6; +pub const XK_Ukranian_i: c_uint = 0x6a6; +pub const XK_Ukrainian_yi: c_uint = 0x6a7; +pub const XK_Ukranian_yi: c_uint = 0x6a7; +pub const XK_Cyrillic_je: c_uint = 0x6a8; +pub const XK_Serbian_je: c_uint = 0x6a8; +pub const XK_Cyrillic_lje: c_uint = 0x6a9; +pub const XK_Serbian_lje: c_uint = 0x6a9; +pub const XK_Cyrillic_nje: c_uint = 0x6aa; +pub const XK_Serbian_nje: c_uint = 0x6aa; +pub const XK_Serbian_tshe: c_uint = 0x6ab; +pub const XK_Macedonia_kje: c_uint = 0x6ac; +pub const XK_Byelorussian_shortu: c_uint = 0x6ae; +pub const XK_Cyrillic_dzhe: c_uint = 0x6af; +pub const XK_Serbian_dze: c_uint = 0x6af; +pub const XK_numerosign: c_uint = 0x6b0; +pub const XK_Serbian_DJE: c_uint = 0x6b1; +pub const XK_Macedonia_GJE: c_uint = 0x6b2; +pub const XK_Cyrillic_IO: c_uint = 0x6b3; +pub const XK_Ukrainian_IE: c_uint = 0x6b4; +pub const XK_Ukranian_JE: c_uint = 0x6b4; +pub const XK_Macedonia_DSE: c_uint = 0x6b5; +pub const XK_Ukrainian_I: c_uint = 0x6b6; +pub const XK_Ukranian_I: c_uint = 0x6b6; +pub const XK_Ukrainian_YI: c_uint = 0x6b7; +pub const XK_Ukranian_YI: c_uint = 0x6b7; +pub const XK_Cyrillic_JE: c_uint = 0x6b8; +pub const XK_Serbian_JE: c_uint = 0x6b8; +pub const XK_Cyrillic_LJE: c_uint = 0x6b9; +pub const XK_Serbian_LJE: c_uint = 0x6b9; +pub const XK_Cyrillic_NJE: c_uint = 0x6ba; +pub const XK_Serbian_NJE: c_uint = 0x6ba; +pub const XK_Serbian_TSHE: c_uint = 0x6bb; +pub const XK_Macedonia_KJE: c_uint = 0x6bc; +pub const XK_Byelorussian_SHORTU: c_uint = 0x6be; +pub const XK_Cyrillic_DZHE: c_uint = 0x6bf; +pub const XK_Serbian_DZE: c_uint = 0x6bf; +pub const XK_Cyrillic_yu: c_uint = 0x6c0; +pub const XK_Cyrillic_a: c_uint = 0x6c1; +pub const XK_Cyrillic_be: c_uint = 0x6c2; +pub const XK_Cyrillic_tse: c_uint = 0x6c3; +pub const XK_Cyrillic_de: c_uint = 0x6c4; +pub const XK_Cyrillic_ie: c_uint = 0x6c5; +pub const XK_Cyrillic_ef: c_uint = 0x6c6; +pub const XK_Cyrillic_ghe: c_uint = 0x6c7; +pub const XK_Cyrillic_ha: c_uint = 0x6c8; +pub const XK_Cyrillic_i: c_uint = 0x6c9; +pub const XK_Cyrillic_shorti: c_uint = 0x6ca; +pub const XK_Cyrillic_ka: c_uint = 0x6cb; +pub const XK_Cyrillic_el: c_uint = 0x6cc; +pub const XK_Cyrillic_em: c_uint = 0x6cd; +pub const XK_Cyrillic_en: c_uint = 0x6ce; +pub const XK_Cyrillic_o: c_uint = 0x6cf; +pub const XK_Cyrillic_pe: c_uint = 0x6d0; +pub const XK_Cyrillic_ya: c_uint = 0x6d1; +pub const XK_Cyrillic_er: c_uint = 0x6d2; +pub const XK_Cyrillic_es: c_uint = 0x6d3; +pub const XK_Cyrillic_te: c_uint = 0x6d4; +pub const XK_Cyrillic_u: c_uint = 0x6d5; +pub const XK_Cyrillic_zhe: c_uint = 0x6d6; +pub const XK_Cyrillic_ve: c_uint = 0x6d7; +pub const XK_Cyrillic_softsign: c_uint = 0x6d8; +pub const XK_Cyrillic_yeru: c_uint = 0x6d9; +pub const XK_Cyrillic_ze: c_uint = 0x6da; +pub const XK_Cyrillic_sha: c_uint = 0x6db; +pub const XK_Cyrillic_e: c_uint = 0x6dc; +pub const XK_Cyrillic_shcha: c_uint = 0x6dd; +pub const XK_Cyrillic_che: c_uint = 0x6de; +pub const XK_Cyrillic_hardsign: c_uint = 0x6df; +pub const XK_Cyrillic_YU: c_uint = 0x6e0; +pub const XK_Cyrillic_A: c_uint = 0x6e1; +pub const XK_Cyrillic_BE: c_uint = 0x6e2; +pub const XK_Cyrillic_TSE: c_uint = 0x6e3; +pub const XK_Cyrillic_DE: c_uint = 0x6e4; +pub const XK_Cyrillic_IE: c_uint = 0x6e5; +pub const XK_Cyrillic_EF: c_uint = 0x6e6; +pub const XK_Cyrillic_GHE: c_uint = 0x6e7; +pub const XK_Cyrillic_HA: c_uint = 0x6e8; +pub const XK_Cyrillic_I: c_uint = 0x6e9; +pub const XK_Cyrillic_SHORTI: c_uint = 0x6ea; +pub const XK_Cyrillic_KA: c_uint = 0x6eb; +pub const XK_Cyrillic_EL: c_uint = 0x6ec; +pub const XK_Cyrillic_EM: c_uint = 0x6ed; +pub const XK_Cyrillic_EN: c_uint = 0x6ee; +pub const XK_Cyrillic_O: c_uint = 0x6ef; +pub const XK_Cyrillic_PE: c_uint = 0x6f0; +pub const XK_Cyrillic_YA: c_uint = 0x6f1; +pub const XK_Cyrillic_ER: c_uint = 0x6f2; +pub const XK_Cyrillic_ES: c_uint = 0x6f3; +pub const XK_Cyrillic_TE: c_uint = 0x6f4; +pub const XK_Cyrillic_U: c_uint = 0x6f5; +pub const XK_Cyrillic_ZHE: c_uint = 0x6f6; +pub const XK_Cyrillic_VE: c_uint = 0x6f7; +pub const XK_Cyrillic_SOFTSIGN: c_uint = 0x6f8; +pub const XK_Cyrillic_YERU: c_uint = 0x6f9; +pub const XK_Cyrillic_ZE: c_uint = 0x6fa; +pub const XK_Cyrillic_SHA: c_uint = 0x6fb; +pub const XK_Cyrillic_E: c_uint = 0x6fc; +pub const XK_Cyrillic_SHCHA: c_uint = 0x6fd; +pub const XK_Cyrillic_CHE: c_uint = 0x6fe; +pub const XK_Cyrillic_HARDSIGN: c_uint = 0x6ff; +pub const XK_Greek_ALPHAaccent: c_uint = 0x7a1; +pub const XK_Greek_EPSILONaccent: c_uint = 0x7a2; +pub const XK_Greek_ETAaccent: c_uint = 0x7a3; +pub const XK_Greek_IOTAaccent: c_uint = 0x7a4; +pub const XK_Greek_IOTAdiaeresis: c_uint = 0x7a5; +pub const XK_Greek_OMICRONaccent: c_uint = 0x7a7; +pub const XK_Greek_UPSILONaccent: c_uint = 0x7a8; +pub const XK_Greek_UPSILONdieresis: c_uint = 0x7a9; +pub const XK_Greek_OMEGAaccent: c_uint = 0x7ab; +pub const XK_Greek_accentdieresis: c_uint = 0x7ae; +pub const XK_Greek_horizbar: c_uint = 0x7af; +pub const XK_Greek_alphaaccent: c_uint = 0x7b1; +pub const XK_Greek_epsilonaccent: c_uint = 0x7b2; +pub const XK_Greek_etaaccent: c_uint = 0x7b3; +pub const XK_Greek_iotaaccent: c_uint = 0x7b4; +pub const XK_Greek_iotadieresis: c_uint = 0x7b5; +pub const XK_Greek_iotaaccentdieresis: c_uint = 0x7b6; +pub const XK_Greek_omicronaccent: c_uint = 0x7b7; +pub const XK_Greek_upsilonaccent: c_uint = 0x7b8; +pub const XK_Greek_upsilondieresis: c_uint = 0x7b9; +pub const XK_Greek_upsilonaccentdieresis: c_uint = 0x7ba; +pub const XK_Greek_omegaaccent: c_uint = 0x7bb; +pub const XK_Greek_ALPHA: c_uint = 0x7c1; +pub const XK_Greek_BETA: c_uint = 0x7c2; +pub const XK_Greek_GAMMA: c_uint = 0x7c3; +pub const XK_Greek_DELTA: c_uint = 0x7c4; +pub const XK_Greek_EPSILON: c_uint = 0x7c5; +pub const XK_Greek_ZETA: c_uint = 0x7c6; +pub const XK_Greek_ETA: c_uint = 0x7c7; +pub const XK_Greek_THETA: c_uint = 0x7c8; +pub const XK_Greek_IOTA: c_uint = 0x7c9; +pub const XK_Greek_KAPPA: c_uint = 0x7ca; +pub const XK_Greek_LAMDA: c_uint = 0x7cb; +pub const XK_Greek_LAMBDA: c_uint = 0x7cb; +pub const XK_Greek_MU: c_uint = 0x7cc; +pub const XK_Greek_NU: c_uint = 0x7cd; +pub const XK_Greek_XI: c_uint = 0x7ce; +pub const XK_Greek_OMICRON: c_uint = 0x7cf; +pub const XK_Greek_PI: c_uint = 0x7d0; +pub const XK_Greek_RHO: c_uint = 0x7d1; +pub const XK_Greek_SIGMA: c_uint = 0x7d2; +pub const XK_Greek_TAU: c_uint = 0x7d4; +pub const XK_Greek_UPSILON: c_uint = 0x7d5; +pub const XK_Greek_PHI: c_uint = 0x7d6; +pub const XK_Greek_CHI: c_uint = 0x7d7; +pub const XK_Greek_PSI: c_uint = 0x7d8; +pub const XK_Greek_OMEGA: c_uint = 0x7d9; +pub const XK_Greek_alpha: c_uint = 0x7e1; +pub const XK_Greek_beta: c_uint = 0x7e2; +pub const XK_Greek_gamma: c_uint = 0x7e3; +pub const XK_Greek_delta: c_uint = 0x7e4; +pub const XK_Greek_epsilon: c_uint = 0x7e5; +pub const XK_Greek_zeta: c_uint = 0x7e6; +pub const XK_Greek_eta: c_uint = 0x7e7; +pub const XK_Greek_theta: c_uint = 0x7e8; +pub const XK_Greek_iota: c_uint = 0x7e9; +pub const XK_Greek_kappa: c_uint = 0x7ea; +pub const XK_Greek_lamda: c_uint = 0x7eb; +pub const XK_Greek_lambda: c_uint = 0x7eb; +pub const XK_Greek_mu: c_uint = 0x7ec; +pub const XK_Greek_nu: c_uint = 0x7ed; +pub const XK_Greek_xi: c_uint = 0x7ee; +pub const XK_Greek_omicron: c_uint = 0x7ef; +pub const XK_Greek_pi: c_uint = 0x7f0; +pub const XK_Greek_rho: c_uint = 0x7f1; +pub const XK_Greek_sigma: c_uint = 0x7f2; +pub const XK_Greek_finalsmallsigma: c_uint = 0x7f3; +pub const XK_Greek_tau: c_uint = 0x7f4; +pub const XK_Greek_upsilon: c_uint = 0x7f5; +pub const XK_Greek_phi: c_uint = 0x7f6; +pub const XK_Greek_chi: c_uint = 0x7f7; +pub const XK_Greek_psi: c_uint = 0x7f8; +pub const XK_Greek_omega: c_uint = 0x7f9; +pub const XK_Greek_switch: c_uint = 0xFF7E; +pub const XK_leftradical: c_uint = 0x8a1; +pub const XK_topleftradical: c_uint = 0x8a2; +pub const XK_horizconnector: c_uint = 0x8a3; +pub const XK_topintegral: c_uint = 0x8a4; +pub const XK_botintegral: c_uint = 0x8a5; +pub const XK_vertconnector: c_uint = 0x8a6; +pub const XK_topleftsqbracket: c_uint = 0x8a7; +pub const XK_botleftsqbracket: c_uint = 0x8a8; +pub const XK_toprightsqbracket: c_uint = 0x8a9; +pub const XK_botrightsqbracket: c_uint = 0x8aa; +pub const XK_topleftparens: c_uint = 0x8ab; +pub const XK_botleftparens: c_uint = 0x8ac; +pub const XK_toprightparens: c_uint = 0x8ad; +pub const XK_botrightparens: c_uint = 0x8ae; +pub const XK_leftmiddlecurlybrace: c_uint = 0x8af; +pub const XK_rightmiddlecurlybrace: c_uint = 0x8b0; +pub const XK_topleftsummation: c_uint = 0x8b1; +pub const XK_botleftsummation: c_uint = 0x8b2; +pub const XK_topvertsummationconnector: c_uint = 0x8b3; +pub const XK_botvertsummationconnector: c_uint = 0x8b4; +pub const XK_toprightsummation: c_uint = 0x8b5; +pub const XK_botrightsummation: c_uint = 0x8b6; +pub const XK_rightmiddlesummation: c_uint = 0x8b7; +pub const XK_lessthanequal: c_uint = 0x8bc; +pub const XK_notequal: c_uint = 0x8bd; +pub const XK_greaterthanequal: c_uint = 0x8be; +pub const XK_integral: c_uint = 0x8bf; +pub const XK_therefore: c_uint = 0x8c0; +pub const XK_variation: c_uint = 0x8c1; +pub const XK_infinity: c_uint = 0x8c2; +pub const XK_nabla: c_uint = 0x8c5; +pub const XK_approximate: c_uint = 0x8c8; +pub const XK_similarequal: c_uint = 0x8c9; +pub const XK_ifonlyif: c_uint = 0x8cd; +pub const XK_implies: c_uint = 0x8ce; +pub const XK_identical: c_uint = 0x8cf; +pub const XK_radical: c_uint = 0x8d6; +pub const XK_includedin: c_uint = 0x8da; +pub const XK_includes: c_uint = 0x8db; +pub const XK_intersection: c_uint = 0x8dc; +pub const XK_union: c_uint = 0x8dd; +pub const XK_logicaland: c_uint = 0x8de; +pub const XK_logicalor: c_uint = 0x8df; +pub const XK_partialderivative: c_uint = 0x8ef; +pub const XK_function: c_uint = 0x8f6; +pub const XK_leftarrow: c_uint = 0x8fb; +pub const XK_uparrow: c_uint = 0x8fc; +pub const XK_rightarrow: c_uint = 0x8fd; +pub const XK_downarrow: c_uint = 0x8fe; +pub const XK_blank: c_uint = 0x9df; +pub const XK_soliddiamond: c_uint = 0x9e0; +pub const XK_checkerboard: c_uint = 0x9e1; +pub const XK_ht: c_uint = 0x9e2; +pub const XK_ff: c_uint = 0x9e3; +pub const XK_cr: c_uint = 0x9e4; +pub const XK_lf: c_uint = 0x9e5; +pub const XK_nl: c_uint = 0x9e8; +pub const XK_vt: c_uint = 0x9e9; +pub const XK_lowrightcorner: c_uint = 0x9ea; +pub const XK_uprightcorner: c_uint = 0x9eb; +pub const XK_upleftcorner: c_uint = 0x9ec; +pub const XK_lowleftcorner: c_uint = 0x9ed; +pub const XK_crossinglines: c_uint = 0x9ee; +pub const XK_horizlinescan1: c_uint = 0x9ef; +pub const XK_horizlinescan3: c_uint = 0x9f0; +pub const XK_horizlinescan5: c_uint = 0x9f1; +pub const XK_horizlinescan7: c_uint = 0x9f2; +pub const XK_horizlinescan9: c_uint = 0x9f3; +pub const XK_leftt: c_uint = 0x9f4; +pub const XK_rightt: c_uint = 0x9f5; +pub const XK_bott: c_uint = 0x9f6; +pub const XK_topt: c_uint = 0x9f7; +pub const XK_vertbar: c_uint = 0x9f8; +pub const XK_emspace: c_uint = 0xaa1; +pub const XK_enspace: c_uint = 0xaa2; +pub const XK_em3space: c_uint = 0xaa3; +pub const XK_em4space: c_uint = 0xaa4; +pub const XK_digitspace: c_uint = 0xaa5; +pub const XK_punctspace: c_uint = 0xaa6; +pub const XK_thinspace: c_uint = 0xaa7; +pub const XK_hairspace: c_uint = 0xaa8; +pub const XK_emdash: c_uint = 0xaa9; +pub const XK_endash: c_uint = 0xaaa; +pub const XK_signifblank: c_uint = 0xaac; +pub const XK_ellipsis: c_uint = 0xaae; +pub const XK_doubbaselinedot: c_uint = 0xaaf; +pub const XK_onethird: c_uint = 0xab0; +pub const XK_twothirds: c_uint = 0xab1; +pub const XK_onefifth: c_uint = 0xab2; +pub const XK_twofifths: c_uint = 0xab3; +pub const XK_threefifths: c_uint = 0xab4; +pub const XK_fourfifths: c_uint = 0xab5; +pub const XK_onesixth: c_uint = 0xab6; +pub const XK_fivesixths: c_uint = 0xab7; +pub const XK_careof: c_uint = 0xab8; +pub const XK_figdash: c_uint = 0xabb; +pub const XK_leftanglebracket: c_uint = 0xabc; +pub const XK_decimalpoint: c_uint = 0xabd; +pub const XK_rightanglebracket: c_uint = 0xabe; +pub const XK_marker: c_uint = 0xabf; +pub const XK_oneeighth: c_uint = 0xac3; +pub const XK_threeeighths: c_uint = 0xac4; +pub const XK_fiveeighths: c_uint = 0xac5; +pub const XK_seveneighths: c_uint = 0xac6; +pub const XK_trademark: c_uint = 0xac9; +pub const XK_signaturemark: c_uint = 0xaca; +pub const XK_trademarkincircle: c_uint = 0xacb; +pub const XK_leftopentriangle: c_uint = 0xacc; +pub const XK_rightopentriangle: c_uint = 0xacd; +pub const XK_emopencircle: c_uint = 0xace; +pub const XK_emopenrectangle: c_uint = 0xacf; +pub const XK_leftsinglequotemark: c_uint = 0xad0; +pub const XK_rightsinglequotemark: c_uint = 0xad1; +pub const XK_leftdoublequotemark: c_uint = 0xad2; +pub const XK_rightdoublequotemark: c_uint = 0xad3; +pub const XK_prescription: c_uint = 0xad4; +pub const XK_minutes: c_uint = 0xad6; +pub const XK_seconds: c_uint = 0xad7; +pub const XK_latincross: c_uint = 0xad9; +pub const XK_hexagram: c_uint = 0xada; +pub const XK_filledrectbullet: c_uint = 0xadb; +pub const XK_filledlefttribullet: c_uint = 0xadc; +pub const XK_filledrighttribullet: c_uint = 0xadd; +pub const XK_emfilledcircle: c_uint = 0xade; +pub const XK_emfilledrect: c_uint = 0xadf; +pub const XK_enopencircbullet: c_uint = 0xae0; +pub const XK_enopensquarebullet: c_uint = 0xae1; +pub const XK_openrectbullet: c_uint = 0xae2; +pub const XK_opentribulletup: c_uint = 0xae3; +pub const XK_opentribulletdown: c_uint = 0xae4; +pub const XK_openstar: c_uint = 0xae5; +pub const XK_enfilledcircbullet: c_uint = 0xae6; +pub const XK_enfilledsqbullet: c_uint = 0xae7; +pub const XK_filledtribulletup: c_uint = 0xae8; +pub const XK_filledtribulletdown: c_uint = 0xae9; +pub const XK_leftpointer: c_uint = 0xaea; +pub const XK_rightpointer: c_uint = 0xaeb; +pub const XK_club: c_uint = 0xaec; +pub const XK_diamond: c_uint = 0xaed; +pub const XK_heart: c_uint = 0xaee; +pub const XK_maltesecross: c_uint = 0xaf0; +pub const XK_dagger: c_uint = 0xaf1; +pub const XK_doubledagger: c_uint = 0xaf2; +pub const XK_checkmark: c_uint = 0xaf3; +pub const XK_ballotcross: c_uint = 0xaf4; +pub const XK_musicalsharp: c_uint = 0xaf5; +pub const XK_musicalflat: c_uint = 0xaf6; +pub const XK_malesymbol: c_uint = 0xaf7; +pub const XK_femalesymbol: c_uint = 0xaf8; +pub const XK_telephone: c_uint = 0xaf9; +pub const XK_telephonerecorder: c_uint = 0xafa; +pub const XK_phonographcopyright: c_uint = 0xafb; +pub const XK_caret: c_uint = 0xafc; +pub const XK_singlelowquotemark: c_uint = 0xafd; +pub const XK_doublelowquotemark: c_uint = 0xafe; +pub const XK_cursor: c_uint = 0xaff; +pub const XK_leftcaret: c_uint = 0xba3; +pub const XK_rightcaret: c_uint = 0xba6; +pub const XK_downcaret: c_uint = 0xba8; +pub const XK_upcaret: c_uint = 0xba9; +pub const XK_overbar: c_uint = 0xbc0; +pub const XK_downtack: c_uint = 0xbc2; +pub const XK_upshoe: c_uint = 0xbc3; +pub const XK_downstile: c_uint = 0xbc4; +pub const XK_underbar: c_uint = 0xbc6; +pub const XK_jot: c_uint = 0xbca; +pub const XK_quad: c_uint = 0xbcc; +pub const XK_uptack: c_uint = 0xbce; +pub const XK_circle: c_uint = 0xbcf; +pub const XK_upstile: c_uint = 0xbd3; +pub const XK_downshoe: c_uint = 0xbd6; +pub const XK_rightshoe: c_uint = 0xbd8; +pub const XK_leftshoe: c_uint = 0xbda; +pub const XK_lefttack: c_uint = 0xbdc; +pub const XK_righttack: c_uint = 0xbfc; +pub const XK_hebrew_doublelowline: c_uint = 0xcdf; +pub const XK_hebrew_aleph: c_uint = 0xce0; +pub const XK_hebrew_bet: c_uint = 0xce1; +pub const XK_hebrew_beth: c_uint = 0xce1; +pub const XK_hebrew_gimel: c_uint = 0xce2; +pub const XK_hebrew_gimmel: c_uint = 0xce2; +pub const XK_hebrew_dalet: c_uint = 0xce3; +pub const XK_hebrew_daleth: c_uint = 0xce3; +pub const XK_hebrew_he: c_uint = 0xce4; +pub const XK_hebrew_waw: c_uint = 0xce5; +pub const XK_hebrew_zain: c_uint = 0xce6; +pub const XK_hebrew_zayin: c_uint = 0xce6; +pub const XK_hebrew_chet: c_uint = 0xce7; +pub const XK_hebrew_het: c_uint = 0xce7; +pub const XK_hebrew_tet: c_uint = 0xce8; +pub const XK_hebrew_teth: c_uint = 0xce8; +pub const XK_hebrew_yod: c_uint = 0xce9; +pub const XK_hebrew_finalkaph: c_uint = 0xcea; +pub const XK_hebrew_kaph: c_uint = 0xceb; +pub const XK_hebrew_lamed: c_uint = 0xcec; +pub const XK_hebrew_finalmem: c_uint = 0xced; +pub const XK_hebrew_mem: c_uint = 0xcee; +pub const XK_hebrew_finalnun: c_uint = 0xcef; +pub const XK_hebrew_nun: c_uint = 0xcf0; +pub const XK_hebrew_samech: c_uint = 0xcf1; +pub const XK_hebrew_samekh: c_uint = 0xcf1; +pub const XK_hebrew_ayin: c_uint = 0xcf2; +pub const XK_hebrew_finalpe: c_uint = 0xcf3; +pub const XK_hebrew_pe: c_uint = 0xcf4; +pub const XK_hebrew_finalzade: c_uint = 0xcf5; +pub const XK_hebrew_finalzadi: c_uint = 0xcf5; +pub const XK_hebrew_zade: c_uint = 0xcf6; +pub const XK_hebrew_zadi: c_uint = 0xcf6; +pub const XK_hebrew_qoph: c_uint = 0xcf7; +pub const XK_hebrew_kuf: c_uint = 0xcf7; +pub const XK_hebrew_resh: c_uint = 0xcf8; +pub const XK_hebrew_shin: c_uint = 0xcf9; +pub const XK_hebrew_taw: c_uint = 0xcfa; +pub const XK_hebrew_taf: c_uint = 0xcfa; +pub const XK_Hebrew_switch: c_uint = 0xFF7E; + +pub const XF86XK_ModeLock: c_uint = 0x1008FF01; +pub const XF86XK_MonBrightnessUp: c_uint = 0x1008FF02; +pub const XF86XK_MonBrightnessDown: c_uint = 0x1008FF03; +pub const XF86XK_KbdLightOnOff: c_uint = 0x1008FF04; +pub const XF86XK_KbdBrightnessUp: c_uint = 0x1008FF05; +pub const XF86XK_KbdBrightnessDown: c_uint = 0x1008FF06; +pub const XF86XK_Standby: c_uint = 0x1008FF10; +pub const XF86XK_AudioLowerVolume: c_uint = 0x1008FF11; +pub const XF86XK_AudioMute: c_uint = 0x1008FF12; +pub const XF86XK_AudioRaiseVolume: c_uint = 0x1008FF13; +pub const XF86XK_AudioPlay: c_uint = 0x1008FF14; +pub const XF86XK_AudioStop: c_uint = 0x1008FF15; +pub const XF86XK_AudioPrev: c_uint = 0x1008FF16; +pub const XF86XK_AudioNext: c_uint = 0x1008FF17; +pub const XF86XK_HomePage: c_uint = 0x1008FF18; +pub const XF86XK_Mail: c_uint = 0x1008FF19; +pub const XF86XK_Start: c_uint = 0x1008FF1A; +pub const XF86XK_Search: c_uint = 0x1008FF1B; +pub const XF86XK_AudioRecord: c_uint = 0x1008FF1C; +pub const XF86XK_Calculator: c_uint = 0x1008FF1D; +pub const XF86XK_Memo: c_uint = 0x1008FF1E; +pub const XF86XK_ToDoList: c_uint = 0x1008FF1F; +pub const XF86XK_Calendar: c_uint = 0x1008FF20; +pub const XF86XK_PowerDown: c_uint = 0x1008FF21; +pub const XF86XK_ContrastAdjust: c_uint = 0x1008FF22; +pub const XF86XK_RockerUp: c_uint = 0x1008FF23; +pub const XF86XK_RockerDown: c_uint = 0x1008FF24; +pub const XF86XK_RockerEnter: c_uint = 0x1008FF25; +pub const XF86XK_Back: c_uint = 0x1008FF26; +pub const XF86XK_Forward: c_uint = 0x1008FF27; +pub const XF86XK_Stop: c_uint = 0x1008FF28; +pub const XF86XK_Refresh: c_uint = 0x1008FF29; +pub const XF86XK_PowerOff: c_uint = 0x1008FF2A; +pub const XF86XK_WakeUp: c_uint = 0x1008FF2B; +pub const XF86XK_Eject: c_uint = 0x1008FF2C; +pub const XF86XK_ScreenSaver: c_uint = 0x1008FF2D; +pub const XF86XK_WWW: c_uint = 0x1008FF2E; +pub const XF86XK_Sleep: c_uint = 0x1008FF2F; +pub const XF86XK_Favorites: c_uint = 0x1008FF30; +pub const XF86XK_AudioPause: c_uint = 0x1008FF31; +pub const XF86XK_AudioMedia: c_uint = 0x1008FF32; +pub const XF86XK_MyComputer: c_uint = 0x1008FF33; +pub const XF86XK_VendorHome: c_uint = 0x1008FF34; +pub const XF86XK_LightBulb: c_uint = 0x1008FF35; +pub const XF86XK_Shop: c_uint = 0x1008FF36; +pub const XF86XK_History: c_uint = 0x1008FF37; +pub const XF86XK_OpenURL: c_uint = 0x1008FF38; +pub const XF86XK_AddFavorite: c_uint = 0x1008FF39; +pub const XF86XK_HotLinks: c_uint = 0x1008FF3A; +pub const XF86XK_BrightnessAdjust: c_uint = 0x1008FF3B; +pub const XF86XK_Finance: c_uint = 0x1008FF3C; +pub const XF86XK_Community: c_uint = 0x1008FF3D; +pub const XF86XK_AudioRewind: c_uint = 0x1008FF3E; +pub const XF86XK_BackForward: c_uint = 0x1008FF3F; +pub const XF86XK_Launch0: c_uint = 0x1008FF40; +pub const XF86XK_Launch1: c_uint = 0x1008FF41; +pub const XF86XK_Launch2: c_uint = 0x1008FF42; +pub const XF86XK_Launch3: c_uint = 0x1008FF43; +pub const XF86XK_Launch4: c_uint = 0x1008FF44; +pub const XF86XK_Launch5: c_uint = 0x1008FF45; +pub const XF86XK_Launch6: c_uint = 0x1008FF46; +pub const XF86XK_Launch7: c_uint = 0x1008FF47; +pub const XF86XK_Launch8: c_uint = 0x1008FF48; +pub const XF86XK_Launch9: c_uint = 0x1008FF49; +pub const XF86XK_LaunchA: c_uint = 0x1008FF4A; +pub const XF86XK_LaunchB: c_uint = 0x1008FF4B; +pub const XF86XK_LaunchC: c_uint = 0x1008FF4C; +pub const XF86XK_LaunchD: c_uint = 0x1008FF4D; +pub const XF86XK_LaunchE: c_uint = 0x1008FF4E; +pub const XF86XK_LaunchF: c_uint = 0x1008FF4F; +pub const XF86XK_ApplicationLeft: c_uint = 0x1008FF50; +pub const XF86XK_ApplicationRight: c_uint = 0x1008FF51; +pub const XF86XK_Book: c_uint = 0x1008FF52; +pub const XF86XK_CD: c_uint = 0x1008FF53; +pub const XF86XK_Calculater: c_uint = 0x1008FF54; +pub const XF86XK_Clear: c_uint = 0x1008FF55; +pub const XF86XK_Close: c_uint = 0x1008FF56; +pub const XF86XK_Copy: c_uint = 0x1008FF57; +pub const XF86XK_Cut: c_uint = 0x1008FF58; +pub const XF86XK_Display: c_uint = 0x1008FF59; +pub const XF86XK_DOS: c_uint = 0x1008FF5A; +pub const XF86XK_Documents: c_uint = 0x1008FF5B; +pub const XF86XK_Excel: c_uint = 0x1008FF5C; +pub const XF86XK_Explorer: c_uint = 0x1008FF5D; +pub const XF86XK_Game: c_uint = 0x1008FF5E; +pub const XF86XK_Go: c_uint = 0x1008FF5F; +pub const XF86XK_iTouch: c_uint = 0x1008FF60; +pub const XF86XK_LogOff: c_uint = 0x1008FF61; +pub const XF86XK_Market: c_uint = 0x1008FF62; +pub const XF86XK_Meeting: c_uint = 0x1008FF63; +pub const XF86XK_MenuKB: c_uint = 0x1008FF65; +pub const XF86XK_MenuPB: c_uint = 0x1008FF66; +pub const XF86XK_MySites: c_uint = 0x1008FF67; +pub const XF86XK_New: c_uint = 0x1008FF68; +pub const XF86XK_News: c_uint = 0x1008FF69; +pub const XF86XK_OfficeHome: c_uint = 0x1008FF6A; +pub const XF86XK_Open: c_uint = 0x1008FF6B; +pub const XF86XK_Option: c_uint = 0x1008FF6C; +pub const XF86XK_Paste: c_uint = 0x1008FF6D; +pub const XF86XK_Phone: c_uint = 0x1008FF6E; +pub const XF86XK_Q: c_uint = 0x1008FF70; +pub const XF86XK_Reply: c_uint = 0x1008FF72; +pub const XF86XK_Reload: c_uint = 0x1008FF73; +pub const XF86XK_RotateWindows: c_uint = 0x1008FF74; +pub const XF86XK_RotationPB: c_uint = 0x1008FF75; +pub const XF86XK_RotationKB: c_uint = 0x1008FF76; +pub const XF86XK_Save: c_uint = 0x1008FF77; +pub const XF86XK_ScrollUp: c_uint = 0x1008FF78; +pub const XF86XK_ScrollDown: c_uint = 0x1008FF79; +pub const XF86XK_ScrollClick: c_uint = 0x1008FF7A; +pub const XF86XK_Send: c_uint = 0x1008FF7B; +pub const XF86XK_Spell: c_uint = 0x1008FF7C; +pub const XF86XK_SplitScreen: c_uint = 0x1008FF7D; +pub const XF86XK_Support: c_uint = 0x1008FF7E; +pub const XF86XK_TaskPane: c_uint = 0x1008FF7F; +pub const XF86XK_Terminal: c_uint = 0x1008FF80; +pub const XF86XK_Tools: c_uint = 0x1008FF81; +pub const XF86XK_Travel: c_uint = 0x1008FF82; +pub const XF86XK_UserPB: c_uint = 0x1008FF84; +pub const XF86XK_User1KB: c_uint = 0x1008FF85; +pub const XF86XK_User2KB: c_uint = 0x1008FF86; +pub const XF86XK_Video: c_uint = 0x1008FF87; +pub const XF86XK_WheelButton: c_uint = 0x1008FF88; +pub const XF86XK_Word: c_uint = 0x1008FF89; +pub const XF86XK_Xfer: c_uint = 0x1008FF8A; +pub const XF86XK_ZoomIn: c_uint = 0x1008FF8B; +pub const XF86XK_ZoomOut: c_uint = 0x1008FF8C; +pub const XF86XK_Away: c_uint = 0x1008FF8D; +pub const XF86XK_Messenger: c_uint = 0x1008FF8E; +pub const XF86XK_WebCam: c_uint = 0x1008FF8F; +pub const XF86XK_MailForward: c_uint = 0x1008FF90; +pub const XF86XK_Pictures: c_uint = 0x1008FF91; +pub const XF86XK_Music: c_uint = 0x1008FF92; +pub const XF86XK_Battery: c_uint = 0x1008FF93; +pub const XF86XK_Bluetooth: c_uint = 0x1008FF94; +pub const XF86XK_WLAN: c_uint = 0x1008FF95; +pub const XF86XK_UWB: c_uint = 0x1008FF96; +pub const XF86XK_AudioForward: c_uint = 0x1008FF97; +pub const XF86XK_AudioRepeat: c_uint = 0x1008FF98; +pub const XF86XK_AudioRandomPlay: c_uint = 0x1008FF99; +pub const XF86XK_Subtitle: c_uint = 0x1008FF9A; +pub const XF86XK_AudioCycleTrack: c_uint = 0x1008FF9B; +pub const XF86XK_CycleAngle: c_uint = 0x1008FF9C; +pub const XF86XK_FrameBack: c_uint = 0x1008FF9D; +pub const XF86XK_FrameForward: c_uint = 0x1008FF9E; +pub const XF86XK_Time: c_uint = 0x1008FF9F; +pub const XF86XK_Select: c_uint = 0x1008FFA0; +pub const XF86XK_View: c_uint = 0x1008FFA1; +pub const XF86XK_TopMenu: c_uint = 0x1008FFA2; +pub const XF86XK_Red: c_uint = 0x1008FFA3; +pub const XF86XK_Green: c_uint = 0x1008FFA4; +pub const XF86XK_Yellow: c_uint = 0x1008FFA5; +pub const XF86XK_Blue: c_uint = 0x1008FFA6; +pub const XF86XK_Suspend: c_uint = 0x1008FFA7; +pub const XF86XK_Hibernate: c_uint = 0x1008FFA8; +pub const XF86XK_TouchpadToggle: c_uint = 0x1008FFA9; +pub const XF86XK_TouchpadOn: c_uint = 0x1008FFB0; +pub const XF86XK_TouchpadOff: c_uint = 0x1008FFB1; +pub const XF86XK_AudioMicMute: c_uint = 0x1008FFB2; +pub const XF86XK_Switch_VT_1: c_uint = 0x1008FE01; +pub const XF86XK_Switch_VT_2: c_uint = 0x1008FE02; +pub const XF86XK_Switch_VT_3: c_uint = 0x1008FE03; +pub const XF86XK_Switch_VT_4: c_uint = 0x1008FE04; +pub const XF86XK_Switch_VT_5: c_uint = 0x1008FE05; +pub const XF86XK_Switch_VT_6: c_uint = 0x1008FE06; +pub const XF86XK_Switch_VT_7: c_uint = 0x1008FE07; +pub const XF86XK_Switch_VT_8: c_uint = 0x1008FE08; +pub const XF86XK_Switch_VT_9: c_uint = 0x1008FE09; +pub const XF86XK_Switch_VT_10: c_uint = 0x1008FE0A; +pub const XF86XK_Switch_VT_11: c_uint = 0x1008FE0B; +pub const XF86XK_Switch_VT_12: c_uint = 0x1008FE0C; +pub const XF86XK_Ungrab: c_uint = 0x1008FE20; +pub const XF86XK_ClearGrab: c_uint = 0x1008FE21; +pub const XF86XK_Next_VMode: c_uint = 0x1008FE22; +pub const XF86XK_Prev_VMode: c_uint = 0x1008FE23; +pub const XF86XK_LogWindowTree: c_uint = 0x1008FE24; +pub const XF86XK_LogGrabInfo: c_uint = 0x1008FE25; + +pub const XK_ISO_Lock: c_uint = 0xfe01; +pub const XK_ISO_Level2_Latch: c_uint = 0xfe02; +pub const XK_ISO_Level3_Shift: c_uint = 0xfe03; +pub const XK_ISO_Level3_Latch: c_uint = 0xfe04; +pub const XK_ISO_Level3_Lock: c_uint = 0xfe05; +pub const XK_ISO_Level5_Shift: c_uint = 0xfe11; +pub const XK_ISO_Level5_Latch: c_uint = 0xfe12; +pub const XK_ISO_Level5_Lock: c_uint = 0xfe13; +pub const XK_ISO_Group_Shift: c_uint = 0xff7e; +pub const XK_ISO_Group_Latch: c_uint = 0xfe06; +pub const XK_ISO_Group_Lock: c_uint = 0xfe07; +pub const XK_ISO_Next_Group: c_uint = 0xfe08; +pub const XK_ISO_Next_Group_Lock: c_uint = 0xfe09; +pub const XK_ISO_Prev_Group: c_uint = 0xfe0a; +pub const XK_ISO_Prev_Group_Lock: c_uint = 0xfe0b; +pub const XK_ISO_First_Group: c_uint = 0xfe0c; +pub const XK_ISO_First_Group_Lock: c_uint = 0xfe0d; +pub const XK_ISO_Last_Group: c_uint = 0xfe0e; +pub const XK_ISO_Last_Group_Lock: c_uint = 0xfe0f; + +pub const XK_ISO_Left_Tab: c_uint = 0xfe20; +pub const XK_ISO_Move_Line_Up: c_uint = 0xfe21; +pub const XK_ISO_Move_Line_Down: c_uint = 0xfe22; +pub const XK_ISO_Partial_Line_Up: c_uint = 0xfe23; +pub const XK_ISO_Partial_Line_Down: c_uint = 0xfe24; +pub const XK_ISO_Partial_Space_Left: c_uint = 0xfe25; +pub const XK_ISO_Partial_Space_Right: c_uint = 0xfe26; +pub const XK_ISO_Set_Margin_Left: c_uint = 0xfe27; +pub const XK_ISO_Set_Margin_Right: c_uint = 0xfe28; +pub const XK_ISO_Release_Margin_Left: c_uint = 0xfe29; +pub const XK_ISO_Release_Margin_Right: c_uint = 0xfe2a; +pub const XK_ISO_Release_Both_Margins: c_uint = 0xfe2b; +pub const XK_ISO_Fast_Cursor_Left: c_uint = 0xfe2c; +pub const XK_ISO_Fast_Cursor_Right: c_uint = 0xfe2d; +pub const XK_ISO_Fast_Cursor_Up: c_uint = 0xfe2e; +pub const XK_ISO_Fast_Cursor_Down: c_uint = 0xfe2f; +pub const XK_ISO_Continuous_Underline: c_uint = 0xfe30; +pub const XK_ISO_Discontinuous_Underline: c_uint = 0xfe31; +pub const XK_ISO_Emphasize: c_uint = 0xfe32; +pub const XK_ISO_Center_Object: c_uint = 0xfe33; +pub const XK_ISO_Enter: c_uint = 0xfe34; + +pub const XK_dead_grave: c_uint = 0xfe50; +pub const XK_dead_acute: c_uint = 0xfe51; +pub const XK_dead_circumflex: c_uint = 0xfe52; +pub const XK_dead_tilde: c_uint = 0xfe53; +pub const XK_dead_perispomeni: c_uint = 0xfe53; +pub const XK_dead_macron: c_uint = 0xfe54; +pub const XK_dead_breve: c_uint = 0xfe55; +pub const XK_dead_abovedot: c_uint = 0xfe56; +pub const XK_dead_diaeresis: c_uint = 0xfe57; +pub const XK_dead_abovering: c_uint = 0xfe58; +pub const XK_dead_doubleacute: c_uint = 0xfe59; +pub const XK_dead_caron: c_uint = 0xfe5a; +pub const XK_dead_cedilla: c_uint = 0xfe5b; +pub const XK_dead_ogonek: c_uint = 0xfe5c; +pub const XK_dead_iota: c_uint = 0xfe5d; +pub const XK_dead_voiced_sound: c_uint = 0xfe5e; +pub const XK_dead_semivoiced_sound: c_uint = 0xfe5f; +pub const XK_dead_belowdot: c_uint = 0xfe60; +pub const XK_dead_hook: c_uint = 0xfe61; +pub const XK_dead_horn: c_uint = 0xfe62; +pub const XK_dead_stroke: c_uint = 0xfe63; +pub const XK_dead_abovecomma: c_uint = 0xfe64; +pub const XK_dead_psili: c_uint = 0xfe64; +pub const XK_dead_abovereversedcomma: c_uint = 0xfe65; +pub const XK_dead_dasia: c_uint = 0xfe65; +pub const XK_dead_doublegrave: c_uint = 0xfe66; +pub const XK_dead_belowring: c_uint = 0xfe67; +pub const XK_dead_belowmacron: c_uint = 0xfe68; +pub const XK_dead_belowcircumflex: c_uint = 0xfe69; +pub const XK_dead_belowtilde: c_uint = 0xfe6a; +pub const XK_dead_belowbreve: c_uint = 0xfe6b; +pub const XK_dead_belowdiaeresis: c_uint = 0xfe6c; +pub const XK_dead_invertedbreve: c_uint = 0xfe6d; +pub const XK_dead_belowcomma: c_uint = 0xfe6e; +pub const XK_dead_currency: c_uint = 0xfe6f; + +pub const XK_dead_lowline: c_uint = 0xfe90; +pub const XK_dead_aboveverticalline: c_uint = 0xfe91; +pub const XK_dead_belowverticalline: c_uint = 0xfe92; +pub const XK_dead_longsolidusoverlay: c_uint = 0xfe93; + +pub const XK_dead_a: c_uint = 0xfe80; +pub const XK_dead_A: c_uint = 0xfe81; +pub const XK_dead_e: c_uint = 0xfe82; +pub const XK_dead_E: c_uint = 0xfe83; +pub const XK_dead_i: c_uint = 0xfe84; +pub const XK_dead_I: c_uint = 0xfe85; +pub const XK_dead_o: c_uint = 0xfe86; +pub const XK_dead_O: c_uint = 0xfe87; +pub const XK_dead_u: c_uint = 0xfe88; +pub const XK_dead_U: c_uint = 0xfe89; +pub const XK_dead_small_schwa: c_uint = 0xfe8a; +pub const XK_dead_capital_schwa: c_uint = 0xfe8b; + +pub const XK_dead_greek: c_uint = 0xfe8c; + +pub const XK_First_Virtual_Screen: c_uint = 0xfed0; +pub const XK_Prev_Virtual_Screen: c_uint = 0xfed1; +pub const XK_Next_Virtual_Screen: c_uint = 0xfed2; +pub const XK_Last_Virtual_Screen: c_uint = 0xfed4; +pub const XK_Terminate_Server: c_uint = 0xfed5; + +pub const XK_AccessX_Enable: c_uint = 0xfe70; +pub const XK_AccessX_Feedback_Enable: c_uint = 0xfe71; +pub const XK_RepeatKeys_Enable: c_uint = 0xfe72; +pub const XK_SlowKeys_Enable: c_uint = 0xfe73; +pub const XK_BounceKeys_Enable: c_uint = 0xfe74; +pub const XK_StickyKeys_Enable: c_uint = 0xfe75; +pub const XK_MouseKeys_Enable: c_uint = 0xfe76; +pub const XK_MouseKeys_Accel_Enable: c_uint = 0xfe77; +pub const XK_Overlay1_Enable: c_uint = 0xfe78; +pub const XK_Overlay2_Enable: c_uint = 0xfe79; +pub const XK_AudibleBell_Enable: c_uint = 0xfe7a; + +pub const XK_Pointer_Left: c_uint = 0xfee0; +pub const XK_Pointer_Right: c_uint = 0xfee1; +pub const XK_Pointer_Up: c_uint = 0xfee2; +pub const XK_Pointer_Down: c_uint = 0xfee3; +pub const XK_Pointer_UpLeft: c_uint = 0xfee4; +pub const XK_Pointer_UpRight: c_uint = 0xfee5; +pub const XK_Pointer_DownLeft: c_uint = 0xfee6; +pub const XK_Pointer_DownRight: c_uint = 0xfee7; +pub const XK_Pointer_Button_Dflt: c_uint = 0xfee8; +pub const XK_Pointer_Button1: c_uint = 0xfee9; +pub const XK_Pointer_Button2: c_uint = 0xfeea; +pub const XK_Pointer_Button3: c_uint = 0xfeeb; +pub const XK_Pointer_Button4: c_uint = 0xfeec; +pub const XK_Pointer_Button5: c_uint = 0xfeed; +pub const XK_Pointer_DblClick_Dflt: c_uint = 0xfeee; +pub const XK_Pointer_DblClick1: c_uint = 0xfeef; +pub const XK_Pointer_DblClick2: c_uint = 0xfef0; +pub const XK_Pointer_DblClick3: c_uint = 0xfef1; +pub const XK_Pointer_DblClick4: c_uint = 0xfef2; +pub const XK_Pointer_DblClick5: c_uint = 0xfef3; +pub const XK_Pointer_Drag_Dflt: c_uint = 0xfef4; +pub const XK_Pointer_Drag1: c_uint = 0xfef5; +pub const XK_Pointer_Drag2: c_uint = 0xfef6; +pub const XK_Pointer_Drag3: c_uint = 0xfef7; +pub const XK_Pointer_Drag4: c_uint = 0xfef8; +pub const XK_Pointer_Drag5: c_uint = 0xfefd; + +pub const XK_Pointer_EnableKeys: c_uint = 0xfef9; +pub const XK_Pointer_Accelerate: c_uint = 0xfefa; +pub const XK_Pointer_DfltBtnNext: c_uint = 0xfefb; +pub const XK_Pointer_DfltBtnPrev: c_uint = 0xfefc; + +pub const XK_ch: c_uint = 0xfea0; +pub const XK_Ch: c_uint = 0xfea1; +pub const XK_CH: c_uint = 0xfea2; +pub const XK_c_h: c_uint = 0xfea3; +pub const XK_C_h: c_uint = 0xfea4; +pub const XK_C_H: c_uint = 0xfea5; diff --git a/third_party/rust/x11/src/lib.rs b/third_party/rust/x11/src/lib.rs new file mode 100644 index 000000000000..f31ccb074777 --- /dev/null +++ b/third_party/rust/x11/src/lib.rs @@ -0,0 +1,37 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(improper_ctypes)] + +extern crate libc; + +#[macro_use] +mod link; +mod internal; + +#[macro_use] +pub mod xlib; + +pub mod dpms; +pub mod glx; +pub mod keysym; +pub mod xcursor; +pub mod xf86vmode; +pub mod xfixes; +pub mod xft; +pub mod xinerama; +pub mod xinput; +pub mod xinput2; +pub mod xmd; +pub mod xmu; +pub mod xrandr; +pub mod xrecord; +pub mod xrender; +pub mod xss; +pub mod xt; +pub mod xtest; +pub mod xlib_xcb; diff --git a/third_party/rust/x11/src/link.rs b/third_party/rust/x11/src/link.rs new file mode 100644 index 000000000000..30e6b2a70e13 --- /dev/null +++ b/third_party/rust/x11/src/link.rs @@ -0,0 +1,22 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +macro_rules! x11_link { + { $struct_name:ident, $pkg_name:expr, [$($lib_name:expr),*], $nsyms:expr, + $(pub fn $fn_name:ident ($($param_name:ident : $param_type:ty),*) -> $ret_type:ty,)* + variadic: + $(pub fn $vfn_name:ident ($($vparam_name: ident : $vparam_type:ty),+) -> $vret_type:ty,)* + globals: + $(pub static $var_name:ident : $var_type:ty,)* + } => { + extern "C" { + $(pub fn $fn_name ($($param_name : $param_type),*) -> $ret_type;)* + $(pub fn $vfn_name ($($vparam_name : $vparam_type),+, ...) -> $vret_type;)* + } + + extern { + $(pub static $var_name : $var_type;)* + } + } +} diff --git a/third_party/rust/x11/src/xcursor.rs b/third_party/rust/x11/src/xcursor.rs new file mode 100644 index 000000000000..5efe3ccb21c9 --- /dev/null +++ b/third_party/rust/x11/src/xcursor.rs @@ -0,0 +1,211 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_int, + c_long, + c_uchar, + c_uint, + c_ulong, + c_void, +}; +use libc::FILE; + +use ::xlib::{ + Cursor, + Display, + XColor, + XImage, +}; + + +// +// functions +// + + +x11_link! { Xcursor, xcursor, ["libXcursor.so.1", "libXcursor.so"], 59, + pub fn XcursorAnimateCreate (_1: *mut XcursorCursors) -> *mut XcursorAnimate, + pub fn XcursorAnimateDestroy (_1: *mut XcursorAnimate) -> (), + pub fn XcursorAnimateNext (_1: *mut XcursorAnimate) -> c_ulong, + pub fn XcursorCommentCreate (_2: c_uint, _1: c_int) -> *mut XcursorComment, + pub fn XcursorCommentDestroy (_1: *mut XcursorComment) -> (), + pub fn XcursorCommentsCreate (_1: c_int) -> *mut XcursorComments, + pub fn XcursorCommentsDestroy (_1: *mut XcursorComments) -> (), + pub fn XcursorCursorsCreate (_2: *mut Display, _1: c_int) -> *mut XcursorCursors, + pub fn XcursorCursorsDestroy (_1: *mut XcursorCursors) -> (), + pub fn XcursorFileLoad (_3: *mut FILE, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int, + pub fn XcursorFileLoadAllImages (_1: *mut FILE) -> *mut XcursorImages, + pub fn XcursorFileLoadImage (_2: *mut FILE, _1: c_int) -> *mut XcursorImage, + pub fn XcursorFileLoadImages (_2: *mut FILE, _1: c_int) -> *mut XcursorImages, + pub fn XcursorFilenameLoad (_3: *const c_char, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int, + pub fn XcursorFilenameLoadAllImages (_1: *const c_char) -> *mut XcursorImages, + pub fn XcursorFilenameLoadCursor (_2: *mut Display, _1: *const c_char) -> c_ulong, + pub fn XcursorFilenameLoadCursors (_2: *mut Display, _1: *const c_char) -> *mut XcursorCursors, + pub fn XcursorFilenameLoadImage (_2: *const c_char, _1: c_int) -> *mut XcursorImage, + pub fn XcursorFilenameLoadImages (_2: *const c_char, _1: c_int) -> *mut XcursorImages, + pub fn XcursorFilenameSave (_3: *const c_char, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int, + pub fn XcursorFilenameSaveImages (_2: *const c_char, _1: *const XcursorImages) -> c_int, + pub fn XcursorFileSave (_3: *mut FILE, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int, + pub fn XcursorFileSaveImages (_2: *mut FILE, _1: *const XcursorImages) -> c_int, + pub fn XcursorGetDefaultSize (_1: *mut Display) -> c_int, + pub fn XcursorGetTheme (_1: *mut Display) -> *mut c_char, + pub fn XcursorGetThemeCore (_1: *mut Display) -> c_int, + pub fn XcursorImageCreate (_2: c_int, _1: c_int) -> *mut XcursorImage, + pub fn XcursorImageDestroy (_1: *mut XcursorImage) -> (), + pub fn XcursorImageHash (_2: *mut XImage, _1: *mut c_uchar) -> (), + pub fn XcursorImageLoadCursor (_2: *mut Display, _1: *const XcursorImage) -> c_ulong, + pub fn XcursorImagesCreate (_1: c_int) -> *mut XcursorImages, + pub fn XcursorImagesDestroy (_1: *mut XcursorImages) -> (), + pub fn XcursorImagesLoadCursor (_2: *mut Display, _1: *const XcursorImages) -> c_ulong, + pub fn XcursorImagesLoadCursors (_2: *mut Display, _1: *const XcursorImages) -> *mut XcursorCursors, + pub fn XcursorImagesSetName (_2: *mut XcursorImages, _1: *const c_char) -> (), + pub fn XcursorLibraryLoadCursor (_2: *mut Display, _1: *const c_char) -> c_ulong, + pub fn XcursorLibraryLoadCursors (_2: *mut Display, _1: *const c_char) -> *mut XcursorCursors, + pub fn XcursorLibraryLoadImage (_3: *const c_char, _2: *const c_char, _1: c_int) -> *mut XcursorImage, + pub fn XcursorLibraryLoadImages (_3: *const c_char, _2: *const c_char, _1: c_int) -> *mut XcursorImages, + pub fn XcursorLibraryPath () -> *const c_char, + pub fn XcursorLibraryShape (_1: *const c_char) -> c_int, + pub fn XcursorNoticeCreateBitmap (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: c_uint) -> (), + pub fn XcursorNoticePutBitmap (_3: *mut Display, _2: c_ulong, _1: *mut XImage) -> (), + pub fn XcursorSetDefaultSize (_2: *mut Display, _1: c_int) -> c_int, + pub fn XcursorSetTheme (_2: *mut Display, _1: *const c_char) -> c_int, + pub fn XcursorSetThemeCore (_2: *mut Display, _1: c_int) -> c_int, + pub fn XcursorShapeLoadCursor (_2: *mut Display, _1: c_uint) -> c_ulong, + pub fn XcursorShapeLoadCursors (_2: *mut Display, _1: c_uint) -> *mut XcursorCursors, + pub fn XcursorShapeLoadImage (_3: c_uint, _2: *const c_char, _1: c_int) -> *mut XcursorImage, + pub fn XcursorShapeLoadImages (_3: c_uint, _2: *const c_char, _1: c_int) -> *mut XcursorImages, + pub fn XcursorSupportsAnim (_1: *mut Display) -> c_int, + pub fn XcursorSupportsARGB (_1: *mut Display) -> c_int, + pub fn XcursorTryShapeBitmapCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: *mut XColor, _3: *mut XColor, _2: c_uint, _1: c_uint) -> c_ulong, + pub fn XcursorTryShapeCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *const XColor, _1: *const XColor) -> c_ulong, + pub fn XcursorXcFileLoad (_3: *mut XcursorFile, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int, + pub fn XcursorXcFileLoadAllImages (_1: *mut XcursorFile) -> *mut XcursorImages, + pub fn XcursorXcFileLoadImage (_2: *mut XcursorFile, _1: c_int) -> *mut XcursorImage, + pub fn XcursorXcFileLoadImages (_2: *mut XcursorFile, _1: c_int) -> *mut XcursorImages, + pub fn XcursorXcFileSave (_3: *mut XcursorFile, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int, +variadic: +globals: +} + + +// +// types +// + + +pub type XcursorBool = c_int; +pub type XcursorDim = XcursorUInt; +pub type XcursorPixel = XcursorUInt; +pub type XcursorUInt = c_uint; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorAnimate { + pub cursors: *mut XcursorCursors, + pub sequence: c_int, +} +pub type XcursorAnimate = _XcursorAnimate; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorChunkHeader { + pub header: XcursorUInt, + pub type_: XcursorUInt, + pub subtype: XcursorUInt, + pub version: XcursorUInt, +} +pub type XcursorChunkHeader = _XcursorChunkHeader; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorComment { + pub version: XcursorUInt, + pub comment_type: XcursorUInt, + pub comment: *mut c_char, +} +pub type XcursorComment = _XcursorComment; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorComments { + pub ncomment: c_int, + pub comments: *mut *mut XcursorComment, +} +pub type XcursorComments = _XcursorComments; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorCursors { + pub dpy: *mut Display, + pub ref_: c_int, + pub ncursor: c_int, + pub cursors: *mut Cursor, +} +pub type XcursorCursors = _XcursorCursors; + +#[derive(Copy)] +#[repr(C)] +pub struct _XcursorFile { + pub closure: *mut c_void, + pub read: Option c_int>, + pub write: Option c_int>, + pub seek: Option c_int>, +} +pub type XcursorFile = _XcursorFile; + +impl Clone for _XcursorFile { + fn clone (&self) -> _XcursorFile { + _XcursorFile { + closure: self.closure, + read: self.read, + write: self.write, + seek: self.seek, + } + } +} + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorFileHeader { + pub magic: XcursorUInt, + pub header: XcursorUInt, + pub version: XcursorUInt, + pub ntoc: XcursorUInt, + pub tocs: *mut XcursorFileToc, +} +pub type XcursorFileHeader = _XcursorFileHeader; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorFileToc { + pub type_: XcursorUInt, + pub subtype: XcursorUInt, + pub position: XcursorUInt, +} +pub type XcursorFileToc = _XcursorFileToc; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorImage { + pub version: XcursorUInt, + pub size: XcursorDim, + pub width: XcursorDim, + pub height: XcursorDim, + pub xhot: XcursorDim, + pub yhot: XcursorDim, + pub delay: XcursorUInt, + pub pixels: *mut XcursorPixel, +} +pub type XcursorImage = _XcursorImage; + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct _XcursorImages { + pub nimage: c_int, + pub images: *mut *mut XcursorImage, + pub name: *mut c_char, +} +pub type XcursorImages = _XcursorImages; diff --git a/third_party/rust/x11/src/xf86vmode.rs b/third_party/rust/x11/src/xf86vmode.rs new file mode 100644 index 000000000000..53d6e2ca8010 --- /dev/null +++ b/third_party/rust/x11/src/xf86vmode.rs @@ -0,0 +1,149 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_float, + c_int, + c_uchar, + c_uint, + c_ulong, + c_ushort, +}; + +use std::mem; +use ::internal::transmute_union; + +use ::xlib::{ + Bool, + Display, + Time, + Window, + XEvent, +}; + + +// +// functions +// + + +x11_link! { Xf86vmode, xxf86vm, ["libXxf86vm.so.1", "libXxf86vm.so"], 22, + pub fn XF86VidModeAddModeLine (_4: *mut Display, _3: c_int, _2: *mut XF86VidModeModeInfo, _1: *mut XF86VidModeModeInfo) -> c_int, + pub fn XF86VidModeDeleteModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int, + pub fn XF86VidModeGetAllModeLines (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut *mut *mut XF86VidModeModeInfo) -> c_int, + pub fn XF86VidModeGetDotClocks (_6: *mut Display, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut *mut c_int) -> c_int, + pub fn XF86VidModeGetGamma (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeGamma) -> c_int, + pub fn XF86VidModeGetGammaRamp (_6: *mut Display, _5: c_int, _4: c_int, _3: *mut c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> c_int, + pub fn XF86VidModeGetGammaRampSize (_3: *mut Display, _2: c_int, _1: *mut c_int) -> c_int, + pub fn XF86VidModeGetModeLine (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut XF86VidModeModeLine) -> c_int, + pub fn XF86VidModeGetMonitor (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeMonitor) -> c_int, + pub fn XF86VidModeGetPermissions (_3: *mut Display, _2: c_int, _1: *mut c_int) -> c_int, + pub fn XF86VidModeGetViewPort (_4: *mut Display, _3: c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XF86VidModeLockModeSwitch (_3: *mut Display, _2: c_int, _1: c_int) -> c_int, + pub fn XF86VidModeModModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeLine) -> c_int, + pub fn XF86VidModeQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XF86VidModeQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XF86VidModeSetClientVersion (_1: *mut Display) -> c_int, + pub fn XF86VidModeSetGamma (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeGamma) -> c_int, + pub fn XF86VidModeSetGammaRamp (_6: *mut Display, _5: c_int, _4: c_int, _3: *mut c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> c_int, + pub fn XF86VidModeSetViewPort (_4: *mut Display, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XF86VidModeSwitchMode (_3: *mut Display, _2: c_int, _1: c_int) -> c_int, + pub fn XF86VidModeSwitchToMode (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int, + pub fn XF86VidModeValidateModeLine (_3: *mut Display, _2: c_int, _1: *mut XF86VidModeModeInfo) -> c_int, +variadic: +globals: +} + + +// +// types +// + + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct XF86VidModeGamma { + pub red: c_float, + pub green: c_float, + pub blue: c_float, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XF86VidModeModeInfo { + pub dotclock: c_uint, + pub hdisplay: c_ushort, + pub hsyncstart: c_ushort, + pub hsyncend: c_ushort, + pub htotal: c_ushort, + pub hskew: c_ushort, + pub vdisplay: c_ushort, + pub vsyncstart: c_ushort, + pub vsyncend: c_ushort, + pub vtotal: c_ushort, + pub flags: c_uint, + pub privsize: c_int, + pub private: *mut i32, +} + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct XF86VidModeModeLine { + pub hdisplay: c_ushort, + pub hsyncstart: c_ushort, + pub hsyncend: c_ushort, + pub htotal: c_ushort, + pub hskew: c_ushort, + pub vdisplay: c_ushort, + pub vsyncstart: c_ushort, + pub vsyncend: c_ushort, + pub vtotal: c_ushort, + pub flags: c_uint, + pub privsize: c_int, + pub private: *mut i32, +} + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct XF86VidModeMonitor { + pub vendor: *mut c_char, + pub model: *mut c_char, + pub EMPTY: c_float, + pub nhsync: c_uchar, + pub hsync: *mut XF86VidModeSyncRange, + pub nvsync: c_uchar, + pub vsync: *mut XF86VidModeSyncRange, +} + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct XF86VidModeSyncRange { + pub hi: c_float, + pub lo: c_float, +} + + +// +// event structures +// + + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct XF86VidModeNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub root: Window, + pub state: c_int, + pub kind: c_int, + pub forced: bool, + pub time: Time, +} + +event_conversions_and_tests! { + XF86VidModeNotifyEvent, +} diff --git a/third_party/rust/x11/src/xfixes.rs b/third_party/rust/x11/src/xfixes.rs new file mode 100644 index 000000000000..0277cbfa299f --- /dev/null +++ b/third_party/rust/x11/src/xfixes.rs @@ -0,0 +1,13 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use ::xlib::XID; + + +// +// types +// + + +pub type PointerBarrier = XID; diff --git a/third_party/rust/x11/src/xft.rs b/third_party/rust/x11/src/xft.rs new file mode 100644 index 000000000000..986c79293bed --- /dev/null +++ b/third_party/rust/x11/src/xft.rs @@ -0,0 +1,219 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::*; + +use xlib::{Display, Region, Visual, XRectangle}; +use xrender::{XGlyphInfo, XRenderColor}; + + +// +// external types +// + + +// freetype +pub enum FT_FaceRec {} +pub type FT_UInt = c_uint; + +// fontconfig +pub type FcChar32 = c_uint; +pub enum FcCharSet {} +pub enum FcPattern {} + +#[repr(C)] +pub enum FcEndian { Big, Little } + +#[repr(C)] +pub enum FcResult { Match, NoMatch, TypeMismatch, NoId, OutOfMemory } + + +// +// functions +// + + +x11_link! { Xft, xft, ["libXft.so.2", "libXft.so"], 77, + pub fn XftCharExists (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_int, + pub fn XftCharFontSpecRender (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftCharFontSpec, _0: c_int) -> (), + pub fn XftCharIndex (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_uint, + pub fn XftCharSpecRender (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *mut XftFont, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftCharSpec, _0: c_int) -> (), + pub fn XftColorAllocName (_4: *mut Display, _3: *const Visual, _2: c_ulong, _1: *const c_char, _0: *mut XftColor) -> c_int, + pub fn XftColorAllocValue (_4: *mut Display, _3: *mut Visual, _2: c_ulong, _1: *const XRenderColor, _0: *mut XftColor) -> c_int, + pub fn XftColorFree (_3: *mut Display, _2: *mut Visual, _1: c_ulong, _0: *mut XftColor) -> (), + pub fn XftDefaultHasRender (_0: *mut Display) -> c_int, + pub fn XftDefaultSet (_1: *mut Display, _0: *mut FcPattern) -> c_int, + pub fn XftDefaultSubstitute (_2: *mut Display, _1: c_int, _0: *mut FcPattern) -> (), + pub fn XftDrawChange (_1: *mut XftDraw, _0: c_ulong) -> (), + pub fn XftDrawCharFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftCharFontSpec, _0: c_int) -> (), + pub fn XftDrawCharSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftCharSpec, _0: c_int) -> (), + pub fn XftDrawColormap (_0: *mut XftDraw) -> c_ulong, + pub fn XftDrawCreate (_3: *mut Display, _2: c_ulong, _1: *mut Visual, _0: c_ulong) -> *mut XftDraw, + pub fn XftDrawCreateAlpha (_2: *mut Display, _1: c_ulong, _0: c_int) -> *mut XftDraw, + pub fn XftDrawCreateBitmap (_1: *mut Display, _0: c_ulong) -> *mut XftDraw, + pub fn XftDrawDestroy (_0: *mut XftDraw) -> (), + pub fn XftDrawDisplay (_0: *mut XftDraw) -> *mut Display, + pub fn XftDrawDrawable (_0: *mut XftDraw) -> c_ulong, + pub fn XftDrawGlyphFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftGlyphFontSpec, _0: c_int) -> (), + pub fn XftDrawGlyphs (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (), + pub fn XftDrawGlyphSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftGlyphSpec, _0: c_int) -> (), + pub fn XftDrawPicture (_0: *mut XftDraw) -> c_ulong, + pub fn XftDrawRect (_5: *mut XftDraw, _4: *const XftColor, _3: c_int, _2: c_int, _1: c_uint, _0: c_uint) -> (), + pub fn XftDrawSetClip (_1: *mut XftDraw, _0: Region) -> c_int, + pub fn XftDrawSetClipRectangles (_4: *mut XftDraw, _3: c_int, _2: c_int, _1: *const XRectangle, _0: c_int) -> c_int, + pub fn XftDrawSetSubwindowMode (_1: *mut XftDraw, _0: c_int) -> (), + pub fn XftDrawSrcPicture (_1: *mut XftDraw, _0: *const XftColor) -> c_ulong, + pub fn XftDrawString16 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_ushort, _0: c_int) -> (), + pub fn XftDrawString32 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (), + pub fn XftDrawString8 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftDrawStringUtf16 (_7: *mut XftDraw, _6: *const XftColor, _5: *mut XftFont, _4: c_int, _3: c_int, _2: *const c_uchar, _1: FcEndian, _0: c_int) -> (), + pub fn XftDrawStringUtf8 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftDrawVisual (_0: *mut XftDraw) -> *mut Visual, + pub fn XftFontCheckGlyph (_5: *mut Display, _4: *mut XftFont, _3: c_int, _2: c_uint, _1: *mut c_uint, _0: *mut c_int) -> c_int, + pub fn XftFontClose (_1: *mut Display, _0: *mut XftFont) -> (), + pub fn XftFontCopy (_1: *mut Display, _0: *mut XftFont) -> *mut XftFont, + pub fn XftFontInfoCreate (_1: *mut Display, _0: *const FcPattern) -> *mut XftFontInfo, + pub fn XftFontInfoDestroy (_1: *mut Display, _0: *mut XftFontInfo) -> (), + pub fn XftFontInfoEqual (_1: *const XftFontInfo, _0: *const XftFontInfo) -> c_int, + pub fn XftFontInfoHash (_0: *const XftFontInfo) -> c_uint, + pub fn XftFontLoadGlyphs (_4: *mut Display, _3: *mut XftFont, _2: c_int, _1: *const c_uint, _0: c_int) -> (), + pub fn XftFontMatch (_3: *mut Display, _2: c_int, _1: *const FcPattern, _0: *mut FcResult) -> *mut FcPattern, + pub fn XftFontOpenInfo (_2: *mut Display, _1: *mut FcPattern, _0: *mut XftFontInfo) -> *mut XftFont, + pub fn XftFontOpenName (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont, + pub fn XftFontOpenPattern (_1: *mut Display, _0: *mut FcPattern) -> *mut XftFont, + pub fn XftFontOpenXlfd (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont, + pub fn XftFontUnloadGlyphs (_3: *mut Display, _2: *mut XftFont, _1: *const c_uint, _0: c_int) -> (), + pub fn XftGetVersion () -> c_int, + pub fn XftGlyphExtents (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (), + pub fn XftGlyphFontSpecRender (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftGlyphFontSpec, _0: c_int) -> (), + pub fn XftGlyphRender (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (), + pub fn XftGlyphSpecRender (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *mut XftFont, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftGlyphSpec, _0: c_int) -> (), + pub fn XftInit (_0: *const c_char) -> c_int, + pub fn XftInitFtLibrary () -> c_int, + pub fn XftLockFace (_0: *mut XftFont) -> *mut FT_FaceRec, + pub fn XftNameParse (_0: *const c_char) -> *mut FcPattern, + pub fn XftNameUnparse (_2: *mut FcPattern, _1: *mut c_char, _0: c_int) -> c_int, + pub fn XftTextExtents16 (_4: *mut Display, _3: *mut XftFont, _2: *const c_ushort, _1: c_int, _0: *mut XGlyphInfo) -> (), + pub fn XftTextExtents32 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (), + pub fn XftTextExtents8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (), + pub fn XftTextExtentsUtf16 (_5: *mut Display, _4: *mut XftFont, _3: *const c_uchar, _2: FcEndian, _1: c_int, _0: *mut XGlyphInfo) -> (), + pub fn XftTextExtentsUtf8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (), + pub fn XftTextRender16 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_ushort, _0: c_int) -> (), + pub fn XftTextRender16BE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftTextRender16LE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftTextRender32 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (), + pub fn XftTextRender32BE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftTextRender32LE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftTextRender8 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftTextRenderUtf16 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: *mut XftFont, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_uchar, _1: FcEndian, _0: c_int) -> (), + pub fn XftTextRenderUtf8 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (), + pub fn XftUnlockFace (_0: *mut XftFont) -> (), + pub fn XftXlfdParse (_2: *const c_char, _1: c_int, _0: c_int) -> *mut FcPattern, +variadic: + pub fn XftFontOpen (_1: *mut Display, _0: c_int) -> *mut XftFont, + pub fn XftListFonts (_1: *mut Display, _0: c_int) -> *mut XftFontSet, +globals: +} + + +// +// types +// + + +pub enum XftFontInfo {} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XftFont { + pub ascent: c_int, + pub descent: c_int, + pub height: c_int, + pub max_advance_width: c_int, + pub charset: *mut FcCharSet, + pub pattern: *mut FcPattern, +} + +pub enum XftDraw {} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XftColor { + pub pixel: c_ulong, + pub color: XRenderColor, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XftCharSpec { + pub ucs4: FcChar32, + pub x: c_short, + pub y: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XftCharFontSpec { + pub font: *mut XftFont, + pub ucs4: FcChar32, + pub x: c_short, + pub y: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XftFontSet { + pub nfont: c_int, + pub sfont: c_int, + pub fonts: *mut *mut XftPattern, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XftGlyphSpec { + pub glyph: FT_UInt, + pub x: c_short, + pub y: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XftGlyphFontSpec { + pub font: *mut XftFont, + pub glyph: FT_UInt, + pub x: c_short, + pub y: c_short, +} + +pub enum XftPattern {} + + +// +// constants +// + + +// font attributes +pub const XFT_FAMILY: &'static str = "family"; +pub const XFT_STYLE: &'static str = "style"; +pub const XFT_SLANT: &'static str = "slant"; +pub const XFT_WEIGHT: &'static str = "weight"; +pub const XFT_SIZE: &'static str = "size"; +pub const XFT_PIXEL_SIZE: &'static str = "pixelsize"; +pub const XFT_SPACING: &'static str = "spacing"; +pub const XFT_FOUNDRY: &'static str = "foundry"; +pub const XFT_ANTIALIAS: &'static str = "antialias"; + +// slant values +pub const XFT_SLANT_ROMAN: c_int = 0; +pub const XFT_SLANT_ITALIC: c_int = 100; +pub const XFT_SLANT_OBLIQUE: c_int = 110; + +// attribute types +pub const XftTypeVoid: c_int = 0; +pub const XftTypeInteger: c_int = 1; +pub const XftTypeDouble: c_int = 2; +pub const XftTypeString: c_int = 3; +pub const XftTypeBool: c_int = 4; +pub const XftTypeMatrix: c_int = 5; diff --git a/third_party/rust/x11/src/xinerama.rs b/third_party/rust/x11/src/xinerama.rs new file mode 100644 index 000000000000..c5d743be1152 --- /dev/null +++ b/third_party/rust/x11/src/xinerama.rs @@ -0,0 +1,66 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_int, + c_short, +}; + +use ::xlib::{ + Bool, + Display, + Drawable, + Status, + Window, + XID, +}; + + +// +// functions +// + + +x11_link! { Xlib, xinerama, ["libXinerama.so.1", "libXinerama.so"], 10, + pub fn XineramaIsActive (dpy: *mut Display) -> Bool, + pub fn XineramaQueryExtension (dpy: *mut Display, event_base: c_int, error_base: c_int) -> Bool, + pub fn XineramaQueryScreens (dpy: *mut Display, number: *mut c_int) -> *mut XineramaScreenInfo, + pub fn XineramaQueryVersion (dpy: *mut Display, major_versionp: *mut c_int, minor_versionp: *mut c_int) -> Status, + pub fn XPanoramiXAllocInfo () -> *mut XPanoramiXInfo, + pub fn XPanoramiXGetScreenCount (dpy: *mut Display, drawable: Drawable, panoramiX_info: *mut XPanoramiXInfo) -> Status, + pub fn XPanoramiXGetScreenSize (dpy: *mut Display, drawable: Drawable, screen_num: c_int, panoramiX_info: *mut XPanoramiXInfo) -> Status, + pub fn XPanoramiXGetState (dpy: *mut Display, drawable: Drawable, panoramiX_info: *mut XPanoramiXInfo) -> Status, + pub fn XPanoramiXQueryExtension (dpy: *mut Display, event_base_return: *mut c_int, error_base_return: *mut c_int) -> Bool, + pub fn XPanoramiXQueryVersion (dpy: *mut Display, major_version_return: *mut c_int, minor_version_return: *mut c_int) -> Status, +variadic: +globals: +} + + +// +// types +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XineramaScreenInfo { + pub screen_number: c_int, + pub x_org: c_short, + pub y_org: c_short, + pub width: c_short, + pub height: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XPanoramiXInfo { + pub window: Window, + pub screen: c_int, + pub State: c_int, + pub width: c_int, + pub height: c_int, + pub ScreenCount: c_int, + pub eventMask: XID, +} diff --git a/third_party/rust/x11/src/xinput.rs b/third_party/rust/x11/src/xinput.rs new file mode 100644 index 000000000000..4b3db4fdb4ec --- /dev/null +++ b/third_party/rust/x11/src/xinput.rs @@ -0,0 +1,165 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_int, + c_long, + c_short, + c_uchar, + c_uint, + c_ulong, +}; + +use ::xlib::{ + Atom, + Display, + Time, + XEvent, + XID, + XModifierKeymap, +}; + +// +// functions +// + +x11_link! { XInput, xi, ["libXi.so.6", "libXi.so"], 44, + pub fn XAllowDeviceEvents (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: c_ulong) -> c_int, + pub fn XChangeDeviceControl (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: *mut XDeviceControl) -> c_int, + pub fn XChangeDeviceDontPropagateList (_5: *mut Display, _4: c_ulong, _3: c_int, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XChangeDeviceKeyMapping (_6: *mut Display, _5: *mut XDevice, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XChangeDeviceProperty (_8: *mut Display, _7: *mut XDevice, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: *const c_uchar, _1: c_int) -> (), + pub fn XChangeFeedbackControl (_4: *mut Display, _3: *mut XDevice, _2: c_ulong, _1: *mut XFeedbackControl) -> c_int, + pub fn XChangeKeyboardDevice (_2: *mut Display, _1: *mut XDevice) -> c_int, + pub fn XChangePointerDevice (_4: *mut Display, _3: *mut XDevice, _2: c_int, _1: c_int) -> c_int, + pub fn XCloseDevice (_2: *mut Display, _1: *mut XDevice) -> c_int, + pub fn XDeleteDeviceProperty (_3: *mut Display, _2: *mut XDevice, _1: c_ulong) -> (), + pub fn XDeviceBell (_5: *mut Display, _4: *mut XDevice, _3: c_ulong, _2: c_ulong, _1: c_int) -> c_int, + pub fn XFreeDeviceControl (_1: *mut XDeviceControl) -> (), + pub fn XFreeDeviceList (_1: *mut XDeviceInfo) -> (), + pub fn XFreeDeviceMotionEvents (_1: *mut XDeviceTimeCoord) -> (), + pub fn XFreeDeviceState (_1: *mut XDeviceState) -> (), + pub fn XFreeFeedbackList (_1: *mut XFeedbackState) -> (), + pub fn XGetDeviceButtonMapping (_4: *mut Display, _3: *mut XDevice, _2: *mut c_uchar, _1: c_uint) -> c_int, + pub fn XGetDeviceControl (_3: *mut Display, _2: *mut XDevice, _1: c_int) -> *mut XDeviceControl, + pub fn XGetDeviceDontPropagateList (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> *mut c_ulong, + pub fn XGetDeviceFocus (_5: *mut Display, _4: *mut XDevice, _3: *mut c_ulong, _2: *mut c_int, _1: *mut c_ulong) -> c_int, + pub fn XGetDeviceKeyMapping (_5: *mut Display, _4: *mut XDevice, _3: c_uchar, _2: c_int, _1: *mut c_int) -> *mut c_ulong, + pub fn XGetDeviceModifierMapping (_2: *mut Display, _1: *mut XDevice) -> *mut XModifierKeymap, + pub fn XGetDeviceMotionEvents (_7: *mut Display, _6: *mut XDevice, _5: c_ulong, _4: c_ulong, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> *mut XDeviceTimeCoord, + pub fn XGetDeviceProperty (_12: *mut Display, _11: *mut XDevice, _10: c_ulong, _9: c_long, _8: c_long, _7: c_int, _6: c_ulong, _5: *mut c_ulong, _4: *mut c_int, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut *mut c_uchar) -> c_int, + pub fn XGetExtensionVersion (_2: *mut Display, _1: *const c_char) -> *mut XExtensionVersion, + pub fn XGetFeedbackControl (_3: *mut Display, _2: *mut XDevice, _1: *mut c_int) -> *mut XFeedbackState, + pub fn XGetSelectedExtensionEvents (_6: *mut Display, _5: c_ulong, _4: *mut c_int, _3: *mut *mut c_ulong, _2: *mut c_int, _1: *mut *mut c_ulong) -> c_int, + pub fn XGrabDevice (_9: *mut Display, _8: *mut XDevice, _7: c_ulong, _6: c_int, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XGrabDeviceButton (_11: *mut Display, _10: *mut XDevice, _9: c_uint, _8: c_uint, _7: *mut XDevice, _6: c_ulong, _5: c_int, _4: c_uint, _3: *mut c_ulong, _2: c_int, _1: c_int) -> c_int, + pub fn XGrabDeviceKey (_11: *mut Display, _10: *mut XDevice, _9: c_uint, _8: c_uint, _7: *mut XDevice, _6: c_ulong, _5: c_int, _4: c_uint, _3: *mut c_ulong, _2: c_int, _1: c_int) -> c_int, + + pub fn XListDeviceProperties (_3: *mut Display, _2: *mut XDevice, _1: *mut c_int) -> *mut c_ulong, + pub fn XListInputDevices (_2: *mut Display, _1: *mut c_int) -> *mut XDeviceInfo, + pub fn XOpenDevice (_2: *mut Display, _1: c_ulong) -> *mut XDevice, + pub fn XQueryDeviceState (_2: *mut Display, _1: *mut XDevice) -> *mut XDeviceState, + pub fn XSelectExtensionEvent (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XSendExtensionEvent (_7: *mut Display, _6: *mut XDevice, _5: c_ulong, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: *mut XEvent) -> c_int, + pub fn XSetDeviceButtonMapping (_4: *mut Display, _3: *mut XDevice, _2: *mut c_uchar, _1: c_int) -> c_int, + pub fn XSetDeviceFocus (_5: *mut Display, _4: *mut XDevice, _3: c_ulong, _2: c_int, _1: c_ulong) -> c_int, + pub fn XSetDeviceMode (_3: *mut Display, _2: *mut XDevice, _1: c_int) -> c_int, + pub fn XSetDeviceModifierMapping (_3: *mut Display, _2: *mut XDevice, _1: *mut XModifierKeymap) -> c_int, + pub fn XSetDeviceValuators (_5: *mut Display, _4: *mut XDevice, _3: *mut c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XUngrabDevice (_3: *mut Display, _2: *mut XDevice, _1: c_ulong) -> c_int, + pub fn XUngrabDeviceButton (_6: *mut Display, _5: *mut XDevice, _4: c_uint, _3: c_uint, _2: *mut XDevice, _1: c_ulong) -> c_int, + pub fn XUngrabDeviceKey (_6: *mut Display, _5: *mut XDevice, _4: c_uint, _3: c_uint, _2: *mut XDevice, _1: c_ulong) -> c_int, +variadic: +globals: +} + + +// +// types +// + +pub enum _XAnyClassinfo {} + +pub type XAnyClassPtr = *mut _XAnyClassinfo; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XDevice { + pub device_id: XID, + pub num_classes: c_int, + pub classes: *mut XInputClassInfo, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XDeviceControl { + pub control: XID, + pub length: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XDeviceInfo { + pub id: XID, + pub type_: Atom, + pub name: *mut c_char, + pub num_classes: c_int, + pub use_: c_int, + pub inputclassinfo: XAnyClassPtr, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XDeviceState { + pub device_id: XID, + pub num_classes: c_int, + pub data: *mut XInputClass, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XDeviceTimeCoord { + pub time: Time, + pub data: *mut c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XExtensionVersion { + pub present: c_int, + pub major_version: c_short, + pub minor_version: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XFeedbackControl { + pub class: XID, + pub length: c_int, + pub id: XID, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XFeedbackState { + pub class: XID, + pub length: c_int, + pub id: XID, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XInputClass { + pub class: c_uchar, + pub length: c_uchar, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XInputClassInfo { + pub input_class: c_uchar, + pub event_type_base: c_uchar, +} + diff --git a/third_party/rust/x11/src/xinput2.rs b/third_party/rust/x11/src/xinput2.rs new file mode 100644 index 000000000000..39fbf40c216d --- /dev/null +++ b/third_party/rust/x11/src/xinput2.rs @@ -0,0 +1,757 @@ +use xfixes::PointerBarrier; +use xlib::{Atom, Display, Time, Window}; +use std::os::raw::{c_int, c_uint, c_long, c_double, c_ulong, c_uchar}; + +// +// macro translations +// +fn mask_byte(mask_flag: i32) -> usize { + (mask_flag >> 3) as usize +} + +pub fn XISetMask(mask: &mut [::std::os::raw::c_uchar], event: i32) { + mask[mask_byte(event)] |= 1 << (event & 7); +} + +pub fn XIClearMask(mask: &mut [::std::os::raw::c_uchar], event: i32) { + mask[mask_byte(event)] &= 1 << (event & 7); +} + +pub fn XIMaskIsSet(mask: &[::std::os::raw::c_uchar], event: i32) -> bool { + (mask[mask_byte(event)] & (1 << (event & 7))) != 0 +} + +// +// functions +// +x11_link! { XInput2, xi, ["libXi.so.6", "libXi.so"], 34, + pub fn XIAllowEvents (_4: *mut Display, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XIAllowTouchEvents (_5: *mut Display, _4: c_int, _3: c_uint, _2: c_ulong, _1: c_int) -> c_int, + pub fn XIBarrierReleasePointer (_4: *mut Display, _3: c_int, _2: c_ulong, _1: c_uint) -> (), + pub fn XIBarrierReleasePointers (_3: *mut Display, _2: *mut XIBarrierReleasePointerInfo, _1: c_int) -> (), + pub fn XIChangeHierarchy (_3: *mut Display, _2: *mut XIAnyHierarchyChangeInfo, _1: c_int) -> c_int, + pub fn XIChangeProperty (_8: *mut Display, _7: c_int, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: *mut c_uchar, _1: c_int) -> (), + pub fn XIDefineCursor (_4: *mut Display, _3: c_int, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XIDeleteProperty (_3: *mut Display, _2: c_int, _1: c_ulong) -> (), + pub fn XIFreeDeviceInfo (_1: *mut XIDeviceInfo) -> (), + pub fn XIGetClientPointer (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> c_int, + pub fn XIGetFocus (_3: *mut Display, _2: c_int, _1: *mut c_ulong) -> c_int, + pub fn XIGetProperty (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_long, _8: c_long, _7: c_int, _6: c_ulong, _5: *mut c_ulong, _4: *mut c_int, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut *mut c_uchar) -> c_int, + pub fn XIGetSelectedEvents (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> *mut XIEventMask, + pub fn XIGrabButton (_11: *mut Display, _10: c_int, _9: c_int, _8: c_ulong, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIGrabDevice (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: c_int, _1: *mut XIEventMask) -> c_int, + pub fn XIGrabEnter (_10: *mut Display, _9: c_int, _8: c_ulong, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIGrabFocusIn (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIGrabKeycode (_10: *mut Display, _9: c_int, _8: c_int, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIGrabTouchBegin (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_int, _3: *mut XIEventMask, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIListProperties (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut c_ulong, + pub fn XIQueryDevice (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut XIDeviceInfo, + pub fn XIQueryPointer (_12: *mut Display, _11: c_int, _10: c_ulong, _9: *mut c_ulong, _8: *mut c_ulong, _7: *mut c_double, _6: *mut c_double, _5: *mut c_double, _4: *mut c_double, _3: *mut XIButtonState, _2: *mut XIModifierState, _1: *mut XIModifierState) -> c_int, + pub fn XIQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XISelectEvents (_4: *mut Display, _3: c_ulong, _2: *mut XIEventMask, _1: c_int) -> c_int, + pub fn XISetClientPointer (_3: *mut Display, _2: c_ulong, _1: c_int) -> c_int, + pub fn XISetFocus (_4: *mut Display, _3: c_int, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XIUndefineCursor (_3: *mut Display, _2: c_int, _1: c_ulong) -> c_int, + pub fn XIUngrabButton (_6: *mut Display, _5: c_int, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIUngrabDevice (_3: *mut Display, _2: c_int, _1: c_ulong) -> c_int, + pub fn XIUngrabEnter (_5: *mut Display, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIUngrabFocusIn (_5: *mut Display, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIUngrabKeycode (_6: *mut Display, _5: c_int, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIUngrabTouchBegin (_5: *mut Display, _4: c_int, _3: c_ulong, _2: c_int, _1: *mut XIGrabModifiers) -> c_int, + pub fn XIWarpPointer (_10: *mut Display, _9: c_int, _8: c_ulong, _7: c_ulong, _6: c_double, _5: c_double, _4: c_uint, _3: c_uint, _2: c_double, _1: c_double) -> c_int, +variadic: +globals: +} + +// +// constants +// (auto-generated with cmacros) +// + +pub const XInput_2_0: i32 = 7; +pub const XI_2_Major: i32 = 2; +pub const XI_2_Minor: i32 = 3; +pub const XIPropertyDeleted: i32 = 0; +pub const XIPropertyCreated: i32 = 1; +pub const XIPropertyModified: i32 = 2; +pub const XIPropModeReplace: i32 = 0; +pub const XIPropModePrepend: i32 = 1; +pub const XIPropModeAppend: i32 = 2; +pub const XINotifyNormal: i32 = 0; +pub const XINotifyGrab: i32 = 1; +pub const XINotifyUngrab: i32 = 2; +pub const XINotifyWhileGrabbed: i32 = 3; +pub const XINotifyPassiveGrab: i32 = 4; +pub const XINotifyPassiveUngrab: i32 = 5; +pub const XINotifyAncestor: i32 = 0; +pub const XINotifyVirtual: i32 = 1; +pub const XINotifyInferior: i32 = 2; +pub const XINotifyNonlinear: i32 = 3; +pub const XINotifyNonlinearVirtual: i32 = 4; +pub const XINotifyPointer: i32 = 5; +pub const XINotifyPointerRoot: i32 = 6; +pub const XINotifyDetailNone: i32 = 7; +pub const XIGrabModeSync: i32 = 0; +pub const XIGrabModeAsync: i32 = 1; +pub const XIGrabModeTouch: i32 = 2; +pub const XIGrabSuccess: i32 = 0; +pub const XIAlreadyGrabbed: i32 = 1; +pub const XIGrabInvalidTime: i32 = 2; +pub const XIGrabNotViewable: i32 = 3; +pub const XIGrabFrozen: i32 = 4; +pub const XIGrabtypeButton: i32 = 0; +pub const XIGrabtypeKeycode: i32 = 1; +pub const XIGrabtypeEnter: i32 = 2; +pub const XIGrabtypeFocusIn: i32 = 3; +pub const XIGrabtypeTouchBegin: i32 = 4; +pub const XIAnyButton: i32 = 0; +pub const XIAnyKeycode: i32 = 0; +pub const XIAsyncDevice: i32 = 0; +pub const XISyncDevice: i32 = 1; +pub const XIReplayDevice: i32 = 2; +pub const XIAsyncPairedDevice: i32 = 3; +pub const XIAsyncPair: i32 = 4; +pub const XISyncPair: i32 = 5; +pub const XIAcceptTouch: i32 = 6; +pub const XIRejectTouch: i32 = 7; +pub const XISlaveSwitch: i32 = 1; +pub const XIDeviceChange: i32 = 2; +pub const XIMasterAdded: i32 = (1 << 0); +pub const XIMasterRemoved: i32 = (1 << 1); +pub const XISlaveAdded: i32 = (1 << 2); +pub const XISlaveRemoved: i32 = (1 << 3); +pub const XISlaveAttached: i32 = (1 << 4); +pub const XISlaveDetached: i32 = (1 << 5); +pub const XIDeviceEnabled: i32 = (1 << 6); +pub const XIDeviceDisabled: i32 = (1 << 7); +pub const XIAddMaster: i32 = 1; +pub const XIRemoveMaster: i32 = 2; +pub const XIAttachSlave: i32 = 3; +pub const XIDetachSlave: i32 = 4; +pub const XIAttachToMaster: i32 = 1; +pub const XIFloating: i32 = 2; +pub const XIModeRelative: i32 = 0; +pub const XIModeAbsolute: i32 = 1; +pub const XIMasterPointer: i32 = 1; +pub const XIMasterKeyboard: i32 = 2; +pub const XISlavePointer: i32 = 3; +pub const XISlaveKeyboard: i32 = 4; +pub const XIFloatingSlave: i32 = 5; +pub const XIKeyClass: i32 = 0; +pub const XIButtonClass: i32 = 1; +pub const XIValuatorClass: i32 = 2; +pub const XIScrollClass: i32 = 3; +pub const XITouchClass: i32 = 8; +pub const XIScrollTypeVertical: i32 = 1; +pub const XIScrollTypeHorizontal: i32 = 2; +pub const XIScrollFlagNoEmulation: i32 = (1 << 0); +pub const XIScrollFlagPreferred: i32 = (1 << 1); +pub const XIKeyRepeat: i32 = (1 << 16); +pub const XIPointerEmulated: i32 = (1 << 16); +pub const XITouchPendingEnd: i32 = (1 << 16); +pub const XITouchEmulatingPointer: i32 = (1 << 17); +pub const XIBarrierPointerReleased: i32 = (1 << 0); +pub const XIBarrierDeviceIsGrabbed: i32 = (1 << 1); +pub const XIDirectTouch: i32 = 1; +pub const XIDependentTouch: i32 = 2; +pub const XIAllDevices: i32 = 0; +pub const XIAllMasterDevices: i32 = 1; +pub const XI_DeviceChanged: i32 = 1; +pub const XI_KeyPress: i32 = 2; +pub const XI_KeyRelease: i32 = 3; +pub const XI_ButtonPress: i32 = 4; +pub const XI_ButtonRelease: i32 = 5; +pub const XI_Motion: i32 = 6; +pub const XI_Enter: i32 = 7; +pub const XI_Leave: i32 = 8; +pub const XI_FocusIn: i32 = 9; +pub const XI_FocusOut: i32 = 10; +pub const XI_HierarchyChanged: i32 = 11; +pub const XI_PropertyEvent: i32 = 12; +pub const XI_RawKeyPress: i32 = 13; +pub const XI_RawKeyRelease: i32 = 14; +pub const XI_RawButtonPress: i32 = 15; +pub const XI_RawButtonRelease: i32 = 16; +pub const XI_RawMotion: i32 = 17; +pub const XI_TouchBegin: i32 = 18 /* XI 2.2 */; +pub const XI_TouchUpdate: i32 = 19; +pub const XI_TouchEnd: i32 = 20; +pub const XI_TouchOwnership: i32 = 21; +pub const XI_RawTouchBegin: i32 = 22; +pub const XI_RawTouchUpdate: i32 = 23; +pub const XI_RawTouchEnd: i32 = 24; +pub const XI_BarrierHit: i32 = 25 /* XI 2.3 */; +pub const XI_BarrierLeave: i32 = 26; +pub const XI_LASTEVENT: i32 = XI_BarrierLeave; +pub const XI_DeviceChangedMask: i32 = (1 << XI_DeviceChanged); +pub const XI_KeyPressMask: i32 = (1 << XI_KeyPress); +pub const XI_KeyReleaseMask: i32 = (1 << XI_KeyRelease); +pub const XI_ButtonPressMask: i32 = (1 << XI_ButtonPress); +pub const XI_ButtonReleaseMask: i32 = (1 << XI_ButtonRelease); +pub const XI_MotionMask: i32 = (1 << XI_Motion); +pub const XI_EnterMask: i32 = (1 << XI_Enter); +pub const XI_LeaveMask: i32 = (1 << XI_Leave); +pub const XI_FocusInMask: i32 = (1 << XI_FocusIn); +pub const XI_FocusOutMask: i32 = (1 << XI_FocusOut); +pub const XI_HierarchyChangedMask: i32 = (1 << XI_HierarchyChanged); +pub const XI_PropertyEventMask: i32 = (1 << XI_PropertyEvent); +pub const XI_RawKeyPressMask: i32 = (1 << XI_RawKeyPress); +pub const XI_RawKeyReleaseMask: i32 = (1 << XI_RawKeyRelease); +pub const XI_RawButtonPressMask: i32 = (1 << XI_RawButtonPress); +pub const XI_RawButtonReleaseMask: i32 = (1 << XI_RawButtonRelease); +pub const XI_RawMotionMask: i32 = (1 << XI_RawMotion); +pub const XI_TouchBeginMask: i32 = (1 << XI_TouchBegin); +pub const XI_TouchEndMask: i32 = (1 << XI_TouchEnd); +pub const XI_TouchOwnershipChangedMask: i32 = (1 << XI_TouchOwnership); +pub const XI_TouchUpdateMask: i32 = (1 << XI_TouchUpdate); +pub const XI_RawTouchBeginMask: i32 = (1 << XI_RawTouchBegin); +pub const XI_RawTouchEndMask: i32 = (1 << XI_RawTouchEnd); +pub const XI_RawTouchUpdateMask: i32 = (1 << XI_RawTouchUpdate); +pub const XI_BarrierHitMask: i32 = (1 << XI_BarrierHit); +pub const XI_BarrierLeaveMask: i32 = (1 << XI_BarrierLeave); + +// +// structs +// (auto-generated with rust-bindgen) +// + +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed1 { + pub _type: ::std::os::raw::c_int, + pub name: *mut ::std::os::raw::c_char, + pub send_core: ::std::os::raw::c_int, + pub enable: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed1 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed1 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIAddMasterInfo = Struct_Unnamed1; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed2 { + pub _type: ::std::os::raw::c_int, + pub deviceid: ::std::os::raw::c_int, + pub return_mode: ::std::os::raw::c_int, + pub return_pointer: ::std::os::raw::c_int, + pub return_keyboard: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed2 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed2 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIRemoveMasterInfo = Struct_Unnamed2; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed3 { + pub _type: ::std::os::raw::c_int, + pub deviceid: ::std::os::raw::c_int, + pub new_master: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed3 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed3 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIAttachSlaveInfo = Struct_Unnamed3; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed4 { + pub _type: ::std::os::raw::c_int, + pub deviceid: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed4 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed4 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIDetachSlaveInfo = Struct_Unnamed4; +#[repr(C)] +#[derive(Copy)] +pub struct Union_Unnamed5 { + pub _bindgen_data_: [u64; 3usize], +} +impl Union_Unnamed5 { + pub unsafe fn _type(&mut self) -> *mut ::std::os::raw::c_int { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } + pub unsafe fn add(&mut self) -> *mut XIAddMasterInfo { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } + pub unsafe fn remove(&mut self) -> *mut XIRemoveMasterInfo { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } + pub unsafe fn attach(&mut self) -> *mut XIAttachSlaveInfo { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } + pub unsafe fn detach(&mut self) -> *mut XIDetachSlaveInfo { + let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_); + ::std::mem::transmute(raw.offset(0)) + } +} +impl ::std::clone::Clone for Union_Unnamed5 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Union_Unnamed5 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIAnyHierarchyChangeInfo = Union_Unnamed5; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed6 { + pub base: ::std::os::raw::c_int, + pub latched: ::std::os::raw::c_int, + pub locked: ::std::os::raw::c_int, + pub effective: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed6 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed6 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIModifierState = Struct_Unnamed6; +pub type XIGroupState = XIModifierState; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed7 { + pub mask_len: ::std::os::raw::c_int, + pub mask: *mut ::std::os::raw::c_uchar, +} +impl ::std::clone::Clone for Struct_Unnamed7 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed7 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIButtonState = Struct_Unnamed7; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed8 { + pub mask_len: ::std::os::raw::c_int, + pub mask: *mut ::std::os::raw::c_uchar, + pub values: *mut ::std::os::raw::c_double, +} +impl ::std::clone::Clone for Struct_Unnamed8 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed8 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIValuatorState = Struct_Unnamed8; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed9 { + pub deviceid: ::std::os::raw::c_int, + pub mask_len: ::std::os::raw::c_int, + pub mask: *mut ::std::os::raw::c_uchar, +} +impl ::std::clone::Clone for Struct_Unnamed9 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed9 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIEventMask = Struct_Unnamed9; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed10 { + pub _type: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed10 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed10 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIAnyClassInfo = Struct_Unnamed10; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed11 { + pub _type: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub num_buttons: ::std::os::raw::c_int, + pub labels: *mut Atom, + pub state: XIButtonState, +} +impl ::std::clone::Clone for Struct_Unnamed11 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed11 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIButtonClassInfo = Struct_Unnamed11; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed12 { + pub _type: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub num_keycodes: ::std::os::raw::c_int, + pub keycodes: *mut ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed12 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed12 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIKeyClassInfo = Struct_Unnamed12; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed13 { + pub _type: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub number: ::std::os::raw::c_int, + pub label: Atom, + pub min: ::std::os::raw::c_double, + pub max: ::std::os::raw::c_double, + pub value: ::std::os::raw::c_double, + pub resolution: ::std::os::raw::c_int, + pub mode: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed13 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed13 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIValuatorClassInfo = Struct_Unnamed13; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed14 { + pub _type: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub number: ::std::os::raw::c_int, + pub scroll_type: ::std::os::raw::c_int, + pub increment: ::std::os::raw::c_double, + pub flags: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed14 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed14 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIScrollClassInfo = Struct_Unnamed14; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed15 { + pub _type: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub mode: ::std::os::raw::c_int, + pub num_touches: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed15 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed15 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XITouchClassInfo = Struct_Unnamed15; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed16 { + pub deviceid: ::std::os::raw::c_int, + pub name: *mut ::std::os::raw::c_char, + pub _use: ::std::os::raw::c_int, + pub attachment: ::std::os::raw::c_int, + pub enabled: ::std::os::raw::c_int, + pub num_classes: ::std::os::raw::c_int, + pub classes: *mut *mut XIAnyClassInfo, +} +impl ::std::clone::Clone for Struct_Unnamed16 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed16 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIDeviceInfo = Struct_Unnamed16; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed17 { + pub modifiers: ::std::os::raw::c_int, + pub status: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed17 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed17 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIGrabModifiers = Struct_Unnamed17; +pub type BarrierEventID = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed18 { + pub deviceid: ::std::os::raw::c_int, + pub barrier: PointerBarrier, + pub eventid: BarrierEventID, +} +impl ::std::clone::Clone for Struct_Unnamed18 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed18 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIBarrierReleasePointerInfo = Struct_Unnamed18; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed19 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, +} +impl ::std::clone::Clone for Struct_Unnamed19 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed19 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIEvent = Struct_Unnamed19; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed20 { + pub deviceid: ::std::os::raw::c_int, + pub attachment: ::std::os::raw::c_int, + pub _use: ::std::os::raw::c_int, + pub enabled: ::std::os::raw::c_int, + pub flags: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed20 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed20 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIHierarchyInfo = Struct_Unnamed20; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed21 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub flags: ::std::os::raw::c_int, + pub num_info: ::std::os::raw::c_int, + pub info: *mut XIHierarchyInfo, +} +impl ::std::clone::Clone for Struct_Unnamed21 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed21 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIHierarchyEvent = Struct_Unnamed21; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed22 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub deviceid: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub reason: ::std::os::raw::c_int, + pub num_classes: ::std::os::raw::c_int, + pub classes: *mut *mut XIAnyClassInfo, +} +impl ::std::clone::Clone for Struct_Unnamed22 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed22 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIDeviceChangedEvent = Struct_Unnamed22; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed23 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub deviceid: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub detail: ::std::os::raw::c_int, + pub root: Window, + pub event: Window, + pub child: Window, + pub root_x: ::std::os::raw::c_double, + pub root_y: ::std::os::raw::c_double, + pub event_x: ::std::os::raw::c_double, + pub event_y: ::std::os::raw::c_double, + pub flags: ::std::os::raw::c_int, + pub buttons: XIButtonState, + pub valuators: XIValuatorState, + pub mods: XIModifierState, + pub group: XIGroupState, +} +impl ::std::clone::Clone for Struct_Unnamed23 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed23 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIDeviceEvent = Struct_Unnamed23; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed24 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub deviceid: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub detail: ::std::os::raw::c_int, + pub flags: ::std::os::raw::c_int, + pub valuators: XIValuatorState, + pub raw_values: *mut ::std::os::raw::c_double, +} +impl ::std::clone::Clone for Struct_Unnamed24 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed24 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIRawEvent = Struct_Unnamed24; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed25 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub deviceid: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub detail: ::std::os::raw::c_int, + pub root: Window, + pub event: Window, + pub child: Window, + pub root_x: ::std::os::raw::c_double, + pub root_y: ::std::os::raw::c_double, + pub event_x: ::std::os::raw::c_double, + pub event_y: ::std::os::raw::c_double, + pub mode: ::std::os::raw::c_int, + pub focus: ::std::os::raw::c_int, + pub same_screen: ::std::os::raw::c_int, + pub buttons: XIButtonState, + pub mods: XIModifierState, + pub group: XIGroupState, +} +impl ::std::clone::Clone for Struct_Unnamed25 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed25 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIEnterEvent = Struct_Unnamed25; +pub type XILeaveEvent = XIEnterEvent; +pub type XIFocusInEvent = XIEnterEvent; +pub type XIFocusOutEvent = XIEnterEvent; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed26 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub deviceid: ::std::os::raw::c_int, + pub property: Atom, + pub what: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed26 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed26 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIPropertyEvent = Struct_Unnamed26; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed27 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub deviceid: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub touchid: ::std::os::raw::c_uint, + pub root: Window, + pub event: Window, + pub child: Window, + pub flags: ::std::os::raw::c_int, +} +impl ::std::clone::Clone for Struct_Unnamed27 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed27 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XITouchOwnershipEvent = Struct_Unnamed27; +#[repr(C)] +#[derive(Copy)] +pub struct Struct_Unnamed28 { + pub _type: ::std::os::raw::c_int, + pub serial: ::std::os::raw::c_ulong, + pub send_event: ::std::os::raw::c_int, + pub display: *mut Display, + pub extension: ::std::os::raw::c_int, + pub evtype: ::std::os::raw::c_int, + pub time: Time, + pub deviceid: ::std::os::raw::c_int, + pub sourceid: ::std::os::raw::c_int, + pub event: Window, + pub root: Window, + pub root_x: ::std::os::raw::c_double, + pub root_y: ::std::os::raw::c_double, + pub dx: ::std::os::raw::c_double, + pub dy: ::std::os::raw::c_double, + pub dtime: ::std::os::raw::c_int, + pub flags: ::std::os::raw::c_int, + pub barrier: PointerBarrier, + pub eventid: BarrierEventID, +} +impl ::std::clone::Clone for Struct_Unnamed28 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_Unnamed28 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type XIBarrierEvent = Struct_Unnamed28; + diff --git a/third_party/rust/x11/src/xlib.rs b/third_party/rust/x11/src/xlib.rs new file mode 100644 index 000000000000..e117523576e6 --- /dev/null +++ b/third_party/rust/x11/src/xlib.rs @@ -0,0 +1,3212 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::mem; +use std::slice; +use std::os::raw::{ + c_char, + c_double, + c_int, + c_long, + c_short, + c_schar, + c_uchar, + c_uint, + c_ulong, + c_ushort, + c_void, +}; + +use libc::wchar_t; + +use ::internal::{ + mem_eq, + transmute_union, +}; + +// deprecated +pub mod xkb {} + + +// +// functions +// + + +x11_link! { Xlib, x11, ["libX11.so.6", "libX11.so"], 767, + pub fn XActivateScreenSaver (_1: *mut Display) -> c_int, + pub fn XAddConnectionWatch (_3: *mut Display, _2: Option, _1: *mut c_char) -> c_int, + pub fn XAddExtension (_1: *mut Display) -> *mut XExtCodes, + pub fn XAddHost (_2: *mut Display, _1: *mut XHostAddress) -> c_int, + pub fn XAddHosts (_3: *mut Display, _2: *mut XHostAddress, _1: c_int) -> c_int, + pub fn XAddPixel (_2: *mut XImage, _1: c_long) -> c_int, + pub fn XAddToExtensionList (_2: *mut *mut XExtData, _1: *mut XExtData) -> c_int, + pub fn XAddToSaveSet (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XAllocClassHint () -> *mut XClassHint, + pub fn XAllocColor (_3: *mut Display, _2: c_ulong, _1: *mut XColor) -> c_int, + pub fn XAllocColorCells (_7: *mut Display, _6: c_ulong, _5: c_int, _4: *mut c_ulong, _3: c_uint, _2: *mut c_ulong, _1: c_uint) -> c_int, + pub fn XAllocColorPlanes (_11: *mut Display, _10: c_ulong, _9: c_int, _8: *mut c_ulong, _7: c_int, _6: c_int, _5: c_int, _4: c_int, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut c_ulong) -> c_int, + pub fn XAllocIconSize () -> *mut XIconSize, + pub fn XAllocNamedColor (_5: *mut Display, _4: c_ulong, _3: *const c_char, _2: *mut XColor, _1: *mut XColor) -> c_int, + pub fn XAllocSizeHints () -> *mut XSizeHints, + pub fn XAllocStandardColormap () -> *mut XStandardColormap, + pub fn XAllocWMHints () -> *mut XWMHints, + pub fn XAllowEvents (_3: *mut Display, _2: c_int, _1: c_ulong) -> c_int, + pub fn XAllPlanes () -> c_ulong, + pub fn XAutoRepeatOff (_1: *mut Display) -> c_int, + pub fn XAutoRepeatOn (_1: *mut Display) -> c_int, + pub fn XBaseFontNameListOfFontSet (_1: XFontSet) -> *mut c_char, + pub fn XBell (_2: *mut Display, _1: c_int) -> c_int, + pub fn XBitmapBitOrder (_1: *mut Display) -> c_int, + pub fn XBitmapPad (_1: *mut Display) -> c_int, + pub fn XBitmapUnit (_1: *mut Display) -> c_int, + pub fn XBlackPixel (_2: *mut Display, _1: c_int) -> c_ulong, + pub fn XBlackPixelOfScreen (_1: *mut Screen) -> c_ulong, + pub fn XCellsOfScreen (_1: *mut Screen) -> c_int, + pub fn XChangeActivePointerGrab (_4: *mut Display, _3: c_uint, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XChangeGC (_4: *mut Display, _3: GC, _2: c_ulong, _1: *mut XGCValues) -> c_int, + pub fn XChangeKeyboardControl (_3: *mut Display, _2: c_ulong, _1: *mut XKeyboardControl) -> c_int, + pub fn XChangeKeyboardMapping (_5: *mut Display, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XChangePointerControl (_6: *mut Display, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XChangeProperty (_8: *mut Display, _7: c_ulong, _6: c_ulong, _5: c_ulong, _4: c_int, _3: c_int, _2: *const c_uchar, _1: c_int) -> c_int, + pub fn XChangeSaveSet (_3: *mut Display, _2: c_ulong, _1: c_int) -> c_int, + pub fn XChangeWindowAttributes (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: *mut XSetWindowAttributes) -> c_int, + pub fn XCheckIfEvent (_4: *mut Display, _3: *mut XEvent, _2: Option c_int>, _1: *mut c_char) -> c_int, + pub fn XCheckMaskEvent (_3: *mut Display, _2: c_long, _1: *mut XEvent) -> c_int, + pub fn XCheckTypedEvent (_3: *mut Display, _2: c_int, _1: *mut XEvent) -> c_int, + pub fn XCheckTypedWindowEvent (_4: *mut Display, _3: c_ulong, _2: c_int, _1: *mut XEvent) -> c_int, + pub fn XCheckWindowEvent (_4: *mut Display, _3: c_ulong, _2: c_long, _1: *mut XEvent) -> c_int, + pub fn XCirculateSubwindows (_3: *mut Display, _2: c_ulong, _1: c_int) -> c_int, + pub fn XCirculateSubwindowsDown (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XCirculateSubwindowsUp (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XClearArea (_7: *mut Display, _6: c_ulong, _5: c_int, _4: c_int, _3: c_uint, _2: c_uint, _1: c_int) -> c_int, + pub fn XClearWindow (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XClipBox (_2: Region, _1: *mut XRectangle) -> c_int, + pub fn XCloseDisplay (_1: *mut Display) -> c_int, + pub fn XCloseIM (_1: XIM) -> c_int, + pub fn XCloseOM (_1: XOM) -> c_int, + pub fn XcmsAddColorSpace (_1: *mut XcmsColorSpace) -> c_int, + pub fn XcmsAddFunctionSet (_1: *mut XcmsFunctionSet) -> c_int, + pub fn XcmsAllocColor (_4: *mut Display, _3: c_ulong, _2: *mut XcmsColor, _1: c_ulong) -> c_int, + pub fn XcmsAllocNamedColor (_6: *mut Display, _5: c_ulong, _4: *const c_char, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_ulong) -> c_int, + pub fn XcmsCCCOfColormap (_2: *mut Display, _1: c_ulong) -> XcmsCCC, + pub fn XcmsCIELabClipab (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIELabClipL (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIELabClipLab (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIELabQueryMaxC (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELabQueryMaxL (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELabQueryMaxLC (_3: XcmsCCC, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELabQueryMinL (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELabToCIEXYZ (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIELabWhiteShiftColors (_7: XcmsCCC, _6: *mut XcmsColor, _5: *mut XcmsColor, _4: c_ulong, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIELuvClipL (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIELuvClipLuv (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIELuvClipuv (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIELuvQueryMaxC (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELuvQueryMaxL (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELuvQueryMaxLC (_3: XcmsCCC, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELuvQueryMinL (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsCIELuvToCIEuvY (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIELuvWhiteShiftColors (_7: XcmsCCC, _6: *mut XcmsColor, _5: *mut XcmsColor, _4: c_ulong, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsCIEuvYToCIELuv (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIEuvYToCIEXYZ (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIEuvYToTekHVC (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIExyYToCIEXYZ (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIEXYZToCIELab (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIEXYZToCIEuvY (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIEXYZToCIExyY (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsCIEXYZToRGBi (_4: XcmsCCC, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsClientWhitePointOfCCC (_1: XcmsCCC) -> *mut XcmsColor, + pub fn XcmsConvertColors (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_ulong, _1: *mut c_int) -> c_int, + pub fn XcmsCreateCCC (_8: *mut Display, _7: c_int, _6: *mut Visual, _5: *mut XcmsColor, _4: Option c_int>, _3: *mut c_char, _2: Option c_int>, _1: *mut c_char) -> XcmsCCC, + pub fn XcmsDefaultCCC (_2: *mut Display, _1: c_int) -> XcmsCCC, + pub fn XcmsDisplayOfCCC (_1: XcmsCCC) -> *mut Display, + pub fn XcmsFormatOfPrefix (_1: *mut c_char) -> c_ulong, + pub fn XcmsFreeCCC (_1: XcmsCCC) -> (), + pub fn XcmsLookupColor (_6: *mut Display, _5: c_ulong, _4: *const c_char, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_ulong) -> c_int, + pub fn XcmsPrefixOfFormat (_1: c_ulong) -> *mut c_char, + pub fn XcmsQueryBlack (_3: XcmsCCC, _2: c_ulong, _1: *mut XcmsColor) -> c_int, + pub fn XcmsQueryBlue (_3: XcmsCCC, _2: c_ulong, _1: *mut XcmsColor) -> c_int, + pub fn XcmsQueryColor (_4: *mut Display, _3: c_ulong, _2: *mut XcmsColor, _1: c_ulong) -> c_int, + pub fn XcmsQueryColors (_5: *mut Display, _4: c_ulong, _3: *mut XcmsColor, _2: c_uint, _1: c_ulong) -> c_int, + pub fn XcmsQueryGreen (_3: XcmsCCC, _2: c_ulong, _1: *mut XcmsColor) -> c_int, + pub fn XcmsQueryRed (_3: XcmsCCC, _2: c_ulong, _1: *mut XcmsColor) -> c_int, + pub fn XcmsQueryWhite (_3: XcmsCCC, _2: c_ulong, _1: *mut XcmsColor) -> c_int, + pub fn XcmsRGBiToCIEXYZ (_4: XcmsCCC, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsRGBiToRGB (_4: XcmsCCC, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsRGBToRGBi (_4: XcmsCCC, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsScreenNumberOfCCC (_1: XcmsCCC) -> c_int, + pub fn XcmsScreenWhitePointOfCCC (_1: XcmsCCC) -> *mut XcmsColor, + pub fn XcmsSetCCCOfColormap (_3: *mut Display, _2: c_ulong, _1: XcmsCCC) -> XcmsCCC, + pub fn XcmsSetCompressionProc (_3: XcmsCCC, _2: Option c_int>, _1: *mut c_char) -> Option c_int>, + pub fn XcmsSetWhiteAdjustProc (_3: XcmsCCC, _2: Option c_int>, _1: *mut c_char) -> Option c_int>, + pub fn XcmsSetWhitePoint (_2: XcmsCCC, _1: *mut XcmsColor) -> c_int, + pub fn XcmsStoreColor (_3: *mut Display, _2: c_ulong, _1: *mut XcmsColor) -> c_int, + pub fn XcmsStoreColors (_5: *mut Display, _4: c_ulong, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsTekHVCClipC (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsTekHVCClipV (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsTekHVCClipVC (_5: XcmsCCC, _4: *mut XcmsColor, _3: c_uint, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsTekHVCQueryMaxC (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsTekHVCQueryMaxV (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsTekHVCQueryMaxVC (_3: XcmsCCC, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsTekHVCQueryMaxVSamples (_4: XcmsCCC, _3: c_double, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsTekHVCQueryMinV (_4: XcmsCCC, _3: c_double, _2: c_double, _1: *mut XcmsColor) -> c_int, + pub fn XcmsTekHVCToCIEuvY (_4: XcmsCCC, _3: *mut XcmsColor, _2: *mut XcmsColor, _1: c_uint) -> c_int, + pub fn XcmsTekHVCWhiteShiftColors (_7: XcmsCCC, _6: *mut XcmsColor, _5: *mut XcmsColor, _4: c_ulong, _3: *mut XcmsColor, _2: c_uint, _1: *mut c_int) -> c_int, + pub fn XcmsVisualOfCCC (_1: XcmsCCC) -> *mut Visual, + pub fn XConfigureWindow (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: *mut XWindowChanges) -> c_int, + pub fn XConnectionNumber (_1: *mut Display) -> c_int, + pub fn XContextDependentDrawing (_1: XFontSet) -> c_int, + pub fn XContextualDrawing (_1: XFontSet) -> c_int, + pub fn XConvertCase (_3: c_ulong, _2: *mut c_ulong, _1: *mut c_ulong) -> (), + pub fn XConvertSelection (_6: *mut Display, _5: c_ulong, _4: c_ulong, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XCopyArea (_10: *mut Display, _9: c_ulong, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_uint, _3: c_uint, _2: c_int, _1: c_int) -> c_int, + pub fn XCopyColormapAndFree (_2: *mut Display, _1: c_ulong) -> c_ulong, + pub fn XCopyGC (_4: *mut Display, _3: GC, _2: c_ulong, _1: GC) -> c_int, + pub fn XCopyPlane (_11: *mut Display, _10: c_ulong, _9: c_ulong, _8: GC, _7: c_int, _6: c_int, _5: c_uint, _4: c_uint, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XCreateBitmapFromData (_5: *mut Display, _4: c_ulong, _3: *const c_char, _2: c_uint, _1: c_uint) -> c_ulong, + pub fn XCreateColormap (_4: *mut Display, _3: c_ulong, _2: *mut Visual, _1: c_int) -> c_ulong, + pub fn XCreateFontCursor (_2: *mut Display, _1: c_uint) -> c_ulong, + pub fn XCreateFontSet (_5: *mut Display, _4: *const c_char, _3: *mut *mut *mut c_char, _2: *mut c_int, _1: *mut *mut c_char) -> XFontSet, + pub fn XCreateGC (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: *mut XGCValues) -> GC, + pub fn XCreateGlyphCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *const XColor, _1: *const XColor) -> c_ulong, + pub fn XCreateImage (_10: *mut Display, _9: *mut Visual, _8: c_uint, _7: c_int, _6: c_int, _5: *mut c_char, _4: c_uint, _3: c_uint, _2: c_int, _1: c_int) -> *mut XImage, + pub fn XCreatePixmap (_5: *mut Display, _4: c_ulong, _3: c_uint, _2: c_uint, _1: c_uint) -> c_ulong, + pub fn XCreatePixmapCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: *mut XColor, _3: *mut XColor, _2: c_uint, _1: c_uint) -> c_ulong, + pub fn XCreatePixmapFromBitmapData (_8: *mut Display, _7: c_ulong, _6: *mut c_char, _5: c_uint, _4: c_uint, _3: c_ulong, _2: c_ulong, _1: c_uint) -> c_ulong, + pub fn XCreateRegion () -> Region, + pub fn XCreateSimpleWindow (_9: *mut Display, _8: c_ulong, _7: c_int, _6: c_int, _5: c_uint, _4: c_uint, _3: c_uint, _2: c_ulong, _1: c_ulong) -> c_ulong, + pub fn XCreateWindow (_12: *mut Display, _11: c_ulong, _10: c_int, _9: c_int, _8: c_uint, _7: c_uint, _6: c_uint, _5: c_int, _4: c_uint, _3: *mut Visual, _2: c_ulong, _1: *mut XSetWindowAttributes) -> c_ulong, + pub fn XDefaultColormap (_2: *mut Display, _1: c_int) -> c_ulong, + pub fn XDefaultColormapOfScreen (_1: *mut Screen) -> c_ulong, + pub fn XDefaultDepth (_2: *mut Display, _1: c_int) -> c_int, + pub fn XDefaultDepthOfScreen (_1: *mut Screen) -> c_int, + pub fn XDefaultGC (_2: *mut Display, _1: c_int) -> GC, + pub fn XDefaultGCOfScreen (_1: *mut Screen) -> GC, + pub fn XDefaultRootWindow (_1: *mut Display) -> c_ulong, + pub fn XDefaultScreen (_1: *mut Display) -> c_int, + pub fn XDefaultScreenOfDisplay (_1: *mut Display) -> *mut Screen, + pub fn XDefaultString () -> *const c_char, + pub fn XDefaultVisual (_2: *mut Display, _1: c_int) -> *mut Visual, + pub fn XDefaultVisualOfScreen (_1: *mut Screen) -> *mut Visual, + pub fn XDefineCursor (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XDeleteContext (_3: *mut Display, _2: c_ulong, _1: c_int) -> c_int, + pub fn XDeleteModifiermapEntry (_3: *mut XModifierKeymap, _2: c_uchar, _1: c_int) -> *mut XModifierKeymap, + pub fn XDeleteProperty (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XDestroyIC (_1: XIC) -> (), + pub fn XDestroyImage (_1: *mut XImage) -> c_int, + pub fn XDestroyOC (_1: XFontSet) -> (), + pub fn XDestroyRegion (_1: Region) -> c_int, + pub fn XDestroySubwindows (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XDestroyWindow (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XDirectionalDependentDrawing (_1: XFontSet) -> c_int, + pub fn XDisableAccessControl (_1: *mut Display) -> c_int, + pub fn XDisplayCells (_2: *mut Display, _1: c_int) -> c_int, + pub fn XDisplayHeight (_2: *mut Display, _1: c_int) -> c_int, + pub fn XDisplayHeightMM (_2: *mut Display, _1: c_int) -> c_int, + pub fn XDisplayKeycodes (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XDisplayMotionBufferSize (_1: *mut Display) -> c_ulong, + pub fn XDisplayName (_1: *const c_char) -> *mut c_char, + pub fn XDisplayOfIM (_1: XIM) -> *mut Display, + pub fn XDisplayOfOM (_1: XOM) -> *mut Display, + pub fn XDisplayOfScreen (_1: *mut Screen) -> *mut Display, + pub fn XDisplayPlanes (_2: *mut Display, _1: c_int) -> c_int, + pub fn XDisplayString (_1: *mut Display) -> *mut c_char, + pub fn XDisplayWidth (_2: *mut Display, _1: c_int) -> c_int, + pub fn XDisplayWidthMM (_2: *mut Display, _1: c_int) -> c_int, + pub fn XDoesBackingStore (_1: *mut Screen) -> c_int, + pub fn XDoesSaveUnders (_1: *mut Screen) -> c_int, + pub fn XDrawArc (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_uint, _3: c_uint, _2: c_int, _1: c_int) -> c_int, + pub fn XDrawArcs (_5: *mut Display, _4: c_ulong, _3: GC, _2: *mut XArc, _1: c_int) -> c_int, + pub fn XDrawImageString (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> c_int, + pub fn XDrawImageString16 (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *const XChar2b, _1: c_int) -> c_int, + pub fn XDrawLine (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XDrawLines (_6: *mut Display, _5: c_ulong, _4: GC, _3: *mut XPoint, _2: c_int, _1: c_int) -> c_int, + pub fn XDrawPoint (_5: *mut Display, _4: c_ulong, _3: GC, _2: c_int, _1: c_int) -> c_int, + pub fn XDrawPoints (_6: *mut Display, _5: c_ulong, _4: GC, _3: *mut XPoint, _2: c_int, _1: c_int) -> c_int, + pub fn XDrawRectangle (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> c_int, + pub fn XDrawRectangles (_5: *mut Display, _4: c_ulong, _3: GC, _2: *mut XRectangle, _1: c_int) -> c_int, + pub fn XDrawSegments (_5: *mut Display, _4: c_ulong, _3: GC, _2: *mut XSegment, _1: c_int) -> c_int, + pub fn XDrawString (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> c_int, + pub fn XDrawString16 (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *const XChar2b, _1: c_int) -> c_int, + pub fn XDrawText (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *mut XTextItem, _1: c_int) -> c_int, + pub fn XDrawText16 (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *mut XTextItem16, _1: c_int) -> c_int, + pub fn XEHeadOfExtensionList (_1: XEDataObject) -> *mut *mut XExtData, + pub fn XEmptyRegion (_1: Region) -> c_int, + pub fn XEnableAccessControl (_1: *mut Display) -> c_int, + pub fn XEqualRegion (_2: Region, _1: Region) -> c_int, + pub fn XESetBeforeFlush (_3: *mut Display, _2: c_int, _1: Option) -> Option, + pub fn XESetCloseDisplay (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetCopyEventCookie (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetCopyGC (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetCreateFont (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetCreateGC (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetError (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetErrorString (_3: *mut Display, _2: c_int, _1: Option *mut c_char>) -> Option *mut c_char>, + pub fn XESetEventToWire (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetFlushGC (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetFreeFont (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetFreeGC (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetPrintErrorValues (_3: *mut Display, _2: c_int, _1: Option) -> Option, + pub fn XESetWireToError (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetWireToEvent (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XESetWireToEventCookie (_3: *mut Display, _2: c_int, _1: Option c_int>) -> Option c_int>, + pub fn XEventMaskOfScreen (_1: *mut Screen) -> c_long, + pub fn XEventsQueued (_2: *mut Display, _1: c_int) -> c_int, + pub fn XExtendedMaxRequestSize (_1: *mut Display) -> c_long, + pub fn XExtentsOfFontSet (_1: XFontSet) -> *mut XFontSetExtents, + pub fn XFetchBuffer (_3: *mut Display, _2: *mut c_int, _1: c_int) -> *mut c_char, + pub fn XFetchBytes (_2: *mut Display, _1: *mut c_int) -> *mut c_char, + pub fn XFetchName (_3: *mut Display, _2: c_ulong, _1: *mut *mut c_char) -> c_int, + pub fn XFillArc (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_uint, _3: c_uint, _2: c_int, _1: c_int) -> c_int, + pub fn XFillArcs (_5: *mut Display, _4: c_ulong, _3: GC, _2: *mut XArc, _1: c_int) -> c_int, + pub fn XFillPolygon (_7: *mut Display, _6: c_ulong, _5: GC, _4: *mut XPoint, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XFillRectangle (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> c_int, + pub fn XFillRectangles (_5: *mut Display, _4: c_ulong, _3: GC, _2: *mut XRectangle, _1: c_int) -> c_int, + pub fn XFilterEvent (_2: *mut XEvent, _1: c_ulong) -> c_int, + pub fn XFindContext (_4: *mut Display, _3: c_ulong, _2: c_int, _1: *mut *mut c_char) -> c_int, + pub fn XFindOnExtensionList (_2: *mut *mut XExtData, _1: c_int) -> *mut XExtData, + pub fn XFlush (_1: *mut Display) -> c_int, + pub fn XFlushGC (_2: *mut Display, _1: GC) -> (), + pub fn XFontsOfFontSet (_3: XFontSet, _2: *mut *mut *mut XFontStruct, _1: *mut *mut *mut c_char) -> c_int, + pub fn XForceScreenSaver (_2: *mut Display, _1: c_int) -> c_int, + pub fn XFree (_1: *mut c_void) -> c_int, + pub fn XFreeColormap (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XFreeColors (_5: *mut Display, _4: c_ulong, _3: *mut c_ulong, _2: c_int, _1: c_ulong) -> c_int, + pub fn XFreeCursor (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XFreeEventData (_2: *mut Display, _1: *mut XGenericEventCookie) -> (), + pub fn XFreeExtensionList (_1: *mut *mut c_char) -> c_int, + pub fn XFreeFont (_2: *mut Display, _1: *mut XFontStruct) -> c_int, + pub fn XFreeFontInfo (_3: *mut *mut c_char, _2: *mut XFontStruct, _1: c_int) -> c_int, + pub fn XFreeFontNames (_1: *mut *mut c_char) -> c_int, + pub fn XFreeFontPath (_1: *mut *mut c_char) -> c_int, + pub fn XFreeFontSet (_2: *mut Display, _1: XFontSet) -> (), + pub fn XFreeGC (_2: *mut Display, _1: GC) -> c_int, + pub fn XFreeModifiermap (_1: *mut XModifierKeymap) -> c_int, + pub fn XFreePixmap (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XFreeStringList (_1: *mut *mut c_char) -> (), + pub fn XGContextFromGC (_1: GC) -> c_ulong, + pub fn XGeometry (_13: *mut Display, _12: c_int, _11: *const c_char, _10: *const c_char, _9: c_uint, _8: c_uint, _7: c_uint, _6: c_int, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XGetAtomName (_2: *mut Display, _1: c_ulong) -> *mut c_char, + pub fn XGetAtomNames (_4: *mut Display, _3: *mut c_ulong, _2: c_int, _1: *mut *mut c_char) -> c_int, + pub fn XGetClassHint (_3: *mut Display, _2: c_ulong, _1: *mut XClassHint) -> c_int, + pub fn XGetCommand (_4: *mut Display, _3: c_ulong, _2: *mut *mut *mut c_char, _1: *mut c_int) -> c_int, + pub fn XGetDefault (_3: *mut Display, _2: *const c_char, _1: *const c_char) -> *mut c_char, + pub fn XGetErrorDatabaseText (_6: *mut Display, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut c_char, _1: c_int) -> c_int, + pub fn XGetErrorText (_4: *mut Display, _3: c_int, _2: *mut c_char, _1: c_int) -> c_int, + pub fn XGetEventData (_2: *mut Display, _1: *mut XGenericEventCookie) -> c_int, + pub fn XGetFontPath (_2: *mut Display, _1: *mut c_int) -> *mut *mut c_char, + pub fn XGetFontProperty (_3: *mut XFontStruct, _2: c_ulong, _1: *mut c_ulong) -> c_int, + pub fn XGetGCValues (_4: *mut Display, _3: GC, _2: c_ulong, _1: *mut XGCValues) -> c_int, + pub fn XGetGeometry (_9: *mut Display, _8: c_ulong, _7: *mut c_ulong, _6: *mut c_int, _5: *mut c_int, _4: *mut c_uint, _3: *mut c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XGetIconName (_3: *mut Display, _2: c_ulong, _1: *mut *mut c_char) -> c_int, + pub fn XGetIconSizes (_4: *mut Display, _3: c_ulong, _2: *mut *mut XIconSize, _1: *mut c_int) -> c_int, + pub fn XGetImage (_8: *mut Display, _7: c_ulong, _6: c_int, _5: c_int, _4: c_uint, _3: c_uint, _2: c_ulong, _1: c_int) -> *mut XImage, + pub fn XGetInputFocus (_3: *mut Display, _2: *mut c_ulong, _1: *mut c_int) -> c_int, + pub fn XGetKeyboardControl (_2: *mut Display, _1: *mut XKeyboardState) -> c_int, + pub fn XGetKeyboardMapping (_4: *mut Display, _3: c_uchar, _2: c_int, _1: *mut c_int) -> *mut c_ulong, + pub fn XGetModifierMapping (_1: *mut Display) -> *mut XModifierKeymap, + pub fn XGetMotionEvents (_5: *mut Display, _4: c_ulong, _3: c_ulong, _2: c_ulong, _1: *mut c_int) -> *mut XTimeCoord, + pub fn XGetNormalHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> c_int, + pub fn XGetPixel (_3: *mut XImage, _2: c_int, _1: c_int) -> c_ulong, + pub fn XGetPointerControl (_4: *mut Display, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XGetPointerMapping (_3: *mut Display, _2: *mut c_uchar, _1: c_int) -> c_int, + pub fn XGetRGBColormaps (_5: *mut Display, _4: c_ulong, _3: *mut *mut XStandardColormap, _2: *mut c_int, _1: c_ulong) -> c_int, + pub fn XGetScreenSaver (_5: *mut Display, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XGetSelectionOwner (_2: *mut Display, _1: c_ulong) -> c_ulong, + pub fn XGetSizeHints (_4: *mut Display, _3: c_ulong, _2: *mut XSizeHints, _1: c_ulong) -> c_int, + pub fn XGetStandardColormap (_4: *mut Display, _3: c_ulong, _2: *mut XStandardColormap, _1: c_ulong) -> c_int, + pub fn XGetSubImage (_11: *mut Display, _10: c_ulong, _9: c_int, _8: c_int, _7: c_uint, _6: c_uint, _5: c_ulong, _4: c_int, _3: *mut XImage, _2: c_int, _1: c_int) -> *mut XImage, + pub fn XGetTextProperty (_4: *mut Display, _3: c_ulong, _2: *mut XTextProperty, _1: c_ulong) -> c_int, + pub fn XGetTransientForHint (_3: *mut Display, _2: c_ulong, _1: *mut c_ulong) -> c_int, + pub fn XGetVisualInfo (_4: *mut Display, _3: c_long, _2: *mut XVisualInfo, _1: *mut c_int) -> *mut XVisualInfo, + pub fn XGetWindowAttributes (_3: *mut Display, _2: c_ulong, _1: *mut XWindowAttributes) -> c_int, + pub fn XGetWindowProperty (_12: *mut Display, _11: c_ulong, _10: c_ulong, _9: c_long, _8: c_long, _7: c_int, _6: c_ulong, _5: *mut c_ulong, _4: *mut c_int, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut *mut c_uchar) -> c_int, + pub fn XGetWMClientMachine (_3: *mut Display, _2: c_ulong, _1: *mut XTextProperty) -> c_int, + pub fn XGetWMColormapWindows (_4: *mut Display, _3: c_ulong, _2: *mut *mut c_ulong, _1: *mut c_int) -> c_int, + pub fn XGetWMHints (_2: *mut Display, _1: c_ulong) -> *mut XWMHints, + pub fn XGetWMIconName (_3: *mut Display, _2: c_ulong, _1: *mut XTextProperty) -> c_int, + pub fn XGetWMName (_3: *mut Display, _2: c_ulong, _1: *mut XTextProperty) -> c_int, + pub fn XGetWMNormalHints (_4: *mut Display, _3: c_ulong, _2: *mut XSizeHints, _1: *mut c_long) -> c_int, + pub fn XGetWMProtocols (_4: *mut Display, _3: c_ulong, _2: *mut *mut c_ulong, _1: *mut c_int) -> c_int, + pub fn XGetWMSizeHints (_5: *mut Display, _4: c_ulong, _3: *mut XSizeHints, _2: *mut c_long, _1: c_ulong) -> c_int, + pub fn XGetZoomHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> c_int, + pub fn XGrabButton (_10: *mut Display, _9: c_uint, _8: c_uint, _7: c_ulong, _6: c_int, _5: c_uint, _4: c_int, _3: c_int, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XGrabKey (_7: *mut Display, _6: c_int, _5: c_uint, _4: c_ulong, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XGrabKeyboard (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XGrabPointer (_9: *mut Display, _8: c_ulong, _7: c_int, _6: c_uint, _5: c_int, _4: c_int, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XGrabServer (_1: *mut Display) -> c_int, + pub fn XHeightMMOfScreen (_1: *mut Screen) -> c_int, + pub fn XHeightOfScreen (_1: *mut Screen) -> c_int, + pub fn XIconifyWindow (_3: *mut Display, _2: c_ulong, _1: c_int) -> c_int, + pub fn XIfEvent (_4: *mut Display, _3: *mut XEvent, _2: Option c_int>, _1: *mut c_char) -> c_int, + pub fn XImageByteOrder (_1: *mut Display) -> c_int, + pub fn XIMOfIC (_1: XIC) -> XIM, + pub fn XInitExtension (_2: *mut Display, _1: *const c_char) -> *mut XExtCodes, + pub fn XInitImage (_1: *mut XImage) -> c_int, + pub fn XInitThreads () -> c_int, + pub fn XInsertModifiermapEntry (_3: *mut XModifierKeymap, _2: c_uchar, _1: c_int) -> *mut XModifierKeymap, + pub fn XInstallColormap (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XInternalConnectionNumbers (_3: *mut Display, _2: *mut *mut c_int, _1: *mut c_int) -> c_int, + pub fn XInternAtom (_3: *mut Display, _2: *const c_char, _1: c_int) -> c_ulong, + pub fn XInternAtoms (_5: *mut Display, _4: *mut *mut c_char, _3: c_int, _2: c_int, _1: *mut c_ulong) -> c_int, + pub fn XIntersectRegion (_3: Region, _2: Region, _1: Region) -> c_int, + pub fn XkbAddDeviceLedInfo (_3: XkbDeviceInfoPtr, _2: c_uint, _1: c_uint) -> XkbDeviceLedInfoPtr, + pub fn XkbAddGeomColor (_3: XkbGeometryPtr, _2: *mut c_char, _1: c_uint) -> XkbColorPtr, + pub fn XkbAddGeomDoodad (_3: XkbGeometryPtr, _2: XkbSectionPtr, _1: c_ulong) -> XkbDoodadPtr, + pub fn XkbAddGeomKey (_1: XkbRowPtr) -> XkbKeyPtr, + pub fn XkbAddGeomKeyAlias (_3: XkbGeometryPtr, _2: *mut c_char, _1: *mut c_char) -> XkbKeyAliasPtr, + pub fn XkbAddGeomOutline (_2: XkbShapePtr, _1: c_int) -> XkbOutlinePtr, + pub fn XkbAddGeomOverlay (_3: XkbSectionPtr, _2: c_ulong, _1: c_int) -> XkbOverlayPtr, + pub fn XkbAddGeomOverlayKey (_4: XkbOverlayPtr, _3: XkbOverlayRowPtr, _2: *mut c_char, _1: *mut c_char) -> XkbOverlayKeyPtr, + pub fn XkbAddGeomOverlayRow (_3: XkbOverlayPtr, _2: c_int, _1: c_int) -> XkbOverlayRowPtr, + pub fn XkbAddGeomProperty (_3: XkbGeometryPtr, _2: *mut c_char, _1: *mut c_char) -> XkbPropertyPtr, + pub fn XkbAddGeomRow (_2: XkbSectionPtr, _1: c_int) -> XkbRowPtr, + pub fn XkbAddGeomSection (_5: XkbGeometryPtr, _4: c_ulong, _3: c_int, _2: c_int, _1: c_int) -> XkbSectionPtr, + pub fn XkbAddGeomShape (_3: XkbGeometryPtr, _2: c_ulong, _1: c_int) -> XkbShapePtr, + pub fn XkbAddKeyType (_5: XkbDescPtr, _4: c_ulong, _3: c_int, _2: c_int, _1: c_int) -> XkbKeyTypePtr, + pub fn XkbAllocClientMap (_3: XkbDescPtr, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbAllocCompatMap (_3: XkbDescPtr, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbAllocControls (_2: XkbDescPtr, _1: c_uint) -> c_int, + pub fn XkbAllocDeviceInfo (_3: c_uint, _2: c_uint, _1: c_uint) -> XkbDeviceInfoPtr, + pub fn XkbAllocGeomColors (_2: XkbGeometryPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomDoodads (_2: XkbGeometryPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeometry (_2: XkbDescPtr, _1: XkbGeometrySizesPtr) -> c_int, + pub fn XkbAllocGeomKeyAliases (_2: XkbGeometryPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomKeys (_2: XkbRowPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomOutlines (_2: XkbShapePtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomOverlayKeys (_2: XkbOverlayRowPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomOverlayRows (_2: XkbOverlayPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomOverlays (_2: XkbSectionPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomPoints (_2: XkbOutlinePtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomProps (_2: XkbGeometryPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomRows (_2: XkbSectionPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomSectionDoodads (_2: XkbSectionPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomSections (_2: XkbGeometryPtr, _1: c_int) -> c_int, + pub fn XkbAllocGeomShapes (_2: XkbGeometryPtr, _1: c_int) -> c_int, + pub fn XkbAllocIndicatorMaps (_1: XkbDescPtr) -> c_int, + pub fn XkbAllocKeyboard () -> XkbDescPtr, + pub fn XkbAllocNames (_4: XkbDescPtr, _3: c_uint, _2: c_int, _1: c_int) -> c_int, + pub fn XkbAllocServerMap (_3: XkbDescPtr, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbApplyCompatMapToKey (_3: XkbDescPtr, _2: c_uchar, _1: XkbChangesPtr) -> c_int, + pub fn XkbApplyVirtualModChanges (_3: XkbDescPtr, _2: c_uint, _1: XkbChangesPtr) -> c_int, + pub fn XkbBell (_4: *mut Display, _3: c_ulong, _2: c_int, _1: c_ulong) -> c_int, + pub fn XkbBellEvent (_4: *mut Display, _3: c_ulong, _2: c_int, _1: c_ulong) -> c_int, + pub fn XkbChangeDeviceInfo (_3: *mut Display, _2: XkbDeviceInfoPtr, _1: XkbDeviceChangesPtr) -> c_int, + pub fn XkbChangeEnabledControls (_4: *mut Display, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbChangeKeycodeRange (_4: XkbDescPtr, _3: c_int, _2: c_int, _1: XkbChangesPtr) -> c_int, + pub fn XkbChangeMap (_3: *mut Display, _2: XkbDescPtr, _1: XkbMapChangesPtr) -> c_int, + pub fn XkbChangeNames (_3: *mut Display, _2: XkbDescPtr, _1: XkbNameChangesPtr) -> c_int, + pub fn XkbChangeTypesOfKey (_6: XkbDescPtr, _5: c_int, _4: c_int, _3: c_uint, _2: *mut c_int, _1: XkbMapChangesPtr) -> c_int, + pub fn XkbComputeEffectiveMap (_3: XkbDescPtr, _2: XkbKeyTypePtr, _1: *mut c_uchar) -> c_int, + pub fn XkbComputeRowBounds (_3: XkbGeometryPtr, _2: XkbSectionPtr, _1: XkbRowPtr) -> c_int, + pub fn XkbComputeSectionBounds (_2: XkbGeometryPtr, _1: XkbSectionPtr) -> c_int, + pub fn XkbComputeShapeBounds (_1: XkbShapePtr) -> c_int, + pub fn XkbComputeShapeTop (_2: XkbShapePtr, _1: XkbBoundsPtr) -> c_int, + pub fn XkbCopyKeyType (_2: XkbKeyTypePtr, _1: XkbKeyTypePtr) -> c_int, + pub fn XkbCopyKeyTypes (_3: XkbKeyTypePtr, _2: XkbKeyTypePtr, _1: c_int) -> c_int, + pub fn XkbDeviceBell (_7: *mut Display, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XkbDeviceBellEvent (_7: *mut Display, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XkbFindOverlayForKey (_3: XkbGeometryPtr, _2: XkbSectionPtr, _1: *mut c_char) -> *mut c_char, + pub fn XkbForceBell (_2: *mut Display, _1: c_int) -> c_int, + pub fn XkbForceDeviceBell (_5: *mut Display, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XkbFreeClientMap (_3: XkbDescPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbFreeCompatMap (_3: XkbDescPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbFreeComponentList (_1: XkbComponentListPtr) -> (), + pub fn XkbFreeControls (_3: XkbDescPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbFreeDeviceInfo (_3: XkbDeviceInfoPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbFreeGeomColors (_4: XkbGeometryPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomDoodads (_3: XkbDoodadPtr, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeometry (_3: XkbGeometryPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbFreeGeomKeyAliases (_4: XkbGeometryPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomKeys (_4: XkbRowPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomOutlines (_4: XkbShapePtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomOverlayKeys (_4: XkbOverlayRowPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomOverlayRows (_4: XkbOverlayPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomOverlays (_4: XkbSectionPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomPoints (_4: XkbOutlinePtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomProperties (_4: XkbGeometryPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomRows (_4: XkbSectionPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomSections (_4: XkbGeometryPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeGeomShapes (_4: XkbGeometryPtr, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XkbFreeIndicatorMaps (_1: XkbDescPtr) -> (), + pub fn XkbFreeKeyboard (_3: XkbDescPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbFreeNames (_3: XkbDescPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbFreeServerMap (_3: XkbDescPtr, _2: c_uint, _1: c_int) -> (), + pub fn XkbGetAutoRepeatRate (_4: *mut Display, _3: c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XkbGetAutoResetControls (_3: *mut Display, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XkbGetCompatMap (_3: *mut Display, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetControls (_3: *mut Display, _2: c_ulong, _1: XkbDescPtr) -> c_int, + pub fn XkbGetDetectableAutoRepeat (_2: *mut Display, _1: *mut c_int) -> c_int, + pub fn XkbGetDeviceButtonActions (_5: *mut Display, _4: XkbDeviceInfoPtr, _3: c_int, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbGetDeviceInfo (_5: *mut Display, _4: c_uint, _3: c_uint, _2: c_uint, _1: c_uint) -> XkbDeviceInfoPtr, + pub fn XkbGetDeviceInfoChanges (_3: *mut Display, _2: XkbDeviceInfoPtr, _1: XkbDeviceChangesPtr) -> c_int, + pub fn XkbGetDeviceLedInfo (_5: *mut Display, _4: XkbDeviceInfoPtr, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbGetGeometry (_2: *mut Display, _1: XkbDescPtr) -> c_int, + pub fn XkbGetIndicatorMap (_3: *mut Display, _2: c_ulong, _1: XkbDescPtr) -> c_int, + pub fn XkbGetIndicatorState (_3: *mut Display, _2: c_uint, _1: *mut c_uint) -> c_int, + pub fn XkbGetKeyActions (_4: *mut Display, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetKeyBehaviors (_4: *mut Display, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetKeyboard (_3: *mut Display, _2: c_uint, _1: c_uint) -> XkbDescPtr, + pub fn XkbGetKeyboardByName (_6: *mut Display, _5: c_uint, _4: XkbComponentNamesPtr, _3: c_uint, _2: c_uint, _1: c_int) -> XkbDescPtr, + pub fn XkbGetKeyExplicitComponents (_4: *mut Display, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetKeyModifierMap (_4: *mut Display, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetKeySyms (_4: *mut Display, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetKeyTypes (_4: *mut Display, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetKeyVirtualModMap (_4: *mut Display, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetMap (_3: *mut Display, _2: c_uint, _1: c_uint) -> XkbDescPtr, + pub fn XkbGetMapChanges (_3: *mut Display, _2: XkbDescPtr, _1: XkbMapChangesPtr) -> c_int, + pub fn XkbGetNamedDeviceIndicator (_9: *mut Display, _8: c_uint, _7: c_uint, _6: c_uint, _5: c_ulong, _4: *mut c_int, _3: *mut c_int, _2: XkbIndicatorMapPtr, _1: *mut c_int) -> c_int, + pub fn XkbGetNamedGeometry (_3: *mut Display, _2: XkbDescPtr, _1: c_ulong) -> c_int, + pub fn XkbGetNamedIndicator (_6: *mut Display, _5: c_ulong, _4: *mut c_int, _3: *mut c_int, _2: XkbIndicatorMapPtr, _1: *mut c_int) -> c_int, + pub fn XkbGetNames (_3: *mut Display, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetPerClientControls (_2: *mut Display, _1: *mut c_uint) -> c_int, + pub fn XkbGetState (_3: *mut Display, _2: c_uint, _1: XkbStatePtr) -> c_int, + pub fn XkbGetUpdatedMap (_3: *mut Display, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetVirtualMods (_3: *mut Display, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbGetXlibControls (_1: *mut Display) -> c_uint, + pub fn XkbIgnoreExtension (_1: c_int) -> c_int, + pub fn XkbInitCanonicalKeyTypes (_3: XkbDescPtr, _2: c_uint, _1: c_int) -> c_int, + pub fn XkbKeycodeToKeysym (_4: *mut Display, _3: c_uchar, _2: c_int, _1: c_int) -> c_ulong, + pub fn XkbKeysymToModifiers (_2: *mut Display, _1: c_ulong) -> c_uint, + pub fn XkbKeyTypesForCoreSymbols (_6: XkbDescPtr, _5: c_int, _4: *mut c_ulong, _3: c_uint, _2: *mut c_int, _1: *mut c_ulong) -> c_int, + pub fn XkbLatchGroup (_3: *mut Display, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbLatchModifiers (_4: *mut Display, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbLibraryVersion (_2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XkbListComponents (_4: *mut Display, _3: c_uint, _2: XkbComponentNamesPtr, _1: *mut c_int) -> XkbComponentListPtr, + pub fn XkbLockGroup (_3: *mut Display, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbLockModifiers (_4: *mut Display, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbLookupKeyBinding (_6: *mut Display, _5: c_ulong, _4: c_uint, _3: *mut c_char, _2: c_int, _1: *mut c_int) -> c_int, + pub fn XkbLookupKeySym (_5: *mut Display, _4: c_uchar, _3: c_uint, _2: *mut c_uint, _1: *mut c_ulong) -> c_int, + pub fn XkbNoteControlsChanges (_3: XkbControlsChangesPtr, _2: *mut XkbControlsNotifyEvent, _1: c_uint) -> (), + pub fn XkbNoteDeviceChanges (_3: XkbDeviceChangesPtr, _2: *mut XkbExtensionDeviceNotifyEvent, _1: c_uint) -> (), + pub fn XkbNoteMapChanges (_3: XkbMapChangesPtr, _2: *mut XkbMapNotifyEvent, _1: c_uint) -> (), + pub fn XkbNoteNameChanges (_3: XkbNameChangesPtr, _2: *mut XkbNamesNotifyEvent, _1: c_uint) -> (), + pub fn XkbOpenDisplay (_6: *mut c_char, _5: *mut c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> *mut Display, + pub fn XkbQueryExtension (_6: *mut Display, _5: *mut c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XkbRefreshKeyboardMapping (_1: *mut XkbMapNotifyEvent) -> c_int, + pub fn XkbResizeDeviceButtonActions (_2: XkbDeviceInfoPtr, _1: c_uint) -> c_int, + pub fn XkbResizeKeyActions (_3: XkbDescPtr, _2: c_int, _1: c_int) -> *mut XkbAction, + pub fn XkbResizeKeySyms (_3: XkbDescPtr, _2: c_int, _1: c_int) -> *mut c_ulong, + pub fn XkbResizeKeyType (_5: XkbDescPtr, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XkbSelectEventDetails (_5: *mut Display, _4: c_uint, _3: c_uint, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XkbSelectEvents (_4: *mut Display, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbSetAtomFuncs (_2: Option c_ulong>, _1: Option *mut c_char>) -> (), + pub fn XkbSetAutoRepeatRate (_4: *mut Display, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbSetAutoResetControls (_4: *mut Display, _3: c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XkbSetCompatMap (_4: *mut Display, _3: c_uint, _2: XkbDescPtr, _1: c_int) -> c_int, + pub fn XkbSetControls (_3: *mut Display, _2: c_ulong, _1: XkbDescPtr) -> c_int, + pub fn XkbSetDebuggingFlags (_8: *mut Display, _7: c_uint, _6: c_uint, _5: *mut c_char, _4: c_uint, _3: c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XkbSetDetectableAutoRepeat (_3: *mut Display, _2: c_int, _1: *mut c_int) -> c_int, + pub fn XkbSetDeviceButtonActions (_4: *mut Display, _3: XkbDeviceInfoPtr, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbSetDeviceInfo (_3: *mut Display, _2: c_uint, _1: XkbDeviceInfoPtr) -> c_int, + pub fn XkbSetDeviceLedInfo (_5: *mut Display, _4: XkbDeviceInfoPtr, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbSetGeometry (_3: *mut Display, _2: c_uint, _1: XkbGeometryPtr) -> c_int, + pub fn XkbSetIgnoreLockMods (_6: *mut Display, _5: c_uint, _4: c_uint, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbSetIndicatorMap (_3: *mut Display, _2: c_ulong, _1: XkbDescPtr) -> c_int, + pub fn XkbSetMap (_3: *mut Display, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbSetNamedDeviceIndicator (_9: *mut Display, _8: c_uint, _7: c_uint, _6: c_uint, _5: c_ulong, _4: c_int, _3: c_int, _2: c_int, _1: XkbIndicatorMapPtr) -> c_int, + pub fn XkbSetNamedIndicator (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: c_int, _1: XkbIndicatorMapPtr) -> c_int, + pub fn XkbSetNames (_5: *mut Display, _4: c_uint, _3: c_uint, _2: c_uint, _1: XkbDescPtr) -> c_int, + pub fn XkbSetPerClientControls (_3: *mut Display, _2: c_uint, _1: *mut c_uint) -> c_int, + pub fn XkbSetServerInternalMods (_6: *mut Display, _5: c_uint, _4: c_uint, _3: c_uint, _2: c_uint, _1: c_uint) -> c_int, + pub fn XkbSetXlibControls (_3: *mut Display, _2: c_uint, _1: c_uint) -> c_uint, + pub fn XkbToControl (_1: c_char) -> c_char, + pub fn XkbTranslateKeyCode (_5: XkbDescPtr, _4: c_uchar, _3: c_uint, _2: *mut c_uint, _1: *mut c_ulong) -> c_int, + pub fn XkbTranslateKeySym (_6: *mut Display, _5: *mut c_ulong, _4: c_uint, _3: *mut c_char, _2: c_int, _1: *mut c_int) -> c_int, + pub fn XkbUpdateActionVirtualMods (_3: XkbDescPtr, _2: *mut XkbAction, _1: c_uint) -> c_int, + pub fn XkbUpdateKeyTypeVirtualMods (_4: XkbDescPtr, _3: XkbKeyTypePtr, _2: c_uint, _1: XkbChangesPtr) -> (), + pub fn XkbUpdateMapFromCore (_6: XkbDescPtr, _5: c_uchar, _4: c_int, _3: c_int, _2: *mut c_ulong, _1: XkbChangesPtr) -> c_int, + pub fn XkbUseExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XkbVirtualModsToReal (_3: XkbDescPtr, _2: c_uint, _1: *mut c_uint) -> c_int, + pub fn XkbXlibControlsImplemented () -> c_uint, + pub fn XKeycodeToKeysym (_3: *mut Display, _2: c_uchar, _1: c_int) -> c_ulong, + pub fn XKeysymToKeycode (_2: *mut Display, _1: c_ulong) -> c_uchar, + pub fn XKeysymToString (_1: c_ulong) -> *mut c_char, + pub fn XKillClient (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XLastKnownRequestProcessed (_1: *mut Display) -> c_ulong, + pub fn XListDepths (_3: *mut Display, _2: c_int, _1: *mut c_int) -> *mut c_int, + pub fn XListExtensions (_2: *mut Display, _1: *mut c_int) -> *mut *mut c_char, + pub fn XListFonts (_4: *mut Display, _3: *const c_char, _2: c_int, _1: *mut c_int) -> *mut *mut c_char, + pub fn XListFontsWithInfo (_5: *mut Display, _4: *const c_char, _3: c_int, _2: *mut c_int, _1: *mut *mut XFontStruct) -> *mut *mut c_char, + pub fn XListHosts (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> *mut XHostAddress, + pub fn XListInstalledColormaps (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> *mut c_ulong, + pub fn XListPixmapFormats (_2: *mut Display, _1: *mut c_int) -> *mut XPixmapFormatValues, + pub fn XListProperties (_3: *mut Display, _2: c_ulong, _1: *mut c_int) -> *mut c_ulong, + pub fn XLoadFont (_2: *mut Display, _1: *const c_char) -> c_ulong, + pub fn XLoadQueryFont (_2: *mut Display, _1: *const c_char) -> *mut XFontStruct, + pub fn XLocaleOfFontSet (_1: XFontSet) -> *mut c_char, + pub fn XLocaleOfIM (_1: XIM) -> *mut c_char, + pub fn XLocaleOfOM (_1: XOM) -> *mut c_char, + pub fn XLockDisplay (_1: *mut Display) -> (), + pub fn XLookupColor (_5: *mut Display, _4: c_ulong, _3: *const c_char, _2: *mut XColor, _1: *mut XColor) -> c_int, + pub fn XLookupKeysym (_2: *mut XKeyEvent, _1: c_int) -> c_ulong, + pub fn XLookupString (_5: *mut XKeyEvent, _4: *mut c_char, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XLowerWindow (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XMapRaised (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XMapSubwindows (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XMapWindow (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XMaskEvent (_3: *mut Display, _2: c_long, _1: *mut XEvent) -> c_int, + pub fn XMatchVisualInfo (_5: *mut Display, _4: c_int, _3: c_int, _2: c_int, _1: *mut XVisualInfo) -> c_int, + pub fn XMaxCmapsOfScreen (_1: *mut Screen) -> c_int, + pub fn XMaxRequestSize (_1: *mut Display) -> c_long, + pub fn XmbDrawImageString (_8: *mut Display, _7: c_ulong, _6: XFontSet, _5: GC, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> (), + pub fn XmbDrawString (_8: *mut Display, _7: c_ulong, _6: XFontSet, _5: GC, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> (), + pub fn XmbDrawText (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *mut XmbTextItem, _1: c_int) -> (), + pub fn XmbLookupString (_6: XIC, _5: *mut XKeyEvent, _4: *mut c_char, _3: c_int, _2: *mut c_ulong, _1: *mut c_int) -> c_int, + pub fn XmbResetIC (_1: XIC) -> *mut c_char, + pub fn XmbSetWMProperties (_9: *mut Display, _8: c_ulong, _7: *const c_char, _6: *const c_char, _5: *mut *mut c_char, _4: c_int, _3: *mut XSizeHints, _2: *mut XWMHints, _1: *mut XClassHint) -> (), + pub fn XmbTextEscapement (_3: XFontSet, _2: *const c_char, _1: c_int) -> c_int, + pub fn XmbTextExtents (_5: XFontSet, _4: *const c_char, _3: c_int, _2: *mut XRectangle, _1: *mut XRectangle) -> c_int, + pub fn XmbTextListToTextProperty (_5: *mut Display, _4: *mut *mut c_char, _3: c_int, _2: XICCEncodingStyle, _1: *mut XTextProperty) -> c_int, + pub fn XmbTextPerCharExtents (_9: XFontSet, _8: *const c_char, _7: c_int, _6: *mut XRectangle, _5: *mut XRectangle, _4: c_int, _3: *mut c_int, _2: *mut XRectangle, _1: *mut XRectangle) -> c_int, + pub fn XmbTextPropertyToTextList (_4: *mut Display, _3: *const XTextProperty, _2: *mut *mut *mut c_char, _1: *mut c_int) -> c_int, + pub fn XMinCmapsOfScreen (_1: *mut Screen) -> c_int, + pub fn XMoveResizeWindow (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> c_int, + pub fn XMoveWindow (_4: *mut Display, _3: c_ulong, _2: c_int, _1: c_int) -> c_int, + pub fn XNewModifiermap (_1: c_int) -> *mut XModifierKeymap, + pub fn XNextEvent (_2: *mut Display, _1: *mut XEvent) -> c_int, + pub fn XNextRequest (_1: *mut Display) -> c_ulong, + pub fn XNoOp (_1: *mut Display) -> c_int, + pub fn XOffsetRegion (_3: Region, _2: c_int, _1: c_int) -> c_int, + pub fn XOMOfOC (_1: XFontSet) -> XOM, + pub fn XOpenDisplay (_1: *const c_char) -> *mut Display, + pub fn XOpenIM (_4: *mut Display, _3: XrmDatabase, _2: *mut c_char, _1: *mut c_char) -> XIM, + pub fn XOpenOM (_4: *mut Display, _3: XrmDatabase, _2: *const c_char, _1: *const c_char) -> XOM, + pub fn XParseColor (_4: *mut Display, _3: c_ulong, _2: *const c_char, _1: *mut XColor) -> c_int, + pub fn XParseGeometry (_5: *const c_char, _4: *mut c_int, _3: *mut c_int, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XPeekEvent (_2: *mut Display, _1: *mut XEvent) -> c_int, + pub fn XPeekIfEvent (_4: *mut Display, _3: *mut XEvent, _2: Option c_int>, _1: *mut c_char) -> c_int, + pub fn XPending (_1: *mut Display) -> c_int, + pub fn Xpermalloc (_1: c_uint) -> *mut c_char, + pub fn XPlanesOfScreen (_1: *mut Screen) -> c_int, + pub fn XPointInRegion (_3: Region, _2: c_int, _1: c_int) -> c_int, + pub fn XPolygonRegion (_3: *mut XPoint, _2: c_int, _1: c_int) -> Region, + pub fn XProcessInternalConnection (_2: *mut Display, _1: c_int) -> (), + pub fn XProtocolRevision (_1: *mut Display) -> c_int, + pub fn XProtocolVersion (_1: *mut Display) -> c_int, + pub fn XPutBackEvent (_2: *mut Display, _1: *mut XEvent) -> c_int, + pub fn XPutImage (_10: *mut Display, _9: c_ulong, _8: GC, _7: *mut XImage, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> c_int, + pub fn XPutPixel (_4: *mut XImage, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XQLength (_1: *mut Display) -> c_int, + pub fn XQueryBestCursor (_6: *mut Display, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XQueryBestSize (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XQueryBestStipple (_6: *mut Display, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XQueryBestTile (_6: *mut Display, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *mut c_uint, _1: *mut c_uint) -> c_int, + pub fn XQueryColor (_3: *mut Display, _2: c_ulong, _1: *mut XColor) -> c_int, + pub fn XQueryColors (_4: *mut Display, _3: c_ulong, _2: *mut XColor, _1: c_int) -> c_int, + pub fn XQueryExtension (_5: *mut Display, _4: *const c_char, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XQueryFont (_2: *mut Display, _1: c_ulong) -> *mut XFontStruct, + pub fn XQueryKeymap (_2: *mut Display, _1: *mut c_char) -> c_int, + pub fn XQueryPointer (_9: *mut Display, _8: c_ulong, _7: *mut c_ulong, _6: *mut c_ulong, _5: *mut c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_uint) -> c_int, + pub fn XQueryTextExtents (_8: *mut Display, _7: c_ulong, _6: *const c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut XCharStruct) -> c_int, + pub fn XQueryTextExtents16 (_8: *mut Display, _7: c_ulong, _6: *const XChar2b, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut XCharStruct) -> c_int, + pub fn XQueryTree (_6: *mut Display, _5: c_ulong, _4: *mut c_ulong, _3: *mut c_ulong, _2: *mut *mut c_ulong, _1: *mut c_uint) -> c_int, + pub fn XRaiseWindow (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XReadBitmapFile (_8: *mut Display, _7: c_ulong, _6: *const c_char, _5: *mut c_uint, _4: *mut c_uint, _3: *mut c_ulong, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XReadBitmapFileData (_6: *const c_char, _5: *mut c_uint, _4: *mut c_uint, _3: *mut *mut c_uchar, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XRebindKeysym (_6: *mut Display, _5: c_ulong, _4: *mut c_ulong, _3: c_int, _2: *const c_uchar, _1: c_int) -> c_int, + pub fn XRecolorCursor (_4: *mut Display, _3: c_ulong, _2: *mut XColor, _1: *mut XColor) -> c_int, + pub fn XReconfigureWMWindow (_5: *mut Display, _4: c_ulong, _3: c_int, _2: c_uint, _1: *mut XWindowChanges) -> c_int, + pub fn XRectInRegion (_5: Region, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> c_int, + pub fn XRefreshKeyboardMapping (_1: *mut XMappingEvent) -> c_int, + pub fn XRegisterIMInstantiateCallback (_6: *mut Display, _5: XrmDatabase, _4: *mut c_char, _3: *mut c_char, _2: Option, _1: *mut c_char) -> c_int, + pub fn XRemoveConnectionWatch (_3: *mut Display, _2: Option, _1: *mut c_char) -> (), + pub fn XRemoveFromSaveSet (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XRemoveHost (_2: *mut Display, _1: *mut XHostAddress) -> c_int, + pub fn XRemoveHosts (_3: *mut Display, _2: *mut XHostAddress, _1: c_int) -> c_int, + pub fn XReparentWindow (_5: *mut Display, _4: c_ulong, _3: c_ulong, _2: c_int, _1: c_int) -> c_int, + pub fn XResetScreenSaver (_1: *mut Display) -> c_int, + pub fn XResizeWindow (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: c_uint) -> c_int, + pub fn XResourceManagerString (_1: *mut Display) -> *mut c_char, + pub fn XRestackWindows (_3: *mut Display, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XrmCombineDatabase (_3: XrmDatabase, _2: *mut XrmDatabase, _1: c_int) -> (), + pub fn XrmCombineFileDatabase (_3: *const c_char, _2: *mut XrmDatabase, _1: c_int) -> c_int, + pub fn XrmDestroyDatabase (_1: XrmDatabase) -> (), + pub fn XrmEnumerateDatabase (_6: XrmDatabase, _5: *mut c_int, _4: *mut c_int, _3: c_int, _2: Option c_int>, _1: *mut c_char) -> c_int, + pub fn XrmGetDatabase (_1: *mut Display) -> XrmDatabase, + pub fn XrmGetFileDatabase (_1: *const c_char) -> XrmDatabase, + pub fn XrmGetResource (_5: XrmDatabase, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut XrmValue) -> c_int, + pub fn XrmGetStringDatabase (_1: *const c_char) -> XrmDatabase, + pub fn XrmInitialize () -> (), + pub fn XrmLocaleOfDatabase (_1: XrmDatabase) -> *const c_char, + pub fn XrmMergeDatabases (_2: XrmDatabase, _1: *mut XrmDatabase) -> (), + pub fn XrmParseCommand (_6: *mut XrmDatabase, _5: XrmOptionDescList, _4: c_int, _3: *const c_char, _2: *mut c_int, _1: *mut *mut c_char) -> (), + pub fn XrmPermStringToQuark (_1: *const c_char) -> c_int, + pub fn XrmPutFileDatabase (_2: XrmDatabase, _1: *const c_char) -> (), + pub fn XrmPutLineResource (_2: *mut XrmDatabase, _1: *const c_char) -> (), + pub fn XrmPutResource (_4: *mut XrmDatabase, _3: *const c_char, _2: *const c_char, _1: *mut XrmValue) -> (), + pub fn XrmPutStringResource (_3: *mut XrmDatabase, _2: *const c_char, _1: *const c_char) -> (), + pub fn XrmQGetResource (_5: XrmDatabase, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut XrmValue) -> c_int, + pub fn XrmQGetSearchList (_5: XrmDatabase, _4: *mut c_int, _3: *mut c_int, _2: *mut *mut XrmDatabase, _1: c_int) -> c_int, + pub fn XrmQGetSearchResource (_5: *mut *mut XrmDatabase, _4: c_int, _3: c_int, _2: *mut c_int, _1: *mut XrmValue) -> c_int, + pub fn XrmQPutResource (_5: *mut XrmDatabase, _4: *mut XrmBinding, _3: *mut c_int, _2: c_int, _1: *mut XrmValue) -> (), + pub fn XrmQPutStringResource (_4: *mut XrmDatabase, _3: *mut XrmBinding, _2: *mut c_int, _1: *const c_char) -> (), + pub fn XrmQuarkToString (_1: c_int) -> *mut c_char, + pub fn XrmSetDatabase (_2: *mut Display, _1: XrmDatabase) -> (), + pub fn XrmStringToBindingQuarkList (_3: *const c_char, _2: *mut XrmBinding, _1: *mut c_int) -> (), + pub fn XrmStringToQuark (_1: *const c_char) -> c_int, + pub fn XrmStringToQuarkList (_2: *const c_char, _1: *mut c_int) -> (), + pub fn XrmUniqueQuark () -> c_int, + pub fn XRootWindow (_2: *mut Display, _1: c_int) -> c_ulong, + pub fn XRootWindowOfScreen (_1: *mut Screen) -> c_ulong, + pub fn XRotateBuffers (_2: *mut Display, _1: c_int) -> c_int, + pub fn XRotateWindowProperties (_5: *mut Display, _4: c_ulong, _3: *mut c_ulong, _2: c_int, _1: c_int) -> c_int, + pub fn XSaveContext (_4: *mut Display, _3: c_ulong, _2: c_int, _1: *const c_char) -> c_int, + pub fn XScreenCount (_1: *mut Display) -> c_int, + pub fn XScreenNumberOfScreen (_1: *mut Screen) -> c_int, + pub fn XScreenOfDisplay (_2: *mut Display, _1: c_int) -> *mut Screen, + pub fn XScreenResourceString (_1: *mut Screen) -> *mut c_char, + pub fn XSelectInput (_3: *mut Display, _2: c_ulong, _1: c_long) -> c_int, + pub fn XSendEvent (_5: *mut Display, _4: c_ulong, _3: c_int, _2: c_long, _1: *mut XEvent) -> c_int, + pub fn XServerVendor (_1: *mut Display) -> *mut c_char, + pub fn XSetAccessControl (_2: *mut Display, _1: c_int) -> c_int, + pub fn XSetAfterFunction (_2: *mut Display, _1: Option c_int>) -> Option c_int>, + pub fn XSetArcMode (_3: *mut Display, _2: GC, _1: c_int) -> c_int, + pub fn XSetAuthorization (_4: *mut c_char, _3: c_int, _2: *mut c_char, _1: c_int) -> (), + pub fn XSetBackground (_3: *mut Display, _2: GC, _1: c_ulong) -> c_int, + pub fn XSetClassHint (_3: *mut Display, _2: c_ulong, _1: *mut XClassHint) -> c_int, + pub fn XSetClipMask (_3: *mut Display, _2: GC, _1: c_ulong) -> c_int, + pub fn XSetClipOrigin (_4: *mut Display, _3: GC, _2: c_int, _1: c_int) -> c_int, + pub fn XSetClipRectangles (_7: *mut Display, _6: GC, _5: c_int, _4: c_int, _3: *mut XRectangle, _2: c_int, _1: c_int) -> c_int, + pub fn XSetCloseDownMode (_2: *mut Display, _1: c_int) -> c_int, + pub fn XSetCommand (_4: *mut Display, _3: c_ulong, _2: *mut *mut c_char, _1: c_int) -> c_int, + pub fn XSetDashes (_5: *mut Display, _4: GC, _3: c_int, _2: *const c_char, _1: c_int) -> c_int, + pub fn XSetErrorHandler (_1: Option c_int>) -> Option c_int>, + pub fn XSetFillRule (_3: *mut Display, _2: GC, _1: c_int) -> c_int, + pub fn XSetFillStyle (_3: *mut Display, _2: GC, _1: c_int) -> c_int, + pub fn XSetFont (_3: *mut Display, _2: GC, _1: c_ulong) -> c_int, + pub fn XSetFontPath (_3: *mut Display, _2: *mut *mut c_char, _1: c_int) -> c_int, + pub fn XSetForeground (_3: *mut Display, _2: GC, _1: c_ulong) -> c_int, + pub fn XSetFunction (_3: *mut Display, _2: GC, _1: c_int) -> c_int, + pub fn XSetGraphicsExposures (_3: *mut Display, _2: GC, _1: c_int) -> c_int, + pub fn XSetICFocus (_1: XIC) -> (), + pub fn XSetIconName (_3: *mut Display, _2: c_ulong, _1: *const c_char) -> c_int, + pub fn XSetIconSizes (_4: *mut Display, _3: c_ulong, _2: *mut XIconSize, _1: c_int) -> c_int, + pub fn XSetInputFocus (_4: *mut Display, _3: c_ulong, _2: c_int, _1: c_ulong) -> c_int, + pub fn XSetIOErrorHandler (_1: Option c_int>) -> Option c_int>, + pub fn XSetLineAttributes (_6: *mut Display, _5: GC, _4: c_uint, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XSetLocaleModifiers (_1: *const c_char) -> *mut c_char, + pub fn XSetModifierMapping (_2: *mut Display, _1: *mut XModifierKeymap) -> c_int, + pub fn XSetNormalHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> c_int, + pub fn XSetPlaneMask (_3: *mut Display, _2: GC, _1: c_ulong) -> c_int, + pub fn XSetPointerMapping (_3: *mut Display, _2: *const c_uchar, _1: c_int) -> c_int, + pub fn XSetRegion (_3: *mut Display, _2: GC, _1: Region) -> c_int, + pub fn XSetRGBColormaps (_5: *mut Display, _4: c_ulong, _3: *mut XStandardColormap, _2: c_int, _1: c_ulong) -> (), + pub fn XSetScreenSaver (_5: *mut Display, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> c_int, + pub fn XSetSelectionOwner (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XSetSizeHints (_4: *mut Display, _3: c_ulong, _2: *mut XSizeHints, _1: c_ulong) -> c_int, + pub fn XSetStandardColormap (_4: *mut Display, _3: c_ulong, _2: *mut XStandardColormap, _1: c_ulong) -> (), + pub fn XSetStandardProperties (_8: *mut Display, _7: c_ulong, _6: *const c_char, _5: *const c_char, _4: c_ulong, _3: *mut *mut c_char, _2: c_int, _1: *mut XSizeHints) -> c_int, + pub fn XSetState (_6: *mut Display, _5: GC, _4: c_ulong, _3: c_ulong, _2: c_int, _1: c_ulong) -> c_int, + pub fn XSetStipple (_3: *mut Display, _2: GC, _1: c_ulong) -> c_int, + pub fn XSetSubwindowMode (_3: *mut Display, _2: GC, _1: c_int) -> c_int, + pub fn XSetTextProperty (_4: *mut Display, _3: c_ulong, _2: *mut XTextProperty, _1: c_ulong) -> (), + pub fn XSetTile (_3: *mut Display, _2: GC, _1: c_ulong) -> c_int, + pub fn XSetTransientForHint (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XSetTSOrigin (_4: *mut Display, _3: GC, _2: c_int, _1: c_int) -> c_int, + pub fn XSetWindowBackground (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XSetWindowBackgroundPixmap (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XSetWindowBorder (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XSetWindowBorderPixmap (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XSetWindowBorderWidth (_3: *mut Display, _2: c_ulong, _1: c_uint) -> c_int, + pub fn XSetWindowColormap (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XSetWMClientMachine (_3: *mut Display, _2: c_ulong, _1: *mut XTextProperty) -> (), + pub fn XSetWMColormapWindows (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XSetWMHints (_3: *mut Display, _2: c_ulong, _1: *mut XWMHints) -> c_int, + pub fn XSetWMIconName (_3: *mut Display, _2: c_ulong, _1: *mut XTextProperty) -> (), + pub fn XSetWMName (_3: *mut Display, _2: c_ulong, _1: *mut XTextProperty) -> (), + pub fn XSetWMNormalHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> (), + pub fn XSetWMProperties (_9: *mut Display, _8: c_ulong, _7: *mut XTextProperty, _6: *mut XTextProperty, _5: *mut *mut c_char, _4: c_int, _3: *mut XSizeHints, _2: *mut XWMHints, _1: *mut XClassHint) -> (), + pub fn XSetWMProtocols (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XSetWMSizeHints (_4: *mut Display, _3: c_ulong, _2: *mut XSizeHints, _1: c_ulong) -> (), + pub fn XSetZoomHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> c_int, + pub fn XShrinkRegion (_3: Region, _2: c_int, _1: c_int) -> c_int, + pub fn XStoreBuffer (_4: *mut Display, _3: *const c_char, _2: c_int, _1: c_int) -> c_int, + pub fn XStoreBytes (_3: *mut Display, _2: *const c_char, _1: c_int) -> c_int, + pub fn XStoreColor (_3: *mut Display, _2: c_ulong, _1: *mut XColor) -> c_int, + pub fn XStoreColors (_4: *mut Display, _3: c_ulong, _2: *mut XColor, _1: c_int) -> c_int, + pub fn XStoreName (_3: *mut Display, _2: c_ulong, _1: *const c_char) -> c_int, + pub fn XStoreNamedColor (_5: *mut Display, _4: c_ulong, _3: *const c_char, _2: c_ulong, _1: c_int) -> c_int, + pub fn XStringListToTextProperty (_3: *mut *mut c_char, _2: c_int, _1: *mut XTextProperty) -> c_int, + pub fn XStringToKeysym (_1: *const c_char) -> c_ulong, + pub fn XSubImage (_5: *mut XImage, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> *mut XImage, + pub fn XSubtractRegion (_3: Region, _2: Region, _1: Region) -> c_int, + pub fn XSupportsLocale () -> c_int, + pub fn XSync (_2: *mut Display, _1: c_int) -> c_int, + pub fn XSynchronize (_2: *mut Display, _1: c_int) -> Option c_int>, + pub fn XTextExtents (_7: *mut XFontStruct, _6: *const c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut XCharStruct) -> c_int, + pub fn XTextExtents16 (_7: *mut XFontStruct, _6: *const XChar2b, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut XCharStruct) -> c_int, + pub fn XTextPropertyToStringList (_3: *mut XTextProperty, _2: *mut *mut *mut c_char, _1: *mut c_int) -> c_int, + pub fn XTextWidth (_3: *mut XFontStruct, _2: *const c_char, _1: c_int) -> c_int, + pub fn XTextWidth16 (_3: *mut XFontStruct, _2: *const XChar2b, _1: c_int) -> c_int, + pub fn XTranslateCoordinates (_8: *mut Display, _7: c_ulong, _6: c_ulong, _5: c_int, _4: c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_ulong) -> c_int, + pub fn XUndefineCursor (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XUngrabButton (_4: *mut Display, _3: c_uint, _2: c_uint, _1: c_ulong) -> c_int, + pub fn XUngrabKey (_4: *mut Display, _3: c_int, _2: c_uint, _1: c_ulong) -> c_int, + pub fn XUngrabKeyboard (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XUngrabPointer (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XUngrabServer (_1: *mut Display) -> c_int, + pub fn XUninstallColormap (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XUnionRectWithRegion (_3: *mut XRectangle, _2: Region, _1: Region) -> c_int, + pub fn XUnionRegion (_3: Region, _2: Region, _1: Region) -> c_int, + pub fn XUnloadFont (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XUnlockDisplay (_1: *mut Display) -> (), + pub fn XUnmapSubwindows (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XUnmapWindow (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XUnregisterIMInstantiateCallback (_6: *mut Display, _5: XrmDatabase, _4: *mut c_char, _3: *mut c_char, _2: Option, _1: *mut c_char) -> c_int, + pub fn XUnsetICFocus (_1: XIC) -> (), + pub fn Xutf8DrawImageString (_8: *mut Display, _7: c_ulong, _6: XFontSet, _5: GC, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> (), + pub fn Xutf8DrawString (_8: *mut Display, _7: c_ulong, _6: XFontSet, _5: GC, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> (), + pub fn Xutf8DrawText (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *mut XmbTextItem, _1: c_int) -> (), + pub fn Xutf8LookupString (_6: XIC, _5: *mut XKeyEvent, _4: *mut c_char, _3: c_int, _2: *mut c_ulong, _1: *mut c_int) -> c_int, + pub fn Xutf8ResetIC (_1: XIC) -> *mut c_char, + pub fn Xutf8SetWMProperties (_9: *mut Display, _8: c_ulong, _7: *const c_char, _6: *const c_char, _5: *mut *mut c_char, _4: c_int, _3: *mut XSizeHints, _2: *mut XWMHints, _1: *mut XClassHint) -> (), + pub fn Xutf8TextEscapement (_3: XFontSet, _2: *const c_char, _1: c_int) -> c_int, + pub fn Xutf8TextExtents (_5: XFontSet, _4: *const c_char, _3: c_int, _2: *mut XRectangle, _1: *mut XRectangle) -> c_int, + pub fn Xutf8TextListToTextProperty (_5: *mut Display, _4: *mut *mut c_char, _3: c_int, _2: XICCEncodingStyle, _1: *mut XTextProperty) -> c_int, + pub fn Xutf8TextPerCharExtents (_9: XFontSet, _8: *const c_char, _7: c_int, _6: *mut XRectangle, _5: *mut XRectangle, _4: c_int, _3: *mut c_int, _2: *mut XRectangle, _1: *mut XRectangle) -> c_int, + pub fn Xutf8TextPropertyToTextList (_4: *mut Display, _3: *const XTextProperty, _2: *mut *mut *mut c_char, _1: *mut c_int) -> c_int, + pub fn XVendorRelease (_1: *mut Display) -> c_int, + pub fn XVisualIDFromVisual (_1: *mut Visual) -> c_ulong, + pub fn XWarpPointer (_9: *mut Display, _8: c_ulong, _7: c_ulong, _6: c_int, _5: c_int, _4: c_uint, _3: c_uint, _2: c_int, _1: c_int) -> c_int, + pub fn XwcDrawImageString (_8: *mut Display, _7: c_ulong, _6: XFontSet, _5: GC, _4: c_int, _3: c_int, _2: *const wchar_t, _1: c_int) -> (), + pub fn XwcDrawString (_8: *mut Display, _7: c_ulong, _6: XFontSet, _5: GC, _4: c_int, _3: c_int, _2: *const wchar_t, _1: c_int) -> (), + pub fn XwcDrawText (_7: *mut Display, _6: c_ulong, _5: GC, _4: c_int, _3: c_int, _2: *mut XwcTextItem, _1: c_int) -> (), + pub fn XwcFreeStringList (_1: *mut *mut wchar_t) -> (), + pub fn XwcLookupString (_6: XIC, _5: *mut XKeyEvent, _4: *mut wchar_t, _3: c_int, _2: *mut c_ulong, _1: *mut c_int) -> c_int, + pub fn XwcResetIC (_1: XIC) -> *mut wchar_t, + pub fn XwcTextEscapement (_3: XFontSet, _2: *const wchar_t, _1: c_int) -> c_int, + pub fn XwcTextExtents (_5: XFontSet, _4: *const wchar_t, _3: c_int, _2: *mut XRectangle, _1: *mut XRectangle) -> c_int, + pub fn XwcTextListToTextProperty (_5: *mut Display, _4: *mut *mut wchar_t, _3: c_int, _2: XICCEncodingStyle, _1: *mut XTextProperty) -> c_int, + pub fn XwcTextPerCharExtents (_9: XFontSet, _8: *const wchar_t, _7: c_int, _6: *mut XRectangle, _5: *mut XRectangle, _4: c_int, _3: *mut c_int, _2: *mut XRectangle, _1: *mut XRectangle) -> c_int, + pub fn XwcTextPropertyToTextList (_4: *mut Display, _3: *const XTextProperty, _2: *mut *mut *mut wchar_t, _1: *mut c_int) -> c_int, + pub fn XWhitePixel (_2: *mut Display, _1: c_int) -> c_ulong, + pub fn XWhitePixelOfScreen (_1: *mut Screen) -> c_ulong, + pub fn XWidthMMOfScreen (_1: *mut Screen) -> c_int, + pub fn XWidthOfScreen (_1: *mut Screen) -> c_int, + pub fn XWindowEvent (_4: *mut Display, _3: c_ulong, _2: c_long, _1: *mut XEvent) -> c_int, + pub fn XWithdrawWindow (_3: *mut Display, _2: c_ulong, _1: c_int) -> c_int, + pub fn XWMGeometry (_11: *mut Display, _10: c_int, _9: *const c_char, _8: *const c_char, _7: c_uint, _6: *mut XSizeHints, _5: *mut c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XWriteBitmapFile (_7: *mut Display, _6: *const c_char, _5: c_ulong, _4: c_uint, _3: c_uint, _2: c_int, _1: c_int) -> c_int, + pub fn XXorRegion (_3: Region, _2: Region, _1: Region) -> c_int, +variadic: + pub fn XCreateIC (_1: XIM) -> XIC, + pub fn XCreateOC (_1: XOM) -> XFontSet, + pub fn XGetICValues (_1: XIC) -> *mut c_char, + pub fn XGetIMValues (_1: XIM) -> *mut c_char, + pub fn XGetOCValues (_1: XFontSet) -> *mut c_char, + pub fn XGetOMValues (_1: XOM) -> *mut c_char, + pub fn XSetICValues (_1: XIC) -> *mut c_char, + pub fn XSetIMValues (_1: XIM) -> *mut c_char, + pub fn XSetOCValues (_1: XFontSet) -> *mut c_char, + pub fn XSetOMValues (_1: XOM) -> *mut c_char, + pub fn XVaCreateNestedList (_1: c_int) -> *mut c_void, +globals: +} + + +// +// types +// + + +// common types +pub type Atom = XID; +pub type Bool = c_int; +pub type Colormap = XID; +pub type Cursor = XID; +pub type Drawable = XID; +pub type Font = XID; +pub type GContext = XID; +pub type KeyCode = c_uchar; +pub type KeySym = XID; +pub type Mask = c_ulong; +pub type Pixmap = XID; +pub type Status = Bool; +pub type Time = c_ulong; +pub type VisualID = XID; +pub type Window = XID; +pub type XID = c_ulong; +pub type XPointer = *mut c_char; + +// opaque structures +pub enum _XDisplay {} +pub enum xError {} +pub enum xEvent {} +pub enum _XGC {} +pub enum _XIC {} +pub enum _XIM {} +pub enum _XRegion {} +pub enum _XOC {} +pub enum _XOM {} +pub enum _XrmHashBucketRec {} + +// TODO structs +#[repr(C)] pub struct _XcmsCCC; +#[repr(C)] pub struct XcmsColor; +#[repr(C)] pub struct _XcmsColorSpace; +#[repr(C)] pub struct _XcmsFunctionSet; +#[repr(C)] pub struct _XkbAction; +#[repr(C)] pub struct _XkbBounds; +#[repr(C)] pub struct _XkbChanges; +#[repr(C)] pub struct _XkbClientMapRec; +#[repr(C)] pub struct _XkbColor; +#[repr(C)] pub struct _XkbComponentList; +#[repr(C)] pub struct _XkbComponentNames; +#[repr(C)] pub struct _XkbControls; +#[repr(C)] pub struct _XkbControlsChanges; +#[repr(C)] pub struct _XkbControlsNotify; +#[repr(C)] pub struct _XkbDeviceChanges; +#[repr(C)] pub struct _XkbDeviceInfo; +#[repr(C)] pub struct _XkbDeviceLedInfo; +#[repr(C)] pub struct _XkbDoodad; +#[repr(C)] pub struct _XkbExtensionDeviceNotify; +#[repr(C)] pub struct _XkbGeometry; +#[repr(C)] pub struct _XkbGeometrySizes; +#[repr(C)] pub struct _XkbIndicatorMapRec; +#[repr(C)] pub struct _XkbKey; +#[repr(C)] pub struct _XkbKeyType; +#[repr(C)] pub struct _XkbMapChanges; +#[repr(C)] pub struct _XkbMods; +#[repr(C)] pub struct _XkbNameChanges; +#[repr(C)] pub struct _XkbNamesNotify; +#[repr(C)] pub struct _XkbOutline; +#[repr(C)] pub struct _XkbOverlay; +#[repr(C)] pub struct _XkbOverlayKey; +#[repr(C)] pub struct _XkbOverlayRow; +#[repr(C)] pub struct _XkbProperty; +#[repr(C)] pub struct _XkbRow; +#[repr(C)] pub struct _XkbSection; +#[repr(C)] pub struct _XkbServerMapRec; +#[repr(C)] pub struct _XkbShape; +#[repr(C)] pub struct _XkbStateRec; +#[repr(C)] pub struct _XkbSymInterpretRec; + +// union placeholders +pub type XEDataObject = *mut c_void; + +// misc typedefs +pub type Display = _XDisplay; +pub type GC = *mut _XGC; +pub type Region = *mut _XRegion; +pub type XcmsCCC = *mut _XcmsCCC; +pub type XcmsColorSpace = _XcmsColorSpace; +pub type XcmsFunctionSet = _XcmsFunctionSet; +pub type XFontSet = *mut _XOC; +pub type XIC = *mut _XIC; +pub type XIM = *mut _XIM; +pub type XkbAction = _XkbAction; +pub type XkbBoundsPtr = *mut _XkbBounds; +pub type XkbChangesPtr = *mut _XkbChanges; +pub type XkbClientMapPtr = *mut _XkbClientMapRec; +pub type XkbColorPtr = *mut _XkbColor; +pub type XkbCompatMapPtr = *mut _XkbCompatMapRec; +pub type XkbComponentListPtr = *mut _XkbComponentList; +pub type XkbComponentNamesPtr = *mut _XkbComponentNames; +pub type XkbControlsChangesPtr = *mut _XkbControlsChanges; +pub type XkbControlsNotifyEvent = _XkbControlsNotify; +pub type XkbControlsPtr = *mut _XkbControls; +pub type XkbDescPtr = *mut _XkbDesc; +pub type XkbDeviceChangesPtr = *mut _XkbDeviceChanges; +pub type XkbDeviceInfoPtr = *mut _XkbDeviceInfo; +pub type XkbDeviceLedInfoPtr = *mut _XkbDeviceLedInfo; +pub type XkbDoodadPtr = *mut _XkbDoodad; +pub type XkbExtensionDeviceNotifyEvent = _XkbExtensionDeviceNotify; +pub type XkbGeometryPtr = *mut _XkbGeometry; +pub type XkbGeometrySizesPtr = *mut _XkbGeometrySizes; +pub type XkbIndicatorMapPtr = *mut _XkbIndicatorMapRec; +pub type XkbIndicatorMapRec = _XkbIndicatorMapRec; +pub type XkbIndicatorPtr = *mut _XkbIndicatorRec; +pub type XkbKeyTypePtr = *mut _XkbKeyType; +pub type XkbMapChangesPtr = *mut _XkbMapChanges; +pub type XkbMapNotifyEvent = _XkbMapNotifyEvent; +pub type XkbModsPtr = *mut _XkbMods; +pub type XkbModsRec = _XkbMods; +pub type XkbNameChangesPtr = *mut _XkbNameChanges; +pub type XkbNamesNotifyEvent = _XkbNamesNotify; +pub type XkbNamesPtr = *mut _XkbNamesRec; +pub type XkbKeyAliasPtr = *mut _XkbKeyAliasRec; +pub type XkbKeyNamePtr = *mut _XkbKeyNameRec; +pub type XkbKeyPtr = *mut _XkbKey; +pub type XkbOutlinePtr = *mut _XkbOutline; +pub type XkbOverlayKeyPtr = *mut _XkbOverlayKey; +pub type XkbOverlayPtr = *mut _XkbOverlay; +pub type XkbOverlayRowPtr = *mut _XkbOverlayRow; +pub type XkbPropertyPtr = *mut _XkbProperty; +pub type XkbRowPtr = *mut _XkbRow; +pub type XkbSectionPtr = *mut _XkbSection; +pub type XkbServerMapPtr = *mut _XkbServerMapRec; +pub type XkbShapePtr = *mut _XkbShape; +pub type XkbStatePtr = *mut _XkbStateRec; +pub type XkbSymInterpretPtr = *mut _XkbSymInterpretRec; +pub type XOM = *mut _XOM; +pub type XrmDatabase = *mut _XrmHashBucketRec; +pub type XrmOptionDescList = *mut XrmOptionDescRec; + +// function pointers +pub type XConnectionWatchProc = Option; + +// C enums +pub type XICCEncodingStyle = c_int; +pub type XOrientation = c_int; +pub type XrmBinding = c_int; +pub type XrmOptionKind = c_int; + +#[allow(dead_code)] +#[cfg(test)] +#[repr(C)] +enum TestEnum { + Variant1, + Variant2, +} + +#[test] +fn enum_size_test () { + assert!(::std::mem::size_of::() == ::std::mem::size_of::()); +} + + +// +// event structures +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XEvent { + pub pad: [c_long; 24], +} + +impl XEvent { + pub fn get_type (&self) -> c_int { + unsafe { + *(self as *const XEvent as *const c_int) + } + } +} + +macro_rules! event_conversions_and_tests { + { $($ty:ty,)* } => { + #[test] + fn xevent_size_test () { + use std::mem::size_of; + let xevent_size = size_of::(); + $(assert!(xevent_size >= size_of::<$ty>());)* + } + + $( + impl AsMut<$ty> for XEvent { + fn as_mut (&mut self) -> &mut $ty { + unsafe { mem::transmute(self) } + } + } + + impl AsRef<$ty> for XEvent { + fn as_ref (&self) -> &$ty { + unsafe { mem::transmute(self) } + } + } + + impl From<$ty> for XEvent { + fn from (other: $ty) -> XEvent { + unsafe { transmute_union(&other) } + } + } + + impl<'a> From<&'a $ty> for XEvent { + fn from (other: &'a $ty) -> XEvent { + unsafe { transmute_union(other) } + } + } + + impl From for $ty { + fn from (xevent: XEvent) -> $ty { + unsafe { transmute_union(&xevent) } + } + } + + impl<'a> From<&'a XEvent> for $ty { + fn from (xevent: &'a XEvent) -> $ty { + unsafe { transmute_union(xevent) } + } + } + )* + }; +} + +event_conversions_and_tests! { + XAnyEvent, + XButtonEvent, + XCirculateEvent, + XCirculateRequestEvent, + XClientMessageEvent, + XColormapEvent, + XConfigureEvent, + XConfigureRequestEvent, + XCreateWindowEvent, + XCrossingEvent, + XDestroyWindowEvent, + XErrorEvent, + XExposeEvent, + XFocusChangeEvent, + XGenericEventCookie, + XGraphicsExposeEvent, + XGravityEvent, + XKeyEvent, + XKeymapEvent, + XMapEvent, + XMappingEvent, + XMapRequestEvent, + XMotionEvent, + XNoExposeEvent, + XPropertyEvent, + XReparentEvent, + XResizeRequestEvent, + XSelectionClearEvent, + XSelectionEvent, + XSelectionRequestEvent, + XUnmapEvent, + XVisibilityEvent, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XAnyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XButtonEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub root: Window, + pub subwindow: Window, + pub time: Time, + pub x: c_int, + pub y: c_int, + pub x_root: c_int, + pub y_root: c_int, + pub state: c_uint, + pub button: c_uint, + pub same_screen: Bool, +} +pub type XButtonPressedEvent = XButtonEvent; +pub type XButtonReleasedEvent = XButtonEvent; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XCirculateEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub window: Window, + pub place: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XCirculateRequestEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub parent: Window, + pub window: Window, + pub place: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XClientMessageEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub message_type: Atom, + pub format: c_int, + pub data: ClientMessageData, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XColormapEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub colormap: Colormap, + pub new: Bool, + pub state: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XConfigureEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub window: Window, + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub border_width: c_int, + pub above: Window, + pub override_redirect: Bool, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XConfigureRequestEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub parent: Window, + pub window: Window, + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub border_width: c_int, + pub above: Window, + pub detail: c_int, + pub value_mask: c_ulong, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XCreateWindowEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub parent: Window, + pub window: Window, + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub border_width: c_int, + pub override_redirect: Bool, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XCrossingEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub root: Window, + pub subwindow: Window, + pub time: Time, + pub x: c_int, + pub y: c_int, + pub x_root: c_int, + pub y_root: c_int, + pub mode: c_int, + pub detail: c_int, + pub same_screen: Bool, + pub focus: Bool, + pub state: c_uint, +} +pub type XEnterWindowEvent = XCrossingEvent; +pub type XLeaveWindowEvent = XCrossingEvent; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XDestroyWindowEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub window: Window, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XErrorEvent { + pub type_: c_int, + pub display: *mut Display, + pub resourceid: XID, + pub serial: c_ulong, + pub error_code: c_uchar, + pub request_code: c_uchar, + pub minor_code: c_uchar, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XExposeEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub count: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XFocusChangeEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub mode: c_int, + pub detail: c_int, +} +pub type XFocusInEvent = XFocusChangeEvent; +pub type XFocusOutEvent = XFocusChangeEvent; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XGraphicsExposeEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub drawable: Drawable, + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub count: c_int, + pub major_code: c_int, + pub minor_code: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XGravityEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub window: Window, + pub x: c_int, + pub y: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XKeyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub root: Window, + pub subwindow: Window, + pub time: Time, + pub x: c_int, + pub y: c_int, + pub x_root: c_int, + pub y_root: c_int, + pub state: c_uint, + pub keycode: c_uint, + pub same_screen: Bool, +} +pub type XKeyPressedEvent = XKeyEvent; +pub type XKeyReleasedEvent = XKeyEvent; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XKeymapEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub key_vector: [c_char; 32], +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XMapEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub window: Window, + pub override_redirect: Bool, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XMappingEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub request: c_int, + pub first_keycode: c_int, + pub count: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XMapRequestEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub parent: Window, + pub window: Window, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XMotionEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub root: Window, + pub subwindow: Window, + pub time: Time, + pub x: c_int, + pub y: c_int, + pub x_root: c_int, + pub y_root: c_int, + pub state: c_uint, + pub is_hint: c_char, + pub same_screen: Bool, +} +pub type XPointerMovedEvent = XMotionEvent; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XNoExposeEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub drawable: Drawable, + pub major_code: c_int, + pub minor_code: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XPropertyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub atom: Atom, + pub time: Time, + pub state: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XReparentEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub window: Window, + pub parent: Window, + pub x: c_int, + pub y: c_int, + pub override_redirect: Bool, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XResizeRequestEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub width: c_int, + pub height: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XSelectionClearEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub selection: Atom, + pub time: Time, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XSelectionEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub requestor: Window, + pub selection: Atom, + pub target: Atom, + pub property: Atom, + pub time: Time, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XSelectionRequestEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub owner: Window, + pub requestor: Window, + pub selection: Atom, + pub target: Atom, + pub property: Atom, + pub time: Time, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XUnmapEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub event: Window, + pub window: Window, + pub from_configure: Bool, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XVisibilityEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub state: c_int, +} + + +// +// Xkb structs +// + + +#[repr(C)] +pub struct _XkbCompatMapRec { + pub sym_interpret: XkbSymInterpretPtr, + pub groups: [XkbModsRec; XkbNumKbdGroups], + pub num_si: c_ushort, + pub size_si: c_ushort, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbDesc { + pub dpy: *mut Display, + pub flags: c_ushort, + pub device_spec: c_ushort, + pub min_key_code: KeyCode, + pub max_key_code: KeyCode, + pub ctrls: XkbControlsPtr, + pub server: XkbServerMapPtr, + pub map: XkbClientMapPtr, + pub indicators: XkbIndicatorPtr, + pub names: XkbNamesPtr, + pub compat: XkbCompatMapPtr, + pub geom: XkbGeometryPtr, +} + +#[repr(C)] +pub struct _XkbIndicatorRec { + pub phys_indicators: c_ulong, + pub maps: [XkbIndicatorMapRec; XkbNumIndicators], +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbKeyAliasRec { + pub real: [c_char; XkbKeyNameLength], + pub alias: [c_char; XkbKeyNameLength], +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbKeyNameRec { + pub name: [c_char; XkbKeyNameLength], +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbNamesRec { + pub keycodes: Atom, + pub geometry: Atom, + pub symbols: Atom, + pub types: Atom, + pub compat: Atom, + pub vmods: [Atom; XkbNumVirtualMods], + pub indicators: [Atom; XkbNumIndicators], + pub groups: [Atom; XkbNumKbdGroups], + pub keys: XkbKeyNamePtr, + pub key_aliases: XkbKeyAliasPtr, + pub radio_groups: *mut Atom, + pub phys_symbols: Atom, + pub num_keys: c_uchar, + pub num_key_aliases: c_uchar, + pub num_rg: c_ushort, +} + + +// +// Xkb event structs +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbAnyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_uint, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbNewKeyboardNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub old_device: c_int, + pub min_key_code: c_int, + pub max_key_code: c_int, + pub old_min_key_code: c_int, + pub old_max_key_code: c_int, + pub changed: c_uint, + pub req_major: c_char, + pub req_minor: c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbMapNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub changed: c_uint, + pub flags: c_uint, + pub first_type: c_int, + pub num_types: c_int, + pub min_key_code: KeyCode, + pub max_key_code: KeyCode, + pub first_key_sym: KeyCode, + pub first_key_act: KeyCode, + pub first_key_bahavior: KeyCode, + pub first_key_explicit: KeyCode, + pub first_modmap_key: KeyCode, + pub first_vmodmap_key: KeyCode, + pub num_key_syms: c_int, + pub num_key_acts: c_int, + pub num_key_behaviors: c_int, + pub num_key_explicit: c_int, + pub num_modmap_keys: c_int, + pub num_vmodmap_keys: c_int, + pub vmods: c_uint, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbStateNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub changed: c_uint, + pub group: c_int, + pub base_group: c_int, + pub latched_group: c_int, + pub locked_group: c_int, + pub mods: c_uint, + pub base_mods: c_uint, + pub latched_mods: c_uint, + pub locked_mods: c_uint, + pub compat_state: c_int, + pub grab_mods: c_uchar, + pub compat_grab_mods: c_uchar, + pub lookup_mods: c_uchar, + pub compat_lookup_mods: c_uchar, + pub ptr_buttons: c_int, + pub keycode: KeyCode, + pub event_type: c_char, + pub req_major: c_char, + pub req_minor: c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbControlsNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub changed_ctrls: c_uint, + pub enabled_ctrls: c_uint, + pub enabled_ctrl_changes: c_uint, + pub num_groups: c_int, + pub keycode: KeyCode, + pub event_type: c_char, + pub req_major: c_char, + pub req_minor: c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbIndicatorNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub changed: c_uint, + pub state: c_uint, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbNamesNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub changed: c_uint, + pub first_type: c_int, + pub num_types: c_int, + pub first_lvl: c_int, + pub num_lvls: c_int, + pub num_aliases: c_int, + pub num_radio_groups: c_int, + pub changed_vmods: c_uint, + pub changed_groups: c_uint, + pub changed_indicators: c_uint, + pub first_key: c_int, + pub num_keys: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbCompatMapNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub changed_groups: c_uint, + pub first_si: c_int, + pub num_si: c_int, + pub num_total_si: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbBellNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub percent: c_int, + pub pitch: c_int, + pub duration: c_int, + pub bell_class: c_int, + pub bell_id: c_int, + pub name: Atom, + pub window: Window, + pub event_only: Bool, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbActionMessageEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub keycode: KeyCode, + pub press: Bool, + pub key_event_follows: Bool, + pub group: c_int, + pub mods: c_uint, + pub message: [c_char; XkbActionMessageLength + 1], +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbAccessXNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub detail: c_int, + pub keycode: c_int, + pub sk_delay: c_int, + pub debounce_delay: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XkbExtensionDeviceNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub time: Time, + pub xkb_type: c_int, + pub device: c_int, + pub reason: c_uint, + pub supported: c_uint, + pub unsupported: c_uint, + pub first_btn: c_int, + pub num_btns: c_int, + pub leds_defined: c_uint, + pub led_state: c_uint, + pub led_class: c_int, + pub led_id: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XkbEvent { + _pad: [c_long; 24], +} + +macro_rules! test_xkb_event_size { + { $($ty:ty,)* } => { $( + assert!(::std::mem::size_of::() >= ::std::mem::size_of::<$ty>()); + )* }; +} + +#[test] +fn xkb_event_size_test () { + test_xkb_event_size! { + XkbAnyEvent, + XkbNewKeyboardNotifyEvent, + XkbMapNotifyEvent, + XkbStateNotifyEvent, + XkbControlsNotifyEvent, + XkbIndicatorNotifyEvent, + XkbNamesNotifyEvent, + XkbCompatMapNotifyEvent, + XkbBellNotifyEvent, + XkbActionMessageEvent, + XkbAccessXNotifyEvent, + XkbExtensionDeviceNotifyEvent, + } +} + +pub enum XkbKbdDpyStateRec {} +pub type XkbKbdDpyStatePtr = *mut XkbKbdDpyStateRec; + + +// +// other structures +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct Depth { + pub depth: c_int, + pub nvisuals: c_int, + pub visuals: *mut Visual, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct Screen { + pub ext_data: *mut XExtData, + pub display: *mut Display, + pub root: Window, + pub width: c_int, + pub height: c_int, + pub mwidth: c_int, + pub mheight: c_int, + pub ndepths: c_int, + pub depths: *mut Depth, + pub root_depth: c_int, + pub root_visual: *mut Visual, + pub default_gc: GC, + pub cmap: Colormap, + pub white_pixel: c_ulong, + pub black_pixel: c_ulong, + pub max_maps: c_int, + pub min_maps: c_int, + pub backing_store: c_int, + pub save_unders: Bool, + pub root_input_mask: c_long, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct ScreenFormat { + pub ext_data: *mut XExtData, + pub depth: c_int, + pub bits_per_pixel: c_int, + pub scanline_pad: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct Visual { + pub ext_data: *mut XExtData, + pub visualid: VisualID, + pub class: c_int, + pub red_mask: c_ulong, + pub green_mask: c_ulong, + pub blue_mask: c_ulong, + pub bits_per_rgb: c_int, + pub map_entries: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XArc { + pub x: c_short, + pub y: c_short, + pub width: c_ushort, + pub height: c_ushort, + pub angle1: c_short, + pub angle2: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XChar2b { + pub byte1: c_uchar, + pub byte2: c_uchar, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XCharStruct { + pub lbearing: c_short, + pub rbearing: c_short, + pub width: c_short, + pub ascent: c_short, + pub descent: c_short, + pub attributes: c_ushort, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XClassHint { + pub res_name: *mut c_char, + pub res_class: *mut c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XColor { + pub pixel: c_ulong, + pub red: c_ushort, + pub green: c_ushort, + pub blue: c_ushort, + pub flags: c_char, + pub pad: c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XComposeStatus { + pub compose_ptr: XPointer, + pub chars_matched: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XExtCodes { + pub extension: c_int, + pub major_opcode: c_int, + pub first_event: c_int, + pub first_error: c_int, +} + +#[repr(C)] +pub struct XExtData { + pub number: c_int, + pub next: *mut XExtData, + pub free_private: Option c_int>, + pub private_data: XPointer, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XFontProp { + pub name: Atom, + pub card32: c_ulong, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XFontSetExtents { + pub max_ink_extent: XRectangle, + pub max_logical_extent: XRectangle, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XFontStruct { + pub ext_data: *mut XExtData, + pub fid: Font, + pub direction: c_uint, + pub min_char_or_byte2: c_uint, + pub max_char_or_byte2: c_uint, + pub min_byte1: c_uint, + pub max_byte1: c_uint, + pub all_chars_exist: Bool, + pub default_char: c_uint, + pub n_properties: c_int, + pub properties: *mut XFontProp, + pub min_bounds: XCharStruct, + pub max_bounds: XCharStruct, + pub per_char: *mut XCharStruct, + pub ascent: c_int, + pub descent: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XGCValues { + pub function: c_int, + pub plane_mask: c_ulong, + pub foreground: c_ulong, + pub background: c_ulong, + pub line_width: c_int, + pub line_style: c_int, + pub cap_style: c_int, + pub join_style: c_int, + pub fill_style: c_int, + pub fill_rule: c_int, + pub arc_mode: c_int, + pub tile: Pixmap, + pub stipple: Pixmap, + pub ts_x_origin: c_int, + pub ts_y_origin: c_int, + pub font: Font, + pub subwindow_mode: c_int, + pub graphics_exposures: Bool, + pub clip_x_origin: c_int, + pub clip_y_origin: c_int, + pub clip_mask: Pixmap, + pub dash_offset: c_int, + pub dashes: c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XGenericEventCookie { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub extension: c_int, + pub evtype: c_int, + pub cookie: c_uint, + pub data: *mut c_void, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XHostAddress { + pub family: c_int, + pub length: c_int, + pub address: *mut c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XIconSize { + pub min_width: c_int, + pub min_height: c_int, + pub max_width: c_int, + pub max_height: c_int, + pub width_inc: c_int, + pub height_inc: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XImage { + pub width: c_int, + pub height: c_int, + pub xoffset: c_int, + pub format: c_int, + pub data: *mut c_char, + pub byte_order: c_int, + pub bitmap_unit: c_int, + pub bitmap_bit_order: c_int, + pub bitmap_pad: c_int, + pub depth: c_int, + pub bytes_per_line: c_int, + pub bits_per_pixel: c_int, + pub red_mask: c_ulong, + pub green_mask: c_ulong, + pub blue_mask: c_ulong, + pub obdata: XPointer, + pub funcs: ImageFns, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XKeyboardControl { + pub key_click_percent: c_int, + pub bell_percent: c_int, + pub bell_pitch: c_int, + pub bell_duration: c_int, + pub led: c_int, + pub led_mode: c_int, + pub key: c_int, + pub auto_repeat_mode: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XKeyboardState { + pub key_click_percent: c_int, + pub bell_percent: c_int, + pub bell_pitch: c_uint, + pub bell_duration: c_uint, + pub led_mask: c_ulong, + pub global_auto_repeat: c_int, + pub auto_repeats: [c_char; 32], +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XmbTextItem { + pub chars: *mut c_char, + pub nchars: c_int, + pub delta: c_int, + pub font_set: XFontSet, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XModifierKeymap { + pub max_keypermod: c_int, + pub modifiermap: *mut KeyCode, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XOMCharSetList { + pub charset_count: c_int, + pub charset_list: *mut *mut c_char, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XPixmapFormatValues { + pub depth: c_int, + pub bits_per_pixel: c_int, + pub scanline_pad: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XPoint { + pub x: c_short, + pub y: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRectangle { + pub x: c_short, + pub y: c_short, + pub width: c_ushort, + pub height: c_ushort, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XrmOptionDescRec { + pub option: *mut c_char, + pub specifier: *mut c_char, + pub argKind: XrmOptionKind, + pub value: XPointer, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XrmValue { + pub size: c_uint, + pub addr: XPointer, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XSegment { + pub x1: c_short, + pub y1: c_short, + pub x2: c_short, + pub y2: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XSetWindowAttributes { + pub background_pixmap: Pixmap, + pub background_pixel: c_ulong, + pub border_pixmap: Pixmap, + pub border_pixel: c_ulong, + pub bit_gravity: c_int, + pub win_gravity: c_int, + pub backing_store: c_int, + pub backing_planes: c_ulong, + pub backing_pixel: c_ulong, + pub save_under: Bool, + pub event_mask: c_long, + pub do_not_propagate_mask: c_long, + pub override_redirect: Bool, + pub colormap: Colormap, + pub cursor: Cursor, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XSizeHints { + pub flags: c_long, + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub min_width: c_int, + pub min_height: c_int, + pub max_width: c_int, + pub max_height: c_int, + pub width_inc: c_int, + pub height_inc: c_int, + pub min_aspect: AspectRatio, + pub max_aspect: AspectRatio, + pub base_width: c_int, + pub base_height: c_int, + pub win_gravity: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XStandardColormap { + pub colormap: Colormap, + pub red_max: c_ulong, + pub red_mult: c_ulong, + pub green_max: c_ulong, + pub green_mult: c_ulong, + pub blue_max: c_ulong, + pub blue_mult: c_ulong, + pub base_pixel: c_ulong, + pub visualid: VisualID, + pub killid: XID, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XTextItem { + pub chars: *mut c_char, + pub nchars: c_int, + pub delta: c_int, + pub font: Font, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XTextItem16 { + pub chars: *mut XChar2b, + pub nchars: c_int, + pub delta: c_int, + pub font: Font, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XTextProperty { + pub value: *mut c_uchar, + pub encoding: Atom, + pub format: c_int, + pub nitems: c_ulong, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XTimeCoord { + pub time: Time, + pub x: c_short, + pub y: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XVisualInfo { + pub visual: *mut Visual, + pub visualid: VisualID, + pub screen: c_int, + pub depth: c_int, + pub class: c_int, + pub red_mask: c_ulong, + pub green_mask: c_ulong, + pub blue_mask: c_ulong, + pub colormap_size: c_int, + pub bits_per_rgb: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XwcTextItem { + pub chars: *mut wchar_t, + pub nchars: c_int, + pub delta: c_int, + pub font_set: XFontSet, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XWindowAttributes { + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub border_width: c_int, + pub depth: c_int, + pub visual: *mut Visual, + pub root: Window, + pub class: c_int, + pub bit_gravity: c_int, + pub win_gravity: c_int, + pub backing_store: c_int, + pub backing_planes: c_ulong, + pub backing_pixel: c_ulong, + pub save_under: Bool, + pub colormap: Colormap, + pub map_installed: Bool, + pub map_state: c_int, + pub all_event_masks: c_long, + pub your_event_mask: c_long, + pub do_not_propagate_mask: c_long, + pub override_redirect: Bool, + pub screen: *mut Screen, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XWindowChanges { + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub border_width: c_int, + pub sibling: Window, + pub stack_mode: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XWMHints { + pub flags: c_long, + pub input: Bool, + pub initial_state: c_int, + pub icon_pixmap: Pixmap, + pub icon_window: Window, + pub icon_x: c_int, + pub icon_y: c_int, + pub icon_mask: Pixmap, + pub window_group: XID, +} + + +// +// anonymous structures +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct AspectRatio { + pub x: c_int, + pub y: c_int, +} + +#[derive(Clone, Copy, Default, PartialEq)] +#[repr(C)] +pub struct ClientMessageData { + longs: [c_long; 5], +} + +impl ClientMessageData { + pub fn as_bytes (&self) -> &[c_char] { + self.as_ref() + } + + pub fn as_bytes_mut (&mut self) -> &mut [c_char] { + self.as_mut() + } + + pub fn as_longs (&self) -> &[c_long] { + self.as_ref() + } + + pub fn as_longs_mut (&mut self) -> &mut [c_long] { + self.as_mut() + } + + pub fn as_shorts (&self) -> &[c_short] { + self.as_ref() + } + + pub fn as_shorts_mut (&mut self) -> &mut [c_short] { + self.as_mut() + } + + pub fn get_byte (&self, index: usize) -> c_char { + self.as_bytes()[index] + } + + pub fn get_long (&self, index: usize) -> c_long { + self.longs[index] + } + + pub fn get_short (&self, index: usize) -> c_short { + self.as_shorts()[index] + } + + pub fn new() -> ClientMessageData { + ClientMessageData { longs: [0; 5] } + } + + pub fn set_byte (&mut self, index: usize, value: c_char) { + self.as_bytes_mut()[index] = value; + } + + pub fn set_long (&mut self, index: usize, value: c_long) { + self.longs[index] = value; + } + + pub fn set_short (&mut self, index: usize, value: c_short) { + self.as_shorts_mut()[index] = value; + } +} + +macro_rules! client_message_data_conversions { + { $($ty:ty[$n:expr],)* } => { + $( + impl AsMut<[$ty]> for ClientMessageData { + fn as_mut (&mut self) -> &mut [$ty] { + unsafe { slice::from_raw_parts_mut(self.longs.as_mut_ptr() as *mut $ty, $n) } + } + } + + impl AsRef<[$ty]> for ClientMessageData { + fn as_ref (&self) -> &[$ty] { + unsafe { slice::from_raw_parts(self.longs.as_ptr() as *mut $ty, $n) } + } + } + + impl From<[$ty; $n]> for ClientMessageData { + fn from (array: [$ty; $n]) -> ClientMessageData { + unsafe { transmute_union(&array) } + } + } + )* + }; +} + +client_message_data_conversions! { + c_schar[20], + c_uchar[20], + c_short[10], + c_ushort[10], + c_long[5], + c_ulong[5], +} + +#[test] +fn client_message_size_test () { + assert!(::std::mem::size_of::() >= ::std::mem::size_of::<[c_char; 20]>()); + assert!(::std::mem::size_of::() >= ::std::mem::size_of::<[c_short; 10]>()); +} + +#[derive(Copy)] +#[repr(C)] +pub struct ImageFns { + pub create_image: Option *mut XImage>, + pub destroy_image: Option c_int>, + pub get_pixel: Option c_ulong>, + pub put_pixel: Option c_int>, + pub sub_image: Option *mut XImage>, + pub add_pixel: Option c_int>, +} + +impl Clone for ImageFns { + fn clone (&self) -> ImageFns { + *self + } +} + +impl PartialEq for ImageFns { + fn eq (&self, rhs: &ImageFns) -> bool { + unsafe { mem_eq(self, rhs) } + } +} + + +// +// constants +// + + +// allocate colormap +pub const AllocNone: c_int = 0; +pub const AllocAll: c_int = 1; + +// array sizes +pub const XkbKeyNameLength: usize = 4; +pub const XkbNumIndicators: usize = 32; +pub const XkbNumKbdGroups: usize = 4; +pub const XkbNumVirtualMods: usize = 16; + +// atoms +pub const XA_PRIMARY: Atom = 1; +pub const XA_SECONDARY: Atom = 2; +pub const XA_ARC: Atom = 3; +pub const XA_ATOM: Atom = 4; +pub const XA_BITMAP: Atom = 5; +pub const XA_CARDINAL: Atom = 6; +pub const XA_COLORMAP: Atom = 7; +pub const XA_CURSOR: Atom = 8; +pub const XA_CUT_BUFFER0: Atom = 9; +pub const XA_CUT_BUFFER1: Atom = 10; +pub const XA_CUT_BUFFER2: Atom = 11; +pub const XA_CUT_BUFFER3: Atom = 12; +pub const XA_CUT_BUFFER4: Atom = 13; +pub const XA_CUT_BUFFER5: Atom = 14; +pub const XA_CUT_BUFFER6: Atom = 15; +pub const XA_CUT_BUFFER7: Atom = 16; +pub const XA_DRAWABLE: Atom = 17; +pub const XA_FONT: Atom = 18; +pub const XA_INTEGER: Atom = 19; +pub const XA_PIXMAP: Atom = 20; +pub const XA_POINT: Atom = 21; +pub const XA_RECTANGLE: Atom = 22; +pub const XA_RESOURCE_MANAGER: Atom = 23; +pub const XA_RGB_COLOR_MAP: Atom = 24; +pub const XA_RGB_BEST_MAP: Atom = 25; +pub const XA_RGB_BLUE_MAP: Atom = 26; +pub const XA_RGB_DEFAULT_MAP: Atom = 27; +pub const XA_RGB_GRAY_MAP: Atom = 28; +pub const XA_RGB_GREEN_MAP: Atom = 29; +pub const XA_RGB_RED_MAP: Atom = 30; +pub const XA_STRING: Atom = 31; +pub const XA_VISUALID: Atom = 32; +pub const XA_WINDOW: Atom = 33; +pub const XA_WM_COMMAND: Atom = 34; +pub const XA_WM_HINTS: Atom = 35; +pub const XA_WM_CLIENT_MACHINE: Atom = 36; +pub const XA_WM_ICON_NAME: Atom = 37; +pub const XA_WM_ICON_SIZE: Atom = 38; +pub const XA_WM_NAME: Atom = 39; +pub const XA_WM_NORMAL_HINTS: Atom = 40; +pub const XA_WM_SIZE_HINTS: Atom = 41; +pub const XA_WM_ZOOM_HINTS: Atom = 42; +pub const XA_MIN_SPACE: Atom = 43; +pub const XA_NORM_SPACE: Atom = 44; +pub const XA_MAX_SPACE: Atom = 45; +pub const XA_END_SPACE: Atom = 46; +pub const XA_SUPERSCRIPT_X: Atom = 47; +pub const XA_SUPERSCRIPT_Y: Atom = 48; +pub const XA_SUBSCRIPT_X: Atom = 49; +pub const XA_SUBSCRIPT_Y: Atom = 50; +pub const XA_UNDERLINE_POSITION: Atom = 51; +pub const XA_UNDERLINE_THICKNESS: Atom = 52; +pub const XA_STRIKEOUT_ASCENT: Atom = 53; +pub const XA_STRIKEOUT_DESCENT: Atom = 54; +pub const XA_ITALIC_ANGLE: Atom = 55; +pub const XA_X_HEIGHT: Atom = 56; +pub const XA_QUAD_WIDTH: Atom = 57; +pub const XA_WEIGHT: Atom = 58; +pub const XA_POINT_SIZE: Atom = 59; +pub const XA_RESOLUTION: Atom = 60; +pub const XA_COPYRIGHT: Atom = 61; +pub const XA_NOTICE: Atom = 62; +pub const XA_FONT_NAME: Atom = 63; +pub const XA_FAMILY_NAME: Atom = 64; +pub const XA_FULL_NAME: Atom = 65; +pub const XA_CAP_HEIGHT: Atom = 66; +pub const XA_WM_CLASS: Atom = 67; +pub const XA_WM_TRANSIENT_FOR: Atom = 68; + +// boolean values +pub const False: Bool = 0; +pub const True: Bool = 1; + +// clip rect ordering +pub const Unsorted: c_int = 0; +pub const YSorted: c_int = 1; +pub const YXSorted: c_int = 2; +pub const YXBanded: c_int = 3; + +// color component mask +pub const DoRed: c_char = 1; +pub const DoGreen: c_char = 2; +pub const DoBlue: c_char = 4; + +// error codes +pub const Success: c_uchar = 0; +pub const BadRequest: c_uchar = 1; +pub const BadValue: c_uchar = 2; +pub const BadWindow: c_uchar = 3; +pub const BadPixmap: c_uchar = 4; +pub const BadAtom: c_uchar = 5; +pub const BadCursor: c_uchar = 6; +pub const BadFont: c_uchar = 7; +pub const BadMatch: c_uchar = 8; +pub const BadDrawable: c_uchar = 9; +pub const BadAccess: c_uchar = 10; +pub const BadAlloc: c_uchar = 11; +pub const BadColor: c_uchar = 12; +pub const BadGC: c_uchar = 13; +pub const BadIDChoice: c_uchar = 14; +pub const BadName: c_uchar = 15; +pub const BadLength: c_uchar = 16; +pub const BadImplementation: c_uchar = 17; +pub const FirstExtensionError: c_uchar = 128; +pub const LastExtensionError: c_uchar = 255; + +// event kinds +pub const KeyPress: c_int = 2; +pub const KeyRelease: c_int = 3; +pub const ButtonPress: c_int = 4; +pub const ButtonRelease: c_int = 5; +pub const MotionNotify: c_int = 6; +pub const EnterNotify: c_int = 7; +pub const LeaveNotify: c_int = 8; +pub const FocusIn: c_int = 9; +pub const FocusOut: c_int = 10; +pub const KeymapNotify: c_int = 11; +pub const Expose: c_int = 12; +pub const GraphicsExpose: c_int = 13; +pub const NoExpose: c_int = 14; +pub const VisibilityNotify: c_int = 15; +pub const CreateNotify: c_int = 16; +pub const DestroyNotify: c_int = 17; +pub const UnmapNotify: c_int = 18; +pub const MapNotify: c_int = 19; +pub const MapRequest: c_int = 20; +pub const ReparentNotify: c_int = 21; +pub const ConfigureNotify: c_int = 22; +pub const ConfigureRequest: c_int = 23; +pub const GravityNotify: c_int = 24; +pub const ResizeRequest: c_int = 25; +pub const CirculateNotify: c_int = 26; +pub const CirculateRequest: c_int = 27; +pub const PropertyNotify: c_int = 28; +pub const SelectionClear: c_int = 29; +pub const SelectionRequest: c_int = 30; +pub const SelectionNotify: c_int = 31; +pub const ColormapNotify: c_int = 32; +pub const ClientMessage: c_int = 33; +pub const MappingNotify: c_int = 34; +pub const GenericEvent: c_int = 35; +pub const LASTEvent: c_int = 36; + +// event mask +pub const NoEventMask: c_long = 0; +pub const KeyPressMask: c_long = 0x0000_0001; +pub const KeyReleaseMask: c_long = 0x0000_0002; +pub const ButtonPressMask: c_long = 0x0000_0004; +pub const ButtonReleaseMask: c_long = 0x0000_0008; +pub const EnterWindowMask: c_long = 0x0000_0010; +pub const LeaveWindowMask: c_long = 0x0000_0020; +pub const PointerMotionMask: c_long = 0x0000_0040; +pub const PointerMotionHintMask: c_long = 0x0000_0080; +pub const Button1MotionMask: c_long = 0x0000_0100; +pub const Button2MotionMask: c_long = 0x0000_0200; +pub const Button3MotionMask: c_long = 0x0000_0400; +pub const Button4MotionMask: c_long = 0x0000_0800; +pub const Button5MotionMask: c_long = 0x0000_1000; +pub const ButtonMotionMask: c_long = 0x0000_2000; +pub const KeymapStateMask: c_long = 0x0000_4000; +pub const ExposureMask: c_long = 0x0000_8000; +pub const VisibilityChangeMask: c_long = 0x0001_0000; +pub const StructureNotifyMask: c_long = 0x0002_0000; +pub const ResizeRedirectMask: c_long = 0x0004_0000; +pub const SubstructureNotifyMask: c_long = 0x0008_0000; +pub const SubstructureRedirectMask: c_long = 0x0010_0000; +pub const FocusChangeMask: c_long = 0x0020_0000; +pub const PropertyChangeMask: c_long = 0x0040_0000; +pub const ColormapChangeMask: c_long = 0x0080_0000; +pub const OwnerGrabButtonMask: c_long = 0x0100_0000; + +// property modes +pub const PropModeReplace: c_int = 0; +pub const PropModePrepend: c_int = 1; +pub const PropModeAppend: c_int = 2; + +// modifier names +pub const ShiftMapIndex: c_int = 0; +pub const LockMapIndex: c_int = 1; +pub const ControlMapIndex: c_int = 2; +pub const Mod1MapIndex: c_int = 3; +pub const Mod2MapIndex: c_int = 4; +pub const Mod3MapIndex: c_int = 5; +pub const Mod4MapIndex: c_int = 6; +pub const Mod5MapIndex: c_int = 7; + +// button masks +pub const Button1Mask: c_uint = (1<<8); +pub const Button2Mask: c_uint = (1<<9); +pub const Button3Mask: c_uint = (1<<10); +pub const Button4Mask: c_uint = (1<<11); +pub const Button5Mask: c_uint = (1<<12); +pub const AnyModifier: c_uint = (1<<15); + +// Notify modes +pub const NotifyNormal: c_int = 0; +pub const NotifyGrab: c_int = 1; +pub const NotifyUngrab: c_int = 2; +pub const NotifyWhileGrabbed: c_int = 3; + +pub const NotifyHint: c_int = 1; + +// Notify detail +pub const NotifyAncestor: c_int = 0; +pub const NotifyVirtual: c_int = 1; +pub const NotifyInferior: c_int = 2; +pub const NotifyNonlinear: c_int = 3; +pub const NotifyNonlinearVirtual: c_int = 4; +pub const NotifyPointer: c_int = 5; +pub const NotifyPointerRoot: c_int = 6; +pub const NotifyDetailNone: c_int = 7; + +// Visibility notify +pub const VisibilityUnobscured: c_int = 0; +pub const VisibilityPartiallyObscured: c_int = 1; +pub const VisibilityFullyObscured: c_int = 2; + +// Circulation request +pub const PlaceOnTop: c_int = 0; +pub const PlaceOnBottom: c_int = 1; + +// protocol families +pub const FamilyInternet: c_int = 0; +pub const FamilyDECnet: c_int = 1; +pub const FamilyChaos: c_int = 2; +pub const FamilyInternet6: c_int = 6; + +// authentication families not tied to a specific protocol +pub const FamilyServerInterpreted: c_int = 5; + +// property notification +pub const PropertyNewValue: c_int = 0; +pub const PropertyDelete: c_int = 1; + +// Color Map notification +pub const ColormapUninstalled: c_int = 0; +pub const ColormapInstalled: c_int = 1; + +// grab modes +pub const GrabModeSync: c_int = 0; +pub const GrabModeAsync: c_int = 1; + +// grab status +pub const GrabSuccess: c_int = 0; +pub const AlreadyGrabbed: c_int = 1; +pub const GrabInvalidTime: c_int = 2; +pub const GrabNotViewable: c_int = 3; +pub const GrabFrozen: c_int = 4; + +// AllowEvents modes +pub const AsyncPointer: c_int = 0; +pub const SyncPointer: c_int = 1; +pub const ReplayPointer: c_int = 2; +pub const AsyncKeyboard: c_int = 3; +pub const SyncKeyboard: c_int = 4; +pub const ReplayKeyboard: c_int = 5; +pub const AsyncBoth: c_int = 6; +pub const SyncBoth: c_int = 7; + +// Used in SetInputFocus, GetInputFocus +pub const RevertToNone: c_int = 0; +pub const RevertToPointerRoot: c_int = 1; +pub const RevertToParent: c_int = 2; + + +// ConfigureWindow structure +pub const CWX: c_ushort = (1<<0); +pub const CWY: c_ushort = (1<<1); +pub const CWWidth: c_ushort = (1<<2); +pub const CWHeight: c_ushort = (1<<3); +pub const CWBorderWidth: c_ushort = (1<<4); +pub const CWSibling: c_ushort = (1<<5); +pub const CWStackMode: c_ushort = (1<<6); + +// gravity +pub const ForgetGravity: c_int = 0; +pub const UnmapGravity: c_int = 0; +pub const NorthWestGravity: c_int = 1; +pub const NorthGravity: c_int = 2; +pub const NorthEastGravity: c_int = 3; +pub const WestGravity: c_int = 4; +pub const CenterGravity: c_int = 5; +pub const EastGravity: c_int = 6; +pub const SouthWestGravity: c_int = 7; +pub const SouthGravity: c_int = 8; +pub const SouthEastGravity: c_int = 9; +pub const StaticGravity: c_int = 10; + +// image format +pub const XYBitmap: c_int = 0; +pub const XYPixmap: c_int = 1; +pub const ZPixmap: c_int = 2; + +// Used in CreateWindow for backing-store hint +pub const NotUseful: c_int = 0; +pub const WhenMapped: c_int = 1; +pub const Always: c_int = 2; + +// map state +pub const IsUnmapped: c_int = 0; +pub const IsUnviewable: c_int = 1; +pub const IsViewable: c_int = 2; + +// modifier keys mask +pub const ShiftMask: c_uint = 0x01; +pub const LockMask: c_uint = 0x02; +pub const ControlMask: c_uint = 0x04; +pub const Mod1Mask: c_uint = 0x08; +pub const Mod2Mask: c_uint = 0x10; +pub const Mod3Mask: c_uint = 0x20; +pub const Mod4Mask: c_uint = 0x40; +pub const Mod5Mask: c_uint = 0x80; + +// mouse buttons +pub const Button1: c_uint = 1; +pub const Button2: c_uint = 2; +pub const Button3: c_uint = 3; +pub const Button4: c_uint = 4; +pub const Button5: c_uint = 5; + +// size hints mask +pub const USPosition: c_long = 0x0001; +pub const USSize: c_long = 0x0002; +pub const PPosition: c_long = 0x0004; +pub const PSize: c_long = 0x0008; +pub const PMinSize: c_long = 0x0010; +pub const PMaxSize: c_long = 0x0020; +pub const PResizeInc: c_long = 0x0040; +pub const PAspect: c_long = 0x0080; +pub const PBaseSize: c_long = 0x0100; +pub const PWinGravity: c_long = 0x0200; +pub const PAllHints: c_long = PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect; + +// Used in ChangeSaveSet +pub const SetModeInsert: c_int = 0; +pub const SetModeDelete: c_int = 1; + +// Used in ChangeCloseDownMode +pub const DestroyAll: c_int = 0; +pub const RetainPermanent: c_int = 1; +pub const RetainTemporary: c_int = 2; + +// Window stacking method (in configureWindow) +pub const Above: c_int = 0; +pub const Below: c_int = 1; +pub const TopIf: c_int = 2; +pub const BottomIf: c_int = 3; +pub const Opposite: c_int = 4; + +// Circulation direction +pub const RaiseLowest: c_int = 0; +pub const LowerHighest: c_int = 1; + +// graphics functions +pub const GXclear: c_int = 0x0; +pub const GXand: c_int = 0x1; +pub const GXandReverse: c_int = 0x2; +pub const GXcopy: c_int = 0x3; +pub const GXandInverted: c_int = 0x4; +pub const GXnoop: c_int = 0x5; +pub const GXxor: c_int = 0x6; +pub const GXor: c_int = 0x7; +pub const GXnor: c_int = 0x8; +pub const GXequiv: c_int = 0x9; +pub const GXinvert: c_int = 0xa; +pub const GXorReverse: c_int = 0xb; +pub const GXcopyInverted: c_int = 0xc; +pub const GXorInverted: c_int = 0xd; +pub const GXnand: c_int = 0xe; +pub const GXset: c_int = 0xf; + +// LineStyle +pub const LineSolid: c_int = 0; +pub const LineOnOffDash: c_int = 1; +pub const LineDoubleDash: c_int = 2; + +// capStyle +pub const CapNotLast: c_int = 0; +pub const CapButt: c_int = 1; +pub const CapRound: c_int = 2; +pub const CapProjecting: c_int = 3; + +// joinStyle +pub const JoinMiter: c_int = 0; +pub const JoinRound: c_int = 1; +pub const JoinBevel: c_int = 2; + +// fillStyle +pub const FillSolid: c_int = 0; +pub const FillTiled: c_int = 1; +pub const FillStippled: c_int = 2; +pub const FillOpaqueStippled: c_int = 3; + +// fillRule +pub const EvenOddRule: c_int = 0; +pub const WindingRule: c_int = 1; + +// subwindow mode +pub const ClipByChildren: c_int = 0; +pub const IncludeInferiors: c_int = 1; + +// CoordinateMode for drawing routines +pub const CoordModeOrigin: c_int = 0; +pub const CoordModePrevious: c_int = 1; + +// Polygon shapes +pub const Complex: c_int = 0; +pub const Nonconvex: c_int = 1; +pub const Convex: c_int = 2; + +// Arc modes for PolyFillArc +pub const ArcChord: c_int = 0; +pub const ArcPieSlice: c_int = 1; + +// GC components +pub const GCFunction: c_uint = (1<<0); +pub const GCPlaneMask: c_uint = (1<<1); +pub const GCForeground: c_uint = (1<<2); +pub const GCBackground: c_uint = (1<<3); +pub const GCLineWidth: c_uint = (1<<4); +pub const GCLineStyle: c_uint = (1<<5); +pub const GCCapStyle: c_uint = (1<<6); +pub const GCJoinStyle: c_uint = (1<<7); +pub const GCFillStyle: c_uint = (1<<8); +pub const GCFillRule: c_uint = (1<<9); +pub const GCTile: c_uint = (1<<10); +pub const GCStipple: c_uint = (1<<11); +pub const GCTileStipXOrigin: c_uint = (1<<12); +pub const GCTileStipYOrigin: c_uint = (1<<13); +pub const GCFont : c_uint = (1<<14); +pub const GCSubwindowMode: c_uint = (1<<15); +pub const GCGraphicsExposures: c_uint = (1<<16); +pub const GCClipXOrigin: c_uint = (1<<17); +pub const GCClipYOrigin: c_uint = (1<<18); +pub const GCClipMask: c_uint = (1<<19); +pub const GCDashOffset: c_uint = (1<<20); +pub const GCDashList: c_uint = (1<<21); +pub const GCArcMode: c_uint = (1<<22); + +pub const GCLastBit: c_uint = 22; + +// draw direction +pub const FontLeftToRight: c_int = 0; +pub const FontRightToLeft: c_int = 1; + +pub const FontChange: c_uchar = 255; + +// QueryBestSize Class +pub const CursorShape: c_int = 0; +pub const TileShape: c_int = 1; +pub const StippleShape: c_int = 2; + +// keyboard autorepeat +pub const AutoRepeatModeOff: c_int = 0; +pub const AutoRepeatModeOn: c_int = 1; +pub const AutoRepeatModeDefault: c_int = 2; + +pub const LedModeOff: c_int = 0; +pub const LedModeOn: c_int = 1; + +// masks for ChangeKeyboardControl +pub const KBKeyClickPercent: c_ulong = (1<<0); +pub const KBBellPercent: c_ulong = (1<<1); +pub const KBBellPitch: c_ulong = (1<<2); +pub const KBBellDuration: c_ulong = (1<<3); +pub const KBLed: c_ulong = (1<<4); +pub const KBLedMode: c_ulong = (1<<5); +pub const KBKey: c_ulong = (1<<6); +pub const KBAutoRepeatMode: c_ulong = (1<<7); + +pub const MappingSuccess: c_uchar = 0; +pub const MappingBusy: c_uchar = 1; +pub const MappingFailed: c_uchar = 2; + +pub const MappingModifier: c_int = 0; +pub const MappingKeyboard: c_int = 1; +pub const MappingPointer: c_int = 2; + +// screensaver +pub const DontPreferBlanking: c_int = 0; +pub const PreferBlanking: c_int = 1; +pub const DefaultBlanking: c_int = 2; + +pub const DisableScreenSaver: c_int = 0; +pub const DisableScreenInterval: c_int = 0; + +pub const DontAllowExposures: c_int = 0; +pub const AllowExposures: c_int = 1; +pub const DefaultExposures: c_int = 2; + +pub const ScreenSaverReset: c_int = 0; +pub const ScreenSaverActive: c_int = 1; + +// hosts and connections +pub const HostInsert: c_uchar = 0; +pub const HostDelete: c_uchar = 1; + +pub const EnableAccess: c_int = 1; +pub const DisableAccess: c_int = 0; + +// visual class +pub const StaticGray: c_int = 0; +pub const GrayScale: c_int = 1; +pub const StaticColor: c_int = 2; +pub const PseudoColor: c_int = 3; +pub const TrueColor: c_int = 4; +pub const DirectColor: c_int = 5; + +// visual info mask +pub const VisualNoMask: c_long = 0x0000; +pub const VisualIDMask: c_long = 0x0001; +pub const VisualScreenMask: c_long = 0x0002; +pub const VisualDepthMask: c_long = 0x0004; +pub const VisualClassMask: c_long = 0x0008; +pub const VisualRedMaskMask: c_long = 0x0010; +pub const VisualGreenMaskMask: c_long = 0x0020; +pub const VisualBlueMaskMask: c_long = 0x0040; +pub const VisualColormapSizeMask: c_long = 0x0080; +pub const VisualBitsPerRGBMask: c_long = 0x0100; +pub const VisualAllMask: c_long = 0x01ff; + +// window attributes +pub const CWBackPixmap: c_ulong = 0x0001; +pub const CWBackPixel: c_ulong = 0x0002; +pub const CWBorderPixmap: c_ulong = 0x0004; +pub const CWBorderPixel: c_ulong = 0x0008; +pub const CWBitGravity: c_ulong = 0x0010; +pub const CWWinGravity: c_ulong = 0x0020; +pub const CWBackingStore: c_ulong = 0x0040; +pub const CWBackingPlanes: c_ulong = 0x0080; +pub const CWBackingPixel: c_ulong = 0x0100; +pub const CWOverrideRedirect: c_ulong = 0x0200; +pub const CWSaveUnder: c_ulong = 0x0400; +pub const CWEventMask: c_ulong = 0x0800; +pub const CWDontPropagate: c_ulong = 0x1000; +pub const CWColormap: c_ulong = 0x2000; +pub const CWCursor: c_ulong = 0x4000; + +// window classes +pub const InputOutput: c_int = 1; +pub const InputOnly: c_int = 2; + +// XCreateIC values +pub const XIMPreeditArea: c_int = 0x0001; +pub const XIMPreeditCallbacks: c_int = 0x0002; +pub const XIMPreeditPosition: c_int = 0x0004; +pub const XIMPreeditNothing: c_int = 0x0008; +pub const XIMPreeditNone: c_int = 0x0010; +pub const XIMStatusArea: c_int = 0x0100; +pub const XIMStatusCallbacks: c_int = 0x0200; +pub const XIMStatusNothing: c_int = 0x0400; +pub const XIMStatusNone: c_int = 0x0800; + +// Byte order used in imageByteOrder and bitmapBitOrder +pub const LSBFirst: c_int = 0; +pub const MSBFirst: c_int = 1; + +// Reserved resource and constant definitions +//pub const None: c_int = 0; +pub const ParentRelative: c_int = 1; +pub const CopyFromParent: c_int = 0; +pub const PointerWindow: c_int = 0; +pub const InputFocus: c_int = 1; +pub const PointerRoot: c_int = 1; +pub const AnyPropertyType: c_int = 0; +pub const AnyKey: c_int = 0; +pub const AnyButton: c_int = 0; +pub const AllTemporary: c_int = 0; +pub const CurrentTime: Time = 0; +pub const NoSymbol: c_int = 0; + +/* Definitions for the X window system likely to be used by applications */ +pub const X_PROTOCOL: c_int = 11; +pub const X_PROTOCOL_REVISION: c_int = 0; + +pub const XNVaNestedList: &'static str = "XNVaNestedList"; +pub const XNQueryInputStyle: &'static str = "queryInputStyle"; +pub const XNClientWindow: &'static str = "clientWindow"; +pub const XNInputStyle: &'static str = "inputStyle"; +pub const XNFocusWindow: &'static str = "focusWindow"; +pub const XNResourceName: &'static str = "resourceName"; +pub const XNResourceClass: &'static str = "resourceClass"; +pub const XNGeometryCallback: &'static str = "geometryCallback"; +pub const XNDestroyCallback: &'static str = "destroyCallback"; +pub const XNFilterEvents: &'static str = "filterEvents"; +pub const XNPreeditStartCallback: &'static str = "preeditStartCallback"; +pub const XNPreeditDoneCallback: &'static str = "preeditDoneCallback"; +pub const XNPreeditDrawCallback: &'static str = "preeditDrawCallback"; +pub const XNPreeditCaretCallback: &'static str = "preeditCaretCallback"; +pub const XNPreeditStateNotifyCallback: &'static str = "preeditStateNotifyCallback"; +pub const XNPreeditAttributes: &'static str = "preeditAttributes"; +pub const XNStatusStartCallback: &'static str = "statusStartCallback"; +pub const XNStatusDoneCallback: &'static str = "statusDoneCallback"; +pub const XNStatusDrawCallback: &'static str = "statusDrawCallback"; +pub const XNStatusAttributes: &'static str = "statusAttributes"; +pub const XNArea: &'static str = "area"; +pub const XNAreaNeeded: &'static str = "areaNeeded"; +pub const XNSpotLocation: &'static str = "spotLocation"; +pub const XNColormap: &'static str = "colorMap"; +pub const XNStdColormap: &'static str = "stdColorMap"; +pub const XNForeground: &'static str = "foreground"; +pub const XNBackground: &'static str = "background"; +pub const XNBackgroundPixmap: &'static str = "backgroundPixmap"; +pub const XNFontSet: &'static str = "fontSet"; +pub const XNLineSpace: &'static str = "lineSpace"; +pub const XNCursor: &'static str = "cursor"; + +pub const XNQueryIMValuesList: &'static str = "queryIMValuesList"; +pub const XNQueryICValuesList: &'static str = "queryICValuesList"; +pub const XNVisiblePosition: &'static str = "visiblePosition"; +pub const XNR6PreeditCallback: &'static str = "r6PreeditCallback"; +pub const XNStringConversionCallback: &'static str = "stringConversionCallback"; +pub const XNStringConversion: &'static str = "stringConversion"; +pub const XNResetState: &'static str = "resetState"; +pub const XNHotKey: &'static str = "hotKey"; +pub const XNHotKeyState: &'static str = "hotKeyState"; +pub const XNPreeditState: &'static str = "preeditState"; +pub const XNSeparatorofNestedList: &'static str = "separatorofNestedList"; + +pub const XBufferOverflow: i32 = -1; +pub const XLookupNone: i32 = 1; +pub const XLookupChars: i32 = 2; +pub const XLookupKeySym: i32 = 3; +pub const XLookupBoth: i32 = 4; + +// Xkb constants +pub const XkbActionMessageLength: usize = 6; + +pub const XkbOD_Success: c_int = 0; +pub const XkbOD_BadLibraryVersion: c_int = 1; +pub const XkbOD_ConnectionRefused: c_int = 2; +pub const XkbOD_NonXkbServer: c_int = 3; +pub const XkbOD_BadServerVersion: c_int = 4; + +pub const XkbLC_ForceLatinLookup: c_uint = 1 << 0; +pub const XkbLC_ConsumeLookupMods: c_uint = 1 << 1; +pub const XkbLC_AlwaysConsumeShiftAndLock: c_uint = 1 << 2; +pub const XkbLC_IgnoreNewKeyboards: c_uint = 1 << 3; +pub const XkbLC_ControlFallback: c_uint = 1 << 4; +pub const XkbLC_ConsumeKeysOnComposeFail: c_uint = 1 << 29; +pub const XkbLC_ComposeLED: c_uint = 1 << 30; +pub const XkbLC_BeepOnComposeFail: c_uint = 1 << 31; + +pub const XkbLC_AllComposeControls: c_uint = 0xc000_0000; +pub const XkbLC_AllControls: c_uint = 0xc000_001f; + +pub const XkbNewKeyboardNotify: c_int = 0; +pub const XkbMapNotify: c_int = 1; +pub const XkbStateNotify: c_int = 2; +pub const XkbControlsNotify: c_int = 3; +pub const XkbIndicatorStateNotify: c_int = 4; +pub const XkbIndicatorMapNotify: c_int = 5; +pub const XkbNamesNotify: c_int = 6; +pub const XkbCompatMapNotify: c_int = 7; +pub const XkbBellNotify: c_int = 8; +pub const XkbActionMessage: c_int = 9; +pub const XkbAccessXNotify: c_int = 10; +pub const XkbExtensionDeviceNotify: c_int = 11; + +pub const XkbNewKeyboardNotifyMask: c_ulong = 1 << 0; +pub const XkbMapNotifyMask: c_ulong = 1 << 1; +pub const XkbStateNotifyMask: c_ulong = 1 << 2; +pub const XkbControlsNotifyMask: c_ulong = 1 << 3; +pub const XkbIndicatorStateNotifyMask: c_ulong = 1 << 4; +pub const XkbIndicatorMapNotifyMask: c_ulong = 1 << 5; +pub const XkbNamesNotifyMask: c_ulong = 1 << 6; +pub const XkbCompatMapNotifyMask: c_ulong = 1 << 7; +pub const XkbBellNotifyMask: c_ulong = 1 << 8; +pub const XkbActionMessageMask: c_ulong = 1 << 9; +pub const XkbAccessXNotifyMask: c_ulong = 1 << 10; +pub const XkbExtensionDeviceNotifyMask: c_ulong = 1 << 11; +pub const XkbAllEventsMask: c_ulong = 0xfff; diff --git a/third_party/rust/x11/src/xlib_xcb.rs b/third_party/rust/x11/src/xlib_xcb.rs new file mode 100644 index 000000000000..c1a814588c2c --- /dev/null +++ b/third_party/rust/x11/src/xlib_xcb.rs @@ -0,0 +1,10 @@ +use std::os::raw::c_void; +use ::xlib::Display; + +x11_link! { Xlib_xcb, xlib_xcb, ["libX11-xcb.so.1", "libX11-xcb.so"], 1, + pub fn XGetXCBConnection(_1: *mut Display) -> *mut xcb_connection_t, + variadic: + globals: +} + +pub type xcb_connection_t = c_void; diff --git a/third_party/rust/x11/src/xmd.rs b/third_party/rust/x11/src/xmd.rs new file mode 100644 index 000000000000..12ec995df286 --- /dev/null +++ b/third_party/rust/x11/src/xmd.rs @@ -0,0 +1,12 @@ +pub type INT8 = i8; +pub type INT16 = i16; +pub type INT32 = i32; +pub type INT64 = i64; + +pub type CARD8 = u8; +pub type CARD16 = u16; +pub type CARD32 = u32; +pub type CARD64 = u64; + +pub type BYTE = CARD8; +pub type BOOL = CARD8; diff --git a/third_party/rust/x11/src/xmu.rs b/third_party/rust/x11/src/xmu.rs new file mode 100644 index 000000000000..937ddda55c20 --- /dev/null +++ b/third_party/rust/x11/src/xmu.rs @@ -0,0 +1,199 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_int, + c_uchar, + c_uint, + c_ulong, + c_void, +}; +use libc::FILE; + +use ::xlib::{ + Display, + GC, + Screen, + XColor, + XComposeStatus, + XErrorEvent, + XEvent, + XKeyEvent, + XrmValue, + XSizeHints, + XStandardColormap, + XVisualInfo, +}; +use ::xt::{ + Widget, + XtAppContext, +}; + + +// +// functions +// + + +x11_link! { Xmu, xmu, ["libXmu.so.6", "libXmu.so"], 132, + pub fn XmuAddCloseDisplayHook (_3: *mut Display, _2: Option c_int>, _1: *mut c_char) -> *mut c_char, + pub fn XmuAddInitializer (_2: Option, _1: *mut c_char) -> (), + pub fn XmuAllStandardColormaps (_1: *mut Display) -> c_int, + pub fn XmuAppendSegment (_2: *mut XmuSegment, _1: *mut XmuSegment) -> c_int, + pub fn XmuAreaAnd (_2: *mut XmuArea, _1: *mut XmuArea) -> *mut XmuArea, + pub fn XmuAreaCopy (_2: *mut XmuArea, _1: *mut XmuArea) -> *mut XmuArea, + pub fn XmuAreaDup (_1: *mut XmuArea) -> *mut XmuArea, + pub fn XmuAreaNot (_5: *mut XmuArea, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> *mut XmuArea, + pub fn XmuAreaOrXor (_3: *mut XmuArea, _2: *mut XmuArea, _1: c_int) -> *mut XmuArea, + pub fn XmuCallInitializers (_1: XtAppContext) -> (), + pub fn XmuClientWindow (_2: *mut Display, _1: c_ulong) -> c_ulong, + pub fn XmuCompareISOLatin1 (_2: *const c_char, _1: *const c_char) -> c_int, + pub fn XmuConvertStandardSelection (_8: Widget, _7: c_ulong, _6: *mut c_ulong, _5: *mut c_ulong, _4: *mut c_ulong, _3: *mut *mut c_char, _2: *mut c_ulong, _1: *mut c_int) -> c_char, + pub fn XmuCopyISOLatin1Lowered (_2: *mut c_char, _1: *const c_char) -> (), + pub fn XmuCopyISOLatin1Uppered (_2: *mut c_char, _1: *const c_char) -> (), + pub fn XmuCreateColormap (_2: *mut Display, _1: *mut XStandardColormap) -> c_int, + pub fn XmuCreatePixmapFromBitmap (_8: *mut Display, _7: c_ulong, _6: c_ulong, _5: c_uint, _4: c_uint, _3: c_uint, _2: c_ulong, _1: c_ulong) -> c_ulong, + pub fn XmuCreateStippledPixmap (_4: *mut Screen, _3: c_ulong, _2: c_ulong, _1: c_uint) -> c_ulong, + pub fn XmuCursorNameToIndex (_1: *const c_char) -> c_int, + pub fn XmuCvtBackingStoreToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtFunctionToCallback (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtGravityToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtJustifyToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtLongToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtOrientationToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtShapeStyleToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtStringToBackingStore (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtStringToBitmap (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtStringToColorCursor (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtStringToCursor (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtStringToGravity (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtStringToJustify (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtStringToLong (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtStringToOrientation (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtStringToShapeStyle (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuCvtStringToWidget (_4: *mut XrmValue, _3: *mut c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XmuCvtWidgetToString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuDeleteStandardColormap (_3: *mut Display, _2: c_int, _1: c_ulong) -> (), + pub fn XmuDestroyScanlineList (_1: *mut XmuScanline) -> (), + pub fn XmuDestroySegmentList (_1: *mut XmuSegment) -> (), + pub fn XmuDistinguishableColors (_2: *mut XColor, _1: c_int) -> c_int, + pub fn XmuDistinguishablePixels (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int, + pub fn XmuDQAddDisplay (_3: *mut XmuDisplayQueue, _2: *mut Display, _1: *mut c_char) -> *mut XmuDisplayQueueEntry, + pub fn XmuDQCreate (_3: Option c_int>, _2: Option c_int>, _1: *mut c_char) -> *mut XmuDisplayQueue, + pub fn XmuDQDestroy (_2: *mut XmuDisplayQueue, _1: c_int) -> c_int, + pub fn XmuDQLookupDisplay (_2: *mut XmuDisplayQueue, _1: *mut Display) -> *mut XmuDisplayQueueEntry, + pub fn XmuDQRemoveDisplay (_2: *mut XmuDisplayQueue, _1: *mut Display) -> c_int, + pub fn XmuDrawLogo (_8: *mut Display, _7: c_ulong, _6: GC, _5: GC, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (), + pub fn XmuDrawRoundedRectangle (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XmuFillRoundedRectangle (_9: *mut Display, _8: c_ulong, _7: GC, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: c_int) -> (), + pub fn XmuGetAtomName (_2: *mut Display, _1: c_ulong) -> *mut c_char, + pub fn XmuGetColormapAllocation (_5: *mut XVisualInfo, _4: c_ulong, _3: *mut c_ulong, _2: *mut c_ulong, _1: *mut c_ulong) -> c_int, + pub fn XmuGetHostname (_2: *mut c_char, _1: c_int) -> c_int, + pub fn XmuInternAtom (_2: *mut Display, _1: AtomPtr) -> c_ulong, + pub fn XmuInternStrings (_4: *mut Display, _3: *mut *mut c_char, _2: c_uint, _1: *mut c_ulong) -> (), + pub fn XmuLocateBitmapFile (_8: *mut Screen, _7: *const c_char, _6: *mut c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_ulong, + pub fn XmuLocatePixmapFile (_11: *mut Screen, _10: *const c_char, _9: c_ulong, _8: c_ulong, _7: c_uint, _6: *mut c_char, _5: c_int, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_ulong, + pub fn XmuLookupAPL (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupArabic (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupCloseDisplayHook (_4: *mut Display, _3: *mut c_char, _2: Option c_int>, _1: *mut c_char) -> c_int, + pub fn XmuLookupCyrillic (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupGreek (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupHebrew (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupJISX0201 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupKana (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupLatin1 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupLatin2 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupLatin3 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupLatin4 (_5: *mut XKeyEvent, _4: *mut c_uchar, _3: c_int, _2: *mut c_ulong, _1: *mut XComposeStatus) -> c_int, + pub fn XmuLookupStandardColormap (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_uint, _3: c_ulong, _2: c_int, _1: c_int) -> c_int, + pub fn XmuLookupString (_6: *mut XKeyEvent, _5: *mut c_uchar, _4: c_int, _3: *mut c_ulong, _2: *mut XComposeStatus, _1: c_ulong) -> c_int, + pub fn XmuMakeAtom (_1: *const c_char) -> AtomPtr, + pub fn XmuNameOfAtom (_1: AtomPtr) -> *mut c_char, + pub fn XmuNCopyISOLatin1Lowered (_3: *mut c_char, _2: *const c_char, _1: c_int) -> (), + pub fn XmuNCopyISOLatin1Uppered (_3: *mut c_char, _2: *const c_char, _1: c_int) -> (), + pub fn XmuNewArea (_4: c_int, _3: c_int, _2: c_int, _1: c_int) -> *mut XmuArea, + pub fn XmuNewCvtStringToWidget (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XmuNewScanline (_3: c_int, _2: c_int, _1: c_int) -> *mut XmuScanline, + pub fn XmuNewSegment (_2: c_int, _1: c_int) -> *mut XmuSegment, + pub fn XmuOptimizeArea (_1: *mut XmuArea) -> *mut XmuArea, + pub fn XmuOptimizeScanline (_1: *mut XmuScanline) -> *mut XmuScanline, + pub fn XmuPrintDefaultErrorMessage (_3: *mut Display, _2: *mut XErrorEvent, _1: *mut FILE) -> c_int, + pub fn XmuReadBitmapData (_6: *mut FILE, _5: *mut c_uint, _4: *mut c_uint, _3: *mut *mut c_uchar, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XmuReadBitmapDataFromFile (_6: *const c_char, _5: *mut c_uint, _4: *mut c_uint, _3: *mut *mut c_uchar, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XmuRegisterExternalAgent (_4: Widget, _3: *mut c_void, _2: *mut XEvent, _1: *mut c_char) -> (), + pub fn XmuReleaseStippledPixmap (_2: *mut Screen, _1: c_ulong) -> (), + pub fn XmuRemoveCloseDisplayHook (_4: *mut Display, _3: *mut c_char, _2: Option c_int>, _1: *mut c_char) -> c_int, + pub fn XmuReshapeWidget (_4: Widget, _3: c_int, _2: c_int, _1: c_int) -> c_char, + pub fn XmuScanlineAnd (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline, + pub fn XmuScanlineAndSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline, + pub fn XmuScanlineCopy (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline, + pub fn XmuScanlineEqu (_2: *mut XmuScanline, _1: *mut XmuScanline) -> c_int, + pub fn XmuScanlineNot (_3: *mut XmuScanline, _2: c_int, _1: c_int) -> *mut XmuScanline, + pub fn XmuScanlineOr (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline, + pub fn XmuScanlineOrSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline, + pub fn XmuScanlineXor (_2: *mut XmuScanline, _1: *mut XmuScanline) -> *mut XmuScanline, + pub fn XmuScanlineXorSegment (_2: *mut XmuScanline, _1: *mut XmuSegment) -> *mut XmuScanline, + pub fn XmuScreenOfWindow (_2: *mut Display, _1: c_ulong) -> *mut Screen, + pub fn XmuSimpleErrorHandler (_2: *mut Display, _1: *mut XErrorEvent) -> c_int, + pub fn XmuStandardColormap (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_uint, _5: c_ulong, _4: c_ulong, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> *mut XStandardColormap, + pub fn XmuUpdateMapHints (_3: *mut Display, _2: c_ulong, _1: *mut XSizeHints) -> c_int, + pub fn XmuValidArea (_1: *mut XmuArea) -> c_int, + pub fn XmuValidScanline (_1: *mut XmuScanline) -> c_int, + pub fn XmuVisualStandardColormaps (_6: *mut Display, _5: c_int, _4: c_ulong, _3: c_uint, _2: c_int, _1: c_int) -> c_int, + pub fn XmuWnCountOwnedResources (_3: *mut XmuWidgetNode, _2: *mut XmuWidgetNode, _1: c_int) -> c_int, + pub fn XmuWnFetchResources (_3: *mut XmuWidgetNode, _2: Widget, _1: *mut XmuWidgetNode) -> (), + pub fn XmuWnInitializeNodes (_2: *mut XmuWidgetNode, _1: c_int) -> (), + pub fn XmuWnNameToNode (_3: *mut XmuWidgetNode, _2: c_int, _1: *const c_char) -> *mut XmuWidgetNode, +variadic: + pub fn XmuSnprintf (_3: *mut c_char, _2: c_int, _1: *const c_char) -> c_int, +globals: + pub static _XA_ATOM_PAIR: AtomPtr, + pub static _XA_CHARACTER_POSITION: AtomPtr, + pub static _XA_CLASS: AtomPtr, + pub static _XA_CLIENT_WINDOW: AtomPtr, + pub static _XA_CLIPBOARD: AtomPtr, + pub static _XA_COMPOUND_TEXT: AtomPtr, + pub static _XA_DECNET_ADDRESS: AtomPtr, + pub static _XA_DELETE: AtomPtr, + pub static _XA_FILENAME: AtomPtr, + pub static _XA_HOSTNAME: AtomPtr, + pub static _XA_IP_ADDRESS: AtomPtr, + pub static _XA_LENGTH: AtomPtr, + pub static _XA_LIST_LENGTH: AtomPtr, + pub static _XA_NAME: AtomPtr, + pub static _XA_NET_ADDRESS: AtomPtr, + pub static _XA_NULL: AtomPtr, + pub static _XA_OWNER_OS: AtomPtr, + pub static _XA_SPAN: AtomPtr, + pub static _XA_TARGETS: AtomPtr, + pub static _XA_TEXT: AtomPtr, + pub static _XA_TIMESTAMP: AtomPtr, + pub static _XA_USER: AtomPtr, + pub static _XA_UTF8_STRING: AtomPtr, +} + + +// +// types +// + + +// TODO structs +#[repr(C)] pub struct _AtomRec; +#[repr(C)] pub struct _XmuArea; +#[repr(C)] pub struct _XmuDisplayQueue; +#[repr(C)] pub struct _XmuDisplayQueueEntry; +#[repr(C)] pub struct _XmuScanline; +#[repr(C)] pub struct _XmuSegment; +#[repr(C)] pub struct _XmuWidgetNode; + +// struct typedefs +pub type AtomPtr = *mut _AtomRec; +pub type XmuArea = _XmuArea; +pub type XmuDisplayQueue = _XmuDisplayQueue; +pub type XmuDisplayQueueEntry = _XmuDisplayQueueEntry; +pub type XmuScanline = _XmuScanline; +pub type XmuSegment = _XmuSegment; +pub type XmuWidgetNode = _XmuWidgetNode; diff --git a/third_party/rust/x11/src/xrandr.rs b/third_party/rust/x11/src/xrandr.rs new file mode 100644 index 000000000000..8f1972763df4 --- /dev/null +++ b/third_party/rust/x11/src/xrandr.rs @@ -0,0 +1,555 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort }; +use std::mem; + +use ::internal::transmute_union; +use xlib::{ Atom, Bool, Display, Drawable, Status, Time, XEvent, XID, Window }; +use xrender::{ XFixed, XTransform }; + + +// +// functions +// + + +x11_link! { Xrandr, xrandr, ["libXrandr.so.2", "libXrandr.so"], 70, + pub fn XRRAddOutputMode (dpy: *mut Display, output: RROutput, mode: RRMode) -> (), + pub fn XRRAllocGamma (size: c_int) -> *mut XRRCrtcGamma, + pub fn XRRAllocModeInfo (name: *const c_char, nameLength: c_int) -> *mut XRRModeInfo, + pub fn XRRAllocateMonitor (dpy: *mut Display, noutput: c_int) -> *mut XRRMonitorInfo, + pub fn XRRChangeOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, type_: Atom, format: c_int, mode: c_int, data: *const c_uchar, nelements: c_int) -> (), + pub fn XRRChangeProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, type_: Atom, format: c_int, mode: c_int, data: *const c_uchar, nelements: c_int) -> (), + pub fn XRRConfigCurrentConfiguration (config: *mut XRRScreenConfiguration, rotation: *mut Rotation) -> SizeID, + pub fn XRRConfigCurrentRate (config: *mut XRRScreenConfiguration) -> c_short, + pub fn XRRConfigRates (config: *mut XRRScreenConfiguration, sizeID: c_int, nrates: *mut c_int) -> *mut c_short, + pub fn XRRConfigRotations (config: *mut XRRScreenConfiguration, current_rotation: *mut Rotation) -> Rotation, + pub fn XRRConfigSizes (config: *mut XRRScreenConfiguration, nsizes: *mut c_int) -> *mut XRRScreenSize, + pub fn XRRConfigTimes (config: *mut XRRScreenConfiguration, config_timestamp: *mut Time) -> Time, + pub fn XRRConfigureOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, pending: Bool, range: Bool, num_values: c_int, values: *mut c_long) -> (), + pub fn XRRConfigureProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, pending: Bool, range: Bool, num_values: c_int, values: *mut c_long) -> (), + pub fn XRRCreateMode (dpy: *mut Display, window: Window, modeInfo: *mut XRRModeInfo) -> RRMode, + pub fn XRRDeleteMonitor (dpy: *mut Display, window: Window, name: Atom) -> (), + pub fn XRRDeleteOutputMode (dpy: *mut Display, output: RROutput, mode: RRMode) -> (), + pub fn XRRDeleteOutputProperty (dpy: *mut Display, output: RROutput, property: Atom) -> (), + pub fn XRRDeleteProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom) -> (), + pub fn XRRDestroyMode (dpy: *mut Display, mode: RRMode) -> (), + pub fn XRRFreeCrtcInfo (crtcInfo: *mut XRRCrtcInfo) -> (), + pub fn XRRFreeGamma (gamma: *mut XRRCrtcGamma) -> (), + pub fn XRRFreeModeInfo (modeInfo: *mut XRRModeInfo) -> (), + pub fn XRRFreeMonitors (monitors: *mut XRRMonitorInfo) -> (), + pub fn XRRFreeOutputInfo (outputInfo: *mut XRROutputInfo) -> (), + pub fn XRRFreePanning (panning: *mut XRRPanning) -> (), + pub fn XRRFreeProviderInfo (provider: *mut XRRProviderInfo) -> (), + pub fn XRRFreeProviderResources (resources: *mut XRRProviderResources) -> (), + pub fn XRRFreeScreenConfigInfo (config: *mut XRRScreenConfiguration) -> (), + pub fn XRRFreeScreenResources (resources: *mut XRRScreenResources) -> (), + pub fn XRRGetCrtcGamma (dpy: *mut Display, crtc: RRCrtc) -> *mut XRRCrtcGamma, + pub fn XRRGetCrtcGammaSize (dpy: *mut Display, crtc: RRCrtc) -> c_int, + pub fn XRRGetCrtcInfo (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc) -> *mut XRRCrtcInfo, + pub fn XRRGetCrtcTransform (dpy: *mut Display, crtc: RRCrtc, attributes: *mut *mut XRRCrtcTransformAttributes) -> Status, + pub fn XRRGetMonitors (dpy: *mut Display, window: Window, get_active: Bool, nmonitors: *mut c_int) -> *mut XRRMonitorInfo, + pub fn XRRGetOutputInfo (dpy: *mut Display, resources: *mut XRRScreenResources, output: RROutput) -> *mut XRROutputInfo, + pub fn XRRGetOutputPrimary (dpy: *mut Display, window: Window) -> RROutput, + pub fn XRRGetOutputProperty (dpy: *mut Display, output: RROutput, property: Atom, offset: c_long, length: c_long, _delete: Bool, pending: Bool, req_type: Atom, actual_type: *mut Atom, actual_format: *mut c_int, nitems: *mut c_ulong, bytes_after: *mut c_ulong, prop: *mut *mut c_uchar) -> c_int, + pub fn XRRGetPanning (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc) -> *mut XRRPanning, + pub fn XRRGetProviderInfo (dpy: *mut Display, resources: *mut XRRScreenResources, provider: RRProvider) -> *mut XRRProviderInfo, + pub fn XRRGetProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom, offset: c_long, length: c_long, _delete: Bool, pending: Bool, req_type: Atom, actual_type: *mut Atom, actual_format: *mut c_int, nitems: *mut c_ulong, bytes_after: *mut c_ulong, prop: *mut *mut c_uchar) -> c_int, + pub fn XRRGetProviderResources (dpy: *mut Display, window: Window) -> *mut XRRProviderResources, + pub fn XRRGetScreenInfo (dpy: *mut Display, window: Window) -> *mut XRRScreenConfiguration, + pub fn XRRGetScreenResources (dpy: *mut Display, window: Window) -> *mut XRRScreenResources, + pub fn XRRGetScreenResourcesCurrent (dpy: *mut Display, window: Window) -> *mut XRRScreenResources, + pub fn XRRGetScreenSizeRange (dpy: *mut Display, window: Window, minWidth: *mut c_int, minHeight: *mut c_int, maxWidth: *mut c_int, maxHeight: *mut c_int) -> Status, + pub fn XRRListOutputProperties (dpy: *mut Display, output: RROutput, nprop: *mut c_int) -> *mut Atom, + pub fn XRRListProviderProperties (dpy: *mut Display, provider: RRProvider, nprop: *mut c_int) -> *mut Atom, + pub fn XRRQueryExtension (dpy: *mut Display, event_base_return: *mut c_int, error_base_return: *mut c_int) -> Bool, + pub fn XRRQueryOutputProperty (dpy: *mut Display, output: RROutput, property: Atom) -> *mut XRRPropertyInfo, + pub fn XRRQueryProviderProperty (dpy: *mut Display, provider: RRProvider, property: Atom) -> *mut XRRPropertyInfo, + pub fn XRRQueryVersion (dpy: *mut Display, major_version_return: *mut c_int, minor_version_return: *mut c_int) -> Status, + pub fn XRRRates (dpy: *mut Display, screen: c_int, sizeID: c_int, nrates: *mut c_int) -> *mut c_short, + pub fn XRRRootToScreen (dpy: *mut Display, root: Window) -> c_int, + pub fn XRRRotations (dpy: *mut Display, screen: c_int, current_rotation: *mut Rotation) -> Rotation, + pub fn XRRSelectInput (dpy: *mut Display, window: Window, mask: c_int) -> (), + pub fn XRRSetCrtcConfig (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc, timestamp: Time, x: c_int, y: c_int, mode: RRMode, rotation: Rotation, outputs: *mut RROutput, noutputs: c_int) -> Status, + pub fn XRRSetCrtcGamma (dpy: *mut Display, crtc: RRCrtc, gamma: *mut XRRCrtcGamma) -> (), + pub fn XRRSetCrtcTransform (dpy: *mut Display, crtc: RRCrtc, transform: *mut XTransform, filter: *const c_char, params: *mut XFixed, nparams: c_int) -> (), + pub fn XRRSetMonitor (dpy: *mut Display, window: Window, monitor: *mut XRRMonitorInfo) -> (), + pub fn XRRSetOutputPrimary (dpy: *mut Display, window: Window, output: RROutput) -> (), + pub fn XRRSetPanning (dpy: *mut Display, resources: *mut XRRScreenResources, crtc: RRCrtc, panning: *mut XRRPanning) -> Status, + pub fn XRRSetProviderOffloadSink (dpy: *mut Display, provider: XID, sink_provider: XID) -> c_int, + pub fn XRRSetProviderOutputSource (dpy: *mut Display, provider: XID, source_provider: XID) -> c_int, + pub fn XRRSetScreenConfig (dpy: *mut Display, config: *mut XRRScreenConfiguration, draw: Drawable, size_index: c_int, rotation: Rotation, timestamp: Time) -> Status, + pub fn XRRSetScreenConfigAndRate (dpy: *mut Display, config: *mut XRRScreenConfiguration, draw: Drawable, size_index: c_int, rotation: Rotation, rate: c_short, timestamp: Time) -> Status, + pub fn XRRSetScreenSize (dpy: *mut Display, window: Window, width: c_int, height: c_int, mmWidth: c_int, mmHeight: c_int) -> (), + pub fn XRRSizes (dpy: *mut Display, screen: c_int, nsizes: *mut c_int) -> *mut XRRScreenSize, + pub fn XRRTimes (dpy: *mut Display, screen: c_int, config_timestamp: *mut Time) -> Time, + pub fn XRRUpdateConfiguration (event: *mut XEvent) -> c_int, +variadic: +globals: +} + + +// +// types +// + + +pub type Connection = c_ushort; +pub type Rotation = c_ushort; +pub type SizeID = c_ushort; +pub type SubpixelOrder = c_ushort; + +pub type RROutput = XID; +pub type RRCrtc = XID; +pub type RRMode = XID; +pub type RRProvider = XID; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRScreenSize { + pub width: c_int, + pub height: c_int, + pub mwidth: c_int, + pub mheight: c_int, +} + +#[repr(C)] pub struct XRRScreenConfiguration; + +pub type XRRModeFlags = c_ulong; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRModeInfo { + pub id: RRMode, + pub width: c_uint, + pub height: c_uint, + pub dotClock: c_ulong, + pub hSyncStart: c_uint, + pub hSyncEnd: c_uint, + pub hTotal: c_uint, + pub hSkew: c_uint, + pub vSyncStart: c_uint, + pub vSyncEnd: c_uint, + pub vTotal: c_uint, + pub name: *mut c_char, + pub nameLength: c_uint, + pub modeFlags: XRRModeFlags, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRScreenResources { + pub timestamp: Time, + pub configTimestamp: Time, + pub ncrtc: c_int, + pub crtcs: *mut RRCrtc, + pub noutput: c_int, + pub outputs: *mut RROutput, + pub nmode: c_int, + pub modes: *mut XRRModeInfo, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRROutputInfo { + pub timestamp: Time, + pub crtc: RRCrtc, + pub name: *mut c_char, + pub nameLen: c_int, + pub mm_width: c_ulong, + pub mm_height: c_ulong, + pub connection: Connection, + pub subpixel_order: SubpixelOrder, + pub ncrtc: c_int, + pub crtcs: *mut RRCrtc, + pub nclone: c_int, + pub clones: *mut RROutput, + pub nmode: c_int, + pub npreferred: c_int, + pub modes: *mut RRMode, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRPropertyInfo { + pub pending: Bool, + pub range: Bool, + pub immutable: Bool, + pub num_values: c_int, + pub values: *mut c_long, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRCrtcInfo { + pub timestamp: Time, + pub x: c_int, + pub y: c_int, + pub width: c_uint, + pub height: c_uint, + pub mode: RRMode, + pub rotation: Rotation, + pub noutput: c_int, + pub outputs: *mut RROutput, + pub rotations: Rotation, + pub npossible: c_int, + pub possible: *mut RROutput, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRCrtcGamma { + pub size: c_int, + pub red: *mut c_ushort, + pub green: *mut c_ushort, + pub blue: *mut c_ushort, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRCrtcTransformAttributes { + pub pendingTransform: XTransform, + pub pendingFilter: *mut c_char, + pub pendingNparams: c_int, + pub pendingParams: *mut XFixed, + pub currentTransform: XTransform, + pub currentFilter: *mut c_char, + pub currentNparams: c_int, + pub currentParams: *mut XFixed, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRPanning { + pub timestamp: Time, + pub left: c_uint, + pub top: c_uint, + pub width: c_uint, + pub height: c_uint, + pub track_left: c_uint, + pub track_top: c_uint, + pub track_width: c_uint, + pub track_height: c_uint, + pub border_left: c_int, + pub border_top: c_int, + pub border_right: c_int, + pub border_bottom: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRProviderResources { + pub timestamp: Time, + pub nproviders: c_int, + pub providers: *mut RRProvider, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRProviderInfo { + pub capabilities: c_uint, + pub ncrtcs: c_int, + pub crtcs: *mut RRCrtc, + pub noutputs: c_int, + pub outputs: *mut RROutput, + pub name: *mut c_char, + pub nassociatedproviders: c_int, + pub associated_providers: *mut RRProvider, + pub associated_capability: *mut c_uint, + pub nameLen: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRMonitorInfo { + pub name: Atom, + pub primary: Bool, + pub automatic: Bool, + pub noutput: c_int, + pub x: c_int, + pub y: c_int, + pub width: c_int, + pub height: c_int, + pub mwidth: c_int, + pub mheight: c_int, + pub outputs: *mut RROutput, +} + + +// +// event structures +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRScreenChangeNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub root: Window, + pub timestamp: Time, + pub config_timestamp: Time, + pub size_index: SizeID, + pub subpixel_order: SubpixelOrder, + pub rotation: Rotation, + pub width: c_int, + pub height: c_int, + pub mwidth: c_int, + pub mheight: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub subtype: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRROutputChangeNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub subtype: c_int, + pub output: RROutput, + pub crtc: RRCrtc, + pub mode: RRMode, + pub rotation: Rotation, + pub connection: Connection, + pub subpixel_order: SubpixelOrder, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRCrtcChangeNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub subtype: c_int, + pub crtc: RRCrtc, + pub mode: RRMode, + pub rotation: Rotation, + pub x: c_int, + pub y: c_int, + pub width: c_uint, + pub height: c_uint, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRROutputPropertyNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub subtype: c_int, + pub output: RROutput, + pub property: Atom, + pub timestamp: Time, + pub state: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRProviderChangeNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub subtype: c_int, + pub provider: RRProvider, + pub timestamp: Time, + pub current_role: c_uint, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRProviderPropertyNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub subtype: c_int, + pub provider: RRProvider, + pub property: Atom, + pub timestamp: Time, + pub state: c_int, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRRResourceChangeNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub subtype: c_int, + pub timestamp: Time, +} + +event_conversions_and_tests! { + XRRScreenChangeNotifyEvent, XRRNotifyEvent, XRROutputChangeNotifyEvent, + XRRCrtcChangeNotifyEvent, XRROutputPropertyNotifyEvent, XRRProviderChangeNotifyEvent, + XRRProviderPropertyNotifyEvent, XRRResourceChangeNotifyEvent, +} + + +// +// constants +// + + +pub const RANDR_NAME: &'static str = "RANDR"; +pub const RANDR_MAJOR: c_int = 1; +pub const RANDR_MINOR: c_int = 5; + +pub const RRNumberErrors: c_int = 4; +pub const RRNumberEvents: c_int = 2; +pub const RRNumberRequests: c_int = 45; + +pub const X_RRQueryVersion: c_int = 0; +pub const X_RROldGetScreenInfo: c_int = 1; +pub const X_RRSetScreenConfig: c_int = 2; +pub const X_RROldScreenChangeSelectInput: c_int = 3; +pub const X_RRSelectInput: c_int = 4; +pub const X_RRGetScreenInfo: c_int = 5; + +pub const X_RRGetScreenSizeRange: c_int = 6; +pub const X_RRSetScreenSize: c_int = 7; +pub const X_RRGetScreenResources: c_int = 8; +pub const X_RRGetOutputInfo: c_int = 9; +pub const X_RRListOutputProperties: c_int = 10; +pub const X_RRQueryOutputProperty: c_int = 11; +pub const X_RRConfigureOutputProperty: c_int = 12; +pub const X_RRChangeOutputProperty: c_int = 13; +pub const X_RRDeleteOutputProperty: c_int = 14; +pub const X_RRGetOutputProperty: c_int = 15; +pub const X_RRCreateMode: c_int = 16; +pub const X_RRDestroyMode: c_int = 17; +pub const X_RRAddOutputMode: c_int = 18; +pub const X_RRDeleteOutputMode: c_int = 19; +pub const X_RRGetCrtcInfo: c_int = 20; +pub const X_RRSetCrtcConfig: c_int = 21; +pub const X_RRGetCrtcGammaSize: c_int = 22; +pub const X_RRGetCrtcGamma: c_int = 23; +pub const X_RRSetCrtcGamma: c_int = 24; + +pub const X_RRGetScreenResourcesCurrent: c_int = 25; +pub const X_RRSetCrtcTransform: c_int = 26; +pub const X_RRGetCrtcTransform: c_int = 27; +pub const X_RRGetPanning: c_int = 28; +pub const X_RRSetPanning: c_int = 29; +pub const X_RRSetOutputPrimary: c_int = 30; +pub const X_RRGetOutputPrimary: c_int = 31; + +pub const X_RRGetProviders: c_int = 32; +pub const X_RRGetProviderInfo: c_int = 33; +pub const X_RRSetProviderOffloadSink: c_int = 34; +pub const X_RRSetProviderOutputSource: c_int = 35; +pub const X_RRListProviderProperties: c_int = 36; +pub const X_RRQueryProviderProperty: c_int = 37; +pub const X_RRConfigureProviderProperty: c_int = 38; +pub const X_RRChangeProviderProperty: c_int = 39; +pub const X_RRDeleteProviderProperty: c_int = 40; +pub const X_RRGetProviderProperty: c_int = 41; + +pub const X_RRGetMonitors: c_int = 42; +pub const X_RRSetMonitor: c_int = 43; +pub const X_RRDeleteMonitor: c_int = 44; + +pub const RRTransformUnit: c_int = 1 << 0; +pub const RRTransformScaleUp: c_int = 1 << 1; +pub const RRTransformScaleDown: c_int = 1 << 2; +pub const RRTransformProjective: c_int = 1 << 3; + +pub const RRScreenChangeNotifyMask: c_int = 1 << 0; +pub const RRCrtcChangeNotifyMask: c_int = 1 << 1; +pub const RROutputChangeNotifyMask: c_int = 1 << 2; +pub const RROutputPropertyNotifyMask: c_int = 1 << 3; +pub const RRProviderChangeNotifyMask: c_int = 1 << 4; +pub const RRProviderPropertyNotifyMask: c_int = 1 << 5; +pub const RRResourceChangeNotifyMask: c_int = 1 << 6; + +pub const RRScreenChangeNotify: c_int = 0; +pub const RRNotify: c_int = 1; +pub const RRNotify_CrtcChange: c_int = 0; +pub const RRNotify_OutputChange: c_int = 1; +pub const RRNotify_OutputProperty: c_int = 2; +pub const RRNotify_ProviderChange: c_int = 3; +pub const RRNotify_ProviderProperty: c_int = 4; +pub const RRNotify_ResourceChange: c_int = 5; + +pub const RR_Rotate_0: c_int = 1; +pub const RR_Rotate_90: c_int = 2; +pub const RR_Rotate_180: c_int = 4; +pub const RR_Rotate_270: c_int = 8; + +pub const RR_Reflect_X: c_int = 16; +pub const RR_Reflect_Y: c_int = 32; + +pub const RRSetConfigSuccess: c_int = 0; +pub const RRSetConfigInvalidConfigTime: c_int = 1; +pub const RRSetConfigInvalidTime: c_int = 2; +pub const RRSetConfigFailed: c_int = 3; + +pub const RR_HSyncPositive: c_int = 0x00000001; +pub const RR_HSyncNegative: c_int = 0x00000002; +pub const RR_VSyncPositive: c_int = 0x00000004; +pub const RR_VSyncNegative: c_int = 0x00000008; +pub const RR_Interlace: c_int = 0x00000010; +pub const RR_DoubleScan: c_int = 0x00000020; +pub const RR_CSync: c_int = 0x00000040; +pub const RR_CSyncPositive: c_int = 0x00000080; +pub const RR_CSyncNegative: c_int = 0x00000100; +pub const RR_HSkewPresent: c_int = 0x00000200; +pub const RR_BCast: c_int = 0x00000400; +pub const RR_PixelMultiplex: c_int = 0x00000800; +pub const RR_DoubleClock: c_int = 0x00001000; +pub const RR_ClockDivideBy2: c_int = 0x00002000; + +pub const RR_Connected: c_int = 0; +pub const RR_Disconnected: c_int = 1; +pub const RR_UnknownConnection: c_int = 2; + +pub const BadRROutput: c_int = 0; +pub const BadRRCrtc: c_int = 1; +pub const BadRRMode: c_int = 2; +pub const BadRRProvider: c_int = 3; + +pub const RR_PROPERTY_BACKLIGHT: &'static str = "Backlight"; +pub const RR_PROPERTY_RANDR_EDID: &'static str = "EDID"; +pub const RR_PROPERTY_SIGNAL_FORMAT: &'static str = "SignalFormat"; +pub const RR_PROPERTY_SIGNAL_PROPERTIES: &'static str = "SignalProperties"; +pub const RR_PROPERTY_CONNECTOR_TYPE: &'static str = "ConnectorType"; +pub const RR_PROPERTY_CONNECTOR_NUMBER: &'static str = "ConnectorNumber"; +pub const RR_PROPERTY_COMPATIBILITY_LIST: &'static str = "CompatibilityList"; +pub const RR_PROPERTY_CLONE_LIST: &'static str = "CloneList"; +pub const RR_PROPERTY_BORDER: &'static str = "Border"; +pub const RR_PROPERTY_BORDER_DIMENSIONS: &'static str = "BorderDimensions"; +pub const RR_PROPERTY_GUID: &'static str = "GUID"; +pub const RR_PROPERTY_RANDR_TILE: &'static str = "TILE"; + +pub const RR_Capability_None: c_int = 0; +pub const RR_Capability_SourceOutput: c_int = 1; +pub const RR_Capability_SinkOutput: c_int = 2; +pub const RR_Capability_SourceOffload: c_int = 4; +pub const RR_Capability_SinkOffload: c_int = 8; + diff --git a/third_party/rust/x11/src/xrecord.rs b/third_party/rust/x11/src/xrecord.rs new file mode 100644 index 000000000000..2b6350942f49 --- /dev/null +++ b/third_party/rust/x11/src/xrecord.rs @@ -0,0 +1,137 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_int, + c_uchar, + c_ulong, + c_ushort, +}; + +use ::xlib::{ + Bool, + Display, + Time, + XID, +}; + + +// +// functions +// + + +x11_link! { Xf86vmode, xtst, ["libXtst.so.6", "libXtst.so"], 14, + pub fn XRecordAllocRange () -> *mut XRecordRange, + pub fn XRecordCreateContext (_6: *mut Display, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: *mut *mut XRecordRange, _1: c_int) -> c_ulong, + pub fn XRecordDisableContext (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XRecordEnableContext (_4: *mut Display, _3: c_ulong, _2: Option, _1: *mut c_char) -> c_int, + pub fn XRecordEnableContextAsync (_4: *mut Display, _3: c_ulong, _2: Option, _1: *mut c_char) -> c_int, + pub fn XRecordFreeContext (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XRecordFreeData (_1: *mut XRecordInterceptData) -> (), + pub fn XRecordFreeState (_1: *mut XRecordState) -> (), + pub fn XRecordGetContext (_3: *mut Display, _2: c_ulong, _1: *mut *mut XRecordState) -> c_int, + pub fn XRecordIdBaseMask (_1: *mut Display) -> c_ulong, + pub fn XRecordProcessReplies (_1: *mut Display) -> (), + pub fn XRecordQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XRecordRegisterClients (_7: *mut Display, _6: c_ulong, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: *mut *mut XRecordRange, _1: c_int) -> c_int, + pub fn XRecordUnregisterClients (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int, +variadic: +globals: +} + + +// +// constants +// + + +pub const XRecordFromServerTime: c_int = 0x01; +pub const XRecordFromClientTime: c_int = 0x02; +pub const XRecordFromClientSequence: c_int = 0x04; + +pub const XRecordCurrentClients: c_ulong = 1; +pub const XRecordFutureClients: c_ulong = 2; +pub const XRecordAllClients: c_ulong = 3; + +pub const XRecordFromServer: c_int = 0; +pub const XRecordFromClient: c_int = 1; +pub const XRecordClientStarted: c_int = 2; +pub const XRecordClientDied: c_int = 3; +pub const XRecordStartOfData: c_int = 4; +pub const XRecordEndOfData: c_int = 5; + + +// +// types +// + + +pub type XRecordClientSpec = c_ulong; +pub type XRecordContext = c_ulong; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRecordClientInfo { + pub client: XRecordClientSpec, + pub nranges: c_ulong, + pub ranges: *mut *mut XRecordRange, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRecordExtRange { + pub ext_major: XRecordRange8, + pub ext_minor: XRecordRange16, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRecordInterceptData { + pub id_base: XID, + pub server_time: Time, + pub client_seq: c_ulong, + pub category: c_int, + pub client_swapped: Bool, + pub data: *mut c_uchar, + pub data_len: c_ulong, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRecordRange { + pub core_requests: XRecordRange8, + pub core_replies: XRecordRange8, + pub ext_requests: XRecordExtRange, + pub ext_replies: XRecordExtRange, + pub delivered_events: XRecordRange8, + pub device_events: XRecordRange8, + pub errors: XRecordRange8, + pub client_started: Bool, + pub client_died: Bool, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRecordRange8 { + pub first: c_uchar, + pub last: c_uchar, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRecordRange16 { + pub first: c_ushort, + pub last: c_ushort, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRecordState { + pub enabled: Bool, + pub datum_flags: c_int, + pub nclients: c_ulong, + pub client_info: *mut *mut XRecordClientInfo, +} diff --git a/third_party/rust/x11/src/xrender.rs b/third_party/rust/x11/src/xrender.rs new file mode 100644 index 000000000000..1f819527bcdb --- /dev/null +++ b/third_party/rust/x11/src/xrender.rs @@ -0,0 +1,463 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_double, + c_int, + c_short, + c_uint, + c_ulong, + c_ushort, +}; + +use ::xlib::{ + Atom, + Bool, + Colormap, + Cursor, + Display, + Pixmap, + Region, + Visual, + XID, + XRectangle, +}; + + +// +// functions +// + + +x11_link! { Xrender, xrender, ["libXrender.so.1", "libXrender.so"], 44, + pub fn XRenderAddGlyphs (_7: *mut Display, _6: c_ulong, _5: *const c_ulong, _4: *const XGlyphInfo, _3: c_int, _2: *const c_char, _1: c_int) -> (), + pub fn XRenderAddTraps (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: *const XTrap, _1: c_int) -> (), + pub fn XRenderChangePicture (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: *const XRenderPictureAttributes) -> (), + pub fn XRenderComposite (_13: *mut Display, _12: c_int, _11: c_ulong, _10: c_ulong, _9: c_ulong, _8: c_int, _7: c_int, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (), + pub fn XRenderCompositeDoublePoly (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_int, _6: c_int, _5: c_int, _4: c_int, _3: *const XPointDouble, _2: c_int, _1: c_int) -> (), + pub fn XRenderCompositeString16 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_ushort, _1: c_int) -> (), + pub fn XRenderCompositeString32 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_uint, _1: c_int) -> (), + pub fn XRenderCompositeString8 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> (), + pub fn XRenderCompositeText16 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt16, _1: c_int) -> (), + pub fn XRenderCompositeText32 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt32, _1: c_int) -> (), + pub fn XRenderCompositeText8 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt8, _1: c_int) -> (), + pub fn XRenderCompositeTrapezoids (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XTrapezoid, _1: c_int) -> (), + pub fn XRenderCompositeTriangles (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XTriangle, _1: c_int) -> (), + pub fn XRenderCompositeTriFan (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XPointFixed, _1: c_int) -> (), + pub fn XRenderCompositeTriStrip (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XPointFixed, _1: c_int) -> (), + pub fn XRenderCreateAnimCursor (_3: *mut Display, _2: c_int, _1: *mut XAnimCursor) -> c_ulong, + pub fn XRenderCreateConicalGradient (_5: *mut Display, _4: *const XConicalGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong, + pub fn XRenderCreateCursor (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: c_uint) -> c_ulong, + pub fn XRenderCreateGlyphSet (_2: *mut Display, _1: *const XRenderPictFormat) -> c_ulong, + pub fn XRenderCreateLinearGradient (_5: *mut Display, _4: *const XLinearGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong, + pub fn XRenderCreatePicture (_5: *mut Display, _4: c_ulong, _3: *const XRenderPictFormat, _2: c_ulong, _1: *const XRenderPictureAttributes) -> c_ulong, + pub fn XRenderCreateRadialGradient (_5: *mut Display, _4: *const XRadialGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong, + pub fn XRenderCreateSolidFill (_2: *mut Display, _1: *const XRenderColor) -> c_ulong, + pub fn XRenderFillRectangle (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *const XRenderColor, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (), + pub fn XRenderFillRectangles (_6: *mut Display, _5: c_int, _4: c_ulong, _3: *const XRenderColor, _2: *const XRectangle, _1: c_int) -> (), + pub fn XRenderFindFormat (_4: *mut Display, _3: c_ulong, _2: *const XRenderPictFormat, _1: c_int) -> *mut XRenderPictFormat, + pub fn XRenderFindStandardFormat (_2: *mut Display, _1: c_int) -> *mut XRenderPictFormat, + pub fn XRenderFindVisualFormat (_2: *mut Display, _1: *const Visual) -> *mut XRenderPictFormat, + pub fn XRenderFreeGlyphs (_4: *mut Display, _3: c_ulong, _2: *const c_ulong, _1: c_int) -> (), + pub fn XRenderFreeGlyphSet (_2: *mut Display, _1: c_ulong) -> (), + pub fn XRenderFreePicture (_2: *mut Display, _1: c_ulong) -> (), + pub fn XRenderParseColor (_3: *mut Display, _2: *mut c_char, _1: *mut XRenderColor) -> c_int, + pub fn XRenderQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XRenderQueryFilters (_2: *mut Display, _1: c_ulong) -> *mut XFilters, + pub fn XRenderQueryFormats (_1: *mut Display) -> c_int, + pub fn XRenderQueryPictIndexValues (_3: *mut Display, _2: *const XRenderPictFormat, _1: *mut c_int) -> *mut XIndexValue, + pub fn XRenderQuerySubpixelOrder (_2: *mut Display, _1: c_int) -> c_int, + pub fn XRenderQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XRenderReferenceGlyphSet (_2: *mut Display, _1: c_ulong) -> c_ulong, + pub fn XRenderSetPictureClipRectangles (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: *const XRectangle, _1: c_int) -> (), + pub fn XRenderSetPictureClipRegion (_3: *mut Display, _2: c_ulong, _1: Region) -> (), + pub fn XRenderSetPictureFilter (_5: *mut Display, _4: c_ulong, _3: *const c_char, _2: *mut c_int, _1: c_int) -> (), + pub fn XRenderSetPictureTransform (_3: *mut Display, _2: c_ulong, _1: *mut XTransform) -> (), + pub fn XRenderSetSubpixelOrder (_3: *mut Display, _2: c_int, _1: c_int) -> c_int, +variadic: +globals: +} + + +// +// types +// + + +pub type Glyph = XID; +pub type GlyphSet = XID; +pub type PictFormat = XID; +pub type Picture = XID; +pub type XDouble = c_double; +pub type XFixed = c_int; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XAnimCursor { + pub cursor: Cursor, + pub delay: c_ulong, +} +pub type XAnimCursor = _XAnimCursor; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XCircle { + pub x: XFixed, + pub y: XFixed, + pub radius: XFixed, +} +pub type XCircle = _XCircle; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XConicalGradient { + pub center: XPointFixed, + pub angle: XFixed, +} +pub type XConicalGradient = _XConicalGradient; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XFilters { + pub nfilter: c_int, + pub filter: *mut *mut c_char, + pub nalias: c_int, + pub alias: *mut c_short, +} +pub type XFilters = _XFilters; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XGlyphElt8 { + pub glyphset: GlyphSet, + pub chars: *mut c_char, + pub nchars: c_int, + pub xOff: c_int, + pub yOff: c_int, +} +pub type XGlyphElt8 = _XGlyphElt8; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XGlyphElt16 { + pub glyphset: GlyphSet, + pub chars: *mut c_ushort, + pub nchars: c_int, + pub xOff: c_int, + pub yOff: c_int, +} +pub type XGlyphElt16 = _XGlyphElt16; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XGlyphElt32 { + pub glyphset: GlyphSet, + pub chars: *mut c_uint, + pub nchars: c_int, + pub xOff: c_int, + pub yOff: c_int, +} +pub type XGlyphElt32 = _XGlyphElt32; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XGlyphInfo { + pub width: c_ushort, + pub height: c_ushort, + pub x: c_short, + pub y: c_short, + pub xOff: c_short, + pub yOff: c_short, +} +pub type XGlyphInfo = _XGlyphInfo; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XIndexValue { + pub pixel: c_ulong, + pub red: c_ushort, + pub green: c_ushort, + pub blue: c_ushort, + pub alpha: c_ushort, +} +pub type XIndexValue = _XIndexValue; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XLinearGradient { + pub p1: XPointFixed, + pub p2: XPointFixed, +} +pub type XLinearGradient = _XLinearGradient; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XLineFixed { + pub p1: XPointFixed, + pub p2: XPointFixed, +} +pub type XLineFixed = _XLineFixed; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XPointDouble { + pub x: XDouble, + pub y: XDouble, +} +pub type XPointDouble = _XPointDouble; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XPointFixed { + pub x: XFixed, + pub y: XFixed, +} +pub type XPointFixed = _XPointFixed; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XRadialGradient { + pub inner: XCircle, + pub outer: XCircle, +} +pub type XRadialGradient = _XRadialGradient; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRenderColor { + pub red: c_ushort, + pub green: c_ushort, + pub blue: c_ushort, + pub alpha: c_ushort, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRenderDirectFormat { + pub red: c_short, + pub redMask: c_short, + pub green: c_short, + pub greenMask: c_short, + pub blue: c_short, + pub blueMask: c_short, + pub alpha: c_short, + pub alphaMask: c_short, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XRenderPictFormat { + pub id: PictFormat, + pub type_: c_int, + pub depth: c_int, + pub direct: XRenderDirectFormat, + pub colormap: Colormap, +} + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XRenderPictureAttributes { + pub repeat: c_int, + pub alpha_map: Picture, + pub alpha_x_origin: c_int, + pub alpha_y_origin: c_int, + pub clip_x_origin: c_int, + pub clip_y_origin: c_int, + pub clip_mask: Pixmap, + pub graphics_exposures: Bool, + pub subwindow_mode: c_int, + pub poly_edge: c_int, + pub poly_mode: c_int, + pub dither: Atom, + pub component_alpha: Bool, +} +pub type XRenderPictureAttributes = _XRenderPictureAttributes; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XSpanFix { + pub left: XFixed, + pub right: XFixed, + pub y: XFixed, +} +pub type XSpanFix = _XSpanFix; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XTrap { + pub top: XSpanFix, + pub bottom: XSpanFix, +} +pub type XTrap = _XTrap; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XTrapezoid { + pub top: XFixed, + pub bottom: XFixed, + pub left: XLineFixed, + pub right: XLineFixed, +} +pub type XTrapezoid = _XTrapezoid; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XTriangle { + pub p1: XPointFixed, + pub p2: XPointFixed, + pub p3: XPointFixed, +} +pub type XTriangle = _XTriangle; + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct _XTransform { + pub matrix: [[XFixed; 3]; 3], +} +pub type XTransform = _XTransform; + + +// +// constants +// + + +// pict format mask +pub const PictFormatID: c_ulong = 1 << 0; +pub const PictFormatType: c_ulong = 1 << 1; +pub const PictFormatDepth: c_ulong = 1 << 2; +pub const PictFormatRed: c_ulong = 1 << 3; +pub const PictFormatRedMask: c_ulong = 1 << 4; +pub const PictFormatGreen: c_ulong = 1 << 5; +pub const PictFormatGreenMask: c_ulong = 1 << 6; +pub const PictFormatBlue: c_ulong = 1 << 7; +pub const PictFormatBlueMask: c_ulong = 1 << 8; +pub const PictFormatAlpha: c_ulong = 1 << 9; +pub const PictFormatAlphaMask: c_ulong = 1 << 10; +pub const PictFormatColormap: c_ulong = 1 << 11; + +// error codes +pub const BadPictFormat: c_int = 0; +pub const BadPicture: c_int = 1; +pub const BadPictOp: c_int = 2; +pub const BadGlyphSet: c_int = 3; +pub const BadGlyph: c_int = 4; +pub const RenderNumberErrors: c_int = BadGlyph + 1; + +// pict types +pub const PictTypeIndexed: c_int = 0; +pub const PictTypeDirect: c_int = 1; + +// ops +pub const PictOpMinimum: c_int = 0; +pub const PictOpClear: c_int = 0; +pub const PictOpSrc: c_int = 1; +pub const PictOpDst: c_int = 2; +pub const PictOpOver: c_int = 3; +pub const PictOpOverReverse: c_int = 4; +pub const PictOpIn: c_int = 5; +pub const PictOpInReverse: c_int = 6; +pub const PictOpOut: c_int = 7; +pub const PictOpOutReverse: c_int = 8; +pub const PictOpAtop: c_int = 9; +pub const PictOpAtopReverse: c_int = 10; +pub const PictOpXor: c_int = 11; +pub const PictOpAdd: c_int = 12; +pub const PictOpSaturate: c_int = 13; +pub const PictOpMaximum: c_int = 13; + +pub const PictOpDisjointMinimum: c_int = 0x10; +pub const PictOpDisjointClear: c_int = 0x10; +pub const PictOpDisjointSrc: c_int = 0x11; +pub const PictOpDisjointDst: c_int = 0x12; +pub const PictOpDisjointOver: c_int = 0x13; +pub const PictOpDisjointOverReverse: c_int = 0x14; +pub const PictOpDisjointIn: c_int = 0x15; +pub const PictOpDisjointInReverse: c_int = 0x16; +pub const PictOpDisjointOut: c_int = 0x17; +pub const PictOpDisjointOutReverse: c_int = 0x18; +pub const PictOpDisjointAtop: c_int = 0x19; +pub const PictOpDisjointAtopReverse: c_int = 0x1a; +pub const PictOpDisjointXor: c_int = 0x1b; +pub const PictOpDisjointMaximum: c_int = 0x1b; + +pub const PictOpConjointMinimum: c_int = 0x20; +pub const PictOpConjointClear: c_int = 0x20; +pub const PictOpConjointSrc: c_int = 0x21; +pub const PictOpConjointDst: c_int = 0x22; +pub const PictOpConjointOver: c_int = 0x23; +pub const PictOpConjointOverReverse: c_int = 0x24; +pub const PictOpConjointIn: c_int = 0x25; +pub const PictOpConjointInReverse: c_int = 0x26; +pub const PictOpConjointOut: c_int = 0x27; +pub const PictOpConjointOutReverse: c_int = 0x28; +pub const PictOpConjointAtop: c_int = 0x29; +pub const PictOpConjointAtopReverse: c_int = 0x2a; +pub const PictOpConjointXor: c_int = 0x2b; +pub const PictOpConjointMaximum: c_int = 0x2b; + +pub const PictOpBlendMinimum: c_int = 0x30; +pub const PictOpMultiply: c_int = 0x30; +pub const PictOpScreen: c_int = 0x31; +pub const PictOpOverlay: c_int = 0x32; +pub const PictOpDarken: c_int = 0x33; +pub const PictOpLighten: c_int = 0x34; +pub const PictOpColorDodge: c_int = 0x35; +pub const PictOpColorBurn: c_int = 0x36; +pub const PictOpHardLight: c_int = 0x37; +pub const PictOpSoftLight: c_int = 0x38; +pub const PictOpDifference: c_int = 0x39; +pub const PictOpExclusion: c_int = 0x3a; +pub const PictOpHSLHue: c_int = 0x3b; +pub const PictOpHSLSaturation: c_int = 0x3c; +pub const PictOpHSLColor: c_int = 0x3d; +pub const PictOpHSLLuminosity: c_int = 0x3e; +pub const PictOpBlendMaximum: c_int = 0x3e; + +// poly edge types +pub const PolyEdgeSharp: c_int = 0; +pub const PolyEdgeSmooth: c_int = 1; + +// poly modes +pub const PolyModePrecise: c_int = 0; +pub const PolyModeImprecise: c_int = 1; + +// picture attributes mask +pub const CPRepeat: c_int = 1 << 0; +pub const CPAlphaMap: c_int = 1 << 1; +pub const CPAlphaXOrigin: c_int = 1 << 2; +pub const CPAlphaYOrigin: c_int = 1 << 3; +pub const CPClipXOrigin: c_int = 1 << 4; +pub const CPClipYOrigin: c_int = 1 << 5; +pub const CPClipMask: c_int = 1 << 6; +pub const CPGraphicsExposure: c_int = 1 << 7; +pub const CPSubwindowMode: c_int = 1 << 8; +pub const CPPolyEdge: c_int = 1 << 9; +pub const CPPolyMode: c_int = 1 << 10; +pub const CPDither: c_int = 1 << 11; +pub const CPComponentAlpha: c_int = 1 << 12; +pub const CPLastBit: c_int = 12; + +// filter methods +pub const FilterNearest: &'static str = "nearest"; +pub const FilterBilinear: &'static str = "bilinear"; +pub const FilterConvolution: &'static str = "convolution"; +pub const FilterFast: &'static str = "fast"; +pub const FilterGood: &'static str = "good"; +pub const FilterBest: &'static str = "best"; + +// subpixel orders +pub const SubPixelUnknown: c_int = 0; +pub const SubPixelHorizontalRGB: c_int = 1; +pub const SubPixelHorizontalBGR: c_int = 2; +pub const SubPixelVerticalRGB: c_int = 3; +pub const SubPixelVerticalBGR: c_int = 4; +pub const SubPixelNone: c_int = 5; + +// repeat attributes +pub const RepeatNone: c_int = 0; +pub const RepeatNormal: c_int = 1; +pub const RepeatPad: c_int = 2; +pub const RepeatReflect: c_int = 3; diff --git a/third_party/rust/x11/src/xss.rs b/third_party/rust/x11/src/xss.rs new file mode 100644 index 000000000000..4aaae613d9b6 --- /dev/null +++ b/third_party/rust/x11/src/xss.rs @@ -0,0 +1,100 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ c_int, c_uint, c_ulong }; +use std::mem; + +use ::internal::transmute_union; +use xlib::{ Atom, Bool, Display, Drawable, Status, Time, Visual, XEvent, XID, XSetWindowAttributes, Window }; + + +// +// functions +// + + +x11_link! { Xss, xscrnsaver, ["libXss.so.2", "libXss.so"], 11, + pub fn XScreenSaverQueryExtension (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Bool, + pub fn XScreenSaverQueryVersion (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Status, + pub fn XScreenSaverAllocInfo () -> *mut XScreenSaverInfo, + pub fn XScreenSaverQueryInfo (_1: *mut Display, _2: Drawable, _3: *mut XScreenSaverInfo) -> Status, + pub fn XScreenSaverSelectInput (_1: *mut Display, _2: Drawable, _3: c_ulong) -> (), + pub fn XScreenSaverSetAttributes (_1: *mut Display, _2: Drawable, _3: c_int, _4: c_int, _5: c_uint, _6: c_uint, _7: c_uint, _8: c_int, _9: c_uint, _10: *mut Visual, _11: c_ulong, _12: *mut XSetWindowAttributes) -> (), + pub fn XScreenSaverUnsetAttributes (_1: *mut Display, _2: Drawable) -> (), + pub fn XScreenSaverRegister (_1: *mut Display, _2: c_int, _3: XID, _4: Atom) -> Status, + pub fn XScreenSaverUnregister (_1: *mut Display, _2: c_int) -> Status, + pub fn XScreenSaverGetRegistered (_1: *mut Display, _2: c_int, _3: *mut XID, _4: *mut Atom) -> Status, + pub fn XScreenSaverSuspend (_1: *mut Display, _2: Bool) -> (), +variadic: +globals: +} + + +// +// types +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XScreenSaverInfo { + pub window: Window, + pub state: c_int, + pub kind: c_int, + pub til_or_since: c_ulong, + pub idle: c_ulong, + pub eventMask: c_ulong, +} + + +// +// event structures +// + + +#[derive(Clone, Copy, PartialEq)] +#[repr(C)] +pub struct XScreenSaverNotifyEvent { + pub type_: c_int, + pub serial: c_ulong, + pub send_event: Bool, + pub display: *mut Display, + pub window: Window, + pub root: Window, + pub state: c_int, + pub kind: c_int, + pub forced: Bool, + pub time: Time, +} + +event_conversions_and_tests! { + XScreenSaverNotifyEvent, +} + + +// +// constants +// + + +pub const ScreenSaverName: &'static str = "MIT-SCREEN-SAVER"; +pub const ScreenSaverPropertyName: &'static str = "_MIT_SCREEN_SAVER_ID"; + +pub const ScreenSaverNotifyMask: c_ulong = 0x00000001; +pub const ScreenSaverCycleMask: c_ulong = 0x00000002; + +pub const ScreenSaverMajorVersion: c_int = 1; +pub const ScreenSaverMinorVersion: c_int = 1; + +pub const ScreenSaverOff: c_int = 0; +pub const ScreenSaverOn: c_int = 1; +pub const ScreenSaverCycle: c_int = 2; +pub const ScreenSaverDisabled: c_int = 3; + +pub const ScreenSaverBlanked: c_int = 0; +pub const ScreenSaverInternal: c_int = 1; +pub const ScreenSaverExternal: c_int = 2; + +pub const ScreenSaverNotify: c_int = 0; +pub const ScreenSaverNumberEvents: c_int = 1; diff --git a/third_party/rust/x11/src/xt.rs b/third_party/rust/x11/src/xt.rs new file mode 100644 index 000000000000..afecdd060e26 --- /dev/null +++ b/third_party/rust/x11/src/xt.rs @@ -0,0 +1,398 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_char, + c_int, + c_long, + c_short, + c_uchar, + c_uint, + c_ulong, + c_ushort, + c_void, +}; + +use ::xlib::{ + Display, + GC, + Region, + Screen, + Visual, + XEvent, + XGCValues, + _XrmHashBucketRec, + XrmOptionDescList, + XrmValue, + XSelectionRequestEvent, + XSetWindowAttributes, +}; + + +// +// functions +// + + +x11_link! { Xt, xt, ["libXt.so.6", "libXt.so"], 300, + pub fn XtAddActions (_2: *mut XtActionsRec, _1: c_uint) -> (), + pub fn XtAddCallback (_4: Widget, _3: *const c_char, _2: Option, _1: *mut c_void) -> (), + pub fn XtAddCallbacks (_3: Widget, _2: *const c_char, _1: XtCallbackList) -> (), + pub fn XtAddConverter (_5: *const c_char, _4: *const c_char, _3: Option, _2: XtConvertArgList, _1: c_uint) -> (), + pub fn XtAddEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option, _1: *mut c_void) -> (), + pub fn XtAddExposureToRegion (_2: *mut XEvent, _1: Region) -> (), + pub fn XtAddGrab (_3: Widget, _2: c_char, _1: c_char) -> (), + pub fn XtAddInput (_4: c_int, _3: *mut c_void, _2: Option, _1: *mut c_void) -> c_ulong, + pub fn XtAddRawEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option, _1: *mut c_void) -> (), + pub fn XtAddSignal (_2: Option, _1: *mut c_void) -> c_ulong, + pub fn XtAddTimeOut (_3: c_ulong, _2: Option, _1: *mut c_void) -> c_ulong, + pub fn XtAddWorkProc (_2: Option c_char>, _1: *mut c_void) -> c_ulong, + pub fn XtAllocateGC (_6: Widget, _5: c_uint, _4: c_ulong, _3: *mut XGCValues, _2: c_ulong, _1: c_ulong) -> GC, + pub fn XtAppAddActionHook (_3: XtAppContext, _2: Option, _1: *mut c_void) -> *mut c_void, + pub fn XtAppAddActions (_3: XtAppContext, _2: *mut XtActionsRec, _1: c_uint) -> (), + pub fn XtAppAddBlockHook (_3: XtAppContext, _2: Option, _1: *mut c_void) -> c_ulong, + pub fn XtAppAddConverter (_6: XtAppContext, _5: *const c_char, _4: *const c_char, _3: Option, _2: XtConvertArgList, _1: c_uint) -> (), + pub fn XtAppAddInput (_5: XtAppContext, _4: c_int, _3: *mut c_void, _2: Option, _1: *mut c_void) -> c_ulong, + pub fn XtAppAddSignal (_3: XtAppContext, _2: Option, _1: *mut c_void) -> c_ulong, + pub fn XtAppAddTimeOut (_4: XtAppContext, _3: c_ulong, _2: Option, _1: *mut c_void) -> c_ulong, + pub fn XtAppAddWorkProc (_3: XtAppContext, _2: Option c_char>, _1: *mut c_void) -> c_ulong, + pub fn XtAppCreateShell (_6: *const c_char, _5: *const c_char, _4: WidgetClass, _3: *mut Display, _2: *mut Arg, _1: c_uint) -> Widget, + pub fn XtAppError (_2: XtAppContext, _1: *const c_char) -> (), + pub fn XtAppErrorMsg (_7: XtAppContext, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (), + pub fn XtAppGetErrorDatabase (_1: XtAppContext) -> *mut *mut _XrmHashBucketRec, + pub fn XtAppGetErrorDatabaseText (_8: XtAppContext, _7: *const c_char, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *mut c_char, _2: c_int, _1: *mut _XrmHashBucketRec) -> (), + pub fn XtAppGetExitFlag (_1: XtAppContext) -> c_char, + pub fn XtAppGetSelectionTimeout (_1: XtAppContext) -> c_ulong, + pub fn XtAppInitialize (_9: *mut XtAppContext, _8: *const c_char, _7: XrmOptionDescList, _6: c_uint, _5: *mut c_int, _4: *mut *mut c_char, _3: *mut *mut c_char, _2: *mut Arg, _1: c_uint) -> Widget, + pub fn XtAppLock (_1: XtAppContext) -> (), + pub fn XtAppMainLoop (_1: XtAppContext) -> (), + pub fn XtAppNextEvent (_2: XtAppContext, _1: *mut XEvent) -> (), + pub fn XtAppPeekEvent (_2: XtAppContext, _1: *mut XEvent) -> c_char, + pub fn XtAppPending (_1: XtAppContext) -> c_ulong, + pub fn XtAppProcessEvent (_2: XtAppContext, _1: c_ulong) -> (), + pub fn XtAppReleaseCacheRefs (_2: XtAppContext, _1: *mut *mut c_void) -> (), + pub fn XtAppSetErrorHandler (_2: XtAppContext, _1: Option) -> Option, + pub fn XtAppSetErrorMsgHandler (_2: XtAppContext, _1: Option) -> Option, + pub fn XtAppSetExitFlag (_1: XtAppContext) -> (), + pub fn XtAppSetFallbackResources (_2: XtAppContext, _1: *mut *mut c_char) -> (), + pub fn XtAppSetSelectionTimeout (_2: XtAppContext, _1: c_ulong) -> (), + pub fn XtAppSetTypeConverter (_8: XtAppContext, _7: *const c_char, _6: *const c_char, _5: Option c_char>, _4: XtConvertArgList, _3: c_uint, _2: c_int, _1: Option) -> (), + pub fn XtAppSetWarningHandler (_2: XtAppContext, _1: Option) -> Option, + pub fn XtAppSetWarningMsgHandler (_2: XtAppContext, _1: Option) -> Option, + pub fn XtAppUnlock (_1: XtAppContext) -> (), + pub fn XtAppWarning (_2: XtAppContext, _1: *const c_char) -> (), + pub fn XtAppWarningMsg (_7: XtAppContext, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (), + pub fn XtAugmentTranslations (_2: Widget, _1: *mut _TranslationData) -> (), + pub fn XtBuildEventMask (_1: Widget) -> c_ulong, + pub fn XtCallAcceptFocus (_2: Widget, _1: *mut c_ulong) -> c_char, + pub fn XtCallActionProc (_5: Widget, _4: *const c_char, _3: *mut XEvent, _2: *mut *mut c_char, _1: c_uint) -> (), + pub fn XtCallbackExclusive (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (), + pub fn XtCallbackNone (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (), + pub fn XtCallbackNonexclusive (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (), + pub fn XtCallbackPopdown (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (), + pub fn XtCallbackReleaseCacheRef (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (), + pub fn XtCallbackReleaseCacheRefList (_3: Widget, _2: *mut c_void, _1: *mut c_void) -> (), + pub fn XtCallCallbackList (_3: Widget, _2: XtCallbackList, _1: *mut c_void) -> (), + pub fn XtCallCallbacks (_3: Widget, _2: *const c_char, _1: *mut c_void) -> (), + pub fn XtCallConverter (_7: *mut Display, _6: Option c_char>, _5: *mut XrmValue, _4: c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCalloc (_2: c_uint, _1: c_uint) -> *mut c_char, + pub fn XtCancelSelectionRequest (_2: Widget, _1: c_ulong) -> (), + pub fn XtChangeManagedSet (_6: *mut Widget, _5: c_uint, _4: Option, _3: *mut c_void, _2: *mut Widget, _1: c_uint) -> (), + pub fn XtClass (_1: Widget) -> WidgetClass, + pub fn XtCloseDisplay (_1: *mut Display) -> (), + pub fn XtConfigureWidget (_6: Widget, _5: c_short, _4: c_short, _3: c_ushort, _2: c_ushort, _1: c_ushort) -> (), + pub fn XtConvert (_5: Widget, _4: *const c_char, _3: *mut XrmValue, _2: *const c_char, _1: *mut XrmValue) -> (), + pub fn XtConvertAndStore (_5: Widget, _4: *const c_char, _3: *mut XrmValue, _2: *const c_char, _1: *mut XrmValue) -> c_char, + pub fn XtConvertCase (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: *mut c_ulong) -> (), + pub fn XtCreateApplicationContext () -> XtAppContext, + pub fn XtCreateApplicationShell (_4: *const c_char, _3: WidgetClass, _2: *mut Arg, _1: c_uint) -> Widget, + pub fn XtCreateManagedWidget (_5: *const c_char, _4: WidgetClass, _3: Widget, _2: *mut Arg, _1: c_uint) -> Widget, + pub fn XtCreatePopupShell (_5: *const c_char, _4: WidgetClass, _3: Widget, _2: *mut Arg, _1: c_uint) -> Widget, + pub fn XtCreateSelectionRequest (_2: Widget, _1: c_ulong) -> (), + pub fn XtCreateWidget (_5: *const c_char, _4: WidgetClass, _3: Widget, _2: *mut Arg, _1: c_uint) -> Widget, + pub fn XtCreateWindow (_5: Widget, _4: c_uint, _3: *mut Visual, _2: c_ulong, _1: *mut XSetWindowAttributes) -> (), + pub fn XtCvtColorToPixel (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToBool (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToBoolean (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToColor (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToFloat (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToFont (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToPixel (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToPixmap (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToShort (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtIntToUnsignedChar (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToAcceleratorTable (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToAtom (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToBool (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToBoolean (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToCommandArgArray (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToCursor (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToDimension (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToDirectoryString (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToDisplay (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToFile (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToFloat (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToFont (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToFontSet (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToFontStruct (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToGravity (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToInitialState (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToInt (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToPixel (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToRestartStyle (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToShort (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToTranslationTable (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToUnsignedChar (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtCvtStringToVisual (_6: *mut Display, _5: *mut XrmValue, _4: *mut c_uint, _3: *mut XrmValue, _2: *mut XrmValue, _1: *mut *mut c_void) -> c_char, + pub fn XtDatabase (_1: *mut Display) -> *mut _XrmHashBucketRec, + pub fn XtDestroyApplicationContext (_1: XtAppContext) -> (), + pub fn XtDestroyGC (_1: GC) -> (), + pub fn XtDestroyWidget (_1: Widget) -> (), + pub fn XtDirectConvert (_5: Option, _4: *mut XrmValue, _3: c_uint, _2: *mut XrmValue, _1: *mut XrmValue) -> (), + pub fn XtDisownSelection (_3: Widget, _2: c_ulong, _1: c_ulong) -> (), + pub fn XtDispatchEvent (_1: *mut XEvent) -> c_char, + pub fn XtDispatchEventToWidget (_2: Widget, _1: *mut XEvent) -> c_char, + pub fn XtDisplay (_1: Widget) -> *mut Display, + pub fn XtDisplayInitialize (_8: XtAppContext, _7: *mut Display, _6: *const c_char, _5: *const c_char, _4: XrmOptionDescList, _3: c_uint, _2: *mut c_int, _1: *mut *mut c_char) -> (), + pub fn XtDisplayOfObject (_1: Widget) -> *mut Display, + pub fn XtDisplayStringConversionWarning (_3: *mut Display, _2: *const c_char, _1: *const c_char) -> (), + pub fn XtDisplayToApplicationContext (_1: *mut Display) -> XtAppContext, + pub fn XtError (_1: *const c_char) -> (), + pub fn XtErrorMsg (_6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (), + pub fn XtFindFile (_4: *const c_char, _3: Substitution, _2: c_uint, _1: Option c_char>) -> *mut c_char, + pub fn XtFree (_1: *mut c_char) -> (), + pub fn XtGetActionKeysym (_2: *mut XEvent, _1: *mut c_uint) -> c_ulong, + pub fn XtGetActionList (_3: WidgetClass, _2: *mut *mut XtActionsRec, _1: *mut c_uint) -> (), + pub fn XtGetApplicationNameAndClass (_3: *mut Display, _2: *mut *mut c_char, _1: *mut *mut c_char) -> (), + pub fn XtGetApplicationResources (_6: Widget, _5: *mut c_void, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (), + pub fn XtGetClassExtension (_5: WidgetClass, _4: c_uint, _3: c_int, _2: c_long, _1: c_uint) -> *mut c_void, + pub fn XtGetConstraintResourceList (_3: WidgetClass, _2: *mut *mut XtResource, _1: *mut c_uint) -> (), + pub fn XtGetDisplays (_3: XtAppContext, _2: *mut *mut *mut Display, _1: *mut c_uint) -> (), + pub fn XtGetErrorDatabase () -> *mut *mut _XrmHashBucketRec, + pub fn XtGetErrorDatabaseText (_6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut c_char, _1: c_int) -> (), + pub fn XtGetGC (_3: Widget, _2: c_ulong, _1: *mut XGCValues) -> GC, + pub fn XtGetKeyboardFocusWidget (_1: Widget) -> Widget, + pub fn XtGetKeysymTable (_3: *mut Display, _2: *mut c_uchar, _1: *mut c_int) -> *mut c_ulong, + pub fn XtGetMultiClickTime (_1: *mut Display) -> c_int, + pub fn XtGetResourceList (_3: WidgetClass, _2: *mut *mut XtResource, _1: *mut c_uint) -> (), + pub fn XtGetSelectionParameters (_7: Widget, _6: c_ulong, _5: *mut c_void, _4: *mut c_ulong, _3: *mut *mut c_void, _2: *mut c_ulong, _1: *mut c_int) -> (), + pub fn XtGetSelectionRequest (_3: Widget, _2: c_ulong, _1: *mut c_void) -> *mut XSelectionRequestEvent, + pub fn XtGetSelectionTimeout () -> c_ulong, + pub fn XtGetSelectionValue (_6: Widget, _5: c_ulong, _4: c_ulong, _3: Option, _2: *mut c_void, _1: c_ulong) -> (), + pub fn XtGetSelectionValueIncremental (_6: Widget, _5: c_ulong, _4: c_ulong, _3: Option, _2: *mut c_void, _1: c_ulong) -> (), + pub fn XtGetSelectionValues (_7: Widget, _6: c_ulong, _5: *mut c_ulong, _4: c_int, _3: Option, _2: *mut *mut c_void, _1: c_ulong) -> (), + pub fn XtGetSelectionValuesIncremental (_7: Widget, _6: c_ulong, _5: *mut c_ulong, _4: c_int, _3: Option, _2: *mut *mut c_void, _1: c_ulong) -> (), + pub fn XtGetSubresources (_8: Widget, _7: *mut c_void, _6: *const c_char, _5: *const c_char, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (), + pub fn XtGetSubvalues (_5: *mut c_void, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (), + pub fn XtGetValues (_3: Widget, _2: *mut Arg, _1: c_uint) -> (), + pub fn XtGrabButton (_9: Widget, _8: c_int, _7: c_uint, _6: c_char, _5: c_uint, _4: c_int, _3: c_int, _2: c_ulong, _1: c_ulong) -> (), + pub fn XtGrabKey (_6: Widget, _5: c_uchar, _4: c_uint, _3: c_char, _2: c_int, _1: c_int) -> (), + pub fn XtGrabKeyboard (_5: Widget, _4: c_char, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XtGrabPointer (_8: Widget, _7: c_char, _6: c_uint, _5: c_int, _4: c_int, _3: c_ulong, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XtHasCallbacks (_2: Widget, _1: *const c_char) -> XtCallbackStatus, + pub fn XtHooksOfDisplay (_1: *mut Display) -> Widget, + pub fn XtInitialize (_6: *const c_char, _5: *const c_char, _4: XrmOptionDescList, _3: c_uint, _2: *mut c_int, _1: *mut *mut c_char) -> Widget, + pub fn XtInitializeWidgetClass (_1: WidgetClass) -> (), + pub fn XtInsertEventHandler (_6: Widget, _5: c_ulong, _4: c_char, _3: Option, _2: *mut c_void, _1: XtListPosition) -> (), + pub fn XtInsertEventTypeHandler (_6: Widget, _5: c_int, _4: *mut c_void, _3: Option, _2: *mut c_void, _1: XtListPosition) -> (), + pub fn XtInsertRawEventHandler (_6: Widget, _5: c_ulong, _4: c_char, _3: Option, _2: *mut c_void, _1: XtListPosition) -> (), + pub fn XtInstallAccelerators (_2: Widget, _1: Widget) -> (), + pub fn XtInstallAllAccelerators (_2: Widget, _1: Widget) -> (), + pub fn XtIsApplicationShell (_1: Widget) -> c_char, + pub fn XtIsComposite (_1: Widget) -> c_char, + pub fn XtIsConstraint (_1: Widget) -> c_char, + pub fn XtIsManaged (_1: Widget) -> c_char, + pub fn XtIsObject (_1: Widget) -> c_char, + pub fn XtIsOverrideShell (_1: Widget) -> c_char, + pub fn XtIsRealized (_1: Widget) -> c_char, + pub fn XtIsRectObj (_1: Widget) -> c_char, + pub fn XtIsSensitive (_1: Widget) -> c_char, + pub fn XtIsSessionShell (_1: Widget) -> c_char, + pub fn XtIsShell (_1: Widget) -> c_char, + pub fn XtIsSubclass (_2: Widget, _1: WidgetClass) -> c_char, + pub fn XtIsTopLevelShell (_1: Widget) -> c_char, + pub fn XtIsTransientShell (_1: Widget) -> c_char, + pub fn XtIsVendorShell (_1: Widget) -> c_char, + pub fn XtIsWidget (_1: Widget) -> c_char, + pub fn XtIsWMShell (_1: Widget) -> c_char, + pub fn XtKeysymToKeycodeList (_4: *mut Display, _3: c_ulong, _2: *mut *mut c_uchar, _1: *mut c_uint) -> (), + pub fn XtLastEventProcessed (_1: *mut Display) -> *mut XEvent, + pub fn XtLastTimestampProcessed (_1: *mut Display) -> c_ulong, + pub fn XtMainLoop () -> (), + pub fn XtMakeGeometryRequest (_3: Widget, _2: *mut XtWidgetGeometry, _1: *mut XtWidgetGeometry) -> XtGeometryResult, + pub fn XtMakeResizeRequest (_5: Widget, _4: c_ushort, _3: c_ushort, _2: *mut c_ushort, _1: *mut c_ushort) -> XtGeometryResult, + pub fn XtMalloc (_1: c_uint) -> *mut c_char, + pub fn XtManageChild (_1: Widget) -> (), + pub fn XtManageChildren (_2: *mut Widget, _1: c_uint) -> (), + pub fn XtMapWidget (_1: Widget) -> (), + pub fn XtMenuPopupAction (_4: Widget, _3: *mut XEvent, _2: *mut *mut c_char, _1: *mut c_uint) -> (), + pub fn XtMergeArgLists (_4: *mut Arg, _3: c_uint, _2: *mut Arg, _1: c_uint) -> *mut Arg, + pub fn XtMoveWidget (_3: Widget, _2: c_short, _1: c_short) -> (), + pub fn XtName (_1: Widget) -> *mut c_char, + pub fn XtNameToWidget (_2: Widget, _1: *const c_char) -> Widget, + pub fn XtNewString (_1: *mut c_char) -> *mut c_char, + pub fn XtNextEvent (_1: *mut XEvent) -> (), + pub fn XtNoticeSignal (_1: c_ulong) -> (), + pub fn XtOpenApplication (_10: *mut XtAppContext, _9: *const c_char, _8: XrmOptionDescList, _7: c_uint, _6: *mut c_int, _5: *mut *mut c_char, _4: *mut *mut c_char, _3: WidgetClass, _2: *mut Arg, _1: c_uint) -> Widget, + pub fn XtOpenDisplay (_8: XtAppContext, _7: *const c_char, _6: *const c_char, _5: *const c_char, _4: XrmOptionDescList, _3: c_uint, _2: *mut c_int, _1: *mut *mut c_char) -> *mut Display, + pub fn XtOverrideTranslations (_2: Widget, _1: *mut _TranslationData) -> (), + pub fn XtOwnSelection (_6: Widget, _5: c_ulong, _4: c_ulong, _3: Option c_char>, _2: Option, _1: Option) -> c_char, + pub fn XtOwnSelectionIncremental (_8: Widget, _7: c_ulong, _6: c_ulong, _5: Option c_char>, _4: Option, _3: Option, _2: Option, _1: *mut c_void) -> c_char, + pub fn XtParent (_1: Widget) -> Widget, + pub fn XtParseAcceleratorTable (_1: *const c_char) -> *mut _TranslationData, + pub fn XtParseTranslationTable (_1: *const c_char) -> *mut _TranslationData, + pub fn XtPeekEvent (_1: *mut XEvent) -> c_char, + pub fn XtPending () -> c_char, + pub fn XtPopdown (_1: Widget) -> (), + pub fn XtPopup (_2: Widget, _1: XtGrabKind) -> (), + pub fn XtPopupSpringLoaded (_1: Widget) -> (), + pub fn XtProcessEvent (_1: c_ulong) -> (), + pub fn XtProcessLock () -> (), + pub fn XtProcessUnlock () -> (), + pub fn XtQueryGeometry (_3: Widget, _2: *mut XtWidgetGeometry, _1: *mut XtWidgetGeometry) -> XtGeometryResult, + pub fn XtRealizeWidget (_1: Widget) -> (), + pub fn XtRealloc (_2: *mut c_char, _1: c_uint) -> *mut c_char, + pub fn XtRegisterCaseConverter (_4: *mut Display, _3: Option, _2: c_ulong, _1: c_ulong) -> (), + pub fn XtRegisterDrawable (_3: *mut Display, _2: c_ulong, _1: Widget) -> (), + pub fn XtRegisterExtensionSelector (_5: *mut Display, _4: c_int, _3: c_int, _2: Option, _1: *mut c_void) -> (), + pub fn XtRegisterGrabAction (_5: Option, _4: c_char, _3: c_uint, _2: c_int, _1: c_int) -> (), + pub fn XtReleaseGC (_2: Widget, _1: GC) -> (), + pub fn XtReleasePropertyAtom (_2: Widget, _1: c_ulong) -> (), + pub fn XtRemoveActionHook (_1: *mut c_void) -> (), + pub fn XtRemoveAllCallbacks (_2: Widget, _1: *const c_char) -> (), + pub fn XtRemoveBlockHook (_1: c_ulong) -> (), + pub fn XtRemoveCallback (_4: Widget, _3: *const c_char, _2: Option, _1: *mut c_void) -> (), + pub fn XtRemoveCallbacks (_3: Widget, _2: *const c_char, _1: XtCallbackList) -> (), + pub fn XtRemoveEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option, _1: *mut c_void) -> (), + pub fn XtRemoveEventTypeHandler (_5: Widget, _4: c_int, _3: *mut c_void, _2: Option, _1: *mut c_void) -> (), + pub fn XtRemoveGrab (_1: Widget) -> (), + pub fn XtRemoveInput (_1: c_ulong) -> (), + pub fn XtRemoveRawEventHandler (_5: Widget, _4: c_ulong, _3: c_char, _2: Option, _1: *mut c_void) -> (), + pub fn XtRemoveSignal (_1: c_ulong) -> (), + pub fn XtRemoveTimeOut (_1: c_ulong) -> (), + pub fn XtRemoveWorkProc (_1: c_ulong) -> (), + pub fn XtReservePropertyAtom (_1: Widget) -> c_ulong, + pub fn XtResizeWidget (_4: Widget, _3: c_ushort, _2: c_ushort, _1: c_ushort) -> (), + pub fn XtResizeWindow (_1: Widget) -> (), + pub fn XtResolvePathname (_8: *mut Display, _7: *const c_char, _6: *const c_char, _5: *const c_char, _4: *const c_char, _3: Substitution, _2: c_uint, _1: Option c_char>) -> *mut c_char, + pub fn XtScreen (_1: Widget) -> *mut Screen, + pub fn XtScreenDatabase (_1: *mut Screen) -> *mut _XrmHashBucketRec, + pub fn XtScreenOfObject (_1: Widget) -> *mut Screen, + pub fn XtSendSelectionRequest (_3: Widget, _2: c_ulong, _1: c_ulong) -> (), + pub fn XtSessionGetToken (_1: Widget) -> XtCheckpointToken, + pub fn XtSessionReturnToken (_1: XtCheckpointToken) -> (), + pub fn XtSetErrorHandler (_1: Option) -> (), + pub fn XtSetErrorMsgHandler (_1: Option) -> (), + pub fn XtSetEventDispatcher (_3: *mut Display, _2: c_int, _1: Option c_char>) -> Option c_char>, + pub fn XtSetKeyboardFocus (_2: Widget, _1: Widget) -> (), + pub fn XtSetKeyTranslator (_2: *mut Display, _1: Option) -> (), + pub fn XtSetLanguageProc (_3: XtAppContext, _2: Option *mut c_char>, _1: *mut c_void) -> Option *mut c_char>, + pub fn XtSetMappedWhenManaged (_2: Widget, _1: c_char) -> (), + pub fn XtSetMultiClickTime (_2: *mut Display, _1: c_int) -> (), + pub fn XtSetSelectionParameters (_6: Widget, _5: c_ulong, _4: c_ulong, _3: *mut c_void, _2: c_ulong, _1: c_int) -> (), + pub fn XtSetSelectionTimeout (_1: c_ulong) -> (), + pub fn XtSetSensitive (_2: Widget, _1: c_char) -> (), + pub fn XtSetSubvalues (_5: *mut c_void, _4: *mut XtResource, _3: c_uint, _2: *mut Arg, _1: c_uint) -> (), + pub fn XtSetTypeConverter (_7: *const c_char, _6: *const c_char, _5: Option c_char>, _4: XtConvertArgList, _3: c_uint, _2: c_int, _1: Option) -> (), + pub fn XtSetValues (_3: Widget, _2: *mut Arg, _1: c_uint) -> (), + pub fn XtSetWarningHandler (_1: Option) -> (), + pub fn XtSetWarningMsgHandler (_1: Option) -> (), + pub fn XtSetWMColormapWindows (_3: Widget, _2: *mut Widget, _1: c_uint) -> (), + pub fn XtStringConversionWarning (_2: *const c_char, _1: *const c_char) -> (), + pub fn XtSuperclass (_1: Widget) -> WidgetClass, + pub fn XtToolkitInitialize () -> (), + pub fn XtToolkitThreadInitialize () -> c_char, + pub fn XtTranslateCoords (_5: Widget, _4: c_short, _3: c_short, _2: *mut c_short, _1: *mut c_short) -> (), + pub fn XtTranslateKey (_5: *mut Display, _4: c_uchar, _3: c_uint, _2: *mut c_uint, _1: *mut c_ulong) -> (), + pub fn XtTranslateKeycode (_5: *mut Display, _4: c_uchar, _3: c_uint, _2: *mut c_uint, _1: *mut c_ulong) -> (), + pub fn XtUngrabButton (_3: Widget, _2: c_uint, _1: c_uint) -> (), + pub fn XtUngrabKey (_3: Widget, _2: c_uchar, _1: c_uint) -> (), + pub fn XtUngrabKeyboard (_2: Widget, _1: c_ulong) -> (), + pub fn XtUngrabPointer (_2: Widget, _1: c_ulong) -> (), + pub fn XtUninstallTranslations (_1: Widget) -> (), + pub fn XtUnmanageChild (_1: Widget) -> (), + pub fn XtUnmanageChildren (_2: *mut Widget, _1: c_uint) -> (), + pub fn XtUnmapWidget (_1: Widget) -> (), + pub fn XtUnrealizeWidget (_1: Widget) -> (), + pub fn XtUnregisterDrawable (_2: *mut Display, _1: c_ulong) -> (), + pub fn XtWarning (_1: *const c_char) -> (), + pub fn XtWarningMsg (_6: *const c_char, _5: *const c_char, _4: *const c_char, _3: *const c_char, _2: *mut *mut c_char, _1: *mut c_uint) -> (), + pub fn XtWidgetToApplicationContext (_1: Widget) -> XtAppContext, + pub fn XtWindow (_1: Widget) -> c_ulong, + pub fn XtWindowOfObject (_1: Widget) -> c_ulong, + pub fn XtWindowToWidget (_2: *mut Display, _1: c_ulong) -> Widget, +variadic: + pub fn XtAsprintf (_2: *mut *mut c_char, _1: *const c_char) -> c_uint, + pub fn XtVaAppCreateShell (_4: *const c_char, _3: *const c_char, _2: WidgetClass, _1: *mut Display) -> Widget, + pub fn XtVaAppInitialize (_7: *mut XtAppContext, _6: *const c_char, _5: XrmOptionDescList, _4: c_uint, _3: *mut c_int, _2: *mut *mut c_char, _1: *mut *mut c_char) -> Widget, + pub fn XtVaCreateArgsList (_1: *mut c_void) -> *mut c_void, + pub fn XtVaCreateManagedWidget (_3: *const c_char, _2: WidgetClass, _1: Widget) -> Widget, + pub fn XtVaCreatePopupShell (_3: *const c_char, _2: WidgetClass, _1: Widget) -> Widget, + pub fn XtVaCreateWidget (_3: *const c_char, _2: WidgetClass, _1: Widget) -> Widget, + pub fn XtVaGetApplicationResources (_4: Widget, _3: *mut c_void, _2: *mut XtResource, _1: c_uint) -> (), + pub fn XtVaGetSubresources (_6: Widget, _5: *mut c_void, _4: *const c_char, _3: *const c_char, _2: *mut XtResource, _1: c_uint) -> (), + pub fn XtVaGetSubvalues (_3: *mut c_void, _2: *mut XtResource, _1: c_uint) -> (), + pub fn XtVaGetValues (_1: Widget) -> (), + pub fn XtVaOpenApplication (_8: *mut XtAppContext, _7: *const c_char, _6: XrmOptionDescList, _5: c_uint, _4: *mut c_int, _3: *mut *mut c_char, _2: *mut *mut c_char, _1: WidgetClass) -> Widget, + pub fn XtVaSetSubvalues (_3: *mut c_void, _2: *mut XtResource, _1: c_uint) -> (), + pub fn XtVaSetValues (_1: Widget) -> (), +globals: +} + + +// +// types +// + + +// TODO structs +#[repr(C)] pub struct Arg; +#[repr(C)] pub struct SubstitutionRec; +#[repr(C)] pub struct _TranslationData; +#[repr(C)] pub struct _WidgetClassRec; +#[repr(C)] pub struct _WidgetRec; +#[repr(C)] pub struct _XtActionsRec; +#[repr(C)] pub struct _XtAppStruct; +#[repr(C)] pub struct _XtCallbackRec; +#[repr(C)] pub struct _XtCheckpointTokenRec; +#[repr(C)] pub struct XtConvertArgRec; +#[repr(C)] pub struct _XtResource; +#[repr(C)] pub struct XtWidgetGeometry; + +// C enums +pub type XtCallbackStatus = c_int; +pub type XtGeometryResult = c_int; +pub type XtGrabKind = c_int; +pub type XtListPosition = c_int; + +#[allow(dead_code)] +#[cfg(test)] +#[repr(C)] +enum TestEnum { + Variant1, + Variant2, +} + +#[test] +fn enum_size_test () { + assert!(::std::mem::size_of::() == ::std::mem::size_of::()); +} + +// struct typedefs +pub type ArgList = *mut Arg; +pub type Substitution = *mut SubstitutionRec; +pub type Widget = *mut _WidgetRec; +pub type WidgetClass = *mut _WidgetClassRec; +pub type XtAccelerators = *mut _TranslationData; +pub type XtActionList = *mut _XtActionsRec; +pub type XtActionsRec = _XtActionsRec; +pub type XtAppContext = *mut _XtAppStruct; +pub type XtCallbackList = *mut _XtCallbackRec; +pub type XtCallbackRec = _XtCallbackRec; +pub type XtCheckpointToken = *mut _XtCheckpointTokenRec; +pub type XtCheckpointTokenRec = _XtCheckpointTokenRec; +pub type XtConvertArgList = *mut XtConvertArgRec; +pub type XtResource = _XtResource; +pub type XtResourceList = *mut _XtResource; +pub type XtTranslations = *mut _TranslationData; diff --git a/third_party/rust/x11/src/xtest.rs b/third_party/rust/x11/src/xtest.rs new file mode 100644 index 000000000000..62cb7fb3d83e --- /dev/null +++ b/third_party/rust/x11/src/xtest.rs @@ -0,0 +1,42 @@ +// x11-rs: Rust bindings for X11 libraries +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_int, + c_uint, + c_ulong, +}; + +use ::xinput::XDevice; +use ::xlib::{ + Display, + GC, + Visual, +}; + + +// +// functions +// + + +x11_link! { Xf86vmode, xtst, ["libXtst.so.6", "libXtst.so"], 15, + pub fn XTestCompareCurrentCursorWithWindow (_2: *mut Display, _1: c_ulong) -> c_int, + pub fn XTestCompareCursorWithWindow (_3: *mut Display, _2: c_ulong, _1: c_ulong) -> c_int, + pub fn XTestDiscard (_1: *mut Display) -> c_int, + pub fn XTestFakeButtonEvent (_4: *mut Display, _3: c_uint, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestFakeDeviceButtonEvent (_7: *mut Display, _6: *mut XDevice, _5: c_uint, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestFakeDeviceKeyEvent (_7: *mut Display, _6: *mut XDevice, _5: c_uint, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestFakeDeviceMotionEvent (_7: *mut Display, _6: *mut XDevice, _5: c_int, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestFakeKeyEvent (_4: *mut Display, _3: c_uint, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestFakeMotionEvent (_5: *mut Display, _4: c_int, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestFakeProximityEvent (_6: *mut Display, _5: *mut XDevice, _4: c_int, _3: *mut c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestFakeRelativeMotionEvent (_4: *mut Display, _3: c_int, _2: c_int, _1: c_ulong) -> c_int, + pub fn XTestGrabControl (_2: *mut Display, _1: c_int) -> c_int, + pub fn XTestQueryExtension (_5: *mut Display, _4: *mut c_int, _3: *mut c_int, _2: *mut c_int, _1: *mut c_int) -> c_int, + pub fn XTestSetGContextOfGC (_2: GC, _1: c_ulong) -> (), + pub fn XTestSetVisualIDOfVisual (_2: *mut Visual, _1: c_ulong) -> (), +variadic: +globals: +} diff --git a/third_party/rust/xml-rs/.cargo-checksum.json b/third_party/rust/xml-rs/.cargo-checksum.json new file mode 100644 index 000000000000..a24a9f553242 --- /dev/null +++ b/third_party/rust/xml-rs/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"0f25ac489651219e162a46535b18af914e56c5422e6329fa3a29d66e8fba8ab8",".travis.yml":"8a46e15f0e861b76f8a600c6b9adf56c7b0de7ce388da6e92d4f34a955536250","Cargo.toml":"7665fd0fd7f60b51ffb02df075dc93bae3f705aaa2d214047f3aca567fdeac66","Changelog.md":"14f57c5a12dc3b2c5dbcc4ef872727e29a8d45aeac52c06cb40f1078455067e1","LICENSE":"0dc18d924dc0a5f41172a393012843a5eaaef338e795b3645da9cc3b6068220b","Readme.md":"3d10a7efeca32d9e7ce2bb2197724632e67a6d2f5ebbfb8e65886c67b6d235f6","design.md":"59eb3e89c9fe3e2c9e7dfd464ddceb56d8bb0fac7459d5b12d3f304487fdfcde","src/analyze.rs":"6fc06790088cc19e2e9c8be9d4d3337fe31f741cf7d5850f4b2dc3522c3b2609","src/attribute.rs":"76ddf747765a461058d6781639161f8b4c10eee630cb0163c8ab205b39f5a673","src/common.rs":"68e13ff6f620681936fb6ca4b7384948729615fea4c9c620551988c874ef3a70","src/escape.rs":"2582d12bff3ef96a0f70a21070e0cf6cbc868fadd7cc0c2b04101f2b02058fcf","src/lib.rs":"8ba36810d8508359279d5241b6ae51dc33e2372e2edc2422fe61e9a992f46fca","src/macros.rs":"8c7f9c18083fceb4af9e27a84d9130888829250c869771cb192eec19941988e0","src/name.rs":"f19eb4cc8c5fb41d84fff9f1b1c3fbb95007ab6c088807272920c022baa8f229","src/namespace.rs":"c3da1668a50bfdf98affdbb8f2126273ebbf73bacde474a5ec5be80f6915957b","src/reader/config.rs":"424c3af8dd6a39ed2af3d1d1e9ecb3ee14b97f1ec42d0fe8821f3ca4c3ade072","src/reader/error.rs":"bf6a889e9464f0b981ad5b761af46b53fed203b917265eaa0c439d5937a313f4","src/reader/events.rs":"4a07a3173f2613f6ea5b7880467152238a20de59dda42c95008d50ef80c9c3ed","src/reader/lexer.rs":"bdec8b9eaa56a0e40d7bf9bf08fc0c664f1fc0d4b79354d9a0c62c78eb5c608f","src/reader/mod.rs":"7418e7da232e164817f01185a4b2306b8b069d9a2a181bbf13daa2d54e2cf0fb","src/reader/parser/inside_cdata.rs":"7217ab332a7e29f8a2282d1bfd4d493465e0d6921e0f9f077634fdcedac331c9","src/reader/parser/inside_closing_tag_name.rs":"595d7888180da8a5ed2003da215be3b8b6521ee0624080b18af4eb3f4a2a6901","src/reader/parser/inside_comment.rs":"1f6b077007422562be7793df0a1d7ace3b2d2afd134e621045cd6650088a438d","src/reader/parser/inside_declaration.rs":"ea00f620e0d2d4fe9024796c80a2b325db2a651fb12467a18ea00f280d83ac48","src/reader/parser/inside_doctype.rs":"c87d1e36aea80ca8443a1a59d5cf2ee32d899c04ccbe38492ce3d02536f8fffd","src/reader/parser/inside_opening_tag.rs":"55c49634886ba41f23ac5f7a8e14f5cb02befb4bf9ea6943b4cc2c31a5569d28","src/reader/parser/inside_processing_instruction.rs":"e9cc8c1f8dd8bb065465659533cf7730d53206a88b06f7385544ccaf54e80368","src/reader/parser/inside_reference.rs":"280ed34b1cad2ebb8534e8cf7455baedb95c0058dcd1f104b528545e7b7d4400","src/reader/parser/mod.rs":"875ea87a59b47dc8d4c07289efc69fe9d19019cd9d0d32a1266955d06f5ef12e","src/reader/parser/outside_tag.rs":"77071f46398a04201e2a0e7ab0ff905165728d6e33e7eb6cc6ba56f772da2947","src/util.rs":"576d7db4550c2c38eb77af6545aebc42dcbe5a81eef190d472202d3ddcd7c97c","src/writer/config.rs":"3aaf615b13862e6daae943d27de05118524bb0d8d9444b1e4f245815696a6fea","src/writer/emitter.rs":"454d6845c6ea0d4ace1c97df1ba180bda0df3e32761a37ea72300c9912ef2147","src/writer/events.rs":"42e3ba410dfecc9e54766e278755761fec16e537774d08e0d5f3dfab90d57e31","src/writer/mod.rs":"81ecabbe31eefd8047e3d55bc8ac2703401807cd2683f31b9155f85dfa6ebaa3","tests/documents/sample_1.xml":"79c9ba2d71d70906230905cef127ba8c09ae8701c60357d32cf581dbfc660237","tests/documents/sample_1_full.txt":"efc646390dd6693c4122bb4a7d0c77e31bba7fda0e5767aa1de501bddc64174f","tests/documents/sample_1_short.txt":"83ef8cca29ac8e4b20dc9aea182155ad39d090fb08b76b6abe581801211b10e4","tests/documents/sample_2.xml":"c8350272a8c205e4004fc7e10be1660a0e10d2c9dbf044395d52ad2ca08fa03a","tests/documents/sample_2_full.txt":"21a7b53ddfb8eeaf73d0f6d7a1f96b1af3188129d69f6a5fd4d21e6376f2fb7f","tests/documents/sample_2_short.txt":"b94bc0600a84acf0999775d19c5a7169d24f88c74cc605a1f30b981181bacfeb","tests/documents/sample_3.xml":"a29359438fe9ca025f09d62d4b96f51a89d4be9e634767a5bb447d555c75aef8","tests/documents/sample_3_full.txt":"3522aa83d2b0e942e963d234af0b3426ad3c08141d60ccacc18077c67e2b2194","tests/documents/sample_3_short.txt":"57a8cc41ec6fcebf854126b3c9bb933a1de8be6c5b62372e857906314bb8f13f","tests/documents/sample_4.xml":"7c0ae3ee71a9c94afe1a35480a8c3bf58ffe90b754bccf42f83784971584e9b8","tests/documents/sample_4_full.txt":"f4f2419b336b04af9746ee12ac908a9b82cebca8fc280ad5422d0ab5483ee817","tests/documents/sample_4_short.txt":"39e1b7947fc33276347031e12a0a3f0e5a70eee9e743aba7d5c45b08a454cfae","tests/event_reader.rs":"44810728dd1e4436053d266ed88910d0d48770139c3fc3da95bd7a3ddac22bf9","tests/event_writer.rs":"18b019f7c013064510f72d0f9d42cbe9db296bed0cb7f40c01d4db997f1364bd"},"package":"f2b15eed12692bd59d15e98ee7f8dc8408465b992d8ddb4d1672c24865132ec7"} \ No newline at end of file diff --git a/third_party/rust/xml-rs/.cargo-ok b/third_party/rust/xml-rs/.cargo-ok new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/rust/xml-rs/.gitignore b/third_party/rust/xml-rs/.gitignore new file mode 100644 index 000000000000..60b0232d6e6f --- /dev/null +++ b/third_party/rust/xml-rs/.gitignore @@ -0,0 +1,8 @@ +*.swp +*.swo +/doc +*~ +/target/ +/Cargo.lock +.idea/ +*.iml \ No newline at end of file diff --git a/third_party/rust/xml-rs/.travis.yml b/third_party/rust/xml-rs/.travis.yml new file mode 100644 index 000000000000..ad4154898d7a --- /dev/null +++ b/third_party/rust/xml-rs/.travis.yml @@ -0,0 +1,28 @@ +notifications: + email: + recipients: + - dpx.infinity@gmail.com + +language: rust +sudo: false + +rust: + - nightly + - beta + - stable + +before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH + +script: + - | + travis-cargo build && + travis-cargo test && + travis-cargo --only beta doc + +after_success: + - travis-cargo --only beta doc-upload + +env: + global: + - TRAVIS_CARGO_NIGHTLY_FEATURE="" diff --git a/third_party/rust/xml-rs/Cargo.toml b/third_party/rust/xml-rs/Cargo.toml new file mode 100644 index 000000000000..07047134e82b --- /dev/null +++ b/third_party/rust/xml-rs/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "xml-rs" +version = "0.3.5" +authors = ["Vladimir Matveev "] +license = "MIT" +description = "An XML library in pure Rust" +repository = "https://github.com/netvl/xml-rs" +documentation = "http://netvl.github.io/xml-rs/" +readme = "Readme.md" +keywords = ["xml", "parsing", "parser"] + +[lib] +name = "xml" +path = "src/lib.rs" + +[[bin]] +name = "xml-analyze" +path = "src/analyze.rs" + +[dependencies] +bitflags = ">=0.5, <0.8" diff --git a/third_party/rust/xml-rs/Changelog.md b/third_party/rust/xml-rs/Changelog.md new file mode 100644 index 000000000000..805c698c832b --- /dev/null +++ b/third_party/rust/xml-rs/Changelog.md @@ -0,0 +1,43 @@ +## Version 0.3.5 + +* Added `Debug` implementation for `XmlVersion` +* Fixed some failing tests + +## Version 0.3.3 + +* Updated `bitflags` to 0.7. + +## Version 0.3.2 + +* Added `From` for `xml::reader::Error`, which improves usability of working with parsing errors. + +## Version 0.3.1 + +* Bumped `bitflags` dependency to 0.4, some internal warning fixes. + +## Version 0.3.0 + +* Changed error handling in `EventReader` - now I/O errors are properly bubbled up from the lexer. + +## Version 0.2.4 + +* Fixed #112 - incorrect handling of namespace redefinitions when writing a document. + +## Version 0.2.3 + +* Added `into_inner()` methods to `EventReader` and `EventWriter`. + +## Version 0.2.2 + +* Using `join` instead of the deprecated `connect`. +* Added a simple XML analyzer program which demonstrates library usage and can be used to check XML documents for well-formedness. +* Fixed incorrect handling of unqualified attribute names (#107). +* Added this changelog. + +## Version 0.2.1 + +* Fixed #105 - incorrect handling of double dashes. + +## Version 0.2.0 + +* Major update, includes proper document writing support and significant architecture changes. diff --git a/third_party/rust/xml-rs/LICENSE b/third_party/rust/xml-rs/LICENSE new file mode 100644 index 000000000000..6caa1d3e7821 --- /dev/null +++ b/third_party/rust/xml-rs/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Vladimir Matveev + +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. diff --git a/third_party/rust/xml-rs/Readme.md b/third_party/rust/xml-rs/Readme.md new file mode 100644 index 000000000000..61b94002c940 --- /dev/null +++ b/third_party/rust/xml-rs/Readme.md @@ -0,0 +1,236 @@ +xml-rs, an XML library for Rust +=============================== + +[![Build Status][build-status-img]](https://travis-ci.org/netvl/xml-rs) +[![crates.io][crates-io-img]](https://crates.io/crates/xml-rs) +[![docs][docs-img]](https://netvl.github.io/xml-rs/) + +[Documentation](https://netvl.github.io/xml-rs/) + + [build-status-img]: https://img.shields.io/travis/netvl/xml-rs.svg?style=flat-square + [crates-io-img]: https://img.shields.io/crates/v/xml-rs.svg?style=flat-square + [docs-img]: https://img.shields.io/badge/docs-rust_beta-6495ed.svg?style=flat-square + +xml-rs is an XML library for [Rust](http://www.rust-lang.org/) programming language. +It is heavily inspired by Java [Streaming API for XML (StAX)][stax]. + + [stax]: https://en.wikipedia.org/wiki/StAX + +This library currently contains pull parser much like [StAX event reader][stax-reader]. +It provides iterator API, so you can leverage Rust's existing iterators library features. + + [stax-reader]: http://docs.oracle.com/javase/8/docs/api/javax/xml/stream/XMLEventReader.html + +It also provides a streaming document writer much like [StAX event writer][stax-writer]. +This writer consumes its own set of events, but reader events can be converted to +writer events easily, and so it is possible to write XML transformation chains in a pretty +clean manner. + + [stax-writer]: http://docs.oracle.com/javase/8/docs/api/javax/xml/stream/XMLEventWriter.html + +This parser is mostly full-featured, however, there are limitations: +* no other encodings but UTF-8 are supported yet, because no stream-based encoding library + is available now; when (or if) one will be available, I'll try to make use of it; +* DTD validation is not supported, `` declarations are completely ignored; thus no + support for custom entities too; internal DTD declarations are likely to cause parsing errors; +* attribute value normalization is not performed, and end-of-line characters are not normalized too. + +Other than that the parser tries to be mostly XML-1.0-compliant. + +Writer is also mostly full-featured with the following limitations: +* no support for encodings other than UTF-8, for the same reason as above; +* no support for emitting `` declarations; +* more validations of input are needed, for example, checking that namespace prefixes are bounded + or comments are well-formed. + +What is planned (highest priority first, approximately): + +0. missing features required by XML standard (e.g. aforementioned normalization and + proper DTD parsing); +1. miscellaneous features of the writer; +2. parsing into a DOM tree and its serialization back to XML text; +3. SAX-like callback-based parser (fairly easy to implement over pull parser); +4. DTD validation; +5. (let's dream a bit) XML Schema validation. + +Building and using +------------------ + +xml-rs uses [Cargo](http://crates.io), so just add a dependency section in your project's manifest: + +```toml +[dependencies] +xml-rs = "0.3" +``` + +The package exposes a single crate called `xml`: + +```rust +extern crate xml; +``` + +Reading XML documents +--------------------- + +`xml::reader::EventReader` requires a `Read` instance to read from. When a proper stream-based encoding +library is available, it is likely that xml-rs will be switched to use whatever character stream structure +this library would provide, but currently it is a `Read`. + +Using `EventReader` is very straightforward. Just provide a `Read` instance to obtain an iterator +over events: + +```rust +extern crate xml; + +use std::fs::File; +use std::io::BufReader; + +use xml::reader::{EventReader, XmlEvent}; + +fn indent(size: usize) -> String { + const INDENT: &'static str = " "; + (0..size).map(|_| INDENT) + .fold(String::with_capacity(size*INDENT.len()), |r, s| r + s) +} + +fn main() { + let file = File::open("file.xml").unwrap(); + let file = BufReader::new(file); + + let parser = EventReader::new(file); + let mut depth = 0; + for e in parser { + match e { + Ok(XmlEvent::StartElement { name, .. }) => { + println!("{}+{}", indent(depth), name); + depth += 1; + } + Ok(XmlEvent::EndElement { name }) => { + depth -= 1; + println!("{}-{}", indent(depth), name); + } + Err(e) => { + println!("Error: {}", e); + break; + } + _ => {} + } + } +} +``` + +`EventReader` implements `IntoIterator` trait, so you can just use it in a `for` loop directly. +Document parsing can end normally or with an error. Regardless of exact cause, the parsing +process will be stopped, and iterator will terminate normally. + +You can also have finer control over when to pull the next event from the parser using its own +`next()` method: + +```rust +match parser.next() { + ... +} +``` + +Upon the end of the document or an error the parser will remember that last event and will always +return it in the result of `next()` call afterwards. If iterator is used, then it will yield +error or end-of-document event once and will produce `None` afterwards. + +It is also possible to tweak parsing process a little using `xml::reader::ParserConfig` structure. +See its documentation for more information and examples. + +You can find a more extensive example of using `EventReader` in `src/analyze.rs`, which is a +small program (BTW, it is built with `cargo build` and can be run after that) which shows various +statistics about specified XML document. It can also be used to check for well-formedness of +XML documents - if a document is not well-formed, this program will exit with an error. + +Writing XML documents +--------------------- + +xml-rs also provides a streaming writer much like StAX event writer. With it you can write an +XML document to any `Write` implementor. + +```rust +extern crate xml; + +use std::fs::File; +use std::io::{self, Write}; + +use xml::writer::{EventWriter, EmitterConfig, XmlEvent, Result}; + +fn handle_event(w: &mut EventWriter, line: String) -> Result<()> { + let line = line.trim(); + let event: XmlEvent = if line.starts_with("+") && line.len() > 1 { + XmlEvent::start_element(&line[1..]).into() + } else if line.starts_with("-") { + XmlEvent::end_element().into() + } else { + XmlEvent::characters(&line).into() + }; + w.write(event) +} + +fn main() { + let mut file = File::create("output.xml").unwrap(); + + let mut input = io::stdin(); + let mut output = io::stdout(); + let mut writer = EmitterConfig::new().perform_indent(true).create_writer(&mut file); + loop { + print!("> "); output.flush().unwrap(); + let mut line = String::new(); + match input.read_line(&mut line) { + Ok(0) => break, + Ok(_) => match handle_event(&mut writer, line) { + Ok(_) => {} + Err(e) => panic!("Write error: {}", e) + }, + Err(e) => panic!("Input error: {}", e) + } + } +} +``` + +The code example above also demonstrates how to create a writer out of its configuration. +Similar thing also works with `EventReader`. + +The library provides an XML event building DSL which helps to construct complex events, +e.g. ones having namespace definitions. Some examples: + +```rust +// +XmlEvent::start_element("a:hello").attr("a:param", "value").ns("a", "urn:some:document") + +// +XmlEvent::start_element("hello").attr("b:config", "value").default_ns("urn:defaul:uri") + +// +XmlEvent::cdata("some unescaped text") +``` + +Of course, one can create `XmlEvent` enum variants directly instead of using the builder DSL. +There are more examples in `xml::writer::XmlEvent` documentation. + +The writer has multiple configuration options; see `EmitterConfig` documentation for more +information. + +Other things +------------ + +No performance tests or measurements are done. The implementation is rather naive, and no specific +optimizations are made. Hopefully the library is sufficiently fast to process documents of common size. +I intend to add benchmarks in future, but not until more important features are added. + +Known issues +------------ + +All known issues are present on GitHub issue tracker: . +Feel free to post any found problems there. + +License +------- + +This library is licensed under MIT license. + +--- +Copyright (C) Vladimir Matveev, 2014-2015 diff --git a/third_party/rust/xml-rs/design.md b/third_party/rust/xml-rs/design.md new file mode 100644 index 000000000000..da67c7b1d277 --- /dev/null +++ b/third_party/rust/xml-rs/design.md @@ -0,0 +1,37 @@ +# Reader + +Basic features: + * [x] Parsing XML 1.0 documents and returning a stream of events + - [ ] Support reading embedded DTD schemas + - [ ] Support for embedded entities + * [x] Support for namespaces and emitting namespace information in events + * [ ] \[maybe\] push-based wrapper + * Missing XML features + - [ ] Support for different encodings + - [ ] Attribute values normalization + - [ ] EOL characters normalization + +Advanced features: + * [ ] DTD schema validation + * [ ] XSD schema validation + +# Writer + +Basic features: + * [x] Writing basic XML 1.0 documents in UTF-8 + * [x] Writing XML 1.0 documents with namespace support + * [x] Support for writing elements with empty body as empty elements + * [x] Pretty-printed and compact output + * [ ] Writing XML document with embedded DTDs and DTD references + * Misc features: + - [ ] Support for different encodings + - [x] Support for writing CDATA as characters + - [ ] Checking events for invalid characters (e.g. `--` in comments) + - [ ] Check for namespaces more correctly, i.e. check both for prefix and namespace URI + - [ ] Support checking namespace prefix presence in the current namespace for events with prefix but without namespace + - [ ] Support checking namespace prefix for events with both prefix and namespace URI + +# Other + +DOM-based API: + * [ ] Basic support for DOM-based API diff --git a/third_party/rust/xml-rs/src/analyze.rs b/third_party/rust/xml-rs/src/analyze.rs new file mode 100644 index 000000000000..0a75298afde4 --- /dev/null +++ b/third_party/rust/xml-rs/src/analyze.rs @@ -0,0 +1,97 @@ +extern crate xml; + +use std::cmp; +use std::env; +use std::io::{self, Read, Write, BufReader}; +use std::fs::File; +use std::collections::HashSet; + +use xml::ParserConfig; +use xml::reader::XmlEvent; + +macro_rules! abort { + ($code:expr) => {::std::process::exit($code)}; + ($code:expr, $($args:tt)+) => {{ + writeln!(&mut ::std::io::stderr(), $($args)+).unwrap(); + ::std::process::exit($code); + }} +} + +fn main() { + let mut file; + let mut stdin; + let source: &mut Read = match env::args().nth(1) { + Some(file_name) => { + file = File::open(file_name) + .unwrap_or_else(|e| abort!(1, "Cannot open input file: {}", e)); + &mut file + } + None => { + stdin = io::stdin(); + &mut stdin + } + }; + + let reader = ParserConfig::new() + .whitespace_to_characters(true) + .ignore_comments(false) + .create_reader(BufReader::new(source)); + + let mut processing_instructions = 0; + let mut elements = 0; + let mut character_blocks = 0; + let mut cdata_blocks = 0; + let mut characters = 0; + let mut comment_blocks = 0; + let mut comment_characters = 0; + let mut namespaces = HashSet::new(); + let mut depth = 0; + let mut max_depth = 0; + + for e in reader { + match e { + Ok(e) => match e { + XmlEvent::StartDocument { version, encoding, standalone } => + println!( + "XML document version {}, encoded in {}, {}standalone", + version, encoding, if standalone.unwrap_or(false) { "" } else { "not " } + ), + XmlEvent::EndDocument => println!("Document finished"), + XmlEvent::ProcessingInstruction { .. } => processing_instructions += 1, + XmlEvent::Whitespace(_) => {} // can't happen due to configuration + XmlEvent::Characters(s) => { + character_blocks += 1; + characters += s.len(); + } + XmlEvent::CData(s) => { + cdata_blocks += 1; + characters += s.len(); + } + XmlEvent::Comment(s) => { + comment_blocks += 1; + comment_characters += s.len(); + } + XmlEvent::StartElement { namespace, .. } => { + depth += 1; + max_depth = cmp::max(max_depth, depth); + elements += 1; + namespaces.extend(namespace.0.into_iter().map(|(_, ns_uri)| ns_uri)); + } + XmlEvent::EndElement { .. } => { + depth -= 1; + } + }, + Err(e) => abort!(1, "Error parsing XML document: {}", e) + } + } + namespaces.remove(xml::namespace::NS_EMPTY_URI); + namespaces.remove(xml::namespace::NS_XMLNS_URI); + namespaces.remove(xml::namespace::NS_XML_URI); + + println!("Elements: {}, maximum depth: {}", elements, max_depth); + println!("Namespaces (excluding built-in): {}", namespaces.len()); + println!("Characters: {}, characters blocks: {}, CDATA blocks: {}", + characters, character_blocks, cdata_blocks); + println!("Comment blocks: {}, comment characters: {}", comment_blocks, comment_characters); + println!("Processing instructions (excluding built-in): {}", processing_instructions); +} diff --git a/third_party/rust/xml-rs/src/attribute.rs b/third_party/rust/xml-rs/src/attribute.rs new file mode 100644 index 000000000000..9af83b418262 --- /dev/null +++ b/third_party/rust/xml-rs/src/attribute.rs @@ -0,0 +1,102 @@ +//! Contains XML attributes manipulation types and functions. +//! + +use std::fmt; + +use name::{Name, OwnedName}; +use escape::escape_str_attribute; + +/// A borrowed version of an XML attribute. +/// +/// Consists of a borrowed qualified name and a borrowed string value. +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +pub struct Attribute<'a> { + /// Attribute name. + pub name: Name<'a>, + + /// Attribute value. + pub value: &'a str +} + +impl<'a> fmt::Display for Attribute<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}=\"{}\"", self.name, escape_str_attribute(self.value)) + } +} + +impl<'a> Attribute<'a> { + /// Creates an owned attribute out of this borrowed one. + #[inline] + pub fn to_owned(&self) -> OwnedAttribute { + OwnedAttribute { + name: self.name.into(), + value: self.value.into() + } + } + + /// Creates a borrowed attribute using the provided borrowed name and a borrowed string value. + #[inline] + pub fn new(name: Name<'a>, value: &'a str) -> Attribute<'a> { + Attribute { + name: name, + value: value + } + } +} + +/// An owned version of an XML attribute. +/// +/// Consists of an owned qualified name and an owned string value. +#[derive(Clone, Eq, PartialEq, Hash, Debug)] +pub struct OwnedAttribute { + /// Attribute name. + pub name: OwnedName, + + /// Attribute value. + pub value: String +} + +impl OwnedAttribute { + /// Returns a borrowed `Attribute` out of this owned one. + pub fn borrow(&self) -> Attribute { + Attribute { + name: self.name.borrow(), + value: &*self.value + } + } + + /// Creates a new owned attribute using the provided owned name and an owned string value. + #[inline] + pub fn new>(name: OwnedName, value: S) -> OwnedAttribute { + OwnedAttribute { + name: name, + value: value.into() + } + } +} + +impl fmt::Display for OwnedAttribute { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}=\"{}\"", self.name, escape_str_attribute(&*self.value)) + } +} + +#[cfg(test)] +mod tests { + use super::{Attribute}; + + use name::Name; + + #[test] + fn attribute_display() { + let attr = Attribute::new( + Name::qualified("attribute", "urn:namespace", Some("n")), + "its value with > & \" ' < weird symbols" + ); + + assert_eq!( + &*attr.to_string(), + "{urn:namespace}n:attribute=\"its value with > & " ' < weird symbols\"" + ) + } +} diff --git a/third_party/rust/xml-rs/src/common.rs b/third_party/rust/xml-rs/src/common.rs new file mode 100644 index 000000000000..9513925763dc --- /dev/null +++ b/third_party/rust/xml-rs/src/common.rs @@ -0,0 +1,135 @@ +//! Contains common types and functions used throughout the library. + +use std::fmt; + +/// Represents a position inside some textual document. +#[derive(Copy, Clone, PartialEq, Eq)] +pub struct TextPosition { + /// Row, counting from 0 + pub row: u64, + /// Column, counting from 0 + pub column: u64, +} + +impl TextPosition { + /// Creates a new position initialized to the beginning of the document + #[inline] + pub fn new() -> TextPosition { + TextPosition { row: 0, column: 0 } + } + + /// Advances the position in a line + #[inline] + pub fn advance(&mut self, count: u8) { + self.column += count as u64; + } + + /// Advances the position in a line to the next tab position + #[inline] + pub fn advance_to_tab(&mut self, width: u8) { + let width = width as u64; + self.column += width - self.column % width + } + + /// Advances the position to the beginning of the next line + #[inline] + pub fn new_line(&mut self) { + self.column = 0; + self.row += 1; + } +} + +impl fmt::Debug for TextPosition { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}:{}", self.row + 1, self.column + 1) + } +} + +impl fmt::Display for TextPosition { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}:{}", self.row + 1, self.column + 1) + } +} + +/// Get the position in the document corresponding to the object +/// +/// This trait is implemented by parsers, lexers and errors. +pub trait Position { + /// Returns the current position or a position corresponding to the object. + fn position(&self) -> TextPosition; +} + +impl Position for TextPosition { + #[inline] + fn position(&self) -> TextPosition { + *self + } +} + +/// XML version enumeration. +#[derive(Copy, Clone, PartialEq, Eq)] +pub enum XmlVersion { + /// XML version 1.0. + Version10, + + /// XML version 1.1. + Version11 +} + +impl fmt::Display for XmlVersion { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + XmlVersion::Version10 => write!(f, "1.0"), + XmlVersion::Version11 => write!(f, "1.1") + } + } +} + +impl fmt::Debug for XmlVersion { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self, f) + } +} + +/// Checks whether the given character is a white space character (`S`) +/// as is defined by XML 1.1 specification, [section 2.3][1]. +/// +/// [1]: http://www.w3.org/TR/2006/REC-xml11-20060816/#sec-common-syn +pub fn is_whitespace_char(c: char) -> bool { + match c { + '\x20' | '\x09' | '\x0d' | '\x0a' => true, + _ => false + } +} + +/// Checks whether the given character is a name start character (`NameStartChar`) +/// as is defined by XML 1.1 specification, [section 2.3][1]. +/// +/// [1]: http://www.w3.org/TR/2006/REC-xml11-20060816/#sec-common-syn +pub fn is_name_start_char(c: char) -> bool { + match c { + ':' | 'A'...'Z' | '_' | 'a'...'z' | + '\u{C0}'...'\u{D6}' | '\u{D8}'...'\u{F6}' | '\u{F8}'...'\u{2FF}' | + '\u{370}'...'\u{37D}' | '\u{37F}'...'\u{1FFF}' | + '\u{200C}'...'\u{200D}' | '\u{2070}'...'\u{218F}' | + '\u{2C00}'...'\u{2FEF}' | '\u{3001}'...'\u{D7FF}' | + '\u{F900}'...'\u{FDCF}' | '\u{FDF0}'...'\u{FFFD}' | + '\u{10000}'...'\u{EFFFF}' => true, + _ => false + } +} + +/// Checks whether the given character is a name character (`NameChar`) +/// as is defined by XML 1.1 specification, [section 2.3][1]. +/// +/// [1]: http://www.w3.org/TR/2006/REC-xml11-20060816/#sec-common-syn +pub fn is_name_char(c: char) -> bool { + match c { + _ if is_name_start_char(c) => true, + '-' | '.' | '0'...'9' | '\u{B7}' | + '\u{300}'...'\u{3F6}' | '\u{203F}'...'\u{2040}' => true, + _ => false + } +} diff --git a/third_party/rust/xml-rs/src/escape.rs b/third_party/rust/xml-rs/src/escape.rs new file mode 100644 index 000000000000..1418d6a56969 --- /dev/null +++ b/third_party/rust/xml-rs/src/escape.rs @@ -0,0 +1,112 @@ +//! Contains functions for performing XML special characters escaping. + +use std::borrow::Cow; + +use self::Value::{C, S}; +use self::Process::{B, O}; + +enum Value { + C(char), + S(&'static str) +} + +impl Value { + fn dispatch_for_attribute(c: char) -> Value { + match c { + '<' => S("<"), + '>' => S(">"), + '"' => S("""), + '\'' => S("'"), + '&' => S("&"), + _ => C(c) + } + } + + fn dispatch_for_pcdata(c: char) -> Value { + match c { + '<' => S("<"), + '&' => S("&"), + _ => C(c) + } + } +} + +enum Process<'a> { + B(&'a str), + O(String) +} + +impl<'a> Process<'a> { + fn process(&mut self, (i, next): (usize, Value)) { + match next { + S(s) => if let O(ref mut o) = *self { + o.push_str(s); + } else if let B(b) = *self { + let mut r = String::with_capacity(b.len() + s.len()); + r.push_str(&b[..i]); + r.push_str(s); + *self = O(r); + }, + C(c) => match *self { + B(_) => {} + O(ref mut o) => o.push(c) + } + } + } + + fn into_result(self) -> Cow<'a, str> { + match self { + B(b) => Cow::Borrowed(b), + O(o) => Cow::Owned(o) + } + } +} + +impl<'a> Extend for Process<'a> { + fn extend>(&mut self, it: I) { + for v in it.into_iter().enumerate() { + self.process(v); + } + } +} + +fn escape_str(s: &str, dispatch: fn(char) -> Value) -> Cow { + let mut p = B(s); + p.extend(s.chars().map(dispatch)); + p.into_result() +} + +/// Performs escaping of common XML characters inside an attribute value. +/// +/// This function replaces several important markup characters with their +/// entity equivalents: +/// +/// * `<` → `<` +/// * `>` → `>` +/// * `"` → `"` +/// * `'` → `'` +/// * `&` → `&` +/// +/// The resulting string is safe to use inside XML attribute values or in PCDATA sections. +/// +/// Does not perform allocations if the given string does not contain escapable characters. +#[inline] +pub fn escape_str_attribute(s: &str) -> Cow { + escape_str(s, Value::dispatch_for_attribute) +} + +/// Performs escaping of common XML characters inside PCDATA. +/// +/// This function replaces several important markup characters with their +/// entity equivalents: +/// +/// * `<` → `<` +/// * `&` → `&` +/// +/// The resulting string is safe to use inside PCDATA sections but NOT inside attribute values. +/// +/// Does not perform allocations if the given string does not contain escapable characters. +#[inline] +pub fn escape_str_pcdata(s: &str) -> Cow { + escape_str(s, Value::dispatch_for_pcdata) +} diff --git a/third_party/rust/xml-rs/src/lib.rs b/third_party/rust/xml-rs/src/lib.rs new file mode 100644 index 000000000000..dd31facf5687 --- /dev/null +++ b/third_party/rust/xml-rs/src/lib.rs @@ -0,0 +1,24 @@ +//#![warn(missing_doc)] +#![allow(dead_code)] +#![allow(unused_variables)] +#![forbid(non_camel_case_types)] + +//! This crate currently provides almost XML 1.0/1.1-compliant pull parser. + +#[macro_use] +extern crate bitflags; + +pub use reader::EventReader; +pub use reader::ParserConfig; +pub use writer::EventWriter; +pub use writer::EmitterConfig; + +pub mod macros; +pub mod name; +pub mod attribute; +pub mod common; +pub mod escape; +pub mod namespace; +pub mod reader; +pub mod writer; +mod util; diff --git a/third_party/rust/xml-rs/src/macros.rs b/third_party/rust/xml-rs/src/macros.rs new file mode 100644 index 000000000000..1cce3d6a5e2c --- /dev/null +++ b/third_party/rust/xml-rs/src/macros.rs @@ -0,0 +1,30 @@ +#![macro_use] + +//! Contains several macros used in this crate. + +macro_rules! gen_setter { + ($target:ty, $field:ident : into $t:ty) => { + impl $target { + /// Sets the field to the provided value and returns updated config object. + pub fn $field>(mut self, value: T) -> $target { + self.$field = value.into(); + self + } + } + }; + ($target:ty, $field:ident : val $t:ty) => { + impl $target { + /// Sets the field to the provided value and returns updated config object. + pub fn $field(mut self, value: $t) -> $target { + self.$field = value; + self + } + } + } +} + +macro_rules! gen_setters { + ($target:ty, $($field:ident : $k:tt $tpe:ty),+) => ($( + gen_setter! { $target, $field : $k $tpe } + )+) +} diff --git a/third_party/rust/xml-rs/src/name.rs b/third_party/rust/xml-rs/src/name.rs new file mode 100644 index 000000000000..3cb87bd6ac2b --- /dev/null +++ b/third_party/rust/xml-rs/src/name.rs @@ -0,0 +1,301 @@ +//! Contains XML qualified names manipulation types and functions. +//! + +use std::fmt; +use std::str::FromStr; + +use namespace::NS_NO_PREFIX; + +/// Represents a qualified XML name. +/// +/// A qualified name always consists at least of a local name. It can optionally contain +/// a prefix; when reading an XML document, if it contains a prefix, it must also contain a +/// namespace URI, but this is not enforced statically; see below. The name can contain a +/// namespace without a prefix; in that case a default, empty prefix is assumed. +/// +/// When writing XML documents, it is possible to omit the namespace URI, leaving only +/// the prefix. In this case the writer will check that the specifed prefix is bound to some +/// URI in the current namespace context. If both prefix and namespace URI are specified, +/// it is checked that the current namespace context contains this exact correspondence +/// between prefix and namespace URI. +/// +/// # Prefixes and URIs +/// +/// A qualified name with a prefix must always contain a proper namespace URI --- names with +/// a prefix but without a namespace associated with that prefix are meaningless. However, +/// it is impossible to obtain proper namespace URI by a prefix without a context, and such +/// context is only available when parsing a document (or it can be constructed manually +/// when writing a document). Tying a name to a context statically seems impractical. This +/// may change in future, though. +/// +/// # Conversions +/// +/// `Name` implements some `From` instances for conversion from strings and tuples. For example: +/// +/// ```rust +/// # use xml::name::Name; +/// let n1: Name = "p:some-name".into(); +/// let n2: Name = ("p", "some-name").into(); +/// +/// assert_eq!(n1, n2); +/// assert_eq!(n1.local_name, "some-name"); +/// assert_eq!(n1.prefix, Some("p")); +/// assert!(n1.namespace.is_none()); +/// ``` +/// +/// This is added to support easy specification of XML elements when writing XML documents. +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] +pub struct Name<'a> { + /// A local name, e.g. `string` in `xsi:string`. + pub local_name: &'a str, + + /// A namespace URI, e.g. `http://www.w3.org/2000/xmlns/`. + pub namespace: Option<&'a str>, + + /// A name prefix, e.g. `xsi` in `xsi:string`. + pub prefix: Option<&'a str> +} + +impl<'a> From<&'a str> for Name<'a> { + fn from(s: &'a str) -> Name<'a> { + let mut parts = s.splitn(2, ":").fuse(); + match (parts.next(), parts.next()) { + (Some(name), None) => Name::local(name), + (Some(prefix), Some(name)) => Name::prefixed(name, prefix), + _ => unreachable!() + } + } +} + +impl<'a> From<(&'a str, &'a str)> for Name<'a> { + fn from((prefix, name): (&'a str, &'a str)) -> Name<'a> { + Name::prefixed(name, prefix) + } +} + +impl<'a> fmt::Display for Name<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if let Some(namespace) = self.namespace { + try! { write!(f, "{{{}}}", namespace) } + } + + if let Some(prefix) = self.prefix { + try! { write!(f, "{}:", prefix) } + } + + write!(f, "{}", self.local_name) + } +} + +impl<'a> Name<'a> { + /// Returns an owned variant of the qualified name. + pub fn to_owned(&self) -> OwnedName { + OwnedName { + local_name: self.local_name.into(), + namespace: self.namespace.map(|s| s.into()), + prefix: self.prefix.map(|s| s.into()) + } + } + + /// Returns a new `Name` instance representing plain local name. + #[inline] + pub fn local(local_name: &str) -> Name { + Name { + local_name: local_name, + prefix: None, + namespace: None + } + } + + /// Returns a new `Name` instance with the given local name and prefix. + #[inline] + pub fn prefixed(local_name: &'a str, prefix: &'a str) -> Name<'a> { + Name { + local_name: local_name, + namespace: None, + prefix: Some(prefix) + } + } + + /// Returns a new `Name` instance representing a qualified name with or without a prefix and + /// with a namespace URI. + #[inline] + pub fn qualified(local_name: &'a str, namespace: &'a str, prefix: Option<&'a str>) -> Name<'a> { + Name { + local_name: local_name, + namespace: Some(namespace), + prefix: prefix, + } + } + + /// Returns a correct XML representation of this local name and prefix. + /// + /// This method is different from the autoimplemented `to_string()` because it does not + /// include namespace URI in the result. + pub fn to_repr(&self) -> String { + self.repr_display().to_string() + } + + /// Returns a structure which can be displayed with `std::fmt` machinery to obtain this + /// local name and prefix. + /// + /// This method is needed for efficiency purposes in order not to create unnecessary + /// allocations. + #[inline] + pub fn repr_display(&self) -> ReprDisplay { + ReprDisplay(self) + } + + /// Returns either a prefix of this name or `namespace::NS_NO_PREFIX` constant. + #[inline] + pub fn prefix_repr(&self) -> &str { + self.prefix.unwrap_or(NS_NO_PREFIX) + } +} + +/// A wrapper around `Name` whose `Display` implementation prints the wrapped name as it is +/// displayed in an XML document. +pub struct ReprDisplay<'a, 'b:'a>(&'a Name<'b>); + +impl<'a, 'b:'a> fmt::Display for ReprDisplay<'a, 'b> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.0.prefix { + Some(prefix) => write!(f, "{}:{}", prefix, self.0.local_name), + None => write!(f, "{}", self.0.local_name) + } + } +} + +/// An owned variant of `Name`. +/// +/// Everything about `Name` applies to this structure as well. +#[derive(Clone, PartialEq, Eq, Hash, Debug)] +pub struct OwnedName { + /// A local name, e.g. `string` in `xsi:string`. + pub local_name: String, + + /// A namespace URI, e.g. `http://www.w3.org/2000/xmlns/`. + pub namespace: Option, + + /// A name prefix, e.g. `xsi` in `xsi:string`. + pub prefix: Option, +} + +impl fmt::Display for OwnedName { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.borrow(), f) + } +} + +impl OwnedName { + /// Constructs a borrowed `Name` based on this owned name. + pub fn borrow(&self) -> Name { + Name { + local_name: &*self.local_name, + namespace: self.namespace.as_ref().map(|s| &**s), + prefix: self.prefix.as_ref().map(|s| &**s), + } + } + + /// Returns a new `OwnedName` instance representing a plain local name. + #[inline] + pub fn local(local_name: S) -> OwnedName where S: Into { + OwnedName { + local_name: local_name.into(), + namespace: None, + prefix: None, + } + } + + /// Returns a new `OwnedName` instance representing a qualified name with or without + /// a prefix and with a namespace URI. + #[inline] + pub fn qualified(local_name: S1, namespace: S2, prefix: Option) -> OwnedName + where S1: Into, S2: Into, S3: Into + { + OwnedName { + local_name: local_name.into(), + namespace: Some(namespace.into()), + prefix: prefix.map(|v| v.into()) + } + } + + /// Returns an optional prefix by reference, equivalent to `self.borrow().prefix` + /// but avoids extra work. + #[inline] + pub fn prefix_ref(&self) -> Option<&str> { + self.prefix.as_ref().map(|s| &**s) + } + + /// Returns an optional namespace by reference, equivalen to `self.borrow().namespace` + /// but avoids extra work. + #[inline] + pub fn namespace_ref(&self) -> Option<&str> { + self.namespace.as_ref().map(|s| &**s) + } +} + +impl<'a> From> for OwnedName { + #[inline] + fn from(n: Name<'a>) -> OwnedName { + n.to_owned() + } +} + +impl FromStr for OwnedName { + type Err = (); + + /// Parses the given string slice into a qualified name. + /// + /// This function, when finishes sucessfully, always return a qualified + /// name without a namespace (`name.namespace == None`). It should be filled later + /// using proper `NamespaceStack`. + /// + /// It is supposed that all characters in the argument string are correct + /// as defined by the XML specification. No additional checks except a check + /// for emptiness are done. + fn from_str(s: &str) -> Result { + let mut it = s.split(':'); + + let r = match (it.next(), it.next(), it.next()) { + (Some(prefix), Some(local_name), None) if !prefix.is_empty() && + !local_name.is_empty() => + Some((local_name.into(), Some(prefix.into()))), + (Some(local_name), None, None) if !local_name.is_empty() => + Some((local_name.into(), None)), + (_, _, _) => None + }; + r.map(|(local_name, prefix)| OwnedName { + local_name: local_name, + namespace: None, + prefix: prefix + }).ok_or(()) + } +} + +#[cfg(test)] +mod tests { + use super::OwnedName; + + #[test] + fn test_owned_name_from_str() { + assert_eq!("prefix:name".parse(), Ok(OwnedName { + local_name: "name".into(), + namespace: None, + prefix: Some("prefix".into()) + })); + + assert_eq!("name".parse(), Ok(OwnedName { + local_name: "name".into(), + namespace: None, + prefix: None + })); + + assert_eq!("".parse(), Err::(())); + assert_eq!(":".parse(), Err::(())); + assert_eq!(":a".parse(), Err::(())); + assert_eq!("a:".parse(), Err::(())); + assert_eq!("a:b:c".parse(), Err::(())); + } +} diff --git a/third_party/rust/xml-rs/src/namespace.rs b/third_party/rust/xml-rs/src/namespace.rs new file mode 100644 index 000000000000..6d9e5b422e67 --- /dev/null +++ b/third_party/rust/xml-rs/src/namespace.rs @@ -0,0 +1,483 @@ +//! Contains namespace manipulation types and functions. + +use std::iter::{Map, Rev}; +use std::collections::btree_map::{BTreeMap, Entry}; +use std::collections::btree_map::Iter as Entries; +use std::collections::HashSet; +use std::slice::Iter; + +/// Designates prefix for namespace definitions. +/// +/// See [Namespaces in XML][namespace] spec for more information. +/// +/// [namespace]: http://www.w3.org/TR/xml-names/#ns-decl +pub const NS_XMLNS_PREFIX: &'static str = "xmlns"; + +/// Designates the standard URI for `xmlns` prefix. +/// +/// See [A Namespace Name for xmlns Attributes][1] for more information. +/// +/// [namespace]: http://www.w3.org/2000/xmlns/ +pub const NS_XMLNS_URI: &'static str = "http://www.w3.org/2000/xmlns/"; + +/// Designates prefix for a namespace containing several special predefined attributes. +/// +/// See [2.10 White Space handling][1], [2.1 Language Identification][2], +/// [XML Base specification][3] and [xml:id specification][4] for more information. +/// +/// [1]: http://www.w3.org/TR/REC-xml/#sec-white-space +/// [2]: http://www.w3.org/TR/REC-xml/#sec-lang-tag +/// [3]: http://www.w3.org/TR/xmlbase/ +/// [4]: http://www.w3.org/TR/xml-id/ +pub const NS_XML_PREFIX: &'static str = "xml"; + +/// Designates the standard URI for `xml` prefix. +/// +/// See `NS_XML_PREFIX` documentation for more information. +pub const NS_XML_URI: &'static str = "http://www.w3.org/XML/1998/namespace"; + +/// Designates the absence of prefix in a qualified name. +/// +/// This constant should be used to define or query default namespace which should be used +/// for element or attribute names without prefix. For example, if a namespace mapping +/// at a particular point in the document contains correspondence like +/// ```none +/// NS_NO_PREFIX --> urn:some:namespace +/// ``` +/// then all names declared without an explicit prefix `urn:some:namespace` is assumed as +/// a namespace URI. +/// +/// By default empty prefix corresponds to absence of namespace, but this can change either +/// when writing an XML document (manually) or when reading an XML document (based on namespace +/// declarations). +pub const NS_NO_PREFIX: &'static str = ""; + +/// Designates an empty namespace URI, which is equivalent to absence of namespace. +/// +/// This constant should not usually be used directly; it is used to designate that +/// empty prefix corresponds to absent namespace in `NamespaceStack` instances created with +/// `NamespaceStack::default()`. Therefore, it can be used to restore `NS_NO_PREFIX` mapping +/// in a namespace back to its default value. +pub const NS_EMPTY_URI: &'static str = ""; + +/// Namespace is a map from prefixes to namespace URIs. +/// +/// No prefix (i.e. default namespace) is designated by `NS_NO_PREFIX` constant. +#[derive(PartialEq, Eq, Clone, Debug)] +pub struct Namespace(pub BTreeMap); + +impl Namespace { + /// Returns an empty namespace. + #[inline] + pub fn empty() -> Namespace { Namespace(BTreeMap::new()) } + + /// Checks whether this namespace is empty. + #[inline] + pub fn is_empty(&self) -> bool { + self.0.is_empty() + } + + /// Checks whether this namespace is essentially empty, that is, it does not contain + /// anything but default mappings. + pub fn is_essentially_empty(&self) -> bool { + // a shortcut for a namespace which is definitely not empty + if self.0.len() > 3 { return false; } + + self.0.iter().all(|(k, v)| match (&**k, &**v) { + (NS_NO_PREFIX, NS_EMPTY_URI) => true, + (NS_XMLNS_PREFIX, NS_XMLNS_URI) => true, + (NS_XML_PREFIX, NS_XML_URI) => true, + _ => false + }) + } + + /// Checks whether this namespace mapping contains the given prefix. + /// + /// # Parameters + /// * `prefix` --- namespace prefix. + /// + /// # Return value + /// `true` if this namespace contains the given prefix, `false` otherwise. + #[inline] + pub fn contains>(&self, prefix: &P) -> bool { + self.0.contains_key(prefix.as_ref()) + } + + /// Puts a mapping into this namespace. + /// + /// This method does not override any already existing mappings. + /// + /// Returns a boolean flag indicating whether the map already contained + /// the given prefix. + /// + /// # Parameters + /// * `prefix` --- namespace prefix; + /// * `uri` --- namespace URI. + /// + /// # Return value + /// `true` if `prefix` has been inserted successfully; `false` if the `prefix` + /// was already present in the namespace. + pub fn put(&mut self, prefix: P, uri: U) -> bool + where P: Into, U: Into + { + match self.0.entry(prefix.into()) { + Entry::Occupied(_) => false, + Entry::Vacant(ve) => { + ve.insert(uri.into()); + true + } + } + } + + /// Puts a mapping into this namespace forcefully. + /// + /// This method, unlike `put()`, does replace an already existing mapping. + /// + /// Returns previous URI which was assigned to the given prefix, if it is present. + /// + /// # Parameters + /// * `prefix` --- namespace prefix; + /// * `uri` --- namespace URI. + /// + /// # Return value + /// `Some(uri)` with `uri` being a previous URI assigned to the `prefix`, or + /// `None` if such prefix was not present in the namespace before. + pub fn force_put(&mut self, prefix: P, uri: U) -> Option + where P: Into, U: Into + { + self.0.insert(prefix.into(), uri.into()) + } + + /// Queries the namespace for the given prefix. + /// + /// # Parameters + /// * `prefix` --- namespace prefix. + /// + /// # Return value + /// Namespace URI corresponding to the given prefix, if it is present. + pub fn get<'a, P: ?Sized+AsRef>(&'a self, prefix: &P) -> Option<&'a str> { + self.0.get(prefix.as_ref()).map(|s| &**s) + } +} + +/// An alias for iterator type for namespace mappings contained in a namespace. +pub type NamespaceMappings<'a> = Map< + Entries<'a, String, String>, + for<'b> fn((&'b String, &'b String)) -> UriMapping<'b> +>; + +impl<'a> IntoIterator for &'a Namespace { + type Item = UriMapping<'a>; + type IntoIter = NamespaceMappings<'a>; + + fn into_iter(self) -> Self::IntoIter { + fn mapper<'a>((prefix, uri): (&'a String, &'a String)) -> UriMapping<'a> { + (&*prefix, &*uri) + } + self.0.iter().map(mapper) + } +} + +/// Namespace stack is a sequence of namespaces. +/// +/// Namespace stack is used to represent cumulative namespace consisting of +/// combined namespaces from nested elements. +#[derive(Clone, Eq, PartialEq, Debug)] +pub struct NamespaceStack(pub Vec); + +impl NamespaceStack { + /// Returns an empty namespace stack. + #[inline] + pub fn empty() -> NamespaceStack { NamespaceStack(Vec::with_capacity(2)) } + + /// Returns a namespace stack with default items in it. + /// + /// Default items are the following: + /// + /// * `xml` → `http://www.w3.org/XML/1998/namespace`; + /// * `xmlns` → `http://www.w3.org/2000/xmlns/`. + #[inline] + pub fn default() -> NamespaceStack { + let mut nst = NamespaceStack::empty(); + nst.push_empty(); + // xml namespace + nst.put(NS_XML_PREFIX, NS_XML_URI); + // xmlns namespace + nst.put(NS_XMLNS_PREFIX, NS_XMLNS_URI); + // empty namespace + nst.put(NS_NO_PREFIX, NS_EMPTY_URI); + nst + } + + /// Adds an empty namespace to the top of this stack. + #[inline] + pub fn push_empty(&mut self) -> &mut NamespaceStack { + self.0.push(Namespace::empty()); + self + } + + /// Removes the topmost namespace in this stack. + /// + /// Panics if the stack is empty. + #[inline] + pub fn pop(&mut self) -> Namespace { + self.0.pop().unwrap() + } + + /// Removes the topmost namespace in this stack. + /// + /// Returns `Some(namespace)` if this stack is not empty and `None` otherwise. + #[inline] + pub fn try_pop(&mut self) -> Option { + self.0.pop() + } + + /// Borrows the topmost namespace mutably, leaving the stack intact. + /// + /// Panics if the stack is empty. + #[inline] + pub fn peek_mut(&mut self) -> &mut Namespace { + self.0.last_mut().unwrap() + } + + /// Borrows the topmost namespace immutably, leaving the stack intact. + /// + /// Panics if the stack is empty. + #[inline] + pub fn peek(&self) -> &Namespace { + self.0.last().unwrap() + } + + /// Puts a mapping into the topmost namespace if this stack does not already contain one. + /// + /// Returns a boolean flag indicating whether the insertion has completed successfully. + /// Note that both key and value are matched and the mapping is inserted if either + /// namespace prefix is not already mapped, or if it is mapped, but to a different URI. + /// + /// # Parameters + /// * `prefix` --- namespace prefix; + /// * `uri` --- namespace URI. + /// + /// # Return value + /// `true` if `prefix` has been inserted successfully; `false` if the `prefix` + /// was already present in the namespace stack. + pub fn put_checked(&mut self, prefix: P, uri: U) -> bool + where P: Into + AsRef, + U: Into + AsRef + { + if self.0.iter().any(|ns| ns.get(&prefix) == Some(uri.as_ref())) { + false + } else { + self.put(prefix, uri); + true + } + } + + /// Puts a mapping into the topmost namespace in this stack. + /// + /// This method does not override a mapping in the topmost namespace if it is + /// already present, however, it does not depend on other namespaces in the stack, + /// so it is possible to put a mapping which is present in lower namespaces. + /// + /// Returns a boolean flag indicating whether the insertion has completed successfully. + /// + /// # Parameters + /// * `prefix` --- namespace prefix; + /// * `uri` --- namespace URI. + /// + /// # Return value + /// `true` if `prefix` has been inserted successfully; `false` if the `prefix` + /// was already present in the namespace. + #[inline] + pub fn put(&mut self, prefix: P, uri: U) -> bool + where P: Into, U: Into + { + self.0.last_mut().unwrap().put(prefix, uri) + } + + /// Performs a search for the given prefix in the whole stack. + /// + /// This method walks the stack from top to bottom, querying each namespace + /// in order for the given prefix. If none of the namespaces contains the prefix, + /// `None` is returned. + /// + /// # Parameters + /// * `prefix` --- namespace prefix. + #[inline] + pub fn get<'a, P: ?Sized+AsRef>(&'a self, prefix: &P) -> Option<&'a str> { + let prefix = prefix.as_ref(); + for ns in self.0.iter().rev() { + match ns.get(prefix) { + None => {}, + r => return r, + } + } + None + } + + /// Combines this stack of namespaces into a single namespace. + /// + /// Namespaces are combined in left-to-right order, that is, rightmost namespace + /// elements take priority over leftmost ones. + pub fn squash(&self) -> Namespace { + let mut result = BTreeMap::new(); + for ns in self.0.iter() { + result.extend(ns.0.iter().map(|(k, v)| (k.clone(), v.clone()))); + } + Namespace(result) + } + + /// Returns an object which implements `Extend` using `put_checked()` instead of `put()`. + /// + /// See `CheckedTarget` for more information. + #[inline] + pub fn checked_target(&mut self) -> CheckedTarget { + CheckedTarget(self) + } + + /// Returns an iterator over all mappings in this namespace stack. + #[inline] + pub fn iter(&self) -> NamespaceStackMappings { + self.into_iter() + } +} + +/// An iterator over mappings from prefixes to URIs in a namespace stack. +/// +/// # Example +/// ``` +/// # use xml::namespace::NamespaceStack; +/// let mut nst = NamespaceStack::empty(); +/// nst.push_empty(); +/// nst.put("a", "urn:A"); +/// nst.put("b", "urn:B"); +/// nst.push_empty(); +/// nst.put("c", "urn:C"); +/// +/// assert_eq!(vec![("c", "urn:C"), ("a", "urn:A"), ("b", "urn:B")], nst.iter().collect::>()); +/// ``` +pub struct NamespaceStackMappings<'a> { + namespaces: Rev>, + current_namespace: Option>, + used_keys: HashSet<&'a str> +} + +impl<'a> NamespaceStackMappings<'a> { + fn to_next_namespace(&mut self) -> bool { + self.current_namespace = self.namespaces.next().map(|ns| ns.into_iter()); + self.current_namespace.is_some() + } +} + +impl<'a> Iterator for NamespaceStackMappings<'a> { + type Item = UriMapping<'a>; + + fn next(&mut self) -> Option> { + // If there is no current namespace and no next namespace, we're finished + if self.current_namespace.is_none() && !self.to_next_namespace() { + return None; + } + let next_item = self.current_namespace.as_mut().unwrap().next(); + + match next_item { + // There is an element in the current namespace + Some((k, v)) => if self.used_keys.contains(&k) { + // If the current key is used, go to the next one + self.next() + } else { + // Otherwise insert the current key to the set of used keys and + // return the mapping + self.used_keys.insert(k); + Some((k, v)) + }, + // Current namespace is exhausted + None => if self.to_next_namespace() { + // If there is next namespace, continue from it + self.next() + } else { + // No next namespace, exiting + None + } + } + } +} + +impl<'a> IntoIterator for &'a NamespaceStack { + type Item = UriMapping<'a>; + type IntoIter = NamespaceStackMappings<'a>; + + fn into_iter(self) -> Self::IntoIter { + NamespaceStackMappings { + namespaces: self.0.iter().rev(), + current_namespace: None, + used_keys: HashSet::new() + } + } +} + +/// A type alias for a pair of `(prefix, uri)` values returned by namespace iterators. +pub type UriMapping<'a> = (&'a str, &'a str); + +impl<'a> Extend> for Namespace { + fn extend(&mut self, iterable: T) where T: IntoIterator> { + for (prefix, uri) in iterable { + self.put(prefix, uri); + } + } +} + +impl<'a> Extend> for NamespaceStack { + fn extend(&mut self, iterable: T) where T: IntoIterator> { + for (prefix, uri) in iterable { + self.put(prefix, uri); + } + } +} + +/// A wrapper around `NamespaceStack` which implements `Extend` using `put_checked()`. +/// +/// # Example +/// +/// ``` +/// # use xml::namespace::NamespaceStack; +/// +/// let mut nst = NamespaceStack::empty(); +/// nst.push_empty(); +/// nst.put("a", "urn:A"); +/// nst.put("b", "urn:B"); +/// nst.push_empty(); +/// nst.put("c", "urn:C"); +/// +/// nst.checked_target().extend(vec![("a", "urn:Z"), ("b", "urn:B"), ("c", "urn:Y"), ("d", "urn:D")]); +/// assert_eq!( +/// vec![("a", "urn:Z"), ("c", "urn:C"), ("d", "urn:D"), ("b", "urn:B")], +/// nst.iter().collect::>() +/// ); +/// ``` +/// +/// Compare: +/// +/// ``` +/// # use xml::namespace::NamespaceStack; +/// # let mut nst = NamespaceStack::empty(); +/// # nst.push_empty(); +/// # nst.put("a", "urn:A"); +/// # nst.put("b", "urn:B"); +/// # nst.push_empty(); +/// # nst.put("c", "urn:C"); +/// +/// nst.extend(vec![("a", "urn:Z"), ("b", "urn:B"), ("c", "urn:Y"), ("d", "urn:D")]); +/// assert_eq!( +/// vec![("a", "urn:Z"), ("b", "urn:B"), ("c", "urn:C"), ("d", "urn:D")], +/// nst.iter().collect::>() +/// ); +/// ``` +pub struct CheckedTarget<'a>(&'a mut NamespaceStack); + +impl<'a, 'b> Extend> for CheckedTarget<'a> { + fn extend(&mut self, iterable: T) where T: IntoIterator> { + for (prefix, uri) in iterable { + self.0.put_checked(prefix, uri); + } + } +} diff --git a/third_party/rust/xml-rs/src/reader/config.rs b/third_party/rust/xml-rs/src/reader/config.rs new file mode 100644 index 000000000000..02da747526ba --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/config.rs @@ -0,0 +1,119 @@ +//! Contains parser configuration structure. +use std::io::Read; + +use reader::EventReader; + +/// Parser configuration structure. +/// +/// This structure contains various configuration options which affect +/// behavior of the parser. +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct ParserConfig { + /// Whether or not should whitespace in textual events be removed. Default is false. + /// + /// When true, all standalone whitespace will be removed (this means no + /// `Whitespace` events will ve emitted), and leading and trailing whitespace + /// from `Character` events will be deleted. If after trimming `Characters` + /// event will be empty, it will also be omitted from output stream. This is + /// possible, however, only if `whitespace_to_characters` or + /// `cdata_to_characters` options are set. + /// + /// This option does not affect CDATA events, unless `cdata_to_characters` + /// option is also set. In that case CDATA content will also be trimmed. + pub trim_whitespace: bool, + + /// Whether or not should whitespace be converted to characters. + /// Default is false. + /// + /// If true, instead of `Whitespace` events `Characters` events with the + /// same content will be emitted. If `trim_whitespace` is also true, these + /// events will be trimmed to nothing and, consequently, not emitted. + pub whitespace_to_characters: bool, + + /// Whether or not should CDATA be converted to characters. + /// Default is false. + /// + /// If true, instead of `CData` events `Characters` events with the same + /// content will be emitted. If `trim_whitespace` is also true, these events + /// will be trimmed. If corresponding CDATA contained nothing but whitespace, + /// this event will be omitted from the stream. + pub cdata_to_characters: bool, + + /// Whether or not should comments be omitted. Default is true. + /// + /// If true, `Comment` events will not be emitted at all. + pub ignore_comments: bool, + + /// Whether or not should sequential `Characters` events be merged. + /// Default is true. + /// + /// If true, multiple sequential `Characters` events will be merged into + /// a single event, that is, their data will be concatenated. + /// + /// Multiple sequential `Characters` events are only possible if either + /// `cdata_to_characters` or `ignore_comments` are set. Otherwise character + /// events will always be separated by other events. + pub coalesce_characters: bool +} + +impl ParserConfig { + /// Returns a new config with default values. + /// + /// You can tweak default values using builder-like pattern: + /// + /// ```rust + /// use xml::reader::ParserConfig; + /// + /// let config = ParserConfig::new() + /// .trim_whitespace(true) + /// .ignore_comments(true) + /// .coalesce_characters(false); + /// ``` + pub fn new() -> ParserConfig { + ParserConfig { + trim_whitespace: false, + whitespace_to_characters: false, + cdata_to_characters: false, + ignore_comments: true, + coalesce_characters: true + } + } + + /// Creates an XML reader with this configuration. + /// + /// This is a convenience method for configuring and creating a reader at the same time: + /// + /// ```rust + /// use xml::reader::ParserConfig; + /// + /// let mut source: &[u8] = b"..."; + /// + /// let reader = ParserConfig::new() + /// .trim_whitespace(true) + /// .ignore_comments(true) + /// .coalesce_characters(false) + /// .create_reader(&mut source); + /// ``` + /// + /// This method is exactly equivalent to calling `EventReader::new_with_config()` with + /// this configuration object. + #[inline] + pub fn create_reader(self, source: R) -> EventReader { + EventReader::new_with_config(source, self) + } +} + +impl Default for ParserConfig { + #[inline] + fn default() -> ParserConfig { + ParserConfig::new() + } +} + +gen_setters! { ParserConfig, + trim_whitespace: val bool, + whitespace_to_characters: val bool, + cdata_to_characters: val bool, + ignore_comments: val bool, + coalesce_characters: val bool +} diff --git a/third_party/rust/xml-rs/src/reader/error.rs b/third_party/rust/xml-rs/src/reader/error.rs new file mode 100644 index 000000000000..92378e6373dd --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/error.rs @@ -0,0 +1,121 @@ + +use std::io; +use std::borrow::Cow; +use std::fmt; +use std::error; +use std::str; + +use util; +use common::{Position, TextPosition}; + +#[derive(Debug)] +pub enum ErrorKind { + Syntax(Cow<'static, str>), + Io(io::Error), + Utf8(str::Utf8Error), + UnexpectedEof, +} + +/// An XML parsing error. +/// +/// Consists of a 2D position in a document and a textual message describing the error. +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct Error { + pos: TextPosition, + kind: ErrorKind, +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{} {}", self.pos, self.msg()) + } +} + +impl Position for Error { + #[inline] + fn position(&self) -> TextPosition { self.pos } +} + +impl Error { + /// Returns a reference to a message which is contained inside this error. + #[inline] + pub fn msg(&self) -> &str { + use self::ErrorKind::*; + match self.kind { + UnexpectedEof => &"Unexpected EOF", + Utf8(ref reason) => error_description(reason), + Io(ref io_error) => error_description(io_error), + Syntax(ref msg) => msg.as_ref(), + } + } + + pub fn kind(&self) -> &ErrorKind { &self.kind } +} + +impl error::Error for Error { + #[inline] + fn description(&self) -> &str { self.msg() } +} + +impl<'a, P, M> From<(&'a P, M)> for Error where P: Position, M: Into> { + fn from(orig: (&'a P, M)) -> Self { + Error{ + pos: orig.0.position(), + kind: ErrorKind::Syntax(orig.1.into()) + } + } +} + +impl From for Error { + fn from(e: util::CharReadError) -> Self { + use util::CharReadError::*; + Error{ + pos: TextPosition::new(), + kind: match e { + UnexpectedEof => ErrorKind::UnexpectedEof, + Utf8(reason) => ErrorKind::Utf8(reason), + Io(io_error) => ErrorKind::Io(io_error), + } + } + } +} + +impl From for Error { + fn from(e: io::Error) -> Self { + Error { + pos: TextPosition::new(), + kind: ErrorKind::Io(e), + } + } +} + +impl Clone for ErrorKind { + fn clone(&self) -> Self { + use self::ErrorKind::*; + match *self { + UnexpectedEof => UnexpectedEof, + Utf8(ref reason) => Utf8(reason.clone()), + Io(ref io_error) => Io(io::Error::new(io_error.kind(), error_description(io_error))), + Syntax(ref msg) => Syntax(msg.clone()), + } + } +} +impl PartialEq for ErrorKind { + fn eq(&self, other: &ErrorKind) -> bool { + use self::ErrorKind::*; + match (self, other) { + (&UnexpectedEof, &UnexpectedEof) => true, + (&Utf8(ref left), &Utf8(ref right)) => left == right, + (&Io(ref left), &Io(ref right)) => + left.kind() == right.kind() && + error_description(left) == error_description(right), + (&Syntax(ref left), &Syntax(ref right)) => + left == right, + + (_, _) => false, + } + } +} +impl Eq for ErrorKind {} + +fn error_description(e: &error::Error) -> &str { e.description() } diff --git a/third_party/rust/xml-rs/src/reader/events.rs b/third_party/rust/xml-rs/src/reader/events.rs new file mode 100644 index 000000000000..46d7621a87be --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/events.rs @@ -0,0 +1,219 @@ +//! Contains `XmlEvent` datatype, instances of which are emitted by the parser. + +use std::fmt; +use std::borrow::Cow; + +use name::OwnedName; +use attribute::OwnedAttribute; +use common::XmlVersion; +use namespace::Namespace; + +/// An element of an XML input stream. +/// +/// Items of this enum are emitted by `reader::EventReader`. They correspond to different +/// elements of an XML document. +#[derive(PartialEq, Clone)] +pub enum XmlEvent { + /// Corresponds to XML document declaration. + /// + /// This event is always emitted before any other event. It is emitted + /// even if the actual declaration is not present in the document. + StartDocument { + /// XML version. + /// + /// If XML declaration is not present, defaults to `Version10`. + version: XmlVersion, + + /// XML document encoding. + /// + /// If XML declaration is not present or does not contain `encoding` attribute, + /// defaults to `"UTF-8"`. This field is currently used for no other purpose than + /// informational. + encoding: String, + + /// XML standalone declaration. + /// + /// If XML document is not present or does not contain `standalone` attribute, + /// defaults to `None`. This field is currently used for no other purpose than + /// informational. + standalone: Option + }, + + /// Denotes to the end of the document stream. + /// + /// This event is always emitted after any other event (except `Error`). After it + /// is emitted for the first time, it will always be emitted on next event pull attempts. + EndDocument, + + /// Denotes an XML processing instruction. + /// + /// This event contains a processing instruction target (`name`) and opaque `data`. It + /// is up to the application to process them. + ProcessingInstruction { + /// Processing instruction target. + name: String, + + /// Processing instruction content. + data: Option + }, + + /// Denotes a beginning of an XML element. + /// + /// This event is emitted after parsing opening tags or after parsing bodiless tags. In the + /// latter case `EndElement` event immediately follows. + StartElement { + /// Qualified name of the element. + name: OwnedName, + + /// A list of attributes associated with the element. + /// + /// Currently attributes are not checked for duplicates (TODO) + attributes: Vec, + + /// Contents of the namespace mapping at this point of the document. + namespace: Namespace, + }, + + /// Denotes an end of an XML element. + /// + /// This event is emitted after parsing closing tags or after parsing bodiless tags. In the + /// latter case it is emitted immediately after corresponding `StartElement` event. + EndElement { + /// Qualified name of the element. + name: OwnedName + }, + + /// Denotes CDATA content. + /// + /// This event contains unparsed data. No unescaping will be performed. + /// + /// It is possible to configure a parser to emit `Characters` event instead of `CData`. See + /// `pull::ParserConfiguration` structure for more information. + CData(String), + + /// Denotes a comment. + /// + /// It is possible to configure a parser to ignore comments, so this event will never be emitted. + /// See `pull::ParserConfiguration` structure for more information. + Comment(String), + + /// Denotes character data outside of tags. + /// + /// Contents of this event will always be unescaped, so no entities like `<` or `&` or `{` + /// will appear in it. + /// + /// It is possible to configure a parser to trim leading and trailing whitespace for this event. + /// See `pull::ParserConfiguration` structure for more information. + Characters(String), + + /// Denotes a chunk of whitespace outside of tags. + /// + /// It is possible to configure a parser to emit `Characters` event instead of `Whitespace`. + /// See `pull::ParserConfiguration` structure for more information. When combined with whitespace + /// trimming, it will eliminate standalone whitespace from the event stream completely. + Whitespace(String) +} + +impl fmt::Debug for XmlEvent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + XmlEvent::StartDocument { ref version, ref encoding, ref standalone } => + write!(f, "StartDocument({}, {}, {:?})", version, *encoding, *standalone), + XmlEvent::EndDocument => + write!(f, "EndDocument"), + XmlEvent::ProcessingInstruction { ref name, ref data } => + write!(f, "ProcessingInstruction({}{})", *name, match *data { + Some(ref data) => format!(", {}", data), + None => String::new() + }), + XmlEvent::StartElement { ref name, ref attributes, namespace: Namespace(ref namespace) } => + write!(f, "StartElement({}, {:?}{})", name, namespace, if attributes.is_empty() { + String::new() + } else { + let attributes: Vec = attributes.iter().map( + |a| format!("{} -> {}", a.name, a.value) + ).collect(); + format!(", [{}]", attributes.join(", ")) + }), + XmlEvent::EndElement { ref name } => + write!(f, "EndElement({})", name), + XmlEvent::Comment(ref data) => + write!(f, "Comment({})", data), + XmlEvent::CData(ref data) => + write!(f, "CData({})", data), + XmlEvent::Characters(ref data) => + write!(f, "Characters({})", data), + XmlEvent::Whitespace(ref data) => + write!(f, "Whitespace({})", data) + } + } +} + +impl XmlEvent { + /// Obtains a writer event from this reader event. + /// + /// This method is useful for streaming processing of XML documents where the output + /// is also an XML document. With this method it is possible to process some events + /// while passing other events through to the writer unchanged: + /// + /// ```rust + /// use std::str; + /// + /// use xml::{EventReader, EventWriter}; + /// use xml::reader::XmlEvent as ReaderEvent; + /// use xml::writer::XmlEvent as WriterEvent; + /// + /// let mut input: &[u8] = b"world"; + /// let mut output: Vec = Vec::new(); + /// + /// { + /// let mut reader = EventReader::new(&mut input); + /// let mut writer = EventWriter::new(&mut output); + /// + /// for e in reader { + /// match e.unwrap() { + /// ReaderEvent::Characters(s) => + /// writer.write(WriterEvent::characters(&s.to_uppercase())).unwrap(), + /// e => if let Some(e) = e.as_writer_event() { + /// writer.write(e).unwrap() + /// } + /// } + /// } + /// } + /// + /// assert_eq!( + /// str::from_utf8(&output).unwrap(), + /// r#"WORLD"# + /// ); + /// ``` + /// + /// Note that this API may change or get additions in future to improve its ergonomics. + pub fn as_writer_event<'a>(&'a self) -> Option<::writer::events::XmlEvent<'a>> { + match *self { + XmlEvent::StartDocument { version, ref encoding, standalone } => + Some(::writer::events::XmlEvent::StartDocument { + version: version, + encoding: Some(encoding), + standalone: standalone + }), + XmlEvent::ProcessingInstruction { ref name, ref data } => + Some(::writer::events::XmlEvent::ProcessingInstruction { + name: name, + data: data.as_ref().map(|s| &s[..]) + }), + XmlEvent::StartElement { ref name, ref attributes, ref namespace } => + Some(::writer::events::XmlEvent::StartElement { + name: name.borrow(), + attributes: attributes.iter().map(|a| a.borrow()).collect(), + namespace: Cow::Borrowed(namespace) + }), + XmlEvent::EndElement { ref name } => + Some(::writer::events::XmlEvent::EndElement { name: Some(name.borrow()) }), + XmlEvent::Comment(ref data) => Some(::writer::events::XmlEvent::Comment(data)), + XmlEvent::CData(ref data) => Some(::writer::events::XmlEvent::CData(data)), + XmlEvent::Characters(ref data) => Some(::writer::events::XmlEvent::Characters(data)), + XmlEvent::Whitespace(ref data) => Some(::writer::events::XmlEvent::Characters(data)), + _ => None + } + } +} diff --git a/third_party/rust/xml-rs/src/reader/lexer.rs b/third_party/rust/xml-rs/src/reader/lexer.rs new file mode 100644 index 000000000000..3a50ce1c3e84 --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/lexer.rs @@ -0,0 +1,840 @@ +//! Contains simple lexer for XML documents. +//! +//! This module is for internal use. Use `xml::pull` module to do parsing. + +use std::fmt; +use std::collections::VecDeque; +use std::io::Read; +use std::result; +use std::borrow::Cow; + +use common::{Position, TextPosition, is_whitespace_char, is_name_char}; +use reader::Error; +use util; + +/// `Token` represents a single lexeme of an XML document. These lexemes +/// are used to perform actual parsing. +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +pub enum Token { + /// `` + ProcessingInstructionEnd, + /// `` + TagEnd, + /// `/>` + EmptyTagEnd, + /// `` + CommentEnd, + /// A chunk of characters, used for errors recovery. + Chunk(&'static str), + /// Any non-special character except whitespace. + Character(char), + /// Whitespace character. + Whitespace(char), + /// `=` + EqualsSign, + /// `'` + SingleQuote, + /// `"` + DoubleQuote, + /// `` + CDataEnd, + /// `&` + ReferenceStart, + /// `;` + ReferenceEnd, +} + +impl fmt::Display for Token { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Token::Chunk(s) => write!(f, "{}", s), + Token::Character(c) | Token::Whitespace(c) => write!(f, "{}", c), + other => write!(f, "{}", match other { + Token::OpeningTagStart => "<", + Token::ProcessingInstructionStart => " " " "", + Token::CDataEnd => "]]>", + Token::ReferenceStart => "&", + Token::ReferenceEnd => ";", + Token::EqualsSign => "=", + Token::SingleQuote => "'", + Token::DoubleQuote => "\"", + _ => unreachable!() + }) + } + } +} + +impl Token { + pub fn as_static_str(&self) -> Option<&'static str> { + match *self { + Token::OpeningTagStart => Some("<"), + Token::ProcessingInstructionStart => Some(" Some(" Some(" Some(""), + Token::CDataEnd => Some("]]>"), + Token::ReferenceStart => Some("&"), + Token::ReferenceEnd => Some(";"), + Token::EqualsSign => Some("="), + Token::SingleQuote => Some("'"), + Token::DoubleQuote => Some("\""), + Token::Chunk(s) => Some(s), + _ => None + } + } + + // using String.push_str(token.to_string()) is simply way too slow + pub fn push_to_string(&self, target: &mut String) { + match self.as_static_str() { + Some(s) => { target.push_str(s); } + None => { + match *self { + Token::Character(c) | Token::Whitespace(c) => target.push(c), + _ => unreachable!() + } + } + } + } + + /// Returns `true` if this token contains data that can be interpreted + /// as a part of the text. Surprisingly, this also means '>' and '=' and '"' and "'" and '-->'. + #[inline] + pub fn contains_char_data(&self) -> bool { + match *self { + Token::Whitespace(_) | Token::Chunk(_) | Token::Character(_) | Token::CommentEnd | + Token::TagEnd | Token::EqualsSign | Token::DoubleQuote | Token::SingleQuote => true, + _ => false + } + } + + /// Returns `true` if this token corresponds to a white space character. + #[inline] + pub fn is_whitespace(&self) -> bool { + match *self { + Token::Whitespace(_) => true, + _ => false + } + } +} + +enum State { + /// Triggered on '<' + TagStarted, + /// Triggered on ', Error>; + +/// Helps to set up a dispatch table for lexing large unambigous tokens like +/// ` ( + match $s { + $( + $st => match $c { + $stc => $_self.move_to($is($next_st)), + _ => $_self.handle_error($chunk, $c) + }, + )+ + $end_st => match $c { + $end_c => $e, + _ => $_self.handle_error($end_chunk, $c) + } + } + ) +); + +/// `Lexer` is a lexer for XML documents, which implements pull API. +/// +/// Main method is `next_token` which accepts an `std::io::Read` instance and +/// tries to read the next lexeme from it. +/// +/// When `skip_errors` flag is set, invalid lexemes will be returned as `Chunk`s. +/// When it is not set, errors will be reported as `Err` objects with a string message. +/// By default this flag is not set. Use `enable_errors` and `disable_errors` methods +/// to toggle the behavior. +pub struct Lexer { + pos: TextPosition, + head_pos: TextPosition, + char_queue: VecDeque, + st: State, + skip_errors: bool, + inside_comment: bool, + inside_token: bool, + eof_handled: bool +} + +impl Position for Lexer { + #[inline] + /// Returns the position of the last token produced by the lexer + fn position(&self) -> TextPosition { self.pos } +} + +impl Lexer { + /// Returns a new lexer with default state. + pub fn new() -> Lexer { + Lexer { + pos: TextPosition::new(), + head_pos: TextPosition::new(), + char_queue: VecDeque::with_capacity(4), // TODO: check size + st: State::Normal, + skip_errors: false, + inside_comment: false, + inside_token: false, + eof_handled: false + } + } + + /// Enables error handling so `next_token` will return `Some(Err(..))` + /// upon invalid lexeme. + #[inline] + pub fn enable_errors(&mut self) { self.skip_errors = false; } + + /// Disables error handling so `next_token` will return `Some(Chunk(..))` + /// upon invalid lexeme with this lexeme content. + #[inline] + pub fn disable_errors(&mut self) { self.skip_errors = true; } + + /// Enables special handling of some lexemes which should be done when we're parsing comment + /// internals. + #[inline] + pub fn inside_comment(&mut self) { self.inside_comment = true; } + + /// Disables the effect of `inside_comment()` method. + #[inline] + pub fn outside_comment(&mut self) { self.inside_comment = false; } + + /// Tries to read the next token from the buffer. + /// + /// It is possible to pass different instaces of `BufReader` each time + /// this method is called, but the resulting behavior is undefined in this case. + /// + /// Return value: + /// * `Err(reason) where reason: reader::Error` - when an error occurs; + /// * `Ok(None)` - upon end of stream is reached; + /// * `Ok(Some(token)) where token: Token` - in case a complete-token has been read from the stream. + pub fn next_token(&mut self, b: &mut B) -> Result { + // Already reached end of buffer + if self.eof_handled { + return Ok(None); + } + + if !self.inside_token { + self.pos = self.head_pos; + self.inside_token = true; + } + + // Check if we have saved a char or two for ourselves + while let Some(c) = self.char_queue.pop_front() { + match try!(self.read_next_token(c)) { + Some(t) => { + self.inside_token = false; + return Ok(Some(t)); + } + None => {} // continue + } + } + + loop { + // TODO: this should handle multiple encodings + let c = match try!(util::next_char_from(b)) { + Some(c) => c, // got next char + None => break, // nothing to read left + }; + + match try!(self.read_next_token(c)) { + Some(t) => { + self.inside_token = false; + return Ok(Some(t)); + } + None => { + // continue + } + } + } + + // Handle end of stream + self.eof_handled = true; + self.pos = self.head_pos; + match self.st { + State::TagStarted | State::CommentOrCDataOrDoctypeStarted | + State::CommentStarted | State::CDataStarted(_)| State::DoctypeStarted(_) | + State::CommentClosing(ClosingSubstate::Second) => + Err(self.error("Unexpected end of stream")), + State::ProcessingInstructionClosing => + Ok(Some(Token::Character('?'))), + State::EmptyTagClosing => + Ok(Some(Token::Character('/'))), + State::CommentClosing(ClosingSubstate::First) => + Ok(Some(Token::Character('-'))), + State::CDataClosing(ClosingSubstate::First) => + Ok(Some(Token::Character(']'))), + State::CDataClosing(ClosingSubstate::Second) => + Ok(Some(Token::Chunk("]]"))), + State::Normal => + Ok(None) + } + } + + #[inline] + fn error>>(&self, msg: M) -> Error { + (self, msg).into() + } + + #[inline] + fn read_next_token(&mut self, c: char) -> Result { + let res = self.dispatch_char(c); + if self.char_queue.is_empty() { + if c == '\n' { + self.head_pos.new_line(); + } else { + self.head_pos.advance(1); + } + } + res + } + + fn dispatch_char(&mut self, c: char) -> Result { + match self.st { + State::Normal => self.normal(c), + State::TagStarted => self.tag_opened(c), + State::CommentOrCDataOrDoctypeStarted => self.comment_or_cdata_or_doctype_started(c), + State::CommentStarted => self.comment_started(c), + State::CDataStarted(s) => self.cdata_started(c, s), + State::DoctypeStarted(s) => self.doctype_started(c, s), + State::ProcessingInstructionClosing => self.processing_instruction_closing(c), + State::EmptyTagClosing => self.empty_element_closing(c), + State::CommentClosing(s) => self.comment_closing(c, s), + State::CDataClosing(s) => self.cdata_closing(c, s) + } + } + + #[inline] + fn move_to(&mut self, st: State) -> Result { + self.st = st; + Ok(None) + } + + #[inline] + fn move_to_with(&mut self, st: State, token: Token) -> Result { + self.st = st; + Ok(Some(token)) + } + + #[inline] + fn move_to_with_unread(&mut self, st: State, cs: &[char], token: Token) -> Result { + self.char_queue.extend(cs.iter().cloned()); + self.move_to_with(st, token) + } + + fn handle_error(&mut self, chunk: &'static str, c: char) -> Result { + self.char_queue.push_back(c); + if self.skip_errors || (self.inside_comment && chunk != "--") { // FIXME: looks hacky + self.move_to_with(State::Normal, Token::Chunk(chunk)) + } else { + Err(self.error(format!("Unexpected token '{}' before '{}'", chunk, c))) + } + } + + /// Encountered a char + fn normal(&mut self, c: char) -> Result { + match c { + '<' => self.move_to(State::TagStarted), + '>' => Ok(Some(Token::TagEnd)), + '/' => self.move_to(State::EmptyTagClosing), + '=' => Ok(Some(Token::EqualsSign)), + '"' => Ok(Some(Token::DoubleQuote)), + '\'' => Ok(Some(Token::SingleQuote)), + '?' => self.move_to(State::ProcessingInstructionClosing), + '-' => self.move_to(State::CommentClosing(ClosingSubstate::First)), + ']' => self.move_to(State::CDataClosing(ClosingSubstate::First)), + '&' => Ok(Some(Token::ReferenceStart)), + ';' => Ok(Some(Token::ReferenceEnd)), + _ if is_whitespace_char(c) => Ok(Some(Token::Whitespace(c))), + _ => Ok(Some(Token::Character(c))) + } + } + + /// Encountered '<' + fn tag_opened(&mut self, c: char) -> Result { + match c { + '?' => self.move_to_with(State::Normal, Token::ProcessingInstructionStart), + '/' => self.move_to_with(State::Normal, Token::ClosingTagStart), + '!' => self.move_to(State::CommentOrCDataOrDoctypeStarted), + _ if is_whitespace_char(c) => self.move_to_with_unread(State::Normal, &[c], Token::OpeningTagStart), + _ if is_name_char(c) => self.move_to_with_unread(State::Normal, &[c], Token::OpeningTagStart), + _ => self.handle_error("<", c) + } + } + + /// Encountered ' Result { + match c { + '-' => self.move_to(State::CommentStarted), + '[' => self.move_to(State::CDataStarted(CDataStartedSubstate::E)), + 'D' => self.move_to(State::DoctypeStarted(DoctypeStartedSubstate::D)), + _ => self.handle_error(" Result { + match c { + '-' => self.move_to_with(State::Normal, Token::CommentStart), + _ => self.handle_error(" Result { + use self::CDataStartedSubstate::{E, C, CD, CDA, CDAT, CDATA}; + dispatch_on_enum_state!(self, s, c, State::CDataStarted, + E ; 'C' ; C ; " Result { + use self::DoctypeStartedSubstate::{D, DO, DOC, DOCT, DOCTY, DOCTYP}; + dispatch_on_enum_state!(self, s, c, State::DoctypeStarted, + D ; 'O' ; DO ; " Result { + match c { + '>' => self.move_to_with(State::Normal, Token::ProcessingInstructionEnd), + _ => self.move_to_with_unread(State::Normal, &[c], Token::Character('?')), + } + } + + /// Encountered '/' + fn empty_element_closing(&mut self, c: char) -> Result { + match c { + '>' => self.move_to_with(State::Normal, Token::EmptyTagEnd), + _ => self.move_to_with_unread(State::Normal, &[c], Token::Character('/')), + } + } + + /// Encountered '-' + fn comment_closing(&mut self, c: char, s: ClosingSubstate) -> Result { + match s { + ClosingSubstate::First => match c { + '-' => self.move_to(State::CommentClosing(ClosingSubstate::Second)), + _ => self.move_to_with_unread(State::Normal, &[c], Token::Character('-')) + }, + ClosingSubstate::Second => match c { + '>' => self.move_to_with(State::Normal, Token::CommentEnd), + // double dash not followed by a greater-than is a hard error inside comment + _ if self.inside_comment => self.handle_error("--", c), + // nothing else except comment closing starts with a double dash, and comment + // closing can never be after another dash, and also we're outside of a comment, + // therefore it is safe to push only the last read character to the list of unread + // characters and pass the double dash directly to the output + _ => self.move_to_with_unread(State::Normal, &[c], Token::Chunk("--")) + } + } + } + + /// Encountered ']' + fn cdata_closing(&mut self, c: char, s: ClosingSubstate) -> Result { + match s { + ClosingSubstate::First => match c { + ']' => self.move_to(State::CDataClosing(ClosingSubstate::Second)), + _ => self.move_to_with_unread(State::Normal, &[c], Token::Character(']')) + }, + ClosingSubstate::Second => match c { + '>' => self.move_to_with(State::Normal, Token::CDataEnd), + _ => self.move_to_with_unread(State::Normal, &[']', c], Token::Character(']')) + } + } + } +} + +#[cfg(test)] +mod tests { + use common::{Position}; + use std::io::{BufReader, Cursor}; + + use super::{Lexer, Token}; + + macro_rules! assert_oks( + (for $lex:ident and $buf:ident ; $($e:expr)+) => ({ + $( + assert_eq!(Ok(Some($e)), $lex.next_token(&mut $buf)); + )+ + }) + ); + + macro_rules! assert_err( + (for $lex:ident and $buf:ident expect row $r:expr ; $c:expr, $s:expr) => ({ + let err = $lex.next_token(&mut $buf); + assert!(err.is_err()); + let err = err.unwrap_err(); + assert_eq!($r as u64, err.position().row); + assert_eq!($c as u64, err.position().column); + assert_eq!($s, err.msg()); + }) + ); + + macro_rules! assert_none( + (for $lex:ident and $buf:ident) => ( + assert_eq!(Ok(None), $lex.next_token(&mut $buf)); + ) + ); + + fn make_lex_and_buf(s: &str) -> (Lexer, BufReader>>) { + (Lexer::new(), BufReader::new(Cursor::new(s.to_owned().into_bytes()))) + } + + #[test] + fn simple_lexer_test() { + let (mut lex, mut buf) = make_lex_and_buf( + r#" xd

 "# + ); + + assert_oks!(for lex and buf ; + Token::OpeningTagStart + Token::Character('a') + Token::Whitespace(' ') + Token::Character('p') + Token::EqualsSign + Token::SingleQuote + Token::Character('q') + Token::SingleQuote + Token::TagEnd + Token::Whitespace(' ') + Token::Character('x') + Token::OpeningTagStart + Token::Character('b') + Token::Whitespace(' ') + Token::Character('z') + Token::EqualsSign + Token::DoubleQuote + Token::Character('y') + Token::DoubleQuote + Token::TagEnd + Token::Character('d') + Token::Whitespace('\t') + Token::ClosingTagStart + Token::Character('b') + Token::TagEnd + Token::ClosingTagStart + Token::Character('a') + Token::TagEnd + Token::OpeningTagStart + Token::Character('p') + Token::EmptyTagEnd + Token::Whitespace(' ') + Token::ProcessingInstructionStart + Token::Character('n') + Token::Character('m') + Token::Whitespace(' ') + Token::ProcessingInstructionEnd + Token::Whitespace(' ') + Token::CommentStart + Token::Whitespace(' ') + Token::Character('a') + Token::Whitespace(' ') + Token::Character('c') + Token::Whitespace(' ') + Token::CommentEnd + Token::Whitespace(' ') + Token::ReferenceStart + Token::Character('n') + Token::Character('b') + Token::Character('s') + Token::Character('p') + Token::ReferenceEnd + ); + assert_none!(for lex and buf); + } + + #[test] + fn special_chars_test() { + let (mut lex, mut buf) = make_lex_and_buf( + r#"?x!+ // -| ]z]]"# + ); + + assert_oks!(for lex and buf ; + Token::Character('?') + Token::Character('x') + Token::Character('!') + Token::Character('+') + Token::Whitespace(' ') + Token::Character('/') + Token::Character('/') + Token::Whitespace(' ') + Token::Character('-') + Token::Character('|') + Token::Whitespace(' ') + Token::Character(']') + Token::Character('z') + Token::Chunk("]]") + ); + assert_none!(for lex and buf); + } + + #[test] + fn cdata_test() { + let (mut lex, mut buf) = make_lex_and_buf( + r#" "# + ); + + assert_oks!(for lex and buf ; + Token::OpeningTagStart + Token::Character('a') + Token::TagEnd + Token::CDataStart + Token::Character('x') + Token::Whitespace(' ') + Token::Character('y') + Token::Whitespace(' ') + Token::Character('?') + Token::CDataEnd + Token::Whitespace(' ') + Token::ClosingTagStart + Token::Character('a') + Token::TagEnd + ); + assert_none!(for lex and buf); + } + + #[test] + fn doctype_test() { + let (mut lex, mut buf) = make_lex_and_buf( + r#" "# + ); + assert_oks!(for lex and buf ; + Token::OpeningTagStart + Token::Character('a') + Token::TagEnd + Token::DoctypeStart + Token::Whitespace(' ') + Token::Character('a') + Token::Character('b') + Token::Whitespace(' ') + Token::Character('x') + Token::Character('x') + Token::Whitespace(' ') + Token::Character('z') + Token::TagEnd + Token::Whitespace(' ') + ); + assert_none!(for lex and buf) + } + + #[test] + fn end_of_stream_handling_ok() { + macro_rules! eof_check( + ($data:expr ; $token:expr) => ({ + let (mut lex, mut buf) = make_lex_and_buf($data); + assert_oks!(for lex and buf ; $token); + assert_none!(for lex and buf); + }) + ); + eof_check!("?" ; Token::Character('?')); + eof_check!("/" ; Token::Character('/')); + eof_check!("-" ; Token::Character('-')); + eof_check!("]" ; Token::Character(']')); + eof_check!("]]" ; Token::Chunk("]]")); + } + + #[test] + fn end_of_stream_handling_error() { + macro_rules! eof_check( + ($data:expr; $r:expr, $c:expr) => ({ + let (mut lex, mut buf) = make_lex_and_buf($data); + assert_err!(for lex and buf expect row $r ; $c, "Unexpected end of stream"); + assert_none!(for lex and buf); + }) + ); + eof_check!("<" ; 0, 1); + eof_check!(" ({ + let (mut lex, mut buf) = make_lex_and_buf($data); + assert_err!(for lex and buf expect row $r ; $c, $s); + + let (mut lex, mut buf) = make_lex_and_buf($data); + lex.disable_errors(); + assert_oks!(for lex and buf ; + Token::Chunk($chunk) + Token::Character($app) + ); + assert_none!(for lex and buf); + }) + ); + + #[test] + fn error_in_cdata_started() { + check_case!(""# + ); + + assert_oks!(for lex and buf ; + Token::CDataStart + Token::Character('F') + Token::Character('o') + Token::Character('o') + Token::Whitespace(' ') + Token::Character('[') + Token::Character('B') + Token::Character('a') + Token::Character('r') + Token::Character(']') + Token::CDataEnd + ); + assert_none!(for lex and buf); + } +} diff --git a/third_party/rust/xml-rs/src/reader/mod.rs b/third_party/rust/xml-rs/src/reader/mod.rs new file mode 100644 index 000000000000..5a7830650a2a --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/mod.rs @@ -0,0 +1,125 @@ +//! Contains high-level interface for a pull-based XML parser. +//! +//! The most important type in this module is `EventReader`, which provides an iterator +//! view for events in XML document. + +use std::io::{Read}; +use std::result; + +use common::{Position, TextPosition}; + +pub use self::config::ParserConfig; +pub use self::events::XmlEvent; + +use self::parser::PullParser; + +mod lexer; +mod parser; +mod config; +mod events; + +mod error; +pub use self::error::{Error, ErrorKind}; + +/// A result type yielded by `XmlReader`. +pub type Result = result::Result; + +/// A wrapper around an `std::io::Read` instance which provides pull-based XML parsing. +pub struct EventReader { + source: R, + parser: PullParser +} + +impl EventReader { + /// Creates a new reader, consuming the given stream. + #[inline] + pub fn new(source: R) -> EventReader { + EventReader::new_with_config(source, ParserConfig::new()) + } + + /// Creates a new reader with the provded configuration, consuming the given stream. + #[inline] + pub fn new_with_config(source: R, config: ParserConfig) -> EventReader { + EventReader { source: source, parser: PullParser::new(config) } + } + + /// Pulls and returns next XML event from the stream. + /// + /// If returned event is `XmlEvent::Error` or `XmlEvent::EndDocument`, then + /// further calls to this method will return this event again. + #[inline] + pub fn next(&mut self) -> Result { + self.parser.next(&mut self.source) + } + + pub fn source(&self) -> &R { &self.source } + pub fn source_mut(&mut self) -> &mut R { &mut self.source } + + /// Unwraps this `EventReader`, returning the underlying reader. + /// + /// Note that this operation is destructive; unwrapping the reader and wrapping it + /// again with `EventReader::new()` will create a fresh reader which will attempt + /// to parse an XML document from the beginning. + pub fn into_inner(self) -> R { + self.source + } +} + +impl Position for EventReader { + /// Returns the position of the last event produced by the reader. + #[inline] + fn position(&self) -> TextPosition { + self.parser.position() + } +} + +impl IntoIterator for EventReader { + type Item = Result; + type IntoIter = Events; + + fn into_iter(self) -> Events { + Events { reader: self, finished: false } + } +} + +/// An iterator over XML events created from some type implementing `Read`. +/// +/// When the next event is `xml::event::Error` or `xml::event::EndDocument`, then +/// it will be returned by the iterator once, and then it will stop producing events. +pub struct Events { + reader: EventReader, + finished: bool +} + +impl Events { + /// Unwraps the iterator, returning the internal `EventReader`. + #[inline] + pub fn into_inner(self) -> EventReader { + self.reader + } +} + +impl Iterator for Events { + type Item = Result; + + #[inline] + fn next(&mut self) -> Option> { + if self.finished { None } + else { + let ev = self.reader.next(); + match ev { + Ok(XmlEvent::EndDocument) | Err(_) => self.finished = true, + _ => {} + } + Some(ev) + } + } +} + +impl<'r> EventReader<&'r [u8]> { + /// A convenience method to create an `XmlReader` from a string slice. + #[inline] + pub fn from_str(source: &'r str) -> EventReader<&'r [u8]> { + EventReader::new(source.as_bytes()) + } +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_cdata.rs b/third_party/rust/xml-rs/src/reader/parser/inside_cdata.rs new file mode 100644 index 000000000000..3269fb4d6b2c --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_cdata.rs @@ -0,0 +1,32 @@ +use reader::events::XmlEvent; +use reader::lexer::Token; + +use super::{Result, PullParser, State}; + +impl PullParser { + pub fn inside_cdata(&mut self, t: Token) -> Option { + match t { + Token::CDataEnd => { + self.lexer.enable_errors(); + let event = if self.config.cdata_to_characters { + None + } else { + let data = self.take_buf(); + Some(Ok(XmlEvent::CData(data))) + }; + self.into_state(State::OutsideTag, event) + } + + Token::Whitespace(_) => { + t.push_to_string(&mut self.buf); + None + } + + _ => { + self.inside_whitespace = false; + t.push_to_string(&mut self.buf); + None + } + } + } +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_closing_tag_name.rs b/third_party/rust/xml-rs/src/reader/parser/inside_closing_tag_name.rs new file mode 100644 index 000000000000..1d8074a5a3f5 --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_closing_tag_name.rs @@ -0,0 +1,34 @@ +use namespace; + +use reader::lexer::Token; + +use super::{Result, PullParser, State, QualifiedNameTarget, ClosingTagSubstate}; + +impl PullParser { + pub fn inside_closing_tag_name(&mut self, t: Token, s: ClosingTagSubstate) -> Option { + match s { + ClosingTagSubstate::CTInsideName => self.read_qualified_name(t, QualifiedNameTarget::ClosingTagNameTarget, |this, token, name| { + match name.prefix_ref() { + Some(prefix) if prefix == namespace::NS_XML_PREFIX || + prefix == namespace::NS_XMLNS_PREFIX => + // TODO: {:?} is bad, need something better + Some(self_error!(this; "'{:?}' cannot be an element name prefix", name.prefix)), + _ => { + this.data.element_name = Some(name.clone()); + match token { + Token::Whitespace(_) => this.into_state_continue(State::InsideClosingTag(ClosingTagSubstate::CTAfterName)), + Token::TagEnd => this.emit_end_element(), + _ => Some(self_error!(this; "Unexpected token inside closing tag: {}", token)) + } + } + } + }), + ClosingTagSubstate::CTAfterName => match t { + Token::Whitespace(_) => None, // Skip whitespace + Token::TagEnd => self.emit_end_element(), + _ => Some(self_error!(self; "Unexpected token inside closing tag: {}", t)) + } + } + } + +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_comment.rs b/third_party/rust/xml-rs/src/reader/parser/inside_comment.rs new file mode 100644 index 000000000000..fc983205ac55 --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_comment.rs @@ -0,0 +1,32 @@ +use reader::events::XmlEvent; +use reader::lexer::Token; + +use super::{Result, PullParser, State}; + +impl PullParser { + pub fn inside_comment(&mut self, t: Token) -> Option { + match t { + // Double dash is illegal inside a comment + Token::Chunk(ref s) if &s[..] == "--" => Some(self_error!(self; "Unexpected token inside a comment: --")), + + Token::CommentEnd if self.config.ignore_comments => { + self.lexer.outside_comment(); + self.into_state_continue(State::OutsideTag) + } + + Token::CommentEnd => { + self.lexer.outside_comment(); + let data = self.take_buf(); + self.into_state_emit(State::OutsideTag, Ok(XmlEvent::Comment(data))) + } + + _ if self.config.ignore_comments => None, // Do not modify buffer if ignoring the comment + + _ => { + t.push_to_string(&mut self.buf); + None + } + } + } + +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_declaration.rs b/third_party/rust/xml-rs/src/reader/parser/inside_declaration.rs new file mode 100644 index 000000000000..af39d10d86c1 --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_declaration.rs @@ -0,0 +1,151 @@ + +use common::XmlVersion; + +use reader::events::XmlEvent; +use reader::lexer::Token; + +use super::{ + Result, PullParser, State, DeclarationSubstate, QualifiedNameTarget, + DEFAULT_VERSION, DEFAULT_ENCODING +}; + +impl PullParser { + // TODO: remove redundancy via macros or extra methods + pub fn inside_declaration(&mut self, t: Token, s: DeclarationSubstate) -> Option { + macro_rules! unexpected_token( + ($this:expr; $t:expr) => (Some($this.error(format!("Unexpected token inside XML declaration: {}", $t)))); + ($t:expr) => (unexpected_token!(self; $t)); + ); + + #[inline] + fn emit_start_document(this: &mut PullParser) -> Option { + this.parsed_declaration = true; + let version = this.data.take_version(); + let encoding = this.data.take_encoding(); + let standalone = this.data.take_standalone(); + this.into_state_emit(State::OutsideTag, Ok(XmlEvent::StartDocument { + version: version.unwrap_or(DEFAULT_VERSION), + encoding: encoding.unwrap_or(DEFAULT_ENCODING.into()), + standalone: standalone + })) + } + + match s { + DeclarationSubstate::BeforeVersion => match t { + Token::Whitespace(_) => None, // continue + Token::Character('v') => self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::InsideVersion)), + _ => unexpected_token!(t) + }, + + DeclarationSubstate::InsideVersion => self.read_qualified_name(t, QualifiedNameTarget::AttributeNameTarget, |this, token, name| { + match &name.local_name[..] { + "ersion" if name.namespace.is_none() => + this.into_state_continue(State::InsideDeclaration( + if token == Token::EqualsSign { + DeclarationSubstate::InsideVersionValue + } else { + DeclarationSubstate::AfterVersion + } + )), + _ => unexpected_token!(this; name) + } + }), + + DeclarationSubstate::AfterVersion => match t { + Token::Whitespace(_) => None, + Token::EqualsSign => self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::InsideVersionValue)), + _ => unexpected_token!(t) + }, + + DeclarationSubstate::InsideVersionValue => self.read_attribute_value(t, |this, value| { + this.data.version = match &value[..] { + "1.0" => Some(XmlVersion::Version10), + "1.1" => Some(XmlVersion::Version11), + _ => None + }; + if this.data.version.is_some() { + this.into_state_continue(State::InsideDeclaration(DeclarationSubstate::AfterVersionValue)) + } else { + Some(self_error!(this; "Unexpected XML version value: {}", value)) + } + }), + + DeclarationSubstate::AfterVersionValue => match t { + Token::Whitespace(_) => None, // skip whitespace + Token::Character('e') => self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::InsideEncoding)), + Token::Character('s') => self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::InsideStandaloneDecl)), + Token::ProcessingInstructionEnd => emit_start_document(self), + _ => unexpected_token!(t) + }, + + DeclarationSubstate::InsideEncoding => self.read_qualified_name(t, QualifiedNameTarget::AttributeNameTarget, |this, token, name| { + match &name.local_name[..] { + "ncoding" if name.namespace.is_none() => + this.into_state_continue(State::InsideDeclaration( + if token == Token::EqualsSign { DeclarationSubstate::InsideEncodingValue } else { DeclarationSubstate::AfterEncoding } + )), + _ => unexpected_token!(this; name) + } + }), + + DeclarationSubstate::AfterEncoding => match t { + Token::Whitespace(_) => None, + Token::EqualsSign => self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::InsideEncodingValue)), + _ => unexpected_token!(t) + }, + + DeclarationSubstate::InsideEncodingValue => self.read_attribute_value(t, |this, value| { + this.data.encoding = Some(value); + this.into_state_continue(State::InsideDeclaration(DeclarationSubstate::BeforeStandaloneDecl)) + }), + + DeclarationSubstate::BeforeStandaloneDecl => match t { + Token::Whitespace(_) => None, // skip whitespace + Token::Character('s') => self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::InsideStandaloneDecl)), + Token::ProcessingInstructionEnd => emit_start_document(self), + _ => unexpected_token!(t) + }, + + DeclarationSubstate::InsideStandaloneDecl => self.read_qualified_name(t, QualifiedNameTarget::AttributeNameTarget, |this, token, name| { + match &name.local_name[..] { + "tandalone" if name.namespace.is_none() => + this.into_state_continue(State::InsideDeclaration( + if token == Token::EqualsSign { + DeclarationSubstate::InsideStandaloneDeclValue + } else { + DeclarationSubstate::AfterStandaloneDecl + } + )), + _ => unexpected_token!(this; name) + } + }), + + DeclarationSubstate::AfterStandaloneDecl => match t { + Token::Whitespace(_) => None, + Token::EqualsSign => self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::InsideStandaloneDeclValue)), + _ => unexpected_token!(t) + }, + + DeclarationSubstate::InsideStandaloneDeclValue => self.read_attribute_value(t, |this, value| { + let standalone = match &value[..] { + "yes" => Some(true), + "no" => Some(false), + _ => None + }; + if standalone.is_some() { + this.data.standalone = standalone; + this.into_state_continue(State::InsideDeclaration(DeclarationSubstate::AfterStandaloneDeclValue)) + } else { + Some(self_error!(this; "Invalid standalone declaration value: {}", value)) + } + }), + + DeclarationSubstate::AfterStandaloneDeclValue => match t { + Token::Whitespace(_) => None, // skip whitespace + Token::ProcessingInstructionEnd => emit_start_document(self), + _ => unexpected_token!(t) + } + } + } + +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_doctype.rs b/third_party/rust/xml-rs/src/reader/parser/inside_doctype.rs new file mode 100644 index 000000000000..8dcf367bc665 --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_doctype.rs @@ -0,0 +1,16 @@ +use reader::lexer::Token; + +use super::{Result, PullParser, State}; + +impl PullParser { + pub fn inside_doctype(&mut self, t: Token) -> Option { + match t { + Token::TagEnd => { + self.lexer.enable_errors(); + self.into_state_continue(State::OutsideTag) + } + + _ => None + } + } +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_opening_tag.rs b/third_party/rust/xml-rs/src/reader/parser/inside_opening_tag.rs new file mode 100644 index 000000000000..533874fb817d --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_opening_tag.rs @@ -0,0 +1,108 @@ +use common::is_name_start_char; +use attribute::OwnedAttribute; +use namespace; + +use reader::lexer::Token; + +use super::{Result, PullParser, State, OpeningTagSubstate, QualifiedNameTarget}; + +impl PullParser { + pub fn inside_opening_tag(&mut self, t: Token, s: OpeningTagSubstate) -> Option { + macro_rules! unexpected_token(($t:expr) => (Some(self_error!(self; "Unexpected token inside opening tag: {}", $t)))); + match s { + OpeningTagSubstate::InsideName => self.read_qualified_name(t, QualifiedNameTarget::OpeningTagNameTarget, |this, token, name| { + match name.prefix_ref() { + Some(prefix) if prefix == namespace::NS_XML_PREFIX || + prefix == namespace::NS_XMLNS_PREFIX => + Some(self_error!(this; "'{:?}' cannot be an element name prefix", name.prefix)), + _ => { + this.data.element_name = Some(name.clone()); + match token { + Token::TagEnd => this.emit_start_element(false), + Token::EmptyTagEnd => this.emit_start_element(true), + Token::Whitespace(_) => this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)), + _ => unreachable!() + } + } + } + }), + + OpeningTagSubstate::InsideTag => match t { + Token::Whitespace(_) => None, // skip whitespace + Token::Character(c) if is_name_start_char(c) => { + self.buf.push(c); + self.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideAttributeName)) + } + Token::TagEnd => self.emit_start_element(false), + Token::EmptyTagEnd => self.emit_start_element(true), + _ => unexpected_token!(t) + }, + + OpeningTagSubstate::InsideAttributeName => self.read_qualified_name(t, QualifiedNameTarget::AttributeNameTarget, |this, token, name| { + this.data.attr_name = Some(name); + match token { + Token::Whitespace(_) => this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::AfterAttributeName)), + Token::EqualsSign => this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideAttributeValue)), + _ => unreachable!() + } + }), + + OpeningTagSubstate::AfterAttributeName => match t { + Token::Whitespace(_) => None, + Token::EqualsSign => self.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideAttributeValue)), + _ => unexpected_token!(t) + }, + + OpeningTagSubstate::InsideAttributeValue => self.read_attribute_value(t, |this, value| { + let name = this.data.take_attr_name().unwrap(); // unwrap() will always succeed here + + // check that no attribute with such name is already present + // if there is one, XML is not well-formed + if this.data.attributes.iter().find(|a| a.name == name).is_some() { // TODO: looks bad + // TODO: ideally this error should point to the beginning of the attribute, + // TODO: not the end of its value + Some(self_error!(this; "Attribute '{}' is redefined", name)) + } else { + match name.prefix_ref() { + // declaring a new prefix; it is sufficient to check prefix only + // because "xmlns" prefix is reserved + Some(namespace::NS_XMLNS_PREFIX) => { + let ln = &name.local_name[..]; + if ln == namespace::NS_XMLNS_PREFIX { + Some(self_error!(this; "Cannot redefine prefix '{}'", namespace::NS_XMLNS_PREFIX)) + } else if ln == namespace::NS_XML_PREFIX && &value[..] != namespace::NS_XML_URI { + Some(self_error!(this; "Prefix '{}' cannot be rebound to another value", namespace::NS_XML_PREFIX)) + } else if value.is_empty() { + Some(self_error!(this; "Cannot undefine prefix '{}'", ln)) + } else { + this.nst.put(name.local_name.clone(), value); + this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)) + } + } + + // declaring default namespace + None if &name.local_name[..] == namespace::NS_XMLNS_PREFIX => + match &value[..] { + namespace::NS_XMLNS_PREFIX | namespace::NS_XML_PREFIX => + Some(self_error!(this; "Namespace '{}' cannot be default", value)), + _ => { + this.nst.put(namespace::NS_NO_PREFIX, value.clone()); + this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)) + } + }, + + // regular attribute + _ => { + this.data.attributes.push(OwnedAttribute { + name: name.clone(), + value: value + }); + this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)) + } + } + } + }) + } + } + +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_processing_instruction.rs b/third_party/rust/xml-rs/src/reader/parser/inside_processing_instruction.rs new file mode 100644 index 000000000000..8ddf6b8d516b --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_processing_instruction.rs @@ -0,0 +1,96 @@ +use common::{ + is_name_start_char, is_name_char, +}; + +use reader::events::XmlEvent; +use reader::lexer::Token; + +use super::{Result, PullParser, State, ProcessingInstructionSubstate, DeclarationSubstate}; + +impl PullParser { + pub fn inside_processing_instruction(&mut self, t: Token, s: ProcessingInstructionSubstate) -> Option { + match s { + ProcessingInstructionSubstate::PIInsideName => match t { + Token::Character(c) if !self.buf_has_data() && is_name_start_char(c) || + self.buf_has_data() && is_name_char(c) => self.append_char_continue(c), + + Token::ProcessingInstructionEnd => { + // self.buf contains PI name + let name = self.take_buf(); + + // Don't need to check for declaration because it has mandatory attributes + // but there is none + match &name[..] { + // Name is empty, it is an error + "" => Some(self_error!(self; "Encountered processing instruction without name")), + + // Found + Some(self_error!(self; "Invalid processing instruction: { + self.into_state_emit( + State::OutsideTag, + Ok(XmlEvent::ProcessingInstruction { + name: name, + data: None + }) + ) + } + } + } + + Token::Whitespace(_) => { + // self.buf contains PI name + let name = self.take_buf(); + + match &name[..] { + // We have not ever encountered an element and have not parsed XML declaration + "xml" if !self.encountered_element && !self.parsed_declaration => + self.into_state_continue(State::InsideDeclaration(DeclarationSubstate::BeforeVersion)), + + // Found + Some(self_error!(self; "Invalid processing instruction: { + self.lexer.disable_errors(); // data is arbitrary, so disable errors + self.data.name = name; + self.into_state_continue(State::InsideProcessingInstruction(ProcessingInstructionSubstate::PIInsideData)) + } + + } + } + + _ => Some(self_error!(self; "Unexpected token: match t { + Token::ProcessingInstructionEnd => { + self.lexer.enable_errors(); + let name = self.data.take_name(); + let data = self.take_buf(); + self.into_state_emit( + State::OutsideTag, + Ok(XmlEvent::ProcessingInstruction { + name: name, + data: Some(data) + }) + ) + }, + + // Any other token should be treated as plain characters + _ => { + t.push_to_string(&mut self.buf); + None + } + }, + } + } + +} diff --git a/third_party/rust/xml-rs/src/reader/parser/inside_reference.rs b/third_party/rust/xml-rs/src/reader/parser/inside_reference.rs new file mode 100644 index 000000000000..c43e73bc09b8 --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/inside_reference.rs @@ -0,0 +1,65 @@ +use std::char; + +use common::{is_name_start_char, is_name_char}; + +use reader::lexer::Token; + +use super::{Result, PullParser, State}; + +impl PullParser { + pub fn inside_reference(&mut self, t: Token, prev_st: State) -> Option { + match t { + Token::Character(c) if !self.data.ref_data.is_empty() && is_name_char(c) || + self.data.ref_data.is_empty() && (is_name_start_char(c) || c == '#') => { + self.data.ref_data.push(c); + None + } + + Token::ReferenceEnd => { + // TODO: check for unicode correctness + let name = self.data.take_ref_data(); + let name_len = name.len(); // compute once + let c = match &name[..] { + "lt" => Ok('<'), + "gt" => Ok('>'), + "amp" => Ok('&'), + "apos" => Ok('\''), + "quot" => Ok('"'), + "" => Err(self_error!(self; "Encountered empty entity")), + _ if name_len > 2 && name.starts_with("#x") => { + let num_str = &name[2..name_len]; + if num_str == "0" { + Err(self_error!(self; "Null character entity is not allowed")) + } else { + match u32::from_str_radix(num_str, 16).ok().and_then(char::from_u32) { + Some(c) => Ok(c), + None => Err(self_error!(self; "Invalid hexadecimal character number in an entity: {}", name)) + } + } + } + _ if name_len > 1 && name.starts_with('#') => { + let num_str = &name[1..name_len]; + if num_str == "0" { + Err(self_error!(self; "Null character entity is not allowed")) + } else { + match u32::from_str_radix(num_str, 10).ok().and_then(char::from_u32) { + Some(c) => Ok(c), + None => Err(self_error!(self; "Invalid decimal character number in an entity: {}", name)) + } + } + }, + _ => Err(self_error!(self; "Unexpected entity: {}", name)) + }; + match c { + Ok(c) => { + self.buf.push(c); + self.into_state_continue(prev_st) + } + Err(e) => Some(e) + } + } + + _ => Some(self_error!(self; "Unexpected token inside an entity: {}", t)) + } + } +} diff --git a/third_party/rust/xml-rs/src/reader/parser/mod.rs b/third_party/rust/xml-rs/src/reader/parser/mod.rs new file mode 100644 index 000000000000..6bc971de1f32 --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/mod.rs @@ -0,0 +1,600 @@ +//! Contains an implementation of pull-based XML parser. + +use std::mem; +use std::borrow::Cow; +use std::io::prelude::*; + +use common::{ + self, + XmlVersion, Position, TextPosition, + is_name_start_char, is_name_char, +}; +use name::OwnedName; +use attribute::OwnedAttribute; +use namespace::NamespaceStack; + +use reader::events::XmlEvent; +use reader::config::ParserConfig; +use reader::lexer::{Lexer, Token}; + +macro_rules! gen_takes( + ($($field:ident -> $method:ident, $t:ty, $def:expr);+) => ( + $( + impl MarkupData { + #[inline] + fn $method(&mut self) -> $t { + mem::replace(&mut self.$field, $def) + } + } + )+ + ) +); + +gen_takes!( + name -> take_name, String, String::new(); + ref_data -> take_ref_data, String, String::new(); + + version -> take_version, Option, None; + encoding -> take_encoding, Option, None; + standalone -> take_standalone, Option, None; + + element_name -> take_element_name, Option, None; + + attr_name -> take_attr_name, Option, None; + attributes -> take_attributes, Vec, vec!() +); + +macro_rules! self_error( + ($this:ident; $msg:expr) => ($this.error($msg)); + ($this:ident; $fmt:expr, $($arg:expr),+) => ($this.error(format!($fmt, $($arg),+))) +); + +mod outside_tag; +mod inside_processing_instruction; +mod inside_declaration; +mod inside_doctype; +mod inside_opening_tag; +mod inside_closing_tag_name; +mod inside_comment; +mod inside_cdata; +mod inside_reference; + +static DEFAULT_VERSION: XmlVersion = XmlVersion::Version10; +static DEFAULT_ENCODING: &'static str = "UTF-8"; +static DEFAULT_STANDALONE: Option = None; + +type ElementStack = Vec; +pub type Result = super::Result; + +/// Pull-based XML parser. +pub struct PullParser { + config: ParserConfig, + lexer: Lexer, + st: State, + buf: String, + nst: NamespaceStack, + + data: MarkupData, + final_result: Option, + next_event: Option, + est: ElementStack, + pos: Vec, + + encountered_element: bool, + parsed_declaration: bool, + inside_whitespace: bool, + read_prefix_separator: bool, + pop_namespace: bool +} + +impl PullParser { + /// Returns a new parser using the given config. + pub fn new(config: ParserConfig) -> PullParser { + PullParser { + config: config, + lexer: Lexer::new(), + st: State::OutsideTag, + buf: String::new(), + nst: NamespaceStack::default(), + + data: MarkupData { + name: String::new(), + version: None, + encoding: None, + standalone: None, + ref_data: String::new(), + element_name: None, + quote: None, + attr_name: None, + attributes: Vec::new() + }, + final_result: None, + next_event: None, + est: Vec::new(), + pos: vec![TextPosition::new()], + + encountered_element: false, + parsed_declaration: false, + inside_whitespace: true, + read_prefix_separator: false, + pop_namespace: false + } + } +} + +impl Position for PullParser { + /// Returns the position of the last event produced by the parser + #[inline] + fn position(&self) -> TextPosition { + self.pos[0] + } +} + +#[derive(Clone, PartialEq)] +pub enum State { + OutsideTag, + InsideOpeningTag(OpeningTagSubstate), + InsideClosingTag(ClosingTagSubstate), + InsideProcessingInstruction(ProcessingInstructionSubstate), + InsideComment, + InsideCData, + InsideDeclaration(DeclarationSubstate), + InsideDoctype, + InsideReference(Box) +} + +#[derive(Clone, PartialEq)] +pub enum OpeningTagSubstate { + InsideName, + + InsideTag, + + InsideAttributeName, + AfterAttributeName, + + InsideAttributeValue, +} + +#[derive(Clone, PartialEq)] +pub enum ClosingTagSubstate { + CTInsideName, + CTAfterName +} + +#[derive(Clone, PartialEq)] +pub enum ProcessingInstructionSubstate { + PIInsideName, + PIInsideData +} + +#[derive(Clone, PartialEq)] +pub enum DeclarationSubstate { + BeforeVersion, + InsideVersion, + AfterVersion, + + InsideVersionValue, + AfterVersionValue, + + InsideEncoding, + AfterEncoding, + + InsideEncodingValue, + + BeforeStandaloneDecl, + InsideStandaloneDecl, + AfterStandaloneDecl, + + InsideStandaloneDeclValue, + AfterStandaloneDeclValue +} + +#[derive(PartialEq)] +enum QualifiedNameTarget { + AttributeNameTarget, + OpeningTagNameTarget, + ClosingTagNameTarget +} + +#[derive(Copy, Clone, PartialEq, Eq)] +enum QuoteToken { + SingleQuoteToken, + DoubleQuoteToken +} + +impl QuoteToken { + fn from_token(t: &Token) -> QuoteToken { + match *t { + Token::SingleQuote => QuoteToken::SingleQuoteToken, + Token::DoubleQuote => QuoteToken::DoubleQuoteToken, + _ => panic!("Unexpected token: {}", t) + } + } + + fn as_token(self) -> Token { + match self { + QuoteToken::SingleQuoteToken => Token::SingleQuote, + QuoteToken::DoubleQuoteToken => Token::DoubleQuote + } + } +} + +struct MarkupData { + name: String, // used for processing instruction name + ref_data: String, // used for reference content + + version: Option, // used for XML declaration version + encoding: Option, // used for XML declaration encoding + standalone: Option, // used for XML declaration standalone parameter + + element_name: Option, // used for element name + + quote: Option, // used to hold opening quote for attribute value + attr_name: Option, // used to hold attribute name + attributes: Vec // used to hold all accumulated attributes +} + +impl PullParser { + /// Returns next event read from the given buffer. + /// + /// This method should be always called with the same buffer. If you call it + /// providing different buffers each time, the result will be undefined. + pub fn next(&mut self, r: &mut R) -> Result { + if let Some(ref ev) = self.final_result { + return ev.clone(); + } + + if let Some(ev) = self.next_event.take() { + return ev; + } + + if self.pop_namespace { + self.pop_namespace = false; + self.nst.pop(); + } + + loop { + // While lexer gives us Ok(maybe_token) -- we loop. + // Upon having a complete XML-event -- we return from the whole function. + match self.lexer.next_token(r) { + Ok(maybe_token) => + match maybe_token { + None => break, + Some(token) => + match self.dispatch_token(token) { + None => {} // continue + Some(Ok(XmlEvent::EndDocument)) => + return { + self.next_pos(); + self.set_final_result(Ok(XmlEvent::EndDocument)) + }, + Some(Ok(xml_event)) => + return { + self.next_pos(); + Ok(xml_event) + }, + Some(Err(xml_error)) => + return { + self.next_pos(); + self.set_final_result(Err(xml_error)) + }, + } + }, + Err(lexer_error) => + return self.set_final_result(Err(lexer_error)), + } + } + + // Handle end of stream + // Forward pos to the lexer head + self.next_pos(); + let ev = if self.depth() == 0 { + if self.encountered_element && self.st == State::OutsideTag { // all is ok + Ok(XmlEvent::EndDocument) + } else if !self.encountered_element { + self_error!(self; "Unexpected end of stream: no root element found") + } else { // self.st != State::OutsideTag + self_error!(self; "Unexpected end of stream") // TODO: add expected hint? + } + } else { + self_error!(self; "Unexpected end of stream: still inside the root element") + }; + self.set_final_result(ev) + } + + // This function is to be called when a terminal event is reached. + // The function sets up the `self.final_result` into `Some(result)` and return `result`. + fn set_final_result(&mut self, result: Result) -> Result { + self.final_result = Some(result.clone()); + result + } + + #[inline] + fn error>>(&self, msg: M) -> Result { + Err((&self.lexer, msg).into()) + } + + #[inline] + fn next_pos(&mut self) { + if self.pos.len() > 1 { + self.pos.remove(0); + } else { + self.pos[0] = self.lexer.position(); + } + } + + #[inline] + fn push_pos(&mut self) { + self.pos.push(self.lexer.position()); + } + + fn dispatch_token(&mut self, t: Token) -> Option { + match self.st.clone() { + State::OutsideTag => self.outside_tag(t), + State::InsideProcessingInstruction(s) => self.inside_processing_instruction(t, s), + State::InsideDeclaration(s) => self.inside_declaration(t, s), + State::InsideDoctype => self.inside_doctype(t), + State::InsideOpeningTag(s) => self.inside_opening_tag(t, s), + State::InsideClosingTag(s) => self.inside_closing_tag_name(t, s), + State::InsideComment => self.inside_comment(t), + State::InsideCData => self.inside_cdata(t), + State::InsideReference(s) => self.inside_reference(t, *s) + } + } + + #[inline] + fn depth(&self) -> usize { + self.est.len() + } + + #[inline] + fn buf_has_data(&self) -> bool { + self.buf.len() > 0 + } + + #[inline] + fn take_buf(&mut self) -> String { + mem::replace(&mut self.buf, String::new()) + } + + #[inline] + fn append_char_continue(&mut self, c: char) -> Option { + self.buf.push(c); + None + } + + #[inline] + fn into_state(&mut self, st: State, ev: Option) -> Option { + self.st = st; + ev + } + + #[inline] + fn into_state_continue(&mut self, st: State) -> Option { + self.into_state(st, None) + } + + #[inline] + fn into_state_emit(&mut self, st: State, ev: Result) -> Option { + self.into_state(st, Some(ev)) + } + + /// Dispatches tokens in order to process qualified name. If qualified name cannot be parsed, + /// an error is returned. + /// + /// # Parameters + /// * `t` --- next token; + /// * `on_name` --- a callback which is executed when whitespace is encountered. + fn read_qualified_name(&mut self, t: Token, target: QualifiedNameTarget, on_name: F) -> Option + where F: Fn(&mut PullParser, Token, OwnedName) -> Option { + // We can get here for the first time only when self.data.name contains zero or one character, + // but first character cannot be a colon anyway + if self.buf.len() <= 1 { + self.read_prefix_separator = false; + } + + let invoke_callback = |this: &mut PullParser, t| { + let name = this.take_buf(); + match name.parse() { + Ok(name) => on_name(this, t, name), + Err(_) => Some(self_error!(this; "Qualified name is invalid: {}", name)) + } + }; + + match t { + // There can be only one colon, and not as the first character + Token::Character(':') if self.buf_has_data() && !self.read_prefix_separator => { + self.buf.push(':'); + self.read_prefix_separator = true; + None + } + + Token::Character(c) if c != ':' && (!self.buf_has_data() && is_name_start_char(c) || + self.buf_has_data() && is_name_char(c)) => + self.append_char_continue(c), + + Token::EqualsSign if target == QualifiedNameTarget::AttributeNameTarget => invoke_callback(self, t), + + Token::EmptyTagEnd if target == QualifiedNameTarget::OpeningTagNameTarget => invoke_callback(self, t), + + Token::TagEnd if target == QualifiedNameTarget::OpeningTagNameTarget || + target == QualifiedNameTarget::ClosingTagNameTarget => invoke_callback(self, t), + + Token::Whitespace(_) => invoke_callback(self, t), + + _ => Some(self_error!(self; "Unexpected token inside qualified name: {}", t)) + } + } + + /// Dispatches tokens in order to process attribute value. + /// + /// # Parameters + /// * `t` --- next token; + /// * `on_value` --- a callback which is called when terminating quote is encountered. + fn read_attribute_value(&mut self, t: Token, on_value: F) -> Option + where F: Fn(&mut PullParser, String) -> Option { + match t { + Token::Whitespace(_) if self.data.quote.is_none() => None, // skip leading whitespace + + Token::DoubleQuote | Token::SingleQuote => match self.data.quote { + None => { // Entered attribute value + self.data.quote = Some(QuoteToken::from_token(&t)); + None + } + Some(q) if q.as_token() == t => { + self.data.quote = None; + let value = self.take_buf(); + on_value(self, value) + } + _ => { + t.push_to_string(&mut self.buf); + None + } + }, + + Token::ReferenceStart => { + let st = Box::new(self.st.clone()); + self.into_state_continue(State::InsideReference(st)) + } + + Token::OpeningTagStart => + Some(self_error!(self; "Unexpected token inside attribute value: <")), + + // Every character except " and ' and < is okay + _ => { + t.push_to_string(&mut self.buf); + None + } + } + } + + fn emit_start_element(&mut self, emit_end_element: bool) -> Option { + let mut name = self.data.take_element_name().unwrap(); + let mut attributes = self.data.take_attributes(); + + // check whether the name prefix is bound and fix its namespace + match self.nst.get(name.borrow().prefix_repr()) { + Some("") => name.namespace = None, // default namespace + Some(ns) => name.namespace = Some(ns.into()), + None => return Some(self_error!(self; "Element {} prefix is unbound", name)) + } + + // check and fix accumulated attributes prefixes + for attr in attributes.iter_mut() { + if let Some(ref pfx) = attr.name.prefix { + let new_ns = match self.nst.get(pfx) { + Some("") => None, // default namespace + Some(ns) => Some(ns.into()), + None => return Some(self_error!(self; "Attribute {} prefix is unbound", attr.name)) + }; + attr.name.namespace = new_ns; + } + } + + if emit_end_element { + self.pop_namespace = true; + self.next_event = Some(Ok(XmlEvent::EndElement { + name: name.clone() + })); + } else { + self.est.push(name.clone()); + } + let namespace = self.nst.squash(); + self.into_state_emit(State::OutsideTag, Ok(XmlEvent::StartElement { + name: name, + attributes: attributes, + namespace: namespace + })) + } + + fn emit_end_element(&mut self) -> Option { + let mut name = self.data.take_element_name().unwrap(); + + // check whether the name prefix is bound and fix its namespace + match self.nst.get(name.borrow().prefix_repr()) { + Some("") => name.namespace = None, // default namespace + Some(ns) => name.namespace = Some(ns.into()), + None => return Some(self_error!(self; "Element {} prefix is unbound", name)) + } + + let op_name = self.est.pop().unwrap(); + + if name == op_name { + self.pop_namespace = true; + self.into_state_emit(State::OutsideTag, Ok(XmlEvent::EndElement { name: name })) + } else { + Some(self_error!(self; "Unexpected closing tag: {}, expected {}", name, op_name)) + } + } + +} + +#[cfg(test)] +mod tests { + use std::io::BufReader; + + use common::{Position, TextPosition}; + use name::OwnedName; + use attribute::OwnedAttribute; + use reader::parser::PullParser; + use reader::ParserConfig; + use reader::events::XmlEvent; + + fn new_parser() -> PullParser { + PullParser::new(ParserConfig::new()) + } + + macro_rules! expect_event( + ($r:expr, $p:expr, $t:pat) => ( + match $p.next(&mut $r) { + $t => {} + e => panic!("Unexpected event: {:?}", e) + } + ); + ($r:expr, $p:expr, $t:pat => $c:expr ) => ( + match $p.next(&mut $r) { + $t if $c => {} + e => panic!("Unexpected event: {:?}", e) + } + ) + ); + + macro_rules! test_data( + ($d:expr) => ({ + static DATA: &'static str = $d; + let r = BufReader::new(DATA.as_bytes()); + let p = new_parser(); + (r, p) + }) + ); + + #[test] + fn issue_3_semicolon_in_attribute_value() { + let (mut r, mut p) = test_data!(r#" + + "#); + + expect_event!(r, p, Ok(XmlEvent::StartDocument { .. })); + expect_event!(r, p, Ok(XmlEvent::StartElement { ref name, ref attributes, ref namespace }) => + *name == OwnedName::local("a") && + attributes.len() == 1 && + attributes[0] == OwnedAttribute::new(OwnedName::local("attr"), "zzz;zzz") && + namespace.is_essentially_empty() + ); + expect_event!(r, p, Ok(XmlEvent::EndElement { ref name }) => *name == OwnedName::local("a")); + expect_event!(r, p, Ok(XmlEvent::EndDocument)); + } + + #[test] + fn opening_tag_in_attribute_value() { + let (mut r, mut p) = test_data!(r#" + + "#); + + expect_event!(r, p, Ok(XmlEvent::StartDocument { .. })); + expect_event!(r, p, Err(ref e) => + e.msg() == "Unexpected token inside attribute value: <" && + e.position() == TextPosition { row: 1, column: 24 } + ); + } +} diff --git a/third_party/rust/xml-rs/src/reader/parser/outside_tag.rs b/third_party/rust/xml-rs/src/reader/parser/outside_tag.rs new file mode 100644 index 000000000000..8ddc515b3b7d --- /dev/null +++ b/third_party/rust/xml-rs/src/reader/parser/outside_tag.rs @@ -0,0 +1,130 @@ +use common::is_whitespace_char; + +use reader::events::XmlEvent; +use reader::lexer::Token; + +use super::{ + Result, PullParser, State, ClosingTagSubstate, OpeningTagSubstate, + ProcessingInstructionSubstate, DEFAULT_VERSION, DEFAULT_ENCODING, DEFAULT_STANDALONE +}; + +impl PullParser { + pub fn outside_tag(&mut self, t: Token) -> Option { + match t { + Token::ReferenceStart => + self.into_state_continue(State::InsideReference(Box::new(State::OutsideTag))), + + Token::Whitespace(_) if self.depth() == 0 => None, // skip whitespace outside of the root element + + _ if t.contains_char_data() && self.depth() == 0 => + Some(self_error!(self; "Unexpected characters outside the root element: {}", t)), + + Token::Whitespace(_) if self.config.trim_whitespace && !self.buf_has_data() => None, + + Token::Whitespace(c) => { + if !self.buf_has_data() { + self.push_pos(); + } + self.append_char_continue(c) + } + + _ if t.contains_char_data() => { // Non-whitespace char data + if !self.buf_has_data() { + self.push_pos(); + } + self.inside_whitespace = false; + t.push_to_string(&mut self.buf); + None + } + + Token::ReferenceEnd => { // Semi-colon in a text outside an entity + self.inside_whitespace = false; + Token::ReferenceEnd.push_to_string(&mut self.buf); + None + } + + Token::CommentStart if self.config.coalesce_characters && self.config.ignore_comments => { + // We need to switch the lexer into a comment mode inside comments + self.lexer.inside_comment(); + self.into_state_continue(State::InsideComment) + } + + Token::CDataStart if self.config.coalesce_characters && self.config.cdata_to_characters => { + if !self.buf_has_data() { + self.push_pos(); + } + // We need to disable lexing errors inside CDATA + self.lexer.disable_errors(); + self.into_state_continue(State::InsideCData) + } + + _ => { + // Encountered some markup event, flush the buffer as characters + // or a whitespace + let mut next_event = if self.buf_has_data() { + let buf = self.take_buf(); + if self.inside_whitespace && self.config.trim_whitespace { + None + } else if self.inside_whitespace && !self.config.whitespace_to_characters { + Some(Ok(XmlEvent::Whitespace(buf))) + } else if self.config.trim_whitespace { + Some(Ok(XmlEvent::Characters(buf.trim_matches(is_whitespace_char).into()))) + } else { + Some(Ok(XmlEvent::Characters(buf))) + } + } else { None }; + self.inside_whitespace = true; // Reset inside_whitespace flag + self.push_pos(); + match t { + Token::ProcessingInstructionStart => + self.into_state(State::InsideProcessingInstruction(ProcessingInstructionSubstate::PIInsideName), next_event), + + Token::DoctypeStart if !self.encountered_element => { + // We don't have a doctype event so skip this position + // FIXME: update when we have a doctype event + self.next_pos(); + self.lexer.disable_errors(); + self.into_state(State::InsideDoctype, next_event) + } + + Token::OpeningTagStart => { + // If declaration was not parsed and we have encountered an element, + // emit this declaration as the next event. + if !self.parsed_declaration { + self.parsed_declaration = true; + let sd_event = XmlEvent::StartDocument { + version: DEFAULT_VERSION, + encoding: DEFAULT_ENCODING.into(), + standalone: DEFAULT_STANDALONE + }; + // next_event is always none here because we're outside of + // the root element + next_event = Some(Ok(sd_event)); + self.push_pos(); + } + self.encountered_element = true; + self.nst.push_empty(); + self.into_state(State::InsideOpeningTag(OpeningTagSubstate::InsideName), next_event) + } + + Token::ClosingTagStart if self.depth() > 0 => + self.into_state(State::InsideClosingTag(ClosingTagSubstate::CTInsideName), next_event), + + Token::CommentStart => { + // We need to switch the lexer into a comment mode inside comments + self.lexer.inside_comment(); + self.into_state(State::InsideComment, next_event) + } + + Token::CDataStart => { + // We need to disable lexing errors inside CDATA + self.lexer.disable_errors(); + self.into_state(State::InsideCData, next_event) + } + + _ => Some(self_error!(self; "Unexpected token: {}", t)) + } + } + } + } +} diff --git a/third_party/rust/xml-rs/src/util.rs b/third_party/rust/xml-rs/src/util.rs new file mode 100644 index 000000000000..23fee04eed60 --- /dev/null +++ b/third_party/rust/xml-rs/src/util.rs @@ -0,0 +1,107 @@ +use std::io::{self, Read}; +use std::str; +use std::fmt; + +#[derive(Debug)] +pub enum CharReadError { + UnexpectedEof, + Utf8(str::Utf8Error), + Io(io::Error) +} + +impl From for CharReadError { + fn from(e: str::Utf8Error) -> CharReadError { + CharReadError::Utf8(e) + } +} + +impl From for CharReadError { + fn from(e: io::Error) -> CharReadError { + CharReadError::Io(e) + } +} + +impl fmt::Display for CharReadError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use self::CharReadError::*; + match *self { + UnexpectedEof => write!(f, "unexpected end of stream"), + Utf8(ref e) => write!(f, "UTF-8 decoding error: {}", e), + Io(ref e) => write!(f, "I/O error: {}", e) + } + } +} + +pub fn next_char_from(source: &mut R) -> Result, CharReadError> { + const MAX_CODEPOINT_LEN: usize = 4; + + let mut bytes = source.bytes(); + let mut buf = [0u8; MAX_CODEPOINT_LEN]; + let mut pos = 0; + + loop { + let next = match bytes.next() { + Some(Ok(b)) => b, + Some(Err(e)) => return Err(e.into()), + None if pos == 0 => return Ok(None), + None => return Err(CharReadError::UnexpectedEof) + }; + buf[pos] = next; + pos += 1; + + match str::from_utf8(&buf[..pos]) { + Ok(s) => return Ok(s.chars().next()), // always Some(..) + Err(_) if pos < MAX_CODEPOINT_LEN => {}, + Err(e) => return Err(e.into()) + } + } +} + +#[cfg(test)] +mod tests { + #[test] + fn test_next_char_from() { + use std::io; + use std::error::Error; + + let mut bytes: &[u8] = "correct".as_bytes(); // correct ASCII + assert_eq!(super::next_char_from(&mut bytes).unwrap(), Some('c')); + + let mut bytes: &[u8] = "правильно".as_bytes(); // correct BMP + assert_eq!(super::next_char_from(&mut bytes).unwrap(), Some('п')); + + let mut bytes: &[u8] = "😊".as_bytes(); // correct non-BMP + assert_eq!(super::next_char_from(&mut bytes).unwrap(), Some('😊')); + + let mut bytes: &[u8] = b""; // empty + assert_eq!(super::next_char_from(&mut bytes).unwrap(), None); + + let mut bytes: &[u8] = b"\xf0\x9f\x98"; // incomplete code point + match super::next_char_from(&mut bytes).unwrap_err() { + super::CharReadError::UnexpectedEof => {}, + e => panic!("Unexpected result: {:?}", e) + }; + + let mut bytes: &[u8] = b"\xff\x9f\x98\x32"; // invalid code point + match super::next_char_from(&mut bytes).unwrap_err() { + super::CharReadError::Utf8(_) => {}, + e => panic!("Unexpected result: {:?}", e) + }; + + + // error during read + struct ErrorReader; + impl io::Read for ErrorReader { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + Err(io::Error::new(io::ErrorKind::Other, "test error")) + } + } + + let mut r = ErrorReader; + match super::next_char_from(&mut r).unwrap_err() { + super::CharReadError::Io(ref e) if e.kind() == io::ErrorKind::Other && + e.description() == "test error" => {}, + e => panic!("Unexpected result: {:?}", e) + } + } +} diff --git a/third_party/rust/xml-rs/src/writer/config.rs b/third_party/rust/xml-rs/src/writer/config.rs new file mode 100644 index 000000000000..c3bcf2f67b47 --- /dev/null +++ b/third_party/rust/xml-rs/src/writer/config.rs @@ -0,0 +1,146 @@ +//! Contains emitter configuration structure. + +use std::io::Write; +use std::borrow::Cow; + +use writer::EventWriter; + +/// Emitter configuration structure. +/// +/// This structure contains various options which control XML document emitter behavior. +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct EmitterConfig { + /// Line separator used to separate lines in formatted output. Default is `"\n"`. + pub line_separator: Cow<'static, str>, + + /// A string which will be used for a single level of indentation. Default is `" "` + /// (two spaces). + pub indent_string: Cow<'static, str>, + + /// Whether or not the emitted document should be indented. Default is false. + /// + /// The emitter is capable to perform automatic indentation of the emitted XML document. + /// It is done in stream-like fashion and does not require the knowledge of the whole + /// document in advance. + /// + /// Sometimes, however, automatic indentation is undesirable, e.g. when you want to keep + /// existing layout when processing an existing XML document. Also the indentiation algorithm + /// is not thoroughly tested. Hence by default it is disabled. + pub perform_indent: bool, + + /// Whether or not characters in output events will be escaped. Default is true. + /// + /// The emitter can automatically escape characters which can't appear in PCDATA sections + /// or element attributes of an XML document, like `<` or `"` (in attributes). This may + /// introduce some overhead because then every corresponding piece of character data + /// should be scanned for invalid characters. + /// + /// If this option is disabled, the XML writer may produce non-well-formed documents, so + /// use `false` value for this option with care. + pub perform_escaping: bool, + + /// Whether or not to write XML document declaration at the beginning of a document. + /// Default is true. + /// + /// This option controls whether the document declaration should be emitted automatically + /// before a root element is written if it was not emitted explicitly by the user. + pub write_document_declaration: bool, + + /// Whether or not to convert elements with empty content to empty elements. Default is true. + /// + /// This option allows turning elements like `` (an element with empty content) + /// into `` (an empty element). + pub normalize_empty_elements: bool, + + /// Whether or not to emit CDATA events as plain characters. Default is false. + /// + /// This option forces the emitter to convert CDATA events into regular character events, + /// performing all the necessary escaping beforehand. This may be occasionally useful + /// for feeding the document into incorrect parsers which do not support CDATA. + pub cdata_to_characters: bool, + + /// Whether or not to keep element names to support `EndElement` events without explicit names. + /// Default is true. + /// + /// This option makes the emitter to keep names of written elements in order to allow + /// omitting names when writing closing element tags. This could incur some memory overhead. + pub keep_element_names_stack: bool, + + /// Whether or not to automatically insert leading and trailing spaces in emitted comments, + /// if necessary. Default is true. + /// + /// This is a convenience option in order for the user not to append spaces before and after + /// comments text in order to get more pretty comments: `` instead of + /// ``. + pub autopad_comments: bool, +} + +impl EmitterConfig { + /// Creates an emitter configuration with default values. + /// + /// You can tweak default options with builder-like pattern: + /// + /// ```rust + /// use xml::writer::EmitterConfig; + /// + /// let config = EmitterConfig::new() + /// .line_separator("\r\n") + /// .perform_indent(true) + /// .normalize_empty_elements(false); + /// ``` + #[inline] + pub fn new() -> EmitterConfig { + EmitterConfig { + line_separator: "\n".into(), + indent_string: " ".into(), // two spaces + perform_indent: false, + perform_escaping: true, + write_document_declaration: true, + normalize_empty_elements: true, + cdata_to_characters: false, + keep_element_names_stack: true, + autopad_comments: true + } + } + + /// Creates an XML writer with this configuration. + /// + /// This is a convenience method for configuring and creating a writer at the same time: + /// + /// ```rust + /// use xml::writer::EmitterConfig; + /// + /// let mut target: Vec = Vec::new(); + /// + /// let writer = EmitterConfig::new() + /// .line_separator("\r\n") + /// .perform_indent(true) + /// .normalize_empty_elements(false) + /// .create_writer(&mut target); + /// ``` + /// + /// This method is exactly equivalent to calling `EventWriter::new_with_config()` with + /// this configuration object. + #[inline] + pub fn create_writer(self, sink: W) -> EventWriter { + EventWriter::new_with_config(sink, self) + } +} + +impl Default for EmitterConfig { + #[inline] + fn default() -> EmitterConfig { + EmitterConfig::new() + } +} + +gen_setters!(EmitterConfig, + line_separator: into Cow<'static, str>, + indent_string: into Cow<'static, str>, + perform_indent: val bool, + write_document_declaration: val bool, + normalize_empty_elements: val bool, + cdata_to_characters: val bool, + keep_element_names_stack: val bool, + autopad_comments: val bool +); diff --git a/third_party/rust/xml-rs/src/writer/emitter.rs b/third_party/rust/xml-rs/src/writer/emitter.rs new file mode 100644 index 000000000000..d54a360354fa --- /dev/null +++ b/third_party/rust/xml-rs/src/writer/emitter.rs @@ -0,0 +1,427 @@ +use std::io; +use std::io::prelude::*; +use std::fmt; +use std::result; +use std::borrow::Cow; + +use common; +use name::{Name, OwnedName}; +use attribute::Attribute; +use escape::{escape_str_attribute, escape_str_pcdata}; +use common::XmlVersion; +use namespace::{NamespaceStack, NS_NO_PREFIX, NS_EMPTY_URI, NS_XMLNS_PREFIX, NS_XML_PREFIX}; + +use writer::config::EmitterConfig; + +/// An error which may be returned by `XmlWriter` when writing XML events. +#[derive(Debug)] +pub enum EmitterError { + /// An I/O error occured in the underlying `Write` instance. + Io(io::Error), + + /// Document declaration has already been written to the output stream. + DocumentStartAlreadyEmitted, + + /// The name of the last opening element is not available. + LastElementNameNotAvailable, + + /// The name of the last opening element is not equal to the name of the provided + /// closing element. + EndElementNameIsNotEqualToLastStartElementName, + + /// End element name is not specified when it is needed, for example, when automatic + /// closing is not enabled in configuration. + EndElementNameIsNotSpecified +} + +impl From for EmitterError { + fn from(err: io::Error) -> EmitterError { + EmitterError::Io(err) + } +} + +impl fmt::Display for EmitterError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + try!(write!(f, "emitter error: ")); + match *self { + EmitterError::Io(ref e) => + write!(f, "I/O error: {}", e), + EmitterError::DocumentStartAlreadyEmitted => + write!(f, "document start event has already been emitted"), + EmitterError::LastElementNameNotAvailable => + write!(f, "last element name is not available"), + EmitterError::EndElementNameIsNotEqualToLastStartElementName => + write!(f, "end element name is not equal to last start element name"), + EmitterError::EndElementNameIsNotSpecified => + write!(f, "end element name is not specified and can't be inferred") + } + } +} + +/// A result type yielded by `XmlWriter`. +pub type Result = result::Result; + +// TODO: split into a low-level fast writer without any checks and formatting logic and a +// high-level indenting validating writer +pub struct Emitter { + config: EmitterConfig, + + nst: NamespaceStack, + + indent_level: usize, + indent_stack: Vec, + + element_names: Vec, + + start_document_emitted: bool, + just_wrote_start_element: bool +} + +impl Emitter { + pub fn new(config: EmitterConfig) -> Emitter { + Emitter { + config: config, + + nst: NamespaceStack::empty(), + + indent_level: 0, + indent_stack: vec!(IndentFlags::empty()), + + element_names: Vec::new(), + + start_document_emitted: false, + just_wrote_start_element: false + } + } +} + +macro_rules! try_chain( + (ok_unit $e:expr) => ({try!($e); Ok(())}); + (ignore $e:expr) => (try!($e)); + ($e:expr) => (Ok(try!($e))); + ($e:expr, $($rest:tt)*) => ({ + try!($e); + try_chain!($($rest)*) + }) +); + +macro_rules! wrapped_with( + ($_self:ident; $before_name:ident ($arg:expr) and $after_name:ident, $body:expr) => ({ + try!($_self.$before_name($arg)); + let result = $body; + $_self.$after_name(); + result + }) +); + +macro_rules! if_present( + ($opt:ident, $body:expr) => ($opt.map(|$opt| $body).unwrap_or(Ok(()))) +); + +bitflags!( + flags IndentFlags: u8 { + const WROTE_NOTHING = 0, + const WROTE_MARKUP = 1, + const WROTE_TEXT = 2 + } +); + +impl Emitter { + /// Returns the current state of namespaces. + #[inline] + pub fn namespace_stack_mut(&mut self) -> &mut NamespaceStack { + &mut self.nst + } + + #[inline] + fn wrote_text(&self) -> bool { + self.indent_stack.last().unwrap().contains(WROTE_TEXT) + } + + #[inline] + fn wrote_markup(&self) -> bool { + self.indent_stack.last().unwrap().contains(WROTE_MARKUP) + } + + #[inline] + fn set_wrote_text(&mut self) { + *self.indent_stack.last_mut().unwrap() = WROTE_TEXT; + } + + #[inline] + fn set_wrote_markup(&mut self) { + *self.indent_stack.last_mut().unwrap() = WROTE_MARKUP; + } + + #[inline] + fn reset_state(&mut self) { + *self.indent_stack.last_mut().unwrap() = WROTE_NOTHING; + } + + fn write_newline(&mut self, target: &mut W, level: usize) -> Result<()> { + try!(target.write(self.config.line_separator.as_bytes())); + for _ in 0..level { + try!(target.write(self.config.indent_string.as_bytes())); + } + Ok(()) + } + + fn before_markup(&mut self, target: &mut W) -> Result<()> { + if self.config.perform_indent && !self.wrote_text() && + (self.indent_level > 0 || self.wrote_markup()) { + let indent_level = self.indent_level; + try!(self.write_newline(target, indent_level)); + if self.indent_level > 0 && self.config.indent_string.len() > 0 { + self.after_markup(); + } + } + Ok(()) + } + + fn after_markup(&mut self) { + self.set_wrote_markup(); + } + + fn before_start_element(&mut self, target: &mut W) -> Result<()> { + try!(self.before_markup(target)); + self.indent_stack.push(WROTE_NOTHING); + Ok(()) + } + + fn after_start_element(&mut self) { + self.after_markup(); + self.indent_level += 1; + } + + fn before_end_element(&mut self, target: &mut W) -> Result<()> { + if self.config.perform_indent && self.indent_level > 0 && self.wrote_markup() && + !self.wrote_text() { + let indent_level = self.indent_level; + self.write_newline(target, indent_level - 1) + } else { + Ok(()) + } + } + + fn after_end_element(&mut self) { + if self.indent_level > 0 { + self.indent_level -= 1; + self.indent_stack.pop(); + } + self.set_wrote_markup(); + } + + fn after_text(&mut self) { + self.set_wrote_text(); + } + + pub fn emit_start_document(&mut self, target: &mut W, + version: XmlVersion, + encoding: &str, + standalone: Option) -> Result<()> { + if self.start_document_emitted { + return Err(EmitterError::DocumentStartAlreadyEmitted); + } + self.start_document_emitted = true; + + wrapped_with!(self; before_markup(target) and after_markup, + try_chain! { + write!(target, "") + } + ) + } + + fn check_document_started(&mut self, target: &mut W) -> Result<()> { + if !self.start_document_emitted && self.config.write_document_declaration { + self.emit_start_document(target, common::XmlVersion::Version10, "utf-8", None) + } else { + Ok(()) + } + } + + fn fix_non_empty_element(&mut self, target: &mut W) -> Result<()> { + if self.config.normalize_empty_elements && self.just_wrote_start_element { + self.just_wrote_start_element = false; + target.write(b">").map(|_| ()).map_err(From::from) + } else { + Ok(()) + } + } + + pub fn emit_processing_instruction(&mut self, + target: &mut W, + name: &str, + data: Option<&str>) -> Result<()> { + try!(self.check_document_started(target)); + try!(self.fix_non_empty_element(target)); + + wrapped_with!(self; before_markup(target) and after_markup, + try_chain! { + write!(target, "") + } + ) + } + + fn emit_start_element_initial(&mut self, target: &mut W, + name: Name, + attributes: &[Attribute]) -> Result<()> + where W: Write + { + try_chain! { + self.check_document_started(target), + self.fix_non_empty_element(target), + self.before_start_element(target), + write!(target, "<{}", name.repr_display()), + self.emit_current_namespace_attributes(target), + ignore self.emit_attributes(target, attributes) + } + self.after_start_element(); + Ok(()) + } + + pub fn emit_start_element(&mut self, target: &mut W, + name: Name, + attributes: &[Attribute]) -> Result<()> + where W: Write + { + if self.config.keep_element_names_stack { + self.element_names.push(name.to_owned()); + } + try_chain! { + self.emit_start_element_initial(target, name, attributes), + { + self.just_wrote_start_element = true; + if self.config.normalize_empty_elements { Ok(()) } + else { write!(target, ">") } + } + } + } + + pub fn emit_current_namespace_attributes(&mut self, target: &mut W) -> Result<()> + where W: Write + { + for (prefix, uri) in self.nst.peek() { + try!(match prefix { + // internal namespaces are not emitted + NS_XMLNS_PREFIX | NS_XML_PREFIX => Ok(()), + //// there is already a namespace binding with this prefix in scope + //prefix if self.nst.get(prefix) == Some(uri) => Ok(()), + // emit xmlns only if it is overridden + NS_NO_PREFIX => if uri != NS_EMPTY_URI { + write!(target, " xmlns=\"{}\"", uri) + } else { Ok(()) }, + // everything else + prefix => write!(target, " xmlns:{}=\"{}\"", prefix, uri) + }); + } + Ok(()) + } + + pub fn emit_attributes(&mut self, target: &mut W, + attributes: &[Attribute]) -> Result<()> { + for attr in attributes.iter() { + try!(write!( + target, " {}=\"{}\"", + attr.name.repr_display(), + if self.config.perform_escaping { escape_str_attribute(attr.value) } + else { Cow::Borrowed(attr.value) } + )) + } + Ok(()) + } + + pub fn emit_end_element(&mut self, target: &mut W, + name: Option) -> Result<()> { + let owned_name = if self.config.keep_element_names_stack { + Some(try!(self.element_names.pop().ok_or(EmitterError::LastElementNameNotAvailable))) + } else { + None + }; + + // Check that last started element name equals to the provided name, if there are both + if let Some(ref last_name) = owned_name { + if let Some(ref name) = name { + if last_name.borrow() != *name { + return Err(EmitterError::EndElementNameIsNotEqualToLastStartElementName); + } + } + } + + if let Some(name) = owned_name.as_ref().map(|n| n.borrow()).or(name) { + if self.config.normalize_empty_elements && self.just_wrote_start_element { + self.just_wrote_start_element = false; + // TODO: make this space configurable + let result = target.write(b" />").map_err(From::from); + self.after_end_element(); + result.map(|_| ()) + } else { + self.just_wrote_start_element = false; + wrapped_with!(self; before_end_element(target) and after_end_element, + write!(target, "", name.repr_display()).map_err(From::from) + ) + } + } else { + Err(EmitterError::EndElementNameIsNotSpecified) + } + } + + pub fn emit_cdata(&mut self, target: &mut W, content: &str) -> Result<()> { + try!(self.fix_non_empty_element(target)); + if self.config.cdata_to_characters { + self.emit_characters(target, content) + } else { + // TODO: escape ']]>' characters in CDATA as two adjacent CDATA blocks + try_chain! { + target.write(b"") + }; + self.after_text(); + Ok(()) + } + } + + pub fn emit_characters(&mut self, target: &mut W, + content: &str) -> Result<()> { + try!(self.fix_non_empty_element(target)); + try!(target.write( + (if self.config.perform_escaping { escape_str_pcdata(content) } + else { Cow::Borrowed(content) }).as_bytes() + )); + self.after_text(); + Ok(()) + } + + pub fn emit_comment(&mut self, target: &mut W, content: &str) -> Result<()> { + try!(self.fix_non_empty_element(target)); + + // TODO: add escaping dashes at the end of the comment + + let autopad_comments = self.config.autopad_comments; + let write = |target: &mut W| -> Result<()> { + try_chain! { + target.write(b"") + } + }; + + wrapped_with!(self; before_markup(target) and after_markup, + write(target) + ) + } +} diff --git a/third_party/rust/xml-rs/src/writer/events.rs b/third_party/rust/xml-rs/src/writer/events.rs new file mode 100644 index 000000000000..7ed610059a3c --- /dev/null +++ b/third_party/rust/xml-rs/src/writer/events.rs @@ -0,0 +1,240 @@ +//! Contains `XmlEvent` datatype, instances of which are consumed by the writer. + +use std::borrow::Cow; + +use name::Name; +use attribute::Attribute; +use common::XmlVersion; +use namespace::{Namespace, NS_NO_PREFIX}; + +/// A part of an XML output stream. +/// +/// Objects of this enum are consumed by `EventWriter`. They correspond to different parts of +/// an XML document. +pub enum XmlEvent<'a> { + /// Corresponds to XML document declaration. + /// + /// This event should always be written before any other event. If it is not written + /// at all, a default XML declaration will be outputted if the corresponding option + /// is set in the configuration. Otherwise an error will be returned. + StartDocument { + /// XML version. + /// + /// Defaults to `XmlVersion::Version10`. + version: XmlVersion, + + /// XML document encoding. + /// + /// Defaults to `Some("UTF-8")`. + encoding: Option<&'a str>, + + /// XML standalone declaration. + /// + /// Defaults to `None`. + standalone: Option + }, + + /// Denotes an XML processing instruction. + ProcessingInstruction { + /// Processing instruction target. + name: &'a str, + + /// Processing instruction content. + data: Option<&'a str> + }, + + /// Denotes a beginning of an XML element. + StartElement { + /// Qualified name of the element. + name: Name<'a>, + + /// A list of attributes associated with the element. + /// + /// Currently attributes are not checked for duplicates (TODO). Attribute values + /// will be escaped, and all characters invalid for attribute values like `"` or `<` + /// will be changed into character entities. + attributes: Cow<'a, [Attribute<'a>]>, + + /// Contents of the namespace mapping at this point of the document. + /// + /// This mapping will be inspected for "new" entries, and if at this point of the document + /// a particular pair of prefix and namespace URI is already defined, no namespace + /// attributes will be emitted. + namespace: Cow<'a, Namespace>, + }, + + /// Denotes an end of an XML element. + EndElement { + /// Optional qualified name of the element. + /// + /// If `None`, then it is assumed that the element name should be the last valid one. + /// If `Some` and element names tracking is enabled, then the writer will check it for + /// correctness. + name: Option> + }, + + /// Denotes CDATA content. + /// + /// This event contains unparsed data, and no escaping will be performed when writing it + /// to the output stream. + CData(&'a str), + + /// Denotes a comment. + /// + /// The string will be checked for invalid sequences and error will be returned by the + /// write operation + Comment(&'a str), + + /// Denotes character data outside of tags. + /// + /// Contents of this event will be escaped if `perform_escaping` option is enabled, + /// that is, every character invalid for PCDATA will appear as a character entity. + Characters(&'a str) +} + +impl<'a> XmlEvent<'a> { + /// Returns an writer event for a processing instruction. + #[inline] + pub fn processing_instruction(name: &'a str, data: Option<&'a str>) -> XmlEvent<'a> { + XmlEvent::ProcessingInstruction { name: name, data: data } + } + + /// Returns a builder for a starting element. + /// + /// This builder can then be used to tweak attributes and namespace starting at + /// this element. + #[inline] + pub fn start_element(name: S) -> StartElementBuilder<'a> where S: Into> { + StartElementBuilder { + name: name.into(), + attributes: Vec::new(), + namespace: Namespace::empty().into() + } + } + + /// Returns a builder for an closing element. + /// + /// This method, unline `start_element()`, does not accept a name because by default + /// the writer is able to determine it automatically. However, when this functionality + /// is disabled, it is possible to specify the name with `name()` method on the builder. + #[inline] + pub fn end_element() -> EndElementBuilder<'a> { + EndElementBuilder { name: None } + } + + /// Returns a CDATA event. + /// + /// Naturally, the provided string won't be escaped, except for closing CDATA token `]]>` + /// (depending on the configuration). + #[inline] + pub fn cdata(data: &'a str) -> XmlEvent<'a> { XmlEvent::CData(data) } + + /// Returns a regular characters (PCDATA) event. + /// + /// All offending symbols, in particular, `&` and `<`, will be escaped by the writer. + #[inline] + pub fn characters(data: &'a str) -> XmlEvent<'a> { XmlEvent::Characters(data) } + + /// Returns a comment event. + #[inline] + pub fn comment(data: &'a str) -> XmlEvent<'a> { XmlEvent::Comment(data) } +} + +impl<'a> From<&'a str> for XmlEvent<'a> { + #[inline] + fn from(s: &'a str) -> XmlEvent<'a> { XmlEvent::Characters(s) } +} + +pub struct EndElementBuilder<'a> { + name: Option> +} + +/// A builder for a closing element event. +impl<'a> EndElementBuilder<'a> { + /// Sets the name of this closing element. + /// + /// Usually the writer is able to determine closing element names automatically. If + /// this functionality is enabled (by default it is), then this name is checked for correctness. + /// It is possible, however, to disable such behavior; then the user must ensure that + /// closing element name is correct manually. + #[inline] + pub fn name(mut self, name: N) -> EndElementBuilder<'a> where N: Into> { + self.name = Some(name.into()); + self + } +} + +impl<'a> From> for XmlEvent<'a> { + fn from(b: EndElementBuilder<'a>) -> XmlEvent<'a> { + XmlEvent::EndElement { name: b.name } + } +} + +/// A builder for a starting element event. +pub struct StartElementBuilder<'a> { + name: Name<'a>, + attributes: Vec>, + namespace: Namespace +} + +impl<'a> StartElementBuilder<'a> { + /// Sets an attribute value of this element to the given string. + /// + /// This method can be used to add attributes to the starting element. Name is a qualified + /// name; its namespace is ignored, but its prefix is checked for correctness, that is, + /// it is checked that the prefix is bound to some namespace in the current context. + /// + /// Currently attributes are not checked for duplicates. Note that duplicate attributes + /// are a violation of XML document well-formedness. + /// + /// The writer checks that you don't specify reserved prefix names, for example `xmlns`. + #[inline] + pub fn attr(mut self, name: N, value: &'a str) -> StartElementBuilder<'a> + where N: Into> + { + self.attributes.push(Attribute::new(name.into(), value)); + self + } + + /// Adds a namespace to the current namespace context. + /// + /// If no namespace URI was bound to the provided prefix at this point of the document, + /// then the mapping from the prefix to the provided namespace URI will be written as + /// a part of this element attribute set. + /// + /// If the same namespace URI was bound to the provided prefix at this point of the document, + /// then no namespace attributes will be emitted. + /// + /// If some other namespace URI was bound to the provided prefix at this point of the document, + /// then another binding will be added as a part of this element attribute set, shadowing + /// the outer binding. + #[inline] + pub fn ns(mut self, prefix: S1, uri: S2) -> StartElementBuilder<'a> + where S1: Into, S2: Into + { + self.namespace.put(prefix, uri); + self + } + + /// Adds a default namespace mapping to the current namespace context. + /// + /// Same rules as for `ns()` are also valid for the default namespace mapping. + #[inline] + pub fn default_ns(mut self, uri: S) -> StartElementBuilder<'a> + where S: Into + { + self.namespace.put(NS_NO_PREFIX, uri); + self + } +} + +impl<'a> From> for XmlEvent<'a> { + #[inline] + fn from(b: StartElementBuilder<'a>) -> XmlEvent<'a> { + XmlEvent::StartElement { + name: b.name, + attributes: Cow::Owned(b.attributes), + namespace: Cow::Owned(b.namespace) + } + } +} diff --git a/third_party/rust/xml-rs/src/writer/mod.rs b/third_party/rust/xml-rs/src/writer/mod.rs new file mode 100644 index 000000000000..53afc67f0832 --- /dev/null +++ b/third_party/rust/xml-rs/src/writer/mod.rs @@ -0,0 +1,83 @@ +//! Contains high-level interface for an events-based XML emitter. +//! +//! The most important type in this module is `EventWriter` which allows writing an XML document +//! to some output stream. + +pub use self::emitter::Result; +pub use self::emitter::EmitterError as Error; +pub use self::config::EmitterConfig; +pub use self::events::XmlEvent; + +use self::emitter::Emitter; + +use std::io::prelude::*; + +mod emitter; +mod config; +pub mod events; + +/// A wrapper around an `std::io::Write` instance which emits XML document according to provided +/// events. +pub struct EventWriter { + sink: W, + emitter: Emitter +} + +impl EventWriter { + /// Creates a new `EventWriter` out of an `std::io::Write` instance using the default + /// configuration. + #[inline] + pub fn new(sink: W) -> EventWriter { + EventWriter::new_with_config(sink, EmitterConfig::new()) + } + + /// Creates a new `EventWriter` out of an `std::io::Write` instance using the provided + /// configuration. + #[inline] + pub fn new_with_config(sink: W, config: EmitterConfig) -> EventWriter { + EventWriter { + sink: sink, + emitter: Emitter::new(config) + } + } + + /// Writes the next piece of XML document according to the provided event. + /// + /// Note that output data may not exactly correspond to the written event because + /// of various configuration options. For example, `XmlEvent::EndElement` may + /// correspond to a separate closing element or it may cause writing an empty element. + /// Another example is that `XmlEvent::CData` may be represented as characters in + /// the output stream. + pub fn write<'a, E>(&mut self, event: E) -> Result<()> where E: Into> { + match event.into() { + XmlEvent::StartDocument { version, encoding, standalone } => + self.emitter.emit_start_document(&mut self.sink, version, encoding.unwrap_or("UTF-8"), standalone), + XmlEvent::ProcessingInstruction { name, data } => + self.emitter.emit_processing_instruction(&mut self.sink, name, data), + XmlEvent::StartElement { name, attributes, namespace } => { + self.emitter.namespace_stack_mut().push_empty().checked_target().extend(namespace.as_ref()); + self.emitter.emit_start_element(&mut self.sink, name, &attributes) + } + XmlEvent::EndElement { name } => { + let r = self.emitter.emit_end_element(&mut self.sink, name); + self.emitter.namespace_stack_mut().try_pop(); + r + } + XmlEvent::Comment(content) => + self.emitter.emit_comment(&mut self.sink, content), + XmlEvent::CData(content) => + self.emitter.emit_cdata(&mut self.sink, content), + XmlEvent::Characters(content) => + self.emitter.emit_characters(&mut self.sink, content) + } + } + + /// Unwraps this `EventWriter`, returning the underlying writer. + /// + /// Note that this is a destructive operation: unwrapping a writer and then wrapping + /// it again with `EventWriter::new()` will create a fresh writer whose state will be + /// blank; for example, accumulated namespaces will be reset. + pub fn into_inner(self) -> W { + self.sink + } +} diff --git a/third_party/rust/xml-rs/tests/documents/sample_1.xml b/third_party/rust/xml-rs/tests/documents/sample_1.xml new file mode 100644 index 000000000000..4d1cbc0564a9 --- /dev/null +++ b/third_party/rust/xml-rs/tests/documents/sample_1.xml @@ -0,0 +1,34 @@ + + + + + + + + + + Some <java> class + + + Another "java" class + + + Weird 'XML' config + + + + + + + + + + JavaScript & program + + + Cascading style sheet: © - ҉ + + + + + diff --git a/third_party/rust/xml-rs/tests/documents/sample_1_full.txt b/third_party/rust/xml-rs/tests/documents/sample_1_full.txt new file mode 100644 index 000000000000..a8d64d01b38b --- /dev/null +++ b/third_party/rust/xml-rs/tests/documents/sample_1_full.txt @@ -0,0 +1,58 @@ +StartDocument(1.0, utf-8) +StartElement(project [name="project-name"]) +Whitespace("\n ") +StartElement(libraries) +Whitespace("\n ") +StartElement(library [groupId="org.example", artifactId="", version="0.1"]) +EndElement(library) +Whitespace("\n ") +StartElement(library [groupId="com.example", artifactId="\"cool-lib&", version="999"]) +EndElement(library) +Whitespace("\n ") +EndElement(libraries) +Whitespace("\n ") +StartElement(module [name="module-1"]) +Whitespace("\n ") +StartElement(files) +Whitespace("\n ") +StartElement(file [name="somefile.java", type="java"]) +Characters("\n Some class\n ") +EndElement(file) +Whitespace("\n ") +StartElement(file [name="another_file.java", type="java"]) +Characters("\n Another \"java\" class\n ") +EndElement(file) +Whitespace("\n ") +StartElement(file [name="config.xml", type="xml"]) +Characters("\n Weird \'XML\' config\n ") +EndElement(file) +Whitespace("\n ") +EndElement(files) +Whitespace("\n ") +StartElement(libraries) +Whitespace("\n ") +StartElement(library [groupId="junit", artifactId="junit", version="1.9.5"]) +EndElement(library) +Whitespace("\n ") +EndElement(libraries) +Whitespace("\n ") +EndElement(module) +Whitespace("\n ") +StartElement(module [name="module-2"]) +Whitespace("\n ") +StartElement(files) +Whitespace("\n ") +StartElement(file [name="program.js", type="javascript"]) +Characters("\n JavaScript & program\n ") +EndElement(file) +Whitespace("\n ") +StartElement(file [name="style.css", type="css"]) +Characters("\n Cascading style sheet: © - ҉\n ") +EndElement(file) +Whitespace("\n ") +EndElement(files) +Whitespace("\n ") +EndElement(module) +Whitespace("\n") +EndElement(project) +EndDocument diff --git a/third_party/rust/xml-rs/tests/documents/sample_1_short.txt b/third_party/rust/xml-rs/tests/documents/sample_1_short.txt new file mode 100644 index 000000000000..4dbe285b9598 --- /dev/null +++ b/third_party/rust/xml-rs/tests/documents/sample_1_short.txt @@ -0,0 +1,37 @@ +StartDocument(1.0, utf-8) +StartElement(project [name="project-name"]) +StartElement(libraries) +StartElement(library [groupId="org.example", artifactId="", version="0.1"]) +EndElement(library) +StartElement(library [groupId="com.example", artifactId="\"cool-lib&", version="999"]) +EndElement(library) +EndElement(libraries) +StartElement(module [name="module-1"]) +StartElement(files) +StartElement(file [name="somefile.java", type="java"]) +Characters("Some class") +EndElement(file) +StartElement(file [name="another_file.java", type="java"]) +Characters("Another \"java\" class") +EndElement(file) +StartElement(file [name="config.xml", type="xml"]) +Characters("Weird \'XML\' config") +EndElement(file) +EndElement(files) +StartElement(libraries) +StartElement(library [groupId="junit", artifactId="junit", version="1.9.5"]) +EndElement(library) +EndElement(libraries) +EndElement(module) +StartElement(module [name="module-2"]) +StartElement(files) +StartElement(file [name="program.js", type="javascript"]) +Characters("JavaScript & program") +EndElement(file) +StartElement(file [name="style.css", type="css"]) +Characters("Cascading style sheet: © - ҉") +EndElement(file) +EndElement(files) +EndElement(module) +EndElement(project) +EndDocument diff --git a/third_party/rust/xml-rs/tests/documents/sample_2.xml b/third_party/rust/xml-rs/tests/documents/sample_2.xml new file mode 100644 index 000000000000..f9543acab325 --- /dev/null +++ b/third_party/rust/xml-rs/tests/documents/sample_2.xml @@ -0,0 +1,15 @@ + + + + Name + Another name + 0.3 + 0.2 + 0.1 + 0.01 + header 1 value + + Some bigger value + + + diff --git a/third_party/rust/xml-rs/tests/documents/sample_2_full.txt b/third_party/rust/xml-rs/tests/documents/sample_2_full.txt new file mode 100644 index 000000000000..75075cd661ea --- /dev/null +++ b/third_party/rust/xml-rs/tests/documents/sample_2_full.txt @@ -0,0 +1,41 @@ +StartDocument(1.0, utf-8) +StartElement({urn:example:namespace}p:data) +Whitespace("\n ") +StartElement({urn:example:namespace}p:datum [id="34"]) +Whitespace("\n ") +StartElement({urn:example:namespace}p:name) +Characters("Name") +EndElement({urn:example:namespace}p:name) +Whitespace("\n ") +StartElement({urn:example:double}d:name) +Characters("Another name") +EndElement({urn:example:double}d:name) +Whitespace("\n ") +StartElement({urn:example:double}d:arg) +Characters("0.3") +EndElement({urn:example:double}d:arg) +Whitespace("\n ") +StartElement({urn:example:double}d:arg) +Characters("0.2") +EndElement({urn:example:double}d:arg) +Whitespace("\n ") +StartElement({urn:example:namespace}p:arg) +Characters("0.1") +EndElement({urn:example:namespace}p:arg) +Whitespace("\n ") +StartElement({urn:example:namespace}p:arg) +Characters("0.01") +EndElement({urn:example:namespace}p:arg) +Whitespace("\n ") +StartElement({urn:example:header}h:header [name="Header-1"]) +Characters("header 1 value") +EndElement({urn:example:header}h:header) +Whitespace("\n ") +StartElement({urn:example:header}h:header [name="Header-2"]) +Characters("\n Some bigger value\n ") +EndElement({urn:example:header}h:header) +Whitespace("\n ") +EndElement({urn:example:namespace}p:datum) +Whitespace("\n") +EndElement({urn:example:namespace}p:data) +EndDocument diff --git a/third_party/rust/xml-rs/tests/documents/sample_2_short.txt b/third_party/rust/xml-rs/tests/documents/sample_2_short.txt new file mode 100644 index 000000000000..23680255a4bc --- /dev/null +++ b/third_party/rust/xml-rs/tests/documents/sample_2_short.txt @@ -0,0 +1,30 @@ +StartDocument(1.0, utf-8) +StartElement({urn:example:namespace}p:data) +StartElement({urn:example:namespace}p:datum [id="34"]) +StartElement({urn:example:namespace}p:name) +Characters("Name") +EndElement({urn:example:namespace}p:name) +StartElement({urn:example:double}d:name) +Characters("Another name") +EndElement({urn:example:double}d:name) +StartElement({urn:example:double}d:arg) +Characters("0.3") +EndElement({urn:example:double}d:arg) +StartElement({urn:example:double}d:arg) +Characters("0.2") +EndElement({urn:example:double}d:arg) +StartElement({urn:example:namespace}p:arg) +Characters("0.1") +EndElement({urn:example:namespace}p:arg) +StartElement({urn:example:namespace}p:arg) +Characters("0.01") +EndElement({urn:example:namespace}p:arg) +StartElement({urn:example:header}h:header [name="Header-1"]) +Characters("header 1 value") +EndElement({urn:example:header}h:header) +StartElement({urn:example:header}h:header [name="Header-2"]) +Characters("Some bigger value") +EndElement({urn:example:header}h:header) +EndElement({urn:example:namespace}p:datum) +EndElement({urn:example:namespace}p:data) +EndDocument diff --git a/third_party/rust/xml-rs/tests/documents/sample_3.xml b/third_party/rust/xml-rs/tests/documents/sample_3.xml new file mode 100644 index 000000000000..657e37d1a56c --- /dev/null +++ b/third_party/rust/xml-rs/tests/documents/sample_3.xml @@ -0,0 +1,13 @@ + + + + test + kkss" = ddd' > + ddddd!e3--> + test + kkss" = ddd' > + ddddd!e3-->"#, + br#" + |1:14 Unexpected token '--' before ' ' + "#, + ParserConfig::new(), + false + ); + + test( + br#""#, + br#" + |1:14 Unexpected token '--' before '-' + "#, + ParserConfig::new(), + false + ); +} + +#[test] +fn tabs_1() { + test( + b"\t\t", + br#" + |1:2 StartDocument(1.0, UTF-8) + |1:2 StartElement(a) + |1:6 StartElement(b) + |1:6 EndElement(b) + |1:10 EndElement(a) + |1:14 EndDocument + "#, + ParserConfig::new() + .trim_whitespace(true), + true + ); +} + +#[test] +fn issue_83_duplicate_attributes() { + test( + br#""#, + br#" + |StartDocument(1.0, UTF-8) + |StartElement(hello) + |1:30 Attribute 'a' is redefined + "#, + ParserConfig::new(), + false + ); +} + +#[test] +fn issue_93_large_characters_in_entity_references() { + test( + r#"&𤶼;"#.as_bytes(), + r#" + |StartDocument(1.0, UTF-8) + |StartElement(hello) + |1:10 Unexpected entity: 𤶼 + "#.as_bytes(), // FIXME: it shouldn't be 10, looks like indices are off slightly + ParserConfig::new(), + false + ) +} + +#[test] +fn issue_98_cdata_ending_with_right_bracket() { + test( + br#""#, + br#" + |StartDocument(1.0, UTF-8) + |StartElement(hello) + |CData("Foo [Bar]") + |EndElement(hello) + |EndDocument + "#, + ParserConfig::new(), + false + ) +} + +#[test] +fn issue_105_unexpected_double_dash() { + test( + br#"-- "#, + br#" + |StartDocument(1.0, UTF-8) + |StartElement(hello) + |Characters("-- ") + |EndElement(hello) + |EndDocument + "#, + ParserConfig::new(), + false + ); + + test( + br#"--"#, + br#" + |StartDocument(1.0, UTF-8) + |StartElement(hello) + |Characters("--") + |EndElement(hello) + |EndDocument + "#, + ParserConfig::new(), + false + ); + + test( + br#"-->"#, + br#" + |StartDocument(1.0, UTF-8) + |StartElement(hello) + |Characters("-->") + |EndElement(hello) + |EndDocument + "#, + ParserConfig::new(), + false + ); + + test( + br#""#, + br#" + |StartDocument(1.0, UTF-8) + |StartElement(hello) + |CData("--") + |EndElement(hello) + |EndDocument + "#, + ParserConfig::new(), + false + ); +} + +#[test] +fn issue_attribues_have_no_default_namespace () { + test( + br#""#, + br#" + |StartDocument(1.0, UTF-8) + |StartElement({urn:foo}hello [x="y"]) + |EndElement({urn:foo}hello) + |EndDocument + "#, + ParserConfig::new(), + false + ); +} + + +static START: Once = ONCE_INIT; +static mut PRINT: bool = false; + +// clones a lot but that's fine +fn trim_until_bar(s: String) -> String { + match s.trim() { + ts if ts.starts_with('|') => return ts[1..].to_owned(), + _ => {} + } + s +} + +fn test(input: &[u8], output: &[u8], config: ParserConfig, test_position: bool) { + // If PRINT_SPEC env variable is set, print the lines + // to stderr instead of comparing with the output + // it can be used like this: + // PRINT_SPEC=1 cargo test --test event_reader sample_1_full 2> sample_1_full.txt + START.call_once(|| { + for (key, value) in env::vars() { + if key == "PRINT_SPEC" && value == "1" { + unsafe { PRINT = true; } + } + } + }); + + let mut reader = config.create_reader(input); + let mut spec_lines = BufReader::new(output).lines() + .map(|line| line.unwrap()) + .enumerate() + .map(|(i, line)| (i, trim_until_bar(line))) + .filter(|&(_, ref line)| !line.trim().is_empty()); + + loop { + let e = reader.next(); + let line = + if test_position { + format!("{} {}", reader.position(), Event(&e)) + } else { + format!("{}", Event(&e)) + }; + + if unsafe { PRINT } { + writeln!(&mut stderr(), "{}", line).unwrap(); + } else { + if let Some((n, spec)) = spec_lines.next() { + if line != spec { + const SPLITTER: &'static str = "-------------------"; + panic!("\n{}\nUnexpected event at line {}:\nExpected: {}\nFound: {}\n{}\n", + SPLITTER, n + 1, spec, line, SPLITTER); + } + } else { + panic!("Unexpected event: {}", line); + } + } + + match e { + Ok(XmlEvent::EndDocument) | Err(_) => break, + _ => {}, + } + } +} + +// Here we define our own string representation of events so we don't depend +// on the specifics of Display implementation for XmlEvent and OwnedName. + +struct Name<'a>(&'a OwnedName); + +impl <'a> fmt::Display for Name<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if let Some(ref namespace) = self.0.namespace { + try! { write!(f, "{{{}}}", namespace) } + } + + if let Some(ref prefix) = self.0.prefix { + try! { write!(f, "{}:", prefix) } + } + + write!(f, "{}", self.0.local_name) + } +} + +struct Event<'a>(&'a Result); + +impl<'a> fmt::Display for Event<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let empty = String::new(); + match *self.0 { + Ok(ref e) => match *e { + XmlEvent::StartDocument { ref version, ref encoding, .. } => + write!(f, "StartDocument({}, {})", version, encoding), + XmlEvent::EndDocument => + write!(f, "EndDocument"), + XmlEvent::ProcessingInstruction { ref name, ref data } => + write!(f, "ProcessingInstruction({}={:?})", name, + data.as_ref().unwrap_or(&empty)), + XmlEvent::StartElement { ref name, ref attributes, .. } => { + if attributes.is_empty() { + write!(f, "StartElement({})", Name(name)) + } + else { + let attrs: Vec<_> = attributes.iter() + .map(|a| format!("{}={:?}", Name(&a.name), a.value)) .collect(); + write!(f, "StartElement({} [{}])", Name(name), attrs.join(", ")) + } + }, + XmlEvent::EndElement { ref name } => + write!(f, "EndElement({})", Name(name)), + XmlEvent::Comment(ref data) => + write!(f, "Comment({:?})", data), + XmlEvent::CData(ref data) => + write!(f, "CData({:?})", data), + XmlEvent::Characters(ref data) => + write!(f, "Characters({:?})", data), + XmlEvent::Whitespace(ref data) => + write!(f, "Whitespace({:?})", data), + }, + Err(ref e) => e.fmt(f), + } + } +} diff --git a/third_party/rust/xml-rs/tests/event_writer.rs b/third_party/rust/xml-rs/tests/event_writer.rs new file mode 100644 index 000000000000..af4cd3a64cc8 --- /dev/null +++ b/third_party/rust/xml-rs/tests/event_writer.rs @@ -0,0 +1,168 @@ +extern crate xml; + +use std::io::{BufReader, SeekFrom}; +use std::io::prelude::*; +use std::fs::File; +use std::str; + +use xml::reader::EventReader; +use xml::writer::EmitterConfig; + +macro_rules! unwrap_all { + ($($e:expr);+) => {{ + $($e.unwrap();)+ + }} +} + +#[test] +fn reading_writing_equal_with_namespaces() { + let mut f = File::open("tests/documents/sample_2.xml").unwrap(); + let mut b = Vec::new(); + + { + let r = EventReader::new(BufReader::new(&mut f)); + let mut w = EmitterConfig::default().perform_indent(true).create_writer(&mut b); + + for e in r { + match e { + Ok(e) => if let Some(e) = e.as_writer_event() { + match w.write(e) { + Ok(_) => {}, + Err(e) => panic!("Writer error: {:?}", e) + } + }, + Err(e) => panic!("Error: {}", e) + } + } + } + + f.seek(SeekFrom::Start(0)).unwrap(); + let mut fs = String::new(); + f.read_to_string(&mut fs).unwrap(); + + let bs = String::from_utf8(b).unwrap(); + + assert_eq!(fs.trim(), bs.trim()); +} + +#[test] +fn writing_simple() { + use xml::writer::XmlEvent; + + let mut b = Vec::new(); + + { + let mut w = EmitterConfig::new().write_document_declaration(false).create_writer(&mut b); + + w.write(XmlEvent::start_element("h:hello").ns("h", "urn:hello-world")).unwrap(); + w.write("hello world").unwrap(); + w.write(XmlEvent::end_element()).unwrap(); + } + + assert_eq!( + str::from_utf8(&b).unwrap(), + r#"hello world"# + ); +} + +#[test] +fn writing_empty_elements_with_normalizing() { + use xml::writer::XmlEvent; + + let mut b = Vec::new(); + + { + let mut w = EmitterConfig::new().write_document_declaration(false).create_writer(&mut b); + + unwrap_all! { + w.write(XmlEvent::start_element("hello")); + w.write(XmlEvent::start_element("world")); + w.write(XmlEvent::end_element()); + w.write(XmlEvent::end_element()) + } + } + + assert_eq!(str::from_utf8(&b).unwrap(), r#""#); +} + +#[test] +fn writing_empty_elements_without_normalizing() { + use xml::writer::XmlEvent; + + let mut b = Vec::new(); + + { + let mut w = EmitterConfig::new() + .write_document_declaration(false) + .normalize_empty_elements(false) + .create_writer(&mut b); + + unwrap_all! { + w.write(XmlEvent::start_element("hello")); + w.write(XmlEvent::start_element("world")); + w.write(XmlEvent::end_element()); + w.write(XmlEvent::end_element()) + } + } + + assert_eq!(str::from_utf8(&b).unwrap(), r#""#); +} + +#[test] +fn writing_comments_with_indentation() { + use xml::writer::XmlEvent; + + let mut b = Vec::new(); + + { + let mut w = EmitterConfig::new() + .write_document_declaration(false) + .perform_indent(true) + .create_writer(&mut b); + + unwrap_all! { + w.write(XmlEvent::start_element("hello")); + w.write(XmlEvent::start_element("world")); + w.write(XmlEvent::comment(" this is a manually padded comment\t")); + w.write(XmlEvent::comment("this is an unpadded comment")); + w.write(XmlEvent::end_element()); + w.write(XmlEvent::end_element()) + } + } + + assert_eq!( + str::from_utf8(&b).unwrap(), + " + + + + +"); +} + +#[test] +fn issue_112_overriding_namepace_prefix() { + use xml::writer::XmlEvent; + + let mut b = Vec::new(); + + { + let mut w = EmitterConfig::new() + .write_document_declaration(false) + .create_writer(&mut b); + + unwrap_all! { + w.write(XmlEvent::start_element("iq").ns("", "jabber:client").ns("a", "urn:A")); + w.write(XmlEvent::start_element("bind").ns("", "urn:ietf:params:xml:ns:xmpp-bind")); + w.write(XmlEvent::end_element()); + w.write(XmlEvent::start_element("whatever").ns("a", "urn:X")); + w.write(XmlEvent::end_element()); + w.write(XmlEvent::end_element()) + } + } + + assert_eq!( + str::from_utf8(&b).unwrap(), + r#""# + ) +} diff --git a/toolkit/library/gtest/rust/Cargo.lock b/toolkit/library/gtest/rust/Cargo.lock index e9c586d1a539..1c8db3e328f5 100644 --- a/toolkit/library/gtest/rust/Cargo.lock +++ b/toolkit/library/gtest/rust/Cargo.lock @@ -7,16 +7,160 @@ dependencies = [ "nsstring-gtest 0.1.0", ] +[[package]] +name = "app_units" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bincode" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-set" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-vec" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitreader" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "byteorder" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cgl" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-graphics" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-text" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dwrote" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "error-chain" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "euclid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fnv" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "freetype" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdi32-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "geckoservo" version = "0.0.0" @@ -29,6 +173,34 @@ dependencies = [ "mp4parse_capi 0.6.0", "nsstring 0.1.0", "rust_url_capi 0.0.1", + "webrender_bindings 0.1.0", +] + +[[package]] +name = "gl_generator" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gleam" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heapsize" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -36,21 +208,55 @@ name = "idna" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "khronos_api" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "matches" -version = "0.1.3" +name = "log" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "matches" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "metadeps" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mp4parse" version = "0.6.0" @@ -82,6 +288,55 @@ dependencies = [ "nsstring 0.1.0", ] +[[package]] +name = "num-traits" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "offscreen_gl_context" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_syscall" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rust_url_capi" version = "0.0.1" @@ -91,12 +346,135 @@ dependencies = [ "url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc-serialize" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_codegen" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen_internals 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.10.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_codegen_internals" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syn 0.10.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "shared_library" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syntex_errors 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_errors" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_pos" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_syntax" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_errors 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "threadpool" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "time" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "toml" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-bidi" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -104,21 +482,169 @@ name = "unicode-normalization" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "url" version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "user32-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "webrender" +version = "0.11.1" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-text 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender_traits 0.11.0", +] + +[[package]] +name = "webrender_bindings" +version = "0.1.0" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender 0.11.1", + "webrender_traits 0.11.0", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "webrender_traits" +version = "0.11.0" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "x11" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xml-rs" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] +"checksum app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "636ee56f12e31dbc11dc0a1ac6004f08b04e6e6595963716fc8130e90d4e04cf" +"checksum bincode 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "55eb0b7fd108527b0c77860f75eca70214e11a8b4c6ef05148c54c05a25d48ad" +"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" +"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitreader 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8319aa6588c40cce19a135009ec70dc730a34ed9d27bab2409298b948546da7a" +"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" +"checksum cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10" +"checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67" +"checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d" +"checksum core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd94d0f0b2bbcbfeeb670fc48654afde7a13c2c551ca9d2b9a6cfafdafe1a64" +"checksum core-text 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "642fa40165b6c53bbd3f636951ffc3e1a3fd3c47e7d00598523c3e8c9321ed0c" +"checksum dwrote 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c3d72c5042f43ee02587b5f3256efc6252c2194fbbb0dfa0bd0b6da2491501" +"checksum error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "318cb3c71ee4cdea69fdc9e15c173b245ed6063e1709029e8fd32525a881120f" +"checksum euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0c274f13773ec277a48408d0c7a8dc935ad4bfe190f4cfccd0126d203afc3c83" +"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" +"checksum freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fde23272c687e4570aefec06cb71174ec0f5284b725deac4e77ba2665d635faf" +"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" +"checksum gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55" +"checksum gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3023edde169b7767a71d2e5dd8e8903ac3b1436ff659225310928db87d6a8a" +"checksum heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5a376f7402b85be6e0ba504243ecbc0709c48019ecc6286d0540c2e359050c88" "checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09c9d3760673c427d46f91a0350f0a84a52e6bc5a84adf26dc610b6c52436630" +"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" "checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5" -"checksum matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc3ad8109fa4b522f9b0cd81440422781f564aaf8c195de6b9d6642177ad0dd" +"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" +"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" +"checksum metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829fffe7ea1d747e23f64be972991bc516b2f1ac2ae4a3b33d8bea150c410151" +"checksum num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c" +"checksum offscreen_gl_context 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2092c6bb5550536a097c5b413a2c36e141bc63c85c0a40944a182c1912d69397" +"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" +"checksum quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e7b44fd83db28b83c1c58187159934906e5e955c812e211df413b76b03c909a5" +"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753" +"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b" +"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" +"checksum serde_codegen 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c5d8a33087d8984f9535daa62a6498a08f6476050b00ab9339dd847e4c25cc" +"checksum serde_codegen_internals 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "afad7924a009f859f380e4a2e3a509a845c2ac66435fcead74a4d983b21ae806" +"checksum shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a" +"checksum syn 0.10.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e5aaf7e4a0f90d7285445c881dcc28f1a510e4962b4ffcdde17f5775b2960df6" +"checksum syntex 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb3f52553a966675982404dc34028291b347e0c9a9c0b0b34f2da6be8a0443f8" +"checksum syntex_errors 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dee2f6e49c075f71332bb775219d5982bee6732d26227fa1ae1b53cdb12f5cc5" +"checksum syntex_pos 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df3921c7945dfb9ffc53aa35adb2cf4313b5ab5f079c3619b3d4eb82a0efc2b" +"checksum syntex_syntax 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc960085bae44591e22d01f6c0e82a8aec832f8659aca556cdf8ecbdac2bb47b" +"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a" +"checksum threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59f6d3eff89920113dac9db44dde461d71d01e88a5b57b258a0466c32b5d7fe1" +"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade" +"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f" "checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f024e241a55f5c88401595adc1d4af0c9649e91da82d0e190fe55950231ae575" +"checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "124eb405bf0262a54e1a982d4ffe4cd1c24261bdb306e49996e2ce7d492284a8" +"checksum xml-rs 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b15eed12692bd59d15e98ee7f8dc8408465b992d8ddb4d1672c24865132ec7" diff --git a/toolkit/library/rust/Cargo.lock b/toolkit/library/rust/Cargo.lock index 7d0a26866306..10a96323dae4 100644 --- a/toolkit/library/rust/Cargo.lock +++ b/toolkit/library/rust/Cargo.lock @@ -5,16 +5,160 @@ dependencies = [ "gkrust-shared 0.1.0", ] +[[package]] +name = "app_units" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bincode" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-set" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-vec" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitreader" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "byteorder" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cgl" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-graphics" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-text" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dwrote" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "error-chain" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "euclid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fnv" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "freetype" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdi32-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "geckoservo" version = "0.0.0" @@ -27,6 +171,34 @@ dependencies = [ "mp4parse_capi 0.6.0", "nsstring 0.1.0", "rust_url_capi 0.0.1", + "webrender_bindings 0.1.0", +] + +[[package]] +name = "gl_generator" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gleam" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heapsize" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -34,21 +206,55 @@ name = "idna" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "khronos_api" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "matches" -version = "0.1.3" +name = "log" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "matches" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "metadeps" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mp4parse" version = "0.6.0" @@ -69,6 +275,55 @@ dependencies = [ name = "nsstring" version = "0.1.0" +[[package]] +name = "num-traits" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "offscreen_gl_context" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_syscall" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rust_url_capi" version = "0.0.1" @@ -78,12 +333,135 @@ dependencies = [ "url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc-serialize" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_codegen" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen_internals 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.10.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_codegen_internals" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syn 0.10.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "shared_library" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syntex_errors 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_errors" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_pos" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_syntax" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_errors 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "threadpool" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "time" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "toml" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-bidi" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -91,21 +469,169 @@ name = "unicode-normalization" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "url" version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "user32-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "webrender" +version = "0.11.1" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-text 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender_traits 0.11.0", +] + +[[package]] +name = "webrender_bindings" +version = "0.1.0" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender 0.11.1", + "webrender_traits 0.11.0", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "webrender_traits" +version = "0.11.0" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "x11" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xml-rs" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] +"checksum app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "636ee56f12e31dbc11dc0a1ac6004f08b04e6e6595963716fc8130e90d4e04cf" +"checksum bincode 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "55eb0b7fd108527b0c77860f75eca70214e11a8b4c6ef05148c54c05a25d48ad" +"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" +"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitreader 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8319aa6588c40cce19a135009ec70dc730a34ed9d27bab2409298b948546da7a" +"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" +"checksum cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10" +"checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67" +"checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d" +"checksum core-graphics 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd94d0f0b2bbcbfeeb670fc48654afde7a13c2c551ca9d2b9a6cfafdafe1a64" +"checksum core-text 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "642fa40165b6c53bbd3f636951ffc3e1a3fd3c47e7d00598523c3e8c9321ed0c" +"checksum dwrote 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c3d72c5042f43ee02587b5f3256efc6252c2194fbbb0dfa0bd0b6da2491501" +"checksum error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "318cb3c71ee4cdea69fdc9e15c173b245ed6063e1709029e8fd32525a881120f" +"checksum euclid 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0c274f13773ec277a48408d0c7a8dc935ad4bfe190f4cfccd0126d203afc3c83" +"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" +"checksum freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fde23272c687e4570aefec06cb71174ec0f5284b725deac4e77ba2665d635faf" +"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" +"checksum gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55" +"checksum gleam 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3023edde169b7767a71d2e5dd8e8903ac3b1436ff659225310928db87d6a8a" +"checksum heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5a376f7402b85be6e0ba504243ecbc0709c48019ecc6286d0540c2e359050c88" "checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09c9d3760673c427d46f91a0350f0a84a52e6bc5a84adf26dc610b6c52436630" +"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" "checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5" -"checksum matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc3ad8109fa4b522f9b0cd81440422781f564aaf8c195de6b9d6642177ad0dd" +"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" +"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" +"checksum metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829fffe7ea1d747e23f64be972991bc516b2f1ac2ae4a3b33d8bea150c410151" +"checksum num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c" +"checksum offscreen_gl_context 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2092c6bb5550536a097c5b413a2c36e141bc63c85c0a40944a182c1912d69397" +"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" +"checksum quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e7b44fd83db28b83c1c58187159934906e5e955c812e211df413b76b03c909a5" +"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753" +"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b" +"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" +"checksum serde_codegen 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c5d8a33087d8984f9535daa62a6498a08f6476050b00ab9339dd847e4c25cc" +"checksum serde_codegen_internals 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "afad7924a009f859f380e4a2e3a509a845c2ac66435fcead74a4d983b21ae806" +"checksum shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a" +"checksum syn 0.10.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e5aaf7e4a0f90d7285445c881dcc28f1a510e4962b4ffcdde17f5775b2960df6" +"checksum syntex 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb3f52553a966675982404dc34028291b347e0c9a9c0b0b34f2da6be8a0443f8" +"checksum syntex_errors 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dee2f6e49c075f71332bb775219d5982bee6732d26227fa1ae1b53cdb12f5cc5" +"checksum syntex_pos 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df3921c7945dfb9ffc53aa35adb2cf4313b5ab5f079c3619b3d4eb82a0efc2b" +"checksum syntex_syntax 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc960085bae44591e22d01f6c0e82a8aec832f8659aca556cdf8ecbdac2bb47b" +"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a" +"checksum threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59f6d3eff89920113dac9db44dde461d71d01e88a5b57b258a0466c32b5d7fe1" +"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade" +"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f" "checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f024e241a55f5c88401595adc1d4af0c9649e91da82d0e190fe55950231ae575" +"checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum x11 2.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "124eb405bf0262a54e1a982d4ffe4cd1c24261bdb306e49996e2ce7d492284a8" +"checksum xml-rs 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b15eed12692bd59d15e98ee7f8dc8408465b992d8ddb4d1672c24865132ec7" From 4b3f339eab5f048d41d7837a637f5d6b85053f0a Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:53 -0500 Subject: [PATCH 65/70] Bug 1335525 - Add --enable-webrender configure option and hook it up build webrender. r=gps MozReview-Commit-ID: BWLoSnV2yEN --- toolkit/library/gtest/rust/moz.build | 3 +++ toolkit/library/moz.build | 11 +++++++++++ toolkit/library/rust/moz.build | 3 +++ toolkit/moz.configure | 8 ++++++++ 4 files changed, 25 insertions(+) diff --git a/toolkit/library/gtest/rust/moz.build b/toolkit/library/gtest/rust/moz.build index c2e0499d5e65..6fe3f8931bc2 100644 --- a/toolkit/library/gtest/rust/moz.build +++ b/toolkit/library/gtest/rust/moz.build @@ -11,4 +11,7 @@ if CONFIG['MOZ_STYLO']: if CONFIG['MOZ_STYLO_BINDGEN']: features += ['bindgen'] +if CONFIG['MOZ_ENABLE_WEBRENDER']: + features += ['quantum_render'] + RustLibrary('gkrust-gtest', features) diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index 5d97bf06717c..30cc34cd6519 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -385,6 +385,17 @@ if CONFIG['COMPILE_ENVIRONMENT']: ] FINAL_TARGET_FILES += ['!dependentlibs.list'] +# WebRender dependencies +if CONFIG['MOZ_ENABLE_WEBRENDER']: + if CONFIG['OS_ARCH'] == 'Linux': + OS_LIBS += [ + 'GL', + ] + elif CONFIG['OS_ARCH'] == 'WINNT': + OS_LIBS += [ + 'opengl32', + ] + # This library needs to be last to make XPCOM module registration work. USE_LIBS += ['StaticXULComponentsEnd'] diff --git a/toolkit/library/rust/moz.build b/toolkit/library/rust/moz.build index b95b39cde094..a5cec1fbbf19 100644 --- a/toolkit/library/rust/moz.build +++ b/toolkit/library/rust/moz.build @@ -11,4 +11,7 @@ if CONFIG['MOZ_STYLO']: if CONFIG['MOZ_STYLO_BINDGEN']: features += ['bindgen'] +if CONFIG['MOZ_ENABLE_WEBRENDER']: + features += ['quantum_render'] + RustLibrary('gkrust', features) diff --git a/toolkit/moz.configure b/toolkit/moz.configure index c8561108677e..febe408ca191 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -690,6 +690,14 @@ def servo_target_dir(value): set_config('SERVO_TARGET_DIR', servo_target_dir) +# WebRender integration +option('--enable-webrender', help='Include WebRender') + +set_config('MOZ_ENABLE_WEBRENDER', + depends_if('--enable-webrender')(lambda _: True)) +set_define('MOZ_ENABLE_WEBRENDER', + depends_if('--enable-webrender')(lambda _: True)) + # Gecko integrated IPC fuzzer # ============================================================== option('--enable-ipc-fuzzer', env='MOZ_FAULTY', From cebab6575c74f20f1aa3da397ec97cb57076f5ae Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:53 -0500 Subject: [PATCH 66/70] Bug 1335748 - Add in-tree mozconfigs for Quantum Render builds. r=dustin MozReview-Commit-ID: wGdHuhshuH --- browser/config/mozconfigs/linux64/debug-qr | 3 +++ browser/config/mozconfigs/linux64/opt-qr | 3 +++ browser/config/mozconfigs/macosx64/debug-qr | 3 +++ browser/config/mozconfigs/macosx64/opt-qr | 3 +++ browser/config/mozconfigs/win64/debug-qr | 3 +++ browser/config/mozconfigs/win64/opt-qr | 3 +++ 6 files changed, 18 insertions(+) create mode 100644 browser/config/mozconfigs/linux64/debug-qr create mode 100644 browser/config/mozconfigs/linux64/opt-qr create mode 100644 browser/config/mozconfigs/macosx64/debug-qr create mode 100644 browser/config/mozconfigs/macosx64/opt-qr create mode 100644 browser/config/mozconfigs/win64/debug-qr create mode 100644 browser/config/mozconfigs/win64/opt-qr diff --git a/browser/config/mozconfigs/linux64/debug-qr b/browser/config/mozconfigs/linux64/debug-qr new file mode 100644 index 000000000000..64c333866bb4 --- /dev/null +++ b/browser/config/mozconfigs/linux64/debug-qr @@ -0,0 +1,3 @@ +. "$topsrcdir/browser/config/mozconfigs/linux64/debug" + +ac_add_options --enable-webrender diff --git a/browser/config/mozconfigs/linux64/opt-qr b/browser/config/mozconfigs/linux64/opt-qr new file mode 100644 index 000000000000..a2b84904d054 --- /dev/null +++ b/browser/config/mozconfigs/linux64/opt-qr @@ -0,0 +1,3 @@ +. "$topsrcdir/browser/config/mozconfigs/linux64/nightly" + +ac_add_options --enable-webrender diff --git a/browser/config/mozconfigs/macosx64/debug-qr b/browser/config/mozconfigs/macosx64/debug-qr new file mode 100644 index 000000000000..54ddc98aba6e --- /dev/null +++ b/browser/config/mozconfigs/macosx64/debug-qr @@ -0,0 +1,3 @@ +. "$topsrcdir/browser/config/mozconfigs/macosx64/debug" + +ac_add_options --enable-webrender diff --git a/browser/config/mozconfigs/macosx64/opt-qr b/browser/config/mozconfigs/macosx64/opt-qr new file mode 100644 index 000000000000..67a01f1c0c58 --- /dev/null +++ b/browser/config/mozconfigs/macosx64/opt-qr @@ -0,0 +1,3 @@ +. "$topsrcdir/browser/config/mozconfigs/macosx64/nightly" + +ac_add_options --enable-webrender diff --git a/browser/config/mozconfigs/win64/debug-qr b/browser/config/mozconfigs/win64/debug-qr new file mode 100644 index 000000000000..1f0a11eaebc8 --- /dev/null +++ b/browser/config/mozconfigs/win64/debug-qr @@ -0,0 +1,3 @@ +. "$topsrcdir/browser/config/mozconfigs/win64/debug" + +ac_add_options --enable-webrender diff --git a/browser/config/mozconfigs/win64/opt-qr b/browser/config/mozconfigs/win64/opt-qr new file mode 100644 index 000000000000..4617559f8148 --- /dev/null +++ b/browser/config/mozconfigs/win64/opt-qr @@ -0,0 +1,3 @@ +. "$topsrcdir/browser/config/mozconfigs/win64/nightly" + +ac_add_options --enable-webrender From f4d5f20a6030afd0a4781037e9727ef2634a1b52 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:54 -0500 Subject: [PATCH 67/70] Bug 1335748 - Enable QR builds on linux64 on m-c and graphics. r=kmoir MozReview-Commit-ID: EB6WjIiBARv --- taskcluster/ci/build/linux.yml | 52 +++++++++++++++++++ .../transforms/gecko_v2_whitelist.py | 2 + .../releng_sub_linux_configs/64_qr_debug.py | 45 ++++++++++++++++ .../releng_sub_linux_configs/64_qr_opt.py | 7 +++ .../mozharness/mozilla/building/buildbase.py | 2 + 5 files changed, 108 insertions(+) create mode 100644 testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_debug.py create mode 100644 testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_opt.py diff --git a/taskcluster/ci/build/linux.yml b/taskcluster/ci/build/linux.yml index b8d209e2e0ba..5848fca3bede 100644 --- a/taskcluster/ci/build/linux.yml +++ b/taskcluster/ci/build/linux.yml @@ -374,3 +374,55 @@ linux64-add-on-devel/opt: tooltool-downloads: public need-xvfb: true run-on-projects: [ 'mozilla-beta', 'mozilla-release', 'mozilla-esr45' ] + +linux64-qr/debug: + description: "Linux64 Debug QuantumRender" + index: + product: firefox + job-name: linux64-qr-debug + treeherder: + platform: linux64-qr/debug + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-linux + worker: + implementation: docker-worker + max-run-time: 36000 + run: + using: mozharness + actions: [get-secrets build check-test generate-build-stats update] + config: + - builds/releng_base_linux_64_builds.py + - balrog/production.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + custom-build-variant-cfg: qr-debug + tooltool-downloads: public + need-xvfb: true + run-on-projects: [ 'mozilla-central', 'graphics' ] + +linux64-qr/opt: + description: "Linux64 Opt QuantumRender" + index: + product: firefox + job-name: linux64-qr-opt + treeherder: + platform: linux64-qr/opt + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-linux + worker: + implementation: docker-worker + max-run-time: 36000 + run: + using: mozharness + actions: [get-secrets build check-test generate-build-stats update] + config: + - builds/releng_base_linux_64_builds.py + - balrog/production.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + custom-build-variant-cfg: qr-opt + tooltool-downloads: public + need-xvfb: true + run-on-projects: [ 'mozilla-central', 'graphics' ] diff --git a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py index 24a337d22e49..ea9c3ea1dae6 100644 --- a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py +++ b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py @@ -41,6 +41,8 @@ JOB_NAME_WHITELIST = set([ 'linux64-nightly-l10n-opt', 'linux64-opt', 'linux64-pgo', + 'linux64-qr-debug', + 'linux64-qr-opt', 'linux64-st-an-opt', 'linux64-stylo-debug', 'linux64-stylo-opt', diff --git a/testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_debug.py b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_debug.py new file mode 100644 index 000000000000..bf6e053154cb --- /dev/null +++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_debug.py @@ -0,0 +1,45 @@ +import os + +MOZ_OBJDIR = 'obj-firefox' + +config = { + 'default_actions': [ + 'clobber', + 'clone-tools', + 'checkout-sources', + 'setup-mock', + 'build', + 'upload-files', + 'sendchange', + 'check-test', + # 'generate-build-stats', + 'update', # decided by query_is_nightly() + ], + 'stage_platform': 'linux64-debug', + 'debug_build': True, + 'enable_signing': False, + 'enable_talos_sendchange': False, + #### 64 bit build specific ##### + 'env': { + 'MOZBUILD_STATE_PATH': os.path.join(os.getcwd(), '.mozbuild'), + 'MOZ_AUTOMATION': '1', + 'DISPLAY': ':2', + 'HG_SHARE_BASE_DIR': '/builds/hg-shared', + 'MOZ_OBJDIR': MOZ_OBJDIR, + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'CCACHE_DIR': '/builds/ccache', + 'CCACHE_COMPRESS': '1', + 'CCACHE_UMASK': '002', + 'LC_ALL': 'C', + 'XPCOM_DEBUG_BREAK': 'stack-and-abort', + # 64 bit specific + 'PATH': '/tools/buildbot/bin:/usr/local/bin:/usr/lib64/ccache:/bin:\ +/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/tools/git/bin:/tools/python27/bin:\ +/tools/python27-mercurial/bin:/home/cltbld/bin', + 'LD_LIBRARY_PATH': '/tools/gcc-4.3.3/installed/lib64:\ +%s/dist/bin' % (MOZ_OBJDIR,), + 'TINDERBOX_OUTPUT': '1', + }, + 'src_mozconfig': 'browser/config/mozconfigs/linux64/debug-qr', + ####################### +} diff --git a/testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_opt.py b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_opt.py new file mode 100644 index 000000000000..6e8a99a8a788 --- /dev/null +++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/64_qr_opt.py @@ -0,0 +1,7 @@ +import os + +MOZ_OBJDIR = 'obj-firefox' + +config = { + 'src_mozconfig': 'browser/config/mozconfigs/linux64/opt-qr', +} diff --git a/testing/mozharness/mozharness/mozilla/building/buildbase.py b/testing/mozharness/mozharness/mozilla/building/buildbase.py index 9e7a6e6acde1..6cd4a0c4ee04 100755 --- a/testing/mozharness/mozharness/mozilla/building/buildbase.py +++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py @@ -375,6 +375,8 @@ class BuildOptionParser(object): 'valgrind' : 'builds/releng_sub_%s_configs/%s_valgrind.py', 'artifact': 'builds/releng_sub_%s_configs/%s_artifact.py', 'debug-artifact': 'builds/releng_sub_%s_configs/%s_debug_artifact.py', + 'qr-debug': 'builds/releng_sub_%s_configs/%s_qr_debug.py', + 'qr-opt': 'builds/releng_sub_%s_configs/%s_qr_opt.py', } build_pool_cfg_file = 'builds/build_pool_specifics.py' branch_cfg_file = 'builds/branch_specifics.py' From a3871b75b28de206d41d2d98a57f919df7ae54c1 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:54 -0500 Subject: [PATCH 68/70] Bug 1335748 - Enable QR builds on macosx64 on m-c and graphics. r=kmoir MozReview-Commit-ID: BQDcraYBJy3 --- taskcluster/ci/build/macosx.yml | 50 +++++++++++++++++++ .../transforms/gecko_v2_whitelist.py | 2 + .../64_cross_qr_debug.py | 43 ++++++++++++++++ .../releng_sub_mac_configs/64_cross_qr_opt.py | 7 +++ .../mozharness/mozilla/building/buildbase.py | 2 + 5 files changed, 104 insertions(+) create mode 100644 testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_debug.py create mode 100644 testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_opt.py diff --git a/taskcluster/ci/build/macosx.yml b/taskcluster/ci/build/macosx.yml index 7e7fb79d420e..662d0ae450f1 100644 --- a/taskcluster/ci/build/macosx.yml +++ b/taskcluster/ci/build/macosx.yml @@ -44,3 +44,53 @@ macosx64/opt: script: "mozharness/scripts/fx_desktop_build.py" secrets: true tooltool-downloads: internal + +macosx64-qr/debug: + description: "MacOS X x64 QuantumRender" + index: + product: firefox + job-name: macosx64-qr-debug + treeherder: + platform: osx-10-7-qr/debug + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-macosx64 + worker: + implementation: docker-worker + max-run-time: 36000 + run: + using: mozharness + actions: [get-secrets build generate-build-stats update] + config: + - builds/releng_base_mac_64_cross_builds.py + - balrog/production.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + custom-build-variant-cfg: cross-qr-debug + tooltool-downloads: internal + run-on-projects: [ 'graphics' ] + +macosx64-qr/opt: + description: "MacOS X x64 QuantumRender" + index: + product: firefox + job-name: macosx64-qr-opt + treeherder: + platform: osx-10-7-qr/opt + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-macosx64 + worker: + implementation: docker-worker + max-run-time: 36000 + run: + using: mozharness + actions: [get-secrets build generate-build-stats update] + config: + - builds/releng_base_mac_64_cross_builds.py + - balrog/production.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + custom-build-variant-cfg: cross-qr-opt + tooltool-downloads: internal + run-on-projects: [ 'graphics' ] diff --git a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py index ea9c3ea1dae6..20d88c752681 100644 --- a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py +++ b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py @@ -57,6 +57,8 @@ JOB_NAME_WHITELIST = set([ 'macosx64-clang-tidy', 'macosx64-debug', 'macosx64-opt', + 'macosx64-qr-debug', + 'macosx64-qr-opt', 'macosx64-st-an-opt', 'nexus-5-l-eng-debug', 'nexus-5-l-eng-opt', diff --git a/testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_debug.py b/testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_debug.py new file mode 100644 index 000000000000..f461d54f3ad2 --- /dev/null +++ b/testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_debug.py @@ -0,0 +1,43 @@ +import os + +MOZ_OBJDIR = 'obj-firefox' + +config = { + 'default_actions': [ + 'clobber', + 'clone-tools', + 'checkout-sources', + # 'setup-mock', + 'build', + 'upload-files', + 'sendchange', + # 'generate-build-stats', + 'update', # decided by query_is_nightly() + ], + 'stage_platform': 'macosx64-debug', + 'debug_build': True, + 'objdir': 'obj-firefox', + 'enable_talos_sendchange': False, + #### 64 bit build specific ##### + 'env': { + 'MOZBUILD_STATE_PATH': os.path.join(os.getcwd(), '.mozbuild'), + 'MOZ_AUTOMATION': '1', + 'HG_SHARE_BASE_DIR': '/builds/hg-shared', + 'MOZ_OBJDIR': 'obj-firefox', + 'TINDERBOX_OUTPUT': '1', + 'TOOLTOOL_CACHE': '/builds/tooltool_cache', + 'TOOLTOOL_HOME': '/builds', + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'CCACHE_DIR': '/builds/ccache', + 'CCACHE_COMPRESS': '1', + 'CCACHE_UMASK': '002', + 'LC_ALL': 'C', + 'XPCOM_DEBUG_BREAK': 'stack-and-abort', + ## 64 bit specific + 'PATH': '/tools/python/bin:/tools/buildbot/bin:/opt/local/bin:/usr/bin:' + '/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin', + ## + }, + 'src_mozconfig': 'browser/config/mozconfigs/macosx64/debug-qr', + ####################### +} diff --git a/testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_opt.py b/testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_opt.py new file mode 100644 index 000000000000..6d9d1e49069e --- /dev/null +++ b/testing/mozharness/configs/builds/releng_sub_mac_configs/64_cross_qr_opt.py @@ -0,0 +1,7 @@ +import os + +MOZ_OBJDIR = 'obj-firefox' + +config = { + 'src_mozconfig': 'browser/config/mozconfigs/macosx64/opt-qr', +} diff --git a/testing/mozharness/mozharness/mozilla/building/buildbase.py b/testing/mozharness/mozharness/mozilla/building/buildbase.py index 6cd4a0c4ee04..7faf2117a96e 100755 --- a/testing/mozharness/mozharness/mozilla/building/buildbase.py +++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py @@ -350,6 +350,8 @@ class BuildOptionParser(object): 'cross-debug': 'builds/releng_sub_%s_configs/%s_cross_debug.py', 'cross-opt-st-an': 'builds/releng_sub_%s_configs/%s_cross_opt_st_an.py', 'cross-universal': 'builds/releng_sub_%s_configs/%s_cross_universal.py', + 'cross-qr-debug': 'builds/releng_sub_%s_configs/%s_cross_qr_debug.py', + 'cross-qr-opt': 'builds/releng_sub_%s_configs/%s_cross_qr_opt.py', 'debug': 'builds/releng_sub_%s_configs/%s_debug.py', 'asan-and-debug': 'builds/releng_sub_%s_configs/%s_asan_and_debug.py', 'asan-tc-and-debug': 'builds/releng_sub_%s_configs/%s_asan_tc_and_debug.py', From cfaa530dc3d72e7792f35da8eecf77d643294579 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:42:54 -0500 Subject: [PATCH 69/70] Bug 1335748 - Enable QR builds on win64 on m-c and graphics. r=kmoir MozReview-Commit-ID: KDYwa748wkz --- taskcluster/ci/build/windows.yml | 40 +++++++++ .../transforms/gecko_v2_whitelist.py | 2 + .../taskcluster_firefox_win64_qr_debug.py | 87 +++++++++++++++++++ .../taskcluster_firefox_win64_qr_opt.py | 85 ++++++++++++++++++ 4 files changed, 214 insertions(+) create mode 100644 testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_debug.py create mode 100644 testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_opt.py diff --git a/taskcluster/ci/build/windows.yml b/taskcluster/ci/build/windows.yml index 50537b9b17e1..9767fe60cc07 100644 --- a/taskcluster/ci/build/windows.yml +++ b/taskcluster/ci/build/windows.yml @@ -113,3 +113,43 @@ win64/pgo: script: mozharness/scripts/fx_desktop_build.py config: - builds/taskcluster_firefox_windows_64_opt.py + +win64-qr/debug: + description: "Win64 Debug QuantumRender" + index: + product: firefox + job-name: win64-qr-debug + treeherder: + platform: windows2012-64-qr/debug + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-win2012 + worker: + implementation: generic-worker + max-run-time: 7200 + run: + using: mozharness + script: mozharness/scripts/fx_desktop_build.py + config: + - builds/taskcluster_firefox_win64_qr_debug.py + run-on-projects: [ 'graphics' ] + +win64-qr/opt: + description: "Win64 Opt QuantumRender" + index: + product: firefox + job-name: win64-qr-opt + treeherder: + platform: windows2012-64-qr/opt + symbol: tc(B) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-win2012 + worker: + implementation: generic-worker + max-run-time: 7200 + run: + using: mozharness + script: mozharness/scripts/fx_desktop_build.py + config: + - builds/taskcluster_firefox_win64_qr_opt.py + run-on-projects: [ 'graphics' ] diff --git a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py index 20d88c752681..e8708e43c8ea 100644 --- a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py +++ b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py @@ -88,6 +88,8 @@ JOB_NAME_WHITELIST = set([ 'win64-debug', 'win64-opt', 'win64-pgo', + 'win64-qr-debug', + 'win64-qr-opt', ]) JOB_NAME_WHITELIST_ERROR = """\ diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_debug.py b/testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_debug.py new file mode 100644 index 000000000000..4f7ba0b0aea6 --- /dev/null +++ b/testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_debug.py @@ -0,0 +1,87 @@ +import os +import sys + +config = { + ######################################################################### + ######## WINDOWS GENERIC CONFIG KEYS/VAlUES + # if you are updating this with custom 64 bit keys/values please add them + # below under the '64 bit specific' code block otherwise, update in this + # code block and also make sure this is synced between: + # - taskcluster_firefox_win32_debug + # - taskcluster_firefox_win32_opt + # - taskcluster_firefox_win64_debug + # - taskcluster_firefox_win64_opt + + 'default_actions': [ + 'clone-tools', + 'build', + 'check-test', + ], + 'exes': { + 'python2.7': sys.executable, + 'make': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'build', 'pymake', 'make.py' + ) + ], + 'virtualenv': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'python', 'virtualenv', 'virtualenv.py' + ) + ], + 'mach-build': [ + os.path.join(os.environ['MOZILLABUILD'], 'msys', 'bin', 'bash.exe'), + os.path.join(os.getcwd(), 'build', 'src', 'mach'), + '--log-no-times', 'build', '-v' + ], + }, + 'app_ini_path': '%(obj_dir)s/dist/bin/application.ini', + # decides whether we want to use moz_sign_cmd in env + 'enable_signing': True, + 'enable_ccache': False, + 'vcs_share_base': os.path.join('y:', os.sep, 'hg-shared'), + 'objdir': 'obj-firefox', + 'tooltool_script': [ + sys.executable, + os.path.join(os.environ['MOZILLABUILD'], 'tooltool.py') + ], + 'tooltool_bootstrap': 'setup.sh', + 'enable_count_ctors': False, + 'max_build_output_timeout': 60 * 80, + ######################################################################### + + + ######################################################################### + ###### 64 bit specific ###### + 'base_name': 'WINNT_6.1_x86-64_%(branch)s', + 'platform': 'win64', + 'stage_platform': 'win64-debug', + 'debug_build': True, + 'publish_nightly_en_US_routes': True, + 'env': { + 'HG_SHARE_BASE_DIR': os.path.join('y:', os.sep, 'hg-shared'), + 'MOZ_AUTOMATION': '1', + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'MOZ_OBJDIR': 'obj-firefox', + 'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/srcsrv/pdbstr.exe', + 'TINDERBOX_OUTPUT': '1', + 'TOOLTOOL_CACHE': '/c/builds/tooltool_cache', + 'TOOLTOOL_HOME': '/c/builds', + 'XPCOM_DEBUG_BREAK': 'stack-and-abort', + 'MSYSTEM': 'MINGW32', + }, + 'upload_env': { + 'UPLOAD_HOST': 'localhost', + 'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'), + }, + "check_test_env": { + 'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win64\\minidump_stackwalk.exe', + 'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps', + }, + 'enable_pymake': True, + 'src_mozconfig': 'browser\\config\\mozconfigs\\win64\\debug-qr', + 'tooltool_manifest_src': 'browser\\config\\tooltool-manifests\\win64\\releng.manifest', + ######################################################################### +} diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_opt.py b/testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_opt.py new file mode 100644 index 000000000000..4210b1971686 --- /dev/null +++ b/testing/mozharness/configs/builds/taskcluster_firefox_win64_qr_opt.py @@ -0,0 +1,85 @@ +import os +import sys + +config = { + ######################################################################### + ######## WINDOWS GENERIC CONFIG KEYS/VAlUES + # if you are updating this with custom 64 bit keys/values please add them + # below under the '64 bit specific' code block otherwise, update in this + # code block and also make sure this is synced between: + # - taskcluster_firefox_win32_debug + # - taskcluster_firefox_win32_opt + # - taskcluster_firefox_win64_debug + # - taskcluster_firefox_win64_opt + + 'default_actions': [ + 'clone-tools', + 'build', + 'check-test', + ], + 'exes': { + 'python2.7': sys.executable, + 'make': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'build', 'pymake', 'make.py' + ) + ], + 'virtualenv': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'python', 'virtualenv', 'virtualenv.py' + ) + ], + 'mach-build': [ + os.path.join(os.environ['MOZILLABUILD'], 'msys', 'bin', 'bash.exe'), + os.path.join(os.getcwd(), 'build', 'src', 'mach'), + '--log-no-times', 'build', '-v' + ], + }, + 'app_ini_path': '%(obj_dir)s/dist/bin/application.ini', + # decides whether we want to use moz_sign_cmd in env + 'enable_signing': True, + 'enable_ccache': False, + 'vcs_share_base': os.path.join('y:', os.sep, 'hg-shared'), + 'objdir': 'obj-firefox', + 'tooltool_script': [ + sys.executable, + os.path.join(os.environ['MOZILLABUILD'], 'tooltool.py') + ], + 'tooltool_bootstrap': 'setup.sh', + 'enable_count_ctors': False, + 'max_build_output_timeout': 60 * 80, + ######################################################################### + + + ######################################################################### + ###### 64 bit specific ###### + 'base_name': 'WINNT_6.1_x86-64_%(branch)s', + 'platform': 'win64', + 'stage_platform': 'win64', + 'publish_nightly_en_US_routes': True, + 'env': { + 'HG_SHARE_BASE_DIR': os.path.join('y:', os.sep, 'hg-shared'), + 'MOZ_AUTOMATION': '1', + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'MOZ_OBJDIR': 'obj-firefox', + 'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/srcsrv/pdbstr.exe', + 'TINDERBOX_OUTPUT': '1', + 'TOOLTOOL_CACHE': '/c/builds/tooltool_cache', + 'TOOLTOOL_HOME': '/c/builds', + 'MSYSTEM': 'MINGW32', + }, + 'upload_env': { + 'UPLOAD_HOST': 'localhost', + 'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'), + }, + "check_test_env": { + 'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win64\\minidump_stackwalk.exe', + 'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps', + }, + 'enable_pymake': True, + 'src_mozconfig': 'browser\\config\\mozconfigs\\win64\\opt-qr', + 'tooltool_manifest_src': 'browser\\config\\tooltool-manifests\\win64\\releng.manifest', + ######################################################################### +} From 83e293796336b05769e9eebb27a56337180db94c Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 6 Feb 2017 11:51:14 -0500 Subject: [PATCH 70/70] Bug 1335748 - Enable a subset of test suites on Linux64 QR builds. r=dustin a=sheriffs for landing on m-c MozReview-Commit-ID: 21HebRtPfU8 --- taskcluster/ci/test/test-platforms.yml | 12 +++++++++++ taskcluster/ci/test/test-sets.yml | 11 ++++++++++ taskcluster/ci/test/tests.yml | 29 +++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/taskcluster/ci/test/test-platforms.yml b/taskcluster/ci/test/test-platforms.yml index b810dbbc0284..fd6d9c0c13e3 100644 --- a/taskcluster/ci/test/test-platforms.yml +++ b/taskcluster/ci/test/test-platforms.yml @@ -69,6 +69,18 @@ linux64-stylo/opt: - stylo-tests - talos +# QR builds just run a subset right now. Note that the tests in this +# test set are further restricted in tests.yml to run on certain projects +# only, to avoid adding too much infra load. +linux64-qr/opt: + build-platform: linux64-qr/opt + test-sets: + - qr-tests +linux64-qr/debug: + build-platform: linux64-qr/debug + test-sets: + - qr-tests + linux64-ccov/opt: build-platform: linux64-ccov/opt test-sets: diff --git a/taskcluster/ci/test/test-sets.yml b/taskcluster/ci/test/test-sets.yml index d6b48417130e..f97886d81344 100644 --- a/taskcluster/ci/test/test-sets.yml +++ b/taskcluster/ci/test/test-sets.yml @@ -71,6 +71,17 @@ stylo-tests: - reftest-stylo - mochitest-style +qr-tests: + - cppunit + - crashtest + - gtest + - jittest + - jsreftest + - mochitest-a11y + - reftest + - reftest-no-accel + - xpcshell + ccov-code-coverage-tests: - crashtest - jsreftest diff --git a/taskcluster/ci/test/tests.yml b/taskcluster/ci/test/tests.yml index 1bb3ef02369b..9a63e406af86 100644 --- a/taskcluster/ci/test/tests.yml +++ b/taskcluster/ci/test/tests.yml @@ -14,6 +14,7 @@ cppunit: run-on-projects: by-test-platform: windows.*: ['mozilla-central', 'try'] + linux64-qr/.*: ['graphics'] default: ['all'] mozharness: by-test-platform: @@ -51,6 +52,10 @@ crashtest: android.*: xlarge default: default docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + linux64-qr/.*: ['graphics', 'mozilla-central'] + default: ['all'] chunks: by-test-platform: android-4.3-arm7-api-15/debug: 10 @@ -198,6 +203,10 @@ gtest: e10s: false instance-size: xlarge docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + linux64-qr/.*: ['graphics'] + default: ['all'] mozharness: script: desktop_unittest.py no-read-buildbot-config: true @@ -220,6 +229,10 @@ jittest: treeherder-symbol: tc(Jit) e10s: false docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + linux64-qr/.*: ['graphics'] + default: ['all'] chunks: by-test-platform: windows.*: 1 @@ -269,6 +282,7 @@ jsreftest: run-on-projects: by-test-platform: windows.*: ['mozilla-central', 'try'] + linux64-qr/.*: ['graphics', 'mozilla-central'] default: ['all'] mozharness: by-test-platform: @@ -401,6 +415,10 @@ mochitest-a11y: loopback-video: true e10s: false docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + linux64-qr/.*: ['graphics'] + default: ['all'] mozharness: script: desktop_unittest.py no-read-buildbot-config: true @@ -871,6 +889,10 @@ reftest: suite: reftest/reftest treeherder-symbol: tc-R(R) docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + linux64-qr/.*: ['graphics', 'mozilla-central'] + default: ['all'] instance-size: by-test-platform: android.*: xlarge @@ -921,6 +943,10 @@ reftest-no-accel: suite: reftest/reftest-no-accel treeherder-symbol: tc-R(Ru) docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + linux64-qr/.*: ['graphics', 'mozilla-central'] + default: ['all'] chunks: by-test-platform: macosx.*: 1 @@ -1233,6 +1259,7 @@ xpcshell: run-on-projects: by-test-platform: linux64-jsdcov/opt: [] + linux64-qr/.*: ['graphics'] default: ['all'] chunks: by-test-platform: @@ -1281,4 +1308,4 @@ xpcshell: linux64-jsdcov/opt: - --xpcshell-suite=xpcshell-coverage default: - - --xpcshell-suite=xpcshell \ No newline at end of file + - --xpcshell-suite=xpcshell